plugin-agent-orchestrator 1.0.20 → 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 (158) hide show
  1. package/dist/client/index.js +1 -1
  2. package/dist/externalVersion.js +6 -6
  3. package/dist/server/collections/agent-execution-spans.js +24 -0
  4. package/dist/server/collections/agent-loop-runs.js +36 -0
  5. package/dist/server/collections/orchestrator-config.js +14 -0
  6. package/dist/server/migrations/20260601000000-add-token-fields.js +101 -0
  7. package/dist/server/plugin.js +56 -0
  8. package/dist/server/resources/agent-loop.js +33 -25
  9. package/dist/server/resources/tracing.js +5 -8
  10. package/dist/server/services/AgentHarness.js +56 -90
  11. package/dist/server/services/AgentLoopController.js +164 -125
  12. package/dist/server/services/AgentLoopRepository.js +16 -34
  13. package/dist/server/services/AgentLoopService.js +7 -1
  14. package/dist/server/services/AgentPlannerService.js +5 -25
  15. package/dist/server/services/AgentRegistryService.js +34 -24
  16. package/dist/server/services/CircuitBreaker.js +120 -0
  17. package/dist/server/services/ContextAggregator.js +201 -0
  18. package/dist/server/services/ExecutionSpanService.js +2 -5
  19. package/dist/server/services/RunEventBus.js +73 -0
  20. package/dist/server/services/TokenTracker.js +173 -0
  21. package/dist/server/tools/agent-loop.js +30 -63
  22. package/dist/server/tools/delegate-task.js +14 -72
  23. package/dist/server/tools/orchestrator-plan.js +10 -47
  24. package/dist/server/types.js +24 -0
  25. package/dist/server/utils/ctx-utils.js +152 -0
  26. package/dist/server/utils/logging.js +86 -0
  27. package/package.json +44 -44
  28. package/src/client/AgentRunsTab.tsx +764 -764
  29. package/src/client/HarnessProfilesTab.tsx +247 -247
  30. package/src/client/OrchestratorSettings.tsx +106 -106
  31. package/src/client/RulesTab.tsx +716 -716
  32. package/src/client/hooks/useRunEventStream.ts +76 -0
  33. package/src/client/index.tsx +2 -1
  34. package/src/client/plugin.tsx +27 -27
  35. package/src/client/skill-hub/components/LoopSettings.tsx +331 -331
  36. package/src/client/skill-hub/index.tsx +51 -51
  37. package/src/client/skill-hub/tools/InteractionSchemasProvider.tsx +99 -99
  38. package/src/client/skill-hub/tools/SkillHubCard.tsx +109 -109
  39. package/src/client/skill-hub/tools/loopTemplates.ts +52 -52
  40. package/src/client/skill-hub/tools/registerSkillLoopCards.ts +58 -58
  41. package/src/client/tools/PlanApprovalCard.tsx +175 -175
  42. package/src/client/tools/registerOrchestratorCards.ts +7 -7
  43. package/src/server/__tests__/agent-loop-controller.test.ts +375 -0
  44. package/src/server/__tests__/circuit-breaker.test.ts +169 -0
  45. package/src/server/__tests__/context-aggregator.test.ts +222 -0
  46. package/src/server/__tests__/parallel-execution.test.ts +318 -0
  47. package/src/server/__tests__/smoke.test.ts +120 -0
  48. package/src/server/collections/agent-execution-spans.ts +24 -0
  49. package/src/server/collections/agent-harness-profiles.ts +59 -59
  50. package/src/server/collections/agent-loop-events.ts +71 -71
  51. package/src/server/collections/agent-loop-runs.ts +38 -1
  52. package/src/server/collections/agent-loop-steps.ts +144 -144
  53. package/src/server/collections/orchestrator-config.ts +14 -0
  54. package/src/server/collections/skill-executions.ts +106 -106
  55. package/src/server/collections/skill-loop-configs.ts +65 -65
  56. package/src/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.ts +30 -30
  57. package/src/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.ts +142 -142
  58. package/src/server/migrations/20260601000000-add-token-fields.ts +89 -0
  59. package/src/server/plugin.ts +68 -0
  60. package/src/server/resources/agent-loop.ts +21 -12
  61. package/src/server/resources/tracing.ts +3 -7
  62. package/src/server/services/AgentHarness.ts +78 -116
  63. package/src/server/services/AgentLoopController.ts +197 -122
  64. package/src/server/services/AgentLoopRepository.ts +9 -25
  65. package/src/server/services/AgentLoopService.ts +13 -1
  66. package/src/server/services/AgentPlanValidator.ts +73 -73
  67. package/src/server/services/AgentPlannerService.ts +2 -25
  68. package/src/server/services/AgentRegistryService.ts +40 -31
  69. package/src/server/services/CircuitBreaker.ts +116 -0
  70. package/src/server/services/ContextAggregator.ts +239 -0
  71. package/src/server/services/ExecutionSpanService.ts +2 -4
  72. package/src/server/services/RunEventBus.ts +45 -0
  73. package/src/server/services/TokenTracker.ts +209 -0
  74. package/src/server/skill-hub/plugin.ts +898 -898
  75. package/src/server/skill-hub/tasks/SkillExecutionTask.ts +460 -460
  76. package/src/server/tools/agent-loop.ts +18 -57
  77. package/src/server/tools/delegate-task.ts +11 -93
  78. package/src/server/tools/orchestrator-plan.ts +26 -50
  79. package/src/server/tools/skill-execute.ts +160 -160
  80. package/src/server/types.ts +55 -0
  81. package/src/server/utils/ctx-utils.ts +118 -0
  82. package/src/server/utils/logging.ts +63 -0
  83. package/dist/client/AIEmployeeSelect.d.ts +0 -11
  84. package/dist/client/AIEmployeesContext.d.ts +0 -30
  85. package/dist/client/AgentRunsTab.d.ts +0 -2
  86. package/dist/client/HarnessProfilesTab.d.ts +0 -2
  87. package/dist/client/OrchestratorSettings.d.ts +0 -3
  88. package/dist/client/RulesTab.d.ts +0 -2
  89. package/dist/client/TracingTab.d.ts +0 -2
  90. package/dist/client/index.d.ts +0 -1
  91. package/dist/client/plugin.d.ts +0 -6
  92. package/dist/client/skill-hub/components/ExecutionHistory.d.ts +0 -2
  93. package/dist/client/skill-hub/components/ExecutionProgress.d.ts +0 -20
  94. package/dist/client/skill-hub/components/GitSkillImport.d.ts +0 -7
  95. package/dist/client/skill-hub/components/LoopSettings.d.ts +0 -2
  96. package/dist/client/skill-hub/components/SkillEditor.d.ts +0 -7
  97. package/dist/client/skill-hub/components/SkillManager.d.ts +0 -2
  98. package/dist/client/skill-hub/components/SkillMetrics.d.ts +0 -2
  99. package/dist/client/skill-hub/components/SkillTestPanel.d.ts +0 -7
  100. package/dist/client/skill-hub/index.d.ts +0 -11
  101. package/dist/client/skill-hub/locale.d.ts +0 -3
  102. package/dist/client/skill-hub/tools/InteractionSchemasProvider.d.ts +0 -6
  103. package/dist/client/skill-hub/tools/SkillHubCard.d.ts +0 -3
  104. package/dist/client/skill-hub/tools/loopTemplates.d.ts +0 -22
  105. package/dist/client/skill-hub/tools/registerSkillLoopCards.d.ts +0 -1
  106. package/dist/client/skill-hub/utils/jsonFields.d.ts +0 -3
  107. package/dist/client/tools/PlanApprovalCard.d.ts +0 -3
  108. package/dist/client/tools/registerOrchestratorCards.d.ts +0 -1
  109. package/dist/index.d.ts +0 -2
  110. package/dist/server/collections/agent-execution-spans.d.ts +0 -9
  111. package/dist/server/collections/agent-harness-profiles.d.ts +0 -2
  112. package/dist/server/collections/agent-loop-events.d.ts +0 -2
  113. package/dist/server/collections/agent-loop-runs.d.ts +0 -2
  114. package/dist/server/collections/agent-loop-steps.d.ts +0 -2
  115. package/dist/server/collections/orchestrator-config.d.ts +0 -2
  116. package/dist/server/collections/orchestrator-logs.d.ts +0 -8
  117. package/dist/server/collections/skill-definitions.d.ts +0 -3
  118. package/dist/server/collections/skill-executions.d.ts +0 -3
  119. package/dist/server/collections/skill-loop-configs.d.ts +0 -3
  120. package/dist/server/collections/skill-worker-configs.d.ts +0 -3
  121. package/dist/server/index.d.ts +0 -1
  122. package/dist/server/migrations/20260423000000-add-progress-fields.d.ts +0 -4
  123. package/dist/server/migrations/20260425000000-add-interaction-schema.d.ts +0 -4
  124. package/dist/server/migrations/20260427000000-add-tracing-detail-fields.d.ts +0 -7
  125. package/dist/server/migrations/20260427000000-change-packages-to-text.d.ts +0 -4
  126. package/dist/server/migrations/20260427000001-change-other-json-to-text.d.ts +0 -4
  127. package/dist/server/migrations/20260429000000-add-llm-fields.d.ts +0 -7
  128. package/dist/server/migrations/20260429000000-fix-inputargs-json-to-text.d.ts +0 -16
  129. package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.d.ts +0 -7
  130. package/dist/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.d.ts +0 -7
  131. package/dist/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.d.ts +0 -12
  132. package/dist/server/plugin.d.ts +0 -16
  133. package/dist/server/resources/agent-loop.d.ts +0 -3
  134. package/dist/server/resources/tracing.d.ts +0 -7
  135. package/dist/server/services/AgentHarness.d.ts +0 -42
  136. package/dist/server/services/AgentLoopController.d.ts +0 -205
  137. package/dist/server/services/AgentLoopRepository.d.ts +0 -20
  138. package/dist/server/services/AgentLoopService.d.ts +0 -149
  139. package/dist/server/services/AgentPlanValidator.d.ts +0 -4
  140. package/dist/server/services/AgentPlannerService.d.ts +0 -8
  141. package/dist/server/services/AgentRegistryService.d.ts +0 -13
  142. package/dist/server/services/CodeValidator.d.ts +0 -32
  143. package/dist/server/services/ExecutionSpanService.d.ts +0 -46
  144. package/dist/server/services/FileManager.d.ts +0 -28
  145. package/dist/server/services/SandboxRunner.d.ts +0 -41
  146. package/dist/server/services/SkillManager.d.ts +0 -6
  147. package/dist/server/services/SkillRepositoryService.d.ts +0 -22
  148. package/dist/server/services/WorkerEnvManager.d.ts +0 -26
  149. package/dist/server/skill-hub/actions/git-import.d.ts +0 -21
  150. package/dist/server/skill-hub/mcp/McpController.d.ts +0 -15
  151. package/dist/server/skill-hub/plugin.d.ts +0 -61
  152. package/dist/server/skill-hub/tasks/SkillExecutionTask.d.ts +0 -16
  153. package/dist/server/skill-hub/utils/json-fields.d.ts +0 -7
  154. package/dist/server/tools/agent-loop.d.ts +0 -235
  155. package/dist/server/tools/delegate-task.d.ts +0 -19
  156. package/dist/server/tools/external-rag-search.d.ts +0 -42
  157. package/dist/server/tools/orchestrator-plan.d.ts +0 -205
  158. package/dist/server/tools/skill-execute.d.ts +0 -36
@@ -1,149 +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
- };
18
- export type AgentLoopPlanStepInput = {
19
- id?: string;
20
- key?: string;
21
- planKey?: string;
22
- parentStepId?: string | number;
23
- title?: string;
24
- description?: string;
25
- type?: AgentLoopStepType;
26
- target?: string;
27
- input?: any;
28
- dependsOn?: string[];
29
- dependencyPolicy?: AgentLoopStepDependencyPolicy;
30
- maxAttempts?: number;
31
- metadata?: any;
32
- };
33
- export declare class AgentLoopService {
34
- private readonly plugin;
35
- readonly registryService: AgentRegistryService;
36
- readonly plannerService: AgentPlannerService;
37
- readonly validator: AgentPlanValidator;
38
- readonly repository: AgentLoopRepository;
39
- readonly harness: AgentHarness;
40
- readonly controller: AgentLoopController;
41
- constructor(plugin: any);
42
- get db(): any;
43
- get app(): any;
44
- createRun(options: any): Promise<{
45
- run: any;
46
- steps: any;
47
- nextStep: any;
48
- }>;
49
- planGoal(options: any): Promise<{
50
- events: any;
51
- spans: any;
52
- skillExecutions: any;
53
- run: any;
54
- steps: any;
55
- nextStep: any;
56
- }>;
57
- revisePlanGoal(runId: any, plan: any, options?: any): Promise<{
58
- events: any;
59
- spans: any;
60
- skillExecutions: any;
61
- run: any;
62
- steps: any;
63
- nextStep: any;
64
- }>;
65
- approvePlanAndExecute(runId: any, options?: any): Promise<{
66
- run: any;
67
- steps: any;
68
- nextStep: any;
69
- }>;
70
- rejectPlan(runId: any, options?: any): Promise<{
71
- run: any;
72
- steps: any;
73
- nextStep: any;
74
- }>;
75
- requestPlanChanges(runId: any, options?: any): Promise<{
76
- events: any;
77
- spans: any;
78
- skillExecutions: any;
79
- run: any;
80
- steps: any;
81
- nextStep: any;
82
- }>;
83
- replacePlan(runId: any, plan: any, options?: any): Promise<any[]>;
84
- replan(runId: any, plan: any, options?: any): Promise<any[]>;
85
- startStep(stepId: any, options?: any): Promise<{
86
- run: any;
87
- steps: any;
88
- nextStep: any;
89
- }>;
90
- completeStep(stepId: any, output: any, options?: any): Promise<{
91
- run: any;
92
- steps: any;
93
- nextStep: any;
94
- }>;
95
- failStep(stepId: any, error: any, options?: any): Promise<{
96
- run: any;
97
- steps: any;
98
- nextStep: any;
99
- }>;
100
- skipStep(stepId: any, reason?: any, options?: any): Promise<{
101
- run: any;
102
- steps: any;
103
- nextStep: any;
104
- }>;
105
- requestApproval(stepId: any, approval: any, options?: any): Promise<{
106
- run: any;
107
- steps: any;
108
- nextStep: any;
109
- }>;
110
- resumeRun(runId: any, options: any): Promise<{
111
- run: any;
112
- steps: any;
113
- nextStep: any;
114
- }>;
115
- retryStep(stepId: any, options?: any): Promise<{
116
- run: any;
117
- steps: any;
118
- nextStep: any;
119
- }>;
120
- finishRun(runId: any, finalAnswer: any, options?: any): Promise<{
121
- run: any;
122
- steps: any;
123
- nextStep: any;
124
- }>;
125
- cancelRun(runId: any, options?: any): Promise<{
126
- run: any;
127
- steps: any;
128
- nextStep: any;
129
- }>;
130
- executeApprovedPlan(runId: any, options?: any): Promise<{
131
- run: any;
132
- steps: any;
133
- nextStep: any;
134
- }>;
135
- getRunSnapshot(runId: any): Promise<{
136
- run: any;
137
- steps: any;
138
- nextStep: any;
139
- }>;
140
- getRunDetail(runId: any): Promise<{
141
- events: any;
142
- spans: any;
143
- skillExecutions: any;
144
- run: any;
145
- steps: any;
146
- nextStep: any;
147
- }>;
148
- createEvent(values: any): Promise<any>;
149
- }
@@ -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,13 +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
- isRegisteredDelegationTool(toolName: string): Promise<boolean>;
13
- }
@@ -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,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,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
- }
@@ -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,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;
@@ -1,16 +0,0 @@
1
- import Application from '@nocobase/server';
2
- import { SandboxRunner } from '../../services/SandboxRunner';
3
- import { FileManager } from '../../services/FileManager';
4
- import { SkillRepositoryService } from '../../services/SkillRepositoryService';
5
- export declare class SkillExecutionTask {
6
- private execution;
7
- private sandboxRunner;
8
- private fileManager;
9
- private skillRepoService;
10
- private app;
11
- constructor(execution: any, sandboxRunner: SandboxRunner, fileManager: FileManager, skillRepoService: SkillRepositoryService, app: Application);
12
- run(): Promise<void>;
13
- private renderTemplate;
14
- private installGeneratedSkillIfRequested;
15
- private validateGeneratedSkillPackages;
16
- }
@@ -1,7 +0,0 @@
1
- export declare function parseJsonText<T = any>(value: any, fallback: T): T;
2
- export declare function stringifyJsonText(value: any, fallback?: any): string;
3
- export declare function parseJsonLike(value: any, fallback: any): any;
4
- export declare function parseSkillMarkdown(markdown: string): {
5
- metadata: Record<string, any>;
6
- body: string;
7
- };