Integration der WinCC OA Project Admin Extension mit GitHub Copilot via Language Model Tools API. Dies ermöglicht AI-Assistenten autonomen Zugriff auf Projekt-Management-Funktionen.
Version: 2.0.0 (Major - neue AI Integration) Referenzen: LogViewer v2.0.0, Script Actions v2.0.0
- Autonomer Projekt-Zugriff: Copilot kann Projekte auflisten, starten, stoppen
- Status-Abfragen: Echtzeit-Informationen über PMON/Manager-Status
- Projekt-Management: Register/Unregister via Natural Language
- Manager-Steuerung: Start/Stop von einzelnen Managern
// src/languageModelTools.ts
export class LanguageModelToolsService {
private disposables: vscode.Disposable[] = [];
register(context: vscode.ExtensionContext): void {
// Register tools via vscode.lm.registerTool()
this.disposables.push(
vscode.lm.registerTool('tool_name', new ToolClass())
);
}
dispose(): void {
this.disposables.forEach(d => d.dispose());
}
}{
"contributes": {
"languageModelTools": [
{
"name": "tool_name",
"displayName": "Human-Readable Name",
"modelDescription": "Description for AI (when to use this tool)",
"canBeReferencedInPrompt": true,
"toolReferenceName": "short_name",
"icon": "$(icon-name)",
"userDescription": "Description for users",
"inputSchema": {
"type": "object",
"properties": { /* JSON Schema */ },
"required": ["field1", "field2"]
}
}
]
}
}class MyTool implements vscode.LanguageModelTool<MyInput> {
async invoke(
options: vscode.LanguageModelToolInvocationOptions<MyInput>,
_token: vscode.CancellationToken
): Promise<vscode.LanguageModelToolResult> {
try {
const input = options.input;
// Business logic here
return new vscode.LanguageModelToolResult([
new vscode.LanguageModelTextPart(
JSON.stringify({ success: true, data: result }, null, 2)
)
]);
} catch (error) {
return new vscode.LanguageModelToolResult([
new vscode.LanguageModelTextPart(
JSON.stringify({
success: false,
error: error.message
}, null, 2)
)
]);
}
}
}Zweck: Liste alle registrierten WinCC OA Projekte mit Status
Input Schema:
{
"type": "object",
"properties": {
"includeSubprojects": {
"type": "boolean",
"description": "Include subproject information (default: false)"
},
"statusFilter": {
"type": "string",
"enum": ["all", "running", "stopped", "error"],
"description": "Filter by project status (default: 'all')"
}
}
}Output Example:
{
"success": true,
"projects": [
{
"id": "MyProject",
"name": "MyProject",
"version": "3.21",
"status": "running",
"path": "C:/Projects/MyProject",
"subprojects": ["SubProj1", "SubProj2"]
}
]
}Use Case:
- "Show me all running WinCC OA projects"
- "Which projects are registered?"
- "List all projects with version 3.19"
Zweck: Detaillierte Informationen über ein spezifisches Projekt
Input Schema:
{
"type": "object",
"properties": {
"projectId": {
"type": "string",
"description": "Project ID or name"
}
},
"required": ["projectId"]
}Output Example:
{
"success": true,
"project": {
"id": "MyProject",
"name": "MyProject",
"version": "3.21",
"status": "running",
"projectDir": "C:/Projects/MyProject",
"installDir": "C:/Siemens/Automation/WinCC_OA/3.21",
"configPath": "C:/Projects/MyProject/config/config",
"subprojects": ["SubProj1", "SubProj2"],
"pmonStatus": {
"running": true,
"startTime": "2026-01-24T10:30:00Z"
}
}
}Use Case:
- "What version is MyProject using?"
- "Show me details about the DevEnv project"
- "Where is MyProject installed?"
Zweck: Registriere ein neues WinCC OA Projekt
Input Schema:
{
"type": "object",
"properties": {
"projectPath": {
"type": "string",
"description": "Absolute path to project directory"
},
"autoDetectVersion": {
"type": "boolean",
"description": "Auto-detect version from config file (default: true)"
},
"version": {
"type": "string",
"description": "WinCC OA version (e.g., '3.21'), required if autoDetectVersion=false"
}
},
"required": ["projectPath"]
}Output Example:
{
"success": true,
"message": "Project 'MyProject' registered successfully",
"projectId": "MyProject",
"version": "3.21"
}Use Case:
- "Register the project at C:/Projects/NewProject"
- "Add the WinCC OA project in D:/WinCCProjects/Test"
Zweck: Deregistriere ein WinCC OA Projekt
Input Schema:
{
"type": "object",
"properties": {
"projectId": {
"type": "string",
"description": "Project ID to unregister"
},
"stopIfRunning": {
"type": "boolean",
"description": "Stop project if currently running (default: true)"
}
},
"required": ["projectId"]
}Output Example:
{
"success": true,
"message": "Project 'OldProject' unregistered successfully",
"wasStopped": true
}Use Case:
- "Unregister the OldProject"
- "Remove TestProject from registry"
Zweck: Starte PMON für ein Projekt (inklusive aller Manager)
Input Schema:
{
"type": "object",
"properties": {
"projectId": {
"type": "string",
"description": "Project ID to start"
},
"waitForStartup": {
"type": "boolean",
"description": "Wait for PMON to fully start (default: false)"
}
},
"required": ["projectId"]
}Output Example:
{
"success": true,
"message": "Project 'MyProject' started successfully",
"pmonStatus": "running"
}Use Case:
- "Start the MyProject"
- "Launch DevEnv project"
Zweck: Stoppe PMON für ein Projekt
Input Schema:
{
"type": "object",
"properties": {
"projectId": {
"type": "string",
"description": "Project ID to stop"
},
"timeout": {
"type": "number",
"description": "Timeout in seconds (default: 10)"
}
},
"required": ["projectId"]
}Output Example:
{
"success": true,
"message": "Project 'MyProject' stopped successfully"
}Use Case:
- "Stop the MyProject"
- "Shutdown DevEnv"
Zweck: PMON Status-Abfrage für ein Projekt
Input Schema:
{
"type": "object",
"properties": {
"projectId": {
"type": "string",
"description": "Project ID to check"
}
},
"required": ["projectId"]
}Output Example:
{
"success": true,
"projectId": "MyProject",
"pmonStatus": {
"running": true,
"startTime": "2026-01-24T10:30:00Z",
"uptime": "3h 45m",
"mode": "normal"
}
}Use Case:
- "Is MyProject running?"
- "Check PMON status for DevEnv"
Zweck: Liste alle Manager eines Projekts
Input Schema:
{
"type": "object",
"properties": {
"projectId": {
"type": "string",
"description": "Project ID (uses current project if not specified)"
},
"statusFilter": {
"type": "string",
"enum": ["all", "running", "stopped"],
"description": "Filter by manager status (default: 'all')"
}
}
}Output Example:
{
"success": true,
"projectId": "MyProject",
"managers": [
{
"name": "DIST_1",
"num": 1,
"state": "running",
"mode": "always",
"secKill": 30,
"restartCount": 2
},
{
"name": "EVENT_1",
"num": 2,
"state": "running",
"mode": "manual"
}
]
}Use Case:
- "Show all managers in MyProject"
- "Which managers are running?"
- "List stopped managers"
Zweck: Starte einen einzelnen Manager
Input Schema:
{
"type": "object",
"properties": {
"projectId": {
"type": "string",
"description": "Project ID (uses current project if not specified)"
},
"managerNum": {
"type": "number",
"description": "Manager number (e.g., 1 for DIST_1)"
}
},
"required": ["managerNum"]
}Output Example:
{
"success": true,
"message": "Manager DIST_1 started successfully"
}Use Case:
- "Start manager DIST_1"
- "Launch the Event manager"
Zweck: Stoppe einen einzelnen Manager
Input Schema:
{
"type": "object",
"properties": {
"projectId": {
"type": "string",
"description": "Project ID (uses current project if not specified)"
},
"managerNum": {
"type": "number",
"description": "Manager number"
}
},
"required": ["managerNum"]
}Output Example:
{
"success": true,
"message": "Manager EVENT_1 stopped successfully"
}Use Case:
- "Stop manager EVENT_1"
- "Kill the UI manager"
Zweck: Restart einen Manager (Stop + Start)
Input Schema:
{
"type": "object",
"properties": {
"projectId": {
"type": "string",
"description": "Project ID (uses current project if not specified)"
},
"managerNum": {
"type": "number",
"description": "Manager number"
}
},
"required": ["managerNum"]
}Output Example:
{
"success": true,
"message": "Manager CTRL_1 restarted successfully"
}Use Case:
- "Restart manager CTRL_1"
- "Reload the Data manager"
| Priority | Tool Name | Category | Complexity | Impact |
|---|---|---|---|---|
| P0 | winccoa_list_projects |
Project Mgmt | Low | High |
| P0 | winccoa_get_project_info |
Project Mgmt | Low | High |
| P0 | winccoa_start_project |
PMON Control | Medium | High |
| P0 | winccoa_stop_project |
PMON Control | Medium | High |
| P1 | winccoa_get_pmon_status |
PMON Control | Low | Medium |
| P1 | winccoa_list_managers |
Manager Control | Medium | High |
| P2 | winccoa_start_manager |
Manager Control | Medium | Medium |
| P2 | winccoa_stop_manager |
Manager Control | Medium | Medium |
| P2 | winccoa_restart_manager |
Manager Control | Medium | Medium |
| P3 | winccoa_register_project |
Project Mgmt | High | Low |
| P3 | winccoa_unregister_project |
Project Mgmt | High | Low |
Gesamt: 11 Tools (6 P0/P1, 3 P2, 2 P3)
User: "Show me all WinCC OA projects and their status"
Copilot:
1. Calls: winccoa_list_projects({ statusFilter: "all" })
2. Presents: Table with project names, versions, status
User: "Start the DevEnv project"
Copilot:
1. Calls: winccoa_get_project_info({ projectId: "DevEnv" })
2. Checks: Status is "stopped"
3. Calls: winccoa_start_project({ projectId: "DevEnv", waitForStartup: true })
4. Confirms: "Project started successfully"
User: "Which managers are running in MyProject?"
Copilot:
1. Calls: winccoa_list_managers({ projectId: "MyProject", statusFilter: "running" })
2. Presents: List of running managers with numbers
User: "Restart the CTRL manager in MyProject"
Copilot:
1. Calls: winccoa_list_managers({ projectId: "MyProject" })
2. Finds: CTRL_1 has num=5
3. Calls: winccoa_restart_manager({ projectId: "MyProject", managerNum: 5 })
4. Confirms: "Manager restarted"
User: "Register the project at C:/Projects/NewProj"
Copilot:
1. Calls: winccoa_register_project({
projectPath: "C:/Projects/NewProj",
autoDetectVersion: true
})
2. Confirms: "Project 'NewProj' registered with version 3.21"
- Create
src/languageModelTools.ts - Implement
LanguageModelToolsServicebase class - Add registration in
extension.ts - Update
package.jsonwithlanguageModelToolscontributions
-
winccoa_list_projects -
winccoa_get_project_info -
winccoa_start_project -
winccoa_stop_project
-
winccoa_get_pmon_status -
winccoa_list_managers
-
winccoa_start_manager -
winccoa_stop_manager -
winccoa_restart_manager
-
winccoa_register_project -
winccoa_unregister_project
- Integration Tests mit GitHub Copilot
- User Documentation
- Update CHANGELOG.md für v2.0.0
- Release Notes
Tools wie winccoa_stop_project, winccoa_unregister_project sind destructive.
Mitigation:
- Confirmation Dialogs vor Ausführung
- Clear warnings in
modelDescription - Read-only mode toggle in settings
winccoa_register_project nimmt User-Paths entgegen.
Mitigation:
- Validate path exists
- Check for valid
config/configfile - Prevent directory traversal attacks
PMON-Calls können fehlschlagen (z.B. Permission denied, Version mismatch).
Mitigation:
- Try/Catch um alle PMON-Calls
- Detaillierte Error-Messages
- Graceful degradation
- Tool Invocation Success Rate: >95%
- Average Response Time: <500ms
- Error Rate: <2%
- Tool Discovery: 80% of users try at least one tool in first week
- Repeat Usage: 50% of users use tools 5+ times per week
- User Satisfaction: >4.5/5 stars
RichardJanisch.winccoa-project-admin(this extension)- VS Code Engine:
^1.107.1(Language Model Tools API)
@winccoa-tools-pack/npm-winccoa-core(existing dependency)
vscode.lm.registerTool()(VS Code 1.107+)vscode.LanguageModelToolinterfacevscode.LanguageModelToolResultclass
- README.md: Add "AI Integration" section
- GitHub Wiki: Create "Using with GitHub Copilot" page
- Examples: Sample prompts for each tool
- Architecture.md: Document Language Model Tools design
- API.md: Tool schemas and response formats
- Testing.md: How to test tools with Copilot
- Minimum VS Code Version: Bump to 1.107.1
- Activation Events: Add Language Model Tool activation
- v1.x users auto-upgrade (no config changes needed)
- New tools are opt-in (work alongside existing UI)
- Beta: Limited user group (internal testing)
- RC: Public release candidate (1 week)
- GA: General Availability
- Monitoring: Track tool usage metrics
winccoa_get_datapoint_value- Datapoint value querieswinccoa_set_datapoint_value- Write to datapointswinccoa_get_alarms- Query alarm listwinccoa_export_project_config- Export project configuration
- Batch Operations: Start/stop multiple managers at once
- Scheduled Tasks: Schedule PMON restarts
- Health Monitoring: Automatic issue detection
- Performance Metrics: CPU/Memory usage via tools
- All P0 tools implemented and tested
- Package.json contributions complete
- Basic documentation available
- Integration tests pass with GitHub Copilot
- All P0-P2 tools implemented
- Comprehensive error handling
- Full documentation (user + developer)
- Performance benchmarks met
- Security review completed
- Product Owner: Approve tool selection
- Engineering Lead: Approve architecture
- Security Team: Approve security mitigations
- Documentation Team: Approve docs plan
Document Version: 1.0 Last Updated: 2026-01-24 Author: GitHub Copilot Analysis Status: 🟡 Planning Phase