@integrity-labs/agt-cli 0.28.770 → 0.28.771

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
@@ -41,7 +41,7 @@ import {
41
41
  success,
42
42
  table,
43
43
  warn
44
- } from "../chunk-E4YS6E4T.js";
44
+ } from "../chunk-BOYUCA64.js";
45
45
  import {
46
46
  getProjectDir,
47
47
  isSessionResumeDisabled,
@@ -5467,7 +5467,7 @@ import { execFileSync, execSync } from "child_process";
5467
5467
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5468
5468
  import chalk18 from "chalk";
5469
5469
  import ora16 from "ora";
5470
- var cliVersion = true ? "0.28.770" : "dev";
5470
+ var cliVersion = true ? "0.28.771" : "dev";
5471
5471
  async function fetchLatestVersion() {
5472
5472
  const host2 = getHost();
5473
5473
  if (!host2) return null;
@@ -6658,7 +6658,7 @@ function handleError(err) {
6658
6658
  }
6659
6659
 
6660
6660
  // src/bin/agt.ts
6661
- var cliVersion2 = true ? "0.28.770" : "dev";
6661
+ var cliVersion2 = true ? "0.28.771" : "dev";
6662
6662
  var program = new Command();
6663
6663
  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");
6664
6664
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6452,7 +6452,7 @@ function exchangeFailureKind(err) {
6452
6452
  }
6453
6453
 
6454
6454
  // src/lib/api-client.ts
6455
- var agtCliVersion = true ? "0.28.770" : "dev";
6455
+ var agtCliVersion = true ? "0.28.771" : "dev";
6456
6456
  var lastConfigHash = null;
6457
6457
  function setConfigHash(hash) {
6458
6458
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -10655,4 +10655,4 @@ export {
10655
10655
  managerInstallSystemUnitCommand,
10656
10656
  managerUninstallSystemUnitCommand
10657
10657
  };
10658
- //# sourceMappingURL=chunk-E4YS6E4T.js.map
10658
+ //# sourceMappingURL=chunk-BOYUCA64.js.map
@@ -58,7 +58,7 @@ import {
58
58
  safeWriteJsonAtomic,
59
59
  setConfigHash,
60
60
  tripClass
61
- } from "../chunk-E4YS6E4T.js";
61
+ } from "../chunk-BOYUCA64.js";
62
62
  import {
63
63
  getProjectDir as getProjectDir2,
64
64
  getReadyTasks,
@@ -13530,7 +13530,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
13530
13530
  var lastVersionCheckAt = 0;
13531
13531
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
13532
13532
  var lastResponsivenessProbeAt = 0;
13533
- var agtCliVersion = true ? "0.28.770" : "dev";
13533
+ var agtCliVersion = true ? "0.28.771" : "dev";
13534
13534
  function resolveBrewPath(execFileSync2) {
13535
13535
  try {
13536
13536
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
package/dist/mcp/xero.js CHANGED
@@ -116594,6 +116594,81 @@ async function getXeroRepeatingInvoice(repeatingInvoiceID) {
116594
116594
  }
116595
116595
  }
116596
116596
 
116597
+ // src/helpers/repeating-invoice-generation.ts
116598
+ function normaliseStatus(v) {
116599
+ if (v === void 0 || v === null) return null;
116600
+ if (typeof v !== "string" && typeof v !== "number") return null;
116601
+ const s = String(v).trim();
116602
+ return s.length > 0 ? s.toUpperCase() : null;
116603
+ }
116604
+ function generationVerdict(t) {
116605
+ const status = normaliseStatus(t.status);
116606
+ if (!status) {
116607
+ return {
116608
+ willGenerate: false,
116609
+ reason: "GENERATION UNKNOWN: Xero returned no status for this template."
116610
+ };
116611
+ }
116612
+ if (status === "DELETED" || status === "VOIDED") {
116613
+ return {
116614
+ willGenerate: false,
116615
+ reason: `WILL NOT GENERATE: template is ${status}.`
116616
+ };
116617
+ }
116618
+ if (status !== "AUTHORISED") {
116619
+ return {
116620
+ willGenerate: false,
116621
+ reason: `WILL NOT GENERATE: status is ${status}. Only AUTHORISED templates generate invoices. Set it with update-repeating-invoice \u2014 and confirm the amount, cadence and counterparty with a human first, because authorising a template starts billing someone on a schedule.`
116622
+ };
116623
+ }
116624
+ const end = t.schedule?.endDate;
116625
+ const next = t.schedule?.nextScheduledDate;
116626
+ if (end && isBoundaryAmbiguous(end)) {
116627
+ return {
116628
+ willGenerate: false,
116629
+ reason: `GENERATION UNKNOWN: AUTHORISED and the schedule ends ${end}, which is within a day of now. Xero generates in the organisation's time zone and this check compares in UTC, so the two can disagree by a calendar day at the boundary. Confirm in Xero before acting on this one.`
116630
+ };
116631
+ }
116632
+ if (end && isPast(end)) {
116633
+ return {
116634
+ willGenerate: false,
116635
+ reason: `WILL NOT GENERATE: AUTHORISED but the schedule ended ${end}.`
116636
+ };
116637
+ }
116638
+ if (!next) {
116639
+ return {
116640
+ willGenerate: false,
116641
+ reason: "GENERATION UNKNOWN: AUTHORISED but Xero returned no next scheduled date, so the next run cannot be confirmed from here."
116642
+ };
116643
+ }
116644
+ return {
116645
+ willGenerate: true,
116646
+ reason: `Generates: AUTHORISED, next invoice ${next}${end ? `, ends ${end}` : ""}.`
116647
+ };
116648
+ }
116649
+ function isPast(dateStr) {
116650
+ const t = Date.parse(dateStr);
116651
+ if (Number.isNaN(t)) return false;
116652
+ const endOfDay = new Date(t);
116653
+ endOfDay.setUTCHours(23, 59, 59, 999);
116654
+ return endOfDay.getTime() < Date.now();
116655
+ }
116656
+ var MAX_TZ_AHEAD_MS = 14 * 60 * 60 * 1e3;
116657
+ var MAX_TZ_BEHIND_MS = 12 * 60 * 60 * 1e3;
116658
+ function isBoundaryAmbiguous(dateStr) {
116659
+ const t = Date.parse(dateStr);
116660
+ if (Number.isNaN(t)) return false;
116661
+ const endOfDayUtc = new Date(t);
116662
+ endOfDayUtc.setUTCHours(23, 59, 59, 999);
116663
+ const end = endOfDayUtc.getTime();
116664
+ const now = Date.now();
116665
+ return now >= end - MAX_TZ_AHEAD_MS && now <= end + MAX_TZ_BEHIND_MS;
116666
+ }
116667
+ function sendSettingsLine(t) {
116668
+ const flag = (v) => v === void 0 ? "unknown" : v ? "yes" : "no";
116669
+ return `Sending: approvedForSending=${flag(t.approvedForSending)}, sendCopy=${flag(t.sendCopy)}, markAsSent=${flag(t.markAsSent)}, includePDF=${flag(t.includePDF)}` + (t.approvedForSending === false ? " \u2014 NOT approved for sending, so generated invoices are not emailed to the contact." : "");
116670
+ }
116671
+
116597
116672
  // src/tools/get/get-repeating-invoice.tool.ts
116598
116673
  var GetRepeatingInvoiceTool = CreateXeroTool(
116599
116674
  "get-repeating-invoice",
@@ -116630,6 +116705,8 @@ var GetRepeatingInvoiceTool = CreateXeroTool(
116630
116705
  type: "text",
116631
116706
  text: [
116632
116707
  `RepeatingInvoiceID: ${t.repeatingInvoiceID}`,
116708
+ // CS-1635: state the conclusion, not just the evidence.
116709
+ generationVerdict(t).reason,
116633
116710
  t.contact ? `Contact: ${t.contact.name} (${t.contact.contactID})` : null,
116634
116711
  t.type ? `Type: ${t.type}` : null,
116635
116712
  t.status ? `Status: ${t.status}` : null,
@@ -116638,6 +116715,7 @@ var GetRepeatingInvoiceTool = CreateXeroTool(
116638
116715
  t.subTotal !== void 0 ? `Sub Total: ${t.subTotal}` : null,
116639
116716
  t.totalTax !== void 0 ? `Total Tax: ${t.totalTax}` : null,
116640
116717
  t.currencyCode ? `Currency: ${t.currencyCode}` : null,
116718
+ sendSettingsLine(t),
116641
116719
  t.lineAmountTypes ? `Line Amount Types: ${t.lineAmountTypes}` : null,
116642
116720
  t.schedule ? `Schedule: every ${t.schedule.period ?? "?"} ${t.schedule.unit ?? ""}, start ${t.schedule.startDate ?? "?"}, due ${t.schedule.dueDate ?? "?"} (${t.schedule.dueDateType ?? "?"}), next ${t.schedule.nextScheduledDate ?? "?"}, end ${t.schedule.endDate ?? "open-ended"}` : null,
116643
116721
  t.lineItems?.length ? `Line Items:
@@ -119042,7 +119120,7 @@ async function listXeroRepeatingInvoices() {
119042
119120
  // src/tools/list/list-repeating-invoices.tool.ts
119043
119121
  var ListRepeatingInvoicesTool = CreateXeroTool(
119044
119122
  "list-repeating-invoices",
119045
- "List every repeating (recurring) invoice template configured on the Xero tenant. Each template defines an invoice that Xero auto-generates on a schedule (weekly/monthly/etc.). Use this to look up the RepeatingInvoiceID before calling get-repeating-invoice or update-repeating-invoice. The endpoint does not support pagination \u2014 all templates are returned.",
119123
+ "List every repeating (recurring) invoice template configured on the Xero tenant. Each template defines an invoice that Xero auto-generates on a schedule (weekly/monthly/etc.). Use this to look up the RepeatingInvoiceID before calling get-repeating-invoice or update-repeating-invoice. The endpoint does not support pagination \u2014 all templates are returned. CS-1635: every row states outright whether it WILL GENERATE and why, plus its next scheduled date and its sending settings. A template can be perfectly configured, sit in DRAFT, and generate nothing \u2014 read the verdict line rather than inferring from Status.",
119046
119124
  {},
119047
119125
  async () => {
119048
119126
  const response = await listXeroRepeatingInvoices();
@@ -119067,6 +119145,10 @@ var ListRepeatingInvoicesTool = CreateXeroTool(
119067
119145
  type: "text",
119068
119146
  text: [
119069
119147
  `RepeatingInvoiceID: ${t.repeatingInvoiceID}`,
119148
+ // CS-1635: the conclusion, first, because it is the question being
119149
+ // asked. Printing Status and leaving the reader to know that DRAFT
119150
+ // means "silent" is how 14 of 15 templates sat dead unnoticed.
119151
+ generationVerdict(t).reason,
119070
119152
  t.contact ? `Contact: ${t.contact.name} (${t.contact.contactID})` : null,
119071
119153
  t.type ? `Type: ${t.type}` : null,
119072
119154
  t.status ? `Status: ${t.status}` : null,
@@ -119074,6 +119156,12 @@ var ListRepeatingInvoicesTool = CreateXeroTool(
119074
119156
  t.total !== void 0 ? `Total: ${t.total}` : null,
119075
119157
  t.currencyCode ? `Currency: ${t.currencyCode}` : null,
119076
119158
  t.schedule ? `Schedule: every ${t.schedule.period ?? "?"} ${t.schedule.unit ?? ""} starting ${t.schedule.startDate ?? "?"}` : null,
119159
+ t.schedule?.nextScheduledDate ? `Next scheduled: ${t.schedule.nextScheduledDate}` : null,
119160
+ t.schedule?.endDate ? `Schedule ends: ${t.schedule.endDate}` : null,
119161
+ // CS-1635 asks for this by name: the send setting was not exposed
119162
+ // anywhere, so a template could generate and never reach the
119163
+ // customer with nothing in any tool saying so.
119164
+ sendSettingsLine(t),
119077
119165
  t.lineAmountTypes ? `Line Amount Types: ${t.lineAmountTypes}` : null
119078
119166
  ].filter(Boolean).join("\n")
119079
119167
  }))
@@ -120609,12 +120697,12 @@ async function updateXeroRepeatingInvoice(repeatingInvoiceID, patch) {
120609
120697
  error: `RepeatingInvoice ${repeatingInvoiceID} not found.`
120610
120698
  };
120611
120699
  }
120612
- const noChange = patch.reference === void 0 && patch.lineItems === void 0 && patch.status === void 0 && patch.contactId === void 0;
120700
+ const noChange = patch.reference === void 0 && patch.lineItems === void 0 && patch.status === void 0 && patch.contactId === void 0 && patch.approvedForSending === void 0;
120613
120701
  if (noChange) {
120614
120702
  return {
120615
120703
  result: null,
120616
120704
  isError: true,
120617
- error: "No fields supplied to update. Pass at least one of reference, lineItems, status, or contactId."
120705
+ error: "No fields supplied to update. Pass at least one of reference, lineItems, status, contactId, or approvedForSending."
120618
120706
  };
120619
120707
  }
120620
120708
  const xeroPatch = {};
@@ -120625,6 +120713,9 @@ async function updateXeroRepeatingInvoice(repeatingInvoiceID, patch) {
120625
120713
  if (patch.contactId !== void 0) {
120626
120714
  xeroPatch.contact = { contactID: patch.contactId };
120627
120715
  }
120716
+ if (patch.approvedForSending !== void 0) {
120717
+ xeroPatch.approvedForSending = patch.approvedForSending;
120718
+ }
120628
120719
  if (patch.lineItems !== void 0) {
120629
120720
  xeroPatch.lineItems = patch.lineItems.map((li) => ({
120630
120721
  description: li.description,
@@ -120674,15 +120765,19 @@ var UpdateRepeatingInvoiceTool = CreateXeroTool(
120674
120765
  status: external_exports.enum(["DRAFT", "AUTHORISED"]).optional().describe(
120675
120766
  "Template status. DRAFT templates do NOT generate invoices; AUTHORISED templates do. Flipping a draft to AUTHORISED is high-risk and should be explicitly confirmed with the user."
120676
120767
  ),
120677
- contactId: external_exports.string().optional().describe("Replace the counterparty. Look up the ContactID via list-contacts first.")
120768
+ contactId: external_exports.string().optional().describe("Replace the counterparty. Look up the ContactID via list-contacts first."),
120769
+ approvedForSending: external_exports.boolean().optional().describe(
120770
+ 'CS-1635: whether Xero emails each generated invoice to the contact. A template can generate invoices perfectly and never send them, which looks identical to "working" from every other field. Setting this true starts emailing a customer on a schedule, so confirm it with a human first.'
120771
+ )
120678
120772
  },
120679
120773
  async (params) => {
120680
- const { repeatingInvoiceID, reference, lineItems, status, contactId } = params;
120774
+ const { repeatingInvoiceID, reference, lineItems, status, contactId, approvedForSending } = params;
120681
120775
  const result = await updateXeroRepeatingInvoice(repeatingInvoiceID, {
120682
120776
  reference,
120683
120777
  lineItems,
120684
120778
  status,
120685
- contactId
120779
+ contactId,
120780
+ approvedForSending
120686
120781
  });
120687
120782
  if (result.isError) {
120688
120783
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.770",
3
+ "version": "0.28.771",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {