@integrity-labs/agt-cli 0.28.483 → 0.28.485

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.
@@ -33430,18 +33430,27 @@ var INTEGRATION_REGISTRY = [
33430
33430
  id: "firecrawl",
33431
33431
  name: "Firecrawl",
33432
33432
  category: "knowledge",
33433
- description: "Web data for agents: scrape, map, crawl and search any website for clean structured data, plus scheduled change-detection monitors whose updates arrive in the agent's direct-chat. Augmented Team manages Firecrawl access for you - there is no key to enter.",
33433
+ description: "Web data for agents: scrape, map, crawl and search any website for clean structured data, plus scheduled change-detection monitors whose updates arrive in the agent's direct-chat. Connect via the platform-managed account, or bring your own Firecrawl API key.",
33434
33434
  // ENG-7217: Firecrawl migrates from a customer-API-key stdio MCP
33435
33435
  // (`npx firecrawl-mcp`, FIRECRAWL_API_KEY) to a PREMIUM, platform-managed
33436
33436
  // integration on the Deck / ElevenLabs model (ADR-0031, epic ENG-6920):
33437
33437
  // Augmented holds ONE Firecrawl account key (`FIRECRAWL_ACCOUNT_KEY`) that
33438
- // every customer agent's web-data calls bill back to, so the key is a single
33439
- // platform-held secret, NOT a per-agent credential. Auth type is therefore
33440
- // `none` - customers never enter a key. The agent-facing tools are brokered
33441
- // server-side (firecrawl-broker.ts, reusing the official @mendable/firecrawl-js
33442
- // SDK) rather than via the stdio MCP, so usage can be metered at the one
33443
- // control-plane chokepoint and gated on a per-org opt-in + monthly USD cap.
33444
- supported_auth_types: ["none"],
33438
+ // every customer agent's web-data calls bill back to. The agent-facing tools
33439
+ // are brokered server-side (firecrawl-broker.ts, reusing the official
33440
+ // @mendable/firecrawl-js SDK) rather than via the stdio MCP, so managed usage
33441
+ // is metered at the one control-plane chokepoint and gated on a per-org opt-in
33442
+ // + monthly USD cap.
33443
+ //
33444
+ // ENG-8304 / ADR-0055 (Phase 1b — Firecrawl is the BYO exemplar): `api_key` is
33445
+ // now also offered so a customer can bring their OWN Firecrawl key. A BYO
33446
+ // install (`credential_source='byo'`) authenticates with the customer's key
33447
+ // (stored encrypted on the install) and is NOT metered — its upstream cost is
33448
+ // on the customer's own Firecrawl bill. BYO is gated on the plan-tier
33449
+ // `byo_credentials` entitlement; managed stays the platform-key, billed path.
33450
+ // `api_key` is the BYO option; the connect UI offers it via the toolkit's
33451
+ // `auth_types` seed (Firecrawl surfaces through the premium list, not the
33452
+ // native `installable` picker — that descriptor is for non-premium natives).
33453
+ supported_auth_types: ["none", "api_key"],
33445
33454
  capabilities: [
33446
33455
  { id: "firecrawl:scrape", name: "Scrape Pages", description: "Fetch a single URL as clean markdown / structured data (firecrawl_scrape).", access: "write" },
33447
33456
  { id: "firecrawl:search", name: "Web Search", description: "Search the web and return ranked results, optionally scraped (firecrawl_search).", access: "write" },
@@ -36745,11 +36754,77 @@ function emitToolCallMarkupRedactionTelemetry(channel) {
36745
36754
  }
36746
36755
 
36747
36756
  // src/rate-limit-watch.ts
36748
- import { readFileSync as readFileSync5, readdirSync as readdirSync2, statSync } from "fs";
36757
+ import { closeSync, fstatSync, openSync, readSync, readdirSync as readdirSync2, statSync } from "fs";
36749
36758
  import { homedir as homedir4 } from "os";
36750
36759
  import { join as join6 } from "path";
36751
36760
  var DEFAULT_WATCH_MS = 5e3;
36752
36761
  var DEFAULT_POLL_MS = 400;
36762
+ var INITIAL_TAIL_BYTES = 256 * 1024;
36763
+ var TAIL_WIDEN_FACTOR = 8;
36764
+ var TAIL_SKEW_TOLERANCE_MS = 5 * 6e4;
36765
+ function readClassifiableTail(path, sinceMs, opts) {
36766
+ let want = Math.max(1, opts?.initialBytes ?? INITIAL_TAIL_BYTES);
36767
+ for (; ; ) {
36768
+ const slice = readTailSlice(path, want);
36769
+ if (slice === null) return "";
36770
+ if (slice.fromStart) return slice.text;
36771
+ const oldest = oldestTimestampMs(slice.text);
36772
+ if (oldest !== null && oldest < sinceMs - TAIL_SKEW_TOLERANCE_MS) return slice.text;
36773
+ want *= TAIL_WIDEN_FACTOR;
36774
+ }
36775
+ }
36776
+ function readTailSlice(path, bytes) {
36777
+ let fd;
36778
+ try {
36779
+ fd = openSync(path, "r");
36780
+ } catch {
36781
+ return null;
36782
+ }
36783
+ try {
36784
+ const size = fstatSync(fd).size;
36785
+ const start = size > bytes ? size - bytes : 0;
36786
+ const len = size - start;
36787
+ if (len <= 0) return { text: "", fromStart: true };
36788
+ const buf = Buffer.allocUnsafe(len);
36789
+ let read = 0;
36790
+ while (read < len) {
36791
+ const n = readSync(fd, buf, read, len - read, start + read);
36792
+ if (n <= 0) break;
36793
+ read += n;
36794
+ }
36795
+ if (read < len) return null;
36796
+ let text = buf.subarray(0, read).toString("utf-8");
36797
+ if (start > 0) {
36798
+ const nl = text.indexOf("\n");
36799
+ text = nl === -1 ? "" : text.slice(nl + 1);
36800
+ }
36801
+ return { text, fromStart: start === 0 };
36802
+ } catch {
36803
+ return null;
36804
+ } finally {
36805
+ closeSync(fd);
36806
+ }
36807
+ }
36808
+ function oldestTimestampMs(text) {
36809
+ let idx = 0;
36810
+ while (idx < text.length) {
36811
+ const nl = text.indexOf("\n", idx);
36812
+ const line = (nl === -1 ? text.slice(idx) : text.slice(idx, nl)).trim();
36813
+ if (line) {
36814
+ try {
36815
+ const ts = JSON.parse(line).timestamp;
36816
+ if (typeof ts === "string") {
36817
+ const ms = new Date(ts).getTime();
36818
+ if (Number.isFinite(ms)) return ms;
36819
+ }
36820
+ } catch {
36821
+ }
36822
+ }
36823
+ if (nl === -1) break;
36824
+ idx = nl + 1;
36825
+ }
36826
+ return null;
36827
+ }
36753
36828
  function agentTranscriptDir(opts) {
36754
36829
  const cwd = opts?.cwd ?? process.cwd();
36755
36830
  const home = opts?.home ?? homedir4();
@@ -36773,12 +36848,10 @@ function classifyTranscriptSince(opts) {
36773
36848
  } catch {
36774
36849
  continue;
36775
36850
  }
36776
- let content;
36777
- try {
36778
- content = readFileSync5(path, "utf-8");
36779
- } catch {
36780
- continue;
36781
- }
36851
+ const content = readClassifiableTail(path, opts.sinceMs, {
36852
+ ...opts.initialTailBytes != null ? { initialBytes: opts.initialTailBytes } : {}
36853
+ });
36854
+ if (!content) continue;
36782
36855
  newest = pickNewerClassification(
36783
36856
  newest,
36784
36857
  classifyTranscriptRateLimit(content, opts.sinceMs, opts.nowMs, new Date(opts.nowMs))
@@ -36814,7 +36887,7 @@ async function watchForRateLimitRefusal(opts) {
36814
36887
  }
36815
36888
 
36816
36889
  // src/turn-failure-watch.ts
36817
- import { readFileSync as readFileSync6, readdirSync as readdirSync3, statSync as statSync2 } from "fs";
36890
+ import { readdirSync as readdirSync3, statSync as statSync2 } from "fs";
36818
36891
  import { join as join7 } from "path";
36819
36892
  function turnFailureNoticeEnabled(env2) {
36820
36893
  return resolveHostBooleanFlag({
@@ -36858,12 +36931,8 @@ function classifyTurnFailureSince(opts) {
36858
36931
  if (cached2 && cached2.fingerprint === fingerprint) {
36859
36932
  scan = cached2.scan;
36860
36933
  } else {
36861
- let content;
36862
- try {
36863
- content = readFileSync6(path, "utf-8");
36864
- } catch {
36865
- continue;
36866
- }
36934
+ const content = readClassifiableTail(path, opts.sinceMs);
36935
+ if (!content) continue;
36867
36936
  const analysis = analyzeTranscriptTurnFailure(content, opts.sinceMs, opts.nowMs);
36868
36937
  scan = {
36869
36938
  result: analysis.result,
@@ -37614,7 +37683,7 @@ function applyHotThreadGuard(input) {
37614
37683
  }
37615
37684
 
37616
37685
  // src/slack-hot-thread-telemetry.ts
37617
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync3 } from "fs";
37686
+ import { readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
37618
37687
  import { join as join11 } from "path";
37619
37688
  var HOT_THREAD_CLASSIFICATION_COUNTER_SUFFIX = "-hot-thread-classifications.json";
37620
37689
  function hotThreadKey(mode, outcome, proactive) {
@@ -37625,7 +37694,7 @@ function recordHotThreadClassification(agentDir, channel, classification) {
37625
37694
  const path = join11(agentDir, `${channel}${HOT_THREAD_CLASSIFICATION_COUNTER_SUFFIX}`);
37626
37695
  let counts = {};
37627
37696
  try {
37628
- const parsed = JSON.parse(readFileSync7(path, "utf-8"));
37697
+ const parsed = JSON.parse(readFileSync5(path, "utf-8"));
37629
37698
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
37630
37699
  for (const [k, v] of Object.entries(parsed)) {
37631
37700
  if (typeof v === "number" && Number.isInteger(v) && v >= 0) counts[k] = v;
@@ -37642,7 +37711,7 @@ function recordHotThreadClassification(agentDir, channel, classification) {
37642
37711
  }
37643
37712
 
37644
37713
  // src/restart-confirm.ts
37645
- import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as readFileSync8, renameSync, unlinkSync as unlinkSync3, writeFileSync as writeFileSync4 } from "fs";
37714
+ import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as readFileSync6, renameSync, unlinkSync as unlinkSync3, writeFileSync as writeFileSync4 } from "fs";
37646
37715
  import { dirname } from "path";
37647
37716
  import { randomUUID } from "crypto";
37648
37717
  var RESTART_CONFIRM_MAX_AGE_MS = 10 * 60 * 1e3;
@@ -37668,7 +37737,7 @@ function writeRestartConfirmMarker(filePath, marker) {
37668
37737
  function readRestartConfirmMarker(filePath) {
37669
37738
  try {
37670
37739
  if (!existsSync6(filePath)) return null;
37671
- const parsed = JSON.parse(readFileSync8(filePath, "utf8"));
37740
+ const parsed = JSON.parse(readFileSync6(filePath, "utf8"));
37672
37741
  if (!parsed || typeof parsed !== "object") return null;
37673
37742
  return parsed;
37674
37743
  } catch {
@@ -37807,13 +37876,13 @@ var StdioServerTransport = class {
37807
37876
  // src/slack-channel.ts
37808
37877
  import {
37809
37878
  chmodSync,
37810
- closeSync,
37879
+ closeSync as closeSync2,
37811
37880
  createWriteStream,
37812
37881
  existsSync as existsSync10,
37813
37882
  ftruncateSync,
37814
37883
  mkdirSync as mkdirSync9,
37815
- openSync,
37816
- readFileSync as readFileSync20,
37884
+ openSync as openSync2,
37885
+ readFileSync as readFileSync18,
37817
37886
  readdirSync as readdirSync7,
37818
37887
  renameSync as renameSync5,
37819
37888
  statSync as statSync5,
@@ -37827,7 +37896,7 @@ import { homedir as homedir6 } from "os";
37827
37896
  import { createHash as createHash3, randomUUID as randomUUID2 } from "crypto";
37828
37897
 
37829
37898
  // src/slack-thread-store.ts
37830
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
37899
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
37831
37900
  import { dirname as dirname2 } from "path";
37832
37901
  function isParticipatingThread(entry) {
37833
37902
  if (!entry) return false;
@@ -37842,7 +37911,7 @@ function loadThreadStore(filePath, opts = {}) {
37842
37911
  const ttlMs = ttlDays * 24 * 60 * 60 * 1e3;
37843
37912
  let raw;
37844
37913
  try {
37845
- raw = readFileSync9(filePath, "utf-8");
37914
+ raw = readFileSync7(filePath, "utf-8");
37846
37915
  } catch {
37847
37916
  return { threads: /* @__PURE__ */ new Map(), pruned: 0 };
37848
37917
  }
@@ -37943,7 +38012,7 @@ function isThreadEntry(value) {
37943
38012
  }
37944
38013
 
37945
38014
  // src/dm-restart-notice.ts
37946
- import { mkdirSync as mkdirSync4, readFileSync as readFileSync10, unlinkSync as unlinkSync4, writeFileSync as writeFileSync6 } from "fs";
38015
+ import { mkdirSync as mkdirSync4, readFileSync as readFileSync8, unlinkSync as unlinkSync4, writeFileSync as writeFileSync6 } from "fs";
37947
38016
  import { dirname as dirname3 } from "path";
37948
38017
  var RECENT_DM_VERSION = 1;
37949
38018
  var DEFAULT_RECENT_DM_TTL_MS = 30 * 60 * 1e3;
@@ -37967,7 +38036,7 @@ function loadRecentDms(filePath, opts = {}) {
37967
38036
  const ttlMs = opts.ttlMs ?? DEFAULT_RECENT_DM_TTL_MS;
37968
38037
  let raw;
37969
38038
  try {
37970
- raw = readFileSync10(filePath, "utf-8");
38039
+ raw = readFileSync8(filePath, "utf-8");
37971
38040
  } catch (err) {
37972
38041
  const code = err.code;
37973
38042
  if (code !== "ENOENT") {
@@ -38052,7 +38121,7 @@ var CHANNEL_ADD_RESTART_MAX_AGE_MS = 15 * 60 * 1e3;
38052
38121
  function readChannelAddRestartMarker(filePath) {
38053
38122
  let raw;
38054
38123
  try {
38055
- raw = readFileSync10(filePath, "utf-8");
38124
+ raw = readFileSync8(filePath, "utf-8");
38056
38125
  } catch {
38057
38126
  return null;
38058
38127
  }
@@ -38110,7 +38179,7 @@ async function runOrRetry(fn, opts) {
38110
38179
  }
38111
38180
 
38112
38181
  // src/turn-initiator-marker.ts
38113
- import { writeFileSync as writeFileSync7, readFileSync as readFileSync11, mkdirSync as mkdirSync5, renameSync as renameSync2 } from "fs";
38182
+ import { writeFileSync as writeFileSync7, readFileSync as readFileSync9, mkdirSync as mkdirSync5, renameSync as renameSync2 } from "fs";
38114
38183
  import { dirname as dirname4, join as join12 } from "path";
38115
38184
  var TURN_INITIATOR_MAX_AGE_MS = 5 * 60 * 1e3;
38116
38185
  var TURN_INITIATOR_LEDGER_MAX_ENTRIES = 20;
@@ -38141,7 +38210,7 @@ function updateTurnInitiatorLedger(singleSlotFile, marker) {
38141
38210
  const ledgerFile = turnInitiatorLedgerPath(singleSlotFile);
38142
38211
  let existing = null;
38143
38212
  try {
38144
- const parsed = JSON.parse(readFileSync11(ledgerFile, "utf8"));
38213
+ const parsed = JSON.parse(readFileSync9(ledgerFile, "utf8"));
38145
38214
  if (parsed && parsed.v === 1 && Array.isArray(parsed.entries)) existing = parsed;
38146
38215
  } catch {
38147
38216
  }
@@ -38168,7 +38237,7 @@ function writeTurnInitiatorMarker(input) {
38168
38237
  }
38169
38238
 
38170
38239
  // src/slack-bot-photo.ts
38171
- import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync12, writeFileSync as writeFileSync8 } from "fs";
38240
+ import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "fs";
38172
38241
  import { dirname as dirname5 } from "path";
38173
38242
  async function applyBotPhoto(opts) {
38174
38243
  const fetchImpl = opts.fetchImpl ?? fetch;
@@ -38178,7 +38247,7 @@ async function applyBotPhoto(opts) {
38178
38247
  const { token, avatarUrl, markerPath } = opts;
38179
38248
  if (markerPath && existsSync7(markerPath)) {
38180
38249
  try {
38181
- if (readFileSync12(markerPath, "utf-8").trim() === avatarUrl) {
38250
+ if (readFileSync10(markerPath, "utf-8").trim() === avatarUrl) {
38182
38251
  return { status: "skipped-unchanged" };
38183
38252
  }
38184
38253
  } catch {
@@ -38303,7 +38372,7 @@ function conversationalLaneMeta(expectsReply = true) {
38303
38372
  }
38304
38373
 
38305
38374
  // src/inbound-lane-telemetry.ts
38306
- import { readFileSync as readFileSync13, writeFileSync as writeFileSync9 } from "fs";
38375
+ import { readFileSync as readFileSync11, writeFileSync as writeFileSync9 } from "fs";
38307
38376
  import { join as join13 } from "path";
38308
38377
  var LANE_CLASSIFICATION_COUNTER_SUFFIX = "-lane-classifications.json";
38309
38378
  var SUSPECTED_MISCLASSIFICATION_KEY = "suspected_misclassification";
@@ -38324,7 +38393,7 @@ function recordLaneClassification(agentDir, channel, classification) {
38324
38393
  const path = join13(agentDir, `${channel}${LANE_CLASSIFICATION_COUNTER_SUFFIX}`);
38325
38394
  let counts = {};
38326
38395
  try {
38327
- const parsed = JSON.parse(readFileSync13(path, "utf-8"));
38396
+ const parsed = JSON.parse(readFileSync11(path, "utf-8"));
38328
38397
  if (parsed && typeof parsed === "object") counts = parsed;
38329
38398
  } catch {
38330
38399
  }
@@ -38340,7 +38409,7 @@ function recordLaneClassification(agentDir, channel, classification) {
38340
38409
  }
38341
38410
 
38342
38411
  // src/slack-inbound-registry.ts
38343
- import { readdirSync as readdirSync5, readFileSync as readFileSync14 } from "fs";
38412
+ import { readdirSync as readdirSync5, readFileSync as readFileSync12 } from "fs";
38344
38413
  import { join as join14 } from "path";
38345
38414
  var DEFAULT_MAX_ENTRIES = 500;
38346
38415
  var DEFAULT_CLEARED_TTL_MS = 6 * 60 * 60 * 1e3;
@@ -38462,7 +38531,7 @@ function createInboundRegistry(opts = {}) {
38462
38531
  if (name.includes(".retry-") || name.includes(".poison")) continue;
38463
38532
  let marker;
38464
38533
  try {
38465
- marker = JSON.parse(readFileSync14(join14(dir, name), "utf-8"));
38534
+ marker = JSON.parse(readFileSync12(join14(dir, name), "utf-8"));
38466
38535
  } catch {
38467
38536
  continue;
38468
38537
  }
@@ -38507,7 +38576,7 @@ function slackInboundId(channel, threadTs, messageTs) {
38507
38576
  }
38508
38577
 
38509
38578
  // src/inbound-delivery-ledger.ts
38510
- import { existsSync as existsSync8, mkdirSync as mkdirSync7, readdirSync as readdirSync6, readFileSync as readFileSync15, renameSync as renameSync3, writeFileSync as writeFileSync10 } from "fs";
38579
+ import { existsSync as existsSync8, mkdirSync as mkdirSync7, readdirSync as readdirSync6, readFileSync as readFileSync13, renameSync as renameSync3, writeFileSync as writeFileSync10 } from "fs";
38511
38580
  import { join as join15 } from "path";
38512
38581
  function safeInboundId(inboundId) {
38513
38582
  return inboundId.replace(/[^A-Za-z0-9_-]/g, "_");
@@ -38517,7 +38586,7 @@ var defaultDeps = {
38517
38586
  writeFile: (path, data) => writeFileSync10(path, data, "utf8"),
38518
38587
  rename: (from, to) => renameSync3(from, to),
38519
38588
  readdir: (dir) => readdirSync6(dir),
38520
- readFile: (path) => readFileSync15(path, "utf8"),
38589
+ readFile: (path) => readFileSync13(path, "utf8"),
38521
38590
  exists: (path) => existsSync8(path)
38522
38591
  };
38523
38592
  function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
@@ -38707,7 +38776,7 @@ function describeSendOutcome(dest) {
38707
38776
  }
38708
38777
 
38709
38778
  // src/slack-reply-binding-telemetry.ts
38710
- import { readFileSync as readFileSync16, writeFileSync as writeFileSync11 } from "fs";
38779
+ import { readFileSync as readFileSync14, writeFileSync as writeFileSync11 } from "fs";
38711
38780
  import { join as join16 } from "path";
38712
38781
  var REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX = "-reply-binding-classifications.json";
38713
38782
  var UNKNOWN_INBOUND_ID_KEY = "unknown_inbound_id";
@@ -38726,7 +38795,7 @@ function recordReplyBindingClassification(agentDir, channel, input) {
38726
38795
  const path = join16(agentDir, `${channel}${REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX}`);
38727
38796
  let counts = {};
38728
38797
  try {
38729
- const parsed = JSON.parse(readFileSync16(path, "utf-8"));
38798
+ const parsed = JSON.parse(readFileSync14(path, "utf-8"));
38730
38799
  if (parsed && typeof parsed === "object") counts = parsed;
38731
38800
  } catch {
38732
38801
  }
@@ -38744,7 +38813,7 @@ function recordScheduledChannelOverride(agentDir, channel, input) {
38744
38813
  const path = join16(agentDir, `${channel}${REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX}`);
38745
38814
  let counts = {};
38746
38815
  try {
38747
- const parsed = JSON.parse(readFileSync16(path, "utf-8"));
38816
+ const parsed = JSON.parse(readFileSync14(path, "utf-8"));
38748
38817
  if (parsed && typeof parsed === "object") counts = parsed;
38749
38818
  } catch {
38750
38819
  }
@@ -38760,7 +38829,7 @@ function recordChannelMistarget(agentDir, channel, input) {
38760
38829
  const path = join16(agentDir, `${channel}${REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX}`);
38761
38830
  let counts = {};
38762
38831
  try {
38763
- const parsed = JSON.parse(readFileSync16(path, "utf-8"));
38832
+ const parsed = JSON.parse(readFileSync14(path, "utf-8"));
38764
38833
  if (parsed && typeof parsed === "object") counts = parsed;
38765
38834
  } catch {
38766
38835
  }
@@ -38775,7 +38844,7 @@ function recordChannelMistarget(agentDir, channel, input) {
38775
38844
  }
38776
38845
 
38777
38846
  // src/slack-reply-target-telemetry.ts
38778
- import { readFileSync as readFileSync17, writeFileSync as writeFileSync12 } from "fs";
38847
+ import { readFileSync as readFileSync15, writeFileSync as writeFileSync12 } from "fs";
38779
38848
  import { join as join17 } from "path";
38780
38849
  var REPLY_TARGET_CLASSIFICATION_COUNTER_SUFFIX = "-reply-target-classifications.json";
38781
38850
  function pendingThreadsBucket(n) {
@@ -38812,7 +38881,7 @@ function recordReplyTargetClassification(agentDir, channel, classification) {
38812
38881
  const path = join17(agentDir, `${channel}${REPLY_TARGET_CLASSIFICATION_COUNTER_SUFFIX}`);
38813
38882
  let counts = {};
38814
38883
  try {
38815
- const parsed = JSON.parse(readFileSync17(path, "utf-8"));
38884
+ const parsed = JSON.parse(readFileSync15(path, "utf-8"));
38816
38885
  if (parsed && typeof parsed === "object") counts = parsed;
38817
38886
  } catch {
38818
38887
  }
@@ -38828,7 +38897,7 @@ function recordReplyTargetClassification(agentDir, channel, classification) {
38828
38897
  }
38829
38898
 
38830
38899
  // src/scheduled-turn-marker.ts
38831
- import { readFileSync as readFileSync18, unlinkSync as unlinkSync5 } from "fs";
38900
+ import { readFileSync as readFileSync16, unlinkSync as unlinkSync5 } from "fs";
38832
38901
  import { join as join18 } from "path";
38833
38902
  var SCHEDULED_TURN_MARKER_FILENAME2 = ".current-scheduled-turn.json";
38834
38903
  var SCHEDULED_TURN_MAX_AGE_MS = 15 * 60 * 1e3;
@@ -38867,7 +38936,7 @@ function readScheduledTurnMarker(agentDir, now = Date.now()) {
38867
38936
  if (!agentDir) return null;
38868
38937
  try {
38869
38938
  const raw = JSON.parse(
38870
- readFileSync18(join18(agentDir, SCHEDULED_TURN_MARKER_FILENAME2), "utf8")
38939
+ readFileSync16(join18(agentDir, SCHEDULED_TURN_MARKER_FILENAME2), "utf8")
38871
38940
  );
38872
38941
  return validateScheduledTurnMarker(raw, now);
38873
38942
  } catch {
@@ -39679,7 +39748,7 @@ async function actuateHostRestart(opts) {
39679
39748
  import {
39680
39749
  existsSync as existsSync9,
39681
39750
  mkdirSync as mkdirSync8,
39682
- readFileSync as readFileSync19,
39751
+ readFileSync as readFileSync17,
39683
39752
  renameSync as renameSync4,
39684
39753
  statSync as statSync4,
39685
39754
  unlinkSync as unlinkSync6,
@@ -39776,7 +39845,7 @@ function defaultLockMtimeMs(path) {
39776
39845
  function readLockHolder(path) {
39777
39846
  if (!existsSync9(path)) return null;
39778
39847
  try {
39779
- const raw = readFileSync19(path, "utf8");
39848
+ const raw = readFileSync17(path, "utf8");
39780
39849
  const parsed = JSON.parse(raw);
39781
39850
  const pid = typeof parsed.pid === "number" ? parsed.pid : Number(parsed.pid);
39782
39851
  if (!Number.isFinite(pid) || pid <= 0) return null;
@@ -40238,7 +40307,7 @@ function readLiveAllowedUsers() {
40238
40307
  return liveAllowedUsersCache.value;
40239
40308
  }
40240
40309
  const value = extractAllowedUsersFromMcpJson(
40241
- readFileSync20(SLACK_MCP_CONFIG_PATH, "utf-8")
40310
+ readFileSync18(SLACK_MCP_CONFIG_PATH, "utf-8")
40242
40311
  );
40243
40312
  if (value === null) return null;
40244
40313
  liveAllowedUsersCache = { mtimeMs, value };
@@ -40259,7 +40328,7 @@ function readLivePingAllowedUsers() {
40259
40328
  return livePingAllowedUsersCache.value;
40260
40329
  }
40261
40330
  const value = extractPingAllowedUsersFromMcpJson(
40262
- readFileSync20(SLACK_MCP_CONFIG_PATH, "utf-8")
40331
+ readFileSync18(SLACK_MCP_CONFIG_PATH, "utf-8")
40263
40332
  );
40264
40333
  if (value === null) return null;
40265
40334
  livePingAllowedUsersCache = { mtimeMs, value };
@@ -40326,7 +40395,7 @@ function writeSlackPendingInboundMarker(channel, threadTs, messageTs, undelivera
40326
40395
  function rewriteSlackMarkerInPlace(path, marker) {
40327
40396
  let fd;
40328
40397
  try {
40329
- fd = openSync(path, "r+");
40398
+ fd = openSync2(path, "r+");
40330
40399
  const buf = Buffer.from(JSON.stringify(marker));
40331
40400
  ftruncateSync(fd, 0);
40332
40401
  writeSync(fd, buf, 0, buf.length, 0);
@@ -40334,7 +40403,7 @@ function rewriteSlackMarkerInPlace(path, marker) {
40334
40403
  } finally {
40335
40404
  if (fd !== void 0) {
40336
40405
  try {
40337
- closeSync(fd);
40406
+ closeSync2(fd);
40338
40407
  } catch {
40339
40408
  }
40340
40409
  }
@@ -40349,7 +40418,7 @@ function markSlackMarkerPromisedInPlace(fullPath) {
40349
40418
  function markSlackMarkerEngagedInPlace(fullPath, opts) {
40350
40419
  let marker;
40351
40420
  try {
40352
- marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
40421
+ marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
40353
40422
  } catch {
40354
40423
  return false;
40355
40424
  }
@@ -40364,7 +40433,7 @@ function markSlackMarkerEngagedInPlace(fullPath, opts) {
40364
40433
  rewriteSlackMarkerInPlace(fullPath, marker);
40365
40434
  if (!opts.promise) return false;
40366
40435
  try {
40367
- const readBack = JSON.parse(readFileSync20(fullPath, "utf-8"));
40436
+ const readBack = JSON.parse(readFileSync18(fullPath, "utf-8"));
40368
40437
  return typeof readBack.promised_at === "string" && readBack.promised_at.length > 0;
40369
40438
  } catch {
40370
40439
  return false;
@@ -40375,7 +40444,7 @@ function attachSlackReplayPayload(channel, threadTs, messageTs, payload) {
40375
40444
  if (!path) return;
40376
40445
  let marker;
40377
40446
  try {
40378
- marker = JSON.parse(readFileSync20(path, "utf-8"));
40447
+ marker = JSON.parse(readFileSync18(path, "utf-8"));
40379
40448
  } catch {
40380
40449
  return;
40381
40450
  }
@@ -40386,7 +40455,7 @@ function readSlackPendingInboundMarker(channel, threadTs, messageTs) {
40386
40455
  const path = slackPendingInboundPath(channel, threadTs, messageTs);
40387
40456
  if (!path || !existsSync10(path)) return null;
40388
40457
  try {
40389
- return JSON.parse(readFileSync20(path, "utf-8"));
40458
+ return JSON.parse(readFileSync18(path, "utf-8"));
40390
40459
  } catch {
40391
40460
  return null;
40392
40461
  }
@@ -40535,7 +40604,7 @@ function __resetSlackBusyAckNoticeThrottle() {
40535
40604
  function clearSlackMarkerFileWithHeal(fullPath) {
40536
40605
  let marker = null;
40537
40606
  try {
40538
- marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
40607
+ marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
40539
40608
  } catch {
40540
40609
  }
40541
40610
  if (marker && decideRecoveryHeal({
@@ -40562,7 +40631,7 @@ var slackPromiseStampOutcome = { attempted: 0, stamped: 0 };
40562
40631
  function healThenEngageSlackMarker(fullPath, opts) {
40563
40632
  let marker = null;
40564
40633
  try {
40565
- marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
40634
+ marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
40566
40635
  } catch {
40567
40636
  return false;
40568
40637
  }
@@ -40650,7 +40719,7 @@ async function processSlackRecoveryOutboxFile(filename) {
40650
40719
  const fullPath = join20(SLACK_RECOVERY_OUTBOX_DIR, filename);
40651
40720
  let payload;
40652
40721
  try {
40653
- payload = JSON.parse(readFileSync20(fullPath, "utf-8"));
40722
+ payload = JSON.parse(readFileSync18(fullPath, "utf-8"));
40654
40723
  } catch (err) {
40655
40724
  process.stderr.write(
40656
40725
  `slack-channel(${AGENT_CODE_NAME}): recovery outbox parse failed (${filename}): ${err.message}
@@ -40866,7 +40935,7 @@ async function processSlackNoticeOutboxFile(filename) {
40866
40935
  }
40867
40936
  let payload;
40868
40937
  try {
40869
- const parsed = JSON.parse(readFileSync20(fullPath, "utf-8"));
40938
+ const parsed = JSON.parse(readFileSync18(fullPath, "utf-8"));
40870
40939
  if (!parsed || typeof parsed !== "object") throw new Error("not an object");
40871
40940
  payload = parsed;
40872
40941
  } catch {
@@ -40995,7 +41064,7 @@ function sweepSlackStaleMarkers(thresholdMs) {
40995
41064
  const fullPath = join20(SLACK_PENDING_INBOUND_DIR, filename);
40996
41065
  let marker;
40997
41066
  try {
40998
- marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
41067
+ marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
40999
41068
  } catch (err) {
41000
41069
  process.stderr.write(
41001
41070
  `slack-channel(${AGENT_CODE_NAME}): stale-marker parse failed for ${redactSlackId(filename)}: ${err.message}
@@ -41059,7 +41128,7 @@ var slackProgressTickRunning = false;
41059
41128
  function readSlackProgressHeartbeat() {
41060
41129
  if (!SLACK_PROGRESS_HEARTBEAT_PATH || !existsSync10(SLACK_PROGRESS_HEARTBEAT_PATH)) return null;
41061
41130
  try {
41062
- return parseProgressHeartbeat(readFileSync20(SLACK_PROGRESS_HEARTBEAT_PATH, "utf-8"));
41131
+ return parseProgressHeartbeat(readFileSync18(SLACK_PROGRESS_HEARTBEAT_PATH, "utf-8"));
41063
41132
  } catch {
41064
41133
  return null;
41065
41134
  }
@@ -41086,7 +41155,7 @@ function findSlackProgressTarget() {
41086
41155
  if (!name.endsWith(".json")) continue;
41087
41156
  let m;
41088
41157
  try {
41089
- m = JSON.parse(readFileSync20(join20(SLACK_PENDING_INBOUND_DIR, name), "utf-8"));
41158
+ m = JSON.parse(readFileSync18(join20(SLACK_PENDING_INBOUND_DIR, name), "utf-8"));
41090
41159
  } catch {
41091
41160
  continue;
41092
41161
  }
@@ -41237,7 +41306,7 @@ function listPendingSlackConversations() {
41237
41306
  if (!name.endsWith(".json")) continue;
41238
41307
  try {
41239
41308
  const marker = JSON.parse(
41240
- readFileSync20(join20(SLACK_PENDING_INBOUND_DIR, name), "utf8")
41309
+ readFileSync18(join20(SLACK_PENDING_INBOUND_DIR, name), "utf8")
41241
41310
  );
41242
41311
  if (typeof marker.channel !== "string" || !marker.channel) continue;
41243
41312
  if (typeof marker.thread_ts !== "string" || !marker.thread_ts) continue;
@@ -41410,7 +41479,7 @@ function readRestartTopicForMarker(filename, channel, threadTs) {
41410
41479
  if (!SLACK_RESTART_CONTEXT_DIR) return null;
41411
41480
  let raw;
41412
41481
  try {
41413
- raw = readFileSync20(join20(SLACK_RESTART_CONTEXT_DIR, filename), "utf-8");
41482
+ raw = readFileSync18(join20(SLACK_RESTART_CONTEXT_DIR, filename), "utf-8");
41414
41483
  } catch {
41415
41484
  return null;
41416
41485
  }
@@ -41464,7 +41533,7 @@ async function notifyStrandedInboundsOnFirstConnect() {
41464
41533
  const fullPath = join20(SLACK_PENDING_INBOUND_DIR, filename);
41465
41534
  let marker;
41466
41535
  try {
41467
- marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
41536
+ marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
41468
41537
  } catch {
41469
41538
  continue;
41470
41539
  }
@@ -43492,7 +43561,7 @@ ${result.formatted}` : "No messages in range, or the bot is not a member of this
43492
43561
  };
43493
43562
  }
43494
43563
  size = stat2.size;
43495
- bytes = readFileSync20(resolvedPath);
43564
+ bytes = readFileSync18(resolvedPath);
43496
43565
  } catch (err) {
43497
43566
  return {
43498
43567
  content: [{ type: "text", text: `Failed to read file: ${err.message}` }],
@@ -44286,7 +44355,7 @@ async function replayPendingSlackMarkers() {
44286
44355
  const fullPath = join20(SLACK_PENDING_INBOUND_DIR, name);
44287
44356
  let marker;
44288
44357
  try {
44289
- marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
44358
+ marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
44290
44359
  } catch {
44291
44360
  continue;
44292
44361
  }