@segmentstream/ontology 0.170.2 → 0.172.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.172.0
4
+
5
+ Route the agent's persona by chat assignment, channel rules and workspace default.
6
+
7
+ ## 0.171.0
8
+
9
+ A deployment that changes the ontology no longer refuses file operations or workflow actions
10
+ while it switches over. Before, once the deployment had migrated the catalog, the running version
11
+ answered every file download, upload and action that takes a file with the retryable 503
12
+ `ontology_updating` until the new version was promoted, about a minute and a half. Pipeline
13
+ worker actions were refused in that window too. A workflow run that the earlier deployment had
14
+ started was refused at every action, even after the promotion, and a workflow step fails on that
15
+ refusal, so those runs died at their next action. Now the running version serves files as it serves
16
+ every other request, waiting only while the migration's transaction holds the catalog. A run in
17
+ flight keeps acting with the code that started it against the new catalog, as the SDK's
18
+ deployment notes describe.
19
+
20
+ An upload stays tied to the version that started it: one started before the switch and saved
21
+ after it is refused, and the client starts it again.
22
+
23
+ The service no longer answers `ontology_updating`, and `PermissionDenied` no longer carries
24
+ `updating`. A workspace that retries `ontology_updating` itself can drop that retry after
25
+ upgrading.
26
+
3
27
  ## 0.170.2
4
28
 
5
29
  Workspace apps and ontology services call the production API at segmentstream.com. Existing signed token issuers, OAuth registrations and custom API origins continue to work.
package/README.md CHANGED
@@ -1744,9 +1744,8 @@ action takes several uploads of the entity, `record_id` when it changes an exist
1744
1744
  `transfer.headers`, calls `files_upload_complete` with `upload.id` for `upload.ticket`, then
1745
1745
  calls the action tool with the ticket in its upload field and `_options` set to `options`. Both
1746
1746
  tools run the REST upload sessions above, with the same checks, limits and permissions. A
1747
- failure of the storage provider answers `storage_unavailable`, and a request made while a
1748
- deployment migrates the catalog answers `ontology_updating`; both are 503s with
1749
- `retryable: true`, so the client repeats the same call, ideally with its own `idempotency_key`.
1747
+ failure of the storage provider answers `storage_unavailable`, a 503 with `retryable: true`, so
1748
+ the client repeats the same call, ideally with its own `idempotency_key`.
1750
1749
  While a failed attempt still holds an upload, a retry answers 409 `conflict` with
1751
1750
  `retryable: true` and `retry_after` seconds; a conflict without `retryable` cannot resume.
1752
1751
 
@@ -17,12 +17,21 @@ export declare const AgentChat: import("./entity.js").Entity<"agent_chat", {
17
17
  readonly lastMessageAt: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
18
18
  readonly handoffAt: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
19
19
  readonly handoffReason: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
20
+ readonly personaNoticeAt: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
21
+ readonly agentPersona: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
20
22
  readonly purpose: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
21
23
  readonly whenToUse: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
22
24
  }, {
23
25
  readonly members: import("./relationship.js").ManyRelationship;
24
26
  readonly handledBy: import("./relationship.js").OneRelationship<true, false, "user">;
25
27
  }, import("./entity.js").InvocableActions<{
28
+ readonly setPersona: import("./action.js").Action<Schema.Struct<{
29
+ readonly chat: Schema.Codec<string, string, never, never>;
30
+ readonly persona: Schema.NullOr<Schema.String>;
31
+ readonly expected: Schema.optional<Schema.NullOr<Schema.String>>;
32
+ }>, {
33
+ agentPersona: string | null;
34
+ }>;
26
35
  readonly takeOver: import("./action.js").Action<Schema.Struct<{
27
36
  readonly chat: Schema.Codec<string, string, never, never>;
28
37
  }>, {
@@ -154,6 +163,8 @@ export declare const AgentChat: import("./entity.js").Entity<"agent_chat", {
154
163
  readonly lastMessageAt: string | null;
155
164
  readonly handoffAt: string | null;
156
165
  readonly handoffReason: string | null;
166
+ readonly personaNoticeAt: string | null;
167
+ readonly agentPersona: string | null;
157
168
  readonly purpose: string | null;
158
169
  readonly whenToUse: string | null;
159
170
  readonly handledById: string | null;
@@ -1,3 +1,4 @@
1
+ import { chatPersonaNames, deployedChatPersonas } from "./chat-personas.js";
1
2
  import { Effect, Option, Schema } from "effect";
2
3
  import { action } from "./action.js";
3
4
  import { AGENT_DRAFT_NOTE_LIMIT } from "./agent-draft.js";
@@ -85,6 +86,19 @@ export const AgentChat = entity("agent_chat", {
85
86
  label: "Handoff reason",
86
87
  description: "What the agent said the person needs from staff when it handed them over.",
87
88
  }),
89
+ personaNoticeAt: p.timestamp({
90
+ optional: true,
91
+ managed: true,
92
+ label: "Persona notice",
93
+ description: "When the first authorized member was offered the default persona for this chat.",
94
+ }),
95
+ agentPersona: p.text({
96
+ optional: true,
97
+ managed: true,
98
+ maxLength: 64,
99
+ label: "Agent persona",
100
+ description: "The persona assigned to this chat. Empty inherits the workspace's chat rules and default.",
101
+ }),
88
102
  purpose: p.text({
89
103
  optional: true,
90
104
  maxLength: 64,
@@ -118,6 +132,37 @@ export const AgentChat = entity("agent_chat", {
118
132
  },
119
133
  indexes: [{ properties: ["provider", "externalId"], unique: true }],
120
134
  }).actions((self) => ({
135
+ setPersona: action({
136
+ description: "Assign a deployed persona to this chat and its threads. Pass null to inherit the workspace rules.",
137
+ hints: { destructive: false, irreversible: false, idempotent: true },
138
+ input: Schema.Struct({
139
+ chat: self.ref,
140
+ persona: Schema.NullOr(Schema.String.check(Schema.isMaxLength(64))),
141
+ expected: Schema.optional(Schema.NullOr(Schema.String)),
142
+ }),
143
+ handler: ({ input }) => Effect.gen(function* () {
144
+ const policy = deployedChatPersonas();
145
+ if (!policy) {
146
+ return yield* new ActionRejected({
147
+ message: "This workspace has not enabled chat persona routing.",
148
+ });
149
+ }
150
+ if (input.persona !== null && !chatPersonaNames(policy).includes(input.persona)) {
151
+ return yield* new ActionRejected({
152
+ message: "Choose a persona declared by the deployed agent.",
153
+ });
154
+ }
155
+ const chat = yield* self.get(input.chat, { forUpdate: true });
156
+ // The scoped write checks record access. A stale selection rolls back the transaction.
157
+ yield* self.update(chat, { agentPersona: input.persona });
158
+ if (input.expected !== undefined && input.expected !== (chat.agentPersona ?? null)) {
159
+ return yield* new ActionRejected({
160
+ message: "The assignment changed. Reload this chat before saving.",
161
+ });
162
+ }
163
+ return { agentPersona: input.persona };
164
+ }),
165
+ }),
121
166
  takeOver: action({
122
167
  description: "Take a person's private chat over from the agent, as yourself, also when the agent handed " +
123
168
  "the person over: until a member hands it back, the agent records the person's messages " +
@@ -0,0 +1,31 @@
1
+ /** Trusted delivery coordinates. The channel is the configured connection's channel name. */
2
+ export interface PersonaContext {
3
+ readonly provider: string;
4
+ readonly channel: string;
5
+ readonly kind: "private" | "group";
6
+ readonly audience?: "guest" | "member";
7
+ }
8
+ export interface PersonaRule {
9
+ readonly when: Partial<PersonaContext>;
10
+ readonly use: string;
11
+ }
12
+ /** Deployed selection policy. The ontology only needs names and conditions. */
13
+ export interface ChatPersonaPolicy {
14
+ readonly default?: string;
15
+ readonly available?: readonly string[];
16
+ readonly rules?: readonly PersonaRule[];
17
+ }
18
+ export declare function chatPersonaNames(settings: ChatPersonaPolicy): readonly string[];
19
+ /** Resolve once for both routing and answering. An obsolete assignment falls back to current policy. */
20
+ export declare function chatPersona(settings: ChatPersonaPolicy, context: PersonaContext | undefined, assigned?: string | null): {
21
+ readonly name: string;
22
+ readonly source: "chat";
23
+ } | {
24
+ readonly name: string;
25
+ readonly source: "rule";
26
+ } | {
27
+ readonly name: string | undefined;
28
+ readonly source: "default";
29
+ };
30
+ /** Set by the deployment bundler for agents using chat routing. */
31
+ export declare function deployedChatPersonas(): ChatPersonaPolicy | undefined;
@@ -0,0 +1,27 @@
1
+ export function chatPersonaNames(settings) {
2
+ return [
3
+ ...new Set([
4
+ ...(settings.available ?? []),
5
+ ...(settings.rules ?? []).map((rule) => rule.use),
6
+ ...(settings.default ? [settings.default] : []),
7
+ ]),
8
+ ];
9
+ }
10
+ /** Resolve once for both routing and answering. An obsolete assignment falls back to current policy. */
11
+ export function chatPersona(settings, context, assigned) {
12
+ if (assigned && chatPersonaNames(settings).includes(assigned)) {
13
+ return { name: assigned, source: "chat" };
14
+ }
15
+ for (const rule of settings.rules ?? []) {
16
+ if (context &&
17
+ Object.entries(rule.when).every(([key, value]) => context[key] === value)) {
18
+ return { name: rule.use, source: "rule" };
19
+ }
20
+ }
21
+ return { name: settings.default, source: "default" };
22
+ }
23
+ /** Set by the deployment bundler for agents using chat routing. */
24
+ export function deployedChatPersonas() {
25
+ const json = process.env.SEGMENTSTREAM_CHAT_PERSONAS;
26
+ return json ? JSON.parse(json) : undefined;
27
+ }
package/dist/errors.d.ts CHANGED
@@ -85,11 +85,6 @@ declare const PermissionDenied_base: Schema.Class<PermissionDenied, Schema.Tagge
85
85
  readonly message: Schema.String;
86
86
  /** The permission that is missing, for example `lead:changeStatus`. */
87
87
  readonly permission: Schema.optionalKey<Schema.String>;
88
- /**
89
- * Refused only because the running ontology and the database catalog differ, as while a
90
- * deployment migrates. The caller retries the same request.
91
- */
92
- readonly updating: Schema.optionalKey<Schema.Literal<true>>;
93
88
  }>, import("effect/Cause").YieldableError>;
94
89
  /**
95
90
  * The principal's roles do not grant a permission the request requires. The service answers 403
package/dist/errors.js CHANGED
@@ -61,11 +61,6 @@ export class PermissionDenied extends Schema.TaggedError()("PermissionDenied", {
61
61
  message: Schema.String,
62
62
  /** The permission that is missing, for example `lead:changeStatus`. */
63
63
  permission: Schema.optionalKey(Schema.String),
64
- /**
65
- * Refused only because the running ontology and the database catalog differ, as while a
66
- * deployment migrates. The caller retries the same request.
67
- */
68
- updating: Schema.optionalKey(Schema.Literal(true)),
69
64
  }) {
70
65
  }
71
66
  // @legacy ontology.workflow-cutover-artifacts
@@ -592,6 +592,27 @@ export function sqlAgentStore(ontology, sql) {
592
592
  : { ...principal, authenticatedVia: provider };
593
593
  }),
594
594
  channelKind: (name) => chatChannelKind(ontology.manifest.chat?.channels, name),
595
+ claimChatPersonaNotice: (id, memberId) => sql
596
+ .withTransaction(Effect.gen(function* () {
597
+ yield* beginReplicationWrite(sql);
598
+ const runtime = makeOntologyRuntime(ontology, sql, {
599
+ action: "agent_chat.persona_notice",
600
+ actionId: randomUUID(),
601
+ principalId: memberId,
602
+ });
603
+ const chat = yield* runtime.get({ entity: AgentChat.name, id, forUpdate: true });
604
+ if (chat.persona_notice_at != null || chat.agent_persona != null) {
605
+ return false;
606
+ }
607
+ yield* runtime.update({
608
+ entity: AgentChat.name,
609
+ id,
610
+ values: { persona_notice_at: new Date().toISOString() },
611
+ });
612
+ return true;
613
+ }))
614
+ .pipe(Effect.orDie),
615
+ readChatPersona: (key) => rows(`SELECT "agent_persona" FROM ${quoteIdentifier(tableName(AgentChat.name))} WHERE "key" = $1`, [key]).pipe(Effect.map(([chat]) => nullableText(chat?.agent_persona))),
595
616
  seeChat: ({ provider, externalId, title, memberId, leftMemberId, agentLeft, migratedFrom }) => sql
596
617
  .withTransaction(Effect.gen(function* () {
597
618
  yield* beginReplicationWrite(sql);
@@ -662,7 +683,12 @@ export function sqlAgentStore(ontology, sql) {
662
683
  // Both were recorded: the new one keeps what members said and gains the members,
663
684
  // and the old one is deleted.
664
685
  const kept = {};
665
- for (const key of ["purpose", "when_to_use"]) {
686
+ for (const key of [
687
+ "purpose",
688
+ "when_to_use",
689
+ "agent_persona",
690
+ "persona_notice_at",
691
+ ]) {
666
692
  if (nullableText(found[key]) === null && nullableText(old[key]) !== null) {
667
693
  kept[key] = old[key];
668
694
  }
@@ -1,3 +1,5 @@
1
+ import { chatPersona, chatPersonaNames, deployedChatPersonas } from "../../chat-personas.js";
2
+ import { isAllowed, effectiveScope } from "../../permissions.js";
1
3
  import { confirmationCommand } from "./confirmations.js";
2
4
  import { randomUUID } from "node:crypto";
3
5
  import { Effect, Layer, Redacted, Result, Schema } from "effect";
@@ -729,6 +731,123 @@ export function agentLayer(options) {
729
731
  : toServerResponse(notFound(requestId, "not_found"));
730
732
  })));
731
733
  }
734
+ // The selector reveals only chat settings. Its row visibility follows the action's scope,
735
+ // including membership traversal, even when the member cannot read the inbox.
736
+ const personaReader = (principal) => {
737
+ const permission = "agent_chat:set_persona";
738
+ if (!isAllowed(permission, principal)) {
739
+ return undefined;
740
+ }
741
+ const scope = effectiveScope(permission, principal);
742
+ return {
743
+ ...principal,
744
+ permissions: ["agent_chat:read"],
745
+ scopes: scope ? [{ permission: "agent_chat:read", where: scope }] : [],
746
+ };
747
+ };
748
+ const manageableChat = (principal, field, value) => Effect.gen(function* () {
749
+ const reader = personaReader(principal);
750
+ if (!reader) {
751
+ return undefined;
752
+ }
753
+ const result = yield* backend
754
+ .find({
755
+ entity: "agent_chat",
756
+ query: { where: { [field]: { eq: value } }, limit: 1 },
757
+ reader,
758
+ })
759
+ .pipe(Effect.orDie);
760
+ return result.items[0];
761
+ });
762
+ yield* router.add("GET", `${AGENT_PATH}/chats/persona-settings`, asMember((request, member) => Effect.gen(function* () {
763
+ const reader = personaReader(member);
764
+ if (!reader || !deployedChatPersonas()) {
765
+ return toServerResponse(notFound(yield* RequestId, "not_found"));
766
+ }
767
+ const after = new URL(request.url, "https://localhost").searchParams.get("after");
768
+ const result = yield* backend
769
+ .find({
770
+ entity: "agent_chat",
771
+ reader,
772
+ query: { limit: 50, ...(after ? { after } : {}) },
773
+ })
774
+ .pipe(Effect.result);
775
+ if (Result.isFailure(result)) {
776
+ return invalidBody(yield* RequestId, [
777
+ { path: ["after"], message: "Invalid cursor." },
778
+ ]);
779
+ }
780
+ return json({
781
+ chats: result.success.items.map((chat) => ({
782
+ id: chat.id,
783
+ title: chat.title,
784
+ channel: chat.provider,
785
+ })),
786
+ after: result.success.nextCursor ?? null,
787
+ });
788
+ })));
789
+ yield* router.add("GET", `${AGENT_PATH}/chats/:id/persona-settings`, asMember((_, member) => Effect.gen(function* () {
790
+ const id = yield* routeParam("id");
791
+ const policy = deployedChatPersonas();
792
+ const chat = policy && Schema.is(Schema.String.check(Schema.isUUID()))(id)
793
+ ? yield* manageableChat(member, "id", id)
794
+ : undefined;
795
+ if (!policy || !chat) {
796
+ return toServerResponse(notFound(yield* RequestId, "not_found"));
797
+ }
798
+ const channel = String(chat.provider);
799
+ const assigned = typeof chat.agent_persona === "string" ? chat.agent_persona : null;
800
+ const selection = chatPersona(policy, {
801
+ provider: store.channelKind?.(channel) ?? channel,
802
+ channel,
803
+ kind: chat.kind === "private" ? "private" : "group",
804
+ audience: channel === "web" && String(chat.external_id).startsWith("guest:")
805
+ ? "guest"
806
+ : "member",
807
+ }, assigned);
808
+ return json({
809
+ title: chat.title,
810
+ assigned,
811
+ effective: selection.name,
812
+ source: selection.source,
813
+ names: chatPersonaNames(policy),
814
+ });
815
+ })));
816
+ if (store.claimChatPersonaNotice !== undefined) {
817
+ const claim = store.claimChatPersonaNotice;
818
+ yield* router.add("POST", `${AGENT_PATH}/chats/persona-notice`, asRuntime((request) => Effect.gen(function* () {
819
+ const requestId = yield* RequestId;
820
+ const decoded = Schema.decodeUnknownResult(Schema.Struct({
821
+ key: Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(1024)),
822
+ memberId: Schema.String.check(Schema.isUUID()),
823
+ provider: Schema.Literals(["slack", "telegram", "whatsapp"]),
824
+ }))(yield* jsonBody(request), { onExcessProperty: "error" });
825
+ if (Result.isFailure(decoded)) {
826
+ return invalidBody(requestId, schemaIssues(decoded.failure));
827
+ }
828
+ const { memberId, key, provider } = decoded.success;
829
+ const principal = yield* store.actingMember(memberId, provider);
830
+ const chat = principal ? yield* manageableChat(principal, "key", key) : undefined;
831
+ if (!chat || chat.agent_persona != null || chat.persona_notice_at != null) {
832
+ return json({ chat: null });
833
+ }
834
+ const id = String(chat.id);
835
+ return json({ chat: (yield* claim(id, memberId)) ? id : null });
836
+ })));
837
+ }
838
+ if (store.readChatPersona !== undefined) {
839
+ const read = store.readChatPersona;
840
+ yield* router.add("POST", `${AGENT_PATH}/chats/persona`, asRuntime((request) => Effect.gen(function* () {
841
+ const requestId = yield* RequestId;
842
+ const decoded = Schema.decodeUnknownResult(Schema.Struct({
843
+ key: Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(1024)),
844
+ }))(yield* jsonBody(request), { onExcessProperty: "error" });
845
+ if (Result.isFailure(decoded)) {
846
+ return invalidBody(requestId, schemaIssues(decoded.failure));
847
+ }
848
+ return json({ persona: yield* read(decoded.success.key) });
849
+ })));
850
+ }
732
851
  yield* router.add("POST", CHATS_SEEN_PATH, asRuntime(seeChat(store)));
733
852
  yield* router.add("POST", CHATS_HANDOFF_PATH, asRuntime(handOffChat(store)));
734
853
  if (store.chatMessages !== undefined) {
@@ -80,11 +80,11 @@ declare const CurrentChatCall_base: Context.ServiceClass<CurrentChatCall, "@segm
80
80
  readonly sender?: string | undefined;
81
81
  readonly peer?: string | undefined;
82
82
  } | undefined;
83
- readonly operation_id?: string | undefined;
84
83
  readonly expected?: {
85
84
  readonly chat_id: string;
86
85
  readonly digest: string;
87
86
  } | undefined;
87
+ readonly operation_id?: string | undefined;
88
88
  }>;
89
89
  export declare class CurrentChatCall extends CurrentChatCall_base {
90
90
  }
@@ -134,11 +134,11 @@ export declare function consumeChatEnvelope(args: Readonly<Record<string, unknow
134
134
  readonly sender?: string | undefined;
135
135
  readonly peer?: string | undefined;
136
136
  } | undefined;
137
- readonly operation_id?: string | undefined;
138
137
  readonly expected?: {
139
138
  readonly chat_id: string;
140
139
  readonly digest: string;
141
140
  } | undefined;
141
+ readonly operation_id?: string | undefined;
142
142
  };
143
143
  }, ActionRejected | PermissionDenied, never>;
144
144
  export {};
@@ -506,19 +506,7 @@ export function expectedFailure(error, requestId) {
506
506
  };
507
507
  }
508
508
  if (Predicate.isTagged(error, "PermissionDenied")) {
509
- const { permission, updating } = error;
510
- if (updating === true) {
511
- return {
512
- status: 503,
513
- body: {
514
- error: "ontology_updating",
515
- detail: "The app is being updated. Retry the same request shortly.",
516
- requestId,
517
- retryable: true,
518
- },
519
- headers: { "retry-after": "5" },
520
- };
521
- }
509
+ const { permission } = error;
522
510
  return {
523
511
  status: 403,
524
512
  body: {
@@ -684,6 +684,8 @@ export interface AgentStore {
684
684
  * ids have one, the new record takes the old one's members, and its purpose and when to use where
685
685
  * it has none. Concurrent calls for one chat leave one record.
686
686
  */
687
+ readonly claimChatPersonaNotice?: (id: string, memberId: string) => Effect.Effect<boolean>;
688
+ readonly readChatPersona?: (key: string) => Effect.Effect<string | null>;
687
689
  readonly seeChat: (input: {
688
690
  readonly provider: string;
689
691
  readonly externalId: string;
@@ -620,7 +620,9 @@ export const ErrorSchemas = {
620
620
  rateLimited: errorBody("RateLimited", 429, ["rate_limited"]),
621
621
  internal: errorBody("InternalError", 500, ["internal_error"]),
622
622
  unavailable: errorBody("ServiceUnavailable", 503, ["service_unavailable"]),
623
- storageUnavailable: errorBody("StorageUnavailable", 503, ["storage_unavailable", "ontology_updating"], { retryable: Schema.Boolean }),
623
+ storageUnavailable: errorBody("StorageUnavailable", 503, ["storage_unavailable"], {
624
+ retryable: Schema.Boolean,
625
+ }),
624
626
  invalidMetricQuery: errorBody("InvalidMetricQuery", 400, ["invalid_aggregate_query"]),
625
627
  readForbidden: errorBody("ReadForbidden", 403, ["forbidden", "scoped_aggregate_unavailable"], {
626
628
  permissions: Schema.optionalKey(Schema.Array(Schema.String)),
@@ -11,17 +11,10 @@ export function authorizeBlobOperation(ontology, sql, principalId, required, exe
11
11
  /** The workflow a workflow user's principal acts for, with its subject in this workspace. */
12
12
  workflowPrincipal) {
13
13
  return Effect.gen(function* () {
14
- const [catalog] = yield* sql.unsafe(`SELECT hash FROM "_ontology" WHERE id = true FOR SHARE`, []);
15
- if (catalog?.hash !== ontology.manifest.hash) {
16
- yield* Effect.logWarning("ontology.storage.catalog_mismatch", {
17
- servedHash: ontology.manifest.hash,
18
- appliedHash: catalog?.hash ?? null,
19
- });
20
- return yield* new PermissionDenied({
21
- message: "The deployed ontology no longer matches the database catalog.",
22
- updating: true,
23
- });
24
- }
14
+ // Lock the catalog first, in the order a migration takes it, so this operation waits for a
15
+ // migration in progress rather than deadlocking with it. A catalog that differs from the one
16
+ // this version serves is not refused: the version keeps serving until the next is promoted.
17
+ yield* sql.unsafe(`SELECT 1 FROM "_ontology" WHERE id = true FOR SHARE`, []);
25
18
  const users = yield* sql.unsafe(`SELECT kind::text, active, identity_provider, identity_subject FROM "user" WHERE id = $1::uuid FOR SHARE`, [principalId]);
26
19
  const user = users[0];
27
20
  const roles = yield* sql.unsafe(`SELECT role FROM "_user_roles" WHERE user_id = $1::uuid FOR SHARE`, [principalId]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.170.2",
3
+ "version": "0.172.0",
4
4
  "description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",
@@ -45,6 +45,10 @@
45
45
  "types": "./dist/workspace-channel.d.ts",
46
46
  "import": "./dist/workspace-channel.js"
47
47
  },
48
+ "./chat-personas": {
49
+ "types": "./dist/chat-personas.d.ts",
50
+ "import": "./dist/chat-personas.js"
51
+ },
48
52
  "./channel-session": {
49
53
  "types": "./dist/channel-session.d.ts",
50
54
  "import": "./dist/channel-session.js"