@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/sessionIngest.js
CHANGED
|
@@ -192,13 +192,16 @@ function finishSessionIndexCleanup(path) {
|
|
|
192
192
|
export async function runSessionIngestTick(dirs, deps = {}) {
|
|
193
193
|
const resolvedDeps = resolveIngestDeps(deps);
|
|
194
194
|
const contextIngestor = resolveContextObservationWriter(resolvedDeps.ingestor, deps.contextIngestor);
|
|
195
|
-
|
|
195
|
+
let contextDeliveryRecovery = contextIngestor
|
|
196
196
|
? await recoverSessionDeliveries(contextIngestor) : undefined;
|
|
197
197
|
if (contextIngestor) {
|
|
198
198
|
// A failed/late protected RPC can outlive its client wait. The existing
|
|
199
199
|
// ordered status RPC joins the service's turn before deciding root admission.
|
|
200
|
-
const journal = contextDeliveryRecovery
|
|
201
|
-
|
|
200
|
+
const journal = contextDeliveryRecovery?.journal ?? events.Ingestor.contextDeliveryStatus(contextIngestor.path);
|
|
201
|
+
// Preserve the admission snapshot without upgrading a late or failed recovery.
|
|
202
|
+
if (contextDeliveryRecovery && contextDeliveryRecovery.journal === undefined) {
|
|
203
|
+
contextDeliveryRecovery = { ...contextDeliveryRecovery, journal };
|
|
204
|
+
}
|
|
202
205
|
if (journal.confirmedPending > 0 || journal.reasons.cleanup_pending)
|
|
203
206
|
return {
|
|
204
207
|
recorded: 0, sourceAgents: [], signalKinds: [], signalStrengths: [],
|
package/dist/skillFetch.d.ts
CHANGED
package/dist/skillFetch.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { dirname, isAbsolute, relative, resolve } from 'node:path';
|
|
1
|
+
import { join } from 'node:path';
|
|
3
2
|
import { assetstore, wire } from '@evomap/evolver-core';
|
|
4
3
|
import { AuthError, HubClientError, HubUnreachableError, connectPublicHub, isHubDryRunEnabled, } from '@evomap/evolver-adapter-public';
|
|
5
4
|
import { loadEnvFileFromEnv } from '@evomap/evolver-mcp';
|
|
5
|
+
import { relativePathInsideRoot, writeFileInsideRoot } from './containedWrite.js';
|
|
6
6
|
import { createRecipeHubFromEnv } from './recipe.js';
|
|
7
7
|
import { geneToSkillMd } from './skillDistill.js';
|
|
8
8
|
const GROUP = 'skill.fetch';
|
|
@@ -53,13 +53,11 @@ async function runSkillFetchCommand(argv, deps = {}) {
|
|
|
53
53
|
stdout: deps.stdout ?? ((line) => { process.stdout.write(`${line}\n`); }),
|
|
54
54
|
stderr: deps.stderr ?? ((line) => { process.stderr.write(`${line}\n`); }),
|
|
55
55
|
};
|
|
56
|
-
const
|
|
56
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
57
|
+
const parsed = parseSkillFetchArgs(argv, cwd);
|
|
57
58
|
if (!parsed.ok)
|
|
58
59
|
return emitFailure(parsed.reason, parsed.message, argv.includes('--json'), io);
|
|
59
60
|
const opts = parsed.value;
|
|
60
|
-
if (opts.source.kind === 'asset' && !opts.write && opts.outDir) {
|
|
61
|
-
// Preview with --out is still read-only; target paths are shown below.
|
|
62
|
-
}
|
|
63
61
|
try {
|
|
64
62
|
const env = deps.env ?? process.env;
|
|
65
63
|
loadEnvFileFromEnv(env);
|
|
@@ -68,7 +66,7 @@ async function runSkillFetchCommand(argv, deps = {}) {
|
|
|
68
66
|
return 0;
|
|
69
67
|
}
|
|
70
68
|
const hub = deps.hub ?? createSkillFetchHubFromEnv(deps, env);
|
|
71
|
-
const run = await buildSkillFetchResult(hub, opts);
|
|
69
|
+
const run = await buildSkillFetchResult(hub, opts, cwd);
|
|
72
70
|
if (!run.ok)
|
|
73
71
|
return emitFailure(run.reason, run.message, opts.json, io);
|
|
74
72
|
emitSuccess(run.value, opts.json, io);
|
|
@@ -79,7 +77,7 @@ async function runSkillFetchCommand(argv, deps = {}) {
|
|
|
79
77
|
return emitFailure(mapped.reason, mapped.message, opts.json, io);
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
|
-
function parseSkillFetchArgs(argv) {
|
|
80
|
+
function parseSkillFetchArgs(argv, cwd) {
|
|
83
81
|
if (argv.includes('--help') || argv.includes('-h')) {
|
|
84
82
|
return { ok: false, reason: 'usage', message: USAGE };
|
|
85
83
|
}
|
|
@@ -97,9 +95,12 @@ function parseSkillFetchArgs(argv) {
|
|
|
97
95
|
if (!Number.isSafeInteger(limit) || limit <= 0)
|
|
98
96
|
return { ok: false, reason: 'invalid_arg', message: '--limit must be a positive integer' };
|
|
99
97
|
const write = argv.includes('--write');
|
|
100
|
-
const
|
|
101
|
-
if (write && !
|
|
98
|
+
const outRaw = flagValue(argv, '--out') || undefined;
|
|
99
|
+
if (write && !outRaw)
|
|
102
100
|
return { ok: false, reason: 'invalid_arg', message: 'skill fetch --write requires --out <dir>' };
|
|
101
|
+
const outDir = outRaw === undefined ? undefined : relativePathInsideRoot(cwd, outRaw);
|
|
102
|
+
if (outDir === null)
|
|
103
|
+
return { ok: false, reason: 'invalid_arg', message: '--out must resolve to a path inside the current working directory' };
|
|
103
104
|
const select = flagValue(argv, '--select') ?? undefined;
|
|
104
105
|
const source = asset
|
|
105
106
|
? { kind: 'asset', id: asset.trim() }
|
|
@@ -127,7 +128,7 @@ function parseSkillFetchArgs(argv) {
|
|
|
127
128
|
},
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
|
-
async function buildSkillFetchResult(hub, opts) {
|
|
131
|
+
async function buildSkillFetchResult(hub, opts, cwd) {
|
|
131
132
|
const direct = opts.source.kind === 'asset' ? await fetchGeneById(hub, opts.source.id) : null;
|
|
132
133
|
if (direct && !direct.ok)
|
|
133
134
|
return direct;
|
|
@@ -157,7 +158,7 @@ async function buildSkillFetchResult(hub, opts) {
|
|
|
157
158
|
if (selected.asset.asset_id !== previewed.assetId) {
|
|
158
159
|
return { ok: false, reason: 'integrity_error', message: 'selected Gene asset_id changed after preview' };
|
|
159
160
|
}
|
|
160
|
-
const written = writeSkill(selected.asset, opts.outDir, opts.force);
|
|
161
|
+
const written = writeSkill(selected.asset, cwd, opts.outDir, opts.force);
|
|
161
162
|
if (!written.ok)
|
|
162
163
|
return written;
|
|
163
164
|
return { ok: true, value: { mode: 'write', candidates: [candidateFromGene(selected.asset, opts.outDir)], written: written.value } };
|
|
@@ -231,16 +232,14 @@ function candidateFromGene(gene, outDir) {
|
|
|
231
232
|
candidate.target = relativeSkillPath(name);
|
|
232
233
|
return candidate;
|
|
233
234
|
}
|
|
234
|
-
function writeSkill(gene, outDir, force) {
|
|
235
|
+
function writeSkill(gene, cwd, outDir, force) {
|
|
235
236
|
const name = skillNameForGene(gene);
|
|
236
237
|
const target = relativeSkillPath(name);
|
|
237
|
-
const
|
|
238
|
-
if (!
|
|
239
|
-
return { ok: false, reason: 'invalid_arg', message: 'resolved skill target escapes --out directory' };
|
|
240
|
-
if (existsSync(targetPath) && !force)
|
|
238
|
+
const write = writeFileInsideRoot(cwd, join(outDir, target), geneToSkillMd(gene, { name }), force);
|
|
239
|
+
if (!write.ok && write.reason === 'exists')
|
|
241
240
|
return { ok: false, reason: 'conflict', message: `SKILL.md already exists for skill ${name}; use --force to overwrite` };
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
if (!write.ok)
|
|
242
|
+
return { ok: false, reason: 'invalid_arg', message: 'skill target path must not pass through a symlink, junction, hard link, or non-directory' };
|
|
244
243
|
const written = { target, assetId: gene.asset_id, name };
|
|
245
244
|
const geneId = stringField(gene, 'id');
|
|
246
245
|
if (geneId)
|
|
@@ -361,16 +360,9 @@ function safeSkillName(value) {
|
|
|
361
360
|
.slice(0, 80);
|
|
362
361
|
return slug || 'skill';
|
|
363
362
|
}
|
|
364
|
-
function targetSkillPath(outDir, name) {
|
|
365
|
-
return resolve(outDir, 'skills', safeSkillName(name), 'SKILL.md');
|
|
366
|
-
}
|
|
367
363
|
function relativeSkillPath(name) {
|
|
368
364
|
return `skills/${safeSkillName(name)}/SKILL.md`;
|
|
369
365
|
}
|
|
370
|
-
function isInside(parent, child) {
|
|
371
|
-
const rel = relative(parent, child);
|
|
372
|
-
return rel.length > 0 && !rel.startsWith('..') && !isAbsolute(rel);
|
|
373
|
-
}
|
|
374
366
|
function arrayOfStrings(value) {
|
|
375
367
|
return Array.isArray(value) ? value.map((item) => String(item).trim()).filter(Boolean) : [];
|
|
376
368
|
}
|
package/dist/workflow.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { workflow } from '@evomap/evolver-core';
|
|
2
2
|
import { type ProductionWorkflowRuntimeOptions } from './workflowRuntime.js';
|
|
3
|
-
export declare const WORKFLOW_SUBCOMMANDS: readonly ["start", "submit", "list", "status", "history", "pause", "resume", "cancel", "approve", "reject"];
|
|
3
|
+
export declare const WORKFLOW_SUBCOMMANDS: readonly ["start", "submit", "list", "status", "inspect", "history", "pause", "resume", "cancel", "approve", "reject"];
|
|
4
4
|
type OutputStream = Pick<NodeJS.WriteStream, 'write'>;
|
|
5
5
|
type RuntimeControlOptions = {
|
|
6
6
|
actor: string;
|
|
@@ -18,6 +18,7 @@ type WorkflowRuntimeLike = {
|
|
|
18
18
|
};
|
|
19
19
|
type WorkflowStoreLike = {
|
|
20
20
|
read(runId: string): workflow.WorkflowRunState;
|
|
21
|
+
inspect?: (runId: string) => workflow.WorkflowRunState;
|
|
21
22
|
listRunIds(): string[];
|
|
22
23
|
history?: (runId: string) => unknown;
|
|
23
24
|
readHistory?: (runId: string) => unknown;
|
package/dist/workflow.js
CHANGED
|
@@ -7,7 +7,7 @@ const MAX_SPEC_BYTES = 1_048_576;
|
|
|
7
7
|
const MAX_REASON_LENGTH = 500;
|
|
8
8
|
const DEFAULT_ACTOR = 'local-operator';
|
|
9
9
|
export const WORKFLOW_SUBCOMMANDS = [
|
|
10
|
-
'start', 'submit', 'list', 'status', 'history', 'pause', 'resume', 'cancel', 'approve', 'reject',
|
|
10
|
+
'start', 'submit', 'list', 'status', 'inspect', 'history', 'pause', 'resume', 'cancel', 'approve', 'reject',
|
|
11
11
|
];
|
|
12
12
|
class WorkflowCliError extends Error {
|
|
13
13
|
code;
|
|
@@ -23,6 +23,7 @@ function usage(stderr) {
|
|
|
23
23
|
' evolver workflow start|submit <spec-file> [--run-id <id>] [--state-dir <path>] [--autoexec-home <path>] [--json]',
|
|
24
24
|
' evolver workflow list [--state-dir <path>] [--autoexec-home <path>] [--json]',
|
|
25
25
|
' evolver workflow status|history <run-id> [--state-dir <path>] [--autoexec-home <path>] [--json]',
|
|
26
|
+
' evolver workflow inspect <run-id> [--state-dir <path>] [--json] # stored checkpoint; no writes or recovery',
|
|
26
27
|
' evolver workflow pause|resume|cancel <run-id> [--actor <id>] [--reason <text>] [--state-dir <path>] [--autoexec-home <path>] [--json]',
|
|
27
28
|
' evolver workflow approve|reject <run-id> <gate-id> [--actor <id>] [--reason <text>] [--state-dir <path>] [--autoexec-home <path>] [--json]',
|
|
28
29
|
].join('\n') + '\n');
|
|
@@ -157,24 +158,34 @@ function statusPayload(state) {
|
|
|
157
158
|
attempts: current?.attempts ?? 0,
|
|
158
159
|
maxAttempts: current?.maxAttempts ?? 0,
|
|
159
160
|
lastErrorClass: safeMetadataToken(state.lastErrorClass),
|
|
160
|
-
createdAt: state.createdAt,
|
|
161
|
-
updatedAt: state.updatedAt,
|
|
162
|
-
completedAt: state.completedAt
|
|
161
|
+
createdAt: safeString(state.createdAt, 64),
|
|
162
|
+
updatedAt: safeString(state.updatedAt, 64),
|
|
163
|
+
completedAt: safeString(state.completedAt, 64),
|
|
163
164
|
};
|
|
164
165
|
}
|
|
165
166
|
function safeString(value, maxLength = 500) {
|
|
166
167
|
if (typeof value !== 'string' || value.length > maxLength || workflow.containsWorkflowSensitiveText(value))
|
|
167
168
|
return null;
|
|
168
|
-
|
|
169
|
-
const code = character.charCodeAt(0);
|
|
170
|
-
return code <= 0x1f || code === 0x7f;
|
|
171
|
-
});
|
|
172
|
-
return hasControlCharacter ? null : value;
|
|
169
|
+
return /[\p{Cc}\p{Bidi_Control}\p{Zl}\p{Zp}]/u.test(value) ? null : value;
|
|
173
170
|
}
|
|
174
|
-
function safeMetadataToken(value) {
|
|
175
|
-
const candidate = safeString(value,
|
|
171
|
+
function safeMetadataToken(value, maxLength = 64) {
|
|
172
|
+
const candidate = safeString(value, maxLength);
|
|
176
173
|
return candidate !== null && /^[A-Za-z0-9._-]+$/.test(candidate) ? candidate : null;
|
|
177
174
|
}
|
|
175
|
+
function inspectionPayload(state) {
|
|
176
|
+
const gateId = state.status === 'waiting_approval' ? safeMetadataToken(state.approval?.gateId, 128) : null;
|
|
177
|
+
const nextAction = state.status === 'waiting_approval' && gateId !== null ? 'review_approval'
|
|
178
|
+
: state.status === 'unsafe_to_resume' ? 'manual_reconciliation'
|
|
179
|
+
: state.status === 'failed' || state.status === 'waiting_approval' ? 'inspect_history'
|
|
180
|
+
: state.status === 'paused' ? 'review_before_resume'
|
|
181
|
+
: state.status === 'succeeded' || state.status === 'cancelled' ? 'none' : 'observe';
|
|
182
|
+
const step = state.currentStep ? state.steps[state.currentStep] : undefined;
|
|
183
|
+
const metadata = Object.fromEntries(Object.entries(statusPayload(state))
|
|
184
|
+
.map(([key, value]) => [key, typeof value === 'string' ? safeString(value)
|
|
185
|
+
: typeof value === 'number' && Number.isFinite(value) ? value : null]));
|
|
186
|
+
return { ...metadata, view: 'stored_checkpoint', nextAction, approvalGateId: gateId,
|
|
187
|
+
nextAttemptAt: state.status === 'retry_wait' ? safeString(step?.nextAttemptAt, 64) : null };
|
|
188
|
+
}
|
|
178
189
|
function historyPayload(entry) {
|
|
179
190
|
if (!isRecord(entry))
|
|
180
191
|
return { type: 'unknown' };
|
|
@@ -350,6 +361,18 @@ export async function runWorkflowCommand(argv, deps = {}) {
|
|
|
350
361
|
return 0;
|
|
351
362
|
}
|
|
352
363
|
runId = validateId(parsed.positionals[0] ?? '', 'runId');
|
|
364
|
+
if (parsed.command === 'inspect') {
|
|
365
|
+
if (!store.inspect)
|
|
366
|
+
throw new WorkflowCliError('INSPECTION_NOT_SUPPORTED');
|
|
367
|
+
const payload = inspectionPayload(store.inspect(runId));
|
|
368
|
+
if (parsed.json)
|
|
369
|
+
writeJson(stdout, { ok: true, ...payload });
|
|
370
|
+
else {
|
|
371
|
+
writeStatusText(stdout, payload);
|
|
372
|
+
stdout.write(`view=stored_checkpoint action=${String(payload['nextAction'])} gate=${String(payload['approvalGateId'] ?? '-')}\n`);
|
|
373
|
+
}
|
|
374
|
+
return 0;
|
|
375
|
+
}
|
|
353
376
|
if (parsed.command === 'status') {
|
|
354
377
|
const payload = statusPayload(store.read(runId));
|
|
355
378
|
if (parsed.json)
|
|
@@ -378,7 +401,7 @@ export async function runWorkflowCommand(argv, deps = {}) {
|
|
|
378
401
|
catch (error) {
|
|
379
402
|
const code = errorCode(error, parsed.command);
|
|
380
403
|
if (parsed.json)
|
|
381
|
-
writeJson(stdout, { ok: false, command: parsed.command, ...(runId ? { runId } : {}), error: code });
|
|
404
|
+
writeJson(stdout, { ok: false, command: parsed.command, ...(runId && safeString(runId, 128) !== null ? { runId } : {}), error: code });
|
|
382
405
|
else
|
|
383
406
|
stderr.write(`workflow ${parsed.command} failed: ${code}\n`);
|
|
384
407
|
return 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evomap/evolver-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.52",
|
|
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.52",
|
|
31
|
+
"@evomap/evolver-adapter-public": "2.0.52",
|
|
32
|
+
"@evomap/evolver-mcp": "2.0.52",
|
|
33
|
+
"@evomap/evolver-proxy": "2.0.52",
|
|
34
|
+
"@evomap/evolver-runtime-adapters": "2.0.52",
|
|
35
|
+
"@evomap/evolver-webui": "2.0.52"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|