plugin-agent-orchestrator 1.0.20 → 1.0.21

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 (98) hide show
  1. package/dist/client/hooks/useRunEventStream.d.ts +22 -0
  2. package/dist/client/index.d.ts +1 -0
  3. package/dist/client/index.js +1 -1
  4. package/dist/externalVersion.js +6 -6
  5. package/dist/server/collections/agent-execution-spans.js +24 -0
  6. package/dist/server/collections/agent-loop-runs.js +36 -0
  7. package/dist/server/collections/orchestrator-config.js +14 -0
  8. package/dist/server/migrations/20260601000000-add-token-fields.d.ts +7 -0
  9. package/dist/server/migrations/20260601000000-add-token-fields.js +101 -0
  10. package/dist/server/plugin.js +47 -0
  11. package/dist/server/resources/agent-loop.js +33 -25
  12. package/dist/server/resources/tracing.js +5 -8
  13. package/dist/server/services/AgentHarness.d.ts +2 -0
  14. package/dist/server/services/AgentHarness.js +56 -90
  15. package/dist/server/services/AgentLoopController.d.ts +33 -20
  16. package/dist/server/services/AgentLoopController.js +164 -125
  17. package/dist/server/services/AgentLoopRepository.js +16 -34
  18. package/dist/server/services/AgentLoopService.d.ts +28 -18
  19. package/dist/server/services/AgentLoopService.js +7 -1
  20. package/dist/server/services/AgentPlannerService.js +5 -25
  21. package/dist/server/services/AgentRegistryService.d.ts +8 -0
  22. package/dist/server/services/AgentRegistryService.js +34 -24
  23. package/dist/server/services/CircuitBreaker.d.ts +40 -0
  24. package/dist/server/services/CircuitBreaker.js +120 -0
  25. package/dist/server/services/ContextAggregator.d.ts +45 -0
  26. package/dist/server/services/ContextAggregator.js +201 -0
  27. package/dist/server/services/ExecutionSpanService.js +2 -5
  28. package/dist/server/services/RunEventBus.d.ts +9 -0
  29. package/dist/server/services/RunEventBus.js +73 -0
  30. package/dist/server/services/TokenTracker.d.ts +62 -0
  31. package/dist/server/services/TokenTracker.js +173 -0
  32. package/dist/server/tools/agent-loop.d.ts +8 -8
  33. package/dist/server/tools/agent-loop.js +30 -63
  34. package/dist/server/tools/delegate-task.js +14 -72
  35. package/dist/server/tools/orchestrator-plan.d.ts +6 -6
  36. package/dist/server/tools/orchestrator-plan.js +10 -47
  37. package/dist/server/types.d.ts +47 -0
  38. package/dist/server/types.js +24 -0
  39. package/dist/server/utils/ctx-utils.d.ts +30 -0
  40. package/dist/server/utils/ctx-utils.js +152 -0
  41. package/dist/server/utils/logging.d.ts +6 -0
  42. package/dist/server/utils/logging.js +86 -0
  43. package/package.json +44 -44
  44. package/src/client/AgentRunsTab.tsx +764 -764
  45. package/src/client/HarnessProfilesTab.tsx +247 -247
  46. package/src/client/OrchestratorSettings.tsx +106 -106
  47. package/src/client/RulesTab.tsx +716 -716
  48. package/src/client/hooks/useRunEventStream.ts +76 -0
  49. package/src/client/index.tsx +2 -1
  50. package/src/client/plugin.tsx +27 -27
  51. package/src/client/skill-hub/components/LoopSettings.tsx +331 -331
  52. package/src/client/skill-hub/index.tsx +51 -51
  53. package/src/client/skill-hub/tools/InteractionSchemasProvider.tsx +99 -99
  54. package/src/client/skill-hub/tools/SkillHubCard.tsx +109 -109
  55. package/src/client/skill-hub/tools/loopTemplates.ts +52 -52
  56. package/src/client/skill-hub/tools/registerSkillLoopCards.ts +58 -58
  57. package/src/client/tools/PlanApprovalCard.tsx +175 -175
  58. package/src/client/tools/registerOrchestratorCards.ts +7 -7
  59. package/src/server/__tests__/agent-loop-controller.test.ts +375 -0
  60. package/src/server/__tests__/circuit-breaker.test.ts +169 -0
  61. package/src/server/__tests__/context-aggregator.test.ts +222 -0
  62. package/src/server/__tests__/parallel-execution.test.ts +318 -0
  63. package/src/server/__tests__/smoke.test.ts +120 -0
  64. package/src/server/collections/agent-execution-spans.ts +24 -0
  65. package/src/server/collections/agent-harness-profiles.ts +59 -59
  66. package/src/server/collections/agent-loop-events.ts +71 -71
  67. package/src/server/collections/agent-loop-runs.ts +38 -1
  68. package/src/server/collections/agent-loop-steps.ts +144 -144
  69. package/src/server/collections/orchestrator-config.ts +14 -0
  70. package/src/server/collections/skill-executions.ts +106 -106
  71. package/src/server/collections/skill-loop-configs.ts +65 -65
  72. package/src/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.ts +30 -30
  73. package/src/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.ts +142 -142
  74. package/src/server/migrations/20260601000000-add-token-fields.ts +89 -0
  75. package/src/server/plugin.ts +53 -0
  76. package/src/server/resources/agent-loop.ts +21 -12
  77. package/src/server/resources/tracing.ts +3 -7
  78. package/src/server/services/AgentHarness.ts +78 -116
  79. package/src/server/services/AgentLoopController.ts +197 -122
  80. package/src/server/services/AgentLoopRepository.ts +9 -25
  81. package/src/server/services/AgentLoopService.ts +13 -1
  82. package/src/server/services/AgentPlanValidator.ts +73 -73
  83. package/src/server/services/AgentPlannerService.ts +2 -25
  84. package/src/server/services/AgentRegistryService.ts +40 -31
  85. package/src/server/services/CircuitBreaker.ts +116 -0
  86. package/src/server/services/ContextAggregator.ts +239 -0
  87. package/src/server/services/ExecutionSpanService.ts +2 -4
  88. package/src/server/services/RunEventBus.ts +45 -0
  89. package/src/server/services/TokenTracker.ts +209 -0
  90. package/src/server/skill-hub/plugin.ts +898 -898
  91. package/src/server/skill-hub/tasks/SkillExecutionTask.ts +460 -460
  92. package/src/server/tools/agent-loop.ts +18 -57
  93. package/src/server/tools/delegate-task.ts +11 -93
  94. package/src/server/tools/orchestrator-plan.ts +26 -50
  95. package/src/server/tools/skill-execute.ts +160 -160
  96. package/src/server/types.ts +55 -0
  97. package/src/server/utils/ctx-utils.ts +118 -0
  98. package/src/server/utils/logging.ts +63 -0
@@ -34,54 +34,30 @@ var import_prebuilt = require("@langchain/langgraph/prebuilt");
34
34
  var import_tools = require("@langchain/core/tools");
35
35
  var import_messages = require("@langchain/core/messages");
36
36
  var import_ExecutionSpanService = require("./ExecutionSpanService");
37
+ var import_TokenTracker = require("./TokenTracker");
38
+ var import_ContextAggregator = require("./ContextAggregator");
39
+ var import_CircuitBreaker = require("./CircuitBreaker");
40
+ var import_ctx_utils = require("../utils/ctx-utils");
41
+ var import_logging = require("../utils/logging");
37
42
  const ORCHESTRATOR_DEPTH_KEY = "__orchestratorDepth";
38
43
  const ORCHESTRATOR_PATH_KEY = "__orchestratorPath";
39
- function toPlain(record) {
40
- var _a;
41
- return ((_a = record == null ? void 0 : record.toJSON) == null ? void 0 : _a.call(record)) || record;
42
- }
43
- function asObject(value) {
44
- if (value && typeof value === "object" && !Array.isArray(value)) return value;
45
- if (typeof value === "string" && value.trim()) {
46
- try {
47
- const parsed = JSON.parse(value);
48
- return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
49
- } catch {
50
- return {};
51
- }
52
- }
53
- return {};
54
- }
55
- function trimText(value, max = 5e4) {
56
- let text = "";
57
- if (typeof value === "string") {
58
- text = value;
59
- } else if (value != null) {
60
- try {
61
- text = JSON.stringify(value);
62
- } catch {
63
- text = String(value);
64
- }
65
- }
66
- return text.length > max ? `${text.slice(0, max)}
67
- ...[truncated]` : text;
68
- }
69
44
  function sanitizeToolPart(value) {
70
45
  return (value || "").replace(/[^a-zA-Z0-9_-]/g, "_");
71
46
  }
72
47
  function buildDelegateToolName(leaderUsername, subAgentUsername) {
73
48
  return `delegate_${sanitizeToolPart(leaderUsername)}_to_${sanitizeToolPart(subAgentUsername)}`;
74
49
  }
75
- function nowIso() {
76
- return (/* @__PURE__ */ new Date()).toISOString();
77
- }
78
50
  class AgentHarness {
79
51
  constructor(plugin, registryService) {
80
52
  this.plugin = plugin;
81
53
  this.registryService = registryService;
82
54
  this.spanService = new import_ExecutionSpanService.ExecutionSpanService(plugin);
55
+ this.tokenTracker = new import_TokenTracker.TokenTracker(plugin);
56
+ this.contextAggregator = new import_ContextAggregator.ContextAggregator(plugin);
83
57
  }
84
58
  spanService;
59
+ tokenTracker;
60
+ contextAggregator;
85
61
  get db() {
86
62
  return this.plugin.db;
87
63
  }
@@ -89,9 +65,9 @@ class AgentHarness {
89
65
  return this.plugin.app;
90
66
  }
91
67
  async executeStep(run, step, options = {}) {
92
- const harnessTag = asObject(run.metadata).harnessTag || asObject(step.metadata).harnessTag || "default";
68
+ const harnessTag = (0, import_ctx_utils.asObject)(run.metadata).harnessTag || (0, import_ctx_utils.asObject)(step.metadata).harnessTag || "default";
93
69
  const profile = await this.registryService.getHarnessProfile(harnessTag);
94
- const settings = asObject(profile == null ? void 0 : profile.settings);
70
+ const settings = (0, import_ctx_utils.asObject)(profile == null ? void 0 : profile.settings);
95
71
  if (step.type === "sub_agent") {
96
72
  if (settings.allowSubAgents === false) {
97
73
  throw new Error(`Harness profile "${harnessTag}" does not allow sub-agent execution.`);
@@ -121,7 +97,7 @@ class AgentHarness {
121
97
  }
122
98
  async invokeSubAgentStep(run, step, settings, options) {
123
99
  var _a;
124
- const target = step.target || asObject(step.metadata).subAgentUsername || ((_a = step.input) == null ? void 0 : _a.subAgentUsername);
100
+ const target = step.target || (0, import_ctx_utils.asObject)(step.metadata).subAgentUsername || ((_a = step.input) == null ? void 0 : _a.subAgentUsername);
125
101
  if (!target) {
126
102
  throw new Error(`Sub-agent step "${step.planKey}" is missing target sub-agent username.`);
127
103
  }
@@ -130,17 +106,33 @@ class AgentHarness {
130
106
  }
131
107
  const toolName = String(target).startsWith("delegate_") ? String(target) : buildDelegateToolName(run.leaderUsername, target);
132
108
  const task = step.description || step.title || run.goal;
133
- const context = trimText(
109
+ const context = (0, import_ctx_utils.trimText)(
134
110
  {
135
111
  goal: run.goal,
136
112
  input: step.input || {},
137
- harnessTag: asObject(run.metadata).harnessTag || asObject(step.metadata).harnessTag || "default",
113
+ harnessTag: (0, import_ctx_utils.asObject)(run.metadata).harnessTag || (0, import_ctx_utils.asObject)(step.metadata).harnessTag || "default",
138
114
  agentLoopRunId: String(run.id),
139
115
  agentLoopStepId: String(step.id)
140
116
  },
141
117
  2e4
142
118
  );
143
- return this.invokeNamedTool(run, step, toolName, { task, context }, settings, options);
119
+ const circuitBreaker = (0, import_CircuitBreaker.getCircuitBreaker)({ appLog: this.app });
120
+ if (!circuitBreaker.isAllowed(target)) {
121
+ const state = circuitBreaker.getState(target);
122
+ throw new Error(
123
+ `Sub-agent "${target}" circuit is open (${(state == null ? void 0 : state.failures) || 0} failures). Retry after the recovery timeout.`
124
+ );
125
+ }
126
+ try {
127
+ const result = await this.invokeNamedTool(run, step, toolName, { task, context }, settings, options);
128
+ circuitBreaker.recordSuccess(target);
129
+ return result;
130
+ } catch (e) {
131
+ if ((e == null ? void 0 : e.message) !== "requires_approval") {
132
+ circuitBreaker.recordFailure(target);
133
+ }
134
+ throw e;
135
+ }
144
136
  }
145
137
  async invokeNamedTool(run, step, toolName, args, settings, options) {
146
138
  var _a, _b, _c, _d, _e;
@@ -225,7 +217,7 @@ class AgentHarness {
225
217
  const trace = [
226
218
  {
227
219
  type: "start",
228
- at: nowIso(),
220
+ at: (0, import_ctx_utils.nowIso)(),
229
221
  title: `Delegation started: ${leaderUsername} -> ${subAgentUsername}`,
230
222
  content: task
231
223
  }
@@ -345,26 +337,26 @@ class AgentHarness {
345
337
  });
346
338
  trace.push({
347
339
  type: "tool_call",
348
- at: nowIso(),
340
+ at: (0, import_ctx_utils.nowIso)(),
349
341
  title: `Calling tool: ${toolEntry.definition.name}`,
350
342
  toolName: toolEntry.definition.name,
351
343
  args: toolArgs
352
344
  });
353
345
  try {
354
346
  const res = await toolEntry.invoke(invokeCtx, toolArgs, `orch-${toolCallId}`);
355
- const output = trimText((res == null ? void 0 : res.content) ?? (res == null ? void 0 : res.result) ?? res, 5e4);
347
+ const output = (0, import_ctx_utils.trimText)((res == null ? void 0 : res.content) ?? (res == null ? void 0 : res.result) ?? res, 5e4);
356
348
  trace.push({
357
349
  type: "tool_result",
358
- at: nowIso(),
350
+ at: (0, import_ctx_utils.nowIso)(),
359
351
  title: `Tool finished: ${toolEntry.definition.name}`,
360
352
  toolName: toolEntry.definition.name,
361
353
  status: (res == null ? void 0 : res.status) || "success",
362
- content: trimText(output, 2e3)
354
+ content: (0, import_ctx_utils.trimText)(output, 2e3)
363
355
  });
364
356
  if ((res == null ? void 0 : res.status) === "error") {
365
357
  await this.spanService.finish(toolSpanId, "error", toolStartedAt, {
366
358
  output,
367
- error: trimText(res.content || output, 1e4)
359
+ error: (0, import_ctx_utils.trimText)(res.content || output, 1e4)
368
360
  });
369
361
  throw new Error(`Tool <${toolEntry.definition.name}> failed: ${res.content}`);
370
362
  }
@@ -376,14 +368,14 @@ class AgentHarness {
376
368
  } catch (e) {
377
369
  trace.push({
378
370
  type: "tool_error",
379
- at: nowIso(),
371
+ at: (0, import_ctx_utils.nowIso)(),
380
372
  title: `Tool failed: ${toolEntry.definition.name}`,
381
373
  toolName: toolEntry.definition.name,
382
374
  status: "error",
383
375
  content: e.message
384
376
  });
385
377
  await this.spanService.finish(toolSpanId, "error", toolStartedAt, {
386
- error: trimText(e.message, 1e4)
378
+ error: (0, import_ctx_utils.trimText)(e.message, 1e4)
387
379
  });
388
380
  throw e;
389
381
  }
@@ -414,7 +406,13 @@ ${contextSummary}
414
406
  </shared_context>`;
415
407
  }
416
408
  }
417
- } catch {
409
+ } catch (e) {
410
+ }
411
+ if (agentLoopRunId) {
412
+ try {
413
+ systemPrompt = await this.contextAggregator.enrichSystemPrompt(systemPrompt, agentLoopRunId, agentLoopStepId);
414
+ } catch {
415
+ }
418
416
  }
419
417
  const combinedTask = context ? `Task: ${task}
420
418
 
@@ -423,7 +421,7 @@ ${context}` : `Task: ${task}`;
423
421
  const effectiveLimit = recursionLimit && recursionLimit > 0 ? recursionLimit : 50;
424
422
  let timeoutId;
425
423
  const timeoutMs = Number(timeout) > 0 ? Number(timeout) : 12e4;
426
- const timeoutPromise = new Promise((_, reject) => {
424
+ const timeoutPromise = new Promise((_resolve, reject) => {
427
425
  timeoutId = setTimeout(() => {
428
426
  abortController.abort();
429
427
  reject(new Error(`Sub-agent execution timed out after ${timeoutMs}ms.`));
@@ -441,6 +439,10 @@ ${context}` : `Task: ${task}`;
441
439
  } finally {
442
440
  if (timeoutId) clearTimeout(timeoutId);
443
441
  }
442
+ const tokenUsage = (0, import_TokenTracker.extractTokenUsage)(finalState);
443
+ if (tokenUsage) {
444
+ await this.tokenTracker.trackSpan(executionSpanId, tokenUsage, agentLoopRunId);
445
+ }
444
446
  const messages = (finalState == null ? void 0 : finalState.messages) || [];
445
447
  const lastAIMessage = [...messages].reverse().find((m) => m.getType() === "ai");
446
448
  let content = "";
@@ -449,10 +451,10 @@ ${context}` : `Task: ${task}`;
449
451
  }
450
452
  trace.push({
451
453
  type: "finish",
452
- at: nowIso(),
454
+ at: (0, import_ctx_utils.nowIso)(),
453
455
  title: `Delegation finished: ${subAgentUsername}`,
454
456
  status: "success",
455
- content: trimText(content, 2e3)
457
+ content: (0, import_ctx_utils.trimText)(content, 2e3)
456
458
  });
457
459
  await this.logDelegation(ctx, {
458
460
  id: logRecord == null ? void 0 : logRecord.id,
@@ -484,7 +486,7 @@ ${context}` : `Task: ${task}`;
484
486
  } catch (e) {
485
487
  trace.push({
486
488
  type: "error",
487
- at: nowIso(),
489
+ at: (0, import_ctx_utils.nowIso)(),
488
490
  title: `Delegation failed: ${subAgentUsername}`,
489
491
  status: "error",
490
492
  content: e.message
@@ -504,7 +506,7 @@ ${context}` : `Task: ${task}`;
504
506
  trace
505
507
  });
506
508
  await this.spanService.finish(executionSpanId, "error", startTime, {
507
- error: trimText(e.message, 1e4),
509
+ error: (0, import_ctx_utils.trimText)(e.message, 1e4),
508
510
  metadata: {
509
511
  depth: currentDepth,
510
512
  toolName,
@@ -520,43 +522,7 @@ ${context}` : `Task: ${task}`;
520
522
  }
521
523
  }
522
524
  async logDelegation(ctx, data) {
523
- var _a, _b, _c, _d;
524
- try {
525
- const logsRepo = this.db.getRepository("orchestratorLogs");
526
- if (!logsRepo) return null;
527
- const userId = ((_b = (_a = ctx == null ? void 0 : ctx.auth) == null ? void 0 : _a.user) == null ? void 0 : _b.id) || ((_d = (_c = ctx == null ? void 0 : ctx.state) == null ? void 0 : _c.currentUser) == null ? void 0 : _d.id);
528
- const values = {
529
- leaderUsername: data.leaderUsername,
530
- subAgentUsername: data.subAgentUsername,
531
- toolName: data.toolName,
532
- task: trimText(data.task, 1e4),
533
- context: trimText(data.context || "", 1e4),
534
- result: trimText(data.result || "", 5e4),
535
- status: data.status,
536
- depth: data.depth,
537
- durationMs: data.durationMs,
538
- error: trimText(data.error || "", 1e4),
539
- trace: data.trace || [],
540
- userId,
541
- updatedAt: /* @__PURE__ */ new Date()
542
- };
543
- if (data.id) {
544
- await logsRepo.update({
545
- filterByTk: data.id,
546
- values
547
- });
548
- return { id: data.id };
549
- }
550
- const record = await logsRepo.create({
551
- values: {
552
- ...values,
553
- createdAt: /* @__PURE__ */ new Date()
554
- }
555
- });
556
- return toPlain(record);
557
- } catch {
558
- return null;
559
- }
525
+ return (0, import_logging.logDelegation)(ctx, this.plugin, data);
560
526
  }
561
527
  }
562
528
  // Annotate the CommonJS export names for ESM import in node:
@@ -4,13 +4,15 @@ import { AgentPlanValidator } from './AgentPlanValidator';
4
4
  import { AgentLoopRepository } from './AgentLoopRepository';
5
5
  import { AgentHarness } from './AgentHarness';
6
6
  import { AgentLoopPolicy, AgentLoopPlanStepInput, AgentLoopRunStatus } from './AgentLoopService';
7
+ import { TokenTracker } from './TokenTracker';
7
8
  export declare class AgentLoopController {
8
9
  private readonly registryService;
9
10
  private readonly plannerService;
10
11
  private readonly validator;
11
12
  private readonly repository;
12
13
  private readonly harness;
13
- constructor(registryService: AgentRegistryService, plannerService: AgentPlannerService, validator: AgentPlanValidator, repository: AgentLoopRepository, harness: AgentHarness);
14
+ private readonly tokenTracker;
15
+ constructor(registryService: AgentRegistryService, plannerService: AgentPlannerService, validator: AgentPlanValidator, repository: AgentLoopRepository, harness: AgentHarness, tokenTracker?: TokenTracker | null);
14
16
  createRun(options: {
15
17
  goal: string;
16
18
  leaderUsername?: string;
@@ -23,7 +25,7 @@ export declare class AgentLoopController {
23
25
  }): Promise<{
24
26
  run: any;
25
27
  steps: any;
26
- nextStep: any;
28
+ nextSteps: any[];
27
29
  }>;
28
30
  planGoal(options: {
29
31
  goal: string;
@@ -45,7 +47,7 @@ export declare class AgentLoopController {
45
47
  skillExecutions: any;
46
48
  run: any;
47
49
  steps: any;
48
- nextStep: any;
50
+ nextSteps: any[];
49
51
  }>;
50
52
  revisePlanGoal(runId: string | number, plan: AgentLoopPlanStepInput[], options?: {
51
53
  goal?: string;
@@ -62,7 +64,7 @@ export declare class AgentLoopController {
62
64
  skillExecutions: any;
63
65
  run: any;
64
66
  steps: any;
65
- nextStep: any;
67
+ nextSteps: any[];
66
68
  }>;
67
69
  approvePlanAndExecute(runId: string | number, options?: {
68
70
  userId?: string | number;
@@ -71,7 +73,7 @@ export declare class AgentLoopController {
71
73
  }): Promise<{
72
74
  run: any;
73
75
  steps: any;
74
- nextStep: any;
76
+ nextSteps: any[];
75
77
  }>;
76
78
  rejectPlan(runId: string | number, options?: {
77
79
  userId?: string | number;
@@ -79,7 +81,7 @@ export declare class AgentLoopController {
79
81
  }): Promise<{
80
82
  run: any;
81
83
  steps: any;
82
- nextStep: any;
84
+ nextSteps: any[];
83
85
  }>;
84
86
  requestPlanChanges(runId: string | number, options?: {
85
87
  userId?: string | number;
@@ -90,7 +92,7 @@ export declare class AgentLoopController {
90
92
  skillExecutions: any;
91
93
  run: any;
92
94
  steps: any;
93
- nextStep: any;
95
+ nextSteps: any[];
94
96
  }>;
95
97
  replacePlan(runId: string | number, plan: AgentLoopPlanStepInput[], options?: {
96
98
  userId?: string | number;
@@ -109,7 +111,7 @@ export declare class AgentLoopController {
109
111
  }): Promise<{
110
112
  run: any;
111
113
  steps: any;
112
- nextStep: any;
114
+ nextSteps: any[];
113
115
  }>;
114
116
  completeStep(stepId: string | number, output: any, options?: {
115
117
  userId?: string | number;
@@ -119,7 +121,7 @@ export declare class AgentLoopController {
119
121
  }): Promise<{
120
122
  run: any;
121
123
  steps: any;
122
- nextStep: any;
124
+ nextSteps: any[];
123
125
  }>;
124
126
  failStep(stepId: string | number, error: string, options?: {
125
127
  userId?: string | number;
@@ -127,14 +129,14 @@ export declare class AgentLoopController {
127
129
  }): Promise<{
128
130
  run: any;
129
131
  steps: any;
130
- nextStep: any;
132
+ nextSteps: any[];
131
133
  }>;
132
134
  skipStep(stepId: string | number, reason?: string, options?: {
133
135
  userId?: string | number;
134
136
  }): Promise<{
135
137
  run: any;
136
138
  steps: any;
137
- nextStep: any;
139
+ nextSteps: any[];
138
140
  }>;
139
141
  requestApproval(stepId: string | number, approval: any, options?: {
140
142
  userId?: string | number;
@@ -142,7 +144,7 @@ export declare class AgentLoopController {
142
144
  }): Promise<{
143
145
  run: any;
144
146
  steps: any;
145
- nextStep: any;
147
+ nextSteps: any[];
146
148
  }>;
147
149
  resumeRun(runId: string | number, options: {
148
150
  stepId?: string | number;
@@ -153,14 +155,14 @@ export declare class AgentLoopController {
153
155
  }): Promise<{
154
156
  run: any;
155
157
  steps: any;
156
- nextStep: any;
158
+ nextSteps: any[];
157
159
  }>;
158
160
  retryStep(stepId: string | number, options?: {
159
161
  userId?: string | number;
160
162
  }): Promise<{
161
163
  run: any;
162
164
  steps: any;
163
- nextStep: any;
165
+ nextSteps: any[];
164
166
  }>;
165
167
  finishRun(runId: string | number, finalAnswer: string, options?: {
166
168
  status?: Extract<AgentLoopRunStatus, 'succeeded' | 'failed'>;
@@ -170,7 +172,18 @@ export declare class AgentLoopController {
170
172
  }): Promise<{
171
173
  run: any;
172
174
  steps: any;
173
- nextStep: any;
175
+ nextSteps: any[];
176
+ }>;
177
+ stepFeedback(stepId: string | number, feedback: {
178
+ rating: 'positive' | 'negative';
179
+ comment?: string;
180
+ category?: string;
181
+ }, options?: {
182
+ userId?: string | number;
183
+ }): Promise<{
184
+ run: any;
185
+ steps: any;
186
+ nextSteps: any[];
174
187
  }>;
175
188
  cancelRun(runId: string | number, options?: {
176
189
  userId?: string | number;
@@ -178,7 +191,7 @@ export declare class AgentLoopController {
178
191
  }): Promise<{
179
192
  run: any;
180
193
  steps: any;
181
- nextStep: any;
194
+ nextSteps: any[];
182
195
  }>;
183
196
  executeApprovedPlan(runId: string | number, options?: {
184
197
  userId?: string | number;
@@ -186,12 +199,12 @@ export declare class AgentLoopController {
186
199
  }): Promise<{
187
200
  run: any;
188
201
  steps: any;
189
- nextStep: any;
202
+ nextSteps: any[];
190
203
  }>;
191
204
  getRunSnapshot(runId: string | number): Promise<{
192
205
  run: any;
193
206
  steps: any;
194
- nextStep: any;
207
+ nextSteps: any[];
195
208
  }>;
196
209
  getRunDetail(runId: string | number): Promise<{
197
210
  events: any;
@@ -199,7 +212,7 @@ export declare class AgentLoopController {
199
212
  skillExecutions: any;
200
213
  run: any;
201
214
  steps: any;
202
- nextStep: any;
215
+ nextSteps: any[];
203
216
  }>;
204
- pickNextStep(steps: any[], runPolicy?: any): any;
217
+ pickNextSteps(steps: any[], runPolicy?: any): any[];
205
218
  }