@integrity-labs/agt-cli 0.28.754 → 0.28.756

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.
@@ -39550,6 +39550,72 @@ function emitMarkdownToMrkdwnTelemetry(channel, links = 0, images = 0) {
39550
39550
  }
39551
39551
  }
39552
39552
 
39553
+ // src/decode-html-entities.ts
39554
+ var RESERVED_CODE_POINTS = /* @__PURE__ */ new Set([38, 60, 62]);
39555
+ var NAMED = {
39556
+ mdash: "\u2014",
39557
+ ndash: "\u2013",
39558
+ nbsp: " ",
39559
+ hellip: "\u2026",
39560
+ lsquo: "\u2018",
39561
+ rsquo: "\u2019",
39562
+ ldquo: "\u201C",
39563
+ rdquo: "\u201D",
39564
+ bull: "\u2022",
39565
+ middot: "\xB7",
39566
+ times: "\xD7",
39567
+ trade: "\u2122",
39568
+ copy: "\xA9",
39569
+ reg: "\xAE",
39570
+ deg: "\xB0",
39571
+ laquo: "\xAB",
39572
+ raquo: "\xBB",
39573
+ quot: '"',
39574
+ apos: "'"
39575
+ };
39576
+ var ENTITY = /&(?:amp;)*(?:#(x?)([0-9a-f]+)|([a-z][a-z0-9]{1,10}));/gi;
39577
+ function decodeHtmlEntities(text) {
39578
+ if (!text || !text.includes("&")) return { text, decoded: false, count: 0 };
39579
+ let count = 0;
39580
+ const out = segmentByCode(text).map((segment) => segment.code ? segment.text : decodeRun(segment.text, () => count++)).join("");
39581
+ return { text: out, decoded: count > 0, count };
39582
+ }
39583
+ function decodeRun(text, tally) {
39584
+ return text.replace(
39585
+ ENTITY,
39586
+ (match, hex, digits, name) => {
39587
+ if (digits !== void 0) {
39588
+ const cp = Number.parseInt(digits, hex ? 16 : 10);
39589
+ if (!Number.isFinite(cp) || cp <= 0 || cp > 1114111) return match;
39590
+ if (RESERVED_CODE_POINTS.has(cp)) return match;
39591
+ if (cp < 32 || cp >= 127 && cp <= 159) return match;
39592
+ if (cp >= 55296 && cp <= 57343) return match;
39593
+ tally();
39594
+ return String.fromCodePoint(cp);
39595
+ }
39596
+ if (name === void 0) return match;
39597
+ const replacement = NAMED[name.toLowerCase()];
39598
+ if (replacement === void 0) return match;
39599
+ tally();
39600
+ return replacement;
39601
+ }
39602
+ );
39603
+ }
39604
+ function emitHtmlEntityDecodeTelemetry(channel, count = 0) {
39605
+ const agentCode = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
39606
+ try {
39607
+ process.stderr.write(
39608
+ `agt.egress.html_entities_decoded ${JSON.stringify({
39609
+ channel,
39610
+ agent_code: agentCode,
39611
+ count
39612
+ })}
39613
+ `
39614
+ );
39615
+ } catch {
39616
+ }
39617
+ }
39618
+
39553
39619
  // src/slack-pending-inbound-cleanup.ts
39554
39620
  import { existsSync as existsSync4, readdirSync as readdirSync4, statSync as statSync3, unlinkSync } from "fs";
39555
39621
  import { join as join9 } from "path";
@@ -43188,7 +43254,9 @@ async function processSlackRecoveryOutboxFile(filename) {
43188
43254
  if (recoveredGuarded.redacted) emitToolCallMarkupRedactionTelemetry("slack");
43189
43255
  const apiErr = rewriteTransientApiError(recoveredGuarded.text);
43190
43256
  if (apiErr.rewritten) emitTransientApiErrorTelemetry("slack", apiErr.match, apiErr.original);
43191
- const mrkdwn = markdownToMrkdwn(apiErr.text);
43257
+ const entities = decodeHtmlEntities(apiErr.text);
43258
+ if (entities.decoded) emitHtmlEntityDecodeTelemetry("slack", entities.count);
43259
+ const mrkdwn = markdownToMrkdwn(entities.text);
43192
43260
  if (mrkdwn.converted) emitMarkdownToMrkdwnTelemetry("slack", mrkdwn.links, mrkdwn.images);
43193
43261
  const urlFixed = stripUrlWrappingAsterisks(mrkdwn.text);
43194
43262
  if (urlFixed.stripped) emitUrlAsteriskStripTelemetry("slack", urlFixed.count);
@@ -45790,7 +45858,9 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
45790
45858
  if (sanitizedGuarded.redacted) emitToolCallMarkupRedactionTelemetry("slack");
45791
45859
  const apiErr = rewriteTransientApiError(sanitizedGuarded.text);
45792
45860
  if (apiErr.rewritten) emitTransientApiErrorTelemetry("slack", apiErr.match, apiErr.original);
45793
- const mrkdwn = markdownToMrkdwn(apiErr.text);
45861
+ const entities = decodeHtmlEntities(apiErr.text);
45862
+ if (entities.decoded) emitHtmlEntityDecodeTelemetry("slack", entities.count);
45863
+ const mrkdwn = markdownToMrkdwn(entities.text);
45794
45864
  if (mrkdwn.converted) emitMarkdownToMrkdwnTelemetry("slack", mrkdwn.links, mrkdwn.images);
45795
45865
  const urlFixed = stripUrlWrappingAsterisks(mrkdwn.text);
45796
45866
  if (urlFixed.stripped) emitUrlAsteriskStripTelemetry("slack", urlFixed.count);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.754",
3
+ "version": "0.28.756",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {