@segmentstream/ontology 0.106.3 → 0.107.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +38 -8
  3. package/dist/analyze.d.ts +7 -1
  4. package/dist/analyze.js +237 -13
  5. package/dist/authoring.js +6 -0
  6. package/dist/diagnostics.d.ts +3 -3
  7. package/dist/diagnostics.js +1 -0
  8. package/dist/index.d.ts +6 -6
  9. package/dist/index.js +5 -3
  10. package/dist/manifest.d.ts +69 -1
  11. package/dist/manifest.js +51 -4
  12. package/dist/migrate/apply.js +8 -1
  13. package/dist/migrate/model.d.ts +32 -0
  14. package/dist/migrate/storage.d.ts +2 -0
  15. package/dist/migrate/storage.js +8 -0
  16. package/dist/names.d.ts +5 -0
  17. package/dist/names.js +5 -0
  18. package/dist/ontology.d.ts +4 -1
  19. package/dist/permissions.d.ts +30 -2
  20. package/dist/permissions.js +51 -6
  21. package/dist/runtime/agent-counters.d.ts +5 -1
  22. package/dist/runtime/agent-counters.js +21 -6
  23. package/dist/runtime/agent-web.d.ts +9 -6
  24. package/dist/runtime/agent-web.js +101 -5
  25. package/dist/runtime/generated-actions.js +2 -3
  26. package/dist/runtime/guests.d.ts +32 -0
  27. package/dist/runtime/guests.js +64 -0
  28. package/dist/runtime/new-user-hook.js +2 -1
  29. package/dist/runtime/oauth.js +7 -1
  30. package/dist/runtime/pipeline.js +3 -2
  31. package/dist/runtime/principals.js +6 -4
  32. package/dist/runtime/sql-runtime.js +2 -1
  33. package/dist/runtime.d.ts +10 -2
  34. package/dist/service/agent/authentication.d.ts +6 -4
  35. package/dist/service/agent/authentication.js +20 -5
  36. package/dist/service/agent/protocol.d.ts +28 -2
  37. package/dist/service/agent/protocol.js +23 -10
  38. package/dist/service/agent/server.d.ts +9 -2
  39. package/dist/service/agent/server.js +12 -12
  40. package/dist/service/agent/tasks.d.ts +3 -0
  41. package/dist/service/agent/tasks.js +5 -3
  42. package/dist/service/agent/web-tokens.d.ts +28 -13
  43. package/dist/service/agent/web-tokens.js +91 -38
  44. package/dist/service/authentication.d.ts +6 -0
  45. package/dist/service/authentication.js +11 -2
  46. package/dist/service/chat/review-delivery.js +4 -0
  47. package/dist/service/mcp/server.js +3 -3
  48. package/dist/service/mcp/tools.d.ts +4 -2
  49. package/dist/service/mcp/tools.js +14 -2
  50. package/dist/service/oauth/protocol.js +8 -2
  51. package/dist/service/oauth/server.js +5 -1
  52. package/dist/service/runtime-contract.d.ts +58 -6
  53. package/dist/service/schemas.d.ts +8 -0
  54. package/dist/service/service.js +15 -4
  55. package/dist/sign-in.d.ts +58 -9
  56. package/dist/sign-in.js +87 -9
  57. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.107.0
4
+
5
+ The agent's own tools are permissions: `agent_tool:sandbox` (the sandbox's shell and file tools,
6
+ staging files into it and file-argument ontology calls) and `agent_tool:web` (reading the web
7
+ domains the agent's configuration lists). A role, `member` or a sign-up role grants them by name,
8
+ or all of them with `agent_tool:*`; no wildcard does, `*:*` included, nor a pipeline workload's
9
+ `*:*`. `check` refuses any other verb of `agent_tool`, a scoped grant of it, and an entity or a
10
+ toolset named `agent_tool`.
11
+
12
+ Wherever the ontology tells the agent whom it acts for, its answer names the tools that caller's
13
+ current roles grant in `agent_tools`: identity lookup and admission, agent token introspection, and
14
+ the current task's user.
15
+
16
+ Action required: name the agent tools in the roles that may use them, such as
17
+ `member: { permissions: ["*:read", "agent_tool:sandbox"] }`, and leave them out of the roles of
18
+ people who sign up. While no role names an `agent_tool` permission, every caller keeps the sandbox
19
+ tools, as before, and `check` warns `agent-tools-implicit`. From 2027-02-15 an ontology whose roles
20
+ name none grants no agent tool.
21
+
22
+ Guests: `defineOntology({ guest: { channels: ["web"], origins, permissions } })` lets the visitors
23
+ of the declared websites talk to the app's agent without signing in or signing up, as the
24
+ counterpart of `member`. A guest is a session, not a user: `POST /api/ontology/agent/visitors`
25
+ from a declared website answers an agent token of a grant to `agent-web` that names no user, with
26
+ a refresh token, and chat `guest:<id>`; no user or identity is created. The guest stays the same,
27
+ in the same chat, while their browser renews the token, and ends after 30 days without a visit.
28
+ One network address may start 10 guests an hour, apart from the cap on new users.
29
+
30
+ Every guest holds the built-in role `guest` alone, with `guest.permissions`. `check` holds them to
31
+ the rules of sign-up roles, and refuses the built-in entities, scopes that name `me`, and
32
+ `agent_tool:sandbox` or `agent_tool:*`: a guest may hold `agent_tool:web`, never the sandbox. The
33
+ agent acting for a guest (`X-SegmentStream-Act-As: guest:<id>` with the token's grant) reaches only
34
+ `/mcp`, where `me`, member files and the chat archive are not offered, and what a guest creates is
35
+ created by nobody. In an action's handler `principal.kind` can now be `guest`. Introspection
36
+ answers a guest's token with `guest_id`, `roles`, `grant_id`, `chat` and `agent_tools`, the agent
37
+ tools `guest.permissions` grant (never the sandbox, never implicitly), and counts each of their
38
+ turns against the agent's new `limits.guest`, per guest and for every guest together, which the web
39
+ channel sends with each turn. `guest.permissions` decide nothing about whether the workspace names
40
+ agent tools: while no other role names one, staff keep the implicit sandbox.
41
+
42
+ `guest.origins` and `signUp.origins` accept a pattern whose leftmost label is `*`, such as
43
+ `https://*.example.com`, which matches one whole label; `websiteOrigin` and `matchesWebsite` check
44
+ them, and `guestOf` reads guests from a manifest. The ontology's migration lets a guest's grant
45
+ name no user. A role declared as `guest` is reserved once the ontology declares guests.
46
+
47
+ Action required: `signUp.channels: ["web"]` is superseded by `guest`, and `check` warns on it.
48
+ Declare `guest` with the same websites and remove `web` from `signUp.channels`; sign-up on `web`
49
+ keeps working until 2027-02-15. `signUpOrigin` is now `websiteOrigin`; the earlier name works until
50
+ 2027-02-15.
51
+
3
52
  ## 0.106.3
4
53
 
5
54
  The ontology service reads less from the workspace database. Its status endpoint reads the hash of
package/README.md CHANGED
@@ -410,11 +410,28 @@ export default defineOntology({
410
410
  affected member has linked email before restoring an email-only deployment. `User.sendSignInLink`
411
411
  preserves Neon links in compatibility and dual mode; sole SegmentStream uses interactive central
412
412
  sign-in, preserving templates, reply routing and the requested landing path.
413
+ - `guest: { channels: ["web"], origins, permissions }` lets the visitors of the websites `origins`
414
+ lists talk to the app's agent without signing in or signing up, as guests: a session, not a user.
415
+ `POST /api/ontology/agent/visitors` from one of those websites answers an agent token of an
416
+ `agent-web` grant that names no user (its id is the guest's), with a refresh token that renews it,
417
+ and chat `guest:<id>`; no user or identity is created, at most 10 guests start per network
418
+ address an hour, and a guest ends after 30 days without a renewal. Every guest holds the built-in
419
+ role `guest` alone, with `permissions`, which `check` holds to the rules of sign-up roles and
420
+ more: no built-in entity, no scope naming `me`, and of the agent's own tools only
421
+ `agent_tool:web`. The agent acting for a guest (`X-SegmentStream-Act-As: guest:<id>` with the
422
+ grant) reaches `/mcp` alone, without `me`, member files or the chat archive; what a guest creates
423
+ is created by nobody, and `principal.kind` is `guest`. Agent token introspection answers a
424
+ guest's token with `guest_id`, `roles`, `grant_id`, `chat` and `agent_tools`, and counts their
425
+ turns against the agent's `limits.guest`. Origins of `guest` and `signUp` are an origin alone
426
+ (`http` only for `localhost` and `127.0.0.1`) or a pattern such as `https://*.example.com`,
427
+ whose `*` is one whole leftmost label over a domain of at least two labels (`websiteOrigin`,
428
+ `matchesWebsite`). The manifest carries `sign_in.guest` and the built-in role only when
429
+ declared; `guestOf(manifest)` reads them.
413
430
  - `signUp: { channels, roles, byChannel?, origins? }` opens sign-up to strangers on each listed
414
431
  channel: `email` (signing in to the app by email code), `telegram` (a first private message to
415
432
  the bot, or opening the Mini App), `whatsapp` (a first message to the number) and `web` (a
416
- visitor of a website `origins` lists, by exact origin, who writes to the agent there; `http` only
417
- for `localhost` and `127.0.0.1`). `web` signs a visitor up at
433
+ visitor of a website `origins` lists who writes to the agent there; `guest` supersedes it, and
434
+ `check` warns on it). `web` signs a visitor up at
418
435
  `POST /api/ontology/agent/visitors`, which answers only browsers on those origins, at most 10 new
419
436
  visitors per network address an hour, with an agent token and a refresh token that renews it at
420
437
  the OAuth token endpoint as client `agent-web`. The new user holds
@@ -935,9 +952,9 @@ configured. This preparation does not advertise or enable exact chat posting.
935
952
  A permission is `<entity>:<verb>`. The verbs are `read`, the generated `create`, `update`,
936
953
  `delete`, `link` and `unlink`, and the names of authored actions. A role may use `*` for the
937
954
  entity, the verb or both: `lead:*`, `*:read`, `*:*`. An entity wildcard never covers the
938
- built-in `agent_chat`, `agent_review`, `app_feedback`, `app_feedback_file`, `user_identity` or
939
- `workspace_source`: reading or changing them needs a permission that names them, such as
940
- `agent_chat:read` or `agent_chat:*`.
955
+ built-in `agent_chat`, `agent_review`, `agent_tool`, `app_feedback`, `app_feedback_file`,
956
+ `user_identity` or `workspace_source`: reading or changing them needs a permission that names them,
957
+ such as `agent_chat:read` or `agent_chat:*`.
941
958
 
942
959
  `workspace_source:read` (`WORKSPACE_SOURCE_PERMISSION`) is the built-in permission to read the
943
960
  workspace's deployed code through the agent (see [The workspace's code](#the-workspaces-code)).
@@ -945,6 +962,18 @@ workspace's deployed code through the agent (see [The workspace's code](#the-wor
945
962
  an entity or toolset named `workspace_source`. Only `workspace_source:read` or
946
963
  `workspace_source:*` grants it; `*:read`, `*:*` and a pipeline workload's `*:*` do not.
947
964
 
965
+ `agent_tool:sandbox` and `agent_tool:web` (`AGENT_TOOL_VERBS`, `agentToolPermission`) grant the
966
+ app's agent's own tools to a caller: its sandbox (shell and files, staging files, file-argument
967
+ calls) and reading the web domains its configuration lists. `agent_tool` is no entity either:
968
+ `check` refuses any other verb, a scoped grant, and an entity or toolset of the name; only a
969
+ permission naming `agent_tool` grants them, never `*:*` or a workload's `*:*`. `agentToolsOf(roles,
970
+ principal)` is what the ontology tells the agent a caller holds, as `agent_tools` in every answer
971
+ that names whom the agent acts for. While no role, `member` and sign-up roles included, names an
972
+ `agent_tool` permission, it is `["sandbox"]` for everyone, as before these permissions, and `check`
973
+ warns `agent-tools-implicit`; from 2027-02-15 such an ontology grants no agent tool. Guests hold
974
+ what `guest.permissions` grant, never the sandbox and never implicitly, and those permissions count
975
+ for nothing in whether the ontology names agent tools.
976
+
948
977
  - Reads require `<entity>:read`: lists, queries, records, history, both entities of a
949
978
  relationship traversal, and every entity a metric query touches. `include` and a filter through a relationship require `read` on
950
979
  the related entity. A missing permission answers 403 with `<permission> is required.`
@@ -1302,7 +1331,7 @@ task header on any other route are a 403.
1302
1331
 
1303
1332
  | Route | Does |
1304
1333
  | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1305
- | `GET /api/ontology/agent/tasks/current` | `{ id, workflow, prompt, deadline_at, principal: { id, name, roles } }`; `roles` includes `member` |
1334
+ | `GET /api/ontology/agent/tasks/current` | `{ id, workflow, prompt, deadline_at, principal: { id, name, roles, agent_tools } }`; `roles` includes `member` |
1306
1335
  | `POST /api/ontology/agent/tasks/current/result` | `{ status: "completed" \| "needs_input", text, truncated }` or `{ status: "failed", reason: "agent_failed" }` → `{ accepted: true }`; 409 when the task already ended |
1307
1336
 
1308
1337
  Without either header the agent may call only the agent routes:
@@ -1314,7 +1343,7 @@ Without either header the agent may call only the agent routes:
1314
1343
  | `POST /api/ontology/agent/pairings/{code}/approve` | member | Pairs the account with the member → `{ identity }` |
1315
1344
  | `POST /api/ontology/agent/identities/resolve` | agent | Admission and turn limits; see below |
1316
1345
  | `POST /api/ontology/agent/identities/notice` | agent | `{ provider, external_id, sha256, version? }` acknowledges notice delivery: 204 |
1317
- | `GET /api/ontology/agent/identities/{provider}/{external_id}` | agent | `{ user: { id, name }, roles }`; 404 unpaired, 403 revoked, inactive |
1346
+ | `GET /api/ontology/agent/identities/{provider}/{external_id}` | agent | `{ user: { id, name }, roles, agent_tools }`; 404 unpaired, 403 revoked, inactive |
1318
1347
  | `GET /api/ontology/agent/identities` | member | `{ identities }`: the member's live identities |
1319
1348
  | `DELETE /api/ontology/agent/identities/{id}` | member | Revokes one of them: 204 |
1320
1349
  | `POST /api/ontology/agent/chats/seen` | agent | `{ provider, externalId, title, memberId?, leftMemberId?, agentLeft?, migratedFrom? }` → `{ id, title, purpose, whenToUse }` |
@@ -1337,7 +1366,8 @@ database an earlier SDK migrated. Additive migrations also create `_agent_counte
1337
1366
  display?, username?, notice_version?, notice_sha256?, limits? }` with a verified runtime token.
1338
1367
  It returns 200 with `status`:
1339
1368
 
1340
- - `created` or `existing`: `{ user: { id, name }, roles, provisioned, notice_due, on_new_user_pending }`.
1369
+ - `created` or `existing`: `{ user: { id, name }, roles, agent_tools, provisioned, notice_due, on_new_user_pending }`.
1370
+ `agent_tools` names the agent's own tools the user's roles grant, such as `sandbox`.
1341
1371
  The optional onboarding hook has already been attempted before this response; pending means retry.
1342
1372
  - `pairing_required`: unknown account on an invited channel, in a group, or with `turn: false`.
1343
1373
  - `refused`: `{ reason: "blocked" | "inactive" }`; revoked bindings also return `blocked` and never re-create.
package/dist/analyze.d.ts CHANGED
@@ -7,7 +7,7 @@ import { type AnyEntity, type EntityWrites } from "./entity.js";
7
7
  import { type PropertyDefinition } from "./property.js";
8
8
  import { type AnyRelationship } from "./relationship.js";
9
9
  import { type Role, type RolePermission } from "./role.js";
10
- import { type ResolvedSignInOptions, type SignInOptions, type SignUpOptions } from "./sign-in.js";
10
+ import { type GuestOptions, type ResolvedSignInOptions, type SignInOptions, type SignUpOptions } from "./sign-in.js";
11
11
  import { type EmailTemplate } from "./emails.js";
12
12
  import { type FeedbackOptions, type ResolvedFeedback } from "./feedback-config.js";
13
13
  import { type ModelMetricManifest, type WorkflowManifest } from "./manifest.js";
@@ -45,6 +45,12 @@ export interface OntologyConfig<Entities extends ReadonlyArray<AnyEntity> = Read
45
45
  * read everything and run only what other roles grant them.
46
46
  */
47
47
  readonly member?: MemberOptions;
48
+ /**
49
+ * Who may talk to the agent without signing in or signing up: the visitors of the websites
50
+ * `origins` names, on `web`. A guest is a session, not a user, and holds the built-in role
51
+ * `guest` with `permissions` alone. Absent, nobody chats without signing in or signing up.
52
+ */
53
+ readonly guest?: GuestOptions<RolePermission>;
48
54
  /** Who may become a member by signing in. Only invited people by default. */
49
55
  readonly signIn?: SignInOptions;
50
56
  /**
package/dist/analyze.js CHANGED
@@ -6,12 +6,12 @@ import { isBlobAccept, MAX_BLOB_BYTES } from "./blob.js";
6
6
  import { isAction } from "./action.js";
7
7
  import { CONNECTION_KEY, isConnection } from "./connection.js";
8
8
  import { isEntity } from "./entity.js";
9
- import { QUERY_METRICS_ROUTE, LEGACY_MEMBER_NAME, ENTITY_ID, GENERATED_ACTIONS, GENERATED_UPSERT_PREFIX, HISTORY_SUFFIX, MCP_METRIC_TOOLS, MCP_READ_TOOLS, MCP_TOOL_NAME_MAX_LENGTH, MEMBER_ROLE, FEEDBACK_REPORTER_ROLE, mcpToolName, RESERVED_ENTITY_NAMES, RESERVED_MEMBER_NAMES, RESERVED_RELATIONSHIP_NAMES, SNAKE_CASE_NAME, SYSTEM_PROPERTIES, humanize, isSystemProperty, toCamelCase, } from "./names.js";
9
+ import { QUERY_METRICS_ROUTE, LEGACY_MEMBER_NAME, ENTITY_ID, GENERATED_ACTIONS, GENERATED_UPSERT_PREFIX, HISTORY_SUFFIX, MCP_METRIC_TOOLS, MCP_READ_TOOLS, MCP_TOOL_NAME_MAX_LENGTH, MEMBER_ROLE, FEEDBACK_REPORTER_ROLE, GUEST_ROLE, mcpToolName, RESERVED_ENTITY_NAMES, RESERVED_MEMBER_NAMES, RESERVED_RELATIONSHIP_NAMES, SNAKE_CASE_NAME, SYSTEM_PROPERTIES, humanize, isSystemProperty, toCamelCase, } from "./names.js";
10
10
  import { REFERENCE_ANNOTATION, propertyDefinition, propertyOptionNames, unknownPropertyOptions, referenceTarget, } from "./property.js";
11
- import { EXPLICIT_GRANT_ENTITIES, generatedActionPermissions, grants, isAllowed, normalizePermission, parsePermission, parseWorkflowPermission, permissionOf, READ_VERB, rolesGranting, USER_IDENTITY_VERBS, USER_MEMBER_VERBS, WILDCARD, wildcardEntityCovers, WORKSPACE_SOURCE, WORKSPACE_SOURCE_PERMISSION, } from "./permissions.js";
11
+ import { AGENT_TOOL, AGENT_TOOL_VERBS, EXPLICIT_GRANT_ENTITIES, generatedActionPermissions, grants, isAllowed, namesAgentTools, normalizePermission, parsePermission, parseWorkflowPermission, permissionOf, READ_VERB, rolesGranting, USER_IDENTITY_VERBS, USER_MEMBER_VERBS, WILDCARD, wildcardEntityCovers, WORKSPACE_SOURCE, WORKSPACE_SOURCE_PERMISSION, } from "./permissions.js";
12
12
  import { ON_DELETE, isRelationship } from "./relationship.js";
13
13
  import { isRole, member, role } from "./role.js";
14
- import { CHANNEL_PROVIDERS, DEFAULT_SIGN_IN_POLICY, SIGN_UP_CHANNELS, SIGN_UP_CHAT_CHANNELS, isSignInPolicy, isSignUpChannel, signUpOrigin, } from "./sign-in.js";
14
+ import { CHANNEL_PROVIDERS, DEFAULT_SIGN_IN_POLICY, GUEST_CHANNELS, SIGN_UP_CHANNELS, SIGN_UP_CHAT_CHANNELS, isGuestChannel, isSignInPolicy, isSignUpChannel, websiteOrigin, } from "./sign-in.js";
15
15
  import { emailOptions } from "./emails.js";
16
16
  import { AgentChat } from "./agent-chat.js";
17
17
  import { AgentReview } from "./agent-review.js";
@@ -76,9 +76,11 @@ export function analyze(config, options = {}) {
76
76
  report("invalid-permission", "hooks.role", "hooks.role must name a declared ontology role.");
77
77
  }
78
78
  const signInDeclared = signInOptions(config, report);
79
+ const guest = guestOptions(config, report);
79
80
  const signIn = {
80
81
  ...signInDeclared,
81
82
  ...signUpOptions(config, signInDeclared, declaredRoles, report),
83
+ ...(guest === undefined ? {} : { guest: guest.resolved }),
82
84
  };
83
85
  const discovery = config.discovery;
84
86
  if (discovery !== undefined &&
@@ -126,7 +128,9 @@ export function analyze(config, options = {}) {
126
128
  definitions: new Set(entities.map((candidate) => candidate.definition)),
127
129
  };
128
130
  }
129
- const { feedback, roles } = feedbackRoles(feedbackSetting, files, declaredRoles, report);
131
+ const { feedback, roles: feedbackAndDeclared } = feedbackRoles(feedbackSetting, files, declaredRoles, report);
132
+ // The guests' role comes last: no declared role, builder, workflow or sign-up may name it.
133
+ const roles = guest === undefined ? feedbackAndDeclared : [...feedbackAndDeclared, guest.role];
130
134
  // Resolve authored entities before the optional feedback entities and the agent's reviews,
131
135
  // preserving their ordering: built-ins added later never move an authored entity.
132
136
  const isFeedback = (candidate) => APP_FEEDBACK_ENTITIES.some((feedback) => feedback.name === candidate.name);
@@ -231,12 +235,21 @@ export function analyze(config, options = {}) {
231
235
  if (options.checkPermissions !== false) {
232
236
  // Validate authored grants before augmentation can replace a scoped grant with an unscoped
233
237
  // builder grant. Invalid authored scopes must remain errors; generated redundancy needs no warning.
234
- checkPermissions(resolved, roles, workflows, report, [...declaredRoles, ...roles.filter((candidate) => candidate.name === FEEDBACK_REPORTER_ROLE)], toolsets);
238
+ checkPermissions(resolved, roles, workflows, report, [
239
+ ...declaredRoles,
240
+ ...roles.filter((candidate) => candidate.name === FEEDBACK_REPORTER_ROLE),
241
+ ...(guest === undefined ? [] : [guest.role]),
242
+ ], toolsets);
235
243
  checkOpenWarehouseReads({ entities: resolved, roles, signIn, report });
236
244
  checkOpenChannels({ config, entities: resolved, roles, signIn, report });
237
245
  checkNewUserAction({ entities: resolved, roles, signIn, report });
238
246
  checkSignUpRoles({ entities: resolved, roles, signIn, report });
239
247
  checkSignUpAction({ entities: resolved, roles, signIn, report });
248
+ // Guests' permissions decide nothing about whether the workspace names agent tools.
249
+ checkAgentToolGrants(roles.filter((candidate) => !BUILT_IN_GUESTS.has(candidate)), report);
250
+ if (guest !== undefined) {
251
+ checkGuestPermissions({ entities: resolved, guest: guest.role, report });
252
+ }
240
253
  if (feedback.enabled) {
241
254
  checkFeedbackResponders(roles, report);
242
255
  }
@@ -389,6 +402,10 @@ function resolveWorkflows(input) {
389
402
  report("workflow_role_unknown", `${path}.role`, "feedback_reporter is implicit human authority and cannot be a workflow role.");
390
403
  valid = false;
391
404
  }
405
+ else if (declared !== undefined && BUILT_IN_GUESTS.has(declared)) {
406
+ report("workflow_role_unknown", `${path}.role`, "guest is the role of guests and cannot be a workflow role.");
407
+ valid = false;
408
+ }
392
409
  else if (role === MEMBER_ROLE) {
393
410
  report("workflow_role_is_member", `${path}.role`, "a workflow runs as a declared role of its own; its runs hold member's permissions " +
394
411
  "anyway, so name the role that adds what the workflow does.");
@@ -929,6 +946,11 @@ function resolveToolsets(declared, entities, connections, report) {
929
946
  "workspace's code; rename the toolset.");
930
947
  return;
931
948
  }
949
+ if (name === AGENT_TOOL) {
950
+ report("reserved-name", path, `${name} names the built-in permissions ${agentToolPermissions()}, which grant the ` +
951
+ "agent's own tools; rename the toolset.");
952
+ return;
953
+ }
932
954
  const definition = candidate.definition;
933
955
  if (!isPlainObject(definition)) {
934
956
  report("invalid-toolset", path, "a toolset takes { connection, api, lock, description }.");
@@ -1390,10 +1412,10 @@ function signUpOptions(config, signIn, declaredRoles, report) {
1390
1412
  }
1391
1413
  else {
1392
1414
  options.origins.forEach((candidate, index) => {
1393
- const origin = signUpOrigin(candidate);
1415
+ const origin = websiteOrigin(candidate);
1394
1416
  const path = `signUp.origins[${index}]`;
1395
1417
  if (origin === undefined) {
1396
- report("invalid-sign-in", path, "Use an exact origin alone, such as https://www.example.com; http only for localhost.");
1418
+ report("invalid-sign-in", path, WEBSITE_ORIGIN_HINT);
1397
1419
  }
1398
1420
  else if (origins.includes(origin)) {
1399
1421
  report("invalid-sign-in", path, `${origin} is listed twice.`);
@@ -1410,6 +1432,12 @@ function signUpOptions(config, signIn, declaredRoles, report) {
1410
1432
  (Array.isArray(options.origins) && options.origins.length === 0))) {
1411
1433
  report("invalid-sign-in", "signUp.origins", "Signing up on web needs the websites' origins in signUp.origins.");
1412
1434
  }
1435
+ // @legacy ontology.sign-up-web
1436
+ if (channels.includes("web")) {
1437
+ report("invalid-sign-in", "signUp.channels", "web makes every visitor of the websites a user of the app, though nobody proved who they " +
1438
+ "are; declare guest, whose visitors talk to the agent as guests without a user, and " +
1439
+ "remove web from signUp.channels.", "warning");
1440
+ }
1413
1441
  if (channels.length > 0 && roles !== undefined) {
1414
1442
  result.signUp = {
1415
1443
  channels: Object.fromEntries(channels.map((channel) => [channel, byChannel[channel] ?? roles])),
@@ -1418,6 +1446,160 @@ function signUpOptions(config, signIn, declaredRoles, report) {
1418
1446
  }
1419
1447
  return result;
1420
1448
  }
1449
+ /** How `guest.origins` and `signUp.origins` take a website. */
1450
+ const WEBSITE_ORIGIN_HINT = "Use an origin alone, such as https://www.example.com, or a pattern whose leftmost label is *, " +
1451
+ "such as https://*.example.com, under a domain of at least two labels; http only for " +
1452
+ "localhost and 127.0.0.1.";
1453
+ /** The built-in `guest` roles `defineOntology({ guest })` made, as opposed to a declared one. */
1454
+ const BUILT_IN_GUESTS = new WeakSet();
1455
+ /** The guest keys `defineOntology({ guest })` takes. */
1456
+ const GUEST_KEYS = ["channels", "origins", "permissions"];
1457
+ /**
1458
+ * Where guests talk to the agent, and the built-in role `guest` with their permissions, when the
1459
+ * definition declares `guest`. Every problem is reported; the role is made from the permissions
1460
+ * as they are, for the permission checks to report on.
1461
+ */
1462
+ function guestOptions(config, report) {
1463
+ const options = config.guest;
1464
+ if (options === undefined) {
1465
+ return undefined;
1466
+ }
1467
+ const shape = `guest takes { channels: ["web"], origins: ["https://www.example.com"], permissions: [...] }.`;
1468
+ if (!isPlainObject(options)) {
1469
+ report("invalid-sign-in", "guest", shape);
1470
+ return undefined;
1471
+ }
1472
+ for (const key of Object.keys(options)) {
1473
+ if (!GUEST_KEYS.includes(key)) {
1474
+ report("invalid-sign-in", `guest.${key}`, `Unknown guest key: ${key}. ${shape}`);
1475
+ }
1476
+ }
1477
+ const channels = [];
1478
+ if (!Array.isArray(options.channels) || options.channels.length === 0) {
1479
+ report("invalid-sign-in", "guest.channels", `List where guests talk to the agent: ${GUEST_CHANNELS.join(", ")}.`);
1480
+ }
1481
+ else {
1482
+ options.channels.forEach((channel, index) => {
1483
+ const path = `guest.channels[${index}]`;
1484
+ if (!isGuestChannel(channel)) {
1485
+ report("invalid-sign-in", path, `Guests talk to the agent only on ${GUEST_CHANNELS.join(", ")}, not ${String(channel)}.`);
1486
+ }
1487
+ else if (channels.includes(channel)) {
1488
+ report("invalid-sign-in", path, `${channel} is listed twice.`);
1489
+ }
1490
+ else {
1491
+ channels.push(channel);
1492
+ }
1493
+ });
1494
+ }
1495
+ const origins = [];
1496
+ if (!Array.isArray(options.origins) || options.origins.length === 0) {
1497
+ report("invalid-sign-in", "guest.origins", "List the websites whose visitors are guests, such as https://www.example.com.");
1498
+ }
1499
+ else {
1500
+ options.origins.forEach((candidate, index) => {
1501
+ const origin = websiteOrigin(candidate);
1502
+ const path = `guest.origins[${index}]`;
1503
+ if (origin === undefined) {
1504
+ report("invalid-sign-in", path, WEBSITE_ORIGIN_HINT);
1505
+ }
1506
+ else if (origins.includes(origin)) {
1507
+ report("invalid-sign-in", path, `${origin} is listed twice.`);
1508
+ }
1509
+ else {
1510
+ origins.push(origin);
1511
+ }
1512
+ });
1513
+ }
1514
+ if (!Array.isArray(options.permissions)) {
1515
+ report("missing-permissions", "guest.permissions", 'List what every guest may do, such as permissions: ["lead:submit"]; [] grants nothing.');
1516
+ }
1517
+ const guest = role(GUEST_ROLE, {
1518
+ description: "Every guest: a visitor of a declared website, who is no user.",
1519
+ permissions: Array.isArray(options.permissions)
1520
+ ? options.permissions
1521
+ : [],
1522
+ });
1523
+ BUILT_IN_GUESTS.add(guest);
1524
+ return { resolved: { channels, origins }, role: guest };
1525
+ }
1526
+ /** Whether a scope's `where` names `me` or a path from it anywhere. */
1527
+ function usesMe(value) {
1528
+ if (mePathOf(value) !== undefined) {
1529
+ return true;
1530
+ }
1531
+ if (Array.isArray(value)) {
1532
+ return value.some(usesMe);
1533
+ }
1534
+ return isPlainObject(value) && Object.values(value).some(usesMe);
1535
+ }
1536
+ /**
1537
+ * The guests' permissions admit anyone who opens a declared website, so they are held to at least
1538
+ * the rules of sign-up roles: no entity wildcard, and no generated create, update, delete, link or
1539
+ * unlink on every record; an unscoped read of a stored entity is warned about. A guest is no user,
1540
+ * so a scope naming `me` would match nothing, and the built-in entities, which concern members,
1541
+ * are not a guest's to use. Of the agent's own tools a guest may hold `agent_tool:web`, never the
1542
+ * sandbox.
1543
+ */
1544
+ function checkGuestPermissions(input) {
1545
+ const { entities, guest, report } = input;
1546
+ const permissions = guest.permissions;
1547
+ const path = "guest.permissions";
1548
+ if (!Array.isArray(permissions)) {
1549
+ return;
1550
+ }
1551
+ const scoped = new Set((guest.scopes ?? []).map((scope) => scope.permission));
1552
+ const hint = "Scope it to the records guests may change, or grant an action that checks them.";
1553
+ (guest.scopes ?? []).forEach((scope, index) => {
1554
+ if (usesMe(scope.where)) {
1555
+ report("invalid-scope", `guest.scopes[${index}]`, `A guest is no user, so me in the scope of ${scope.permission} matches nothing; ` +
1556
+ "scope it by the records' own fields.");
1557
+ }
1558
+ });
1559
+ for (const permission of permissions) {
1560
+ const parsed = parsePermission(permission);
1561
+ if (parsed === undefined) {
1562
+ continue;
1563
+ }
1564
+ if (parsed.entity === WILDCARD) {
1565
+ report("invalid-sign-in", path, `Guests cannot hold ${String(permission)}; name the entities they may use.`);
1566
+ continue;
1567
+ }
1568
+ // A guest may read the agent's listed websites, never run its sandbox: the sandbox reads the
1569
+ // records and files of whoever it acts for, and anyone opening the website is a guest.
1570
+ if (parsed.entity === AGENT_TOOL && (parsed.verb === "sandbox" || parsed.verb === WILDCARD)) {
1571
+ report("invalid-sign-in", path, `Guests cannot hold ${String(permission)}: the agent's sandbox is never a guest's. Name ` +
1572
+ `${AGENT_TOOL}:web alone for the agent to read the websites web.domains lists for them.`);
1573
+ continue;
1574
+ }
1575
+ const entity = entities.find((resolved) => resolved.name === parsed.entity);
1576
+ if (entity === undefined) {
1577
+ continue;
1578
+ }
1579
+ if (entity.builtIn) {
1580
+ report("invalid-sign-in", path, `Guests cannot hold ${String(permission)}: ${entity.name} concerns the app's users, and a ` +
1581
+ "guest is none.");
1582
+ continue;
1583
+ }
1584
+ if (scoped.has(String(permission))) {
1585
+ continue;
1586
+ }
1587
+ const generatedWrite = [
1588
+ entity.permissions.create,
1589
+ entity.permissions.update,
1590
+ entity.permissions.delete,
1591
+ entity.permissions.link,
1592
+ entity.permissions.unlink,
1593
+ ].some((required) => required !== undefined && isAllowed(required, { permissions: [String(permission)] }));
1594
+ if (generatedWrite) {
1595
+ report("invalid-sign-in", path, `Guests cannot hold ${String(permission)} on every record. ${hint}`);
1596
+ }
1597
+ else if (isAllowed(entity.permissions.read, { permissions: [String(permission)] })) {
1598
+ report("invalid-sign-in", path, `${String(permission)} lets every visitor of the guests' websites read every ` +
1599
+ `${entity.name}. Review it, or scope it to the records guests may read.`, "warning");
1600
+ }
1601
+ }
1602
+ }
1421
1603
  /**
1422
1604
  * The roles sign-up grants admit strangers. Each must be explicitly reviewed: no entity wildcard,
1423
1605
  * and no generated create, update, delete, link or unlink that is not scoped to the person's own
@@ -1510,6 +1692,11 @@ function collectRoles(config, report) {
1510
1692
  report("reserved-name", path, `${candidate.name} is a reserved built-in role.`);
1511
1693
  return;
1512
1694
  }
1695
+ // A role of this name stays the workspace's own until the ontology declares guests.
1696
+ if (candidate.name === GUEST_ROLE && config.guest !== undefined) {
1697
+ report("reserved-name", path, "guest is the built-in role of guests once the ontology declares guest; rename this role.");
1698
+ return;
1699
+ }
1513
1700
  if (roles.some((existing) => existing.name === candidate.name)) {
1514
1701
  report("duplicate-name", path, `role "${candidate.name}" is declared twice.`);
1515
1702
  return;
@@ -1547,6 +1734,10 @@ function resolveEntity(candidate, scope, resolvedProperties) {
1547
1734
  report("reserved-name", name, `${WORKSPACE_SOURCE} names the built-in permission ${WORKSPACE_SOURCE_PERMISSION}, which ` +
1548
1735
  "reads the workspace's code; choose another entity name.");
1549
1736
  }
1737
+ else if (name === AGENT_TOOL) {
1738
+ report("reserved-name", name, `${AGENT_TOOL} names the built-in permissions ${agentToolPermissions()}, which grant the ` +
1739
+ "agent's own tools; choose another entity name.");
1740
+ }
1550
1741
  else if (APP_FEEDBACK_ENTITIES.some((feedback) => feedback.name === name) &&
1551
1742
  !scope.builtIns.has(definition)) {
1552
1743
  report("reserved-name", name, `${name} is the SDK's app feedback; configure feedback on defineOntology ` +
@@ -2284,7 +2475,7 @@ function ownMembers(candidate, entitiesByName) {
2284
2475
  * The verbs each entity has: `read`, its generated actions, and what its actions require. The
2285
2476
  * built-in user also has its member management verbs, and the built-in sign-in identities their
2286
2477
  * attach and revoke, which roles may grant. The built-in `workspace_source`, which is no entity,
2287
- * has `read` only.
2478
+ * has `read` only, and the built-in `agent_tool`, no entity either, the agent's own tools.
2288
2479
  */
2289
2480
  function knownVerbs(entities, toolsets = []) {
2290
2481
  const verbs = new Map();
@@ -2322,8 +2513,13 @@ function knownVerbs(entities, toolsets = []) {
2322
2513
  }
2323
2514
  // Last, so that an entity or a toolset of the name, which check refuses, adds no verb to it.
2324
2515
  verbs.set(WORKSPACE_SOURCE, new Set([READ_VERB]));
2516
+ verbs.set(AGENT_TOOL, new Set(AGENT_TOOL_VERBS));
2325
2517
  return verbs;
2326
2518
  }
2519
+ /** `agent_tool:sandbox and agent_tool:web`, for messages. */
2520
+ function agentToolPermissions() {
2521
+ return listed(AGENT_TOOL_VERBS.map((tool) => `${AGENT_TOOL}:${tool}`));
2522
+ }
2327
2523
  /** Why a role's permission matches nothing in the ontology, or `undefined` when it matches. */
2328
2524
  function unknownPermission(value, { entity, verb }, verbs) {
2329
2525
  if (entity === WILDCARD) {
@@ -2384,15 +2580,16 @@ function listed(names) {
2384
2580
  return names.length === 1 ? names[0] : `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
2385
2581
  }
2386
2582
  function checkRolePermissions(candidate, verbs, workflows, report) {
2387
- const builtIn = candidate.name === MEMBER_ROLE;
2388
- const path = builtIn ? "member.permissions" : `roles.${candidate.name}.permissions`;
2583
+ const builtIn = candidate.name === MEMBER_ROLE || BUILT_IN_GUESTS.has(candidate);
2584
+ const path = builtIn ? `${candidate.name}.permissions` : `roles.${candidate.name}.permissions`;
2389
2585
  const permissions = candidate.permissions;
2390
2586
  if (!Array.isArray(permissions)) {
2391
2587
  report("missing-permissions", path, "list what the role may do as <entity>:<verb> permissions, such as " +
2392
2588
  'permissions: ["lead:read"].');
2393
2589
  return;
2394
2590
  }
2395
- // An empty member list is a choice: members then hold only the roles they are given.
2591
+ // An empty member list is a choice: members then hold only the roles they are given. An empty
2592
+ // guest list lets guests talk to the agent and do nothing more.
2396
2593
  if (permissions.length === 0 && !builtIn) {
2397
2594
  report("missing-permissions", path, "a role without permissions can do nothing; list at least one, such as lead:read.");
2398
2595
  }
@@ -2519,6 +2716,25 @@ function checkNewUserAction(input) {
2519
2716
  fail("onNewUser cannot prepare or use external connections.");
2520
2717
  }
2521
2718
  }
2719
+ // @legacy ontology.implicit-agent-sandbox
2720
+ /** The day an ontology whose roles name no agent tool stops giving every caller the sandbox. */
2721
+ const IMPLICIT_AGENT_SANDBOX_ENDS = "2027-02-15";
2722
+ // @legacy ontology.implicit-agent-sandbox
2723
+ /**
2724
+ * While no role names an agent tool, the ontology tells the agent that every caller has the
2725
+ * sandbox, as before agent tools were permissions: people `signUp` admits included. Builders learn
2726
+ * here to grant the tools to the roles that should have them.
2727
+ */
2728
+ function checkAgentToolGrants(roles, report) {
2729
+ if (namesAgentTools(roles)) {
2730
+ return;
2731
+ }
2732
+ const named = [...AGENT_TOOL_VERBS.map((tool) => `${AGENT_TOOL}:${tool}`), `${AGENT_TOOL}:*`];
2733
+ report("agent-tools-implicit", "roles", `no role names an ${AGENT_TOOL} permission, so the agent gives everyone it acts for, people ` +
2734
+ `who sign up included, its sandbox tools. From ${IMPLICIT_AGENT_SANDBOX_ENDS} only roles ` +
2735
+ `grant the agent's own tools: name ${named.slice(0, -1).join(", ")} or ${named.at(-1)} in ` +
2736
+ "the roles that may use them, such as member's permissions.", "warning");
2737
+ }
2522
2738
  /** The member management verbs that act on members a page or an agent must first find. */
2523
2739
  const ROSTER_VERBS = ["invite", "grant_roles"];
2524
2740
  /**
@@ -2842,6 +3058,11 @@ function checkScope(input) {
2842
3058
  `${WORKSPACE_SOURCE_PERMISSION} as a string in the roles that may read the code.`);
2843
3059
  return;
2844
3060
  }
3061
+ if (parsed.entity === AGENT_TOOL && verbs.get(AGENT_TOOL)?.has(parsed.verb) === true) {
3062
+ report("invalid-scope", path, `${permission} grants one of the agent's own tools, which has no records to scope; list ` +
3063
+ `${permission} as a string in the roles that may use it.`);
3064
+ return;
3065
+ }
2845
3066
  const entity = entities.find((candidate) => candidate.name === parsed.entity);
2846
3067
  if (entity === undefined && verbs.get(parsed.entity)?.has(parsed.verb) === true) {
2847
3068
  report("invalid-scope", path, `${parsed.entity} is a toolset, which has no records to scope; list ${permission} as a ` +
@@ -2928,7 +3149,9 @@ function checkScopes(entities, roles, verbs, report) {
2928
3149
  };
2929
3150
  for (const candidate of roles) {
2930
3151
  const scopes = Array.isArray(candidate.scopes) ? candidate.scopes : [];
2931
- const base = candidate.name === MEMBER_ROLE ? MEMBER_ROLE : `roles.${candidate.name}`;
3152
+ const base = candidate.name === MEMBER_ROLE || BUILT_IN_GUESTS.has(candidate)
3153
+ ? candidate.name
3154
+ : `roles.${candidate.name}`;
2932
3155
  const unscoped = unscopedPermissions(candidate);
2933
3156
  const unused = (permission, grant, by, path) => report("scope-unused", path, `${candidate.name} scopes ${permission}, but ${by} grants it on every record through ` +
2934
3157
  `${grant}, so the scope never applies; remove ${grant} from ${by}, or the scoped entry ` +
@@ -2944,7 +3167,8 @@ function checkScopes(entities, roles, verbs, report) {
2944
3167
  if (parsed !== undefined && parsed.entity !== WILDCARD && parsed.verb !== WILDCARD) {
2945
3168
  const permission = scope.permission;
2946
3169
  const own = unscoped.find((granted) => grants(granted, permission));
2947
- const fromMember = candidate.name === MEMBER_ROLE
3170
+ // A guest never holds member.
3171
+ const fromMember = candidate.name === MEMBER_ROLE || BUILT_IN_GUESTS.has(candidate)
2948
3172
  ? undefined
2949
3173
  : memberGrants.find((granted) => grants(granted, permission));
2950
3174
  if (own !== undefined) {
package/dist/authoring.js CHANGED
@@ -330,5 +330,11 @@ export function authoringToWire(config, builtIns, report) {
330
330
  permissions: config.member.permissions.map((permission) => encoder.permission(permission)),
331
331
  };
332
332
  }
333
+ if (isRecord(config.guest) && Array.isArray(config.guest.permissions)) {
334
+ normalized.guest = {
335
+ ...config.guest,
336
+ permissions: config.guest.permissions.map((permission) => encoder.permission(permission)),
337
+ };
338
+ }
333
339
  return { config: normalized, builtIns: builtIns.map((entity) => encoder.entity(entity)) };
334
340
  }
@@ -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", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "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", "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"];
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", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "agent-tools-implicit", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "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", "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"];
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", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "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", "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"]>;
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", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "agent-tools-implicit", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "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", "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"]>;
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", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "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", "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"]>;
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", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "agent-tools-implicit", "unknown-connection", "unused-connection", "invalid-prepare", "invalid-tool-name", "invalid-toolset", "toolset-lock-mismatch", "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", "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"]>;
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;