@segmentstream/ontology 0.207.0 → 0.209.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?: {
@@ -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]);
@@ -1,9 +1,16 @@
1
1
  import { Effect } from "effect";
2
2
  import type { SqlClient } from "effect/unstable/sql";
3
3
  import type { AgentLimits, AgentLimitScope, AgentResolution, ResolveIdentityInput } from "../service/runtime-contract.js";
4
- /** Defaults shared by bot resolution and other trusted channel admission boundaries. */
4
+ /**
5
+ * The limits that apply where the agent sets none, shared by bot resolution and other trusted
6
+ * channel admission boundaries. `newUsersPerHour` is the agent's `signUpsPerHour`, under the name
7
+ * the protocol keeps.
8
+ */
5
9
  export declare const DEFAULT_AGENT_LIMITS: AgentLimits;
6
- /** Platform ceilings. Workspace policy can only lower these values. */
10
+ /**
11
+ * Platform ceilings. A limit on one person can only be lowered: its ceiling is its default. A
12
+ * limit on the whole workspace may be raised up to its ceiling.
13
+ */
7
14
  export declare const PLATFORM_CHANNEL_LIMITS: AgentLimits;
8
15
  /**
9
16
  * Ceilings of the guests' daily model cost, in US dollars. Unlike the turn limits they have no
@@ -20,6 +27,7 @@ export declare const GUEST_USD_CEILINGS: Readonly<{
20
27
  export declare const GUEST_USD_UNIT = 0.0001;
21
28
  /** The most one usage report may add, in US dollars; a turn costing more is counted at this. */
22
29
  export declare const MAX_GUEST_USAGE_REPORT_USD = 100;
30
+ /** The agent's limits within the platform's ceilings; the default for each it leaves out. */
23
31
  export declare function clampChannelLimits(input: ResolveIdentityInput["limits"]): AgentLimits;
24
32
  /**
25
33
  * Only trusted runtimes submit limits; channel-app callers omit them and reuse the latest policy.
@@ -1,15 +1,30 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { Effect, Schema } from "effect";
3
3
  import { AGENT_COUNTERS_TABLE, CHANNEL_LIMITS_TABLE } from "../migrate/storage.js";
4
- /** Defaults shared by bot resolution and other trusted channel admission boundaries. */
4
+ /**
5
+ * The limits that apply where the agent sets none, shared by bot resolution and other trusted
6
+ * channel admission boundaries. `newUsersPerHour` is the agent's `signUpsPerHour`, under the name
7
+ * the protocol keeps.
8
+ */
5
9
  export const DEFAULT_AGENT_LIMITS = Object.freeze({
6
10
  perSender: Object.freeze({ turnsPerMinute: 6, turnsPerDay: 80 }),
7
11
  newUsersPerHour: 30,
8
12
  workspaceTurnsPerDay: 3000,
9
13
  guest: Object.freeze({ turnsPerDay: 20, workspaceTurnsPerDay: 1000 }),
10
14
  });
11
- /** Platform ceilings. Workspace policy can only lower these values. */
12
- export const PLATFORM_CHANNEL_LIMITS = DEFAULT_AGENT_LIMITS;
15
+ /**
16
+ * Platform ceilings. A limit on one person can only be lowered: its ceiling is its default. A
17
+ * limit on the whole workspace may be raised up to its ceiling.
18
+ */
19
+ export const PLATFORM_CHANNEL_LIMITS = Object.freeze({
20
+ perSender: DEFAULT_AGENT_LIMITS.perSender,
21
+ newUsersPerHour: 1000,
22
+ workspaceTurnsPerDay: 100_000,
23
+ guest: Object.freeze({
24
+ turnsPerDay: DEFAULT_AGENT_LIMITS.guest.turnsPerDay,
25
+ workspaceTurnsPerDay: 100_000,
26
+ }),
27
+ });
13
28
  /**
14
29
  * Ceilings of the guests' daily model cost, in US dollars. Unlike the turn limits they have no
15
30
  * default: a cap the agent does not set does not apply.
@@ -41,20 +56,21 @@ function clampUsd(value, ceiling) {
41
56
  ? Math.min(value, ceiling)
42
57
  : undefined;
43
58
  }
59
+ /** The agent's limits within the platform's ceilings; the default for each it leaves out. */
44
60
  export function clampChannelLimits(input) {
45
- const clamp = (value, ceiling) => Number.isSafeInteger(value) && value > 0 ? Math.min(value, ceiling) : ceiling;
61
+ const clamp = (value, fallback, ceiling) => Number.isSafeInteger(value) && value > 0 ? Math.min(value, ceiling) : fallback;
46
62
  const usdPerDay = clampUsd(input?.guest?.usdPerDay, GUEST_USD_CEILINGS.usdPerDay);
47
63
  const workspaceUsdPerDay = clampUsd(input?.guest?.workspaceUsdPerDay, GUEST_USD_CEILINGS.workspaceUsdPerDay);
48
64
  return {
49
65
  perSender: {
50
- turnsPerMinute: clamp(input?.perSender?.turnsPerMinute, PLATFORM_CHANNEL_LIMITS.perSender.turnsPerMinute),
51
- turnsPerDay: clamp(input?.perSender?.turnsPerDay, PLATFORM_CHANNEL_LIMITS.perSender.turnsPerDay),
66
+ turnsPerMinute: clamp(input?.perSender?.turnsPerMinute, DEFAULT_AGENT_LIMITS.perSender.turnsPerMinute, PLATFORM_CHANNEL_LIMITS.perSender.turnsPerMinute),
67
+ turnsPerDay: clamp(input?.perSender?.turnsPerDay, DEFAULT_AGENT_LIMITS.perSender.turnsPerDay, PLATFORM_CHANNEL_LIMITS.perSender.turnsPerDay),
52
68
  },
53
- newUsersPerHour: clamp(input?.newUsersPerHour, PLATFORM_CHANNEL_LIMITS.newUsersPerHour),
54
- workspaceTurnsPerDay: clamp(input?.workspaceTurnsPerDay, PLATFORM_CHANNEL_LIMITS.workspaceTurnsPerDay),
69
+ newUsersPerHour: clamp(input?.newUsersPerHour, DEFAULT_AGENT_LIMITS.newUsersPerHour, PLATFORM_CHANNEL_LIMITS.newUsersPerHour),
70
+ workspaceTurnsPerDay: clamp(input?.workspaceTurnsPerDay, DEFAULT_AGENT_LIMITS.workspaceTurnsPerDay, PLATFORM_CHANNEL_LIMITS.workspaceTurnsPerDay),
55
71
  guest: {
56
- turnsPerDay: clamp(input?.guest?.turnsPerDay, PLATFORM_CHANNEL_LIMITS.guest.turnsPerDay),
57
- workspaceTurnsPerDay: clamp(input?.guest?.workspaceTurnsPerDay, PLATFORM_CHANNEL_LIMITS.guest.workspaceTurnsPerDay),
72
+ turnsPerDay: clamp(input?.guest?.turnsPerDay, DEFAULT_AGENT_LIMITS.guest.turnsPerDay, PLATFORM_CHANNEL_LIMITS.guest.turnsPerDay),
73
+ workspaceTurnsPerDay: clamp(input?.guest?.workspaceTurnsPerDay, DEFAULT_AGENT_LIMITS.guest.workspaceTurnsPerDay, PLATFORM_CHANNEL_LIMITS.guest.workspaceTurnsPerDay),
58
74
  ...(usdPerDay === undefined ? {} : { usdPerDay }),
59
75
  ...(workspaceUsdPerDay === undefined ? {} : { workspaceUsdPerDay }),
60
76
  },
@@ -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
+ }
@@ -29,7 +29,8 @@ export declare const PairingRequest: Schema.Struct<{
29
29
  readonly display: Schema.optionalKey<Schema.NullOr<Schema.String>>;
30
30
  }>;
31
31
  /**
32
- * The agent's limits, as it sends them with a turn: each can only lower the platform's ceiling.
32
+ * The agent's limits, as it sends them with a turn, each within the platform's ceiling
33
+ * (`PLATFORM_CHANNEL_LIMITS`). `newUsersPerHour` is the agent's `signUpsPerHour`.
33
34
  * `guest` limits guests' turns, apart from those of people who signed up, and, when the agent sets
34
35
  * them, the model cost of each guest's turns and of every guest's together each day.
35
36
  */
@@ -56,7 +56,8 @@ function usdCap(ceiling) {
56
56
  return Schema.Number.check(Schema.isFinite(), Schema.isGreaterThan(0), Schema.isLessThanOrEqualTo(ceiling));
57
57
  }
58
58
  /**
59
- * The agent's limits, as it sends them with a turn: each can only lower the platform's ceiling.
59
+ * The agent's limits, as it sends them with a turn, each within the platform's ceiling
60
+ * (`PLATFORM_CHANNEL_LIMITS`). `newUsersPerHour` is the agent's `signUpsPerHour`.
60
61
  * `guest` limits guests' turns, apart from those of people who signed up, and, when the agent sets
61
62
  * them, the model cost of each guest's turns and of every guest's together each day.
62
63
  */
@@ -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
  *