@segmentstream/ontology 0.114.0 → 0.116.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.116.0
4
+
5
+ A webhook trigger may name the connection whose provider sends to it:
6
+ `webhook("paymentEvents", { description, connection: nowpayments })`. The connection must be
7
+ listed in `defineOntology({ connections })`; `check` reports `invalid-connection` or
8
+ `unknown-connection` otherwise. The manifest records its key on the trigger, the workflow list
9
+ presents it as `connection`, and the console shows the webhook on the connection's page.
10
+
11
+ `webhookUrl(trigger)` returns a webhook's full URL in a production deployment, as
12
+ `segmentstream workflow webhooks` prints it: the workspace's domain, `/api/webhooks/<name>` and,
13
+ for a webhook without a signature, its token. Workspace code passes it to the provider through the
14
+ connection, as a payment's callback URL or to register an endpoint. It throws
15
+ `WebhookUrlUnavailable` in previews and local runs, which receive no webhooks. Call it in a step
16
+ or an action's `prepare`. Cloud sets the domain on deployments made after this release.
17
+
18
+ ## 0.115.0
19
+
20
+ The inbox: `defineOntology({ inbox: { roles: [client] } })` names the roles whose people's private
21
+ chats with the agent the workspace's staff work. Each such chat, on Telegram, WhatsApp, Slack
22
+ direct messages, email threads and workspace channels, becomes an `agent_chat` record of the new
23
+ managed `kind` `private` (group chats are `group`), with its person as its one member and the
24
+ `recipient` and `threadId` its replies use. The agent reports a chat when the answer to its
25
+ admission says the inbox takes the person, so registration needs no workspace code; the service
26
+ checks the person's roles again. Without `inbox`, no private chat is registered.
27
+
28
+ `chat_history`, and its route `POST /api/ontology/chat/history`, read such a chat by its record id.
29
+ A member with `agent_chat:read` whose scope holds the record reads its messages, whoever wrote
30
+ them: the service checks the caller against the record and asks the archive for that exact chat,
31
+ which returns messages, never the agent's tool calls. Its person reads the messages they took part
32
+ in, as in any private chat. Group chats, chat posts, the chat list and attachments behave as
33
+ before.
34
+
35
+ Before declaring `inbox`, check which roles hold `agent_chat:read`, and its
36
+ scopes. Once the inbox takes a role, an unscoped `agent_chat:read` also reads those people's
37
+ private chats and their messages; scope it, for example
38
+ `{ permission: "agent_chat:read", where: { kind: "private" } }`, to give staff only the inbox.
39
+
3
40
  ## 0.114.0
4
41
 
5
42
  `agent_tool:browser` is a built-in permission: roles that name it give their members the agent's
@@ -2,8 +2,11 @@ export declare const TELEGRAM = "telegram";
2
2
  /** Existing chat registry and membership storage; delivery lives in the ontology service. */
3
3
  export declare const AgentChat: import("./entity.js").Entity<"agent_chat", {
4
4
  readonly provider: import("./property.js").Property<string, false, false>;
5
+ readonly kind: import("./property.js").Property<"group" | "private", true, false>;
5
6
  readonly externalId: import("./property.js").Property<string, false, false>;
6
7
  readonly title: import("./property.js").Property<string, false, false>;
8
+ readonly recipient: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
9
+ readonly threadId: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
7
10
  readonly lastMessageAt: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
8
11
  readonly purpose: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
9
12
  readonly whenToUse: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
@@ -35,8 +38,11 @@ export declare const AgentChat: import("./entity.js").Entity<"agent_chat", {
35
38
  readonly createdBy: string | null;
36
39
  readonly updatedBy: string | null;
37
40
  readonly provider: string;
41
+ readonly kind: "group" | "private";
38
42
  readonly externalId: string;
39
43
  readonly title: string;
44
+ readonly recipient: string | null;
45
+ readonly threadId: string | null;
40
46
  readonly lastMessageAt: string | null;
41
47
  readonly purpose: string | null;
42
48
  readonly whenToUse: string | null;
@@ -12,14 +12,37 @@ export const AgentChat = entity("agent_chat", {
12
12
  label: "Agent chat",
13
13
  plural: "Agent chats",
14
14
  title: "title",
15
- description: "A group chat the workspace's agent is in. The agent records each chat it sees; " +
16
- "members say what the chat is for, so that agents know where to write.",
15
+ description: "A chat of the workspace's agent: a group chat it is in, which the agent records when it sees " +
16
+ "it and members say what it is for, so that agents know where to write; or a person's private " +
17
+ "chat with the agent, which the agent records for the workspace's staff when the ontology's " +
18
+ "inbox takes the person's role.",
17
19
  properties: {
18
20
  provider: p.text({ managed: true, description: "The channel, for example telegram." }),
21
+ kind: p.select([
22
+ { value: "group", description: "A group chat the agent is in." },
23
+ { value: "private", description: "A person's own chat with the agent." },
24
+ ], {
25
+ default: "group",
26
+ managed: true,
27
+ description: "Whether the chat is a group chat or a person's private chat with the agent.",
28
+ }),
19
29
  externalId: p.text({ managed: true, description: "The chat's id at the provider." }),
20
30
  title: p.text({
21
31
  managed: true,
22
- description: "The chat's name at the provider, kept current by the agent.",
32
+ description: "The chat's name at the provider, kept current by the agent: a private chat's is its " +
33
+ "person's name there.",
34
+ }),
35
+ recipient: p.text({
36
+ optional: true,
37
+ managed: true,
38
+ description: "Whom a reply in a private chat is sent to at the provider, where it differs from the " +
39
+ "chat's id.",
40
+ }),
41
+ threadId: p.text({
42
+ optional: true,
43
+ managed: true,
44
+ label: "Thread",
45
+ description: "The thread at the provider a reply in a private chat stays in.",
23
46
  }),
24
47
  lastMessageAt: p.timestamp({
25
48
  optional: true,
@@ -46,7 +69,8 @@ export const AgentChat = entity("agent_chat", {
46
69
  members: rel.many("user", {
47
70
  inverse: "agentChats",
48
71
  phrase: ["includes", "is in"],
49
- description: "Workspace members the agent has seen writing in the chat.",
72
+ description: "Workspace members the agent has seen writing in the chat; a private chat's one member " +
73
+ "is its person.",
50
74
  }),
51
75
  },
52
76
  indexes: [{ properties: ["provider", "externalId"], unique: true }],
@@ -39,7 +39,7 @@ export declare const AgentReview: import("./entity.js").Entity<"agent_review", {
39
39
  readonly channel: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
40
40
  readonly chatId: import("./property.js").Property<string, false, false>;
41
41
  readonly recipient: import("./property.js").Property<string, false, false>;
42
- readonly chatKind: import("./property.js").Property<"private" | "group", false, false>;
42
+ readonly chatKind: import("./property.js").Property<"group" | "private", false, false>;
43
43
  readonly threadId: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
44
44
  readonly replyTo: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
45
45
  readonly sessionId: import("./property.js").Property<string, false, false>;
@@ -80,7 +80,7 @@ export declare const AgentReview: import("./entity.js").Entity<"agent_review", {
80
80
  readonly channel: string | null;
81
81
  readonly chatId: string;
82
82
  readonly recipient: string;
83
- readonly chatKind: "private" | "group";
83
+ readonly chatKind: "group" | "private";
84
84
  readonly threadId: string | null;
85
85
  readonly replyTo: string | null;
86
86
  readonly sessionId: string;
package/dist/analyze.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ChatAttributionSettings } from "./chat.js";
1
+ import type { ChatAttributionSettings, InboxOptions } from "./chat.js";
2
2
  import { type ChatKind } from "./chat-channel.js";
3
3
  import type { ChatManifestInput } from "./manifest.js";
4
4
  import { Schema } from "effect";
@@ -101,6 +101,13 @@ export interface OntologyConfig<Entities extends ReadonlyArray<AnyEntity> = Read
101
101
  * through it, never a chat post.
102
102
  */
103
103
  readonly chat?: ChatConfig;
104
+ /**
105
+ * Whose private chats with the agent the workspace's staff work: `{ roles: [client] }`. The agent
106
+ * registers each private chat of a person holding one of these roles as an `agent_chat` record of
107
+ * kind `private`, which `agent_chat:read` within its scope reads with its messages. Absent, no
108
+ * private chat is registered and `agent_chat` holds group chats only.
109
+ */
110
+ readonly inbox?: InboxOptions<Role | string>;
104
111
  /**
105
112
  * Metrics of the model, by camelCase name: each combines metrics of entities, read with
106
113
  * `m.ref("entity.metric")`, or other model metrics, read with `m.ref("name")`, through
@@ -210,6 +217,10 @@ export interface ResolvedEntity {
210
217
  export interface Analysis {
211
218
  readonly feedback: ResolvedFeedback;
212
219
  readonly chat?: ChatManifestInput;
220
+ /** The wire names of the roles whose private chats join the inbox, when declared. */
221
+ readonly inbox?: {
222
+ readonly roles: ReadonlyArray<string>;
223
+ };
213
224
  readonly entities: ReadonlyArray<ResolvedEntity>;
214
225
  /** The workspace-owned `member` role and declared roles, then the implicit reporter when enabled. */
215
226
  readonly roles: ReadonlyArray<Role>;
package/dist/analyze.js CHANGED
@@ -102,6 +102,7 @@ export function analyze(config, options = {}) {
102
102
  ...(linkEmail === undefined ? {} : { linkEmail }),
103
103
  ...(codeEmail === undefined ? {} : { codeEmail }),
104
104
  };
105
+ const inbox = inboxOptions(config.inbox, declaredRoles, report);
105
106
  const discovery = config.discovery;
106
107
  if (discovery !== undefined &&
107
108
  (!isPlainObject(discovery) ||
@@ -329,8 +330,43 @@ export function analyze(config, options = {}) {
329
330
  toolsets,
330
331
  diagnostics,
331
332
  ...(chat === undefined ? {} : { chat }),
333
+ ...(inbox === undefined ? {} : { inbox }),
332
334
  };
333
335
  }
336
+ /**
337
+ * `inbox`: the wire names of the roles whose private chats join the inbox, each a declared role or
338
+ * `member`; `undefined` when absent or malformed.
339
+ */
340
+ function inboxOptions(value, declaredRoles, report) {
341
+ if (value === undefined) {
342
+ return undefined;
343
+ }
344
+ if (!isPlainObject(value) ||
345
+ Object.keys(value).some((key) => key !== "roles") ||
346
+ !Array.isArray(value.roles) ||
347
+ value.roles.length === 0) {
348
+ report("invalid-inbox", "inbox", "inbox takes { roles: [...] }, at least one role.");
349
+ return undefined;
350
+ }
351
+ const declared = new Set(declaredRoles.map((candidate) => candidate.name));
352
+ const roles = [];
353
+ let valid = true;
354
+ value.roles.forEach((candidate, index) => {
355
+ const name = isRole(candidate)
356
+ ? nameToWire(candidate.name)
357
+ : typeof candidate === "string"
358
+ ? nameToWire(candidate)
359
+ : undefined;
360
+ if (name === undefined || !declared.has(name)) {
361
+ report("invalid-inbox", `inbox.roles[${index}]`, "Use a role the ontology declares, or member.");
362
+ valid = false;
363
+ }
364
+ else if (!roles.includes(name)) {
365
+ roles.push(name);
366
+ }
367
+ });
368
+ return valid ? { roles } : undefined;
369
+ }
334
370
  /**
335
371
  * Warns where workspace code declares a field by the name an earlier SDK gave it, naming the current
336
372
  * one, so that authors move to it while the earlier name is still accepted.
@@ -549,7 +585,7 @@ function resolveWorkflows(input) {
549
585
  ? resolveCronTrigger(trigger, at, schema, wire, report)
550
586
  : trigger.kind === "action"
551
587
  ? resolveActionTrigger(trigger, at, entities, schema, wire, report)
552
- : resolveWebhookTrigger(trigger, at, report);
588
+ : resolveWebhookTrigger(trigger, at, scope);
553
589
  if (resolvedTrigger === undefined) {
554
590
  valid = false;
555
591
  }
@@ -636,7 +672,8 @@ export function webhookDeliveryJsonSchema() {
636
672
  * A webhook trigger's manifest form, without its name: the signature when declared and the headers
637
673
  * when listed. `undefined` after reporting a problem.
638
674
  */
639
- function resolveWebhookTrigger(trigger, at, report) {
675
+ function resolveWebhookTrigger(trigger, at, scope) {
676
+ const { report } = scope;
640
677
  let valid = true;
641
678
  const signature = trigger.signature;
642
679
  if (signature !== undefined) {
@@ -693,6 +730,17 @@ function resolveWebhookTrigger(trigger, at, report) {
693
730
  }
694
731
  }
695
732
  }
733
+ const connection = trigger.connection;
734
+ if (connection !== undefined) {
735
+ if (!isConnection(connection)) {
736
+ report("invalid-connection", `${at}.connection`, "is not a connection; declare it with connection(key, { … }).");
737
+ valid = false;
738
+ }
739
+ else if (!scope.connections.has(connection.key)) {
740
+ report("unknown-connection", `${at}.connection`, `the connection ${String(connection.key)} is not listed in defineOntology({ connections }).`);
741
+ valid = false;
742
+ }
743
+ }
696
744
  if (!valid) {
697
745
  return undefined;
698
746
  }
@@ -706,6 +754,7 @@ function resolveWebhookTrigger(trigger, at, report) {
706
754
  : { signature: { scheme: trigger.signature.scheme, secret: trigger.signature.secret } }),
707
755
  ...(trigger.verification === undefined ? {} : { verification: { ...trigger.verification } }),
708
756
  ...(listed.length === 0 ? {} : { headers: [...listed] }),
757
+ ...(trigger.connection === undefined ? {} : { connection: trigger.connection.key }),
709
758
  };
710
759
  }
711
760
  /**
package/dist/chat.d.ts CHANGED
@@ -3,6 +3,13 @@ export interface ChatAttributionSettings {
3
3
  readonly template?: string;
4
4
  readonly separator?: string;
5
5
  }
6
+ /**
7
+ * `inbox` of `defineOntology`: the roles of the people whose private chats with the agent the
8
+ * workspace's staff work, as `agent_chat` records of kind `private`.
9
+ */
10
+ export interface InboxOptions<R = unknown> {
11
+ readonly roles: ReadonlyArray<R>;
12
+ }
6
13
  import { Context, Effect, Schema } from "effect";
7
14
  import type { ActionError } from "./errors.js";
8
15
  export declare const ChatPostInput: Schema.Struct<{
@@ -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", "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"];
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", "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", "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"]>;
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", "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", "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"]>;
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", "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;
@@ -52,6 +52,7 @@ export const DIAGNOSTIC_CODES = [
52
52
  "unreachable-action",
53
53
  "wildcard-permission",
54
54
  "invalid-sign-in",
55
+ "invalid-inbox",
55
56
  "invalid-connection",
56
57
  "invalid-feedback",
57
58
  "invalid-discovery",
package/dist/index.d.ts CHANGED
@@ -24,14 +24,14 @@ export type { ActionsBuilder, AnyEntity, ActionHandle, ActionInvoker, MetricQuer
24
24
  export { ActionRejected, BatchErrorDetails, Conflict, DeploymentInterrupted, DeploymentSwitching, LimitErrorDetails, NotFound, PermissionDenied, ScopeViolated, } from "./errors.js";
25
25
  export type { ActionError } from "./errors.js";
26
26
  export { browserAuthenticationCompatible } from "./manifest-compatibility.js";
27
- export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isWebhookTrigger, OtherTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, signUpRolesOf, } from "./manifest.js";
27
+ export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isWebhookTrigger, OtherTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, inboxRolesOf, signUpRolesOf, } from "./manifest.js";
28
28
  export { SYSTEM_PROPERTIES } from "./names.js";
29
29
  export type { SystemProperty } from "./names.js";
30
30
  export { isMe, isMeMarker, MAX_ME_HOPS, me, ME_KEY, MeMarker, mePathOf, meToWire, MeTypeId, } from "./me.js";
31
31
  export type { MeReference } from "./me.js";
32
32
  export { check, defineOntology } from "./ontology.js";
33
33
  export { webhookDeliveryJsonSchema } from "./analyze.js";
34
- export { webhookToken, webhookTokenMatches, WEBHOOK_TOKEN_CONTEXT } from "./webhook-token.js";
34
+ export { webhookToken, webhookTokenMatches, webhookUrl, WebhookUrlUnavailable, WEBHOOK_ORIGIN_VARIABLE, WEBHOOK_TOKEN_CONTEXT, } from "./webhook-token.js";
35
35
  export type { Ontology } from "./ontology.js";
36
36
  export { AGENT_TOOL_VERBS, agentToolPermission, agentToolsOf, DEFAULT_MEMBER_PERMISSIONS, effectiveScope, generatedActionPermissions, grants, isAllowed, parsePermission, permissionsOf, principalScopes, READ_VERB, readScope, rolesGranting, scopesOf, USER_IDENTITY_VERBS, USER_MEMBER_VERBS, WILDCARD, WILDCARD_ENTITY_VERBS, WORKSPACE_SOURCE_PERMISSION, } from "./permissions.js";
37
37
  export type { AgentToolVerb, ParsedPermission, PermissionHolder, RolePermissions, ScopedPermission, ScopeFilter, ScopeValue, ScopeWhere, UserMemberVerb, } from "./permissions.js";
@@ -66,7 +66,7 @@ export { AppFeedback, AppFeedbackFile, APP_FEEDBACK_ENTITIES, APP_FEEDBACK_FILE_
66
66
  export { ChatDelivery, ChatPostInput, ChatPostResult } from "./chat.js";
67
67
  export { CHAT_CHANNEL_KINDS, CHAT_CHANNEL_NAME, CHAT_KINDS, WORKSPACE_CHANNEL_KIND, channelIdentityProvider, } from "./chat-channel.js";
68
68
  export type { ChatChannelKind, ChatKind } from "./chat-channel.js";
69
- export type { ReviewSendInput, ReviewSendResult } from "./chat.js";
69
+ export type { InboxOptions, ReviewSendInput, ReviewSendResult } from "./chat.js";
70
70
  export { DEFAULT_QUERY_LIMIT, entityQueryResultSchema, entityQuerySchema, entityQuerySchemas, entityRecordSchema, FILTER_OPERATORS, LIST_FILTER_OPERATORS, MANY_QUANTIFIERS, MAX_IN_VALUES, MAX_QUERY_LIMIT, OrderBy, Query, queryFields, queryJsonSchema, queryLinks, QueryResult, queryResultJsonSchema, queryResultSchema, SortDirection, WHERE_COMBINATORS, } from "./query.js";
71
71
  export type { EntityQuerySchemas, FieldFilter, FilterOperator, JsonRecord, ListFilterOperator, ManyFilter, QueryField, QueryLink, StorageType, Where, } from "./query.js";
72
72
  export { InvalidQuery, InvalidValues, MemberNotFound, PrincipalRejected, StoredRecordMismatch, UnknownAction, UnknownRole, ValidationIssue, UndeclaredWrite, WriteOutsideAction, } from "./runtime/errors.js";
package/dist/index.js CHANGED
@@ -13,12 +13,12 @@ export { entity, isEntity } from "./entity.js";
13
13
  export { isToolset, MCP_TOOL_NAME, TOOLSET_LOCK_VERSION, toolset, ToolsetLock, ToolsetLockTool, } from "./toolset.js";
14
14
  export { ActionRejected, BatchErrorDetails, Conflict, DeploymentInterrupted, DeploymentSwitching, LimitErrorDetails, NotFound, PermissionDenied, ScopeViolated, } from "./errors.js";
15
15
  export { browserAuthenticationCompatible } from "./manifest-compatibility.js";
16
- export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isWebhookTrigger, OtherTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, signUpRolesOf, } from "./manifest.js";
16
+ export { ActionManifest, actionConnectionKeys, canonicalJson, ConnectionManifest, EntityManifest, EntityPermissionsManifest, decodeManifestDocument, encodeManifest, formatManifest, IndexManifest, isValueMatched, MANIFEST_VERSION, manifestHash, ModelMetricManifest, OntologyManifest, OntologyManifestWire, PropertyManifest, RelationshipManifest, RoleManifest, ActionTriggerManifest, ScopeManifest, CronTriggerManifest, isActionTrigger, isCronTrigger, isWebhookTrigger, OtherTriggerManifest, WebhookTriggerManifest, WorkflowManifest, WorkflowTriggerManifest, SelectOptionManifest, SignInManifest, GuestManifest, guestOf, signInPolicyOf, channelPolicyOf, signUpOriginsOf, inboxRolesOf, signUpRolesOf, } from "./manifest.js";
17
17
  export { SYSTEM_PROPERTIES } from "./names.js";
18
18
  export { isMe, isMeMarker, MAX_ME_HOPS, me, ME_KEY, MeMarker, mePathOf, meToWire, MeTypeId, } from "./me.js";
19
19
  export { check, defineOntology } from "./ontology.js";
20
20
  export { webhookDeliveryJsonSchema } from "./analyze.js";
21
- export { webhookToken, webhookTokenMatches, WEBHOOK_TOKEN_CONTEXT } from "./webhook-token.js";
21
+ export { webhookToken, webhookTokenMatches, webhookUrl, WebhookUrlUnavailable, WEBHOOK_ORIGIN_VARIABLE, WEBHOOK_TOKEN_CONTEXT, } from "./webhook-token.js";
22
22
  export { AGENT_TOOL_VERBS, agentToolPermission, agentToolsOf, DEFAULT_MEMBER_PERMISSIONS, effectiveScope, generatedActionPermissions, grants, isAllowed, parsePermission, permissionsOf, principalScopes, READ_VERB, readScope, rolesGranting, scopesOf, USER_IDENTITY_VERBS, USER_MEMBER_VERBS, WILDCARD, WILDCARD_ENTITY_VERBS, WORKSPACE_SOURCE_PERMISSION, } from "./permissions.js";
23
23
  export { p, PROPERTY_TYPES, propertyDefinition } from "./property.js";
24
24
  export { ON_DELETE, rel } from "./relationship.js";