@mcp-abap-adt/llm-agent 16.2.0 → 18.0.0

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 (107) hide show
  1. package/dist/coordinator-signals.d.ts +24 -0
  2. package/dist/coordinator-signals.d.ts.map +1 -0
  3. package/dist/coordinator-signals.js +33 -0
  4. package/dist/coordinator-signals.js.map +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/interfaces/builder.d.ts +7 -1
  10. package/dist/interfaces/builder.d.ts.map +1 -1
  11. package/dist/interfaces/context-path.d.ts +17 -0
  12. package/dist/interfaces/context-path.d.ts.map +1 -0
  13. package/dist/interfaces/context-path.js +2 -0
  14. package/dist/interfaces/context-path.js.map +1 -0
  15. package/dist/interfaces/coordinator.d.ts +5 -18
  16. package/dist/interfaces/coordinator.d.ts.map +1 -1
  17. package/dist/interfaces/dag-plan.d.ts +19 -0
  18. package/dist/interfaces/dag-plan.d.ts.map +1 -0
  19. package/dist/interfaces/dag-plan.js +2 -0
  20. package/dist/interfaces/dag-plan.js.map +1 -0
  21. package/dist/interfaces/error-strategy.d.ts +24 -0
  22. package/dist/interfaces/error-strategy.d.ts.map +1 -0
  23. package/dist/interfaces/error-strategy.js +2 -0
  24. package/dist/interfaces/error-strategy.js.map +1 -0
  25. package/dist/interfaces/executor.d.ts +36 -0
  26. package/dist/interfaces/executor.d.ts.map +1 -0
  27. package/dist/interfaces/executor.js +2 -0
  28. package/dist/interfaces/executor.js.map +1 -0
  29. package/dist/interfaces/finalizer.d.ts +33 -0
  30. package/dist/interfaces/finalizer.d.ts.map +1 -0
  31. package/dist/interfaces/finalizer.js +2 -0
  32. package/dist/interfaces/finalizer.js.map +1 -0
  33. package/dist/interfaces/index.d.ts +21 -1
  34. package/dist/interfaces/index.d.ts.map +1 -1
  35. package/dist/interfaces/index.js +3 -0
  36. package/dist/interfaces/index.js.map +1 -1
  37. package/dist/interfaces/insufficient-signal.d.ts +7 -0
  38. package/dist/interfaces/insufficient-signal.d.ts.map +1 -0
  39. package/dist/interfaces/insufficient-signal.js +11 -0
  40. package/dist/interfaces/insufficient-signal.js.map +1 -0
  41. package/dist/interfaces/interpreter.d.ts +56 -0
  42. package/dist/interfaces/interpreter.d.ts.map +1 -0
  43. package/dist/interfaces/interpreter.js +2 -0
  44. package/dist/interfaces/interpreter.js.map +1 -0
  45. package/dist/interfaces/knowledge-rag.d.ts +40 -0
  46. package/dist/interfaces/knowledge-rag.d.ts.map +1 -0
  47. package/dist/interfaces/knowledge-rag.js +2 -0
  48. package/dist/interfaces/knowledge-rag.js.map +1 -0
  49. package/dist/interfaces/need-resolver.d.ts +12 -0
  50. package/dist/interfaces/need-resolver.d.ts.map +1 -0
  51. package/dist/interfaces/need-resolver.js +2 -0
  52. package/dist/interfaces/need-resolver.js.map +1 -0
  53. package/dist/interfaces/planner.d.ts +33 -0
  54. package/dist/interfaces/planner.d.ts.map +1 -0
  55. package/dist/interfaces/planner.js +2 -0
  56. package/dist/interfaces/planner.js.map +1 -0
  57. package/dist/interfaces/request-logger.d.ts +22 -8
  58. package/dist/interfaces/request-logger.d.ts.map +1 -1
  59. package/dist/interfaces/review.d.ts +66 -0
  60. package/dist/interfaces/review.d.ts.map +1 -0
  61. package/dist/interfaces/review.js +2 -0
  62. package/dist/interfaces/review.js.map +1 -0
  63. package/dist/interfaces/session-identity.d.ts +10 -0
  64. package/dist/interfaces/session-identity.d.ts.map +1 -0
  65. package/dist/interfaces/session-identity.js +2 -0
  66. package/dist/interfaces/session-identity.js.map +1 -0
  67. package/dist/interfaces/state-oracle.d.ts +22 -0
  68. package/dist/interfaces/state-oracle.d.ts.map +1 -0
  69. package/dist/interfaces/state-oracle.js +2 -0
  70. package/dist/interfaces/state-oracle.js.map +1 -0
  71. package/dist/interfaces/stepper-interpreter.d.ts +27 -0
  72. package/dist/interfaces/stepper-interpreter.d.ts.map +1 -0
  73. package/dist/interfaces/stepper-interpreter.js +2 -0
  74. package/dist/interfaces/stepper-interpreter.js.map +1 -0
  75. package/dist/interfaces/stepper-planner.d.ts +32 -0
  76. package/dist/interfaces/stepper-planner.d.ts.map +1 -0
  77. package/dist/interfaces/stepper-planner.js +2 -0
  78. package/dist/interfaces/stepper-planner.js.map +1 -0
  79. package/dist/interfaces/stepper.d.ts +73 -0
  80. package/dist/interfaces/stepper.d.ts.map +1 -0
  81. package/dist/interfaces/stepper.js +18 -0
  82. package/dist/interfaces/stepper.js.map +1 -0
  83. package/dist/interfaces/streaming.d.ts +69 -0
  84. package/dist/interfaces/streaming.d.ts.map +1 -0
  85. package/dist/interfaces/streaming.js +2 -0
  86. package/dist/interfaces/streaming.js.map +1 -0
  87. package/dist/interfaces/subagent-context.d.ts +0 -1
  88. package/dist/interfaces/subagent-context.d.ts.map +1 -1
  89. package/dist/interfaces/subagent.d.ts +20 -32
  90. package/dist/interfaces/subagent.d.ts.map +1 -1
  91. package/dist/interfaces/task-spec.d.ts +42 -0
  92. package/dist/interfaces/task-spec.d.ts.map +1 -0
  93. package/dist/interfaces/task-spec.js +17 -0
  94. package/dist/interfaces/task-spec.js.map +1 -0
  95. package/dist/interfaces/types.d.ts +9 -5
  96. package/dist/interfaces/types.d.ts.map +1 -1
  97. package/dist/interfaces/types.js.map +1 -1
  98. package/dist/needs-decomposition-error.d.ts +10 -0
  99. package/dist/needs-decomposition-error.d.ts.map +1 -0
  100. package/dist/needs-decomposition-error.js +14 -0
  101. package/dist/needs-decomposition-error.js.map +1 -0
  102. package/dist/rag/in-memory-rag.d.ts.map +1 -1
  103. package/dist/rag/in-memory-rag.js +5 -1
  104. package/dist/rag/in-memory-rag.js.map +1 -1
  105. package/dist/types.d.ts +9 -5
  106. package/dist/types.d.ts.map +1 -1
  107. package/package.json +1 -1
@@ -0,0 +1,40 @@
1
+ import type { LlmTool } from './types.js';
2
+ export interface KnowledgeEntryMetadata {
3
+ traceId: string;
4
+ turnId: string;
5
+ stepperId: string;
6
+ parentStepperId?: string;
7
+ task: string;
8
+ artifactType: string;
9
+ toolName?: string;
10
+ createdAt: string;
11
+ }
12
+ export interface KnowledgeEntry {
13
+ content: string;
14
+ metadata: KnowledgeEntryMetadata;
15
+ }
16
+ export interface KnowledgeFilter {
17
+ traceId?: string;
18
+ turnId?: string;
19
+ stepperId?: string;
20
+ parentStepperId?: string;
21
+ artifactType?: string | readonly string[];
22
+ toolName?: string;
23
+ }
24
+ export interface IKnowledgeRagHandle {
25
+ query(text: string, opts?: {
26
+ k?: number;
27
+ filter?: KnowledgeFilter;
28
+ }): Promise<readonly KnowledgeEntry[]>;
29
+ list(filter: KnowledgeFilter): Promise<readonly KnowledgeEntry[]>;
30
+ write(entry: {
31
+ content: string;
32
+ metadata: KnowledgeEntryMetadata;
33
+ }): Promise<void>;
34
+ fingerprint(): string;
35
+ }
36
+ export interface IToolsRagHandle {
37
+ query(text: string, k?: number): Promise<readonly LlmTool[]>;
38
+ lookup(name: string): LlmTool | undefined;
39
+ }
40
+ //# sourceMappingURL=knowledge-rag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-rag.d.ts","sourceRoot":"","sources":["../../src/interfaces/knowledge-rag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,sBAAsB,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,CACH,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,eAAe,CAAA;KAAE,GAC9C,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC,CAAC;IAClE,KAAK,CAAC,KAAK,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,sBAAsB,CAAC;KAClC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB,WAAW,IAAI,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;IAC7D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC3C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=knowledge-rag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-rag.js","sourceRoot":"","sources":["../../src/interfaces/knowledge-rag.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ export interface INeedResolver {
2
+ /** Inspect an LLM utterance for an unmet-capability signal. Returns a
3
+ * tools-RAG query string to discover the needed capability, or undefined
4
+ * for a clean answer / normal tool call.
5
+ * v1 scope: only `queryToolsRag`. (Reserved for 18.x: queryKnowledgeRag,
6
+ * injectTools — intentionally NOT in the v1 contract so there are no dead
7
+ * public fields the executor ignores; see review R1-F5.) */
8
+ resolve(llmResponse: string): Promise<{
9
+ queryToolsRag: string;
10
+ } | undefined>;
11
+ }
12
+ //# sourceMappingURL=need-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"need-resolver.d.ts","sourceRoot":"","sources":["../../src/interfaces/need-resolver.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B;;;;;iEAK6D;IAC7D,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;CAC9E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=need-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"need-resolver.js","sourceRoot":"","sources":["../../src/interfaces/need-resolver.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ import type { ContextPath } from './context-path.js';
2
+ import type { DagPlan } from './dag-plan.js';
3
+ import type { LlmUsage } from './types.js';
4
+ export interface PlannerCatalogEntry {
5
+ name: string;
6
+ description?: string;
7
+ }
8
+ export interface PlannerInput {
9
+ prompt: string;
10
+ agents: PlannerCatalogEntry[];
11
+ sessionId: string;
12
+ signal?: AbortSignal;
13
+ ancestorContext?: ContextPath;
14
+ reviewerFeedback?: string;
15
+ }
16
+ /** Wrapper returned by `IPlanner.plan`. Splits the pure domain plan from the
17
+ * optional runtime telemetry, so the plan itself stays free of LLM-overhead
18
+ * metadata that would otherwise leak into prompts (the reviewer serializes
19
+ * `input.plan` via JSON.stringify into the critic prompt) or into
20
+ * persistence. Non-LLM planners may omit `usage`. */
21
+ export interface PlannerResult {
22
+ plan: DagPlan;
23
+ usage?: LlmUsage;
24
+ }
25
+ export interface IPlanner {
26
+ readonly name: string;
27
+ /** Optional model identifier (best-effort), surfaced to the coordinator so
28
+ * per-role LLM usage can be attributed to a specific model in the request
29
+ * logger. Non-LLM planners may omit it. */
30
+ readonly model?: string;
31
+ plan(input: PlannerInput): Promise<PlannerResult>;
32
+ }
33
+ //# sourceMappingURL=planner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../src/interfaces/planner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;sDAIsD;AACtD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;gDAE4C;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACnD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=planner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner.js","sourceRoot":"","sources":["../../src/interfaces/planner.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- export type LlmComponent = 'tool-loop' | 'classifier' | 'helper' | 'translate' | 'query-expander' | 'embedding';
1
+ export type LlmComponent = 'tool-loop' | 'classifier' | 'tool-definer' | 'helper' | 'translate' | 'query-expander' | 'embedding' | 'planner' | 'reviewer' | 'finalizer' | 'oracle';
2
2
  export type TokenCategory = 'initialization' | 'auxiliary' | 'request';
3
3
  export interface TokenBucket {
4
4
  promptTokens: number;
@@ -17,6 +17,9 @@ export interface LlmCallEntry {
17
17
  estimated?: boolean;
18
18
  scope?: 'initialization' | 'request';
19
19
  detail?: string;
20
+ /** Request correlation id (the server's traceId). Routes the entry to the
21
+ * per-request delta; absent → session-cumulative only. */
22
+ requestId?: string;
20
23
  }
21
24
  export interface RagQueryEntry {
22
25
  store: string;
@@ -31,6 +34,9 @@ export interface ToolCallEntry {
31
34
  cached: boolean;
32
35
  }
33
36
  export interface RequestSummary {
37
+ /** Faithful sum across all byComponent entries (promptTokens, completionTokens,
38
+ * totalTokens, requests). Equal to reducing byComponent values; never null. */
39
+ totals: TokenBucket;
34
40
  /** Per-model aggregated token usage. */
35
41
  byModel: Record<string, TokenBucket>;
36
42
  /** Per-component aggregated token usage. */
@@ -44,13 +50,21 @@ export interface RequestSummary {
44
50
  }
45
51
  export interface IRequestLogger {
46
52
  logLlmCall(entry: LlmCallEntry): void;
47
- logRagQuery(entry: RagQueryEntry): void;
48
- logToolCall(entry: ToolCallEntry): void;
49
- /** Mark the start of a request for wall-clock duration tracking. */
50
- startRequest(): void;
51
- /** Mark the end of a request for wall-clock duration tracking. */
52
- endRequest(): void;
53
- getSummary(): RequestSummary;
53
+ logRagQuery(entry: RagQueryEntry & {
54
+ requestId?: string;
55
+ }): void;
56
+ logToolCall(entry: ToolCallEntry & {
57
+ requestId?: string;
58
+ }): void;
59
+ /** Enter a request scope. Nested-safe: depth-counted, bucket created if absent,
60
+ * NEVER clears an existing bucket. */
61
+ startRequest(requestId?: string): void;
62
+ /** Leave a request scope. Depth-counted; NEVER deletes the bucket. */
63
+ endRequest(requestId?: string): void;
64
+ /** Explicitly free a request delta. The top-level owner (server) calls this
65
+ * AFTER reading getSummary(requestId) for the response usage. */
66
+ dropRequest(requestId?: string): void;
67
+ getSummary(requestId?: string): RequestSummary;
54
68
  reset(): void;
55
69
  }
56
70
  //# sourceMappingURL=request-logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-logger.d.ts","sourceRoot":"","sources":["../../src/interfaces/request-logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,YAAY,GACZ,QAAQ,GACR,WAAW,GACX,gBAAgB,GAChB,WAAW,CAAC;AAEhB,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,WAAW,GAAG,SAAS,CAAC;AAEvE,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACrC,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACzC,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACtC,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACxC,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACxC,oEAAoE;IACpE,YAAY,IAAI,IAAI,CAAC;IACrB,kEAAkE;IAClE,UAAU,IAAI,IAAI,CAAC;IACnB,UAAU,IAAI,cAAc,CAAC;IAC7B,KAAK,IAAI,IAAI,CAAC;CACf"}
1
+ {"version":3,"file":"request-logger.d.ts","sourceRoot":"","sources":["../../src/interfaces/request-logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,YAAY,GACZ,cAAc,GACd,QAAQ,GACR,WAAW,GACX,gBAAgB,GAChB,WAAW,GACX,SAAS,GACT,UAAU,GACV,WAAW,GACX,QAAQ,CAAC;AAEb,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,WAAW,GAAG,SAAS,CAAC;AAEvE,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;+DAC2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B;oFACgF;IAChF,MAAM,EAAE,WAAW,CAAC;IACpB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACrC,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACzC,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACtC,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACjE,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACjE;2CACuC;IACvC,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,sEAAsE;IACtE,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;sEACkE;IAClE,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;IAC/C,KAAK,IAAI,IAAI,CAAC;CACf"}
@@ -0,0 +1,66 @@
1
+ import type { ContextPath } from './context-path.js';
2
+ import type { DagPlan } from './dag-plan.js';
3
+ import type { NodeResult } from './interpreter.js';
4
+ import type { PlannerCatalogEntry } from './planner.js';
5
+ import type { LlmUsage } from './types.js';
6
+ export interface ReviewInput {
7
+ prompt: string;
8
+ plan: DagPlan;
9
+ agents: PlannerCatalogEntry[];
10
+ sessionId: string;
11
+ signal?: AbortSignal;
12
+ ancestorContext?: ContextPath;
13
+ }
14
+ /** Pure domain verdict from the reviewer. Telemetry (LLM usage) is carried
15
+ * separately on the wrapper (`ReviewResult`) so it does not contaminate the
16
+ * verdict object itself. */
17
+ export type ReviewVerdict = {
18
+ pass: true;
19
+ } | {
20
+ pass: false;
21
+ feedback: string;
22
+ };
23
+ /** Wrapper returned by `IReviewStrategy.review`. Keeps optional LLM-usage
24
+ * telemetry OUT of the verdict (which is a pure domain decision); the
25
+ * coordinator forwards `usage` into the session request logger. */
26
+ export interface ReviewResult {
27
+ verdict: ReviewVerdict;
28
+ usage?: LlmUsage;
29
+ }
30
+ /** Input to the reviewer when a node FAILED during execution (slice 4a). */
31
+ export interface ExecutionFailureInput {
32
+ objective?: string;
33
+ /** The plan as it stands now. */
34
+ plan: DagPlan;
35
+ /** Completed/failed nodes so far — the reviewer's view of current state. */
36
+ trace: NodeResult[];
37
+ failedNodeId: string;
38
+ error: string;
39
+ agents: PlannerCatalogEntry[];
40
+ sessionId: string;
41
+ signal?: AbortSignal;
42
+ ancestorContext?: ContextPath;
43
+ }
44
+ /** Pure domain recovery decision. Telemetry is carried on the wrapper. */
45
+ export type ExecutionReviewDecision = {
46
+ action: 'abort';
47
+ } | {
48
+ action: 'revise';
49
+ revisedPlan: DagPlan;
50
+ };
51
+ export interface ExecutionReviewResult {
52
+ decision: ExecutionReviewDecision;
53
+ usage?: LlmUsage;
54
+ }
55
+ export interface IReviewStrategy {
56
+ readonly name: string;
57
+ /** Optional model identifier (best-effort), surfaced to the coordinator so
58
+ * per-role LLM usage can be attributed to a specific model in the request
59
+ * logger. Non-LLM reviewers may omit it. */
60
+ readonly model?: string;
61
+ review(input: ReviewInput): Promise<ReviewResult>;
62
+ /** Decide recovery for an execution failure (slice 4a). OPTIONAL — a reviewer
63
+ * that omits it cannot drive recovery (the strategy treats that as abort). */
64
+ reviewExecutionFailure?(input: ExecutionFailureInput): Promise<ExecutionReviewResult>;
65
+ }
66
+ //# sourceMappingURL=review.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/interfaces/review.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,eAAe,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED;;6BAE6B;AAC7B,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E;;oEAEoE;AACpE,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED,4EAA4E;AAC5E,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,4EAA4E;IAC5E,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,eAAe,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,0EAA0E;AAC1E,MAAM,MAAM,uBAAuB,GAC/B;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GACnB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;iDAE6C;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAClD;mFAC+E;IAC/E,sBAAsB,CAAC,CACrB,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACnC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=review.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/interfaces/review.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Identity context for a session. `sessionId` is always present (server-issued
3
+ * cookie, RFC 6265). `userId` is populated only by authorization-enabled builds;
4
+ * the default server leaves it undefined. Extensible for future identity facets.
5
+ */
6
+ export interface SessionIdentity {
7
+ readonly sessionId: string;
8
+ readonly userId?: string;
9
+ }
10
+ //# sourceMappingURL=session-identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-identity.d.ts","sourceRoot":"","sources":["../../src/interfaces/session-identity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=session-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-identity.js","sourceRoot":"","sources":["../../src/interfaces/session-identity.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import type { LlmUsage } from './types.js';
2
+ export interface StateOracleInput {
3
+ query: string;
4
+ sessionId?: string;
5
+ signal?: AbortSignal;
6
+ trace?: {
7
+ traceId: string;
8
+ };
9
+ sessionLogger?: {
10
+ logStep(name: string, data: unknown): void;
11
+ };
12
+ }
13
+ export interface StateOracleResult {
14
+ answer: string;
15
+ usage?: LlmUsage;
16
+ }
17
+ export interface IStateOracle {
18
+ readonly name: string;
19
+ readonly model?: string;
20
+ query(input: StateOracleInput): Promise<StateOracleResult>;
21
+ }
22
+ //# sourceMappingURL=state-oracle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-oracle.d.ts","sourceRoot":"","sources":["../../src/interfaces/state-oracle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,aAAa,CAAC,EAAE;QAAE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;CAChE;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC5D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=state-oracle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-oracle.js","sourceRoot":"","sources":["../../src/interfaces/state-oracle.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ import type { DagPlan } from './dag-plan.js';
2
+ import type { IExecutor } from './executor.js';
3
+ import type { IKnowledgeRagHandle, IToolsRagHandle } from './knowledge-rag.js';
4
+ import type { Budget, IStepper, IStepperResult, RunIdentity } from './stepper.js';
5
+ import type { StreamChunk } from './streaming.js';
6
+ import type { ITaskSpec } from './task-spec.js';
7
+ export interface IStepperInterpreter {
8
+ readonly name: string;
9
+ interpret(plan: DagPlan, ctx: {
10
+ prompt: string;
11
+ knowledgeRag: IKnowledgeRagHandle;
12
+ toolsRag: IToolsRagHandle;
13
+ childSteppers: ReadonlyMap<string, IStepper>;
14
+ executor: IExecutor;
15
+ budget: Budget;
16
+ identity: RunIdentity;
17
+ taskSpec?: ITaskSpec;
18
+ maxParallelSteps: number;
19
+ mintStepperId: () => string;
20
+ signal?: AbortSignal;
21
+ sessionLogger?: {
22
+ logStep(name: string, data: unknown): void;
23
+ };
24
+ onProgress?: (event: StreamChunk) => void;
25
+ }): Promise<IStepperResult>;
26
+ }
27
+ //# sourceMappingURL=stepper-interpreter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepper-interpreter.d.ts","sourceRoot":"","sources":["../../src/interfaces/stepper-interpreter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EACV,MAAM,EACN,QAAQ,EACR,cAAc,EACd,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,SAAS,CACP,IAAI,EAAE,OAAO,EACb,GAAG,EAAE;QACH,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,mBAAmB,CAAC;QAClC,QAAQ,EAAE,eAAe,CAAC;QAC1B,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC7C,QAAQ,EAAE,SAAS,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,WAAW,CAAC;QACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;QACzB,aAAa,EAAE,MAAM,MAAM,CAAC;QAC5B,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,aAAa,CAAC,EAAE;YAAE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;SAAE,CAAC;QAC/D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;KAC3C,GACA,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stepper-interpreter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepper-interpreter.js","sourceRoot":"","sources":["../../src/interfaces/stepper-interpreter.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ import type { DagPlan } from './dag-plan.js';
2
+ import type { IKnowledgeRagHandle, IToolsRagHandle } from './knowledge-rag.js';
3
+ import type { RunIdentity } from './stepper.js';
4
+ import type { ITaskSpec } from './task-spec.js';
5
+ export interface IStepperPlanner {
6
+ readonly name: string;
7
+ plan(input: {
8
+ prompt: string;
9
+ knowledgeRag: IKnowledgeRagHandle;
10
+ toolsRag: IToolsRagHandle;
11
+ parentPath: string[];
12
+ identity: RunIdentity;
13
+ /**
14
+ * Formalized overall task (optional). When present, every planner at every
15
+ * level sees the overall task — not just its local sub-prompt — so plans
16
+ * stay aligned to the whole. Absent → behaves as before.
17
+ */
18
+ taskSpec?: ITaskSpec;
19
+ /**
20
+ * Child worker Steppers available for delegation (deep-stepper mode). The
21
+ * planner renders these into its prompt and may set a node's `agent` to one
22
+ * of these names to recurse into that child. Empty/omitted → the planner
23
+ * emits only leaves (executor-handled), i.e. flat planned-react behaviour.
24
+ */
25
+ agents?: ReadonlyArray<{
26
+ name: string;
27
+ description?: string;
28
+ }>;
29
+ signal?: AbortSignal;
30
+ }): Promise<DagPlan>;
31
+ }
32
+ //# sourceMappingURL=stepper-planner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepper-planner.d.ts","sourceRoot":"","sources":["../../src/interfaces/stepper-planner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,mBAAmB,CAAC;QAClC,QAAQ,EAAE,eAAe,CAAC;QAC1B,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,QAAQ,EAAE,WAAW,CAAC;QACtB;;;;WAIG;QACH,QAAQ,CAAC,EAAE,SAAS,CAAC;QACrB;;;;;WAKG;QACH,MAAM,CAAC,EAAE,aAAa,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC/D,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stepper-planner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepper-planner.js","sourceRoot":"","sources":["../../src/interfaces/stepper-planner.ts"],"names":[],"mappings":""}
@@ -0,0 +1,73 @@
1
+ import type { IKnowledgeRagHandle, IToolsRagHandle } from './knowledge-rag.js';
2
+ import type { StreamChunk } from './streaming.js';
3
+ import type { ITaskSpec } from './task-spec.js';
4
+ import type { LlmUsage } from './types.js';
5
+ /** Identity carried through every layer so executors can stamp
6
+ * KnowledgeEntryMetadata and the coordinator can attribute streaming
7
+ * + usage. Minted at the coordinator boundary; the interpreter rewrites
8
+ * stepperId/parentStepperId at each dispatch. */
9
+ export interface RunIdentity {
10
+ traceId: string;
11
+ turnId: string;
12
+ sessionId: string;
13
+ stepperId: string;
14
+ parentStepperId?: string;
15
+ }
16
+ /** Shared, live token ledger (review R2-F1). ONE instance is created at the
17
+ * coordinator boundary and passed BY REFERENCE through the whole run. Every
18
+ * Stepper and executor reads `exhausted()` before each LLM call and calls
19
+ * `spend(usage)` after. This is a SOFT cap (review R3-F2/R5-F1): parallel
20
+ * siblings can each pass the pre-check before any records its spend, so the
21
+ * run can overshoot by at most (total in-flight calls across the tree ×
22
+ * tokens-per-call). maxParallelSteps bounds only each LOCAL scheduler; the
23
+ * global in-flight count is ≈ maxParallelSteps^depth worst case. The
24
+ * budget-extension ClarifySignal is the real net. Tokens bound WORK; depth
25
+ * (a per-branch value below) bounds RECURSION. A reserve-before-call hard
26
+ * cap is deferred. */
27
+ export interface ITokenLedger {
28
+ readonly remaining: number;
29
+ spend(usage: LlmUsage): void;
30
+ exhausted(): boolean;
31
+ }
32
+ export interface Budget {
33
+ /** Per-branch recursion bound — a plain value, decremented by 1 at each
34
+ * child dispatch (NOT shared). */
35
+ depthRemaining: number;
36
+ /** Shared run-wide token ledger — the SAME object reference for every
37
+ * Stepper/executor in the run. */
38
+ tokens: ITokenLedger;
39
+ }
40
+ export interface IStepperInput {
41
+ prompt: string;
42
+ knowledgeRag: IKnowledgeRagHandle;
43
+ toolsRag: IToolsRagHandle;
44
+ budget: Budget;
45
+ identity: RunIdentity;
46
+ /** Formalized overall task (optional). Threaded down to every planner and
47
+ * executor as a compact anchor. Absent → behaves as before. */
48
+ taskSpec?: ITaskSpec;
49
+ signal?: AbortSignal;
50
+ sessionLogger?: {
51
+ logStep(name: string, data: unknown): void;
52
+ };
53
+ onProgress?: (event: StreamChunk) => void;
54
+ }
55
+ export interface IStepperResult {
56
+ status: 'ok' | 'incomplete' | 'budget-exhausted';
57
+ missing?: string[];
58
+ usage: LlmUsage;
59
+ }
60
+ export interface IStepper {
61
+ readonly name: string;
62
+ run(input: IStepperInput): Promise<IStepperResult>;
63
+ }
64
+ /** Default mutable ledger. Created once per run with the configured token
65
+ * budget; shared by reference. */
66
+ export declare class TokenLedger implements ITokenLedger {
67
+ private _remaining;
68
+ constructor(total: number);
69
+ get remaining(): number;
70
+ spend(usage: LlmUsage): void;
71
+ exhausted(): boolean;
72
+ }
73
+ //# sourceMappingURL=stepper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepper.d.ts","sourceRoot":"","sources":["../../src/interfaces/stepper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;kDAGkD;AAClD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;uBAUuB;AACvB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC7B,SAAS,IAAI,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,MAAM;IACrB;uCACmC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB;uCACmC;IACnC,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,mBAAmB,CAAC;IAClC,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,WAAW,CAAC;IACtB;oEACgE;IAChE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,aAAa,CAAC,EAAE;QAAE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;IAC/D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,GAAG,YAAY,GAAG,kBAAkB,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACpD;AAED;mCACmC;AACnC,qBAAa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,UAAU,CAAS;gBACf,KAAK,EAAE,MAAM;IAGzB,IAAI,SAAS,IAAI,MAAM,CAEtB;IACD,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAG5B,SAAS,IAAI,OAAO;CAGrB"}
@@ -0,0 +1,18 @@
1
+ /** Default mutable ledger. Created once per run with the configured token
2
+ * budget; shared by reference. */
3
+ export class TokenLedger {
4
+ _remaining;
5
+ constructor(total) {
6
+ this._remaining = total;
7
+ }
8
+ get remaining() {
9
+ return this._remaining;
10
+ }
11
+ spend(usage) {
12
+ this._remaining -= usage.totalTokens;
13
+ }
14
+ exhausted() {
15
+ return this._remaining <= 0;
16
+ }
17
+ }
18
+ //# sourceMappingURL=stepper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepper.js","sourceRoot":"","sources":["../../src/interfaces/stepper.ts"],"names":[],"mappings":"AAoEA;mCACmC;AACnC,MAAM,OAAO,WAAW;IACd,UAAU,CAAS;IAC3B,YAAY,KAAa;QACvB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IACD,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IACD,KAAK,CAAC,KAAe;QACnB,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,WAAW,CAAC;IACvC,CAAC;IACD,SAAS;QACP,OAAO,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF"}
@@ -0,0 +1,69 @@
1
+ import type { LlmComponent } from './request-logger.js';
2
+ import type { LlmUsage } from './types.js';
3
+ /**
4
+ * Stable reference to a Stepper execution. Minted at dispatch (for recursive
5
+ * Stepper construction) or synthesized for terminal executor invocations.
6
+ * Unique across the whole run.
7
+ */
8
+ export interface StepperRef {
9
+ /** Stable UUID minted at each dispatch. */
10
+ stepperId: string;
11
+ /** Parent Stepper ID (undefined at root or for terminal executors). */
12
+ parentStepperId?: string;
13
+ /** Human-readable name (goal name or executor type). */
14
+ name: string;
15
+ }
16
+ /**
17
+ * Per-event chunk type emitted by `onPartial` callbacks along the
18
+ * worker → Stepper → coordinator path.
19
+ *
20
+ * `content` carries an LLM-output delta. The 18.0 progress-event variants
21
+ * (`stepper-spawned`, `stepper-done`, `mcp-call`, `mcp-result`,
22
+ * `tokens-used`, `llm-call-start`, `llm-call-end`) each carry
23
+ * `source: StepperRef` for precise attribution in nested execution trees.
24
+ *
25
+ * BREAKING (18.0 / Task 19e): the 17.0 `tool-call`, `node-start`, and
26
+ * `node-end` variants have been removed. SSE clients must migrate to
27
+ * `mcp-call` / `mcp-result` / `stepper-spawned` / `stepper-done`.
28
+ */
29
+ export type StreamChunk = {
30
+ kind: 'content';
31
+ nodeId?: string;
32
+ delta: string;
33
+ } | {
34
+ kind: 'stepper-spawned';
35
+ source: StepperRef;
36
+ goal: string;
37
+ } | {
38
+ kind: 'stepper-done';
39
+ source: StepperRef;
40
+ ok: boolean;
41
+ } | {
42
+ kind: 'mcp-call';
43
+ source: StepperRef;
44
+ tool: string;
45
+ args?: unknown;
46
+ } | {
47
+ kind: 'mcp-result';
48
+ source: StepperRef;
49
+ tool: string;
50
+ durationMs: number;
51
+ bytes?: number;
52
+ } | {
53
+ kind: 'tokens-used';
54
+ source: StepperRef;
55
+ component: LlmComponent;
56
+ delta: LlmUsage;
57
+ } | {
58
+ kind: 'llm-call-start';
59
+ source: StepperRef;
60
+ component: LlmComponent;
61
+ model: string;
62
+ } | {
63
+ kind: 'llm-call-end';
64
+ source: StepperRef;
65
+ component: LlmComponent;
66
+ durationMs: number;
67
+ };
68
+ export type OnPartial = (chunk: StreamChunk) => void;
69
+ //# sourceMappingURL=streaming.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../../src/interfaces/streaming.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAEnD;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,EAAE,EAAE,OAAO,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GACtE;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,QAAQ,CAAC;CACjB,GACD;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,YAAY,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEN,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=streaming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.js","sourceRoot":"","sources":["../../src/interfaces/streaming.ts"],"names":[],"mappings":""}
@@ -8,7 +8,6 @@ export interface SubAgentContextRequest {
8
8
  task: string;
9
9
  step: PlanStep;
10
10
  agent: ISubAgent;
11
- layer: number;
12
11
  inputText: string;
13
12
  sessionId: string;
14
13
  signal?: AbortSignal;
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-context.d.ts","sourceRoot":"","sources":["../../src/interfaces/subagent-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxE;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACpE"}
1
+ {"version":3,"file":"subagent-context.d.ts","sourceRoot":"","sources":["../../src/interfaces/subagent-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxE;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACpE"}