@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.
@@ -69,22 +69,26 @@ chats) {
69
69
  const destinationPreviews = previews.settings?.connection === destination ? previews : { ownOrigins: previews.ownOrigins };
70
70
  return (context) => {
71
71
  /**
72
- * A post's destination, requester and exact text. `asAgent` sends it as the agent, without the
73
- * sender attribution, under `agent_chat:send`; the requester is still recorded with it.
72
+ * A message's destination, requester and exact text, in the voice `as` names: as the agent, by
73
+ * default, without the sender attribution, under `agent_chat:send`, the requester still
74
+ * recorded with it; or, with `as: "me"`, signed as the requester, under
75
+ * `agent_chat:post_message`. The voice's own permission is checked here, whichever of the two
76
+ * opened the action.
74
77
  */
75
- const check = (input, approved = true, asAgent = false) => Effect.gen(function* () {
76
- const template = "template" in input ? input.template : undefined;
77
- const buttons = "buttons" in input ? input.buttons : undefined;
78
- // A message is text, or on WhatsApp a template the agent sends; a post is always text.
79
- if ((input.text === undefined) === (template === undefined) || (template && !asAgent)) {
78
+ const check = (input, approved = true) => Effect.gen(function* () {
79
+ const asAgent = input.as !== "me";
80
+ const template = input.template;
81
+ const buttons = input.buttons;
82
+ // A message is text, or on WhatsApp an approved template.
83
+ if ((input.text === undefined) === (template === undefined)) {
80
84
  return yield* new ActionRejected({
81
85
  message: "Give exactly one of text and template.",
82
86
  });
83
87
  }
84
88
  // An approved template has its own buttons, given by their values.
85
- if (buttons !== undefined && (template !== undefined || !asAgent)) {
89
+ if (buttons !== undefined && template !== undefined) {
86
90
  return yield* new ActionRejected({
87
- message: "Buttons go under a text the agent sends; a template's are its own.",
91
+ message: "Buttons go under a text; a template's are its own.",
88
92
  });
89
93
  }
90
94
  const permission = asAgent ? "agent_chat:send" : "agent_chat:post_message";
@@ -101,6 +105,14 @@ chats) {
101
105
  message: "The agent's sessions do not send as the agent: they answer in their chats.",
102
106
  });
103
107
  }
108
+ // A session posts for its member only the exact text they approved in their chat, whose
109
+ // frozen preview binds no template, buttons or files.
110
+ if (context.caller.kind === "runtime" &&
111
+ (template !== undefined || buttons !== undefined || input.files !== undefined)) {
112
+ return yield* new ActionRejected({
113
+ message: "The agent's sessions post only the text a member approved, as written.",
114
+ });
115
+ }
104
116
  const user = yield* context.backend.get({ entity: "user", id: context.principal.id });
105
117
  if (user.active !== true || user.kind !== context.principal.kind) {
106
118
  return yield* new PermissionDenied({ message: "The requester is inactive." });
@@ -205,6 +217,16 @@ chats) {
205
217
  message: "Templates are sent on WhatsApp; this chat's channel takes text.",
206
218
  });
207
219
  }
220
+ // WhatsApp sends an approved template's text as it is: nothing can sign it. In the
221
+ // caller's voice it goes only where their post carries no name, as a member's own reply
222
+ // in the inbox does where the inbox's `attribution` is `none`.
223
+ if (signature !== "") {
224
+ return yield* new ActionRejected({
225
+ message: "A template cannot carry the sender attribution; nothing was sent. Send it as " +
226
+ "the agent, or as text.",
227
+ refusal: "attribution_unsupported",
228
+ });
229
+ }
208
230
  const read = provider.template;
209
231
  const request = {
210
232
  name: template.name,
@@ -574,15 +596,17 @@ chats) {
574
596
  identityToken: context.identityToken,
575
597
  requestId: context.requestId,
576
598
  }),
577
- preview: (input) => check(input, false).pipe(Effect.flatMap(({ compose }) => compose), Effect.map(({ preview }) => preview)),
599
+ preview: (input) => check({ ...input, as: "me" }, false).pipe(Effect.flatMap(({ compose }) => compose), Effect.map(({ preview }) => preview)),
578
600
  validate: (input) => check(input).pipe(Effect.asVoid),
579
- post: (input) => deliver(input, false),
580
- send: (input) => deliver(input, true),
601
+ // @legacy ontology.chat-post-message
602
+ post: (input) => deliver({ ...input, as: "me" }),
603
+ send: (input) => deliver(input),
581
604
  };
582
- /** One delivery: posted with its requester's attribution, or sent as the agent without it. */
583
- function deliver(input, asAgent) {
605
+ /** One delivery: as the agent without attribution, or with `as: "me"` signed as the caller. */
606
+ function deliver(input) {
584
607
  return Effect.gen(function* () {
585
- const checked = yield* check(input, true, asAgent);
608
+ const asAgent = input.as !== "me";
609
+ const checked = yield* check(input);
586
610
  const { target, requester, connection, provider, inbox, compose } = checked;
587
611
  const buttons = "buttons" in checked ? checked.buttons : undefined;
588
612
  const scope = deliveryScopeDigest({
@@ -626,13 +650,12 @@ chats) {
626
650
  });
627
651
  // A post's stored files, as the caller names them. The key binds those names: a retry after
628
652
  // a file changed or went recovers the first attempt's receipt, read before the files are.
629
- const named = "files" in input && input.files !== undefined ? input.files : [];
653
+ const named = input.files ?? [];
630
654
  const references = named.map((file) => [file.entity, file.id.toLowerCase(), file.property ?? "content", ""]);
631
655
  const fingerprint = references.length === 0 || !("preview" in checked) || checked.preview === undefined
632
656
  ? checked.fingerprint
633
657
  : deliveryFingerprint(checked.preview, requester, undefined, buttons, undefined, references);
634
- if (named.length > 0 &&
635
- (("template" in input && input.template !== undefined) || archive === cloud)) {
658
+ if (named.length > 0 && (input.template !== undefined || archive === cloud)) {
636
659
  // @legacy agent.cloud-chat-archive Files go only through the workspace chat store.
637
660
  return yield* new ActionRejected({
638
661
  message: "The post's files cannot be sent (files_unsupported); nothing was sent.",
@@ -642,9 +665,7 @@ chats) {
642
665
  // A message read when it is sent, a template, its files, or the people of a shared
643
666
  // thread's reply, may read differently by the time its key is replayed, or not at all: a
644
667
  // replay recovers the first attempt's receipt before it.
645
- if ((("template" in input && input.template !== undefined) ||
646
- named.length > 0 ||
647
- inbox?.shared === true) &&
668
+ if ((input.template !== undefined || named.length > 0 || inbox?.shared === true) &&
648
669
  archive.find !== undefined) {
649
670
  const found = yield* archive
650
671
  .find({ delivery: { scope, key, fingerprint }, identityToken: context.identityToken })
@@ -692,7 +713,7 @@ chats) {
692
713
  const transport = connections({
693
714
  identityToken: context.identityToken,
694
715
  audit: {
695
- action: asAgent ? "agent_chat.send" : "agent_chat.post_message",
716
+ action: "agent_chat.send",
696
717
  principalId: context.principal.id,
697
718
  requestId: context.requestId,
698
719
  },
@@ -28,6 +28,8 @@ export function chatRoutes(options) {
28
28
  });
29
29
  const operations = makeOperations(backend, options.built.plan, options.hooks, options.connections, options.replicate, options.chatDelivery);
30
30
  const planned = options.built.plan.entities.find((entity) => entity.name === "agent_chat");
31
+ // @legacy ontology.chat-post-message `chat/actions/post_message`, send as me by its earlier
32
+ // name: `agent_chat/actions/send` serves every message.
31
33
  const action = planned.actions.find((candidate) => candidate.name === "post_message");
32
34
  for (const method of ["list", "history", "search", "actions/post_message"]) {
33
35
  yield* router.add("POST", `/api/ontology/chat/${method}`, (request) => Effect.gen(function* () {
@@ -1,4 +1,44 @@
1
1
  import { Schema } from "effect";
2
+ export declare const ChatSendWire: Schema.encodeKeys<Schema.Struct<{
3
+ readonly chat: Schema.String;
4
+ readonly text: Schema.optionalKey<Schema.String>;
5
+ readonly template: Schema.optionalKey<Schema.Struct<{
6
+ readonly name: Schema.String;
7
+ readonly language: Schema.String;
8
+ readonly parameters: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
9
+ readonly header: Schema.optionalKey<Schema.Struct<{
10
+ readonly parameters: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
11
+ readonly media: Schema.optionalKey<Schema.Struct<{
12
+ readonly url: Schema.optionalKey<Schema.String>;
13
+ readonly file: Schema.optionalKey<Schema.Struct<{
14
+ readonly entity: Schema.String;
15
+ readonly id: Schema.String;
16
+ readonly property: Schema.optionalKey<Schema.String>;
17
+ }>>;
18
+ readonly filename: Schema.optionalKey<Schema.String>;
19
+ }>>;
20
+ }>>;
21
+ readonly buttons: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
22
+ }>>;
23
+ readonly replyTo: Schema.optionalKey<Schema.String>;
24
+ readonly buttons: Schema.optionalKey<Schema.$Array<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
25
+ readonly text: Schema.String;
26
+ readonly url: Schema.String;
27
+ }>, Schema.Struct<{
28
+ readonly text: Schema.String;
29
+ readonly token: Schema.String;
30
+ }>]>>>>;
31
+ readonly files: Schema.optionalKey<Schema.$Array<Schema.Struct<{
32
+ readonly entity: Schema.String;
33
+ readonly id: Schema.String;
34
+ readonly property: Schema.optionalKey<Schema.String>;
35
+ }>>>;
36
+ readonly as: Schema.optionalKey<Schema.Literals<readonly ["agent", "me"]>>;
37
+ readonly idempotencyKey: Schema.String;
38
+ }>, {
39
+ readonly replyTo: "reply_to";
40
+ readonly idempotencyKey: "idempotency_key";
41
+ }>;
2
42
  export declare const ChatPostWire: Schema.encodeKeys<Schema.Struct<{
3
43
  readonly chat: Schema.String;
4
44
  readonly text: Schema.String;
@@ -1,7 +1,9 @@
1
1
  import { Schema } from "effect";
2
- import { ChatPostInput } from "../../chat.js";
2
+ import { ChatPostInput, ChatSendInput } from "../../chat.js";
3
3
  import { CHAT_KINDS } from "../../chat-channel.js";
4
4
  const Id = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(512));
5
+ export const ChatSendWire = ChatSendInput.pipe(Schema.encodeKeys({ replyTo: "reply_to", idempotencyKey: "idempotency_key" }));
6
+ // @legacy ontology.chat-post-message The input of post_message, the earlier name of send as me.
5
7
  export const ChatPostWire = ChatPostInput.pipe(Schema.encodeKeys({ replyTo: "reply_to", idempotencyKey: "idempotency_key" }));
6
8
  export const RuntimeChatPostWire = Schema.Struct({
7
9
  chat: ChatPostInput.fields.chat,
@@ -482,6 +482,8 @@ function runTool(server, tool, args, request, preview) {
482
482
  };
483
483
  }
484
484
  case "action": {
485
+ // @legacy ontology.chat-post-message chat_post_message, send as me by its earlier name,
486
+ // answers the flat receipt, and is the tool through which the agent's sessions post.
485
487
  if (target.planned.name === "agent_chat" && target.action.name === "post_message") {
486
488
  yield* decodeArguments(caller.kind === "runtime" ? RuntimeChatPostWire : ChatPostWire, args);
487
489
  const answer = yield* operations.runAction(target.planned, target.action, {
@@ -57,8 +57,13 @@ export interface McpTool {
57
57
  /** The JSON Schema of the tool's `structuredContent`, for the tools that return a known shape. */
58
58
  readonly outputSchema?: JsonSchemaObject;
59
59
  readonly annotations: McpToolAnnotations;
60
- /** Every permission a caller needs to see and run the tool; none for the global tools. */
60
+ /**
61
+ * Every permission a caller needs to see and run the tool, or, with `anyPermission`, one of them;
62
+ * none for the global tools.
63
+ */
61
64
  readonly permissions: ReadonlyArray<string>;
65
+ /** Any one of `permissions` opens the tool: an action several permissions open. */
66
+ readonly anyPermission?: true;
62
67
  /**
63
68
  * For a tool whose input depends on what the caller may read: the caller's input schema, or
64
69
  * `undefined` when the tool can do nothing for them and is not listed. Calls are checked anyway.
@@ -83,7 +88,10 @@ export declare function encodedJsonSchema(schema: Schema.Top): JsonSchemaObject;
83
88
  export declare const ACTION_OPTIONS_ARGUMENT = "_options";
84
89
  /** The `me` tool's marker: tool calls accept the runtime envelope's chat source. */
85
90
  export declare const RUNTIME_SOURCE_META = "segmentstream/runtime-source";
86
- /** The `chat_post_message` tool's marker: the deployment posts exact messages to its chat. */
91
+ /**
92
+ * The `chat_post_message` tool's marker: the deployment posts exact messages to its chat.
93
+ * @legacy ontology.chat-post-message
94
+ */
87
95
  export declare const CHAT_POST_META = "segmentstream/chat-post";
88
96
  /**
89
97
  * The MCP tools of an ontology: `me`, `discover` when it ranks by meaning, opt-in `navigation`,
@@ -2,7 +2,7 @@ import { Schema } from "effect";
2
2
  import { METRIC_QUERY_NAME_PATTERN, isBuiltInUser } from "../../metric-routes.js";
3
3
  import { InvalidOntology } from "../../diagnostics.js";
4
4
  import { GENERATED_UPSERT_PREFIX, humanize, mcpToolName } from "../../names.js";
5
- import { effectivePermissions, isAllowed, permissionOf, READ_VERB, } from "../../permissions.js";
5
+ import { allowsAction, effectivePermissions, isAllowed, permissionOf, READ_VERB, } from "../../permissions.js";
6
6
  import { FIND_CONDITIONS, findToolInput } from "./find-input.js";
7
7
  import { metricDescription, metricsFor, modelMetricDescription, modelMetricsFor, reachesOf, RECORDS_OR_METRIC_QUERIES, } from "../../render.js";
8
8
  import { actionInputJsonSchema } from "../../runtime/generated-actions.js";
@@ -267,7 +267,10 @@ function readTools(planned, schemas, built) {
267
267
  export const ACTION_OPTIONS_ARGUMENT = "_options";
268
268
  /** The `me` tool's marker: tool calls accept the runtime envelope's chat source. */
269
269
  export const RUNTIME_SOURCE_META = "segmentstream/runtime-source";
270
- /** The `chat_post_message` tool's marker: the deployment posts exact messages to its chat. */
270
+ /**
271
+ * The `chat_post_message` tool's marker: the deployment posts exact messages to its chat.
272
+ * @legacy ontology.chat-post-message
273
+ */
271
274
  export const CHAT_POST_META = "segmentstream/chat-post";
272
275
  const ACTION_OPTIONS_SCHEMA = {
273
276
  type: "object",
@@ -299,7 +302,7 @@ function actionToolInput(action) {
299
302
  };
300
303
  }
301
304
  function actionTool(planned, plannedAction) {
302
- const { name, action, permissions } = plannedAction;
305
+ const { name, action, permissions, anyPermission } = plannedAction;
303
306
  const hints = hintsOf(planned, plannedAction);
304
307
  return {
305
308
  name: mcpToolName(planned.name, name),
@@ -314,6 +317,7 @@ function actionTool(planned, plannedAction) {
314
317
  openWorldHint: action.connections.length > 0 && hints.connectionsReadOnly !== true,
315
318
  },
316
319
  permissions,
320
+ ...(anyPermission === undefined ? {} : { anyPermission }),
317
321
  target: { kind: "action", planned, action: plannedAction },
318
322
  };
319
323
  }
@@ -772,6 +776,7 @@ export function mcpTools(built, chatHistory = false, storage = {}, navigation =
772
776
  tools[discover] = { ...tools[discover], description: DISCOVER_BY_MEANING };
773
777
  }
774
778
  }
779
+ // @legacy ontology.chat-post-message chat_post_message, send as me by its earlier name.
775
780
  const post = tools.findIndex((tool) => tool.name === "chat_post_message");
776
781
  if (post >= 0) {
777
782
  const original = tools[post];
@@ -943,6 +948,7 @@ export function mcpTools(built, chatHistory = false, storage = {}, navigation =
943
948
  ...tool,
944
949
  inputSchema: withConfirmation(tool.inputSchema, tool.annotations),
945
950
  // Exact chat posting confirms its own preview of the destination and the posted text.
951
+ // @legacy ontology.chat-post-message
946
952
  ...(tool.target.kind === "action" &&
947
953
  tool.name !== "chat_post_message" &&
948
954
  needsConfirmation(tool.annotations)
@@ -980,7 +986,7 @@ export function visibleTools(tools, caller, provenance = { kind: "unverified" })
980
986
  if ((caller.kind === "guest" && USER_TOOL_TARGETS.has(tool.target.kind)) ||
981
987
  !runtimeAllows(provenance, tool) ||
982
988
  (tool.target.kind === "toolset" && isReadScoped(provenance)) ||
983
- !tool.permissions.every((required) => isAllowed(required, caller))) {
989
+ !allowsAction(tool, caller)) {
984
990
  return [];
985
991
  }
986
992
  const description = tool.descriptionFor?.(caller) ?? tool.description;
@@ -989,6 +995,7 @@ export function visibleTools(tools, caller, provenance = { kind: "unverified" })
989
995
  {
990
996
  ...tool,
991
997
  description,
998
+ // @legacy ontology.chat-post-message
992
999
  ...(tool.name === "chat_post_message" && provenance.kind === "runtime"
993
1000
  ? {
994
1001
  inputSchema: withConfirmation(encodedJsonSchema(RuntimeChatPostWire), tool.annotations),
@@ -14,7 +14,7 @@ import { requireRuntimeOperation } from "./mcp/runtime-policy.js";
14
14
  import { ChatDelivery } from "../chat.js";
15
15
  import { withoutConfirmation } from "./mcp/confirmation.js";
16
16
  import { consumeChatEnvelope, CurrentChatCall } from "./chat/envelope.js";
17
- import { ChatPostWire, RuntimeChatPostWire } from "./chat/schemas.js";
17
+ import { ChatPostWire, ChatSendWire, RuntimeChatPostWire } from "./chat/schemas.js";
18
18
  import { OIDC_TOKEN_HEADER } from "./connections.js";
19
19
  import { InvalidActionInput, RequestId } from "./errors.js";
20
20
  import { recordReads } from "./record-reads.js";
@@ -233,6 +233,7 @@ function runActionOf(backend, plan, hooks, connections, replicate, chatDelivery)
233
233
  "for a task whatever its workflow's role grants; the workflow sends what the task wrote.",
234
234
  });
235
235
  }
236
+ // @legacy ontology.chat-post-message The agent's sessions post through post_message alone.
236
237
  if (planned.name === "agent_chat" && name === "post_message" && caller.kind === "runtime") {
237
238
  const values = yield* Schema.decodeUnknownEffect(RuntimeChatPostWire)(consumed.input, {
238
239
  onExcessProperty: "error",
@@ -333,13 +334,16 @@ function runActionOf(backend, plan, hooks, connections, replicate, chatDelivery)
333
334
  const outcome = yield* delivery === undefined
334
335
  ? run
335
336
  : run.pipe(Effect.provideService(ChatDelivery, delivery));
337
+ // Validating a message checks its destination, sender and exact text, sending nothing.
336
338
  if (call.validateOnly &&
337
339
  outcome.validation.ok &&
338
340
  planned.name === "agent_chat" &&
339
- name === "post_message" &&
341
+ (name === "send" || name === "post_message") &&
340
342
  delivery) {
341
- const decoded = yield* Schema.decodeUnknownEffect(ChatPostWire)(input).pipe(Effect.mapError(() => new ActionRejected({ message: "Invalid exact chat post input." })));
342
- yield* delivery.validate(decoded);
343
+ const decoded = yield* Schema.decodeUnknownEffect(
344
+ // @legacy ontology.chat-post-message post_message, which posts as send with as me.
345
+ name === "send" ? ChatSendWire : ChatPostWire)(input).pipe(Effect.mapError(() => new ActionRejected({ message: "Invalid exact chat post input." })));
346
+ yield* delivery.validate(name === "send" ? decoded : { ...decoded, as: "me" });
343
347
  }
344
348
  const { issues } = outcome.validation;
345
349
  if (!outcome.validation.ok && !call.validateOnly) {
@@ -31,8 +31,10 @@ export interface PlannedAction {
31
31
  readonly name: string;
32
32
  readonly action: AnyAction;
33
33
  readonly generated: boolean;
34
- /** Every permission a principal needs to run it. */
34
+ /** Every permission a principal needs to run it, or, with `anyPermission`, one of them. */
35
35
  readonly permissions: ReadonlyArray<string>;
36
+ /** Any one of `permissions` runs the action, which checks inside what its input needs. */
37
+ readonly anyPermission?: true;
36
38
  /** The entities an authored action declares it writes, by name; absent when it declares none. */
37
39
  readonly writes?: ReadonlyArray<string>;
38
40
  }
@@ -48,11 +48,13 @@ function plannedActions(resolved, generatedActions, report) {
48
48
  generated: true,
49
49
  permissions: generatedActionPermissions(resolved.name, name),
50
50
  }));
51
- const authored = resolved.actions.map(({ name, action, permission, writes }) => ({
51
+ const authored = resolved.actions.map(({ name, action, permission, anyOf, writes }) => ({
52
52
  name,
53
53
  action,
54
54
  generated: false,
55
- permissions: [permission],
55
+ ...(anyOf === undefined
56
+ ? { permissions: [permission] }
57
+ : { permissions: anyOf, anyPermission: true }),
56
58
  ...(writes === undefined ? {} : { writes }),
57
59
  }));
58
60
  const actions = [...generated, ...authored];
@@ -386,6 +386,7 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
386
386
  readonly name: Schema.String;
387
387
  readonly description: Schema.String;
388
388
  readonly permission: Schema.optionalKey<Schema.String>;
389
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
389
390
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
390
391
  readonly retryOnDeadlock: Schema.optionalKey<Schema.Boolean>;
391
392
  readonly writes: Schema.optionalKey<Schema.$Array<Schema.String>>;
@@ -677,6 +678,7 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
677
678
  readonly name: Schema.String;
678
679
  readonly description: Schema.String;
679
680
  readonly permission: Schema.optionalKey<Schema.String>;
681
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
680
682
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
681
683
  readonly retryOnDeadlock: Schema.optionalKey<Schema.Boolean>;
682
684
  readonly writes: Schema.optionalKey<Schema.$Array<Schema.String>>;
@@ -779,6 +781,7 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
779
781
  readonly name: Schema.String;
780
782
  readonly description: Schema.String;
781
783
  readonly permission: Schema.optionalKey<Schema.String>;
784
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
782
785
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
783
786
  readonly retryOnDeadlock: Schema.optionalKey<Schema.Boolean>;
784
787
  readonly writes: Schema.optionalKey<Schema.$Array<Schema.String>>;
@@ -1070,6 +1073,7 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
1070
1073
  readonly name: Schema.String;
1071
1074
  readonly description: Schema.String;
1072
1075
  readonly permission: Schema.optionalKey<Schema.String>;
1076
+ readonly anyOf: Schema.optionalKey<Schema.$Array<Schema.String>>;
1073
1077
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1074
1078
  readonly retryOnDeadlock: Schema.optionalKey<Schema.Boolean>;
1075
1079
  readonly writes: Schema.optionalKey<Schema.$Array<Schema.String>>;
@@ -11,7 +11,7 @@ import { nameToWire } from "../authoring-names.js";
11
11
  import { bundledNavigationCatalog } from "../navigation-artifact.js";
12
12
  import { parsePageCatalog } from "../navigation-catalog.js";
13
13
  import { chatRetentionDaysOf, declaredChatRetentionDaysOf, guestOf, signUpOriginsOf, signUpRolesOf, } from "../manifest.js";
14
- import { isAllowed } from "../permissions.js";
14
+ import { allowsAction } from "../permissions.js";
15
15
  import { agentToolsFor } from "../runtime/guests.js";
16
16
  import { implicitMemberOf } from "../role.js";
17
17
  import { sqlServiceRuntime } from "../runtime/service-binding.js";
@@ -130,7 +130,7 @@ function unmatchedRoutes(plan, verifyToken, exchangeSession, verifyRuntime) {
130
130
  const authenticated = yield* withPrincipal(credential, verifyToken, backend, Effect.gen(function* () {
131
131
  const principal = yield* CurrentPrincipal;
132
132
  const caller = yield* currentCaller;
133
- const visible = entity.actions.filter((action) => action.permissions.every((permission) => isAllowed(permission, principal)) &&
133
+ const visible = entity.actions.filter((action) => allowsAction(action, principal) &&
134
134
  runtimeAllows(caller, { entity: entity.name, action: action.name }));
135
135
  const suggestions = suggestNames(match[2], visible.map(({ name }) => name));
136
136
  return toServerResponse(routeNotFound(requestId, suggestions));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.182.0",
3
+ "version": "0.183.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",