@agentchatme/cli 0.0.134 → 0.0.136
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 +164 -121
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4561,14 +4561,21 @@ function formatRegistrationOffer(cliPath, platform) {
|
|
|
4561
4561
|
return [
|
|
4562
4562
|
"The AgentChat plugin is installed but this agent has no AgentChat identity yet.",
|
|
4563
4563
|
"",
|
|
4564
|
-
"AgentChat gives you (the agent) a handle other agents can DM
|
|
4564
|
+
"AgentChat gives you (the agent) a handle other agents can DM. If the user would like that, offer to set it up \u2014 and FIRST ask whether they already have an AgentChat account (e.g. from another machine, or a Hermes / OpenClaw agent), so you sign them in instead of creating a duplicate:",
|
|
4565
4565
|
...hostNote ? [hostNote] : [],
|
|
4566
|
-
"1. Ask for the email + desired handle (3\u201330 chars, lowercase letters/digits/hyphens, must start with a letter).",
|
|
4567
|
-
`2. Run: ${invoke} register${p} --email <email> --handle <handle>`,
|
|
4568
|
-
`3. A 6-digit code lands in their email; ask for it, then run: ${invoke} register${p} --code <code>`,
|
|
4569
|
-
`4. Then turn on always-on so you stay reachable when they're away \u2014 run: ${invoke} daemon install${p}. It's on by default; tell them in one line they can say "go session-only" any time to switch it off (that runs ${invoke} daemon disable${p}).`,
|
|
4570
4566
|
"",
|
|
4571
|
-
"
|
|
4567
|
+
"NEW to AgentChat (most people):",
|
|
4568
|
+
" 1. Ask for their email + a desired handle (3\u201330 chars, lowercase letters/digits/hyphens, must start with a letter).",
|
|
4569
|
+
` 2. Run: ${invoke} register${p} --email <email> --handle <handle>`,
|
|
4570
|
+
` 3. A 6-digit code lands in their email; ask for it, then run: ${invoke} register${p} --code <code>`,
|
|
4571
|
+
"",
|
|
4572
|
+
"ALREADY have an AgentChat agent \u2014 sign in, do NOT register a second one:",
|
|
4573
|
+
` \u2022 They have its API key (ac_\u2026): ${invoke} login${p} --api-key <ac_\u2026>`,
|
|
4574
|
+
` \u2022 They lost the key: ${invoke} recover${p} --email <email>, then relay the emailed 6-digit code: ${invoke} recover${p} --code <code>`,
|
|
4575
|
+
"",
|
|
4576
|
+
`Then, either way, turn on always-on so you stay reachable when they're away: ${invoke} daemon install${p} (on by default; they can say "go session-only" any time \u2192 ${invoke} daemon disable${p}).`,
|
|
4577
|
+
"",
|
|
4578
|
+
"Do not push the offer \u2014 one short ask is plenty. If declined, drop the topic for the rest of the session."
|
|
4572
4579
|
].join("\n");
|
|
4573
4580
|
}
|
|
4574
4581
|
|
|
@@ -4702,8 +4709,8 @@ async function runStopHook(platform) {
|
|
|
4702
4709
|
}
|
|
4703
4710
|
|
|
4704
4711
|
// src/commands/identity.ts
|
|
4705
|
-
import * as
|
|
4706
|
-
import * as
|
|
4712
|
+
import * as fs6 from "fs";
|
|
4713
|
+
import * as path7 from "path";
|
|
4707
4714
|
import * as readline from "readline/promises";
|
|
4708
4715
|
|
|
4709
4716
|
// ../node_modules/.pnpm/agentchatme@1.0.2_ws@8.21.1/node_modules/agentchatme/dist/index.js
|
|
@@ -6299,6 +6306,107 @@ function removeCodex() {
|
|
|
6299
6306
|
return removed;
|
|
6300
6307
|
}
|
|
6301
6308
|
|
|
6309
|
+
// src/commands/daemon.ts
|
|
6310
|
+
import * as fs5 from "fs";
|
|
6311
|
+
import * as os3 from "os";
|
|
6312
|
+
import * as path6 from "path";
|
|
6313
|
+
import { spawnSync } from "child_process";
|
|
6314
|
+
var DAEMON_PKG = "@agentchatme/daemon";
|
|
6315
|
+
function runtimeDir() {
|
|
6316
|
+
return path6.join(os3.homedir(), ".agentchat", "daemon-runtime");
|
|
6317
|
+
}
|
|
6318
|
+
function daemonEntry() {
|
|
6319
|
+
return path6.join(runtimeDir(), "node_modules", "@agentchatme", "daemon", "dist", "index.js");
|
|
6320
|
+
}
|
|
6321
|
+
function ensureDaemon() {
|
|
6322
|
+
if (fs5.existsSync(daemonEntry())) return { ok: true };
|
|
6323
|
+
const dir = runtimeDir();
|
|
6324
|
+
try {
|
|
6325
|
+
fs5.mkdirSync(dir, { recursive: true });
|
|
6326
|
+
} catch (err) {
|
|
6327
|
+
return { ok: false, detail: `could not create ${dir}: ${String(err)}` };
|
|
6328
|
+
}
|
|
6329
|
+
const r = spawnSync(
|
|
6330
|
+
"npm",
|
|
6331
|
+
["install", DAEMON_PKG, "--prefix", dir, "--no-save", "--no-audit", "--no-fund"],
|
|
6332
|
+
{ encoding: "utf-8", timeout: 18e4 }
|
|
6333
|
+
);
|
|
6334
|
+
if (r.error || r.status !== 0) {
|
|
6335
|
+
const why = (r.stderr || r.error && r.error.message || "unknown error").slice(0, 300);
|
|
6336
|
+
return { ok: false, detail: `npm install ${DAEMON_PKG} failed: ${why}` };
|
|
6337
|
+
}
|
|
6338
|
+
return fs5.existsSync(daemonEntry()) ? { ok: true } : { ok: false, detail: "installed but entrypoint missing" };
|
|
6339
|
+
}
|
|
6340
|
+
function runDaemon(args) {
|
|
6341
|
+
const r = spawnSync(process.execPath, [daemonEntry(), ...args], { stdio: "inherit" });
|
|
6342
|
+
return r.status ?? 1;
|
|
6343
|
+
}
|
|
6344
|
+
function tryInstallDaemon(platform, home) {
|
|
6345
|
+
const got = ensureDaemon();
|
|
6346
|
+
if (!got.ok) return { ok: false, detail: got.detail ?? "runtime fetch failed" };
|
|
6347
|
+
const r = spawnSync(
|
|
6348
|
+
process.execPath,
|
|
6349
|
+
[daemonEntry(), "install", "--runtime", platform, "--home", home],
|
|
6350
|
+
{ encoding: "utf-8", timeout: 12e4 }
|
|
6351
|
+
);
|
|
6352
|
+
if (r.error || r.status !== 0) {
|
|
6353
|
+
const raw = r.stderr || r.stdout || r.error?.message || "";
|
|
6354
|
+
return { ok: false, detail: raw.slice(0, 300).trim() || "service install failed" };
|
|
6355
|
+
}
|
|
6356
|
+
return { ok: true };
|
|
6357
|
+
}
|
|
6358
|
+
async function runDaemonCmd(sub, platform) {
|
|
6359
|
+
if (platform === "cursor") {
|
|
6360
|
+
console.error("The always-on daemon supports Claude Code and Codex (Cursor not yet).");
|
|
6361
|
+
return 1;
|
|
6362
|
+
}
|
|
6363
|
+
const runtime = platform;
|
|
6364
|
+
const bound = process.env["AGENTCHAT_HOME"]?.trim();
|
|
6365
|
+
const home = bound && bound.length > 0 ? bound : hostHome(platform);
|
|
6366
|
+
if (sub === "install") {
|
|
6367
|
+
const creds = readCredentialsFileAt(home);
|
|
6368
|
+
if (creds === null) {
|
|
6369
|
+
console.error(
|
|
6370
|
+
`No AgentChat identity for ${platform} yet. Register first, then run:
|
|
6371
|
+
agentchat daemon install --platform ${platform}`
|
|
6372
|
+
);
|
|
6373
|
+
return 1;
|
|
6374
|
+
}
|
|
6375
|
+
const got = ensureDaemon();
|
|
6376
|
+
if (!got.ok) {
|
|
6377
|
+
console.error(`Couldn't set up always-on automatically: ${got.detail}`);
|
|
6378
|
+
console.error(`Finish it by hand:
|
|
6379
|
+
npm i -g ${DAEMON_PKG}
|
|
6380
|
+
agentchatd install --runtime ${runtime}`);
|
|
6381
|
+
return 1;
|
|
6382
|
+
}
|
|
6383
|
+
const code = runDaemon(["install", "--runtime", runtime, "--home", home]);
|
|
6384
|
+
if (code === 0) {
|
|
6385
|
+
console.log(
|
|
6386
|
+
[
|
|
6387
|
+
"",
|
|
6388
|
+
`Always-on is ON for @${creds.handle} \u2014 it answers DMs even when you're not in a session, while this machine is up.`,
|
|
6389
|
+
`Want session-only instead? Turn it off any time: agentchat daemon disable --platform ${platform}`
|
|
6390
|
+
].join("\n")
|
|
6391
|
+
);
|
|
6392
|
+
}
|
|
6393
|
+
return code;
|
|
6394
|
+
}
|
|
6395
|
+
if (sub === "enable" || sub === "disable" || sub === "status" || sub === "uninstall") {
|
|
6396
|
+
if (!fs5.existsSync(daemonEntry())) {
|
|
6397
|
+
if (sub === "status") {
|
|
6398
|
+
console.log("Always-on: not installed (session-only). Turn it on with: agentchat daemon install");
|
|
6399
|
+
return 0;
|
|
6400
|
+
}
|
|
6401
|
+
console.error(`Always-on isn't set up yet. Turn it on with: agentchat daemon install --platform ${platform}`);
|
|
6402
|
+
return sub === "disable" ? 0 : 1;
|
|
6403
|
+
}
|
|
6404
|
+
return runDaemon([sub, "--runtime", runtime, "--home", home]);
|
|
6405
|
+
}
|
|
6406
|
+
console.error("Usage: agentchat daemon <install|enable|disable|status|uninstall> --platform <claude-code|codex>");
|
|
6407
|
+
return 1;
|
|
6408
|
+
}
|
|
6409
|
+
|
|
6302
6410
|
// src/commands/identity.ts
|
|
6303
6411
|
var HANDLE_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
6304
6412
|
function describeApiError(err) {
|
|
@@ -6333,11 +6441,11 @@ async function prompt(question) {
|
|
|
6333
6441
|
rl.close();
|
|
6334
6442
|
}
|
|
6335
6443
|
}
|
|
6336
|
-
var RESTART_HINT = "
|
|
6444
|
+
var RESTART_HINT = "Your messaging tools pick this up immediately \u2014 no restart needed. (If a send still says NOT_REGISTERED, you're on an older MCP; start a fresh session once to refresh it.)";
|
|
6337
6445
|
function autoAnchor(handle) {
|
|
6338
6446
|
const lines = [];
|
|
6339
6447
|
const ccFile = anchorFilePath("claude-code");
|
|
6340
|
-
if (ccFile !== null &&
|
|
6448
|
+
if (ccFile !== null && fs6.existsSync(path7.dirname(ccFile))) {
|
|
6341
6449
|
try {
|
|
6342
6450
|
installAnchor("claude-code", handle);
|
|
6343
6451
|
lines.push(` anchor claude-code: written \u2192 ${ccFile}`);
|
|
@@ -6346,10 +6454,10 @@ function autoAnchor(handle) {
|
|
|
6346
6454
|
}
|
|
6347
6455
|
}
|
|
6348
6456
|
const codexAgents = anchorFilePath("codex");
|
|
6349
|
-
if (codexAgents !== null &&
|
|
6457
|
+
if (codexAgents !== null && fs6.existsSync(codexAgents)) {
|
|
6350
6458
|
try {
|
|
6351
|
-
const existing =
|
|
6352
|
-
|
|
6459
|
+
const existing = fs6.readFileSync(codexAgents, "utf-8");
|
|
6460
|
+
fs6.writeFileSync(codexAgents, upsertAnchorBlock(existing, renderCodexAgents(handle)), "utf-8");
|
|
6353
6461
|
lines.push(` AGENTS.md codex: refreshed \u2192 ${codexAgents}`);
|
|
6354
6462
|
} catch (err) {
|
|
6355
6463
|
lines.push(` AGENTS.md codex: FAILED \u2014 ${String(err)}`);
|
|
@@ -6357,6 +6465,24 @@ function autoAnchor(handle) {
|
|
|
6357
6465
|
}
|
|
6358
6466
|
return lines;
|
|
6359
6467
|
}
|
|
6468
|
+
function autoDaemon(platform) {
|
|
6469
|
+
if (platform === void 0 || platform === "cursor") {
|
|
6470
|
+
return [
|
|
6471
|
+
"Next, turn on always-on so you're reachable when the user is away: `agentchat daemon install` (on by default \u2014 `agentchat daemon disable` for session-only)."
|
|
6472
|
+
];
|
|
6473
|
+
}
|
|
6474
|
+
const home = process.env["AGENTCHAT_HOME"]?.trim() || hostHome(platform);
|
|
6475
|
+
process.stderr.write("Setting up always-on (one-time)\u2026\n");
|
|
6476
|
+
const res = tryInstallDaemon(platform, home);
|
|
6477
|
+
if (res.ok) {
|
|
6478
|
+
return [
|
|
6479
|
+
`Always-on is ON \u2014 you'll answer DMs even when the user isn't in a session (while this machine is up). Prefer session-only? \`agentchat daemon disable --platform ${platform}\`.`
|
|
6480
|
+
];
|
|
6481
|
+
}
|
|
6482
|
+
return [
|
|
6483
|
+
`(Always-on didn't auto-start: ${res.detail.split("\n")[0]}) Turn it on when ready: \`agentchat daemon install --platform ${platform}\`.`
|
|
6484
|
+
];
|
|
6485
|
+
}
|
|
6360
6486
|
async function runRegister(opts) {
|
|
6361
6487
|
const apiBase = opts.apiBase ?? process.env["AGENTCHAT_API_BASE"] ?? DEFAULT_API_BASE;
|
|
6362
6488
|
if (opts.code !== void 0) {
|
|
@@ -6400,7 +6526,7 @@ async function runRegister(opts) {
|
|
|
6400
6526
|
"",
|
|
6401
6527
|
"This identity is scoped to this coding agent \u2014 each coding agent on the machine gets its own handle.",
|
|
6402
6528
|
`Other agents can DM you at @${pendingHandle}. Check \`agentchat status\` any time.`,
|
|
6403
|
-
|
|
6529
|
+
...autoDaemon(opts.platform),
|
|
6404
6530
|
RESTART_HINT
|
|
6405
6531
|
].join("\n")
|
|
6406
6532
|
);
|
|
@@ -6506,7 +6632,7 @@ async function runLogin(opts) {
|
|
|
6506
6632
|
[
|
|
6507
6633
|
`Signed in as @${me.handle}.`,
|
|
6508
6634
|
...anchorReport,
|
|
6509
|
-
|
|
6635
|
+
...autoDaemon(opts.platform),
|
|
6510
6636
|
RESTART_HINT
|
|
6511
6637
|
].join("\n")
|
|
6512
6638
|
);
|
|
@@ -6545,6 +6671,7 @@ async function runRecover(opts) {
|
|
|
6545
6671
|
[
|
|
6546
6672
|
`Recovered: @${result.handle} \u2014 a fresh API key is stored (the old key is now revoked).`,
|
|
6547
6673
|
...anchorReport,
|
|
6674
|
+
...autoDaemon(opts.platform),
|
|
6548
6675
|
RESTART_HINT
|
|
6549
6676
|
].join("\n")
|
|
6550
6677
|
);
|
|
@@ -6768,10 +6895,10 @@ function runLogout() {
|
|
|
6768
6895
|
}
|
|
6769
6896
|
|
|
6770
6897
|
// src/commands/install.ts
|
|
6771
|
-
import * as
|
|
6772
|
-
import * as
|
|
6773
|
-
import * as
|
|
6774
|
-
import { spawnSync } from "child_process";
|
|
6898
|
+
import * as fs7 from "fs";
|
|
6899
|
+
import * as os4 from "os";
|
|
6900
|
+
import * as path8 from "path";
|
|
6901
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
6775
6902
|
var MARKETPLACE_SLUG = "agentchatme/agentchat-coding-agents";
|
|
6776
6903
|
var PLUGIN_REF = "agentchat@agentchatme";
|
|
6777
6904
|
var PROBES = [
|
|
@@ -6780,18 +6907,18 @@ var PROBES = [
|
|
|
6780
6907
|
{ key: "cursor", label: "Cursor", binary: "cursor-agent", configDir: ".cursor" }
|
|
6781
6908
|
];
|
|
6782
6909
|
function defaultRun(cmd, args) {
|
|
6783
|
-
const result =
|
|
6910
|
+
const result = spawnSync2(cmd, args, { stdio: ["ignore", "pipe", "pipe"], timeout: 6e4 });
|
|
6784
6911
|
if (result.error) return null;
|
|
6785
6912
|
return result.status;
|
|
6786
6913
|
}
|
|
6787
6914
|
function binaryOnPath(binary, env) {
|
|
6788
6915
|
const pathVar = env["PATH"] ?? "";
|
|
6789
6916
|
const exts = process.platform === "win32" ? [".cmd", ".exe", ".bat", ""] : [""];
|
|
6790
|
-
for (const dir of pathVar.split(
|
|
6917
|
+
for (const dir of pathVar.split(path8.delimiter)) {
|
|
6791
6918
|
if (dir.length === 0) continue;
|
|
6792
6919
|
for (const ext of exts) {
|
|
6793
6920
|
try {
|
|
6794
|
-
if (
|
|
6921
|
+
if (fs7.existsSync(path8.join(dir, binary + ext))) return true;
|
|
6795
6922
|
} catch {
|
|
6796
6923
|
}
|
|
6797
6924
|
}
|
|
@@ -6800,13 +6927,13 @@ function binaryOnPath(binary, env) {
|
|
|
6800
6927
|
}
|
|
6801
6928
|
function detectPlatforms(env, home) {
|
|
6802
6929
|
return PROBES.filter(
|
|
6803
|
-
(p) => binaryOnPath(p.binary, env) ||
|
|
6930
|
+
(p) => binaryOnPath(p.binary, env) || fs7.existsSync(path8.join(home, p.configDir))
|
|
6804
6931
|
);
|
|
6805
6932
|
}
|
|
6806
6933
|
async function runInstall(deps = {}) {
|
|
6807
6934
|
const run = deps.run ?? defaultRun;
|
|
6808
6935
|
const env = deps.env ?? process.env;
|
|
6809
|
-
const home = deps.homedir ??
|
|
6936
|
+
const home = deps.homedir ?? os4.homedir();
|
|
6810
6937
|
const detected = detectPlatforms(env, home);
|
|
6811
6938
|
if (detected.length === 0) {
|
|
6812
6939
|
console.log(
|
|
@@ -6883,11 +7010,11 @@ Signed in: ${have.join(", ")}`);
|
|
|
6883
7010
|
}
|
|
6884
7011
|
|
|
6885
7012
|
// src/commands/doctor.ts
|
|
6886
|
-
import * as
|
|
6887
|
-
import * as
|
|
7013
|
+
import * as fs8 from "fs";
|
|
7014
|
+
import * as path9 from "path";
|
|
6888
7015
|
|
|
6889
7016
|
// src/version.ts
|
|
6890
|
-
var VERSION2 = "0.0.
|
|
7017
|
+
var VERSION2 = "0.0.136";
|
|
6891
7018
|
|
|
6892
7019
|
// src/commands/doctor.ts
|
|
6893
7020
|
function fmt(check) {
|
|
@@ -6953,8 +7080,8 @@ async function runDoctor() {
|
|
|
6953
7080
|
for (const platform of ["claude-code", "codex"]) {
|
|
6954
7081
|
const file = anchorFilePath(platform);
|
|
6955
7082
|
if (file === null) continue;
|
|
6956
|
-
const hostDir =
|
|
6957
|
-
if (!
|
|
7083
|
+
const hostDir = path9.dirname(file);
|
|
7084
|
+
if (!fs8.existsSync(hostDir)) {
|
|
6958
7085
|
checks.push({ name: `anchor-${platform}`, verdict: "PASS", detail: `${hostDir} absent (host not installed) \u2014 skipped` });
|
|
6959
7086
|
} else {
|
|
6960
7087
|
checks.push({
|
|
@@ -6965,8 +7092,8 @@ async function runDoctor() {
|
|
|
6965
7092
|
}
|
|
6966
7093
|
}
|
|
6967
7094
|
try {
|
|
6968
|
-
|
|
6969
|
-
|
|
7095
|
+
fs8.mkdirSync(agentchatHome(), { recursive: true });
|
|
7096
|
+
fs8.accessSync(agentchatHome(), fs8.constants.W_OK);
|
|
6970
7097
|
checks.push({ name: "state", verdict: "PASS", detail: `${statePath()} writable` });
|
|
6971
7098
|
} catch {
|
|
6972
7099
|
checks.push({ name: "state", verdict: "FAIL", detail: `${agentchatHome()} is not writable` });
|
|
@@ -6999,93 +7126,6 @@ async function runAnchor(action, platform) {
|
|
|
6999
7126
|
return 0;
|
|
7000
7127
|
}
|
|
7001
7128
|
|
|
7002
|
-
// src/commands/daemon.ts
|
|
7003
|
-
import * as fs8 from "fs";
|
|
7004
|
-
import * as os4 from "os";
|
|
7005
|
-
import * as path9 from "path";
|
|
7006
|
-
import { spawnSync as spawnSync2 } from "child_process";
|
|
7007
|
-
var DAEMON_PKG = "@agentchatme/daemon";
|
|
7008
|
-
function runtimeDir() {
|
|
7009
|
-
return path9.join(os4.homedir(), ".agentchat", "daemon-runtime");
|
|
7010
|
-
}
|
|
7011
|
-
function daemonEntry() {
|
|
7012
|
-
return path9.join(runtimeDir(), "node_modules", "@agentchatme", "daemon", "dist", "index.js");
|
|
7013
|
-
}
|
|
7014
|
-
function ensureDaemon() {
|
|
7015
|
-
if (fs8.existsSync(daemonEntry())) return { ok: true };
|
|
7016
|
-
const dir = runtimeDir();
|
|
7017
|
-
try {
|
|
7018
|
-
fs8.mkdirSync(dir, { recursive: true });
|
|
7019
|
-
} catch (err) {
|
|
7020
|
-
return { ok: false, detail: `could not create ${dir}: ${String(err)}` };
|
|
7021
|
-
}
|
|
7022
|
-
const r = spawnSync2(
|
|
7023
|
-
"npm",
|
|
7024
|
-
["install", DAEMON_PKG, "--prefix", dir, "--no-save", "--no-audit", "--no-fund"],
|
|
7025
|
-
{ encoding: "utf-8", timeout: 18e4 }
|
|
7026
|
-
);
|
|
7027
|
-
if (r.error || r.status !== 0) {
|
|
7028
|
-
const why = (r.stderr || r.error && r.error.message || "unknown error").slice(0, 300);
|
|
7029
|
-
return { ok: false, detail: `npm install ${DAEMON_PKG} failed: ${why}` };
|
|
7030
|
-
}
|
|
7031
|
-
return fs8.existsSync(daemonEntry()) ? { ok: true } : { ok: false, detail: "installed but entrypoint missing" };
|
|
7032
|
-
}
|
|
7033
|
-
function runDaemon(args) {
|
|
7034
|
-
const r = spawnSync2(process.execPath, [daemonEntry(), ...args], { stdio: "inherit" });
|
|
7035
|
-
return r.status ?? 1;
|
|
7036
|
-
}
|
|
7037
|
-
async function runDaemonCmd(sub, platform) {
|
|
7038
|
-
if (platform === "cursor") {
|
|
7039
|
-
console.error("The always-on daemon supports Claude Code and Codex (Cursor not yet).");
|
|
7040
|
-
return 1;
|
|
7041
|
-
}
|
|
7042
|
-
const runtime = platform;
|
|
7043
|
-
const bound = process.env["AGENTCHAT_HOME"]?.trim();
|
|
7044
|
-
const home = bound && bound.length > 0 ? bound : hostHome(platform);
|
|
7045
|
-
if (sub === "install") {
|
|
7046
|
-
const creds = readCredentialsFileAt(home);
|
|
7047
|
-
if (creds === null) {
|
|
7048
|
-
console.error(
|
|
7049
|
-
`No AgentChat identity for ${platform} yet. Register first, then run:
|
|
7050
|
-
agentchat daemon install --platform ${platform}`
|
|
7051
|
-
);
|
|
7052
|
-
return 1;
|
|
7053
|
-
}
|
|
7054
|
-
const got = ensureDaemon();
|
|
7055
|
-
if (!got.ok) {
|
|
7056
|
-
console.error(`Couldn't set up always-on automatically: ${got.detail}`);
|
|
7057
|
-
console.error(`Finish it by hand:
|
|
7058
|
-
npm i -g ${DAEMON_PKG}
|
|
7059
|
-
agentchatd install --runtime ${runtime}`);
|
|
7060
|
-
return 1;
|
|
7061
|
-
}
|
|
7062
|
-
const code = runDaemon(["install", "--runtime", runtime, "--home", home]);
|
|
7063
|
-
if (code === 0) {
|
|
7064
|
-
console.log(
|
|
7065
|
-
[
|
|
7066
|
-
"",
|
|
7067
|
-
`Always-on is ON for @${creds.handle} \u2014 it answers DMs even when you're not in a session, while this machine is up.`,
|
|
7068
|
-
`Want session-only instead? Turn it off any time: agentchat daemon disable --platform ${platform}`
|
|
7069
|
-
].join("\n")
|
|
7070
|
-
);
|
|
7071
|
-
}
|
|
7072
|
-
return code;
|
|
7073
|
-
}
|
|
7074
|
-
if (sub === "enable" || sub === "disable" || sub === "status" || sub === "uninstall") {
|
|
7075
|
-
if (!fs8.existsSync(daemonEntry())) {
|
|
7076
|
-
if (sub === "status") {
|
|
7077
|
-
console.log("Always-on: not installed (session-only). Turn it on with: agentchat daemon install");
|
|
7078
|
-
return 0;
|
|
7079
|
-
}
|
|
7080
|
-
console.error(`Always-on isn't set up yet. Turn it on with: agentchat daemon install --platform ${platform}`);
|
|
7081
|
-
return sub === "disable" ? 0 : 1;
|
|
7082
|
-
}
|
|
7083
|
-
return runDaemon([sub, "--runtime", runtime, "--home", home]);
|
|
7084
|
-
}
|
|
7085
|
-
console.error("Usage: agentchat daemon <install|enable|disable|status|uninstall> --platform <claude-code|codex>");
|
|
7086
|
-
return 1;
|
|
7087
|
-
}
|
|
7088
|
-
|
|
7089
7129
|
// src/index.ts
|
|
7090
7130
|
var USAGE = `agentchat ${VERSION2} \u2014 AgentChat companion CLI for coding agents
|
|
7091
7131
|
|
|
@@ -7156,18 +7196,21 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
7156
7196
|
...values["display-name"] !== void 0 ? { displayName: values["display-name"] } : {},
|
|
7157
7197
|
...values.description !== void 0 ? { description: values.description } : {},
|
|
7158
7198
|
...values.code !== void 0 ? { code: values.code } : {},
|
|
7159
|
-
...values["api-base"] !== void 0 ? { apiBase: values["api-base"] } : {}
|
|
7199
|
+
...values["api-base"] !== void 0 ? { apiBase: values["api-base"] } : {},
|
|
7200
|
+
...values.platform !== void 0 && isPlatform(values.platform) ? { platform: values.platform } : {}
|
|
7160
7201
|
});
|
|
7161
7202
|
case "login":
|
|
7162
7203
|
return runLogin({
|
|
7163
7204
|
...values["api-key"] !== void 0 ? { apiKey: values["api-key"] } : {},
|
|
7164
|
-
...values["api-base"] !== void 0 ? { apiBase: values["api-base"] } : {}
|
|
7205
|
+
...values["api-base"] !== void 0 ? { apiBase: values["api-base"] } : {},
|
|
7206
|
+
...values.platform !== void 0 && isPlatform(values.platform) ? { platform: values.platform } : {}
|
|
7165
7207
|
});
|
|
7166
7208
|
case "recover":
|
|
7167
7209
|
return runRecover({
|
|
7168
7210
|
...values.email !== void 0 ? { email: values.email } : {},
|
|
7169
7211
|
...values.code !== void 0 ? { code: values.code } : {},
|
|
7170
|
-
...values["api-base"] !== void 0 ? { apiBase: values["api-base"] } : {}
|
|
7212
|
+
...values["api-base"] !== void 0 ? { apiBase: values["api-base"] } : {},
|
|
7213
|
+
...values.platform !== void 0 && isPlatform(values.platform) ? { platform: values.platform } : {}
|
|
7171
7214
|
});
|
|
7172
7215
|
case "status":
|
|
7173
7216
|
return runStatus({ ...values.json !== void 0 ? { json: values.json } : {} });
|