pi-roundtable-sandbox 0.12.1 → 0.13.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.
- package/CHANGELOG.md +5 -0
- package/package.json +3 -3
- package/src/pi-attachments.ts +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.13.0
|
|
6
|
+
|
|
7
|
+
- Release in lockstep with pi-roundtable 0.13.0. The core peer range moves to `>=0.13.0 <0.14.0`.
|
|
8
|
+
- A failed attachment download is reported as `download failed: <code>` (the error's `code` or `name`, else `error`) instead of the error's text, which could quote a path in the guest-writable directory.
|
|
9
|
+
|
|
5
10
|
## 0.12.1
|
|
6
11
|
|
|
7
12
|
- Release in lockstep with pi-roundtable 0.12.1; no package-specific behavior changes. The core peer range stays `>=0.12.0 <0.13.0`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-roundtable-sandbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Sealed guest channels and an allow-listed credential broker for pi-roundtable",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@earendil-works/pi-coding-agent": ">=1.0.0 <2",
|
|
39
|
-
"pi-roundtable": ">=0.
|
|
39
|
+
"pi-roundtable": ">=0.13.0 <0.14.0",
|
|
40
40
|
"typebox": ">=1.3.34 <2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@biomejs/biome": "2.5.15",
|
|
53
53
|
"@types/bun": "1.4.2",
|
|
54
54
|
"discord.js": "14.27.0",
|
|
55
|
-
"pi-roundtable": "0.
|
|
55
|
+
"pi-roundtable": "0.13.0",
|
|
56
56
|
"typebox": "1.3.34",
|
|
57
57
|
"typescript": "7.0.2"
|
|
58
58
|
}
|
package/src/pi-attachments.ts
CHANGED
|
@@ -14,6 +14,16 @@ export interface PiAttachmentOptions {
|
|
|
14
14
|
/** Trusted presentation adapter for a failure; return undefined to keep the default wording. */
|
|
15
15
|
describeFailure?(error: unknown): string | undefined;
|
|
16
16
|
}
|
|
17
|
+
/** An error's `code` or `name` and never its message, which can quote the directory a file was written to. */
|
|
18
|
+
function failureCode(error: unknown): string {
|
|
19
|
+
const word = /^[A-Za-z][A-Za-z0-9_]{0,40}$/;
|
|
20
|
+
if (typeof error !== "object" || error === null) return "error";
|
|
21
|
+
const { code, name } = error as { code?: unknown; name?: unknown };
|
|
22
|
+
if (typeof code === "string" && word.test(code)) return code;
|
|
23
|
+
if (typeof name === "string" && name !== "Error" && word.test(name))
|
|
24
|
+
return name;
|
|
25
|
+
return "error";
|
|
26
|
+
}
|
|
17
27
|
/** A failure whose message is already safe to show, matching the core's attachment wording. */
|
|
18
28
|
class AttachmentRefused extends Error {}
|
|
19
29
|
/** Bounded downloads and no-follow, descriptor-anchored writes into a guest-writable directory. */
|
|
@@ -147,7 +157,7 @@ export async function collectPiAttachments(
|
|
|
147
157
|
options.describeFailure?.(error) ??
|
|
148
158
|
(error instanceof AttachmentRefused
|
|
149
159
|
? error.message
|
|
150
|
-
: `download failed: ${
|
|
160
|
+
: `download failed: ${failureCode(error)}`),
|
|
151
161
|
fromReference,
|
|
152
162
|
});
|
|
153
163
|
}
|