@proofoftech/flowsafe 0.19.0 → 0.21.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 +106 -0
- package/README.md +68 -6
- package/deployment-identity-protocol.d.mts +70 -1
- package/deployment-identity-protocol.mjs +423 -5
- package/dist/agent-host/index.d.ts +1 -1
- package/dist/agent-host/index.d.ts.map +1 -1
- package/dist/agent-host/index.js.map +1 -1
- package/dist/agent-host/router.d.ts.map +1 -1
- package/dist/agent-host/router.js +17 -4
- package/dist/agent-host/router.js.map +1 -1
- package/dist/agent-host/thread-host.d.ts +14 -1
- package/dist/agent-host/thread-host.d.ts.map +1 -1
- package/dist/agent-host/thread-host.js +865 -308
- package/dist/agent-host/thread-host.js.map +1 -1
- package/dist/agent-host/thread-topology.d.ts +43 -1
- package/dist/agent-host/thread-topology.d.ts.map +1 -1
- package/dist/agent-host/thread-topology.js +301 -28
- package/dist/agent-host/thread-topology.js.map +1 -1
- package/dist/agent-runner/durable-agent-runner.d.ts +107 -8
- package/dist/agent-runner/durable-agent-runner.d.ts.map +1 -1
- package/dist/agent-runner/durable-agent-runner.js +427 -55
- package/dist/agent-runner/durable-agent-runner.js.map +1 -1
- package/dist/agent-runner/index.d.ts +1 -1
- package/dist/agent-runner/index.d.ts.map +1 -1
- package/dist/agent-runner/index.js.map +1 -1
- package/dist/approval-api/actor-context.d.ts +4 -0
- package/dist/approval-api/actor-context.d.ts.map +1 -1
- package/dist/approval-api/actor-context.js +53 -5
- package/dist/approval-api/actor-context.js.map +1 -1
- package/dist/approval-api/d1-store.d.ts.map +1 -1
- package/dist/approval-api/d1-store.js +6 -3
- package/dist/approval-api/d1-store.js.map +1 -1
- package/dist/approval-api/principal-identity.d.ts +32 -0
- package/dist/approval-api/principal-identity.d.ts.map +1 -0
- package/dist/approval-api/principal-identity.js +69 -0
- package/dist/approval-api/principal-identity.js.map +1 -0
- package/dist/approval-api/principal.d.ts +10 -13
- package/dist/approval-api/principal.d.ts.map +1 -1
- package/dist/approval-api/principal.js +10 -46
- package/dist/approval-api/principal.js.map +1 -1
- package/dist/approval-api/retention.d.ts +1 -2
- package/dist/approval-api/retention.d.ts.map +1 -1
- package/dist/approval-api/retention.js.map +1 -1
- package/dist/approval-api/router.d.ts.map +1 -1
- package/dist/approval-api/router.js +9 -1
- package/dist/approval-api/router.js.map +1 -1
- package/dist/approval-api/service.d.ts +29 -14
- package/dist/approval-api/service.d.ts.map +1 -1
- package/dist/approval-api/service.js +83 -25
- package/dist/approval-api/service.js.map +1 -1
- package/dist/approval-api/types.d.ts +12 -0
- package/dist/approval-api/types.d.ts.map +1 -1
- package/dist/approval-api/types.js +12 -0
- package/dist/approval-api/types.js.map +1 -1
- package/dist/audit-export/index.d.ts +2 -2
- package/dist/audit-export/index.js +2 -2
- package/dist/background-tasks/d1-storage.d.ts +4 -3
- package/dist/background-tasks/d1-storage.d.ts.map +1 -1
- package/dist/background-tasks/d1-storage.js +7 -13
- package/dist/background-tasks/d1-storage.js.map +1 -1
- package/dist/background-tasks/host.d.ts +127 -14
- package/dist/background-tasks/host.d.ts.map +1 -1
- package/dist/background-tasks/host.js +579 -50
- package/dist/background-tasks/host.js.map +1 -1
- package/dist/background-tasks/index.d.ts +2 -2
- package/dist/background-tasks/index.d.ts.map +1 -1
- package/dist/background-tasks/index.js +11 -6
- package/dist/background-tasks/index.js.map +1 -1
- package/dist/background-tasks/routes.d.ts +19 -2
- package/dist/background-tasks/routes.d.ts.map +1 -1
- package/dist/background-tasks/routes.js +4 -4
- package/dist/background-tasks/routes.js.map +1 -1
- package/dist/deployment-identity-protocol.d.ts +2 -2
- 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/cause-chain.d.ts +53 -0
- package/dist/do-runner/cause-chain.d.ts.map +1 -0
- package/dist/do-runner/cause-chain.js +96 -0
- package/dist/do-runner/cause-chain.js.map +1 -0
- package/dist/do-runner/constants.d.ts +3 -0
- package/dist/do-runner/constants.d.ts.map +1 -0
- package/dist/do-runner/constants.js +3 -0
- package/dist/do-runner/constants.js.map +1 -0
- package/dist/do-runner/d1-storage.d.ts +47 -69
- package/dist/do-runner/d1-storage.d.ts.map +1 -1
- package/dist/do-runner/d1-storage.js +972 -196
- package/dist/do-runner/d1-storage.js.map +1 -1
- package/dist/do-runner/deployment-identity.d.ts +29 -5
- package/dist/do-runner/deployment-identity.d.ts.map +1 -1
- package/dist/do-runner/deployment-identity.js +23 -6
- package/dist/do-runner/deployment-identity.js.map +1 -1
- package/dist/do-runner/do-error-response.d.ts +4 -23
- package/dist/do-runner/do-error-response.d.ts.map +1 -1
- package/dist/do-runner/do-error-response.js +19 -24
- package/dist/do-runner/do-error-response.js.map +1 -1
- package/dist/do-runner/do-status-error.d.ts +37 -0
- package/dist/do-runner/do-status-error.d.ts.map +1 -0
- package/dist/do-runner/do-status-error.js +42 -0
- package/dist/do-runner/do-status-error.js.map +1 -0
- package/dist/do-runner/durable-object.d.ts +2 -1
- package/dist/do-runner/durable-object.d.ts.map +1 -1
- package/dist/do-runner/durable-object.js +617 -144
- package/dist/do-runner/durable-object.js.map +1 -1
- package/dist/do-runner/execution-admission.d.ts +114 -0
- package/dist/do-runner/execution-admission.d.ts.map +1 -0
- package/dist/do-runner/execution-admission.js +206 -0
- package/dist/do-runner/execution-admission.js.map +1 -0
- package/dist/do-runner/execution-context.d.ts.map +1 -1
- package/dist/do-runner/execution-context.js +1 -0
- package/dist/do-runner/execution-context.js.map +1 -1
- package/dist/do-runner/execution-fence.d.ts +379 -0
- package/dist/do-runner/execution-fence.d.ts.map +1 -0
- package/dist/do-runner/execution-fence.js +1098 -0
- package/dist/do-runner/execution-fence.js.map +1 -0
- package/dist/do-runner/fenced-workflow-capability.d.ts +64 -0
- package/dist/do-runner/fenced-workflow-capability.d.ts.map +1 -0
- package/dist/do-runner/fenced-workflow-capability.js +3 -0
- package/dist/do-runner/fenced-workflow-capability.js.map +1 -0
- package/dist/do-runner/fenced-workflows-d1.d.ts +15 -0
- package/dist/do-runner/fenced-workflows-d1.d.ts.map +1 -0
- package/dist/do-runner/fenced-workflows-d1.js +894 -0
- package/dist/do-runner/fenced-workflows-d1.js.map +1 -0
- package/dist/do-runner/index.d.ts +20 -8
- package/dist/do-runner/index.d.ts.map +1 -1
- package/dist/do-runner/index.js +21 -4
- package/dist/do-runner/index.js.map +1 -1
- package/dist/do-runner/init.d.ts +82 -1
- package/dist/do-runner/init.d.ts.map +1 -1
- package/dist/do-runner/init.js +58 -3
- package/dist/do-runner/init.js.map +1 -1
- package/dist/do-runner/initial-admission-refusal.d.ts +7 -0
- package/dist/do-runner/initial-admission-refusal.d.ts.map +1 -0
- package/dist/do-runner/initial-admission-refusal.js +41 -0
- package/dist/do-runner/initial-admission-refusal.js.map +1 -0
- package/dist/do-runner/inventory.d.ts +295 -0
- package/dist/do-runner/inventory.d.ts.map +1 -0
- package/dist/do-runner/inventory.js +800 -0
- package/dist/do-runner/inventory.js.map +1 -0
- package/dist/do-runner/notification-predicate.d.ts +8 -0
- package/dist/do-runner/notification-predicate.d.ts.map +1 -0
- package/dist/do-runner/notification-predicate.js +136 -0
- package/dist/do-runner/notification-predicate.js.map +1 -0
- package/dist/do-runner/run-lifecycle.d.ts +20 -1
- package/dist/do-runner/run-lifecycle.d.ts.map +1 -1
- package/dist/do-runner/run-lifecycle.js +67 -13
- package/dist/do-runner/run-lifecycle.js.map +1 -1
- package/dist/do-runner/run-provenance.d.ts +38 -0
- package/dist/do-runner/run-provenance.d.ts.map +1 -0
- package/dist/do-runner/run-provenance.js +152 -0
- package/dist/do-runner/run-provenance.js.map +1 -0
- package/dist/do-runner/run-storage-tables.d.ts +2 -0
- package/dist/do-runner/run-storage-tables.d.ts.map +1 -0
- package/dist/do-runner/run-storage-tables.js +4 -0
- package/dist/do-runner/run-storage-tables.js.map +1 -0
- package/dist/do-runner/run-terminal-state.d.ts +29 -0
- package/dist/do-runner/run-terminal-state.d.ts.map +1 -0
- package/dist/do-runner/run-terminal-state.js +105 -0
- package/dist/do-runner/run-terminal-state.js.map +1 -0
- package/dist/do-runner/runtime.d.ts +191 -46
- package/dist/do-runner/runtime.d.ts.map +1 -1
- package/dist/do-runner/runtime.js +994 -378
- package/dist/do-runner/runtime.js.map +1 -1
- package/dist/do-runner/start-idempotency.d.ts +285 -0
- package/dist/do-runner/start-idempotency.d.ts.map +1 -0
- package/dist/do-runner/start-idempotency.js +994 -0
- package/dist/do-runner/start-idempotency.js.map +1 -0
- package/dist/do-runner/start-reservation-contract.d.ts +103 -0
- package/dist/do-runner/start-reservation-contract.d.ts.map +1 -0
- package/dist/do-runner/start-reservation-contract.js +338 -0
- package/dist/do-runner/start-reservation-contract.js.map +1 -0
- package/dist/do-runner/suspension-deadline.d.ts +4 -11
- package/dist/do-runner/suspension-deadline.d.ts.map +1 -1
- package/dist/do-runner/suspension-deadline.js +8 -12
- package/dist/do-runner/suspension-deadline.js.map +1 -1
- package/dist/do-runner/table-prefix.d.ts.map +1 -1
- package/dist/do-runner/table-prefix.js +2 -1
- package/dist/do-runner/table-prefix.js.map +1 -1
- package/dist/do-runner/testing.d.ts +3 -0
- package/dist/do-runner/testing.d.ts.map +1 -0
- package/dist/do-runner/testing.js +3 -0
- package/dist/do-runner/testing.js.map +1 -0
- package/dist/do-runner/thread-do.d.ts +2 -1
- package/dist/do-runner/thread-do.d.ts.map +1 -1
- package/dist/do-runner/thread-do.js +14 -10
- package/dist/do-runner/thread-do.js.map +1 -1
- package/dist/do-runner/workflow-snapshot-row.d.ts +49 -0
- package/dist/do-runner/workflow-snapshot-row.d.ts.map +1 -0
- package/dist/do-runner/workflow-snapshot-row.js +97 -0
- package/dist/do-runner/workflow-snapshot-row.js.map +1 -0
- package/dist/goals/objective-routes.d.ts +15 -5
- package/dist/goals/objective-routes.d.ts.map +1 -1
- package/dist/goals/objective-routes.js +64 -64
- package/dist/goals/objective-routes.js.map +1 -1
- package/dist/host-kit/approval-bridge.d.ts.map +1 -1
- package/dist/host-kit/approval-bridge.js +10 -7
- package/dist/host-kit/approval-bridge.js.map +1 -1
- package/dist/host-kit/do-response.d.ts +16 -0
- package/dist/host-kit/do-response.d.ts.map +1 -1
- package/dist/host-kit/do-response.js +181 -0
- package/dist/host-kit/do-response.js.map +1 -1
- package/dist/host-kit/do-run-topology.d.ts +3 -0
- package/dist/host-kit/do-run-topology.d.ts.map +1 -1
- package/dist/host-kit/do-run-topology.js +36 -8
- package/dist/host-kit/do-run-topology.js.map +1 -1
- package/dist/host-kit/env-vars.d.ts.map +1 -1
- package/dist/host-kit/env-vars.js +5 -6
- package/dist/host-kit/env-vars.js.map +1 -1
- package/dist/host-kit/flowsafe-worker.d.ts +49 -6
- package/dist/host-kit/flowsafe-worker.d.ts.map +1 -1
- package/dist/host-kit/flowsafe-worker.js +409 -111
- package/dist/host-kit/flowsafe-worker.js.map +1 -1
- package/dist/host-kit/host-approval-service.d.ts +24 -14
- package/dist/host-kit/host-approval-service.d.ts.map +1 -1
- package/dist/host-kit/host-approval-service.js +29 -40
- package/dist/host-kit/host-approval-service.js.map +1 -1
- package/dist/host-kit/index.d.ts +9 -3
- package/dist/host-kit/index.d.ts.map +1 -1
- package/dist/host-kit/index.js +5 -1
- package/dist/host-kit/index.js.map +1 -1
- package/dist/host-kit/run-route-error.d.ts +8 -4
- package/dist/host-kit/run-route-error.d.ts.map +1 -1
- package/dist/host-kit/run-route-error.js +14 -11
- package/dist/host-kit/run-route-error.js.map +1 -1
- package/dist/host-kit/run-router.d.ts +63 -2
- package/dist/host-kit/run-router.d.ts.map +1 -1
- package/dist/host-kit/run-router.js +167 -45
- package/dist/host-kit/run-router.js.map +1 -1
- package/dist/host-kit/stream-router.d.ts.map +1 -1
- package/dist/host-kit/stream-router.js +18 -9
- package/dist/host-kit/stream-router.js.map +1 -1
- package/dist/host-kit/thread-topology.d.ts +1 -1
- package/dist/host-kit/thread-topology.d.ts.map +1 -1
- package/dist/host-kit/thread-topology.js +7 -3
- package/dist/host-kit/thread-topology.js.map +1 -1
- package/dist/internal-error-response.d.ts.map +1 -1
- package/dist/internal-error-response.js +16 -6
- package/dist/internal-error-response.js.map +1 -1
- package/dist/schedules/index.d.ts +1 -0
- package/dist/schedules/index.d.ts.map +1 -1
- package/dist/schedules/index.js +1 -7
- package/dist/schedules/index.js.map +1 -1
- package/dist/schedules/mutation-contract.d.ts +38 -0
- package/dist/schedules/mutation-contract.d.ts.map +1 -0
- package/dist/schedules/mutation-contract.js +21 -0
- package/dist/schedules/mutation-contract.js.map +1 -0
- package/dist/schedules/router.d.ts +15 -8
- package/dist/schedules/router.d.ts.map +1 -1
- package/dist/schedules/router.js +170 -59
- package/dist/schedules/router.js.map +1 -1
- package/dist/schedules/schedules-d1.d.ts +11 -5
- package/dist/schedules/schedules-d1.d.ts.map +1 -1
- package/dist/schedules/schedules-d1.js +570 -143
- package/dist/schedules/schedules-d1.js.map +1 -1
- package/dist/schedules/storage.d.ts +0 -7
- package/dist/schedules/storage.d.ts.map +1 -1
- package/dist/schedules/storage.js +0 -27
- package/dist/schedules/storage.js.map +1 -1
- package/dist/schedules/tick.d.ts +13 -0
- package/dist/schedules/tick.d.ts.map +1 -1
- package/dist/schedules/tick.js +66 -40
- package/dist/schedules/tick.js.map +1 -1
- package/dist/signal-providers/host-do.d.ts +12 -1
- package/dist/signal-providers/host-do.d.ts.map +1 -1
- package/dist/signal-providers/host-do.js +28 -3
- package/dist/signal-providers/host-do.js.map +1 -1
- package/dist/signal-providers/webhook-route.d.ts +15 -1
- package/dist/signal-providers/webhook-route.d.ts.map +1 -1
- package/dist/signal-providers/webhook-route.js +126 -113
- package/dist/signal-providers/webhook-route.js.map +1 -1
- package/dist/signals/d1-shared.d.ts +11 -8
- package/dist/signals/d1-shared.d.ts.map +1 -1
- package/dist/signals/d1-shared.js +1 -6
- package/dist/signals/d1-shared.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 +1 -1
- package/dist/signals/index.js.map +1 -1
- package/dist/signals/notification-dispatch.d.ts +109 -5
- package/dist/signals/notification-dispatch.d.ts.map +1 -1
- package/dist/signals/notification-dispatch.js +430 -46
- package/dist/signals/notification-dispatch.js.map +1 -1
- package/dist/signals/notifications-d1.d.ts +14 -1
- package/dist/signals/notifications-d1.d.ts.map +1 -1
- package/dist/signals/notifications-d1.js +229 -18
- package/dist/signals/notifications-d1.js.map +1 -1
- package/dist/signals/router.d.ts +6 -4
- package/dist/signals/router.d.ts.map +1 -1
- package/dist/signals/router.js +49 -84
- package/dist/signals/router.js.map +1 -1
- package/dist/signals/thread-do-routes.d.ts +2 -0
- package/dist/signals/thread-do-routes.d.ts.map +1 -1
- package/dist/signals/thread-do-routes.js +330 -83
- package/dist/signals/thread-do-routes.js.map +1 -1
- package/package.json +6 -3
- package/patches/@mastra__core@1.53.0.patch +54 -0
- package/scripts/seed-deployment-identity.mjs +34 -9
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { captureActorContext } from '../approval-api/actor-context.js';
|
|
2
3
|
import { defaultResumeData, } from '../approval-api/index.js';
|
|
3
|
-
import {
|
|
4
|
+
import { isExecutionPrincipalId, isExecutionPrincipalKind, } from '../approval-api/principal.js';
|
|
5
|
+
import { APPROVAL_PRIORITIES, APPROVAL_STATUSES, canonicalApprovalResumeTarget, } from '../approval-api/types.js';
|
|
6
|
+
import { beginIdempotentStart, isPathSafeId, requireStartIdempotency, resourceIdFromKey, } from '../do-runner/index.js';
|
|
7
|
+
import { captureReservation, } from '../do-runner/start-reservation-contract.js';
|
|
8
|
+
import { doStartLiveness, persistedStartExecution, persistedStartRecord, publicRunSummary, publicStartFields, } from '../host-kit/do-response.js';
|
|
4
9
|
import { createThreadTopology, requireResourceAccess, } from '../host-kit/index.js';
|
|
5
10
|
import { RunRouteError } from '../host-kit/run-route-error.js';
|
|
6
11
|
import { sanitizeStoredAgentContext } from './trusted-context.js';
|
|
@@ -44,7 +49,7 @@ function expectedResource(context, threadId, supplied) {
|
|
|
44
49
|
}
|
|
45
50
|
return resourceId;
|
|
46
51
|
}
|
|
47
|
-
export function createAgentThreadTopology(namespace, deploymentIdentitySecret) {
|
|
52
|
+
export function createAgentThreadTopology(namespace, deploymentIdentitySecret, options) {
|
|
48
53
|
const threads = createThreadTopology(namespace, deploymentIdentitySecret);
|
|
49
54
|
const fetchStatus = async (context, input, resourceId, dispatch) => {
|
|
50
55
|
const response = await threads.send(context, input.threadId, `${AGENT_HOST_ROUTE_PREFIX}/runs/${encodeURIComponent(input.agentId)}/${encodeURIComponent(input.runId)}?resourceId=${encodeURIComponent(resourceId)}${dispatch ? '&dispatch=1' : ''}`);
|
|
@@ -68,6 +73,48 @@ export function createAgentThreadTopology(namespace, deploymentIdentitySecret) {
|
|
|
68
73
|
const resourceId = expectedResource(context, input.threadId);
|
|
69
74
|
return fetchStatus(context, input, resourceId, true);
|
|
70
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* A reserved agent run's persisted envelope, read from the thread the
|
|
78
|
+
* reservation recorded — which is NOT necessarily the thread this retry would
|
|
79
|
+
* have minted. That indirection is the whole reason the reservation stores a
|
|
80
|
+
* thread at all: an unthreaded retry mints a fresh thread every time, and
|
|
81
|
+
* without the recorded one it would be asking an empty object about a run it
|
|
82
|
+
* never had.
|
|
83
|
+
*
|
|
84
|
+
* The dispatch variant of the status route, because a run that already
|
|
85
|
+
* reached a terminal state has had its run record and ownership released, and
|
|
86
|
+
* the public variant answers 404 for exactly that case — which a replay must
|
|
87
|
+
* not confuse with "no run".
|
|
88
|
+
*
|
|
89
|
+
* NO `requireResourceAccess` here, deliberately. Ownership on this path is
|
|
90
|
+
* the RESERVATION's: the reserve call already refused every principal but the
|
|
91
|
+
* key's owner, and the resource registry it would consult has legitimately
|
|
92
|
+
* forgotten a settled run. Re-checking there would make a completed run's
|
|
93
|
+
* replay a 404 — the one answer that would send a caller off to start a
|
|
94
|
+
* second one.
|
|
95
|
+
*/
|
|
96
|
+
const reservedRunEnvelope = async (context, agentId, reservation) => {
|
|
97
|
+
const threadId = reservation.threadId;
|
|
98
|
+
if (threadId === undefined || !isPathSafeId(threadId))
|
|
99
|
+
throw new RunRouteError(503, 'persisted start is not readable');
|
|
100
|
+
const response = await threads.send(context, threadId, `${AGENT_HOST_ROUTE_PREFIX}/runs/${encodeURIComponent(agentId)}/${encodeURIComponent(reservation.runId)}?resourceId=${encodeURIComponent(context.resourceIdFromKey(threadId))}&dispatch=1&replay=1`);
|
|
101
|
+
if (response.status === 404)
|
|
102
|
+
return undefined;
|
|
103
|
+
return persistedEnvelope(response, {
|
|
104
|
+
agentId,
|
|
105
|
+
threadId,
|
|
106
|
+
resourceId: context.resourceIdFromKey(threadId),
|
|
107
|
+
runId: reservation.runId,
|
|
108
|
+
owner: reservation.owner,
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const reservedRunLive = async (context, agentId, reservation) => {
|
|
112
|
+
const threadId = reservation.threadId;
|
|
113
|
+
if (threadId === undefined || !isPathSafeId(threadId))
|
|
114
|
+
return false;
|
|
115
|
+
const response = await threads.send(context, threadId, `${AGENT_HOST_ROUTE_PREFIX}/runs/${encodeURIComponent(agentId)}/${encodeURIComponent(reservation.runId)}/start-liveness`);
|
|
116
|
+
return doStartLiveness(response);
|
|
117
|
+
};
|
|
71
118
|
return {
|
|
72
119
|
requireBoundThread: async (context, target) => {
|
|
73
120
|
const threadId = validThread(target.threadId);
|
|
@@ -80,8 +127,25 @@ export function createAgentThreadTopology(namespace, deploymentIdentitySecret) {
|
|
|
80
127
|
if (!response.ok)
|
|
81
128
|
throw await errorFrom(response);
|
|
82
129
|
},
|
|
83
|
-
start: async (
|
|
84
|
-
const
|
|
130
|
+
start: async (sourceContext, sourceInput) => {
|
|
131
|
+
const context = captureActorContext(sourceContext);
|
|
132
|
+
const { principal, mutationEpoch } = context;
|
|
133
|
+
const { agentId, entryPath, runId: suppliedRunId, threadId: suppliedThreadId, resourceId: suppliedResourceId, topologyThreadId, threaded: suppliedThreaded, scheduleId, dispatchId, idempotencyKey, prompt, requestContext, streamRequestContext, providerOptions, } = sourceInput;
|
|
134
|
+
const input = {
|
|
135
|
+
agentId,
|
|
136
|
+
entryPath,
|
|
137
|
+
threadId: suppliedThreadId,
|
|
138
|
+
resourceId: suppliedResourceId,
|
|
139
|
+
topologyThreadId,
|
|
140
|
+
scheduleId,
|
|
141
|
+
dispatchId,
|
|
142
|
+
idempotencyKey,
|
|
143
|
+
prompt,
|
|
144
|
+
requestContext,
|
|
145
|
+
streamRequestContext,
|
|
146
|
+
providerOptions,
|
|
147
|
+
};
|
|
148
|
+
const threaded = suppliedThreaded !== false;
|
|
85
149
|
if ((input.entryPath === 'schedule.fire') !==
|
|
86
150
|
(input.scheduleId !== undefined) ||
|
|
87
151
|
(input.entryPath === 'schedule.fire') !==
|
|
@@ -102,10 +166,16 @@ export function createAgentThreadTopology(namespace, deploymentIdentitySecret) {
|
|
|
102
166
|
? context.newThreadId()
|
|
103
167
|
: validThread(input.threadId);
|
|
104
168
|
const resourceId = expectedResource(context, threadId, input.resourceId);
|
|
105
|
-
|
|
169
|
+
// The mint, as a THUNK. Two things depend on the delay: the reservation
|
|
170
|
+
// only spends an id when it wins the insert, and — for the
|
|
171
|
+
// caller-influenced `input.runId` path this closes the gap on — a retry
|
|
172
|
+
// that loses the insert takes the WINNER's id rather than re-proposing
|
|
173
|
+
// its own, which is what makes two same-key starts converge instead of
|
|
174
|
+
// becoming two runs.
|
|
175
|
+
const mintRunId = () => suppliedRunId === undefined
|
|
106
176
|
? context.newRunId()
|
|
107
|
-
: isPathSafeId(
|
|
108
|
-
?
|
|
177
|
+
: isPathSafeId(suppliedRunId)
|
|
178
|
+
? suppliedRunId
|
|
109
179
|
: (() => {
|
|
110
180
|
throw new RunRouteError(404, 'run not found');
|
|
111
181
|
})();
|
|
@@ -117,27 +187,66 @@ export function createAgentThreadTopology(namespace, deploymentIdentitySecret) {
|
|
|
117
187
|
...input.requestContext,
|
|
118
188
|
...input.streamRequestContext,
|
|
119
189
|
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
190
|
+
const sendStart = async (targetThreadId, targetRunId, idempotencyKey, suppliedReservation) => {
|
|
191
|
+
const startReservation = suppliedReservation === undefined
|
|
192
|
+
? undefined
|
|
193
|
+
: captureReservation(suppliedReservation, 'started');
|
|
194
|
+
return envelope(await threads.send({ principal, mutationEpoch }, targetThreadId, `${AGENT_HOST_ROUTE_PREFIX}/start`, {
|
|
195
|
+
method: 'POST',
|
|
196
|
+
headers: { 'content-type': 'application/json' },
|
|
197
|
+
body: JSON.stringify({
|
|
198
|
+
agentId: input.agentId,
|
|
199
|
+
threadId: targetThreadId,
|
|
200
|
+
resourceId: context.resourceIdFromKey(targetThreadId),
|
|
201
|
+
runId: targetRunId,
|
|
202
|
+
prompt: input.prompt,
|
|
203
|
+
entryPath: input.entryPath,
|
|
204
|
+
threaded,
|
|
205
|
+
safeContext,
|
|
206
|
+
providerOptions: input.providerOptions,
|
|
207
|
+
// The key rides the internal Worker-to-DO channel only, so the
|
|
208
|
+
// fence's proof-only state can match it inside the runtime.
|
|
209
|
+
...(idempotencyKey === undefined ? {} : { idempotencyKey }),
|
|
210
|
+
...(startReservation === undefined ? {} : { startReservation }),
|
|
211
|
+
...(input.scheduleId !== undefined
|
|
212
|
+
? { scheduleId: input.scheduleId }
|
|
213
|
+
: {}),
|
|
214
|
+
...(input.dispatchId !== undefined
|
|
215
|
+
? { dispatchId: input.dispatchId }
|
|
216
|
+
: {}),
|
|
217
|
+
}),
|
|
218
|
+
}));
|
|
219
|
+
};
|
|
220
|
+
if (input.idempotencyKey === undefined) {
|
|
221
|
+
// Unkeyed starts take the path they always took, on the thread this
|
|
222
|
+
// call resolved.
|
|
223
|
+
return sendStart(threadId, mintRunId());
|
|
224
|
+
}
|
|
225
|
+
const store = requireStartIdempotency(options.startIdempotency);
|
|
226
|
+
const decision = await beginIdempotentStart(store, {
|
|
227
|
+
key: input.idempotencyKey,
|
|
228
|
+
owner: {
|
|
229
|
+
kind: principal.kind,
|
|
230
|
+
id: principal.id,
|
|
231
|
+
},
|
|
232
|
+
targetKind: 'agent',
|
|
233
|
+
targetId: input.agentId,
|
|
234
|
+
threadId,
|
|
235
|
+
mintRunId,
|
|
236
|
+
}, {
|
|
237
|
+
persisted: (reservation) => reservedRunEnvelope(context, input.agentId, reservation),
|
|
238
|
+
live: (reservation) => reservedRunLive(context, input.agentId, reservation),
|
|
239
|
+
}, options.executionFence, mutationEpoch);
|
|
240
|
+
if (decision.kind === 'replay')
|
|
241
|
+
return decision.persisted;
|
|
242
|
+
// The RESERVATION's thread and run, not this call's: on a re-claim of a
|
|
243
|
+
// reservation an earlier crashed caller left behind, the recorded thread
|
|
244
|
+
// is where that run belongs and this call's freshly minted one is not.
|
|
245
|
+
const { reservation } = decision;
|
|
246
|
+
const startThreadId = reservation.threadId;
|
|
247
|
+
if (!isPathSafeId(startThreadId))
|
|
248
|
+
throw new RunRouteError(503, 'persisted start is not readable');
|
|
249
|
+
return sendStart(startThreadId, reservation.runId, reservation.key, reservation);
|
|
141
250
|
},
|
|
142
251
|
status: statusFromHost,
|
|
143
252
|
dispatchStatus: dispatchStatusFromHost,
|
|
@@ -195,4 +304,168 @@ export function createAgentThreadTopology(namespace, deploymentIdentitySecret) {
|
|
|
195
304
|
},
|
|
196
305
|
};
|
|
197
306
|
}
|
|
307
|
+
function publicApproval(value, execution) {
|
|
308
|
+
const record = publicStartFields(value, [
|
|
309
|
+
'id',
|
|
310
|
+
'workflowId',
|
|
311
|
+
'runId',
|
|
312
|
+
'stepPath',
|
|
313
|
+
'title',
|
|
314
|
+
'summary',
|
|
315
|
+
'payload',
|
|
316
|
+
'connectors',
|
|
317
|
+
'grantScope',
|
|
318
|
+
'toolCallId',
|
|
319
|
+
'priority',
|
|
320
|
+
'status',
|
|
321
|
+
'requestedBy',
|
|
322
|
+
'requestedByKind',
|
|
323
|
+
'claimedBy',
|
|
324
|
+
'decidedBy',
|
|
325
|
+
'decision',
|
|
326
|
+
'comment',
|
|
327
|
+
'delegatedTo',
|
|
328
|
+
'createdAt',
|
|
329
|
+
'updatedAt',
|
|
330
|
+
'claimedAt',
|
|
331
|
+
'decidedAt',
|
|
332
|
+
'escalatedAt',
|
|
333
|
+
'slaDeadlineAt',
|
|
334
|
+
'suspendedAt',
|
|
335
|
+
'resumedAt',
|
|
336
|
+
'resumeCount',
|
|
337
|
+
'runScoped',
|
|
338
|
+
'resumeTarget',
|
|
339
|
+
]);
|
|
340
|
+
const invalid = () => {
|
|
341
|
+
throw new RunRouteError(503, 'persisted start is not readable');
|
|
342
|
+
};
|
|
343
|
+
if (!isPathSafeId(record.id) ||
|
|
344
|
+
record.workflowId !== execution.workflowId ||
|
|
345
|
+
record.runId !== execution.runId ||
|
|
346
|
+
typeof record.title !== 'string' ||
|
|
347
|
+
typeof record.createdAt !== 'string' ||
|
|
348
|
+
typeof record.updatedAt !== 'string' ||
|
|
349
|
+
!APPROVAL_PRIORITIES.includes(record.priority) ||
|
|
350
|
+
!APPROVAL_STATUSES.includes(record.status))
|
|
351
|
+
invalid();
|
|
352
|
+
for (const field of ['connectors', 'stepPath']) {
|
|
353
|
+
if ((field === 'connectors' || record[field] !== undefined) &&
|
|
354
|
+
(!Array.isArray(record[field]) ||
|
|
355
|
+
record[field].some((part) => typeof part !== 'string')))
|
|
356
|
+
invalid();
|
|
357
|
+
}
|
|
358
|
+
for (const field of [
|
|
359
|
+
'summary',
|
|
360
|
+
'toolCallId',
|
|
361
|
+
'claimedBy',
|
|
362
|
+
'decidedBy',
|
|
363
|
+
'comment',
|
|
364
|
+
'delegatedTo',
|
|
365
|
+
'claimedAt',
|
|
366
|
+
'decidedAt',
|
|
367
|
+
'escalatedAt',
|
|
368
|
+
'slaDeadlineAt',
|
|
369
|
+
]) {
|
|
370
|
+
if (record[field] !== undefined && typeof record[field] !== 'string')
|
|
371
|
+
invalid();
|
|
372
|
+
}
|
|
373
|
+
if (record.requestedBy !== undefined &&
|
|
374
|
+
!isExecutionPrincipalId(record.requestedBy))
|
|
375
|
+
invalid();
|
|
376
|
+
if (record.requestedByKind !== undefined &&
|
|
377
|
+
(!isExecutionPrincipalKind(record.requestedByKind) ||
|
|
378
|
+
record.requestedBy === undefined))
|
|
379
|
+
invalid();
|
|
380
|
+
if (record.grantScope !== undefined &&
|
|
381
|
+
!['tool-call', 'suspension', 'run'].includes(record.grantScope))
|
|
382
|
+
invalid();
|
|
383
|
+
if (record.decision !== undefined &&
|
|
384
|
+
record.decision !== 'approve' &&
|
|
385
|
+
record.decision !== 'reject')
|
|
386
|
+
invalid();
|
|
387
|
+
if (record.runScoped !== undefined && typeof record.runScoped !== 'boolean')
|
|
388
|
+
invalid();
|
|
389
|
+
for (const field of ['suspendedAt', 'resumedAt', 'resumeCount']) {
|
|
390
|
+
const value = record[field];
|
|
391
|
+
if (value !== undefined &&
|
|
392
|
+
(typeof value !== 'number' ||
|
|
393
|
+
!Number.isFinite(value) ||
|
|
394
|
+
(field === 'resumeCount' &&
|
|
395
|
+
(!Number.isSafeInteger(value) || value < 0))))
|
|
396
|
+
invalid();
|
|
397
|
+
}
|
|
398
|
+
if (record.resumeTarget !== undefined) {
|
|
399
|
+
const target = canonicalApprovalResumeTarget(record.resumeTarget);
|
|
400
|
+
if (!target)
|
|
401
|
+
invalid();
|
|
402
|
+
if (target?.kind === 'agent-thread' &&
|
|
403
|
+
(execution.target.kind !== 'agent' ||
|
|
404
|
+
target.agentId !== execution.target.id ||
|
|
405
|
+
target.threadId !== execution.target.threadId ||
|
|
406
|
+
target.resourceId !== resourceIdFromKey(target.threadId)))
|
|
407
|
+
invalid();
|
|
408
|
+
record.resumeTarget = target;
|
|
409
|
+
}
|
|
410
|
+
return record;
|
|
411
|
+
}
|
|
412
|
+
/** @internal Project the private replay envelope without execution authority. */
|
|
413
|
+
export function publicAgentRunEnvelope(value, execution, expected) {
|
|
414
|
+
const source = publicStartFields(value, [
|
|
415
|
+
'agentId',
|
|
416
|
+
'threadId',
|
|
417
|
+
'resourceId',
|
|
418
|
+
'runId',
|
|
419
|
+
'summary',
|
|
420
|
+
'approval',
|
|
421
|
+
'approvals',
|
|
422
|
+
]);
|
|
423
|
+
if (source.agentId !== expected.agentId ||
|
|
424
|
+
source.threadId !== expected.threadId ||
|
|
425
|
+
source.resourceId !== expected.resourceId ||
|
|
426
|
+
source.runId !== expected.runId)
|
|
427
|
+
throw new RunRouteError(503, 'persisted start is not readable');
|
|
428
|
+
const result = {
|
|
429
|
+
agentId: expected.agentId,
|
|
430
|
+
threadId: expected.threadId,
|
|
431
|
+
resourceId: expected.resourceId,
|
|
432
|
+
runId: expected.runId,
|
|
433
|
+
summary: publicRunSummary(source.summary, expected.runId),
|
|
434
|
+
};
|
|
435
|
+
if (source.approval !== undefined)
|
|
436
|
+
result.approval = publicApproval(source.approval, execution);
|
|
437
|
+
if (source.approvals !== undefined) {
|
|
438
|
+
if (!Array.isArray(source.approvals))
|
|
439
|
+
throw new RunRouteError(503, 'persisted start is not readable');
|
|
440
|
+
result.approvals = source.approvals.map((approval) => publicApproval(approval, execution));
|
|
441
|
+
}
|
|
442
|
+
return result;
|
|
443
|
+
}
|
|
444
|
+
async function persistedEnvelope(response, expected) {
|
|
445
|
+
if (!response.ok)
|
|
446
|
+
throw await errorFrom(response);
|
|
447
|
+
try {
|
|
448
|
+
const payload = persistedStartRecord(await response.json());
|
|
449
|
+
const execution = persistedStartExecution(payload.execution);
|
|
450
|
+
if (execution.runId !== expected.runId ||
|
|
451
|
+
execution.owner.kind !== expected.owner.kind ||
|
|
452
|
+
execution.owner.id !== expected.owner.id ||
|
|
453
|
+
execution.target.kind !== 'agent' ||
|
|
454
|
+
execution.target.id !== expected.agentId ||
|
|
455
|
+
execution.target.threadId !== expected.threadId)
|
|
456
|
+
throw new Error('selector mismatch');
|
|
457
|
+
if (payload.kind === 'initial' && !Object.hasOwn(payload, 'value'))
|
|
458
|
+
return { kind: 'initial', execution };
|
|
459
|
+
if (payload.kind !== 'result' || !Object.hasOwn(payload, 'value'))
|
|
460
|
+
throw new Error('invalid result');
|
|
461
|
+
return {
|
|
462
|
+
kind: 'result',
|
|
463
|
+
execution,
|
|
464
|
+
value: publicAgentRunEnvelope(payload.value, execution, expected),
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
catch {
|
|
468
|
+
throw new RunRouteError(503, 'persisted start is not readable');
|
|
469
|
+
}
|
|
470
|
+
}
|
|
198
471
|
//# sourceMappingURL=thread-topology.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-topology.js","sourceRoot":"","sources":["../../src/agent-host/thread-topology.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAIL,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAGL,oBAAoB,EACpB,qBAAqB,GAGtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAGlE,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AAmF/D,KAAK,UAAU,SAAS,CAAC,QAAkB;IACzC,IAAI,OAAO,GAAG,oCAAoC,QAAQ,CAAC,MAAM,EAAE,CAAC;IACpE,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,E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,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,CAAC,IAAI;YAC5C,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC,KAAK,CAAC,EAAE;YACxC,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO;YACjC,SAAS,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ,CAAC,OAAO;YACxC,SAAS,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ;YAE/C,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;YAChE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;QACxC,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;YAC/D,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACpC,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,SAAS;YACT,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC;SAClE,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,aAAa,CAAC,GAAG,EAAE,iCAAiC,CAAC,CAAC;IAClE,CAAC;AACH,CAAC"}
|
|
@@ -2,7 +2,40 @@ import { type Agent, type AgentExecutionOptions, type ToolsInput } from '@mastra
|
|
|
2
2
|
import { DurableAgent, type DurableAgentConfig, type DurableAgenticWorkflowInput, type DurableAgentStreamOptions } from '@mastra/core/agent/durable';
|
|
3
3
|
import type { Mastra } from '@mastra/core/mastra';
|
|
4
4
|
import { type ExecutionPrincipalKind } from '../approval-api/principal.js';
|
|
5
|
-
import { type
|
|
5
|
+
import { type D1RunExecutionIdentity, type RunExecutionIdentity, type StartExecutionIdentity, type StartIdentity } from '../do-runner/execution-admission.js';
|
|
6
|
+
import { RunStateUnreadableError } from '../do-runner/index.js';
|
|
7
|
+
import type { AuthoritativeStartState, LegacyRunState, RunnerRuntime, RunSummary, StartRunOptions } from '../do-runner/runtime.js';
|
|
8
|
+
import { type StartReservationReading } from '../do-runner/start-reservation-contract.js';
|
|
9
|
+
/** @internal One owned snapshot observation; pending never carries a summary. */
|
|
10
|
+
export type AuthoritativeAgentStartState = AuthoritativeStartState & {
|
|
11
|
+
readonly execution: StartExecutionIdentity;
|
|
12
|
+
readonly threaded: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** @internal Selected ordinary agent data without generation authority. */
|
|
15
|
+
export type LegacyAgentRunState = LegacyRunState & {
|
|
16
|
+
readonly threaded: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** @internal A coherent snapshot belongs to another agent or thread. */
|
|
19
|
+
export declare class AgentRunSelectorMismatchError extends RunStateUnreadableError {
|
|
20
|
+
constructor(workflowId: string, runId: string);
|
|
21
|
+
}
|
|
22
|
+
/** @internal Host-owned start authority captured before streaming. */
|
|
23
|
+
export interface AgentStartAuthority {
|
|
24
|
+
readonly startReservation?: StartReservationReading;
|
|
25
|
+
readonly mutationEpoch?: number;
|
|
26
|
+
readonly startIdentity: StartIdentity & {
|
|
27
|
+
readonly target: {
|
|
28
|
+
readonly kind: 'agent';
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly threadId: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
readonly agentStart: {
|
|
34
|
+
readonly threaded: boolean;
|
|
35
|
+
};
|
|
36
|
+
readonly onPreparedStartIdentity: ((execution: RunExecutionIdentity) => void | Promise<void>) | undefined;
|
|
37
|
+
readonly runOwnerGuard?: StartRunOptions['runOwnerGuard'];
|
|
38
|
+
}
|
|
6
39
|
/**
|
|
7
40
|
* The shared workflow id every durable-agent loop compiles to (core's
|
|
8
41
|
* DurableAgentDefaults.AGENTIC_LOOP). Exposed so hosts and tests can reference
|
|
@@ -40,15 +73,16 @@ export declare function breakwaterGuardedAgentHostProtocol(agent: unknown): Brea
|
|
|
40
73
|
* 3. snapshot deletion owned by deployment-scoped retention;
|
|
41
74
|
* 4. a SECOND execution surface that runs the agent outside RunnerRuntime
|
|
42
75
|
* entirely, or that mints a run id below the caller — the network loop's
|
|
43
|
-
* own workflow, the legacy handler,
|
|
44
|
-
* continuation
|
|
76
|
+
* own workflow, the legacy handler, the thread runtime's tool-approval
|
|
77
|
+
* continuation, and the setter that installs a different agent as the
|
|
78
|
+
* thread runtime's execution target.
|
|
45
79
|
*
|
|
46
80
|
* Deliberately NOT re-exported from `./index.js` (a named-exports-only barrel),
|
|
47
81
|
* so this stays off the public `@proofoftech/flowsafe/agent-runner` subpath.
|
|
48
82
|
*/
|
|
49
83
|
export declare const BLOCKED_RUN_ENTRIES: {
|
|
50
|
-
readonly recover: "re-driving a persisted run bypasses run ownership
|
|
51
|
-
readonly recoverActiveRuns: "bulk re-driving persisted runs bypasses run ownership
|
|
84
|
+
readonly recover: "re-driving a persisted run bypasses run ownership, per-leg grant minting and the fail-closed registry rehydration";
|
|
85
|
+
readonly recoverActiveRuns: "bulk re-driving persisted runs bypasses run ownership and per-leg grant minting";
|
|
52
86
|
readonly resume: "on a run-registry miss the inherited path rehydrates from persisted snapshot storage and re-drives with createRun + run.resume outside RunnerRuntime, bypassing the approval-decision path's grant derivation and the fail-closed registry rehydration";
|
|
53
87
|
readonly resumeStream: "on a run-registry miss the inherited path rehydrates from persisted snapshot storage and re-drives with createRun + run.resume outside RunnerRuntime, bypassing the approval-decision path's grant derivation and the fail-closed registry rehydration";
|
|
54
88
|
readonly resumeGenerate: "on a run-registry miss the inherited path rehydrates from persisted snapshot storage and re-drives with createRun + run.resume outside RunnerRuntime, bypassing the approval-decision path's grant derivation and the fail-closed registry rehydration";
|
|
@@ -58,14 +92,16 @@ export declare const BLOCKED_RUN_ENTRIES: {
|
|
|
58
92
|
readonly declineToolCallGenerate: "on a run-registry miss the inherited path rehydrates from persisted snapshot storage and re-drives with createRun + run.resume outside RunnerRuntime, bypassing the approval-decision path's grant derivation and the fail-closed registry rehydration";
|
|
59
93
|
readonly listActiveRuns: "core scopes the running-run listing by agentId plus the caller's own optional thread and resource ids, never by per-principal ownership, so it bypasses the host topology's run-ownership checks and returns run, thread and resource ids the caller does not own";
|
|
60
94
|
readonly listSuspendedRuns: "core scopes the suspended-run listing by agentId plus the caller's own optional thread and resource ids, never by per-principal ownership, so it bypasses the host topology's run-ownership checks and returns run, thread and resource ids the caller does not own";
|
|
95
|
+
readonly listActiveThreadRuns: "core scopes the active thread-run listing by nothing at all: it takes no arguments and returns the run, thread and resource ids of every thread on the pubsub instance with a run in flight, which core keys by pubsub instance rather than by agent, so it enumerates ids across every principal AND every agent that shares the instance";
|
|
61
96
|
readonly deleteRunSnapshots: "durable-agent snapshot rows are retained until deployment-scoped retention purge removes them";
|
|
62
|
-
readonly network: "the multi-agent network loop compiles its own workflow and drives it with createRun plus run.stream/run.resumeStream on the default engine, outside RunnerRuntime, so no leg is run-owned, grant-derived or snapshot-provenanced — and under autoResumeSuspendedTools it additionally recovers a suspended run id from thread memory and re-drives that run, and it mints an unowned run id when the caller omits one
|
|
97
|
+
readonly network: "the multi-agent network loop compiles its own workflow and drives it with createRun plus run.stream/run.resumeStream on the default engine, outside RunnerRuntime, so no leg is run-owned, grant-derived or snapshot-provenanced — and under autoResumeSuspendedTools it additionally recovers a suspended run id from thread memory and re-drives that run, and it mints an unowned run id when the caller omits one";
|
|
63
98
|
readonly resumeNetwork: "the multi-agent network loop compiles its own workflow and drives it with createRun plus run.stream/run.resumeStream on the default engine, outside RunnerRuntime, so no leg is run-owned, grant-derived or snapshot-provenanced — and under autoResumeSuspendedTools it additionally recovers a suspended run id from thread memory and re-drives that run";
|
|
64
99
|
readonly approveNetworkToolCall: "the multi-agent network loop compiles its own workflow and drives it with createRun plus run.stream/run.resumeStream on the default engine, outside RunnerRuntime, so no leg is run-owned, grant-derived or snapshot-provenanced — and under autoResumeSuspendedTools it additionally recovers a suspended run id from thread memory and re-drives that run";
|
|
65
100
|
readonly declineNetworkToolCall: "the multi-agent network loop compiles its own workflow and drives it with createRun plus run.stream/run.resumeStream on the default engine, outside RunnerRuntime, so no leg is run-owned, grant-derived or snapshot-provenanced — and under autoResumeSuspendedTools it additionally recovers a suspended run id from thread memory and re-drives that run";
|
|
66
101
|
readonly generateLegacy: "the AI SDK v4 legacy handler is a second execution surface that converts and runs the agent's tools outside RunnerRuntime, mints its own run id when the caller omits one, and skips the authorization gate every supported entry calls (requireAgentExecutionFGA)";
|
|
67
102
|
readonly streamLegacy: "the AI SDK v4 legacy handler is a second execution surface that converts and runs the agent's tools outside RunnerRuntime, mints its own run id when the caller omits one, and skips the authorization gate every supported entry calls (requireAgentExecutionFGA)";
|
|
68
103
|
readonly sendToolApproval: "the messages-plus-approved branch does not resume at all: it hands the thread runtime a continuation whose run id falls back to randomUUID() when the caller names none, then starts a run under that id — path-safe, so the host-owned run-id guard cannot tell it from a caller-minted one — and its no-active-run branch reaches the equally unscoped suspended-run discovery";
|
|
104
|
+
readonly __setThreadRuntimeAgent: "it installs the agent the thread-runtime paths resolve their target through — on @mastra/core 1.67.0 these are subscribeToThread, claimThreadOwnership, sendMessage, queueMessage, sendStateSignal, sendNotificationSignal and sendSignal, which read the field it writes — so one call moves every run those paths start, and subscribeToThread's replay target with them, onto an agent that carries none of this class's overrides: no caller-minted run id, no executeWorkflow, and no terminal refusal for a run the host start seam never registered";
|
|
69
105
|
};
|
|
70
106
|
/**
|
|
71
107
|
* Brand marking an agent as runtime-driven. The thread Durable Object requires
|
|
@@ -139,6 +175,8 @@ export declare class FlowsafeDurableAgent<TAgentId extends string = string, TToo
|
|
|
139
175
|
*/
|
|
140
176
|
readonly [RUNTIME_DRIVEN_AGENT] = true;
|
|
141
177
|
constructor(options: FlowsafeDurableAgentOptions<TAgentId, TTools, TOutput>);
|
|
178
|
+
/** @internal */
|
|
179
|
+
isRunLive(runId: string): boolean;
|
|
142
180
|
/**
|
|
143
181
|
* Enforce a caller-minted run ID before the inherited durable
|
|
144
182
|
* `stream()` runs: without this the
|
|
@@ -161,10 +199,25 @@ export declare class FlowsafeDurableAgent<TAgentId extends string = string, TToo
|
|
|
161
199
|
*
|
|
162
200
|
* @internal
|
|
163
201
|
*/
|
|
164
|
-
streamUntilPersisted(messages: Parameters<DurableAgent<TAgentId, TTools, TOutput>['stream']>[0], options: NonNullable<Parameters<DurableAgent<TAgentId, TTools, TOutput>['stream']>[1]>, requestedBy: string, requestedByKind: ExecutionPrincipalKind, attemptToken
|
|
202
|
+
streamUntilPersisted(messages: Parameters<DurableAgent<TAgentId, TTools, TOutput>['stream']>[0], options: NonNullable<Parameters<DurableAgent<TAgentId, TTools, TOutput>['stream']>[1]>, requestedBy: string, requestedByKind: ExecutionPrincipalKind, attemptToken: string | undefined, scheduleDispatch: {
|
|
165
203
|
scheduleId: string;
|
|
166
204
|
dispatchId: string;
|
|
167
|
-
}
|
|
205
|
+
} | undefined,
|
|
206
|
+
/**
|
|
207
|
+
* The idempotency key the thread topology already RESERVED for this run.
|
|
208
|
+
*
|
|
209
|
+
* It travels down here for one job: the execution fence's proof-only state
|
|
210
|
+
* admits exactly the start whose key matches its nominated proof key, and
|
|
211
|
+
* `RunnerRuntime.start` is where that comparison happens. It buys no
|
|
212
|
+
* exactly-once property at this layer — the reservation above already did —
|
|
213
|
+
* so nothing here validates it beyond passing it on, and a run started
|
|
214
|
+
* without one behaves exactly as before.
|
|
215
|
+
*
|
|
216
|
+
* Parked per-runId beside the attempt token rather than threaded through
|
|
217
|
+
* core, because core owns the call between `stream()` and
|
|
218
|
+
* `executeWorkflow()` and carries no field this could ride in.
|
|
219
|
+
*/
|
|
220
|
+
idempotencyKey: string | undefined, authority: AgentStartAuthority): Promise<Awaited<ReturnType<DurableAgent<TAgentId, TTools, TOutput>['stream']>>>;
|
|
168
221
|
/**
|
|
169
222
|
* The same host-owned run-ID guard as {@link FlowsafeDurableAgent.stream} —
|
|
170
223
|
* `generate()`
|
|
@@ -233,6 +286,24 @@ export declare class FlowsafeDurableAgent<TAgentId extends string = string, TToo
|
|
|
233
286
|
* override.
|
|
234
287
|
*/
|
|
235
288
|
listSuspendedRuns(_options?: Parameters<Agent<TAgentId, TTools, TOutput>['listSuspendedRuns']>[0]): Promise<never>;
|
|
289
|
+
/**
|
|
290
|
+
* Refuse the thread-level run enumerator newer cores add.
|
|
291
|
+
* `listActiveThreadRuns()` takes no arguments and returns a runId plus the
|
|
292
|
+
* resourceId and threadId parsed out of the key for every thread on the
|
|
293
|
+
* pubsub instance with a run in flight, and core keys that state by pubsub
|
|
294
|
+
* instance rather than by agent — so it is the same discovery ground as
|
|
295
|
+
* {@link FlowsafeDurableAgent.listActiveRuns} with the last scoping gone.
|
|
296
|
+
* The in-process sibling `getActiveThreadRunId()` stays inherited because it
|
|
297
|
+
* makes the caller name the (resourceId, threadId) pair it confirms.
|
|
298
|
+
*
|
|
299
|
+
* Signature caveat, and the reason this one is not `async`: the base declares
|
|
300
|
+
* it SYNCHRONOUS (`listActiveThreadRuns(): ActiveThreadRun[]`), so the
|
|
301
|
+
* `async … Promise<never>` shape every other refusal here carries would not
|
|
302
|
+
* be assignable to it. No `override` keyword either — the pinned 1.53.0
|
|
303
|
+
* declares no such member, and `override` on a member the base lacks is a
|
|
304
|
+
* type error. Both are re-checks for a peer bump.
|
|
305
|
+
*/
|
|
306
|
+
listActiveThreadRuns(): never;
|
|
236
307
|
/**
|
|
237
308
|
* Refuse the multi-agent network start. `network()` does not touch the
|
|
238
309
|
* durable-agentic-loop at all: it compiles a SEPARATE workflow and drives it
|
|
@@ -298,6 +369,26 @@ export declare class FlowsafeDurableAgent<TAgentId extends string = string, TToo
|
|
|
298
369
|
* every peer bump.
|
|
299
370
|
*/
|
|
300
371
|
sendToolApproval(_options: unknown): Promise<never>;
|
|
372
|
+
/**
|
|
373
|
+
* Refuse the thread-runtime target swap newer cores add. It sets one private
|
|
374
|
+
* field that the thread-runtime paths resolve their target through, falling
|
|
375
|
+
* back to `this`; the refusal in `BLOCKED_RUN_ENTRIES` names those paths,
|
|
376
|
+
* for the core it is written against. So the containment those inherited
|
|
377
|
+
* members rely on is virtual dispatch on `this`, and one call to this setter
|
|
378
|
+
* moves every run they start, and their replay targets with them, onto an
|
|
379
|
+
* agent with none of these overrides in the chain. That is the fourth ground
|
|
380
|
+
* reached by installing a second execution surface rather than by calling
|
|
381
|
+
* one.
|
|
382
|
+
*
|
|
383
|
+
* Signature caveat: the parameter is `unknown` rather than core's
|
|
384
|
+
* `Agent<any, any, any, any>` because the pinned 1.53.0 declares no such
|
|
385
|
+
* member at all, while newest 1.x does — `unknown` is the one supertype of
|
|
386
|
+
* core's parameter, so it satisfies that base without depending on method
|
|
387
|
+
* bivariance, and it constrains nothing on the pin, where there is no base
|
|
388
|
+
* member to satisfy. No `override` keyword, for the same reason as
|
|
389
|
+
* {@link FlowsafeDurableAgent.listActiveThreadRuns}.
|
|
390
|
+
*/
|
|
391
|
+
__setThreadRuntimeAgent(_agent: unknown): never;
|
|
301
392
|
/**
|
|
302
393
|
* Refuse core's terminal snapshot cleanup. Its only call sites are the base
|
|
303
394
|
* `executeWorkflow` (overridden here), the blocked `resume()` and the blocked
|
|
@@ -378,6 +469,14 @@ export declare class FlowsafeDurableAgent<TAgentId extends string = string, TToo
|
|
|
378
469
|
resumeData?: unknown;
|
|
379
470
|
memory?: DurableAgentStreamOptions<TOutput>['memory'];
|
|
380
471
|
}): Promise<RunSummary>;
|
|
472
|
+
/** @internal Include validated legacy agent data for ordinary host operations. */
|
|
473
|
+
authoritativeAgentStartState(expectedRuntime: RunnerRuntime, threadId: string, runId: string, options: {
|
|
474
|
+
readonly includeLegacy: true;
|
|
475
|
+
}): Promise<AuthoritativeAgentStartState | LegacyAgentRunState | null>;
|
|
476
|
+
/** @internal Select the actual private Runtime/workflow and immutable agent owner once. */
|
|
477
|
+
authoritativeAgentStartState(expectedRuntime: RunnerRuntime, threadId: string, runId: string): Promise<AuthoritativeAgentStartState | null>;
|
|
478
|
+
/** @internal Initial identity can correlate proof without granting replay success. */
|
|
479
|
+
proofExecutionFor(expectedRuntime: RunnerRuntime, threadId: string, runId: string): Promise<D1RunExecutionIdentity | undefined>;
|
|
381
480
|
/**
|
|
382
481
|
* Drive the durable-agentic-loop through RunnerRuntime instead of the base
|
|
383
482
|
* `createRun + run.start`. stream()/generate() have already parked the
|