usebeeline 0.0.49 → 0.0.50
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 +1 -1
- package/dist/usebeeline.mjs +187 -105
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -148,7 +148,7 @@ Two MCP surfaces are mounted into every agent session.
|
|
|
148
148
|
Beeline is on both stores:
|
|
149
149
|
|
|
150
150
|
- [App Store](https://apps.apple.com/app/id6803948500)
|
|
151
|
-
- [Google Play](https://play.google.com/store/apps/details?id=app.usebeeline
|
|
151
|
+
- [Google Play](https://play.google.com/store/apps/details?id=app.usebeeline)
|
|
152
152
|
|
|
153
153
|
Sign in with GitHub, and the app hands you the pairing code that `npx usebeeline connect` asks for.
|
|
154
154
|
|
package/dist/usebeeline.mjs
CHANGED
|
@@ -309,12 +309,12 @@ __export(self_update_exports, {
|
|
|
309
309
|
});
|
|
310
310
|
import { createHash as createHash5 } from "node:crypto";
|
|
311
311
|
import { constants as fsConstants } from "node:fs";
|
|
312
|
-
import { access, chmod as
|
|
312
|
+
import { access, chmod as chmod4, lstat as lstat2, mkdir as mkdir13, open, readFile as readFile9, rename as rename3, rm as rm5, symlink as symlink2, writeFile as writeFile9 } from "node:fs/promises";
|
|
313
313
|
import { spawn as spawn4 } from "node:child_process";
|
|
314
314
|
import { homedir as homedir9 } from "node:os";
|
|
315
|
-
import { dirname as dirname9, join as join7, resolve as
|
|
315
|
+
import { dirname as dirname9, join as join7, resolve as resolve21 } from "node:path";
|
|
316
316
|
function anchorLayout(rawLibDir) {
|
|
317
|
-
const libDir =
|
|
317
|
+
const libDir = resolve21(rawLibDir);
|
|
318
318
|
const segments = libDir.split(/[/\\]/);
|
|
319
319
|
const idx = segments.lastIndexOf(RELEASES_SEGMENT);
|
|
320
320
|
if (idx >= 2 && segments[idx - 1] === "lib") {
|
|
@@ -330,9 +330,9 @@ function anchorLayout(rawLibDir) {
|
|
|
330
330
|
// prefix's bin, NOT <prefix>/lib/bin — deriving it one level up was the
|
|
331
331
|
// defect that made activateRelease write its stable forwarders where
|
|
332
332
|
// nothing executed them, leaving stale raw wrappers in <prefix>/bin.
|
|
333
|
-
binDir:
|
|
333
|
+
binDir: resolve21(libDir, "../../bin"),
|
|
334
334
|
libDir,
|
|
335
|
-
releasesRoot:
|
|
335
|
+
releasesRoot: resolve21(libDir, `../${RELEASES_SEGMENT}`)
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
function beelineInstallLayout(env = process.env) {
|
|
@@ -343,7 +343,7 @@ function beelineInstallLayout(env = process.env) {
|
|
|
343
343
|
}
|
|
344
344
|
function defaultBeelineInstallLayout(env = process.env) {
|
|
345
345
|
const home = env.HOME?.trim() || homedir9();
|
|
346
|
-
return anchorLayout(
|
|
346
|
+
return anchorLayout(resolve21(home, ".local", "lib", "beeline"));
|
|
347
347
|
}
|
|
348
348
|
function hostPlatformKey() {
|
|
349
349
|
const os = process.platform === "linux" ? "linux" : process.platform === "darwin" ? "darwin" : "";
|
|
@@ -387,8 +387,8 @@ async function readUpdateState(layout) {
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
async function writeUpdateState(layout, state) {
|
|
390
|
-
await
|
|
391
|
-
await
|
|
390
|
+
await mkdir13(join7(layout.releasesRoot, ".state"), { recursive: true });
|
|
391
|
+
await writeFile9(updateStatePath(layout), `${JSON.stringify(state, null, 2)}
|
|
392
392
|
`, "utf8");
|
|
393
393
|
}
|
|
394
394
|
async function readInstalledBundleIdentity(layout, _state = {}) {
|
|
@@ -501,7 +501,7 @@ async function stageRelease(layout, manifestUrl, published, opts = {}) {
|
|
|
501
501
|
previouslyVerified = true;
|
|
502
502
|
} catch {
|
|
503
503
|
}
|
|
504
|
-
await
|
|
504
|
+
await mkdir13(releaseDir, { recursive: true });
|
|
505
505
|
const tempArchive = join7(layout.releasesRoot, `.download-${releaseId}-${process.pid}.tar.gz`);
|
|
506
506
|
try {
|
|
507
507
|
log2(`downloading ${published.file}`);
|
|
@@ -522,7 +522,7 @@ async function stageRelease(layout, manifestUrl, published, opts = {}) {
|
|
|
522
522
|
if (actual !== published.sha256.toLowerCase()) {
|
|
523
523
|
throw new Error(`checksum mismatch for ${published.file}: expected ${published.sha256}, got ${actual} \u2014 aborting without touching the installed bundle`);
|
|
524
524
|
}
|
|
525
|
-
await
|
|
525
|
+
await writeFile9(tempArchive, Buffer.concat(chunks), { mode: 384 });
|
|
526
526
|
const entries = (await new Promise((resolveList, rejectList) => {
|
|
527
527
|
const child = spawn4("tar", ["-tzf", tempArchive], { stdio: ["ignore", "pipe", "inherit"] });
|
|
528
528
|
let out = "";
|
|
@@ -553,7 +553,7 @@ async function stageRelease(layout, manifestUrl, published, opts = {}) {
|
|
|
553
553
|
throw new Error(`staged bundle failed its startup smoke test (--version exited ${probe.status})${probe.stderr ? `: ${probe.stderr.trim()}` : ""}`);
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
|
-
await
|
|
556
|
+
await writeFile9(okMarker, `${published.sha256}
|
|
557
557
|
`, "utf8");
|
|
558
558
|
log2(`staged release ${releaseId} (sha256 verified)`);
|
|
559
559
|
return releaseId;
|
|
@@ -581,15 +581,15 @@ function forwarderScript(tool) {
|
|
|
581
581
|
}
|
|
582
582
|
async function replaceFile(path, contents, mode) {
|
|
583
583
|
const temp = `${path}.new-${process.pid}`;
|
|
584
|
-
await
|
|
585
|
-
await
|
|
584
|
+
await writeFile9(temp, contents, { mode });
|
|
585
|
+
await chmod4(temp, mode);
|
|
586
586
|
await rename3(temp, path);
|
|
587
587
|
}
|
|
588
588
|
async function activateRelease(layout, releaseId) {
|
|
589
589
|
const releaseDir = join7(layout.releasesRoot, releaseId);
|
|
590
590
|
await access(join7(releaseDir, BUNDLE_ENTRYPOINT), fsConstants.F_OK);
|
|
591
|
-
await
|
|
592
|
-
await
|
|
591
|
+
await mkdir13(layout.releasesRoot, { recursive: true });
|
|
592
|
+
await mkdir13(layout.binDir, { recursive: true });
|
|
593
593
|
let previousReleaseId = await activeReleaseId(layout);
|
|
594
594
|
const kind = await pathKind(layout.libDir);
|
|
595
595
|
if (kind === "directory") {
|
|
@@ -628,7 +628,7 @@ async function normalizeLegacyBundleShape(bundleDir) {
|
|
|
628
628
|
}
|
|
629
629
|
if (!anyFlat)
|
|
630
630
|
return;
|
|
631
|
-
await
|
|
631
|
+
await mkdir13(innerLib, { recursive: true });
|
|
632
632
|
for (const name of LEGACY_FLAT_BUNDLE_FILES) {
|
|
633
633
|
try {
|
|
634
634
|
await access(join7(innerLib, name), fsConstants.F_OK);
|
|
@@ -661,7 +661,7 @@ async function repairInstallForwarders(layout, opts = {}) {
|
|
|
661
661
|
}
|
|
662
662
|
if (current === forwarderScript("beeline"))
|
|
663
663
|
return false;
|
|
664
|
-
await
|
|
664
|
+
await mkdir13(layout.binDir, { recursive: true });
|
|
665
665
|
await writeBinForwarders(layout, layout.libDir);
|
|
666
666
|
opts.logger?.(`[body] self-update: repaired <prefix>/bin forwarders to follow the active-bundle anchor (${layout.libDir})`);
|
|
667
667
|
return true;
|
|
@@ -693,10 +693,10 @@ async function readUpdateAttempt(layout) {
|
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
695
|
async function writeUpdateAttempt(layout, record2) {
|
|
696
|
-
await
|
|
696
|
+
await mkdir13(join7(layout.releasesRoot, ".state"), { recursive: true });
|
|
697
697
|
const path = updateAttemptPath(layout);
|
|
698
698
|
const staged = `${path}.${process.pid}.tmp`;
|
|
699
|
-
await
|
|
699
|
+
await writeFile9(staged, `${JSON.stringify(record2, null, 2)}
|
|
700
700
|
`, { mode: 384 });
|
|
701
701
|
await rename3(staged, path);
|
|
702
702
|
}
|
|
@@ -955,8 +955,8 @@ var init_self_update = __esm({
|
|
|
955
955
|
});
|
|
956
956
|
|
|
957
957
|
// apps/body/dist/cli.js
|
|
958
|
-
import { dirname as dirname15, resolve as
|
|
959
|
-
import { readFile as readFile14, unlink as unlink3, writeFile as
|
|
958
|
+
import { dirname as dirname15, resolve as resolve28 } from "node:path";
|
|
959
|
+
import { readFile as readFile14, unlink as unlink3, writeFile as writeFile15 } from "node:fs/promises";
|
|
960
960
|
import { stdin as stdin4, stdout as stdout5 } from "node:process";
|
|
961
961
|
|
|
962
962
|
// node_modules/@clack/core/dist/index.mjs
|
|
@@ -3832,7 +3832,7 @@ var AcpClient = class extends EventEmitter {
|
|
|
3832
3832
|
const current = this.activeRunIds.get(sessionId);
|
|
3833
3833
|
if (current)
|
|
3834
3834
|
return Promise.resolve(current);
|
|
3835
|
-
return new Promise((
|
|
3835
|
+
return new Promise((resolve29, reject) => {
|
|
3836
3836
|
const onUpdate = (update) => {
|
|
3837
3837
|
if (update.sessionId !== sessionId)
|
|
3838
3838
|
return;
|
|
@@ -3840,7 +3840,7 @@ var AcpClient = class extends EventEmitter {
|
|
|
3840
3840
|
if (!runId)
|
|
3841
3841
|
return;
|
|
3842
3842
|
cleanup();
|
|
3843
|
-
|
|
3843
|
+
resolve29(runId);
|
|
3844
3844
|
};
|
|
3845
3845
|
const timer = setTimeout(() => {
|
|
3846
3846
|
cleanup();
|
|
@@ -3924,13 +3924,13 @@ var AcpClient = class extends EventEmitter {
|
|
|
3924
3924
|
}
|
|
3925
3925
|
const id = this.nextId++;
|
|
3926
3926
|
const payload = { jsonrpc: "2.0", id, method, params };
|
|
3927
|
-
return new Promise((
|
|
3927
|
+
return new Promise((resolve29, reject) => {
|
|
3928
3928
|
const timer = setTimeout(() => {
|
|
3929
3929
|
this.pending.delete(id);
|
|
3930
3930
|
reject(new AcpRequestTimeoutError(method, timeoutMs, this.stderrTail, Boolean(onStart), detail));
|
|
3931
3931
|
}, timeoutMs);
|
|
3932
3932
|
this.pending.set(id, {
|
|
3933
|
-
resolve:
|
|
3933
|
+
resolve: resolve29,
|
|
3934
3934
|
reject,
|
|
3935
3935
|
timer,
|
|
3936
3936
|
method,
|
|
@@ -13283,8 +13283,8 @@ async function activateDaemonTransport(path, fetchImpl = fetch) {
|
|
|
13283
13283
|
import { execFile as execFile4 } from "node:child_process";
|
|
13284
13284
|
import { createHash as createHash4 } from "node:crypto";
|
|
13285
13285
|
import { existsSync as existsSync4, mkdirSync } from "node:fs";
|
|
13286
|
-
import { mkdir as
|
|
13287
|
-
import { dirname as dirname6, resolve as
|
|
13286
|
+
import { mkdir as mkdir11, rm as rm4 } from "node:fs/promises";
|
|
13287
|
+
import { dirname as dirname6, resolve as resolve19 } from "node:path";
|
|
13288
13288
|
import { promisify as promisify3 } from "node:util";
|
|
13289
13289
|
|
|
13290
13290
|
// apps/body/dist/grant-runner.js
|
|
@@ -14126,7 +14126,7 @@ var GrantRunnerServer = class {
|
|
|
14126
14126
|
|
|
14127
14127
|
// apps/body/dist/monolith-corner-turn.js
|
|
14128
14128
|
import { execFile as execFile3 } from "node:child_process";
|
|
14129
|
-
import { mkdir as
|
|
14129
|
+
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
14130
14130
|
import { homedir as homedir6 } from "node:os";
|
|
14131
14131
|
import { join as join5 } from "node:path";
|
|
14132
14132
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -16610,6 +16610,57 @@ var TurnTraceFile = class {
|
|
|
16610
16610
|
}
|
|
16611
16611
|
};
|
|
16612
16612
|
|
|
16613
|
+
// apps/body/dist/corner-github-auth.js
|
|
16614
|
+
import { chmod as chmod3, mkdir as mkdir8, writeFile as writeFile7 } from "node:fs/promises";
|
|
16615
|
+
import { delimiter as delimiter2, resolve as resolve18 } from "node:path";
|
|
16616
|
+
async function installCornerGitHubWrappers(input) {
|
|
16617
|
+
const bin = resolve18(input.root, "beeline-github-bin");
|
|
16618
|
+
await mkdir8(bin, { recursive: true, mode: 448 });
|
|
16619
|
+
const common = {
|
|
16620
|
+
node: process.execPath,
|
|
16621
|
+
cli: input.cliEntrypoint,
|
|
16622
|
+
config: input.runtimeConfigPath,
|
|
16623
|
+
room: input.roomId
|
|
16624
|
+
};
|
|
16625
|
+
await writeLauncher(resolve18(bin, "git"), { ...common, command: input.gitBinary });
|
|
16626
|
+
if (input.ghBinary)
|
|
16627
|
+
await writeLauncher(resolve18(bin, "gh"), { ...common, command: input.ghBinary });
|
|
16628
|
+
return {
|
|
16629
|
+
PATH: [bin, input.inheritedPath].filter(Boolean).join(delimiter2),
|
|
16630
|
+
// Static startup tokens take precedence over the refreshed token in gh.
|
|
16631
|
+
GH_TOKEN: "",
|
|
16632
|
+
GITHUB_TOKEN: ""
|
|
16633
|
+
};
|
|
16634
|
+
}
|
|
16635
|
+
async function writeLauncher(path, config) {
|
|
16636
|
+
const source = `#!/usr/bin/env node
|
|
16637
|
+
import { spawnSync } from 'node:child_process';
|
|
16638
|
+
const config = ${JSON.stringify(config)};
|
|
16639
|
+
const authFailure = /(?:authentication failed|bad credentials|could not read username|http(?:\\/\\d(?:\\.\\d)?)? 40[13]|status (?:code )?40[13])/i;
|
|
16640
|
+
function token() {
|
|
16641
|
+
const result = spawnSync(config.node, [config.cli, 'corner-read-token', '--config', config.config, '--room', config.room], { encoding: 'utf8' });
|
|
16642
|
+
if (result.status !== 0) {
|
|
16643
|
+
process.stderr.write(result.stderr || 'Beeline could not refresh the repository credential.\\n');
|
|
16644
|
+
process.exit(result.status || 1);
|
|
16645
|
+
}
|
|
16646
|
+
return result.stdout.trim();
|
|
16647
|
+
}
|
|
16648
|
+
function run(value) {
|
|
16649
|
+
const env = { ...process.env, GH_TOKEN: value, GITHUB_TOKEN: value, GIT_TERMINAL_PROMPT: '0' };
|
|
16650
|
+
return spawnSync(config.command, process.argv.slice(2), { env, encoding: 'buffer', stdio: ['inherit', 'pipe', 'pipe'] });
|
|
16651
|
+
}
|
|
16652
|
+
let result = run(token());
|
|
16653
|
+
const diagnostic = Buffer.concat([result.stdout || Buffer.alloc(0), result.stderr || Buffer.alloc(0)]).toString('utf8');
|
|
16654
|
+
if (result.status !== 0 && authFailure.test(diagnostic)) result = run(token());
|
|
16655
|
+
if (result.stdout) process.stdout.write(result.stdout);
|
|
16656
|
+
if (result.stderr) process.stderr.write(result.stderr);
|
|
16657
|
+
if (result.error) throw result.error;
|
|
16658
|
+
process.exit(result.status ?? 1);
|
|
16659
|
+
`;
|
|
16660
|
+
await writeFile7(path, source, { mode: 448 });
|
|
16661
|
+
await chmod3(path, 448);
|
|
16662
|
+
}
|
|
16663
|
+
|
|
16613
16664
|
// apps/body/dist/monolith-corner-turn.js
|
|
16614
16665
|
var execFileAsync2 = promisify2(execFile3);
|
|
16615
16666
|
var TOOL_ARGUMENT_MAX_BYTES = 1200;
|
|
@@ -16866,7 +16917,7 @@ var MonolithCornerTurnLoop = class {
|
|
|
16866
16917
|
soul: configuration.soul ?? self?.soul,
|
|
16867
16918
|
agentName: self?.name ?? this.agent.name
|
|
16868
16919
|
});
|
|
16869
|
-
await
|
|
16920
|
+
await mkdir9(this.options.worktreePath, { recursive: true });
|
|
16870
16921
|
const selection = configuration.model || configuration.effort ? { model: configuration.model, effort: configuration.effort } : this.options.config.modelSelection;
|
|
16871
16922
|
const homeOverlay = this.options.config.agentHomeRoot ? await prepareRoomAgentHome({
|
|
16872
16923
|
root: this.options.config.agentHomeRoot,
|
|
@@ -16883,11 +16934,27 @@ var MonolithCornerTurnLoop = class {
|
|
|
16883
16934
|
})
|
|
16884
16935
|
}) : {};
|
|
16885
16936
|
const command = this.options.config.agentCommand ?? this.options.config.agentBinary;
|
|
16937
|
+
let githubEnv = {
|
|
16938
|
+
GH_TOKEN: this.options.githubToken,
|
|
16939
|
+
GITHUB_TOKEN: this.options.githubToken
|
|
16940
|
+
};
|
|
16941
|
+
if (this.options.config.runtimeConfigPath && this.options.config.agentHomeRoot) {
|
|
16942
|
+
const gitBinary = (await execFileAsync2("which", ["git"])).stdout.trim();
|
|
16943
|
+
const ghBinary = await execFileAsync2("which", ["gh"]).then((result) => result.stdout.trim()).catch(() => void 0);
|
|
16944
|
+
githubEnv = await installCornerGitHubWrappers({
|
|
16945
|
+
root: this.options.config.agentHomeRoot,
|
|
16946
|
+
runtimeConfigPath: this.options.config.runtimeConfigPath,
|
|
16947
|
+
roomId: this.options.parentRoomId,
|
|
16948
|
+
cliEntrypoint: process.argv[1],
|
|
16949
|
+
gitBinary,
|
|
16950
|
+
...ghBinary ? { ghBinary } : {},
|
|
16951
|
+
inheritedPath: this.options.config.agentEnv.PATH ?? process.env.PATH
|
|
16952
|
+
});
|
|
16953
|
+
}
|
|
16886
16954
|
const agentEnv = {
|
|
16887
16955
|
...this.options.config.agentEnv,
|
|
16888
16956
|
...homeOverlay,
|
|
16889
|
-
|
|
16890
|
-
GITHUB_TOKEN: this.options.githubToken
|
|
16957
|
+
...githubEnv
|
|
16891
16958
|
};
|
|
16892
16959
|
this.agentEnv = agentEnv;
|
|
16893
16960
|
const agentArgs = agentArgsWithModelSelection({
|
|
@@ -16900,7 +16967,7 @@ var MonolithCornerTurnLoop = class {
|
|
|
16900
16967
|
this.attachmentDir = tmpDir ? join5(tmpDir, "beeline-attachments") : void 0;
|
|
16901
16968
|
this.sessionScratchDir = tmpDir;
|
|
16902
16969
|
const homeStateDirs = harnessHomeStateDirs(command, agentEnv.HOME ?? operatorHome);
|
|
16903
|
-
await Promise.all(homeStateDirs.map((dir) =>
|
|
16970
|
+
await Promise.all(homeStateDirs.map((dir) => mkdir9(dir, { recursive: true })));
|
|
16904
16971
|
const spawnCommand = wrapAgentCommand({
|
|
16905
16972
|
bwrapPath: this.options.config.bwrapPath,
|
|
16906
16973
|
spec: {
|
|
@@ -17336,7 +17403,7 @@ async function wait(ms, signal) {
|
|
|
17336
17403
|
}
|
|
17337
17404
|
|
|
17338
17405
|
// apps/body/dist/monolith-room-turn.js
|
|
17339
|
-
import { mkdir as
|
|
17406
|
+
import { mkdir as mkdir10 } from "node:fs/promises";
|
|
17340
17407
|
import { homedir as homedir7 } from "node:os";
|
|
17341
17408
|
import { join as join6 } from "node:path";
|
|
17342
17409
|
|
|
@@ -17651,7 +17718,7 @@ var MonolithRoomTurnLoop = class {
|
|
|
17651
17718
|
agentName: self?.name ?? this.agent.name
|
|
17652
17719
|
});
|
|
17653
17720
|
const directMessage = Array.isArray(repositoryState.directParticipants) && repositoryState.directParticipants.length === 2;
|
|
17654
|
-
await
|
|
17721
|
+
await mkdir10(this.options.cwd, { recursive: true });
|
|
17655
17722
|
const selection = configuration.model || configuration.effort ? { model: configuration.model, effort: configuration.effort } : this.options.config.modelSelection;
|
|
17656
17723
|
const homeOverlay = this.options.config.agentHomeRoot ? await prepareRoomAgentHome({
|
|
17657
17724
|
root: this.options.config.agentHomeRoot,
|
|
@@ -17681,7 +17748,7 @@ var MonolithRoomTurnLoop = class {
|
|
|
17681
17748
|
this.sessionScratchDir = tmpDir;
|
|
17682
17749
|
this.sessionStateDirs = stateDirs;
|
|
17683
17750
|
const homeStateDirs = harnessHomeStateDirs(command, agentEnv.HOME ?? operatorHome);
|
|
17684
|
-
await Promise.all(homeStateDirs.map((dir) =>
|
|
17751
|
+
await Promise.all(homeStateDirs.map((dir) => mkdir10(dir, { recursive: true })));
|
|
17685
17752
|
const spawnCommand = wrapAgentCommand({
|
|
17686
17753
|
bwrapPath: this.options.config.bwrapPath,
|
|
17687
17754
|
spec: {
|
|
@@ -18730,13 +18797,13 @@ var RoomRuntimeCoordinator = class {
|
|
|
18730
18797
|
return this.runtime.rooms.find((room) => room.channelId === roomId);
|
|
18731
18798
|
}
|
|
18732
18799
|
roomRoot(roomId) {
|
|
18733
|
-
return this.roomRecord(roomId)?.root ??
|
|
18800
|
+
return this.roomRecord(roomId)?.root ?? resolve19(dirname6(this.configPath), "rooms", roomId);
|
|
18734
18801
|
}
|
|
18735
18802
|
roomAgentHomeRoot(workspaceRoot, required = false) {
|
|
18736
18803
|
const flag = process.env.BUZZY_BODY_ROOM_HOME;
|
|
18737
18804
|
if (!required && flag === "0")
|
|
18738
18805
|
return void 0;
|
|
18739
|
-
const home =
|
|
18806
|
+
const home = resolve19(workspaceRoot, "agent-home");
|
|
18740
18807
|
if (!required && flag !== "1" && !existsSync4(home) && existsSync4(workspaceRoot))
|
|
18741
18808
|
return void 0;
|
|
18742
18809
|
try {
|
|
@@ -18753,8 +18820,8 @@ var RoomRuntimeCoordinator = class {
|
|
|
18753
18820
|
return {
|
|
18754
18821
|
...this.baseConfig,
|
|
18755
18822
|
workspaceRoot,
|
|
18756
|
-
agentPrivateRoot:
|
|
18757
|
-
agentMemoryRoot:
|
|
18823
|
+
agentPrivateRoot: resolve19(workspaceRoot, "agent-private"),
|
|
18824
|
+
agentMemoryRoot: resolve19(dirname6(this.configPath), "memory"),
|
|
18758
18825
|
openRouterRoutingCacheDir: openRouterRoutingCacheDir(dirname6(this.configPath)),
|
|
18759
18826
|
turnTraceDir: turnTraceDirectory(dirname6(this.configPath)),
|
|
18760
18827
|
...agentHomeRoot ? { agentHomeRoot } : {}
|
|
@@ -18823,11 +18890,11 @@ var RoomRuntimeCoordinator = class {
|
|
|
18823
18890
|
const remote = roomCheckoutRemote(repository.remote);
|
|
18824
18891
|
const targetBranch = repository.targetBranch || "main";
|
|
18825
18892
|
const checkoutId = createHash4("sha256").update(`${remote}\0${targetBranch}`).digest("hex").slice(0, 24);
|
|
18826
|
-
const path =
|
|
18827
|
-
await
|
|
18893
|
+
const path = resolve19(this.runtime.supervisorRoot, "beeline", "room-checkouts", checkoutId);
|
|
18894
|
+
await mkdir11(dirname6(path), { recursive: true, mode: 448 });
|
|
18828
18895
|
const token = remote.startsWith("https://github.com/") ? await this.options.daemonApi.execute("getRoomGitHubToken", { roomId }) : void 0;
|
|
18829
18896
|
const env = token ? githubGitEnv(token.token) : process.env;
|
|
18830
|
-
if (!existsSync4(
|
|
18897
|
+
if (!existsSync4(resolve19(path, ".git"))) {
|
|
18831
18898
|
await execFileAsync3("git", ["clone", "--no-checkout", remote, path], {
|
|
18832
18899
|
env,
|
|
18833
18900
|
maxBuffer: 4 * 1024 * 1024
|
|
@@ -18952,12 +19019,12 @@ var RoomRuntimeCoordinator = class {
|
|
|
18952
19019
|
async materializeCornerWorktree(input) {
|
|
18953
19020
|
const remote = githubHttpsRemote(input.remote);
|
|
18954
19021
|
const repositoryHash = createHash4("sha256").update(remote).digest("hex").slice(0, 24);
|
|
18955
|
-
const gitCommonDir =
|
|
18956
|
-
const path =
|
|
18957
|
-
await
|
|
18958
|
-
await
|
|
19022
|
+
const gitCommonDir = resolve19(this.runtime.supervisorRoot, "beeline", "repositories", `${repositoryHash}.git`);
|
|
19023
|
+
const path = resolve19(this.runtime.supervisorRoot, "beeline", "corners", input.cornerId);
|
|
19024
|
+
await mkdir11(dirname6(gitCommonDir), { recursive: true, mode: 448 });
|
|
19025
|
+
await mkdir11(dirname6(path), { recursive: true, mode: 448 });
|
|
18959
19026
|
const authEnv = githubGitEnv(input.token);
|
|
18960
|
-
if (!existsSync4(
|
|
19027
|
+
if (!existsSync4(resolve19(gitCommonDir, "HEAD"))) {
|
|
18961
19028
|
await execFileAsync3("git", ["clone", "--bare", remote, gitCommonDir], {
|
|
18962
19029
|
env: authEnv,
|
|
18963
19030
|
maxBuffer: 4 * 1024 * 1024
|
|
@@ -18970,7 +19037,7 @@ var RoomRuntimeCoordinator = class {
|
|
|
18970
19037
|
"origin",
|
|
18971
19038
|
`+refs/heads/${input.targetBranch}:refs/remotes/origin/${input.targetBranch}`
|
|
18972
19039
|
], { env: authEnv, maxBuffer: 4 * 1024 * 1024 });
|
|
18973
|
-
if (!existsSync4(
|
|
19040
|
+
if (!existsSync4(resolve19(path, ".git"))) {
|
|
18974
19041
|
await rm4(path, { recursive: true, force: true });
|
|
18975
19042
|
await execFileAsync3("git", [
|
|
18976
19043
|
`--git-dir=${gitCommonDir}`,
|
|
@@ -19007,7 +19074,7 @@ var RoomRuntimeCoordinator = class {
|
|
|
19007
19074
|
`${this.agent.publicKey.slice(0, 16)}@users.noreply.github.com`
|
|
19008
19075
|
]);
|
|
19009
19076
|
const top = await execFileAsync3("git", ["-C", path, "rev-parse", "--show-toplevel"]);
|
|
19010
|
-
if (
|
|
19077
|
+
if (resolve19(top.stdout.trim()) !== resolve19(path)) {
|
|
19011
19078
|
throw new Error(`corner worktree escaped its isolated root: ${top.stdout.trim()}`);
|
|
19012
19079
|
}
|
|
19013
19080
|
return { path, gitCommonDir };
|
|
@@ -19185,9 +19252,9 @@ var ThinDaemonCore = class {
|
|
|
19185
19252
|
|
|
19186
19253
|
// apps/body/dist/systemd.js
|
|
19187
19254
|
import { execFile as execFile5 } from "node:child_process";
|
|
19188
|
-
import { mkdir as
|
|
19255
|
+
import { mkdir as mkdir12, readFile as readFile8, writeFile as writeFile8 } from "node:fs/promises";
|
|
19189
19256
|
import { homedir as homedir8 } from "node:os";
|
|
19190
|
-
import { dirname as dirname7, resolve as
|
|
19257
|
+
import { dirname as dirname7, resolve as resolve20 } from "node:path";
|
|
19191
19258
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
19192
19259
|
import { promisify as promisify4 } from "node:util";
|
|
19193
19260
|
var execFileAsync4 = promisify4(execFile5);
|
|
@@ -19229,9 +19296,9 @@ WantedBy=default.target
|
|
|
19229
19296
|
}
|
|
19230
19297
|
function isCanonicalInstalledLauncher(env = process.env, invocationPath = process.argv[1]) {
|
|
19231
19298
|
const home = env.HOME?.trim() || homedir8();
|
|
19232
|
-
const expectedLibDir =
|
|
19299
|
+
const expectedLibDir = resolve20(home, ".local", "lib", "beeline");
|
|
19233
19300
|
const expectedPrefix = `${expectedLibDir}/`;
|
|
19234
|
-
return
|
|
19301
|
+
return resolve20(env.BEELINE_LIB_DIR?.trim() || "/") === expectedLibDir && Boolean(invocationPath) && resolve20(invocationPath).startsWith(expectedPrefix);
|
|
19235
19302
|
}
|
|
19236
19303
|
function assertCanonicalInstalledLauncher(env, invocationPath) {
|
|
19237
19304
|
if (isCanonicalInstalledLauncher(env, invocationPath))
|
|
@@ -19239,8 +19306,8 @@ function assertCanonicalInstalledLauncher(env, invocationPath) {
|
|
|
19239
19306
|
throw new Error("refusing to modify the shared Beeline systemd unit outside the canonical ~/.local/bin/beeline launcher");
|
|
19240
19307
|
}
|
|
19241
19308
|
function systemdUserUnitPath(env = process.env) {
|
|
19242
|
-
const configRoot = env.XDG_CONFIG_HOME?.trim() ||
|
|
19243
|
-
return
|
|
19309
|
+
const configRoot = env.XDG_CONFIG_HOME?.trim() || resolve20(homedir8(), ".config");
|
|
19310
|
+
return resolve20(configRoot, "systemd", "user", SYSTEMD_UNIT_NAME);
|
|
19244
19311
|
}
|
|
19245
19312
|
var runSystemctl = async (args) => {
|
|
19246
19313
|
const result = await execFileAsync4("systemctl", ["--user", ...args], {
|
|
@@ -19258,8 +19325,8 @@ async function installAgentService(publicKey, options = {}) {
|
|
|
19258
19325
|
const content = agentServiceUnit();
|
|
19259
19326
|
const existing = await readFile8(path, "utf8").catch(() => "");
|
|
19260
19327
|
if (existing !== content) {
|
|
19261
|
-
await
|
|
19262
|
-
await
|
|
19328
|
+
await mkdir12(dirname7(path), { recursive: true, mode: 448 });
|
|
19329
|
+
await writeFile8(path, content, { mode: 384 });
|
|
19263
19330
|
}
|
|
19264
19331
|
const run2 = options.run ?? runSystemctl;
|
|
19265
19332
|
await run2(["daemon-reload"]);
|
|
@@ -19431,8 +19498,8 @@ async function runStartCommand(args, interactiveUi) {
|
|
|
19431
19498
|
// apps/body/dist/connect-command.js
|
|
19432
19499
|
import { spawn as spawn5 } from "node:child_process";
|
|
19433
19500
|
import { createHash as createHash6 } from "node:crypto";
|
|
19434
|
-
import { chmod as
|
|
19435
|
-
import { dirname as dirname10, resolve as
|
|
19501
|
+
import { chmod as chmod5, mkdir as mkdir14, readFile as readFile10, unlink as unlink2, writeFile as writeFile10 } from "node:fs/promises";
|
|
19502
|
+
import { dirname as dirname10, resolve as resolve22 } from "node:path";
|
|
19436
19503
|
import { stdin as stdin3, stdout as stdout4 } from "node:process";
|
|
19437
19504
|
|
|
19438
19505
|
// packages/api-contract/dist/agent-pairing-code.js
|
|
@@ -20066,7 +20133,7 @@ async function installCurrentRelease(fetchImpl) {
|
|
|
20066
20133
|
});
|
|
20067
20134
|
await activateRelease(layout, releaseId);
|
|
20068
20135
|
return {
|
|
20069
|
-
binary:
|
|
20136
|
+
binary: resolve22(layout.binDir, "beeline"),
|
|
20070
20137
|
version: published.version ?? releaseId
|
|
20071
20138
|
};
|
|
20072
20139
|
}
|
|
@@ -20089,21 +20156,21 @@ function providerEnvironment(selection) {
|
|
|
20089
20156
|
};
|
|
20090
20157
|
}
|
|
20091
20158
|
async function writePrivateJson(path, value) {
|
|
20092
|
-
await
|
|
20093
|
-
await
|
|
20159
|
+
await mkdir14(dirname10(path), { recursive: true, mode: 448 });
|
|
20160
|
+
await writeFile10(path, `${JSON.stringify(value, null, 2)}
|
|
20094
20161
|
`, { mode: 384 });
|
|
20095
|
-
await
|
|
20162
|
+
await chmod5(path, 384);
|
|
20096
20163
|
}
|
|
20097
20164
|
async function writeProviderEnv(selection, agentPubkey) {
|
|
20098
20165
|
const values = providerEnvironment(selection);
|
|
20099
20166
|
if (Object.keys(values).length === 0)
|
|
20100
20167
|
return void 0;
|
|
20101
|
-
const path =
|
|
20102
|
-
await
|
|
20168
|
+
const path = resolve22(defaultSupervisorRoot(process.env), "beeline", "connect", `${agentPubkey}.env`);
|
|
20169
|
+
await mkdir14(dirname10(path), { recursive: true, mode: 448 });
|
|
20103
20170
|
const contents = Object.entries(values).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join("\n");
|
|
20104
|
-
await
|
|
20171
|
+
await writeFile10(path, `${contents}
|
|
20105
20172
|
`, { mode: 384 });
|
|
20106
|
-
await
|
|
20173
|
+
await chmod5(path, 384);
|
|
20107
20174
|
return path;
|
|
20108
20175
|
}
|
|
20109
20176
|
async function runInstalledFinish(binary, grantPath) {
|
|
@@ -20164,7 +20231,7 @@ async function runConnectWizard(code, fetchImpl, eventSubscriptions, accessPolic
|
|
|
20164
20231
|
await finishConnectedAgentPairing(baseUrl, pairingCode, grant.workspace_joined, eventSubscriptions, fetchImpl);
|
|
20165
20232
|
const installedRelease = await brassSpinner("Installing the Beeline daemon\u2026", () => installCurrentRelease(fetchImpl), (release) => `Installed Beeline helper ${release.version}`);
|
|
20166
20233
|
const llmEnvFile = await writeProviderEnv(selection, grant.agent_pubkey);
|
|
20167
|
-
const grantPath =
|
|
20234
|
+
const grantPath = resolve22(defaultSupervisorRoot(process.env), "beeline", "connect", `grant-${process.pid}-${Date.now()}.json`);
|
|
20168
20235
|
await writePrivateJson(grantPath, {
|
|
20169
20236
|
agentSecretKey: grant.agent_secret_key,
|
|
20170
20237
|
bodySecretKey: grant.body_secret_key,
|
|
@@ -20246,11 +20313,11 @@ async function runConnectFinishCommand(path) {
|
|
|
20246
20313
|
throw new Error("connect-finish may run only from the canonical installed Beeline launcher");
|
|
20247
20314
|
}
|
|
20248
20315
|
try {
|
|
20249
|
-
const grant = JSON.parse(await readFile10(
|
|
20316
|
+
const grant = JSON.parse(await readFile10(resolve22(path), "utf8"));
|
|
20250
20317
|
if (!isDevicePairingGrant(grant))
|
|
20251
20318
|
throw new Error("device connection grant is invalid");
|
|
20252
20319
|
const connected = await completeDevicePairing(grant);
|
|
20253
|
-
await unlink2(
|
|
20320
|
+
await unlink2(resolve22(path));
|
|
20254
20321
|
const providerEnv = grant.llmEnvFile ? await readFile10(grant.llmEnvFile, "utf8").catch(() => "") : "";
|
|
20255
20322
|
const apiKey = (/^OPENROUTER_API_KEY=(\S+)/m.exec(providerEnv)?.[1] ?? "").replace(/^["']|["']$/g, "");
|
|
20256
20323
|
const model = openRouterModelId(grant.model, { OPENROUTER_API_KEY: apiKey });
|
|
@@ -20279,20 +20346,20 @@ init_self_update_manifest();
|
|
|
20279
20346
|
// apps/body/dist/managed-update.js
|
|
20280
20347
|
init_self_update();
|
|
20281
20348
|
import { spawn as spawn6 } from "node:child_process";
|
|
20282
|
-
import { mkdir as
|
|
20283
|
-
import { dirname as dirname12, resolve as
|
|
20349
|
+
import { mkdir as mkdir16, rm as rm6, stat as stat2, writeFile as writeFile12 } from "node:fs/promises";
|
|
20350
|
+
import { dirname as dirname12, resolve as resolve24 } from "node:path";
|
|
20284
20351
|
|
|
20285
20352
|
// apps/body/dist/update-rollback-alert.js
|
|
20286
|
-
import { mkdir as
|
|
20287
|
-
import { dirname as dirname11, resolve as
|
|
20353
|
+
import { mkdir as mkdir15, readFile as readFile11, rename as rename4, writeFile as writeFile11 } from "node:fs/promises";
|
|
20354
|
+
import { dirname as dirname11, resolve as resolve23 } from "node:path";
|
|
20288
20355
|
function updateRollbackAlertPath(runtimeDir) {
|
|
20289
|
-
return
|
|
20356
|
+
return resolve23(runtimeDir, "update-rollback-alert.json");
|
|
20290
20357
|
}
|
|
20291
20358
|
async function writeAlert(runtimeDir, alert) {
|
|
20292
20359
|
const path = updateRollbackAlertPath(runtimeDir);
|
|
20293
20360
|
const staged = `${path}.${process.pid}.tmp`;
|
|
20294
|
-
await
|
|
20295
|
-
await
|
|
20361
|
+
await mkdir15(dirname11(path), { recursive: true });
|
|
20362
|
+
await writeFile11(staged, `${JSON.stringify(alert, null, 2)}
|
|
20296
20363
|
`, { mode: 384 });
|
|
20297
20364
|
await rename4(staged, path);
|
|
20298
20365
|
}
|
|
@@ -20329,13 +20396,13 @@ var LOCK_STALE_MS = UPDATE_WORKER_DEADLINE_MS + 5 * 6e4;
|
|
|
20329
20396
|
var DEFAULT_UPDATE_INITIAL_DELAY_MS = 0;
|
|
20330
20397
|
async function withInstallLock(layout, work, options = {}) {
|
|
20331
20398
|
const now2 = options.now ?? Date.now;
|
|
20332
|
-
const lock =
|
|
20399
|
+
const lock = resolve24(layout.releasesRoot, ".state", "install.lock");
|
|
20333
20400
|
const deadline = now2() + (options.waitMs ?? 1e4);
|
|
20334
|
-
await
|
|
20401
|
+
await mkdir16(dirname12(lock), { recursive: true });
|
|
20335
20402
|
for (; ; ) {
|
|
20336
20403
|
try {
|
|
20337
|
-
await
|
|
20338
|
-
await
|
|
20404
|
+
await mkdir16(lock);
|
|
20405
|
+
await writeFile12(resolve24(lock, "owner"), `${process.pid}
|
|
20339
20406
|
${now2()}
|
|
20340
20407
|
`, "utf8");
|
|
20341
20408
|
break;
|
|
@@ -20458,7 +20525,7 @@ var ManagedUpdateHandoff = class _ManagedUpdateHandoff {
|
|
|
20458
20525
|
if (!attempt || attempt.releaseId !== desiredRelease || attempt.status !== "pending") {
|
|
20459
20526
|
const from = await readInstalledBundleIdentity({
|
|
20460
20527
|
...this.#layout,
|
|
20461
|
-
libDir:
|
|
20528
|
+
libDir: resolve24(this.#layout.releasesRoot, this.#loadedRelease)
|
|
20462
20529
|
}).catch(() => void 0) ?? {};
|
|
20463
20530
|
const to = await readInstalledBundleIdentity(this.#layout).catch(() => void 0) ?? {};
|
|
20464
20531
|
const record2 = {
|
|
@@ -20745,7 +20812,7 @@ async function proveLoadedReleaseReady(layout, runtimeDir, loadedRelease, option
|
|
|
20745
20812
|
});
|
|
20746
20813
|
if (!accepted)
|
|
20747
20814
|
return false;
|
|
20748
|
-
await
|
|
20815
|
+
await writeFile12(resolve24(runtimeDir, "daemon-ready.json"), `${JSON.stringify({
|
|
20749
20816
|
readyAt: (options.now ?? Date.now)(),
|
|
20750
20817
|
loadedRelease,
|
|
20751
20818
|
functionalProof: options.functionalProof
|
|
@@ -20950,12 +21017,12 @@ async function runUpdateCommand(args) {
|
|
|
20950
21017
|
init_self_update();
|
|
20951
21018
|
|
|
20952
21019
|
// apps/body/dist/daemon-failure.js
|
|
20953
|
-
import { mkdir as
|
|
20954
|
-
import { dirname as dirname13, resolve as
|
|
21020
|
+
import { mkdir as mkdir17, readFile as readFile12, rename as rename5, rm as rm7, writeFile as writeFile13 } from "node:fs/promises";
|
|
21021
|
+
import { dirname as dirname13, resolve as resolve25 } from "node:path";
|
|
20955
21022
|
var DAEMON_FAILURE_LIMIT = 3;
|
|
20956
21023
|
var DAEMON_FAILURE_WINDOW_MS = 5 * 6e4;
|
|
20957
21024
|
function daemonFailurePath(runtimeDir) {
|
|
20958
|
-
return
|
|
21025
|
+
return resolve25(runtimeDir, "daemon-distress.json");
|
|
20959
21026
|
}
|
|
20960
21027
|
async function readFailureRecord(runtimeDir) {
|
|
20961
21028
|
try {
|
|
@@ -20971,8 +21038,8 @@ async function readFailureRecord(runtimeDir) {
|
|
|
20971
21038
|
async function writeFailureRecord(runtimeDir, record2) {
|
|
20972
21039
|
const path = daemonFailurePath(runtimeDir);
|
|
20973
21040
|
const staged = `${path}.${process.pid}.tmp`;
|
|
20974
|
-
await
|
|
20975
|
-
await
|
|
21041
|
+
await mkdir17(dirname13(path), { recursive: true, mode: 448 });
|
|
21042
|
+
await writeFile13(staged, `${JSON.stringify(record2, null, 2)}
|
|
20976
21043
|
`, { mode: 384 });
|
|
20977
21044
|
await rename5(staged, path);
|
|
20978
21045
|
}
|
|
@@ -20994,9 +21061,9 @@ async function clearDaemonStartFailures(runtimeDir) {
|
|
|
20994
21061
|
}
|
|
20995
21062
|
|
|
20996
21063
|
// apps/body/dist/update-functional-probe.js
|
|
20997
|
-
import { mkdir as
|
|
21064
|
+
import { mkdir as mkdir18, rm as rm8 } from "node:fs/promises";
|
|
20998
21065
|
import { homedir as homedir10 } from "node:os";
|
|
20999
|
-
import { resolve as
|
|
21066
|
+
import { resolve as resolve26 } from "node:path";
|
|
21000
21067
|
var UPDATE_PROBE_SESSION_TIMEOUT_MS = 1e4;
|
|
21001
21068
|
var UPDATE_PROBE_SESSION_OPEN_TIMEOUT_MS = 2e4;
|
|
21002
21069
|
var UPDATE_PROBE_TURN_TIMEOUT_MS = 45e3;
|
|
@@ -21042,11 +21109,11 @@ async function runUpdateFunctionalProbe(input) {
|
|
|
21042
21109
|
if (input.sandboxRequired && !input.config.bwrapPath) {
|
|
21043
21110
|
throw new UpdateFunctionalProbeError("sandbox-unavailable", "the configured bubblewrap boundary did not pass its startup self-test");
|
|
21044
21111
|
}
|
|
21045
|
-
const root = input.probeRoot ??
|
|
21046
|
-
const cwd =
|
|
21047
|
-
const homeRoot =
|
|
21112
|
+
const root = input.probeRoot ?? resolve26(input.runtimeDir, "update-functional-probe");
|
|
21113
|
+
const cwd = resolve26(root, "checkout");
|
|
21114
|
+
const homeRoot = resolve26(root, "agent-home");
|
|
21048
21115
|
await rm8(root, { recursive: true, force: true });
|
|
21049
|
-
await
|
|
21116
|
+
await mkdir18(cwd, { recursive: true, mode: 448 });
|
|
21050
21117
|
let client;
|
|
21051
21118
|
try {
|
|
21052
21119
|
const agentEnv = {
|
|
@@ -21075,7 +21142,7 @@ async function runUpdateFunctionalProbe(input) {
|
|
|
21075
21142
|
const { stateDirs, tmpDir } = harnessStateDirsFromEnv(agentEnv);
|
|
21076
21143
|
const operatorHome = input.config.operatorHome ?? homedir10();
|
|
21077
21144
|
const homeStateDirs = harnessHomeStateDirs(command, agentEnv.HOME ?? operatorHome);
|
|
21078
|
-
await Promise.all(homeStateDirs.map((dir) =>
|
|
21145
|
+
await Promise.all(homeStateDirs.map((dir) => mkdir18(dir, { recursive: true })));
|
|
21079
21146
|
spawnCommand = wrapAgentCommand({
|
|
21080
21147
|
bwrapPath: input.config.bwrapPath,
|
|
21081
21148
|
spec: {
|
|
@@ -21211,7 +21278,7 @@ async function probeReleaseInSubprocess(input) {
|
|
|
21211
21278
|
return { kind: "unavailable", reason: `release ${input.releaseId} has no runnable CLI entrypoint` };
|
|
21212
21279
|
}
|
|
21213
21280
|
const timeoutMs = input.timeoutMs ?? CURRENT_RELEASE_PROBE_TIMEOUT_MS;
|
|
21214
|
-
return new Promise((
|
|
21281
|
+
return new Promise((resolve29) => {
|
|
21215
21282
|
const child = spawn7(input.execPath ?? process.execPath, [entrypoint, UPDATE_PROBE_COMMAND, "--config", input.runtimeConfigPath], { env: input.env ?? process.env, stdio: ["ignore", "pipe", "pipe"] });
|
|
21216
21283
|
let stdout6 = "";
|
|
21217
21284
|
let stderr = "";
|
|
@@ -21221,7 +21288,7 @@ async function probeReleaseInSubprocess(input) {
|
|
|
21221
21288
|
return;
|
|
21222
21289
|
settled = true;
|
|
21223
21290
|
clearTimeout(timer);
|
|
21224
|
-
|
|
21291
|
+
resolve29(outcome);
|
|
21225
21292
|
};
|
|
21226
21293
|
const timer = setTimeout(() => {
|
|
21227
21294
|
child.kill("SIGKILL");
|
|
@@ -21300,8 +21367,8 @@ async function runUpdateProbeCommand(args, options = {}) {
|
|
|
21300
21367
|
}
|
|
21301
21368
|
|
|
21302
21369
|
// apps/body/dist/release-status.js
|
|
21303
|
-
import { readFile as readFile13, readdir as readdir5, rename as rename6, writeFile as
|
|
21304
|
-
import { resolve as
|
|
21370
|
+
import { readFile as readFile13, readdir as readdir5, rename as rename6, writeFile as writeFile14 } from "node:fs/promises";
|
|
21371
|
+
import { resolve as resolve27 } from "node:path";
|
|
21305
21372
|
var DAEMON_RELEASE_STATUS_FILE = "release-status.json";
|
|
21306
21373
|
var RELEASE_VERSION = /^v\d+\.\d+\.\d+$/;
|
|
21307
21374
|
var SOURCE_SHA = /^[0-9a-f]{7,64}$/;
|
|
@@ -21318,9 +21385,9 @@ async function writeDaemonReleaseStatus(runtimeDir, agentPubkey, identity, optio
|
|
|
21318
21385
|
pid: options.pid ?? process.pid,
|
|
21319
21386
|
readyAt: (options.now?.() ?? /* @__PURE__ */ new Date()).toISOString()
|
|
21320
21387
|
};
|
|
21321
|
-
const target =
|
|
21388
|
+
const target = resolve27(runtimeDir, DAEMON_RELEASE_STATUS_FILE);
|
|
21322
21389
|
const temporary = `${target}.${status.pid}.tmp`;
|
|
21323
|
-
await
|
|
21390
|
+
await writeFile14(temporary, `${JSON.stringify(status, null, 2)}
|
|
21324
21391
|
`, { mode: 384 });
|
|
21325
21392
|
await rename6(temporary, target);
|
|
21326
21393
|
return status;
|
|
@@ -21378,7 +21445,7 @@ async function runStoredDaemon(pathOrPointer) {
|
|
|
21378
21445
|
runtime = activated.runtime;
|
|
21379
21446
|
const daemonApi = activated.client;
|
|
21380
21447
|
const agent = runtimeAgentCommand(runtime);
|
|
21381
|
-
await
|
|
21448
|
+
await writeFile15(resolve28(dirname15(configPath), "daemon.pid"), `${process.pid}
|
|
21382
21449
|
`, { mode: 384 });
|
|
21383
21450
|
const env = {
|
|
21384
21451
|
...process.env,
|
|
@@ -21386,7 +21453,7 @@ async function runStoredDaemon(pathOrPointer) {
|
|
|
21386
21453
|
BUZZ_DEV_MCP_BIN: runtime.mcpBinary
|
|
21387
21454
|
};
|
|
21388
21455
|
const config = loadBodyConfig({
|
|
21389
|
-
workspaceRoot:
|
|
21456
|
+
workspaceRoot: resolve28(dirname15(configPath), "workspace"),
|
|
21390
21457
|
llmEnvFile: runtime.llmEnvFile,
|
|
21391
21458
|
env,
|
|
21392
21459
|
agent
|
|
@@ -21556,7 +21623,7 @@ async function runStoredDaemon(pathOrPointer) {
|
|
|
21556
21623
|
throw error;
|
|
21557
21624
|
} finally {
|
|
21558
21625
|
await notifier.stopping(stoppingStatus).catch(() => void 0);
|
|
21559
|
-
const pidPath =
|
|
21626
|
+
const pidPath = resolve28(dirname15(configPath), "daemon.pid");
|
|
21560
21627
|
const recorded = Number((await readFile14(pidPath, "utf8").catch(() => "")).trim());
|
|
21561
21628
|
if (recorded === process.pid) {
|
|
21562
21629
|
await unlink3(pidPath).catch(() => void 0);
|
|
@@ -21577,6 +21644,21 @@ async function main() {
|
|
|
21577
21644
|
console.log(JSON.stringify(await runManagedUpdateWorker()));
|
|
21578
21645
|
return;
|
|
21579
21646
|
}
|
|
21647
|
+
if (command === "corner-read-token") {
|
|
21648
|
+
const configFlag = args.indexOf("--config");
|
|
21649
|
+
const roomFlag = args.indexOf("--room");
|
|
21650
|
+
const configPath = configFlag >= 0 ? args[configFlag + 1] : void 0;
|
|
21651
|
+
const roomId = roomFlag >= 0 ? args[roomFlag + 1] : void 0;
|
|
21652
|
+
if (!configPath || !roomId)
|
|
21653
|
+
throw new Error("corner-read-token requires --config and --room");
|
|
21654
|
+
const activated = await activateDaemonTransport(resolve28(configPath));
|
|
21655
|
+
if (!activated)
|
|
21656
|
+
throw new Error("corner-read-token requires monolith transport");
|
|
21657
|
+
const credential = await activated.client.execute("getRoomGitHubToken", { roomId });
|
|
21658
|
+
process.stdout.write(`${credential.token}
|
|
21659
|
+
`);
|
|
21660
|
+
return;
|
|
21661
|
+
}
|
|
21580
21662
|
if (command === "connect") {
|
|
21581
21663
|
const subscribeFlag = args.indexOf("--subscribe");
|
|
21582
21664
|
const subscribe = subscribeFlag >= 0 ? parseConnectSubscriptions(args[subscribeFlag + 1]) : [];
|
|
@@ -21631,7 +21713,7 @@ async function main() {
|
|
|
21631
21713
|
}
|
|
21632
21714
|
if (!configPath)
|
|
21633
21715
|
throw new Error("daemon requires --config <runtime.json> or --agent <pubkey>");
|
|
21634
|
-
await runStoredDaemon(
|
|
21716
|
+
await runStoredDaemon(resolve28(configPath));
|
|
21635
21717
|
return;
|
|
21636
21718
|
}
|
|
21637
21719
|
if (command === "update") {
|