@kodax-ai/kodax 0.7.63 → 0.7.67

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 (84) hide show
  1. package/CHANGELOG.md +2390 -2189
  2. package/README.md +118 -16
  3. package/README_CN.md +78 -12
  4. package/dist/chunks/{agent-SL444XLN.js → agent-E4V5SLX6.js} +1 -1
  5. package/dist/chunks/argument-completer-N6RT5KYT.js +2 -0
  6. package/dist/chunks/{chunk-ARUWXX25.js → chunk-35P7QL2Q.js} +1 -1
  7. package/dist/chunks/chunk-AKMXJSGM.js +56 -0
  8. package/dist/chunks/{chunk-L3MF5V64.js → chunk-CW32NQFO.js} +1 -1
  9. package/dist/chunks/{chunk-KCFVGXVK.js → chunk-DEICMTHO.js} +9 -9
  10. package/dist/chunks/{chunk-7MPU7TP6.js → chunk-EN3O2C43.js} +270 -270
  11. package/dist/chunks/chunk-KBBGDRER.js +22 -0
  12. package/dist/chunks/chunk-NVDK375I.js +729 -0
  13. package/dist/chunks/{chunk-S4GVQO3W.js → chunk-O7N22GJ3.js} +1 -1
  14. package/dist/chunks/chunk-ONUPGMER.js +2 -0
  15. package/dist/chunks/{chunk-ZL5CEANW.js → chunk-PZTG2C33.js} +1 -1
  16. package/dist/chunks/chunk-QI6SQ2UQ.js +306 -0
  17. package/dist/chunks/{chunk-6OZ5KWG3.js → chunk-QJJKMNZF.js} +1 -1
  18. package/dist/chunks/chunk-RS2GAABJ.js +328 -0
  19. package/dist/chunks/chunk-W2XMNYLK.js +15 -0
  20. package/dist/chunks/chunk-WCSSXBHR.js +419 -0
  21. package/dist/chunks/chunk-YH5BTUQO.js +343 -0
  22. package/dist/chunks/{chunk-UA744TZM.js → chunk-YRBNXFHY.js} +1 -1
  23. package/dist/chunks/compaction-config-56NO42ZI.js +2 -0
  24. package/dist/chunks/{construction-bootstrap-EFZBONTK.js → construction-bootstrap-GLEHQ2KB.js} +1 -1
  25. package/dist/chunks/{devtools-4CRULTR2.js → devtools-CD6KSIHE.js} +1 -1
  26. package/dist/chunks/{devtools-YINBSZC7.js → devtools-XR5F2C6T.js} +1 -1
  27. package/dist/chunks/{dist-73L4OYPD.js → dist-4PXB7U22.js} +1 -1
  28. package/dist/chunks/dist-4UIRSSFS.js +2 -0
  29. package/dist/chunks/host-DMREFNSO.js +2 -0
  30. package/dist/chunks/{paste-FDYM7SZX.js → paste-C33GZQV5.js} +1 -1
  31. package/dist/chunks/run-manager-P5XMSGZ7.js +2 -0
  32. package/dist/chunks/utils-JENPFKAE.js +2 -0
  33. package/dist/constructed-handler-worker.js +2 -0
  34. package/dist/index.d.ts +25 -11
  35. package/dist/index.js +6 -6
  36. package/dist/kodax_cli.js +1282 -1232
  37. package/dist/runtime-worker.js +2872 -0
  38. package/dist/sdk-agent.d.ts +46 -10
  39. package/dist/sdk-agent.js +1 -1
  40. package/dist/sdk-coding.d.ts +337 -1020
  41. package/dist/sdk-coding.js +1 -1
  42. package/dist/sdk-llm.js +1 -1
  43. package/dist/sdk-mcp.d.ts +2 -1
  44. package/dist/sdk-mcp.js +1 -1
  45. package/dist/sdk-media.js +1 -1
  46. package/dist/sdk-repl.d.ts +208 -185
  47. package/dist/sdk-repl.js +2 -2
  48. package/dist/sdk-runtime.d.ts +1070 -0
  49. package/dist/sdk-runtime.js +2 -0
  50. package/dist/sdk-session.d.ts +4 -4
  51. package/dist/sdk-session.js +1 -1
  52. package/dist/sdk-skills.js +1 -1
  53. package/dist/semantic-worker.js +191 -10
  54. package/dist/types-chunks/{bash-prefix-extractor.d-CZW9fRoa.d.ts → bash-prefix-extractor.d-D57Gt6n8.d.ts} +186 -12
  55. package/dist/types-chunks/{run-manager.d-CYTnWhZY.d.ts → capsule.d-BZmqu_HL.d.ts} +5 -92
  56. package/dist/types-chunks/commands.d-Cg26ud-Y.d.ts +213 -0
  57. package/dist/types-chunks/{types.d-1CnTg7Sd.d.ts → guardrail.d-Ds7JHxR1.d.ts} +3 -128
  58. package/dist/types-chunks/{guardrail.d-MR6LwMB2.d.ts → guardrail.d-vSaBe64I.d.ts} +3 -3
  59. package/dist/types-chunks/{manager.d-DBD7SOTT.d.ts → manager.d-Zum9cGHU.d.ts} +3 -173
  60. package/dist/types-chunks/oauth-login.d-Bgb4rdLN.d.ts +174 -0
  61. package/dist/types-chunks/public-api.d-CPBMPDiU.d.ts +602 -0
  62. package/dist/types-chunks/run-manager.d-lnwnfyNC.d.ts +91 -0
  63. package/dist/types-chunks/{sdk-session-RBSBBKol.d.ts → sdk-session-ByoMLoUS.d.ts} +8 -306
  64. package/dist/types-chunks/{process.d-CY2g03Mb.d.ts → types.d-DG9B4SMm.d.ts} +369 -4
  65. package/dist/types-chunks/types.d-DU9lLkmE.d.ts +128 -0
  66. package/dist/types-chunks/types.d-DYv3a1ka.d.ts +975 -0
  67. package/dist/types-chunks/{utils.d-C14jZ9ZM.d.ts → utils.d-DMI-9GTR.d.ts} +88 -72
  68. package/docs/SDK_EMBEDDER_GUIDE.md +3079 -0
  69. package/package.json +8 -1
  70. package/dist/chunks/argument-completer-EN63ZVJK.js +0 -2
  71. package/dist/chunks/chunk-4MIHVNB7.js +0 -405
  72. package/dist/chunks/chunk-HP4FXMEM.js +0 -18
  73. package/dist/chunks/chunk-KHICMJIR.js +0 -310
  74. package/dist/chunks/chunk-LGR7ACBQ.js +0 -326
  75. package/dist/chunks/chunk-RR7W7UF6.js +0 -341
  76. package/dist/chunks/chunk-UGTK2JIJ.js +0 -731
  77. package/dist/chunks/chunk-V4WSBIXB.js +0 -2
  78. package/dist/chunks/chunk-VSWROENP.js +0 -52
  79. package/dist/chunks/compaction-config-4VIONMFB.js +0 -2
  80. package/dist/chunks/dist-EDF2YUF6.js +0 -2
  81. package/dist/chunks/host-J4HPDLFC.js +0 -2
  82. package/dist/chunks/run-manager-ZVSW2OWM.js +0 -2
  83. package/dist/chunks/utils-5HDLYTZJ.js +0 -2
  84. package/dist/types-chunks/storage.d-C6kkAEch.d.ts +0 -280
@@ -1,5 +1,5 @@
1
- import { _ as KodaXGoalState, h as AgentMessage, bM as StopHookFn, af as KodaXSessionLineage, a4 as KodaXJsonValue, U as KodaXExtensionSessionRecord, f as Agent, c8 as WorkflowIsolation, V as KodaXExtensionSessionState, a6 as KodaXSessionArtifactLedgerEntry, bx as SessionErrorMetadata, al as KodaXSessionScope, am as KodaXSessionStorage, a2 as KodaXInputArtifact, C as ChildTaskRegistry, c5 as WorkflowEventCorrelation, x as CompactionUpdate, ch as WorkflowProcessEvent, c4 as WorkflowEvent, q as AskUserQuestionOptions, m as AskUserAnswer, o as AskUserMultiOptions, b0 as MemoryReviewPlan, b1 as MemoryReviewRunner, J as Guardrail, B as DiscoveredInstance, bQ as TaskAbortRegistry } from './process.d-CY2g03Mb.js';
2
- import { $ as KodaXTokenUsage, j as KodaXMessage, a8 as KodaXWireReasoningEffort, T as KodaXTaskRoutingDecision, U as KodaXTaskType, V as KodaXTaskWorkIntent, P as KodaXTaskComplexity, J as KodaXRiskLevel, g as KodaXHarnessProfile, e as KodaXExecutionMode, b as KodaXChildFanoutClass, E as KodaXReasoningMode, I as KodaXReviewScale } from './types.d-Bp4Lm1jv.js';
1
+ import { aN as KodaXGoalState, I as AgentMessage, cB as StopHookFn, b2 as KodaXSessionLineage, aT as KodaXJsonValue, aH as KodaXExtensionSessionRecord, f as Agent, cZ as WorkflowIsolation, aI as KodaXExtensionSessionState, aV as KodaXSessionArtifactLedgerEntry, cm as SessionErrorMetadata, b8 as KodaXSessionScope, b9 as KodaXSessionStorage, aR as KodaXInputArtifact, B as AgentExecutorPlaneBinding, a6 as ChildTaskRegistry, cW as WorkflowEventCorrelation, ac as CompactionUpdate, d6 as WorkflowProcessEvent, cV as WorkflowEvent, a3 as AskUserQuestionOptions, $ as AskUserAnswer, a1 as AskUserMultiOptions, bR as MemoryReviewPlan, bS as MemoryReviewRunner, aw as Guardrail, ah as DiscoveredInstance, cF as TaskAbortRegistry } from './types.d-DG9B4SMm.js';
2
+ import { $ as KodaXTokenUsage, j as KodaXMessage, a0 as KodaXToolDefinition, a8 as KodaXWireReasoningEffort, T as KodaXTaskRoutingDecision, U as KodaXTaskType, V as KodaXTaskWorkIntent, P as KodaXTaskComplexity, J as KodaXRiskLevel, g as KodaXHarnessProfile, e as KodaXExecutionMode, b as KodaXChildFanoutClass, E as KodaXReasoningMode, I as KodaXReviewScale } from './types.d-Bp4Lm1jv.js';
3
3
  import { d as SkillDynamicContextExecutor } from './types.d-vJExiRje.js';
4
4
  import { Diagnostic, Position, Location, Hover, DocumentSymbol, SymbolInformation, WorkspaceSymbol, CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall } from 'vscode-languageserver-protocol';
5
5
  import { K as KodaXLlmTimeoutConfig, a as CostTracker } from './cost-tracker.d-CBLk1fiD.js';
@@ -1130,6 +1130,134 @@ interface KodaXTimeoutConfig {
1130
1130
  }
1131
1131
  declare function providerResilienceConfigFromTimeouts(timeouts: KodaXTimeoutConfig | undefined): ProviderResilienceConfig | undefined;
1132
1132
 
1133
+ type RuntimeContextOptimizationProfile = 'off' | 'report_only' | 'balanced' | 'small_window' | 'aggressive';
1134
+ type RuntimeContextPressure = 'low' | 'medium' | 'high' | 'critical';
1135
+ interface RuntimeContextBudgetBreakdown {
1136
+ readonly systemPrompt: number;
1137
+ readonly toolSchemas: number;
1138
+ readonly skillCatalog: number;
1139
+ readonly mcpCatalog: number;
1140
+ readonly transcript: number;
1141
+ readonly pendingInput: number;
1142
+ readonly recentToolResults: number;
1143
+ readonly reservedResponse: number;
1144
+ readonly total: number;
1145
+ }
1146
+ interface RuntimeContextBudgetSnapshot {
1147
+ readonly sessionId?: string;
1148
+ readonly runId?: string;
1149
+ readonly turnId?: string;
1150
+ readonly provider?: string;
1151
+ readonly model?: string;
1152
+ readonly profile: RuntimeContextOptimizationProfile;
1153
+ readonly contextWindow: number;
1154
+ readonly smallWindow: boolean;
1155
+ readonly pressure: RuntimeContextPressure;
1156
+ readonly tokenBreakdown: RuntimeContextBudgetBreakdown;
1157
+ readonly usedTokens: number;
1158
+ readonly availableTokens: number;
1159
+ readonly usedRatio: number;
1160
+ readonly toolSchemaRatio: number;
1161
+ readonly recommendations: readonly RuntimeContextBudgetRecommendation[];
1162
+ readonly createdAt: string;
1163
+ }
1164
+ type RuntimeContextBudgetRecommendation = 'prefer_progressive_tool_exposure' | 'compact_or_summarize_history' | 'trim_recent_tool_results' | 'reserve_response_budget';
1165
+ interface RuntimeContextBudgetSnapshotInput {
1166
+ readonly sessionId?: string;
1167
+ readonly runId?: string;
1168
+ readonly turnId?: string;
1169
+ readonly provider?: string;
1170
+ readonly model?: string;
1171
+ readonly profile?: RuntimeContextOptimizationProfile;
1172
+ readonly contextWindow: number;
1173
+ readonly systemPrompt?: string;
1174
+ readonly toolDefinitions?: readonly KodaXToolDefinition[];
1175
+ readonly skillCatalogText?: string;
1176
+ readonly mcpCatalogText?: string;
1177
+ readonly messages?: readonly KodaXMessage[];
1178
+ readonly pendingInput?: string;
1179
+ readonly recentToolResults?: readonly string[];
1180
+ readonly reservedResponseTokens?: number;
1181
+ readonly now?: () => Date;
1182
+ }
1183
+ declare function estimateToolSchemaTokens(definition: KodaXToolDefinition, descriptionOverride?: string): number;
1184
+ declare function createRuntimeContextBudgetSnapshot(input: RuntimeContextBudgetSnapshotInput): RuntimeContextBudgetSnapshot;
1185
+
1186
+ type RuntimeToolExposureMode = 'resident' | 'hint' | 'bridge' | 'native_deferred' | 'hidden';
1187
+ type RuntimeToolExposureReason = 'profile_off' | 'protected_core' | 'already_unlocked' | 'low_pressure' | 'deferred_hint' | 'portable_bridge' | 'native_deferred' | 'bridge_unavailable';
1188
+ interface RuntimeToolExposureDecision {
1189
+ readonly toolName: string;
1190
+ readonly mode: RuntimeToolExposureMode;
1191
+ readonly recommendedMode: RuntimeToolExposureMode;
1192
+ readonly reason: RuntimeToolExposureReason;
1193
+ readonly estimatedTokensBefore: number;
1194
+ readonly estimatedTokensAfter: number;
1195
+ readonly estimatedTokensIfApplied: number;
1196
+ readonly modelVisible: boolean;
1197
+ }
1198
+ interface RuntimeToolExposurePlan {
1199
+ readonly profile: RuntimeContextOptimizationProfile;
1200
+ readonly reportOnly: boolean;
1201
+ readonly pressure: RuntimeContextPressure;
1202
+ readonly bridgeAvailable: boolean;
1203
+ readonly nativeDeferredAvailable: boolean;
1204
+ readonly decisions: readonly RuntimeToolExposureDecision[];
1205
+ readonly modelVisibleToolNames: readonly string[];
1206
+ readonly estimatedToolSchemaTokensBefore: number;
1207
+ readonly estimatedToolSchemaTokensAfter: number;
1208
+ readonly estimatedToolSchemaTokensIfApplied: number;
1209
+ readonly estimatedTokensSaved: number;
1210
+ readonly estimatedTokensSavedIfApplied: number;
1211
+ readonly residentToolCount: number;
1212
+ readonly hintedToolCount: number;
1213
+ readonly bridgeToolCount: number;
1214
+ readonly nativeDeferredToolCount: number;
1215
+ readonly hiddenToolCount: number;
1216
+ }
1217
+ interface RuntimeToolExposurePlanInput {
1218
+ readonly tools: readonly KodaXToolDefinition[];
1219
+ readonly budget: RuntimeContextBudgetSnapshot;
1220
+ readonly profile?: RuntimeContextOptimizationProfile;
1221
+ readonly bridgeAvailable?: boolean;
1222
+ readonly nativeDeferredAvailable?: boolean;
1223
+ readonly unlockedDeferredTools?: ReadonlySet<string>;
1224
+ }
1225
+ declare const ALWAYS_RESIDENT_TOOL_NAMES: ReadonlySet<string>;
1226
+ declare function planToolExposure(input: RuntimeToolExposurePlanInput): RuntimeToolExposurePlan;
1227
+
1228
+ interface CompactionAntiThrashState {
1229
+ readonly lowSavingsStreak: number;
1230
+ readonly cooldownTurnsRemaining: number;
1231
+ }
1232
+ interface CompactionSavingsSample {
1233
+ readonly tokensBefore: number;
1234
+ readonly tokensAfter: number;
1235
+ }
1236
+ interface CompactionAntiThrashConfig {
1237
+ readonly lowSavingsRatio?: number;
1238
+ readonly lowSavingsStreakLimit?: number;
1239
+ readonly cooldownTurns?: number;
1240
+ }
1241
+ interface CompactionSavingsDecision {
1242
+ readonly state: CompactionAntiThrashState;
1243
+ readonly savingsRatio: number;
1244
+ readonly lowSavings: boolean;
1245
+ readonly enteredCooldown: boolean;
1246
+ }
1247
+ type CompactionSkipReason = 'low_savings_cooldown';
1248
+ interface RuntimeCompactionSkippedEvent {
1249
+ readonly reason: CompactionSkipReason;
1250
+ readonly currentTokens: number;
1251
+ readonly contextWindow: number;
1252
+ readonly triggerPercent: number;
1253
+ readonly cooldownTurnsRemaining: number;
1254
+ readonly lowSavingsStreak: number;
1255
+ }
1256
+ declare function createCompactionAntiThrashState(): CompactionAntiThrashState;
1257
+ declare function shouldSkipLlmCompaction(state: CompactionAntiThrashState | undefined): boolean;
1258
+ declare function consumeCompactionCooldown(state: CompactionAntiThrashState | undefined): CompactionAntiThrashState;
1259
+ declare function recordCompactionSavings(state: CompactionAntiThrashState | undefined, sample: CompactionSavingsSample, config?: CompactionAntiThrashConfig): CompactionSavingsDecision;
1260
+
1133
1261
  /**
1134
1262
  * FEATURE_093 (v0.7.24): minimal contract interfaces for the coding extension
1135
1263
  * runtime. Extracted so `@kodax-ai/coding/src/types.ts` can reference the
@@ -1709,6 +1837,12 @@ interface KodaXEvents {
1709
1837
  effort: string;
1710
1838
  } & Partial<KodaXLiveEventMeta>) => void;
1711
1839
  onRepoIntelligenceTrace?: (event: KodaXRepoIntelligenceTraceEvent & Partial<KodaXLiveEventMeta>) => void;
1840
+ /** Optional bounded context diagnostics. Emitted only when context.contextDiagnostics is true. */
1841
+ onContextBudgetSnapshot?: (event: RuntimeContextBudgetSnapshot & Partial<KodaXLiveEventMeta>) => void;
1842
+ /** Optional bounded tool-exposure diagnostics. Emitted only when context.contextDiagnostics is true. */
1843
+ onToolExposurePlanned?: (event: RuntimeToolExposurePlan & Partial<KodaXLiveEventMeta>) => void;
1844
+ /** Optional bounded compaction-pressure diagnostics. Emitted only when context.contextDiagnostics is true. */
1845
+ onContextCompactionSkipped?: (event: RuntimeCompactionSkippedEvent & Partial<KodaXLiveEventMeta>) => void;
1712
1846
  /**
1713
1847
  * Fired when the Sidecar Verifier produces an actionable message.
1714
1848
  *
@@ -2039,14 +2173,9 @@ interface KodaXChildContextBundle {
2039
2173
  constraints: string[];
2040
2174
  readOnly: boolean;
2041
2175
  /**
2042
- * FEATURE_120 v0.7.39 Phase 4 optional model tier hint that the
2043
- * dispatching agent provides as a UX signal. Routing is a **no-op**
2044
- * for now: every child runs on the parent's model regardless of
2045
- * hint. FEATURE_102 (v0.7.45 capability profile) is the planned
2046
- * consumer that will translate `'fast' | 'balanced' | 'deep'` to a
2047
- * concrete provider/model selection. The field is surfaced + parsed
2048
- * now so prompt-eval data starts accumulating; the routing wire-up
2049
- * lands separately.
2176
+ * FEATURE_102 / FEATURE_259semantic model tier intent. The runtime maps
2177
+ * configured `fast`/`deep` tiers to concrete routes and safely inherits the
2178
+ * parent when a tier is unavailable or ineligible.
2050
2179
  */
2051
2180
  modelHint?: KodaXChildModelHint;
2052
2181
  /**
@@ -2082,6 +2211,11 @@ interface KodaXChildContextBundle {
2082
2211
  * one bounded repair turn) and surfaces it on `KodaXChildAgentResult.structured`.
2083
2212
  */
2084
2213
  outputSchema?: unknown;
2214
+ /** Trusted host provenance plus the generated script's terse-result declaration. */
2215
+ workflowOutputContract?: {
2216
+ readonly kodaxAuthored: boolean;
2217
+ readonly terseResult: boolean;
2218
+ };
2085
2219
  }
2086
2220
  /**
2087
2221
  * FEATURE_120 v0.7.39 Phase 4 — model tier hint. Tier semantics:
@@ -2094,6 +2228,26 @@ interface KodaXChildContextBundle {
2094
2228
  * unknown values silently with a tolerant fallback to `undefined`).
2095
2229
  */
2096
2230
  type KodaXChildModelHint = 'fast' | 'balanced' | 'deep';
2231
+ type KodaXChildTierOutcome = 'applied' | 'balanced-parent' | 'fast-write-ineligible' | 'unconfigured' | 'shadowed-by-selector' | 'inherited';
2232
+ type KodaXChildRouteSource = 'explicit' | 'specialist' | 'tier' | 'parent' | 'default';
2233
+ interface KodaXChildRouteFacts {
2234
+ readonly requestedTier: KodaXChildModelHint | 'inherited';
2235
+ readonly tierOutcome: KodaXChildTierOutcome;
2236
+ readonly providerSource: KodaXChildRouteSource;
2237
+ readonly modelSource?: Exclude<KodaXChildRouteSource, 'default'>;
2238
+ readonly initialProvider?: string;
2239
+ readonly initialModel?: string;
2240
+ readonly finalProvider?: string;
2241
+ readonly finalModel?: string;
2242
+ readonly resolvedEffort?: string;
2243
+ readonly fallbackReason?: string;
2244
+ readonly iterations?: number;
2245
+ readonly inputTokens?: number;
2246
+ readonly cacheReadTokens?: number;
2247
+ readonly outputTokens?: number;
2248
+ readonly digestTokens?: number;
2249
+ readonly durationMs?: number;
2250
+ }
2097
2251
  interface KodaXChildAgentResult {
2098
2252
  childId: string;
2099
2253
  fanoutClass: KodaXChildFanoutClass;
@@ -2117,6 +2271,17 @@ interface KodaXChildAgentResult {
2117
2271
  actualIterations?: number;
2118
2272
  /** Best-known token usage for this child run. Used by workflow budget accounting. */
2119
2273
  totalTokensUsed?: number;
2274
+ /** Token usage attributable only to the optional presentation digest call. */
2275
+ digestTokensUsed?: number;
2276
+ /** Provider-reported usage for the optional digest call (diagnostic subset of totalTokensUsed). */
2277
+ digestUsage?: {
2278
+ readonly inputTokens?: number;
2279
+ readonly outputTokens?: number;
2280
+ readonly totalTokens?: number;
2281
+ readonly cacheReadTokens?: number;
2282
+ };
2283
+ /** Correlated model-tier and fallback facts for cost/quality reporting. */
2284
+ routeFacts?: KodaXChildRouteFacts;
2120
2285
  /** True when the child exhausted its iteration budget before completing. */
2121
2286
  limitReached?: boolean;
2122
2287
  /**
@@ -2397,6 +2562,11 @@ interface KodaXContextOptions {
2397
2562
  repoIntelligenceMode?: KodaXRepoIntelligenceMode;
2398
2563
  /** Optional repo-intelligence trace toggle for this run. */
2399
2564
  repoIntelligenceTrace?: boolean;
2565
+ /**
2566
+ * Optional runtime-context diagnostics for SDK/daemon hosts. When false or
2567
+ * omitted, no extra budget/exposure calculation is performed.
2568
+ */
2569
+ contextDiagnostics?: boolean;
2400
2570
  disableAutoTaskReroute?: boolean;
2401
2571
  /**
2402
2572
  * FEATURE_087/088 (v0.7.28): when true, the prompt builder injects a
@@ -2423,6 +2593,8 @@ interface KodaXContextOptions {
2423
2593
  * lookups use the legacy process-global registry.
2424
2594
  */
2425
2595
  agentScope?: KodaXAgentScope;
2596
+ /** FEATURE_258: host-bound external-agent plane and non-model dispatch context. */
2597
+ agentExecutorPlane?: AgentExecutorPlaneBinding;
2426
2598
  /** Optional task-engine surface label used to track managed tasks across UX entry points. */
2427
2599
  taskSurface?: KodaXTaskSurface;
2428
2600
  /**
@@ -2974,6 +3146,8 @@ interface KodaXToolExecutionContext {
2974
3146
  agentProfile?: KodaXAgentProfile;
2975
3147
  /** Scoped specialist-agent resolver inherited from KodaXOptions.context. */
2976
3148
  agentScope?: KodaXAgentScope;
3149
+ /** FEATURE_258: external dispatch capability; absent keeps the tool surface unchanged. */
3150
+ agentExecutorPlane?: AgentExecutorPlaneBinding;
2977
3151
  /** FEATURE_221: SDK-consumer self-manual injection, forwarded from KodaXOptions. */
2978
3152
  selfManual?: KodaXSelfManualConfig;
2979
3153
  /** FEATURE_222 skill security — host policy for skill `!`cmd`` dynamic-context,
@@ -3539,5 +3713,5 @@ interface CreateBashPrefixExtractorOptions {
3539
3713
  */
3540
3714
  declare function createBashPrefixExtractor(opts: CreateBashPrefixExtractorOptions): BashPrefixExtractor;
3541
3715
 
3542
- export { BASH_POLICY_SPEC as B, LSP_SERVERS as aC, LspService as aE, buildGoalRuntimeBinding as b7, createBashPrefixExtractor as b8, decideWorkflowInvocation as b9, drainPendingSwaps as ba, extractCommandPrefix as bb, getDefaultLspService as bc, hasPendingSwap as bd, makeDisabledGoalToolsContext as be, providerResilienceConfigFromTimeouts as bf, resolveConstructedAgent as bg, shutdownDefaultLspService as bh, withGoalBeforeNextTurn as bi, withGoalStopHook as bj, workflowStartOutcomeConsumesTurn as bk };
3543
- export type { KodaXResult as $, KodaXManagedBudgetSnapshot as A, CapabilityRuntimeContract as C, DiagnosticsRequest as D, ExtensionRuntimeContract as E, FailureStage as F, GoalBlockedResult as G, KodaXManagedProtocolPayload as H, KodaXManagedTask as I, KodaXManagedTaskRuntimeState as J, KodaXActivityEventMeta as K, KodaXManagedTaskStatusEvent as L, KodaXManualSource as M, KodaXManualTopic as N, KodaXManualTopicId as O, KodaXManualTopicInput as P, KodaXMemoryStrategy as Q, KodaXOptions as R, KodaXOrchestrationVerdict as S, KodaXParentReductionContract as T, KodaXProviderPolicyHints as U, KodaXRepoIntelligenceCapability as V, KodaXRepoIntelligenceMode as W, KodaXRepoIntelligenceResolvedMode as X, KodaXRepoIntelligenceTrace as Y, KodaXRepoIntelligenceTraceEvent as Z, KodaXRepoRoutingSignals as _, BashPrefixExtractor as a, WorkflowInvocationPolicyInput as a$, KodaXRoleRoundSummary as a0, KodaXRuntimeVerificationContract as a1, KodaXSelfManualConfig as a2, KodaXSessionControl as a3, KodaXSessionMutators as a4, KodaXSessionOptions as a5, KodaXSidecarMessageEvent as a6, KodaXSkillDynamicContextPolicy as a7, KodaXSkillInvocationContext as a8, KodaXSkillMap as a9, KodaXWorkflowEventMeta as aA, KodaXWorkflowTimeoutConfig as aB, LspServerInfo as aD, LspServiceConfig as aF, ProviderExecutionState as aG, ProviderRecoveryEvent as aH, ProviderResilienceConfig as aI, ProviderResiliencePolicy as aJ, RecoveryAction as aK, RecoveryDecision as aL, RecoveryLadderStep as aM, RecoveryResult as aN, ResilienceClassification as aO, ResilienceErrorClass as aP, ResolveKodaXManualInput as aQ, ResolveKodaXManualOptions as aR, ResolveKodaXManualResult as aS, RuntimeDefaultsSnapshot as aT, TodoItem as aU, TodoList as aV, TodoStatus as aW, ToolSideEffect as aX, WorkflowHostPolicy as aY, WorkflowInvocationAction as aZ, WorkflowInvocationPolicyDecision as a_, KodaXSkillProjectionConfidence as aa, KodaXTaskCapabilityHint as ab, KodaXTaskContract as ac, KodaXTaskEvidenceArtifact as ad, KodaXTaskEvidenceBundle as ae, KodaXTaskEvidenceEntry as af, KodaXTaskRole as ag, KodaXTaskRoleAssignment as ah, KodaXTaskStatus as ai, KodaXTaskSurface as aj, KodaXTaskToolPolicy as ak, KodaXTaskVerificationContract as al, KodaXTaskVerificationCriterion as am, KodaXTaskWorkItem as an, KodaXTimeoutConfig as ao, KodaXToolEventMeta as ap, KodaXToolExecutionContext as aq, KodaXToolVisibilityMeta as ar, KodaXToolVisibilityPolicy as as, KodaXTurnCompletedEvent as at, KodaXTurnDeliveryKind as au, KodaXTurnFailedEvent as av, KodaXTurnStartedEvent as aw, KodaXVerificationScorecard as ax, KodaXVerificationScorecardCriterion as ay, KodaXWorkflowAgentDigestEvent as az, BashPrefixResult as b, WorkflowInvocationSource as b0, WorkflowRunProgressView as b1, WorkflowStartOutcome as b2, WorkflowToolHost as b3, WorkflowToolHostInlineInput as b4, WorkflowToolHostResult as b5, WorkflowToolHostStartResult as b6, BoundExtensionRuntimeController as c, ChildSnapshotEvent as d, CreateBashPrefixExtractorOptions as e, ExtractCommandPrefixOptions as f, GoalCompleteResult as g, GoalCreateInput as h, GoalLifecycleContext as i, GoalRuntimeBinding as j, GoalRuntimeBindingDeps as k, GoalToolsContext as l, KodaXAgentMode as m, KodaXAgentProfile as n, KodaXAgentScope as o, KodaXBudgetDisclosureZone as p, KodaXBudgetExtensionRequest as q, KodaXChildAgentResult as r, KodaXChildContextBundle as s, KodaXChildExecutionResult as t, KodaXCompactionOverride as u, KodaXContextOptions as v, KodaXContextTokenSnapshot as w, KodaXEffectiveTaskConfig as x, KodaXEvents as y, KodaXLiveEventMeta as z };
3716
+ export { ALWAYS_RESIDENT_TOOL_NAMES as A, BASH_POLICY_SPEC as B, LSP_SERVERS as aI, LspService as aK, makeDisabledGoalToolsContext as bA, planToolExposure as bB, providerResilienceConfigFromTimeouts as bC, recordCompactionSavings as bD, resolveConstructedAgent as bE, shouldSkipLlmCompaction as bF, shutdownDefaultLspService as bG, withGoalBeforeNextTurn as bH, withGoalStopHook as bI, workflowStartOutcomeConsumesTurn as bJ, buildGoalRuntimeBinding as bp, consumeCompactionCooldown as bq, createBashPrefixExtractor as br, createCompactionAntiThrashState as bs, createRuntimeContextBudgetSnapshot as bt, decideWorkflowInvocation as bu, drainPendingSwaps as bv, estimateToolSchemaTokens as bw, extractCommandPrefix as bx, getDefaultLspService as by, hasPendingSwap as bz };
3717
+ export type { KodaXRepoIntelligenceCapability as $, CapabilityRuntimeContract as C, DiagnosticsRequest as D, ExtensionRuntimeContract as E, FailureStage as F, GoalBlockedResult as G, KodaXContextOptions as H, KodaXContextTokenSnapshot as I, KodaXEffectiveTaskConfig as J, KodaXActivityEventMeta as K, KodaXEvents as L, KodaXLiveEventMeta as M, KodaXManagedBudgetSnapshot as N, KodaXManagedProtocolPayload as O, KodaXManagedTask as P, KodaXManagedTaskRuntimeState as Q, KodaXManagedTaskStatusEvent as R, KodaXManualSource as S, KodaXManualTopic as T, KodaXManualTopicId as U, KodaXManualTopicInput as V, KodaXMemoryStrategy as W, KodaXOptions as X, KodaXOrchestrationVerdict as Y, KodaXParentReductionContract as Z, KodaXProviderPolicyHints as _, BashPrefixExtractor as a, RuntimeContextBudgetRecommendation as a$, KodaXRepoIntelligenceMode as a0, KodaXRepoIntelligenceResolvedMode as a1, KodaXRepoIntelligenceTrace as a2, KodaXRepoIntelligenceTraceEvent as a3, KodaXRepoRoutingSignals as a4, KodaXResult as a5, KodaXRoleRoundSummary as a6, KodaXRuntimeVerificationContract as a7, KodaXSelfManualConfig as a8, KodaXSessionControl as a9, KodaXTurnDeliveryKind as aA, KodaXTurnFailedEvent as aB, KodaXTurnStartedEvent as aC, KodaXVerificationScorecard as aD, KodaXVerificationScorecardCriterion as aE, KodaXWorkflowAgentDigestEvent as aF, KodaXWorkflowEventMeta as aG, KodaXWorkflowTimeoutConfig as aH, LspServerInfo as aJ, LspServiceConfig as aL, ProviderExecutionState as aM, ProviderRecoveryEvent as aN, ProviderResilienceConfig as aO, ProviderResiliencePolicy as aP, RecoveryAction as aQ, RecoveryDecision as aR, RecoveryLadderStep as aS, RecoveryResult as aT, ResilienceClassification as aU, ResilienceErrorClass as aV, ResolveKodaXManualInput as aW, ResolveKodaXManualOptions as aX, ResolveKodaXManualResult as aY, RuntimeCompactionSkippedEvent as aZ, RuntimeContextBudgetBreakdown as a_, KodaXSessionMutators as aa, KodaXSessionOptions as ab, KodaXSidecarMessageEvent as ac, KodaXSkillDynamicContextPolicy as ad, KodaXSkillInvocationContext as ae, KodaXSkillMap as af, KodaXSkillProjectionConfidence as ag, KodaXTaskCapabilityHint as ah, KodaXTaskContract as ai, KodaXTaskEvidenceArtifact as aj, KodaXTaskEvidenceBundle as ak, KodaXTaskEvidenceEntry as al, KodaXTaskRole as am, KodaXTaskRoleAssignment as an, KodaXTaskStatus as ao, KodaXTaskSurface as ap, KodaXTaskToolPolicy as aq, KodaXTaskVerificationContract as ar, KodaXTaskVerificationCriterion as as, KodaXTaskWorkItem as at, KodaXTimeoutConfig as au, KodaXToolEventMeta as av, KodaXToolExecutionContext as aw, KodaXToolVisibilityMeta as ax, KodaXToolVisibilityPolicy as ay, KodaXTurnCompletedEvent as az, BashPrefixResult as b, RuntimeContextBudgetSnapshot as b0, RuntimeContextBudgetSnapshotInput as b1, RuntimeContextOptimizationProfile as b2, RuntimeContextPressure as b3, RuntimeDefaultsSnapshot as b4, RuntimeToolExposureDecision as b5, RuntimeToolExposureMode as b6, RuntimeToolExposurePlan as b7, RuntimeToolExposurePlanInput as b8, RuntimeToolExposureReason as b9, TodoItem as ba, TodoList as bb, TodoStatus as bc, ToolSideEffect as bd, WorkflowHostPolicy as be, WorkflowInvocationAction as bf, WorkflowInvocationPolicyDecision as bg, WorkflowInvocationPolicyInput as bh, WorkflowInvocationSource as bi, WorkflowRunProgressView as bj, WorkflowStartOutcome as bk, WorkflowToolHost as bl, WorkflowToolHostInlineInput as bm, WorkflowToolHostResult as bn, WorkflowToolHostStartResult as bo, BoundExtensionRuntimeController as c, ChildSnapshotEvent as d, CompactionAntiThrashConfig as e, CompactionAntiThrashState as f, CompactionSavingsDecision as g, CompactionSavingsSample as h, CompactionSkipReason as i, CreateBashPrefixExtractorOptions as j, ExtractCommandPrefixOptions as k, GoalCompleteResult as l, GoalCreateInput as m, GoalLifecycleContext as n, GoalRuntimeBinding as o, GoalRuntimeBindingDeps as p, GoalToolsContext as q, KodaXAgentMode as r, KodaXAgentProfile as s, KodaXAgentScope as t, KodaXBudgetDisclosureZone as u, KodaXBudgetExtensionRequest as v, KodaXChildAgentResult as w, KodaXChildContextBundle as x, KodaXChildExecutionResult as y, KodaXCompactionOverride as z };
@@ -1,6 +1,6 @@
1
1
  import { j as KodaXMessage } from './types.d-Bp4Lm1jv.js';
2
- import { Q as QueueEventListener, f as QueuedMessage, E as EnqueueInput, D as DequeueFilter } from './types.d-1CnTg7Sd.js';
3
- import { h as AgentMessage, bw as SessionEntry, bu as Session, by as SessionExtension, af as KodaXSessionLineage, a4 as KodaXJsonValue, u as CompactionDetails, T as KodaXCompactMemorySeed, ab as KodaXSessionEntry, an as KodaXSessionTreeNode, ae as KodaXSessionLabelEntry, ad as KodaXSessionGoalEntry, a8 as KodaXSessionClientNoticeEntry, aj as KodaXSessionRewindMarkerEntry, ai as KodaXSessionNavigationOptions, a6 as KodaXSessionArtifactLedgerEntry, H as FileOperations, cb as WorkflowMeta, cc as WorkflowModelHint, cd as WorkflowModule, ct as WorkflowProcessTrackerOptions, c4 as WorkflowEvent, cn as WorkflowProcessSnapshot, ch as WorkflowProcessEvent } from './process.d-CY2g03Mb.js';
2
+ import { Q as QueueEventListener, c as QueuedMessage, E as EnqueueInput, D as DequeueFilter } from './types.d-DU9lLkmE.js';
3
+ import { I as AgentMessage, cl as SessionEntry, cj as Session, cn as SessionExtension, b2 as KodaXSessionLineage, aT as KodaXJsonValue, a9 as CompactionDetails, aG as KodaXCompactMemorySeed, a_ as KodaXSessionEntry, ba as KodaXSessionTreeNode, b1 as KodaXSessionLabelEntry, b0 as KodaXSessionGoalEntry, aX as KodaXSessionClientNoticeEntry, b6 as KodaXSessionRewindMarkerEntry, b5 as KodaXSessionNavigationOptions, aV as KodaXSessionArtifactLedgerEntry, au as FileOperations, d0 as WorkflowMeta, d1 as WorkflowModelHint, d2 as WorkflowModule } from './types.d-DG9B4SMm.js';
4
4
 
5
5
  /**
6
6
  * @kodax-ai/agent Constants
@@ -33,7 +33,7 @@ declare const PROMISE_PATTERN: RegExp;
33
33
  * - 内容文本
34
34
  * - 工具调用和结果
35
35
  */
36
- declare function estimateTokens(messages: KodaXMessage[]): number;
36
+ declare function estimateTokens(messages: readonly KodaXMessage[]): number;
37
37
  /**
38
38
  * 计算单个文本的 token 数量(便捷函数)
39
39
  */
@@ -831,92 +831,5 @@ declare function buildWorkflowCapsuleIntent(manifest: {
831
831
  readonly originalRequest?: string;
832
832
  }): WorkflowCapsuleIntent;
833
833
 
834
- /**
835
- * FEATURE_246 Part A0 (ADR-046) neutral workflow run lifecycle manager.
836
- *
837
- * Domain-neutral run registry + lifecycle (pause / resume / stop), process-event
838
- * tracking, and terminal settle — lifted out of `@kodax-ai/coding` so any agent
839
- * (including non-coding SDK hosts) can host and manage workflow runs.
840
- *
841
- * It never knows HOW a run executes: the caller injects a `runFn` thunk that
842
- * receives lifecycle hooks (`onEvent` / `signal` / `beforeSpawn`) and returns a
843
- * caller-shaped outcome, plus a `classify` mapping that outcome to a neutral
844
- * terminal status and an `onError` that synthesizes a failure outcome. The
845
- * coding layer wires `runFn` to its `runWorkflowModule` / `runWorkflowFromOptions`
846
- * (backend + run-graph + worktrees); SDK hosts wire their own. Dependency arrows
847
- * therefore point only coding → agent — no cycle.
848
- */
849
-
850
- type ManagedWorkflowStatus = 'running' | 'paused' | 'completed' | 'failed' | 'denied' | 'stopped';
851
- /** Provenance/display metadata for a run's process tracker. */
852
- type WorkflowProcessMetadata = Pick<WorkflowProcessTrackerOptions, 'displayName' | 'goal' | 'source' | 'savedWorkflowName' | 'sourceRunId' | 'sourceWorkflowName' | 'revisionOf' | 'resumedFromRunId' | 'hostMetadata'>;
853
- interface ManagedWorkflowSnapshot {
854
- readonly runId: string;
855
- readonly workflow: string;
856
- readonly status: ManagedWorkflowStatus;
857
- readonly totalSpawned: number;
858
- readonly eventCount: number;
859
- readonly startedAt: number;
860
- readonly endedAt?: number;
861
- readonly error?: string;
862
- readonly resultText?: string;
863
- }
864
- interface ManagedWorkflowRun<TOutcome = unknown> {
865
- readonly runId: string;
866
- readonly done: Promise<TOutcome>;
867
- getSnapshot(): ManagedWorkflowSnapshot | undefined;
868
- getProcessSnapshot(): WorkflowProcessSnapshot | undefined;
869
- }
870
- /** Lifecycle hooks the manager injects into the caller's `runFn`. */
871
- interface ManagedRunHooks {
872
- /** Forward every workflow event so the manager can track spawn/progress. */
873
- readonly onEvent: (event: WorkflowEvent) => void;
874
- /** Abort signal owned by the manager (fires on stop()). */
875
- readonly signal: AbortSignal;
876
- /** Await before launching each agent so pause() can gate new spawns. */
877
- readonly beforeSpawn: () => Promise<void>;
878
- }
879
- /** Neutral terminal classification of a caller-shaped outcome. */
880
- interface ManagedRunClassification {
881
- readonly status: 'completed' | 'failed' | 'denied';
882
- readonly error?: Error;
883
- readonly resultText?: string;
884
- }
885
- interface StartManagedRunInput<TOutcome> {
886
- readonly runId: string;
887
- /** Display name (usually the workflow's `meta.name`). */
888
- readonly workflow: string;
889
- readonly phases?: readonly string[];
890
- readonly maxAgents?: number;
891
- readonly plannedAgents?: number;
892
- readonly tokenBudget?: number;
893
- readonly processMetadata?: WorkflowProcessMetadata;
894
- readonly signal?: AbortSignal;
895
- /** Executes the run with the manager's lifecycle hooks injected. */
896
- readonly runFn: (hooks: ManagedRunHooks) => Promise<TOutcome>;
897
- /** Map the caller's terminal outcome to a neutral status for the snapshot. */
898
- readonly classify: (outcome: TOutcome) => ManagedRunClassification;
899
- /** Synthesize a caller-shaped outcome when `runFn` throws. */
900
- readonly onError: (error: unknown) => TOutcome;
901
- }
902
- interface WorkflowRunManager {
903
- start<TOutcome>(input: StartManagedRunInput<TOutcome>): ManagedWorkflowRun<TOutcome>;
904
- list(): readonly ManagedWorkflowSnapshot[];
905
- get(runId: string): ManagedWorkflowSnapshot | undefined;
906
- subscribeWorkflowProcess(listener: (event: WorkflowProcessEvent) => void): () => void;
907
- getWorkflowProcessSnapshot(runId: string): WorkflowProcessSnapshot | undefined;
908
- listWorkflowProcessSnapshots(options?: {
909
- readonly activeOnly?: boolean;
910
- readonly limit?: number;
911
- }): readonly WorkflowProcessSnapshot[];
912
- pause(runId: string): boolean;
913
- resume(runId: string): boolean;
914
- stop(runId: string, reason?: string): boolean;
915
- }
916
- declare function createWorkflowRunManager(deps?: {
917
- readonly now?: () => number;
918
- }): WorkflowRunManager;
919
- declare function getDefaultWorkflowRunManager(): WorkflowRunManager;
920
-
921
- export { applySessionCompaction as $, WORKFLOW_CAPSULE_FORMAT as A, WORKFLOW_CAPSULE_VERSION as B, DefaultSummaryCompaction as D, WORKFLOW_PATTERN_IDS as E, KODAX_API_MIN_INTERVAL as K, LINEAGE_ENTRY_TYPES as L, PROMISE_PATTERN as P, WORKFLOW_CAPSULE_API_VERSION as W, appendSessionLineageLabel as Y, applyLineageTruncation as Z, _resetMessageQueueForTests as _, archiveOldIslands as a0, assertRestrictedWorkflowQuality as a1, buildSessionTree as a2, buildWorkflowCapsuleIntent as a3, cleanupIncompleteToolCalls as a4, countActiveLineageMessages as a5, countTokens as a6, createSessionLineage as a7, createWorkflowCapsule as a8, createWorkflowModuleFromCapsule as a9, createWorkflowRunManager as aa, estimateTokens as ab, extractArtifactLedger as ac, extractFileOps as ad, extractTitleFromMessages as ae, findPreviousUserEntryId as af, forkSessionLineage as ag, generateSessionId as ah, getAgentConfigHome as ai, getAgentConfigPath as aj, getAppDataDir as ak, getDefaultWorkflowRunManager as al, getMessageQueue as am, getSessionLineagePath as an, getSessionMessagesFromLineage as ao, lintRestrictedWorkflowSource as ap, mergeArtifactLedger as aq, mergeFileOps as ar, resolveSessionLineageTarget as as, rewindSessionLineage as at, setAgentConfigHome as au, setSessionLineageActiveEntry as av, validateAndFixToolHistory as aw, validateWorkflowCapsule as ax, validateWorkflowScriptManifest as ay, 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, MessageQueue as y };
922
- export type { CompactionContext as C, WorkflowCapsule as F, WorkflowCapsuleEnvironmentRequirement as G, WorkflowCapsuleInputs as H, WorkflowCapsuleIntent as I, WorkflowCapsuleProvenance as J, ManagedRunClassification as M, WorkflowCapsuleRequirements as N, WorkflowPatternId as O, WorkflowProcessMetadata as Q, WorkflowQualityLintFinding as R, StartManagedRunInput as S, WorkflowQualityLintOptions as T, WorkflowQualityLintSeverity as U, WorkflowRunManager as V, WorkflowScriptManifest as X, 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, ManagedRunHooks as u, ManagedWorkflowRun as v, ManagedWorkflowSnapshot as w, ManagedWorkflowStatus as x, PolicyCompactionResult as z };
834
+ export { createSessionLineage as $, DefaultSummaryCompaction as D, KODAX_API_MIN_INTERVAL as K, LINEAGE_ENTRY_TYPES as L, MessageQueue as M, appendSessionLineageLabel as O, PROMISE_PATTERN as P, applyLineageTruncation as Q, applySessionCompaction as R, archiveOldIslands as S, assertRestrictedWorkflowQuality as T, buildSessionTree as U, buildWorkflowCapsuleIntent as V, WORKFLOW_CAPSULE_API_VERSION as W, cleanupIncompleteToolCalls as X, countActiveLineageMessages as Y, countTokens as Z, _resetMessageQueueForTests as _, createWorkflowCapsule as a0, createWorkflowModuleFromCapsule as a1, estimateTokens as a2, extractArtifactLedger as a3, extractFileOps as a4, extractTitleFromMessages as a5, findPreviousUserEntryId as a6, forkSessionLineage as a7, generateSessionId as a8, getAgentConfigHome as a9, getAgentConfigPath as aa, getAppDataDir as ab, getMessageQueue as ac, getSessionLineagePath as ad, getSessionMessagesFromLineage as ae, lintRestrictedWorkflowSource as af, mergeArtifactLedger as ag, mergeFileOps as ah, resolveSessionLineageTarget as ai, rewindSessionLineage as aj, setAgentConfigHome as ak, setSessionLineageActiveEntry as al, validateAndFixToolHistory as am, validateWorkflowCapsule as an, validateWorkflowScriptManifest as ao, 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 };
835
+ export type { WorkflowCapsuleInputs as A, WorkflowCapsuleIntent as B, CompactionContext as C, WorkflowCapsuleProvenance as E, WorkflowCapsuleRequirements as F, WorkflowPatternId as G, WorkflowQualityLintFinding as H, WorkflowQualityLintOptions as I, WorkflowQualityLintSeverity as J, WorkflowScriptManifest as N, 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 };
@@ -0,0 +1,213 @@
1
+ import { h as SessionStorage$1, f as PermissionMode } from './public-api.d-CPBMPDiU.js';
2
+ import { X as KodaXOptions, a5 as KodaXResult } from './bash-prefix-extractor.d-D57Gt6n8.js';
3
+ import { m as RuntimeSurfaceStatus, b as CommandDefinition, e as CommandSource, c as CommandInfo, C as Command$1, I as InteractiveContext, a as CommandCallbacks, g as CurrentConfig, d as CommandInvocationRequest, f as CommandWorkflowInvocationRequest } from './utils.d-DMI-9GTR.js';
4
+ import { b9 as KodaXSessionStorage, aZ as KodaXSessionData } from './types.d-DG9B4SMm.js';
5
+
6
+ /**
7
+ * InkREPL - Ink-based REPL Adapter
8
+ *
9
+ * Bridges Ink UI components with existing KodaX command processing logic.
10
+ * Replaces the Node.js readline-based input with Ink's React components.
11
+ *
12
+ * Architecture based on Gemini CLI:
13
+ * - Uses UIStateContext for global state
14
+ * - Uses KeypressContext for priority-based keyboard handling
15
+ * - Uses StreamingContext for streaming response management
16
+ */
17
+
18
+ interface InkRuntimeRunnerInput {
19
+ readonly options: KodaXOptions;
20
+ readonly prompt: string;
21
+ readonly sessionId: string;
22
+ readonly permissionMode: PermissionMode;
23
+ }
24
+ type InkRuntimeRunner = (input: InkRuntimeRunnerInput) => Promise<KodaXResult>;
25
+ type InkRuntimeStatusProvider = () => Promise<RuntimeSurfaceStatus | undefined>;
26
+ interface InkREPLOptions extends KodaXOptions {
27
+ storage?: SessionStorage$1;
28
+ hardExitOnClose?: boolean;
29
+ runtimeRunner?: InkRuntimeRunner;
30
+ getRuntimeStatus?: InkRuntimeStatusProvider;
31
+ }
32
+ /**
33
+ * Run Ink-based interactive mode
34
+ */
35
+ declare function runInkInteractiveMode(options: InkREPLOptions): Promise<void>;
36
+
37
+ interface SessionStorage extends KodaXSessionStorage {
38
+ list(gitRoot?: string): Promise<Array<{
39
+ id: string;
40
+ title: string;
41
+ msgCount: number;
42
+ tag?: string;
43
+ runtimeInfo?: KodaXSessionData['runtimeInfo'];
44
+ }>>;
45
+ }
46
+ interface ReplRuntimeRunnerInput {
47
+ readonly options: KodaXOptions;
48
+ readonly prompt: string;
49
+ readonly sessionId: string;
50
+ readonly permissionMode: PermissionMode;
51
+ }
52
+ type ReplRuntimeRunner = (input: ReplRuntimeRunnerInput) => Promise<KodaXResult>;
53
+ type ReplRuntimeStatusProvider = () => Promise<RuntimeSurfaceStatus | undefined>;
54
+ interface RepLOptions extends KodaXOptions {
55
+ storage?: SessionStorage;
56
+ runtimeRunner?: ReplRuntimeRunner;
57
+ getRuntimeStatus?: ReplRuntimeStatusProvider;
58
+ }
59
+ declare function runInteractiveMode(options: RepLOptions): Promise<void>;
60
+ declare function processSpecialSyntax(input: string): Promise<string>;
61
+
62
+ /**
63
+ * Command Registry - Dynamic command registration system
64
+ * 命令注册表 - 动态命令注册系统
65
+ *
66
+ * Provides centralized command management with source tracking,
67
+ * supporting dynamic registration, lookup, and listing of commands.
68
+ */
69
+
70
+ /**
71
+ * CommandRegistry - Centralized command management
72
+ * 命令注册表 - 集中式命令管理
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * const registry = new CommandRegistry();
77
+ *
78
+ * // Register a command
79
+ * registry.register({
80
+ * name: 'copy',
81
+ * description: 'Copy last message to clipboard',
82
+ * source: 'builtin',
83
+ * handler: async (args, context, callbacks, config) => {
84
+ * // Implementation
85
+ * }
86
+ * });
87
+ *
88
+ * // Get a command
89
+ * const cmd = registry.get('copy');
90
+ *
91
+ * // List all commands
92
+ * const allCommands = registry.getAll();
93
+ *
94
+ * // List builtin commands only
95
+ * const builtinCommands = registry.getBySource('builtin');
96
+ * ```
97
+ */
98
+ declare class CommandRegistry {
99
+ /**
100
+ * Internal command storage
101
+ * 内部命令存储
102
+ */
103
+ private commands;
104
+ /**
105
+ * Alias to command name mapping
106
+ * 别名到命令名称的映射
107
+ */
108
+ private aliases;
109
+ /**
110
+ * Register a command
111
+ * 注册命令
112
+ *
113
+ * @param def - Command definition
114
+ * @throws Error if command with same name already exists
115
+ */
116
+ register(def: CommandDefinition): void;
117
+ /**
118
+ * Unregister a command
119
+ * 注销命令
120
+ *
121
+ * @param name - Command name or alias
122
+ * @returns true if command was unregistered, false if not found
123
+ */
124
+ unregister(name: string): boolean;
125
+ /**
126
+ * Get a command by name or alias
127
+ * 通过名称或别名获取命令
128
+ *
129
+ * @param name - Command name or alias
130
+ * @returns Command definition or undefined if not found
131
+ */
132
+ get(name: string): CommandDefinition | undefined;
133
+ /**
134
+ * Check if a command exists
135
+ * 检查命令是否存在
136
+ *
137
+ * @param name - Command name or alias
138
+ * @returns true if command exists, false otherwise
139
+ */
140
+ has(name: string): boolean;
141
+ /**
142
+ * Get all commands with optional source filter
143
+ * 获取所有命令,可选按来源过滤
144
+ *
145
+ * @param source - Optional source filter
146
+ * @returns Array of command information
147
+ */
148
+ getAll(source?: CommandSource): CommandInfo[];
149
+ /**
150
+ * Get commands by source
151
+ * 按来源获取命令
152
+ *
153
+ * @param source - Command source
154
+ * @returns Array of command information
155
+ */
156
+ getBySource(source: CommandSource): CommandInfo[];
157
+ /**
158
+ * Get all command names
159
+ * 获取所有命令名称
160
+ *
161
+ * @returns Array of command names
162
+ */
163
+ getNames(): string[];
164
+ /**
165
+ * Clear all commands
166
+ * 清空所有命令
167
+ */
168
+ clear(): void;
169
+ /**
170
+ * Get command count
171
+ * 获取命令数量
172
+ *
173
+ * @returns Number of registered commands
174
+ */
175
+ get size(): number;
176
+ /**
177
+ * Get alias count
178
+ * 获取别名数量
179
+ *
180
+ * @returns Number of registered aliases
181
+ */
182
+ get aliasCount(): number;
183
+ }
184
+
185
+ /**
186
+ * KodaX Interactive Command System
187
+ */
188
+
189
+ type Command = Command$1;
190
+ declare const BUILTIN_COMMANDS: Command[];
191
+ declare function getCommandRegistry(projectRoot?: string): CommandRegistry;
192
+ declare function parseCommand(input: string): {
193
+ command: string;
194
+ args: string[];
195
+ skillInvocation?: {
196
+ name: string;
197
+ };
198
+ } | null;
199
+ type CommandResult = boolean | {
200
+ skillContent?: string;
201
+ invocation?: CommandInvocationRequest;
202
+ workflow?: CommandWorkflowInvocationRequest;
203
+ };
204
+ declare function executeCommand(parsed: {
205
+ command: string;
206
+ args: string[];
207
+ skillInvocation?: {
208
+ name: string;
209
+ };
210
+ }, context: InteractiveContext, callbacks: CommandCallbacks, currentConfig: CurrentConfig): Promise<CommandResult>;
211
+
212
+ export { BUILTIN_COMMANDS as B, executeCommand as g, getCommandRegistry as h, processSpecialSyntax as i, runInteractiveMode as j, parseCommand as p, runInkInteractiveMode as r };
213
+ export type { Command as C, InkREPLOptions as I, RepLOptions as R, InkRuntimeRunner as a, InkRuntimeRunnerInput as b, InkRuntimeStatusProvider as c, ReplRuntimeRunner as d, ReplRuntimeRunnerInput as e, ReplRuntimeStatusProvider as f };