@evomap/evolver-cli 2.0.47 → 2.0.49
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/autoDistillTranscript.d.ts +1 -1
- package/dist/autoDistillTranscript.js +9 -2
- package/dist/autoexec.js +4 -0
- package/dist/cliContracts.js +5 -28
- package/dist/cycleConsumer.js +3 -0
- package/dist/distillAdmission.d.ts +8 -1
- package/dist/distillAdmission.js +30 -0
- package/dist/distillObserver.d.ts +0 -6
- package/dist/distillObserver.js +17 -5
- package/dist/distillPrimitives.d.ts +4 -3
- package/dist/distillPrimitives.js +27 -18
- package/dist/doctor.d.ts +3 -0
- package/dist/doctor.js +17 -0
- package/dist/feedbackOutbox.js +11 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/lifecycle.d.ts +9 -0
- package/dist/lifecycle.js +158 -98
- package/dist/lifecycleAutoexecCompanion.d.ts +40 -0
- package/dist/lifecycleAutoexecCompanion.js +102 -0
- package/dist/llmCycle.js +15 -5
- package/dist/localMemoryGraph.js +23 -19
- 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/dist/promptRecallRuntime.d.ts +3 -0
- package/dist/promptRecallRuntime.js +6 -0
- package/dist/promptRecallShared.d.ts +2 -0
- package/dist/promptRecallShared.js +13 -3
- package/dist/protectedAuditStatus.d.ts +22 -0
- package/dist/protectedAuditStatus.js +234 -0
- package/dist/recall.js +2 -3
- package/dist/runtimeCapabilities.d.ts +1 -1
- package/dist/runtimeCapabilities.js +24 -0
- package/dist/runtimeSessionSource.js +4 -4
- package/dist/sessionIngest.js +3 -0
- package/dist/setupHooks.d.ts +3 -0
- package/dist/setupHooks.js +29 -5
- package/dist/trajectoryExport.js +2 -2
- package/package.json +7 -7
package/dist/localMemoryGraph.js
CHANGED
|
@@ -3,7 +3,7 @@ import { closeSync, constants, existsSync, fstatSync, ftruncateSync, fsyncSync,
|
|
|
3
3
|
import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
4
4
|
import { userInfo } from 'node:os';
|
|
5
5
|
import { gzipSync, gunzipSync } from 'node:zlib';
|
|
6
|
-
import { reference, algo, events, util } from '@evomap/evolver-core';
|
|
6
|
+
import { reference, algo, events, util, assetstore } from '@evomap/evolver-core';
|
|
7
7
|
import { MAX_TRIGGER_FEEDBACK_BYTES, TRIGGER_FEEDBACK_FILE, readLocalTriggerFeedback, upsertLocalTriggerFeedback, triggerFeedbackRecords } from './localTriggerFeedback.js';
|
|
8
8
|
import { authorizeTriggerFeedbackDelivery, claimTriggerFeedbackDelivery, markTriggerFeedbackDispatched, settleTriggerFeedbackDelivery } from './triggerFeedbackSyncState.js';
|
|
9
9
|
const ACTIVE_FILE = 'memory_graph.v2.jsonl';
|
|
@@ -524,7 +524,7 @@ export class LocalMemoryGraph {
|
|
|
524
524
|
const payload = this.readResetSource(file);
|
|
525
525
|
const destination = join(backup.pendingDir, file.name);
|
|
526
526
|
this.writeAtomic(destination, payload);
|
|
527
|
-
const copiedIdentity =
|
|
527
|
+
const copiedIdentity = graphPathSnapshot(destination);
|
|
528
528
|
const copiedPayload = this.readRawBounded(destination, payload.length);
|
|
529
529
|
if (!copiedIdentity.isFile() || copiedIdentity.isSymbolicLink()
|
|
530
530
|
|| copiedPayload === null || !copiedPayload.equals(payload)) {
|
|
@@ -596,7 +596,7 @@ export class LocalMemoryGraph {
|
|
|
596
596
|
const path = join(this.dir, name);
|
|
597
597
|
let identity;
|
|
598
598
|
try {
|
|
599
|
-
identity =
|
|
599
|
+
identity = graphPathSnapshot(path);
|
|
600
600
|
}
|
|
601
601
|
catch (error) {
|
|
602
602
|
if (isObject(error) && error['code'] === 'ENOENT')
|
|
@@ -661,7 +661,7 @@ export class LocalMemoryGraph {
|
|
|
661
661
|
cleanupResetPendingDirectory(backup, copied) {
|
|
662
662
|
for (const file of [...copied].reverse()) {
|
|
663
663
|
try {
|
|
664
|
-
const current =
|
|
664
|
+
const current = graphPathSnapshot(file.path);
|
|
665
665
|
if (current.isFile() && !current.isSymbolicLink()
|
|
666
666
|
&& sameGraphFileIdentity(file.identity, current))
|
|
667
667
|
unlinkSync(file.path);
|
|
@@ -773,7 +773,7 @@ export class LocalMemoryGraph {
|
|
|
773
773
|
const path = join(this.dir, EPOCH_FILE);
|
|
774
774
|
let identity;
|
|
775
775
|
try {
|
|
776
|
-
identity =
|
|
776
|
+
identity = graphPathSnapshot(path);
|
|
777
777
|
}
|
|
778
778
|
catch (error) {
|
|
779
779
|
if (isObject(error) && error['code'] === 'ENOENT') {
|
|
@@ -856,7 +856,7 @@ export class LocalMemoryGraph {
|
|
|
856
856
|
if (!baseline)
|
|
857
857
|
return false;
|
|
858
858
|
try {
|
|
859
|
-
const current =
|
|
859
|
+
const current = graphPathSnapshot(join(this.dir, COMPACT_FILE));
|
|
860
860
|
return current.isFile() && !current.isSymbolicLink()
|
|
861
861
|
&& serializedSnapshotMatches(baseline, current);
|
|
862
862
|
}
|
|
@@ -886,7 +886,7 @@ export class LocalMemoryGraph {
|
|
|
886
886
|
const path = join(this.dir, ACTIVE_FILE);
|
|
887
887
|
let identity;
|
|
888
888
|
try {
|
|
889
|
-
identity =
|
|
889
|
+
identity = graphPathSnapshot(path);
|
|
890
890
|
}
|
|
891
891
|
catch (error) {
|
|
892
892
|
if (isObject(error) && error['code'] === 'ENOENT') {
|
|
@@ -955,7 +955,7 @@ export class LocalMemoryGraph {
|
|
|
955
955
|
if (!expected)
|
|
956
956
|
return true;
|
|
957
957
|
try {
|
|
958
|
-
const current =
|
|
958
|
+
const current = graphPathSnapshot(join(this.dir, file));
|
|
959
959
|
return !current.isFile() || current.isSymbolicLink()
|
|
960
960
|
|| !serializedSnapshotMatches(expected, current);
|
|
961
961
|
}
|
|
@@ -1074,7 +1074,7 @@ export class LocalMemoryGraph {
|
|
|
1074
1074
|
const archives = this.archiveFiles().length;
|
|
1075
1075
|
let activeOversized = false;
|
|
1076
1076
|
if (existsSync(activePath) && this.secureRegularFile(activePath)) {
|
|
1077
|
-
const activeIdentity =
|
|
1077
|
+
const activeIdentity = graphPathSnapshot(activePath);
|
|
1078
1078
|
const window = this.activeLogicalWindow(epoch, activeIdentity);
|
|
1079
1079
|
activeOversized = window.invalid || window.size > this.maxActiveBytes;
|
|
1080
1080
|
}
|
|
@@ -1199,7 +1199,7 @@ export class LocalMemoryGraph {
|
|
|
1199
1199
|
const path = join(this.dir, file);
|
|
1200
1200
|
let stat;
|
|
1201
1201
|
try {
|
|
1202
|
-
stat =
|
|
1202
|
+
stat = graphPathSnapshot(path);
|
|
1203
1203
|
}
|
|
1204
1204
|
catch (error) {
|
|
1205
1205
|
if (isObject(error) && error['code'] === 'ENOENT')
|
|
@@ -1681,7 +1681,7 @@ export class LocalMemoryGraph {
|
|
|
1681
1681
|
rotationTargetMatches(path, target) {
|
|
1682
1682
|
let identity;
|
|
1683
1683
|
try {
|
|
1684
|
-
identity =
|
|
1684
|
+
identity = graphPathSnapshot(path);
|
|
1685
1685
|
}
|
|
1686
1686
|
catch (error) {
|
|
1687
1687
|
if (isObject(error) && error['code'] === 'ENOENT')
|
|
@@ -1716,7 +1716,7 @@ export class LocalMemoryGraph {
|
|
|
1716
1716
|
removeVerifiedRotationFile(path, identity, reason) {
|
|
1717
1717
|
let current;
|
|
1718
1718
|
try {
|
|
1719
|
-
current =
|
|
1719
|
+
current = graphPathSnapshot(path);
|
|
1720
1720
|
}
|
|
1721
1721
|
catch {
|
|
1722
1722
|
throw new Error(reason);
|
|
@@ -1736,7 +1736,7 @@ export class LocalMemoryGraph {
|
|
|
1736
1736
|
readVerifiedRotationFile(path, maxBytes, optional, reason, range) {
|
|
1737
1737
|
let pathBefore;
|
|
1738
1738
|
try {
|
|
1739
|
-
pathBefore =
|
|
1739
|
+
pathBefore = graphPathSnapshot(path);
|
|
1740
1740
|
}
|
|
1741
1741
|
catch (error) {
|
|
1742
1742
|
if (optional && isObject(error) && error['code'] === 'ENOENT')
|
|
@@ -1772,7 +1772,7 @@ export class LocalMemoryGraph {
|
|
|
1772
1772
|
const openedAfter = fstatSync(fd, { bigint: true });
|
|
1773
1773
|
let pathAfter;
|
|
1774
1774
|
try {
|
|
1775
|
-
pathAfter =
|
|
1775
|
+
pathAfter = graphPathSnapshot(path);
|
|
1776
1776
|
}
|
|
1777
1777
|
catch {
|
|
1778
1778
|
throw new Error(reason);
|
|
@@ -1811,7 +1811,7 @@ export class LocalMemoryGraph {
|
|
|
1811
1811
|
const path = join(this.dir, name);
|
|
1812
1812
|
let identity;
|
|
1813
1813
|
try {
|
|
1814
|
-
identity =
|
|
1814
|
+
identity = graphPathSnapshot(path);
|
|
1815
1815
|
}
|
|
1816
1816
|
catch (error) {
|
|
1817
1817
|
if (isObject(error) && error['code'] === 'ENOENT')
|
|
@@ -1935,7 +1935,7 @@ export class LocalMemoryGraph {
|
|
|
1935
1935
|
if (!this.secureRegularFile(activePath)) {
|
|
1936
1936
|
throw new MemoryGraphImportStateRejectedError();
|
|
1937
1937
|
}
|
|
1938
|
-
const activeWindow = this.activeLogicalWindow(epoch,
|
|
1938
|
+
const activeWindow = this.activeLogicalWindow(epoch, graphPathSnapshot(activePath));
|
|
1939
1939
|
if (activeWindow.invalid || activeWindow.size > this.maxActiveBytes) {
|
|
1940
1940
|
throw new MemoryGraphImportStateRejectedError();
|
|
1941
1941
|
}
|
|
@@ -2044,7 +2044,7 @@ export class LocalMemoryGraph {
|
|
|
2044
2044
|
let closed = false;
|
|
2045
2045
|
let published = false;
|
|
2046
2046
|
try {
|
|
2047
|
-
tempIdentity =
|
|
2047
|
+
tempIdentity = graphPathSnapshot(temp);
|
|
2048
2048
|
const descriptorIdentity = fstatSync(fd, { bigint: true });
|
|
2049
2049
|
if (!tempIdentity.isFile() || tempIdentity.isSymbolicLink()
|
|
2050
2050
|
|| !descriptorIdentity.isFile() || descriptorIdentity.isSymbolicLink()
|
|
@@ -2071,7 +2071,7 @@ export class LocalMemoryGraph {
|
|
|
2071
2071
|
}
|
|
2072
2072
|
if (!published && tempIdentity !== null) {
|
|
2073
2073
|
try {
|
|
2074
|
-
const currentIdentity =
|
|
2074
|
+
const currentIdentity = graphPathSnapshot(temp);
|
|
2075
2075
|
if (currentIdentity.isFile() && !currentIdentity.isSymbolicLink()
|
|
2076
2076
|
&& sameGraphFileIdentity(tempIdentity, currentIdentity))
|
|
2077
2077
|
unlinkSync(temp);
|
|
@@ -2187,7 +2187,7 @@ export class LocalMemoryGraph {
|
|
|
2187
2187
|
if (!existsSync(path))
|
|
2188
2188
|
return null;
|
|
2189
2189
|
try {
|
|
2190
|
-
const identity =
|
|
2190
|
+
const identity = graphPathSnapshot(path);
|
|
2191
2191
|
if (epoch.baseline?.recovery
|
|
2192
2192
|
&& serializedSnapshotMatches(epoch.baseline.recovery, identity))
|
|
2193
2193
|
return null;
|
|
@@ -2718,6 +2718,10 @@ function writeAll(fd, payload, position = null) {
|
|
|
2718
2718
|
offset += written;
|
|
2719
2719
|
}
|
|
2720
2720
|
}
|
|
2721
|
+
function graphPathSnapshot(path) {
|
|
2722
|
+
const named = lstatSync(path, { bigint: true });
|
|
2723
|
+
return named.isFile() && !named.isSymbolicLink() ? assetstore.captureRegularAssetFileSnapshot(path) : named;
|
|
2724
|
+
}
|
|
2721
2725
|
function sameGraphFileIdentity(left, right) {
|
|
2722
2726
|
const hasStableFileId = left.dev !== 0n || left.ino !== 0n || right.dev !== 0n || right.ino !== 0n;
|
|
2723
2727
|
if (hasStableFileId)
|
|
@@ -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;
|