@epoch-agent/cli 0.12.0 → 0.14.0
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/dist/index.js +94 -52
- package/dist/tui-entry.js +65 -53
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -510,6 +510,10 @@ var SECTION_FIELDS = {
|
|
|
510
510
|
autoPrune: (v) => v === "true" || v === "false",
|
|
511
511
|
retentionDays: isPositiveInt,
|
|
512
512
|
vacuumAfterPrune: (v) => v === "true" || v === "false"
|
|
513
|
+
},
|
|
514
|
+
automation: {
|
|
515
|
+
keepRuns: isPositiveInt,
|
|
516
|
+
maxRecordingMb: isPositiveInt
|
|
513
517
|
}
|
|
514
518
|
};
|
|
515
519
|
function knownKeys() {
|
|
@@ -1325,7 +1329,7 @@ import { existsSync as existsSync6 } from "fs";
|
|
|
1325
1329
|
import { dirname as dirname4, join as join5 } from "path";
|
|
1326
1330
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
1327
1331
|
import { isNonInteractive as isNonInteractive8, OPERATION_TYPES as OPERATION_TYPES3, PERMISSION_LEVELS as PERMISSION_LEVELS3 } from "@epoch-agent/core";
|
|
1328
|
-
import { t as t25 } from "@epoch-agent/infra";
|
|
1332
|
+
import { guardSpawn as guardSpawn3, t as t25 } from "@epoch-agent/infra";
|
|
1329
1333
|
import {
|
|
1330
1334
|
HEADLESS_INPUT_FORMATS as HEADLESS_INPUT_FORMATS2,
|
|
1331
1335
|
HEADLESS_OUTPUT_FORMATS as HEADLESS_OUTPUT_FORMATS2,
|
|
@@ -2330,23 +2334,31 @@ import { execFile } from "child_process";
|
|
|
2330
2334
|
import { randomBytes } from "crypto";
|
|
2331
2335
|
import { mkdirSync as mkdirSync4 } from "fs";
|
|
2332
2336
|
import { basename, join as join4, resolve as resolve3 } from "path";
|
|
2333
|
-
import { t as t16, worktreesDir } from "@epoch-agent/infra";
|
|
2337
|
+
import { guardSpawn, t as t16, worktreesDir } from "@epoch-agent/infra";
|
|
2334
2338
|
var TIMEOUT_MS = 6e4;
|
|
2335
2339
|
function git(args, cwd) {
|
|
2336
2340
|
return new Promise((done) => {
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2341
|
+
guardSpawn(
|
|
2342
|
+
() => execFile(
|
|
2343
|
+
"git",
|
|
2344
|
+
args,
|
|
2345
|
+
{ cwd, timeout: TIMEOUT_MS, encoding: "utf-8", windowsHide: true },
|
|
2346
|
+
(err2, stdout, stderr) => {
|
|
2347
|
+
const code = err2?.code;
|
|
2348
|
+
done({
|
|
2349
|
+
ok: !err2,
|
|
2350
|
+
stdout,
|
|
2351
|
+
stderr: stderr || "",
|
|
2352
|
+
missing: code === "ENOENT"
|
|
2353
|
+
});
|
|
2354
|
+
}
|
|
2355
|
+
),
|
|
2356
|
+
(err2) => done({
|
|
2357
|
+
ok: false,
|
|
2358
|
+
stdout: "",
|
|
2359
|
+
stderr: `${err2.message} (cwd=${cwd})`,
|
|
2360
|
+
missing: err2.code === "ENOENT" || err2.code === "ENOTDIR"
|
|
2361
|
+
})
|
|
2350
2362
|
);
|
|
2351
2363
|
});
|
|
2352
2364
|
}
|
|
@@ -2579,7 +2591,7 @@ import {
|
|
|
2579
2591
|
matchPreauthorization,
|
|
2580
2592
|
mergeHeadlessPolicy
|
|
2581
2593
|
} from "@epoch-agent/core";
|
|
2582
|
-
import { createStreamDecoder, t as t18 } from "@epoch-agent/infra";
|
|
2594
|
+
import { createStreamDecoder, guardSpawn as guardSpawn2, t as t18 } from "@epoch-agent/infra";
|
|
2583
2595
|
import { APPROVAL_OUTCOMES as APPROVAL_OUTCOMES2, isApprovalOutcome as isApprovalOutcome2 } from "@epoch-agent/protocol";
|
|
2584
2596
|
var APPROVER_TIMEOUT_MS = 6e4;
|
|
2585
2597
|
var MAX_STDOUT_BYTES = 64 * 1024;
|
|
@@ -2633,11 +2645,15 @@ function askExternalApprover(program2, payload, opts = {}) {
|
|
|
2633
2645
|
settled = true;
|
|
2634
2646
|
resolve5(v);
|
|
2635
2647
|
};
|
|
2636
|
-
const child =
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2648
|
+
const child = guardSpawn2(
|
|
2649
|
+
() => spawn2(program2, {
|
|
2650
|
+
shell: true,
|
|
2651
|
+
...opts.cwd ? { cwd: opts.cwd } : {},
|
|
2652
|
+
stdio: ["pipe", "pipe", "inherit"]
|
|
2653
|
+
}),
|
|
2654
|
+
(err2) => settle({ ok: false, why: t18("approver.spawn_failed", { message: err2.message }) })
|
|
2655
|
+
);
|
|
2656
|
+
if (!child) return;
|
|
2641
2657
|
const timer = setTimeout(() => {
|
|
2642
2658
|
child.kill("SIGKILL");
|
|
2643
2659
|
settle({ ok: false, why: t18("approver.timeout", { ms: timeoutMs }) });
|
|
@@ -3435,6 +3451,10 @@ function registerSessionsCommand(program2) {
|
|
|
3435
3451
|
...opts.archivedOnly ? { archived: true } : {},
|
|
3436
3452
|
...opts.includePinned ? { includePinned: true } : {}
|
|
3437
3453
|
};
|
|
3454
|
+
const sweepOrphans = () => {
|
|
3455
|
+
const swept = withSessions((sm) => sm.sweepOrphans({ olderThanMs, now: Date.now() }));
|
|
3456
|
+
if (swept > 0) log7(t24("sessions.prune_swept", { count: swept, days }));
|
|
3457
|
+
};
|
|
3438
3458
|
const { victims, openCount } = withSessions((sm) => ({
|
|
3439
3459
|
victims: sm.pruneCandidates(select2),
|
|
3440
3460
|
openCount: sm.openPruneMatches({
|
|
@@ -3442,16 +3462,22 @@ function registerSessionsCommand(program2) {
|
|
|
3442
3462
|
...opts.includePinned ? { includePinned: true } : {}
|
|
3443
3463
|
})
|
|
3444
3464
|
}));
|
|
3465
|
+
const sweepNote = () => {
|
|
3466
|
+
if (openCount === 0) return;
|
|
3467
|
+
log7(t24("sessions.prune_open_skipped", { count: openCount }));
|
|
3468
|
+
if (!opts.yes) log7(t24("sessions.prune_sweep_preview", { days }));
|
|
3469
|
+
};
|
|
3445
3470
|
if (victims.length === 0) {
|
|
3446
3471
|
log7(t24("sessions.prune_none", { days }));
|
|
3447
|
-
|
|
3472
|
+
sweepNote();
|
|
3473
|
+
if (opts.yes) sweepOrphans();
|
|
3448
3474
|
return;
|
|
3449
3475
|
}
|
|
3450
3476
|
log7(t24("sessions.prune_head"));
|
|
3451
3477
|
for (const s of victims) {
|
|
3452
3478
|
log7(` ${s.id.slice(0, SHORT_ID_LEN2)} ${whenOf(s.updatedAt)} ${titleOf(s)}`);
|
|
3453
3479
|
}
|
|
3454
|
-
|
|
3480
|
+
sweepNote();
|
|
3455
3481
|
if (!opts.yes) {
|
|
3456
3482
|
log7(t24("sessions.prune_preview", { count: victims.length, days }));
|
|
3457
3483
|
return;
|
|
@@ -3461,6 +3487,7 @@ function registerSessionsCommand(program2) {
|
|
|
3461
3487
|
for (const s of victims) if (sm.delete(s.id)) removed++;
|
|
3462
3488
|
});
|
|
3463
3489
|
log7(t24("sessions.prune_done", { count: removed }));
|
|
3490
|
+
sweepOrphans();
|
|
3464
3491
|
if (removed > 0) {
|
|
3465
3492
|
const ratio = withSessions((sm) => sm.freelistRatio());
|
|
3466
3493
|
if (ratio > VACUUM_MIN_FREELIST_RATIO) {
|
|
@@ -3683,17 +3710,22 @@ async function launchTui(resumeId) {
|
|
|
3683
3710
|
const cmd = process.execPath;
|
|
3684
3711
|
const args = isSource ? ["--import", "tsx", target] : [target];
|
|
3685
3712
|
const { spawn: spawn3 } = await import("child_process");
|
|
3686
|
-
const child = spawn3(cmd, args, {
|
|
3687
|
-
stdio: "inherit",
|
|
3688
|
-
env: { ...process.env, ...resumeId ? { EPOCH_RESUME: resumeId } : {} }
|
|
3689
|
-
});
|
|
3690
3713
|
await new Promise((done) => {
|
|
3691
|
-
|
|
3714
|
+
const failToStart = (err2) => {
|
|
3692
3715
|
process.stderr.write(`${t25("run.tui_spawn_failed", { message: err2.message })}
|
|
3693
3716
|
`);
|
|
3694
3717
|
process.exitCode = EXIT_CODES.FAILURE;
|
|
3695
3718
|
done();
|
|
3696
|
-
}
|
|
3719
|
+
};
|
|
3720
|
+
const child = guardSpawn3(
|
|
3721
|
+
() => spawn3(cmd, args, {
|
|
3722
|
+
stdio: "inherit",
|
|
3723
|
+
env: { ...process.env, ...resumeId ? { EPOCH_RESUME: resumeId } : {} }
|
|
3724
|
+
}),
|
|
3725
|
+
failToStart
|
|
3726
|
+
);
|
|
3727
|
+
if (!child) return;
|
|
3728
|
+
child.on("error", failToStart);
|
|
3697
3729
|
child.on("exit", (code, signal) => {
|
|
3698
3730
|
process.exitCode = signal ? EXIT_CODES.FAILURE : code ?? EXIT_CODES.SUCCESS;
|
|
3699
3731
|
done();
|
|
@@ -4039,6 +4071,7 @@ function buildInput(opts, trigger, permission) {
|
|
|
4039
4071
|
prompt: opts.prompt ?? "",
|
|
4040
4072
|
...opts.workdir ? { workDir: opts.workdir } : {},
|
|
4041
4073
|
...opts.model ? { model: opts.model } : {},
|
|
4074
|
+
...opts.role ? { role: opts.role } : {},
|
|
4042
4075
|
permission,
|
|
4043
4076
|
...opts.allowTool ? { allowTools: opts.allowTool } : {},
|
|
4044
4077
|
allowOperations: parseOperations(opts.allowOperation),
|
|
@@ -4261,6 +4294,7 @@ async function runShow(idOrPrefix) {
|
|
|
4261
4294
|
);
|
|
4262
4295
|
log9(` ${t32("schedule.field_workdir")}: ${def.workDir}`);
|
|
4263
4296
|
if (def.model) log9(` ${t32("schedule.field_model")}: ${def.model}`);
|
|
4297
|
+
if (def.role) log9(` ${t32("schedule.field_role")}: ${def.role}`);
|
|
4264
4298
|
log9(` ${t32("schedule.field_permission")}: ${permissionLabel(def.permission)}`);
|
|
4265
4299
|
log9(
|
|
4266
4300
|
` ${t32("schedule.field_limits")}: ` + t32("schedule.limits_value", {
|
|
@@ -4270,6 +4304,11 @@ async function runShow(idOrPrefix) {
|
|
|
4270
4304
|
})
|
|
4271
4305
|
);
|
|
4272
4306
|
log9(` ${t32("schedule.field_backend")}: ${def.osBackend} ${def.osTaskId || "\u2014"}`);
|
|
4307
|
+
log9(
|
|
4308
|
+
` ${t32("schedule.field_session")}: ` + t32(
|
|
4309
|
+
def.showInSessionList === true ? "schedule.session_listed" : "schedule.session_discarded"
|
|
4310
|
+
)
|
|
4311
|
+
);
|
|
4273
4312
|
log9(` ${t32("schedule.field_prompt")}:`);
|
|
4274
4313
|
for (const line of def.prompt.split("\n")) log9(` ${line}`);
|
|
4275
4314
|
log9("");
|
|
@@ -4347,7 +4386,7 @@ function printRecording(run) {
|
|
|
4347
4386
|
var DEFAULT_LOG_LIMIT = 10;
|
|
4348
4387
|
function registerScheduleCommand(program2) {
|
|
4349
4388
|
const cmd = program2.command("schedule").description(t33("cli.schedule.summary"));
|
|
4350
|
-
cmd.command("add").description(t33("cli.schedule.add")).option("--name <name>", t33("cli.schedule.opt_name")).option("--prompt <text>", t33("cli.schedule.opt_prompt")).option("--daily <HH:mm>", t33("cli.schedule.opt_daily")).option("--weekly <days>", t33("cli.schedule.opt_weekly")).option("--monthly <days>", t33("cli.schedule.opt_monthly")).option("--every <interval>", t33("cli.schedule.opt_every")).option("--once <YYYY-MM-DD>", t33("cli.schedule.opt_once")).option("--at <HH:mm>", t33("cli.schedule.opt_at")).option("--start <YYYY-MM-DD>", t33("cli.schedule.opt_start")).option("--end <YYYY-MM-DD>", t33("cli.schedule.opt_end")).option("--workdir <dir>", t33("cli.schedule.opt_workdir")).option("--model <model>", t33("cli.schedule.opt_model")).option("--permission <level>", t33("cli.schedule.opt_permission")).option("--allow-tool <name>", t33("cli.schedule.opt_allow_tool"), collect3, []).option("--allow-operation <type>", t33("cli.schedule.opt_allow_operation"), collect3, []).option("--allow-rule <rule>", t33("cli.schedule.opt_allow_rule"), collect3, []).option("--max-turns <n>", t33("cli.schedule.opt_max_turns")).option("--budget <usd>", t33("cli.schedule.opt_budget")).option("--timeout <minutes>", t33("cli.schedule.opt_timeout")).option("--disabled", t33("cli.schedule.opt_disabled")).option("--i-understand-bypass", t33("cli.schedule.opt_bypass_ack")).action((opts) => runAdd(opts));
|
|
4389
|
+
cmd.command("add").description(t33("cli.schedule.add")).option("--name <name>", t33("cli.schedule.opt_name")).option("--prompt <text>", t33("cli.schedule.opt_prompt")).option("--daily <HH:mm>", t33("cli.schedule.opt_daily")).option("--weekly <days>", t33("cli.schedule.opt_weekly")).option("--monthly <days>", t33("cli.schedule.opt_monthly")).option("--every <interval>", t33("cli.schedule.opt_every")).option("--once <YYYY-MM-DD>", t33("cli.schedule.opt_once")).option("--at <HH:mm>", t33("cli.schedule.opt_at")).option("--start <YYYY-MM-DD>", t33("cli.schedule.opt_start")).option("--end <YYYY-MM-DD>", t33("cli.schedule.opt_end")).option("--workdir <dir>", t33("cli.schedule.opt_workdir")).option("--model <model>", t33("cli.schedule.opt_model")).option("--role <name>", t33("cli.schedule.opt_role")).option("--permission <level>", t33("cli.schedule.opt_permission")).option("--allow-tool <name>", t33("cli.schedule.opt_allow_tool"), collect3, []).option("--allow-operation <type>", t33("cli.schedule.opt_allow_operation"), collect3, []).option("--allow-rule <rule>", t33("cli.schedule.opt_allow_rule"), collect3, []).option("--max-turns <n>", t33("cli.schedule.opt_max_turns")).option("--budget <usd>", t33("cli.schedule.opt_budget")).option("--timeout <minutes>", t33("cli.schedule.opt_timeout")).option("--disabled", t33("cli.schedule.opt_disabled")).option("--i-understand-bypass", t33("cli.schedule.opt_bypass_ack")).action((opts) => runAdd(opts));
|
|
4351
4390
|
cmd.command("list", { isDefault: true }).description(t33("cli.schedule.list")).action(() => runList());
|
|
4352
4391
|
cmd.command("show").description(t33("cli.schedule.show")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runShow(id));
|
|
4353
4392
|
cmd.command("enable").description(t33("cli.schedule.enable")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runSetEnabled(id, true));
|
|
@@ -4383,7 +4422,7 @@ import { hasFailure } from "@epoch-agent/protocol";
|
|
|
4383
4422
|
// src/statusline.ts
|
|
4384
4423
|
import { execFile as execFile2 } from "child_process";
|
|
4385
4424
|
import { sanitizeToolOutput } from "@epoch-agent/core";
|
|
4386
|
-
import { shellSpawnArgs, t as t34 } from "@epoch-agent/infra";
|
|
4425
|
+
import { guardSpawn as guardSpawn4, shellSpawnArgs, t as t34 } from "@epoch-agent/infra";
|
|
4387
4426
|
var TIMEOUT_MS2 = 2e3;
|
|
4388
4427
|
var MAX_WIDTH = 60;
|
|
4389
4428
|
var MAX_BUFFER = 64 * 1024;
|
|
@@ -4395,28 +4434,31 @@ function formatStatusLine(stdout) {
|
|
|
4395
4434
|
function runStatusLineCommand(command, cwd) {
|
|
4396
4435
|
const { file, args, options } = shellSpawnArgs(command);
|
|
4397
4436
|
return new Promise((settle) => {
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4437
|
+
guardSpawn4(
|
|
4438
|
+
() => execFile2(
|
|
4439
|
+
file,
|
|
4440
|
+
args,
|
|
4441
|
+
{
|
|
4442
|
+
...options,
|
|
4443
|
+
cwd,
|
|
4444
|
+
timeout: TIMEOUT_MS2,
|
|
4445
|
+
maxBuffer: MAX_BUFFER,
|
|
4446
|
+
encoding: "utf-8",
|
|
4447
|
+
windowsHide: true
|
|
4448
|
+
},
|
|
4449
|
+
(err2, stdout) => {
|
|
4450
|
+
if (err2) {
|
|
4451
|
+
const killed = err2.killed === true;
|
|
4452
|
+
settle({
|
|
4453
|
+
text: null,
|
|
4454
|
+
error: killed ? t34("statusline.timeout", { ms: TIMEOUT_MS2 }) : err2.message.trim()
|
|
4455
|
+
});
|
|
4456
|
+
return;
|
|
4457
|
+
}
|
|
4458
|
+
settle({ text: formatStatusLine(stdout) });
|
|
4417
4459
|
}
|
|
4418
|
-
|
|
4419
|
-
}
|
|
4460
|
+
),
|
|
4461
|
+
(err2) => settle({ text: null, error: err2.message.trim() })
|
|
4420
4462
|
);
|
|
4421
4463
|
});
|
|
4422
4464
|
}
|
package/dist/tui-entry.js
CHANGED
|
@@ -458,7 +458,7 @@ import { listBackgroundTasks } from "@epoch-agent/runtime";
|
|
|
458
458
|
// src/clipboard.ts
|
|
459
459
|
import { execFile } from "child_process";
|
|
460
460
|
import { readImageSize, sniffMediaType } from "@epoch-agent/core";
|
|
461
|
-
import { t as t6 } from "@epoch-agent/infra";
|
|
461
|
+
import { guardSpawn, t as t6 } from "@epoch-agent/infra";
|
|
462
462
|
var MAX_BYTES = 32 * 1024 * 1024;
|
|
463
463
|
var TIMEOUT_MS = 5e3;
|
|
464
464
|
var WINDOWS_SCRIPT = [
|
|
@@ -506,18 +506,21 @@ function clipboardImageCandidates(platform = process.platform, env = process.env
|
|
|
506
506
|
}
|
|
507
507
|
function runCandidate(cmd) {
|
|
508
508
|
return new Promise((done) => {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
509
|
+
guardSpawn(
|
|
510
|
+
() => execFile(
|
|
511
|
+
cmd.command,
|
|
512
|
+
cmd.args,
|
|
513
|
+
{ timeout: TIMEOUT_MS, maxBuffer: MAX_BYTES, encoding: "buffer", windowsHide: true },
|
|
514
|
+
(err, stdout) => {
|
|
515
|
+
const e = err;
|
|
516
|
+
if (e?.code === "ENOENT") {
|
|
517
|
+
done(null);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
done({ stdout: Buffer.from(stdout), code: typeof e?.code === "number" ? e.code : 0 });
|
|
518
521
|
}
|
|
519
|
-
|
|
520
|
-
|
|
522
|
+
),
|
|
523
|
+
() => done(null)
|
|
521
524
|
);
|
|
522
525
|
});
|
|
523
526
|
}
|
|
@@ -700,23 +703,31 @@ import { execFile as execFile2 } from "child_process";
|
|
|
700
703
|
import { writeFileSync } from "fs";
|
|
701
704
|
import { isAbsolute, resolve } from "path";
|
|
702
705
|
import { loadPlugins, readPluginRecords, scanPluginDir } from "@epoch-agent/core";
|
|
703
|
-
import { pluginsStatePath, t as t8 } from "@epoch-agent/infra";
|
|
706
|
+
import { guardSpawn as guardSpawn2, pluginsStatePath, t as t8 } from "@epoch-agent/infra";
|
|
704
707
|
var TIMEOUT_MS2 = 1e4;
|
|
705
708
|
var MAX_BUFFER = 1024 * 1024;
|
|
706
709
|
function run(command, args, cwd) {
|
|
707
710
|
return new Promise((done) => {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
711
|
+
guardSpawn2(
|
|
712
|
+
() => execFile2(
|
|
713
|
+
command,
|
|
714
|
+
args,
|
|
715
|
+
{ cwd, timeout: TIMEOUT_MS2, maxBuffer: MAX_BUFFER, encoding: "utf-8", windowsHide: true },
|
|
716
|
+
(err, stdout, stderr) => {
|
|
717
|
+
const e = err;
|
|
718
|
+
if (e?.code === "ENOENT") {
|
|
719
|
+
done({ stdout: "", ok: false, missing: true, stderr: "" });
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
done({ stdout, ok: !err, missing: false, stderr: stderr || "" });
|
|
717
723
|
}
|
|
718
|
-
|
|
719
|
-
|
|
724
|
+
),
|
|
725
|
+
(err) => done({
|
|
726
|
+
stdout: "",
|
|
727
|
+
ok: false,
|
|
728
|
+
missing: err.code === "ENOENT" || err.code === "ENOTDIR",
|
|
729
|
+
stderr: err.message
|
|
730
|
+
})
|
|
720
731
|
);
|
|
721
732
|
});
|
|
722
733
|
}
|
|
@@ -737,17 +748,15 @@ async function writeClipboardText(text) {
|
|
|
737
748
|
const candidates = clipboardWriteCommand();
|
|
738
749
|
for (const cmd of candidates) {
|
|
739
750
|
const done = await new Promise((resolve_) => {
|
|
740
|
-
const child =
|
|
741
|
-
cmd.command,
|
|
742
|
-
cmd.args,
|
|
743
|
-
{ timeout: TIMEOUT_MS2, windowsHide: true },
|
|
744
|
-
(err) => {
|
|
751
|
+
const child = guardSpawn2(
|
|
752
|
+
() => execFile2(cmd.command, cmd.args, { timeout: TIMEOUT_MS2, windowsHide: true }, (err) => {
|
|
745
753
|
const e = err;
|
|
746
754
|
if (e?.code === "ENOENT") return resolve_("missing");
|
|
747
755
|
resolve_(err ? err.message ?? t8("host_actions.clipboard_write_failed") : "ok");
|
|
748
|
-
}
|
|
756
|
+
}),
|
|
757
|
+
() => resolve_("missing")
|
|
749
758
|
);
|
|
750
|
-
child
|
|
759
|
+
child?.stdin?.end(text, "utf-8");
|
|
751
760
|
});
|
|
752
761
|
if (done === "ok") return;
|
|
753
762
|
if (done === "missing") continue;
|
|
@@ -835,7 +844,7 @@ function contributionLines(dir, name) {
|
|
|
835
844
|
// src/statusline.ts
|
|
836
845
|
import { execFile as execFile3 } from "child_process";
|
|
837
846
|
import { sanitizeToolOutput } from "@epoch-agent/core";
|
|
838
|
-
import { shellSpawnArgs, t as t9 } from "@epoch-agent/infra";
|
|
847
|
+
import { guardSpawn as guardSpawn3, shellSpawnArgs, t as t9 } from "@epoch-agent/infra";
|
|
839
848
|
var TIMEOUT_MS3 = 2e3;
|
|
840
849
|
var MAX_WIDTH = 60;
|
|
841
850
|
var DEFAULT_INTERVAL_MS = 5e3;
|
|
@@ -848,28 +857,31 @@ function formatStatusLine(stdout) {
|
|
|
848
857
|
function runStatusLineCommand(command, cwd) {
|
|
849
858
|
const { file, args, options } = shellSpawnArgs(command);
|
|
850
859
|
return new Promise((settle) => {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
860
|
+
guardSpawn3(
|
|
861
|
+
() => execFile3(
|
|
862
|
+
file,
|
|
863
|
+
args,
|
|
864
|
+
{
|
|
865
|
+
...options,
|
|
866
|
+
cwd,
|
|
867
|
+
timeout: TIMEOUT_MS3,
|
|
868
|
+
maxBuffer: MAX_BUFFER2,
|
|
869
|
+
encoding: "utf-8",
|
|
870
|
+
windowsHide: true
|
|
871
|
+
},
|
|
872
|
+
(err, stdout) => {
|
|
873
|
+
if (err) {
|
|
874
|
+
const killed = err.killed === true;
|
|
875
|
+
settle({
|
|
876
|
+
text: null,
|
|
877
|
+
error: killed ? t9("statusline.timeout", { ms: TIMEOUT_MS3 }) : err.message.trim()
|
|
878
|
+
});
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
settle({ text: formatStatusLine(stdout) });
|
|
870
882
|
}
|
|
871
|
-
|
|
872
|
-
}
|
|
883
|
+
),
|
|
884
|
+
(err) => settle({ text: null, error: err.message.trim() })
|
|
873
885
|
);
|
|
874
886
|
});
|
|
875
887
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epoch-agent/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "epoch-agent CLI 入口",
|
|
6
6
|
"repository": {
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"commander": "^15.0.0",
|
|
23
23
|
"ink": "^7.1.1",
|
|
24
24
|
"react": "^19.2.8",
|
|
25
|
-
"@epoch-agent/
|
|
26
|
-
"@epoch-agent/
|
|
27
|
-
"@epoch-agent/protocol": "0.
|
|
28
|
-
"@epoch-agent/
|
|
29
|
-
"@epoch-agent/
|
|
30
|
-
"@epoch-agent/
|
|
25
|
+
"@epoch-agent/runtime": "0.14.0",
|
|
26
|
+
"@epoch-agent/core": "0.14.0",
|
|
27
|
+
"@epoch-agent/protocol": "0.14.0",
|
|
28
|
+
"@epoch-agent/server": "0.14.0",
|
|
29
|
+
"@epoch-agent/tui": "^0.14.0",
|
|
30
|
+
"@epoch-agent/infra": "0.14.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.20.1",
|