@sorbetai/runtime 0.1.0-alpha.17 → 0.1.0-alpha.19

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/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { $ as UnitReader, $t as JsonValueSchema, A as ToolExecutionObservation, At as JournalWrite, B as openUnitStorage, Bt as SessionForkedPayload, C as RunAdmittedObservation, Ct as JournalPage, D as RunSettledObservation, Dt as JournalStoreFaultError, E as RunResourceWaitObservation, Et as JournalStore, F as WaitIdentityObservation, Ft as RunFailureCodeSchema, G as UnitFact, Gt as SubmissionControlInputSchema, H as UnitCommitOutcome, Ht as SessionInputSourceSchema, I as WaitSettledObservation, It as RunJournalFact, J as UnitHistoryErrorCode, Jt as ToolOutputArchiveRecord, K as UnitFactSchema, Kt as SubmissionInputSchema, L as WaitStartedObservation, Lt as RunJournalFactKind, M as ToolOutputMeasurement, Mt as ModelRequestContextSnapshot, N as ToolOutputObservation, Nt as NewJournalFact, O as RuntimeObservationPort, Ot as JournalSubscription, P as ToolPermissionObservation, Pt as RunFailureCode, Q as UnitReadOptions, Qt as JsonValue, R as UnitStorage, Rt as SendSessionInputSchema, S as ObservationTraceContext, St as JournalFactSchema, T as RunExecutionObservation, Tt as JournalReadOptions, U as UnitEntry, Ut as SessionJournalFact, V as OpenedUnitStore, Vt as SessionInputSource, W as UnitEpoch, Wt as SessionJournalFactKind, X as UnitOpenOptions, Xt as ToolResultMessageCommittedPayload, Y as UnitInspectionPage, Yt as ToolOutputArchiveRecordSchema, Z as UnitPage, Zt as UserPromptSchema, _ as ModelDispatchObservation, _t as JournalCursor, a as CompactionSourceFallbackObservation, at as JournalRecoveryFact, b as ModelRetryWaitObservation, bt as JournalFact, c as ContextCapacityObservation, ct as JournalReaderResetRequiredError, d as EffectObservation, dt as CompletedToolResultSchema, et as UnitRecord, f as JournalBatchObservation, ft as ContextForkSeedSchema, g as ModelAttemptObservation, gt as JournalConflictError, h as JournalReopenObservation, ht as JournalAppendOptions, i as CompactionProviderObservation, it as UnitWrite, j as ToolExecutionStartedObservation, jt as ModelRequestBaseCommittedPayload, k as SessionRecoveryObservation, kt as JournalSubscriptionOptions, l as ContextPreparationObservation, lt as JournalWriterBusyError, m as JournalQueueObservation, mt as JOURNAL_FACT_SCHEMA_VERSION, n as CompactionModelObservation, nt as UnitStoreError, o as ContextAttributionObservation, ot as JournalCorruptionError, p as JournalProjectionObservation, pt as EffectUnknownPayload, q as UnitHistoryError, qt as ToolHookEvidenceSchema, r as CompactionObservation, rt as UnitSubscription, s as ContextAttributionSection, st as JournalReaderCapacityError, t as ApprovalReviewObservation, tt as UnitStore, u as ContextSectionEstimate, ut as CompleteModelInputSchema, v as ModelProviderObservation, vt as JournalCursorGapError, w as RunDrainObservation, wt as JournalPayloadMap, x as ModelUnknownObservation, xt as JournalFactKind, y as ModelRetryObservation, yt as JournalCursorSchema, z as UnitStorageWrite, zt as SendSessionInputVariants } from "./contracts-D0cczmsb.js";
1
+ import { $ as RunExecutionObservation, $t as SessionJournalFactKind, A as CompactionModelObservation, At as JournalFactKind, B as JournalBatchObservation, Bt as ModelRequestBaseCommittedPayload, C as UnitSubscription, Ct as JOURNAL_FACT_SCHEMA_VERSION, D as MessageReceipt, Dt as JournalCursorGapError, E as MessageDeliveryResult, Et as JournalCursor, F as ContextAttributionSection, Ft as JournalStore, G as ModelDispatchObservation, Gt as RunJournalFact, H as JournalQueueObservation, Ht as NewJournalFact, I as ContextCapacityObservation, It as JournalStoreFaultError, J as ModelRetryWaitObservation, Jt as SendSessionInputVariants, K as ModelProviderObservation, Kt as RunJournalFactKind, L as ContextPreparationObservation, Lt as JournalSubscription, M as CompactionProviderObservation, Mt as JournalPage, N as CompactionSourceFallbackObservation, Nt as JournalPayloadMap, O as MessageRejection, Ot as JournalCursorSchema, P as ContextAttributionObservation, Pt as JournalReadOptions, Q as RunDrainObservation, Qt as SessionJournalFact, R as ContextSectionEstimate, Rt as JournalSubscriptionOptions, S as UnitStoreError, St as EffectUnknownPayload, Tt as JournalConflictError, U as JournalReopenObservation, Ut as RunFailureCode, V as JournalProjectionObservation, Vt as ModelRequestContextSnapshot, W as ModelAttemptObservation, Wt as RunFailureCodeSchema, X as ObservationTraceContext, Xt as SessionInputSource, Y as ModelUnknownObservation, Yt as SessionForkedPayload, Z as RunAdmittedObservation, Zt as SessionInputSourceSchema, _ as UnitReader, _t as CompactionStateBaselineEntry, a as OpenedUnitStore, an as ToolResultMessageCommittedPayload, at as ToolExecutionStartedObservation, bt as CompletedToolResultSchema, c as UnitEpoch, cn as JsonValueSchema, ct as ToolPermissionObservation, d as UnitHistoryError, dt as WaitStartedObservation, en as SubmissionControlInputSchema, et as RunResourceWaitObservation, f as UnitHistoryErrorCode, ft as JournalRecoveryFact, g as UnitReadOptions, gt as JournalWriterBusyError, h as UnitPage, ht as JournalReaderResetRequiredError, i as openUnitStorage, in as ToolOutputArchiveRecordSchema, it as ToolExecutionObservation, j as CompactionObservation, jt as JournalFactSchema, k as ApprovalReviewObservation, kt as JournalFact, l as UnitFact, lt as WaitIdentityObservation, m as UnitOpenOptions, mt as JournalReaderCapacityError, n as UnitStorage, nn as ToolHookEvidenceSchema, nt as RuntimeObservationPort, o as UnitCommitOutcome, on as UserPromptSchema, ot as ToolOutputMeasurement, p as UnitInspectionPage, pt as JournalCorruptionError, q as ModelRetryObservation, qt as SendSessionInputSchema, r as UnitStorageWrite, rn as ToolOutputArchiveRecord, rt as SessionRecoveryObservation, s as UnitEntry, sn as JsonValue, st as ToolOutputObservation, t as UnitSession, tn as SubmissionInputSchema, tt as RunSettledObservation, u as UnitFactSchema, ut as WaitSettledObservation, v as UnitRecord, vt as CompactionStateBaselineEntrySchema, w as UnitWrite, wt as JournalAppendOptions, x as UnitStore, xt as ContextForkSeedSchema, yt as CompleteModelInputSchema, z as EffectObservation, zt as JournalWrite } from "./catalog-AETfQ-ha.js";
2
2
  import * as s from "@earendil-works/pi-schema";
3
- import * as _sorbetai_schema30 from "@sorbetai/schema";
4
- import * as _sorbetai_context56 from "@sorbetai/context";
3
+ import * as _sorbetai_context43 from "@sorbetai/context";
5
4
  import { AssistantMessage, ContextHistorySnapshot, ContextManager, ContextModelView, ContextProvenance, ContextSnapshot, ContextSource, ContextTransitionFrame, ImageContent, JsonValue as JsonValue$1, Message, ModelContext, NamedStateOwner, PrefixContextContributor, PrefixContextSource, ReadonlyJsonValue, RequestContextSource, TextContent, ToolCall, ToolDeclaration, ToolResultMessage, TurnContextSource, Usage, UserMessage } from "@sorbetai/context";
5
+ import * as _sorbetai_schema54 from "@sorbetai/schema";
6
6
  import { ModelToolLease, ModelToolSource, ModelView, ObjectCapabilityOptions, PluginToolResultSnapshot, SessionBehaviorCommand, SessionBehaviorView, UsageTotals } from "@sorbetai/plugins/model";
7
7
  import { ArtifactRef, ArtifactStore } from "@sorbetai/artifacts";
8
8
  import * as Context from "effect/Context";
@@ -25,7 +25,7 @@ declare const ApprovalRequestRecordSchema: s.Schema<{
25
25
  toolCallId: string;
26
26
  toolName: string;
27
27
  reason: string;
28
- parameters: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
28
+ parameters: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
29
29
  taskId?: string | undefined;
30
30
  parentToolCallId?: string | undefined;
31
31
  }>;
@@ -329,6 +329,54 @@ declare function compactModelRequestContextSnapshot(snapshot: ContextSnapshot, p
329
329
  declare function expandModelRequestContextSnapshot(snapshot: ModelRequestContextSnapshot, lookup: (modelRequestId: string) => ModelRequestContextSnapshot | undefined): ModelRequestContextSnapshot;
330
330
  declare function materializeModelRequestContextSnapshot(base: ModelRequestBaseFact, snapshot: ModelRequestContextSnapshot, _logicalModelCallId?: string): ContextSnapshot;
331
331
  //#endregion
332
+ //#region src/journal/read.d.ts
333
+ /**
334
+ * Follows a cursor-paged history to its end. The caller's read is issued with only the
335
+ * cursor, and each page is yielded before the next is fetched, so per-page work keeps
336
+ * its lazy evaluation and early exits propagate.
337
+ */
338
+ declare function readPagesToEnd<Page extends {
339
+ readonly cursor?: JournalCursor;
340
+ readonly hasMore: boolean;
341
+ }>(read: (options: {
342
+ readonly after?: JournalCursor;
343
+ }) => Promise<Page>, after?: JournalCursor): AsyncGenerator<Page>;
344
+ //#endregion
345
+ //#region src/observation/invoke.d.ts
346
+ /** Isolates host callbacks, including async functions accidentally assigned to a void callback. */
347
+ declare function observeRuntime(report: () => void): void;
348
+ /** Tracing is not authority; adapter failures must not affect dispatch. */
349
+ declare function readObservationTraceContext(port: RuntimeObservationPort | undefined, identity: Parameters<NonNullable<RuntimeObservationPort['traceContext']>>[0]): ObservationTraceContext | undefined;
350
+ //#endregion
351
+ //#region src/journal/recovery.d.ts
352
+ /** Tracks outstanding durable identities without retaining terminal payloads. */
353
+ declare class SessionRecoveryProjection {
354
+ #private;
355
+ constructor(restored?: SessionRecoveryExport & {
356
+ readonly sessionId: string;
357
+ });
358
+ apply(fact: JournalRecoveryFact): boolean;
359
+ snapshot(sessionId: string): SessionRecoveryObservation;
360
+ reset(): void;
361
+ /** The fold's complete state, so a snapshot can persist and later restore it. */
362
+ export(): SessionRecoveryExport;
363
+ /** Rebuilds a projection from an `export()`. Used by snapshot restore. */
364
+ static restore(sessionId: string, state: SessionRecoveryExport): SessionRecoveryProjection;
365
+ }
366
+ interface SessionRecoveryExport {
367
+ readonly runs: readonly string[];
368
+ readonly models: readonly string[];
369
+ readonly compactionModels: readonly string[];
370
+ readonly effects: readonly string[];
371
+ readonly compactions: readonly string[];
372
+ readonly unknownModels: number;
373
+ readonly unknownEffects: number;
374
+ readonly sequence: number;
375
+ readonly cursor?: string;
376
+ }
377
+ /** Projects durable uncertainty without opening a Session, acquiring ownership or performing recovery. */
378
+ declare function projectSessionRecovery(sessionId: string, facts: readonly JournalRecoveryFact[]): SessionRecoveryObservation;
379
+ //#endregion
332
380
  //#region src/journal/tool-result-evidence.d.ts
333
381
  type EffectTerminalFact = Extract<JournalFact, {
334
382
  kind: 'effect.succeeded' | 'effect.failed' | 'effect.unknown';
@@ -353,7 +401,7 @@ declare const PluginRecordOwnerSchema: s.Schema<{
353
401
  declare const AppendPluginRecordSchema: s.Schema<{
354
402
  recordType: string;
355
403
  recordVersion: number;
356
- data: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
404
+ data: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
357
405
  expectedRevision: number;
358
406
  sourceSequence: number;
359
407
  idempotencyKey?: string | undefined;
@@ -364,10 +412,10 @@ declare const PluginRecordPayloadSchema: s.Schema<{
364
412
  activationId?: string | undefined;
365
413
  };
366
414
  revision: number;
367
- data: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
368
- sourceSequence: number;
415
+ data: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
369
416
  recordType: string;
370
417
  recordVersion: number;
418
+ sourceSequence: number;
371
419
  idempotencyKey?: string | undefined;
372
420
  }>;
373
421
  type PluginRecordOwner = s.Static<typeof PluginRecordOwnerSchema>;
@@ -523,7 +571,7 @@ declare const TaskWaitMemberSchema: s.Schema<{
523
571
  declare const TaskJoinPolicySchema: s.Schema<"allSettled" | "firstSettled">;
524
572
  declare const TaskOutcomeSchema: s.Schema<{
525
573
  status: "completed";
526
- result: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
574
+ result: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
527
575
  } | {
528
576
  status: "failed";
529
577
  error: {
@@ -560,7 +608,7 @@ declare const TaskFactSchema: s.Schema<{
560
608
  };
561
609
  background: boolean;
562
610
  creationKey: string;
563
- input: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
611
+ input: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
564
612
  checkpoint: Record<string, JsonValue> & {
565
613
  phase: string;
566
614
  };
@@ -575,12 +623,12 @@ declare const TaskFactSchema: s.Schema<{
575
623
  owner: {
576
624
  session: string;
577
625
  };
578
- result: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
626
+ result: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
579
627
  kind: string;
580
628
  version: number;
581
629
  background: boolean;
582
630
  creationKey: string;
583
- input: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
631
+ input: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
584
632
  checkpoint: Record<string, JsonValue> & {
585
633
  phase: string;
586
634
  };
@@ -699,7 +747,7 @@ declare const TaskFactSchema: s.Schema<{
699
747
  invocationId: string;
700
748
  outcome: {
701
749
  status: "completed";
702
- result: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
750
+ result: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
703
751
  } | {
704
752
  status: "failed";
705
753
  error: {
@@ -729,7 +777,7 @@ declare const TaskFactSchema: s.Schema<{
729
777
  payload: {
730
778
  outcome: {
731
779
  status: "completed";
732
- result: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
780
+ result: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
733
781
  } | {
734
782
  status: "failed";
735
783
  error: {
@@ -761,7 +809,7 @@ declare const TaskFactSchema: s.Schema<{
761
809
  signalId: string;
762
810
  creationKey: string;
763
811
  type: "host-command" | "elicitation" | "message-reply";
764
- payload: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
812
+ payload: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
765
813
  invocationId: string;
766
814
  };
767
815
  } | {
@@ -772,7 +820,7 @@ declare const TaskFactSchema: s.Schema<{
772
820
  kind: "signal.resolved";
773
821
  payload: {
774
822
  signalId: string;
775
- result: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
823
+ result: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
776
824
  commandId: string;
777
825
  };
778
826
  } | {
@@ -809,7 +857,7 @@ declare const UnitMessageSchema: s.Schema<{
809
857
  })[];
810
858
  source: {
811
859
  kind: string;
812
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
860
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
813
861
  };
814
862
  } | {
815
863
  kind: "context-event";
@@ -861,7 +909,7 @@ declare const UnitMessageSchema: s.Schema<{
861
909
  kind: "container";
862
910
  name: string;
863
911
  attributes?: Record<string, string | number>;
864
- children: _sorbetai_context56.ContextXmlElement[];
912
+ children: _sorbetai_context43.ContextXmlElement[];
865
913
  };
866
914
  sourceId: string;
867
915
  provenance: {
@@ -869,11 +917,11 @@ declare const UnitMessageSchema: s.Schema<{
869
917
  label: string;
870
918
  location?: string | undefined;
871
919
  };
872
- metadata?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
920
+ metadata?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
873
921
  })[];
874
922
  source: {
875
923
  kind: string;
876
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
924
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
877
925
  };
878
926
  };
879
927
  whenBusy: "followUp" | "steer";
@@ -938,7 +986,7 @@ declare const MessageFactSchema: s.Schema<{
938
986
  })[];
939
987
  source: {
940
988
  kind: string;
941
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
989
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
942
990
  };
943
991
  } | {
944
992
  kind: "context-event";
@@ -990,7 +1038,7 @@ declare const MessageFactSchema: s.Schema<{
990
1038
  kind: "container";
991
1039
  name: string;
992
1040
  attributes?: Record<string, string | number>;
993
- children: _sorbetai_context56.ContextXmlElement[];
1041
+ children: _sorbetai_context43.ContextXmlElement[];
994
1042
  };
995
1043
  sourceId: string;
996
1044
  provenance: {
@@ -998,11 +1046,11 @@ declare const MessageFactSchema: s.Schema<{
998
1046
  label: string;
999
1047
  location?: string | undefined;
1000
1048
  };
1001
- metadata?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
1049
+ metadata?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
1002
1050
  })[];
1003
1051
  source: {
1004
1052
  kind: string;
1005
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
1053
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
1006
1054
  };
1007
1055
  };
1008
1056
  whenBusy: "followUp" | "steer";
@@ -1037,10 +1085,10 @@ declare const MessageFactSchema: s.Schema<{
1037
1085
  payload: {
1038
1086
  status: "accepted";
1039
1087
  acceptanceId: string;
1040
- targetUnitId: string;
1041
- targetSessionId: string;
1042
1088
  messageId: string;
1043
1089
  sourceUnitId: string;
1090
+ targetUnitId: string;
1091
+ targetSessionId: string;
1044
1092
  };
1045
1093
  } | {
1046
1094
  id: string;
@@ -1052,10 +1100,10 @@ declare const MessageFactSchema: s.Schema<{
1052
1100
  status: "rejected";
1053
1101
  code: string;
1054
1102
  message: string;
1055
- targetUnitId: string;
1056
- targetSessionId: string;
1057
1103
  messageId: string;
1058
1104
  sourceUnitId: string;
1105
+ targetUnitId: string;
1106
+ targetSessionId: string;
1059
1107
  };
1060
1108
  }>;
1061
1109
  type MessageFact = s.Static<typeof MessageFactSchema>;
@@ -1063,47 +1111,6 @@ type MessageIntent = Extract<MessageFact, {
1063
1111
  kind: 'message.outbox.enqueued';
1064
1112
  }>['payload'];
1065
1113
  //#endregion
1066
- //#region src/journal/message-routing.d.ts
1067
- declare const MessageReceiptSchema: s.Schema<{
1068
- status: "accepted";
1069
- acceptanceId: string;
1070
- targetUnitId: string;
1071
- targetSessionId: string;
1072
- messageId: string;
1073
- sourceUnitId: string;
1074
- }>;
1075
- declare const MessageRejectionSchema: s.Schema<{
1076
- status: "rejected";
1077
- code: string;
1078
- message: string;
1079
- targetUnitId: string;
1080
- targetSessionId: string;
1081
- messageId: string;
1082
- sourceUnitId: string;
1083
- }>;
1084
- declare const MessageDeliveryResultSchema: s.Schema<{
1085
- status: "accepted";
1086
- acceptanceId: string;
1087
- targetUnitId: string;
1088
- targetSessionId: string;
1089
- messageId: string;
1090
- sourceUnitId: string;
1091
- } | {
1092
- status: "rejected";
1093
- code: string;
1094
- message: string;
1095
- targetUnitId: string;
1096
- targetSessionId: string;
1097
- messageId: string;
1098
- sourceUnitId: string;
1099
- } | {
1100
- status: "unavailable";
1101
- code: string;
1102
- }>;
1103
- type MessageReceipt = s.Static<typeof MessageReceiptSchema>;
1104
- type MessageRejection = s.Static<typeof MessageRejectionSchema>;
1105
- type MessageDeliveryResult = s.Static<typeof MessageDeliveryResultSchema>;
1106
- //#endregion
1107
1114
  //#region src/journal/pre-b3.d.ts
1108
1115
  /** Run facts that carried input evidence inline before Submissions owned admission. */
1109
1116
  declare const PRE_B3_INPUT_FACT_KINDS: readonly ["run.accepted", "run.input.accepted"];
@@ -1155,12 +1162,6 @@ interface ToolDefinition<Parameters$1 extends object = object, Details = unknown
1155
1162
  execute(toolCallId: string, parameters: s.Static<Parameters$1>, signal?: AbortSignal, onUpdate?: ToolUpdateCallback<Details>): Promise<ToolResult<Details>>;
1156
1163
  }
1157
1164
  //#endregion
1158
- //#region src/observation/invoke.d.ts
1159
- /** Isolates host callbacks, including async functions accidentally assigned to a void callback. */
1160
- declare function observeRuntime(report: () => void): void;
1161
- /** Tracing is not authority; adapter failures must not affect dispatch. */
1162
- declare function readObservationTraceContext(port: RuntimeObservationPort | undefined, identity: Parameters<NonNullable<RuntimeObservationPort['traceContext']>>[0]): ObservationTraceContext | undefined;
1163
- //#endregion
1164
1165
  //#region src/tools/discovery/contracts.d.ts
1165
1166
  declare const ToolSourcesSchema: s.Schema<{
1166
1167
  namespace: string;
@@ -1387,7 +1388,7 @@ declare function parseToolParameters<T extends s.JsonSchema>(toolName: string, s
1387
1388
  declare const PermissionGrantSchema: s.Schema<{
1388
1389
  grantId: string;
1389
1390
  toolName: string;
1390
- parameters: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
1391
+ parameters: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
1391
1392
  sourceToolCallId: string;
1392
1393
  grantedAt: string;
1393
1394
  sourceRunId?: string | undefined;
@@ -1407,9 +1408,9 @@ declare const SessionPermissionGrantSchema: s.Schema<{
1407
1408
  }>;
1408
1409
  type SessionPermissionGrant = Readonly<s.Static<typeof SessionPermissionGrantSchema>>;
1409
1410
  /** The access decision that a Permission policy can make before execution. */
1410
- declare const ToolPermissionAccessSchema: s.Schema<"allow" | "deny">;
1411
+ declare const ToolPermissionAccessSchema: s.Schema<"deny" | "allow">;
1411
1412
  /** Whether an otherwise allowed Tool call needs a Host Approval. */
1412
- declare const ToolApprovalRequirementSchema: s.Schema<"required" | "not-required">;
1413
+ declare const ToolApprovalRequirementSchema: s.Schema<"not-required" | "required">;
1413
1414
  /** The non-terminal admission instruction produced by a Permission evaluator. */
1414
1415
  declare const ToolPermissionDirectiveSchema: s.Schema<{
1415
1416
  access: "deny";
@@ -1916,6 +1917,14 @@ declare class RunFactCommitter {
1916
1917
  * from genesis, or only the facts after `after`.
1917
1918
  */
1918
1919
  journalSnapshot(after?: JournalCursor): Promise<readonly JournalFact[]>;
1920
+ /**
1921
+ * Streams durable facts one at a time after all commits issued through this owner
1922
+ * settle. Unlike {@link journalSnapshot}, the resident set stays at one Store page:
1923
+ * callers that fold or filter should consume this instead of materializing the whole
1924
+ * suffix first. An uncursored, unbounded stream is served from the resumed prefix cache
1925
+ * so repeated full folds do not re-parse the Journal.
1926
+ */
1927
+ journalFacts(after?: JournalCursor, throughSequence?: number): AsyncGenerator<JournalFact>;
1919
1928
  unresolvedModelInvocations(): Promise<readonly Extract<JournalFact, {
1920
1929
  kind: 'model.invocation.requested';
1921
1930
  }>[]>;
@@ -2040,6 +2049,67 @@ declare class SessionContextCapacityError extends Error {
2040
2049
  }
2041
2050
  declare function validateCompactionSettings(settings: Partial<CompactionSettings> | undefined, model: Pick<CompactionModel, 'contextWindow' | 'maxTokens'>): CompactionSettings;
2042
2051
  //#endregion
2052
+ //#region src/session/history/integrity.d.ts
2053
+ /**
2054
+ * Opt-in strict handling of the effective-conversation projection. 'lenient' is the
2055
+ * default and preserves current behavior bit-for-bit; 'strict' folds the same facts
2056
+ * but throws HistoryIntegrityError on the first integrity violation instead of
2057
+ * silently synthesizing the missing evidence.
2058
+ */
2059
+ type HistoryIntegrityMode = 'lenient' | 'strict';
2060
+ type HistoryIntegrityViolationReason = 'tool-call-open' | 'model-request-open' | 'turn-atomicity' | 'atomic-group-split';
2061
+ interface HistoryIntegrityViolation {
2062
+ readonly reason: HistoryIntegrityViolationReason;
2063
+ readonly message: string;
2064
+ readonly toolCallId?: string;
2065
+ readonly modelRequestId?: string;
2066
+ readonly runId?: string;
2067
+ readonly sequence?: number;
2068
+ readonly cursor?: JournalCursor;
2069
+ }
2070
+ /**
2071
+ * Strict history folding rejected the committed fact stream. `violation` names the
2072
+ * offending call, request, or boundary with enough identity to locate it in the Journal.
2073
+ */
2074
+ declare class HistoryIntegrityError extends Error {
2075
+ readonly code = "history_integrity";
2076
+ readonly violation: HistoryIntegrityViolation;
2077
+ constructor(violation: HistoryIntegrityViolation);
2078
+ }
2079
+ /**
2080
+ * One fold over the committed fact stream producing every gap the lenient
2081
+ * projection absorbs: Tool calls that never resolved and model requests that were
2082
+ * never settled by a committed response or `model.request.unknown`.
2083
+ */
2084
+ declare function inspectHistoryIntegrity(facts: readonly JournalFact[]): readonly HistoryIntegrityViolation[];
2085
+ /**
2086
+ * Folds the same invariants and throws HistoryIntegrityError on the first violation.
2087
+ * Used by the strict effective-conversation projection before it materializes any
2088
+ * interrupted evidence.
2089
+ */
2090
+ declare function assertHistoryIntegrity(facts: readonly JournalFact[]): void;
2091
+ type HistoryBoundaryVerdict = {
2092
+ readonly valid: true;
2093
+ } | {
2094
+ readonly valid: false;
2095
+ readonly reason: HistoryIntegrityViolationReason;
2096
+ readonly offendingFactCursor: JournalCursor;
2097
+ readonly message: string;
2098
+ };
2099
+ /**
2100
+ * Whether a cut placed after `cutSequence` (keep facts with sequence <= cut) is a
2101
+ * valid conversation boundary, decidable from committed facts alone. The cut is
2102
+ * invalid when it falls inside a Tool-call/result pair, inside a model request
2103
+ * without its response, or inside an atomic commit group.
2104
+ */
2105
+ declare function validateHistoryBoundary(facts: readonly JournalFact[], cutSequence: number): HistoryBoundaryVerdict;
2106
+ /**
2107
+ * The nearest valid cut at or before `cutSequence`: scans downward one fact at a
2108
+ * time so a Tool-call pair or atomic group that spans the requested cut is kept
2109
+ * whole. Returns 0 when no earlier boundary is valid.
2110
+ */
2111
+ declare function relocateHistoryBoundary(facts: readonly JournalFact[], cutSequence: number): number;
2112
+ //#endregion
2043
2113
  //#region src/session/run-handle/contracts.d.ts
2044
2114
  type RunAcceptedReceipt = Extract<JournalFact, {
2045
2115
  kind: 'run.accepted';
@@ -2147,6 +2217,11 @@ interface ConversationProjectionOptions {
2147
2217
  * so its acceptance must stay visible for the placement to resolve.
2148
2218
  */
2149
2219
  readonly sinceSequence?: number;
2220
+ /**
2221
+ * 'strict' throws HistoryIntegrityError on unresolved Tool calls instead of
2222
+ * synthesizing interrupted results; 'lenient' (default) is unchanged.
2223
+ */
2224
+ readonly integrity?: HistoryIntegrityMode;
2150
2225
  }
2151
2226
  /**
2152
2227
  * Rebuilds a Provider-valid Pi transcript without changing Journal history.
@@ -2206,7 +2281,7 @@ declare const SessionForkSeedSchema: s.Schema<{
2206
2281
  };
2207
2282
  source: {
2208
2283
  kind: string;
2209
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
2284
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
2210
2285
  };
2211
2286
  } | {
2212
2287
  runId: string;
@@ -2227,7 +2302,7 @@ declare const SessionForkSeedSchema: s.Schema<{
2227
2302
  type: "toolCall";
2228
2303
  id: string;
2229
2304
  name: string;
2230
- arguments: Record<string, _sorbetai_schema30.JsonValue>;
2305
+ arguments: Record<string, _sorbetai_schema54.JsonValue>;
2231
2306
  thoughtSignature?: string | undefined;
2232
2307
  argumentsError?: string | undefined;
2233
2308
  })[];
@@ -2264,7 +2339,7 @@ declare const SessionForkSeedSchema: s.Schema<{
2264
2339
  stack?: string | undefined;
2265
2340
  code?: string | number | undefined;
2266
2341
  } | undefined;
2267
- details?: Record<string, _sorbetai_schema30.JsonValue> | undefined;
2342
+ details?: Record<string, _sorbetai_schema54.JsonValue> | undefined;
2268
2343
  }[] | undefined;
2269
2344
  deferred?: {
2270
2345
  provider: string;
@@ -2273,7 +2348,7 @@ declare const SessionForkSeedSchema: s.Schema<{
2273
2348
  id: string;
2274
2349
  expiresAt?: number | undefined;
2275
2350
  pollAfterMs?: number | undefined;
2276
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
2351
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
2277
2352
  } | undefined;
2278
2353
  errorMessage?: string | undefined;
2279
2354
  rawStopReason?: string | undefined;
@@ -2296,7 +2371,7 @@ declare const SessionForkSeedSchema: s.Schema<{
2296
2371
  })[];
2297
2372
  isError: boolean;
2298
2373
  timestamp: number;
2299
- details?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
2374
+ details?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
2300
2375
  usage?: {
2301
2376
  input: number;
2302
2377
  output: number;
@@ -2331,6 +2406,9 @@ type SessionForkSeed = Readonly<Omit<SessionForkedPayload, 'conversation'>> & {
2331
2406
  };
2332
2407
  //#endregion
2333
2408
  //#region src/session/history/effective-conversation.d.ts
2409
+ type CommittedCompaction$1 = Extract<JournalFact, {
2410
+ kind: 'compaction.committed';
2411
+ }>;
2334
2412
  /**
2335
2413
  * Complete model-eligible exchanges at a committed Journal prefix, including
2336
2414
  * compaction summaries. Unlike committedConversationMessages, this respects
@@ -2350,7 +2428,23 @@ interface HistoryScope {
2350
2428
  readonly requestBase: (requestBaseId: string) => ModelRequestBaseFact | undefined;
2351
2429
  /** Complete named states of an applied request, as its reuse chain expands to. */
2352
2430
  readonly namedStates: (modelRequestId: string) => ContextSnapshot['namedStates'] | undefined;
2431
+ /**
2432
+ * Named-state floor recorded inside the scoped compaction fact. Scoped reconstruction
2433
+ * re-emits these frames instead of replaying pre-boundary named-state evidence.
2434
+ */
2435
+ readonly stateBaseline?: readonly CompactionStateBaselineEntry[];
2436
+ }
2437
+ interface EffectiveConversationProjection {
2438
+ readonly committedCompaction?: CommittedCompaction$1;
2439
+ readonly inheritedEntries: readonly ConversationEntry[];
2440
+ readonly entries: readonly ConversationEntry[];
2441
+ readonly effectiveEntries: readonly ConversationEntry[];
2353
2442
  }
2443
+ /** Rebuilds the effective conversation without changing canonical Journal history. */
2444
+ declare function projectEffectiveConversation(facts: readonly JournalFact[], options?: {
2445
+ readonly scope?: HistoryScope;
2446
+ readonly integrity?: HistoryIntegrityMode;
2447
+ }): EffectiveConversationProjection;
2354
2448
  //#endregion
2355
2449
  //#region src/session/compaction/blocks.d.ts
2356
2450
  interface SkeletonBlock {
@@ -2437,7 +2531,7 @@ declare function projectedMessagesAfterCompaction(summary: string, retainedTail:
2437
2531
  type: "toolCall";
2438
2532
  id: string;
2439
2533
  name: string;
2440
- arguments: Record<string, _sorbetai_schema30.JsonValue>;
2534
+ arguments: Record<string, _sorbetai_schema54.JsonValue>;
2441
2535
  thoughtSignature?: string | undefined;
2442
2536
  argumentsError?: string | undefined;
2443
2537
  })[];
@@ -2474,7 +2568,7 @@ declare function projectedMessagesAfterCompaction(summary: string, retainedTail:
2474
2568
  stack?: string | undefined;
2475
2569
  code?: string | number | undefined;
2476
2570
  } | undefined;
2477
- details?: Record<string, _sorbetai_schema30.JsonValue> | undefined;
2571
+ details?: Record<string, _sorbetai_schema54.JsonValue> | undefined;
2478
2572
  }[] | undefined;
2479
2573
  deferred?: {
2480
2574
  provider: string;
@@ -2483,7 +2577,7 @@ declare function projectedMessagesAfterCompaction(summary: string, retainedTail:
2483
2577
  id: string;
2484
2578
  expiresAt?: number | undefined;
2485
2579
  pollAfterMs?: number | undefined;
2486
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
2580
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
2487
2581
  } | undefined;
2488
2582
  errorMessage?: string | undefined;
2489
2583
  rawStopReason?: string | undefined;
@@ -2506,7 +2600,7 @@ declare function projectedMessagesAfterCompaction(summary: string, retainedTail:
2506
2600
  })[];
2507
2601
  isError: boolean;
2508
2602
  timestamp: number;
2509
- details?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
2603
+ details?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
2510
2604
  usage?: {
2511
2605
  input: number;
2512
2606
  output: number;
@@ -2943,13 +3037,13 @@ declare const ScheduleInputSchema: s.Schema<{
2943
3037
  })[];
2944
3038
  source: {
2945
3039
  kind: string;
2946
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
3040
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
2947
3041
  };
2948
3042
  } | {
2949
3043
  kind: "context-event";
2950
3044
  source: {
2951
3045
  kind: string;
2952
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
3046
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
2953
3047
  };
2954
3048
  contextSources: ({
2955
3049
  lifecycle: "turn";
@@ -2998,7 +3092,7 @@ declare const ScheduleInputSchema: s.Schema<{
2998
3092
  kind: "container";
2999
3093
  name: string;
3000
3094
  attributes?: Record<string, string | number>;
3001
- children: _sorbetai_context56.ContextXmlElement[];
3095
+ children: _sorbetai_context43.ContextXmlElement[];
3002
3096
  };
3003
3097
  sourceId: string;
3004
3098
  provenance: {
@@ -3006,7 +3100,7 @@ declare const ScheduleInputSchema: s.Schema<{
3006
3100
  label: string;
3007
3101
  location?: string | undefined;
3008
3102
  };
3009
- metadata?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
3103
+ metadata?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
3010
3104
  })[];
3011
3105
  };
3012
3106
  whenBusy: "followUp" | "steer";
@@ -3027,13 +3121,13 @@ declare const ScheduleInputSchema: s.Schema<{
3027
3121
  })[];
3028
3122
  source: {
3029
3123
  kind: string;
3030
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
3124
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
3031
3125
  };
3032
3126
  } | {
3033
3127
  kind: "context-event";
3034
3128
  source: {
3035
3129
  kind: string;
3036
- data?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
3130
+ data?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
3037
3131
  };
3038
3132
  contextSources: ({
3039
3133
  lifecycle: "turn";
@@ -3082,7 +3176,7 @@ declare const ScheduleInputSchema: s.Schema<{
3082
3176
  kind: "container";
3083
3177
  name: string;
3084
3178
  attributes?: Record<string, string | number>;
3085
- children: _sorbetai_context56.ContextXmlElement[];
3179
+ children: _sorbetai_context43.ContextXmlElement[];
3086
3180
  };
3087
3181
  sourceId: string;
3088
3182
  provenance: {
@@ -3090,15 +3184,15 @@ declare const ScheduleInputSchema: s.Schema<{
3090
3184
  label: string;
3091
3185
  location?: string | undefined;
3092
3186
  };
3093
- metadata?: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null | undefined;
3187
+ metadata?: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null | undefined;
3094
3188
  })[];
3095
3189
  };
3096
3190
  whenBusy: "followUp" | "steer";
3097
3191
  } | {
3098
3192
  kind: "task";
3099
- input: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
3100
- taskKind: string;
3101
3193
  version: number;
3194
+ input: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
3195
+ taskKind: string;
3102
3196
  };
3103
3197
  }>;
3104
3198
  /**
@@ -3158,15 +3252,18 @@ interface StartRunInput {
3158
3252
  }
3159
3253
  type StartContinuationInput = Omit<StartRunInput, 'forkSeed'>;
3160
3254
  /**
3161
- * A trusted Unit owner can stage durable changes alongside a successful model response.
3255
+ * A trusted Unit owner can stage durable changes alongside model requests and successful responses.
3162
3256
  * Request sources are captured before dispatch; the receipt receives a copy of that
3163
3257
  * committed snapshot and model-visible Tool results after the last assistant message.
3164
3258
  */
3165
3259
  interface UnitModelContext {
3166
3260
  /** Supplies material for one logical request. Physical retries reuse captured sources. */
3167
3261
  read?(signal: AbortSignal): Promise<readonly RequestContextSource[]>;
3262
+ /** Runs in the request's atomic group, before dispatch, with the full snapshot before reuse compaction.
3263
+ * Physical retries reuse this commit. This hook must not perform external I/O. */
3264
+ stageRequest?(tx: UnitTx, snapshot: ContextSnapshot, modelRequestId: string): void;
3168
3265
  /** Runs synchronously in the response's atomic group; it must not perform external I/O. */
3169
- stage(tx: UnitTx, snapshot: ContextSnapshot, modelRequestId: string, toolResults: readonly {
3266
+ stage?(tx: UnitTx, snapshot: ContextSnapshot, modelRequestId: string, toolResults: readonly {
3170
3267
  readonly toolName: string;
3171
3268
  readonly isError: boolean;
3172
3269
  readonly text: readonly string[];
@@ -3285,6 +3382,11 @@ declare class SessionExternalTools {
3285
3382
  //#region src/session/fork-snapshot.d.ts
3286
3383
  interface ProjectSessionForkSeedOptions {
3287
3384
  readonly sourceRunId?: string;
3385
+ /**
3386
+ * 'relocate' (default) moves an invalid Run-terminal cut to the nearest earlier
3387
+ * valid boundary; 'refuse' throws HistoryIntegrityError instead.
3388
+ */
3389
+ readonly onInvalidCut?: 'relocate' | 'refuse';
3288
3390
  }
3289
3391
  /**
3290
3392
  * Projects a self-contained seed. The caller supplies an ordered, durable,
@@ -3304,6 +3406,20 @@ interface ConversationDelta {
3304
3406
  type CommittedCompaction = Extract<JournalFact, {
3305
3407
  kind: 'compaction.committed';
3306
3408
  }>;
3409
+ type ModelRequestedFact$1 = Extract<JournalFact, {
3410
+ kind: 'model.requested';
3411
+ }>;
3412
+ /**
3413
+ * The committed request's resolved incremental evidence, used to seed the next
3414
+ * request's dedup without replaying request facts. Rebuilt on every applied
3415
+ * `model.requested` and cleared on epoch boundaries, so it survives reopen and
3416
+ * tracks the request the model actually saw.
3417
+ */
3418
+ interface RequestIncrementSeed {
3419
+ readonly modelRequestId: string;
3420
+ readonly namedStates: ContextSnapshot['namedStates'];
3421
+ readonly conversationSources: NonNullable<ModelRequestedFact$1['payload']['conversationSources']>;
3422
+ }
3307
3423
  /** Incremental, reconstructible Session projections fed only by durable facts. */
3308
3424
  declare class SessionHistoryProjection {
3309
3425
  #private;
@@ -3324,10 +3440,21 @@ declare class SessionHistoryProjection {
3324
3440
  contextSnapshot(fact: Extract<JournalFact, {
3325
3441
  kind: 'model.requested';
3326
3442
  }>): ContextSnapshot;
3443
+ /**
3444
+ * The incremental evidence of the latest committed request, for seeding the
3445
+ * next request's named-state and conversation-source dedup. Rebuilt from
3446
+ * durable facts on replay, so it is correct after reopen; cleared across
3447
+ * context epochs where reuse chains end.
3448
+ */
3449
+ latestRequestSeed(): RequestIncrementSeed | undefined;
3327
3450
  resolveConversationReference(reference: ConversationEntryReference): ConversationEntry;
3328
3451
  estimateRequestContextTokens(fact: Extract<JournalFact, {
3329
3452
  kind: 'model.requested';
3330
3453
  }>): number;
3454
+ /**
3455
+ * The latest request's materialized named states with its identity, so a resumed
3456
+ * execution can seed incremental compaction without replaying request evidence.
3457
+ */
3331
3458
  requestContextEstimate(fact: Extract<JournalFact, {
3332
3459
  kind: 'model.requested';
3333
3460
  }>): () => number;
@@ -3468,32 +3595,6 @@ declare class SessionInputInclusionProjection {
3468
3595
  reset(): void;
3469
3596
  }
3470
3597
  //#endregion
3471
- //#region src/session/history/recovery.d.ts
3472
- /** Tracks outstanding durable identities without retaining terminal payloads. */
3473
- declare class SessionRecoveryProjection {
3474
- #private;
3475
- apply(fact: JournalRecoveryFact): boolean;
3476
- snapshot(sessionId: string): SessionRecoveryObservation;
3477
- reset(): void;
3478
- /** Durable folded state so a later process can resume a scan instead of re-reading. */
3479
- toJSON(): {
3480
- sessionId: string | undefined;
3481
- sequence: number;
3482
- cursor: string | undefined;
3483
- runs: string[];
3484
- models: string[];
3485
- compactionModels: string[];
3486
- effects: string[];
3487
- compactions: string[];
3488
- unknownModels: number;
3489
- unknownEffects: number;
3490
- };
3491
- /** Restores a projection folded by an earlier scan; the Journal prefix it covers is trusted. */
3492
- static fromJSON(state: ReturnType<SessionRecoveryProjection['toJSON']>): SessionRecoveryProjection;
3493
- }
3494
- /** Projects durable uncertainty without opening a Session, acquiring ownership or performing recovery. */
3495
- declare function projectSessionRecovery(sessionId: string, facts: readonly JournalRecoveryFact[]): SessionRecoveryObservation;
3496
- //#endregion
3497
3598
  //#region src/session/inspection/context-attribution.d.ts
3498
3599
  interface ModelRequestContextSourceEstimate extends ModelRequestDispatchPart {
3499
3600
  readonly characterCount?: number;
@@ -3763,7 +3864,7 @@ declare function capturePluginRecordInput(owner: PluginRecordOwner, input: Appen
3763
3864
  input: {
3764
3865
  recordType: string;
3765
3866
  recordVersion: number;
3766
- data: string | number | boolean | _sorbetai_schema30.JsonArray | _sorbetai_schema30.JsonObject | null;
3867
+ data: string | number | boolean | _sorbetai_schema54.JsonArray | _sorbetai_schema54.JsonObject | null;
3767
3868
  expectedRevision: number;
3768
3869
  sourceSequence: number;
3769
3870
  idempotencyKey?: string | undefined;
@@ -3913,14 +4014,6 @@ interface OutboxRecord extends MessageIntent {
3913
4014
  } | MessageReceipt | MessageRejection;
3914
4015
  }
3915
4016
  //#endregion
3916
- //#region src/units/catalog.d.ts
3917
- type UnitSession = Extract<UnitFact, {
3918
- kind: 'session.created';
3919
- }>['payload'] & {
3920
- readonly closing: boolean;
3921
- readonly closed: boolean;
3922
- };
3923
- //#endregion
3924
4017
  //#region src/units/recovery.d.ts
3925
4018
  /**
3926
4019
  * Acquires the same configured execution facade used for interactive work. The
@@ -4077,6 +4170,11 @@ declare class UnitRuntime {
4077
4170
  notifyAvailable(sessionId: string): Promise<void>;
4078
4171
  /** Owner-local recovery decisions alongside committed, tree-wide Effect uncertainty. */
4079
4172
  recovery(): UnitRecoverySnapshot;
4173
+ /**
4174
+ * Recovery folded from this owner's own commits, so a census over an owned Unit reads memory
4175
+ * instead of re-decoding its Journal. Sessions not yet observed have a zeroed snapshot.
4176
+ */
4177
+ recoverySnapshot(sessionId: string): SessionRecoveryObservation;
4080
4178
  /**
4081
4179
  * Observes completion of each Session acquisition/admission pass, including
4082
4180
  * unavailable or faulted passes. This is not Run completion. No initial replay;
@@ -4241,5 +4339,5 @@ declare class UnitRuntime {
4241
4339
  close(): Promise<void>;
4242
4340
  }
4243
4341
  //#endregion
4244
- export { type AppendPluginRecord, type ApprovalComposition, type ApprovalMode, ApprovalModeSchema, type ApprovalResolver, type ApprovalReviewDecision, ApprovalReviewDecisionSchema, type ApprovalReviewObservation, type ApprovalReviewRequest, type ApprovalReviewer, type ApprovalReviewerDecision, CommittedConversationMessage, CompactSessionOptions, CompactionAttemptUsage, type CompactionDispatchRequest, type CompactionDispatchResult, type CompactionModel, type CompactionModelObservation, type CompactionObservation, type CompactionProviderObservation, CompactionResult, CompactionSettings, type CompactionSourceFallbackObservation, CompactionWorkflowError, CompleteModelInput, CompleteModelOptions, type ContextAttributionObservation, type ContextAttributionSection, type ContextCapacityObservation, ContextEventSessionInput, type ContextForkSeed, ContextForkSeedSchema, type ContextPreparationObservation, type ContextSectionEstimate, type ContextualTool, ContinuationReplayPlan, ContinuationReplayPlanSchema, type ConversationEntry, type CreateTaskOptions, type CreateUnitSession, DEFAULT_MAX_TOOL_OUTPUT_TOKENS, type DiscoverableTool, type DurableSubmission, type EffectObservation, type ElicitationCapabilities, ElicitationCapabilitiesSchema, type ElicitationComposition, type ElicitationContentValue, ElicitationContentValueSchema, type ElicitationForm, ElicitationFormSchema, type ElicitationInvocationContext, type ElicitationProperty, ElicitationPropertySchema, type ElicitationRequest, ElicitationRequestSchema, type ElicitationResponse, ElicitationResponseSchema, ElicitationUnavailableError, type HistoryScope, type InvokeToolInput, type InvokeToolOptions, JOURNAL_FACT_SCHEMA_VERSION, type JoinPolicy, type JournalAppendOptions, type JournalBatchObservation, JournalConflictError, JournalCorruptionError, type JournalCursor, JournalCursorGapError, JournalCursorSchema, type JournalFact, type JournalFactKind, JournalFactSchema, JournalGroupDependencyError, type JournalPage, type JournalProjectionObservation, type JournalQueueObservation, type JournalReadOptions, JournalReaderCapacityError, JournalReaderResetRequiredError, type JournalRecoveryFact, type JournalReopenObservation, DurableRun as JournalRunHandle, type JournalStore, JournalStoreFaultError, type JournalSubscription, type JournalSubscriptionOptions, type JournalWrite, JournalWriterBusyError, type JsonValue, JsonValueSchema, MemoryUnitStore, type MessageDeliveryResult, type MessageDraft, type MessageReceipt, type MessageRejection, type ModelAttemptObservation, type ModelContextEstimateEvent, type ModelDispatchObservation, ModelInvocationReceipt, ModelInvocationUnknownError, type ModelProviderObservation, type ModelRequestContentOrigin, ModelRequestContextAttribution, ModelRequestContextSourceEstimate, type ModelRequestInspection, type ModelRequestMessageInspection, type ModelRequestToolInspection, type ModelRequestedFact, type ModelRetryEndEvent, type ModelRetryObservation, ModelRetryPolicy, type ModelRetryStartEvent, type ModelRetryWaitObservation, type ModelUnknownObservation, type ModelUsageEvent, type NewJournalFact, type NextState, type ObservationTraceContext, type OpenUnitOptions, type OpenedUnitStore, type PermissionComposition, type PermissionGrant, PermissionGrantNotFoundError, PermissionGrantSchema, type PermissionScalar, PermissionScalarSchema, type PlacedRunInput, PluginRecord, PluginRecordConflictError, type PluginRecordOwner, type PluginRecordPayload, type ProjectRequestContextOptions, ProjectSessionForkSeedOptions, type ProjectedRequestContext, type ReconstructedModelRequest, ResumeInterruptedRunOptions, RunAcceptedReceipt, RunAdmissionConflictError, type RunAdmittedObservation, RunCancellationReceipt, type RunDrainObservation, type RunExecutionObservation, RunExecutionResource, RunExecutionResourceProvider, type RunFailureCode, RunFailureCodeSchema, type RunInput, RunInputAcceptedReceipt, RunInputPlacementReceipt, RunInputProjection, type RunInspection, type RunJournalFact, type RunJournalFactKind, type RunLiveEvent, RunLiveEventHub, type RunLiveEventSubscription, type RunResourceWaitObservation, type RunSettledObservation, type RunStatus, RunSubscription, type RunTerminalOutcome, type RunView, type RunningTask, type RuntimeObservationPort, type ScheduleInput, type SendMessageOptions, SendSessionInput, SendSessionInputOptions, SendSessionInputSchema, SendSessionInputVariants, type SentMessage, SessionApprovalReviewer, SessionArtifactIndex, SessionBehaviorSnapshot, SessionBehaviors, SessionBusyError, SessionCompactionBusyError, SessionContextCapacityError, SessionExternalTools, SessionForkBusyError, SessionForkSeed, SessionForkSeedSchema, SessionHistoryProjection, SessionInputAcceptedReceipt, SessionInputConflictError, SessionInputInclusion, SessionInputInclusionProjection, type SessionInputSource, SessionInputSourceSchema, SessionInputSubmission, SessionInspection, type SessionInspectionContentPolicy, type SessionInspectionOptions, type SessionJournalFact, type SessionJournalFactKind, SessionModelInvocations, SessionObjectCapabilities, type SessionParticipants, type SessionPermissionGrant, SessionPermissionGrantSchema, SessionPromptCacheInspection, SessionProviderUsageEntry, type SessionRecoveryObservation, SessionRecoveryProjection, SessionRunActiveError, SessionToolDiscovery, SessionTurnUsage, SessionUsageProjection, SessionUsageSnapshot, type SignalRecord, SorbetRun, type SqliteUnitDatabase, SqliteUnitStore, type SqliteUnitStoreOptions, type SqliteValue, StartContinuationInput, StartRunInput, StartRunOptions, type StoredToolOutputFile, SubmissionControlInputSchema, SubmissionInputSchema, TaskContractError, type TaskDefinition, type TaskHandle, type TaskOutcome, type TaskRecord, type TaskRuntime, type ToolApprovalInspection, type ToolApprovalRequirement, ToolApprovalRequirementSchema, type ToolCallInspection, type ToolDefinition, type ToolDiscoveryMetadata, type ToolEffectInspection, type ToolExecutionObservation, type ToolExecutionStartedObservation, type ToolExposure, ToolHookEvidenceSchema, type ToolInvocationContext, ToolOperationError, type ToolOperationReceipt, type ToolOutputArchiveRecord, ToolOutputArchiveRecordSchema, ToolOutputArchiver, type ToolOutputFileStore, type ToolOutputMeasurement, type ToolOutputObservation, type ToolPermissionAccess, ToolPermissionAccessSchema, type ToolPermissionDirective, ToolPermissionDirectiveSchema, type ToolPermissionEvaluator, type ToolPermissionObservation, type ToolPermissionPolicy, type ToolPermissionPolicyEntry, ToolPermissionPolicyEntrySchema, ToolPermissionPolicySchema, type ToolPermissionRequest, type ToolPermissionRule, ToolPermissionRuleSchema, type ToolResult, type ToolResultMessageCommittedPayload, type ToolSearchOptions, ToolSourcesSchema, type ToolUpdateCallback, type UnitCloseResult, type UnitCommitOutcome, type UnitEntry, type UnitEpoch, type UnitFact, UnitFactSchema, UnitHistoryError, type UnitHistoryErrorCode, type UnitInspectionPage, type UnitMessage, UnitMessageSchema, UnitModelContext, type UnitOpenOptions, type UnitPage, type UnitReadOptions, type UnitReader, type UnitRecord, type UnitRecoverySnapshot, type UnitRecoveryState, UnitRuntime, type UnitSession, type UnitSessionProvider, type UnitStorage, type UnitStorageWrite, type UnitStore, type UnitStoreConformanceFixture, type UnitStoreConformanceHarness, UnitStoreError, type UnitSubscription, type UnitTransaction, type UnitTx, type UnitWorkSummary, type UnitWrite, type UserPrompt, UserPromptSchema, UserSessionInput, type WaitIdentityObservation, type WaitMember, type WaitSettledObservation, type WaitStartedObservation, appendPluginRecord, buildContinuationReplayPlan, capturePluginRecordInput, committedConversationMessages, compactModelRequestContextSnapshot, contextHistorySnapshot, conversationEntries, createArtifactTool, createContextForkSeed, createRequestUserInputTool, defineTask, effectiveConversationEntries, estimateContextTokens, estimateMessageTokens, estimateMessagesTokens, evaluateToolPermissionPolicy, executeCompactionWorkflow, expandModelRequestContextSnapshot, inspectRunHistory, isRunTerminalFactKind, limitToolOutput, materializeModelRequestContextSnapshot, observeRuntime, openUnitStorage, parseToolParameters, planSessionCompaction, pluginPrefixSources, prepareModelRequestBase, prepareSessionCompaction, projectModelRequestDispatch, projectModelView, projectPermissionGrants, projectRequestContext, projectSessionForkSeed, projectSessionInspection, projectSessionProviderUsage, projectSessionRecovery, projectToolResultObservations, projectUnknownEffectResult, projectedMessagesAfterCompaction, readObservationTraceContext, readUnitWorkSummary, reconstructModelRequest, registerUnitStoreConformance, requestElicitation, shouldCompact, validateCompactionSettings };
4342
+ export { type AppendPluginRecord, type ApprovalComposition, type ApprovalMode, ApprovalModeSchema, type ApprovalResolver, type ApprovalReviewDecision, ApprovalReviewDecisionSchema, type ApprovalReviewObservation, type ApprovalReviewRequest, type ApprovalReviewer, type ApprovalReviewerDecision, CommittedConversationMessage, CompactSessionOptions, CompactionAttemptUsage, type CompactionDispatchRequest, type CompactionDispatchResult, type CompactionModel, type CompactionModelObservation, type CompactionObservation, type CompactionProviderObservation, CompactionResult, CompactionSettings, type CompactionSourceFallbackObservation, type CompactionStateBaselineEntry, CompactionStateBaselineEntrySchema, CompactionWorkflowError, CompleteModelInput, CompleteModelOptions, type ContextAttributionObservation, type ContextAttributionSection, type ContextCapacityObservation, ContextEventSessionInput, type ContextForkSeed, ContextForkSeedSchema, type ContextPreparationObservation, type ContextSectionEstimate, type ContextualTool, ContinuationReplayPlan, ContinuationReplayPlanSchema, type ConversationEntry, type CreateTaskOptions, type CreateUnitSession, DEFAULT_MAX_TOOL_OUTPUT_TOKENS, type DiscoverableTool, type DurableSubmission, type EffectObservation, EffectiveConversationProjection, type ElicitationCapabilities, ElicitationCapabilitiesSchema, type ElicitationComposition, type ElicitationContentValue, ElicitationContentValueSchema, type ElicitationForm, ElicitationFormSchema, type ElicitationInvocationContext, type ElicitationProperty, ElicitationPropertySchema, type ElicitationRequest, ElicitationRequestSchema, type ElicitationResponse, ElicitationResponseSchema, ElicitationUnavailableError, type HistoryBoundaryVerdict, HistoryIntegrityError, type HistoryIntegrityMode, type HistoryIntegrityViolation, type HistoryIntegrityViolationReason, type HistoryScope, type InvokeToolInput, type InvokeToolOptions, JOURNAL_FACT_SCHEMA_VERSION, type JoinPolicy, type JournalAppendOptions, type JournalBatchObservation, JournalConflictError, JournalCorruptionError, type JournalCursor, JournalCursorGapError, JournalCursorSchema, type JournalFact, type JournalFactKind, JournalFactSchema, JournalGroupDependencyError, type JournalPage, type JournalProjectionObservation, type JournalQueueObservation, type JournalReadOptions, JournalReaderCapacityError, JournalReaderResetRequiredError, type JournalRecoveryFact, type JournalReopenObservation, DurableRun as JournalRunHandle, type JournalStore, JournalStoreFaultError, type JournalSubscription, type JournalSubscriptionOptions, type JournalWrite, JournalWriterBusyError, type JsonValue, JsonValueSchema, MemoryUnitStore, type MessageDeliveryResult, type MessageDraft, type MessageReceipt, type MessageRejection, type ModelAttemptObservation, type ModelContextEstimateEvent, type ModelDispatchObservation, ModelInvocationReceipt, ModelInvocationUnknownError, type ModelProviderObservation, type ModelRequestContentOrigin, ModelRequestContextAttribution, ModelRequestContextSourceEstimate, type ModelRequestInspection, type ModelRequestMessageInspection, type ModelRequestToolInspection, type ModelRequestedFact, type ModelRetryEndEvent, type ModelRetryObservation, ModelRetryPolicy, type ModelRetryStartEvent, type ModelRetryWaitObservation, type ModelUnknownObservation, type ModelUsageEvent, type NewJournalFact, type NextState, type ObservationTraceContext, type OpenUnitOptions, type OpenedUnitStore, type PermissionComposition, type PermissionGrant, PermissionGrantNotFoundError, PermissionGrantSchema, type PermissionScalar, PermissionScalarSchema, type PlacedRunInput, PluginRecord, PluginRecordConflictError, type PluginRecordOwner, type PluginRecordPayload, type ProjectRequestContextOptions, ProjectSessionForkSeedOptions, type ProjectedRequestContext, type ReconstructedModelRequest, type RequestIncrementSeed, ResumeInterruptedRunOptions, RunAcceptedReceipt, RunAdmissionConflictError, type RunAdmittedObservation, RunCancellationReceipt, type RunDrainObservation, type RunExecutionObservation, RunExecutionResource, RunExecutionResourceProvider, type RunFailureCode, RunFailureCodeSchema, type RunInput, RunInputAcceptedReceipt, RunInputPlacementReceipt, RunInputProjection, type RunInspection, type RunJournalFact, type RunJournalFactKind, type RunLiveEvent, RunLiveEventHub, type RunLiveEventSubscription, type RunResourceWaitObservation, type RunSettledObservation, type RunStatus, RunSubscription, type RunTerminalOutcome, type RunView, type RunningTask, type RuntimeObservationPort, type ScheduleInput, type SendMessageOptions, SendSessionInput, SendSessionInputOptions, SendSessionInputSchema, SendSessionInputVariants, type SentMessage, SessionApprovalReviewer, SessionArtifactIndex, SessionBehaviorSnapshot, SessionBehaviors, SessionBusyError, SessionCompactionBusyError, SessionContextCapacityError, SessionExternalTools, SessionForkBusyError, SessionForkSeed, SessionForkSeedSchema, SessionHistoryProjection, SessionInputAcceptedReceipt, SessionInputConflictError, SessionInputInclusion, SessionInputInclusionProjection, type SessionInputSource, SessionInputSourceSchema, SessionInputSubmission, SessionInspection, type SessionInspectionContentPolicy, type SessionInspectionOptions, type SessionJournalFact, type SessionJournalFactKind, SessionModelInvocations, SessionObjectCapabilities, type SessionParticipants, type SessionPermissionGrant, SessionPermissionGrantSchema, SessionPromptCacheInspection, SessionProviderUsageEntry, type SessionRecoveryObservation, SessionRecoveryProjection, SessionRunActiveError, SessionToolDiscovery, SessionTurnUsage, SessionUsageProjection, SessionUsageSnapshot, type SignalRecord, SorbetRun, type SqliteUnitDatabase, SqliteUnitStore, type SqliteUnitStoreOptions, type SqliteValue, StartContinuationInput, StartRunInput, StartRunOptions, type StoredToolOutputFile, SubmissionControlInputSchema, SubmissionInputSchema, TaskContractError, type TaskDefinition, type TaskHandle, type TaskOutcome, type TaskRecord, type TaskRuntime, type ToolApprovalInspection, type ToolApprovalRequirement, ToolApprovalRequirementSchema, type ToolCallInspection, type ToolDefinition, type ToolDiscoveryMetadata, type ToolEffectInspection, type ToolExecutionObservation, type ToolExecutionStartedObservation, type ToolExposure, ToolHookEvidenceSchema, type ToolInvocationContext, ToolOperationError, type ToolOperationReceipt, type ToolOutputArchiveRecord, ToolOutputArchiveRecordSchema, ToolOutputArchiver, type ToolOutputFileStore, type ToolOutputMeasurement, type ToolOutputObservation, type ToolPermissionAccess, ToolPermissionAccessSchema, type ToolPermissionDirective, ToolPermissionDirectiveSchema, type ToolPermissionEvaluator, type ToolPermissionObservation, type ToolPermissionPolicy, type ToolPermissionPolicyEntry, ToolPermissionPolicyEntrySchema, ToolPermissionPolicySchema, type ToolPermissionRequest, type ToolPermissionRule, ToolPermissionRuleSchema, type ToolResult, type ToolResultMessageCommittedPayload, type ToolSearchOptions, ToolSourcesSchema, type ToolUpdateCallback, type UnitCloseResult, type UnitCommitOutcome, type UnitEntry, type UnitEpoch, type UnitFact, UnitFactSchema, UnitHistoryError, type UnitHistoryErrorCode, type UnitInspectionPage, type UnitMessage, UnitMessageSchema, UnitModelContext, type UnitOpenOptions, type UnitPage, type UnitReadOptions, type UnitReader, type UnitRecord, type UnitRecoverySnapshot, type UnitRecoveryState, UnitRuntime, type UnitSession, type UnitSessionProvider, type UnitStorage, type UnitStorageWrite, type UnitStore, type UnitStoreConformanceFixture, type UnitStoreConformanceHarness, UnitStoreError, type UnitSubscription, type UnitTransaction, type UnitTx, type UnitWorkSummary, type UnitWrite, type UserPrompt, UserPromptSchema, UserSessionInput, type WaitIdentityObservation, type WaitMember, type WaitSettledObservation, type WaitStartedObservation, appendPluginRecord, assertHistoryIntegrity, buildContinuationReplayPlan, capturePluginRecordInput, committedConversationMessages, compactModelRequestContextSnapshot, contextHistorySnapshot, conversationEntries, createArtifactTool, createContextForkSeed, createRequestUserInputTool, defineTask, effectiveConversationEntries, estimateContextTokens, estimateMessageTokens, estimateMessagesTokens, evaluateToolPermissionPolicy, executeCompactionWorkflow, expandModelRequestContextSnapshot, inspectHistoryIntegrity, inspectRunHistory, isRunTerminalFactKind, limitToolOutput, materializeModelRequestContextSnapshot, observeRuntime, openUnitStorage, parseToolParameters, planSessionCompaction, pluginPrefixSources, prepareModelRequestBase, prepareSessionCompaction, projectEffectiveConversation, projectModelRequestDispatch, projectModelView, projectPermissionGrants, projectRequestContext, projectSessionForkSeed, projectSessionInspection, projectSessionProviderUsage, projectSessionRecovery, projectToolResultObservations, projectUnknownEffectResult, projectedMessagesAfterCompaction, readObservationTraceContext, readPagesToEnd, readUnitWorkSummary, reconstructModelRequest, registerUnitStoreConformance, relocateHistoryBoundary, requestElicitation, shouldCompact, validateCompactionSettings, validateHistoryBoundary };
4245
4343
  //# sourceMappingURL=index.d.ts.map