@integrity-labs/agt-cli 0.28.1261 → 0.28.1263

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.
Files changed (34) hide show
  1. package/dist/{api-client-2YLFNHFZ.js → api-client-SJR7V5JU.js} +3 -3
  2. package/dist/bin/agt.js +7 -7
  3. package/dist/{chunk-335HKIDZ.js → chunk-5BXIXSSH.js} +2 -2
  4. package/dist/{chunk-I2NQQOMD.js → chunk-CEJNJ6NF.js} +3 -3
  5. package/dist/{chunk-JYSPPCHG.js → chunk-HJWOXFJM.js} +2 -2
  6. package/dist/{chunk-6NHFZYUP.js → chunk-I4ZCWVZZ.js} +3 -3
  7. package/dist/{chunk-QFLR5EFT.js → chunk-KJ5OCCSJ.js} +2 -2
  8. package/dist/{chunk-QFLR5EFT.js.map → chunk-KJ5OCCSJ.js.map} +1 -1
  9. package/dist/{chunk-ZEJUBTXJ.js → chunk-M6EWNC4M.js} +89 -5
  10. package/dist/chunk-M6EWNC4M.js.map +1 -0
  11. package/dist/{claude-code-updater-B2BWPRFE.js → claude-code-updater-JQLNRK25.js} +3 -3
  12. package/dist/{claude-pair-runtime-FNDHAPXR.js → claude-pair-runtime-BJ3EAWEJ.js} +3 -3
  13. package/dist/lib/manager-worker.js +21 -21
  14. package/dist/mcp/direct-chat-channel.js +484 -309
  15. package/dist/mcp/index.js +1 -1
  16. package/dist/mcp/origami.js +1 -1
  17. package/dist/mcp/slack-channel.js +1 -1
  18. package/dist/mcp/teams-channel.js +218 -82
  19. package/dist/mcp/telegram-channel.js +159 -1
  20. package/dist/{persistent-session-LHQLLU4U.js → persistent-session-YNHYNCNA.js} +4 -4
  21. package/dist/{responsiveness-probe-KDSNPKUY.js → responsiveness-probe-57RV3U2H.js} +4 -4
  22. package/dist/{session-auth-dead-3IHR4M2B.js → session-auth-dead-A3TO2N63.js} +3 -3
  23. package/package.json +1 -1
  24. package/dist/chunk-ZEJUBTXJ.js.map +0 -1
  25. /package/dist/{api-client-2YLFNHFZ.js.map → api-client-SJR7V5JU.js.map} +0 -0
  26. /package/dist/{chunk-335HKIDZ.js.map → chunk-5BXIXSSH.js.map} +0 -0
  27. /package/dist/{chunk-I2NQQOMD.js.map → chunk-CEJNJ6NF.js.map} +0 -0
  28. /package/dist/{chunk-JYSPPCHG.js.map → chunk-HJWOXFJM.js.map} +0 -0
  29. /package/dist/{chunk-6NHFZYUP.js.map → chunk-I4ZCWVZZ.js.map} +0 -0
  30. /package/dist/{claude-code-updater-B2BWPRFE.js.map → claude-code-updater-JQLNRK25.js.map} +0 -0
  31. /package/dist/{claude-pair-runtime-FNDHAPXR.js.map → claude-pair-runtime-BJ3EAWEJ.js.map} +0 -0
  32. /package/dist/{persistent-session-LHQLLU4U.js.map → persistent-session-YNHYNCNA.js.map} +0 -0
  33. /package/dist/{responsiveness-probe-KDSNPKUY.js.map → responsiveness-probe-57RV3U2H.js.map} +0 -0
  34. /package/dist/{session-auth-dead-3IHR4M2B.js.map → session-auth-dead-A3TO2N63.js.map} +0 -0
@@ -31383,6 +31383,26 @@ function resolveGhostReplyMode(opts) {
31383
31383
  if (cached2 !== void 0) return cached2;
31384
31384
  return "off";
31385
31385
  }
31386
+ var GHOST_REPLY_NARRATION_GUARD_FLAG_KEY = "ghost-reply-narration-guard";
31387
+ function resolveGhostReplyNarrationGuardMode(opts) {
31388
+ const env2 = opts?.env ?? process.env;
31389
+ const parse3 = (raw) => {
31390
+ const v = typeof raw === "string" ? raw.trim().toLowerCase() : "";
31391
+ return v === "off" || v === "shadow" || v === "enforce" ? v : void 0;
31392
+ };
31393
+ const override = parse3(env2["AGT_GHOST_REPLY_NARRATION_GUARD_MODE"]);
31394
+ if (override) return override;
31395
+ try {
31396
+ const path = opts?.cachePath ?? defaultFlagsCachePath(env2);
31397
+ if (existsSync3(path)) {
31398
+ const parsed = JSON.parse(readFileSync4(path, "utf8"));
31399
+ const cached2 = parse3(parsed?.flags?.[GHOST_REPLY_NARRATION_GUARD_FLAG_KEY]);
31400
+ if (cached2) return cached2;
31401
+ }
31402
+ } catch {
31403
+ }
31404
+ return "shadow";
31405
+ }
31386
31406
  var MAINTENANCE_FLAG_KEY = "platform-maintenance-mode";
31387
31407
  function parseMaintenanceMode(raw) {
31388
31408
  if (raw === void 0) return void 0;
@@ -40062,7 +40082,7 @@ var FLAG_REGISTRY = [
40062
40082
  },
40063
40083
  {
40064
40084
  key: "ghost-reply-narration-guard",
40065
- description: "Model-free guard on the SLACK ghost-reply RECOVERY path (CS-1821, CS-1429, ENG-7780); Telegram and Teams recovery do not run it. Recovered end-of-turn text with no second person, question, link or mention, that uses stand-down wording or names the person being answered in the third person, is not published. enforce = keep the marker so the inbound is re-delivered and the agent can answer properly. When re-deliveries run out, stand-down wording closes unposted and a name-only match publishes; with no reply owed, either closes. shadow = log only. off = never runs. A false match usually costs a re-ask; a real reply using stand-down wording every time is lost.",
40085
+ description: "Model-free guard on the ghost-reply RECOVERY path of Slack, Telegram and Teams (CS-1821, CS-1429, ENG-7780, ENG-11890). Teams has no re-delivery, so there it only closes stand-down wording. Recovered end-of-turn text with no second person, question, link or mention, that uses stand-down wording or names the person being answered in the third person, is not published. enforce = keep the marker so the inbound is re-delivered and the agent can answer properly. When re-deliveries run out, stand-down wording closes unposted and a name-only match publishes; with no reply owed, either closes. shadow = log only. off = never runs. A false match usually costs a re-ask; a real reply using stand-down wording every time is lost.",
40066
40086
  flagType: "enum",
40067
40087
  allowedValues: ["off", "shadow", "enforce"],
40068
40088
  // Ships in SHADOW: a free local log line, like every enum flag here, enforce is a
@@ -44782,6 +44802,73 @@ function shouldDeliverWithoutClassifying(text) {
44782
44802
  if (/<[@#][A-Z0-9]/.test(t)) return true;
44783
44803
  return false;
44784
44804
  }
44805
+ var STAND_DOWN_NARRATION = [
44806
+ /\bstanding by\b/i,
44807
+ /\bstaying (silent|quiet|out)\b/i,
44808
+ /\bstand(ing)? down\b/i,
44809
+ /\bnot (addressed to|for|directed at) me\b/i,
44810
+ /\bno (reply|response) (is )?(needed|required|owed)\b/i,
44811
+ /\bnot replying\b/i,
44812
+ /\breacted,? nothing else\b/i,
44813
+ /\bcard (is )?parked\b/i,
44814
+ /\bparked (in|on) (todo|waiting|backlog)\b/i
44815
+ ];
44816
+ function withoutAddress(text, name) {
44817
+ const escaped = name.replace(/[.*+?^\${}()|[\]\\]/g, "\\$&");
44818
+ return text.replace(
44819
+ new RegExp(`^\\s*(?:(?:hi|hey|hello|thanks|thank you|ok|okay|sure|yes|no),?\\s+)?${escaped}\\s*[,:!.\\-]`, "i"),
44820
+ ""
44821
+ ).replace(new RegExp(`(?:thanks|thank you|cheers),?\\s+${escaped}\\s*[.!]*\\s*$`, "i"), "").replace(new RegExp(`,\\s*${escaped}\\s*[.!]*\\s*$`, "i"), "");
44822
+ }
44823
+ function detectInternalNarration(text, addresseeName) {
44824
+ const t = String(text ?? "");
44825
+ if (!t.trim() || shouldDeliverWithoutClassifying(t)) return null;
44826
+ if (STAND_DOWN_NARRATION.some((re) => re.test(t))) return "stand_down";
44827
+ const raw = String(addresseeName ?? "").trim().split(/\s+/)[0] ?? "";
44828
+ const first = raw.charAt(0).toUpperCase() + raw.slice(1);
44829
+ if (first.length >= 3) {
44830
+ const escaped = first.replace(/[.*+?^\${}()|[\]\\]/g, "\\$&");
44831
+ if (new RegExp(`\\b${escaped}\\b`).test(withoutAddress(t, first))) {
44832
+ return "third_person_addressee";
44833
+ }
44834
+ }
44835
+ return null;
44836
+ }
44837
+ function summariseRecoveryMarkers(markers) {
44838
+ const owed = markers.filter((m) => !m.owesNoReply);
44839
+ const newest = (list) => [...list].sort((a, b) => Number(b.messageTs) - Number(a.messageTs))[0];
44840
+ if (owed.length === 0) {
44841
+ return {
44842
+ owesNoReply: true,
44843
+ hasPayload: markers.every((m) => m.hasPayload),
44844
+ replayCount: Math.max(...markers.map((m) => m.replayCount)),
44845
+ addresseeName: newest(markers)?.addresseeName
44846
+ };
44847
+ }
44848
+ return {
44849
+ owesNoReply: false,
44850
+ hasPayload: owed.every((m) => m.hasPayload),
44851
+ replayCount: Math.min(...owed.map((m) => m.replayCount)),
44852
+ maxReplayCount: Math.max(...owed.map((m) => m.replayCount)),
44853
+ addresseeName: newest(owed)?.addresseeName
44854
+ };
44855
+ }
44856
+ var UNREADABLE_RECOVERY_MARKER = {
44857
+ owesNoReply: false,
44858
+ hasPayload: false,
44859
+ replayCount: 0,
44860
+ messageTs: ""
44861
+ };
44862
+ function decideNarrationGuard(opts) {
44863
+ if (!opts.match || opts.mode !== "enforce") return "publish";
44864
+ if (!opts.marker) return "publish";
44865
+ if (opts.marker.owesNoReply) return "close";
44866
+ if (!opts.marker.hasPayload || !opts.replayEnabled) return "publish";
44867
+ const mostReplays = opts.marker.maxReplayCount ?? opts.marker.replayCount;
44868
+ if (opts.match === "third_person_addressee" && mostReplays >= opts.maxReplays) return "publish";
44869
+ if (opts.marker.replayCount < opts.maxReplays) return "redeliver";
44870
+ return opts.match === "stand_down" ? "close" : "publish";
44871
+ }
44785
44872
  async function decideRecovery(text, mode, env2 = process.env, classify = classifyRecoveredReply) {
44786
44873
  if (shouldDeliverWithoutClassifying(text)) {
44787
44874
  return { action: "deliver", mode, verdict: "pre-gate-deliver", wouldSuppress: false };
@@ -47680,6 +47767,42 @@ function nextRetryName(filename) {
47680
47767
  }
47681
47768
  return { next: `${base}.retry-${attempt}.json`, attempt };
47682
47769
  }
47770
+ function readTelegramRecoveryMarkerState(markerName) {
47771
+ if (!PENDING_INBOUND_DIR || !markerName) return null;
47772
+ const chatPrefix = basename(markerName).split("__")[0];
47773
+ if (!chatPrefix) return null;
47774
+ let names;
47775
+ try {
47776
+ names = readdirSync6(PENDING_INBOUND_DIR).filter((f) => f.startsWith(`${chatPrefix}__`) && f.endsWith(".json"));
47777
+ } catch {
47778
+ return null;
47779
+ }
47780
+ const markers = [];
47781
+ for (const name of names) {
47782
+ let raw;
47783
+ try {
47784
+ raw = readFileSync16(join18(PENDING_INBOUND_DIR, name), "utf-8");
47785
+ } catch (err) {
47786
+ if (err.code !== "ENOENT") markers.push(UNREADABLE_RECOVERY_MARKER);
47787
+ continue;
47788
+ }
47789
+ try {
47790
+ const m = JSON.parse(raw);
47791
+ const msgPart = name.slice(chatPrefix.length + 2, -".json".length);
47792
+ markers.push({
47793
+ hasPayload: Boolean(m.payload),
47794
+ owesNoReply: false,
47795
+ replayCount: m.replay_count ?? 0,
47796
+ messageTs: String(m.message_id ?? msgPart),
47797
+ addresseeName: m.payload?.meta?.["user_name"]
47798
+ });
47799
+ } catch {
47800
+ markers.push(UNREADABLE_RECOVERY_MARKER);
47801
+ }
47802
+ }
47803
+ if (markers.length === 0) return null;
47804
+ return summariseRecoveryMarkers(markers);
47805
+ }
47683
47806
  async function processRecoveryOutboxFile(filename) {
47684
47807
  if (!RECOVERY_OUTBOX_DIR) return;
47685
47808
  if (filename.endsWith(".poison.json") || filename.endsWith(".tmp")) return;
@@ -47719,6 +47842,41 @@ async function processRecoveryOutboxFile(filename) {
47719
47842
  if (apiErr.rewritten) emitTransientApiErrorTelemetry("telegram", apiErr.match, apiErr.original);
47720
47843
  const text = apiErr.text;
47721
47844
  const recoveryDrainCutoffMs = Date.now();
47845
+ const narrationGuardMode = resolveGhostReplyNarrationGuardMode();
47846
+ if (narrationGuardMode !== "off") {
47847
+ const marker = readTelegramRecoveryMarkerState(payload.marker_name);
47848
+ const narration = detectInternalNarration(text, marker?.addresseeName);
47849
+ const decide = (mode) => decideNarrationGuard({
47850
+ match: narration,
47851
+ mode,
47852
+ marker,
47853
+ maxReplays: MAX_MARKER_REPLAYS,
47854
+ replayEnabled: channelReplayEnabled()
47855
+ });
47856
+ const narrationAction = decide(narrationGuardMode);
47857
+ if (narration) {
47858
+ process.stderr.write(
47859
+ `telegram-channel(${AGENT_CODE_NAME}): ghost-reply narration match=${narration} mode=${narrationGuardMode} action=${narrationAction} enforce_action=${decide("enforce")} chat=${redactId(payload.chat_id)} text_len=${text.length}
47860
+ `
47861
+ );
47862
+ }
47863
+ if (narrationAction !== "publish") {
47864
+ if (narrationAction === "close") {
47865
+ process.stderr.write(
47866
+ `telegram-channel(${AGENT_CODE_NAME}): ghost-reply narration lost_owed_reply=1 match=${narration} replays=${marker?.replayCount ?? 0} chat=${redactId(payload.chat_id)} text_len=${text.length}
47867
+ `
47868
+ );
47869
+ noteMarkerAnsweredByRecovery(payload.marker_name);
47870
+ clearPendingMessage(payload.chat_id, recoveryDrainCutoffMs);
47871
+ }
47872
+ removeRecoveryLedgerEntry(RECOVERY_LEDGER_DIR, payload.marker_name);
47873
+ try {
47874
+ unlinkSync9(fullPath);
47875
+ } catch {
47876
+ }
47877
+ return;
47878
+ }
47879
+ }
47722
47880
  const ghostReplyMode = resolveGhostReplyMode();
47723
47881
  if (ghostReplyMode !== "off") {
47724
47882
  const decision = await decideRecovery(text, ghostReplyMode);
@@ -68,12 +68,12 @@ import {
68
68
  writeDirectChatSessionState,
69
69
  writeEgressAllowlist,
70
70
  writePersistentClaudeWrapper
71
- } from "./chunk-I2NQQOMD.js";
72
- import "./chunk-JYSPPCHG.js";
71
+ } from "./chunk-CEJNJ6NF.js";
72
+ import "./chunk-HJWOXFJM.js";
73
73
  import "./chunk-HYQ7VOC3.js";
74
74
  import "./chunk-6HBXEJHO.js";
75
75
  import "./chunk-XWVM4KPK.js";
76
- import "./chunk-QFLR5EFT.js";
76
+ import "./chunk-KJ5OCCSJ.js";
77
77
  import "./chunk-AIUIMEUS.js";
78
78
  import "./chunk-DGUM43GV.js";
79
79
  export {
@@ -147,4 +147,4 @@ export {
147
147
  writeEgressAllowlist,
148
148
  writePersistentClaudeWrapper
149
149
  };
150
- //# sourceMappingURL=persistent-session-LHQLLU4U.js.map
150
+ //# sourceMappingURL=persistent-session-YNHYNCNA.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-I2NQQOMD.js";
4
- import "./chunk-JYSPPCHG.js";
3
+ } from "./chunk-CEJNJ6NF.js";
4
+ import "./chunk-HJWOXFJM.js";
5
5
  import "./chunk-HYQ7VOC3.js";
6
6
  import "./chunk-6HBXEJHO.js";
7
7
  import "./chunk-XWVM4KPK.js";
8
- import "./chunk-QFLR5EFT.js";
8
+ import "./chunk-KJ5OCCSJ.js";
9
9
  import "./chunk-AIUIMEUS.js";
10
10
  import "./chunk-DGUM43GV.js";
11
11
 
@@ -804,4 +804,4 @@ export {
804
804
  readAndResetSlackReplyBindingClassifications,
805
805
  readAndResetSlackReplyTargetClassifications
806
806
  };
807
- //# sourceMappingURL=responsiveness-probe-KDSNPKUY.js.map
807
+ //# sourceMappingURL=responsiveness-probe-57RV3U2H.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  sessionTranscriptDir
3
- } from "./chunk-JYSPPCHG.js";
4
- import "./chunk-QFLR5EFT.js";
3
+ } from "./chunk-HJWOXFJM.js";
4
+ import "./chunk-KJ5OCCSJ.js";
5
5
  import "./chunk-DGUM43GV.js";
6
6
 
7
7
  // src/lib/session-auth-dead.ts
@@ -205,4 +205,4 @@ export {
205
205
  decideSessionAuthState,
206
206
  probeSessionAuth
207
207
  };
208
- //# sourceMappingURL=session-auth-dead-3IHR4M2B.js.map
208
+ //# sourceMappingURL=session-auth-dead-A3TO2N63.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.1261",
3
+ "version": "0.28.1263",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {