@sixb/cli 0.2.1 → 0.2.3
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 +25 -22
- package/dist/commands/access-token-utils.d.ts.map +1 -1
- package/dist/commands/agent.d.ts +4 -1
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/connect.d.ts +13 -0
- package/dist/commands/connect.d.ts.map +1 -0
- package/dist/commands/db-migrate.d.ts.map +1 -1
- package/dist/commands/db-prepare.d.ts.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/desktop.d.ts.map +1 -1
- package/dist/commands/dev-runner.d.ts.map +1 -1
- package/dist/commands/env.d.ts +6 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/lake-cleanup.d.ts +2 -12
- package/dist/commands/lake-cleanup.d.ts.map +1 -1
- package/dist/commands/lake-rejected.d.ts +10 -0
- package/dist/commands/lake-rejected.d.ts.map +1 -0
- package/dist/commands/orchestrator.d.ts.map +1 -1
- package/dist/commands/scheduler.d.ts +2 -5
- package/dist/commands/scheduler.d.ts.map +1 -1
- package/dist/commands/worker-group.d.ts.map +1 -1
- package/dist/lib/command-line.d.ts +22 -7
- package/dist/lib/command-line.d.ts.map +1 -1
- package/dist/{tui → lib}/connection.d.ts +11 -1
- package/dist/{tui → lib}/connection.d.ts.map +1 -1
- package/dist/lib/deploy-release.d.ts +7 -1
- package/dist/lib/deploy-release.d.ts.map +1 -1
- package/dist/lib/desktop.d.ts +4 -0
- package/dist/lib/desktop.d.ts.map +1 -1
- package/dist/lib/dev-supervisor.d.ts.map +1 -1
- package/dist/lib/duration.d.ts +3 -0
- package/dist/lib/duration.d.ts.map +1 -0
- package/dist/lib/loadSixb.d.ts.map +1 -1
- package/dist/lib/production-roles.d.ts +0 -4
- package/dist/lib/production-roles.d.ts.map +1 -1
- package/dist/lib/profiles.d.ts +5 -0
- package/dist/lib/profiles.d.ts.map +1 -1
- package/dist/lib/runtime.d.ts +7 -9
- 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 +4 -1
- package/dist/lib/worker-registry.d.ts.map +1 -1
- package/dist/runner/allowed-folders.d.ts +17 -0
- package/dist/runner/allowed-folders.d.ts.map +1 -0
- package/dist/runner/computer-connection.d.ts +70 -0
- package/dist/runner/computer-connection.d.ts.map +1 -0
- package/dist/runner/computer.d.ts.map +1 -0
- package/dist/runner/desktop-runner-main.d.ts +2 -0
- package/dist/runner/desktop-runner-main.d.ts.map +1 -0
- package/dist/runner/desktop-runner.d.ts +43 -0
- package/dist/runner/desktop-runner.d.ts.map +1 -0
- package/dist/runner/keep-awake.d.ts +11 -0
- package/dist/runner/keep-awake.d.ts.map +1 -0
- package/dist/runner/local-runner.d.ts +131 -0
- package/dist/runner/local-runner.d.ts.map +1 -0
- package/dist/tui/app.d.ts +2 -2
- package/dist/tui/app.d.ts.map +1 -1
- package/dist/tui/format.d.ts +29 -0
- package/dist/tui/format.d.ts.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/settings.d.ts +5 -8
- package/dist/tui/settings.d.ts.map +1 -1
- package/dist/ui/deploy-screens.d.ts +4 -2
- package/dist/ui/deploy-screens.d.ts.map +1 -1
- package/dist/ui/env-screens.d.ts +14 -1
- package/dist/ui/env-screens.d.ts.map +1 -1
- package/dist/ui/screens.d.ts +5 -11
- package/dist/ui/screens.d.ts.map +1 -1
- package/package.json +21 -17
- package/src/commands/access-token-utils.ts +2 -20
- package/src/commands/agent.ts +122 -39
- package/src/commands/api.ts +7 -0
- package/src/commands/check.ts +75 -1
- package/src/commands/connect.ts +197 -0
- package/src/commands/db-migrate.ts +1 -0
- package/src/commands/db-prepare.ts +1 -0
- package/src/commands/deploy.ts +15 -3
- package/src/commands/desktop.ts +2 -1
- package/src/commands/dev-runner.ts +5 -0
- package/src/commands/env.ts +99 -20
- package/src/commands/lake-cleanup.ts +25 -48
- package/src/commands/lake-rejected.ts +36 -0
- package/src/commands/orchestrator.ts +2 -7
- package/src/commands/scheduler.ts +11 -61
- package/src/commands/worker-group.ts +6 -3
- package/src/index.tsx +23 -4
- package/src/lib/command-line.ts +47 -15
- package/src/{tui → lib}/connection.ts +64 -17
- package/src/lib/deploy-release.ts +42 -2
- package/src/lib/desktop.ts +8 -1
- package/src/lib/dev-supervisor.ts +7 -2
- package/src/lib/duration.ts +11 -0
- package/src/lib/loadSixb.ts +3 -4
- package/src/lib/production-roles.ts +0 -1
- package/src/lib/profiles.ts +15 -1
- package/src/lib/runtime.ts +63 -43
- package/src/lib/shareable-providers.ts +2 -2
- package/src/lib/storage-migration.ts +1 -0
- package/src/lib/worker-concurrency.ts +1 -0
- package/src/lib/worker-registry.ts +36 -1
- package/src/runner/allowed-folders.ts +126 -0
- package/src/runner/computer-connection.ts +184 -0
- package/src/runner/desktop-runner-main.ts +9 -0
- package/src/runner/desktop-runner.ts +217 -0
- package/src/runner/keep-awake.ts +50 -0
- package/src/runner/local-runner.ts +427 -0
- package/src/tui/app.tsx +168 -12
- package/src/tui/format.ts +213 -7
- package/src/tui/index.tsx +14 -13
- package/src/tui/settings.ts +12 -44
- package/src/ui/deploy-screens.ts +8 -1
- package/src/ui/env-screens.ts +39 -5
- package/src/ui/screens.ts +21 -20
- package/dist/tui/computer.d.ts.map +0 -1
- package/dist/tui/runner.d.ts +0 -75
- package/dist/tui/runner.d.ts.map +0 -1
- package/src/tui/runner.ts +0 -256
- /package/dist/{tui → runner}/computer.d.ts +0 -0
- /package/src/{tui → runner}/computer.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-screens.d.ts","sourceRoot":"","sources":["../../src/ui/env-screens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAI7C,wBAAgB,aAAa,C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ist/ui/screens.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LakeRetentionReport } from "@sixb/core/lake-storage";
|
|
1
2
|
import { type CliHelp } from "../lib/command-line";
|
|
2
3
|
export type KeyValueItem = {
|
|
3
4
|
label: string;
|
|
@@ -114,18 +115,11 @@ export declare function lakeCheckView({ projectId, warnings, }: {
|
|
|
114
115
|
projectId: string;
|
|
115
116
|
warnings?: readonly string[];
|
|
116
117
|
}): string;
|
|
117
|
-
export
|
|
118
|
-
readonly dryRun: boolean;
|
|
119
|
-
readonly expireOlderThan: string;
|
|
120
|
-
readonly deleteOlderThan: string;
|
|
121
|
-
readonly snapshots: number;
|
|
122
|
-
readonly keptSnapshots?: number;
|
|
123
|
-
readonly oldFiles: number;
|
|
124
|
-
readonly orphanedFiles: number;
|
|
125
|
-
}
|
|
126
|
-
export declare function lakeCleanupView({ projectId, report, }: {
|
|
118
|
+
export declare function lakeCleanupView({ projectId, keepVersionsFor, deleteFilesAfter, report, }: {
|
|
127
119
|
projectId: string;
|
|
128
|
-
|
|
120
|
+
keepVersionsFor: string;
|
|
121
|
+
deleteFilesAfter: string;
|
|
122
|
+
report: LakeRetentionReport;
|
|
129
123
|
}): string;
|
|
130
124
|
export declare function initView({ name, files, commands: next, }: {
|
|
131
125
|
name: string;
|
package/dist/ui/screens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screens.d.ts","sourceRoot":"","sources":["../../src/ui/screens.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EAIb,MAAM,qBAAqB,CAAA;AAyB5B,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAwC3D,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,QAAQ,CAAC,EAAE,YAAY,EAAE,GAAE;IAAE,YAA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AM,CAyBT;AAED,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,KAAK,EACL,QAAQ,EAAE,IAAI,GACf,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAC5B,GAAG,MAAM,CAKT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixb/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Command-line interface for Sixb projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -25,33 +25,37 @@
|
|
|
25
25
|
"build": "bun ../../scripts/build-package.ts",
|
|
26
26
|
"typecheck": "tsc --noEmit",
|
|
27
27
|
"test": "bun test",
|
|
28
|
-
"test:e2e": "bun test ./tests/build.e2e.ts && bun test ./tests/prod-roles.e2e.ts && bun test ./tests/worker-group.e2e.ts && bun test ./tests/dev-reload.e2e.ts && bun test ./tests/pipeline-markings.e2e.ts",
|
|
28
|
+
"test:e2e": "bun test ./tests/build.e2e.ts && bun test ./tests/prod-roles.e2e.ts && bun test ./tests/worker-group.e2e.ts && bun test ./tests/ingest-roles.e2e.ts && bun test ./tests/dev-reload.e2e.ts && bun test ./tests/pipeline-markings.e2e.ts && bun test ./tests/run-recovery.e2e.ts && bun test ./tests/run-recovery-infra.e2e.ts && bun test ./tests/run-recovery-dev.e2e.ts && bun test ./tests/connect-signed-out.e2e.ts && bun test ./tests/desktop-runner.e2e.ts",
|
|
29
29
|
"prepack": "bun run build"
|
|
30
30
|
},
|
|
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.
|
|
39
|
-
"@sixb/cli-core": "^0.2.
|
|
40
|
-
"@sixb/
|
|
41
|
-
"@sixb/
|
|
42
|
-
"@sixb/
|
|
43
|
-
"@sixb/
|
|
34
|
+
"@sixb/agent": "0.2.3",
|
|
35
|
+
"@sixb/agent-worker": "0.2.3",
|
|
36
|
+
"@sixb/app": "^0.2.3",
|
|
37
|
+
"@sixb/client": "^0.2.3",
|
|
38
|
+
"@sixb/core": "0.2.3",
|
|
39
|
+
"@sixb/cli-core": "^0.2.3",
|
|
40
|
+
"@sixb/lake-worker": "0.2.3",
|
|
41
|
+
"@sixb/orchestrator": "0.2.3",
|
|
42
|
+
"@sixb/pipeline-worker": "0.2.3",
|
|
43
|
+
"@sixb/projection-worker": "0.2.3",
|
|
44
|
+
"@sixb/rules-worker": "0.2.3",
|
|
44
45
|
"@sixb/sandboxes-local": "^0.2.0",
|
|
45
|
-
"@sixb/server": "0.2.
|
|
46
|
-
"@sixb/sync-worker": "0.2.
|
|
47
|
-
"@sixb/workflow-worker": "0.2.
|
|
46
|
+
"@sixb/server": "0.2.3",
|
|
47
|
+
"@sixb/sync-worker": "0.2.3",
|
|
48
|
+
"@sixb/workflow-worker": "0.2.3",
|
|
48
49
|
"create-sixb": "^0.2.0",
|
|
49
50
|
"react": "^19.2.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@sixb/deploy-ssh": "0.2.0",
|
|
53
|
-
"@sixb/desktop": "0.2.
|
|
54
|
-
"@sixb/ducklake": "0.2.
|
|
54
|
+
"@sixb/desktop": "0.2.1",
|
|
55
|
+
"@sixb/ducklake": "0.2.3",
|
|
56
|
+
"@sixb/pg": "0.2.3",
|
|
57
|
+
"@sixb/queues-bullmq": "0.2.3",
|
|
58
|
+
"@sixb/sqlite": "0.2.3",
|
|
55
59
|
"@types/bun": "latest",
|
|
56
60
|
"@types/react": "^19.0.0",
|
|
57
61
|
"typescript": "^5.7.0"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SixbApiClientConfig } from "../lib/api-client"
|
|
2
|
+
import { parseDurationMs } from "../lib/duration"
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The API creates tokens only for a signed-in session, never for another access token, so say how
|
|
@@ -25,7 +26,7 @@ export function resolveExpiration(options: ExpirationOptions): string {
|
|
|
25
26
|
return date.toISOString()
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
const duration = parseDurationMs(options.expiresIn ?? "90d")
|
|
29
|
+
const duration = parseDurationMs(options.expiresIn ?? "90d", "--expires-in")
|
|
29
30
|
return new Date(Date.now() + duration).toISOString()
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -55,22 +56,3 @@ export function formatDate(value: string | undefined): string {
|
|
|
55
56
|
if (Number.isNaN(date.getTime())) return value
|
|
56
57
|
return date.toISOString().replace("T", " ").slice(0, 16)
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
function parseDurationMs(value: string): number {
|
|
60
|
-
const match = value.trim().match(/^(\d+)(m|h|d|w|y)$/)
|
|
61
|
-
if (!match) {
|
|
62
|
-
throw new Error("[SixbCLI] Use --expires-in like 30d, 12h, 4w, or 1y.")
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const amount = Number(match[1])
|
|
66
|
-
const unit = match[2]
|
|
67
|
-
const multipliers = {
|
|
68
|
-
m: 60_000,
|
|
69
|
-
h: 60 * 60_000,
|
|
70
|
-
d: 24 * 60 * 60_000,
|
|
71
|
-
w: 7 * 24 * 60 * 60_000,
|
|
72
|
-
y: 365 * 24 * 60 * 60_000,
|
|
73
|
-
} as const
|
|
74
|
-
|
|
75
|
-
return amount * multipliers[unit as keyof typeof multipliers]
|
|
76
|
-
}
|
package/src/commands/agent.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
createAgentRunSocket,
|
|
6
6
|
createAgentThread,
|
|
7
7
|
decideAgentApproval,
|
|
8
|
+
getAgentRun,
|
|
8
9
|
getAgentThread,
|
|
9
10
|
listAgentThreadApprovals,
|
|
10
11
|
listAgentThreadMessages,
|
|
@@ -12,11 +13,12 @@ import {
|
|
|
12
13
|
listModels,
|
|
13
14
|
postAgentThreadMessage,
|
|
14
15
|
} from "@sixb/client"
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
16
|
+
import { type Connection, connect } from "../lib/connection"
|
|
17
|
+
import { errorMessage } from "../lib/errors"
|
|
18
|
+
import { thisComputer, thisComputerId } from "../runner/computer"
|
|
19
|
+
import { LocalRunner } from "../runner/local-runner"
|
|
17
20
|
import { toolLine } from "../tui/format"
|
|
18
21
|
import { liveRun, reduceLive, shownMessage } from "../tui/parts"
|
|
19
|
-
import { LocalRunner } from "../tui/runner"
|
|
20
22
|
import {
|
|
21
23
|
APPROVAL_MODES,
|
|
22
24
|
type ApprovalMode,
|
|
@@ -29,11 +31,16 @@ import { glyph, paint, palette, tone } from "../ui/theme"
|
|
|
29
31
|
|
|
30
32
|
/** Exit status when the turn stopped on calls only the person can decide, and nobody could ask. */
|
|
31
33
|
const EXIT_WAITING = 4
|
|
34
|
+
/** Exit status when the turn waits for a computer that isn't connected. */
|
|
35
|
+
const EXIT_OFFLINE = 5
|
|
36
|
+
/** How often this checks that something still holds the folder of a turn it waits for. */
|
|
37
|
+
const HOLDER_CHECK_MS = 1_000
|
|
32
38
|
|
|
33
39
|
/**
|
|
34
40
|
* `sixb agent "<message>"`: one message to the agent, answered in the terminal. The turn runs on
|
|
35
41
|
* this computer in the current folder, or in the cloud with `--cloud`; its steps go to stderr and
|
|
36
|
-
* its answer to stdout, so the answer can be piped.
|
|
42
|
+
* its answer to stdout, so the answer can be piped. A conversation elsewhere, or a folder a
|
|
43
|
+
* connected sixb holds, runs there, and this follows it.
|
|
37
44
|
*/
|
|
38
45
|
export async function runAgent(options: {
|
|
39
46
|
readonly text: readonly string[]
|
|
@@ -42,6 +49,8 @@ export async function runAgent(options: {
|
|
|
42
49
|
/** The turn's mode; without it, the person's in the thread applies, as for a message in the web. */
|
|
43
50
|
readonly approvalMode?: string
|
|
44
51
|
readonly json: boolean
|
|
52
|
+
/** Send it and exit, without following the turn. */
|
|
53
|
+
readonly detach: boolean
|
|
45
54
|
readonly apiUrl?: string
|
|
46
55
|
readonly profile?: string
|
|
47
56
|
}): Promise<void> {
|
|
@@ -58,7 +67,7 @@ export async function runAgent(options: {
|
|
|
58
67
|
)
|
|
59
68
|
}
|
|
60
69
|
const { client } = connection
|
|
61
|
-
const settings = await loadSettings(
|
|
70
|
+
const settings = await loadSettings()
|
|
62
71
|
// As the project keeps it, and the local sandbox compares it: its real path.
|
|
63
72
|
const folder = await realpath(process.cwd())
|
|
64
73
|
const models = (await listModels({ client })).data?.language ?? []
|
|
@@ -80,22 +89,17 @@ export async function runAgent(options: {
|
|
|
80
89
|
// Read as the person: it says the mode their turns run in there.
|
|
81
90
|
const { data: thread } = await getAgentThread({ client, path: { threadId }, throwOnError: true })
|
|
82
91
|
const onComputer = thread.runsOn === "computer"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
!place
|
|
89
|
-
? "[SixbCLI] This conversation has no folder yet: open it with sixb in its folder, and press ctrl+f."
|
|
90
|
-
: place.id === computerId
|
|
91
|
-
? `[SixbCLI] This conversation works in ${place.folder}: run sixb agent there.`
|
|
92
|
-
: `[SixbCLI] This conversation runs on ${place.name}: run sixb agent there.`
|
|
93
|
-
)
|
|
94
|
-
}
|
|
92
|
+
const place = thread.computer
|
|
93
|
+
if (onComputer && !place) {
|
|
94
|
+
throw new Error(
|
|
95
|
+
"[SixbCLI] This conversation has no folder yet: open it with sixb in its folder, and press ctrl+f."
|
|
96
|
+
)
|
|
95
97
|
}
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
+
const here = onComputer && place?.id === (await thisComputerId()) && place.folder === folder
|
|
99
|
+
const runner = here
|
|
100
|
+
? new LocalRunner(connection, folder, (error) => step(tone.fail(errorMessage(error))))
|
|
98
101
|
: null
|
|
102
|
+
if (runner) runner.keepsAwake = settings.keepAwake
|
|
99
103
|
if (!options.json) {
|
|
100
104
|
const mode = approvalMode ?? thread.approvalMode
|
|
101
105
|
step(
|
|
@@ -120,16 +124,33 @@ export async function runAgent(options: {
|
|
|
120
124
|
throwOnError: true,
|
|
121
125
|
})
|
|
122
126
|
let runId: string | null = posted.run.id
|
|
127
|
+
if (options.detach) {
|
|
128
|
+
if (onComputer && !thread.computer?.online) step(tone.faint(waitingNote(thread.computer)))
|
|
129
|
+
printSent(thread.id, runId, options.json)
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
|
|
123
133
|
let followed: Awaited<ReturnType<typeof follow>> = "finished"
|
|
124
134
|
while (runId) {
|
|
125
|
-
//
|
|
126
|
-
const
|
|
127
|
-
|
|
135
|
+
// Only while this follows: once it stops, nothing may start a turn nobody follows.
|
|
136
|
+
const watching = new AbortController()
|
|
137
|
+
const stopWatching = () => watching.abort()
|
|
138
|
+
stop.signal.addEventListener("abort", stopWatching, { once: true })
|
|
139
|
+
const nobody =
|
|
140
|
+
onComputer && runnerUntilHeld(connection, thread.id, runId, runner, watching.signal)
|
|
141
|
+
followed = await follow(connection, runId, options.json, stop.signal, nobody || undefined)
|
|
142
|
+
stopWatching()
|
|
143
|
+
stop.signal.removeEventListener("abort", stopWatching)
|
|
144
|
+
if (followed === "offline") {
|
|
145
|
+
const { data } = await getAgentThread({ client, path: { threadId: thread.id } })
|
|
146
|
+
step(tone.faint(waitingNote(data?.computer ?? thread.computer)))
|
|
147
|
+
printSent(thread.id, runId, options.json)
|
|
148
|
+
process.exitCode = EXIT_OFFLINE
|
|
149
|
+
return
|
|
150
|
+
}
|
|
128
151
|
if (followed === "unclaimed") {
|
|
129
152
|
process.exitCode = 1
|
|
130
|
-
step(
|
|
131
|
-
tone.fail("This computer couldn't claim the turn: another runner holds it, or it ended.")
|
|
132
|
-
)
|
|
153
|
+
step(tone.fail("This computer couldn't claim the turn."))
|
|
133
154
|
return
|
|
134
155
|
}
|
|
135
156
|
if (followed !== "finished") break
|
|
@@ -148,28 +169,91 @@ export async function runAgent(options: {
|
|
|
148
169
|
}
|
|
149
170
|
}
|
|
150
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Watch a queued turn until something runs it. While a sixb holds its folder that's whose it is, even
|
|
174
|
+
* if busy: it runs one at a time, and taking the turn would run two. Once nothing does, which a
|
|
175
|
+
* crashed sixb's session reaches within a minute, this computer runs it if it's the place to, and
|
|
176
|
+
* otherwise it waits for a computer nobody has open. Null when the turn left the queue by itself.
|
|
177
|
+
* Rejects with the API's answer once it refuses these reads for good.
|
|
178
|
+
*/
|
|
179
|
+
async function runnerUntilHeld(
|
|
180
|
+
connection: Connection,
|
|
181
|
+
threadId: string,
|
|
182
|
+
runId: string,
|
|
183
|
+
runner: LocalRunner | null,
|
|
184
|
+
signal: AbortSignal
|
|
185
|
+
): Promise<"unclaimed" | "offline" | null> {
|
|
186
|
+
const { client } = connection
|
|
187
|
+
const readRun = () => getAgentRun({ client, path: { runId } })
|
|
188
|
+
while (!signal.aborted) {
|
|
189
|
+
const [threadRead, runRead] = await Promise.all([
|
|
190
|
+
getAgentThread({ client, path: { threadId } }),
|
|
191
|
+
readRun(),
|
|
192
|
+
])
|
|
193
|
+
if (signal.aborted) return null
|
|
194
|
+
if (refusedForGood(threadRead)) throw threadRead.error
|
|
195
|
+
if (refusedForGood(runRead)) throw runRead.error
|
|
196
|
+
const thread = threadRead.data
|
|
197
|
+
const status = runRead.data?.status
|
|
198
|
+
// Any other read that failed says nothing about who holds the folder: only a later one can.
|
|
199
|
+
if (thread && status) {
|
|
200
|
+
if (status !== "queued") return null
|
|
201
|
+
if (!thread.computer?.online) {
|
|
202
|
+
if (!runner) return "offline"
|
|
203
|
+
if (await runner.claim(runId)) return null
|
|
204
|
+
// A read that fails here can't say it left the queue, and nothing else here will run it.
|
|
205
|
+
const after = (await readRun()).data?.status
|
|
206
|
+
return after === undefined || after === "queued" ? "unclaimed" : null
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
await Bun.sleep(HOLDER_CHECK_MS)
|
|
210
|
+
}
|
|
211
|
+
return null
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** An answer that won't change by asking again: signed out, no access, or nothing there now. */
|
|
215
|
+
function refusedForGood(read: { readonly response?: Response }): boolean {
|
|
216
|
+
return [401, 403, 404].includes(read.response?.status ?? 0)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Where a turn waits, for a person reading why nothing is happening yet. */
|
|
220
|
+
function waitingNote(computer: { readonly name: string; readonly folder: string } | undefined) {
|
|
221
|
+
return computer
|
|
222
|
+
? `It waits until ${computer.folder} is connected on ${computer.name}: sixb connect there, or sixb with messages from the web on.`
|
|
223
|
+
: "It waits for its computer."
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** A turn asked for and not followed: what a script needs to find it again. */
|
|
227
|
+
function printSent(threadId: string, runId: string, json: boolean): void {
|
|
228
|
+
process.stdout.write(
|
|
229
|
+
json ? `${JSON.stringify({ threadId, runId, status: "queued" })}\n` : `${threadId}\n`
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
|
|
151
233
|
/**
|
|
152
234
|
* Show a turn's steps as they finish, until it ends, the stream fails, the person stops waiting,
|
|
153
|
-
* or `
|
|
235
|
+
* or `nobody` says nothing will run it. Rejects when `nobody` does.
|
|
154
236
|
*/
|
|
155
237
|
async function follow(
|
|
156
238
|
connection: Connection,
|
|
157
239
|
runId: string,
|
|
158
240
|
json: boolean,
|
|
159
241
|
signal: AbortSignal,
|
|
160
|
-
|
|
161
|
-
): Promise<"finished" | "stopped" | "failed" | "unclaimed"> {
|
|
242
|
+
nobody?: Promise<"unclaimed" | "offline" | null>
|
|
243
|
+
): Promise<"finished" | "stopped" | "failed" | "unclaimed" | "offline"> {
|
|
162
244
|
let live = liveRun(runId)
|
|
163
245
|
const shown = new Set<string>()
|
|
164
|
-
return new Promise((resolve) => {
|
|
246
|
+
return new Promise((resolve, reject) => {
|
|
165
247
|
let settled = false
|
|
166
|
-
const
|
|
248
|
+
const end = (answer: () => void) => {
|
|
167
249
|
if (settled) return
|
|
168
250
|
settled = true
|
|
169
251
|
socket.close()
|
|
170
252
|
signal.removeEventListener("abort", onAbort)
|
|
171
|
-
|
|
253
|
+
answer()
|
|
172
254
|
}
|
|
255
|
+
const settle = (outcome: "finished" | "stopped" | "failed" | "unclaimed" | "offline") =>
|
|
256
|
+
end(() => resolve(outcome))
|
|
173
257
|
const onAbort = () => settle("stopped")
|
|
174
258
|
const socket = createAgentRunSocket({
|
|
175
259
|
client: connection.client,
|
|
@@ -203,9 +287,12 @@ async function follow(
|
|
|
203
287
|
},
|
|
204
288
|
})
|
|
205
289
|
signal.addEventListener("abort", onAbort)
|
|
206
|
-
void
|
|
207
|
-
|
|
208
|
-
|
|
290
|
+
void nobody?.then(
|
|
291
|
+
(outcome) => {
|
|
292
|
+
if (outcome) settle(outcome)
|
|
293
|
+
},
|
|
294
|
+
(error: unknown) => end(() => reject(error))
|
|
295
|
+
)
|
|
209
296
|
})
|
|
210
297
|
}
|
|
211
298
|
|
|
@@ -232,7 +319,7 @@ async function afterTurn(
|
|
|
232
319
|
const approvals = data?.approvals ?? []
|
|
233
320
|
if (approvals.length === 0 || json || !process.stdin.isTTY) {
|
|
234
321
|
for (const approval of approvals) step(tone.warn(`? ${describe(approval.call)}`))
|
|
235
|
-
step(tone.faint(
|
|
322
|
+
step(tone.faint("Decide in the app, or open the conversation with sixb in its folder."))
|
|
236
323
|
process.exitCode = EXIT_WAITING
|
|
237
324
|
return null
|
|
238
325
|
}
|
|
@@ -329,10 +416,6 @@ async function readStdin(): Promise<string> {
|
|
|
329
416
|
return text.trim()
|
|
330
417
|
}
|
|
331
418
|
|
|
332
|
-
function errorText(error: unknown): string {
|
|
333
|
-
return error instanceof Error ? error.message : String(error)
|
|
334
|
-
}
|
|
335
|
-
|
|
336
419
|
/**
|
|
337
420
|
* The answer as a terminal shows it: bold and inline code styled, their markers gone. Piped, the
|
|
338
421
|
* answer stays the markdown it is.
|
package/src/commands/api.ts
CHANGED
|
@@ -64,6 +64,10 @@ export async function runApi(options: ApiOptions = {}) {
|
|
|
64
64
|
port: topology.apiPort,
|
|
65
65
|
hostname: topology.apiHost,
|
|
66
66
|
quiet: true,
|
|
67
|
+
// `sixb orchestrator` owns it.
|
|
68
|
+
ontologyMaintenance: false,
|
|
69
|
+
// A lake worker owns it. Without one, changes wait where `sixb check` and the Console show.
|
|
70
|
+
ingestFlush: false,
|
|
67
71
|
browser: {
|
|
68
72
|
publicOrigin: topology.apiPublicOrigin,
|
|
69
73
|
allowedOrigins: topology.allowedBrowserOrigins,
|
|
@@ -85,6 +89,9 @@ export async function runApi(options: ApiOptions = {}) {
|
|
|
85
89
|
{ label: "events", value: apiEventsUrl(topology) },
|
|
86
90
|
],
|
|
87
91
|
storage: migration.summary,
|
|
92
|
+
warnings: [
|
|
93
|
+
"This process runs no upkeep. Keep `sixb orchestrator` running, even with no schedules: it delivers events left undelivered, purges expired records, and runs cron.",
|
|
94
|
+
],
|
|
88
95
|
})
|
|
89
96
|
)
|
|
90
97
|
|
package/src/commands/check.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { dirname, resolve } from "node:path"
|
|
2
|
+
import { getLakeRetentionRuntime, ingestStalledSince } from "@sixb/core/internal/runtime"
|
|
3
|
+
import { countLostRuns } from "@sixb/core/internal/workers"
|
|
2
4
|
import { assertDeclaredEnv } from "../lib/env-config"
|
|
3
5
|
import { errorMessage } from "../lib/errors"
|
|
4
6
|
import { checkRuntimeHealth } from "../lib/health"
|
|
@@ -59,7 +61,12 @@ export async function runCheck(options: CheckOptions = {}) {
|
|
|
59
61
|
// are a different thing and counting them here read as ontology drift.
|
|
60
62
|
warnings: 0,
|
|
61
63
|
},
|
|
62
|
-
warnings: [
|
|
64
|
+
warnings: [
|
|
65
|
+
...health.warnings,
|
|
66
|
+
...markings.warnings,
|
|
67
|
+
...(await lakeWorkerWarnings(sixb, health.storage.ok)),
|
|
68
|
+
...(await lostRunWarnings(sixb, health.storage.ok)),
|
|
69
|
+
],
|
|
63
70
|
})
|
|
64
71
|
)
|
|
65
72
|
|
|
@@ -87,6 +94,73 @@ export async function runCheck(options: CheckOptions = {}) {
|
|
|
87
94
|
|
|
88
95
|
const CLOSE_TIMEOUT_MS = 10_000
|
|
89
96
|
|
|
97
|
+
/**
|
|
98
|
+
* What storage says, since no process knows what the others run. A storage that is down or behind
|
|
99
|
+
* has its own row in this report.
|
|
100
|
+
*/
|
|
101
|
+
async function lakeWorkerWarnings(
|
|
102
|
+
sixb: LoadedSixbHost,
|
|
103
|
+
storageOk: boolean
|
|
104
|
+
): Promise<readonly string[]> {
|
|
105
|
+
if (!storageOk) return []
|
|
106
|
+
|
|
107
|
+
const [status, stalled] = await Promise.all([
|
|
108
|
+
getLakeRetentionRuntime(sixb)
|
|
109
|
+
.status()
|
|
110
|
+
.catch(() => null),
|
|
111
|
+
stalledIngestDatasets(sixb),
|
|
112
|
+
])
|
|
113
|
+
|
|
114
|
+
return [
|
|
115
|
+
...(status?.state === "no-worker"
|
|
116
|
+
? ["Lake cleanup is requested but no lake worker has run it. Run `sixb worker lake`."]
|
|
117
|
+
: []),
|
|
118
|
+
...(stalled.length > 0
|
|
119
|
+
? [
|
|
120
|
+
`Ingested changes wait and nothing writes them, in ${stalled.join(", ")}. Run \`sixb worker lake\`.`,
|
|
121
|
+
]
|
|
122
|
+
: []),
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function stalledIngestDatasets(sixb: LoadedSixbHost): Promise<readonly string[]> {
|
|
127
|
+
const summaries = await sixb.storage.datasetIngest
|
|
128
|
+
?.summarize({ projectId: sixb.id })
|
|
129
|
+
.catch(() => [])
|
|
130
|
+
|
|
131
|
+
return (summaries ?? [])
|
|
132
|
+
.filter(
|
|
133
|
+
(summary) => summary.pendingDeliveries > 0 && ingestStalledSince(summary, Date.now()) !== null
|
|
134
|
+
)
|
|
135
|
+
.map((summary) => summary.datasetId)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* What the orchestrator's `runs` pass will do once it starts: runs that lost their job go on, with
|
|
140
|
+
* their side effects, so whoever is upgrading can look at them first.
|
|
141
|
+
*/
|
|
142
|
+
async function lostRunWarnings(
|
|
143
|
+
sixb: LoadedSixbHost,
|
|
144
|
+
storageOk: boolean
|
|
145
|
+
): Promise<readonly string[]> {
|
|
146
|
+
if (!storageOk) return []
|
|
147
|
+
|
|
148
|
+
const counts = await countLostRuns({
|
|
149
|
+
projectId: sixb.id,
|
|
150
|
+
storage: sixb.storage,
|
|
151
|
+
queues: sixb.queues,
|
|
152
|
+
events: sixb.events,
|
|
153
|
+
now: new Date(),
|
|
154
|
+
}).catch(() => [])
|
|
155
|
+
|
|
156
|
+
return counts.flatMap(({ primitive, goOn, end }) => [
|
|
157
|
+
...(goOn > 0
|
|
158
|
+
? [`${goOn} ${primitive} run(s) lost their job and will go on when the orchestrator starts.`]
|
|
159
|
+
: []),
|
|
160
|
+
...(end > 0 ? [`${end} ${primitive} run(s) are too old to go on and will end cancelled.`] : []),
|
|
161
|
+
])
|
|
162
|
+
}
|
|
163
|
+
|
|
90
164
|
interface MarkingsCheck {
|
|
91
165
|
readonly ok: boolean
|
|
92
166
|
readonly warning?: boolean
|