@sixb/cli 0.1.18 → 0.1.19
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 +0 -1
- package/dist/commands/dev-runner.d.ts.map +1 -1
- package/dist/lib/command-line.d.ts.map +1 -1
- package/dist/lib/deploy-release.d.ts.map +1 -1
- package/dist/lib/runtime.d.ts +10 -14
- package/dist/lib/runtime.d.ts.map +1 -1
- package/dist/lib/worker-concurrency.d.ts.map +1 -1
- package/dist/lib/worker-registry.d.ts +2 -31
- package/dist/lib/worker-registry.d.ts.map +1 -1
- package/package.json +13 -14
- package/src/commands/dev-runner.tsx +0 -1
- package/src/lib/command-line.ts +7 -11
- package/src/lib/deploy-release.ts +21 -4
- package/src/lib/runtime.ts +16 -23
- package/src/lib/worker-concurrency.ts +15 -38
- package/src/lib/worker-registry.ts +11 -35
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-runner.d.ts","sourceRoot":"","sources":["../../src/commands/dev-runner.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC;AAED,wBAAsB,aAAa,CAAC,OAAO,GAAE,UAAe,
|
|
1
|
+
{"version":3,"file":"dev-runner.d.ts","sourceRoot":"","sources":["../../src/commands/dev-runner.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,UAAU;IAC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ACd,QAAQ,GACR,eAAe,GACf,aAAa,GACb,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,cAAc,GACd,cAAc,GACd,WAAW,GACX,oBAAoB,GACpB,mBAAmB,GACnB,sBAAsB,GACtB,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"command-line.d.ts","sourceRoot":"","sources":["../../src/lib/command-line.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsIuD,CAAA;AAE1F,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,sBAAsB,CAAA;AAC/D,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,KAAK,GACL,OAAO,GACP,KAAK,GACL,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,cAAc,GACd,cAAc,GACd,aAAa,GACb,YAAY,GACZ,cAAc,GACd,cAAc,GACd,sBAAsB,GACtB,wBAAwB,GACxB,yBAAyB,GACzB,4BAA4B,GAC5B,8BAA8B,GAC9B,8BAA8B,GAC9B,WAAW,GACX,cAAc,GACd,OAAO,GACP,QAAQ,GACR,cAAc,GACd,OAAO,GACP,SAAS,GACT,OAAO,GACP,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,QAAQ,GACR,eAAe,GACf,aAAa,GACb,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,cAAc,GACd,cAAc,GACd,WAAW,GACX,oBAAoB,GACpB,mBAAmB,GACnB,sBAAsB,GACtB,MAAM,CAAA;AAkWV,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WA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I,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAkB/D;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAG/F;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAErF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,GAAG,SAAS,MAAM,EAAE,CAGhG;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAMpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-release.d.ts","sourceRoot":"","sources":["../../src/lib/deploy-release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EAIZ,aAAa,EAOd,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"deploy-release.d.ts","sourceRoot":"","sources":["../../src/lib/deploy-release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EAIZ,aAAa,EAOd,MAAM,mBAAmB,CAAA;AAgE1B,MAAM,WAAW,oBAAoB;IACnC,yFAAyF;IACzF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,oBAAoB,GAC5B,aAAa,CAgCf"}
|
package/dist/lib/runtime.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ActionWorker } from "@sixb/action-worker";
|
|
2
1
|
import { AgentWorker } from "@sixb/agent-worker";
|
|
3
2
|
import type { Worker } from "@sixb/core/internal/workers";
|
|
4
3
|
import { OrchestratorWorker } from "@sixb/orchestrator";
|
|
@@ -13,7 +12,6 @@ export declare function waitForWorkerFailure(worker: Worker | null | undefined):
|
|
|
13
12
|
export interface RunningSixbRuntime {
|
|
14
13
|
readonly rulesWorker: RulesWorker | null;
|
|
15
14
|
readonly syncWorker: SyncWorker | null;
|
|
16
|
-
readonly actionWorker: ActionWorker | null;
|
|
17
15
|
readonly agentWorker: AgentWorker | null;
|
|
18
16
|
readonly projectionWorker: ProjectionWorker | null;
|
|
19
17
|
readonly pipelineWorker: PipelineWorker | null;
|
|
@@ -67,15 +65,14 @@ export declare function startOrchestratorRuntime(sixb: LoadedSixbHost): Promise<
|
|
|
67
65
|
*
|
|
68
66
|
* Startup order (consumers before producers):
|
|
69
67
|
* 1. RulesWorker (subscribes to ontology events)
|
|
70
|
-
* 2.
|
|
71
|
-
* 3.
|
|
72
|
-
* 4.
|
|
73
|
-
* 5.
|
|
74
|
-
* 6.
|
|
75
|
-
* 7.
|
|
76
|
-
* 8.
|
|
77
|
-
* 9.
|
|
78
|
-
* 10. AgentWorker (claims from queues; its turns call the API)
|
|
68
|
+
* 2. ProjectionWorker (claims from queues)
|
|
69
|
+
* 3. PipelineWorker (claims from queues)
|
|
70
|
+
* 4. WorkflowWorker (claims from queues)
|
|
71
|
+
* 5. SyncWorker (claims from queues)
|
|
72
|
+
* 6. Orchestrator (subscribes to events and enqueues jobs)
|
|
73
|
+
* 7. Scheduler (emits schedule.triggered)
|
|
74
|
+
* 8. API server, when this process serves it
|
|
75
|
+
* 9. AgentWorker (claims from queues; its turns call the API)
|
|
79
76
|
*
|
|
80
77
|
* Shutdown order (producers before consumers):
|
|
81
78
|
* 1. AgentWorker (ends its turns while the API still answers them)
|
|
@@ -86,9 +83,8 @@ export declare function startOrchestratorRuntime(sixb: LoadedSixbHost): Promise<
|
|
|
86
83
|
* 6. WorkflowWorker
|
|
87
84
|
* 7. PipelineWorker
|
|
88
85
|
* 8. ProjectionWorker
|
|
89
|
-
* 9.
|
|
90
|
-
* 10.
|
|
91
|
-
* 11. Runtime providers (connectors, broker)
|
|
86
|
+
* 9. RulesWorker (drains pending evaluations)
|
|
87
|
+
* 10. Runtime providers (connectors, broker)
|
|
92
88
|
*/
|
|
93
89
|
export declare function startSixbRuntime(sixb: LoadedSixbHost, options?: StartSixbRuntimeOptions): Promise<RunningSixbRuntime>;
|
|
94
90
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/lib/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/lib/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAWhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAGzD,OAAO,EAGL,kBAAkB,EACnB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAG1D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,CAItF;AAMD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IACxC,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IACxC,QAAQ,CAAC,gBAAgB,EAAE,gBAA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B,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAG3F;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/E;AAED,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAKrF;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB3E;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAc1F;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,uBAAuB,CAAC,CAQlC;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,0BAA0B,CAAC,CA4CrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,kBAAkB,CAAC,CAgH7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-concurrency.d.ts","sourceRoot":"","sources":["../../src/lib/worker-concurrency.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"worker-concurrency.d.ts","sourceRoot":"","sources":["../../src/lib/worker-concurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAWzF,uEAAuE;AACvE,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,iBAAiB,CAMnB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,GAAE,SAAS,MAAM,EAAO,GAAG,iBAAiB,CAoB1F"}
|
|
@@ -1,37 +1,8 @@
|
|
|
1
1
|
import type { Worker } from "@sixb/core/internal/workers";
|
|
2
2
|
import type { LoadedSixbHost } from "./loadSixb";
|
|
3
|
-
export declare const WORKER_TYPES: readonly ["sync", "
|
|
3
|
+
export declare const WORKER_TYPES: readonly ["sync", "agent", "pipeline", "projection", "workflow"];
|
|
4
4
|
export type WorkerType = (typeof WORKER_TYPES)[number];
|
|
5
|
-
export
|
|
6
|
-
readonly sync: {
|
|
7
|
-
readonly configurable: true;
|
|
8
|
-
readonly environmentVariable: "SIXB_SYNC_WORKER_CONCURRENCY";
|
|
9
|
-
};
|
|
10
|
-
readonly action: {
|
|
11
|
-
readonly configurable: false;
|
|
12
|
-
readonly environmentVariable: "SIXB_ACTION_WORKER_CONCURRENCY";
|
|
13
|
-
};
|
|
14
|
-
readonly agent: {
|
|
15
|
-
readonly configurable: true;
|
|
16
|
-
readonly environmentVariable: "SIXB_AGENT_WORKER_CONCURRENCY";
|
|
17
|
-
};
|
|
18
|
-
readonly pipeline: {
|
|
19
|
-
readonly configurable: true;
|
|
20
|
-
readonly environmentVariable: "SIXB_PIPELINE_WORKER_CONCURRENCY";
|
|
21
|
-
};
|
|
22
|
-
readonly projection: {
|
|
23
|
-
readonly configurable: true;
|
|
24
|
-
readonly environmentVariable: "SIXB_PROJECTION_WORKER_CONCURRENCY";
|
|
25
|
-
};
|
|
26
|
-
readonly workflow: {
|
|
27
|
-
readonly configurable: true;
|
|
28
|
-
readonly environmentVariable: "SIXB_WORKFLOW_WORKER_CONCURRENCY";
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export type ConfigurableWorkerType = {
|
|
32
|
-
[Type in WorkerType]: (typeof WORKER_CONCURRENCY_CONFIG)[Type]["configurable"] extends true ? Type : never;
|
|
33
|
-
}[WorkerType];
|
|
34
|
-
export type WorkerConcurrency = Readonly<Partial<Record<ConfigurableWorkerType, number>>>;
|
|
5
|
+
export type WorkerConcurrency = Readonly<Partial<Record<WorkerType, number>>>;
|
|
35
6
|
export type QueueWorkerProcess = Worker & {
|
|
36
7
|
readonly concurrency: number;
|
|
37
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-registry.d.ts","sourceRoot":"","sources":["../../src/lib/worker-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"worker-registry.d.ts","sourceRoot":"","sources":["../../src/lib/worker-registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAMzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGhD,eAAO,MAAM,YAAY,kEAAmE,CAAA;AAE5F,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;AAC7E,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;CAC/C;AAmDD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,cAAc,EACpB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,qBAA0B,GAClC,kBAAkB,CAOpB;AAED,wBAAgB,wBAAwB,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,UAAU,CAa7E;AAUD;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,qBAAqB,EAC9B,gBAAgB,EAAE,OAAO,GACxB,MAAM,GAAG,IAAI,CAIf;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAA;IACvC;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CA6BjE;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,UAAU,EAAE,CAwBxF;AAsBD,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAIjE;AAED,4FAA4F;AAC5F,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,cAAc,CAAC,aAAa,CAAC,GAAG,OAAO,CAOxF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixb/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "Command-line interface for Sixb projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -29,20 +29,19 @@
|
|
|
29
29
|
"prepack": "bun run build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@sixb/
|
|
33
|
-
"@sixb/agent-worker": "0.1.18",
|
|
32
|
+
"@sixb/agent-worker": "0.1.19",
|
|
34
33
|
"@sixb/app": "^0.1.11",
|
|
35
|
-
"@sixb/atlas": "^0.1.
|
|
36
|
-
"@sixb/client": "^0.1.
|
|
37
|
-
"@sixb/core": "0.1.
|
|
38
|
-
"@sixb/cli-core": "^0.1.
|
|
39
|
-
"@sixb/orchestrator": "0.1.
|
|
40
|
-
"@sixb/pipeline-worker": "0.1.
|
|
41
|
-
"@sixb/projection-worker": "0.1.
|
|
42
|
-
"@sixb/rules-worker": "0.1.
|
|
43
|
-
"@sixb/server": "0.1.
|
|
44
|
-
"@sixb/sync-worker": "0.1.
|
|
45
|
-
"@sixb/workflow-worker": "0.1.
|
|
34
|
+
"@sixb/atlas": "^0.1.16",
|
|
35
|
+
"@sixb/client": "^0.1.19",
|
|
36
|
+
"@sixb/core": "0.1.19",
|
|
37
|
+
"@sixb/cli-core": "^0.1.8",
|
|
38
|
+
"@sixb/orchestrator": "0.1.19",
|
|
39
|
+
"@sixb/pipeline-worker": "0.1.19",
|
|
40
|
+
"@sixb/projection-worker": "0.1.19",
|
|
41
|
+
"@sixb/rules-worker": "0.1.19",
|
|
42
|
+
"@sixb/server": "0.1.19",
|
|
43
|
+
"@sixb/sync-worker": "0.1.19",
|
|
44
|
+
"@sixb/workflow-worker": "0.1.19",
|
|
46
45
|
"create-sixb": "^0.1.4",
|
|
47
46
|
"ink": "^6.0.0",
|
|
48
47
|
"react": "^19.0.0",
|
|
@@ -148,7 +148,6 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
148
148
|
uiUrl={topology.atlasPublicOrigin}
|
|
149
149
|
appUrl={appUrl}
|
|
150
150
|
workers={[
|
|
151
|
-
{ type: "action", worker: runtime.actionWorker },
|
|
152
151
|
{ type: "agent", worker: runtime.agentWorker },
|
|
153
152
|
{ type: "projection", worker: runtime.projectionWorker },
|
|
154
153
|
{ type: "pipeline", worker: runtime.pipelineWorker },
|
package/src/lib/command-line.ts
CHANGED
|
@@ -414,17 +414,13 @@ const commandTree: readonly CommandNode[] = [
|
|
|
414
414
|
options: ["entry", "no-migrate"],
|
|
415
415
|
}),
|
|
416
416
|
command("rules", "Start production rules runtime", { options: ["entry", "no-migrate"] }),
|
|
417
|
-
command(
|
|
418
|
-
"worker",
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
maximumPositionals: 1,
|
|
425
|
-
rootHelpLabel: "worker <type>",
|
|
426
|
-
}
|
|
427
|
-
),
|
|
417
|
+
command("worker", "Start production queue worker: sync, agent, pipeline, projection, workflow", {
|
|
418
|
+
usage: "sixb worker <sync|agent|pipeline|projection|workflow> [options]",
|
|
419
|
+
options: ["entry", "no-migrate", "api-public-origin", "agent-turn-timeout", "concurrency"],
|
|
420
|
+
minimumPositionals: 1,
|
|
421
|
+
maximumPositionals: 1,
|
|
422
|
+
rootHelpLabel: "worker <type>",
|
|
423
|
+
}),
|
|
428
424
|
command("worker-group", "Co-host multiple queue workers in one process (constrained resources)", {
|
|
429
425
|
usage: "sixb worker-group [types...] [options]",
|
|
430
426
|
options: ["entry", "no-migrate", "api-public-origin", "agent-turn-timeout", "concurrency"],
|
|
@@ -65,6 +65,16 @@ const API_READINESS_PATH = "/ready"
|
|
|
65
65
|
const DEFAULT_KILL_TIMEOUT_MS = 10_000
|
|
66
66
|
const DEFAULT_RESTART_DELAY_MS = 1_000
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* The API and the workers run Actions in process: the API for the requests it serves, the workers
|
|
70
|
+
* for workflow action nodes. Stopping, each first waits up to 65 s for the Actions it is running
|
|
71
|
+
* and their effects (`ACTION_RUN_DRAIN_TIMEOUT_MS` in core), so a graceful restart must not kill it
|
|
72
|
+
* before. A literal keeps the runtime out of the deploy command; `deploy.test.ts` holds the two
|
|
73
|
+
* together.
|
|
74
|
+
*/
|
|
75
|
+
const ACTION_HOST_KILL_TIMEOUT_MS = 70_000
|
|
76
|
+
const ACTION_HOST_SERVICES: ReadonlySet<DeployServiceName> = new Set(["api", "workers"])
|
|
77
|
+
|
|
68
78
|
export interface DeployReleaseOptions {
|
|
69
79
|
/** The Bun version the project runs on, from its `packageManager` or the running Bun. */
|
|
70
80
|
readonly bunVersion: string
|
|
@@ -135,7 +145,11 @@ function sixbService(
|
|
|
135
145
|
env: { ...env, ...options.env },
|
|
136
146
|
instances: processOptions.instances ?? 1,
|
|
137
147
|
...(address ? { http: address } : {}),
|
|
138
|
-
process: releaseProcess(processOptions
|
|
148
|
+
process: releaseProcess(processOptions, {
|
|
149
|
+
killTimeoutMs: ACTION_HOST_SERVICES.has(service)
|
|
150
|
+
? ACTION_HOST_KILL_TIMEOUT_MS
|
|
151
|
+
: DEFAULT_KILL_TIMEOUT_MS,
|
|
152
|
+
}),
|
|
139
153
|
}
|
|
140
154
|
}
|
|
141
155
|
|
|
@@ -171,7 +185,7 @@ function projectProcess(
|
|
|
171
185
|
command: { program: "bun", args: [definition.entrypoint, ...(definition.args ?? [])] },
|
|
172
186
|
env: { ...env, ...definition.env },
|
|
173
187
|
instances: processOptions.instances ?? 1,
|
|
174
|
-
process: releaseProcess(processOptions),
|
|
188
|
+
process: releaseProcess(processOptions, { killTimeoutMs: DEFAULT_KILL_TIMEOUT_MS }),
|
|
175
189
|
}
|
|
176
190
|
}
|
|
177
191
|
|
|
@@ -237,9 +251,12 @@ function defaultDomain(config: DeployConfig, service: DeployHttpServiceName): st
|
|
|
237
251
|
return `${label}.${config.domain}`
|
|
238
252
|
}
|
|
239
253
|
|
|
240
|
-
function releaseProcess(
|
|
254
|
+
function releaseProcess(
|
|
255
|
+
options: DeployScalableProcessOptions,
|
|
256
|
+
defaults: { readonly killTimeoutMs: number }
|
|
257
|
+
): DeployReleaseProcess {
|
|
241
258
|
return {
|
|
242
|
-
killTimeoutMs: options.killTimeoutMs ??
|
|
259
|
+
killTimeoutMs: options.killTimeoutMs ?? defaults.killTimeoutMs,
|
|
243
260
|
restartDelayMs: options.restartDelayMs ?? DEFAULT_RESTART_DELAY_MS,
|
|
244
261
|
...(options.maxMemory === undefined ? {} : { maxMemory: options.maxMemory.trim() }),
|
|
245
262
|
}
|
package/src/lib/runtime.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ActionWorker } from "@sixb/action-worker"
|
|
2
1
|
import { AgentWorker } from "@sixb/agent-worker"
|
|
3
2
|
import { migrateStorage } from "@sixb/core"
|
|
3
|
+
import { ACTION_RUN_DRAIN_TIMEOUT_MS, drainActionRuns } from "@sixb/core/internal/actions"
|
|
4
4
|
import { flushSixbErrors } from "@sixb/core/internal/error-reporting"
|
|
5
5
|
import { PipelineRunDispatcher } from "@sixb/core/internal/pipelines"
|
|
6
6
|
import {
|
|
@@ -41,7 +41,6 @@ async function closeProvider(provider: { close?(): void | Promise<void> }): Prom
|
|
|
41
41
|
export interface RunningSixbRuntime {
|
|
42
42
|
readonly rulesWorker: RulesWorker | null
|
|
43
43
|
readonly syncWorker: SyncWorker | null
|
|
44
|
-
readonly actionWorker: ActionWorker | null
|
|
45
44
|
readonly agentWorker: AgentWorker | null
|
|
46
45
|
readonly projectionWorker: ProjectionWorker | null
|
|
47
46
|
readonly pipelineWorker: PipelineWorker | null
|
|
@@ -109,6 +108,11 @@ export async function checkRuntimeLakeDefinitions(sixb: LoadedSixbHost): Promise
|
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
export async function stopSixbProviders(sixb: LoadedSixbHost): Promise<void> {
|
|
111
|
+
// Actions run inside the request that asked for them, and a client that disconnects does not stop
|
|
112
|
+
// them: refuse new ones and give those in flight, and the effects they start, time to finish
|
|
113
|
+
// before closing what they use. A run is recorded only when it ends, so one cut short leaves no
|
|
114
|
+
// record, and a retry under the same run id runs it again.
|
|
115
|
+
await stopQuietly(() => drainActionRuns(sixb, ACTION_RUN_DRAIN_TIMEOUT_MS))
|
|
112
116
|
await stopQuietly(() => flushSixbErrors(sixb))
|
|
113
117
|
await stopQuietly(() => sixb.closeConnectors())
|
|
114
118
|
await stopQuietly(() => closeProvider(sixb.queues))
|
|
@@ -203,15 +207,14 @@ export async function startOrchestratorRuntime(
|
|
|
203
207
|
*
|
|
204
208
|
* Startup order (consumers before producers):
|
|
205
209
|
* 1. RulesWorker (subscribes to ontology events)
|
|
206
|
-
* 2.
|
|
207
|
-
* 3.
|
|
208
|
-
* 4.
|
|
209
|
-
* 5.
|
|
210
|
-
* 6.
|
|
211
|
-
* 7.
|
|
212
|
-
* 8.
|
|
213
|
-
* 9.
|
|
214
|
-
* 10. AgentWorker (claims from queues; its turns call the API)
|
|
210
|
+
* 2. ProjectionWorker (claims from queues)
|
|
211
|
+
* 3. PipelineWorker (claims from queues)
|
|
212
|
+
* 4. WorkflowWorker (claims from queues)
|
|
213
|
+
* 5. SyncWorker (claims from queues)
|
|
214
|
+
* 6. Orchestrator (subscribes to events and enqueues jobs)
|
|
215
|
+
* 7. Scheduler (emits schedule.triggered)
|
|
216
|
+
* 8. API server, when this process serves it
|
|
217
|
+
* 9. AgentWorker (claims from queues; its turns call the API)
|
|
215
218
|
*
|
|
216
219
|
* Shutdown order (producers before consumers):
|
|
217
220
|
* 1. AgentWorker (ends its turns while the API still answers them)
|
|
@@ -222,9 +225,8 @@ export async function startOrchestratorRuntime(
|
|
|
222
225
|
* 6. WorkflowWorker
|
|
223
226
|
* 7. PipelineWorker
|
|
224
227
|
* 8. ProjectionWorker
|
|
225
|
-
* 9.
|
|
226
|
-
* 10.
|
|
227
|
-
* 11. Runtime providers (connectors, broker)
|
|
228
|
+
* 9. RulesWorker (drains pending evaluations)
|
|
229
|
+
* 10. Runtime providers (connectors, broker)
|
|
228
230
|
*/
|
|
229
231
|
export async function startSixbRuntime(
|
|
230
232
|
sixb: LoadedSixbHost,
|
|
@@ -235,7 +237,6 @@ export async function startSixbRuntime(
|
|
|
235
237
|
let orchestratorRuntime: RunningOrchestratorRuntime | null = null
|
|
236
238
|
let rulesWorker: RulesWorker | null = null
|
|
237
239
|
let syncWorker: SyncWorker | null = null
|
|
238
|
-
let actionWorker: ActionWorker | null = null
|
|
239
240
|
let agentWorker: AgentWorker | null = null
|
|
240
241
|
let pipelineWorker: PipelineWorker | null = null
|
|
241
242
|
let workflowWorker: WorkflowWorker | null = null
|
|
@@ -252,7 +253,6 @@ export async function startSixbRuntime(
|
|
|
252
253
|
await stopQuietly(() => workflowWorker?.stop() ?? Promise.resolve())
|
|
253
254
|
await stopQuietly(() => pipelineWorker?.stop() ?? Promise.resolve())
|
|
254
255
|
await stopQuietly(() => projectionWorker?.stop() ?? Promise.resolve())
|
|
255
|
-
await stopQuietly(() => actionWorker?.stop() ?? Promise.resolve())
|
|
256
256
|
await stopQuietly(() => rulesRuntime?.stop() ?? Promise.resolve())
|
|
257
257
|
await stopSixbProviders(sixb)
|
|
258
258
|
}
|
|
@@ -265,11 +265,6 @@ export async function startSixbRuntime(
|
|
|
265
265
|
rulesWorker = rulesRuntime.rulesWorker
|
|
266
266
|
|
|
267
267
|
if (options.cohostWorkers) {
|
|
268
|
-
if (sixb.definitions.actions.list().length > 0) {
|
|
269
|
-
actionWorker = new ActionWorker(sixb)
|
|
270
|
-
await actionWorker.start()
|
|
271
|
-
}
|
|
272
|
-
|
|
273
268
|
// Constructed here so a configuration error stops startup early; started last, below.
|
|
274
269
|
if (agentWorkerRequired(sixb)) {
|
|
275
270
|
agentWorker = new AgentWorker(sixb, {
|
|
@@ -326,7 +321,6 @@ export async function startSixbRuntime(
|
|
|
326
321
|
const workers: Worker[] = []
|
|
327
322
|
if (rulesWorker) workers.push(rulesWorker)
|
|
328
323
|
if (syncWorker) workers.push(syncWorker)
|
|
329
|
-
if (actionWorker) workers.push(actionWorker)
|
|
330
324
|
if (agentWorker) workers.push(agentWorker)
|
|
331
325
|
if (projectionWorker) workers.push(projectionWorker)
|
|
332
326
|
if (pipelineWorker) workers.push(pipelineWorker)
|
|
@@ -338,7 +332,6 @@ export async function startSixbRuntime(
|
|
|
338
332
|
return {
|
|
339
333
|
rulesWorker,
|
|
340
334
|
syncWorker,
|
|
341
|
-
actionWorker,
|
|
342
335
|
agentWorker,
|
|
343
336
|
projectionWorker,
|
|
344
337
|
pipelineWorker,
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { WORKER_TYPES, type WorkerConcurrency, type WorkerType } from "./worker-registry"
|
|
2
|
+
|
|
3
|
+
/** The environment variable that sets each worker type's concurrency. */
|
|
4
|
+
const ENVIRONMENT_VARIABLES = {
|
|
5
|
+
sync: "SIXB_SYNC_WORKER_CONCURRENCY",
|
|
6
|
+
agent: "SIXB_AGENT_WORKER_CONCURRENCY",
|
|
7
|
+
pipeline: "SIXB_PIPELINE_WORKER_CONCURRENCY",
|
|
8
|
+
projection: "SIXB_PROJECTION_WORKER_CONCURRENCY",
|
|
9
|
+
workflow: "SIXB_WORKFLOW_WORKER_CONCURRENCY",
|
|
10
|
+
} as const satisfies Record<WorkerType, string>
|
|
8
11
|
|
|
9
12
|
/** Resolve the scalar concurrency accepted by `sixb worker <type>`. */
|
|
10
13
|
export function resolveSingleWorkerConcurrency(
|
|
11
14
|
workerType: WorkerType,
|
|
12
15
|
value: string | undefined
|
|
13
16
|
): WorkerConcurrency {
|
|
14
|
-
const
|
|
15
|
-
if (!isConfigurableWorkerType(workerType)) {
|
|
16
|
-
if (value !== undefined || nonblank(process.env[definition.environmentVariable])) {
|
|
17
|
-
throw fixedActionConcurrency()
|
|
18
|
-
}
|
|
19
|
-
return {}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const environmentVariable = definition.environmentVariable
|
|
17
|
+
const environmentVariable = ENVIRONMENT_VARIABLES[workerType]
|
|
23
18
|
const configured = value?.trim() ?? nonblank(process.env[environmentVariable])
|
|
24
19
|
if (configured === undefined) return {}
|
|
25
20
|
|
|
@@ -33,19 +28,12 @@ export function resolveSingleWorkerConcurrency(
|
|
|
33
28
|
export function resolveWorkerConcurrency(values: readonly string[] = []): WorkerConcurrency {
|
|
34
29
|
const overrides = values.map(parseWorkerConcurrencyEntry)
|
|
35
30
|
const overriddenWorkerTypes = new Set(overrides.map((entry) => entry.workerType))
|
|
36
|
-
const resolved: Partial<Record<
|
|
31
|
+
const resolved: Partial<Record<WorkerType, number>> = {}
|
|
37
32
|
|
|
38
33
|
for (const workerType of WORKER_TYPES) {
|
|
39
|
-
const definition = WORKER_CONCURRENCY_CONFIG[workerType]
|
|
40
|
-
if (!isConfigurableWorkerType(workerType)) {
|
|
41
|
-
if (nonblank(process.env[definition.environmentVariable])) {
|
|
42
|
-
throw fixedActionConcurrency()
|
|
43
|
-
}
|
|
44
|
-
continue
|
|
45
|
-
}
|
|
46
34
|
if (overriddenWorkerTypes.has(workerType)) continue
|
|
47
35
|
|
|
48
|
-
const environmentVariable =
|
|
36
|
+
const environmentVariable = ENVIRONMENT_VARIABLES[workerType]
|
|
49
37
|
const configured = nonblank(process.env[environmentVariable])
|
|
50
38
|
if (configured !== undefined) {
|
|
51
39
|
resolved[workerType] = parseConcurrency(configured, environmentVariable)
|
|
@@ -60,7 +48,7 @@ export function resolveWorkerConcurrency(values: readonly string[] = []): Worker
|
|
|
60
48
|
}
|
|
61
49
|
|
|
62
50
|
function parseWorkerConcurrencyEntry(value: string): {
|
|
63
|
-
readonly workerType:
|
|
51
|
+
readonly workerType: WorkerType
|
|
64
52
|
readonly concurrency: number
|
|
65
53
|
} {
|
|
66
54
|
const separator = value.indexOf("=")
|
|
@@ -72,12 +60,9 @@ function parseWorkerConcurrencyEntry(value: string): {
|
|
|
72
60
|
const configured = value.slice(separator + 1).trim()
|
|
73
61
|
if (!isWorkerType(workerType)) {
|
|
74
62
|
throw new Error(
|
|
75
|
-
`[SixbCLI] Unknown worker concurrency type '${workerType || value}'. Available: ${WORKER_TYPES.
|
|
63
|
+
`[SixbCLI] Unknown worker concurrency type '${workerType || value}'. Available: ${WORKER_TYPES.join(", ")}.`
|
|
76
64
|
)
|
|
77
65
|
}
|
|
78
|
-
if (!isConfigurableWorkerType(workerType)) {
|
|
79
|
-
throw fixedActionConcurrency()
|
|
80
|
-
}
|
|
81
66
|
|
|
82
67
|
return {
|
|
83
68
|
workerType,
|
|
@@ -105,10 +90,6 @@ function isWorkerType(value: string): value is WorkerType {
|
|
|
105
90
|
return WORKER_TYPES.some((workerType) => workerType === value)
|
|
106
91
|
}
|
|
107
92
|
|
|
108
|
-
function isConfigurableWorkerType(value: WorkerType): value is ConfigurableWorkerType {
|
|
109
|
-
return WORKER_CONCURRENCY_CONFIG[value].configurable
|
|
110
|
-
}
|
|
111
|
-
|
|
112
93
|
function invalidConcurrency(value: string, source: string): Error {
|
|
113
94
|
return new Error(
|
|
114
95
|
`[SixbCLI] Invalid worker concurrency '${value}'. Use a positive integer with ${source}.`
|
|
@@ -121,7 +102,3 @@ function invalidWorkerConcurrencyEntry(value: string): Error {
|
|
|
121
102
|
"--concurrency agent=4 --concurrency sync=2."
|
|
122
103
|
)
|
|
123
104
|
}
|
|
124
|
-
|
|
125
|
-
function fixedActionConcurrency(): Error {
|
|
126
|
-
return new Error("[SixbCLI] Action worker concurrency is fixed at 1 and cannot be configured.")
|
|
127
|
-
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ActionWorker } from "@sixb/action-worker"
|
|
2
1
|
import { AgentWorker } from "@sixb/agent-worker"
|
|
3
2
|
import type { Worker } from "@sixb/core/internal/workers"
|
|
4
3
|
import { PipelineWorker } from "@sixb/pipeline-worker"
|
|
@@ -9,36 +8,11 @@ import { SixbCliError } from "./errors"
|
|
|
9
8
|
import type { LoadedSixbHost } from "./loadSixb"
|
|
10
9
|
import { configuredOrigin } from "./public-origin"
|
|
11
10
|
|
|
12
|
-
export const WORKER_TYPES = [
|
|
13
|
-
"sync",
|
|
14
|
-
"action",
|
|
15
|
-
"agent",
|
|
16
|
-
"pipeline",
|
|
17
|
-
"projection",
|
|
18
|
-
"workflow",
|
|
19
|
-
] as const
|
|
11
|
+
export const WORKER_TYPES = ["sync", "agent", "pipeline", "projection", "workflow"] as const
|
|
20
12
|
|
|
21
13
|
export type WorkerType = (typeof WORKER_TYPES)[number]
|
|
22
14
|
|
|
23
|
-
export
|
|
24
|
-
sync: { configurable: true, environmentVariable: "SIXB_SYNC_WORKER_CONCURRENCY" },
|
|
25
|
-
action: { configurable: false, environmentVariable: "SIXB_ACTION_WORKER_CONCURRENCY" },
|
|
26
|
-
agent: { configurable: true, environmentVariable: "SIXB_AGENT_WORKER_CONCURRENCY" },
|
|
27
|
-
pipeline: { configurable: true, environmentVariable: "SIXB_PIPELINE_WORKER_CONCURRENCY" },
|
|
28
|
-
projection: { configurable: true, environmentVariable: "SIXB_PROJECTION_WORKER_CONCURRENCY" },
|
|
29
|
-
workflow: { configurable: true, environmentVariable: "SIXB_WORKFLOW_WORKER_CONCURRENCY" },
|
|
30
|
-
} as const satisfies Record<
|
|
31
|
-
WorkerType,
|
|
32
|
-
{ readonly configurable: boolean; readonly environmentVariable: string }
|
|
33
|
-
>
|
|
34
|
-
|
|
35
|
-
export type ConfigurableWorkerType = {
|
|
36
|
-
[Type in WorkerType]: (typeof WORKER_CONCURRENCY_CONFIG)[Type]["configurable"] extends true
|
|
37
|
-
? Type
|
|
38
|
-
: never
|
|
39
|
-
}[WorkerType]
|
|
40
|
-
|
|
41
|
-
export type WorkerConcurrency = Readonly<Partial<Record<ConfigurableWorkerType, number>>>
|
|
15
|
+
export type WorkerConcurrency = Readonly<Partial<Record<WorkerType, number>>>
|
|
42
16
|
export type QueueWorkerProcess = Worker & { readonly concurrency: number }
|
|
43
17
|
|
|
44
18
|
export interface WorkerCreationOptions {
|
|
@@ -70,9 +44,6 @@ const workerFactories: Record<WorkerType, WorkerFactory> = {
|
|
|
70
44
|
create: (sixb, options) =>
|
|
71
45
|
new SyncWorker(sixb, { concurrency: options.workerConcurrency?.sync }),
|
|
72
46
|
},
|
|
73
|
-
action: {
|
|
74
|
-
create: (sixb) => new ActionWorker(sixb),
|
|
75
|
-
},
|
|
76
47
|
agent: {
|
|
77
48
|
create: (sixb, options) =>
|
|
78
49
|
new AgentWorker(sixb, {
|
|
@@ -117,6 +88,7 @@ export function resolveWorkerTypeToStart(requestedWorker?: string): WorkerType {
|
|
|
117
88
|
throw new Error(`[SixbWorker] Usage: sixb worker <${knownWorkers().replaceAll(", ", "|")}>`)
|
|
118
89
|
}
|
|
119
90
|
|
|
91
|
+
if (requestedWorker === "action") throw removedActionWorker()
|
|
120
92
|
if (!isWorkerType(requestedWorker)) {
|
|
121
93
|
throw new Error(
|
|
122
94
|
`[SixbWorker] Unknown worker '${requestedWorker}'. Available: ${knownWorkers()}`
|
|
@@ -126,6 +98,14 @@ export function resolveWorkerTypeToStart(requestedWorker?: string): WorkerType {
|
|
|
126
98
|
return requestedWorker
|
|
127
99
|
}
|
|
128
100
|
|
|
101
|
+
/** `action` was a worker type until Actions ran in the process that requests them. */
|
|
102
|
+
function removedActionWorker(): Error {
|
|
103
|
+
return new Error(
|
|
104
|
+
"[SixbWorker] 'action' is no longer a worker type: Actions run in the process that requests " +
|
|
105
|
+
"them (API, workflows, syncs). Remove it from the command."
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
129
109
|
/**
|
|
130
110
|
* Why this worker cannot be constructed with these options, or `null` when it can. Exported
|
|
131
111
|
* for `sixb worker`, which has to answer this before it migrates storage.
|
|
@@ -203,10 +183,6 @@ export function resolveRegisteredWorkerTypes(sixb: LoadedSixbHost): readonly Wor
|
|
|
203
183
|
workerTypes.push("projection")
|
|
204
184
|
}
|
|
205
185
|
|
|
206
|
-
if (sixb.definitions.actions.list().length > 0) {
|
|
207
|
-
workerTypes.push("action")
|
|
208
|
-
}
|
|
209
|
-
|
|
210
186
|
if (agentWorkerRequired(sixb)) {
|
|
211
187
|
workerTypes.push("agent")
|
|
212
188
|
}
|