@integrity-labs/agt-cli 0.28.1209 → 0.28.1211

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 (29) hide show
  1. package/dist/bin/agt.js +6 -6
  2. package/dist/{chunk-QPNZGRNJ.js → chunk-6YBTIPCB.js} +2 -2
  3. package/dist/{chunk-WSJULPTE.js → chunk-ALZS5XAJ.js} +5 -5
  4. package/dist/{chunk-BWIPB6CR.js → chunk-OFYHF2CU.js} +3 -3
  5. package/dist/{chunk-IXMHJ3GU.js → chunk-PL2SNTAN.js} +21 -4
  6. package/dist/chunk-PL2SNTAN.js.map +1 -0
  7. package/dist/{chunk-EV2TOTKT.js → chunk-POUQ6BY5.js} +2 -2
  8. package/dist/{claude-code-updater-5Z43CR4N.js → claude-code-updater-GCXW25K2.js} +3 -3
  9. package/dist/{claude-pair-runtime-EGFTJSNS.js → claude-pair-runtime-FZPM6JE6.js} +3 -3
  10. package/dist/lib/manager-worker.js +19 -19
  11. package/dist/mcp/direct-chat-channel.js +20 -3
  12. package/dist/mcp/index.js +20 -3
  13. package/dist/mcp/origami.js +20 -3
  14. package/dist/mcp/slack-channel.js +183 -3
  15. package/dist/mcp/telegram-channel.js +20 -3
  16. package/dist/{persistent-session-NEKCQLFH.js → persistent-session-65FCCLDW.js} +4 -4
  17. package/dist/{responsiveness-probe-4VILKGY6.js → responsiveness-probe-6CJCC736.js} +4 -4
  18. package/dist/{session-auth-dead-UZGQIMDK.js → session-auth-dead-FWNR2IOO.js} +3 -3
  19. package/package.json +1 -1
  20. package/dist/chunk-IXMHJ3GU.js.map +0 -1
  21. /package/dist/{chunk-QPNZGRNJ.js.map → chunk-6YBTIPCB.js.map} +0 -0
  22. /package/dist/{chunk-WSJULPTE.js.map → chunk-ALZS5XAJ.js.map} +0 -0
  23. /package/dist/{chunk-BWIPB6CR.js.map → chunk-OFYHF2CU.js.map} +0 -0
  24. /package/dist/{chunk-EV2TOTKT.js.map → chunk-POUQ6BY5.js.map} +0 -0
  25. /package/dist/{claude-code-updater-5Z43CR4N.js.map → claude-code-updater-GCXW25K2.js.map} +0 -0
  26. /package/dist/{claude-pair-runtime-EGFTJSNS.js.map → claude-pair-runtime-FZPM6JE6.js.map} +0 -0
  27. /package/dist/{persistent-session-NEKCQLFH.js.map → persistent-session-65FCCLDW.js.map} +0 -0
  28. /package/dist/{responsiveness-probe-4VILKGY6.js.map → responsiveness-probe-6CJCC736.js.map} +0 -0
  29. /package/dist/{session-auth-dead-UZGQIMDK.js.map → session-auth-dead-FWNR2IOO.js.map} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-XWVM4KPK.js";
5
5
  import {
6
6
  FORCED_UPDATE_HARD_DEADLINE_MS
7
- } from "./chunk-IXMHJ3GU.js";
7
+ } from "./chunk-PL2SNTAN.js";
8
8
  import {
9
9
  effectiveClaudeJsonPath
10
10
  } from "./chunk-AIUIMEUS.js";
@@ -722,4 +722,4 @@ export {
722
722
  probeClaudeInstalls,
723
723
  maybeUpdateClaudeCode
724
724
  };
725
- //# sourceMappingURL=chunk-EV2TOTKT.js.map
725
+ //# sourceMappingURL=chunk-POUQ6BY5.js.map
@@ -13,9 +13,9 @@ import {
13
13
  probeClaudeInstalls,
14
14
  readsAsNativeInstall,
15
15
  shouldRunClaudeCodeUpdater
16
- } from "./chunk-EV2TOTKT.js";
16
+ } from "./chunk-POUQ6BY5.js";
17
17
  import "./chunk-XWVM4KPK.js";
18
- import "./chunk-IXMHJ3GU.js";
18
+ import "./chunk-PL2SNTAN.js";
19
19
  import "./chunk-AIUIMEUS.js";
20
20
  import "./chunk-DGUM43GV.js";
21
21
  export {
@@ -34,4 +34,4 @@ export {
34
34
  readsAsNativeInstall,
35
35
  shouldRunClaudeCodeUpdater
36
36
  };
37
- //# sourceMappingURL=claude-code-updater-5Z43CR4N.js.map
37
+ //# sourceMappingURL=claude-code-updater-GCXW25K2.js.map
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  redactPaneFrame,
10
10
  sanitizeTerminalFrame
11
- } from "./chunk-IXMHJ3GU.js";
11
+ } from "./chunk-PL2SNTAN.js";
12
12
  import {
13
13
  CLAUDE_CONFIG_DIR_ENV,
14
14
  claudeConfigDirFor,
@@ -321,7 +321,7 @@ async function spawnPairSession(session) {
321
321
  return { ok: true };
322
322
  } catch {
323
323
  }
324
- const { resolveClaudeBinary } = await import("./persistent-session-NEKCQLFH.js");
324
+ const { resolveClaudeBinary } = await import("./persistent-session-65FCCLDW.js");
325
325
  const claudeBin = resolveClaudeBinary();
326
326
  const pairEnv = {
327
327
  ...process.env,
@@ -836,4 +836,4 @@ export {
836
836
  startClaudePair,
837
837
  submitClaudePairCode
838
838
  };
839
- //# sourceMappingURL=claude-pair-runtime-EGFTJSNS.js.map
839
+ //# sourceMappingURL=claude-pair-runtime-FZPM6JE6.js.map
@@ -85,7 +85,7 @@ import {
85
85
  tripClass,
86
86
  writeEtcEnvironment,
87
87
  writeProfileDScript
88
- } from "../chunk-WSJULPTE.js";
88
+ } from "../chunk-ALZS5XAJ.js";
89
89
  import {
90
90
  CLAUDE_CODE_SECURITY_FLOOR,
91
91
  SELF_UPDATE_TIMEOUTS,
@@ -99,7 +99,7 @@ import {
99
99
  runSafeCleanup,
100
100
  tightestDiskStat,
101
101
  withPackageCacheLock
102
- } from "../chunk-EV2TOTKT.js";
102
+ } from "../chunk-POUQ6BY5.js";
103
103
  import {
104
104
  rewriteSupervisorApiKey,
105
105
  supervisorChannelsRefusing
@@ -192,7 +192,7 @@ import {
192
192
  webFetchBaselineValue,
193
193
  webFetchRestartNeeded,
194
194
  writeEgressAllowlist
195
- } from "../chunk-BWIPB6CR.js";
195
+ } from "../chunk-OFYHF2CU.js";
196
196
  import {
197
197
  isAgentIdle,
198
198
  isStaleForToday,
@@ -202,7 +202,7 @@ import {
202
202
  sessionTranscriptDir,
203
203
  subagentActivityAgeSeconds,
204
204
  transcriptActivityAgeSeconds
205
- } from "../chunk-QPNZGRNJ.js";
205
+ } from "../chunk-6YBTIPCB.js";
206
206
  import {
207
207
  classifyUnanswerablePane,
208
208
  focusedConfirmDialogBlock,
@@ -330,7 +330,7 @@ import {
330
330
  stabiliseResetInstant,
331
331
  sumTranscriptUsageInWindow,
332
332
  summarizeTranscriptActivity
333
- } from "../chunk-IXMHJ3GU.js";
333
+ } from "../chunk-PL2SNTAN.js";
334
334
  import {
335
335
  CLAUDE_CONFIG_DIR_ENV,
336
336
  claudeConfigDirFor,
@@ -15650,7 +15650,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
15650
15650
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
15651
15651
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
15652
15652
  async function channelInboundActivityAgeSecondsFor(codeName) {
15653
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-4VILKGY6.js");
15653
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-6CJCC736.js");
15654
15654
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
15655
15655
  if (newest === null) return null;
15656
15656
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -16447,7 +16447,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
16447
16447
  var lastVersionCheckAt = 0;
16448
16448
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
16449
16449
  var lastResponsivenessProbeAt = 0;
16450
- var agtCliVersion = true ? "0.28.1209" : "dev";
16450
+ var agtCliVersion = true ? "0.28.1211" : "dev";
16451
16451
  function resolveBrewPath(execFileSync3) {
16452
16452
  try {
16453
16453
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -18351,7 +18351,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
18351
18351
  if (codeNames.length === 0) return;
18352
18352
  void (async () => {
18353
18353
  try {
18354
- const { collectDiagnostics } = await import("../persistent-session-NEKCQLFH.js");
18354
+ const { collectDiagnostics } = await import("../persistent-session-65FCCLDW.js");
18355
18355
  await api.post("/host/heartbeat", {
18356
18356
  host_id: hostId,
18357
18357
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -18494,7 +18494,7 @@ async function pollCycleInner() {
18494
18494
  }
18495
18495
  try {
18496
18496
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
18497
- const { collectDiagnostics } = await import("../persistent-session-NEKCQLFH.js");
18497
+ const { collectDiagnostics } = await import("../persistent-session-65FCCLDW.js");
18498
18498
  const diagCodeNames = [...agentState.persistentSessionAgents];
18499
18499
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor) : void 0;
18500
18500
  let tailscaleHostname;
@@ -18752,7 +18752,7 @@ async function pollCycleInner() {
18752
18752
  }
18753
18753
  try {
18754
18754
  const desiredClaudeCodeVersion = hbResp?.desired_claude_code_version?.trim();
18755
- const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-5Z43CR4N.js");
18755
+ const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-GCXW25K2.js");
18756
18756
  const securityFloor = currentSecurityFloor();
18757
18757
  claudeUpdaterInFlight = true;
18758
18758
  if (desiredClaudeCodeVersion && (claudePairLoop.busy || claudePairingInProgress())) {
@@ -18787,7 +18787,7 @@ async function pollCycleInner() {
18787
18787
  collectPanelessActivityProbes,
18788
18788
  getResponsivenessIntervalMs,
18789
18789
  occupancyQualificationClassifications
18790
- } = await import("../responsiveness-probe-4VILKGY6.js");
18790
+ } = await import("../responsiveness-probe-6CJCC736.js");
18791
18791
  const probeIntervalMs = getResponsivenessIntervalMs();
18792
18792
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
18793
18793
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -18904,7 +18904,7 @@ async function pollCycleInner() {
18904
18904
  collectResponsivenessProbes,
18905
18905
  livePendingInboundOldestAgeSeconds,
18906
18906
  parkPendingInbound
18907
- } = await import("../responsiveness-probe-4VILKGY6.js");
18907
+ } = await import("../responsiveness-probe-6CJCC736.js");
18908
18908
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-M6AFZWNU.js");
18909
18909
  const wedgeNow = /* @__PURE__ */ new Date();
18910
18910
  const liveAgents = agentState.persistentSessionAgents;
@@ -19190,7 +19190,7 @@ async function pollCycleInner() {
19190
19190
  }
19191
19191
  }
19192
19192
  );
19193
- const { parkPendingInbound } = await import("../responsiveness-probe-4VILKGY6.js");
19193
+ const { parkPendingInbound } = await import("../responsiveness-probe-6CJCC736.js");
19194
19194
  const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
19195
19195
  paneFatalStreak.delete(codeName);
19196
19196
  paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
@@ -19221,7 +19221,7 @@ async function pollCycleInner() {
19221
19221
  TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
19222
19222
  bindSourceEscalations
19223
19223
  } = await import("../transcript-mount-health-OHE6IVJV.js");
19224
- const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-NEKCQLFH.js");
19224
+ const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-65FCCLDW.js");
19225
19225
  const mountConfig = resolveTranscriptMountConfig();
19226
19226
  const liveAgents = agentState.persistentSessionAgents;
19227
19227
  for (const tracked of [
@@ -19386,7 +19386,7 @@ async function pollCycleInner() {
19386
19386
  }
19387
19387
  try {
19388
19388
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
19389
- const { probeSessionAuth } = await import("../session-auth-dead-UZGQIMDK.js");
19389
+ const { probeSessionAuth } = await import("../session-auth-dead-FWNR2IOO.js");
19390
19390
  const observations = [];
19391
19391
  const pendingCacheCommits = [];
19392
19392
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -24116,7 +24116,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
24116
24116
  try {
24117
24117
  const freshId = rotateSessionForWedge(codeName);
24118
24118
  consecutiveWedgeCycles.delete(codeName);
24119
- const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-4VILKGY6.js");
24119
+ const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-6CJCC736.js");
24120
24120
  const { parked, deadLettered } = parkForRestart(codeName, /* @__PURE__ */ new Date());
24121
24121
  const parkNote = parked > 0 ? `, ${parked} inbound parked` : "";
24122
24122
  const deadNote = deadLettered > 0 ? `, ${deadLettered} undeliverable dead-lettered` : "";
@@ -24159,7 +24159,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
24159
24159
  void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
24160
24160
  void (async () => {
24161
24161
  try {
24162
- const { collectDiagnostics } = await import("../persistent-session-NEKCQLFH.js");
24162
+ const { collectDiagnostics } = await import("../persistent-session-65FCCLDW.js");
24163
24163
  await api.post("/host/heartbeat", {
24164
24164
  host_id: hostId,
24165
24165
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -24210,7 +24210,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
24210
24210
  }
24211
24211
  try {
24212
24212
  const hostId = await getHostId();
24213
- const { collectDiagnostics } = await import("../persistent-session-NEKCQLFH.js");
24213
+ const { collectDiagnostics } = await import("../persistent-session-65FCCLDW.js");
24214
24214
  await api.post("/host/heartbeat", {
24215
24215
  host_id: hostId,
24216
24216
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -24912,7 +24912,7 @@ async function processClaudePairSessions(agents) {
24912
24912
  snapshotPairConfig,
24913
24913
  // ENG-11659: result -> report body + the manager.log line that records it.
24914
24914
  planPairStartReport
24915
- } = await import("../claude-pair-runtime-EGFTJSNS.js");
24915
+ } = await import("../claude-pair-runtime-FZPM6JE6.js");
24916
24916
  const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
24917
24917
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
24918
24918
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
@@ -41950,7 +41950,7 @@ var INTEGRATION_REGISTRY = [
41950
41950
  id: "ninjafy-notes",
41951
41951
  name: "Ninja Notes",
41952
41952
  category: "workspace-productivity",
41953
- description: "Meeting notes captured on your Mac and sent to an agent. Ninja Notes records and transcribes a meeting on-device \u2014 the audio never leaves your machine \u2014 then hands the transcript to the agents you choose, which read it with your organization's context and write their own summary. Notes are private by default; sending one to an agent is the only thing that grants access.",
41953
+ description: "Meeting notes captured on your Mac or Windows PC and sent to an agent. Ninja Notes records and transcribes a meeting, then hands the transcript to the agents you choose, which read it with your organization's context and write their own summary. On macOS 26 and later it transcribes on the device unless you turn on cloud transcription. On Windows and earlier macOS, cloud transcription is the only option, so recording needs it: your organization must have opted into Grok Voice, cloud transcription must be available to it, and you must allow it in the app. Notes are private by default; sending one to an agent is the only thing that grants access.",
41954
41954
  supported_auth_types: ["none"],
41955
41955
  capabilities: [
41956
41956
  {
@@ -41992,7 +41992,7 @@ var INTEGRATION_REGISTRY = [
41992
41992
  // here rather than read from the rate card, which is a real drift
41993
41993
  // hazard — so it is held by a test that reprices both from the migration
41994
41994
  // and fails if they disagree, rather than by anyone remembering.
41995
- description: "Let an agent advise on a meeting while it is happening. Audio is transcribed on the Mac as usual; short passages are then checked by Ninjafy to decide when the agent should speak up, and the agent sees those moments in real time. Off until you turn it on. Billed per minute the advisor is armed \u2014 about $0.90 for a half-hour advised meeting (A$1.50 in Australian dollars); a meeting you record without arming the advisor costs nothing.",
41995
+ description: "Let an agent advise on a meeting while it is happening, in the Mac app for now. Audio is transcribed as usual; short passages are then checked by Ninjafy to decide when the agent should speak up, and the agent sees those moments in real time. Off until you turn it on. Billed per minute the advisor is armed \u2014 about $0.90 for a half-hour advised meeting (A$1.50 in Australian dollars); a meeting you record without arming the advisor carries no extra charge for advising. Cloud transcription, where used, is billed separately.",
41996
41996
  access: "write",
41997
41997
  requires_org_opt_in: true
41998
41998
  }
@@ -42029,7 +42029,7 @@ var INTEGRATION_REGISTRY = [
42029
42029
  // independently, so an hour-long meeting on default settings spends two
42030
42030
  // audio-hours (ADR-0063 §2a). The Mac's own caption carries the fuller
42031
42031
  // explanation, at the point where the person choosing it can read it.
42032
- note: "Notes are included in your plan. Transcription runs on your own Mac by default and no platform summariser runs, so nothing is metered per note \u2014 the agent turn that reads it is billed as agent-hours like any other. Two capabilities are turned on separately and billed when they are: live meeting advising, per minute the advisor is armed; and cloud transcription, per hour of audio."
42032
+ note: "Notes are included in your plan. On macOS 26 and later, transcription runs on your own Mac by default; on Windows and earlier macOS it always uses cloud transcription. No platform summariser runs, so nothing is metered per note \u2014 the agent turn that reads it is billed as agent-hours like any other. Two capabilities are turned on separately and billed when they are: live meeting advising, per minute the advisor is armed; and cloud transcription, per hour of audio."
42033
42033
  }
42034
42034
  },
42035
42035
  {
@@ -44818,6 +44818,23 @@ var FLAG_REGISTRY = [
44818
44818
  // change (ADR-0022 sensitive-flag confirm).
44819
44819
  sensitive: true
44820
44820
  },
44821
+ {
44822
+ key: "ghost-reply-narration-guard",
44823
+ 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.",
44824
+ flagType: "enum",
44825
+ allowedValues: ["off", "shadow", "enforce"],
44826
+ // Ships in SHADOW: a free local log line, like every enum flag here, enforce is a
44827
+ // deliberate flip. Read the match log before flipping: a false match usually costs
44828
+ // a re-ask, but one repeated on every re-delivery loses the reply.
44829
+ defaultValue: "shadow",
44830
+ envVar: "AGT_GHOST_REPLY_NARRATION_GUARD_MODE",
44831
+ sensitive: true,
44832
+ // DELIBERATE UNREACHABLE PLACEHOLDER, not a real threshold. The reader is host-side
44833
+ // (the channel MCP), so a host on an older agt-cli ignores this flag. Replace it with
44834
+ // the first published agt-cli carrying the reader before flipping to enforce. Same
44835
+ // convention as `github-broker-credentials`.
44836
+ since: "0.29.0"
44837
+ },
44821
44838
  {
44822
44839
  key: "slack-scheduled-channel-guard",
44823
44840
  description: 'Guard on slack.reply that refuses to let an active scheduled-task destination silently move a reply to a DIFFERENT channel than the agent named (ENG-8137). CS-1505 gave an explicit inbound_id priority over the task destination but left the no-inbound_id case treating "no inbound reference" as "no destination specified" - and `channel` is a REQUIRED argument, so every call names one. The symptom: a question asked in one channel answered in another, and a reply meant as a DM landing in a public channel. Fires only when the marker carries an EXPLICIT target, the named channel differs from it, and neither an inbound_id, an enforce binding, nor an ENG-7542 channel correction is available to arbitrate. off = never runs (today behaviour: silent retarget). shadow = count + log the would-block but STILL route as today, so the false-positive rate is measurable before anyone refuses a send. enforce = block the reply and tell the agent to retry. Read live from the heartbeat flags-cache (or the env override). NOTE: enforce is currently CLAMPED to shadow host-side and setting it here will not take effect - it stays blocked until ENG-8142 teaches the Stop hook to tell a refused reply from a delivered one, because until then a blocked send fails silently (no recovery, no re-prompt, nothing in the channel). Lifting the clamp is a code change, not a flag flip.',
package/dist/mcp/index.js CHANGED
@@ -28046,7 +28046,7 @@ var INTEGRATION_REGISTRY = [
28046
28046
  id: "ninjafy-notes",
28047
28047
  name: "Ninja Notes",
28048
28048
  category: "workspace-productivity",
28049
- description: "Meeting notes captured on your Mac and sent to an agent. Ninja Notes records and transcribes a meeting on-device \u2014 the audio never leaves your machine \u2014 then hands the transcript to the agents you choose, which read it with your organization's context and write their own summary. Notes are private by default; sending one to an agent is the only thing that grants access.",
28049
+ description: "Meeting notes captured on your Mac or Windows PC and sent to an agent. Ninja Notes records and transcribes a meeting, then hands the transcript to the agents you choose, which read it with your organization's context and write their own summary. On macOS 26 and later it transcribes on the device unless you turn on cloud transcription. On Windows and earlier macOS, cloud transcription is the only option, so recording needs it: your organization must have opted into Grok Voice, cloud transcription must be available to it, and you must allow it in the app. Notes are private by default; sending one to an agent is the only thing that grants access.",
28050
28050
  supported_auth_types: ["none"],
28051
28051
  capabilities: [
28052
28052
  {
@@ -28088,7 +28088,7 @@ var INTEGRATION_REGISTRY = [
28088
28088
  // here rather than read from the rate card, which is a real drift
28089
28089
  // hazard — so it is held by a test that reprices both from the migration
28090
28090
  // and fails if they disagree, rather than by anyone remembering.
28091
- description: "Let an agent advise on a meeting while it is happening. Audio is transcribed on the Mac as usual; short passages are then checked by Ninjafy to decide when the agent should speak up, and the agent sees those moments in real time. Off until you turn it on. Billed per minute the advisor is armed \u2014 about $0.90 for a half-hour advised meeting (A$1.50 in Australian dollars); a meeting you record without arming the advisor costs nothing.",
28091
+ description: "Let an agent advise on a meeting while it is happening, in the Mac app for now. Audio is transcribed as usual; short passages are then checked by Ninjafy to decide when the agent should speak up, and the agent sees those moments in real time. Off until you turn it on. Billed per minute the advisor is armed \u2014 about $0.90 for a half-hour advised meeting (A$1.50 in Australian dollars); a meeting you record without arming the advisor carries no extra charge for advising. Cloud transcription, where used, is billed separately.",
28092
28092
  access: "write",
28093
28093
  requires_org_opt_in: true
28094
28094
  }
@@ -28125,7 +28125,7 @@ var INTEGRATION_REGISTRY = [
28125
28125
  // independently, so an hour-long meeting on default settings spends two
28126
28126
  // audio-hours (ADR-0063 §2a). The Mac's own caption carries the fuller
28127
28127
  // explanation, at the point where the person choosing it can read it.
28128
- note: "Notes are included in your plan. Transcription runs on your own Mac by default and no platform summariser runs, so nothing is metered per note \u2014 the agent turn that reads it is billed as agent-hours like any other. Two capabilities are turned on separately and billed when they are: live meeting advising, per minute the advisor is armed; and cloud transcription, per hour of audio."
28128
+ note: "Notes are included in your plan. On macOS 26 and later, transcription runs on your own Mac by default; on Windows and earlier macOS it always uses cloud transcription. No platform summariser runs, so nothing is metered per note \u2014 the agent turn that reads it is billed as agent-hours like any other. Two capabilities are turned on separately and billed when they are: live meeting advising, per minute the advisor is armed; and cloud transcription, per hour of audio."
28129
28129
  }
28130
28130
  },
28131
28131
  {
@@ -30484,6 +30484,23 @@ var FLAG_REGISTRY = [
30484
30484
  // change (ADR-0022 sensitive-flag confirm).
30485
30485
  sensitive: true
30486
30486
  },
30487
+ {
30488
+ key: "ghost-reply-narration-guard",
30489
+ 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.",
30490
+ flagType: "enum",
30491
+ allowedValues: ["off", "shadow", "enforce"],
30492
+ // Ships in SHADOW: a free local log line, like every enum flag here, enforce is a
30493
+ // deliberate flip. Read the match log before flipping: a false match usually costs
30494
+ // a re-ask, but one repeated on every re-delivery loses the reply.
30495
+ defaultValue: "shadow",
30496
+ envVar: "AGT_GHOST_REPLY_NARRATION_GUARD_MODE",
30497
+ sensitive: true,
30498
+ // DELIBERATE UNREACHABLE PLACEHOLDER, not a real threshold. The reader is host-side
30499
+ // (the channel MCP), so a host on an older agt-cli ignores this flag. Replace it with
30500
+ // the first published agt-cli carrying the reader before flipping to enforce. Same
30501
+ // convention as `github-broker-credentials`.
30502
+ since: "0.29.0"
30503
+ },
30487
30504
  {
30488
30505
  key: "slack-scheduled-channel-guard",
30489
30506
  description: 'Guard on slack.reply that refuses to let an active scheduled-task destination silently move a reply to a DIFFERENT channel than the agent named (ENG-8137). CS-1505 gave an explicit inbound_id priority over the task destination but left the no-inbound_id case treating "no inbound reference" as "no destination specified" - and `channel` is a REQUIRED argument, so every call names one. The symptom: a question asked in one channel answered in another, and a reply meant as a DM landing in a public channel. Fires only when the marker carries an EXPLICIT target, the named channel differs from it, and neither an inbound_id, an enforce binding, nor an ENG-7542 channel correction is available to arbitrate. off = never runs (today behaviour: silent retarget). shadow = count + log the would-block but STILL route as today, so the false-positive rate is measurable before anyone refuses a send. enforce = block the reply and tell the agent to retry. Read live from the heartbeat flags-cache (or the env override). NOTE: enforce is currently CLAMPED to shadow host-side and setting it here will not take effect - it stays blocked until ENG-8142 teaches the Stop hook to tell a refused reply from a delivered one, because until then a blocked send fails silently (no recovery, no re-prompt, nothing in the channel). Lifting the clamp is a code change, not a flag flip.',
@@ -42107,7 +42107,7 @@ var INTEGRATION_REGISTRY = [
42107
42107
  id: "ninjafy-notes",
42108
42108
  name: "Ninja Notes",
42109
42109
  category: "workspace-productivity",
42110
- description: "Meeting notes captured on your Mac and sent to an agent. Ninja Notes records and transcribes a meeting on-device \u2014 the audio never leaves your machine \u2014 then hands the transcript to the agents you choose, which read it with your organization's context and write their own summary. Notes are private by default; sending one to an agent is the only thing that grants access.",
42110
+ description: "Meeting notes captured on your Mac or Windows PC and sent to an agent. Ninja Notes records and transcribes a meeting, then hands the transcript to the agents you choose, which read it with your organization's context and write their own summary. On macOS 26 and later it transcribes on the device unless you turn on cloud transcription. On Windows and earlier macOS, cloud transcription is the only option, so recording needs it: your organization must have opted into Grok Voice, cloud transcription must be available to it, and you must allow it in the app. Notes are private by default; sending one to an agent is the only thing that grants access.",
42111
42111
  supported_auth_types: ["none"],
42112
42112
  capabilities: [
42113
42113
  {
@@ -42149,7 +42149,7 @@ var INTEGRATION_REGISTRY = [
42149
42149
  // here rather than read from the rate card, which is a real drift
42150
42150
  // hazard — so it is held by a test that reprices both from the migration
42151
42151
  // and fails if they disagree, rather than by anyone remembering.
42152
- description: "Let an agent advise on a meeting while it is happening. Audio is transcribed on the Mac as usual; short passages are then checked by Ninjafy to decide when the agent should speak up, and the agent sees those moments in real time. Off until you turn it on. Billed per minute the advisor is armed \u2014 about $0.90 for a half-hour advised meeting (A$1.50 in Australian dollars); a meeting you record without arming the advisor costs nothing.",
42152
+ description: "Let an agent advise on a meeting while it is happening, in the Mac app for now. Audio is transcribed as usual; short passages are then checked by Ninjafy to decide when the agent should speak up, and the agent sees those moments in real time. Off until you turn it on. Billed per minute the advisor is armed \u2014 about $0.90 for a half-hour advised meeting (A$1.50 in Australian dollars); a meeting you record without arming the advisor carries no extra charge for advising. Cloud transcription, where used, is billed separately.",
42153
42153
  access: "write",
42154
42154
  requires_org_opt_in: true
42155
42155
  }
@@ -42186,7 +42186,7 @@ var INTEGRATION_REGISTRY = [
42186
42186
  // independently, so an hour-long meeting on default settings spends two
42187
42187
  // audio-hours (ADR-0063 §2a). The Mac's own caption carries the fuller
42188
42188
  // explanation, at the point where the person choosing it can read it.
42189
- note: "Notes are included in your plan. Transcription runs on your own Mac by default and no platform summariser runs, so nothing is metered per note \u2014 the agent turn that reads it is billed as agent-hours like any other. Two capabilities are turned on separately and billed when they are: live meeting advising, per minute the advisor is armed; and cloud transcription, per hour of audio."
42189
+ note: "Notes are included in your plan. On macOS 26 and later, transcription runs on your own Mac by default; on Windows and earlier macOS it always uses cloud transcription. No platform summariser runs, so nothing is metered per note \u2014 the agent turn that reads it is billed as agent-hours like any other. Two capabilities are turned on separately and billed when they are: live meeting advising, per minute the advisor is armed; and cloud transcription, per hour of audio."
42190
42190
  }
42191
42191
  },
42192
42192
  {
@@ -44324,6 +44324,23 @@ var FLAG_REGISTRY = [
44324
44324
  // change (ADR-0022 sensitive-flag confirm).
44325
44325
  sensitive: true
44326
44326
  },
44327
+ {
44328
+ key: "ghost-reply-narration-guard",
44329
+ 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.",
44330
+ flagType: "enum",
44331
+ allowedValues: ["off", "shadow", "enforce"],
44332
+ // Ships in SHADOW: a free local log line, like every enum flag here, enforce is a
44333
+ // deliberate flip. Read the match log before flipping: a false match usually costs
44334
+ // a re-ask, but one repeated on every re-delivery loses the reply.
44335
+ defaultValue: "shadow",
44336
+ envVar: "AGT_GHOST_REPLY_NARRATION_GUARD_MODE",
44337
+ sensitive: true,
44338
+ // DELIBERATE UNREACHABLE PLACEHOLDER, not a real threshold. The reader is host-side
44339
+ // (the channel MCP), so a host on an older agt-cli ignores this flag. Replace it with
44340
+ // the first published agt-cli carrying the reader before flipping to enforce. Same
44341
+ // convention as `github-broker-credentials`.
44342
+ since: "0.29.0"
44343
+ },
44327
44344
  {
44328
44345
  key: "slack-scheduled-channel-guard",
44329
44346
  description: 'Guard on slack.reply that refuses to let an active scheduled-task destination silently move a reply to a DIFFERENT channel than the agent named (ENG-8137). CS-1505 gave an explicit inbound_id priority over the task destination but left the no-inbound_id case treating "no inbound reference" as "no destination specified" - and `channel` is a REQUIRED argument, so every call names one. The symptom: a question asked in one channel answered in another, and a reply meant as a DM landing in a public channel. Fires only when the marker carries an EXPLICIT target, the named channel differs from it, and neither an inbound_id, an enforce binding, nor an ENG-7542 channel correction is available to arbitrate. off = never runs (today behaviour: silent retarget). shadow = count + log the would-block but STILL route as today, so the false-positive rate is measurable before anyone refuses a send. enforce = block the reply and tell the agent to retry. Read live from the heartbeat flags-cache (or the env override). NOTE: enforce is currently CLAMPED to shadow host-side and setting it here will not take effect - it stays blocked until ENG-8142 teaches the Stop hook to tell a refused reply from a delivered one, because until then a blocked send fails silently (no recovery, no re-prompt, nothing in the channel). Lifting the clamp is a code change, not a flag flip.',
@@ -30836,6 +30836,26 @@ function resolveGhostReplyMode(opts) {
30836
30836
  if (cached2 !== void 0) return cached2;
30837
30837
  return "off";
30838
30838
  }
30839
+ var GHOST_REPLY_NARRATION_GUARD_FLAG_KEY = "ghost-reply-narration-guard";
30840
+ function resolveGhostReplyNarrationGuardMode(opts) {
30841
+ const env2 = opts?.env ?? process.env;
30842
+ const parse3 = (raw) => {
30843
+ const v = typeof raw === "string" ? raw.trim().toLowerCase() : "";
30844
+ return v === "off" || v === "shadow" || v === "enforce" ? v : void 0;
30845
+ };
30846
+ const override = parse3(env2["AGT_GHOST_REPLY_NARRATION_GUARD_MODE"]);
30847
+ if (override) return override;
30848
+ try {
30849
+ const path = opts?.cachePath ?? defaultFlagsCachePath(env2);
30850
+ if (existsSync(path)) {
30851
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
30852
+ const cached2 = parse3(parsed?.flags?.[GHOST_REPLY_NARRATION_GUARD_FLAG_KEY]);
30853
+ if (cached2) return cached2;
30854
+ }
30855
+ } catch {
30856
+ }
30857
+ return "shadow";
30858
+ }
30839
30859
  var MAINTENANCE_FLAG_KEY = "platform-maintenance-mode";
30840
30860
  function parseMaintenanceMode(raw) {
30841
30861
  if (raw === void 0) return void 0;
@@ -36517,7 +36537,7 @@ var INTEGRATION_REGISTRY = [
36517
36537
  id: "ninjafy-notes",
36518
36538
  name: "Ninja Notes",
36519
36539
  category: "workspace-productivity",
36520
- description: "Meeting notes captured on your Mac and sent to an agent. Ninja Notes records and transcribes a meeting on-device \u2014 the audio never leaves your machine \u2014 then hands the transcript to the agents you choose, which read it with your organization's context and write their own summary. Notes are private by default; sending one to an agent is the only thing that grants access.",
36540
+ description: "Meeting notes captured on your Mac or Windows PC and sent to an agent. Ninja Notes records and transcribes a meeting, then hands the transcript to the agents you choose, which read it with your organization's context and write their own summary. On macOS 26 and later it transcribes on the device unless you turn on cloud transcription. On Windows and earlier macOS, cloud transcription is the only option, so recording needs it: your organization must have opted into Grok Voice, cloud transcription must be available to it, and you must allow it in the app. Notes are private by default; sending one to an agent is the only thing that grants access.",
36521
36541
  supported_auth_types: ["none"],
36522
36542
  capabilities: [
36523
36543
  {
@@ -36559,7 +36579,7 @@ var INTEGRATION_REGISTRY = [
36559
36579
  // here rather than read from the rate card, which is a real drift
36560
36580
  // hazard — so it is held by a test that reprices both from the migration
36561
36581
  // and fails if they disagree, rather than by anyone remembering.
36562
- description: "Let an agent advise on a meeting while it is happening. Audio is transcribed on the Mac as usual; short passages are then checked by Ninjafy to decide when the agent should speak up, and the agent sees those moments in real time. Off until you turn it on. Billed per minute the advisor is armed \u2014 about $0.90 for a half-hour advised meeting (A$1.50 in Australian dollars); a meeting you record without arming the advisor costs nothing.",
36582
+ description: "Let an agent advise on a meeting while it is happening, in the Mac app for now. Audio is transcribed as usual; short passages are then checked by Ninjafy to decide when the agent should speak up, and the agent sees those moments in real time. Off until you turn it on. Billed per minute the advisor is armed \u2014 about $0.90 for a half-hour advised meeting (A$1.50 in Australian dollars); a meeting you record without arming the advisor carries no extra charge for advising. Cloud transcription, where used, is billed separately.",
36563
36583
  access: "write",
36564
36584
  requires_org_opt_in: true
36565
36585
  }
@@ -36596,7 +36616,7 @@ var INTEGRATION_REGISTRY = [
36596
36616
  // independently, so an hour-long meeting on default settings spends two
36597
36617
  // audio-hours (ADR-0063 §2a). The Mac's own caption carries the fuller
36598
36618
  // explanation, at the point where the person choosing it can read it.
36599
- note: "Notes are included in your plan. Transcription runs on your own Mac by default and no platform summariser runs, so nothing is metered per note \u2014 the agent turn that reads it is billed as agent-hours like any other. Two capabilities are turned on separately and billed when they are: live meeting advising, per minute the advisor is armed; and cloud transcription, per hour of audio."
36619
+ note: "Notes are included in your plan. On macOS 26 and later, transcription runs on your own Mac by default; on Windows and earlier macOS it always uses cloud transcription. No platform summariser runs, so nothing is metered per note \u2014 the agent turn that reads it is billed as agent-hours like any other. Two capabilities are turned on separately and billed when they are: live meeting advising, per minute the advisor is armed; and cloud transcription, per hour of audio."
36600
36620
  }
36601
36621
  },
36602
36622
  {
@@ -39156,6 +39176,23 @@ var FLAG_REGISTRY = [
39156
39176
  // change (ADR-0022 sensitive-flag confirm).
39157
39177
  sensitive: true
39158
39178
  },
39179
+ {
39180
+ key: "ghost-reply-narration-guard",
39181
+ 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.",
39182
+ flagType: "enum",
39183
+ allowedValues: ["off", "shadow", "enforce"],
39184
+ // Ships in SHADOW: a free local log line, like every enum flag here, enforce is a
39185
+ // deliberate flip. Read the match log before flipping: a false match usually costs
39186
+ // a re-ask, but one repeated on every re-delivery loses the reply.
39187
+ defaultValue: "shadow",
39188
+ envVar: "AGT_GHOST_REPLY_NARRATION_GUARD_MODE",
39189
+ sensitive: true,
39190
+ // DELIBERATE UNREACHABLE PLACEHOLDER, not a real threshold. The reader is host-side
39191
+ // (the channel MCP), so a host on an older agt-cli ignores this flag. Replace it with
39192
+ // the first published agt-cli carrying the reader before flipping to enforce. Same
39193
+ // convention as `github-broker-credentials`.
39194
+ since: "0.29.0"
39195
+ },
39159
39196
  {
39160
39197
  key: "slack-scheduled-channel-guard",
39161
39198
  description: 'Guard on slack.reply that refuses to let an active scheduled-task destination silently move a reply to a DIFFERENT channel than the agent named (ENG-8137). CS-1505 gave an explicit inbound_id priority over the task destination but left the no-inbound_id case treating "no inbound reference" as "no destination specified" - and `channel` is a REQUIRED argument, so every call names one. The symptom: a question asked in one channel answered in another, and a reply meant as a DM landing in a public channel. Fires only when the marker carries an EXPLICIT target, the named channel differs from it, and neither an inbound_id, an enforce binding, nor an ENG-7542 channel correction is available to arbitrate. off = never runs (today behaviour: silent retarget). shadow = count + log the would-block but STILL route as today, so the false-positive rate is measurable before anyone refuses a send. enforce = block the reply and tell the agent to retry. Read live from the heartbeat flags-cache (or the env override). NOTE: enforce is currently CLAMPED to shadow host-side and setting it here will not take effect - it stays blocked until ENG-8142 teaches the Stop hook to tell a refused reply from a delivered one, because until then a blocked send fails silently (no recovery, no re-prompt, nothing in the channel). Lifting the clamp is a code change, not a flag flip.',
@@ -43513,6 +43550,73 @@ function shouldDeliverWithoutClassifying(text) {
43513
43550
  if (/<[@#][A-Z0-9]/.test(t)) return true;
43514
43551
  return false;
43515
43552
  }
43553
+ var STAND_DOWN_NARRATION = [
43554
+ /\bstanding by\b/i,
43555
+ /\bstaying (silent|quiet|out)\b/i,
43556
+ /\bstand(ing)? down\b/i,
43557
+ /\bnot (addressed to|for|directed at) me\b/i,
43558
+ /\bno (reply|response) (is )?(needed|required|owed)\b/i,
43559
+ /\bnot replying\b/i,
43560
+ /\breacted,? nothing else\b/i,
43561
+ /\bcard (is )?parked\b/i,
43562
+ /\bparked (in|on) (todo|waiting|backlog)\b/i
43563
+ ];
43564
+ function withoutAddress(text, name) {
43565
+ const escaped = name.replace(/[.*+?^\${}()|[\]\\]/g, "\\$&");
43566
+ return text.replace(
43567
+ new RegExp(`^\\s*(?:(?:hi|hey|hello|thanks|thank you|ok|okay|sure|yes|no),?\\s+)?${escaped}\\s*[,:!.\\-]`, "i"),
43568
+ ""
43569
+ ).replace(new RegExp(`(?:thanks|thank you|cheers),?\\s+${escaped}\\s*[.!]*\\s*$`, "i"), "").replace(new RegExp(`,\\s*${escaped}\\s*[.!]*\\s*$`, "i"), "");
43570
+ }
43571
+ function detectInternalNarration(text, addresseeName) {
43572
+ const t = String(text ?? "");
43573
+ if (!t.trim() || shouldDeliverWithoutClassifying(t)) return null;
43574
+ if (STAND_DOWN_NARRATION.some((re) => re.test(t))) return "stand_down";
43575
+ const raw = String(addresseeName ?? "").trim().split(/\s+/)[0] ?? "";
43576
+ const first = raw.charAt(0).toUpperCase() + raw.slice(1);
43577
+ if (first.length >= 3) {
43578
+ const escaped = first.replace(/[.*+?^\${}()|[\]\\]/g, "\\$&");
43579
+ if (new RegExp(`\\b${escaped}\\b`).test(withoutAddress(t, first))) {
43580
+ return "third_person_addressee";
43581
+ }
43582
+ }
43583
+ return null;
43584
+ }
43585
+ function summariseRecoveryMarkers(markers) {
43586
+ const owed = markers.filter((m) => !m.owesNoReply);
43587
+ const newest = (list) => [...list].sort((a, b) => Number(b.messageTs) - Number(a.messageTs))[0];
43588
+ if (owed.length === 0) {
43589
+ return {
43590
+ owesNoReply: true,
43591
+ hasPayload: markers.every((m) => m.hasPayload),
43592
+ replayCount: Math.max(...markers.map((m) => m.replayCount)),
43593
+ addresseeName: newest(markers)?.addresseeName
43594
+ };
43595
+ }
43596
+ return {
43597
+ owesNoReply: false,
43598
+ hasPayload: owed.every((m) => m.hasPayload),
43599
+ replayCount: Math.min(...owed.map((m) => m.replayCount)),
43600
+ maxReplayCount: Math.max(...owed.map((m) => m.replayCount)),
43601
+ addresseeName: newest(owed)?.addresseeName
43602
+ };
43603
+ }
43604
+ var UNREADABLE_RECOVERY_MARKER = {
43605
+ owesNoReply: false,
43606
+ hasPayload: false,
43607
+ replayCount: 0,
43608
+ messageTs: ""
43609
+ };
43610
+ function decideNarrationGuard(opts) {
43611
+ if (!opts.match || opts.mode !== "enforce") return "publish";
43612
+ if (!opts.marker) return "publish";
43613
+ if (opts.marker.owesNoReply) return "close";
43614
+ if (!opts.marker.hasPayload || !opts.replayEnabled) return "publish";
43615
+ const mostReplays = opts.marker.maxReplayCount ?? opts.marker.replayCount;
43616
+ if (opts.match === "third_person_addressee" && mostReplays >= opts.maxReplays) return "publish";
43617
+ if (opts.marker.replayCount < opts.maxReplays) return "redeliver";
43618
+ return opts.match === "stand_down" ? "close" : "publish";
43619
+ }
43516
43620
  async function decideRecovery(text, mode, env2 = process.env, classify = classifyRecoveredReply) {
43517
43621
  if (shouldDeliverWithoutClassifying(text)) {
43518
43622
  return { action: "deliver", mode, verdict: "pre-gate-deliver", wouldSuppress: false };
@@ -47741,6 +47845,42 @@ function readSlackThreadMarkerState(channel, threadTs) {
47741
47845
  humanOwed: markers.some((m) => m.ingress_only !== true)
47742
47846
  };
47743
47847
  }
47848
+ function readRecoveryMarkerState(channel, threadTs, markerName) {
47849
+ if (!SLACK_PENDING_INBOUND_DIR) return null;
47850
+ const markers = [];
47851
+ const collect = (fullPath) => {
47852
+ let raw;
47853
+ try {
47854
+ raw = readFileSync20(fullPath, "utf-8");
47855
+ } catch (err) {
47856
+ if (err.code !== "ENOENT") markers.push(UNREADABLE_RECOVERY_MARKER);
47857
+ return;
47858
+ }
47859
+ try {
47860
+ const m = JSON.parse(raw);
47861
+ markers.push({
47862
+ owesNoReply: markerOwesNoReply(m),
47863
+ hasPayload: Boolean(m.payload),
47864
+ replayCount: m.replay_count ?? 0,
47865
+ messageTs: m.message_ts ?? "",
47866
+ addresseeName: m.payload?.meta?.["user_name"]
47867
+ });
47868
+ } catch {
47869
+ markers.push(UNREADABLE_RECOVERY_MARKER);
47870
+ }
47871
+ };
47872
+ try {
47873
+ if (threadTs) {
47874
+ markSeenAllSlackPendingMarkersForThread(SLACK_PENDING_INBOUND_DIR, channel, threadTs, collect);
47875
+ } else if (markerName) {
47876
+ collect(join22(SLACK_PENDING_INBOUND_DIR, basename(markerName)));
47877
+ }
47878
+ } catch {
47879
+ return null;
47880
+ }
47881
+ if (markers.length === 0) return null;
47882
+ return summariseRecoveryMarkers(markers);
47883
+ }
47744
47884
  async function processSlackRecoveryOutboxFile(filename) {
47745
47885
  if (!SLACK_RECOVERY_OUTBOX_DIR) return;
47746
47886
  if (filename.endsWith(".poison.json") || filename.endsWith(".tmp")) return;
@@ -47804,6 +47944,46 @@ async function processSlackRecoveryOutboxFile(filename) {
47804
47944
  }
47805
47945
  return;
47806
47946
  }
47947
+ const narrationGuardMode = resolveGhostReplyNarrationGuardMode();
47948
+ if (narrationGuardMode !== "off") {
47949
+ const recoveryMarker = readRecoveryMarkerState(payload.channel, payload.thread_ts, payload.marker_name);
47950
+ const narration = detectInternalNarration(text, recoveryMarker?.addresseeName);
47951
+ const narrationAction = decideNarrationGuard({
47952
+ match: narration,
47953
+ mode: narrationGuardMode,
47954
+ marker: recoveryMarker,
47955
+ maxReplays: MAX_MARKER_REPLAYS,
47956
+ replayEnabled: channelReplayEnabled()
47957
+ });
47958
+ if (narration) {
47959
+ const enforceAction = decideNarrationGuard({
47960
+ match: narration,
47961
+ mode: "enforce",
47962
+ marker: recoveryMarker,
47963
+ maxReplays: MAX_MARKER_REPLAYS,
47964
+ replayEnabled: channelReplayEnabled()
47965
+ });
47966
+ process.stderr.write(
47967
+ `slack-channel(${AGENT_CODE_NAME}): ghost-reply narration match=${narration} mode=${narrationGuardMode} action=${narrationAction} enforce_action=${enforceAction} channel=${redactSlackId(payload.channel)} thread=${redactSlackId(payload.thread_ts)} text_len=${text.length}
47968
+ `
47969
+ );
47970
+ }
47971
+ if (narrationAction !== "publish") {
47972
+ if (narrationAction === "close" && payload.thread_ts) clearPendingMessage(payload.channel, payload.thread_ts);
47973
+ if (narrationAction === "close" && recoveryMarker && !recoveryMarker.owesNoReply) {
47974
+ process.stderr.write(
47975
+ `slack-channel(${AGENT_CODE_NAME}): ghost-reply narration lost_owed_reply=1 match=${narration} replays=${recoveryMarker.replayCount} channel=${redactSlackId(payload.channel)} thread=${redactSlackId(payload.thread_ts)} text_len=${text.length}
47976
+ `
47977
+ );
47978
+ }
47979
+ removeRecoveryLedgerEntry(SLACK_RECOVERY_LEDGER_DIR, payload.marker_name);
47980
+ try {
47981
+ unlinkSync7(fullPath);
47982
+ } catch {
47983
+ }
47984
+ return;
47985
+ }
47986
+ }
47807
47987
  const ghostReplyMode = resolveGhostReplyMode();
47808
47988
  if (ghostReplyMode !== "off") {
47809
47989
  const decision = await decideRecovery(text, ghostReplyMode);