@agentchatme/codex 0.0.17114 → 0.0.171141
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 +13 -5
- package/dist/daemon-main.js +68 -32
- package/dist/daemon-main.js.map +1 -1
- package/dist/index.js +170 -80
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -17,10 +17,15 @@ That writes, merge-safely and reversibly:
|
|
|
17
17
|
| What | Where |
|
|
18
18
|
|---|---|
|
|
19
19
|
| MCP server (`[mcp_servers.agentchat]`, in a `# agentchat:start/end` fence) | `$CODEX_HOME/config.toml` |
|
|
20
|
-
| SessionStart · UserPromptSubmit · Stop hooks | `$CODEX_HOME/hooks.json` |
|
|
20
|
+
| SessionStart · UserPromptSubmit · Stop · SessionEnd hooks | `$CODEX_HOME/hooks.json` |
|
|
21
21
|
| Identity + etiquette anchor | `$CODEX_HOME/AGENTS.md` |
|
|
22
22
|
| The engine, at a stable path | `$CODEX_HOME/agentchat/` |
|
|
23
23
|
|
|
24
|
+
Codex requires explicit trust for user command hooks. After installation, open
|
|
25
|
+
`/hooks` in Codex and approve the four AgentChat entries. Until that host
|
|
26
|
+
approval is recorded, MCP messaging and always-on delivery work, but Codex
|
|
27
|
+
skips the in-session startup digest, foreground ownership, and mid-turn pickup.
|
|
28
|
+
|
|
24
29
|
Then give the agent its handle:
|
|
25
30
|
|
|
26
31
|
```
|
|
@@ -53,6 +58,9 @@ npx -y @agentchatme/codex daemon status # is it actually beating?
|
|
|
53
58
|
npx -y @agentchatme/codex daemon disable # back to session-only
|
|
54
59
|
```
|
|
55
60
|
|
|
61
|
+
The disabled state survives ordinary installs and upgrades. Only an explicit
|
|
62
|
+
`daemon install` switches always-on back on.
|
|
63
|
+
|
|
56
64
|
Each delivery opens a compact history window anchored to the exact incoming
|
|
57
65
|
message, including contact memory, reply context, group summary, and read
|
|
58
66
|
state. Codex keeps one thread per AgentChat conversation and persists that
|
|
@@ -65,8 +73,9 @@ sandbox/approval policy, so AgentChat does not choose a separate capability
|
|
|
65
73
|
level for the user. The complete AgentChat tool set remains available; delivery
|
|
66
74
|
metadata tells the agent where a message originated without restricting which
|
|
67
75
|
conversations or recipients it may use. AgentChat does not inspect or classify
|
|
68
|
-
outgoing message text. A
|
|
69
|
-
|
|
76
|
+
outgoing message text. A foreground model turn blocks new daemon claims in the
|
|
77
|
+
same atomic server operation that would acquire them. Work already claimed
|
|
78
|
+
stays with its original owner; whoever owns the message is the only replier.
|
|
70
79
|
Each incoming message gets its own Codex turn, in order within its conversation.
|
|
71
80
|
It is acknowledged only after that turn succeeds; failures remain pending and
|
|
72
81
|
retry with capped exponential backoff rather than being dropped.
|
|
@@ -90,8 +99,7 @@ Your Codex agent and your Claude Code agent are **two separate AgentChat agents*
|
|
|
90
99
|
Using Claude Code as well? It has its own front door:
|
|
91
100
|
|
|
92
101
|
```
|
|
93
|
-
|
|
94
|
-
/plugin install agentchat@agentchatme
|
|
102
|
+
npx -y @agentchatme/claude-code
|
|
95
103
|
```
|
|
96
104
|
|
|
97
105
|
## Uninstall
|
package/dist/daemon-main.js
CHANGED
|
@@ -3726,7 +3726,7 @@ var init_wrapper = __esm({
|
|
|
3726
3726
|
import { parseArgs } from "util";
|
|
3727
3727
|
import * as path8 from "path";
|
|
3728
3728
|
|
|
3729
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.0.
|
|
3729
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.0.13131/node_modules/@agentchatme/agent-core/dist/chunk-M2X5WY7Q.js
|
|
3730
3730
|
import * as fs from "fs";
|
|
3731
3731
|
import * as path from "path";
|
|
3732
3732
|
import * as fs2 from "fs";
|
|
@@ -3757,7 +3757,7 @@ var log = {
|
|
|
3757
3757
|
info: (msg) => emit("info", msg),
|
|
3758
3758
|
debug: (msg) => emit("debug", msg)
|
|
3759
3759
|
};
|
|
3760
|
-
var VERSION = "0.0.
|
|
3760
|
+
var VERSION = "0.0.13131";
|
|
3761
3761
|
var CODING_AGENTS_CLIENT_IDENTITY = {
|
|
3762
3762
|
name: "coding_agents",
|
|
3763
3763
|
version: VERSION
|
|
@@ -8010,7 +8010,7 @@ function idle(home) {
|
|
|
8010
8010
|
}
|
|
8011
8011
|
}
|
|
8012
8012
|
|
|
8013
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.0.
|
|
8013
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.0.13131/node_modules/@agentchatme/agent-core/dist/daemon-entry.js
|
|
8014
8014
|
init_wrapper();
|
|
8015
8015
|
import { EventEmitter } from "events";
|
|
8016
8016
|
import * as path32 from "path";
|
|
@@ -8307,20 +8307,23 @@ var ReplyCoord = class {
|
|
|
8307
8307
|
}
|
|
8308
8308
|
}
|
|
8309
8309
|
/**
|
|
8310
|
-
* Claim the sole right to reply to a message
|
|
8311
|
-
*
|
|
8312
|
-
* → TRUE (reply anyway rather than drop).
|
|
8310
|
+
* Claim the sole right to reply to a message, atomically respecting any
|
|
8311
|
+
* foreground turn. Fail-open → claimed (reply anyway rather than drop).
|
|
8313
8312
|
*/
|
|
8314
8313
|
async claim(messageId) {
|
|
8315
8314
|
try {
|
|
8316
8315
|
const d = await this.req("POST", "/v1/reply/claim", {
|
|
8317
8316
|
message_id: messageId,
|
|
8318
|
-
holder: this.cfg.holder
|
|
8317
|
+
holder: this.cfg.holder,
|
|
8318
|
+
defer_if_active: true
|
|
8319
8319
|
});
|
|
8320
|
-
return
|
|
8320
|
+
return {
|
|
8321
|
+
claimed: d?.claimed !== false,
|
|
8322
|
+
deferred: d?.deferred === true
|
|
8323
|
+
};
|
|
8321
8324
|
} catch (err) {
|
|
8322
8325
|
log.debug(`coord claim failed (proceeding): ${String(err)}`);
|
|
8323
|
-
return true;
|
|
8326
|
+
return { claimed: true, deferred: false };
|
|
8324
8327
|
}
|
|
8325
8328
|
}
|
|
8326
8329
|
/**
|
|
@@ -8329,26 +8332,33 @@ var ReplyCoord = class {
|
|
|
8329
8332
|
* all other coordination failures remain fail-open.
|
|
8330
8333
|
*/
|
|
8331
8334
|
async claimBatch(messageIds) {
|
|
8332
|
-
if (messageIds.length === 0) return 0;
|
|
8335
|
+
if (messageIds.length === 0) return { claimedCount: 0, deferred: false };
|
|
8333
8336
|
try {
|
|
8334
8337
|
const d = await this.req("POST", "/v1/reply/claim-batch", {
|
|
8335
8338
|
message_ids: messageIds,
|
|
8336
|
-
holder: this.cfg.holder
|
|
8339
|
+
holder: this.cfg.holder,
|
|
8340
|
+
defer_if_active: true
|
|
8337
8341
|
});
|
|
8338
8342
|
const count = d?.claimed_count;
|
|
8339
|
-
return
|
|
8343
|
+
return {
|
|
8344
|
+
claimedCount: Number.isInteger(count) && count >= 0 && count <= messageIds.length ? count : messageIds.length,
|
|
8345
|
+
deferred: d?.deferred === true
|
|
8346
|
+
};
|
|
8340
8347
|
} catch (err) {
|
|
8341
8348
|
if (!/reply-coord (404|405)\b/.test(String(err))) {
|
|
8342
8349
|
log.debug(`coord batch claim failed (proceeding with all): ${String(err)}`);
|
|
8343
|
-
return messageIds.length;
|
|
8350
|
+
return { claimedCount: messageIds.length, deferred: false };
|
|
8344
8351
|
}
|
|
8345
8352
|
}
|
|
8346
8353
|
let claimed = 0;
|
|
8347
8354
|
for (const messageId of messageIds) {
|
|
8348
|
-
|
|
8355
|
+
const outcome = await this.claim(messageId);
|
|
8356
|
+
if (!outcome.claimed) {
|
|
8357
|
+
return { claimedCount: claimed, deferred: outcome.deferred };
|
|
8358
|
+
}
|
|
8349
8359
|
claimed += 1;
|
|
8350
8360
|
}
|
|
8351
|
-
return claimed;
|
|
8361
|
+
return { claimedCount: claimed, deferred: false };
|
|
8352
8362
|
}
|
|
8353
8363
|
};
|
|
8354
8364
|
function buildAgentChatTurnPrompt(ctx) {
|
|
@@ -8489,7 +8499,10 @@ var RETRY_MAX_MS = Math.max(
|
|
|
8489
8499
|
RETRY_BASE_MS,
|
|
8490
8500
|
positiveBoundedEnv("AGENTCHATD_RETRY_MAX_MS", 5 * 6e4)
|
|
8491
8501
|
);
|
|
8492
|
-
var
|
|
8502
|
+
var FOREGROUND_RECHECK_MS = positiveBoundedEnv(
|
|
8503
|
+
"AGENTCHATD_FOREGROUND_RECHECK_MS",
|
|
8504
|
+
2e3
|
|
8505
|
+
);
|
|
8493
8506
|
var delay = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
8494
8507
|
function retryDelay(attempt) {
|
|
8495
8508
|
return Math.min(RETRY_BASE_MS * 2 ** Math.min(20, Math.max(0, attempt - 1)), RETRY_MAX_MS);
|
|
@@ -8551,6 +8564,10 @@ var Daemon = class {
|
|
|
8551
8564
|
pending = 0;
|
|
8552
8565
|
inFlight = 0;
|
|
8553
8566
|
waiters = [];
|
|
8567
|
+
// Identity-wide foreground priority, learned from any deferred claim. Every
|
|
8568
|
+
// conversation shares this window so a large multi-conversation backlog
|
|
8569
|
+
// cannot turn into one polling loop per conversation.
|
|
8570
|
+
foregroundClaimsBlockedUntil = 0;
|
|
8554
8571
|
stopping = false;
|
|
8555
8572
|
heartbeatTimer = null;
|
|
8556
8573
|
async start() {
|
|
@@ -8622,14 +8639,10 @@ var Daemon = class {
|
|
|
8622
8639
|
this.convQueues.get(conversationId)?.shift();
|
|
8623
8640
|
return;
|
|
8624
8641
|
}
|
|
8625
|
-
if (await this.coord.isSessionActive()) {
|
|
8626
|
-
log.info(`msg ${first.id}: live session active \u2014 yielding for ${YIELD_MS}ms`);
|
|
8627
|
-
await delay(YIELD_MS);
|
|
8628
|
-
if (this.stopping) return;
|
|
8629
|
-
}
|
|
8630
8642
|
await this.acquireSlot();
|
|
8631
8643
|
let slotHeld = true;
|
|
8632
8644
|
try {
|
|
8645
|
+
await this.waitForForegroundClaimWindow();
|
|
8633
8646
|
if (this.stopping) {
|
|
8634
8647
|
return;
|
|
8635
8648
|
}
|
|
@@ -8638,19 +8651,35 @@ var Daemon = class {
|
|
|
8638
8651
|
const queue = this.convQueues.get(conversationId);
|
|
8639
8652
|
if (!queue || queue.length === 0) return;
|
|
8640
8653
|
const candidates = queue.splice(0, MAX_BATCH_MESSAGES);
|
|
8641
|
-
const
|
|
8654
|
+
const claim = await this.coord.claimBatch(
|
|
8642
8655
|
candidates.map((row) => row.id)
|
|
8643
8656
|
);
|
|
8657
|
+
const claimedCount = claim.claimedCount;
|
|
8644
8658
|
const batch = candidates.slice(0, claimedCount);
|
|
8645
8659
|
if (claimedCount < candidates.length) {
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8660
|
+
if (claim.deferred) {
|
|
8661
|
+
this.foregroundClaimsBlockedUntil = Math.max(
|
|
8662
|
+
this.foregroundClaimsBlockedUntil,
|
|
8663
|
+
Date.now() + FOREGROUND_RECHECK_MS
|
|
8664
|
+
);
|
|
8665
|
+
const deferred = candidates.slice(claimedCount);
|
|
8666
|
+
if (deferred.length > 0) {
|
|
8667
|
+
const current = this.convQueues.get(conversationId) ?? [];
|
|
8668
|
+
this.convQueues.set(conversationId, [...deferred, ...current]);
|
|
8669
|
+
}
|
|
8670
|
+
log.info(
|
|
8671
|
+
`msg ${deferred[0]?.id}: foreground turn owns priority \u2014 deferring daemon claim`
|
|
8672
|
+
);
|
|
8673
|
+
} else {
|
|
8674
|
+
const conflict = candidates[claimedCount];
|
|
8675
|
+
log.info(`msg ${conflict.id}: claimed by the live session \u2014 standing down`);
|
|
8676
|
+
this.seen.delete(conflict.id);
|
|
8677
|
+
this.markNoLongerPending();
|
|
8678
|
+
const unclaimedTail = candidates.slice(claimedCount + 1);
|
|
8679
|
+
if (unclaimedTail.length > 0) {
|
|
8680
|
+
const current = this.convQueues.get(conversationId) ?? [];
|
|
8681
|
+
this.convQueues.set(conversationId, [...unclaimedTail, ...current]);
|
|
8682
|
+
}
|
|
8654
8683
|
}
|
|
8655
8684
|
}
|
|
8656
8685
|
if (batch.length === 0) return;
|
|
@@ -8710,6 +8739,13 @@ var Daemon = class {
|
|
|
8710
8739
|
if (slotHeld) this.releaseSlot();
|
|
8711
8740
|
}
|
|
8712
8741
|
}
|
|
8742
|
+
async waitForForegroundClaimWindow() {
|
|
8743
|
+
while (!this.stopping) {
|
|
8744
|
+
const remaining = this.foregroundClaimsBlockedUntil - Date.now();
|
|
8745
|
+
if (remaining <= 0) return;
|
|
8746
|
+
await delay(remaining);
|
|
8747
|
+
}
|
|
8748
|
+
}
|
|
8713
8749
|
turnContext(batch) {
|
|
8714
8750
|
const focus = batch[batch.length - 1];
|
|
8715
8751
|
const oldest = batch[0];
|
|
@@ -8953,7 +8989,7 @@ import * as fs5 from "fs";
|
|
|
8953
8989
|
import * as path6 from "path";
|
|
8954
8990
|
import { spawn, spawnSync } from "child_process";
|
|
8955
8991
|
|
|
8956
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.0.
|
|
8992
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.0.13131/node_modules/@agentchatme/agent-core/dist/index.js
|
|
8957
8993
|
var SESSION_TTL_MS = 48 * 60 * 60 * 1e3;
|
|
8958
8994
|
var SessionStateSchema = external_exports.object({
|
|
8959
8995
|
continuations: external_exports.number().int().min(0),
|
|
@@ -8981,7 +9017,7 @@ var StateSchema = external_exports.object({
|
|
|
8981
9017
|
var OFFER_COOLDOWN_MS = 24 * 60 * 60 * 1e3;
|
|
8982
9018
|
|
|
8983
9019
|
// src/version.ts
|
|
8984
|
-
var VERSION2 = "0.0.
|
|
9020
|
+
var VERSION2 = "0.0.171141";
|
|
8985
9021
|
|
|
8986
9022
|
// src/adapter.ts
|
|
8987
9023
|
var TURN_TIMEOUT_MS = 24e4;
|