@integrity-labs/agt-cli 0.28.109 → 0.28.111
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-D22IMWAZ.js → chunk-63VABDNF.js} +1 -1
- package/dist/{chunk-ZJLRHPPL.js → chunk-JMNRCUHL.js} +28 -3
- package/dist/chunk-JMNRCUHL.js.map +1 -0
- package/dist/{chunk-O4OYAFTZ.js → chunk-QP4RFWWF.js} +2 -2
- package/dist/{claude-pair-runtime-6DZEDQAG.js → claude-pair-runtime-Z3RAR35Q.js} +2 -2
- package/dist/lib/manager-worker.js +8 -8
- package/dist/mcp/slack-channel.js +95 -54
- package/dist/mcp/teams-channel.js +76 -35
- package/dist/mcp/telegram-channel.js +101 -60
- package/dist/{persistent-session-RMRG5HXI.js → persistent-session-BQ3NLYEC.js} +3 -3
- package/dist/{responsiveness-probe-2KVIALGI.js → responsiveness-probe-QNTUW6SW.js} +58 -4
- package/dist/responsiveness-probe-QNTUW6SW.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-ZJLRHPPL.js.map +0 -1
- package/dist/responsiveness-probe-2KVIALGI.js.map +0 -1
- /package/dist/{chunk-D22IMWAZ.js.map → chunk-63VABDNF.js.map} +0 -0
- /package/dist/{chunk-O4OYAFTZ.js.map → chunk-QP4RFWWF.js.map} +0 -0
- /package/dist/{claude-pair-runtime-6DZEDQAG.js.map → claude-pair-runtime-Z3RAR35Q.js.map} +0 -0
- /package/dist/{persistent-session-RMRG5HXI.js.map → persistent-session-BQ3NLYEC.js.map} +0 -0
|
@@ -13865,16 +13865,16 @@ var StdioServerTransport = class {
|
|
|
13865
13865
|
import {
|
|
13866
13866
|
mkdirSync as mkdirSync3,
|
|
13867
13867
|
readdirSync as readdirSync2,
|
|
13868
|
-
readFileSync as
|
|
13868
|
+
readFileSync as readFileSync3,
|
|
13869
13869
|
renameSync,
|
|
13870
13870
|
rmSync,
|
|
13871
13871
|
statSync,
|
|
13872
13872
|
unlinkSync,
|
|
13873
13873
|
watch,
|
|
13874
|
-
writeFileSync as
|
|
13874
|
+
writeFileSync as writeFileSync4
|
|
13875
13875
|
} from "fs";
|
|
13876
13876
|
import { homedir } from "os";
|
|
13877
|
-
import { join as
|
|
13877
|
+
import { join as join3, resolve as resolvePath2 } from "path";
|
|
13878
13878
|
import { basename } from "path";
|
|
13879
13879
|
|
|
13880
13880
|
// src/slack-loop-throttle.ts
|
|
@@ -14280,6 +14280,43 @@ function conversationalLaneMeta(expectsReply = true) {
|
|
|
14280
14280
|
};
|
|
14281
14281
|
}
|
|
14282
14282
|
|
|
14283
|
+
// src/inbound-lane-telemetry.ts
|
|
14284
|
+
import { readFileSync, writeFileSync as writeFileSync2 } from "fs";
|
|
14285
|
+
import { join as join2 } from "path";
|
|
14286
|
+
var LANE_CLASSIFICATION_COUNTER_SUFFIX = "-lane-classifications.json";
|
|
14287
|
+
var SUSPECTED_MISCLASSIFICATION_KEY = "suspected_misclassification";
|
|
14288
|
+
var HUMAN_CHANNEL_SOURCES = /* @__PURE__ */ new Set([
|
|
14289
|
+
"slack",
|
|
14290
|
+
"telegram",
|
|
14291
|
+
"msteams",
|
|
14292
|
+
"direct-chat"
|
|
14293
|
+
]);
|
|
14294
|
+
function laneClassificationKey(lane, expectsReply, source) {
|
|
14295
|
+
return `${lane}|${expectsReply ? "true" : "false"}|${source}`;
|
|
14296
|
+
}
|
|
14297
|
+
function isSuspectedMisclassification(lane, source) {
|
|
14298
|
+
return lane === "directive" && HUMAN_CHANNEL_SOURCES.has(source);
|
|
14299
|
+
}
|
|
14300
|
+
function recordLaneClassification(agentDir, channel, classification) {
|
|
14301
|
+
if (!agentDir) return;
|
|
14302
|
+
const path = join2(agentDir, `${channel}${LANE_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
14303
|
+
let counts = {};
|
|
14304
|
+
try {
|
|
14305
|
+
const parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
14306
|
+
if (parsed && typeof parsed === "object") counts = parsed;
|
|
14307
|
+
} catch {
|
|
14308
|
+
}
|
|
14309
|
+
const key2 = laneClassificationKey(classification.lane, classification.expectsReply, channel);
|
|
14310
|
+
counts[key2] = (counts[key2] ?? 0) + 1;
|
|
14311
|
+
if (isSuspectedMisclassification(classification.lane, channel)) {
|
|
14312
|
+
counts[SUSPECTED_MISCLASSIFICATION_KEY] = (counts[SUSPECTED_MISCLASSIFICATION_KEY] ?? 0) + 1;
|
|
14313
|
+
}
|
|
14314
|
+
try {
|
|
14315
|
+
writeFileSync2(path, JSON.stringify(counts), { mode: 384 });
|
|
14316
|
+
} catch {
|
|
14317
|
+
}
|
|
14318
|
+
}
|
|
14319
|
+
|
|
14283
14320
|
// src/teams-channel-info.ts
|
|
14284
14321
|
function buildChannelInfoResult(input) {
|
|
14285
14322
|
if (input.members === null) {
|
|
@@ -14535,7 +14572,7 @@ function parsePeerAgentModeEnv(raw) {
|
|
|
14535
14572
|
}
|
|
14536
14573
|
|
|
14537
14574
|
// src/teams-thread-store.ts
|
|
14538
|
-
import { mkdirSync as mkdirSync2, readFileSync, writeFileSync as
|
|
14575
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
14539
14576
|
import { dirname } from "path";
|
|
14540
14577
|
var FILE_VERSION = 1;
|
|
14541
14578
|
var DEFAULT_TTL_DAYS = 30;
|
|
@@ -14549,7 +14586,7 @@ function loadThreadStore(filePath, opts = {}) {
|
|
|
14549
14586
|
const ttlMs = ttlDays * 24 * 60 * 60 * 1e3;
|
|
14550
14587
|
let raw;
|
|
14551
14588
|
try {
|
|
14552
|
-
raw =
|
|
14589
|
+
raw = readFileSync2(filePath, "utf-8");
|
|
14553
14590
|
} catch {
|
|
14554
14591
|
return { threads: /* @__PURE__ */ new Map(), pruned: 0 };
|
|
14555
14592
|
}
|
|
@@ -14602,7 +14639,7 @@ function createThreadPersister(opts) {
|
|
|
14602
14639
|
const writeNow = (snap) => {
|
|
14603
14640
|
try {
|
|
14604
14641
|
mkdirSync2(dirname(opts.filePath), { recursive: true });
|
|
14605
|
-
|
|
14642
|
+
writeFileSync3(opts.filePath, serializeThreadStore(snap), "utf-8");
|
|
14606
14643
|
lastWriteAt = Date.now();
|
|
14607
14644
|
} catch (err) {
|
|
14608
14645
|
opts.onError?.(
|
|
@@ -14736,7 +14773,7 @@ var ADAPTIVE_CARDS_ENABLED = process.env.MSTEAMS_ADAPTIVE_CARDS_ENABLED === "tru
|
|
|
14736
14773
|
var ADAPTIVE_CARDS_ASK_USER_ENABLED = process.env.MSTEAMS_ADAPTIVE_CARDS_ASK_USER_ENABLED === "true";
|
|
14737
14774
|
var ASK_USER_DEFAULT_TIMEOUT_SECONDS = 300;
|
|
14738
14775
|
var ASK_USER_POLL_INTERVAL_MS = 1e3;
|
|
14739
|
-
var PROJECT_DIR = AGENT_CODE_NAME ? resolvePath2(
|
|
14776
|
+
var PROJECT_DIR = AGENT_CODE_NAME ? resolvePath2(join3(homedir(), ".augmented", AGENT_CODE_NAME, "project")) : null;
|
|
14740
14777
|
var MAX_UPLOAD_BYTES = 4 * 1024 * 1024;
|
|
14741
14778
|
var AAD_TOKEN_URL = (tenantId) => `https://login.microsoftonline.com/${encodeURIComponent(tenantId)}/oauth2/v2.0/token`;
|
|
14742
14779
|
var BOT_FRAMEWORK_SCOPE = "https://api.botframework.com/.default";
|
|
@@ -14856,7 +14893,7 @@ var trackedThreads = /* @__PURE__ */ new Map();
|
|
|
14856
14893
|
var threadPersister = null;
|
|
14857
14894
|
function threadStorePath() {
|
|
14858
14895
|
if (!AGENT_CODE_NAME) return null;
|
|
14859
|
-
return
|
|
14896
|
+
return join3(homedir(), ".augmented", AGENT_CODE_NAME, "msteams-tracked-threads.json");
|
|
14860
14897
|
}
|
|
14861
14898
|
function loadTrackedThreads() {
|
|
14862
14899
|
const path = threadStorePath();
|
|
@@ -14901,9 +14938,9 @@ function rememberThread(conversationId, serviceUrl, mode, activityId) {
|
|
|
14901
14938
|
});
|
|
14902
14939
|
threadPersister?.schedule(trackedThreads);
|
|
14903
14940
|
}
|
|
14904
|
-
var AGENT_DIR = AGENT_CODE_NAME ?
|
|
14905
|
-
var PENDING_INBOUND_DIR = AGENT_DIR ?
|
|
14906
|
-
var PROCESSED_DIR = PENDING_INBOUND_DIR ?
|
|
14941
|
+
var AGENT_DIR = AGENT_CODE_NAME ? join3(homedir(), ".augmented", AGENT_CODE_NAME) : null;
|
|
14942
|
+
var PENDING_INBOUND_DIR = AGENT_DIR ? join3(AGENT_DIR, "msteams-pending-inbound") : null;
|
|
14943
|
+
var PROCESSED_DIR = PENDING_INBOUND_DIR ? join3(PENDING_INBOUND_DIR, ".processed") : null;
|
|
14907
14944
|
function ensurePendingDirs() {
|
|
14908
14945
|
if (!PENDING_INBOUND_DIR || !PROCESSED_DIR) return;
|
|
14909
14946
|
try {
|
|
@@ -14919,10 +14956,10 @@ function ensurePendingDirs() {
|
|
|
14919
14956
|
async function processPendingFile(filename) {
|
|
14920
14957
|
if (!PENDING_INBOUND_DIR || !PROCESSED_DIR) return;
|
|
14921
14958
|
if (!filename.endsWith(".json")) return;
|
|
14922
|
-
const fullPath =
|
|
14959
|
+
const fullPath = join3(PENDING_INBOUND_DIR, filename);
|
|
14923
14960
|
let activity;
|
|
14924
14961
|
try {
|
|
14925
|
-
const raw =
|
|
14962
|
+
const raw = readFileSync3(fullPath, "utf8");
|
|
14926
14963
|
activity = JSON.parse(raw);
|
|
14927
14964
|
} catch (err) {
|
|
14928
14965
|
process.stderr.write(
|
|
@@ -14931,7 +14968,7 @@ async function processPendingFile(filename) {
|
|
|
14931
14968
|
);
|
|
14932
14969
|
if (PROCESSED_DIR) {
|
|
14933
14970
|
try {
|
|
14934
|
-
renameSync(fullPath,
|
|
14971
|
+
renameSync(fullPath, join3(PROCESSED_DIR, `${filename}.invalid`));
|
|
14935
14972
|
} catch {
|
|
14936
14973
|
}
|
|
14937
14974
|
}
|
|
@@ -14945,7 +14982,7 @@ async function processPendingFile(filename) {
|
|
|
14945
14982
|
peerAgentMode: PEER_AGENT_MODE
|
|
14946
14983
|
});
|
|
14947
14984
|
try {
|
|
14948
|
-
renameSync(fullPath,
|
|
14985
|
+
renameSync(fullPath, join3(PROCESSED_DIR, filename));
|
|
14949
14986
|
} catch {
|
|
14950
14987
|
return;
|
|
14951
14988
|
}
|
|
@@ -15069,6 +15106,10 @@ async function emitChannelNotification(activity, flags = {}) {
|
|
|
15069
15106
|
}
|
|
15070
15107
|
if (isAutoFollowed) meta["auto_followed"] = "true";
|
|
15071
15108
|
if (flags.isPeerListen) meta["peer_listen"] = "true";
|
|
15109
|
+
recordLaneClassification(AGENT_DIR, "msteams", {
|
|
15110
|
+
lane: "conversational",
|
|
15111
|
+
expectsReply: !flags.isPeerListen
|
|
15112
|
+
});
|
|
15072
15113
|
try {
|
|
15073
15114
|
await mcp.notification({
|
|
15074
15115
|
method: "notifications/claude/channel",
|
|
@@ -15095,7 +15136,7 @@ function startPendingInboundWatcher() {
|
|
|
15095
15136
|
}
|
|
15096
15137
|
ensurePendingDirs();
|
|
15097
15138
|
try {
|
|
15098
|
-
const entries = readdirSync2(PENDING_INBOUND_DIR).filter((f) => f.endsWith(".json")).map((f) => ({ f, m: safeMtimeMs(
|
|
15139
|
+
const entries = readdirSync2(PENDING_INBOUND_DIR).filter((f) => f.endsWith(".json")).map((f) => ({ f, m: safeMtimeMs(join3(PENDING_INBOUND_DIR, f)) })).sort((a, b) => a.m - b.m).map((e) => e.f);
|
|
15099
15140
|
for (const f of entries) {
|
|
15100
15141
|
void processPendingFile(f).catch((err) => {
|
|
15101
15142
|
process.stderr.write(
|
|
@@ -15120,7 +15161,7 @@ function startPendingInboundWatcher() {
|
|
|
15120
15161
|
if (!name || typeof name !== "string") return;
|
|
15121
15162
|
if (!name.endsWith(".json")) return;
|
|
15122
15163
|
if (name.startsWith(".")) return;
|
|
15123
|
-
const fullPath =
|
|
15164
|
+
const fullPath = join3(PENDING_INBOUND_DIR, name);
|
|
15124
15165
|
try {
|
|
15125
15166
|
statSync(fullPath);
|
|
15126
15167
|
} catch {
|
|
@@ -15533,7 +15574,7 @@ function optionalStringArg(args, key2) {
|
|
|
15533
15574
|
function errResult(text) {
|
|
15534
15575
|
return { content: [{ type: "text", text }], isError: true };
|
|
15535
15576
|
}
|
|
15536
|
-
var PENDING_INTERACTIONS_DIR = AGENT_DIR ?
|
|
15577
|
+
var PENDING_INTERACTIONS_DIR = AGENT_DIR ? join3(AGENT_DIR, "msteams-pending-interactions") : null;
|
|
15537
15578
|
function ensurePendingInteractionsDir() {
|
|
15538
15579
|
if (!PENDING_INTERACTIONS_DIR) return;
|
|
15539
15580
|
try {
|
|
@@ -15548,16 +15589,16 @@ function ensurePendingInteractionsDir() {
|
|
|
15548
15589
|
function writePendingInteraction(entry) {
|
|
15549
15590
|
if (!PENDING_INTERACTIONS_DIR) return;
|
|
15550
15591
|
ensurePendingInteractionsDir();
|
|
15551
|
-
|
|
15552
|
-
|
|
15592
|
+
writeFileSync4(
|
|
15593
|
+
join3(PENDING_INTERACTIONS_DIR, `${entry.interaction_id}.json`),
|
|
15553
15594
|
JSON.stringify(entry, null, 2)
|
|
15554
15595
|
);
|
|
15555
15596
|
}
|
|
15556
15597
|
function readInteractionAnswer(interactionId) {
|
|
15557
15598
|
if (!PENDING_INTERACTIONS_DIR) return null;
|
|
15558
|
-
const path =
|
|
15599
|
+
const path = join3(PENDING_INTERACTIONS_DIR, `${interactionId}.answer.json`);
|
|
15559
15600
|
try {
|
|
15560
|
-
const raw =
|
|
15601
|
+
const raw = readFileSync3(path, "utf8");
|
|
15561
15602
|
const parsed = JSON.parse(raw);
|
|
15562
15603
|
if (typeof parsed.value !== "string") return null;
|
|
15563
15604
|
return {
|
|
@@ -15579,7 +15620,7 @@ function readInteractionAnswer(interactionId) {
|
|
|
15579
15620
|
function clearPendingInteraction(interactionId) {
|
|
15580
15621
|
if (!PENDING_INTERACTIONS_DIR) return;
|
|
15581
15622
|
for (const suffix of [".json", ".answer.json"]) {
|
|
15582
|
-
const path =
|
|
15623
|
+
const path = join3(PENDING_INTERACTIONS_DIR, `${interactionId}${suffix}`);
|
|
15583
15624
|
try {
|
|
15584
15625
|
unlinkSync(path);
|
|
15585
15626
|
} catch (err) {
|
|
@@ -15743,7 +15784,7 @@ async function handleUploadFile(args) {
|
|
|
15743
15784
|
);
|
|
15744
15785
|
}
|
|
15745
15786
|
try {
|
|
15746
|
-
buffer =
|
|
15787
|
+
buffer = readFileSync3(sandboxed.resolved);
|
|
15747
15788
|
} catch (err) {
|
|
15748
15789
|
return errResult(`Failed to read file: ${err.message}`);
|
|
15749
15790
|
}
|
|
@@ -15786,8 +15827,8 @@ async function handleUploadFile(args) {
|
|
|
15786
15827
|
return errResult(`Failed: ${err.message}`);
|
|
15787
15828
|
}
|
|
15788
15829
|
}
|
|
15789
|
-
var PENDING_MARKER_DIR = PENDING_INBOUND_DIR ?
|
|
15790
|
-
var RECOVERY_OUTBOX_DIR = AGENT_DIR ?
|
|
15830
|
+
var PENDING_MARKER_DIR = PENDING_INBOUND_DIR ? join3(PENDING_INBOUND_DIR, ".markers") : null;
|
|
15831
|
+
var RECOVERY_OUTBOX_DIR = AGENT_DIR ? join3(AGENT_DIR, "msteams-recovery-outbox") : null;
|
|
15791
15832
|
var STALE_MARKER_MS = 24 * 60 * 60 * 1e3;
|
|
15792
15833
|
var RECOVERY_RETRY_SCAN_INTERVAL_MS = 6e4;
|
|
15793
15834
|
var RECOVERY_RETRY_BACKOFFS_MS = [6e4, 12e4, 24e4];
|
|
@@ -15814,8 +15855,8 @@ function writePendingMarker(activity) {
|
|
|
15814
15855
|
ensureGhostReplyDirs();
|
|
15815
15856
|
const name = safeMarkerName(activity.conversation.id, activity.id);
|
|
15816
15857
|
try {
|
|
15817
|
-
|
|
15818
|
-
|
|
15858
|
+
writeFileSync4(
|
|
15859
|
+
join3(PENDING_MARKER_DIR, name),
|
|
15819
15860
|
JSON.stringify(
|
|
15820
15861
|
{
|
|
15821
15862
|
conversation_id: activity.conversation.id,
|
|
@@ -15848,7 +15889,7 @@ function clearPendingMarkersForConversation(conversationId) {
|
|
|
15848
15889
|
for (const f of entries) {
|
|
15849
15890
|
if (f.startsWith(`${safe}--`)) {
|
|
15850
15891
|
try {
|
|
15851
|
-
unlinkSync(
|
|
15892
|
+
unlinkSync(join3(PENDING_MARKER_DIR, f));
|
|
15852
15893
|
} catch {
|
|
15853
15894
|
}
|
|
15854
15895
|
}
|
|
@@ -15865,7 +15906,7 @@ function sweepStaleMarkersOnBoot() {
|
|
|
15865
15906
|
let pruned = 0;
|
|
15866
15907
|
const now = Date.now();
|
|
15867
15908
|
for (const f of entries) {
|
|
15868
|
-
const path =
|
|
15909
|
+
const path = join3(PENDING_MARKER_DIR, f);
|
|
15869
15910
|
try {
|
|
15870
15911
|
const stats = statSync(path);
|
|
15871
15912
|
if (now - stats.mtimeMs > STALE_MARKER_MS) {
|
|
@@ -15897,10 +15938,10 @@ function recoveryNextAttempt(filename) {
|
|
|
15897
15938
|
}
|
|
15898
15939
|
async function processRecoveryFile(filename) {
|
|
15899
15940
|
if (!RECOVERY_OUTBOX_DIR) return;
|
|
15900
|
-
const fullPath =
|
|
15941
|
+
const fullPath = join3(RECOVERY_OUTBOX_DIR, filename);
|
|
15901
15942
|
let payload;
|
|
15902
15943
|
try {
|
|
15903
|
-
payload = JSON.parse(
|
|
15944
|
+
payload = JSON.parse(readFileSync3(fullPath, "utf8"));
|
|
15904
15945
|
} catch (err) {
|
|
15905
15946
|
process.stderr.write(
|
|
15906
15947
|
`teams-channel: recovery file ${filename} unreadable (${err.message}) \u2014 dropping
|
|
@@ -15947,7 +15988,7 @@ async function processRecoveryFile(filename) {
|
|
|
15947
15988
|
return;
|
|
15948
15989
|
}
|
|
15949
15990
|
try {
|
|
15950
|
-
renameSync(fullPath,
|
|
15991
|
+
renameSync(fullPath, join3(RECOVERY_OUTBOX_DIR, next.next));
|
|
15951
15992
|
process.stderr.write(
|
|
15952
15993
|
`teams-channel: recovery ${filename} \u2192 attempt ${next.attempt} (${err.message})
|
|
15953
15994
|
`
|
|
@@ -15973,7 +16014,7 @@ function startRecoveryOutboxWatcher() {
|
|
|
15973
16014
|
for (const f of entries) {
|
|
15974
16015
|
if (!f.endsWith(".json")) continue;
|
|
15975
16016
|
if (f.startsWith(".")) continue;
|
|
15976
|
-
const path =
|
|
16017
|
+
const path = join3(RECOVERY_OUTBOX_DIR, f);
|
|
15977
16018
|
let mtimeMs;
|
|
15978
16019
|
try {
|
|
15979
16020
|
mtimeMs = statSync(path).mtimeMs;
|
|
@@ -15998,7 +16039,7 @@ function startRecoveryOutboxWatcher() {
|
|
|
15998
16039
|
if (!name || typeof name !== "string") return;
|
|
15999
16040
|
if (!name.endsWith(".json")) return;
|
|
16000
16041
|
if (name.startsWith(".")) return;
|
|
16001
|
-
const path =
|
|
16042
|
+
const path = join3(RECOVERY_OUTBOX_DIR, name);
|
|
16002
16043
|
let mtimeMs;
|
|
16003
16044
|
try {
|
|
16004
16045
|
mtimeMs = statSync(path).mtimeMs;
|