plugin-agent-orchestrator 1.0.27 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/dist/client/index.js +1 -1
- package/dist/client-v2/{214.723affb37c13bf7a.js → 214.79650a549273f163.js} +1 -1
- package/dist/client-v2/264.718a107e43fc163c.js +10 -0
- package/dist/client-v2/373.f5d5292e53c4e832.js +10 -0
- package/dist/client-v2/{41.1805b2edfaa4afe2.js → 41.ba6e080cc0488143.js} +1 -1
- package/dist/client-v2/418.29e713f79131eece.js +10 -0
- package/dist/client-v2/619.bd3c5698b40705c3.js +10 -0
- package/dist/client-v2/677.a991ce0250ff5c77.js +10 -0
- package/dist/client-v2/{70.a15d7fcec7c41768.js → 70.bda9518881c05360.js} +1 -1
- package/dist/client-v2/925.f5370de8f6632d65.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +7 -10
- package/dist/locale/en-US.json +94 -25
- package/dist/locale/vi-VN.json +94 -25
- package/dist/locale/zh-CN.json +94 -25
- package/dist/server/collections/agent-execution-spans.js +37 -0
- package/dist/server/collections/agent-harness-profiles.js +2 -2
- package/dist/server/collections/agent-memory-contexts.js +125 -0
- package/dist/server/collections/orchestrator-logs.js +2 -2
- package/dist/server/migrations/20260425000000-add-interaction-schema.js +3 -1
- package/dist/server/migrations/20260427000000-change-packages-to-text.js +3 -1
- package/dist/server/migrations/20260427000001-change-other-json-to-text.js +6 -2
- package/dist/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.js +21 -19
- package/dist/server/migrations/20260621000000-native-policy-profile-defaults.js +193 -0
- package/dist/server/plugin.js +128 -74
- package/dist/server/resources/agent-monitor.js +454 -0
- package/dist/server/services/AgentHarness.js +24 -499
- package/dist/server/services/AgentMemoryContextService.js +216 -0
- package/dist/server/services/ExecutionSpanService.js +2 -2
- package/dist/server/services/NativeSubAgentObserver.js +413 -0
- package/dist/server/skill-hub/mcp/McpController.js +16 -5
- package/dist/server/skill-hub/plugin.js +81 -5
- package/dist/server/skill-hub/tasks/SkillExecutionTask.js +9 -3
- package/dist/server/tools/delegate-task.js +11 -589
- package/dist/server/utils/skill-settings.js +18 -1
- package/package.json +47 -49
- package/src/client/AIEmployeesContext.tsx +5 -18
- package/src/client/AgentRunsTab.tsx +2 -771
- package/src/client/HarnessProfilesTab.tsx +2 -257
- package/src/client/OrchestratorSettings.tsx +97 -106
- package/src/client/RulesTab.tsx +2 -788
- package/src/client/plugin.tsx +0 -2
- package/src/client/skill-hub/components/ExecutionHistory.tsx +200 -202
- package/src/client/skill-hub/components/ExecutionProgress.tsx +51 -55
- package/src/client/skill-hub/components/LoopSettings.tsx +331 -331
- package/src/client/skill-hub/components/SkillEditor.tsx +43 -39
- package/src/client/skill-hub/components/SkillManager.tsx +194 -181
- package/src/client/skill-hub/components/SkillTestPanel.tsx +141 -145
- package/src/client/skill-hub/locale.ts +16 -16
- package/src/client/skill-hub/tools/SkillHubCard.tsx +104 -109
- package/src/client/skill-hub/tools/loopTemplates.ts +52 -52
- package/src/client/skill-hub/utils/jsonFields.ts +7 -3
- package/src/client-v2/components/AIEmployeesContext.tsx +3 -16
- package/src/client-v2/components/AgentRunsTab.tsx +182 -455
- package/src/client-v2/components/HarnessProfilesTab.tsx +34 -31
- package/src/client-v2/components/RulesTab.tsx +2 -782
- package/src/client-v2/components/TracingTab.tsx +1 -1
- package/src/client-v2/hooks/useApiRequest.ts +8 -1
- package/src/client-v2/pages/RulesPage.tsx +2 -2
- package/src/client-v2/plugin.tsx +3 -3
- package/src/locale/en-US.json +94 -25
- package/src/locale/vi-VN.json +94 -25
- package/src/locale/zh-CN.json +94 -25
- package/src/server/__tests__/native-sub-agent-observer.test.ts +246 -0
- package/src/server/__tests__/skill-settings.test.ts +6 -6
- package/src/server/__tests__/smoke.test.ts +1 -0
- package/src/server/collections/agent-execution-spans.ts +37 -0
- package/src/server/collections/agent-harness-profiles.ts +59 -59
- package/src/server/collections/agent-loop-events.ts +71 -71
- package/src/server/collections/agent-loop-steps.ts +144 -144
- package/src/server/collections/agent-memory-contexts.ts +95 -0
- package/src/server/collections/orchestrator-logs.ts +4 -4
- package/src/server/collections/skill-definitions.ts +111 -111
- package/src/server/collections/skill-executions.ts +106 -106
- package/src/server/collections/skill-loop-configs.ts +65 -65
- package/src/server/migrations/20260423000000-add-progress-fields.ts +14 -14
- package/src/server/migrations/20260425000000-add-interaction-schema.ts +3 -1
- package/src/server/migrations/20260427000000-change-packages-to-text.ts +4 -2
- package/src/server/migrations/20260427000001-change-other-json-to-text.ts +9 -5
- package/src/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.ts +30 -30
- package/src/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.ts +145 -142
- package/src/server/migrations/20260615000000-normalize-ai-employee-tool-bindings.ts +2 -2
- package/src/server/migrations/20260621000000-native-policy-profile-defaults.ts +193 -0
- package/src/server/plugin.ts +151 -94
- package/src/server/resources/agent-monitor.ts +482 -0
- package/src/server/services/AgentHarness.ts +38 -623
- package/src/server/services/AgentMemoryContextService.ts +256 -0
- package/src/server/services/AgentPlanValidator.ts +73 -73
- package/src/server/services/ExecutionSpanService.ts +6 -2
- package/src/server/services/FileManager.ts +144 -144
- package/src/server/services/NativeSubAgentObserver.ts +507 -0
- package/src/server/services/SkillManager.ts +583 -583
- package/src/server/services/SkillRepositoryService.ts +5 -7
- package/src/server/services/TokenTracker.ts +3 -3
- package/src/server/services/WorkerEnvManager.ts +1 -2
- package/src/server/skill-hub/actions/git-import.ts +5 -7
- package/src/server/skill-hub/mcp/McpController.ts +41 -14
- package/src/server/skill-hub/plugin.ts +89 -6
- package/src/server/skill-hub/tasks/SkillExecutionTask.ts +470 -460
- package/src/server/skill-hub/utils/json-fields.ts +1 -1
- package/src/server/tools/delegate-task.ts +13 -847
- package/src/server/utils/skill-settings.ts +24 -6
- package/dist/client-v2/264.0533912e6c5ea2d7.js +0 -10
- package/dist/client-v2/418.5ae055abf141820e.js +0 -10
- package/dist/client-v2/619.d99d3c9e61c99064.js +0 -10
- package/dist/client-v2/892.72db4161511c8a16.js +0 -10
- package/dist/client-v2/926.87f660b670d85bcc.js +0 -10
- package/src/client/tools/PlanApprovalCard.tsx +0 -176
- package/src/client/tools/registerOrchestratorCards.ts +0 -17
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
import { mkdirSync, readdirSync, statSync, existsSync, rmSync } from 'fs';
|
|
2
|
-
import { resolve, join } from 'path';
|
|
3
|
-
|
|
4
|
-
export interface OutputFileInfo {
|
|
5
|
-
name: string;
|
|
6
|
-
size: number;
|
|
7
|
-
mimeType: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const MIME_MAP: Record<string, string> = {
|
|
11
|
-
'.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
12
|
-
'.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
13
|
-
'.pdf': 'application/pdf',
|
|
14
|
-
'.csv': 'text/csv',
|
|
15
|
-
'.json': 'application/json',
|
|
16
|
-
'.txt': 'text/plain',
|
|
17
|
-
'.png': 'image/png',
|
|
18
|
-
'.jpg': 'image/jpeg',
|
|
19
|
-
'.jpeg': 'image/jpeg',
|
|
20
|
-
'.svg': 'image/svg+xml',
|
|
21
|
-
'.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
22
|
-
'.zip': 'application/zip',
|
|
23
|
-
'.html': 'text/html',
|
|
24
|
-
'.xml': 'application/xml',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
function getMimeType(filename: string): string {
|
|
28
|
-
const ext = filename.substring(filename.lastIndexOf('.')).toLowerCase();
|
|
29
|
-
return MIME_MAP[ext] || 'application/octet-stream';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export class FileManager {
|
|
33
|
-
private executionsDir: string;
|
|
34
|
-
|
|
35
|
-
constructor(private storagePath: string) {
|
|
36
|
-
this.executionsDir = resolve(storagePath, 'executions');
|
|
37
|
-
mkdirSync(this.executionsDir, { recursive: true });
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
createExecDir(execId: string): string {
|
|
41
|
-
const dir = resolve(this.executionsDir, execId);
|
|
42
|
-
mkdirSync(dir, { recursive: true });
|
|
43
|
-
mkdirSync(resolve(dir, 'output'), { recursive: true });
|
|
44
|
-
return dir;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
getExecDir(execId: string): string {
|
|
48
|
-
return resolve(this.executionsDir, execId);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
getOutputDir(execId: string): string {
|
|
52
|
-
return resolve(this.executionsDir, execId, 'output');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Returns absolute path to an output file, or null if invalid/not found.
|
|
57
|
-
* Includes path traversal protection.
|
|
58
|
-
*/
|
|
59
|
-
getOutputFilePath(execId: string, filename: string): string | null {
|
|
60
|
-
const safeBase = resolve(this.executionsDir, execId, 'output');
|
|
61
|
-
const filePath = resolve(safeBase, filename);
|
|
62
|
-
|
|
63
|
-
// Path traversal protection
|
|
64
|
-
if (!filePath.startsWith(safeBase)) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
if (!existsSync(filePath)) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
return filePath;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
listOutputFiles(execId: string): OutputFileInfo[] {
|
|
74
|
-
const outputDir = this.getOutputDir(execId);
|
|
75
|
-
if (!existsSync(outputDir)) return [];
|
|
76
|
-
|
|
77
|
-
try {
|
|
78
|
-
return readdirSync(outputDir)
|
|
79
|
-
.filter((name) => {
|
|
80
|
-
const filePath = join(outputDir, name);
|
|
81
|
-
return statSync(filePath).isFile();
|
|
82
|
-
})
|
|
83
|
-
.map((name) => {
|
|
84
|
-
const filePath = join(outputDir, name);
|
|
85
|
-
const stat = statSync(filePath);
|
|
86
|
-
return {
|
|
87
|
-
name,
|
|
88
|
-
size: stat.size,
|
|
89
|
-
mimeType: getMimeType(name),
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
} catch {
|
|
93
|
-
return [];
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
getTotalOutputSize(execId: string): number {
|
|
98
|
-
const files = this.listOutputFiles(execId);
|
|
99
|
-
return files.reduce((sum, f) => sum + f.size, 0);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Remove a specific execution directory by execId.
|
|
104
|
-
*/
|
|
105
|
-
removeExecDir(execId: string): void {
|
|
106
|
-
const dirPath = resolve(this.executionsDir, execId);
|
|
107
|
-
if (existsSync(dirPath)) {
|
|
108
|
-
try {
|
|
109
|
-
rmSync(dirPath, { recursive: true, force: true });
|
|
110
|
-
} catch {
|
|
111
|
-
// Skip errors
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Remove execution directories older than maxAgeMs.
|
|
118
|
-
*/
|
|
119
|
-
cleanupOlderThan(maxAgeMs: number): number {
|
|
120
|
-
if (!existsSync(this.executionsDir)) return 0;
|
|
121
|
-
|
|
122
|
-
let cleaned = 0;
|
|
123
|
-
const now = Date.now();
|
|
124
|
-
|
|
125
|
-
try {
|
|
126
|
-
for (const dir of readdirSync(this.executionsDir)) {
|
|
127
|
-
const dirPath = resolve(this.executionsDir, dir);
|
|
128
|
-
try {
|
|
129
|
-
const stat = statSync(dirPath);
|
|
130
|
-
if (stat.isDirectory() && now - stat.mtimeMs > maxAgeMs) {
|
|
131
|
-
rmSync(dirPath, { recursive: true, force: true });
|
|
132
|
-
cleaned++;
|
|
133
|
-
}
|
|
134
|
-
} catch {
|
|
135
|
-
// Skip individual dir errors
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
} catch {
|
|
139
|
-
// Skip if executionsDir not accessible
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return cleaned;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
1
|
+
import { mkdirSync, readdirSync, statSync, existsSync, rmSync } from 'fs';
|
|
2
|
+
import { resolve, join } from 'path';
|
|
3
|
+
|
|
4
|
+
export interface OutputFileInfo {
|
|
5
|
+
name: string;
|
|
6
|
+
size: number;
|
|
7
|
+
mimeType: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const MIME_MAP: Record<string, string> = {
|
|
11
|
+
'.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
12
|
+
'.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
13
|
+
'.pdf': 'application/pdf',
|
|
14
|
+
'.csv': 'text/csv',
|
|
15
|
+
'.json': 'application/json',
|
|
16
|
+
'.txt': 'text/plain',
|
|
17
|
+
'.png': 'image/png',
|
|
18
|
+
'.jpg': 'image/jpeg',
|
|
19
|
+
'.jpeg': 'image/jpeg',
|
|
20
|
+
'.svg': 'image/svg+xml',
|
|
21
|
+
'.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
22
|
+
'.zip': 'application/zip',
|
|
23
|
+
'.html': 'text/html',
|
|
24
|
+
'.xml': 'application/xml',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function getMimeType(filename: string): string {
|
|
28
|
+
const ext = filename.substring(filename.lastIndexOf('.')).toLowerCase();
|
|
29
|
+
return MIME_MAP[ext] || 'application/octet-stream';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class FileManager {
|
|
33
|
+
private executionsDir: string;
|
|
34
|
+
|
|
35
|
+
constructor(private storagePath: string) {
|
|
36
|
+
this.executionsDir = resolve(storagePath, 'executions');
|
|
37
|
+
mkdirSync(this.executionsDir, { recursive: true });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
createExecDir(execId: string): string {
|
|
41
|
+
const dir = resolve(this.executionsDir, execId);
|
|
42
|
+
mkdirSync(dir, { recursive: true });
|
|
43
|
+
mkdirSync(resolve(dir, 'output'), { recursive: true });
|
|
44
|
+
return dir;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getExecDir(execId: string): string {
|
|
48
|
+
return resolve(this.executionsDir, execId);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getOutputDir(execId: string): string {
|
|
52
|
+
return resolve(this.executionsDir, execId, 'output');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Returns absolute path to an output file, or null if invalid/not found.
|
|
57
|
+
* Includes path traversal protection.
|
|
58
|
+
*/
|
|
59
|
+
getOutputFilePath(execId: string, filename: string): string | null {
|
|
60
|
+
const safeBase = resolve(this.executionsDir, execId, 'output');
|
|
61
|
+
const filePath = resolve(safeBase, filename);
|
|
62
|
+
|
|
63
|
+
// Path traversal protection
|
|
64
|
+
if (!filePath.startsWith(safeBase)) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
if (!existsSync(filePath)) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return filePath;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
listOutputFiles(execId: string): OutputFileInfo[] {
|
|
74
|
+
const outputDir = this.getOutputDir(execId);
|
|
75
|
+
if (!existsSync(outputDir)) return [];
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
return readdirSync(outputDir)
|
|
79
|
+
.filter((name) => {
|
|
80
|
+
const filePath = join(outputDir, name);
|
|
81
|
+
return statSync(filePath).isFile();
|
|
82
|
+
})
|
|
83
|
+
.map((name) => {
|
|
84
|
+
const filePath = join(outputDir, name);
|
|
85
|
+
const stat = statSync(filePath);
|
|
86
|
+
return {
|
|
87
|
+
name,
|
|
88
|
+
size: stat.size,
|
|
89
|
+
mimeType: getMimeType(name),
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
} catch {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
getTotalOutputSize(execId: string): number {
|
|
98
|
+
const files = this.listOutputFiles(execId);
|
|
99
|
+
return files.reduce((sum, f) => sum + f.size, 0);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Remove a specific execution directory by execId.
|
|
104
|
+
*/
|
|
105
|
+
removeExecDir(execId: string): void {
|
|
106
|
+
const dirPath = resolve(this.executionsDir, execId);
|
|
107
|
+
if (existsSync(dirPath)) {
|
|
108
|
+
try {
|
|
109
|
+
rmSync(dirPath, { recursive: true, force: true });
|
|
110
|
+
} catch {
|
|
111
|
+
// Skip errors
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Remove execution directories older than maxAgeMs.
|
|
118
|
+
*/
|
|
119
|
+
cleanupOlderThan(maxAgeMs: number): number {
|
|
120
|
+
if (!existsSync(this.executionsDir)) return 0;
|
|
121
|
+
|
|
122
|
+
let cleaned = 0;
|
|
123
|
+
const now = Date.now();
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
for (const dir of readdirSync(this.executionsDir)) {
|
|
127
|
+
const dirPath = resolve(this.executionsDir, dir);
|
|
128
|
+
try {
|
|
129
|
+
const stat = statSync(dirPath);
|
|
130
|
+
if (stat.isDirectory() && now - stat.mtimeMs > maxAgeMs) {
|
|
131
|
+
rmSync(dirPath, { recursive: true, force: true });
|
|
132
|
+
cleaned++;
|
|
133
|
+
}
|
|
134
|
+
} catch {
|
|
135
|
+
// Skip individual dir errors
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
} catch {
|
|
139
|
+
// Skip if executionsDir not accessible
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return cleaned;
|
|
143
|
+
}
|
|
144
|
+
}
|