@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.
@@ -518,6 +518,11 @@ export declare const MigrationPlan: Schema.Struct<{
518
518
  readonly input?: string | undefined;
519
519
  readonly verifyToken?: string | undefined;
520
520
  } | undefined;
521
+ } | {
522
+ readonly kind: "platform";
523
+ readonly name: string;
524
+ readonly description: string;
525
+ readonly events: readonly string[];
521
526
  })[];
522
527
  readonly role: string;
523
528
  readonly action?: {
@@ -904,6 +909,11 @@ export declare const MigrationPlan: Schema.Struct<{
904
909
  readonly input?: string | undefined;
905
910
  readonly verifyToken?: string | undefined;
906
911
  } | undefined;
912
+ } | {
913
+ readonly kind: "platform";
914
+ readonly name: string;
915
+ readonly description: string;
916
+ readonly events: readonly string[];
907
917
  })[];
908
918
  readonly role: string;
909
919
  readonly action?: {
@@ -1290,6 +1300,11 @@ export declare const MigrationPlan: Schema.Struct<{
1290
1300
  readonly input?: string | undefined;
1291
1301
  readonly verifyToken?: string | undefined;
1292
1302
  } | undefined;
1303
+ } | {
1304
+ readonly kind: "platform";
1305
+ readonly name: string;
1306
+ readonly description: string;
1307
+ readonly events: readonly string[];
1293
1308
  })[];
1294
1309
  readonly role: string;
1295
1310
  readonly action?: {
@@ -1676,6 +1691,11 @@ export declare const MigrationPlan: Schema.Struct<{
1676
1691
  readonly input?: string | undefined;
1677
1692
  readonly verifyToken?: string | undefined;
1678
1693
  } | undefined;
1694
+ } | {
1695
+ readonly kind: "platform";
1696
+ readonly name: string;
1697
+ readonly description: string;
1698
+ readonly events: readonly string[];
1679
1699
  })[];
1680
1700
  readonly role: string;
1681
1701
  readonly action?: {
@@ -2192,6 +2212,11 @@ export declare const MigrationPlan: Schema.Struct<{
2192
2212
  }>>;
2193
2213
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
2194
2214
  readonly connection: Schema.optionalKey<Schema.String>;
2215
+ }>, Schema.Struct<{
2216
+ readonly kind: Schema.Literal<"platform">;
2217
+ readonly name: Schema.String;
2218
+ readonly description: Schema.String;
2219
+ readonly events: Schema.$Array<Schema.String>;
2195
2220
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
2196
2221
  readonly action: Schema.optionalKey<Schema.Struct<{
2197
2222
  readonly entity: Schema.String;
@@ -2574,6 +2599,11 @@ export declare const MigrationPlan: Schema.Struct<{
2574
2599
  }>>;
2575
2600
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
2576
2601
  readonly connection: Schema.optionalKey<Schema.String>;
2602
+ }>, Schema.Struct<{
2603
+ readonly kind: Schema.Literal<"platform">;
2604
+ readonly name: Schema.String;
2605
+ readonly description: Schema.String;
2606
+ readonly events: Schema.$Array<Schema.String>;
2577
2607
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
2578
2608
  readonly action: Schema.optionalKey<Schema.Struct<{
2579
2609
  readonly entity: Schema.String;
@@ -2841,6 +2871,11 @@ export declare const MigrationPlan: Schema.Struct<{
2841
2871
  readonly input?: string | undefined;
2842
2872
  readonly verifyToken?: string | undefined;
2843
2873
  } | undefined;
2874
+ } | {
2875
+ readonly kind: "platform";
2876
+ readonly name: string;
2877
+ readonly description: string;
2878
+ readonly events: readonly string[];
2844
2879
  })[];
2845
2880
  readonly role: string;
2846
2881
  readonly action?: {
@@ -3227,6 +3262,11 @@ export declare const MigrationPlan: Schema.Struct<{
3227
3262
  readonly input?: string | undefined;
3228
3263
  readonly verifyToken?: string | undefined;
3229
3264
  } | undefined;
3265
+ } | {
3266
+ readonly kind: "platform";
3267
+ readonly name: string;
3268
+ readonly description: string;
3269
+ readonly events: readonly string[];
3230
3270
  })[];
3231
3271
  readonly role: string;
3232
3272
  readonly action?: {
@@ -35,6 +35,7 @@ export function planMigration(input) {
35
35
  const draft = {
36
36
  before: [],
37
37
  catalog: [],
38
+ beforeDrops: [],
38
39
  drops: [],
39
40
  renames: [],
40
41
  indexDrops: [],
@@ -300,6 +301,7 @@ export function planMigration(input) {
300
301
  steps: [
301
302
  ...draft.before,
302
303
  ...draft.catalog,
304
+ ...draft.beforeDrops,
303
305
  ...draft.drops,
304
306
  ...draft.renames,
305
307
  ...draft.indexDrops,
@@ -328,6 +330,24 @@ function builtInValues(entity, property) {
328
330
  ]
329
331
  : [];
330
332
  }
333
+ /** Fill the new field while the previous manifest's columns still exist, even with allowDrops. */
334
+ function chatDescriptionBackfill(current) {
335
+ if (current.id !== "ent_agent_chat") {
336
+ return undefined;
337
+ }
338
+ const previous = new Set(current.properties.map(({ name }) => name));
339
+ const usage = previous.has("when_to_use") ? "when_to_use" : "whenToUse";
340
+ const columns = ["purpose", usage].filter((name) => previous.has(name)).map(quoteIdentifier);
341
+ if (columns.length === 0) {
342
+ return undefined;
343
+ }
344
+ const values = columns.map((column) => `NULLIF(${column}, '')`);
345
+ const [purpose, guidance] = values;
346
+ const merged = guidance ? `concat_ws(' ', ${purpose}, NULLIF(${guidance}, ${purpose}))` : purpose;
347
+ const hasText = values.map((value) => `${value} IS NOT NULL`).join(" OR ");
348
+ return (`UPDATE ${quoteIdentifier(tableName(current.name))} SET "description" = NULLIF(${merged}, '') ` +
349
+ `WHERE ${hasText}`);
350
+ }
331
351
  /**
332
352
  * A deploy that drops a browser sign-in method is refused while an active member would lose access:
333
353
  * every established email member needs a SegmentStream identity to drop email, and every member with
@@ -1826,7 +1846,9 @@ function planEntityChanges(input) {
1826
1846
  `ADD COLUMN ${columnDefinition(column)}`,
1827
1847
  ...(check === undefined ? [] : [`ADD ${constraintDefinition(check)}`]),
1828
1848
  ];
1829
- draft.additions.push(step({
1849
+ const backfill = property.name === "description" ? chatDescriptionBackfill(pair.current) : undefined;
1850
+ const phase = backfill ? draft.beforeDrops : draft.additions;
1851
+ phase.push(step({
1830
1852
  kind: "addProperty",
1831
1853
  classification: "additive",
1832
1854
  validatesData: column.notNull && column.default === undefined,
@@ -1835,6 +1857,7 @@ function planEntityChanges(input) {
1835
1857
  ...(enumStorage === undefined ? [] : [createEnumStatement(enumStorage)]),
1836
1858
  alterTable(table, actions.join(", ")),
1837
1859
  ...builtInValues(entity, property.name),
1860
+ ...(backfill ? [backfill] : []),
1838
1861
  ],
1839
1862
  }));
1840
1863
  }
@@ -0,0 +1,74 @@
1
+ import { Schema } from "effect";
2
+ /**
3
+ * The catalog of platform events: what the platform recorded for a workspace that a platform
4
+ * trigger, `platform(name, { events })`, starts a workflow for. The platform decides which exist.
5
+ * An event carries ids and codes, never text: the console and the CLI explain them by the same
6
+ * ids. It names no workspace or organization, since it is delivered only to the workspace it is
7
+ * about. A type gains fields compatibly; a change to a field is a new type.
8
+ */
9
+ export declare const PLATFORM_EVENT_TYPES: readonly ["deployment.succeeded", "deployment.failed"];
10
+ export type PlatformEventType = (typeof PLATFORM_EVENT_TYPES)[number];
11
+ /** Who sends an event type: backend-next for deployments. */
12
+ export type PlatformEventSender = "platform";
13
+ export declare const PLATFORM_EVENT_SENDERS: Readonly<Record<PlatformEventType, PlatformEventSender>>;
14
+ /** Whether a value names a type of this SDK's catalog. */
15
+ export declare function isPlatformEventType(value: unknown): value is PlatformEventType;
16
+ /** A production deployment of the workspace became the serving deployment. */
17
+ export declare const DeploymentSucceededEvent: Schema.Struct<{
18
+ /** Derived from the type and the deployment, so every delivery of this outcome carries it. */
19
+ readonly id: Schema.String;
20
+ readonly type: Schema.Literal<"deployment.succeeded">;
21
+ /** When the outcome was recorded, ISO 8601. */
22
+ readonly at: Schema.String;
23
+ readonly deployment: Schema.Struct<{
24
+ readonly id: Schema.String;
25
+ readonly commit: Schema.NullOr<Schema.String>;
26
+ }>;
27
+ }>;
28
+ /** The deployment workflow recorded a failure of a production deployment of the workspace. */
29
+ export declare const DeploymentFailedEvent: Schema.Struct<{
30
+ readonly id: Schema.String;
31
+ readonly type: Schema.Literal<"deployment.failed">;
32
+ readonly at: Schema.String;
33
+ readonly deployment: Schema.Struct<{
34
+ readonly id: Schema.String;
35
+ readonly commit: Schema.NullOr<Schema.String>;
36
+ }>;
37
+ readonly failure: Schema.Struct<{
38
+ /** A code of the deployment failure catalog, such as `ontology_migration_refused`. */
39
+ readonly code: Schema.String;
40
+ /** The `dep_…` reference the console and the CLI show with the full explanation. */
41
+ readonly reference: Schema.String;
42
+ }>;
43
+ }>;
44
+ /** Any event of the catalog, by `type`. Fields a later platform adds are ignored. */
45
+ export declare const PlatformEvent: Schema.Union<readonly [Schema.Struct<{
46
+ /** Derived from the type and the deployment, so every delivery of this outcome carries it. */
47
+ readonly id: Schema.String;
48
+ readonly type: Schema.Literal<"deployment.succeeded">;
49
+ /** When the outcome was recorded, ISO 8601. */
50
+ readonly at: Schema.String;
51
+ readonly deployment: Schema.Struct<{
52
+ readonly id: Schema.String;
53
+ readonly commit: Schema.NullOr<Schema.String>;
54
+ }>;
55
+ }>, Schema.Struct<{
56
+ readonly id: Schema.String;
57
+ readonly type: Schema.Literal<"deployment.failed">;
58
+ readonly at: Schema.String;
59
+ readonly deployment: Schema.Struct<{
60
+ readonly id: Schema.String;
61
+ readonly commit: Schema.NullOr<Schema.String>;
62
+ }>;
63
+ readonly failure: Schema.Struct<{
64
+ /** A code of the deployment failure catalog, such as `ontology_migration_refused`. */
65
+ readonly code: Schema.String;
66
+ /** The `dep_…` reference the console and the CLI show with the full explanation. */
67
+ readonly reference: Schema.String;
68
+ }>;
69
+ }>]>;
70
+ export type PlatformEvent = typeof PlatformEvent.Type;
71
+ /** The event of one catalog type. */
72
+ export type PlatformEventOf<T extends PlatformEventType> = Extract<PlatformEvent, {
73
+ readonly type: T;
74
+ }>;
@@ -0,0 +1,46 @@
1
+ import { Schema } from "effect";
2
+ /**
3
+ * The catalog of platform events: what the platform recorded for a workspace that a platform
4
+ * trigger, `platform(name, { events })`, starts a workflow for. The platform decides which exist.
5
+ * An event carries ids and codes, never text: the console and the CLI explain them by the same
6
+ * ids. It names no workspace or organization, since it is delivered only to the workspace it is
7
+ * about. A type gains fields compatibly; a change to a field is a new type.
8
+ */
9
+ export const PLATFORM_EVENT_TYPES = ["deployment.succeeded", "deployment.failed"];
10
+ export const PLATFORM_EVENT_SENDERS = {
11
+ "deployment.succeeded": "platform",
12
+ "deployment.failed": "platform",
13
+ };
14
+ /** Whether a value names a type of this SDK's catalog. */
15
+ export function isPlatformEventType(value) {
16
+ return (typeof value === "string" && PLATFORM_EVENT_TYPES.includes(value));
17
+ }
18
+ /** The deployment an event is about: its id, and its commit SHA, `null` for an upload without Git. */
19
+ const EventDeployment = Schema.Struct({
20
+ id: Schema.String,
21
+ commit: Schema.NullOr(Schema.String),
22
+ });
23
+ /** A production deployment of the workspace became the serving deployment. */
24
+ export const DeploymentSucceededEvent = Schema.Struct({
25
+ /** Derived from the type and the deployment, so every delivery of this outcome carries it. */
26
+ id: Schema.String,
27
+ type: Schema.Literal("deployment.succeeded"),
28
+ /** When the outcome was recorded, ISO 8601. */
29
+ at: Schema.String,
30
+ deployment: EventDeployment,
31
+ });
32
+ /** The deployment workflow recorded a failure of a production deployment of the workspace. */
33
+ export const DeploymentFailedEvent = Schema.Struct({
34
+ id: Schema.String,
35
+ type: Schema.Literal("deployment.failed"),
36
+ at: Schema.String,
37
+ deployment: EventDeployment,
38
+ failure: Schema.Struct({
39
+ /** A code of the deployment failure catalog, such as `ontology_migration_refused`. */
40
+ code: Schema.String,
41
+ /** The `dep_…` reference the console and the CLI show with the full explanation. */
42
+ reference: Schema.String,
43
+ }),
44
+ });
45
+ /** Any event of the catalog, by `type`. Fields a later platform adds are ignored. */
46
+ export const PlatformEvent = Schema.Union([DeploymentSucceededEvent, DeploymentFailedEvent]);
@@ -107,6 +107,17 @@ const DRAFT_CONTENT_FIELDS = [
107
107
  function nullableText(value) {
108
108
  return value === null || value === undefined ? null : String(value);
109
109
  }
110
+ /** @legacy agent.chat-description: an older agent requires both former keys on the wire. */
111
+ function chatRegistryResponse(chat) {
112
+ const description = nullableText(chat.description);
113
+ return {
114
+ id: String(chat.id),
115
+ title: String(chat.title),
116
+ description,
117
+ purpose: null,
118
+ whenToUse: description,
119
+ };
120
+ }
110
121
  function pairingOf(row) {
111
122
  return {
112
123
  id: String(row.id),
@@ -731,8 +742,7 @@ export function sqlAgentStore(ontology, sql) {
731
742
  // and the old one is deleted.
732
743
  const kept = {};
733
744
  for (const key of [
734
- "purpose",
735
- "when_to_use",
745
+ "description",
736
746
  "agent_persona",
737
747
  "persona_changed_at",
738
748
  "group_access",
@@ -833,12 +843,7 @@ export function sqlAgentStore(ontology, sql) {
833
843
  // link again when they write after the agent is back.
834
844
  yield* releaseMembers(String(chat.id));
835
845
  }
836
- return {
837
- id: String(chat.id),
838
- title: String(chat.title),
839
- purpose: nullableText(chat.purpose),
840
- whenToUse: nullableText(chat.when_to_use),
841
- };
846
+ return chatRegistryResponse(chat);
842
847
  }))
843
848
  .pipe(Effect.orDie),
844
849
  seeInboxChat: (input) => Effect.gen(function* () {
@@ -950,10 +955,7 @@ export function sqlAgentStore(ontology, sql) {
950
955
  });
951
956
  }
952
957
  return {
953
- id: String(chat.id),
954
- title: String(chat.title),
955
- purpose: nullableText(chat.purpose),
956
- whenToUse: nullableText(chat.when_to_use),
958
+ ...chatRegistryResponse(chat),
957
959
  // A member of staff took the chat over, or the agent handed the person over to staff:
958
960
  // the agent records the person and answers none.
959
961
  ...(((chat.handled_by_id ?? null) !== null || (chat.handoff_at ?? null) !== null) &&
@@ -1067,12 +1069,7 @@ export function sqlAgentStore(ontology, sql) {
1067
1069
  values: { last_message_at: now.toISOString() },
1068
1070
  })
1069
1071
  : found;
1070
- return {
1071
- id: String(chat.id),
1072
- title: String(chat.title),
1073
- purpose: nullableText(chat.purpose),
1074
- whenToUse: nullableText(chat.when_to_use),
1075
- };
1072
+ return chatRegistryResponse(chat);
1076
1073
  }));
1077
1074
  }).pipe(Effect.orDie),
1078
1075
  holdReply: (input) => hold(input.key, input.memberId, () => Effect.succeed({ kind: "reply", reply: input })).pipe(Effect.map((held) => (held === "discarded" ? undefined : held))),
@@ -0,0 +1,42 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { PlatformEvent, type PlatformEventSender } from "../platform-events.js";
3
+ /** A platform trigger the events route can start: the workflow's own, with its functions. */
4
+ export interface PlatformTriggerTarget {
5
+ /** The workflow's wire name. */
6
+ readonly workflow: string;
7
+ /** `<workflow>.<trigger>`, in wire names. */
8
+ readonly trigger: string;
9
+ /** The catalog types that start it. */
10
+ readonly events: ReadonlyArray<string>;
11
+ readonly when: ((event: PlatformEvent) => boolean) | undefined;
12
+ readonly input: ((event: PlatformEvent) => unknown) | undefined;
13
+ /** The workflow's input codec, TypeScript names on the type side and wire names encoded. */
14
+ readonly codec: Schema.Top;
15
+ }
16
+ /** Why a trigger an event matched starts no run, when its own code is at fault. */
17
+ export type PlatformTriggerFailure = "trigger_function_failed" | "trigger_input_invalid";
18
+ /** What one trigger does with one event. */
19
+ export type PlatformTriggerOutcome = {
20
+ readonly start: true;
21
+ readonly input: unknown;
22
+ } | {
23
+ readonly start: false;
24
+ } | {
25
+ readonly start: false;
26
+ readonly failed: PlatformTriggerFailure;
27
+ readonly cause: unknown;
28
+ };
29
+ /**
30
+ * The event a sender delivered, decoded with this SDK's catalog. Fields a later platform adds are
31
+ * ignored; an unknown type or a missing field is `undefined`.
32
+ */
33
+ export declare function decodePlatformEvent(value: unknown): PlatformEvent | undefined;
34
+ /** Whether a sender may deliver an event of this type: each sends only what it records. */
35
+ export declare function maySend(sender: PlatformEventSender, event: PlatformEvent): boolean;
36
+ /**
37
+ * Runs a trigger's `when` and `input` on an event, as an action trigger's run on an action: both
38
+ * synchronous workspace code. The input comes back in the workflow input's wire form, validated as
39
+ * a start decodes it. A function that throws, a `when` that is not a boolean and an input the
40
+ * workflow does not accept are the trigger's own failures, which skip it and nothing else.
41
+ */
42
+ export declare function evaluatePlatformTrigger(target: PlatformTriggerTarget, event: PlatformEvent): Effect.Effect<PlatformTriggerOutcome>;
@@ -0,0 +1,67 @@
1
+ import { Effect, Result, Schema } from "effect";
2
+ import { PLATFORM_EVENT_SENDERS, PlatformEvent, } from "../platform-events.js";
3
+ import { validate } from "./validation.js";
4
+ /**
5
+ * The event a sender delivered, decoded with this SDK's catalog. Fields a later platform adds are
6
+ * ignored; an unknown type or a missing field is `undefined`.
7
+ */
8
+ export function decodePlatformEvent(value) {
9
+ const decoded = Schema.decodeUnknownResult(PlatformEvent)(value, {
10
+ errors: "all",
11
+ onExcessProperty: "ignore",
12
+ });
13
+ return Result.isSuccess(decoded) ? decoded.success : undefined;
14
+ }
15
+ /** Whether a sender may deliver an event of this type: each sends only what it records. */
16
+ export function maySend(sender, event) {
17
+ return PLATFORM_EVENT_SENDERS[event.type] === sender;
18
+ }
19
+ /**
20
+ * Runs a trigger's `when` and `input` on an event, as an action trigger's run on an action: both
21
+ * synchronous workspace code. The input comes back in the workflow input's wire form, validated as
22
+ * a start decodes it. A function that throws, a `when` that is not a boolean and an input the
23
+ * workflow does not accept are the trigger's own failures, which skip it and nothing else.
24
+ */
25
+ export function evaluatePlatformTrigger(target, event) {
26
+ return Effect.gen(function* () {
27
+ if (target.when !== undefined) {
28
+ let fires;
29
+ try {
30
+ fires = target.when(event);
31
+ }
32
+ catch (cause) {
33
+ return { start: false, failed: "trigger_function_failed", cause };
34
+ }
35
+ if (typeof fires !== "boolean") {
36
+ return {
37
+ start: false,
38
+ failed: "trigger_function_failed",
39
+ cause: new TypeError(`when returned ${typeof fires}, not a boolean.`),
40
+ };
41
+ }
42
+ if (!fires) {
43
+ return { start: false };
44
+ }
45
+ }
46
+ let mapped;
47
+ try {
48
+ mapped = target.input === undefined ? {} : target.input(event);
49
+ }
50
+ catch (cause) {
51
+ return { start: false, failed: "trigger_function_failed", cause };
52
+ }
53
+ const encoded = yield* Schema.encodeUnknownEffect(target.codec)(mapped, { errors: "all", onExcessProperty: "error" }).pipe(Effect.result);
54
+ if (Result.isFailure(encoded)) {
55
+ return { start: false, failed: "trigger_input_invalid", cause: encoded.failure };
56
+ }
57
+ const decoded = validate(target.codec, encoded.success);
58
+ if (!decoded.ok) {
59
+ return {
60
+ start: false,
61
+ failed: "trigger_input_invalid",
62
+ cause: new TypeError(decoded.issues.map((issue) => issue.message).join("; ")),
63
+ };
64
+ }
65
+ return { start: true, input: JSON.parse(JSON.stringify(encoded.success)) };
66
+ });
67
+ }
@@ -590,6 +590,8 @@ export declare class IdentityInUse extends IdentityInUse_base {
590
590
  export interface SeenChat {
591
591
  readonly id: string;
592
592
  readonly title: string;
593
+ readonly description: string | null;
594
+ /** @legacy agent.chat-description: accepted by agents predating description. */
593
595
  readonly purpose: string | null;
594
596
  readonly whenToUse: string | null;
595
597
  /**
@@ -694,7 +696,7 @@ export interface AgentStore {
694
696
  * member, and unlinks `leftMemberId`, a member who left, when linked. With `agentLeft`, the agent
695
697
  * itself left the chat: every member is unlinked, and the chat stays. With `migratedFrom`, the
696
698
  * chat had that id before it became a supergroup: its record moves to `externalId`, or, when both
697
- * ids have one, the new record takes the old one's members, and its purpose and when to use where
699
+ * ids have one, the new record takes the old one's members, and its description where
698
700
  * it has none. Concurrent calls for one chat leave one record.
699
701
  */
700
702
  readonly claimChatPersonaNotice?: (id: string, memberId: string) => Effect.Effect<boolean>;
@@ -660,6 +660,11 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
660
660
  }>>;
661
661
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
662
662
  readonly connection: Schema.optionalKey<Schema.String>;
663
+ }>, Schema.Struct<{
664
+ readonly kind: Schema.Literal<"platform">;
665
+ readonly name: Schema.String;
666
+ readonly description: Schema.String;
667
+ readonly events: Schema.$Array<Schema.String>;
663
668
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
664
669
  readonly action: Schema.optionalKey<Schema.Struct<{
665
670
  readonly entity: Schema.String;
@@ -1057,6 +1062,11 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
1057
1062
  }>>;
1058
1063
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
1059
1064
  readonly connection: Schema.optionalKey<Schema.String>;
1065
+ }>, Schema.Struct<{
1066
+ readonly kind: Schema.Literal<"platform">;
1067
+ readonly name: Schema.String;
1068
+ readonly description: Schema.String;
1069
+ readonly events: Schema.$Array<Schema.String>;
1060
1070
  }>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
1061
1071
  readonly action: Schema.optionalKey<Schema.Struct<{
1062
1072
  readonly entity: Schema.String;
@@ -651,6 +651,13 @@ export function createOntologyService(ontology, config) {
651
651
  if (parts[1] === "api" && parts[2] === "ontology" && entity !== undefined) {
652
652
  return `/api/ontology/${entity.name}/*`;
653
653
  }
654
+ if (parts[1] === "api" &&
655
+ parts[2] === "ontology" &&
656
+ parts[3] === "workflows" &&
657
+ parts[4] === "events" &&
658
+ parts.length === 5) {
659
+ return "/api/ontology/workflows/events";
660
+ }
654
661
  if (parts[1] === "api" && parts[2] === "ontology" && parts[3] === "workflows") {
655
662
  const workflow = ontology.workflows.find((item) => item.name === parts[4]);
656
663
  if (workflow) {
@@ -230,6 +230,8 @@ export declare function scheduledMinute(expression: string, now: Date): string;
230
230
  export declare function triggerPath(workflow: string, trigger: string): string;
231
231
  /** The route Vercel calls every five minutes when the manifest declares an action trigger. */
232
232
  export declare const SWEEP_PATH = "/api/ontology/workflows/sweep";
233
+ /** The route the platform delivers a platform event about this workspace to. */
234
+ export declare const PLATFORM_EVENTS_PATH = "/api/ontology/workflows/events";
233
235
  /**
234
236
  * The workflow routes and the in-process binding of workflow runs:
235
237
  *