@integrity-labs/agt-cli 0.28.138 → 0.28.140

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/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,
@@ -34,8 +34,8 @@ import {
34
34
  writeDirectChatSessionState,
35
35
  writeEgressAllowlist,
36
36
  writePersistentClaudeWrapper
37
- } from "./chunk-NGES4EZD.js";
38
- import "./chunk-ROOFBKRE.js";
37
+ } from "./chunk-6GNDRA3F.js";
38
+ import "./chunk-WI6HYZ7K.js";
39
39
  import "./chunk-XWVM4KPK.js";
40
40
  export {
41
41
  EGRESS_BASELINE_DOMAINS,
@@ -74,4 +74,4 @@ export {
74
74
  writeEgressAllowlist,
75
75
  writePersistentClaudeWrapper
76
76
  };
77
- //# sourceMappingURL=persistent-session-SVZCOP7I.js.map
77
+ //# sourceMappingURL=persistent-session-BRGQGGZY.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-NGES4EZD.js";
4
- import "./chunk-ROOFBKRE.js";
3
+ } from "./chunk-6GNDRA3F.js";
4
+ import "./chunk-WI6HYZ7K.js";
5
5
  import "./chunk-XWVM4KPK.js";
6
6
 
7
7
  // src/lib/responsiveness-probe.ts
@@ -304,4 +304,4 @@ export {
304
304
  readAndResetChannelDeflections,
305
305
  readAndResetChannelLaneClassifications
306
306
  };
307
- //# sourceMappingURL=responsiveness-probe-AS7ASMDE.js.map
307
+ //# sourceMappingURL=responsiveness-probe-RZYQMCM3.js.map
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.140",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {