@friendlyrobot/discord-pi-agent 0.19.18 → 0.20.0

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.
Files changed (2) hide show
  1. package/dist/index.js +27 -0
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -279,6 +279,12 @@ function normalizeCodeFences(text) {
279
279
  result.push(beforeFence);
280
280
  }
281
281
  result.push("```");
282
+ } else if (trimmed.startsWith("```") && !isValidFenceLine(trimmed)) {
283
+ result.push("```");
284
+ const afterFence = trimmed.slice(3).trimStart();
285
+ if (afterFence) {
286
+ result.push(afterFence);
287
+ }
282
288
  } else {
283
289
  result.push(line);
284
290
  }
@@ -286,6 +292,27 @@ function normalizeCodeFences(text) {
286
292
  return result.join(`
287
293
  `);
288
294
  }
295
+ function isValidFenceLine(line) {
296
+ const trimmed = line.trimEnd();
297
+ if (trimmed === "```") {
298
+ return true;
299
+ }
300
+ const afterFence = trimmed.slice(3);
301
+ if (!afterFence) {
302
+ return true;
303
+ }
304
+ if (afterFence.codePointAt(0) > 127) {
305
+ return false;
306
+ }
307
+ const tokens = afterFence.trimStart().split(/\s+/);
308
+ if (tokens.length > 1) {
309
+ return false;
310
+ }
311
+ if (tokens[0].includes("`")) {
312
+ return false;
313
+ }
314
+ return true;
315
+ }
289
316
  async function formatWithPrettier(text) {
290
317
  const prettier = await import("prettier");
291
318
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@friendlyrobot/discord-pi-agent",
3
- "version": "0.19.18",
3
+ "version": "0.20.0",
4
4
  "description": "Reusable Discord gateway for persistent pi agent sessions",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,8 +36,8 @@
36
36
  "typecheck": "tsgo --noEmit -p tsconfig.json"
37
37
  },
38
38
  "dependencies": {
39
- "@earendil-works/pi-ai": "^0.75.3",
40
- "@earendil-works/pi-coding-agent": "^0.75.3",
39
+ "@earendil-works/pi-ai": "^0.75.4",
40
+ "@earendil-works/pi-coding-agent": "^0.75.4",
41
41
  "discord.js": "^14.26.4",
42
42
  "dotenv": "^17.4.2",
43
43
  "marked": "^18.0.4",
@@ -47,9 +47,9 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^25.9.1",
50
- "@typescript/native-preview": "^7.0.0-dev.20260519.1",
51
- "@vitest/coverage-v8": "^4.1.6",
52
- "@vitest/ui": "^4.1.6",
53
- "vitest": "^4.1.6"
50
+ "@typescript/native-preview": "^7.0.0-dev.20260521.1",
51
+ "@vitest/coverage-v8": "^4.1.7",
52
+ "@vitest/ui": "^4.1.7",
53
+ "vitest": "^4.1.7"
54
54
  }
55
55
  }