@codeworksh/schema 0.0.0-stage → 0.1.0-canary.165.2.g336229f9

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 (96) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +47 -2
  3. package/common.d.mts +86 -0
  4. package/common.mjs +88 -0
  5. package/common.mjs.map +1 -0
  6. package/daemon.d.mts +12 -0
  7. package/daemon.mjs +22 -0
  8. package/daemon.mjs.map +1 -0
  9. package/door.d.mts +33 -0
  10. package/door.mjs +52 -0
  11. package/door.mjs.map +1 -0
  12. package/event.d.mts +79 -0
  13. package/event.mjs +35 -0
  14. package/event.mjs.map +1 -0
  15. package/forwarded.d.mts +13 -0
  16. package/forwarded.mjs +25 -0
  17. package/forwarded.mjs.map +1 -0
  18. package/host/envelope.d.mts +36 -0
  19. package/host/envelope.mjs +35 -0
  20. package/host/envelope.mjs.map +1 -0
  21. package/host/part.d.mts +2 -0
  22. package/host/part.mjs +60 -0
  23. package/host/part.mjs.map +1 -0
  24. package/host/principal.d.mts +36 -0
  25. package/host/principal.mjs +24 -0
  26. package/host/principal.mjs.map +1 -0
  27. package/host/records.d.mts +1051 -0
  28. package/host/records.mjs +494 -0
  29. package/host/records.mjs.map +1 -0
  30. package/host.d.mts +2224 -0
  31. package/host.mjs +812 -0
  32. package/host.mjs.map +1 -0
  33. package/ids.d.mts +53 -0
  34. package/ids.mjs +60 -0
  35. package/ids.mjs.map +1 -0
  36. package/jws.d.mts +84 -0
  37. package/jws.mjs +119 -0
  38. package/jws.mjs.map +1 -0
  39. package/location.d.mts +55 -0
  40. package/location.mjs +51 -0
  41. package/location.mjs.map +1 -0
  42. package/machine.d.mts +77 -0
  43. package/machine.mjs +48 -0
  44. package/machine.mjs.map +1 -0
  45. package/mcp.d.mts +24 -0
  46. package/mcp.mjs +36 -0
  47. package/mcp.mjs.map +1 -0
  48. package/model.d.mts +18 -0
  49. package/model.mjs +35 -0
  50. package/model.mjs.map +1 -0
  51. package/package.json +182 -5
  52. package/pairing.d.mts +67 -0
  53. package/pairing.mjs +67 -0
  54. package/pairing.mjs.map +1 -0
  55. package/part-Bzm-yNax.d.mts +69 -0
  56. package/project.d.mts +30 -0
  57. package/project.mjs +27 -0
  58. package/project.mjs.map +1 -0
  59. package/records-316ZUpKX.mjs +127 -0
  60. package/records-316ZUpKX.mjs.map +1 -0
  61. package/relay.d.mts +285 -0
  62. package/relay.mjs +115 -0
  63. package/relay.mjs.map +1 -0
  64. package/repo.d.mts +42 -0
  65. package/repo.mjs +46 -0
  66. package/repo.mjs.map +1 -0
  67. package/rolldown-runtime-D7D4PA-g.mjs +13 -0
  68. package/sandbox/driver.d.mts +10 -0
  69. package/sandbox/driver.mjs +13 -0
  70. package/sandbox/driver.mjs.map +1 -0
  71. package/sandbox/errors.d.mts +130 -0
  72. package/sandbox/errors.mjs +112 -0
  73. package/sandbox/errors.mjs.map +1 -0
  74. package/sandbox/instance.d.mts +152 -0
  75. package/sandbox/instance.mjs +150 -0
  76. package/sandbox/instance.mjs.map +1 -0
  77. package/session.d.mts +59 -0
  78. package/session.mjs +69 -0
  79. package/session.mjs.map +1 -0
  80. package/settings.d.mts +22 -0
  81. package/settings.mjs +32 -0
  82. package/settings.mjs.map +1 -0
  83. package/shell.d.mts +5 -0
  84. package/shell.mjs +7 -0
  85. package/shell.mjs.map +1 -0
  86. package/space-CR-9UxdT.d.mts +25 -0
  87. package/space.d.mts +2 -0
  88. package/space.mjs +33 -0
  89. package/space.mjs.map +1 -0
  90. package/thread.d.mts +50 -0
  91. package/thread.mjs +69 -0
  92. package/thread.mjs.map +1 -0
  93. package/usage-B_TDmpKC.d.mts +15 -0
  94. package/usage.d.mts +2 -0
  95. package/usage.mjs +43 -0
  96. package/usage.mjs.map +1 -0
@@ -0,0 +1,494 @@
1
+ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
+ import { AbsolutePath, optional } from "../common.mjs";
3
+ import { SessionID, ThreadID } from "../ids.mjs";
4
+ import { ThinkingLevel } from "../model.mjs";
5
+ import { ID, Kind, Ownership, Status, Usage } from "../sandbox/instance.mjs";
6
+ import { Delivery } from "../session.mjs";
7
+ import { RunError, RunOutcome, RunState } from "../thread.mjs";
8
+ import { edges, tallyKinds } from "../usage.mjs";
9
+ import { Part, ToolCall } from "./part.mjs";
10
+ import { Schema } from "effect";
11
+ //#region src/host/records.ts
12
+ var records_exports = /* @__PURE__ */ __exportAll({
13
+ Clone: () => Clone,
14
+ ClonePhase: () => ClonePhase,
15
+ CloneStage: () => CloneStage,
16
+ Delivery: () => Delivery,
17
+ DeviceInfo: () => DeviceInfo,
18
+ Folder: () => Folder,
19
+ HistoryEntry: () => HistoryEntry,
20
+ HostError: () => HostError,
21
+ HostRecords: () => records_exports,
22
+ IndexItem: () => IndexItem,
23
+ LiveDelta: () => LiveDelta,
24
+ LogSynced: () => LogSynced,
25
+ ModelList: () => ModelList,
26
+ ModelProvider: () => ModelProvider,
27
+ OAuthCredentials: () => OAuthCredentials,
28
+ OAuthError: () => OAuthError,
29
+ OAuthInfo: () => OAuthInfo,
30
+ OAuthProvider: () => OAuthProvider,
31
+ Part: () => Part,
32
+ ProjectInfo: () => ProjectInfo,
33
+ QueuedPrompt: () => QueuedPrompt,
34
+ Repository: () => Repository,
35
+ RunError: () => RunError,
36
+ RunOutcome: () => RunOutcome,
37
+ RunState: () => RunState,
38
+ RuntimeConfig: () => RuntimeConfig,
39
+ SandboxInfo: () => SandboxInfo,
40
+ SessionInfo: () => SessionInfo,
41
+ SpaceInfo: () => SpaceInfo,
42
+ ThinkingLevel: () => ThinkingLevel,
43
+ ThreadInfo: () => ThreadInfo,
44
+ ThreadItem: () => ThreadItem,
45
+ ThreadOrigin: () => ThreadOrigin,
46
+ ThreadRun: () => ThreadRun,
47
+ ThreadSummary: () => ThreadSummary,
48
+ ThreadUsage: () => ThreadUsage,
49
+ ToolCall: () => ToolCall,
50
+ UsageItem: () => UsageItem,
51
+ edges: () => edges
52
+ });
53
+ /** A computer paired with this machine. */
54
+ const DeviceInfo = Schema.Struct({
55
+ id: Schema.String,
56
+ label: Schema.String,
57
+ /** Its key's fingerprint, `SHA256:<thumbprint>`. */
58
+ fingerprint: Schema.String,
59
+ /** Epoch milliseconds. */
60
+ createdAt: Schema.Finite,
61
+ /** When it last took a ticket, epoch milliseconds; a device unseen for 30 days is refused. */
62
+ seenAt: Schema.Finite,
63
+ /** Whether it last paired or took a ticket over TLS, which ends at a proxy in front of this server. */
64
+ encrypted: Schema.optional(Schema.Boolean)
65
+ });
66
+ const SandboxInfo = Schema.Struct({
67
+ id: ID,
68
+ driver: Schema.String,
69
+ kind: Kind,
70
+ providerResourceId: Schema.OptionFromNullOr(Schema.String),
71
+ ownership: Ownership,
72
+ status: Status,
73
+ usage: Usage,
74
+ refCount: Schema.Int,
75
+ createdAt: Schema.DateFromString,
76
+ updatedAt: Schema.DateFromString
77
+ });
78
+ /** One logical codebase, whatever env it is checked out in. */
79
+ const ProjectInfo = Schema.Struct({
80
+ id: Schema.String,
81
+ name: Schema.String,
82
+ status: Schema.Literals(["active", "archived"]),
83
+ /** Epoch milliseconds. */
84
+ createdAt: Schema.Finite,
85
+ updatedAt: Schema.Finite
86
+ });
87
+ /** One directory of a project in one env; sessions attach to it. */
88
+ const SpaceInfo = Schema.Struct({
89
+ id: Schema.String,
90
+ projectId: Schema.String,
91
+ location: AbsolutePath,
92
+ kind: Schema.Literals([
93
+ "primary",
94
+ "linked",
95
+ "copy",
96
+ "plain"
97
+ ]),
98
+ /** The sandbox it is in; absent for the host. */
99
+ env: optional(Schema.String),
100
+ status: Schema.Literals(["active", "archived"]),
101
+ /** Epoch milliseconds. */
102
+ createdAt: Schema.Finite,
103
+ updatedAt: Schema.Finite
104
+ });
105
+ /** The container: where its threads run by default, and which host project it reads. */
106
+ const SessionInfo = Schema.Struct({
107
+ id: SessionID,
108
+ spaceId: Schema.String,
109
+ slug: Schema.String,
110
+ directory: AbsolutePath,
111
+ /** The host directory this session is anchored to. Absent when it has none. */
112
+ hostDir: optional(AbsolutePath),
113
+ sandbox: optional(SandboxInfo),
114
+ /** The project the session's space belongs to. */
115
+ project: optional(Schema.Struct({
116
+ id: Schema.String,
117
+ name: Schema.String
118
+ })),
119
+ tag: optional(Schema.String),
120
+ metadata: optional(Schema.Record(Schema.String, Schema.String)),
121
+ /** Epoch milliseconds. */
122
+ createdAt: Schema.Finite,
123
+ /** Last activity in any of its threads, epoch milliseconds. */
124
+ updatedAt: Schema.Finite,
125
+ /** Where unaddressed prompts go. */
126
+ mainThreadId: ThreadID
127
+ });
128
+ /** `cut` is the committed seq of `entryId`: the inherited line ends there. */
129
+ const ThreadOrigin = Schema.Union([
130
+ Schema.Struct({ kind: Schema.Literal("main") }),
131
+ Schema.Struct({
132
+ kind: Schema.Literal("fork"),
133
+ threadId: Schema.String,
134
+ entryId: Schema.String,
135
+ cut: Schema.Int
136
+ }),
137
+ Schema.Struct({
138
+ kind: Schema.Literal("subagent"),
139
+ threadId: Schema.String,
140
+ callId: Schema.String,
141
+ entryId: optional(Schema.String),
142
+ /** Present once `entryId` is committed. */
143
+ cut: optional(Schema.Int)
144
+ })
145
+ ]);
146
+ /** Billed usage of a thread's own entries; what it inherits through a fork point counts for its source. */
147
+ const ThreadUsage = Schema.Struct({
148
+ /** Total cost in US dollars, from the catalog's prices. */
149
+ cost: Schema.Finite,
150
+ input: Schema.Int,
151
+ output: Schema.Int,
152
+ cacheRead: Schema.Int,
153
+ cacheWrite: Schema.Int
154
+ });
155
+ /** The last run of a thread; `error` is set unless it succeeded or is still going. */
156
+ const ThreadRun = Schema.Struct({
157
+ /** Epoch milliseconds. */
158
+ startedAt: Schema.Finite,
159
+ endedAt: optional(Schema.Finite),
160
+ outcome: optional(RunOutcome),
161
+ error: optional(RunError)
162
+ });
163
+ const ThreadFields = {
164
+ id: ThreadID,
165
+ origin: ThreadOrigin,
166
+ /** Absent until its first own prompt; clients show a fork's source title until then. */
167
+ title: optional(Schema.String),
168
+ /** Last activity, epoch milliseconds. */
169
+ updatedAt: Schema.Finite,
170
+ /** The model chosen for this thread; absent when settings decide. */
171
+ model: optional(Schema.Struct({
172
+ provider: Schema.String,
173
+ id: Schema.String
174
+ })),
175
+ /** The thinking level chosen for this thread; absent when settings decide. */
176
+ thinkingLevel: optional(ThinkingLevel),
177
+ /** The prompt foundation chosen for this thread; absent when prompt plugins render it. */
178
+ foundation: optional(Schema.String),
179
+ /** Where it runs instead of the session's space and directory. */
180
+ placement: optional(Schema.Struct({
181
+ spaceId: Schema.String,
182
+ directory: AbsolutePath
183
+ })),
184
+ usage: ThreadUsage,
185
+ /** Where its run is, as the harness stores it: live whenever the server is up. */
186
+ runState: RunState,
187
+ /** When `runState` last changed, epoch milliseconds; absent before the first run. */
188
+ runStateAt: optional(Schema.Finite),
189
+ /** Absent before the first run. */
190
+ lastRun: optional(ThreadRun),
191
+ /** Whether it holds queued prompts that wait for its next prompt instead of running by themselves. */
192
+ parked: Schema.Boolean,
193
+ /** Automatic restarts of the current run. */
194
+ restarts: Schema.Int,
195
+ /** The 1-based provider request in flight; absent when none is. */
196
+ attempt: optional(Schema.Int),
197
+ /** The seq of the session event that created it. */
198
+ createdSeq: Schema.Int,
199
+ /** Epoch milliseconds. */
200
+ createdAt: Schema.Finite
201
+ };
202
+ /** One linear transcript of a session, with the session embedded. */
203
+ const ThreadInfo = Schema.Struct({
204
+ ...ThreadFields,
205
+ session: SessionInfo
206
+ });
207
+ /** A thread as `index.sync` sends it: its session is a row of its own. */
208
+ const ThreadSummary = Schema.Struct({
209
+ ...ThreadFields,
210
+ sessionId: SessionID
211
+ });
212
+ /** An `index.sync` item: a row with the revision that last wrote it, a deletion, or progress. */
213
+ const IndexItem = Schema.Union([
214
+ Schema.TaggedStruct("Project", {
215
+ project: ProjectInfo,
216
+ rev: Schema.Int
217
+ }),
218
+ Schema.TaggedStruct("Space", {
219
+ space: SpaceInfo,
220
+ rev: Schema.Int
221
+ }),
222
+ Schema.TaggedStruct("Session", {
223
+ session: SessionInfo,
224
+ rev: Schema.Int
225
+ }),
226
+ Schema.TaggedStruct("Thread", {
227
+ thread: ThreadSummary,
228
+ rev: Schema.Int
229
+ }),
230
+ Schema.TaggedStruct("Removed", {
231
+ kind: Schema.Literal("session"),
232
+ id: Schema.String,
233
+ rev: Schema.Int
234
+ }),
235
+ Schema.TaggedStruct("Synced", {
236
+ storeId: Schema.String,
237
+ rev: Schema.Int,
238
+ boot: Schema.String,
239
+ reset: optional(Schema.Literal(true))
240
+ })
241
+ ]);
242
+ /** Where a `usage.sync` row belongs: a thread's UTC hour. */
243
+ const UsageOwner = {
244
+ /** Start of the UTC hour, epoch milliseconds. */
245
+ hour: Schema.Int,
246
+ threadId: ThreadID,
247
+ /** The thread's session and project when the row was first written. */
248
+ sessionId: SessionID,
249
+ projectId: Schema.String
250
+ };
251
+ /** A `usage.sync` item: a rollup row with the revision that last wrote it, or progress. */
252
+ const UsageItem = Schema.Union([
253
+ Schema.TaggedStruct("Usage", {
254
+ ...UsageOwner,
255
+ provider: Schema.String,
256
+ model: Schema.String,
257
+ thinking: Schema.String,
258
+ requests: Schema.Int,
259
+ /** `reasoning` is part of `output`. */
260
+ tokens: Schema.Struct({
261
+ input: Schema.Int,
262
+ output: Schema.Int,
263
+ cacheRead: Schema.Int,
264
+ cacheWrite: Schema.Int,
265
+ reasoning: Schema.Int
266
+ }),
267
+ /** US dollars, from the catalog's prices. */
268
+ cost: Schema.Struct({
269
+ total: Schema.Finite,
270
+ input: Schema.Finite,
271
+ output: Schema.Finite,
272
+ cacheRead: Schema.Finite,
273
+ cacheWrite: Schema.Finite
274
+ }),
275
+ /** Total ms of the `timed` requests: the committed ones; aborted requests are never timed. */
276
+ duration: Schema.Finite,
277
+ timed: Schema.Int,
278
+ /** The `timed` requests per bucket of `edges`, one more than there are edges. */
279
+ durations: Schema.Array(Schema.Int),
280
+ rev: Schema.Int
281
+ }),
282
+ Schema.TaggedStruct("Tally", {
283
+ ...UsageOwner,
284
+ kind: Schema.Literals(tallyKinds),
285
+ name: Schema.String,
286
+ count: Schema.Int,
287
+ rev: Schema.Int
288
+ }),
289
+ Schema.TaggedStruct("Synced", {
290
+ storeId: Schema.String,
291
+ rev: Schema.Int,
292
+ boot: Schema.String,
293
+ reset: optional(Schema.Literal(true))
294
+ })
295
+ ]);
296
+ /** One message in a thread's line (inherited ones first), oldest first. */
297
+ const HistoryEntry = Schema.Struct({
298
+ /** The entry id: what live events and `thread.message` refer to. */
299
+ id: Schema.String,
300
+ /** The thread that wrote it: this one, or a source it was forked from. */
301
+ threadId: Schema.String,
302
+ /** Its place in the session's durable log; live events continue from it. */
303
+ seq: Schema.Int,
304
+ role: Schema.Literals(["user", "assistant"]),
305
+ /** `draft` is a reply still streaming; `aborted` one that was interrupted. */
306
+ state: Schema.Literals([
307
+ "committed",
308
+ "draft",
309
+ "aborted"
310
+ ]),
311
+ /** Epoch milliseconds. */
312
+ createdAt: Schema.Finite,
313
+ /** Epoch milliseconds of the last change; for a reply, when it ended once it is no longer a draft. */
314
+ updatedAt: Schema.Finite,
315
+ parts: Schema.Array(Part),
316
+ /** Bytes of its parts as the harness stores them; `thread.sync`'s budget counts it. */
317
+ size: Schema.Int,
318
+ /** Why a reply failed, as `provider/model: reason`; absent for one that ended normally or was stopped. */
319
+ error: optional(Schema.String)
320
+ });
321
+ /** A prompt admitted but not yet in the conversation: a steer waiting for the next model request, or a follow-up for the next turn. */
322
+ const QueuedPrompt = Schema.Struct({
323
+ /** The id of the user message it becomes once promoted. */
324
+ id: Schema.String,
325
+ delivery: Delivery,
326
+ text: Schema.String,
327
+ /** The thread's sequence number at admission; orders the queue. */
328
+ admittedSeq: Schema.Int,
329
+ /** Epoch milliseconds. */
330
+ createdAt: Schema.Finite
331
+ });
332
+ /** Text streamed into a reply's part since its last checkpoint; never stored. */
333
+ const LiveDelta = Schema.Struct({
334
+ /** The reply's entry id. */
335
+ entryId: Schema.String,
336
+ partIndex: Schema.Int,
337
+ kind: Schema.Literals(["text", "thinking"]),
338
+ /** The part's text length before this delta: apply it only where the held text ends there. */
339
+ offset: Schema.Int,
340
+ delta: Schema.String
341
+ });
342
+ /** A `thread.sync` item: a row with the revision that last wrote it, progress, or a live delta. */
343
+ const ThreadItem = Schema.Union([
344
+ Schema.TaggedStruct("Entry", {
345
+ entry: HistoryEntry,
346
+ rev: Schema.Int
347
+ }),
348
+ Schema.TaggedStruct("Inbox", {
349
+ prompt: QueuedPrompt,
350
+ state: Schema.Literals([
351
+ "pending",
352
+ "promoted",
353
+ "cancelled"
354
+ ]),
355
+ rev: Schema.Int
356
+ }),
357
+ Schema.TaggedStruct("Synced", {
358
+ storeId: Schema.String,
359
+ rev: Schema.Int,
360
+ floor: optional(Schema.Int)
361
+ }),
362
+ Schema.TaggedStruct("Delta", { delta: LiveDelta })
363
+ ]);
364
+ /** Ends `session.log`'s replay; `seq` is absent when the session has no durable events yet. */
365
+ const LogSynced = Schema.Struct({
366
+ type: Schema.Literal("log.synced"),
367
+ /** The session the log was read for. */
368
+ aggregateId: Schema.String,
369
+ seq: optional(Schema.Int)
370
+ });
371
+ /** A thread's model, thinking and foundation choices: a given field replaces the stored one, `null` clears it. */
372
+ const RuntimeConfig = Schema.Struct({
373
+ model: optional(Schema.NullOr(Schema.Struct({
374
+ provider: Schema.String,
375
+ id: Schema.String
376
+ }))),
377
+ thinkingLevel: optional(Schema.NullOr(ThinkingLevel)),
378
+ foundation: optional(Schema.NullOr(Schema.NonEmptyString))
379
+ });
380
+ /** A model to choose, by the catalog's id and display name, with the thinking levels it supports. */
381
+ const ModelOption = Schema.Struct({
382
+ id: Schema.String,
383
+ name: Schema.String,
384
+ /** In ascending order; `["off"]` for a model that does not reason. */
385
+ thinkingLevels: Schema.Array(ThinkingLevel)
386
+ });
387
+ /** A provider this server can call, with the models a session may use from it. */
388
+ const ModelProvider = Schema.Struct({
389
+ id: Schema.String,
390
+ name: Schema.String,
391
+ models: Schema.Array(ModelOption)
392
+ });
393
+ /** What `model.list` answers. */
394
+ const ModelList = Schema.Struct({
395
+ providers: Schema.Array(ModelProvider),
396
+ default: optional(Schema.Struct({
397
+ provider: Schema.String,
398
+ id: Schema.String,
399
+ /** As settings name it; a run clamps it to what the model supports. */
400
+ thinkingLevel: ThinkingLevel,
401
+ /** Display names from the catalog, present even when its provider is not listed. */
402
+ name: optional(Schema.String),
403
+ providerName: optional(Schema.String)
404
+ }))
405
+ });
406
+ var OAuthError = class extends Schema.TaggedError()("Server.OAuthError", { message: Schema.String }) {};
407
+ /** OAuth providers whose credentials this server stores. */
408
+ const OAuthProvider = Schema.Literals(["openai-codex", "github-copilot"]);
409
+ /**
410
+ * Credentials as the provider's aikit module persists them. The union is
411
+ * discriminated by `provider` so one set of RPCs serves every login.
412
+ */
413
+ const OAuthCredentials = Schema.Union([Schema.Struct({
414
+ provider: Schema.Literal("openai-codex"),
415
+ access: Schema.String,
416
+ refresh: Schema.String,
417
+ expires: Schema.Finite,
418
+ accountId: Schema.String
419
+ }), Schema.Struct({
420
+ provider: Schema.Literal("github-copilot"),
421
+ access: Schema.String,
422
+ refresh: Schema.String,
423
+ expires: Schema.Finite,
424
+ enterpriseUrl: optional(Schema.String),
425
+ apiEndpoint: optional(Schema.String),
426
+ availableModelIds: optional(Schema.Array(Schema.String))
427
+ })]);
428
+ /** What a login looks like from the outside: never the tokens themselves. */
429
+ const OAuthInfo = Schema.Struct({
430
+ provider: OAuthProvider,
431
+ /** Epoch millis, or 0 for a credential that does not expire. */
432
+ expires: Schema.Finite,
433
+ accountId: optional(Schema.String),
434
+ apiEndpoint: optional(Schema.String),
435
+ enterpriseUrl: optional(Schema.String),
436
+ availableModels: optional(Schema.Int)
437
+ });
438
+ /**
439
+ * A host folder operation that failed: unreadable, not a directory, taken, or git/gh refused. `reason`
440
+ * names a path that is not there, or is a file, so a client can offer to create it only when it is missing.
441
+ */
442
+ var HostError = class extends Schema.TaggedError()("Server.HostError", {
443
+ message: Schema.String,
444
+ reason: optional(Schema.Literals(["missing", "file"]))
445
+ }) {};
446
+ /** A directory on the host, by its name and absolute path. */
447
+ const Folder = Schema.Struct({
448
+ name: Schema.String,
449
+ path: Schema.String
450
+ });
451
+ /** A GitHub repository as `gh` names it, with its web and SSH clone URLs. */
452
+ const Repository = Schema.Struct({
453
+ nameWithOwner: Schema.String,
454
+ url: Schema.String,
455
+ sshUrl: Schema.String
456
+ });
457
+ const CloneStage = Schema.Literals([
458
+ "connecting",
459
+ "counting",
460
+ "receiving",
461
+ "resolving",
462
+ "checkout"
463
+ ]);
464
+ const ClonePhase = Schema.Literals([
465
+ "running",
466
+ "done",
467
+ "failed",
468
+ "cancelled"
469
+ ]);
470
+ /** A tracked clone; `path` (the absolute destination) is its id. */
471
+ const Clone = Schema.Struct({
472
+ path: Schema.String,
473
+ /** Credentials and query stripped. */
474
+ remote: Schema.String,
475
+ phase: ClonePhase,
476
+ stage: CloneStage,
477
+ /** 0 to 100 within `stage`, when git prints one. */
478
+ percent: Schema.NullOr(Schema.Int),
479
+ /** Git's transfer note, such as its speed; at most 200 characters. */
480
+ detail: Schema.NullOr(Schema.String),
481
+ /** Git has printed no progress for 20 seconds. */
482
+ stalled: Schema.Boolean,
483
+ /** Why it failed; at most 1000 characters. */
484
+ error: Schema.NullOr(Schema.String),
485
+ /** Epoch milliseconds. */
486
+ startedAt: Schema.Finite,
487
+ endedAt: Schema.NullOr(Schema.Finite),
488
+ /** Bumped on every change across all clones; a higher one is newer. */
489
+ sequence: Schema.Int
490
+ });
491
+ //#endregion
492
+ export { Clone, ClonePhase, CloneStage, Delivery, DeviceInfo, Folder, HistoryEntry, HostError, records_exports as HostRecords, IndexItem, LiveDelta, LogSynced, ModelList, ModelProvider, OAuthCredentials, OAuthError, OAuthInfo, OAuthProvider, Part, ProjectInfo, QueuedPrompt, Repository, RunError, RunOutcome, RunState, RuntimeConfig, SandboxInfo, SessionInfo, SpaceInfo, ThinkingLevel, ThreadInfo, ThreadItem, ThreadOrigin, ThreadRun, ThreadSummary, ThreadUsage, ToolCall, UsageItem, edges };
493
+
494
+ //# sourceMappingURL=records.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"records.mjs","names":["SandboxInstance.ID","SandboxInstance.Kind","SandboxInstance.Ownership","SandboxInstance.Status","SandboxInstance.Usage"],"sources":["../../../src/host/records.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { AbsolutePath, optional } from \"../common.ts\";\nimport { SessionID, ThreadID } from \"../ids.ts\";\nimport { ThinkingLevel } from \"../model.ts\";\nimport { SandboxInstance } from \"../sandbox/instance.ts\";\nimport { Delivery } from \"../session.ts\";\nimport { RunError, RunOutcome, RunState } from \"../thread.ts\";\nimport { edges, tallyKinds } from \"../usage.ts\";\nimport { Part, ToolCall } from \"./part.ts\";\n\n/*\n * The host RPC contract's wire records, apart from the `RpcGroup` in `../host.ts` (which re-exports\n * them): consumers such as the desktop UI and app contract import shapes here without pulling in\n * `effect/rpc`, `Host.Api`, or the server's error classes.\n */\n\n/** A computer paired with this machine. */\nexport const DeviceInfo = Schema.Struct({\n\tid: Schema.String,\n\tlabel: Schema.String,\n\t/** Its key's fingerprint, `SHA256:<thumbprint>`. */\n\tfingerprint: Schema.String,\n\t/** Epoch milliseconds. */\n\tcreatedAt: Schema.Finite,\n\t/** When it last took a ticket, epoch milliseconds; a device unseen for 30 days is refused. */\n\tseenAt: Schema.Finite,\n\t/** Whether it last paired or took a ticket over TLS, which ends at a proxy in front of this server. */\n\tencrypted: Schema.optional(Schema.Boolean),\n});\nexport type DeviceInfo = typeof DeviceInfo.Type;\n\nexport const SandboxInfo = Schema.Struct({\n\tid: SandboxInstance.ID,\n\tdriver: Schema.String,\n\tkind: SandboxInstance.Kind,\n\tproviderResourceId: Schema.OptionFromNullOr(Schema.String),\n\townership: SandboxInstance.Ownership,\n\tstatus: SandboxInstance.Status,\n\tusage: SandboxInstance.Usage,\n\trefCount: Schema.Int,\n\tcreatedAt: Schema.DateFromString,\n\tupdatedAt: Schema.DateFromString,\n});\nexport type SandboxInfo = typeof SandboxInfo.Type;\n\n/** One logical codebase, whatever env it is checked out in. */\nexport const ProjectInfo = Schema.Struct({\n\tid: Schema.String,\n\tname: Schema.String,\n\tstatus: Schema.Literals([\"active\", \"archived\"]),\n\t/** Epoch milliseconds. */\n\tcreatedAt: Schema.Finite,\n\tupdatedAt: Schema.Finite,\n});\nexport type ProjectInfo = typeof ProjectInfo.Type;\n\n/** One directory of a project in one env; sessions attach to it. */\nexport const SpaceInfo = Schema.Struct({\n\tid: Schema.String,\n\tprojectId: Schema.String,\n\tlocation: AbsolutePath,\n\tkind: Schema.Literals([\"primary\", \"linked\", \"copy\", \"plain\"]),\n\t/** The sandbox it is in; absent for the host. */\n\tenv: optional(Schema.String),\n\tstatus: Schema.Literals([\"active\", \"archived\"]),\n\t/** Epoch milliseconds. */\n\tcreatedAt: Schema.Finite,\n\tupdatedAt: Schema.Finite,\n});\nexport type SpaceInfo = typeof SpaceInfo.Type;\n\n/** The container: where its threads run by default, and which host project it reads. */\nexport const SessionInfo = Schema.Struct({\n\tid: SessionID,\n\tspaceId: Schema.String,\n\tslug: Schema.String,\n\tdirectory: AbsolutePath,\n\t/** The host directory this session is anchored to. Absent when it has none. */\n\thostDir: optional(AbsolutePath),\n\tsandbox: optional(SandboxInfo),\n\t/** The project the session's space belongs to. */\n\tproject: optional(Schema.Struct({ id: Schema.String, name: Schema.String })),\n\ttag: optional(Schema.String),\n\tmetadata: optional(Schema.Record(Schema.String, Schema.String)),\n\t/** Epoch milliseconds. */\n\tcreatedAt: Schema.Finite,\n\t/** Last activity in any of its threads, epoch milliseconds. */\n\tupdatedAt: Schema.Finite,\n\t/** Where unaddressed prompts go. */\n\tmainThreadId: ThreadID,\n});\nexport type SessionInfo = typeof SessionInfo.Type;\n\n/** `cut` is the committed seq of `entryId`: the inherited line ends there. */\nexport const ThreadOrigin = Schema.Union([\n\tSchema.Struct({ kind: Schema.Literal(\"main\") }),\n\tSchema.Struct({ kind: Schema.Literal(\"fork\"), threadId: Schema.String, entryId: Schema.String, cut: Schema.Int }),\n\tSchema.Struct({\n\t\tkind: Schema.Literal(\"subagent\"),\n\t\tthreadId: Schema.String,\n\t\tcallId: Schema.String,\n\t\tentryId: optional(Schema.String),\n\t\t/** Present once `entryId` is committed. */\n\t\tcut: optional(Schema.Int),\n\t}),\n]);\nexport type ThreadOrigin = typeof ThreadOrigin.Type;\n\n/** Billed usage of a thread's own entries; what it inherits through a fork point counts for its source. */\nexport const ThreadUsage = Schema.Struct({\n\t/** Total cost in US dollars, from the catalog's prices. */\n\tcost: Schema.Finite,\n\tinput: Schema.Int,\n\toutput: Schema.Int,\n\tcacheRead: Schema.Int,\n\tcacheWrite: Schema.Int,\n});\nexport type ThreadUsage = typeof ThreadUsage.Type;\n\n/** The last run of a thread; `error` is set unless it succeeded or is still going. */\nexport const ThreadRun = Schema.Struct({\n\t/** Epoch milliseconds. */\n\tstartedAt: Schema.Finite,\n\tendedAt: optional(Schema.Finite),\n\toutcome: optional(RunOutcome),\n\terror: optional(RunError),\n});\nexport type ThreadRun = typeof ThreadRun.Type;\n\nconst ThreadFields = {\n\tid: ThreadID,\n\torigin: ThreadOrigin,\n\t/** Absent until its first own prompt; clients show a fork's source title until then. */\n\ttitle: optional(Schema.String),\n\t/** Last activity, epoch milliseconds. */\n\tupdatedAt: Schema.Finite,\n\t/** The model chosen for this thread; absent when settings decide. */\n\tmodel: optional(Schema.Struct({ provider: Schema.String, id: Schema.String })),\n\t/** The thinking level chosen for this thread; absent when settings decide. */\n\tthinkingLevel: optional(ThinkingLevel),\n\t/** The prompt foundation chosen for this thread; absent when prompt plugins render it. */\n\tfoundation: optional(Schema.String),\n\t/** Where it runs instead of the session's space and directory. */\n\tplacement: optional(Schema.Struct({ spaceId: Schema.String, directory: AbsolutePath })),\n\tusage: ThreadUsage,\n\t/** Where its run is, as the harness stores it: live whenever the server is up. */\n\trunState: RunState,\n\t/** When `runState` last changed, epoch milliseconds; absent before the first run. */\n\trunStateAt: optional(Schema.Finite),\n\t/** Absent before the first run. */\n\tlastRun: optional(ThreadRun),\n\t/** Whether it holds queued prompts that wait for its next prompt instead of running by themselves. */\n\tparked: Schema.Boolean,\n\t/** Automatic restarts of the current run. */\n\trestarts: Schema.Int,\n\t/** The 1-based provider request in flight; absent when none is. */\n\tattempt: optional(Schema.Int),\n\t/** The seq of the session event that created it. */\n\tcreatedSeq: Schema.Int,\n\t/** Epoch milliseconds. */\n\tcreatedAt: Schema.Finite,\n};\n\n/** One linear transcript of a session, with the session embedded. */\nexport const ThreadInfo = Schema.Struct({ ...ThreadFields, session: SessionInfo });\nexport type ThreadInfo = typeof ThreadInfo.Type;\n\n/** A thread as `index.sync` sends it: its session is a row of its own. */\nexport const ThreadSummary = Schema.Struct({ ...ThreadFields, sessionId: SessionID });\nexport type ThreadSummary = typeof ThreadSummary.Type;\n\n/** An `index.sync` item: a row with the revision that last wrote it, a deletion, or progress. */\nexport const IndexItem = Schema.Union([\n\tSchema.TaggedStruct(\"Project\", { project: ProjectInfo, rev: Schema.Int }),\n\tSchema.TaggedStruct(\"Space\", { space: SpaceInfo, rev: Schema.Int }),\n\tSchema.TaggedStruct(\"Session\", { session: SessionInfo, rev: Schema.Int }),\n\tSchema.TaggedStruct(\"Thread\", { thread: ThreadSummary, rev: Schema.Int }),\n\tSchema.TaggedStruct(\"Removed\", { kind: Schema.Literal(\"session\"), id: Schema.String, rev: Schema.Int }),\n\t/**\n\t * Every row with a revision up to `rev` has been sent. `boot` is the store's latest open, for the\n\t * next call; `reset` marks the first one after a `boot` off the store's line: the whole index was\n\t * sent again from zero, and a client drops what it held of this store that was not sent.\n\t */\n\tSchema.TaggedStruct(\"Synced\", {\n\t\tstoreId: Schema.String,\n\t\trev: Schema.Int,\n\t\tboot: Schema.String,\n\t\treset: optional(Schema.Literal(true)),\n\t}),\n]);\nexport type IndexItem = typeof IndexItem.Type;\n\n/**\n * Upper bounds in ms of the request duration histogram: bucket `i` of `durations` counts durations\n * below `edges[i]` and at or above `edges[i - 1]`; one more bucket past the last edge is open-ended.\n */\nexport { edges };\n\n/** Where a `usage.sync` row belongs: a thread's UTC hour. */\nconst UsageOwner = {\n\t/** Start of the UTC hour, epoch milliseconds. */\n\thour: Schema.Int,\n\tthreadId: ThreadID,\n\t/** The thread's session and project when the row was first written. */\n\tsessionId: SessionID,\n\tprojectId: Schema.String,\n};\n\n/** A `usage.sync` item: a rollup row with the revision that last wrote it, or progress. */\nexport const UsageItem = Schema.Union([\n\t/** Requests of one thread in one hour to one provider, model and thinking level, aborted ones included. */\n\tSchema.TaggedStruct(\"Usage\", {\n\t\t...UsageOwner,\n\t\tprovider: Schema.String,\n\t\tmodel: Schema.String,\n\t\tthinking: Schema.String,\n\t\trequests: Schema.Int,\n\t\t/** `reasoning` is part of `output`. */\n\t\ttokens: Schema.Struct({\n\t\t\tinput: Schema.Int,\n\t\t\toutput: Schema.Int,\n\t\t\tcacheRead: Schema.Int,\n\t\t\tcacheWrite: Schema.Int,\n\t\t\treasoning: Schema.Int,\n\t\t}),\n\t\t/** US dollars, from the catalog's prices. */\n\t\tcost: Schema.Struct({\n\t\t\ttotal: Schema.Finite,\n\t\t\tinput: Schema.Finite,\n\t\t\toutput: Schema.Finite,\n\t\t\tcacheRead: Schema.Finite,\n\t\t\tcacheWrite: Schema.Finite,\n\t\t}),\n\t\t/** Total ms of the `timed` requests: the committed ones; aborted requests are never timed. */\n\t\tduration: Schema.Finite,\n\t\ttimed: Schema.Int,\n\t\t/** The `timed` requests per bucket of `edges`, one more than there are edges. */\n\t\tdurations: Schema.Array(Schema.Int),\n\t\trev: Schema.Int,\n\t}),\n\t/** Committed prompts (`name` is empty), or tool calls that ran by tool name, of one thread in one hour. */\n\tSchema.TaggedStruct(\"Tally\", {\n\t\t...UsageOwner,\n\t\tkind: Schema.Literals(tallyKinds),\n\t\tname: Schema.String,\n\t\tcount: Schema.Int,\n\t\trev: Schema.Int,\n\t}),\n\t/**\n\t * Every row with a revision up to `rev` has been sent. `boot` is the store's latest open, for the\n\t * next call; `reset` marks the first one after a `boot` off the store's line: every row was sent\n\t * again from zero, and a client drops what it held of this store.\n\t */\n\tSchema.TaggedStruct(\"Synced\", {\n\t\tstoreId: Schema.String,\n\t\trev: Schema.Int,\n\t\tboot: Schema.String,\n\t\treset: optional(Schema.Literal(true)),\n\t}),\n]);\nexport type UsageItem = typeof UsageItem.Type;\n\n/** One message in a thread's line (inherited ones first), oldest first. */\nexport const HistoryEntry = Schema.Struct({\n\t/** The entry id: what live events and `thread.message` refer to. */\n\tid: Schema.String,\n\t/** The thread that wrote it: this one, or a source it was forked from. */\n\tthreadId: Schema.String,\n\t/** Its place in the session's durable log; live events continue from it. */\n\tseq: Schema.Int,\n\trole: Schema.Literals([\"user\", \"assistant\"]),\n\t/** `draft` is a reply still streaming; `aborted` one that was interrupted. */\n\tstate: Schema.Literals([\"committed\", \"draft\", \"aborted\"]),\n\t/** Epoch milliseconds. */\n\tcreatedAt: Schema.Finite,\n\t/** Epoch milliseconds of the last change; for a reply, when it ended once it is no longer a draft. */\n\tupdatedAt: Schema.Finite,\n\tparts: Schema.Array(Part),\n\t/** Bytes of its parts as the harness stores them; `thread.sync`'s budget counts it. */\n\tsize: Schema.Int,\n\t/** Why a reply failed, as `provider/model: reason`; absent for one that ended normally or was stopped. */\n\terror: optional(Schema.String),\n});\nexport type HistoryEntry = typeof HistoryEntry.Type;\n\n/** A prompt admitted but not yet in the conversation: a steer waiting for the next model request, or a follow-up for the next turn. */\nexport const QueuedPrompt = Schema.Struct({\n\t/** The id of the user message it becomes once promoted. */\n\tid: Schema.String,\n\tdelivery: Delivery,\n\ttext: Schema.String,\n\t/** The thread's sequence number at admission; orders the queue. */\n\tadmittedSeq: Schema.Int,\n\t/** Epoch milliseconds. */\n\tcreatedAt: Schema.Finite,\n});\nexport type QueuedPrompt = typeof QueuedPrompt.Type;\n\n/** Text streamed into a reply's part since its last checkpoint; never stored. */\nexport const LiveDelta = Schema.Struct({\n\t/** The reply's entry id. */\n\tentryId: Schema.String,\n\tpartIndex: Schema.Int,\n\tkind: Schema.Literals([\"text\", \"thinking\"]),\n\t/** The part's text length before this delta: apply it only where the held text ends there. */\n\toffset: Schema.Int,\n\tdelta: Schema.String,\n});\nexport type LiveDelta = typeof LiveDelta.Type;\n\n/** A `thread.sync` item: a row with the revision that last wrote it, progress, or a live delta. */\nexport const ThreadItem = Schema.Union([\n\t/** Upsert by entry id. */\n\tSchema.TaggedStruct(\"Entry\", { entry: HistoryEntry, rev: Schema.Int }),\n\tSchema.TaggedStruct(\"Inbox\", {\n\t\tprompt: QueuedPrompt,\n\t\tstate: Schema.Literals([\"pending\", \"promoted\", \"cancelled\"]),\n\t\trev: Schema.Int,\n\t}),\n\t/** Every row with a revision up to `rev` has been sent; `floor`, on the first, is the oldest entry's seq. */\n\tSchema.TaggedStruct(\"Synced\", { storeId: Schema.String, rev: Schema.Int, floor: optional(Schema.Int) }),\n\tSchema.TaggedStruct(\"Delta\", { delta: LiveDelta }),\n]);\nexport type ThreadItem = typeof ThreadItem.Type;\n\n/** Ends `session.log`'s replay; `seq` is absent when the session has no durable events yet. */\nexport const LogSynced = Schema.Struct({\n\ttype: Schema.Literal(\"log.synced\"),\n\t/** The session the log was read for. */\n\taggregateId: Schema.String,\n\tseq: optional(Schema.Int),\n});\nexport type LogSynced = typeof LogSynced.Type;\n\n/** A thread's model, thinking and foundation choices: a given field replaces the stored one, `null` clears it. */\nexport const RuntimeConfig = Schema.Struct({\n\tmodel: optional(Schema.NullOr(Schema.Struct({ provider: Schema.String, id: Schema.String }))),\n\tthinkingLevel: optional(Schema.NullOr(ThinkingLevel)),\n\tfoundation: optional(Schema.NullOr(Schema.NonEmptyString)),\n});\nexport type RuntimeConfig = typeof RuntimeConfig.Type;\n\n/** A model to choose, by the catalog's id and display name, with the thinking levels it supports. */\nconst ModelOption = Schema.Struct({\n\tid: Schema.String,\n\tname: Schema.String,\n\t/** In ascending order; `[\"off\"]` for a model that does not reason. */\n\tthinkingLevels: Schema.Array(ThinkingLevel),\n});\n\n/** A provider this server can call, with the models a session may use from it. */\nexport const ModelProvider = Schema.Struct({\n\tid: Schema.String,\n\tname: Schema.String,\n\tmodels: Schema.Array(ModelOption),\n});\nexport type ModelProvider = typeof ModelProvider.Type;\n\n/** What `model.list` answers. */\nexport const ModelList = Schema.Struct({\n\tproviders: Schema.Array(ModelProvider),\n\tdefault: optional(\n\t\tSchema.Struct({\n\t\t\tprovider: Schema.String,\n\t\t\tid: Schema.String,\n\t\t\t/** As settings name it; a run clamps it to what the model supports. */\n\t\t\tthinkingLevel: ThinkingLevel,\n\t\t\t/** Display names from the catalog, present even when its provider is not listed. */\n\t\t\tname: optional(Schema.String),\n\t\t\tproviderName: optional(Schema.String),\n\t\t}),\n\t),\n});\nexport type ModelList = typeof ModelList.Type;\n\nexport class OAuthError extends Schema.TaggedError<OAuthError>()(\"Server.OAuthError\", {\n\tmessage: Schema.String,\n}) {}\n\n/** OAuth providers whose credentials this server stores. */\nexport const OAuthProvider = Schema.Literals([\"openai-codex\", \"github-copilot\"]);\nexport type OAuthProvider = typeof OAuthProvider.Type;\n\n/**\n * Credentials as the provider's aikit module persists them. The union is\n * discriminated by `provider` so one set of RPCs serves every login.\n */\nexport const OAuthCredentials = Schema.Union([\n\tSchema.Struct({\n\t\tprovider: Schema.Literal(\"openai-codex\"),\n\t\taccess: Schema.String,\n\t\trefresh: Schema.String,\n\t\texpires: Schema.Finite,\n\t\taccountId: Schema.String,\n\t}),\n\tSchema.Struct({\n\t\tprovider: Schema.Literal(\"github-copilot\"),\n\t\taccess: Schema.String,\n\t\trefresh: Schema.String,\n\t\texpires: Schema.Finite,\n\t\tenterpriseUrl: optional(Schema.String),\n\t\tapiEndpoint: optional(Schema.String),\n\t\tavailableModelIds: optional(Schema.Array(Schema.String)),\n\t}),\n]);\nexport type OAuthCredentials = typeof OAuthCredentials.Type;\n\n/** What a login looks like from the outside: never the tokens themselves. */\nexport const OAuthInfo = Schema.Struct({\n\tprovider: OAuthProvider,\n\t/** Epoch millis, or 0 for a credential that does not expire. */\n\texpires: Schema.Finite,\n\taccountId: optional(Schema.String),\n\tapiEndpoint: optional(Schema.String),\n\tenterpriseUrl: optional(Schema.String),\n\tavailableModels: optional(Schema.Int),\n});\nexport type OAuthInfo = typeof OAuthInfo.Type;\n\n/**\n * A host folder operation that failed: unreadable, not a directory, taken, or git/gh refused. `reason`\n * names a path that is not there, or is a file, so a client can offer to create it only when it is missing.\n */\nexport class HostError extends Schema.TaggedError<HostError>()(\"Server.HostError\", {\n\tmessage: Schema.String,\n\treason: optional(Schema.Literals([\"missing\", \"file\"])),\n}) {}\n\n/** A directory on the host, by its name and absolute path. */\nexport const Folder = Schema.Struct({ name: Schema.String, path: Schema.String });\nexport type Folder = typeof Folder.Type;\n\n/** A GitHub repository as `gh` names it, with its web and SSH clone URLs. */\nexport const Repository = Schema.Struct({ nameWithOwner: Schema.String, url: Schema.String, sshUrl: Schema.String });\nexport type Repository = typeof Repository.Type;\n\nexport const CloneStage = Schema.Literals([\"connecting\", \"counting\", \"receiving\", \"resolving\", \"checkout\"]);\nexport type CloneStage = typeof CloneStage.Type;\n\nexport const ClonePhase = Schema.Literals([\"running\", \"done\", \"failed\", \"cancelled\"]);\nexport type ClonePhase = typeof ClonePhase.Type;\n\n/** A tracked clone; `path` (the absolute destination) is its id. */\nexport const Clone = Schema.Struct({\n\tpath: Schema.String,\n\t/** Credentials and query stripped. */\n\tremote: Schema.String,\n\tphase: ClonePhase,\n\tstage: CloneStage,\n\t/** 0 to 100 within `stage`, when git prints one. */\n\tpercent: Schema.NullOr(Schema.Int),\n\t/** Git's transfer note, such as its speed; at most 200 characters. */\n\tdetail: Schema.NullOr(Schema.String),\n\t/** Git has printed no progress for 20 seconds. */\n\tstalled: Schema.Boolean,\n\t/** Why it failed; at most 1000 characters. */\n\terror: Schema.NullOr(Schema.String),\n\t/** Epoch milliseconds. */\n\tstartedAt: Schema.Finite,\n\tendedAt: Schema.NullOr(Schema.Finite),\n\t/** Bumped on every change across all clones; a higher one is newer. */\n\tsequence: Schema.Int,\n});\nexport type Clone = typeof Clone.Type;\n\nexport { Delivery, Part, RunError, RunOutcome, RunState, ThinkingLevel, ToolCall };\n\nexport * as HostRecords from \"./records.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAa,aAAa,OAAO,OAAO;CACvC,IAAI,OAAO;CACX,OAAO,OAAO;;CAEd,aAAa,OAAO;;CAEpB,WAAW,OAAO;;CAElB,QAAQ,OAAO;;CAEf,WAAW,OAAO,SAAS,OAAO,OAAO;AAC1C,CAAC;AAGD,MAAa,cAAc,OAAO,OAAO;CACxC,IAAIA;CACJ,QAAQ,OAAO;CACf,MAAMC;CACN,oBAAoB,OAAO,iBAAiB,OAAO,MAAM;CACzD,WAAWC;CACX,QAAQC;CACR,OAAOC;CACP,UAAU,OAAO;CACjB,WAAW,OAAO;CAClB,WAAW,OAAO;AACnB,CAAC;;AAID,MAAa,cAAc,OAAO,OAAO;CACxC,IAAI,OAAO;CACX,MAAM,OAAO;CACb,QAAQ,OAAO,SAAS,CAAC,UAAU,UAAU,CAAC;;CAE9C,WAAW,OAAO;CAClB,WAAW,OAAO;AACnB,CAAC;;AAID,MAAa,YAAY,OAAO,OAAO;CACtC,IAAI,OAAO;CACX,WAAW,OAAO;CAClB,UAAU;CACV,MAAM,OAAO,SAAS;EAAC;EAAW;EAAU;EAAQ;CAAO,CAAC;;CAE5D,KAAK,SAAS,OAAO,MAAM;CAC3B,QAAQ,OAAO,SAAS,CAAC,UAAU,UAAU,CAAC;;CAE9C,WAAW,OAAO;CAClB,WAAW,OAAO;AACnB,CAAC;;AAID,MAAa,cAAc,OAAO,OAAO;CACxC,IAAI;CACJ,SAAS,OAAO;CAChB,MAAM,OAAO;CACb,WAAW;;CAEX,SAAS,SAAS,YAAY;CAC9B,SAAS,SAAS,WAAW;;CAE7B,SAAS,SAAS,OAAO,OAAO;EAAE,IAAI,OAAO;EAAQ,MAAM,OAAO;CAAO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