plugin-agent-orchestrator 1.0.21 → 1.0.22

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.
Files changed (88) hide show
  1. package/dist/server/plugin.js +9 -0
  2. package/package.json +1 -1
  3. package/src/server/plugin.ts +15 -0
  4. package/dist/client/AIEmployeeSelect.d.ts +0 -11
  5. package/dist/client/AIEmployeesContext.d.ts +0 -30
  6. package/dist/client/AgentRunsTab.d.ts +0 -2
  7. package/dist/client/HarnessProfilesTab.d.ts +0 -2
  8. package/dist/client/OrchestratorSettings.d.ts +0 -3
  9. package/dist/client/RulesTab.d.ts +0 -2
  10. package/dist/client/TracingTab.d.ts +0 -2
  11. package/dist/client/hooks/useRunEventStream.d.ts +0 -22
  12. package/dist/client/index.d.ts +0 -2
  13. package/dist/client/plugin.d.ts +0 -6
  14. package/dist/client/skill-hub/components/ExecutionHistory.d.ts +0 -2
  15. package/dist/client/skill-hub/components/ExecutionProgress.d.ts +0 -20
  16. package/dist/client/skill-hub/components/GitSkillImport.d.ts +0 -7
  17. package/dist/client/skill-hub/components/LoopSettings.d.ts +0 -2
  18. package/dist/client/skill-hub/components/SkillEditor.d.ts +0 -7
  19. package/dist/client/skill-hub/components/SkillManager.d.ts +0 -2
  20. package/dist/client/skill-hub/components/SkillMetrics.d.ts +0 -2
  21. package/dist/client/skill-hub/components/SkillTestPanel.d.ts +0 -7
  22. package/dist/client/skill-hub/index.d.ts +0 -11
  23. package/dist/client/skill-hub/locale.d.ts +0 -3
  24. package/dist/client/skill-hub/tools/InteractionSchemasProvider.d.ts +0 -6
  25. package/dist/client/skill-hub/tools/SkillHubCard.d.ts +0 -3
  26. package/dist/client/skill-hub/tools/loopTemplates.d.ts +0 -22
  27. package/dist/client/skill-hub/tools/registerSkillLoopCards.d.ts +0 -1
  28. package/dist/client/skill-hub/utils/jsonFields.d.ts +0 -3
  29. package/dist/client/tools/PlanApprovalCard.d.ts +0 -3
  30. package/dist/client/tools/registerOrchestratorCards.d.ts +0 -1
  31. package/dist/index.d.ts +0 -2
  32. package/dist/server/collections/agent-execution-spans.d.ts +0 -9
  33. package/dist/server/collections/agent-harness-profiles.d.ts +0 -2
  34. package/dist/server/collections/agent-loop-events.d.ts +0 -2
  35. package/dist/server/collections/agent-loop-runs.d.ts +0 -2
  36. package/dist/server/collections/agent-loop-steps.d.ts +0 -2
  37. package/dist/server/collections/orchestrator-config.d.ts +0 -2
  38. package/dist/server/collections/orchestrator-logs.d.ts +0 -8
  39. package/dist/server/collections/skill-definitions.d.ts +0 -3
  40. package/dist/server/collections/skill-executions.d.ts +0 -3
  41. package/dist/server/collections/skill-loop-configs.d.ts +0 -3
  42. package/dist/server/collections/skill-worker-configs.d.ts +0 -3
  43. package/dist/server/index.d.ts +0 -1
  44. package/dist/server/migrations/20260423000000-add-progress-fields.d.ts +0 -4
  45. package/dist/server/migrations/20260425000000-add-interaction-schema.d.ts +0 -4
  46. package/dist/server/migrations/20260427000000-add-tracing-detail-fields.d.ts +0 -7
  47. package/dist/server/migrations/20260427000000-change-packages-to-text.d.ts +0 -4
  48. package/dist/server/migrations/20260427000001-change-other-json-to-text.d.ts +0 -4
  49. package/dist/server/migrations/20260429000000-add-llm-fields.d.ts +0 -7
  50. package/dist/server/migrations/20260429000000-fix-inputargs-json-to-text.d.ts +0 -16
  51. package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.d.ts +0 -7
  52. package/dist/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.d.ts +0 -7
  53. package/dist/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.d.ts +0 -12
  54. package/dist/server/migrations/20260601000000-add-token-fields.d.ts +0 -7
  55. package/dist/server/plugin.d.ts +0 -16
  56. package/dist/server/resources/agent-loop.d.ts +0 -3
  57. package/dist/server/resources/tracing.d.ts +0 -7
  58. package/dist/server/services/AgentHarness.d.ts +0 -44
  59. package/dist/server/services/AgentLoopController.d.ts +0 -218
  60. package/dist/server/services/AgentLoopRepository.d.ts +0 -20
  61. package/dist/server/services/AgentLoopService.d.ts +0 -159
  62. package/dist/server/services/AgentPlanValidator.d.ts +0 -4
  63. package/dist/server/services/AgentPlannerService.d.ts +0 -8
  64. package/dist/server/services/AgentRegistryService.d.ts +0 -21
  65. package/dist/server/services/CircuitBreaker.d.ts +0 -40
  66. package/dist/server/services/CodeValidator.d.ts +0 -32
  67. package/dist/server/services/ContextAggregator.d.ts +0 -45
  68. package/dist/server/services/ExecutionSpanService.d.ts +0 -46
  69. package/dist/server/services/FileManager.d.ts +0 -28
  70. package/dist/server/services/RunEventBus.d.ts +0 -9
  71. package/dist/server/services/SandboxRunner.d.ts +0 -41
  72. package/dist/server/services/SkillManager.d.ts +0 -6
  73. package/dist/server/services/SkillRepositoryService.d.ts +0 -22
  74. package/dist/server/services/TokenTracker.d.ts +0 -62
  75. package/dist/server/services/WorkerEnvManager.d.ts +0 -26
  76. package/dist/server/skill-hub/actions/git-import.d.ts +0 -21
  77. package/dist/server/skill-hub/mcp/McpController.d.ts +0 -15
  78. package/dist/server/skill-hub/plugin.d.ts +0 -61
  79. package/dist/server/skill-hub/tasks/SkillExecutionTask.d.ts +0 -16
  80. package/dist/server/skill-hub/utils/json-fields.d.ts +0 -7
  81. package/dist/server/tools/agent-loop.d.ts +0 -235
  82. package/dist/server/tools/delegate-task.d.ts +0 -19
  83. package/dist/server/tools/external-rag-search.d.ts +0 -42
  84. package/dist/server/tools/orchestrator-plan.d.ts +0 -205
  85. package/dist/server/tools/skill-execute.d.ts +0 -36
  86. package/dist/server/types.d.ts +0 -47
  87. package/dist/server/utils/ctx-utils.d.ts +0 -30
  88. package/dist/server/utils/logging.d.ts +0 -6
@@ -1,218 +0,0 @@
1
- import { AgentRegistryService } from './AgentRegistryService';
2
- import { AgentPlannerService } from './AgentPlannerService';
3
- import { AgentPlanValidator } from './AgentPlanValidator';
4
- import { AgentLoopRepository } from './AgentLoopRepository';
5
- import { AgentHarness } from './AgentHarness';
6
- import { AgentLoopPolicy, AgentLoopPlanStepInput, AgentLoopRunStatus } from './AgentLoopService';
7
- import { TokenTracker } from './TokenTracker';
8
- export declare class AgentLoopController {
9
- private readonly registryService;
10
- private readonly plannerService;
11
- private readonly validator;
12
- private readonly repository;
13
- private readonly harness;
14
- private readonly tokenTracker;
15
- constructor(registryService: AgentRegistryService, plannerService: AgentPlannerService, validator: AgentPlanValidator, repository: AgentLoopRepository, harness: AgentHarness, tokenTracker?: TokenTracker | null);
16
- createRun(options: {
17
- goal: string;
18
- leaderUsername?: string;
19
- sessionId?: string;
20
- messageId?: string;
21
- userId?: string | number;
22
- policy?: Partial<AgentLoopPolicy>;
23
- metadata?: any;
24
- plan?: AgentLoopPlanStepInput[];
25
- }): Promise<{
26
- run: any;
27
- steps: any;
28
- nextSteps: any[];
29
- }>;
30
- planGoal(options: {
31
- goal: string;
32
- leaderUsername?: string;
33
- sessionId?: string;
34
- messageId?: string;
35
- userId?: string | number;
36
- policy?: Partial<AgentLoopPolicy>;
37
- metadata?: any;
38
- plan?: AgentLoopPlanStepInput[];
39
- planSource?: string;
40
- plannerModel?: string;
41
- harnessTag?: string;
42
- targetAgent?: string;
43
- runId?: string | number;
44
- }): Promise<{
45
- events: any;
46
- spans: any;
47
- skillExecutions: any;
48
- run: any;
49
- steps: any;
50
- nextSteps: any[];
51
- }>;
52
- revisePlanGoal(runId: string | number, plan: AgentLoopPlanStepInput[], options?: {
53
- goal?: string;
54
- userId?: string | number;
55
- metadata?: any;
56
- planSource?: string;
57
- plannerModel?: string;
58
- harnessTag?: string;
59
- harnessProfileId?: string | number;
60
- harnessSettings?: any;
61
- }): Promise<{
62
- events: any;
63
- spans: any;
64
- skillExecutions: any;
65
- run: any;
66
- steps: any;
67
- nextSteps: any[];
68
- }>;
69
- approvePlanAndExecute(runId: string | number, options?: {
70
- userId?: string | number;
71
- ctx?: any;
72
- reason?: string;
73
- }): Promise<{
74
- run: any;
75
- steps: any;
76
- nextSteps: any[];
77
- }>;
78
- rejectPlan(runId: string | number, options?: {
79
- userId?: string | number;
80
- reason?: string;
81
- }): Promise<{
82
- run: any;
83
- steps: any;
84
- nextSteps: any[];
85
- }>;
86
- requestPlanChanges(runId: string | number, options?: {
87
- userId?: string | number;
88
- feedback?: string;
89
- }): Promise<{
90
- events: any;
91
- spans: any;
92
- skillExecutions: any;
93
- run: any;
94
- steps: any;
95
- nextSteps: any[];
96
- }>;
97
- replacePlan(runId: string | number, plan: AgentLoopPlanStepInput[], options?: {
98
- userId?: string | number;
99
- mode?: 'append' | 'replace_pending';
100
- reason?: string;
101
- markRunning?: boolean;
102
- }): Promise<any[]>;
103
- replan(runId: string | number, plan: AgentLoopPlanStepInput[], options?: {
104
- reason?: string;
105
- mode?: 'append' | 'replace_pending';
106
- userId?: string | number;
107
- }): Promise<any[]>;
108
- startStep(stepId: string | number, options?: {
109
- userId?: string | number;
110
- agentExecutionSpanId?: string | number;
111
- }): Promise<{
112
- run: any;
113
- steps: any;
114
- nextSteps: any[];
115
- }>;
116
- completeStep(stepId: string | number, output: any, options?: {
117
- userId?: string | number;
118
- skillExecutionId?: string | number;
119
- agentExecutionSpanId?: string | number;
120
- metadata?: any;
121
- }): Promise<{
122
- run: any;
123
- steps: any;
124
- nextSteps: any[];
125
- }>;
126
- failStep(stepId: string | number, error: string, options?: {
127
- userId?: string | number;
128
- metadata?: any;
129
- }): Promise<{
130
- run: any;
131
- steps: any;
132
- nextSteps: any[];
133
- }>;
134
- skipStep(stepId: string | number, reason?: string, options?: {
135
- userId?: string | number;
136
- }): Promise<{
137
- run: any;
138
- steps: any;
139
- nextSteps: any[];
140
- }>;
141
- requestApproval(stepId: string | number, approval: any, options?: {
142
- userId?: string | number;
143
- reason?: string;
144
- }): Promise<{
145
- run: any;
146
- steps: any;
147
- nextSteps: any[];
148
- }>;
149
- resumeRun(runId: string | number, options: {
150
- stepId?: string | number;
151
- approved: boolean;
152
- editedInput?: any;
153
- userId?: string | number;
154
- ctx?: any;
155
- }): Promise<{
156
- run: any;
157
- steps: any;
158
- nextSteps: any[];
159
- }>;
160
- retryStep(stepId: string | number, options?: {
161
- userId?: string | number;
162
- }): Promise<{
163
- run: any;
164
- steps: any;
165
- nextSteps: any[];
166
- }>;
167
- finishRun(runId: string | number, finalAnswer: string, options?: {
168
- status?: Extract<AgentLoopRunStatus, 'succeeded' | 'failed'>;
169
- summary?: string;
170
- evidence?: any;
171
- userId?: string | number;
172
- }): Promise<{
173
- run: any;
174
- steps: any;
175
- nextSteps: any[];
176
- }>;
177
- stepFeedback(stepId: string | number, feedback: {
178
- rating: 'positive' | 'negative';
179
- comment?: string;
180
- category?: string;
181
- }, options?: {
182
- userId?: string | number;
183
- }): Promise<{
184
- run: any;
185
- steps: any;
186
- nextSteps: any[];
187
- }>;
188
- cancelRun(runId: string | number, options?: {
189
- userId?: string | number;
190
- reason?: string;
191
- }): Promise<{
192
- run: any;
193
- steps: any;
194
- nextSteps: any[];
195
- }>;
196
- executeApprovedPlan(runId: string | number, options?: {
197
- userId?: string | number;
198
- ctx?: any;
199
- }): Promise<{
200
- run: any;
201
- steps: any;
202
- nextSteps: any[];
203
- }>;
204
- getRunSnapshot(runId: string | number): Promise<{
205
- run: any;
206
- steps: any;
207
- nextSteps: any[];
208
- }>;
209
- getRunDetail(runId: string | number): Promise<{
210
- events: any;
211
- spans: any;
212
- skillExecutions: any;
213
- run: any;
214
- steps: any;
215
- nextSteps: any[];
216
- }>;
217
- pickNextSteps(steps: any[], runPolicy?: any): any[];
218
- }
@@ -1,20 +0,0 @@
1
- export declare class AgentLoopRepository {
2
- private readonly plugin;
3
- constructor(plugin: any);
4
- get db(): any;
5
- getRun(runId: string | number): Promise<any>;
6
- requireRun(runId: string | number): Promise<any>;
7
- createRun(values: any): Promise<any>;
8
- updateRun(runId: string | number, values: any): Promise<void>;
9
- getStep(stepId: string | number): Promise<any>;
10
- requireStep(stepId: string | number): Promise<any>;
11
- createStep(values: any): Promise<any>;
12
- updateStep(stepId: string | number, values: any): Promise<void>;
13
- getSteps(runId: string | number): Promise<any>;
14
- createEvent(values: any): Promise<any>;
15
- getEvents(runId: string | number): Promise<any>;
16
- getLinkedSpans(runId: string | number, rootRunId?: string): Promise<any>;
17
- getLinkedSkillExecutions(runId: string | number, steps: any[]): Promise<any>;
18
- lockRun(runId: string | number, lockName: string, durationMs: number): Promise<boolean>;
19
- unlockRun(runId: string | number): Promise<void>;
20
- }
@@ -1,159 +0,0 @@
1
- import { AgentRegistryService } from './AgentRegistryService';
2
- import { AgentPlannerService } from './AgentPlannerService';
3
- import { AgentPlanValidator } from './AgentPlanValidator';
4
- import { AgentLoopRepository } from './AgentLoopRepository';
5
- import { AgentHarness } from './AgentHarness';
6
- import { AgentLoopController } from './AgentLoopController';
7
- export type AgentLoopRunStatus = 'planning' | 'waiting_plan_approval' | 'approved' | 'running' | 'waiting_user' | 'needs_replan' | 'succeeded' | 'failed' | 'rejected' | 'canceled';
8
- export type AgentLoopStepStatus = 'pending' | 'running' | 'waiting_user' | 'succeeded' | 'failed' | 'skipped';
9
- export type AgentLoopStepType = 'reasoning' | 'skill' | 'tool' | 'sub_agent' | 'verification';
10
- export type AgentLoopStepDependencyPolicy = 'require_success' | 'allow_skipped';
11
- export type AgentLoopPolicy = {
12
- maxIterations: number;
13
- maxStepAttempts: number;
14
- allowReplan: boolean;
15
- requireVerification: boolean;
16
- stopOnApprovalRequired: boolean;
17
- maxContextTokens?: number;
18
- contextSummaryStrategy?: 'last_n' | 'all';
19
- includeToolResults?: boolean;
20
- includeStepOutputs?: boolean;
21
- maxConcurrency?: number;
22
- };
23
- export type AgentLoopPlanStepInput = {
24
- id?: string;
25
- key?: string;
26
- planKey?: string;
27
- parentStepId?: string | number;
28
- title?: string;
29
- description?: string;
30
- type?: AgentLoopStepType;
31
- target?: string;
32
- input?: any;
33
- dependsOn?: string[];
34
- dependencyPolicy?: AgentLoopStepDependencyPolicy;
35
- maxAttempts?: number;
36
- metadata?: any;
37
- };
38
- export declare class AgentLoopService {
39
- private readonly plugin;
40
- readonly registryService: AgentRegistryService;
41
- readonly plannerService: AgentPlannerService;
42
- readonly validator: AgentPlanValidator;
43
- readonly repository: AgentLoopRepository;
44
- readonly harness: AgentHarness;
45
- readonly controller: AgentLoopController;
46
- constructor(plugin: any);
47
- get db(): any;
48
- get app(): any;
49
- createRun(options: any): Promise<{
50
- run: any;
51
- steps: any;
52
- nextSteps: any[];
53
- }>;
54
- planGoal(options: any): Promise<{
55
- events: any;
56
- spans: any;
57
- skillExecutions: any;
58
- run: any;
59
- steps: any;
60
- nextSteps: any[];
61
- }>;
62
- revisePlanGoal(runId: any, plan: any, options?: any): Promise<{
63
- events: any;
64
- spans: any;
65
- skillExecutions: any;
66
- run: any;
67
- steps: any;
68
- nextSteps: any[];
69
- }>;
70
- approvePlanAndExecute(runId: any, options?: any): Promise<{
71
- run: any;
72
- steps: any;
73
- nextSteps: any[];
74
- }>;
75
- rejectPlan(runId: any, options?: any): Promise<{
76
- run: any;
77
- steps: any;
78
- nextSteps: any[];
79
- }>;
80
- requestPlanChanges(runId: any, options?: any): Promise<{
81
- events: any;
82
- spans: any;
83
- skillExecutions: any;
84
- run: any;
85
- steps: any;
86
- nextSteps: any[];
87
- }>;
88
- replacePlan(runId: any, plan: any, options?: any): Promise<any[]>;
89
- replan(runId: any, plan: any, options?: any): Promise<any[]>;
90
- startStep(stepId: any, options?: any): Promise<{
91
- run: any;
92
- steps: any;
93
- nextSteps: any[];
94
- }>;
95
- completeStep(stepId: any, output: any, options?: any): Promise<{
96
- run: any;
97
- steps: any;
98
- nextSteps: any[];
99
- }>;
100
- failStep(stepId: any, error: any, options?: any): Promise<{
101
- run: any;
102
- steps: any;
103
- nextSteps: any[];
104
- }>;
105
- skipStep(stepId: any, reason?: any, options?: any): Promise<{
106
- run: any;
107
- steps: any;
108
- nextSteps: any[];
109
- }>;
110
- requestApproval(stepId: any, approval: any, options?: any): Promise<{
111
- run: any;
112
- steps: any;
113
- nextSteps: any[];
114
- }>;
115
- resumeRun(runId: any, options: any): Promise<{
116
- run: any;
117
- steps: any;
118
- nextSteps: any[];
119
- }>;
120
- retryStep(stepId: any, options?: any): Promise<{
121
- run: any;
122
- steps: any;
123
- nextSteps: any[];
124
- }>;
125
- stepFeedback(stepId: any, feedback: any, options?: any): Promise<{
126
- run: any;
127
- steps: any;
128
- nextSteps: any[];
129
- }>;
130
- finishRun(runId: any, finalAnswer: any, options?: any): Promise<{
131
- run: any;
132
- steps: any;
133
- nextSteps: any[];
134
- }>;
135
- cancelRun(runId: any, options?: any): Promise<{
136
- run: any;
137
- steps: any;
138
- nextSteps: any[];
139
- }>;
140
- executeApprovedPlan(runId: any, options?: any): Promise<{
141
- run: any;
142
- steps: any;
143
- nextSteps: any[];
144
- }>;
145
- getRunSnapshot(runId: any): Promise<{
146
- run: any;
147
- steps: any;
148
- nextSteps: any[];
149
- }>;
150
- getRunDetail(runId: any): Promise<{
151
- events: any;
152
- spans: any;
153
- skillExecutions: any;
154
- run: any;
155
- steps: any;
156
- nextSteps: any[];
157
- }>;
158
- createEvent(values: any): Promise<any>;
159
- }
@@ -1,4 +0,0 @@
1
- import { AgentLoopPlanStepInput } from './AgentLoopService';
2
- export declare class AgentPlanValidator {
3
- validate(plan: AgentLoopPlanStepInput[]): void;
4
- }
@@ -1,8 +0,0 @@
1
- import { AgentLoopPlanStepInput } from './AgentLoopService';
2
- export declare class AgentPlannerService {
3
- buildPlan(goal: string, plan: AgentLoopPlanStepInput[] | undefined, options: {
4
- targetAgent?: string;
5
- harnessTag?: string;
6
- metadata?: any;
7
- }): AgentLoopPlanStepInput[];
8
- }
@@ -1,21 +0,0 @@
1
- export declare class AgentRegistryService {
2
- private readonly plugin;
3
- constructor(plugin: any);
4
- get db(): any;
5
- getHarnessProfile(tag: string): Promise<any>;
6
- getOrchestratorConfig(leaderUsername: string, subAgentUsername: string): Promise<any>;
7
- getAIEmployee(username: string): Promise<any>;
8
- resolveModelSettings(subAgentUsername: string, leaderUsername?: string, dynamicValues?: any): Promise<{
9
- llmService: string;
10
- model: string;
11
- }>;
12
- /**
13
- * Find alternative sub-agents for the same leader, excluding a specific one.
14
- * Used by the smart retry feature to route around a failing sub-agent.
15
- */
16
- findAlternativeSubAgents(leaderUsername: string, excludeSubAgentUsername: string): Promise<{
17
- username: string;
18
- label: string;
19
- }[]>;
20
- isRegisteredDelegationTool(toolName: string): Promise<boolean>;
21
- }
@@ -1,40 +0,0 @@
1
- export interface CircuitState {
2
- failures: number;
3
- lastFailureTime: number;
4
- state: 'closed' | 'open' | 'half-open';
5
- }
6
- /**
7
- * CircuitBreakerRegistry — prevents cascading failures by tracking per-key
8
- * failure rates and temporarily stopping calls when thresholds are exceeded.
9
- *
10
- * State machine: closed → open (after threshold failures) → half-open (after recoveryTimeout)
11
- * half-open: allows 1 probe request; success → closed, failure → open.
12
- */
13
- export declare class CircuitBreakerRegistry {
14
- private readonly circuits;
15
- readonly threshold: number;
16
- readonly recoveryTimeout: number;
17
- readonly halfOpenMaxRequests: number;
18
- private readonly appLog;
19
- constructor(options?: {
20
- threshold?: number;
21
- recoveryTimeout?: number;
22
- halfOpenMaxRequests?: number;
23
- appLog?: any;
24
- });
25
- private getOrCreate;
26
- recordSuccess(key: string): void;
27
- recordFailure(key: string): void;
28
- isAllowed(key: string): boolean;
29
- getState(key: string): CircuitState | null;
30
- /** Reset a circuit back to closed state. */
31
- reset(key: string): void;
32
- /** Get all circuit state keys (for monitoring/diagnostics). */
33
- getKeys(): string[];
34
- }
35
- export declare function getCircuitBreaker(options?: {
36
- threshold?: number;
37
- recoveryTimeout?: number;
38
- halfOpenMaxRequests?: number;
39
- appLog?: any;
40
- }): CircuitBreakerRegistry;
@@ -1,32 +0,0 @@
1
- export declare class CodeValidator {
2
- /**
3
- * Check code against forbidden patterns (dangerous modules/functions).
4
- * @throws CodeValidationError if a forbidden pattern is found.
5
- */
6
- validate(code: string, language: 'node' | 'python'): void;
7
- /**
8
- * Validate that code only imports packages in the whitelist.
9
- * Called after the basic forbidden pattern check.
10
- * Skips validation if whitelist is empty (env not initialized yet).
11
- *
12
- * @param code - The code to validate
13
- * @param language - 'node' or 'python'
14
- * @param whitelist - Array of allowed package names (from skillWorkerConfigs.packageWhitelist)
15
- */
16
- validateImports(code: string, language: 'node' | 'python', whitelist: string[]): void;
17
- /**
18
- * Check Node.js require() calls against the whitelist.
19
- * Built-in modules (fs, path, etc.) are always allowed.
20
- */
21
- private validateNodeImports;
22
- /**
23
- * Check Python import/from statements against the whitelist.
24
- * Built-in modules (os, sys, json, etc.) are always allowed.
25
- * Handles PyPI→import name mapping (e.g., python-docx → docx, Pillow → PIL).
26
- */
27
- private validatePythonImports;
28
- }
29
- export declare class CodeValidationError extends Error {
30
- matchedPattern: string;
31
- constructor(message: string, matchedPattern: string);
32
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * ContextAggregator — builds structured step context for sub-agent system prompts.
3
- *
4
- * Responsibilities:
5
- * 1. Query completed steps of a run
6
- * 2. Format them as structured XML context
7
- * 3. Apply truncation/summarization based on policy
8
- * 4. Inject into sub-agent system prompt
9
- */
10
- export declare class ContextAggregator {
11
- private readonly plugin;
12
- constructor(plugin: any);
13
- get db(): any;
14
- get app(): any;
15
- /**
16
- * Build a structured context string from completed steps of a run.
17
- *
18
- * @param runId - agentLoopRuns.id
19
- * @param maxTokens - Maximum tokens for the context output (default 4000)
20
- * @param options - Strategy options
21
- */
22
- buildStepContext(runId: string | number, maxTokens?: number, options?: {
23
- strategy?: 'last_n' | 'all';
24
- includeToolResults?: boolean;
25
- includeStepOutputs?: boolean;
26
- }): Promise<string>;
27
- /**
28
- * Enrich a base system prompt with step context from the run.
29
- * Fetches the run from DB to access policy settings (maxContextTokens, etc.).
30
- *
31
- * @param basePrompt - The original system prompt to enrich
32
- * @param runId - agentLoopRuns.id
33
- * @param _stepId - agentLoopSteps.id (reserved for future per-step context)
34
- */
35
- enrichSystemPrompt(basePrompt: string, runId: string | number, _stepId?: string | number, options?: {
36
- maxContextTokens?: number;
37
- contextSummaryStrategy?: 'last_n' | 'all';
38
- includeToolResults?: boolean;
39
- includeStepOutputs?: boolean;
40
- }): Promise<string>;
41
- private truncateToTokenLimit;
42
- private splitStepBlocks;
43
- private escapeXml;
44
- private safeStringify;
45
- }
@@ -1,46 +0,0 @@
1
- export declare const ORCHESTRATOR_TRACE_CONTEXT_KEY = "__orchestratorTraceContext";
2
- export type OrchestratorTraceContext = {
3
- rootRunId: string;
4
- spanId?: string;
5
- parentSpanId?: string;
6
- toolCallId?: string;
7
- leaderUsername?: string;
8
- employeeUsername?: string;
9
- toolName?: string;
10
- agentLoopRunId?: string;
11
- agentLoopStepId?: string;
12
- };
13
- type SpanValues = {
14
- rootRunId: string;
15
- parentSpanId?: string;
16
- type: string;
17
- status: string;
18
- leaderUsername?: string;
19
- employeeUsername?: string;
20
- toolName?: string;
21
- title?: string;
22
- input?: any;
23
- output?: string;
24
- error?: string;
25
- durationMs?: number;
26
- startedAt?: Date;
27
- endedAt?: Date;
28
- orchestratorLogId?: string | number;
29
- skillExecutionId?: string | number;
30
- metadata?: any;
31
- userId?: string | number;
32
- };
33
- export declare class ExecutionSpanService {
34
- private readonly plugin;
35
- constructor(plugin: any);
36
- create(values: SpanValues): Promise<any>;
37
- update(spanId: string | number | undefined, values: Record<string, any>): Promise<{
38
- id: string | number;
39
- }>;
40
- finish(spanId: string | number | undefined, status: 'success' | 'error' | 'canceled' | 'timeout', startedAt: number, values?: Record<string, any>): Promise<{
41
- id: string | number;
42
- }>;
43
- }
44
- export declare function getOrchestratorTraceContext(ctx: any): OrchestratorTraceContext | null;
45
- export declare function setOrchestratorTraceContext(ctx: any, traceContext: OrchestratorTraceContext): any;
46
- export {};
@@ -1,28 +0,0 @@
1
- export interface OutputFileInfo {
2
- name: string;
3
- size: number;
4
- mimeType: string;
5
- }
6
- export declare class FileManager {
7
- private storagePath;
8
- private executionsDir;
9
- constructor(storagePath: string);
10
- createExecDir(execId: string): string;
11
- getExecDir(execId: string): string;
12
- getOutputDir(execId: string): string;
13
- /**
14
- * Returns absolute path to an output file, or null if invalid/not found.
15
- * Includes path traversal protection.
16
- */
17
- getOutputFilePath(execId: string, filename: string): string | null;
18
- listOutputFiles(execId: string): OutputFileInfo[];
19
- getTotalOutputSize(execId: string): number;
20
- /**
21
- * Remove a specific execution directory by execId.
22
- */
23
- removeExecDir(execId: string): void;
24
- /**
25
- * Remove execution directories older than maxAgeMs.
26
- */
27
- cleanupOlderThan(maxAgeMs: number): number;
28
- }
@@ -1,9 +0,0 @@
1
- type EventCallback = (event: any) => void;
2
- declare class RunEventBusImpl {
3
- private listeners;
4
- subscribe(runId: string | number, callback: EventCallback): () => void;
5
- emit(runId: string | number, event: any): void;
6
- listenerCount(runId: string | number): number;
7
- }
8
- export declare function getRunEventBus(): RunEventBusImpl;
9
- export {};
@@ -1,41 +0,0 @@
1
- import { FileManager, OutputFileInfo } from './FileManager';
2
- export interface ExecuteOptions {
3
- language: 'node' | 'python';
4
- code: string;
5
- execId: string;
6
- timeoutSeconds?: number;
7
- maxOutputSizeMb?: number;
8
- onProgress?: (progress: ProgressUpdate) => void;
9
- /** AbortSignal — when aborted, the child process is killed */
10
- signal?: {
11
- addEventListener(event: string, listener: () => void): void;
12
- };
13
- /** Package whitelist for import validation (from skillWorkerConfigs) */
14
- packageWhitelist?: string[];
15
- /** Optional installed/copied skill package root exposed to the runtime as SKILL_DIR. */
16
- skillDir?: string;
17
- }
18
- export interface ProgressUpdate {
19
- percent: number;
20
- log: string;
21
- }
22
- export interface ExecutionResult {
23
- success: boolean;
24
- stdout: string;
25
- stderr: string;
26
- files: OutputFileInfo[];
27
- durationMs: number;
28
- /** true if execution was canceled by user */
29
- canceled?: boolean;
30
- /** true if execution timed out */
31
- timedOut?: boolean;
32
- }
33
- export declare class SandboxRunner {
34
- private fileManager;
35
- private logger;
36
- private storagePath;
37
- private validator;
38
- private sandboxWorkspace;
39
- constructor(fileManager: FileManager, logger: any, storagePath: string);
40
- execute(options: ExecuteOptions): Promise<ExecutionResult>;
41
- }
@@ -1,6 +0,0 @@
1
- import { Database } from '@nocobase/database';
2
- export declare class SkillManager {
3
- private db;
4
- constructor(db: Database);
5
- seedDefaults(): Promise<void>;
6
- }