@opencode-ai/schema 0.0.0-beta-18286 → 0.0.0-beta-18314

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.
@@ -99,6 +99,16 @@ export const Viewed = Event.durable({
99
99
  idle: Schema.Finite,
100
100
  },
101
101
  });
102
+ export const MessageContentUpdated = Event.durable({
103
+ type: "session.message.content.updated",
104
+ ...options,
105
+ schema: {
106
+ ...Base,
107
+ messageID: SessionMessage.ID,
108
+ // Public events are framed directly, so timestamps must already be encoded.
109
+ content: Schema.Array(SessionMessage.AssistantContentEncoded),
110
+ },
111
+ });
102
112
  export const UsageRecorded = Event.durable({
103
113
  type: "session.usage.recorded",
104
114
  ...options,
@@ -253,6 +263,15 @@ export var Step;
253
263
  snapshot: Snapshot.ID.pipe(optional),
254
264
  },
255
265
  });
266
+ /** Records the provider response-body boundary independently of tool settlement. */
267
+ Step.Streamed = Event.durable({
268
+ type: "session.step.streamed",
269
+ ...options,
270
+ schema: {
271
+ ...Base,
272
+ assistantMessageID: SessionMessage.ID,
273
+ },
274
+ });
256
275
  Step.Ended = Event.durable({
257
276
  type: "session.step.ended",
258
277
  ...options,
@@ -505,7 +524,7 @@ export var RevertEvent;
505
524
  schema: { ...Base, to: SessionMessage.ID },
506
525
  });
507
526
  })(RevertEvent || (RevertEvent = {}));
508
- export const Definitions = Event.inventory(Created, AgentSelected, ModelSelected, Moved, Renamed, Viewed, UsageUpdated, Deleted, Forked, InboxDelivered, InboxEnqueued, InboxCancelled, InboxDeliveryChanged, Execution.Started, Execution.Succeeded, Execution.Failed, Execution.Interrupted, InstructionsUpdated, Synthetic, Skill.Activated, Shell.Started, Shell.Ended, Step.Started, Step.Ended, Step.Failed, Text.Started, Text.Delta, Text.Ended, Reasoning.Started, Reasoning.Delta, Reasoning.Ended, Tool.Input.Started, Tool.Input.Delta, Tool.Input.Ended, Tool.Called, Tool.Progress, Tool.Success, Tool.Failed, RetryScheduled, Compaction.Started, Compaction.Delta, Compaction.Ended, Compaction.Failed, RevertEvent.Staged, RevertEvent.Cleared, RevertEvent.Committed);
527
+ export const Definitions = Event.inventory(Created, AgentSelected, ModelSelected, Moved, Renamed, Viewed, UsageUpdated, Deleted, Forked, InboxDelivered, InboxEnqueued, InboxCancelled, InboxDeliveryChanged, Execution.Started, Execution.Succeeded, Execution.Failed, Execution.Interrupted, InstructionsUpdated, Synthetic, Skill.Activated, Shell.Started, Shell.Ended, Step.Started, Step.Streamed, Step.Ended, Step.Failed, Text.Started, Text.Delta, Text.Ended, Reasoning.Started, Reasoning.Delta, Reasoning.Ended, Tool.Input.Started, Tool.Input.Delta, Tool.Input.Ended, Tool.Called, Tool.Progress, Tool.Success, Tool.Failed, RetryScheduled, Compaction.Started, Compaction.Delta, Compaction.Ended, Compaction.Failed, RevertEvent.Staged, RevertEvent.Cleared, RevertEvent.Committed, MessageContentUpdated);
509
528
  // UsageRecorded is durable but internal: excluded from Definitions so it never reaches the public manifest.
510
529
  export const DurableDefinitions = Event.inventory(...Definitions.filter((definition) => definition.durability === "durable"), UsageRecorded);
511
530
  export const EphemeralDefinitions = Event.inventory(...Definitions.filter((definition) => definition.durability === "ephemeral"));
@@ -654,6 +654,82 @@ export declare const AssistantContent: Schema.toTaggedUnion<"type", readonly [Sc
654
654
  }>;
655
655
  }>]>;
656
656
  export type AssistantContent = AssistantText | AssistantReasoning | AssistantTool;
657
+ export declare const AssistantContentEncoded: Schema.toEncoded<Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
658
+ readonly type: Schema.tag<"text">;
659
+ readonly text: Schema.String;
660
+ readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
661
+ }>, Schema.Struct<{
662
+ readonly type: Schema.tag<"reasoning">;
663
+ readonly text: Schema.String;
664
+ readonly state: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
665
+ readonly time: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
666
+ readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
667
+ 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>;
668
+ }>>>, Schema.optionalKey<Schema.Struct<{
669
+ readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
670
+ 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>;
671
+ }>>, never, never>;
672
+ }>, Schema.Struct<{
673
+ readonly type: Schema.tag<"tool">;
674
+ readonly id: Schema.String;
675
+ readonly name: Schema.String;
676
+ readonly executed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
677
+ readonly providerState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
678
+ readonly providerResultState: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
679
+ readonly state: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
680
+ readonly status: Schema.tag<"streaming">;
681
+ readonly input: Schema.String;
682
+ }>, Schema.Struct<{
683
+ readonly status: Schema.tag<"running">;
684
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
685
+ readonly metadata: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
686
+ }>, Schema.Struct<{
687
+ readonly status: Schema.tag<"completed">;
688
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
689
+ readonly content: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
690
+ readonly type: Schema.Literal<"text">;
691
+ readonly text: Schema.String;
692
+ }>, Schema.Struct<{
693
+ readonly type: Schema.Literal<"file">;
694
+ readonly uri: Schema.String;
695
+ readonly mime: Schema.String;
696
+ readonly name: Schema.optional<Schema.String>;
697
+ }>]>>;
698
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>, never, never>;
699
+ }>, Schema.Struct<{
700
+ readonly status: Schema.tag<"error">;
701
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
702
+ readonly error: Schema.Struct<{
703
+ readonly type: Schema.String;
704
+ readonly message: Schema.String;
705
+ readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
706
+ }>;
707
+ readonly content: Schema.decodeTo<Schema.optional<Schema.toType<Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
708
+ readonly type: Schema.Literal<"text">;
709
+ readonly text: Schema.String;
710
+ }>, Schema.Struct<{
711
+ readonly type: Schema.Literal<"file">;
712
+ readonly uri: Schema.String;
713
+ readonly mime: Schema.String;
714
+ readonly name: Schema.optional<Schema.String>;
715
+ }>]>>>>, Schema.optionalKey<Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
716
+ readonly type: Schema.Literal<"text">;
717
+ readonly text: Schema.String;
718
+ }>, Schema.Struct<{
719
+ readonly type: Schema.Literal<"file">;
720
+ readonly uri: Schema.String;
721
+ readonly mime: Schema.String;
722
+ readonly name: Schema.optional<Schema.String>;
723
+ }>]>>>, never, never>;
724
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>, never, never>;
725
+ }>]>;
726
+ readonly time: Schema.Struct<{
727
+ readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
728
+ readonly ran: 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>;
729
+ 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>;
730
+ }>;
731
+ }>]>>;
732
+ export type AssistantContentEncoded = typeof AssistantContentEncoded.Type;
657
733
  export interface AssistantRetry extends Schema.Schema.Type<typeof AssistantRetry> {
658
734
  }
659
735
  export declare const AssistantRetry: Schema.Struct<{
@@ -830,6 +906,8 @@ export declare const Assistant: Schema.Struct<{
830
906
  }>>, never, never>;
831
907
  readonly time: Schema.Struct<{
832
908
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
909
+ /** When the provider response body ended, before tool settlement. */
910
+ readonly streamed: 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>;
833
911
  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>;
834
912
  }>;
835
913
  readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
@@ -1459,6 +1537,8 @@ export declare const Info: Schema.Union<readonly [Schema.Struct<{
1459
1537
  }>>, never, never>;
1460
1538
  readonly time: Schema.Struct<{
1461
1539
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
1540
+ /** When the provider response body ended, before tool settlement. */
1541
+ readonly streamed: 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>;
1462
1542
  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>;
1463
1543
  }>;
1464
1544
  readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
@@ -147,6 +147,9 @@ export const AssistantReasoning = Schema.Struct({
147
147
  }).pipe(optional),
148
148
  }).annotate({ identifier: "Session.Message.Assistant.Reasoning" });
149
149
  export const AssistantContent = Schema.Union([AssistantText, AssistantReasoning, AssistantTool]).pipe(Schema.toTaggedUnion("type"));
150
+ export const AssistantContentEncoded = Schema.toEncoded(AssistantContent).annotate({
151
+ identifier: "Session.Message.AssistantContent.Encoded",
152
+ });
150
153
  export const AssistantRetry = Schema.Struct({
151
154
  attempt: PositiveInt,
152
155
  at: DateTimeUtcFromMillis,
@@ -172,6 +175,8 @@ export const Assistant = Schema.Struct({
172
175
  retry: AssistantRetry.pipe(optional),
173
176
  time: Schema.Struct({
174
177
  created: DateTimeUtcFromMillis,
178
+ /** When the provider response body ended, before tool settlement. */
179
+ streamed: DateTimeUtcFromMillis.pipe(optional),
175
180
  completed: DateTimeUtcFromMillis.pipe(optional),
176
181
  }),
177
182
  }).annotate({ identifier: "Session.Message.Assistant" });
@@ -693,6 +693,7 @@ export declare const Data: Schema.Struct<{
693
693
  }>>, never, never>;
694
694
  readonly time: Schema.Struct<{
695
695
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
696
+ readonly streamed: 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>;
696
697
  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>;
697
698
  }>;
698
699
  readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/schema",
4
- "version": "0.0.0-beta-18286",
4
+ "version": "0.0.0-beta-18314",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {