@integrity-labs/agt-cli 0.28.1088 → 0.28.1090
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 +5 -5
- package/dist/{chunk-JAXSZCTH.js → chunk-3YZWZJZR.js} +4 -4
- package/dist/{chunk-YOIJFB4J.js → chunk-DAZBANX7.js} +4 -2
- package/dist/{chunk-YOIJFB4J.js.map → chunk-DAZBANX7.js.map} +1 -1
- package/dist/{chunk-HN6B5G5V.js → chunk-YBOORROA.js} +2 -2
- package/dist/{claude-pair-runtime-XZXUHC4Q.js → claude-pair-runtime-U3QGHO36.js} +2 -2
- package/dist/lib/manager-worker.js +16 -16
- package/dist/mcp/direct-chat-channel.js +176 -133
- package/dist/mcp/index.js +175 -41
- package/dist/mcp/origami.js +3 -1
- package/dist/mcp/slack-channel.js +347 -262
- package/dist/mcp/teams-channel.js +210 -86
- package/dist/mcp/telegram-channel.js +290 -207
- package/dist/mcp/whatsapp-channel.js +194 -69
- package/dist/{persistent-session-QVJASJSQ.js → persistent-session-V3AMSH7S.js} +3 -3
- package/dist/{responsiveness-probe-AZSZBDKL.js → responsiveness-probe-MZBID4WC.js} +3 -3
- package/dist/{session-auth-dead-VY7AZM77.js → session-auth-dead-OCGA6YZW.js} +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-JAXSZCTH.js.map → chunk-3YZWZJZR.js.map} +0 -0
- /package/dist/{chunk-HN6B5G5V.js.map → chunk-YBOORROA.js.map} +0 -0
- /package/dist/{claude-pair-runtime-XZXUHC4Q.js.map → claude-pair-runtime-U3QGHO36.js.map} +0 -0
- /package/dist/{persistent-session-QVJASJSQ.js.map → persistent-session-V3AMSH7S.js.map} +0 -0
- /package/dist/{responsiveness-probe-AZSZBDKL.js.map → responsiveness-probe-MZBID4WC.js.map} +0 -0
- /package/dist/{session-auth-dead-VY7AZM77.js.map → session-auth-dead-OCGA6YZW.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 join18(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 = join18;
|
|
18880
18880
|
function last(arr) {
|
|
18881
18881
|
return arr[arr.length - 1];
|
|
18882
18882
|
}
|
|
@@ -20042,9 +20042,9 @@ var require_handler = __commonJS({
|
|
|
20042
20042
|
if (this.fsw.closed) {
|
|
20043
20043
|
return;
|
|
20044
20044
|
}
|
|
20045
|
-
const
|
|
20045
|
+
const dirname4 = sysPath.dirname(file);
|
|
20046
20046
|
const basename = sysPath.basename(file);
|
|
20047
|
-
const parent = this.fsw._getWatchedDir(
|
|
20047
|
+
const parent = this.fsw._getWatchedDir(dirname4);
|
|
20048
20048
|
let prevStats = stats;
|
|
20049
20049
|
if (parent.has(basename))
|
|
20050
20050
|
return;
|
|
@@ -20071,7 +20071,7 @@ var require_handler = __commonJS({
|
|
|
20071
20071
|
prevStats = newStats2;
|
|
20072
20072
|
}
|
|
20073
20073
|
} catch (error2) {
|
|
20074
|
-
this.fsw._remove(
|
|
20074
|
+
this.fsw._remove(dirname4, basename);
|
|
20075
20075
|
}
|
|
20076
20076
|
} else if (parent.has(basename)) {
|
|
20077
20077
|
const at = newStats.atimeMs;
|
|
@@ -32672,7 +32672,7 @@ var MARKUP_BRIDGE_SCRIPT = `<script>(function(){
|
|
|
32672
32672
|
})();</script>`;
|
|
32673
32673
|
|
|
32674
32674
|
// ../core/dist/integrations/augmented-live/publisher.js
|
|
32675
|
-
var PRESENTER_CHROME_SELECTORS = "#al-download, .al-launcher, .al-stats-btn, .al-edit-btn";
|
|
32675
|
+
var PRESENTER_CHROME_SELECTORS = "#al-download, #al-vis, .al-launcher, .al-stats-btn, .al-edit-btn";
|
|
32676
32676
|
var presenterChromeCss = `
|
|
32677
32677
|
/* ENG-9516: presenter mode. */
|
|
32678
32678
|
${PRESENTER_CHROME_SELECTORS}{transition:opacity .25s ease,visibility .25s ease}
|
|
@@ -32703,6 +32703,8 @@ var DECK_ATTRIBUTION_BOTTOM_PX = DECK_HUD_TOP_PX + DECK_CHROME_GAP_PX;
|
|
|
32703
32703
|
var DOWNLOAD_BOTTOM_PX = 72;
|
|
32704
32704
|
var DOWNLOAD_MOBILE_MIN_HEIGHT_PX = 44;
|
|
32705
32705
|
var DECK_ATTRIBUTION_NARROW_BOTTOM_PX = DOWNLOAD_BOTTOM_PX + DOWNLOAD_MOBILE_MIN_HEIGHT_PX + DECK_CHROME_GAP_PX;
|
|
32706
|
+
var VISIBILITY_BOTTOM_PX = DOWNLOAD_BOTTOM_PX + DOWNLOAD_MOBILE_MIN_HEIGHT_PX + DECK_CHROME_GAP_PX;
|
|
32707
|
+
var DECK_ATTRIBUTION_NARROW_WITH_VISIBILITY_BOTTOM_PX = VISIBILITY_BOTTOM_PX + DOWNLOAD_MOBILE_MIN_HEIGHT_PX + DECK_CHROME_GAP_PX;
|
|
32706
32708
|
|
|
32707
32709
|
// ../core/dist/integrations/augmented-live/asset.js
|
|
32708
32710
|
var MB = 1024 * 1024;
|
|
@@ -39375,6 +39377,9 @@ function foldTurnInitiatorLedger(existing, marker, maxAgeMs = TURN_INITIATOR_MAX
|
|
|
39375
39377
|
sender_id: marker.sender_id,
|
|
39376
39378
|
...marker.sender_name ? { sender_name: marker.sender_name } : {},
|
|
39377
39379
|
...marker.channel_ref ? { channel_ref: marker.channel_ref } : {},
|
|
39380
|
+
...marker.chat_kind ? { chat_kind: marker.chat_kind } : {},
|
|
39381
|
+
...marker.chat_id ? { chat_id: marker.chat_id } : {},
|
|
39382
|
+
...marker.unattributed ? { unattributed: true } : {},
|
|
39378
39383
|
ts: marker.ts
|
|
39379
39384
|
});
|
|
39380
39385
|
kept.sort((a, b) => b.ts - a.ts);
|
|
@@ -39389,7 +39394,7 @@ function updateTurnInitiatorLedger(singleSlotFile, marker) {
|
|
|
39389
39394
|
} catch {
|
|
39390
39395
|
}
|
|
39391
39396
|
const next = foldTurnInitiatorLedger(existing, marker);
|
|
39392
|
-
const tmp = `${ledgerFile}.tmp`;
|
|
39397
|
+
const tmp = `${ledgerFile}.${process.pid}.${Date.now()}.tmp`;
|
|
39393
39398
|
writeFileSync2(tmp, JSON.stringify(next), "utf8");
|
|
39394
39399
|
renameSync2(tmp, ledgerFile);
|
|
39395
39400
|
}
|
|
@@ -39410,30 +39415,103 @@ function writeTurnInitiatorMarker(input) {
|
|
|
39410
39415
|
}
|
|
39411
39416
|
}
|
|
39412
39417
|
|
|
39418
|
+
// src/turn-context.ts
|
|
39419
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "fs";
|
|
39420
|
+
import { homedir } from "os";
|
|
39421
|
+
import { dirname as dirname3, join as join6 } from "path";
|
|
39422
|
+
|
|
39423
|
+
// ../core/dist/provisioning/frameworks/claudecode/agent-dir-alias.js
|
|
39424
|
+
import { isAbsolute, join as join4, relative, sep } from "path";
|
|
39425
|
+
var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
39426
|
+
var VALID_AGENT_ID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
39427
|
+
var INITIATOR_BASENAME = ".current-turn-initiator.json";
|
|
39428
|
+
function isSafeAgentSegment(segment) {
|
|
39429
|
+
return VALID_CODE_NAME.test(segment) || VALID_AGENT_ID.test(segment);
|
|
39430
|
+
}
|
|
39431
|
+
function initiatorDirSegment(initiatorFile, homeDir) {
|
|
39432
|
+
const rel = relative(join4(homeDir, ".augmented"), initiatorFile);
|
|
39433
|
+
if (!rel || isAbsolute(rel))
|
|
39434
|
+
return null;
|
|
39435
|
+
const parts = rel.split(sep);
|
|
39436
|
+
if (parts.length !== 2 || parts[1] !== INITIATOR_BASENAME)
|
|
39437
|
+
return null;
|
|
39438
|
+
const segment = parts[0];
|
|
39439
|
+
if (segment === void 0)
|
|
39440
|
+
return null;
|
|
39441
|
+
return isSafeAgentSegment(segment) ? segment : null;
|
|
39442
|
+
}
|
|
39443
|
+
function resolveAgentDirAlias(input) {
|
|
39444
|
+
const { codeName, turnInitiatorFile, agentId, homeDir } = input;
|
|
39445
|
+
const codeNameTrimmed = typeof codeName === "string" ? codeName.trim() : "";
|
|
39446
|
+
if (codeNameTrimmed && VALID_CODE_NAME.test(codeNameTrimmed)) {
|
|
39447
|
+
return join4(homeDir, ".augmented", codeNameTrimmed);
|
|
39448
|
+
}
|
|
39449
|
+
const initiator = typeof turnInitiatorFile === "string" ? turnInitiatorFile.trim() : "";
|
|
39450
|
+
if (initiator) {
|
|
39451
|
+
const segment = initiatorDirSegment(initiator, homeDir);
|
|
39452
|
+
if (segment)
|
|
39453
|
+
return join4(homeDir, ".augmented", segment);
|
|
39454
|
+
}
|
|
39455
|
+
const agentIdTrimmed = typeof agentId === "string" ? agentId.trim() : "";
|
|
39456
|
+
if (agentIdTrimmed && VALID_AGENT_ID.test(agentIdTrimmed)) {
|
|
39457
|
+
return join4(homeDir, ".augmented", agentIdTrimmed);
|
|
39458
|
+
}
|
|
39459
|
+
return null;
|
|
39460
|
+
}
|
|
39461
|
+
|
|
39413
39462
|
// src/scheduled-turn-marker.ts
|
|
39414
39463
|
import { readFileSync as readFileSync4, unlinkSync } from "fs";
|
|
39415
|
-
import { join as
|
|
39464
|
+
import { join as join5 } from "path";
|
|
39416
39465
|
var SCHEDULED_TURN_MARKER_FILENAME2 = ".current-scheduled-turn.json";
|
|
39417
39466
|
var SCHEDULED_TURN_MAX_AGE_MS = 15 * 60 * 1e3;
|
|
39418
39467
|
function clearScheduledTurnMarker(agentDir) {
|
|
39419
39468
|
if (!agentDir) return;
|
|
39420
39469
|
try {
|
|
39421
|
-
unlinkSync(
|
|
39470
|
+
unlinkSync(join5(agentDir, SCHEDULED_TURN_MARKER_FILENAME2));
|
|
39422
39471
|
} catch {
|
|
39423
39472
|
}
|
|
39424
39473
|
}
|
|
39425
39474
|
|
|
39475
|
+
// src/turn-context.ts
|
|
39476
|
+
var TURN_INITIATOR_MARKER_FILENAME = ".current-turn-initiator.json";
|
|
39477
|
+
function writeUnattributedTurnMarker(channel, opts = {}) {
|
|
39478
|
+
try {
|
|
39479
|
+
const file = resolveTurnInitiatorFile(opts.env ?? process.env, opts.home ?? homedir());
|
|
39480
|
+
if (!file) return;
|
|
39481
|
+
mkdirSync3(dirname3(file), { recursive: true });
|
|
39482
|
+
updateTurnInitiatorLedger(file, {
|
|
39483
|
+
channel,
|
|
39484
|
+
sender_id: "",
|
|
39485
|
+
channel_ref: "unattributed",
|
|
39486
|
+
unattributed: true,
|
|
39487
|
+
ts: opts.now ?? Date.now()
|
|
39488
|
+
});
|
|
39489
|
+
} catch {
|
|
39490
|
+
}
|
|
39491
|
+
}
|
|
39492
|
+
function resolveTurnInitiatorFile(env2 = process.env, home = homedir()) {
|
|
39493
|
+
const injected = env2["AGT_TURN_INITIATOR_FILE"]?.trim();
|
|
39494
|
+
if (injected) return injected;
|
|
39495
|
+
const dir = resolveAgentDirAlias({
|
|
39496
|
+
codeName: env2["AGT_AGENT_CODE_NAME"],
|
|
39497
|
+
agentId: env2["AGT_AGENT_ID"],
|
|
39498
|
+
turnInitiatorFile: null,
|
|
39499
|
+
homeDir: home
|
|
39500
|
+
});
|
|
39501
|
+
return dir ? join6(dir, TURN_INITIATOR_MARKER_FILENAME) : null;
|
|
39502
|
+
}
|
|
39503
|
+
|
|
39426
39504
|
// src/direct-chat-pending-inbound.ts
|
|
39427
39505
|
import {
|
|
39428
39506
|
existsSync as existsSync2,
|
|
39429
|
-
mkdirSync as
|
|
39507
|
+
mkdirSync as mkdirSync4,
|
|
39430
39508
|
readdirSync,
|
|
39431
|
-
readFileSync as
|
|
39509
|
+
readFileSync as readFileSync6,
|
|
39432
39510
|
renameSync as renameSync3,
|
|
39433
39511
|
unlinkSync as unlinkSync2,
|
|
39434
39512
|
writeFileSync as writeFileSync3
|
|
39435
39513
|
} from "fs";
|
|
39436
|
-
import { join as
|
|
39514
|
+
import { join as join7 } from "path";
|
|
39437
39515
|
function hexEncodeSegment(value) {
|
|
39438
39516
|
return Buffer.from(value, "utf8").toString("hex");
|
|
39439
39517
|
}
|
|
@@ -39452,7 +39530,7 @@ function directChatInboundId(sessionId, messageId) {
|
|
|
39452
39530
|
function writeDirectChatPendingInboundMarker(dir, sessionId, messageId) {
|
|
39453
39531
|
if (!dir || !sessionId || !messageId) return;
|
|
39454
39532
|
try {
|
|
39455
|
-
|
|
39533
|
+
mkdirSync4(dir, { recursive: true });
|
|
39456
39534
|
const marker = {
|
|
39457
39535
|
channel: "direct-chat",
|
|
39458
39536
|
session_id: sessionId,
|
|
@@ -39460,7 +39538,7 @@ function writeDirectChatPendingInboundMarker(dir, sessionId, messageId) {
|
|
|
39460
39538
|
received_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
39461
39539
|
inbound_id: directChatInboundId(sessionId, messageId)
|
|
39462
39540
|
};
|
|
39463
|
-
const final =
|
|
39541
|
+
const final = join7(dir, directChatMarkerName(sessionId, messageId));
|
|
39464
39542
|
const tmp = `${final}.tmp`;
|
|
39465
39543
|
writeFileSync3(tmp, JSON.stringify(marker), "utf8");
|
|
39466
39544
|
renameSync3(tmp, final);
|
|
@@ -39479,15 +39557,15 @@ function clearDirectChatPendingMarkersForSession(dir, sessionId, op = defaultCle
|
|
|
39479
39557
|
}
|
|
39480
39558
|
for (const name of names) {
|
|
39481
39559
|
if (!name.startsWith(prefix) || !name.endsWith(".json")) continue;
|
|
39482
|
-
op(
|
|
39560
|
+
op(join7(dir, name));
|
|
39483
39561
|
cleared += 1;
|
|
39484
39562
|
}
|
|
39485
39563
|
return cleared;
|
|
39486
39564
|
}
|
|
39487
|
-
function readDirectChatPendingInboundMarker(dir, sessionId, messageId, readFileImpl = (path) =>
|
|
39565
|
+
function readDirectChatPendingInboundMarker(dir, sessionId, messageId, readFileImpl = (path) => readFileSync6(path, "utf8")) {
|
|
39488
39566
|
if (!dir || !sessionId || !messageId) return null;
|
|
39489
39567
|
try {
|
|
39490
|
-
const raw = readFileImpl(
|
|
39568
|
+
const raw = readFileImpl(join7(dir, directChatMarkerName(sessionId, messageId)));
|
|
39491
39569
|
return JSON.parse(raw);
|
|
39492
39570
|
} catch {
|
|
39493
39571
|
return null;
|
|
@@ -39510,7 +39588,7 @@ function sweepAgedDirectChatMarkers(dir, deps) {
|
|
|
39510
39588
|
}
|
|
39511
39589
|
for (const name of names) {
|
|
39512
39590
|
if (!name.endsWith(".json") || name.startsWith(".")) continue;
|
|
39513
|
-
const full =
|
|
39591
|
+
const full = join7(dir, name);
|
|
39514
39592
|
let marker;
|
|
39515
39593
|
try {
|
|
39516
39594
|
marker = JSON.parse(deps.readFile(full));
|
|
@@ -39609,17 +39687,17 @@ async function consumeDirectChatRecoveryFile(fullPath, filename, deps) {
|
|
|
39609
39687
|
}
|
|
39610
39688
|
|
|
39611
39689
|
// src/inbound-delivery-ledger.ts
|
|
39612
|
-
import { existsSync as existsSync3, mkdirSync as
|
|
39613
|
-
import { join as
|
|
39690
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync5, readdirSync as readdirSync2, readFileSync as readFileSync7, renameSync as renameSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
39691
|
+
import { join as join8 } from "path";
|
|
39614
39692
|
function safeInboundId(inboundId) {
|
|
39615
39693
|
return inboundId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
39616
39694
|
}
|
|
39617
39695
|
var defaultDeps = {
|
|
39618
|
-
mkdir: (dir) =>
|
|
39696
|
+
mkdir: (dir) => mkdirSync5(dir, { recursive: true }),
|
|
39619
39697
|
writeFile: (path, data) => writeFileSync4(path, data, "utf8"),
|
|
39620
39698
|
rename: (from, to) => renameSync4(from, to),
|
|
39621
39699
|
readdir: (dir) => readdirSync2(dir),
|
|
39622
|
-
readFile: (path) =>
|
|
39700
|
+
readFile: (path) => readFileSync7(path, "utf8"),
|
|
39623
39701
|
exists: (path) => existsSync3(path)
|
|
39624
39702
|
};
|
|
39625
39703
|
function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
|
|
@@ -39628,7 +39706,7 @@ function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
|
|
|
39628
39706
|
if (!safe || safe.includes("/") || safe.includes("\\") || safe.includes("..")) return;
|
|
39629
39707
|
try {
|
|
39630
39708
|
deps.mkdir(dir);
|
|
39631
|
-
const final =
|
|
39709
|
+
const final = join8(dir, `${safe}.json`);
|
|
39632
39710
|
const tmp = `${final}.tmp`;
|
|
39633
39711
|
deps.writeFile(tmp, JSON.stringify(record2));
|
|
39634
39712
|
deps.rename(tmp, final);
|
|
@@ -39640,22 +39718,22 @@ function inboundDeliveryLedgerHas(dir, inboundId, deps = defaultDeps) {
|
|
|
39640
39718
|
const safe = safeInboundId(inboundId);
|
|
39641
39719
|
if (!safe || safe.includes("/") || safe.includes("\\") || safe.includes("..")) return false;
|
|
39642
39720
|
try {
|
|
39643
|
-
return deps.exists(
|
|
39721
|
+
return deps.exists(join8(dir, `${safe}.json`));
|
|
39644
39722
|
} catch {
|
|
39645
39723
|
return false;
|
|
39646
39724
|
}
|
|
39647
39725
|
}
|
|
39648
39726
|
|
|
39649
39727
|
// src/ack-reaction.ts
|
|
39650
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
39651
|
-
import { join as
|
|
39728
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
|
|
39729
|
+
import { join as join10 } from "path";
|
|
39652
39730
|
|
|
39653
39731
|
// src/flags-cache-read.ts
|
|
39654
|
-
import { existsSync as existsSync4, readFileSync as
|
|
39655
|
-
import { homedir } from "os";
|
|
39656
|
-
import { join as
|
|
39732
|
+
import { existsSync as existsSync4, readFileSync as readFileSync8 } from "fs";
|
|
39733
|
+
import { homedir as homedir2 } from "os";
|
|
39734
|
+
import { join as join9 } from "path";
|
|
39657
39735
|
function defaultFlagsCachePath() {
|
|
39658
|
-
return
|
|
39736
|
+
return join9(homedir2(), ".augmented", "flags-cache.json");
|
|
39659
39737
|
}
|
|
39660
39738
|
function envBoolean(raw) {
|
|
39661
39739
|
if (raw === void 0) return void 0;
|
|
@@ -39668,7 +39746,7 @@ function envBoolean(raw) {
|
|
|
39668
39746
|
function cachedBoolean(key, path) {
|
|
39669
39747
|
try {
|
|
39670
39748
|
if (!existsSync4(path)) return void 0;
|
|
39671
|
-
const parsed = JSON.parse(
|
|
39749
|
+
const parsed = JSON.parse(readFileSync8(path, "utf8"));
|
|
39672
39750
|
if (!parsed || typeof parsed !== "object") return void 0;
|
|
39673
39751
|
const flags = parsed.flags;
|
|
39674
39752
|
if (!flags || typeof flags !== "object") return void 0;
|
|
@@ -39749,7 +39827,7 @@ function undeliverableNoticeTextForRepeat(i) {
|
|
|
39749
39827
|
}
|
|
39750
39828
|
return null;
|
|
39751
39829
|
}
|
|
39752
|
-
function channelInboundGateOpen(readFile = (p2) =>
|
|
39830
|
+
function channelInboundGateOpen(readFile = (p2) => readFileSync9(p2, "utf-8")) {
|
|
39753
39831
|
const path = process.platform === "darwin" ? "/Library/Application Support/ClaudeCode/managed-settings.json" : "/etc/claude-code/managed-settings.json";
|
|
39754
39832
|
let raw;
|
|
39755
39833
|
try {
|
|
@@ -39814,7 +39892,7 @@ var GIVE_UP_SIGNAL_MAX_AGE_MS = 30 * 60 * 1e3;
|
|
|
39814
39892
|
function readGiveUpSignal(path, now = Date.now()) {
|
|
39815
39893
|
if (!path) return null;
|
|
39816
39894
|
try {
|
|
39817
|
-
const raw = JSON.parse(
|
|
39895
|
+
const raw = JSON.parse(readFileSync9(path, "utf8"));
|
|
39818
39896
|
if (typeof raw.gave_up_at !== "string") return null;
|
|
39819
39897
|
const t = Date.parse(raw.gave_up_at);
|
|
39820
39898
|
if (!Number.isFinite(t) || t > now) return null;
|
|
@@ -39828,12 +39906,12 @@ function readGiveUpSignal(path, now = Date.now()) {
|
|
|
39828
39906
|
var USAGE_LIMIT_LIVE_WINDOW_MS = 3 * 6e4;
|
|
39829
39907
|
function readUsageLimitForBusyAck(agentDir, now = Date.now()) {
|
|
39830
39908
|
if (!agentDir) return null;
|
|
39831
|
-
const path =
|
|
39909
|
+
const path = join10(agentDir, GIVE_UP_SIGNAL_FILENAME);
|
|
39832
39910
|
const sig = readGiveUpSignal(path, now);
|
|
39833
39911
|
if (sig?.reason !== "usage_limit") return null;
|
|
39834
39912
|
let lastSeenMs = null;
|
|
39835
39913
|
try {
|
|
39836
|
-
const raw = JSON.parse(
|
|
39914
|
+
const raw = JSON.parse(readFileSync9(path, "utf8"));
|
|
39837
39915
|
if (typeof raw.usage_limit_last_seen_at === "string") {
|
|
39838
39916
|
const t = Date.parse(raw.usage_limit_last_seen_at);
|
|
39839
39917
|
if (Number.isFinite(t) && t <= now) lastSeenMs = t;
|
|
@@ -39852,7 +39930,7 @@ function readBlockedPromptForBusyAck(agentDir, now = Date.now()) {
|
|
|
39852
39930
|
if (!agentDir) return null;
|
|
39853
39931
|
let raw;
|
|
39854
39932
|
try {
|
|
39855
|
-
raw = JSON.parse(
|
|
39933
|
+
raw = JSON.parse(readFileSync9(join10(agentDir, BLOCKED_PROMPT_SIGNAL_FILENAME), "utf8"));
|
|
39856
39934
|
} catch {
|
|
39857
39935
|
return null;
|
|
39858
39936
|
}
|
|
@@ -39905,7 +39983,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
|
|
|
39905
39983
|
if (!name.endsWith(".json")) continue;
|
|
39906
39984
|
let receivedAt;
|
|
39907
39985
|
try {
|
|
39908
|
-
const raw = JSON.parse(
|
|
39986
|
+
const raw = JSON.parse(readFileSync9(join10(dir, name), "utf-8"));
|
|
39909
39987
|
if (raw.discretionary === true) continue;
|
|
39910
39988
|
if (!opts?.includeSeen && typeof raw.seen_at === "string" && raw.seen_at) continue;
|
|
39911
39989
|
receivedAt = raw.received_at;
|
|
@@ -39959,14 +40037,14 @@ function isMarkerGenuinelyAged(receivedAt, nowMs, thresholdMs) {
|
|
|
39959
40037
|
}
|
|
39960
40038
|
var DEFLECTION_COUNTER_SUFFIX = "-deflections.json";
|
|
39961
40039
|
function deflectionCounterPath(agentDir, channel) {
|
|
39962
|
-
return
|
|
40040
|
+
return join10(agentDir, `${channel}${DEFLECTION_COUNTER_SUFFIX}`);
|
|
39963
40041
|
}
|
|
39964
40042
|
function recordChannelDeflection(agentDir, channel, cause) {
|
|
39965
40043
|
if (!agentDir) return;
|
|
39966
40044
|
const path = deflectionCounterPath(agentDir, channel);
|
|
39967
40045
|
let counts = {};
|
|
39968
40046
|
try {
|
|
39969
|
-
const parsed = JSON.parse(
|
|
40047
|
+
const parsed = JSON.parse(readFileSync9(path, "utf-8"));
|
|
39970
40048
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
39971
40049
|
} catch {
|
|
39972
40050
|
}
|
|
@@ -39979,12 +40057,12 @@ function recordChannelDeflection(agentDir, channel, cause) {
|
|
|
39979
40057
|
|
|
39980
40058
|
// src/turn-failure-watch.ts
|
|
39981
40059
|
import { readdirSync as readdirSync5, statSync as statSync2 } from "fs";
|
|
39982
|
-
import { join as
|
|
40060
|
+
import { join as join12 } from "path";
|
|
39983
40061
|
|
|
39984
40062
|
// src/rate-limit-watch.ts
|
|
39985
40063
|
import { closeSync, fstatSync, openSync, readSync, readdirSync as readdirSync4, statSync } from "fs";
|
|
39986
|
-
import { homedir as
|
|
39987
|
-
import { join as
|
|
40064
|
+
import { homedir as homedir3 } from "os";
|
|
40065
|
+
import { join as join11 } from "path";
|
|
39988
40066
|
var DEFAULT_WATCH_MS = 5e3;
|
|
39989
40067
|
var DEFAULT_POLL_MS = 400;
|
|
39990
40068
|
var INITIAL_TAIL_BYTES = 256 * 1024;
|
|
@@ -40055,8 +40133,8 @@ function oldestTimestampMs(text) {
|
|
|
40055
40133
|
}
|
|
40056
40134
|
function agentTranscriptDir(opts) {
|
|
40057
40135
|
const cwd = opts?.cwd ?? process.cwd();
|
|
40058
|
-
const home = opts?.home ??
|
|
40059
|
-
return
|
|
40136
|
+
const home = opts?.home ?? homedir3();
|
|
40137
|
+
return join11(home, ".claude", "projects", encodeClaudeProjectPath(cwd));
|
|
40060
40138
|
}
|
|
40061
40139
|
function classifyTranscriptSince(opts) {
|
|
40062
40140
|
const dir = opts.transcriptDir ?? agentTranscriptDir({ cwd: opts.cwd, home: opts.home });
|
|
@@ -40069,7 +40147,7 @@ function classifyTranscriptSince(opts) {
|
|
|
40069
40147
|
let newest = UNKNOWN_RATE_LIMIT;
|
|
40070
40148
|
for (const name of entries) {
|
|
40071
40149
|
if (!name.endsWith(".jsonl")) continue;
|
|
40072
|
-
const path =
|
|
40150
|
+
const path = join11(dir, name);
|
|
40073
40151
|
try {
|
|
40074
40152
|
const st = statSync(path);
|
|
40075
40153
|
if (!st.isFile() || st.mtimeMs < opts.sinceMs) continue;
|
|
@@ -40144,7 +40222,7 @@ function classifyTurnFailureSince(opts) {
|
|
|
40144
40222
|
const unrecognised = /* @__PURE__ */ new Set();
|
|
40145
40223
|
for (const name of entries) {
|
|
40146
40224
|
if (!name.endsWith(".jsonl")) continue;
|
|
40147
|
-
const path =
|
|
40225
|
+
const path = join12(dir, name);
|
|
40148
40226
|
let fingerprint;
|
|
40149
40227
|
try {
|
|
40150
40228
|
const st = statSync2(path);
|
|
@@ -40331,15 +40409,15 @@ async function fetchWithTimeout(input, init, timeoutMs, fetchImpl = fetch) {
|
|
|
40331
40409
|
// src/mcp-spawn-lock.ts
|
|
40332
40410
|
import {
|
|
40333
40411
|
existsSync as existsSync5,
|
|
40334
|
-
mkdirSync as
|
|
40335
|
-
readFileSync as
|
|
40412
|
+
mkdirSync as mkdirSync6,
|
|
40413
|
+
readFileSync as readFileSync10,
|
|
40336
40414
|
renameSync as renameSync5,
|
|
40337
40415
|
statSync as statSync3,
|
|
40338
40416
|
unlinkSync as unlinkSync3,
|
|
40339
40417
|
utimesSync,
|
|
40340
40418
|
writeFileSync as writeFileSync6
|
|
40341
40419
|
} from "fs";
|
|
40342
|
-
import { join as
|
|
40420
|
+
import { join as join13 } from "path";
|
|
40343
40421
|
var STALE_LOCK_MS = 9e4;
|
|
40344
40422
|
var HEARTBEAT_INTERVAL_MS = 3e4;
|
|
40345
40423
|
function defaultIsPidAlive(pid) {
|
|
@@ -40362,7 +40440,7 @@ function acquireMcpSpawnLock(args) {
|
|
|
40362
40440
|
const nowMs = options.nowMs ?? (() => Date.now());
|
|
40363
40441
|
const lockMtimeMs = options.lockMtimeMs ?? defaultLockMtimeMs;
|
|
40364
40442
|
const staleMs = options.staleMs ?? STALE_LOCK_MS;
|
|
40365
|
-
const path =
|
|
40443
|
+
const path = join13(agentDir, basename);
|
|
40366
40444
|
const existing = readLockHolder(path);
|
|
40367
40445
|
if (existing) {
|
|
40368
40446
|
if (existing.pid === selfPid) {
|
|
@@ -40376,7 +40454,7 @@ function acquireMcpSpawnLock(args) {
|
|
|
40376
40454
|
}
|
|
40377
40455
|
}
|
|
40378
40456
|
}
|
|
40379
|
-
|
|
40457
|
+
mkdirSync6(agentDir, { recursive: true, mode: 448 });
|
|
40380
40458
|
const tmpPath = `${path}.${selfPid}.tmp`;
|
|
40381
40459
|
const payload = { pid: selfPid, started_at: now() };
|
|
40382
40460
|
writeFileSync6(tmpPath, JSON.stringify(payload), { mode: 384 });
|
|
@@ -40429,7 +40507,7 @@ function defaultLockMtimeMs(path) {
|
|
|
40429
40507
|
function readLockHolder(path) {
|
|
40430
40508
|
if (!existsSync5(path)) return null;
|
|
40431
40509
|
try {
|
|
40432
|
-
const raw =
|
|
40510
|
+
const raw = readFileSync10(path, "utf8");
|
|
40433
40511
|
const parsed = JSON.parse(raw);
|
|
40434
40512
|
const pid = typeof parsed.pid === "number" ? parsed.pid : Number(parsed.pid);
|
|
40435
40513
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
@@ -40441,14 +40519,14 @@ function readLockHolder(path) {
|
|
|
40441
40519
|
}
|
|
40442
40520
|
|
|
40443
40521
|
// src/direct-chat-channel.ts
|
|
40444
|
-
import { homedir as
|
|
40445
|
-
import { join as
|
|
40522
|
+
import { homedir as homedir5 } from "os";
|
|
40523
|
+
import { join as join17 } from "path";
|
|
40446
40524
|
import { randomUUID } from "crypto";
|
|
40447
40525
|
import {
|
|
40448
40526
|
watch,
|
|
40449
|
-
mkdirSync as
|
|
40527
|
+
mkdirSync as mkdirSync7,
|
|
40450
40528
|
writeFileSync as writeFileSync8,
|
|
40451
|
-
readFileSync as
|
|
40529
|
+
readFileSync as readFileSync13,
|
|
40452
40530
|
readdirSync as readdirSync6,
|
|
40453
40531
|
existsSync as existsSync6,
|
|
40454
40532
|
renameSync as renameSync6,
|
|
@@ -40458,53 +40536,12 @@ import {
|
|
|
40458
40536
|
} from "fs";
|
|
40459
40537
|
|
|
40460
40538
|
// src/direct-chat-inbound-attachments.ts
|
|
40461
|
-
import { join as
|
|
40462
|
-
|
|
40463
|
-
// ../core/dist/provisioning/frameworks/claudecode/agent-dir-alias.js
|
|
40464
|
-
import { isAbsolute, join as join12, relative, sep } from "path";
|
|
40465
|
-
var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
40466
|
-
var VALID_AGENT_ID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
40467
|
-
var INITIATOR_BASENAME = ".current-turn-initiator.json";
|
|
40468
|
-
function isSafeAgentSegment(segment) {
|
|
40469
|
-
return VALID_CODE_NAME.test(segment) || VALID_AGENT_ID.test(segment);
|
|
40470
|
-
}
|
|
40471
|
-
function initiatorDirSegment(initiatorFile, homeDir) {
|
|
40472
|
-
const rel = relative(join12(homeDir, ".augmented"), initiatorFile);
|
|
40473
|
-
if (!rel || isAbsolute(rel))
|
|
40474
|
-
return null;
|
|
40475
|
-
const parts = rel.split(sep);
|
|
40476
|
-
if (parts.length !== 2 || parts[1] !== INITIATOR_BASENAME)
|
|
40477
|
-
return null;
|
|
40478
|
-
const segment = parts[0];
|
|
40479
|
-
if (segment === void 0)
|
|
40480
|
-
return null;
|
|
40481
|
-
return isSafeAgentSegment(segment) ? segment : null;
|
|
40482
|
-
}
|
|
40483
|
-
function resolveAgentDirAlias(input) {
|
|
40484
|
-
const { codeName, turnInitiatorFile, agentId, homeDir } = input;
|
|
40485
|
-
const codeNameTrimmed = typeof codeName === "string" ? codeName.trim() : "";
|
|
40486
|
-
if (codeNameTrimmed && VALID_CODE_NAME.test(codeNameTrimmed)) {
|
|
40487
|
-
return join12(homeDir, ".augmented", codeNameTrimmed);
|
|
40488
|
-
}
|
|
40489
|
-
const initiator = typeof turnInitiatorFile === "string" ? turnInitiatorFile.trim() : "";
|
|
40490
|
-
if (initiator) {
|
|
40491
|
-
const segment = initiatorDirSegment(initiator, homeDir);
|
|
40492
|
-
if (segment)
|
|
40493
|
-
return join12(homeDir, ".augmented", segment);
|
|
40494
|
-
}
|
|
40495
|
-
const agentIdTrimmed = typeof agentId === "string" ? agentId.trim() : "";
|
|
40496
|
-
if (agentIdTrimmed && VALID_AGENT_ID.test(agentIdTrimmed)) {
|
|
40497
|
-
return join12(homeDir, ".augmented", agentIdTrimmed);
|
|
40498
|
-
}
|
|
40499
|
-
return null;
|
|
40500
|
-
}
|
|
40501
|
-
|
|
40502
|
-
// src/direct-chat-inbound-attachments.ts
|
|
40539
|
+
import { join as join14 } from "path";
|
|
40503
40540
|
var MAX_INBOUND_ATTACHMENT_BYTES = 10 * 1024 * 1024;
|
|
40504
40541
|
var INBOUND_ATTACHMENTS_SUBDIR = "direct-chat-inbound";
|
|
40505
40542
|
function resolveInboundAttachmentsDir(input) {
|
|
40506
40543
|
const alias = resolveAgentDirAlias(input);
|
|
40507
|
-
return alias === null ? null :
|
|
40544
|
+
return alias === null ? null : join14(alias, INBOUND_ATTACHMENTS_SUBDIR);
|
|
40508
40545
|
}
|
|
40509
40546
|
function isImageContentType(contentType) {
|
|
40510
40547
|
return typeof contentType === "string" && contentType.toLowerCase().startsWith("image/");
|
|
@@ -40987,19 +41024,19 @@ function isMaintenanceModeActive(opts) {
|
|
|
40987
41024
|
}
|
|
40988
41025
|
|
|
40989
41026
|
// src/account-enforcement-notice.ts
|
|
40990
|
-
import { readFileSync as
|
|
40991
|
-
import { homedir as
|
|
40992
|
-
import { join as
|
|
41027
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
41028
|
+
import { homedir as homedir4 } from "os";
|
|
41029
|
+
import { join as join15 } from "path";
|
|
40993
41030
|
function accountEnforcementMarkerPath(codeName) {
|
|
40994
41031
|
if (!codeName) return null;
|
|
40995
|
-
return
|
|
41032
|
+
return join15(homedir4(), ".augmented", codeName, ACCOUNT_ENFORCEMENT_MARKER_FILENAME);
|
|
40996
41033
|
}
|
|
40997
41034
|
function readAccountEnforcementMarker(opts) {
|
|
40998
41035
|
const path = opts.filePath ?? accountEnforcementMarkerPath(opts.codeName);
|
|
40999
41036
|
if (!path) return null;
|
|
41000
41037
|
let raw;
|
|
41001
41038
|
try {
|
|
41002
|
-
raw =
|
|
41039
|
+
raw = readFileSync11(path, "utf-8");
|
|
41003
41040
|
} catch {
|
|
41004
41041
|
return null;
|
|
41005
41042
|
}
|
|
@@ -41025,8 +41062,8 @@ function shouldSendAccountWarn(opts) {
|
|
|
41025
41062
|
}
|
|
41026
41063
|
|
|
41027
41064
|
// ../core/dist/direct-chat/cursor-advance-telemetry.js
|
|
41028
|
-
import { readFileSync as
|
|
41029
|
-
import { join as
|
|
41065
|
+
import { readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "fs";
|
|
41066
|
+
import { join as join16 } from "path";
|
|
41030
41067
|
var CURSOR_SHORTFALL_COUNTER_SUFFIX = "-cursor-advance-classifications.json";
|
|
41031
41068
|
function recordCursorAdvanceOutcome(agentDir, source, route, verdict) {
|
|
41032
41069
|
if (!agentDir)
|
|
@@ -41034,10 +41071,10 @@ function recordCursorAdvanceOutcome(agentDir, source, route, verdict) {
|
|
|
41034
41071
|
const key = cursorAdvanceCounterKey(route, verdict);
|
|
41035
41072
|
if (key === null)
|
|
41036
41073
|
return;
|
|
41037
|
-
const path =
|
|
41074
|
+
const path = join16(agentDir, `${source}${CURSOR_SHORTFALL_COUNTER_SUFFIX}`);
|
|
41038
41075
|
const counts = {};
|
|
41039
41076
|
try {
|
|
41040
|
-
const parsed = JSON.parse(
|
|
41077
|
+
const parsed = JSON.parse(readFileSync12(path, "utf-8"));
|
|
41041
41078
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
41042
41079
|
for (const [k, v] of Object.entries(parsed)) {
|
|
41043
41080
|
if (typeof v === "number" && Number.isInteger(v) && v >= 0)
|
|
@@ -41170,21 +41207,21 @@ var DIRECT_CHAT_ACCOUNT_WARN_COOLDOWN_MS = (() => {
|
|
|
41170
41207
|
var AGT_HOST = process.env.AGT_HOST;
|
|
41171
41208
|
var AGT_API_KEY = process.env.AGT_API_KEY;
|
|
41172
41209
|
var AGT_AGENT_ID = process.env.AGT_AGENT_ID;
|
|
41173
|
-
var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ?
|
|
41210
|
+
var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ? join17(homedir5(), ".augmented", AGT_AGENT_ID) : null;
|
|
41174
41211
|
var INBOUND_ATTACHMENTS_DIR = resolveInboundAttachmentsDir({
|
|
41175
41212
|
codeName: process.env.AGT_AGENT_CODE_NAME,
|
|
41176
41213
|
turnInitiatorFile: process.env.AGT_TURN_INITIATOR_FILE,
|
|
41177
41214
|
agentId: AGT_AGENT_ID,
|
|
41178
|
-
homeDir:
|
|
41215
|
+
homeDir: homedir5()
|
|
41179
41216
|
});
|
|
41180
41217
|
var AGT_AGENT_CODE_NAME = process.env.AGT_AGENT_CODE_NAME;
|
|
41181
41218
|
var directChatStderrLogStream = null;
|
|
41182
41219
|
if (AGT_AGENT_CODE_NAME) {
|
|
41183
41220
|
try {
|
|
41184
|
-
const logDir =
|
|
41185
|
-
|
|
41221
|
+
const logDir = join17(homedir5(), ".augmented", AGT_AGENT_CODE_NAME);
|
|
41222
|
+
mkdirSync7(logDir, { recursive: true });
|
|
41186
41223
|
directChatStderrLogStream = createWriteStream(
|
|
41187
|
-
|
|
41224
|
+
join17(logDir, "direct-chat-channel-stderr.log"),
|
|
41188
41225
|
{ flags: "a", mode: 384 }
|
|
41189
41226
|
);
|
|
41190
41227
|
directChatStderrLogStream.on("error", () => {
|
|
@@ -41203,10 +41240,10 @@ if (AGT_AGENT_CODE_NAME) {
|
|
|
41203
41240
|
} catch {
|
|
41204
41241
|
}
|
|
41205
41242
|
}
|
|
41206
|
-
var PROGRESS_HEARTBEAT_PATH = AGT_AGENT_CODE_NAME ?
|
|
41207
|
-
var DIRECT_CHAT_PENDING_INBOUND_DIR = AGT_AGENT_CODE_NAME ?
|
|
41208
|
-
var DIRECT_CHAT_DELIVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ?
|
|
41209
|
-
var DIRECT_CHAT_CODE_NAME_AGENT_DIR = AGT_AGENT_CODE_NAME ?
|
|
41243
|
+
var PROGRESS_HEARTBEAT_PATH = AGT_AGENT_CODE_NAME ? join17(homedir5(), ".augmented", AGT_AGENT_CODE_NAME, "channel-progress-heartbeat.json") : null;
|
|
41244
|
+
var DIRECT_CHAT_PENDING_INBOUND_DIR = AGT_AGENT_CODE_NAME ? join17(homedir5(), ".augmented", AGT_AGENT_CODE_NAME, "direct-chat-pending-inbound") : null;
|
|
41245
|
+
var DIRECT_CHAT_DELIVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ? join17(homedir5(), ".augmented", AGT_AGENT_CODE_NAME, ".agt-inbound-delivery-ledger") : null;
|
|
41246
|
+
var DIRECT_CHAT_CODE_NAME_AGENT_DIR = AGT_AGENT_CODE_NAME ? join17(homedir5(), ".augmented", AGT_AGENT_CODE_NAME) : null;
|
|
41210
41247
|
var DIRECT_CHAT_STALE_MARKER_MS = 24 * 60 * 60 * 1e3;
|
|
41211
41248
|
function judgeCursorAdvance(input, ctx) {
|
|
41212
41249
|
const verdict = classifyCursorAdvance(input);
|
|
@@ -41226,8 +41263,8 @@ function recordDirectChatDelivery(sessionId, messageIds) {
|
|
|
41226
41263
|
delivered_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
41227
41264
|
});
|
|
41228
41265
|
}
|
|
41229
|
-
var DIRECT_CHAT_RECOVERY_OUTBOX_DIR = AGT_AGENT_CODE_NAME ?
|
|
41230
|
-
var DIRECT_CHAT_RECOVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ?
|
|
41266
|
+
var DIRECT_CHAT_RECOVERY_OUTBOX_DIR = AGT_AGENT_CODE_NAME ? join17(homedir5(), ".augmented", AGT_AGENT_CODE_NAME, "direct-chat-recovery-outbox") : null;
|
|
41267
|
+
var DIRECT_CHAT_RECOVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ? join17(homedir5(), ".augmented", AGT_AGENT_CODE_NAME, ".agt-direct-chat-recovery-ledger") : null;
|
|
41231
41268
|
var progressReceivedAt = /* @__PURE__ */ new Map();
|
|
41232
41269
|
var directChatProgressState = { tracked: null };
|
|
41233
41270
|
var directChatProgressTickRunning = false;
|
|
@@ -41246,7 +41283,7 @@ var directChatKanbanCardClient = createKanbanCardActiveClient({
|
|
|
41246
41283
|
function readProgressHeartbeat() {
|
|
41247
41284
|
if (!PROGRESS_HEARTBEAT_PATH || !existsSync6(PROGRESS_HEARTBEAT_PATH)) return null;
|
|
41248
41285
|
try {
|
|
41249
|
-
return parseProgressHeartbeat(
|
|
41286
|
+
return parseProgressHeartbeat(readFileSync13(PROGRESS_HEARTBEAT_PATH, "utf-8"));
|
|
41250
41287
|
} catch {
|
|
41251
41288
|
return null;
|
|
41252
41289
|
}
|
|
@@ -41255,7 +41292,7 @@ function seedProgressHeartbeat() {
|
|
|
41255
41292
|
if (!PROGRESS_HEARTBEAT_PATH) return;
|
|
41256
41293
|
const tmp = `${PROGRESS_HEARTBEAT_PATH}.${process.pid}.tmp`;
|
|
41257
41294
|
try {
|
|
41258
|
-
|
|
41295
|
+
mkdirSync7(join17(homedir5(), ".augmented", AGT_AGENT_CODE_NAME), { recursive: true });
|
|
41259
41296
|
writeFileSync8(tmp, serializeProgressHeartbeat(SEED_PROGRESS_STEP, Date.now()), { mode: 384 });
|
|
41260
41297
|
renameSync6(tmp, PROGRESS_HEARTBEAT_PATH);
|
|
41261
41298
|
} catch {
|
|
@@ -41450,9 +41487,9 @@ var inboundAttachmentDeps = {
|
|
|
41450
41487
|
bytes: async () => new Uint8Array(await res.arrayBuffer())
|
|
41451
41488
|
};
|
|
41452
41489
|
},
|
|
41453
|
-
ensureDir: (dir) =>
|
|
41490
|
+
ensureDir: (dir) => mkdirSync7(dir, { recursive: true }),
|
|
41454
41491
|
writeFile: (path, bytes) => writeFileSync8(path, bytes, { mode: 384 }),
|
|
41455
|
-
joinPath: (...parts) =>
|
|
41492
|
+
joinPath: (...parts) => join17(...parts),
|
|
41456
41493
|
warn: (msg) => process.stderr.write(`${msg}
|
|
41457
41494
|
`)
|
|
41458
41495
|
};
|
|
@@ -41886,7 +41923,7 @@ function directChatSessionReplayFacts(sessionId) {
|
|
|
41886
41923
|
sessionId,
|
|
41887
41924
|
(fullPath) => {
|
|
41888
41925
|
try {
|
|
41889
|
-
const marker = JSON.parse(
|
|
41926
|
+
const marker = JSON.parse(readFileSync13(fullPath, "utf-8"));
|
|
41890
41927
|
found.push({ hasPayload: Boolean(marker.payload), discretionary: marker.discretionary });
|
|
41891
41928
|
} catch {
|
|
41892
41929
|
found.push({ hasPayload: false });
|
|
@@ -41945,7 +41982,7 @@ function scheduleDirectChatBusyAck(sessionId, messageId, arrivedWhileBusy) {
|
|
|
41945
41982
|
let paneLogFreshAgeMs = null;
|
|
41946
41983
|
if (DIRECT_CHAT_CODE_NAME_AGENT_DIR) {
|
|
41947
41984
|
try {
|
|
41948
|
-
const paneMtimeMs = statSync4(
|
|
41985
|
+
const paneMtimeMs = statSync4(join17(DIRECT_CHAT_CODE_NAME_AGENT_DIR, "pane.log")).mtimeMs;
|
|
41949
41986
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
41950
41987
|
} catch {
|
|
41951
41988
|
}
|
|
@@ -42295,8 +42332,14 @@ async function pollForMessages(sinceMs) {
|
|
|
42295
42332
|
writeTurnInitiatorMarker({
|
|
42296
42333
|
channel: "direct-chat",
|
|
42297
42334
|
sender_id: msg.sender_id,
|
|
42298
|
-
channel_ref: msg.session_id
|
|
42335
|
+
channel_ref: msg.session_id,
|
|
42336
|
+
// ENG-11348: one sender per session from this side. Whether the
|
|
42337
|
+
// TRANSCRIPT is private (only for a manager-only agent) is decided
|
|
42338
|
+
// server-side, so 'direct' here is not the last word.
|
|
42339
|
+
chat_kind: "direct"
|
|
42299
42340
|
});
|
|
42341
|
+
} else {
|
|
42342
|
+
writeUnattributedTurnMarker("direct-chat");
|
|
42300
42343
|
}
|
|
42301
42344
|
if (isNotice) {
|
|
42302
42345
|
try {
|
|
@@ -42414,7 +42457,7 @@ var doorbellWatcher = null;
|
|
|
42414
42457
|
var safetyNetTimer = null;
|
|
42415
42458
|
if (DOORBELL_ENABLED && DIRECT_CHAT_AGENT_DIR) {
|
|
42416
42459
|
try {
|
|
42417
|
-
|
|
42460
|
+
mkdirSync7(DIRECT_CHAT_AGENT_DIR, { recursive: true });
|
|
42418
42461
|
} catch {
|
|
42419
42462
|
}
|
|
42420
42463
|
const sessionState = readDirectChatSessionState(DIRECT_CHAT_AGENT_DIR, Date.now());
|
|
@@ -42485,7 +42528,7 @@ function sweepAgedDirectChatMarkersNow(thresholdMs) {
|
|
|
42485
42528
|
const now = Date.now();
|
|
42486
42529
|
const res = sweepAgedDirectChatMarkers(DIRECT_CHAT_PENDING_INBOUND_DIR, {
|
|
42487
42530
|
readdir: (dir) => readdirSync6(dir),
|
|
42488
|
-
readFile: (p2) =>
|
|
42531
|
+
readFile: (p2) => readFileSync13(p2, "utf8"),
|
|
42489
42532
|
unlink: (p2) => {
|
|
42490
42533
|
if (existsSync6(p2)) unlinkSync4(p2);
|
|
42491
42534
|
},
|
|
@@ -42534,7 +42577,7 @@ function sanitizeRecoveryText(text) {
|
|
|
42534
42577
|
}
|
|
42535
42578
|
function directChatRecoveryDeps() {
|
|
42536
42579
|
return {
|
|
42537
|
-
readFile: (p2) =>
|
|
42580
|
+
readFile: (p2) => readFileSync13(p2, "utf-8"),
|
|
42538
42581
|
renameFile: (from, to) => renameSync6(from, to),
|
|
42539
42582
|
unlinkFile: (p2) => {
|
|
42540
42583
|
if (existsSync6(p2)) unlinkSync4(p2);
|
|
@@ -42547,7 +42590,7 @@ function directChatRecoveryDeps() {
|
|
|
42547
42590
|
if (!DIRECT_CHAT_RECOVERY_LEDGER_DIR) return;
|
|
42548
42591
|
if (markerName.includes("/") || markerName.includes("\\") || markerName.includes("..")) return;
|
|
42549
42592
|
try {
|
|
42550
|
-
const p2 =
|
|
42593
|
+
const p2 = join17(DIRECT_CHAT_RECOVERY_LEDGER_DIR, markerName);
|
|
42551
42594
|
if (existsSync6(p2)) unlinkSync4(p2);
|
|
42552
42595
|
} catch {
|
|
42553
42596
|
}
|
|
@@ -42598,7 +42641,7 @@ async function processDirectChatRecoveryOutboxFile(filename) {
|
|
|
42598
42641
|
if (!enabled) return;
|
|
42599
42642
|
directChatRecoveryInFlight.add(filename);
|
|
42600
42643
|
try {
|
|
42601
|
-
const fullPath =
|
|
42644
|
+
const fullPath = join17(DIRECT_CHAT_RECOVERY_OUTBOX_DIR, filename);
|
|
42602
42645
|
await consumeDirectChatRecoveryFile(fullPath, filename, directChatRecoveryDeps());
|
|
42603
42646
|
} catch (err) {
|
|
42604
42647
|
process.stderr.write(
|
|
@@ -42612,7 +42655,7 @@ async function processDirectChatRecoveryOutboxFile(filename) {
|
|
|
42612
42655
|
var directChatRecoveryWatcher = null;
|
|
42613
42656
|
if (DIRECT_CHAT_RECOVERY_OUTBOX_DIR) {
|
|
42614
42657
|
try {
|
|
42615
|
-
|
|
42658
|
+
mkdirSync7(DIRECT_CHAT_RECOVERY_OUTBOX_DIR, { recursive: true, mode: 448 });
|
|
42616
42659
|
} catch {
|
|
42617
42660
|
}
|
|
42618
42661
|
try {
|
|
@@ -42626,7 +42669,7 @@ if (DIRECT_CHAT_RECOVERY_OUTBOX_DIR) {
|
|
|
42626
42669
|
if (!filename) return;
|
|
42627
42670
|
const name = filename.toString();
|
|
42628
42671
|
if (!name.endsWith(".json")) return;
|
|
42629
|
-
if (existsSync6(
|
|
42672
|
+
if (existsSync6(join17(DIRECT_CHAT_RECOVERY_OUTBOX_DIR, name))) {
|
|
42630
42673
|
void processDirectChatRecoveryOutboxFile(name);
|
|
42631
42674
|
}
|
|
42632
42675
|
});
|