pal-code 0.0.15 → 0.0.16
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/pal-code.js
CHANGED
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
* This thin wrapper detects the current platform and spawns the appropriate
|
|
7
7
|
* compiled binary. Users run `pal` after `npm install -g pal-code`.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* platform
|
|
9
|
+
* Resolution order:
|
|
10
|
+
* 1. `pal-code-<platform>` optional dependency (prebuilt, preferred)
|
|
11
|
+
* 2. `dist/pal-<platform>` shipped inside this package
|
|
12
|
+
* 3. bundled TypeScript run under Bun (last-resort fallback)
|
|
11
13
|
*/
|
|
12
14
|
|
|
13
15
|
const { spawn } = require('child_process');
|
|
14
|
-
const { existsSync
|
|
16
|
+
const { existsSync } = require('fs');
|
|
15
17
|
const { join, dirname } = require('path');
|
|
16
18
|
|
|
17
19
|
// Fast version check — before any binary lookup
|
|
@@ -43,6 +45,12 @@ function getPlatform() {
|
|
|
43
45
|
return platformMap[key] || null;
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
// Binary filename inside a platform package's `bin/` dir. Built artifacts are
|
|
49
|
+
// named `pal-<platform>[.exe]` (see build scripts in package.json).
|
|
50
|
+
function binaryName(platform) {
|
|
51
|
+
return platform === 'windows-x64' ? 'pal-windows-x64.exe' : `pal-${platform}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
// Find the binary
|
|
47
55
|
function findBinary() {
|
|
48
56
|
const platform = getPlatform();
|
|
@@ -52,32 +60,40 @@ function findBinary() {
|
|
|
52
60
|
process.exit(1);
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
//
|
|
63
|
+
// 1. Platform-specific optional dependency holding the prebuilt binary.
|
|
56
64
|
try {
|
|
57
65
|
const pkgName = `pal-code-${platform}`;
|
|
58
66
|
const pkgPath = require.resolve(`${pkgName}/package.json`);
|
|
59
67
|
const pkgDir = dirname(pkgPath);
|
|
60
|
-
const
|
|
61
|
-
const binPath = join(pkgDir, 'bin', binName);
|
|
68
|
+
const binPath = join(pkgDir, 'bin', binaryName(platform));
|
|
62
69
|
|
|
63
70
|
if (existsSync(binPath)) {
|
|
64
71
|
return binPath;
|
|
65
72
|
}
|
|
66
|
-
} catch
|
|
67
|
-
// Package not
|
|
73
|
+
} catch {
|
|
74
|
+
// Package not installed for this platform — expected on most installs.
|
|
68
75
|
}
|
|
69
76
|
|
|
70
|
-
//
|
|
77
|
+
// 2. Compiled binary shipped in this package's own dist/ directory.
|
|
78
|
+
// `npm pack` strips dist/ via .npmignore, so this only applies to local
|
|
79
|
+
// installs (e.g. `bun install -g` from a checkout).
|
|
71
80
|
const distDir = join(dirname(__dirname), 'dist');
|
|
72
|
-
const
|
|
73
|
-
|
|
81
|
+
const preferred = join(distDir, binaryName(platform));
|
|
82
|
+
|
|
83
|
+
if (existsSync(preferred)) {
|
|
84
|
+
return preferred;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 2b. Older local installs may only have the short `pal` / `pal.exe` name.
|
|
88
|
+
const shortName = platform === 'windows-x64' ? 'pal.exe' : 'pal';
|
|
89
|
+
const shortBin = join(distDir, shortName);
|
|
74
90
|
|
|
75
|
-
if (existsSync(
|
|
76
|
-
return
|
|
91
|
+
if (existsSync(shortBin)) {
|
|
92
|
+
return shortBin;
|
|
77
93
|
}
|
|
78
94
|
|
|
79
|
-
//
|
|
80
|
-
//
|
|
95
|
+
// 3. Last resort: run the bundled TypeScript source under Bun. Slower to
|
|
96
|
+
// start and requires Bun on PATH, but keeps `pal` working everywhere.
|
|
81
97
|
const { execSync } = require('child_process');
|
|
82
98
|
const srcPath = join(__dirname, '../packages/cli/src/index.ts');
|
|
83
99
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pal-code",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "A terminal coding agent with BYOK, tool use, and extensions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"gemini"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@pal-code/core": "0.0.
|
|
65
|
+
"@pal-code/core": "0.0.16",
|
|
66
66
|
"@earendil-works/pi-tui": "^0.85.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
@@ -130,7 +130,7 @@ import type {SessionStore as SessionStoreType} from '@pal-code/core';
|
|
|
130
130
|
// (see buildModelOptions). Static curated lists live in @pal-code/core PROVIDERS as fallback.
|
|
131
131
|
|
|
132
132
|
// Version synced from version.json via `node scripts/sync-version.js`.
|
|
133
|
-
const VERSION = '0.0.
|
|
133
|
+
const VERSION = '0.0.16';
|
|
134
134
|
|
|
135
135
|
// ── Canvas sync (OSC 10/11) ──
|
|
136
136
|
// Raw reply payloads captured after a successful startup query + set, or null
|
package/packages/cli/src/turn.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
registerExtensionHandlers,
|
|
12
12
|
registerExtensionLifecycle,
|
|
13
13
|
loadExtensions,
|
|
14
|
-
|
|
14
|
+
importExtensionModule,
|
|
15
15
|
runWithFallback,
|
|
16
16
|
shortModel,
|
|
17
17
|
buildRolesPrompt,
|
|
@@ -31,7 +31,7 @@ import type {TUI, Container} from '@earendil-works/pi-tui';
|
|
|
31
31
|
|
|
32
32
|
import type {Config} from './config.js';
|
|
33
33
|
import {RunView} from './components/run-view.js';
|
|
34
|
-
import {state} from './state.js';
|
|
34
|
+
import {state, type McpServerInfo} from './state.js';
|
|
35
35
|
import {checkToolPermission} from './utils/permissions.js';
|
|
36
36
|
|
|
37
37
|
export interface TurnResult {
|
|
@@ -71,9 +71,13 @@ async function applyLoaded(requested: string[], result: LoadedExtensions): Promi
|
|
|
71
71
|
//
|
|
72
72
|
// Resolved through core rather than a bare import: `pal add` installs the
|
|
73
73
|
// extension under ~/.pal/extensions/node_modules, which a plain
|
|
74
|
-
// `import('@pal-code/mcp')` from here would not search.
|
|
74
|
+
// `import('@pal-code/mcp')` from here would not search. `importExtensionModule`
|
|
75
|
+
// also handles the compiled binary, where that bare import cannot resolve at
|
|
76
|
+
// all — treating that as "not installed" would leave the server list empty.
|
|
75
77
|
try {
|
|
76
|
-
const mcpMod = await
|
|
78
|
+
const mcpMod = (await importExtensionModule('@pal-code/mcp')) as {
|
|
79
|
+
mcpManager?: {getServerDetails(): McpServerInfo[]};
|
|
80
|
+
};
|
|
77
81
|
if (mcpMod?.mcpManager) {
|
|
78
82
|
state.mcpServers = mcpMod.mcpManager.getServerDetails();
|
|
79
83
|
state.refreshSidebar();
|
|
@@ -180,15 +180,15 @@ function buildPermissionSummary(
|
|
|
180
180
|
target: string,
|
|
181
181
|
): string {
|
|
182
182
|
switch (toolName) {
|
|
183
|
-
case '
|
|
183
|
+
case 'write':
|
|
184
184
|
return `Write to ${target}`;
|
|
185
|
-
case '
|
|
185
|
+
case 'edit':
|
|
186
186
|
return `Edit ${target}`;
|
|
187
187
|
case 'edit_block':
|
|
188
188
|
return `Edit blocks in ${target}`;
|
|
189
189
|
case 'bash':
|
|
190
190
|
return `Run: ${target.length > 80 ? target.slice(0, 77) + '...' : target}`;
|
|
191
|
-
case '
|
|
191
|
+
case 'read':
|
|
192
192
|
return `Read ${target}`;
|
|
193
193
|
default:
|
|
194
194
|
return `${toolName}: ${target}`;
|