@opencode/protocol 0.0.0-dev-19447 → 0.0.0-dev-19449

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.
@@ -367,6 +367,15 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
367
367
  };
368
368
  }>, never, never>;
369
369
  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>;
370
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
371
+ readonly action: Schema.String;
372
+ readonly resource: Schema.String;
373
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
374
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
375
+ readonly action: Schema.String;
376
+ readonly resource: Schema.String;
377
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
378
+ }>>>, never, never>;
370
379
  readonly version: Schema.String;
371
380
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
372
381
  create: () => string & import("effect/Brand").Brand<"SessionID">;
@@ -451,6 +460,15 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
451
460
  };
452
461
  }>, never, never>;
453
462
  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>;
463
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
464
+ readonly action: Schema.String;
465
+ readonly resource: Schema.String;
466
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
467
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
468
+ readonly action: Schema.String;
469
+ readonly resource: Schema.String;
470
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
471
+ }>>>, never, never>;
454
472
  readonly version: Schema.String;
455
473
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
456
474
  create: () => string & import("effect/Brand").Brand<"SessionID">;
@@ -827,6 +845,66 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
827
845
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
828
846
  };
829
847
  }>;
848
+ }, Schema.Struct<{
849
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
850
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
851
+ };
852
+ readonly created: Schema.Finite;
853
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
854
+ readonly type: Schema.Literal<"session.permissions.updated">;
855
+ readonly durable: Schema.Struct<{
856
+ readonly aggregateID: Schema.String;
857
+ readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
858
+ readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
859
+ }>;
860
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
861
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
862
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
863
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
864
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
865
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
866
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
867
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
868
+ }>, never, never>;
869
+ }>>>, Schema.optionalKey<Schema.Struct<{
870
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
871
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
872
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
873
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
874
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
875
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
876
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
877
+ }>, never, never>;
878
+ }>>, never, never>;
879
+ readonly data: Schema.Struct<{
880
+ readonly permissions: Schema.$Array<Schema.Struct<{
881
+ readonly action: Schema.String;
882
+ readonly resource: Schema.String;
883
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
884
+ }>>;
885
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
886
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
887
+ descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
888
+ };
889
+ }>;
890
+ }> & {
891
+ type: "session.permissions.updated";
892
+ durability: "durable";
893
+ durable: {
894
+ readonly version: number;
895
+ readonly aggregate: string;
896
+ };
897
+ data: Schema.Struct<{
898
+ readonly permissions: Schema.$Array<Schema.Struct<{
899
+ readonly action: Schema.String;
900
+ readonly resource: Schema.String;
901
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
902
+ }>>;
903
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
904
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
905
+ descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
906
+ };
907
+ }>;
830
908
  }, Schema.Struct<{
831
909
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
832
910
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
@@ -6616,6 +6694,11 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
6616
6694
  readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
6617
6695
  readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
6618
6696
  } | undefined;
6697
+ readonly permissions?: readonly {
6698
+ readonly action: string;
6699
+ readonly resource: string;
6700
+ readonly effect: "allow" | "deny" | "ask";
6701
+ }[] | undefined;
6619
6702
  readonly agent?: (string & import("effect/Brand").Brand<"Agent.ID">) | undefined;
6620
6703
  readonly subpath?: (string & import("effect/Brand").Brand<"RelativePath">) | undefined;
6621
6704
  readonly parentID?: (string & import("effect/Brand").Brand<"SessionID">) | undefined;
@@ -6729,6 +6812,30 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
6729
6812
  readonly metadata?: {
6730
6813
  readonly [x: string]: unknown;
6731
6814
  } | undefined;
6815
+ } | {
6816
+ readonly id: string & import("effect/Brand").Brand<"Event.ID">;
6817
+ readonly data: {
6818
+ readonly permissions: readonly {
6819
+ readonly action: string;
6820
+ readonly resource: string;
6821
+ readonly effect: "allow" | "deny" | "ask";
6822
+ }[];
6823
+ readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
6824
+ };
6825
+ readonly durable: {
6826
+ readonly aggregateID: string;
6827
+ readonly seq: number & import("effect/Brand").Brand<"Event.Seq">;
6828
+ readonly version: number & import("effect/Brand").Brand<"Event.Version">;
6829
+ };
6830
+ readonly type: "session.permissions.updated";
6831
+ readonly created: number;
6832
+ readonly location?: {
6833
+ readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
6834
+ readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
6835
+ } | undefined;
6836
+ readonly metadata?: {
6837
+ readonly [x: string]: unknown;
6838
+ } | undefined;
6732
6839
  } | {
6733
6840
  readonly id: string & import("effect/Brand").Brand<"Event.ID">;
6734
6841
  readonly data: {
@@ -8651,6 +8758,15 @@ export declare const OpenCodeEvent: Schema.Union<readonly [Schema.Struct<{
8651
8758
  };
8652
8759
  }>, never, never>;
8653
8760
  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>;
8761
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
8762
+ readonly action: Schema.String;
8763
+ readonly resource: Schema.String;
8764
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
8765
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
8766
+ readonly action: Schema.String;
8767
+ readonly resource: Schema.String;
8768
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
8769
+ }>>>, never, never>;
8654
8770
  readonly version: Schema.String;
8655
8771
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
8656
8772
  create: () => string & import("effect/Brand").Brand<"SessionID">;
@@ -8735,6 +8851,15 @@ export declare const OpenCodeEvent: Schema.Union<readonly [Schema.Struct<{
8735
8851
  };
8736
8852
  }>, never, never>;
8737
8853
  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>;
8854
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
8855
+ readonly action: Schema.String;
8856
+ readonly resource: Schema.String;
8857
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
8858
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
8859
+ readonly action: Schema.String;
8860
+ readonly resource: Schema.String;
8861
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
8862
+ }>>>, never, never>;
8738
8863
  readonly version: Schema.String;
8739
8864
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
8740
8865
  create: () => string & import("effect/Brand").Brand<"SessionID">;
@@ -9111,6 +9236,66 @@ export declare const OpenCodeEvent: Schema.Union<readonly [Schema.Struct<{
9111
9236
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
9112
9237
  };
9113
9238
  }>;
9239
+ }, Schema.Struct<{
9240
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
9241
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
9242
+ };
9243
+ readonly created: Schema.Finite;
9244
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
9245
+ readonly type: Schema.Literal<"session.permissions.updated">;
9246
+ readonly durable: Schema.Struct<{
9247
+ readonly aggregateID: Schema.String;
9248
+ readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
9249
+ readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
9250
+ }>;
9251
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
9252
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
9253
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
9254
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
9255
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
9256
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
9257
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
9258
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
9259
+ }>, never, never>;
9260
+ }>>>, Schema.optionalKey<Schema.Struct<{
9261
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
9262
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
9263
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
9264
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
9265
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
9266
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
9267
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
9268
+ }>, never, never>;
9269
+ }>>, never, never>;
9270
+ readonly data: Schema.Struct<{
9271
+ readonly permissions: Schema.$Array<Schema.Struct<{
9272
+ readonly action: Schema.String;
9273
+ readonly resource: Schema.String;
9274
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
9275
+ }>>;
9276
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
9277
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
9278
+ descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
9279
+ };
9280
+ }>;
9281
+ }> & {
9282
+ type: "session.permissions.updated";
9283
+ durability: "durable";
9284
+ durable: {
9285
+ readonly version: number;
9286
+ readonly aggregate: string;
9287
+ };
9288
+ data: Schema.Struct<{
9289
+ readonly permissions: Schema.$Array<Schema.Struct<{
9290
+ readonly action: Schema.String;
9291
+ readonly resource: Schema.String;
9292
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
9293
+ }>>;
9294
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
9295
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
9296
+ descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
9297
+ };
9298
+ }>;
9114
9299
  }, Schema.Struct<{
9115
9300
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
9116
9301
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
@@ -153,4 +153,15 @@ export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.
153
153
  }>>, never, Schema.toCodecJson<Schema.Struct<{
154
154
  readonly reply: Schema.Literals<readonly ["once", "always", "reject"]>;
155
155
  readonly message: Schema.optional<Schema.String>;
156
- }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof SessionNotFoundError | typeof PermissionNotFoundError>, SessionLocationId, HttpApiMiddleware.Requires<SessionLocationId>>, false>;
156
+ }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof SessionNotFoundError | typeof PermissionNotFoundError>, SessionLocationId, HttpApiMiddleware.Requires<SessionLocationId>> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.rules", "PUT", "/api/session/:sessionID/permission/rules", Schema.toCodecStringTree<Schema.Struct<{
157
+ sessionID: Schema.brand<Schema.String, "SessionID"> & {
158
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
159
+ descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
160
+ };
161
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
162
+ readonly permissions: Schema.$Array<Schema.Struct<{
163
+ readonly action: Schema.String;
164
+ readonly resource: Schema.String;
165
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
166
+ }>>;
167
+ }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof SessionNotFoundError>, SessionLocationId, HttpApiMiddleware.Requires<SessionLocationId>>, false>;
@@ -93,5 +93,17 @@ export const makePermissionGroup = (locationMiddleware, sessionLocationMiddlewar
93
93
  identifier: "v2.session.permission.reply",
94
94
  summary: "Reply to pending permission request",
95
95
  description: "Respond to a pending permission request owned by a session.",
96
+ })))
97
+ .add(HttpApiEndpoint.put("session.permission.rules", "/api/session/:sessionID/permission/rules", {
98
+ params: { sessionID: Session.ID },
99
+ payload: Schema.Struct({ permissions: Permission.Ruleset }),
100
+ success: HttpApiSchema.NoContent,
101
+ error: SessionNotFoundError,
102
+ })
103
+ .middleware(sessionLocationMiddleware)
104
+ .annotateMerge(OpenApi.annotations({
105
+ identifier: "v2.session.permission.rules",
106
+ summary: "Replace session permission rules",
107
+ description: "Replace the session-scoped permission rules. Rules are evaluated after the agent's rules, and the last matching rule wins.",
96
108
  })))
97
109
  .annotateMerge(OpenApi.annotations({ title: "permission", description: "Experimental permission routes." }));
@@ -275,6 +275,15 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
275
275
  }>;
276
276
  readonly subpath: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "RelativePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "RelativePath">>, never, never>;
277
277
  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>;
278
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
279
+ readonly action: Schema.String;
280
+ readonly resource: Schema.String;
281
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
282
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
283
+ readonly action: Schema.String;
284
+ readonly resource: Schema.String;
285
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
286
+ }>>>, never, never>;
278
287
  readonly revert: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
279
288
  readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
280
289
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
@@ -536,6 +545,11 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
536
545
  }>, never, never>;
537
546
  }>>;
538
547
  readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
548
+ readonly permissions: Schema.optional<Schema.$Array<Schema.Struct<{
549
+ readonly action: Schema.String;
550
+ readonly resource: Schema.String;
551
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
552
+ }>>>;
539
553
  }>>, never, Schema.toCodecJson<Schema.Struct<{
540
554
  readonly data: Schema.Struct<{
541
555
  readonly id: Schema.brand<Schema.String, "SessionID"> & {
@@ -668,6 +682,15 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
668
682
  }>;
669
683
  readonly subpath: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "RelativePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "RelativePath">>, never, never>;
670
684
  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>;
685
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
686
+ readonly action: Schema.String;
687
+ readonly resource: Schema.String;
688
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
689
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
690
+ readonly action: Schema.String;
691
+ readonly resource: Schema.String;
692
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
693
+ }>>>, never, never>;
671
694
  readonly revert: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
672
695
  readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
673
696
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
@@ -852,6 +875,15 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
852
875
  }>;
853
876
  readonly subpath: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "RelativePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "RelativePath">>, never, never>;
854
877
  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>;
878
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
879
+ readonly action: Schema.String;
880
+ readonly resource: Schema.String;
881
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
882
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
883
+ readonly action: Schema.String;
884
+ readonly resource: Schema.String;
885
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
886
+ }>>>, never, never>;
855
887
  readonly revert: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
856
888
  readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
857
889
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
@@ -1735,6 +1767,15 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
1735
1767
  }>;
1736
1768
  readonly subpath: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "RelativePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "RelativePath">>, never, never>;
1737
1769
  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>;
1770
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
1771
+ readonly action: Schema.String;
1772
+ readonly resource: Schema.String;
1773
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
1774
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
1775
+ readonly action: Schema.String;
1776
+ readonly resource: Schema.String;
1777
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
1778
+ }>>>, never, never>;
1738
1779
  readonly revert: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
1739
1780
  readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
1740
1781
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
@@ -1917,6 +1958,15 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
1917
1958
  }>;
1918
1959
  readonly subpath: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "RelativePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "RelativePath">>, never, never>;
1919
1960
  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>;
1961
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
1962
+ readonly action: Schema.String;
1963
+ readonly resource: Schema.String;
1964
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
1965
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
1966
+ readonly action: Schema.String;
1967
+ readonly resource: Schema.String;
1968
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
1969
+ }>>>, never, never>;
1920
1970
  readonly revert: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
1921
1971
  readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
1922
1972
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
@@ -2813,6 +2863,15 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
2813
2863
  }>;
2814
2864
  readonly subpath: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "RelativePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "RelativePath">>, never, never>;
2815
2865
  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>;
2866
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
2867
+ readonly action: Schema.String;
2868
+ readonly resource: Schema.String;
2869
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
2870
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
2871
+ readonly action: Schema.String;
2872
+ readonly resource: Schema.String;
2873
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
2874
+ }>>>, never, never>;
2816
2875
  readonly revert: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
2817
2876
  readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
2818
2877
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
@@ -3007,6 +3066,15 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
3007
3066
  }>;
3008
3067
  readonly subpath: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "RelativePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "RelativePath">>, never, never>;
3009
3068
  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>;
3069
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
3070
+ readonly action: Schema.String;
3071
+ readonly resource: Schema.String;
3072
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
3073
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
3074
+ readonly action: Schema.String;
3075
+ readonly resource: Schema.String;
3076
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
3077
+ }>>>, never, never>;
3010
3078
  readonly revert: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
3011
3079
  readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
3012
3080
  create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
@@ -4690,6 +4758,15 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
4690
4758
  };
4691
4759
  }>, never, never>;
4692
4760
  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>;
4761
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
4762
+ readonly action: Schema.String;
4763
+ readonly resource: Schema.String;
4764
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
4765
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
4766
+ readonly action: Schema.String;
4767
+ readonly resource: Schema.String;
4768
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
4769
+ }>>>, never, never>;
4693
4770
  readonly version: Schema.String;
4694
4771
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
4695
4772
  create: () => string & import("effect/Brand").Brand<"SessionID">;
@@ -4774,6 +4851,15 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
4774
4851
  };
4775
4852
  }>, never, never>;
4776
4853
  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>;
4854
+ readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
4855
+ readonly action: Schema.String;
4856
+ readonly resource: Schema.String;
4857
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
4858
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
4859
+ readonly action: Schema.String;
4860
+ readonly resource: Schema.String;
4861
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
4862
+ }>>>, never, never>;
4777
4863
  readonly version: Schema.String;
4778
4864
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
4779
4865
  create: () => string & import("effect/Brand").Brand<"SessionID">;
@@ -5150,6 +5236,66 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
5150
5236
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
5151
5237
  };
5152
5238
  }>;
5239
+ }) | (Schema.Struct<{
5240
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
5241
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
5242
+ };
5243
+ readonly created: Schema.Finite;
5244
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
5245
+ readonly type: Schema.Literal<"session.permissions.updated">;
5246
+ readonly durable: Schema.Struct<{
5247
+ readonly aggregateID: Schema.String;
5248
+ readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
5249
+ readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
5250
+ }>;
5251
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
5252
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
5253
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
5254
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
5255
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
5256
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
5257
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
5258
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
5259
+ }>, never, never>;
5260
+ }>>>, Schema.optionalKey<Schema.Struct<{
5261
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
5262
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
5263
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
5264
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
5265
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
5266
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
5267
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
5268
+ }>, never, never>;
5269
+ }>>, never, never>;
5270
+ readonly data: Schema.Struct<{
5271
+ readonly permissions: Schema.$Array<Schema.Struct<{
5272
+ readonly action: Schema.String;
5273
+ readonly resource: Schema.String;
5274
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
5275
+ }>>;
5276
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
5277
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
5278
+ descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
5279
+ };
5280
+ }>;
5281
+ }> & {
5282
+ type: "session.permissions.updated";
5283
+ durability: "durable";
5284
+ durable: {
5285
+ readonly version: number;
5286
+ readonly aggregate: string;
5287
+ };
5288
+ data: Schema.Struct<{
5289
+ readonly permissions: Schema.$Array<Schema.Struct<{
5290
+ readonly action: Schema.String;
5291
+ readonly resource: Schema.String;
5292
+ readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
5293
+ }>>;
5294
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
5295
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
5296
+ descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
5297
+ };
5298
+ }>;
5153
5299
  }) | (Schema.Struct<{
5154
5300
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
5155
5301
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
@@ -8552,6 +8698,11 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
8552
8698
  readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
8553
8699
  readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
8554
8700
  } | undefined;
8701
+ readonly permissions?: readonly {
8702
+ readonly action: string;
8703
+ readonly resource: string;
8704
+ readonly effect: "allow" | "deny" | "ask";
8705
+ }[] | undefined;
8555
8706
  readonly agent?: (string & import("effect/Brand").Brand<"Agent.ID">) | undefined;
8556
8707
  readonly subpath?: (string & import("effect/Brand").Brand<"RelativePath">) | undefined;
8557
8708
  readonly parentID?: (string & import("effect/Brand").Brand<"SessionID">) | undefined;
@@ -8665,6 +8816,30 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
8665
8816
  readonly metadata?: {
8666
8817
  readonly [x: string]: unknown;
8667
8818
  } | undefined;
8819
+ } | {
8820
+ readonly id: string & import("effect/Brand").Brand<"Event.ID">;
8821
+ readonly data: {
8822
+ readonly permissions: readonly {
8823
+ readonly action: string;
8824
+ readonly resource: string;
8825
+ readonly effect: "allow" | "deny" | "ask";
8826
+ }[];
8827
+ readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
8828
+ };
8829
+ readonly durable: {
8830
+ readonly aggregateID: string;
8831
+ readonly seq: number & import("effect/Brand").Brand<"Event.Seq">;
8832
+ readonly version: number & import("effect/Brand").Brand<"Event.Version">;
8833
+ };
8834
+ readonly type: "session.permissions.updated";
8835
+ readonly created: number;
8836
+ readonly location?: {
8837
+ readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
8838
+ readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
8839
+ } | undefined;
8840
+ readonly metadata?: {
8841
+ readonly [x: string]: unknown;
8842
+ } | undefined;
8668
8843
  } | {
8669
8844
  readonly id: string & import("effect/Brand").Brand<"Event.ID">;
8670
8845
  readonly data: {
@@ -15,6 +15,7 @@ import { ConflictError, CommandExecutionError, CommandNotFoundError, InvalidCurs
15
15
  import { Agent } from "@opencode/schema/agent";
16
16
  import { Skill } from "@opencode/schema/skill";
17
17
  import { Model } from "@opencode/schema/model";
18
+ import { Permission } from "@opencode/schema/permission";
18
19
  import { Location } from "@opencode/schema/location";
19
20
  import { SessionEvent } from "@opencode/schema/session-event";
20
21
  import { EventLog } from "@opencode/schema/event-log";
@@ -129,6 +130,7 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
129
130
  model: Model.Ref.pipe(Schema.optional),
130
131
  location: Location.Ref.pipe(Schema.optional),
131
132
  metadata: Session.Metadata.pipe(Schema.optional),
133
+ permissions: Permission.Ruleset.pipe(Schema.optional),
132
134
  }),
133
135
  success: Schema.Struct({ data: Session.Info }),
134
136
  }).annotateMerge(OpenApi.annotations({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/protocol",
4
- "version": "0.0.0-dev-19447",
4
+ "version": "0.0.0-dev-19449",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "typecheck": "tsgo --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@opencode/schema": "0.0.0-dev-19447",
35
+ "@opencode/schema": "0.0.0-dev-19449",
36
36
  "effect": "4.0.0-rc.112"
37
37
  },
38
38
  "devDependencies": {