@integrity-labs/agt-cli 0.28.138 → 0.28.139

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
@@ -37,7 +37,7 @@ import {
37
37
  success,
38
38
  table,
39
39
  warn
40
- } from "../chunk-QJCTWNIJ.js";
40
+ } from "../chunk-CVGZ2BZB.js";
41
41
  import {
42
42
  CHANNEL_REGISTRY,
43
43
  DEPLOYMENT_TEMPLATES,
@@ -4777,7 +4777,7 @@ import { execFileSync, execSync } from "child_process";
4777
4777
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4778
4778
  import chalk18 from "chalk";
4779
4779
  import ora16 from "ora";
4780
- var cliVersion = true ? "0.28.138" : "dev";
4780
+ var cliVersion = true ? "0.28.139" : "dev";
4781
4781
  async function fetchLatestVersion() {
4782
4782
  const host2 = getHost();
4783
4783
  if (!host2) return null;
@@ -5791,7 +5791,7 @@ function handleError(err) {
5791
5791
  }
5792
5792
 
5793
5793
  // src/bin/agt.ts
5794
- var cliVersion2 = true ? "0.28.138" : "dev";
5794
+ var cliVersion2 = true ? "0.28.139" : "dev";
5795
5795
  var program = new Command();
5796
5796
  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");
5797
5797
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -7746,7 +7746,7 @@ function requireHost() {
7746
7746
  }
7747
7747
 
7748
7748
  // src/lib/api-client.ts
7749
- var agtCliVersion = true ? "0.28.138" : "dev";
7749
+ var agtCliVersion = true ? "0.28.139" : "dev";
7750
7750
  var lastConfigHash = null;
7751
7751
  function setConfigHash(hash) {
7752
7752
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -9043,4 +9043,4 @@ export {
9043
9043
  managerInstallSystemUnitCommand,
9044
9044
  managerUninstallSystemUnitCommand
9045
9045
  };
9046
- //# sourceMappingURL=chunk-QJCTWNIJ.js.map
9046
+ //# sourceMappingURL=chunk-CVGZ2BZB.js.map
@@ -28,7 +28,7 @@ import {
28
28
  requireHost,
29
29
  safeWriteJsonAtomic,
30
30
  setConfigHash
31
- } from "../chunk-QJCTWNIJ.js";
31
+ } from "../chunk-CVGZ2BZB.js";
32
32
  import {
33
33
  getProjectDir as getProjectDir2,
34
34
  getReadyTasks,
@@ -7070,7 +7070,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
7070
7070
  var lastVersionCheckAt = 0;
7071
7071
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
7072
7072
  var lastResponsivenessProbeAt = 0;
7073
- var agtCliVersion = true ? "0.28.138" : "dev";
7073
+ var agtCliVersion = true ? "0.28.139" : "dev";
7074
7074
  function resolveBrewPath(execFileSync4) {
7075
7075
  try {
7076
7076
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
package/dist/mcp/index.js CHANGED
@@ -6798,6 +6798,11 @@ var require_dist = __commonJS({
6798
6798
  }
6799
6799
  });
6800
6800
 
6801
+ // src/index.ts
6802
+ import { mkdtemp, writeFile } from "fs/promises";
6803
+ import { tmpdir } from "os";
6804
+ import { basename, join as join3 } from "path";
6805
+
6801
6806
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
6802
6807
  var external_exports = {};
6803
6808
  __export(external_exports, {
@@ -23052,6 +23057,7 @@ var LOCAL_TOOL_NAMES = /* @__PURE__ */ new Set([
23052
23057
  "artefacts_list",
23053
23058
  "artefacts_get",
23054
23059
  "artefacts_get_source_chunk",
23060
+ "artefacts_download",
23055
23061
  // ADR-0017 Projects container (the reclaimed projects_* namespace). Read tools
23056
23062
  // shipped in v1; ENG-6769 adds agent-initiated create + post-creation tagging
23057
23063
  // of artefacts/tasks to a project. No projects_get_source_chunk — a project is
@@ -23193,6 +23199,92 @@ server.tool(
23193
23199
  ]
23194
23200
  })
23195
23201
  );
23202
+ var ARTEFACT_DOWNLOAD_MAX_ITEMS = 50;
23203
+ function safeDownloadName(name, fallback) {
23204
+ const base = basename(name).replace(/[^a-zA-Z0-9._-]/g, "_").replace(/^\.+/, "");
23205
+ return base.length > 0 ? base : fallback;
23206
+ }
23207
+ async function exportArtefactToFile(dir, artefactId, format, item) {
23208
+ const data = await apiPost(`/host/artefact/${encodeURIComponent(artefactId)}/export`, {
23209
+ agent_id: AGT_AGENT_ID,
23210
+ format,
23211
+ item
23212
+ });
23213
+ const fallback = `${artefactId}${item !== void 0 ? `-item-${item + 1}` : ""}.${format}`;
23214
+ const filePath = join3(dir, safeDownloadName(data.filename, fallback));
23215
+ const buf = Buffer.from(data.base64, "base64");
23216
+ await writeFile(filePath, buf);
23217
+ return { path: filePath, bytes: buf.length, contentType: data.content_type, version: data.version };
23218
+ }
23219
+ async function resolveItemCountForPng(artefactId) {
23220
+ try {
23221
+ const meta = await apiPost(`/host/published-artefact/${encodeURIComponent(artefactId)}`, { agent_id: AGT_AGENT_ID });
23222
+ const manifest = meta.artefact?.metadata?.manifest;
23223
+ if (manifest?.hasItems && typeof manifest.itemCount === "number" && manifest.itemCount > 1) {
23224
+ return { count: Math.min(manifest.itemCount, ARTEFACT_DOWNLOAD_MAX_ITEMS), total: manifest.itemCount };
23225
+ }
23226
+ } catch {
23227
+ }
23228
+ return { count: 1, total: 1 };
23229
+ }
23230
+ async function downloadArtefactText(params) {
23231
+ const dir = await mkdtemp(join3(tmpdir(), "augmented-artefact-"));
23232
+ let items;
23233
+ let truncatedFrom = null;
23234
+ if (params.format === "pdf") {
23235
+ items = [void 0];
23236
+ } else if (params.item === void 0) {
23237
+ const { count, total } = await resolveItemCountForPng(params.artefact_id);
23238
+ if (count > 1) {
23239
+ items = Array.from({ length: count }, (_, i) => i);
23240
+ if (total > count) truncatedFrom = total;
23241
+ } else {
23242
+ items = [void 0];
23243
+ }
23244
+ } else {
23245
+ items = [params.item];
23246
+ }
23247
+ const saved = [];
23248
+ let contentType = "";
23249
+ let version2 = 0;
23250
+ for (const item of items) {
23251
+ const r = await exportArtefactToFile(dir, params.artefact_id, params.format, item);
23252
+ saved.push({ path: r.path, bytes: r.bytes });
23253
+ contentType = r.contentType;
23254
+ version2 = r.version;
23255
+ }
23256
+ const fmt = params.format.toUpperCase();
23257
+ if (saved.length === 1) {
23258
+ const kb = Math.max(1, Math.round(saved[0].bytes / 1024));
23259
+ return [
23260
+ `Downloaded the artefact as ${fmt} (${kb} KB, v${version2}).`,
23261
+ `Saved to: ${saved[0].path}`,
23262
+ `Content-Type: ${contentType}`,
23263
+ "You can now attach or upload this file (e.g. send it over a channel)."
23264
+ ].join("\n");
23265
+ }
23266
+ const totalKb = Math.max(1, Math.round(saved.reduce((s, f) => s + f.bytes, 0) / 1024));
23267
+ const header = truncatedFrom ? `Downloaded the first ${saved.length} of ${truncatedFrom} items as separate ${fmt} files (${totalKb} KB total, v${version2}). To get a later page, call again with its item index:` : `Downloaded ${saved.length} items as separate ${fmt} files (${totalKb} KB total, v${version2}):`;
23268
+ return [
23269
+ header,
23270
+ ...saved.map((f) => `- ${f.path}`),
23271
+ "You can now attach or upload these files (e.g. send them over a channel)."
23272
+ ].join("\n");
23273
+ }
23274
+ server.tool(
23275
+ "artefacts_download",
23276
+ "Download a published artefact as a PDF or image (PNG) file(s) on this host, returning the saved file path(s) so you can attach, upload, or send them. pdf gives one multi-page document (one page per carousel item). png with an item index gives that single page. png with NO item index gives one PNG per item for a multi-item carousel (or a single PNG for a one-item artefact). Video downloads are not supported yet (tracked in ENG-6776).",
23277
+ {
23278
+ artefact_id: external_exports.string().uuid().describe("The artefact id returned by artefacts_list"),
23279
+ format: external_exports.enum(["pdf", "png"]).describe('Output format: "pdf" (carousel document) or "png" (image)'),
23280
+ item: external_exports.number().int().min(0).optional().describe(
23281
+ "For a carousel, the 0-based page index to export as a single PNG. Omit to get one PNG per item (png) or the full multi-page document (pdf)."
23282
+ )
23283
+ },
23284
+ async (params) => ({
23285
+ content: [{ type: "text", text: await downloadArtefactText(params) }]
23286
+ })
23287
+ );
23196
23288
  async function listProjectsText(params) {
23197
23289
  const data = await apiPost("/host/my-projects", {
23198
23290
  agent_id: AGT_AGENT_ID,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.138",
3
+ "version": "0.28.139",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {