@integrity-labs/agt-cli 0.28.329 → 0.28.330

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.
package/dist/bin/agt.js CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  success,
39
39
  table,
40
40
  warn
41
- } from "../chunk-AOSBSVNB.js";
41
+ } from "../chunk-CDRVXSQ3.js";
42
42
  import {
43
43
  AnchorSessionClient,
44
44
  CHANNEL_REGISTRY,
@@ -4827,7 +4827,7 @@ import { execFileSync, execSync } from "child_process";
4827
4827
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4828
4828
  import chalk18 from "chalk";
4829
4829
  import ora16 from "ora";
4830
- var cliVersion = true ? "0.28.329" : "dev";
4830
+ var cliVersion = true ? "0.28.330" : "dev";
4831
4831
  async function fetchLatestVersion() {
4832
4832
  const host2 = getHost();
4833
4833
  if (!host2) return null;
@@ -5931,7 +5931,7 @@ function handleError(err) {
5931
5931
  }
5932
5932
 
5933
5933
  // src/bin/agt.ts
5934
- var cliVersion2 = true ? "0.28.329" : "dev";
5934
+ var cliVersion2 = true ? "0.28.330" : "dev";
5935
5935
  var program = new Command();
5936
5936
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
5937
5937
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6797,7 +6797,7 @@ function requireHost() {
6797
6797
  }
6798
6798
 
6799
6799
  // src/lib/api-client.ts
6800
- var agtCliVersion = true ? "0.28.329" : "dev";
6800
+ var agtCliVersion = true ? "0.28.330" : "dev";
6801
6801
  var lastConfigHash = null;
6802
6802
  function setConfigHash(hash) {
6803
6803
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -9194,4 +9194,4 @@ export {
9194
9194
  managerInstallSystemUnitCommand,
9195
9195
  managerUninstallSystemUnitCommand
9196
9196
  };
9197
- //# sourceMappingURL=chunk-AOSBSVNB.js.map
9197
+ //# sourceMappingURL=chunk-CDRVXSQ3.js.map
@@ -43,7 +43,7 @@ import {
43
43
  requireHost,
44
44
  safeWriteJsonAtomic,
45
45
  setConfigHash
46
- } from "../chunk-AOSBSVNB.js";
46
+ } from "../chunk-CDRVXSQ3.js";
47
47
  import {
48
48
  getProjectDir as getProjectDir2,
49
49
  getReadyTasks,
@@ -8386,7 +8386,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
8386
8386
  var lastVersionCheckAt = 0;
8387
8387
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
8388
8388
  var lastResponsivenessProbeAt = 0;
8389
- var agtCliVersion = true ? "0.28.329" : "dev";
8389
+ var agtCliVersion = true ? "0.28.330" : "dev";
8390
8390
  function resolveBrewPath(execFileSync2) {
8391
8391
  try {
8392
8392
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
package/dist/mcp/xero.js CHANGED
@@ -114409,7 +114409,8 @@ var BrokerCredentialClient = class {
114409
114409
  accessToken: res.data.access_token,
114410
114410
  tenantId: res.data.tenant_id ?? null,
114411
114411
  expiresAt: res.data.expires_at ?? null,
114412
- grantedScopes: res.data.granted_scopes ?? null
114412
+ grantedScopes: res.data.granted_scopes ?? null,
114413
+ effectiveScopes: res.data.effective_scopes ?? null
114413
114414
  };
114414
114415
  } catch (err) {
114415
114416
  if (err.status !== void 0) throw err;
@@ -120511,38 +120512,80 @@ function writesGoViaBroker() {
120511
120512
  const raw = (process.env.XERO_WRITES_VIA_BROKER ?? "").trim().toLowerCase();
120512
120513
  return raw === "true" || raw === "1" || raw === "yes";
120513
120514
  }
120514
- function ToolFactory(server) {
120515
+ var SCOPE_GATES = [
120516
+ { family: /payroll/i, requiresScope: "payroll" }
120517
+ ];
120518
+ function makeToolGate(effectiveScopes) {
120519
+ if (effectiveScopes == null) return () => true;
120520
+ const scopes = effectiveScopes.toLowerCase();
120521
+ return (toolName) => {
120522
+ for (const gate of SCOPE_GATES) {
120523
+ if (gate.family.test(toolName) && !scopes.includes(gate.requiresScope)) {
120524
+ return false;
120525
+ }
120526
+ }
120527
+ return true;
120528
+ };
120529
+ }
120530
+ function ToolFactory(server, effectiveScopes = null) {
120515
120531
  const readOnly = writesGoViaBroker();
120532
+ const allow = makeToolGate(effectiveScopes);
120516
120533
  if (readOnly) {
120517
120534
  console.error(
120518
120535
  "xero-mcp-server: XERO_WRITES_VIA_BROKER is set \u2014 registering read-only tools only (Get/List). Create/Update/Delete are gated through the Augmented xero-broker (HITL)."
120519
120536
  );
120520
120537
  }
120521
- GetTools.map((tool) => tool()).forEach(
120522
- (tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler)
120523
- );
120524
- ListTools.map((tool) => tool()).forEach(
120525
- (tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler)
120526
- );
120538
+ if (effectiveScopes != null && !effectiveScopes.toLowerCase().includes("payroll")) {
120539
+ console.error(
120540
+ "xero-mcp-server: agent policy excludes payroll scopes \u2014 payroll tools not registered (ENG-7824)."
120541
+ );
120542
+ }
120543
+ GetTools.map((tool) => tool()).filter((tool) => allow(tool.name)).forEach((tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler));
120544
+ ListTools.map((tool) => tool()).filter((tool) => allow(tool.name)).forEach((tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler));
120527
120545
  AttachmentTools.map((tool) => tool()).forEach(
120528
120546
  (tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler)
120529
120547
  );
120530
120548
  if (readOnly) return;
120531
- DeleteTools.map((tool) => tool()).forEach(
120532
- (tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler)
120533
- );
120534
- CreateTools.map((tool) => tool()).forEach(
120535
- (tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler)
120536
- );
120537
- UpdateTools.map((tool) => tool()).forEach(
120538
- (tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler)
120539
- );
120549
+ DeleteTools.map((tool) => tool()).filter((tool) => allow(tool.name)).forEach((tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler));
120550
+ CreateTools.map((tool) => tool()).filter((tool) => allow(tool.name)).forEach((tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler));
120551
+ UpdateTools.map((tool) => tool()).filter((tool) => allow(tool.name)).forEach((tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler));
120540
120552
  }
120541
120553
 
120542
120554
  // src/index.ts
120555
+ async function resolveEffectiveScopes() {
120556
+ const host = process.env.AGT_HOST;
120557
+ const agentId = process.env.AGT_AGENT_ID;
120558
+ const integrationId = process.env.AGT_INTEGRATION_ID;
120559
+ const initialToken = process.env.AGT_TOKEN;
120560
+ const apiKey = process.env.AGT_API_KEY;
120561
+ const brokerMode = Boolean(host && agentId && integrationId && (initialToken || apiKey));
120562
+ if (!brokerMode) return null;
120563
+ try {
120564
+ const client = new BrokerCredentialClient({
120565
+ host,
120566
+ initialToken,
120567
+ apiKey,
120568
+ agentId,
120569
+ integrationId
120570
+ });
120571
+ const cred = await Promise.race([
120572
+ client.fetchCredential(),
120573
+ new Promise(
120574
+ (_, reject) => setTimeout(() => reject(new Error("effective-scope resolution timed out")), 8e3)
120575
+ )
120576
+ ]);
120577
+ return cred.effectiveScopes;
120578
+ } catch (err) {
120579
+ console.error(
120580
+ `xero-mcp-server: effective-scope resolution failed, registering all tools (fail-open): ${err.message}`
120581
+ );
120582
+ return null;
120583
+ }
120584
+ }
120543
120585
  var main = async () => {
120544
120586
  const server = XeroMcpServer.GetServer();
120545
- ToolFactory(server);
120587
+ const effectiveScopes = await resolveEffectiveScopes();
120588
+ ToolFactory(server, effectiveScopes);
120546
120589
  const transport = new StdioServerTransport();
120547
120590
  await server.connect(transport);
120548
120591
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.329",
3
+ "version": "0.28.330",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {