@integrity-labs/agt-cli 0.28.494 → 0.28.496
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-DJNJWFKI.js → chunk-DZSS6TA3.js} +15 -7
- package/dist/{chunk-DJNJWFKI.js.map → chunk-DZSS6TA3.js.map} +1 -1
- package/dist/{chunk-JHEJP3KC.js → chunk-JWR5FP7S.js} +119 -1
- package/dist/chunk-JWR5FP7S.js.map +1 -0
- package/dist/{claude-pair-runtime-2RMAJGZH.js → claude-pair-runtime-C2O3QBAT.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 +318 -46
- package/dist/mcp/origami.js +31 -0
- package/dist/mcp/remote-oauth-proxy.js +62 -35
- package/dist/mcp/slack-channel.js +31 -0
- package/dist/mcp/telegram-channel.js +31 -0
- package/dist/{persistent-session-JEN37LZS.js → persistent-session-O7YXPCRX.js} +2 -2
- package/dist/{responsiveness-probe-MSXL7NVR.js → responsiveness-probe-Z4L2CZNA.js} +64 -2
- package/dist/responsiveness-probe-Z4L2CZNA.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/{claude-pair-runtime-2RMAJGZH.js.map → claude-pair-runtime-C2O3QBAT.js.map} +0 -0
- /package/dist/{persistent-session-JEN37LZS.js.map → persistent-session-O7YXPCRX.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
|
}
|
|
@@ -32373,6 +32373,23 @@ var ASSET_TYPES = {
|
|
|
32373
32373
|
var DEFAULT_CHUNK_BUDGET_BYTES = 180 * 1024;
|
|
32374
32374
|
var textEncoder = new TextEncoder();
|
|
32375
32375
|
|
|
32376
|
+
// ../core/dist/integrations/remote-mcp-proxy-env.js
|
|
32377
|
+
var REMOTE_MCP_PROXY_ENV = {
|
|
32378
|
+
url: "AGT_REMOTE_MCP_URL",
|
|
32379
|
+
tokenFile: "AGT_REMOTE_MCP_TOKEN_FILE",
|
|
32380
|
+
tokenVar: "AGT_REMOTE_MCP_TOKEN_VAR",
|
|
32381
|
+
label: "AGT_REMOTE_MCP_LABEL",
|
|
32382
|
+
authHeader: "AGT_REMOTE_MCP_AUTH_HEADER",
|
|
32383
|
+
extraHeaders: "AGT_REMOTE_MCP_EXTRA_HEADERS",
|
|
32384
|
+
toolAllowlist: "AGT_REMOTE_MCP_TOOL_ALLOWLIST",
|
|
32385
|
+
preEnableToolsets: "AGT_REMOTE_MCP_PREENABLE_TOOLSETS"
|
|
32386
|
+
};
|
|
32387
|
+
var REMOTE_MCP_AUTH_ENV_KEYS = [
|
|
32388
|
+
REMOTE_MCP_PROXY_ENV.tokenVar,
|
|
32389
|
+
REMOTE_MCP_PROXY_ENV.authHeader,
|
|
32390
|
+
REMOTE_MCP_PROXY_ENV.extraHeaders
|
|
32391
|
+
];
|
|
32392
|
+
|
|
32376
32393
|
// ../core/dist/integrations/registry.js
|
|
32377
32394
|
var INTEGRATION_REGISTRY = [
|
|
32378
32395
|
{
|
|
@@ -33518,6 +33535,65 @@ var DIRECT_CHAT_UPLOAD_MAX_BYTES = 10 * MB2;
|
|
|
33518
33535
|
var AGENT_DIRECTED_NOTICE_KINDS = ["scheduled_task_nudge", "kanban_check"];
|
|
33519
33536
|
var AGENT_DIRECTED_KIND_SET = new Set(AGENT_DIRECTED_NOTICE_KINDS);
|
|
33520
33537
|
|
|
33538
|
+
// ../core/dist/direct-chat/cursor-advance.js
|
|
33539
|
+
var CURSOR_SHORTFALL_REASONS = [
|
|
33540
|
+
"not_found",
|
|
33541
|
+
"gave_up",
|
|
33542
|
+
"already_delivered",
|
|
33543
|
+
"error",
|
|
33544
|
+
"undiagnosed",
|
|
33545
|
+
"unknown",
|
|
33546
|
+
"unreported",
|
|
33547
|
+
"malformed_count",
|
|
33548
|
+
"other"
|
|
33549
|
+
];
|
|
33550
|
+
var KNOWN_REASONS = new Set(CURSOR_SHORTFALL_REASONS);
|
|
33551
|
+
function normalizeCursorShortfallReason(raw) {
|
|
33552
|
+
if (raw == null || raw === "")
|
|
33553
|
+
return "unreported";
|
|
33554
|
+
return KNOWN_REASONS.has(raw) ? raw : "other";
|
|
33555
|
+
}
|
|
33556
|
+
function classifyCursorAdvance(input) {
|
|
33557
|
+
const body = input.body ?? void 0;
|
|
33558
|
+
if (!input.httpOk || body?.error != null) {
|
|
33559
|
+
const error2 = body?.error ?? input.statusText ?? (input.httpStatus !== void 0 ? `HTTP ${input.httpStatus}` : "request failed");
|
|
33560
|
+
return { outcome: "failed", error: error2 };
|
|
33561
|
+
}
|
|
33562
|
+
const expected = new Set(input.messageIds).size;
|
|
33563
|
+
const raw = body?.consumed;
|
|
33564
|
+
if (raw === void 0 || raw === null) {
|
|
33565
|
+
return { outcome: "advanced", reported: false, expected, consumed: 0 };
|
|
33566
|
+
}
|
|
33567
|
+
if (typeof raw !== "number" || !Number.isSafeInteger(raw) || raw < 0) {
|
|
33568
|
+
if (expected === 0)
|
|
33569
|
+
return { outcome: "advanced", reported: false, expected, consumed: 0 };
|
|
33570
|
+
return {
|
|
33571
|
+
outcome: "shortfall",
|
|
33572
|
+
expected,
|
|
33573
|
+
consumed: 0,
|
|
33574
|
+
reason: "malformed_count",
|
|
33575
|
+
partial: false
|
|
33576
|
+
};
|
|
33577
|
+
}
|
|
33578
|
+
if (raw < expected) {
|
|
33579
|
+
return {
|
|
33580
|
+
outcome: "shortfall",
|
|
33581
|
+
expected,
|
|
33582
|
+
consumed: raw,
|
|
33583
|
+
reason: normalizeCursorShortfallReason(body?.reason),
|
|
33584
|
+
partial: raw > 0
|
|
33585
|
+
};
|
|
33586
|
+
}
|
|
33587
|
+
return { outcome: "advanced", reported: true, expected, consumed: raw };
|
|
33588
|
+
}
|
|
33589
|
+
function cursorShortfallKey(route, reason, partial2) {
|
|
33590
|
+
return `${route}|${reason}|${partial2 ? "true" : "false"}`;
|
|
33591
|
+
}
|
|
33592
|
+
function formatCursorAdvanceShortfall(verdict, ctx) {
|
|
33593
|
+
const cleared = ctx.cleared.length > 0 ? ctx.cleared.join(",") : "none";
|
|
33594
|
+
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}`;
|
|
33595
|
+
}
|
|
33596
|
+
|
|
33521
33597
|
// ../core/dist/onboarding/state-machine.js
|
|
33522
33598
|
var AREA_ORDER = [
|
|
33523
33599
|
"framing",
|
|
@@ -35839,13 +35915,13 @@ function readLockHolder(path) {
|
|
|
35839
35915
|
|
|
35840
35916
|
// src/direct-chat-channel.ts
|
|
35841
35917
|
import { homedir as homedir4 } from "os";
|
|
35842
|
-
import { join as
|
|
35918
|
+
import { join as join14 } from "path";
|
|
35843
35919
|
import { randomUUID } from "crypto";
|
|
35844
35920
|
import {
|
|
35845
35921
|
watch,
|
|
35846
35922
|
mkdirSync as mkdirSync5,
|
|
35847
|
-
writeFileSync as
|
|
35848
|
-
readFileSync as
|
|
35923
|
+
writeFileSync as writeFileSync7,
|
|
35924
|
+
readFileSync as readFileSync11,
|
|
35849
35925
|
readdirSync as readdirSync6,
|
|
35850
35926
|
existsSync as existsSync6,
|
|
35851
35927
|
renameSync as renameSync5,
|
|
@@ -36323,6 +36399,58 @@ function shouldSendAccountWarn(opts) {
|
|
|
36323
36399
|
}).reply;
|
|
36324
36400
|
}
|
|
36325
36401
|
|
|
36402
|
+
// ../core/dist/direct-chat/cursor-advance-telemetry.js
|
|
36403
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "fs";
|
|
36404
|
+
import { join as join13 } from "path";
|
|
36405
|
+
var CURSOR_SHORTFALL_COUNTER_SUFFIX = "-cursor-advance-classifications.json";
|
|
36406
|
+
function recordCursorAdvanceShortfall(agentDir, source, classification) {
|
|
36407
|
+
if (!agentDir)
|
|
36408
|
+
return;
|
|
36409
|
+
const path = join13(agentDir, `${source}${CURSOR_SHORTFALL_COUNTER_SUFFIX}`);
|
|
36410
|
+
const counts = {};
|
|
36411
|
+
try {
|
|
36412
|
+
const parsed = JSON.parse(readFileSync10(path, "utf-8"));
|
|
36413
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
36414
|
+
for (const [k, v] of Object.entries(parsed)) {
|
|
36415
|
+
if (typeof v === "number" && Number.isInteger(v) && v >= 0)
|
|
36416
|
+
counts[k] = v;
|
|
36417
|
+
}
|
|
36418
|
+
}
|
|
36419
|
+
} catch {
|
|
36420
|
+
}
|
|
36421
|
+
const key = cursorShortfallKey(classification.route, classification.reason, classification.partial);
|
|
36422
|
+
counts[key] = (counts[key] ?? 0) + 1;
|
|
36423
|
+
try {
|
|
36424
|
+
writeFileSync6(path, JSON.stringify(counts), { mode: 384 });
|
|
36425
|
+
} catch {
|
|
36426
|
+
}
|
|
36427
|
+
}
|
|
36428
|
+
|
|
36429
|
+
// src/direct-chat-cursor-body.ts
|
|
36430
|
+
async function readCursorAdvanceBody(res) {
|
|
36431
|
+
let body;
|
|
36432
|
+
let bodyError;
|
|
36433
|
+
try {
|
|
36434
|
+
const parsed = await res.json();
|
|
36435
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
36436
|
+
bodyError = "invalid";
|
|
36437
|
+
} else {
|
|
36438
|
+
body = parsed;
|
|
36439
|
+
}
|
|
36440
|
+
} catch {
|
|
36441
|
+
bodyError = "unreadable";
|
|
36442
|
+
}
|
|
36443
|
+
return {
|
|
36444
|
+
body,
|
|
36445
|
+
httpOk: res.ok && bodyError === void 0,
|
|
36446
|
+
// `res.statusText` is '' on HTTP/2, where it does not exist at all. Passing
|
|
36447
|
+
// '' through is not caught by `classifyCursorAdvance`'s `??` fallback (an
|
|
36448
|
+
// empty string is not nullish), so the operator would get `Reply failed: `
|
|
36449
|
+
// with nothing after it.
|
|
36450
|
+
statusText: bodyError === void 0 ? res.statusText || `HTTP ${res.status}` : `HTTP ${res.status} (${bodyError} response body)`
|
|
36451
|
+
};
|
|
36452
|
+
}
|
|
36453
|
+
|
|
36326
36454
|
// src/usage-limit-reactive-decision.ts
|
|
36327
36455
|
import { createHash } from "crypto";
|
|
36328
36456
|
function shouldArmWatch(opts) {
|
|
@@ -36335,6 +36463,9 @@ function decideUsageLimitCursorCall(opts) {
|
|
|
36335
36463
|
body: {
|
|
36336
36464
|
agent_id: opts.agentId,
|
|
36337
36465
|
session_id: opts.sessionId,
|
|
36466
|
+
// This module BUILDS the body but never posts it; the POST and its
|
|
36467
|
+
// verdict live at the `usage-limit-reactive` site in direct-chat-channel.ts.
|
|
36468
|
+
// cursor-advance-allow: body-only, judged at the call site.
|
|
36338
36469
|
message_ids: [opts.messageId]
|
|
36339
36470
|
}
|
|
36340
36471
|
};
|
|
@@ -36345,6 +36476,7 @@ function decideUsageLimitCursorCall(opts) {
|
|
|
36345
36476
|
agent_id: opts.agentId,
|
|
36346
36477
|
session_id: opts.sessionId,
|
|
36347
36478
|
content: opts.noticeText,
|
|
36479
|
+
// cursor-advance-allow: body-only, as above — judged at the call site.
|
|
36348
36480
|
message_ids: [opts.messageId],
|
|
36349
36481
|
// ENG-8274: a cap refusal is the SYSTEM speaking, not the agent.
|
|
36350
36482
|
// Orthogonal to message_ids — consuming the cursor is about delivery,
|
|
@@ -36377,7 +36509,7 @@ var DIRECT_CHAT_ACCOUNT_WARN_COOLDOWN_MS = (() => {
|
|
|
36377
36509
|
var AGT_HOST = process.env.AGT_HOST;
|
|
36378
36510
|
var AGT_API_KEY = process.env.AGT_API_KEY;
|
|
36379
36511
|
var AGT_AGENT_ID = process.env.AGT_AGENT_ID;
|
|
36380
|
-
var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ?
|
|
36512
|
+
var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ? join14(homedir4(), ".augmented", AGT_AGENT_ID) : null;
|
|
36381
36513
|
var INBOUND_ATTACHMENTS_DIR = resolveInboundAttachmentsDir({
|
|
36382
36514
|
codeName: process.env.AGT_AGENT_CODE_NAME,
|
|
36383
36515
|
turnInitiatorFile: process.env.AGT_TURN_INITIATOR_FILE,
|
|
@@ -36388,10 +36520,10 @@ var AGT_AGENT_CODE_NAME = process.env.AGT_AGENT_CODE_NAME;
|
|
|
36388
36520
|
var directChatStderrLogStream = null;
|
|
36389
36521
|
if (AGT_AGENT_CODE_NAME) {
|
|
36390
36522
|
try {
|
|
36391
|
-
const logDir =
|
|
36523
|
+
const logDir = join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME);
|
|
36392
36524
|
mkdirSync5(logDir, { recursive: true });
|
|
36393
36525
|
directChatStderrLogStream = createWriteStream(
|
|
36394
|
-
|
|
36526
|
+
join14(logDir, "direct-chat-channel-stderr.log"),
|
|
36395
36527
|
{ flags: "a", mode: 384 }
|
|
36396
36528
|
);
|
|
36397
36529
|
directChatStderrLogStream.on("error", () => {
|
|
@@ -36410,11 +36542,24 @@ if (AGT_AGENT_CODE_NAME) {
|
|
|
36410
36542
|
} catch {
|
|
36411
36543
|
}
|
|
36412
36544
|
}
|
|
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 ?
|
|
36545
|
+
var PROGRESS_HEARTBEAT_PATH = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME, "channel-progress-heartbeat.json") : null;
|
|
36546
|
+
var DIRECT_CHAT_PENDING_INBOUND_DIR = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME, "direct-chat-pending-inbound") : null;
|
|
36547
|
+
var DIRECT_CHAT_DELIVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME, ".agt-inbound-delivery-ledger") : null;
|
|
36548
|
+
var DIRECT_CHAT_CODE_NAME_AGENT_DIR = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME) : null;
|
|
36417
36549
|
var DIRECT_CHAT_STALE_MARKER_MS = 24 * 60 * 60 * 1e3;
|
|
36550
|
+
function judgeCursorAdvance(input, ctx) {
|
|
36551
|
+
const verdict = classifyCursorAdvance(input);
|
|
36552
|
+
if (verdict.outcome === "shortfall") {
|
|
36553
|
+
process.stderr.write(`direct-chat-channel: ${formatCursorAdvanceShortfall(verdict, ctx)}
|
|
36554
|
+
`);
|
|
36555
|
+
recordCursorAdvanceShortfall(DIRECT_CHAT_CODE_NAME_AGENT_DIR, "direct-chat", {
|
|
36556
|
+
route: ctx.route,
|
|
36557
|
+
reason: verdict.reason,
|
|
36558
|
+
partial: verdict.partial
|
|
36559
|
+
});
|
|
36560
|
+
}
|
|
36561
|
+
return verdict;
|
|
36562
|
+
}
|
|
36418
36563
|
function recordDirectChatDelivery(sessionId, messageIds) {
|
|
36419
36564
|
if (!sessionId) return;
|
|
36420
36565
|
writeInboundDeliveryLedgerEntry(DIRECT_CHAT_DELIVERY_LEDGER_DIR, {
|
|
@@ -36424,8 +36569,8 @@ function recordDirectChatDelivery(sessionId, messageIds) {
|
|
|
36424
36569
|
delivered_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
36425
36570
|
});
|
|
36426
36571
|
}
|
|
36427
|
-
var DIRECT_CHAT_RECOVERY_OUTBOX_DIR = AGT_AGENT_CODE_NAME ?
|
|
36428
|
-
var DIRECT_CHAT_RECOVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ?
|
|
36572
|
+
var DIRECT_CHAT_RECOVERY_OUTBOX_DIR = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME, "direct-chat-recovery-outbox") : null;
|
|
36573
|
+
var DIRECT_CHAT_RECOVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME, ".agt-direct-chat-recovery-ledger") : null;
|
|
36429
36574
|
var progressReceivedAt = /* @__PURE__ */ new Map();
|
|
36430
36575
|
var directChatProgressState = { tracked: null };
|
|
36431
36576
|
var directChatProgressTickRunning = false;
|
|
@@ -36444,7 +36589,7 @@ var directChatKanbanCardClient = createKanbanCardActiveClient({
|
|
|
36444
36589
|
function readProgressHeartbeat() {
|
|
36445
36590
|
if (!PROGRESS_HEARTBEAT_PATH || !existsSync6(PROGRESS_HEARTBEAT_PATH)) return null;
|
|
36446
36591
|
try {
|
|
36447
|
-
return parseProgressHeartbeat(
|
|
36592
|
+
return parseProgressHeartbeat(readFileSync11(PROGRESS_HEARTBEAT_PATH, "utf-8"));
|
|
36448
36593
|
} catch {
|
|
36449
36594
|
return null;
|
|
36450
36595
|
}
|
|
@@ -36453,8 +36598,8 @@ function seedProgressHeartbeat() {
|
|
|
36453
36598
|
if (!PROGRESS_HEARTBEAT_PATH) return;
|
|
36454
36599
|
const tmp = `${PROGRESS_HEARTBEAT_PATH}.${process.pid}.tmp`;
|
|
36455
36600
|
try {
|
|
36456
|
-
mkdirSync5(
|
|
36457
|
-
|
|
36601
|
+
mkdirSync5(join14(homedir4(), ".augmented", AGT_AGENT_CODE_NAME), { recursive: true });
|
|
36602
|
+
writeFileSync7(tmp, serializeProgressHeartbeat(SEED_PROGRESS_STEP, Date.now()), { mode: 384 });
|
|
36458
36603
|
renameSync5(tmp, PROGRESS_HEARTBEAT_PATH);
|
|
36459
36604
|
} catch {
|
|
36460
36605
|
try {
|
|
@@ -36614,6 +36759,9 @@ async function maybeSendDirectChatAccountWarn(sessionId) {
|
|
|
36614
36759
|
agent_id: AGT_AGENT_ID,
|
|
36615
36760
|
session_id: sessionId,
|
|
36616
36761
|
content: buildAccountIssueReplyText(),
|
|
36762
|
+
// The L1 warn nag is an extra message alongside the agent's real reply,
|
|
36763
|
+
// which has already advanced the cursor.
|
|
36764
|
+
// cursor-advance-allow: deliberately EMPTY — nothing to advance, no count to read.
|
|
36617
36765
|
message_ids: [],
|
|
36618
36766
|
// ENG-8274: kind:'notice' — an account-auth nag is the system speaking, not
|
|
36619
36767
|
// the agent, and owes no reply.
|
|
@@ -36647,8 +36795,8 @@ var inboundAttachmentDeps = {
|
|
|
36647
36795
|
};
|
|
36648
36796
|
},
|
|
36649
36797
|
ensureDir: (dir) => mkdirSync5(dir, { recursive: true }),
|
|
36650
|
-
writeFile: (path, bytes) =>
|
|
36651
|
-
joinPath: (...parts) =>
|
|
36798
|
+
writeFile: (path, bytes) => writeFileSync7(path, bytes, { mode: 384 }),
|
|
36799
|
+
joinPath: (...parts) => join14(...parts),
|
|
36652
36800
|
warn: (msg) => process.stderr.write(`${msg}
|
|
36653
36801
|
`)
|
|
36654
36802
|
};
|
|
@@ -36813,11 +36961,29 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
36813
36961
|
content: slices[0],
|
|
36814
36962
|
message_ids
|
|
36815
36963
|
});
|
|
36816
|
-
const data = await res
|
|
36817
|
-
|
|
36964
|
+
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
36965
|
+
const verdict = judgeCursorAdvance(
|
|
36966
|
+
{
|
|
36967
|
+
messageIds: message_ids,
|
|
36968
|
+
httpOk,
|
|
36969
|
+
httpStatus: res.status,
|
|
36970
|
+
statusText,
|
|
36971
|
+
body: data
|
|
36972
|
+
},
|
|
36973
|
+
{
|
|
36974
|
+
route: "reply",
|
|
36975
|
+
site: "direct_chat.reply:stream-anchor",
|
|
36976
|
+
sessionId: session_id,
|
|
36977
|
+
cleared: ["claim", "markers", "delivery-ledger"]
|
|
36978
|
+
}
|
|
36979
|
+
);
|
|
36980
|
+
if (verdict.outcome === "failed" || !data?.message_id) {
|
|
36818
36981
|
return {
|
|
36819
36982
|
content: [
|
|
36820
|
-
{
|
|
36983
|
+
{
|
|
36984
|
+
type: "text",
|
|
36985
|
+
text: `Reply failed: ${verdict.outcome === "failed" ? verdict.error : "no message_id returned"}`
|
|
36986
|
+
}
|
|
36821
36987
|
],
|
|
36822
36988
|
isError: true
|
|
36823
36989
|
};
|
|
@@ -36862,10 +37028,25 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
36862
37028
|
content,
|
|
36863
37029
|
message_ids
|
|
36864
37030
|
});
|
|
36865
|
-
const data = await res
|
|
36866
|
-
|
|
37031
|
+
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
37032
|
+
const verdict = judgeCursorAdvance(
|
|
37033
|
+
{
|
|
37034
|
+
messageIds: message_ids,
|
|
37035
|
+
httpOk,
|
|
37036
|
+
httpStatus: res.status,
|
|
37037
|
+
statusText,
|
|
37038
|
+
body: data
|
|
37039
|
+
},
|
|
37040
|
+
{
|
|
37041
|
+
route: "reply",
|
|
37042
|
+
site: "direct_chat.reply:single-shot",
|
|
37043
|
+
sessionId: session_id,
|
|
37044
|
+
cleared: ["claim", "markers", "delivery-ledger"]
|
|
37045
|
+
}
|
|
37046
|
+
);
|
|
37047
|
+
if (verdict.outcome === "failed") {
|
|
36867
37048
|
return {
|
|
36868
|
-
content: [{ type: "text", text: `Reply failed: ${
|
|
37049
|
+
content: [{ type: "text", text: `Reply failed: ${verdict.error}` }],
|
|
36869
37050
|
isError: true
|
|
36870
37051
|
};
|
|
36871
37052
|
}
|
|
@@ -36893,10 +37074,25 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
36893
37074
|
session_id,
|
|
36894
37075
|
message_ids
|
|
36895
37076
|
});
|
|
36896
|
-
const data = await res
|
|
36897
|
-
|
|
37077
|
+
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
37078
|
+
const verdict = judgeCursorAdvance(
|
|
37079
|
+
{
|
|
37080
|
+
messageIds: message_ids,
|
|
37081
|
+
httpOk,
|
|
37082
|
+
httpStatus: res.status,
|
|
37083
|
+
statusText,
|
|
37084
|
+
body: data
|
|
37085
|
+
},
|
|
37086
|
+
{
|
|
37087
|
+
route: "consume",
|
|
37088
|
+
site: "direct_chat.consume",
|
|
37089
|
+
sessionId: session_id,
|
|
37090
|
+
cleared: ["claim", "markers", "delivery-ledger"]
|
|
37091
|
+
}
|
|
37092
|
+
);
|
|
37093
|
+
if (verdict.outcome === "failed") {
|
|
36898
37094
|
return {
|
|
36899
|
-
content: [{ type: "text", text: `Consume failed: ${
|
|
37095
|
+
content: [{ type: "text", text: `Consume failed: ${verdict.error}` }],
|
|
36900
37096
|
isError: true
|
|
36901
37097
|
};
|
|
36902
37098
|
}
|
|
@@ -36982,7 +37178,7 @@ function scheduleDirectChatBusyAck(sessionId, messageId, arrivedWhileBusy) {
|
|
|
36982
37178
|
let paneLogFreshAgeMs = null;
|
|
36983
37179
|
if (DIRECT_CHAT_CODE_NAME_AGENT_DIR) {
|
|
36984
37180
|
try {
|
|
36985
|
-
const paneMtimeMs = statSync4(
|
|
37181
|
+
const paneMtimeMs = statSync4(join14(DIRECT_CHAT_CODE_NAME_AGENT_DIR, "pane.log")).mtimeMs;
|
|
36986
37182
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
36987
37183
|
} catch {
|
|
36988
37184
|
}
|
|
@@ -37095,8 +37291,23 @@ function armUsageLimitWatch(args) {
|
|
|
37095
37291
|
noticeText: buildUsageLimitReplyText(refusal.resetsAt)
|
|
37096
37292
|
});
|
|
37097
37293
|
const res = await apiPost(route, body);
|
|
37098
|
-
const data = await res
|
|
37099
|
-
|
|
37294
|
+
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
37295
|
+
const verdict = judgeCursorAdvance(
|
|
37296
|
+
{
|
|
37297
|
+
messageIds: [args.messageId],
|
|
37298
|
+
httpOk,
|
|
37299
|
+
httpStatus: res.status,
|
|
37300
|
+
statusText,
|
|
37301
|
+
body: data
|
|
37302
|
+
},
|
|
37303
|
+
{
|
|
37304
|
+
route: throttle.reply ? "reply" : "consume",
|
|
37305
|
+
site: "usage-limit-reactive",
|
|
37306
|
+
sessionId: args.sessionId,
|
|
37307
|
+
cleared: ["claim", "markers"]
|
|
37308
|
+
}
|
|
37309
|
+
);
|
|
37310
|
+
if (verdict.outcome !== "failed") {
|
|
37100
37311
|
claimTracker.clear(args.sessionId, [args.messageId]);
|
|
37101
37312
|
clearDirectChatPendingMarkersForSession(DIRECT_CHAT_PENDING_INBOUND_DIR, args.sessionId);
|
|
37102
37313
|
process.stderr.write(
|
|
@@ -37106,7 +37317,7 @@ function armUsageLimitWatch(args) {
|
|
|
37106
37317
|
} else {
|
|
37107
37318
|
if (throttle.reply) DIRECT_CHAT_USAGE_LIMIT_CACHE.delete(throttleKey);
|
|
37108
37319
|
process.stderr.write(
|
|
37109
|
-
`direct-chat-channel: [usage-limit-reactive] ${throttle.reply ? "notice" : "consume"} failed for session=${args.sessionId}: ${
|
|
37320
|
+
`direct-chat-channel: [usage-limit-reactive] ${throttle.reply ? "notice" : "consume"} failed for session=${args.sessionId}: ${verdict.error}
|
|
37110
37321
|
`
|
|
37111
37322
|
);
|
|
37112
37323
|
}
|
|
@@ -37164,13 +37375,28 @@ async function pollForMessages(sinceMs) {
|
|
|
37164
37375
|
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
37376
|
try {
|
|
37166
37377
|
const res2 = await apiPost(route, body);
|
|
37167
|
-
const data2 = await res2
|
|
37168
|
-
|
|
37378
|
+
const { body: data2, httpOk, statusText } = await readCursorAdvanceBody(res2);
|
|
37379
|
+
const verdict = judgeCursorAdvance(
|
|
37380
|
+
{
|
|
37381
|
+
messageIds: [msg.id],
|
|
37382
|
+
httpOk,
|
|
37383
|
+
httpStatus: res2.status,
|
|
37384
|
+
statusText,
|
|
37385
|
+
body: data2
|
|
37386
|
+
},
|
|
37387
|
+
{
|
|
37388
|
+
route: throttle.reply ? "reply" : "consume",
|
|
37389
|
+
site: "maintenance-offline",
|
|
37390
|
+
sessionId: msg.session_id,
|
|
37391
|
+
cleared: ["processed-marker"]
|
|
37392
|
+
}
|
|
37393
|
+
);
|
|
37394
|
+
if (verdict.outcome !== "failed") {
|
|
37169
37395
|
markProcessed(msg.id);
|
|
37170
37396
|
} else {
|
|
37171
37397
|
if (throttle.reply) DIRECT_CHAT_MAINTENANCE_CACHE.delete(throttleKey);
|
|
37172
37398
|
process.stderr.write(
|
|
37173
|
-
`direct-chat-channel: maintenance ${throttle.reply ? "reply" : "consume"} failed: ${
|
|
37399
|
+
`direct-chat-channel: maintenance ${throttle.reply ? "reply" : "consume"} failed: ${verdict.error}
|
|
37174
37400
|
`
|
|
37175
37401
|
);
|
|
37176
37402
|
}
|
|
@@ -37195,13 +37421,28 @@ async function pollForMessages(sinceMs) {
|
|
|
37195
37421
|
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
37422
|
try {
|
|
37197
37423
|
const res2 = await apiPost(route, body);
|
|
37198
|
-
const data2 = await res2
|
|
37199
|
-
|
|
37424
|
+
const { body: data2, httpOk, statusText } = await readCursorAdvanceBody(res2);
|
|
37425
|
+
const verdict = judgeCursorAdvance(
|
|
37426
|
+
{
|
|
37427
|
+
messageIds: [msg.id],
|
|
37428
|
+
httpOk,
|
|
37429
|
+
httpStatus: res2.status,
|
|
37430
|
+
statusText,
|
|
37431
|
+
body: data2
|
|
37432
|
+
},
|
|
37433
|
+
{
|
|
37434
|
+
route: throttle.reply ? "reply" : "consume",
|
|
37435
|
+
site: "account-mute",
|
|
37436
|
+
sessionId: msg.session_id,
|
|
37437
|
+
cleared: ["processed-marker"]
|
|
37438
|
+
}
|
|
37439
|
+
);
|
|
37440
|
+
if (verdict.outcome !== "failed") {
|
|
37200
37441
|
markProcessed(msg.id);
|
|
37201
37442
|
} else {
|
|
37202
37443
|
if (throttle.reply) DIRECT_CHAT_ACCOUNT_MUTE_CACHE.delete(throttleKey);
|
|
37203
37444
|
process.stderr.write(
|
|
37204
|
-
`direct-chat-channel: account-mute ${throttle.reply ? "reply" : "consume"} failed: ${
|
|
37445
|
+
`direct-chat-channel: account-mute ${throttle.reply ? "reply" : "consume"} failed: ${verdict.error}
|
|
37205
37446
|
`
|
|
37206
37447
|
);
|
|
37207
37448
|
}
|
|
@@ -37271,7 +37512,23 @@ async function pollForMessages(sinceMs) {
|
|
|
37271
37512
|
session_id: msg.session_id,
|
|
37272
37513
|
message_ids: [msg.id]
|
|
37273
37514
|
});
|
|
37274
|
-
|
|
37515
|
+
const { body: data2, httpOk, statusText } = await readCursorAdvanceBody(res2);
|
|
37516
|
+
const verdict = judgeCursorAdvance(
|
|
37517
|
+
{
|
|
37518
|
+
messageIds: [msg.id],
|
|
37519
|
+
httpOk,
|
|
37520
|
+
httpStatus: res2.status,
|
|
37521
|
+
statusText,
|
|
37522
|
+
body: data2
|
|
37523
|
+
},
|
|
37524
|
+
{
|
|
37525
|
+
route: "consume",
|
|
37526
|
+
site: "notice-push-consume",
|
|
37527
|
+
sessionId: msg.session_id,
|
|
37528
|
+
cleared: ["processed-marker"]
|
|
37529
|
+
}
|
|
37530
|
+
);
|
|
37531
|
+
if (verdict.outcome === "failed") throw new Error(verdict.error);
|
|
37275
37532
|
markProcessed(msg.id);
|
|
37276
37533
|
} catch (err) {
|
|
37277
37534
|
process.stderr.write(
|
|
@@ -37411,7 +37668,7 @@ function sweepAgedDirectChatMarkersNow(thresholdMs) {
|
|
|
37411
37668
|
const now = Date.now();
|
|
37412
37669
|
const res = sweepAgedDirectChatMarkers(DIRECT_CHAT_PENDING_INBOUND_DIR, {
|
|
37413
37670
|
readdir: (dir) => readdirSync6(dir),
|
|
37414
|
-
readFile: (p2) =>
|
|
37671
|
+
readFile: (p2) => readFileSync11(p2, "utf8"),
|
|
37415
37672
|
unlink: (p2) => {
|
|
37416
37673
|
if (existsSync6(p2)) unlinkSync4(p2);
|
|
37417
37674
|
},
|
|
@@ -37447,7 +37704,7 @@ function sanitizeRecoveryText(text) {
|
|
|
37447
37704
|
}
|
|
37448
37705
|
function directChatRecoveryDeps() {
|
|
37449
37706
|
return {
|
|
37450
|
-
readFile: (p2) =>
|
|
37707
|
+
readFile: (p2) => readFileSync11(p2, "utf-8"),
|
|
37451
37708
|
renameFile: (from, to) => renameSync5(from, to),
|
|
37452
37709
|
unlinkFile: (p2) => {
|
|
37453
37710
|
if (existsSync6(p2)) unlinkSync4(p2);
|
|
@@ -37460,7 +37717,7 @@ function directChatRecoveryDeps() {
|
|
|
37460
37717
|
if (!DIRECT_CHAT_RECOVERY_LEDGER_DIR) return;
|
|
37461
37718
|
if (markerName.includes("/") || markerName.includes("\\") || markerName.includes("..")) return;
|
|
37462
37719
|
try {
|
|
37463
|
-
const p2 =
|
|
37720
|
+
const p2 = join14(DIRECT_CHAT_RECOVERY_LEDGER_DIR, markerName);
|
|
37464
37721
|
if (existsSync6(p2)) unlinkSync4(p2);
|
|
37465
37722
|
} catch {
|
|
37466
37723
|
}
|
|
@@ -37473,8 +37730,23 @@ function directChatRecoveryDeps() {
|
|
|
37473
37730
|
content,
|
|
37474
37731
|
message_ids: messageIds
|
|
37475
37732
|
});
|
|
37476
|
-
const data = await res
|
|
37477
|
-
|
|
37733
|
+
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
37734
|
+
const verdict = judgeCursorAdvance(
|
|
37735
|
+
{
|
|
37736
|
+
messageIds,
|
|
37737
|
+
httpOk,
|
|
37738
|
+
httpStatus: res.status,
|
|
37739
|
+
statusText,
|
|
37740
|
+
body: data
|
|
37741
|
+
},
|
|
37742
|
+
{
|
|
37743
|
+
route: "reply",
|
|
37744
|
+
site: "recovery-outbox",
|
|
37745
|
+
sessionId,
|
|
37746
|
+
cleared: ["claim", "markers", "outbox-payload", "recovery-ledger"]
|
|
37747
|
+
}
|
|
37748
|
+
);
|
|
37749
|
+
if (verdict.outcome === "failed") return { ok: false, error: verdict.error };
|
|
37478
37750
|
return { ok: true };
|
|
37479
37751
|
} catch (err) {
|
|
37480
37752
|
return { ok: false, error: err.message };
|
|
@@ -37496,7 +37768,7 @@ async function processDirectChatRecoveryOutboxFile(filename) {
|
|
|
37496
37768
|
if (!enabled) return;
|
|
37497
37769
|
directChatRecoveryInFlight.add(filename);
|
|
37498
37770
|
try {
|
|
37499
|
-
const fullPath =
|
|
37771
|
+
const fullPath = join14(DIRECT_CHAT_RECOVERY_OUTBOX_DIR, filename);
|
|
37500
37772
|
await consumeDirectChatRecoveryFile(fullPath, filename, directChatRecoveryDeps());
|
|
37501
37773
|
} catch (err) {
|
|
37502
37774
|
process.stderr.write(
|
|
@@ -37524,7 +37796,7 @@ if (DIRECT_CHAT_RECOVERY_OUTBOX_DIR) {
|
|
|
37524
37796
|
if (!filename) return;
|
|
37525
37797
|
const name = filename.toString();
|
|
37526
37798
|
if (!name.endsWith(".json")) return;
|
|
37527
|
-
if (existsSync6(
|
|
37799
|
+
if (existsSync6(join14(DIRECT_CHAT_RECOVERY_OUTBOX_DIR, name))) {
|
|
37528
37800
|
void processDirectChatRecoveryOutboxFile(name);
|
|
37529
37801
|
}
|
|
37530
37802
|
});
|
package/dist/mcp/origami.js
CHANGED
|
@@ -38700,6 +38700,23 @@ var ASSET_TYPES = {
|
|
|
38700
38700
|
var DEFAULT_CHUNK_BUDGET_BYTES = 180 * 1024;
|
|
38701
38701
|
var textEncoder = new TextEncoder();
|
|
38702
38702
|
|
|
38703
|
+
// ../core/dist/integrations/remote-mcp-proxy-env.js
|
|
38704
|
+
var REMOTE_MCP_PROXY_ENV = {
|
|
38705
|
+
url: "AGT_REMOTE_MCP_URL",
|
|
38706
|
+
tokenFile: "AGT_REMOTE_MCP_TOKEN_FILE",
|
|
38707
|
+
tokenVar: "AGT_REMOTE_MCP_TOKEN_VAR",
|
|
38708
|
+
label: "AGT_REMOTE_MCP_LABEL",
|
|
38709
|
+
authHeader: "AGT_REMOTE_MCP_AUTH_HEADER",
|
|
38710
|
+
extraHeaders: "AGT_REMOTE_MCP_EXTRA_HEADERS",
|
|
38711
|
+
toolAllowlist: "AGT_REMOTE_MCP_TOOL_ALLOWLIST",
|
|
38712
|
+
preEnableToolsets: "AGT_REMOTE_MCP_PREENABLE_TOOLSETS"
|
|
38713
|
+
};
|
|
38714
|
+
var REMOTE_MCP_AUTH_ENV_KEYS = [
|
|
38715
|
+
REMOTE_MCP_PROXY_ENV.tokenVar,
|
|
38716
|
+
REMOTE_MCP_PROXY_ENV.authHeader,
|
|
38717
|
+
REMOTE_MCP_PROXY_ENV.extraHeaders
|
|
38718
|
+
];
|
|
38719
|
+
|
|
38703
38720
|
// ../core/dist/integrations/registry.js
|
|
38704
38721
|
var INTEGRATION_REGISTRY = [
|
|
38705
38722
|
{
|
|
@@ -39845,6 +39862,20 @@ var DIRECT_CHAT_UPLOAD_MAX_BYTES = 10 * MB2;
|
|
|
39845
39862
|
var AGENT_DIRECTED_NOTICE_KINDS = ["scheduled_task_nudge", "kanban_check"];
|
|
39846
39863
|
var AGENT_DIRECTED_KIND_SET = new Set(AGENT_DIRECTED_NOTICE_KINDS);
|
|
39847
39864
|
|
|
39865
|
+
// ../core/dist/direct-chat/cursor-advance.js
|
|
39866
|
+
var CURSOR_SHORTFALL_REASONS = [
|
|
39867
|
+
"not_found",
|
|
39868
|
+
"gave_up",
|
|
39869
|
+
"already_delivered",
|
|
39870
|
+
"error",
|
|
39871
|
+
"undiagnosed",
|
|
39872
|
+
"unknown",
|
|
39873
|
+
"unreported",
|
|
39874
|
+
"malformed_count",
|
|
39875
|
+
"other"
|
|
39876
|
+
];
|
|
39877
|
+
var KNOWN_REASONS = new Set(CURSOR_SHORTFALL_REASONS);
|
|
39878
|
+
|
|
39848
39879
|
// ../core/dist/onboarding/state-machine.js
|
|
39849
39880
|
var AREA_ORDER = [
|
|
39850
39881
|
"framing",
|