@evomap/evolver-cli 2.0.47 → 2.0.48
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/dist/autoexec.js +1 -0
- package/dist/feedbackOutbox.js +11 -1
- package/dist/localPublishBinding.js +5 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +15 -7
- package/dist/pluginBundle.d.ts +1 -0
- package/dist/pluginBundle.js +3 -4
- package/dist/pluginDshStore.d.ts +7 -0
- package/dist/pluginDshStore.js +84 -0
- package/dist/pluginHosts.d.ts +16 -0
- package/dist/pluginHosts.js +34 -8
- package/dist/pluginInspection.d.ts +2 -0
- package/dist/pluginInspection.js +20 -9
- package/dist/pluginInstall.d.ts +1 -0
- package/dist/pluginInstall.js +29 -10
- package/dist/pluginRuntime.d.ts +3 -2
- package/dist/pluginRuntime.js +3 -1
- package/package.json +7 -7
package/dist/autoexec.js
CHANGED
|
@@ -1900,6 +1900,7 @@ export function makeProxyHubCapability(proxy) {
|
|
|
1900
1900
|
recordReuseResult: async (report) => reuseReceipt(await proxy.recordReuseResult({
|
|
1901
1901
|
assetId: report.assetId,
|
|
1902
1902
|
outcome: report.outcome,
|
|
1903
|
+
...(report.idempotencyKey ? { idempotencyKey: report.idempotencyKey } : {}),
|
|
1903
1904
|
...(report.taskId ? { taskId: report.taskId } : {}),
|
|
1904
1905
|
...(report.traceId ? { traceId: report.traceId } : {}),
|
|
1905
1906
|
...(report.timeSavedSeconds !== undefined ? { timeSavedSeconds: report.timeSavedSeconds } : {}),
|
package/dist/feedbackOutbox.js
CHANGED
|
@@ -341,11 +341,21 @@ export class FeedbackOutbox {
|
|
|
341
341
|
if (reportable && input.destinationId !== undefined && !SHA256_ID.test(input.destinationId)) {
|
|
342
342
|
throw new FeedbackOutboxError('invalid Hub feedback destination id');
|
|
343
343
|
}
|
|
344
|
+
// The Hub records one event per (asset, reporter node, idempotency key). The outbox row IS
|
|
345
|
+
// one logical reuse — its operation id is derived from (claim root, asset) and is stable on
|
|
346
|
+
// disk across processes and restarts — so it mints exactly one stable key for that row. A
|
|
347
|
+
// network retry of the same row therefore records once instead of double-counting the reuse.
|
|
344
348
|
const report = appliedUse.source === 'hub'
|
|
345
349
|
&& (appliedUse.outcome === 'success' || appliedUse.outcome === 'failed')
|
|
346
350
|
&& input.destinationId
|
|
347
351
|
&& appliedUse.hubOriginDestinationId === input.destinationId
|
|
348
|
-
? {
|
|
352
|
+
? {
|
|
353
|
+
assetId: appliedUse.assetId,
|
|
354
|
+
outcome: appliedUse.outcome,
|
|
355
|
+
taskId,
|
|
356
|
+
traceId: appliedUse.cycleId,
|
|
357
|
+
idempotencyKey: hub.reuseResultIdempotencyKey([identity.operationId]),
|
|
358
|
+
}
|
|
349
359
|
: undefined;
|
|
350
360
|
const networkStatus = report
|
|
351
361
|
? 'pending' : appliedUse.source === 'hub' ? 'terminal' : 'not_applicable';
|
|
@@ -65,7 +65,11 @@ async function authorizeSnapshot(assets, expectedHubMode, proxy) {
|
|
|
65
65
|
catch (error) {
|
|
66
66
|
throw new LocalPublishBindingError(safeFailureReason(error, 'publish_binding_authorization_unavailable', 'binding_authorization'));
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
// binding_exempt 表示本机 ledger 按 parent 规则放行(parent Gene 已随本节点发布),
|
|
69
|
+
// 不是宿主执行回执;它与 binding_verified 一样只是本机授权结论。
|
|
70
|
+
if (response['ok'] !== true
|
|
71
|
+
|| (response['binding_verified'] !== true && response['binding_exempt'] !== true)
|
|
72
|
+
|| response['bundle_digest'] !== digest
|
|
69
73
|
|| requestDigest !== digest || hub.publishBundleDigest(requestAssets) !== requestDigest
|
|
70
74
|
|| hub.publishBundleDigest(assets) !== digest) {
|
|
71
75
|
throw new LocalPublishBindingError('publish_binding_authorization_invalid');
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PluginRuntime } from './pluginRuntime.js';
|
|
2
|
-
export declare const PLUGIN_USAGE = "Usage: evolver plugin list [--json]\n evolver plugin install [--host <host>] [--scope user|project] [--root <dir>]\n [--profile <dsh-profile>] [--dry-run] [--json]\n\nHosts: claude-code, codex, grok, qoder, antigravity, opencode, dsh,\n cursor, workbuddy, mcp-generic\nDefault scope: user. dsh default profile: dsh-tui.\nWith no host, only a single discovered native host is selected; otherwise choose --host.\nCursor, WorkBuddy and generic MCP return manual_required without writing client config.\nDry-run performs no download, host command or config write and proves no installed state.\nInstallation uses EvoMap/evolver-agent-plugin and does not replace setup-hooks.\nExit codes: 0 verified install/already-installed/list/preview; 2 action required; 1 failure.\n";
|
|
2
|
+
export declare const PLUGIN_USAGE = "Usage: evolver plugin list [--json]\n evolver plugin install [--host <host>] [--scope user|project] [--root <dir>]\n [--profile <dsh-profile>] [--trust] [--dry-run] [--json]\n\nHosts: claude-code, codex, grok, qoder, antigravity, opencode, dsh,\n cursor, workbuddy, mcp-generic\nDefault scope: user. dsh default profile: dsh-tui.\n--trust says you trust the plugin's hooks; only hosts that require it (grok) accept it.\nWith no host, only a single discovered native host is selected; otherwise choose --host.\nCursor, WorkBuddy and generic MCP return manual_required without writing client config.\nDry-run performs no download, host command or config write and proves no installed state.\nInstallation uses EvoMap/evolver-agent-plugin and does not replace setup-hooks.\nExit codes: 0 verified install/already-installed/list/preview; 2 action required\n(including trust_required and profile_store_mismatch); 1 conflict or failure.\n";
|
|
3
3
|
export interface PluginCommandDeps {
|
|
4
4
|
runtime?: PluginRuntime;
|
|
5
5
|
stdout?: (text: string) => void;
|
package/dist/plugin.js
CHANGED
|
@@ -5,19 +5,21 @@ import { installAgentPlugin } from './pluginInstall.js';
|
|
|
5
5
|
import { createPluginRuntime, PluginInstallError } from './pluginRuntime.js';
|
|
6
6
|
export const PLUGIN_USAGE = `Usage: evolver plugin list [--json]
|
|
7
7
|
evolver plugin install [--host <host>] [--scope user|project] [--root <dir>]
|
|
8
|
-
[--profile <dsh-profile>] [--dry-run] [--json]
|
|
8
|
+
[--profile <dsh-profile>] [--trust] [--dry-run] [--json]
|
|
9
9
|
|
|
10
10
|
Hosts: claude-code, codex, grok, qoder, antigravity, opencode, dsh,
|
|
11
11
|
cursor, workbuddy, mcp-generic
|
|
12
12
|
Default scope: user. dsh default profile: dsh-tui.
|
|
13
|
+
--trust says you trust the plugin's hooks; only hosts that require it (grok) accept it.
|
|
13
14
|
With no host, only a single discovered native host is selected; otherwise choose --host.
|
|
14
15
|
Cursor, WorkBuddy and generic MCP return manual_required without writing client config.
|
|
15
16
|
Dry-run performs no download, host command or config write and proves no installed state.
|
|
16
17
|
Installation uses EvoMap/evolver-agent-plugin and does not replace setup-hooks.
|
|
17
|
-
Exit codes: 0 verified install/already-installed/list/preview; 2 action required
|
|
18
|
+
Exit codes: 0 verified install/already-installed/list/preview; 2 action required
|
|
19
|
+
(including trust_required and profile_store_mismatch); 1 conflict or failure.
|
|
18
20
|
`;
|
|
19
21
|
function parsePluginArgs(argv) {
|
|
20
|
-
const flags = { action: 'list', json: false, dryRun: false };
|
|
22
|
+
const flags = { action: 'list', json: false, dryRun: false, trust: false };
|
|
21
23
|
let index = 0;
|
|
22
24
|
if (argv[0] && !argv[0].startsWith('-')) {
|
|
23
25
|
if (argv[0] !== 'list' && argv[0] !== 'install')
|
|
@@ -32,12 +34,14 @@ function parsePluginArgs(argv) {
|
|
|
32
34
|
flags.action = 'help';
|
|
33
35
|
continue;
|
|
34
36
|
}
|
|
35
|
-
if (token === '--json' || token === '--dry-run') {
|
|
37
|
+
if (token === '--json' || token === '--dry-run' || token === '--trust') {
|
|
36
38
|
if (seen.has(token))
|
|
37
39
|
throw new PluginInstallError('invalid_arguments', 'A plugin option was repeated.');
|
|
38
40
|
seen.add(token);
|
|
39
41
|
if (token === '--json')
|
|
40
42
|
flags.json = true;
|
|
43
|
+
else if (token === '--trust')
|
|
44
|
+
flags.trust = true;
|
|
41
45
|
else
|
|
42
46
|
flags.dryRun = true;
|
|
43
47
|
continue;
|
|
@@ -54,7 +58,7 @@ function parsePluginArgs(argv) {
|
|
|
54
58
|
throw new PluginInstallError('invalid_arguments', `--${key} requires a non-empty value.`);
|
|
55
59
|
flags[key] = value;
|
|
56
60
|
}
|
|
57
|
-
if (flags.action === 'list' && (flags.host || flags.scope || flags.root || flags.profile || flags.dryRun)) {
|
|
61
|
+
if (flags.action === 'list' && (flags.host || flags.scope || flags.root || flags.profile || flags.dryRun || flags.trust)) {
|
|
58
62
|
throw new PluginInstallError('invalid_arguments', 'plugin list accepts only --json; use plugin install for installation options.');
|
|
59
63
|
}
|
|
60
64
|
return flags;
|
|
@@ -76,6 +80,10 @@ function installOptions(flags, runtime) {
|
|
|
76
80
|
throw new PluginInstallError('invalid_arguments', '--scope must be user or project.');
|
|
77
81
|
if (!host.scopes.includes(scope))
|
|
78
82
|
throw new PluginInstallError('invalid_arguments', `${host.label} does not have a verified ${scope}-scope installer. Supported scopes: ${host.scopes.join(', ')}.`);
|
|
83
|
+
if (flags.trust && !host.requiresTrust) {
|
|
84
|
+
const trustHosts = PLUGIN_HOSTS.filter(candidate => candidate.requiresTrust).map(candidate => candidate.id).join(', ');
|
|
85
|
+
throw new PluginInstallError('invalid_arguments', `--trust is only accepted for hosts whose installer requires plugin trust (${trustHosts}); ${host.label} does not, and no host-specific argument is silently ignored.`);
|
|
86
|
+
}
|
|
79
87
|
if (flags.profile && host.id !== 'dsh')
|
|
80
88
|
throw new PluginInstallError('invalid_arguments', '--profile is only supported for dsh; no host-specific argument was silently ignored.');
|
|
81
89
|
const profile = flags.profile ?? 'dsh-tui';
|
|
@@ -92,7 +100,7 @@ function installOptions(flags, runtime) {
|
|
|
92
100
|
throw new PluginInstallError('invalid_arguments', '--root must identify an existing project/working directory.');
|
|
93
101
|
}
|
|
94
102
|
}
|
|
95
|
-
return { host, scope: scope, root, profile, dryRun: flags.dryRun };
|
|
103
|
+
return { host, scope: scope, root, profile, dryRun: flags.dryRun, trust: flags.trust };
|
|
96
104
|
}
|
|
97
105
|
export async function runPluginCommand(argv, deps = {}) {
|
|
98
106
|
const stdout = deps.stdout ?? (text => { process.stdout.write(text); });
|
|
@@ -107,7 +115,7 @@ export async function runPluginCommand(argv, deps = {}) {
|
|
|
107
115
|
return 0;
|
|
108
116
|
}
|
|
109
117
|
if (flags.action === 'list') {
|
|
110
|
-
const hosts = PLUGIN_HOSTS.map(host => ({ id: host.id, label: host.label, mode: host.kind === 'manual' ? 'manual' : 'native', cli: host.command ?? null, cliFound: Boolean(host.command && runtime.available(host.command)), minimumVersion: host.minimumVersion ?? null, scopes: host.scopes, instructions: host.instructions }));
|
|
118
|
+
const hosts = PLUGIN_HOSTS.map(host => ({ id: host.id, label: host.label, mode: host.kind === 'manual' ? 'manual' : 'native', cli: host.command ?? null, cliFound: Boolean(host.command && runtime.available(host.command)), minimumVersion: host.minimumVersion ?? null, requiresTrust: Boolean(host.requiresTrust), scopes: host.scopes, instructions: host.instructions }));
|
|
111
119
|
stdout(json ? `${JSON.stringify({ ok: true, action: 'list', hosts })}\n` : `${hosts.map(host => `${host.id.padEnd(14)} ${host.mode.padEnd(7)} ${host.cliFound ? 'CLI found' : 'CLI not found / not required'}; scopes=${host.scopes.join('|')}`).join('\n')}\nCLI detection is not installation or version verification.\n`);
|
|
112
120
|
return 0;
|
|
113
121
|
}
|
package/dist/pluginBundle.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type PluginHost } from './pluginHosts.js';
|
|
2
2
|
import { type PluginRuntime } from './pluginRuntime.js';
|
|
3
|
+
export declare function validatePackedBundle(bundle: string, host: PluginHost): void;
|
|
3
4
|
export declare function ensureAgentPluginBundle(runtime: PluginRuntime, host: PluginHost): Promise<string>;
|
package/dist/pluginBundle.js
CHANGED
|
@@ -5,8 +5,7 @@ import { AGENT_PLUGIN_GIT_URL, AGENT_PLUGIN_NAME, AGENT_PLUGIN_REPOSITORY, AGENT
|
|
|
5
5
|
import { agentPluginRepositoryMatches } from './pluginInspection.js';
|
|
6
6
|
import { assertPluginManagedPath, checkedPluginCommand, pluginHome, PluginInstallError, readPluginJson, readPluginText } from './pluginRuntime.js';
|
|
7
7
|
const RECEIPT = '.evolver-plugin-checkout.json';
|
|
8
|
-
function
|
|
9
|
-
const bundle = join(checkout, 'dist', host.id);
|
|
8
|
+
export function validatePackedBundle(bundle, host) {
|
|
10
9
|
const root = lstatSync(bundle);
|
|
11
10
|
if (root.isSymbolicLink() || !root.isDirectory())
|
|
12
11
|
throw new PluginInstallError('failed', 'The plugin bundle root is not an ordinary owned directory.');
|
|
@@ -60,7 +59,7 @@ export async function ensureAgentPluginBundle(runtime, host) {
|
|
|
60
59
|
if (receipt?.['repository'] !== AGENT_PLUGIN_REPOSITORY || receipt['commit'] !== commit || receipt['host'] !== host.id) {
|
|
61
60
|
throw new PluginInstallError('conflict', 'The plugin cache directory is not an owned, matching release checkout.');
|
|
62
61
|
}
|
|
63
|
-
|
|
62
|
+
validatePackedBundle(join(checkout, 'dist', host.id), host);
|
|
64
63
|
return join(checkout, 'dist');
|
|
65
64
|
}
|
|
66
65
|
stage = mkdtempSync(join(base, `.${host.id}-`));
|
|
@@ -74,7 +73,7 @@ export async function ensureAgentPluginBundle(runtime, host) {
|
|
|
74
73
|
const head = await checkedPluginCommand(runtime, 'git', ['-C', source, 'rev-parse', 'HEAD']);
|
|
75
74
|
if (head.stdout.trim() !== commit)
|
|
76
75
|
throw new PluginInstallError('failed', 'The plugin release changed while downloading. Retry to use a consistent release.');
|
|
77
|
-
|
|
76
|
+
validatePackedBundle(join(source, 'dist', host.id), host);
|
|
78
77
|
writeFileSync(join(source, RECEIPT), `${JSON.stringify({ repository: AGENT_PLUGIN_REPOSITORY, commit, host: host.id })}\n`, { flag: 'wx', mode: 0o600 });
|
|
79
78
|
assertPluginManagedPath(checkout);
|
|
80
79
|
if (existsSync(checkout))
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type PluginInstallOptions } from './pluginHosts.js';
|
|
2
|
+
import { type PluginRuntime } from './pluginRuntime.js';
|
|
3
|
+
/**
|
|
4
|
+
* The dsh CLI runs the pnpm on PATH, while the dsh app uses its bundled pnpm. A profile installed by another
|
|
5
|
+
* pnpm major or into another store makes pnpm fail with ERR_PNPM_UNEXPECTED_STORE.
|
|
6
|
+
*/
|
|
7
|
+
export declare function assertDshProfileStoreMatches(runtime: PluginRuntime, options: PluginInstallOptions): Promise<void>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { realpathSync } from 'node:fs';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { DSH_PLUGIN_SOURCE } from './pluginHosts.js';
|
|
4
|
+
import { checkedPluginCommand, objectOf, pluginHome, PluginInstallError, readPluginText } from './pluginRuntime.js';
|
|
5
|
+
const PNPM_MAJOR = /^pnpm@(\d+)\./;
|
|
6
|
+
function yamlScalar(text, key) {
|
|
7
|
+
const value = new RegExp(`^${key}:[ \\t]*(.+?)[ \\t]*$`, 'm').exec(text)?.[1];
|
|
8
|
+
return value?.replace(/^(["'])(.*)\1$/, '$2');
|
|
9
|
+
}
|
|
10
|
+
function recordedProfileStore(text) {
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = objectOf(JSON.parse(text));
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
parsed = undefined;
|
|
17
|
+
}
|
|
18
|
+
const packageManager = parsed ? parsed['packageManager'] : yamlScalar(text, 'packageManager');
|
|
19
|
+
const storeDir = parsed ? parsed['storeDir'] : yamlScalar(text, 'storeDir');
|
|
20
|
+
return {
|
|
21
|
+
pnpmMajor: typeof packageManager === 'string' ? PNPM_MAJOR.exec(packageManager)?.[1] : undefined,
|
|
22
|
+
storeDir: typeof storeDir === 'string' && storeDir.trim() ? storeDir.trim() : undefined,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function comparableStorePath(path, base, platform) {
|
|
26
|
+
let absolute = resolve(base, path);
|
|
27
|
+
try {
|
|
28
|
+
absolute = realpathSync(absolute);
|
|
29
|
+
}
|
|
30
|
+
catch { /* A store that does not exist yet still has a comparable path. */ }
|
|
31
|
+
const trimmed = absolute.length > 1 ? absolute.replace(/[\\/]+$/, '') : absolute;
|
|
32
|
+
return platform === 'win32' ? trimmed.toLowerCase() : trimmed;
|
|
33
|
+
}
|
|
34
|
+
async function pathPnpmMajor(runtime, root) {
|
|
35
|
+
if (!runtime.available('pnpm'))
|
|
36
|
+
throw new PluginInstallError('host_missing', 'The dsh CLI installs plugins with the pnpm on PATH, and no pnpm was found. No dsh install command was run.');
|
|
37
|
+
const { stdout } = await checkedPluginCommand(runtime, 'pnpm', ['--version'], root, 30_000);
|
|
38
|
+
const major = /^(\d+)\.\d+\.\d+/.exec(stdout.trim())?.[1];
|
|
39
|
+
if (!major)
|
|
40
|
+
throw new PluginInstallError('unsupported_version', 'The pnpm on PATH reported an unrecognized version. No dsh install command was run.');
|
|
41
|
+
return major;
|
|
42
|
+
}
|
|
43
|
+
async function pathPnpmStore(runtime, profileDir) {
|
|
44
|
+
try {
|
|
45
|
+
const { stdout } = await checkedPluginCommand(runtime, 'pnpm', ['store', 'path'], profileDir, 30_000);
|
|
46
|
+
return stdout.trim().split(/\r?\n/).at(-1)?.trim() || undefined;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function storeMismatch(options, recordedMajor, problem) {
|
|
53
|
+
return new PluginInstallError('profile_store_mismatch', `dsh profile ${options.profile} ${problem} No dsh install command was run.`, [
|
|
54
|
+
`This profile is managed by pnpm ${recordedMajor}. Do one of these:`,
|
|
55
|
+
`- In dsh's own plugin screen, paste ${DSH_PLUGIN_SOURCE}`,
|
|
56
|
+
`- Put pnpm ${recordedMajor} with the profile's store on PATH, then rerun: evolver plugin install --host dsh --profile ${options.profile}`,
|
|
57
|
+
'Evolver does not reinstall the profile or edit its pnpm-workspace.yaml.',
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The dsh CLI runs the pnpm on PATH, while the dsh app uses its bundled pnpm. A profile installed by another
|
|
62
|
+
* pnpm major or into another store makes pnpm fail with ERR_PNPM_UNEXPECTED_STORE.
|
|
63
|
+
*/
|
|
64
|
+
export async function assertDshProfileStoreMatches(runtime, options) {
|
|
65
|
+
const profileDir = join(pluginHome(runtime), '.dsh', 'profiles', options.profile);
|
|
66
|
+
const modules = readPluginText(join(profileDir, 'node_modules', '.modules.yaml'));
|
|
67
|
+
if (modules === undefined)
|
|
68
|
+
return;
|
|
69
|
+
const recorded = recordedProfileStore(modules);
|
|
70
|
+
if (recorded.pnpmMajor === undefined)
|
|
71
|
+
return;
|
|
72
|
+
const onPath = await pathPnpmMajor(runtime, options.root);
|
|
73
|
+
if (onPath !== recorded.pnpmMajor)
|
|
74
|
+
throw storeMismatch(options, recorded.pnpmMajor, `is managed by pnpm ${recorded.pnpmMajor}, but the dsh CLI would use pnpm ${onPath} from PATH.`);
|
|
75
|
+
if (recorded.storeDir === undefined)
|
|
76
|
+
return;
|
|
77
|
+
const pathStore = await pathPnpmStore(runtime, profileDir);
|
|
78
|
+
if (pathStore === undefined)
|
|
79
|
+
return;
|
|
80
|
+
const base = join(profileDir, 'node_modules');
|
|
81
|
+
if (comparableStorePath(recorded.storeDir, base, runtime.platform) !== comparableStorePath(pathStore, profileDir, runtime.platform)) {
|
|
82
|
+
throw storeMismatch(options, recorded.pnpmMajor, `uses the pnpm store ${recorded.storeDir}, but the pnpm on PATH uses ${pathStore}.`);
|
|
83
|
+
}
|
|
84
|
+
}
|
package/dist/pluginHosts.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const AGENT_PLUGIN_REPOSITORY = "EvoMap/evolver-agent-plugin";
|
|
|
2
2
|
export declare const AGENT_PLUGIN_GIT_URL = "https://github.com/EvoMap/evolver-agent-plugin.git";
|
|
3
3
|
export declare const AGENT_PLUGIN_NAME = "evolver-plugin";
|
|
4
4
|
export declare const AGENT_PLUGIN_RELEASE = "release";
|
|
5
|
+
export declare const DSH_PLUGIN_SOURCE = "github:EvoMap/evolver-agent-plugin#release&path:dist/dsh";
|
|
5
6
|
export type PluginScope = 'user' | 'project';
|
|
6
7
|
type PluginHostId = 'claude-code' | 'codex' | 'grok' | 'qoder' | 'antigravity' | 'opencode' | 'dsh' | 'cursor' | 'workbuddy' | 'mcp-generic';
|
|
7
8
|
export interface PluginHost {
|
|
@@ -14,6 +15,10 @@ export interface PluginHost {
|
|
|
14
15
|
management?: 'plugin' | 'plugins';
|
|
15
16
|
marketplace?: string;
|
|
16
17
|
manifest?: string;
|
|
18
|
+
/** Where the packed plugin sits inside the checkout path the host's inventory reports. */
|
|
19
|
+
packedSubdir?: string;
|
|
20
|
+
/** The host's installer refuses to install hooks/MCP/skills until the user passes its trust flag. */
|
|
21
|
+
requiresTrust?: boolean;
|
|
17
22
|
legacyNames: readonly string[];
|
|
18
23
|
instructions: readonly string[];
|
|
19
24
|
}
|
|
@@ -25,6 +30,7 @@ export interface PluginInstallOptions {
|
|
|
25
30
|
root: string;
|
|
26
31
|
profile: string;
|
|
27
32
|
dryRun: boolean;
|
|
33
|
+
trust: boolean;
|
|
28
34
|
}
|
|
29
35
|
export interface PluginCommandStep {
|
|
30
36
|
name: string;
|
|
@@ -33,4 +39,14 @@ export interface PluginCommandStep {
|
|
|
33
39
|
}
|
|
34
40
|
export declare function pluginInstallSteps(options: PluginInstallOptions, bundle?: string): PluginCommandStep[];
|
|
35
41
|
export declare function pluginRollbackInstructions(options: PluginInstallOptions, bundle?: string): string[];
|
|
42
|
+
export interface StandalonePlugin {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
scope?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The host's own removal command for an old plugin, keeping its data where the host has a flag for that.
|
|
49
|
+
* Inventory values are host data, so a value that is not a plain argument never reaches a suggested command.
|
|
50
|
+
*/
|
|
51
|
+
export declare function standalonePluginRemoval(options: PluginInstallOptions, plugin: StandalonePlugin): string;
|
|
36
52
|
export {};
|
package/dist/pluginHosts.js
CHANGED
|
@@ -2,6 +2,7 @@ export const AGENT_PLUGIN_REPOSITORY = 'EvoMap/evolver-agent-plugin';
|
|
|
2
2
|
export const AGENT_PLUGIN_GIT_URL = `https://github.com/${AGENT_PLUGIN_REPOSITORY}.git`;
|
|
3
3
|
export const AGENT_PLUGIN_NAME = 'evolver-plugin';
|
|
4
4
|
export const AGENT_PLUGIN_RELEASE = 'release';
|
|
5
|
+
export const DSH_PLUGIN_SOURCE = `github:${AGENT_PLUGIN_REPOSITORY}#${AGENT_PLUGIN_RELEASE}&path:dist/dsh`;
|
|
5
6
|
export const PLUGIN_HOSTS = [
|
|
6
7
|
{
|
|
7
8
|
id: 'claude-code', label: 'Claude Code', command: 'claude', minimumVersion: '2.1.286',
|
|
@@ -11,14 +12,14 @@ export const PLUGIN_HOSTS = [
|
|
|
11
12
|
instructions: ['Restart Claude Code. Installed hooks modules also require the host rollout flag; an installed plugin is not proof that recall is active.'],
|
|
12
13
|
},
|
|
13
14
|
{
|
|
14
|
-
id: 'codex', label: 'Codex', command: 'codex', kind: 'marketplace', management: 'plugin', marketplace: 'evomap',
|
|
15
|
+
id: 'codex', label: 'Codex', command: 'codex', minimumVersion: '0.164.0', kind: 'marketplace', management: 'plugin', marketplace: 'evomap',
|
|
15
16
|
scopes: ['user'], manifest: '.codex-plugin/plugin.json', legacyNames: ['evolver'],
|
|
16
17
|
instructions: ['Open /hooks in Codex, review and trust the Evolver hooks, then start a new thread.'],
|
|
17
18
|
},
|
|
18
19
|
{
|
|
19
20
|
id: 'grok', label: 'Grok CLI', command: 'grok', minimumVersion: '1.0.70',
|
|
20
|
-
kind: 'marketplace', management: 'plugin', marketplace: '
|
|
21
|
-
legacyNames: ['evolver', 'evolver-grok-plugin'],
|
|
21
|
+
kind: 'marketplace', management: 'plugin', marketplace: 'evolver-agent-plugin', scopes: ['user'], manifest: '.grok-plugin/plugin.json',
|
|
22
|
+
packedSubdir: 'dist/grok', requiresTrust: true, legacyNames: ['evolver', 'evolver-grok-plugin'],
|
|
22
23
|
instructions: ['Restart Grok and review its hook trust settings. Recall reaches the first tool result; a turn without tools receives no strategy.'],
|
|
23
24
|
},
|
|
24
25
|
{
|
|
@@ -76,7 +77,7 @@ export function pluginHostNamed(name) {
|
|
|
76
77
|
return PLUGIN_HOSTS.find(host => host.id === (aliases[name] ?? name));
|
|
77
78
|
}
|
|
78
79
|
export function pluginInstallSteps(options, bundle = '<release-checkout>/dist') {
|
|
79
|
-
const { host, scope, profile } = options;
|
|
80
|
+
const { host, scope, profile, trust } = options;
|
|
80
81
|
const command = host.command ?? '';
|
|
81
82
|
if (host.kind === 'marketplace') {
|
|
82
83
|
const management = host.management;
|
|
@@ -84,7 +85,7 @@ export function pluginInstallSteps(options, bundle = '<release-checkout>/dist')
|
|
|
84
85
|
const add = [management, 'marketplace', 'add', AGENT_PLUGIN_REPOSITORY];
|
|
85
86
|
const install = host.id === 'codex'
|
|
86
87
|
? [management, 'add', selector, '--json']
|
|
87
|
-
: [management, 'install', selector, ...(host.id === 'claude-code' ? ['--scope', scope, '--json'] : [])];
|
|
88
|
+
: [management, 'install', selector, ...(host.id === 'claude-code' ? ['--scope', scope, '--json'] : []), ...(host.requiresTrust && trust ? ['--trust'] : [])];
|
|
88
89
|
return [
|
|
89
90
|
{ name: 'marketplace', command, args: add },
|
|
90
91
|
{ name: 'install', command, args: install },
|
|
@@ -96,7 +97,7 @@ export function pluginInstallSteps(options, bundle = '<release-checkout>/dist')
|
|
|
96
97
|
return [{ name: 'install', command, args: ['plugin', `${bundle}/opencode`, ...(scope === 'user' ? ['-g'] : [])] }];
|
|
97
98
|
if (host.id === 'dsh')
|
|
98
99
|
return [{
|
|
99
|
-
name: 'install', command, args: ['plugin', '--profile', profile, 'add', '-w',
|
|
100
|
+
name: 'install', command, args: ['plugin', '--profile', profile, 'add', '-w', DSH_PLUGIN_SOURCE],
|
|
100
101
|
}];
|
|
101
102
|
return [];
|
|
102
103
|
}
|
|
@@ -107,9 +108,9 @@ export function pluginRollbackInstructions(options, bundle) {
|
|
|
107
108
|
if (host.id === 'codex')
|
|
108
109
|
return [`codex plugin remove ${AGENT_PLUGIN_NAME}@${host.marketplace}`];
|
|
109
110
|
if (host.id === 'grok')
|
|
110
|
-
return ['grok plugin uninstall evolver-plugin'];
|
|
111
|
+
return ['grok plugin uninstall evolver-plugin --keep-data'];
|
|
111
112
|
if (host.id === 'qoder')
|
|
112
|
-
return ['qodercli plugins uninstall evolver-plugin@evomap'];
|
|
113
|
+
return ['qodercli plugins uninstall evolver-plugin@evomap --keep-data'];
|
|
113
114
|
if (host.id === 'antigravity')
|
|
114
115
|
return ['agy plugin uninstall evolver-plugin'];
|
|
115
116
|
if (host.id === 'dsh')
|
|
@@ -117,4 +118,29 @@ export function pluginRollbackInstructions(options, bundle) {
|
|
|
117
118
|
if (host.id === 'opencode')
|
|
118
119
|
return [`Remove only this plugin's ${bundle ?? '<installed-bundle>'}/opencode/server.mjs and tui.mjs entries from opencode.json and tui.json; preserve neighboring configuration.`];
|
|
119
120
|
return [];
|
|
121
|
+
}
|
|
122
|
+
const SHELL_SAFE_ARGUMENT = /^[A-Za-z0-9@._/][A-Za-z0-9@._/-]*$/;
|
|
123
|
+
/**
|
|
124
|
+
* The host's own removal command for an old plugin, keeping its data where the host has a flag for that.
|
|
125
|
+
* Inventory values are host data, so a value that is not a plain argument never reaches a suggested command.
|
|
126
|
+
*/
|
|
127
|
+
export function standalonePluginRemoval(options, plugin) {
|
|
128
|
+
const { host, profile } = options;
|
|
129
|
+
const scope = plugin.scope ?? options.scope;
|
|
130
|
+
if ([plugin.id, plugin.name, scope].some(value => !SHELL_SAFE_ARGUMENT.test(value))) {
|
|
131
|
+
return `Remove the standalone Evolver plugin through ${host.label}'s own plugin manager, keeping its data; its inventory name is not a plain command argument, so no command is suggested.`;
|
|
132
|
+
}
|
|
133
|
+
if (host.id === 'claude-code')
|
|
134
|
+
return `claude plugin uninstall ${plugin.id} --scope ${scope} --keep-data`;
|
|
135
|
+
if (host.id === 'codex')
|
|
136
|
+
return `codex plugin remove ${plugin.id}`;
|
|
137
|
+
if (host.id === 'grok')
|
|
138
|
+
return `grok plugin uninstall ${plugin.name} --keep-data`;
|
|
139
|
+
if (host.id === 'qoder')
|
|
140
|
+
return `qodercli plugins uninstall ${plugin.id} --scope ${scope} --keep-data`;
|
|
141
|
+
if (host.id === 'antigravity')
|
|
142
|
+
return `agy plugin uninstall ${plugin.name}`;
|
|
143
|
+
if (host.id === 'dsh')
|
|
144
|
+
return `dsh plugin --profile ${profile} remove ${plugin.name}`;
|
|
145
|
+
return `Remove only the ${plugin.name} entries from the OpenCode opencode.json and tui.json; keep the rest of the configuration.`;
|
|
120
146
|
}
|
|
@@ -14,6 +14,8 @@ export interface PluginInspection {
|
|
|
14
14
|
installed?: InstalledAgentPlugin;
|
|
15
15
|
marketplacePresent: boolean;
|
|
16
16
|
conflicts: string[];
|
|
17
|
+
/** Native commands the user can run to remove a conflicting standalone plugin; never run automatically. */
|
|
18
|
+
migrations: string[];
|
|
17
19
|
}
|
|
18
20
|
export declare function installedPluginsFromJson(value: unknown, host: PluginHost): InstalledAgentPlugin[];
|
|
19
21
|
export declare function agentPluginRepositoryMatches(value: unknown): boolean;
|
package/dist/pluginInspection.js
CHANGED
|
@@ -2,7 +2,7 @@ import { resolveOpenCodeConfig } from '@evomap/evolver-mcp';
|
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { dirname, join, resolve } from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { AGENT_PLUGIN_GIT_URL, AGENT_PLUGIN_NAME, AGENT_PLUGIN_REPOSITORY } from './pluginHosts.js';
|
|
5
|
+
import { AGENT_PLUGIN_GIT_URL, AGENT_PLUGIN_NAME, AGENT_PLUGIN_REPOSITORY, standalonePluginRemoval } from './pluginHosts.js';
|
|
6
6
|
import { checkedPluginCommand, objectOf, pluginHome, pluginJson, pluginVersionAtLeast, PluginInstallError, readPluginJson, readPluginText } from './pluginRuntime.js';
|
|
7
7
|
function listRecords(value, key, label) {
|
|
8
8
|
const list = Array.isArray(value) ? value : objectOf(value)?.[key];
|
|
@@ -91,11 +91,14 @@ async function inspectMarketplacePlugin(runtime, options) {
|
|
|
91
91
|
const markets = listRecords(pluginJson(marketResult.stdout, `${host.label} marketplace list`), 'marketplaces', `${host.label} marketplace list`);
|
|
92
92
|
const market = markets.find(record => record['name'] === host.marketplace);
|
|
93
93
|
const conflicts = oldHookConflicts(runtime, options);
|
|
94
|
+
const migrations = [];
|
|
94
95
|
if (market && !await marketplaceMatches(runtime, market))
|
|
95
96
|
conflicts.push(`Marketplace ${host.marketplace} belongs to another source. Review its plugins before replacing it with ${AGENT_PLUGIN_REPOSITORY}.`);
|
|
96
97
|
for (const plugin of plugins) {
|
|
97
|
-
if (host.legacyNames.includes(plugin.name) && plugin.enabled)
|
|
98
|
+
if (host.legacyNames.includes(plugin.name) && plugin.enabled) {
|
|
98
99
|
conflicts.push(`The standalone ${plugin.name} plugin is enabled. Disable/remove it using ${host.label}, keeping its data, before installing ${AGENT_PLUGIN_NAME}.`);
|
|
100
|
+
migrations.push(standalonePluginRemoval(options, plugin));
|
|
101
|
+
}
|
|
99
102
|
if (plugin.name === AGENT_PLUGIN_NAME && plugin.id !== `${AGENT_PLUGIN_NAME}@${host.marketplace}` && !(host.id === 'grok' && plugin.id === AGENT_PLUGIN_NAME))
|
|
100
103
|
conflicts.push('An Evolver plugin from another marketplace is registered; review that installation before continuing.');
|
|
101
104
|
}
|
|
@@ -106,14 +109,15 @@ async function inspectMarketplacePlugin(runtime, options) {
|
|
|
106
109
|
conflicts.push('The plugin is installed but disabled. Enable it explicitly in the host rather than installing another copy.');
|
|
107
110
|
if (installed && host.id === 'codex' && !agentPluginRepositoryMatches(repositoryOf(installed.raw)))
|
|
108
111
|
conflicts.push('The installed plugin source does not match the unified Evolver plugin repository.');
|
|
109
|
-
return { installed, marketplacePresent: Boolean(market), conflicts };
|
|
112
|
+
return { installed, marketplacePresent: Boolean(market), conflicts, migrations };
|
|
110
113
|
}
|
|
111
114
|
export function verifyPluginManifest(runtime, options, plugin, installAnswer) {
|
|
112
115
|
const { host } = options;
|
|
113
116
|
if (!pluginVersionAtLeast(plugin.version, plugin.version))
|
|
114
117
|
throw new PluginInstallError('failed', 'The installed plugin has no verifiable version.');
|
|
115
118
|
const answer = objectOf(installAnswer);
|
|
116
|
-
const
|
|
119
|
+
const listedPath = plugin.path && host.packedSubdir ? join(plugin.path, host.packedSubdir) : plugin.path;
|
|
120
|
+
const path = listedPath ?? stringOf(answer?.['installedPath']) ?? stringOf(answer?.['installPath'])
|
|
117
121
|
?? (host.id === 'codex' ? join(runtime.env['CODEX_HOME'] ?? join(pluginHome(runtime), '.codex'), 'plugins', 'cache', host.marketplace, AGENT_PLUGIN_NAME, plugin.version) : undefined);
|
|
118
122
|
if (!path || !host.manifest)
|
|
119
123
|
throw new PluginInstallError('failed', 'The host did not identify a verifiable installed plugin directory.');
|
|
@@ -161,10 +165,13 @@ export function inspectOpenCodePlugin(runtime, options) {
|
|
|
161
165
|
const tuiFile = existsSync(join(root, 'tui.jsonc')) ? join(root, 'tui.jsonc') : join(root, 'tui.json');
|
|
162
166
|
const tuiEntries = pluginEntries(readPluginJson(tuiFile));
|
|
163
167
|
const conflicts = [];
|
|
168
|
+
const migrations = [];
|
|
164
169
|
const pairs = [];
|
|
165
170
|
for (const entry of [...serverEntries, ...tuiEntries]) {
|
|
166
|
-
if (options.host.legacyNames.some(name => entry.includes(name)))
|
|
171
|
+
if (options.host.legacyNames.some(name => entry.includes(name))) {
|
|
167
172
|
conflicts.push('The standalone OpenCode Evolver package is registered; remove only its entries, keeping its data.');
|
|
173
|
+
migrations.push(standalonePluginRemoval(options, { id: entry, name: entry }));
|
|
174
|
+
}
|
|
168
175
|
}
|
|
169
176
|
if (existsSync(join(options.root, '.opencode', 'plugins', 'evolver.js')))
|
|
170
177
|
conflicts.push('A legacy .opencode/plugins/evolver.js is present; inspect/disable it before continuing.');
|
|
@@ -199,7 +206,7 @@ export function inspectOpenCodePlugin(runtime, options) {
|
|
|
199
206
|
const path = pair && dirname(pair.server);
|
|
200
207
|
const manifest = path && readPluginJson(join(path, 'package.json'));
|
|
201
208
|
const installed = manifest && typeof manifest['version'] === 'string' ? { id: AGENT_PLUGIN_NAME, name: AGENT_PLUGIN_NAME, version: manifest['version'], enabled: true, path, raw: manifest } : undefined;
|
|
202
|
-
return { installed, marketplacePresent: false, conflicts };
|
|
209
|
+
return { installed, marketplacePresent: false, conflicts, migrations: [...new Set(migrations)] };
|
|
203
210
|
}
|
|
204
211
|
function inspectDshPlugin(runtime, options) {
|
|
205
212
|
const profileDir = join(pluginHome(runtime), '.dsh', 'profiles', options.profile);
|
|
@@ -208,15 +215,17 @@ function inspectDshPlugin(runtime, options) {
|
|
|
208
215
|
const path = join(profileDir, 'node_modules', '@evomap', 'dsh-evolver');
|
|
209
216
|
const manifest = readPluginJson(join(path, 'package.json'));
|
|
210
217
|
const conflicts = [];
|
|
218
|
+
const migrations = [];
|
|
211
219
|
if (dependency !== undefined && (typeof dependency !== 'string' || !dependency.includes(`github:${AGENT_PLUGIN_REPOSITORY}#release&path:dist/dsh`))) {
|
|
212
220
|
conflicts.push(`Profile ${options.profile} contains the standalone or differently sourced @evomap/dsh-evolver. Remove that package in this profile first; keep its state.`);
|
|
221
|
+
migrations.push(standalonePluginRemoval(options, { id: '@evomap/dsh-evolver', name: '@evomap/dsh-evolver' }));
|
|
213
222
|
}
|
|
214
223
|
const repository = packageRepositoryOf(manifest?.['repository']);
|
|
215
224
|
if (manifest && !agentPluginRepositoryMatches(repository))
|
|
216
225
|
conflicts.push('The installed dsh package does not belong to the unified plugin repository.');
|
|
217
226
|
const installed = manifest && dependency !== undefined && typeof manifest['version'] === 'string'
|
|
218
227
|
? { id: AGENT_PLUGIN_NAME, name: AGENT_PLUGIN_NAME, version: manifest['version'], enabled: true, path, raw: manifest } : undefined;
|
|
219
|
-
return { installed, marketplacePresent: false, conflicts };
|
|
228
|
+
return { installed, marketplacePresent: false, conflicts, migrations };
|
|
220
229
|
}
|
|
221
230
|
export async function inspectAgentPlugin(runtime, options) {
|
|
222
231
|
if (options.host.kind === 'marketplace')
|
|
@@ -228,10 +237,12 @@ export async function inspectAgentPlugin(runtime, options) {
|
|
|
228
237
|
const result = await checkedPluginCommand(runtime, options.host.command, ['plugin', 'list', '--json'], options.root);
|
|
229
238
|
const plugins = installedPluginsFromJson(pluginJson(result.stdout, 'Antigravity plugin list'), options.host);
|
|
230
239
|
const installed = plugins.find(plugin => plugin.name === AGENT_PLUGIN_NAME);
|
|
231
|
-
const
|
|
240
|
+
const standalone = plugins.filter(plugin => options.host.legacyNames.includes(plugin.name) && plugin.enabled);
|
|
241
|
+
const conflicts = standalone.map(plugin => `Standalone ${plugin.name} is enabled; disable/remove it and keep its data before continuing.`);
|
|
242
|
+
const migrations = standalone.map(plugin => standalonePluginRemoval(options, plugin));
|
|
232
243
|
if (installed && hasForeignInstalledScope(installed, options.scope))
|
|
233
244
|
conflicts.push('The host registered this plugin in another scope; it cannot confirm the requested installation scope.');
|
|
234
245
|
if (installed && !installed.enabled)
|
|
235
246
|
conflicts.push('The plugin is installed but disabled. Enable it explicitly in the host rather than installing another copy.');
|
|
236
|
-
return { marketplacePresent: false, installed, conflicts };
|
|
247
|
+
return { marketplacePresent: false, installed, conflicts, migrations };
|
|
237
248
|
}
|
package/dist/pluginInstall.d.ts
CHANGED
package/dist/pluginInstall.js
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import { ensureAgentPluginBundle } from './pluginBundle.js';
|
|
2
|
+
import { assertDshProfileStoreMatches } from './pluginDshStore.js';
|
|
2
3
|
import { AGENT_PLUGIN_NAME, AGENT_PLUGIN_REPOSITORY, pluginInstallSteps, pluginRollbackInstructions } from './pluginHosts.js';
|
|
3
4
|
import { inspectAgentPlugin, verifyPluginManifest } from './pluginInspection.js';
|
|
4
5
|
import { withPluginInstallLock } from './pluginLock.js';
|
|
5
6
|
import { checkedPluginCommand, checkPluginHostVersion, PluginInstallError } from './pluginRuntime.js';
|
|
7
|
+
function trustInstruction(host) {
|
|
8
|
+
return `${host.label} asks you to trust a plugin before it installs. Review ${AGENT_PLUGIN_REPOSITORY}, then rerun with --trust: evolver plugin install --host ${host.id} --trust`;
|
|
9
|
+
}
|
|
10
|
+
function assertNoConflicts(inspection) {
|
|
11
|
+
if (inspection.conflicts.length > 0)
|
|
12
|
+
throw new PluginInstallError('conflict', inspection.conflicts.join('\n'), inspection.migrations);
|
|
13
|
+
}
|
|
14
|
+
function migrationInstructions(error) {
|
|
15
|
+
if (!(error instanceof PluginInstallError) || error.instructions.length === 0)
|
|
16
|
+
return [];
|
|
17
|
+
if (error.status !== 'conflict')
|
|
18
|
+
return [...error.instructions];
|
|
19
|
+
return ['To migrate, run this yourself after checking the old plugin and its data (Evolver never runs it):', ...error.instructions];
|
|
20
|
+
}
|
|
6
21
|
export async function installAgentPlugin(runtime, options) {
|
|
7
22
|
const { host } = options;
|
|
8
23
|
const result = {
|
|
9
|
-
ok: false, status: 'failed', host: host.id, scope: options.scope, verified: false, repository: AGENT_PLUGIN_REPOSITORY,
|
|
24
|
+
ok: false, status: 'failed', host: host.id, scope: options.scope, verified: false, requiresTrust: Boolean(host.requiresTrust), repository: AGENT_PLUGIN_REPOSITORY,
|
|
10
25
|
commands: pluginInstallSteps(options), completed: [], instructions: [...host.instructions], rollback: pluginRollbackInstructions(options),
|
|
11
26
|
...(host.id === 'dsh' && { profile: options.profile }),
|
|
12
27
|
};
|
|
@@ -16,25 +31,30 @@ export async function installAgentPlugin(runtime, options) {
|
|
|
16
31
|
: result.instructions;
|
|
17
32
|
return { ...result, status: 'manual_required', instructions: [...instructions, `Requested scope: ${options.scope}. No client configuration was changed.`] };
|
|
18
33
|
}
|
|
19
|
-
|
|
20
|
-
|
|
34
|
+
const trustMissing = host.requiresTrust && !options.trust;
|
|
35
|
+
if (options.dryRun) {
|
|
36
|
+
return { ...result, ok: true, status: 'dry_run', instructions: [...result.instructions, ...(trustMissing ? [trustInstruction(host)] : []), 'Preview only: host version, registration, download and installation have not been executed.'] };
|
|
37
|
+
}
|
|
38
|
+
if (trustMissing) {
|
|
39
|
+
return { ...result, status: 'trust_required', error: `${host.label} installs plugin hooks, MCP servers and skills only after you trust the plugin. No host command was run.`, instructions: [trustInstruction(host)] };
|
|
40
|
+
}
|
|
21
41
|
try {
|
|
22
42
|
await checkPluginHostVersion(runtime, host);
|
|
23
43
|
let inspection = await inspectAgentPlugin(runtime, options);
|
|
24
|
-
|
|
25
|
-
throw new PluginInstallError('conflict', inspection.conflicts.join('\n'));
|
|
44
|
+
assertNoConflicts(inspection);
|
|
26
45
|
if (inspection.installed) {
|
|
27
46
|
const installedPath = verifyPluginManifest(runtime, options, inspection.installed);
|
|
28
47
|
return { ...result, ok: true, status: 'already_installed', verified: true, version: inspection.installed.version, installedPath, commands: [] };
|
|
29
48
|
}
|
|
30
49
|
return await withPluginInstallLock(runtime, options, async () => {
|
|
31
50
|
inspection = await inspectAgentPlugin(runtime, options);
|
|
32
|
-
|
|
33
|
-
throw new PluginInstallError('conflict', inspection.conflicts.join('\n'));
|
|
51
|
+
assertNoConflicts(inspection);
|
|
34
52
|
if (inspection.installed) {
|
|
35
53
|
const installedPath = verifyPluginManifest(runtime, options, inspection.installed);
|
|
36
54
|
return { ...result, ok: true, status: 'already_installed', verified: true, version: inspection.installed.version, installedPath, commands: [] };
|
|
37
55
|
}
|
|
56
|
+
if (host.id === 'dsh')
|
|
57
|
+
await assertDshProfileStoreMatches(runtime, options);
|
|
38
58
|
let bundle;
|
|
39
59
|
if (host.kind === 'bundle') {
|
|
40
60
|
bundle = await ensureAgentPluginBundle(runtime, host);
|
|
@@ -62,8 +82,7 @@ export async function installAgentPlugin(runtime, options) {
|
|
|
62
82
|
}
|
|
63
83
|
}
|
|
64
84
|
inspection = await inspectAgentPlugin(runtime, options);
|
|
65
|
-
|
|
66
|
-
throw new PluginInstallError('conflict', inspection.conflicts.join('\n'));
|
|
85
|
+
assertNoConflicts(inspection);
|
|
67
86
|
if (!inspection.installed)
|
|
68
87
|
throw new PluginInstallError('failed', `The ${AGENT_PLUGIN_NAME} command completed, but the selected host/scope did not register it. Installation was not confirmed.`);
|
|
69
88
|
const installedPath = verifyPluginManifest(runtime, options, inspection.installed, installAnswer);
|
|
@@ -75,7 +94,7 @@ export async function installAgentPlugin(runtime, options) {
|
|
|
75
94
|
...result,
|
|
76
95
|
status: error instanceof PluginInstallError ? error.status : 'failed',
|
|
77
96
|
error: error instanceof PluginInstallError ? error.message : 'The plugin operation failed; no verified installation was reported.',
|
|
78
|
-
instructions: [...result.instructions, ...(result.completed.length > 0 ? [
|
|
97
|
+
instructions: [...result.instructions, ...migrationInstructions(error), ...(result.completed.length > 0 ? [
|
|
79
98
|
`Commands already completed: ${result.completed.join(', ')}. Inspect the selected host before retrying.`,
|
|
80
99
|
'No existing plugin, user data or marketplace was automatically removed. Use the rollback instructions only after checking the current host registration.',
|
|
81
100
|
] : [])],
|
package/dist/pluginRuntime.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { exec } from '@evomap/evolver-core';
|
|
2
2
|
import type { PluginHost } from './pluginHosts.js';
|
|
3
3
|
export type PluginProcessResult = Awaited<ReturnType<typeof exec.spawnCapture>>;
|
|
4
|
-
export type PluginInstallStatus = 'installed' | 'already_installed' | 'dry_run' | 'manual_required' | 'host_missing' | 'unsupported_version' | 'unsupported_capability' | 'conflict' | 'failed' | 'invalid_arguments' | 'selection_required';
|
|
4
|
+
export type PluginInstallStatus = 'installed' | 'already_installed' | 'dry_run' | 'manual_required' | 'host_missing' | 'unsupported_version' | 'unsupported_capability' | 'conflict' | 'failed' | 'invalid_arguments' | 'selection_required' | 'trust_required' | 'profile_store_mismatch';
|
|
5
5
|
export declare class PluginInstallError extends Error {
|
|
6
6
|
readonly status: PluginInstallStatus;
|
|
7
|
-
|
|
7
|
+
readonly instructions: readonly string[];
|
|
8
|
+
constructor(status: PluginInstallStatus, message: string, instructions?: readonly string[]);
|
|
8
9
|
}
|
|
9
10
|
export interface PluginRuntime {
|
|
10
11
|
env: NodeJS.ProcessEnv;
|
package/dist/pluginRuntime.js
CHANGED
|
@@ -4,9 +4,11 @@ import { homedir } from 'node:os';
|
|
|
4
4
|
import { delimiter, dirname, isAbsolute, join, resolve } from 'node:path';
|
|
5
5
|
export class PluginInstallError extends Error {
|
|
6
6
|
status;
|
|
7
|
-
|
|
7
|
+
instructions;
|
|
8
|
+
constructor(status, message, instructions = []) {
|
|
8
9
|
super(message);
|
|
9
10
|
this.status = status;
|
|
11
|
+
this.instructions = instructions;
|
|
10
12
|
this.name = 'PluginInstallError';
|
|
11
13
|
}
|
|
12
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evomap/evolver-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.48",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@evomap/evolver-core": "2.0.
|
|
31
|
-
"@evomap/evolver-adapter-public": "2.0.
|
|
32
|
-
"@evomap/evolver-mcp": "2.0.
|
|
33
|
-
"@evomap/evolver-proxy": "2.0.
|
|
34
|
-
"@evomap/evolver-runtime-adapters": "2.0.
|
|
35
|
-
"@evomap/evolver-webui": "2.0.
|
|
30
|
+
"@evomap/evolver-core": "2.0.48",
|
|
31
|
+
"@evomap/evolver-adapter-public": "2.0.48",
|
|
32
|
+
"@evomap/evolver-mcp": "2.0.48",
|
|
33
|
+
"@evomap/evolver-proxy": "2.0.48",
|
|
34
|
+
"@evomap/evolver-runtime-adapters": "2.0.48",
|
|
35
|
+
"@evomap/evolver-webui": "2.0.48"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|