@integrity-labs/agt-cli 0.28.1247 → 0.28.1249

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-ETLHVYWG.js → chunk-CMCT3LOQ.js} +26 -2
  3. package/dist/chunk-CMCT3LOQ.js.map +1 -0
  4. package/dist/{chunk-5RS4R43T.js → chunk-COCLODTH.js} +5 -5
  5. package/dist/{chunk-DXP7JXKR.js → chunk-G5CNX4XF.js} +3 -3
  6. package/dist/{chunk-W4HCSKZD.js → chunk-IQ6MCAEK.js} +2 -2
  7. package/dist/{chunk-JEIS2UOM.js → chunk-NNB7XNZA.js} +2 -2
  8. package/dist/{claude-code-updater-HCB6O4EB.js → claude-code-updater-EWJ6B5HX.js} +3 -3
  9. package/dist/{claude-pair-runtime-QRSPPPER.js → claude-pair-runtime-BJLV7HMD.js} +3 -3
  10. package/dist/lib/manager-worker.js +19 -19
  11. package/dist/mcp/direct-chat-channel.js +25 -1
  12. package/dist/mcp/index.js +25 -1
  13. package/dist/mcp/origami.js +25 -1
  14. package/dist/mcp/slack-channel.js +25 -1
  15. package/dist/mcp/telegram-channel.js +212 -2
  16. package/dist/{persistent-session-W7AXIJPR.js → persistent-session-ZTDFRERR.js} +4 -4
  17. package/dist/{responsiveness-probe-F6AUG6K2.js → responsiveness-probe-SVSMKLYS.js} +4 -4
  18. package/dist/{session-auth-dead-IW36EKQV.js → session-auth-dead-K63LMSKK.js} +3 -3
  19. package/package.json +1 -1
  20. package/dist/chunk-ETLHVYWG.js.map +0 -1
  21. /package/dist/{chunk-5RS4R43T.js.map → chunk-COCLODTH.js.map} +0 -0
  22. /package/dist/{chunk-DXP7JXKR.js.map → chunk-G5CNX4XF.js.map} +0 -0
  23. /package/dist/{chunk-W4HCSKZD.js.map → chunk-IQ6MCAEK.js.map} +0 -0
  24. /package/dist/{chunk-JEIS2UOM.js.map → chunk-NNB7XNZA.js.map} +0 -0
  25. /package/dist/{claude-code-updater-HCB6O4EB.js.map → claude-code-updater-EWJ6B5HX.js.map} +0 -0
  26. /package/dist/{claude-pair-runtime-QRSPPPER.js.map → claude-pair-runtime-BJLV7HMD.js.map} +0 -0
  27. /package/dist/{persistent-session-W7AXIJPR.js.map → persistent-session-ZTDFRERR.js.map} +0 -0
  28. /package/dist/{responsiveness-probe-F6AUG6K2.js.map → responsiveness-probe-SVSMKLYS.js.map} +0 -0
  29. /package/dist/{session-auth-dead-IW36EKQV.js.map → session-auth-dead-K63LMSKK.js.map} +0 -0
@@ -18,11 +18,11 @@ import {
18
18
  requiresRemoteMcpToolGate,
19
19
  shellQuote,
20
20
  withheldRemoteMcpMessage
21
- } from "./chunk-DXP7JXKR.js";
21
+ } from "./chunk-G5CNX4XF.js";
22
22
  import {
23
23
  readDailySessionPin,
24
24
  sessionTranscriptDir
25
- } from "./chunk-W4HCSKZD.js";
25
+ } from "./chunk-IQ6MCAEK.js";
26
26
  import {
27
27
  classifyUnanswerablePane,
28
28
  isConsumerTermsDialogVisible,
@@ -95,7 +95,7 @@ import {
95
95
  scanConfigForLiteralSecrets,
96
96
  worseConnectivityOutcome,
97
97
  wrapScheduledTaskPrompt
98
- } from "./chunk-ETLHVYWG.js";
98
+ } from "./chunk-CMCT3LOQ.js";
99
99
  import {
100
100
  claudeJsonPathFor,
101
101
  effectiveClaudeJsonPath,
@@ -8095,7 +8095,7 @@ function exchangeFailureKind(err) {
8095
8095
  }
8096
8096
 
8097
8097
  // src/lib/api-client.ts
8098
- var agtCliVersion = true ? "0.28.1247" : "dev";
8098
+ var agtCliVersion = true ? "0.28.1249" : "dev";
8099
8099
  var lastConfigHash = null;
8100
8100
  function setConfigHash(hash) {
8101
8101
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -13750,4 +13750,4 @@ export {
13750
13750
  managerInstallSystemUnitCommand,
13751
13751
  managerUninstallSystemUnitCommand
13752
13752
  };
13753
- //# sourceMappingURL=chunk-5RS4R43T.js.map
13753
+ //# sourceMappingURL=chunk-COCLODTH.js.map
@@ -4,7 +4,7 @@ import {
4
4
  rotateDailySession,
5
5
  sessionFileExists,
6
6
  todayLocalIso
7
- } from "./chunk-W4HCSKZD.js";
7
+ } from "./chunk-IQ6MCAEK.js";
8
8
  import {
9
9
  classifyUnanswerablePane,
10
10
  customApiKeyDialogKeys,
@@ -51,7 +51,7 @@ import {
51
51
  remoteMcpConnectionEnvInfix,
52
52
  remoteMcpConnectionLabel,
53
53
  remoteMcpConnectionScopedEnvVar
54
- } from "./chunk-ETLHVYWG.js";
54
+ } from "./chunk-CMCT3LOQ.js";
55
55
  import {
56
56
  CLAUDE_CONFIG_DIR_ENV,
57
57
  approveApiKeyInClaudeConfig,
@@ -6196,4 +6196,4 @@ export {
6196
6196
  stopAllSessionsAndWait,
6197
6197
  getProjectDir
6198
6198
  };
6199
- //# sourceMappingURL=chunk-DXP7JXKR.js.map
6199
+ //# sourceMappingURL=chunk-G5CNX4XF.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  encodeClaudeProjectPath
3
- } from "./chunk-ETLHVYWG.js";
3
+ } from "./chunk-CMCT3LOQ.js";
4
4
 
5
5
  // src/lib/daily-session.ts
6
6
  import { randomUUID } from "crypto";
@@ -244,4 +244,4 @@ export {
244
244
  peekPreviousSession,
245
245
  readDailySessionPin
246
246
  };
247
- //# sourceMappingURL=chunk-W4HCSKZD.js.map
247
+ //# sourceMappingURL=chunk-IQ6MCAEK.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-XWVM4KPK.js";
5
5
  import {
6
6
  FORCED_UPDATE_HARD_DEADLINE_MS
7
- } from "./chunk-ETLHVYWG.js";
7
+ } from "./chunk-CMCT3LOQ.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-JEIS2UOM.js.map
725
+ //# sourceMappingURL=chunk-NNB7XNZA.js.map
@@ -13,9 +13,9 @@ import {
13
13
  probeClaudeInstalls,
14
14
  readsAsNativeInstall,
15
15
  shouldRunClaudeCodeUpdater
16
- } from "./chunk-JEIS2UOM.js";
16
+ } from "./chunk-NNB7XNZA.js";
17
17
  import "./chunk-XWVM4KPK.js";
18
- import "./chunk-ETLHVYWG.js";
18
+ import "./chunk-CMCT3LOQ.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-HCB6O4EB.js.map
37
+ //# sourceMappingURL=claude-code-updater-EWJ6B5HX.js.map
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  redactPaneFrame,
10
10
  sanitizeTerminalFrame
11
- } from "./chunk-ETLHVYWG.js";
11
+ } from "./chunk-CMCT3LOQ.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-W7AXIJPR.js");
324
+ const { resolveClaudeBinary } = await import("./persistent-session-ZTDFRERR.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-QRSPPPER.js.map
839
+ //# sourceMappingURL=claude-pair-runtime-BJLV7HMD.js.map
@@ -85,7 +85,7 @@ import {
85
85
  tripClass,
86
86
  writeEtcEnvironment,
87
87
  writeProfileDScript
88
- } from "../chunk-5RS4R43T.js";
88
+ } from "../chunk-COCLODTH.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-JEIS2UOM.js";
102
+ } from "../chunk-NNB7XNZA.js";
103
103
  import {
104
104
  rewriteSupervisorApiKey,
105
105
  supervisorChannelsRefusing
@@ -195,7 +195,7 @@ import {
195
195
  webFetchBaselineValue,
196
196
  webFetchRestartNeeded,
197
197
  writeEgressAllowlist
198
- } from "../chunk-DXP7JXKR.js";
198
+ } from "../chunk-G5CNX4XF.js";
199
199
  import {
200
200
  isAgentIdle,
201
201
  isStaleForToday,
@@ -206,7 +206,7 @@ import {
206
206
  subagentActivityAgeSeconds,
207
207
  subagentTranscriptDir,
208
208
  transcriptActivityAgeSeconds
209
- } from "../chunk-W4HCSKZD.js";
209
+ } from "../chunk-IQ6MCAEK.js";
210
210
  import {
211
211
  classifyUnanswerablePane,
212
212
  focusedConfirmDialogBlock,
@@ -337,7 +337,7 @@ import {
337
337
  stabiliseResetInstant,
338
338
  sumTranscriptUsageInWindow,
339
339
  summarizeTranscriptActivity
340
- } from "../chunk-ETLHVYWG.js";
340
+ } from "../chunk-CMCT3LOQ.js";
341
341
  import {
342
342
  CLAUDE_CONFIG_DIR_ENV,
343
343
  claudeConfigDirFor,
@@ -15953,7 +15953,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
15953
15953
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
15954
15954
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
15955
15955
  async function channelInboundActivityAgeSecondsFor(codeName) {
15956
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-F6AUG6K2.js");
15956
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-SVSMKLYS.js");
15957
15957
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
15958
15958
  if (newest === null) return null;
15959
15959
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -16768,7 +16768,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
16768
16768
  var lastVersionCheckAt = 0;
16769
16769
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
16770
16770
  var lastResponsivenessProbeAt = 0;
16771
- var agtCliVersion = true ? "0.28.1247" : "dev";
16771
+ var agtCliVersion = true ? "0.28.1249" : "dev";
16772
16772
  function resolveBrewPath(execFileSync4) {
16773
16773
  try {
16774
16774
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -18766,7 +18766,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
18766
18766
  if (codeNames.length === 0) return;
18767
18767
  void (async () => {
18768
18768
  try {
18769
- const { collectDiagnostics } = await import("../persistent-session-W7AXIJPR.js");
18769
+ const { collectDiagnostics } = await import("../persistent-session-ZTDFRERR.js");
18770
18770
  await api.post("/host/heartbeat", {
18771
18771
  host_id: hostId,
18772
18772
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -18909,7 +18909,7 @@ async function pollCycleInner() {
18909
18909
  }
18910
18910
  try {
18911
18911
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
18912
- const { collectDiagnostics } = await import("../persistent-session-W7AXIJPR.js");
18912
+ const { collectDiagnostics } = await import("../persistent-session-ZTDFRERR.js");
18913
18913
  const diagCodeNames = [...agentState.persistentSessionAgents];
18914
18914
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor) : void 0;
18915
18915
  let tailscaleHostname;
@@ -19174,7 +19174,7 @@ async function pollCycleInner() {
19174
19174
  }
19175
19175
  try {
19176
19176
  const desiredClaudeCodeVersion = hbResp?.desired_claude_code_version?.trim();
19177
- const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-HCB6O4EB.js");
19177
+ const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-EWJ6B5HX.js");
19178
19178
  const securityFloor = currentSecurityFloor();
19179
19179
  claudeUpdaterInFlight = true;
19180
19180
  if (desiredClaudeCodeVersion && (claudePairLoop.busy || claudePairingInProgress())) {
@@ -19209,7 +19209,7 @@ async function pollCycleInner() {
19209
19209
  collectPanelessActivityProbes,
19210
19210
  getResponsivenessIntervalMs,
19211
19211
  occupancyQualificationClassifications
19212
- } = await import("../responsiveness-probe-F6AUG6K2.js");
19212
+ } = await import("../responsiveness-probe-SVSMKLYS.js");
19213
19213
  const probeIntervalMs = getResponsivenessIntervalMs();
19214
19214
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
19215
19215
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -19326,7 +19326,7 @@ async function pollCycleInner() {
19326
19326
  collectResponsivenessProbes,
19327
19327
  livePendingInboundOldestAgeSeconds,
19328
19328
  parkPendingInbound
19329
- } = await import("../responsiveness-probe-F6AUG6K2.js");
19329
+ } = await import("../responsiveness-probe-SVSMKLYS.js");
19330
19330
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-5PCBGRNY.js");
19331
19331
  const wedgeNow = /* @__PURE__ */ new Date();
19332
19332
  const liveAgents = agentState.persistentSessionAgents;
@@ -19612,7 +19612,7 @@ async function pollCycleInner() {
19612
19612
  }
19613
19613
  }
19614
19614
  );
19615
- const { parkPendingInbound } = await import("../responsiveness-probe-F6AUG6K2.js");
19615
+ const { parkPendingInbound } = await import("../responsiveness-probe-SVSMKLYS.js");
19616
19616
  const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
19617
19617
  paneFatalStreak.delete(codeName);
19618
19618
  paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
@@ -19643,7 +19643,7 @@ async function pollCycleInner() {
19643
19643
  TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
19644
19644
  bindSourceEscalations
19645
19645
  } = await import("../transcript-mount-health-OHE6IVJV.js");
19646
- const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-W7AXIJPR.js");
19646
+ const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-ZTDFRERR.js");
19647
19647
  const mountConfig = resolveTranscriptMountConfig();
19648
19648
  const liveAgents = agentState.persistentSessionAgents;
19649
19649
  for (const tracked of [
@@ -19808,7 +19808,7 @@ async function pollCycleInner() {
19808
19808
  }
19809
19809
  try {
19810
19810
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
19811
- const { probeSessionAuth } = await import("../session-auth-dead-IW36EKQV.js");
19811
+ const { probeSessionAuth } = await import("../session-auth-dead-K63LMSKK.js");
19812
19812
  const observations = [];
19813
19813
  const pendingCacheCommits = [];
19814
19814
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -24619,7 +24619,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
24619
24619
  if (!refreshData) return;
24620
24620
  const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
24621
24621
  const hostId = await getHostId();
24622
- const parkForRestart = await import("../responsiveness-probe-F6AUG6K2.js").then(
24622
+ const parkForRestart = await import("../responsiveness-probe-SVSMKLYS.js").then(
24623
24623
  (m) => m.parkPendingInbound,
24624
24624
  (err) => err
24625
24625
  );
@@ -24692,7 +24692,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
24692
24692
  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}`));
24693
24693
  void (async () => {
24694
24694
  try {
24695
- const { collectDiagnostics } = await import("../persistent-session-W7AXIJPR.js");
24695
+ const { collectDiagnostics } = await import("../persistent-session-ZTDFRERR.js");
24696
24696
  await api.post("/host/heartbeat", {
24697
24697
  host_id: hostId,
24698
24698
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -24743,7 +24743,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
24743
24743
  }
24744
24744
  try {
24745
24745
  const hostId = await getHostId();
24746
- const { collectDiagnostics } = await import("../persistent-session-W7AXIJPR.js");
24746
+ const { collectDiagnostics } = await import("../persistent-session-ZTDFRERR.js");
24747
24747
  await api.post("/host/heartbeat", {
24748
24748
  host_id: hostId,
24749
24749
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -25445,7 +25445,7 @@ async function processClaudePairSessions(agents) {
25445
25445
  snapshotPairConfig,
25446
25446
  // ENG-11659: result -> report body + the manager.log line that records it.
25447
25447
  planPairStartReport
25448
- } = await import("../claude-pair-runtime-QRSPPPER.js");
25448
+ } = await import("../claude-pair-runtime-BJLV7HMD.js");
25449
25449
  const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
25450
25450
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
25451
25451
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
@@ -39509,6 +39509,12 @@ function sniffImageType(bytes) {
39509
39509
  }
39510
39510
  return null;
39511
39511
  }
39512
+ var ENTITY_DOUBLE_QUOTE = "&(?:[qQ][uU][oO][tT]|#0*34|#[xX]0*22);";
39513
+ var ENTITY_SINGLE_QUOTE = "&(?:[aA][pP][oO][sS]|#0*39|#[xX]0*27);";
39514
+ var ENTITY_QUOTE_KINDS = [ENTITY_DOUBLE_QUOTE, ENTITY_SINGLE_QUOTE].map((src) => ({
39515
+ opens: new RegExp(`${src}$`),
39516
+ closes: new RegExp(src)
39517
+ }));
39512
39518
 
39513
39519
  // ../core/dist/integrations/augmented-live/publisher.js
39514
39520
  var PRESENTER_CHROME_SELECTORS = "#al-download, #al-vis, .al-launcher, .al-stats-btn, .al-edit-btn";
@@ -46465,6 +46471,24 @@ var FLAG_REGISTRY = [
46465
46471
  // everywhere it matters.
46466
46472
  envVar: "AUGMENTED_CONNECTIVITY_RECONCILE_STATUS"
46467
46473
  },
46474
+ {
46475
+ key: "direct-chat-malware-scan",
46476
+ // CodeRabbit on #7501: read stage-wide only (empty scope), so a scoped
46477
+ // override would look armed and do nothing. Turning it off disarms the
46478
+ // upload and download scan, so a change needs explicit confirmation.
46479
+ stageWideOnly: true,
46480
+ sensitive: true,
46481
+ description: "Gate Direct Chat uploads on the GuardDuty Malware Protection for S3 verdict (ENG-11967). When on, verifyDirectChatUploads waits for the GuardDutyMalwareScanStatus tag on each uploaded object and FAILS CLOSED: only NO_THREATS_FOUND is linked to a message; THREATS_FOUND is deleted (it marks every row sharing the object) and raises an upload_malware_detected alert; UNSUPPORTED, ACCESS_DENIED and FAILED are refused but KEPT, because the content-addressed object may back messages already delivered and two of those are our faults, not the file; no tag within the wait budget is refused and kept, so a re-send can pass once the scan lands. ARMING ALSO GATES EVERY DOWNLOAD: the browser mint and the agent poll serve an object only if its GuardDutyMalwareScanStatus tag is NO_THREATS_FOUND, so an attachment stored before the plan existed is refused until a one-off rescan (triggered on first access) tags it clean. In the browser it becomes downloadable once that lands; the agent poll delivers each attachment once, so one untagged at that poll is NEVER delivered to the agent (only a warn line records it). ARM ONLY AFTER the DirectChatUploadsMalwareProtection plan is deployed (GUARDDUTY_MALWARE_SCAN=true): with the flag on and no plan, no object is ever tagged and every upload is refused. ALSO CONFIRM FIRST, on the test stage, that the legacy rescan works: self-copy one untagged object and check it gains a GuardDutyMalwareScanStatus tag within a minute. If it does not, do NOT arm: every attachment stored before the plan stays refused while armed and the rescan cannot restore it. GLOBAL ONLY: evaluated with an empty context, so scoped overrides have no effect.",
46482
+ flagType: "boolean",
46483
+ // Off is the pre-ENG-11967 behaviour: no scan wait, no tag read.
46484
+ // UNLIKE most flags here, a flag-store READ ERROR counts as ON on the SEND
46485
+ // path (see malwareScanArmed in api lib/direct-chat-uploads.ts): the send
46486
+ // is the gate, and an outage must not silently stop scanning. The read
46487
+ // paths (agent poll, download mint) treat a read error as OFF, so a blip
46488
+ // cannot strip a claimed, single-shot message of its files (Obi Wan
46489
+ // edec921a519f); THREATS_FOUND rows stay hidden either way.
46490
+ defaultValue: false
46491
+ },
46468
46492
  {
46469
46493
  key: "platform-held-key-central-probe",
46470
46494
  description: "Arm the scheduled CENTRAL connectivity probe lane for platform-held-key integrations (ENG-10086). These store no customer credential (auth_type none), so the host cannot probe them and reports unverified forever. When on, the hourly PlatformHeldKeyProbe cron runs each central probe that exists (today only ninjafy-notes: org entitlement + broker routing, never note contents) and writes the result through the monitor observation path, so consecutive_connectivity_failures / _ok_cycles move and integration_down alerts can open and close on it. Definitions with no central probe are skipped, never written as a failure. When off the cron reads nothing and writes nothing. Boolean gate; ships dark because a new writer of the escalation counters is a paging change. GLOBAL ONLY: the cron and the host connectivity route both evaluate this flag with an empty context, so an org-, team- or agent-scoped override is stored but has NO effect. Arm it by its global value, not as a staged per-org rollout (Obi Wan 63053d02035e).",
@@ -47109,7 +47133,7 @@ var FLAG_REGISTRY = [
47109
47133
  },
47110
47134
  {
47111
47135
  key: "org-two-factor-enforcement",
47112
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware API-ONLY: host routes (hostAuthMiddleware) and the webapp (server components, /api handlers) are NOT covered until ENG-12023 lands, so DO NOT turn this on before then, whatever a customer asks for. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
47136
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
47113
47137
  flagType: "boolean",
47114
47138
  defaultValue: false,
47115
47139
  // Turning it on changes the admission rule for people on the platform's
package/dist/mcp/index.js CHANGED
@@ -25605,6 +25605,12 @@ var ASSET_TYPES = {
25605
25605
  // module header does not apply. Embedded as <audio src=...> in the page HTML.
25606
25606
  "audio/mpeg": { ext: "mp3", maxBytes: 20 * MB, enabled: true }
25607
25607
  };
25608
+ var ENTITY_DOUBLE_QUOTE = "&(?:[qQ][uU][oO][tT]|#0*34|#[xX]0*22);";
25609
+ var ENTITY_SINGLE_QUOTE = "&(?:[aA][pP][oO][sS]|#0*39|#[xX]0*27);";
25610
+ var ENTITY_QUOTE_KINDS = [ENTITY_DOUBLE_QUOTE, ENTITY_SINGLE_QUOTE].map((src) => ({
25611
+ opens: new RegExp(`${src}$`),
25612
+ closes: new RegExp(src)
25613
+ }));
25608
25614
 
25609
25615
  // ../core/dist/integrations/augmented-live/publisher.js
25610
25616
  var PRESENTER_CHROME_SELECTORS = "#al-download, #al-vis, .al-launcher, .al-stats-btn, .al-edit-btn";
@@ -32147,6 +32153,24 @@ var FLAG_REGISTRY = [
32147
32153
  // everywhere it matters.
32148
32154
  envVar: "AUGMENTED_CONNECTIVITY_RECONCILE_STATUS"
32149
32155
  },
32156
+ {
32157
+ key: "direct-chat-malware-scan",
32158
+ // CodeRabbit on #7501: read stage-wide only (empty scope), so a scoped
32159
+ // override would look armed and do nothing. Turning it off disarms the
32160
+ // upload and download scan, so a change needs explicit confirmation.
32161
+ stageWideOnly: true,
32162
+ sensitive: true,
32163
+ description: "Gate Direct Chat uploads on the GuardDuty Malware Protection for S3 verdict (ENG-11967). When on, verifyDirectChatUploads waits for the GuardDutyMalwareScanStatus tag on each uploaded object and FAILS CLOSED: only NO_THREATS_FOUND is linked to a message; THREATS_FOUND is deleted (it marks every row sharing the object) and raises an upload_malware_detected alert; UNSUPPORTED, ACCESS_DENIED and FAILED are refused but KEPT, because the content-addressed object may back messages already delivered and two of those are our faults, not the file; no tag within the wait budget is refused and kept, so a re-send can pass once the scan lands. ARMING ALSO GATES EVERY DOWNLOAD: the browser mint and the agent poll serve an object only if its GuardDutyMalwareScanStatus tag is NO_THREATS_FOUND, so an attachment stored before the plan existed is refused until a one-off rescan (triggered on first access) tags it clean. In the browser it becomes downloadable once that lands; the agent poll delivers each attachment once, so one untagged at that poll is NEVER delivered to the agent (only a warn line records it). ARM ONLY AFTER the DirectChatUploadsMalwareProtection plan is deployed (GUARDDUTY_MALWARE_SCAN=true): with the flag on and no plan, no object is ever tagged and every upload is refused. ALSO CONFIRM FIRST, on the test stage, that the legacy rescan works: self-copy one untagged object and check it gains a GuardDutyMalwareScanStatus tag within a minute. If it does not, do NOT arm: every attachment stored before the plan stays refused while armed and the rescan cannot restore it. GLOBAL ONLY: evaluated with an empty context, so scoped overrides have no effect.",
32164
+ flagType: "boolean",
32165
+ // Off is the pre-ENG-11967 behaviour: no scan wait, no tag read.
32166
+ // UNLIKE most flags here, a flag-store READ ERROR counts as ON on the SEND
32167
+ // path (see malwareScanArmed in api lib/direct-chat-uploads.ts): the send
32168
+ // is the gate, and an outage must not silently stop scanning. The read
32169
+ // paths (agent poll, download mint) treat a read error as OFF, so a blip
32170
+ // cannot strip a claimed, single-shot message of its files (Obi Wan
32171
+ // edec921a519f); THREATS_FOUND rows stay hidden either way.
32172
+ defaultValue: false
32173
+ },
32150
32174
  {
32151
32175
  key: "platform-held-key-central-probe",
32152
32176
  description: "Arm the scheduled CENTRAL connectivity probe lane for platform-held-key integrations (ENG-10086). These store no customer credential (auth_type none), so the host cannot probe them and reports unverified forever. When on, the hourly PlatformHeldKeyProbe cron runs each central probe that exists (today only ninjafy-notes: org entitlement + broker routing, never note contents) and writes the result through the monitor observation path, so consecutive_connectivity_failures / _ok_cycles move and integration_down alerts can open and close on it. Definitions with no central probe are skipped, never written as a failure. When off the cron reads nothing and writes nothing. Boolean gate; ships dark because a new writer of the escalation counters is a paging change. GLOBAL ONLY: the cron and the host connectivity route both evaluate this flag with an empty context, so an org-, team- or agent-scoped override is stored but has NO effect. Arm it by its global value, not as a staged per-org rollout (Obi Wan 63053d02035e).",
@@ -32791,7 +32815,7 @@ var FLAG_REGISTRY = [
32791
32815
  },
32792
32816
  {
32793
32817
  key: "org-two-factor-enforcement",
32794
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware API-ONLY: host routes (hostAuthMiddleware) and the webapp (server components, /api handlers) are NOT covered until ENG-12023 lands, so DO NOT turn this on before then, whatever a customer asks for. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
32818
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
32795
32819
  flagType: "boolean",
32796
32820
  defaultValue: false,
32797
32821
  // Turning it on changes the admission rule for people on the platform's
@@ -39666,6 +39666,12 @@ var ASSET_TYPES = {
39666
39666
  // module header does not apply. Embedded as <audio src=...> in the page HTML.
39667
39667
  "audio/mpeg": { ext: "mp3", maxBytes: 20 * MB, enabled: true }
39668
39668
  };
39669
+ var ENTITY_DOUBLE_QUOTE = "&(?:[qQ][uU][oO][tT]|#0*34|#[xX]0*22);";
39670
+ var ENTITY_SINGLE_QUOTE = "&(?:[aA][pP][oO][sS]|#0*39|#[xX]0*27);";
39671
+ var ENTITY_QUOTE_KINDS = [ENTITY_DOUBLE_QUOTE, ENTITY_SINGLE_QUOTE].map((src) => ({
39672
+ opens: new RegExp(`${src}$`),
39673
+ closes: new RegExp(src)
39674
+ }));
39669
39675
 
39670
39676
  // ../core/dist/integrations/augmented-live/publisher.js
39671
39677
  var PRESENTER_CHROME_SELECTORS = "#al-download, #al-vis, .al-launcher, .al-stats-btn, .al-edit-btn";
@@ -45949,6 +45955,24 @@ var FLAG_REGISTRY = [
45949
45955
  // everywhere it matters.
45950
45956
  envVar: "AUGMENTED_CONNECTIVITY_RECONCILE_STATUS"
45951
45957
  },
45958
+ {
45959
+ key: "direct-chat-malware-scan",
45960
+ // CodeRabbit on #7501: read stage-wide only (empty scope), so a scoped
45961
+ // override would look armed and do nothing. Turning it off disarms the
45962
+ // upload and download scan, so a change needs explicit confirmation.
45963
+ stageWideOnly: true,
45964
+ sensitive: true,
45965
+ description: "Gate Direct Chat uploads on the GuardDuty Malware Protection for S3 verdict (ENG-11967). When on, verifyDirectChatUploads waits for the GuardDutyMalwareScanStatus tag on each uploaded object and FAILS CLOSED: only NO_THREATS_FOUND is linked to a message; THREATS_FOUND is deleted (it marks every row sharing the object) and raises an upload_malware_detected alert; UNSUPPORTED, ACCESS_DENIED and FAILED are refused but KEPT, because the content-addressed object may back messages already delivered and two of those are our faults, not the file; no tag within the wait budget is refused and kept, so a re-send can pass once the scan lands. ARMING ALSO GATES EVERY DOWNLOAD: the browser mint and the agent poll serve an object only if its GuardDutyMalwareScanStatus tag is NO_THREATS_FOUND, so an attachment stored before the plan existed is refused until a one-off rescan (triggered on first access) tags it clean. In the browser it becomes downloadable once that lands; the agent poll delivers each attachment once, so one untagged at that poll is NEVER delivered to the agent (only a warn line records it). ARM ONLY AFTER the DirectChatUploadsMalwareProtection plan is deployed (GUARDDUTY_MALWARE_SCAN=true): with the flag on and no plan, no object is ever tagged and every upload is refused. ALSO CONFIRM FIRST, on the test stage, that the legacy rescan works: self-copy one untagged object and check it gains a GuardDutyMalwareScanStatus tag within a minute. If it does not, do NOT arm: every attachment stored before the plan stays refused while armed and the rescan cannot restore it. GLOBAL ONLY: evaluated with an empty context, so scoped overrides have no effect.",
45966
+ flagType: "boolean",
45967
+ // Off is the pre-ENG-11967 behaviour: no scan wait, no tag read.
45968
+ // UNLIKE most flags here, a flag-store READ ERROR counts as ON on the SEND
45969
+ // path (see malwareScanArmed in api lib/direct-chat-uploads.ts): the send
45970
+ // is the gate, and an outage must not silently stop scanning. The read
45971
+ // paths (agent poll, download mint) treat a read error as OFF, so a blip
45972
+ // cannot strip a claimed, single-shot message of its files (Obi Wan
45973
+ // edec921a519f); THREATS_FOUND rows stay hidden either way.
45974
+ defaultValue: false
45975
+ },
45952
45976
  {
45953
45977
  key: "platform-held-key-central-probe",
45954
45978
  description: "Arm the scheduled CENTRAL connectivity probe lane for platform-held-key integrations (ENG-10086). These store no customer credential (auth_type none), so the host cannot probe them and reports unverified forever. When on, the hourly PlatformHeldKeyProbe cron runs each central probe that exists (today only ninjafy-notes: org entitlement + broker routing, never note contents) and writes the result through the monitor observation path, so consecutive_connectivity_failures / _ok_cycles move and integration_down alerts can open and close on it. Definitions with no central probe are skipped, never written as a failure. When off the cron reads nothing and writes nothing. Boolean gate; ships dark because a new writer of the escalation counters is a paging change. GLOBAL ONLY: the cron and the host connectivity route both evaluate this flag with an empty context, so an org-, team- or agent-scoped override is stored but has NO effect. Arm it by its global value, not as a staged per-org rollout (Obi Wan 63053d02035e).",
@@ -46593,7 +46617,7 @@ var FLAG_REGISTRY = [
46593
46617
  },
46594
46618
  {
46595
46619
  key: "org-two-factor-enforcement",
46596
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware API-ONLY: host routes (hostAuthMiddleware) and the webapp (server components, /api handlers) are NOT covered until ENG-12023 lands, so DO NOT turn this on before then, whatever a customer asks for. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
46620
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
46597
46621
  flagType: "boolean",
46598
46622
  defaultValue: false,
46599
46623
  // Turning it on changes the admission rule for people on the platform's
@@ -34099,6 +34099,12 @@ var ASSET_TYPES = {
34099
34099
  // module header does not apply. Embedded as <audio src=...> in the page HTML.
34100
34100
  "audio/mpeg": { ext: "mp3", maxBytes: 20 * MB, enabled: true }
34101
34101
  };
34102
+ var ENTITY_DOUBLE_QUOTE = "&(?:[qQ][uU][oO][tT]|#0*34|#[xX]0*22);";
34103
+ var ENTITY_SINGLE_QUOTE = "&(?:[aA][pP][oO][sS]|#0*39|#[xX]0*27);";
34104
+ var ENTITY_QUOTE_KINDS = [ENTITY_DOUBLE_QUOTE, ENTITY_SINGLE_QUOTE].map((src) => ({
34105
+ opens: new RegExp(`${src}$`),
34106
+ closes: new RegExp(src)
34107
+ }));
34102
34108
 
34103
34109
  // ../core/dist/integrations/augmented-live/publisher.js
34104
34110
  var PRESENTER_CHROME_SELECTORS = "#al-download, #al-vis, .al-launcher, .al-stats-btn, .al-edit-btn";
@@ -40804,6 +40810,24 @@ var FLAG_REGISTRY = [
40804
40810
  // everywhere it matters.
40805
40811
  envVar: "AUGMENTED_CONNECTIVITY_RECONCILE_STATUS"
40806
40812
  },
40813
+ {
40814
+ key: "direct-chat-malware-scan",
40815
+ // CodeRabbit on #7501: read stage-wide only (empty scope), so a scoped
40816
+ // override would look armed and do nothing. Turning it off disarms the
40817
+ // upload and download scan, so a change needs explicit confirmation.
40818
+ stageWideOnly: true,
40819
+ sensitive: true,
40820
+ description: "Gate Direct Chat uploads on the GuardDuty Malware Protection for S3 verdict (ENG-11967). When on, verifyDirectChatUploads waits for the GuardDutyMalwareScanStatus tag on each uploaded object and FAILS CLOSED: only NO_THREATS_FOUND is linked to a message; THREATS_FOUND is deleted (it marks every row sharing the object) and raises an upload_malware_detected alert; UNSUPPORTED, ACCESS_DENIED and FAILED are refused but KEPT, because the content-addressed object may back messages already delivered and two of those are our faults, not the file; no tag within the wait budget is refused and kept, so a re-send can pass once the scan lands. ARMING ALSO GATES EVERY DOWNLOAD: the browser mint and the agent poll serve an object only if its GuardDutyMalwareScanStatus tag is NO_THREATS_FOUND, so an attachment stored before the plan existed is refused until a one-off rescan (triggered on first access) tags it clean. In the browser it becomes downloadable once that lands; the agent poll delivers each attachment once, so one untagged at that poll is NEVER delivered to the agent (only a warn line records it). ARM ONLY AFTER the DirectChatUploadsMalwareProtection plan is deployed (GUARDDUTY_MALWARE_SCAN=true): with the flag on and no plan, no object is ever tagged and every upload is refused. ALSO CONFIRM FIRST, on the test stage, that the legacy rescan works: self-copy one untagged object and check it gains a GuardDutyMalwareScanStatus tag within a minute. If it does not, do NOT arm: every attachment stored before the plan stays refused while armed and the rescan cannot restore it. GLOBAL ONLY: evaluated with an empty context, so scoped overrides have no effect.",
40821
+ flagType: "boolean",
40822
+ // Off is the pre-ENG-11967 behaviour: no scan wait, no tag read.
40823
+ // UNLIKE most flags here, a flag-store READ ERROR counts as ON on the SEND
40824
+ // path (see malwareScanArmed in api lib/direct-chat-uploads.ts): the send
40825
+ // is the gate, and an outage must not silently stop scanning. The read
40826
+ // paths (agent poll, download mint) treat a read error as OFF, so a blip
40827
+ // cannot strip a claimed, single-shot message of its files (Obi Wan
40828
+ // edec921a519f); THREATS_FOUND rows stay hidden either way.
40829
+ defaultValue: false
40830
+ },
40807
40831
  {
40808
40832
  key: "platform-held-key-central-probe",
40809
40833
  description: "Arm the scheduled CENTRAL connectivity probe lane for platform-held-key integrations (ENG-10086). These store no customer credential (auth_type none), so the host cannot probe them and reports unverified forever. When on, the hourly PlatformHeldKeyProbe cron runs each central probe that exists (today only ninjafy-notes: org entitlement + broker routing, never note contents) and writes the result through the monitor observation path, so consecutive_connectivity_failures / _ok_cycles move and integration_down alerts can open and close on it. Definitions with no central probe are skipped, never written as a failure. When off the cron reads nothing and writes nothing. Boolean gate; ships dark because a new writer of the escalation counters is a paging change. GLOBAL ONLY: the cron and the host connectivity route both evaluate this flag with an empty context, so an org-, team- or agent-scoped override is stored but has NO effect. Arm it by its global value, not as a staged per-org rollout (Obi Wan 63053d02035e).",
@@ -41448,7 +41472,7 @@ var FLAG_REGISTRY = [
41448
41472
  },
41449
41473
  {
41450
41474
  key: "org-two-factor-enforcement",
41451
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware API-ONLY: host routes (hostAuthMiddleware) and the webapp (server components, /api handlers) are NOT covered until ENG-12023 lands, so DO NOT turn this on before then, whatever a customer asks for. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
41475
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
41452
41476
  flagType: "boolean",
41453
41477
  defaultValue: false,
41454
41478
  // Turning it on changes the admission rule for people on the platform's