@codemation/eventbus-redis 0.0.39 → 0.0.40
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 +7 -0
- package/dist/index.d.ts +169 -126
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @codemation/eventbus-redis
|
|
2
2
|
|
|
3
|
+
## 0.0.40
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`3044474`](https://github.com/MadeRelevant/codemation/commit/3044474495525490735510ff74500b53761284b6)]:
|
|
8
|
+
- @codemation/core@0.12.0
|
|
9
|
+
|
|
3
10
|
## 0.0.39
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import IORedis from "ioredis";
|
|
2
2
|
|
|
3
|
-
//#region ../core/src/contracts/
|
|
3
|
+
//#region ../core/src/contracts/testTriggerTypes.d.ts
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Identifier minted by the host (or in-memory test runner) for one execution of a test suite.
|
|
7
|
+
* One TestSuiteRun produces N child workflow runs, one per item yielded by `generateItems`.
|
|
8
|
+
*/
|
|
9
|
+
type TestSuiteRunId = string;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region ../core/src/contracts/baseTypes.d.ts
|
|
5
12
|
/**
|
|
6
13
|
* Minimal base types that have no dependencies on other contracts.
|
|
7
14
|
* Used by credentialTypes, workflowTypes, and other contract layers
|
|
@@ -14,6 +21,122 @@ type InputPortKey = string;
|
|
|
14
21
|
type PersistedTokenId = string;
|
|
15
22
|
type NodeConnectionName = string;
|
|
16
23
|
//#endregion
|
|
24
|
+
//#region ../core/src/events/runEvents.d.ts
|
|
25
|
+
/**
|
|
26
|
+
* Outcome of a single test case (one workflow run dispatched by the test-suite orchestrator).
|
|
27
|
+
* - `running`: workflow still in flight
|
|
28
|
+
* - `succeeded`: workflow completed AND all assertions passed (or no assertions)
|
|
29
|
+
* - `failed`: workflow failed OR (workflow completed but ≥1 assertion failed)
|
|
30
|
+
* - `errored` / `cancelled`: workflow itself errored or was cancelled
|
|
31
|
+
*/
|
|
32
|
+
type TestCaseRunStatus = "running" | "succeeded" | "failed" | "errored" | "cancelled";
|
|
33
|
+
/** Aggregate outcome of a TestSuiteRun. */
|
|
34
|
+
type TestSuiteRunStatus = "succeeded" | "failed" | "partial" | "errored" | "cancelled";
|
|
35
|
+
type RunEvent = Readonly<{
|
|
36
|
+
kind: "runCreated";
|
|
37
|
+
runId: RunId;
|
|
38
|
+
workflowId: WorkflowId;
|
|
39
|
+
parent?: ParentExecutionRef;
|
|
40
|
+
at: string;
|
|
41
|
+
}> | Readonly<{
|
|
42
|
+
kind: "runSaved";
|
|
43
|
+
runId: RunId;
|
|
44
|
+
workflowId: WorkflowId;
|
|
45
|
+
parent?: ParentExecutionRef;
|
|
46
|
+
at: string;
|
|
47
|
+
state: PersistedRunState;
|
|
48
|
+
}> | Readonly<{
|
|
49
|
+
kind: "nodeQueued";
|
|
50
|
+
runId: RunId;
|
|
51
|
+
workflowId: WorkflowId;
|
|
52
|
+
parent?: ParentExecutionRef;
|
|
53
|
+
at: string;
|
|
54
|
+
snapshot: NodeExecutionSnapshot;
|
|
55
|
+
}> | Readonly<{
|
|
56
|
+
kind: "nodeStarted";
|
|
57
|
+
runId: RunId;
|
|
58
|
+
workflowId: WorkflowId;
|
|
59
|
+
parent?: ParentExecutionRef;
|
|
60
|
+
at: string;
|
|
61
|
+
snapshot: NodeExecutionSnapshot;
|
|
62
|
+
}> | Readonly<{
|
|
63
|
+
kind: "nodeCompleted";
|
|
64
|
+
runId: RunId;
|
|
65
|
+
workflowId: WorkflowId;
|
|
66
|
+
parent?: ParentExecutionRef;
|
|
67
|
+
at: string;
|
|
68
|
+
snapshot: NodeExecutionSnapshot;
|
|
69
|
+
}> | Readonly<{
|
|
70
|
+
kind: "nodeFailed";
|
|
71
|
+
runId: RunId;
|
|
72
|
+
workflowId: WorkflowId;
|
|
73
|
+
parent?: ParentExecutionRef;
|
|
74
|
+
at: string;
|
|
75
|
+
snapshot: NodeExecutionSnapshot;
|
|
76
|
+
}> | Readonly<{
|
|
77
|
+
kind: "connectionInvocationStarted";
|
|
78
|
+
runId: RunId;
|
|
79
|
+
workflowId: WorkflowId;
|
|
80
|
+
parent?: ParentExecutionRef;
|
|
81
|
+
at: string;
|
|
82
|
+
record: ConnectionInvocationRecord;
|
|
83
|
+
}> | Readonly<{
|
|
84
|
+
kind: "connectionInvocationCompleted";
|
|
85
|
+
runId: RunId;
|
|
86
|
+
workflowId: WorkflowId;
|
|
87
|
+
parent?: ParentExecutionRef;
|
|
88
|
+
at: string;
|
|
89
|
+
record: ConnectionInvocationRecord;
|
|
90
|
+
}> | Readonly<{
|
|
91
|
+
kind: "connectionInvocationFailed";
|
|
92
|
+
runId: RunId;
|
|
93
|
+
workflowId: WorkflowId;
|
|
94
|
+
parent?: ParentExecutionRef;
|
|
95
|
+
at: string;
|
|
96
|
+
record: ConnectionInvocationRecord;
|
|
97
|
+
}> | Readonly<{
|
|
98
|
+
kind: "testSuiteStarted";
|
|
99
|
+
testSuiteRunId: TestSuiteRunId;
|
|
100
|
+
workflowId: WorkflowId;
|
|
101
|
+
triggerNodeId: string;
|
|
102
|
+
triggerNodeName?: string;
|
|
103
|
+
concurrency: number;
|
|
104
|
+
at: string;
|
|
105
|
+
}> | Readonly<{
|
|
106
|
+
kind: "testSuiteFinished";
|
|
107
|
+
testSuiteRunId: TestSuiteRunId;
|
|
108
|
+
workflowId: WorkflowId;
|
|
109
|
+
status: TestSuiteRunStatus;
|
|
110
|
+
totalCases: number;
|
|
111
|
+
passedCases: number;
|
|
112
|
+
failedCases: number;
|
|
113
|
+
at: string;
|
|
114
|
+
}> | Readonly<{
|
|
115
|
+
kind: "testCaseStarted";
|
|
116
|
+
testSuiteRunId: TestSuiteRunId;
|
|
117
|
+
testCaseIndex: number;
|
|
118
|
+
runId: RunId;
|
|
119
|
+
workflowId: WorkflowId;
|
|
120
|
+
testCaseLabel?: string;
|
|
121
|
+
at: string;
|
|
122
|
+
}> | Readonly<{
|
|
123
|
+
kind: "testCaseCompleted";
|
|
124
|
+
testSuiteRunId: TestSuiteRunId;
|
|
125
|
+
testCaseIndex: number;
|
|
126
|
+
runId: RunId;
|
|
127
|
+
workflowId: WorkflowId;
|
|
128
|
+
status: TestCaseRunStatus;
|
|
129
|
+
at: string;
|
|
130
|
+
}>;
|
|
131
|
+
interface RunEventSubscription {
|
|
132
|
+
close(): Promise<void>;
|
|
133
|
+
}
|
|
134
|
+
interface RunEventBus {
|
|
135
|
+
publish(event: RunEvent): Promise<void>;
|
|
136
|
+
subscribe(onEvent: (event: RunEvent) => void): Promise<RunEventSubscription>;
|
|
137
|
+
subscribeToWorkflow(workflowId: WorkflowId, onEvent: (event: RunEvent) => void): Promise<RunEventSubscription>;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
17
140
|
//#region ../core/src/contracts/runTypes.d.ts
|
|
18
141
|
/**
|
|
19
142
|
* Test-suite linkage for a run. When set, this run was started by a TestSuiteOrchestrator
|
|
@@ -111,7 +234,7 @@ interface RunQueueEntry {
|
|
|
111
234
|
received: Readonly<Record<InputPortKey, Items>>;
|
|
112
235
|
}>;
|
|
113
236
|
}
|
|
114
|
-
type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped";
|
|
237
|
+
type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped" | "hitl-approved" | "hitl-rejected" | "hitl-timeout" | "hitl-auto-accepted" | "hitl-cancelled";
|
|
115
238
|
interface NodeExecutionError {
|
|
116
239
|
message: string;
|
|
117
240
|
name?: string;
|
|
@@ -171,7 +294,9 @@ interface ConnectionInvocationRecord {
|
|
|
171
294
|
/** When set, this invocation was produced inside a sub-agent triggered by the named parent invocation. */
|
|
172
295
|
readonly parentInvocationId?: ConnectionInvocationId;
|
|
173
296
|
}
|
|
174
|
-
type RunStatus = "running" | "pending" | "completed" | "failed";
|
|
297
|
+
type RunStatus = "running" | "pending" | "completed" | "failed" | "suspended" | "halted";
|
|
298
|
+
/** Reason a run transitioned to {@link RunStatus} `"halted"`. */
|
|
299
|
+
type RunHaltReason = "hitl-rejected" | "hitl-timeout" | "hitl-cancelled";
|
|
175
300
|
interface PendingNodeExecution {
|
|
176
301
|
runId: RunId;
|
|
177
302
|
activationId: NodeActivationId;
|
|
@@ -184,6 +309,35 @@ interface PendingNodeExecution {
|
|
|
184
309
|
batchId?: string;
|
|
185
310
|
enqueuedAt: string;
|
|
186
311
|
}
|
|
312
|
+
/** One persisted suspension entry per suspended item. */
|
|
313
|
+
interface PersistedSuspensionEntry {
|
|
314
|
+
/** Opaque task identifier (UUID v4). */
|
|
315
|
+
readonly taskId: string;
|
|
316
|
+
readonly nodeId: NodeId;
|
|
317
|
+
readonly activationId: NodeActivationId;
|
|
318
|
+
readonly itemIndex: number;
|
|
319
|
+
/** SHA-256 hex digest of the decision schema JSON (for schema-drift detection). */
|
|
320
|
+
readonly decisionSchemaHash: string;
|
|
321
|
+
/** Serialized return value from `SuspensionRequest.deliver` (stored on the HumanTask row). */
|
|
322
|
+
readonly deliveryRef: JsonValue;
|
|
323
|
+
/** ISO timestamp when the task expires. */
|
|
324
|
+
readonly timeoutAt: string;
|
|
325
|
+
readonly onTimeout: "halt" | "auto-accept";
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* When a node is re-activated after suspension, the engine writes the resume context here
|
|
329
|
+
* so `NodeExecutionRequestHandlerService` can splice `resumeContext` into ctx.
|
|
330
|
+
* Cleared once the re-activation is consumed.
|
|
331
|
+
*/
|
|
332
|
+
interface PendingResumeEntry {
|
|
333
|
+
readonly activationId: NodeActivationId;
|
|
334
|
+
readonly nodeId: NodeId;
|
|
335
|
+
/**
|
|
336
|
+
* Typed as `unknown` here to avoid a circular import between runTypes ↔ runtimeTypes.
|
|
337
|
+
* `NodeExecutionRequestHandlerService` casts this to `ResumeContext` from runtimeTypes.
|
|
338
|
+
*/
|
|
339
|
+
readonly resumeContext: unknown;
|
|
340
|
+
}
|
|
187
341
|
interface PersistedRunState {
|
|
188
342
|
runId: RunId;
|
|
189
343
|
workflowId: WorkflowId;
|
|
@@ -202,12 +356,24 @@ interface PersistedRunState {
|
|
|
202
356
|
/** Successful node completions so far (for activation budget). */
|
|
203
357
|
engineCounters?: EngineRunCounters;
|
|
204
358
|
status: RunStatus;
|
|
359
|
+
/** Populated when `status === "halted"` to discriminate why the run was halted. */
|
|
360
|
+
reason?: RunHaltReason;
|
|
205
361
|
pending?: PendingNodeExecution;
|
|
206
362
|
queue: RunQueueEntry[];
|
|
207
363
|
outputsByNode: Record<NodeId, NodeOutputs>;
|
|
208
364
|
nodeSnapshotsByNodeId: Record<NodeId, NodeExecutionSnapshot>;
|
|
209
365
|
/** Append-only history of connection invocations (LLM/tool) nested under owning nodes. */
|
|
210
366
|
connectionInvocations?: ReadonlyArray<ConnectionInvocationRecord>;
|
|
367
|
+
/**
|
|
368
|
+
* One entry per outstanding HITL suspension (per-item).
|
|
369
|
+
* Present and non-empty iff `status === "suspended"`.
|
|
370
|
+
*/
|
|
371
|
+
suspension?: ReadonlyArray<PersistedSuspensionEntry>;
|
|
372
|
+
/**
|
|
373
|
+
* Written by `resumeRun()` so `NodeExecutionRequestHandlerService` can splice `resumeContext`
|
|
374
|
+
* into the ctx when re-executing the suspended node. Cleared once consumed.
|
|
375
|
+
*/
|
|
376
|
+
pendingResume?: PendingResumeEntry;
|
|
211
377
|
}
|
|
212
378
|
//#endregion
|
|
213
379
|
//#region ../core/src/contracts/workflowTypes.d.ts
|
|
@@ -304,129 +470,6 @@ interface PersistedRunPolicySnapshot {
|
|
|
304
470
|
readonly storagePolicy: WorkflowStoragePolicyMode;
|
|
305
471
|
}
|
|
306
472
|
//#endregion
|
|
307
|
-
//#region ../core/src/contracts/testTriggerTypes.d.ts
|
|
308
|
-
/**
|
|
309
|
-
* Identifier minted by the host (or in-memory test runner) for one execution of a test suite.
|
|
310
|
-
* One TestSuiteRun produces N child workflow runs, one per item yielded by `generateItems`.
|
|
311
|
-
*/
|
|
312
|
-
type TestSuiteRunId = string;
|
|
313
|
-
//#endregion
|
|
314
|
-
//#region ../core/src/events/runEvents.d.ts
|
|
315
|
-
/**
|
|
316
|
-
* Outcome of a single test case (one workflow run dispatched by the test-suite orchestrator).
|
|
317
|
-
* - `running`: workflow still in flight
|
|
318
|
-
* - `succeeded`: workflow completed AND all assertions passed (or no assertions)
|
|
319
|
-
* - `failed`: workflow failed OR (workflow completed but ≥1 assertion failed)
|
|
320
|
-
* - `errored` / `cancelled`: workflow itself errored or was cancelled
|
|
321
|
-
*/
|
|
322
|
-
type TestCaseRunStatus = "running" | "succeeded" | "failed" | "errored" | "cancelled";
|
|
323
|
-
/** Aggregate outcome of a TestSuiteRun. */
|
|
324
|
-
type TestSuiteRunStatus = "succeeded" | "failed" | "partial" | "errored" | "cancelled";
|
|
325
|
-
type RunEvent = Readonly<{
|
|
326
|
-
kind: "runCreated";
|
|
327
|
-
runId: RunId;
|
|
328
|
-
workflowId: WorkflowId;
|
|
329
|
-
parent?: ParentExecutionRef;
|
|
330
|
-
at: string;
|
|
331
|
-
}> | Readonly<{
|
|
332
|
-
kind: "runSaved";
|
|
333
|
-
runId: RunId;
|
|
334
|
-
workflowId: WorkflowId;
|
|
335
|
-
parent?: ParentExecutionRef;
|
|
336
|
-
at: string;
|
|
337
|
-
state: PersistedRunState;
|
|
338
|
-
}> | Readonly<{
|
|
339
|
-
kind: "nodeQueued";
|
|
340
|
-
runId: RunId;
|
|
341
|
-
workflowId: WorkflowId;
|
|
342
|
-
parent?: ParentExecutionRef;
|
|
343
|
-
at: string;
|
|
344
|
-
snapshot: NodeExecutionSnapshot;
|
|
345
|
-
}> | Readonly<{
|
|
346
|
-
kind: "nodeStarted";
|
|
347
|
-
runId: RunId;
|
|
348
|
-
workflowId: WorkflowId;
|
|
349
|
-
parent?: ParentExecutionRef;
|
|
350
|
-
at: string;
|
|
351
|
-
snapshot: NodeExecutionSnapshot;
|
|
352
|
-
}> | Readonly<{
|
|
353
|
-
kind: "nodeCompleted";
|
|
354
|
-
runId: RunId;
|
|
355
|
-
workflowId: WorkflowId;
|
|
356
|
-
parent?: ParentExecutionRef;
|
|
357
|
-
at: string;
|
|
358
|
-
snapshot: NodeExecutionSnapshot;
|
|
359
|
-
}> | Readonly<{
|
|
360
|
-
kind: "nodeFailed";
|
|
361
|
-
runId: RunId;
|
|
362
|
-
workflowId: WorkflowId;
|
|
363
|
-
parent?: ParentExecutionRef;
|
|
364
|
-
at: string;
|
|
365
|
-
snapshot: NodeExecutionSnapshot;
|
|
366
|
-
}> | Readonly<{
|
|
367
|
-
kind: "connectionInvocationStarted";
|
|
368
|
-
runId: RunId;
|
|
369
|
-
workflowId: WorkflowId;
|
|
370
|
-
parent?: ParentExecutionRef;
|
|
371
|
-
at: string;
|
|
372
|
-
record: ConnectionInvocationRecord;
|
|
373
|
-
}> | Readonly<{
|
|
374
|
-
kind: "connectionInvocationCompleted";
|
|
375
|
-
runId: RunId;
|
|
376
|
-
workflowId: WorkflowId;
|
|
377
|
-
parent?: ParentExecutionRef;
|
|
378
|
-
at: string;
|
|
379
|
-
record: ConnectionInvocationRecord;
|
|
380
|
-
}> | Readonly<{
|
|
381
|
-
kind: "connectionInvocationFailed";
|
|
382
|
-
runId: RunId;
|
|
383
|
-
workflowId: WorkflowId;
|
|
384
|
-
parent?: ParentExecutionRef;
|
|
385
|
-
at: string;
|
|
386
|
-
record: ConnectionInvocationRecord;
|
|
387
|
-
}> | Readonly<{
|
|
388
|
-
kind: "testSuiteStarted";
|
|
389
|
-
testSuiteRunId: TestSuiteRunId;
|
|
390
|
-
workflowId: WorkflowId;
|
|
391
|
-
triggerNodeId: string;
|
|
392
|
-
triggerNodeName?: string;
|
|
393
|
-
concurrency: number;
|
|
394
|
-
at: string;
|
|
395
|
-
}> | Readonly<{
|
|
396
|
-
kind: "testSuiteFinished";
|
|
397
|
-
testSuiteRunId: TestSuiteRunId;
|
|
398
|
-
workflowId: WorkflowId;
|
|
399
|
-
status: TestSuiteRunStatus;
|
|
400
|
-
totalCases: number;
|
|
401
|
-
passedCases: number;
|
|
402
|
-
failedCases: number;
|
|
403
|
-
at: string;
|
|
404
|
-
}> | Readonly<{
|
|
405
|
-
kind: "testCaseStarted";
|
|
406
|
-
testSuiteRunId: TestSuiteRunId;
|
|
407
|
-
testCaseIndex: number;
|
|
408
|
-
runId: RunId;
|
|
409
|
-
workflowId: WorkflowId;
|
|
410
|
-
testCaseLabel?: string;
|
|
411
|
-
at: string;
|
|
412
|
-
}> | Readonly<{
|
|
413
|
-
kind: "testCaseCompleted";
|
|
414
|
-
testSuiteRunId: TestSuiteRunId;
|
|
415
|
-
testCaseIndex: number;
|
|
416
|
-
runId: RunId;
|
|
417
|
-
workflowId: WorkflowId;
|
|
418
|
-
status: TestCaseRunStatus;
|
|
419
|
-
at: string;
|
|
420
|
-
}>;
|
|
421
|
-
interface RunEventSubscription {
|
|
422
|
-
close(): Promise<void>;
|
|
423
|
-
}
|
|
424
|
-
interface RunEventBus {
|
|
425
|
-
publish(event: RunEvent): Promise<void>;
|
|
426
|
-
subscribe(onEvent: (event: RunEvent) => void): Promise<RunEventSubscription>;
|
|
427
|
-
subscribeToWorkflow(workflowId: WorkflowId, onEvent: (event: RunEvent) => void): Promise<RunEventSubscription>;
|
|
428
|
-
}
|
|
429
|
-
//#endregion
|
|
430
473
|
//#region src/RedisRunEventBusRegistry.d.ts
|
|
431
474
|
declare class RedisRunEventBus implements RunEventBus {
|
|
432
475
|
private readonly redisUrl;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemation/eventbus-redis",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"ioredis": "^5.7.0",
|
|
32
|
-
"@codemation/core": "0.
|
|
32
|
+
"@codemation/core": "0.12.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^25.3.5",
|