@tomflow/proflow-task-orchestration 0.1.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.
@@ -0,0 +1,4 @@
1
+ import type { NodeStatus, TaskGroupStatus, TaskStatus } from "./model.ts";
2
+ export declare const assertTaskTransition: (from: TaskStatus, to: TaskStatus) => void;
3
+ export declare const assertTaskGroupTransition: (from: TaskGroupStatus, to: TaskGroupStatus) => void;
4
+ export declare const assertNodeTransition: (from: NodeStatus, to: NodeStatus) => void;
@@ -0,0 +1,27 @@
1
+ function assertTransition(from, to, allowed) {
2
+ if (!allowed[from].includes(to))
3
+ throw new Error(`illegal transition ${from} -> ${to}`);
4
+ }
5
+ const taskTransitions = {
6
+ PENDING: ["READY", "TERMINATED"],
7
+ READY: ["ACTIVE", "TERMINATED"],
8
+ ACTIVE: ["WAITING", "PAUSED", "FAILED", "SUCCEEDED", "TERMINATED"],
9
+ WAITING: ["ACTIVE", "PAUSED", "TERMINATED"],
10
+ FAILED: ["PAUSED", "TERMINATED"],
11
+ PAUSED: ["ACTIVE", "TERMINATED"],
12
+ SUCCEEDED: [],
13
+ TERMINATED: [],
14
+ };
15
+ const groupTransitions = { READY: ["ACTIVE"], ACTIVE: ["SUCCEEDED"], SUCCEEDED: [] };
16
+ const nodeTransitions = {
17
+ PENDING: ["READY", "TERMINATED"],
18
+ READY: ["IN_PROGRESS", "TERMINATED"],
19
+ IN_PROGRESS: ["WAITING", "FAILED", "SUCCEEDED", "TERMINATED"],
20
+ WAITING: ["IN_PROGRESS", "TERMINATED"],
21
+ FAILED: ["READY", "TERMINATED"],
22
+ SUCCEEDED: [],
23
+ TERMINATED: [],
24
+ };
25
+ export const assertTaskTransition = (from, to) => assertTransition(from, to, taskTransitions);
26
+ export const assertTaskGroupTransition = (from, to) => assertTransition(from, to, groupTransitions);
27
+ export const assertNodeTransition = (from, to) => assertTransition(from, to, nodeTransitions);
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@tomflow/proflow-task-orchestration",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "exports": {
9
+ ".": "./dist/src/index.js",
10
+ "./deployment/adapter": "./dist/deployment/adapter.js",
11
+ "./deployment/descriptor": "./dist/deployment/descriptor.js"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "proflow.module.json",
16
+ "conformance.json",
17
+ "README.md",
18
+ "self-install.mjs"
19
+ ],
20
+ "dependencies": {
21
+ "zod": "4.1.12",
22
+ "@tomflow/proflow-module-contract": "^0.1.0"
23
+ },
24
+ "devDependencies": {
25
+ "@tomflow/proflow-deployment-conformance": "^0.1.0",
26
+ "@tomflow/proflow-task-migration-runner": "^0.1.0",
27
+ "@tomflow/proflow-task-store-sqlite": "^0.1.0"
28
+ },
29
+ "description": "Owns the Task & Orchestration public contract, domain rules and application services.",
30
+ "keywords": [
31
+ "proflow",
32
+ "proflow-module",
33
+ "task-orchestration"
34
+ ],
35
+ "proflow": {
36
+ "module": true,
37
+ "installClass": "core",
38
+ "installRequires": [
39
+ "@tomflow/proflow-module-contract"
40
+ ],
41
+ "descriptor": "./dist/deployment/descriptor.js",
42
+ "manifest": "./proflow.module.json"
43
+ },
44
+ "bin": {
45
+ "proflow-task-orchestration": "./self-install.mjs"
46
+ },
47
+ "scripts": {
48
+ "test": "node --test tests/**/*.test.ts",
49
+ "typecheck": "tsc --noEmit"
50
+ }
51
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "contract": "module",
3
+ "contractVersion": "1.0.0",
4
+ "moduleRef": "task-orchestration",
5
+ "packageName": "@tomflow/proflow-task-orchestration",
6
+ "moduleVersion": "0.1.0",
7
+ "kind": "library",
8
+ "templateVersion": "1.0.0",
9
+ "platformCompatibility": ">=1.0.0 <2.0.0",
10
+ "installClass": "core",
11
+ "identity": {
12
+ "domain": "task-orchestration",
13
+ "summary": "Owns the Task & Orchestration public contract, domain rules and application services."
14
+ },
15
+ "provides": [
16
+ {
17
+ "contractRef": "task-orchestration",
18
+ "version": "1.0.0"
19
+ }
20
+ ],
21
+ "requires": [],
22
+ "requirements": [
23
+ {
24
+ "kind": "runtime",
25
+ "runtime": "node",
26
+ "versionRange": ">=24.19.0"
27
+ }
28
+ ],
29
+ "configSlots": [],
30
+ "lifecycle": {
31
+ "supported": ["describe", "preflight", "verify", "doctor"]
32
+ },
33
+ "verification": {
34
+ "checks": [
35
+ {
36
+ "id": "task-domain-tests-pass",
37
+ "description": "Task orchestration Critical Proofs pass",
38
+ "lifecycle": "verify"
39
+ }
40
+ ]
41
+ },
42
+ "effects": [
43
+ {
44
+ "kind": "filesystem",
45
+ "description": "Owns TaskDocument Markdown writes inside the configured workspace",
46
+ "retention": "preserve"
47
+ }
48
+ ],
49
+ "documentation": [
50
+ {
51
+ "id": "overview",
52
+ "path": "./README.md",
53
+ "description": "Package-owned module overview"
54
+ }
55
+ ]
56
+ }
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from "node:child_process";
3
+
4
+ const [command, ...rest] = process.argv.slice(2);
5
+ const usage = "Usage: npx @tomflow/proflow-task-orchestration install\n";
6
+ if (command === "--help" || command === "-h") {
7
+ process.stdout.write(usage);
8
+ process.exit(0);
9
+ }
10
+ if (command !== "install" || rest.length > 0) {
11
+ process.stderr.write(usage);
12
+ process.exit(2);
13
+ }
14
+ const executable = process.platform === "win32" ? "npx.cmd" : "npx";
15
+ const result = spawnSync(
16
+ executable,
17
+ [
18
+ "--yes",
19
+ "@tomflow/proflow-platform-cli",
20
+ "install",
21
+ "@tomflow/proflow-task-orchestration",
22
+ ],
23
+ { cwd: process.cwd(), env: process.env, stdio: "inherit" },
24
+ );
25
+ if (result.error) throw result.error;
26
+ process.exit(result.status ?? 1);