@integrity-labs/agt-cli 0.28.471 → 0.28.473

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.
@@ -39,14 +39,27 @@ function parsePreEnableToolsets(raw) {
39
39
  }
40
40
  return out;
41
41
  }
42
+ var ACTIVATION_TOOL = "enable_toolset";
42
43
  function buildEnableToolsetRequest(toolset) {
43
44
  return JSON.stringify({
44
45
  jsonrpc: "2.0",
45
46
  id: `agt-preenable-${toolset}`,
46
47
  method: "tools/call",
47
- params: { name: "enable_toolset", arguments: { name: toolset } }
48
+ params: { name: ACTIVATION_TOOL, arguments: { name: toolset } }
48
49
  });
49
50
  }
51
+ function stripActivationTool(tools) {
52
+ return tools.filter((t) => toolName(t) !== ACTIVATION_TOOL);
53
+ }
54
+ function isManagedActivationCall(method, params) {
55
+ if (method !== "tools/call") return false;
56
+ const name = params && typeof params === "object" && typeof params.name === "string" ? params.name : "";
57
+ return name === ACTIVATION_TOOL;
58
+ }
59
+ function activationRefusalMessage(label2, managed) {
60
+ const groups = managed.length > 0 ? managed.join(", ") : "none";
61
+ return `${label2}: toolset activation is managed by this connection, not by the agent. This connection manages these toolsets, and their tools are already in this session's tool list: ${groups}. Calling ${ACTIVATION_TOOL} cannot add a callable tool \u2014 the tool list is fixed for the session, so anything it reported as "newly available" would still answer "No such tool available". Call the tool you need directly; if it is not in your tool list, it is not enabled for this integration.`;
62
+ }
50
63
  function buildToolsListRequest() {
51
64
  return JSON.stringify({ jsonrpc: "2.0", id: "agt-union-list", method: "tools/list", params: {} });
52
65
  }
@@ -250,6 +263,10 @@ function ensureUnionManifest(token) {
250
263
  return unionOnce;
251
264
  }
252
265
  async function forward(line, id, isNotification, method, params) {
266
+ if (preEnableToolsets.length > 0 && isManagedActivationCall(method, params)) {
267
+ logErr(`refused agent-issued ${ACTIVATION_TOOL} (activation is proxy-managed)`);
268
+ return isNotification ? [] : [jsonRpcError(id, -32601, activationRefusalMessage(label, preEnableToolsets))];
269
+ }
253
270
  const token = readCurrentToken(tokenFile, tokenVar);
254
271
  if (!token) {
255
272
  logErr(`no token in ${tokenFile} (var ${tokenVar})`);
@@ -259,6 +276,7 @@ async function forward(line, id, isNotification, method, params) {
259
276
  await ensureUnionManifest(token);
260
277
  let tools = [...unionToolByName.values()];
261
278
  if (toolAllowlist.size > 0) tools = tools.filter((t) => toolAllowlist.has(toolName(t)));
279
+ tools = stripActivationTool(tools);
262
280
  return [JSON.stringify({ jsonrpc: "2.0", id: id ?? null, result: { tools } })];
263
281
  }
264
282
  if (method === "tools/call" && preEnableToolsets.length > 0) {
@@ -384,12 +402,16 @@ if (invokedDirectly) {
384
402
  void main();
385
403
  }
386
404
  export {
405
+ ACTIVATION_TOOL,
406
+ activationRefusalMessage,
387
407
  buildEnableToolsetRequest,
388
408
  buildForwardHeaders,
389
409
  buildToolsListRequest,
390
410
  extractJsonRpcMessages,
391
411
  extractToolsArray,
392
412
  filterToolsListMessage,
413
+ forward,
414
+ isManagedActivationCall,
393
415
  isToolCallBlocked,
394
416
  main,
395
417
  parseEnableToolsetResponse,
@@ -397,5 +419,6 @@ export {
397
419
  parsePreEnableToolsets,
398
420
  parseToolAllowlist,
399
421
  readCurrentToken,
422
+ stripActivationTool,
400
423
  toolName
401
424
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.471",
3
+ "version": "0.28.473",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {