donsetch 2.4.0 → 2.5.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/bin/donsetch.js +4 -1
- package/install.js +61 -14
- package/package.json +1 -1
- package/pi-extension.ts +9 -1
package/bin/donsetch.js
CHANGED
|
@@ -57,7 +57,10 @@ child.on('exit', (code, signal) => {
|
|
|
57
57
|
if (signal) {
|
|
58
58
|
// Re-raise the signal so the parent's exit reflects it
|
|
59
59
|
try { process.kill(process.pid, signal); } catch (_) {}
|
|
60
|
-
|
|
60
|
+
// Fallback: exit code for the signal we actually received
|
|
61
|
+
// (SIGINT=2, SIGTERM=15, SIGHUP=1), not always SIGTERM's 143.
|
|
62
|
+
const sigNum = { SIGHUP: 1, SIGINT: 2, SIGQUIT: 3, SIGTERM: 15 }[signal] || 15;
|
|
63
|
+
process.exit(128 + sigNum);
|
|
61
64
|
} else {
|
|
62
65
|
process.exit(code || 0);
|
|
63
66
|
}
|
package/install.js
CHANGED
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
// uses the same release artifacts that manual users download.
|
|
11
11
|
//
|
|
12
12
|
// Supported platforms:
|
|
13
|
-
// linux-x64 Linux x86_64
|
|
14
|
-
// linux-arm64 Linux ARM64 (
|
|
13
|
+
// linux-x64 Linux x86_64 (glibc)
|
|
14
|
+
// linux-arm64 Linux ARM64 (glibc)
|
|
15
15
|
// darwin-arm64 macOS Apple Silicon
|
|
16
|
+
// darwin-x64 macOS Intel
|
|
16
17
|
// win32-x64 Windows x86_64
|
|
17
18
|
|
|
18
19
|
const https = require('https');
|
|
@@ -30,6 +31,7 @@ const PLATFORMS = {
|
|
|
30
31
|
'linux-x64': { asset: 'donsetch-linux-x64.tar.gz', binary: 'donsetch' },
|
|
31
32
|
'linux-arm64': { asset: 'donsetch-linux-arm64.tar.gz', binary: 'donsetch' },
|
|
32
33
|
'darwin-arm64': { asset: 'donsetch-darwin-arm64.tar.gz', binary: 'donsetch' },
|
|
34
|
+
'darwin-x64': { asset: 'donsetch-darwin-x64.tar.gz', binary: 'donsetch' },
|
|
33
35
|
'win32-x64': { asset: 'donsetch-win32-x64.tar.gz', binary: 'donsetch.exe' },
|
|
34
36
|
};
|
|
35
37
|
|
|
@@ -37,25 +39,56 @@ const platKey = `${process.platform}-${process.arch}`;
|
|
|
37
39
|
const plat = PLATFORMS[platKey];
|
|
38
40
|
|
|
39
41
|
if (!plat) {
|
|
40
|
-
|
|
42
|
+
const known = {
|
|
43
|
+
'darwin-x64': 'prebuilt binaries exist — update donsetch to a version that ships one',
|
|
44
|
+
'win32-arm64': 'no prebuilt binary yet — build from source (see below)',
|
|
45
|
+
}[platKey];
|
|
46
|
+
console.error(`donsetch: unsupported platform ${platKey}${known ? ` (${known})` : ''}`);
|
|
41
47
|
console.error('');
|
|
42
48
|
console.error('Supported platforms:');
|
|
43
|
-
console.error(' linux-x64 Linux x86_64');
|
|
44
|
-
console.error(' linux-arm64 Linux ARM64 (
|
|
49
|
+
console.error(' linux-x64 Linux x86_64 (glibc)');
|
|
50
|
+
console.error(' linux-arm64 Linux ARM64 (glibc)');
|
|
45
51
|
console.error(' darwin-arm64 macOS Apple Silicon');
|
|
52
|
+
console.error(' darwin-x64 macOS Intel');
|
|
46
53
|
console.error(' win32-x64 Windows x86_64');
|
|
47
54
|
console.error('');
|
|
48
55
|
console.error('Build from source: https://github.com/' + REPO);
|
|
49
56
|
process.exit(1);
|
|
50
57
|
}
|
|
51
58
|
|
|
59
|
+
// ── musl detection (Alpine etc.) ────────────────────────────────
|
|
60
|
+
// The Linux binaries are glibc-linked. On musl systems they install
|
|
61
|
+
// fine but can never exec (missing ld-linux loader) — fail HERE with
|
|
62
|
+
// the actual cause instead of a cryptic spawn error on first run.
|
|
63
|
+
if (process.platform === 'linux') {
|
|
64
|
+
const isMusl = fs.existsSync('/lib/ld-musl-x86_64.so.1')
|
|
65
|
+
|| fs.existsSync('/lib/ld-musl-aarch64.so.1');
|
|
66
|
+
if (isMusl) {
|
|
67
|
+
console.error('donsetch: musl libc detected (Alpine?).');
|
|
68
|
+
console.error('The prebuilt Linux binaries are glibc-linked and will not run.');
|
|
69
|
+
console.error('');
|
|
70
|
+
console.error('Options:');
|
|
71
|
+
console.error(' - build from source: git clone https://github.com/' + REPO + ' && cargo build --release');
|
|
72
|
+
console.error(' - use a glibc-based image/dist (debian, ubuntu, fedora)');
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
52
77
|
const binDir = path.join(__dirname, 'binaries');
|
|
53
78
|
const binaryPath = path.join(binDir, plat.binary);
|
|
54
79
|
|
|
55
|
-
// Skip if already installed (npm cache reuse, reinstall, etc.)
|
|
80
|
+
// Skip if already installed (npm cache reuse, reinstall, etc.).
|
|
81
|
+
// A plausibility check first: a stale 0-byte or truncated leftover
|
|
82
|
+
// (killed install, crashed download) must not shadow a fresh one.
|
|
56
83
|
if (fs.existsSync(binaryPath)) {
|
|
57
|
-
|
|
58
|
-
|
|
84
|
+
let size = 0;
|
|
85
|
+
try { size = fs.statSync(binaryPath).size; } catch (_) {}
|
|
86
|
+
if (size > 1024 * 1024) {
|
|
87
|
+
console.log(`donsetch: binary already present (${plat.binary})`);
|
|
88
|
+
process.exit(0);
|
|
89
|
+
}
|
|
90
|
+
console.log(`donsetch: leftover ${plat.binary} is ${size} bytes — re-downloading`);
|
|
91
|
+
try { fs.unlinkSync(binaryPath); } catch (_) {}
|
|
59
92
|
}
|
|
60
93
|
|
|
61
94
|
fs.mkdirSync(binDir, { recursive: true });
|
|
@@ -110,6 +143,19 @@ async function main() {
|
|
|
110
143
|
const tarball = path.join(binDir, plat.asset);
|
|
111
144
|
const checksumFile = path.join(binDir, 'checksum.sha256');
|
|
112
145
|
|
|
146
|
+
// 0. Windows: tar ships with Windows 10 1803+; older boxes lack it.
|
|
147
|
+
// Detect BEFORE downloading so the error names the real problem.
|
|
148
|
+
if (process.platform === 'win32') {
|
|
149
|
+
let hasTar = false;
|
|
150
|
+
try { execFileSync('tar', ['--version'], { stdio: 'ignore' }); hasTar = true; } catch (_) {}
|
|
151
|
+
if (!hasTar) {
|
|
152
|
+
console.error('donsetch: `tar` not found on this Windows system.');
|
|
153
|
+
console.error('tar ships with Windows 10 1803+. Update Windows, or extract manually');
|
|
154
|
+
console.error('after downloading ' + assetUrl);
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
113
159
|
// 1. Download the binary tarball
|
|
114
160
|
console.log(`donsetch: downloading ${plat.asset} from ${TAG}...`);
|
|
115
161
|
await download(assetUrl, tarball);
|
|
@@ -142,12 +188,8 @@ async function main() {
|
|
|
142
188
|
try { fs.unlinkSync(tarball); } catch (_) {}
|
|
143
189
|
try { fs.unlinkSync(checksumFile); } catch (_) {}
|
|
144
190
|
|
|
145
|
-
// 6.
|
|
146
|
-
|
|
147
|
-
fs.chmodSync(binaryPath, 0o755);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// 7. Verify the binary exists after extraction
|
|
191
|
+
// 6. Verify the binary exists after extraction (BEFORE chmod —
|
|
192
|
+
// chmod on a missing file throws an opaque error).
|
|
151
193
|
if (!fs.existsSync(binaryPath)) {
|
|
152
194
|
console.error(`donsetch: expected ${plat.binary} not found after extraction`);
|
|
153
195
|
console.error(` looked at: ${binaryPath}`);
|
|
@@ -155,6 +197,11 @@ async function main() {
|
|
|
155
197
|
process.exit(1);
|
|
156
198
|
}
|
|
157
199
|
|
|
200
|
+
// 7. Make executable (Unix only)
|
|
201
|
+
if (process.platform !== 'win32') {
|
|
202
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
203
|
+
}
|
|
204
|
+
|
|
158
205
|
console.log(`donsetch: installed ${plat.binary} to ${binaryPath}`);
|
|
159
206
|
console.log(`donsetch: run \`donsetch\` to see available commands.`);
|
|
160
207
|
}
|
package/package.json
CHANGED
package/pi-extension.ts
CHANGED
|
@@ -385,7 +385,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
385
385
|
|
|
386
386
|
try {
|
|
387
387
|
const result = await callMcpTool(toolName, params);
|
|
388
|
-
|
|
388
|
+
// Join all content text blocks, skipping [meta] blocks.
|
|
389
|
+
// [meta] blocks contain compact metadata for clients
|
|
390
|
+
// (Claude Code, VSCode) that drop text when
|
|
391
|
+
// structuredContent is present. Pi reads structuredContent
|
|
392
|
+
// directly for details, so meta blocks are redundant here.
|
|
393
|
+
const text = (result?.content ?? [])
|
|
394
|
+
.map((b: any) => b?.text ?? "")
|
|
395
|
+
.filter((t: string) => !t.startsWith("[meta]"))
|
|
396
|
+
.join("") || "";
|
|
389
397
|
const isErr = result?.isError ?? false;
|
|
390
398
|
const sc = result?.structuredContent ?? null;
|
|
391
399
|
|