@lucid-softworks/workflow-events 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lucid Softworks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # `@lucid-softworks/workflow-events`
2
+
3
+ Typed workflow/task lifecycle events with synchronous subscriptions and an
4
+ immutable history view for telemetry, progress UIs, and tests.
@@ -0,0 +1,34 @@
1
+ export type WorkflowEvent = {
2
+ readonly type: "workflow-started" | "workflow-succeeded";
3
+ readonly executionId: string;
4
+ readonly workflowId: string;
5
+ readonly timestamp: number;
6
+ } | {
7
+ readonly type: "workflow-failed" | "workflow-cancelled";
8
+ readonly executionId: string;
9
+ readonly workflowId: string;
10
+ readonly timestamp: number;
11
+ readonly error?: unknown;
12
+ } | {
13
+ readonly type: "task-started" | "task-succeeded";
14
+ readonly executionId: string;
15
+ readonly taskId: string;
16
+ readonly timestamp: number;
17
+ readonly output?: unknown;
18
+ } | {
19
+ readonly type: "task-failed" | "task-cancelled" | "task-skipped";
20
+ readonly executionId: string;
21
+ readonly taskId: string;
22
+ readonly timestamp: number;
23
+ readonly error?: unknown;
24
+ };
25
+ export type WorkflowEventListener = (event: WorkflowEvent) => void;
26
+ /** Records events and synchronously notifies current subscribers. */
27
+ export declare class WorkflowEventBus {
28
+ #private;
29
+ get history(): readonly WorkflowEvent[];
30
+ subscribe(listener: WorkflowEventListener): () => void;
31
+ emit(event: WorkflowEvent): void;
32
+ clear(): void;
33
+ }
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB;IACE,QAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG,oBAAoB,CAAC;IACzD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,gBAAgB,CAAC;IACjD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,gBAAgB,GAAG,cAAc,CAAC;IACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEN,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAEnE,qEAAqE;AACrE,qBAAa,gBAAgB;;IAI3B,IAAI,OAAO,IAAI,SAAS,aAAa,EAAE,CAEtC;IAED,SAAS,CAAC,QAAQ,EAAE,qBAAqB,GAAG,MAAM,IAAI,CAKrD;IAED,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAG/B;IAED,KAAK,IAAI,IAAI,CAEZ;CACF"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ /** Records events and synchronously notifies current subscribers. */
2
+ export class WorkflowEventBus {
3
+ #events = [];
4
+ #listeners = new Set();
5
+ get history() {
6
+ return [...this.#events];
7
+ }
8
+ subscribe(listener) {
9
+ this.#listeners.add(listener);
10
+ return () => {
11
+ this.#listeners.delete(listener);
12
+ };
13
+ }
14
+ emit(event) {
15
+ this.#events.push(event);
16
+ for (const listener of this.#listeners)
17
+ listener(event);
18
+ }
19
+ clear() {
20
+ this.#events.length = 0;
21
+ }
22
+ }
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+BA,qEAAqE;AACrE,MAAM,OAAO,gBAAgB;IAClB,OAAO,GAAoB,EAAE,CAAC;IAC9B,UAAU,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEvD,IAAI,OAAO;QACT,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,SAAS,CAAC,QAA+B;QACvC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO,GAAS,EAAE;YAChB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAoB;QACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU;YAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1B,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@lucid-softworks/workflow-events",
3
+ "version": "0.0.0",
4
+ "description": "Typed workflow lifecycle events, history, and subscriptions.",
5
+ "keywords": [
6
+ "events",
7
+ "javascript",
8
+ "typescript",
9
+ "utility",
10
+ "workflow"
11
+ ],
12
+ "homepage": "https://github.com/lucid-softworks/workflow-events#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/lucid-softworks/workflow-events/issues"
15
+ },
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/lucid-softworks/workflow-events.git"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "type": "module",
25
+ "sideEffects": false,
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js"
30
+ }
31
+ },
32
+ "publishConfig": {
33
+ "access": "public",
34
+ "provenance": true
35
+ },
36
+ "scripts": {
37
+ "bench": "vitest bench --run",
38
+ "bench:smoke": "VITEST_BENCHMARK_SMOKE=1 vitest bench --run",
39
+ "build": "tsc -p tsconfig.build.json",
40
+ "check": "oxfmt --check . && oxlint . && tsc -p tsconfig.json && tsc -p tsconfig.build.json && vitest run --coverage && publint && VITEST_BENCHMARK_SMOKE=1 vitest bench --run",
41
+ "format": "oxfmt --write .",
42
+ "format:check": "oxfmt --check .",
43
+ "lint": "oxlint .",
44
+ "pack:check": "publint",
45
+ "test": "vitest run --coverage",
46
+ "typecheck": "tsc -p tsconfig.json"
47
+ },
48
+ "devDependencies": {
49
+ "@lucid-softworks/oxfmt-config": "^0.1.1",
50
+ "@lucid-softworks/oxlint-config": "^0.1.0",
51
+ "@lucid-softworks/tsconfig": "^0.1.0",
52
+ "@lucid-softworks/vitest-config": "^0.1.1",
53
+ "@types/node": "26.1.1",
54
+ "@vitest/coverage-v8": "4.1.10",
55
+ "oxfmt": "0.60.0",
56
+ "oxlint": "1.75.0",
57
+ "publint": "0.3.22",
58
+ "typescript": "7.0.2",
59
+ "vitest": "4.1.10"
60
+ },
61
+ "engines": {
62
+ "node": ">=22"
63
+ },
64
+ "packageManager": "pnpm@11.16.0"
65
+ }