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.
Files changed (180) hide show
  1. package/client-v2.d.ts +2 -0
  2. package/client-v2.js +1 -0
  3. package/dist/client/index.js +1 -1
  4. package/dist/client-v2/214.723affb37c13bf7a.js +10 -0
  5. package/dist/client-v2/264.0533912e6c5ea2d7.js +10 -0
  6. package/dist/client-v2/41.1805b2edfaa4afe2.js +10 -0
  7. package/dist/client-v2/418.5ae055abf141820e.js +10 -0
  8. package/dist/client-v2/619.d99d3c9e61c99064.js +10 -0
  9. package/dist/client-v2/70.a15d7fcec7c41768.js +10 -0
  10. package/dist/client-v2/892.72db4161511c8a16.js +10 -0
  11. package/dist/client-v2/926.87f660b670d85bcc.js +10 -0
  12. package/dist/client-v2/index.js +10 -0
  13. package/dist/externalVersion.js +7 -6
  14. package/dist/locale/en-US.json +7 -0
  15. package/dist/locale/vi-VN.json +7 -0
  16. package/dist/locale/zh-CN.json +27 -0
  17. package/dist/server/migrations/20260615000000-normalize-ai-employee-tool-bindings.js +63 -0
  18. package/dist/server/plugin.js +41 -1
  19. package/dist/server/services/AgentHarness.js +52 -27
  20. package/dist/server/services/AgentLoopController.js +8 -2
  21. package/dist/server/services/AgentLoopService.js +1 -1
  22. package/dist/server/services/AgentRegistryService.js +53 -42
  23. package/dist/server/services/CircuitBreaker.js +7 -2
  24. package/dist/server/services/CodeValidator.js +48 -14
  25. package/dist/server/services/SandboxRunner.js +18 -14
  26. package/dist/server/skill-hub/plugin.js +44 -17
  27. package/dist/server/tools/delegate-task.js +7 -2
  28. package/dist/server/tools/skill-execute.js +33 -2
  29. package/dist/server/utils/ai-manager.js +51 -0
  30. package/dist/server/utils/ctx-utils.js +11 -0
  31. package/dist/server/utils/skill-settings.js +122 -0
  32. package/package.json +49 -45
  33. package/src/client/AIEmployeesContext.tsx +51 -14
  34. package/src/client/AgentRunsTab.tsx +767 -764
  35. package/src/client/HarnessProfilesTab.tsx +254 -247
  36. package/src/client/RulesTab.tsx +780 -716
  37. package/src/client/TracingTab.tsx +1 -0
  38. package/src/client/plugin.tsx +34 -27
  39. package/src/client/skill-hub/components/GitSkillImport.tsx +10 -3
  40. package/src/client/skill-hub/components/SkillMetrics.tsx +157 -124
  41. package/src/client/skill-hub/index.tsx +58 -51
  42. package/src/client/skill-hub/tools/InteractionSchemasProvider.tsx +132 -99
  43. package/src/client/skill-hub/tools/registerSkillLoopCards.ts +71 -58
  44. package/src/client/tools/registerOrchestratorCards.ts +17 -7
  45. package/src/client-v2/components/AIEmployeeSelect.tsx +47 -0
  46. package/src/client-v2/components/AIEmployeesContext.tsx +110 -0
  47. package/src/client-v2/components/AgentRunsTab.tsx +767 -0
  48. package/src/client-v2/components/HarnessProfilesTab.tsx +254 -0
  49. package/src/client-v2/components/RulesTab.tsx +782 -0
  50. package/src/client-v2/components/TracingTab.tsx +432 -0
  51. package/src/client-v2/hooks/useApiRequest.ts +114 -0
  52. package/src/client-v2/pages/AgentRunsPage.tsx +13 -0
  53. package/src/client-v2/pages/ExecutionHistoryPage.tsx +10 -0
  54. package/src/client-v2/pages/HarnessProfilesPage.tsx +10 -0
  55. package/src/client-v2/pages/LoopSettingsPage.tsx +10 -0
  56. package/src/client-v2/pages/RulesPage.tsx +13 -0
  57. package/src/client-v2/pages/SkillDefinitionsPage.tsx +10 -0
  58. package/src/client-v2/pages/SkillMetricsPage.tsx +10 -0
  59. package/src/client-v2/pages/TracingPage.tsx +13 -0
  60. package/src/client-v2/plugin.tsx +70 -0
  61. package/src/client-v2/skill-hub/components/ExecutionHistory.tsx +196 -0
  62. package/src/client-v2/skill-hub/components/FileLinkList.tsx +37 -0
  63. package/src/client-v2/skill-hub/components/GitSkillImport.tsx +539 -0
  64. package/src/client-v2/skill-hub/components/LoopSettings.tsx +331 -0
  65. package/src/client-v2/skill-hub/components/SkillEditor.tsx +453 -0
  66. package/src/client-v2/skill-hub/components/SkillManager.tsx +174 -0
  67. package/src/client-v2/skill-hub/components/SkillMetrics.tsx +157 -0
  68. package/src/client-v2/skill-hub/components/SkillTestPanel.tsx +135 -0
  69. package/src/client-v2/skill-hub/locale.ts +13 -0
  70. package/src/client-v2/skill-hub/tools/loopTemplates.ts +52 -0
  71. package/src/client-v2/skill-hub/utils/jsonFields.ts +41 -0
  72. package/src/client-v2/utils/jsonFields.ts +41 -0
  73. package/src/locale/en-US.json +7 -0
  74. package/src/locale/vi-VN.json +7 -0
  75. package/src/locale/zh-CN.json +27 -0
  76. package/src/server/__tests__/agent-registry-service.test.ts +147 -0
  77. package/src/server/__tests__/code-validator.test.ts +63 -0
  78. package/src/server/__tests__/skill-execute.test.ts +33 -0
  79. package/src/server/__tests__/skill-settings.test.ts +63 -0
  80. package/src/server/migrations/20260615000000-normalize-ai-employee-tool-bindings.ts +39 -0
  81. package/src/server/plugin.ts +68 -12
  82. package/src/server/services/AgentHarness.ts +49 -22
  83. package/src/server/services/AgentLoopController.ts +17 -6
  84. package/src/server/services/AgentLoopService.ts +1 -1
  85. package/src/server/services/AgentPlannerService.ts +10 -0
  86. package/src/server/services/AgentRegistryService.ts +89 -47
  87. package/src/server/services/CircuitBreaker.ts +10 -0
  88. package/src/server/services/CodeValidator.ts +237 -159
  89. package/src/server/services/SandboxRunner.ts +203 -189
  90. package/src/server/skill-hub/plugin.ts +933 -898
  91. package/src/server/tools/delegate-task.ts +12 -9
  92. package/src/server/tools/skill-execute.ts +194 -160
  93. package/src/server/utils/ai-manager.ts +24 -0
  94. package/src/server/utils/ctx-utils.ts +14 -0
  95. package/src/server/utils/skill-settings.ts +116 -0
  96. package/dist/client/AIEmployeeSelect.d.ts +0 -11
  97. package/dist/client/AIEmployeesContext.d.ts +0 -30
  98. package/dist/client/AgentRunsTab.d.ts +0 -2
  99. package/dist/client/HarnessProfilesTab.d.ts +0 -2
  100. package/dist/client/OrchestratorSettings.d.ts +0 -3
  101. package/dist/client/RulesTab.d.ts +0 -2
  102. package/dist/client/TracingTab.d.ts +0 -2
  103. package/dist/client/hooks/useRunEventStream.d.ts +0 -22
  104. package/dist/client/index.d.ts +0 -2
  105. package/dist/client/plugin.d.ts +0 -6
  106. package/dist/client/skill-hub/components/ExecutionHistory.d.ts +0 -2
  107. package/dist/client/skill-hub/components/ExecutionProgress.d.ts +0 -20
  108. package/dist/client/skill-hub/components/GitSkillImport.d.ts +0 -7
  109. package/dist/client/skill-hub/components/LoopSettings.d.ts +0 -2
  110. package/dist/client/skill-hub/components/SkillEditor.d.ts +0 -7
  111. package/dist/client/skill-hub/components/SkillManager.d.ts +0 -2
  112. package/dist/client/skill-hub/components/SkillMetrics.d.ts +0 -2
  113. package/dist/client/skill-hub/components/SkillTestPanel.d.ts +0 -7
  114. package/dist/client/skill-hub/index.d.ts +0 -11
  115. package/dist/client/skill-hub/locale.d.ts +0 -3
  116. package/dist/client/skill-hub/tools/InteractionSchemasProvider.d.ts +0 -6
  117. package/dist/client/skill-hub/tools/SkillHubCard.d.ts +0 -3
  118. package/dist/client/skill-hub/tools/loopTemplates.d.ts +0 -22
  119. package/dist/client/skill-hub/tools/registerSkillLoopCards.d.ts +0 -1
  120. package/dist/client/skill-hub/utils/jsonFields.d.ts +0 -3
  121. package/dist/client/tools/PlanApprovalCard.d.ts +0 -3
  122. package/dist/client/tools/registerOrchestratorCards.d.ts +0 -1
  123. package/dist/index.d.ts +0 -2
  124. package/dist/server/collections/agent-execution-spans.d.ts +0 -9
  125. package/dist/server/collections/agent-harness-profiles.d.ts +0 -2
  126. package/dist/server/collections/agent-loop-events.d.ts +0 -2
  127. package/dist/server/collections/agent-loop-runs.d.ts +0 -2
  128. package/dist/server/collections/agent-loop-steps.d.ts +0 -2
  129. package/dist/server/collections/orchestrator-config.d.ts +0 -2
  130. package/dist/server/collections/orchestrator-logs.d.ts +0 -8
  131. package/dist/server/collections/skill-definitions.d.ts +0 -3
  132. package/dist/server/collections/skill-executions.d.ts +0 -3
  133. package/dist/server/collections/skill-loop-configs.d.ts +0 -3
  134. package/dist/server/collections/skill-worker-configs.d.ts +0 -3
  135. package/dist/server/migrations/20260423000000-add-progress-fields.d.ts +0 -4
  136. package/dist/server/migrations/20260425000000-add-interaction-schema.d.ts +0 -4
  137. package/dist/server/migrations/20260427000000-add-tracing-detail-fields.d.ts +0 -7
  138. package/dist/server/migrations/20260427000000-change-packages-to-text.d.ts +0 -4
  139. package/dist/server/migrations/20260427000001-change-other-json-to-text.d.ts +0 -4
  140. package/dist/server/migrations/20260429000000-add-llm-fields.d.ts +0 -7
  141. package/dist/server/migrations/20260429000000-fix-inputargs-json-to-text.d.ts +0 -16
  142. package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.d.ts +0 -7
  143. package/dist/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.d.ts +0 -7
  144. package/dist/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.d.ts +0 -12
  145. package/dist/server/migrations/20260601000000-add-token-fields.d.ts +0 -7
  146. package/dist/server/plugin.d.ts +0 -16
  147. package/dist/server/resources/agent-loop.d.ts +0 -3
  148. package/dist/server/resources/tracing.d.ts +0 -7
  149. package/dist/server/services/AgentHarness.d.ts +0 -44
  150. package/dist/server/services/AgentLoopController.d.ts +0 -218
  151. package/dist/server/services/AgentLoopRepository.d.ts +0 -20
  152. package/dist/server/services/AgentLoopService.d.ts +0 -159
  153. package/dist/server/services/AgentPlanValidator.d.ts +0 -4
  154. package/dist/server/services/AgentPlannerService.d.ts +0 -8
  155. package/dist/server/services/AgentRegistryService.d.ts +0 -21
  156. package/dist/server/services/CircuitBreaker.d.ts +0 -40
  157. package/dist/server/services/CodeValidator.d.ts +0 -32
  158. package/dist/server/services/ContextAggregator.d.ts +0 -45
  159. package/dist/server/services/ExecutionSpanService.d.ts +0 -46
  160. package/dist/server/services/FileManager.d.ts +0 -28
  161. package/dist/server/services/RunEventBus.d.ts +0 -9
  162. package/dist/server/services/SandboxRunner.d.ts +0 -41
  163. package/dist/server/services/SkillManager.d.ts +0 -6
  164. package/dist/server/services/SkillRepositoryService.d.ts +0 -22
  165. package/dist/server/services/TokenTracker.d.ts +0 -62
  166. package/dist/server/services/WorkerEnvManager.d.ts +0 -26
  167. package/dist/server/skill-hub/actions/git-import.d.ts +0 -21
  168. package/dist/server/skill-hub/mcp/McpController.d.ts +0 -15
  169. package/dist/server/skill-hub/plugin.d.ts +0 -61
  170. package/dist/server/skill-hub/tasks/SkillExecutionTask.d.ts +0 -16
  171. package/dist/server/skill-hub/utils/json-fields.d.ts +0 -7
  172. package/dist/server/tools/agent-loop.d.ts +0 -235
  173. package/dist/server/tools/delegate-task.d.ts +0 -19
  174. package/dist/server/tools/external-rag-search.d.ts +0 -42
  175. package/dist/server/tools/orchestrator-plan.d.ts +0 -205
  176. package/dist/server/tools/skill-execute.d.ts +0 -36
  177. package/dist/server/types.d.ts +0 -47
  178. package/dist/server/utils/ctx-utils.d.ts +0 -30
  179. package/dist/server/utils/logging.d.ts +0 -6
  180. /package/{dist/server/index.d.ts → src/client-v2/index.tsx} +0 -0
@@ -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
- };
@@ -1,235 +0,0 @@
1
- import { z } from 'zod';
2
- import { AgentLoopService } from '../services/AgentLoopService';
3
- export declare function createAgentLoopTools(plugin: any, service: AgentLoopService): ({
4
- scope: "CUSTOM";
5
- execution: "backend";
6
- defaultPermission: "ALLOW";
7
- introduction: {
8
- title: string;
9
- about: string;
10
- };
11
- definition: {
12
- name: string;
13
- description: string;
14
- schema: z.ZodObject<{
15
- goal: z.ZodString;
16
- leaderUsername: z.ZodOptional<z.ZodString>;
17
- sessionId: z.ZodOptional<z.ZodString>;
18
- messageId: z.ZodOptional<z.ZodString>;
19
- policy: z.ZodOptional<z.ZodObject<{
20
- maxIterations: z.ZodOptional<z.ZodNumber>;
21
- maxStepAttempts: z.ZodOptional<z.ZodNumber>;
22
- allowReplan: z.ZodOptional<z.ZodBoolean>;
23
- requireVerification: z.ZodOptional<z.ZodBoolean>;
24
- stopOnApprovalRequired: z.ZodOptional<z.ZodBoolean>;
25
- }, "strip", z.ZodTypeAny, {
26
- maxIterations?: number;
27
- maxStepAttempts?: number;
28
- allowReplan?: boolean;
29
- requireVerification?: boolean;
30
- stopOnApprovalRequired?: boolean;
31
- }, {
32
- maxIterations?: number;
33
- maxStepAttempts?: number;
34
- allowReplan?: boolean;
35
- requireVerification?: boolean;
36
- stopOnApprovalRequired?: boolean;
37
- }>>;
38
- metadata: z.ZodOptional<z.ZodAny>;
39
- plan: z.ZodOptional<z.ZodArray<z.ZodObject<{
40
- id: z.ZodOptional<z.ZodString>;
41
- key: z.ZodOptional<z.ZodString>;
42
- planKey: z.ZodOptional<z.ZodString>;
43
- parentStepId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
44
- title: z.ZodOptional<z.ZodString>;
45
- description: z.ZodOptional<z.ZodString>;
46
- type: z.ZodOptional<z.ZodEnum<["reasoning", "skill", "tool", "sub_agent", "verification"]>>;
47
- target: z.ZodOptional<z.ZodString>;
48
- input: z.ZodOptional<z.ZodAny>;
49
- dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
50
- maxAttempts: z.ZodOptional<z.ZodNumber>;
51
- metadata: z.ZodOptional<z.ZodAny>;
52
- }, "strip", z.ZodTypeAny, {
53
- type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
54
- key?: string;
55
- title?: string;
56
- description?: string;
57
- metadata?: any;
58
- input?: any;
59
- id?: string;
60
- planKey?: string;
61
- target?: string;
62
- dependsOn?: string[];
63
- parentStepId?: string | number;
64
- maxAttempts?: number;
65
- }, {
66
- type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
67
- key?: string;
68
- title?: string;
69
- description?: string;
70
- metadata?: any;
71
- input?: any;
72
- id?: string;
73
- planKey?: string;
74
- target?: string;
75
- dependsOn?: string[];
76
- parentStepId?: string | number;
77
- maxAttempts?: number;
78
- }>, "many">>;
79
- }, "strip", z.ZodTypeAny, {
80
- leaderUsername?: string;
81
- metadata?: any;
82
- sessionId?: string;
83
- goal?: string;
84
- messageId?: string;
85
- policy?: {
86
- maxIterations?: number;
87
- maxStepAttempts?: number;
88
- allowReplan?: boolean;
89
- requireVerification?: boolean;
90
- stopOnApprovalRequired?: boolean;
91
- };
92
- plan?: {
93
- type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
94
- key?: string;
95
- title?: string;
96
- description?: string;
97
- metadata?: any;
98
- input?: any;
99
- id?: string;
100
- planKey?: string;
101
- target?: string;
102
- dependsOn?: string[];
103
- parentStepId?: string | number;
104
- maxAttempts?: number;
105
- }[];
106
- }, {
107
- leaderUsername?: string;
108
- metadata?: any;
109
- sessionId?: string;
110
- goal?: string;
111
- messageId?: string;
112
- policy?: {
113
- maxIterations?: number;
114
- maxStepAttempts?: number;
115
- allowReplan?: boolean;
116
- requireVerification?: boolean;
117
- stopOnApprovalRequired?: boolean;
118
- };
119
- plan?: {
120
- type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
121
- key?: string;
122
- title?: string;
123
- description?: string;
124
- metadata?: any;
125
- input?: any;
126
- id?: string;
127
- planKey?: string;
128
- target?: string;
129
- dependsOn?: string[];
130
- parentStepId?: string | number;
131
- maxAttempts?: number;
132
- }[];
133
- }>;
134
- };
135
- invoke: (ctx: any, args: any) => Promise<{
136
- status: "success" | "error";
137
- content: string;
138
- }>;
139
- } | {
140
- scope: "CUSTOM";
141
- execution: "backend";
142
- defaultPermission: "ALLOW";
143
- introduction: {
144
- title: string;
145
- about: string;
146
- };
147
- definition: {
148
- name: string;
149
- description: string;
150
- schema: z.ZodObject<{
151
- runId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
152
- }, "strip", z.ZodTypeAny, {
153
- runId?: string | number;
154
- }, {
155
- runId?: string | number;
156
- }>;
157
- };
158
- invoke: (ctx: any, args: any) => Promise<{
159
- status: "success" | "error";
160
- content: string;
161
- }>;
162
- } | {
163
- scope: "CUSTOM";
164
- execution: "backend";
165
- defaultPermission: "ALLOW";
166
- introduction: {
167
- title: string;
168
- about: string;
169
- };
170
- definition: {
171
- name: string;
172
- description: string;
173
- schema: z.ZodObject<{
174
- stepId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
175
- status: z.ZodEnum<["running", "succeeded", "failed", "skipped"]>;
176
- output: z.ZodOptional<z.ZodAny>;
177
- error: z.ZodOptional<z.ZodString>;
178
- reason: z.ZodOptional<z.ZodString>;
179
- skillExecutionId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
180
- agentExecutionSpanId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
181
- metadata: z.ZodOptional<z.ZodAny>;
182
- }, "strip", z.ZodTypeAny, {
183
- error?: string;
184
- status?: "succeeded" | "failed" | "running" | "skipped";
185
- reason?: string;
186
- metadata?: any;
187
- output?: any;
188
- skillExecutionId?: string | number;
189
- stepId?: string | number;
190
- agentExecutionSpanId?: string | number;
191
- }, {
192
- error?: string;
193
- status?: "succeeded" | "failed" | "running" | "skipped";
194
- reason?: string;
195
- metadata?: any;
196
- output?: any;
197
- skillExecutionId?: string | number;
198
- stepId?: string | number;
199
- agentExecutionSpanId?: string | number;
200
- }>;
201
- };
202
- invoke: (ctx: any, args: any) => Promise<{
203
- status: "success" | "error";
204
- content: string;
205
- }>;
206
- } | {
207
- scope: "CUSTOM";
208
- execution: "backend";
209
- defaultPermission: "ALLOW";
210
- introduction: {
211
- title: string;
212
- about: string;
213
- };
214
- definition: {
215
- name: string;
216
- description: string;
217
- schema: z.ZodObject<{
218
- stepId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
219
- reason: z.ZodOptional<z.ZodString>;
220
- approval: z.ZodOptional<z.ZodAny>;
221
- }, "strip", z.ZodTypeAny, {
222
- reason?: string;
223
- stepId?: string | number;
224
- approval?: any;
225
- }, {
226
- reason?: string;
227
- stepId?: string | number;
228
- approval?: any;
229
- }>;
230
- };
231
- invoke: (ctx: any, args: any) => Promise<{
232
- status: "success" | "error";
233
- content: string;
234
- }>;
235
- })[];
@@ -1,19 +0,0 @@
1
- /**
2
- * Creates one dynamic tool per configured sub-agent for a given leader.
3
- * Uses Strategy B (Per-SubAgent Tool): each sub-agent becomes a separate tool
4
- * with its own name and description, making LLM tool selection natural.
5
- *
6
- * Architecture:
7
- * - Uses createReactAgent (public LangGraph API) for agent execution
8
- * - Uses plugin-ai's getLLMService() for LLM model resolution
9
- * - Uses core app.aiManager.toolsManager.listTools() for tool resolution
10
- * (same manager that AIEmployee uses — see ai-employee.ts:1286)
11
- * - Depth enforcement via ctx metadata tracking
12
- * - Per-leader scoping via invoke-time check (core ToolsOptions has no
13
- * leaderUsername field, so scoping is enforced in the invoke callback)
14
- */
15
- export declare function createDelegateToolsProvider(plugin: any): (register: any) => Promise<void>;
16
- /**
17
- * Test/internal helper to drop the in-memory tool cache (e.g., from a CLI op).
18
- */
19
- export declare function invalidateDelegateToolsCache(): void;
@@ -1,42 +0,0 @@
1
- import { z } from 'zod';
2
- export declare function createExternalRagSearchTool(plugin: any): {
3
- scope: "CUSTOM";
4
- execution: "backend";
5
- defaultPermission: "ALLOW";
6
- introduction: {
7
- title: string;
8
- about: string;
9
- };
10
- definition: {
11
- name: string;
12
- description: string;
13
- schema: z.ZodObject<{
14
- query: z.ZodString;
15
- knowledgeBaseIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
16
- topK: z.ZodOptional<z.ZodNumber>;
17
- scoreThreshold: z.ZodOptional<z.ZodNumber>;
18
- }, "strip", z.ZodTypeAny, {
19
- query?: string;
20
- knowledgeBaseIds?: string[];
21
- topK?: number;
22
- scoreThreshold?: number;
23
- }, {
24
- query?: string;
25
- knowledgeBaseIds?: string[];
26
- topK?: number;
27
- scoreThreshold?: number;
28
- }>;
29
- };
30
- invoke: (ctx: any, args: {
31
- query?: string;
32
- knowledgeBaseIds?: string[];
33
- topK?: number;
34
- scoreThreshold?: number;
35
- }) => Promise<{
36
- status: "error";
37
- content: string;
38
- } | {
39
- status: "success";
40
- content: string;
41
- }>;
42
- };
@@ -1,205 +0,0 @@
1
- import { z } from 'zod';
2
- import { AgentLoopService } from '../services/AgentLoopService';
3
- export declare function createOrchestratorPlanTools(plugin: any, service: AgentLoopService): ({
4
- scope: "CUSTOM";
5
- execution: "backend";
6
- defaultPermission: "ALLOW";
7
- introduction: {
8
- title: string;
9
- about: string;
10
- };
11
- definition: {
12
- name: string;
13
- description: string;
14
- schema: z.ZodObject<{
15
- goal: z.ZodString;
16
- runId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
17
- leaderUsername: z.ZodOptional<z.ZodString>;
18
- sessionId: z.ZodOptional<z.ZodString>;
19
- messageId: z.ZodOptional<z.ZodString>;
20
- harnessTag: z.ZodDefault<z.ZodOptional<z.ZodString>>;
21
- targetAgent: z.ZodOptional<z.ZodString>;
22
- plannerModel: z.ZodOptional<z.ZodString>;
23
- policy: z.ZodOptional<z.ZodObject<{
24
- maxIterations: z.ZodOptional<z.ZodNumber>;
25
- maxStepAttempts: z.ZodOptional<z.ZodNumber>;
26
- allowReplan: z.ZodOptional<z.ZodBoolean>;
27
- requireVerification: z.ZodOptional<z.ZodBoolean>;
28
- stopOnApprovalRequired: z.ZodOptional<z.ZodBoolean>;
29
- }, "strip", z.ZodTypeAny, {
30
- maxIterations?: number;
31
- maxStepAttempts?: number;
32
- allowReplan?: boolean;
33
- requireVerification?: boolean;
34
- stopOnApprovalRequired?: boolean;
35
- }, {
36
- maxIterations?: number;
37
- maxStepAttempts?: number;
38
- allowReplan?: boolean;
39
- requireVerification?: boolean;
40
- stopOnApprovalRequired?: boolean;
41
- }>>;
42
- metadata: z.ZodOptional<z.ZodAny>;
43
- plan: z.ZodOptional<z.ZodArray<z.ZodObject<{
44
- id: z.ZodOptional<z.ZodString>;
45
- key: z.ZodOptional<z.ZodString>;
46
- planKey: z.ZodOptional<z.ZodString>;
47
- parentStepId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
48
- title: z.ZodOptional<z.ZodString>;
49
- description: z.ZodOptional<z.ZodString>;
50
- type: z.ZodOptional<z.ZodEnum<["reasoning", "skill", "tool", "sub_agent", "verification"]>>;
51
- target: z.ZodOptional<z.ZodString>;
52
- input: z.ZodOptional<z.ZodAny>;
53
- dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
54
- dependencyPolicy: z.ZodOptional<z.ZodEnum<["require_success", "allow_skipped"]>>;
55
- maxAttempts: z.ZodOptional<z.ZodNumber>;
56
- metadata: z.ZodOptional<z.ZodAny>;
57
- }, "strip", z.ZodTypeAny, {
58
- type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
59
- key?: string;
60
- title?: string;
61
- description?: string;
62
- metadata?: any;
63
- input?: any;
64
- id?: string;
65
- planKey?: string;
66
- target?: string;
67
- dependsOn?: string[];
68
- parentStepId?: string | number;
69
- dependencyPolicy?: "require_success" | "allow_skipped";
70
- maxAttempts?: number;
71
- }, {
72
- type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
73
- key?: string;
74
- title?: string;
75
- description?: string;
76
- metadata?: any;
77
- input?: any;
78
- id?: string;
79
- planKey?: string;
80
- target?: string;
81
- dependsOn?: string[];
82
- parentStepId?: string | number;
83
- dependencyPolicy?: "require_success" | "allow_skipped";
84
- maxAttempts?: number;
85
- }>, "many">>;
86
- }, "strip", z.ZodTypeAny, {
87
- leaderUsername?: string;
88
- metadata?: any;
89
- runId?: string | number;
90
- sessionId?: string;
91
- goal?: string;
92
- messageId?: string;
93
- policy?: {
94
- maxIterations?: number;
95
- maxStepAttempts?: number;
96
- allowReplan?: boolean;
97
- requireVerification?: boolean;
98
- stopOnApprovalRequired?: boolean;
99
- };
100
- harnessTag?: string;
101
- targetAgent?: string;
102
- plannerModel?: string;
103
- plan?: {
104
- type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
105
- key?: string;
106
- title?: string;
107
- description?: string;
108
- metadata?: any;
109
- input?: any;
110
- id?: string;
111
- planKey?: string;
112
- target?: string;
113
- dependsOn?: string[];
114
- parentStepId?: string | number;
115
- dependencyPolicy?: "require_success" | "allow_skipped";
116
- maxAttempts?: number;
117
- }[];
118
- }, {
119
- leaderUsername?: string;
120
- metadata?: any;
121
- runId?: string | number;
122
- sessionId?: string;
123
- goal?: string;
124
- messageId?: string;
125
- policy?: {
126
- maxIterations?: number;
127
- maxStepAttempts?: number;
128
- allowReplan?: boolean;
129
- requireVerification?: boolean;
130
- stopOnApprovalRequired?: boolean;
131
- };
132
- harnessTag?: string;
133
- targetAgent?: string;
134
- plannerModel?: string;
135
- plan?: {
136
- type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
137
- key?: string;
138
- title?: string;
139
- description?: string;
140
- metadata?: any;
141
- input?: any;
142
- id?: string;
143
- planKey?: string;
144
- target?: string;
145
- dependsOn?: string[];
146
- parentStepId?: string | number;
147
- dependencyPolicy?: "require_success" | "allow_skipped";
148
- maxAttempts?: number;
149
- }[];
150
- }>;
151
- };
152
- invoke: (ctx: any, args: any) => Promise<{
153
- status: "success" | "error";
154
- content: string;
155
- }>;
156
- } | {
157
- scope: "CUSTOM";
158
- execution: "backend";
159
- defaultPermission: "ALLOW";
160
- introduction: {
161
- title: string;
162
- about: string;
163
- };
164
- definition: {
165
- name: string;
166
- description: string;
167
- schema: z.ZodObject<{
168
- runId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
169
- }, "strip", z.ZodTypeAny, {
170
- runId?: string | number;
171
- }, {
172
- runId?: string | number;
173
- }>;
174
- };
175
- invoke: (_ctx: any, args: any) => Promise<{
176
- status: "success" | "error";
177
- content: string;
178
- }>;
179
- } | {
180
- scope: "CUSTOM";
181
- execution: "backend";
182
- defaultPermission: "ASK";
183
- introduction: {
184
- title: string;
185
- about: string;
186
- };
187
- definition: {
188
- name: string;
189
- description: string;
190
- schema: z.ZodObject<{
191
- runId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
192
- reason: z.ZodOptional<z.ZodString>;
193
- }, "strip", z.ZodTypeAny, {
194
- reason?: string;
195
- runId?: string | number;
196
- }, {
197
- reason?: string;
198
- runId?: string | number;
199
- }>;
200
- };
201
- invoke: (ctx: any, args: any) => Promise<{
202
- status: "success" | "error";
203
- content: string;
204
- }>;
205
- })[];
@@ -1,36 +0,0 @@
1
- export declare function createSkillExecuteTool(plugin: any): {
2
- scope: string;
3
- execution: string;
4
- defaultPermission: string;
5
- introduction: {
6
- title: string;
7
- about: string;
8
- };
9
- definition: {
10
- name: string;
11
- description: string;
12
- schema: {
13
- type: string;
14
- properties: {
15
- action: {
16
- type: string;
17
- enum: string[];
18
- description: string;
19
- };
20
- skillName: {
21
- type: string;
22
- description: string;
23
- };
24
- input: {
25
- type: string;
26
- description: string;
27
- };
28
- };
29
- required: string[];
30
- };
31
- };
32
- invoke(ctx: any, args: Record<string, any>, _id?: string): Promise<{
33
- status: string;
34
- content: string;
35
- }>;
36
- };
@@ -1,47 +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
- export interface CircuitState {
16
- failures: number;
17
- lastFailureTime: number;
18
- state: 'closed' | 'open' | 'half-open';
19
- }
20
- export interface TraceEvent {
21
- type: string;
22
- at: string;
23
- title: string;
24
- content?: string;
25
- toolName?: string;
26
- args?: any;
27
- status?: string;
28
- }
29
- export interface DelegationLogData {
30
- id?: number | string;
31
- leaderUsername: string;
32
- subAgentUsername: string;
33
- toolName: string;
34
- task: string;
35
- context?: string;
36
- result: string;
37
- status: string;
38
- depth: number;
39
- durationMs: number;
40
- error?: string;
41
- trace?: TraceEvent[];
42
- messages?: any[];
43
- userId?: number | string;
44
- }
45
- export type CtxSnapshot = {
46
- userId?: number;
47
- };
@@ -1,30 +0,0 @@
1
- /** Normalize a record to a plain JS object. */
2
- export declare function toPlain(record: any): any;
3
- /** Coerce a value to a plain object (JSON parse if needed). */
4
- export declare function asObject(value: any): any;
5
- /** Coerce value to array. */
6
- export declare function asArray(value: any): any[];
7
- /** Trim text to max length with ellipsis suffix. */
8
- export declare function trimText(value: any, max?: number): string;
9
- /** Get the current user id from ctx. */
10
- export declare function currentUserId(ctx: any): any;
11
- /** Get action params values from ctx. */
12
- export declare function valuesFromCtx(ctx: any): any;
13
- /** Normalize raw employee username input (string | object → string | null). */
14
- export declare function normalizeEmployeeUsername(raw: any): any;
15
- /** Resolve session id from args or ctx. */
16
- export declare function resolveSessionId(ctx: any, args: any): any;
17
- /** Resolve message id from args or ctx. */
18
- export declare function resolveMessageId(ctx: any, args: any): any;
19
- /** Resolve leader employee username from args, ctx state, or conversation record. */
20
- export declare function resolveLeaderUsername(ctx: any, plugin: any, args: any): Promise<any>;
21
- /** Snapshot ctx user id for later use (avoids stale ctx). */
22
- export declare function captureCtxSnapshot(ctx: any): {
23
- userId?: number;
24
- };
25
- /** Normalize step type to a known value. */
26
- export declare function normalizeStepType(value: any): any;
27
- /** Normalize plan key from step input. */
28
- export declare function normalizePlanKey(step: any, index: number): string;
29
- /** Now ISO string. */
30
- export declare function nowIso(): string;
@@ -1,6 +0,0 @@
1
- import { DelegationLogData } from '../types';
2
- /**
3
- * Log (or update) a delegation event in the orchestratorLogs collection.
4
- * Used by both delegate-task.ts and AgentHarness.ts.
5
- */
6
- export declare function logDelegation(ctx: any, plugin: any, data: DelegationLogData): Promise<any>;