@codeworksh/harness 0.7.0 → 0.8.0-canary.129.1.g84dd6b36

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.
package/effect.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./index-BlvIgEtU.mjs";
2
2
  import "./index-BEZ8eL--.mjs";
3
- import { Cause, Config, Context, DateTime, Duration, Effect, JsonSchema, Layer, Option, Ref, Schema, Scope, Stream } from "effect";
4
- import { SqlClient, SqlClient as SqlClient$1, SqlSchema as SqlSchema$1 } from "effect/sql";
3
+ import { Cause, Config, Context, DateTime, Duration, Effect, JsonSchema, Layer, Option, PubSub, Ref, Schema, Scope, Stream } from "effect";
4
+ import { SqlClient, SqlClient as SqlClient$1, SqlError, SqlSchema as SqlSchema$1, Statement } from "effect/sql";
5
5
  import { Model } from "effect/schema";
6
6
  import { Event, Message, Model as Model$1, Protocol } from "@codeworksh/aikit";
7
7
  import { MessageID as ID, SessionID as ID$4, ThreadID, ThreadID as ID$3 } from "@codeworksh/plugin/ids";
@@ -16,6 +16,33 @@ import { Config as Config$1, Events, Plugin, PluginOptions, PluginRef, PluginReg
16
16
  import * as AikitFailure from "@codeworksh/aikit/failure";
17
17
  import "just-bash";
18
18
  import { Exposure, HttpServer, OAuthConfig, ServerConfig } from "@codeworksh/plugin/plugin/mcp";
19
+ declare namespace store_d_exports {
20
+ export { Head, Interface$22 as Interface, Service$21 as Service, store_d_exports as Store, layer$23 as layer };
21
+ }
22
+ /** The store's identity and its last revision taken. */
23
+ interface Head {
24
+ readonly id: string;
25
+ readonly rev: number;
26
+ }
27
+ interface Interface$22 {
28
+ /**
29
+ * Runs `effect` as one write transaction, or inside the enclosing one. Every write to project,
30
+ * space, session, thread, entry or inbox goes through it. After a commit that took a revision,
31
+ * the doorbell rings.
32
+ */
33
+ readonly write: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | SqlError.SqlError, R>;
34
+ /** The enclosing write's revision, taken on first use; every row the write touches is stamped with it. */
35
+ readonly rev: Effect.Effect<number>;
36
+ readonly head: Effect.Effect<Head>;
37
+ /**
38
+ * A doorbell for the caller's scope, rung after every commit that took a revision. Register it
39
+ * before reading `head`, so no commit falls between the read and the first ring.
40
+ */
41
+ readonly wake: Effect.Effect<PubSub.Subscription<void>, never, Scope.Scope>;
42
+ }
43
+ declare const Service_base$19: Context.ServiceClass<Service$21, "@codeworksh/harness/db/store/Service", Interface$22>;
44
+ declare class Service$21 extends Service_base$19 {}
45
+ declare const layer$23: Layer.Layer<Service$21, never, SqlClient.SqlClient>;
19
46
  declare namespace schema_d_exports$1 {
20
47
  export { Delivery, IMAGE_MAX_BASE64, IMAGE_TYPES, ImagePart, InvalidPromptError, Part, Prompt$1 as Prompt, schema_d_exports$1 as PromptSchema, TextPart, imageProblem };
21
48
  }
@@ -112,6 +139,7 @@ declare const SpaceRow_base: import("effect/schema/VariantSchema").Class<SpaceRo
112
139
  create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
113
140
  }>;
114
141
  readonly status: Schema.Literals<readonly ["active", "archived"]>;
142
+ readonly rev: Schema.Int;
115
143
  }, Schema.Struct<import("effect/schema/VariantSchema").ExtractFields<"select", {
116
144
  readonly createdAt: Model.DateTimeInsertFromNumber;
117
145
  readonly updatedAt: Model.DateTimeUpdateFromNumber;
@@ -124,6 +152,7 @@ declare const SpaceRow_base: import("effect/schema/VariantSchema").Class<SpaceRo
124
152
  create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
125
153
  }>;
126
154
  readonly status: Schema.Literals<readonly ["active", "archived"]>;
155
+ readonly rev: Schema.Int;
127
156
  }, true>>> & {
128
157
  readonly insert: Schema.Struct<{
129
158
  readonly createdAt: import("effect/schema/VariantSchema").Overrideable<Schema.DateTimeUtcFromMillis>;
@@ -137,6 +166,7 @@ declare const SpaceRow_base: import("effect/schema/VariantSchema").Class<SpaceRo
137
166
  create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
138
167
  }>;
139
168
  readonly status: Schema.Literals<readonly ["active", "archived"]>;
169
+ readonly rev: Schema.Int;
140
170
  }>;
141
171
  readonly json: Schema.Struct<{
142
172
  readonly createdAt: Schema.DateTimeUtcFromMillis;
@@ -150,6 +180,7 @@ declare const SpaceRow_base: import("effect/schema/VariantSchema").Class<SpaceRo
150
180
  create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
151
181
  }>;
152
182
  readonly status: Schema.Literals<readonly ["active", "archived"]>;
183
+ readonly rev: Schema.Int;
153
184
  }>;
154
185
  readonly jsonCreate: Schema.Struct<{
155
186
  readonly id: Schema.String;
@@ -161,6 +192,7 @@ declare const SpaceRow_base: import("effect/schema/VariantSchema").Class<SpaceRo
161
192
  create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
162
193
  }>;
163
194
  readonly status: Schema.Literals<readonly ["active", "archived"]>;
195
+ readonly rev: Schema.Int;
164
196
  }>;
165
197
  readonly jsonUpdate: Schema.Struct<{
166
198
  readonly id: Schema.String;
@@ -172,6 +204,7 @@ declare const SpaceRow_base: import("effect/schema/VariantSchema").Class<SpaceRo
172
204
  create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
173
205
  }>;
174
206
  readonly status: Schema.Literals<readonly ["active", "archived"]>;
207
+ readonly rev: Schema.Int;
175
208
  }>;
176
209
  readonly select: Schema.Struct<{
177
210
  readonly createdAt: Schema.DateTimeUtcFromMillis;
@@ -185,6 +218,7 @@ declare const SpaceRow_base: import("effect/schema/VariantSchema").Class<SpaceRo
185
218
  create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
186
219
  }>;
187
220
  readonly status: Schema.Literals<readonly ["active", "archived"]>;
221
+ readonly rev: Schema.Int;
188
222
  }>;
189
223
  readonly update: Schema.Struct<{
190
224
  readonly updatedAt: import("effect/schema/VariantSchema").Overrideable<Schema.DateTimeUtcFromMillis>;
@@ -197,6 +231,7 @@ declare const SpaceRow_base: import("effect/schema/VariantSchema").Class<SpaceRo
197
231
  create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
198
232
  }>;
199
233
  readonly status: Schema.Literals<readonly ["active", "archived"]>;
234
+ readonly rev: Schema.Int;
200
235
  }>;
201
236
  };
202
237
  declare class SpaceRow extends SpaceRow_base {}
@@ -217,6 +252,7 @@ declare const SessionRow_base: import("effect/schema/VariantSchema").Class<Sessi
217
252
  readonly jsonCreate: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
218
253
  readonly jsonUpdate: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
219
254
  }>;
255
+ readonly rev: Schema.Int;
220
256
  }, Schema.Struct<import("effect/schema/VariantSchema").ExtractFields<"select", {
221
257
  readonly createdAt: Model.DateTimeInsertFromNumber;
222
258
  readonly updatedAt: Model.DateTimeUpdateFromNumber;
@@ -234,6 +270,7 @@ declare const SessionRow_base: import("effect/schema/VariantSchema").Class<Sessi
234
270
  readonly jsonCreate: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
235
271
  readonly jsonUpdate: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
236
272
  }>;
273
+ readonly rev: Schema.Int;
237
274
  }, true>>> & {
238
275
  readonly insert: Schema.Struct<{
239
276
  readonly createdAt: import("effect/schema/VariantSchema").Overrideable<Schema.DateTimeUtcFromMillis>;
@@ -245,6 +282,7 @@ declare const SessionRow_base: import("effect/schema/VariantSchema").Class<Sessi
245
282
  readonly hostDir: Schema.OptionFromNullOr<Schema.brand<Schema.String, "AbsolutePath">>;
246
283
  readonly tag: Schema.OptionFromNullOr<Schema.String>;
247
284
  readonly metadata: Schema.OptionFromNullOr<Schema.fromJsonString<Schema.$Record<Schema.String, Schema.String>>>;
285
+ readonly rev: Schema.Int;
248
286
  }>;
249
287
  readonly json: Schema.Struct<{
250
288
  readonly createdAt: Schema.DateTimeUtcFromMillis;
@@ -256,6 +294,7 @@ declare const SessionRow_base: import("effect/schema/VariantSchema").Class<Sessi
256
294
  readonly hostDir: Model.optionalOption<Schema.brand<Schema.String, "AbsolutePath">>;
257
295
  readonly tag: Model.optionalOption<Schema.String>;
258
296
  readonly metadata: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
297
+ readonly rev: Schema.Int;
259
298
  }>;
260
299
  readonly jsonCreate: Schema.Struct<{
261
300
  readonly id: Schema.brand<Schema.String, "Session.ID">;
@@ -265,6 +304,7 @@ declare const SessionRow_base: import("effect/schema/VariantSchema").Class<Sessi
265
304
  readonly hostDir: Model.optionalOption<Schema.brand<Schema.String, "AbsolutePath">>;
266
305
  readonly tag: Model.optionalOption<Schema.String>;
267
306
  readonly metadata: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
307
+ readonly rev: Schema.Int;
268
308
  }>;
269
309
  readonly jsonUpdate: Schema.Struct<{
270
310
  readonly id: Schema.brand<Schema.String, "Session.ID">;
@@ -274,6 +314,7 @@ declare const SessionRow_base: import("effect/schema/VariantSchema").Class<Sessi
274
314
  readonly hostDir: Model.optionalOption<Schema.brand<Schema.String, "AbsolutePath">>;
275
315
  readonly tag: Model.optionalOption<Schema.String>;
276
316
  readonly metadata: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
317
+ readonly rev: Schema.Int;
277
318
  }>;
278
319
  readonly select: Schema.Struct<{
279
320
  readonly createdAt: Schema.DateTimeUtcFromMillis;
@@ -285,6 +326,7 @@ declare const SessionRow_base: import("effect/schema/VariantSchema").Class<Sessi
285
326
  readonly hostDir: Schema.OptionFromNullOr<Schema.brand<Schema.String, "AbsolutePath">>;
286
327
  readonly tag: Schema.OptionFromNullOr<Schema.String>;
287
328
  readonly metadata: Schema.OptionFromNullOr<Schema.fromJsonString<Schema.$Record<Schema.String, Schema.String>>>;
329
+ readonly rev: Schema.Int;
288
330
  }>;
289
331
  readonly update: Schema.Struct<{
290
332
  readonly updatedAt: import("effect/schema/VariantSchema").Overrideable<Schema.DateTimeUtcFromMillis>;
@@ -295,6 +337,7 @@ declare const SessionRow_base: import("effect/schema/VariantSchema").Class<Sessi
295
337
  readonly hostDir: Schema.OptionFromNullOr<Schema.brand<Schema.String, "AbsolutePath">>;
296
338
  readonly tag: Schema.OptionFromNullOr<Schema.String>;
297
339
  readonly metadata: Schema.OptionFromNullOr<Schema.fromJsonString<Schema.$Record<Schema.String, Schema.String>>>;
340
+ readonly rev: Schema.Int;
298
341
  }>;
299
342
  };
300
343
  declare class SessionRow extends SessionRow_base {}
@@ -309,6 +352,23 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
309
352
  readonly originCallId: Model.FieldOption<Schema.String>;
310
353
  readonly title: Model.FieldOption<Schema.String>;
311
354
  readonly execution: Model.FieldOption<Schema.Literals<readonly ["running", "closed"]>>;
355
+ readonly runState: Model.GeneratedByDb<Schema.Literals<readonly ["idle", "starting", "running"]>>;
356
+ readonly runStateAt: Model.GeneratedByDb<Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>>;
357
+ readonly runStartedAt: Model.GeneratedByDb<Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>>;
358
+ readonly runEndedAt: Model.GeneratedByDb<Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>>;
359
+ readonly runOutcome: Model.GeneratedByDb<Schema.OptionFromNullOr<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>>;
360
+ readonly runError: Model.GeneratedByDb<Schema.OptionFromNullOr<Schema.fromJsonString<Schema.Union<readonly [Schema.TaggedStruct<"failed", {
361
+ readonly error: Schema.Struct<{
362
+ readonly type: Schema.String;
363
+ readonly message: Schema.String;
364
+ readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
365
+ }>;
366
+ }>, Schema.TaggedStruct<"runFailed", {
367
+ readonly reason: Schema.Literals<readonly ["crashloop", "interrupted", "truncated"]>;
368
+ readonly message: Schema.String;
369
+ }>, Schema.TaggedStruct<"interrupted", {
370
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
371
+ }>]>>>>;
312
372
  readonly restarts: Model.GeneratedByDb<Schema.Int>;
313
373
  readonly attempt: Model.FieldOption<Schema.Int>;
314
374
  readonly cost: Model.GeneratedByDb<Schema.Finite>;
@@ -317,6 +377,7 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
317
377
  readonly tokensCacheRead: Model.GeneratedByDb<Schema.Int>;
318
378
  readonly tokensCacheWrite: Model.GeneratedByDb<Schema.Int>;
319
379
  readonly createdSeq: Schema.Int;
380
+ readonly rev: Schema.Int;
320
381
  }, Schema.Struct<import("effect/schema/VariantSchema").ExtractFields<"select", {
321
382
  readonly createdAt: Model.DateTimeInsertFromNumber;
322
383
  readonly updatedAt: Model.DateTimeUpdateFromNumber;
@@ -328,6 +389,23 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
328
389
  readonly originCallId: Model.FieldOption<Schema.String>;
329
390
  readonly title: Model.FieldOption<Schema.String>;
330
391
  readonly execution: Model.FieldOption<Schema.Literals<readonly ["running", "closed"]>>;
392
+ readonly runState: Model.GeneratedByDb<Schema.Literals<readonly ["idle", "starting", "running"]>>;
393
+ readonly runStateAt: Model.GeneratedByDb<Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>>;
394
+ readonly runStartedAt: Model.GeneratedByDb<Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>>;
395
+ readonly runEndedAt: Model.GeneratedByDb<Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>>;
396
+ readonly runOutcome: Model.GeneratedByDb<Schema.OptionFromNullOr<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>>;
397
+ readonly runError: Model.GeneratedByDb<Schema.OptionFromNullOr<Schema.fromJsonString<Schema.Union<readonly [Schema.TaggedStruct<"failed", {
398
+ readonly error: Schema.Struct<{
399
+ readonly type: Schema.String;
400
+ readonly message: Schema.String;
401
+ readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
402
+ }>;
403
+ }>, Schema.TaggedStruct<"runFailed", {
404
+ readonly reason: Schema.Literals<readonly ["crashloop", "interrupted", "truncated"]>;
405
+ readonly message: Schema.String;
406
+ }>, Schema.TaggedStruct<"interrupted", {
407
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
408
+ }>]>>>>;
331
409
  readonly restarts: Model.GeneratedByDb<Schema.Int>;
332
410
  readonly attempt: Model.FieldOption<Schema.Int>;
333
411
  readonly cost: Model.GeneratedByDb<Schema.Finite>;
@@ -336,6 +414,7 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
336
414
  readonly tokensCacheRead: Model.GeneratedByDb<Schema.Int>;
337
415
  readonly tokensCacheWrite: Model.GeneratedByDb<Schema.Int>;
338
416
  readonly createdSeq: Schema.Int;
417
+ readonly rev: Schema.Int;
339
418
  }, true>>> & {
340
419
  readonly insert: Schema.Struct<{
341
420
  readonly createdAt: import("effect/schema/VariantSchema").Overrideable<Schema.DateTimeUtcFromMillis>;
@@ -350,6 +429,7 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
350
429
  readonly execution: Schema.OptionFromNullOr<Schema.Literals<readonly ["running", "closed"]>>;
351
430
  readonly attempt: Schema.OptionFromNullOr<Schema.Int>;
352
431
  readonly createdSeq: Schema.Int;
432
+ readonly rev: Schema.Int;
353
433
  }>;
354
434
  readonly json: Schema.Struct<{
355
435
  readonly createdAt: Schema.DateTimeUtcFromMillis;
@@ -362,6 +442,23 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
362
442
  readonly originCallId: Model.optionalOption<Schema.String>;
363
443
  readonly title: Model.optionalOption<Schema.String>;
364
444
  readonly execution: Model.optionalOption<Schema.Literals<readonly ["running", "closed"]>>;
445
+ readonly runState: Schema.Literals<readonly ["idle", "starting", "running"]>;
446
+ readonly runStateAt: Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>;
447
+ readonly runStartedAt: Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>;
448
+ readonly runEndedAt: Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>;
449
+ readonly runOutcome: Schema.OptionFromNullOr<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>;
450
+ readonly runError: Schema.OptionFromNullOr<Schema.fromJsonString<Schema.Union<readonly [Schema.TaggedStruct<"failed", {
451
+ readonly error: Schema.Struct<{
452
+ readonly type: Schema.String;
453
+ readonly message: Schema.String;
454
+ readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
455
+ }>;
456
+ }>, Schema.TaggedStruct<"runFailed", {
457
+ readonly reason: Schema.Literals<readonly ["crashloop", "interrupted", "truncated"]>;
458
+ readonly message: Schema.String;
459
+ }>, Schema.TaggedStruct<"interrupted", {
460
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
461
+ }>]>>>;
365
462
  readonly restarts: Schema.Int;
366
463
  readonly attempt: Model.optionalOption<Schema.Int>;
367
464
  readonly cost: Schema.Finite;
@@ -370,6 +467,7 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
370
467
  readonly tokensCacheRead: Schema.Int;
371
468
  readonly tokensCacheWrite: Schema.Int;
372
469
  readonly createdSeq: Schema.Int;
470
+ readonly rev: Schema.Int;
373
471
  }>;
374
472
  readonly jsonCreate: Schema.Struct<{
375
473
  readonly id: Schema.brand<Schema.String, "Thread.ID">;
@@ -382,6 +480,7 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
382
480
  readonly execution: Model.optionalOption<Schema.Literals<readonly ["running", "closed"]>>;
383
481
  readonly attempt: Model.optionalOption<Schema.Int>;
384
482
  readonly createdSeq: Schema.Int;
483
+ readonly rev: Schema.Int;
385
484
  }>;
386
485
  readonly jsonUpdate: Schema.Struct<{
387
486
  readonly id: Schema.brand<Schema.String, "Thread.ID">;
@@ -394,6 +493,7 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
394
493
  readonly execution: Model.optionalOption<Schema.Literals<readonly ["running", "closed"]>>;
395
494
  readonly attempt: Model.optionalOption<Schema.Int>;
396
495
  readonly createdSeq: Schema.Int;
496
+ readonly rev: Schema.Int;
397
497
  }>;
398
498
  readonly select: Schema.Struct<{
399
499
  readonly createdAt: Schema.DateTimeUtcFromMillis;
@@ -406,6 +506,23 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
406
506
  readonly originCallId: Schema.OptionFromNullOr<Schema.String>;
407
507
  readonly title: Schema.OptionFromNullOr<Schema.String>;
408
508
  readonly execution: Schema.OptionFromNullOr<Schema.Literals<readonly ["running", "closed"]>>;
509
+ readonly runState: Schema.Literals<readonly ["idle", "starting", "running"]>;
510
+ readonly runStateAt: Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>;
511
+ readonly runStartedAt: Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>;
512
+ readonly runEndedAt: Schema.OptionFromNullOr<Schema.DateTimeUtcFromMillis>;
513
+ readonly runOutcome: Schema.OptionFromNullOr<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>;
514
+ readonly runError: Schema.OptionFromNullOr<Schema.fromJsonString<Schema.Union<readonly [Schema.TaggedStruct<"failed", {
515
+ readonly error: Schema.Struct<{
516
+ readonly type: Schema.String;
517
+ readonly message: Schema.String;
518
+ readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
519
+ }>;
520
+ }>, Schema.TaggedStruct<"runFailed", {
521
+ readonly reason: Schema.Literals<readonly ["crashloop", "interrupted", "truncated"]>;
522
+ readonly message: Schema.String;
523
+ }>, Schema.TaggedStruct<"interrupted", {
524
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
525
+ }>]>>>;
409
526
  readonly restarts: Schema.Int;
410
527
  readonly attempt: Schema.OptionFromNullOr<Schema.Int>;
411
528
  readonly cost: Schema.Finite;
@@ -414,6 +531,7 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
414
531
  readonly tokensCacheRead: Schema.Int;
415
532
  readonly tokensCacheWrite: Schema.Int;
416
533
  readonly createdSeq: Schema.Int;
534
+ readonly rev: Schema.Int;
417
535
  }>;
418
536
  readonly update: Schema.Struct<{
419
537
  readonly updatedAt: import("effect/schema/VariantSchema").Overrideable<Schema.DateTimeUtcFromMillis>;
@@ -427,9 +545,360 @@ declare const ThreadRow_base: import("effect/schema/VariantSchema").Class<Thread
427
545
  readonly execution: Schema.OptionFromNullOr<Schema.Literals<readonly ["running", "closed"]>>;
428
546
  readonly attempt: Schema.OptionFromNullOr<Schema.Int>;
429
547
  readonly createdSeq: Schema.Int;
548
+ readonly rev: Schema.Int;
430
549
  }>;
431
550
  };
432
551
  declare class ThreadRow extends ThreadRow_base {}
552
+ declare const InboxRow_base: import("effect/schema/VariantSchema").Class<InboxRow, {
553
+ readonly id: Schema.String;
554
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID">;
555
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID">;
556
+ readonly kind: Schema.Literals<readonly ["prompt"]>;
557
+ readonly data: Model.JsonFromString<Schema.Struct<{
558
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
559
+ readonly type: Schema.Literal<"text">;
560
+ readonly text: Schema.String;
561
+ }>, Schema.Struct<{
562
+ readonly type: Schema.Literal<"image">;
563
+ readonly data: Schema.String;
564
+ readonly mimeType: Schema.String;
565
+ }>]>>;
566
+ }> & {
567
+ equivalence: import("effect/Equivalence").Equivalence<{
568
+ readonly parts: readonly ({
569
+ readonly type: "text";
570
+ readonly text: string;
571
+ } | {
572
+ readonly type: "image";
573
+ readonly data: string;
574
+ readonly mimeType: string;
575
+ })[];
576
+ }>;
577
+ fromText: (text: string) => {
578
+ readonly parts: readonly ({
579
+ readonly type: "text";
580
+ readonly text: string;
581
+ } | {
582
+ readonly type: "image";
583
+ readonly data: string;
584
+ readonly mimeType: string;
585
+ })[];
586
+ };
587
+ text: (prompt: Prompt$1) => string;
588
+ }>;
589
+ readonly delivery: Schema.Literals<readonly ["steer", "followUp"]>;
590
+ readonly admittedSeq: Schema.Int;
591
+ readonly promotedSeq: Model.FieldOption<Schema.Int>;
592
+ readonly cancelledSeq: Model.FieldOption<Schema.Int>;
593
+ readonly createdAt: Model.DateTimeInsertFromNumber;
594
+ readonly rev: Schema.Int;
595
+ }, Schema.Struct<import("effect/schema/VariantSchema").ExtractFields<"select", {
596
+ readonly id: Schema.String;
597
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID">;
598
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID">;
599
+ readonly kind: Schema.Literals<readonly ["prompt"]>;
600
+ readonly data: Model.JsonFromString<Schema.Struct<{
601
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
602
+ readonly type: Schema.Literal<"text">;
603
+ readonly text: Schema.String;
604
+ }>, Schema.Struct<{
605
+ readonly type: Schema.Literal<"image">;
606
+ readonly data: Schema.String;
607
+ readonly mimeType: Schema.String;
608
+ }>]>>;
609
+ }> & {
610
+ equivalence: import("effect/Equivalence").Equivalence<{
611
+ readonly parts: readonly ({
612
+ readonly type: "text";
613
+ readonly text: string;
614
+ } | {
615
+ readonly type: "image";
616
+ readonly data: string;
617
+ readonly mimeType: string;
618
+ })[];
619
+ }>;
620
+ fromText: (text: string) => {
621
+ readonly parts: readonly ({
622
+ readonly type: "text";
623
+ readonly text: string;
624
+ } | {
625
+ readonly type: "image";
626
+ readonly data: string;
627
+ readonly mimeType: string;
628
+ })[];
629
+ };
630
+ text: (prompt: Prompt$1) => string;
631
+ }>;
632
+ readonly delivery: Schema.Literals<readonly ["steer", "followUp"]>;
633
+ readonly admittedSeq: Schema.Int;
634
+ readonly promotedSeq: Model.FieldOption<Schema.Int>;
635
+ readonly cancelledSeq: Model.FieldOption<Schema.Int>;
636
+ readonly createdAt: Model.DateTimeInsertFromNumber;
637
+ readonly rev: Schema.Int;
638
+ }, true>>> & {
639
+ readonly insert: Schema.Struct<{
640
+ readonly id: Schema.String;
641
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID">;
642
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID">;
643
+ readonly kind: Schema.Literals<readonly ["prompt"]>;
644
+ readonly data: Schema.fromJsonString<Schema.Struct<{
645
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
646
+ readonly type: Schema.Literal<"text">;
647
+ readonly text: Schema.String;
648
+ }>, Schema.Struct<{
649
+ readonly type: Schema.Literal<"image">;
650
+ readonly data: Schema.String;
651
+ readonly mimeType: Schema.String;
652
+ }>]>>;
653
+ }> & {
654
+ equivalence: import("effect/Equivalence").Equivalence<{
655
+ readonly parts: readonly ({
656
+ readonly type: "text";
657
+ readonly text: string;
658
+ } | {
659
+ readonly type: "image";
660
+ readonly data: string;
661
+ readonly mimeType: string;
662
+ })[];
663
+ }>;
664
+ fromText: (text: string) => {
665
+ readonly parts: readonly ({
666
+ readonly type: "text";
667
+ readonly text: string;
668
+ } | {
669
+ readonly type: "image";
670
+ readonly data: string;
671
+ readonly mimeType: string;
672
+ })[];
673
+ };
674
+ text: (prompt: Prompt$1) => string;
675
+ }>;
676
+ readonly delivery: Schema.Literals<readonly ["steer", "followUp"]>;
677
+ readonly admittedSeq: Schema.Int;
678
+ readonly promotedSeq: Schema.OptionFromNullOr<Schema.Int>;
679
+ readonly cancelledSeq: Schema.OptionFromNullOr<Schema.Int>;
680
+ readonly createdAt: import("effect/schema/VariantSchema").Overrideable<Schema.DateTimeUtcFromMillis>;
681
+ readonly rev: Schema.Int;
682
+ }>;
683
+ readonly json: Schema.Struct<{
684
+ readonly id: Schema.String;
685
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID">;
686
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID">;
687
+ readonly kind: Schema.Literals<readonly ["prompt"]>;
688
+ readonly data: Schema.Struct<{
689
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
690
+ readonly type: Schema.Literal<"text">;
691
+ readonly text: Schema.String;
692
+ }>, Schema.Struct<{
693
+ readonly type: Schema.Literal<"image">;
694
+ readonly data: Schema.String;
695
+ readonly mimeType: Schema.String;
696
+ }>]>>;
697
+ }> & {
698
+ equivalence: import("effect/Equivalence").Equivalence<{
699
+ readonly parts: readonly ({
700
+ readonly type: "text";
701
+ readonly text: string;
702
+ } | {
703
+ readonly type: "image";
704
+ readonly data: string;
705
+ readonly mimeType: string;
706
+ })[];
707
+ }>;
708
+ fromText: (text: string) => {
709
+ readonly parts: readonly ({
710
+ readonly type: "text";
711
+ readonly text: string;
712
+ } | {
713
+ readonly type: "image";
714
+ readonly data: string;
715
+ readonly mimeType: string;
716
+ })[];
717
+ };
718
+ text: (prompt: Prompt$1) => string;
719
+ };
720
+ readonly delivery: Schema.Literals<readonly ["steer", "followUp"]>;
721
+ readonly admittedSeq: Schema.Int;
722
+ readonly promotedSeq: Model.optionalOption<Schema.Int>;
723
+ readonly cancelledSeq: Model.optionalOption<Schema.Int>;
724
+ readonly createdAt: Schema.DateTimeUtcFromMillis;
725
+ readonly rev: Schema.Int;
726
+ }>;
727
+ readonly jsonCreate: Schema.Struct<{
728
+ readonly id: Schema.String;
729
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID">;
730
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID">;
731
+ readonly kind: Schema.Literals<readonly ["prompt"]>;
732
+ readonly data: Schema.Struct<{
733
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
734
+ readonly type: Schema.Literal<"text">;
735
+ readonly text: Schema.String;
736
+ }>, Schema.Struct<{
737
+ readonly type: Schema.Literal<"image">;
738
+ readonly data: Schema.String;
739
+ readonly mimeType: Schema.String;
740
+ }>]>>;
741
+ }> & {
742
+ equivalence: import("effect/Equivalence").Equivalence<{
743
+ readonly parts: readonly ({
744
+ readonly type: "text";
745
+ readonly text: string;
746
+ } | {
747
+ readonly type: "image";
748
+ readonly data: string;
749
+ readonly mimeType: string;
750
+ })[];
751
+ }>;
752
+ fromText: (text: string) => {
753
+ readonly parts: readonly ({
754
+ readonly type: "text";
755
+ readonly text: string;
756
+ } | {
757
+ readonly type: "image";
758
+ readonly data: string;
759
+ readonly mimeType: string;
760
+ })[];
761
+ };
762
+ text: (prompt: Prompt$1) => string;
763
+ };
764
+ readonly delivery: Schema.Literals<readonly ["steer", "followUp"]>;
765
+ readonly admittedSeq: Schema.Int;
766
+ readonly promotedSeq: Model.optionalOption<Schema.Int>;
767
+ readonly cancelledSeq: Model.optionalOption<Schema.Int>;
768
+ readonly rev: Schema.Int;
769
+ }>;
770
+ readonly jsonUpdate: Schema.Struct<{
771
+ readonly id: Schema.String;
772
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID">;
773
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID">;
774
+ readonly kind: Schema.Literals<readonly ["prompt"]>;
775
+ readonly data: Schema.Struct<{
776
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
777
+ readonly type: Schema.Literal<"text">;
778
+ readonly text: Schema.String;
779
+ }>, Schema.Struct<{
780
+ readonly type: Schema.Literal<"image">;
781
+ readonly data: Schema.String;
782
+ readonly mimeType: Schema.String;
783
+ }>]>>;
784
+ }> & {
785
+ equivalence: import("effect/Equivalence").Equivalence<{
786
+ readonly parts: readonly ({
787
+ readonly type: "text";
788
+ readonly text: string;
789
+ } | {
790
+ readonly type: "image";
791
+ readonly data: string;
792
+ readonly mimeType: string;
793
+ })[];
794
+ }>;
795
+ fromText: (text: string) => {
796
+ readonly parts: readonly ({
797
+ readonly type: "text";
798
+ readonly text: string;
799
+ } | {
800
+ readonly type: "image";
801
+ readonly data: string;
802
+ readonly mimeType: string;
803
+ })[];
804
+ };
805
+ text: (prompt: Prompt$1) => string;
806
+ };
807
+ readonly delivery: Schema.Literals<readonly ["steer", "followUp"]>;
808
+ readonly admittedSeq: Schema.Int;
809
+ readonly promotedSeq: Model.optionalOption<Schema.Int>;
810
+ readonly cancelledSeq: Model.optionalOption<Schema.Int>;
811
+ readonly rev: Schema.Int;
812
+ }>;
813
+ readonly select: Schema.Struct<{
814
+ readonly id: Schema.String;
815
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID">;
816
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID">;
817
+ readonly kind: Schema.Literals<readonly ["prompt"]>;
818
+ readonly data: Schema.fromJsonString<Schema.Struct<{
819
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
820
+ readonly type: Schema.Literal<"text">;
821
+ readonly text: Schema.String;
822
+ }>, Schema.Struct<{
823
+ readonly type: Schema.Literal<"image">;
824
+ readonly data: Schema.String;
825
+ readonly mimeType: Schema.String;
826
+ }>]>>;
827
+ }> & {
828
+ equivalence: import("effect/Equivalence").Equivalence<{
829
+ readonly parts: readonly ({
830
+ readonly type: "text";
831
+ readonly text: string;
832
+ } | {
833
+ readonly type: "image";
834
+ readonly data: string;
835
+ readonly mimeType: string;
836
+ })[];
837
+ }>;
838
+ fromText: (text: string) => {
839
+ readonly parts: readonly ({
840
+ readonly type: "text";
841
+ readonly text: string;
842
+ } | {
843
+ readonly type: "image";
844
+ readonly data: string;
845
+ readonly mimeType: string;
846
+ })[];
847
+ };
848
+ text: (prompt: Prompt$1) => string;
849
+ }>;
850
+ readonly delivery: Schema.Literals<readonly ["steer", "followUp"]>;
851
+ readonly admittedSeq: Schema.Int;
852
+ readonly promotedSeq: Schema.OptionFromNullOr<Schema.Int>;
853
+ readonly cancelledSeq: Schema.OptionFromNullOr<Schema.Int>;
854
+ readonly createdAt: Schema.DateTimeUtcFromMillis;
855
+ readonly rev: Schema.Int;
856
+ }>;
857
+ readonly update: Schema.Struct<{
858
+ readonly id: Schema.String;
859
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID">;
860
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID">;
861
+ readonly kind: Schema.Literals<readonly ["prompt"]>;
862
+ readonly data: Schema.fromJsonString<Schema.Struct<{
863
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
864
+ readonly type: Schema.Literal<"text">;
865
+ readonly text: Schema.String;
866
+ }>, Schema.Struct<{
867
+ readonly type: Schema.Literal<"image">;
868
+ readonly data: Schema.String;
869
+ readonly mimeType: Schema.String;
870
+ }>]>>;
871
+ }> & {
872
+ equivalence: import("effect/Equivalence").Equivalence<{
873
+ readonly parts: readonly ({
874
+ readonly type: "text";
875
+ readonly text: string;
876
+ } | {
877
+ readonly type: "image";
878
+ readonly data: string;
879
+ readonly mimeType: string;
880
+ })[];
881
+ }>;
882
+ fromText: (text: string) => {
883
+ readonly parts: readonly ({
884
+ readonly type: "text";
885
+ readonly text: string;
886
+ } | {
887
+ readonly type: "image";
888
+ readonly data: string;
889
+ readonly mimeType: string;
890
+ })[];
891
+ };
892
+ text: (prompt: Prompt$1) => string;
893
+ }>;
894
+ readonly delivery: Schema.Literals<readonly ["steer", "followUp"]>;
895
+ readonly admittedSeq: Schema.Int;
896
+ readonly promotedSeq: Schema.OptionFromNullOr<Schema.Int>;
897
+ readonly cancelledSeq: Schema.OptionFromNullOr<Schema.Int>;
898
+ readonly rev: Schema.Int;
899
+ }>;
900
+ };
901
+ declare class InboxRow extends InboxRow_base {}
433
902
  declare const EntryRow_base: import("effect/schema/VariantSchema").Class<EntryRow, {
434
903
  readonly createdAt: Model.DateTimeInsertFromNumber;
435
904
  readonly updatedAt: Model.DateTimeUpdateFromNumber;
@@ -450,6 +919,7 @@ declare const EntryRow_base: import("effect/schema/VariantSchema").Class<EntryRo
450
919
  readonly jsonCreate: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
451
920
  readonly jsonUpdate: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
452
921
  }>;
922
+ readonly rev: Schema.Int;
453
923
  }, Schema.Struct<import("effect/schema/VariantSchema").ExtractFields<"select", {
454
924
  readonly createdAt: Model.DateTimeInsertFromNumber;
455
925
  readonly updatedAt: Model.DateTimeUpdateFromNumber;
@@ -470,6 +940,7 @@ declare const EntryRow_base: import("effect/schema/VariantSchema").Class<EntryRo
470
940
  readonly jsonCreate: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
471
941
  readonly jsonUpdate: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
472
942
  }>;
943
+ readonly rev: Schema.Int;
473
944
  }, true>>> & {
474
945
  readonly insert: Schema.Struct<{
475
946
  readonly createdAt: import("effect/schema/VariantSchema").Overrideable<Schema.DateTimeUtcFromMillis>;
@@ -484,6 +955,7 @@ declare const EntryRow_base: import("effect/schema/VariantSchema").Class<EntryRo
484
955
  readonly data: Schema.String;
485
956
  readonly label: Schema.OptionFromNullOr<Schema.String>;
486
957
  readonly metadata: Schema.OptionFromNullOr<Schema.fromJsonString<Schema.$Record<Schema.String, Schema.String>>>;
958
+ readonly rev: Schema.Int;
487
959
  }>;
488
960
  readonly json: Schema.Struct<{
489
961
  readonly createdAt: Schema.DateTimeUtcFromMillis;
@@ -498,6 +970,7 @@ declare const EntryRow_base: import("effect/schema/VariantSchema").Class<EntryRo
498
970
  readonly data: Schema.String;
499
971
  readonly label: Model.optionalOption<Schema.String>;
500
972
  readonly metadata: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
973
+ readonly rev: Schema.Int;
501
974
  }>;
502
975
  readonly jsonCreate: Schema.Struct<{
503
976
  readonly id: Schema.String;
@@ -510,6 +983,7 @@ declare const EntryRow_base: import("effect/schema/VariantSchema").Class<EntryRo
510
983
  readonly data: Schema.String;
511
984
  readonly label: Model.optionalOption<Schema.String>;
512
985
  readonly metadata: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
986
+ readonly rev: Schema.Int;
513
987
  }>;
514
988
  readonly jsonUpdate: Schema.Struct<{
515
989
  readonly id: Schema.String;
@@ -522,6 +996,7 @@ declare const EntryRow_base: import("effect/schema/VariantSchema").Class<EntryRo
522
996
  readonly data: Schema.String;
523
997
  readonly label: Model.optionalOption<Schema.String>;
524
998
  readonly metadata: Model.optionalOption<Schema.$Record<Schema.String, Schema.String>>;
999
+ readonly rev: Schema.Int;
525
1000
  }>;
526
1001
  readonly select: Schema.Struct<{
527
1002
  readonly createdAt: Schema.DateTimeUtcFromMillis;
@@ -536,6 +1011,7 @@ declare const EntryRow_base: import("effect/schema/VariantSchema").Class<EntryRo
536
1011
  readonly data: Schema.String;
537
1012
  readonly label: Schema.OptionFromNullOr<Schema.String>;
538
1013
  readonly metadata: Schema.OptionFromNullOr<Schema.fromJsonString<Schema.$Record<Schema.String, Schema.String>>>;
1014
+ readonly rev: Schema.Int;
539
1015
  }>;
540
1016
  readonly update: Schema.Struct<{
541
1017
  readonly updatedAt: import("effect/schema/VariantSchema").Overrideable<Schema.DateTimeUtcFromMillis>;
@@ -549,6 +1025,7 @@ declare const EntryRow_base: import("effect/schema/VariantSchema").Class<EntryRo
549
1025
  readonly data: Schema.String;
550
1026
  readonly label: Schema.OptionFromNullOr<Schema.String>;
551
1027
  readonly metadata: Schema.OptionFromNullOr<Schema.fromJsonString<Schema.$Record<Schema.String, Schema.String>>>;
1028
+ readonly rev: Schema.Int;
552
1029
  }>;
553
1030
  };
554
1031
  declare class EntryRow extends EntryRow_base {}
@@ -789,9 +1266,10 @@ declare const IDFromDb$1: Schema.brand<Schema.String, "Session.ID">;
789
1266
  /**
790
1267
  * Why an execution stopped. Supplied by whoever asked for the interruption --
791
1268
  * a stop the user asked for and a stop the process imposed on shutdown are
792
- * different facts, and inspecting the cause cannot tell them apart.
1269
+ * different facts, and inspecting the cause cannot tell them apart. `crash` is
1270
+ * the startup sweep's: the process that ran the execution died without ending it.
793
1271
  */
794
- declare const InterruptReason: Schema.Literals<readonly ["user", "shutdown"]>;
1272
+ declare const InterruptReason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
795
1273
  type InterruptReason = typeof InterruptReason.Type;
796
1274
  declare const JsonObject: Schema.fromJsonString<Schema.$Record<Schema.String, Schema.Unknown>>;
797
1275
  declare const MessageEnvelopeIdentity: Schema.fromJsonString<Schema.Struct<{
@@ -875,7 +1353,7 @@ declare const AssistantEnvelopeUsage: Schema.fromJsonString<Schema.Struct<{
875
1353
  }>;
876
1354
  }>>;
877
1355
  declare namespace schema_d_exports$2 {
878
- export { Execution, ID$3 as ID, IDFromDb, MAIN, Origin$1 as Origin, OriginKind, TITLE_MAX_LENGTH, schema_d_exports$2 as ThreadSchema, titleFrom };
1356
+ export { Execution, ID$3 as ID, IDFromDb, MAIN, Origin$1 as Origin, OriginKind, RunError$1 as RunError, RunFailedReason, RunOutcome, RunState, TITLE_MAX_LENGTH, schema_d_exports$2 as ThreadSchema, titleFrom };
879
1357
  }
880
1358
  declare const IDFromDb: Schema.brand<Schema.String, "Thread.ID">;
881
1359
  /** How a thread came to exist; stored flattened as the `origin_*` columns. */
@@ -909,6 +1387,31 @@ type Origin$1 =
909
1387
  */
910
1388
  declare const Execution: Schema.Literals<readonly ["running", "closed"]>;
911
1389
  type Execution = typeof Execution.Type;
1390
+ /**
1391
+ * Where the thread's run is, projected from its lifecycle events: `starting` from
1392
+ * `execution.started` until the first `llm.started`, `running` after it, `idle` once it ended.
1393
+ */
1394
+ declare const RunState: Schema.Literals<readonly ["idle", "starting", "running"]>;
1395
+ type RunState = typeof RunState.Type;
1396
+ declare const RunOutcome: Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>;
1397
+ type RunOutcome = typeof RunOutcome.Type;
1398
+ /** Why a run ended without its answer and is not resumed; see `session.run.failed`. */
1399
+ declare const RunFailedReason: Schema.Literals<readonly ["crashloop", "interrupted", "truncated"]>;
1400
+ type RunFailedReason = typeof RunFailedReason.Type;
1401
+ /** Why the last run did not succeed; stored as `thread.run_error` JSON. */
1402
+ declare const RunError$1: Schema.Union<readonly [Schema.TaggedStruct<"failed", {
1403
+ readonly error: Schema.Struct<{
1404
+ readonly type: Schema.String;
1405
+ readonly message: Schema.String;
1406
+ readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
1407
+ }>;
1408
+ }>, Schema.TaggedStruct<"runFailed", {
1409
+ readonly reason: Schema.Literals<readonly ["crashloop", "interrupted", "truncated"]>;
1410
+ readonly message: Schema.String;
1411
+ }>, Schema.TaggedStruct<"interrupted", {
1412
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
1413
+ }>]>;
1414
+ type RunError$1 = typeof RunError$1.Type;
912
1415
  /** `main` names a session's main thread wherever a thread id is accepted from a person. */
913
1416
  declare const MAIN = "main";
914
1417
  declare const TITLE_MAX_LENGTH = 48;
@@ -1058,7 +1561,7 @@ interface Interface$21 {
1058
1561
  }
1059
1562
  declare const Service_base$18: Context.ServiceClass<Service$20, "@codeworksh/harness/document/document/Service", Interface$21>;
1060
1563
  declare class Service$20 extends Service_base$18 {}
1061
- declare const layer$22: Layer.Layer<Service$20, never, SqlClient.SqlClient>;
1564
+ declare const layer$22: Layer.Layer<Service$20, never, Service$21 | SqlClient.SqlClient>;
1062
1565
  import * as import__codeworksh_plugin_event from "@codeworksh/plugin/event";
1063
1566
  declare namespace event_d_exports {
1064
1567
  export { event_d_exports as Event, Interface$20 as Interface, InvalidDurableEventError, LogInput, LogItem, Manifest, PublishOptions, ReadAggregateInput, ReadAggregateResult, SerializedEvent, Service$19 as Service, Subscribe, SubscribeOptions, Subscriber, SubscriptionOverflowError, Synced, Unsubscribe, isSynced, layer$21 as layer };
@@ -1217,7 +1720,7 @@ interface Interface$20 {
1217
1720
  }
1218
1721
  declare const Service_base$17: Context.ServiceClass<Service$19, "@codeworksh/harness/event/event/Service", Interface$20>;
1219
1722
  declare class Service$19 extends Service_base$17 {}
1220
- declare const layer$21: Layer.Layer<Service$19, never, SqlClient.SqlClient>;
1723
+ declare const layer$21: Layer.Layer<Service$19, never, Service$21 | SqlClient.SqlClient>;
1221
1724
  declare namespace list_d_exports {
1222
1725
  export { Definitions, DurableDefinitions, list_d_exports as EventList, ExecutionFailed, ExecutionInterrupted, ExecutionStarted, ExecutionSucceeded, LLMEnded, LLMFailed, LLMProgress, LLMProgressChange, LLMStarted, LLMTextDelta, LLMTextEnd, LLMTextStart, LLMThinkingDelta, LLMThinkingEnd, LLMThinkingStart, McpServerState, McpServerStatus, McpSkipped, McpState, PluginUpdated, PromptAdmitted, PromptCancelled, PromptUpdated, Prompted, PublicDefinitions, RetryFinished, RetryScheduled, RunFailed, SessionCreated, SystemChanged, ThreadConfigured, ThreadForked, ToolProgress, ToolSettled, ToolStarted, TurnAbortCause, TurnAborted, TurnEnded, TurnStarted };
1223
1726
  }
@@ -3646,20 +4149,21 @@ declare const LLMTextDelta: Schema.Struct<{
3646
4149
  readonly version: Schema.Int;
3647
4150
  }>>, never, never>;
3648
4151
  readonly data: Schema.Struct<{
3649
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
3650
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
4152
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
4153
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
3651
4154
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
3652
4155
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
3653
4156
  };
3654
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
4157
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
3655
4158
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
3656
4159
  };
3657
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
4160
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
3658
4161
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
3659
4162
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
3660
4163
  };
3661
- readonly partIndex: Schema.Int;
3662
- readonly delta: Schema.String;
4164
+ partIndex: Schema.Int;
4165
+ offset: Schema.Int;
4166
+ delta: Schema.String;
3663
4167
  }>;
3664
4168
  }> & {
3665
4169
  type: "session.llm.text.delta";
@@ -3668,20 +4172,21 @@ declare const LLMTextDelta: Schema.Struct<{
3668
4172
  readonly aggregate: string;
3669
4173
  };
3670
4174
  data: Schema.Struct<{
3671
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
3672
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
4175
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
4176
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
3673
4177
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
3674
4178
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
3675
4179
  };
3676
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
4180
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
3677
4181
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
3678
4182
  };
3679
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
4183
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
3680
4184
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
3681
4185
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
3682
4186
  };
3683
- readonly partIndex: Schema.Int;
3684
- readonly delta: Schema.String;
4187
+ partIndex: Schema.Int;
4188
+ offset: Schema.Int;
4189
+ delta: Schema.String;
3685
4190
  }>;
3686
4191
  };
3687
4192
  type LLMTextDelta = typeof LLMTextDelta.Type;
@@ -3809,20 +4314,21 @@ declare const LLMThinkingDelta: Schema.Struct<{
3809
4314
  readonly version: Schema.Int;
3810
4315
  }>>, never, never>;
3811
4316
  readonly data: Schema.Struct<{
3812
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
3813
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
4317
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
4318
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
3814
4319
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
3815
4320
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
3816
4321
  };
3817
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
4322
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
3818
4323
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
3819
4324
  };
3820
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
4325
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
3821
4326
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
3822
4327
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
3823
4328
  };
3824
- readonly partIndex: Schema.Int;
3825
- readonly delta: Schema.String;
4329
+ partIndex: Schema.Int;
4330
+ offset: Schema.Int;
4331
+ delta: Schema.String;
3826
4332
  }>;
3827
4333
  }> & {
3828
4334
  type: "session.llm.thinking.delta";
@@ -3831,20 +4337,21 @@ declare const LLMThinkingDelta: Schema.Struct<{
3831
4337
  readonly aggregate: string;
3832
4338
  };
3833
4339
  data: Schema.Struct<{
3834
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
3835
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
4340
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
4341
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
3836
4342
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
3837
4343
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
3838
4344
  };
3839
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
4345
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
3840
4346
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
3841
4347
  };
3842
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
4348
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
3843
4349
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
3844
4350
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
3845
4351
  };
3846
- readonly partIndex: Schema.Int;
3847
- readonly delta: Schema.String;
4352
+ partIndex: Schema.Int;
4353
+ offset: Schema.Int;
4354
+ delta: Schema.String;
3848
4355
  }>;
3849
4356
  };
3850
4357
  type LLMThinkingDelta = typeof LLMThinkingDelta.Type;
@@ -8049,14 +8556,15 @@ declare const ExecutionStarted: Schema.Struct<{
8049
8556
  readonly version: Schema.Int;
8050
8557
  }>>, never, never>;
8051
8558
  readonly data: Schema.Struct<{
8052
- timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
8053
- sessionId: Schema.brand<Schema.String, "Session.ID"> & {
8559
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
8560
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
8054
8561
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
8055
8562
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
8056
8563
  };
8057
- threadId: Schema.brand<Schema.String, "Thread.ID"> & {
8564
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
8058
8565
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
8059
8566
  };
8567
+ readonly resumed: Schema.Boolean;
8060
8568
  }>;
8061
8569
  }> & {
8062
8570
  type: "session.execution.started";
@@ -8065,14 +8573,15 @@ declare const ExecutionStarted: Schema.Struct<{
8065
8573
  readonly aggregate: string;
8066
8574
  };
8067
8575
  data: Schema.Struct<{
8068
- timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
8069
- sessionId: Schema.brand<Schema.String, "Session.ID"> & {
8576
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
8577
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
8070
8578
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
8071
8579
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
8072
8580
  };
8073
- threadId: Schema.brand<Schema.String, "Thread.ID"> & {
8581
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
8074
8582
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
8075
8583
  };
8584
+ readonly resumed: Schema.Boolean;
8076
8585
  }>;
8077
8586
  };
8078
8587
  type ExecutionStarted = typeof ExecutionStarted.Type;
@@ -8196,7 +8705,7 @@ declare const ExecutionInterrupted: Schema.Struct<{
8196
8705
  readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
8197
8706
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
8198
8707
  };
8199
- readonly reason: Schema.Literals<readonly ["user", "shutdown"]>;
8708
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
8200
8709
  }>;
8201
8710
  }> & {
8202
8711
  type: "session.execution.interrupted";
@@ -8213,7 +8722,7 @@ declare const ExecutionInterrupted: Schema.Struct<{
8213
8722
  readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
8214
8723
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
8215
8724
  };
8216
- readonly reason: Schema.Literals<readonly ["user", "shutdown"]>;
8725
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
8217
8726
  }>;
8218
8727
  };
8219
8728
  type ExecutionInterrupted = typeof ExecutionInterrupted.Type;
@@ -8494,14 +9003,15 @@ declare const Definitions: readonly [Schema.Struct<{
8494
9003
  readonly version: Schema.Int;
8495
9004
  }>>, never, never>;
8496
9005
  readonly data: Schema.Struct<{
8497
- timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
8498
- sessionId: Schema.brand<Schema.String, "Session.ID"> & {
9006
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
9007
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
8499
9008
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
8500
9009
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
8501
9010
  };
8502
- threadId: Schema.brand<Schema.String, "Thread.ID"> & {
9011
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
8503
9012
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
8504
9013
  };
9014
+ readonly resumed: Schema.Boolean;
8505
9015
  }>;
8506
9016
  }> & {
8507
9017
  type: "session.execution.started";
@@ -8510,14 +9020,15 @@ declare const Definitions: readonly [Schema.Struct<{
8510
9020
  readonly aggregate: string;
8511
9021
  };
8512
9022
  data: Schema.Struct<{
8513
- timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
8514
- sessionId: Schema.brand<Schema.String, "Session.ID"> & {
9023
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
9024
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
8515
9025
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
8516
9026
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
8517
9027
  };
8518
- threadId: Schema.brand<Schema.String, "Thread.ID"> & {
9028
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
8519
9029
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
8520
9030
  };
9031
+ readonly resumed: Schema.Boolean;
8521
9032
  }>;
8522
9033
  }, Schema.Struct<{
8523
9034
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -8635,7 +9146,7 @@ declare const Definitions: readonly [Schema.Struct<{
8635
9146
  readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
8636
9147
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
8637
9148
  };
8638
- readonly reason: Schema.Literals<readonly ["user", "shutdown"]>;
9149
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
8639
9150
  }>;
8640
9151
  }> & {
8641
9152
  type: "session.execution.interrupted";
@@ -8652,7 +9163,7 @@ declare const Definitions: readonly [Schema.Struct<{
8652
9163
  readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
8653
9164
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
8654
9165
  };
8655
- readonly reason: Schema.Literals<readonly ["user", "shutdown"]>;
9166
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
8656
9167
  }>;
8657
9168
  }, Schema.Struct<{
8658
9169
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -11017,20 +11528,21 @@ declare const Definitions: readonly [Schema.Struct<{
11017
11528
  readonly version: Schema.Int;
11018
11529
  }>>, never, never>;
11019
11530
  readonly data: Schema.Struct<{
11020
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
11021
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
11531
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
11532
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
11022
11533
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
11023
11534
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
11024
11535
  };
11025
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
11536
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
11026
11537
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
11027
11538
  };
11028
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
11539
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
11029
11540
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
11030
11541
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
11031
11542
  };
11032
- readonly partIndex: Schema.Int;
11033
- readonly delta: Schema.String;
11543
+ partIndex: Schema.Int;
11544
+ offset: Schema.Int;
11545
+ delta: Schema.String;
11034
11546
  }>;
11035
11547
  }> & {
11036
11548
  type: "session.llm.text.delta";
@@ -11039,20 +11551,21 @@ declare const Definitions: readonly [Schema.Struct<{
11039
11551
  readonly aggregate: string;
11040
11552
  };
11041
11553
  data: Schema.Struct<{
11042
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
11043
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
11554
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
11555
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
11044
11556
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
11045
11557
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
11046
11558
  };
11047
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
11559
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
11048
11560
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
11049
11561
  };
11050
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
11562
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
11051
11563
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
11052
11564
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
11053
11565
  };
11054
- readonly partIndex: Schema.Int;
11055
- readonly delta: Schema.String;
11566
+ partIndex: Schema.Int;
11567
+ offset: Schema.Int;
11568
+ delta: Schema.String;
11056
11569
  }>;
11057
11570
  }, Schema.Struct<{
11058
11571
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -11174,20 +11687,21 @@ declare const Definitions: readonly [Schema.Struct<{
11174
11687
  readonly version: Schema.Int;
11175
11688
  }>>, never, never>;
11176
11689
  readonly data: Schema.Struct<{
11177
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
11178
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
11690
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
11691
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
11179
11692
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
11180
11693
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
11181
11694
  };
11182
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
11695
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
11183
11696
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
11184
11697
  };
11185
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
11698
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
11186
11699
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
11187
11700
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
11188
11701
  };
11189
- readonly partIndex: Schema.Int;
11190
- readonly delta: Schema.String;
11702
+ partIndex: Schema.Int;
11703
+ offset: Schema.Int;
11704
+ delta: Schema.String;
11191
11705
  }>;
11192
11706
  }> & {
11193
11707
  type: "session.llm.thinking.delta";
@@ -11196,20 +11710,21 @@ declare const Definitions: readonly [Schema.Struct<{
11196
11710
  readonly aggregate: string;
11197
11711
  };
11198
11712
  data: Schema.Struct<{
11199
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
11200
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
11713
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
11714
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
11201
11715
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
11202
11716
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
11203
11717
  };
11204
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
11718
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
11205
11719
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
11206
11720
  };
11207
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
11721
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
11208
11722
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
11209
11723
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
11210
11724
  };
11211
- readonly partIndex: Schema.Int;
11212
- readonly delta: Schema.String;
11725
+ partIndex: Schema.Int;
11726
+ offset: Schema.Int;
11727
+ delta: Schema.String;
11213
11728
  }>;
11214
11729
  }, Schema.Struct<{
11215
11730
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -15277,14 +15792,15 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
15277
15792
  readonly version: Schema.Int;
15278
15793
  }>>, never, never>;
15279
15794
  readonly data: Schema.Struct<{
15280
- timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
15281
- sessionId: Schema.brand<Schema.String, "Session.ID"> & {
15795
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
15796
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
15282
15797
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
15283
15798
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
15284
15799
  };
15285
- threadId: Schema.brand<Schema.String, "Thread.ID"> & {
15800
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
15286
15801
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
15287
15802
  };
15803
+ readonly resumed: Schema.Boolean;
15288
15804
  }>;
15289
15805
  }> & {
15290
15806
  type: "session.execution.started";
@@ -15293,14 +15809,15 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
15293
15809
  readonly aggregate: string;
15294
15810
  };
15295
15811
  data: Schema.Struct<{
15296
- timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
15297
- sessionId: Schema.brand<Schema.String, "Session.ID"> & {
15812
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
15813
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
15298
15814
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
15299
15815
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
15300
15816
  };
15301
- threadId: Schema.brand<Schema.String, "Thread.ID"> & {
15817
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
15302
15818
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
15303
15819
  };
15820
+ readonly resumed: Schema.Boolean;
15304
15821
  }>;
15305
15822
  }, Schema.Struct<{
15306
15823
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -15418,7 +15935,7 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
15418
15935
  readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
15419
15936
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
15420
15937
  };
15421
- readonly reason: Schema.Literals<readonly ["user", "shutdown"]>;
15938
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
15422
15939
  }>;
15423
15940
  }> & {
15424
15941
  type: "session.execution.interrupted";
@@ -15435,7 +15952,7 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
15435
15952
  readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
15436
15953
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
15437
15954
  };
15438
- readonly reason: Schema.Literals<readonly ["user", "shutdown"]>;
15955
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
15439
15956
  }>;
15440
15957
  }, Schema.Struct<{
15441
15958
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -17800,20 +18317,21 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
17800
18317
  readonly version: Schema.Int;
17801
18318
  }>>, never, never>;
17802
18319
  readonly data: Schema.Struct<{
17803
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
17804
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
18320
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
18321
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
17805
18322
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
17806
18323
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
17807
18324
  };
17808
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
18325
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
17809
18326
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
17810
18327
  };
17811
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
18328
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
17812
18329
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
17813
18330
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
17814
18331
  };
17815
- readonly partIndex: Schema.Int;
17816
- readonly delta: Schema.String;
18332
+ partIndex: Schema.Int;
18333
+ offset: Schema.Int;
18334
+ delta: Schema.String;
17817
18335
  }>;
17818
18336
  }> & {
17819
18337
  type: "session.llm.text.delta";
@@ -17822,20 +18340,21 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
17822
18340
  readonly aggregate: string;
17823
18341
  };
17824
18342
  data: Schema.Struct<{
17825
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
17826
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
18343
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
18344
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
17827
18345
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
17828
18346
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
17829
18347
  };
17830
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
18348
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
17831
18349
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
17832
18350
  };
17833
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
18351
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
17834
18352
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
17835
18353
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
17836
18354
  };
17837
- readonly partIndex: Schema.Int;
17838
- readonly delta: Schema.String;
18355
+ partIndex: Schema.Int;
18356
+ offset: Schema.Int;
18357
+ delta: Schema.String;
17839
18358
  }>;
17840
18359
  }, Schema.Struct<{
17841
18360
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -17957,20 +18476,21 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
17957
18476
  readonly version: Schema.Int;
17958
18477
  }>>, never, never>;
17959
18478
  readonly data: Schema.Struct<{
17960
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
17961
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
18479
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
18480
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
17962
18481
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
17963
18482
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
17964
18483
  };
17965
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
18484
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
17966
18485
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
17967
18486
  };
17968
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
18487
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
17969
18488
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
17970
18489
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
17971
18490
  };
17972
- readonly partIndex: Schema.Int;
17973
- readonly delta: Schema.String;
18491
+ partIndex: Schema.Int;
18492
+ offset: Schema.Int;
18493
+ delta: Schema.String;
17974
18494
  }>;
17975
18495
  }> & {
17976
18496
  type: "session.llm.thinking.delta";
@@ -17979,20 +18499,21 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
17979
18499
  readonly aggregate: string;
17980
18500
  };
17981
18501
  data: Schema.Struct<{
17982
- readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
17983
- readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
18502
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
18503
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
17984
18504
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
17985
18505
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
17986
18506
  };
17987
- readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
18507
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
17988
18508
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
17989
18509
  };
17990
- readonly messageId: Schema.brand<Schema.String, "Message.ID"> & {
18510
+ messageId: Schema.brand<Schema.String, "Message.ID"> & {
17991
18511
  create: () => string & import("effect/Brand").Brand<"Message.ID">;
17992
18512
  from: (id: string) => string & import("effect/Brand").Brand<"Message.ID">;
17993
18513
  };
17994
- readonly partIndex: Schema.Int;
17995
- readonly delta: Schema.String;
18514
+ partIndex: Schema.Int;
18515
+ offset: Schema.Int;
18516
+ delta: Schema.String;
17996
18517
  }>;
17997
18518
  }, Schema.Struct<{
17998
18519
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -21944,19 +22465,242 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
21944
22465
  }>>, Schema.optionalKey<Schema.brand<Schema.String, "Session.ID"> & {
21945
22466
  ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
21946
22467
  create: () => string & import("effect/Brand").Brand<"Session.ID">;
21947
- }>, never, never>;
21948
- readonly threadId: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Thread.ID"> & {
21949
- create: () => string & import("effect/Brand").Brand<"Thread.ID">;
21950
- }>>, Schema.optionalKey<Schema.brand<Schema.String, "Thread.ID"> & {
22468
+ }>, never, never>;
22469
+ readonly threadId: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Thread.ID"> & {
22470
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
22471
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Thread.ID"> & {
22472
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
22473
+ }>, never, never>;
22474
+ }>;
22475
+ }, Schema.Struct<{
22476
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
22477
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
22478
+ };
22479
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
22480
+ readonly type: Schema.Literal<"mcp.server.status">;
22481
+ readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
22482
+ readonly aggregateId: Schema.String;
22483
+ readonly seq: Schema.Int;
22484
+ readonly version: Schema.Int;
22485
+ }>>>, Schema.optionalKey<Schema.Struct<{
22486
+ readonly aggregateId: Schema.String;
22487
+ readonly seq: Schema.Int;
22488
+ readonly version: Schema.Int;
22489
+ }>>, never, never>;
22490
+ readonly data: Schema.Struct<{
22491
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
22492
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
22493
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
22494
+ create: () => string & import("effect/Brand").Brand<"Session.ID">;
22495
+ };
22496
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
22497
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
22498
+ };
22499
+ readonly status: Schema.Union<readonly [Schema.Struct<{
22500
+ readonly server: Schema.String;
22501
+ readonly state: Schema.Literals<readonly ["connected"]>;
22502
+ readonly tools: Schema.$Array<Schema.String>;
22503
+ readonly skipped: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
22504
+ readonly names: Schema.$Array<Schema.String>;
22505
+ readonly unnamed: Schema.Int;
22506
+ }>>>, Schema.optionalKey<Schema.Struct<{
22507
+ readonly names: Schema.$Array<Schema.String>;
22508
+ readonly unnamed: Schema.Int;
22509
+ }>>, never, never>;
22510
+ }>, Schema.Struct<{
22511
+ readonly server: Schema.String;
22512
+ readonly state: Schema.Literals<readonly ["failed", "authenticate"]>;
22513
+ readonly error: Schema.String;
22514
+ }>, Schema.Struct<{
22515
+ readonly server: Schema.String;
22516
+ readonly state: Schema.Literals<readonly ["disconnected"]>;
22517
+ readonly error: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
22518
+ }>, Schema.Struct<{
22519
+ readonly server: Schema.String;
22520
+ readonly state: Schema.Literals<readonly ["connecting", "disabled"]>;
22521
+ }>]>;
22522
+ }>;
22523
+ }> & {
22524
+ type: "mcp.server.status";
22525
+ durable?: {
22526
+ readonly version: number;
22527
+ readonly aggregate: string;
22528
+ };
22529
+ data: Schema.Struct<{
22530
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
22531
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
22532
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
22533
+ create: () => string & import("effect/Brand").Brand<"Session.ID">;
22534
+ };
22535
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
22536
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
22537
+ };
22538
+ readonly status: Schema.Union<readonly [Schema.Struct<{
22539
+ readonly server: Schema.String;
22540
+ readonly state: Schema.Literals<readonly ["connected"]>;
22541
+ readonly tools: Schema.$Array<Schema.String>;
22542
+ readonly skipped: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
22543
+ readonly names: Schema.$Array<Schema.String>;
22544
+ readonly unnamed: Schema.Int;
22545
+ }>>>, Schema.optionalKey<Schema.Struct<{
22546
+ readonly names: Schema.$Array<Schema.String>;
22547
+ readonly unnamed: Schema.Int;
22548
+ }>>, never, never>;
22549
+ }>, Schema.Struct<{
22550
+ readonly server: Schema.String;
22551
+ readonly state: Schema.Literals<readonly ["failed", "authenticate"]>;
22552
+ readonly error: Schema.String;
22553
+ }>, Schema.Struct<{
22554
+ readonly server: Schema.String;
22555
+ readonly state: Schema.Literals<readonly ["disconnected"]>;
22556
+ readonly error: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
22557
+ }>, Schema.Struct<{
22558
+ readonly server: Schema.String;
22559
+ readonly state: Schema.Literals<readonly ["connecting", "disabled"]>;
22560
+ }>]>;
22561
+ }>;
22562
+ }];
22563
+ declare const DurableDefinitions: readonly [Schema.Struct<{
22564
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
22565
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
22566
+ };
22567
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
22568
+ readonly type: Schema.Literal<"session.execution.started">;
22569
+ readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
22570
+ readonly aggregateId: Schema.String;
22571
+ readonly seq: Schema.Int;
22572
+ readonly version: Schema.Int;
22573
+ }>>>, Schema.optionalKey<Schema.Struct<{
22574
+ readonly aggregateId: Schema.String;
22575
+ readonly seq: Schema.Int;
22576
+ readonly version: Schema.Int;
22577
+ }>>, never, never>;
22578
+ readonly data: Schema.Struct<{
22579
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
22580
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
22581
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
22582
+ create: () => string & import("effect/Brand").Brand<"Session.ID">;
22583
+ };
22584
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
22585
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
22586
+ };
22587
+ readonly resumed: Schema.Boolean;
22588
+ }>;
22589
+ }> & {
22590
+ type: "session.execution.started";
22591
+ durable?: {
22592
+ readonly version: number;
22593
+ readonly aggregate: string;
22594
+ };
22595
+ data: Schema.Struct<{
22596
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
22597
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
22598
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
22599
+ create: () => string & import("effect/Brand").Brand<"Session.ID">;
22600
+ };
22601
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
22602
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
22603
+ };
22604
+ readonly resumed: Schema.Boolean;
22605
+ }>;
22606
+ }, Schema.Struct<{
22607
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
22608
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
22609
+ };
22610
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
22611
+ readonly type: Schema.Literal<"session.execution.succeeded">;
22612
+ readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
22613
+ readonly aggregateId: Schema.String;
22614
+ readonly seq: Schema.Int;
22615
+ readonly version: Schema.Int;
22616
+ }>>>, Schema.optionalKey<Schema.Struct<{
22617
+ readonly aggregateId: Schema.String;
22618
+ readonly seq: Schema.Int;
22619
+ readonly version: Schema.Int;
22620
+ }>>, never, never>;
22621
+ readonly data: Schema.Struct<{
22622
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
22623
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
22624
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
22625
+ create: () => string & import("effect/Brand").Brand<"Session.ID">;
22626
+ };
22627
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
22628
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
22629
+ };
22630
+ }>;
22631
+ }> & {
22632
+ type: "session.execution.succeeded";
22633
+ durable?: {
22634
+ readonly version: number;
22635
+ readonly aggregate: string;
22636
+ };
22637
+ data: Schema.Struct<{
22638
+ timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
22639
+ sessionId: Schema.brand<Schema.String, "Session.ID"> & {
22640
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
22641
+ create: () => string & import("effect/Brand").Brand<"Session.ID">;
22642
+ };
22643
+ threadId: Schema.brand<Schema.String, "Thread.ID"> & {
22644
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
22645
+ };
22646
+ }>;
22647
+ }, Schema.Struct<{
22648
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
22649
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
22650
+ };
22651
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
22652
+ readonly type: Schema.Literal<"session.execution.failed">;
22653
+ readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
22654
+ readonly aggregateId: Schema.String;
22655
+ readonly seq: Schema.Int;
22656
+ readonly version: Schema.Int;
22657
+ }>>>, Schema.optionalKey<Schema.Struct<{
22658
+ readonly aggregateId: Schema.String;
22659
+ readonly seq: Schema.Int;
22660
+ readonly version: Schema.Int;
22661
+ }>>, never, never>;
22662
+ readonly data: Schema.Struct<{
22663
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
22664
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
22665
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
22666
+ create: () => string & import("effect/Brand").Brand<"Session.ID">;
22667
+ };
22668
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
22669
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
22670
+ };
22671
+ readonly error: Schema.Struct<{
22672
+ readonly type: Schema.String;
22673
+ readonly message: Schema.String;
22674
+ readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
22675
+ }>;
22676
+ }>;
22677
+ }> & {
22678
+ type: "session.execution.failed";
22679
+ durable?: {
22680
+ readonly version: number;
22681
+ readonly aggregate: string;
22682
+ };
22683
+ data: Schema.Struct<{
22684
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
22685
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
22686
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
22687
+ create: () => string & import("effect/Brand").Brand<"Session.ID">;
22688
+ };
22689
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
21951
22690
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
21952
- }>, never, never>;
22691
+ };
22692
+ readonly error: Schema.Struct<{
22693
+ readonly type: Schema.String;
22694
+ readonly message: Schema.String;
22695
+ readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
22696
+ }>;
21953
22697
  }>;
21954
22698
  }, Schema.Struct<{
21955
22699
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
21956
22700
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
21957
22701
  };
21958
22702
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
21959
- readonly type: Schema.Literal<"mcp.server.status">;
22703
+ readonly type: Schema.Literal<"session.execution.interrupted">;
21960
22704
  readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
21961
22705
  readonly aggregateId: Schema.String;
21962
22706
  readonly seq: Schema.Int;
@@ -21975,32 +22719,10 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
21975
22719
  readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
21976
22720
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
21977
22721
  };
21978
- readonly status: Schema.Union<readonly [Schema.Struct<{
21979
- readonly server: Schema.String;
21980
- readonly state: Schema.Literals<readonly ["connected"]>;
21981
- readonly tools: Schema.$Array<Schema.String>;
21982
- readonly skipped: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
21983
- readonly names: Schema.$Array<Schema.String>;
21984
- readonly unnamed: Schema.Int;
21985
- }>>>, Schema.optionalKey<Schema.Struct<{
21986
- readonly names: Schema.$Array<Schema.String>;
21987
- readonly unnamed: Schema.Int;
21988
- }>>, never, never>;
21989
- }>, Schema.Struct<{
21990
- readonly server: Schema.String;
21991
- readonly state: Schema.Literals<readonly ["failed", "authenticate"]>;
21992
- readonly error: Schema.String;
21993
- }>, Schema.Struct<{
21994
- readonly server: Schema.String;
21995
- readonly state: Schema.Literals<readonly ["disconnected"]>;
21996
- readonly error: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
21997
- }>, Schema.Struct<{
21998
- readonly server: Schema.String;
21999
- readonly state: Schema.Literals<readonly ["connecting", "disabled"]>;
22000
- }>]>;
22722
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
22001
22723
  }>;
22002
22724
  }> & {
22003
- type: "mcp.server.status";
22725
+ type: "session.execution.interrupted";
22004
22726
  durable?: {
22005
22727
  readonly version: number;
22006
22728
  readonly aggregate: string;
@@ -22014,32 +22736,9 @@ declare const PublicDefinitions: readonly [Schema.Struct<{
22014
22736
  readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
22015
22737
  create: () => string & import("effect/Brand").Brand<"Thread.ID">;
22016
22738
  };
22017
- readonly status: Schema.Union<readonly [Schema.Struct<{
22018
- readonly server: Schema.String;
22019
- readonly state: Schema.Literals<readonly ["connected"]>;
22020
- readonly tools: Schema.$Array<Schema.String>;
22021
- readonly skipped: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
22022
- readonly names: Schema.$Array<Schema.String>;
22023
- readonly unnamed: Schema.Int;
22024
- }>>>, Schema.optionalKey<Schema.Struct<{
22025
- readonly names: Schema.$Array<Schema.String>;
22026
- readonly unnamed: Schema.Int;
22027
- }>>, never, never>;
22028
- }>, Schema.Struct<{
22029
- readonly server: Schema.String;
22030
- readonly state: Schema.Literals<readonly ["failed", "authenticate"]>;
22031
- readonly error: Schema.String;
22032
- }>, Schema.Struct<{
22033
- readonly server: Schema.String;
22034
- readonly state: Schema.Literals<readonly ["disconnected"]>;
22035
- readonly error: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
22036
- }>, Schema.Struct<{
22037
- readonly server: Schema.String;
22038
- readonly state: Schema.Literals<readonly ["connecting", "disabled"]>;
22039
- }>]>;
22739
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
22040
22740
  }>;
22041
- }];
22042
- declare const DurableDefinitions: readonly [Schema.Struct<{
22741
+ }, Schema.Struct<{
22043
22742
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
22044
22743
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
22045
22744
  };
@@ -22868,6 +23567,55 @@ declare const DurableDefinitions: readonly [Schema.Struct<{
22868
23567
  };
22869
23568
  readonly recovered: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
22870
23569
  }>;
23570
+ }, Schema.Struct<{
23571
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
23572
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
23573
+ };
23574
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
23575
+ readonly type: Schema.Literal<"session.retry.scheduled">;
23576
+ readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
23577
+ readonly aggregateId: Schema.String;
23578
+ readonly seq: Schema.Int;
23579
+ readonly version: Schema.Int;
23580
+ }>>>, Schema.optionalKey<Schema.Struct<{
23581
+ readonly aggregateId: Schema.String;
23582
+ readonly seq: Schema.Int;
23583
+ readonly version: Schema.Int;
23584
+ }>>, never, never>;
23585
+ readonly data: Schema.Struct<{
23586
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
23587
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
23588
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
23589
+ create: () => string & import("effect/Brand").Brand<"Session.ID">;
23590
+ };
23591
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
23592
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
23593
+ };
23594
+ readonly attempt: Schema.Int;
23595
+ readonly maxRetries: Schema.Int;
23596
+ readonly delayMs: Schema.Int;
23597
+ readonly message: Schema.String;
23598
+ }>;
23599
+ }> & {
23600
+ type: "session.retry.scheduled";
23601
+ durable?: {
23602
+ readonly version: number;
23603
+ readonly aggregate: string;
23604
+ };
23605
+ data: Schema.Struct<{
23606
+ readonly timestamp: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
23607
+ readonly sessionId: Schema.brand<Schema.String, "Session.ID"> & {
23608
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Session.ID">;
23609
+ create: () => string & import("effect/Brand").Brand<"Session.ID">;
23610
+ };
23611
+ readonly threadId: Schema.brand<Schema.String, "Thread.ID"> & {
23612
+ create: () => string & import("effect/Brand").Brand<"Thread.ID">;
23613
+ };
23614
+ readonly attempt: Schema.Int;
23615
+ readonly maxRetries: Schema.Int;
23616
+ readonly delayMs: Schema.Int;
23617
+ readonly message: Schema.String;
23618
+ }>;
22871
23619
  }, Schema.Struct<{
22872
23620
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
22873
23621
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
@@ -27872,7 +28620,7 @@ declare const DurableDefinitions: readonly [Schema.Struct<{
27872
28620
  }>;
27873
28621
  }];
27874
28622
  declare namespace thread_d_exports {
27875
- export { AppendEntry, AppendPart, EndAssistant, EntryNotFoundError, ForkError, ForkInput$1 as ForkInput, Forked, HydratedEntry, InsertThread, Interface$19 as Interface, InvalidEntryDataError, ProgressAssistant, ProgressChange, ReplaceAssistant, Service$18 as Service, SettleToolCall, thread_d_exports as Thread, ThreadNotFoundError, layer$20 as layer };
28623
+ export { AppendEntry, AppendPart, EndAssistant, EntryNotFoundError, ForkError, ForkInput$1 as ForkInput, Forked, HydratedEntry, InsertThread, Interface$19 as Interface, InvalidEntryDataError, LinePageInput, ProgressAssistant, ProgressChange, ReplaceAssistant, RunChange, Service$18 as Service, SettleToolCall, thread_d_exports as Thread, ThreadNotFoundError, layer$20 as layer };
27876
28624
  }
27877
28625
  declare const ThreadNotFoundError_base: Schema.Class<ThreadNotFoundError, Schema.TaggedStruct<"ThreadNotFoundError", {
27878
28626
  readonly threadId: Schema.String;
@@ -27978,9 +28726,29 @@ interface InsertThread {
27978
28726
  readonly title?: string;
27979
28727
  readonly seq: number;
27980
28728
  }
28729
+ /** One step of a thread's run lifecycle, from the event that projects it. */
28730
+ type RunChange = {
28731
+ readonly _tag: "started";
28732
+ } | {
28733
+ readonly _tag: "running";
28734
+ } | {
28735
+ readonly _tag: "ended";
28736
+ readonly outcome: RunOutcome;
28737
+ readonly error?: RunError$1;
28738
+ };
27981
28739
  interface HydratedEntry {
27982
28740
  readonly entry: EntryRow;
27983
28741
  readonly parts: ReadonlyArray<EntryPartRow>;
28742
+ /** Bytes of its parts' stored `data`. */
28743
+ readonly size: number;
28744
+ }
28745
+ interface LinePageInput {
28746
+ readonly threadId: ID$3;
28747
+ /** Only entries with a lower seq; absent starts at the newest. */
28748
+ readonly before?: number;
28749
+ /** Bytes by `size`; the newest entry is always read, whatever its size. */
28750
+ readonly budget: number;
28751
+ readonly limit: number;
27984
28752
  }
27985
28753
  interface Interface$19 {
27986
28754
  readonly get: (threadId: string) => Effect.Effect<Option.Option<ThreadRow>>;
@@ -27989,11 +28757,19 @@ interface Interface$19 {
27989
28757
  /** Threads newest first: of one session, or of the whole database. */
27990
28758
  readonly list: (sessionId?: ID$4) => Effect.Effect<ReadonlyArray<ThreadRow>>;
27991
28759
  readonly entry: (entryId: string) => Effect.Effect<Option.Option<HydratedEntry>>;
28760
+ /** Where the thread's inherited line ends: its origin entry's committed seq; none when it inherits nothing. */
28761
+ readonly cut: (threadId: string) => Effect.Effect<Option.Option<number>>;
27992
28762
  /**
27993
28763
  * The thread's line: its own entries, then its source's through the fork entry, recursively, in
27994
28764
  * seq order. Every state is included; context assembly drops what is not committed.
27995
28765
  */
27996
28766
  readonly line: (threadId: ID$3) => Effect.Effect<ReadonlyArray<HydratedEntry>>;
28767
+ /**
28768
+ * One page of the conversation in the thread's line (user and assistant entries, inherited ones
28769
+ * included), newest first: past `before`, up to `limit` entries, stopping once `budget` bytes
28770
+ * are spent.
28771
+ */
28772
+ readonly linePage: (input: LinePageInput) => Effect.Effect<ReadonlyArray<HydratedEntry>>;
27997
28773
  /** The thread's open draft, if a run left one. */
27998
28774
  readonly draft: (threadId: ID$3) => Effect.Effect<Option.Option<HydratedEntry>>;
27999
28775
  /** Unsettled toolCall parts of the thread's own entries (crash recovery / live status). */
@@ -28044,6 +28820,13 @@ interface Interface$19 {
28044
28820
  readonly idle: (threadId: ID$3) => Effect.Effect<void>;
28045
28821
  /** Root threads with a run left unfinished, oldest first. */
28046
28822
  readonly unfinished: Effect.Effect<ReadonlyArray<ThreadRow>>;
28823
+ /**
28824
+ * Projector-only: the `run_*` columns, at the time `at` of the event that changed them. The one
28825
+ * writer of those columns.
28826
+ */
28827
+ readonly projectRun: (threadId: ID$3, at: DateTime.Utc, change: RunChange) => Effect.Effect<void>;
28828
+ /** Threads whose stored run is not idle: at startup, the runs a dead process left open. */
28829
+ readonly open: Effect.Effect<ReadonlyArray<ThreadRow>>;
28047
28830
  /** Set or clear (null) the bookmark label on an entry of the thread. */
28048
28831
  readonly setLabel: (input: {
28049
28832
  threadId: ID$3;
@@ -28053,7 +28836,7 @@ interface Interface$19 {
28053
28836
  }
28054
28837
  declare const Service_base$16: Context.ServiceClass<Service$18, "@codeworksh/harness/thread/thread/Service", Interface$19>;
28055
28838
  declare class Service$18 extends Service_base$16 {}
28056
- declare const layer$20: Layer.Layer<Service$18, never, Service$19 | Service$20 | SqlClient.SqlClient>;
28839
+ declare const layer$20: Layer.Layer<Service$18, never, Service$21 | Service$19 | Service$20 | SqlClient.SqlClient>;
28057
28840
  import * as import__codeworksh_plugin_project from "@codeworksh/plugin/project";
28058
28841
  import * as import__codeworksh_plugin_schema from "@codeworksh/plugin/schema";
28059
28842
  import * as import__codeworksh_plugin_space from "@codeworksh/plugin/space";
@@ -28182,9 +28965,9 @@ interface Interface$18 {
28182
28965
  }
28183
28966
  declare const Service_base$15: Context.ServiceClass<Service$17, "@codeworksh/harness/session/session/Service", Interface$18>;
28184
28967
  declare class Service$17 extends Service_base$15 {}
28185
- declare const layer$19: Layer.Layer<Service$17, never, Service$19 | Service$20 | Service$18 | SqlClient.SqlClient>;
28968
+ declare const layer$19: Layer.Layer<Service$17, never, Service$21 | Service$19 | Service$20 | Service$18 | SqlClient.SqlClient>;
28186
28969
  /** The session store with the thread and document stores it is built on. */
28187
- declare const storeLayer: Layer.Layer<Service$20 | Service$18 | Service$17, never, Service$19 | SqlClient.SqlClient>;
28970
+ declare const storeLayer: Layer.Layer<Service$20 | Service$18 | Service$17, never, Service$21 | Service$19 | SqlClient.SqlClient>;
28188
28971
  //#endregion
28189
28972
  //#region src/context/errors.d.ts
28190
28973
  declare const ContextDecodeError_base: Schema.Class<ContextDecodeError, Schema.TaggedStruct<"ContextDecodeError", {
@@ -28284,8 +29067,8 @@ interface Options$6 {
28284
29067
  readonly transportIdleTimeToLive?: Duration.Input;
28285
29068
  readonly provisioningTimeoutMs?: number;
28286
29069
  }
28287
- declare const make$5: (options: Options$6) => Effect.Effect<Interface$17, errors_d_exports.SandboxDriverRegistrationError, Registry | import("effect/Scope").Scope | SqlClient.SqlClient>;
28288
- declare const layer$17: (options: Options$6) => Layer.Layer<Controller, errors_d_exports.SandboxDriverRegistrationError, Registry | SqlClient.SqlClient>;
29070
+ declare const make$5: (options: Options$6) => Effect.Effect<Interface$17, errors_d_exports.SandboxDriverRegistrationError, Registry | import("effect/Scope").Scope | Service$21 | SqlClient.SqlClient>;
29071
+ declare const layer$17: (options: Options$6) => Layer.Layer<Controller, errors_d_exports.SandboxDriverRegistrationError, Registry | Service$21 | SqlClient.SqlClient>;
28289
29072
  //#endregion
28290
29073
  //#region src/sandbox/sandbox.d.ts
28291
29074
  /**
@@ -28406,7 +29189,7 @@ declare const layer$15: Layer.Layer<Service$15, never, import("@codeworksh/plugi
28406
29189
  declare const layerWith$4: <E, RIn>(sandbox: Sandbox.Sandbox<E, RIn>) => Layer.Layer<Service$15, E, RIn>;
28407
29190
  declare const defaultLayer$4: (rootPath: string) => Layer.Layer<Service$15, never, never>;
28408
29191
  declare namespace space_d_exports {
28409
- export { AbsorbInput, Interface$14 as Interface, RehomeInput, Service$14 as Service, space_d_exports as Space, archiveEnv, fromRow, id, layer$14 as layer, layerWith$3 as layerWith };
29192
+ export { AbsorbInput, Interface$14 as Interface, RehomeInput, Service$14 as Service, space_d_exports as Space, archiveEnv, fromRow$1 as fromRow, id, layer$14 as layer, layerWith$3 as layerWith };
28410
29193
  }
28411
29194
  /** `hash(env, location)` — no project component (D-SPACEID). */
28412
29195
  declare const id: (env: instance_d_exports.SandboxInstance.ID, location: string) => schema_d_exports$8.SpaceSchema.ID;
@@ -28437,16 +29220,16 @@ interface Interface$14 {
28437
29220
  declare const Service_base$12: Context.ServiceClass<Service$14, "@codeworksh/harness/space/space/Service", Interface$14>;
28438
29221
  declare class Service$14 extends Service_base$12 {}
28439
29222
  /** Row → public shape. Shared with `Session.space`, which reads the same row through a join. */
28440
- declare const fromRow: (row: SpaceRow) => schema_d_exports$8.SpaceSchema.Info;
29223
+ declare const fromRow$1: (row: SpaceRow) => schema_d_exports$8.SpaceSchema.Info;
28441
29224
  /**
28442
29225
  * Archive every space of an env, then every touched project left without an
28443
- * active space in any env (§5.5). Requires only `SqlClient` so the sandbox
28444
- * controller can run it inside its destroy tombstone transaction (D-ENV).
29226
+ * active space in any env (§5.5). Requires only `SqlClient` and `Store` so the
29227
+ * sandbox controller can run it inside its destroy tombstone transaction (D-ENV).
28445
29228
  * Write-first so a DEFERRED transaction takes the write lock immediately.
28446
29229
  */
28447
- declare const archiveEnv: (env: string & import("effect/Brand").Brand<"SandboxInstance.ID">) => Effect.Effect<void, never, SqlClient.SqlClient>;
28448
- declare const layer$14: Layer.Layer<Service$14, never, io_d_exports.SandboxIO.Current | import("@codeworksh/plugin/sandbox/filesystem").Service | SqlClient.SqlClient>;
28449
- declare const layerWith$3: <E, RIn>(sandbox: Sandbox.Sandbox<E, RIn>) => Layer.Layer<Service$14, E, RIn | SqlClient.SqlClient>;
29230
+ declare const archiveEnv: (env: string & import("effect/Brand").Brand<"SandboxInstance.ID">) => Effect.Effect<void, never, Service$21 | SqlClient.SqlClient>;
29231
+ declare const layer$14: Layer.Layer<Service$14, never, io_d_exports.SandboxIO.Current | import("@codeworksh/plugin/sandbox/filesystem").Service | Service$21 | SqlClient.SqlClient>;
29232
+ declare const layerWith$3: <E, RIn>(sandbox: Sandbox.Sandbox<E, RIn>) => Layer.Layer<Service$14, E, RIn | Service$21 | SqlClient.SqlClient>;
28450
29233
  declare namespace worktree_d_exports {
28451
29234
  export { Entry$2 as Entry, Input$2 as Input, Interface$13 as Interface, Service$13 as Service, worktree_d_exports as Worktree, WorktreeError, defaultLayer$3 as defaultLayer, layer$13 as layer, layerWith$2 as layerWith };
28452
29235
  }
@@ -28507,7 +29290,7 @@ interface Interface$12 {
28507
29290
  }
28508
29291
  declare const Service_base$10: Context.ServiceClass<Service$12, "@codeworksh/harness/project/project/Service", Interface$12>;
28509
29292
  declare class Service$12 extends Service_base$10 {}
28510
- declare const layer$12: Layer.Layer<Service$12, never, io_d_exports.SandboxIO.Current | import("@codeworksh/plugin/sandbox/filesystem").Service | Service$14 | Service$15 | Service$13 | SqlClient.SqlClient>;
29293
+ declare const layer$12: Layer.Layer<Service$12, never, io_d_exports.SandboxIO.Current | import("@codeworksh/plugin/sandbox/filesystem").Service | Service$21 | Service$14 | Service$15 | Service$13 | SqlClient.SqlClient>;
28511
29294
  declare const ProjectNotFoundError_base: Schema.Class<ProjectNotFoundError, Schema.TaggedStruct<"ProjectNotFoundError", {
28512
29295
  readonly projectId: Schema.String;
28513
29296
  }>, import("effect/Cause").YieldableError>;
@@ -28516,9 +29299,9 @@ declare class ProjectNotFoundError extends ProjectNotFoundError_base {}
28516
29299
  declare const rename: (input: {
28517
29300
  readonly projectId: string;
28518
29301
  readonly name: string;
28519
- }) => Effect.Effect<schema_d_exports$10.ProjectSchema.Info, ProjectNotFoundError, SqlClient.SqlClient>;
29302
+ }) => Effect.Effect<schema_d_exports$10.ProjectSchema.Info, ProjectNotFoundError, Service$21 | SqlClient.SqlClient>;
28520
29303
  /** Takes an assembled sandbox — local or remote — not a local backend. */
28521
- declare const layerWith$1: <E, RIn>(sandbox: Sandbox.Sandbox<E, RIn>) => Layer.Layer<Service$12, E | import("effect/Config").ConfigError, Exclude<RIn, SqlClient.SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient>>;
29304
+ declare const layerWith$1: <E, RIn>(sandbox: Sandbox.Sandbox<E, RIn>) => Layer.Layer<Service$12, E | import("effect/Config").ConfigError, Exclude<RIn, Service$21 | SqlClient.SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient>>;
28522
29305
  declare const defaultLayer$2: (path: string) => Layer.Layer<Service$12, import("effect/Config").ConfigError, never>;
28523
29306
  declare namespace location_d_exports {
28524
29307
  export { DirectoryNotFoundError, Error, Info$5 as Info, Interface$11 as Interface, location_d_exports as Location, NotDirectoryError, Service$11 as Service, layer$11 as layer, layerMounted };
@@ -28529,7 +29312,7 @@ declare const layer$11: (options?: ResolveOptions) => Layer.Layer<Service, impor
28529
29312
  * folded in. What remains is exactly the mount and the database — for callers
28530
29313
  * that already hold both, such as the runner and `Session.create`.
28531
29314
  */
28532
- declare const layerMounted: (options?: ResolveOptions) => Layer.Layer<Service, import("@codeworksh/plugin/location").Error, io_d_exports.SandboxIO.Current | import("@codeworksh/plugin/sandbox/filesystem").Service | import("@codeworksh/plugin/sandbox/shell").Shell | import("effect/sql/SqlClient").SqlClient>;
29315
+ declare const layerMounted: (options?: ResolveOptions) => Layer.Layer<Service, import("@codeworksh/plugin/location").Error, io_d_exports.SandboxIO.Current | import("@codeworksh/plugin/sandbox/filesystem").Service | Service$21 | import("@codeworksh/plugin/sandbox/shell").Shell | import("effect/sql/SqlClient").SqlClient>;
28533
29316
  declare namespace global_d_exports {
28534
29317
  export { global_d_exports as Global, Interface$10 as Interface, Service$10 as Service, app, appConfigDir, authFile, defaultLayer$1 as defaultLayer, homeConfig, layer$10 as layer, layerWith, make$4 as make, resolve$3 as resolve };
28535
29318
  }
@@ -29728,7 +30511,7 @@ rebuild: (root: string | undefined, current: Pool) => Effect.Effect<Pool, {
29728
30511
  /** The view a session in `hostDir` runs from: its project root, or the process view. */
29729
30512
  viewOf?: (hostDir: string | undefined) => Effect.Effect<string | undefined>) => Layer.Layer<Service$5, never, Service$19 | Service$10 | Service$9 | Service$20 | Service$18 | Service$17 | Service$8 | Service$6 | Service$7>;
29730
30513
  declare namespace run_d_exports {
29731
- export { Interface$4 as Interface, LLMStreamError, ModelCatalogError, ModelNotFoundError, ProviderAuthenticationError, ProviderAuthorizationError, ProviderConfigurationError, ProviderContentPolicyError, ProviderError, ProviderFailureReason, ProviderInvalidRequestError, ProviderInvalidResponseError, ProviderModelUnavailableError, ProviderQuotaError, ProviderRateLimitError, ProviderTimeoutError, ProviderTransportError, ProviderUnavailableError, ProviderUnknownError, RunError, run_d_exports as Runner, SandboxDirectoryNotFoundError, Service$4 as Service };
30514
+ export { Interface$4 as Interface, LLMStreamError, ModelCatalogError, ModelNotFoundError, Outcome, ProviderAuthenticationError, ProviderAuthorizationError, ProviderConfigurationError, ProviderContentPolicyError, ProviderError, ProviderFailureReason, ProviderInvalidRequestError, ProviderInvalidResponseError, ProviderModelUnavailableError, ProviderQuotaError, ProviderRateLimitError, ProviderTimeoutError, ProviderTransportError, ProviderUnavailableError, ProviderUnknownError, RunError, run_d_exports as Runner, SandboxDirectoryNotFoundError, Service$4 as Service };
29732
30515
  }
29733
30516
  declare const SandboxDirectoryNotFoundError_base: Schema.Class<SandboxDirectoryNotFoundError, Schema.TaggedStruct<"Runner.SandboxDirectoryNotFoundError", {
29734
30517
  readonly threadId: Schema.String;
@@ -29895,6 +30678,8 @@ declare class LLMStreamError extends LLMStreamError_base {
29895
30678
  get message(): string;
29896
30679
  }
29897
30680
  type RunError = ModelCatalogError | ModelNotFoundError | ProviderError | LLMStreamError | ContextDecodeError | ContextEncodeError | SessionNotFoundError | ThreadNotFoundError | SessionLinkedSpaceNotFoundError | SettingsError | SnapshotError | SandboxDirectoryNotFoundError | errors_d_exports.SandboxMountError | filesystem_d_exports.SandboxFileSystem.FileSystemError;
30681
+ /** `ended`: the run published its own terminal, `session.run.failed`; `drained`: it left that to its execution. */
30682
+ type Outcome = "ended" | "drained";
29898
30683
  interface Interface$4 {
29899
30684
  /** Drains eligible durable work. Explicit runs perform one provider attempt even when no work is eligible. */
29900
30685
  readonly run: (input: {
@@ -29902,7 +30687,7 @@ interface Interface$4 {
29902
30687
  readonly force: boolean;
29903
30688
  /** Resuming a run a previous process left unfinished: its cut-off reply is answered first. */
29904
30689
  readonly recovered?: boolean;
29905
- }) => Effect.Effect<void, RunError, io_d_exports.SandboxIO.Provides | Service$11>;
30690
+ }) => Effect.Effect<Outcome, RunError, io_d_exports.SandboxIO.Provides | Service$11>;
29906
30691
  /**
29907
30692
  * Ends a run the server no longer resumes: settles what the dead process left of its reply,
29908
30693
  * records `session.run.failed` with `message`, and leaves the thread idle, its queue kept.
@@ -29910,7 +30695,7 @@ interface Interface$4 {
29910
30695
  readonly abandon: (input: {
29911
30696
  readonly threadId: ID$3;
29912
30697
  readonly message: string;
29913
- }) => Effect.Effect<void>;
30698
+ }) => Effect.Effect<Outcome>;
29914
30699
  }
29915
30700
  declare const Service_base$3: Context.ServiceClass<Service$4, "@codeworksh/harness/runner/run/Service", Interface$4>;
29916
30701
  declare class Service$4 extends Service_base$3 {}
@@ -30613,7 +31398,7 @@ declare const Admitted: Schema.Struct<{
30613
31398
  }>;
30614
31399
  interface Admitted extends Schema.Schema.Type<typeof Admitted> {}
30615
31400
  declare namespace inbox_d_exports {
30616
- export { AdmitInput, inbox_d_exports as Inbox, Interface$1 as Interface, LifecycleConflict, ProjectAdmittedInput, ProjectCancelledInput, ProjectPromptedInput, ProjectUpdatedInput, UpdatePatch, equivalent, make$2 as make };
31401
+ export { AdmitInput, inbox_d_exports as Inbox, Interface$1 as Interface, LifecycleConflict, ProjectAdmittedInput, ProjectCancelledInput, ProjectPromptedInput, ProjectUpdatedInput, UpdatePatch, equivalent, fromRow, make$2 as make };
30617
31402
  }
30618
31403
  declare const LifecycleConflict_base: Schema.Class<LifecycleConflict, Schema.TaggedStruct<"Inbox.LifecycleConflict", {
30619
31404
  readonly id: Schema.brand<Schema.String, "Message.ID"> & {
@@ -30630,6 +31415,7 @@ declare const LifecycleConflict_base: Schema.Class<LifecycleConflict, Schema.Tag
30630
31415
  * `promote*` then recover by reading the row that won.
30631
31416
  */
30632
31417
  declare class LifecycleConflict extends LifecycleConflict_base {}
31418
+ declare const fromRow: (row: InboxRow) => Admitted;
30633
31419
  /**
30634
31420
  * Whether a stored input carries the prompt the caller believes it admitted.
30635
31421
  * A retry that reuses an id with different content is a conflict, not an
@@ -30729,7 +31515,7 @@ declare const make$2: Effect.Effect<{
30729
31515
  hasPending: (threadId: string & import("effect/Brand").Brand<"Thread.ID">, delivery: "followUp" | "steer") => Effect.Effect<boolean, never, never>;
30730
31516
  promoteSteers: (threadId: string & import("effect/Brand").Brand<"Thread.ID">, cutoff: number) => Effect.Effect<number, never, never>;
30731
31517
  promoteFollowUp: (threadId: string & import("effect/Brand").Brand<"Thread.ID">) => Effect.Effect<boolean, never, never>;
30732
- }, never, Service$19 | SqlClient.SqlClient>;
31518
+ }, never, Service$21 | Service$19 | SqlClient.SqlClient>;
30733
31519
  declare namespace control_d_exports {
30734
31520
  export { control_d_exports as Control, Interface, PromptConflictError, PromptInput$1 as PromptInput, RESTART_LIMIT, ResolveError, Service$1 as Service, ThreadRef, layer$3 as layer };
30735
31521
  }
@@ -30806,6 +31592,12 @@ interface Interface {
30806
31592
  * run has settled.
30807
31593
  */
30808
31594
  readonly resumeUnfinished: Effect.Effect<void>;
31595
+ /**
31596
+ * Ends every stored run the last process left open with a durable `execution.interrupted`:
31597
+ * `shutdown` where it closed the run, `crash` where it died in it. Runs as the server starts,
31598
+ * before it accepts connections and before {@link resumeUnfinished}.
31599
+ */
31600
+ readonly sweep: Effect.Effect<void>;
30809
31601
  /** Prompts admitted but not yet in the conversation, steers and follow-ups, in admission order. */
30810
31602
  readonly pending: (threadId: ID$3) => Effect.Effect<ReadonlyArray<Admitted>>;
30811
31603
  /**
@@ -30819,15 +31611,15 @@ interface Interface {
30819
31611
  }
30820
31612
  declare const Service_base: Context.ServiceClass<Service$1, "@codeworksh/harness/control/Service", Interface>;
30821
31613
  declare class Service$1 extends Service_base {}
30822
- declare const layer$3: Layer.Layer<Service$1, never, Service$19 | Service$18 | Service$17 | Service$7 | Service$3 | import("effect/sql/SqlClient").SqlClient>;
31614
+ declare const layer$3: Layer.Layer<Service$1, never, Service$21 | Service$19 | Service$18 | Service$17 | Service$7 | Service$3 | import("effect/sql/SqlClient").SqlClient>;
30823
31615
  declare namespace db_d_exports {
30824
31616
  export { db_d_exports as Database, SqlClient$1 as SqlClient, SqlSchema$1 as SqlSchema, defaultLayer, layer$2 as layer, locationConfig, path, resolveDatabaseLocation };
30825
31617
  }
30826
- declare function layer$2(location: string): Layer.Layer<SqlClient.SqlClient | SqliteClient.SqliteClient, never, never>;
31618
+ declare function layer$2(location: string): Layer.Layer<Service$21 | SqlClient.SqlClient | SqliteClient.SqliteClient, never, never>;
30827
31619
  declare const locationConfig: Config.Config<string>;
30828
31620
  declare function resolveDatabaseLocation(configured: string, data: string): string;
30829
31621
  declare const path: (data?: string | undefined) => Effect.Effect<string, Config.ConfigError, never>;
30830
- declare const defaultLayer: Layer.Layer<SqlClient.SqlClient | SqliteClient.SqliteClient, Config.ConfigError, never>;
31622
+ declare const defaultLayer: Layer.Layer<Service$21 | SqlClient.SqlClient | SqliteClient.SqliteClient, Config.ConfigError, never>;
30831
31623
  declare namespace catalog_d_exports {
30832
31624
  export { Credential, Credentials, catalog_d_exports as ModelCatalog, Provider, RefreshError, Status, available, effective, entry, filename, fromSettings, layer$1 as layer, loadError, models, oauthCredentials, oauthStorage, providerToken, providers, refresh$1 as refresh, sync, ttlConfig };
30833
31625
  }
@@ -31448,7 +32240,7 @@ declare const make$1: (input: {
31448
32240
  terminal: Effect.Effect<Terminal, LLMStreamError, never>;
31449
32241
  }, never, Service$19>;
31450
32242
  declare namespace llm_d_exports {
31451
- export { Input, llm_d_exports as LLM, Open, OpenOptions, Request, RequestInput, ResolutionInput, Resolve, make, messageFailure, open, openWith, providerError, resolve$2 as resolve, run, runtimeOptions };
32243
+ export { Input, llm_d_exports as LLM, Open, OpenOptions, Request, RequestInput, ResolutionInput, Resolve, make, messageFailure, open$1 as open, openWith, providerError, resolve$2 as resolve, run, runtimeOptions };
31452
32244
  }
31453
32245
  interface Input {
31454
32246
  /** Also the provider session and prompt-cache key: fresh per thread, never inherited. */
@@ -31508,7 +32300,7 @@ type Resolve = (input: ResolutionInput) => Effect.Effect<Model$1.Info, ModelCata
31508
32300
  declare const resolve$2: Resolve;
31509
32301
  /** Start a provider stream using the model pinned by State. */
31510
32302
  declare const openWith: (options?: OpenOptions) => Open;
31511
- declare const open: Open;
32303
+ declare const open$1: Open;
31512
32304
  /**
31513
32305
  * Build a provider request from an opener. Tests use this with deterministic
31514
32306
  * aikit event streams; production uses `open` above.
@@ -31586,7 +32378,7 @@ interface Options$1 {
31586
32378
  /** How long an MCP server no running session holds stays open. Default: 10 minutes. */
31587
32379
  readonly mcpIdleTimeout?: Duration.Input;
31588
32380
  }
31589
- declare const layer: (options?: Options$1) => Layer.Layer<Controller | Credentials | Registry | Service$19 | Service$10 | Service$9 | Service$20 | Service$18 | Service$17 | Service$8 | Service$6 | Service$5 | Service$7 | Service$3 | Service$1 | Service$2 | SqlClient$1.SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient, import("effect/Config").ConfigError | EventRegistrationError | InstallError | LoadError | import("@codeworksh/plugin/sandbox/errors").SandboxDriverLoadError | import("@codeworksh/plugin/sandbox/errors").SandboxDriverRegistrationError | SettingsError | SourceError | StoreError, never>;
32381
+ declare const layer: (options?: Options$1) => Layer.Layer<Controller | Credentials | Registry | Service$21 | Service$19 | Service$10 | Service$9 | Service$20 | Service$18 | Service$17 | Service$8 | Service$6 | Service$5 | Service$7 | Service$3 | Service$1 | Service$2 | SqlClient$1.SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient, import("effect/Config").ConfigError | EventRegistrationError | InstallError | LoadError | import("@codeworksh/plugin/sandbox/errors").SandboxDriverLoadError | import("@codeworksh/plugin/sandbox/errors").SandboxDriverRegistrationError | SettingsError | SourceError | StoreError, never>;
31590
32382
  declare namespace sandbox_d_exports {
31591
32383
  export { CreateInput$1 as CreateInput, Driver, DriverInfo, Info$2 as Info, RegisterInput, sandbox_d_exports as Sandbox, instance_d_exports.SandboxInstance as SandboxInstance, Selection, create$2 as create, destroy, drivers, get$1 as get, list, refresh, register, resolve$1 as resolve, stop, wake };
31592
32384
  }
@@ -31637,7 +32429,7 @@ declare const wake: (id: string & import("effect/Brand").Brand<"SandboxInstance.
31637
32429
  declare const stop: (id: string & import("effect/Brand").Brand<"SandboxInstance.ID">) => Effect.Effect<instance_d_exports.SandboxInstance.Info, import("@codeworksh/plugin/sandbox/errors").SandboxStopError, Controller>;
31638
32430
  declare const destroy: (id: string & import("effect/Brand").Brand<"SandboxInstance.ID">) => Effect.Effect<void, import("@codeworksh/plugin/sandbox/errors").SandboxDestroyError, Controller>;
31639
32431
  declare namespace session_d_exports {
31640
- export { schema_d_exports$9.AbsolutePath as AbsolutePath, AttachInput, CreateInput, ForkInput, Handle, Info$1 as Info, ModelConfig, PromptInput, RelinkInput, RuntimeInput, session_d_exports as Session, schema_d_exports$3 as SessionMessageSchema, schema_d_exports$12 as SessionSchema, SystemPromptConfig, ThreadHandle, ThreadInfo, schema_d_exports$2 as ThreadSchema, ToolsConfig, Usage, attach, configuration, create$1 as create, get, info, link, relink, remove, threadInfo };
32432
+ export { schema_d_exports$9.AbsolutePath as AbsolutePath, AttachInput, CreateInput, ForkInput, Handle, Info$1 as Info, ModelConfig, PromptInput, RelinkInput, RuntimeInput, session_d_exports as Session, schema_d_exports$3 as SessionMessageSchema, schema_d_exports$12 as SessionSchema, SystemPromptConfig, ThreadHandle, ThreadInfo, ThreadOrigin, schema_d_exports$2 as ThreadSchema, ThreadSummary, ToolsConfig, Usage, attach, configuration, create$1 as create, get, info, link, relink, remove, threadInfo, threadSummary };
31641
32433
  }
31642
32434
  interface ModelConfig {
31643
32435
  readonly provider: string;
@@ -31706,6 +32498,8 @@ type Admission = ReturnType<Interface["prompt"]>;
31706
32498
  type PromptResult = Effect.Effect<Effect.Success<Admission>, Effect.Error<Admission> | InvalidPromptError>;
31707
32499
  interface Info$1 {
31708
32500
  readonly id: ID$4;
32501
+ readonly spaceId: string;
32502
+ readonly slug: string;
31709
32503
  readonly directory: schema_d_exports$9.AbsolutePath;
31710
32504
  /** Absent when the session has no host anchor; see {@link CreateInput.hostDir}. */
31711
32505
  readonly hostDir?: schema_d_exports$9.AbsolutePath;
@@ -31717,14 +32511,35 @@ interface Info$1 {
31717
32511
  readonly id: schema_d_exports$10.ProjectSchema.ID;
31718
32512
  readonly name: string;
31719
32513
  };
32514
+ readonly tag?: string;
32515
+ readonly metadata?: Readonly<Record<string, string>>;
32516
+ /** Epoch milliseconds. */
32517
+ readonly createdAt: number;
31720
32518
  /** Last activity in any of its threads, epoch milliseconds. */
31721
32519
  readonly updatedAt: number;
31722
32520
  readonly mainThreadId: ID$3;
31723
32521
  }
31724
- interface ThreadInfo {
32522
+ /** How a thread came to exist; `cut` is the committed seq its inherited line ends at. */
32523
+ type ThreadOrigin = {
32524
+ readonly kind: "main";
32525
+ } | {
32526
+ readonly kind: "fork";
32527
+ readonly threadId: ID$3;
32528
+ readonly entryId: string;
32529
+ readonly cut: number;
32530
+ } | {
32531
+ readonly kind: "subagent";
32532
+ readonly threadId: ID$3;
32533
+ readonly callId: string;
32534
+ readonly entryId?: string;
32535
+ /** Present once `entryId` is committed. */
32536
+ readonly cut?: number;
32537
+ };
32538
+ /** A thread without its session. */
32539
+ interface ThreadSummary {
31725
32540
  readonly id: ID$3;
31726
32541
  readonly sessionId: ID$4;
31727
- readonly origin: Origin$1;
32542
+ readonly origin: ThreadOrigin;
31728
32543
  /** Absent until its first own prompt; clients show a fork's source title until then. */
31729
32544
  readonly title?: string;
31730
32545
  /** Last activity, epoch milliseconds: every appended entry moves it. */
@@ -31742,6 +32557,27 @@ interface ThreadInfo {
31742
32557
  readonly placement?: Placement$1;
31743
32558
  /** Billed usage of its own entries; what it inherits through a fork point counts for its source. */
31744
32559
  readonly usage: Usage;
32560
+ /** Where its run is, as stored: live whenever the harness is up. */
32561
+ readonly runState: RunState;
32562
+ /** When `runState` last changed, epoch milliseconds; absent before the first run. */
32563
+ readonly runStateAt?: number;
32564
+ /** The last run, absent before the first: times in epoch milliseconds; `error` unless it succeeded. */
32565
+ readonly lastRun?: {
32566
+ readonly startedAt: number;
32567
+ readonly endedAt?: number;
32568
+ readonly outcome?: RunOutcome;
32569
+ readonly error?: RunError$1;
32570
+ };
32571
+ /** Automatic restarts of the current run. */
32572
+ readonly restarts: number;
32573
+ /** The 1-based provider request in flight; absent when none is. */
32574
+ readonly attempt?: number;
32575
+ /** The seq of the event that created it. */
32576
+ readonly createdSeq: number;
32577
+ /** Epoch milliseconds. */
32578
+ readonly createdAt: number;
32579
+ }
32580
+ interface ThreadInfo extends ThreadSummary {
31745
32581
  readonly session: Info$1;
31746
32582
  }
31747
32583
  interface Usage {
@@ -31791,6 +32627,8 @@ interface Handle {
31791
32627
  }
31792
32628
  declare const info: (id: string & import("effect/Brand").Brand<"Session.ID">) => Effect.Effect<{
31793
32629
  id: string & import("effect/Brand").Brand<"Session.ID">;
32630
+ spaceId: string;
32631
+ slug: string;
31794
32632
  directory: string & import("effect/Brand").Brand<"AbsolutePath">;
31795
32633
  hostDir?: string & import("effect/Brand").Brand<"AbsolutePath">;
31796
32634
  hasHostLink: boolean;
@@ -31799,13 +32637,68 @@ declare const info: (id: string & import("effect/Brand").Brand<"Session.ID">) =>
31799
32637
  id: string & import("effect/Brand").Brand<"Project.ID">;
31800
32638
  name: string;
31801
32639
  };
32640
+ tag?: string;
32641
+ metadata?: {
32642
+ readonly [x: string]: string;
32643
+ };
32644
+ createdAt: number;
31802
32645
  updatedAt: number;
31803
32646
  mainThreadId: string & import("effect/Brand").Brand<"Thread.ID">;
31804
32647
  }, SessionNotFoundError, Controller | Service$18 | Service$17>;
32648
+ declare const threadSummary: (id: string & import("effect/Brand").Brand<"Thread.ID">) => Effect.Effect<{
32649
+ id: string & import("effect/Brand").Brand<"Thread.ID">;
32650
+ sessionId: string & import("effect/Brand").Brand<"Session.ID">;
32651
+ origin: ThreadOrigin;
32652
+ title?: string;
32653
+ updatedAt: number;
32654
+ model?: {
32655
+ readonly provider: string;
32656
+ readonly id: string;
32657
+ };
32658
+ thinkingLevel?: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
32659
+ foundation?: string;
32660
+ placement?: {
32661
+ readonly spaceId: string;
32662
+ readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
32663
+ };
32664
+ usage: {
32665
+ cost: number;
32666
+ input: number;
32667
+ output: number;
32668
+ cacheRead: number;
32669
+ cacheWrite: number;
32670
+ };
32671
+ runState: "idle" | "running" | "starting";
32672
+ runStateAt?: number;
32673
+ lastRun?: {
32674
+ startedAt: number;
32675
+ endedAt?: number;
32676
+ outcome?: "failed" | "interrupted" | "succeeded";
32677
+ error?: {
32678
+ readonly _tag: "failed";
32679
+ readonly error: {
32680
+ readonly type: string;
32681
+ readonly message: string;
32682
+ readonly status?: number | undefined;
32683
+ };
32684
+ } | {
32685
+ readonly _tag: "runFailed";
32686
+ readonly reason: "crashloop" | "interrupted" | "truncated";
32687
+ readonly message: string;
32688
+ } | {
32689
+ readonly _tag: "interrupted";
32690
+ readonly reason: "crash" | "shutdown" | "user";
32691
+ };
32692
+ };
32693
+ restarts: number;
32694
+ attempt?: number;
32695
+ createdSeq: number;
32696
+ createdAt: number;
32697
+ }, ThreadNotFoundError, Service$20 | Service$18>;
31805
32698
  declare const threadInfo: (id: string & import("effect/Brand").Brand<"Thread.ID">) => Effect.Effect<{
31806
32699
  id: string & import("effect/Brand").Brand<"Thread.ID">;
31807
32700
  sessionId: string & import("effect/Brand").Brand<"Session.ID">;
31808
- origin: Origin$1;
32701
+ origin: ThreadOrigin;
31809
32702
  title?: string;
31810
32703
  updatedAt: number;
31811
32704
  model?: {
@@ -31825,8 +32718,36 @@ declare const threadInfo: (id: string & import("effect/Brand").Brand<"Thread.ID"
31825
32718
  cacheRead: number;
31826
32719
  cacheWrite: number;
31827
32720
  };
32721
+ runState: "idle" | "running" | "starting";
32722
+ runStateAt?: number;
32723
+ lastRun?: {
32724
+ startedAt: number;
32725
+ endedAt?: number;
32726
+ outcome?: "failed" | "interrupted" | "succeeded";
32727
+ error?: {
32728
+ readonly _tag: "failed";
32729
+ readonly error: {
32730
+ readonly type: string;
32731
+ readonly message: string;
32732
+ readonly status?: number | undefined;
32733
+ };
32734
+ } | {
32735
+ readonly _tag: "runFailed";
32736
+ readonly reason: "crashloop" | "interrupted" | "truncated";
32737
+ readonly message: string;
32738
+ } | {
32739
+ readonly _tag: "interrupted";
32740
+ readonly reason: "crash" | "shutdown" | "user";
32741
+ };
32742
+ };
32743
+ restarts: number;
32744
+ attempt?: number;
32745
+ createdSeq: number;
32746
+ createdAt: number;
31828
32747
  session: {
31829
32748
  id: string & import("effect/Brand").Brand<"Session.ID">;
32749
+ spaceId: string;
32750
+ slug: string;
31830
32751
  directory: string & import("effect/Brand").Brand<"AbsolutePath">;
31831
32752
  hostDir?: string & import("effect/Brand").Brand<"AbsolutePath">;
31832
32753
  hasHostLink: boolean;
@@ -31835,6 +32756,11 @@ declare const threadInfo: (id: string & import("effect/Brand").Brand<"Thread.ID"
31835
32756
  id: string & import("effect/Brand").Brand<"Project.ID">;
31836
32757
  name: string;
31837
32758
  };
32759
+ tag?: string;
32760
+ metadata?: {
32761
+ readonly [x: string]: string;
32762
+ };
32763
+ createdAt: number;
31838
32764
  updatedAt: number;
31839
32765
  mainThreadId: string & import("effect/Brand").Brand<"Thread.ID">;
31840
32766
  };
@@ -31843,6 +32769,8 @@ declare const create$1: (input?: CreateInput | undefined) => Effect.Effect<{
31843
32769
  id: string & import("effect/Brand").Brand<"Session.ID">;
31844
32770
  info: Effect.Effect<{
31845
32771
  id: string & import("effect/Brand").Brand<"Session.ID">;
32772
+ spaceId: string;
32773
+ slug: string;
31846
32774
  directory: string & import("effect/Brand").Brand<"AbsolutePath">;
31847
32775
  hostDir?: string & import("effect/Brand").Brand<"AbsolutePath">;
31848
32776
  hasHostLink: boolean;
@@ -31851,6 +32779,11 @@ declare const create$1: (input?: CreateInput | undefined) => Effect.Effect<{
31851
32779
  id: string & import("effect/Brand").Brand<"Project.ID">;
31852
32780
  name: string;
31853
32781
  };
32782
+ tag?: string;
32783
+ metadata?: {
32784
+ readonly [x: string]: string;
32785
+ };
32786
+ createdAt: number;
31854
32787
  updatedAt: number;
31855
32788
  mainThreadId: string & import("effect/Brand").Brand<"Thread.ID">;
31856
32789
  }, SessionNotFoundError, never>;
@@ -31858,7 +32791,7 @@ declare const create$1: (input?: CreateInput | undefined) => Effect.Effect<{
31858
32791
  thread: (threadId: "main" | (string & import("effect/Brand").Brand<"Thread.ID">)) => Effect.Effect<ThreadHandle, ThreadNotFoundError, never>;
31859
32792
  threads: Effect.Effect<ThreadHandle[], never, never>;
31860
32793
  interrupt: () => Effect.Effect<boolean, never, never>;
31861
- }, Error | import("@codeworksh/plugin/sandbox/errors").SandboxMountError, Controller | Service$19 | Service$20 | Service$18 | Service$17 | Service$6 | Service$1 | import("effect/sql/SqlClient").SqlClient>;
32794
+ }, Error | import("@codeworksh/plugin/sandbox/errors").SandboxMountError, Controller | Service$21 | Service$19 | Service$20 | Service$18 | Service$17 | Service$6 | Service$1 | import("effect/sql/SqlClient").SqlClient>;
31862
32795
  /**
31863
32796
  * Point an existing session at a host directory, or clear it with `null`.
31864
32797
  *
@@ -31872,6 +32805,8 @@ declare const link: (input: {
31872
32805
  id: string & import("effect/Brand").Brand<"Session.ID">;
31873
32806
  info: Effect.Effect<{
31874
32807
  id: string & import("effect/Brand").Brand<"Session.ID">;
32808
+ spaceId: string;
32809
+ slug: string;
31875
32810
  directory: string & import("effect/Brand").Brand<"AbsolutePath">;
31876
32811
  hostDir?: string & import("effect/Brand").Brand<"AbsolutePath">;
31877
32812
  hasHostLink: boolean;
@@ -31880,6 +32815,11 @@ declare const link: (input: {
31880
32815
  id: string & import("effect/Brand").Brand<"Project.ID">;
31881
32816
  name: string;
31882
32817
  };
32818
+ tag?: string;
32819
+ metadata?: {
32820
+ readonly [x: string]: string;
32821
+ };
32822
+ createdAt: number;
31883
32823
  updatedAt: number;
31884
32824
  mainThreadId: string & import("effect/Brand").Brand<"Thread.ID">;
31885
32825
  }, SessionNotFoundError, never>;
@@ -31902,6 +32842,8 @@ declare const relink: (input: RelinkInput) => Effect.Effect<{
31902
32842
  id: string & import("effect/Brand").Brand<"Session.ID">;
31903
32843
  info: Effect.Effect<{
31904
32844
  id: string & import("effect/Brand").Brand<"Session.ID">;
32845
+ spaceId: string;
32846
+ slug: string;
31905
32847
  directory: string & import("effect/Brand").Brand<"AbsolutePath">;
31906
32848
  hostDir?: string & import("effect/Brand").Brand<"AbsolutePath">;
31907
32849
  hasHostLink: boolean;
@@ -31910,6 +32852,11 @@ declare const relink: (input: RelinkInput) => Effect.Effect<{
31910
32852
  id: string & import("effect/Brand").Brand<"Project.ID">;
31911
32853
  name: string;
31912
32854
  };
32855
+ tag?: string;
32856
+ metadata?: {
32857
+ readonly [x: string]: string;
32858
+ };
32859
+ createdAt: number;
31913
32860
  updatedAt: number;
31914
32861
  mainThreadId: string & import("effect/Brand").Brand<"Thread.ID">;
31915
32862
  }, SessionNotFoundError, never>;
@@ -31917,7 +32864,7 @@ declare const relink: (input: RelinkInput) => Effect.Effect<{
31917
32864
  thread: (threadId: "main" | (string & import("effect/Brand").Brand<"Thread.ID">)) => Effect.Effect<ThreadHandle, ThreadNotFoundError, never>;
31918
32865
  threads: Effect.Effect<ThreadHandle[], never, never>;
31919
32866
  interrupt: () => Effect.Effect<boolean, never, never>;
31920
- }, RelinkError | SessionNotFoundError | ThreadNotFoundError | Error | import("@codeworksh/plugin/sandbox/errors").SandboxMountError, Controller | Service$19 | Service$20 | Service$18 | Service$17 | Service$1 | import("effect/sql/SqlClient").SqlClient>;
32867
+ }, RelinkError | SessionNotFoundError | ThreadNotFoundError | Error | import("@codeworksh/plugin/sandbox/errors").SandboxMountError, Controller | Service$21 | Service$19 | Service$20 | Service$18 | Service$17 | Service$1 | import("effect/sql/SqlClient").SqlClient>;
31921
32868
  declare const get: (sessionId: string & import("effect/Brand").Brand<"Session.ID">) => Effect.Effect<Option.None<Handle> | Option.Some<Handle>, never, Controller | Service$19 | Service$20 | Service$18 | Service$17 | Service$1>;
31922
32869
  /**
31923
32870
  * A thread of an existing session (its `main` when `threadId` is absent), with this process's
@@ -31932,6 +32879,264 @@ declare const remove: (sessionId: string & import("effect/Brand").Brand<"Session
31932
32879
  * process; without one, the thread follows its settings.
31933
32880
  */
31934
32881
  declare const configuration: (threadId: string & import("effect/Brand").Brand<"Thread.ID">) => Effect.Effect<Configuration, ModelCatalogError | ModelNotFoundError | ProviderError | SettingsError | ThreadNotFoundError, Service$18 | Service$5>;
32882
+ declare namespace sync_d_exports {
32883
+ export { Cursor, InboxState, IndexChange, Page, ProjectInfo, SpaceInfo, sync_d_exports as Sync, ThreadChange, index, open, page, thread };
32884
+ }
32885
+ /** Where a read in revision order stands: past revision `rev` whole, or past `key` within it. */
32886
+ interface Cursor {
32887
+ readonly rev: number;
32888
+ readonly key?: {
32889
+ readonly kind: string;
32890
+ readonly id: string;
32891
+ };
32892
+ }
32893
+ interface Page<A> {
32894
+ readonly items: ReadonlyArray<A>;
32895
+ /** Where the next page starts; absent once the range is read. */
32896
+ readonly next?: Cursor;
32897
+ }
32898
+ /**
32899
+ * One page of the rows `select` names, as `kind`, `id` and `rev`, past `from` and up to revision
32900
+ * `upto`, in `(rev, kind, id)` order. `select` filters each table on the revision range it is given,
32901
+ * so every table reads through its `rev` index. Rows of one revision can span pages.
32902
+ */
32903
+ declare const page: (select: (range: Statement.Fragment) => Statement.Fragment, from: Cursor, upto: number, limit: number) => Effect.Effect<{
32904
+ items: readonly {
32905
+ readonly kind: string;
32906
+ readonly id: string;
32907
+ readonly rev: number;
32908
+ }[];
32909
+ next?: {
32910
+ rev: number;
32911
+ key: {
32912
+ kind: string;
32913
+ id: string;
32914
+ };
32915
+ };
32916
+ }, never, SqlClient.SqlClient>;
32917
+ interface ProjectInfo {
32918
+ readonly id: string;
32919
+ readonly name: string;
32920
+ readonly status: schema_d_exports$10.ProjectSchema.Status;
32921
+ /** Epoch milliseconds. */
32922
+ readonly createdAt: number;
32923
+ readonly updatedAt: number;
32924
+ }
32925
+ interface SpaceInfo {
32926
+ readonly id: string;
32927
+ readonly projectId: string;
32928
+ readonly location: schema_d_exports$9.AbsolutePath;
32929
+ readonly kind: schema_d_exports$8.SpaceSchema.Kind;
32930
+ /** The sandbox it is in; absent for the host. */
32931
+ readonly env?: string;
32932
+ readonly status: schema_d_exports$8.SpaceSchema.Status;
32933
+ /** Epoch milliseconds. */
32934
+ readonly createdAt: number;
32935
+ readonly updatedAt: number;
32936
+ }
32937
+ /** A row of the index (every project, space, session and thread) at the revision that last wrote it. */
32938
+ type IndexChange = {
32939
+ readonly _tag: "Project";
32940
+ readonly project: ProjectInfo;
32941
+ readonly rev: number;
32942
+ } | {
32943
+ readonly _tag: "Space";
32944
+ readonly space: SpaceInfo;
32945
+ readonly rev: number;
32946
+ } | {
32947
+ readonly _tag: "Session";
32948
+ readonly session: Info$1;
32949
+ readonly rev: number;
32950
+ } | {
32951
+ readonly _tag: "Thread";
32952
+ readonly thread: ThreadSummary;
32953
+ readonly rev: number;
32954
+ } |
32955
+ /** Only sessions are deleted; their threads go with them. */
32956
+ {
32957
+ readonly _tag: "Removed";
32958
+ readonly kind: "session";
32959
+ readonly id: string;
32960
+ readonly rev: number;
32961
+ };
32962
+ /**
32963
+ * One page of the index rows past `from`, up to revision `upto`, read as one snapshot so every row
32964
+ * the page names is still there to read.
32965
+ */
32966
+ declare const index: (from: Cursor, upto: number, limit: number) => Effect.Effect<{
32967
+ items: ({
32968
+ _tag: "Project";
32969
+ project: {
32970
+ id: string;
32971
+ name: string;
32972
+ status: "active" | "archived";
32973
+ createdAt: number;
32974
+ updatedAt: number;
32975
+ };
32976
+ rev: number;
32977
+ space?: never;
32978
+ session?: never;
32979
+ thread?: never;
32980
+ kind?: never;
32981
+ id?: never;
32982
+ } | {
32983
+ project?: never;
32984
+ _tag: "Space";
32985
+ space: {
32986
+ id: string;
32987
+ projectId: string;
32988
+ location: string & import("effect/Brand").Brand<"AbsolutePath">;
32989
+ kind: "copy" | "linked" | "plain" | "primary";
32990
+ env?: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
32991
+ status: "active" | "archived";
32992
+ createdAt: number;
32993
+ updatedAt: number;
32994
+ };
32995
+ rev: number;
32996
+ session?: never;
32997
+ thread?: never;
32998
+ kind?: never;
32999
+ id?: never;
33000
+ } | {
33001
+ project?: never;
33002
+ space?: never;
33003
+ _tag: "Session";
33004
+ session: {
33005
+ id: string & import("effect/Brand").Brand<"Session.ID">;
33006
+ spaceId: string;
33007
+ slug: string;
33008
+ directory: string & import("effect/Brand").Brand<"AbsolutePath">;
33009
+ hostDir?: string & import("effect/Brand").Brand<"AbsolutePath">;
33010
+ hasHostLink: boolean;
33011
+ sandbox?: import("@codeworksh/plugin/sandbox/instance").Info;
33012
+ project?: {
33013
+ id: string & import("effect/Brand").Brand<"Project.ID">;
33014
+ name: string;
33015
+ };
33016
+ tag?: string;
33017
+ metadata?: {
33018
+ readonly [x: string]: string;
33019
+ };
33020
+ createdAt: number;
33021
+ updatedAt: number;
33022
+ mainThreadId: string & import("effect/Brand").Brand<"Thread.ID">;
33023
+ };
33024
+ rev: number;
33025
+ thread?: never;
33026
+ kind?: never;
33027
+ id?: never;
33028
+ } | {
33029
+ project?: never;
33030
+ space?: never;
33031
+ session?: never;
33032
+ _tag: "Thread";
33033
+ thread: {
33034
+ id: string & import("effect/Brand").Brand<"Thread.ID">;
33035
+ sessionId: string & import("effect/Brand").Brand<"Session.ID">;
33036
+ origin: ThreadOrigin;
33037
+ title?: string;
33038
+ updatedAt: number;
33039
+ model?: {
33040
+ readonly provider: string;
33041
+ readonly id: string;
33042
+ };
33043
+ thinkingLevel?: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
33044
+ foundation?: string;
33045
+ placement?: {
33046
+ readonly spaceId: string;
33047
+ readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
33048
+ };
33049
+ usage: {
33050
+ cost: number;
33051
+ input: number;
33052
+ output: number;
33053
+ cacheRead: number;
33054
+ cacheWrite: number;
33055
+ };
33056
+ runState: "idle" | "running" | "starting";
33057
+ runStateAt?: number;
33058
+ lastRun?: {
33059
+ startedAt: number;
33060
+ endedAt?: number;
33061
+ outcome?: "failed" | "interrupted" | "succeeded";
33062
+ error?: {
33063
+ readonly _tag: "failed";
33064
+ readonly error: {
33065
+ readonly type: string;
33066
+ readonly message: string;
33067
+ readonly status?: number | undefined;
33068
+ };
33069
+ } | {
33070
+ readonly _tag: "runFailed";
33071
+ readonly reason: "crashloop" | "interrupted" | "truncated";
33072
+ readonly message: string;
33073
+ } | {
33074
+ readonly _tag: "interrupted";
33075
+ readonly reason: "crash" | "shutdown" | "user";
33076
+ };
33077
+ };
33078
+ restarts: number;
33079
+ attempt?: number;
33080
+ createdSeq: number;
33081
+ createdAt: number;
33082
+ };
33083
+ rev: number;
33084
+ kind?: never;
33085
+ id?: never;
33086
+ } | {
33087
+ project?: never;
33088
+ space?: never;
33089
+ session?: never;
33090
+ thread?: never;
33091
+ _tag: "Removed";
33092
+ kind: "session";
33093
+ id: string;
33094
+ rev: number;
33095
+ })[];
33096
+ next?: {
33097
+ rev: number;
33098
+ key: {
33099
+ kind: string;
33100
+ id: string;
33101
+ };
33102
+ };
33103
+ }, never, Controller | Service$20 | Service$18 | Service$17 | SqlClient.SqlClient>;
33104
+ type InboxState = "pending" | "promoted" | "cancelled";
33105
+ /** A row of one thread's detail at the revision that last wrote it. */
33106
+ type ThreadChange = {
33107
+ readonly _tag: "Entry";
33108
+ readonly entry: HydratedEntry;
33109
+ readonly rev: number;
33110
+ } | {
33111
+ readonly _tag: "Inbox";
33112
+ readonly prompt: Admitted;
33113
+ readonly state: InboxState;
33114
+ readonly rev: number;
33115
+ };
33116
+ /**
33117
+ * One page of a thread's own user and assistant entries and inbox rows past `from`, up to revision
33118
+ * `upto`, read as one snapshot. Inherited entries never change after the fork's cut, so a resume
33119
+ * does not read them.
33120
+ */
33121
+ declare const thread: (threadId: string & import("effect/Brand").Brand<"Thread.ID">, from: Cursor, upto: number, limit: number) => Effect.Effect<{
33122
+ items: ThreadChange[];
33123
+ next?: {
33124
+ rev: number;
33125
+ key: {
33126
+ kind: string;
33127
+ id: string;
33128
+ };
33129
+ };
33130
+ }, never, Service$18 | SqlClient.SqlClient>;
33131
+ /**
33132
+ * A thread's first page, read as one snapshot: the newest entries of its line within `budget`
33133
+ * bytes and `limit` entries (`Thread.linePage`), oldest first, then its pending inbox in admission
33134
+ * order. `floor` is the oldest entry's seq.
33135
+ */
33136
+ declare const open: (threadId: string & import("effect/Brand").Brand<"Thread.ID">, budget: number, limit: number) => Effect.Effect<{
33137
+ items: ThreadChange[];
33138
+ floor?: number;
33139
+ }, never, Service$18 | SqlClient.SqlClient>;
31935
33140
  declare namespace config_d_exports {
31936
33141
  export { config_d_exports as McpConfig, clash, isLoopbackRedirect, isSecure, load, namespace, validate };
31937
33142
  }
@@ -32300,5 +33505,5 @@ type DateTimeUtcFromMillis = import__codeworksh_plugin_schema.DateTimeUtcFromMil
32300
33505
  type EventSchema = import__codeworksh_plugin_event.EventSchema;
32301
33506
  type SandboxError = import__codeworksh_plugin_sandbox_errors.SandboxError;
32302
33507
  type optional = import__codeworksh_plugin_schema.optional;
32303
- export { control_d_exports as Control, db_d_exports as Database, DateTimeUtcFromMillis, schema_d_exports as DocumentSchema, event_d_exports as Event, list_d_exports as EventList, registry_d_exports as EventRegistry, EventSchema, git_d_exports as Git, global_d_exports as Global, harness_d_exports as Harness, location_d_exports as Location, mcp_d_exports as Mcp, config_d_exports as McpConfig, error_d_exports as McpError, oauth_d_exports as McpOAuth, catalog_d_exports as ModelCatalog, index_d_exports as Plugin, project_d_exports as Project, schema_d_exports$1 as PromptSchema, run_d_exports as Runner, sandbox_d_exports as Sandbox, SandboxError, session_d_exports as Session, session_d_exports$1 as SessionStore, settings_d_exports as Settings, state_d_exports as State, schema_d_exports$2 as ThreadSchema, thread_d_exports as ThreadStore, tool_d_exports as Tool, optional };
33508
+ export { control_d_exports as Control, db_d_exports as Database, DateTimeUtcFromMillis, schema_d_exports as DocumentSchema, event_d_exports as Event, list_d_exports as EventList, registry_d_exports as EventRegistry, EventSchema, git_d_exports as Git, global_d_exports as Global, harness_d_exports as Harness, location_d_exports as Location, mcp_d_exports as Mcp, config_d_exports as McpConfig, error_d_exports as McpError, oauth_d_exports as McpOAuth, catalog_d_exports as ModelCatalog, index_d_exports as Plugin, project_d_exports as Project, schema_d_exports$1 as PromptSchema, run_d_exports as Runner, sandbox_d_exports as Sandbox, SandboxError, session_d_exports as Session, session_d_exports$1 as SessionStore, settings_d_exports as Settings, state_d_exports as State, store_d_exports as Store, sync_d_exports as Sync, schema_d_exports$2 as ThreadSchema, thread_d_exports as ThreadStore, tool_d_exports as Tool, optional };
32304
33509
  //# sourceMappingURL=effect.d.mts.map