@agentchatme/claude-code 0.1.0 → 0.1.1
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 +3 -3
- package/dist/daemon-main.js +50 -17
- package/dist/daemon-main.js.map +1 -1
- package/dist/index.js +81 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ var require_windows = __commonJS({
|
|
|
39
39
|
"use strict";
|
|
40
40
|
module.exports = isexe;
|
|
41
41
|
isexe.sync = sync;
|
|
42
|
-
var
|
|
42
|
+
var fs10 = __require("fs");
|
|
43
43
|
function checkPathExt(path11, options) {
|
|
44
44
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
45
45
|
if (!pathext) {
|
|
@@ -64,12 +64,12 @@ var require_windows = __commonJS({
|
|
|
64
64
|
return checkPathExt(path11, options);
|
|
65
65
|
}
|
|
66
66
|
function isexe(path11, options, cb) {
|
|
67
|
-
|
|
67
|
+
fs10.stat(path11, function(er, stat) {
|
|
68
68
|
cb(er, er ? false : checkStat(stat, path11, options));
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
function sync(path11, options) {
|
|
72
|
-
return checkStat(
|
|
72
|
+
return checkStat(fs10.statSync(path11), path11, options);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
});
|
|
@@ -80,14 +80,14 @@ var require_mode = __commonJS({
|
|
|
80
80
|
"use strict";
|
|
81
81
|
module.exports = isexe;
|
|
82
82
|
isexe.sync = sync;
|
|
83
|
-
var
|
|
83
|
+
var fs10 = __require("fs");
|
|
84
84
|
function isexe(path11, options, cb) {
|
|
85
|
-
|
|
85
|
+
fs10.stat(path11, function(er, stat) {
|
|
86
86
|
cb(er, er ? false : checkStat(stat, options));
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
function sync(path11, options) {
|
|
90
|
-
return checkStat(
|
|
90
|
+
return checkStat(fs10.statSync(path11), options);
|
|
91
91
|
}
|
|
92
92
|
function checkStat(stat, options) {
|
|
93
93
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -112,7 +112,7 @@ var require_mode = __commonJS({
|
|
|
112
112
|
var require_isexe = __commonJS({
|
|
113
113
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
|
|
114
114
|
"use strict";
|
|
115
|
-
var
|
|
115
|
+
var fs10 = __require("fs");
|
|
116
116
|
var core;
|
|
117
117
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
118
118
|
core = require_windows();
|
|
@@ -130,12 +130,12 @@ var require_isexe = __commonJS({
|
|
|
130
130
|
if (typeof Promise !== "function") {
|
|
131
131
|
throw new TypeError("callback not provided");
|
|
132
132
|
}
|
|
133
|
-
return new Promise(function(
|
|
133
|
+
return new Promise(function(resolve6, reject) {
|
|
134
134
|
isexe(path11, options || {}, function(er, is) {
|
|
135
135
|
if (er) {
|
|
136
136
|
reject(er);
|
|
137
137
|
} else {
|
|
138
|
-
|
|
138
|
+
resolve6(is);
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
});
|
|
@@ -202,27 +202,27 @@ var require_which = __commonJS({
|
|
|
202
202
|
opt = {};
|
|
203
203
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
204
204
|
const found = [];
|
|
205
|
-
const step = (i) => new Promise((
|
|
205
|
+
const step = (i) => new Promise((resolve6, reject) => {
|
|
206
206
|
if (i === pathEnv.length)
|
|
207
|
-
return opt.all && found.length ?
|
|
207
|
+
return opt.all && found.length ? resolve6(found) : reject(getNotFoundError(cmd));
|
|
208
208
|
const ppRaw = pathEnv[i];
|
|
209
209
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
210
210
|
const pCmd = path11.join(pathPart, cmd);
|
|
211
211
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
212
|
-
|
|
212
|
+
resolve6(subStep(p, i, 0));
|
|
213
213
|
});
|
|
214
|
-
const subStep = (p, i, ii) => new Promise((
|
|
214
|
+
const subStep = (p, i, ii) => new Promise((resolve6, reject) => {
|
|
215
215
|
if (ii === pathExt.length)
|
|
216
|
-
return
|
|
216
|
+
return resolve6(step(i + 1));
|
|
217
217
|
const ext = pathExt[ii];
|
|
218
218
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
219
219
|
if (!er && is) {
|
|
220
220
|
if (opt.all)
|
|
221
221
|
found.push(p + ext);
|
|
222
222
|
else
|
|
223
|
-
return
|
|
223
|
+
return resolve6(p + ext);
|
|
224
224
|
}
|
|
225
|
-
return
|
|
225
|
+
return resolve6(subStep(p, i, ii + 1));
|
|
226
226
|
});
|
|
227
227
|
});
|
|
228
228
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -377,16 +377,16 @@ var require_shebang_command = __commonJS({
|
|
|
377
377
|
var require_readShebang = __commonJS({
|
|
378
378
|
"node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
379
379
|
"use strict";
|
|
380
|
-
var
|
|
380
|
+
var fs10 = __require("fs");
|
|
381
381
|
var shebangCommand = require_shebang_command();
|
|
382
382
|
function readShebang(command) {
|
|
383
383
|
const size = 150;
|
|
384
384
|
const buffer = Buffer.alloc(size);
|
|
385
385
|
let fd;
|
|
386
386
|
try {
|
|
387
|
-
fd =
|
|
388
|
-
|
|
389
|
-
|
|
387
|
+
fd = fs10.openSync(command, "r");
|
|
388
|
+
fs10.readSync(fd, buffer, 0, size, 0);
|
|
389
|
+
fs10.closeSync(fd);
|
|
390
390
|
} catch (e) {
|
|
391
391
|
}
|
|
392
392
|
return shebangCommand(buffer.toString());
|
|
@@ -535,7 +535,7 @@ var require_cross_spawn = __commonJS({
|
|
|
535
535
|
});
|
|
536
536
|
|
|
537
537
|
// src/index.ts
|
|
538
|
-
import * as
|
|
538
|
+
import * as fs9 from "fs";
|
|
539
539
|
import { parseArgs } from "util";
|
|
540
540
|
|
|
541
541
|
// node_modules/.pnpm/@agentchatme+agent-core@0.1.0/node_modules/@agentchatme/agent-core/dist/chunk-I4U4A7HO.js
|
|
@@ -5446,10 +5446,10 @@ function statusToCode(status) {
|
|
|
5446
5446
|
}
|
|
5447
5447
|
async function sleep(ms, signal) {
|
|
5448
5448
|
if (ms <= 0) return;
|
|
5449
|
-
await new Promise((
|
|
5449
|
+
await new Promise((resolve6, reject) => {
|
|
5450
5450
|
const timer = setTimeout(() => {
|
|
5451
5451
|
if (signal) signal.removeEventListener("abort", onAbort);
|
|
5452
|
-
|
|
5452
|
+
resolve6();
|
|
5453
5453
|
}, ms);
|
|
5454
5454
|
const onAbort = () => {
|
|
5455
5455
|
clearTimeout(timer);
|
|
@@ -7797,6 +7797,16 @@ function identityHome() {
|
|
|
7797
7797
|
function identityHomeFor(configDirOverride) {
|
|
7798
7798
|
return path6.join(configDirOverride ?? path6.join(os2.homedir(), ".claude"), "agentchat");
|
|
7799
7799
|
}
|
|
7800
|
+
function runWorkdirFor(configDirOverride) {
|
|
7801
|
+
return path6.join(configDirOverride ?? path6.join(os2.homedir(), ".claude"), "agentchat-workdir");
|
|
7802
|
+
}
|
|
7803
|
+
function legacyRunWorkdirFor(configDirOverride) {
|
|
7804
|
+
return path6.join(identityHomeFor(configDirOverride), "daemon-workdir");
|
|
7805
|
+
}
|
|
7806
|
+
function resolveRunWorkdir(configDirOverride, env = process.env) {
|
|
7807
|
+
const cwd = env["AGENTCHAT_RUN_CWD"]?.trim();
|
|
7808
|
+
return cwd !== void 0 && cwd.length > 0 ? path6.resolve(cwd) : runWorkdirFor(configDirOverride);
|
|
7809
|
+
}
|
|
7800
7810
|
function anchorFile() {
|
|
7801
7811
|
return path6.join(claudeHome(), "CLAUDE.md");
|
|
7802
7812
|
}
|
|
@@ -8166,6 +8176,7 @@ function formatPlacement(steps) {
|
|
|
8166
8176
|
}
|
|
8167
8177
|
|
|
8168
8178
|
// src/identity.ts
|
|
8179
|
+
import * as fs8 from "fs";
|
|
8169
8180
|
import * as path10 from "path";
|
|
8170
8181
|
|
|
8171
8182
|
// src/runner.ts
|
|
@@ -8238,6 +8249,17 @@ function inspectClaudeRuntime(configDirOverride, command = "claude") {
|
|
|
8238
8249
|
detail: `${rendered || "unrecognized version"}; AgentChat requires Claude Code >= ${MIN_CLAUDE_CODE_VERSION} (for --permission-prompts none and CLAUDE_CODE_MCP_STARTUP_WAIT_MS)`
|
|
8239
8250
|
};
|
|
8240
8251
|
}
|
|
8252
|
+
function denyReadPathsFor(configDirOverride) {
|
|
8253
|
+
return [identityHomeFor(configDirOverride), claudeUserStatePathFor(configDirOverride)];
|
|
8254
|
+
}
|
|
8255
|
+
function deniedAncestorOf(dir, denied) {
|
|
8256
|
+
const target = path8.resolve(dir);
|
|
8257
|
+
for (const raw of denied) {
|
|
8258
|
+
const root = path8.resolve(raw);
|
|
8259
|
+
if (target === root || target.startsWith(root.endsWith(path8.sep) ? root : root + path8.sep)) return root;
|
|
8260
|
+
}
|
|
8261
|
+
return null;
|
|
8262
|
+
}
|
|
8241
8263
|
|
|
8242
8264
|
// src/service.ts
|
|
8243
8265
|
import * as fs7 from "fs";
|
|
@@ -8245,7 +8267,7 @@ import * as path9 from "path";
|
|
|
8245
8267
|
import { fileURLToPath } from "url";
|
|
8246
8268
|
|
|
8247
8269
|
// src/version.ts
|
|
8248
|
-
var VERSION3 = "0.1.
|
|
8270
|
+
var VERSION3 = "0.1.1";
|
|
8249
8271
|
|
|
8250
8272
|
// src/service.ts
|
|
8251
8273
|
var DAEMON_REL = path9.join("bin", "agentchat-daemon.mjs");
|
|
@@ -8321,7 +8343,7 @@ var profile = {
|
|
|
8321
8343
|
apiBase: identity?.apiBase ?? process.env["AGENTCHAT_API_BASE"]?.trim() ?? "https://api.agentchat.me"
|
|
8322
8344
|
}).map((s) => ` ${s.name}: ${s.detail}`),
|
|
8323
8345
|
logoutHints: () => [`To remove the integration too, run \`${invocation()} uninstall\`.`],
|
|
8324
|
-
extraDoctorChecks: (opts) => [...runtimeChecks(), ...placementChecks(opts.fix === true), serviceCheck(opts.fix === true), doorbellCheck()]
|
|
8346
|
+
extraDoctorChecks: (opts) => [...runtimeChecks(), ...placementChecks(opts.fix === true), serviceCheck(opts.fix === true), workdirCheck(opts.fix === true), doorbellCheck()]
|
|
8325
8347
|
};
|
|
8326
8348
|
function concise(value) {
|
|
8327
8349
|
return value.replace(/\s+/g, " ").trim().slice(0, 180);
|
|
@@ -8369,6 +8391,37 @@ function serviceCheck(fix) {
|
|
|
8369
8391
|
const state = alwaysOnState(home);
|
|
8370
8392
|
return { name: "service", verdict: state === "down" ? "FAIL" : "PASS", detail: `${state}; service definition and daemon bundle match ${VERSION3}` };
|
|
8371
8393
|
}
|
|
8394
|
+
function workdirCheck(fix) {
|
|
8395
|
+
const configDir = claudeConfigOverride();
|
|
8396
|
+
const workdir = resolveRunWorkdir(configDir);
|
|
8397
|
+
const denied = deniedAncestorOf(workdir, denyReadPathsFor(configDir));
|
|
8398
|
+
if (denied !== null) {
|
|
8399
|
+
return {
|
|
8400
|
+
name: "run-workdir",
|
|
8401
|
+
verdict: "WARN",
|
|
8402
|
+
detail: `${workdir} is inside ${denied}, which runs may not read \u2014 point AGENTCHAT_RUN_CWD outside it (or unset it for ${runWorkdirFor(configDir)}), then \`${invocation()} daemon install\``
|
|
8403
|
+
};
|
|
8404
|
+
}
|
|
8405
|
+
const legacy = legacyRunWorkdirFor(configDir);
|
|
8406
|
+
if (!fs8.existsSync(legacy)) return { name: "run-workdir", verdict: "PASS", detail: workdir };
|
|
8407
|
+
let empty = false;
|
|
8408
|
+
try {
|
|
8409
|
+
empty = fs8.readdirSync(legacy).length === 0;
|
|
8410
|
+
} catch {
|
|
8411
|
+
}
|
|
8412
|
+
if (empty && fix) {
|
|
8413
|
+
try {
|
|
8414
|
+
fs8.rmdirSync(legacy);
|
|
8415
|
+
return { name: "run-workdir", verdict: "PASS", detail: `${workdir}; removed the empty former default ${legacy}` };
|
|
8416
|
+
} catch {
|
|
8417
|
+
}
|
|
8418
|
+
}
|
|
8419
|
+
return {
|
|
8420
|
+
name: "run-workdir",
|
|
8421
|
+
verdict: "WARN",
|
|
8422
|
+
detail: empty ? `${workdir}; the former default ${legacy} is left behind inside the identity home \u2014 \`${invocation()} doctor --fix\` removes it` : `${workdir}; the former default ${legacy} is inside the identity home, where runs cannot read it \u2014 move anything you want to keep, then delete it`
|
|
8423
|
+
};
|
|
8424
|
+
}
|
|
8372
8425
|
function doorbellCheck() {
|
|
8373
8426
|
const home = identityHome();
|
|
8374
8427
|
if (readCredentials(home) === null) return { name: "doorbell", verdict: "PASS", detail: "no identity \u2014 the daemon idles by design" };
|
|
@@ -8407,6 +8460,8 @@ async function runStatus(opts) {
|
|
|
8407
8460
|
const checks = checkPlacement(identity);
|
|
8408
8461
|
console.log("Placement:");
|
|
8409
8462
|
for (const c of checks) console.log(` ${c.ok ? "\u2713" : "\u2717"} ${c.name}: ${c.detail}`);
|
|
8463
|
+
const workdir = workdirCheck(false);
|
|
8464
|
+
console.log(` ${workdir.verdict === "PASS" ? "\u2713" : "\u2717"} run workdir: ${workdir.detail}`);
|
|
8410
8465
|
if (identity) {
|
|
8411
8466
|
const reach = await hostedMcpReachCheck();
|
|
8412
8467
|
console.log(` ${reach.verdict === "PASS" ? "\u2713" : "\u2717"} hosted MCP: ${reach.detail}`);
|
|
@@ -8579,7 +8634,7 @@ function runUninstall() {
|
|
|
8579
8634
|
for (const step of steps) if (step.status === "failed") warnings.push(step.detail);
|
|
8580
8635
|
if (serviceRemoved) {
|
|
8581
8636
|
try {
|
|
8582
|
-
|
|
8637
|
+
fs9.rmSync(stableDaemonPath(), { force: true });
|
|
8583
8638
|
} catch {
|
|
8584
8639
|
}
|
|
8585
8640
|
}
|