@agentchatme/codex 0.0.1711411111 → 0.0.171141111111
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/daemon-main.js +72 -18
- package/dist/daemon-main.js.map +1 -1
- package/dist/index.js +45 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/daemon-main.js
CHANGED
|
@@ -4227,7 +4227,7 @@ var require_cross_spawn = __commonJS({
|
|
|
4227
4227
|
import { parseArgs } from "util";
|
|
4228
4228
|
import * as path8 from "path";
|
|
4229
4229
|
|
|
4230
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.0.
|
|
4230
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.0.131311111111/node_modules/@agentchatme/agent-core/dist/chunk-CRHJICEC.js
|
|
4231
4231
|
import * as fs from "fs";
|
|
4232
4232
|
import * as path from "path";
|
|
4233
4233
|
import * as fs2 from "fs";
|
|
@@ -4258,7 +4258,7 @@ var log = {
|
|
|
4258
4258
|
info: (msg) => emit("info", msg),
|
|
4259
4259
|
debug: (msg) => emit("debug", msg)
|
|
4260
4260
|
};
|
|
4261
|
-
var VERSION = "0.0.
|
|
4261
|
+
var VERSION = "0.0.131311111111";
|
|
4262
4262
|
var CODING_AGENTS_CLIENT_IDENTITY = {
|
|
4263
4263
|
name: "coding_agents",
|
|
4264
4264
|
version: VERSION
|
|
@@ -8511,7 +8511,7 @@ function idle(home) {
|
|
|
8511
8511
|
}
|
|
8512
8512
|
}
|
|
8513
8513
|
|
|
8514
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.0.
|
|
8514
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.0.131311111111/node_modules/@agentchatme/agent-core/dist/daemon-entry.js
|
|
8515
8515
|
init_wrapper();
|
|
8516
8516
|
import { EventEmitter } from "events";
|
|
8517
8517
|
import * as path32 from "path";
|
|
@@ -9004,6 +9004,10 @@ var FOREGROUND_RECHECK_MS = positiveBoundedEnv(
|
|
|
9004
9004
|
"AGENTCHATD_FOREGROUND_RECHECK_MS",
|
|
9005
9005
|
2e3
|
|
9006
9006
|
);
|
|
9007
|
+
var FOREGROUND_RECHECK_MAX_MS = Math.max(
|
|
9008
|
+
FOREGROUND_RECHECK_MS,
|
|
9009
|
+
positiveBoundedEnv("AGENTCHATD_FOREGROUND_RECHECK_MAX_MS", 15e3)
|
|
9010
|
+
);
|
|
9007
9011
|
var delay = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
9008
9012
|
function retryDelay(attempt) {
|
|
9009
9013
|
return Math.min(RETRY_BASE_MS * 2 ** Math.min(20, Math.max(0, attempt - 1)), RETRY_MAX_MS);
|
|
@@ -9069,6 +9073,11 @@ var Daemon = class {
|
|
|
9069
9073
|
// conversation shares this window so a large multi-conversation backlog
|
|
9070
9074
|
// cannot turn into one polling loop per conversation.
|
|
9071
9075
|
foregroundClaimsBlockedUntil = 0;
|
|
9076
|
+
foregroundDeferralRounds = 0;
|
|
9077
|
+
// Log one start and one resolution per deferred conversation. Repeated
|
|
9078
|
+
// rechecks remain visible through the resolution count without flooding the
|
|
9079
|
+
// resident daemon log every few seconds.
|
|
9080
|
+
foregroundDeferrals = /* @__PURE__ */ new Map();
|
|
9072
9081
|
stopping = false;
|
|
9073
9082
|
heartbeatTimer = null;
|
|
9074
9083
|
async start() {
|
|
@@ -9157,23 +9166,29 @@ var Daemon = class {
|
|
|
9157
9166
|
);
|
|
9158
9167
|
const claimedCount = claim.claimedCount;
|
|
9159
9168
|
let batch = candidates.slice(0, claimedCount);
|
|
9169
|
+
if (!claim.deferred && claimedCount > 0) {
|
|
9170
|
+
this.finishForegroundDeferral(conversationId, "daemon-resumed");
|
|
9171
|
+
}
|
|
9160
9172
|
if (claimedCount < candidates.length) {
|
|
9161
9173
|
if (claim.deferred) {
|
|
9162
|
-
this.foregroundClaimsBlockedUntil = Math.max(
|
|
9163
|
-
this.foregroundClaimsBlockedUntil,
|
|
9164
|
-
Date.now() + FOREGROUND_RECHECK_MS
|
|
9165
|
-
);
|
|
9166
9174
|
const deferred = candidates.slice(claimedCount);
|
|
9167
9175
|
if (deferred.length > 0) {
|
|
9168
9176
|
const current = this.convQueues.get(conversationId) ?? [];
|
|
9169
9177
|
this.convQueues.set(conversationId, [...deferred, ...current]);
|
|
9170
9178
|
}
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9179
|
+
const deferredHead = deferred[0];
|
|
9180
|
+
if (deferredHead) {
|
|
9181
|
+
this.noteForegroundDeferral(conversationId, deferredHead.id);
|
|
9182
|
+
}
|
|
9174
9183
|
} else {
|
|
9175
9184
|
const conflict = candidates[claimedCount];
|
|
9176
|
-
|
|
9185
|
+
const summarized = this.finishForegroundDeferral(
|
|
9186
|
+
conversationId,
|
|
9187
|
+
"foreground-owned"
|
|
9188
|
+
);
|
|
9189
|
+
if (!summarized) {
|
|
9190
|
+
log.info(`msg ${conflict.id}: claimed by the live session \u2014 standing down`);
|
|
9191
|
+
}
|
|
9177
9192
|
this.seen.delete(conflict.id);
|
|
9178
9193
|
this.markNoLongerPending();
|
|
9179
9194
|
const unclaimedTail = candidates.slice(claimedCount + 1);
|
|
@@ -9190,10 +9205,6 @@ var Daemon = class {
|
|
|
9190
9205
|
const lost = batch.slice(renewed.claimedCount);
|
|
9191
9206
|
batch = batch.slice(0, renewed.claimedCount);
|
|
9192
9207
|
if (renewed.deferred) {
|
|
9193
|
-
this.foregroundClaimsBlockedUntil = Math.max(
|
|
9194
|
-
this.foregroundClaimsBlockedUntil,
|
|
9195
|
-
Date.now() + FOREGROUND_RECHECK_MS
|
|
9196
|
-
);
|
|
9197
9208
|
for (const row of lost) {
|
|
9198
9209
|
const state = this.seen.get(row.id);
|
|
9199
9210
|
if (state) {
|
|
@@ -9203,9 +9214,17 @@ var Daemon = class {
|
|
|
9203
9214
|
}
|
|
9204
9215
|
const current = this.convQueues.get(conversationId) ?? [];
|
|
9205
9216
|
this.convQueues.set(conversationId, [...lost, ...current]);
|
|
9217
|
+
const lostHead = lost[0];
|
|
9218
|
+
if (lostHead) this.noteForegroundDeferral(conversationId, lostHead.id);
|
|
9206
9219
|
} else {
|
|
9207
9220
|
const conflict = lost[0];
|
|
9208
|
-
|
|
9221
|
+
const summarized = this.finishForegroundDeferral(
|
|
9222
|
+
conversationId,
|
|
9223
|
+
"foreground-owned"
|
|
9224
|
+
);
|
|
9225
|
+
if (!summarized) {
|
|
9226
|
+
log.info(`msg ${conflict.id}: renewal lost to a live session \u2014 standing down`);
|
|
9227
|
+
}
|
|
9209
9228
|
this.seen.delete(conflict.id);
|
|
9210
9229
|
this.markNoLongerPending();
|
|
9211
9230
|
const tail = lost.slice(1);
|
|
@@ -9285,6 +9304,41 @@ var Daemon = class {
|
|
|
9285
9304
|
await delay(remaining);
|
|
9286
9305
|
}
|
|
9287
9306
|
}
|
|
9307
|
+
noteForegroundDeferral(conversationId, messageId) {
|
|
9308
|
+
const now = Date.now();
|
|
9309
|
+
if (now >= this.foregroundClaimsBlockedUntil) {
|
|
9310
|
+
this.foregroundDeferralRounds += 1;
|
|
9311
|
+
}
|
|
9312
|
+
const retryMs = Math.min(
|
|
9313
|
+
FOREGROUND_RECHECK_MS * 2 ** Math.min(20, Math.max(0, this.foregroundDeferralRounds - 1)),
|
|
9314
|
+
FOREGROUND_RECHECK_MAX_MS
|
|
9315
|
+
);
|
|
9316
|
+
this.foregroundClaimsBlockedUntil = Math.max(
|
|
9317
|
+
this.foregroundClaimsBlockedUntil,
|
|
9318
|
+
now + retryMs
|
|
9319
|
+
);
|
|
9320
|
+
const prior = this.foregroundDeferrals.get(conversationId);
|
|
9321
|
+
if (prior) {
|
|
9322
|
+
prior.claims += 1;
|
|
9323
|
+
return;
|
|
9324
|
+
}
|
|
9325
|
+
this.foregroundDeferrals.set(conversationId, { messageId, claims: 1 });
|
|
9326
|
+
log.info(`msg ${messageId}: foreground turn owns priority \u2014 daemon waiting`);
|
|
9327
|
+
}
|
|
9328
|
+
finishForegroundDeferral(conversationId, outcome) {
|
|
9329
|
+
const deferred = this.foregroundDeferrals.get(conversationId);
|
|
9330
|
+
if (!deferred) return false;
|
|
9331
|
+
this.foregroundDeferrals.delete(conversationId);
|
|
9332
|
+
if (this.foregroundDeferrals.size === 0) {
|
|
9333
|
+
this.foregroundDeferralRounds = 0;
|
|
9334
|
+
this.foregroundClaimsBlockedUntil = 0;
|
|
9335
|
+
}
|
|
9336
|
+
const resolution = outcome === "daemon-resumed" ? "foreground priority ended \u2014 daemon resumed" : "foreground session claimed delivery \u2014 daemon stood down";
|
|
9337
|
+
log.info(
|
|
9338
|
+
`msg ${deferred.messageId}: ${resolution} after ${deferred.claims} deferred claim(s)`
|
|
9339
|
+
);
|
|
9340
|
+
return true;
|
|
9341
|
+
}
|
|
9288
9342
|
turnContext(batch) {
|
|
9289
9343
|
const focus = batch[batch.length - 1];
|
|
9290
9344
|
const oldest = batch[0];
|
|
@@ -9528,7 +9582,7 @@ import * as crypto2 from "crypto";
|
|
|
9528
9582
|
import * as fs5 from "fs";
|
|
9529
9583
|
import * as path6 from "path";
|
|
9530
9584
|
|
|
9531
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.0.
|
|
9585
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.0.131311111111/node_modules/@agentchatme/agent-core/dist/index.js
|
|
9532
9586
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
9533
9587
|
var SESSION_TTL_MS = 48 * 60 * 60 * 1e3;
|
|
9534
9588
|
var SessionStateSchema = external_exports.object({
|
|
@@ -9560,7 +9614,7 @@ var spawnCommand = import_cross_spawn.default;
|
|
|
9560
9614
|
var spawnCommandSync = import_cross_spawn.default.sync;
|
|
9561
9615
|
|
|
9562
9616
|
// src/version.ts
|
|
9563
|
-
var VERSION2 = "0.0.
|
|
9617
|
+
var VERSION2 = "0.0.171141111111";
|
|
9564
9618
|
|
|
9565
9619
|
// src/adapter.ts
|
|
9566
9620
|
var TURN_TIMEOUT_MS = 24e4;
|