@segmentstream/ontology 0.119.0 → 0.121.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 (43) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +55 -38
  3. package/dist/analyze.d.ts +8 -3
  4. package/dist/analyze.js +71 -31
  5. package/dist/diagnostics.d.ts +3 -3
  6. package/dist/diagnostics.js +1 -0
  7. package/dist/errors.d.ts +6 -0
  8. package/dist/errors.js +6 -0
  9. package/dist/feedback-config.d.ts +10 -1
  10. package/dist/feedback-config.js +46 -20
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.js +2 -2
  13. package/dist/manifest.d.ts +29 -9
  14. package/dist/manifest.js +12 -5
  15. package/dist/permissions.d.ts +1 -1
  16. package/dist/permissions.js +1 -1
  17. package/dist/role.d.ts +22 -3
  18. package/dist/role.js +42 -6
  19. package/dist/runtime/generated-actions.js +14 -4
  20. package/dist/runtime/member-writes.d.ts +10 -4
  21. package/dist/runtime/member-writes.js +15 -7
  22. package/dist/runtime/model.d.ts +5 -0
  23. package/dist/runtime/model.js +5 -2
  24. package/dist/runtime/new-user-hook.js +7 -4
  25. package/dist/runtime/principals.d.ts +30 -10
  26. package/dist/runtime/principals.js +88 -44
  27. package/dist/runtime/records.js +1 -1
  28. package/dist/runtime/resolve-agent-identity.js +3 -3
  29. package/dist/runtime/sql-runtime.js +2 -1
  30. package/dist/runtime/user-roles.d.ts +8 -7
  31. package/dist/runtime/user-roles.js +17 -12
  32. package/dist/runtime/where.js +4 -4
  33. package/dist/service/agent/server.js +1 -0
  34. package/dist/service/agent/tasks.d.ts +2 -0
  35. package/dist/service/agent/tasks.js +7 -4
  36. package/dist/service/chat/delivery.js +2 -0
  37. package/dist/service/errors.js +4 -3
  38. package/dist/service/runtime-contract.d.ts +5 -0
  39. package/dist/service/schemas.js +2 -0
  40. package/dist/service/service.js +2 -0
  41. package/dist/storage/authorization.js +9 -6
  42. package/dist/workflow.d.ts +7 -3
  43. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.121.0
4
+
5
+ The platform builds in no role. An ontology without `defineOntology({ member })` names every role
6
+ itself: an invited or paired person holds exactly the roles their invitation, a later grant or
7
+ `signUp.roles` gave them; a workflow's runs and its agent tasks hold exactly the workflow's role;
8
+ and no `feedback_reporter` role is added. `member` and `feedback_reporter` are names like any
9
+ other, which a workspace may declare and grant. A workspace that wants its people to report app
10
+ feedback grants `app_feedback:submit`, with `app_feedback:read` and `app_feedback:acknowledge`
11
+ scoped to `{ reporter: me }`, in its own roles; `check` warns `feedback-unreportable` when it turns
12
+ feedback on and no role may report. `signIn.policy: "open"` needs `member`, which it admits people
13
+ with; `check` refuses it otherwise, and `signIn.onNewUser` too. The manifest marks `member` and
14
+ `feedback_reporter` built in only while the ontology declares `member`. The agent's identity
15
+ answer says in `counted` whether the person's turns count against the limits.
16
+
17
+ An ontology that declares `defineOntology({ member: { permissions } })` behaves as before: every
18
+ invited or paired user, every workflow and every agent task holds `member`, people also hold the
19
+ implicit `feedback_reporter`, and both names stay reserved.
20
+
21
+ Action required: an ontology that does not set `member` no longer gives every invited member, every
22
+ workflow and every agent task `*:read`. Declare a role for what everyone may do, such as
23
+ `role("team", { permissions: ["*:read", …] })`, grant it to your current members
24
+ (`segmentstream ontology member grant <email> --role team`) and invite people with it, and add the
25
+ reads each workflow needs to its role; or set `member: { permissions: ["*:read"] }` to keep the
26
+ earlier behavior.
27
+
28
+ ## 0.120.0
29
+
30
+ A chat post whose delivery did not happen and spent its idempotency key, a message the provider
31
+ refused or a replay of one, now answers `422 action_rejected` with `key_consumed: true`, so a client
32
+ sends it again with a new key. Any other failure keeps meaning: retry with the same key.
33
+ `ActionRejected` takes `keyConsumed: true` for any action whose key a refusal spends.
34
+
3
35
  ## 0.119.0
4
36
 
5
37
  A trigger can run one action without a workflow file. List it in `defineOntology({ triggers })`
package/README.md CHANGED
@@ -159,10 +159,10 @@ SDK 0.13.0 also serves aggregates. Upgrade notes:
159
159
  `User` cannot.
160
160
  - `aggregate` is reserved for the route and the MCP tool: rename an entity with that name
161
161
  before upgrading.
162
- - Under `signIn: { policy: "open" }`, anyone who signs in holds `member`, so `check` refuses a
163
- `member` whose wildcard (`*:read`, the default, or `*:*`) would let strangers read
164
- warehouse-backed entities through aggregates. Grant those to `member` by name
165
- (`acme_sales:read`), or keep the `invited` policy.
162
+ - Under `signIn: { policy: "open" }`, which only an ontology declaring the built-in `member`
163
+ accepts, anyone who signs in holds `member`, so `check` refuses a `member` whose wildcard
164
+ (`*:read` or `*:*`) would let strangers read warehouse-backed entities through aggregates.
165
+ Grant those to `member` by name (`acme_sales:read`), or keep the `invited` policy.
166
166
 
167
167
  See `docs/ontology-metrics.md`.
168
168
 
@@ -371,10 +371,9 @@ import { Lead, sales } from "./lead";
371
371
 
372
372
  export default defineOntology({
373
373
  entities: [Lead],
374
+ // Every role is the workspace's own: a person holds exactly the roles they were given.
374
375
  roles: [sales],
375
- // What every active app user may do. Without it, members may only read: ["*:read"].
376
- member: { permissions: ["*:read"] },
377
- // Who may become a member by signing in: only invited people (the default), or anyone ("open").
376
+ // Who may become a member by signing in: only invited people (the default).
378
377
  signIn: { policy: "invited" },
379
378
  });
380
379
  ```
@@ -391,8 +390,16 @@ export default defineOntology({
391
390
  held for a member to approve, edit or reject. Every ontology includes them. Text feedback defaults on with built-in `AppFeedback`; files follow the non-feedback-blob policy
392
391
  (or an explicit opt-in) and add `AppFeedbackFile` (see [App feedback](#app-feedback)).
393
392
  - `role(name, { description, permissions })` declares a role: a named set of permissions.
394
- `member` is built in: every active app user holds it, with the permissions of
395
- `defineOntology({ member })`.
393
+ Every role is the workspace's own, named as it likes; `member` and `feedback_reporter` are
394
+ names like any other. A person holds exactly the roles an invitation, a grant
395
+ (`user.grant_roles`, `User.grantRoles`, the CLI or the console) or sign-up gave them, an API
396
+ key the roles it was created with, and a workflow's runs the workflow's role. Give staff a
397
+ role every member of staff holds, such as the starter's `team`, at invitation.
398
+ - `defineOntology({ member: { permissions } })` keeps the earlier built-in `member`: every
399
+ invited or paired user, every workflow's runs and every agent task hold it without a grant,
400
+ people also hold the built-in `feedback_reporter`, and both names are reserved. Listing the
401
+ exported `member` in `roles` without `member:` is an error. New ontologies declare their own
402
+ roles instead.
396
403
  - `.actions((self) => ({ … }))` adds actions. Each action has a description, an input
397
404
  schema and an Effect handler. It requires the permission `<entity>:<action name>`, or the
398
405
  one its `permission` names.
@@ -459,11 +466,11 @@ export default defineOntology({
459
466
  exactly `roles`, declared roles passed as role objects or names, or the channel's own list in
460
467
  `byChannel`; `[]` grants nothing beyond what is later granted or shared. Sign-up writes them as
461
468
  ordinary role assignments in its own transaction, so one person's roles can be revoked or added
462
- to like anyone's. A user sign-up created never holds `member`, the baseline of invited people,
463
- nor the implicit feedback reporter role, and the platform records that they signed up (`_channel_users.signed_up`) whatever roles they
469
+ to like anyone's. A user sign-up created never holds the built-in `member` or feedback
470
+ reporter role of an ontology that declares `member`, and the platform records that they signed up (`_channel_users.signed_up`) whatever roles they
464
471
  hold later: turn limits always count them. A channel not listed admits only invited or paired
465
472
  people; a workspace without `signUp` is internal. `check` refuses in sign-up roles an
466
- undeclared role, `member`, an entity wildcard, and a generated create, update, delete, link or
473
+ undeclared role, the built-in `member`, an entity wildcard, and a generated create, update, delete, link or
467
474
  unlink that is not scoped (`{ permission, where: { createdBy: me } }`); an unscoped read of a
468
475
  stored entity warns for review. Telegram and WhatsApp need a matching `chat.<channel>` adapter.
469
476
  A channel opened both here and by `signIn.channels` or `signIn.policy: "open"` is refused.
@@ -478,7 +485,8 @@ export default defineOntology({
478
485
  - `signIn: { policy }` decides who may become a member by signing in. `invited`, the
479
486
  default, admits only people whose email a member already has, from an invitation or a
480
487
  role grant; anyone else is answered 403 `not_invited`. `open` makes anyone who signs in a
481
- member holding only `member`. The manifest carries the policy. <!-- @legacy ontology.legacy-channel-admission -->
488
+ member holding only the built-in `member`, so `check` refuses it in an ontology that does not
489
+ declare `member`; use `signUp` instead. The manifest carries the policy. <!-- @legacy ontology.legacy-channel-admission -->
482
490
  `signIn.codeLink: true` makes the platform's sign-in code emails also link to the app's
483
491
  `/sign-in` page with the code in the URL fragment; the app SDK's `useSignIn()` fills it in and
484
492
  waits for the person to confirm. Off when omitted; see the app authentication guide.
@@ -590,8 +598,9 @@ export default workflow("remindStaleLeads", {
590
598
  SDK did not compile is logged as `ontology.workflow.not_compiled` when the service starts, and
591
599
  starting it answers 503 `workflow_not_compiled`.
592
600
  - `name` is camelCase and unique; it names the workflow's user. `description` is required.
593
- - `role` is a declared role other than `member`, and not one that grants `*:*`. The runs hold
594
- what it and `member` grant.
601
+ - `role` is a declared role, and not one that grants `*:*`. The runs hold exactly this role,
602
+ so it grants what they read as well as the actions they run; in an ontology that declares
603
+ the built-in `member`, they also hold `member`, which cannot be the workflow's role.
595
604
  - `input` is a `Schema.Struct`; omitted means `{}`. `run` receives the decoded input in
596
605
  TypeScript names, and as its second argument `{ startedBy }`: the trigger, the member, or the
597
606
  platform (with the person it acted for) that started the run.
@@ -622,7 +631,8 @@ export default workflow("remindStaleLeads", {
622
631
  - `connections` lists the connections the steps call directly; each must be in
623
632
  `defineOntology({ connections })`. Connections declared on an action stay that action's.
624
633
  - At most 50 workflows. `check` reports `workflow_role_unknown`, `workflow_role_is_member`,
625
- `workflow_role_grants_nothing` (a warning: with member's grants, the role grants no action),
634
+ `workflow_role_grants_nothing` (a warning: the role, with the built-in `member`'s grants where
635
+ declared, grants no action),
626
636
  `workflow_role_wildcard` (the role grants `*:*`), `workflow_input_invalid`,
627
637
  `workflow_cron_invalid`, `workflow_cron_never_fires` (a warning: no listed month has the
628
638
  day), `workflow_run_missing` (`run` is not a function), `invalid-workflow`, `invalid-property`
@@ -681,8 +691,9 @@ A workflow hands the workspace's agent a prompt with `agentTask` from
681
691
  `@segmentstream/ontology/workflows`, in its `"use workflow"` body, and waits for the
682
692
  agent's final answer without holding compute. It is the agent members reach in chats, with the
683
693
  same instructions, models, tools and sandbox, acting as the workflow's own user: it sees and does
684
- exactly what the workflow's role and `member` grant, and ontology actions run without
685
- confirmation, since no person is present. Keep the role narrow: a prompt may carry untrusted text.
694
+ exactly what the workflow's role grants (and the built-in `member`, where the ontology declares
695
+ it), and ontology actions run without confirmation, since no person is present. Keep the role
696
+ narrow: a prompt may carry untrusted text.
686
697
 
687
698
  ```ts
688
699
  import { agentTask, workflow } from "@segmentstream/ontology/workflows";
@@ -848,8 +859,8 @@ reactivates redeclared ones. A run before the deploy creates a missing user
848
859
  and a user whose roles are not exactly the declared role is refused (`role_mismatch`) until a
849
860
  deploy reconciles it. Runs that are in flight on an older deployment when a deploy changes the
850
861
  workflow's role fail fatally at their next step, since their deployment declares the old role. The
851
- user never holds `member` as a role; every action re-reads its roles in
852
- the action's transaction and refuses any assignment other than the declared role.
862
+ user is assigned the declared role alone, never the built-in `member`; every action re-reads its
863
+ roles in the action's transaction and refuses any assignment other than the declared role.
853
864
 
854
865
  ## Batch writes in actions
855
866
 
@@ -996,11 +1007,11 @@ calls) and reading the web domains its configuration lists. `agent_tool` is no e
996
1007
  `check` refuses any other verb, a scoped grant, and an entity or toolset of the name; only a
997
1008
  permission naming `agent_tool` grants them, never `*:*` or a workload's `*:*`. `agentToolsOf(roles,
998
1009
  principal)` is what the ontology tells the agent a caller holds, as `agent_tools` in every answer
999
- that names whom the agent acts for. While no role, `member` and sign-up roles included, names an
1000
- `agent_tool` permission, it is `["sandbox"]` for everyone, as before these permissions, and `check`
1001
- warns `agent-tools-implicit`; from 2027-02-15 such an ontology grants no agent tool. Guests hold
1002
- what `guest.permissions` grant, never the sandbox and never implicitly, and those permissions count
1003
- for nothing in whether the ontology names agent tools.
1010
+ that names whom the agent acts for. While no role, sign-up roles and the built-in `member`
1011
+ included, names an `agent_tool` permission, it is `["sandbox"]` for everyone, as before these
1012
+ permissions, and `check` warns `agent-tools-implicit`; from 2027-02-15 such an ontology grants no
1013
+ agent tool. Guests hold what `guest.permissions` grant, never the sandbox and never implicitly, and
1014
+ those permissions count for nothing in whether the ontology names agent tools.
1004
1015
 
1005
1016
  - Reads require `<entity>:read`: lists, queries, records, history, both entities of a
1006
1017
  relationship traversal, and every entity a metric query touches. `include` and a filter through a relationship require `read` on
@@ -1008,8 +1019,9 @@ for nothing in whether the ontology names agent tools.
1008
1019
  - Each action requires one permission. The generated `upsert_by_<property>` requires both
1009
1020
  `<entity>:create` and `<entity>:update`.
1010
1021
  - A principal's permissions are the union of its roles' permissions in the ontology.
1011
- Members hold `member` and their assigned roles; an API key holds exactly the roles it was
1012
- created with; a workflow's runs hold the workflow's role and what `member` grants. A role the
1022
+ Members hold exactly their assigned roles; an API key holds exactly the roles it was created
1023
+ with; a workflow's runs hold exactly the workflow's role. In an ontology that declares the
1024
+ built-in `member`, invited and paired members and workflow runs also hold `member`. A role the
1013
1025
  ontology no longer declares grants nothing.
1014
1026
  - The catalog, `describe`, `graph`, `openapi.json` and `me` need only authentication;
1015
1027
  `status`, `sign-in/check` and the `docs` page need none. `?as=me` lists only the actions the caller may run.
@@ -1257,16 +1269,21 @@ lookup for code that holds a SQL client.
1257
1269
 
1258
1270
  ## App feedback
1259
1271
 
1260
- Text feedback is enabled when `feedback` is omitted. Every authenticated human member can
1261
- submit, read their own items and acknowledge answers, including members with no assigned roles.
1262
- It works through the app's REST API or the customer's own OAuth MCP client; an in-app agent,
1263
- pairing and Telegram are optional. Upgrade the ontology SDK and deploy to apply these defaults;
1264
- running deployments and historical manifests do not change retroactively.
1265
-
1266
- The reserved built-in `feedback_reporter` role supplies this authority during human principal
1267
- resolution. It is never stored or assignable, cannot be declared as a workspace role, and cannot
1268
- be used by API keys, services, workflows, hooks or `feedback.builders`. The workspace's `member`
1269
- permissions remain unchanged. OAuth `ontology:read` consent still removes writes.
1272
+ Text feedback is enabled when `feedback` is omitted. The workspace's roles say who may report:
1273
+ a role granting `app_feedback:submit`, `{ permission: "app_feedback:read", where: { reporter: me } }`
1274
+ and `{ permission: "app_feedback:acknowledge", where: { reporter: me } }` lets its holders submit,
1275
+ read their own items and acknowledge answers; with feedback files, `app_feedback_file:attach`
1276
+ and `app_feedback_file:read` scoped to `{ feedback: { reporter: me } }` add their files. The
1277
+ starter's `team` grants the first three. When `feedback` is set and no role grants
1278
+ `app_feedback:submit`, `check` warns `feedback-unreportable`. It works through the app's REST
1279
+ API or the customer's own OAuth MCP client; an in-app agent, pairing and Telegram are optional.
1280
+ Upgrade the ontology SDK and deploy to apply these defaults; running deployments and historical
1281
+ manifests do not change retroactively. OAuth `ontology:read` consent still removes writes.
1282
+
1283
+ An ontology that declares the built-in `member` also gives every invited or paired member the
1284
+ built-in `feedback_reporter` role, with those grants, during human principal resolution. It is
1285
+ never stored or assignable, cannot be declared as a workspace role while `member` is declared,
1286
+ and is not held by API keys, services, workflows, hooks or `feedback.builders`.
1270
1287
 
1271
1288
  Files follow a conservative policy resolved without network calls:
1272
1289
 
@@ -1359,7 +1376,7 @@ task header on any other route are a 403.
1359
1376
 
1360
1377
  | Route | Does |
1361
1378
  | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1362
- | `GET /api/ontology/agent/tasks/current` | `{ id, workflow, prompt, deadline_at, principal: { id, name, roles, agent_tools } }`; `roles` includes `member` |
1379
+ | `GET /api/ontology/agent/tasks/current` | `{ id, workflow, prompt, deadline_at, principal: { id, name, roles, agent_tools } }`; `roles` is the workflow's role, and `member` where declared |
1363
1380
  | `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 |
1364
1381
 
1365
1382
  Without either header the agent may call only the agent routes:
package/dist/analyze.d.ts CHANGED
@@ -34,7 +34,10 @@ export interface OntologyConfig<Entities extends ReadonlyArray<AnyEntity> = Read
34
34
  readonly hooks?: {
35
35
  readonly role: string;
36
36
  };
37
- /** Business roles. The built-in `member` role is always included. */
37
+ /**
38
+ * The roles people, API keys and workflows hold, each named by the workspace. A person holds the
39
+ * roles an invitation, a grant or sign-up gave them, and nothing else.
40
+ */
38
41
  readonly roles?: ReadonlyArray<Role>;
39
42
  /**
40
43
  * Durable processes written with the Vercel Workflow SDK, each declared with
@@ -50,8 +53,10 @@ export interface OntologyConfig<Entities extends ReadonlyArray<AnyEntity> = Read
50
53
  */
51
54
  readonly triggers?: ReadonlyArray<WorkflowTrigger>;
52
55
  /**
53
- * The built-in role every active app user holds. Its permissions default to `["*:read"]`: members
54
- * read everything and run only what other roles grant them.
56
+ * The earlier built-in `member` role: while it is declared, every invited or paired user, every
57
+ * workflow and every agent task holds it without being granted it, and people also hold the
58
+ * implicit `feedback_reporter`. Without it, the platform builds in no role: declare a role of
59
+ * your own, such as `team`, and grant it to the people and workflows that need it.
55
60
  */
56
61
  readonly member?: MemberOptions;
57
62
  /**
package/dist/analyze.js CHANGED
@@ -12,13 +12,13 @@ import { QUERY_METRICS_ROUTE, LEGACY_MEMBER_NAME, ENTITY_ID, GENERATED_ACTIONS,
12
12
  import { REFERENCE_ANNOTATION, propertyDefinition, propertyOptionNames, unknownPropertyOptions, referenceTarget, } from "./property.js";
13
13
  import { AGENT_TOOL, AGENT_TOOL_VERBS, EXPLICIT_GRANT_ENTITIES, generatedActionPermissions, grants, isAllowed, MEMBER_AGENT_TOOLS, namesAgentTools, normalizePermission, parsePermission, parseWorkflowPermission, permissionOf, READ_VERB, rolesGranting, USER_IDENTITY_VERBS, USER_MEMBER_VERBS, WILDCARD, wildcardEntityCovers, WORKSPACE_SOURCE, WORKSPACE_SOURCE_PERMISSION, } from "./permissions.js";
14
14
  import { ON_DELETE, isRelationship } from "./relationship.js";
15
- import { isRole, member, role } from "./role.js";
15
+ import { implicitMemberOf, implicitRole, isImplicitRole, isRole, member, role, } from "./role.js";
16
16
  import { CHANNEL_PROVIDERS, DEFAULT_SIGN_IN_POLICY, GUEST_BOT_CHECK_SCHEMES, GUEST_CHANNELS, SIGN_UP_CHANNELS, SIGN_UP_CHAT_CHANNELS, isGuestBotCheckScheme, isGuestChannel, isSignInPolicy, isSignUpChannel, websiteOrigin, } from "./sign-in.js";
17
17
  import { BUILT_IN_EMAIL_VALUES, emailOptions, emailValueNames, SIGN_IN_CODE_VALUE, } from "./emails.js";
18
18
  import { AgentChat } from "./agent-chat.js";
19
19
  import { AgentReview } from "./agent-review.js";
20
20
  import { APP_FEEDBACK_ENTITIES } from "./app-feedback.js";
21
- import { feedbackOptions, feedbackRoles, checkFeedbackResponders, } from "./feedback-config.js";
21
+ import { feedbackOptions, feedbackRoles, checkFeedbackReporters, checkFeedbackResponders, } from "./feedback-config.js";
22
22
  import { User } from "./user.js";
23
23
  import { UserIdentity } from "./user-identity.js";
24
24
  import { authoringToWire } from "./authoring.js";
@@ -85,8 +85,7 @@ export function analyze(config, options = {}) {
85
85
  (!isPlainObject(config.hooks) ||
86
86
  Object.keys(config.hooks).some((key) => key !== "role") ||
87
87
  typeof config.hooks.role !== "string" ||
88
- nameToWire(config.hooks.role) === FEEDBACK_REPORTER_ROLE ||
89
- !declaredRoles.some((candidate) => candidate.name === nameToWire(config.hooks.role)))) {
88
+ !declaredRoles.some((candidate) => candidate.name === nameToWire(config.hooks.role) && !isImplicitRole(candidate)))) {
90
89
  report("invalid-permission", "hooks.role", "hooks.role must name a declared ontology role.");
91
90
  }
92
91
  const emails = emailOptions(config.emails, report, (name, path) => camelCaseName(name, path, "agreementReview", "Email", report));
@@ -293,7 +292,7 @@ export function analyze(config, options = {}) {
293
292
  // builder grant. Invalid authored scopes must remain errors; generated redundancy needs no warning.
294
293
  checkPermissions(resolved, roles, workflows, report, [
295
294
  ...declaredRoles,
296
- ...roles.filter((candidate) => candidate.name === FEEDBACK_REPORTER_ROLE),
295
+ ...roles.filter((candidate) => candidate.name === FEEDBACK_REPORTER_ROLE && isImplicitRole(candidate)),
297
296
  ...(guest === undefined ? [] : [guest.role]),
298
297
  ], toolsets);
299
298
  checkOpenWarehouseReads({ entities: resolved, roles, signIn, report });
@@ -308,6 +307,11 @@ export function analyze(config, options = {}) {
308
307
  }
309
308
  if (feedback.enabled) {
310
309
  checkFeedbackResponders(roles, report);
310
+ // @legacy ontology.implicit-member
311
+ // Feedback is on by default; only a workspace that turns it on is told nobody can report.
312
+ if (implicitMemberOf(roles) === undefined && config.feedback !== undefined) {
313
+ checkFeedbackReporters(roles.filter((candidate) => !BUILT_IN_GUESTS.has(candidate)), report);
314
+ }
311
315
  }
312
316
  if ((Object.values(signIn.channels ?? {}).includes("open") ||
313
317
  SIGN_UP_CHAT_CHANNELS.some((channel) => signIn.signUp?.channels[channel] !== undefined)) &&
@@ -460,7 +464,10 @@ function resolveWorkflows(input) {
460
464
  report("invalid-workflow", "workflows", `An ontology may declare at most ${MAX_WORKFLOWS} workflows; it declares ` +
461
465
  `${input.workflows.length}.`);
462
466
  }
463
- const memberPermissions = roles.find((candidate) => candidate.name === MEMBER_ROLE)?.permissions;
467
+ // @legacy ontology.implicit-member
468
+ // A workflow's runs hold the implicit member's permissions beside their own role's.
469
+ const implicit = implicitMemberOf(roles);
470
+ const memberPermissions = implicit?.permissions;
464
471
  const names = new Set();
465
472
  const resolved = [];
466
473
  input.workflows.forEach((candidate, index) => {
@@ -489,7 +496,9 @@ function resolveWorkflows(input) {
489
496
  }
490
497
  const role = typeof candidate.role === "string" ? nameToWire(candidate.role) : undefined;
491
498
  const declared = roles.find((existing) => existing.name === role);
492
- if (role === FEEDBACK_REPORTER_ROLE) {
499
+ if (declared !== undefined &&
500
+ declared.name === FEEDBACK_REPORTER_ROLE &&
501
+ isImplicitRole(declared)) {
493
502
  report("workflow_role_unknown", `${path}.role`, "feedback_reporter is implicit human authority and cannot be a workflow role.");
494
503
  valid = false;
495
504
  }
@@ -497,14 +506,14 @@ function resolveWorkflows(input) {
497
506
  report("workflow_role_unknown", `${path}.role`, "guest is the role of guests and cannot be a workflow role.");
498
507
  valid = false;
499
508
  }
500
- else if (role === MEMBER_ROLE) {
509
+ else if (declared !== undefined && declared === implicit) {
501
510
  report("workflow_role_is_member", `${path}.role`, "a workflow runs as a declared role of its own; its runs hold member's permissions " +
502
511
  "anyway, so name the role that adds what the workflow does.");
503
512
  valid = false;
504
513
  }
505
514
  else if (declared === undefined) {
506
515
  report("workflow_role_unknown", `${path}.role`, `${JSON.stringify(candidate.role) ?? "undefined"} is not a declared role; a workflow ` +
507
- "runs as one of the ontology's roles, other than member.");
516
+ "runs as one of the ontology's roles.");
508
517
  valid = false;
509
518
  }
510
519
  else if (Array.isArray(declared.permissions) && declared.permissions.includes("*:*")) {
@@ -517,12 +526,13 @@ function resolveWorkflows(input) {
517
526
  ...(Array.isArray(memberPermissions) ? memberPermissions : []),
518
527
  ...(Array.isArray(declared.permissions) ? declared.permissions : []),
519
528
  ])) {
520
- report("workflow_role_grants_nothing", `${path}.role`, `${declared.name}, with member's permissions, grants no action, so the workflow can only ` +
521
- "read; add the actions it runs to the role's permissions.", "warning");
529
+ report("workflow_role_grants_nothing", `${path}.role`, `${declared.name}${implicit === undefined ? "" : ", with member's permissions,"} grants ` +
530
+ "no action, so the workflow can at most read; add the actions it runs to the role's " +
531
+ "permissions.", "warning");
522
532
  }
523
533
  if (input.checkGrants &&
524
534
  declared !== undefined &&
525
- role !== MEMBER_ROLE &&
535
+ declared !== implicit &&
526
536
  (declared.scopes ?? []).length > 0) {
527
537
  const scoped = [...new Set((declared.scopes ?? []).map((scope) => scope.permission))];
528
538
  report("workflow_role_scoped", `${path}.role`, `${declared.name} scopes ${scoped.join(", ")}; bare me is the workflow service user's ID. ` +
@@ -1340,10 +1350,12 @@ function collectEntities(config, builtIns, report) {
1340
1350
  const REMOVED_ALLOW = "allow was removed: each action requires one permission (its permission option, by default " +
1341
1351
  "<entity>:<action name>), and roles grant permissions in their permissions list.";
1342
1352
  /** The built-in `member` role with the ontology's member permissions. */
1353
+ // @legacy ontology.implicit-member
1354
+ /** The implicit `member` while the definition declares `member`; none otherwise. */
1343
1355
  function memberRole(config, report) {
1344
1356
  const options = config.member;
1345
1357
  if (options === undefined) {
1346
- return member;
1358
+ return undefined;
1347
1359
  }
1348
1360
  if (!isPlainObject(options)) {
1349
1361
  report("missing-permissions", "member", 'member takes { permissions: ["*:read", …] }.');
@@ -1352,10 +1364,10 @@ function memberRole(config, report) {
1352
1364
  if ("allow" in options) {
1353
1365
  report("removed-allow", "member.allow", REMOVED_ALLOW);
1354
1366
  }
1355
- return role(MEMBER_ROLE, {
1367
+ return implicitRole(role(MEMBER_ROLE, {
1356
1368
  description: member.description,
1357
1369
  permissions: options.permissions,
1358
- });
1370
+ }));
1359
1371
  }
1360
1372
  /** The sign-in policy, which decides whether a stranger who signs in becomes a member. */
1361
1373
  function signInOptions(config, report) {
@@ -1508,7 +1520,11 @@ function signUpOptions(config, signIn, declaredRoles, report) {
1508
1520
  report("invalid-sign-in", `signUp.${key}`, `Unknown signUp key: ${key}.`);
1509
1521
  }
1510
1522
  }
1511
- const declared = new Set(declaredRoles.map((candidate) => candidate.name).filter((name) => name !== MEMBER_ROLE));
1523
+ const declared = new Set(declaredRoles
1524
+ .filter((candidate) => !isImplicitRole(candidate))
1525
+ .map((candidate) => candidate.name));
1526
+ // @legacy ontology.implicit-member
1527
+ const implicit = implicitMemberOf(declaredRoles) !== undefined;
1512
1528
  const roleNames = (value, path) => {
1513
1529
  if (!Array.isArray(value)) {
1514
1530
  report("invalid-sign-in", path, "Use a list of declared roles; [] grants none.");
@@ -1521,7 +1537,7 @@ function signUpOptions(config, signIn, declaredRoles, report) {
1521
1537
  : typeof candidate === "string"
1522
1538
  ? nameToWire(candidate)
1523
1539
  : undefined;
1524
- if (name === MEMBER_ROLE) {
1540
+ if (implicit && name === MEMBER_ROLE) {
1525
1541
  report("invalid-sign-in", `${path}[${index}]`, "member is the baseline of invited people; sign-up grants declared roles only.");
1526
1542
  }
1527
1543
  else if (name === undefined || !declared.has(name)) {
@@ -1923,18 +1939,27 @@ function checkSignUpAction(input) {
1923
1939
  }
1924
1940
  }
1925
1941
  function collectRoles(config, report) {
1926
- const roles = [memberRole(config, report)];
1942
+ const implicit = memberRole(config, report);
1943
+ const roles = implicit === undefined ? [] : [implicit];
1927
1944
  (config.roles ?? []).forEach((candidate, index) => {
1928
1945
  if (!isRole(candidate)) {
1929
1946
  report("invalid-role", `roles[${index}]`, "is not a role; declare roles with role(name, { description, permissions }).");
1930
1947
  return;
1931
1948
  }
1949
+ // @legacy ontology.implicit-member
1932
1950
  // Listing the built-in role is harmless: its permissions come from defineOntology({ member }).
1933
- if (candidate === member || roles.includes(candidate)) {
1951
+ if (implicit !== undefined && (candidate === member || roles.includes(candidate))) {
1934
1952
  return;
1935
1953
  }
1936
1954
  const path = `roles.${candidate.name}`;
1937
- if (candidate.name === MEMBER_ROLE || candidate.name === FEEDBACK_REPORTER_ROLE) {
1955
+ if (candidate === member) {
1956
+ report("invalid-role", `roles[${index}]`, "the built-in member exists only with defineOntology({ member }); declare a role of " +
1957
+ 'your own, such as role("team", { description, permissions }).');
1958
+ return;
1959
+ }
1960
+ // @legacy ontology.implicit-member
1961
+ if (implicit !== undefined &&
1962
+ (candidate.name === MEMBER_ROLE || candidate.name === FEEDBACK_REPORTER_ROLE)) {
1938
1963
  report("reserved-name", path, `${candidate.name} is a reserved built-in role.`);
1939
1964
  return;
1940
1965
  }
@@ -2826,7 +2851,7 @@ function listed(names) {
2826
2851
  return names.length === 1 ? names[0] : `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
2827
2852
  }
2828
2853
  function checkRolePermissions(candidate, verbs, workflows, report) {
2829
- const builtIn = candidate.name === MEMBER_ROLE || BUILT_IN_GUESTS.has(candidate);
2854
+ const builtIn = isImplicitRole(candidate) || BUILT_IN_GUESTS.has(candidate);
2830
2855
  const path = builtIn ? `${candidate.name}.permissions` : `roles.${candidate.name}.permissions`;
2831
2856
  const permissions = candidate.permissions;
2832
2857
  if (!Array.isArray(permissions)) {
@@ -2876,7 +2901,14 @@ function checkOpenWarehouseReads(input) {
2876
2901
  const warehouseBacked = entities
2877
2902
  .filter((candidate) => candidate.entity.definition.source !== undefined)
2878
2903
  .map((candidate) => candidate.name);
2879
- const memberPermissions = roles.find((candidate) => candidate.name === MEMBER_ROLE)?.permissions;
2904
+ const implicit = implicitMemberOf(roles);
2905
+ // @legacy ontology.legacy-channel-admission
2906
+ if (signIn.policy === "open" && implicit === undefined) {
2907
+ report("invalid-sign-in", "signIn.policy", "signIn policy open admits people with the built-in member, which only " +
2908
+ "defineOntology({ member }) declares; use signUp with the roles they get.");
2909
+ return;
2910
+ }
2911
+ const memberPermissions = implicit?.permissions;
2880
2912
  if (signIn.policy !== "open" ||
2881
2913
  warehouseBacked.length === 0 ||
2882
2914
  !Array.isArray(memberPermissions)) {
@@ -2908,7 +2940,7 @@ function checkOpenChannels(input) {
2908
2940
  report("invalid-sign-in", "member", `Open channels require explicit member permissions; ${hint}.`);
2909
2941
  return;
2910
2942
  }
2911
- const permissions = roles.find((candidate) => candidate.name === MEMBER_ROLE)?.permissions;
2943
+ const permissions = implicitMemberOf(roles)?.permissions;
2912
2944
  if (!Array.isArray(permissions)) {
2913
2945
  report("invalid-sign-in", "member.permissions", "Open channels require an explicit permissions array.");
2914
2946
  return;
@@ -2952,7 +2984,12 @@ function checkNewUserAction(input) {
2952
2984
  if (Result.isFailure(Schema.decodeUnknownResult(found.action.input)({}))) {
2953
2985
  fail("onNewUser cannot have required input; it is called with {}.");
2954
2986
  }
2955
- if (!isAllowed(found.permission, { permissions: roles[0]?.permissions ?? [] })) {
2987
+ const member = implicitMemberOf(roles);
2988
+ if (member === undefined) {
2989
+ fail("onNewUser runs with the built-in member, which only defineOntology({ member }) " +
2990
+ "declares; use signUp and onSignUp.");
2991
+ }
2992
+ else if (!isAllowed(found.permission, { permissions: member.permissions ?? [] })) {
2956
2993
  fail("onNewUser must be runnable by member.");
2957
2994
  }
2958
2995
  if (found.action.hints?.idempotent !== true) {
@@ -2979,7 +3016,7 @@ function checkAgentToolGrants(roles, report) {
2979
3016
  report("agent-tools-implicit", "roles", `no role names an ${AGENT_TOOL} permission, so the agent gives everyone it acts for, people ` +
2980
3017
  `who sign up included, its sandbox tools. From ${IMPLICIT_AGENT_SANDBOX_ENDS} only roles ` +
2981
3018
  `grant the agent's own tools: name ${named.slice(0, -1).join(", ")} or ${named.at(-1)} in ` +
2982
- "the roles that may use them, such as member's permissions.", "warning");
3019
+ "the roles that may use them.", "warning");
2983
3020
  }
2984
3021
  /** The member management verbs that act on members a page or an agent must first find. */
2985
3022
  const ROSTER_VERBS = ["invite", "grant_roles"];
@@ -2989,9 +3026,11 @@ const ROSTER_VERBS = ["invite", "grant_roles"];
2989
3026
  */
2990
3027
  function checkRosterReads(roles, report) {
2991
3028
  const permissionsOf = (candidate) => Array.isArray(candidate?.permissions) ? candidate.permissions : [];
2992
- const memberPermissions = permissionsOf(roles.find((candidate) => candidate.name === MEMBER_ROLE));
3029
+ // @legacy ontology.implicit-member
3030
+ const implicit = implicitMemberOf(roles);
3031
+ const memberPermissions = permissionsOf(implicit);
2993
3032
  for (const candidate of roles) {
2994
- const builtIn = candidate.name === MEMBER_ROLE;
3033
+ const builtIn = candidate === implicit;
2995
3034
  const permissions = builtIn
2996
3035
  ? memberPermissions
2997
3036
  : [...permissionsOf(candidate), ...memberPermissions];
@@ -3028,7 +3067,7 @@ function checkPermissions(entities, roles, workflows, report, authoredRoles = ro
3028
3067
  const checkable = parsed !== undefined && verbs.has(parsed.entity);
3029
3068
  if (checkable && rolesGranting(granting, permission).length === 0) {
3030
3069
  report("unreachable-action", `${candidate.name}.actions.${name}`, `no role grants ${permission}, so nobody can run this action; ` +
3031
- "add it to a role's permissions or to member's.", "warning");
3070
+ "add it to the permissions of a role that may run it.", "warning");
3032
3071
  }
3033
3072
  }
3034
3073
  }
@@ -3377,7 +3416,8 @@ function checkScopes(entities, roles, verbs, report) {
3377
3416
  (candidate.unusedScopes ?? []).length > 0)) {
3378
3417
  return;
3379
3418
  }
3380
- const memberRole = roles.find((candidate) => candidate.name === MEMBER_ROLE);
3419
+ // @legacy ontology.implicit-member
3420
+ const memberRole = implicitMemberOf(roles);
3381
3421
  const memberGrants = memberRole === undefined ? [] : unscopedPermissions(memberRole);
3382
3422
  let built;
3383
3423
  // The manifest of the entities, for their query schemas; a definition it cannot be built from
@@ -3395,7 +3435,7 @@ function checkScopes(entities, roles, verbs, report) {
3395
3435
  };
3396
3436
  for (const candidate of roles) {
3397
3437
  const scopes = Array.isArray(candidate.scopes) ? candidate.scopes : [];
3398
- const base = candidate.name === MEMBER_ROLE || BUILT_IN_GUESTS.has(candidate)
3438
+ const base = isImplicitRole(candidate) || BUILT_IN_GUESTS.has(candidate)
3399
3439
  ? candidate.name
3400
3440
  : `roles.${candidate.name}`;
3401
3441
  const unscoped = unscopedPermissions(candidate);
@@ -3414,7 +3454,7 @@ function checkScopes(entities, roles, verbs, report) {
3414
3454
  const permission = scope.permission;
3415
3455
  const own = unscoped.find((granted) => grants(granted, permission));
3416
3456
  // A guest never holds member.
3417
- const fromMember = candidate.name === MEMBER_ROLE || BUILT_IN_GUESTS.has(candidate)
3457
+ const fromMember = candidate === memberRole || BUILT_IN_GUESTS.has(candidate)
3418
3458
  ? undefined
3419
3459
  : memberGrants.find((granted) => grants(granted, permission));
3420
3460
  if (own !== undefined) {
@@ -1,10 +1,10 @@
1
1
  import { Schema } from "effect";
2
- export declare const DIAGNOSTIC_CODES: readonly ["invalid-source", "missing-column", "invalid-column", "invalid-scope", "invalid-scope-path", "scope-reads-all", "scope-unused", "scope-member-overlap", "source-with-actions", "source-with-index", "invalid-metric", "unknown-metric", "circular-metric", "invalid-join", "missing-join", "invalid-entity", "invalid-property", "invalid-relationship", "invalid-actions", "invalid-action", "invalid-action-input", "invalid-role", "invalid-name", "reserved-name", "duplicate-name", "invalid-entity-id", "duplicate-entity-id", "missing-label", "missing-description", "invalid-title", "invalid-options", "invalid-default", "invalid-constraint", "unknown-relationship-target", "inverse-collision", "invalid-on-delete", "invalid-phrase", "invalid-index", "unknown-reference", "invalid-renamed-from", "earlier-name", "invalid-guide", "invalid-writes", "generated-update-empty", "managed-without-effect", "missing-permissions", "invalid-permission", "unknown-permission", "removed-allow", "unreachable-action", "wildcard-permission", "invalid-sign-in", "invalid-inbox", "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", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"];
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-inbox", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "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", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"];
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-inbox", "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", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"]>;
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-inbox", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "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", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"]>;
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-inbox", "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", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"]>;
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-inbox", "invalid-connection", "invalid-feedback", "invalid-discovery", "invalid-email", "feedback-unanswerable", "feedback-unreportable", "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", "trigger_runs_invalid", "workflow_trigger_limit_exceeded", "workflow_webhook_duplicate", "workflow_webhook_input_invalid", "workflow_webhook_mixed_triggers", "workflow_webhook_signature_invalid", "workflow_webhook_verification_invalid", "workflow_webhook_headers_invalid", "workflow_webhook_limit_exceeded"]>;
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;
@@ -58,6 +58,7 @@ export const DIAGNOSTIC_CODES = [
58
58
  "invalid-discovery",
59
59
  "invalid-email",
60
60
  "feedback-unanswerable",
61
+ "feedback-unreportable",
61
62
  "agent-tools-implicit",
62
63
  "unknown-connection",
63
64
  "unused-connection",
package/dist/errors.d.ts CHANGED
@@ -58,6 +58,12 @@ declare const ActionRejected_base: Schema.Class<ActionRejected, Schema.TaggedStr
58
58
  readonly live: Schema.Int;
59
59
  readonly max: Schema.Int;
60
60
  }>]>>;
61
+ /**
62
+ * The request's idempotency key is spent on an operation that did not happen, such as a message
63
+ * the provider refused: the same key is refused again, and a new attempt takes a new key. Absent,
64
+ * a client that is unsure whether its request took effect retries with the same key.
65
+ */
66
+ readonly keyConsumed: Schema.optionalKey<Schema.Literal<true>>;
61
67
  }>, import("effect/Cause").YieldableError>;
62
68
  /**
63
69
  * An action refused the request for a business reason. The message is written for the caller and is