@evomap/evolver-cli 2.0.50 → 2.0.52
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/assetEvolution.d.ts +9 -0
- package/dist/assetEvolution.js +164 -0
- package/dist/commandCatalog.d.ts +4 -0
- package/dist/commandCatalog.js +4 -0
- package/dist/containedWrite.d.ts +8 -0
- package/dist/containedWrite.js +79 -0
- package/dist/dispatch.js +8 -0
- package/dist/experience.js +34 -2
- package/dist/gene.d.ts +3 -0
- package/dist/gene.js +174 -0
- package/dist/jsonCommand.d.ts +34 -0
- package/dist/jsonCommand.js +118 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +15 -5
- package/dist/pluginBundle.d.ts +2 -0
- package/dist/pluginBundle.js +37 -9
- package/dist/pluginDrafts.d.ts +19 -0
- package/dist/pluginDrafts.js +87 -0
- package/dist/pluginHosts.d.ts +13 -2
- package/dist/pluginHosts.js +88 -29
- package/dist/pluginInspection.d.ts +2 -2
- package/dist/pluginInspection.js +25 -19
- package/dist/pluginInstall.js +16 -12
- package/dist/pluginLauncher.d.ts +7 -0
- package/dist/pluginLauncher.js +40 -0
- package/dist/pluginLocalInspection.d.ts +7 -0
- package/dist/pluginLocalInspection.js +46 -0
- package/dist/pluginRuntime.d.ts +2 -1
- package/dist/pluginRuntime.js +10 -4
- package/dist/publishPolicy.d.ts +6 -0
- package/dist/publishPolicy.js +19 -0
- package/dist/redact.d.ts +3 -0
- package/dist/redact.js +27 -0
- package/dist/sessionIngest.d.ts +1 -0
- package/dist/sessionIngest.js +6 -3
- package/dist/skillFetch.d.ts +1 -0
- package/dist/skillFetch.js +18 -26
- package/dist/workflow.d.ts +2 -1
- package/dist/workflow.js +35 -12
- package/package.json +7 -7
package/dist/pluginHosts.js
CHANGED
|
@@ -1,49 +1,86 @@
|
|
|
1
|
+
import { dirname, join } from 'node:path';
|
|
1
2
|
export const AGENT_PLUGIN_REPOSITORY = 'EvoMap/evolver-agent-plugin';
|
|
2
3
|
export const AGENT_PLUGIN_GIT_URL = `https://github.com/${AGENT_PLUGIN_REPOSITORY}.git`;
|
|
3
4
|
export const AGENT_PLUGIN_NAME = 'evolver-plugin';
|
|
4
5
|
export const AGENT_PLUGIN_RELEASE = 'release';
|
|
5
6
|
export const DSH_PLUGIN_SOURCE = `github:${AGENT_PLUGIN_REPOSITORY}#${AGENT_PLUGIN_RELEASE}&path:dist/dsh`;
|
|
7
|
+
export function agentPluginRepositoryMatches(value) {
|
|
8
|
+
if (typeof value !== 'string')
|
|
9
|
+
return false;
|
|
10
|
+
const source = value.trim().toLowerCase().replace(/^git\+/, '').replace(/^git@github\.com:/, 'https://github.com/').replace(/^ssh:\/\/git@github\.com\//, 'https://github.com/').replace(/\/$/, '').replace(/\.git$/, '');
|
|
11
|
+
return source === AGENT_PLUGIN_GIT_URL.toLowerCase().replace(/\.git$/, '') || source === AGENT_PLUGIN_REPOSITORY.toLowerCase();
|
|
12
|
+
}
|
|
6
13
|
export const PLUGIN_HOSTS = [
|
|
7
14
|
{
|
|
8
15
|
id: 'claude-code', label: 'Claude Code', command: 'claude', minimumVersion: '2.1.286',
|
|
9
16
|
kind: 'marketplace', management: 'plugin', marketplace: 'evolver-agent-plugin',
|
|
10
|
-
scopes: ['user', 'project'], manifest: '.claude-plugin/plugin.json',
|
|
17
|
+
scopes: ['user', 'project'], manifest: '.claude-plugin/plugin.json', entries: ['hooks/hooks.json', 'hooks/register.ts', 'bin/relay.mjs'],
|
|
11
18
|
legacyNames: ['evolver', 'evolver-mods', 'evolver-agent-plugin'],
|
|
12
19
|
instructions: ['Restart Claude Code. Installed hooks modules also require the host rollout flag; an installed plugin is not proof that recall is active.'],
|
|
13
20
|
},
|
|
14
21
|
{
|
|
15
22
|
id: 'codex', label: 'Codex', command: 'codex', minimumVersion: '0.164.0', kind: 'marketplace', management: 'plugin', marketplace: 'evomap',
|
|
16
|
-
scopes: ['user'], manifest: '.codex-plugin/plugin.json', legacyNames: ['evolver'],
|
|
23
|
+
scopes: ['user'], manifest: '.codex-plugin/plugin.json', entries: ['hooks/hooks.json', 'bin/hook.mjs'], legacyNames: ['evolver'],
|
|
17
24
|
instructions: ['Open /hooks in Codex, review and trust the Evolver hooks, then start a new thread.'],
|
|
18
25
|
},
|
|
19
26
|
{
|
|
20
27
|
id: 'grok', label: 'Grok CLI', command: 'grok', minimumVersion: '1.0.70',
|
|
21
|
-
kind: 'marketplace', management: 'plugin', marketplace: 'evolver-agent-plugin', scopes: ['user'], manifest: '.grok-plugin/plugin.json',
|
|
28
|
+
kind: 'marketplace', management: 'plugin', marketplace: 'evolver-agent-plugin', scopes: ['user'], manifest: '.grok-plugin/plugin.json', entries: ['hooks/hooks.json', 'bin/hook.mjs'],
|
|
22
29
|
packedSubdir: 'dist/grok', requiresTrust: true, legacyNames: ['evolver', 'evolver-grok-plugin'],
|
|
23
30
|
instructions: ['Restart Grok and review its hook trust settings. Recall reaches the first tool result; a turn without tools receives no strategy.'],
|
|
24
31
|
},
|
|
25
32
|
{
|
|
26
33
|
id: 'qoder', label: 'Qoder CLI', command: 'qodercli', minimumVersion: '1.1.79',
|
|
27
|
-
kind: 'marketplace', management: 'plugins', marketplace: 'evomap', scopes: ['user'], manifest: '.qoder-plugin/plugin.json',
|
|
34
|
+
kind: 'marketplace', management: 'plugins', marketplace: 'evomap', scopes: ['user'], manifest: '.qoder-plugin/plugin.json', entries: ['hooks/hooks.json', 'bin/hook.mjs'],
|
|
28
35
|
legacyNames: ['evolver', 'evolver-qoder-plugin'], instructions: ['Start a new Qoder session or run /plugins reload.'],
|
|
29
36
|
},
|
|
30
37
|
{
|
|
31
38
|
id: 'antigravity', label: 'Antigravity', command: 'agy', kind: 'bundle', management: 'plugin',
|
|
32
|
-
scopes: ['user'], manifest: 'plugin.json', legacyNames: ['evolver-antigravity-plugin'],
|
|
39
|
+
scopes: ['user'], manifest: 'plugin.json', entries: ['hooks.json', 'bin/hook.mjs'], legacyNames: ['evolver-antigravity-plugin'],
|
|
33
40
|
instructions: ['Restart Antigravity. Its commands run from the installed plugin with node bin/command.mjs antigravity <command>.'],
|
|
34
41
|
},
|
|
35
42
|
{
|
|
36
43
|
id: 'opencode', label: 'OpenCode', command: 'opencode', minimumVersion: '1.19.4', kind: 'bundle',
|
|
37
|
-
scopes: ['user', 'project'], manifest: 'package.json',
|
|
44
|
+
scopes: ['user', 'project'], manifest: 'package.json', packageName: '@evomap/evolver-opencode', entries: ['server.mjs', 'tui.mjs'],
|
|
45
|
+
legacyNames: ['evolver-opencode-plugin'],
|
|
38
46
|
instructions: ['Restart OpenCode. Both the server entry in opencode.json and the TUI entry in tui.json must be registered.'],
|
|
39
47
|
},
|
|
40
48
|
{
|
|
41
49
|
id: 'dsh', label: 'DeepSeek Harness', command: 'dsh', minimumVersion: '0.1.5', kind: 'profile',
|
|
42
|
-
scopes: ['user'], manifest: 'package.json', legacyNames: ['@evomap/dsh-evolver'],
|
|
50
|
+
scopes: ['user'], manifest: 'package.json', packageName: '@evomap/dsh-evolver', entries: ['plugin.mjs'], legacyNames: ['@evomap/dsh-evolver'],
|
|
43
51
|
instructions: ['Restart dsh. Installation applies only to the selected profile; repeat for other profiles. DSH Desktop requires its own bundled CLI/profile.'],
|
|
44
52
|
},
|
|
45
53
|
{
|
|
46
|
-
id: '
|
|
54
|
+
id: 'zcode', label: 'ZCode', command: 'zcode', kind: 'bundle', management: 'plugins', marketplace: 'evolver-zcode-local',
|
|
55
|
+
scopes: ['user'], platforms: ['win32', 'darwin'], manifest: '.zcode-plugin/plugin.json', entries: ['hooks/hooks.json', 'bin/hook.mjs'], legacyNames: [],
|
|
56
|
+
instructions: [
|
|
57
|
+
'Start a new ZCode session. ZCode CLI and Desktop share this installation; plugins and hooks must be enabled in ZCode.',
|
|
58
|
+
'Evolver runs the CLI shipped with ZCode Desktop, or the standalone zcode.cjs named by ZCODE_CLI_PATH.',
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'kimi', label: 'Kimi Code', command: 'kimi', kind: 'script', installer: 'scripts/install-kimi.mjs',
|
|
63
|
+
scopes: ['user'], platforms: ['win32'], manifest: 'kimi.plugin.json', entries: ['bin/hook.mjs'], legacyNames: [],
|
|
64
|
+
instructions: [
|
|
65
|
+
'Close Kimi Code before installing or updating, then start a new CLI or Desktop session.',
|
|
66
|
+
'KIMI_CODE_HOME selects the profile root; start Kimi with the same value.',
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'stepcode', label: 'Step Code', command: 'step', kind: 'bundle', scopes: ['user'], platforms: ['win32'],
|
|
71
|
+
manifest: 'package.json', packageName: '@evomap/stepcode-evolver', entries: ['plugin.mjs'], legacyNames: [],
|
|
72
|
+
instructions: ['Start a new Step Code session. The adapter is a Windows draft for Step Code CLI 0.1.7; STEP_CODING_AGENT_DIR selects the profile.'],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'minimax', label: 'MiniMax Code', command: 'mcode', kind: 'script', installer: 'scripts/install-minimax.mjs',
|
|
76
|
+
scopes: ['user'], manifest: '.minimax-plugin/plugin.json', entries: ['hooks/hooks.json', 'bin/hook.mjs'], legacyNames: [],
|
|
77
|
+
instructions: [
|
|
78
|
+
'Start a new MiniMax task. MINIMAX_DATA_DIR selects the data root; keep it the same for mcode.',
|
|
79
|
+
'To pause the plugin: mcode plugin disable evolver-plugin@local --json',
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: 'cursor', label: 'Cursor', command: 'cursor-agent', kind: 'manual', scopes: ['user'], entries: [],
|
|
47
84
|
legacyNames: ['evolver-cursor-plugin'],
|
|
48
85
|
instructions: [
|
|
49
86
|
`In Cursor's plugin marketplace, add ${AGENT_PLUGIN_REPOSITORY} and install evolver-plugin.`,
|
|
@@ -52,7 +89,7 @@ export const PLUGIN_HOSTS = [
|
|
|
52
89
|
],
|
|
53
90
|
},
|
|
54
91
|
{
|
|
55
|
-
id: 'workbuddy', label: 'WorkBuddy / CodeBuddy', command: 'codebuddy', kind: 'manual', scopes: ['user', 'project'],
|
|
92
|
+
id: 'workbuddy', label: 'WorkBuddy / CodeBuddy', command: 'codebuddy', kind: 'manual', scopes: ['user', 'project'], entries: [],
|
|
56
93
|
legacyNames: ['evolver'],
|
|
57
94
|
instructions: [
|
|
58
95
|
'In WorkBuddy, if the standalone plugin is installed: /plugin uninstall evolver@evomap-workbuddy --keep-data (repeat with --scope project where applicable).',
|
|
@@ -63,7 +100,7 @@ export const PLUGIN_HOSTS = [
|
|
|
63
100
|
],
|
|
64
101
|
},
|
|
65
102
|
{
|
|
66
|
-
id: 'mcp-generic', label: 'Generic MCP client', kind: 'manual', scopes: ['user'], legacyNames: [],
|
|
103
|
+
id: 'mcp-generic', label: 'Generic MCP client', kind: 'manual', scopes: ['user'], entries: [], legacyNames: [],
|
|
67
104
|
instructions: [
|
|
68
105
|
`git clone --depth 1 --branch release ${AGENT_PLUGIN_GIT_URL}`,
|
|
69
106
|
'In that checkout, run npm ci; the stdio server requires the MCP SDK.',
|
|
@@ -73,36 +110,50 @@ export const PLUGIN_HOSTS = [
|
|
|
73
110
|
},
|
|
74
111
|
];
|
|
75
112
|
export function pluginHostNamed(name) {
|
|
76
|
-
const aliases = {
|
|
113
|
+
const aliases = {
|
|
114
|
+
claude: 'claude-code', codebuddy: 'workbuddy', 'deepseek-harness': 'dsh', mcp: 'mcp-generic', 'kimi-code': 'kimi', step: 'stepcode', mcode: 'minimax',
|
|
115
|
+
};
|
|
77
116
|
return PLUGIN_HOSTS.find(host => host.id === (aliases[name] ?? name));
|
|
78
117
|
}
|
|
118
|
+
function marketplaceInstallSteps({ host, scope, trust }, step) {
|
|
119
|
+
const management = host.management;
|
|
120
|
+
const selector = host.id === 'grok' ? AGENT_PLUGIN_NAME : `${AGENT_PLUGIN_NAME}@${host.marketplace}`;
|
|
121
|
+
const install = host.id === 'codex'
|
|
122
|
+
? [management, 'add', selector, '--json']
|
|
123
|
+
: [management, 'install', selector, ...(host.id === 'claude-code' ? ['--scope', scope, '--json'] : []), ...(host.requiresTrust && trust ? ['--trust'] : [])];
|
|
124
|
+
return [step('marketplace', [management, 'marketplace', 'add', AGENT_PLUGIN_REPOSITORY]), step('install', install)];
|
|
125
|
+
}
|
|
126
|
+
function scriptInstallSteps(host, bundle, step) {
|
|
127
|
+
const installer = { name: 'install', command: 'node', args: [join(dirname(bundle), host.installer), 'install'] };
|
|
128
|
+
return host.id === 'minimax' ? [installer, step('enable', ['plugin', 'enable', `${AGENT_PLUGIN_NAME}@local`, '--json'])] : [installer];
|
|
129
|
+
}
|
|
79
130
|
export function pluginInstallSteps(options, bundle = '<release-checkout>/dist') {
|
|
80
|
-
const { host, scope, profile
|
|
81
|
-
const command =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
: [management, 'install', selector, ...(host.id === 'claude-code' ? ['--scope', scope, '--json'] : []), ...(host.requiresTrust && trust ? ['--trust'] : [])];
|
|
131
|
+
const { host, scope, profile } = options;
|
|
132
|
+
const [command = '', ...prefix] = options.launcher;
|
|
133
|
+
const step = (name, args) => ({ name, command, args: [...prefix, ...args] });
|
|
134
|
+
if (host.kind === 'marketplace')
|
|
135
|
+
return marketplaceInstallSteps(options, step);
|
|
136
|
+
if (host.kind === 'script')
|
|
137
|
+
return scriptInstallSteps(host, bundle, step);
|
|
138
|
+
if (host.id === 'zcode') {
|
|
89
139
|
return [
|
|
90
|
-
|
|
91
|
-
|
|
140
|
+
step('marketplace', ['plugins', 'marketplace', 'add', join(bundle, 'zcode'), '--json']),
|
|
141
|
+
step('install', ['plugins', 'install', `${AGENT_PLUGIN_NAME}@${host.marketplace}`, '--scope', scope, '--json']),
|
|
92
142
|
];
|
|
93
143
|
}
|
|
94
144
|
if (host.id === 'antigravity')
|
|
95
|
-
return [
|
|
145
|
+
return [step('install', ['plugin', 'install', `${bundle}/antigravity`])];
|
|
96
146
|
if (host.id === 'opencode')
|
|
97
|
-
return [
|
|
147
|
+
return [step('install', ['plugin', `${bundle}/opencode`, ...(scope === 'user' ? ['-g'] : [])])];
|
|
148
|
+
if (host.id === 'stepcode')
|
|
149
|
+
return [step('install', ['install', join(bundle, 'stepcode')])];
|
|
98
150
|
if (host.id === 'dsh')
|
|
99
|
-
return [
|
|
100
|
-
name: 'install', command, args: ['plugin', '--profile', profile, 'add', '-w', DSH_PLUGIN_SOURCE],
|
|
101
|
-
}];
|
|
151
|
+
return [step('install', ['plugin', '--profile', profile, 'add', '-w', DSH_PLUGIN_SOURCE])];
|
|
102
152
|
return [];
|
|
103
153
|
}
|
|
104
|
-
export function pluginRollbackInstructions(options, bundle) {
|
|
154
|
+
export function pluginRollbackInstructions(options, bundle = '<release-checkout>/dist') {
|
|
105
155
|
const { host, scope, profile } = options;
|
|
156
|
+
const cli = options.launcher.map(part => (/\s/.test(part) ? JSON.stringify(part) : part)).join(' ');
|
|
106
157
|
if (host.id === 'claude-code')
|
|
107
158
|
return [`claude plugin uninstall ${AGENT_PLUGIN_NAME}@${host.marketplace} --scope ${scope} --keep-data`];
|
|
108
159
|
if (host.id === 'codex')
|
|
@@ -116,7 +167,15 @@ export function pluginRollbackInstructions(options, bundle) {
|
|
|
116
167
|
if (host.id === 'dsh')
|
|
117
168
|
return [`dsh plugin --profile ${profile} remove @evomap/dsh-evolver`];
|
|
118
169
|
if (host.id === 'opencode')
|
|
119
|
-
return [`Remove only this plugin's ${bundle
|
|
170
|
+
return [`Remove only this plugin's ${bundle}/opencode/server.mjs and tui.mjs entries from opencode.json and tui.json; preserve neighboring configuration.`];
|
|
171
|
+
if (host.id === 'zcode')
|
|
172
|
+
return [`${cli} plugins uninstall ${AGENT_PLUGIN_NAME}@${host.marketplace} --scope ${scope}`];
|
|
173
|
+
if (host.id === 'kimi')
|
|
174
|
+
return [`node ${join(dirname(bundle), host.installer)} remove`];
|
|
175
|
+
if (host.id === 'stepcode')
|
|
176
|
+
return [`step remove ${join(bundle, 'stepcode')}`];
|
|
177
|
+
if (host.id === 'minimax')
|
|
178
|
+
return [`mcode plugin remove ${AGENT_PLUGIN_NAME}@local --json`];
|
|
120
179
|
return [];
|
|
121
180
|
}
|
|
122
181
|
const SHELL_SAFE_ARGUMENT = /^[A-Za-z0-9@._/][A-Za-z0-9@._/-]*$/;
|
|
@@ -18,7 +18,7 @@ export interface PluginInspection {
|
|
|
18
18
|
migrations: string[];
|
|
19
19
|
}
|
|
20
20
|
export declare function installedPluginsFromJson(value: unknown, host: PluginHost): InstalledAgentPlugin[];
|
|
21
|
-
export declare function agentPluginRepositoryMatches(value: unknown): boolean;
|
|
22
21
|
export declare function verifyPluginManifest(runtime: PluginRuntime, options: PluginInstallOptions, plugin: InstalledAgentPlugin, installAnswer?: unknown): string;
|
|
23
22
|
export declare function inspectOpenCodePlugin(runtime: PluginRuntime, options: PluginInstallOptions): PluginInspection;
|
|
24
|
-
|
|
23
|
+
/** `bundle` is the release checkout's dist folder, which a `script` host's own status command needs. */
|
|
24
|
+
export declare function inspectAgentPlugin(runtime: PluginRuntime, options: PluginInstallOptions, bundle?: string): Promise<PluginInspection>;
|
package/dist/pluginInspection.js
CHANGED
|
@@ -2,7 +2,9 @@ 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 {
|
|
5
|
+
import { agentPluginRepositoryMatches, AGENT_PLUGIN_NAME, AGENT_PLUGIN_REPOSITORY, standalonePluginRemoval } from './pluginHosts.js';
|
|
6
|
+
import { isManagedPackedBundle } from './pluginBundle.js';
|
|
7
|
+
import { inspectScriptPlugin, inspectStepCodePlugin } from './pluginLocalInspection.js';
|
|
6
8
|
import { checkedPluginCommand, objectOf, pluginHome, pluginJson, pluginVersionAtLeast, PluginInstallError, readPluginJson, readPluginText } from './pluginRuntime.js';
|
|
7
9
|
function listRecords(value, key, label) {
|
|
8
10
|
const list = Array.isArray(value) ? value : objectOf(value)?.[key];
|
|
@@ -21,16 +23,10 @@ export function installedPluginsFromJson(value, host) {
|
|
|
21
23
|
throw new PluginInstallError('unsupported_capability', `${host.label} plugin list has an unnamed entry.`);
|
|
22
24
|
return {
|
|
23
25
|
id, name, version: stringOf(raw['version']) ?? '', enabled: raw['enabled'] !== false,
|
|
24
|
-
scope: stringOf(raw['scope']), path: stringOf(raw['installPath']) ?? stringOf(raw['installedPath']) ?? stringOf(raw['path']), raw,
|
|
26
|
+
scope: stringOf(raw['scope']), path: stringOf(raw['installPath']) ?? stringOf(raw['installedPath']) ?? stringOf(raw['rootPath']) ?? stringOf(raw['path']), raw,
|
|
25
27
|
};
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
|
-
export function agentPluginRepositoryMatches(value) {
|
|
29
|
-
if (typeof value !== 'string')
|
|
30
|
-
return false;
|
|
31
|
-
const source = value.trim().toLowerCase().replace(/^git\+/, '').replace(/^git@github\.com:/, 'https://github.com/').replace(/^ssh:\/\/git@github\.com\//, 'https://github.com/').replace(/\/$/, '').replace(/\.git$/, '');
|
|
32
|
-
return source === AGENT_PLUGIN_GIT_URL.toLowerCase().replace(/\.git$/, '') || source === AGENT_PLUGIN_REPOSITORY.toLowerCase();
|
|
33
|
-
}
|
|
34
30
|
function packageRepositoryOf(value) {
|
|
35
31
|
return typeof value === 'string' ? value : objectOf(value)?.['url'];
|
|
36
32
|
}
|
|
@@ -38,9 +34,14 @@ function repositoryOf(record) {
|
|
|
38
34
|
return record['repo'] ?? objectOf(record['marketplaceSource'])?.['source']
|
|
39
35
|
?? objectOf(record['source'])?.['url'] ?? (typeof record['source'] === 'string' ? record['source'] : undefined);
|
|
40
36
|
}
|
|
41
|
-
async function marketplaceMatches(runtime, record) {
|
|
37
|
+
async function marketplaceMatches(runtime, host, record) {
|
|
42
38
|
if (agentPluginRepositoryMatches(repositoryOf(record)))
|
|
43
39
|
return true;
|
|
40
|
+
const source = objectOf(record['source']);
|
|
41
|
+
if (source?.['source'] === 'directory') {
|
|
42
|
+
const folder = stringOf(source['path']);
|
|
43
|
+
return folder !== undefined && isManagedPackedBundle(runtime, host, folder);
|
|
44
|
+
}
|
|
44
45
|
const root = stringOf(record['root']) ?? stringOf(record['installLocation']);
|
|
45
46
|
if (!root)
|
|
46
47
|
return false;
|
|
@@ -85,14 +86,15 @@ function hasForeignInstalledScope(plugin, scope) {
|
|
|
85
86
|
async function inspectMarketplacePlugin(runtime, options) {
|
|
86
87
|
const { host, scope } = options;
|
|
87
88
|
const management = host.management;
|
|
88
|
-
const
|
|
89
|
+
const [command, ...prefix] = options.launcher;
|
|
90
|
+
const pluginResult = await checkedPluginCommand(runtime, command, [...prefix, management, 'list', '--json'], options.root);
|
|
89
91
|
const plugins = installedPluginsFromJson(pluginJson(pluginResult.stdout, `${host.label} plugin list`), host);
|
|
90
|
-
const marketResult = await checkedPluginCommand(runtime,
|
|
92
|
+
const marketResult = await checkedPluginCommand(runtime, command, [...prefix, management, 'marketplace', 'list', '--json'], options.root);
|
|
91
93
|
const markets = listRecords(pluginJson(marketResult.stdout, `${host.label} marketplace list`), 'marketplaces', `${host.label} marketplace list`);
|
|
92
94
|
const market = markets.find(record => record['name'] === host.marketplace);
|
|
93
95
|
const conflicts = oldHookConflicts(runtime, options);
|
|
94
96
|
const migrations = [];
|
|
95
|
-
if (market && !await marketplaceMatches(runtime, market))
|
|
97
|
+
if (market && !await marketplaceMatches(runtime, host, market))
|
|
96
98
|
conflicts.push(`Marketplace ${host.marketplace} belongs to another source. Review its plugins before replacing it with ${AGENT_PLUGIN_REPOSITORY}.`);
|
|
97
99
|
for (const plugin of plugins) {
|
|
98
100
|
if (host.legacyNames.includes(plugin.name) && plugin.enabled) {
|
|
@@ -122,8 +124,7 @@ export function verifyPluginManifest(runtime, options, plugin, installAnswer) {
|
|
|
122
124
|
if (!path || !host.manifest)
|
|
123
125
|
throw new PluginInstallError('failed', 'The host did not identify a verifiable installed plugin directory.');
|
|
124
126
|
const manifest = readPluginJson(join(path, host.manifest));
|
|
125
|
-
|
|
126
|
-
if (!manifest || manifest['name'] !== expectedName || manifest['version'] !== plugin.version) {
|
|
127
|
+
if (!manifest || manifest['name'] !== (host.packageName ?? AGENT_PLUGIN_NAME) || manifest['version'] !== plugin.version) {
|
|
127
128
|
throw new PluginInstallError('failed', 'The host registration and installed plugin manifest do not agree; installation was not confirmed.');
|
|
128
129
|
}
|
|
129
130
|
const repository = packageRepositoryOf(manifest?.['repository']);
|
|
@@ -131,8 +132,7 @@ export function verifyPluginManifest(runtime, options, plugin, installAnswer) {
|
|
|
131
132
|
throw new PluginInstallError('conflict', 'The installed plugin manifest does not identify the unified Evolver plugin source.');
|
|
132
133
|
if (readPluginText(join(path, '.evolver-packed'))?.trim() !== host.id)
|
|
133
134
|
throw new PluginInstallError('failed', 'The installed plugin is not the packed artifact for the selected host.');
|
|
134
|
-
|
|
135
|
-
if (entries.some(entry => !existsSync(join(path, entry))))
|
|
135
|
+
if (host.entries.some(entry => !existsSync(join(path, entry))))
|
|
136
136
|
throw new PluginInstallError('failed', 'The installed plugin is missing its hook/plugin entry files.');
|
|
137
137
|
return path;
|
|
138
138
|
}
|
|
@@ -227,14 +227,20 @@ function inspectDshPlugin(runtime, options) {
|
|
|
227
227
|
? { id: AGENT_PLUGIN_NAME, name: AGENT_PLUGIN_NAME, version: manifest['version'], enabled: true, path, raw: manifest } : undefined;
|
|
228
228
|
return { installed, marketplacePresent: false, conflicts, migrations };
|
|
229
229
|
}
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
/** `bundle` is the release checkout's dist folder, which a `script` host's own status command needs. */
|
|
231
|
+
export async function inspectAgentPlugin(runtime, options, bundle) {
|
|
232
|
+
if (options.host.marketplace)
|
|
232
233
|
return inspectMarketplacePlugin(runtime, options);
|
|
234
|
+
if (options.host.kind === 'script')
|
|
235
|
+
return inspectScriptPlugin(runtime, options, bundle);
|
|
236
|
+
if (options.host.id === 'stepcode')
|
|
237
|
+
return inspectStepCodePlugin(runtime, options);
|
|
233
238
|
if (options.host.id === 'opencode')
|
|
234
239
|
return inspectOpenCodePlugin(runtime, options);
|
|
235
240
|
if (options.host.id === 'dsh')
|
|
236
241
|
return inspectDshPlugin(runtime, options);
|
|
237
|
-
const
|
|
242
|
+
const [command, ...prefix] = options.launcher;
|
|
243
|
+
const result = await checkedPluginCommand(runtime, command, [...prefix, 'plugin', 'list', '--json'], options.root);
|
|
238
244
|
const plugins = installedPluginsFromJson(pluginJson(result.stdout, 'Antigravity plugin list'), options.host);
|
|
239
245
|
const installed = plugins.find(plugin => plugin.name === AGENT_PLUGIN_NAME);
|
|
240
246
|
const standalone = plugins.filter(plugin => options.host.legacyNames.includes(plugin.name) && plugin.enabled);
|
package/dist/pluginInstall.js
CHANGED
|
@@ -2,11 +2,19 @@ import { ensureAgentPluginBundle } from './pluginBundle.js';
|
|
|
2
2
|
import { assertDshProfileStoreMatches } from './pluginDshStore.js';
|
|
3
3
|
import { AGENT_PLUGIN_NAME, AGENT_PLUGIN_REPOSITORY, pluginInstallSteps, pluginRollbackInstructions } from './pluginHosts.js';
|
|
4
4
|
import { inspectAgentPlugin, verifyPluginManifest } from './pluginInspection.js';
|
|
5
|
+
import { hostLauncher } from './pluginLauncher.js';
|
|
5
6
|
import { withPluginInstallLock } from './pluginLock.js';
|
|
6
7
|
import { checkedPluginCommand, checkPluginHostVersion, PluginInstallError } from './pluginRuntime.js';
|
|
7
8
|
function trustInstruction(host) {
|
|
8
9
|
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
|
}
|
|
11
|
+
async function useReleaseCheckout(runtime, options, result) {
|
|
12
|
+
const bundle = await ensureAgentPluginBundle(runtime, options.host);
|
|
13
|
+
result.completed.push('download');
|
|
14
|
+
result.commands = pluginInstallSteps(options, bundle);
|
|
15
|
+
result.rollback = pluginRollbackInstructions(options, bundle);
|
|
16
|
+
return bundle;
|
|
17
|
+
}
|
|
10
18
|
function assertNoConflicts(inspection) {
|
|
11
19
|
if (inspection.conflicts.length > 0)
|
|
12
20
|
throw new PluginInstallError('conflict', inspection.conflicts.join('\n'), inspection.migrations);
|
|
@@ -39,15 +47,16 @@ export async function installAgentPlugin(runtime, options) {
|
|
|
39
47
|
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
48
|
}
|
|
41
49
|
try {
|
|
42
|
-
await checkPluginHostVersion(runtime, host);
|
|
43
|
-
let
|
|
50
|
+
await checkPluginHostVersion(runtime, host, hostLauncher(runtime, host));
|
|
51
|
+
let bundle = host.kind === 'script' ? await useReleaseCheckout(runtime, options, result) : undefined;
|
|
52
|
+
let inspection = await inspectAgentPlugin(runtime, options, bundle);
|
|
44
53
|
assertNoConflicts(inspection);
|
|
45
54
|
if (inspection.installed) {
|
|
46
55
|
const installedPath = verifyPluginManifest(runtime, options, inspection.installed);
|
|
47
56
|
return { ...result, ok: true, status: 'already_installed', verified: true, version: inspection.installed.version, installedPath, commands: [] };
|
|
48
57
|
}
|
|
49
58
|
return await withPluginInstallLock(runtime, options, async () => {
|
|
50
|
-
inspection = await inspectAgentPlugin(runtime, options);
|
|
59
|
+
inspection = await inspectAgentPlugin(runtime, options, bundle);
|
|
51
60
|
assertNoConflicts(inspection);
|
|
52
61
|
if (inspection.installed) {
|
|
53
62
|
const installedPath = verifyPluginManifest(runtime, options, inspection.installed);
|
|
@@ -55,13 +64,8 @@ export async function installAgentPlugin(runtime, options) {
|
|
|
55
64
|
}
|
|
56
65
|
if (host.id === 'dsh')
|
|
57
66
|
await assertDshProfileStoreMatches(runtime, options);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
bundle = await ensureAgentPluginBundle(runtime, host);
|
|
61
|
-
result.completed.push('download');
|
|
62
|
-
result.commands = pluginInstallSteps(options, bundle);
|
|
63
|
-
result.rollback = pluginRollbackInstructions(options, bundle);
|
|
64
|
-
}
|
|
67
|
+
if (host.kind === 'bundle')
|
|
68
|
+
bundle = await useReleaseCheckout(runtime, options, result);
|
|
65
69
|
let installAnswer;
|
|
66
70
|
for (const step of result.commands) {
|
|
67
71
|
if (step.name === 'marketplace' && inspection.marketplacePresent)
|
|
@@ -69,7 +73,7 @@ export async function installAgentPlugin(runtime, options) {
|
|
|
69
73
|
const executed = await checkedPluginCommand(runtime, step.command, step.args, options.root, 120_000);
|
|
70
74
|
result.completed.push(step.name);
|
|
71
75
|
if (step.name === 'marketplace') {
|
|
72
|
-
inspection = await inspectAgentPlugin(runtime, options);
|
|
76
|
+
inspection = await inspectAgentPlugin(runtime, options, bundle);
|
|
73
77
|
if (!inspection.marketplacePresent || inspection.conflicts.length > 0) {
|
|
74
78
|
throw new PluginInstallError('conflict', 'The registered marketplace could not be confirmed as the unified plugin source. No plugin install was attempted.');
|
|
75
79
|
}
|
|
@@ -81,7 +85,7 @@ export async function installAgentPlugin(runtime, options) {
|
|
|
81
85
|
catch { /* Some native installers report human-readable progress; the final inventory is authoritative. */ }
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
|
-
inspection = await inspectAgentPlugin(runtime, options);
|
|
88
|
+
inspection = await inspectAgentPlugin(runtime, options, bundle);
|
|
85
89
|
assertNoConflicts(inspection);
|
|
86
90
|
if (!inspection.installed)
|
|
87
91
|
throw new PluginInstallError('failed', `The ${AGENT_PLUGIN_NAME} command completed, but the selected host/scope did not register it. Installation was not confirmed.`);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginHost } from './pluginHosts.js';
|
|
2
|
+
import { type PluginRuntime } from './pluginRuntime.js';
|
|
3
|
+
/** The argv prefix that runs the host's own CLI, or undefined when it is not present on this machine. ZCode's CLI is
|
|
4
|
+
* a Node script, never a `zcode` executable on PATH. */
|
|
5
|
+
export declare function hostLauncher(runtime: PluginRuntime, host: PluginHost): string[] | undefined;
|
|
6
|
+
/** What a preview shows when the host CLI is absent: the command a real install would run. */
|
|
7
|
+
export declare function expectedHostLauncher(runtime: PluginRuntime, host: PluginHost): string[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { statSync } from 'node:fs';
|
|
2
|
+
import { isAbsolute, join } from 'node:path';
|
|
3
|
+
import { pluginHome } from './pluginRuntime.js';
|
|
4
|
+
const ZCODE_DESKTOP_CLI = ['resources', 'glm', 'zcode.cjs'];
|
|
5
|
+
const ZCODE_MAC_CLI = ['ZCode.app', 'Contents', 'Resources', 'glm', 'zcode.cjs'];
|
|
6
|
+
const isFile = (path) => {
|
|
7
|
+
try {
|
|
8
|
+
return statSync(path).isFile();
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/** ZCode ships its CLI as a Node script inside Desktop; ZCODE_CLI_PATH names another copy of that zcode.cjs script. */
|
|
15
|
+
function zcodeCliCandidates(runtime) {
|
|
16
|
+
const explicit = runtime.env['ZCODE_CLI_PATH']?.trim();
|
|
17
|
+
if (explicit)
|
|
18
|
+
return isAbsolute(explicit) ? [explicit] : [];
|
|
19
|
+
const home = pluginHome(runtime);
|
|
20
|
+
if (runtime.platform === 'win32')
|
|
21
|
+
return [join(runtime.env['LOCALAPPDATA'] || join(home, 'AppData', 'Local'), 'Programs', 'ZCode', ...ZCODE_DESKTOP_CLI)];
|
|
22
|
+
if (runtime.platform === 'darwin')
|
|
23
|
+
return [join(home, 'Applications', ...ZCODE_MAC_CLI), join('/Applications', ...ZCODE_MAC_CLI)];
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
/** The argv prefix that runs the host's own CLI, or undefined when it is not present on this machine. ZCode's CLI is
|
|
27
|
+
* a Node script, never a `zcode` executable on PATH. */
|
|
28
|
+
export function hostLauncher(runtime, host) {
|
|
29
|
+
if (host.id === 'zcode') {
|
|
30
|
+
const cli = zcodeCliCandidates(runtime).find(isFile);
|
|
31
|
+
return cli && runtime.available('node') ? ['node', cli] : undefined;
|
|
32
|
+
}
|
|
33
|
+
return host.command && runtime.available(host.command) ? [host.command] : undefined;
|
|
34
|
+
}
|
|
35
|
+
/** What a preview shows when the host CLI is absent: the command a real install would run. */
|
|
36
|
+
export function expectedHostLauncher(runtime, host) {
|
|
37
|
+
if (host.id === 'zcode')
|
|
38
|
+
return ['node', zcodeCliCandidates(runtime)[0] ?? '<ZCode Desktop>/resources/glm/zcode.cjs'];
|
|
39
|
+
return host.command ? [host.command] : [];
|
|
40
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type PluginInstallOptions } from './pluginHosts.js';
|
|
2
|
+
import type { PluginInspection } from './pluginInspection.js';
|
|
3
|
+
import { type PluginRuntime } from './pluginRuntime.js';
|
|
4
|
+
/** Kimi and MiniMax are installed by the release checkout's own installer, whose `status` is the registration record. */
|
|
5
|
+
export declare function inspectScriptPlugin(runtime: PluginRuntime, options: PluginInstallOptions, bundle: string): Promise<PluginInspection>;
|
|
6
|
+
/** Step Code lists installed extension packages in its agent settings; local sources are folder paths. */
|
|
7
|
+
export declare function inspectStepCodePlugin(runtime: PluginRuntime, options: PluginInstallOptions): PluginInspection;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
2
|
+
import { AGENT_PLUGIN_NAME } from './pluginHosts.js';
|
|
3
|
+
import { checkedPluginCommand, objectOf, pluginHome, pluginJson, PluginInstallError, readPluginJson } from './pluginRuntime.js';
|
|
4
|
+
const DISABLED = 'The plugin is installed but disabled. Enable it explicitly in the host rather than installing another copy.';
|
|
5
|
+
function installedRecord(version, path, enabled, raw) {
|
|
6
|
+
if (typeof version !== 'string' || typeof path !== 'string' || !isAbsolute(path))
|
|
7
|
+
return undefined;
|
|
8
|
+
return { id: AGENT_PLUGIN_NAME, name: AGENT_PLUGIN_NAME, version, enabled, path, raw };
|
|
9
|
+
}
|
|
10
|
+
/** Kimi and MiniMax are installed by the release checkout's own installer, whose `status` is the registration record. */
|
|
11
|
+
export async function inspectScriptPlugin(runtime, options, bundle) {
|
|
12
|
+
const { host } = options;
|
|
13
|
+
const { stdout } = await checkedPluginCommand(runtime, 'node', [join(dirname(bundle), host.installer), 'status'], options.root);
|
|
14
|
+
const status = objectOf(pluginJson(stdout, `${host.label} installer status`));
|
|
15
|
+
if (typeof status?.['installed'] !== 'boolean')
|
|
16
|
+
throw new PluginInstallError('unsupported_capability', `${host.label} installer status has an unsupported shape; no installed state can be inferred.`);
|
|
17
|
+
const installed = status['installed'] ? installedRecord(status['version'], status['path'], status['enabled'] !== false, status) : undefined;
|
|
18
|
+
if (status['installed'] && !installed)
|
|
19
|
+
throw new PluginInstallError('unsupported_capability', `${host.label} installer status reports an installation without its version and path.`);
|
|
20
|
+
return { installed, marketplacePresent: false, conflicts: installed && !installed.enabled ? [DISABLED] : [], migrations: [] };
|
|
21
|
+
}
|
|
22
|
+
function stepAgentDir(runtime) {
|
|
23
|
+
const configured = runtime.env['STEP_CODING_AGENT_DIR'];
|
|
24
|
+
if (configured === undefined)
|
|
25
|
+
return join(pluginHome(runtime), '.stepcode', 'agent');
|
|
26
|
+
if (!isAbsolute(configured))
|
|
27
|
+
throw new PluginInstallError('invalid_arguments', 'STEP_CODING_AGENT_DIR must be an absolute directory, as Step Code requires.');
|
|
28
|
+
return configured;
|
|
29
|
+
}
|
|
30
|
+
/** Step Code lists installed extension packages in its agent settings; local sources are folder paths. */
|
|
31
|
+
export function inspectStepCodePlugin(runtime, options) {
|
|
32
|
+
const agentDir = stepAgentDir(runtime);
|
|
33
|
+
const packages = readPluginJson(join(agentDir, 'settings.json'))?.['packages'] ?? [];
|
|
34
|
+
if (!Array.isArray(packages))
|
|
35
|
+
throw new PluginInstallError('unsupported_capability', 'Step Code settings list packages in an unsupported shape; no installed state can be inferred.');
|
|
36
|
+
const ours = packages.flatMap(entry => {
|
|
37
|
+
const source = typeof entry === 'string' ? entry : objectOf(entry)?.['source'];
|
|
38
|
+
if (typeof source !== 'string' || /^(?:npm|git|https?):/.test(source))
|
|
39
|
+
return [];
|
|
40
|
+
const path = resolve(agentDir, source);
|
|
41
|
+
const manifest = readPluginJson(join(path, 'package.json'));
|
|
42
|
+
return manifest && manifest['name'] === options.host.packageName ? [installedRecord(manifest['version'], path, true, manifest)] : [];
|
|
43
|
+
}).filter(plugin => plugin !== undefined);
|
|
44
|
+
const conflicts = ours.length > 1 ? ['Multiple Step Code Evolver packages are installed; remove all but one with step remove <path>.'] : [];
|
|
45
|
+
return { installed: ours[0], marketplacePresent: false, conflicts, migrations: [] };
|
|
46
|
+
}
|
package/dist/pluginRuntime.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare function objectOf(value: unknown): Record<string, unknown> | unde
|
|
|
27
27
|
export declare function readPluginText(path: string, maxBytes?: number): string | undefined;
|
|
28
28
|
export declare function readPluginJson(path: string): Record<string, unknown> | undefined;
|
|
29
29
|
export declare function pluginVersionAtLeast(current: string, minimum: string): boolean;
|
|
30
|
-
|
|
30
|
+
/** `launcher` is the host CLI found on this machine (see hostLauncher), or undefined when it is missing. */
|
|
31
|
+
export declare function checkPluginHostVersion(runtime: PluginRuntime, host: PluginHost, launcher: readonly string[] | undefined): Promise<void>;
|
|
31
32
|
/** Only installer-owned descendants are written; a symlink may not redirect the cache or lock. */
|
|
32
33
|
export declare function assertPluginManagedPath(path: string): void;
|
package/dist/pluginRuntime.js
CHANGED
|
@@ -157,12 +157,18 @@ export function pluginVersionAtLeast(current, minimum) {
|
|
|
157
157
|
}
|
|
158
158
|
return true;
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
/** `launcher` is the host CLI found on this machine (see hostLauncher), or undefined when it is missing. */
|
|
161
|
+
export async function checkPluginHostVersion(runtime, host, launcher) {
|
|
162
|
+
if (!launcher)
|
|
163
|
+
throw new PluginInstallError('host_missing', host.id === 'zcode'
|
|
164
|
+
? 'ZCode CLI was not found: install ZCode Desktop, or set ZCODE_CLI_PATH to an absolute standalone zcode.cjs, with node on PATH.'
|
|
165
|
+
: `${host.label} CLI (${host.command ?? 'none'}) was not found on PATH.`);
|
|
166
|
+
if (host.kind === 'script' && !runtime.available('node'))
|
|
167
|
+
throw new PluginInstallError('host_missing', `${host.label} is installed by a Node.js script; node was not found on PATH.`);
|
|
163
168
|
if (!host.minimumVersion)
|
|
164
169
|
return;
|
|
165
|
-
const
|
|
170
|
+
const [command, ...prefix] = launcher;
|
|
171
|
+
const { stdout } = await checkedPluginCommand(runtime, command, [...prefix, '--version']);
|
|
166
172
|
const version = /(?:^|\s)v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)(?:\s|$)/.exec(stdout.trim())?.[1];
|
|
167
173
|
if (!version || !pluginVersionAtLeast(version, host.minimumVersion)) {
|
|
168
174
|
throw new PluginInstallError('unsupported_version', `${host.label} requires ${host.minimumVersion}+; ${version ?? 'an unknown version'} was observed. Upgrade the host CLI before installing.`);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type JsonCommandIo } from './jsonCommand.js';
|
|
2
|
+
/**
|
|
3
|
+
* `evolver publish-policy get|set --json`. In `manual` the Proxy's background curation still promotes trial Genes but
|
|
4
|
+
* never enqueues a publish; the policy lives with this node's asset store and the Proxy rereads it every pass.
|
|
5
|
+
*/
|
|
6
|
+
export declare function runPublishPolicyCommand(argv: string[], io?: JsonCommandIo): Promise<number>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { assetstore, events } from '@evomap/evolver-core';
|
|
2
|
+
import { SMALL_REQUEST_BYTES, operationOf, readJsonRequest, requestLocale, requiredEnum, runJsonCommand } from './jsonCommand.js';
|
|
3
|
+
const PUBLISH_POLICY_COMMAND_SCHEMA = 'evolver.publish-policy.v1';
|
|
4
|
+
/**
|
|
5
|
+
* `evolver publish-policy get|set --json`. In `manual` the Proxy's background curation still promotes trial Genes but
|
|
6
|
+
* never enqueues a publish; the policy lives with this node's asset store and the Proxy rereads it every pass.
|
|
7
|
+
*/
|
|
8
|
+
export async function runPublishPolicyCommand(argv, io = {}) {
|
|
9
|
+
const { operation, error } = operationOf(argv, ['get', 'set'], io);
|
|
10
|
+
return runJsonCommand(PUBLISH_POLICY_COMMAND_SCHEMA, operation, io, async () => {
|
|
11
|
+
if (error)
|
|
12
|
+
throw error;
|
|
13
|
+
const dir = events.assetsDir(io.env ?? process.env);
|
|
14
|
+
if (operation === 'get')
|
|
15
|
+
return assetstore.readPublishPolicy(dir);
|
|
16
|
+
const request = await readJsonRequest(SMALL_REQUEST_BYTES, io);
|
|
17
|
+
return assetstore.writePublishPolicy(dir, requiredEnum(request, 'mode', assetstore.PUBLISH_MODES, requestLocale(request, io)));
|
|
18
|
+
});
|
|
19
|
+
}
|
package/dist/redact.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type JsonCommandIo } from './jsonCommand.js';
|
|
2
|
+
/** `evolver redact --json`: what would be removed from each text before it leaves this machine, with exact offsets. Read-only. */
|
|
3
|
+
export declare function runRedactCommand(argv: string[], io?: JsonCommandIo): Promise<number>;
|
package/dist/redact.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { authoring } from '@evomap/evolver-core';
|
|
2
|
+
import { LARGE_REQUEST_BYTES, inputError, operationOf, optionalStrings, readJsonRequest, requestLocale, runJsonCommand, } from './jsonCommand.js';
|
|
3
|
+
const REDACT_SCHEMA = 'evolver.redact.v1';
|
|
4
|
+
const MAX_TEXTS = 500;
|
|
5
|
+
const MAX_TERMS = 200;
|
|
6
|
+
const MAX_TERM_CHARS = 200;
|
|
7
|
+
/** `evolver redact --json`: what would be removed from each text before it leaves this machine, with exact offsets. Read-only. */
|
|
8
|
+
export async function runRedactCommand(argv, io = {}) {
|
|
9
|
+
const { error } = operationOf(['redact', ...argv], ['redact'], io);
|
|
10
|
+
return runJsonCommand(REDACT_SCHEMA, 'redact', io, async () => {
|
|
11
|
+
if (error)
|
|
12
|
+
throw error;
|
|
13
|
+
const request = await readJsonRequest(LARGE_REQUEST_BYTES, io);
|
|
14
|
+
const locale = requestLocale(request, io);
|
|
15
|
+
const texts = optionalStrings(request, 'texts', locale, MAX_TEXTS, LARGE_REQUEST_BYTES);
|
|
16
|
+
if (!texts)
|
|
17
|
+
throw inputError(locale, `缺少 texts(最多 ${MAX_TEXTS} 段文本)。`, `Missing texts (at most ${MAX_TEXTS}).`);
|
|
18
|
+
const terms = optionalStrings(request, 'terms', locale, MAX_TERMS, MAX_TERM_CHARS);
|
|
19
|
+
const identifiers = optionalStrings(request, 'identifiers', locale, MAX_TERMS, MAX_TERM_CHARS);
|
|
20
|
+
const items = texts.map((text) => {
|
|
21
|
+
const { text: redacted, findings } = authoring.redactWithFindings({ text, env: io.env ?? process.env, locale,
|
|
22
|
+
...(terms ? { terms } : {}), ...(identifiers ? { identifiers } : {}) });
|
|
23
|
+
return { text: redacted, findings };
|
|
24
|
+
});
|
|
25
|
+
return { rulesVersion: authoring.REDACTION_RULES_VERSION, items };
|
|
26
|
+
});
|
|
27
|
+
}
|
package/dist/sessionIngest.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export type SessionContextDeliveryRecovery = {
|
|
|
44
44
|
} | {
|
|
45
45
|
status: 'unknown';
|
|
46
46
|
reason: 'recovery_failed' | 'deadline';
|
|
47
|
+
journal?: events.ContextDeliveryStatus;
|
|
47
48
|
};
|
|
48
49
|
/** Resolve context ownership before any recovery/index I/O. Physical aliases
|
|
49
50
|
* alone are insufficient: protected audit namespaces retain the exact logical
|