@segmentstream/ontology 0.182.0 → 0.183.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.
@@ -113,6 +113,9 @@ import { type ResolvedGuest, type ResolvedSignInOptions, type SignInPolicy } fro
113
113
  * Within version 16, an entity may carry `erase_from_warehouse_on_delete: true`, written only when
114
114
  * declared: deleting a record erases its replicated history from the warehouse. The SDK's own
115
115
  * replication capture acts on it; readers ignore it.
116
+ * Within version 16, an action may carry `anyOf`, written only when several permissions open it,
117
+ * as the built-in `agent_chat.send` is: any one of them runs it, and `permission` is the first.
118
+ * Older readers show the action as requiring `permission` alone.
116
119
  */
117
120
  export declare const MANIFEST_VERSION = 16;
118
121
  /** The phrase used for a direction the author did not phrase. */
@@ -201,6 +204,11 @@ export declare const ActionManifest: Schema.Struct<{
201
204
  * written; absent from version 1 manifests, where it reads as `<entity>:<action name>`.
202
205
  */
203
206
  readonly permission: Schema.optionalKey<Schema.String>;
207
+ /**
208
+ * For an action several permissions open, each of them, any one of which runs it; `permission` is
209
+ * the first. Written only then; an older reader shows the action as requiring `permission` alone.
210
+ */
211
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
204
212
  /** JSON Schema (draft 2020-12) of the input object. */
205
213
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
206
214
  /** Opt-in SQL handler replay after a confirmed deadlock rollback; absent means disabled. */
@@ -376,6 +384,11 @@ export declare const EntityManifest: Schema.Struct<{
376
384
  * written; absent from version 1 manifests, where it reads as `<entity>:<action name>`.
377
385
  */
378
386
  readonly permission: Schema.optionalKey<Schema.String>;
387
+ /**
388
+ * For an action several permissions open, each of them, any one of which runs it; `permission` is
389
+ * the first. Written only then; an older reader shows the action as requiring `permission` alone.
390
+ */
391
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
379
392
  /** JSON Schema (draft 2020-12) of the input object. */
380
393
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
381
394
  /** Opt-in SQL handler replay after a confirmed deadlock rollback; absent means disabled. */
@@ -742,6 +755,11 @@ export declare const ToolsetManifest: Schema.Struct<{
742
755
  * written; absent from version 1 manifests, where it reads as `<entity>:<action name>`.
743
756
  */
744
757
  readonly permission: Schema.optionalKey<Schema.String>;
758
+ /**
759
+ * For an action several permissions open, each of them, any one of which runs it; `permission` is
760
+ * the first. Written only then; an older reader shows the action as requiring `permission` alone.
761
+ */
762
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
745
763
  /** JSON Schema (draft 2020-12) of the input object. */
746
764
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
747
765
  /** Opt-in SQL handler replay after a confirmed deadlock rollback; absent means disabled. */
@@ -1118,6 +1136,11 @@ export declare const OntologyManifestWire: Schema.encodeKeys<Schema.Struct<{
1118
1136
  * written; absent from version 1 manifests, where it reads as `<entity>:<action name>`.
1119
1137
  */
1120
1138
  readonly permission: Schema.optionalKey<Schema.String>;
1139
+ /**
1140
+ * For an action several permissions open, each of them, any one of which runs it; `permission` is
1141
+ * the first. Written only then; an older reader shows the action as requiring `permission` alone.
1142
+ */
1143
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
1121
1144
  /** JSON Schema (draft 2020-12) of the input object. */
1122
1145
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1123
1146
  /** Opt-in SQL handler replay after a confirmed deadlock rollback; absent means disabled. */
@@ -1515,6 +1538,11 @@ export declare const OntologyManifestWire: Schema.encodeKeys<Schema.Struct<{
1515
1538
  * written; absent from version 1 manifests, where it reads as `<entity>:<action name>`.
1516
1539
  */
1517
1540
  readonly permission: Schema.optionalKey<Schema.String>;
1541
+ /**
1542
+ * For an action several permissions open, each of them, any one of which runs it; `permission` is
1543
+ * the first. Written only then; an older reader shows the action as requiring `permission` alone.
1544
+ */
1545
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
1518
1546
  /** JSON Schema (draft 2020-12) of the input object. */
1519
1547
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1520
1548
  /** Opt-in SQL handler replay after a confirmed deadlock rollback; absent means disabled. */
@@ -1614,6 +1642,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
1614
1642
  readonly property: string;
1615
1643
  }[] | undefined;
1616
1644
  readonly connections?: readonly string[] | undefined;
1645
+ readonly anyOf?: readonly string[] | undefined;
1617
1646
  readonly retryOnDeadlock?: boolean | undefined;
1618
1647
  readonly writes?: readonly string[] | undefined;
1619
1648
  readonly hints?: {
@@ -1926,6 +1955,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
1926
1955
  readonly property: string;
1927
1956
  }[] | undefined;
1928
1957
  readonly connections?: readonly string[] | undefined;
1958
+ readonly anyOf?: readonly string[] | undefined;
1929
1959
  readonly retryOnDeadlock?: boolean | undefined;
1930
1960
  readonly writes?: readonly string[] | undefined;
1931
1961
  readonly hints?: {
@@ -1996,6 +2026,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
1996
2026
  readonly property: string;
1997
2027
  }[] | undefined;
1998
2028
  readonly connections?: readonly string[] | undefined;
2029
+ readonly anyOf?: readonly string[] | undefined;
1999
2030
  readonly retryOnDeadlock?: boolean | undefined;
2000
2031
  readonly writes?: readonly string[] | undefined;
2001
2032
  readonly hints?: {
@@ -2308,6 +2339,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2308
2339
  readonly property: string;
2309
2340
  }[] | undefined;
2310
2341
  readonly connections?: readonly string[] | undefined;
2342
+ readonly anyOf?: readonly string[] | undefined;
2311
2343
  readonly retryOnDeadlock?: boolean | undefined;
2312
2344
  readonly writes?: readonly string[] | undefined;
2313
2345
  readonly hints?: {
@@ -2378,6 +2410,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2378
2410
  readonly property: string;
2379
2411
  }[] | undefined;
2380
2412
  readonly connections?: readonly string[] | undefined;
2413
+ readonly anyOf?: readonly string[] | undefined;
2381
2414
  readonly retryOnDeadlock?: boolean | undefined;
2382
2415
  readonly writes?: readonly string[] | undefined;
2383
2416
  readonly hints?: {
@@ -2649,6 +2682,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2649
2682
  readonly property: string;
2650
2683
  }[] | undefined;
2651
2684
  readonly connections?: readonly string[] | undefined;
2685
+ readonly anyOf?: readonly string[] | undefined;
2652
2686
  readonly retryOnDeadlock?: boolean | undefined;
2653
2687
  readonly writes?: readonly string[] | undefined;
2654
2688
  readonly hints?: {
@@ -2760,6 +2794,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2760
2794
  readonly property: string;
2761
2795
  }[] | undefined;
2762
2796
  readonly connections?: readonly string[] | undefined;
2797
+ readonly anyOf?: readonly string[] | undefined;
2763
2798
  readonly retryOnDeadlock?: boolean | undefined;
2764
2799
  readonly writes?: readonly string[] | undefined;
2765
2800
  readonly hints?: {
@@ -3072,6 +3107,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3072
3107
  readonly property: string;
3073
3108
  }[] | undefined;
3074
3109
  readonly connections?: readonly string[] | undefined;
3110
+ readonly anyOf?: readonly string[] | undefined;
3075
3111
  readonly retryOnDeadlock?: boolean | undefined;
3076
3112
  readonly writes?: readonly string[] | undefined;
3077
3113
  readonly hints?: {
@@ -3180,6 +3216,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3180
3216
  * written; absent from version 1 manifests, where it reads as `<entity>:<action name>`.
3181
3217
  */
3182
3218
  readonly permission: Schema.optionalKey<Schema.String>;
3219
+ /**
3220
+ * For an action several permissions open, each of them, any one of which runs it; `permission` is
3221
+ * the first. Written only then; an older reader shows the action as requiring `permission` alone.
3222
+ */
3223
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
3183
3224
  /** JSON Schema (draft 2020-12) of the input object. */
3184
3225
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3185
3226
  /** Opt-in SQL handler replay after a confirmed deadlock rollback; absent means disabled. */
@@ -3577,6 +3618,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3577
3618
  * written; absent from version 1 manifests, where it reads as `<entity>:<action name>`.
3578
3619
  */
3579
3620
  readonly permission: Schema.optionalKey<Schema.String>;
3621
+ /**
3622
+ * For an action several permissions open, each of them, any one of which runs it; `permission` is
3623
+ * the first. Written only then; an older reader shows the action as requiring `permission` alone.
3624
+ */
3625
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
3580
3626
  /** JSON Schema (draft 2020-12) of the input object. */
3581
3627
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3582
3628
  /** Opt-in SQL handler replay after a confirmed deadlock rollback; absent means disabled. */
@@ -3721,6 +3767,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3721
3767
  * written; absent from version 1 manifests, where it reads as `<entity>:<action name>`.
3722
3768
  */
3723
3769
  readonly permission: Schema.optionalKey<Schema.String>;
3770
+ /**
3771
+ * For an action several permissions open, each of them, any one of which runs it; `permission` is
3772
+ * the first. Written only then; an older reader shows the action as requiring `permission` alone.
3773
+ */
3774
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
3724
3775
  /** JSON Schema (draft 2020-12) of the input object. */
3725
3776
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
3726
3777
  /** Opt-in SQL handler replay after a confirmed deadlock rollback; absent means disabled. */
@@ -4096,6 +4147,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
4096
4147
  * written; absent from version 1 manifests, where it reads as `<entity>:<action name>`.
4097
4148
  */
4098
4149
  readonly permission: Schema.optionalKey<Schema.String>;
4150
+ /**
4151
+ * For an action several permissions open, each of them, any one of which runs it; `permission` is
4152
+ * the first. Written only then; an older reader shows the action as requiring `permission` alone.
4153
+ */
4154
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
4099
4155
  /** JSON Schema (draft 2020-12) of the input object. */
4100
4156
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
4101
4157
  /** Opt-in SQL handler replay after a confirmed deadlock rollback; absent means disabled. */
@@ -4187,6 +4243,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
4187
4243
  readonly property: string;
4188
4244
  }[] | undefined;
4189
4245
  readonly connections?: readonly string[] | undefined;
4246
+ readonly anyOf?: readonly string[] | undefined;
4190
4247
  readonly retryOnDeadlock?: boolean | undefined;
4191
4248
  readonly writes?: readonly string[] | undefined;
4192
4249
  readonly hints?: {
@@ -4499,6 +4556,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
4499
4556
  readonly property: string;
4500
4557
  }[] | undefined;
4501
4558
  readonly connections?: readonly string[] | undefined;
4559
+ readonly anyOf?: readonly string[] | undefined;
4502
4560
  readonly retryOnDeadlock?: boolean | undefined;
4503
4561
  readonly writes?: readonly string[] | undefined;
4504
4562
  readonly hints?: {
@@ -4569,6 +4627,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
4569
4627
  readonly property: string;
4570
4628
  }[] | undefined;
4571
4629
  readonly connections?: readonly string[] | undefined;
4630
+ readonly anyOf?: readonly string[] | undefined;
4572
4631
  readonly retryOnDeadlock?: boolean | undefined;
4573
4632
  readonly writes?: readonly string[] | undefined;
4574
4633
  readonly hints?: {
@@ -4881,6 +4940,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
4881
4940
  readonly property: string;
4882
4941
  }[] | undefined;
4883
4942
  readonly connections?: readonly string[] | undefined;
4943
+ readonly anyOf?: readonly string[] | undefined;
4884
4944
  readonly retryOnDeadlock?: boolean | undefined;
4885
4945
  readonly writes?: readonly string[] | undefined;
4886
4946
  readonly hints?: {
@@ -4957,6 +5017,7 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
4957
5017
  readonly property: string;
4958
5018
  }[] | undefined;
4959
5019
  readonly connections?: readonly string[] | undefined;
5020
+ readonly anyOf?: readonly string[] | undefined;
4960
5021
  readonly retryOnDeadlock?: boolean | undefined;
4961
5022
  readonly writes?: readonly string[] | undefined;
4962
5023
  readonly hints?: {
@@ -5269,6 +5330,7 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
5269
5330
  readonly property: string;
5270
5331
  }[] | undefined;
5271
5332
  readonly connections?: readonly string[] | undefined;
5333
+ readonly anyOf?: readonly string[] | undefined;
5272
5334
  readonly retryOnDeadlock?: boolean | undefined;
5273
5335
  readonly writes?: readonly string[] | undefined;
5274
5336
  readonly hints?: {
@@ -5339,6 +5401,7 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
5339
5401
  readonly property: string;
5340
5402
  }[] | undefined;
5341
5403
  readonly connections?: readonly string[] | undefined;
5404
+ readonly anyOf?: readonly string[] | undefined;
5342
5405
  readonly retryOnDeadlock?: boolean | undefined;
5343
5406
  readonly writes?: readonly string[] | undefined;
5344
5407
  readonly hints?: {
@@ -5651,6 +5714,7 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
5651
5714
  readonly property: string;
5652
5715
  }[] | undefined;
5653
5716
  readonly connections?: readonly string[] | undefined;
5717
+ readonly anyOf?: readonly string[] | undefined;
5654
5718
  readonly retryOnDeadlock?: boolean | undefined;
5655
5719
  readonly writes?: readonly string[] | undefined;
5656
5720
  readonly hints?: {
package/dist/manifest.js CHANGED
@@ -114,6 +114,9 @@ import { CHANNEL_PROVIDERS, DEFAULT_SIGN_IN_POLICY, isGuestBotCheckScheme, isGue
114
114
  * Within version 16, an entity may carry `erase_from_warehouse_on_delete: true`, written only when
115
115
  * declared: deleting a record erases its replicated history from the warehouse. The SDK's own
116
116
  * replication capture acts on it; readers ignore it.
117
+ * Within version 16, an action may carry `anyOf`, written only when several permissions open it,
118
+ * as the built-in `agent_chat.send` is: any one of them runs it, and `permission` is the first.
119
+ * Older readers show the action as requiring `permission` alone.
117
120
  */
118
121
  export const MANIFEST_VERSION = 16;
119
122
  /** The first version whose documents use snake_case names on the wire. */
@@ -197,6 +200,11 @@ export const ActionManifest = Schema.Struct({
197
200
  * written; absent from version 1 manifests, where it reads as `<entity>:<action name>`.
198
201
  */
199
202
  permission: Schema.optionalKey(Schema.String),
203
+ /**
204
+ * For an action several permissions open, each of them, any one of which runs it; `permission` is
205
+ * the first. Written only then; an older reader shows the action as requiring `permission` alone.
206
+ */
207
+ anyOf: Schema.optionalKey(Schema.Array(Schema.String)),
200
208
  /** JSON Schema (draft 2020-12) of the input object. */
201
209
  input: Schema.Record(Schema.String, Schema.Json),
202
210
  /** Opt-in SQL handler replay after a confirmed deadlock rollback; absent means disabled. */
@@ -1114,6 +1122,7 @@ function entityManifest(input) {
1114
1122
  name: action.name,
1115
1123
  description: action.action.description,
1116
1124
  permission: action.permission,
1125
+ ...(action.anyOf === undefined ? {} : { anyOf: [...action.anyOf] }),
1117
1126
  input: action.input ?? {},
1118
1127
  ...(action.action.retryOnDeadlock === undefined
1119
1128
  ? {}
@@ -348,6 +348,7 @@ export declare const MigrationPlan: Schema.Struct<{
348
348
  readonly property: string;
349
349
  }[] | undefined;
350
350
  readonly connections?: readonly string[] | undefined;
351
+ readonly anyOf?: readonly string[] | undefined;
351
352
  readonly retryOnDeadlock?: boolean | undefined;
352
353
  readonly writes?: readonly string[] | undefined;
353
354
  readonly hints?: {
@@ -660,6 +661,7 @@ export declare const MigrationPlan: Schema.Struct<{
660
661
  readonly property: string;
661
662
  }[] | undefined;
662
663
  readonly connections?: readonly string[] | undefined;
664
+ readonly anyOf?: readonly string[] | undefined;
663
665
  readonly retryOnDeadlock?: boolean | undefined;
664
666
  readonly writes?: readonly string[] | undefined;
665
667
  readonly hints?: {
@@ -730,6 +732,7 @@ export declare const MigrationPlan: Schema.Struct<{
730
732
  readonly property: string;
731
733
  }[] | undefined;
732
734
  readonly connections?: readonly string[] | undefined;
735
+ readonly anyOf?: readonly string[] | undefined;
733
736
  readonly retryOnDeadlock?: boolean | undefined;
734
737
  readonly writes?: readonly string[] | undefined;
735
738
  readonly hints?: {
@@ -1042,6 +1045,7 @@ export declare const MigrationPlan: Schema.Struct<{
1042
1045
  readonly property: string;
1043
1046
  }[] | undefined;
1044
1047
  readonly connections?: readonly string[] | undefined;
1048
+ readonly anyOf?: readonly string[] | undefined;
1045
1049
  readonly retryOnDeadlock?: boolean | undefined;
1046
1050
  readonly writes?: readonly string[] | undefined;
1047
1051
  readonly hints?: {
@@ -1112,6 +1116,7 @@ export declare const MigrationPlan: Schema.Struct<{
1112
1116
  readonly property: string;
1113
1117
  }[] | undefined;
1114
1118
  readonly connections?: readonly string[] | undefined;
1119
+ readonly anyOf?: readonly string[] | undefined;
1115
1120
  readonly retryOnDeadlock?: boolean | undefined;
1116
1121
  readonly writes?: readonly string[] | undefined;
1117
1122
  readonly hints?: {
@@ -1383,6 +1388,7 @@ export declare const MigrationPlan: Schema.Struct<{
1383
1388
  readonly property: string;
1384
1389
  }[] | undefined;
1385
1390
  readonly connections?: readonly string[] | undefined;
1391
+ readonly anyOf?: readonly string[] | undefined;
1386
1392
  readonly retryOnDeadlock?: boolean | undefined;
1387
1393
  readonly writes?: readonly string[] | undefined;
1388
1394
  readonly hints?: {
@@ -1494,6 +1500,7 @@ export declare const MigrationPlan: Schema.Struct<{
1494
1500
  readonly property: string;
1495
1501
  }[] | undefined;
1496
1502
  readonly connections?: readonly string[] | undefined;
1503
+ readonly anyOf?: readonly string[] | undefined;
1497
1504
  readonly retryOnDeadlock?: boolean | undefined;
1498
1505
  readonly writes?: readonly string[] | undefined;
1499
1506
  readonly hints?: {
@@ -1806,6 +1813,7 @@ export declare const MigrationPlan: Schema.Struct<{
1806
1813
  readonly property: string;
1807
1814
  }[] | undefined;
1808
1815
  readonly connections?: readonly string[] | undefined;
1816
+ readonly anyOf?: readonly string[] | undefined;
1809
1817
  readonly retryOnDeadlock?: boolean | undefined;
1810
1818
  readonly writes?: readonly string[] | undefined;
1811
1819
  readonly hints?: {
@@ -1902,6 +1910,7 @@ export declare const MigrationPlan: Schema.Struct<{
1902
1910
  readonly name: Schema.String;
1903
1911
  readonly description: Schema.String;
1904
1912
  readonly permission: Schema.optionalKey<Schema.String>;
1913
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
1905
1914
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1906
1915
  readonly retryOnDeadlock: Schema.optionalKey<Schema.Boolean>;
1907
1916
  readonly writes: Schema.optionalKey<Schema.$Array<Schema.String>>;
@@ -2193,6 +2202,7 @@ export declare const MigrationPlan: Schema.Struct<{
2193
2202
  readonly name: Schema.String;
2194
2203
  readonly description: Schema.String;
2195
2204
  readonly permission: Schema.optionalKey<Schema.String>;
2205
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
2196
2206
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
2197
2207
  readonly retryOnDeadlock: Schema.optionalKey<Schema.Boolean>;
2198
2208
  readonly writes: Schema.optionalKey<Schema.$Array<Schema.String>>;
@@ -2299,6 +2309,7 @@ export declare const MigrationPlan: Schema.Struct<{
2299
2309
  readonly name: Schema.String;
2300
2310
  readonly description: Schema.String;
2301
2311
  readonly permission: Schema.optionalKey<Schema.String>;
2312
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
2302
2313
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
2303
2314
  readonly retryOnDeadlock: Schema.optionalKey<Schema.Boolean>;
2304
2315
  readonly writes: Schema.optionalKey<Schema.$Array<Schema.String>>;
@@ -2571,6 +2582,7 @@ export declare const MigrationPlan: Schema.Struct<{
2571
2582
  readonly name: Schema.String;
2572
2583
  readonly description: Schema.String;
2573
2584
  readonly permission: Schema.optionalKey<Schema.String>;
2585
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
2574
2586
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
2575
2587
  readonly retryOnDeadlock: Schema.optionalKey<Schema.Boolean>;
2576
2588
  readonly writes: Schema.optionalKey<Schema.$Array<Schema.String>>;
@@ -2647,6 +2659,7 @@ export declare const MigrationPlan: Schema.Struct<{
2647
2659
  readonly property: string;
2648
2660
  }[] | undefined;
2649
2661
  readonly connections?: readonly string[] | undefined;
2662
+ readonly anyOf?: readonly string[] | undefined;
2650
2663
  readonly retryOnDeadlock?: boolean | undefined;
2651
2664
  readonly writes?: readonly string[] | undefined;
2652
2665
  readonly hints?: {
@@ -2959,6 +2972,7 @@ export declare const MigrationPlan: Schema.Struct<{
2959
2972
  readonly property: string;
2960
2973
  }[] | undefined;
2961
2974
  readonly connections?: readonly string[] | undefined;
2975
+ readonly anyOf?: readonly string[] | undefined;
2962
2976
  readonly retryOnDeadlock?: boolean | undefined;
2963
2977
  readonly writes?: readonly string[] | undefined;
2964
2978
  readonly hints?: {
@@ -3029,6 +3043,7 @@ export declare const MigrationPlan: Schema.Struct<{
3029
3043
  readonly property: string;
3030
3044
  }[] | undefined;
3031
3045
  readonly connections?: readonly string[] | undefined;
3046
+ readonly anyOf?: readonly string[] | undefined;
3032
3047
  readonly retryOnDeadlock?: boolean | undefined;
3033
3048
  readonly writes?: readonly string[] | undefined;
3034
3049
  readonly hints?: {
@@ -3341,6 +3356,7 @@ export declare const MigrationPlan: Schema.Struct<{
3341
3356
  readonly property: string;
3342
3357
  }[] | undefined;
3343
3358
  readonly connections?: readonly string[] | undefined;
3359
+ readonly anyOf?: readonly string[] | undefined;
3344
3360
  readonly retryOnDeadlock?: boolean | undefined;
3345
3361
  readonly writes?: readonly string[] | undefined;
3346
3362
  readonly hints?: {
@@ -210,6 +210,23 @@ export declare function readScope(entity: string, holder: PermissionHolder): Sco
210
210
  export declare function effectivePermissions(principal: PermissionHolder): ReadonlyArray<string>;
211
211
  /** The first of the required permissions the principal lacks, or `undefined` when it holds all. */
212
212
  export declare function missingPermission(required: ReadonlyArray<string>, principal: PermissionHolder): string | undefined;
213
+ /**
214
+ * What running an action requires: every one of `permissions`, or, with `anyPermission`, any one of
215
+ * them, for an action several permissions open, whose input chooses what it does and which checks
216
+ * inside what that needs, as `agent_chat.send` checks the voice it sends in.
217
+ */
218
+ export interface ActionRequirement {
219
+ readonly permissions: ReadonlyArray<string>;
220
+ readonly anyPermission?: true;
221
+ }
222
+ /** Whether the holder may run an action that requires `required`. */
223
+ export declare function allowsAction(required: ActionRequirement, holder: PermissionHolder): boolean;
224
+ /**
225
+ * What the holder lacks to run an action that requires `required`, for a refusal: the first
226
+ * permission it lacks, or, for an action any one of several permissions opens, all of them joined
227
+ * by `or`. `undefined` when it may run the action.
228
+ */
229
+ export declare function missingActionPermission(required: ActionRequirement, holder: PermissionHolder): string | undefined;
213
230
  /**
214
231
  * What a generated action requires: `<entity>:<action>`, except `upsert_by_<property>`, which may
215
232
  * create or update and so requires both `<entity>:create` and `<entity>:update`.
@@ -269,6 +269,23 @@ export function effectivePermissions(principal) {
269
269
  export function missingPermission(required, principal) {
270
270
  return required.find((permission) => !isAllowed(permission, principal));
271
271
  }
272
+ /** Whether the holder may run an action that requires `required`. */
273
+ export function allowsAction(required, holder) {
274
+ return required.anyPermission === true
275
+ ? required.permissions.some((permission) => isAllowed(permission, holder))
276
+ : required.permissions.every((permission) => isAllowed(permission, holder));
277
+ }
278
+ /**
279
+ * What the holder lacks to run an action that requires `required`, for a refusal: the first
280
+ * permission it lacks, or, for an action any one of several permissions opens, all of them joined
281
+ * by `or`. `undefined` when it may run the action.
282
+ */
283
+ export function missingActionPermission(required, holder) {
284
+ if (required.anyPermission !== true) {
285
+ return missingPermission(required.permissions, holder);
286
+ }
287
+ return allowsAction(required, holder) ? undefined : required.permissions.join(" or ");
288
+ }
272
289
  /**
273
290
  * What a generated action requires: `<entity>:<action>`, except `upsert_by_<property>`, which may
274
291
  * create or update and so requires both `<entity>:create` and `<entity>:update`.
package/dist/render.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ActionManifest, EntityManifest, MetricManifest, ModelMetricManifest, OntologyManifest } from "./manifest.js";
2
+ import { type ActionRequirement } from "./permissions.js";
2
3
  export interface RenderOptions {
3
4
  /**
4
5
  * The permissions of the reader. Only the actions these permissions may run are listed, and only
@@ -9,6 +10,11 @@ export interface RenderOptions {
9
10
  }
10
11
  /** What an action of the manifest requires; version 1 manifests leave it implicit. */
11
12
  export declare function actionPermission(entity: string, action: ActionManifest): string;
13
+ /**
14
+ * What running an action of the manifest requires: its permission, or, for an action several
15
+ * permissions open, any one of them.
16
+ */
17
+ export declare function actionRequirement(entity: string, action: ActionManifest): ActionRequirement;
12
18
  /**
13
19
  * A metric's description followed by its conditions and balance note, as `describe`, the MCP
14
20
  * metric list and the console show it: `Revenue of won orders. Where status = "won".`
package/dist/render.js CHANGED
@@ -1,17 +1,32 @@
1
1
  import { inputEntities, shortestRoutesFrom } from "./metric-routes.js";
2
2
  import { QUERY_METRICS_ROUTE } from "./names.js";
3
- import { isAllowed, permissionOf, READ_VERB, rolesGranting } from "./permissions.js";
3
+ import { allowsAction, isAllowed, permissionOf, READ_VERB, rolesGranting, } from "./permissions.js";
4
4
  import { REFERENCE_ANNOTATION } from "./property.js";
5
5
  /** What an action of the manifest requires; version 1 manifests leave it implicit. */
6
6
  export function actionPermission(entity, action) {
7
7
  return action.permission ?? permissionOf(entity, action.name);
8
8
  }
9
- /** `Requires lead:changeStatus (member, sales).`: the permission and the roles that grant it. */
10
- function requirement(subject, permission, roles) {
11
- const granting = rolesGranting(roles, permission);
12
- return granting.length === 0
13
- ? `${subject} ${permission}, which no role grants.`
14
- : `${subject} ${permission} (${granting.join(", ")}).`;
9
+ /**
10
+ * What running an action of the manifest requires: its permission, or, for an action several
11
+ * permissions open, any one of them.
12
+ */
13
+ export function actionRequirement(entity, action) {
14
+ return action.anyOf !== undefined && action.anyOf.length > 1
15
+ ? { permissions: action.anyOf, anyPermission: true }
16
+ : { permissions: [actionPermission(entity, action)] };
17
+ }
18
+ /**
19
+ * `Requires lead:changeStatus (member, sales).`: the permission and the roles that grant it, or, for
20
+ * an action several permissions open, each of them with its roles, joined by `or`.
21
+ */
22
+ function requirement(subject, permissions, roles) {
23
+ const granted = permissions.map((permission) => {
24
+ const granting = rolesGranting(roles, permission);
25
+ return granting.length === 0 ? permission : `${permission} (${granting.join(", ")})`;
26
+ });
27
+ return permissions.every((permission) => rolesGranting(roles, permission).length === 0)
28
+ ? `${subject} ${permissions.join(" or ")}, which no role grants.`
29
+ : `${subject} ${granted.join(" or ")}.`;
15
30
  }
16
31
  const INDENT = " ";
17
32
  function isRecord(value) {
@@ -310,14 +325,14 @@ export function metricDescription(entity, metric) {
310
325
  function renderEntity(entity, manifest, entities, options) {
311
326
  const reader = options.as;
312
327
  const actions = entity.actions.filter((action) => reader === undefined ||
313
- isAllowed(actionPermission(entity.name, action), { permissions: reader }));
328
+ allowsAction(actionRequirement(entity.name, action), { permissions: reader }));
314
329
  const read = entity.permissions?.read ?? permissionOf(entity.name, READ_VERB);
315
330
  const connections = new Map((manifest.connections ?? []).map((connection) => [connection.key, connection.description]));
316
331
  return [
317
332
  `${entity.label} (${entity.plural.toLowerCase()}): ${entity.description}`,
318
333
  `${INDENT}Identified by: ${entity.title}.`,
319
334
  ...(reader === undefined
320
- ? [`${INDENT}${requirement("Reading requires", read, manifest.roles)}`]
335
+ ? [`${INDENT}${requirement("Reading requires", [read], manifest.roles)}`]
321
336
  : []),
322
337
  ...(entity.source
323
338
  ? [`${INDENT}Source: ${entity.source.asset}; key: ${entity.source.key.join(", ")}.`]
@@ -326,7 +341,7 @@ function renderEntity(entity, manifest, entities, options) {
326
341
  ...section("Metrics", (entity.metrics ?? []).map((metric) => `${metric.name}: ${metricDescription(entity, metric)} (${metric.unit}).`)),
327
342
  ...section("Relationships", relationshipLines(entity, entities, manifest.entities)),
328
343
  ...section(reader === undefined ? "Actions" : "Actions you may run", actions.flatMap((action) => actionLines(action, reader === undefined
329
- ? requirement("Requires", actionPermission(entity.name, action), manifest.roles)
344
+ ? requirement("Requires", actionRequirement(entity.name, action).permissions, manifest.roles)
330
345
  : undefined, connections))),
331
346
  ].join("\n");
332
347
  }
@@ -5,6 +5,7 @@ import { type AnyAction } from "../action.js";
5
5
  import { ConnectionError, ConnectionTransport } from "../connection.js";
6
6
  import { type ActionError } from "../errors.js";
7
7
  import type { Ontology } from "../ontology.js";
8
+ import { type ActionRequirement } from "../permissions.js";
8
9
  import { type Principal } from "../runtime.js";
9
10
  import { TriggerInputInvalid, UnknownAction, WorkflowRecoveryUnavailable } from "./errors.js";
10
11
  import { Edit } from "./history.js";
@@ -102,10 +103,9 @@ export interface ActionOutcome<Result = unknown> {
102
103
  readonly validation: ActionValidation;
103
104
  readonly edits: ReadonlyArray<Edit>;
104
105
  }
105
- /** An action and every permission a principal needs to run it. */
106
- export interface FoundAction {
106
+ /** An action and every permission a principal needs to run it, or, with `anyPermission`, one. */
107
+ export interface FoundAction extends ActionRequirement {
107
108
  readonly action: AnyAction;
108
- readonly permissions: ReadonlyArray<string>;
109
109
  /**
110
110
  * A generated `create`, `update`, `delete`, `upsert_by_<property>`, `link`, `unlink` or member
111
111
  * action, whose input and result are in wire names.
@@ -16,7 +16,7 @@ import { beginReplicationWrite } from "../replication/transaction.js";
16
16
  import { RuntimeDeployment } from "./deployment.js";
17
17
  import { requireDeploymentCapability } from "../deployment.js";
18
18
  import { authorizeBlobOperation } from "../storage/authorization.js";
19
- import { effectiveScope, generatedActionPermissions, missingPermission, parsePermission, } from "../permissions.js";
19
+ import { effectiveScope, generatedActionPermissions, missingActionPermission, parsePermission, } from "../permissions.js";
20
20
  import { OntologyReads, OntologyRuntime } from "../runtime.js";
21
21
  import { UnknownAction, ValidationIssue, WorkflowRecoveryUnavailable, } from "./errors.js";
22
22
  import { generatedActions, writesOnlyThroughActions } from "./generated-actions.js";
@@ -72,7 +72,13 @@ export function resolveAction(ontology, entityName, actionName) {
72
72
  }
73
73
  const authored = entity.actions.find((candidate) => candidate.name === actionName);
74
74
  if (authored !== undefined) {
75
- return { action: authored.action, permissions: [authored.permission], generated: false };
75
+ return {
76
+ action: authored.action,
77
+ ...(authored.anyOf === undefined
78
+ ? { permissions: [authored.permission] }
79
+ : { permissions: authored.anyOf, anyPermission: true }),
80
+ generated: false,
81
+ };
76
82
  }
77
83
  const generated = generatedActions(ontology, entityName)[actionName];
78
84
  return generated === undefined
@@ -205,10 +211,11 @@ export function runAction(ontology, request) {
205
211
  if (!decoded.ok) {
206
212
  return { result: null, validation: { ok: false, issues: decoded.issues }, edits: [] };
207
213
  }
208
- const missing = missingPermission(found.permissions, request.principal);
214
+ const missing = missingActionPermission(found, request.principal);
209
215
  if (missing !== undefined) {
210
216
  return yield* new PermissionDenied({
211
- permission: missing,
217
+ // Of an action several permissions open, the first it names.
218
+ permission: found.anyPermission === true ? found.permissions[0] : missing,
212
219
  message: `${qualified} requires ${missing}, which the principal's roles do not grant.`,
213
220
  });
214
221
  }
@@ -1,6 +1,6 @@
1
1
  import { isValueMatched } from "../manifest.js";
2
- import { isAllowed } from "../permissions.js";
3
- import { actionPermission, modelMetricsFor } from "../render.js";
2
+ import { allowsAction, isAllowed } from "../permissions.js";
3
+ import { actionRequirement, modelMetricsFor } from "../render.js";
4
4
  /**
5
5
  * The catalog for a reader: the manifest, with each entity's actions narrowed to the ones the given
6
6
  * permissions may run, and only the metrics of the model whose every input entity they may read.
@@ -29,7 +29,7 @@ export function catalogFor(manifest, permissions) {
29
29
  isAllowed(entity.permissions?.read ?? `${entity.name}:read`, { permissions }))
30
30
  .map((entity) => ({
31
31
  ...entity,
32
- actions: entity.actions.filter((action) => isAllowed(actionPermission(entity.name, action), { permissions })),
32
+ actions: entity.actions.filter((action) => allowsAction(actionRequirement(entity.name, action), { permissions })),
33
33
  })),
34
34
  };
35
35
  }
@@ -10,7 +10,7 @@ import type { Destination } from "./resolve.js";
10
10
  export declare const CHAT_DRAFT_PERMISSION = "agent_chat:draft";
11
11
  /** The key prefix of a draft the agent writes on request: `request:<request>`. */
12
12
  export declare const REQUESTED_DRAFT_KEY = "request:";
13
- /** A private chat the inbox registered, as `agent_chat.send` and `postMessage` find it. */
13
+ /** A private chat the inbox registered, as `agent_chat.send` finds it in either voice. */
14
14
  export interface DraftChat {
15
15
  readonly target: Destination;
16
16
  readonly chatId: string;