pal-code 0.0.18 → 0.0.19
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pal-code",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "A terminal coding agent with BYOK, tool use, and extensions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"gemini"
|
|
66
66
|
],
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@pal-code/core": "0.0.
|
|
68
|
+
"@pal-code/core": "0.0.19",
|
|
69
69
|
"@earendil-works/pi-tui": "^0.85.1",
|
|
70
70
|
"get-east-asian-width": "1.6.0",
|
|
71
71
|
"marked": "^18.1.3"
|
|
@@ -47,6 +47,18 @@ export const REGISTRY: ExtRegistryEntry[] = [
|
|
|
47
47
|
package: '@pal-code/memory',
|
|
48
48
|
tags: ['memory', 'knowledge', 'schema', 'playbook', 'context', 'notes', 'handoff'],
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Jev',
|
|
52
|
+
description: 'Calibrated yes/no, choice and rubric judgments over OpenCode Zen',
|
|
53
|
+
package: '@pal-code/jev',
|
|
54
|
+
tags: ['jev', 'judgment', 'decision', 'classify', 'score', 'calibration', 'zen'],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'Workflow',
|
|
58
|
+
description: 'Task continuity: work folders, a durable backlog, session guardrails',
|
|
59
|
+
package: '@pal-code/workflow',
|
|
60
|
+
tags: ['workflow', 'work', 'backlog', 'handoff', 'todo', 'continuity', 'session'],
|
|
61
|
+
},
|
|
50
62
|
];
|
|
51
63
|
|
|
52
64
|
/** ANSI codes used when rendering the browse list (omit for plain text). */
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
import {homedir} from 'node:os';
|
|
14
14
|
import {join} from 'node:path';
|
|
15
|
-
import {existsSync, mkdirSync, writeFileSync} from 'node:fs';
|
|
15
|
+
import {existsSync, mkdirSync, readdirSync, writeFileSync} from 'node:fs';
|
|
16
16
|
import {execSync} from 'node:child_process';
|
|
17
|
-
import {readPalConfig, saveSetting} from '@pal-code/core';
|
|
17
|
+
import {DEFAULT_EXTENSIONS, readPalConfig, saveSetting} from '@pal-code/core';
|
|
18
18
|
|
|
19
19
|
import {formatBrowse} from './ext-registry.js';
|
|
20
20
|
|
|
@@ -37,9 +37,19 @@ function ensureExtensionsDir(): void {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* The configured extension list, defaulting to the shipped set.
|
|
42
|
+
*
|
|
43
|
+
* Must not fall back to `[]`: `extAdd` pushes onto whatever this returns and
|
|
44
|
+
* saves it, so an empty default would replace the whole shipped set with the
|
|
45
|
+
* single package being added. One `pal add jev` would silently disable
|
|
46
|
+
* web-search, agents, mcp, memory and workflow — the user would see a list of
|
|
47
|
+
* one and assume the rest were never installed.
|
|
48
|
+
*/
|
|
49
|
+
export function getExtensions(): string[] {
|
|
41
50
|
const config = readPalConfig();
|
|
42
|
-
|
|
51
|
+
if (Array.isArray(config.extensions)) return config.extensions as string[];
|
|
52
|
+
return [...DEFAULT_EXTENSIONS];
|
|
43
53
|
}
|
|
44
54
|
|
|
45
55
|
export interface ExtCommandResult {
|
|
@@ -154,11 +164,79 @@ async function lookupNpmPackage(pkg: string): Promise<'found' | 'missing' | 'unk
|
|
|
154
164
|
}
|
|
155
165
|
}
|
|
156
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Package names physically present in `~/.pal/extensions/node_modules`.
|
|
169
|
+
*
|
|
170
|
+
* `/ext list` needs this because the loaded-extension list only ever contains
|
|
171
|
+
* packages pal was *asked* to load (the defaults plus `config.json`). A package
|
|
172
|
+
* installed with `bun add` by hand, or one that dropped out of the config, is
|
|
173
|
+
* invisible there — which reads to the user as "my install vanished".
|
|
174
|
+
*
|
|
175
|
+
* Best-effort and never throws: a missing directory means nothing is installed.
|
|
176
|
+
*/
|
|
177
|
+
export function listInstalledExtensions(root: string = EXTENSIONS_DIR): string[] {
|
|
178
|
+
const modulesDir = join(root, 'node_modules');
|
|
179
|
+
if (!existsSync(modulesDir)) return [];
|
|
180
|
+
|
|
181
|
+
const names: string[] = [];
|
|
182
|
+
try {
|
|
183
|
+
for (const entry of readdirSync(modulesDir, {withFileTypes: true})) {
|
|
184
|
+
if (!entry.isDirectory() || entry.name.startsWith('.')) continue;
|
|
185
|
+
|
|
186
|
+
// A scope directory holds the real packages one level down.
|
|
187
|
+
if (entry.name.startsWith('@')) {
|
|
188
|
+
for (const inner of readdirSync(join(modulesDir, entry.name), {withFileTypes: true})) {
|
|
189
|
+
if (inner.isDirectory() && !inner.name.startsWith('.')) {
|
|
190
|
+
names.push(`${entry.name}/${inner.name}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
names.push(entry.name);
|
|
197
|
+
}
|
|
198
|
+
} catch {
|
|
199
|
+
return names;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return names.sort();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** npm package for an extension name, e.g. `jev` → `@pal-code/jev`. */
|
|
206
|
+
function scopedGuess(name: string): string {
|
|
207
|
+
return `@pal-code/${name}`;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Suggest the `@pal-code/*` package for a bare name, when one exists.
|
|
212
|
+
*
|
|
213
|
+
* Returns undefined when the name is already scoped, or when no scoped
|
|
214
|
+
* counterpart is published. Exported so the guard can be tested without
|
|
215
|
+
* running a real install.
|
|
216
|
+
*/
|
|
217
|
+
export async function suggestScopedPackage(pkg: string): Promise<string | undefined> {
|
|
218
|
+
if (pkg.startsWith('@')) return undefined;
|
|
219
|
+
const scoped = scopedGuess(pkg);
|
|
220
|
+
return (await lookupNpmPackage(scoped)) === 'found' ? scoped : undefined;
|
|
221
|
+
}
|
|
222
|
+
|
|
157
223
|
export async function extAdd(pkg: string): Promise<ExtCommandResult> {
|
|
158
224
|
if (!NPM_NAME_RE.test(pkg)) {
|
|
159
225
|
return {ok: false, message: `Invalid package name: ${pkg}`};
|
|
160
226
|
}
|
|
161
227
|
|
|
228
|
+
// A bare name is almost never a pal extension, and the collision is silent:
|
|
229
|
+
// `jev` exists on npm as an unrelated 2021 stub, so `pal add jev` would
|
|
230
|
+
// install that and report a confusing red "failed". If the scoped package
|
|
231
|
+
// exists, point at it instead of installing the wrong thing.
|
|
232
|
+
const scoped = await suggestScopedPackage(pkg);
|
|
233
|
+
if (scoped) {
|
|
234
|
+
return {
|
|
235
|
+
ok: false,
|
|
236
|
+
message: `"${pkg}" is not a pal extension — did you mean "${scoped}"?`,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
162
240
|
// Validate against npm before installing; on registry/network failure fall
|
|
163
241
|
// through to `bun add` so offline installs still work (bun will 404 itself).
|
|
164
242
|
const lookup = await lookupNpmPackage(pkg);
|
|
@@ -123,7 +123,7 @@ import type {SessionStore as SessionStoreType} from '@pal-code/core';
|
|
|
123
123
|
// (see buildModelOptions). Static curated lists live in @pal-code/core PROVIDERS as fallback.
|
|
124
124
|
|
|
125
125
|
// Version synced from version.json via `node scripts/sync-version.js`.
|
|
126
|
-
const VERSION = '0.0.
|
|
126
|
+
const VERSION = '0.0.19';
|
|
127
127
|
|
|
128
128
|
// ── Canvas sync (OSC 10/11) ──
|
|
129
129
|
// Raw reply payloads captured after a successful startup query + set, or null
|
|
@@ -1843,13 +1843,39 @@ async function main() {
|
|
|
1843
1843
|
const detail = ext.reason ? ` ${c.dim}— ${ext.reason}${c.reset}` : '';
|
|
1844
1844
|
return ` ${ext.name.padEnd(24)} ${status}${detail}`;
|
|
1845
1845
|
});
|
|
1846
|
-
|
|
1846
|
+
|
|
1847
|
+
// Installed but never requested: shown separately so an install can
|
|
1848
|
+
// never look like it silently vanished. These are on disk under
|
|
1849
|
+
// ~/.pal/extensions but absent from config.json, so pal never loads them.
|
|
1850
|
+
const {listInstalledExtensions} = await import('./commands/ext.js');
|
|
1851
|
+
const loadedNames = new Set(
|
|
1852
|
+
extensions.map((ext) => ext.name.replace(/^@pal-code\//, '')),
|
|
1853
|
+
);
|
|
1854
|
+
const unloaded = listInstalledExtensions().filter((pkg) => {
|
|
1855
|
+
const short = pkg.replace(/^@pal-code\//, '');
|
|
1856
|
+
return !loadedNames.has(short);
|
|
1857
|
+
});
|
|
1858
|
+
|
|
1859
|
+
if (lines.length === 0 && unloaded.length === 0) {
|
|
1847
1860
|
const {emptyListMessage} = await import('./commands/ext-registry.js');
|
|
1848
1861
|
messagesContainer.addChild(new Text(`${c.dim} ${emptyListMessage()}${c.reset}`, 1, 0));
|
|
1849
1862
|
} else {
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1863
|
+
const body: string[] = [];
|
|
1864
|
+
if (lines.length > 0) {
|
|
1865
|
+
body.push(`${c.bold}Loaded extensions${c.reset}`, ...lines);
|
|
1866
|
+
}
|
|
1867
|
+
if (unloaded.length > 0) {
|
|
1868
|
+
if (body.length > 0) body.push('');
|
|
1869
|
+
body.push(
|
|
1870
|
+
`${c.bold}Installed but not loaded${c.reset}`,
|
|
1871
|
+
...unloaded.map(
|
|
1872
|
+
(pkg) =>
|
|
1873
|
+
` ${pkg.replace(/^@pal-code\//, '').padEnd(24)} ${c.dim}not in config${c.reset}`,
|
|
1874
|
+
),
|
|
1875
|
+
`${c.dim} Load one with: /ext add <name>${c.reset}`,
|
|
1876
|
+
);
|
|
1877
|
+
}
|
|
1878
|
+
messagesContainer.addChild(new Text(body.join('\n'), 1, 0));
|
|
1853
1879
|
}
|
|
1854
1880
|
} else {
|
|
1855
1881
|
messagesContainer.addChild(
|