@segmentstream/ontology 0.95.0 → 0.97.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.
Files changed (44) hide show
  1. package/README.md +39 -4
  2. package/dist/analyze.d.ts +23 -3
  3. package/dist/analyze.js +431 -17
  4. package/dist/authoring.js +3 -0
  5. package/dist/bin/check.js +2 -0
  6. package/dist/diagnostics.d.ts +3 -3
  7. package/dist/diagnostics.js +2 -0
  8. package/dist/index.d.ts +5 -3
  9. package/dist/index.js +3 -2
  10. package/dist/manifest.d.ts +607 -20
  11. package/dist/manifest.js +96 -4
  12. package/dist/migrate/apply.js +5 -1
  13. package/dist/migrate/model.d.ts +332 -12
  14. package/dist/migrate/storage.js +2 -0
  15. package/dist/ontology.d.ts +5 -2
  16. package/dist/ontology.js +1 -0
  17. package/dist/runtime/member-tables.d.ts +7 -2
  18. package/dist/runtime/member-tables.js +18 -3
  19. package/dist/runtime/new-user-hook.d.ts +11 -1
  20. package/dist/runtime/new-user-hook.js +69 -29
  21. package/dist/runtime/pipeline.d.ts +2 -0
  22. package/dist/runtime/pipeline.js +11 -3
  23. package/dist/runtime/principals.d.ts +13 -0
  24. package/dist/runtime/principals.js +98 -28
  25. package/dist/runtime/resolve-agent-identity.js +43 -12
  26. package/dist/runtime/service-binding.js +10 -4
  27. package/dist/service/catalog.js +10 -1
  28. package/dist/service/chat/envelope.d.ts +16 -16
  29. package/dist/service/connections.js +1 -0
  30. package/dist/service/discovery-search.d.ts +1 -1
  31. package/dist/service/mcp/server.js +13 -1
  32. package/dist/service/mcp/tools.d.ts +5 -0
  33. package/dist/service/mcp/tools.js +30 -0
  34. package/dist/service/operations.d.ts +3 -1
  35. package/dist/service/operations.js +3 -0
  36. package/dist/service/schemas.d.ts +74 -0
  37. package/dist/service/toolsets.d.ts +49 -0
  38. package/dist/service/toolsets.js +284 -0
  39. package/dist/sign-in.d.ts +32 -1
  40. package/dist/sign-in.js +12 -1
  41. package/dist/toolset.d.ts +141 -0
  42. package/dist/toolset.js +154 -0
  43. package/dist/user-identity.d.ts +1 -1
  44. package/package.json +1 -1
@@ -400,10 +400,10 @@ export declare const MigrationPlan: Schema.Struct<{
400
400
  readonly telegram?: {
401
401
  readonly connection: string;
402
402
  } | undefined;
403
- readonly slack?: {
403
+ readonly whatsapp?: {
404
404
  readonly connection: string;
405
405
  } | undefined;
406
- readonly whatsapp?: {
406
+ readonly slack?: {
407
407
  readonly connection: string;
408
408
  } | undefined;
409
409
  readonly attribution?: {
@@ -491,6 +491,12 @@ export declare const MigrationPlan: Schema.Struct<{
491
491
  } | undefined;
492
492
  readonly onNewUser?: string | undefined;
493
493
  readonly codeLink?: boolean | undefined;
494
+ readonly signUp?: {
495
+ readonly channels: {
496
+ readonly [x: string]: unknown;
497
+ };
498
+ } | undefined;
499
+ readonly onSignUp?: string | undefined;
494
500
  } | undefined;
495
501
  readonly emails?: {
496
502
  readonly [x: string]: {
@@ -508,6 +514,41 @@ export declare const MigrationPlan: Schema.Struct<{
508
514
  readonly footer?: string | undefined;
509
515
  };
510
516
  } | undefined;
517
+ readonly toolsets?: readonly {
518
+ readonly name: string;
519
+ readonly description: string;
520
+ readonly connection: string;
521
+ readonly api: string;
522
+ readonly tools: readonly {
523
+ readonly name: string;
524
+ readonly access: "read" | "write";
525
+ readonly fixed: {
526
+ readonly [x: string]: string | number | boolean;
527
+ };
528
+ }[];
529
+ readonly actions: readonly {
530
+ readonly name: string;
531
+ readonly description: string;
532
+ readonly input: {
533
+ readonly [x: string]: Schema.Json;
534
+ };
535
+ readonly permission?: string | undefined;
536
+ readonly retryOnDeadlock?: boolean | undefined;
537
+ readonly writes?: readonly string[] | undefined;
538
+ readonly connections?: readonly string[] | undefined;
539
+ readonly files?: readonly {
540
+ readonly entity: string;
541
+ readonly property: string;
542
+ }[] | undefined;
543
+ readonly hints?: {
544
+ readonly readOnly?: boolean | undefined;
545
+ readonly connectionsReadOnly?: boolean | undefined;
546
+ readonly destructive?: boolean | undefined;
547
+ readonly irreversible?: boolean | undefined;
548
+ readonly idempotent?: boolean | undefined;
549
+ } | undefined;
550
+ }[];
551
+ }[] | undefined;
511
552
  } | {
512
553
  readonly version: number;
513
554
  readonly hash: string;
@@ -627,10 +668,10 @@ export declare const MigrationPlan: Schema.Struct<{
627
668
  readonly telegram?: {
628
669
  readonly connection: string;
629
670
  } | undefined;
630
- readonly slack?: {
671
+ readonly whatsapp?: {
631
672
  readonly connection: string;
632
673
  } | undefined;
633
- readonly whatsapp?: {
674
+ readonly slack?: {
634
675
  readonly connection: string;
635
676
  } | undefined;
636
677
  readonly attribution?: {
@@ -718,6 +759,12 @@ export declare const MigrationPlan: Schema.Struct<{
718
759
  } | undefined;
719
760
  readonly onNewUser?: string | undefined;
720
761
  readonly codeLink?: boolean | undefined;
762
+ readonly signUp?: {
763
+ readonly channels: {
764
+ readonly [x: string]: unknown;
765
+ };
766
+ } | undefined;
767
+ readonly onSignUp?: string | undefined;
721
768
  } | undefined;
722
769
  readonly emails?: {
723
770
  readonly [x: string]: {
@@ -735,6 +782,41 @@ export declare const MigrationPlan: Schema.Struct<{
735
782
  readonly footer?: string | undefined;
736
783
  };
737
784
  } | undefined;
785
+ readonly toolsets?: readonly {
786
+ readonly name: string;
787
+ readonly description: string;
788
+ readonly connection: string;
789
+ readonly api: string;
790
+ readonly tools: readonly {
791
+ readonly name: string;
792
+ readonly access: "read" | "write";
793
+ readonly fixed: {
794
+ readonly [x: string]: string | number | boolean;
795
+ };
796
+ }[];
797
+ readonly actions: readonly {
798
+ readonly name: string;
799
+ readonly description: string;
800
+ readonly input: {
801
+ readonly [x: string]: Schema.Json;
802
+ };
803
+ readonly permission?: string | undefined;
804
+ readonly retryOnDeadlock?: boolean | undefined;
805
+ readonly writes?: readonly string[] | undefined;
806
+ readonly connections?: readonly string[] | undefined;
807
+ readonly files?: readonly {
808
+ readonly entity: string;
809
+ readonly property: string;
810
+ }[] | undefined;
811
+ readonly hints?: {
812
+ readonly readOnly?: boolean | undefined;
813
+ readonly connectionsReadOnly?: boolean | undefined;
814
+ readonly destructive?: boolean | undefined;
815
+ readonly irreversible?: boolean | undefined;
816
+ readonly idempotent?: boolean | undefined;
817
+ } | undefined;
818
+ }[];
819
+ }[] | undefined;
738
820
  }, {
739
821
  readonly version: number;
740
822
  readonly hash: string;
@@ -854,10 +936,10 @@ export declare const MigrationPlan: Schema.Struct<{
854
936
  readonly telegram?: {
855
937
  readonly connection: string;
856
938
  } | undefined;
857
- readonly slack?: {
939
+ readonly whatsapp?: {
858
940
  readonly connection: string;
859
941
  } | undefined;
860
- readonly whatsapp?: {
942
+ readonly slack?: {
861
943
  readonly connection: string;
862
944
  } | undefined;
863
945
  readonly attribution?: {
@@ -946,6 +1028,41 @@ export declare const MigrationPlan: Schema.Struct<{
946
1028
  readonly reply_to?: string | undefined;
947
1029
  };
948
1030
  } | undefined;
1031
+ readonly toolsets?: readonly {
1032
+ readonly name: string;
1033
+ readonly description: string;
1034
+ readonly connection: string;
1035
+ readonly api: string;
1036
+ readonly tools: readonly {
1037
+ readonly name: string;
1038
+ readonly access: "read" | "write";
1039
+ readonly fixed: {
1040
+ readonly [x: string]: string | number | boolean;
1041
+ };
1042
+ }[];
1043
+ readonly actions: readonly {
1044
+ readonly name: string;
1045
+ readonly description: string;
1046
+ readonly input: {
1047
+ readonly [x: string]: Schema.Json;
1048
+ };
1049
+ readonly permission?: string | undefined;
1050
+ readonly retryOnDeadlock?: boolean | undefined;
1051
+ readonly writes?: readonly string[] | undefined;
1052
+ readonly connections?: readonly string[] | undefined;
1053
+ readonly files?: readonly {
1054
+ readonly entity: string;
1055
+ readonly property: string;
1056
+ }[] | undefined;
1057
+ readonly hints?: {
1058
+ readonly readOnly?: boolean | undefined;
1059
+ readonly connectionsReadOnly?: boolean | undefined;
1060
+ readonly destructive?: boolean | undefined;
1061
+ readonly irreversible?: boolean | undefined;
1062
+ readonly idempotent?: boolean | undefined;
1063
+ } | undefined;
1064
+ }[];
1065
+ }[] | undefined;
949
1066
  readonly sign_in?: {
950
1067
  readonly policy: string;
951
1068
  readonly browser?: {
@@ -961,6 +1078,12 @@ export declare const MigrationPlan: Schema.Struct<{
961
1078
  } | undefined;
962
1079
  readonly on_new_user?: string | undefined;
963
1080
  readonly code_link?: boolean | undefined;
1081
+ readonly sign_up?: {
1082
+ readonly channels: {
1083
+ readonly [x: string]: unknown;
1084
+ };
1085
+ } | undefined;
1086
+ readonly on_sign_up?: string | undefined;
964
1087
  } | undefined;
965
1088
  } | {
966
1089
  readonly version: number;
@@ -1081,10 +1204,10 @@ export declare const MigrationPlan: Schema.Struct<{
1081
1204
  readonly telegram?: {
1082
1205
  readonly connection: string;
1083
1206
  } | undefined;
1084
- readonly slack?: {
1207
+ readonly whatsapp?: {
1085
1208
  readonly connection: string;
1086
1209
  } | undefined;
1087
- readonly whatsapp?: {
1210
+ readonly slack?: {
1088
1211
  readonly connection: string;
1089
1212
  } | undefined;
1090
1213
  readonly attribution?: {
@@ -1172,6 +1295,12 @@ export declare const MigrationPlan: Schema.Struct<{
1172
1295
  } | undefined;
1173
1296
  readonly on_new_user?: string | undefined;
1174
1297
  readonly code_link?: boolean | undefined;
1298
+ readonly sign_up?: {
1299
+ readonly channels: {
1300
+ readonly [x: string]: unknown;
1301
+ };
1302
+ } | undefined;
1303
+ readonly on_sign_up?: string | undefined;
1175
1304
  } | undefined;
1176
1305
  readonly emails?: {
1177
1306
  readonly [x: string]: {
@@ -1189,6 +1318,41 @@ export declare const MigrationPlan: Schema.Struct<{
1189
1318
  readonly reply_to?: string | undefined;
1190
1319
  };
1191
1320
  } | undefined;
1321
+ readonly toolsets?: readonly {
1322
+ readonly name: string;
1323
+ readonly description: string;
1324
+ readonly connection: string;
1325
+ readonly api: string;
1326
+ readonly tools: readonly {
1327
+ readonly name: string;
1328
+ readonly access: "read" | "write";
1329
+ readonly fixed: {
1330
+ readonly [x: string]: string | number | boolean;
1331
+ };
1332
+ }[];
1333
+ readonly actions: readonly {
1334
+ readonly name: string;
1335
+ readonly description: string;
1336
+ readonly input: {
1337
+ readonly [x: string]: Schema.Json;
1338
+ };
1339
+ readonly permission?: string | undefined;
1340
+ readonly retryOnDeadlock?: boolean | undefined;
1341
+ readonly writes?: readonly string[] | undefined;
1342
+ readonly connections?: readonly string[] | undefined;
1343
+ readonly files?: readonly {
1344
+ readonly entity: string;
1345
+ readonly property: string;
1346
+ }[] | undefined;
1347
+ readonly hints?: {
1348
+ readonly readOnly?: boolean | undefined;
1349
+ readonly connectionsReadOnly?: boolean | undefined;
1350
+ readonly destructive?: boolean | undefined;
1351
+ readonly irreversible?: boolean | undefined;
1352
+ readonly idempotent?: boolean | undefined;
1353
+ } | undefined;
1354
+ }[];
1355
+ }[] | undefined;
1192
1356
  }, readonly [Schema.Union<readonly [Schema.encodeKeys<Schema.Struct<{
1193
1357
  readonly entities: Schema.$Array<Schema.encodeKeys<Schema.Struct<{
1194
1358
  readonly metrics: Schema.optionalKey<Schema.$Array<Schema.encodeKeys<Schema.Struct<{
@@ -1341,9 +1505,15 @@ export declare const MigrationPlan: Schema.Struct<{
1341
1505
  readonly channels: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
1342
1506
  readonly onNewUser: Schema.optionalKey<Schema.String>;
1343
1507
  readonly codeLink: Schema.optionalKey<Schema.Boolean>;
1508
+ readonly signUp: Schema.optionalKey<Schema.Struct<{
1509
+ readonly channels: Schema.$Record<Schema.String, Schema.Unknown>;
1510
+ }>>;
1511
+ readonly onSignUp: Schema.optionalKey<Schema.String>;
1344
1512
  }>, {
1345
1513
  readonly onNewUser: "on_new_user";
1346
1514
  readonly codeLink: "code_link";
1515
+ readonly signUp: "sign_up";
1516
+ readonly onSignUp: "on_sign_up";
1347
1517
  }>>;
1348
1518
  readonly emails: Schema.optionalKey<Schema.$Record<Schema.String, Schema.encodeKeys<Schema.Struct<{
1349
1519
  readonly subject: Schema.String;
@@ -1424,6 +1594,37 @@ export declare const MigrationPlan: Schema.Struct<{
1424
1594
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
1425
1595
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
1426
1596
  }>>>;
1597
+ readonly toolsets: Schema.optionalKey<Schema.$Array<Schema.Struct<{
1598
+ readonly name: Schema.String;
1599
+ readonly description: Schema.String;
1600
+ readonly connection: Schema.String;
1601
+ readonly api: Schema.String;
1602
+ readonly tools: Schema.$Array<Schema.Struct<{
1603
+ readonly name: Schema.String;
1604
+ readonly access: Schema.Literals<readonly ["read", "write"]>;
1605
+ readonly fixed: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1606
+ }>>;
1607
+ readonly actions: Schema.$Array<Schema.Struct<{
1608
+ readonly name: Schema.String;
1609
+ readonly description: Schema.String;
1610
+ readonly permission: Schema.optionalKey<Schema.String>;
1611
+ readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1612
+ readonly retryOnDeadlock: Schema.optionalKey<Schema.Boolean>;
1613
+ readonly writes: Schema.optionalKey<Schema.$Array<Schema.String>>;
1614
+ readonly connections: Schema.optionalKey<Schema.$Array<Schema.String>>;
1615
+ readonly files: Schema.optionalKey<Schema.$Array<Schema.Struct<{
1616
+ readonly entity: Schema.String;
1617
+ readonly property: Schema.String;
1618
+ }>>>;
1619
+ readonly hints: Schema.optionalKey<Schema.Struct<{
1620
+ readonly readOnly: Schema.optionalKey<Schema.Boolean>;
1621
+ readonly connectionsReadOnly: Schema.optionalKey<Schema.Boolean>;
1622
+ readonly destructive: Schema.optionalKey<Schema.Boolean>;
1623
+ readonly irreversible: Schema.optionalKey<Schema.Boolean>;
1624
+ readonly idempotent: Schema.optionalKey<Schema.Boolean>;
1625
+ }>>;
1626
+ }>>;
1627
+ }>>>;
1427
1628
  }>, {
1428
1629
  readonly signIn: "sign_in";
1429
1630
  }>, Schema.Struct<{
@@ -1563,9 +1764,15 @@ export declare const MigrationPlan: Schema.Struct<{
1563
1764
  readonly channels: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
1564
1765
  readonly onNewUser: Schema.optionalKey<Schema.String>;
1565
1766
  readonly codeLink: Schema.optionalKey<Schema.Boolean>;
1767
+ readonly signUp: Schema.optionalKey<Schema.Struct<{
1768
+ readonly channels: Schema.$Record<Schema.String, Schema.Unknown>;
1769
+ }>>;
1770
+ readonly onSignUp: Schema.optionalKey<Schema.String>;
1566
1771
  }>, {
1567
1772
  readonly onNewUser: "on_new_user";
1568
1773
  readonly codeLink: "code_link";
1774
+ readonly signUp: "sign_up";
1775
+ readonly onSignUp: "on_sign_up";
1569
1776
  }>>;
1570
1777
  readonly emails: Schema.optionalKey<Schema.$Record<Schema.String, Schema.encodeKeys<Schema.Struct<{
1571
1778
  readonly subject: Schema.String;
@@ -1646,6 +1853,37 @@ export declare const MigrationPlan: Schema.Struct<{
1646
1853
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
1647
1854
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
1648
1855
  }>>>;
1856
+ readonly toolsets: Schema.optionalKey<Schema.$Array<Schema.Struct<{
1857
+ readonly name: Schema.String;
1858
+ readonly description: Schema.String;
1859
+ readonly connection: Schema.String;
1860
+ readonly api: Schema.String;
1861
+ readonly tools: Schema.$Array<Schema.Struct<{
1862
+ readonly name: Schema.String;
1863
+ readonly access: Schema.Literals<readonly ["read", "write"]>;
1864
+ readonly fixed: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1865
+ }>>;
1866
+ readonly actions: Schema.$Array<Schema.Struct<{
1867
+ readonly name: Schema.String;
1868
+ readonly description: Schema.String;
1869
+ readonly permission: Schema.optionalKey<Schema.String>;
1870
+ readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1871
+ readonly retryOnDeadlock: Schema.optionalKey<Schema.Boolean>;
1872
+ readonly writes: Schema.optionalKey<Schema.$Array<Schema.String>>;
1873
+ readonly connections: Schema.optionalKey<Schema.$Array<Schema.String>>;
1874
+ readonly files: Schema.optionalKey<Schema.$Array<Schema.Struct<{
1875
+ readonly entity: Schema.String;
1876
+ readonly property: Schema.String;
1877
+ }>>>;
1878
+ readonly hints: Schema.optionalKey<Schema.Struct<{
1879
+ readonly readOnly: Schema.optionalKey<Schema.Boolean>;
1880
+ readonly connectionsReadOnly: Schema.optionalKey<Schema.Boolean>;
1881
+ readonly destructive: Schema.optionalKey<Schema.Boolean>;
1882
+ readonly irreversible: Schema.optionalKey<Schema.Boolean>;
1883
+ readonly idempotent: Schema.optionalKey<Schema.Boolean>;
1884
+ }>>;
1885
+ }>>;
1886
+ }>>>;
1649
1887
  }>]>], {
1650
1888
  readonly version: number;
1651
1889
  readonly hash: string;
@@ -1765,10 +2003,10 @@ export declare const MigrationPlan: Schema.Struct<{
1765
2003
  readonly telegram?: {
1766
2004
  readonly connection: string;
1767
2005
  } | undefined;
1768
- readonly slack?: {
2006
+ readonly whatsapp?: {
1769
2007
  readonly connection: string;
1770
2008
  } | undefined;
1771
- readonly whatsapp?: {
2009
+ readonly slack?: {
1772
2010
  readonly connection: string;
1773
2011
  } | undefined;
1774
2012
  readonly attribution?: {
@@ -1856,6 +2094,12 @@ export declare const MigrationPlan: Schema.Struct<{
1856
2094
  } | undefined;
1857
2095
  readonly onNewUser?: string | undefined;
1858
2096
  readonly codeLink?: boolean | undefined;
2097
+ readonly signUp?: {
2098
+ readonly channels: {
2099
+ readonly [x: string]: unknown;
2100
+ };
2101
+ } | undefined;
2102
+ readonly onSignUp?: string | undefined;
1859
2103
  } | undefined;
1860
2104
  readonly emails?: {
1861
2105
  readonly [x: string]: {
@@ -1873,6 +2117,41 @@ export declare const MigrationPlan: Schema.Struct<{
1873
2117
  readonly footer?: string | undefined;
1874
2118
  };
1875
2119
  } | undefined;
2120
+ readonly toolsets?: readonly {
2121
+ readonly name: string;
2122
+ readonly description: string;
2123
+ readonly connection: string;
2124
+ readonly api: string;
2125
+ readonly tools: readonly {
2126
+ readonly name: string;
2127
+ readonly access: "read" | "write";
2128
+ readonly fixed: {
2129
+ readonly [x: string]: string | number | boolean;
2130
+ };
2131
+ }[];
2132
+ readonly actions: readonly {
2133
+ readonly name: string;
2134
+ readonly description: string;
2135
+ readonly input: {
2136
+ readonly [x: string]: Schema.Json;
2137
+ };
2138
+ readonly permission?: string | undefined;
2139
+ readonly retryOnDeadlock?: boolean | undefined;
2140
+ readonly writes?: readonly string[] | undefined;
2141
+ readonly connections?: readonly string[] | undefined;
2142
+ readonly files?: readonly {
2143
+ readonly entity: string;
2144
+ readonly property: string;
2145
+ }[] | undefined;
2146
+ readonly hints?: {
2147
+ readonly readOnly?: boolean | undefined;
2148
+ readonly connectionsReadOnly?: boolean | undefined;
2149
+ readonly destructive?: boolean | undefined;
2150
+ readonly irreversible?: boolean | undefined;
2151
+ readonly idempotent?: boolean | undefined;
2152
+ } | undefined;
2153
+ }[];
2154
+ }[] | undefined;
1876
2155
  } | {
1877
2156
  readonly version: number;
1878
2157
  readonly hash: string;
@@ -1992,10 +2271,10 @@ export declare const MigrationPlan: Schema.Struct<{
1992
2271
  readonly telegram?: {
1993
2272
  readonly connection: string;
1994
2273
  } | undefined;
1995
- readonly slack?: {
2274
+ readonly whatsapp?: {
1996
2275
  readonly connection: string;
1997
2276
  } | undefined;
1998
- readonly whatsapp?: {
2277
+ readonly slack?: {
1999
2278
  readonly connection: string;
2000
2279
  } | undefined;
2001
2280
  readonly attribution?: {
@@ -2083,6 +2362,12 @@ export declare const MigrationPlan: Schema.Struct<{
2083
2362
  } | undefined;
2084
2363
  readonly onNewUser?: string | undefined;
2085
2364
  readonly codeLink?: boolean | undefined;
2365
+ readonly signUp?: {
2366
+ readonly channels: {
2367
+ readonly [x: string]: unknown;
2368
+ };
2369
+ } | undefined;
2370
+ readonly onSignUp?: string | undefined;
2086
2371
  } | undefined;
2087
2372
  readonly emails?: {
2088
2373
  readonly [x: string]: {
@@ -2100,6 +2385,41 @@ export declare const MigrationPlan: Schema.Struct<{
2100
2385
  readonly footer?: string | undefined;
2101
2386
  };
2102
2387
  } | undefined;
2388
+ readonly toolsets?: readonly {
2389
+ readonly name: string;
2390
+ readonly description: string;
2391
+ readonly connection: string;
2392
+ readonly api: string;
2393
+ readonly tools: readonly {
2394
+ readonly name: string;
2395
+ readonly access: "read" | "write";
2396
+ readonly fixed: {
2397
+ readonly [x: string]: string | number | boolean;
2398
+ };
2399
+ }[];
2400
+ readonly actions: readonly {
2401
+ readonly name: string;
2402
+ readonly description: string;
2403
+ readonly input: {
2404
+ readonly [x: string]: Schema.Json;
2405
+ };
2406
+ readonly permission?: string | undefined;
2407
+ readonly retryOnDeadlock?: boolean | undefined;
2408
+ readonly writes?: readonly string[] | undefined;
2409
+ readonly connections?: readonly string[] | undefined;
2410
+ readonly files?: readonly {
2411
+ readonly entity: string;
2412
+ readonly property: string;
2413
+ }[] | undefined;
2414
+ readonly hints?: {
2415
+ readonly readOnly?: boolean | undefined;
2416
+ readonly connectionsReadOnly?: boolean | undefined;
2417
+ readonly destructive?: boolean | undefined;
2418
+ readonly irreversible?: boolean | undefined;
2419
+ readonly idempotent?: boolean | undefined;
2420
+ } | undefined;
2421
+ }[];
2422
+ }[] | undefined;
2103
2423
  }>;
2104
2424
  /** Non-transactional steps first, then the steps of the one transaction, in execution order. */
2105
2425
  readonly steps: Schema.$Array<Schema.Struct<{
@@ -663,6 +663,8 @@ export const AGENT_TABLES_DDL = [
663
663
  "blocked_at" timestamptz,
664
664
  "on_new_user_completed_at" timestamptz
665
665
  )`,
666
+ // A user `signUp` created holds exactly the roles sign-up granted, never `member`.
667
+ `ALTER TABLE "${CHANNEL_USERS_TABLE}" ADD COLUMN IF NOT EXISTS "signed_up" boolean NOT NULL DEFAULT false`,
666
668
  `INSERT INTO "${CHANNEL_USERS_TABLE}" ("user_id", "created_via")
667
669
  SELECT DISTINCT ON ("user_id") "user_id", "provider" FROM "${AGENT_IDENTITIES_TABLE}"
668
670
  WHERE "origin" = 'provisioned' ORDER BY "user_id", "created_at", "id"
@@ -4,7 +4,8 @@ import type { AnyEntity } from "./entity.js";
4
4
  import { type OntologyManifest, type WorkflowManifest } from "./manifest.js";
5
5
  import type { ModelMetrics } from "./metric.js";
6
6
  import type { Role } from "./role.js";
7
- import type { SignInOptions } from "./sign-in.js";
7
+ import type { ResolvedSignInOptions } from "./sign-in.js";
8
+ import type { ResolvedToolset } from "./toolset.js";
8
9
  /** A checked ontology: the resolved definitions and the manifest built from them. */
9
10
  export interface Ontology<Entities extends ReadonlyArray<AnyEntity> = ReadonlyArray<AnyEntity>, Metrics extends ModelMetrics = ModelMetrics> {
10
11
  /** The definition as given to `defineOntology`. */
@@ -14,11 +15,13 @@ export interface Ontology<Entities extends ReadonlyArray<AnyEntity> = ReadonlyAr
14
15
  /** The workspace-owned `member` role first, declared roles, then the implicit reporter when enabled. */
15
16
  readonly roles: ReadonlyArray<Role>;
16
17
  /** Who may become a member by signing in, with the default policy when the definition sets none. */
17
- readonly signIn: SignInOptions;
18
+ readonly signIn: ResolvedSignInOptions;
18
19
  /** The connections the actions call, as `defineOntology({ connections })` lists them. */
19
20
  readonly connections: ReadonlyArray<ResolvedConnection>;
20
21
  /** The workflows, with wire names and their triggers' input in wire form, as the manifest lists them. */
21
22
  readonly workflows: ReadonlyArray<WorkflowManifest>;
23
+ /** The provider MCP tools the ontology serves, with wire names. */
24
+ readonly toolsets: ReadonlyArray<ResolvedToolset>;
22
25
  readonly manifest: OntologyManifest;
23
26
  /** Warning-level diagnostics; any error makes `defineOntology` throw. */
24
27
  readonly warnings: ReadonlyArray<Diagnostic>;
package/dist/ontology.js CHANGED
@@ -33,6 +33,7 @@ export function buildOntology(config, options) {
33
33
  signIn: analysis.signIn,
34
34
  connections: analysis.connections,
35
35
  workflows: analysis.workflows,
36
+ toolsets: analysis.toolsets,
36
37
  manifest: buildManifest(analysis),
37
38
  warnings: analysis.diagnostics,
38
39
  };
@@ -2,7 +2,12 @@ import { Effect } from "effect";
2
2
  import type { SqlClient } from "effect/unstable/sql";
3
3
  /** Legacy workspace databases remain readable before their next additive migration. */
4
4
  export declare function channelUsersAvailable(sql: SqlClient.SqlClient): Effect.Effect<boolean, import("effect/unstable/sql/SqlError").SqlError, never>;
5
- /** Records how a user came to be: `invite`, `email` or a channel's sign-up. The first record stays. */
6
- export declare function recordUserCreation(sql: SqlClient.SqlClient, userId: string, via: string): Effect.Effect<void, import("effect/unstable/sql/SqlError").SqlError, never>;
5
+ /**
6
+ * Records how a user came to be: `invite`, `email` or a channel's sign-up. The first record stays.
7
+ * `signedUp` marks a user `signUp` created, who never holds `member`.
8
+ */
9
+ export declare function recordUserCreation(sql: SqlClient.SqlClient, userId: string, via: string, signedUp?: boolean): Effect.Effect<void, import("effect/unstable/sql/SqlError").SqlError, never>;
7
10
  /** Session revocation integration point for every channel-app issuer (including Mini Apps). */
8
11
  export declare function revokeMemberSessions(sql: SqlClient.SqlClient, userId: string): Effect.Effect<void, import("effect/unstable/sql/SqlError").SqlError, never>;
12
+ /** Whether a user sign-up created still waits for `onSignUp`: not completed and not blocked. */
13
+ export declare function signUpPending(sql: SqlClient.SqlClient, userId: string): Effect.Effect<boolean, import("effect/unstable/sql/SqlError").SqlError, never>;
@@ -9,10 +9,17 @@ export function channelUsersAvailable(sql) {
9
9
  ])
10
10
  .pipe(Effect.map(([table]) => table?.present === true));
11
11
  }
12
- /** Records how a user came to be: `invite`, `email` or a channel's sign-up. The first record stays. */
13
- export function recordUserCreation(sql, userId, via) {
12
+ /**
13
+ * Records how a user came to be: `invite`, `email` or a channel's sign-up. The first record stays.
14
+ * `signedUp` marks a user `signUp` created, who never holds `member`.
15
+ */
16
+ export function recordUserCreation(sql, userId, via, signedUp = false) {
14
17
  return Effect.gen(function* () {
15
- if (yield* channelUsersAvailable(sql)) {
18
+ if (signedUp) {
19
+ yield* sql.unsafe(`INSERT INTO "${CHANNEL_USERS_TABLE}" ("user_id", "created_via", "signed_up")
20
+ VALUES ($1::uuid, $2, true) ON CONFLICT ("user_id") DO NOTHING`, [userId, via]);
21
+ }
22
+ else if (yield* channelUsersAvailable(sql)) {
16
23
  yield* sql.unsafe(`INSERT INTO "${CHANNEL_USERS_TABLE}" ("user_id", "created_via") VALUES ($1::uuid, $2)
17
24
  ON CONFLICT ("user_id") DO NOTHING`, [userId, via]);
18
25
  }
@@ -31,3 +38,11 @@ export function revokeMemberSessions(sql, userId) {
31
38
  }
32
39
  });
33
40
  }
41
+ /** Whether a user sign-up created still waits for `onSignUp`: not completed and not blocked. */
42
+ export function signUpPending(sql, userId) {
43
+ return sql
44
+ .unsafe(`SELECT true AS "pending" FROM "${CHANNEL_USERS_TABLE}" AS "c" WHERE "c"."user_id" = $1::uuid
45
+ AND COALESCE(to_jsonb("c") ->> 'signed_up', 'false') = 'true'
46
+ AND "c"."on_new_user_completed_at" IS NULL AND "c"."blocked_at" IS NULL`, [userId])
47
+ .pipe(Effect.map((rows) => rows.length > 0));
48
+ }
@@ -2,5 +2,15 @@ import { Effect } from "effect";
2
2
  import { SqlClient } from "effect/unstable/sql";
3
3
  import type { Ontology } from "../ontology.js";
4
4
  import type { Principal } from "../runtime.js";
5
- /** Runs after admission commits, before a model turn or channel-app session. True means retry pending. */
5
+ import type { FederationStore } from "./federation.js";
6
+ /**
7
+ * Runs after admission commits, before a model turn or app session. True means retry pending.
8
+ * A user `signUp` created runs `onSignUp` with the roles they hold; a user an open
9
+ * `signIn.channels` created runs `onNewUser` with only `member`. Workload authority never applies.
10
+ */
6
11
  export declare function runNewUserHook(ontology: Ontology, sql: SqlClient.SqlClient, principal: Principal): Effect.Effect<boolean>;
12
+ /**
13
+ * The federation store, running a signed-up user's pending `onSignUp` once they enroll through a
14
+ * SegmentStream account and on each later federated request until it completes.
15
+ */
16
+ export declare function withSignUpOnboarding(ontology: Ontology, sql: SqlClient.SqlClient, store: FederationStore): FederationStore;