@fungi.computer/truffle 0.0.0-stage → 0.1.1

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 (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +294 -2
  3. package/computerd-loopback.cjs +16 -0
  4. package/dist/auth-cli.d.ts +36 -0
  5. package/dist/auth-cli.js +351 -0
  6. package/dist/fungi-account-command.d.ts +18 -0
  7. package/dist/fungi-account-command.js +92 -0
  8. package/dist/index.d.ts +19 -0
  9. package/dist/index.js +17 -0
  10. package/dist/internal/private-workerd-sandbox-worker.mjs +27488 -0
  11. package/dist/internal/sandbox-metafile.json +6726 -0
  12. package/dist/linear-auth.d.ts +4 -0
  13. package/dist/linear-auth.js +72 -0
  14. package/dist/local-extensions.d.ts +97 -0
  15. package/dist/local-extensions.js +484 -0
  16. package/dist/local-login.d.ts +55 -0
  17. package/dist/local-login.js +167 -0
  18. package/dist/local-models.d.ts +14 -0
  19. package/dist/local-models.js +77 -0
  20. package/dist/local-skill-source.d.ts +6 -0
  21. package/dist/local-skill-source.js +357 -0
  22. package/dist/log-event.d.ts +2 -0
  23. package/dist/log-event.js +9 -0
  24. package/dist/private-bun-shiitake-host.d.ts +11 -0
  25. package/dist/private-bun-shiitake-host.js +66 -0
  26. package/dist/private-file-credential-store.d.ts +33 -0
  27. package/dist/private-file-credential-store.js +283 -0
  28. package/dist/private-files-patch.d.ts +3 -0
  29. package/dist/private-files-patch.js +86 -0
  30. package/dist/private-fungi-account.d.ts +235 -0
  31. package/dist/private-fungi-account.js +1149 -0
  32. package/dist/private-fungi-auth-error.d.ts +5 -0
  33. package/dist/private-fungi-auth-error.js +7 -0
  34. package/dist/private-fungi-mcp-connection.d.ts +22 -0
  35. package/dist/private-fungi-mcp-connection.js +143 -0
  36. package/dist/private-fungi-mcp-endpoint.d.ts +2 -0
  37. package/dist/private-fungi-mcp-endpoint.js +15 -0
  38. package/dist/private-fungi-mcp-selection.d.ts +14 -0
  39. package/dist/private-fungi-mcp-selection.js +36 -0
  40. package/dist/private-fungi-model-api.d.ts +6 -0
  41. package/dist/private-fungi-model-api.js +125 -0
  42. package/dist/private-fungi-model-catalog.d.ts +6 -0
  43. package/dist/private-fungi-model-catalog.js +78 -0
  44. package/dist/private-fungi-model-provider.d.ts +6 -0
  45. package/dist/private-fungi-model-provider.js +46 -0
  46. package/dist/private-fungi-pending-logouts.d.ts +34 -0
  47. package/dist/private-fungi-pending-logouts.js +136 -0
  48. package/dist/private-invocation-computer.d.ts +37 -0
  49. package/dist/private-invocation-computer.js +459 -0
  50. package/dist/private-invocation-files.d.ts +15 -0
  51. package/dist/private-invocation-files.js +449 -0
  52. package/dist/private-local-acp-stdio.d.ts +17 -0
  53. package/dist/private-local-acp-stdio.js +142 -0
  54. package/dist/private-local-auth-rpc.d.ts +69 -0
  55. package/dist/private-local-auth-rpc.js +273 -0
  56. package/dist/private-local-computer-attach.d.ts +49 -0
  57. package/dist/private-local-computer-attach.js +216 -0
  58. package/dist/private-local-computer-backend.d.ts +282 -0
  59. package/dist/private-local-computer-backend.js +402 -0
  60. package/dist/private-local-computer-processes.d.ts +199 -0
  61. package/dist/private-local-computer-processes.js +589 -0
  62. package/dist/private-local-default-model.d.ts +11 -0
  63. package/dist/private-local-default-model.js +45 -0
  64. package/dist/private-local-delegation.d.ts +29 -0
  65. package/dist/private-local-delegation.js +78 -0
  66. package/dist/private-local-effective-model.d.ts +19 -0
  67. package/dist/private-local-effective-model.js +14 -0
  68. package/dist/private-local-exec-launch.d.ts +41 -0
  69. package/dist/private-local-exec-launch.js +51 -0
  70. package/dist/private-local-exec-path.d.ts +6 -0
  71. package/dist/private-local-exec-path.js +40 -0
  72. package/dist/private-local-git-exclude.d.ts +2 -0
  73. package/dist/private-local-git-exclude.js +33 -0
  74. package/dist/private-local-http-dispatch.d.ts +5 -0
  75. package/dist/private-local-http-dispatch.js +14 -0
  76. package/dist/private-local-mail.d.ts +11 -0
  77. package/dist/private-local-mail.js +69 -0
  78. package/dist/private-local-model-settings.d.ts +5 -0
  79. package/dist/private-local-model-settings.js +31 -0
  80. package/dist/private-local-runtime-host.d.ts +141 -0
  81. package/dist/private-local-runtime-host.js +988 -0
  82. package/dist/private-local-service-contract.d.ts +90 -0
  83. package/dist/private-local-service-contract.js +1 -0
  84. package/dist/private-local-service-discovery.d.ts +101 -0
  85. package/dist/private-local-service-discovery.js +221 -0
  86. package/dist/private-local-service-ids.d.ts +3 -0
  87. package/dist/private-local-service-ids.js +8 -0
  88. package/dist/private-local-service-listener.d.ts +15 -0
  89. package/dist/private-local-service-listener.js +211 -0
  90. package/dist/private-local-service-owner.d.ts +1567 -0
  91. package/dist/private-local-service-owner.js +371 -0
  92. package/dist/private-local-service-process.d.ts +1 -0
  93. package/dist/private-local-service-process.js +6 -0
  94. package/dist/private-local-service.d.ts +17 -0
  95. package/dist/private-local-service.js +330 -0
  96. package/dist/private-local-session-discovery.d.ts +19 -0
  97. package/dist/private-local-session-discovery.js +157 -0
  98. package/dist/private-local-shiitake-host.d.ts +44 -0
  99. package/dist/private-local-shiitake-host.js +143 -0
  100. package/dist/private-local-subagents.d.ts +27 -0
  101. package/dist/private-local-subagents.js +77 -0
  102. package/dist/private-local-worker-server.d.ts +15 -0
  103. package/dist/private-local-worker-server.js +136 -0
  104. package/dist/private-sqlite-owner.d.ts +7 -0
  105. package/dist/private-sqlite-owner.js +103 -0
  106. package/dist/private-team-computers.d.ts +38 -0
  107. package/dist/private-team-computers.js +101 -0
  108. package/dist/private-workerd-sandbox.d.ts +3 -0
  109. package/dist/private-workerd-sandbox.js +347 -0
  110. package/dist/team-apps.d.ts +24 -0
  111. package/dist/team-apps.js +123 -0
  112. package/dist/tracker-git-credential.d.ts +15 -0
  113. package/dist/tracker-git-credential.js +87 -0
  114. package/native/bin/build.json +4037 -0
  115. package/native/bin/fungi-apply-patch +0 -0
  116. package/package.json +148 -3
@@ -0,0 +1,1567 @@
1
+ import type { PrivateLocalServiceSelection, PrivateLocalSessionCreation } from "./private-local-service-contract.js";
2
+ import { openPrivateLocalRuntimeHost, type PrivateLocalRuntimeHost } from "./private-local-runtime-host.js";
3
+ export type LocalServiceRuntime = Pick<PrivateLocalRuntimeHost, "databasePath" | "agentId" | "getSession" | "effectiveModel" | "setModel" | "assertModelReady" | "listSessions" | "createSession" | "deleteSession" | "extensions" | "bindSessionPath" | "acceptMail" | "readSettlement" | "close">;
4
+ export declare class LocalSessionPathConflict extends Error {
5
+ readonly name = "LocalSessionPathConflict";
6
+ constructor();
7
+ }
8
+ export type OpenLocalServiceRuntime = (options: Parameters<typeof openPrivateLocalRuntimeHost>[0]) => Promise<LocalServiceRuntime>;
9
+ /** One service owns each store, independently of how many clients select it. */
10
+ export declare function createLocalServiceOwners(openRuntime?: OpenLocalServiceRuntime, recoveryDirectory?: string): {
11
+ createSession: (creation: PrivateLocalSessionCreation) => Promise<{
12
+ agentId: string;
13
+ databasePath: string;
14
+ sessionId: string;
15
+ session: Readonly<{
16
+ address: string;
17
+ command: import("@fungi.computer/shiitake").SessionCommandHandler;
18
+ abort: () => Promise<void>;
19
+ send: (text: string, options?: import("@fungi.computer/shiitake").SendOptions) => Promise<import("@fungi.computer/shiitake").Accepted>;
20
+ cancel: (input: Readonly<{
21
+ commandId: string;
22
+ onlyIfPending?: boolean;
23
+ }>) => Promise<import("@fungi.computer/shiitake").CancelResult>;
24
+ extension: (extensionId: string) => import("@fungi.computer/shiitake").SessionExtensionControls;
25
+ modelPreference: Readonly<{
26
+ read: () => Promise<import("@fungi.computer/shiitake/model-preference").ModelPreference | null>;
27
+ set: (preference: import("@fungi.computer/shiitake/model-preference").ModelPreference | null) => Promise<void>;
28
+ }>;
29
+ read: (input?: import("@fungi.computer/shiitake").ReadOptions) => Promise<import("@fungi.computer/shiitake").SessionSnapshot>;
30
+ subscribe: (input: import("@fungi.computer/shiitake").SubscribeOptions) => AsyncIterable<import("@fungi.computer/shiitake").SessionFrame>;
31
+ watch: (input?: import("@fungi.computer/shiitake").WatchOptions) => Promise<import("@fungi.computer/shiitake").SessionWatch>;
32
+ }>;
33
+ effectiveModel: (sessionId: string, signal: AbortSignal) => Promise<import("./private-local-effective-model.js").PrivateLocalEffectiveModel>;
34
+ routes: import("hono/hono-base").HonoBase<import("@fungi.computer/shiitake/http").ShiitakeHttpEnv, {
35
+ "/extensions": {
36
+ $get: {
37
+ input: {};
38
+ output: readonly {
39
+ readonly id: string;
40
+ readonly version: string;
41
+ readonly revision: string;
42
+ readonly status: "running" | "stopped";
43
+ readonly reason: string | null;
44
+ readonly stoppedAt: number | null;
45
+ }[];
46
+ outputFormat: "json";
47
+ status: 200;
48
+ };
49
+ };
50
+ } & {
51
+ "/extensions/:extensionId/resume": {
52
+ $post: {
53
+ input: {
54
+ param: {
55
+ extensionId: string;
56
+ };
57
+ };
58
+ output: {
59
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
60
+ readonly _tag: "ShiitakeError";
61
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
62
+ readonly message: string;
63
+ readonly requestId?: string | undefined;
64
+ };
65
+ outputFormat: "json";
66
+ status: 400;
67
+ } | {
68
+ input: {
69
+ param: {
70
+ extensionId: string;
71
+ };
72
+ };
73
+ output: {
74
+ readonly id: string;
75
+ readonly version: string;
76
+ readonly revision: string;
77
+ readonly status: "running" | "stopped";
78
+ readonly reason: string | null;
79
+ readonly stoppedAt: number | null;
80
+ };
81
+ outputFormat: "json";
82
+ status: 200;
83
+ };
84
+ };
85
+ } & {
86
+ "/extensions/:extensionId/commands/:command": {
87
+ $post: {
88
+ input: {
89
+ param: {
90
+ extensionId: string;
91
+ } & {
92
+ command: string;
93
+ };
94
+ };
95
+ output: {};
96
+ outputFormat: string;
97
+ status: import("hono/utils/http-status").StatusCode;
98
+ };
99
+ };
100
+ } & {
101
+ "/sessions/:sessionId/extensions/:extensionId/commands/:command": {
102
+ $post: {
103
+ input: {
104
+ param: {
105
+ extensionId: string;
106
+ } & {
107
+ command: string;
108
+ } & {
109
+ sessionId: string;
110
+ };
111
+ };
112
+ output: {};
113
+ outputFormat: string;
114
+ status: import("hono/utils/http-status").StatusCode;
115
+ };
116
+ };
117
+ } & {
118
+ "/sessions": {
119
+ $post: {
120
+ input: {
121
+ json: {
122
+ readonly requestId: string;
123
+ };
124
+ };
125
+ output: {
126
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
127
+ readonly _tag: "ShiitakeError";
128
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
129
+ readonly message: string;
130
+ readonly requestId?: string | undefined;
131
+ };
132
+ outputFormat: "json";
133
+ status: 400;
134
+ } | {
135
+ input: {
136
+ json: {
137
+ readonly requestId: string;
138
+ };
139
+ };
140
+ output: {
141
+ sessionId: string;
142
+ };
143
+ outputFormat: "json";
144
+ status: 201;
145
+ };
146
+ };
147
+ } & {
148
+ "/sessions/:sessionId": {
149
+ $delete: {
150
+ input: {
151
+ param: {
152
+ sessionId: string;
153
+ };
154
+ };
155
+ output: {
156
+ deleted: boolean;
157
+ };
158
+ outputFormat: "json";
159
+ status: 200;
160
+ };
161
+ };
162
+ } & {
163
+ "/sessions": {
164
+ $get: {
165
+ input: {};
166
+ output: {
167
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
168
+ readonly _tag: "ShiitakeError";
169
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
170
+ readonly message: string;
171
+ readonly requestId?: string | undefined;
172
+ };
173
+ outputFormat: "json";
174
+ status: 400;
175
+ } | {
176
+ input: {};
177
+ output: {
178
+ readonly sessions: readonly ({
179
+ readonly sessionId: string;
180
+ readonly state: "unavailable";
181
+ } | {
182
+ readonly createdAt: number;
183
+ readonly lastActivityAt: number;
184
+ readonly settledAt?: number | undefined;
185
+ readonly title: string;
186
+ readonly state: import("@fungi.computer/shiitake").SessionInboxState;
187
+ readonly sessionId: string;
188
+ })[];
189
+ readonly next: string | undefined;
190
+ };
191
+ outputFormat: "json";
192
+ status: 200;
193
+ };
194
+ };
195
+ } & {
196
+ "/sessions/:sessionId/model-preference": {
197
+ $get: {
198
+ input: {
199
+ param: {
200
+ sessionId: string;
201
+ };
202
+ };
203
+ output: {
204
+ readonly providerId: string;
205
+ readonly modelId: string;
206
+ readonly reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
207
+ } | null;
208
+ outputFormat: "json";
209
+ status: 200;
210
+ };
211
+ };
212
+ } & {
213
+ "/sessions/:sessionId/model-preference": {
214
+ $put: {
215
+ input: {
216
+ json: {
217
+ readonly providerId: string;
218
+ readonly modelId: string;
219
+ readonly reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
220
+ } | null;
221
+ } & {
222
+ param: {
223
+ sessionId: string;
224
+ };
225
+ };
226
+ output: {
227
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
228
+ readonly _tag: "ShiitakeError";
229
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
230
+ readonly message: string;
231
+ readonly requestId?: string | undefined;
232
+ };
233
+ outputFormat: "json";
234
+ status: 400;
235
+ } | {
236
+ input: {
237
+ json: {
238
+ readonly providerId: string;
239
+ readonly modelId: string;
240
+ readonly reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
241
+ } | null;
242
+ } & {
243
+ param: {
244
+ sessionId: string;
245
+ };
246
+ };
247
+ output: null;
248
+ outputFormat: "body";
249
+ status: 204;
250
+ };
251
+ };
252
+ } & {
253
+ "/sessions/:sessionId/command": {
254
+ $post: {
255
+ input: {
256
+ json: {
257
+ readonly command: {
258
+ readonly requestId: string;
259
+ readonly type: "prompt";
260
+ readonly text: string;
261
+ readonly delivery: "followUp" | "steer";
262
+ readonly images?: readonly {
263
+ readonly type: "image";
264
+ readonly data: string;
265
+ readonly mimeType: string;
266
+ }[];
267
+ } | {
268
+ readonly type: "abort";
269
+ } | {
270
+ readonly type: "cancel";
271
+ readonly commandId: string;
272
+ readonly onlyIfPending?: boolean | undefined;
273
+ } | {
274
+ readonly type: "branch";
275
+ readonly entryId: string;
276
+ } | {
277
+ readonly type: "fork";
278
+ readonly entryId: string;
279
+ } | {
280
+ readonly type: "operator";
281
+ readonly requestId: string;
282
+ readonly author: "operator" | "party";
283
+ readonly text: string;
284
+ } | {
285
+ readonly requestId: string;
286
+ readonly type: "compact";
287
+ readonly instructions?: string;
288
+ } | {
289
+ readonly type: "title";
290
+ readonly title: string | null;
291
+ };
292
+ };
293
+ } & {
294
+ param: {
295
+ sessionId: string;
296
+ };
297
+ };
298
+ output: {
299
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
300
+ readonly _tag: "ShiitakeError";
301
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
302
+ readonly message: string;
303
+ readonly requestId?: string | undefined;
304
+ };
305
+ outputFormat: "json";
306
+ status: 400;
307
+ } | {
308
+ input: {
309
+ json: {
310
+ readonly command: {
311
+ readonly requestId: string;
312
+ readonly type: "prompt";
313
+ readonly text: string;
314
+ readonly delivery: "followUp" | "steer";
315
+ readonly images?: readonly {
316
+ readonly type: "image";
317
+ readonly data: string;
318
+ readonly mimeType: string;
319
+ }[];
320
+ } | {
321
+ readonly type: "abort";
322
+ } | {
323
+ readonly type: "cancel";
324
+ readonly commandId: string;
325
+ readonly onlyIfPending?: boolean | undefined;
326
+ } | {
327
+ readonly type: "branch";
328
+ readonly entryId: string;
329
+ } | {
330
+ readonly type: "fork";
331
+ readonly entryId: string;
332
+ } | {
333
+ readonly type: "operator";
334
+ readonly requestId: string;
335
+ readonly author: "operator" | "party";
336
+ readonly text: string;
337
+ } | {
338
+ readonly requestId: string;
339
+ readonly type: "compact";
340
+ readonly instructions?: string;
341
+ } | {
342
+ readonly type: "title";
343
+ readonly title: string | null;
344
+ };
345
+ };
346
+ } & {
347
+ param: {
348
+ sessionId: string;
349
+ };
350
+ };
351
+ output: null;
352
+ outputFormat: "body";
353
+ status: 204;
354
+ } | {
355
+ input: {
356
+ json: {
357
+ readonly command: {
358
+ readonly requestId: string;
359
+ readonly type: "prompt";
360
+ readonly text: string;
361
+ readonly delivery: "followUp" | "steer";
362
+ readonly images?: readonly {
363
+ readonly type: "image";
364
+ readonly data: string;
365
+ readonly mimeType: string;
366
+ }[];
367
+ } | {
368
+ readonly type: "abort";
369
+ } | {
370
+ readonly type: "cancel";
371
+ readonly commandId: string;
372
+ readonly onlyIfPending?: boolean | undefined;
373
+ } | {
374
+ readonly type: "branch";
375
+ readonly entryId: string;
376
+ } | {
377
+ readonly type: "fork";
378
+ readonly entryId: string;
379
+ } | {
380
+ readonly type: "operator";
381
+ readonly requestId: string;
382
+ readonly author: "operator" | "party";
383
+ readonly text: string;
384
+ } | {
385
+ readonly requestId: string;
386
+ readonly type: "compact";
387
+ readonly instructions?: string;
388
+ } | {
389
+ readonly type: "title";
390
+ readonly title: string | null;
391
+ };
392
+ };
393
+ } & {
394
+ param: {
395
+ sessionId: string;
396
+ };
397
+ };
398
+ output: {
399
+ readonly status: "accepted";
400
+ readonly commandId: string;
401
+ } | {
402
+ readonly status: "too_late";
403
+ readonly commandId: string;
404
+ } | {
405
+ readonly sessionId: string;
406
+ };
407
+ outputFormat: "json";
408
+ status: 200;
409
+ };
410
+ };
411
+ } & {
412
+ "/sessions/:sessionId": {
413
+ $get: {
414
+ input: {
415
+ query: {
416
+ readonly includeSandboxFailures?: "true" | undefined;
417
+ readonly limit?: number | undefined;
418
+ readonly before?: string | undefined;
419
+ };
420
+ } & {
421
+ param: {
422
+ sessionId: string;
423
+ };
424
+ };
425
+ output: {
426
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
427
+ readonly _tag: "ShiitakeError";
428
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
429
+ readonly message: string;
430
+ readonly requestId?: string | undefined;
431
+ };
432
+ outputFormat: "json";
433
+ status: 400;
434
+ } | {
435
+ input: {
436
+ query: {
437
+ readonly includeSandboxFailures?: "true" | undefined;
438
+ readonly limit?: number | undefined;
439
+ readonly before?: string | undefined;
440
+ };
441
+ } & {
442
+ param: {
443
+ sessionId: string;
444
+ };
445
+ };
446
+ output: {
447
+ readonly sessionId: string;
448
+ readonly cursor: string | null;
449
+ readonly hasMore: boolean;
450
+ readonly oldestCursor?: string | null | undefined;
451
+ readonly messages: readonly {
452
+ readonly meta?: any;
453
+ readonly origin?: {
454
+ readonly extensionId: string;
455
+ readonly correlation: string | null;
456
+ } | undefined;
457
+ readonly id: string;
458
+ readonly sequence: number;
459
+ readonly commandId: string | null;
460
+ readonly value: {
461
+ role: "system";
462
+ content: string | {
463
+ type: "text";
464
+ text: string;
465
+ textSignature?: string | undefined;
466
+ }[];
467
+ sections?: {
468
+ [x: string]: string | null;
469
+ } | undefined;
470
+ toolsAdded?: {
471
+ name: string;
472
+ description: string;
473
+ parameters: never;
474
+ constrainedSampling?: false | {
475
+ type: "json_schema";
476
+ strict: "prefer" | "require";
477
+ } | {
478
+ type: "grammar";
479
+ variants: {
480
+ openai_lark?: string | undefined;
481
+ openai_regex?: string | undefined;
482
+ };
483
+ } | undefined;
484
+ }[] | undefined;
485
+ toolsRemoved?: {
486
+ name: string;
487
+ }[] | undefined;
488
+ timestamp: number;
489
+ } | {
490
+ role: "user";
491
+ content: string | ({
492
+ type: "text";
493
+ text: string;
494
+ textSignature?: string | undefined;
495
+ } | {
496
+ type: "image";
497
+ data: string;
498
+ mimeType: string;
499
+ })[];
500
+ timestamp: number;
501
+ } | {
502
+ role: "assistant";
503
+ content: ({
504
+ type: "text";
505
+ text: string;
506
+ textSignature?: string | undefined;
507
+ } | {
508
+ type: "toolCall";
509
+ id: string;
510
+ name: string;
511
+ arguments: {
512
+ [x: string]: any;
513
+ };
514
+ thoughtSignature?: string | undefined;
515
+ namespace?: string | undefined;
516
+ } | {
517
+ type: "thinking";
518
+ thinking: string;
519
+ thinkingSignature?: string | undefined;
520
+ redacted?: boolean | undefined;
521
+ })[];
522
+ api: import("@earendil-works/pi-ai").Api;
523
+ provider: import("@earendil-works/pi-ai").ProviderId;
524
+ model: string;
525
+ responseModel?: string | undefined;
526
+ responseId?: string | undefined;
527
+ providerThinkingLevel?: string | undefined;
528
+ thinkingLevel?: import("@earendil-works/pi-ai").ModelThinkingLevel | undefined;
529
+ diagnostics?: {
530
+ type: string;
531
+ timestamp: number;
532
+ error?: {
533
+ name?: string | undefined;
534
+ message: string;
535
+ stack?: string | undefined;
536
+ code?: string | number | undefined;
537
+ } | undefined;
538
+ details?: {
539
+ [x: string]: any;
540
+ } | undefined;
541
+ }[] | undefined;
542
+ usage: {
543
+ input: number;
544
+ output: number;
545
+ cacheRead: number;
546
+ cacheWrite: number;
547
+ cacheWrite1h?: number | undefined;
548
+ reasoning?: number | undefined;
549
+ totalTokens: number;
550
+ cost: {
551
+ input: number;
552
+ output: number;
553
+ cacheRead: number;
554
+ cacheWrite: number;
555
+ total: number;
556
+ };
557
+ };
558
+ stopReason: import("@earendil-works/pi-ai").StopReason;
559
+ deferred?: {
560
+ provider: string;
561
+ modelId: string;
562
+ api: string;
563
+ id: string;
564
+ expiresAt?: number | undefined;
565
+ pollAfterMs?: number | undefined;
566
+ data?: any;
567
+ } | undefined;
568
+ errorMessage?: string | undefined;
569
+ rawStopReason?: string | undefined;
570
+ endTurn?: boolean | undefined;
571
+ timestamp: number;
572
+ } | {
573
+ role: "toolResult";
574
+ toolCallId: string;
575
+ toolName: string;
576
+ content: ({
577
+ type: "text";
578
+ text: string;
579
+ textSignature?: string | undefined;
580
+ } | {
581
+ type: "image";
582
+ data: string;
583
+ mimeType: string;
584
+ })[];
585
+ details?: any;
586
+ usage?: {
587
+ input: number;
588
+ output: number;
589
+ cacheRead: number;
590
+ cacheWrite: number;
591
+ cacheWrite1h?: number | undefined;
592
+ reasoning?: number | undefined;
593
+ totalTokens: number;
594
+ cost: {
595
+ input: number;
596
+ output: number;
597
+ cacheRead: number;
598
+ cacheWrite: number;
599
+ total: number;
600
+ };
601
+ } | undefined;
602
+ nestedCalls?: {
603
+ calls: {
604
+ id: string;
605
+ name: string;
606
+ arguments?: {
607
+ [x: string]: any;
608
+ } | undefined;
609
+ argumentsBytes?: number | undefined;
610
+ status: "ok" | "error" | "unfinished";
611
+ durationMs?: number | undefined;
612
+ error?: string | undefined;
613
+ }[];
614
+ complete: boolean;
615
+ } | undefined;
616
+ isError: boolean;
617
+ timestamp: number;
618
+ };
619
+ }[];
620
+ readonly terminals: readonly {
621
+ readonly commandId: string;
622
+ readonly outcome: "completed" | "cancelled" | "failed" | "interrupted";
623
+ readonly sequence: number;
624
+ readonly diagnostic: string | null;
625
+ readonly meta?: any;
626
+ }[];
627
+ readonly compactions?: readonly {
628
+ readonly id: string;
629
+ readonly sequence: number;
630
+ readonly at: number;
631
+ readonly tokensBefore: number;
632
+ readonly tokensAfter: number | null;
633
+ readonly trigger: import("@fungi.computer/shiitake").SessionCompactionTrigger | null;
634
+ }[] | undefined;
635
+ readonly compactionNotices?: readonly {
636
+ readonly id: string;
637
+ readonly sequence: number;
638
+ readonly at: number;
639
+ readonly trigger: import("@fungi.computer/shiitake").SessionCompactionTrigger;
640
+ readonly result: "nothing_to_compact" | "failed";
641
+ readonly diagnostic: string | null;
642
+ }[] | undefined;
643
+ readonly sandboxFailures?: readonly {
644
+ readonly kind: "sandbox_failure";
645
+ readonly ref: string;
646
+ readonly executionId: string;
647
+ readonly adapter: string;
648
+ readonly buildSha: string | null;
649
+ readonly tag: "Unknown" | "SourceInvalid" | "GuestThrew" | "DeadlineExceeded" | "Cancelled" | "DispatchLost" | "SandboxCrashed" | "BadResponse" | "ResultTooLarge" | "ResultNotJson" | "CapabilityFailed";
650
+ readonly fields: {
651
+ readonly [x: string]: any;
652
+ };
653
+ readonly healthAlert: boolean;
654
+ }[] | undefined;
655
+ readonly pending: {
656
+ readonly total: number;
657
+ readonly prompts: readonly {
658
+ readonly meta?: any;
659
+ readonly origin?: {
660
+ readonly extensionId: string;
661
+ readonly correlation: string | null;
662
+ } | undefined;
663
+ readonly commandId: string;
664
+ readonly text: string;
665
+ readonly images?: readonly {
666
+ readonly type: "image";
667
+ readonly data: string;
668
+ readonly mimeType: string;
669
+ }[] | undefined;
670
+ readonly delivery: import("@fungi.computer/shiitake").PromptDelivery;
671
+ }[];
672
+ readonly hasMore: boolean;
673
+ };
674
+ readonly activity: {
675
+ readonly queue: {
676
+ readonly state: "idle";
677
+ } | {
678
+ readonly state: "queued";
679
+ readonly commandId: string;
680
+ readonly runningWork: {
681
+ readonly kind: "session";
682
+ readonly sessionId: string;
683
+ readonly commandId: string;
684
+ } | {
685
+ readonly kind: "host";
686
+ readonly lane: string;
687
+ readonly jobId: string;
688
+ } | null;
689
+ } | {
690
+ readonly state: "running";
691
+ readonly commandId: string;
692
+ };
693
+ readonly cancellationRequested: boolean;
694
+ readonly retry: {
695
+ readonly attempt: number;
696
+ readonly maxAttempts: number;
697
+ readonly delayMs: number;
698
+ readonly errorMessage: string;
699
+ readonly scheduledAt: number;
700
+ } | null;
701
+ readonly activeTool: string | null;
702
+ readonly lastModelChoiceSequence: number | null;
703
+ readonly compaction: {
704
+ readonly trigger: import("@fungi.computer/shiitake").SessionCompactionTrigger;
705
+ } | null;
706
+ };
707
+ readonly progress: {
708
+ readonly messageId: string;
709
+ readonly revision: number;
710
+ readonly text: string;
711
+ readonly thinking: string;
712
+ readonly textTruncated: boolean;
713
+ readonly thinkingTruncated: boolean;
714
+ } | null;
715
+ readonly extensions: {
716
+ readonly [x: string]: {
717
+ readonly status: "running";
718
+ readonly revision: string;
719
+ readonly value: any;
720
+ readonly catalog?: any;
721
+ } | {
722
+ readonly status: "stopped";
723
+ readonly revision: string;
724
+ readonly reason: string;
725
+ };
726
+ };
727
+ readonly attention: readonly {
728
+ readonly id: string;
729
+ readonly kind: string;
730
+ readonly summary: string;
731
+ readonly since: number;
732
+ readonly extensionId: string;
733
+ readonly expiresAt?: number | undefined;
734
+ }[];
735
+ readonly context?: {
736
+ readonly tokens: number;
737
+ readonly window: number | null;
738
+ } | undefined;
739
+ };
740
+ outputFormat: "json";
741
+ status: 200;
742
+ };
743
+ };
744
+ } & {
745
+ "/sessions/:sessionId/events": {
746
+ $get: {
747
+ input: {
748
+ query: {
749
+ readonly includeSandboxFailures?: "true" | undefined;
750
+ readonly limit?: number | undefined;
751
+ readonly after?: string | undefined;
752
+ readonly mode?: "subscribe" | undefined;
753
+ };
754
+ } & {
755
+ param: {
756
+ sessionId: string;
757
+ };
758
+ };
759
+ output: {};
760
+ outputFormat: string;
761
+ status: import("hono/utils/http-status").StatusCode;
762
+ } | {
763
+ input: {
764
+ query: {
765
+ readonly includeSandboxFailures?: "true" | undefined;
766
+ readonly limit?: number | undefined;
767
+ readonly after?: string | undefined;
768
+ readonly mode?: "subscribe" | undefined;
769
+ };
770
+ } & {
771
+ param: {
772
+ sessionId: string;
773
+ };
774
+ };
775
+ output: {
776
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
777
+ readonly _tag: "ShiitakeError";
778
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
779
+ readonly message: string;
780
+ readonly requestId?: string | undefined;
781
+ };
782
+ outputFormat: "json";
783
+ status: 400;
784
+ };
785
+ };
786
+ }, "/", "/sessions/:sessionId/events">;
787
+ }>;
788
+ select: (selection: PrivateLocalServiceSelection, createRequestId?: string) => Promise<{
789
+ agentId: string;
790
+ databasePath: string;
791
+ sessionId: string;
792
+ session: Readonly<{
793
+ address: string;
794
+ command: import("@fungi.computer/shiitake").SessionCommandHandler;
795
+ abort: () => Promise<void>;
796
+ send: (text: string, options?: import("@fungi.computer/shiitake").SendOptions) => Promise<import("@fungi.computer/shiitake").Accepted>;
797
+ cancel: (input: Readonly<{
798
+ commandId: string;
799
+ onlyIfPending?: boolean;
800
+ }>) => Promise<import("@fungi.computer/shiitake").CancelResult>;
801
+ extension: (extensionId: string) => import("@fungi.computer/shiitake").SessionExtensionControls;
802
+ modelPreference: Readonly<{
803
+ read: () => Promise<import("@fungi.computer/shiitake/model-preference").ModelPreference | null>;
804
+ set: (preference: import("@fungi.computer/shiitake/model-preference").ModelPreference | null) => Promise<void>;
805
+ }>;
806
+ read: (input?: import("@fungi.computer/shiitake").ReadOptions) => Promise<import("@fungi.computer/shiitake").SessionSnapshot>;
807
+ subscribe: (input: import("@fungi.computer/shiitake").SubscribeOptions) => AsyncIterable<import("@fungi.computer/shiitake").SessionFrame>;
808
+ watch: (input?: import("@fungi.computer/shiitake").WatchOptions) => Promise<import("@fungi.computer/shiitake").SessionWatch>;
809
+ }>;
810
+ effectiveModel: (sessionId: string, signal: AbortSignal) => Promise<import("./private-local-effective-model.js").PrivateLocalEffectiveModel>;
811
+ routes: import("hono/hono-base").HonoBase<import("@fungi.computer/shiitake/http").ShiitakeHttpEnv, {
812
+ "/extensions": {
813
+ $get: {
814
+ input: {};
815
+ output: readonly {
816
+ readonly id: string;
817
+ readonly version: string;
818
+ readonly revision: string;
819
+ readonly status: "running" | "stopped";
820
+ readonly reason: string | null;
821
+ readonly stoppedAt: number | null;
822
+ }[];
823
+ outputFormat: "json";
824
+ status: 200;
825
+ };
826
+ };
827
+ } & {
828
+ "/extensions/:extensionId/resume": {
829
+ $post: {
830
+ input: {
831
+ param: {
832
+ extensionId: string;
833
+ };
834
+ };
835
+ output: {
836
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
837
+ readonly _tag: "ShiitakeError";
838
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
839
+ readonly message: string;
840
+ readonly requestId?: string | undefined;
841
+ };
842
+ outputFormat: "json";
843
+ status: 400;
844
+ } | {
845
+ input: {
846
+ param: {
847
+ extensionId: string;
848
+ };
849
+ };
850
+ output: {
851
+ readonly id: string;
852
+ readonly version: string;
853
+ readonly revision: string;
854
+ readonly status: "running" | "stopped";
855
+ readonly reason: string | null;
856
+ readonly stoppedAt: number | null;
857
+ };
858
+ outputFormat: "json";
859
+ status: 200;
860
+ };
861
+ };
862
+ } & {
863
+ "/extensions/:extensionId/commands/:command": {
864
+ $post: {
865
+ input: {
866
+ param: {
867
+ extensionId: string;
868
+ } & {
869
+ command: string;
870
+ };
871
+ };
872
+ output: {};
873
+ outputFormat: string;
874
+ status: import("hono/utils/http-status").StatusCode;
875
+ };
876
+ };
877
+ } & {
878
+ "/sessions/:sessionId/extensions/:extensionId/commands/:command": {
879
+ $post: {
880
+ input: {
881
+ param: {
882
+ extensionId: string;
883
+ } & {
884
+ command: string;
885
+ } & {
886
+ sessionId: string;
887
+ };
888
+ };
889
+ output: {};
890
+ outputFormat: string;
891
+ status: import("hono/utils/http-status").StatusCode;
892
+ };
893
+ };
894
+ } & {
895
+ "/sessions": {
896
+ $post: {
897
+ input: {
898
+ json: {
899
+ readonly requestId: string;
900
+ };
901
+ };
902
+ output: {
903
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
904
+ readonly _tag: "ShiitakeError";
905
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
906
+ readonly message: string;
907
+ readonly requestId?: string | undefined;
908
+ };
909
+ outputFormat: "json";
910
+ status: 400;
911
+ } | {
912
+ input: {
913
+ json: {
914
+ readonly requestId: string;
915
+ };
916
+ };
917
+ output: {
918
+ sessionId: string;
919
+ };
920
+ outputFormat: "json";
921
+ status: 201;
922
+ };
923
+ };
924
+ } & {
925
+ "/sessions/:sessionId": {
926
+ $delete: {
927
+ input: {
928
+ param: {
929
+ sessionId: string;
930
+ };
931
+ };
932
+ output: {
933
+ deleted: boolean;
934
+ };
935
+ outputFormat: "json";
936
+ status: 200;
937
+ };
938
+ };
939
+ } & {
940
+ "/sessions": {
941
+ $get: {
942
+ input: {};
943
+ output: {
944
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
945
+ readonly _tag: "ShiitakeError";
946
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
947
+ readonly message: string;
948
+ readonly requestId?: string | undefined;
949
+ };
950
+ outputFormat: "json";
951
+ status: 400;
952
+ } | {
953
+ input: {};
954
+ output: {
955
+ readonly sessions: readonly ({
956
+ readonly sessionId: string;
957
+ readonly state: "unavailable";
958
+ } | {
959
+ readonly createdAt: number;
960
+ readonly lastActivityAt: number;
961
+ readonly settledAt?: number | undefined;
962
+ readonly title: string;
963
+ readonly state: import("@fungi.computer/shiitake").SessionInboxState;
964
+ readonly sessionId: string;
965
+ })[];
966
+ readonly next: string | undefined;
967
+ };
968
+ outputFormat: "json";
969
+ status: 200;
970
+ };
971
+ };
972
+ } & {
973
+ "/sessions/:sessionId/model-preference": {
974
+ $get: {
975
+ input: {
976
+ param: {
977
+ sessionId: string;
978
+ };
979
+ };
980
+ output: {
981
+ readonly providerId: string;
982
+ readonly modelId: string;
983
+ readonly reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
984
+ } | null;
985
+ outputFormat: "json";
986
+ status: 200;
987
+ };
988
+ };
989
+ } & {
990
+ "/sessions/:sessionId/model-preference": {
991
+ $put: {
992
+ input: {
993
+ json: {
994
+ readonly providerId: string;
995
+ readonly modelId: string;
996
+ readonly reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
997
+ } | null;
998
+ } & {
999
+ param: {
1000
+ sessionId: string;
1001
+ };
1002
+ };
1003
+ output: {
1004
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
1005
+ readonly _tag: "ShiitakeError";
1006
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
1007
+ readonly message: string;
1008
+ readonly requestId?: string | undefined;
1009
+ };
1010
+ outputFormat: "json";
1011
+ status: 400;
1012
+ } | {
1013
+ input: {
1014
+ json: {
1015
+ readonly providerId: string;
1016
+ readonly modelId: string;
1017
+ readonly reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
1018
+ } | null;
1019
+ } & {
1020
+ param: {
1021
+ sessionId: string;
1022
+ };
1023
+ };
1024
+ output: null;
1025
+ outputFormat: "body";
1026
+ status: 204;
1027
+ };
1028
+ };
1029
+ } & {
1030
+ "/sessions/:sessionId/command": {
1031
+ $post: {
1032
+ input: {
1033
+ json: {
1034
+ readonly command: {
1035
+ readonly requestId: string;
1036
+ readonly type: "prompt";
1037
+ readonly text: string;
1038
+ readonly delivery: "followUp" | "steer";
1039
+ readonly images?: readonly {
1040
+ readonly type: "image";
1041
+ readonly data: string;
1042
+ readonly mimeType: string;
1043
+ }[];
1044
+ } | {
1045
+ readonly type: "abort";
1046
+ } | {
1047
+ readonly type: "cancel";
1048
+ readonly commandId: string;
1049
+ readonly onlyIfPending?: boolean | undefined;
1050
+ } | {
1051
+ readonly type: "branch";
1052
+ readonly entryId: string;
1053
+ } | {
1054
+ readonly type: "fork";
1055
+ readonly entryId: string;
1056
+ } | {
1057
+ readonly type: "operator";
1058
+ readonly requestId: string;
1059
+ readonly author: "operator" | "party";
1060
+ readonly text: string;
1061
+ } | {
1062
+ readonly requestId: string;
1063
+ readonly type: "compact";
1064
+ readonly instructions?: string;
1065
+ } | {
1066
+ readonly type: "title";
1067
+ readonly title: string | null;
1068
+ };
1069
+ };
1070
+ } & {
1071
+ param: {
1072
+ sessionId: string;
1073
+ };
1074
+ };
1075
+ output: {
1076
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
1077
+ readonly _tag: "ShiitakeError";
1078
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
1079
+ readonly message: string;
1080
+ readonly requestId?: string | undefined;
1081
+ };
1082
+ outputFormat: "json";
1083
+ status: 400;
1084
+ } | {
1085
+ input: {
1086
+ json: {
1087
+ readonly command: {
1088
+ readonly requestId: string;
1089
+ readonly type: "prompt";
1090
+ readonly text: string;
1091
+ readonly delivery: "followUp" | "steer";
1092
+ readonly images?: readonly {
1093
+ readonly type: "image";
1094
+ readonly data: string;
1095
+ readonly mimeType: string;
1096
+ }[];
1097
+ } | {
1098
+ readonly type: "abort";
1099
+ } | {
1100
+ readonly type: "cancel";
1101
+ readonly commandId: string;
1102
+ readonly onlyIfPending?: boolean | undefined;
1103
+ } | {
1104
+ readonly type: "branch";
1105
+ readonly entryId: string;
1106
+ } | {
1107
+ readonly type: "fork";
1108
+ readonly entryId: string;
1109
+ } | {
1110
+ readonly type: "operator";
1111
+ readonly requestId: string;
1112
+ readonly author: "operator" | "party";
1113
+ readonly text: string;
1114
+ } | {
1115
+ readonly requestId: string;
1116
+ readonly type: "compact";
1117
+ readonly instructions?: string;
1118
+ } | {
1119
+ readonly type: "title";
1120
+ readonly title: string | null;
1121
+ };
1122
+ };
1123
+ } & {
1124
+ param: {
1125
+ sessionId: string;
1126
+ };
1127
+ };
1128
+ output: null;
1129
+ outputFormat: "body";
1130
+ status: 204;
1131
+ } | {
1132
+ input: {
1133
+ json: {
1134
+ readonly command: {
1135
+ readonly requestId: string;
1136
+ readonly type: "prompt";
1137
+ readonly text: string;
1138
+ readonly delivery: "followUp" | "steer";
1139
+ readonly images?: readonly {
1140
+ readonly type: "image";
1141
+ readonly data: string;
1142
+ readonly mimeType: string;
1143
+ }[];
1144
+ } | {
1145
+ readonly type: "abort";
1146
+ } | {
1147
+ readonly type: "cancel";
1148
+ readonly commandId: string;
1149
+ readonly onlyIfPending?: boolean | undefined;
1150
+ } | {
1151
+ readonly type: "branch";
1152
+ readonly entryId: string;
1153
+ } | {
1154
+ readonly type: "fork";
1155
+ readonly entryId: string;
1156
+ } | {
1157
+ readonly type: "operator";
1158
+ readonly requestId: string;
1159
+ readonly author: "operator" | "party";
1160
+ readonly text: string;
1161
+ } | {
1162
+ readonly requestId: string;
1163
+ readonly type: "compact";
1164
+ readonly instructions?: string;
1165
+ } | {
1166
+ readonly type: "title";
1167
+ readonly title: string | null;
1168
+ };
1169
+ };
1170
+ } & {
1171
+ param: {
1172
+ sessionId: string;
1173
+ };
1174
+ };
1175
+ output: {
1176
+ readonly status: "accepted";
1177
+ readonly commandId: string;
1178
+ } | {
1179
+ readonly status: "too_late";
1180
+ readonly commandId: string;
1181
+ } | {
1182
+ readonly sessionId: string;
1183
+ };
1184
+ outputFormat: "json";
1185
+ status: 200;
1186
+ };
1187
+ };
1188
+ } & {
1189
+ "/sessions/:sessionId": {
1190
+ $get: {
1191
+ input: {
1192
+ query: {
1193
+ readonly includeSandboxFailures?: "true" | undefined;
1194
+ readonly limit?: number | undefined;
1195
+ readonly before?: string | undefined;
1196
+ };
1197
+ } & {
1198
+ param: {
1199
+ sessionId: string;
1200
+ };
1201
+ };
1202
+ output: {
1203
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
1204
+ readonly _tag: "ShiitakeError";
1205
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
1206
+ readonly message: string;
1207
+ readonly requestId?: string | undefined;
1208
+ };
1209
+ outputFormat: "json";
1210
+ status: 400;
1211
+ } | {
1212
+ input: {
1213
+ query: {
1214
+ readonly includeSandboxFailures?: "true" | undefined;
1215
+ readonly limit?: number | undefined;
1216
+ readonly before?: string | undefined;
1217
+ };
1218
+ } & {
1219
+ param: {
1220
+ sessionId: string;
1221
+ };
1222
+ };
1223
+ output: {
1224
+ readonly sessionId: string;
1225
+ readonly cursor: string | null;
1226
+ readonly hasMore: boolean;
1227
+ readonly oldestCursor?: string | null | undefined;
1228
+ readonly messages: readonly {
1229
+ readonly meta?: any;
1230
+ readonly origin?: {
1231
+ readonly extensionId: string;
1232
+ readonly correlation: string | null;
1233
+ } | undefined;
1234
+ readonly id: string;
1235
+ readonly sequence: number;
1236
+ readonly commandId: string | null;
1237
+ readonly value: {
1238
+ role: "system";
1239
+ content: string | {
1240
+ type: "text";
1241
+ text: string;
1242
+ textSignature?: string | undefined;
1243
+ }[];
1244
+ sections?: {
1245
+ [x: string]: string | null;
1246
+ } | undefined;
1247
+ toolsAdded?: {
1248
+ name: string;
1249
+ description: string;
1250
+ parameters: never;
1251
+ constrainedSampling?: false | {
1252
+ type: "json_schema";
1253
+ strict: "prefer" | "require";
1254
+ } | {
1255
+ type: "grammar";
1256
+ variants: {
1257
+ openai_lark?: string | undefined;
1258
+ openai_regex?: string | undefined;
1259
+ };
1260
+ } | undefined;
1261
+ }[] | undefined;
1262
+ toolsRemoved?: {
1263
+ name: string;
1264
+ }[] | undefined;
1265
+ timestamp: number;
1266
+ } | {
1267
+ role: "user";
1268
+ content: string | ({
1269
+ type: "text";
1270
+ text: string;
1271
+ textSignature?: string | undefined;
1272
+ } | {
1273
+ type: "image";
1274
+ data: string;
1275
+ mimeType: string;
1276
+ })[];
1277
+ timestamp: number;
1278
+ } | {
1279
+ role: "assistant";
1280
+ content: ({
1281
+ type: "text";
1282
+ text: string;
1283
+ textSignature?: string | undefined;
1284
+ } | {
1285
+ type: "toolCall";
1286
+ id: string;
1287
+ name: string;
1288
+ arguments: {
1289
+ [x: string]: any;
1290
+ };
1291
+ thoughtSignature?: string | undefined;
1292
+ namespace?: string | undefined;
1293
+ } | {
1294
+ type: "thinking";
1295
+ thinking: string;
1296
+ thinkingSignature?: string | undefined;
1297
+ redacted?: boolean | undefined;
1298
+ })[];
1299
+ api: import("@earendil-works/pi-ai").Api;
1300
+ provider: import("@earendil-works/pi-ai").ProviderId;
1301
+ model: string;
1302
+ responseModel?: string | undefined;
1303
+ responseId?: string | undefined;
1304
+ providerThinkingLevel?: string | undefined;
1305
+ thinkingLevel?: import("@earendil-works/pi-ai").ModelThinkingLevel | undefined;
1306
+ diagnostics?: {
1307
+ type: string;
1308
+ timestamp: number;
1309
+ error?: {
1310
+ name?: string | undefined;
1311
+ message: string;
1312
+ stack?: string | undefined;
1313
+ code?: string | number | undefined;
1314
+ } | undefined;
1315
+ details?: {
1316
+ [x: string]: any;
1317
+ } | undefined;
1318
+ }[] | undefined;
1319
+ usage: {
1320
+ input: number;
1321
+ output: number;
1322
+ cacheRead: number;
1323
+ cacheWrite: number;
1324
+ cacheWrite1h?: number | undefined;
1325
+ reasoning?: number | undefined;
1326
+ totalTokens: number;
1327
+ cost: {
1328
+ input: number;
1329
+ output: number;
1330
+ cacheRead: number;
1331
+ cacheWrite: number;
1332
+ total: number;
1333
+ };
1334
+ };
1335
+ stopReason: import("@earendil-works/pi-ai").StopReason;
1336
+ deferred?: {
1337
+ provider: string;
1338
+ modelId: string;
1339
+ api: string;
1340
+ id: string;
1341
+ expiresAt?: number | undefined;
1342
+ pollAfterMs?: number | undefined;
1343
+ data?: any;
1344
+ } | undefined;
1345
+ errorMessage?: string | undefined;
1346
+ rawStopReason?: string | undefined;
1347
+ endTurn?: boolean | undefined;
1348
+ timestamp: number;
1349
+ } | {
1350
+ role: "toolResult";
1351
+ toolCallId: string;
1352
+ toolName: string;
1353
+ content: ({
1354
+ type: "text";
1355
+ text: string;
1356
+ textSignature?: string | undefined;
1357
+ } | {
1358
+ type: "image";
1359
+ data: string;
1360
+ mimeType: string;
1361
+ })[];
1362
+ details?: any;
1363
+ usage?: {
1364
+ input: number;
1365
+ output: number;
1366
+ cacheRead: number;
1367
+ cacheWrite: number;
1368
+ cacheWrite1h?: number | undefined;
1369
+ reasoning?: number | undefined;
1370
+ totalTokens: number;
1371
+ cost: {
1372
+ input: number;
1373
+ output: number;
1374
+ cacheRead: number;
1375
+ cacheWrite: number;
1376
+ total: number;
1377
+ };
1378
+ } | undefined;
1379
+ nestedCalls?: {
1380
+ calls: {
1381
+ id: string;
1382
+ name: string;
1383
+ arguments?: {
1384
+ [x: string]: any;
1385
+ } | undefined;
1386
+ argumentsBytes?: number | undefined;
1387
+ status: "ok" | "error" | "unfinished";
1388
+ durationMs?: number | undefined;
1389
+ error?: string | undefined;
1390
+ }[];
1391
+ complete: boolean;
1392
+ } | undefined;
1393
+ isError: boolean;
1394
+ timestamp: number;
1395
+ };
1396
+ }[];
1397
+ readonly terminals: readonly {
1398
+ readonly commandId: string;
1399
+ readonly outcome: "completed" | "cancelled" | "failed" | "interrupted";
1400
+ readonly sequence: number;
1401
+ readonly diagnostic: string | null;
1402
+ readonly meta?: any;
1403
+ }[];
1404
+ readonly compactions?: readonly {
1405
+ readonly id: string;
1406
+ readonly sequence: number;
1407
+ readonly at: number;
1408
+ readonly tokensBefore: number;
1409
+ readonly tokensAfter: number | null;
1410
+ readonly trigger: import("@fungi.computer/shiitake").SessionCompactionTrigger | null;
1411
+ }[] | undefined;
1412
+ readonly compactionNotices?: readonly {
1413
+ readonly id: string;
1414
+ readonly sequence: number;
1415
+ readonly at: number;
1416
+ readonly trigger: import("@fungi.computer/shiitake").SessionCompactionTrigger;
1417
+ readonly result: "nothing_to_compact" | "failed";
1418
+ readonly diagnostic: string | null;
1419
+ }[] | undefined;
1420
+ readonly sandboxFailures?: readonly {
1421
+ readonly kind: "sandbox_failure";
1422
+ readonly ref: string;
1423
+ readonly executionId: string;
1424
+ readonly adapter: string;
1425
+ readonly buildSha: string | null;
1426
+ readonly tag: "Unknown" | "SourceInvalid" | "GuestThrew" | "DeadlineExceeded" | "Cancelled" | "DispatchLost" | "SandboxCrashed" | "BadResponse" | "ResultTooLarge" | "ResultNotJson" | "CapabilityFailed";
1427
+ readonly fields: {
1428
+ readonly [x: string]: any;
1429
+ };
1430
+ readonly healthAlert: boolean;
1431
+ }[] | undefined;
1432
+ readonly pending: {
1433
+ readonly total: number;
1434
+ readonly prompts: readonly {
1435
+ readonly meta?: any;
1436
+ readonly origin?: {
1437
+ readonly extensionId: string;
1438
+ readonly correlation: string | null;
1439
+ } | undefined;
1440
+ readonly commandId: string;
1441
+ readonly text: string;
1442
+ readonly images?: readonly {
1443
+ readonly type: "image";
1444
+ readonly data: string;
1445
+ readonly mimeType: string;
1446
+ }[] | undefined;
1447
+ readonly delivery: import("@fungi.computer/shiitake").PromptDelivery;
1448
+ }[];
1449
+ readonly hasMore: boolean;
1450
+ };
1451
+ readonly activity: {
1452
+ readonly queue: {
1453
+ readonly state: "idle";
1454
+ } | {
1455
+ readonly state: "queued";
1456
+ readonly commandId: string;
1457
+ readonly runningWork: {
1458
+ readonly kind: "session";
1459
+ readonly sessionId: string;
1460
+ readonly commandId: string;
1461
+ } | {
1462
+ readonly kind: "host";
1463
+ readonly lane: string;
1464
+ readonly jobId: string;
1465
+ } | null;
1466
+ } | {
1467
+ readonly state: "running";
1468
+ readonly commandId: string;
1469
+ };
1470
+ readonly cancellationRequested: boolean;
1471
+ readonly retry: {
1472
+ readonly attempt: number;
1473
+ readonly maxAttempts: number;
1474
+ readonly delayMs: number;
1475
+ readonly errorMessage: string;
1476
+ readonly scheduledAt: number;
1477
+ } | null;
1478
+ readonly activeTool: string | null;
1479
+ readonly lastModelChoiceSequence: number | null;
1480
+ readonly compaction: {
1481
+ readonly trigger: import("@fungi.computer/shiitake").SessionCompactionTrigger;
1482
+ } | null;
1483
+ };
1484
+ readonly progress: {
1485
+ readonly messageId: string;
1486
+ readonly revision: number;
1487
+ readonly text: string;
1488
+ readonly thinking: string;
1489
+ readonly textTruncated: boolean;
1490
+ readonly thinkingTruncated: boolean;
1491
+ } | null;
1492
+ readonly extensions: {
1493
+ readonly [x: string]: {
1494
+ readonly status: "running";
1495
+ readonly revision: string;
1496
+ readonly value: any;
1497
+ readonly catalog?: any;
1498
+ } | {
1499
+ readonly status: "stopped";
1500
+ readonly revision: string;
1501
+ readonly reason: string;
1502
+ };
1503
+ };
1504
+ readonly attention: readonly {
1505
+ readonly id: string;
1506
+ readonly kind: string;
1507
+ readonly summary: string;
1508
+ readonly since: number;
1509
+ readonly extensionId: string;
1510
+ readonly expiresAt?: number | undefined;
1511
+ }[];
1512
+ readonly context?: {
1513
+ readonly tokens: number;
1514
+ readonly window: number | null;
1515
+ } | undefined;
1516
+ };
1517
+ outputFormat: "json";
1518
+ status: 200;
1519
+ };
1520
+ };
1521
+ } & {
1522
+ "/sessions/:sessionId/events": {
1523
+ $get: {
1524
+ input: {
1525
+ query: {
1526
+ readonly includeSandboxFailures?: "true" | undefined;
1527
+ readonly limit?: number | undefined;
1528
+ readonly after?: string | undefined;
1529
+ readonly mode?: "subscribe" | undefined;
1530
+ };
1531
+ } & {
1532
+ param: {
1533
+ sessionId: string;
1534
+ };
1535
+ };
1536
+ output: {};
1537
+ outputFormat: string;
1538
+ status: import("hono/utils/http-status").StatusCode;
1539
+ } | {
1540
+ input: {
1541
+ query: {
1542
+ readonly includeSandboxFailures?: "true" | undefined;
1543
+ readonly limit?: number | undefined;
1544
+ readonly after?: string | undefined;
1545
+ readonly mode?: "subscribe" | undefined;
1546
+ };
1547
+ } & {
1548
+ param: {
1549
+ sessionId: string;
1550
+ };
1551
+ };
1552
+ output: {
1553
+ readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable" | "storage_pressure" | "context_too_large";
1554
+ readonly _tag: "ShiitakeError";
1555
+ readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools";
1556
+ readonly message: string;
1557
+ readonly requestId?: string | undefined;
1558
+ };
1559
+ outputFormat: "json";
1560
+ status: 400;
1561
+ };
1562
+ };
1563
+ }, "/", "/sessions/:sessionId/events">;
1564
+ }>;
1565
+ restore: () => Promise<void>;
1566
+ close: () => Promise<void>;
1567
+ };