@integrity-labs/agt-cli 0.27.159 → 0.27.160

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.
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
100
100
  return { ok: true };
101
101
  } catch {
102
102
  }
103
- const { resolveClaudeBinary } = await import("./persistent-session-EWHFMQRC.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-W6V2DO3R.js");
104
104
  const claudeBin = resolveClaudeBinary();
105
105
  const pairEnv = {
106
106
  ...process.env,
@@ -373,4 +373,4 @@ export {
373
373
  startClaudePair,
374
374
  submitClaudePairCode
375
375
  };
376
- //# sourceMappingURL=claude-pair-runtime-FTU6NTBF.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-G4MYOINJ.js.map
@@ -1,10 +1,13 @@
1
1
  import {
2
2
  ApiError,
3
3
  CHANNEL_SECRET_ENV_KEYS,
4
+ HostFlagStore,
4
5
  INTEGRATIONS_SECTION_END,
5
6
  INTEGRATIONS_SECTION_START,
6
7
  SUPERVISOR_RESTART_EXIT_CODE,
7
8
  api,
9
+ atomicWriteFileSync,
10
+ defaultFlagsCachePath,
8
11
  estimateActiveTasksTokens,
9
12
  exchangeApiKey,
10
13
  extractCommandNotFound,
@@ -19,7 +22,7 @@ import {
19
22
  provisionStopHook,
20
23
  requireHost,
21
24
  safeWriteJsonAtomic
22
- } from "../chunk-F5ZAIJHI.js";
25
+ } from "../chunk-O24XVAYZ.js";
23
26
  import {
24
27
  getProjectDir as getProjectDir2,
25
28
  getReadyTasks,
@@ -61,8 +64,9 @@ import {
61
64
  takeWatchdogGiveUpCount,
62
65
  takeZombieDetection,
63
66
  transcriptActivityAgeSeconds
64
- } from "../chunk-GJVY7WKU.js";
67
+ } from "../chunk-7RCGHACC.js";
65
68
  import {
69
+ FLAGS_SCHEMA_VERSION,
66
70
  KANBAN_CHECK_COMMAND,
67
71
  MAX_AVATAR_ENV_URL_BYTES,
68
72
  SUPPRESS_SENTINEL,
@@ -91,7 +95,7 @@ import {
91
95
  resolveDmTarget,
92
96
  worseConnectivityOutcome,
93
97
  wrapScheduledTaskPrompt
94
- } from "../chunk-5E5B4T7K.js";
98
+ } from "../chunk-BC26YO7P.js";
95
99
  import {
96
100
  parsePsRows,
97
101
  reapOrphanChannelMcps
@@ -99,10 +103,10 @@ import {
99
103
 
100
104
  // src/lib/manager-worker.ts
101
105
  import { createHash as createHash3 } from "crypto";
102
- import { readFileSync as readFileSync9, writeFileSync as writeFileSync4, appendFileSync, mkdirSync as mkdirSync4, chmodSync, existsSync as existsSync5, rmSync as rmSync2, readdirSync as readdirSync4, statSync as statSync3, unlinkSync, copyFileSync } from "fs";
106
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync4, appendFileSync, mkdirSync as mkdirSync3, chmodSync, existsSync as existsSync5, rmSync as rmSync2, readdirSync as readdirSync4, statSync as statSync3, unlinkSync, copyFileSync } from "fs";
103
107
  import https from "https";
104
108
  import { execFileSync as syncExecFile } from "child_process";
105
- import { join as join9, dirname as dirname3 } from "path";
109
+ import { join as join9, dirname as dirname2 } from "path";
106
110
  import { homedir as homedir5 } from "os";
107
111
  import { fileURLToPath } from "url";
108
112
 
@@ -752,40 +756,6 @@ function extractSlackBehaviourSubset(config2) {
752
756
  // src/lib/channel-quarantine.ts
753
757
  import { readFileSync } from "fs";
754
758
  import { join } from "path";
755
-
756
- // src/lib/atomic-write.ts
757
- import { closeSync, fsyncSync, openSync, writeSync, renameSync, mkdirSync } from "fs";
758
- import { dirname } from "path";
759
- function atomicWriteFileSync(path, data) {
760
- const dirPath = dirname(path);
761
- const tmpPath = `${path}.tmp.${process.pid}.${Math.random().toString(36).slice(2, 8)}`;
762
- try {
763
- mkdirSync(dirPath, { recursive: true });
764
- } catch {
765
- }
766
- const fd = openSync(tmpPath, "w", 420);
767
- try {
768
- writeSync(fd, data);
769
- try {
770
- fsyncSync(fd);
771
- } catch {
772
- }
773
- } finally {
774
- closeSync(fd);
775
- }
776
- renameSync(tmpPath, path);
777
- try {
778
- const dirFd = openSync(dirPath, "r");
779
- try {
780
- fsyncSync(dirFd);
781
- } finally {
782
- closeSync(dirFd);
783
- }
784
- } catch {
785
- }
786
- }
787
-
788
- // src/lib/channel-quarantine.ts
789
759
  var ESSENTIAL_CHANNEL_KEYS = /* @__PURE__ */ new Set(["direct-chat", "augmented"]);
790
760
  var OPTIONAL_CHANNEL_KEYS = /* @__PURE__ */ new Set([
791
761
  "telegram",
@@ -1391,8 +1361,8 @@ function runCliProbe(binary, args, opts = {}) {
1391
1361
  }
1392
1362
 
1393
1363
  // src/lib/self-update-coalesce.ts
1394
- import { readFileSync as readFileSync2, writeFileSync, mkdirSync as mkdirSync2 } from "fs";
1395
- import { dirname as dirname2 } from "path";
1364
+ import { readFileSync as readFileSync2, writeFileSync, mkdirSync } from "fs";
1365
+ import { dirname } from "path";
1396
1366
  var DEFAULT_SELF_UPDATE_COALESCE_MS = 30 * 60 * 1e3;
1397
1367
  function resolveCoalesceWindowMs(env = process.env) {
1398
1368
  const raw = env.AGT_SELF_UPDATE_COALESCE_MS;
@@ -1414,7 +1384,7 @@ function readLastSelfUpdateAppliedMs(markerPath, now = Date.now(), read = (p) =>
1414
1384
  return v;
1415
1385
  }
1416
1386
  function stampLastSelfUpdateApplied(markerPath, now = Date.now(), write = (p, v) => {
1417
- mkdirSync2(dirname2(p), { recursive: true });
1387
+ mkdirSync(dirname(p), { recursive: true });
1418
1388
  writeFileSync(p, v);
1419
1389
  }) {
1420
1390
  try {
@@ -3655,7 +3625,7 @@ function partitionActionableByPoison(actionable, states, config2) {
3655
3625
  }
3656
3626
 
3657
3627
  // src/lib/restart-flags.ts
3658
- import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync as readdirSync3, readFileSync as readFileSync8, renameSync as renameSync2, rmSync, writeFileSync as writeFileSync3 } from "fs";
3628
+ import { existsSync as existsSync4, mkdirSync as mkdirSync2, readdirSync as readdirSync3, readFileSync as readFileSync8, renameSync, rmSync, writeFileSync as writeFileSync3 } from "fs";
3659
3629
  import { homedir as homedir4 } from "os";
3660
3630
  import { join as join8 } from "path";
3661
3631
  import { randomUUID } from "crypto";
@@ -4924,7 +4894,7 @@ var cachedMaintenanceWindow = null;
4924
4894
  var lastVersionCheckAt = 0;
4925
4895
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
4926
4896
  var lastResponsivenessProbeAt = 0;
4927
- var agtCliVersion = true ? "0.27.159" : "dev";
4897
+ var agtCliVersion = true ? "0.27.160" : "dev";
4928
4898
  function resolveBrewPath(execFileSync4) {
4929
4899
  try {
4930
4900
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -5019,7 +4989,7 @@ async function ensureToolkitCli(toolkitSlug) {
5019
4989
  toolkitCliEnsured.add(toolkitSlug);
5020
4990
  return;
5021
4991
  }
5022
- brewBinDir = dirname3(brewPath);
4992
+ brewBinDir = dirname2(brewPath);
5023
4993
  const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
5024
4994
  log(`[toolkit-install] ${toolkitSlug}: installing via brew (${pkg})\u2026`);
5025
4995
  if (isRoot) {
@@ -5117,7 +5087,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
5117
5087
  }
5118
5088
  if (settings.channelsEnabled === true) return "ok";
5119
5089
  settings.channelsEnabled = true;
5120
- mkdirSync4(dirname3(path), { recursive: true });
5090
+ mkdirSync3(dirname2(path), { recursive: true });
5121
5091
  writeFileSync4(path, `${JSON.stringify(settings, null, 2)}
5122
5092
  `);
5123
5093
  log(`[managed-settings] set channelsEnabled:true in ${path} (ENG-5786 \u2014 unblocks Claude Code channels)`);
@@ -5159,7 +5129,7 @@ async function ensureFrameworkBinary(frameworkId) {
5159
5129
  log(`Claude Code install failed: ${err.message}`);
5160
5130
  return;
5161
5131
  }
5162
- const brewBinDir = dirname3(brewPath);
5132
+ const brewBinDir = dirname2(brewPath);
5163
5133
  if (!process.env.PATH?.split(":").includes(brewBinDir)) {
5164
5134
  process.env.PATH = `${brewBinDir}:${process.env.PATH ?? ""}`;
5165
5135
  }
@@ -5538,7 +5508,7 @@ function ensureEvalEmptyMcpConfig() {
5538
5508
  if (evalEmptyMcpConfigPath && existsSync5(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
5539
5509
  const dir = join9(homedir5(), ".augmented");
5540
5510
  try {
5541
- mkdirSync4(dir, { recursive: true });
5511
+ mkdirSync3(dir, { recursive: true });
5542
5512
  } catch {
5543
5513
  }
5544
5514
  const p = join9(dir, ".eval-empty-mcp.json");
@@ -5622,7 +5592,7 @@ function loadGatewayPorts() {
5622
5592
  }
5623
5593
  }
5624
5594
  function saveGatewayPorts(ports) {
5625
- mkdirSync4(AUGMENTED_DIR, { recursive: true });
5595
+ mkdirSync3(AUGMENTED_DIR, { recursive: true });
5626
5596
  writeFileSync4(GATEWAY_PORTS_FILE, JSON.stringify(ports, null, 2));
5627
5597
  }
5628
5598
  function allocatePort(codeName) {
@@ -5665,6 +5635,14 @@ function channelQuarantineStore() {
5665
5635
  }
5666
5636
  return _channelQuarantineStore;
5667
5637
  }
5638
+ var _hostFlagStore = null;
5639
+ function hostFlagStore() {
5640
+ if (!_hostFlagStore) {
5641
+ const dir = config?.configDir ?? join9(process.env["HOME"] ?? "/tmp", ".augmented");
5642
+ _hostFlagStore = new HostFlagStore({ cachePath: defaultFlagsCachePath(dir), log });
5643
+ }
5644
+ return _hostFlagStore;
5645
+ }
5668
5646
  function channelQuarantineMode() {
5669
5647
  const v = process.env["AGT_CHANNEL_QUARANTINE_MODE"]?.toLowerCase();
5670
5648
  if (v === "off") return "off";
@@ -5716,7 +5694,7 @@ function log(msg) {
5716
5694
  if (!managerLogPath) {
5717
5695
  try {
5718
5696
  managerLogPath = join9(homedir5(), ".augmented", "manager.log");
5719
- mkdirSync4(dirname3(managerLogPath), { recursive: true });
5697
+ mkdirSync3(dirname2(managerLogPath), { recursive: true });
5720
5698
  if (existsSync5(managerLogPath)) {
5721
5699
  chmodSync(managerLogPath, 384);
5722
5700
  }
@@ -5849,7 +5827,7 @@ async function migrateToProfiles() {
5849
5827
  const profileAuthDir = join9(profileDir, "agents", codeName, "agent");
5850
5828
  const authFile = join9(sharedAuthDir, "auth-profiles.json");
5851
5829
  if (existsSync5(authFile)) {
5852
- mkdirSync4(profileAuthDir, { recursive: true });
5830
+ mkdirSync3(profileAuthDir, { recursive: true });
5853
5831
  const authContent = readFileSync9(authFile, "utf-8");
5854
5832
  writeFileSync4(join9(profileAuthDir, "auth-profiles.json"), authContent);
5855
5833
  }
@@ -6122,7 +6100,7 @@ async function pollCycle() {
6122
6100
  }
6123
6101
  try {
6124
6102
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
6125
- const { collectDiagnostics } = await import("../persistent-session-EWHFMQRC.js");
6103
+ const { collectDiagnostics } = await import("../persistent-session-W6V2DO3R.js");
6126
6104
  const diagCodeNames = [...agentState.persistentSessionAgents];
6127
6105
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
6128
6106
  let tailscaleHostname;
@@ -6185,11 +6163,18 @@ async function pollCycle() {
6185
6163
  // ALL channel inbound — the API opens a host-scoped alert on it.
6186
6164
  // Omitted (undefined) on hosts that haven't run the assertion
6187
6165
  // (non-claude-code frameworks).
6188
- channels_setting_status: lastManagedSettingsStatus ?? void 0
6166
+ channels_setting_status: lastManagedSettingsStatus ?? void 0,
6167
+ // ENG-6251: capability advertisement — the flags schema version this
6168
+ // CLI compiled with, so the admin UI can show flip reach across a
6169
+ // mixed-CLI fleet (an older CLI sends an older fingerprint).
6170
+ flags_schema_version: FLAGS_SCHEMA_VERSION
6189
6171
  });
6190
6172
  if (hbResp?.maintenance_window) {
6191
6173
  cachedMaintenanceWindow = hbResp.maintenance_window;
6192
6174
  }
6175
+ if (hbResp?.feature_flags) {
6176
+ hostFlagStore().applyHeartbeat(hbResp.feature_flags, hbResp.flags_schema_version);
6177
+ }
6193
6178
  try {
6194
6179
  if (decideMaintenanceWindowGate({ window: cachedMaintenanceWindow, now: /* @__PURE__ */ new Date() }) === "proceed") {
6195
6180
  const { maybeUpdateClaudeCode } = await import("../claude-code-updater-4E5T2X3Z.js");
@@ -6209,12 +6194,12 @@ async function pollCycle() {
6209
6194
  const {
6210
6195
  collectResponsivenessProbes,
6211
6196
  getResponsivenessIntervalMs
6212
- } = await import("../responsiveness-probe-SWHB27QI.js");
6197
+ } = await import("../responsiveness-probe-LY2H2XR5.js");
6213
6198
  const probeIntervalMs = getResponsivenessIntervalMs();
6214
6199
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
6215
6200
  const probeCodeNames = [...agentState.persistentSessionAgents];
6216
6201
  if (probeCodeNames.length > 0) {
6217
- const { takeAcpxExecFailureCount, creditAcpxExecFailureCount } = await import("../persistent-session-EWHFMQRC.js");
6202
+ const { takeAcpxExecFailureCount, creditAcpxExecFailureCount } = await import("../persistent-session-W6V2DO3R.js");
6218
6203
  const drainedGiveUps = /* @__PURE__ */ new Map();
6219
6204
  const drainedAcpxFailures = /* @__PURE__ */ new Map();
6220
6205
  const probes = collectResponsivenessProbes(probeCodeNames).map((p) => {
@@ -6248,7 +6233,7 @@ async function pollCycle() {
6248
6233
  collectResponsivenessProbes,
6249
6234
  livePendingInboundOldestAgeSeconds,
6250
6235
  parkPendingInbound
6251
- } = await import("../responsiveness-probe-SWHB27QI.js");
6236
+ } = await import("../responsiveness-probe-LY2H2XR5.js");
6252
6237
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
6253
6238
  const wedgeNow = /* @__PURE__ */ new Date();
6254
6239
  const liveAgents = agentState.persistentSessionAgents;
@@ -6960,7 +6945,7 @@ async function processAgent(agent, agentStates) {
6960
6945
  try {
6961
6946
  const artifacts = generateArtifacts(agent, refreshData, frameworkAdapter);
6962
6947
  const changedFiles = [];
6963
- mkdirSync4(agentDir, { recursive: true });
6948
+ mkdirSync3(agentDir, { recursive: true });
6964
6949
  for (const artifact of artifacts) {
6965
6950
  const filePath = join9(agentDir, artifact.relativePath);
6966
6951
  let existingHash;
@@ -7028,7 +7013,7 @@ async function processAgent(agent, agentStates) {
7028
7013
  log(`${verb} '${agent.code_name}': ${fileNames}`);
7029
7014
  for (const file of changedFiles) {
7030
7015
  const filePath = join9(agentDir, file.relativePath);
7031
- mkdirSync4(dirname3(filePath), { recursive: true });
7016
+ mkdirSync3(dirname2(filePath), { recursive: true });
7032
7017
  if (file.relativePath === ".mcp.json") {
7033
7018
  safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
7034
7019
  } else {
@@ -7458,8 +7443,8 @@ async function processAgent(agent, agentStates) {
7458
7443
  try {
7459
7444
  const agentProvisionDir = agentDir;
7460
7445
  const projectDir = join9(homedir5(), ".augmented", agent.code_name, "project");
7461
- mkdirSync4(agentProvisionDir, { recursive: true });
7462
- mkdirSync4(projectDir, { recursive: true });
7446
+ mkdirSync3(agentProvisionDir, { recursive: true });
7447
+ mkdirSync3(projectDir, { recursive: true });
7463
7448
  const provisionMcpPath = join9(agentProvisionDir, ".mcp.json");
7464
7449
  const projectMcpPath = join9(projectDir, ".mcp.json");
7465
7450
  let mcpConfig = { mcpServers: {} };
@@ -10838,7 +10823,7 @@ async function processClaudePairSessions(agents) {
10838
10823
  killPairSession,
10839
10824
  pairTmuxSession,
10840
10825
  finalizeClaudePairOnboarding
10841
- } = await import("../claude-pair-runtime-FTU6NTBF.js");
10826
+ } = await import("../claude-pair-runtime-G4MYOINJ.js");
10842
10827
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
10843
10828
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
10844
10829
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -11220,7 +11205,7 @@ async function downloadMemories(agent, memoryDir, log2, { force }) {
11220
11205
  lastDownloadHash.set(agent.agent_id, responseHash);
11221
11206
  lastLocalFileHash.set(agent.agent_id, localListHash);
11222
11207
  if (dbMemories.memories?.length) {
11223
- mkdirSync4(memoryDir, { recursive: true });
11208
+ mkdirSync3(memoryDir, { recursive: true });
11224
11209
  let written = 0;
11225
11210
  let overwritten = 0;
11226
11211
  for (let i = 0; i < dbMemories.memories.length; i++) {
@@ -11389,6 +11374,7 @@ function startPolling() {
11389
11374
  running = true;
11390
11375
  void startCaffeinate();
11391
11376
  loadChannelHashCache2();
11377
+ hostFlagStore().init();
11392
11378
  log(`Starting poll loop (interval=${config.intervalMs}ms, configDir=${config.configDir})`);
11393
11379
  void killAllAgtTmuxSessions().catch(() => {
11394
11380
  }).then(() => migrateToProfiles()).then(() => {
@@ -11646,8 +11632,8 @@ function restartRunningChannelMcps(basenames) {
11646
11632
  }
11647
11633
  function deployMcpAssets() {
11648
11634
  const targetDir = join9(homedir5(), ".augmented", "_mcp");
11649
- mkdirSync4(targetDir, { recursive: true });
11650
- const moduleDir = dirname3(fileURLToPath(import.meta.url));
11635
+ mkdirSync3(targetDir, { recursive: true });
11636
+ const moduleDir = dirname2(fileURLToPath(import.meta.url));
11651
11637
  let mcpSourceDir = "";
11652
11638
  let dir = moduleDir;
11653
11639
  for (let i = 0; i < 6; i++) {
@@ -11656,7 +11642,7 @@ function deployMcpAssets() {
11656
11642
  mcpSourceDir = candidate;
11657
11643
  break;
11658
11644
  }
11659
- const parent = dirname3(dir);
11645
+ const parent = dirname2(dir);
11660
11646
  if (parent === dir) break;
11661
11647
  dir = parent;
11662
11648
  }