@proofoftech/flowsafe 0.18.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 +89 -0
- package/README.md +64 -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-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/suspension-deadline.d.ts +3 -2
- package/dist/do-runner/suspension-deadline.d.ts.map +1 -1
- package/dist/do-runner/suspension-deadline.js +3 -2
- package/dist/do-runner/suspension-deadline.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,94 @@
|
|
|
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
|
+
|
|
3
92
|
## 0.18.0
|
|
4
93
|
|
|
5
94
|
### 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
|
|
|
@@ -397,6 +397,65 @@ Agent event replay lasts only as long as the configured Mastra cache. The defaul
|
|
|
397
397
|
|
|
398
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.
|
|
399
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
|
+
|
|
400
459
|
`D1NotificationsStorage` and `D1ThreadStateStorage` mirror Mastra's in-memory domains on D1. `SignalClient` is available from the browser-safe `signals/client` export.
|
|
401
460
|
|
|
402
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,EAA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