@segmentstream/ontology 0.208.0 → 0.210.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,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.210.0
4
+
5
+ A chat now has one optional `description`. Upgrading the ontology combines its existing `purpose` and `when_to_use` text in that field. The agent uses the description in group routing and conversation context. A workspace can use its own language.
6
+
7
+ Action required: before upgrading the ontology, move reads and updates of the two former fields to `description`. Replace exact purpose-key lookups with references to the intended chats. The agent and ontology can be upgraded independently.
8
+
9
+ ## 0.209.0
10
+
11
+ Workflows can start when the platform records an outcome for their workspace. Declare
12
+ `platform(name, { description, events, when, input })` from `@segmentstream/ontology/workflows`
13
+ in a workflow's `triggers`: the workflow starts once for each event of the listed types, as its own
14
+ user. The first events are `deployment.succeeded`, when a production deployment becomes the serving
15
+ one, and `deployment.failed`, when one fails. Each event carries its id, its time and the
16
+ deployment's id and commit; a failure adds its code and the `dep_…` reference the console and the
17
+ CLI explain it by. An event is delivered at least once, and a repeated delivery starts no second
18
+ run for a trigger. `when` and `input` are synchronous functions of the event, as for `after(…)`.
19
+
20
+ `check` refuses an event type the catalog does not define (`platform_event_unknown`), a platform
21
+ trigger on a workflow that lists an owned connection (`platform_trigger_owned`), and more than 20
22
+ platform triggers per ontology. Run attribution names the trigger and the event's id
23
+ (`startedBy.triggerKind: "platform"`, `startedBy.event`), and the workflow list shows platform
24
+ triggers with their event types.
25
+
3
26
  ## 0.208.0
4
27
 
5
28
  The agent's limit on sign-ups is named for what it counts, and a workspace may raise its
package/README.md CHANGED
@@ -1407,7 +1407,7 @@ Without either header the agent may call only the agent routes:
1407
1407
  | `GET /api/ontology/agent/identities/{provider}/{external_id}` | agent | `{ user: { id, name }, roles, agent_tools }`; 404 unpaired, 403 revoked, inactive |
1408
1408
  | `GET /api/ontology/agent/identities` | member | `{ identities }`: the member's live identities |
1409
1409
  | `DELETE /api/ontology/agent/identities/{id}` | member | Revokes one of them: 204 |
1410
- | `POST /api/ontology/agent/chats/seen` | agent | `{ provider, externalId, title, memberId?, leftMemberId?, agentLeft?, migratedFrom? }` → `{ id, title, purpose, whenToUse, handled? }` |
1410
+ | `POST /api/ontology/agent/chats/seen` | agent | `{ provider, externalId, title, memberId?, leftMemberId?, agentLeft?, migratedFrom? }` → `{ id, title, description, handled? }` |
1411
1411
  | `POST /api/ontology/agent/chats/handoff` | agent | `{ provider, externalId, memberId, reason }` → `{ id, handoffAt, handled? }`; 404 for a chat staff do not take over |
1412
1412
  | `POST /api/ontology/agent/chats/messages` | agent | Records one message in `_chat_messages`, once by `(channel, chatId, messageId)` and by `operation` → `{ id, first }`; 409 `operation_conflict` for a replay with another `fingerprint` |
1413
1413
  | `POST /api/ontology/agent/chats/messages/change` | agent | One change to a message: `edit`, `delete`, `reaction`, `status`, `disposition`, `sent` (by `operation`) or `meta` → `{ applied }` |
@@ -1538,9 +1538,9 @@ records `lastMessageAt` at most every 15 minutes, links a paired, active writer
1538
1538
  `members` and unlinks `leftMemberId`, a paired member who left, when linked, or every member
1539
1539
  with `agentLeft: true`, when the agent itself left (the chat stays). With `migratedFrom`, the
1540
1540
  old id of a group that became a supergroup, it moves the old record to `externalId`, or, when
1541
- both are recorded, moves the members and a missing `purpose` and `whenToUse` to the new one and
1541
+ both are recorded, moves the members and a missing `description` to the new one and
1542
1542
  deletes the old one. `provider`, `externalId`, `title` and `lastMessageAt` are
1543
- managed. Members set `purpose` and `whenToUse` with the generated
1543
+ managed. Members set `description` with the generated
1544
1544
  `agent_chat.update`, the chat's only generated action, which sets no relationship: `handledBy`
1545
1545
  changes only through `agent_chat.takeOver` and `agent_chat.handBack`. `agent_chat.importHistory`
1546
1546
  adds a chat's messages from before the agent recorded it, each in its place by its time and once by
@@ -17,8 +17,7 @@ export declare const AgentChat: import("./entity.js").Entity<"agent_chat", {
17
17
  readonly personaNoticeAt: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
18
18
  readonly personaChangedAt: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
19
19
  readonly agentPersona: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
20
- readonly purpose: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
21
- readonly whenToUse: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
20
+ readonly description: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
22
21
  }, {
23
22
  readonly members: import("./relationship.js").ManyRelationship;
24
23
  readonly handledBy: import("./relationship.js").OneRelationship<true, false, "user">;
@@ -186,8 +185,7 @@ export declare const AgentChat: import("./entity.js").Entity<"agent_chat", {
186
185
  readonly personaNoticeAt: string | null;
187
186
  readonly personaChangedAt: string | null;
188
187
  readonly agentPersona: string | null;
189
- readonly purpose: string | null;
190
- readonly whenToUse: string | null;
188
+ readonly description: string | null;
191
189
  readonly handledById: string | null;
192
190
  }>, Readonly<Record<never, never>>, "generated">;
193
191
  export type AgentChat = typeof AgentChat.Type;
@@ -107,18 +107,11 @@ export const AgentChat = entity("agent_chat", {
107
107
  label: "Agent persona",
108
108
  description: "The persona assigned to this chat. Empty inherits the workspace's chat rules and default.",
109
109
  }),
110
- purpose: p.text({
110
+ description: p.text({
111
111
  optional: true,
112
- maxLength: 64,
113
- description: "A short key that code and agents look the chat up by, such as support.",
114
- }),
115
- whenToUse: p.text({
116
- optional: true,
117
- maxLength: 1000,
112
+ maxLength: 1200,
118
113
  display: "multiline",
119
- label: "When to use",
120
- description: "For agents: what the chat is for and when to write there, such as " +
121
- '"Order questions; the team answers on weekdays."',
114
+ description: "What the chat is for and what its participants use it for.",
122
115
  }),
123
116
  },
124
117
  relationships: {
package/dist/analyze.js CHANGED
@@ -30,7 +30,8 @@ import { MAX_ME_HOPS, mePathOf } from "./me.js";
30
30
  import { entityQuerySchemas, findEntityManifest, queryFields, queryLinks, } from "./query.js";
31
31
  import { EARLIER_QUERY_METRICS_ROUTE, earlierNamesOf } from "./legacy.js";
32
32
  import { resolveModelMetrics } from "./model-metrics.js";
33
- import { cronNeverFires, cronProblem, isAsyncFunction, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_WORKFLOWS, } from "./workflow.js";
33
+ import { cronNeverFires, cronProblem, isAsyncFunction, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_PLATFORM_TRIGGERS, MAX_WORKFLOWS, } from "./workflow.js";
34
+ import { isPlatformEventType, PLATFORM_EVENT_TYPES } from "./platform-events.js";
34
35
  import { MAX_WEBHOOK_HEADERS, MAX_WEBHOOKS, webhookDelivery, webhookHeaderProblem, CONNECTION_INPUT_KEY, webhookSignatureManifest, webhookSignatureProblems, WORKSPACE_SECRET_NAME, } from "./webhooks.js";
35
36
  import { actionInputToWire } from "./authoring-input.js";
36
37
  import { validate } from "./runtime/validation.js";
@@ -729,15 +730,20 @@ function resolveWorkflows(input) {
729
730
  const triggers = [];
730
731
  const triggerNames = new Set();
731
732
  if (!Array.isArray(candidate.triggers)) {
732
- report("invalid-workflow", `${path}.triggers`, "triggers is a list of cron(name, …), after(name, …) and webhook(name, …).");
733
+ report("invalid-workflow", `${path}.triggers`, "triggers is a list of cron(name, …), after(name, …), webhook(name, …) and " +
734
+ "platform(name, …).");
733
735
  valid = false;
734
736
  }
735
737
  else {
736
738
  candidate.triggers.forEach((trigger, position) => {
737
739
  if (!isWorkflowTrigger(trigger) ||
738
- (trigger.kind !== "cron" && trigger.kind !== "action" && trigger.kind !== "webhook")) {
740
+ (trigger.kind !== "cron" &&
741
+ trigger.kind !== "action" &&
742
+ trigger.kind !== "webhook" &&
743
+ trigger.kind !== "platform")) {
739
744
  report("invalid-workflow", `${path}.triggers[${position}]`, "is not a trigger; declare triggers with cron(name, expression, { description }), " +
740
- "after(name, target, { description }) or webhook(name, { description }).");
745
+ "after(name, target, { description }), webhook(name, { description }) or " +
746
+ "platform(name, { description, events }).");
741
747
  valid = false;
742
748
  return;
743
749
  }
@@ -746,7 +752,9 @@ function resolveWorkflows(input) {
746
752
  ? "weekdayMorning"
747
753
  : trigger.kind === "action"
748
754
  ? "qualified"
749
- : "stripe";
755
+ : trigger.kind === "platform"
756
+ ? "deployFailed"
757
+ : "stripe";
750
758
  const triggerName = camelCaseName(trigger.name, at, example, "trigger", report);
751
759
  if (triggerName === undefined) {
752
760
  valid = false;
@@ -766,7 +774,9 @@ function resolveWorkflows(input) {
766
774
  ? resolveCronTrigger(trigger, at, schema, wire, report)
767
775
  : trigger.kind === "action"
768
776
  ? resolveActionTrigger(trigger, at, entities, schema, wire, report)
769
- : resolveWebhookTrigger(trigger, at, scope);
777
+ : trigger.kind === "platform"
778
+ ? resolvePlatformTrigger(trigger, at, schema, wire, report)
779
+ : resolveWebhookTrigger(trigger, at, scope);
770
780
  if (resolvedTrigger === undefined) {
771
781
  valid = false;
772
782
  }
@@ -809,6 +819,13 @@ function resolveWorkflows(input) {
809
819
  "belongs to none; start the owned work from a cron, an action trigger or a person.");
810
820
  valid = false;
811
821
  }
822
+ // A platform event belongs to the workspace, not to a user, as a webhook's delivery does.
823
+ if (kinds.has("platform") && ownedKeys.length > 0) {
824
+ report("platform_trigger_owned", `${path}.triggers`, `the workflow lists the owned connection${ownedKeys.length === 1 ? "" : "s"} ` +
825
+ `${ownedKeys.join(", ")}, so each run belongs to a user, and a platform event ` +
826
+ "belongs to none; start the owned work from a cron, an action trigger or a person.");
827
+ valid = false;
828
+ }
812
829
  if (kinds.has("webhook")) {
813
830
  if (kinds.size > 1) {
814
831
  report("workflow_webhook_mixed_triggers", `${path}.triggers`, "a workflow that a webhook starts takes a delivery as its input, so it has only webhook " +
@@ -846,6 +863,14 @@ function resolveWorkflows(input) {
846
863
  report("workflow_trigger_limit_exceeded", "workflows", `An ontology may declare at most ${MAX_ACTION_TRIGGERS} action triggers; it declares ` +
847
864
  `${actionTriggers}.`);
848
865
  }
866
+ const platformTriggers = input.workflows
867
+ .filter(isWorkflow)
868
+ .flatMap((candidate) => (Array.isArray(candidate.triggers) ? candidate.triggers : []))
869
+ .filter((trigger) => isWorkflowTrigger(trigger) && trigger.kind === "platform").length;
870
+ if (platformTriggers > MAX_PLATFORM_TRIGGERS) {
871
+ report("workflow_trigger_limit_exceeded", "workflows", `An ontology may declare at most ${MAX_PLATFORM_TRIGGERS} platform triggers; it declares ` +
872
+ `${platformTriggers}.`);
873
+ }
849
874
  // A webhook's wire name is its URL, so it is unique across the ontology, not only its workflow.
850
875
  const webhooks = new Map();
851
876
  for (const candidate of input.workflows.filter(isWorkflow)) {
@@ -1123,6 +1148,57 @@ function resolveActionTrigger(trigger, at, entities, schema, wire, report) {
1123
1148
  }
1124
1149
  : undefined;
1125
1150
  }
1151
+ /**
1152
+ * A platform trigger's manifest form: its event types, each one of this SDK's catalog, listed
1153
+ * once. `when` and `input` are synchronous functions of the event, as an action trigger's are.
1154
+ * `undefined` after reporting a problem.
1155
+ */
1156
+ function resolvePlatformTrigger(trigger, at, schema, wire, report) {
1157
+ let valid = true;
1158
+ const events = trigger.events;
1159
+ if (!Array.isArray(events) || events.length === 0) {
1160
+ report("invalid-trigger", `${at}.events`, `events lists the platform events that start the workflow: one or more of ` +
1161
+ `${PLATFORM_EVENT_TYPES.join(", ")}.`);
1162
+ return undefined;
1163
+ }
1164
+ const types = [];
1165
+ for (const event of events) {
1166
+ if (!isPlatformEventType(event)) {
1167
+ report("platform_event_unknown", `${at}.events`, `${JSON.stringify(event)} is not a platform event; the platform sends ` +
1168
+ `${PLATFORM_EVENT_TYPES.join(", ")}.`);
1169
+ valid = false;
1170
+ }
1171
+ else if (!types.includes(event)) {
1172
+ types.push(event);
1173
+ }
1174
+ }
1175
+ for (const key of ["when", "input"]) {
1176
+ const fn = trigger[key];
1177
+ if (fn === undefined) {
1178
+ continue;
1179
+ }
1180
+ if (typeof fn !== "function") {
1181
+ report("invalid-trigger", `${at}.${key}`, `${key} is a function of the event, (event) => ….`);
1182
+ valid = false;
1183
+ }
1184
+ else if (isAsyncFunction(fn)) {
1185
+ report("trigger_function_async", `${at}.${key}`, `${key} runs before the run starts, so it is synchronous: drop async and read only the ` +
1186
+ "event; the workflow's steps read the rest.");
1187
+ valid = false;
1188
+ }
1189
+ }
1190
+ if (trigger.input === undefined && typeof schema !== "string" && wire !== undefined) {
1191
+ const empty = workflowWireInput(schema, wire, undefined);
1192
+ if (typeof empty === "string") {
1193
+ report("workflow_input_invalid", `${at}.input`, `without input the trigger starts the workflow with {}, which ${empty}; map the event ` +
1194
+ "to the workflow's input with input: (event) => ({ … }).");
1195
+ valid = false;
1196
+ }
1197
+ }
1198
+ return valid
1199
+ ? { kind: "platform", name: trigger.name, description: trigger.description, events: types }
1200
+ : undefined;
1201
+ }
1126
1202
  /** The keys of the connections a workflow's steps call, each listed in `defineOntology`. */
1127
1203
  function workflowConnections(path, declared, scope) {
1128
1204
  if (declared === undefined) {
@@ -1,10 +1,10 @@
1
1
  import { Schema } from "effect";
2
- export declare const DIAGNOSTIC_CODES: readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "invalid-erasure", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-chat", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "toolset_connection_owned", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded", "workflow_owned_connection_webhook"];
2
+ export declare const DIAGNOSTIC_CODES: readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "invalid-erasure", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-chat", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "toolset_connection_owned", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded", "workflow_owned_connection_webhook", "platform_event_unknown", "platform_trigger_owned"];
3
3
  export type DiagnosticCode = (typeof DIAGNOSTIC_CODES)[number];
4
4
  /** A problem `check` found in an ontology definition. */
5
5
  export declare const Diagnostic: Schema.Struct<{
6
6
  readonly severity: Schema.Literals<readonly ["error", "warning", "info"]>;
7
- readonly code: Schema.Literals<readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "invalid-erasure", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-chat", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "toolset_connection_owned", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded", "workflow_owned_connection_webhook"]>;
7
+ readonly code: Schema.Literals<readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "invalid-erasure", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-chat", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "toolset_connection_owned", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded", "workflow_owned_connection_webhook", "platform_event_unknown", "platform_trigger_owned"]>;
8
8
  /** Where the problem is, for example `lead.properties.status.options[1]`. */
9
9
  readonly path: Schema.String;
10
10
  readonly message: Schema.String;
@@ -14,7 +14,7 @@ declare const InvalidOntology_base: Schema.Class<InvalidOntology, Schema.TaggedS
14
14
  readonly message: Schema.String;
15
15
  readonly diagnostics: Schema.$Array<Schema.Struct<{
16
16
  readonly severity: Schema.Literals<readonly ["error", "warning", "info"]>;
17
- readonly code: Schema.Literals<readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "invalid-erasure", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-chat", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "toolset_connection_owned", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded", "workflow_owned_connection_webhook"]>;
17
+ readonly code: Schema.Literals<readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "invalid-erasure", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "invalid-chat", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "agent-tools-implicit", "named-secret-deprecated", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "toolset_connection_owned", "invalid-alignment", "single-entity-model-metric", "invalid-workflow", "workflow_role_unknown", "workflow_role_is_member", "workflow_role_grants_nothing", "workflow_role_wildcard", "workflow_role_scoped", "workflow_cron_never_fires", "workflow_input_invalid", "workflow_cron_invalid", "workflow_run_missing", "invalid-trigger", "trigger_action_unknown", "trigger_function_async", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded", "workflow_owned_connection_webhook", "platform_event_unknown", "platform_trigger_owned"]>;
18
18
  /** Where the problem is, for example `lead.properties.status.options[1]`. */
19
19
  readonly path: Schema.String;
20
20
  readonly message: Schema.String;
@@ -95,6 +95,8 @@ export const DIAGNOSTIC_CODES = [
95
95
  "workflow_webhook_headers_invalid",
96
96
  "workflow_webhook_limit_exceeded",
97
97
  "workflow_owned_connection_webhook",
98
+ "platform_event_unknown",
99
+ "platform_trigger_owned",
98
100
  ];
99
101
  /** A problem `check` found in an ontology definition. */
100
102
  export const Diagnostic = Schema.Struct({
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ export type { ActionsBuilder, AnyEntity, ActionHandle, ActionInvoker, MetricQuer
24
24
  export { ActionRejected, BatchErrorDetails, Conflict, DeploymentInterrupted, DeploymentSwitching, LimitErrorDetails, NotFound, PermissionDenied, ScopeViolated, } from "./errors.js";
25
25
  export type { ActionError } from "./errors.js";
26
26
  export { browserAuthenticationCompatible } from "./manifest-compatibility.js";
27
- export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isWebhookTrigger, OtherTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, inboxRolesOf, inboxChannelsOf, takeoverChannelsOf, signUpRolesOf, CHAT_RETENTION_DAYS, chatRetentionDaysOf, keepsChatFiles, } from "./manifest.js";
27
+ export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isPlatformTrigger, isWebhookTrigger, OtherTriggerManifest, PlatformTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, inboxRolesOf, inboxChannelsOf, takeoverChannelsOf, signUpRolesOf, CHAT_RETENTION_DAYS, chatRetentionDaysOf, keepsChatFiles, } from "./manifest.js";
28
28
  export { SYSTEM_PROPERTIES } from "./names.js";
29
29
  export type { SystemProperty } from "./names.js";
30
30
  export { isMe, isMeMarker, MAX_ME_HOPS, me, ME_KEY, MeMarker, mePathOf, meToWire, MeTypeId, } from "./me.js";
@@ -44,10 +44,12 @@ export type { RenderOptions } from "./render.js";
44
44
  export { implicitMemberOf, implicitRoleNames, isImplicitRole, member, role, roleEntries, rolePermissions, } from "./role.js";
45
45
  export type { Role, RoleOptions, RolePermission } from "./role.js";
46
46
  export type { FeedbackOptions, ResolvedFeedback } from "./feedback-config.js";
47
- export { after, changed, cron, cronNeverFires, cronProblem, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_WORKFLOWS, nextCronTime, webhook, workflow, } from "./workflow.js";
47
+ export { after, changed, cron, cronNeverFires, cronProblem, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_PLATFORM_TRIGGERS, MAX_WORKFLOWS, nextCronTime, platform, webhook, workflow, } from "./workflow.js";
48
+ export { PLATFORM_EVENT_TYPES } from "./platform-events.js";
49
+ export type { PlatformEvent, PlatformEventOf, PlatformEventType } from "./platform-events.js";
48
50
  export { MAX_WEBHOOK_BODY_BYTES, MAX_META_WEBHOOK_BODY_BYTES, MAX_WEBHOOK_HEADERS, MAX_WEBHOOKS, WEBHOOK_BASE_PATH, WEBHOOK_SIGNATURE_SCHEMES, webhookDelivery, webhookHeaderProblem, webhookPath, } from "./webhooks.js";
49
51
  export type { WebhookDelivery, WebhookHmacFormat, WebhookSignatureScheme, WebhookSignedPart, } from "./webhooks.js";
50
- export type { ActionEvent, ActionTrigger, AfterOptions, AnyActionHandle, AnyWorkflow, ChangedBounds, CronOptions, CronProblem, CronTrigger, TriggerFunction, TriggerRecord, WebhookOptions, WebhookSignature, WebhookVerification, WebhookTrigger, Workflow, WorkflowFunction, WorkflowOptions, WorkflowRunContext, WorkflowTrigger, } from "./workflow.js";
52
+ export type { ActionEvent, ActionTrigger, AfterOptions, AnyActionHandle, AnyWorkflow, ChangedBounds, CronOptions, CronProblem, CronTrigger, PlatformOptions, PlatformTrigger, TriggerFunction, TriggerRecord, WebhookOptions, WebhookSignature, WebhookVerification, WebhookTrigger, Workflow, WorkflowFunction, WorkflowOptions, WorkflowRunContext, WorkflowTrigger, } from "./workflow.js";
51
53
  export { CHANNEL_PROVIDERS, DEFAULT_SIGN_IN_POLICY, SIGN_IN_METHODS, SIGN_IN_POLICIES, SIGN_UP_CHANNELS, GUEST_BOT_CHECK_SCHEMES, GUEST_CHANNELS, matchesWebsite, signUpOrigin, websiteOrigin, } from "./sign-in.js";
52
54
  export type { ChannelProvider, GuestBotCheck, GuestBotCheckScheme, ResolvedGuestBotCheck, GuestChannel, GuestOptions, ResolvedGuest, ResolvedSignInOptions, ResolvedSignUp, SignInCheck, SignInMethod, SignInOptions, SignInPolicy, SignUpChannel, SignUpOptions, } from "./sign-in.js";
53
55
  export { SIGN_IN_CODE_VALUE } from "./emails.js";
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ export { entity, isEntity } from "./entity.js";
13
13
  export { isToolset, MCP_TOOL_NAME, TOOLSET_LOCK_VERSION, toolset, ToolsetLock, ToolsetLockTool, } from "./toolset.js";
14
14
  export { ActionRejected, BatchErrorDetails, Conflict, DeploymentInterrupted, DeploymentSwitching, LimitErrorDetails, NotFound, PermissionDenied, ScopeViolated, } from "./errors.js";
15
15
  export { browserAuthenticationCompatible } from "./manifest-compatibility.js";
16
- export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isWebhookTrigger, OtherTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, inboxRolesOf, inboxChannelsOf, takeoverChannelsOf, signUpRolesOf, CHAT_RETENTION_DAYS, chatRetentionDaysOf, keepsChatFiles, } from "./manifest.js";
16
+ export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isPlatformTrigger, isWebhookTrigger, OtherTriggerManifest, PlatformTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, inboxRolesOf, inboxChannelsOf, takeoverChannelsOf, signUpRolesOf, CHAT_RETENTION_DAYS, chatRetentionDaysOf, keepsChatFiles, } from "./manifest.js";
17
17
  export { SYSTEM_PROPERTIES } from "./names.js";
18
18
  export { isMe, isMeMarker, MAX_ME_HOPS, me, ME_KEY, MeMarker, mePathOf, meToWire, MeTypeId, } from "./me.js";
19
19
  export { check, defineOntology } from "./ontology.js";
@@ -24,7 +24,8 @@ export { p, PROPERTY_TYPES, propertyDefinition } from "./property.js";
24
24
  export { ON_DELETE, rel } from "./relationship.js";
25
25
  export { renderCatalog } from "./render.js";
26
26
  export { implicitMemberOf, implicitRoleNames, isImplicitRole, member, role, roleEntries, rolePermissions, } from "./role.js";
27
- export { after, changed, cron, cronNeverFires, cronProblem, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_WORKFLOWS, nextCronTime, webhook, workflow, } from "./workflow.js";
27
+ export { after, changed, cron, cronNeverFires, cronProblem, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_PLATFORM_TRIGGERS, MAX_WORKFLOWS, nextCronTime, platform, webhook, workflow, } from "./workflow.js";
28
+ export { PLATFORM_EVENT_TYPES } from "./platform-events.js";
28
29
  export { MAX_WEBHOOK_BODY_BYTES, MAX_META_WEBHOOK_BODY_BYTES, MAX_WEBHOOK_HEADERS, MAX_WEBHOOKS, WEBHOOK_BASE_PATH, WEBHOOK_SIGNATURE_SCHEMES, webhookDelivery, webhookHeaderProblem, webhookPath, } from "./webhooks.js";
29
30
  export { CHANNEL_PROVIDERS, DEFAULT_SIGN_IN_POLICY, SIGN_IN_METHODS, SIGN_IN_POLICIES, SIGN_UP_CHANNELS, GUEST_BOT_CHECK_SCHEMES, GUEST_CHANNELS, matchesWebsite,
30
31
  // @legacy ontology.sign-up-origin-name
@@ -24,8 +24,8 @@ import { type ResolvedGuest, type ResolvedSignInOptions, type SignInPolicy } fro
24
24
  * input as JSON Schema, the connections its steps call and its triggers, whose input is in wire form.
25
25
  * Within version 9, a property may have the type `list` with its `items` type: only the built-in
26
26
  * user's managed `roles`, which has no column.
27
- * Within version 9, triggers may also be `action` and `webhook` triggers; readers ignore kinds they
28
- * do not know.
27
+ * Within version 9, triggers may also be `action`, `webhook` and `platform` triggers; readers
28
+ * ignore kinds they do not know.
29
29
  * Version 10 adds the roles' `scopes`, written only when a role scopes some of its permissions: each
30
30
  * names the permission and its `where` in the wire form of a query, with `me` as `{ "$me": [] }`
31
31
  * and a path from it as `{ "$me": ["staff_member", "division"] }`. `permissions` still lists every
@@ -566,6 +566,18 @@ export declare const WebhookTriggerManifest: Schema.Struct<{
566
566
  readonly connection: Schema.optionalKey<Schema.String>;
567
567
  }>;
568
568
  export type WebhookTriggerManifest = typeof WebhookTriggerManifest.Type;
569
+ /**
570
+ * A platform trigger of a workflow: the ontology service starts the workflow for each event of the
571
+ * listed catalog types that the platform delivers for this workspace. The trigger's predicate and
572
+ * input mapping are code and never in the manifest.
573
+ */
574
+ export declare const PlatformTriggerManifest: Schema.Struct<{
575
+ readonly kind: Schema.Literal<"platform">;
576
+ readonly name: Schema.String;
577
+ readonly description: Schema.String;
578
+ readonly events: Schema.$Array<Schema.String>;
579
+ }>;
580
+ export type PlatformTriggerManifest = typeof PlatformTriggerManifest.Type;
569
581
  /**
570
582
  * A trigger of a kind this reader does not know, kept as written: a manifest a later SDK built
571
583
  * keeps its hash, and readers that present triggers drop it.
@@ -573,8 +585,8 @@ export type WebhookTriggerManifest = typeof WebhookTriggerManifest.Type;
573
585
  export declare const OtherTriggerManifest: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
574
586
  export type OtherTriggerManifest = typeof OtherTriggerManifest.Type;
575
587
  /**
576
- * A trigger of a workflow, by `kind`: `cron`, `action`, `webhook`, or a kind this reader keeps
577
- * without knowing.
588
+ * A trigger of a workflow, by `kind`: `cron`, `action`, `webhook`, `platform`, or a kind this
589
+ * reader keeps without knowing.
578
590
  */
579
591
  export declare const WorkflowTriggerManifest: Schema.Union<readonly [Schema.Struct<{
580
592
  readonly kind: Schema.Literal<"cron">;
@@ -640,6 +652,11 @@ export declare const WorkflowTriggerManifest: Schema.Union<readonly [Schema.Stru
640
652
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
641
653
  /** The key of the connection whose provider sends to the webhook, when declared. */
642
654
  readonly connection: Schema.optionalKey<Schema.String>;
655
+ }>, Schema.Struct<{
656
+ readonly kind: Schema.Literal<"platform">;
657
+ readonly name: Schema.String;
658
+ readonly description: Schema.String;
659
+ readonly events: Schema.$Array<Schema.String>;
643
660
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
644
661
  export type WorkflowTriggerManifest = typeof WorkflowTriggerManifest.Type;
645
662
  /** Whether a trigger is a cron trigger. */
@@ -648,6 +665,8 @@ export declare function isCronTrigger(trigger: WorkflowTriggerManifest): trigger
648
665
  export declare function isActionTrigger(trigger: WorkflowTriggerManifest): trigger is ActionTriggerManifest;
649
666
  /** Whether a trigger is a webhook trigger. */
650
667
  export declare function isWebhookTrigger(trigger: WorkflowTriggerManifest): trigger is WebhookTriggerManifest;
668
+ /** Whether a trigger is a platform trigger. */
669
+ export declare function isPlatformTrigger(trigger: WorkflowTriggerManifest): trigger is PlatformTriggerManifest;
651
670
  /**
652
671
  * A workflow, `defineOntology({ workflows })`: a durable process the ontology service runs as the
653
672
  * workflow's own service user holding `role`. Names are wire names; `input` is the JSON Schema of
@@ -723,6 +742,11 @@ export declare const WorkflowManifest: Schema.Struct<{
723
742
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
724
743
  /** The key of the connection whose provider sends to the webhook, when declared. */
725
744
  readonly connection: Schema.optionalKey<Schema.String>;
745
+ }>, Schema.Struct<{
746
+ readonly kind: Schema.Literal<"platform">;
747
+ readonly name: Schema.String;
748
+ readonly description: Schema.String;
749
+ readonly events: Schema.$Array<Schema.String>;
726
750
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
727
751
  /**
728
752
  * The action a trigger listed in `defineOntology({ triggers })` runs, in wire names: the
@@ -1522,6 +1546,11 @@ export declare const OntologyManifestWire: Schema.encodeKeys<Schema.Struct<{
1522
1546
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
1523
1547
  /** The key of the connection whose provider sends to the webhook, when declared. */
1524
1548
  readonly connection: Schema.optionalKey<Schema.String>;
1549
+ }>, Schema.Struct<{
1550
+ readonly kind: Schema.Literal<"platform">;
1551
+ readonly name: Schema.String;
1552
+ readonly description: Schema.String;
1553
+ readonly events: Schema.$Array<Schema.String>;
1525
1554
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
1526
1555
  /**
1527
1556
  * The action a trigger listed in `defineOntology({ triggers })` runs, in wire names: the
@@ -1829,6 +1858,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
1829
1858
  readonly input?: string | undefined;
1830
1859
  readonly verifyToken?: string | undefined;
1831
1860
  } | undefined;
1861
+ } | {
1862
+ readonly kind: "platform";
1863
+ readonly name: string;
1864
+ readonly description: string;
1865
+ readonly events: readonly string[];
1832
1866
  })[];
1833
1867
  readonly role: string;
1834
1868
  readonly action?: {
@@ -2215,6 +2249,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2215
2249
  readonly input?: string | undefined;
2216
2250
  readonly verifyToken?: string | undefined;
2217
2251
  } | undefined;
2252
+ } | {
2253
+ readonly kind: "platform";
2254
+ readonly name: string;
2255
+ readonly description: string;
2256
+ readonly events: readonly string[];
2218
2257
  })[];
2219
2258
  readonly role: string;
2220
2259
  readonly action?: {
@@ -2601,6 +2640,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2601
2640
  readonly input?: string | undefined;
2602
2641
  readonly verifyToken?: string | undefined;
2603
2642
  } | undefined;
2643
+ } | {
2644
+ readonly kind: "platform";
2645
+ readonly name: string;
2646
+ readonly description: string;
2647
+ readonly events: readonly string[];
2604
2648
  })[];
2605
2649
  readonly role: string;
2606
2650
  readonly action?: {
@@ -2987,6 +3031,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2987
3031
  readonly input?: string | undefined;
2988
3032
  readonly verifyToken?: string | undefined;
2989
3033
  } | undefined;
3034
+ } | {
3035
+ readonly kind: "platform";
3036
+ readonly name: string;
3037
+ readonly description: string;
3038
+ readonly events: readonly string[];
2990
3039
  })[];
2991
3040
  readonly role: string;
2992
3041
  readonly action?: {
@@ -3617,6 +3666,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3617
3666
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
3618
3667
  /** The key of the connection whose provider sends to the webhook, when declared. */
3619
3668
  readonly connection: Schema.optionalKey<Schema.String>;
3669
+ }>, Schema.Struct<{
3670
+ readonly kind: Schema.Literal<"platform">;
3671
+ readonly name: Schema.String;
3672
+ readonly description: Schema.String;
3673
+ readonly events: Schema.$Array<Schema.String>;
3620
3674
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
3621
3675
  /**
3622
3676
  * The action a trigger listed in `defineOntology({ triggers })` runs, in wire names: the
@@ -4153,6 +4207,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
4153
4207
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
4154
4208
  /** The key of the connection whose provider sends to the webhook, when declared. */
4155
4209
  readonly connection: Schema.optionalKey<Schema.String>;
4210
+ }>, Schema.Struct<{
4211
+ readonly kind: Schema.Literal<"platform">;
4212
+ readonly name: Schema.String;
4213
+ readonly description: Schema.String;
4214
+ readonly events: Schema.$Array<Schema.String>;
4156
4215
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
4157
4216
  /**
4158
4217
  * The action a trigger listed in `defineOntology({ triggers })` runs, in wire names: the
@@ -4452,6 +4511,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
4452
4511
  readonly input?: string | undefined;
4453
4512
  readonly verifyToken?: string | undefined;
4454
4513
  } | undefined;
4514
+ } | {
4515
+ readonly kind: "platform";
4516
+ readonly name: string;
4517
+ readonly description: string;
4518
+ readonly events: readonly string[];
4455
4519
  })[];
4456
4520
  readonly role: string;
4457
4521
  readonly action?: {
@@ -4838,6 +4902,11 @@ export declare const OntologyManifest: Schema.declareConstructor<{
4838
4902
  readonly input?: string | undefined;
4839
4903
  readonly verifyToken?: string | undefined;
4840
4904
  } | undefined;
4905
+ } | {
4906
+ readonly kind: "platform";
4907
+ readonly name: string;
4908
+ readonly description: string;
4909
+ readonly events: readonly string[];
4841
4910
  })[];
4842
4911
  readonly role: string;
4843
4912
  readonly action?: {
@@ -5230,6 +5299,11 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
5230
5299
  readonly input?: string | undefined;
5231
5300
  readonly verifyToken?: string | undefined;
5232
5301
  } | undefined;
5302
+ } | {
5303
+ readonly kind: "platform";
5304
+ readonly name: string;
5305
+ readonly description: string;
5306
+ readonly events: readonly string[];
5233
5307
  })[];
5234
5308
  readonly role: string;
5235
5309
  readonly action?: {
@@ -5616,6 +5690,11 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
5616
5690
  readonly input?: string | undefined;
5617
5691
  readonly verifyToken?: string | undefined;
5618
5692
  } | undefined;
5693
+ } | {
5694
+ readonly kind: "platform";
5695
+ readonly name: string;
5696
+ readonly description: string;
5697
+ readonly events: readonly string[];
5619
5698
  })[];
5620
5699
  readonly role: string;
5621
5700
  readonly action?: {
package/dist/manifest.js CHANGED
@@ -25,8 +25,8 @@ import { CHANNEL_PROVIDERS, DEFAULT_SIGN_IN_POLICY, isGuestBotCheckScheme, isGue
25
25
  * input as JSON Schema, the connections its steps call and its triggers, whose input is in wire form.
26
26
  * Within version 9, a property may have the type `list` with its `items` type: only the built-in
27
27
  * user's managed `roles`, which has no column.
28
- * Within version 9, triggers may also be `action` and `webhook` triggers; readers ignore kinds they
29
- * do not know.
28
+ * Within version 9, triggers may also be `action`, `webhook` and `platform` triggers; readers
29
+ * ignore kinds they do not know.
30
30
  * Version 10 adds the roles' `scopes`, written only when a role scopes some of its permissions: each
31
31
  * names the permission and its `where` in the wire form of a query, with `me` as `{ "$me": [] }`
32
32
  * and a path from it as `{ "$me": ["staff_member", "division"] }`. `permissions` still lists every
@@ -422,22 +422,34 @@ export const WebhookTriggerManifest = Schema.Struct({
422
422
  /** The key of the connection whose provider sends to the webhook, when declared. */
423
423
  connection: Schema.optionalKey(Schema.String),
424
424
  });
425
+ /**
426
+ * A platform trigger of a workflow: the ontology service starts the workflow for each event of the
427
+ * listed catalog types that the platform delivers for this workspace. The trigger's predicate and
428
+ * input mapping are code and never in the manifest.
429
+ */
430
+ export const PlatformTriggerManifest = Schema.Struct({
431
+ kind: Schema.Literal("platform"),
432
+ name: Schema.String,
433
+ description: Schema.String,
434
+ events: Schema.Array(Schema.String),
435
+ });
425
436
  /** The trigger kinds this reader knows. */
426
- const KNOWN_TRIGGER_KINDS = ["cron", "action", "webhook"];
437
+ const KNOWN_TRIGGER_KINDS = ["cron", "action", "webhook", "platform"];
427
438
  /**
428
439
  * A trigger of a kind this reader does not know, kept as written: a manifest a later SDK built
429
440
  * keeps its hash, and readers that present triggers drop it.
430
441
  */
431
442
  export const OtherTriggerManifest = Schema.Record(Schema.String, Schema.Json).check(Schema.makeFilter((value) => (typeof value.kind === "string" && !KNOWN_TRIGGER_KINDS.includes(value.kind)) ||
432
- "Expected a trigger of another kind than cron, action or webhook"));
443
+ "Expected a trigger of another kind than cron, action, webhook or platform"));
433
444
  /**
434
- * A trigger of a workflow, by `kind`: `cron`, `action`, `webhook`, or a kind this reader keeps
435
- * without knowing.
445
+ * A trigger of a workflow, by `kind`: `cron`, `action`, `webhook`, `platform`, or a kind this
446
+ * reader keeps without knowing.
436
447
  */
437
448
  export const WorkflowTriggerManifest = Schema.Union([
438
449
  CronTriggerManifest,
439
450
  ActionTriggerManifest,
440
451
  WebhookTriggerManifest,
452
+ PlatformTriggerManifest,
441
453
  OtherTriggerManifest,
442
454
  ]);
443
455
  /** Whether a trigger is a cron trigger. */
@@ -452,6 +464,10 @@ export function isActionTrigger(trigger) {
452
464
  export function isWebhookTrigger(trigger) {
453
465
  return trigger.kind === "webhook";
454
466
  }
467
+ /** Whether a trigger is a platform trigger. */
468
+ export function isPlatformTrigger(trigger) {
469
+ return trigger.kind === "platform";
470
+ }
455
471
  /**
456
472
  * A workflow, `defineOntology({ workflows })`: a durable process the ontology service runs as the
457
473
  * workflow's own service user holding `role`. Names are wire names; `input` is the JSON Schema of