@evomap/evolver-cli 2.0.42 → 2.0.44
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/autoRecall.d.ts +24 -5
- package/dist/autoRecall.js +233 -12
- package/dist/autoexec.d.ts +69 -10
- package/dist/autoexec.js +847 -137
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +71 -26
- package/dist/cliContracts.js +29 -7
- package/dist/cliEntry.d.ts +3 -0
- package/dist/cliEntry.js +63 -0
- package/dist/commandCatalog.d.ts +1 -0
- package/dist/commandCatalog.js +1 -0
- package/dist/contextDelivery.d.ts +12 -0
- package/dist/contextDelivery.js +139 -0
- package/dist/cycleConsumer.js +9 -1
- package/dist/dispatch.js +6 -0
- package/dist/feedbackOutbox.d.ts +96 -0
- package/dist/feedbackOutbox.js +510 -0
- package/dist/feedbackOutboxCli.d.ts +7 -0
- package/dist/feedbackOutboxCli.js +208 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +286 -69
- package/dist/lifecycle.d.ts +18 -0
- package/dist/lifecycle.js +130 -3
- package/dist/lifecycleBootstrapTransaction.js +1 -6
- package/dist/liveStatus.d.ts +27 -0
- package/dist/liveStatus.js +197 -0
- package/dist/outboxLock.d.ts +7 -0
- package/dist/outboxLock.js +141 -0
- package/dist/promptRecallHook.d.ts +7 -22
- package/dist/promptRecallHook.js +20 -489
- package/dist/promptRecallRuntime.d.ts +24 -0
- package/dist/promptRecallRuntime.js +678 -0
- package/dist/promptRecallShared.d.ts +18 -0
- package/dist/promptRecallShared.js +119 -0
- package/dist/recall.js +27 -6
- package/dist/runtimeTelemetry.d.ts +9 -0
- package/dist/runtimeTelemetry.js +16 -0
- package/dist/sessionIngest.d.ts +25 -2
- package/dist/sessionIngest.js +196 -32
- package/dist/setupHooks.js +63 -13
- package/dist/setupHooksLifecycle.js +39 -17
- package/dist/skill2gep.d.ts +11 -0
- package/dist/skill2gep.js +23 -3
- package/dist/solo/mode.js +4 -0
- package/dist/taskCommitments.d.ts +4 -2
- package/dist/taskCommitments.js +208 -114
- package/dist/taskOutcomeOutbox.d.ts +83 -0
- package/dist/taskOutcomeOutbox.js +553 -0
- package/dist/workflowRuntime.js +12 -0
- package/package.json +11 -7
package/dist/setupHooks.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// cleanly removes only evolver's entries.
|
|
7
7
|
import { planInjection, installInjection, uninstallInjection, runtimeSupport, renderManualWiring, renderServiceGuidance, SETUP_RUNTIMES, SERVICE_TARGETS, kiroConfigRoot, resolveOpenCodeConfig, McpConfigConflictError, McpConfigOwnershipError, McpConfigVerificationError, McpServerValidationError } from '@evomap/evolver-mcp';
|
|
8
8
|
import { assetstore, events } from '@evomap/evolver-core';
|
|
9
|
+
import { resolveInstallComponents } from '@evomap/evolver-mcp';
|
|
9
10
|
import { accessSync, constants, existsSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
10
11
|
import { createRequire } from 'node:module';
|
|
11
12
|
import { homedir } from 'node:os';
|
|
@@ -43,7 +44,7 @@ function parseFlags(argv) {
|
|
|
43
44
|
}
|
|
44
45
|
return out;
|
|
45
46
|
}
|
|
46
|
-
const USAGE = `usage: evolver setup-hooks [--runtime=${SETUP_RUNTIMES.join('|')}] [--scope=user|project|global] [--root=<dir>] [--lifecycle=capabilities|plan|verify|execute] [--action=install|uninstall] [--confirmed-plan=<base64url>] [--target-id=<id>] [--completed-targets=<id,id>] [--env-file=<path>] [--profile-descriptor=<json>] [--service=${SERVICE_TARGETS.join('|')}] [--verify] [--uninstall] [--dry-run] [--force] [--json] [--hook-command="evolver inject session-start"] [--server-node=<absolute-node>] [--server-command=<cmd>] [--server-args=a,b] [--service-command=<cmd>] [--service-args=a,b]\n --verify is read-only for opencode and kiro\n lifecycle operations are versioned JSON and require --json\n`;
|
|
47
|
+
const USAGE = `usage: evolver setup-hooks [--runtime=${SETUP_RUNTIMES.join('|')}] [--scope=user|project|global] [--components=product-only|evolution-only|both] [--root=<dir>] [--lifecycle=capabilities|plan|verify|execute] [--action=install|uninstall] [--confirmed-plan=<base64url>] [--target-id=<id>] [--completed-targets=<id,id>] [--env-file=<path>] [--profile-descriptor=<json>] [--service=${SERVICE_TARGETS.join('|')}] [--verify] [--uninstall] [--dry-run] [--force] [--json] [--hook-command="evolver inject session-start"] [--server-node=<absolute-node>] [--server-command=<cmd>] [--server-args=a,b] [--service-command=<cmd>] [--service-args=a,b]\n --verify is read-only for claude-code, codex, opencode and kiro\n lifecycle operations are versioned JSON and require --json\n`;
|
|
47
48
|
export function commandNamesForPath(command, platform, pathExt) {
|
|
48
49
|
if (platform !== 'win32' || /\.[^\\/]+$/.test(command))
|
|
49
50
|
return [command];
|
|
@@ -199,6 +200,8 @@ function displayResultPaths(paths, configRoot, scope) {
|
|
|
199
200
|
return paths?.map((path) => displaySetupPath(path, configRoot, scope));
|
|
200
201
|
}
|
|
201
202
|
export function safeSetupOperationError(error) {
|
|
203
|
+
if (error instanceof Error && error.message === '[setup-hooks] product bridge is user-owned; explicit --force is required')
|
|
204
|
+
return error.message;
|
|
202
205
|
if (error instanceof McpConfigConflictError)
|
|
203
206
|
return error.message;
|
|
204
207
|
if (error instanceof McpConfigOwnershipError)
|
|
@@ -448,6 +451,14 @@ function descriptorEnvFile(f, descriptor, descriptorServer) {
|
|
|
448
451
|
return descriptorServer?.env?.['EVOLVER_ENV_FILE'] ?? descriptor.envFile;
|
|
449
452
|
}
|
|
450
453
|
function buildServer(f, descriptor = { manualHints: {} }, resolveNodePath) {
|
|
454
|
+
if (f['components'] === 'product-only') {
|
|
455
|
+
if (f['server-node'] === true)
|
|
456
|
+
throw new McpNodeOverrideError('missing value for --server-node');
|
|
457
|
+
const nodePath = typeof f['server-node'] === 'string'
|
|
458
|
+
? resolveStableMcpNodePath({ execPath: f['server-node'], platform: process.platform, systemCandidates: [] })
|
|
459
|
+
: (resolveNodePath ?? resolveStableMcpNodePath)();
|
|
460
|
+
return { server: { command: nodePath }, nodePath };
|
|
461
|
+
}
|
|
451
462
|
const serverArgs = argsFromFlag(f['server-args']);
|
|
452
463
|
if (f['server-node'] === true)
|
|
453
464
|
throw new McpNodeOverrideError('missing value for --server-node');
|
|
@@ -514,7 +525,7 @@ function appendAdapterNotes(text, hints) {
|
|
|
514
525
|
: text;
|
|
515
526
|
}
|
|
516
527
|
const SETUP_VALUE_FLAGS = new Set([
|
|
517
|
-
'runtime', 'platform', 'scope', 'root', 'lifecycle', 'action', 'confirmed-plan', 'target-id', 'completed-targets', 'env-file', 'profile-descriptor', 'service',
|
|
528
|
+
'runtime', 'platform', 'scope', 'root', 'components', 'lifecycle', 'action', 'confirmed-plan', 'target-id', 'completed-targets', 'env-file', 'profile-descriptor', 'service',
|
|
518
529
|
'hook-command', 'server-node', 'server-command', 'server-args', 'service-command', 'service-args',
|
|
519
530
|
]);
|
|
520
531
|
function setupHelpRequested(argv) {
|
|
@@ -532,6 +543,12 @@ function setupHelpRequested(argv) {
|
|
|
532
543
|
function lifecycleAction(raw) {
|
|
533
544
|
return raw === 'install' || raw === 'uninstall' ? raw : undefined;
|
|
534
545
|
}
|
|
546
|
+
function validateSetupComponents(f, runtime) {
|
|
547
|
+
resolveInstallComponents(f['components']);
|
|
548
|
+
if (f['components'] !== undefined && runtime !== 'claude-code' && runtime !== 'codex') {
|
|
549
|
+
throw new Error('component selection is available only for claude-code and codex');
|
|
550
|
+
}
|
|
551
|
+
}
|
|
535
552
|
function runSetupLifecycle(f, runtime, scope, configRoot, emit, deps) {
|
|
536
553
|
const operation = f['lifecycle'];
|
|
537
554
|
if (operation === undefined)
|
|
@@ -557,6 +574,12 @@ function runSetupLifecycle(f, runtime, scope, configRoot, emit, deps) {
|
|
|
557
574
|
if (operation === 'execute' && f['completed-targets'] !== undefined && f['target-id'] === undefined) {
|
|
558
575
|
return fail('PLAN_INVALID', '--completed-targets requires --target-id');
|
|
559
576
|
}
|
|
577
|
+
try {
|
|
578
|
+
validateSetupComponents(f, runtime);
|
|
579
|
+
}
|
|
580
|
+
catch (error) {
|
|
581
|
+
return fail('PLAN_INVALID', error instanceof Error ? error.message : 'invalid component selection');
|
|
582
|
+
}
|
|
560
583
|
const capabilities = setupLifecycleCapabilities(runtime, scope);
|
|
561
584
|
if (operation === 'capabilities') {
|
|
562
585
|
emit({ schema: SETUP_LIFECYCLE_SCHEMA, operation, ok: true, capabilities });
|
|
@@ -568,7 +591,9 @@ function runSetupLifecycle(f, runtime, scope, configRoot, emit, deps) {
|
|
|
568
591
|
if ((operation === 'plan' || operation === 'execute') && action === undefined) {
|
|
569
592
|
return fail('PLAN_INVALID', '--action=install|uninstall is required');
|
|
570
593
|
}
|
|
571
|
-
const descriptor =
|
|
594
|
+
const descriptor = f['components'] === 'product-only'
|
|
595
|
+
? { ok: true, descriptor: { manualHints: {} } }
|
|
596
|
+
: profileDescriptorFromFlag(f);
|
|
572
597
|
if (!descriptor.ok)
|
|
573
598
|
return fail('PLAN_INVALID', descriptor.error, 1);
|
|
574
599
|
let server = { command: 'evolver-mcp' };
|
|
@@ -577,7 +602,9 @@ function runSetupLifecycle(f, runtime, scope, configRoot, emit, deps) {
|
|
|
577
602
|
try {
|
|
578
603
|
const built = buildServer(f, descriptor.descriptor, deps.resolveMcpNodePath);
|
|
579
604
|
server = built.server;
|
|
580
|
-
|
|
605
|
+
if (f['components'] !== 'evolution-only') {
|
|
606
|
+
productBridgeNodePath = built.nodePath ?? (deps.resolveMcpNodePath ?? resolveStableMcpNodePath)();
|
|
607
|
+
}
|
|
581
608
|
}
|
|
582
609
|
catch (error) {
|
|
583
610
|
return fail('CAPABILITY_UNAVAILABLE', safeSetupOperationError(error), 1);
|
|
@@ -590,6 +617,7 @@ function runSetupLifecycle(f, runtime, scope, configRoot, emit, deps) {
|
|
|
590
617
|
configRoot,
|
|
591
618
|
injectionPlan,
|
|
592
619
|
installOptions: {
|
|
620
|
+
components: resolveInstallComponents(f['components']),
|
|
593
621
|
configRoot,
|
|
594
622
|
server,
|
|
595
623
|
scope,
|
|
@@ -689,6 +717,17 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
689
717
|
const lifecycleCode = runSetupLifecycle(f, runtime, scope, configRoot, emit, deps);
|
|
690
718
|
if (lifecycleCode !== undefined)
|
|
691
719
|
return lifecycleCode;
|
|
720
|
+
try {
|
|
721
|
+
validateSetupComponents(f, runtime);
|
|
722
|
+
}
|
|
723
|
+
catch (error) {
|
|
724
|
+
const message = error instanceof Error ? error.message : 'invalid component selection';
|
|
725
|
+
if (json)
|
|
726
|
+
emit({ runtime, outcome: 'error', files: [], error: message });
|
|
727
|
+
else
|
|
728
|
+
process.stderr.write(`${message}\n`);
|
|
729
|
+
return 2;
|
|
730
|
+
}
|
|
692
731
|
// V1 exposed setup-hooks --verify as a read-only operation. Silently ignoring it is unsafe: the command then
|
|
693
732
|
// falls through to installInjection and can rewrite runtime configuration while the operator asked only to
|
|
694
733
|
// inspect it. V2's JSON MCP installers already have a transaction-free dry-run preflight, so use that as the
|
|
@@ -706,7 +745,7 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
706
745
|
process.stderr.write(`${error}\n${USAGE}`);
|
|
707
746
|
return 2;
|
|
708
747
|
}
|
|
709
|
-
if (runtime !== 'opencode' && runtime !== 'kiro') {
|
|
748
|
+
if (runtime !== 'opencode' && runtime !== 'kiro' && runtime !== 'claude-code' && runtime !== 'codex') {
|
|
710
749
|
const error = `--verify is not available for ${runtime}; no config was written`;
|
|
711
750
|
if (json)
|
|
712
751
|
emit({ runtime, action: 'verify', ok: false, verified: false, files: [], error });
|
|
@@ -714,7 +753,9 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
714
753
|
process.stderr.write(`${error}\n`);
|
|
715
754
|
return 2;
|
|
716
755
|
}
|
|
717
|
-
const verifyDescriptor =
|
|
756
|
+
const verifyDescriptor = f['components'] === 'product-only'
|
|
757
|
+
? { ok: true, descriptor: { manualHints: {} } }
|
|
758
|
+
: profileDescriptorFromFlag(f);
|
|
718
759
|
if (!verifyDescriptor.ok) {
|
|
719
760
|
if (json)
|
|
720
761
|
emit({ runtime, action: 'verify', ok: false, verified: false, files: [], error: verifyDescriptor.error });
|
|
@@ -724,13 +765,18 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
724
765
|
}
|
|
725
766
|
let verification;
|
|
726
767
|
try {
|
|
727
|
-
const
|
|
768
|
+
const built = buildServer(f, verifyDescriptor.descriptor, deps.resolveMcpNodePath);
|
|
769
|
+
const { server } = built;
|
|
728
770
|
verification = installInjection(planInjection(runtime, server), {
|
|
771
|
+
components: runtime === 'claude-code' || runtime === 'codex' ? resolveInstallComponents(f['components']) : undefined,
|
|
729
772
|
configRoot,
|
|
730
773
|
server,
|
|
731
774
|
scope,
|
|
732
775
|
dryRun: true,
|
|
776
|
+
...((runtime === 'claude-code' || runtime === 'codex') && f['components'] !== 'evolution-only'
|
|
777
|
+
? { productBridgeNodePath: built.nodePath ?? (deps.resolveMcpNodePath ?? resolveStableMcpNodePath)() } : {}),
|
|
733
778
|
homeDir: configuredHomeDir(),
|
|
779
|
+
codexHome: process.env['CODEX_HOME'],
|
|
734
780
|
kiroHome: process.env['KIRO_HOME'],
|
|
735
781
|
xdgConfigHome: process.env['XDG_CONFIG_HOME'],
|
|
736
782
|
opencodeConfig: process.env['OPENCODE_CONFIG'],
|
|
@@ -763,8 +809,8 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
763
809
|
: `evolver setup for ${runtime} is missing or does not match the requested configuration\n`);
|
|
764
810
|
return verified ? 0 : 1;
|
|
765
811
|
}
|
|
766
|
-
if (f['dry-run'] === true && runtime !== 'opencode' && runtime !== 'kiro') {
|
|
767
|
-
const error = `--dry-run is
|
|
812
|
+
if (f['dry-run'] === true && runtime !== 'opencode' && runtime !== 'kiro' && runtime !== 'claude-code' && runtime !== 'codex') {
|
|
813
|
+
const error = `--dry-run is supported for claude-code, codex, opencode and kiro setup; no config was written.`;
|
|
768
814
|
if (json)
|
|
769
815
|
emit({ runtime, outcome: 'error', files: [], error });
|
|
770
816
|
else
|
|
@@ -775,6 +821,7 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
775
821
|
let r;
|
|
776
822
|
try {
|
|
777
823
|
r = uninstallInjection(runtime, {
|
|
824
|
+
components: runtime === 'claude-code' || runtime === 'codex' ? resolveInstallComponents(f['components']) : undefined,
|
|
778
825
|
configRoot,
|
|
779
826
|
scope,
|
|
780
827
|
homeDir: configuredHomeDir(),
|
|
@@ -817,7 +864,9 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
817
864
|
process.stdout.write(files.length ? `removed evolver from: ${files.join(', ')}\n` : 'nothing to remove\n');
|
|
818
865
|
return 0;
|
|
819
866
|
}
|
|
820
|
-
const profileDescriptor =
|
|
867
|
+
const profileDescriptor = f['components'] === 'product-only'
|
|
868
|
+
? { ok: true, descriptor: { manualHints: {} } }
|
|
869
|
+
: profileDescriptorFromFlag(f);
|
|
821
870
|
if (!profileDescriptor.ok) {
|
|
822
871
|
if (json)
|
|
823
872
|
emit({ runtime: runtimeRaw, outcome: 'error', files: [], error: profileDescriptor.error });
|
|
@@ -919,8 +968,8 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
919
968
|
// cursor seeds .cursor/rules/evolver.mdc with the CURRENT top REVIEW-APPROVED genes so the file is useful
|
|
920
969
|
// immediately (before the first daemon rewrite) without seeding an unapproved draft (A2a). The renderer thus
|
|
921
970
|
// has a real production caller even without the daemon running.
|
|
922
|
-
const cursorStore = store ?? new assetstore.LocalJsonlProvider(events.assetsDir());
|
|
923
|
-
const cursorGenes =
|
|
971
|
+
const cursorStore = runtime === 'cursor' ? store ?? new assetstore.LocalJsonlProvider(events.assetsDir()) : undefined;
|
|
972
|
+
const cursorGenes = cursorStore
|
|
924
973
|
? await currentTopCursorGenes(cursorStore, review ?? reviewLedgerForStore(cursorStore))
|
|
925
974
|
: undefined;
|
|
926
975
|
let r;
|
|
@@ -929,10 +978,11 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
929
978
|
// It must not inherit a package-manager-local process.execPath (#1068): give it the same stable Node the
|
|
930
979
|
// evolver entry uses — the pinned --server-node when set, otherwise the default stable resolution. Runtimes
|
|
931
980
|
// without a bridge entry never resolve a Node here.
|
|
932
|
-
const productBridgeNodePath = (runtime === 'claude-code' || runtime === 'codex')
|
|
981
|
+
const productBridgeNodePath = (runtime === 'claude-code' || runtime === 'codex') && f['components'] !== 'evolution-only'
|
|
933
982
|
? serverNodePath ?? (deps.resolveMcpNodePath ?? resolveStableMcpNodePath)()
|
|
934
983
|
: undefined;
|
|
935
984
|
r = installInjection(planInjection(runtime, server), {
|
|
985
|
+
components: runtime === 'claude-code' || runtime === 'codex' ? resolveInstallComponents(f['components']) : undefined,
|
|
936
986
|
configRoot, server, scope,
|
|
937
987
|
...(productBridgeNodePath !== undefined ? { productBridgeNodePath } : {}),
|
|
938
988
|
...(typeof f['hook-command'] === 'string' ? { hookCommand: f['hook-command'] } : {}),
|
|
@@ -2,7 +2,7 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import { lstatSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { isAbsolute, relative, resolve, sep } from 'node:path';
|
|
5
|
-
import { DEFAULT_HOOK_COMMAND, DEFAULT_PROMPT_RECALL_HOOK_COMMAND, installInjection, uninstallInjection, } from '@evomap/evolver-mcp';
|
|
5
|
+
import { DEFAULT_HOOK_COMMAND, DEFAULT_PROMPT_RECALL_HOOK_COMMAND, claudeCodeTargets, codexConfigTarget, installInjection, uninstallInjection, resolveInstallComponents, } from '@evomap/evolver-mcp';
|
|
6
6
|
export const SETUP_LIFECYCLE_SCHEMA = 'evolver.setup_hooks.lifecycle.v1';
|
|
7
7
|
export const SETUP_LIFECYCLE_PLAN_TTL_MS = 120_000;
|
|
8
8
|
export class SetupLifecycleError extends Error {
|
|
@@ -46,6 +46,7 @@ function canonicalJson(value) {
|
|
|
46
46
|
function lifecycleIntentDigest(context, action) {
|
|
47
47
|
const options = context.installOptions;
|
|
48
48
|
const targetResolution = {
|
|
49
|
+
components: resolveInstallComponents(options.components),
|
|
49
50
|
configRoot: context.configRoot,
|
|
50
51
|
scope: context.scope,
|
|
51
52
|
homeDir: options.homeDir,
|
|
@@ -117,6 +118,7 @@ function planResult(context, action) {
|
|
|
117
118
|
return installInjection(context.injectionPlan, { ...context.installOptions, dryRun: true });
|
|
118
119
|
}
|
|
119
120
|
return uninstallInjection(context.runtime, {
|
|
121
|
+
components: context.installOptions.components,
|
|
120
122
|
configRoot: context.configRoot,
|
|
121
123
|
scope: context.scope,
|
|
122
124
|
homeDir: context.installOptions.homeDir,
|
|
@@ -128,7 +130,7 @@ function planResult(context, action) {
|
|
|
128
130
|
dryRun: true,
|
|
129
131
|
});
|
|
130
132
|
}
|
|
131
|
-
function planForTimes(context, action, createdAt, expiresAt) {
|
|
133
|
+
function planForTimes(context, action, createdAt, expiresAt, resolvedPaths) {
|
|
132
134
|
const capabilities = setupLifecycleCapabilities(context.runtime, context.scope);
|
|
133
135
|
if (!capabilities.supported || !capabilities.operations[action]) {
|
|
134
136
|
throw new SetupLifecycleError('CAPABILITY_UNAVAILABLE', `lifecycle ${action} is unavailable for ${context.runtime}/${context.scope}`);
|
|
@@ -136,11 +138,24 @@ function planForTimes(context, action, createdAt, expiresAt) {
|
|
|
136
138
|
const dryRun = planResult(context, action);
|
|
137
139
|
if (!dryRun.ok)
|
|
138
140
|
throw new SetupLifecycleError('PLAN_INVALID', dryRun.error ?? 'lifecycle plan failed');
|
|
141
|
+
if (resolvedPaths) {
|
|
142
|
+
const options = context.installOptions;
|
|
143
|
+
const claude = context.runtime === 'claude-code'
|
|
144
|
+
? claudeCodeTargets(options.scope ?? 'project', options.configRoot, options.homeDir)
|
|
145
|
+
: undefined;
|
|
146
|
+
const paths = claude
|
|
147
|
+
? [claude.mcpConfigPath, ...(resolveInstallComponents(options.components) === 'product-only' ? [] : [claude.settingsPath])]
|
|
148
|
+
: [codexConfigTarget(options).configPath];
|
|
149
|
+
for (const path of paths.map((path) => resolve(path))) {
|
|
150
|
+
resolvedPaths.set(digest(`${context.runtime}\0${context.scope}\0${path}`).slice(0, 32), path);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
139
153
|
const files = [...new Set(dryRun.files.map((path) => resolve(path)))].sort();
|
|
140
154
|
const targets = files.map((path) => {
|
|
141
155
|
const expectedIdentity = fileIdentity(path);
|
|
156
|
+
const targetId = digest(`${context.runtime}\0${context.scope}\0${path}`).slice(0, 32);
|
|
142
157
|
return {
|
|
143
|
-
target_id:
|
|
158
|
+
target_id: targetId,
|
|
144
159
|
target_ref: displayTarget(path, context),
|
|
145
160
|
expected_identity: expectedIdentity,
|
|
146
161
|
disposition: action === 'install' ? 'installable' : 'removable',
|
|
@@ -243,7 +258,8 @@ export function executeSetupLifecyclePlan(context, confirmed, options = {}) {
|
|
|
243
258
|
if (options.targetId !== undefined) {
|
|
244
259
|
return executeSetupLifecycleTarget(context, confirmed, options.targetId, options.completedTargetIds ?? [], createdAt, expiresAt);
|
|
245
260
|
}
|
|
246
|
-
const
|
|
261
|
+
const resolvedPaths = new Map();
|
|
262
|
+
const current = planForTimes(context, confirmed.action, createdAt, expiresAt, resolvedPaths);
|
|
247
263
|
const sameTargets = JSON.stringify(current.targets.map((target) => target.target_id))
|
|
248
264
|
=== JSON.stringify(confirmed.targets.map((target) => target.target_id));
|
|
249
265
|
if (current.plan_id !== confirmed.plan_id
|
|
@@ -258,6 +274,7 @@ export function executeSetupLifecyclePlan(context, confirmed, options = {}) {
|
|
|
258
274
|
result = confirmed.action === 'install'
|
|
259
275
|
? installInjection(context.injectionPlan, context.installOptions)
|
|
260
276
|
: uninstallInjection(context.runtime, {
|
|
277
|
+
components: context.installOptions.components,
|
|
261
278
|
configRoot: context.configRoot,
|
|
262
279
|
scope: context.scope,
|
|
263
280
|
homeDir: context.installOptions.homeDir,
|
|
@@ -284,8 +301,8 @@ export function executeSetupLifecyclePlan(context, confirmed, options = {}) {
|
|
|
284
301
|
}
|
|
285
302
|
}
|
|
286
303
|
const targets = confirmed.targets.map((target) => {
|
|
287
|
-
const path =
|
|
288
|
-
const committed = path !==
|
|
304
|
+
const path = resolvedPaths.get(target.target_id);
|
|
305
|
+
const committed = path !== undefined && fileIdentity(path) !== target.expected_identity;
|
|
289
306
|
const targetVerified = !executionFailed && verified;
|
|
290
307
|
return {
|
|
291
308
|
target_id: target.target_id,
|
|
@@ -321,13 +338,20 @@ function executeSetupLifecycleTarget(context, confirmed, targetId, completedTarg
|
|
|
321
338
|
if (completed.size !== completedTargetIds.length || completed.has(targetId) || [...completed].some((id) => !confirmedIds.has(id))) {
|
|
322
339
|
throw new SetupLifecycleError('PLAN_INVALID', 'completed lifecycle target set is invalid');
|
|
323
340
|
}
|
|
324
|
-
const
|
|
341
|
+
const resolvedPaths = new Map();
|
|
342
|
+
const current = planForTimes(context, confirmed.action, createdAt, expiresAt, resolvedPaths);
|
|
325
343
|
const currentTargets = current.targets.filter((target) => target.disposition !== 'already_satisfied');
|
|
326
344
|
const currentByID = new Map(currentTargets.map((target) => [target.target_id, target]));
|
|
327
345
|
if (currentTargets.some((target) => !confirmedIds.has(target.target_id))) {
|
|
328
346
|
throw new SetupLifecycleError('PLAN_STALE', 'lifecycle target set changed; create a fresh plan');
|
|
329
347
|
}
|
|
348
|
+
const currentSelected = currentByID.get(targetId);
|
|
349
|
+
if (currentSelected && (currentSelected.target_ref !== selected.target_ref || currentSelected.disposition !== selected.disposition)) {
|
|
350
|
+
throw new SetupLifecycleError('PLAN_STALE', 'selected lifecycle target metadata changed');
|
|
351
|
+
}
|
|
330
352
|
if (selected.disposition === 'already_satisfied') {
|
|
353
|
+
if (current.plan_id !== confirmed.plan_id)
|
|
354
|
+
throw new SetupLifecycleError('PLAN_STALE', 'no-op lifecycle plan changed');
|
|
331
355
|
return {
|
|
332
356
|
schema: SETUP_LIFECYCLE_SCHEMA,
|
|
333
357
|
action: confirmed.action,
|
|
@@ -346,6 +370,12 @@ function executeSetupLifecycleTarget(context, confirmed, targetId, completedTarg
|
|
|
346
370
|
}],
|
|
347
371
|
};
|
|
348
372
|
}
|
|
373
|
+
const targetPath = resolvedPaths.get(targetId);
|
|
374
|
+
if (targetPath === undefined
|
|
375
|
+
|| displayTarget(targetPath, context) !== selected.target_ref
|
|
376
|
+
|| selected.disposition !== (confirmed.action === 'install' ? 'installable' : 'removable')) {
|
|
377
|
+
throw new SetupLifecycleError('PLAN_STALE', 'selected lifecycle target is not owned by this operation');
|
|
378
|
+
}
|
|
349
379
|
for (const target of confirmed.targets) {
|
|
350
380
|
if (target.disposition === 'already_satisfied')
|
|
351
381
|
continue;
|
|
@@ -365,7 +395,6 @@ function executeSetupLifecycleTarget(context, confirmed, targetId, completedTarg
|
|
|
365
395
|
throw new SetupLifecycleError('PLAN_STALE', 'a pending lifecycle target identity changed');
|
|
366
396
|
}
|
|
367
397
|
}
|
|
368
|
-
const targetPath = resolveTargetRef(selected, context);
|
|
369
398
|
const alreadyApplied = !currentByID.has(targetId);
|
|
370
399
|
if (alreadyApplied) {
|
|
371
400
|
return {
|
|
@@ -391,6 +420,7 @@ function executeSetupLifecycleTarget(context, confirmed, targetId, completedTarg
|
|
|
391
420
|
const result = confirmed.action === 'install'
|
|
392
421
|
? installInjection(context.injectionPlan, { ...context.installOptions, targetPath })
|
|
393
422
|
: uninstallInjection(context.runtime, {
|
|
423
|
+
components: context.installOptions.components,
|
|
394
424
|
configRoot: context.configRoot,
|
|
395
425
|
scope: context.scope,
|
|
396
426
|
homeDir: context.installOptions.homeDir,
|
|
@@ -414,7 +444,7 @@ function executeSetupLifecycleTarget(context, confirmed, targetId, completedTarg
|
|
|
414
444
|
catch {
|
|
415
445
|
executionFailed = true;
|
|
416
446
|
}
|
|
417
|
-
const committed =
|
|
447
|
+
const committed = fileIdentity(targetPath) !== selected.expected_identity;
|
|
418
448
|
const targetVerified = !executionFailed && verified;
|
|
419
449
|
const outcome = targetVerified
|
|
420
450
|
? confirmed.action === 'install' ? 'installed' : 'removed'
|
|
@@ -437,12 +467,4 @@ function executeSetupLifecycleTarget(context, confirmed, targetId, completedTarg
|
|
|
437
467
|
...(!targetVerified ? { recovery: committed ? 'RETRY_VERIFICATION' : 'OPEN_CONFIG' } : {}),
|
|
438
468
|
}],
|
|
439
469
|
};
|
|
440
|
-
}
|
|
441
|
-
function resolveTargetRef(target, context) {
|
|
442
|
-
if (target.disposition === 'already_satisfied' || target.target_ref.startsWith('<managed:'))
|
|
443
|
-
return '';
|
|
444
|
-
if (target.target_ref.startsWith('~/')) {
|
|
445
|
-
return resolve(context.installOptions.homeDir ?? homedir(), target.target_ref.slice(2));
|
|
446
|
-
}
|
|
447
|
-
return resolve(context.configRoot, target.target_ref);
|
|
448
470
|
}
|
package/dist/skill2gep.d.ts
CHANGED
|
@@ -114,6 +114,15 @@ export interface SkillCapsule {
|
|
|
114
114
|
gene: string;
|
|
115
115
|
trigger: string[];
|
|
116
116
|
summary: string;
|
|
117
|
+
a2a: {
|
|
118
|
+
context_projection: {
|
|
119
|
+
schema: 'gene-context-projection.v1';
|
|
120
|
+
record_kind: 'method_record';
|
|
121
|
+
summary: string;
|
|
122
|
+
trigger: string[];
|
|
123
|
+
strategy: string[];
|
|
124
|
+
};
|
|
125
|
+
};
|
|
117
126
|
confidence: number;
|
|
118
127
|
blast_radius: {
|
|
119
128
|
files: number;
|
|
@@ -149,10 +158,12 @@ export type AssembleResult = {
|
|
|
149
158
|
* Assemble a Capsule from a gene + real execution evidence (v1 assembleCapsule) — RED LINE #2/#3. Every
|
|
150
159
|
* `Gene.validation` command MUST appear in `execution.trace` (whitespace-normalized exact match) AND carry an
|
|
151
160
|
* integer exit code; otherwise refuse → the caller degrades to Gene-only. No coverage = no Capsule.
|
|
161
|
+
* Context projection requires an explicit source plannedStrategy. Synthesized Gene steps stay in the legacy field.
|
|
152
162
|
*/
|
|
153
163
|
export declare function assembleCapsule(gene: algo.GeneCandidate, execution: SkillExecution, opts?: {
|
|
154
164
|
scenario?: string;
|
|
155
165
|
evidenceMode?: SkillEvidenceMode;
|
|
166
|
+
plannedStrategy?: readonly string[];
|
|
156
167
|
}): AssembleResult;
|
|
157
168
|
export interface ReverseDistillResult {
|
|
158
169
|
gene: algo.GeneCandidate | null;
|
package/dist/skill2gep.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// faithful to v1 (golden-tested). B2 adds `synthesizeGene` + the Capsule contracts (trace-only / empty→Gene-only /
|
|
5
5
|
// validation-coverage); the human-review + real-trace red lines live there.
|
|
6
6
|
import { createHash } from 'node:crypto';
|
|
7
|
-
import { bootstrap, verify } from '@evomap/evolver-core';
|
|
7
|
+
import { bootstrap, hub, verify } from '@evomap/evolver-core';
|
|
8
8
|
const { isValidationCommandAllowed } = verify;
|
|
9
9
|
// Re-export for backward compatibility (used by tests)
|
|
10
10
|
export { isValidationCommandAllowed };
|
|
@@ -439,6 +439,7 @@ const buildContentSummary = (trace, blast) => {
|
|
|
439
439
|
* Assemble a Capsule from a gene + real execution evidence (v1 assembleCapsule) — RED LINE #2/#3. Every
|
|
440
440
|
* `Gene.validation` command MUST appear in `execution.trace` (whitespace-normalized exact match) AND carry an
|
|
441
441
|
* integer exit code; otherwise refuse → the caller degrades to Gene-only. No coverage = no Capsule.
|
|
442
|
+
* Context projection requires an explicit source plannedStrategy. Synthesized Gene steps stay in the legacy field.
|
|
442
443
|
*/
|
|
443
444
|
export function assembleCapsule(gene, execution, opts = {}) {
|
|
444
445
|
const trace = Array.isArray(execution?.trace) ? execution.trace : [];
|
|
@@ -467,12 +468,29 @@ export function assembleCapsule(gene, execution, opts = {}) {
|
|
|
467
468
|
const stableExecKey = execution?.started_at ??
|
|
468
469
|
JSON.stringify({ s: status, sc: score, f: files, l: lines, t: trace.map((t) => `${normalizeCmd(t?.cmd)}:${Number.isInteger(t?.exit) ? t.exit : 'x'}`) });
|
|
469
470
|
const idKey = shortHash(`${String(gene.id)}|${stableExecKey}`);
|
|
471
|
+
const summary = execution?.summary || `Applied ${gene.id} on scenario ${opts.scenario || 'local skill invocation'}`;
|
|
472
|
+
const trigger = Array.isArray(execution?.trigger) ? [...execution.trigger] : [...(gene.signals_match ?? [])].slice(0, 6);
|
|
473
|
+
// Gene synthesis may add generic fallback steps. Only a caller-supplied source
|
|
474
|
+
// plan can be projected as Skill method history; keep the legacy field below.
|
|
475
|
+
const plannedStrategy = opts.plannedStrategy ?? [];
|
|
470
476
|
const capsule = {
|
|
471
477
|
type: 'Capsule',
|
|
472
478
|
id: CAPSULE_ID_PREFIX + slugify(geneIdSuffix) + '_' + idKey,
|
|
473
479
|
gene: String(gene.id),
|
|
474
|
-
trigger
|
|
475
|
-
summary
|
|
480
|
+
trigger,
|
|
481
|
+
summary,
|
|
482
|
+
// The Skill supplies a plan; command exits do not prove each prose step ran.
|
|
483
|
+
// This projection is method content, not an extra verifier or permission channel.
|
|
484
|
+
a2a: { context_projection: {
|
|
485
|
+
schema: 'gene-context-projection.v1',
|
|
486
|
+
record_kind: 'method_record',
|
|
487
|
+
summary: hub.redactString(summary),
|
|
488
|
+
trigger: trigger.map(signal => hub.redactString(signal)),
|
|
489
|
+
strategy: Array.isArray(plannedStrategy) && plannedStrategy.length <= 64
|
|
490
|
+
&& plannedStrategy.every((step) => typeof step === 'string' && step.length <= 7900)
|
|
491
|
+
? plannedStrategy.filter((step) => step.trim()).map(step => hub.redactString(step))
|
|
492
|
+
: [],
|
|
493
|
+
} },
|
|
476
494
|
confidence: Math.max(0, Math.min(1, score)),
|
|
477
495
|
blast_radius: { files, lines },
|
|
478
496
|
outcome: { status, score },
|
|
@@ -517,6 +535,8 @@ export function reverseDistill(parsed, execution = {}, opts = {}) {
|
|
|
517
535
|
}
|
|
518
536
|
else {
|
|
519
537
|
const r = assembleCapsule(gene, execution, {
|
|
538
|
+
// Do not project synthesizeGene's generic fallback steps as this Skill's actual method.
|
|
539
|
+
plannedStrategy: parsed.strategy ?? [],
|
|
520
540
|
...(opts.scenario ? { scenario: opts.scenario } : {}),
|
|
521
541
|
...(opts.evidenceMode ? { evidenceMode: opts.evidenceMode } : {}),
|
|
522
542
|
});
|
package/dist/solo/mode.js
CHANGED
|
@@ -26,6 +26,10 @@ export function soloMaxFails(env = process.env) {
|
|
|
26
26
|
*/
|
|
27
27
|
export function applySoloLockdown(env = process.env) {
|
|
28
28
|
const forced = {
|
|
29
|
+
// Startup has already loaded local settings. Freeze this profile across
|
|
30
|
+
// later connector reloads and child processes; the file cannot restore gates.
|
|
31
|
+
EVOLVER_SOLO: '1',
|
|
32
|
+
EVOLVER_ENV_FILE: '',
|
|
29
33
|
// Offline: the hub-reuse + question links are gated on this flag; forcing it
|
|
30
34
|
// off means resolveHubLink/resolveHubQuestionLink return undefined → zero hub calls.
|
|
31
35
|
EVOLVER_REUSE_BEFORE_SOLVE: '0',
|
|
@@ -43,7 +43,7 @@ export interface CompletedTask {
|
|
|
43
43
|
taskId: string;
|
|
44
44
|
completed: boolean;
|
|
45
45
|
error?: string;
|
|
46
|
-
/**
|
|
46
|
+
/** Saved debt: known unsent or refused can retry; unknown delivery requires reconciliation. */
|
|
47
47
|
pending?: boolean;
|
|
48
48
|
}
|
|
49
49
|
export interface PendingCompletion {
|
|
@@ -54,6 +54,8 @@ export interface PendingCompletion {
|
|
|
54
54
|
attempts: number;
|
|
55
55
|
nextAttemptMs: number;
|
|
56
56
|
lastError?: string;
|
|
57
|
+
/** Written before every HTTP attempt; removed only after its response is recorded. */
|
|
58
|
+
dispatchState?: 'in_progress';
|
|
57
59
|
}
|
|
58
60
|
export interface PendingClaim {
|
|
59
61
|
taskId: string;
|
|
@@ -110,7 +112,7 @@ export interface CommitmentWiring {
|
|
|
110
112
|
* learns it was kept when the produced asset comes back.
|
|
111
113
|
*/
|
|
112
114
|
complete: (taskId: string, resultAssetId: string, generation?: string) => Promise<CompletedTask>;
|
|
113
|
-
/**
|
|
115
|
+
/** Send known-unsent or response-settled debt. Unknown delivery stays saved without replay. */
|
|
114
116
|
retryCompletions: () => Promise<CompletionRetryResult>;
|
|
115
117
|
/** Re-file claims that never reached the execute queue. The claim is already spent. */
|
|
116
118
|
retryQueueWrites: () => Promise<QueueRetryResult>;
|