@kodax-ai/kodax 0.7.96 → 0.7.97-alpha.2

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 (127) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +85 -62
  3. package/README_CN.md +57 -67
  4. package/config-templates/config.example.jsonc +0 -14
  5. package/dist/chunks/{agent-7N427EVB.js → agent-J7SHFM5N.js} +1 -1
  6. package/dist/chunks/argument-completer-ZJQOWTIS.js +2 -0
  7. package/dist/chunks/{chunk-ABZDFK2X.js → chunk-2GV6MQ4T.js} +14 -14
  8. package/dist/chunks/{chunk-6QI3GOYG.js → chunk-3PS3YEDS.js} +1 -1
  9. package/dist/chunks/chunk-4VJMQDTH.js +417 -0
  10. package/dist/chunks/{chunk-NI7PBPUR.js → chunk-5DSUVP46.js} +1 -1
  11. package/dist/chunks/chunk-5P7RTSZT.js +21 -0
  12. package/dist/chunks/{chunk-XXNR6S4Q.js → chunk-6ZAQKFIM.js} +1 -1
  13. package/dist/chunks/chunk-7V2QBZ73.js +137 -0
  14. package/dist/chunks/{chunk-C7U542KM.js → chunk-F7DHZH6T.js} +1 -1
  15. package/dist/chunks/{chunk-7IMWOR34.js → chunk-HSRYDDPF.js} +1 -1
  16. package/dist/chunks/chunk-K3DQGSQU.js +372 -0
  17. package/dist/chunks/chunk-NO23K2CB.js +2 -0
  18. package/dist/chunks/{chunk-NKT3B3DR.js → chunk-OT5WHAX4.js} +1 -1
  19. package/dist/chunks/{chunk-YEAUDI6U.js → chunk-QGWHJIO4.js} +1 -1
  20. package/dist/chunks/chunk-QOFFAY5C.js +261 -0
  21. package/dist/chunks/{chunk-4PFZ7BEE.js → chunk-QVDTORL3.js} +11 -11
  22. package/dist/chunks/chunk-QZ4B4AWG.js +473 -0
  23. package/dist/chunks/chunk-RXDS6CNA.js +355 -0
  24. package/dist/chunks/{chunk-WV3DJVW4.js → chunk-VDGPJQL7.js} +135 -135
  25. package/dist/chunks/chunk-VEZ4WHPN.js +641 -0
  26. package/dist/chunks/chunk-ZPPAT25E.js +5 -0
  27. package/dist/chunks/chunk-ZQYWDI4O.js +1 -0
  28. package/dist/chunks/chunk-ZS2GUADU.js +498 -0
  29. package/dist/chunks/{chunk-GN2IY5YE.js → chunk-ZTYZYXGV.js} +1 -1
  30. package/dist/chunks/{chunk-EM4XJBTK.js → chunk-ZZQ4GDVU.js} +1 -1
  31. package/dist/chunks/{client-6WZZTTSV.js → client-MXOJ5XUN.js} +1 -1
  32. package/dist/chunks/{compaction-config-ZMEJU4U7.js → compaction-config-5VZSGKBQ.js} +1 -1
  33. package/dist/chunks/{construction-bootstrap-RX4DMHI7.js → construction-bootstrap-U2ZU2WAT.js} +1 -1
  34. package/dist/chunks/dist-CSLNWLOE.js +2 -0
  35. package/dist/chunks/dist-XXMJMJDU.js +2 -0
  36. package/dist/chunks/host-RUXYZFYN.js +2 -0
  37. package/dist/chunks/readline-helpers-JCVULR4C.js +2 -0
  38. package/dist/chunks/run-manager-DRIM5VNE.js +2 -0
  39. package/dist/chunks/utils-MQEBGKIX.js +2 -0
  40. package/dist/index.d.ts +63 -30
  41. package/dist/index.js +10 -6
  42. package/dist/kodax_bootstrap.js +1 -1
  43. package/dist/kodax_cli.js +1745 -1734
  44. package/dist/kodax_resume.js +32 -35
  45. package/dist/native/win32-x64/kodax-windows-sandbox.exe +0 -0
  46. package/dist/native/win32-x64/kodax-windows-text-transaction.node +0 -0
  47. package/dist/native/win32-x64/manifest.json +2 -2
  48. package/dist/sandbox-network-broker.js +77 -77
  49. package/dist/sdk-a2a.d.ts +33 -18
  50. package/dist/sdk-a2a.js +8 -9
  51. package/dist/sdk-agent.d.ts +33 -26
  52. package/dist/sdk-agent.js +1 -1
  53. package/dist/sdk-client.d.ts +40 -0
  54. package/dist/sdk-client.js +2 -0
  55. package/dist/sdk-coding.d.ts +87 -499
  56. package/dist/sdk-coding.js +1 -1
  57. package/dist/sdk-experimental-memory.d.ts +3 -4
  58. package/dist/sdk-experimental-memory.js +1 -1
  59. package/dist/sdk-llm.d.ts +11 -9
  60. package/dist/sdk-llm.js +1 -1
  61. package/dist/sdk-mcp.d.ts +3 -3
  62. package/dist/sdk-mcp.js +1 -1
  63. package/dist/sdk-media.d.ts +3 -1
  64. package/dist/sdk-media.js +1 -1
  65. package/dist/sdk-repl.d.ts +317 -70
  66. package/dist/sdk-repl.js +2 -2
  67. package/dist/sdk-runtime.d.ts +580 -452
  68. package/dist/sdk-runtime.js +1 -1
  69. package/dist/sdk-sandbox.js +1 -1
  70. package/dist/sdk-session.d.ts +13 -9
  71. package/dist/sdk-session.js +1 -1
  72. package/dist/sdk-skills.js +1 -1
  73. package/dist/semantic-worker.js +57 -57
  74. package/dist/types-chunks/{base.d-Bt9lhwSV.d.ts → base.d-ZBOdjDUT.d.ts} +2 -1
  75. package/dist/types-chunks/{bash-prefix-extractor.d-DWFIMg0v.d.ts → bash-prefix-extractor.d-DvswAXKS.d.ts} +136 -66
  76. package/dist/types-chunks/{capability-learning.d-gRtO03f6.d.ts → capability-learning.d-B4pxKwP4.d.ts} +1 -1
  77. package/dist/types-chunks/{capability.d-Ch5Vos33.d.ts → capability.d-DOF3r0fJ.d.ts} +1 -1
  78. package/dist/types-chunks/{capsule.d-Dj1n6s0Y.d.ts → capsule.d-B4atvlxE.d.ts} +7 -19
  79. package/dist/types-chunks/client-contract-A1jdk6xz.d.ts +1993 -0
  80. package/dist/types-chunks/{controller.d-C0IM1Tud.d.ts → controller.d-BkUJ_3sl.d.ts} +1 -1
  81. package/dist/types-chunks/{controller.d-J2t1q8Ly.d.ts → controller.d-yyKajPTi.d.ts} +140 -1380
  82. package/dist/types-chunks/{cost-tracker.d-BWI4lFWn.d.ts → cost-tracker.d-BeaenODW.d.ts} +2 -47
  83. package/dist/types-chunks/{history-retrieval.d-CPN5PMBV.d.ts → history-retrieval.d-JdFfkeF3.d.ts} +2 -2
  84. package/dist/types-chunks/{manager.d-rtmywU9M.d.ts → manager.d-C_20XqCV.d.ts} +8 -1
  85. package/dist/types-chunks/manifest.d-Bw2i-zQi.d.ts +18 -0
  86. package/dist/types-chunks/provider-credential-context.d-BH2OaB1b.d.ts +47 -0
  87. package/dist/types-chunks/provider-request-observation.d-jL8T6wVO.d.ts +34 -0
  88. package/dist/types-chunks/{public-api.d-amBop8Nk.d.ts → public-api.d-Cq8ILMte.d.ts} +52 -13
  89. package/dist/types-chunks/{resolver.d-BrwLoWNr.d.ts → resolver.d-DLY01RHx.d.ts} +4 -2
  90. package/dist/types-chunks/{types.d-CSv0_cZC.d.ts → review-inbox.d-BeaLRNHx.d.ts} +251 -3
  91. package/dist/types-chunks/{shell-command-sets.d-oejwpP_7.d.ts → review-packet.d-D4bbTbq3.d.ts} +46 -3
  92. package/dist/types-chunks/{exec-policy.d-BPESl90L.d.ts → run-manager.d-C7Q71rin.d.ts} +385 -62
  93. package/dist/types-chunks/runtime-client-info-CxnlZlW5.d.ts +175 -0
  94. package/dist/types-chunks/{sdk-session-B6XjHNU1.d.ts → sdk-session-BDFjCpDn.d.ts} +12 -4
  95. package/dist/types-chunks/{side-query.d-DHWG1JZg.d.ts → side-query.d-DTrhVd_r.d.ts} +4 -3
  96. package/dist/types-chunks/trusted-repl-entry-vbUM8R6P.d.ts +445 -0
  97. package/dist/types-chunks/{types.d-CtO8mR1s.d.ts → types.d-BJTN-RZr.d.ts} +5 -5
  98. package/dist/types-chunks/{types.d-BrQMB-hy.d.ts → types.d-BjOq57-z.d.ts} +6 -0
  99. package/dist/types-chunks/types.d-o7t9dds4.d.ts +1484 -0
  100. package/dist/types-chunks/{utils.d-DcznBeQ3.d.ts → utils.d-CWiMhFfu.d.ts} +202 -36
  101. package/docs/CLIENT_CONTRACT.md +441 -0
  102. package/docs/SDK_MIGRATION.md +123 -0
  103. package/docs/SPACE_SDK_SEAMS.md +139 -0
  104. package/package.json +10 -5
  105. package/public_docs/README.md +12 -133
  106. package/public_docs/configuration/config-files.md +8 -14
  107. package/public_docs/sdk/embedder-guide.md +494 -420
  108. package/dist/chunks/argument-completer-FAIHW7HZ.js +0 -2
  109. package/dist/chunks/chunk-66XN5AFU.js +0 -417
  110. package/dist/chunks/chunk-7O2AIFNE.js +0 -373
  111. package/dist/chunks/chunk-DSXUXUZG.js +0 -5
  112. package/dist/chunks/chunk-GYO73UYQ.js +0 -275
  113. package/dist/chunks/chunk-HPCS3LZ5.js +0 -324
  114. package/dist/chunks/chunk-HZYRLIOC.js +0 -137
  115. package/dist/chunks/chunk-SC2ELSUS.js +0 -675
  116. package/dist/chunks/chunk-TEUD5VPJ.js +0 -471
  117. package/dist/chunks/chunk-TYZ2ZAYL.js +0 -487
  118. package/dist/chunks/dist-3UCCMCYR.js +0 -2
  119. package/dist/chunks/dist-F5IWZSAY.js +0 -2
  120. package/dist/chunks/host-W2JJ3V3Q.js +0 -2
  121. package/dist/chunks/run-manager-RBWU3EVE.js +0 -2
  122. package/dist/chunks/utils-DJ4ZFJGL.js +0 -2
  123. package/dist/runtime-worker.js +0 -5381
  124. package/dist/types-chunks/review-inbox.d-CTeUIKda.d.ts +0 -225
  125. package/dist/types-chunks/run-manager.d-hm1XgEou.d.ts +0 -94
  126. package/dist/types-chunks/trusted-repl-entry-D0w5M0UZ.d.ts +0 -323
  127. package/dist/types-chunks/types.d-B1l9pWyX.d.ts +0 -146
@@ -1,7 +1,8 @@
1
- import { a3 as KodaXToolDefinition, k as KodaXMessage, G as KodaXReasoningMode, ab as KodaXWireReasoningEffort, a5 as KodaXToolResultContentItem, _ as KodaXThinkingBlock, L as KodaXRedactedThinkingBlock, I as KodaXReasoningRequest, a2 as KodaXTokenUsage } from './types.d-BrQMB-hy.js';
2
- import { a as KodaXContextOverflowError } from './base.d-Bt9lhwSV.js';
1
+ import { a3 as KodaXToolDefinition, k as KodaXMessage, G as KodaXReasoningMode, ab as KodaXWireReasoningEffort, a5 as KodaXToolResultContentItem, _ as KodaXThinkingBlock, L as KodaXRedactedThinkingBlock, U as KodaXTaskResultMetadata } from './types.d-BjOq57-z.js';
2
+ import { a as KodaXContextOverflowError } from './base.d-ZBOdjDUT.js';
3
3
  import { ChildProcess } from 'node:child_process';
4
- import { b6 as MemoryReviewModelInput, a4 as KodaXMemoryOutcomeDigest, b9 as MemoryReviewPlan, U as KodaXCompactMemorySeed, a7 as KodaXSessionArtifactLedgerEntry, q as AgentCapabilities, P as AgentTurnExecutor, w as AgentExecutionKind, p as AgentBudgetPort, k as AgentActorStore, b as AgentActorOwner, t as AgentEvent, F as AgentMailboxMessage, a as AgentActorClient, x as AgentExecutionResult, M as AgentSpawnInput, H as AgentMutationOptions, A as AgentActor, O as AgentTurn, Q as AgentTurnRef, r as AgentDataClassification, G as AgentMetadataValue, y as AgentFollowupResult, B as AgentInterruptScope, N as AgentTreeSnapshot, s as AgentDetail, I as AgentOutput } from './types.d-CSv0_cZC.js';
4
+ import { am as KodaXInputArtifact, ax as LearnedCapabilityRecord, aI as LearningEvent, aH as LearningClientRecord, aA as LearnedCapabilityScope, aw as LearnedCapabilityProvenance, az as LearnedCapabilityRecordV2, aq as LearnedCapabilityArtifact } from './types.d-o7t9dds4.js';
5
+ import { bn as MemoryReviewModelInput, al as KodaXMemoryOutcomeDigest, bq as MemoryReviewPlan, q as AgentCapabilities, P as AgentTurnExecutor, w as AgentExecutionKind, p as AgentBudgetPort, k as AgentActorStore, b as AgentActorOwner, t as AgentEvent, F as AgentMailboxMessage, a as AgentActorClient, x as AgentExecutionResult, M as AgentSpawnInput, H as AgentMutationOptions, A as AgentActor, O as AgentTurn, Q as AgentTurnRef, r as AgentDataClassification, G as AgentMetadataValue, y as AgentFollowupResult, B as AgentInterruptScope, N as AgentTreeSnapshot, s as AgentDetail, I as AgentOutput } from './review-inbox.d-BeaLRNHx.js';
5
6
 
6
7
  /**
7
8
  * Layer A Primitive: Agent / Handoff / Guardrail / AgentReasoningProfile
@@ -1158,6 +1159,8 @@ interface RunnerToolCall {
1158
1159
  */
1159
1160
  interface RunnerLlmResult {
1160
1161
  readonly text: string;
1162
+ /** Identity shared by live output and the assistant message committed from this result. */
1163
+ readonly outputId?: string;
1161
1164
  readonly toolCalls?: readonly RunnerToolCall[];
1162
1165
  readonly stopReason?: string;
1163
1166
  /**
@@ -1985,177 +1988,150 @@ declare function registerManagedChildProcess(child: ChildProcess, metadata: Mana
1985
1988
  declare function cleanupRegisteredManagedChildren(options?: CleanupOptions): Promise<ManagedChildCleanupSummary>;
1986
1989
 
1987
1990
  /**
1988
- * FEATURE_222 — user-interaction primitive (agent layer).
1989
- *
1990
- * "Ask the user a question" is needed at BOTH layers: the coding `ask_user_*`
1991
- * tools (LLM-initiated) AND the MCP elicitation reverse capability
1992
- * (server-initiated). The capability historically lived only in
1993
- * `@kodax-ai/coding`, but the MCP runtime lives one layer below in
1994
- * `@kodax-ai/agent` and cannot reach up to it. So the primitive is owned here,
1995
- * at the agent layer, and the host injects ONE implementation that both layers
1996
- * share — coding re-exports these types for backward compatibility.
1997
- *
1998
- * The agent layer is UI-less by design: these are the contract the host
1999
- * (REPL / ACP / SDK) fulfils with its real interaction surface. A headless host
2000
- * leaves them undefined and consumers degrade gracefully (cancel / decline).
2001
- */
2002
- /** A single question item used in multi-question mode. */
2003
- interface AskUserQuestionItem {
2004
- question: string;
2005
- header?: string;
2006
- options: Array<{
2007
- label: string;
2008
- description?: string;
2009
- value: string;
2010
- }>;
2011
- multiSelect?: boolean;
1991
+ * @kodax-ai/agent/messaging — Message queue types
1992
+ *
1993
+ * FEATURE_115 (v0.7.36): agentId-scoped 2-tier priority queue infrastructure.
1994
+ *
1995
+ * Per ADR-021: messaging is a generic agent-platform primitive (not coding-
1996
+ * specific). Downstream consumers:
1997
+ * - @kodax-ai/coding runner-driven mid-turn drain
1998
+ * - @kodax-ai/repl InkREPL ESC soft-pause + text injection (FEATURE_111 absorbed)
1999
+ * - subagent task-notification routing (FEATURE_155 idle-yield wakeup)
2000
+ *
2001
+ * Phase 0.6 study (`c:/tmp/claude-code-actual-usage.md`): Claude Code's
2002
+ * `'now'` priority has zero production usage; KodaX simplifies to 2 tiers.
2003
+ */
2004
+
2005
+ type MessagePriority = 'user' | 'background';
2006
+ /**
2007
+ * Delivery owner for user prompts. Ordinary messages are runtime-deliverable.
2008
+ * `host` is reserved for prompts that must re-enter a trusted host command
2009
+ * pipeline (for example an explicit user Skill invocation) before any model
2010
+ * can observe them.
2011
+ */
2012
+ type MessageDelivery = 'runtime' | 'host';
2013
+ /**
2014
+ * Delivery semantics, independent of priority:
2015
+ * - `prompt`: user-authored input; delivered as a real user turn.
2016
+ * - `agent-message`: Runtime-authenticated Agent communication.
2017
+ * - `task-notification`: structured Agent completion evidence.
2018
+ * - `system-reminder`: Runtime-authored synthetic guidance.
2019
+ */
2020
+ type MessageMode = 'prompt' | 'agent-message' | 'task-notification' | 'system-reminder';
2021
+ type QueuedInputArtifact = KodaXInputArtifact;
2022
+ interface QueuedMessage {
2023
+ /** Stable id for tracing / dedup. Format: `msg-<sequence>`. */
2024
+ readonly id: string;
2025
+ readonly priority: MessagePriority;
2012
2026
  /**
2013
- * FEATURE_222 — only meaningful when `multiSelect` is true. The host should
2014
- * reject (re-prompt / show an error, do NOT resolve) a selection with fewer
2015
- * than `minSelections` items. Absent ⇒ no lower bound.
2027
+ * Routing key:
2028
+ * undefined = main thread / coordinator agent
2029
+ * 'agent-id-XYZ' = subagent / specific consumer
2030
+ *
2031
+ * Drain consumers MUST filter by agentId match — undefined matches only
2032
+ * undefined-agentId messages, not "any agent".
2016
2033
  */
2017
- minSelections?: number;
2034
+ readonly agentId?: string;
2035
+ readonly mode: MessageMode;
2036
+ /** Omitted means `runtime`; `host` messages must not be spliced into a model turn. */
2037
+ readonly delivery?: MessageDelivery;
2038
+ readonly content: string;
2039
+ /** Accepted client input identity; joins the canonical user message to its Host admission. */
2040
+ readonly inputId?: string;
2041
+ readonly inputArtifacts?: readonly QueuedInputArtifact[];
2042
+ readonly taskResult?: KodaXTaskResultMetadata;
2043
+ /** Wall-clock timestamp (`Date.now()`) for tracing only — not used for ordering. */
2044
+ readonly enqueuedAt: number;
2045
+ }
2046
+ interface DequeueFilter {
2018
2047
  /**
2019
- * FEATURE_222 — only meaningful when `multiSelect` is true. The host should
2020
- * reject a selection with more than `maxSelections` items. Absent ⇒ no upper
2021
- * bound. Lets a host render + validate "pick at most N" structurally instead
2022
- * of parsing it out of natural-language question text.
2048
+ * Only return messages with this agentId.
2049
+ * undefined matches messages with no agentId (main-thread messages only).
2023
2050
  */
2024
- maxSelections?: number;
2025
- /** Runtime-validated option value selected if the interaction expires. */
2026
- default?: string;
2051
+ readonly agentId?: string;
2027
2052
  /**
2028
- * Choice surfaces are open-ended by default: hosts SHOULD offer a synthetic
2029
- * custom-input option unless this is explicitly false.
2053
+ * Highest priority level included in the drain.
2054
+ * 'user' → only user priority drained, background stays queued
2055
+ * 'background' → both user + background drained (Sleep-gated case)
2030
2056
  */
2031
- allowCustomInput?: boolean;
2032
- customInputLabel?: string;
2033
- customInputPrompt?: string;
2034
- customInputDefault?: string;
2035
- }
2036
- /** Options for multi-question mode — multiple independent questions in one call. */
2037
- interface AskUserMultiOptions {
2038
- questions: AskUserQuestionItem[];
2039
- }
2040
- /** Options for a single question (select or free-text input). */
2041
- interface AskUserQuestionOptions {
2042
- question: string;
2043
- kind?: 'select' | 'input';
2044
- /** Required for kind="select", ignored for kind="input". */
2045
- options?: Array<{
2046
- label: string;
2047
- description?: string;
2048
- value: string;
2049
- }>;
2050
- multiSelect?: boolean;
2051
- /** FEATURE_222 — see {@link AskUserQuestionItem.minSelections}. */
2052
- minSelections?: number;
2053
- /** FEATURE_222 — see {@link AskUserQuestionItem.maxSelections}. */
2054
- maxSelections?: number;
2055
- /** Input text or a Runtime-validated option value selected on expiry. */
2056
- default?: string;
2057
+ readonly maxPriority: MessagePriority;
2057
2058
  /**
2058
- * Choice surfaces are open-ended by default: hosts SHOULD offer a synthetic
2059
- * custom-input option unless this is explicitly false.
2059
+ * Optional cap on number of messages drained in this call.
2060
+ * Defaults to unlimited (drains all matching).
2060
2061
  */
2061
- allowCustomInput?: boolean;
2062
- customInputLabel?: string;
2063
- customInputPrompt?: string;
2064
- customInputDefault?: string;
2065
- }
2066
- /** Host return value for a user-entered answer chosen through a select dialog's
2067
- * synthetic "Other..." option. */
2068
- interface AskUserCustomInputAnswer {
2069
- kind: 'customInput';
2070
- value: string;
2071
- }
2072
- type AskUserSelectionAnswer = string | AskUserCustomInputAnswer;
2073
- type AskUserAnswer = AskUserSelectionAnswer | AskUserSelectionAnswer[];
2074
- /**
2075
- * FEATURE_222 — reserved option value a host may append as a synthetic option
2076
- * (e.g. a "← Back" entry) in `askUserMulti`'s per-question flow to mean "return
2077
- * to the previous question" instead of answering the current one. Only
2078
- * meaningful for `questions[]` index > 0 (there is no previous before the
2079
- * first). The coding `ask_user_question` tool rejects this as a normal
2080
- * `option.value` supplied by the model, so a host may safely reuse it for its
2081
- * own back-navigation UI. A host that ignores this constant simply never offers
2082
- * back-navigation — the default multi-question flow is unaffected either way.
2083
- */
2084
- declare const ASK_USER_BACK_SIGNAL = "__back__";
2085
- /** Reserved synthetic option value for a host-provided custom input entry. */
2086
- declare const ASK_USER_CUSTOM_INPUT_SIGNAL = "__custom_input__";
2087
- declare function isAskUserCustomInputAnswer(value: unknown): value is AskUserCustomInputAnswer;
2088
- /**
2089
- * FEATURE_222 — narrow an `askUser` result to a single string for the many
2090
- * callers that only ever ask single-select questions (they never set
2091
- * `multiSelect: true`, so the array branch is unreachable at runtime). Collapses
2092
- * an unexpected array to its first element so a mis-configured host degrades
2093
- * predictably instead of leaking `[object Array]` into a string comparison.
2094
- */
2095
- declare function asSingleSelection(answer: AskUserAnswer): string;
2096
- /** Lifecycle signal supplied by a bounded interaction owner. */
2097
- interface UserInteractionPromptContext {
2098
- /** Aborted when the interaction expires or its owner settles it elsewhere. */
2099
- readonly signal: AbortSignal;
2100
- }
2101
- /**
2102
- * The host-provided user-interaction surface. Each method is optional — a
2103
- * headless host omits them and callers degrade gracefully. This is the single
2104
- * primitive shared by the coding `ask_user_*` tools and the agent's MCP
2105
- * elicitation reverse capability.
2106
- */
2107
- interface UserInteraction {
2062
+ readonly limit?: number;
2108
2063
  /**
2109
- * Ask one question (select mode by default). Single-select resolves the
2110
- * chosen option value as a string. Multi-select resolves the selected values
2111
- * as an array. If the user chooses the host-provided custom-input option,
2112
- * return `{ kind: 'customInput', value }` in the single or array position.
2113
- * Plain string/string[] hosts remain valid for backward compatibility.
2064
+ * FEATURE_159 (v0.7.40) — optional mode filter. Lets REPL split the
2065
+ * single queue into mode-typed views (e.g. `mode:'prompt'` for user
2066
+ * input vs `mode:'task-notification'` for child completion banners)
2067
+ * without separate queues. When omitted, all modes match.
2114
2068
  */
2115
- askUser?: (options: AskUserQuestionOptions, context?: UserInteractionPromptContext) => Promise<AskUserAnswer>;
2116
- /** Ask several independent questions sequentially. Resolves a per-question
2117
- * value map using the same `AskUserAnswer` shape as `askUser`, or undefined
2118
- * when the user cancels. */
2119
- askUserMulti?: (options: AskUserMultiOptions, context?: UserInteractionPromptContext) => Promise<Record<string, AskUserAnswer> | undefined>;
2120
- /** Ask for free-text input. Resolves the text, or undefined when cancelled. */
2121
- askUserInput?: (options: {
2122
- question: string;
2123
- default?: string;
2124
- }, context?: UserInteractionPromptContext) => Promise<string | undefined>;
2125
- }
2126
- /** Register the live user-interaction surface (host calls this when interactive). */
2127
- declare function setActiveUserInteraction(interaction: UserInteraction | undefined): void;
2128
- /** The live user-interaction surface, or undefined when none is active. */
2129
- declare function getActiveUserInteraction(): UserInteraction | undefined;
2130
-
2131
- type KodaXImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
2132
- type KodaXVideoMediaType = 'video/mp4' | 'video/mpeg' | 'video/quicktime' | 'video/x-msvideo' | 'video/x-flv' | 'video/webm' | 'video/x-ms-wmv' | 'video/3gpp';
2133
- type KodaXInputArtifactSource = 'user-inline' | 'clipboard' | 'drag-drop' | 'file-picker';
2134
- interface KodaXImageInputArtifact {
2135
- readonly kind: 'image';
2136
- readonly path: string;
2137
- readonly mediaType?: KodaXImageMediaType;
2138
- readonly source?: KodaXInputArtifactSource;
2139
- readonly description?: string;
2140
- }
2141
- interface KodaXFileInputArtifact {
2142
- readonly kind: 'file';
2143
- readonly path: string;
2144
- readonly mediaType?: string;
2145
- readonly mimeType?: string;
2146
- readonly name?: string;
2147
- readonly source?: KodaXInputArtifactSource;
2148
- readonly description?: string;
2069
+ readonly mode?: MessageMode;
2070
+ /**
2071
+ * FEATURE_159 (v0.7.40) — optional precise-id filter. Single-message
2072
+ * targeted removal — drives Esc-pop-this-uuid in REPL. When set, all
2073
+ * other filters still apply (agentId / priority / mode mismatches still
2074
+ * skip the message), so callers can't accidentally remove a message
2075
+ * outside their scope.
2076
+ */
2077
+ readonly id?: string;
2078
+ /**
2079
+ * FEATURE_159 (v0.7.40) — optional escape-hatch predicate, AND-ed with
2080
+ * the structured filters. Lets SDK consumers express conditions the
2081
+ * typed fields don't cover (e.g. timestamp ranges, content-match) without
2082
+ * forcing every new use case to extend `DequeueFilter`. KodaX-internal
2083
+ * code should prefer the typed fields for readability; this is the
2084
+ * "data-driven main path + predicate escape" pattern.
2085
+ *
2086
+ * Evaluated AFTER the typed filters succeed — so a `predicate` that
2087
+ * inspects `message.content` never runs on messages outside the
2088
+ * caller's `agentId` / `mode` / `id` scope.
2089
+ */
2090
+ readonly predicate?: (message: QueuedMessage) => boolean;
2149
2091
  }
2150
- interface KodaXVideoInputArtifact {
2151
- readonly kind: 'video';
2152
- readonly path: string;
2153
- readonly mediaType: KodaXVideoMediaType;
2154
- readonly name?: string;
2155
- readonly source?: KodaXInputArtifactSource;
2156
- readonly description?: string;
2092
+ /**
2093
+ * FEATURE_159 (v0.7.40) — structured queue event emitted to subscribers.
2094
+ *
2095
+ * Replaces the prior `() => void` bare-notify signal. Carries the kind +
2096
+ * affected messages so SDK observability consumers (logging, tracing,
2097
+ * metrics) can react per-event without re-diffing snapshots.
2098
+ *
2099
+ * Event granularity rules:
2100
+ * - `enqueued` fires ONCE per `enqueue()` call (always 1 message).
2101
+ * - `dequeued` fires ONCE per `dequeue()` call that removed ≥1 message,
2102
+ * carrying ALL drained messages in priority+FIFO order. No-op drains
2103
+ * (filter matched nothing) fire no event — quiet by design so the
2104
+ * idle consumers can probe without spamming subscribers.
2105
+ * - `cleared` fires ONCE per `clear()` call that removed ≥1 message,
2106
+ * carrying the pre-clear messages. Empty-queue clear fires nothing.
2107
+ *
2108
+ * The `useSyncExternalStore` React hook ignores the event payload (it
2109
+ * only needs the change signal); SDK / tracer consumers read the event.
2110
+ */
2111
+ type QueueEvent = {
2112
+ readonly kind: 'enqueued';
2113
+ readonly message: QueuedMessage;
2114
+ } | {
2115
+ readonly kind: 'dequeued';
2116
+ readonly messages: readonly QueuedMessage[];
2117
+ } | {
2118
+ readonly kind: 'cleared';
2119
+ readonly messages: readonly QueuedMessage[];
2120
+ };
2121
+ /** FEATURE_159 — `MessageQueue.subscribe` listener signature. */
2122
+ type QueueEventListener = (event: QueueEvent) => void;
2123
+ interface EnqueueInput {
2124
+ readonly priority: MessagePriority;
2125
+ readonly mode: MessageMode;
2126
+ /** Accepted client input identity carried onto the drained user message. */
2127
+ readonly inputId?: string;
2128
+ /** Omitted means `runtime`; use `host` for command-pipeline-owned prompts. */
2129
+ readonly delivery?: MessageDelivery;
2130
+ readonly content: string;
2131
+ readonly agentId?: string;
2132
+ readonly inputArtifacts?: readonly QueuedInputArtifact[];
2133
+ readonly taskResult?: KodaXTaskResultMetadata;
2157
2134
  }
2158
- type KodaXInputArtifact = KodaXImageInputArtifact | KodaXFileInputArtifact | KodaXVideoInputArtifact;
2159
2135
 
2160
2136
  /**
2161
2137
  * FEATURE_125 (v0.7.41) — Team Mode Layer 1: per-instance state broadcast.
@@ -2385,154 +2361,6 @@ interface DiscoveryOptions {
2385
2361
  */
2386
2362
  declare function discoverInstances(options?: DiscoveryOptions): DiscoveredInstance[];
2387
2363
 
2388
- type LearnedCapabilityCarrier = 'skill' | 'extension' | 'workflow_handoff';
2389
- type LearnedCapabilityLifecycle = 'opportunity' | 'drafting' | 'ready' | 'testing' | 'active_learned' | 'promoted_user' | 'quarantined' | 'archived' | 'rejected';
2390
- type LearningEventKind = 'opportunity' | 'drafting' | 'ready' | 'testing' | 'activated' | 'promoted' | 'attention' | 'archived' | 'rejected';
2391
- type LearningAction = 'review' | 'trust' | 'reject' | 'disable' | 'rollback' | 'archive' | 'restore' | 'promote';
2392
- interface LearnedCapabilitySource {
2393
- readonly kind: 'learning_controller' | 'f224_proposal' | 'skill_learning_loop' | 'legacy_manual';
2394
- readonly proposalId?: string;
2395
- }
2396
- interface LearnedCapabilityRecordBase {
2397
- readonly capabilityId: string;
2398
- readonly displayName: string;
2399
- readonly slug: string;
2400
- readonly carrier: LearnedCapabilityCarrier;
2401
- readonly lifecycle: LearnedCapabilityLifecycle;
2402
- readonly revision: number;
2403
- readonly createdAt: string;
2404
- readonly updatedAt: string;
2405
- readonly source: LearnedCapabilitySource;
2406
- /** The control action that produced this revision, when it is not implied by lifecycle. */
2407
- readonly lastAction?: LearningAction;
2408
- readonly artifactPath?: string;
2409
- readonly previousGoodRevision?: number;
2410
- readonly previousLifecycle?: LearnedCapabilityLifecycle;
2411
- readonly diagnostics?: readonly string[];
2412
- }
2413
- interface LearnedCapabilityRecordV1 extends LearnedCapabilityRecordBase {
2414
- readonly schemaVersion: 1;
2415
- }
2416
- interface LearnedCapabilityScope {
2417
- readonly configHomeHash: string;
2418
- readonly tenantHash: string;
2419
- readonly projectHash: string;
2420
- }
2421
- interface LearnedCapabilityArtifact {
2422
- readonly kind: 'skill_markdown';
2423
- readonly relativePath: string;
2424
- readonly fingerprint: string;
2425
- readonly contentRevision: number;
2426
- }
2427
- interface LearnedCapabilityProvenance {
2428
- readonly jobId: string;
2429
- readonly inputHash: string;
2430
- readonly decisionId: string;
2431
- readonly actionId: string;
2432
- }
2433
- interface LearnedCapabilityCanaryBinding {
2434
- readonly bindingId: string;
2435
- readonly ownerSessionRef: string;
2436
- readonly expiresAt: string;
2437
- }
2438
- interface LearnedCapabilityCanaryInvocation {
2439
- readonly invocationId: string;
2440
- readonly bindingId: string;
2441
- /** Durable usage-ledger identity for recovery after the binding expires. */
2442
- readonly usageSessionHash?: string;
2443
- readonly artifactRevision?: number;
2444
- readonly artifactFingerprint?: string;
2445
- readonly status: 'pending' | 'verified_success' | 'credible_negative' | 'inconclusive';
2446
- readonly evidenceRefs: readonly string[];
2447
- readonly invokedAt: string;
2448
- readonly completedAt?: string;
2449
- }
2450
- interface LearnedCapabilityCanary {
2451
- readonly maxInvocations: 3;
2452
- readonly invocationCount: number;
2453
- readonly verifiedSuccesses: number;
2454
- readonly credibleNegatives: number;
2455
- readonly binding?: LearnedCapabilityCanaryBinding;
2456
- readonly invocations: readonly LearnedCapabilityCanaryInvocation[];
2457
- }
2458
- interface LearnedCapabilityRecordV2 extends LearnedCapabilityRecordBase {
2459
- readonly schemaVersion: 2;
2460
- readonly carrier: 'skill';
2461
- readonly scope: LearnedCapabilityScope;
2462
- readonly artifact: LearnedCapabilityArtifact;
2463
- readonly previousGoodArtifact?: LearnedCapabilityArtifact;
2464
- readonly provenance: LearnedCapabilityProvenance;
2465
- readonly canary: LearnedCapabilityCanary;
2466
- }
2467
- type LearnedCapabilityRecord = LearnedCapabilityRecordV1 | LearnedCapabilityRecordV2;
2468
- interface LearningEvent {
2469
- readonly schemaVersion: 1;
2470
- readonly sequence: number;
2471
- readonly eventId: string;
2472
- readonly capabilityId: string;
2473
- readonly capabilityRevision: number;
2474
- readonly kind: LearningEventKind;
2475
- readonly lifecycle: LearnedCapabilityLifecycle;
2476
- readonly displayName: string;
2477
- readonly slug: string;
2478
- readonly carrier: LearnedCapabilityCarrier;
2479
- readonly createdAt: string;
2480
- }
2481
- type LearningNotificationState = 'unread' | 'seen' | 'acknowledged' | 'snoozed';
2482
- interface LearningClientEventState {
2483
- readonly state: LearningNotificationState;
2484
- readonly capabilityRevision: number;
2485
- readonly updatedAt: string;
2486
- readonly snoozedUntil?: string;
2487
- }
2488
- interface LearningClientRecord {
2489
- readonly schemaVersion: 1;
2490
- readonly clientIdentity: string;
2491
- readonly events: Readonly<Record<string, LearningClientEventState>>;
2492
- }
2493
- interface LearningSurfaceSnapshot {
2494
- readonly ready: number;
2495
- readonly newlyActive: number;
2496
- readonly attention: number;
2497
- readonly active: number;
2498
- readonly revision: number;
2499
- }
2500
- interface LearningQuery {
2501
- readonly search?: string;
2502
- readonly carrier?: LearnedCapabilityCarrier;
2503
- readonly lifecycle?: LearnedCapabilityLifecycle;
2504
- readonly limit?: number;
2505
- readonly cursor?: string;
2506
- }
2507
- interface LearningPage {
2508
- readonly items: readonly LearnedCapabilityRecord[];
2509
- readonly nextCursor?: string;
2510
- readonly revision: number;
2511
- }
2512
- interface LearningSubscribeOptions {
2513
- readonly afterRevision?: number;
2514
- }
2515
- interface LearningExplicitUserAuthority {
2516
- readonly authority: 'explicit_user';
2517
- readonly expectedRevision: number;
2518
- readonly expectedFingerprint?: string;
2519
- }
2520
- interface LearningActionDriver {
2521
- readonly carrier: LearnedCapabilityCarrier;
2522
- readonly actions: readonly LearningAction[];
2523
- execute(action: LearningAction, capability: LearnedCapabilityRecord): Promise<LearnedCapabilityRecord>;
2524
- }
2525
- type LearningCapabilityErrorCode = 'ambiguous_name' | 'action_failed' | 'capability_not_found' | 'invalid_record' | 'invalid_transition' | 'store_integrity_error' | 'unsupported_action';
2526
- declare class LearningCapabilityError extends Error {
2527
- readonly code: LearningCapabilityErrorCode;
2528
- constructor(code: LearningCapabilityErrorCode, message: string);
2529
- }
2530
- declare function canTransitionLearnedCapability(from: LearnedCapabilityLifecycle, to: LearnedCapabilityLifecycle): boolean;
2531
- declare function assertLearnedCapabilityTransition(from: LearnedCapabilityLifecycle, to: LearnedCapabilityLifecycle): void;
2532
- declare function slugifyLearnedCapabilityName(displayName: string): string;
2533
- declare function learningEventKindForLifecycle(lifecycle: LearnedCapabilityLifecycle): LearningEventKind;
2534
- declare function learningEventIdFor(record: LearnedCapabilityRecord): string;
2535
-
2536
2364
  interface LearnedAreaPaths {
2537
2365
  readonly root: string;
2538
2366
  readonly skills: string;
@@ -2780,1074 +2608,6 @@ declare function sanitizeUnifiedLearningReviewInput(input: UnifiedLearningReview
2780
2608
  declare function isUnifiedLearningReviewModelInput(value: unknown): value is UnifiedLearningReviewModelInput;
2781
2609
  declare function normalizeUnifiedLearningReview(input: UnifiedLearningReviewModelInput, raw: unknown): UnifiedLearningReviewResult;
2782
2610
 
2783
- /**
2784
- * ../../index.js Compaction Types
2785
- */
2786
-
2787
- interface CompactionConfig {
2788
- /** Independent of the main turn; defaults off, or to a low supported effort on always-on models. */
2789
- reasoning?: boolean | KodaXReasoningRequest;
2790
- /** @deprecated Automatic large compaction is always enabled. */
2791
- enabled: boolean;
2792
- /**
2793
- * Automatic large-compaction threshold percentage. Defaults to 75 and is
2794
- * normalized to the inclusive 15-90 range.
2795
- */
2796
- triggerPercent: number;
2797
- /**
2798
- * Optional absolute token threshold. Missing or zero is inactive; otherwise
2799
- * the smaller percentage/absolute/physical threshold wins.
2800
- */
2801
- triggerTokens?: number;
2802
- /**
2803
- * @deprecated V2 compaction no longer uses this option.
2804
- * FEATURE_272 derives protection from the effective trigger and covers the
2805
- * complete eligible prefix in one logical wave.
2806
- */
2807
- keepRecentPercent?: number;
2808
- /**
2809
- * @deprecated Large compaction protects 20% of its effective trigger.
2810
- * Retained only for source compatibility with v0.7.x callers.
2811
- */
2812
- protectionPercent?: number;
2813
- /**
2814
- * @deprecated FEATURE_272 replaces rolling summary passes with one complete
2815
- * eligible-prefix wave. Retained for source compatibility.
2816
- */
2817
- rollingSummaryPercent?: number;
2818
- /**
2819
- * Explicit legacy opt-in for destructive emergency pruning after semantic
2820
- * compaction cannot restore a physically valid request. Undefined keeps the
2821
- * fallback disabled.
2822
- */
2823
- pruningThresholdTokens?: number;
2824
- /**
2825
- * Legacy deterministic-pruning gap ratio. Only relevant when
2826
- * `pruningThresholdTokens` is explicitly configured.
2827
- */
2828
- pruningGapRatio?: number;
2829
- /** Optional override for the provider context window. */
2830
- contextWindow?: number;
2831
- }
2832
- interface CompactionDetails {
2833
- readFiles: string[];
2834
- modifiedFiles: string[];
2835
- }
2836
- interface CompactionAnchor {
2837
- summary: string;
2838
- tokensBefore: number;
2839
- tokensAfter: number;
2840
- entriesRemoved: number;
2841
- reason: string;
2842
- artifactLedgerId?: string;
2843
- details?: CompactionDetails;
2844
- memorySeed?: KodaXCompactMemorySeed;
2845
- }
2846
- interface CompactionUpdate {
2847
- /**
2848
- * Exact host-only snapshot used to reconcile lineage before durable commit.
2849
- * It is intentionally not part of the persisted CompactionEntry or provider
2850
- * context. Hosts may evict old message bodies only after saving this state.
2851
- */
2852
- preCompactionMessages?: readonly KodaXMessage[];
2853
- anchor?: CompactionAnchor;
2854
- artifactLedger?: KodaXSessionArtifactLedgerEntry[];
2855
- memorySeed?: KodaXCompactMemorySeed;
2856
- /**
2857
- * FEATURE_072: ledger-summary + file-content messages produced by
2858
- * `buildPostCompactAttachments` + `buildFileContentMessages`. Agent.ts
2859
- * passes these separately from the kept-tail messages so REPL-side
2860
- * `applySessionCompaction` can store them natively on the CompactionEntry
2861
- * rather than inlining them as loose `[Post-compact: ...]` system messages
2862
- * in lineage. Agent.ts keeps inlining them into its local flat `messages`
2863
- * via `injectPostCompactAttachments` (P4 belt-and-suspenders); the lineage
2864
- * is the persistence source of truth.
2865
- */
2866
- postCompactAttachments?: readonly KodaXMessage[];
2867
- /** Canonical metrics for one committed large-compaction transaction. */
2868
- report?: CompactionReport;
2869
- }
2870
- interface CompactionReport {
2871
- /** Physical summary calls, including map/reduce; never contains prompt or output text. */
2872
- readonly summaryRequests?: readonly CompactionRequestMetrics[];
2873
- /** Durable history commit only; excludes summary generation. */
2874
- readonly commitMs?: number;
2875
- readonly strategy: 'full_prefix' | 'map_reduce';
2876
- readonly triggerSource: 'percentage' | 'absolute' | 'physical_capacity';
2877
- readonly effectiveTriggerTokens: number;
2878
- readonly protectedBudgetTokens: number;
2879
- readonly fixedInputTokens: number;
2880
- readonly eligibleTokens: number;
2881
- readonly rawTailTokens: number;
2882
- readonly summaryTokens: number;
2883
- readonly queryLedgerTokens: number;
2884
- }
2885
- interface CompactionRequestMetrics {
2886
- readonly provider: string;
2887
- readonly model: string;
2888
- /** Requested summary policy; the provider may adapt it to its capabilities. */
2889
- readonly reasoning: boolean | KodaXReasoningRequest;
2890
- readonly prepareMs: number;
2891
- readonly credentialMs: number;
2892
- /** Includes retries and their waits. firstDeltaMs is an offset within this duration. */
2893
- readonly providerMs: number;
2894
- readonly firstDeltaMs?: number;
2895
- /** Retries reported by the provider adapter; excludes opaque upstream retries. */
2896
- readonly retryCount: number;
2897
- readonly retryWaitMs: number;
2898
- readonly usage?: KodaXTokenUsage;
2899
- readonly stopReason?: string;
2900
- readonly outcome: 'succeeded' | 'failed';
2901
- }
2902
- interface CompactionResult {
2903
- compacted: boolean;
2904
- messages: KodaXMessage[];
2905
- summary?: string;
2906
- tokensBefore: number;
2907
- tokensAfter: number;
2908
- entriesRemoved: number;
2909
- details?: CompactionDetails;
2910
- artifactLedger?: KodaXSessionArtifactLedgerEntry[];
2911
- anchor?: CompactionAnchor;
2912
- memorySeed?: KodaXCompactMemorySeed;
2913
- report?: CompactionReport;
2914
- }
2915
- interface FileOperations {
2916
- readFiles: string[];
2917
- modifiedFiles: string[];
2918
- }
2919
-
2920
- /**
2921
- * FEATURE_217 (v0.7.49) — Workflow run-graph events.
2922
- *
2923
- * Append-only event stream for a workflow run. Each event carries a
2924
- * monotonic `seq` so ordering is stable and verifiable regardless of
2925
- * wall-clock (the durable writer in Phase D adds timestamps via an
2926
- * injected clock). The run graph models agent relationships as a
2927
- * thread/edge/event stream, not just a final summary blob.
2928
- */
2929
- type WorkflowEventType = 'workflow_started' | 'phase_started' | 'phase_finished' | 'agent_spawned' | 'agent_message_sent' | 'agent_completed' | 'agent_unverified' | 'agent_failed' | 'agent_summary_updated' | 'agent_stopped' | 'agent_replayed' | 'workflow_log' | 'artifact_written' | 'synthesis_completed' | 'workflow_completed' | 'workflow_stopped' | 'workflow_failed';
2930
- interface WorkflowEvent {
2931
- /** Monotonic sequence number — stable append ordering. */
2932
- readonly seq: number;
2933
- readonly type: WorkflowEventType;
2934
- /** Structured payload (agent name/id, phase name, error message, …). */
2935
- readonly data?: Record<string, unknown>;
2936
- }
2937
- /**
2938
- * Append-only event recorder. Assigns sequential `seq` and fans each
2939
- * event out to an optional sink (the durable JSONL writer / UI consumer
2940
- * subscribes here in Phase D).
2941
- */
2942
- declare class WorkflowEventRecorder {
2943
- private readonly sink?;
2944
- private seq;
2945
- private readonly events;
2946
- constructor(sink?: ((event: WorkflowEvent) => void) | undefined);
2947
- /** Append an event, returning the materialized record. */
2948
- emit(type: WorkflowEventType, data?: Record<string, unknown>): WorkflowEvent;
2949
- /** Immutable snapshot of all events emitted so far. */
2950
- snapshot(): readonly WorkflowEvent[];
2951
- }
2952
-
2953
- /**
2954
- * FEATURE_217 (v0.7.49) — Dynamic Workflow Harness Runtime: public types.
2955
- *
2956
- * Domain-neutral workflow orchestration surface. A workflow *script*
2957
- * coordinates (decompose / fan-out / loop / wait / stop / verify /
2958
- * synthesize); it never touches files or shell directly. The actual
2959
- * agent execution is delegated to an injected `WorkflowAgentBackend`
2960
- * (the coding layer provides the real one in Phase B; tests inject a
2961
- * fake). This keeps `@kodax-ai/agent` free of any `@kodax-ai/coding`
2962
- * dependency (ADR-021 layer independence).
2963
- */
2964
- /** Lifecycle status of a single workflow-spawned agent. */
2965
- type WorkflowTaskStatus = 'running' | 'completed' | 'completed_unverified' | 'failed' | 'stopped';
2966
- /** Routing hint for which provider/model tier the child should use. */
2967
- type WorkflowModelHint = 'fast' | 'balanced' | 'deep';
2968
- /** Isolation policy for a spawned agent. `shared-cwd` is the default
2969
- * (FEATURE_188); `worktree` is opt-in for high-risk parallel writes. */
2970
- type WorkflowIsolation = 'shared-cwd' | 'worktree';
2971
- /**
2972
- * Machine-checkable postconditions for a workflow child task. The agent
2973
- * package only defines the contract; concrete backends decide which evidence
2974
- * they can verify.
2975
- */
2976
- interface WorkflowTaskVerification {
2977
- readonly enforcement?: 'hard' | 'warn';
2978
- readonly requiresMutation?: boolean;
2979
- readonly requiredChangedPaths?: readonly string[];
2980
- /** Read-tool paths that must be observed before accepting a review verdict. */
2981
- readonly requiredReadPaths?: readonly string[];
2982
- readonly minFinalTextChars?: number;
2983
- readonly rejectPreparatoryFinalText?: boolean;
2984
- }
2985
- interface WorkflowTaskVerificationResult {
2986
- readonly ok: boolean;
2987
- readonly enforcement?: 'hard' | 'warn';
2988
- readonly reasons: readonly string[];
2989
- readonly changedPaths?: readonly string[];
2990
- readonly mutationToolCalls?: readonly string[];
2991
- readonly mutationEvidence?: boolean;
2992
- readonly readPaths?: readonly string[];
2993
- }
2994
- interface WorkflowAgentTarget {
2995
- readonly agentId: string;
2996
- readonly expectedConfigurationRevision?: string;
2997
- }
2998
- interface WorkflowSpawnAgentInput {
2999
- /** Human-readable label for the agent — surfaces in events / UI. */
3000
- readonly name: string;
3001
- /**
3002
- * Optional progress-group tag (FEATURE_246 Part E). When set, this agent is
3003
- * grouped under a phase of that name in the progress display — the per-agent
3004
- * equivalent of wrapping a block in `wf.phase(name, fn)`, matching the harness
3005
- * `agent(..., { phase })`. The phase group is created on first use. Agents
3006
- * with no `phase` fall under the currently-active `wf.phase(...)` block (if any).
3007
- */
3008
- readonly phase?: string;
3009
- /** The task prompt handed to the child agent. */
3010
- readonly prompt: string;
3011
- /** Compact scope summary copied into the child briefing without retyping the diff. */
3012
- readonly scopeSummary?: string;
3013
- /** Binding constraints/interfaces the child cannot discover locally. */
3014
- readonly constraints?: readonly string[];
3015
- /** When true, the child runs with a read-only tool whitelist. */
3016
- readonly readOnly?: boolean;
3017
- /** Route to a registered specialist agent (FEATURE_191). */
3018
- readonly subagentType?: string;
3019
- /** Route through the shared dispatchable-agent catalog (FEATURE_258). */
3020
- readonly target?: WorkflowAgentTarget;
3021
- /**
3022
- * Per-agent model TIER (FEATURE_120 model_hint). The script expresses semantic
3023
- * intent — 'fast' (cheap), 'deep' (strong), 'balanced' (default) — NOT a
3024
- * concrete model name: the authoring model has no cognition of which
3025
- * providers/models a given operator has configured. The operator maps the
3026
- * tiers to concrete models via env (KODAX_FAST/DEEP_PROVIDER/MODEL); when a
3027
- * tier is unconfigured the child inherits the parent provider/model. 'fast'
3028
- * applies to read-only children
3029
- * only (write/codegen stays on the parent tier — a quality guard).
3030
- */
3031
- readonly modelHint?: WorkflowModelHint;
3032
- /** Isolation policy; defaults to `shared-cwd`. */
3033
- readonly isolation?: WorkflowIsolation;
3034
- /** Per-child reasoning effort hint (e.g. 'low' | 'medium' | 'high' | 'max').
3035
- * The backend maps it onto the child's reasoning resolver; omit to inherit
3036
- * the parent/default effort. Opaque string so the agent layer needs no
3037
- * coding effort-enum dependency. */
3038
- readonly effort?: string;
3039
- /** Evidence refs (`task_id:<id>` etc.) seeded into the child context. */
3040
- readonly evidenceRefs?: readonly string[];
3041
- /** Optional machine-checkable postconditions for this child task. */
3042
- readonly verification?: WorkflowTaskVerification;
3043
- /**
3044
- * Optional JSON Schema (FEATURE_246 Part B). When set, the child is asked to
3045
- * end with a fenced JSON block matching the schema; the backend parses and
3046
- * validates it (with one bounded repair turn on a hard miss) and returns the
3047
- * parsed object on `WorkflowTaskResult.structured`. Orthogonal to
3048
- * `verification` (which checks side-effects, not return shape). Carried as an
3049
- * opaque value so the agent layer needs no JSON-Schema dependency.
3050
- */
3051
- readonly outputSchema?: unknown;
3052
- /** Register concise finalText for digest reuse; trusted host provenance is checked separately. */
3053
- readonly terseResult?: boolean;
3054
- }
3055
- /** Returned by `spawnAgent` — the child is in-flight, not yet complete. */
3056
- interface WorkflowTaskHandle {
3057
- readonly taskId: string;
3058
- readonly name: string;
3059
- }
3060
- interface WorkflowTaskUsage {
3061
- readonly inputTokens?: number;
3062
- readonly outputTokens?: number;
3063
- readonly totalTokens?: number;
3064
- readonly cacheReadTokens?: number;
3065
- }
3066
- type WorkflowTaskSummaryKind = 'digest' | 'excerpt' | 'digest-failed' | 'pending';
3067
- interface WorkflowTaskSummaryEventUpdate {
3068
- readonly summary?: string;
3069
- readonly summaryKind: WorkflowTaskSummaryKind;
3070
- readonly usage?: WorkflowTaskUsage;
3071
- }
3072
- /** Terminal result of a spawned agent (from `wait` / `runAgent`). */
3073
- interface WorkflowTaskResult {
3074
- readonly taskId: string;
3075
- readonly name: string;
3076
- readonly status: WorkflowTaskStatus;
3077
- readonly finalText: string;
3078
- /** Schema-validated structured result (FEATURE_246 Part B), present when the
3079
- * spawn carried `outputSchema` and a JSON value was parsed from the child's
3080
- * output. The workflow script consumes it directly (e.g. `result.structured`). */
3081
- readonly structured?: unknown;
3082
- /** Durable artifacts produced by this Agent turn. */
3083
- readonly artifacts?: readonly string[];
3084
- /** Short user-facing digest, separate from the full finalText used for synthesis/audit. */
3085
- readonly digest?: string;
3086
- /** True when a digest was attempted but failed (error/timeout/empty); the UI then labels the excerpt fallback. */
3087
- readonly digestFailed?: boolean;
3088
- /** True when a digest was scheduled asynchronously and may arrive via `agent_summary_updated`. */
3089
- readonly digestPending?: boolean;
3090
- /** Task postcondition check, when a backend evaluated one. */
3091
- readonly verification?: WorkflowTaskVerificationResult;
3092
- /** True when the child exhausted its iteration budget before completing. */
3093
- readonly limitReached?: boolean;
3094
- /** Best-known provider/model used by the child, for host correlation only. */
3095
- readonly provider?: string;
3096
- readonly model?: string;
3097
- /** Requested semantic tier and how the local runtime resolved it. */
3098
- readonly requestedTier?: WorkflowModelHint | 'inherited';
3099
- readonly tierOutcome?: 'applied' | 'balanced-parent' | 'fast-write-ineligible' | 'unconfigured' | 'shadowed-by-selector' | 'inherited';
3100
- readonly providerSource?: 'explicit' | 'specialist' | 'tier' | 'parent' | 'default';
3101
- readonly modelSource?: 'explicit' | 'specialist' | 'tier' | 'parent';
3102
- readonly initialProvider?: string;
3103
- readonly initialModel?: string;
3104
- readonly finalProvider?: string;
3105
- readonly finalModel?: string;
3106
- readonly fallbackReason?: string;
3107
- readonly resolvedEffort?: string;
3108
- readonly iterations?: number;
3109
- readonly durationMs?: number;
3110
- readonly digestUsage?: WorkflowTaskUsage;
3111
- readonly usage?: WorkflowTaskUsage;
3112
- }
3113
- /** Point-in-time snapshot of a (possibly still-running) agent. */
3114
- interface WorkflowTaskSnapshot {
3115
- readonly taskId: string;
3116
- readonly name: string;
3117
- readonly status: WorkflowTaskStatus;
3118
- readonly lastText?: string;
3119
- }
3120
- interface WorkflowWaitOptions {
3121
- readonly timeoutMs?: number;
3122
- }
3123
- interface WorkflowParallelOptions {
3124
- /** In-flight cap for this parallel block; clamped by workflow
3125
- * maxConcurrency. */
3126
- readonly concurrency?: number;
3127
- }
3128
- interface WorkflowSynthesizeInput {
3129
- readonly inputs: readonly unknown[] | string | Record<string, unknown>;
3130
- readonly rubric: string;
3131
- }
3132
- interface WorkflowSynthesis {
3133
- readonly text: string;
3134
- }
3135
- interface WorkflowArtifactRef {
3136
- readonly name: string;
3137
- readonly path?: string;
3138
- }
3139
- interface WorkflowLogEvent {
3140
- readonly message: string;
3141
- readonly data?: unknown;
3142
- }
3143
- /**
3144
- * Token budget accounting. The runtime hard-stops before launching a new
3145
- * agent once completed children have exhausted the configured budget.
3146
- */
3147
- interface WorkflowBudget {
3148
- /** Configured token budget, or null when unbounded. */
3149
- readonly total: number | null;
3150
- /** Tokens accounted across completed agents so far. */
3151
- spent(): number;
3152
- /** `max(0, total - spent())`, or Infinity when unbounded. */
3153
- remaining(): number;
3154
- }
3155
- interface WorkflowLimits {
3156
- /** Total agents spawnable across the whole run lifetime. */
3157
- readonly maxAgents?: number;
3158
- /** Maximum simultaneously in-flight agents (via runAgent / parallel). */
3159
- readonly maxConcurrency?: number;
3160
- /** Token budget. New spawns stop once completed usage exhausts it. */
3161
- readonly tokenBudget?: number;
3162
- }
3163
- /**
3164
- * The surface a workflow script consumes. The script never gets raw
3165
- * fs/shell — all effects route through agent tools behind the backend.
3166
- */
3167
- interface WorkflowApi {
3168
- readonly runId: string;
3169
- readonly args: unknown;
3170
- readonly budget: WorkflowBudget;
3171
- /** Group operations under a named phase (emits phase_started/finished). */
3172
- phase<T>(name: string, fn: () => Promise<T>): Promise<T>;
3173
- /** Start a child agent; returns immediately with a handle. */
3174
- spawnAgent(input: WorkflowSpawnAgentInput): Promise<WorkflowTaskHandle>;
3175
- /** spawnAgent + wait convenience; returns the terminal result, or `null` if
3176
- * the child ended failed/stopped (FEATURE_246 Part E lenient failure — the
3177
- * harness `agent()` semantics, so scripts can `.filter(Boolean)` instead of
3178
- * wrapping every call in try/catch). Abort and budget/agent-cap limits still
3179
- * throw. */
3180
- runAgent(input: WorkflowSpawnAgentInput): Promise<WorkflowTaskResult | null>;
3181
- /** Await a spawned agent's terminal result. */
3182
- wait(taskId: string, opts?: WorkflowWaitOptions): Promise<WorkflowTaskResult>;
3183
- /** Snapshot a (possibly running) agent. */
3184
- snapshot(taskId: string): Promise<WorkflowTaskSnapshot>;
3185
- /** Snapshot a (possibly running) agent.
3186
- * @deprecated Prefer `snapshot(taskId)`; `output` is kept as a compatibility alias. */
3187
- output(taskId: string): Promise<WorkflowTaskSnapshot>;
3188
- /** Send a message to a running Agent through its Actor mailbox. */
3189
- send(taskId: string, content: string): Promise<void>;
3190
- /** Stop a running agent (graceful abort). */
3191
- stop(taskId: string, reason: string): Promise<void>;
3192
- /** Run lazy thunks concurrently under the concurrency gate. Thunks
3193
- * MUST be `() => Promise<T>` (not already-started promises) so the
3194
- * runtime can bound concurrency. A thunk that throws (or whose agent fails)
3195
- * resolves to `null` in the result array — the call itself never rejects, so
3196
- * `.filter(Boolean)` before use (FEATURE_246 Part E, harness parity). Abort
3197
- * still tears down the whole run. */
3198
- parallel<T>(items: readonly (() => Promise<T>)[], opts?: WorkflowParallelOptions): Promise<(T | null)[]>;
3199
- /**
3200
- * Stream items through ordered stages with NO barrier between stages: an
3201
- * item advances to stage N+1 as soon as its own stage N resolves,
3202
- * independent of other items (wall-clock = slowest single chain, not
3203
- * sum-of-slowest-per-stage). Each stage receives `(prev, item, index)`
3204
- * where `prev` is the previous stage's result (the original item at
3205
- * stage 1). A stage that throws drops that item to `null` and skips its
3206
- * remaining stages; results preserve input order. Agent spawns inside
3207
- * stages stay bounded by the workflow `maxConcurrency` gate. Optional:
3208
- * the restricted-script bootstrap always provides it; SDK consumers get
3209
- * it from the runtime. */
3210
- pipeline?(items: readonly unknown[], ...stages: readonly ((prev: unknown, item: unknown, index: number) => unknown)[]): Promise<unknown[]>;
3211
- /** Synthesize across inputs. Runs as a gated agent through the runtime
3212
- * (spawn → wait), so it counts toward maxAgents / concurrency / budget
3213
- * and emits run-graph events — it is NOT a backend side-channel. */
3214
- synthesize(input: WorkflowSynthesizeInput): Promise<WorkflowSynthesis>;
3215
- /**
3216
- * Run another saved/built-in workflow inline as a sub-step (FEATURE_246 Part E,
3217
- * harness parity). Resolves the module by name via the host-injected resolver
3218
- * and runs it under THIS run's runtime — sharing the same concurrency cap,
3219
- * agent counter, token budget, and abort signal. **One level only**: calling
3220
- * `workflow(...)` from inside a nested workflow throws. Returns whatever the
3221
- * sub-workflow's `run` returns. Optional: present when a resolver is wired
3222
- * (the restricted-script bootstrap provides it; SDK consumers may omit). */
3223
- workflow?(name: string, args?: unknown): Promise<unknown>;
3224
- /** Persist a named artifact. */
3225
- artifact(name: string, value: unknown): Promise<WorkflowArtifactRef>;
3226
- /** Emit a free-text progress log event. */
3227
- log(event: WorkflowLogEvent): void;
3228
- }
3229
- /** Metadata a workflow declares (name, description, default caps). */
3230
- interface WorkflowMeta {
3231
- readonly name: string;
3232
- readonly description: string;
3233
- /** Best-effort expected child-agent count for progress UI; not a hard cap. */
3234
- readonly plannedAgents?: number;
3235
- readonly maxAgents?: number;
3236
- readonly maxConcurrency?: number;
3237
- readonly tokenBudget?: number;
3238
- /** True when the workflow only ever spawns read-only agents (no file
3239
- * writes) — surfaced in the approval prompt. */
3240
- readonly readOnly?: boolean;
3241
- /** Declared phase names, for the approval prompt preview. */
3242
- readonly phases?: readonly string[];
3243
- }
3244
- /** Summary shown to the user before a workflow's first run. */
3245
- interface WorkflowApprovalSummary {
3246
- readonly name: string;
3247
- readonly description: string;
3248
- readonly phases: readonly string[];
3249
- readonly plannedAgents?: number;
3250
- readonly maxAgents: number | null;
3251
- readonly maxConcurrency: number | null;
3252
- readonly tokenBudget: number | null;
3253
- /** Whether the workflow may write files (false for read-only workflows). */
3254
- readonly writesFiles: boolean;
3255
- }
3256
- /** Approval gate — returns true to proceed, false to cancel the run. */
3257
- type WorkflowApproval = (summary: WorkflowApprovalSummary) => boolean | Promise<boolean>;
3258
- /** A workflow's entry function: coordinates agents via the `WorkflowApi`. */
3259
- type WorkflowRun<TArgs = unknown, TResult = unknown> = (wf: WorkflowApi, args: TArgs) => Promise<TResult>;
3260
- /** A self-contained workflow: metadata + entry function. Built-in
3261
- * workflows (Phase C) and saved `.kodax/workflows/*.ts` (Phase E) both
3262
- * materialize to this shape. */
3263
- interface WorkflowModule<TArgs = unknown, TResult = unknown> {
3264
- readonly meta: WorkflowMeta;
3265
- readonly run: WorkflowRun<TArgs, TResult>;
3266
- }
3267
- /** Injected execution backend over the host's Runtime-owned Actor plane. */
3268
- interface WorkflowAgentBackend {
3269
- spawn(input: WorkflowSpawnAgentInput): Promise<WorkflowTaskHandle>;
3270
- /** Wait until the global Actor scheduler can admit a step. False means no slot can ever exist. */
3271
- waitForAgentCapacity?(signal?: AbortSignal): Promise<boolean>;
3272
- wait(taskId: string, opts?: WorkflowWaitOptions): Promise<WorkflowTaskResult>;
3273
- output(taskId: string): Promise<WorkflowTaskSnapshot>;
3274
- send(taskId: string, content: string): Promise<void>;
3275
- stop(taskId: string, reason: string): Promise<void>;
3276
- /** Optional late summary stream for presentation-only async digests. */
3277
- subscribeTaskSummaryUpdates?(listener: (taskId: string, update: WorkflowTaskSummaryEventUpdate) => void): () => void;
3278
- /** Optional durable artifact writer (Phase D wires the run graph).
3279
- * `wf.synthesize` is NOT a backend method — it runs as a gated agent
3280
- * through `spawn`/`wait` so it counts toward the runtime's caps. */
3281
- writeArtifact?(name: string, value: unknown): Promise<WorkflowArtifactRef>;
3282
- }
3283
- type WorkflowRunStatus = 'running' | 'completed' | 'failed' | 'stopped';
3284
- type WorkflowOutcomeStatus = 'completed' | 'partial' | 'failed' | 'interrupted';
3285
- interface WorkflowOutcomeResult {
3286
- readonly taskId: string;
3287
- readonly name: string;
3288
- readonly status: WorkflowTaskStatus;
3289
- readonly summary: string;
3290
- readonly structured?: unknown;
3291
- readonly artifacts: readonly string[];
3292
- readonly usage?: WorkflowTaskUsage;
3293
- }
3294
- interface WorkflowOutcomeError {
3295
- readonly taskId?: string;
3296
- readonly name?: string;
3297
- readonly message: string;
3298
- }
3299
- interface WorkflowOutcomeUsage extends WorkflowTaskUsage {
3300
- readonly totalSpawned: number;
3301
- }
3302
- /** Stable terminal payload exposed through the Workflow protocol owner's Agent output. */
3303
- interface WorkflowOutcome {
3304
- readonly runId: string;
3305
- readonly status: WorkflowOutcomeStatus;
3306
- readonly summary: string;
3307
- readonly results: readonly WorkflowOutcomeResult[];
3308
- readonly artifacts: readonly WorkflowArtifactRef[];
3309
- readonly coverage: readonly string[];
3310
- readonly unresolved: readonly string[];
3311
- readonly errors: readonly WorkflowOutcomeError[];
3312
- readonly usage: WorkflowOutcomeUsage;
3313
- }
3314
- /** Immutable snapshot of a workflow run's accumulated state. */
3315
- interface WorkflowRunState {
3316
- readonly runId: string;
3317
- readonly status: WorkflowRunStatus;
3318
- readonly totalSpawned: number;
3319
- readonly results: readonly WorkflowTaskResult[];
3320
- readonly events: readonly WorkflowEvent[];
3321
- readonly artifacts: readonly WorkflowArtifactRef[];
3322
- }
3323
-
3324
- type WorkflowProcessStatus = 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
3325
- type WorkflowProcessItemStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled' | 'skipped';
3326
- type WorkflowProcessItemKind = 'phase' | 'agent' | 'step' | 'artifact';
3327
- /**
3328
- * FEATURE_246 resume telemetry — how an agent item came to be in a resumed run.
3329
- * `ran` = executed live this run; `replayed-from-cache` = returned instantly from
3330
- * a prior run's content-addressed result cache (resumeFromRunId). Only populated
3331
- * on resumed runs; absent on a fresh run (treat absent as `ran`).
3332
- */
3333
- type WorkflowProcessItemOrigin = 'ran' | 'replayed-from-cache';
3334
- type WorkflowProcessSummaryStatus = 'pending' | 'result' | 'notice' | 'unavailable';
3335
- type WorkflowProcessSource = 'command' | 'review' | 'sdk' | 'capsule' | 'extension' | 'automation';
3336
- interface WorkflowProcessItem {
3337
- readonly id: string;
3338
- readonly title: string;
3339
- readonly kind: WorkflowProcessItemKind;
3340
- readonly status: WorkflowProcessItemStatus;
3341
- readonly phaseId?: string;
3342
- readonly parentId?: string;
3343
- readonly agentId?: string;
3344
- readonly childAgentId?: string;
3345
- readonly provider?: string;
3346
- readonly model?: string;
3347
- readonly startedAt?: string;
3348
- readonly endedAt?: string;
3349
- readonly summary?: string;
3350
- readonly summaryStatus?: WorkflowProcessSummaryStatus;
3351
- readonly error?: string;
3352
- /** FEATURE_246 resume telemetry — see {@link WorkflowProcessItemOrigin}. */
3353
- readonly origin?: WorkflowProcessItemOrigin;
3354
- }
3355
- interface WorkflowEventCorrelation {
3356
- readonly workflowRunId: string;
3357
- readonly childAgentId?: string;
3358
- readonly phaseId?: string;
3359
- readonly itemId?: string;
3360
- }
3361
- interface WorkflowProcessCounts {
3362
- readonly pending: number;
3363
- readonly running: number;
3364
- readonly completed: number;
3365
- readonly failed: number;
3366
- readonly cancelled: number;
3367
- readonly skipped: number;
3368
- }
3369
- interface WorkflowProcessProgress {
3370
- readonly spawnedAgents: number;
3371
- readonly finishedAgents: number;
3372
- readonly activeAgents: number;
3373
- readonly failedAgents: number;
3374
- readonly stoppedAgents: number;
3375
- readonly agentCap?: number;
3376
- readonly plannedItems?: number;
3377
- /** FEATURE_246 resume telemetry — count of agents that replayed from a prior
3378
- * run's cache (origin `replayed-from-cache`). Present only when > 0, so a
3379
- * fresh run's progress is unchanged. */
3380
- readonly replayedAgents?: number;
3381
- }
3382
- interface WorkflowProcessTokenUsage {
3383
- readonly spent: number;
3384
- readonly total?: number;
3385
- }
3386
- interface WorkflowProcessArtifact {
3387
- readonly name: string;
3388
- readonly path?: string;
3389
- readonly description?: string;
3390
- }
3391
- interface WorkflowProcessSnapshot {
3392
- readonly runId: string;
3393
- readonly workflowName: string;
3394
- readonly displayName?: string;
3395
- readonly status: WorkflowProcessStatus;
3396
- readonly startedAt: string;
3397
- readonly updatedAt: string;
3398
- readonly elapsedMs?: number;
3399
- readonly goal?: string;
3400
- readonly source?: WorkflowProcessSource;
3401
- readonly savedWorkflowName?: string;
3402
- readonly sourceRunId?: string;
3403
- readonly sourceWorkflowName?: string;
3404
- readonly revisionOf?: string;
3405
- /** FEATURE_246 resume telemetry — the prior run this run resumed from
3406
- * (content-addressed replay). Absent on a fresh (non-resumed) run. */
3407
- readonly resumedFromRunId?: string;
3408
- readonly hostMetadata?: Record<string, string>;
3409
- readonly activePhaseId?: string;
3410
- readonly activePhaseIndex?: number;
3411
- readonly phaseCount?: number;
3412
- readonly items: readonly WorkflowProcessItem[];
3413
- readonly counts: WorkflowProcessCounts;
3414
- readonly progress: WorkflowProcessProgress;
3415
- readonly tokens?: WorkflowProcessTokenUsage;
3416
- readonly latestMessage?: string;
3417
- readonly resultSummary?: string;
3418
- readonly error?: string;
3419
- readonly artifacts?: readonly WorkflowProcessArtifact[];
3420
- }
3421
- type WorkflowProcessEvent = {
3422
- readonly type: 'workflow_started';
3423
- readonly snapshot: WorkflowProcessSnapshot;
3424
- } | {
3425
- readonly type: 'workflow_updated';
3426
- readonly snapshot: WorkflowProcessSnapshot;
3427
- readonly message?: string;
3428
- } | {
3429
- readonly type: 'workflow_finished';
3430
- readonly snapshot: WorkflowProcessSnapshot;
3431
- };
3432
- interface WorkflowProcessTrackerOptions {
3433
- readonly runId: string;
3434
- readonly workflowName: string;
3435
- readonly displayName?: string;
3436
- readonly goal?: string;
3437
- readonly source?: WorkflowProcessSource;
3438
- readonly savedWorkflowName?: string;
3439
- readonly sourceRunId?: string;
3440
- readonly sourceWorkflowName?: string;
3441
- readonly revisionOf?: string;
3442
- /** FEATURE_246 resume telemetry — the prior run this run resumed from. */
3443
- readonly resumedFromRunId?: string;
3444
- readonly hostMetadata?: Record<string, string>;
3445
- readonly phases?: readonly string[];
3446
- readonly maxAgents?: number;
3447
- readonly plannedAgents?: number;
3448
- readonly tokenBudget?: number;
3449
- readonly resultSummary?: string;
3450
- readonly artifacts?: readonly WorkflowArtifactRef[];
3451
- readonly now?: () => string;
3452
- }
3453
- interface WorkflowTaskSummaryUpdate {
3454
- readonly summary?: string;
3455
- readonly summaryStatus: WorkflowProcessSummaryStatus;
3456
- }
3457
- interface WorkflowProcessTracker {
3458
- applyEvent(event: WorkflowEvent): WorkflowProcessEvent;
3459
- updateTaskSummary(taskId: string, update: WorkflowTaskSummaryUpdate): WorkflowProcessEvent | undefined;
3460
- setStatus(status: WorkflowProcessStatus, message?: string): WorkflowProcessEvent;
3461
- setResultSummary(resultSummary: string | undefined): WorkflowProcessEvent;
3462
- getSnapshot(): WorkflowProcessSnapshot;
3463
- }
3464
- declare function isFinalWorkflowProcessStatus(status: WorkflowProcessStatus): boolean;
3465
- declare function normalizeHostMetadata(value: unknown): Record<string, string> | undefined;
3466
- declare function createWorkflowProcessTracker(options: WorkflowProcessTrackerOptions): WorkflowProcessTracker;
3467
-
3468
- type DispatchableAgentOrigin = 'native' | 'constructed' | 'external';
3469
- type AgentExecutorProtocol = 'native' | 'a2a' | 'mcp' | 'http';
3470
- type ExternalAgentProtocol = Exclude<AgentExecutorProtocol, 'native'>;
3471
- type CapabilitySupport = 'supported' | 'unsupported' | 'conditional';
3472
- type AgentJsonValue = string | number | boolean | null | AgentJsonObject | readonly AgentJsonValue[];
3473
- interface AgentJsonObject {
3474
- readonly [key: string]: AgentJsonValue;
3475
- }
3476
- interface AgentCapabilityDeclaration {
3477
- readonly streaming: CapabilitySupport;
3478
- readonly durableTasks: CapabilitySupport;
3479
- readonly inputRequired: CapabilitySupport;
3480
- readonly cancellation: CapabilitySupport;
3481
- readonly artifacts: CapabilitySupport;
3482
- }
3483
- interface AgentEffectDeclaration {
3484
- readonly remote: 'none' | 'read' | 'write' | 'unknown';
3485
- readonly workspace: 'none' | 'proposal' | 'direct';
3486
- }
3487
- interface ExternalAgentEffectDeclaration extends AgentEffectDeclaration {
3488
- readonly workspace: 'none' | 'proposal';
3489
- }
3490
- interface DispatchableAgentDescriptor {
3491
- readonly agentId: string;
3492
- readonly displayName: string;
3493
- readonly description?: string;
3494
- readonly origin: DispatchableAgentOrigin;
3495
- readonly protocol: AgentExecutorProtocol;
3496
- readonly configurationRevision: string;
3497
- readonly skills: readonly string[];
3498
- readonly inputModalities: readonly string[];
3499
- readonly outputModalities: readonly string[];
3500
- readonly capabilities: AgentCapabilityDeclaration;
3501
- readonly effects: AgentEffectDeclaration;
3502
- }
3503
- type AgentDispatchabilityStatus = 'dispatchable' | 'degraded' | 'busy' | 'unavailable';
3504
- interface AgentDispatchabilitySnapshot {
3505
- readonly status: AgentDispatchabilityStatus;
3506
- readonly checkedAt: string;
3507
- readonly reasons: readonly string[];
3508
- readonly retryAfterMs?: number;
3509
- }
3510
- interface DispatchableAgentListing {
3511
- readonly descriptor: DispatchableAgentDescriptor;
3512
- readonly dispatchability: AgentDispatchabilitySnapshot;
3513
- }
3514
- interface AgentDispatchContext {
3515
- readonly actorId: string;
3516
- readonly projectId?: string;
3517
- readonly workflowId?: string;
3518
- readonly parentTaskId?: string;
3519
- readonly runId?: string;
3520
- readonly nodeId?: string;
3521
- readonly dataClassifications?: readonly string[];
3522
- readonly budget?: number;
3523
- }
3524
- interface AgentCapabilityRequirements {
3525
- readonly streaming?: boolean;
3526
- readonly durableTasks?: boolean;
3527
- readonly inputRequired?: boolean;
3528
- readonly cancellation?: boolean;
3529
- readonly artifacts?: boolean;
3530
- }
3531
- interface DispatchableAgentQuery extends AgentDispatchContext {
3532
- readonly requiredSkills?: readonly string[];
3533
- readonly requiredCapabilities?: AgentCapabilityRequirements;
3534
- readonly readOnly?: boolean;
3535
- }
3536
- interface ExternalAgentHealth {
3537
- readonly status: 'healthy' | 'degraded' | 'unhealthy';
3538
- readonly checkedAt: string;
3539
- readonly retryAfterMs?: number;
3540
- readonly diagnostic?: string;
3541
- }
3542
- interface ExternalAgentRegistration {
3543
- readonly agentId: string;
3544
- readonly displayName: string;
3545
- readonly description?: string;
3546
- readonly managementOwner?: string;
3547
- readonly enabled: boolean;
3548
- readonly executorId: string;
3549
- readonly protocol: ExternalAgentProtocol;
3550
- /**
3551
- * Stable content identity for this execution route. Producers must issue a
3552
- * new value whenever immutable execution content changes. The same immutable
3553
- * content may reuse its stable revision after removal or Runtime restart;
3554
- * different content must never reuse a revision.
3555
- */
3556
- readonly configurationRevision: string;
3557
- readonly endpointIdentityHash: string;
3558
- readonly credentialRef?: string;
3559
- /** Public, JSON-safe executor configuration. Secrets must remain references. */
3560
- readonly executorConfig?: AgentJsonObject;
3561
- readonly skills?: readonly string[];
3562
- readonly inputModalities?: readonly string[];
3563
- readonly outputModalities?: readonly string[];
3564
- readonly capabilities: AgentCapabilityDeclaration;
3565
- readonly effects: ExternalAgentEffectDeclaration;
3566
- readonly health?: ExternalAgentHealth;
3567
- readonly maxConcurrency?: number;
3568
- readonly minimumBudget?: number;
3569
- readonly allowedDataClassifications?: readonly string[];
3570
- }
3571
- interface ExternalAgentRegistrationSummary {
3572
- readonly agentId: string;
3573
- readonly displayName: string;
3574
- readonly description?: string;
3575
- readonly managementOwner?: string;
3576
- readonly enabled: boolean;
3577
- readonly executorId: string;
3578
- readonly protocol: ExternalAgentProtocol;
3579
- readonly configurationRevision: string;
3580
- readonly endpointIdentityHash: string;
3581
- readonly credentialConfigured: boolean;
3582
- readonly capabilities: AgentCapabilityDeclaration;
3583
- readonly effects: ExternalAgentEffectDeclaration;
3584
- readonly health?: ExternalAgentHealth;
3585
- readonly diagnostics: readonly string[];
3586
- }
3587
- interface AgentDispatchPolicyInput {
3588
- readonly registration: ExternalAgentRegistration;
3589
- readonly query: DispatchableAgentQuery;
3590
- }
3591
- interface AgentDispatchPolicyDecision {
3592
- readonly allowed: boolean;
3593
- readonly reasons?: readonly string[];
3594
- }
3595
- type AgentDispatchPolicy = (input: AgentDispatchPolicyInput) => AgentDispatchPolicyDecision | Promise<AgentDispatchPolicyDecision>;
3596
- interface AgentCredentialBroker {
3597
- isAvailable?(credentialRef: string): boolean | Promise<boolean>;
3598
- withCredential<T>(credentialRef: string, use: (credential: string) => Promise<T>): Promise<T>;
3599
- }
3600
- interface AgentArtifactReference {
3601
- readonly name: string;
3602
- readonly mimeType?: string;
3603
- readonly size?: number;
3604
- readonly hash?: string;
3605
- readonly uri?: string;
3606
- readonly provenance?: string;
3607
- readonly producingAgentId?: string;
3608
- readonly remoteTaskId?: string;
3609
- }
3610
- interface AgentArtifactPolicyInput {
3611
- readonly registration: ExternalAgentRegistration;
3612
- readonly artifact: AgentArtifactReference;
3613
- }
3614
- interface AgentArtifactPolicyDecision {
3615
- readonly allowed: boolean;
3616
- readonly reason?: string;
3617
- }
3618
- type AgentArtifactPolicy = (input: AgentArtifactPolicyInput) => AgentArtifactPolicyDecision | Promise<AgentArtifactPolicyDecision>;
3619
- interface AgentTaskUsage {
3620
- readonly inputTokens?: number;
3621
- readonly outputTokens?: number;
3622
- readonly totalTokens?: number;
3623
- readonly cost?: number;
3624
- readonly currency?: string;
3625
- }
3626
- type AgentTaskState = 'submitted' | 'working' | 'input-required' | 'auth-required' | 'completed' | 'failed' | 'canceled' | 'rejected' | 'unknown';
3627
- type AgentTaskCancellation = 'none' | 'requested' | 'confirmed' | 'unsupported' | 'failed' | 'unknown';
3628
- interface AgentTaskProgress {
3629
- readonly message?: string;
3630
- readonly percent?: number;
3631
- }
3632
- interface AgentTaskCorrelation {
3633
- readonly parentTaskId?: string;
3634
- readonly workflowId?: string;
3635
- readonly runId?: string;
3636
- readonly nodeId?: string;
3637
- }
3638
- interface AgentTaskRegistrationSnapshot {
3639
- readonly agentId: string;
3640
- readonly origin: DispatchableAgentOrigin;
3641
- readonly executorId: string;
3642
- readonly protocol: AgentExecutorProtocol;
3643
- readonly configurationRevision: string;
3644
- readonly endpointIdentityHash?: string;
3645
- readonly capabilities: AgentCapabilityDeclaration;
3646
- readonly effects: AgentEffectDeclaration;
3647
- }
3648
- interface AgentExecutorTaskReference {
3649
- readonly idempotencyKey: string;
3650
- readonly remoteTaskId?: string;
3651
- readonly metadata?: AgentJsonObject;
3652
- }
3653
- interface AgentTaskSnapshot extends AgentTaskCorrelation {
3654
- readonly taskId: string;
3655
- readonly route: 'local' | 'external';
3656
- readonly agentId: string;
3657
- readonly objective: string;
3658
- readonly state: AgentTaskState;
3659
- readonly cancellation: AgentTaskCancellation;
3660
- readonly registration: AgentTaskRegistrationSnapshot;
3661
- readonly idempotencyKey: string;
3662
- readonly dispatchAttempt: number;
3663
- readonly createdAt: string;
3664
- readonly updatedAt: string;
3665
- readonly remoteTaskId?: string;
3666
- readonly executorReference?: AgentExecutorTaskReference;
3667
- readonly progress?: AgentTaskProgress;
3668
- readonly output?: string;
3669
- readonly error?: string;
3670
- readonly cancellationError?: string;
3671
- readonly artifacts?: readonly AgentArtifactReference[];
3672
- readonly usage?: AgentTaskUsage;
3673
- }
3674
- interface AgentExecutorTaskSnapshot {
3675
- readonly state: AgentTaskState;
3676
- readonly progress?: AgentTaskProgress;
3677
- readonly output?: string;
3678
- readonly error?: string;
3679
- readonly artifacts?: readonly AgentArtifactReference[];
3680
- readonly usage?: AgentTaskUsage;
3681
- }
3682
- interface AgentTaskStartInput {
3683
- readonly taskId?: string;
3684
- readonly agentId: string;
3685
- readonly objective: string;
3686
- readonly context: AgentDispatchContext;
3687
- readonly readOnly?: boolean;
3688
- readonly requiredSkills?: readonly string[];
3689
- readonly requiredCapabilities?: AgentCapabilityRequirements;
3690
- readonly expectedConfigurationRevision?: string;
3691
- readonly idempotencyKey?: string;
3692
- readonly input?: string;
3693
- }
3694
- interface AgentContinuationInput {
3695
- readonly content: string;
3696
- }
3697
- interface AgentExecutorEvent {
3698
- readonly state?: AgentTaskState;
3699
- readonly progress?: AgentTaskProgress;
3700
- readonly output?: string;
3701
- readonly error?: string;
3702
- readonly artifacts?: readonly AgentArtifactReference[];
3703
- readonly usage?: AgentTaskUsage;
3704
- }
3705
- interface AgentTaskEvent extends AgentExecutorEvent {
3706
- readonly taskId: string;
3707
- readonly seq: number;
3708
- readonly timestamp: string;
3709
- readonly type: 'submitted' | 'state' | 'progress' | 'output' | 'artifact' | 'usage' | 'error' | 'cancellation';
3710
- readonly cancellation?: AgentTaskCancellation;
3711
- }
3712
- interface AgentExecutorPreflightResult {
3713
- readonly ok: boolean;
3714
- readonly reasons?: readonly string[];
3715
- }
3716
- interface AgentExecutor {
3717
- preflight?(input: AgentTaskStartInput): Promise<AgentExecutorPreflightResult>;
3718
- start(input: AgentTaskStartInput, signal?: AbortSignal): Promise<AgentExecutorTaskReference>;
3719
- events(reference: AgentExecutorTaskReference): AsyncIterable<AgentExecutorEvent>;
3720
- get(reference: AgentExecutorTaskReference): Promise<AgentExecutorTaskSnapshot>;
3721
- sendInput(reference: AgentExecutorTaskReference, input: AgentContinuationInput): Promise<void>;
3722
- cancel(reference: AgentExecutorTaskReference, reason?: string): Promise<AgentExecutorTaskSnapshot>;
3723
- reconcile(reference: AgentExecutorTaskReference): Promise<AgentExecutorTaskSnapshot>;
3724
- dispose(): Promise<void>;
3725
- }
3726
- interface AgentExecutorFactoryContext {
3727
- withCredential<T>(credentialRef: string, use: (credential: string) => Promise<T>): Promise<T>;
3728
- authorizeArtifact(artifact: AgentArtifactReference): Promise<void>;
3729
- }
3730
- interface AgentExecutorFactory {
3731
- readonly executorId: string;
3732
- readonly protocol: ExternalAgentProtocol;
3733
- create(registration: ExternalAgentRegistration, context: AgentExecutorFactoryContext): Promise<AgentExecutor>;
3734
- }
3735
- interface AgentPreflightInput {
3736
- readonly agentId: string;
3737
- readonly query: DispatchableAgentQuery;
3738
- readonly expectedConfigurationRevision?: string;
3739
- }
3740
- interface AgentPreflightResult {
3741
- readonly ok: boolean;
3742
- readonly descriptor?: DispatchableAgentDescriptor;
3743
- readonly dispatchability: AgentDispatchabilitySnapshot;
3744
- readonly reasons: readonly string[];
3745
- }
3746
- interface AgentTaskFilter {
3747
- readonly agentId?: string;
3748
- readonly parentTaskId?: string;
3749
- readonly workflowId?: string;
3750
- readonly runId?: string;
3751
- readonly state?: AgentTaskState | readonly AgentTaskState[];
3752
- }
3753
- interface LocalAgentTaskInput extends AgentTaskCorrelation {
3754
- readonly taskId: string;
3755
- readonly agentId: string;
3756
- readonly objective: string;
3757
- readonly configurationRevision: string;
3758
- readonly origin?: 'native' | 'constructed';
3759
- }
3760
- interface LocalAgentTaskUpdate {
3761
- readonly state?: AgentTaskState;
3762
- readonly progress?: AgentTaskProgress;
3763
- readonly output?: string;
3764
- readonly error?: string;
3765
- readonly artifacts?: readonly AgentArtifactReference[];
3766
- readonly usage?: AgentTaskUsage;
3767
- }
3768
- interface AgentExecutorPlaneStore {
3769
- loadRegistrations(): Promise<readonly ExternalAgentRegistration[]>;
3770
- saveRegistrations(registrations: readonly ExternalAgentRegistration[]): Promise<void>;
3771
- /**
3772
- * Optional compatibility extension for durable executor recovery across a
3773
- * registration update/removal. Built-in stores implement both hooks. A
3774
- * custom store that omits them can only recover through a still-current
3775
- * registration with the same revision; otherwise recovery fails closed.
3776
- * Implement both hooks or neither. The plane is the single writer and
3777
- * serializes whole-map replacements. Credential fields in snapshots are
3778
- * references only; `executorConfig` must likewise contain public data or secret
3779
- * references, never secret material. A store must never resolve or persist a
3780
- * referenced secret value.
3781
- */
3782
- loadTaskRegistrationSnapshots?(): Promise<readonly ExternalAgentRegistration[]>;
3783
- saveTaskRegistrationSnapshots?(registrations: readonly ExternalAgentRegistration[]): Promise<void>;
3784
- loadTasks(): Promise<readonly AgentTaskSnapshot[]>;
3785
- saveTask(task: AgentTaskSnapshot): Promise<void>;
3786
- loadEvents(taskId: string): Promise<readonly AgentTaskEvent[]>;
3787
- appendEvent(event: AgentTaskEvent): Promise<void>;
3788
- }
3789
- interface AgentRegistrationMutationOptions {
3790
- /** `null` means that no registration may exist; `undefined` disables CAS. */
3791
- readonly expectedConfigurationRevision?: string | null;
3792
- /** `null` means that no manager may own the registration; `undefined` disables owner CAS. */
3793
- readonly expectedManagementOwner?: string | null;
3794
- }
3795
- interface AgentRegistrationEnabledMutationOptions extends AgentRegistrationMutationOptions {
3796
- /** Atomically claims an unowned registration; a different existing owner is rejected. */
3797
- readonly claimOwner?: string;
3798
- }
3799
- interface AgentRegistrationService {
3800
- list(): Promise<readonly ExternalAgentRegistrationSummary[]>;
3801
- upsert(input: ExternalAgentRegistration, options?: AgentRegistrationMutationOptions): Promise<ExternalAgentRegistrationSummary>;
3802
- setEnabled(agentId: string, enabled: boolean, options?: AgentRegistrationEnabledMutationOptions): Promise<ExternalAgentRegistrationSummary | undefined>;
3803
- remove(agentId: string, options?: AgentRegistrationMutationOptions): Promise<boolean>;
3804
- }
3805
- interface AgentTaskService {
3806
- start(input: AgentTaskStartInput, signal?: AbortSignal): Promise<AgentTaskSnapshot>;
3807
- list(filter?: AgentTaskFilter): Promise<readonly AgentTaskSnapshot[]>;
3808
- get(taskId: string): Promise<AgentTaskSnapshot>;
3809
- events(taskId: string, cursor?: number): Promise<readonly AgentTaskEvent[]>;
3810
- wait(taskId: string, timeoutMs?: number): Promise<AgentTaskSnapshot>;
3811
- sendInput(taskId: string, input: AgentContinuationInput): Promise<AgentTaskSnapshot>;
3812
- cancel(taskId: string, reason?: string): Promise<AgentTaskSnapshot>;
3813
- reconcile(taskId: string): Promise<AgentTaskSnapshot>;
3814
- recordLocal(input: LocalAgentTaskInput): Promise<AgentTaskSnapshot>;
3815
- updateLocal(taskId: string, update: LocalAgentTaskUpdate): Promise<AgentTaskSnapshot>;
3816
- }
3817
- interface AgentExecutorPlaneBinding {
3818
- readonly plane: AgentExecutorPlane;
3819
- readonly context: AgentDispatchContext;
3820
- }
3821
- interface AgentExecutorPlane {
3822
- readonly registrations: AgentRegistrationService;
3823
- readonly tasks: AgentTaskService;
3824
- listDispatchable(query: DispatchableAgentQuery, localAgents?: readonly DispatchableAgentDescriptor[]): Promise<readonly DispatchableAgentListing[]>;
3825
- describe(agentId: string, query: DispatchableAgentQuery, localAgents?: readonly DispatchableAgentDescriptor[]): Promise<DispatchableAgentListing | undefined>;
3826
- preflight(input: AgentPreflightInput, localAgents?: readonly DispatchableAgentDescriptor[]): Promise<AgentPreflightResult>;
3827
- close(): Promise<void>;
3828
- }
3829
- interface AgentExecutorPlaneBackgroundErrorContext {
3830
- readonly operation: 'event-pump-recovery' | 'task-admission-event' | 'executor-dispose';
3831
- readonly taskId?: string;
3832
- readonly agentId?: string;
3833
- readonly configurationRevision?: string;
3834
- }
3835
- type AgentExecutorPlaneBackgroundErrorHandler = (error: Error, context: AgentExecutorPlaneBackgroundErrorContext) => void | Promise<void>;
3836
- interface CreateAgentExecutorPlaneOptions {
3837
- readonly factories: readonly AgentExecutorFactory[];
3838
- readonly policy: AgentDispatchPolicy;
3839
- readonly credentialBroker?: AgentCredentialBroker;
3840
- readonly artifactPolicy?: AgentArtifactPolicy;
3841
- /** Receives failures from detached event handling and best-effort resource cleanup. */
3842
- readonly onBackgroundError?: AgentExecutorPlaneBackgroundErrorHandler;
3843
- readonly store?: AgentExecutorPlaneStore;
3844
- readonly now?: () => Date;
3845
- readonly createTaskId?: () => string;
3846
- readonly createIdempotencyKey?: () => string;
3847
- /** Overall bound for draining admitted work and disposing executors during close. */
3848
- readonly closeTimeoutMs?: number;
3849
- }
3850
-
3851
2611
  interface AgentControllerOptions {
3852
2612
  readonly maxConcurrentThreadsPerSession?: number;
3853
2613
  readonly rootCapabilities?: AgentCapabilities;
@@ -4034,5 +2794,5 @@ declare class AgentActorController {
4034
2794
  }
4035
2795
  declare function createAgentActorController(options?: AgentControllerOptions): Promise<AgentActorController>;
4036
2796
 
4037
- export { ASK_USER_BACK_SIGNAL as A, ASK_USER_CUSTOM_INPUT_SIGNAL as a, GuardrailBlockedError as aL, GuardrailEscalateError as aN, InvariantSession as aY, DEFAULT_SYSTEM_CAP as ar, LearnedAreaStore as b5, MAX_TOOL_LOOP_ITERATIONS as bJ, LearningCapabilityError as bs, Runner as c5, RunnerIterationLimitError as c7, Tracer as cL, WorkflowEventRecorder as c_, SpanImpl as cr, createAgentActorController as d$, _resetAdmittedAgentBindings as dJ, _resetPresetDispatchers as dK, admitAndRecordLearnedSkillInvocation as dL, admitLearnedSkillBinding as dM, asSingleSelection as dN, assertLearnedCapabilityTransition as dO, attachRunnerRecoveryTranscript as dP, buildAssistantMessageFromLlmResult as dQ, buildSystemPrompt as dR, buildToolResultMessage as dS, canTransitionLearnedCapability as dT, cleanupManagedRunChildProcess as dU, cleanupRegisteredManagedChildren as dV, collectGuardrails as dW, commitLearnedSkillRevision as dX, completeLearnedSkillOutcome as dY, completeLearnedSkillSessionOutcomes as dZ, createAgent as d_, createHandoff as e0, createInMemorySession as e1, createInvariantSessionForAgent as e2, createLearnedCapabilityScope as e3, createLearnedSkillRecord as e4, createStateWriter as e5, createTrace as e6, createWorkflowProcessTracker as e7, defaultTracer as e8, detectInstructionsInjection as e9, releaseLearnedSkillBinding as eA, renderDeclarativeSkill as eB, resolveLearnedAreaPaths as eC, resolveProjectLearnedAreaRoot as eD, runAdmissionAudit as eE, runInputGuardrails as eF, runOutputGuardrails as eG, runToolAfterGuardrails as eH, runToolBeforeGuardrails as eI, sanitizeUnifiedLearningReviewInput as eJ, setActiveUserInteraction as eK, setAdmittedAgentBindings as eL, slugifyLearnedCapabilityName as eM, stageLearnedSkillRevision as eN, validateDeclarativeSkillSpec as eO, discoverInstances as ea, eventFromCapability as eb, exactInvokedSkillSnapshotForSession as ec, executeRunnerToolCall as ed, extractAssistantTextFromMessage as ee, getActiveUserInteraction as ef, getAdmittedAgentBindings as eg, invokeLearnedSkillCanary as eh, isAskUserCustomInputAnswer as ei, isFinalWorkflowProcessStatus as ej, isLearnedCapabilityRecordV2 as ek, isRunnableTool as el, isRunnerIterationLimitError as em, isRunnerLlmResult as en, isUnifiedLearningReviewModelInput as eo, learningEventIdFor as ep, learningEventKindForLifecycle as eq, listLearnedSkillUsageReceipts as er, normalizeHostMetadata as es, normalizeUnifiedLearningReview as et, quarantineLearnedSkillRevision as eu, readRunnerRecoveryTranscript as ev, reconcileLearnedSkillBindingOutcomes as ew, recordLearnedSkillOffered as ex, registerManagedChildProcess as ey, registerPresetDispatcher as ez, AgentActorController as g };
4038
- export type { AgentTaskFilter as $, AgentExecutorFactory as B, AgentExecutorFactoryContext as C, AgentExecutorPlane as D, AgentExecutorPlaneBackgroundErrorContext as E, AgentExecutorPlaneBackgroundErrorHandler as F, AgentExecutorPlaneBinding as G, AgentExecutorPlaneStore as H, AgentExecutorPreflightResult as I, AgentExecutorProtocol as J, AgentExecutorTaskReference as K, AgentExecutorTaskSnapshot as L, AgentJsonObject as M, AgentJsonValue as N, AgentManifest as O, AgentMessage as P, AgentMiddlewareDeclaration as Q, AgentPreflightInput as R, AgentPreflightResult as S, AgentReasoningProfile as T, AgentRegistrationEnabledMutationOptions as U, AgentRegistrationMutationOptions as V, AgentRegistrationService as W, AgentSpanData as X, AgentTaskCancellation as Y, AgentTaskCorrelation as Z, AgentTaskEvent as _, KodaXImageMediaType as a$, AgentTaskProgress as a0, AgentTaskRegistrationSnapshot as a1, AgentTaskService as a2, AgentTaskSnapshot as a3, AgentTaskStartInput as a4, AgentTaskState as a5, AgentTaskUsage as a6, AgentTool as a7, AskUserAnswer as a8, AskUserCustomInputAnswer as a9, EvidenceSpanData as aA, ExactInvokedSkillSnapshot as aB, ExternalAgentEffectDeclaration as aC, ExternalAgentHealth as aD, ExternalAgentProtocol as aE, ExternalAgentRegistration as aF, ExternalAgentRegistrationSummary as aG, FanoutSpanData as aH, FileOperations as aI, GenerationSpanData as aJ, Guardrail as aK, GuardrailContext as aM, GuardrailPermissionIntent as aO, GuardrailSpanData as aP, GuardrailVerdict as aQ, Handoff as aR, HandoffSpanData as aS, InMemorySessionOptions as aT, InputGuardrail as aU, InstanceDiscoveryFs as aV, InvariantId as aW, InvariantResult as aX, KodaXFileInputArtifact as aZ, KodaXImageInputArtifact as a_, AskUserMultiOptions as aa, AskUserQuestionItem as ab, AskUserQuestionOptions as ac, AskUserSelectionAnswer as ad, CapabilitySupport as ae, CommitLearnedSkillRevisionInput as af, CompactionAnchor as ag, CompactionConfig as ah, CompactionDetails as ai, CompactionReport as aj, CompactionRequestMetrics as ak, CompactionResult as al, CompactionSpanData as am, CompactionUpdate as an, CreateAgentExecutorPlaneOptions as ao, CreateLearnedSkillRecordInput as ap, CurrentTodoSummary as aq, DeclarativeSkillSpec as as, Deliverable as at, DiscoveredInstance as au, DiscoveryOptions as av, DispatchableAgentDescriptor as aw, DispatchableAgentListing as ax, DispatchableAgentOrigin as ay, DispatchableAgentQuery as az, AdmissionAuditOptions as b, ReasoningDepth as b$, KodaXInputArtifact as b0, KodaXInputArtifactSource as b1, KodaXVideoInputArtifact as b2, KodaXVideoMediaType as b3, LearnedAreaPaths as b4, LearnedCapabilityArtifact as b6, LearnedCapabilityCanary as b7, LearnedCapabilityCanaryBinding as b8, LearnedCapabilityCanaryInvocation as b9, LearningPage as bA, LearningQuery as bB, LearningReviewEvidencePacket as bC, LearningReviewQualification as bD, LearningReviewVerifierFact as bE, LearningSubscribeOptions as bF, LearningSurfaceSnapshot as bG, LocalAgentTaskInput as bH, LocalAgentTaskUpdate as bI, ManagedChildCleanupSummary as bK, ManagedChildProcessMetadata as bL, ManagedChildRegistrationOptions as bM, ManagedRunChildCleanupResult as bN, ManagedRunChildProcessReference as bO, ManifestPatch as bP, MemoryDecisionTraceReceipt as bQ, MessageEntry as bR, NormalizedLearnedSkillDecision as bS, ObserveCtx as bT, OutputGuardrail as bU, PersistedSessionState as bV, PresetDispatcher as bW, PresetTracingContext as bX, QualityInvariant as bY, ReadonlyMutationTracker as bZ, ReadonlyRecorder as b_, LearnedCapabilityCarrier as ba, LearnedCapabilityLifecycle as bb, LearnedCapabilityProvenance as bc, LearnedCapabilityRecord as bd, LearnedCapabilityRecordV1 as be, LearnedCapabilityRecordV2 as bf, LearnedCapabilityScope as bg, LearnedCapabilitySource as bh, LearnedSkillBindingAdmission as bi, LearnedSkillCanaryOutcome as bj, LearnedSkillDecisionDisposition as bk, LearnedSkillInvocationAdmission as bl, LearnedSkillInvokedReceipt as bm, LearnedSkillOfferedReceipt as bn, LearnedSkillOutcomeReceipt as bo, LearnedSkillUsageReceipt as bp, LearningAction as bq, LearningActionDriver as br, LearningCapabilityErrorCode as bt, LearningClientEventState as bu, LearningClientRecord as bv, LearningEvent as bw, LearningEventKind as bx, LearningExplicitUserAuthority as by, LearningNotificationState as bz, AdmissionCtx as c, WorkflowEventType as c$, RecentlyModifiedFile as c0, RunEvent as c1, RunOptions as c2, RunResult as c3, RunnableTool as c4, RunnerEvent as c6, RunnerLlmResult as c8, RunnerLlmReturn as c9, StopHookResult as cA, StopHookSpanData as cB, SystemCap as cC, TerminalCtx as cD, ToolBeforeOutcome as cE, ToolCallSpanData as cF, ToolCapability as cG, ToolGuardrail as cH, ToolPermission as cI, Trace as cJ, TraceOptions as cK, TracerOptions as cM, UnifiedLearningReviewModelInput as cN, UnifiedLearningReviewResult as cO, UnifiedLearningReviewRunner as cP, UserInteraction as cQ, UserInteractionPromptContext as cR, WorkflowAgentBackend as cS, WorkflowApi as cT, WorkflowApproval as cU, WorkflowApprovalSummary as cV, WorkflowArtifactRef as cW, WorkflowBudget as cX, WorkflowEvent as cY, WorkflowEventCorrelation as cZ, RunnerRecoveryTranscriptCarrier as ca, RunnerToolCall as cb, RunnerToolContext as cc, RunnerToolObserver as cd, RunnerToolResult as ce, RunnerToolResultBatch as cf, RunnerToolResultBatchTransform as cg, Session as ch, SessionDispatchResult as ci, SessionEntry as cj, SessionExtension as ck, SessionForkOptions as cl, SessionMeta as cm, SessionStateSnapshot as cn, Span as co, SpanData as cp, SpanError as cq, SpanImplOptions as cs, StagedLearnedSkillArtifact as ct, StartTraceOptions as cu, StateWriter as cv, StateWriterFs as cw, StateWriterOptions as cx, StopHookContext as cy, StopHookFn as cz, AdmissionVerdict as d, WorkflowIsolation as d0, WorkflowLimits as d1, WorkflowLogEvent as d2, WorkflowMeta as d3, WorkflowModelHint as d4, WorkflowModule as d5, WorkflowOutcome as d6, WorkflowOutcomeError as d7, WorkflowOutcomeResult as d8, WorkflowOutcomeStatus as d9, WorkflowTaskSnapshot as dA, WorkflowTaskStatus as dB, WorkflowTaskSummaryEventUpdate as dC, WorkflowTaskSummaryKind as dD, WorkflowTaskSummaryUpdate as dE, WorkflowTaskUsage as dF, WorkflowTaskVerification as dG, WorkflowTaskVerificationResult as dH, WorkflowWaitOptions as dI, WorkflowOutcomeUsage as da, WorkflowParallelOptions as db, WorkflowProcessArtifact as dc, WorkflowProcessCounts as dd, WorkflowProcessEvent as de, WorkflowProcessItem as df, WorkflowProcessItemKind as dg, WorkflowProcessItemOrigin as dh, WorkflowProcessItemStatus as di, WorkflowProcessProgress as dj, WorkflowProcessSnapshot as dk, WorkflowProcessSource as dl, WorkflowProcessStatus as dm, WorkflowProcessSummaryStatus as dn, WorkflowProcessTokenUsage as dp, WorkflowProcessTracker as dq, WorkflowProcessTrackerOptions as dr, WorkflowRun as ds, WorkflowRunState as dt, WorkflowRunStatus as du, WorkflowSpawnAgentInput as dv, WorkflowSynthesis as dw, WorkflowSynthesizeInput as dx, WorkflowTaskHandle as dy, WorkflowTaskResult as dz, AdmittedHandle as e, Agent as f, AgentArtifactPolicy as h, AgentArtifactPolicyDecision as i, AgentArtifactPolicyInput as j, AgentArtifactReference as k, AgentCapabilityDeclaration as l, AgentCapabilityRequirements as m, AgentContinuationInput as n, AgentControllerHealth as o, AgentControllerOptions as p, AgentCredentialBroker as q, AgentDispatchContext as r, AgentDispatchPolicy as s, AgentDispatchPolicyDecision as t, AgentDispatchPolicyInput as u, AgentDispatchabilitySnapshot as v, AgentDispatchabilityStatus as w, AgentEffectDeclaration as x, AgentExecutor as y, AgentExecutorEvent as z };
2797
+ export { GuardrailEscalateError as B, DEFAULT_SYSTEM_CAP as D, InvariantSession as R, LearnedAreaStore as T, MAX_TOOL_LOOP_ITERATIONS as a3, SpanImpl as aT, Runner as ax, RunnerIterationLimitError as az, resolveLearnedAreaPaths as b$, createLearnedSkillRecord as bA, createStateWriter as bB, createTrace as bC, defaultTracer as bD, detectInstructionsInjection as bE, discoverInstances as bF, eventFromCapability as bG, exactInvokedSkillSnapshotForSession as bH, executeRunnerToolCall as bI, extractAssistantTextFromMessage as bJ, getAdmittedAgentBindings as bK, invokeLearnedSkillCanary as bL, isLearnedCapabilityRecordV2 as bM, isRunnableTool as bN, isRunnerIterationLimitError as bO, isRunnerLlmResult as bP, isUnifiedLearningReviewModelInput as bQ, listLearnedSkillUsageReceipts as bR, normalizeUnifiedLearningReview as bS, quarantineLearnedSkillRevision as bT, readRunnerRecoveryTranscript as bU, reconcileLearnedSkillBindingOutcomes as bV, recordLearnedSkillOffered as bW, registerManagedChildProcess as bX, registerPresetDispatcher as bY, releaseLearnedSkillBinding as bZ, renderDeclarativeSkill as b_, Tracer as bb, _resetAdmittedAgentBindings as bg, _resetPresetDispatchers as bh, admitAndRecordLearnedSkillInvocation as bi, admitLearnedSkillBinding as bj, attachRunnerRecoveryTranscript as bk, buildAssistantMessageFromLlmResult as bl, buildSystemPrompt as bm, buildToolResultMessage as bn, cleanupManagedRunChildProcess as bo, cleanupRegisteredManagedChildren as bp, collectGuardrails as bq, commitLearnedSkillRevision as br, completeLearnedSkillOutcome as bs, completeLearnedSkillSessionOutcomes as bt, createAgent as bu, createAgentActorController as bv, createHandoff as bw, createInMemorySession as bx, createInvariantSessionForAgent as by, createLearnedCapabilityScope as bz, resolveProjectLearnedAreaRoot as c0, runAdmissionAudit as c1, runInputGuardrails as c2, runOutputGuardrails as c3, runToolAfterGuardrails as c4, runToolBeforeGuardrails as c5, sanitizeUnifiedLearningReviewInput as c6, setAdmittedAgentBindings as c7, stageLearnedSkillRevision as c8, validateDeclarativeSkillSpec as c9, AgentActorController as e, GuardrailBlockedError as y };
2798
+ export type { LearnedSkillUsageReceipt as $, AdmissionAuditOptions as A, CommitLearnedSkillRevisionInput as C, EnqueueInput as E, FanoutSpanData as F, GenerationSpanData as G, GuardrailPermissionIntent as H, GuardrailSpanData as I, GuardrailVerdict as J, Handoff as K, HandoffSpanData as L, InMemorySessionOptions as M, InputGuardrail as N, InstanceDiscoveryFs as O, InvariantId as P, InvariantResult as Q, LearnedAreaPaths as S, LearnedSkillBindingAdmission as U, LearnedSkillCanaryOutcome as V, LearnedSkillDecisionDisposition as W, LearnedSkillInvocationAdmission as X, LearnedSkillInvokedReceipt as Y, LearnedSkillOfferedReceipt as Z, LearnedSkillOutcomeReceipt as _, AdmissionCtx as a, StopHookFn as a$, LearningReviewEvidencePacket as a0, LearningReviewQualification as a1, LearningReviewVerifierFact as a2, ManagedChildCleanupSummary as a4, ManagedChildProcessMetadata as a5, ManagedChildRegistrationOptions as a6, ManagedRunChildCleanupResult as a7, ManagedRunChildProcessReference as a8, ManifestPatch as a9, RunnerLlmResult as aA, RunnerLlmReturn as aB, RunnerRecoveryTranscriptCarrier as aC, RunnerToolCall as aD, RunnerToolContext as aE, RunnerToolObserver as aF, RunnerToolResult as aG, RunnerToolResultBatch as aH, RunnerToolResultBatchTransform as aI, Session as aJ, SessionDispatchResult as aK, SessionEntry as aL, SessionExtension as aM, SessionForkOptions as aN, SessionMeta as aO, SessionStateSnapshot as aP, Span as aQ, SpanData as aR, SpanError as aS, SpanImplOptions as aU, StagedLearnedSkillArtifact as aV, StartTraceOptions as aW, StateWriter as aX, StateWriterFs as aY, StateWriterOptions as aZ, StopHookContext as a_, MemoryDecisionTraceReceipt as aa, MessageDelivery as ab, MessageEntry as ac, MessageMode as ad, MessagePriority as ae, NormalizedLearnedSkillDecision as af, ObserveCtx as ag, OutputGuardrail as ah, PersistedSessionState as ai, PresetDispatcher as aj, PresetTracingContext as ak, QualityInvariant as al, QueueEventListener as am, QueuedInputArtifact as an, QueuedMessage as ao, ReadonlyMutationTracker as ap, ReadonlyRecorder as aq, ReasoningDepth as ar, RecentlyModifiedFile as as, RunEvent as at, RunOptions as au, RunResult as av, RunnableTool as aw, RunnerEvent as ay, AdmissionVerdict as b, StopHookResult as b0, StopHookSpanData as b1, SystemCap as b2, TerminalCtx as b3, ToolBeforeOutcome as b4, ToolCallSpanData as b5, ToolCapability as b6, ToolGuardrail as b7, ToolPermission as b8, Trace as b9, TraceOptions as ba, TracerOptions as bc, UnifiedLearningReviewModelInput as bd, UnifiedLearningReviewResult as be, UnifiedLearningReviewRunner as bf, AdmittedHandle as c, Agent as d, AgentControllerHealth as f, AgentControllerOptions as g, AgentManifest as h, AgentMessage as i, AgentMiddlewareDeclaration as j, AgentReasoningProfile as k, AgentSpanData as l, AgentTool as m, CompactionSpanData as n, CreateLearnedSkillRecordInput as o, CurrentTodoSummary as p, DeclarativeSkillSpec as q, Deliverable as r, DequeueFilter as s, DiscoveredInstance as t, DiscoveryOptions as u, EvidenceSpanData as v, ExactInvokedSkillSnapshot as w, Guardrail as x, GuardrailContext as z };