@proofoftech/flowsafe 0.23.0 → 0.25.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 +135 -0
- package/README.md +59 -9
- package/dist/agent-host/thread-host.d.ts.map +1 -1
- package/dist/agent-host/thread-host.js +26 -2
- package/dist/agent-host/thread-host.js.map +1 -1
- package/dist/agent-runner/durable-agent-runner.d.ts +13 -19
- package/dist/agent-runner/durable-agent-runner.d.ts.map +1 -1
- package/dist/agent-runner/durable-agent-runner.js +551 -372
- package/dist/agent-runner/durable-agent-runner.js.map +1 -1
- package/dist/approval-api/retention.d.ts.map +1 -1
- package/dist/approval-api/retention.js +6 -5
- package/dist/approval-api/retention.js.map +1 -1
- package/dist/approval-api/service.js +4 -4
- package/dist/approval-api/service.js.map +1 -1
- package/dist/approval-ui/use-approval-dashboard.js +6 -6
- package/dist/approval-ui/use-approval-dashboard.js.map +1 -1
- package/dist/background-tasks/d1-storage.d.ts.map +1 -1
- package/dist/background-tasks/d1-storage.js +7 -5
- package/dist/background-tasks/d1-storage.js.map +1 -1
- package/dist/background-tasks/host.d.ts.map +1 -1
- package/dist/background-tasks/host.js +27 -38
- package/dist/background-tasks/host.js.map +1 -1
- package/dist/do-runner/cause-chain.d.ts +5 -0
- package/dist/do-runner/cause-chain.d.ts.map +1 -1
- package/dist/do-runner/cause-chain.js +12 -0
- package/dist/do-runner/cause-chain.js.map +1 -1
- package/dist/do-runner/cf-types.d.ts +3 -0
- package/dist/do-runner/cf-types.d.ts.map +1 -1
- package/dist/do-runner/cf-types.js.map +1 -1
- package/dist/do-runner/constants.d.ts +1 -1
- package/dist/do-runner/constants.d.ts.map +1 -1
- package/dist/do-runner/constants.js +1 -1
- package/dist/do-runner/constants.js.map +1 -1
- package/dist/do-runner/core-events-nonce.d.ts +2 -0
- package/dist/do-runner/core-events-nonce.d.ts.map +1 -0
- package/dist/do-runner/core-events-nonce.js +16 -0
- package/dist/do-runner/core-events-nonce.js.map +1 -0
- package/dist/do-runner/d1-storage.js +1 -9
- package/dist/do-runner/d1-storage.js.map +1 -1
- package/dist/do-runner/do-error-response.d.ts.map +1 -1
- package/dist/do-runner/do-error-response.js +2 -1
- package/dist/do-runner/do-error-response.js.map +1 -1
- package/dist/do-runner/durable-object.d.ts +34 -2
- package/dist/do-runner/durable-object.d.ts.map +1 -1
- package/dist/do-runner/durable-object.js +447 -53
- package/dist/do-runner/durable-object.js.map +1 -1
- package/dist/do-runner/fenced-workflow-capability.d.ts +51 -0
- package/dist/do-runner/fenced-workflow-capability.d.ts.map +1 -1
- package/dist/do-runner/fenced-workflows-d1.d.ts +5 -1
- package/dist/do-runner/fenced-workflows-d1.d.ts.map +1 -1
- package/dist/do-runner/fenced-workflows-d1.js +236 -48
- package/dist/do-runner/fenced-workflows-d1.js.map +1 -1
- package/dist/do-runner/index.d.ts +2 -2
- package/dist/do-runner/index.d.ts.map +1 -1
- package/dist/do-runner/index.js +2 -2
- package/dist/do-runner/index.js.map +1 -1
- package/dist/do-runner/init.d.ts +2 -3
- package/dist/do-runner/init.d.ts.map +1 -1
- package/dist/do-runner/init.js.map +1 -1
- package/dist/do-runner/memory-id.js +1 -1
- package/dist/do-runner/memory-id.js.map +1 -1
- package/dist/do-runner/pubsub.d.ts +6 -2
- package/dist/do-runner/pubsub.d.ts.map +1 -1
- package/dist/do-runner/pubsub.js +12 -22
- package/dist/do-runner/pubsub.js.map +1 -1
- package/dist/do-runner/run-lifecycle.d.ts +42 -2
- package/dist/do-runner/run-lifecycle.d.ts.map +1 -1
- package/dist/do-runner/run-lifecycle.js +57 -1
- package/dist/do-runner/run-lifecycle.js.map +1 -1
- package/dist/do-runner/run-terminal-state.d.ts +2 -0
- package/dist/do-runner/run-terminal-state.d.ts.map +1 -1
- package/dist/do-runner/run-terminal-state.js +4 -0
- package/dist/do-runner/run-terminal-state.js.map +1 -1
- package/dist/do-runner/runtime.d.ts +87 -17
- package/dist/do-runner/runtime.d.ts.map +1 -1
- package/dist/do-runner/runtime.js +455 -155
- package/dist/do-runner/runtime.js.map +1 -1
- package/dist/do-runner/suspension-deadline.d.ts +25 -17
- package/dist/do-runner/suspension-deadline.d.ts.map +1 -1
- package/dist/do-runner/suspension-deadline.js +44 -21
- package/dist/do-runner/suspension-deadline.js.map +1 -1
- package/dist/do-runner/workflow-snapshot-row.d.ts +6 -0
- package/dist/do-runner/workflow-snapshot-row.d.ts.map +1 -1
- package/dist/do-runner/workflow-snapshot-row.js +17 -0
- package/dist/do-runner/workflow-snapshot-row.js.map +1 -1
- package/dist/host-kit/approval-bridge.d.ts +25 -9
- package/dist/host-kit/approval-bridge.d.ts.map +1 -1
- package/dist/host-kit/approval-bridge.js +72 -15
- package/dist/host-kit/approval-bridge.js.map +1 -1
- package/dist/host-kit/do-response.d.ts.map +1 -1
- package/dist/host-kit/do-response.js +7 -1
- package/dist/host-kit/do-response.js.map +1 -1
- package/dist/host-kit/flowsafe-worker.d.ts +2 -1
- package/dist/host-kit/flowsafe-worker.d.ts.map +1 -1
- package/dist/host-kit/flowsafe-worker.js +4 -2
- package/dist/host-kit/flowsafe-worker.js.map +1 -1
- package/dist/host-kit/run-router.d.ts +4 -1
- package/dist/host-kit/run-router.d.ts.map +1 -1
- package/dist/host-kit/run-router.js +3 -2
- package/dist/host-kit/run-router.js.map +1 -1
- package/dist/schedules/schedules-d1.d.ts +1 -0
- package/dist/schedules/schedules-d1.d.ts.map +1 -1
- package/dist/schedules/schedules-d1.js +35 -22
- package/dist/schedules/schedules-d1.js.map +1 -1
- package/dist/schedules/tick.d.ts +17 -2
- package/dist/schedules/tick.d.ts.map +1 -1
- package/dist/schedules/tick.js +63 -44
- package/dist/schedules/tick.js.map +1 -1
- package/dist/signals/d1-shared.js +1 -1
- package/dist/signals/d1-shared.js.map +1 -1
- package/dist/signals/thread-do-routes.d.ts +8 -1
- package/dist/signals/thread-do-routes.d.ts.map +1 -1
- package/dist/signals/thread-do-routes.js +40 -44
- package/dist/signals/thread-do-routes.js.map +1 -1
- package/package.json +10 -7
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type ExecutionPrincipalKind } from '../approval-api/principal.js';
|
|
2
2
|
import type { DurableObjectRunnerState, WebSocketLike } from './cf-types.js';
|
|
3
|
-
import { RunnerRuntime } from './runtime.js';
|
|
3
|
+
import { RunnerRuntime, type RunSummary } from './runtime.js';
|
|
4
4
|
import { type ScheduleSourceStore } from './schedule-source.js';
|
|
5
|
+
import { type SuspensionDeadlineEntry } from './suspension-deadline.js';
|
|
5
6
|
export interface DurableObjectRunOwner {
|
|
6
7
|
readonly kind: ExecutionPrincipalKind;
|
|
7
8
|
readonly id: string;
|
|
@@ -21,6 +22,33 @@ export interface DurableObjectRunOwnershipStore {
|
|
|
21
22
|
export interface DurableObjectRunLifecycleHooks {
|
|
22
23
|
abandonApprovals(workflowId: string, runId: string, status: 'cancelled' | 'timed_out'): Promise<void>;
|
|
23
24
|
discardScheduleDispatch?(scheduleId: string, dispatchId: string, runId: string): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Reconcile the approvals of a run at a boundary the object reached on its
|
|
27
|
+
* own, with no host request behind it (docs/do-runner-design.md, "Approvals
|
|
28
|
+
* the run object files"). Called from the object's alarm, under its
|
|
29
|
+
* operation lock, with an authoritative summary. Steps listed in
|
|
30
|
+
* `summary.suspensionTimers` are timers the object resumes itself and must
|
|
31
|
+
* get no approval; `reconcileApprovalsForSummary` skips them.
|
|
32
|
+
*
|
|
33
|
+
* After a suspension-deadline resume it is called whatever the run did next,
|
|
34
|
+
* so `summary` need not be suspended, and `ended` names the suspension that
|
|
35
|
+
* resume ended, which nothing can decide any more. An implementation
|
|
36
|
+
* honours `ended` by superseding each open record whose step, `suspendedAt`
|
|
37
|
+
* and `resumeCount` equal it exactly, counting a record's absent
|
|
38
|
+
* `resumeCount` as 0, and by leaving every other record alone while the run
|
|
39
|
+
* is suspended. `createFlowsafeRunnerLifecycle()` does, and once `summary`
|
|
40
|
+
* is terminal it supersedes every open record of the run. An implementation
|
|
41
|
+
* that ignores `ended` leaves such a record open.
|
|
42
|
+
*
|
|
43
|
+
* Best effort, one attempt: a failure is logged and never retried, and a
|
|
44
|
+
* host read with approval reconciliation files what it missed, so it must be
|
|
45
|
+
* idempotent beside that read. A failed read or hook, an eviction between the
|
|
46
|
+
* resume and this call, a resume that throws after its result was saved (the
|
|
47
|
+
* later wake names no ended suspension), or a host status read that files
|
|
48
|
+
* from a summary taken before the resume leaves the ended suspension's
|
|
49
|
+
* record open, and the SLA sweep escalates it.
|
|
50
|
+
*/
|
|
51
|
+
reconcileApprovals?(workflowId: string, summary: RunSummary, ended?: Pick<SuspensionDeadlineEntry, 'step' | 'suspendedAt' | 'resumeCount'>): Promise<void>;
|
|
24
52
|
}
|
|
25
53
|
export declare const RUN_OWNER_RECOVERY_DELAY_MS = 60000;
|
|
26
54
|
export declare abstract class DurableObjectRunner<TEnv = unknown> {
|
|
@@ -35,7 +63,11 @@ export declare abstract class DurableObjectRunner<TEnv = unknown> {
|
|
|
35
63
|
protected abstract runOwnership(env: TEnv): DurableObjectRunOwnershipStore;
|
|
36
64
|
/** Existing schedules domain used only for target-verifiable schedule fires. */
|
|
37
65
|
protected scheduleSource(_env: TEnv): ScheduleSourceStore | undefined;
|
|
38
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Required when the host exposes terminate or deadline lifecycle routes.
|
|
68
|
+
* Its optional `reconcileApprovals` files the approvals the object reaches
|
|
69
|
+
* from its alarm.
|
|
70
|
+
*/
|
|
39
71
|
protected runLifecycle(_env: TEnv): DurableObjectRunLifecycleHooks | undefined;
|
|
40
72
|
fetch(request: Request): Promise<Response>;
|
|
41
73
|
alarm(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable-object.d.ts","sourceRoot":"","sources":["../../src/do-runner/durable-object.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"durable-object.d.ts","sourceRoot":"","sources":["../../src/do-runner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