@opencode/schema 0.0.0-dev-21269 → 0.0.0-dev-21289

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.
@@ -312,7 +312,7 @@ export var Step;
312
312
  assistantMessageID: SessionMessage.ID,
313
313
  finish: FinishReason,
314
314
  rawFinish: Schema.String.pipe(optional),
315
- providerState: SessionMessage.ProviderState.pipe(optional),
315
+ native: SessionMessage.Native.pipe(optional),
316
316
  cost: Money.USD,
317
317
  tokens: TokenUsage.Info,
318
318
  snapshot: Snapshot.ID.pipe(optional),
@@ -328,7 +328,7 @@ export var Step;
328
328
  error: SessionError.Error,
329
329
  finish: Schema.Literals(["content-filter"]).pipe(optional),
330
330
  rawFinish: Schema.String.pipe(optional),
331
- providerState: SessionMessage.ProviderState.pipe(optional),
331
+ native: SessionMessage.Native.pipe(optional),
332
332
  cost: Money.USD.pipe(optional),
333
333
  tokens: TokenUsage.Info.pipe(optional),
334
334
  snapshot: Snapshot.ID.pipe(optional),
@@ -365,7 +365,7 @@ export var Text;
365
365
  assistantMessageID: SessionMessage.ID,
366
366
  ordinal: NonNegativeInt,
367
367
  text: Schema.String,
368
- state: SessionMessage.ProviderState.pipe(optional),
368
+ native: SessionMessage.Native.pipe(optional),
369
369
  },
370
370
  });
371
371
  })(Text || (Text = {}));
@@ -378,7 +378,7 @@ export var Reasoning;
378
378
  ...Base,
379
379
  assistantMessageID: SessionMessage.ID,
380
380
  ordinal: NonNegativeInt,
381
- state: SessionMessage.ProviderState.pipe(optional),
381
+ native: SessionMessage.Native.pipe(optional),
382
382
  },
383
383
  });
384
384
  // Stream fragments are live-only; Reasoning.Ended is the replayable full-value boundary.
@@ -399,7 +399,7 @@ export var Reasoning;
399
399
  assistantMessageID: SessionMessage.ID,
400
400
  ordinal: NonNegativeInt,
401
401
  text: Schema.String,
402
- state: SessionMessage.ProviderState.pipe(optional),
402
+ native: SessionMessage.Native.pipe(optional),
403
403
  },
404
404
  });
405
405
  })(Reasoning || (Reasoning = {}));
@@ -444,7 +444,7 @@ export var Tool;
444
444
  ...ToolBase,
445
445
  input: Schema.Record(Schema.String, Schema.Unknown),
446
446
  executed: Schema.Boolean,
447
- state: SessionMessage.ProviderState.pipe(optional),
447
+ native: SessionMessage.Native.pipe(optional),
448
448
  },
449
449
  });
450
450
  /** Live replacement metadata for a running tool. */
@@ -467,7 +467,7 @@ export var Tool;
467
467
  content: Schema.NonEmptyArray(Content),
468
468
  metadata: Schema.Record(Schema.String, Schema.Json).pipe(optional),
469
469
  executed: Schema.Boolean,
470
- resultState: SessionMessage.ProviderState.pipe(optional),
470
+ native: SessionMessage.Native.pipe(optional),
471
471
  },
472
472
  });
473
473
  /**
@@ -487,7 +487,7 @@ export var Tool;
487
487
  content: Schema.NonEmptyArray(Content).pipe(optional),
488
488
  metadata: Schema.Record(Schema.String, Schema.Json).pipe(optional),
489
489
  executed: Schema.Boolean,
490
- resultState: SessionMessage.ProviderState.pipe(optional),
490
+ native: SessionMessage.Native.pipe(optional),
491
491
  },
492
492
  });
493
493
  })(Tool || (Tool = {}));
@@ -510,7 +510,6 @@ export var Compaction;
510
510
  schema: {
511
511
  ...Base,
512
512
  reason: Schema.Literals(["auto", "manual"]),
513
- recent: Schema.String,
514
513
  inputID: SessionMessage.ID.pipe(optional),
515
514
  },
516
515
  });
@@ -528,10 +527,8 @@ export var Compaction;
528
527
  ...Base,
529
528
  reason: Compaction.Started.data.fields.reason,
530
529
  model: SessionMessage.CompactionCompleted.fields.model,
531
- providerState: SessionMessage.CompactionCompleted.fields.providerState,
532
- providerContext: SessionMessage.CompactionCompleted.fields.providerContext,
530
+ native: SessionMessage.CompactionCompleted.fields.native,
533
531
  text: Schema.String,
534
- recent: Schema.String,
535
532
  // Repeats the internal `session.usage.recorded` figures: that event never reaches clients, and it
536
533
  // stays the accounting source for session totals and stats.
537
534
  cost: SessionMessage.CompactionCompleted.fields.cost,
@@ -0,0 +1,7 @@
1
+ export * as SessionLegacy from "./session-legacy.js";
2
+ /** Upgrades a durable event payload by event type. */
3
+ export declare function event(type: string, data: unknown): unknown;
4
+ /** Upgrades a projected message's data by message type. */
5
+ export declare function message(type: unknown, data: Record<string, unknown>): Record<string, unknown>;
6
+ /** Upgrades complete messages, such as those in an exported session, before decoding. */
7
+ export declare function messages(values: ReadonlyArray<unknown>): unknown[];
@@ -0,0 +1,118 @@
1
+ export * as SessionLegacy from "./session-legacy.js";
2
+ /**
3
+ * Storage and wire compatibility for current-architecture data written before v2.1 (not V1 contracts). Native data
4
+ * was then named `state` or `providerState`, a tool's result native data `resultState` or `providerResultState`,
5
+ * summary compactions stored the text of the messages they kept in `recent`, and provider compactions stored their
6
+ * replacement window in `providerContext`. Stored events, projected messages, and exported transcripts keep whichever
7
+ * shape they were written with, so these upgrade them before decoding.
8
+ */
9
+ const renames = {
10
+ "session.text.ended": ["state", "native"],
11
+ "session.reasoning.started": ["state", "native"],
12
+ "session.reasoning.ended": ["state", "native"],
13
+ "session.tool.called": ["state", "native"],
14
+ "session.step.ended": ["providerState", "native"],
15
+ "session.step.failed": ["providerState", "native"],
16
+ "session.tool.success": ["resultState", "native"],
17
+ "session.tool.failed": ["resultState", "native"],
18
+ };
19
+ /** Upgrades a durable event payload by event type. */
20
+ export function event(type, data) {
21
+ if (!isRecord(data))
22
+ return data;
23
+ if (type === "session.message.content.updated")
24
+ return content(data);
25
+ // Messages carry a legacy compaction's kept text; its events have no reader for it.
26
+ if (type === "session.compaction.started")
27
+ return omit(data, "recent");
28
+ if (type === "session.compaction.ended")
29
+ return providerContext(omit(rename(data, "providerState", "native"), "recent"));
30
+ const entry = renames[type];
31
+ return entry ? rename(data, entry[0], entry[1]) : data;
32
+ }
33
+ /** Upgrades a projected message's data by message type. */
34
+ export function message(type, data) {
35
+ if (type === "assistant")
36
+ return content(rename(data, "providerState", "native"));
37
+ if (type === "compaction")
38
+ return providerContext(recent(rename(data, "providerState", "native")));
39
+ return data;
40
+ }
41
+ /** Upgrades complete messages, such as those in an exported session, before decoding. */
42
+ export function messages(values) {
43
+ return values.map((value) => (isRecord(value) ? message(value.type, value) : value));
44
+ }
45
+ function content(data) {
46
+ if (!Array.isArray(data.content))
47
+ return data;
48
+ return { ...data, content: data.content.map(part) };
49
+ }
50
+ function part(value) {
51
+ if (!isRecord(value))
52
+ return value;
53
+ if (value.type === "text" || value.type === "reasoning")
54
+ return rename(value, "state", "native");
55
+ // A tool part's own `state` is its lifecycle status, not native data.
56
+ if (value.type === "tool")
57
+ return toolResult(rename(value, "providerState", "native"));
58
+ return value;
59
+ }
60
+ /** Kept text a summary compaction stored before it referenced `metadata.keepID`; replay still reads it. */
61
+ function recent(data) {
62
+ const text = data.recent;
63
+ const rest = omit(data, "recent");
64
+ if (typeof text !== "string" || !text)
65
+ return rest;
66
+ const metadata = isRecord(rest.metadata) ? rest.metadata : {};
67
+ return { ...rest, metadata: { recent: text, ...metadata } };
68
+ }
69
+ /** The window moves to `native.messages`; the `native` stored beside it was never replayed. */
70
+ function providerContext(data) {
71
+ const context = data.providerContext;
72
+ const rest = omit(data, "providerContext");
73
+ if (!isRecord(context))
74
+ return rest;
75
+ return {
76
+ ...rest,
77
+ native: { messages: Array.isArray(context.messages) ? context.messages.map(media) : context.messages },
78
+ };
79
+ }
80
+ /** Before 2.0.15, window media parts stored `mediaType` and base64 `data` directly. */
81
+ function media(message) {
82
+ if (!isRecord(message) || !Array.isArray(message.content))
83
+ return message;
84
+ return {
85
+ ...message,
86
+ content: message.content.map((part) => {
87
+ if (!isRecord(part) || part.type !== "media" || part.media !== undefined || typeof part.data !== "string")
88
+ return part;
89
+ const { mediaType, data, ...rest } = part;
90
+ return { ...rest, media: { source: { type: "base64", data, mediaType } } };
91
+ }),
92
+ };
93
+ }
94
+ function omit(value, key) {
95
+ if (!(key in value))
96
+ return value;
97
+ const { [key]: _, ...rest } = value;
98
+ return rest;
99
+ }
100
+ // Result data now merges into the tool's single `native`, as projection does for current result events.
101
+ function toolResult(value) {
102
+ if (!("providerResultState" in value))
103
+ return value;
104
+ const { providerResultState, ...rest } = value;
105
+ if (!isRecord(providerResultState))
106
+ return rest;
107
+ return { ...rest, native: { ...(isRecord(rest.native) ? rest.native : {}), ...providerResultState } };
108
+ }
109
+ // The current name wins when a payload carries both.
110
+ function rename(value, from, to) {
111
+ if (!(from in value))
112
+ return value;
113
+ const { [from]: moved, ...rest } = value;
114
+ return to in rest ? rest : { ...rest, [to]: moved };
115
+ }
116
+ function isRecord(value) {
117
+ return typeof value === "object" && value !== null && !Array.isArray(value);
118
+ }
@@ -6,8 +6,12 @@ export declare const ID: Schema.brand<Schema.String, "Session.Message.ID"> & {
6
6
  fromEvent: (eventID: Event.ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
7
7
  };
8
8
  export type ID = typeof ID.Type;
9
- export declare const ProviderState: Schema.$Record<Schema.String, Schema.Unknown>;
10
- export type ProviderState = typeof ProviderState.Type;
9
+ /**
10
+ * Provider-owned replay data, keyed by the producing provider's metadata fields and echoed back verbatim. A tool's
11
+ * result data is merged into its call data, so adapters must not reuse a key with a different value across the two.
12
+ */
13
+ export declare const Native: Schema.$Record<Schema.String, Schema.Unknown>;
14
+ export type Native = typeof Native.Type;
11
15
  export interface AgentSelected extends Schema.Schema.Type<typeof AgentSelected> {
12
16
  }
13
17
  export declare const AgentSelected: Schema.Struct<{
@@ -512,8 +516,7 @@ export declare const AssistantTool: Schema.Struct<{
512
516
  readonly id: Schema.String;
513
517
  readonly name: Schema.String;
514
518
  readonly executed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
515
- readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
516
- readonly providerResultState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
519
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
517
520
  readonly state: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
518
521
  readonly status: Schema.tag<"streaming">;
519
522
  readonly input: Schema.String;
@@ -577,14 +580,14 @@ export interface AssistantText extends Schema.Schema.Type<typeof AssistantText>
577
580
  export declare const AssistantText: Schema.Struct<{
578
581
  readonly type: Schema.tag<"text">;
579
582
  readonly text: Schema.String;
580
- readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
583
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
581
584
  }>;
582
585
  export interface AssistantReasoning extends Schema.Schema.Type<typeof AssistantReasoning> {
583
586
  }
584
587
  export declare const AssistantReasoning: Schema.Struct<{
585
588
  readonly type: Schema.tag<"reasoning">;
586
589
  readonly text: Schema.String;
587
- readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
590
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
588
591
  readonly time: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
589
592
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
590
593
  readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
@@ -596,11 +599,11 @@ export declare const AssistantReasoning: Schema.Struct<{
596
599
  export declare const AssistantContent: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
597
600
  readonly type: Schema.tag<"text">;
598
601
  readonly text: Schema.String;
599
- readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
602
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
600
603
  }>, Schema.Struct<{
601
604
  readonly type: Schema.tag<"reasoning">;
602
605
  readonly text: Schema.String;
603
- readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
606
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
604
607
  readonly time: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
605
608
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
606
609
  readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
@@ -613,8 +616,7 @@ export declare const AssistantContent: Schema.toTaggedUnion<"type", readonly [Sc
613
616
  readonly id: Schema.String;
614
617
  readonly name: Schema.String;
615
618
  readonly executed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
616
- readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
617
- readonly providerResultState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
619
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
618
620
  readonly state: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
619
621
  readonly status: Schema.tag<"streaming">;
620
622
  readonly input: Schema.String;
@@ -677,11 +679,11 @@ export type AssistantContent = AssistantText | AssistantReasoning | AssistantToo
677
679
  export declare const AssistantContentEncoded: Schema.toEncoded<Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
678
680
  readonly type: Schema.tag<"text">;
679
681
  readonly text: Schema.String;
680
- readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
682
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
681
683
  }>, Schema.Struct<{
682
684
  readonly type: Schema.tag<"reasoning">;
683
685
  readonly text: Schema.String;
684
- readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
686
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
685
687
  readonly time: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
686
688
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
687
689
  readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
@@ -694,8 +696,7 @@ export declare const AssistantContentEncoded: Schema.toEncoded<Schema.toTaggedUn
694
696
  readonly id: Schema.String;
695
697
  readonly name: Schema.String;
696
698
  readonly executed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
697
- readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
698
- readonly providerResultState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
699
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
699
700
  readonly state: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
700
701
  readonly status: Schema.tag<"streaming">;
701
702
  readonly input: Schema.String;
@@ -807,11 +808,11 @@ export declare const Assistant: Schema.Struct<{
807
808
  readonly content: Schema.$Array<Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
808
809
  readonly type: Schema.tag<"text">;
809
810
  readonly text: Schema.String;
810
- readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
811
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
811
812
  }>, Schema.Struct<{
812
813
  readonly type: Schema.tag<"reasoning">;
813
814
  readonly text: Schema.String;
814
- readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
815
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
815
816
  readonly time: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
816
817
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
817
818
  readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
@@ -824,8 +825,7 @@ export declare const Assistant: Schema.Struct<{
824
825
  readonly id: Schema.String;
825
826
  readonly name: Schema.String;
826
827
  readonly executed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
827
- readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
828
- readonly providerResultState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
828
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
829
829
  readonly state: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
830
830
  readonly status: Schema.tag<"streaming">;
831
831
  readonly input: Schema.String;
@@ -895,7 +895,8 @@ export declare const Assistant: Schema.Struct<{
895
895
  }>>, never, never>;
896
896
  readonly finish: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>>>, Schema.optionalKey<Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>>, never, never>;
897
897
  readonly rawFinish: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
898
- readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
898
+ /** Step-level native data, such as a provider's reason for blocking a response. */
899
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
899
900
  readonly cost: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.Finite, "Money.USD"> & {
900
901
  zero: number & import("effect/Brand").Brand<"Money.USD">;
901
902
  }>>, Schema.optionalKey<Schema.brand<Schema.Finite, "Money.USD"> & {
@@ -986,7 +987,6 @@ export declare const CompactionRunning: Schema.Struct<{
986
987
  readonly status: Schema.tag<"running">;
987
988
  readonly reason: Schema.Literals<readonly ["auto", "manual"]>;
988
989
  readonly summary: Schema.String;
989
- readonly recent: Schema.String;
990
990
  }>;
991
991
  export interface CompactionCompleted extends Schema.Schema.Type<typeof CompactionCompleted> {
992
992
  }
@@ -1069,56 +1069,9 @@ export declare const CompactionCompleted: Schema.Struct<{
1069
1069
  readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
1070
1070
  };
1071
1071
  }>, never, never>;
1072
- readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1072
+ /** A provider compaction stores its replacement window in `native.messages`, replayed instead of `summary`. */
1073
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1073
1074
  readonly summary: Schema.String;
1074
- readonly recent: Schema.String;
1075
- readonly providerContext: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
1076
- readonly version: Schema.Literal<1>;
1077
- readonly provenance: Schema.Struct<{
1078
- readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
1079
- opencode: string & import("effect/Brand").Brand<"Provider.ID">;
1080
- anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
1081
- openai: string & import("effect/Brand").Brand<"Provider.ID">;
1082
- google: string & import("effect/Brand").Brand<"Provider.ID">;
1083
- googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
1084
- githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
1085
- amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
1086
- azure: string & import("effect/Brand").Brand<"Provider.ID">;
1087
- openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
1088
- mistral: string & import("effect/Brand").Brand<"Provider.ID">;
1089
- gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
1090
- };
1091
- readonly provider: Schema.String;
1092
- readonly modelID: Schema.String;
1093
- readonly route: Schema.String;
1094
- readonly protocol: Schema.String;
1095
- readonly endpoint: Schema.String;
1096
- }>;
1097
- readonly messages: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1098
- }>>>, Schema.optionalKey<Schema.Struct<{
1099
- readonly version: Schema.Literal<1>;
1100
- readonly provenance: Schema.Struct<{
1101
- readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
1102
- opencode: string & import("effect/Brand").Brand<"Provider.ID">;
1103
- anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
1104
- openai: string & import("effect/Brand").Brand<"Provider.ID">;
1105
- google: string & import("effect/Brand").Brand<"Provider.ID">;
1106
- googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
1107
- githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
1108
- amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
1109
- azure: string & import("effect/Brand").Brand<"Provider.ID">;
1110
- openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
1111
- mistral: string & import("effect/Brand").Brand<"Provider.ID">;
1112
- gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
1113
- };
1114
- readonly provider: Schema.String;
1115
- readonly modelID: Schema.String;
1116
- readonly route: Schema.String;
1117
- readonly protocol: Schema.String;
1118
- readonly endpoint: Schema.String;
1119
- }>;
1120
- readonly messages: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1121
- }>>, never, never>;
1122
1075
  }>;
1123
1076
  export interface CompactionFailed extends Schema.Schema.Type<typeof CompactionFailed> {
1124
1077
  }
@@ -1180,7 +1133,6 @@ export declare const Compaction: Schema.Union<readonly [Schema.Struct<{
1180
1133
  readonly status: Schema.tag<"running">;
1181
1134
  readonly reason: Schema.Literals<readonly ["auto", "manual"]>;
1182
1135
  readonly summary: Schema.String;
1183
- readonly recent: Schema.String;
1184
1136
  }>, Schema.Struct<{
1185
1137
  readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
1186
1138
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
@@ -1260,56 +1212,9 @@ export declare const Compaction: Schema.Union<readonly [Schema.Struct<{
1260
1212
  readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
1261
1213
  };
1262
1214
  }>, never, never>;
1263
- readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1215
+ /** A provider compaction stores its replacement window in `native.messages`, replayed instead of `summary`. */
1216
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1264
1217
  readonly summary: Schema.String;
1265
- readonly recent: Schema.String;
1266
- readonly providerContext: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
1267
- readonly version: Schema.Literal<1>;
1268
- readonly provenance: Schema.Struct<{
1269
- readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
1270
- opencode: string & import("effect/Brand").Brand<"Provider.ID">;
1271
- anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
1272
- openai: string & import("effect/Brand").Brand<"Provider.ID">;
1273
- google: string & import("effect/Brand").Brand<"Provider.ID">;
1274
- googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
1275
- githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
1276
- amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
1277
- azure: string & import("effect/Brand").Brand<"Provider.ID">;
1278
- openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
1279
- mistral: string & import("effect/Brand").Brand<"Provider.ID">;
1280
- gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
1281
- };
1282
- readonly provider: Schema.String;
1283
- readonly modelID: Schema.String;
1284
- readonly route: Schema.String;
1285
- readonly protocol: Schema.String;
1286
- readonly endpoint: Schema.String;
1287
- }>;
1288
- readonly messages: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1289
- }>>>, Schema.optionalKey<Schema.Struct<{
1290
- readonly version: Schema.Literal<1>;
1291
- readonly provenance: Schema.Struct<{
1292
- readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
1293
- opencode: string & import("effect/Brand").Brand<"Provider.ID">;
1294
- anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
1295
- openai: string & import("effect/Brand").Brand<"Provider.ID">;
1296
- google: string & import("effect/Brand").Brand<"Provider.ID">;
1297
- googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
1298
- githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
1299
- amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
1300
- azure: string & import("effect/Brand").Brand<"Provider.ID">;
1301
- openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
1302
- mistral: string & import("effect/Brand").Brand<"Provider.ID">;
1303
- gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
1304
- };
1305
- readonly provider: Schema.String;
1306
- readonly modelID: Schema.String;
1307
- readonly route: Schema.String;
1308
- readonly protocol: Schema.String;
1309
- readonly endpoint: Schema.String;
1310
- }>;
1311
- readonly messages: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1312
- }>>, never, never>;
1313
1218
  }>, Schema.Struct<{
1314
1219
  readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
1315
1220
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
@@ -1785,11 +1690,11 @@ export declare const Info: Schema.Union<readonly [Schema.Struct<{
1785
1690
  readonly content: Schema.$Array<Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
1786
1691
  readonly type: Schema.tag<"text">;
1787
1692
  readonly text: Schema.String;
1788
- readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1693
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1789
1694
  }>, Schema.Struct<{
1790
1695
  readonly type: Schema.tag<"reasoning">;
1791
1696
  readonly text: Schema.String;
1792
- readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1697
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1793
1698
  readonly time: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
1794
1699
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
1795
1700
  readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
@@ -1802,8 +1707,7 @@ export declare const Info: Schema.Union<readonly [Schema.Struct<{
1802
1707
  readonly id: Schema.String;
1803
1708
  readonly name: Schema.String;
1804
1709
  readonly executed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
1805
- readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1806
- readonly providerResultState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1710
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1807
1711
  readonly state: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
1808
1712
  readonly status: Schema.tag<"streaming">;
1809
1713
  readonly input: Schema.String;
@@ -1873,7 +1777,8 @@ export declare const Info: Schema.Union<readonly [Schema.Struct<{
1873
1777
  }>>, never, never>;
1874
1778
  readonly finish: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>>>, Schema.optionalKey<Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>>, never, never>;
1875
1779
  readonly rawFinish: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
1876
- readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1780
+ /** Step-level native data, such as a provider's reason for blocking a response. */
1781
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1877
1782
  readonly cost: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.Finite, "Money.USD"> & {
1878
1783
  zero: number & import("effect/Brand").Brand<"Money.USD">;
1879
1784
  }>>, Schema.optionalKey<Schema.brand<Schema.Finite, "Money.USD"> & {
@@ -1961,7 +1866,6 @@ export declare const Info: Schema.Union<readonly [Schema.Struct<{
1961
1866
  readonly status: Schema.tag<"running">;
1962
1867
  readonly reason: Schema.Literals<readonly ["auto", "manual"]>;
1963
1868
  readonly summary: Schema.String;
1964
- readonly recent: Schema.String;
1965
1869
  }>, Schema.Struct<{
1966
1870
  readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
1967
1871
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
@@ -2041,56 +1945,9 @@ export declare const Info: Schema.Union<readonly [Schema.Struct<{
2041
1945
  readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
2042
1946
  };
2043
1947
  }>, never, never>;
2044
- readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1948
+ /** A provider compaction stores its replacement window in `native.messages`, replayed instead of `summary`. */
1949
+ readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
2045
1950
  readonly summary: Schema.String;
2046
- readonly recent: Schema.String;
2047
- readonly providerContext: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
2048
- readonly version: Schema.Literal<1>;
2049
- readonly provenance: Schema.Struct<{
2050
- readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
2051
- opencode: string & import("effect/Brand").Brand<"Provider.ID">;
2052
- anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
2053
- openai: string & import("effect/Brand").Brand<"Provider.ID">;
2054
- google: string & import("effect/Brand").Brand<"Provider.ID">;
2055
- googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
2056
- githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
2057
- amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
2058
- azure: string & import("effect/Brand").Brand<"Provider.ID">;
2059
- openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
2060
- mistral: string & import("effect/Brand").Brand<"Provider.ID">;
2061
- gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
2062
- };
2063
- readonly provider: Schema.String;
2064
- readonly modelID: Schema.String;
2065
- readonly route: Schema.String;
2066
- readonly protocol: Schema.String;
2067
- readonly endpoint: Schema.String;
2068
- }>;
2069
- readonly messages: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2070
- }>>>, Schema.optionalKey<Schema.Struct<{
2071
- readonly version: Schema.Literal<1>;
2072
- readonly provenance: Schema.Struct<{
2073
- readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
2074
- opencode: string & import("effect/Brand").Brand<"Provider.ID">;
2075
- anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
2076
- openai: string & import("effect/Brand").Brand<"Provider.ID">;
2077
- google: string & import("effect/Brand").Brand<"Provider.ID">;
2078
- googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
2079
- githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
2080
- amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
2081
- azure: string & import("effect/Brand").Brand<"Provider.ID">;
2082
- openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
2083
- mistral: string & import("effect/Brand").Brand<"Provider.ID">;
2084
- gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
2085
- };
2086
- readonly provider: Schema.String;
2087
- readonly modelID: Schema.String;
2088
- readonly route: Schema.String;
2089
- readonly protocol: Schema.String;
2090
- readonly endpoint: Schema.String;
2091
- }>;
2092
- readonly messages: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2093
- }>>, never, never>;
2094
1951
  }>, Schema.Struct<{
2095
1952
  readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
2096
1953
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;