@integrity-labs/agt-cli 0.28.162 → 0.28.164

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-T7Q53HW5.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-XIW3I5CQ.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-PJ4OZ3DE.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-6ZLSPL6Z.js.map
@@ -28,7 +28,7 @@ import {
28
28
  requireHost,
29
29
  safeWriteJsonAtomic,
30
30
  setConfigHash
31
- } from "../chunk-G6NDQYBC.js";
31
+ } from "../chunk-7YBYMQNJ.js";
32
32
  import {
33
33
  getProjectDir as getProjectDir2,
34
34
  getReadyTasks,
@@ -70,7 +70,7 @@ import {
70
70
  takeZombieDetection,
71
71
  transcriptActivityAgeSeconds,
72
72
  writeEgressAllowlist
73
- } from "../chunk-MNW2HVGO.js";
73
+ } from "../chunk-6TIVVGA7.js";
74
74
  import {
75
75
  CONVERSATION_FAILURE_CATEGORIES,
76
76
  DEFAULT_FRAMEWORK,
@@ -111,7 +111,7 @@ import {
111
111
  resolveChannels,
112
112
  resolveDmTarget,
113
113
  sumTranscriptUsageInWindow
114
- } from "../chunk-U6HS4U7L.js";
114
+ } from "../chunk-SDUFTHIF.js";
115
115
  import {
116
116
  parsePsRows,
117
117
  reapOrphanChannelMcps
@@ -6878,7 +6878,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
6878
6878
  var lastVersionCheckAt = 0;
6879
6879
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
6880
6880
  var lastResponsivenessProbeAt = 0;
6881
- var agtCliVersion = true ? "0.28.162" : "dev";
6881
+ var agtCliVersion = true ? "0.28.164" : "dev";
6882
6882
  function resolveBrewPath(execFileSync4) {
6883
6883
  try {
6884
6884
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -8011,7 +8011,7 @@ async function pollCycle() {
8011
8011
  }
8012
8012
  try {
8013
8013
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
8014
- const { collectDiagnostics } = await import("../persistent-session-T7Q53HW5.js");
8014
+ const { collectDiagnostics } = await import("../persistent-session-XIW3I5CQ.js");
8015
8015
  const diagCodeNames = [...agentState.persistentSessionAgents];
8016
8016
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
8017
8017
  let tailscaleHostname;
@@ -8159,7 +8159,7 @@ async function pollCycle() {
8159
8159
  const {
8160
8160
  collectResponsivenessProbes,
8161
8161
  getResponsivenessIntervalMs
8162
- } = await import("../responsiveness-probe-K4Y7BXRH.js");
8162
+ } = await import("../responsiveness-probe-7JTG6QMB.js");
8163
8163
  const probeIntervalMs = getResponsivenessIntervalMs();
8164
8164
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
8165
8165
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -8191,7 +8191,7 @@ async function pollCycle() {
8191
8191
  collectResponsivenessProbes,
8192
8192
  livePendingInboundOldestAgeSeconds,
8193
8193
  parkPendingInbound
8194
- } = await import("../responsiveness-probe-K4Y7BXRH.js");
8194
+ } = await import("../responsiveness-probe-7JTG6QMB.js");
8195
8195
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
8196
8196
  const wedgeNow = /* @__PURE__ */ new Date();
8197
8197
  const liveAgents = agentState.persistentSessionAgents;
@@ -11692,7 +11692,7 @@ async function processClaudePairSessions(agents) {
11692
11692
  killPairSession,
11693
11693
  pairTmuxSession,
11694
11694
  finalizeClaudePairOnboarding
11695
- } = await import("../claude-pair-runtime-PJ4OZ3DE.js");
11695
+ } = await import("../claude-pair-runtime-6ZLSPL6Z.js");
11696
11696
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
11697
11697
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
11698
11698
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -10,15 +10,48 @@ import { resolve as resolvePath } from "path";
10
10
  var URL_ENV = "AGT_REMOTE_MCP_URL";
11
11
  var TOKEN_FILE_ENV = "AGT_REMOTE_MCP_TOKEN_FILE";
12
12
  var TOKEN_VAR_ENV = "AGT_REMOTE_MCP_TOKEN_VAR";
13
+ var ALLOWLIST_ENV = "AGT_REMOTE_MCP_TOOL_ALLOWLIST";
13
14
  var REMOTE_FETCH_TIMEOUT_MS = 3e4;
14
15
  var remoteUrl = process.env[URL_ENV] ?? "";
15
16
  var tokenFile = process.env[TOKEN_FILE_ENV] ?? "";
16
17
  var tokenVar = process.env[TOKEN_VAR_ENV] ?? "";
17
18
  var label = process.env["AGT_REMOTE_MCP_LABEL"] || tokenVar || "remote-oauth";
19
+ var toolAllowlist = parseToolAllowlist(process.env[ALLOWLIST_ENV] ?? "");
18
20
  function logErr(msg) {
19
21
  process.stderr.write(`[remote-oauth-proxy:${label}] ${msg}
20
22
  `);
21
23
  }
24
+ function parseToolAllowlist(raw) {
25
+ const out = /* @__PURE__ */ new Set();
26
+ for (const part of (raw || "").split(",")) {
27
+ const name = part.trim();
28
+ if (name) out.add(name);
29
+ }
30
+ return out;
31
+ }
32
+ function filterToolsListMessage(message, allow) {
33
+ if (allow.size === 0) return { message, total: 0, kept: 0, advertised: [] };
34
+ let obj;
35
+ try {
36
+ obj = JSON.parse(message);
37
+ } catch {
38
+ return { message, total: 0, kept: 0, advertised: [] };
39
+ }
40
+ const result = obj?.result;
41
+ const tools = result?.tools;
42
+ if (!Array.isArray(tools)) return { message, total: 0, kept: 0, advertised: [] };
43
+ const nameOf = (t) => t && typeof t === "object" && typeof t.name === "string" ? t.name : "";
44
+ const advertised = tools.map(nameOf).filter((n) => n.length > 0);
45
+ const filtered = tools.filter((t) => allow.has(nameOf(t)));
46
+ result.tools = filtered;
47
+ return { message: JSON.stringify(obj), total: tools.length, kept: filtered.length, advertised };
48
+ }
49
+ function isToolCallBlocked(method, params, allow) {
50
+ if (allow.size === 0 || method !== "tools/call") return { blocked: false, name: "" };
51
+ const name = params && typeof params === "object" && typeof params.name === "string" ? params.name : "";
52
+ if (name && !allow.has(name)) return { blocked: true, name };
53
+ return { blocked: false, name };
54
+ }
22
55
  function readCurrentToken(file, varName) {
23
56
  let raw;
24
57
  try {
@@ -71,7 +104,7 @@ function extractJsonRpcMessages(contentType, body) {
71
104
  }
72
105
  return out;
73
106
  }
74
- async function forward(line, id, isNotification) {
107
+ async function forward(line, id, isNotification, method) {
75
108
  const token = readCurrentToken(tokenFile, tokenVar);
76
109
  if (!token) {
77
110
  logErr(`no token in ${tokenFile} (var ${tokenVar})`);
@@ -102,7 +135,24 @@ async function forward(line, id, isNotification) {
102
135
  }
103
136
  if (isNotification) return [];
104
137
  const messages = extractJsonRpcMessages(ct, body);
105
- if (messages.length > 0) return messages;
138
+ if (messages.length > 0) {
139
+ if (method === "tools/list" && toolAllowlist.size > 0) {
140
+ return messages.map((m) => {
141
+ const r = filterToolsListMessage(m, toolAllowlist);
142
+ if (r.total !== r.kept) {
143
+ logErr(`tools/list filtered ${r.total} -> ${r.kept} (allowlist ${toolAllowlist.size})`);
144
+ }
145
+ if (r.advertised.length > 0) {
146
+ const missing = [...toolAllowlist].filter((n) => !r.advertised.includes(n));
147
+ if (missing.length > 0) {
148
+ logErr(`allowlisted tools not advertised by server: ${missing.join(", ")}`);
149
+ }
150
+ }
151
+ return r.message;
152
+ });
153
+ }
154
+ return messages;
155
+ }
106
156
  const detail = body.slice(0, 300).replace(/\s+/g, " ").trim();
107
157
  return [jsonRpcError(id, -32002, `${label}: MCP server returned HTTP ${res.status}${detail ? ` (${detail})` : ""}`)];
108
158
  }
@@ -139,7 +189,19 @@ async function main() {
139
189
  }
140
190
  const isNotification = !("id" in parsed);
141
191
  const id = parsed.id;
142
- const task = forward(text, id, isNotification).then(writeReplies).catch((err) => {
192
+ if (!isNotification) {
193
+ const block = isToolCallBlocked(parsed.method, parsed.params, toolAllowlist);
194
+ if (block.blocked) {
195
+ logErr(`blocked tools/call to non-allowlisted tool "${block.name}"`);
196
+ const task2 = writeReplies([
197
+ jsonRpcError(id, -32601, `${label}: tool "${block.name}" is not enabled for this integration`)
198
+ ]).catch((err) => logErr(`handler error: ${err.message}`));
199
+ inflight.add(task2);
200
+ void task2.finally(() => inflight.delete(task2));
201
+ return;
202
+ }
203
+ }
204
+ const task = forward(text, id, isNotification, parsed.method).then(writeReplies).catch((err) => {
143
205
  logErr(`handler error: ${err.message}`);
144
206
  });
145
207
  inflight.add(task);
@@ -163,6 +225,9 @@ if (invokedDirectly) {
163
225
  }
164
226
  export {
165
227
  extractJsonRpcMessages,
228
+ filterToolsListMessage,
229
+ isToolCallBlocked,
166
230
  main,
231
+ parseToolAllowlist,
167
232
  readCurrentToken
168
233
  };
@@ -14562,8 +14562,8 @@ function shouldPostUndeliverableNotice(lastNoticeAtMs, nowMs, throttleMs = UNDEL
14562
14562
  function undeliverableNoticeText(replayEnabled = channelReplayEnabled()) {
14563
14563
  return replayEnabled ? "\u23F3 I can't get to this right now \u2014 no need to resend; I'll pick it up automatically as soon as I'm free." : "\u23F3 I can't get to this right now. Please resend in a few minutes \u2014 I may not see this one.";
14564
14564
  }
14565
- var BUSY_ACK_THRESHOLD_MS = 9e4;
14566
- var BUSY_ACK_NOTICE_THROTTLE_MS = 10 * 60 * 1e3;
14565
+ var BUSY_ACK_THRESHOLD_MS = 12e4;
14566
+ var BUSY_ACK_NOTICE_THROTTLE_MS = 20 * 60 * 1e3;
14567
14567
  function channelBusyAckEnabled() {
14568
14568
  return resolveHostBooleanFlag({
14569
14569
  key: "channel-busy-ack",
@@ -14620,7 +14620,7 @@ function decideGiveUpNotice(input) {
14620
14620
  function giveUpNoticeText() {
14621
14621
  return "\u26A0\uFE0F I couldn't read your last message \u2014 please resend it.";
14622
14622
  }
14623
- function oldestPendingMarkerAgeMs(dir, now = Date.now()) {
14623
+ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
14624
14624
  if (!dir) return null;
14625
14625
  let names;
14626
14626
  try {
@@ -14635,7 +14635,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now()) {
14635
14635
  try {
14636
14636
  const raw = JSON.parse(readFileSync2(join2(dir, name), "utf-8"));
14637
14637
  if (raw.discretionary === true) continue;
14638
- if (typeof raw.seen_at === "string" && raw.seen_at) continue;
14638
+ if (!opts?.includeSeen && typeof raw.seen_at === "string" && raw.seen_at) continue;
14639
14639
  receivedAt = raw.received_at;
14640
14640
  } catch {
14641
14641
  continue;
@@ -14649,6 +14649,9 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now()) {
14649
14649
  }
14650
14650
  return oldest;
14651
14651
  }
14652
+ function hasInFlightInbound(dir, now = Date.now()) {
14653
+ return oldestPendingMarkerAgeMs(dir, now, { includeSeen: true }) != null;
14654
+ }
14652
14655
  function isPendingMarkerStale(receivedAt, nowMs, thresholdMs) {
14653
14656
  if (!receivedAt) return true;
14654
14657
  const t = Date.parse(receivedAt);
@@ -20830,6 +20833,7 @@ async function connectSocketMode() {
20830
20833
  paneLogFreshAgeMs
20831
20834
  };
20832
20835
  const ackDecision = decideAckReaction(ackInputs);
20836
+ const arrivedWhileBusy = hasInFlightInbound(SLACK_PENDING_INBOUND_DIR);
20833
20837
  if (ackDecision === "undeliverable") {
20834
20838
  const cause = classifyUndeliverableCause(ackInputs) ?? "unknown";
20835
20839
  recordChannelDeflection(SLACK_AGENT_DIR, "slack", cause);
@@ -20861,7 +20865,7 @@ async function connectSocketMode() {
20861
20865
  threadTs,
20862
20866
  ts,
20863
20867
  isThreadReply,
20864
- ackInputs.oldestPendingAgeMs != null
20868
+ arrivedWhileBusy
20865
20869
  );
20866
20870
  }
20867
20871
  }
@@ -16733,8 +16733,8 @@ function shouldPostUndeliverableNotice(lastNoticeAtMs, nowMs, throttleMs = UNDEL
16733
16733
  function undeliverableNoticeText(replayEnabled = channelReplayEnabled()) {
16734
16734
  return replayEnabled ? "\u23F3 I can't get to this right now \u2014 no need to resend; I'll pick it up automatically as soon as I'm free." : "\u23F3 I can't get to this right now. Please resend in a few minutes \u2014 I may not see this one.";
16735
16735
  }
16736
- var BUSY_ACK_THRESHOLD_MS = 9e4;
16737
- var BUSY_ACK_NOTICE_THROTTLE_MS = 10 * 60 * 1e3;
16736
+ var BUSY_ACK_THRESHOLD_MS = 12e4;
16737
+ var BUSY_ACK_NOTICE_THROTTLE_MS = 20 * 60 * 1e3;
16738
16738
  function channelBusyAckEnabled() {
16739
16739
  return resolveHostBooleanFlag({
16740
16740
  key: "channel-busy-ack",
@@ -16791,7 +16791,7 @@ function decideGiveUpNotice(input) {
16791
16791
  function giveUpNoticeText() {
16792
16792
  return "\u26A0\uFE0F I couldn't read your last message \u2014 please resend it.";
16793
16793
  }
16794
- function oldestPendingMarkerAgeMs(dir, now = Date.now()) {
16794
+ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
16795
16795
  if (!dir) return null;
16796
16796
  let names;
16797
16797
  try {
@@ -16806,7 +16806,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now()) {
16806
16806
  try {
16807
16807
  const raw = JSON.parse(readFileSync9(join7(dir, name), "utf-8"));
16808
16808
  if (raw.discretionary === true) continue;
16809
- if (typeof raw.seen_at === "string" && raw.seen_at) continue;
16809
+ if (!opts?.includeSeen && typeof raw.seen_at === "string" && raw.seen_at) continue;
16810
16810
  receivedAt = raw.received_at;
16811
16811
  } catch {
16812
16812
  continue;
@@ -16820,6 +16820,9 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now()) {
16820
16820
  }
16821
16821
  return oldest;
16822
16822
  }
16823
+ function hasInFlightInbound(dir, now = Date.now()) {
16824
+ return oldestPendingMarkerAgeMs(dir, now, { includeSeen: true }) != null;
16825
+ }
16823
16826
  function isPendingMarkerStale(receivedAt, nowMs, thresholdMs) {
16824
16827
  if (!receivedAt) return true;
16825
16828
  const t = Date.parse(receivedAt);
@@ -19798,6 +19801,7 @@ async function pollLoop() {
19798
19801
  paneLogFreshAgeMs
19799
19802
  };
19800
19803
  const ackDecision = decideAckReaction(ackInputs);
19804
+ const arrivedWhileBusy = hasInFlightInbound(PENDING_INBOUND_DIR);
19801
19805
  if (ackDecision === "undeliverable") {
19802
19806
  const cause = classifyUndeliverableCause(ackInputs) ?? "unknown";
19803
19807
  recordChannelDeflection(AGENT_DIR, "telegram", cause);
@@ -19876,7 +19880,7 @@ async function pollLoop() {
19876
19880
  channelPayload
19877
19881
  );
19878
19882
  if (ackDecision === "ack") {
19879
- scheduleBusyAck(chatId, messageId, ackInputs.oldestPendingAgeMs != null);
19883
+ scheduleBusyAck(chatId, messageId, arrivedWhileBusy);
19880
19884
  }
19881
19885
  await mcp.notification({
19882
19886
  method: "notifications/claude/channel",
@@ -34,8 +34,8 @@ import {
34
34
  writeDirectChatSessionState,
35
35
  writeEgressAllowlist,
36
36
  writePersistentClaudeWrapper
37
- } from "./chunk-MNW2HVGO.js";
38
- import "./chunk-U6HS4U7L.js";
37
+ } from "./chunk-6TIVVGA7.js";
38
+ import "./chunk-SDUFTHIF.js";
39
39
  import "./chunk-XWVM4KPK.js";
40
40
  export {
41
41
  EGRESS_BASELINE_DOMAINS,
@@ -74,4 +74,4 @@ export {
74
74
  writeEgressAllowlist,
75
75
  writePersistentClaudeWrapper
76
76
  };
77
- //# sourceMappingURL=persistent-session-T7Q53HW5.js.map
77
+ //# sourceMappingURL=persistent-session-XIW3I5CQ.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-MNW2HVGO.js";
4
- import "./chunk-U6HS4U7L.js";
3
+ } from "./chunk-6TIVVGA7.js";
4
+ import "./chunk-SDUFTHIF.js";
5
5
  import "./chunk-XWVM4KPK.js";
6
6
 
7
7
  // src/lib/responsiveness-probe.ts
@@ -304,4 +304,4 @@ export {
304
304
  readAndResetChannelDeflections,
305
305
  readAndResetChannelLaneClassifications
306
306
  };
307
- //# sourceMappingURL=responsiveness-probe-K4Y7BXRH.js.map
307
+ //# sourceMappingURL=responsiveness-probe-7JTG6QMB.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.162",
3
+ "version": "0.28.164",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {