@proofoftech/flowsafe 0.17.0 → 0.19.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 +103 -0
- package/README.md +104 -5
- package/deployment-identity-protocol.d.mts +17 -0
- package/deployment-identity-protocol.mjs +32 -0
- package/dist/agent-host/catalog.js +1 -1
- package/dist/agent-host/catalog.js.map +1 -1
- package/dist/agent-host/thread-host.d.ts.map +1 -1
- package/dist/agent-host/thread-host.js +30 -4
- package/dist/agent-host/thread-host.js.map +1 -1
- package/dist/agent-runner/durable-agent-runner.d.ts +251 -20
- package/dist/agent-runner/durable-agent-runner.d.ts.map +1 -1
- package/dist/agent-runner/durable-agent-runner.js +657 -57
- package/dist/agent-runner/durable-agent-runner.js.map +1 -1
- package/dist/deployment-identity-protocol.d.ts +1 -1
- package/dist/deployment-identity-protocol.d.ts.map +1 -1
- package/dist/deployment-identity-protocol.js +1 -1
- package/dist/deployment-identity-protocol.js.map +1 -1
- package/dist/do-runner/deployment-identity.d.ts +2 -11
- package/dist/do-runner/deployment-identity.d.ts.map +1 -1
- package/dist/do-runner/deployment-identity.js +2 -29
- package/dist/do-runner/deployment-identity.js.map +1 -1
- package/dist/do-runner/do-error-response.d.ts.map +1 -1
- package/dist/do-runner/do-error-response.js +9 -1
- package/dist/do-runner/do-error-response.js.map +1 -1
- package/dist/do-runner/durable-object.d.ts +13 -1
- package/dist/do-runner/durable-object.d.ts.map +1 -1
- package/dist/do-runner/durable-object.js +825 -29
- package/dist/do-runner/durable-object.js.map +1 -1
- package/dist/do-runner/index.d.ts +3 -1
- package/dist/do-runner/index.d.ts.map +1 -1
- package/dist/do-runner/index.js +2 -1
- package/dist/do-runner/index.js.map +1 -1
- package/dist/do-runner/runtime.d.ts +43 -0
- package/dist/do-runner/runtime.d.ts.map +1 -1
- package/dist/do-runner/runtime.js +67 -0
- package/dist/do-runner/runtime.js.map +1 -1
- package/dist/do-runner/suspension-deadline.d.ts +184 -0
- package/dist/do-runner/suspension-deadline.d.ts.map +1 -0
- package/dist/do-runner/suspension-deadline.js +452 -0
- package/dist/do-runner/suspension-deadline.js.map +1 -0
- package/dist/do-runner/thread-do.d.ts +5 -1
- package/dist/do-runner/thread-do.d.ts.map +1 -1
- package/dist/do-runner/thread-do.js +24 -1
- package/dist/do-runner/thread-do.js.map +1 -1
- package/dist/signal-providers/delivery.d.ts +32 -0
- package/dist/signal-providers/delivery.d.ts.map +1 -1
- package/dist/signal-providers/delivery.js +45 -0
- package/dist/signal-providers/delivery.js.map +1 -1
- package/dist/signal-providers/host-do.d.ts +11 -0
- package/dist/signal-providers/host-do.d.ts.map +1 -1
- package/dist/signal-providers/host-do.js +48 -14
- package/dist/signal-providers/host-do.js.map +1 -1
- package/dist/signal-providers/provider.d.ts +8 -0
- package/dist/signal-providers/provider.d.ts.map +1 -1
- package/dist/signal-providers/provider.js.map +1 -1
- package/dist/signal-providers/webhook-route.d.ts +6 -0
- package/dist/signal-providers/webhook-route.d.ts.map +1 -1
- package/dist/signal-providers/webhook-route.js +109 -21
- package/dist/signal-providers/webhook-route.js.map +1 -1
- package/dist/signals/client.d.ts +19 -5
- package/dist/signals/client.d.ts.map +1 -1
- package/dist/signals/client.js +25 -17
- package/dist/signals/client.js.map +1 -1
- package/dist/signals/index.d.ts +1 -1
- package/dist/signals/index.d.ts.map +1 -1
- package/dist/signals/index.js.map +1 -1
- package/dist/signals/notification-dispatch.d.ts +2 -0
- package/dist/signals/notification-dispatch.d.ts.map +1 -1
- package/dist/signals/notification-dispatch.js +3 -0
- package/dist/signals/notification-dispatch.js.map +1 -1
- package/dist/signals/router.d.ts.map +1 -1
- package/dist/signals/router.js +3 -2
- package/dist/signals/router.js.map +1 -1
- package/dist/signals/thread-do-routes.d.ts +48 -10
- package/dist/signals/thread-do-routes.d.ts.map +1 -1
- package/dist/signals/thread-do-routes.js +624 -118
- package/dist/signals/thread-do-routes.js.map +1 -1
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,108 @@
|
|
|
1
1
|
# @proofoftech/flowsafe
|
|
2
2
|
|
|
3
|
+
## 0.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fa0d11d: Add an optional content-policy boundary for agent signals. Breakwater exposes `createContentPolicyGate()`, a reusable opaque input-policy gate for host code outside Mastra's processor chain, and FlowSafe's thread signal routes accept a structural `contentPolicy` callback that inspects Mastra's canonical escaped XML before delivery, persistence, wake, or run start — covering direct ingestion, providers, schedules, and notification dispatch. Denial is terminal and evaluator failure stays recoverable on every lane; neither exposes policy names, reasons, content, or causes.
|
|
8
|
+
|
|
9
|
+
Signal attributes whose keys are not XML names are now dropped when a signal is ingested, and a schedule whose stored target cannot be rendered settles a terminal discard receipt instead of failing every later tick with the same broken target.
|
|
10
|
+
|
|
11
|
+
Provider deliveries now distinguish a terminal refusal from one the deployment could not decide: an undecided webhook is answered with 503 so the sender redelivers, and every delivery carries a dedupe key derived from the signed bytes and the subscription so a redelivery coalesces into a still-pending notification instead of duplicating it. Webhook and poll results report `denied`, `failed`, and `deferred` counts.
|
|
12
|
+
|
|
13
|
+
- 0447466: Signal delivery through a Flowsafe durable agent no longer starts an unowned
|
|
14
|
+
run below the host seam; an unbranded agent on an active thread keeps core's own
|
|
15
|
+
behavior as a degraded configuration.
|
|
16
|
+
|
|
17
|
+
This changes the public signal contract:
|
|
18
|
+
|
|
19
|
+
- `/signal/queue` persists in both active and idle states. Success now returns
|
|
20
|
+
`decision.action: 'persist'` without a `runId`; active-thread auto-drain is
|
|
21
|
+
removed, so the message surfaces on the next host-started turn.
|
|
22
|
+
- `/signal/state` now applies the queue route's owner gates and can return
|
|
23
|
+
`principal-mismatch` or `persistence-forbidden`.
|
|
24
|
+
- `/signal/notification` creates the notification record for every accepted
|
|
25
|
+
provider delivery. Owners receive core's `{ record, decision, ... }` result
|
|
26
|
+
under the top-level `record` field, with the signal-routing decision exposed
|
|
27
|
+
separately as `delivery` when core returns one. Non-owners receive a flat
|
|
28
|
+
`NotificationRecord` under `record` plus
|
|
29
|
+
`delivery: { action: 'deferred', reason: 'dispatcher' }`; they never send a
|
|
30
|
+
signal directly. Low-priority owner notifications use summarize-later and
|
|
31
|
+
have no immediate `delivery`.
|
|
32
|
+
- Unbranded agents return `degraded: 'not-runtime-driven'` from successful,
|
|
33
|
+
non-skipped state and owner-notification responses, regardless of thread state.
|
|
34
|
+
Skipped state and an early `memory-unavailable` state response carry no marker.
|
|
35
|
+
- `/signal/message`, `/signal`, `/signal/schedule`, and
|
|
36
|
+
`/signal/notifications/dispatch` now persist on a stale-active-id fall-through
|
|
37
|
+
instead of waking. A forbidden fallback returns `persistence-forbidden`; a
|
|
38
|
+
memory-less fallback returns `memory-unavailable`. The notification dispatch
|
|
39
|
+
lane counts either discard as failed and performs no persisted write. A
|
|
40
|
+
non-owner `/signal` request for `ifActive: 'persist'` degrades to `discard`
|
|
41
|
+
for active delivery: when the thread was active, the response is
|
|
42
|
+
`persistence-forbidden` without a `signalId` because the gate refused and
|
|
43
|
+
nothing was delivered; when the thread was idle, the caller's own `ifIdle`
|
|
44
|
+
outcome is returned unchanged with `signalId`. Owners still forward
|
|
45
|
+
`persist`. Non-owner active deliveries carry non-rendered metadata so a
|
|
46
|
+
completion drain cannot preserve a leftover through the terminal path.
|
|
47
|
+
- Persist outcomes return a `memory-unavailable` discard decision when the
|
|
48
|
+
resolved agent has no memory, after the content gate. A default or
|
|
49
|
+
`ifIdle: 'persist'` message or signal is delivered into an active run without
|
|
50
|
+
memory; an active persist that no memory could write answers
|
|
51
|
+
`memory-unavailable`. A persist-behavior `/signal/schedule` fire instead
|
|
52
|
+
settles a canonical `discard` receipt with `outcome: 'discarded'` and no
|
|
53
|
+
reason, where it previously settled `persisted`.
|
|
54
|
+
Owner `/signal/notification` is the other exception: its model-visible memory
|
|
55
|
+
write is best-effort because the inbox record is already durable. The shipped
|
|
56
|
+
starter host does not configure agent memory, so its other persist outcomes
|
|
57
|
+
return `memory-unavailable` until the host adds memory configuration.
|
|
58
|
+
- Non-owner `/signal/notification` ingestion now requires notification storage
|
|
59
|
+
and returns `409` without it. Those rows bypass the agent's delivery policy and
|
|
60
|
+
readiness hook; the host must run `createNotificationDispatchTick()` to
|
|
61
|
+
deliver them. The starter runs it every 60 seconds, giving up to one tick of
|
|
62
|
+
latency. A host without the tick records but never delivers them; the spike
|
|
63
|
+
has no tick and its provider probes assert only the inbox row.
|
|
64
|
+
- The durable-agent runner terminally fails every run that was not registered
|
|
65
|
+
through `streamUntilPersisted()`. Direct `stream()` resolves to a failed
|
|
66
|
+
output; direct `generate()` rejects. `stream()`, `generate()`, `prepare()`, and
|
|
67
|
+
`streamUntilPersisted()` synchronously refuse a live id, and `prepare(X)`
|
|
68
|
+
keeps `X` live until cleanup. `streamUntilPersisted()` also refuses
|
|
69
|
+
`untilIdle`. If the runner's two terminal-publication attempts and core's own
|
|
70
|
+
fire-and-forget attempt all fail, the output never closes and the thread stays
|
|
71
|
+
active until eviction or a new host start.
|
|
72
|
+
- The public `signals/router.ts` state and notification channels carry these new
|
|
73
|
+
response shapes.
|
|
74
|
+
|
|
75
|
+
Migrate run starts to the host routes or `streamUntilPersisted()`. Treat queue
|
|
76
|
+
success as `{ action: 'persist' }` without a `runId`, and read queued messages on
|
|
77
|
+
the next host-started turn.
|
|
78
|
+
|
|
79
|
+
- 8f4daae: Require `@mastra/core` 1.53.0 exactly (previously 1.50.0). The peer is exact, so every consumer must move to 1.53.0 as well; this is breaking for consumers pinned to 1.50.0. 1.53.0 is the newest release whose published output still bundles for Cloudflare Workers and Vite: 1.54.0 through 1.60.0 inline Node-only dynamic imports (`execa`, `@ast-grep/napi`) that fail to bundle (mastra-ai/mastra#20638). `@mastra/cloudflare-d1` stays at 1.1.1. FlowSafe's `@proofoftech/breakwater` peer floor rises to `>=0.13.0` in step, that being the first Breakwater release built against the same core.
|
|
80
|
+
|
|
81
|
+
FlowSafe's durable agent runner now refuses every inherited entry point that can drive execution outside `RunnerRuntime`, mint a run id below the caller, or hand back runs the caller does not own: the run-recovery entry points 1.53.0 adds to `DurableAgent` (`recover`, `recoverActiveRuns`, `listActiveRuns`); the resume family (`resume`, `resumeStream`, `resumeGenerate`, `approveToolCall`, `declineToolCall`, `approveToolCallGenerate`, `declineToolCallGenerate`), which since 1.53.0 rehydrate from snapshot storage on a run-registry miss; the agent-level discovery member `listSuspendedRuns`; the network family (`network`, `resumeNetwork`, `approveNetworkToolCall`, `declineNetworkToolCall`), which drives the multi-agent loop's own workflow on the default engine; the AI SDK v4 legacy pair (`generateLegacy`, `streamLegacy`), which runs the agent's tools while skipping the authorization check every supported entry point calls; and `sendToolApproval`, whose continuation branch starts a run under a generated run id rather than resuming. `deleteRunSnapshots` is refused on a separate ground: the snapshot rows it deletes belong to deployment-scoped retention rather than to any caller. Nineteen entry points in all. That leaves `resumeViaRuntime` as the only resume path and the guarded `stream`/`generate`/`prepare` as the only execution entry points. Surface tripwires now classify every `DurableAgent` prototype member and every inherited `Agent` member, so a future peer bump surfaces new entry points on either.
|
|
82
|
+
|
|
83
|
+
This is a behavior change for any consumer that called those methods on a FlowSafe durable agent: they now throw instead of executing. Their TYPE signatures narrow too — the overridden members return `Promise<never>`, and the generic overloads several of them carried (`network`, `generateLegacy`, `streamLegacy`, `sendToolApproval`) collapse to a single refusing signature, so a call that no longer type-checks is the intended signal rather than a regression. Nothing in the supported agent-host surface reaches them — route clients through the agent-host run routes.
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- 80a801c: Signal-provider delivery-error log events now carry the same `terminal` flag as their delivery-rejected siblings, so a dropped-forever throw is distinguishable from a deferred one without re-deriving the classification.
|
|
88
|
+
- da6a0aa: Export deployment identity headers from the protocol leaf so external candidates do not import the Durable Object runner barrel.
|
|
89
|
+
- 66c19f1: Clean generated output at the packaging boundary so deleted source modules cannot remain in published tarballs.
|
|
90
|
+
- 5cbe01d: Align the package and documented Node.js runtime floor with the required `@mastra/core` peer dependency.
|
|
91
|
+
|
|
92
|
+
## 0.18.0
|
|
93
|
+
|
|
94
|
+
### Minor Changes
|
|
95
|
+
|
|
96
|
+
- e7fb658: Time out one suspension. A workflow step can now arm a deadline on the suspension it creates by adding the reserved `flowsafe.deadlineMs` key to the payload it passes Mastra's `suspend()`. When that deadline elapses before the awaited signal arrives, the run's own Durable Object resumes the run itself and delivers the `flowsafe.suspensionTimeout` envelope to the expired step, which tells it apart from a real signal with the exported `isSuspensionTimeoutResumeData()` guard. The deadline is persisted in the run's Durable Object storage, so it survives eviction and hibernation, and the resume is fenced on the exact suspension it was armed against: a genuine signal that arrives first drops the deadline instead of resuming twice.
|
|
97
|
+
|
|
98
|
+
This is backward compatible. Nothing arms unless the reserved key is present, so existing runs and existing suspensions behave exactly as before. A host that forwards a `timeoutMs` field today is unaffected: that field was ignored and remains ignored.
|
|
99
|
+
|
|
100
|
+
Authoring notes. A step that declares a Zod `suspendSchema` must declare the reserved field, or use a loose object (`z.looseObject()`, or `.passthrough()` on a `z.object()`): Mastra validates the suspend payload and substitutes the parsed result, so a strict `z.object()` strips the key and no deadline arms. A step that declares a `resumeSchema` must accept the timeout envelope as well as its own signal shape, or every timeout resume fails that validation and the deadline is abandoned. Only a top-level suspended step can arm a deadline: a step suspended inside a nested workflow is reported under its nested path while its suspension time is recorded against the enclosing step, so there is no way to fence the resume, and the deadline is refused and logged instead of armed. A top-level step id containing a dot arms normally, but it must not coincide with a nested path: a step `'a.b'` suspended alongside a nested workflow `'a'` whose inner step `'b'` suspends gives one key for two suspensions, and every deadline on that key is refused and logged rather than armed against the wrong one. A `foreach` step arms one deadline for the step as a whole, because that is all the run summary reports for it: run sequentially, which is the default, each iteration suspends on its own and gets its own deadline, so clearing a whole loop by timeout takes one deadline per item; with `concurrency` above 1 the timeout resume delivers the envelope to every iteration suspended at that moment (at most `concurrency` of them), iterations not yet started suspend afresh with their own deadline, only the first suspended iteration's value is read per batch, and clearing the whole loop takes one deadline per batch of `concurrency` items. Values must be a whole number of milliseconds between `MIN_SUSPENSION_DEADLINE_MS` and `MAX_SUSPENSION_DEADLINE_MS` (365 days); a value outside that range is reported in the runner log and left unarmed rather than failing the suspension that Mastra has already persisted.
|
|
101
|
+
|
|
102
|
+
Operational caveats. Wake precision is a Durable Object alarm's — near the requested time, not exact — and there is no maintenance-sweep backstop for suspension deadlines, so a lost alarm is a lost deadline. Run-level `deadlineMs` remains the swept mechanism when a hard expiry is required. One deadline fires per wake, a run arms at most `MAX_SUSPENSION_DEADLINES_PER_RUN` of them, and a failing timeout resume backs off before it is abandoned for that suspension — the spent entry is kept, never retried and never re-armed, so the same suspension cannot earn itself a fresh budget, while a later suspension of the same step starts one. Only a wake whose authoritative read succeeded spends that budget: a read that did not succeed keeps a 60 second retry cadence and charges nothing, so a storage incident cannot abandon a live deadline — unless an entry has been due for a full day with the state unreadable throughout, after which that entry is abandoned under its own log (`abandoned after 24 h of unreadable run state`). A run whose state has been readable and genuinely absent across five wakes is charged and abandoned the ordinary way, and either abandonment is permanent for the suspension it was armed against. The routes that must not answer from a fabricated read fail closed instead: while a pending owner recovery cannot read authoritative state, `POST /runs` and `GET /runs/:workflowId/:runId/dispatch-status` return 503 for that run. Each previously answered from the fabricated read in its own way: `dispatch-status` returned 200 with a fabricated summary after deleting the very row it could not see, and `POST /runs` refused the run with a 500 (`existing run … has no matching committed owner`) — the same recovery had deleted the row and released its claim, while the fabricated read still reported the run as existing. A start whose own body throws is the one path that answers otherwise: it logs the recovery read it could not make, leaves the journal armed for a later wake, and rethrows the original start failure, so the caller sees that error's own status — a 500 for an unclassified start fault, or the error's own code such as a 400 for a malformed `deadlineMs` — rather than the 503. The same guard covers agent-host owner recovery, which now retries fail-closed — keeping its journal, its reservation and its run record — instead of possibly deleting a row behind a lagging read. The agent-host routes that drive that recovery fail closed in the taxonomy of the surface they escape to rather than reporting a run they could not read. Those that escape to the thread Durable Object's own shell, such as the dispatch read (`GET /_flowsafe/agent-host/runs/:agentId/:runId?resourceId=…&dispatch=1`) and the start route (`POST /_flowsafe/agent-host/start`), answer 503 from that shell; the schedule-wake route (`POST /signal/schedule`, which recovers a lost dispatch receipt through that same recovery) answers 502 with an `internal error` body from the signals router instead of settling a dispatch receipt from a read it could not make. An armed deadline is not observable through `RunSummary` in this release: the record is the run object's own wake state, no route projects it, and the exported bounds exist so a consumer can validate its own `deadlineMs` before arming rather than to read back what is armed, while `MAX_SUSPENSION_DEADLINES_PER_RUN` is exported as the operational figure a host plans against.
|
|
103
|
+
|
|
104
|
+
A timeout resume is not an approval decision. It records `requestedByKind: 'system'` with the reserved `flowsafe-suspension-deadline` principal id, mints no connector grant, and names no reviewer. Only the runner mints the envelope: a resume request whose resume data carries the reserved `flowsafe.suspensionTimeout` key is rejected with a 400 on both the workflow run route and the agent-host resume route, so no caller can present itself to a step as an expired deadline. A step that gates a privileged action must treat its timeout branch as a denial, an escalation, or a no-op — never as consent. Because the run object resumes itself, a timeout resume passes through no host route: `RunRouterOptions.beforeResume` does not vet it and approval reconciliation does not run at that moment, so an approval record filed for the expired suspension stays open until a later host status read supersedes it against the suspension it was bound to. Suspension deadlines cover workflow runs hosted by `DurableObjectRunner`; durable agents keep their own resume path.
|
|
105
|
+
|
|
3
106
|
## 0.17.0
|
|
4
107
|
|
|
5
108
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Flowsafe runs Mastra workflows and agents through Cloudflare Durable Objects, st
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install @mastra/core@1.
|
|
12
|
+
npm install @mastra/core@1.53.0 @proofoftech/flowsafe
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Install `@proofoftech/breakwater` when resumed steps call approval-protected connectors:
|
|
@@ -22,12 +22,12 @@ Install React and React DOM only when you import `@proofoftech/flowsafe/approval
|
|
|
22
22
|
|
|
23
23
|
Compatibility:
|
|
24
24
|
|
|
25
|
-
- Node.js 22 or later (engine range `>=22`)
|
|
25
|
+
- Node.js 22.13.0 or later (engine range `>=22.13.0`)
|
|
26
26
|
- ESM only
|
|
27
27
|
- TypeScript `moduleResolution: "NodeNext"`, `"Node16"`, or `"Bundler"`
|
|
28
|
-
- `@mastra/core` `1.
|
|
28
|
+
- `@mastra/core` `1.53.0`
|
|
29
29
|
- `react` and `react-dom` `>=18 <20` (React 18 or 19) for the optional approval UI
|
|
30
|
-
- `@proofoftech/breakwater` `>=0.
|
|
30
|
+
- `@proofoftech/breakwater` `>=0.13.0 <1.0.0` when used
|
|
31
31
|
- host-provided Wrangler `>=4.118 <5` for the optional `flowsafe-provision` CLI
|
|
32
32
|
|
|
33
33
|
## Choose an export
|
|
@@ -101,7 +101,7 @@ export class AppRunner extends DurableObjectRunner<Env> {
|
|
|
101
101
|
}
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
`init()` creates D1-backed Mastra storage from the conventional `DB` binding unless you inject storage. Workflow definitions use the same `createWorkflow()` and `createStep()` shape as Mastra. Flowsafe pins `@mastra/cloudflare-d1` 1.1.1
|
|
104
|
+
`init()` creates D1-backed Mastra storage from the conventional `DB` binding unless you inject storage. Workflow definitions use the same `createWorkflow()` and `createStep()` shape as Mastra. Flowsafe pins `@mastra/cloudflare-d1` 1.1.1 because the shipped D1 storage is written against that release's domain surface: it subclasses the adapter's background-tasks domain to apply the `TaskFilter.resourceId` predicate the adapter declares but omits from its SQL builder, and hand-writes the schedules, notifications, and thread-state domains the adapter does not ship at all. The pin also holds the adapter on its `@cloudflare/workers-types` v4 peer, which is the major Flowsafe and Agent Starter still build against.
|
|
105
105
|
|
|
106
106
|
If the deployment uses a table prefix, pass one shared constant to storage and host maintenance:
|
|
107
107
|
|
|
@@ -168,6 +168,46 @@ The terminal snapshot commits before lifecycle cleanup. Cleanup abandons open ap
|
|
|
168
168
|
|
|
169
169
|
Monitor `nextDeadlineAt`, `lastDeadlineAt`, `lastDeadlineAttemptAt`, and `lastDeadlineError` on the maintenance health projection. The sweep is bounded by `maintenance.deadlineLimit`, which defaults to 100.
|
|
170
170
|
|
|
171
|
+
### Time out one suspension
|
|
172
|
+
|
|
173
|
+
A suspended step can carry its own deadline. It arms one by adding the reserved `SUSPENSION_DEADLINE_PAYLOAD_KEY` to the payload it passes to Mastra's `suspend()`. When the deadline elapses before the awaited signal arrives, the run's own Durable Object resumes that step with a payload the step can tell apart from a real signal. `createStep` below is the import-swapped factory `init()` returns:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
import {
|
|
177
|
+
isSuspensionTimeoutResumeData,
|
|
178
|
+
SUSPENSION_DEADLINE_PAYLOAD_KEY,
|
|
179
|
+
} from '@proofoftech/flowsafe/do-runner';
|
|
180
|
+
import { z } from 'zod';
|
|
181
|
+
|
|
182
|
+
const gate = createStep({
|
|
183
|
+
id: 'gate',
|
|
184
|
+
inputSchema: z.object({ topic: z.string() }),
|
|
185
|
+
outputSchema: z.object({ topic: z.string(), settledBy: z.string() }),
|
|
186
|
+
execute: async ({ inputData, resumeData, suspend }) => {
|
|
187
|
+
if (!resumeData) {
|
|
188
|
+
return suspend({
|
|
189
|
+
reason: 'awaiting approval',
|
|
190
|
+
[SUSPENSION_DEADLINE_PAYLOAD_KEY]: 900_000,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
topic: inputData.topic,
|
|
195
|
+
settledBy: isSuspensionTimeoutResumeData(resumeData)
|
|
196
|
+
? 'timeout'
|
|
197
|
+
: 'signal',
|
|
198
|
+
};
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
The value is relative milliseconds between `MIN_SUSPENSION_DEADLINE_MS` and `MAX_SUSPENSION_DEADLINE_MS`. A step that declares a Zod `suspendSchema` must declare the reserved field or use a loose object, because Mastra substitutes the parsed suspend payload and a strict schema strips unknown keys. A step that declares a `resumeSchema` must accept the timeout envelope as well as its own signal shape, or the timeout resume fails validation and the deadline is abandoned after the runner's retries. The timeout resume delivers `SUSPENSION_TIMEOUT_RESUME_KEY` wrapping the expired step, its deadline, and the expiry time; branch on `isSuspensionTimeoutResumeData()` instead of the literal key, and build the same envelope in your own tests from that key and the `SuspensionTimeoutEnvelope` and `SuspensionTimeoutResumeData` types. Only the runner mints it: a resume request that carries the reserved key is rejected. It records `requestedByKind: 'system'` with the reserved `SUSPENSION_DEADLINE_PRINCIPAL_ID`, and it is not an approval decision: it mints no grant and records no reviewer.
|
|
204
|
+
|
|
205
|
+
Only a top-level suspended step can arm a deadline. A step suspended inside a nested workflow is reported under the nested path while its suspension time is recorded against the enclosing step, so there is nothing to fence the resume against; the deadline is refused and logged instead of armed.
|
|
206
|
+
|
|
207
|
+
Wake precision is the Durable Object alarm's, and there is no maintenance-sweep backstop for it, so treat a suspension deadline as best-effort near its due time. Run-level `deadlineMs` remains the swept mechanism. `MAX_SUSPENSION_DEADLINES_PER_RUN` caps how many deadlines one run arms; the stored record, its parser, and the wake arithmetic stay inside the run's Durable Object, because nothing outside it can act on that state safely. Suspension deadlines apply to `DurableObjectRunner`-hosted workflow runs; durable agents keep their own resume path.
|
|
208
|
+
|
|
209
|
+
Read the [Durable Object runner design](https://github.com/ProofOfTechOrg/anchorage/blob/main/docs/do-runner-design.md) for the suspension fence, the stored record, and the failure modes.
|
|
210
|
+
|
|
171
211
|
### REST surface
|
|
172
212
|
|
|
173
213
|
The default approval base is `/api/approvals`.
|
|
@@ -357,6 +397,65 @@ Agent event replay lasts only as long as the configured Mastra cache. The defaul
|
|
|
357
397
|
|
|
358
398
|
`createThreadSignalRoutes()` hosts message, queue, signal, state, and notification delivery in the thread Durable Object. `createSignalRouter()` is the Worker trust boundary: authenticate, authorize, ownership-check, cap, parse, reject memory ids, allowlist attributes, rate-limit, audit, then forward.
|
|
359
399
|
|
|
400
|
+
The thread routes reject a signal whose `tagName` is not an XML name, and drop an attributes object carrying a value Mastra cannot render or a key that is not an XML name. Both are what core would otherwise throw on while rendering the signal inside the agent turn.
|
|
401
|
+
|
|
402
|
+
Configure `ThreadSignalRoutesOptions.contentPolicy` when signal content needs a domain policy before it becomes model input. The Thread Durable Object invokes this structural callback for direct ingestion, provider delivery, schedule fires, and notification dispatch. Its `text` is Mastra's canonical escaped XML representation. A denial stops direct delivery with 422, settles a scheduled fire as discarded, or terminally discards the affected notification.
|
|
403
|
+
|
|
404
|
+
A policy failure is opaque, and each lane recovers the way it already recovers from any other failure: direct delivery returns 503, schedule state is left unsettled so the lease expires and a later tick retries, and notification dispatch uses its existing backoff. A webhook whose matched deliveries the deployment could not decide is answered with 503 so the provider's own at-least-once redelivery recovers it; each delivery carries a dedupe key derived from the signed bytes and the subscription, so a redelivery coalesces into a still-pending row rather than duplicating it. A content denial is terminal and answers 2xx, because redelivering the identical bytes would only be denied again. Poll deliveries report the same three outcomes and depend on the adapter re-reporting state it has not seen accepted. Give a network-backed policy its own timeout and failure budget inside the callback; FlowSafe imposes neither.
|
|
405
|
+
|
|
406
|
+
Adapt Breakwater without adding a FlowSafe runtime dependency on it:
|
|
407
|
+
|
|
408
|
+
```typescript
|
|
409
|
+
import { RequestContext } from '@mastra/core/request-context';
|
|
410
|
+
import {
|
|
411
|
+
ACTOR_CONTEXT_KEY,
|
|
412
|
+
AGENT_AUDIT_CONTEXT_KEY,
|
|
413
|
+
createContentPolicyGate,
|
|
414
|
+
} from '@proofoftech/breakwater';
|
|
415
|
+
import {
|
|
416
|
+
breakwaterActorFor,
|
|
417
|
+
principalAuditFields,
|
|
418
|
+
} from '@proofoftech/flowsafe/approval-api';
|
|
419
|
+
import {
|
|
420
|
+
createThreadSignalRoutes,
|
|
421
|
+
type SignalContentPolicyInput,
|
|
422
|
+
} from '@proofoftech/flowsafe/signals';
|
|
423
|
+
|
|
424
|
+
const inspectContent = createContentPolicyGate({ policies });
|
|
425
|
+
|
|
426
|
+
function signalPolicyContext(input: SignalContentPolicyInput): RequestContext {
|
|
427
|
+
const requestContext = new RequestContext();
|
|
428
|
+
requestContext.set(ACTOR_CONTEXT_KEY, breakwaterActorFor(input.principal));
|
|
429
|
+
requestContext.set(AGENT_AUDIT_CONTEXT_KEY, {
|
|
430
|
+
agentId: input.agentId,
|
|
431
|
+
...(input.deploymentTag === undefined
|
|
432
|
+
? {}
|
|
433
|
+
: { tenantId: input.deploymentTag }),
|
|
434
|
+
...(input.runId === undefined ? {} : { runId: input.runId }),
|
|
435
|
+
threadId: input.threadId,
|
|
436
|
+
...(input.resourceId === undefined
|
|
437
|
+
? {}
|
|
438
|
+
: { resourceId: input.resourceId }),
|
|
439
|
+
entryPath: input.entryPath,
|
|
440
|
+
...principalAuditFields(input.principal),
|
|
441
|
+
});
|
|
442
|
+
return requestContext;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const signalRoutes = createThreadSignalRoutes({
|
|
446
|
+
// Existing server-owned resolvers and dispatch seams.
|
|
447
|
+
contentPolicy: (input) =>
|
|
448
|
+
inspectContent({
|
|
449
|
+
text: input.text,
|
|
450
|
+
requestContext: signalPolicyContext(input),
|
|
451
|
+
}),
|
|
452
|
+
});
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
Build the request context only from the callback input. FlowSafe derives those fields from the asserted Thread Durable Object scope and server-owned metadata; never merge HTTP body context or caller-supplied identity into it.
|
|
456
|
+
|
|
457
|
+
Notification ingestion is checked before persistence, and that check is authoritative rather than advisory: Mastra's default delivery decision sends an urgent notification — and an idle-thread high or medium one — straight out of `sendNotificationSignal`, so those records never reach the dispatcher. Storage owns the id, the timestamps and any coalescing, so ingestion inspects a canonical prospective notification carrying every untrusted model-visible field, in both renderings Mastra can choose between: the individual signal and the single-record summary. Dispatch then checks the exact persisted individual or summary signal for every record that was deferred or batched to the tick.
|
|
458
|
+
|
|
360
459
|
`D1NotificationsStorage` and `D1ThreadStateStorage` mirror Mastra's in-memory domains on D1. `SignalClient` is available from the browser-safe `signals/client` export.
|
|
361
460
|
|
|
362
461
|
### Goals
|
|
@@ -15,6 +15,12 @@ export type DeploymentIdentityProtocolExecutor = (
|
|
|
15
15
|
export const DEPLOYMENT_TAG_PATTERN: RegExp;
|
|
16
16
|
export const DEPLOYMENT_ENVIRONMENT_PATTERN: RegExp;
|
|
17
17
|
export const DEPLOYMENT_SENTINEL_TABLE: 'flowsafe_deployment';
|
|
18
|
+
/**
|
|
19
|
+
* Internal Worker-to-Durable-Object credential header. Topology helpers always
|
|
20
|
+
* overwrite it, and public request resolvers reject it. The value is a
|
|
21
|
+
* deployment secret rather than the public deployment tag.
|
|
22
|
+
*/
|
|
23
|
+
export const DEPLOYMENT_IDENTITY_HEADER: 'x-flowsafe-deployment-identity';
|
|
18
24
|
export const DEPLOYMENT_SENTINEL_DDL: string;
|
|
19
25
|
export const DEPLOYMENT_SENTINEL_COLUMNS: readonly Readonly<{
|
|
20
26
|
name: string;
|
|
@@ -25,6 +31,17 @@ export const DEPLOYMENT_SENTINEL_COLUMNS: readonly Readonly<{
|
|
|
25
31
|
|
|
26
32
|
export class DeploymentIdentityError extends Error {}
|
|
27
33
|
|
|
34
|
+
export function assertDeploymentIdentitySecret(
|
|
35
|
+
secret: unknown,
|
|
36
|
+
caller?: string,
|
|
37
|
+
): asserts secret is string;
|
|
38
|
+
|
|
39
|
+
/** Stamp the internal credential onto an ordinary topology request. */
|
|
40
|
+
export function deploymentIdentityHeaders(
|
|
41
|
+
secret: string,
|
|
42
|
+
initial?: HeadersInit,
|
|
43
|
+
): Record<string, string>;
|
|
44
|
+
|
|
28
45
|
export function isDeploymentEnvironment(value: unknown): value is string;
|
|
29
46
|
|
|
30
47
|
export function assertValidDeploymentTag(
|
|
@@ -4,6 +4,12 @@ export const DEPLOYMENT_TAG_PATTERN = /^[a-z0-9]{3,32}$/;
|
|
|
4
4
|
export const DEPLOYMENT_ENVIRONMENT_PATTERN =
|
|
5
5
|
/^[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])?$/;
|
|
6
6
|
export const DEPLOYMENT_SENTINEL_TABLE = 'flowsafe_deployment';
|
|
7
|
+
/**
|
|
8
|
+
* Internal Worker-to-Durable-Object credential header. Topology helpers always
|
|
9
|
+
* overwrite it, and public request resolvers reject it. The value is a
|
|
10
|
+
* deployment secret rather than the public deployment tag.
|
|
11
|
+
*/
|
|
12
|
+
export const DEPLOYMENT_IDENTITY_HEADER = 'x-flowsafe-deployment-identity';
|
|
7
13
|
export const DEPLOYMENT_SENTINEL_DDL = `CREATE TABLE IF NOT EXISTS ${DEPLOYMENT_SENTINEL_TABLE} (
|
|
8
14
|
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
9
15
|
tenant_tag TEXT NOT NULL,
|
|
@@ -23,6 +29,8 @@ export const DEPLOYMENT_SENTINEL_COLUMNS = Object.freeze([
|
|
|
23
29
|
const SENTINEL_SQL_PATTERN =
|
|
24
30
|
/^create table (?:if not exists )?flowsafe_deployment\s*\(\s*id integer primary key check\s*\(\s*id\s*=\s*1\s*\)\s*,\s*tenant_tag text not null\s*,\s*provisioned_at text not null\s*\)$/i;
|
|
25
31
|
const D1_OWNED_INTERNAL_TABLES = Object.freeze(['_cf_KV', '_cf_METADATA']);
|
|
32
|
+
const MIN_DEPLOYMENT_CREDENTIAL_LENGTH = 32;
|
|
33
|
+
const MAX_DEPLOYMENT_CREDENTIAL_LENGTH = 256;
|
|
26
34
|
const D1_OWNED_TABLE_EXCLUSIONS = D1_OWNED_INTERNAL_TABLES.map(
|
|
27
35
|
(name) => ` AND name <> '${name}'`,
|
|
28
36
|
).join('\n');
|
|
@@ -60,6 +68,30 @@ export class DeploymentIdentityError extends Error {
|
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
70
|
|
|
71
|
+
export function assertDeploymentIdentitySecret(
|
|
72
|
+
secret,
|
|
73
|
+
caller = 'deployment identity',
|
|
74
|
+
) {
|
|
75
|
+
if (
|
|
76
|
+
typeof secret !== 'string' ||
|
|
77
|
+
secret.length < MIN_DEPLOYMENT_CREDENTIAL_LENGTH ||
|
|
78
|
+
secret.length > MAX_DEPLOYMENT_CREDENTIAL_LENGTH ||
|
|
79
|
+
!/^[\x21-\x7e]+$/.test(secret)
|
|
80
|
+
) {
|
|
81
|
+
throw new DeploymentIdentityError(
|
|
82
|
+
`${caller}: DEPLOYMENT_IDENTITY_SECRET must contain ${MIN_DEPLOYMENT_CREDENTIAL_LENGTH}-${MAX_DEPLOYMENT_CREDENTIAL_LENGTH} visible ASCII characters`,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Stamp the internal credential onto an ordinary topology request. */
|
|
88
|
+
export function deploymentIdentityHeaders(secret, initial) {
|
|
89
|
+
assertDeploymentIdentitySecret(secret, 'deploymentIdentityHeaders');
|
|
90
|
+
const merged = new Headers(initial);
|
|
91
|
+
merged.set(DEPLOYMENT_IDENTITY_HEADER, secret);
|
|
92
|
+
return Object.fromEntries(merged.entries());
|
|
93
|
+
}
|
|
94
|
+
|
|
63
95
|
export function isDeploymentEnvironment(value) {
|
|
64
96
|
return (
|
|
65
97
|
typeof value === 'string' && DEPLOYMENT_ENVIRONMENT_PATTERN.test(value)
|
|
@@ -169,7 +169,7 @@ export function validateAgentModule(module) {
|
|
|
169
169
|
fail(`agent '${meta.id}' must be created by createGuardedAgent`);
|
|
170
170
|
}
|
|
171
171
|
if (breakwaterGuardedAgentHostProtocol(module.agent) === undefined) {
|
|
172
|
-
fail(`agent '${meta.id}' was built by a @proofoftech/breakwater without the durable-host protocol
|
|
172
|
+
fail(`agent '${meta.id}' was built by a @proofoftech/breakwater release without the durable-host protocol (added in 0.12.0); install a release inside the declared peer range`);
|
|
173
173
|
}
|
|
174
174
|
if (module.agent.id !== meta.id) {
|
|
175
175
|
fail(`metadata id '${meta.id}' does not match guarded agent id '${module.agent.id}'`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/agent-host/catalog.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,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,CAAC,GAAG,CAAC,OAAO,CAAC;QAC3C,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;KAC7C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-host.d.ts","sourceRoot":"","sources":["../../src/agent-host/thread-host.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGjE,OAAO,EAGL,KAAK,cAAc,EAQnB,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAIjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EAIvB,KAAK,iCAAiC,EAIvC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EAIf,KAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"thread-host.d.ts","sourceRoot":"","sources":["../../src/agent-host/thread-host.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGjE,OAAO,EAGL,KAAK,cAAc,EAQnB,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAIjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EAIvB,KAAK,iCAAiC,EAIvC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EAIf,KAAK,mBAAmB,EAExB,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAa/B,OAAO,KAAK,EACV,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,uEAAuE;IACvE,sBAAsB,CACpB,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAC5D,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IACnC,gBAAgB,CACd,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EACvC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;CACvE;AAuQD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,GAC9B,eAAe,CA6gDjB"}
|
|
@@ -5,7 +5,7 @@ import { isPrincipalPermissions } from '@proofoftech/breakwater/rbac';
|
|
|
5
5
|
import { AGENT_ENTRY_PATHS, AGENT_RUN_STORAGE_KEY_PREFIX, bindAgentThread, createFlowsafeDurableAgent, DURABLE_AGENTIC_LOOP_WORKFLOW_ID, deleteAgentRunRecord, deleteAgentThreadBinding, readAgentRunRecord, readAgentThreadBinding, writeAgentRunRecord, } from '../agent-runner/index.js';
|
|
6
6
|
import { canonicalResourceOwner, principalActor, principalAuditFields, principalOwner, RUN_START_ROLES, samePrincipal, } from '../approval-api/index.js';
|
|
7
7
|
import { isExecutionPrincipalId, } from '../approval-api/principal.js';
|
|
8
|
-
import { DoStatusError, isPathSafeId, resolveScheduleStartOwner, resourceIdFromKey, } from '../do-runner/index.js';
|
|
8
|
+
import { DoStatusError, isPathSafeId, resolveScheduleStartOwner, resourceIdFromKey, SUSPENSION_TIMEOUT_RESUME_KEY, } from '../do-runner/index.js';
|
|
9
9
|
import { mastraRegistryEntries } from '../do-runner/mastra-registry.js';
|
|
10
10
|
import { abandonApprovalsForRun, reconcileApprovalsForSummary, } from '../host-kit/index.js';
|
|
11
11
|
import { createAgentModuleCatalog } from './catalog.js';
|
|
@@ -117,6 +117,23 @@ function requestedBy(value) {
|
|
|
117
117
|
}
|
|
118
118
|
return value;
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* The reserved suspension-timeout envelope is minted by a run object's alarm and
|
|
122
|
+
* by nothing else. Agent runs never arm a suspension deadline, so a forged
|
|
123
|
+
* envelope here could only mislead a step — but this route forwards client
|
|
124
|
+
* resume data verbatim under `requestedByKind: 'human'`, and the guarantee the
|
|
125
|
+
* feature sells is that no caller can present itself to a step as an expired
|
|
126
|
+
* deadline. The KEY is refused, exactly as the workflow resume route refuses it,
|
|
127
|
+
* so a step that reads the key directly cannot be fooled either.
|
|
128
|
+
*/
|
|
129
|
+
function resumeData(value) {
|
|
130
|
+
if (value !== null &&
|
|
131
|
+
typeof value === 'object' &&
|
|
132
|
+
SUSPENSION_TIMEOUT_RESUME_KEY in value) {
|
|
133
|
+
throw new AgentHostRequestError(400, `resume data must not carry the reserved '${SUSPENSION_TIMEOUT_RESUME_KEY}' key`);
|
|
134
|
+
}
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
120
137
|
function createFifoLock() {
|
|
121
138
|
let tail = Promise.resolve();
|
|
122
139
|
return async (operation) => {
|
|
@@ -977,8 +994,14 @@ export function createThreadAgentHost(options) {
|
|
|
977
994
|
try {
|
|
978
995
|
summary = await scope.init.runtime.recoverStartAttempt(DURABLE_AGENTIC_LOOP_WORKFLOW_ID, ref.runId, recovery.token);
|
|
979
996
|
}
|
|
980
|
-
catch {
|
|
981
|
-
// Unknown authoritative state: retain metadata and fail closed
|
|
997
|
+
catch (recoverError) {
|
|
998
|
+
// Unknown authoritative state: retain metadata and fail closed —
|
|
999
|
+
// and logged, never swallowed silently, because this read is the
|
|
1000
|
+
// only thing that could tell an interrupted start apart from a
|
|
1001
|
+
// failed one, and its own failure is why the journal is left
|
|
1002
|
+
// armed for a wake that can read. The caller still sees the
|
|
1003
|
+
// ORIGINAL start error.
|
|
1004
|
+
console.error('interrupted start could not read authoritative state', recoverError);
|
|
982
1005
|
}
|
|
983
1006
|
if (summary === null ||
|
|
984
1007
|
(summary && isTerminalRunStatus(summary.status))) {
|
|
@@ -1137,6 +1160,9 @@ export function createThreadAgentHost(options) {
|
|
|
1137
1160
|
if (!durable)
|
|
1138
1161
|
throw new Error('guarded agent was not registered');
|
|
1139
1162
|
const requesterId = requestedBy(body.requestedBy);
|
|
1163
|
+
const resumeFields = 'resumeData' in body
|
|
1164
|
+
? { resumeData: resumeData(body.resumeData) }
|
|
1165
|
+
: {};
|
|
1140
1166
|
const step = typeof body.step === 'string' ||
|
|
1141
1167
|
(Array.isArray(body.step) &&
|
|
1142
1168
|
body.step.every((part) => typeof part === 'string'))
|
|
@@ -1161,7 +1187,7 @@ export function createThreadAgentHost(options) {
|
|
|
1161
1187
|
runId: ref.runId,
|
|
1162
1188
|
requestedBy: requesterId,
|
|
1163
1189
|
...(step !== undefined ? { step } : {}),
|
|
1164
|
-
...
|
|
1190
|
+
...resumeFields,
|
|
1165
1191
|
...(snapshotExecution.threaded
|
|
1166
1192
|
? {
|
|
1167
1193
|
memory: {
|