@sixb/cli 0.2.4 → 0.2.5
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 +2 -0
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/dev-runner.d.ts.map +1 -1
- package/dist/commands/run.d.ts +15 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/lib/command-line.d.ts +7 -2
- package/dist/lib/command-line.d.ts.map +1 -1
- package/dist/lib/deploy-source.d.ts +2 -0
- package/dist/lib/deploy-source.d.ts.map +1 -1
- package/dist/lib/runtime.d.ts +4 -2
- 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 +3 -1
- package/dist/lib/worker-registry.d.ts.map +1 -1
- package/dist/tui/app.d.ts.map +1 -1
- package/dist/tui/format.d.ts +7 -2
- package/dist/tui/format.d.ts.map +1 -1
- package/package.json +20 -19
- package/src/commands/agent.ts +16 -4
- package/src/commands/dev-runner.ts +1 -0
- package/src/commands/run.ts +221 -0
- package/src/index.tsx +14 -0
- package/src/lib/command-line.ts +35 -4
- package/src/lib/deploy-source.ts +5 -0
- package/src/lib/runtime.ts +19 -3
- package/src/lib/worker-concurrency.ts +1 -0
- package/src/lib/worker-registry.ts +31 -4
- package/src/tui/app.tsx +8 -5
- package/src/tui/format.ts +132 -7
- package/src/tui/transcript.tsx +4 -1
package/README.md
CHANGED
|
@@ -195,6 +195,7 @@ sixb worker pipeline
|
|
|
195
195
|
sixb worker projection
|
|
196
196
|
sixb worker workflow
|
|
197
197
|
sixb worker lake
|
|
198
|
+
sixb worker render
|
|
198
199
|
|
|
199
200
|
# Development with custom entry and app port
|
|
200
201
|
sixb dev --entry examples/mac-os/sixb.config.ts --port 8080
|
|
@@ -399,6 +400,7 @@ sixb worker sync
|
|
|
399
400
|
sixb worker pipeline
|
|
400
401
|
sixb worker projection
|
|
401
402
|
sixb worker lake
|
|
403
|
+
sixb worker render
|
|
402
404
|
SIXB_API_PUBLIC_ORIGIN=https://api.example.com sixb worker agent
|
|
403
405
|
```
|
|
404
406
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAsCA;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE;IACtC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,oGAAoG;IACpG,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAsCA;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE;IACtC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,oGAAoG;IACpG,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAgIhB;AAsPD,oFAAoF;AACpF,wBAAgB,aAAa,CAC3B,SAAS,EAAE,SAAS;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,GACvF,MAAM,CAWR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-runner.d.ts","sourceRoot":"","sources":["../../src/commands/dev-runner.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAExB,MAAM,kBAAkB,CAAA;AA2BzB,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,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,mGAAmG;IACnG,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAsB,aAAa,CAAC,OAAO,GAAE,UAAe,
|
|
1
|
+
{"version":3,"file":"dev-runner.d.ts","sourceRoot":"","sources":["../../src/commands/dev-runner.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAExB,MAAM,kBAAkB,CAAA;AA2BzB,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,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,mGAAmG;IACnG,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAsB,aAAa,CAAC,OAAO,GAAE,UAAe,iBAwJ3D;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,SAAS,EAAE;IAAE,GAAG,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;CAAE,EAC7E,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAOpF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RunScriptOptions {
|
|
2
|
+
readonly script: string;
|
|
3
|
+
/** Everything after the script's path, passed to it untouched. */
|
|
4
|
+
readonly args: readonly string[];
|
|
5
|
+
readonly entry?: string;
|
|
6
|
+
readonly deployed?: boolean;
|
|
7
|
+
readonly yes?: boolean;
|
|
8
|
+
readonly cwd?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* `sixb run`: calls a script's default export with the project's SDK, here or, with `deployed`, on
|
|
12
|
+
* the deployment. Resolves with the exit code the command should end with.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runScriptCommand(options: RunScriptOptions): Promise<number>;
|
|
15
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CASjF"}
|
|
@@ -146,7 +146,12 @@ export declare const CLI_OPTION_DEFINITIONS: {
|
|
|
146
146
|
};
|
|
147
147
|
readonly yes: {
|
|
148
148
|
readonly syntax: "--yes";
|
|
149
|
-
readonly summary: "
|
|
149
|
+
readonly summary: "Go ahead without asking: allow the folders named, or run on the deployment";
|
|
150
|
+
readonly kind: "boolean";
|
|
151
|
+
};
|
|
152
|
+
readonly deployed: {
|
|
153
|
+
readonly syntax: "--deployed";
|
|
154
|
+
readonly summary: "Run on the deployment sixb.deploy.ts describes";
|
|
150
155
|
readonly kind: "boolean";
|
|
151
156
|
};
|
|
152
157
|
readonly outdir: {
|
|
@@ -231,7 +236,7 @@ export declare const CLI_OPTION_DEFINITIONS: {
|
|
|
231
236
|
};
|
|
232
237
|
};
|
|
233
238
|
export type CliOptionName = keyof typeof CLI_OPTION_DEFINITIONS;
|
|
234
|
-
export type LocalCommandId = "agent" | "connect" | "dev" | "api" | "app" | "login" | "logout" | "status" | "profile:list" | "profile:show" | "profile:use" | "token:list" | "token:create" | "token:revoke" | "service-account:list" | "service-account:create" | "service-account:disable" | "service-account:token:list" | "service-account:token:create" | "service-account:token:revoke" | "scheduler" | "orchestrator" | "rules" | "worker" | "worker-group" | "check" | "typegen" | "build" | "desktop:build" | "db:migrate" | "db:prepare" | "lake:check" | "lake:cleanup" | "lake:rejected" | "deploy" | "deploy:status" | "deploy:logs" | "deploy:restart" | "deploy:start" | "deploy:stop" | "deploy:setup" | "deploy:check" | "deploy:ci" | "deploy:access:list" | "deploy:access:add" | "deploy:access:remove" | "env:init" | "env:pull" | "env:set" | "env:status" | "init";
|
|
239
|
+
export type LocalCommandId = "agent" | "connect" | "dev" | "api" | "app" | "login" | "logout" | "status" | "profile:list" | "profile:show" | "profile:use" | "token:list" | "token:create" | "token:revoke" | "service-account:list" | "service-account:create" | "service-account:disable" | "service-account:token:list" | "service-account:token:create" | "service-account:token:revoke" | "scheduler" | "orchestrator" | "rules" | "worker" | "worker-group" | "check" | "run" | "typegen" | "build" | "desktop:build" | "db:migrate" | "db:prepare" | "lake:check" | "lake:cleanup" | "lake:rejected" | "deploy" | "deploy:status" | "deploy:logs" | "deploy:restart" | "deploy:start" | "deploy:stop" | "deploy:setup" | "deploy:check" | "deploy:ci" | "deploy:access:list" | "deploy:access:add" | "deploy:access:remove" | "env:init" | "env:pull" | "env:set" | "env:status" | "init";
|
|
235
240
|
export interface CliHelpItem {
|
|
236
241
|
readonly label: string;
|
|
237
242
|
readonly value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-line.d.ts","sourceRoot":"","sources":["../../src/lib/command-line.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"command-line.d.ts","sourceRoot":"","sources":["../../src/lib/command-line.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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,CAepE"}
|
|
@@ -18,6 +18,8 @@ export declare function resolveBunVersion(projectDir: string, source?: Pick<Depl
|
|
|
18
18
|
export declare function projectPathOf(projectDir: string): Promise<string>;
|
|
19
19
|
/** The root of the git repository the project is in. */
|
|
20
20
|
export declare function repoRootOf(projectDir: string): Promise<string>;
|
|
21
|
+
/** The commit checked out where the project is, or null outside a git repository. */
|
|
22
|
+
export declare function headCommit(projectDir: string): Promise<string | null>;
|
|
21
23
|
/** Who deploys, recorded with the release. */
|
|
22
24
|
export declare function deployer(projectDir: string): Promise<string>;
|
|
23
25
|
/** Whether a commit being deployed has this file in the project's directory. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-source.d.ts","sourceRoot":"","sources":["../../src/lib/deploy-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAA;AAG1E,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAkCxF;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,MAAM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gB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE9D;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAErE;AAED,8CAA8C;AAC9C,wBAAsB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMlE;AA4DD,gFAAgF;AAChF,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,aAAa,CAAC,EACpD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,OAAO,CAAC,CAGlB"}
|
package/dist/lib/runtime.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { LakeWorker } from "@sixb/lake-worker";
|
|
|
4
4
|
import { OrchestratorWorker } from "@sixb/orchestrator";
|
|
5
5
|
import { PipelineWorker } from "@sixb/pipeline-worker";
|
|
6
6
|
import { ProjectionWorker } from "@sixb/projection-worker";
|
|
7
|
+
import { RenderWorker } from "@sixb/render-worker";
|
|
7
8
|
import { RulesWorker } from "@sixb/rules-worker";
|
|
8
9
|
import { SyncWorker } from "@sixb/sync-worker";
|
|
9
10
|
import { WorkflowWorker } from "@sixb/workflow-worker";
|
|
@@ -14,6 +15,7 @@ export interface RunningSixbRuntime {
|
|
|
14
15
|
readonly rulesWorker: RulesWorker | null;
|
|
15
16
|
readonly syncWorker: SyncWorker | null;
|
|
16
17
|
readonly lakeWorker: LakeWorker | null;
|
|
18
|
+
readonly renderWorker: RenderWorker | null;
|
|
17
19
|
readonly agentWorker: AgentWorker | null;
|
|
18
20
|
readonly projectionWorker: ProjectionWorker | null;
|
|
19
21
|
readonly pipelineWorker: PipelineWorker | null;
|
|
@@ -77,7 +79,7 @@ export declare function startOrchestratorRuntime(sixb: LoadedSixbHost): Promise<
|
|
|
77
79
|
* 3. PipelineWorker (claims from queues)
|
|
78
80
|
* 4. WorkflowWorker (claims from queues)
|
|
79
81
|
* 5. SyncWorker (claims from queues)
|
|
80
|
-
* 6. LakeWorker (
|
|
82
|
+
* 6. LakeWorker and RenderWorker (claim from queues)
|
|
81
83
|
* 7. Orchestrator (subscribes to events, enqueues jobs, runs cron and the maintenance loop)
|
|
82
84
|
* 8. API server, when this process serves it
|
|
83
85
|
* 9. AgentWorker (claims from queues; its turns call the API)
|
|
@@ -86,7 +88,7 @@ export declare function startOrchestratorRuntime(sixb: LoadedSixbHost): Promise<
|
|
|
86
88
|
* 1. AgentWorker (ends its turns while the API still answers them)
|
|
87
89
|
* 2. API server
|
|
88
90
|
* 3. Orchestrator (stops cron, drains pending dispatches)
|
|
89
|
-
* 4. LakeWorker
|
|
91
|
+
* 4. RenderWorker and LakeWorker
|
|
90
92
|
* 5. SyncWorker
|
|
91
93
|
* 6. WorkflowWorker
|
|
92
94
|
* 7. PipelineWorker
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/lib/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAYhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAGzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAIL,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,OAA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,wBAAgB,qBAAqB,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,CAM/E;AAED,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAKrF;AAED,kGAAkG;AAClG,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtF;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAGhG;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,wBAAwB,CAC5C,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,0BAA0B,CAAC,CA6DrC;AAYD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,kBAAkB,CAAC,CAiI7B"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAazF,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;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAKtF;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CACpC,GAAG;IAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAA;CAAE,CAsBzF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
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", "agent", "pipeline", "projection", "workflow", "lake"];
|
|
3
|
+
export declare const WORKER_TYPES: readonly ["sync", "agent", "pipeline", "projection", "workflow", "lake", "render"];
|
|
4
4
|
export type WorkerType = (typeof WORKER_TYPES)[number];
|
|
5
5
|
export type WorkerConcurrency = Readonly<Partial<Record<WorkerType, number>>>;
|
|
6
6
|
export type QueueWorkerProcess = Worker & {
|
|
@@ -39,6 +39,8 @@ export interface WorkerGroupInputs {
|
|
|
39
39
|
export declare function assertWorkerInputs(input: WorkerGroupInputs): void;
|
|
40
40
|
export declare function resolveRegisteredWorkerTypes(sixb: LoadedSixbHost): readonly WorkerType[];
|
|
41
41
|
export declare function lakeWorkerRequired(sixb: LoadedSixbHost): boolean;
|
|
42
|
+
/** Renders run in the project's sandboxes, so a project with none asks for none. */
|
|
43
|
+
export declare function renderWorkerRequired(sixb: LoadedSixbHost): boolean;
|
|
42
44
|
/** Requests stay queued while no worker claims them, which looks like an idle system. */
|
|
43
45
|
export declare function omittedWorkerWarnings(sixb: LoadedSixbHost, workerTypes: readonly string[]): readonly string[];
|
|
44
46
|
/** Explicit model calls can enqueue accounting recovery without a model catalog. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-registry.d.ts","sourceRoot":"","sources":["../../src/lib/worker-registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"worker-registry.d.ts","sourceRoot":"","sources":["../../src/lib/worker-registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAQzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGhD,eAAO,MAAM,YAAY,oFAQf,CAAA;AAEV,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,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IAC9C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IACnC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IACrC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAA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AAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAmC,KAAK,GAAG,EAAuB,MAAM,cAAc,CAAA;AAgB7F,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAA;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,mFAAmF;IACnF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAA;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAC5B;AAED,+FAA+F;AAC/F,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,6BAqZ9C;AAqvBD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,GAAG,EAAE,EACpB,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,KAAK,EAAE;IACL,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;IACjC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;CAC9B,GACA,MAAM,CAcR"}
|
package/dist/tui/format.d.ts
CHANGED
|
@@ -17,9 +17,14 @@ export interface ToolLine {
|
|
|
17
17
|
readonly command?: string;
|
|
18
18
|
/** The preview is diff lines, `+` added and `-` removed, colored as such. */
|
|
19
19
|
readonly diff?: boolean;
|
|
20
|
+
/** The preview rows start with paths, shown as the person reads them. */
|
|
21
|
+
readonly paths?: boolean;
|
|
20
22
|
}
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
+
/**
|
|
24
|
+
* `outcomes` says how the held calls ended, by approval id: a decided call is no longer held.
|
|
25
|
+
* `folder` is the one a computer's turns work in: a search names where it looked relative to it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function toolLine(part: ToolPart, outcomes?: ReadonlyMap<string, ApprovalOutcome>, folder?: string): ToolLine;
|
|
23
28
|
export interface AskedQuestion {
|
|
24
29
|
readonly question: string;
|
|
25
30
|
readonly choices: readonly string[];
|
package/dist/tui/format.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/tui/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEpD,KAAK,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAExD,mEAAmE;AACnE,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,gFAAgF;IAChF,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,wDAAwD;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/tui/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEpD,KA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AAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX;IACD,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB,CAoBA;AAED,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACzB,CAQA;AAED,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,SAAK,GAAG,MAAM,CAStE;AAED,qCAAqC;AACrC,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAUlE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixb/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Command-line interface for Sixb projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -31,31 +31,32 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@opentui/core": "0.6.6",
|
|
33
33
|
"@opentui/react": "0.6.6",
|
|
34
|
-
"@sixb/agent": "0.2.
|
|
35
|
-
"@sixb/agent-worker": "0.2.
|
|
36
|
-
"@sixb/app": "^0.2.
|
|
37
|
-
"@sixb/client": "^0.2.
|
|
38
|
-
"@sixb/core": "0.2.
|
|
34
|
+
"@sixb/agent": "0.2.5",
|
|
35
|
+
"@sixb/agent-worker": "0.2.5",
|
|
36
|
+
"@sixb/app": "^0.2.5",
|
|
37
|
+
"@sixb/client": "^0.2.5",
|
|
38
|
+
"@sixb/core": "0.2.5",
|
|
39
39
|
"@sixb/cli-core": "^0.2.3",
|
|
40
|
-
"@sixb/lake-worker": "0.2.
|
|
41
|
-
"@sixb/orchestrator": "0.2.
|
|
42
|
-
"@sixb/pipeline-worker": "0.2.
|
|
43
|
-
"@sixb/projection-worker": "0.2.
|
|
44
|
-
"@sixb/
|
|
40
|
+
"@sixb/lake-worker": "0.2.5",
|
|
41
|
+
"@sixb/orchestrator": "0.2.5",
|
|
42
|
+
"@sixb/pipeline-worker": "0.2.5",
|
|
43
|
+
"@sixb/projection-worker": "0.2.5",
|
|
44
|
+
"@sixb/render-worker": "0.2.5",
|
|
45
|
+
"@sixb/rules-worker": "0.2.5",
|
|
45
46
|
"@sixb/sandboxes-local": "^0.2.0",
|
|
46
|
-
"@sixb/server": "0.2.
|
|
47
|
-
"@sixb/sync-worker": "0.2.
|
|
48
|
-
"@sixb/workflow-worker": "0.2.
|
|
47
|
+
"@sixb/server": "0.2.5",
|
|
48
|
+
"@sixb/sync-worker": "0.2.5",
|
|
49
|
+
"@sixb/workflow-worker": "0.2.5",
|
|
49
50
|
"create-sixb": "^0.2.0",
|
|
50
51
|
"react": "^19.2.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@sixb/deploy-ssh": "0.2.
|
|
54
|
+
"@sixb/deploy-ssh": "0.2.5",
|
|
54
55
|
"@sixb/desktop": "0.2.1",
|
|
55
|
-
"@sixb/ducklake": "0.2.
|
|
56
|
-
"@sixb/pg": "0.2.
|
|
57
|
-
"@sixb/queues-bullmq": "0.2.
|
|
58
|
-
"@sixb/sqlite": "0.2.
|
|
56
|
+
"@sixb/ducklake": "0.2.5",
|
|
57
|
+
"@sixb/pg": "0.2.5",
|
|
58
|
+
"@sixb/queues-bullmq": "0.2.5",
|
|
59
|
+
"@sixb/sqlite": "0.2.5",
|
|
59
60
|
"@types/bun": "latest",
|
|
60
61
|
"@types/react": "^19.0.0",
|
|
61
62
|
"typescript": "^5.7.0"
|
package/src/commands/agent.ts
CHANGED
|
@@ -127,6 +127,9 @@ export async function runAgent(options: {
|
|
|
127
127
|
},
|
|
128
128
|
throwOnError: true,
|
|
129
129
|
})
|
|
130
|
+
if (!posted.run) {
|
|
131
|
+
throw new Error("[SixbCli] A sent message started no turn: the thread already had one.")
|
|
132
|
+
}
|
|
130
133
|
let runId: string | null = posted.run.id
|
|
131
134
|
if (options.detach) {
|
|
132
135
|
if (onComputer && !thread.computer?.online) step(tone.faint(waitingNote(thread.computer)))
|
|
@@ -142,7 +145,14 @@ export async function runAgent(options: {
|
|
|
142
145
|
stop.signal.addEventListener("abort", stopWatching, { once: true })
|
|
143
146
|
const nobody =
|
|
144
147
|
onComputer && runnerUntilHeld(connection, thread.id, runId, runner, watching.signal)
|
|
145
|
-
followed = await follow(
|
|
148
|
+
followed = await follow(
|
|
149
|
+
connection,
|
|
150
|
+
runId,
|
|
151
|
+
options.json,
|
|
152
|
+
stop.signal,
|
|
153
|
+
nobody || undefined,
|
|
154
|
+
onComputer ? place?.folder : undefined
|
|
155
|
+
)
|
|
146
156
|
stopWatching()
|
|
147
157
|
stop.signal.removeEventListener("abort", stopWatching)
|
|
148
158
|
if (followed === "offline") {
|
|
@@ -236,14 +246,16 @@ function printSent(threadId: string, runId: string, json: boolean): void {
|
|
|
236
246
|
|
|
237
247
|
/**
|
|
238
248
|
* Show a turn's steps as they finish, until it ends, the stream fails, the person stops waiting,
|
|
239
|
-
* or `nobody` says nothing will run it. Rejects when `nobody` does.
|
|
249
|
+
* or `nobody` says nothing will run it. Rejects when `nobody` does. `folder` is the one a
|
|
250
|
+
* computer's turns work in.
|
|
240
251
|
*/
|
|
241
252
|
async function follow(
|
|
242
253
|
connection: Connection,
|
|
243
254
|
runId: string,
|
|
244
255
|
json: boolean,
|
|
245
256
|
signal: AbortSignal,
|
|
246
|
-
nobody?: Promise<"unclaimed" | "offline" | null
|
|
257
|
+
nobody?: Promise<"unclaimed" | "offline" | null>,
|
|
258
|
+
folder?: string
|
|
247
259
|
): Promise<"finished" | "stopped" | "failed" | "unclaimed" | "offline"> {
|
|
248
260
|
let live = liveRun(runId)
|
|
249
261
|
const shown = new Set<string>()
|
|
@@ -276,7 +288,7 @@ async function follow(
|
|
|
276
288
|
for (const part of live.parts) {
|
|
277
289
|
if (part.kind !== "tool" || part.state === "running" || shown.has(part.id)) continue
|
|
278
290
|
shown.add(part.id)
|
|
279
|
-
const line = toolLine(part)
|
|
291
|
+
const line = toolLine(part, undefined, folder)
|
|
280
292
|
const mark = line.held
|
|
281
293
|
? tone.warn(glyph.live)
|
|
282
294
|
: line.failed || part.state === "error"
|
|
@@ -161,6 +161,7 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
161
161
|
{ type: "workflow", worker: runtime.workflowWorker },
|
|
162
162
|
{ type: "sync", worker: runtime.syncWorker },
|
|
163
163
|
{ type: "lake", worker: runtime.lakeWorker },
|
|
164
|
+
{ type: "render", worker: runtime.renderWorker },
|
|
164
165
|
].flatMap(({ type, worker }) => (worker ? [{ type, concurrency: worker.concurrency }] : [])),
|
|
165
166
|
warnings: devApp.warning ? [devApp.warning, ...runtime.warnings] : runtime.warnings,
|
|
166
167
|
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { readFile, stat } from "node:fs/promises"
|
|
2
|
+
import { isAbsolute, relative, resolve, sep } from "node:path"
|
|
3
|
+
import { createInterface } from "node:readline/promises"
|
|
4
|
+
import { pathToFileURL } from "node:url"
|
|
5
|
+
import { checkStorageSchema } from "@sixb/core"
|
|
6
|
+
import { listProjectModules } from "@sixb/core/internal/bootstrap"
|
|
7
|
+
import { bindScript } from "@sixb/core/internal/runtime"
|
|
8
|
+
import { loadDeployConfig } from "../lib/deploy-config"
|
|
9
|
+
import { headCommit } from "../lib/deploy-source"
|
|
10
|
+
import { SixbCliError } from "../lib/errors"
|
|
11
|
+
import { loadSixbFromEntry } from "../lib/loadSixb"
|
|
12
|
+
import { stopSixbProviders } from "../lib/runtime"
|
|
13
|
+
import { withTask } from "../ui"
|
|
14
|
+
import { glyph, tone } from "../ui/theme"
|
|
15
|
+
|
|
16
|
+
export interface RunScriptOptions {
|
|
17
|
+
readonly script: string
|
|
18
|
+
/** Everything after the script's path, passed to it untouched. */
|
|
19
|
+
readonly args: readonly string[]
|
|
20
|
+
readonly entry?: string
|
|
21
|
+
readonly deployed?: boolean
|
|
22
|
+
readonly yes?: boolean
|
|
23
|
+
readonly cwd?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* `sixb run`: calls a script's default export with the project's SDK, here or, with `deployed`, on
|
|
28
|
+
* the deployment. Resolves with the exit code the command should end with.
|
|
29
|
+
*/
|
|
30
|
+
export async function runScriptCommand(options: RunScriptOptions): Promise<number> {
|
|
31
|
+
const cwd = options.cwd ?? process.cwd()
|
|
32
|
+
if (options.deployed && options.entry) {
|
|
33
|
+
throw new SixbCliError("[SixbRun] --entry applies to a run here, not to a deployed one.", {
|
|
34
|
+
remediation: "The deployment runs with the configuration it was deployed with.",
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
const script = await projectScript(cwd, options.script)
|
|
38
|
+
return options.deployed ? runOnDeployment(cwd, script, options) : runHere(cwd, script, options)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface ProjectScript {
|
|
42
|
+
readonly file: string
|
|
43
|
+
/** Relative to the project, with forward slashes: what the execution records. */
|
|
44
|
+
readonly path: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function projectScript(cwd: string, script: string): Promise<ProjectScript> {
|
|
48
|
+
const file = resolve(cwd, script)
|
|
49
|
+
const entry = await stat(file).catch(() => null)
|
|
50
|
+
if (!entry?.isFile()) throw new SixbCliError(`[SixbRun] No script at ${script}.`)
|
|
51
|
+
|
|
52
|
+
const path = relative(cwd, file)
|
|
53
|
+
if (path.startsWith("..") || isAbsolute(path)) {
|
|
54
|
+
throw new SixbCliError(`[SixbRun] ${script} is outside the project.`, {
|
|
55
|
+
remediation:
|
|
56
|
+
"Move it into the project, such as into scripts/, and run sixb run from the project's directory.",
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
const projectPath = path.split(sep).join("/")
|
|
60
|
+
// Sixb imports every module in these folders as a definition, and a script is not one.
|
|
61
|
+
const modules = await listProjectModules(cwd)
|
|
62
|
+
if (modules.some((module) => module.path.split(sep).join("/") === projectPath)) {
|
|
63
|
+
throw new SixbCliError(`[SixbRun] ${projectPath} is in a folder Sixb loads definitions from.`, {
|
|
64
|
+
remediation: "Move it outside the definition folders, such as into scripts/.",
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
return { file, path: projectPath }
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function runHere(
|
|
71
|
+
cwd: string,
|
|
72
|
+
script: ProjectScript,
|
|
73
|
+
options: RunScriptOptions
|
|
74
|
+
): Promise<number> {
|
|
75
|
+
// The source entry, even where a build exists: the script imports the project's source modules,
|
|
76
|
+
// and loading the same files keeps one copy of each.
|
|
77
|
+
const entry = resolve(cwd, options.entry ?? "sixb.config.ts")
|
|
78
|
+
if (!(await Bun.file(entry).exists())) {
|
|
79
|
+
throw new SixbCliError(`[SixbRun] No ${relative(cwd, entry)} here.`, {
|
|
80
|
+
remediation: "Run sixb run from the project's directory, or pass --entry.",
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const host = await loadSixbFromEntry(entry)
|
|
85
|
+
const stop = interruptOnSignals()
|
|
86
|
+
try {
|
|
87
|
+
// Before anything can fail: closing the host must not publish the running instance's events.
|
|
88
|
+
const bound = bindScript(host, script.path)
|
|
89
|
+
|
|
90
|
+
// Awaited here, as `sixb check` does: `checkReadiness()` serves a probe that polls, so its first
|
|
91
|
+
// answer only starts this check and reports it in progress.
|
|
92
|
+
const schema = await checkStorageSchema(host.storage)
|
|
93
|
+
if (!schema.ok) {
|
|
94
|
+
throw new SixbCliError(`[SixbRun] ${host.id}'s storage is not usable: ${schema.reason}`)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const module = (await import(pathToFileURL(script.file).href)) as { readonly default?: unknown }
|
|
98
|
+
if (typeof module.default !== "function") {
|
|
99
|
+
throw new SixbCliError(`[SixbRun] ${script.path} has no default export to run.`, {
|
|
100
|
+
remediation:
|
|
101
|
+
"Export a function: `export default async function ({ sixb, args, signal }: ScriptContext) { ... }`.",
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (stop.signal.aborted) return 130
|
|
106
|
+
say(`${tone.muted(glyph.prompt)} ${tone.strong(script.path)} ${tone.muted(`on ${host.id}`)}`)
|
|
107
|
+
const started = performance.now()
|
|
108
|
+
try {
|
|
109
|
+
await bound.run({ main: module.default, args: options.args, signal: stop.signal })
|
|
110
|
+
} catch (error) {
|
|
111
|
+
// A script that stops by throwing once its signal aborts, as `throwIfAborted()` does, was
|
|
112
|
+
// stopped; any other throw is its own failure, and its stack is what its author needs.
|
|
113
|
+
if (!stop.signal.aborted) {
|
|
114
|
+
console.error(error)
|
|
115
|
+
say(`${tone.fail(glyph.fail)} ${script.path} failed after ${seconds(started)}`)
|
|
116
|
+
return 1
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (stop.signal.aborted) {
|
|
121
|
+
say(`${tone.warn(glyph.warn)} ${script.path} stopped after ${seconds(started)}`)
|
|
122
|
+
return 130
|
|
123
|
+
}
|
|
124
|
+
say(`${tone.ok(glyph.ok)} ${script.path} finished in ${seconds(started)}`)
|
|
125
|
+
return 0
|
|
126
|
+
} finally {
|
|
127
|
+
stop.dispose()
|
|
128
|
+
await stopSixbProviders(host)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The first Ctrl-C or SIGTERM aborts the script's `signal`; a second one exits at once. A hangup,
|
|
134
|
+
* such as a closed SSH connection, exits at once: nobody is left to read the output or press
|
|
135
|
+
* Ctrl-C again. Either way, writes already committed stay committed.
|
|
136
|
+
*/
|
|
137
|
+
function interruptOnSignals(): { readonly signal: AbortSignal; dispose(): void } {
|
|
138
|
+
const controller = new AbortController()
|
|
139
|
+
const signals = ["SIGINT", "SIGTERM", "SIGHUP"] as const
|
|
140
|
+
const onSignal = (signal: (typeof signals)[number]) => {
|
|
141
|
+
if (signal === "SIGHUP") process.exit(129)
|
|
142
|
+
if (controller.signal.aborted) process.exit(130)
|
|
143
|
+
say(tone.muted("Stopping the script. Press Ctrl-C again to exit at once."))
|
|
144
|
+
controller.abort(new Error(`[SixbRun] Stopped by ${signal}.`))
|
|
145
|
+
}
|
|
146
|
+
for (const signal of signals) process.on(signal, onSignal)
|
|
147
|
+
return {
|
|
148
|
+
signal: controller.signal,
|
|
149
|
+
dispose: () => {
|
|
150
|
+
for (const signal of signals) process.off(signal, onSignal)
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function runOnDeployment(
|
|
156
|
+
cwd: string,
|
|
157
|
+
script: ProjectScript,
|
|
158
|
+
options: RunScriptOptions
|
|
159
|
+
): Promise<number> {
|
|
160
|
+
const { config } = await loadDeployConfig(cwd)
|
|
161
|
+
const { target } = config
|
|
162
|
+
if (!target.run) {
|
|
163
|
+
throw new SixbCliError(`[SixbRun] A ${target.kind} deployment cannot run scripts.`)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const status = await withTask("run", `Asking ${target.location}`, () =>
|
|
167
|
+
target.status({ name: config.name })
|
|
168
|
+
)
|
|
169
|
+
if (!status.release) {
|
|
170
|
+
throw new SixbCliError(
|
|
171
|
+
`[SixbRun] Nothing named ${config.name} is deployed on ${target.location} yet.`,
|
|
172
|
+
{ remediation: "Deploy it first: sixb deploy." }
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const deployed = status.release.commit
|
|
177
|
+
const head = await headCommit(cwd)
|
|
178
|
+
const question =
|
|
179
|
+
`Run ${tone.strong(script.path)} on ${tone.strong(config.name)} ${tone.muted(`(${target.kind} ${target.location})`)}?\n` +
|
|
180
|
+
tone.muted(
|
|
181
|
+
` Its imports resolve against the deployed ${deployed.slice(0, 12)}` +
|
|
182
|
+
(head && head !== deployed ? `; your HEAD is ${head.slice(0, 12)}.` : ".")
|
|
183
|
+
)
|
|
184
|
+
if (!(await confirm(question, options.yes === true))) {
|
|
185
|
+
say(tone.muted("Not run."))
|
|
186
|
+
return 1
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return target.run(
|
|
190
|
+
{
|
|
191
|
+
path: script.path,
|
|
192
|
+
source: new Uint8Array(await readFile(script.file)),
|
|
193
|
+
args: options.args,
|
|
194
|
+
},
|
|
195
|
+
{ name: config.name }
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** Asks before a deployed run. Without a terminal there is nobody to ask, so only `--yes` proceeds. */
|
|
200
|
+
async function confirm(question: string, yes: boolean): Promise<boolean> {
|
|
201
|
+
if (yes) return true
|
|
202
|
+
if (!process.stdin.isTTY) {
|
|
203
|
+
throw new SixbCliError("[SixbRun] Running on the deployment needs a yes.", {
|
|
204
|
+
remediation: "Pass --yes to run without being asked.",
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
say(question)
|
|
209
|
+
const prompt = createInterface({ input: process.stdin, output: process.stderr })
|
|
210
|
+
const answer = await prompt.question("Run it? [y/N] ").finally(() => prompt.close())
|
|
211
|
+
return answer.trim().toLowerCase() === "y"
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** On standard error, so a script run here has standard output to itself. */
|
|
215
|
+
function say(line: string): void {
|
|
216
|
+
process.stderr.write(`${line}\n`)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function seconds(started: number): string {
|
|
220
|
+
return `${((performance.now() - started) / 1000).toFixed(1)}s`
|
|
221
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -358,6 +358,20 @@ async function main(): Promise<void> {
|
|
|
358
358
|
break
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
case "run": {
|
|
362
|
+
const { runScriptCommand } = await import("./commands/run")
|
|
363
|
+
const [script = "", ...scriptArgs] = positionals
|
|
364
|
+
const exitCode = await runScriptCommand({
|
|
365
|
+
script,
|
|
366
|
+
args: scriptArgs,
|
|
367
|
+
entry: getFlag("entry"),
|
|
368
|
+
deployed: hasFlag("deployed"),
|
|
369
|
+
yes: hasFlag("yes"),
|
|
370
|
+
})
|
|
371
|
+
// Whatever the script left running, such as a timer or a socket, must not keep it alive.
|
|
372
|
+
return process.exit(exitCode)
|
|
373
|
+
}
|
|
374
|
+
|
|
361
375
|
case "db:prepare": {
|
|
362
376
|
const { runDbPrepare } = await import("./commands/db-prepare")
|
|
363
377
|
await runDbPrepare({ entry: getFlag("entry") })
|
package/src/lib/command-line.ts
CHANGED
|
@@ -126,7 +126,12 @@ export const CLI_OPTION_DEFINITIONS = {
|
|
|
126
126
|
},
|
|
127
127
|
yes: {
|
|
128
128
|
syntax: "--yes",
|
|
129
|
-
summary: "
|
|
129
|
+
summary: "Go ahead without asking: allow the folders named, or run on the deployment",
|
|
130
|
+
kind: "boolean",
|
|
131
|
+
},
|
|
132
|
+
deployed: {
|
|
133
|
+
syntax: "--deployed",
|
|
134
|
+
summary: "Run on the deployment sixb.deploy.ts describes",
|
|
130
135
|
kind: "boolean",
|
|
131
136
|
},
|
|
132
137
|
outdir: { syntax: "--outdir <path>", summary: "Build output directory", kind: "string" },
|
|
@@ -232,6 +237,7 @@ export type LocalCommandId =
|
|
|
232
237
|
| "worker"
|
|
233
238
|
| "worker-group"
|
|
234
239
|
| "check"
|
|
240
|
+
| "run"
|
|
235
241
|
| "typegen"
|
|
236
242
|
| "build"
|
|
237
243
|
| "desktop:build"
|
|
@@ -274,6 +280,8 @@ interface CommandNode {
|
|
|
274
280
|
readonly positional: number
|
|
275
281
|
}[]
|
|
276
282
|
readonly rootHelpLabel?: string
|
|
283
|
+
/** Everything after the first positional is a positional too, passed on untouched. */
|
|
284
|
+
readonly passthrough?: boolean
|
|
277
285
|
}
|
|
278
286
|
|
|
279
287
|
const CONNECTION_OPTIONS = ["api-url", "token", "profile"] as const
|
|
@@ -535,6 +543,14 @@ const commandTree: readonly CommandNode[] = [
|
|
|
535
543
|
rootHelpLabel: "worker-group [types...]",
|
|
536
544
|
}),
|
|
537
545
|
command("check", "Validate project configuration and health", { options: ["entry"] }),
|
|
546
|
+
command("run", "Run a script against the project, here or in production", {
|
|
547
|
+
usage: "sixb run [--deployed] [--yes] [--entry <path>] <script> [args...]",
|
|
548
|
+
options: ["entry", "deployed", "yes"],
|
|
549
|
+
minimumPositionals: 1,
|
|
550
|
+
maximumPositionals: Number.POSITIVE_INFINITY,
|
|
551
|
+
passthrough: true,
|
|
552
|
+
rootHelpLabel: "run <script>",
|
|
553
|
+
}),
|
|
538
554
|
command("typegen", "Generate ontology types for typed queries", { options: ["entry"] }),
|
|
539
555
|
command("build", "Build the runtime and the app for production", {
|
|
540
556
|
options: ["entry", "outdir"],
|
|
@@ -751,7 +767,7 @@ const ROOT_HELP_GROUP_COMMANDS: readonly {
|
|
|
751
767
|
readonly compact?: boolean
|
|
752
768
|
}[] = [
|
|
753
769
|
{ title: "Agent", names: ["agent", "connect"] },
|
|
754
|
-
{ title: "Develop", names: ["init", "dev", "env", "check", "typegen", "build"] },
|
|
770
|
+
{ title: "Develop", names: ["init", "dev", "env", "check", "run", "typegen", "build"] },
|
|
755
771
|
{ title: "Deploy", names: ["deploy", "desktop"] },
|
|
756
772
|
{
|
|
757
773
|
title: "Run in production",
|
|
@@ -865,6 +881,7 @@ function command(
|
|
|
865
881
|
readonly positional: number
|
|
866
882
|
}[]
|
|
867
883
|
readonly rootHelpLabel?: string
|
|
884
|
+
readonly passthrough?: boolean
|
|
868
885
|
} = {}
|
|
869
886
|
): CommandNode {
|
|
870
887
|
const path = input.path ?? [id]
|
|
@@ -879,6 +896,7 @@ function command(
|
|
|
879
896
|
maximumPositionals: input.maximumPositionals ?? 0,
|
|
880
897
|
requiredInputs: input.requiredInputs,
|
|
881
898
|
rootHelpLabel: input.rootHelpLabel ?? (path.length === 1 ? path[0] : undefined),
|
|
899
|
+
...(input.passthrough ? { passthrough: true } : {}),
|
|
882
900
|
}
|
|
883
901
|
}
|
|
884
902
|
|
|
@@ -923,13 +941,24 @@ function parseLocalCommand(root: CommandNode, args: readonly string[]): ParsedCl
|
|
|
923
941
|
|
|
924
942
|
if (!node.id) throw new Error(`[SixbCLI] Command '${path.join(" ")}' has no handler.`)
|
|
925
943
|
const remaining = args.slice(index)
|
|
926
|
-
if (requestsHelp(remaining)) {
|
|
944
|
+
if (requestsHelp(node.passthrough ? remaining.slice(0, firstPositional(remaining)) : remaining)) {
|
|
927
945
|
return { kind: "help", help: helpFor(node, path) }
|
|
928
946
|
}
|
|
929
947
|
const { options, positionals } = parseOptions(node, path, remaining)
|
|
930
948
|
return { kind: "command", id: node.id, path, positionals, options }
|
|
931
949
|
}
|
|
932
950
|
|
|
951
|
+
/** Where the first positional is, past options and the values they take. */
|
|
952
|
+
function firstPositional(args: readonly string[]): number {
|
|
953
|
+
for (let index = 0; index < args.length; index++) {
|
|
954
|
+
const argument = args[index] ?? ""
|
|
955
|
+
if (argument === "--" || !argument.startsWith("-")) return index
|
|
956
|
+
const definition = CLI_OPTION_DEFINITIONS[argument.slice(2) as CliOptionName]
|
|
957
|
+
if (definition?.kind === "string") index++
|
|
958
|
+
}
|
|
959
|
+
return args.length
|
|
960
|
+
}
|
|
961
|
+
|
|
933
962
|
function requestsHelp(args: readonly string[]): boolean {
|
|
934
963
|
const separator = args.indexOf("--")
|
|
935
964
|
const options = separator < 0 ? args : args.slice(0, separator)
|
|
@@ -950,12 +979,14 @@ function parseOptions(
|
|
|
950
979
|
for (let index = 0; index < args.length; index++) {
|
|
951
980
|
const argument = args[index]
|
|
952
981
|
if (argument === undefined) continue
|
|
953
|
-
|
|
982
|
+
// A script's own `--` is one of its arguments.
|
|
983
|
+
if (argument === "--" && !(node.passthrough && positionalOnly)) {
|
|
954
984
|
positionalOnly = true
|
|
955
985
|
continue
|
|
956
986
|
}
|
|
957
987
|
if (positionalOnly || !argument.startsWith("-")) {
|
|
958
988
|
positionals.push(argument)
|
|
989
|
+
if (node.passthrough) positionalOnly = true
|
|
959
990
|
continue
|
|
960
991
|
}
|
|
961
992
|
if (!argument.startsWith("--")) {
|
package/src/lib/deploy-source.ts
CHANGED
|
@@ -104,6 +104,11 @@ export function repoRootOf(projectDir: string): Promise<string> {
|
|
|
104
104
|
return git(projectDir, ["rev-parse", "--show-toplevel"])
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
/** The commit checked out where the project is, or null outside a git repository. */
|
|
108
|
+
export function headCommit(projectDir: string): Promise<string | null> {
|
|
109
|
+
return git(projectDir, ["rev-parse", "HEAD"]).catch(() => null)
|
|
110
|
+
}
|
|
111
|
+
|
|
107
112
|
/** Who deploys, recorded with the release. */
|
|
108
113
|
export async function deployer(projectDir: string): Promise<string> {
|
|
109
114
|
if (process.env.GITHUB_ACTIONS && process.env.GITHUB_ACTOR) {
|
package/src/lib/runtime.ts
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from "@sixb/orchestrator"
|
|
23
23
|
import { PipelineWorker } from "@sixb/pipeline-worker"
|
|
24
24
|
import { ProjectionWorker } from "@sixb/projection-worker"
|
|
25
|
+
import { RenderWorker } from "@sixb/render-worker"
|
|
25
26
|
import { RulesWorker } from "@sixb/rules-worker"
|
|
26
27
|
import { SyncWorker } from "@sixb/sync-worker"
|
|
27
28
|
import { WorkflowWorker } from "@sixb/workflow-worker"
|
|
@@ -29,7 +30,12 @@ import type { LoadedSixbHost } from "./loadSixb"
|
|
|
29
30
|
import { configuredOrigin } from "./public-origin"
|
|
30
31
|
import { stopQuietly } from "./role-lifecycle"
|
|
31
32
|
import type { WorkerConcurrency } from "./worker-registry"
|
|
32
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
agentRuntimeRequired,
|
|
35
|
+
agentWorkerRequired,
|
|
36
|
+
lakeWorkerRequired,
|
|
37
|
+
renderWorkerRequired,
|
|
38
|
+
} from "./worker-registry"
|
|
33
39
|
|
|
34
40
|
export function waitForWorkerFailure(worker: Worker | null | undefined): Promise<never> {
|
|
35
41
|
return new Promise<never>((_resolve, reject) => {
|
|
@@ -45,6 +51,7 @@ export interface RunningSixbRuntime {
|
|
|
45
51
|
readonly rulesWorker: RulesWorker | null
|
|
46
52
|
readonly syncWorker: SyncWorker | null
|
|
47
53
|
readonly lakeWorker: LakeWorker | null
|
|
54
|
+
readonly renderWorker: RenderWorker | null
|
|
48
55
|
readonly agentWorker: AgentWorker | null
|
|
49
56
|
readonly projectionWorker: ProjectionWorker | null
|
|
50
57
|
readonly pipelineWorker: PipelineWorker | null
|
|
@@ -244,7 +251,7 @@ function hasRecoverableRuns({ definitions }: LoadedSixbHost): boolean {
|
|
|
244
251
|
* 3. PipelineWorker (claims from queues)
|
|
245
252
|
* 4. WorkflowWorker (claims from queues)
|
|
246
253
|
* 5. SyncWorker (claims from queues)
|
|
247
|
-
* 6. LakeWorker (
|
|
254
|
+
* 6. LakeWorker and RenderWorker (claim from queues)
|
|
248
255
|
* 7. Orchestrator (subscribes to events, enqueues jobs, runs cron and the maintenance loop)
|
|
249
256
|
* 8. API server, when this process serves it
|
|
250
257
|
* 9. AgentWorker (claims from queues; its turns call the API)
|
|
@@ -253,7 +260,7 @@ function hasRecoverableRuns({ definitions }: LoadedSixbHost): boolean {
|
|
|
253
260
|
* 1. AgentWorker (ends its turns while the API still answers them)
|
|
254
261
|
* 2. API server
|
|
255
262
|
* 3. Orchestrator (stops cron, drains pending dispatches)
|
|
256
|
-
* 4. LakeWorker
|
|
263
|
+
* 4. RenderWorker and LakeWorker
|
|
257
264
|
* 5. SyncWorker
|
|
258
265
|
* 6. WorkflowWorker
|
|
259
266
|
* 7. PipelineWorker
|
|
@@ -270,6 +277,7 @@ export async function startSixbRuntime(
|
|
|
270
277
|
let rulesWorker: RulesWorker | null = null
|
|
271
278
|
let syncWorker: SyncWorker | null = null
|
|
272
279
|
let lakeWorker: LakeWorker | null = null
|
|
280
|
+
let renderWorker: RenderWorker | null = null
|
|
273
281
|
let agentWorker: AgentWorker | null = null
|
|
274
282
|
let pipelineWorker: PipelineWorker | null = null
|
|
275
283
|
let workflowWorker: WorkflowWorker | null = null
|
|
@@ -281,6 +289,7 @@ export async function startSixbRuntime(
|
|
|
281
289
|
await stopQuietly(() => agentWorker?.stop() ?? Promise.resolve())
|
|
282
290
|
await stopQuietly(() => options.api?.stop() ?? Promise.resolve())
|
|
283
291
|
await stopQuietly(() => orchestratorRuntime?.stop() ?? Promise.resolve())
|
|
292
|
+
await stopQuietly(() => renderWorker?.stop() ?? Promise.resolve())
|
|
284
293
|
await stopQuietly(() => lakeWorker?.stop() ?? Promise.resolve())
|
|
285
294
|
await stopQuietly(() => syncWorker?.stop() ?? Promise.resolve())
|
|
286
295
|
await stopQuietly(() => workflowWorker?.stop() ?? Promise.resolve())
|
|
@@ -344,6 +353,11 @@ export async function startSixbRuntime(
|
|
|
344
353
|
await lakeWorker.start()
|
|
345
354
|
}
|
|
346
355
|
|
|
356
|
+
if (renderWorkerRequired(sixb)) {
|
|
357
|
+
renderWorker = new RenderWorker(sixb, { concurrency: options.workerConcurrency?.render })
|
|
358
|
+
await renderWorker.start()
|
|
359
|
+
}
|
|
360
|
+
|
|
347
361
|
orchestratorRuntime = await startOrchestratorRuntime(sixb)
|
|
348
362
|
orchestratorWorker = orchestratorRuntime.orchestratorWorker
|
|
349
363
|
warnings.push(...orchestratorRuntime.warnings)
|
|
@@ -361,6 +375,7 @@ export async function startSixbRuntime(
|
|
|
361
375
|
if (rulesWorker) workers.push(rulesWorker)
|
|
362
376
|
if (syncWorker) workers.push(syncWorker)
|
|
363
377
|
if (lakeWorker) workers.push(lakeWorker)
|
|
378
|
+
if (renderWorker) workers.push(renderWorker)
|
|
364
379
|
if (agentWorker) workers.push(agentWorker)
|
|
365
380
|
if (projectionWorker) workers.push(projectionWorker)
|
|
366
381
|
if (pipelineWorker) workers.push(pipelineWorker)
|
|
@@ -373,6 +388,7 @@ export async function startSixbRuntime(
|
|
|
373
388
|
rulesWorker,
|
|
374
389
|
syncWorker,
|
|
375
390
|
lakeWorker,
|
|
391
|
+
renderWorker,
|
|
376
392
|
agentWorker,
|
|
377
393
|
projectionWorker,
|
|
378
394
|
pipelineWorker,
|
|
@@ -8,6 +8,7 @@ const ENVIRONMENT_VARIABLES = {
|
|
|
8
8
|
projection: "SIXB_PROJECTION_WORKER_CONCURRENCY",
|
|
9
9
|
workflow: "SIXB_WORKFLOW_WORKER_CONCURRENCY",
|
|
10
10
|
lake: "SIXB_LAKE_WORKER_CONCURRENCY",
|
|
11
|
+
render: "SIXB_RENDER_WORKER_CONCURRENCY",
|
|
11
12
|
} as const satisfies Record<WorkerType, string>
|
|
12
13
|
|
|
13
14
|
/** Resolve the scalar concurrency accepted by `sixb worker <type>`. */
|
|
@@ -4,13 +4,22 @@ import type { Worker } from "@sixb/core/internal/workers"
|
|
|
4
4
|
import { LakeWorker } from "@sixb/lake-worker"
|
|
5
5
|
import { PipelineWorker } from "@sixb/pipeline-worker"
|
|
6
6
|
import { ProjectionWorker } from "@sixb/projection-worker"
|
|
7
|
+
import { RenderWorker } from "@sixb/render-worker"
|
|
7
8
|
import { SyncWorker } from "@sixb/sync-worker"
|
|
8
9
|
import { WorkflowWorker } from "@sixb/workflow-worker"
|
|
9
10
|
import { SixbCliError } from "./errors"
|
|
10
11
|
import type { LoadedSixbHost } from "./loadSixb"
|
|
11
12
|
import { configuredOrigin } from "./public-origin"
|
|
12
13
|
|
|
13
|
-
export const WORKER_TYPES = [
|
|
14
|
+
export const WORKER_TYPES = [
|
|
15
|
+
"sync",
|
|
16
|
+
"agent",
|
|
17
|
+
"pipeline",
|
|
18
|
+
"projection",
|
|
19
|
+
"workflow",
|
|
20
|
+
"lake",
|
|
21
|
+
"render",
|
|
22
|
+
] as const
|
|
14
23
|
|
|
15
24
|
export type WorkerType = (typeof WORKER_TYPES)[number]
|
|
16
25
|
|
|
@@ -80,6 +89,10 @@ const workerFactories: Record<WorkerType, WorkerFactory> = {
|
|
|
80
89
|
create: (sixb, options) =>
|
|
81
90
|
new LakeWorker(sixb, { concurrency: options.workerConcurrency?.lake }),
|
|
82
91
|
},
|
|
92
|
+
render: {
|
|
93
|
+
create: (sixb, options) =>
|
|
94
|
+
new RenderWorker(sixb, { concurrency: options.workerConcurrency?.render }),
|
|
95
|
+
},
|
|
83
96
|
}
|
|
84
97
|
|
|
85
98
|
export function createWorkerForType(
|
|
@@ -207,6 +220,10 @@ export function resolveRegisteredWorkerTypes(sixb: LoadedSixbHost): readonly Wor
|
|
|
207
220
|
workerTypes.push("lake")
|
|
208
221
|
}
|
|
209
222
|
|
|
223
|
+
if (renderWorkerRequired(sixb)) {
|
|
224
|
+
workerTypes.push("render")
|
|
225
|
+
}
|
|
226
|
+
|
|
210
227
|
return workerTypes
|
|
211
228
|
}
|
|
212
229
|
|
|
@@ -234,24 +251,34 @@ export function lakeWorkerRequired(sixb: LoadedSixbHost): boolean {
|
|
|
234
251
|
return getLakeRetentionRuntime(sixb).automatic || getDatasetIngestRuntime(sixb).enabled
|
|
235
252
|
}
|
|
236
253
|
|
|
254
|
+
/** Renders run in the project's sandboxes, so a project with none asks for none. */
|
|
255
|
+
export function renderWorkerRequired(sixb: LoadedSixbHost): boolean {
|
|
256
|
+
return sixb.sandboxes !== undefined
|
|
257
|
+
}
|
|
258
|
+
|
|
237
259
|
/** Requests stay queued while no worker claims them, which looks like an idle system. */
|
|
238
260
|
export function omittedWorkerWarnings(
|
|
239
261
|
sixb: LoadedSixbHost,
|
|
240
262
|
workerTypes: readonly string[]
|
|
241
263
|
): readonly string[] {
|
|
242
|
-
|
|
264
|
+
const omitted = (workerType: WorkerType) => !workerTypes.includes(workerType)
|
|
243
265
|
|
|
244
266
|
return [
|
|
245
|
-
...(getLakeRetentionRuntime(sixb).automatic
|
|
267
|
+
...(omitted("lake") && getLakeRetentionRuntime(sixb).automatic
|
|
246
268
|
? [
|
|
247
269
|
"Lake cleanup needs a lake worker and this group has none: run `sixb worker lake`, or the lake keeps growing.",
|
|
248
270
|
]
|
|
249
271
|
: []),
|
|
250
|
-
...(getDatasetIngestRuntime(sixb).enabled
|
|
272
|
+
...(omitted("lake") && getDatasetIngestRuntime(sixb).enabled
|
|
251
273
|
? [
|
|
252
274
|
"Ingested changes need a lake worker and this group has none: run `sixb worker lake`, or they wait and never reach their dataset.",
|
|
253
275
|
]
|
|
254
276
|
: []),
|
|
277
|
+
...(omitted("render") && renderWorkerRequired(sixb)
|
|
278
|
+
? [
|
|
279
|
+
"Documents print to PDF in a render worker and this group has none: run `sixb worker render`, or a PDF someone asks for never prints.",
|
|
280
|
+
]
|
|
281
|
+
: []),
|
|
255
282
|
]
|
|
256
283
|
}
|
|
257
284
|
|
package/src/tui/app.tsx
CHANGED
|
@@ -667,7 +667,7 @@ function Home(
|
|
|
667
667
|
},
|
|
668
668
|
throwOnError: true,
|
|
669
669
|
})
|
|
670
|
-
if (created.thread.runsOn === "computer") void runner.claim(posted.run.id)
|
|
670
|
+
if (created.thread.runsOn === "computer" && posted.run) void runner.claim(posted.run.id)
|
|
671
671
|
props.onOpen(created.thread.id)
|
|
672
672
|
return true
|
|
673
673
|
} catch (error) {
|
|
@@ -1006,10 +1006,6 @@ function ThreadView(
|
|
|
1006
1006
|
props.say("It works in another folder: press ctrl+f to move it here first.")
|
|
1007
1007
|
return false
|
|
1008
1008
|
}
|
|
1009
|
-
if (activeRunId) {
|
|
1010
|
-
props.say("The agent is still working. Press esc twice to stop it.")
|
|
1011
|
-
return false
|
|
1012
|
-
}
|
|
1013
1009
|
const { data, error } = await postAgentThreadMessage({
|
|
1014
1010
|
client,
|
|
1015
1011
|
path: { threadId },
|
|
@@ -1021,12 +1017,19 @@ function ThreadView(
|
|
|
1021
1017
|
: {}),
|
|
1022
1018
|
...requesterSettings(),
|
|
1023
1019
|
...messageSelection(models, settings),
|
|
1020
|
+
// Enter steers the turn that runs; a message it cannot steer is refused with why.
|
|
1021
|
+
...(activeRunId ? { delivery: "steer" as const } : {}),
|
|
1024
1022
|
},
|
|
1025
1023
|
})
|
|
1026
1024
|
if (error || !data) {
|
|
1027
1025
|
props.say(errorText(error), "error")
|
|
1028
1026
|
return false
|
|
1029
1027
|
}
|
|
1028
|
+
// A message sent while a turn runs waits in the thread's inbox instead of starting one.
|
|
1029
|
+
if (!data.run) {
|
|
1030
|
+
void reload()
|
|
1031
|
+
return true
|
|
1032
|
+
}
|
|
1030
1033
|
if (runsHere) void runner.claim(data.run.id)
|
|
1031
1034
|
setLive(liveRun(data.run.id))
|
|
1032
1035
|
void reload()
|
package/src/tui/format.ts
CHANGED
|
@@ -17,16 +17,22 @@ export interface ToolLine {
|
|
|
17
17
|
readonly command?: string
|
|
18
18
|
/** The preview is diff lines, `+` added and `-` removed, colored as such. */
|
|
19
19
|
readonly diff?: boolean
|
|
20
|
+
/** The preview rows start with paths, shown as the person reads them. */
|
|
21
|
+
readonly paths?: boolean
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
const PREVIEW_LINES = 4
|
|
23
25
|
|
|
24
26
|
const NO_OUTCOMES: ReadonlyMap<string, ApprovalOutcome> = new Map()
|
|
25
27
|
|
|
26
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* `outcomes` says how the held calls ended, by approval id: a decided call is no longer held.
|
|
30
|
+
* `folder` is the one a computer's turns work in: a search names where it looked relative to it.
|
|
31
|
+
*/
|
|
27
32
|
export function toolLine(
|
|
28
33
|
part: ToolPart,
|
|
29
|
-
outcomes: ReadonlyMap<string, ApprovalOutcome> = NO_OUTCOMES
|
|
34
|
+
outcomes: ReadonlyMap<string, ApprovalOutcome> = NO_OUTCOMES,
|
|
35
|
+
folder?: string
|
|
30
36
|
): ToolLine {
|
|
31
37
|
const input = record(part.input) ?? partialInput(part.inputText)
|
|
32
38
|
const output = record(part.output)
|
|
@@ -167,6 +173,71 @@ export function toolLine(
|
|
|
167
173
|
...error,
|
|
168
174
|
}
|
|
169
175
|
}
|
|
176
|
+
case "glob": {
|
|
177
|
+
const files = Array.isArray(output?.files) ? output.files.map(text) : undefined
|
|
178
|
+
const found = files?.length ?? 0
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
verb: "glob",
|
|
182
|
+
detail: searchDetail(input, text(input?.pattern), folder),
|
|
183
|
+
...(files
|
|
184
|
+
? {
|
|
185
|
+
note: searchNote(
|
|
186
|
+
output,
|
|
187
|
+
found === 0
|
|
188
|
+
? "no files"
|
|
189
|
+
: output?.truncated === true
|
|
190
|
+
? `${found}+ files`
|
|
191
|
+
: plural(found, "file")
|
|
192
|
+
),
|
|
193
|
+
...(found > 0 ? { preview: limitedRows(files, "file", "files"), paths: true } : {}),
|
|
194
|
+
}
|
|
195
|
+
: {}),
|
|
196
|
+
...error,
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
case "grep": {
|
|
200
|
+
const matches = Array.isArray(output?.matches) ? output.matches.map(record) : undefined
|
|
201
|
+
const shown = matches?.length ?? 0
|
|
202
|
+
const counted = Object.values(record(output?.more) ?? {}).filter(
|
|
203
|
+
(count): count is number => typeof count === "number"
|
|
204
|
+
)
|
|
205
|
+
const total = counted.reduce((sum, count) => sum + count, shown)
|
|
206
|
+
|
|
207
|
+
const files = typeof output?.files === "number" ? output.files : 0
|
|
208
|
+
const found = `${total} ${total === 1 ? "match" : "matches"}`
|
|
209
|
+
|
|
210
|
+
return {
|
|
211
|
+
verb: "grep",
|
|
212
|
+
detail: searchDetail(input, input?.pattern ? `"${text(input.pattern)}"` : "", folder),
|
|
213
|
+
...(matches
|
|
214
|
+
? {
|
|
215
|
+
note: searchNote(
|
|
216
|
+
output,
|
|
217
|
+
total === 0
|
|
218
|
+
? "no matches"
|
|
219
|
+
: output?.truncated === true
|
|
220
|
+
? `${total}+ matches`
|
|
221
|
+
: `${found} in ${plural(files, "file")}`
|
|
222
|
+
),
|
|
223
|
+
...(shown > 0
|
|
224
|
+
? {
|
|
225
|
+
preview: limitedRows(
|
|
226
|
+
matches.map(
|
|
227
|
+
(match) => `${text(match?.path)}:${match?.line} ${text(match?.text).trim()}`
|
|
228
|
+
),
|
|
229
|
+
"match",
|
|
230
|
+
"matches",
|
|
231
|
+
total
|
|
232
|
+
),
|
|
233
|
+
paths: true,
|
|
234
|
+
}
|
|
235
|
+
: {}),
|
|
236
|
+
}
|
|
237
|
+
: {}),
|
|
238
|
+
...error,
|
|
239
|
+
}
|
|
240
|
+
}
|
|
170
241
|
// Earlier threads hold calls to it.
|
|
171
242
|
case "view_file":
|
|
172
243
|
return { verb: "view", detail: text(input?.path), ...error }
|
|
@@ -435,11 +506,16 @@ function partialInput(inputText: string | undefined): Record<string, unknown> |
|
|
|
435
506
|
try {
|
|
436
507
|
return record(JSON.parse(inputText))
|
|
437
508
|
} catch {
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
509
|
+
const found = /"(command|path|task|key|query|url|pattern)"\s*:\s*"((?:[^"\\]|\\.)*)/.exec(
|
|
510
|
+
inputText
|
|
511
|
+
)
|
|
512
|
+
const [, key, value] = found ?? []
|
|
513
|
+
if (value === undefined) return undefined
|
|
514
|
+
|
|
515
|
+
// A search's pattern is only its pattern: it is no path its line would say it looked in.
|
|
516
|
+
if (key === "pattern") return { pattern: value }
|
|
517
|
+
|
|
518
|
+
return { command: value, path: value, task: value, query: value, url: value }
|
|
443
519
|
}
|
|
444
520
|
}
|
|
445
521
|
|
|
@@ -513,6 +589,55 @@ function limited(rows: readonly string[]): string[] {
|
|
|
513
589
|
: [...rows]
|
|
514
590
|
}
|
|
515
591
|
|
|
592
|
+
/**
|
|
593
|
+
* The first rows, then the rest counted by what they are: `… 8 more files`. `total` counts what
|
|
594
|
+
* the rows stand for when some were never listed, as a file's matches past the ones grep shows.
|
|
595
|
+
*/
|
|
596
|
+
function limitedRows(
|
|
597
|
+
rows: readonly string[],
|
|
598
|
+
one: string,
|
|
599
|
+
many: string,
|
|
600
|
+
total = rows.length
|
|
601
|
+
): string[] {
|
|
602
|
+
const shown = rows.slice(0, PREVIEW_LINES)
|
|
603
|
+
const left = total - shown.length
|
|
604
|
+
return left > 0 ? [...shown, `… ${left} more ${left === 1 ? one : many}`] : shown
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* A search as the call wrote it: its pattern, the files it was limited to, and where it looked, as
|
|
609
|
+
* the person reads it. The folder the agent works in goes unsaid, however the call named it.
|
|
610
|
+
*/
|
|
611
|
+
function searchDetail(
|
|
612
|
+
input: Record<string, unknown> | undefined,
|
|
613
|
+
pattern: string,
|
|
614
|
+
folder: string | undefined
|
|
615
|
+
): string {
|
|
616
|
+
const path = givenText(input?.path)
|
|
617
|
+
const include = givenText(input?.include)
|
|
618
|
+
const place = path.replace(/(.)\/+$/, "$1")
|
|
619
|
+
const working =
|
|
620
|
+
place === "." ||
|
|
621
|
+
(folder !== undefined && [folder, folder.replace(/^\/private/, "")].includes(place))
|
|
622
|
+
|
|
623
|
+
return [
|
|
624
|
+
...(pattern ? [pattern] : []),
|
|
625
|
+
...(include ? [include] : []),
|
|
626
|
+
...(path && !working ? [`in ${friendlyPath(path, folder)}`] : []),
|
|
627
|
+
].join(" ")
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/** What a search found, and that it stopped early when it did. */
|
|
631
|
+
function searchNote(output: Record<string, unknown> | undefined, found: string): string {
|
|
632
|
+
return output?.incomplete === true ? `${found} · stopped early` : found
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/** A string the call gave: models send `"null"` and `"undefined"` for nothing. */
|
|
636
|
+
function givenText(value: unknown): string {
|
|
637
|
+
const given = text(value).trim()
|
|
638
|
+
return given === "null" || given === "undefined" ? "" : given
|
|
639
|
+
}
|
|
640
|
+
|
|
516
641
|
function lines(value: string): string[] {
|
|
517
642
|
const all = value.replace(/\s+$/, "").split("\n")
|
|
518
643
|
return all.length > PREVIEW_LINES
|
package/src/tui/transcript.tsx
CHANGED
|
@@ -221,7 +221,7 @@ function AgentParts({
|
|
|
221
221
|
<ToolRow
|
|
222
222
|
key={key}
|
|
223
223
|
colors={colors}
|
|
224
|
-
line={shownLine(toolLine(part, outcomes), folder)}
|
|
224
|
+
line={shownLine(toolLine(part, outcomes, folder), folder)}
|
|
225
225
|
state={part.state}
|
|
226
226
|
width={width}
|
|
227
227
|
/>
|
|
@@ -613,6 +613,9 @@ function shownLine(line: ToolLine, folder?: string): ToolLine {
|
|
|
613
613
|
...line,
|
|
614
614
|
detail: friendlyPath(line.detail, folder),
|
|
615
615
|
...(line.command === undefined ? {} : { command: friendlyPath(line.command, folder) }),
|
|
616
|
+
...(line.paths && line.preview
|
|
617
|
+
? { preview: line.preview.map((row) => friendlyPath(row, folder)) }
|
|
618
|
+
: {}),
|
|
616
619
|
}
|
|
617
620
|
}
|
|
618
621
|
|