@integrity-labs/agt-cli 0.27.119 → 0.27.120
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
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
success,
|
|
29
29
|
table,
|
|
30
30
|
warn
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-I2K6JKWP.js";
|
|
32
32
|
import {
|
|
33
33
|
CHANNEL_REGISTRY,
|
|
34
34
|
DEPLOYMENT_TEMPLATES,
|
|
@@ -4934,7 +4934,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4934
4934
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4935
4935
|
import chalk18 from "chalk";
|
|
4936
4936
|
import ora16 from "ora";
|
|
4937
|
-
var cliVersion = true ? "0.27.
|
|
4937
|
+
var cliVersion = true ? "0.27.120" : "dev";
|
|
4938
4938
|
async function fetchLatestVersion() {
|
|
4939
4939
|
const host2 = getHost();
|
|
4940
4940
|
if (!host2) return null;
|
|
@@ -5857,7 +5857,7 @@ function handleError(err) {
|
|
|
5857
5857
|
}
|
|
5858
5858
|
|
|
5859
5859
|
// src/bin/agt.ts
|
|
5860
|
-
var cliVersion2 = true ? "0.27.
|
|
5860
|
+
var cliVersion2 = true ? "0.27.120" : "dev";
|
|
5861
5861
|
var program = new Command();
|
|
5862
5862
|
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");
|
|
5863
5863
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
provisionStopHook,
|
|
18
18
|
requireHost,
|
|
19
19
|
safeWriteJsonAtomic
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-I2K6JKWP.js";
|
|
21
21
|
import {
|
|
22
22
|
getProjectDir as getProjectDir2,
|
|
23
23
|
getReadyTasks,
|
|
@@ -4366,7 +4366,7 @@ var cachedMaintenanceWindow = null;
|
|
|
4366
4366
|
var lastVersionCheckAt = 0;
|
|
4367
4367
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
4368
4368
|
var lastResponsivenessProbeAt = 0;
|
|
4369
|
-
var agtCliVersion = true ? "0.27.
|
|
4369
|
+
var agtCliVersion = true ? "0.27.120" : "dev";
|
|
4370
4370
|
function resolveBrewPath(execFileSync4) {
|
|
4371
4371
|
try {
|
|
4372
4372
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -15266,6 +15266,165 @@ function buildSafeInboundPath2(codeName, fileId, mimetype) {
|
|
|
15266
15266
|
return buildSafeInboundPath(resolveSlackInboundDir(codeName), fileId, mimetype);
|
|
15267
15267
|
}
|
|
15268
15268
|
|
|
15269
|
+
// src/slack-rich-text.ts
|
|
15270
|
+
var MAX_DEPTH = 12;
|
|
15271
|
+
function isRecord(v) {
|
|
15272
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
15273
|
+
}
|
|
15274
|
+
function asString(v) {
|
|
15275
|
+
return typeof v === "string" ? v : "";
|
|
15276
|
+
}
|
|
15277
|
+
function asArray(v) {
|
|
15278
|
+
return Array.isArray(v) ? v : [];
|
|
15279
|
+
}
|
|
15280
|
+
function isTableElement(el) {
|
|
15281
|
+
return isRecord(el) && asString(el.type).includes("table");
|
|
15282
|
+
}
|
|
15283
|
+
function renderEmoji(el) {
|
|
15284
|
+
const unicode = asString(el.unicode);
|
|
15285
|
+
if (unicode) {
|
|
15286
|
+
try {
|
|
15287
|
+
const cps = unicode.split("-").map((h) => parseInt(h, 16));
|
|
15288
|
+
if (cps.every((n) => Number.isFinite(n) && n >= 0 && n <= 1114111)) {
|
|
15289
|
+
return String.fromCodePoint(...cps);
|
|
15290
|
+
}
|
|
15291
|
+
} catch {
|
|
15292
|
+
}
|
|
15293
|
+
}
|
|
15294
|
+
const name = asString(el.name);
|
|
15295
|
+
return name ? `:${name}:` : "";
|
|
15296
|
+
}
|
|
15297
|
+
function renderLeaf(el) {
|
|
15298
|
+
if (!isRecord(el)) return "";
|
|
15299
|
+
switch (asString(el.type)) {
|
|
15300
|
+
case "text":
|
|
15301
|
+
return asString(el.text);
|
|
15302
|
+
case "link": {
|
|
15303
|
+
const label = asString(el.text);
|
|
15304
|
+
const url = asString(el.url);
|
|
15305
|
+
if (label && url && label !== url) return `${label} (${url})`;
|
|
15306
|
+
return label || url;
|
|
15307
|
+
}
|
|
15308
|
+
case "emoji":
|
|
15309
|
+
return renderEmoji(el);
|
|
15310
|
+
case "user":
|
|
15311
|
+
return `<@${asString(el.user_id)}>`;
|
|
15312
|
+
case "usergroup":
|
|
15313
|
+
return `<!subteam^${asString(el.usergroup_id)}>`;
|
|
15314
|
+
case "channel":
|
|
15315
|
+
return `<#${asString(el.channel_id)}>`;
|
|
15316
|
+
case "broadcast":
|
|
15317
|
+
return `@${asString(el.range) || "channel"}`;
|
|
15318
|
+
case "date":
|
|
15319
|
+
return asString(el.fallback) || asString(el.timestamp);
|
|
15320
|
+
default:
|
|
15321
|
+
if (Array.isArray(el.elements)) return renderInline(el.elements);
|
|
15322
|
+
return asString(el.text);
|
|
15323
|
+
}
|
|
15324
|
+
}
|
|
15325
|
+
function renderInline(elements) {
|
|
15326
|
+
return elements.map(renderLeaf).join("");
|
|
15327
|
+
}
|
|
15328
|
+
function deepText(node, depth) {
|
|
15329
|
+
if (depth > MAX_DEPTH) return "";
|
|
15330
|
+
if (typeof node === "string") return node;
|
|
15331
|
+
if (Array.isArray(node)) return node.map((n) => deepText(n, depth + 1)).join("");
|
|
15332
|
+
if (!isRecord(node)) return "";
|
|
15333
|
+
const type = asString(node.type);
|
|
15334
|
+
if (type && type !== "rich_text" && !type.startsWith("rich_text_") && !type.includes("table")) {
|
|
15335
|
+
return renderLeaf(node);
|
|
15336
|
+
}
|
|
15337
|
+
if (Array.isArray(node.elements)) return node.elements.map((n) => deepText(n, depth + 1)).join("");
|
|
15338
|
+
if (Array.isArray(node.rows)) return node.rows.map((n) => deepText(n, depth + 1)).join(" ");
|
|
15339
|
+
return asString(node.text);
|
|
15340
|
+
}
|
|
15341
|
+
function renderCell(cell) {
|
|
15342
|
+
if (!isRecord(cell)) return deepText(cell, 0).replace(/\s*\n\s*/g, " ").trim();
|
|
15343
|
+
const inner = Array.isArray(cell.elements) ? renderSection(cell, 0) : deepText(cell, 0);
|
|
15344
|
+
return inner.replace(/\s*\n\s*/g, " ").trim();
|
|
15345
|
+
}
|
|
15346
|
+
function renderTable(el) {
|
|
15347
|
+
const rawRows = asArray(el.elements).length ? asArray(el.elements) : asArray(el.rows);
|
|
15348
|
+
const rows = [];
|
|
15349
|
+
for (const row of rawRows) {
|
|
15350
|
+
if (!isRecord(row) && !Array.isArray(row)) continue;
|
|
15351
|
+
const rawCells = Array.isArray(row) ? row : asArray(row.elements).length ? asArray(row.elements) : asArray(row.cells);
|
|
15352
|
+
if (rawCells.length === 0) continue;
|
|
15353
|
+
rows.push(rawCells.map(renderCell));
|
|
15354
|
+
}
|
|
15355
|
+
if (rows.length === 0) {
|
|
15356
|
+
const fallback = deepText(el, 0).replace(/[ \t]+\n/g, "\n").trim();
|
|
15357
|
+
return fallback;
|
|
15358
|
+
}
|
|
15359
|
+
const colCount = rows.reduce((max, r) => Math.max(max, r.length), 0);
|
|
15360
|
+
const pad = (r) => {
|
|
15361
|
+
const cells = r.slice();
|
|
15362
|
+
while (cells.length < colCount) cells.push("");
|
|
15363
|
+
return cells.map((c) => c.replace(/\|/g, "\\|"));
|
|
15364
|
+
};
|
|
15365
|
+
const lines = [];
|
|
15366
|
+
const header = rows[0] ?? [];
|
|
15367
|
+
const body = rows.slice(1);
|
|
15368
|
+
lines.push(`| ${pad(header).join(" | ")} |`);
|
|
15369
|
+
lines.push(`| ${Array.from({ length: colCount }, () => "---").join(" | ")} |`);
|
|
15370
|
+
for (const r of body) lines.push(`| ${pad(r).join(" | ")} |`);
|
|
15371
|
+
return lines.join("\n");
|
|
15372
|
+
}
|
|
15373
|
+
function renderSection(section, depth) {
|
|
15374
|
+
if (depth > MAX_DEPTH || !isRecord(section)) return "";
|
|
15375
|
+
const type = asString(section.type);
|
|
15376
|
+
if (isTableElement(section)) return renderTable(section);
|
|
15377
|
+
switch (type) {
|
|
15378
|
+
case "rich_text_section":
|
|
15379
|
+
return renderInline(asArray(section.elements));
|
|
15380
|
+
case "rich_text_preformatted": {
|
|
15381
|
+
const code = renderInline(asArray(section.elements));
|
|
15382
|
+
return code ? `\`\`\`
|
|
15383
|
+
${code}
|
|
15384
|
+
\`\`\`` : "";
|
|
15385
|
+
}
|
|
15386
|
+
case "rich_text_quote": {
|
|
15387
|
+
const quoted = renderInline(asArray(section.elements));
|
|
15388
|
+
return quoted ? quoted.split("\n").map((l) => `> ${l}`).join("\n") : "";
|
|
15389
|
+
}
|
|
15390
|
+
case "rich_text_list": {
|
|
15391
|
+
const ordered = asString(section.style) === "ordered";
|
|
15392
|
+
const items = asArray(section.elements).map((item, i) => {
|
|
15393
|
+
const body = renderSection(item, depth + 1) || renderInline(asArray(item?.elements));
|
|
15394
|
+
const marker = ordered ? `${i + 1}.` : "-";
|
|
15395
|
+
return `${marker} ${body}`.trimEnd();
|
|
15396
|
+
});
|
|
15397
|
+
return items.join("\n");
|
|
15398
|
+
}
|
|
15399
|
+
default:
|
|
15400
|
+
if (Array.isArray(section.elements)) return renderInline(asArray(section.elements));
|
|
15401
|
+
return deepText(section, depth + 1);
|
|
15402
|
+
}
|
|
15403
|
+
}
|
|
15404
|
+
function renderSlackBlocks(blocks) {
|
|
15405
|
+
let hadTable = false;
|
|
15406
|
+
const out = [];
|
|
15407
|
+
try {
|
|
15408
|
+
for (const block of asArray(blocks)) {
|
|
15409
|
+
if (!isRecord(block) || asString(block.type) !== "rich_text") continue;
|
|
15410
|
+
for (const section of asArray(block.elements)) {
|
|
15411
|
+
if (isTableElement(section)) hadTable = true;
|
|
15412
|
+
const rendered = renderSection(section, 0);
|
|
15413
|
+
if (rendered.trim().length > 0) out.push(rendered);
|
|
15414
|
+
}
|
|
15415
|
+
}
|
|
15416
|
+
} catch {
|
|
15417
|
+
}
|
|
15418
|
+
const text = out.join("\n\n").replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
15419
|
+
return { text, hadTable };
|
|
15420
|
+
}
|
|
15421
|
+
function mergeInboundText(text, blocks) {
|
|
15422
|
+
const { text: rendered, hadTable } = renderSlackBlocks(blocks);
|
|
15423
|
+
if (!hadTable) return { content: text, recoveredTable: false };
|
|
15424
|
+
const content = rendered.length > 0 ? rendered : text;
|
|
15425
|
+
return { content, recoveredTable: rendered.length > 0 && content !== text };
|
|
15426
|
+
}
|
|
15427
|
+
|
|
15269
15428
|
// src/slack-response-mode.ts
|
|
15270
15429
|
var MODES = [
|
|
15271
15430
|
"mention_only",
|
|
@@ -18788,10 +18947,17 @@ async function connectSocketMode() {
|
|
|
18788
18947
|
);
|
|
18789
18948
|
}
|
|
18790
18949
|
}
|
|
18950
|
+
const { content: inboundContent, recoveredTable } = mergeInboundText(text, evt.blocks);
|
|
18951
|
+
if (recoveredTable) {
|
|
18952
|
+
process.stderr.write(
|
|
18953
|
+
`slack-channel(${AGENT_CODE_NAME}): recovered rich_text table from blocks (channel=${redactSlackId(channel)} ts=${redactSlackId(ts)})
|
|
18954
|
+
`
|
|
18955
|
+
);
|
|
18956
|
+
}
|
|
18791
18957
|
await mcp.notification({
|
|
18792
18958
|
method: "notifications/claude/channel",
|
|
18793
18959
|
params: {
|
|
18794
|
-
content:
|
|
18960
|
+
content: inboundContent,
|
|
18795
18961
|
meta: {
|
|
18796
18962
|
user,
|
|
18797
18963
|
user_name: userName,
|
package/package.json
CHANGED
|
File without changes
|