@segmentstream/ontology 0.135.0 → 0.136.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,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.136.0
4
+
5
+ Workspace secrets named in code give way to values of the connections that use them.
6
+
7
+ - A workspace channel names a verification value of its connection with
8
+ `channels.<name>.input`, such as `"input": "webhook_signing_secret"`, and its code's
9
+ `signedWith` and `matches` check deliveries against it.
10
+ - `check` warns `named-secret-deprecated` for a webhook's `signature.secret` or
11
+ `verification.verifyToken` and for the guests' `botCheck.secret`.
12
+ - `secret_ref(...)` is documented as the older form of a connection's own `Secret(...)`.
13
+ - Deploying a connection field changed from `secret_ref(name)` to its own `Secret(...)` makes the
14
+ workspace secret that field's value, without reading it, when nothing else the deployment
15
+ declares names it: nobody enters the value again, and a Telegram bot keeps its token and chats.
16
+
17
+ Action required: `secret_ref(name)` in `connections/connections.py`, including
18
+ `TelegramBotConnection(key="telegram", token=secret_ref("agent-telegram-token"))` from earlier
19
+ `segmentstream agent init` runs, stops working after 2027-01-19. Replace each with the field's own
20
+ `Secret(...)`, or `TelegramBotConnection(key="telegram")`, and deploy: the deploy takes the
21
+ workspace secret over as the field's value.
22
+
23
+ Action required: a webhook's `signature: { scheme, secret }` and
24
+ `verification: { scheme: "meta", verifyToken }` stop working after 2027-01-19. Declare the secret
25
+ as a verification value of the webhook's connection, `verification={"webhook_signing_secret":
26
+ Secret(...)}`, name the connection with `connection`, write `input: "webhook_signing_secret"`, and
27
+ paste the value on the connection's page; a WhatsApp number on the workspace's own Meta app
28
+ uses `WhatsAppConnection(key=..., application="own")`, which checks Meta's deliveries itself.
29
+
30
+ Action required: a workspace channel's `channels.<name>.secret` in `agent/segmentstream.json`
31
+ stops working after 2027-01-19. Declare the value on the channel's connection with
32
+ `verification={...}`, write `"input": "<field>"` instead, and paste it on the connection's page.
33
+
3
34
  ## 0.135.0
4
35
 
5
36
  `agent_chat.send` writes to a chat as the agent, without the sender attribution a post carries,
package/dist/analyze.js CHANGED
@@ -758,6 +758,10 @@ function resolveWorkflows(input) {
758
758
  }
759
759
  return resolved;
760
760
  }
761
+ /** @legacy ontology.webhook-named-secrets: the last day a webhook reads a workspace secret. */
762
+ const WEBHOOK_NAMED_SECRETS_END = "2027-01-19";
763
+ /** @legacy ontology.guest-bot-check-secret: the last day the bot check reads a workspace secret. */
764
+ const GUEST_BOT_CHECK_SECRET_ENDS = "2026-12-21";
761
765
  let deliveryJsonSchema;
762
766
  /**
763
767
  * The JSON Schema of `webhookDelivery`, the input every webhook-started workflow declares, as the
@@ -811,6 +815,26 @@ function resolveWebhookTrigger(trigger, at, scope) {
811
815
  valid = false;
812
816
  }
813
817
  }
818
+ // @legacy ontology.webhook-named-secrets
819
+ const named = [
820
+ ...(typeof signature === "object" &&
821
+ signature !== null &&
822
+ typeof signature.secret === "string"
823
+ ? [`${at}.signature.secret`]
824
+ : []),
825
+ ...(typeof verification === "object" &&
826
+ verification !== null &&
827
+ typeof verification.verifyToken === "string"
828
+ ? [`${at}.verification.verifyToken`]
829
+ : []),
830
+ ];
831
+ if (valid) {
832
+ for (const path of named) {
833
+ report("named-secret-deprecated", path, `a workspace secret works for a webhook only until ${WEBHOOK_NAMED_SECRETS_END}: declare ` +
834
+ "it as a verification value of the webhook's connection, " +
835
+ 'verification={"webhook_signing_secret": Secret(...)}, and name it with input.', "warning");
836
+ }
837
+ }
814
838
  const headers = trigger.headers;
815
839
  if (!Array.isArray(headers) || headers.length > MAX_WEBHOOK_HEADERS) {
816
840
  report("workflow_webhook_headers_invalid", `${at}.headers`, `headers is a list of at most ${MAX_WEBHOOK_HEADERS} lowercase header names.`);
@@ -1859,6 +1883,9 @@ function guestBotCheck(value, report, connections) {
1859
1883
  report("invalid-sign-in", "guest.botCheck.secret", `${JSON.stringify(secret) ?? "undefined"} is not a workspace secret name. ${shape}`);
1860
1884
  valid = false;
1861
1885
  }
1886
+ if (valid) {
1887
+ report("named-secret-deprecated", "guest.botCheck.secret", `a workspace secret works as the bot check's secret key only until ${GUEST_BOT_CHECK_SECRET_ENDS}. ${shape}`, "warning");
1888
+ }
1862
1889
  return valid && typeof secret === "string"
1863
1890
  ? { scheme: scheme, secret }
1864
1891
  : 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", "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"];
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", "named-secret-deprecated", "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", "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"]>;
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", "named-secret-deprecated", "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", "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"]>;
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", "named-secret-deprecated", "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;
@@ -60,6 +60,7 @@ export const DIAGNOSTIC_CODES = [
60
60
  "feedback-unanswerable",
61
61
  "feedback-unreportable",
62
62
  "agent-tools-implicit",
63
+ "named-secret-deprecated",
63
64
  "unknown-connection",
64
65
  "unused-connection",
65
66
  "invalid-prepare",
@@ -43,6 +43,7 @@ export function deployedWebhookTokenVerifier(environment, fetchImpl = fetch) {
43
43
  export function deployedSecretVerifier(environment, operation, fetchImpl) {
44
44
  const base = `${environment.segmentstreamUrl}/api/internal/v1/workspaces/` +
45
45
  `${encodeURIComponent(environment.workspaceId)}/`;
46
+ // @legacy ontology.webhook-named-secrets: a workspace secret is checked at secrets/{name}.
46
47
  const target = (request) => request.input === undefined
47
48
  ? `secrets/${encodeURIComponent(request.secret)}`
48
49
  : `connections/${encodeURIComponent(request.input.connection)}/inputs/` +
@@ -149,7 +149,11 @@ export type WebhookSignatureSecret = {
149
149
  readonly secret?: undefined;
150
150
  readonly input?: undefined;
151
151
  } | {
152
- /** A workspace secret's name, such as `stripe-webhook-signing-secret`. */
152
+ /**
153
+ * A workspace secret's name, such as `stripe-webhook-signing-secret`.
154
+ *
155
+ * @deprecated Name a verification value of the webhook's `connection` with `input`.
156
+ */
153
157
  readonly secret: string;
154
158
  readonly generated?: undefined;
155
159
  readonly input?: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.135.0",
3
+ "version": "0.136.0",
4
4
  "description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",