@kodax-ai/kodax 0.7.48 → 0.7.50

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 (50) hide show
  1. package/CHANGELOG.md +1773 -1720
  2. package/README.md +91 -35
  3. package/README_CN.md +70 -23
  4. package/dist/builtin/code-review/SKILL.md +1 -1
  5. package/dist/chunks/argument-completer-3WX5B42G.js +2 -0
  6. package/dist/chunks/chunk-5UJQ2GKJ.js +574 -0
  7. package/dist/chunks/chunk-HR64F32V.js +2 -0
  8. package/dist/chunks/chunk-MFOMFMSK.js +1056 -0
  9. package/dist/chunks/{chunk-DEODZG6Q.js → chunk-SK4HOYT2.js} +1 -1
  10. package/dist/chunks/chunk-UB5IAZHF.js +476 -0
  11. package/dist/chunks/chunk-XZY4CIDV.js +31 -0
  12. package/dist/chunks/chunk-YJLRBIEW.js +301 -0
  13. package/dist/chunks/{compaction-config-YWCHOP2U.js → compaction-config-DDJSQ4OT.js} +1 -1
  14. package/dist/chunks/{construction-bootstrap-AIWATBWW.js → construction-bootstrap-4QNM2BVM.js} +1 -1
  15. package/dist/chunks/{dist-IDNOAB4M.js → dist-OJSNNI7P.js} +1 -1
  16. package/dist/chunks/dist-T256OSDI.js +2 -0
  17. package/dist/chunks/{utils-OG57XTPC.js → utils-JHIEOX6Z.js} +1 -1
  18. package/dist/index.d.ts +11 -11
  19. package/dist/index.js +2 -2
  20. package/dist/kodax_cli.js +1406 -892
  21. package/dist/provider-capabilities.json +193 -190
  22. package/dist/sdk-agent.d.ts +213 -103
  23. package/dist/sdk-agent.js +1 -1
  24. package/dist/sdk-coding.d.ts +644 -33
  25. package/dist/sdk-coding.js +1 -1
  26. package/dist/sdk-llm.d.ts +5 -5
  27. package/dist/sdk-llm.js +1 -1
  28. package/dist/sdk-mcp.js +1 -1
  29. package/dist/sdk-repl.d.ts +36 -13
  30. package/dist/sdk-repl.js +2 -2
  31. package/dist/sdk-session.d.ts +32 -5
  32. package/dist/sdk-session.js +1 -1
  33. package/dist/sdk-skills.js +1 -1
  34. package/dist/types-chunks/{base.d-BdJKSPO2.d.ts → base.d-C4jYVjJh.d.ts} +2 -1
  35. package/dist/types-chunks/{bash-prefix-extractor.d-DNO2-ycp.d.ts → bash-prefix-extractor.d-B0CIb0N3.d.ts} +137 -23
  36. package/dist/types-chunks/{file-tracker.d-D7L_SbRm.d.ts → capsule.d-CwBEm6M-.d.ts} +173 -5
  37. package/dist/types-chunks/{types.d-BCnbYG_A.d.ts → process.d-BbiXD24v.d.ts} +502 -4
  38. package/dist/types-chunks/{resolver.d-DkgJlEzr.d.ts → resolver.d-CQfaJbht.d.ts} +24 -6
  39. package/dist/types-chunks/{storage.d-B1Jk6ryM.d.ts → storage.d-J2GqOgaX.d.ts} +4 -1
  40. package/dist/types-chunks/{types.d-B_MIIApc.d.ts → types.d-BnjX2Gn4.d.ts} +6 -1
  41. package/dist/types-chunks/{types.d-Cf-GCzac.d.ts → types.d-rPRl2LSB.d.ts} +4 -0
  42. package/dist/types-chunks/{utils.d-Dgy5SVrq.d.ts → utils.d-D_-jrRku.d.ts} +44 -8
  43. package/package.json +1 -1
  44. package/dist/chunks/chunk-66B6ZOU7.js +0 -31
  45. package/dist/chunks/chunk-6Z75SHX3.js +0 -2
  46. package/dist/chunks/chunk-EP46H5P3.js +0 -415
  47. package/dist/chunks/chunk-LNJNRREL.js +0 -903
  48. package/dist/chunks/chunk-UHAP234X.js +0 -567
  49. package/dist/chunks/dist-4WABQRJU.js +0 -2
  50. package/dist/types-chunks/types.d-C5mHR87z.d.ts +0 -119
@@ -1,10 +1,10 @@
1
1
  import { M as McpConnectMode, a as McpServerConfig, b as McpServersConfig, c as McpTransportKind } from './config.d-CJy1WENT.js';
2
- import { g as KodaXGoalState, s as KodaXSessionLineage, x as KodaXSessionScope, y as KodaXSessionStorage, i as KodaXJsonValue, k as KodaXSessionArtifactLedgerEntry, S as SessionErrorMetadata } from './types.d-B_MIIApc.js';
3
- import { X as KodaXTokenUsage, n as KodaXMessage, E as KodaXReasoningMode, k as KodaXHarnessProfile, S as KodaXTaskWorkIntent, I as KodaXReviewScale, O as KodaXTaskComplexity, a as KodaXAmaFanoutClass, Q as KodaXTaskRoutingDecision, R as KodaXTaskType, J as KodaXRiskLevel, i as KodaXExecutionMode, c as KodaXAmaProfile, d as KodaXAmaTactic, b as KodaXAmaFanoutPolicy } from './types.d-Cf-GCzac.js';
4
- import { f as AgentMessage, ay as StopHookFn, C as ChildTaskRegistry, s as CompactionUpdate, m as AskUserQuestionOptions, k as AskUserMultiOptions, y as Guardrail, v as DiscoveredInstance, aC as TaskAbortRegistry, ad as RunnerToolCall, aH as ToolGuardrail } from './types.d-BCnbYG_A.js';
2
+ import { g as KodaXGoalState, s as KodaXSessionLineage, x as KodaXSessionScope, y as KodaXSessionStorage, i as KodaXJsonValue, k as KodaXSessionArtifactLedgerEntry, S as SessionErrorMetadata } from './types.d-BnjX2Gn4.js';
3
+ import { X as KodaXTokenUsage, n as KodaXMessage, E as KodaXReasoningMode, k as KodaXHarnessProfile, S as KodaXTaskWorkIntent, I as KodaXReviewScale, O as KodaXTaskComplexity, a as KodaXAmaFanoutClass, Q as KodaXTaskRoutingDecision, R as KodaXTaskType, J as KodaXRiskLevel, i as KodaXExecutionMode, c as KodaXAmaProfile, d as KodaXAmaTactic, b as KodaXAmaFanoutPolicy } from './types.d-rPRl2LSB.js';
4
+ import { f as AgentMessage, aE as StopHookFn, C as ChildTaskRegistry, a$ as WorkflowEventCorrelation, s as CompactionUpdate, bb as WorkflowProcessEvent, m as AskUserQuestionOptions, k as AskUserMultiOptions, B as Guardrail, b2 as WorkflowIsolation, w as DiscoveredInstance, aI as TaskAbortRegistry, aj as RunnerToolCall, aN as ToolGuardrail } from './process.d-BbiXD24v.js';
5
5
  import { Diagnostic, Position, Location, Hover, DocumentSymbol, SymbolInformation } from 'vscode-languageserver-protocol';
6
6
  import { C as CapabilityKind, b as CapabilityResult } from './capability.d-3C62G8Eq.js';
7
- import { K as KodaXBaseProvider } from './base.d-BdJKSPO2.js';
7
+ import { K as KodaXBaseProvider } from './base.d-C4jYVjJh.js';
8
8
  import { a as CostTracker } from './cost-tracker.d-wRtyEW9d.js';
9
9
 
10
10
  /**
@@ -139,6 +139,23 @@ interface ChildProgressSnapshot {
139
139
  */
140
140
  readonly specialistName?: string;
141
141
  }
142
+ /**
143
+ * Event variants the per-child events bridge feeds back to the
144
+ * snapshot. Kept as a discriminated union so future event kinds (e.g.,
145
+ * a real assistant-text chunk hook if the agent runtime grows one) can
146
+ * be added without breaking existing call sites.
147
+ */
148
+ type ChildSnapshotEvent = {
149
+ readonly kind: 'iteration';
150
+ readonly iteration: number;
151
+ readonly maxIterations: number;
152
+ } | {
153
+ readonly kind: 'tool-start';
154
+ readonly iteration: number;
155
+ readonly toolName: string;
156
+ readonly inputHint: string;
157
+ readonly startedAt: number;
158
+ };
142
159
 
143
160
  /** Result of a cache lookup. */
144
161
  type ReadStateLookup = {
@@ -392,6 +409,32 @@ interface TodoStore {
392
409
  reset(): void;
393
410
  }
394
411
 
412
+ type WorkflowInvocationSource = 'natural-language' | 'command';
413
+ type WorkflowInvocationAction = 'none' | 'suggest' | 'auto-start';
414
+ type WorkflowInvocationTrigger = 'explicit' | 'complexity' | 'negated' | 'none';
415
+ type WorkflowStartOutcome = 'started' | 'declined' | 'cancelled' | 'failed';
416
+ interface WorkflowHostPolicy {
417
+ readonly autoStart?: 'off' | 'confirm' | 'on';
418
+ readonly maxAgents?: number;
419
+ readonly maxConcurrency?: number;
420
+ readonly tokenBudget?: number;
421
+ }
422
+ interface WorkflowInvocationPolicyInput {
423
+ readonly agentMode: KodaXAgentMode;
424
+ readonly source: WorkflowInvocationSource;
425
+ readonly input: string;
426
+ readonly hostPolicy?: WorkflowHostPolicy;
427
+ }
428
+ interface WorkflowInvocationPolicyDecision {
429
+ readonly action: WorkflowInvocationAction;
430
+ readonly trigger: WorkflowInvocationTrigger;
431
+ readonly reason: string;
432
+ }
433
+ declare function decideWorkflowInvocation(input: WorkflowInvocationPolicyInput): WorkflowInvocationPolicyDecision;
434
+ declare function workflowStartOutcomeConsumesTurn(input: {
435
+ readonly outcome: WorkflowStartOutcome;
436
+ }): boolean;
437
+
395
438
  /**
396
439
  * FEATURE_132 — language-server registry + discovery (cascade step ①).
397
440
  *
@@ -1193,29 +1236,43 @@ interface KodaXRepoIntelligenceTraceEvent {
1193
1236
  trace?: KodaXRepoIntelligenceTrace;
1194
1237
  }
1195
1238
 
1239
+ interface KodaXWorkflowEventMeta {
1240
+ readonly workflowCorrelation?: WorkflowEventCorrelation;
1241
+ }
1242
+ interface KodaXActivityEventMeta extends KodaXWorkflowEventMeta {
1243
+ readonly childAgentId?: string;
1244
+ readonly childAgentName?: string;
1245
+ readonly parentToolId?: string;
1246
+ readonly liveOnly?: boolean;
1247
+ }
1248
+ interface KodaXToolEventMeta extends KodaXActivityEventMeta {
1249
+ readonly toolId?: string;
1250
+ }
1196
1251
  interface KodaXEvents {
1197
- onTextDelta?: (text: string) => void;
1198
- onThinkingDelta?: (text: string) => void;
1199
- onThinkingEnd?: (thinking: string) => void;
1252
+ /** FEATURE_229: correlates child-agent SDK callbacks back to a workflow run/item. */
1253
+ workflowCorrelation?: WorkflowEventCorrelation;
1254
+ onTextDelta?: (text: string, meta?: KodaXActivityEventMeta) => void;
1255
+ onThinkingDelta?: (text: string, meta?: KodaXActivityEventMeta) => void;
1256
+ onThinkingEnd?: (thinking: string, meta?: KodaXActivityEventMeta) => void;
1200
1257
  onToolUseStart?: (tool: {
1201
1258
  name: string;
1202
1259
  id: string;
1203
1260
  input?: Record<string, unknown>;
1204
- }) => void;
1261
+ }, meta?: KodaXToolEventMeta) => void;
1205
1262
  onToolResult?: (result: {
1206
1263
  id: string;
1207
1264
  name: string;
1208
1265
  content: string;
1209
- }) => void;
1266
+ }, meta?: KodaXToolEventMeta) => void;
1210
1267
  /** FEATURE_067 v2: Real-time tool execution progress update. Updates the tool's display in the REPL transcript. */
1211
1268
  onToolProgress?: (update: {
1212
1269
  id: string;
1213
1270
  message: string;
1214
- }) => void;
1215
- onToolInputDelta?: (toolName: string, partialJson: string, meta?: {
1216
- toolId?: string;
1217
- }) => void;
1218
- onStreamEnd?: () => void;
1271
+ }, meta?: KodaXToolEventMeta) => void;
1272
+ onToolInputDelta?: (toolName: string, partialJson: string, meta?: KodaXToolEventMeta) => void;
1273
+ onStreamEnd?: (meta?: KodaXActivityEventMeta) => void;
1274
+ /** Fired once when a child-agent run fully leaves the child executor. */
1275
+ onChildActivityEnd?: (meta?: KodaXActivityEventMeta) => void;
1219
1276
  onSessionStart?: (info: {
1220
1277
  provider: string;
1221
1278
  sessionId: string;
@@ -1320,6 +1377,8 @@ interface KodaXEvents {
1320
1377
  onComplete?: () => void;
1321
1378
  onError?: (error: Error) => void;
1322
1379
  onManagedTaskStatus?: (status: KodaXManagedTaskStatusEvent) => void;
1380
+ /** FEATURE_229: workflow process snapshot stream for SDK/host panels. */
1381
+ onWorkflowProcessEvent?: (event: WorkflowProcessEvent) => void;
1323
1382
  /**
1324
1383
  * Fired when Scout's managed-task completion is inferred but the harness
1325
1384
  * detected suspicious signals (mutation expected but none happened, budget
@@ -1356,18 +1415,16 @@ interface KodaXEvents {
1356
1415
  current: (() => string) | null;
1357
1416
  };
1358
1417
  /** Tool execution hook - called before tool execution, return false to block - 工具执行前回调 */
1359
- beforeToolExecute?: (tool: string, input: Record<string, unknown>, meta?: {
1360
- toolId?: string;
1361
- }) => Promise<boolean | string>;
1418
+ beforeToolExecute?: (tool: string, input: Record<string, unknown>, meta?: KodaXToolEventMeta) => Promise<boolean | string>;
1362
1419
  /** Ask user a question interactively - Issue 069 - 交互式向用户提问 */
1363
- askUser?: (options: AskUserQuestionOptions) => Promise<string>;
1420
+ askUser?: (options: AskUserQuestionOptions, meta?: KodaXToolEventMeta) => Promise<string>;
1364
1421
  /** Ask user multiple independent questions sequentially - 多问题顺序提问 */
1365
- askUserMulti?: (options: AskUserMultiOptions) => Promise<Record<string, string> | undefined>;
1422
+ askUserMulti?: (options: AskUserMultiOptions, meta?: KodaXToolEventMeta) => Promise<Record<string, string> | undefined>;
1366
1423
  /** Ask user for free-text input - 自由文本输入 (Issue 112) */
1367
1424
  askUserInput?: (options: {
1368
1425
  question: string;
1369
1426
  default?: string;
1370
- }) => Promise<string | undefined>;
1427
+ }, meta?: KodaXToolEventMeta) => Promise<string | undefined>;
1371
1428
  /**
1372
1429
  * FEATURE_074: Exit plan mode with user approval. Called by the `exit_plan_mode` tool.
1373
1430
  * Returns:
@@ -1409,6 +1466,8 @@ interface KodaXSessionOptions {
1409
1466
  resume?: boolean;
1410
1467
  autoResume?: boolean;
1411
1468
  scope?: KodaXSessionScope;
1469
+ /** Consumer-owned private string persisted with the session. */
1470
+ tag?: string;
1412
1471
  storage?: KodaXSessionStorage;
1413
1472
  initialMessages?: KodaXMessage[];
1414
1473
  /**
@@ -1561,6 +1620,11 @@ interface KodaXChildContextBundle {
1561
1620
  * lands separately.
1562
1621
  */
1563
1622
  modelHint?: KodaXChildModelHint;
1623
+ /**
1624
+ * FEATURE_217 (v0.7.49): workflow-level child isolation hint. Default is
1625
+ * shared parent cwd; `worktree` is opt-in and parent-managed.
1626
+ */
1627
+ isolation?: WorkflowIsolation;
1564
1628
  /**
1565
1629
  * FEATURE_191 — optional registered specialist agent name. When set,
1566
1630
  * the child is dispatched with that agent's `instructions` /
@@ -1602,8 +1666,19 @@ interface KodaXChildAgentResult {
1602
1666
  contradictions: string[];
1603
1667
  artifactPaths?: string[];
1604
1668
  sessionId?: string;
1669
+ /** Bounded workflow transcript digest. Full `summary` remains the synthesis/audit source. */
1670
+ digest?: string;
1671
+ /** True when a workflow child digest was attempted but failed (error/timeout/empty distillation). */
1672
+ digestFailed?: boolean;
1673
+ /** True when a workflow child digest is running asynchronously and may arrive later. */
1674
+ digestPending?: boolean;
1675
+ /** Actual provider/model selected for this child run, when known. */
1676
+ provider?: string;
1677
+ model?: string;
1605
1678
  /** Actual iterations consumed by this child agent. */
1606
1679
  actualIterations?: number;
1680
+ /** Best-known token usage for this child run. Used by workflow budget accounting. */
1681
+ totalTokensUsed?: number;
1607
1682
  /**
1608
1683
  * True when the child's `runKodaX` exited via CAP-083 AbortError silent
1609
1684
  * terminal (`KodaXResult.interrupted === true`). Surfaces the
@@ -1674,7 +1749,7 @@ interface KodaXFanoutSchedulerPlan {
1674
1749
  cancellationPolicy: 'none' | 'winner-cancel' | 'budget-cancel';
1675
1750
  reason: string;
1676
1751
  }
1677
- type KodaXAgentMode = 'ama' | 'sa';
1752
+ type KodaXAgentMode = 'ama' | 'sa' | 'amaw';
1678
1753
  type KodaXMemoryStrategy = 'continuous' | 'compact' | 'reset-handoff';
1679
1754
  type KodaXBudgetDisclosureZone = 'green' | 'yellow' | 'orange' | 'red';
1680
1755
  interface KodaXManagedTaskHarnessTransition {
@@ -1963,6 +2038,23 @@ interface KodaXSelfManualConfig {
1963
2038
  readonly productName?: string;
1964
2039
  readonly topics?: readonly KodaXManualTopicInput[];
1965
2040
  }
2041
+ /**
2042
+ * SDK-consumer auto-compaction override. When a field is provided it wins
2043
+ * over both the adaptive default and `~/.kodax/config.json`. Lets an
2044
+ * embedder that calls `runManagedTask` in-process pin the context window /
2045
+ * trigger for a model the built-in capability table doesn't cover (or that
2046
+ * it resolves through a custom provider), or disable auto-compaction for a
2047
+ * run — without writing to the user's home-dir config file. Omitted fields
2048
+ * fall through to the normal resolution cascade.
2049
+ */
2050
+ interface KodaXCompactionOverride {
2051
+ /** Override the resolved provider context window, in tokens. */
2052
+ contextWindow?: number;
2053
+ /** Override the auto-compaction trigger percentage (0-100). */
2054
+ triggerPercent?: number;
2055
+ /** Set false to disable automatic compaction for this run. */
2056
+ enabled?: boolean;
2057
+ }
1966
2058
  interface KodaXOptions {
1967
2059
  provider: string;
1968
2060
  model?: string;
@@ -1975,6 +2067,8 @@ interface KodaXOptions {
1975
2067
  context?: KodaXContextOptions;
1976
2068
  events?: KodaXEvents;
1977
2069
  extensionRuntime?: ExtensionRuntimeContract;
2070
+ /** FEATURE_229: host-owned policy for workflow auto-start and ceilings. */
2071
+ workflowHostPolicy?: WorkflowHostPolicy;
1978
2072
  /** FEATURE_221: SDK-consumer self-manual injection (product name + topics). */
1979
2073
  selfManual?: KodaXSelfManualConfig;
1980
2074
  /**
@@ -1999,6 +2093,11 @@ interface KodaXOptions {
1999
2093
  * SDK callers can also instantiate one via {@link createSessionControl}.
2000
2094
  */
2001
2095
  sessionControl?: KodaXSessionControl;
2096
+ /**
2097
+ * SDK-consumer auto-compaction override. Wins over the adaptive default
2098
+ * and `~/.kodax/config.json`. See {@link KodaXCompactionOverride}.
2099
+ */
2100
+ compaction?: KodaXCompactionOverride;
2002
2101
  }
2003
2102
  /**
2004
2103
  * Low-level mutators handed to a `KodaXSessionControl` by the substrate.
@@ -2222,6 +2321,8 @@ interface KodaXResult {
2222
2321
  managedTask?: KodaXManagedTask;
2223
2322
  /** Best-known token snapshot after the round completes. */
2224
2323
  contextTokenSnapshot?: KodaXContextTokenSnapshot;
2324
+ /** Latest provider usage when the caller has it directly. */
2325
+ usage?: KodaXTokenUsage;
2225
2326
  /**
2226
2327
  * FEATURE_076: artifact ledger pre-extracted before round-boundary reshape.
2227
2328
  * Populated when the reshape replaces `messages` with a clean {user, assistant}
@@ -2248,6 +2349,13 @@ interface KodaXToolExecutionContext {
2248
2349
  selfManual?: KodaXSelfManualConfig;
2249
2350
  /** Working directory used to resolve relative paths and execute shell commands. */
2250
2351
  executionCwd?: string;
2352
+ /**
2353
+ * FEATURE_217 (v0.7.49): parent dir for `isolation:'worktree'` workflow child
2354
+ * worktrees. Workflow runs point this at `<runDir>/worktrees` so worktrees are
2355
+ * reclaimable (Layer 2/3 sweep) and never pollute the user's project tree.
2356
+ * Absent on non-workflow paths → worktrees fall back to the git root's parent.
2357
+ */
2358
+ workflowWorktreeBaseDir?: string;
2251
2359
  /** Shared extension capability runtime used by retrieval-family tools. */
2252
2360
  extensionRuntime?: ExtensionRuntimeContract;
2253
2361
  /** Ask user a question interactively (select mode) - 交互式向用户提问 (Issue 069) */
@@ -2295,6 +2403,12 @@ interface KodaXToolExecutionContext {
2295
2403
  readonly model?: string;
2296
2404
  readonly reasoningMode?: KodaXReasoningMode;
2297
2405
  };
2406
+ /**
2407
+ * Parent SDK/REPL callback surface available to child-dispatch tools.
2408
+ * `dispatch_child_task` uses this to preserve live child telemetry without
2409
+ * copying every callback onto KodaXToolExecutionContext as a separate field.
2410
+ */
2411
+ parentEvents?: KodaXEvents;
2298
2412
  /**
2299
2413
  * FEATURE_123 v0.7.44 — agentId of the agent whose tool call this
2300
2414
  * context backs. `undefined` for the top-level Worker (main runtime
@@ -3173,5 +3287,5 @@ interface CreateBashPrefixExtractorOptions {
3173
3287
  */
3174
3288
  declare function createBashPrefixExtractor(opts: CreateBashPrefixExtractorOptions): BashPrefixExtractor;
3175
3289
 
3176
- export { BASH_POLICY_SPEC as B, CONSECUTIVE_THRESHOLD as C, ERROR_THRESHOLD as E, LSP_SERVERS as aB, LspService as aF, WINDOW_MS as b1, buildGoalRuntimeBinding as b2, collectAllSignals as b3, computeRulesFingerprint as b4, createAutoModeToolGuardrail as b5, createBashPrefixExtractor as b6, createCircuitBreaker as b7, createDenialTracker as b8, extractCommandPrefix as b9, formatAgentsForPrompt as ba, getDefaultLspService as bb, getKodaxGlobalDir as bc, loadAgentsFiles as bd, loadAutoRules as be, makeDisabledGoalToolsContext as bf, parseAutoRules as bg, readTrustState as bh, recordAllow as bi, recordBlock as bj, recordError as bk, shouldFallback$1 as bl, shouldFallback as bm, shutdownDefaultLspService as bn, trustProjectRules as bo, withGoalBeforeNextTurn as bp, withGoalStopHook as bq, CUMULATIVE_THRESHOLD as k };
3177
- export type { KodaXMcpTransport as $, AgentsFile as A, DenialTracker as D, FailureStage as F, GoalBlockedResult as G, KodaXContextOptions as H, KodaXContextTokenSnapshot as I, KodaXEvents as J, KodaXAgentMode as K, KodaXFanoutBranchLifecycle as L, KodaXFanoutBranchRecord as M, KodaXFanoutBranchTransition as N, KodaXFanoutSchedulerInput as O, KodaXFanoutSchedulerPlan as P, KodaXInputArtifact as Q, KodaXManagedBudgetSnapshot as R, KodaXManagedProtocolPayload as S, KodaXManagedTask as T, KodaXManagedTaskRuntimeState as U, KodaXManagedTaskStatusEvent as V, KodaXManualTopicId as W, KodaXManualTopicInput as X, KodaXMcpConnectMode as Y, KodaXMcpServerConfig as Z, KodaXMcpServersConfig as _, AutoModeAskUser as a, ToolCallSignal as a$, KodaXMemoryStrategy as a0, KodaXOptions as a1, KodaXOrchestrationVerdict as a2, KodaXParentReductionContract as a3, KodaXProviderPolicyHints as a4, KodaXRepoIntelligenceCapability as a5, KodaXRepoIntelligenceMode as a6, KodaXRepoIntelligenceResolvedMode as a7, KodaXRepoIntelligenceTrace as a8, KodaXRepoIntelligenceTraceEvent as a9, KodaXVerificationScorecardCriterion as aA, LoadAgentsOptions as aC, LoadedRulesSource as aD, LspServerInfo as aE, LspServiceConfig as aG, ProviderExecutionState as aH, ProviderRecoveryEvent as aI, ProviderResilienceConfig as aJ, ProviderResiliencePolicy as aK, RecoveryAction as aL, RecoveryDecision as aM, RecoveryLadderStep as aN, RecoveryResult as aO, ResilienceClassification as aP, ResilienceErrorClass as aQ, ResolveKodaXManualInput as aR, ResolveKodaXManualOptions as aS, ResolveKodaXManualResult as aT, RulesLoadError as aU, RulesLoadResult as aV, SignalCollector as aW, SkippedRulesSource as aX, TodoItem as aY, TodoList as aZ, TodoStatus as a_, KodaXRepoRoutingSignals as aa, KodaXResult as ab, KodaXRoleRoundSummary as ac, KodaXRuntimeVerificationContract as ad, KodaXSelfManualConfig as ae, KodaXSessionControl as af, KodaXSessionMutators as ag, KodaXSessionOptions as ah, KodaXSkillInvocationContext as ai, KodaXSkillMap as aj, KodaXSkillProjectionConfidence as ak, KodaXTaskCapabilityHint as al, KodaXTaskContract as am, KodaXTaskEvidenceArtifact as an, KodaXTaskEvidenceBundle as ao, KodaXTaskEvidenceEntry as ap, KodaXTaskRole as aq, KodaXTaskRoleAssignment as ar, KodaXTaskStatus as as, KodaXTaskSurface as at, KodaXTaskToolPolicy as au, KodaXTaskVerificationContract as av, KodaXTaskVerificationCriterion as aw, KodaXTaskWorkItem as ax, KodaXToolExecutionContext as ay, KodaXVerificationScorecard as az, AutoModeAskUserVerdict as b, TrustState as b0, AutoModeEngine as c, AutoModeGuardrailConfig as d, AutoModeSharedState as e, AutoModeStats as f, AutoModeToolGuardrail as g, AutoRules as h, BashPrefixExtractor as i, BashPrefixResult as j, CircuitBreaker as l, CreateBashPrefixExtractorOptions as m, DiagnosticsRequest as n, ExtensionRuntimeContract as o, ExtractCommandPrefixOptions as p, GoalCompleteResult as q, GoalCreateInput as r, GoalLifecycleContext as s, GoalRuntimeBinding as t, GoalRuntimeBindingDeps as u, GoalToolsContext as v, KodaXBudgetDisclosureZone as w, KodaXBudgetExtensionRequest as x, KodaXChildAgentResult as y, KodaXChildContextBundle as z };
3290
+ export { BASH_POLICY_SPEC as B, CONSECUTIVE_THRESHOLD as C, ERROR_THRESHOLD as E, LSP_SERVERS as aH, LspService as aL, WINDOW_MS as b7, shouldFallback as bA, shutdownDefaultLspService as bB, trustProjectRules as bC, withGoalBeforeNextTurn as bD, withGoalStopHook as bE, workflowStartOutcomeConsumesTurn as bF, buildGoalRuntimeBinding as bf, collectAllSignals as bg, computeRulesFingerprint as bh, createAutoModeToolGuardrail as bi, createBashPrefixExtractor as bj, createCircuitBreaker as bk, createDenialTracker as bl, decideWorkflowInvocation as bm, extractCommandPrefix as bn, formatAgentsForPrompt as bo, getDefaultLspService as bp, getKodaxGlobalDir as bq, loadAgentsFiles as br, loadAutoRules as bs, makeDisabledGoalToolsContext as bt, parseAutoRules as bu, readTrustState as bv, recordAllow as bw, recordBlock as bx, recordError as by, shouldFallback$1 as bz, CUMULATIVE_THRESHOLD as k };
3291
+ export type { KodaXManualTopicInput as $, AgentsFile as A, DenialTracker as D, FailureStage as F, GoalBlockedResult as G, KodaXChildAgentResult as H, KodaXChildContextBundle as I, KodaXChildExecutionResult as J, KodaXActivityEventMeta as K, KodaXCompactionOverride as L, KodaXContextOptions as M, KodaXContextTokenSnapshot as N, KodaXEvents as O, KodaXFanoutBranchLifecycle as P, KodaXFanoutBranchRecord as Q, KodaXFanoutBranchTransition as R, KodaXFanoutSchedulerInput as S, KodaXFanoutSchedulerPlan as T, KodaXInputArtifact as U, KodaXManagedBudgetSnapshot as V, KodaXManagedProtocolPayload as W, KodaXManagedTask as X, KodaXManagedTaskRuntimeState as Y, KodaXManagedTaskStatusEvent as Z, KodaXManualTopicId as _, AutoModeAskUser as a, RulesLoadResult as a$, KodaXMcpConnectMode as a0, KodaXMcpServerConfig as a1, KodaXMcpServersConfig as a2, KodaXMcpTransport as a3, KodaXMemoryStrategy as a4, KodaXOptions as a5, KodaXOrchestrationVerdict as a6, KodaXParentReductionContract as a7, KodaXProviderPolicyHints as a8, KodaXRepoIntelligenceCapability as a9, KodaXTaskVerificationCriterion as aA, KodaXTaskWorkItem as aB, KodaXToolEventMeta as aC, KodaXToolExecutionContext as aD, KodaXVerificationScorecard as aE, KodaXVerificationScorecardCriterion as aF, KodaXWorkflowEventMeta as aG, LoadAgentsOptions as aI, LoadedRulesSource as aJ, LspServerInfo as aK, LspServiceConfig as aM, ProviderExecutionState as aN, ProviderRecoveryEvent as aO, ProviderResilienceConfig as aP, ProviderResiliencePolicy as aQ, RecoveryAction as aR, RecoveryDecision as aS, RecoveryLadderStep as aT, RecoveryResult as aU, ResilienceClassification as aV, ResilienceErrorClass as aW, ResolveKodaXManualInput as aX, ResolveKodaXManualOptions as aY, ResolveKodaXManualResult as aZ, RulesLoadError as a_, KodaXRepoIntelligenceMode as aa, KodaXRepoIntelligenceResolvedMode as ab, KodaXRepoIntelligenceTrace as ac, KodaXRepoIntelligenceTraceEvent as ad, KodaXRepoRoutingSignals as ae, KodaXResult as af, KodaXRoleRoundSummary as ag, KodaXRuntimeVerificationContract as ah, KodaXSelfManualConfig as ai, KodaXSessionControl as aj, KodaXSessionMutators as ak, KodaXSessionOptions as al, KodaXSkillInvocationContext as am, KodaXSkillMap as an, KodaXSkillProjectionConfidence as ao, KodaXTaskCapabilityHint as ap, KodaXTaskContract as aq, KodaXTaskEvidenceArtifact as ar, KodaXTaskEvidenceBundle as as, KodaXTaskEvidenceEntry as at, KodaXTaskRole as au, KodaXTaskRoleAssignment as av, KodaXTaskStatus as aw, KodaXTaskSurface as ax, KodaXTaskToolPolicy as ay, KodaXTaskVerificationContract as az, AutoModeAskUserVerdict as b, SignalCollector as b0, SkippedRulesSource as b1, TodoItem as b2, TodoList as b3, TodoStatus as b4, ToolCallSignal as b5, TrustState as b6, WorkflowHostPolicy as b8, WorkflowInvocationAction as b9, WorkflowInvocationPolicyDecision as ba, WorkflowInvocationPolicyInput as bb, WorkflowInvocationSource as bc, WorkflowInvocationTrigger as bd, WorkflowStartOutcome as be, AutoModeEngine as c, AutoModeGuardrailConfig as d, AutoModeSharedState as e, AutoModeStats as f, AutoModeToolGuardrail as g, AutoRules as h, BashPrefixExtractor as i, BashPrefixResult as j, ChildSnapshotEvent as l, CircuitBreaker as m, CreateBashPrefixExtractorOptions as n, DiagnosticsRequest as o, ExtensionRuntimeContract as p, ExtractCommandPrefixOptions as q, GoalCompleteResult as r, GoalCreateInput as s, GoalLifecycleContext as t, GoalRuntimeBinding as u, GoalRuntimeBindingDeps as v, GoalToolsContext as w, KodaXAgentMode as x, KodaXBudgetDisclosureZone as y, KodaXBudgetExtensionRequest as z };
@@ -1,6 +1,6 @@
1
- import { n as KodaXMessage } from './types.d-Cf-GCzac.js';
2
- import { f as AgentMessage, aj as SessionEntry, ah as Session, ak as SessionExtension, p as CompactionDetails, x as FileOperations } from './types.d-BCnbYG_A.js';
3
- import { s as KodaXSessionLineage, i as KodaXJsonValue, a as KodaXCompactMemorySeed, o as KodaXSessionEntry, z as KodaXSessionTreeNode, r as KodaXSessionLabelEntry, q as KodaXSessionGoalEntry, v as KodaXSessionNavigationOptions, k as KodaXSessionArtifactLedgerEntry } from './types.d-B_MIIApc.js';
1
+ import { n as KodaXMessage } from './types.d-rPRl2LSB.js';
2
+ import { f as AgentMessage, ap as SessionEntry, an as Session, a3 as QueueEventListener, a4 as QueuedMessage, E as EnqueueInput, v as DequeueFilter, aq as SessionExtension, p as CompactionDetails, z as FileOperations, b5 as WorkflowMeta, b6 as WorkflowModelHint, b7 as WorkflowModule } from './process.d-BbiXD24v.js';
3
+ import { s as KodaXSessionLineage, i as KodaXJsonValue, a as KodaXCompactMemorySeed, o as KodaXSessionEntry, z as KodaXSessionTreeNode, r as KodaXSessionLabelEntry, q as KodaXSessionGoalEntry, v as KodaXSessionNavigationOptions, k as KodaXSessionArtifactLedgerEntry } from './types.d-BnjX2Gn4.js';
4
4
 
5
5
  /**
6
6
  * @kodax-ai/agent Constants
@@ -271,6 +271,98 @@ declare function getAgentConfigPath(...segments: string[]): string;
271
271
  */
272
272
  declare function getAppDataDir(appId: string): string;
273
273
 
274
+ /**
275
+ * @kodax-ai/agent/messaging/queue — 2-tier agentId-scoped FIFO message queue.
276
+ *
277
+ * FEATURE_115 (v0.7.36).
278
+ *
279
+ * Invariants:
280
+ * - In-priority FIFO: messages of the same priority drain in enqueue order.
281
+ * - Cross-priority precedence: 'user' drains before 'background', regardless
282
+ * of enqueue order.
283
+ * - agentId routing: messages addressed to agentId X are only visible to
284
+ * consumers filtering for that exact agentId. undefined ≠ "any agent" —
285
+ * it specifically matches main-thread messages.
286
+ * - Not persistent: process restart loses queue state, by design (matches
287
+ * TodoStore semantics).
288
+ *
289
+ * The queue is process-global by default (`getMessageQueue()`); the class is
290
+ * also exported for tests / isolated downstream use.
291
+ */
292
+
293
+ declare class MessageQueue {
294
+ private messages;
295
+ private nextSeq;
296
+ /**
297
+ * FEATURE_159 (v0.7.40) — observable subscription set. Same pattern as
298
+ * Claude Code's `messageQueueManager.ts` `createSignal()` substrate,
299
+ * but the listener carries a structured `QueueEvent` so SDK
300
+ * observability consumers (logger, tracer, metrics) can react per-
301
+ * event without re-diffing snapshots. `useSyncExternalStore` consumers
302
+ * still work — they ignore the event argument.
303
+ *
304
+ * Cached `snapshotRef` keeps reference identity stable across reads
305
+ * when nothing changed — required by React 18's `useSyncExternalStore`
306
+ * to avoid render loops.
307
+ */
308
+ private listeners;
309
+ private snapshotRef;
310
+ private notify;
311
+ /**
312
+ * Subscribe to queue mutations. Compatible with React 18's
313
+ * `useSyncExternalStore(subscribe, getSnapshot)` — the hook passes a
314
+ * `() => void` callback, which is structurally assignable to the
315
+ * `QueueEventListener` parameter because TypeScript treats
316
+ * callback parameter discards as compatible. SDK consumers that
317
+ * declare a typed `(event: QueueEvent) => void` listener see the
318
+ * structured event.
319
+ *
320
+ * Listener is called synchronously after every mutation; returns an
321
+ * unsubscribe function.
322
+ */
323
+ subscribe: (listener: QueueEventListener) => (() => void);
324
+ /**
325
+ * Returns the current frozen queue snapshot. Reference identity is
326
+ * stable across reads when the queue has not mutated, which is the
327
+ * contract React's `useSyncExternalStore` relies on.
328
+ */
329
+ getSnapshot: () => readonly QueuedMessage[];
330
+ /** Returns the assigned id of the enqueued message. */
331
+ enqueue(input: EnqueueInput): string;
332
+ /**
333
+ * Drain matching messages, ordered by priority (user > background) then
334
+ * FIFO within each priority. Removes drained messages from the queue.
335
+ */
336
+ dequeue(filter: DequeueFilter): QueuedMessage[];
337
+ /**
338
+ * Peek at matching messages without removing them. Returns messages in
339
+ * the same priority + FIFO order that `dequeue(filter)` would return,
340
+ * so callers can inspect what the next drain would yield.
341
+ */
342
+ peek(filter: DequeueFilter): QueuedMessage[];
343
+ /** Total queue size across all priorities / agents. */
344
+ size(): number;
345
+ /** Count of messages matching the filter. */
346
+ count(filter: DequeueFilter): number;
347
+ /** True iff at least one message matches the filter. */
348
+ has(filter: DequeueFilter): boolean;
349
+ /** Remove all queued messages — used in tests / process abort scenarios. */
350
+ clear(): void;
351
+ }
352
+ /**
353
+ * Returns the process-global MessageQueue singleton, creating it lazily on
354
+ * first call. Use this for production wiring; instantiate `MessageQueue`
355
+ * directly in tests / isolated subsystems where a shared instance would
356
+ * cause cross-test pollution.
357
+ */
358
+ declare function getMessageQueue(): MessageQueue;
359
+ /**
360
+ * Test-only reset hook. Production code MUST NOT call this. Underscored
361
+ * prefix follows the same convention as `_resetInvariantRegistry` /
362
+ * `_resetAdmittedAgentBindings` / `_resetAdmissionMetrics`.
363
+ */
364
+ declare function _resetMessageQueueForTests(): void;
365
+
274
366
  /**
275
367
  * History cleanup middleware — CAP-002
276
368
  *
@@ -636,5 +728,81 @@ declare function mergeFileOps(ops1: FileOperations, ops2: FileOperations): FileO
636
728
  declare function extractArtifactLedger(messages: KodaXMessage[]): KodaXSessionArtifactLedgerEntry[];
637
729
  declare function mergeArtifactLedger(existing: KodaXSessionArtifactLedgerEntry[], next: KodaXSessionArtifactLedgerEntry[]): KodaXSessionArtifactLedgerEntry[];
638
730
 
639
- export { countActiveLineageMessages as A, countTokens as B, DefaultSummaryCompaction as D, createSessionLineage as E, estimateTokens as F, extractArtifactLedger as G, extractFileOps as H, extractTitleFromMessages as I, findPreviousUserEntryId as J, KODAX_API_MIN_INTERVAL as K, LINEAGE_ENTRY_TYPES as L, forkSessionLineage as M, generateSessionId as N, getAgentConfigHome as O, PROMISE_PATTERN as P, getAgentConfigPath as Q, getAppDataDir as R, getSessionLineagePath as S, getSessionMessagesFromLineage as T, mergeArtifactLedger as U, mergeFileOps as V, resolveSessionLineageTarget as W, rewindSessionLineage as X, setAgentConfigHome as Y, setSessionLineageActiveEntry as Z, validateAndFixToolHistory as _, KODAX_DEFAULT_TIMEOUT as e, KODAX_HARD_TIMEOUT as f, KODAX_MAX_INCOMPLETE_RETRIES as g, KODAX_MAX_MAXTOKENS_RETRIES as h, KODAX_MAX_RETRIES as i, KODAX_MAX_TOKENS as j, KODAX_RETRY_BASE_DELAY as k, KODAX_STAGGER_DELAY as l, LineageCompaction as n, LineageExtension as q, appendSessionLineageLabel as u, applyLineageTruncation as v, applySessionCompaction as w, archiveOldIslands as x, buildSessionTree as y, cleanupIncompleteToolCalls as z };
640
- export type { CompactionContext as C, CompactionEntry as a, CompactionEntryPayload as b, CompactionPolicy as c, DefaultSummaryCompactionOptions as d, LineageArtifactLedgerPayload as m, LineageCompactionDelegates as o, LineageEntryType as p, LineageLabelPayload as r, LineageTreeNode as s, PolicyCompactionResult as t };
731
+ declare const WORKFLOW_PATTERN_IDS: readonly ["classify-and-act", "fan-out-and-synthesize", "adversarial-verification", "generate-and-filter", "tournament", "loop-until-done"];
732
+ type WorkflowPatternId = (typeof WORKFLOW_PATTERN_IDS)[number];
733
+ interface WorkflowScriptManifest extends WorkflowMeta {
734
+ readonly phases: readonly string[];
735
+ readonly readOnly: boolean;
736
+ readonly plannedAgents?: number;
737
+ readonly maxAgents: number;
738
+ readonly maxConcurrency: number;
739
+ readonly tokenBudget?: number;
740
+ readonly mayUseWorktree?: boolean;
741
+ readonly patterns: readonly WorkflowPatternId[];
742
+ }
743
+ declare function validateWorkflowScriptManifest(value: unknown): WorkflowScriptManifest;
744
+
745
+ /**
746
+ * FEATURE_217 (v0.7.49) Phase M — reusable generated workflow capsule.
747
+ *
748
+ * Agent owns only the domain-neutral capsule contract. Persistence,
749
+ * environment preflight, skills, MCP, and REPL UX live in higher layers.
750
+ */
751
+
752
+ declare const WORKFLOW_CAPSULE_FORMAT: "kodax.workflow";
753
+ declare const WORKFLOW_CAPSULE_VERSION: 1;
754
+ declare const WORKFLOW_CAPSULE_API_VERSION: 1;
755
+ type WorkflowCapsuleEnvironmentRequirement = 'git-repo' | 'worktree-capable';
756
+ interface WorkflowCapsuleIntent {
757
+ readonly taskClass: string;
758
+ readonly originalRequest?: string;
759
+ readonly reusableFor?: readonly string[];
760
+ readonly notFor?: readonly string[];
761
+ }
762
+ interface WorkflowCapsuleInputs {
763
+ readonly description: string;
764
+ readonly examples?: readonly unknown[];
765
+ }
766
+ interface WorkflowCapsuleRequirements {
767
+ readonly environment?: readonly WorkflowCapsuleEnvironmentRequirement[];
768
+ readonly tools?: readonly string[];
769
+ readonly mcp?: readonly string[];
770
+ readonly skills?: readonly string[];
771
+ readonly modelTiers?: readonly WorkflowModelHint[];
772
+ readonly userInteraction?: boolean;
773
+ }
774
+ interface WorkflowCapsuleProvenance {
775
+ readonly fromRunId?: string;
776
+ readonly fromWorkflowName?: string;
777
+ readonly revisionOf?: string;
778
+ readonly replacesWorkflowName?: string;
779
+ readonly createdAt: string;
780
+ readonly kodaxVersion: string;
781
+ }
782
+ interface WorkflowCapsule {
783
+ readonly format: typeof WORKFLOW_CAPSULE_FORMAT;
784
+ readonly version: typeof WORKFLOW_CAPSULE_VERSION;
785
+ readonly workflowApiVersion: typeof WORKFLOW_CAPSULE_API_VERSION;
786
+ readonly minKodaxVersion: string;
787
+ readonly manifest: WorkflowScriptManifest;
788
+ readonly source: string;
789
+ readonly intent?: WorkflowCapsuleIntent;
790
+ readonly inputs?: WorkflowCapsuleInputs;
791
+ readonly requires?: WorkflowCapsuleRequirements;
792
+ readonly provenance?: WorkflowCapsuleProvenance;
793
+ }
794
+ interface CreateWorkflowCapsuleInput {
795
+ readonly minKodaxVersion: string;
796
+ readonly manifest: WorkflowScriptManifest;
797
+ readonly source: string;
798
+ readonly intent?: WorkflowCapsuleIntent;
799
+ readonly inputs?: WorkflowCapsuleInputs;
800
+ readonly requires?: WorkflowCapsuleRequirements;
801
+ readonly provenance?: WorkflowCapsuleProvenance;
802
+ }
803
+ declare function validateWorkflowCapsule(value: unknown): WorkflowCapsule;
804
+ declare function createWorkflowCapsule(input: CreateWorkflowCapsuleInput): WorkflowCapsule;
805
+ declare function createWorkflowModuleFromCapsule(capsule: WorkflowCapsule): WorkflowModule;
806
+
807
+ export { extractFileOps as $, DefaultSummaryCompaction as D, appendSessionLineageLabel as I, applyLineageTruncation as J, KODAX_API_MIN_INTERVAL as K, LINEAGE_ENTRY_TYPES as L, MessageQueue as M, applySessionCompaction as N, archiveOldIslands as O, PROMISE_PATTERN as P, buildSessionTree as Q, cleanupIncompleteToolCalls as R, countActiveLineageMessages as S, countTokens as T, createSessionLineage as U, createWorkflowCapsule as V, WORKFLOW_CAPSULE_API_VERSION as W, createWorkflowModuleFromCapsule as X, estimateTokens as Y, extractArtifactLedger as Z, _resetMessageQueueForTests as _, extractTitleFromMessages as a0, findPreviousUserEntryId as a1, forkSessionLineage as a2, generateSessionId as a3, getAgentConfigHome as a4, getAgentConfigPath as a5, getAppDataDir as a6, getMessageQueue as a7, getSessionLineagePath as a8, getSessionMessagesFromLineage as a9, mergeArtifactLedger as aa, mergeFileOps as ab, resolveSessionLineageTarget as ac, rewindSessionLineage as ad, setAgentConfigHome as ae, setSessionLineageActiveEntry as af, validateAndFixToolHistory as ag, validateWorkflowCapsule as ah, validateWorkflowScriptManifest as ai, KODAX_DEFAULT_TIMEOUT as f, KODAX_HARD_TIMEOUT as g, KODAX_MAX_INCOMPLETE_RETRIES as h, KODAX_MAX_MAXTOKENS_RETRIES as i, KODAX_MAX_RETRIES as j, KODAX_MAX_TOKENS as k, KODAX_RETRY_BASE_DELAY as l, KODAX_STAGGER_DELAY as m, LineageCompaction as o, LineageExtension as r, WORKFLOW_CAPSULE_FORMAT as v, WORKFLOW_CAPSULE_VERSION as w, WORKFLOW_PATTERN_IDS as x };
808
+ export type { WorkflowCapsuleInputs as A, WorkflowCapsuleIntent as B, CompactionContext as C, WorkflowCapsuleProvenance as E, WorkflowCapsuleRequirements as F, WorkflowPatternId as G, WorkflowScriptManifest as H, CompactionEntry as a, CompactionEntryPayload as b, CompactionPolicy as c, CreateWorkflowCapsuleInput as d, DefaultSummaryCompactionOptions as e, LineageArtifactLedgerPayload as n, LineageCompactionDelegates as p, LineageEntryType as q, LineageLabelPayload as s, LineageTreeNode as t, PolicyCompactionResult as u, WorkflowCapsule as y, WorkflowCapsuleEnvironmentRequirement as z };