@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,225 +0,0 @@
1
- import { a4 as KodaXMemoryOutcomeDigest, aJ as MemoryContextIdentity } from './types.d-CSv0_cZC.js';
2
-
3
- interface PendingEpisodeReviewV1 {
4
- readonly version: 1;
5
- readonly reviewKey: string;
6
- readonly digest: KodaXMemoryOutcomeDigest;
7
- readonly ownerSessionRef: string;
8
- readonly ownerAgentHash: string;
9
- readonly ownerProjectHash?: string;
10
- readonly createdAt: string;
11
- }
12
- interface PendingEpisodeReviewV2 {
13
- readonly version: 2;
14
- readonly jobId: string;
15
- readonly reviewKey: string;
16
- readonly digest: KodaXMemoryOutcomeDigest;
17
- readonly ownerSessionRef: string;
18
- readonly ownerAgentHash: string;
19
- readonly ownerProjectHash?: string;
20
- readonly branchId: string;
21
- readonly branchEpoch: number;
22
- readonly authorityCeiling: 'memory_and_project_skill';
23
- readonly createdAt: string;
24
- }
25
- type PendingEpisodeReview = PendingEpisodeReviewV1 | PendingEpisodeReviewV2;
26
- interface PendingEpisodeReviewFilter {
27
- readonly configHome?: string;
28
- readonly tenantId: string;
29
- readonly agentId?: string;
30
- /** Omit for every project; pass null for ownerless reviews only. */
31
- readonly projectId?: string | null;
32
- }
33
- type EpisodeReviewJobStatus = 'pending' | 'processing' | 'decided' | 'completed' | 'attention';
34
- interface EpisodeReviewJobState {
35
- readonly schemaVersion: 1;
36
- readonly jobId: string;
37
- readonly status: EpisodeReviewJobStatus;
38
- readonly claimEpoch: number;
39
- readonly claimToken?: string;
40
- readonly leaseDeadline?: string;
41
- readonly providerAttempts: number;
42
- readonly applyAttempts: number;
43
- readonly applyAttemptsByCarrier: {
44
- readonly memory: number;
45
- readonly skill: number;
46
- };
47
- readonly completionAttempts: number;
48
- readonly nextAttemptAt?: string;
49
- readonly nextApplyAttemptAt?: string;
50
- readonly nextCompletionAttemptAt?: string;
51
- readonly lastError?: string;
52
- readonly updatedAt: string;
53
- }
54
- interface PendingEpisodeReviewSummary {
55
- readonly version: 1 | 2;
56
- readonly jobId?: string;
57
- readonly reviewKey: string;
58
- readonly ownerSessionRef: string;
59
- readonly createdAt: string;
60
- readonly status: EpisodeReviewJobStatus | 'unknown';
61
- readonly providerAttempts?: number;
62
- readonly applyAttempts?: number;
63
- readonly completionAttempts?: number;
64
- readonly nextAttemptAt?: string;
65
- readonly nextApplyAttemptAt?: string;
66
- readonly nextCompletionAttemptAt?: string;
67
- readonly lastError?: string;
68
- }
69
- interface EpisodeReviewClaim {
70
- readonly jobId: string;
71
- readonly reviewKey: string;
72
- readonly ownerSessionRef: string;
73
- readonly branchId: string;
74
- readonly branchEpoch: number;
75
- readonly epoch: number;
76
- readonly token: string;
77
- readonly leaseDeadline: string;
78
- }
79
- interface EpisodeReviewInputSpec {
80
- readonly evidence: unknown;
81
- readonly promptRevision: string;
82
- readonly schemaRevision: string;
83
- readonly policyRevision: string;
84
- readonly providerRevision: string;
85
- }
86
- interface EpisodeReviewInputCheckpoint extends EpisodeReviewInputSpec {
87
- readonly version: 1;
88
- readonly jobId: string;
89
- readonly evidenceBytes: string;
90
- readonly evidenceHash: string;
91
- readonly createdAt: string;
92
- }
93
- interface EpisodeReviewDecisionInput {
94
- readonly inputHash: string;
95
- readonly memoryProposalIds: readonly string[];
96
- readonly requiredCarriers?: readonly ('memory' | 'skill')[];
97
- readonly memoryPlan?: unknown;
98
- readonly capabilityDecision?: unknown;
99
- }
100
- interface EpisodeReviewDecision extends EpisodeReviewDecisionInput {
101
- readonly version: 1;
102
- readonly jobId: string;
103
- readonly decisionId: string;
104
- readonly committedAt: string;
105
- }
106
- interface EpisodeReviewActionInput {
107
- readonly actionId: string;
108
- readonly decisionId: string;
109
- readonly carrier: 'memory' | 'skill';
110
- readonly resultRefs: readonly string[];
111
- }
112
- interface EpisodeReviewActionReceipt extends EpisodeReviewActionInput {
113
- readonly version: 1;
114
- readonly jobId: string;
115
- readonly committedAt: string;
116
- }
117
- type EpisodeReviewFailureKind = 'provider_timeout' | 'provider_error' | 'malformed_response' | 'shutdown' | 'budget_unavailable' | 'provider_unavailable';
118
- declare class EpisodeReviewFailure extends Error {
119
- readonly kind: EpisodeReviewFailureKind;
120
- constructor(kind: EpisodeReviewFailureKind, message: string);
121
- }
122
- interface EpisodeReviewJobSnapshot {
123
- readonly envelope: PendingEpisodeReviewV2;
124
- readonly state: EpisodeReviewJobState;
125
- readonly input?: EpisodeReviewInputCheckpoint;
126
- readonly decision?: EpisodeReviewDecision;
127
- readonly actions: readonly EpisodeReviewActionReceipt[];
128
- }
129
- interface EpisodeReviewReceipt {
130
- readonly version: 1;
131
- readonly jobId?: string;
132
- readonly reviewKey: string;
133
- readonly ownerAgentHash?: string;
134
- readonly ownerProjectHash?: string;
135
- readonly proposalIds: readonly string[];
136
- readonly completedAt: string;
137
- }
138
- type EpisodeReviewDrainEligibility = 'eligible' | 'discard' | 'defer';
139
- interface EpisodeReviewDrainOptions {
140
- readonly maxEntries?: number;
141
- /** Process this just-persisted job before bounded backlog work. */
142
- readonly preferredJobId?: string;
143
- /** Skip unrelated backlog when searching across alternate project identities. */
144
- readonly onlyPreferred?: boolean;
145
- /** Epoch-ms deadline: stop claiming new jobs once passed and release an
146
- * in-flight claim instead of committing a decision. */
147
- readonly deadlineAtMs?: number;
148
- /** Cancel new work and await the active reviewer before releasing its claim.
149
- * Owned reviewers must honor their signal and settle; neither cancellation nor
150
- * the provider timeout detaches a still-running owned reviewer. */
151
- readonly abortSignal?: AbortSignal;
152
- readonly revalidate: (entry: PendingEpisodeReview) => Promise<EpisodeReviewDrainEligibility>;
153
- readonly review: (entry: PendingEpisodeReview, signal?: AbortSignal) => Promise<readonly string[]>;
154
- readonly prepareV2Input?: (entry: PendingEpisodeReviewV2) => Promise<EpisodeReviewInputSpec>;
155
- readonly decideV2?: (entry: PendingEpisodeReviewV2, input: EpisodeReviewInputCheckpoint, signal: AbortSignal) => Promise<EpisodeReviewDecisionInput>;
156
- readonly listV2Actions?: (entry: PendingEpisodeReviewV2, decision: EpisodeReviewDecision) => readonly ('memory' | 'skill')[];
157
- readonly applyV2Action?: (entry: PendingEpisodeReviewV2, decision: EpisodeReviewDecision, carrier: 'memory' | 'skill', claim: EpisodeReviewClaim, commitWithAuthority: (effect: (revalidateAuthority: () => Promise<void>) => Promise<readonly string[]>) => Promise<readonly string[]>) => Promise<readonly string[]>;
158
- readonly onV2Completed?: (entry: PendingEpisodeReviewV2, decision: EpisodeReviewDecision, proposalIds: readonly string[]) => Promise<void>;
159
- }
160
- interface EpisodeReviewDrainResult {
161
- readonly reviewed: number;
162
- readonly discarded: number;
163
- readonly deferred: number;
164
- readonly failed: number;
165
- readonly failures: readonly {
166
- readonly reviewKey: string;
167
- readonly error: string;
168
- }[];
169
- }
170
- declare class EpisodeReviewBranchChangedError extends Error {
171
- constructor();
172
- }
173
- declare function captureEpisodeReviewBranchEpoch(identity: MemoryContextIdentity): Promise<number>;
174
- declare function persistPendingEpisodeReview(identity: MemoryContextIdentity, digest: KodaXMemoryOutcomeDigest, options?: {
175
- readonly expectedBranchEpoch?: number;
176
- readonly persistOwner?: (entry: PendingEpisodeReviewV2) => Promise<void>;
177
- }): Promise<{
178
- readonly path: string;
179
- readonly entry: PendingEpisodeReviewV2;
180
- }>;
181
- declare function claimEpisodeReview(identity: MemoryContextIdentity, reviewKeyOrJobId: string, options?: {
182
- readonly now?: Date;
183
- readonly leaseMs?: number;
184
- }): Promise<EpisodeReviewClaim | undefined>;
185
- declare function freezeEpisodeReviewInput(identity: MemoryContextIdentity, claim: EpisodeReviewClaim, spec: EpisodeReviewInputSpec, now?: Date): Promise<EpisodeReviewInputCheckpoint>;
186
- declare function commitEpisodeReviewDecision(identity: MemoryContextIdentity, claim: EpisodeReviewClaim, input: EpisodeReviewDecisionInput, now?: Date): Promise<EpisodeReviewDecision>;
187
- declare function commitEpisodeReviewAction(identity: MemoryContextIdentity, claim: EpisodeReviewClaim, input: EpisodeReviewActionInput, now?: Date): Promise<EpisodeReviewActionReceipt>;
188
- declare function withEpisodeReviewClaimAuthority<T>(identity: MemoryContextIdentity, claim: EpisodeReviewClaim, operation: (revalidateAuthority: () => Promise<void>) => Promise<T>): Promise<T>;
189
- declare function failEpisodeReviewAttempt(identity: MemoryContextIdentity, claim: EpisodeReviewClaim, failure: {
190
- readonly kind: EpisodeReviewFailureKind;
191
- readonly message: string;
192
- }, now?: Date): Promise<EpisodeReviewJobState>;
193
- declare function failEpisodeReviewApply(identity: MemoryContextIdentity, claim: EpisodeReviewClaim, failure: {
194
- readonly carrier: 'memory' | 'skill';
195
- readonly message: string;
196
- }, now?: Date): Promise<EpisodeReviewJobState>;
197
- declare function deferEpisodeReview(identity: MemoryContextIdentity, claim: EpisodeReviewClaim, reason: string, now?: Date): Promise<EpisodeReviewJobState>;
198
- declare function completeFencedEpisodeReview(identity: MemoryContextIdentity, claim: EpisodeReviewClaim, proposalIds: readonly string[], now?: Date): Promise<{
199
- readonly acknowledged: boolean;
200
- readonly receiptPath: string;
201
- }>;
202
- declare function discardFencedEpisodeReview(identity: MemoryContextIdentity, claim: EpisodeReviewClaim, reason: string, now?: Date): Promise<void>;
203
- declare function inspectEpisodeReviewJob(identity: MemoryContextIdentity, reviewKeyOrJobId: string): Promise<EpisodeReviewJobSnapshot | undefined>;
204
- declare function listPendingEpisodeReviews(filter: PendingEpisodeReviewFilter): Promise<readonly PendingEpisodeReview[]>;
205
- declare function listPendingEpisodeReviewSummaries(filter: PendingEpisodeReviewFilter): Promise<readonly PendingEpisodeReviewSummary[]>;
206
- declare function completeEpisodeReview(identity: MemoryContextIdentity, reviewKey: string, proposalIds: readonly string[]): Promise<{
207
- readonly acknowledged: boolean;
208
- readonly receiptPath: string;
209
- }>;
210
- /**
211
- * Establishes the lock order used by both review completion and Session branch
212
- * mutation: the Session root registry first, every sorted tenant branch fence
213
- * next, then the caller-owned Session transaction. The supplied fence operation
214
- * runs without reacquiring those locks, so a mutation can fence its prospective
215
- * lineage and persist that exact lineage atomically with respect to review
216
- * effects, new tenant registration and completion delivery.
217
- */
218
- declare function withPendingEpisodeReviewSessionFence<T>(input: {
219
- readonly configHome?: string;
220
- readonly sessionId: string;
221
- }, operation: (fence: (activeReviewIds: readonly string[]) => Promise<number>) => Promise<T>): Promise<T>;
222
- declare function drainPendingEpisodeReviews(identity: MemoryContextIdentity, options: EpisodeReviewDrainOptions): Promise<EpisodeReviewDrainResult>;
223
-
224
- export { deferEpisodeReview as A, discardFencedEpisodeReview as B, drainPendingEpisodeReviews as C, failEpisodeReviewApply as D, failEpisodeReviewAttempt as F, freezeEpisodeReviewInput as G, inspectEpisodeReviewJob as H, listPendingEpisodeReviewSummaries as I, listPendingEpisodeReviews as J, persistPendingEpisodeReview as K, withEpisodeReviewClaimAuthority as L, withPendingEpisodeReviewSessionFence as M, EpisodeReviewBranchChangedError as b, EpisodeReviewFailure as i, captureEpisodeReviewBranchEpoch as u, claimEpisodeReview as v, commitEpisodeReviewAction as w, commitEpisodeReviewDecision as x, completeEpisodeReview as y, completeFencedEpisodeReview as z };
225
- export type { EpisodeReviewActionInput as E, PendingEpisodeReview as P, EpisodeReviewActionReceipt as a, EpisodeReviewClaim as c, EpisodeReviewDecision as d, EpisodeReviewDecisionInput as e, EpisodeReviewDrainEligibility as f, EpisodeReviewDrainOptions as g, EpisodeReviewDrainResult as h, EpisodeReviewFailureKind as j, EpisodeReviewInputCheckpoint as k, EpisodeReviewInputSpec as l, EpisodeReviewJobSnapshot as m, EpisodeReviewJobState as n, EpisodeReviewJobStatus as o, EpisodeReviewReceipt as p, PendingEpisodeReviewFilter as q, PendingEpisodeReviewSummary as r, PendingEpisodeReviewV1 as s, PendingEpisodeReviewV2 as t };
@@ -1,94 +0,0 @@
1
- import { dr as WorkflowProcessTrackerOptions, cY as WorkflowEvent, dk as WorkflowProcessSnapshot, de as WorkflowProcessEvent } from './controller.d-J2t1q8Ly.js';
2
-
3
- /**
4
- * FEATURE_246 Part A0 (ADR-046) — neutral workflow run lifecycle manager.
5
- *
6
- * Domain-neutral run registry + lifecycle (pause / resume / stop), process-event
7
- * tracking, and terminal settle — lifted out of `@kodax-ai/coding` so any agent
8
- * (including non-coding SDK hosts) can host and manage workflow runs.
9
- *
10
- * It never knows HOW a run executes: the caller injects a `runFn` thunk that
11
- * receives lifecycle hooks (`onEvent` / `signal` / `beforeSpawn`) and returns a
12
- * caller-shaped outcome, plus a `classify` mapping that outcome to a neutral
13
- * terminal status and an `onError` that synthesizes a failure outcome. The
14
- * coding layer wires `runFn` to its `runWorkflowModule` / `runWorkflowFromOptions`
15
- * (backend + run-graph + worktrees); SDK hosts wire their own. Dependency arrows
16
- * therefore point only coding → agent — no cycle.
17
- */
18
-
19
- type ManagedWorkflowStatus = 'running' | 'paused' | 'completed' | 'failed' | 'denied' | 'stopped';
20
- /** Provenance/display metadata for a run's process tracker. */
21
- type WorkflowProcessMetadata = Pick<WorkflowProcessTrackerOptions, 'displayName' | 'goal' | 'source' | 'savedWorkflowName' | 'sourceRunId' | 'sourceWorkflowName' | 'revisionOf' | 'resumedFromRunId' | 'hostMetadata'>;
22
- interface ManagedWorkflowSnapshot {
23
- readonly stop?: {
24
- readonly state: 'unknown' | 'confirmed';
25
- };
26
- readonly runId: string;
27
- readonly workflow: string;
28
- readonly status: ManagedWorkflowStatus;
29
- readonly totalSpawned: number;
30
- readonly eventCount: number;
31
- readonly startedAt: number;
32
- readonly endedAt?: number;
33
- readonly error?: string;
34
- readonly resultText?: string;
35
- }
36
- interface ManagedWorkflowRun<TOutcome = unknown> {
37
- readonly runId: string;
38
- readonly done: Promise<TOutcome>;
39
- getSnapshot(): ManagedWorkflowSnapshot | undefined;
40
- getProcessSnapshot(): WorkflowProcessSnapshot | undefined;
41
- }
42
- /** Lifecycle hooks the manager injects into the caller's `runFn`. */
43
- interface ManagedRunHooks {
44
- /** Forward every workflow event so the manager can track spawn/progress. */
45
- readonly onEvent: (event: WorkflowEvent) => void;
46
- /** Abort signal owned by the manager (fires on stop()). */
47
- readonly signal: AbortSignal;
48
- /** Await before launching each agent so pause() can gate new spawns. */
49
- readonly beforeSpawn: () => Promise<void>;
50
- }
51
- /** Neutral terminal classification of a caller-shaped outcome. */
52
- interface ManagedRunClassification {
53
- readonly status: 'completed' | 'failed' | 'denied';
54
- readonly error?: Error;
55
- readonly resultText?: string;
56
- }
57
- interface StartManagedRunInput<TOutcome> {
58
- readonly runId: string;
59
- /** Display name (usually the workflow's `meta.name`). */
60
- readonly workflow: string;
61
- readonly phases?: readonly string[];
62
- readonly maxAgents?: number;
63
- readonly plannedAgents?: number;
64
- readonly tokenBudget?: number;
65
- readonly processMetadata?: WorkflowProcessMetadata;
66
- readonly signal?: AbortSignal;
67
- /** Executes the run with the manager's lifecycle hooks injected. */
68
- readonly runFn: (hooks: ManagedRunHooks) => Promise<TOutcome>;
69
- /** Map the caller's terminal outcome to a neutral status for the snapshot. */
70
- readonly classify: (outcome: TOutcome) => ManagedRunClassification;
71
- /** Synthesize a caller-shaped outcome when `runFn` throws. */
72
- readonly onError: (error: unknown) => TOutcome;
73
- }
74
- interface WorkflowRunManager {
75
- start<TOutcome>(input: StartManagedRunInput<TOutcome>): ManagedWorkflowRun<TOutcome>;
76
- list(): readonly ManagedWorkflowSnapshot[];
77
- get(runId: string): ManagedWorkflowSnapshot | undefined;
78
- subscribeWorkflowProcess(listener: (event: WorkflowProcessEvent) => void): () => void;
79
- getWorkflowProcessSnapshot(runId: string): WorkflowProcessSnapshot | undefined;
80
- listWorkflowProcessSnapshots(options?: {
81
- readonly activeOnly?: boolean;
82
- readonly limit?: number;
83
- }): readonly WorkflowProcessSnapshot[];
84
- pause(runId: string): boolean;
85
- resume(runId: string): boolean;
86
- stop(runId: string, reason?: string): boolean;
87
- }
88
- declare function createWorkflowRunManager(deps?: {
89
- readonly now?: () => number;
90
- }): WorkflowRunManager;
91
- declare function getDefaultWorkflowRunManager(): WorkflowRunManager;
92
-
93
- export { createWorkflowRunManager as f, getDefaultWorkflowRunManager as g };
94
- export type { ManagedRunClassification as M, StartManagedRunInput as S, WorkflowProcessMetadata as W, ManagedRunHooks as a, ManagedWorkflowRun as b, ManagedWorkflowSnapshot as c, ManagedWorkflowStatus as d, WorkflowRunManager as e };
@@ -1,323 +0,0 @@
1
- import { p as ResolvedAutoModeSettings, b as CommandDefinition, e as CommandSource, c as CommandInfo, C as Command$1, I as InteractiveContext, a as CommandCallbacks, h as CurrentConfig, d as CommandInvocationRequest, f as CommandWorkflowInvocationRequest, r as RuntimeSurfaceStatus } from './utils.d-DcznBeQ3.js';
2
- import { c as CanonicalPermissionMode, ai as SessionStorage$1, U as PermissionMode, L as LearningBinding } from './public-api.d-amBop8Nk.js';
3
- import { a9 as KodaXOptions, as as KodaXResult } from './bash-prefix-extractor.d-DWFIMg0v.js';
4
- import { V as ExecPolicyRuleInput, r as AutoModeStats } from './exec-policy.d-BPESl90L.js';
5
- import { ap as KodaXSessionStorage, ab as KodaXSessionData } from './types.d-CSv0_cZC.js';
6
-
7
- /** Host-owned user Stop; acceptance is distinct from execution settlement. */
8
- interface RuntimeStopControl {
9
- request(): Promise<{
10
- readonly state: 'unknown' | 'confirmed';
11
- }>;
12
- }
13
- interface RuntimeStopCallbacks {
14
- readonly onStopControl?: (control: RuntimeStopControl | undefined) => void;
15
- readonly onStopState?: (state: 'requesting' | 'accepted' | 'confirmed' | 'rejected', detail?: string) => void;
16
- }
17
-
18
- interface StandaloneExecPolicyOptions {
19
- readonly adminRules?: readonly ExecPolicyRuleInput[];
20
- readonly trustedProjectRoots?: readonly string[];
21
- }
22
-
23
- interface ReplRuntimePermissionGrantSuggestion {
24
- readonly id: string;
25
- readonly kind: 'session' | 'persistent';
26
- readonly label: string;
27
- }
28
- interface ReplRuntimePermissionRequest {
29
- readonly id: string;
30
- readonly toolName: string;
31
- readonly toolCallId?: string;
32
- readonly input: Readonly<Record<string, unknown>>;
33
- readonly reason?: string;
34
- readonly risk?: 'low' | 'medium' | 'high';
35
- readonly executionCwd?: string;
36
- readonly grantSuggestions?: readonly ReplRuntimePermissionGrantSuggestion[];
37
- readonly createdAt?: string;
38
- readonly expiresAt?: string;
39
- }
40
- interface ReplRuntimePermissionPromptContext {
41
- readonly signal: AbortSignal;
42
- }
43
- type ReplRuntimePermissionDecision = {
44
- readonly type: 'allow_once';
45
- } | {
46
- readonly type: 'allow_session';
47
- readonly suggestionId: string;
48
- } | {
49
- readonly type: 'allow_always';
50
- readonly suggestionId: string;
51
- } | {
52
- readonly type: 'reject';
53
- readonly reason?: string;
54
- };
55
- type ReplRuntimePermissionPrompt = (request: ReplRuntimePermissionRequest, context: ReplRuntimePermissionPromptContext) => Promise<ReplRuntimePermissionDecision>;
56
- declare const RUNTIME_PERMISSION_PENDING_NOTICE = "Runtime state: run active until this approval is resolved.";
57
- interface ReplRuntimeAutoModeControl {
58
- getStats(sessionId: string): Promise<AutoModeStats | undefined>;
59
- syncSettings?(sessionId: string, permissionMode: CanonicalPermissionMode, settings: ReplRuntimeAutoModeSettings): Promise<AutoModeStats | undefined>;
60
- subscribe?(sessionId: string, listener: (stats: AutoModeStats | undefined) => void): {
61
- close(): void;
62
- };
63
- }
64
- interface ReplRuntimeAutoModeSettings {
65
- readonly classifierModel?: string;
66
- readonly reviewPolicy?: string;
67
- }
68
- declare function toReplRuntimeAutoModeSettings(settings: ResolvedAutoModeSettings): ReplRuntimeAutoModeSettings;
69
-
70
- /**
71
- * Command Registry - Dynamic command registration system
72
- * 命令注册表 - 动态命令注册系统
73
- *
74
- * Provides centralized command management with source tracking,
75
- * supporting dynamic registration, lookup, and listing of commands.
76
- */
77
-
78
- /**
79
- * CommandRegistry - Centralized command management
80
- * 命令注册表 - 集中式命令管理
81
- *
82
- * @example
83
- * ```typescript
84
- * const registry = new CommandRegistry();
85
- *
86
- * // Register a command
87
- * registry.register({
88
- * name: 'copy',
89
- * description: 'Copy last message to clipboard',
90
- * source: 'builtin',
91
- * handler: async (args, context, callbacks, config) => {
92
- * // Implementation
93
- * }
94
- * });
95
- *
96
- * // Get a command
97
- * const cmd = registry.get('copy');
98
- *
99
- * // List all commands
100
- * const allCommands = registry.getAll();
101
- *
102
- * // List builtin commands only
103
- * const builtinCommands = registry.getBySource('builtin');
104
- * ```
105
- */
106
- declare class CommandRegistry {
107
- /**
108
- * Internal command storage
109
- * 内部命令存储
110
- */
111
- private commands;
112
- /**
113
- * Alias to command name mapping
114
- * 别名到命令名称的映射
115
- */
116
- private aliases;
117
- /**
118
- * Register a command
119
- * 注册命令
120
- *
121
- * @param def - Command definition
122
- * @throws Error if command with same name already exists
123
- */
124
- register(def: CommandDefinition): void;
125
- /**
126
- * Unregister a command
127
- * 注销命令
128
- *
129
- * @param name - Command name or alias
130
- * @returns true if command was unregistered, false if not found
131
- */
132
- unregister(name: string): boolean;
133
- /**
134
- * Get a command by name or alias
135
- * 通过名称或别名获取命令
136
- *
137
- * @param name - Command name or alias
138
- * @returns Command definition or undefined if not found
139
- */
140
- get(name: string): CommandDefinition | undefined;
141
- /**
142
- * Check if a command exists
143
- * 检查命令是否存在
144
- *
145
- * @param name - Command name or alias
146
- * @returns true if command exists, false otherwise
147
- */
148
- has(name: string): boolean;
149
- /**
150
- * Get all commands with optional source filter
151
- * 获取所有命令,可选按来源过滤
152
- *
153
- * @param source - Optional source filter
154
- * @returns Array of command information
155
- */
156
- getAll(source?: CommandSource): CommandInfo[];
157
- /**
158
- * Get commands by source
159
- * 按来源获取命令
160
- *
161
- * @param source - Command source
162
- * @returns Array of command information
163
- */
164
- getBySource(source: CommandSource): CommandInfo[];
165
- /**
166
- * Get all command names
167
- * 获取所有命令名称
168
- *
169
- * @returns Array of command names
170
- */
171
- getNames(): string[];
172
- /**
173
- * Clear all commands
174
- * 清空所有命令
175
- */
176
- clear(): void;
177
- /**
178
- * Get command count
179
- * 获取命令数量
180
- *
181
- * @returns Number of registered commands
182
- */
183
- get size(): number;
184
- /**
185
- * Get alias count
186
- * 获取别名数量
187
- *
188
- * @returns Number of registered aliases
189
- */
190
- get aliasCount(): number;
191
- }
192
-
193
- /**
194
- * KodaX Interactive Command System
195
- */
196
-
197
- type Command = Command$1;
198
- declare const BUILTIN_COMMANDS: Command[];
199
- declare function getCommandRegistry(projectRoot?: string): CommandRegistry;
200
- declare function parseCommand(input: string): {
201
- command: string;
202
- args: string[];
203
- skillInvocation?: {
204
- name: string;
205
- };
206
- } | null;
207
- type CommandResult = boolean | {
208
- skillContent?: string;
209
- invocation?: CommandInvocationRequest;
210
- workflow?: CommandWorkflowInvocationRequest;
211
- };
212
- declare function executeCommand(parsed: {
213
- command: string;
214
- args: string[];
215
- skillInvocation?: {
216
- name: string;
217
- };
218
- }, context: InteractiveContext, callbacks: CommandCallbacks, currentConfig: CurrentConfig, rawInput?: string): Promise<CommandResult>;
219
-
220
- /**
221
- * InkREPL - Ink-based REPL Adapter
222
- *
223
- * Bridges Ink UI components with existing KodaX command processing logic.
224
- * Replaces the Node.js readline-based input with Ink's React components.
225
- *
226
- * Architecture based on Gemini CLI:
227
- * - Uses UIStateContext for global state
228
- * - Uses KeypressContext for priority-based keyboard handling
229
- * - Uses StreamingContext for streaming response management
230
- */
231
-
232
- interface InkRuntimeRunnerInput extends RuntimeStopCallbacks {
233
- readonly options: KodaXOptions;
234
- readonly prompt: string;
235
- readonly sessionId: string;
236
- readonly permissionMode: PermissionMode;
237
- readonly autoModeSettings?: ReplRuntimeAutoModeSettings;
238
- readonly requestPermission?: ReplRuntimePermissionPrompt;
239
- /** Marks the callback installed by the REPL's legacy permission UI. */
240
- readonly legacyPermissionHook?: true;
241
- }
242
- type InkRuntimeRunner = (input: InkRuntimeRunnerInput) => Promise<KodaXResult>;
243
- type InkRuntimeStatusProvider = () => Promise<RuntimeSurfaceStatus | undefined>;
244
- interface InkTransientNotice {
245
- readonly text: string;
246
- readonly tone: "success" | "warning";
247
- }
248
- interface InkREPLOptions extends KodaXOptions {
249
- storage?: SessionStorage$1;
250
- execPolicy?: StandaloneExecPolicyOptions;
251
- hardExitOnClose?: boolean;
252
- runtimeRunner?: InkRuntimeRunner;
253
- runtimeAutoModeControl?: ReplRuntimeAutoModeControl;
254
- getRuntimeStatus?: InkRuntimeStatusProvider;
255
- validateSetupA2AConfig?: (value: unknown) => unknown;
256
- prepareSetupSandbox?: CommandCallbacks['prepareSetupSandbox'];
257
- inspectSandbox?: CommandCallbacks['inspectSandbox'];
258
- learning?: LearningBinding;
259
- subscribeTransientNotices?: (listener: (notice: InkTransientNotice) => void) => () => void;
260
- }
261
-
262
- /** Manual shell syntax is a host tool invocation under the current Session owner. */
263
- interface ShellExecutorConfig {
264
- maxBuffer?: number;
265
- timeout?: number;
266
- maxOutputLength?: number;
267
- maxErrorLength?: number;
268
- cwd?: string;
269
- execute?: (command: string) => Promise<{
270
- success: boolean;
271
- lastText: string;
272
- interrupted?: boolean;
273
- }>;
274
- onOutput?: (text: string) => void;
275
- }
276
- declare function executeShellCommand(command: string, config?: ShellExecutorConfig): Promise<string>;
277
- declare function isShellCommand(input: string): boolean;
278
- declare function isShellCommandSuccess(result: string): boolean;
279
-
280
- interface SessionStorage extends KodaXSessionStorage {
281
- list(gitRoot?: string, options?: {
282
- limit?: number;
283
- includeArchived?: boolean;
284
- }): Promise<Array<{
285
- id: string;
286
- title: string;
287
- msgCount: number;
288
- tag?: string;
289
- runtimeInfo?: KodaXSessionData['runtimeInfo'];
290
- }>>;
291
- }
292
- interface ReplRuntimeRunnerInput extends RuntimeStopCallbacks {
293
- readonly options: KodaXOptions;
294
- readonly prompt: string;
295
- readonly sessionId: string;
296
- readonly permissionMode: PermissionMode;
297
- readonly autoModeSettings?: ReplRuntimeAutoModeSettings;
298
- readonly requestPermission?: ReplRuntimePermissionPrompt;
299
- /** Marks the callback installed by the REPL's legacy permission UI. */
300
- readonly legacyPermissionHook?: true;
301
- }
302
- type ReplRuntimeRunner = (input: ReplRuntimeRunnerInput) => Promise<KodaXResult>;
303
- type ReplRuntimeStatusProvider = () => Promise<RuntimeSurfaceStatus | undefined>;
304
- interface RepLOptions extends KodaXOptions {
305
- storage?: SessionStorage;
306
- execPolicy?: StandaloneExecPolicyOptions;
307
- runtimeRunner?: ReplRuntimeRunner;
308
- runtimeAutoModeControl?: ReplRuntimeAutoModeControl;
309
- getRuntimeStatus?: ReplRuntimeStatusProvider;
310
- validateSetupA2AConfig?: (value: unknown) => unknown;
311
- prepareSetupSandbox?: CommandCallbacks['prepareSetupSandbox'];
312
- inspectSandbox?: CommandCallbacks['inspectSandbox'];
313
- learning?: LearningBinding;
314
- }
315
- declare function processSpecialSyntax(input: string, executionCwd?: string, execute?: ShellExecutorConfig['execute']): Promise<string>;
316
-
317
- /** KodaX-owned classic REPL entry with the native trusted-text authority bound. */
318
- declare function runInteractiveMode(options: RepLOptions): Promise<void>;
319
- /** KodaX-owned Ink REPL entry with the native trusted-text authority bound. */
320
- declare function runInkInteractiveMode(options: InkREPLOptions): Promise<void>;
321
-
322
- export { toReplRuntimeAutoModeSettings as A, BUILTIN_COMMANDS as B, RUNTIME_PERMISSION_PENDING_NOTICE as R, executeCommand as r, executeShellCommand as s, getCommandRegistry as t, isShellCommand as u, isShellCommandSuccess as v, parseCommand as w, processSpecialSyntax as x, runInkInteractiveMode as y, runInteractiveMode as z };
323
- export type { Command as C, InkREPLOptions as I, ShellExecutorConfig as S, InkRuntimeRunner as a, InkRuntimeRunnerInput as b, InkRuntimeStatusProvider as c, InkTransientNotice as d, RepLOptions as e, ReplRuntimeAutoModeControl as f, ReplRuntimeAutoModeSettings as g, ReplRuntimePermissionDecision as h, ReplRuntimePermissionGrantSuggestion as i, ReplRuntimePermissionPrompt as j, ReplRuntimePermissionRequest as k, ReplRuntimeRunner as l, ReplRuntimeRunnerInput as m, ReplRuntimeStatusProvider as n, RuntimeStopCallbacks as o, RuntimeStopControl as p, StandaloneExecPolicyOptions as q };