@temps-sdk/workflows 0.0.0-stage → 0.1.0-beta.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/dist/adapters.d.ts +28 -0
- package/dist/adapters.d.ts.map +1 -0
- package/dist/adapters.js +55 -0
- package/dist/adapters.js.map +1 -0
- package/dist/client.d.ts +73 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +102 -0
- package/dist/client.js.map +1 -0
- package/dist/codec.d.ts +22 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +127 -0
- package/dist/codec.js.map +1 -0
- package/dist/conformance/fixtures.d.ts +32 -0
- package/dist/conformance/fixtures.d.ts.map +1 -0
- package/dist/conformance/fixtures.js +109 -0
- package/dist/conformance/fixtures.js.map +1 -0
- package/dist/conformance/suite.d.ts +34 -0
- package/dist/conformance/suite.d.ts.map +1 -0
- package/dist/conformance/suite.js +239 -0
- package/dist/conformance/suite.js.map +1 -0
- package/dist/errors.d.ts +53 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +100 -0
- package/dist/errors.js.map +1 -0
- package/dist/handler.d.ts +51 -0
- package/dist/handler.d.ts.map +1 -0
- package/dist/handler.js +218 -0
- package/dist/handler.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +159 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +19 -0
- package/dist/protocol.js.map +1 -0
- package/dist/replay.d.ts +45 -0
- package/dist/replay.d.ts.map +1 -0
- package/dist/replay.js +485 -0
- package/dist/replay.js.map +1 -0
- package/dist/telemetry.d.ts +66 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +89 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/testing/fake-orchestrator.d.ts +116 -0
- package/dist/testing/fake-orchestrator.d.ts.map +1 -0
- package/dist/testing/fake-orchestrator.js +556 -0
- package/dist/testing/fake-orchestrator.js.map +1 -0
- package/dist/testing/index.d.ts +57 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +72 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/token.d.ts +26 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +82 -0
- package/dist/token.js.map +1 -0
- package/dist/transport.d.ts +30 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +114 -0
- package/dist/transport.js.map +1 -0
- package/dist/workflow.d.ts +97 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +45 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +64 -4
- package/README.md +0 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { FetchHandler } from '../handler.js';
|
|
2
|
+
import { type JournalEntry, type JsonValue, type RunStatus } from '../protocol.js';
|
|
3
|
+
import { type ConformanceFixtures } from './fixtures.js';
|
|
4
|
+
export interface RunView {
|
|
5
|
+
status: RunStatus;
|
|
6
|
+
output: JsonValue | null | undefined;
|
|
7
|
+
error: string | null | undefined;
|
|
8
|
+
errorKind: string | null | undefined;
|
|
9
|
+
}
|
|
10
|
+
/** What a case needs from an orchestrator. */
|
|
11
|
+
export interface ConformanceTarget {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
start(workflow: string, input?: JsonValue, idempotencyKey?: string): Promise<{
|
|
14
|
+
runId: string;
|
|
15
|
+
created: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
sendEvent(name: string, key?: string, payload?: JsonValue): Promise<number>;
|
|
18
|
+
run(runId: string): Promise<RunView>;
|
|
19
|
+
journal(runId: string): Promise<JournalEntry[]>;
|
|
20
|
+
/** Start due invocations without waiting for them. */
|
|
21
|
+
kick(): Promise<void>;
|
|
22
|
+
/** Until nothing is due and nothing is in flight. */
|
|
23
|
+
settle(): Promise<void>;
|
|
24
|
+
/** Let `ms` pass for timers (sleeps, retry backoff, wait timeouts), then settle. */
|
|
25
|
+
advance(ms: number): Promise<void>;
|
|
26
|
+
/** The lease of a running run expires, as when its replica dies. */
|
|
27
|
+
expireLease(runId: string): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export interface ConformanceCase {
|
|
30
|
+
name: string;
|
|
31
|
+
run(target: ConformanceTarget, fixtures: ConformanceFixtures, handler: FetchHandler): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export declare const conformanceCases: ConformanceCase[];
|
|
34
|
+
//# sourceMappingURL=suite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../src/conformance/suite.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAgD,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACjI,OAAO,EAA+C,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEtG,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IACrC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtC;AAED,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAClH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5E,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAChD,sDAAsD;IACtD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,qDAAqD;IACrD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,oFAAoF;IACpF,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,oEAAoE;IACpE,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrG;AAYD,eAAO,MAAM,gBAAgB,EAAE,eAAe,EAiO7C,CAAC"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2024-2026 Temps Contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* The executor protocol conformance suite (version 1).
|
|
5
|
+
*
|
|
6
|
+
* Each case drives the SDK through an orchestrator: the in-memory fake
|
|
7
|
+
* (`fake.test.ts`) or the real engine (`scripts/real-engine-conformance.ts`,
|
|
8
|
+
* run by the engine's test). Both must pass: the fake proves the SDK against
|
|
9
|
+
* the specification, the real engine proves the specification is the
|
|
10
|
+
* engine's.
|
|
11
|
+
*/
|
|
12
|
+
import assert from 'node:assert/strict';
|
|
13
|
+
import { generateKeyPairSync, sign } from 'node:crypto';
|
|
14
|
+
import { INVOKE_PATH, PROTOCOL_VERSION, TOKEN_VERSION } from '../protocol.js';
|
|
15
|
+
import { RETRY_BACKOFF_MS, SLEEP_MS, WAIT_TIMEOUT_MS } from './fixtures.js';
|
|
16
|
+
const unique = () => Math.random().toString(36).slice(2, 10);
|
|
17
|
+
async function until(what, check, timeoutMs = 10_000) {
|
|
18
|
+
const deadline = Date.now() + timeoutMs;
|
|
19
|
+
while (!(await check())) {
|
|
20
|
+
if (Date.now() > deadline)
|
|
21
|
+
throw new Error(`timed out waiting for ${what}`);
|
|
22
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export const conformanceCases = [
|
|
26
|
+
{
|
|
27
|
+
name: 'replay: recorded steps are not run again after a suspension',
|
|
28
|
+
async run(target, fixtures) {
|
|
29
|
+
const { runId } = await target.start('conf-replay', { case: unique() });
|
|
30
|
+
await target.settle();
|
|
31
|
+
assert.equal((await target.run(runId)).status, 'sleeping');
|
|
32
|
+
assert.equal(fixtures.effects.get('conf-replay/a'), 1);
|
|
33
|
+
await target.advance(SLEEP_MS + 500);
|
|
34
|
+
const run = await target.run(runId);
|
|
35
|
+
assert.equal(run.status, 'completed', `run ended ${run.status}: ${run.error}`);
|
|
36
|
+
assert.equal(fixtures.effects.get('conf-replay/a'), 1, 'step a ran again on replay');
|
|
37
|
+
assert.equal(fixtures.effects.get('conf-replay/b'), 1);
|
|
38
|
+
const journal = await target.journal(runId);
|
|
39
|
+
assert.deepEqual(journal.map((entry) => [entry.sequence, entry.name, entry.kind, entry.status]), [
|
|
40
|
+
[0, 'a', 'step', 'completed'],
|
|
41
|
+
[1, 'pause', 'sleep', 'completed'],
|
|
42
|
+
[2, 'b', 'step', 'completed'],
|
|
43
|
+
[3, 'now', 'now', 'completed'],
|
|
44
|
+
[4, 'random', 'random', 'completed'],
|
|
45
|
+
]);
|
|
46
|
+
const output = run.output;
|
|
47
|
+
assert.equal(new Date(String(journal[3]?.result)).toISOString(), output.now, 'now() was not the recorded value');
|
|
48
|
+
assert.equal(journal[4]?.result, output.random, 'random() was not the recorded value');
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'retries: a failing step is retried with backoff and its attempts recorded',
|
|
53
|
+
async run(target, fixtures) {
|
|
54
|
+
const { runId } = await target.start('conf-retry', { case: unique() });
|
|
55
|
+
await target.settle();
|
|
56
|
+
assert.equal((await target.run(runId)).status, 'retrying');
|
|
57
|
+
await target.advance(RETRY_BACKOFF_MS + 300);
|
|
58
|
+
await target.advance(RETRY_BACKOFF_MS * 2 + 300);
|
|
59
|
+
const run = await target.run(runId);
|
|
60
|
+
assert.equal(run.status, 'completed', `run ended ${run.status}: ${run.error}`);
|
|
61
|
+
assert.deepEqual(run.output, { attempt: 3 });
|
|
62
|
+
assert.equal(fixtures.effects.get('conf-retry/flaky'), 3);
|
|
63
|
+
const [entry] = await target.journal(runId);
|
|
64
|
+
assert.equal(entry?.status, 'completed');
|
|
65
|
+
assert.equal(entry?.attempts, 3);
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'retries: a step out of attempts fails the run with the step named',
|
|
70
|
+
async run(target, fixtures) {
|
|
71
|
+
const { runId } = await target.start('conf-retry-exhausted', { case: unique() });
|
|
72
|
+
await target.settle();
|
|
73
|
+
await target.advance(RETRY_BACKOFF_MS + 300);
|
|
74
|
+
const run = await target.run(runId);
|
|
75
|
+
assert.equal(run.status, 'failed');
|
|
76
|
+
assert.equal(run.errorKind, 'step_failed');
|
|
77
|
+
assert.match(String(run.error), /always-fails.*the upstream is down/);
|
|
78
|
+
assert.equal(fixtures.effects.get('conf-retry-exhausted/always-fails'), 2);
|
|
79
|
+
const [entry] = await target.journal(runId);
|
|
80
|
+
assert.equal(entry?.status, 'failed');
|
|
81
|
+
assert.equal(entry?.attempts, 2);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'suspend/resume: a run waits for its event and resumes with the payload',
|
|
86
|
+
async run(target, fixtures) {
|
|
87
|
+
const key = `order-${unique()}`;
|
|
88
|
+
const { runId } = await target.start('conf-suspend', { key });
|
|
89
|
+
await target.settle();
|
|
90
|
+
assert.equal((await target.run(runId)).status, 'waiting');
|
|
91
|
+
assert.equal(await target.sendEvent('conf.approved', `${key}-other`, { by: 'nobody' }), 0, 'another key woke the run');
|
|
92
|
+
assert.equal(await target.sendEvent('conf.approved', key, { by: 'operator' }), 1);
|
|
93
|
+
await target.settle();
|
|
94
|
+
const run = await target.run(runId);
|
|
95
|
+
assert.equal(run.status, 'completed', `run ended ${run.status}: ${run.error}`);
|
|
96
|
+
assert.deepEqual(run.output, { approval: { received: true, payload: { by: 'operator' } }, after: 1 });
|
|
97
|
+
assert.equal(fixtures.effects.get('conf-suspend/after'), 1);
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'suspend/resume: an event sent before the run waits is not lost',
|
|
102
|
+
async run(target) {
|
|
103
|
+
const key = `early-${unique()}`;
|
|
104
|
+
const { runId } = await target.start('conf-suspend', { key });
|
|
105
|
+
assert.equal(await target.sendEvent('conf.approved', key, { early: true }), 0);
|
|
106
|
+
await target.settle();
|
|
107
|
+
const run = await target.run(runId);
|
|
108
|
+
assert.equal(run.status, 'completed', `run ended ${run.status}: ${run.error}`);
|
|
109
|
+
assert.deepEqual(run.output.approval, { received: true, payload: { early: true } });
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'suspend/resume: a wait times out with received false',
|
|
114
|
+
async run(target) {
|
|
115
|
+
const { runId } = await target.start('conf-suspend', { key: `late-${unique()}`, timeoutMs: WAIT_TIMEOUT_MS });
|
|
116
|
+
await target.settle();
|
|
117
|
+
assert.equal((await target.run(runId)).status, 'waiting');
|
|
118
|
+
await target.advance(WAIT_TIMEOUT_MS + 500);
|
|
119
|
+
const run = await target.run(runId);
|
|
120
|
+
assert.equal(run.status, 'completed', `run ended ${run.status}: ${run.error}`);
|
|
121
|
+
assert.deepEqual(run.output.approval, { received: false, payload: null });
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'incompatibility: code that no longer matches the journal fails the run, keeping the journal',
|
|
126
|
+
async run(target, fixtures) {
|
|
127
|
+
const { runId } = await target.start('conf-incompatible', { case: unique() });
|
|
128
|
+
await target.settle();
|
|
129
|
+
assert.equal((await target.run(runId)).status, 'sleeping');
|
|
130
|
+
fixtures.variant.current = 'b';
|
|
131
|
+
await target.advance(SLEEP_MS + 500);
|
|
132
|
+
const run = await target.run(runId);
|
|
133
|
+
assert.equal(run.status, 'failed');
|
|
134
|
+
assert.equal(run.errorKind, 'incompatible');
|
|
135
|
+
assert.match(String(run.error), /WorkflowIncompatible/);
|
|
136
|
+
assert.match(String(run.error), /one/);
|
|
137
|
+
assert.match(String(run.error), /uno/);
|
|
138
|
+
assert.equal(fixtures.effects.get('conf-incompatible/uno'), undefined, 'the new step ran');
|
|
139
|
+
assert.equal((await target.journal(runId)).length, 2, 'the journal was not kept');
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'stale lease: a write from an expired lease is rejected and the step is recorded once',
|
|
144
|
+
async run(target, fixtures) {
|
|
145
|
+
const { runId } = await target.start('conf-gated', { case: unique() });
|
|
146
|
+
await target.kick();
|
|
147
|
+
await until('the first invocation to enter the step', () => fixtures.effects.get('conf-gated/entered') === 1);
|
|
148
|
+
await target.expireLease(runId);
|
|
149
|
+
await target.kick();
|
|
150
|
+
await until('the second invocation to enter the step', () => fixtures.effects.get('conf-gated/entered') === 2);
|
|
151
|
+
fixtures.gated.gate.open();
|
|
152
|
+
await target.settle();
|
|
153
|
+
const run = await target.run(runId);
|
|
154
|
+
assert.equal(run.status, 'completed', `run ended ${run.status}: ${run.error}`);
|
|
155
|
+
const journal = await target.journal(runId);
|
|
156
|
+
assert.equal(journal.length, 1);
|
|
157
|
+
// Whichever invocation wrote: only the current lease's write is kept.
|
|
158
|
+
assert.deepEqual(run.output, journal[0]?.result);
|
|
159
|
+
assert.deepEqual(run.output, { entered: 2 });
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'stale lease: the handler refuses a token Temps did not sign, before any code runs',
|
|
164
|
+
async run(_target, fixtures, handler) {
|
|
165
|
+
const { privateKey } = generateKeyPairSync('ed25519');
|
|
166
|
+
const body = JSON.stringify({
|
|
167
|
+
protocol_version: PROTOCOL_VERSION,
|
|
168
|
+
run_id: '00000000-0000-0000-0000-000000000000',
|
|
169
|
+
workflow: 'conf-idempotent',
|
|
170
|
+
attempt: 1,
|
|
171
|
+
lease: 1,
|
|
172
|
+
now: new Date().toISOString(),
|
|
173
|
+
deadline_at: new Date(Date.now() + 60_000).toISOString(),
|
|
174
|
+
lease_expires_at: new Date(Date.now() + 60_000).toISOString(),
|
|
175
|
+
input: null,
|
|
176
|
+
journal: [],
|
|
177
|
+
});
|
|
178
|
+
const claims = Buffer.from(JSON.stringify({ v: 1, typ: 'invoke', pid: 1, eid: 1, run: '00000000-0000-0000-0000-000000000000', lease: 1, exp: Math.floor(Date.now() / 1000) + 60 })).toString('base64url');
|
|
179
|
+
const signature = sign(null, Buffer.from(`${TOKEN_VERSION}.${claims}`), privateKey).toString('base64url');
|
|
180
|
+
const before = fixtures.effects.get('conf-idempotent/once') ?? 0;
|
|
181
|
+
const response = await handler(new Request(`http://executor${INVOKE_PATH}`, {
|
|
182
|
+
method: 'POST',
|
|
183
|
+
headers: { authorization: `Bearer ${TOKEN_VERSION}.${claims}.${signature}`, 'content-type': 'application/json' },
|
|
184
|
+
body,
|
|
185
|
+
}));
|
|
186
|
+
assert.equal(response.status, 401);
|
|
187
|
+
assert.equal(fixtures.effects.get('conf-idempotent/once') ?? 0, before, 'workflow code ran for a forged request');
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: 'idempotent start: the same key returns the same run',
|
|
192
|
+
async run(target, fixtures) {
|
|
193
|
+
const key = `idem-${unique()}`;
|
|
194
|
+
const first = await target.start('conf-idempotent', { n: 1 }, key);
|
|
195
|
+
const second = await target.start('conf-idempotent', { n: 2 }, key);
|
|
196
|
+
assert.equal(first.created, true);
|
|
197
|
+
assert.equal(second.created, false);
|
|
198
|
+
assert.equal(second.runId, first.runId);
|
|
199
|
+
await target.settle();
|
|
200
|
+
assert.equal((await target.run(first.runId)).status, 'completed');
|
|
201
|
+
assert.equal(fixtures.effects.get('conf-idempotent/once'), 1);
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: 'child workflows: a child starts once and the parent resumes with its output',
|
|
206
|
+
async run(target, fixtures) {
|
|
207
|
+
const { runId } = await target.start('conf-parent', { n: 7 });
|
|
208
|
+
await target.settle();
|
|
209
|
+
await until('the parent to complete', async () => (await target.run(runId)).status === 'completed');
|
|
210
|
+
const run = await target.run(runId);
|
|
211
|
+
const output = run.output;
|
|
212
|
+
assert.equal(output.child.status, 'completed');
|
|
213
|
+
assert.equal(output.child.output, 49);
|
|
214
|
+
assert.equal(output.child.error, null);
|
|
215
|
+
assert.equal(fixtures.effects.get('conf-parent/before'), 1, 'the parent re-ran a step while it waited');
|
|
216
|
+
assert.equal(fixtures.effects.get('conf-child/square'), 1, 'the child ran more than once');
|
|
217
|
+
const child = await target.run(output.child.run_id);
|
|
218
|
+
assert.equal(child.status, 'completed');
|
|
219
|
+
const journal = await target.journal(runId);
|
|
220
|
+
assert.deepEqual(journal.map((entry) => [entry.sequence, entry.name, entry.kind, entry.status]), [
|
|
221
|
+
[0, 'before', 'step', 'completed'],
|
|
222
|
+
[1, 'square', 'child', 'completed'],
|
|
223
|
+
]);
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: 'child workflows: a failed child reports its error and the parent decides',
|
|
228
|
+
async run(target) {
|
|
229
|
+
const { runId } = await target.start('conf-parent', { n: 2, fail: true });
|
|
230
|
+
await target.settle();
|
|
231
|
+
await until('the parent to complete', async () => (await target.run(runId)).status === 'completed');
|
|
232
|
+
const output = (await target.run(runId)).output;
|
|
233
|
+
assert.equal(output.child.status, 'failed');
|
|
234
|
+
assert.equal(output.child.output, null);
|
|
235
|
+
assert.match(output.child.error, /the child cannot square that/);
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
];
|
|
239
|
+
//# sourceMappingURL=suite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite.js","sourceRoot":"","sources":["../../src/conformance/suite.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,6CAA6C;AAE7C;;;;;;;;GAQG;AAEH,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAqD,MAAM,gBAAgB,CAAC;AACjI,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe,EAA4B,MAAM,eAAe,CAAC;AA+BtG,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAE7D,KAAK,UAAU,KAAK,CAAC,IAAY,EAAE,KAAuC,EAAE,SAAS,GAAG,MAAM;IAC5F,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IACxC,OAAO,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;QAC5E,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,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,0 +1,53 @@
|
|
|
1
|
+
/** A call to the Temps API failed. `title` is the RFC 7807 problem title. */
|
|
2
|
+
export declare class TempsApiError extends Error {
|
|
3
|
+
readonly operation: string;
|
|
4
|
+
readonly status: number;
|
|
5
|
+
readonly title: string | undefined;
|
|
6
|
+
readonly detail: string | undefined;
|
|
7
|
+
constructor(operation: string, status: number, title: string | undefined, detail: string | undefined);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Temps could not be reached, or answered with a server error, while the
|
|
11
|
+
* invocation read its journal or recorded an entry. Nothing about the run is
|
|
12
|
+
* wrong: the handler answers 503 so Temps retries the invocation with
|
|
13
|
+
* backoff, instead of reporting the run failed.
|
|
14
|
+
*/
|
|
15
|
+
export declare class TempsUnavailableError extends Error {
|
|
16
|
+
readonly runId: string;
|
|
17
|
+
readonly cause: TempsApiError;
|
|
18
|
+
constructor(runId: string, cause: TempsApiError);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The run was leased to another invocation (a lease expired, an operator
|
|
22
|
+
* cancelled or retried it). This invocation must stop without reporting.
|
|
23
|
+
*/
|
|
24
|
+
export declare class StaleLeaseError extends Error {
|
|
25
|
+
readonly runId: string;
|
|
26
|
+
constructor(runId: string, detail?: string);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Replay found a different step than the journal recorded: the workflow's
|
|
30
|
+
* code changed in an incompatible way since the run started.
|
|
31
|
+
*/
|
|
32
|
+
export declare class WorkflowIncompatibleError extends Error {
|
|
33
|
+
readonly runId: string;
|
|
34
|
+
readonly sequence: number;
|
|
35
|
+
readonly expected: string;
|
|
36
|
+
readonly found: string;
|
|
37
|
+
constructor(runId: string, sequence: number, expected: string, found: string);
|
|
38
|
+
}
|
|
39
|
+
/** A step exhausted its attempts. Catch it to continue the workflow. */
|
|
40
|
+
export declare class StepFailedError extends Error {
|
|
41
|
+
readonly step: string;
|
|
42
|
+
readonly sequence: number;
|
|
43
|
+
readonly attempts: number;
|
|
44
|
+
readonly reason: string;
|
|
45
|
+
constructor(step: string, sequence: number, attempts: number, reason: string);
|
|
46
|
+
}
|
|
47
|
+
/** An operator cancelled the run; the workflow stops at the next step. */
|
|
48
|
+
export declare class RunCancelledError extends Error {
|
|
49
|
+
readonly runId: string;
|
|
50
|
+
constructor(runId: string);
|
|
51
|
+
}
|
|
52
|
+
export declare function errorMessage(error: unknown): string;
|
|
53
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAGA,6EAA6E;AAC7E,qBAAa,aAAc,SAAQ,KAAK;aAEpB,SAAS,EAAE,MAAM;aACjB,MAAM,EAAE,MAAM;aACd,KAAK,EAAE,MAAM,GAAG,SAAS;aACzB,MAAM,EAAE,MAAM,GAAG,SAAS;gBAH1B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,MAAM,GAAG,SAAS;CAO7C;AAED;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;aAE5B,KAAK,EAAE,MAAM;aACb,KAAK,EAAE,aAAa;gBADpB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,aAAa;CAKvC;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,KAAK;aAEtB,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM,EAC7B,MAAM,CAAC,EAAE,MAAM;CAKlB;AAED;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;aAEhC,KAAK,EAAE,MAAM;aACb,QAAQ,EAAE,MAAM;aAChB,QAAQ,EAAE,MAAM;aAChB,KAAK,EAAE,MAAM;gBAHb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM;CAOhC;AAED,wEAAwE;AACxE,qBAAa,eAAgB,SAAQ,KAAK;aAEtB,IAAI,EAAE,MAAM;aACZ,QAAQ,EAAE,MAAM;aAChB,QAAQ,EAAE,MAAM;aAChB,MAAM,EAAE,MAAM;gBAHd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM;CAKjC;AAED,0EAA0E;AAC1E,qBAAa,iBAAkB,SAAQ,KAAK;aACd,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;CAI1C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQnD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2024-2026 Temps Contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
3
|
+
/** A call to the Temps API failed. `title` is the RFC 7807 problem title. */
|
|
4
|
+
export class TempsApiError extends Error {
|
|
5
|
+
operation;
|
|
6
|
+
status;
|
|
7
|
+
title;
|
|
8
|
+
detail;
|
|
9
|
+
constructor(operation, status, title, detail) {
|
|
10
|
+
super(`Temps API ${operation} failed with ${status}${title ? ` ${title}` : ''}${detail ? `: ${detail}` : ''}`);
|
|
11
|
+
this.operation = operation;
|
|
12
|
+
this.status = status;
|
|
13
|
+
this.title = title;
|
|
14
|
+
this.detail = detail;
|
|
15
|
+
this.name = 'TempsApiError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Temps could not be reached, or answered with a server error, while the
|
|
20
|
+
* invocation read its journal or recorded an entry. Nothing about the run is
|
|
21
|
+
* wrong: the handler answers 503 so Temps retries the invocation with
|
|
22
|
+
* backoff, instead of reporting the run failed.
|
|
23
|
+
*/
|
|
24
|
+
export class TempsUnavailableError extends Error {
|
|
25
|
+
runId;
|
|
26
|
+
cause;
|
|
27
|
+
constructor(runId, cause) {
|
|
28
|
+
super(`Temps was unavailable during run ${runId}: ${cause.message}`);
|
|
29
|
+
this.runId = runId;
|
|
30
|
+
this.cause = cause;
|
|
31
|
+
this.name = 'TempsUnavailableError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The run was leased to another invocation (a lease expired, an operator
|
|
36
|
+
* cancelled or retried it). This invocation must stop without reporting.
|
|
37
|
+
*/
|
|
38
|
+
export class StaleLeaseError extends Error {
|
|
39
|
+
runId;
|
|
40
|
+
constructor(runId, detail) {
|
|
41
|
+
super(`Run ${runId} is held by another invocation${detail ? `: ${detail}` : ''}`);
|
|
42
|
+
this.runId = runId;
|
|
43
|
+
this.name = 'StaleLeaseError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Replay found a different step than the journal recorded: the workflow's
|
|
48
|
+
* code changed in an incompatible way since the run started.
|
|
49
|
+
*/
|
|
50
|
+
export class WorkflowIncompatibleError extends Error {
|
|
51
|
+
runId;
|
|
52
|
+
sequence;
|
|
53
|
+
expected;
|
|
54
|
+
found;
|
|
55
|
+
constructor(runId, sequence, expected, found) {
|
|
56
|
+
super(`Workflow run ${runId} is incompatible with the deployed code at step ${sequence}: the journal recorded '${expected}', the code reached '${found}'`);
|
|
57
|
+
this.runId = runId;
|
|
58
|
+
this.sequence = sequence;
|
|
59
|
+
this.expected = expected;
|
|
60
|
+
this.found = found;
|
|
61
|
+
this.name = 'WorkflowIncompatibleError';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** A step exhausted its attempts. Catch it to continue the workflow. */
|
|
65
|
+
export class StepFailedError extends Error {
|
|
66
|
+
step;
|
|
67
|
+
sequence;
|
|
68
|
+
attempts;
|
|
69
|
+
reason;
|
|
70
|
+
constructor(step, sequence, attempts, reason) {
|
|
71
|
+
super(`Step '${step}' failed after ${attempts} attempt(s): ${reason}`);
|
|
72
|
+
this.step = step;
|
|
73
|
+
this.sequence = sequence;
|
|
74
|
+
this.attempts = attempts;
|
|
75
|
+
this.reason = reason;
|
|
76
|
+
this.name = 'StepFailedError';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** An operator cancelled the run; the workflow stops at the next step. */
|
|
80
|
+
export class RunCancelledError extends Error {
|
|
81
|
+
runId;
|
|
82
|
+
constructor(runId) {
|
|
83
|
+
super(`Workflow run ${runId} was cancelled`);
|
|
84
|
+
this.runId = runId;
|
|
85
|
+
this.name = 'RunCancelledError';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export function errorMessage(error) {
|
|
89
|
+
if (error instanceof Error)
|
|
90
|
+
return error.message || error.name;
|
|
91
|
+
if (typeof error === 'string')
|
|
92
|
+
return error;
|
|
93
|
+
try {
|
|
94
|
+
return JSON.stringify(error) ?? String(error);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return String(error);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,6CAA6C;AAE7C,6EAA6E;AAC7E,MAAM,OAAO,aAAc,SAAQ,KAAK;IAEpB;IACA;IACA;IACA;IAJlB,YACkB,SAAiB,EACjB,MAAc,EACd,KAAyB,EACzB,MAA0B;QAE1C,KAAK,CACH,aAAa,SAAS,gBAAgB,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACxG,CAAC;QAPc,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAQ;QACd,UAAK,GAAL,KAAK,CAAoB;QACzB,WAAM,GAAN,MAAM,CAAoB;QAK1C,IAAI,CAAC,IAAI,GAAG,eAAe,CA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MAAM,EAAE,CAAC,CAAC;QALvD,SAAI,GAAJ,IAAI,CAAQ;QACZ,aAAQ,GAAR,QAAQ,CAAQ;QAChB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAQ;QAG9B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,0EAA0E;AAC1E,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACd;IAA5B,YAA4B,KAAa;QACvC,KAAK,CAAC,gBAAgB,KAAK,gBAAgB,CAAC,CAAC;QADnB,UAAK,GAAL,KAAK,CAAQ;QAEvC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC;IAC/D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The executor's HTTP surface: `GET /.well-known/temps/workflows/manifest`
|
|
3
|
+
* and `POST /.well-known/temps/workflows/invoke`, as a Fetch API handler
|
|
4
|
+
* (`(Request) => Promise<Response>`) that the adapters mount in Node's http
|
|
5
|
+
* server, Express, Next.js or Hono.
|
|
6
|
+
*
|
|
7
|
+
* Every request must carry an invocation token signed by this Temps
|
|
8
|
+
* instance for this app's own project and environment; the handler verifies
|
|
9
|
+
* it before reading the body or running any workflow code. The key, and the
|
|
10
|
+
* environment it binds tokens to, are read with the environment's workflow
|
|
11
|
+
* credential (`TEMPS_WORKFLOWS_TOKEN`).
|
|
12
|
+
*/
|
|
13
|
+
import type { PayloadCodec } from './codec.js';
|
|
14
|
+
import { type InvocationKey } from './protocol.js';
|
|
15
|
+
import { type TelemetryOptions } from './telemetry.js';
|
|
16
|
+
import { type FetchLike } from './transport.js';
|
|
17
|
+
import type { WorkflowDefinition } from './workflow.js';
|
|
18
|
+
export declare const SDK_NAME = "@temps-sdk/workflows/0.1.0";
|
|
19
|
+
/** Longest invoke body accepted (the journal travels in it). */
|
|
20
|
+
export declare const MAX_INVOKE_BODY: number;
|
|
21
|
+
export interface WorkflowHandlerOptions extends TelemetryOptions {
|
|
22
|
+
codec?: PayloadCodec;
|
|
23
|
+
workflows: WorkflowDefinition[];
|
|
24
|
+
/** Temps' API root; default `process.env.TEMPS_API_URL`. */
|
|
25
|
+
apiUrl?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The environment's workflow credential, used to read the invocation key
|
|
28
|
+
* and the project and environment it accepts tokens for; default
|
|
29
|
+
* `process.env.TEMPS_WORKFLOWS_TOKEN`.
|
|
30
|
+
*/
|
|
31
|
+
token?: string;
|
|
32
|
+
/** Pin the invocation key (and its environment) instead of fetching it (tests, air-gapped setups). */
|
|
33
|
+
invocationKey?: InvocationKey;
|
|
34
|
+
fetch?: FetchLike;
|
|
35
|
+
/** Heartbeat interval override, for tests. */
|
|
36
|
+
heartbeatMs?: number;
|
|
37
|
+
}
|
|
38
|
+
export type FetchHandler = (request: Request) => Promise<Response>;
|
|
39
|
+
/**
|
|
40
|
+
* Create the workflow handler.
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* const handler = createWorkflowHandler({ workflows: [sendInvoice] });
|
|
44
|
+
* // Node http / Express: app.use(toNodeListener(handler))
|
|
45
|
+
* // Next.js App Router: app/.well-known/temps/workflows/[action]/route.ts
|
|
46
|
+
* // export const { GET, POST } = nextRouteHandlers(handler)
|
|
47
|
+
* // Hono: app.all('/.well-known/temps/workflows/*', (c) => handler(c.req.raw))
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function createWorkflowHandler(options: WorkflowHandlerOptions): FetchHandler;
|
|
51
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAKL,KAAK,aAAa,EAGnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAQlE,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,eAAO,MAAM,QAAQ,+BAA+B,CAAC;AAErD,gEAAgE;AAChE,eAAO,MAAM,eAAe,QAAmB,CAAC;AAIhD,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sGAAsG;IACtG,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AA4FnE;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,YAAY,CAoHnF"}
|