flowviant 0.48.3 → 0.48.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/bin/cli.mjs +15 -32
- package/bin/lib/config.mjs +4 -8
- package/bin/lib/fleet.mjs +7 -767
- package/bin/lib/prompts.mjs +22 -326
- package/package.json +2 -2
- package/bin/lib/live.mjs +0 -2151
- package/bin/lib/single.mjs +0 -66
package/bin/lib/single.mjs
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Back-compat single-token + static-fleet modes. A single token drains the whole
|
|
3
|
-
* queue in one continuous Claude session in the current checkout; FLOWVIANT_TOKENS
|
|
4
|
-
* runs one such worker per token, each in its own git worktree.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { mkdtempSync, rmSync } from 'node:fs';
|
|
8
|
-
import { tmpdir } from 'node:os';
|
|
9
|
-
import { join } from 'node:path';
|
|
10
|
-
import { MCP_URL, POLL_SECONDS, tokens } from './config.mjs';
|
|
11
|
-
import { sleep, mcpConfigFor, runTurn, sawSentinel, blockedId, SYSTEM_MULTI, KICKOFF, RESUME } from './claude.mjs';
|
|
12
|
-
import { git, repoRootOrDie } from './git.mjs';
|
|
13
|
-
|
|
14
|
-
export async function runWorker({ token, cwd, label }) {
|
|
15
|
-
const { dir, path: mcpConfig } = mcpConfigFor(token, MCP_URL);
|
|
16
|
-
try {
|
|
17
|
-
let out = await runTurn({ prompt: KICKOFF, resume: false, system: SYSTEM_MULTI, cwd, mcpConfig, label });
|
|
18
|
-
while (!sawSentinel(out, 'ALL_CLEAR')) {
|
|
19
|
-
if (blockedId(out)) {
|
|
20
|
-
console.log(`${label} » waiting on you in Flowviant — answer the blocker. Re-checking in ${POLL_SECONDS}s…`);
|
|
21
|
-
}
|
|
22
|
-
await sleep(POLL_SECONDS);
|
|
23
|
-
out = await runTurn({ prompt: RESUME, resume: true, system: SYSTEM_MULTI, cwd, mcpConfig, label });
|
|
24
|
-
}
|
|
25
|
-
console.log(`${label} » queue clear.`);
|
|
26
|
-
} finally {
|
|
27
|
-
rmSync(dir, { recursive: true, force: true });
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function runStaticFleet() {
|
|
32
|
-
console.log(`» flowviant fleet → ${tokens.length} workers · ${MCP_URL}`);
|
|
33
|
-
const repoRoot = repoRootOrDie();
|
|
34
|
-
const baseDir = mkdtempSync(join(tmpdir(), 'flowviant-fleet-'));
|
|
35
|
-
const worktrees = [];
|
|
36
|
-
const cleanup = () => {
|
|
37
|
-
for (const wt of worktrees) {
|
|
38
|
-
try {
|
|
39
|
-
git(['worktree', 'remove', '--force', wt], repoRoot);
|
|
40
|
-
} catch {
|
|
41
|
-
/* best-effort */
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
try {
|
|
45
|
-
rmSync(baseDir, { recursive: true, force: true });
|
|
46
|
-
} catch {
|
|
47
|
-
/* best-effort */
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
process.on('SIGINT', () => {
|
|
51
|
-
cleanup();
|
|
52
|
-
process.exit(130);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const jobs = tokens.map((token, i) => {
|
|
56
|
-
const label = `[w${i + 1}]`;
|
|
57
|
-
const wt = join(baseDir, `worker-${i + 1}`);
|
|
58
|
-
git(['worktree', 'add', '--detach', wt, 'HEAD'], repoRoot);
|
|
59
|
-
worktrees.push(wt);
|
|
60
|
-
console.log(`${label} worktree ready (token fva_…${token.slice(-4)})`);
|
|
61
|
-
return runWorker({ token, cwd: wt, label });
|
|
62
|
-
});
|
|
63
|
-
await Promise.allSettled(jobs);
|
|
64
|
-
cleanup();
|
|
65
|
-
console.log('» fleet done — all queues clear.');
|
|
66
|
-
}
|