@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,48 +1,3 @@
1
- type ProviderCredentialPurpose = 'primary' | 'fallback' | 'classifier' | 'sidecar' | 'compaction' | 'workflow' | 'utility';
2
- interface ProviderCredentialLeaseAccess {
3
- readonly allowedProviders: readonly string[];
4
- readonly signal?: AbortSignal;
5
- readonly isActive?: () => boolean;
6
- acquire(provider: string, purpose: ProviderCredentialPurpose, signal: AbortSignal, attribution?: ProviderCredentialAttribution): Promise<string>;
7
- }
8
- type ProviderCredentialAttribution = {
9
- readonly kind: 'actor_turn';
10
- readonly actorPath: string;
11
- readonly turnId: string;
12
- } | {
13
- readonly kind: 'workflow';
14
- readonly workflowRunId: string;
15
- };
16
- interface ProviderCredentialLeaseScope {
17
- readonly allowedProviders: readonly string[];
18
- close(reason?: string): void;
19
- }
20
- /** Run a provider operation with an in-memory, run-scoped credential override. */
21
- declare function runWithProviderCredential<T>(provider: string, credential: string, operation: () => T): T;
22
- /** Create an operation-owned resolver scope. No credential material is retained here. */
23
- declare function createProviderCredentialLeaseScope(access: ProviderCredentialLeaseAccess): ProviderCredentialLeaseScope;
24
- /** Run an operation in a previously created lease scope. */
25
- declare function runWithProviderCredentialLeaseScope<T>(scope: ProviderCredentialLeaseScope, operation: () => T): T;
26
- /** Run outside any Runtime Provider credential authority (for external executors). */
27
- declare function runWithoutProviderCredentialScope<T>(operation: () => T): T;
28
- /** Derive a short-lived child from the active lazy lease without exposing its resolver. */
29
- declare function deriveCurrentProviderCredentialLeaseScope(allowedProviders: readonly string[], attribution?: ProviderCredentialAttribution): ProviderCredentialLeaseScope | undefined;
30
- /** Concrete Provider authority carried by the active lazy lease, never a wildcard. */
31
- declare function currentProviderCredentialLeaseProviders(): readonly string[] | undefined;
32
- /**
33
- * Resolve one Provider immediately before its wire call. The secret exists only
34
- * in the nested exact scope and is discarded when the call settles.
35
- */
36
- declare function withProviderRequestCredential<T>(provider: string, purpose: ProviderCredentialPurpose, signal: AbortSignal | undefined, operation: (signal: AbortSignal | undefined) => Promise<T> | T): Promise<T>;
37
- /** Internal provider lookup. The credential is never copied to config or diagnostics. */
38
- declare function getScopedProviderCredential(provider: string): string | undefined;
39
- /** Whether an active scope authorizes a Provider without triggering broker I/O. */
40
- declare function hasScopedProviderCredentialAuthority(provider: string): boolean | undefined;
41
- /** True while either an exact or lazy credential authority is present. */
42
- declare function hasProviderCredentialContext(): boolean;
43
- /** Remove the active exact credential from DTOs before diagnostics or persistence. */
44
- declare function redactScopedProviderCredential<T>(value: T): T;
45
-
46
1
  interface KodaXLlmTimeoutConfig {
47
2
  /** Main provider request hard timeout, in seconds. Default 600s. */
48
3
  readonly requestTimeoutSec?: number;
@@ -176,5 +131,5 @@ declare function getSummary(tracker: CostTracker): SessionCostSummary;
176
131
  declare function formatCost(usd: number): string;
177
132
  declare function formatCostReport(summary: SessionCostSummary): string;
178
133
 
179
- export { timeoutSecToMs as A, withProviderRequestCredential as B, DEFAULT_COST_RATES as D, calculateCost as g, createCostTracker as h, createProviderCredentialLeaseScope as i, currentProviderCredentialLeaseProviders as j, deriveCurrentProviderCredentialLeaseScope as k, formatCost as l, formatCostReport as m, getCostRate as n, getScopedProviderCredential as o, getSummary as p, hasProviderCredentialContext as q, hasScopedProviderCredentialAuthority as r, parseTimeoutSecEnvMs as s, recordRetry as t, recordUsage as u, redactScopedProviderCredential as v, resolveLlmTimeoutConfig as w, runWithProviderCredential as x, runWithProviderCredentialLeaseScope as y, runWithoutProviderCredentialScope as z };
180
- export type { CostRate as C, KodaXLlmTimeoutConfig as K, ProviderCostSummary as P, RetryRecord as R, SessionCostSummary as S, TokenUsageRecord as T, CostTracker as a, KodaXResolvedLlmTimeoutConfig as b, ProviderCredentialAttribution as c, ProviderCredentialLeaseAccess as d, ProviderCredentialLeaseScope as e, ProviderCredentialPurpose as f };
134
+ export { DEFAULT_COST_RATES as D, calculateCost as c, createCostTracker as d, formatCostReport as e, formatCost as f, getCostRate as g, getSummary as h, recordUsage as i, resolveLlmTimeoutConfig as j, parseTimeoutSecEnvMs as p, recordRetry as r, timeoutSecToMs as t };
135
+ export type { CostRate as C, KodaXLlmTimeoutConfig as K, ProviderCostSummary as P, RetryRecord as R, SessionCostSummary as S, TokenUsageRecord as T, CostTracker as a, KodaXResolvedLlmTimeoutConfig as b };
@@ -1,5 +1,5 @@
1
- import { k as KodaXMessage } from './types.d-BrQMB-hy.js';
2
- import { ag as KodaXSessionLineage } from './types.d-CSv0_cZC.js';
1
+ import { k as KodaXMessage } from './types.d-BjOq57-z.js';
2
+ import { ax as KodaXSessionLineage } from './review-inbox.d-BeaLRNHx.js';
3
3
 
4
4
  type KodaXSessionHistoryScope = 'compacted' | 'all';
5
5
  type KodaXSessionHistorySource = 'user' | 'assistant' | 'system' | 'tool' | 'child_task';
@@ -1,4 +1,4 @@
1
- import { b as CapabilityResult, a as CapabilityProvider, C as CapabilityKind, f as CapabilitySearchSnapshot } from './capability.d-Ch5Vos33.js';
1
+ import { b as CapabilityResult, a as CapabilityProvider, C as CapabilityKind, f as CapabilitySearchSnapshot } from './capability.d-DOF3r0fJ.js';
2
2
  import { a as McpServerConfig, b as McpServersConfig, M as McpConnectMode } from './config.d-CJy1WENT.js';
3
3
 
4
4
  type McpCapabilityKind = 'tool' | 'resource' | 'prompt';
@@ -271,6 +271,13 @@ declare class McpServerRuntime {
271
271
  private sendResponse;
272
272
  /** Best-effort JSON-RPC error send. */
273
273
  private sendError;
274
+ /**
275
+ * The shared host call context of the currently in-flight client requests.
276
+ * Zero, one, or many pending requests may share one context; a mix of
277
+ * different contexts cannot be attributed and resolves to undefined
278
+ * (fail-closed: the host handler declines rather than mis-attributes).
279
+ */
280
+ private pendingCallContext;
274
281
  /**
275
282
  * FEATURE_222 — handle a server→client request for an advertised reverse
276
283
  * capability. Each slice adds a case to {@link dispatchServerRequest};
@@ -0,0 +1,18 @@
1
+ import { bb as WorkflowMeta } from './types.d-o7t9dds4.js';
2
+
3
+ declare const WORKFLOW_PATTERN_IDS: readonly ["classify-and-act", "fan-out-and-synthesize", "adversarial-verification", "generate-and-filter", "tournament", "loop-until-done"];
4
+ type WorkflowPatternId = (typeof WORKFLOW_PATTERN_IDS)[number];
5
+ interface WorkflowScriptManifest extends WorkflowMeta {
6
+ readonly phases: readonly string[];
7
+ readonly readOnly: boolean;
8
+ readonly plannedAgents?: number;
9
+ readonly maxAgents: number;
10
+ readonly maxConcurrency: number;
11
+ readonly tokenBudget?: number;
12
+ readonly mayUseWorktree?: boolean;
13
+ readonly patterns: readonly WorkflowPatternId[];
14
+ }
15
+ declare function validateWorkflowScriptManifest(value: unknown): WorkflowScriptManifest;
16
+
17
+ export { WORKFLOW_PATTERN_IDS as W, validateWorkflowScriptManifest as v };
18
+ export type { WorkflowPatternId as a, WorkflowScriptManifest as b };
@@ -0,0 +1,47 @@
1
+ type ProviderCredentialPurpose = 'primary' | 'fallback' | 'classifier' | 'sidecar' | 'compaction' | 'workflow' | 'utility';
2
+ interface ProviderCredentialLeaseAccess {
3
+ readonly allowedProviders: readonly string[];
4
+ readonly signal?: AbortSignal;
5
+ readonly isActive?: () => boolean;
6
+ acquire(provider: string, purpose: ProviderCredentialPurpose, signal: AbortSignal, attribution?: ProviderCredentialAttribution): Promise<string>;
7
+ }
8
+ type ProviderCredentialAttribution = {
9
+ readonly kind: 'actor_turn';
10
+ readonly actorPath: string;
11
+ readonly turnId: string;
12
+ } | {
13
+ readonly kind: 'workflow';
14
+ readonly workflowRunId: string;
15
+ };
16
+ interface ProviderCredentialLeaseScope {
17
+ readonly allowedProviders: readonly string[];
18
+ close(reason?: string): void;
19
+ }
20
+ /** Run a provider operation with an in-memory, run-scoped credential override. */
21
+ declare function runWithProviderCredential<T>(provider: string, credential: string, operation: () => T): T;
22
+ /** Create an operation-owned resolver scope. No credential material is retained here. */
23
+ declare function createProviderCredentialLeaseScope(access: ProviderCredentialLeaseAccess): ProviderCredentialLeaseScope;
24
+ /** Run an operation in a previously created lease scope. */
25
+ declare function runWithProviderCredentialLeaseScope<T>(scope: ProviderCredentialLeaseScope, operation: () => T): T;
26
+ /** Run outside any Runtime Provider credential authority (for external executors). */
27
+ declare function runWithoutProviderCredentialScope<T>(operation: () => T): T;
28
+ /** Derive a short-lived child from the active lazy lease without exposing its resolver. */
29
+ declare function deriveCurrentProviderCredentialLeaseScope(allowedProviders: readonly string[], attribution?: ProviderCredentialAttribution): ProviderCredentialLeaseScope | undefined;
30
+ /** Concrete Provider authority carried by the active lazy lease, never a wildcard. */
31
+ declare function currentProviderCredentialLeaseProviders(): readonly string[] | undefined;
32
+ /**
33
+ * Resolve one Provider immediately before its wire call. The secret exists only
34
+ * in the nested exact scope and is discarded when the call settles.
35
+ */
36
+ declare function withProviderRequestCredential<T>(provider: string, purpose: ProviderCredentialPurpose, signal: AbortSignal | undefined, operation: (signal: AbortSignal | undefined) => Promise<T> | T, logicalRequestId?: string): Promise<T>;
37
+ /** Internal provider lookup. The credential is never copied to config or diagnostics. */
38
+ declare function getScopedProviderCredential(provider: string): string | undefined;
39
+ /** Whether an active scope authorizes a Provider without triggering broker I/O. */
40
+ declare function hasScopedProviderCredentialAuthority(provider: string): boolean | undefined;
41
+ /** True while either an exact or lazy credential authority is present. */
42
+ declare function hasProviderCredentialContext(): boolean;
43
+ /** Remove the active exact credential from DTOs before diagnostics or persistence. */
44
+ declare function redactScopedProviderCredential<T>(value: T): T;
45
+
46
+ export { createProviderCredentialLeaseScope as d, currentProviderCredentialLeaseProviders as e, deriveCurrentProviderCredentialLeaseScope as f, getScopedProviderCredential as g, hasProviderCredentialContext as h, hasScopedProviderCredentialAuthority as i, runWithProviderCredential as j, runWithProviderCredentialLeaseScope as k, runWithoutProviderCredentialScope as l, redactScopedProviderCredential as r, withProviderRequestCredential as w };
47
+ export type { ProviderCredentialAttribution as P, ProviderCredentialLeaseAccess as a, ProviderCredentialLeaseScope as b, ProviderCredentialPurpose as c };
@@ -0,0 +1,34 @@
1
+ import { a2 as KodaXTokenUsage } from './types.d-BjOq57-z.js';
2
+ import { c as ProviderCredentialPurpose, P as ProviderCredentialAttribution } from './provider-credential-context.d-BH2OaB1b.js';
3
+
4
+ interface ProviderRequestObservation {
5
+ /** pending is a native fetch adapter's provisional boundary; unavailable is operation-only. */
6
+ readonly wireObservation?: 'pending' | 'observed' | 'unavailable';
7
+ readonly route?: {
8
+ readonly chainId: string;
9
+ readonly attempt: number;
10
+ readonly fromProvider?: string;
11
+ };
12
+ readonly requestId: string;
13
+ readonly logicalRequestId: string;
14
+ readonly provider: string;
15
+ readonly model?: string;
16
+ readonly purpose: ProviderCredentialPurpose;
17
+ readonly attribution?: ProviderCredentialAttribution;
18
+ readonly attempt: number;
19
+ readonly boundary: 'physical_attempt' | 'provider_operation';
20
+ readonly dispatch: 'dispatched' | 'unknown';
21
+ readonly state: 'started' | 'succeeded' | 'failed' | 'cancelled';
22
+ readonly startedAt: string;
23
+ readonly endedAt?: string;
24
+ readonly usage?: KodaXTokenUsage;
25
+ }
26
+ type Observer = (fact: ProviderRequestObservation) => void;
27
+ /** Execution identity is observational and exists independently of credential authority. */
28
+ declare function runWithProviderRequestAttribution<T>(attribution: ProviderCredentialAttribution, operation: () => T): T;
29
+ declare function runWithProviderRequestRoute<T>(route: NonNullable<ProviderRequestObservation['route']>, operation: () => T): T;
30
+ declare function runWithProviderRequestAbortSignal<T>(signal: AbortSignal, operation: () => T): T;
31
+ declare function runWithProviderRequestObserver<T>(observer: Observer, operation: () => T): T;
32
+
33
+ export { runWithProviderRequestAttribution as a, runWithProviderRequestObserver as b, runWithProviderRequestRoute as c, runWithProviderRequestAbortSignal as r };
34
+ export type { ProviderRequestObservation as P };
@@ -1,7 +1,8 @@
1
- import { a as BashPrefixExtractor, v as KodaXAgentMode } from './bash-prefix-extractor.d-DWFIMg0v.js';
2
- import { G as KodaXReasoningMode, k as KodaXMessage, U as KodaXTaskResultMetadata } from './types.d-BrQMB-hy.js';
3
- import { bG as LearningSurfaceSnapshot$1, bB as LearningQuery, bA as LearningPage, bd as LearnedCapabilityRecord, bw as LearningEvent, bF as LearningSubscribeOptions, aj as CompactionReport, ah as CompactionConfig } from './controller.d-J2t1q8Ly.js';
4
- import { ab as KodaXSessionData, ag as KodaXSessionLineage, al as KodaXSessionNavigationOptions, an as KodaXSessionRuntimeInfo, ap as KodaXSessionStorage, V as KodaXExtensionSessionRecord, ac as KodaXSessionEntry, a7 as KodaXSessionArtifactLedgerEntry, ar as KodaXSessionUiHistoryItem, ao as KodaXSessionScope, g as AgentActorSnapshot, c as AgentActorSaveAttempt, a1 as KodaXJsonValue } from './types.d-CSv0_cZC.js';
1
+ import { ai as ClientSessionSettings } from './client-contract-A1jdk6xz.js';
2
+ import { a as BashPrefixExtractor, w as KodaXAgentMode } from './bash-prefix-extractor.d-DvswAXKS.js';
3
+ import { G as KodaXReasoningMode, k as KodaXMessage, U as KodaXTaskResultMetadata } from './types.d-BjOq57-z.js';
4
+ import { aP as LearningSurfaceSnapshot$1, aN as LearningQuery, aM as LearningPage, ax as LearnedCapabilityRecord, aI as LearningEvent, aO as LearningSubscribeOptions, a4 as CompactionReport, a2 as CompactionConfig } from './types.d-o7t9dds4.js';
5
+ import { as as KodaXSessionData, ax as KodaXSessionLineage, aC as KodaXSessionNavigationOptions, aE as KodaXSessionRuntimeInfo, aG as KodaXSessionStorage, aa as KodaXExtensionSessionRecord, at as KodaXSessionEntry, ao as KodaXSessionArtifactLedgerEntry, aI as KodaXSessionUiHistoryItem, aF as KodaXSessionScope, g as AgentActorSnapshot, c as AgentActorSaveAttempt, ai as KodaXJsonValue } from './review-inbox.d-BeaLRNHx.js';
5
6
 
6
7
  /**
7
8
  * TextBuffer - Text buffer management class - 文本缓冲区管理类
@@ -485,14 +486,15 @@ interface InputPromptProps {
485
486
  * `undefined` to leave history-recall behavior intact when the queue is
486
487
  * empty.
487
488
  */
488
- onPopPendingInputs?: () => string | undefined;
489
+ onPopPendingInputs?: () => string | undefined | Promise<string | undefined>;
489
490
  }
490
491
  type LearningSurfaceSnapshot = LearningSurfaceSnapshot$1;
491
492
  interface LearningBinding {
492
493
  getSnapshot(): Promise<LearningSurfaceSnapshot>;
493
494
  list(query?: LearningQuery): Promise<LearningPage>;
494
495
  get(nameOrSlug: string): Promise<LearnedCapabilityRecord>;
495
- subscribe(listener: (event: LearningEvent) => void, options?: LearningSubscribeOptions): {
496
+ subscribe(listener: (event: LearningEvent) => void, options?: LearningSubscribeOptions, onError?: (error: unknown) => void): {
497
+ readonly ready?: Promise<void>;
496
498
  close(): void;
497
499
  };
498
500
  acknowledge(nameOrSlug: string): Promise<void>;
@@ -505,6 +507,7 @@ interface LearningBinding {
505
507
  trust(nameOrSlug: string): Promise<void>;
506
508
  }
507
509
  interface StatusBarProps {
510
+ hostSettings?: ClientSessionSettings;
508
511
  sessionId: string;
509
512
  permissionMode: PermissionMode;
510
513
  agentMode: KodaXAgentMode;
@@ -538,6 +541,11 @@ interface StatusBarProps {
538
541
  maxIter?: number;
539
542
  /** Context usage info - Issue 070: 显示上下文使用情况 */
540
543
  contextUsage?: {
544
+ /** Host configuration cannot supply a physical trigger before execution resolves its envelope. */
545
+ hostBudget?: boolean;
546
+ effectiveTriggerTokens?: number;
547
+ /** Live execution scope the tokens belong to; workers run their own window. */
548
+ scope?: 'parent' | 'worker';
541
549
  /** Current token count in context */
542
550
  currentTokens: number;
543
551
  /** Context window size (effective contextWindow) */
@@ -549,6 +557,11 @@ interface StatusBarProps {
549
557
  /** Provider output capacity reserved from the physical context window. */
550
558
  reservedResponseTokens?: number;
551
559
  };
560
+ /** Scope-specific quantity when no matching budget is known. */
561
+ contextTokens?: {
562
+ currentTokens: number;
563
+ scope: 'parent' | 'worker';
564
+ };
552
565
  /** Client-specific Learning Center projection. Inventory alone stays hidden. */
553
566
  learning?: LearningSurfaceSnapshot;
554
567
  /** Whether current busy/thinking status should be visible in the bar */
@@ -630,9 +643,12 @@ declare const TOOL_STATUS_ICONS: Record<ToolCallStatus, string>;
630
643
  */
631
644
  interface ToolCall {
632
645
  id: string;
646
+ assistantOutputId?: string;
633
647
  name: string;
634
648
  status: ToolCallStatus;
635
649
  input?: Record<string, unknown>;
650
+ /** Serialized Host arguments; may be a bounded preview until explicitly read. */
651
+ inputText?: string;
636
652
  preview?: string;
637
653
  output?: unknown;
638
654
  error?: string;
@@ -651,9 +667,21 @@ type HistoryItemType = "user" | "assistant" | "system" | "tool_group" | "thinkin
651
667
  * History item base class - 历史项基类
652
668
  */
653
669
  interface HistoryItemBase {
670
+ outputId?: string;
671
+ outputState?: 'draft' | 'committed';
672
+ textRevision?: number;
673
+ /** Source input boundary for retained Host output. */
674
+ afterInputId?: string;
654
675
  id: string;
676
+ /** Accepted input identity used to join saved history to a frozen browse snapshot. */
677
+ inputId?: string;
655
678
  type: HistoryItemType;
656
679
  timestamp: number;
680
+ textOffset?: number;
681
+ totalTextLength?: number;
682
+ totalInputLength?: number;
683
+ /** Stable canonical reader identity when this display item came from history paging. */
684
+ historyItemId?: string;
657
685
  /** Ephemeral marker used so restored display-only entries cannot evict canonical transcript history. */
658
686
  isSessionUiOnly?: boolean;
659
687
  }
@@ -737,15 +765,15 @@ interface HistoryItemHint extends HistoryItemBase {
737
765
  * Displayed as an independent "role" with its own header so the user can
738
766
  * clearly see that the Sidecar Verifier is actively reviewing the output.
739
767
  * verdict: 'revise' | 'blocked' | undefined; delivery 'budget-exhausted' means
740
- * the verifier ran out of budget before returning a verdict.
768
+ * the verifier exhausted its delivery budget instead of injecting the advice.
741
769
  */
742
770
  interface HistoryItemSidecar extends HistoryItemBase {
743
771
  type: "sidecar";
744
772
  text: string;
745
- /** 'revise' or 'blocked'; absent when delivery === 'budget-exhausted' */
773
+ /** Absent on legacy snapshots that retained only a delivery marker. */
746
774
  verdict?: "revise" | "blocked";
747
- /** Set when the verifier exhausted its token budget before reaching a verdict */
748
- delivery?: "budget-exhausted";
775
+ /** How the verifier result was delivered; absent on older snapshots. */
776
+ delivery?: "synthetic-user-message" | "budget-exhausted" | "terminal-block";
749
777
  }
750
778
  /**
751
779
  * Union type of all history items - 所有历史项的联合类型
@@ -788,6 +816,8 @@ interface UIActions {
788
816
  clearResponse: () => void;
789
817
  addHistoryItem: (item: CreatableHistoryItem) => void;
790
818
  addHistoryItems: (items: CreatableHistoryItem[]) => void;
819
+ /** FEATURE_298 T17 — wholesale replacement from the Host session view. */
820
+ replaceHistoryItems: (items: HistoryItem[]) => void;
791
821
  updateHistoryItem: (id: string, updates: Partial<HistoryItem>) => void;
792
822
  clearHistory: () => void;
793
823
  addToolCall: (tool: Omit<ToolCall, "id" | "startTime">) => string;
@@ -934,8 +964,8 @@ interface SessionIdentityRepairInput {
934
964
  readonly runId: string;
935
965
  readonly inputId: string;
936
966
  readonly eventId: string;
937
- readonly seq: number;
938
- readonly eventDigest: string;
967
+ /** sha256 over the persisted Run-status delivery receipt the Host verified. */
968
+ readonly receiptDigest: string;
939
969
  };
940
970
  }
941
971
  interface SessionConfirmedIdentityRepairData extends SessionIdentityRepairInput {
@@ -971,6 +1001,8 @@ interface ConversationPageCacheInput {
971
1001
  readonly maxPageBytes: number;
972
1002
  readonly maxInlineEntryBytes: number;
973
1003
  readonly reservedBytes: number;
1004
+ /** Internal source lookup: returns matching entry locators without reading bodies. */
1005
+ readonly sourceKeys?: readonly string[];
974
1006
  readonly authorize?: (admission: ConversationPageCacheAdmission) => void | Promise<void>;
975
1007
  readonly signal?: AbortSignal;
976
1008
  }
@@ -1140,6 +1172,7 @@ declare class FileSessionStorage implements KodaXSessionStorage {
1140
1172
  completeSessionLocationTraversal(boundary: SessionLocationTraversalBoundary, filePaths: readonly string[], traversalComplete: boolean): void;
1141
1173
  private writeQueues;
1142
1174
  private serializedWrite;
1175
+ private awaitOwnWrites;
1143
1176
  private refreshSelfVerifiedLocationTopology;
1144
1177
  private sessionWriteLockPath;
1145
1178
  private persistSessionLocationHint;
@@ -1207,6 +1240,8 @@ declare class FileSessionStorage implements KodaXSessionStorage {
1207
1240
  * IDs must continue through the ordinary global conflict check.
1208
1241
  */
1209
1242
  createGenerated(id: string, data: SessionData): Promise<void>;
1243
+ /** Update display metadata under the same writer lock as canonical Session saves. */
1244
+ mutateUiHistory(id: string, mutation: (history: readonly KodaXSessionUiHistoryItem[], session: Readonly<SessionData>) => KodaXSessionUiHistoryItem[]): Promise<boolean>;
1210
1245
  mutateLineage(id: string, mutation: (lineage: KodaXSessionLineage) => KodaXSessionLineage): Promise<boolean>;
1211
1246
  mutateRuntimeInfo(id: string, mutation: (runtimeInfo: KodaXSessionRuntimeInfo | undefined) => KodaXSessionRuntimeInfo | undefined): Promise<boolean>;
1212
1247
  /** Phase-aware Actor CAS save; canonical success is observable before cache maintenance. */
@@ -1240,6 +1275,7 @@ declare class FileSessionStorage implements KodaXSessionStorage {
1240
1275
  }): Promise<SessionData | null>;
1241
1276
  setLabel(id: string, selector: string, label?: string): Promise<SessionData | null>;
1242
1277
  fork(id: string, selector?: string, options?: {
1278
+ before?: boolean;
1243
1279
  sessionId?: string;
1244
1280
  title?: string;
1245
1281
  historyBoundary?: SessionHistoryBoundary;
@@ -1337,6 +1373,7 @@ declare class FileSessionStorage implements KodaXSessionStorage {
1337
1373
  */
1338
1374
 
1339
1375
  interface CompactSessionOptions {
1376
+ readonly abortSignal?: AbortSignal;
1340
1377
  /** Summary policy, normally supplied by the Runtime Session settings. */
1341
1378
  readonly reasoning?: CompactionConfig['reasoning'];
1342
1379
  /** Provider alias for the summarizer. Defaults to the session's persisted provider, then 'anthropic'. */
@@ -1642,7 +1679,9 @@ declare function rewindSession(id: string, opts?: RewindSessionOptions): Promise
1642
1679
  * Set the active lineage entry by selector.
1643
1680
  * Returns null for a missing session. NEVER throws.
1644
1681
  */
1645
- declare function setActiveEntry(id: string, selector: string): Promise<SessionData | null>;
1682
+ declare function setActiveEntry(id: string, selector: string, options?: {
1683
+ summarizeCurrentBranch?: boolean;
1684
+ }): Promise<SessionData | null>;
1646
1685
  interface RunningSessionInfo {
1647
1686
  readonly pid: number;
1648
1687
  readonly startedAt: number;
@@ -1,6 +1,6 @@
1
- import { G as KodaXReasoningMode, O as KodaXStableEffortIntent, ab as KodaXWireReasoningEffort, H as KodaXReasoningProfile, $ as KodaXThinkingBudgetMap, a0 as KodaXThinkingDepth, r as KodaXProviderConfig, C as KodaXReasoningCapability, I as KodaXReasoningRequest, n as KodaXNormalizedReasoningRequest, X as KodaXTaskType, a9 as KodaXVerifyCredentialResult, a3 as KodaXToolDefinition, k as KodaXMessage, z as KodaXProviderStreamOptions, P as KodaXStreamResult, l as KodaXModelDescriptor, q as KodaXProviderCapabilityProfile, o as KodaXOpenAICompatMaxOutputTokensField, aa as KodaXVerifyStrategy, d as KodaXCustomProviderConfig, j as KodaXListModelsResult } from './types.d-BrQMB-hy.js';
1
+ import { G as KodaXReasoningMode, O as KodaXStableEffortIntent, ab as KodaXWireReasoningEffort, H as KodaXReasoningProfile, $ as KodaXThinkingBudgetMap, a0 as KodaXThinkingDepth, r as KodaXProviderConfig, C as KodaXReasoningCapability, I as KodaXReasoningRequest, n as KodaXNormalizedReasoningRequest, X as KodaXTaskType, a9 as KodaXVerifyCredentialResult, a3 as KodaXToolDefinition, k as KodaXMessage, z as KodaXProviderStreamOptions, P as KodaXStreamResult, l as KodaXModelDescriptor, q as KodaXProviderCapabilityProfile, o as KodaXOpenAICompatMaxOutputTokensField, aa as KodaXVerifyStrategy, d as KodaXCustomProviderConfig, j as KodaXListModelsResult } from './types.d-BjOq57-z.js';
2
2
  import Anthropic from '@anthropic-ai/sdk';
3
- import { K as KodaXBaseProvider } from './base.d-Bt9lhwSV.js';
3
+ import { K as KodaXBaseProvider } from './base.d-ZBOdjDUT.js';
4
4
  import OpenAI from 'openai';
5
5
 
6
6
  declare const KODAX_REASONING_MODE_SEQUENCE: KodaXReasoningMode[];
@@ -117,6 +117,7 @@ declare function resolveWireEffort(input: ResolveWireEffortInput): ResolvedWireE
117
117
  */
118
118
 
119
119
  declare abstract class KodaXAnthropicCompatProvider extends KodaXBaseProvider {
120
+ protected readonly requestObservationBoundary: "physical_attempt";
120
121
  abstract readonly name: string;
121
122
  readonly supportsThinking = true;
122
123
  protected abstract readonly config: KodaXProviderConfig;
@@ -242,6 +243,7 @@ declare abstract class KodaXAnthropicCompatProvider extends KodaXBaseProvider {
242
243
  */
243
244
 
244
245
  declare abstract class KodaXOpenAICompatProvider extends KodaXBaseProvider {
246
+ protected readonly requestObservationBoundary: "physical_attempt";
245
247
  private reasoningRejections;
246
248
  protected normalizeReasoning(reasoning?: boolean | KodaXReasoningRequest): KodaXNormalizedReasoningRequest;
247
249
  private reasoningAttempts;