@segmentstream/ontology 0.128.1 → 0.130.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,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.130.0
4
+
5
+ Reply review now gives the workspace what it needs to learn from staff decisions, and gives the agent what became of its replies.
6
+
7
+ - **Reason for a rejection.** `agent_review.reject({ review, reason })` keeps a member's reason as the review's `reason`. `useInboxChat`'s `reject(reply, reason)` passes it. Neither the person nor the agent's chat with them sees it.
8
+ - **Workflows on reviews.** `after(...)` on `AgentReview.actions.approve` or `reject` runs a workspace workflow after a member's decision. `after(...)` on `AgentReview` with `when: (event) => event.action === "agent_review.hold"` runs one when the agent holds a reply, for example to tell reviewers. Holding starts these runs like an action does.
9
+ - **What the agent learns.** At its next turn, the agent's session gets a `<held_replies>` block for each reply it held: `waiting`, `sent` (`edited` when a member sent their own version), `uncertain` (approved, but delivery is in doubt) or `not_sent`. It now goes on from what the person actually saw, without learning anything a member wrote. The ontology service answers it at `POST /api/ontology/agent/reviews/session`. An ontology service that predates the route answers nothing, and the agent behaves as before.
10
+
11
+ ## 0.129.0
12
+
13
+ A provider's secret for checking what it sends, such as a webhook signing secret, lives on its
14
+ connection. `ApiKeyConnection(verification={"webhook_signing_secret": Secret(...)})` declares it;
15
+ members set it on the connection's page, the backend never sends it, request signing and
16
+ workspace code never read it, and an unset value never stops requests. `StripeConnection` and
17
+ `ResendConnection` declare `webhook_signing_secret`. The connections manifest moves to schema 24.
18
+
19
+ A webhook that names its `connection` checks deliveries against such a value with
20
+ `signature: { scheme, input: "webhook_signing_secret" }`, and Meta's registration token with
21
+ `verification: { scheme: "meta", input }`. Naming a workspace secret with `secret` or
22
+ `verifyToken` is the older form.
23
+
3
24
  ## 0.128.1
4
25
 
5
26
  A `find` MCP tool's `where` reads `{ "$me": [] }` on a to-one relationship also when it is combined
@@ -33,6 +33,8 @@ export declare const AGENT_REVIEW_MODES: readonly [{
33
33
  }];
34
34
  /** The longest reply a review holds; a provider may accept less in one message. */
35
35
  export declare const AGENT_REVIEW_TEXT_LIMIT = 20000;
36
+ /** The longest reason a member gives for rejecting a reply. */
37
+ export declare const AGENT_REVIEW_REASON_LIMIT = 2000;
36
38
  export declare const AgentReview: import("./entity.js").Entity<"agent_review", {
37
39
  readonly key: import("./property.js").Property<string, false, true>;
38
40
  readonly provider: import("./property.js").Property<string, false, false>;
@@ -50,6 +52,7 @@ export declare const AgentReview: import("./entity.js").Entity<"agent_review", {
50
52
  readonly confidence: Schema.optionalKey<import("./property.js").Property<number, false, false>>;
51
53
  readonly messageId: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
52
54
  readonly decidedAt: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
55
+ readonly reason: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
53
56
  }, {
54
57
  readonly person: import("./relationship.js").OneRelationship<false, false, "user">;
55
58
  readonly decidedBy: import("./relationship.js").OneRelationship<true, false, "user">;
@@ -66,6 +69,7 @@ export declare const AgentReview: import("./entity.js").Entity<"agent_review", {
66
69
  }>;
67
70
  readonly reject: import("./action.js").Action<Schema.Struct<{
68
71
  readonly review: Schema.Codec<string, string, never, never>;
72
+ readonly reason: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
69
73
  }>, {
70
74
  review: string;
71
75
  status: "rejected";
@@ -92,6 +96,7 @@ export declare const AgentReview: import("./entity.js").Entity<"agent_review", {
92
96
  readonly confidence: number | null;
93
97
  readonly messageId: string | null;
94
98
  readonly decidedAt: string | null;
99
+ readonly reason: string | null;
95
100
  readonly personId: string;
96
101
  readonly decidedById: string | null;
97
102
  readonly agentChatId: string | null;
@@ -33,6 +33,8 @@ export const AGENT_REVIEW_MODES = [
33
33
  ];
34
34
  /** The longest reply a review holds; a provider may accept less in one message. */
35
35
  export const AGENT_REVIEW_TEXT_LIMIT = 20_000;
36
+ /** The longest reason a member gives for rejecting a reply. */
37
+ export const AGENT_REVIEW_REASON_LIMIT = 2_000;
36
38
  export const AgentReview = entity("agent_review", {
37
39
  id: "ent_agent_review",
38
40
  label: "Agent reply review",
@@ -118,6 +120,14 @@ export const AgentReview = entity("agent_review", {
118
120
  label: "Decided",
119
121
  description: "When a member approved or rejected the reply.",
120
122
  }),
123
+ reason: p.text({
124
+ optional: true,
125
+ managed: true,
126
+ maxLength: AGENT_REVIEW_REASON_LIMIT,
127
+ display: "multiline",
128
+ description: "Why the member rejected the reply, when they said: for the workspace's own review of " +
129
+ "the agent's replies. The person and the agent's chat with them never see it.",
130
+ }),
121
131
  },
122
132
  relationships: {
123
133
  // By name, so that an ontology rebuilt with the deployed `user` still resolves it.
@@ -143,7 +153,7 @@ export const AgentReview = entity("agent_review", {
143
153
  "is in, or a person's private chat in the inbox. Empty when the chat is not registered.",
144
154
  }),
145
155
  },
146
- indexes: [{ properties: ["status"] }],
156
+ indexes: [{ properties: ["status"] }, { properties: ["sessionId"] }],
147
157
  }).actions((self) => ({
148
158
  approve: action({
149
159
  description: "Send a reply the agent held for review to the person, as written or with your edit in " +
@@ -193,10 +203,17 @@ export const AgentReview = entity("agent_review", {
193
203
  }),
194
204
  }),
195
205
  reject: action({
196
- description: "Discard a reply the agent held for review: the person never sees it. A review already " +
197
- "approved is refused.",
206
+ description: "Discard a reply the agent held for review: the person never sees it. Say why in reason " +
207
+ "when the member gives one; it stays with the review and never reaches the person or the " +
208
+ "agent's chat with them. A review already approved is refused.",
198
209
  hints: { destructive: true, irreversible: false, idempotent: true },
199
- input: Schema.Struct({ review: self.ref }),
210
+ input: Schema.Struct({
211
+ review: self.ref,
212
+ reason: Schema.optionalKey(p.text({
213
+ maxLength: AGENT_REVIEW_REASON_LIMIT,
214
+ description: "Why the reply should not be sent, in the member's words.",
215
+ })),
216
+ }),
200
217
  handler: ({ input, principal }) => Effect.gen(function* () {
201
218
  const review = yield* self.get(input.review, { forUpdate: true });
202
219
  if (review.status === "rejected") {
@@ -207,10 +224,12 @@ export const AgentReview = entity("agent_review", {
207
224
  message: "The reply was already approved and sent; it cannot be rejected.",
208
225
  });
209
226
  }
227
+ const reason = input.reason?.trim();
210
228
  yield* self.update(review, {
211
229
  status: "rejected",
212
230
  decidedAt: new Date().toISOString(),
213
231
  decidedBy: principal.id,
232
+ ...(reason === undefined || reason === "" ? {} : { reason }),
214
233
  });
215
234
  return { review: review.id, status: "rejected" };
216
235
  }),
package/dist/analyze.js CHANGED
@@ -29,7 +29,7 @@ import { entityQuerySchemas, findEntityManifest, queryFields, queryLinks, } from
29
29
  import { EARLIER_QUERY_METRICS_ROUTE, earlierNamesOf } from "./legacy.js";
30
30
  import { resolveModelMetrics } from "./model-metrics.js";
31
31
  import { cronNeverFires, cronProblem, isAsyncFunction, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_WORKFLOWS, } from "./workflow.js";
32
- import { MAX_WEBHOOK_HEADERS, MAX_WEBHOOKS, webhookDelivery, webhookHeaderProblem, webhookSignatureManifest, webhookSignatureProblems, WORKSPACE_SECRET_NAME, } from "./webhooks.js";
32
+ import { MAX_WEBHOOK_HEADERS, MAX_WEBHOOKS, webhookDelivery, webhookHeaderProblem, CONNECTION_INPUT_KEY, webhookSignatureManifest, webhookSignatureProblems, WORKSPACE_SECRET_NAME, } from "./webhooks.js";
33
33
  import { actionInputToWire } from "./authoring-input.js";
34
34
  import { validate } from "./runtime/validation.js";
35
35
  import { fixedArgumentsConflict, isToolset, MAXIMUM_TOOLSET_TOOLS, MCP_TOOL_NAME, toolHints, ToolsetLock, withoutFixedArguments, } from "./toolset.js";
@@ -779,16 +779,33 @@ function resolveWebhookTrigger(trigger, at, scope) {
779
779
  valid = false;
780
780
  }
781
781
  }
782
+ // A connection's verification value is read from the connection the webhook names.
783
+ if (typeof signature === "object" &&
784
+ signature !== null &&
785
+ signature.input !== undefined &&
786
+ trigger.connection === undefined) {
787
+ report("workflow_webhook_signature_invalid", `${at}.signature.input`, "input names a verification value of the webhook's connection: set connection too.");
788
+ valid = false;
789
+ }
782
790
  const verification = trigger.verification;
783
791
  if (verification !== undefined) {
784
792
  const declared = verification;
793
+ const source = typeof declared === "object" && declared !== null
794
+ ? declared.input !== undefined
795
+ ? declared.verifyToken === undefined &&
796
+ typeof declared.input === "string" &&
797
+ CONNECTION_INPUT_KEY.test(declared.input) &&
798
+ trigger.connection !== undefined
799
+ : typeof declared.verifyToken === "string" &&
800
+ WORKSPACE_SECRET_NAME.test(declared.verifyToken)
801
+ : false;
785
802
  if (typeof declared !== "object" ||
786
803
  declared === null ||
787
804
  declared.scheme !== "meta" ||
788
- typeof declared.verifyToken !== "string" ||
789
- !WORKSPACE_SECRET_NAME.test(declared.verifyToken) ||
805
+ !source ||
790
806
  trigger.signature?.scheme !== "meta") {
791
- report("workflow_webhook_verification_invalid", `${at}.verification`, 'Use { scheme: "meta", verifyToken: <workspace secret name> } with a Meta signature.');
807
+ report("workflow_webhook_verification_invalid", `${at}.verification`, 'Use { scheme: "meta", input: <verification value of the webhook\'s connection> } ' +
808
+ "with a Meta signature.");
792
809
  valid = false;
793
810
  }
794
811
  }
@@ -481,10 +481,12 @@ export declare const WebhookTriggerManifest: Schema.Struct<{
481
481
  readonly description: Schema.String;
482
482
  readonly signature: Schema.optionalKey<Schema.Struct<{
483
483
  readonly scheme: Schema.String;
484
- /** The workspace secret's name; absent when the secret is `generated`. */
484
+ /** The workspace secret's name; absent when the secret is `generated` or an `input`. */
485
485
  readonly secret: Schema.optionalKey<Schema.String>;
486
486
  /** The platform derives the secret for the webhook; workspace code registers it. */
487
487
  readonly generated: Schema.optionalKey<Schema.Literal<true>>;
488
+ /** The verification value of the webhook's `connection` that holds the secret. */
489
+ readonly input: Schema.optionalKey<Schema.String>;
488
490
  readonly algorithm: Schema.optionalKey<Schema.String>;
489
491
  readonly encoding: Schema.optionalKey<Schema.String>;
490
492
  readonly key: Schema.optionalKey<Schema.Struct<{
@@ -516,7 +518,10 @@ export declare const WebhookTriggerManifest: Schema.Struct<{
516
518
  }>>;
517
519
  readonly verification: Schema.optionalKey<Schema.Struct<{
518
520
  readonly scheme: Schema.String;
519
- readonly verifyToken: Schema.String;
521
+ /** The workspace secret holding the token; absent when the token is an `input`. */
522
+ readonly verifyToken: Schema.optionalKey<Schema.String>;
523
+ /** The verification value of the webhook's `connection` that holds the token. */
524
+ readonly input: Schema.optionalKey<Schema.String>;
520
525
  }>>;
521
526
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
522
527
  /** The key of the connection whose provider sends to the webhook, when declared. */
@@ -552,10 +557,12 @@ export declare const WorkflowTriggerManifest: Schema.Union<readonly [Schema.Stru
552
557
  readonly description: Schema.String;
553
558
  readonly signature: Schema.optionalKey<Schema.Struct<{
554
559
  readonly scheme: Schema.String;
555
- /** The workspace secret's name; absent when the secret is `generated`. */
560
+ /** The workspace secret's name; absent when the secret is `generated` or an `input`. */
556
561
  readonly secret: Schema.optionalKey<Schema.String>;
557
562
  /** The platform derives the secret for the webhook; workspace code registers it. */
558
563
  readonly generated: Schema.optionalKey<Schema.Literal<true>>;
564
+ /** The verification value of the webhook's `connection` that holds the secret. */
565
+ readonly input: Schema.optionalKey<Schema.String>;
559
566
  readonly algorithm: Schema.optionalKey<Schema.String>;
560
567
  readonly encoding: Schema.optionalKey<Schema.String>;
561
568
  readonly key: Schema.optionalKey<Schema.Struct<{
@@ -587,7 +594,10 @@ export declare const WorkflowTriggerManifest: Schema.Union<readonly [Schema.Stru
587
594
  }>>;
588
595
  readonly verification: Schema.optionalKey<Schema.Struct<{
589
596
  readonly scheme: Schema.String;
590
- readonly verifyToken: Schema.String;
597
+ /** The workspace secret holding the token; absent when the token is an `input`. */
598
+ readonly verifyToken: Schema.optionalKey<Schema.String>;
599
+ /** The verification value of the webhook's `connection` that holds the token. */
600
+ readonly input: Schema.optionalKey<Schema.String>;
591
601
  }>>;
592
602
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
593
603
  /** The key of the connection whose provider sends to the webhook, when declared. */
@@ -630,10 +640,12 @@ export declare const WorkflowManifest: Schema.Struct<{
630
640
  readonly description: Schema.String;
631
641
  readonly signature: Schema.optionalKey<Schema.Struct<{
632
642
  readonly scheme: Schema.String;
633
- /** The workspace secret's name; absent when the secret is `generated`. */
643
+ /** The workspace secret's name; absent when the secret is `generated` or an `input`. */
634
644
  readonly secret: Schema.optionalKey<Schema.String>;
635
645
  /** The platform derives the secret for the webhook; workspace code registers it. */
636
646
  readonly generated: Schema.optionalKey<Schema.Literal<true>>;
647
+ /** The verification value of the webhook's `connection` that holds the secret. */
648
+ readonly input: Schema.optionalKey<Schema.String>;
637
649
  readonly algorithm: Schema.optionalKey<Schema.String>;
638
650
  readonly encoding: Schema.optionalKey<Schema.String>;
639
651
  readonly key: Schema.optionalKey<Schema.Struct<{
@@ -665,7 +677,10 @@ export declare const WorkflowManifest: Schema.Struct<{
665
677
  }>>;
666
678
  readonly verification: Schema.optionalKey<Schema.Struct<{
667
679
  readonly scheme: Schema.String;
668
- readonly verifyToken: Schema.String;
680
+ /** The workspace secret holding the token; absent when the token is an `input`. */
681
+ readonly verifyToken: Schema.optionalKey<Schema.String>;
682
+ /** The verification value of the webhook's `connection` that holds the token. */
683
+ readonly input: Schema.optionalKey<Schema.String>;
669
684
  }>>;
670
685
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
671
686
  /** The key of the connection whose provider sends to the webhook, when declared. */
@@ -1337,10 +1352,12 @@ export declare const OntologyManifestWire: Schema.encodeKeys<Schema.Struct<{
1337
1352
  readonly description: Schema.String;
1338
1353
  readonly signature: Schema.optionalKey<Schema.Struct<{
1339
1354
  readonly scheme: Schema.String;
1340
- /** The workspace secret's name; absent when the secret is `generated`. */
1355
+ /** The workspace secret's name; absent when the secret is `generated` or an `input`. */
1341
1356
  readonly secret: Schema.optionalKey<Schema.String>;
1342
1357
  /** The platform derives the secret for the webhook; workspace code registers it. */
1343
1358
  readonly generated: Schema.optionalKey<Schema.Literal<true>>;
1359
+ /** The verification value of the webhook's `connection` that holds the secret. */
1360
+ readonly input: Schema.optionalKey<Schema.String>;
1344
1361
  readonly algorithm: Schema.optionalKey<Schema.String>;
1345
1362
  readonly encoding: Schema.optionalKey<Schema.String>;
1346
1363
  readonly key: Schema.optionalKey<Schema.Struct<{
@@ -1372,7 +1389,10 @@ export declare const OntologyManifestWire: Schema.encodeKeys<Schema.Struct<{
1372
1389
  }>>;
1373
1390
  readonly verification: Schema.optionalKey<Schema.Struct<{
1374
1391
  readonly scheme: Schema.String;
1375
- readonly verifyToken: Schema.String;
1392
+ /** The workspace secret holding the token; absent when the token is an `input`. */
1393
+ readonly verifyToken: Schema.optionalKey<Schema.String>;
1394
+ /** The verification value of the webhook's `connection` that holds the token. */
1395
+ readonly input: Schema.optionalKey<Schema.String>;
1376
1396
  }>>;
1377
1397
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
1378
1398
  /** The key of the connection whose provider sends to the webhook, when declared. */
@@ -1634,6 +1654,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
1634
1654
  readonly tolerance?: number | undefined;
1635
1655
  readonly header?: string | undefined;
1636
1656
  } | undefined;
1657
+ readonly input?: string | undefined;
1637
1658
  readonly generated?: true | undefined;
1638
1659
  readonly algorithm?: string | undefined;
1639
1660
  readonly encoding?: string | undefined;
@@ -1650,7 +1671,8 @@ export declare const OntologyManifest: Schema.declareConstructor<{
1650
1671
  } | undefined;
1651
1672
  readonly verification?: {
1652
1673
  readonly scheme: string;
1653
- readonly verifyToken: string;
1674
+ readonly input?: string | undefined;
1675
+ readonly verifyToken?: string | undefined;
1654
1676
  } | undefined;
1655
1677
  } | {
1656
1678
  readonly [x: string]: Schema.Json;
@@ -1983,6 +2005,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
1983
2005
  readonly tolerance?: number | undefined;
1984
2006
  readonly header?: string | undefined;
1985
2007
  } | undefined;
2008
+ readonly input?: string | undefined;
1986
2009
  readonly generated?: true | undefined;
1987
2010
  readonly algorithm?: string | undefined;
1988
2011
  readonly encoding?: string | undefined;
@@ -1999,7 +2022,8 @@ export declare const OntologyManifest: Schema.declareConstructor<{
1999
2022
  } | undefined;
2000
2023
  readonly verification?: {
2001
2024
  readonly scheme: string;
2002
- readonly verifyToken: string;
2025
+ readonly input?: string | undefined;
2026
+ readonly verifyToken?: string | undefined;
2003
2027
  } | undefined;
2004
2028
  } | {
2005
2029
  readonly [x: string]: Schema.Json;
@@ -2334,6 +2358,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2334
2358
  readonly tolerance?: number | undefined;
2335
2359
  readonly header?: string | undefined;
2336
2360
  } | undefined;
2361
+ readonly input?: string | undefined;
2337
2362
  readonly generated?: true | undefined;
2338
2363
  readonly algorithm?: string | undefined;
2339
2364
  readonly encoding?: string | undefined;
@@ -2350,7 +2375,8 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2350
2375
  } | undefined;
2351
2376
  readonly verification?: {
2352
2377
  readonly scheme: string;
2353
- readonly verifyToken: string;
2378
+ readonly input?: string | undefined;
2379
+ readonly verifyToken?: string | undefined;
2354
2380
  } | undefined;
2355
2381
  })[];
2356
2382
  readonly action?: {
@@ -2683,6 +2709,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2683
2709
  readonly tolerance?: number | undefined;
2684
2710
  readonly header?: string | undefined;
2685
2711
  } | undefined;
2712
+ readonly input?: string | undefined;
2686
2713
  readonly generated?: true | undefined;
2687
2714
  readonly algorithm?: string | undefined;
2688
2715
  readonly encoding?: string | undefined;
@@ -2699,7 +2726,8 @@ export declare const OntologyManifest: Schema.declareConstructor<{
2699
2726
  } | undefined;
2700
2727
  readonly verification?: {
2701
2728
  readonly scheme: string;
2702
- readonly verifyToken: string;
2729
+ readonly input?: string | undefined;
2730
+ readonly verifyToken?: string | undefined;
2703
2731
  } | undefined;
2704
2732
  })[];
2705
2733
  readonly action?: {
@@ -3213,10 +3241,12 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3213
3241
  readonly description: Schema.String;
3214
3242
  readonly signature: Schema.optionalKey<Schema.Struct<{
3215
3243
  readonly scheme: Schema.String;
3216
- /** The workspace secret's name; absent when the secret is `generated`. */
3244
+ /** The workspace secret's name; absent when the secret is `generated` or an `input`. */
3217
3245
  readonly secret: Schema.optionalKey<Schema.String>;
3218
3246
  /** The platform derives the secret for the webhook; workspace code registers it. */
3219
3247
  readonly generated: Schema.optionalKey<Schema.Literal<true>>;
3248
+ /** The verification value of the webhook's `connection` that holds the secret. */
3249
+ readonly input: Schema.optionalKey<Schema.String>;
3220
3250
  readonly algorithm: Schema.optionalKey<Schema.String>;
3221
3251
  readonly encoding: Schema.optionalKey<Schema.String>;
3222
3252
  readonly key: Schema.optionalKey<Schema.Struct<{
@@ -3248,7 +3278,10 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3248
3278
  }>>;
3249
3279
  readonly verification: Schema.optionalKey<Schema.Struct<{
3250
3280
  readonly scheme: Schema.String;
3251
- readonly verifyToken: Schema.String;
3281
+ /** The workspace secret holding the token; absent when the token is an `input`. */
3282
+ readonly verifyToken: Schema.optionalKey<Schema.String>;
3283
+ /** The verification value of the webhook's `connection` that holds the token. */
3284
+ readonly input: Schema.optionalKey<Schema.String>;
3252
3285
  }>>;
3253
3286
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
3254
3287
  /** The key of the connection whose provider sends to the webhook, when declared. */
@@ -3680,10 +3713,12 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3680
3713
  readonly description: Schema.String;
3681
3714
  readonly signature: Schema.optionalKey<Schema.Struct<{
3682
3715
  readonly scheme: Schema.String;
3683
- /** The workspace secret's name; absent when the secret is `generated`. */
3716
+ /** The workspace secret's name; absent when the secret is `generated` or an `input`. */
3684
3717
  readonly secret: Schema.optionalKey<Schema.String>;
3685
3718
  /** The platform derives the secret for the webhook; workspace code registers it. */
3686
3719
  readonly generated: Schema.optionalKey<Schema.Literal<true>>;
3720
+ /** The verification value of the webhook's `connection` that holds the secret. */
3721
+ readonly input: Schema.optionalKey<Schema.String>;
3687
3722
  readonly algorithm: Schema.optionalKey<Schema.String>;
3688
3723
  readonly encoding: Schema.optionalKey<Schema.String>;
3689
3724
  readonly key: Schema.optionalKey<Schema.Struct<{
@@ -3715,7 +3750,10 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3715
3750
  }>>;
3716
3751
  readonly verification: Schema.optionalKey<Schema.Struct<{
3717
3752
  readonly scheme: Schema.String;
3718
- readonly verifyToken: Schema.String;
3753
+ /** The workspace secret holding the token; absent when the token is an `input`. */
3754
+ readonly verifyToken: Schema.optionalKey<Schema.String>;
3755
+ /** The verification value of the webhook's `connection` that holds the token. */
3756
+ readonly input: Schema.optionalKey<Schema.String>;
3719
3757
  }>>;
3720
3758
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
3721
3759
  /** The key of the connection whose provider sends to the webhook, when declared. */
@@ -3969,6 +4007,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3969
4007
  readonly tolerance?: number | undefined;
3970
4008
  readonly header?: string | undefined;
3971
4009
  } | undefined;
4010
+ readonly input?: string | undefined;
3972
4011
  readonly generated?: true | undefined;
3973
4012
  readonly algorithm?: string | undefined;
3974
4013
  readonly encoding?: string | undefined;
@@ -3985,7 +4024,8 @@ export declare const OntologyManifest: Schema.declareConstructor<{
3985
4024
  } | undefined;
3986
4025
  readonly verification?: {
3987
4026
  readonly scheme: string;
3988
- readonly verifyToken: string;
4027
+ readonly input?: string | undefined;
4028
+ readonly verifyToken?: string | undefined;
3989
4029
  } | undefined;
3990
4030
  } | {
3991
4031
  readonly [x: string]: Schema.Json;
@@ -4318,6 +4358,7 @@ export declare const OntologyManifest: Schema.declareConstructor<{
4318
4358
  readonly tolerance?: number | undefined;
4319
4359
  readonly header?: string | undefined;
4320
4360
  } | undefined;
4361
+ readonly input?: string | undefined;
4321
4362
  readonly generated?: true | undefined;
4322
4363
  readonly algorithm?: string | undefined;
4323
4364
  readonly encoding?: string | undefined;
@@ -4334,7 +4375,8 @@ export declare const OntologyManifest: Schema.declareConstructor<{
4334
4375
  } | undefined;
4335
4376
  readonly verification?: {
4336
4377
  readonly scheme: string;
4337
- readonly verifyToken: string;
4378
+ readonly input?: string | undefined;
4379
+ readonly verifyToken?: string | undefined;
4338
4380
  } | undefined;
4339
4381
  } | {
4340
4382
  readonly [x: string]: Schema.Json;
@@ -4673,6 +4715,7 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
4673
4715
  readonly tolerance?: number | undefined;
4674
4716
  readonly header?: string | undefined;
4675
4717
  } | undefined;
4718
+ readonly input?: string | undefined;
4676
4719
  readonly generated?: true | undefined;
4677
4720
  readonly algorithm?: string | undefined;
4678
4721
  readonly encoding?: string | undefined;
@@ -4689,7 +4732,8 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
4689
4732
  } | undefined;
4690
4733
  readonly verification?: {
4691
4734
  readonly scheme: string;
4692
- readonly verifyToken: string;
4735
+ readonly input?: string | undefined;
4736
+ readonly verifyToken?: string | undefined;
4693
4737
  } | undefined;
4694
4738
  } | {
4695
4739
  readonly [x: string]: Schema.Json;
@@ -5022,6 +5066,7 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
5022
5066
  readonly tolerance?: number | undefined;
5023
5067
  readonly header?: string | undefined;
5024
5068
  } | undefined;
5069
+ readonly input?: string | undefined;
5025
5070
  readonly generated?: true | undefined;
5026
5071
  readonly algorithm?: string | undefined;
5027
5072
  readonly encoding?: string | undefined;
@@ -5038,7 +5083,8 @@ export declare const decodeManifestDocument: (value: unknown) => Effect.Effect<{
5038
5083
  } | undefined;
5039
5084
  readonly verification?: {
5040
5085
  readonly scheme: string;
5041
- readonly verifyToken: string;
5086
+ readonly input?: string | undefined;
5087
+ readonly verifyToken?: string | undefined;
5042
5088
  } | undefined;
5043
5089
  } | {
5044
5090
  readonly [x: string]: Schema.Json;
package/dist/manifest.js CHANGED
@@ -352,10 +352,12 @@ export const WebhookTriggerManifest = Schema.Struct({
352
352
  description: Schema.String,
353
353
  signature: Schema.optionalKey(Schema.Struct({
354
354
  scheme: Schema.String,
355
- /** The workspace secret's name; absent when the secret is `generated`. */
355
+ /** The workspace secret's name; absent when the secret is `generated` or an `input`. */
356
356
  secret: Schema.optionalKey(Schema.String),
357
357
  /** The platform derives the secret for the webhook; workspace code registers it. */
358
358
  generated: Schema.optionalKey(Schema.Literal(true)),
359
+ /** The verification value of the webhook's `connection` that holds the secret. */
360
+ input: Schema.optionalKey(Schema.String),
359
361
  algorithm: Schema.optionalKey(Schema.String),
360
362
  encoding: Schema.optionalKey(Schema.String),
361
363
  key: Schema.optionalKey(Schema.Struct({ decode: Schema.String, prefix: Schema.optionalKey(Schema.String) })),
@@ -377,7 +379,13 @@ export const WebhookTriggerManifest = Schema.Struct({
377
379
  Schema.Struct({ timestamp: Schema.Literal(true) }),
378
380
  ]))),
379
381
  })),
380
- verification: Schema.optionalKey(Schema.Struct({ scheme: Schema.String, verifyToken: Schema.String })),
382
+ verification: Schema.optionalKey(Schema.Struct({
383
+ scheme: Schema.String,
384
+ /** The workspace secret holding the token; absent when the token is an `input`. */
385
+ verifyToken: Schema.optionalKey(Schema.String),
386
+ /** The verification value of the webhook's `connection` that holds the token. */
387
+ input: Schema.optionalKey(Schema.String),
388
+ })),
381
389
  headers: Schema.optionalKey(Schema.Array(Schema.String)),
382
390
  /** The key of the connection whose provider sends to the webhook, when declared. */
383
391
  connection: Schema.optionalKey(Schema.String),
@@ -465,6 +465,7 @@ export declare const MigrationPlan: Schema.Struct<{
465
465
  readonly tolerance?: number | undefined;
466
466
  readonly header?: string | undefined;
467
467
  } | undefined;
468
+ readonly input?: string | undefined;
468
469
  readonly generated?: true | undefined;
469
470
  readonly algorithm?: string | undefined;
470
471
  readonly encoding?: string | undefined;
@@ -481,7 +482,8 @@ export declare const MigrationPlan: Schema.Struct<{
481
482
  } | undefined;
482
483
  readonly verification?: {
483
484
  readonly scheme: string;
484
- readonly verifyToken: string;
485
+ readonly input?: string | undefined;
486
+ readonly verifyToken?: string | undefined;
485
487
  } | undefined;
486
488
  } | {
487
489
  readonly [x: string]: Schema.Json;
@@ -814,6 +816,7 @@ export declare const MigrationPlan: Schema.Struct<{
814
816
  readonly tolerance?: number | undefined;
815
817
  readonly header?: string | undefined;
816
818
  } | undefined;
819
+ readonly input?: string | undefined;
817
820
  readonly generated?: true | undefined;
818
821
  readonly algorithm?: string | undefined;
819
822
  readonly encoding?: string | undefined;
@@ -830,7 +833,8 @@ export declare const MigrationPlan: Schema.Struct<{
830
833
  } | undefined;
831
834
  readonly verification?: {
832
835
  readonly scheme: string;
833
- readonly verifyToken: string;
836
+ readonly input?: string | undefined;
837
+ readonly verifyToken?: string | undefined;
834
838
  } | undefined;
835
839
  } | {
836
840
  readonly [x: string]: Schema.Json;
@@ -1165,6 +1169,7 @@ export declare const MigrationPlan: Schema.Struct<{
1165
1169
  readonly tolerance?: number | undefined;
1166
1170
  readonly header?: string | undefined;
1167
1171
  } | undefined;
1172
+ readonly input?: string | undefined;
1168
1173
  readonly generated?: true | undefined;
1169
1174
  readonly algorithm?: string | undefined;
1170
1175
  readonly encoding?: string | undefined;
@@ -1181,7 +1186,8 @@ export declare const MigrationPlan: Schema.Struct<{
1181
1186
  } | undefined;
1182
1187
  readonly verification?: {
1183
1188
  readonly scheme: string;
1184
- readonly verifyToken: string;
1189
+ readonly input?: string | undefined;
1190
+ readonly verifyToken?: string | undefined;
1185
1191
  } | undefined;
1186
1192
  })[];
1187
1193
  readonly action?: {
@@ -1514,6 +1520,7 @@ export declare const MigrationPlan: Schema.Struct<{
1514
1520
  readonly tolerance?: number | undefined;
1515
1521
  readonly header?: string | undefined;
1516
1522
  } | undefined;
1523
+ readonly input?: string | undefined;
1517
1524
  readonly generated?: true | undefined;
1518
1525
  readonly algorithm?: string | undefined;
1519
1526
  readonly encoding?: string | undefined;
@@ -1530,7 +1537,8 @@ export declare const MigrationPlan: Schema.Struct<{
1530
1537
  } | undefined;
1531
1538
  readonly verification?: {
1532
1539
  readonly scheme: string;
1533
- readonly verifyToken: string;
1540
+ readonly input?: string | undefined;
1541
+ readonly verifyToken?: string | undefined;
1534
1542
  } | undefined;
1535
1543
  })[];
1536
1544
  readonly action?: {
@@ -1963,6 +1971,7 @@ export declare const MigrationPlan: Schema.Struct<{
1963
1971
  readonly scheme: Schema.String;
1964
1972
  readonly secret: Schema.optionalKey<Schema.String>;
1965
1973
  readonly generated: Schema.optionalKey<Schema.Literal<true>>;
1974
+ readonly input: Schema.optionalKey<Schema.String>;
1966
1975
  readonly algorithm: Schema.optionalKey<Schema.String>;
1967
1976
  readonly encoding: Schema.optionalKey<Schema.String>;
1968
1977
  readonly key: Schema.optionalKey<Schema.Struct<{
@@ -1994,7 +2003,8 @@ export declare const MigrationPlan: Schema.Struct<{
1994
2003
  }>>;
1995
2004
  readonly verification: Schema.optionalKey<Schema.Struct<{
1996
2005
  readonly scheme: Schema.String;
1997
- readonly verifyToken: Schema.String;
2006
+ readonly verifyToken: Schema.optionalKey<Schema.String>;
2007
+ readonly input: Schema.optionalKey<Schema.String>;
1998
2008
  }>>;
1999
2009
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
2000
2010
  readonly connection: Schema.optionalKey<Schema.String>;
@@ -2308,6 +2318,7 @@ export declare const MigrationPlan: Schema.Struct<{
2308
2318
  readonly scheme: Schema.String;
2309
2319
  readonly secret: Schema.optionalKey<Schema.String>;
2310
2320
  readonly generated: Schema.optionalKey<Schema.Literal<true>>;
2321
+ readonly input: Schema.optionalKey<Schema.String>;
2311
2322
  readonly algorithm: Schema.optionalKey<Schema.String>;
2312
2323
  readonly encoding: Schema.optionalKey<Schema.String>;
2313
2324
  readonly key: Schema.optionalKey<Schema.Struct<{
@@ -2339,7 +2350,8 @@ export declare const MigrationPlan: Schema.Struct<{
2339
2350
  }>>;
2340
2351
  readonly verification: Schema.optionalKey<Schema.Struct<{
2341
2352
  readonly scheme: Schema.String;
2342
- readonly verifyToken: Schema.String;
2353
+ readonly verifyToken: Schema.optionalKey<Schema.String>;
2354
+ readonly input: Schema.optionalKey<Schema.String>;
2343
2355
  }>>;
2344
2356
  readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
2345
2357
  readonly connection: Schema.optionalKey<Schema.String>;
@@ -2564,6 +2576,7 @@ export declare const MigrationPlan: Schema.Struct<{
2564
2576
  readonly tolerance?: number | undefined;
2565
2577
  readonly header?: string | undefined;
2566
2578
  } | undefined;
2579
+ readonly input?: string | undefined;
2567
2580
  readonly generated?: true | undefined;
2568
2581
  readonly algorithm?: string | undefined;
2569
2582
  readonly encoding?: string | undefined;
@@ -2580,7 +2593,8 @@ export declare const MigrationPlan: Schema.Struct<{
2580
2593
  } | undefined;
2581
2594
  readonly verification?: {
2582
2595
  readonly scheme: string;
2583
- readonly verifyToken: string;
2596
+ readonly input?: string | undefined;
2597
+ readonly verifyToken?: string | undefined;
2584
2598
  } | undefined;
2585
2599
  } | {
2586
2600
  readonly [x: string]: Schema.Json;
@@ -2913,6 +2927,7 @@ export declare const MigrationPlan: Schema.Struct<{
2913
2927
  readonly tolerance?: number | undefined;
2914
2928
  readonly header?: string | undefined;
2915
2929
  } | undefined;
2930
+ readonly input?: string | undefined;
2916
2931
  readonly generated?: true | undefined;
2917
2932
  readonly algorithm?: string | undefined;
2918
2933
  readonly encoding?: string | undefined;
@@ -2929,7 +2944,8 @@ export declare const MigrationPlan: Schema.Struct<{
2929
2944
  } | undefined;
2930
2945
  readonly verification?: {
2931
2946
  readonly scheme: string;
2932
- readonly verifyToken: string;
2947
+ readonly input?: string | undefined;
2948
+ readonly verifyToken?: string | undefined;
2933
2949
  } | undefined;
2934
2950
  } | {
2935
2951
  readonly [x: string]: Schema.Json;
@@ -6,7 +6,9 @@ import { type AgentResolution, type AgentStore, type ResolveIdentityInput, type
6
6
  * The agent store on the runtime's agent tables, as `ontology_app`. Expiry is the database's
7
7
  * `now()`; a pairing is consumed with one `UPDATE … WHERE "consumed_at" IS NULL`, so two concurrent
8
8
  * approvals cannot both succeed. Ids that are not UUIDs find nothing rather than fail the cast.
9
- * Chats the agent sees are `agent_chat` records, written as the platform with history.
9
+ * Chats the agent sees are `agent_chat` records, written as the platform with history. Holding a
10
+ * reply is admitted, bounded and starts the workflows whose triggers on `agent_review` fire for it as
11
+ * an action is and does, with the `ActionTransactions` and `WorkflowStarter` it runs with.
10
12
  */
11
13
  export declare function sqlAgentStore(ontology: Ontology, sql: SqlClient.SqlClient): AgentStore;
12
14
  /** Shared verified admission for agents and channel-app adapters; never expose trusted inputs to browsers. */