@integrity-labs/agt-cli 0.28.170 → 0.28.172

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.
@@ -14035,6 +14035,43 @@ function emitPreambleStripTelemetry(channel, shape) {
14035
14035
  }
14036
14036
  }
14037
14037
 
14038
+ // src/redact-tool-call-markup.ts
14039
+ var SAFE_FALLBACK = "Sorry \u2014 I hit a problem completing that action and couldn't finish my reply. Could you try again, or rephrase?";
14040
+ var TOOLCALL_TAG = /<\s*\/?\s*(?:antml:)?(?:function_calls|invoke|parameter)\b/i;
14041
+ var BLOCK_PATTERNS = [
14042
+ /<\s*(?:antml:)?function_calls\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?function_calls\s*>/gi,
14043
+ /<\s*(?:antml:)?invoke\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?invoke\s*>/gi,
14044
+ /<\s*(?:antml:)?parameter\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?parameter\s*>/gi
14045
+ ];
14046
+ var DANGLING_OPEN = /<\s*(?:antml:)?(?:function_calls|invoke|parameter)\b/i;
14047
+ var ORPHAN_CLOSE = /<\s*\/\s*(?:antml:)?(?:function_calls|invoke|parameter)\s*>/gi;
14048
+ var DANGLING_CLOSE = /<\s*\/\s*(?:antml:)?(?:function_calls|invoke|parameter)\b[^>]*$/i;
14049
+ function redactToolCallMarkup(text) {
14050
+ if (!text || !TOOLCALL_TAG.test(text)) return { text, redacted: false };
14051
+ let out = text;
14052
+ for (const re of BLOCK_PATTERNS) out = out.replace(re, "");
14053
+ const openIdx = out.search(DANGLING_OPEN);
14054
+ if (openIdx !== -1) out = out.slice(0, openIdx);
14055
+ out = out.replace(ORPHAN_CLOSE, "");
14056
+ out = out.replace(DANGLING_CLOSE, "");
14057
+ out = out.replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
14058
+ if (out === "") out = SAFE_FALLBACK;
14059
+ return { text: out, redacted: true };
14060
+ }
14061
+ function emitToolCallMarkupRedactionTelemetry(channel) {
14062
+ const agentCode = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
14063
+ try {
14064
+ process.stderr.write(
14065
+ `agt.egress.tool_call_markup_redacted ${JSON.stringify({
14066
+ channel,
14067
+ agent_code: agentCode
14068
+ })}
14069
+ `
14070
+ );
14071
+ } catch {
14072
+ }
14073
+ }
14074
+
14038
14075
  // src/transient-api-error.ts
14039
14076
  var CODE_KIND = {
14040
14077
  "429": "rate_limit",
@@ -14576,7 +14613,9 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
14576
14613
  const { session_id, content: rawContent } = args;
14577
14614
  const sanitizedReply = stripRepostPreambleWithMeta(rawContent);
14578
14615
  if (sanitizedReply.stripped) emitPreambleStripTelemetry("direct_chat", sanitizedReply.shape);
14579
- const apiErr = rewriteTransientApiError(sanitizedReply.text);
14616
+ const sanitizedReplyGuarded = redactToolCallMarkup(sanitizedReply.text);
14617
+ if (sanitizedReplyGuarded.redacted) emitToolCallMarkupRedactionTelemetry("direct_chat");
14618
+ const apiErr = rewriteTransientApiError(sanitizedReplyGuarded.text);
14580
14619
  if (apiErr.rewritten) emitTransientApiErrorTelemetry("direct_chat", apiErr.match, apiErr.original);
14581
14620
  const content = apiErr.text;
14582
14621
  const message_ids = claimTracker.peek(session_id);
@@ -15662,6 +15662,43 @@ function emitPreambleStripTelemetry(channel, shape) {
15662
15662
  }
15663
15663
  }
15664
15664
 
15665
+ // src/redact-tool-call-markup.ts
15666
+ var SAFE_FALLBACK = "Sorry \u2014 I hit a problem completing that action and couldn't finish my reply. Could you try again, or rephrase?";
15667
+ var TOOLCALL_TAG = /<\s*\/?\s*(?:antml:)?(?:function_calls|invoke|parameter)\b/i;
15668
+ var BLOCK_PATTERNS = [
15669
+ /<\s*(?:antml:)?function_calls\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?function_calls\s*>/gi,
15670
+ /<\s*(?:antml:)?invoke\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?invoke\s*>/gi,
15671
+ /<\s*(?:antml:)?parameter\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?parameter\s*>/gi
15672
+ ];
15673
+ var DANGLING_OPEN = /<\s*(?:antml:)?(?:function_calls|invoke|parameter)\b/i;
15674
+ var ORPHAN_CLOSE = /<\s*\/\s*(?:antml:)?(?:function_calls|invoke|parameter)\s*>/gi;
15675
+ var DANGLING_CLOSE = /<\s*\/\s*(?:antml:)?(?:function_calls|invoke|parameter)\b[^>]*$/i;
15676
+ function redactToolCallMarkup(text) {
15677
+ if (!text || !TOOLCALL_TAG.test(text)) return { text, redacted: false };
15678
+ let out = text;
15679
+ for (const re of BLOCK_PATTERNS) out = out.replace(re, "");
15680
+ const openIdx = out.search(DANGLING_OPEN);
15681
+ if (openIdx !== -1) out = out.slice(0, openIdx);
15682
+ out = out.replace(ORPHAN_CLOSE, "");
15683
+ out = out.replace(DANGLING_CLOSE, "");
15684
+ out = out.replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
15685
+ if (out === "") out = SAFE_FALLBACK;
15686
+ return { text: out, redacted: true };
15687
+ }
15688
+ function emitToolCallMarkupRedactionTelemetry(channel) {
15689
+ const agentCode = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
15690
+ try {
15691
+ process.stderr.write(
15692
+ `agt.egress.tool_call_markup_redacted ${JSON.stringify({
15693
+ channel,
15694
+ agent_code: agentCode
15695
+ })}
15696
+ `
15697
+ );
15698
+ } catch {
15699
+ }
15700
+ }
15701
+
15665
15702
  // src/transient-api-error.ts
15666
15703
  var CODE_KIND = {
15667
15704
  "429": "rate_limit",
@@ -17788,7 +17825,9 @@ async function processSlackRecoveryOutboxFile(filename) {
17788
17825
  }
17789
17826
  const recovered = stripRepostPreambleWithMeta(payload.text);
17790
17827
  if (recovered.stripped) emitPreambleStripTelemetry("slack", recovered.shape);
17791
- const apiErr = rewriteTransientApiError(recovered.text);
17828
+ const recoveredGuarded = redactToolCallMarkup(recovered.text);
17829
+ if (recoveredGuarded.redacted) emitToolCallMarkupRedactionTelemetry("slack");
17830
+ const apiErr = rewriteTransientApiError(recoveredGuarded.text);
17792
17831
  if (apiErr.rewritten) emitTransientApiErrorTelemetry("slack", apiErr.match, apiErr.original);
17793
17832
  const text = apiErr.text;
17794
17833
  let sendSucceeded = false;
@@ -19739,7 +19778,9 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
19739
19778
  };
19740
19779
  const sanitized = stripRepostPreambleWithMeta(text);
19741
19780
  if (sanitized.stripped) emitPreambleStripTelemetry("slack", sanitized.shape);
19742
- const apiErr = rewriteTransientApiError(sanitized.text);
19781
+ const sanitizedGuarded = redactToolCallMarkup(sanitized.text);
19782
+ if (sanitizedGuarded.redacted) emitToolCallMarkupRedactionTelemetry("slack");
19783
+ const apiErr = rewriteTransientApiError(sanitizedGuarded.text);
19743
19784
  if (apiErr.rewritten) emitTransientApiErrorTelemetry("slack", apiErr.match, apiErr.original);
19744
19785
  try {
19745
19786
  const res = await fetch("https://slack.com/api/chat.postMessage", {
@@ -14094,6 +14094,43 @@ function emitPreambleStripTelemetry(channel, shape) {
14094
14094
  }
14095
14095
  }
14096
14096
 
14097
+ // src/redact-tool-call-markup.ts
14098
+ var SAFE_FALLBACK = "Sorry \u2014 I hit a problem completing that action and couldn't finish my reply. Could you try again, or rephrase?";
14099
+ var TOOLCALL_TAG = /<\s*\/?\s*(?:antml:)?(?:function_calls|invoke|parameter)\b/i;
14100
+ var BLOCK_PATTERNS = [
14101
+ /<\s*(?:antml:)?function_calls\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?function_calls\s*>/gi,
14102
+ /<\s*(?:antml:)?invoke\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?invoke\s*>/gi,
14103
+ /<\s*(?:antml:)?parameter\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?parameter\s*>/gi
14104
+ ];
14105
+ var DANGLING_OPEN = /<\s*(?:antml:)?(?:function_calls|invoke|parameter)\b/i;
14106
+ var ORPHAN_CLOSE = /<\s*\/\s*(?:antml:)?(?:function_calls|invoke|parameter)\s*>/gi;
14107
+ var DANGLING_CLOSE = /<\s*\/\s*(?:antml:)?(?:function_calls|invoke|parameter)\b[^>]*$/i;
14108
+ function redactToolCallMarkup(text) {
14109
+ if (!text || !TOOLCALL_TAG.test(text)) return { text, redacted: false };
14110
+ let out = text;
14111
+ for (const re of BLOCK_PATTERNS) out = out.replace(re, "");
14112
+ const openIdx = out.search(DANGLING_OPEN);
14113
+ if (openIdx !== -1) out = out.slice(0, openIdx);
14114
+ out = out.replace(ORPHAN_CLOSE, "");
14115
+ out = out.replace(DANGLING_CLOSE, "");
14116
+ out = out.replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
14117
+ if (out === "") out = SAFE_FALLBACK;
14118
+ return { text: out, redacted: true };
14119
+ }
14120
+ function emitToolCallMarkupRedactionTelemetry(channel) {
14121
+ const agentCode = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
14122
+ try {
14123
+ process.stderr.write(
14124
+ `agt.egress.tool_call_markup_redacted ${JSON.stringify({
14125
+ channel,
14126
+ agent_code: agentCode
14127
+ })}
14128
+ `
14129
+ );
14130
+ } catch {
14131
+ }
14132
+ }
14133
+
14097
14134
  // src/transient-api-error.ts
14098
14135
  var CODE_KIND = {
14099
14136
  "429": "rate_limit",
@@ -15513,7 +15550,9 @@ async function handleReply(args) {
15513
15550
  }
15514
15551
  const sanitized = stripRepostPreambleWithMeta(text);
15515
15552
  if (sanitized.stripped) emitPreambleStripTelemetry("teams", sanitized.shape);
15516
- const apiErr = rewriteTransientApiError(sanitized.text);
15553
+ const sanitizedGuarded = redactToolCallMarkup(sanitized.text);
15554
+ if (sanitizedGuarded.redacted) emitToolCallMarkupRedactionTelemetry("teams");
15555
+ const apiErr = rewriteTransientApiError(sanitizedGuarded.text);
15517
15556
  if (apiErr.rewritten) emitTransientApiErrorTelemetry("teams", apiErr.match, apiErr.original);
15518
15557
  try {
15519
15558
  const result = await sendActivity(serviceUrl, conversationId, {
@@ -16076,7 +16115,9 @@ async function processRecoveryFile(filename) {
16076
16115
  }
16077
16116
  const recovered = stripRepostPreambleWithMeta(payload.text);
16078
16117
  if (recovered.stripped) emitPreambleStripTelemetry("teams", recovered.shape);
16079
- const apiErr = rewriteTransientApiError(recovered.text);
16118
+ const recoveredGuarded = redactToolCallMarkup(recovered.text);
16119
+ if (recoveredGuarded.redacted) emitToolCallMarkupRedactionTelemetry("teams");
16120
+ const apiErr = rewriteTransientApiError(recoveredGuarded.text);
16080
16121
  if (apiErr.rewritten) emitTransientApiErrorTelemetry("teams", apiErr.match, apiErr.original);
16081
16122
  try {
16082
16123
  await sendActivity(payload.service_url, payload.conversation_id, {
@@ -16533,6 +16533,43 @@ function emitPreambleStripTelemetry(channel, shape) {
16533
16533
  }
16534
16534
  }
16535
16535
 
16536
+ // src/redact-tool-call-markup.ts
16537
+ var SAFE_FALLBACK = "Sorry \u2014 I hit a problem completing that action and couldn't finish my reply. Could you try again, or rephrase?";
16538
+ var TOOLCALL_TAG = /<\s*\/?\s*(?:antml:)?(?:function_calls|invoke|parameter)\b/i;
16539
+ var BLOCK_PATTERNS = [
16540
+ /<\s*(?:antml:)?function_calls\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?function_calls\s*>/gi,
16541
+ /<\s*(?:antml:)?invoke\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?invoke\s*>/gi,
16542
+ /<\s*(?:antml:)?parameter\b[^>]*>[\s\S]*?<\/\s*(?:antml:)?parameter\s*>/gi
16543
+ ];
16544
+ var DANGLING_OPEN = /<\s*(?:antml:)?(?:function_calls|invoke|parameter)\b/i;
16545
+ var ORPHAN_CLOSE = /<\s*\/\s*(?:antml:)?(?:function_calls|invoke|parameter)\s*>/gi;
16546
+ var DANGLING_CLOSE = /<\s*\/\s*(?:antml:)?(?:function_calls|invoke|parameter)\b[^>]*$/i;
16547
+ function redactToolCallMarkup(text) {
16548
+ if (!text || !TOOLCALL_TAG.test(text)) return { text, redacted: false };
16549
+ let out = text;
16550
+ for (const re of BLOCK_PATTERNS) out = out.replace(re, "");
16551
+ const openIdx = out.search(DANGLING_OPEN);
16552
+ if (openIdx !== -1) out = out.slice(0, openIdx);
16553
+ out = out.replace(ORPHAN_CLOSE, "");
16554
+ out = out.replace(DANGLING_CLOSE, "");
16555
+ out = out.replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
16556
+ if (out === "") out = SAFE_FALLBACK;
16557
+ return { text: out, redacted: true };
16558
+ }
16559
+ function emitToolCallMarkupRedactionTelemetry(channel) {
16560
+ const agentCode = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
16561
+ try {
16562
+ process.stderr.write(
16563
+ `agt.egress.tool_call_markup_redacted ${JSON.stringify({
16564
+ channel,
16565
+ agent_code: agentCode
16566
+ })}
16567
+ `
16568
+ );
16569
+ } catch {
16570
+ }
16571
+ }
16572
+
16536
16573
  // src/transient-api-error.ts
16537
16574
  var CODE_KIND = {
16538
16575
  "429": "rate_limit",
@@ -18396,7 +18433,9 @@ async function processRecoveryOutboxFile(filename) {
18396
18433
  }
18397
18434
  const recovered = stripRepostPreambleWithMeta(payload.text);
18398
18435
  if (recovered.stripped) emitPreambleStripTelemetry("telegram", recovered.shape);
18399
- const apiErr = rewriteTransientApiError(recovered.text);
18436
+ const recoveredGuarded = redactToolCallMarkup(recovered.text);
18437
+ if (recoveredGuarded.redacted) emitToolCallMarkupRedactionTelemetry("telegram");
18438
+ const apiErr = rewriteTransientApiError(recoveredGuarded.text);
18400
18439
  if (apiErr.rewritten) emitTransientApiErrorTelemetry("telegram", apiErr.match, apiErr.original);
18401
18440
  const text = apiErr.text;
18402
18441
  const body = {
@@ -19096,7 +19135,9 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
19096
19135
  }
19097
19136
  const tgSanitized = stripRepostPreambleWithMeta(text);
19098
19137
  if (tgSanitized.stripped) emitPreambleStripTelemetry("telegram", tgSanitized.shape);
19099
- const tgApiErr = rewriteTransientApiError(tgSanitized.text);
19138
+ const tgSanitizedGuarded = redactToolCallMarkup(tgSanitized.text);
19139
+ if (tgSanitizedGuarded.redacted) emitToolCallMarkupRedactionTelemetry("telegram");
19140
+ const tgApiErr = rewriteTransientApiError(tgSanitizedGuarded.text);
19100
19141
  if (tgApiErr.rewritten) emitTransientApiErrorTelemetry("telegram", tgApiErr.match, tgApiErr.original);
19101
19142
  const isPrivateChat = !chat_id.startsWith("-");
19102
19143
  const tgThrottleCfg = isPrivateChat ? relaxedThrottleConfig(configFromEnv()) : configFromEnv();
@@ -34,8 +34,8 @@ import {
34
34
  writeDirectChatSessionState,
35
35
  writeEgressAllowlist,
36
36
  writePersistentClaudeWrapper
37
- } from "./chunk-25T4GQTU.js";
38
- import "./chunk-VZP5CIVP.js";
37
+ } from "./chunk-N25WAF7G.js";
38
+ import "./chunk-OMC7BHRP.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-2QNOLKCT.js.map
77
+ //# sourceMappingURL=persistent-session-4HC7YFSU.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-25T4GQTU.js";
4
- import "./chunk-VZP5CIVP.js";
3
+ } from "./chunk-N25WAF7G.js";
4
+ import "./chunk-OMC7BHRP.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-4JPUYWPB.js.map
307
+ //# sourceMappingURL=responsiveness-probe-W4PCY6HC.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.170",
3
+ "version": "0.28.172",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {