@opencode/schema 2.2.6 → 2.3.0

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.
@@ -1107,7 +1107,7 @@ export declare const UsageRecorded: Schema.Struct<{
1107
1107
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
1108
1108
  create: () => string & import("effect/Brand").Brand<"SessionID">;
1109
1109
  };
1110
- readonly source: Schema.Literals<readonly ["title", "compaction"]>;
1110
+ readonly source: Schema.Literals<readonly ["title", "compaction", "generate"]>;
1111
1111
  readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
1112
1112
  zero: number & import("effect/Brand").Brand<"Money.USD">;
1113
1113
  };
@@ -1132,7 +1132,7 @@ export declare const UsageRecorded: Schema.Struct<{
1132
1132
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
1133
1133
  create: () => string & import("effect/Brand").Brand<"SessionID">;
1134
1134
  };
1135
- readonly source: Schema.Literals<readonly ["title", "compaction"]>;
1135
+ readonly source: Schema.Literals<readonly ["title", "compaction", "generate"]>;
1136
1136
  readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
1137
1137
  zero: number & import("effect/Brand").Brand<"Money.USD">;
1138
1138
  };
@@ -2639,6 +2639,65 @@ export declare namespace Step {
2639
2639
  }>;
2640
2640
  };
2641
2641
  type Started = typeof Started.Type;
2642
+ /** Records when the provider streamed the first output token, before the rest of the response. */
2643
+ const FirstToken: Schema.Struct<{
2644
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
2645
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
2646
+ };
2647
+ readonly created: Schema.Finite;
2648
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
2649
+ readonly type: Schema.Literal<"session.step.first-token">;
2650
+ readonly durable: Schema.Struct<{
2651
+ readonly aggregateID: Schema.String;
2652
+ readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
2653
+ readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
2654
+ }>;
2655
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
2656
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
2657
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
2658
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
2659
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
2660
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
2661
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
2662
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
2663
+ }>, never, never>;
2664
+ }>>>, Schema.optionalKey<Schema.Struct<{
2665
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
2666
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
2667
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
2668
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
2669
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
2670
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
2671
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
2672
+ }>, never, never>;
2673
+ }>>, never, never>;
2674
+ readonly data: Schema.Struct<{
2675
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
2676
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
2677
+ };
2678
+ readonly assistantMessageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
2679
+ create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
2680
+ fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
2681
+ };
2682
+ }>;
2683
+ }> & {
2684
+ type: "session.step.first-token";
2685
+ durability: "durable";
2686
+ durable: {
2687
+ readonly version: number;
2688
+ readonly aggregate: string;
2689
+ };
2690
+ data: Schema.Struct<{
2691
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
2692
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
2693
+ };
2694
+ readonly assistantMessageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
2695
+ create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
2696
+ fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
2697
+ };
2698
+ }>;
2699
+ };
2700
+ type FirstToken = typeof FirstToken.Type;
2642
2701
  /** Records the provider response-body boundary independently of tool settlement. */
2643
2702
  const Streamed: Schema.Struct<{
2644
2703
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -6811,6 +6870,62 @@ export declare const Definitions: readonly [Schema.Struct<{
6811
6870
  /** Request dispatch time, before waiting for provider output. */
6812
6871
  readonly started: Schema.Int;
6813
6872
  }>;
6873
+ }, Schema.Struct<{
6874
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
6875
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
6876
+ };
6877
+ readonly created: Schema.Finite;
6878
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
6879
+ readonly type: Schema.Literal<"session.step.first-token">;
6880
+ readonly durable: Schema.Struct<{
6881
+ readonly aggregateID: Schema.String;
6882
+ readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
6883
+ readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
6884
+ }>;
6885
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
6886
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
6887
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
6888
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
6889
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
6890
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
6891
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
6892
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
6893
+ }>, never, never>;
6894
+ }>>>, Schema.optionalKey<Schema.Struct<{
6895
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
6896
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
6897
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
6898
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
6899
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
6900
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
6901
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
6902
+ }>, never, never>;
6903
+ }>>, never, never>;
6904
+ readonly data: Schema.Struct<{
6905
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
6906
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
6907
+ };
6908
+ readonly assistantMessageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
6909
+ create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
6910
+ fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
6911
+ };
6912
+ }>;
6913
+ }> & {
6914
+ type: "session.step.first-token";
6915
+ durability: "durable";
6916
+ durable: {
6917
+ readonly version: number;
6918
+ readonly aggregate: string;
6919
+ };
6920
+ data: Schema.Struct<{
6921
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
6922
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
6923
+ };
6924
+ readonly assistantMessageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
6925
+ create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
6926
+ fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
6927
+ };
6928
+ }>;
6814
6929
  }, Schema.Struct<{
6815
6930
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
6816
6931
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
@@ -11598,6 +11713,62 @@ export declare const DurableDefinitions: readonly [...((Schema.Struct<{
11598
11713
  readonly snapshot: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Snapshot.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Snapshot.ID">>, never, never>;
11599
11714
  readonly files: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "RelativePath">>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "RelativePath">>>, never, never>;
11600
11715
  }>;
11716
+ }) | (Schema.Struct<{
11717
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
11718
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
11719
+ };
11720
+ readonly created: Schema.Finite;
11721
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
11722
+ readonly type: Schema.Literal<"session.step.first-token">;
11723
+ readonly durable: Schema.Struct<{
11724
+ readonly aggregateID: Schema.String;
11725
+ readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
11726
+ readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
11727
+ }>;
11728
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
11729
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
11730
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
11731
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
11732
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
11733
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
11734
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
11735
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
11736
+ }>, never, never>;
11737
+ }>>>, Schema.optionalKey<Schema.Struct<{
11738
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
11739
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
11740
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
11741
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
11742
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
11743
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
11744
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
11745
+ }>, never, never>;
11746
+ }>>, never, never>;
11747
+ readonly data: Schema.Struct<{
11748
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
11749
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
11750
+ };
11751
+ readonly assistantMessageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
11752
+ create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
11753
+ fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
11754
+ };
11755
+ }>;
11756
+ }> & {
11757
+ type: "session.step.first-token";
11758
+ durability: "durable";
11759
+ durable: {
11760
+ readonly version: number;
11761
+ readonly aggregate: string;
11762
+ };
11763
+ data: Schema.Struct<{
11764
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
11765
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
11766
+ };
11767
+ readonly assistantMessageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
11768
+ create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
11769
+ fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
11770
+ };
11771
+ }>;
11601
11772
  }) | (Schema.Struct<{
11602
11773
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
11603
11774
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
@@ -12461,7 +12632,7 @@ export declare const DurableDefinitions: readonly [...((Schema.Struct<{
12461
12632
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
12462
12633
  create: () => string & import("effect/Brand").Brand<"SessionID">;
12463
12634
  };
12464
- readonly source: Schema.Literals<readonly ["title", "compaction"]>;
12635
+ readonly source: Schema.Literals<readonly ["title", "compaction", "generate"]>;
12465
12636
  readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
12466
12637
  zero: number & import("effect/Brand").Brand<"Money.USD">;
12467
12638
  };
@@ -12486,7 +12657,7 @@ export declare const DurableDefinitions: readonly [...((Schema.Struct<{
12486
12657
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
12487
12658
  create: () => string & import("effect/Brand").Brand<"SessionID">;
12488
12659
  };
12489
- readonly source: Schema.Literals<readonly ["title", "compaction"]>;
12660
+ readonly source: Schema.Literals<readonly ["title", "compaction", "generate"]>;
12490
12661
  readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
12491
12662
  zero: number & import("effect/Brand").Brand<"Money.USD">;
12492
12663
  };
@@ -15996,6 +16167,62 @@ export declare const Durable: Schema.toTaggedUnion<"type", readonly [...((Schema
15996
16167
  readonly snapshot: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Snapshot.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Snapshot.ID">>, never, never>;
15997
16168
  readonly files: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "RelativePath">>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "RelativePath">>>, never, never>;
15998
16169
  }>;
16170
+ }) | (Schema.Struct<{
16171
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
16172
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
16173
+ };
16174
+ readonly created: Schema.Finite;
16175
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
16176
+ readonly type: Schema.Literal<"session.step.first-token">;
16177
+ readonly durable: Schema.Struct<{
16178
+ readonly aggregateID: Schema.String;
16179
+ readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
16180
+ readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
16181
+ }>;
16182
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
16183
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
16184
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
16185
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
16186
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
16187
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
16188
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
16189
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
16190
+ }>, never, never>;
16191
+ }>>>, Schema.optionalKey<Schema.Struct<{
16192
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
16193
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
16194
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
16195
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
16196
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
16197
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
16198
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
16199
+ }>, never, never>;
16200
+ }>>, never, never>;
16201
+ readonly data: Schema.Struct<{
16202
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
16203
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
16204
+ };
16205
+ readonly assistantMessageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
16206
+ create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
16207
+ fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
16208
+ };
16209
+ }>;
16210
+ }> & {
16211
+ type: "session.step.first-token";
16212
+ durability: "durable";
16213
+ durable: {
16214
+ readonly version: number;
16215
+ readonly aggregate: string;
16216
+ };
16217
+ data: Schema.Struct<{
16218
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
16219
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
16220
+ };
16221
+ readonly assistantMessageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
16222
+ create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
16223
+ fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
16224
+ };
16225
+ }>;
15999
16226
  }) | (Schema.Struct<{
16000
16227
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
16001
16228
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
@@ -16859,7 +17086,7 @@ export declare const Durable: Schema.toTaggedUnion<"type", readonly [...((Schema
16859
17086
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
16860
17087
  create: () => string & import("effect/Brand").Brand<"SessionID">;
16861
17088
  };
16862
- readonly source: Schema.Literals<readonly ["title", "compaction"]>;
17089
+ readonly source: Schema.Literals<readonly ["title", "compaction", "generate"]>;
16863
17090
  readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
16864
17091
  zero: number & import("effect/Brand").Brand<"Money.USD">;
16865
17092
  };
@@ -16884,7 +17111,7 @@ export declare const Durable: Schema.toTaggedUnion<"type", readonly [...((Schema
16884
17111
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
16885
17112
  create: () => string & import("effect/Brand").Brand<"SessionID">;
16886
17113
  };
16887
- readonly source: Schema.Literals<readonly ["title", "compaction"]>;
17114
+ readonly source: Schema.Literals<readonly ["title", "compaction", "generate"]>;
16888
17115
  readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
16889
17116
  zero: number & import("effect/Brand").Brand<"Money.USD">;
16890
17117
  };
@@ -20080,6 +20307,62 @@ export declare const All: Schema.toTaggedUnion<"type", readonly [Schema.toTagged
20080
20307
  readonly snapshot: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Snapshot.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Snapshot.ID">>, never, never>;
20081
20308
  readonly files: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "RelativePath">>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "RelativePath">>>, never, never>;
20082
20309
  }>;
20310
+ }) | (Schema.Struct<{
20311
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
20312
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
20313
+ };
20314
+ readonly created: Schema.Finite;
20315
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
20316
+ readonly type: Schema.Literal<"session.step.first-token">;
20317
+ readonly durable: Schema.Struct<{
20318
+ readonly aggregateID: Schema.String;
20319
+ readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
20320
+ readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
20321
+ }>;
20322
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
20323
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
20324
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
20325
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
20326
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
20327
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
20328
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
20329
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
20330
+ }>, never, never>;
20331
+ }>>>, Schema.optionalKey<Schema.Struct<{
20332
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
20333
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
20334
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
20335
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
20336
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
20337
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
20338
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
20339
+ }>, never, never>;
20340
+ }>>, never, never>;
20341
+ readonly data: Schema.Struct<{
20342
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
20343
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
20344
+ };
20345
+ readonly assistantMessageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
20346
+ create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
20347
+ fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
20348
+ };
20349
+ }>;
20350
+ }> & {
20351
+ type: "session.step.first-token";
20352
+ durability: "durable";
20353
+ durable: {
20354
+ readonly version: number;
20355
+ readonly aggregate: string;
20356
+ };
20357
+ data: Schema.Struct<{
20358
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
20359
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
20360
+ };
20361
+ readonly assistantMessageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
20362
+ create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
20363
+ fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
20364
+ };
20365
+ }>;
20083
20366
  }) | (Schema.Struct<{
20084
20367
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
20085
20368
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
@@ -20943,7 +21226,7 @@ export declare const All: Schema.toTaggedUnion<"type", readonly [Schema.toTagged
20943
21226
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
20944
21227
  create: () => string & import("effect/Brand").Brand<"SessionID">;
20945
21228
  };
20946
- readonly source: Schema.Literals<readonly ["title", "compaction"]>;
21229
+ readonly source: Schema.Literals<readonly ["title", "compaction", "generate"]>;
20947
21230
  readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
20948
21231
  zero: number & import("effect/Brand").Brand<"Money.USD">;
20949
21232
  };
@@ -20968,7 +21251,7 @@ export declare const All: Schema.toTaggedUnion<"type", readonly [Schema.toTagged
20968
21251
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
20969
21252
  create: () => string & import("effect/Brand").Brand<"SessionID">;
20970
21253
  };
20971
- readonly source: Schema.Literals<readonly ["title", "compaction"]>;
21254
+ readonly source: Schema.Literals<readonly ["title", "compaction", "generate"]>;
20972
21255
  readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
20973
21256
  zero: number & import("effect/Brand").Brand<"Money.USD">;
20974
21257
  };
@@ -137,7 +137,7 @@ export const UsageRecorded = Event.durable({
137
137
  ...options,
138
138
  schema: {
139
139
  ...Base,
140
- source: Schema.Literals(["title", "compaction"]),
140
+ source: Schema.Literals(["title", "compaction", "generate"]),
141
141
  cost: Money.USD,
142
142
  tokens: TokenUsage.Info,
143
143
  },
@@ -288,6 +288,15 @@ export var Step;
288
288
  started: NonNegativeInt,
289
289
  },
290
290
  });
291
+ /** Records when the provider streamed the first output token, before the rest of the response. */
292
+ Step.FirstToken = Event.durable({
293
+ type: "session.step.first-token",
294
+ ...options,
295
+ schema: {
296
+ ...Base,
297
+ assistantMessageID: SessionMessage.ID,
298
+ },
299
+ });
291
300
  /** Records the provider response-body boundary independently of tool settlement. */
292
301
  Step.Streamed = Event.durable({
293
302
  type: "session.step.streamed",
@@ -555,7 +564,7 @@ export var RevertEvent;
555
564
  schema: { ...Base, to: SessionMessage.ID },
556
565
  });
557
566
  })(RevertEvent || (RevertEvent = {}));
558
- export const Definitions = Event.inventory(Created, AgentSelected, ModelSelected, Moved, Renamed, MetadataUpdated, Permissions, Viewed, Archived, Unarchived, 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);
567
+ export const Definitions = Event.inventory(Created, AgentSelected, ModelSelected, Moved, Renamed, MetadataUpdated, Permissions, Viewed, Archived, Unarchived, 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.FirstToken, 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);
559
568
  // Internal and replay-only events are excluded from the public manifest.
560
569
  export const DurableDefinitions = Event.inventory(...Definitions.filter((definition) => definition.durability === "durable"), UsageRecorded, MessageContentUpdated);
561
570
  export const EphemeralDefinitions = Event.inventory(...Definitions.filter((definition) => definition.durability === "ephemeral"));
@@ -1169,6 +1169,8 @@ export declare const Assistant: Schema.Struct<{
1169
1169
  }>>, never, never>;
1170
1170
  readonly time: Schema.Struct<{
1171
1171
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
1172
+ /** When the provider streamed the first output token, before the rest of the response. */
1173
+ readonly firstToken: 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>;
1172
1174
  /** When the provider response body ended, before tool settlement. */
1173
1175
  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>;
1174
1176
  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>;
@@ -2068,6 +2070,8 @@ export declare const Info: Schema.Union<readonly [Schema.Struct<{
2068
2070
  }>>, never, never>;
2069
2071
  readonly time: Schema.Struct<{
2070
2072
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
2073
+ /** When the provider streamed the first output token, before the rest of the response. */
2074
+ readonly firstToken: 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>;
2071
2075
  /** When the provider response body ended, before tool settlement. */
2072
2076
  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>;
2073
2077
  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>;
@@ -2855,6 +2859,8 @@ export declare const MediaInfo: Schema.Union<readonly [Schema.Struct<{
2855
2859
  }>>, never, never>;
2856
2860
  readonly time: Schema.Struct<{
2857
2861
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
2862
+ /** When the provider streamed the first output token, before the rest of the response. */
2863
+ readonly firstToken: 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>;
2858
2864
  /** When the provider response body ended, before tool settlement. */
2859
2865
  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>;
2860
2866
  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>;
@@ -182,6 +182,8 @@ export const Assistant = Schema.Struct({
182
182
  retry: AssistantRetry.pipe(optional),
183
183
  time: Schema.Struct({
184
184
  created: DateTimeUtcFromMillis,
185
+ /** When the provider streamed the first output token, before the rest of the response. */
186
+ firstToken: DateTimeUtcFromMillis.pipe(optional),
185
187
  /** When the provider response body ended, before tool settlement. */
186
188
  streamed: DateTimeUtcFromMillis.pipe(optional),
187
189
  completed: DateTimeUtcFromMillis.pipe(optional),
@@ -743,6 +743,7 @@ export declare const Data: Schema.Struct<{
743
743
  }>>, never, never>;
744
744
  readonly time: Schema.Struct<{
745
745
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
746
+ readonly firstToken: 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>;
746
747
  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>;
747
748
  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>;
748
749
  }>;
package/dist/tool.d.ts CHANGED
@@ -5,6 +5,18 @@ import type { Agent } from "./agent.js";
5
5
  import type { Session } from "./session.js";
6
6
  import type { SessionMessage } from "./session-message.js";
7
7
  export type Metadata = Readonly<Record<string, any>>;
8
+ /** Optional wire encoding of a tool's single required string field. Execution still receives the object. */
9
+ export declare const Freeform: Schema.Union<readonly [Schema.Struct<{
10
+ readonly type: Schema.Literal<"text">;
11
+ }>, Schema.Struct<{
12
+ readonly type: Schema.Literal<"regex">;
13
+ readonly pattern: Schema.String;
14
+ }>, Schema.Struct<{
15
+ readonly type: Schema.Literal<"lark">;
16
+ readonly grammar: Schema.String;
17
+ }>]>;
18
+ export type Freeform = typeof Freeform.Type;
19
+ export declare const FreeformFormat: Schema.Literals<("lark" | "regex" | "text")[]>;
8
20
  export declare const CallID: Schema.brand<Schema.String, "Tool.CallID">;
9
21
  export type CallID = typeof CallID.Type;
10
22
  export interface Context {
@@ -13,6 +25,11 @@ export interface Context {
13
25
  readonly messageID: SessionMessage.ID;
14
26
  readonly id: CallID;
15
27
  readonly progress: (update: Metadata) => Effect.Effect<void>;
28
+ /**
29
+ * Completes when the user asks the call to stop. A tool that awaits it can stop its work and fail with what it
30
+ * has; a tool that does not is interrupted.
31
+ */
32
+ readonly cancel?: Effect.Effect<void>;
16
33
  }
17
34
  export interface Namespace {
18
35
  readonly name: string;
@@ -71,6 +88,7 @@ export interface Result<Output extends ValueSchema<any> | undefined = ValueSchem
71
88
  export type Info<Input extends ValueSchema<any> = ValueSchema<any>, Output extends ValueSchema<any> | undefined = ValueSchema<any> | undefined> = {
72
89
  readonly name: string;
73
90
  readonly input: Input;
91
+ readonly freeform?: Freeform;
74
92
  readonly description: string;
75
93
  readonly execute: (input: InputValue<Input>, context: Context) => Effect.Effect<Result<Output>, Error>;
76
94
  readonly output?: Output;
package/dist/tool.js CHANGED
@@ -1,5 +1,14 @@
1
1
  export * as Tool from "./tool.js";
2
2
  import { Effect, JsonSchema, Schema } from "effect";
3
+ /** Optional wire encoding of a tool's single required string field. Execution still receives the object. */
4
+ export const Freeform = Schema.Union([
5
+ Schema.Struct({ type: Schema.Literal("text") }),
6
+ Schema.Struct({ type: Schema.Literal("regex"), pattern: Schema.String }),
7
+ Schema.Struct({ type: Schema.Literal("lark"), grammar: Schema.String }),
8
+ ]).annotate({ identifier: "Tool.Freeform" });
9
+ export const FreeformFormat = Schema.Literals(Freeform.members.map((member) => member.fields.type.literal)).annotate({
10
+ identifier: "Tool.FreeformFormat",
11
+ });
3
12
  export const CallID = Schema.String.pipe(Schema.brand("Tool.CallID"));
4
13
  export class Error extends Schema.TaggedError()("Tool.Error", {
5
14
  message: Schema.String,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/schema",
4
- "version": "2.2.6",
4
+ "version": "2.3.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -17,12 +17,12 @@
17
17
  ],
18
18
  "exports": {
19
19
  ".": {
20
- "import": "./dist/index.js",
21
- "types": "./dist/index.d.ts"
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
22
  },
23
23
  "./*": {
24
- "import": "./dist/*.js",
25
- "types": "./dist/*.d.ts"
24
+ "types": "./dist/*.d.ts",
25
+ "import": "./dist/*.js"
26
26
  }
27
27
  },
28
28
  "scripts": {