@anureo/workflow 0.3.0 → 0.3.1
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/README.md +96 -70
- package/package.json +17 -16
- package/src/agent-adapters.test.ts +121 -0
- package/src/agent-execution.ts +201 -0
- package/src/agent.test.ts +333 -0
- package/src/agent.ts +135 -0
- package/src/fixtures/workflow-crash.ts +53 -0
- package/src/index.ts +9 -0
- package/src/output-schema.test.ts +147 -0
- package/src/output-schema.ts +231 -0
- package/src/parallel.test.ts +96 -0
- package/src/parallel.ts +33 -0
- package/src/persistence/checkpoint-files.ts +82 -0
- package/src/persistence/journal.ts +111 -0
- package/src/persistence/json.ts +83 -0
- package/src/persistence/records.ts +97 -0
- package/src/persistence/replay.ts +91 -0
- package/src/persistence/store.ts +286 -0
- package/src/pipeline.test.ts +201 -0
- package/src/pipeline.ts +99 -0
- package/src/test-helpers.ts +23 -0
- package/src/workflow-state.ts +130 -0
- package/src/workflow-types.ts +38 -0
- package/src/workflow.test.ts +376 -0
- package/src/workflow.ts +112 -0
- package/tsconfig.json +13 -0
- package/LICENSE +0 -201
- package/src/agent-outcome.d.ts +0 -15
- package/src/agent-outcome.js +0 -28
- package/src/agent.d.ts +0 -49
- package/src/agent.js +0 -206
- package/src/index.d.ts +0 -6
- package/src/index.js +0 -5
- package/src/output-schema.d.ts +0 -27
- package/src/output-schema.js +0 -192
- package/src/parallel.d.ts +0 -18
- package/src/parallel.js +0 -25
- package/src/persistence/atomic.d.ts +0 -9
- package/src/persistence/atomic.js +0 -48
- package/src/persistence/journal.d.ts +0 -54
- package/src/persistence/journal.js +0 -106
- package/src/persistence/json.d.ts +0 -17
- package/src/persistence/json.js +0 -75
- package/src/persistence/read-json.d.ts +0 -11
- package/src/persistence/read-json.js +0 -46
- package/src/persistence/records.d.ts +0 -92
- package/src/persistence/records.js +0 -70
- package/src/persistence/replay.d.ts +0 -11
- package/src/persistence/replay.js +0 -79
- package/src/persistence/store.d.ts +0 -45
- package/src/persistence/store.js +0 -238
- package/src/pipeline.d.ts +0 -41
- package/src/pipeline.js +0 -24
- package/src/run-context.d.ts +0 -16
- package/src/run-context.js +0 -13
- package/src/test-helpers.d.ts +0 -11
- package/src/test-helpers.js +0 -21
- package/src/workflow-state.d.ts +0 -44
- package/src/workflow-state.js +0 -96
- package/src/workflow-types.d.ts +0 -39
- package/src/workflow-types.js +0 -0
- package/src/workflow.d.ts +0 -17
- package/src/workflow.js +0 -104
package/src/test-helpers.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Scripted client setup shared by workflow tests; each suite retains its own disposal registry.
|
|
2
|
-
import { randomUUID } from 'node:crypto';
|
|
3
|
-
import { createClient } from '@anureo/sdk';
|
|
4
|
-
import { createScriptedAdapter } from '@anureo/conformance';
|
|
5
|
-
/**
|
|
6
|
-
* Give the agent and workflow suites a factory for initialized scripted clients. Register each
|
|
7
|
-
* successful client for the suite's afterEach disposal. Initialization failures reject without
|
|
8
|
-
* adding a client to the registry.
|
|
9
|
-
*/
|
|
10
|
-
export function createFixture(clients) {
|
|
11
|
-
/**
|
|
12
|
-
* Return the client and adapter for dispatch assertions. Give each fixture a distinct runtime
|
|
13
|
-
* identity so journal replay can distinguish clients.
|
|
14
|
-
*/
|
|
15
|
-
return async function fixture(options) {
|
|
16
|
-
const adapter = createScriptedAdapter(options);
|
|
17
|
-
const client = await createClient({ adapter, identity: { adapterId: 'scripted', runtimeConfigId: randomUUID() } });
|
|
18
|
-
clients.push(client);
|
|
19
|
-
return { client, adapter };
|
|
20
|
-
};
|
|
21
|
-
}
|
package/src/workflow-state.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { HarnessSdkError } from '@anureo/sdk';
|
|
2
|
-
import type { StoredFailure } from "./persistence/records.js";
|
|
3
|
-
/** Recognize SDK resource-release errors and explicit cleanup evidence on another failure.
|
|
4
|
-
* isFatal, storedFailure and RunState.failure share this rule for dispatch and reporting. */
|
|
5
|
-
export declare function cleanupFailed(error: HarnessSdkError): boolean;
|
|
6
|
-
/** Project abortRun's failure into manifest metadata, excluding diagnostic messages and details. */
|
|
7
|
-
export declare function storedFailure(error: HarnessSdkError): StoredFailure;
|
|
8
|
-
/** Tell memoizedAgent and RunState.track when a failure must stop later dispatch even if caught.
|
|
9
|
-
* Uncertain execution, failed cleanup and broken persistence cannot safely continue the run. */
|
|
10
|
-
export declare function isFatal(error: HarnessSdkError): boolean;
|
|
11
|
-
/** Internal admission and settlement state shared by workflow and its journaled agent calls.
|
|
12
|
-
* Ordinary step failures mark completion incomplete; sticky failures reject the run and block dispatch.
|
|
13
|
-
* workflow's completion and abort phases close admission and drain registered work. */
|
|
14
|
-
export declare class RunState {
|
|
15
|
-
/** Preserve a failure for workflow's rejection and prevent later dispatch. Active work keeps settling. */
|
|
16
|
-
stop(error: HarnessSdkError): void;
|
|
17
|
-
/** Record a normalized storage failure when abortRun cannot publish or workflow cannot release the handle. */
|
|
18
|
-
noteStorageFailure(): void;
|
|
19
|
-
/** Return the first sticky code and message with all recorded codes, uncertainty and cleanup evidence.
|
|
20
|
-
* abortRun snapshots this for failure publication. workflow reads it again after lock release. */
|
|
21
|
-
get failure(): HarnessSdkError | undefined;
|
|
22
|
-
/** Publication status for workflow when no sticky failure remains to reject the run. */
|
|
23
|
-
get status(): 'completed' | 'incomplete';
|
|
24
|
-
/** Mark a drop from memoizedAgent or a rejection from track incomplete. Fatality is checked separately. */
|
|
25
|
-
noteIncomplete(): void;
|
|
26
|
-
/** Throw the sticky aggregate before dispatch. memoizedAgent checks again after publishing
|
|
27
|
-
* its started marker because another call may have stopped the run during that await.
|
|
28
|
-
* Admission closure is checked separately by track. */
|
|
29
|
-
assertDispatch(): void;
|
|
30
|
-
/** Invoke memoizedAgent's operation immediately and register it for workflow's drain.
|
|
31
|
-
* Closed admission returns a WORKFLOW_CLOSED rejection without invoking the operation.
|
|
32
|
-
* Sticky failures and synchronous operation throws become rejected promises. Return the
|
|
33
|
-
* original work promise; a separate observer marks rejections incomplete and fatal ones sticky,
|
|
34
|
-
* so catching an agent failure cannot hide its effect on workflow completion. */
|
|
35
|
-
track<T>(operation: () => Promise<T>): Promise<T>;
|
|
36
|
-
/** Stop admitting agent work synchronously, then await all work already registered by track.
|
|
37
|
-
* completeRun calls this before publication; abortRun repeats it on failure. Operation
|
|
38
|
-
* rejections are recorded in state rather than rethrown by the drain. Active work is not cancelled. */
|
|
39
|
-
closeAndDrain(): Promise<void>;
|
|
40
|
-
private accepting;
|
|
41
|
-
private pending;
|
|
42
|
-
private stops;
|
|
43
|
-
private incomplete;
|
|
44
|
-
}
|
package/src/workflow-state.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { HarnessSdkError, sdkError } from '@anureo/sdk';
|
|
2
|
-
/** Recognize SDK resource-release errors and explicit cleanup evidence on another failure.
|
|
3
|
-
* isFatal, storedFailure and RunState.failure share this rule for dispatch and reporting. */
|
|
4
|
-
export function cleanupFailed(error) {
|
|
5
|
-
return error.code === 'RESOURCE_RELEASE_FAILED'
|
|
6
|
-
|| error.details?.cleanupFailed === true
|
|
7
|
-
|| (Array.isArray(error.details?.cleanupErrors) && error.details.cleanupErrors.length > 0);
|
|
8
|
-
}
|
|
9
|
-
/** Project abortRun's failure into manifest metadata, excluding diagnostic messages and details. */
|
|
10
|
-
export function storedFailure(error) {
|
|
11
|
-
return {
|
|
12
|
-
code: error.code,
|
|
13
|
-
retryable: error.retryable,
|
|
14
|
-
outcomeUnknown: error.outcomeUnknown,
|
|
15
|
-
cleanupFailed: cleanupFailed(error),
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
/** Tell memoizedAgent and RunState.track when a failure must stop later dispatch even if caught.
|
|
19
|
-
* Uncertain execution, failed cleanup and broken persistence cannot safely continue the run. */
|
|
20
|
-
export function isFatal(error) {
|
|
21
|
-
return error.outcomeUnknown || cleanupFailed(error)
|
|
22
|
-
|| error.code === 'WORKFLOW_STORAGE_FAILED'
|
|
23
|
-
|| error.code === 'WORKFLOW_CHECKPOINT_INVALID';
|
|
24
|
-
}
|
|
25
|
-
/** Internal admission and settlement state shared by workflow and its journaled agent calls.
|
|
26
|
-
* Ordinary step failures mark completion incomplete; sticky failures reject the run and block dispatch.
|
|
27
|
-
* workflow's completion and abort phases close admission and drain registered work. */
|
|
28
|
-
export class RunState {
|
|
29
|
-
/** Preserve a failure for workflow's rejection and prevent later dispatch. Active work keeps settling. */
|
|
30
|
-
stop(error) { this.stops.add(error); }
|
|
31
|
-
/** Record a normalized storage failure when abortRun cannot publish or workflow cannot release the handle. */
|
|
32
|
-
noteStorageFailure() { this.stop(new HarnessSdkError('WORKFLOW_STORAGE_FAILED')); }
|
|
33
|
-
/** Return the first sticky code and message with all recorded codes, uncertainty and cleanup evidence.
|
|
34
|
-
* abortRun snapshots this for failure publication. workflow reads it again after lock release. */
|
|
35
|
-
get failure() {
|
|
36
|
-
const failures = [...this.stops];
|
|
37
|
-
const first = failures[0];
|
|
38
|
-
if (!first)
|
|
39
|
-
return undefined;
|
|
40
|
-
return new HarnessSdkError(first.code, first.message, false, failures.some(error => error.outcomeUnknown), {
|
|
41
|
-
failureCodes: [...new Set(failures.map(error => error.code))],
|
|
42
|
-
cleanupFailed: failures.some(cleanupFailed),
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/** Publication status for workflow when no sticky failure remains to reject the run. */
|
|
46
|
-
get status() {
|
|
47
|
-
return this.incomplete ? 'incomplete' : 'completed';
|
|
48
|
-
}
|
|
49
|
-
/** Mark a drop from memoizedAgent or a rejection from track incomplete. Fatality is checked separately. */
|
|
50
|
-
noteIncomplete() { this.incomplete = true; }
|
|
51
|
-
/** Throw the sticky aggregate before dispatch. memoizedAgent checks again after publishing
|
|
52
|
-
* its started marker because another call may have stopped the run during that await.
|
|
53
|
-
* Admission closure is checked separately by track. */
|
|
54
|
-
assertDispatch() {
|
|
55
|
-
const failure = this.failure;
|
|
56
|
-
if (failure)
|
|
57
|
-
throw failure;
|
|
58
|
-
}
|
|
59
|
-
/** Invoke memoizedAgent's operation immediately and register it for workflow's drain.
|
|
60
|
-
* Closed admission returns a WORKFLOW_CLOSED rejection without invoking the operation.
|
|
61
|
-
* Sticky failures and synchronous operation throws become rejected promises. Return the
|
|
62
|
-
* original work promise; a separate observer marks rejections incomplete and fatal ones sticky,
|
|
63
|
-
* so catching an agent failure cannot hide its effect on workflow completion. */
|
|
64
|
-
track(operation) {
|
|
65
|
-
if (!this.accepting)
|
|
66
|
-
return Promise.reject(new HarnessSdkError('WORKFLOW_CLOSED'));
|
|
67
|
-
let work;
|
|
68
|
-
try {
|
|
69
|
-
this.assertDispatch();
|
|
70
|
-
work = operation();
|
|
71
|
-
}
|
|
72
|
-
catch (cause) {
|
|
73
|
-
work = Promise.reject(cause);
|
|
74
|
-
}
|
|
75
|
-
const observed = work.then(() => { }, cause => {
|
|
76
|
-
this.noteIncomplete();
|
|
77
|
-
const error = sdkError(cause, 'WORKFLOW_STEP_FAILED');
|
|
78
|
-
if (isFatal(error))
|
|
79
|
-
this.stop(error);
|
|
80
|
-
});
|
|
81
|
-
this.pending.add(observed);
|
|
82
|
-
void observed.then(() => { this.pending.delete(observed); });
|
|
83
|
-
return work;
|
|
84
|
-
}
|
|
85
|
-
/** Stop admitting agent work synchronously, then await all work already registered by track.
|
|
86
|
-
* completeRun calls this before publication; abortRun repeats it on failure. Operation
|
|
87
|
-
* rejections are recorded in state rather than rethrown by the drain. Active work is not cancelled. */
|
|
88
|
-
async closeAndDrain() {
|
|
89
|
-
this.accepting = false;
|
|
90
|
-
await Promise.all([...this.pending]);
|
|
91
|
-
}
|
|
92
|
-
accepting = true;
|
|
93
|
-
pending = new Set();
|
|
94
|
-
stops = new Set();
|
|
95
|
-
incomplete = false;
|
|
96
|
-
}
|
package/src/workflow-types.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** Identify a new durable run and optionally supply a compatible source journal for replay. */
|
|
2
|
-
export interface WorkflowOptions<Input> {
|
|
3
|
-
/** Nonempty workflow name. Resume requires the same name in the source manifest. */
|
|
4
|
-
name: string;
|
|
5
|
-
/** Nonempty application-managed revision. Change it when existing journals are incompatible. */
|
|
6
|
-
revision: string;
|
|
7
|
-
/** Nonempty storage root. Relative paths are resolved against the process working directory. */
|
|
8
|
-
directory: string;
|
|
9
|
-
/** New target directory name, defaulting to a random UUID. Use a nonblank single path
|
|
10
|
-
* component of at most 255 UTF-8 bytes. Control characters, separators, `.` and `..` are
|
|
11
|
-
* invalid. A locked or nonempty target directory rejects. */
|
|
12
|
-
runId?: string;
|
|
13
|
-
/** Strict JSON input. The body receives a deeply frozen copy. */
|
|
14
|
-
input: Input;
|
|
15
|
-
/** Omit for a fresh journal. A string selects a run under `directory`. An object supplies the
|
|
16
|
-
* source's storage root and ID explicitly. Resume requires an inactive source with matching
|
|
17
|
-
* name and revision and copies its journal into the new run before invoking the body. */
|
|
18
|
-
resumeFrom?: string | {
|
|
19
|
-
directory: string;
|
|
20
|
-
runId: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/** Body inputs available after the initial manifest has been published. */
|
|
24
|
-
export interface WorkflowContext<Input> {
|
|
25
|
-
/** Identity of the new run, including when replaying a source journal. */
|
|
26
|
-
readonly runId: string;
|
|
27
|
-
/** Isolated, deeply frozen JSON copy of the input supplied for this invocation. */
|
|
28
|
-
readonly input: Input;
|
|
29
|
-
}
|
|
30
|
-
/** Published body result returned after registered agent work settles and the writer lock is released. */
|
|
31
|
-
export interface WorkflowResult<Result> {
|
|
32
|
-
/** Identity of the run that published this result. */
|
|
33
|
-
runId: string;
|
|
34
|
-
/** Incomplete if registered agent work rejected or was dropped and the workflow could still
|
|
35
|
-
* publish a result. Fatal agent failures reject the workflow promise. */
|
|
36
|
-
status: 'completed' | 'incomplete';
|
|
37
|
-
/** JSON copy of the awaited body return value. */
|
|
38
|
-
result: Result;
|
|
39
|
-
}
|
package/src/workflow-types.js
DELETED
|
File without changes
|
package/src/workflow.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { WorkflowContext, WorkflowOptions, WorkflowResult } from "./workflow-types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Run a body with a durable identity, frozen JSON input and journaled agent calls.
|
|
4
|
-
* After saving the initial manifest, invoke the body with the new run's ID and input.
|
|
5
|
-
* On resume, the body runs from the beginning and eligible agent calls reuse source journal results.
|
|
6
|
-
* The body owns any side effects outside those reused calls and must account for re-execution.
|
|
7
|
-
* Supply strict JSON for the input and the awaited body result, and await any background work
|
|
8
|
-
* other than registered agent calls inside the body. Keep borrowed clients alive until the
|
|
9
|
-
* workflow promise settles and dispose them separately.
|
|
10
|
-
*
|
|
11
|
-
* Resolve with a JSON copy of the body result after registered agent work settles, publication
|
|
12
|
-
* succeeds and the writer lock is released. Drops and recovered ordinary agent failures can
|
|
13
|
-
* yield an incomplete result. Invalid inputs, body errors, fatal agent failures, and storage
|
|
14
|
-
* failures reject. Run failures report the run ID and storage root in SDK error details. A
|
|
15
|
-
* lock-release failure can reject after the result and terminal manifest have been published.
|
|
16
|
-
*/
|
|
17
|
-
export declare function workflow<Input, Result>(options: WorkflowOptions<Input>, body: (run: WorkflowContext<Input>) => Result | Promise<Result>): Promise<WorkflowResult<Awaited<Result>>>;
|
package/src/workflow.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { HarnessSdkError, sdkError } from '@anureo/sdk';
|
|
3
|
-
import { RunState, storedFailure } from "./workflow-state.js";
|
|
4
|
-
import { runWith } from "./run-context.js";
|
|
5
|
-
import { freezeJson, jsonCopy } from "./persistence/json.js";
|
|
6
|
-
import { openFileRun } from "./persistence/store.js";
|
|
7
|
-
/**
|
|
8
|
-
* Run a body with a durable identity, frozen JSON input and journaled agent calls.
|
|
9
|
-
* After saving the initial manifest, invoke the body with the new run's ID and input.
|
|
10
|
-
* On resume, the body runs from the beginning and eligible agent calls reuse source journal results.
|
|
11
|
-
* The body owns any side effects outside those reused calls and must account for re-execution.
|
|
12
|
-
* Supply strict JSON for the input and the awaited body result, and await any background work
|
|
13
|
-
* other than registered agent calls inside the body. Keep borrowed clients alive until the
|
|
14
|
-
* workflow promise settles and dispose them separately.
|
|
15
|
-
*
|
|
16
|
-
* Resolve with a JSON copy of the body result after registered agent work settles, publication
|
|
17
|
-
* succeeds and the writer lock is released. Drops and recovered ordinary agent failures can
|
|
18
|
-
* yield an incomplete result. Invalid inputs, body errors, fatal agent failures, and storage
|
|
19
|
-
* failures reject. Run failures report the run ID and storage root in SDK error details. A
|
|
20
|
-
* lock-release failure can reject after the result and terminal manifest have been published.
|
|
21
|
-
*/
|
|
22
|
-
export async function workflow(options, body) {
|
|
23
|
-
const runId = options?.runId ?? randomUUID();
|
|
24
|
-
const state = new RunState();
|
|
25
|
-
let handle;
|
|
26
|
-
let publishedResult;
|
|
27
|
-
try {
|
|
28
|
-
const { storageOptions, context } = prepareRun(options, body, runId);
|
|
29
|
-
handle = await openFileRun(storageOptions);
|
|
30
|
-
publishedResult = await completeRun({ handle, state, body, context });
|
|
31
|
-
}
|
|
32
|
-
catch (cause) {
|
|
33
|
-
await abortRun({ cause, state, handle });
|
|
34
|
-
}
|
|
35
|
-
finally {
|
|
36
|
-
if (handle) {
|
|
37
|
-
try {
|
|
38
|
-
await handle.close();
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
state.noteStorageFailure();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const failure = state.failure;
|
|
46
|
-
if (failure) {
|
|
47
|
-
throw new HarnessSdkError(failure.code, failure.message, false, failure.outcomeUnknown, {
|
|
48
|
-
...failure.details,
|
|
49
|
-
runId,
|
|
50
|
-
directory: handle?.identity.directory ?? options?.directory,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
// A failed publication also stops the run, so only published results reach this return.
|
|
54
|
-
return { runId, status: state.status, result: publishedResult };
|
|
55
|
-
}
|
|
56
|
-
/** Prepare workflow's storage options and body context from the same frozen input snapshot.
|
|
57
|
-
* Missing or non-object options, a non-function body or non-JSON input throw before storage opens. */
|
|
58
|
-
function prepareRun(options, body, runId) {
|
|
59
|
-
if (!options || typeof options !== 'object' || typeof body !== 'function') {
|
|
60
|
-
throw new HarnessSdkError('INVALID_PARAMS');
|
|
61
|
-
}
|
|
62
|
-
const input = freezeJson(jsonCopy(options.input));
|
|
63
|
-
const resumeFrom = options.resumeFrom && typeof options.resumeFrom === 'object'
|
|
64
|
-
? { ...options.resumeFrom } : options.resumeFrom;
|
|
65
|
-
return {
|
|
66
|
-
storageOptions: { ...options, runId, input: input, resumeFrom },
|
|
67
|
-
context: { runId, input },
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/** Run workflow's body in the journal context and stop dispatch if it throws or rejects.
|
|
71
|
-
* Drain before checking sticky failure so agent settlement can still change the outcome.
|
|
72
|
-
* Return the JSON copy after publication. A rejection sends workflow through abortRun before release. */
|
|
73
|
-
async function completeRun({ handle, state, body, context }) {
|
|
74
|
-
let value;
|
|
75
|
-
try {
|
|
76
|
-
value = await runWith({ journal: handle.journal, state }, async () => body(context));
|
|
77
|
-
}
|
|
78
|
-
catch (cause) {
|
|
79
|
-
state.stop(sdkError(cause, 'WORKFLOW_BODY_FAILED'));
|
|
80
|
-
}
|
|
81
|
-
await state.closeAndDrain();
|
|
82
|
-
const failure = state.failure;
|
|
83
|
-
if (failure)
|
|
84
|
-
throw failure;
|
|
85
|
-
const result = jsonCopy(value);
|
|
86
|
-
await handle.finish(state.status, result);
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
/** Record workflow's failure and drain before publishing the aggregate to an acquired handle.
|
|
90
|
-
* Initialization failures can arrive before a handle exists. An abort publication error is
|
|
91
|
-
* recorded as a storage failure. workflow still releases the handle and reports the final aggregate. */
|
|
92
|
-
async function abortRun({ cause, state, handle }) {
|
|
93
|
-
const error = sdkError(cause, 'WORKFLOW_FAILED');
|
|
94
|
-
state.stop(error);
|
|
95
|
-
await state.closeAndDrain();
|
|
96
|
-
if (handle) {
|
|
97
|
-
try {
|
|
98
|
-
await handle.abort(storedFailure(state.failure ?? error));
|
|
99
|
-
}
|
|
100
|
-
catch {
|
|
101
|
-
state.noteStorageFailure();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|