portercode 0.1.0

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 (112) hide show
  1. package/LICENSE +123 -0
  2. package/NOTICE +45 -0
  3. package/README.md +178 -0
  4. package/dist/auth/index.d.ts +103 -0
  5. package/dist/bus/bus-event.d.ts +10 -0
  6. package/dist/bus/global.d.ts +7 -0
  7. package/dist/bus/index.d.ts +26 -0
  8. package/dist/cli/auth.d.ts +11 -0
  9. package/dist/cli/index.d.ts +1 -0
  10. package/dist/cli/ui.d.ts +26 -0
  11. package/dist/command/index.d.ts +54 -0
  12. package/dist/config/config.d.ts +6756 -0
  13. package/dist/config/index.d.ts +2 -0
  14. package/dist/config/markdown.d.ts +415 -0
  15. package/dist/constants/index.d.ts +9 -0
  16. package/dist/diff/engine.d.ts +15 -0
  17. package/dist/diff/index.d.ts +8 -0
  18. package/dist/diff/types.d.ts +66 -0
  19. package/dist/file/ignore.d.ts +7 -0
  20. package/dist/flag/index.d.ts +19 -0
  21. package/dist/gateway/bridge.d.ts +11 -0
  22. package/dist/gateway/handlers/llm.d.ts +7 -0
  23. package/dist/gateway/handlers/permission.d.ts +15 -0
  24. package/dist/gateway/handlers/session.d.ts +7 -0
  25. package/dist/gateway/handlers/system.d.ts +7 -0
  26. package/dist/gateway/handlers/tool.d.ts +7 -0
  27. package/dist/gateway/index.d.ts +17 -0
  28. package/dist/gateway/protocol.d.ts +159 -0
  29. package/dist/gateway/router.d.ts +7 -0
  30. package/dist/gateway/server.d.ts +24 -0
  31. package/dist/global/index.d.ts +11 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +2 -0
  34. package/dist/permission/index.d.ts +2 -0
  35. package/dist/permission/permission.d.ts +172 -0
  36. package/dist/permission/types.d.ts +109 -0
  37. package/dist/project/index.d.ts +3 -0
  38. package/dist/project/instance.d.ts +33 -0
  39. package/dist/project/project.d.ts +82 -0
  40. package/dist/project/state.d.ts +4 -0
  41. package/dist/prompt/index.d.ts +5 -0
  42. package/dist/prompt/system.d.ts +24 -0
  43. package/dist/provider/index.d.ts +3 -0
  44. package/dist/provider/models.d.ts +17 -0
  45. package/dist/provider/provider.d.ts +844 -0
  46. package/dist/provider/types.d.ts +328 -0
  47. package/dist/session/context-optimization.d.ts +160 -0
  48. package/dist/session/index.d.ts +4 -0
  49. package/dist/session/llm.d.ts +29 -0
  50. package/dist/session/session.d.ts +400 -0
  51. package/dist/session/types.d.ts +544 -0
  52. package/dist/snapshot/index.d.ts +40 -0
  53. package/dist/storage/index.d.ts +1 -0
  54. package/dist/storage/storage.d.ts +34 -0
  55. package/dist/tool/bash.d.ts +19 -0
  56. package/dist/tool/edit.d.ts +21 -0
  57. package/dist/tool/glob.d.ts +15 -0
  58. package/dist/tool/grep.d.ts +20 -0
  59. package/dist/tool/image.d.ts +23 -0
  60. package/dist/tool/index.d.ts +11 -0
  61. package/dist/tool/ls.d.ts +14 -0
  62. package/dist/tool/read.d.ts +17 -0
  63. package/dist/tool/registry.d.ts +30 -0
  64. package/dist/tool/todo.d.ts +76 -0
  65. package/dist/tool/tool.d.ts +65 -0
  66. package/dist/tool/write.d.ts +16 -0
  67. package/dist/tui/App.d.ts +10 -0
  68. package/dist/tui/components/Header.d.ts +12 -0
  69. package/dist/tui/components/Message/AssistantMessage.d.ts +10 -0
  70. package/dist/tui/components/Message/ReasoningMessage.d.ts +20 -0
  71. package/dist/tui/components/Message/ToolCallMessage.d.ts +25 -0
  72. package/dist/tui/components/Message/UserMessage.d.ts +11 -0
  73. package/dist/tui/components/Message/index.d.ts +13 -0
  74. package/dist/tui/components/PermissionPrompt.d.ts +6 -0
  75. package/dist/tui/components/PromptInput.d.ts +32 -0
  76. package/dist/tui/components/REPL.d.ts +17 -0
  77. package/dist/tui/components/Spinner.d.ts +13 -0
  78. package/dist/tui/components/StatusBar.d.ts +12 -0
  79. package/dist/tui/components/TodoList.d.ts +17 -0
  80. package/dist/tui/components/WelcomeBox.d.ts +13 -0
  81. package/dist/tui/components/dialogs/DiagnosticsPanel.d.ts +12 -0
  82. package/dist/tui/components/dialogs/HelpPanel.d.ts +11 -0
  83. package/dist/tui/components/dialogs/ModelSelector.d.ts +14 -0
  84. package/dist/tui/components/dialogs/PermissionPrompt.d.ts +17 -0
  85. package/dist/tui/components/dialogs/SessionPicker.d.ts +15 -0
  86. package/dist/tui/components/dialogs/index.d.ts +10 -0
  87. package/dist/tui/components/diff/DiffHunk.d.ts +12 -0
  88. package/dist/tui/components/diff/DiffLine.d.ts +14 -0
  89. package/dist/tui/components/diff/DiffStats.d.ts +12 -0
  90. package/dist/tui/components/diff/DiffView.d.ts +15 -0
  91. package/dist/tui/components/diff/index.d.ts +9 -0
  92. package/dist/tui/hooks/usePermission.d.ts +26 -0
  93. package/dist/tui/index.d.ts +15 -0
  94. package/dist/tui/theme.d.ts +27 -0
  95. package/dist/tui/utils/Cursor.d.ts +37 -0
  96. package/dist/tui/utils/clipboard.d.ts +3 -0
  97. package/dist/tui/utils/keypress.d.ts +39 -0
  98. package/dist/tui/utils/markdown.d.ts +13 -0
  99. package/dist/tui/utils/openContent.d.ts +22 -0
  100. package/dist/util/context.d.ts +10 -0
  101. package/dist/util/debug.d.ts +51 -0
  102. package/dist/util/error.d.ts +294 -0
  103. package/dist/util/example-commands.d.ts +18 -0
  104. package/dist/util/filesystem.d.ts +17 -0
  105. package/dist/util/id.d.ts +24 -0
  106. package/dist/util/iife.d.ts +1 -0
  107. package/dist/util/index.d.ts +7 -0
  108. package/dist/util/lazy.d.ts +1 -0
  109. package/dist/util/log.d.ts +26 -0
  110. package/dist/util/timeout.d.ts +1 -0
  111. package/dist/util/wildcard.d.ts +8 -0
  112. package/package.json +72 -0
@@ -0,0 +1,544 @@
1
+ import z from "zod";
2
+ /**
3
+ * Session and Message Type Definitions
4
+ */
5
+ export declare const SessionId: z.ZodBranded<z.ZodString, "SessionId">;
6
+ export type SessionId = z.infer<typeof SessionId>;
7
+ export declare const MessageId: z.ZodBranded<z.ZodString, "MessageId">;
8
+ export type MessageId = z.infer<typeof MessageId>;
9
+ export declare const PartId: z.ZodBranded<z.ZodString, "PartId">;
10
+ export type PartId = z.infer<typeof PartId>;
11
+ /**
12
+ * Session information
13
+ */
14
+ export declare const SessionInfo: z.ZodObject<{
15
+ id: z.ZodString;
16
+ projectId: z.ZodString;
17
+ directory: z.ZodString;
18
+ parentId: z.ZodOptional<z.ZodString>;
19
+ title: z.ZodString;
20
+ createdAt: z.ZodNumber;
21
+ updatedAt: z.ZodNumber;
22
+ }, "strip", z.ZodTypeAny, {
23
+ id: string;
24
+ directory: string;
25
+ title: string;
26
+ projectId: string;
27
+ createdAt: number;
28
+ updatedAt: number;
29
+ parentId?: string | undefined;
30
+ }, {
31
+ id: string;
32
+ directory: string;
33
+ title: string;
34
+ projectId: string;
35
+ createdAt: number;
36
+ updatedAt: number;
37
+ parentId?: string | undefined;
38
+ }>;
39
+ export type SessionInfo = z.infer<typeof SessionInfo>;
40
+ /**
41
+ * Message roles
42
+ */
43
+ export declare const MessageRole: z.ZodEnum<["user", "assistant", "system"]>;
44
+ export type MessageRole = z.infer<typeof MessageRole>;
45
+ /**
46
+ * Text content part
47
+ */
48
+ export declare const TextPart: z.ZodObject<{
49
+ type: z.ZodLiteral<"text">;
50
+ id: z.ZodString;
51
+ messageId: z.ZodString;
52
+ sessionId: z.ZodString;
53
+ content: z.ZodString;
54
+ }, "strip", z.ZodTypeAny, {
55
+ type: "text";
56
+ id: string;
57
+ sessionId: string;
58
+ content: string;
59
+ messageId: string;
60
+ }, {
61
+ type: "text";
62
+ id: string;
63
+ sessionId: string;
64
+ content: string;
65
+ messageId: string;
66
+ }>;
67
+ export type TextPart = z.infer<typeof TextPart>;
68
+ /**
69
+ * Reasoning content part (for models with thinking)
70
+ */
71
+ export declare const ReasoningPart: z.ZodObject<{
72
+ type: z.ZodLiteral<"reasoning">;
73
+ id: z.ZodString;
74
+ messageId: z.ZodString;
75
+ sessionId: z.ZodString;
76
+ content: z.ZodString;
77
+ }, "strip", z.ZodTypeAny, {
78
+ type: "reasoning";
79
+ id: string;
80
+ sessionId: string;
81
+ content: string;
82
+ messageId: string;
83
+ }, {
84
+ type: "reasoning";
85
+ id: string;
86
+ sessionId: string;
87
+ content: string;
88
+ messageId: string;
89
+ }>;
90
+ export type ReasoningPart = z.infer<typeof ReasoningPart>;
91
+ /**
92
+ * Tool call part
93
+ */
94
+ export declare const ToolCallPart: z.ZodObject<{
95
+ type: z.ZodLiteral<"tool-call">;
96
+ id: z.ZodString;
97
+ messageId: z.ZodString;
98
+ sessionId: z.ZodString;
99
+ toolId: z.ZodString;
100
+ toolName: z.ZodString;
101
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
102
+ state: z.ZodEnum<["pending", "running", "completed", "failed"]>;
103
+ }, "strip", z.ZodTypeAny, {
104
+ type: "tool-call";
105
+ id: string;
106
+ state: "completed" | "pending" | "running" | "failed";
107
+ input: Record<string, any>;
108
+ sessionId: string;
109
+ toolId: string;
110
+ messageId: string;
111
+ toolName: string;
112
+ }, {
113
+ type: "tool-call";
114
+ id: string;
115
+ state: "completed" | "pending" | "running" | "failed";
116
+ input: Record<string, any>;
117
+ sessionId: string;
118
+ toolId: string;
119
+ messageId: string;
120
+ toolName: string;
121
+ }>;
122
+ export type ToolCallPart = z.infer<typeof ToolCallPart>;
123
+ /**
124
+ * Tool result part
125
+ */
126
+ export declare const ToolResultPart: z.ZodObject<{
127
+ type: z.ZodLiteral<"tool-result">;
128
+ id: z.ZodString;
129
+ messageId: z.ZodString;
130
+ sessionId: z.ZodString;
131
+ toolCallId: z.ZodString;
132
+ toolName: z.ZodOptional<z.ZodString>;
133
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
134
+ output: z.ZodString;
135
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
136
+ }, "strip", z.ZodTypeAny, {
137
+ type: "tool-result";
138
+ id: string;
139
+ output: string;
140
+ sessionId: string;
141
+ messageId: string;
142
+ toolCallId: string;
143
+ input?: Record<string, any> | undefined;
144
+ toolName?: string | undefined;
145
+ metadata?: Record<string, any> | undefined;
146
+ }, {
147
+ type: "tool-result";
148
+ id: string;
149
+ output: string;
150
+ sessionId: string;
151
+ messageId: string;
152
+ toolCallId: string;
153
+ input?: Record<string, any> | undefined;
154
+ toolName?: string | undefined;
155
+ metadata?: Record<string, any> | undefined;
156
+ }>;
157
+ export type ToolResultPart = z.infer<typeof ToolResultPart>;
158
+ /**
159
+ * All message part types
160
+ */
161
+ export declare const MessagePart: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
162
+ type: z.ZodLiteral<"text">;
163
+ id: z.ZodString;
164
+ messageId: z.ZodString;
165
+ sessionId: z.ZodString;
166
+ content: z.ZodString;
167
+ }, "strip", z.ZodTypeAny, {
168
+ type: "text";
169
+ id: string;
170
+ sessionId: string;
171
+ content: string;
172
+ messageId: string;
173
+ }, {
174
+ type: "text";
175
+ id: string;
176
+ sessionId: string;
177
+ content: string;
178
+ messageId: string;
179
+ }>, z.ZodObject<{
180
+ type: z.ZodLiteral<"reasoning">;
181
+ id: z.ZodString;
182
+ messageId: z.ZodString;
183
+ sessionId: z.ZodString;
184
+ content: z.ZodString;
185
+ }, "strip", z.ZodTypeAny, {
186
+ type: "reasoning";
187
+ id: string;
188
+ sessionId: string;
189
+ content: string;
190
+ messageId: string;
191
+ }, {
192
+ type: "reasoning";
193
+ id: string;
194
+ sessionId: string;
195
+ content: string;
196
+ messageId: string;
197
+ }>, z.ZodObject<{
198
+ type: z.ZodLiteral<"tool-call">;
199
+ id: z.ZodString;
200
+ messageId: z.ZodString;
201
+ sessionId: z.ZodString;
202
+ toolId: z.ZodString;
203
+ toolName: z.ZodString;
204
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
205
+ state: z.ZodEnum<["pending", "running", "completed", "failed"]>;
206
+ }, "strip", z.ZodTypeAny, {
207
+ type: "tool-call";
208
+ id: string;
209
+ state: "completed" | "pending" | "running" | "failed";
210
+ input: Record<string, any>;
211
+ sessionId: string;
212
+ toolId: string;
213
+ messageId: string;
214
+ toolName: string;
215
+ }, {
216
+ type: "tool-call";
217
+ id: string;
218
+ state: "completed" | "pending" | "running" | "failed";
219
+ input: Record<string, any>;
220
+ sessionId: string;
221
+ toolId: string;
222
+ messageId: string;
223
+ toolName: string;
224
+ }>, z.ZodObject<{
225
+ type: z.ZodLiteral<"tool-result">;
226
+ id: z.ZodString;
227
+ messageId: z.ZodString;
228
+ sessionId: z.ZodString;
229
+ toolCallId: z.ZodString;
230
+ toolName: z.ZodOptional<z.ZodString>;
231
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
232
+ output: z.ZodString;
233
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
234
+ }, "strip", z.ZodTypeAny, {
235
+ type: "tool-result";
236
+ id: string;
237
+ output: string;
238
+ sessionId: string;
239
+ messageId: string;
240
+ toolCallId: string;
241
+ input?: Record<string, any> | undefined;
242
+ toolName?: string | undefined;
243
+ metadata?: Record<string, any> | undefined;
244
+ }, {
245
+ type: "tool-result";
246
+ id: string;
247
+ output: string;
248
+ sessionId: string;
249
+ messageId: string;
250
+ toolCallId: string;
251
+ input?: Record<string, any> | undefined;
252
+ toolName?: string | undefined;
253
+ metadata?: Record<string, any> | undefined;
254
+ }>]>;
255
+ export type MessagePart = z.infer<typeof MessagePart>;
256
+ /**
257
+ * Message information
258
+ */
259
+ export declare const MessageInfo: z.ZodObject<{
260
+ id: z.ZodString;
261
+ sessionId: z.ZodString;
262
+ role: z.ZodEnum<["user", "assistant", "system"]>;
263
+ createdAt: z.ZodNumber;
264
+ model: z.ZodOptional<z.ZodString>;
265
+ provider: z.ZodOptional<z.ZodString>;
266
+ }, "strip", z.ZodTypeAny, {
267
+ id: string;
268
+ sessionId: string;
269
+ createdAt: number;
270
+ role: "system" | "user" | "assistant";
271
+ provider?: string | undefined;
272
+ model?: string | undefined;
273
+ }, {
274
+ id: string;
275
+ sessionId: string;
276
+ createdAt: number;
277
+ role: "system" | "user" | "assistant";
278
+ provider?: string | undefined;
279
+ model?: string | undefined;
280
+ }>;
281
+ export type MessageInfo = z.infer<typeof MessageInfo>;
282
+ /**
283
+ * Message with all its parts
284
+ */
285
+ export declare const MessageWithParts: z.ZodObject<{
286
+ info: z.ZodObject<{
287
+ id: z.ZodString;
288
+ sessionId: z.ZodString;
289
+ role: z.ZodEnum<["user", "assistant", "system"]>;
290
+ createdAt: z.ZodNumber;
291
+ model: z.ZodOptional<z.ZodString>;
292
+ provider: z.ZodOptional<z.ZodString>;
293
+ }, "strip", z.ZodTypeAny, {
294
+ id: string;
295
+ sessionId: string;
296
+ createdAt: number;
297
+ role: "system" | "user" | "assistant";
298
+ provider?: string | undefined;
299
+ model?: string | undefined;
300
+ }, {
301
+ id: string;
302
+ sessionId: string;
303
+ createdAt: number;
304
+ role: "system" | "user" | "assistant";
305
+ provider?: string | undefined;
306
+ model?: string | undefined;
307
+ }>;
308
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
309
+ type: z.ZodLiteral<"text">;
310
+ id: z.ZodString;
311
+ messageId: z.ZodString;
312
+ sessionId: z.ZodString;
313
+ content: z.ZodString;
314
+ }, "strip", z.ZodTypeAny, {
315
+ type: "text";
316
+ id: string;
317
+ sessionId: string;
318
+ content: string;
319
+ messageId: string;
320
+ }, {
321
+ type: "text";
322
+ id: string;
323
+ sessionId: string;
324
+ content: string;
325
+ messageId: string;
326
+ }>, z.ZodObject<{
327
+ type: z.ZodLiteral<"reasoning">;
328
+ id: z.ZodString;
329
+ messageId: z.ZodString;
330
+ sessionId: z.ZodString;
331
+ content: z.ZodString;
332
+ }, "strip", z.ZodTypeAny, {
333
+ type: "reasoning";
334
+ id: string;
335
+ sessionId: string;
336
+ content: string;
337
+ messageId: string;
338
+ }, {
339
+ type: "reasoning";
340
+ id: string;
341
+ sessionId: string;
342
+ content: string;
343
+ messageId: string;
344
+ }>, z.ZodObject<{
345
+ type: z.ZodLiteral<"tool-call">;
346
+ id: z.ZodString;
347
+ messageId: z.ZodString;
348
+ sessionId: z.ZodString;
349
+ toolId: z.ZodString;
350
+ toolName: z.ZodString;
351
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
352
+ state: z.ZodEnum<["pending", "running", "completed", "failed"]>;
353
+ }, "strip", z.ZodTypeAny, {
354
+ type: "tool-call";
355
+ id: string;
356
+ state: "completed" | "pending" | "running" | "failed";
357
+ input: Record<string, any>;
358
+ sessionId: string;
359
+ toolId: string;
360
+ messageId: string;
361
+ toolName: string;
362
+ }, {
363
+ type: "tool-call";
364
+ id: string;
365
+ state: "completed" | "pending" | "running" | "failed";
366
+ input: Record<string, any>;
367
+ sessionId: string;
368
+ toolId: string;
369
+ messageId: string;
370
+ toolName: string;
371
+ }>, z.ZodObject<{
372
+ type: z.ZodLiteral<"tool-result">;
373
+ id: z.ZodString;
374
+ messageId: z.ZodString;
375
+ sessionId: z.ZodString;
376
+ toolCallId: z.ZodString;
377
+ toolName: z.ZodOptional<z.ZodString>;
378
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
379
+ output: z.ZodString;
380
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
381
+ }, "strip", z.ZodTypeAny, {
382
+ type: "tool-result";
383
+ id: string;
384
+ output: string;
385
+ sessionId: string;
386
+ messageId: string;
387
+ toolCallId: string;
388
+ input?: Record<string, any> | undefined;
389
+ toolName?: string | undefined;
390
+ metadata?: Record<string, any> | undefined;
391
+ }, {
392
+ type: "tool-result";
393
+ id: string;
394
+ output: string;
395
+ sessionId: string;
396
+ messageId: string;
397
+ toolCallId: string;
398
+ input?: Record<string, any> | undefined;
399
+ toolName?: string | undefined;
400
+ metadata?: Record<string, any> | undefined;
401
+ }>]>, "many">;
402
+ }, "strip", z.ZodTypeAny, {
403
+ info: {
404
+ id: string;
405
+ sessionId: string;
406
+ createdAt: number;
407
+ role: "system" | "user" | "assistant";
408
+ provider?: string | undefined;
409
+ model?: string | undefined;
410
+ };
411
+ parts: ({
412
+ type: "text";
413
+ id: string;
414
+ sessionId: string;
415
+ content: string;
416
+ messageId: string;
417
+ } | {
418
+ type: "reasoning";
419
+ id: string;
420
+ sessionId: string;
421
+ content: string;
422
+ messageId: string;
423
+ } | {
424
+ type: "tool-call";
425
+ id: string;
426
+ state: "completed" | "pending" | "running" | "failed";
427
+ input: Record<string, any>;
428
+ sessionId: string;
429
+ toolId: string;
430
+ messageId: string;
431
+ toolName: string;
432
+ } | {
433
+ type: "tool-result";
434
+ id: string;
435
+ output: string;
436
+ sessionId: string;
437
+ messageId: string;
438
+ toolCallId: string;
439
+ input?: Record<string, any> | undefined;
440
+ toolName?: string | undefined;
441
+ metadata?: Record<string, any> | undefined;
442
+ })[];
443
+ }, {
444
+ info: {
445
+ id: string;
446
+ sessionId: string;
447
+ createdAt: number;
448
+ role: "system" | "user" | "assistant";
449
+ provider?: string | undefined;
450
+ model?: string | undefined;
451
+ };
452
+ parts: ({
453
+ type: "text";
454
+ id: string;
455
+ sessionId: string;
456
+ content: string;
457
+ messageId: string;
458
+ } | {
459
+ type: "reasoning";
460
+ id: string;
461
+ sessionId: string;
462
+ content: string;
463
+ messageId: string;
464
+ } | {
465
+ type: "tool-call";
466
+ id: string;
467
+ state: "completed" | "pending" | "running" | "failed";
468
+ input: Record<string, any>;
469
+ sessionId: string;
470
+ toolId: string;
471
+ messageId: string;
472
+ toolName: string;
473
+ } | {
474
+ type: "tool-result";
475
+ id: string;
476
+ output: string;
477
+ sessionId: string;
478
+ messageId: string;
479
+ toolCallId: string;
480
+ input?: Record<string, any> | undefined;
481
+ toolName?: string | undefined;
482
+ metadata?: Record<string, any> | undefined;
483
+ })[];
484
+ }>;
485
+ export type MessageWithParts = z.infer<typeof MessageWithParts>;
486
+ /**
487
+ * Token usage statistics
488
+ */
489
+ export declare const TokenUsage: z.ZodObject<{
490
+ input: z.ZodNumber;
491
+ output: z.ZodNumber;
492
+ reasoning: z.ZodOptional<z.ZodNumber>;
493
+ cached: z.ZodOptional<z.ZodNumber>;
494
+ }, "strip", z.ZodTypeAny, {
495
+ input: number;
496
+ output: number;
497
+ reasoning?: number | undefined;
498
+ cached?: number | undefined;
499
+ }, {
500
+ input: number;
501
+ output: number;
502
+ reasoning?: number | undefined;
503
+ cached?: number | undefined;
504
+ }>;
505
+ export type TokenUsage = z.infer<typeof TokenUsage>;
506
+ /**
507
+ * Cost calculation result
508
+ */
509
+ export declare const UsageCost: z.ZodObject<{
510
+ tokens: z.ZodObject<{
511
+ input: z.ZodNumber;
512
+ output: z.ZodNumber;
513
+ reasoning: z.ZodOptional<z.ZodNumber>;
514
+ cached: z.ZodOptional<z.ZodNumber>;
515
+ }, "strip", z.ZodTypeAny, {
516
+ input: number;
517
+ output: number;
518
+ reasoning?: number | undefined;
519
+ cached?: number | undefined;
520
+ }, {
521
+ input: number;
522
+ output: number;
523
+ reasoning?: number | undefined;
524
+ cached?: number | undefined;
525
+ }>;
526
+ cost: z.ZodNumber;
527
+ }, "strip", z.ZodTypeAny, {
528
+ cost: number;
529
+ tokens: {
530
+ input: number;
531
+ output: number;
532
+ reasoning?: number | undefined;
533
+ cached?: number | undefined;
534
+ };
535
+ }, {
536
+ cost: number;
537
+ tokens: {
538
+ input: number;
539
+ output: number;
540
+ reasoning?: number | undefined;
541
+ cached?: number | undefined;
542
+ };
543
+ }>;
544
+ export type UsageCost = z.infer<typeof UsageCost>;
@@ -0,0 +1,40 @@
1
+ import { z } from "zod";
2
+ export declare namespace Snapshot {
3
+ function track(): Promise<string | undefined>;
4
+ const Patch: z.ZodObject<{
5
+ hash: z.ZodString;
6
+ files: z.ZodArray<z.ZodString, "many">;
7
+ }, "strip", z.ZodTypeAny, {
8
+ hash: string;
9
+ files: string[];
10
+ }, {
11
+ hash: string;
12
+ files: string[];
13
+ }>;
14
+ type Patch = z.infer<typeof Patch>;
15
+ function patch(hash: string): Promise<Patch>;
16
+ function restore(snapshot: string): Promise<void>;
17
+ function revert(patches: Patch[]): Promise<void>;
18
+ function diff(hash: string): Promise<string>;
19
+ const FileDiff: z.ZodObject<{
20
+ file: z.ZodString;
21
+ before: z.ZodString;
22
+ after: z.ZodString;
23
+ additions: z.ZodNumber;
24
+ deletions: z.ZodNumber;
25
+ }, "strip", z.ZodTypeAny, {
26
+ file: string;
27
+ before: string;
28
+ after: string;
29
+ additions: number;
30
+ deletions: number;
31
+ }, {
32
+ file: string;
33
+ before: string;
34
+ after: string;
35
+ additions: number;
36
+ deletions: number;
37
+ }>;
38
+ type FileDiff = z.infer<typeof FileDiff>;
39
+ function diffFull(from: string, to: string): Promise<FileDiff[]>;
40
+ }
@@ -0,0 +1 @@
1
+ export { Storage } from "./storage";
@@ -0,0 +1,34 @@
1
+ export declare namespace Storage {
2
+ /**
3
+ * Write data to storage
4
+ */
5
+ function write<T>(key: string[], data: T): Promise<void>;
6
+ /**
7
+ * Read data from storage
8
+ */
9
+ function read<T>(key: string[]): Promise<T | undefined>;
10
+ /**
11
+ * Update data in storage using an editor function
12
+ */
13
+ function update<T>(key: string[], editor: (data: T) => void): Promise<T>;
14
+ /**
15
+ * Check if a key exists
16
+ */
17
+ function exists(key: string[]): Promise<boolean>;
18
+ /**
19
+ * Remove data from storage
20
+ */
21
+ function remove(key: string[]): Promise<void>;
22
+ /**
23
+ * List all keys under a prefix
24
+ */
25
+ function list(prefix: string[]): Promise<string[][]>;
26
+ /**
27
+ * List subdirectories under a prefix
28
+ */
29
+ function listDirs(prefix: string[]): Promise<string[]>;
30
+ /**
31
+ * Clear all data under a prefix
32
+ */
33
+ function clear(prefix: string[]): Promise<void>;
34
+ }
@@ -0,0 +1,19 @@
1
+ import z from "zod";
2
+ import { Tool } from "./tool";
3
+ export declare const BashTool: Tool.Info<z.ZodObject<{
4
+ command: z.ZodString;
5
+ timeout: z.ZodOptional<z.ZodNumber>;
6
+ workdir: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ command: string;
9
+ timeout?: number | undefined;
10
+ workdir?: string | undefined;
11
+ }, {
12
+ command: string;
13
+ timeout?: number | undefined;
14
+ workdir?: string | undefined;
15
+ }>, {
16
+ exitCode: number;
17
+ preview: string;
18
+ error: string | undefined;
19
+ }>;
@@ -0,0 +1,21 @@
1
+ import z from "zod";
2
+ import { Tool } from "./tool";
3
+ export declare const EditTool: Tool.Info<z.ZodObject<{
4
+ filePath: z.ZodString;
5
+ oldString: z.ZodString;
6
+ newString: z.ZodString;
7
+ replaceAll: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ replaceAll: boolean;
10
+ filePath: string;
11
+ oldString: string;
12
+ newString: string;
13
+ }, {
14
+ filePath: string;
15
+ oldString: string;
16
+ newString: string;
17
+ replaceAll?: boolean | undefined;
18
+ }>, {
19
+ action: string;
20
+ replacements: number;
21
+ }>;
@@ -0,0 +1,15 @@
1
+ import z from "zod";
2
+ import { Tool } from "./tool";
3
+ export declare const GlobTool: Tool.Info<z.ZodObject<{
4
+ pattern: z.ZodString;
5
+ path: z.ZodOptional<z.ZodString>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ pattern: string;
8
+ path?: string | undefined;
9
+ }, {
10
+ pattern: string;
11
+ path?: string | undefined;
12
+ }>, {
13
+ count: number;
14
+ truncated: boolean;
15
+ }>;
@@ -0,0 +1,20 @@
1
+ import z from "zod";
2
+ import { Tool } from "./tool";
3
+ export declare const GrepTool: Tool.Info<z.ZodObject<{
4
+ pattern: z.ZodString;
5
+ path: z.ZodOptional<z.ZodString>;
6
+ glob: z.ZodOptional<z.ZodString>;
7
+ output_mode: z.ZodOptional<z.ZodEnum<["content", "files_with_matches", "count"]>>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ pattern: string;
10
+ path?: string | undefined;
11
+ glob?: string | undefined;
12
+ output_mode?: "content" | "count" | "files_with_matches" | undefined;
13
+ }, {
14
+ pattern: string;
15
+ path?: string | undefined;
16
+ glob?: string | undefined;
17
+ output_mode?: "content" | "count" | "files_with_matches" | undefined;
18
+ }>, {
19
+ count: number;
20
+ }>;