@ktkid/kmh-codex-cli 0.0.0-stage → 0.1.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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +296 -2
  3. package/bin/README.md +25 -0
  4. package/bin/codex +36 -0
  5. package/bin/runtime-receipt.json +9 -0
  6. package/bin/version +1 -0
  7. package/cordis.patch.yml +7 -0
  8. package/lib/browser-types/src/account-status.d.ts +9 -0
  9. package/lib/browser-types/src/client/ComposerQuota.d.ts +10 -0
  10. package/lib/browser-types/src/client/DetailCard.d.ts +12 -0
  11. package/lib/browser-types/src/client/LiveBall.d.ts +19 -0
  12. package/lib/browser-types/src/client/QuotaCard.d.ts +20 -0
  13. package/lib/browser-types/src/client/QuotaDisplaySettings.d.ts +6 -0
  14. package/lib/browser-types/src/client/index.d.ts +18 -0
  15. package/lib/browser-types/src/client/locales.d.ts +54 -0
  16. package/lib/browser-types/src/client/quota-store.d.ts +56 -0
  17. package/lib/browser-types/src/live-state.d.ts +31 -0
  18. package/lib/browser-types/src/quota-protocol.d.ts +135 -0
  19. package/lib/browser-types/src/quota-rules.d.ts +18 -0
  20. package/lib/browser-types/src/tool-switches.d.ts +63 -0
  21. package/lib/client.js +16193 -0
  22. package/lib/src/account-status.d.ts +9 -0
  23. package/lib/src/account-status.js +1 -0
  24. package/lib/src/account.d.ts +35 -0
  25. package/lib/src/account.js +173 -0
  26. package/lib/src/adapter.d.ts +22 -0
  27. package/lib/src/adapter.js +222 -0
  28. package/lib/src/approval.d.ts +48 -0
  29. package/lib/src/approval.js +235 -0
  30. package/lib/src/capabilities.d.ts +40 -0
  31. package/lib/src/capabilities.js +85 -0
  32. package/lib/src/config.d.ts +69 -0
  33. package/lib/src/config.js +75 -0
  34. package/lib/src/connection.d.ts +65 -0
  35. package/lib/src/connection.js +178 -0
  36. package/lib/src/cursor.d.ts +61 -0
  37. package/lib/src/cursor.js +339 -0
  38. package/lib/src/image-delivery.d.ts +36 -0
  39. package/lib/src/image-delivery.js +65 -0
  40. package/lib/src/imagegen.d.ts +21 -0
  41. package/lib/src/imagegen.js +132 -0
  42. package/lib/src/index.d.ts +146 -0
  43. package/lib/src/index.js +551 -0
  44. package/lib/src/isolation.d.ts +61 -0
  45. package/lib/src/isolation.js +298 -0
  46. package/lib/src/live-state.d.ts +31 -0
  47. package/lib/src/live-state.js +14 -0
  48. package/lib/src/models.d.ts +24 -0
  49. package/lib/src/models.js +98 -0
  50. package/lib/src/native-items.d.ts +59 -0
  51. package/lib/src/native-items.js +122 -0
  52. package/lib/src/native-tools/catalog.d.ts +29 -0
  53. package/lib/src/native-tools/catalog.js +197 -0
  54. package/lib/src/probe.d.ts +17 -0
  55. package/lib/src/probe.js +54 -0
  56. package/lib/src/protocol.d.ts +508 -0
  57. package/lib/src/protocol.js +511 -0
  58. package/lib/src/quota-protocol.d.ts +135 -0
  59. package/lib/src/quota-protocol.js +97 -0
  60. package/lib/src/quota-rules.d.ts +18 -0
  61. package/lib/src/quota-rules.js +49 -0
  62. package/lib/src/quota.d.ts +32 -0
  63. package/lib/src/quota.js +227 -0
  64. package/lib/src/session-history.d.ts +18 -0
  65. package/lib/src/session-history.js +113 -0
  66. package/lib/src/session-store.d.ts +592 -0
  67. package/lib/src/session-store.js +275 -0
  68. package/lib/src/status.d.ts +19 -0
  69. package/lib/src/status.js +69 -0
  70. package/lib/src/tool-policy.d.ts +47 -0
  71. package/lib/src/tool-policy.js +454 -0
  72. package/lib/src/tool-registry.d.ts +42 -0
  73. package/lib/src/tool-registry.js +70 -0
  74. package/lib/src/tool-selection.d.ts +88 -0
  75. package/lib/src/tool-selection.js +60 -0
  76. package/lib/src/tool-switches-service.d.ts +24 -0
  77. package/lib/src/tool-switches-service.js +129 -0
  78. package/lib/src/tool-switches.d.ts +63 -0
  79. package/lib/src/tool-switches.js +43 -0
  80. package/lib/src/turn.d.ts +200 -0
  81. package/lib/src/turn.js +1012 -0
  82. package/lib/src/web.d.ts +9 -0
  83. package/lib/src/web.js +143 -0
  84. package/package.json +172 -4
  85. package/vendor/codex/LICENSE +201 -0
  86. package/vendor/codex/NOTICE +4 -0
  87. package/vendor/codex/models.json +1613 -0
  88. package/vendor/native-tools/0.162.0-alpha.17.2.json +143 -0
  89. package/vendor/native-tools/0.163.0-alpha.10.2.json +128 -0
@@ -0,0 +1,592 @@
1
+ import { z } from "zod";
2
+ import Schema from "@deepseek-ai/schemastery";
3
+ import { type Branded } from "@deepseek-ai/dsh-brand";
4
+ import { CliTargetId, ToolSourceId } from "./tool-selection.ts";
5
+ import type { CursorSnapshot } from "./cursor.ts";
6
+ /** 创建时固定的工具信息;原生目录首次验证后补存,技能仍独立读取。 */
7
+ export declare const SavedToolPolicySchema: z.ZodObject<{
8
+ version: z.ZodLiteral<1>;
9
+ target: z.ZodPipe<z.ZodString, z.ZodTransform<CliTargetId, string>>;
10
+ choices: z.ZodPipe<z.ZodCustom<Schemastery.ObjectT<{
11
+ version: Schema<1, 1, "defined">;
12
+ harness: Schema<Schemastery.ObjectS<{
13
+ source: Schema<string, string, "defined">;
14
+ name: Schema<string, string, "defined">;
15
+ enabled: Schema<boolean, boolean, "defined">;
16
+ }>[], Schemastery.ObjectT<{
17
+ source: Schema<string, string, "defined">;
18
+ name: Schema<string, string, "defined">;
19
+ enabled: Schema<boolean, boolean, "defined">;
20
+ }>[], "defined">;
21
+ native: Schema<Schemastery.ObjectS<{
22
+ source: Schema<string, string, "defined">;
23
+ name: Schema<string, string, "defined">;
24
+ enabled: Schema<boolean, boolean, "defined">;
25
+ }>[], Schemastery.ObjectT<{
26
+ source: Schema<string, string, "defined">;
27
+ name: Schema<string, string, "defined">;
28
+ enabled: Schema<boolean, boolean, "defined">;
29
+ }>[], "defined">;
30
+ }>, Schemastery.ObjectT<{
31
+ version: Schema<1, 1, "defined">;
32
+ harness: Schema<Schemastery.ObjectS<{
33
+ source: Schema<string, string, "defined">;
34
+ name: Schema<string, string, "defined">;
35
+ enabled: Schema<boolean, boolean, "defined">;
36
+ }>[], Schemastery.ObjectT<{
37
+ source: Schema<string, string, "defined">;
38
+ name: Schema<string, string, "defined">;
39
+ enabled: Schema<boolean, boolean, "defined">;
40
+ }>[], "defined">;
41
+ native: Schema<Schemastery.ObjectS<{
42
+ source: Schema<string, string, "defined">;
43
+ name: Schema<string, string, "defined">;
44
+ enabled: Schema<boolean, boolean, "defined">;
45
+ }>[], Schemastery.ObjectT<{
46
+ source: Schema<string, string, "defined">;
47
+ name: Schema<string, string, "defined">;
48
+ enabled: Schema<boolean, boolean, "defined">;
49
+ }>[], "defined">;
50
+ }>>, z.ZodTransform<Schemastery.ObjectT<{
51
+ version: Schema<1, 1, "defined">;
52
+ harness: Schema<Schemastery.ObjectS<{
53
+ source: Schema<string, string, "defined">;
54
+ name: Schema<string, string, "defined">;
55
+ enabled: Schema<boolean, boolean, "defined">;
56
+ }>[], Schemastery.ObjectT<{
57
+ source: Schema<string, string, "defined">;
58
+ name: Schema<string, string, "defined">;
59
+ enabled: Schema<boolean, boolean, "defined">;
60
+ }>[], "defined">;
61
+ native: Schema<Schemastery.ObjectS<{
62
+ source: Schema<string, string, "defined">;
63
+ name: Schema<string, string, "defined">;
64
+ enabled: Schema<boolean, boolean, "defined">;
65
+ }>[], Schemastery.ObjectT<{
66
+ source: Schema<string, string, "defined">;
67
+ name: Schema<string, string, "defined">;
68
+ enabled: Schema<boolean, boolean, "defined">;
69
+ }>[], "defined">;
70
+ }>, Schemastery.ObjectT<{
71
+ version: Schema<1, 1, "defined">;
72
+ harness: Schema<Schemastery.ObjectS<{
73
+ source: Schema<string, string, "defined">;
74
+ name: Schema<string, string, "defined">;
75
+ enabled: Schema<boolean, boolean, "defined">;
76
+ }>[], Schemastery.ObjectT<{
77
+ source: Schema<string, string, "defined">;
78
+ name: Schema<string, string, "defined">;
79
+ enabled: Schema<boolean, boolean, "defined">;
80
+ }>[], "defined">;
81
+ native: Schema<Schemastery.ObjectS<{
82
+ source: Schema<string, string, "defined">;
83
+ name: Schema<string, string, "defined">;
84
+ enabled: Schema<boolean, boolean, "defined">;
85
+ }>[], Schemastery.ObjectT<{
86
+ source: Schema<string, string, "defined">;
87
+ name: Schema<string, string, "defined">;
88
+ enabled: Schema<boolean, boolean, "defined">;
89
+ }>[], "defined">;
90
+ }>>>;
91
+ inventory: z.ZodArray<z.ZodPipe<z.ZodObject<{
92
+ source: z.ZodPipe<z.ZodString, z.ZodTransform<ToolSourceId, string>>;
93
+ sourceLabel: z.ZodOptional<z.ZodString>;
94
+ schema: z.ZodPipe<z.ZodObject<{
95
+ name: z.ZodString;
96
+ description: z.ZodString;
97
+ parameters: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
98
+ deferLoading: z.ZodOptional<z.ZodLiteral<true>>;
99
+ }, z.core.$strip>, z.ZodTransform<{
100
+ deferLoading?: true;
101
+ name: string;
102
+ description: string;
103
+ parameters: Record<string, z.core.util.JSONType>;
104
+ }, {
105
+ name: string;
106
+ description: string;
107
+ parameters: Record<string, z.core.util.JSONType>;
108
+ deferLoading?: true | undefined;
109
+ }>>;
110
+ sdk: z.ZodOptional<z.ZodPipe<z.ZodObject<{
111
+ name: z.ZodString;
112
+ description: z.ZodString;
113
+ parameters: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
114
+ deferLoading: z.ZodOptional<z.ZodLiteral<true>>;
115
+ output: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodJSONSchema>, z.ZodTransform<Record<string, z.core.util.JSONType>, Record<string, z.core.util.JSONType>>>;
116
+ }, z.core.$strip>, z.ZodTransform<{
117
+ deferLoading?: true;
118
+ name: string;
119
+ description: string;
120
+ parameters: Record<string, z.core.util.JSONType>;
121
+ output: Record<string, z.core.util.JSONType>;
122
+ }, {
123
+ name: string;
124
+ description: string;
125
+ parameters: Record<string, z.core.util.JSONType>;
126
+ output: Record<string, z.core.util.JSONType>;
127
+ deferLoading?: true | undefined;
128
+ }>>>;
129
+ }, z.core.$strip>, z.ZodTransform<{
130
+ sdk?: {
131
+ deferLoading?: true;
132
+ name: string;
133
+ description: string;
134
+ parameters: Record<string, z.core.util.JSONType>;
135
+ output: Record<string, z.core.util.JSONType>;
136
+ };
137
+ sourceLabel?: string;
138
+ source: ToolSourceId;
139
+ schema: {
140
+ deferLoading?: true;
141
+ name: string;
142
+ description: string;
143
+ parameters: Record<string, z.core.util.JSONType>;
144
+ };
145
+ }, {
146
+ source: ToolSourceId;
147
+ schema: {
148
+ deferLoading?: true;
149
+ name: string;
150
+ description: string;
151
+ parameters: Record<string, z.core.util.JSONType>;
152
+ };
153
+ sourceLabel?: string | undefined;
154
+ sdk?: {
155
+ deferLoading?: true;
156
+ name: string;
157
+ description: string;
158
+ parameters: Record<string, z.core.util.JSONType>;
159
+ output: Record<string, z.core.util.JSONType>;
160
+ } | undefined;
161
+ }>>>;
162
+ nativeExecution: z.ZodObject<{
163
+ commandExecution: z.ZodBoolean;
164
+ fileChange: z.ZodBoolean;
165
+ viewImage: z.ZodBoolean;
166
+ webSearch: z.ZodBoolean;
167
+ }, z.core.$strip>;
168
+ nativeCatalog: z.ZodOptional<z.ZodObject<{
169
+ version: z.ZodString;
170
+ rows: z.ZodArray<z.ZodPipe<z.ZodObject<{
171
+ side: z.ZodEnum<{
172
+ harness: "harness";
173
+ native: "native";
174
+ }>;
175
+ source: z.ZodPipe<z.ZodString, z.ZodTransform<ToolSourceId, string>>;
176
+ name: z.ZodString;
177
+ description: z.ZodString;
178
+ sourceLabel: z.ZodOptional<z.ZodString>;
179
+ registryName: z.ZodOptional<z.ZodString>;
180
+ declaration: z.ZodOptional<z.ZodJSONSchema>;
181
+ schema: z.ZodOptional<z.ZodPipe<z.ZodObject<{
182
+ name: z.ZodString;
183
+ description: z.ZodString;
184
+ parameters: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
185
+ deferLoading: z.ZodOptional<z.ZodLiteral<true>>;
186
+ }, z.core.$strip>, z.ZodTransform<{
187
+ deferLoading?: true;
188
+ name: string;
189
+ description: string;
190
+ parameters: Record<string, z.core.util.JSONType>;
191
+ }, {
192
+ name: string;
193
+ description: string;
194
+ parameters: Record<string, z.core.util.JSONType>;
195
+ deferLoading?: true | undefined;
196
+ }>>>;
197
+ control: z.ZodDiscriminatedUnion<[z.ZodObject<{
198
+ kind: z.ZodLiteral<"adjustable">;
199
+ }, z.core.$strip>, z.ZodObject<{
200
+ kind: z.ZodLiteral<"linked">;
201
+ group: z.ZodString;
202
+ }, z.core.$strip>, z.ZodObject<{
203
+ kind: z.ZodLiteral<"fixed">;
204
+ enabled: z.ZodBoolean;
205
+ reason: z.ZodString;
206
+ }, z.core.$strip>, z.ZodObject<{
207
+ kind: z.ZodLiteral<"unverified">;
208
+ reason: z.ZodString;
209
+ }, z.core.$strip>], "kind">;
210
+ }, z.core.$strip>, z.ZodTransform<{
211
+ schema?: {
212
+ deferLoading?: true;
213
+ name: string;
214
+ description: string;
215
+ parameters: Record<string, z.core.util.JSONType>;
216
+ };
217
+ declaration?: z.core.util.JSONType;
218
+ registryName?: string;
219
+ sourceLabel?: string;
220
+ side: "harness" | "native";
221
+ source: ToolSourceId;
222
+ name: string;
223
+ description: string;
224
+ control: {
225
+ kind: "adjustable";
226
+ } | {
227
+ kind: "linked";
228
+ group: string;
229
+ } | {
230
+ kind: "fixed";
231
+ enabled: boolean;
232
+ reason: string;
233
+ } | {
234
+ kind: "unverified";
235
+ reason: string;
236
+ };
237
+ }, {
238
+ side: "harness" | "native";
239
+ source: ToolSourceId;
240
+ name: string;
241
+ description: string;
242
+ control: {
243
+ kind: "adjustable";
244
+ } | {
245
+ kind: "linked";
246
+ group: string;
247
+ } | {
248
+ kind: "fixed";
249
+ enabled: boolean;
250
+ reason: string;
251
+ } | {
252
+ kind: "unverified";
253
+ reason: string;
254
+ };
255
+ sourceLabel?: string | undefined;
256
+ registryName?: string | undefined;
257
+ declaration?: z.core.util.JSONType | undefined;
258
+ schema?: {
259
+ deferLoading?: true;
260
+ name: string;
261
+ description: string;
262
+ parameters: Record<string, z.core.util.JSONType>;
263
+ } | undefined;
264
+ }>>>;
265
+ }, z.core.$strip>>;
266
+ }, z.core.$strip>;
267
+ /** 已校验的会话固定工具记录。 */
268
+ export type SavedToolPolicy = z.infer<typeof SavedToolPolicySchema>;
269
+ type NativeSessionId = Branded<"CodexNativeSessionId">;
270
+ type NativeTurnId = Branded<"CodexNativeTurnId">;
271
+ declare const bindingSchema: z.ZodObject<{
272
+ threadId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<NativeSessionId, string>>>;
273
+ fingerprints: z.ZodArray<z.ZodString>;
274
+ lastTurnId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<NativeTurnId, string>>>;
275
+ delivered: z.ZodOptional<z.ZodArray<z.ZodString>>;
276
+ toolsVersion: z.ZodOptional<z.ZodNumber>;
277
+ toolFingerprint: z.ZodOptional<z.ZodString>;
278
+ turns: z.ZodOptional<z.ZodArray<z.ZodObject<{
279
+ turnId: z.ZodPipe<z.ZodString, z.ZodTransform<NativeTurnId, string>>;
280
+ fingerprints: z.ZodArray<z.ZodString>;
281
+ delivered: z.ZodArray<z.ZodString>;
282
+ }, z.core.$strip>>>;
283
+ previousThreadIds: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<NativeSessionId, string>>>>;
284
+ toolMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
285
+ toolPolicy: z.ZodOptional<z.ZodObject<{
286
+ version: z.ZodLiteral<1>;
287
+ target: z.ZodPipe<z.ZodString, z.ZodTransform<CliTargetId, string>>;
288
+ choices: z.ZodPipe<z.ZodCustom<Schemastery.ObjectT<{
289
+ version: Schema<1, 1, "defined">;
290
+ harness: Schema<Schemastery.ObjectS<{
291
+ source: Schema<string, string, "defined">;
292
+ name: Schema<string, string, "defined">;
293
+ enabled: Schema<boolean, boolean, "defined">;
294
+ }>[], Schemastery.ObjectT<{
295
+ source: Schema<string, string, "defined">;
296
+ name: Schema<string, string, "defined">;
297
+ enabled: Schema<boolean, boolean, "defined">;
298
+ }>[], "defined">;
299
+ native: Schema<Schemastery.ObjectS<{
300
+ source: Schema<string, string, "defined">;
301
+ name: Schema<string, string, "defined">;
302
+ enabled: Schema<boolean, boolean, "defined">;
303
+ }>[], Schemastery.ObjectT<{
304
+ source: Schema<string, string, "defined">;
305
+ name: Schema<string, string, "defined">;
306
+ enabled: Schema<boolean, boolean, "defined">;
307
+ }>[], "defined">;
308
+ }>, Schemastery.ObjectT<{
309
+ version: Schema<1, 1, "defined">;
310
+ harness: Schema<Schemastery.ObjectS<{
311
+ source: Schema<string, string, "defined">;
312
+ name: Schema<string, string, "defined">;
313
+ enabled: Schema<boolean, boolean, "defined">;
314
+ }>[], Schemastery.ObjectT<{
315
+ source: Schema<string, string, "defined">;
316
+ name: Schema<string, string, "defined">;
317
+ enabled: Schema<boolean, boolean, "defined">;
318
+ }>[], "defined">;
319
+ native: Schema<Schemastery.ObjectS<{
320
+ source: Schema<string, string, "defined">;
321
+ name: Schema<string, string, "defined">;
322
+ enabled: Schema<boolean, boolean, "defined">;
323
+ }>[], Schemastery.ObjectT<{
324
+ source: Schema<string, string, "defined">;
325
+ name: Schema<string, string, "defined">;
326
+ enabled: Schema<boolean, boolean, "defined">;
327
+ }>[], "defined">;
328
+ }>>, z.ZodTransform<Schemastery.ObjectT<{
329
+ version: Schema<1, 1, "defined">;
330
+ harness: Schema<Schemastery.ObjectS<{
331
+ source: Schema<string, string, "defined">;
332
+ name: Schema<string, string, "defined">;
333
+ enabled: Schema<boolean, boolean, "defined">;
334
+ }>[], Schemastery.ObjectT<{
335
+ source: Schema<string, string, "defined">;
336
+ name: Schema<string, string, "defined">;
337
+ enabled: Schema<boolean, boolean, "defined">;
338
+ }>[], "defined">;
339
+ native: Schema<Schemastery.ObjectS<{
340
+ source: Schema<string, string, "defined">;
341
+ name: Schema<string, string, "defined">;
342
+ enabled: Schema<boolean, boolean, "defined">;
343
+ }>[], Schemastery.ObjectT<{
344
+ source: Schema<string, string, "defined">;
345
+ name: Schema<string, string, "defined">;
346
+ enabled: Schema<boolean, boolean, "defined">;
347
+ }>[], "defined">;
348
+ }>, Schemastery.ObjectT<{
349
+ version: Schema<1, 1, "defined">;
350
+ harness: Schema<Schemastery.ObjectS<{
351
+ source: Schema<string, string, "defined">;
352
+ name: Schema<string, string, "defined">;
353
+ enabled: Schema<boolean, boolean, "defined">;
354
+ }>[], Schemastery.ObjectT<{
355
+ source: Schema<string, string, "defined">;
356
+ name: Schema<string, string, "defined">;
357
+ enabled: Schema<boolean, boolean, "defined">;
358
+ }>[], "defined">;
359
+ native: Schema<Schemastery.ObjectS<{
360
+ source: Schema<string, string, "defined">;
361
+ name: Schema<string, string, "defined">;
362
+ enabled: Schema<boolean, boolean, "defined">;
363
+ }>[], Schemastery.ObjectT<{
364
+ source: Schema<string, string, "defined">;
365
+ name: Schema<string, string, "defined">;
366
+ enabled: Schema<boolean, boolean, "defined">;
367
+ }>[], "defined">;
368
+ }>>>;
369
+ inventory: z.ZodArray<z.ZodPipe<z.ZodObject<{
370
+ source: z.ZodPipe<z.ZodString, z.ZodTransform<ToolSourceId, string>>;
371
+ sourceLabel: z.ZodOptional<z.ZodString>;
372
+ schema: z.ZodPipe<z.ZodObject<{
373
+ name: z.ZodString;
374
+ description: z.ZodString;
375
+ parameters: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
376
+ deferLoading: z.ZodOptional<z.ZodLiteral<true>>;
377
+ }, z.core.$strip>, z.ZodTransform<{
378
+ deferLoading?: true;
379
+ name: string;
380
+ description: string;
381
+ parameters: Record<string, z.core.util.JSONType>;
382
+ }, {
383
+ name: string;
384
+ description: string;
385
+ parameters: Record<string, z.core.util.JSONType>;
386
+ deferLoading?: true | undefined;
387
+ }>>;
388
+ sdk: z.ZodOptional<z.ZodPipe<z.ZodObject<{
389
+ name: z.ZodString;
390
+ description: z.ZodString;
391
+ parameters: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
392
+ deferLoading: z.ZodOptional<z.ZodLiteral<true>>;
393
+ output: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodJSONSchema>, z.ZodTransform<Record<string, z.core.util.JSONType>, Record<string, z.core.util.JSONType>>>;
394
+ }, z.core.$strip>, z.ZodTransform<{
395
+ deferLoading?: true;
396
+ name: string;
397
+ description: string;
398
+ parameters: Record<string, z.core.util.JSONType>;
399
+ output: Record<string, z.core.util.JSONType>;
400
+ }, {
401
+ name: string;
402
+ description: string;
403
+ parameters: Record<string, z.core.util.JSONType>;
404
+ output: Record<string, z.core.util.JSONType>;
405
+ deferLoading?: true | undefined;
406
+ }>>>;
407
+ }, z.core.$strip>, z.ZodTransform<{
408
+ sdk?: {
409
+ deferLoading?: true;
410
+ name: string;
411
+ description: string;
412
+ parameters: Record<string, z.core.util.JSONType>;
413
+ output: Record<string, z.core.util.JSONType>;
414
+ };
415
+ sourceLabel?: string;
416
+ source: ToolSourceId;
417
+ schema: {
418
+ deferLoading?: true;
419
+ name: string;
420
+ description: string;
421
+ parameters: Record<string, z.core.util.JSONType>;
422
+ };
423
+ }, {
424
+ source: ToolSourceId;
425
+ schema: {
426
+ deferLoading?: true;
427
+ name: string;
428
+ description: string;
429
+ parameters: Record<string, z.core.util.JSONType>;
430
+ };
431
+ sourceLabel?: string | undefined;
432
+ sdk?: {
433
+ deferLoading?: true;
434
+ name: string;
435
+ description: string;
436
+ parameters: Record<string, z.core.util.JSONType>;
437
+ output: Record<string, z.core.util.JSONType>;
438
+ } | undefined;
439
+ }>>>;
440
+ nativeExecution: z.ZodObject<{
441
+ commandExecution: z.ZodBoolean;
442
+ fileChange: z.ZodBoolean;
443
+ viewImage: z.ZodBoolean;
444
+ webSearch: z.ZodBoolean;
445
+ }, z.core.$strip>;
446
+ nativeCatalog: z.ZodOptional<z.ZodObject<{
447
+ version: z.ZodString;
448
+ rows: z.ZodArray<z.ZodPipe<z.ZodObject<{
449
+ side: z.ZodEnum<{
450
+ harness: "harness";
451
+ native: "native";
452
+ }>;
453
+ source: z.ZodPipe<z.ZodString, z.ZodTransform<ToolSourceId, string>>;
454
+ name: z.ZodString;
455
+ description: z.ZodString;
456
+ sourceLabel: z.ZodOptional<z.ZodString>;
457
+ registryName: z.ZodOptional<z.ZodString>;
458
+ declaration: z.ZodOptional<z.ZodJSONSchema>;
459
+ schema: z.ZodOptional<z.ZodPipe<z.ZodObject<{
460
+ name: z.ZodString;
461
+ description: z.ZodString;
462
+ parameters: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
463
+ deferLoading: z.ZodOptional<z.ZodLiteral<true>>;
464
+ }, z.core.$strip>, z.ZodTransform<{
465
+ deferLoading?: true;
466
+ name: string;
467
+ description: string;
468
+ parameters: Record<string, z.core.util.JSONType>;
469
+ }, {
470
+ name: string;
471
+ description: string;
472
+ parameters: Record<string, z.core.util.JSONType>;
473
+ deferLoading?: true | undefined;
474
+ }>>>;
475
+ control: z.ZodDiscriminatedUnion<[z.ZodObject<{
476
+ kind: z.ZodLiteral<"adjustable">;
477
+ }, z.core.$strip>, z.ZodObject<{
478
+ kind: z.ZodLiteral<"linked">;
479
+ group: z.ZodString;
480
+ }, z.core.$strip>, z.ZodObject<{
481
+ kind: z.ZodLiteral<"fixed">;
482
+ enabled: z.ZodBoolean;
483
+ reason: z.ZodString;
484
+ }, z.core.$strip>, z.ZodObject<{
485
+ kind: z.ZodLiteral<"unverified">;
486
+ reason: z.ZodString;
487
+ }, z.core.$strip>], "kind">;
488
+ }, z.core.$strip>, z.ZodTransform<{
489
+ schema?: {
490
+ deferLoading?: true;
491
+ name: string;
492
+ description: string;
493
+ parameters: Record<string, z.core.util.JSONType>;
494
+ };
495
+ declaration?: z.core.util.JSONType;
496
+ registryName?: string;
497
+ sourceLabel?: string;
498
+ side: "harness" | "native";
499
+ source: ToolSourceId;
500
+ name: string;
501
+ description: string;
502
+ control: {
503
+ kind: "adjustable";
504
+ } | {
505
+ kind: "linked";
506
+ group: string;
507
+ } | {
508
+ kind: "fixed";
509
+ enabled: boolean;
510
+ reason: string;
511
+ } | {
512
+ kind: "unverified";
513
+ reason: string;
514
+ };
515
+ }, {
516
+ side: "harness" | "native";
517
+ source: ToolSourceId;
518
+ name: string;
519
+ description: string;
520
+ control: {
521
+ kind: "adjustable";
522
+ } | {
523
+ kind: "linked";
524
+ group: string;
525
+ } | {
526
+ kind: "fixed";
527
+ enabled: boolean;
528
+ reason: string;
529
+ } | {
530
+ kind: "unverified";
531
+ reason: string;
532
+ };
533
+ sourceLabel?: string | undefined;
534
+ registryName?: string | undefined;
535
+ declaration?: z.core.util.JSONType | undefined;
536
+ schema?: {
537
+ deferLoading?: true;
538
+ name: string;
539
+ description: string;
540
+ parameters: Record<string, z.core.util.JSONType>;
541
+ } | undefined;
542
+ }>>>;
543
+ }, z.core.$strip>>;
544
+ }, z.core.$strip>>;
545
+ }, z.core.$strip>;
546
+ /** 会话记录:首条消息前只有工具信息,收到原生编号后保存完整绑定。 */
547
+ export type BindingRecord = z.infer<typeof bindingSchema>;
548
+ /** 文件为会话状态来源;内存只缓存已成功保存的记录,坏文件明确报错。 */
549
+ export declare class CodexSessionStore {
550
+ private readonly dataDir;
551
+ private cache;
552
+ private loading;
553
+ private writes;
554
+ constructor(dataDir: string);
555
+ private get file();
556
+ private load;
557
+ private read;
558
+ /**
559
+ * 读取独立副本;确实不存在的会话返回 undefined,损坏状态抛错。
560
+ * @param sessionKey - KMH 会话标识。
561
+ * @returns 保存记录的独立副本或 undefined。
562
+ */
563
+ get(sessionKey: string): Promise<BindingRecord | undefined>;
564
+ /**
565
+ * 顺序保存记录;文件写入成功后才接受新状态。
566
+ * @param sessionKey - KMH 会话标识。
567
+ * @param record - 已校验的完整记录。
568
+ */
569
+ put(sessionKey: string, record: BindingRecord): Promise<void>;
570
+ /**
571
+ * 删除记录并保存;写入失败保留已接受状态。
572
+ * @param sessionKey - KMH 会话标识。
573
+ */
574
+ delete(sessionKey: string): Promise<void>;
575
+ private enqueue;
576
+ private flush;
577
+ }
578
+ /**
579
+ * 从保存记录恢复消息处理位置。
580
+ * @param record - 已校验的保存记录。
581
+ * @returns 与原记录独立的消息处理位置。
582
+ */
583
+ export declare function recordToCursor(record: BindingRecord): CursorSnapshot;
584
+ /**
585
+ * 将原生编号和消息处理位置写回记录;调用方合并创建时工具信息。
586
+ * @param threadId - 官方 Codex 会话编号。
587
+ * @param cursor - 已接受的消息处理位置。
588
+ * @param lastTurnId - 最近完成的官方回合编号。
589
+ * @returns 可合并到原记录的原生编号和消息处理位置。
590
+ */
591
+ export declare function cursorToRecord(threadId: string, cursor: CursorSnapshot, lastTurnId?: string): BindingRecord;
592
+ export {};