plugin-agent-orchestrator 1.0.21 → 1.0.23
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/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/214.723affb37c13bf7a.js +10 -0
- package/dist/client-v2/264.0533912e6c5ea2d7.js +10 -0
- package/dist/client-v2/41.1805b2edfaa4afe2.js +10 -0
- package/dist/client-v2/418.5ae055abf141820e.js +10 -0
- package/dist/client-v2/619.d99d3c9e61c99064.js +10 -0
- package/dist/client-v2/70.a15d7fcec7c41768.js +10 -0
- package/dist/client-v2/892.72db4161511c8a16.js +10 -0
- package/dist/client-v2/926.87f660b670d85bcc.js +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/externalVersion.js +7 -6
- package/dist/locale/en-US.json +7 -0
- package/dist/locale/vi-VN.json +7 -0
- package/dist/locale/zh-CN.json +27 -0
- package/dist/server/migrations/20260615000000-normalize-ai-employee-tool-bindings.js +63 -0
- package/dist/server/plugin.js +41 -1
- package/dist/server/services/AgentHarness.js +52 -27
- package/dist/server/services/AgentLoopController.js +8 -2
- package/dist/server/services/AgentLoopService.js +1 -1
- package/dist/server/services/AgentRegistryService.js +53 -42
- package/dist/server/services/CircuitBreaker.js +7 -2
- package/dist/server/services/CodeValidator.js +48 -14
- package/dist/server/services/SandboxRunner.js +18 -14
- package/dist/server/skill-hub/plugin.js +44 -17
- package/dist/server/tools/delegate-task.js +7 -2
- package/dist/server/tools/skill-execute.js +33 -2
- package/dist/server/utils/ai-manager.js +51 -0
- package/dist/server/utils/ctx-utils.js +11 -0
- package/dist/server/utils/skill-settings.js +122 -0
- package/package.json +49 -45
- package/src/client/AIEmployeesContext.tsx +51 -14
- package/src/client/AgentRunsTab.tsx +767 -764
- package/src/client/HarnessProfilesTab.tsx +254 -247
- package/src/client/RulesTab.tsx +780 -716
- package/src/client/TracingTab.tsx +1 -0
- package/src/client/plugin.tsx +34 -27
- package/src/client/skill-hub/components/GitSkillImport.tsx +10 -3
- package/src/client/skill-hub/components/SkillMetrics.tsx +157 -124
- package/src/client/skill-hub/index.tsx +58 -51
- package/src/client/skill-hub/tools/InteractionSchemasProvider.tsx +132 -99
- package/src/client/skill-hub/tools/registerSkillLoopCards.ts +71 -58
- package/src/client/tools/registerOrchestratorCards.ts +17 -7
- package/src/client-v2/components/AIEmployeeSelect.tsx +47 -0
- package/src/client-v2/components/AIEmployeesContext.tsx +110 -0
- package/src/client-v2/components/AgentRunsTab.tsx +767 -0
- package/src/client-v2/components/HarnessProfilesTab.tsx +254 -0
- package/src/client-v2/components/RulesTab.tsx +782 -0
- package/src/client-v2/components/TracingTab.tsx +432 -0
- package/src/client-v2/hooks/useApiRequest.ts +114 -0
- package/src/client-v2/pages/AgentRunsPage.tsx +13 -0
- package/src/client-v2/pages/ExecutionHistoryPage.tsx +10 -0
- package/src/client-v2/pages/HarnessProfilesPage.tsx +10 -0
- package/src/client-v2/pages/LoopSettingsPage.tsx +10 -0
- package/src/client-v2/pages/RulesPage.tsx +13 -0
- package/src/client-v2/pages/SkillDefinitionsPage.tsx +10 -0
- package/src/client-v2/pages/SkillMetricsPage.tsx +10 -0
- package/src/client-v2/pages/TracingPage.tsx +13 -0
- package/src/client-v2/plugin.tsx +70 -0
- package/src/client-v2/skill-hub/components/ExecutionHistory.tsx +196 -0
- package/src/client-v2/skill-hub/components/FileLinkList.tsx +37 -0
- package/src/client-v2/skill-hub/components/GitSkillImport.tsx +539 -0
- package/src/client-v2/skill-hub/components/LoopSettings.tsx +331 -0
- package/src/client-v2/skill-hub/components/SkillEditor.tsx +453 -0
- package/src/client-v2/skill-hub/components/SkillManager.tsx +174 -0
- package/src/client-v2/skill-hub/components/SkillMetrics.tsx +157 -0
- package/src/client-v2/skill-hub/components/SkillTestPanel.tsx +135 -0
- package/src/client-v2/skill-hub/locale.ts +13 -0
- package/src/client-v2/skill-hub/tools/loopTemplates.ts +52 -0
- package/src/client-v2/skill-hub/utils/jsonFields.ts +41 -0
- package/src/client-v2/utils/jsonFields.ts +41 -0
- package/src/locale/en-US.json +7 -0
- package/src/locale/vi-VN.json +7 -0
- package/src/locale/zh-CN.json +27 -0
- package/src/server/__tests__/agent-registry-service.test.ts +147 -0
- package/src/server/__tests__/code-validator.test.ts +63 -0
- package/src/server/__tests__/skill-execute.test.ts +33 -0
- package/src/server/__tests__/skill-settings.test.ts +63 -0
- package/src/server/migrations/20260615000000-normalize-ai-employee-tool-bindings.ts +39 -0
- package/src/server/plugin.ts +68 -12
- package/src/server/services/AgentHarness.ts +49 -22
- package/src/server/services/AgentLoopController.ts +17 -6
- package/src/server/services/AgentLoopService.ts +1 -1
- package/src/server/services/AgentPlannerService.ts +10 -0
- package/src/server/services/AgentRegistryService.ts +89 -47
- package/src/server/services/CircuitBreaker.ts +10 -0
- package/src/server/services/CodeValidator.ts +237 -159
- package/src/server/services/SandboxRunner.ts +203 -189
- package/src/server/skill-hub/plugin.ts +933 -898
- package/src/server/tools/delegate-task.ts +12 -9
- package/src/server/tools/skill-execute.ts +194 -160
- package/src/server/utils/ai-manager.ts +24 -0
- package/src/server/utils/ctx-utils.ts +14 -0
- package/src/server/utils/skill-settings.ts +116 -0
- package/dist/client/AIEmployeeSelect.d.ts +0 -11
- package/dist/client/AIEmployeesContext.d.ts +0 -30
- package/dist/client/AgentRunsTab.d.ts +0 -2
- package/dist/client/HarnessProfilesTab.d.ts +0 -2
- package/dist/client/OrchestratorSettings.d.ts +0 -3
- package/dist/client/RulesTab.d.ts +0 -2
- package/dist/client/TracingTab.d.ts +0 -2
- package/dist/client/hooks/useRunEventStream.d.ts +0 -22
- package/dist/client/index.d.ts +0 -2
- package/dist/client/plugin.d.ts +0 -6
- package/dist/client/skill-hub/components/ExecutionHistory.d.ts +0 -2
- package/dist/client/skill-hub/components/ExecutionProgress.d.ts +0 -20
- package/dist/client/skill-hub/components/GitSkillImport.d.ts +0 -7
- package/dist/client/skill-hub/components/LoopSettings.d.ts +0 -2
- package/dist/client/skill-hub/components/SkillEditor.d.ts +0 -7
- package/dist/client/skill-hub/components/SkillManager.d.ts +0 -2
- package/dist/client/skill-hub/components/SkillMetrics.d.ts +0 -2
- package/dist/client/skill-hub/components/SkillTestPanel.d.ts +0 -7
- package/dist/client/skill-hub/index.d.ts +0 -11
- package/dist/client/skill-hub/locale.d.ts +0 -3
- package/dist/client/skill-hub/tools/InteractionSchemasProvider.d.ts +0 -6
- package/dist/client/skill-hub/tools/SkillHubCard.d.ts +0 -3
- package/dist/client/skill-hub/tools/loopTemplates.d.ts +0 -22
- package/dist/client/skill-hub/tools/registerSkillLoopCards.d.ts +0 -1
- package/dist/client/skill-hub/utils/jsonFields.d.ts +0 -3
- package/dist/client/tools/PlanApprovalCard.d.ts +0 -3
- package/dist/client/tools/registerOrchestratorCards.d.ts +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/server/collections/agent-execution-spans.d.ts +0 -9
- package/dist/server/collections/agent-harness-profiles.d.ts +0 -2
- package/dist/server/collections/agent-loop-events.d.ts +0 -2
- package/dist/server/collections/agent-loop-runs.d.ts +0 -2
- package/dist/server/collections/agent-loop-steps.d.ts +0 -2
- package/dist/server/collections/orchestrator-config.d.ts +0 -2
- package/dist/server/collections/orchestrator-logs.d.ts +0 -8
- package/dist/server/collections/skill-definitions.d.ts +0 -3
- package/dist/server/collections/skill-executions.d.ts +0 -3
- package/dist/server/collections/skill-loop-configs.d.ts +0 -3
- package/dist/server/collections/skill-worker-configs.d.ts +0 -3
- package/dist/server/migrations/20260423000000-add-progress-fields.d.ts +0 -4
- package/dist/server/migrations/20260425000000-add-interaction-schema.d.ts +0 -4
- package/dist/server/migrations/20260427000000-add-tracing-detail-fields.d.ts +0 -7
- package/dist/server/migrations/20260427000000-change-packages-to-text.d.ts +0 -4
- package/dist/server/migrations/20260427000001-change-other-json-to-text.d.ts +0 -4
- package/dist/server/migrations/20260429000000-add-llm-fields.d.ts +0 -7
- package/dist/server/migrations/20260429000000-fix-inputargs-json-to-text.d.ts +0 -16
- package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.d.ts +0 -7
- package/dist/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.d.ts +0 -7
- package/dist/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.d.ts +0 -12
- package/dist/server/migrations/20260601000000-add-token-fields.d.ts +0 -7
- package/dist/server/plugin.d.ts +0 -16
- package/dist/server/resources/agent-loop.d.ts +0 -3
- package/dist/server/resources/tracing.d.ts +0 -7
- package/dist/server/services/AgentHarness.d.ts +0 -44
- package/dist/server/services/AgentLoopController.d.ts +0 -218
- package/dist/server/services/AgentLoopRepository.d.ts +0 -20
- package/dist/server/services/AgentLoopService.d.ts +0 -159
- package/dist/server/services/AgentPlanValidator.d.ts +0 -4
- package/dist/server/services/AgentPlannerService.d.ts +0 -8
- package/dist/server/services/AgentRegistryService.d.ts +0 -21
- package/dist/server/services/CircuitBreaker.d.ts +0 -40
- package/dist/server/services/CodeValidator.d.ts +0 -32
- package/dist/server/services/ContextAggregator.d.ts +0 -45
- package/dist/server/services/ExecutionSpanService.d.ts +0 -46
- package/dist/server/services/FileManager.d.ts +0 -28
- package/dist/server/services/RunEventBus.d.ts +0 -9
- package/dist/server/services/SandboxRunner.d.ts +0 -41
- package/dist/server/services/SkillManager.d.ts +0 -6
- package/dist/server/services/SkillRepositoryService.d.ts +0 -22
- package/dist/server/services/TokenTracker.d.ts +0 -62
- package/dist/server/services/WorkerEnvManager.d.ts +0 -26
- package/dist/server/skill-hub/actions/git-import.d.ts +0 -21
- package/dist/server/skill-hub/mcp/McpController.d.ts +0 -15
- package/dist/server/skill-hub/plugin.d.ts +0 -61
- package/dist/server/skill-hub/tasks/SkillExecutionTask.d.ts +0 -16
- package/dist/server/skill-hub/utils/json-fields.d.ts +0 -7
- package/dist/server/tools/agent-loop.d.ts +0 -235
- package/dist/server/tools/delegate-task.d.ts +0 -19
- package/dist/server/tools/external-rag-search.d.ts +0 -42
- package/dist/server/tools/orchestrator-plan.d.ts +0 -205
- package/dist/server/tools/skill-execute.d.ts +0 -36
- package/dist/server/types.d.ts +0 -47
- package/dist/server/utils/ctx-utils.d.ts +0 -30
- package/dist/server/utils/logging.d.ts +0 -6
- /package/{dist/server/index.d.ts → src/client-v2/index.tsx} +0 -0
|
@@ -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,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,22 +0,0 @@
|
|
|
1
|
-
export interface SkillPackageMetadata {
|
|
2
|
-
path: string;
|
|
3
|
-
metadata: Record<string, any>;
|
|
4
|
-
instructions: string;
|
|
5
|
-
code: string | null;
|
|
6
|
-
}
|
|
7
|
-
export declare class SkillRepositoryService {
|
|
8
|
-
private baseDir;
|
|
9
|
-
constructor(storagePath: string);
|
|
10
|
-
/**
|
|
11
|
-
* Extract a zip file to the repository.
|
|
12
|
-
* Returns parsed metadata from SKILL.md / skill.yaml
|
|
13
|
-
*/
|
|
14
|
-
extractSkillPackage(skillName: string, zipFilePath: string): Promise<SkillPackageMetadata>;
|
|
15
|
-
getSkillPath(skillName: string): string;
|
|
16
|
-
getSkillCode(skillName: string): string | null;
|
|
17
|
-
copySkillPackageTo(skillName: string, destDir: string): void;
|
|
18
|
-
readSkillPackage(packageDir: string): SkillPackageMetadata;
|
|
19
|
-
copyDirectoryTo(srcDir: string, destDir: string): void;
|
|
20
|
-
private getSkillCodeFromDir;
|
|
21
|
-
private aggregateOtherMarkdownFiles;
|
|
22
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export interface TokenUsage {
|
|
2
|
-
inputTokens: number;
|
|
3
|
-
outputTokens: number;
|
|
4
|
-
totalTokens: number;
|
|
5
|
-
cost: number;
|
|
6
|
-
}
|
|
7
|
-
export interface BudgetConfig {
|
|
8
|
-
budgetMaxTokens?: number;
|
|
9
|
-
budgetMaxCost?: number;
|
|
10
|
-
}
|
|
11
|
-
export interface BudgetCheckResult {
|
|
12
|
-
allowed: boolean;
|
|
13
|
-
reason?: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Extract usage_metadata from the final state returned by createReactAgent.invoke().
|
|
17
|
-
*
|
|
18
|
-
* LangChain's createReactAgent returns a final state object with a `messages` array.
|
|
19
|
-
* The last AIMessage in that array carries `usage_metadata` populated by the
|
|
20
|
-
* LLM provider after the final generation step. This is the standard LangChain
|
|
21
|
-
* approach — no private API access needed.
|
|
22
|
-
*
|
|
23
|
-
* Expected shape (from @langchain/core/messages/ai):
|
|
24
|
-
* AIMessage.usage_metadata = {
|
|
25
|
-
* input_tokens: number,
|
|
26
|
-
* output_tokens: number,
|
|
27
|
-
* total_tokens: number,
|
|
28
|
-
* }
|
|
29
|
-
*/
|
|
30
|
-
export declare function extractTokenUsage(finalState: any): TokenUsage | null;
|
|
31
|
-
/**
|
|
32
|
-
* Service for tracking token consumption across agent runs and spans.
|
|
33
|
-
*
|
|
34
|
-
* Responsibilities:
|
|
35
|
-
* 1. Parse token usage from LangGraph execution results
|
|
36
|
-
* 2. Persist token counts to agentExecutionSpans
|
|
37
|
-
* 3. Accumulate totals at the agentLoopRuns level
|
|
38
|
-
* 4. Enforce budget limits (max tokens / max cost per run)
|
|
39
|
-
*/
|
|
40
|
-
export declare class TokenTracker {
|
|
41
|
-
private readonly plugin;
|
|
42
|
-
constructor(plugin: any);
|
|
43
|
-
get db(): any;
|
|
44
|
-
get app(): any;
|
|
45
|
-
/**
|
|
46
|
-
* Track token usage for a single execution span.
|
|
47
|
-
* Updates the span record and accumulates into the parent run.
|
|
48
|
-
*
|
|
49
|
-
* @param spanId - The agentExecutionSpans.id to update
|
|
50
|
-
* @param usage - Parsed token usage from extractTokenUsage()
|
|
51
|
-
* @param runId - Optional agentLoopRuns.id to accumulate totals
|
|
52
|
-
*/
|
|
53
|
-
trackSpan(spanId: string | number | undefined, usage: TokenUsage, runId?: string | number): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Recalculate total token/cost for a run by summing all its spans.
|
|
56
|
-
*/
|
|
57
|
-
accumulateToRun(runId: string | number): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Check if a run has exceeded its budget limits.
|
|
60
|
-
*/
|
|
61
|
-
checkBudget(runId: string | number): Promise<BudgetCheckResult>;
|
|
62
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import Application from '@nocobase/server';
|
|
2
|
-
import { Database } from '@nocobase/database';
|
|
3
|
-
type WorkerEnvConfig = {
|
|
4
|
-
npmRegistryUrl?: string;
|
|
5
|
-
npmAuthToken?: string;
|
|
6
|
-
pypiIndexUrl?: string;
|
|
7
|
-
pypiTrustedHost?: string;
|
|
8
|
-
aptMirrorUrl?: string;
|
|
9
|
-
aptGpgKeyUrl?: string;
|
|
10
|
-
customPackages?: {
|
|
11
|
-
python?: string[];
|
|
12
|
-
node?: string[];
|
|
13
|
-
apt?: string[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare class WorkerEnvManager {
|
|
17
|
-
private readonly app;
|
|
18
|
-
private readonly db;
|
|
19
|
-
private readonly storagePath;
|
|
20
|
-
constructor(app: Application, db: Database, storagePath: string);
|
|
21
|
-
getOrCreateConfig(): Promise<any>;
|
|
22
|
-
initEnvironment(config: WorkerEnvConfig): Promise<string>;
|
|
23
|
-
executeInit(payload: WorkerEnvConfig): Promise<void>;
|
|
24
|
-
parsePackageWhitelist(config: any): Record<"node" | "python" | "apt", string[]>;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Context } from '@nocobase/actions';
|
|
2
|
-
/**
|
|
3
|
-
* Git integration actions for skill-hub.
|
|
4
|
-
*
|
|
5
|
-
* Supported manifest shape:
|
|
6
|
-
* {
|
|
7
|
-
* "skills": [
|
|
8
|
-
* { "folder": "my-skill", "name": "my-skill", "language": "python" },
|
|
9
|
-
* { "name": "pptx-advanced-export", "storageType": "plugin", "pluginSource": "pptx-advanced-export" }
|
|
10
|
-
* ]
|
|
11
|
-
* }
|
|
12
|
-
*/
|
|
13
|
-
export declare function gitListSkills(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Sync selected skills from git into skillDefinitions.
|
|
16
|
-
*
|
|
17
|
-
* Code is optional. Regular git skills may provide code via codeTemplate,
|
|
18
|
-
* codeFile, or conventional files under skills/<folder>. Plugin skills only
|
|
19
|
-
* need storageType=plugin and pluginSource.
|
|
20
|
-
*/
|
|
21
|
-
export declare function gitSyncSkills(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type PluginSkillHubServer from '../plugin';
|
|
2
|
-
export declare class McpController {
|
|
3
|
-
private plugin;
|
|
4
|
-
constructor(plugin: PluginSkillHubServer);
|
|
5
|
-
/**
|
|
6
|
-
* List all enabled skills in standard MCP format.
|
|
7
|
-
* Route: GET /api/skillHub:mcpListTools
|
|
8
|
-
*/
|
|
9
|
-
listTools(ctx: any, next: any): Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* Execute a skill in standard MCP format.
|
|
12
|
-
* Route: POST /api/skillHub:mcpCallTool
|
|
13
|
-
*/
|
|
14
|
-
callTool(ctx: any, next: any): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { SandboxRunner } from '../services/SandboxRunner';
|
|
2
|
-
import { FileManager } from '../services/FileManager';
|
|
3
|
-
import { SkillManager } from '../services/SkillManager';
|
|
4
|
-
import { WorkerEnvManager } from '../services/WorkerEnvManager';
|
|
5
|
-
export declare class SkillHubSubFeature {
|
|
6
|
-
private plugin;
|
|
7
|
-
sandboxRunner: SandboxRunner;
|
|
8
|
-
fileManager: FileManager;
|
|
9
|
-
skillManager: SkillManager;
|
|
10
|
-
workerEnvManager: WorkerEnvManager;
|
|
11
|
-
private cleanupInterval;
|
|
12
|
-
private initEnvDoneCallback;
|
|
13
|
-
private initEnvProgressCallback;
|
|
14
|
-
private mcpController;
|
|
15
|
-
private skillRepoService;
|
|
16
|
-
private rateLimiter;
|
|
17
|
-
private skillTemplates;
|
|
18
|
-
constructor(plugin: any);
|
|
19
|
-
get app(): any;
|
|
20
|
-
get db(): any;
|
|
21
|
-
get name(): any;
|
|
22
|
-
load(): Promise<void>;
|
|
23
|
-
private onQueueTask;
|
|
24
|
-
/**
|
|
25
|
-
* Execute skill — called by both AI tool and REST test endpoint.
|
|
26
|
-
* Dispatches to worker via EventQueue, waits for result via PubSub.
|
|
27
|
-
* Pushes progress to SSE via runtime.writer (if within AI tool context).
|
|
28
|
-
* Includes rate limiting and graceful abort propagation.
|
|
29
|
-
*/
|
|
30
|
-
executeSkill(skill: any, inputArgs: Record<string, any>, ctx?: any): Promise<any>;
|
|
31
|
-
private handleDownload;
|
|
32
|
-
private handleTest;
|
|
33
|
-
/**
|
|
34
|
-
* Handle Init Environment request from admin UI.
|
|
35
|
-
* Dispatches init task to all workers via EventQueue.
|
|
36
|
-
*/
|
|
37
|
-
private handleInitEnv;
|
|
38
|
-
/**
|
|
39
|
-
* Subscribe to init-env done AND progress PubSub channels.
|
|
40
|
-
* When a worker finishes init, auto-update the DB with status.
|
|
41
|
-
*/
|
|
42
|
-
private subscribeInitEnvDone;
|
|
43
|
-
private getSkillRecordId;
|
|
44
|
-
private resolveLoopInteractionSchema;
|
|
45
|
-
private getLoopConfigsBySkillId;
|
|
46
|
-
private registerAITools;
|
|
47
|
-
private startCleanupInterval;
|
|
48
|
-
beforeStop(): Promise<void>;
|
|
49
|
-
private handleClearStorage;
|
|
50
|
-
private handleListTemplates;
|
|
51
|
-
/**
|
|
52
|
-
* Register a skill template into memory for UI importing.
|
|
53
|
-
*/
|
|
54
|
-
registerSkillTemplate(pluginName: string, skillDef: any): void;
|
|
55
|
-
resolveSkillTemplate(templateName: string): any;
|
|
56
|
-
getSkillDescriptionForAI(skill: any): Promise<string>;
|
|
57
|
-
getSkillInstructions(skill: any): Promise<any>;
|
|
58
|
-
private hydrateSkillTemplate;
|
|
59
|
-
install(): Promise<void>;
|
|
60
|
-
}
|
|
61
|
-
export default SkillHubSubFeature;
|