@integrity-labs/agt-cli 0.28.494 → 0.28.495
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/bin/agt.js +4 -4
- package/dist/{chunk-JHEJP3KC.js → chunk-4SQZDAWG.js} +63 -1
- package/dist/chunk-4SQZDAWG.js.map +1 -0
- package/dist/{chunk-DJNJWFKI.js → chunk-CAHE6QSE.js} +3 -3
- package/dist/{claude-pair-runtime-2RMAJGZH.js → claude-pair-runtime-LCQYCW67.js} +2 -2
- package/dist/lib/manager-worker.js +272 -212
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +301 -46
- package/dist/mcp/origami.js +14 -0
- package/dist/mcp/slack-channel.js +14 -0
- package/dist/mcp/telegram-channel.js +14 -0
- package/dist/{persistent-session-JEN37LZS.js → persistent-session-TSPVNVQL.js} +2 -2
- package/dist/{responsiveness-probe-MSXL7NVR.js → responsiveness-probe-3LWQKHV2.js} +64 -2
- package/dist/responsiveness-probe-3LWQKHV2.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-JHEJP3KC.js.map +0 -1
- package/dist/responsiveness-probe-MSXL7NVR.js.map +0 -1
- /package/dist/{chunk-DJNJWFKI.js.map → chunk-CAHE6QSE.js.map} +0 -0
- /package/dist/{claude-pair-runtime-2RMAJGZH.js.map → claude-pair-runtime-LCQYCW67.js.map} +0 -0
- /package/dist/{persistent-session-JEN37LZS.js.map → persistent-session-TSPVNVQL.js.map} +0 -0
|
@@ -18867,7 +18867,7 @@ var require_filters = __commonJS({
|
|
|
18867
18867
|
return r.copySafeness(str, res);
|
|
18868
18868
|
}
|
|
18869
18869
|
_exports.indent = indent;
|
|
18870
|
-
function
|
|
18870
|
+
function join15(arr, del, attr) {
|
|
18871
18871
|
del = del || "";
|
|
18872
18872
|
if (attr) {
|
|
18873
18873
|
arr = lib.map(arr, function(v) {
|
|
@@ -18876,7 +18876,7 @@ var require_filters = __commonJS({
|
|
|
18876
18876
|
}
|
|
18877
18877
|
return arr.join(del);
|
|
18878
18878
|
}
|
|
18879
|
-
_exports.join =
|
|
18879
|
+
_exports.join = join15;
|
|
18880
18880
|
function last(arr) {
|
|
18881
18881
|
return arr[arr.length - 1];
|
|
18882
18882
|
}
|
|
@@ -33518,6 +33518,65 @@ var DIRECT_CHAT_UPLOAD_MAX_BYTES = 10 * MB2;
|
|
|
33518
33518
|
var AGENT_DIRECTED_NOTICE_KINDS = ["scheduled_task_nudge", "kanban_check"];
|
|
33519
33519
|
var AGENT_DIRECTED_KIND_SET = new Set(AGENT_DIRECTED_NOTICE_KINDS);
|
|
33520
33520
|
|
|
33521
|
+
// ../core/dist/direct-chat/cursor-advance.js
|
|
33522
|
+
var CURSOR_SHORTFALL_REASONS = [
|
|
33523
|
+
"not_found",
|
|
33524
|
+
"gave_up",
|
|
33525
|
+
"already_delivered",
|
|
33526
|
+
"error",
|
|
33527
|
+
"undiagnosed",
|
|
33528
|
+
"unknown",
|
|
33529
|
+
"unreported",
|
|
33530
|
+
"malformed_count",
|
|
33531
|
+
"other"
|
|
33532
|
+
];
|
|
33533
|
+
var KNOWN_REASONS = new Set(CURSOR_SHORTFALL_REASONS);
|
|
33534
|
+
function normalizeCursorShortfallReason(raw) {
|
|
33535
|
+
if (raw == null || raw === "")
|
|
33536
|
+
return "unreported";
|
|
33537
|
+
return KNOWN_REASONS.has(raw) ? raw : "other";
|
|
33538
|
+
}
|
|
33539
|
+
function classifyCursorAdvance(input) {
|
|
33540
|
+
const body = input.body ?? void 0;
|
|
33541
|
+
if (!input.httpOk || body?.error != null) {
|
|
33542
|
+
const error2 = body?.error ?? input.statusText ?? (input.httpStatus !== void 0 ? `HTTP ${input.httpStatus}` : "request failed");
|
|
33543
|
+
return { outcome: "failed", error: error2 };
|
|
33544
|
+
}
|
|
33545
|
+
const expected = new Set(input.messageIds).size;
|
|
33546
|
+
const raw = body?.consumed;
|
|
33547
|
+
if (raw === void 0 || raw === null) {
|
|
33548
|
+
return { outcome: "advanced", reported: false, expected, consumed: 0 };
|
|
33549
|
+
}
|
|
33550
|
+
if (typeof raw !== "number" || !Number.isSafeInteger(raw) || raw < 0) {
|
|
33551
|
+
if (expected === 0)
|
|
33552
|
+
return { outcome: "advanced", reported: false, expected, consumed: 0 };
|
|
33553
|
+
return {
|
|
33554
|
+
outcome: "shortfall",
|
|
33555
|
+
expected,
|
|
33556
|
+
consumed: 0,
|
|
33557
|
+
reason: "malformed_count",
|
|
33558
|
+
partial: false
|
|
33559
|
+
};
|
|
33560
|
+
}
|
|
33561
|
+
if (raw < expected) {
|
|
33562
|
+
return {
|
|
33563
|
+
outcome: "shortfall",
|
|
33564
|
+
expected,
|
|
33565
|
+
consumed: raw,
|
|
33566
|
+
reason: normalizeCursorShortfallReason(body?.reason),
|
|
33567
|
+
partial: raw > 0
|
|
33568
|
+
};
|
|
33569
|
+
}
|
|
33570
|
+
return { outcome: "advanced", reported: true, expected, consumed: raw };
|
|
33571
|
+
}
|
|
33572
|
+
function cursorShortfallKey(route, reason, partial2) {
|
|
33573
|
+
return `${route}|${reason}|${partial2 ? "true" : "false"}`;
|
|
33574
|
+
}
|
|
33575
|
+
function formatCursorAdvanceShortfall(verdict, ctx) {
|
|
33576
|
+
const cleared = ctx.cleared.length > 0 ? ctx.cleared.join(",") : "none";
|
|
33577
|
+
return `[direct-chat] cursor advance shortfall route=/${ctx.route} site=${ctx.site} session=${ctx.sessionId} expected=${verdict.expected} consumed=${verdict.consumed} reason=${verdict.reason} partial=${verdict.partial} cleared_anyway=${cleared}`;
|
|
33578
|
+
}
|
|
33579
|
+
|
|
33521
33580
|
// ../core/dist/onboarding/state-machine.js
|
|
33522
33581
|
var AREA_ORDER = [
|
|
33523
33582
|
"framing",
|
|
@@ -35839,13 +35898,13 @@ function readLockHolder(path) {
|
|
|
35839
35898
|
|
|
35840
35899
|
// src/direct-chat-channel.ts
|
|
35841
35900
|
import { homedir as homedir4 } from "os";
|
|
35842
|
-
import { join as
|
|
35901
|
+
import { join as join14 } from "path";
|
|
35843
35902
|
import { randomUUID } from "crypto";
|
|
35844
35903
|
import {
|
|
35845
35904
|
watch,
|
|
35846
35905
|
mkdirSync as mkdirSync5,
|
|
35847
|
-
writeFileSync as
|
|
35848
|
-
readFileSync as
|
|
35906
|
+
writeFileSync as writeFileSync7,
|
|
35907
|
+
readFileSync as readFileSync11,
|
|
35849
35908
|
readdirSync as readdirSync6,
|
|
35850
35909
|
existsSync as existsSync6,
|
|
35851
35910
|
renameSync as renameSync5,
|
|
@@ -36323,6 +36382,58 @@ function shouldSendAccountWarn(opts) {
|
|
|
36323
36382
|
}).reply;
|
|
36324
36383
|
}
|
|
36325
36384
|
|
|
36385
|
+
// ../core/dist/direct-chat/cursor-advance-telemetry.js
|
|
36386
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "fs";
|
|
36387
|
+
import { join as join13 } from "path";
|
|
36388
|
+
var CURSOR_SHORTFALL_COUNTER_SUFFIX = "-cursor-advance-classifications.json";
|
|
36389
|
+
function recordCursorAdvanceShortfall(agentDir, source, classification) {
|
|
36390
|
+
if (!agentDir)
|
|
36391
|
+
return;
|
|
36392
|
+
const path = join13(agentDir, `${source}${CURSOR_SHORTFALL_COUNTER_SUFFIX}`);
|
|
36393
|
+
const counts = {};
|
|
36394
|
+
try {
|
|
36395
|
+
const parsed = JSON.parse(readFileSync10(path, "utf-8"));
|
|
36396
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
36397
|
+
for (const [k, v] of Object.entries(parsed)) {
|
|
36398
|
+
if (typeof v === "number" && Number.isInteger(v) && v >= 0)
|
|
36399
|
+
counts[k] = v;
|
|
36400
|
+
}
|
|
36401
|
+
}
|
|
36402
|
+
} catch {
|
|
36403
|
+
}
|
|
36404
|
+
const key = cursorShortfallKey(classification.route, classification.reason, classification.partial);
|
|
36405
|
+
counts[key] = (counts[key] ?? 0) + 1;
|
|
36406
|
+
try {
|
|
36407
|
+
writeFileSync6(path, JSON.stringify(counts), { mode: 384 });
|
|
36408
|
+
} catch {
|
|
36409
|
+
}
|
|
36410
|
+
}
|
|
36411
|
+
|
|
36412
|
+
// src/direct-chat-cursor-body.ts
|
|
36413
|
+
async function readCursorAdvanceBody(res) {
|
|
36414
|
+
let body;
|
|
36415
|
+
let bodyError;
|
|
36416
|
+
try {
|
|
36417
|
+
const parsed = await res.json();
|
|
36418
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
36419
|
+
bodyError = "invalid";
|
|
36420
|
+
} else {
|
|
36421
|
+
body = parsed;
|
|
36422
|
+
}
|
|
36423
|
+
} catch {
|
|
36424
|
+
bodyError = "unreadable";
|
|
36425
|
+
}
|
|
36426
|
+
return {
|
|
36427
|
+
body,
|
|
36428
|
+
httpOk: res.ok && bodyError === void 0,
|
|
36429
|
+
// `res.statusText` is '' on HTTP/2, where it does not exist at all. Passing
|
|
36430
|
+
// '' through is not caught by `classifyCursorAdvance`'s `??` fallback (an
|
|
36431
|
+
// empty string is not nullish), so the operator would get `Reply failed: `
|
|
36432
|
+
// with nothing after it.
|
|
36433
|
+
statusText: bodyError === void 0 ? res.statusText || `HTTP ${res.status}` : `HTTP ${res.status} (${bodyError} response body)`
|
|
36434
|
+
};
|
|
36435
|
+
}
|
|
36436
|
+
|
|
36326
36437
|
// src/usage-limit-reactive-decision.ts
|
|
36327
36438
|
import { createHash } from "crypto";
|
|
36328
36439
|
function shouldArmWatch(opts) {
|
|
@@ -36335,6 +36446,9 @@ function decideUsageLimitCursorCall(opts) {
|
|
|
36335
36446
|
body: {
|
|
36336
36447
|
agent_id: opts.agentId,
|
|
36337
36448
|
session_id: opts.sessionId,
|
|
36449
|
+
// This module BUILDS the body but never posts it; the POST and its
|
|
36450
|
+
// verdict live at the `usage-limit-reactive` site in direct-chat-channel.ts.
|
|
36451
|
+
// cursor-advance-allow: body-only, judged at the call site.
|
|
36338
36452
|
message_ids: [opts.messageId]
|
|
36339
36453
|
}
|
|
36340
36454
|
};
|
|
@@ -36345,6 +36459,7 @@ function decideUsageLimitCursorCall(opts) {
|
|
|
36345
36459
|
agent_id: opts.agentId,
|
|
36346
36460
|
session_id: opts.sessionId,
|
|
36347
36461
|
content: opts.noticeText,
|
|
36462
|
+
// cursor-advance-allow: body-only, as above — judged at the call site.
|
|
36348
36463
|
message_ids: [opts.messageId],
|
|
36349
36464
|
// ENG-8274: a cap refusal is the SYSTEM speaking, not the agent.
|
|
36350
36465
|
// Orthogonal to message_ids — consuming the cursor is about delivery,
|
|
@@ -36377,7 +36492,7 @@ var DIRECT_CHAT_ACCOUNT_WARN_COOLDOWN_MS = (() => {
|
|
|
36377
36492
|
var AGT_HOST = process.env.AGT_HOST;
|
|
36378
36493
|
var AGT_API_KEY = process.env.AGT_API_KEY;
|
|
36379
36494
|
var AGT_AGENT_ID = process.env.AGT_AGENT_ID;
|
|
36380
|
-
var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ?
|
|
36495
|
+
var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ? join14(homedir4(), ".augmented", AGT_AGENT_ID) : null;
|
|
36381
36496
|
var INBOUND_ATTACHMENTS_DIR = resolveInboundAttachmentsDir({
|
|
36382
36497
|
codeName: process.env.AGT_AGENT_CODE_NAME,
|
|
36383
36498
|
turnInitiatorFile: process.env.AGT_TURN_INITIATOR_FILE,
|
|
@@ -36388,10 +36503,10 @@ var AGT_AGENT_CODE_NAME = process.env.AGT_AGENT_CODE_NAME;
|
|
|
36388
36503
|
var directChatStderrLogStream = null;
|
|
36389
36504
|
if (AGT_AGENT_CODE_NAME) {
|
|
36390
36505
|
try {
|
|
36391
|
-
const logDir =
|
|
36506
|
+
const logDir = join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME);
|
|
36392
36507
|
mkdirSync5(logDir, { recursive: true });
|
|
36393
36508
|
directChatStderrLogStream = createWriteStream(
|
|
36394
|
-
|
|
36509
|
+
join14(logDir, "direct-chat-channel-stderr.log"),
|
|
36395
36510
|
{ flags: "a", mode: 384 }
|
|
36396
36511
|
);
|
|
36397
36512
|
directChatStderrLogStream.on("error", () => {
|
|
@@ -36410,11 +36525,24 @@ if (AGT_AGENT_CODE_NAME) {
|
|
|
36410
36525
|
} catch {
|
|
36411
36526
|
}
|
|
36412
36527
|
}
|
|
36413
|
-
var PROGRESS_HEARTBEAT_PATH = AGT_AGENT_CODE_NAME ?
|
|
36414
|
-
var DIRECT_CHAT_PENDING_INBOUND_DIR = AGT_AGENT_CODE_NAME ?
|
|
36415
|
-
var DIRECT_CHAT_DELIVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ?
|
|
36416
|
-
var DIRECT_CHAT_CODE_NAME_AGENT_DIR = AGT_AGENT_CODE_NAME ?
|
|
36528
|
+
var PROGRESS_HEARTBEAT_PATH = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME, "channel-progress-heartbeat.json") : null;
|
|
36529
|
+
var DIRECT_CHAT_PENDING_INBOUND_DIR = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME, "direct-chat-pending-inbound") : null;
|
|
36530
|
+
var DIRECT_CHAT_DELIVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME, ".agt-inbound-delivery-ledger") : null;
|
|
36531
|
+
var DIRECT_CHAT_CODE_NAME_AGENT_DIR = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME) : null;
|
|
36417
36532
|
var DIRECT_CHAT_STALE_MARKER_MS = 24 * 60 * 60 * 1e3;
|
|
36533
|
+
function judgeCursorAdvance(input, ctx) {
|
|
36534
|
+
const verdict = classifyCursorAdvance(input);
|
|
36535
|
+
if (verdict.outcome === "shortfall") {
|
|
36536
|
+
process.stderr.write(`direct-chat-channel: ${formatCursorAdvanceShortfall(verdict, ctx)}
|
|
36537
|
+
`);
|
|
36538
|
+
recordCursorAdvanceShortfall(DIRECT_CHAT_CODE_NAME_AGENT_DIR, "direct-chat", {
|
|
36539
|
+
route: ctx.route,
|
|
36540
|
+
reason: verdict.reason,
|
|
36541
|
+
partial: verdict.partial
|
|
36542
|
+
});
|
|
36543
|
+
}
|
|
36544
|
+
return verdict;
|
|
36545
|
+
}
|
|
36418
36546
|
function recordDirectChatDelivery(sessionId, messageIds) {
|
|
36419
36547
|
if (!sessionId) return;
|
|
36420
36548
|
writeInboundDeliveryLedgerEntry(DIRECT_CHAT_DELIVERY_LEDGER_DIR, {
|
|
@@ -36424,8 +36552,8 @@ function recordDirectChatDelivery(sessionId, messageIds) {
|
|
|
36424
36552
|
delivered_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
36425
36553
|
});
|
|
36426
36554
|
}
|
|
36427
|
-
var DIRECT_CHAT_RECOVERY_OUTBOX_DIR = AGT_AGENT_CODE_NAME ?
|
|
36428
|
-
var DIRECT_CHAT_RECOVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ?
|
|
36555
|
+
var DIRECT_CHAT_RECOVERY_OUTBOX_DIR = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME, "direct-chat-recovery-outbox") : null;
|
|
36556
|
+
var DIRECT_CHAT_RECOVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME, ".agt-direct-chat-recovery-ledger") : null;
|
|
36429
36557
|
var progressReceivedAt = /* @__PURE__ */ new Map();
|
|
36430
36558
|
var directChatProgressState = { tracked: null };
|
|
36431
36559
|
var directChatProgressTickRunning = false;
|
|
@@ -36444,7 +36572,7 @@ var directChatKanbanCardClient = createKanbanCardActiveClient({
|
|
|
36444
36572
|
function readProgressHeartbeat() {
|
|
36445
36573
|
if (!PROGRESS_HEARTBEAT_PATH || !existsSync6(PROGRESS_HEARTBEAT_PATH)) return null;
|
|
36446
36574
|
try {
|
|
36447
|
-
return parseProgressHeartbeat(
|
|
36575
|
+
return parseProgressHeartbeat(readFileSync11(PROGRESS_HEARTBEAT_PATH, "utf-8"));
|
|
36448
36576
|
} catch {
|
|
36449
36577
|
return null;
|
|
36450
36578
|
}
|
|
@@ -36453,8 +36581,8 @@ function seedProgressHeartbeat() {
|
|
|
36453
36581
|
if (!PROGRESS_HEARTBEAT_PATH) return;
|
|
36454
36582
|
const tmp = `${PROGRESS_HEARTBEAT_PATH}.${process.pid}.tmp`;
|
|
36455
36583
|
try {
|
|
36456
|
-
mkdirSync5(
|
|
36457
|
-
|
|
36584
|
+
mkdirSync5(join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME), { recursive: true });
|
|
36585
|
+
writeFileSync7(tmp, serializeProgressHeartbeat(SEED_PROGRESS_STEP, Date.now()), { mode: 384 });
|
|
36458
36586
|
renameSync5(tmp, PROGRESS_HEARTBEAT_PATH);
|
|
36459
36587
|
} catch {
|
|
36460
36588
|
try {
|
|
@@ -36614,6 +36742,9 @@ async function maybeSendDirectChatAccountWarn(sessionId) {
|
|
|
36614
36742
|
agent_id: AGT_AGENT_ID,
|
|
36615
36743
|
session_id: sessionId,
|
|
36616
36744
|
content: buildAccountIssueReplyText(),
|
|
36745
|
+
// The L1 warn nag is an extra message alongside the agent's real reply,
|
|
36746
|
+
// which has already advanced the cursor.
|
|
36747
|
+
// cursor-advance-allow: deliberately EMPTY — nothing to advance, no count to read.
|
|
36617
36748
|
message_ids: [],
|
|
36618
36749
|
// ENG-8274: kind:'notice' — an account-auth nag is the system speaking, not
|
|
36619
36750
|
// the agent, and owes no reply.
|
|
@@ -36647,8 +36778,8 @@ var inboundAttachmentDeps = {
|
|
|
36647
36778
|
};
|
|
36648
36779
|
},
|
|
36649
36780
|
ensureDir: (dir) => mkdirSync5(dir, { recursive: true }),
|
|
36650
|
-
writeFile: (path, bytes) =>
|
|
36651
|
-
joinPath: (...parts) =>
|
|
36781
|
+
writeFile: (path, bytes) => writeFileSync7(path, bytes, { mode: 384 }),
|
|
36782
|
+
joinPath: (...parts) => join14(...parts),
|
|
36652
36783
|
warn: (msg) => process.stderr.write(`${msg}
|
|
36653
36784
|
`)
|
|
36654
36785
|
};
|
|
@@ -36813,11 +36944,29 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
36813
36944
|
content: slices[0],
|
|
36814
36945
|
message_ids
|
|
36815
36946
|
});
|
|
36816
|
-
const data = await res
|
|
36817
|
-
|
|
36947
|
+
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
36948
|
+
const verdict = judgeCursorAdvance(
|
|
36949
|
+
{
|
|
36950
|
+
messageIds: message_ids,
|
|
36951
|
+
httpOk,
|
|
36952
|
+
httpStatus: res.status,
|
|
36953
|
+
statusText,
|
|
36954
|
+
body: data
|
|
36955
|
+
},
|
|
36956
|
+
{
|
|
36957
|
+
route: "reply",
|
|
36958
|
+
site: "direct_chat.reply:stream-anchor",
|
|
36959
|
+
sessionId: session_id,
|
|
36960
|
+
cleared: ["claim", "markers", "delivery-ledger"]
|
|
36961
|
+
}
|
|
36962
|
+
);
|
|
36963
|
+
if (verdict.outcome === "failed" || !data?.message_id) {
|
|
36818
36964
|
return {
|
|
36819
36965
|
content: [
|
|
36820
|
-
{
|
|
36966
|
+
{
|
|
36967
|
+
type: "text",
|
|
36968
|
+
text: `Reply failed: ${verdict.outcome === "failed" ? verdict.error : "no message_id returned"}`
|
|
36969
|
+
}
|
|
36821
36970
|
],
|
|
36822
36971
|
isError: true
|
|
36823
36972
|
};
|
|
@@ -36862,10 +37011,25 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
36862
37011
|
content,
|
|
36863
37012
|
message_ids
|
|
36864
37013
|
});
|
|
36865
|
-
const data = await res
|
|
36866
|
-
|
|
37014
|
+
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
37015
|
+
const verdict = judgeCursorAdvance(
|
|
37016
|
+
{
|
|
37017
|
+
messageIds: message_ids,
|
|
37018
|
+
httpOk,
|
|
37019
|
+
httpStatus: res.status,
|
|
37020
|
+
statusText,
|
|
37021
|
+
body: data
|
|
37022
|
+
},
|
|
37023
|
+
{
|
|
37024
|
+
route: "reply",
|
|
37025
|
+
site: "direct_chat.reply:single-shot",
|
|
37026
|
+
sessionId: session_id,
|
|
37027
|
+
cleared: ["claim", "markers", "delivery-ledger"]
|
|
37028
|
+
}
|
|
37029
|
+
);
|
|
37030
|
+
if (verdict.outcome === "failed") {
|
|
36867
37031
|
return {
|
|
36868
|
-
content: [{ type: "text", text: `Reply failed: ${
|
|
37032
|
+
content: [{ type: "text", text: `Reply failed: ${verdict.error}` }],
|
|
36869
37033
|
isError: true
|
|
36870
37034
|
};
|
|
36871
37035
|
}
|
|
@@ -36893,10 +37057,25 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
36893
37057
|
session_id,
|
|
36894
37058
|
message_ids
|
|
36895
37059
|
});
|
|
36896
|
-
const data = await res
|
|
36897
|
-
|
|
37060
|
+
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
37061
|
+
const verdict = judgeCursorAdvance(
|
|
37062
|
+
{
|
|
37063
|
+
messageIds: message_ids,
|
|
37064
|
+
httpOk,
|
|
37065
|
+
httpStatus: res.status,
|
|
37066
|
+
statusText,
|
|
37067
|
+
body: data
|
|
37068
|
+
},
|
|
37069
|
+
{
|
|
37070
|
+
route: "consume",
|
|
37071
|
+
site: "direct_chat.consume",
|
|
37072
|
+
sessionId: session_id,
|
|
37073
|
+
cleared: ["claim", "markers", "delivery-ledger"]
|
|
37074
|
+
}
|
|
37075
|
+
);
|
|
37076
|
+
if (verdict.outcome === "failed") {
|
|
36898
37077
|
return {
|
|
36899
|
-
content: [{ type: "text", text: `Consume failed: ${
|
|
37078
|
+
content: [{ type: "text", text: `Consume failed: ${verdict.error}` }],
|
|
36900
37079
|
isError: true
|
|
36901
37080
|
};
|
|
36902
37081
|
}
|
|
@@ -36982,7 +37161,7 @@ function scheduleDirectChatBusyAck(sessionId, messageId, arrivedWhileBusy) {
|
|
|
36982
37161
|
let paneLogFreshAgeMs = null;
|
|
36983
37162
|
if (DIRECT_CHAT_CODE_NAME_AGENT_DIR) {
|
|
36984
37163
|
try {
|
|
36985
|
-
const paneMtimeMs = statSync4(
|
|
37164
|
+
const paneMtimeMs = statSync4(join14(DIRECT_CHAT_CODE_NAME_AGENT_DIR, "pane.log")).mtimeMs;
|
|
36986
37165
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
36987
37166
|
} catch {
|
|
36988
37167
|
}
|
|
@@ -37095,8 +37274,23 @@ function armUsageLimitWatch(args) {
|
|
|
37095
37274
|
noticeText: buildUsageLimitReplyText(refusal.resetsAt)
|
|
37096
37275
|
});
|
|
37097
37276
|
const res = await apiPost(route, body);
|
|
37098
|
-
const data = await res
|
|
37099
|
-
|
|
37277
|
+
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
37278
|
+
const verdict = judgeCursorAdvance(
|
|
37279
|
+
{
|
|
37280
|
+
messageIds: [args.messageId],
|
|
37281
|
+
httpOk,
|
|
37282
|
+
httpStatus: res.status,
|
|
37283
|
+
statusText,
|
|
37284
|
+
body: data
|
|
37285
|
+
},
|
|
37286
|
+
{
|
|
37287
|
+
route: throttle.reply ? "reply" : "consume",
|
|
37288
|
+
site: "usage-limit-reactive",
|
|
37289
|
+
sessionId: args.sessionId,
|
|
37290
|
+
cleared: ["claim", "markers"]
|
|
37291
|
+
}
|
|
37292
|
+
);
|
|
37293
|
+
if (verdict.outcome !== "failed") {
|
|
37100
37294
|
claimTracker.clear(args.sessionId, [args.messageId]);
|
|
37101
37295
|
clearDirectChatPendingMarkersForSession(DIRECT_CHAT_PENDING_INBOUND_DIR, args.sessionId);
|
|
37102
37296
|
process.stderr.write(
|
|
@@ -37106,7 +37300,7 @@ function armUsageLimitWatch(args) {
|
|
|
37106
37300
|
} else {
|
|
37107
37301
|
if (throttle.reply) DIRECT_CHAT_USAGE_LIMIT_CACHE.delete(throttleKey);
|
|
37108
37302
|
process.stderr.write(
|
|
37109
|
-
`direct-chat-channel: [usage-limit-reactive] ${throttle.reply ? "notice" : "consume"} failed for session=${args.sessionId}: ${
|
|
37303
|
+
`direct-chat-channel: [usage-limit-reactive] ${throttle.reply ? "notice" : "consume"} failed for session=${args.sessionId}: ${verdict.error}
|
|
37110
37304
|
`
|
|
37111
37305
|
);
|
|
37112
37306
|
}
|
|
@@ -37164,13 +37358,28 @@ async function pollForMessages(sinceMs) {
|
|
|
37164
37358
|
const body = throttle.reply ? { agent_id: AGT_AGENT_ID, session_id: msg.session_id, content: MAINTENANCE_OFFLINE_MESSAGE, message_ids: [msg.id], kind: "notice" } : { agent_id: AGT_AGENT_ID, session_id: msg.session_id, message_ids: [msg.id] };
|
|
37165
37359
|
try {
|
|
37166
37360
|
const res2 = await apiPost(route, body);
|
|
37167
|
-
const data2 = await res2
|
|
37168
|
-
|
|
37361
|
+
const { body: data2, httpOk, statusText } = await readCursorAdvanceBody(res2);
|
|
37362
|
+
const verdict = judgeCursorAdvance(
|
|
37363
|
+
{
|
|
37364
|
+
messageIds: [msg.id],
|
|
37365
|
+
httpOk,
|
|
37366
|
+
httpStatus: res2.status,
|
|
37367
|
+
statusText,
|
|
37368
|
+
body: data2
|
|
37369
|
+
},
|
|
37370
|
+
{
|
|
37371
|
+
route: throttle.reply ? "reply" : "consume",
|
|
37372
|
+
site: "maintenance-offline",
|
|
37373
|
+
sessionId: msg.session_id,
|
|
37374
|
+
cleared: ["processed-marker"]
|
|
37375
|
+
}
|
|
37376
|
+
);
|
|
37377
|
+
if (verdict.outcome !== "failed") {
|
|
37169
37378
|
markProcessed(msg.id);
|
|
37170
37379
|
} else {
|
|
37171
37380
|
if (throttle.reply) DIRECT_CHAT_MAINTENANCE_CACHE.delete(throttleKey);
|
|
37172
37381
|
process.stderr.write(
|
|
37173
|
-
`direct-chat-channel: maintenance ${throttle.reply ? "reply" : "consume"} failed: ${
|
|
37382
|
+
`direct-chat-channel: maintenance ${throttle.reply ? "reply" : "consume"} failed: ${verdict.error}
|
|
37174
37383
|
`
|
|
37175
37384
|
);
|
|
37176
37385
|
}
|
|
@@ -37195,13 +37404,28 @@ async function pollForMessages(sinceMs) {
|
|
|
37195
37404
|
const body = throttle.reply ? { agent_id: AGT_AGENT_ID, session_id: msg.session_id, content: buildAccountIssueReplyText(), message_ids: [msg.id], kind: "notice" } : { agent_id: AGT_AGENT_ID, session_id: msg.session_id, message_ids: [msg.id] };
|
|
37196
37405
|
try {
|
|
37197
37406
|
const res2 = await apiPost(route, body);
|
|
37198
|
-
const data2 = await res2
|
|
37199
|
-
|
|
37407
|
+
const { body: data2, httpOk, statusText } = await readCursorAdvanceBody(res2);
|
|
37408
|
+
const verdict = judgeCursorAdvance(
|
|
37409
|
+
{
|
|
37410
|
+
messageIds: [msg.id],
|
|
37411
|
+
httpOk,
|
|
37412
|
+
httpStatus: res2.status,
|
|
37413
|
+
statusText,
|
|
37414
|
+
body: data2
|
|
37415
|
+
},
|
|
37416
|
+
{
|
|
37417
|
+
route: throttle.reply ? "reply" : "consume",
|
|
37418
|
+
site: "account-mute",
|
|
37419
|
+
sessionId: msg.session_id,
|
|
37420
|
+
cleared: ["processed-marker"]
|
|
37421
|
+
}
|
|
37422
|
+
);
|
|
37423
|
+
if (verdict.outcome !== "failed") {
|
|
37200
37424
|
markProcessed(msg.id);
|
|
37201
37425
|
} else {
|
|
37202
37426
|
if (throttle.reply) DIRECT_CHAT_ACCOUNT_MUTE_CACHE.delete(throttleKey);
|
|
37203
37427
|
process.stderr.write(
|
|
37204
|
-
`direct-chat-channel: account-mute ${throttle.reply ? "reply" : "consume"} failed: ${
|
|
37428
|
+
`direct-chat-channel: account-mute ${throttle.reply ? "reply" : "consume"} failed: ${verdict.error}
|
|
37205
37429
|
`
|
|
37206
37430
|
);
|
|
37207
37431
|
}
|
|
@@ -37271,7 +37495,23 @@ async function pollForMessages(sinceMs) {
|
|
|
37271
37495
|
session_id: msg.session_id,
|
|
37272
37496
|
message_ids: [msg.id]
|
|
37273
37497
|
});
|
|
37274
|
-
|
|
37498
|
+
const { body: data2, httpOk, statusText } = await readCursorAdvanceBody(res2);
|
|
37499
|
+
const verdict = judgeCursorAdvance(
|
|
37500
|
+
{
|
|
37501
|
+
messageIds: [msg.id],
|
|
37502
|
+
httpOk,
|
|
37503
|
+
httpStatus: res2.status,
|
|
37504
|
+
statusText,
|
|
37505
|
+
body: data2
|
|
37506
|
+
},
|
|
37507
|
+
{
|
|
37508
|
+
route: "consume",
|
|
37509
|
+
site: "notice-push-consume",
|
|
37510
|
+
sessionId: msg.session_id,
|
|
37511
|
+
cleared: ["processed-marker"]
|
|
37512
|
+
}
|
|
37513
|
+
);
|
|
37514
|
+
if (verdict.outcome === "failed") throw new Error(verdict.error);
|
|
37275
37515
|
markProcessed(msg.id);
|
|
37276
37516
|
} catch (err) {
|
|
37277
37517
|
process.stderr.write(
|
|
@@ -37411,7 +37651,7 @@ function sweepAgedDirectChatMarkersNow(thresholdMs) {
|
|
|
37411
37651
|
const now = Date.now();
|
|
37412
37652
|
const res = sweepAgedDirectChatMarkers(DIRECT_CHAT_PENDING_INBOUND_DIR, {
|
|
37413
37653
|
readdir: (dir) => readdirSync6(dir),
|
|
37414
|
-
readFile: (p2) =>
|
|
37654
|
+
readFile: (p2) => readFileSync11(p2, "utf8"),
|
|
37415
37655
|
unlink: (p2) => {
|
|
37416
37656
|
if (existsSync6(p2)) unlinkSync4(p2);
|
|
37417
37657
|
},
|
|
@@ -37447,7 +37687,7 @@ function sanitizeRecoveryText(text) {
|
|
|
37447
37687
|
}
|
|
37448
37688
|
function directChatRecoveryDeps() {
|
|
37449
37689
|
return {
|
|
37450
|
-
readFile: (p2) =>
|
|
37690
|
+
readFile: (p2) => readFileSync11(p2, "utf-8"),
|
|
37451
37691
|
renameFile: (from, to) => renameSync5(from, to),
|
|
37452
37692
|
unlinkFile: (p2) => {
|
|
37453
37693
|
if (existsSync6(p2)) unlinkSync4(p2);
|
|
@@ -37460,7 +37700,7 @@ function directChatRecoveryDeps() {
|
|
|
37460
37700
|
if (!DIRECT_CHAT_RECOVERY_LEDGER_DIR) return;
|
|
37461
37701
|
if (markerName.includes("/") || markerName.includes("\\") || markerName.includes("..")) return;
|
|
37462
37702
|
try {
|
|
37463
|
-
const p2 =
|
|
37703
|
+
const p2 = join14(DIRECT_CHAT_RECOVERY_LEDGER_DIR, markerName);
|
|
37464
37704
|
if (existsSync6(p2)) unlinkSync4(p2);
|
|
37465
37705
|
} catch {
|
|
37466
37706
|
}
|
|
@@ -37473,8 +37713,23 @@ function directChatRecoveryDeps() {
|
|
|
37473
37713
|
content,
|
|
37474
37714
|
message_ids: messageIds
|
|
37475
37715
|
});
|
|
37476
|
-
const data = await res
|
|
37477
|
-
|
|
37716
|
+
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
37717
|
+
const verdict = judgeCursorAdvance(
|
|
37718
|
+
{
|
|
37719
|
+
messageIds,
|
|
37720
|
+
httpOk,
|
|
37721
|
+
httpStatus: res.status,
|
|
37722
|
+
statusText,
|
|
37723
|
+
body: data
|
|
37724
|
+
},
|
|
37725
|
+
{
|
|
37726
|
+
route: "reply",
|
|
37727
|
+
site: "recovery-outbox",
|
|
37728
|
+
sessionId,
|
|
37729
|
+
cleared: ["claim", "markers", "outbox-payload", "recovery-ledger"]
|
|
37730
|
+
}
|
|
37731
|
+
);
|
|
37732
|
+
if (verdict.outcome === "failed") return { ok: false, error: verdict.error };
|
|
37478
37733
|
return { ok: true };
|
|
37479
37734
|
} catch (err) {
|
|
37480
37735
|
return { ok: false, error: err.message };
|
|
@@ -37496,7 +37751,7 @@ async function processDirectChatRecoveryOutboxFile(filename) {
|
|
|
37496
37751
|
if (!enabled) return;
|
|
37497
37752
|
directChatRecoveryInFlight.add(filename);
|
|
37498
37753
|
try {
|
|
37499
|
-
const fullPath =
|
|
37754
|
+
const fullPath = join14(DIRECT_CHAT_RECOVERY_OUTBOX_DIR, filename);
|
|
37500
37755
|
await consumeDirectChatRecoveryFile(fullPath, filename, directChatRecoveryDeps());
|
|
37501
37756
|
} catch (err) {
|
|
37502
37757
|
process.stderr.write(
|
|
@@ -37524,7 +37779,7 @@ if (DIRECT_CHAT_RECOVERY_OUTBOX_DIR) {
|
|
|
37524
37779
|
if (!filename) return;
|
|
37525
37780
|
const name = filename.toString();
|
|
37526
37781
|
if (!name.endsWith(".json")) return;
|
|
37527
|
-
if (existsSync6(
|
|
37782
|
+
if (existsSync6(join14(DIRECT_CHAT_RECOVERY_OUTBOX_DIR, name))) {
|
|
37528
37783
|
void processDirectChatRecoveryOutboxFile(name);
|
|
37529
37784
|
}
|
|
37530
37785
|
});
|
package/dist/mcp/origami.js
CHANGED
|
@@ -39845,6 +39845,20 @@ var DIRECT_CHAT_UPLOAD_MAX_BYTES = 10 * MB2;
|
|
|
39845
39845
|
var AGENT_DIRECTED_NOTICE_KINDS = ["scheduled_task_nudge", "kanban_check"];
|
|
39846
39846
|
var AGENT_DIRECTED_KIND_SET = new Set(AGENT_DIRECTED_NOTICE_KINDS);
|
|
39847
39847
|
|
|
39848
|
+
// ../core/dist/direct-chat/cursor-advance.js
|
|
39849
|
+
var CURSOR_SHORTFALL_REASONS = [
|
|
39850
|
+
"not_found",
|
|
39851
|
+
"gave_up",
|
|
39852
|
+
"already_delivered",
|
|
39853
|
+
"error",
|
|
39854
|
+
"undiagnosed",
|
|
39855
|
+
"unknown",
|
|
39856
|
+
"unreported",
|
|
39857
|
+
"malformed_count",
|
|
39858
|
+
"other"
|
|
39859
|
+
];
|
|
39860
|
+
var KNOWN_REASONS = new Set(CURSOR_SHORTFALL_REASONS);
|
|
39861
|
+
|
|
39848
39862
|
// ../core/dist/onboarding/state-machine.js
|
|
39849
39863
|
var AREA_ORDER = [
|
|
39850
39864
|
"framing",
|
|
@@ -33740,6 +33740,20 @@ var DIRECT_CHAT_UPLOAD_MAX_BYTES = 10 * MB2;
|
|
|
33740
33740
|
var AGENT_DIRECTED_NOTICE_KINDS = ["scheduled_task_nudge", "kanban_check"];
|
|
33741
33741
|
var AGENT_DIRECTED_KIND_SET = new Set(AGENT_DIRECTED_NOTICE_KINDS);
|
|
33742
33742
|
|
|
33743
|
+
// ../core/dist/direct-chat/cursor-advance.js
|
|
33744
|
+
var CURSOR_SHORTFALL_REASONS = [
|
|
33745
|
+
"not_found",
|
|
33746
|
+
"gave_up",
|
|
33747
|
+
"already_delivered",
|
|
33748
|
+
"error",
|
|
33749
|
+
"undiagnosed",
|
|
33750
|
+
"unknown",
|
|
33751
|
+
"unreported",
|
|
33752
|
+
"malformed_count",
|
|
33753
|
+
"other"
|
|
33754
|
+
];
|
|
33755
|
+
var KNOWN_REASONS = new Set(CURSOR_SHORTFALL_REASONS);
|
|
33756
|
+
|
|
33743
33757
|
// ../core/dist/onboarding/state-machine.js
|
|
33744
33758
|
var AREA_ORDER = [
|
|
33745
33759
|
"framing",
|
|
@@ -34066,6 +34066,20 @@ var DIRECT_CHAT_UPLOAD_MAX_BYTES = 10 * MB2;
|
|
|
34066
34066
|
var AGENT_DIRECTED_NOTICE_KINDS = ["scheduled_task_nudge", "kanban_check"];
|
|
34067
34067
|
var AGENT_DIRECTED_KIND_SET = new Set(AGENT_DIRECTED_NOTICE_KINDS);
|
|
34068
34068
|
|
|
34069
|
+
// ../core/dist/direct-chat/cursor-advance.js
|
|
34070
|
+
var CURSOR_SHORTFALL_REASONS = [
|
|
34071
|
+
"not_found",
|
|
34072
|
+
"gave_up",
|
|
34073
|
+
"already_delivered",
|
|
34074
|
+
"error",
|
|
34075
|
+
"undiagnosed",
|
|
34076
|
+
"unknown",
|
|
34077
|
+
"unreported",
|
|
34078
|
+
"malformed_count",
|
|
34079
|
+
"other"
|
|
34080
|
+
];
|
|
34081
|
+
var KNOWN_REASONS = new Set(CURSOR_SHORTFALL_REASONS);
|
|
34082
|
+
|
|
34069
34083
|
// ../core/dist/onboarding/state-machine.js
|
|
34070
34084
|
var AREA_ORDER = [
|
|
34071
34085
|
"framing",
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
writeDirectChatSessionState,
|
|
37
37
|
writeEgressAllowlist,
|
|
38
38
|
writePersistentClaudeWrapper
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-4SQZDAWG.js";
|
|
40
40
|
import "./chunk-XWVM4KPK.js";
|
|
41
41
|
export {
|
|
42
42
|
EGRESS_BASELINE_DOMAINS,
|
|
@@ -77,4 +77,4 @@ export {
|
|
|
77
77
|
writeEgressAllowlist,
|
|
78
78
|
writePersistentClaudeWrapper
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=persistent-session-
|
|
80
|
+
//# sourceMappingURL=persistent-session-TSPVNVQL.js.map
|