@integrity-labs/agt-cli 0.28.1084 → 0.28.1086

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/mcp/xero.js CHANGED
@@ -114339,9 +114339,17 @@ function ensureError(value) {
114339
114339
  }
114340
114340
 
114341
114341
  // src/helpers/pick-tenant-id.ts
114342
- function pickTenantId(tenants, desired) {
114342
+ var UNEXPANDED_PLACEHOLDER = /^\$\{[^}]*\}$/;
114343
+ function normaliseDesiredTenant(raw) {
114344
+ if (typeof raw !== "string") return void 0;
114345
+ const trimmed = raw.trim();
114346
+ if (trimmed === "" || UNEXPANDED_PLACEHOLDER.test(trimmed)) return void 0;
114347
+ return trimmed;
114348
+ }
114349
+ function pickTenantId(tenants, rawDesired) {
114350
+ const desired = normaliseDesiredTenant(rawDesired);
114343
114351
  if (!desired) {
114344
- return tenants[0]?.tenantId ?? "";
114352
+ return tenants.length === 1 ? tenants[0].tenantId : "";
114345
114353
  }
114346
114354
  const match = tenants.find((t) => t.tenantId === desired);
114347
114355
  if (!match) {
@@ -114363,6 +114371,49 @@ function currentCallTenant() {
114363
114371
  return store.getStore()?.tenantId;
114364
114372
  }
114365
114373
 
114374
+ // src/helpers/resolve-call-tenant.ts
114375
+ function describe(allowed) {
114376
+ return allowed.map((t) => t.tenantName ? `${t.tenantName} (${t.tenantId})` : t.tenantId).join(", ");
114377
+ }
114378
+ function resolveCallTenant(allowed, requested) {
114379
+ const wanted = typeof requested === "string" ? requested.trim() : "";
114380
+ if (allowed !== null && allowed.length === 0) {
114381
+ return {
114382
+ ok: false,
114383
+ message: "This agent has no Xero organisations selected, so no Xero call can run. Ask an admin to choose the organisations for this integration."
114384
+ };
114385
+ }
114386
+ if (allowed === null) {
114387
+ if (wanted) {
114388
+ return {
114389
+ ok: false,
114390
+ message: `tenant_id ${wanted} cannot be used: this Xero connection has no organisation list to check it against.`
114391
+ };
114392
+ }
114393
+ return { ok: true, tenantId: void 0 };
114394
+ }
114395
+ if (wanted) {
114396
+ if (allowed.some((t) => t.tenantId === wanted)) return { ok: true, tenantId: wanted };
114397
+ return {
114398
+ ok: false,
114399
+ message: `tenant_id ${wanted} is not one of the Xero organisations this agent may use: ${describe(allowed)}.`
114400
+ };
114401
+ }
114402
+ if (allowed.length === 1) return { ok: true, tenantId: allowed[0].tenantId };
114403
+ return {
114404
+ ok: false,
114405
+ message: `This agent can use more than one Xero organisation, so pass tenant_id. Allowed: ${describe(allowed)}. Call list-organisations to see them.`
114406
+ };
114407
+ }
114408
+ function fallbackAllowedTenants(pinnedTenantId, tokenTenants) {
114409
+ const fromToken = tokenTenants.filter((t) => typeof t?.tenantId === "string" && t.tenantId !== "").map((t) => ({ tenantId: t.tenantId, tenantName: typeof t.tenantName === "string" ? t.tenantName : null }));
114410
+ if (pinnedTenantId) {
114411
+ const match = fromToken.find((t) => t.tenantId === pinnedTenantId);
114412
+ return [{ tenantId: pinnedTenantId, tenantName: match?.tenantName ?? null }];
114413
+ }
114414
+ return fromToken;
114415
+ }
114416
+
114366
114417
  // src/clients/broker-credential-client.ts
114367
114418
  function makeError(status, message, needsReauth = false) {
114368
114419
  const err = new Error(message);
@@ -114541,6 +114592,15 @@ var MCPXeroClient = class extends import_xero_node.XeroClient {
114541
114592
  * despite the operator allowing nothing.
114542
114593
  */
114543
114594
  allowedTenants = null;
114595
+ /**
114596
+ * CS-1944 (Obi Wan on #6802): the organisations this token carries, for
114597
+ * clients that learn them WITHOUT going through xero-node's updateTenants()
114598
+ * (whose `tenants` is a read-only getter here). Custom Connections read
114599
+ * /connections directly, so without this the unpinned multi-organisation
114600
+ * fallback saw an empty list and refused every call, explicit tenant_id
114601
+ * included.
114602
+ */
114603
+ tokenTenants = null;
114544
114604
  constructor(config2) {
114545
114605
  super(config2);
114546
114606
  }
@@ -114561,9 +114621,7 @@ var MCPXeroClient = class extends import_xero_node.XeroClient {
114561
114621
  async getAllowedTenants() {
114562
114622
  await this.authenticate();
114563
114623
  if (this.allowedTenants !== null) return this.allowedTenants;
114564
- if (!this.pinnedTenantId) return [];
114565
- const match = (this.tenants ?? []).find((t) => t?.tenantId === this.pinnedTenantId);
114566
- return [{ tenantId: this.pinnedTenantId, tenantName: match?.tenantName ?? null }];
114624
+ return fallbackAllowedTenants(this.pinnedTenantId, this.tokenTenants ?? this.tenants ?? []);
114567
114625
  }
114568
114626
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
114569
114627
  async updateTenants(fullOrgDetails) {
@@ -114687,12 +114745,9 @@ var CustomConnectionsXeroClient = class extends MCPXeroClient {
114687
114745
  }
114688
114746
  }
114689
114747
  );
114690
- if (connectionsResponse.data && connectionsResponse.data.length > 0) {
114691
- this.tenantId = pickTenantId(
114692
- connectionsResponse.data,
114693
- process.env.XERO_TENANT_ID
114694
- );
114695
- }
114748
+ const connections = Array.isArray(connectionsResponse.data) ? connectionsResponse.data : [];
114749
+ this.tokenTenants = connections;
114750
+ this.tenantId = pickTenantId(connections, process.env.XERO_TENANT_ID);
114696
114751
  return response.data;
114697
114752
  }
114698
114753
  async authenticate() {
@@ -120917,12 +120972,14 @@ var ListOrganisationsTool = CreateXeroTool(
120917
120972
  isError: true
120918
120973
  };
120919
120974
  }
120975
+ const single = allowed.length === 1;
120920
120976
  const lines = allowed.map(
120921
- (t, i) => `${i + 1}. ${t.tenantName ?? "(name unknown)"} - tenant_id: ${t.tenantId}${i === 0 ? " (default)" : ""}`
120977
+ (t, i) => `${i + 1}. ${t.tenantName ?? "(name unknown)"} - tenant_id: ${t.tenantId}${single ? " (default)" : ""}`
120922
120978
  );
120979
+ const footer = single ? "" : "\nThere is no default: pass tenant_id on every Xero call to choose one of these.";
120923
120980
  return {
120924
120981
  content: [{ type: "text", text: `Xero organisations this agent may use:
120925
- ${lines.join("\n")}` }]
120982
+ ${lines.join("\n")}${footer}` }]
120926
120983
  };
120927
120984
  } catch (error2) {
120928
120985
  return {
@@ -120934,41 +120991,6 @@ ${lines.join("\n")}` }]
120934
120991
  );
120935
120992
  var list_organisations_tool_default = ListOrganisationsTool;
120936
120993
 
120937
- // src/helpers/resolve-call-tenant.ts
120938
- function describe(allowed) {
120939
- return allowed.map((t) => t.tenantName ? `${t.tenantName} (${t.tenantId})` : t.tenantId).join(", ");
120940
- }
120941
- function resolveCallTenant(allowed, requested) {
120942
- const wanted = typeof requested === "string" ? requested.trim() : "";
120943
- if (allowed !== null && allowed.length === 0) {
120944
- return {
120945
- ok: false,
120946
- message: "This agent has no Xero organisations selected, so no Xero call can run. Ask an admin to choose the organisations for this integration."
120947
- };
120948
- }
120949
- if (allowed === null) {
120950
- if (wanted) {
120951
- return {
120952
- ok: false,
120953
- message: `tenant_id ${wanted} cannot be used: this Xero connection has no organisation list to check it against.`
120954
- };
120955
- }
120956
- return { ok: true, tenantId: void 0 };
120957
- }
120958
- if (wanted) {
120959
- if (allowed.some((t) => t.tenantId === wanted)) return { ok: true, tenantId: wanted };
120960
- return {
120961
- ok: false,
120962
- message: `tenant_id ${wanted} is not one of the Xero organisations this agent may use: ${describe(allowed)}.`
120963
- };
120964
- }
120965
- if (allowed.length === 1) return { ok: true, tenantId: allowed[0].tenantId };
120966
- return {
120967
- ok: false,
120968
- message: `This agent can use more than one Xero organisation, so pass tenant_id. Allowed: ${describe(allowed)}. Call list-organisations to see them.`
120969
- };
120970
- }
120971
-
120972
120994
  // src/tools/tenant-scope.ts
120973
120995
  var TENANT_ID_ARG_DESCRIPTION = "Optional. The Xero organisation id (tenant) to use. Needed only when this agent can use more than one Xero organisation; call list-organisations to see them. Defaults to the only allowed organisation.";
120974
120996
  function errorResult(text) {
@@ -68,8 +68,8 @@ import {
68
68
  writeDirectChatSessionState,
69
69
  writeEgressAllowlist,
70
70
  writePersistentClaudeWrapper
71
- } from "./chunk-XJ4JK4C7.js";
72
- import "./chunk-NEGFSB2W.js";
71
+ } from "./chunk-672WJ7K3.js";
72
+ import "./chunk-36PNRFZD.js";
73
73
  import "./chunk-OCMJ5E6J.js";
74
74
  import "./chunk-XWVM4KPK.js";
75
75
  import "./chunk-EL5MWGGH.js";
@@ -145,4 +145,4 @@ export {
145
145
  writeEgressAllowlist,
146
146
  writePersistentClaudeWrapper
147
147
  };
148
- //# sourceMappingURL=persistent-session-35BXCGHB.js.map
148
+ //# sourceMappingURL=persistent-session-V2TJ6HPL.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-XJ4JK4C7.js";
4
- import "./chunk-NEGFSB2W.js";
3
+ } from "./chunk-672WJ7K3.js";
4
+ import "./chunk-36PNRFZD.js";
5
5
  import "./chunk-OCMJ5E6J.js";
6
6
  import "./chunk-XWVM4KPK.js";
7
7
  import "./chunk-EL5MWGGH.js";
@@ -802,4 +802,4 @@ export {
802
802
  readAndResetSlackReplyBindingClassifications,
803
803
  readAndResetSlackReplyTargetClassifications
804
804
  };
805
- //# sourceMappingURL=responsiveness-probe-VDL3QULE.js.map
805
+ //# sourceMappingURL=responsiveness-probe-2JSH5Y3H.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sessionTranscriptDir
3
- } from "./chunk-NEGFSB2W.js";
3
+ } from "./chunk-36PNRFZD.js";
4
4
  import "./chunk-DGUM43GV.js";
5
5
 
6
6
  // src/lib/session-auth-dead.ts
@@ -204,4 +204,4 @@ export {
204
204
  decideSessionAuthState,
205
205
  probeSessionAuth
206
206
  };
207
- //# sourceMappingURL=session-auth-dead-L7ZD5ZZO.js.map
207
+ //# sourceMappingURL=session-auth-dead-WUMWF4GK.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.1084",
3
+ "version": "0.28.1086",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {