@agentchatme/agent-core 0.0.13 → 0.0.1311
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/{chunk-NEGTEBFK.js → chunk-ER4AFPH7.js} +30 -4
- package/dist/chunk-ER4AFPH7.js.map +1 -0
- package/dist/daemon-entry.js +11 -1
- package/dist/daemon-entry.js.map +1 -1
- package/dist/index.d.ts +79 -45
- package/dist/index.js +63 -23
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-NEGTEBFK.js.map +0 -1
|
@@ -24,6 +24,19 @@ var log = {
|
|
|
24
24
|
debug: (msg) => emit("debug", msg)
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
// src/version.ts
|
|
28
|
+
var VERSION = "0.0.1311";
|
|
29
|
+
|
|
30
|
+
// src/client-identity.ts
|
|
31
|
+
var CODING_AGENTS_CLIENT_IDENTITY = {
|
|
32
|
+
name: "coding_agents",
|
|
33
|
+
version: VERSION
|
|
34
|
+
};
|
|
35
|
+
var CODING_AGENTS_CLIENT_HEADERS = {
|
|
36
|
+
"X-AgentChat-Client": CODING_AGENTS_CLIENT_IDENTITY.name,
|
|
37
|
+
"X-AgentChat-Client-Version": CODING_AGENTS_CLIENT_IDENTITY.version
|
|
38
|
+
};
|
|
39
|
+
|
|
27
40
|
// src/daemon/leader-lock.ts
|
|
28
41
|
import * as fs from "fs";
|
|
29
42
|
import * as path from "path";
|
|
@@ -4275,6 +4288,7 @@ async function request(cfg, method, pathname, body) {
|
|
|
4275
4288
|
const res = await fetch(url, {
|
|
4276
4289
|
method,
|
|
4277
4290
|
headers: {
|
|
4291
|
+
...CODING_AGENTS_CLIENT_HEADERS,
|
|
4278
4292
|
authorization: `Bearer ${cfg.apiKey}`,
|
|
4279
4293
|
...body !== void 0 ? { "content-type": "application/json" } : {}
|
|
4280
4294
|
},
|
|
@@ -4374,7 +4388,7 @@ var HEARTBEAT_STALE_MS = 3 * 6e4;
|
|
|
4374
4388
|
function markAlwaysOnWanted(home) {
|
|
4375
4389
|
try {
|
|
4376
4390
|
fs4.mkdirSync(home, { recursive: true });
|
|
4377
|
-
fs4.writeFileSync(path4.join(home, ALWAYS_ON_WANTED),
|
|
4391
|
+
fs4.writeFileSync(path4.join(home, ALWAYS_ON_WANTED), (/* @__PURE__ */ new Date()).toISOString());
|
|
4378
4392
|
} catch {
|
|
4379
4393
|
}
|
|
4380
4394
|
}
|
|
@@ -4417,15 +4431,24 @@ function idle(home) {
|
|
|
4417
4431
|
} catch {
|
|
4418
4432
|
}
|
|
4419
4433
|
}
|
|
4434
|
+
var STARTUP_GRACE_MS = 9e4;
|
|
4420
4435
|
function alwaysOnState(home) {
|
|
4421
4436
|
if (!alwaysOnWanted(home)) return "off";
|
|
4422
4437
|
if (!fs4.existsSync(path4.join(home, "credentials"))) return "idle";
|
|
4438
|
+
let beating = false;
|
|
4423
4439
|
try {
|
|
4424
4440
|
const age = Date.now() - fs4.statSync(path4.join(home, HEARTBEAT_FILE)).mtimeMs;
|
|
4425
|
-
|
|
4441
|
+
beating = age <= HEARTBEAT_STALE_MS;
|
|
4442
|
+
} catch {
|
|
4443
|
+
beating = false;
|
|
4444
|
+
}
|
|
4445
|
+
if (beating) return "connected";
|
|
4446
|
+
try {
|
|
4447
|
+
const since = Date.now() - fs4.statSync(path4.join(home, ALWAYS_ON_WANTED)).mtimeMs;
|
|
4448
|
+
if (since <= STARTUP_GRACE_MS) return "starting";
|
|
4426
4449
|
} catch {
|
|
4427
|
-
return "down";
|
|
4428
4450
|
}
|
|
4451
|
+
return "down";
|
|
4429
4452
|
}
|
|
4430
4453
|
function alwaysOnHealth(home) {
|
|
4431
4454
|
const state = alwaysOnState(home);
|
|
@@ -4435,6 +4458,9 @@ function alwaysOnHealth(home) {
|
|
|
4435
4458
|
export {
|
|
4436
4459
|
log,
|
|
4437
4460
|
external_exports,
|
|
4461
|
+
VERSION,
|
|
4462
|
+
CODING_AGENTS_CLIENT_IDENTITY,
|
|
4463
|
+
CODING_AGENTS_CLIENT_HEADERS,
|
|
4438
4464
|
acquireLeaderLock,
|
|
4439
4465
|
atomicWriteFile,
|
|
4440
4466
|
readJsonFile,
|
|
@@ -4470,4 +4496,4 @@ export {
|
|
|
4470
4496
|
alwaysOnState,
|
|
4471
4497
|
alwaysOnHealth
|
|
4472
4498
|
};
|
|
4473
|
-
//# sourceMappingURL=chunk-
|
|
4499
|
+
//# sourceMappingURL=chunk-ER4AFPH7.js.map
|