@ornexus/neocortex 4.60.66 → 4.60.68
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/release-source.json +1 -1
- package/dist/sbom.cdx.json +1598 -1640
- package/install.ps1 +1 -1
- package/install.sh +2 -1
- package/package.json +10 -7
- package/packages/client/dist/adapters/adapter-registry.js +108 -1
- package/packages/client/dist/adapters/antigravity-adapter.js +77 -2
- package/packages/client/dist/adapters/claude-code-adapter.js +79 -3
- package/packages/client/dist/adapters/codex-adapter.js +80 -2
- package/packages/client/dist/adapters/cursor-adapter.js +115 -4
- package/packages/client/dist/adapters/gemini-adapter.js +71 -2
- package/packages/client/dist/adapters/grok-adapter.js +42 -2
- package/packages/client/dist/adapters/index.js +22 -1
- package/packages/client/dist/adapters/platform-detector.js +212 -1
- package/packages/client/dist/adapters/target-adapter.js +12 -0
- package/packages/client/dist/adapters/vscode-adapter.js +72 -2
- package/packages/client/dist/agent/refresh-stubs.js +417 -2
- package/packages/client/dist/agent/update-agent-yaml.js +102 -1
- package/packages/client/dist/agent/update-description.js +251 -1
- package/packages/client/dist/cache/crypto-utils.js +78 -1
- package/packages/client/dist/cache/encrypted-cache.js +108 -1
- package/packages/client/dist/cache/in-memory-asset-cache.js +73 -1
- package/packages/client/dist/cache/index.js +13 -1
- package/packages/client/dist/cache/protected-pi-boundary.js +44 -1
- package/packages/client/dist/checkpoint/checkpoint-client-reader.js +127 -2
- package/packages/client/dist/checkpoint/index.js +11 -1
- package/packages/client/dist/checkpoint/shared-checkpoint-types.js +32 -1
- package/packages/client/dist/cli.js +303 -3
- package/packages/client/dist/commands/activate.js +394 -8
- package/packages/client/dist/commands/architecture-answers.js +274 -7
- package/packages/client/dist/commands/architecture-memory-terminal.js +253 -4
- package/packages/client/dist/commands/architecture-non-ui-continuation.js +100 -1
- package/packages/client/dist/commands/architecture-root-binding.js +51 -1
- package/packages/client/dist/commands/cache-status.js +112 -2
- package/packages/client/dist/commands/config.js +88 -1
- package/packages/client/dist/commands/doctor.d.ts +135 -0
- package/packages/client/dist/commands/doctor.js +635 -0
- package/packages/client/dist/commands/invoke.d.ts +18 -0
- package/packages/client/dist/commands/invoke.js +7140 -142
- package/packages/client/dist/commands/legacy-epic-terminal.js +71 -1
- package/packages/client/dist/commands/legacy-story-branch.js +96 -1
- package/packages/client/dist/commands/legacy-story-pr.js +276 -1
- package/packages/client/dist/commands/mutation-qa-checkpoint.js +285 -5
- package/packages/client/dist/commands/mutation-qa-gate.js +54 -1
- package/packages/client/dist/commands/mutation-qa-git.js +41 -1
- package/packages/client/dist/commands/mutation-qa-policy.js +102 -1
- package/packages/client/dist/commands/mutation-qa-run.js +219 -3
- package/packages/client/dist/commands/mutation-qa-verdict.js +149 -1
- package/packages/client/dist/commands/mutation-qa.js +220 -1
- package/packages/client/dist/commands/native-agent.js +136 -2
- package/packages/client/dist/commands/planning-diagnosis.js +43 -1
- package/packages/client/dist/commands/planning-generation.js +53 -1
- package/packages/client/dist/commands/planning-memory.js +40 -1
- package/packages/client/dist/commands/planning-research.js +42 -1
- package/packages/client/dist/commands/private-session.js +75 -1
- package/packages/client/dist/commands/property-qa.js +139 -1
- package/packages/client/dist/commands/qa-control.js +16 -1
- package/packages/client/dist/commands/qa-scan-browser-launch.js +55 -1
- package/packages/client/dist/commands/qa-scan-browser-route.js +28 -1
- package/packages/client/dist/commands/qa-scan-capture.js +663 -5
- package/packages/client/dist/commands/qa-scan-discovery.js +376 -3
- package/packages/client/dist/commands/qa-scan-review.js +826 -5
- package/packages/client/dist/commands/qa-synthetic-backend-capture.js +266 -1
- package/packages/client/dist/commands/qa-synthetic-backend-review.js +297 -1
- package/packages/client/dist/commands/qa-synthetic-backend.js +340 -2
- package/packages/client/dist/commands/qa-synthetic-broker-port.js +85 -1
- package/packages/client/dist/commands/qa-synthetic-browser.js +39 -1
- package/packages/client/dist/commands/refactor-characterization.js +671 -21
- package/packages/client/dist/commands/refactor-commit.js +399 -13
- package/packages/client/dist/commands/refactor-control.js +142 -3
- package/packages/client/dist/commands/refactor-cpp-assertions.js +93 -3
- package/packages/client/dist/commands/refactor-review.js +283 -5
- package/packages/client/dist/commands/refactor-root.js +588 -7
- package/packages/client/dist/commands/refresh-memory.js +156 -3
- package/packages/client/dist/commands/shared-architecture-non-ui.js +24 -1
- package/packages/client/dist/commands/story-checkpoint.js +171 -1
- package/packages/client/dist/config/profile-directory.js +13 -1
- package/packages/client/dist/config/resolver-selection.js +278 -1
- package/packages/client/dist/config/secure-config.js +281 -12
- package/packages/client/dist/config.js +223 -2
- package/packages/client/dist/constants.js +25 -1
- package/packages/client/dist/context/context-collector.js +222 -2
- package/packages/client/dist/context/context-sanitizer.js +145 -1
- package/packages/client/dist/continuity/autonomous-governance.js +285 -1
- package/packages/client/dist/continuity/continuity-client-state-store.js +1587 -1
- package/packages/client/dist/continuity/invoke-hooks.js +129 -1
- package/packages/client/dist/continuity/migrations/001-initial-schema.js +12 -2
- package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +12 -2
- package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +12 -2
- package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +12 -2
- package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +12 -2
- package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +10 -2
- package/packages/client/dist/continuity/native-agent-store.js +69 -1
- package/packages/client/dist/continuity/native-agent-types.js +90 -1
- package/packages/client/dist/continuity/outbox.js +117 -1
- package/packages/client/dist/continuity/runner-bootstrap-policy.js +172 -1
- package/packages/client/dist/continuity/sqlite-store.js +2536 -81
- package/packages/client/dist/effects/invoke-effect-gateways.js +62 -1
- package/packages/client/dist/errors/error-messages.js +228 -2
- package/packages/client/dist/errors/frontmatter-diagnostics.js +125 -1
- package/packages/client/dist/evidence/collector.js +347 -1
- package/packages/client/dist/evidence/index.js +1 -1
- package/packages/client/dist/evidence/types.js +2 -0
- package/packages/client/dist/fs/atomic-state-replace.js +152 -1
- package/packages/client/dist/generated/command-registry.generated.js +4076 -1
- package/packages/client/dist/generated/public-projections.generated.js +149 -1
- package/packages/client/dist/git/direct-yolo-c01-retry.js +138 -4
- package/packages/client/dist/git/direct-yolo-checkpoint.js +1234 -4
- package/packages/client/dist/git/git-lifecycle-step-ids.js +14 -1
- package/packages/client/dist/git/git-lifecycle-store.js +1938 -9
- package/packages/client/dist/git/legacy-story-branch-checkpoint.js +259 -9
- package/packages/client/dist/git/legacy-story-branch-setup.js +348 -4
- package/packages/client/dist/git/legacy-story-pr.js +3538 -70
- package/packages/client/dist/git/secure-filesystem-boundary.js +182 -5
- package/packages/client/dist/graph-retrieval/pre-command-hook.js +284 -1
- package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +237 -1
- package/packages/client/dist/i18n/first-run.js +60 -2
- package/packages/client/dist/index.js +47 -1
- package/packages/client/dist/invocation/invoke-input.js +24 -1
- package/packages/client/dist/license/index.js +5 -1
- package/packages/client/dist/license/license-client.js +304 -1
- package/packages/client/dist/machine/fingerprint.js +163 -2
- package/packages/client/dist/machine/index.js +5 -1
- package/packages/client/dist/memory/project-memory-path-scope.js +62 -1
- package/packages/client/dist/memory/project-memory-writer.js +1007 -40
- package/packages/client/dist/memory/shared-project-memory-types.js +253 -2
- package/packages/client/dist/migrations/project-identity-capability.js +50 -1
- package/packages/client/dist/migrations/project-identity.js +493 -7
- package/packages/client/dist/migrations/state-json.js +344 -4
- package/packages/client/dist/policy/architecture-policy.js +184 -2
- package/packages/client/dist/policy/index.js +7 -1
- package/packages/client/dist/policy/shared-policy-types.js +38 -0
- package/packages/client/dist/policy/subagent-approval-policy.js +55 -1
- package/packages/client/dist/private-execution/clean-baseline.js +279 -2
- package/packages/client/dist/private-execution/codex-executor.js +574 -4
- package/packages/client/dist/private-execution/codex-host-runtime.js +137 -1
- package/packages/client/dist/private-execution/codex-lifecycle-guard.js +97 -1
- package/packages/client/dist/private-execution/codex-scoped-permissions.js +128 -1
- package/packages/client/dist/private-execution/delivery.js +410 -13
- package/packages/client/dist/private-execution/diagnosis-root-review.js +294 -2
- package/packages/client/dist/private-execution/frozen-handoff.js +19 -6
- package/packages/client/dist/private-execution/implementation-validation.js +106 -2
- package/packages/client/dist/private-execution/isolated-admission.js +1432 -23
- package/packages/client/dist/private-execution/isolated-session.js +725 -5
- package/packages/client/dist/private-execution/isolated-workspace.js +122 -1
- package/packages/client/dist/private-execution/pact-consumer-runtime.js +409 -3
- package/packages/client/dist/private-execution/pact-test-source.js +258 -1
- package/packages/client/dist/private-execution/pact-toolchain.js +290 -3
- package/packages/client/dist/private-execution/pact-write-set.js +172 -1
- package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +406 -5
- package/packages/client/dist/private-execution/planning-generation-checkpoint.js +462 -5
- package/packages/client/dist/private-execution/planning-memory-checkpoint.js +139 -3
- package/packages/client/dist/private-execution/planning-research-checkpoint.js +325 -4
- package/packages/client/dist/private-execution/private-report-store.js +42 -1
- package/packages/client/dist/private-execution/property-test-candidate.js +103 -1
- package/packages/client/dist/private-execution/property-test-choices.js +147 -3
- package/packages/client/dist/private-execution/property-test-plan.js +271 -7
- package/packages/client/dist/private-execution/property-test-review.js +258 -4
- package/packages/client/dist/private-execution/property-test-runtime.js +372 -9
- package/packages/client/dist/private-execution/property-test-source.js +139 -1
- package/packages/client/dist/private-execution/root-checkpoint.js +80 -1
- package/packages/client/dist/private-execution/root-memory-git-evidence.js +135 -3
- package/packages/client/dist/private-execution/root-memory-recovery.js +93 -1
- package/packages/client/dist/private-execution/root-memory-request.js +29 -1
- package/packages/client/dist/private-execution/root-memory-scope.js +178 -1
- package/packages/client/dist/private-execution/root-memory-writer.js +102 -1
- package/packages/client/dist/private-execution/session-lease.js +63 -1
- package/packages/client/dist/private-execution/shared-private-admission-types.js +50 -1
- package/packages/client/dist/private-execution/shared-project-validation.js +66 -1
- package/packages/client/dist/private-execution/shared-root-memory-types.js +61 -1
- package/packages/client/dist/private-execution/ux-source-validation.js +372 -1
- package/packages/client/dist/private-execution/ux-write-set.js +191 -2
- package/packages/client/dist/resilience/circuit-breaker.js +170 -1
- package/packages/client/dist/resilience/degradation-manager.js +164 -1
- package/packages/client/dist/resilience/freshness-indicator.js +100 -1
- package/packages/client/dist/resilience/index.js +8 -1
- package/packages/client/dist/resilience/recovery-detector.js +74 -1
- package/packages/client/dist/resolvers/asset-resolver.js +13 -0
- package/packages/client/dist/resolvers/local-resolver.js +255 -8
- package/packages/client/dist/resolvers/remote-resolver.js +233 -1
- package/packages/client/dist/runner/binary.js +404 -1
- package/packages/client/dist/runner/cli.js +1571 -17
- package/packages/client/dist/runner/headless/adapters.js +49 -1
- package/packages/client/dist/runner/headless/claude-code-adapter.js +79 -1
- package/packages/client/dist/runner/headless/continuous-story-workspace.js +1628 -11
- package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +69 -1
- package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +110 -2
- package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +1236 -8
- package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +318 -2
- package/packages/client/dist/runner/headless/fake-adapter.js +62 -1
- package/packages/client/dist/runner/headless/managed-profile.js +132 -1
- package/packages/client/dist/runner/headless/opencode-adapter.js +145 -2
- package/packages/client/dist/runner/headless/prepared-story-bundle.js +43 -1
- package/packages/client/dist/runner/headless/resolver.js +231 -1
- package/packages/client/dist/runner/headless/run-yolo.js +885 -1
- package/packages/client/dist/runner/headless/run-yoloop.d.ts +4 -1
- package/packages/client/dist/runner/headless/run-yoloop.js +2574 -2
- package/packages/client/dist/runner/headless/types.js +574 -2
- package/packages/client/dist/runner/local-console.js +396 -13
- package/packages/client/dist/runner/portal-sync-worker.js +1487 -1
- package/packages/client/dist/runner/project-identity.js +106 -1
- package/packages/client/dist/runner/scheduler.js +995 -7
- package/packages/client/dist/runner-cli.js +18 -2
- package/packages/client/dist/state/invocation-shape.js +13 -1
- package/packages/client/dist/state/project-state-snapshot.js +1677 -1
- package/packages/client/dist/state/state-json-repair.js +785 -3
- package/packages/client/dist/state/structural-dag-projection.js +118 -1
- package/packages/client/dist/telemetry/index.js +5 -1
- package/packages/client/dist/telemetry/offline-queue.js +131 -1
- package/packages/client/dist/tier/index.js +5 -1
- package/packages/client/dist/tier/tier-aware-client.js +405 -1
- package/packages/client/dist/types/index.js +38 -1
- package/packages/client/dist/version.js +27 -1
- package/packages/client/dist/yolo/change-evidence-collector.js +126 -1
- package/packages/client/dist/yolo/invoke-envelope-capability.js +62 -1
- package/packages/client/dist/yolo/spec-envelope-collector.js +185 -5
- package/packages/client/dist/yoloop/discovery-hook.js +300 -2
- package/packages/client/dist/yoloop/index.js +8 -1
- package/packages/client/dist/yoloop/invoke-hooks.js +669 -12
- package/packages/client/dist/yoloop/shared-discover-epics.js +1007 -1
- package/packages/client/dist/yoloop/shared-yoloop-types.js +33 -1
- package/packages/client/dist/yoloop/target-normalization.js +180 -1
- package/packages/client/dist/yoloop/yoloop-client-state-store.js +1723 -1
- package/packages/shared/dist/compatibility/index.js +476 -0
- package/packages/shared/dist/yoloop/release-blocked.js +653 -0
- package/targets-stubs/antigravity/gemini.md +1 -1
- package/targets-stubs/antigravity/skill/SKILL.md +3 -2
- package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex-root.md +5 -5
- package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex.md +8 -9
- package/targets-stubs/codex/AGENTS.md +3 -3
- package/targets-stubs/cursor/agent.md +4 -3
- package/targets-stubs/gemini-cli/agent.md +5 -4
- package/targets-stubs/opencode/neocortex-root.md +3 -3
- package/targets-stubs/vscode/neocortex.agent.md +5 -4
|
@@ -1,2 +1,136 @@
|
|
|
1
|
-
import{isNativeDispatchBindingV1
|
|
2
|
-
|
|
1
|
+
import { isNativeDispatchBindingV1, isNativeHostAttestationV1, } from '../continuity/native-agent-types.js';
|
|
2
|
+
import { deriveOpaqueNativeAgentHandle, openNativeAgentPrivateStore, } from '../continuity/native-agent-store.js';
|
|
3
|
+
const MAX_STDIN_BYTES = 64 * 1024;
|
|
4
|
+
const STATES = new Set(['requested', 'spawned', 'running', 'completed', 'failed', 'interrupted', 'unknown', 'lost']);
|
|
5
|
+
const TOPOLOGIES = new Set(['native-agent', 'headless-process', 'inline']);
|
|
6
|
+
const FRESHNESS = new Set(['fresh', 'stale', 'unknown']);
|
|
7
|
+
const SOURCES = new Set(['host-event', 'host-list', 'bounded-poll', 'local-reservation']);
|
|
8
|
+
function parseFlag(args, name) {
|
|
9
|
+
const index = args.indexOf(name);
|
|
10
|
+
return index >= 0 ? args[index + 1] : undefined;
|
|
11
|
+
}
|
|
12
|
+
function exactKeys(value, required, optional = []) {
|
|
13
|
+
const allowed = new Set([...required, ...optional]);
|
|
14
|
+
return required.every((key) => Object.prototype.hasOwnProperty.call(value, key))
|
|
15
|
+
&& Object.keys(value).every((key) => allowed.has(key));
|
|
16
|
+
}
|
|
17
|
+
async function readBoundedJsonStdin() {
|
|
18
|
+
const chunks = [];
|
|
19
|
+
let total = 0;
|
|
20
|
+
for await (const chunk of process.stdin) {
|
|
21
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk));
|
|
22
|
+
total += buffer.length;
|
|
23
|
+
if (total > MAX_STDIN_BYTES)
|
|
24
|
+
throw new Error('native-agent-input-too-large');
|
|
25
|
+
chunks.push(buffer);
|
|
26
|
+
}
|
|
27
|
+
const parsed = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
28
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
29
|
+
throw new Error('native-agent-input-invalid');
|
|
30
|
+
return parsed;
|
|
31
|
+
}
|
|
32
|
+
function output(value) {
|
|
33
|
+
process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
34
|
+
}
|
|
35
|
+
function safeError(error) {
|
|
36
|
+
if (error && typeof error === 'object' && 'code' in error && typeof error.code === 'string')
|
|
37
|
+
return error.code;
|
|
38
|
+
if (error instanceof SyntaxError)
|
|
39
|
+
return 'native-agent-input-invalid';
|
|
40
|
+
if (error instanceof Error && /^native-agent-[a-z0-9-]+$/.test(error.message))
|
|
41
|
+
return error.message;
|
|
42
|
+
return 'native-agent-operation-failed';
|
|
43
|
+
}
|
|
44
|
+
export async function nativeAgentCliHandler(args) {
|
|
45
|
+
const action = args[0];
|
|
46
|
+
const projectRoot = parseFlag(args, '--project-root') ?? process.cwd();
|
|
47
|
+
let opened;
|
|
48
|
+
try {
|
|
49
|
+
if (action !== 'reserve' && action !== 'observe' && action !== 'status') {
|
|
50
|
+
output({ ok: false, reasonCode: 'native-agent-action-invalid', publicSafe: true });
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
opened = await openNativeAgentPrivateStore(projectRoot);
|
|
54
|
+
if (action === 'reserve') {
|
|
55
|
+
const input = await readBoundedJsonStdin();
|
|
56
|
+
if (!exactKeys(input, [
|
|
57
|
+
'directiveKind', 'supportsTaskDelegation', 'taskDelegationCapability', 'binding', 'hostAttestation',
|
|
58
|
+
], ['requestedAt', 'topology']))
|
|
59
|
+
throw new Error('native-agent-input-invalid');
|
|
60
|
+
if (input.directiveKind !== 'task'
|
|
61
|
+
|| input.supportsTaskDelegation !== true
|
|
62
|
+
|| input.taskDelegationCapability !== 'native_safe'
|
|
63
|
+
|| !isNativeDispatchBindingV1(input.binding)
|
|
64
|
+
|| !isNativeHostAttestationV1(input.hostAttestation)) {
|
|
65
|
+
throw new Error('native-agent-dispatch-not-authorized');
|
|
66
|
+
}
|
|
67
|
+
const topology = (input.topology ?? 'native-agent');
|
|
68
|
+
if (!TOPOLOGIES.has(topology))
|
|
69
|
+
throw new Error('native-agent-input-invalid');
|
|
70
|
+
const result = opened.store.reserveNativeAgentDispatch({
|
|
71
|
+
binding: input.binding,
|
|
72
|
+
hostAttestation: input.hostAttestation,
|
|
73
|
+
requestedAt: typeof input.requestedAt === 'string' ? input.requestedAt : new Date().toISOString(),
|
|
74
|
+
topology,
|
|
75
|
+
});
|
|
76
|
+
output({
|
|
77
|
+
ok: true,
|
|
78
|
+
authorized: true,
|
|
79
|
+
action: result.reserved ? 'spawn-once' : 'reconcile-existing',
|
|
80
|
+
...result,
|
|
81
|
+
publicSafe: true,
|
|
82
|
+
});
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
if (action === 'observe') {
|
|
86
|
+
const input = await readBoundedJsonStdin();
|
|
87
|
+
if (!exactKeys(input, [
|
|
88
|
+
'dispatchKey', 'expectedRevision', 'state', 'topology', 'observedAt',
|
|
89
|
+
'freshness', 'observationSource', 'reasonCode',
|
|
90
|
+
], ['rawHandle', 'rawParentHandle', 'terminalAt']))
|
|
91
|
+
throw new Error('native-agent-input-invalid');
|
|
92
|
+
const state = input.state;
|
|
93
|
+
const topology = input.topology;
|
|
94
|
+
const freshness = input.freshness;
|
|
95
|
+
const observationSource = input.observationSource;
|
|
96
|
+
if (!STATES.has(state) || !TOPOLOGIES.has(topology) || !FRESHNESS.has(freshness) || !SOURCES.has(observationSource)) {
|
|
97
|
+
throw new Error('native-agent-input-invalid');
|
|
98
|
+
}
|
|
99
|
+
const rawHandle = typeof input.rawHandle === 'string' ? input.rawHandle : null;
|
|
100
|
+
const rawParentHandle = typeof input.rawParentHandle === 'string' ? input.rawParentHandle : null;
|
|
101
|
+
const result = opened.store.observeNativeAgentDispatch({
|
|
102
|
+
dispatchKey: String(input.dispatchKey),
|
|
103
|
+
expectedRevision: Number(input.expectedRevision),
|
|
104
|
+
state,
|
|
105
|
+
handle: rawHandle ? deriveOpaqueNativeAgentHandle(rawHandle, opened.paths.handleKeyPath) : null,
|
|
106
|
+
parentHandle: rawParentHandle ? deriveOpaqueNativeAgentHandle(rawParentHandle, opened.paths.handleKeyPath) : null,
|
|
107
|
+
topology,
|
|
108
|
+
observedAt: String(input.observedAt),
|
|
109
|
+
terminalAt: input.terminalAt === null || typeof input.terminalAt === 'string' ? input.terminalAt : undefined,
|
|
110
|
+
freshness,
|
|
111
|
+
observationSource,
|
|
112
|
+
reasonCode: String(input.reasonCode),
|
|
113
|
+
});
|
|
114
|
+
output({ ok: true, ...result, publicSafe: true });
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
const dispatchKey = parseFlag(args, '--dispatch-key');
|
|
118
|
+
const staleAfterMs = Number(parseFlag(args, '--stale-after-ms') ?? 30_000);
|
|
119
|
+
if (dispatchKey) {
|
|
120
|
+
const receipt = opened.store.getNativeAgentDispatchStatus(dispatchKey, { staleAfterMs });
|
|
121
|
+
output({ ok: true, receipt, publicSafe: true });
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
const receipts = opened.store.listRecentNativeAgentDispatches(Number(parseFlag(args, '--limit') ?? 20));
|
|
125
|
+
output({ ok: true, receipts, publicSafe: true });
|
|
126
|
+
}
|
|
127
|
+
return 0;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
output({ ok: false, reasonCode: safeError(error), publicSafe: true });
|
|
131
|
+
return 1;
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
opened?.store.close();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -1 +1,43 @@
|
|
|
1
|
-
import{sealPlanningDiagnosis
|
|
1
|
+
import { sealPlanningDiagnosis } from '../private-execution/planning-diagnosis-checkpoint.js';
|
|
2
|
+
const MAX_REVIEW_BYTES = 64 * 1024;
|
|
3
|
+
async function readBoundedReview(input) {
|
|
4
|
+
const chunks = [];
|
|
5
|
+
let size = 0;
|
|
6
|
+
for await (const chunk of input) {
|
|
7
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
8
|
+
size += bytes.length;
|
|
9
|
+
if (size > MAX_REVIEW_BYTES)
|
|
10
|
+
throw new Error('planning-diagnosis-review-too-large');
|
|
11
|
+
chunks.push(bytes);
|
|
12
|
+
}
|
|
13
|
+
if (size === 0)
|
|
14
|
+
throw new Error('planning-diagnosis-review-missing');
|
|
15
|
+
return JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
16
|
+
}
|
|
17
|
+
/** The root supplies reviewed structured evidence through stdin; no agent output is auto-accepted. */
|
|
18
|
+
export async function planningDiagnosisCliHandler(args) {
|
|
19
|
+
return planningDiagnosisCliHandlerWithIO(args, process.stdin, console);
|
|
20
|
+
}
|
|
21
|
+
/** Injectable IO keeps success and redacted-error output verifiable in tests. */
|
|
22
|
+
export async function planningDiagnosisCliHandlerWithIO(args, input, output) {
|
|
23
|
+
if (args[0] !== 'seal' || args.length !== 1 && args.length !== 3
|
|
24
|
+
|| args.length === 3 && args[1] !== '--project-root') {
|
|
25
|
+
output.error('usage: planning-diagnosis seal [--project-root <path>] < review.json');
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const review = await readBoundedReview(input);
|
|
30
|
+
const receipt = sealPlanningDiagnosis(args.length === 3 ? args[2] : process.cwd(), review);
|
|
31
|
+
output.log(JSON.stringify({ ok: true, epicId: receipt.epicId,
|
|
32
|
+
diagnosisReceiptId: receipt.diagnosisReceiptId,
|
|
33
|
+
qaEvidenceId: receipt.qaEvidenceId, publicSafe: true }));
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const message = error instanceof Error ? error.message : '';
|
|
38
|
+
const reasonCode = /^planning-diagnosis-[a-z-]+$/.test(message)
|
|
39
|
+
? message : 'planning-diagnosis-seal-failed';
|
|
40
|
+
output.error(JSON.stringify({ ok: false, reasonCode, publicSafe: true }));
|
|
41
|
+
return 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1 +1,53 @@
|
|
|
1
|
-
import{sealPlanningGeneration
|
|
1
|
+
import { sealPlanningGeneration, verifyCommittedPlanningGeneration } from '../private-execution/planning-generation-checkpoint.js';
|
|
2
|
+
const MAX_REVIEW_BYTES = 64 * 1024;
|
|
3
|
+
async function readBoundedReview(input) {
|
|
4
|
+
const chunks = [];
|
|
5
|
+
let size = 0;
|
|
6
|
+
for await (const chunk of input) {
|
|
7
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
8
|
+
size += bytes.length;
|
|
9
|
+
if (size > MAX_REVIEW_BYTES)
|
|
10
|
+
throw new Error('planning-generation-review-too-large');
|
|
11
|
+
chunks.push(bytes);
|
|
12
|
+
}
|
|
13
|
+
if (size === 0)
|
|
14
|
+
throw new Error('planning-generation-review-missing');
|
|
15
|
+
return JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
16
|
+
}
|
|
17
|
+
export async function planningGenerationCliHandler(args) {
|
|
18
|
+
return planningGenerationCliHandlerWithIO(args, process.stdin, console);
|
|
19
|
+
}
|
|
20
|
+
export async function planningGenerationCliHandlerWithIO(args, input, output) {
|
|
21
|
+
if (args[0] !== 'seal' && args[0] !== 'verify' || args.length !== 1 && args.length !== 3
|
|
22
|
+
|| args.length === 3 && args[1] !== '--project-root') {
|
|
23
|
+
output.error('usage: planning-generation <seal|verify> [--project-root <path>] < input.json');
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const review = await readBoundedReview(input);
|
|
28
|
+
const root = args.length === 3 ? args[2] : process.cwd();
|
|
29
|
+
let receipt;
|
|
30
|
+
if (args[0] === 'verify') {
|
|
31
|
+
if (!review || typeof review !== 'object' || Array.isArray(review)
|
|
32
|
+
|| Object.keys(review).sort().join('|') !== 'claimId|epicId|schemaVersion'
|
|
33
|
+
|| review.schemaVersion !== 'PlanningGenerationVerification/1'
|
|
34
|
+
|| typeof review.claimId !== 'string'
|
|
35
|
+
|| typeof review.epicId !== 'string') {
|
|
36
|
+
throw new Error('planning-generation-verification-input-invalid');
|
|
37
|
+
}
|
|
38
|
+
const identity = review;
|
|
39
|
+
receipt = verifyCommittedPlanningGeneration(root, identity.claimId, identity.epicId);
|
|
40
|
+
}
|
|
41
|
+
else
|
|
42
|
+
receipt = sealPlanningGeneration(root, review);
|
|
43
|
+
output.log(JSON.stringify({ ok: true, ...receipt, publicSafe: true }));
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
const message = error instanceof Error ? error.message : '';
|
|
48
|
+
const reasonCode = /^planning-generation-[a-z-]+$/.test(message)
|
|
49
|
+
? message : args[0] === 'verify' ? 'planning-generation-verification-failed' : 'planning-generation-seal-failed';
|
|
50
|
+
output.error(JSON.stringify({ ok: false, reasonCode, publicSafe: true }));
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -1 +1,40 @@
|
|
|
1
|
-
import{sealPlanningMemory
|
|
1
|
+
import { sealPlanningMemory, verifyCommittedPlanningMemory } from '../private-execution/planning-memory-checkpoint.js';
|
|
2
|
+
export async function planningMemoryCliHandler(args) {
|
|
3
|
+
if (!['seal', 'verify'].includes(args[0] ?? '') || args.length !== 1 && args.length !== 3
|
|
4
|
+
|| args.length === 3 && args[1] !== '--project-root') {
|
|
5
|
+
console.error('usage: planning-memory <seal|verify> [--project-root <path>] < input.json');
|
|
6
|
+
return 1;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
const buffers = [];
|
|
10
|
+
let size = 0;
|
|
11
|
+
for await (const chunk of process.stdin) {
|
|
12
|
+
const bytes = Buffer.from(chunk);
|
|
13
|
+
size += bytes.length;
|
|
14
|
+
if (size > 16384)
|
|
15
|
+
throw new Error('planning-memory-input-too-large');
|
|
16
|
+
buffers.push(bytes);
|
|
17
|
+
}
|
|
18
|
+
const input = JSON.parse(Buffer.concat(buffers).toString('utf8'));
|
|
19
|
+
const root = args.length === 3 ? args[2] : process.cwd();
|
|
20
|
+
let receipt;
|
|
21
|
+
if (args[0] === 'verify') {
|
|
22
|
+
if (!input || typeof input !== 'object' || Array.isArray(input)
|
|
23
|
+
|| Object.keys(input).sort().join('|') !== 'claimId|epicId|schemaVersion'
|
|
24
|
+
|| input.schemaVersion !== 'PlanningMemoryVerification/1'
|
|
25
|
+
|| typeof input.claimId !== 'string'
|
|
26
|
+
|| typeof input.epicId !== 'string')
|
|
27
|
+
throw new Error('planning-memory-input-invalid');
|
|
28
|
+
const identity = input;
|
|
29
|
+
receipt = verifyCommittedPlanningMemory(root, identity.claimId, identity.epicId);
|
|
30
|
+
}
|
|
31
|
+
else
|
|
32
|
+
receipt = sealPlanningMemory(root, input);
|
|
33
|
+
console.log(JSON.stringify({ ok: true, receipt, publicSafe: true }));
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
console.error(JSON.stringify({ ok: false, reasonCode: 'planning-memory-evidence-unverified', publicSafe: true }));
|
|
38
|
+
return 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1 +1,42 @@
|
|
|
1
|
-
import{sealPlanningResearch
|
|
1
|
+
import { sealPlanningResearch } from '../private-execution/planning-research-checkpoint.js';
|
|
2
|
+
const MAX_REVIEW_BYTES = 64 * 1024;
|
|
3
|
+
async function readBoundedReview(input) {
|
|
4
|
+
const chunks = [];
|
|
5
|
+
let size = 0;
|
|
6
|
+
for await (const chunk of input) {
|
|
7
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
8
|
+
size += bytes.length;
|
|
9
|
+
if (size > MAX_REVIEW_BYTES)
|
|
10
|
+
throw new Error('planning-research-review-too-large');
|
|
11
|
+
chunks.push(bytes);
|
|
12
|
+
}
|
|
13
|
+
if (size === 0)
|
|
14
|
+
throw new Error('planning-research-review-missing');
|
|
15
|
+
return JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
16
|
+
}
|
|
17
|
+
/** The root supplies reviewed P02 evidence through stdin; no agent output is auto-accepted. */
|
|
18
|
+
export async function planningResearchCliHandler(args) {
|
|
19
|
+
return planningResearchCliHandlerWithIO(args, process.stdin, console);
|
|
20
|
+
}
|
|
21
|
+
export async function planningResearchCliHandlerWithIO(args, input, output) {
|
|
22
|
+
if (args[0] !== 'seal' || args.length !== 1 && args.length !== 3
|
|
23
|
+
|| args.length === 3 && args[1] !== '--project-root') {
|
|
24
|
+
output.error('usage: planning-research seal [--project-root <path>] < review.json');
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const review = await readBoundedReview(input);
|
|
29
|
+
const receipt = sealPlanningResearch(args.length === 3 ? args[2] : process.cwd(), review);
|
|
30
|
+
output.log(JSON.stringify({ ok: true, epicId: receipt.epicId,
|
|
31
|
+
researchReceiptId: receipt.researchReceiptId,
|
|
32
|
+
qaEvidenceId: receipt.qaEvidenceId, publicSafe: true }));
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const message = error instanceof Error ? error.message : '';
|
|
37
|
+
const reasonCode = /^planning-research-[a-z-]+$/.test(message)
|
|
38
|
+
? message : 'planning-research-seal-failed';
|
|
39
|
+
output.error(JSON.stringify({ ok: false, reasonCode, publicSafe: true }));
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1 +1,75 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { validatePrivateYoloImplementation } from '../private-execution/implementation-validation.js';
|
|
2
|
+
import { renewPrivateYoloSessionLease } from '../private-execution/session-lease.js';
|
|
3
|
+
import { acceptPrivateYoloDiagnosisRootReview, acceptPrivateYoloResearchRootReview, acceptPrivateYoloSpecificationRootReview, acceptPrivateYoloTasksRootReview, acceptPrivateYoloImplementationRootReview, acceptPrivateYoloRefactorAdvisoryRootReview, acceptPrivateYoloTestValidationRootReview, acceptPrivateYoloQaRootReview } from '../private-execution/diagnosis-root-review.js';
|
|
4
|
+
const reviewers = {
|
|
5
|
+
'accept-project-memory': acceptPrivateYoloProjectMemoryRootReview,
|
|
6
|
+
'accept-qa': acceptPrivateYoloQaRootReview,
|
|
7
|
+
'accept-test-validation': acceptPrivateYoloTestValidationRootReview,
|
|
8
|
+
'accept-refactor-advisory': acceptPrivateYoloRefactorAdvisoryRootReview,
|
|
9
|
+
'validate-implementation': validatePrivateYoloImplementation,
|
|
10
|
+
'accept-implementation': acceptPrivateYoloImplementationRootReview,
|
|
11
|
+
'accept-diagnosis': acceptPrivateYoloDiagnosisRootReview,
|
|
12
|
+
'accept-research': acceptPrivateYoloResearchRootReview,
|
|
13
|
+
'accept-specification': acceptPrivateYoloSpecificationRootReview,
|
|
14
|
+
'accept-tasks': acceptPrivateYoloTasksRootReview,
|
|
15
|
+
};
|
|
16
|
+
import { acceptPrivateYoloProjectMemoryRootReview, discardPrivateYoloRejectedCandidate, inspectPrivateYoloRejectedCandidate } from '../private-execution/isolated-session.js';
|
|
17
|
+
export async function privateSessionCliHandler(args) {
|
|
18
|
+
if (!['inspect-rejected', 'discard-rejected', 'renew-lease', ...Object.keys(reviewers)].includes(args[0] ?? '')
|
|
19
|
+
|| args.length !== 1 && args.length !== 3 || args.length === 3 && args[1] !== '--project-root') {
|
|
20
|
+
console.error('usage: private-session <inspect-rejected|discard-rejected|renew-lease|accept-diagnosis|accept-research|accept-specification|accept-tasks|validate-implementation|accept-implementation|accept-refactor-advisory|accept-test-validation|accept-qa|accept-project-memory> [--project-root <path>] < root-request.json');
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const chunks = [];
|
|
25
|
+
let size = 0;
|
|
26
|
+
for await (const chunk of process.stdin) {
|
|
27
|
+
const bytes = Buffer.from(chunk);
|
|
28
|
+
size += bytes.length;
|
|
29
|
+
if (size > 16384)
|
|
30
|
+
throw new Error('input-too-large');
|
|
31
|
+
chunks.push(bytes);
|
|
32
|
+
}
|
|
33
|
+
const input = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
34
|
+
if (Object.hasOwn(reviewers, args[0])) {
|
|
35
|
+
const accept = reviewers[args[0]];
|
|
36
|
+
const result = await accept(args.length === 3 ? args[2] : process.cwd(), input);
|
|
37
|
+
console.log(JSON.stringify({ ok: true, result, publicSafe: true }));
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
if (!input || typeof input !== 'object' || Array.isArray(input))
|
|
41
|
+
throw new Error('input-invalid');
|
|
42
|
+
const r = input, discard = args[0] === 'discard-rejected', renew = args[0] === 'renew-lease';
|
|
43
|
+
const keys = ['schemaVersion', 'storyId', 'graphRevision', 'executorStopped',
|
|
44
|
+
...(discard ? ['expectedCandidateDigest', 'authorizeDiscard'] : []),
|
|
45
|
+
...(renew ? ['expectedSnapshotSha', 'expiresAt'] : [])];
|
|
46
|
+
if (Object.keys(r).sort().join('|') !== keys.sort().join('|')
|
|
47
|
+
|| r.schemaVersion !== (renew ? 'PrivateYoloSessionLeaseRequest/1' : 'PrivateYoloRejectedCandidateRequest/1')
|
|
48
|
+
|| typeof r.storyId !== 'string' || typeof r.graphRevision !== 'string'
|
|
49
|
+
|| !/^[a-f0-9]{64}$/.test(r.graphRevision) || r.executorStopped !== true
|
|
50
|
+
|| discard && (r.authorizeDiscard !== true || typeof r.expectedCandidateDigest !== 'string')
|
|
51
|
+
|| renew && (typeof r.expectedSnapshotSha !== 'string' || typeof r.expiresAt !== 'string'))
|
|
52
|
+
throw new Error('input-invalid');
|
|
53
|
+
const root = args.length === 3 ? args[2] : process.cwd();
|
|
54
|
+
const result = renew ? await renewPrivateYoloSessionLease(root, r.storyId, r.graphRevision, { executorStopped: true, expectedSnapshotSha: r.expectedSnapshotSha, expiresAt: r.expiresAt })
|
|
55
|
+
: discard ? await discardPrivateYoloRejectedCandidate(root, r.storyId, r.graphRevision, { expectedCandidateDigest: r.expectedCandidateDigest, executorStopped: true, authorizeDiscard: true })
|
|
56
|
+
: await inspectPrivateYoloRejectedCandidate(root, r.storyId, r.graphRevision, true);
|
|
57
|
+
console.log(JSON.stringify({ ok: true, result, publicSafe: true }));
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
const reasonCode = args[0] === 'accept-project-memory' ? 'private-root-memory-acceptance-unverified'
|
|
62
|
+
: args[0] === 'accept-qa' ? 'private-execution-qa-root-review-unverified'
|
|
63
|
+
: args[0] === 'accept-test-validation' ? 'private-execution-test-validation-root-review-unverified'
|
|
64
|
+
: args[0] === 'accept-refactor-advisory' ? 'private-execution-refactor-advisory-root-review-unverified'
|
|
65
|
+
: args[0] === 'validate-implementation' ? 'private-execution-implementation-validation-unverified'
|
|
66
|
+
: args[0] === 'accept-implementation' ? 'private-execution-implementation-root-review-unverified'
|
|
67
|
+
: args[0] === 'accept-diagnosis' ? 'private-execution-diagnosis-root-review-unverified'
|
|
68
|
+
: args[0] === 'accept-research' ? 'private-execution-research-root-review-unverified'
|
|
69
|
+
: args[0] === 'accept-specification' ? 'private-execution-specification-root-review-unverified'
|
|
70
|
+
: args[0] === 'accept-tasks' ? 'private-execution-tasks-root-review-unverified'
|
|
71
|
+
: args[0] === 'renew-lease' ? 'private-execution-session-renewal-unverified' : 'private-execution-rejected-candidate-unverified';
|
|
72
|
+
console.error(JSON.stringify({ ok: false, reasonCode, publicSafe: true }));
|
|
73
|
+
return 1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1 +1,139 @@
|
|
|
1
|
-
|
|
1
|
+
/** Local-only operator preflight for protected property-test. */
|
|
2
|
+
import { inspectPropertyTestCatalog, confirmPropertyTestPlan } from '../private-execution/property-test-plan.js';
|
|
3
|
+
import { savePropertyTestChoices } from '../private-execution/property-test-choices.js';
|
|
4
|
+
export async function propertyQaCliHandler(args) {
|
|
5
|
+
const action = args[0];
|
|
6
|
+
let projectRoot = process.cwd();
|
|
7
|
+
let format = 'plain';
|
|
8
|
+
let authorizeRun = false;
|
|
9
|
+
let authorizeReview = false;
|
|
10
|
+
const seen = new Set();
|
|
11
|
+
for (let index = 1; index < args.length; index++) {
|
|
12
|
+
const token = args[index];
|
|
13
|
+
if (seen.has(token)) {
|
|
14
|
+
console.error('property-test-invalid-cli-argument');
|
|
15
|
+
return 1;
|
|
16
|
+
}
|
|
17
|
+
seen.add(token);
|
|
18
|
+
if (token === '--project-root' && args[index + 1])
|
|
19
|
+
projectRoot = args[++index];
|
|
20
|
+
else if (token === '--format' && (args[index + 1] === 'plain' || args[index + 1] === 'json')) {
|
|
21
|
+
format = args[++index];
|
|
22
|
+
}
|
|
23
|
+
else if (token === '--authorize-run') {
|
|
24
|
+
authorizeRun = true;
|
|
25
|
+
}
|
|
26
|
+
else if (token === '--authorize-review') {
|
|
27
|
+
authorizeReview = true;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.error('property-test-invalid-cli-argument');
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (action !== 'inspect' && action !== 'confirm' && action !== 'save'
|
|
35
|
+
&& action !== 'candidate' && action !== 'verify' && action !== 'review-plan'
|
|
36
|
+
&& action !== 'review-accept' && action !== 'review-status') {
|
|
37
|
+
console.error('Usage: neocortex-client property-qa inspect|confirm|save|candidate|verify|review-plan|review-accept|review-status --project-root <path> --format json|plain');
|
|
38
|
+
return 1;
|
|
39
|
+
}
|
|
40
|
+
if (authorizeRun !== (action === 'verify') || authorizeReview !== (action === 'review-accept')) {
|
|
41
|
+
console.error(action === 'review-accept' || authorizeReview
|
|
42
|
+
? 'property-test-review-authorization-required' : 'property-test-run-authorization-required');
|
|
43
|
+
return 1;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
if (action === 'inspect') {
|
|
47
|
+
const result = inspectPropertyTestCatalog(projectRoot);
|
|
48
|
+
if (format === 'json')
|
|
49
|
+
console.log(JSON.stringify(result));
|
|
50
|
+
else {
|
|
51
|
+
console.log(`PRD: ${result.prdPath} (${result.prdSha256})`);
|
|
52
|
+
for (const item of result.aggregates) {
|
|
53
|
+
console.log(`${item.name}: ${item.invariantCount} invariants; candidates: ${item.suggestedFiles.join(', ') || '(none)'}`);
|
|
54
|
+
}
|
|
55
|
+
console.log('Explicit mapping, language and numRuns are required for confirm. No tests were written.');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (action === 'verify') {
|
|
59
|
+
const { verifyPropertyTestRuntime } = await import('../private-execution/property-test-runtime.js');
|
|
60
|
+
const result = verifyPropertyTestRuntime(projectRoot);
|
|
61
|
+
if (format === 'json')
|
|
62
|
+
console.log(JSON.stringify(result));
|
|
63
|
+
else
|
|
64
|
+
console.log(`property-test runtime ${result.outcome}: ${result.reasonCode}; QA not accepted`);
|
|
65
|
+
return result.executionVerified ? 0 : 1;
|
|
66
|
+
}
|
|
67
|
+
else if (action === 'review-plan') {
|
|
68
|
+
const { inspectPropertyTestReviewPlan } = await import('../private-execution/property-test-review.js');
|
|
69
|
+
const result = inspectPropertyTestReviewPlan(projectRoot);
|
|
70
|
+
if (format === 'json')
|
|
71
|
+
console.log(JSON.stringify(result));
|
|
72
|
+
else
|
|
73
|
+
console.log(`property-test review plan ${result.candidateSha256}: ${result.invariants.length} invariant hashes; no QA accepted`);
|
|
74
|
+
}
|
|
75
|
+
else if (action === 'review-accept') {
|
|
76
|
+
let input = '';
|
|
77
|
+
for await (const chunk of process.stdin) {
|
|
78
|
+
input += String(chunk);
|
|
79
|
+
if (Buffer.byteLength(input) > 256 * 1024)
|
|
80
|
+
throw new Error('property-test-review-too-large');
|
|
81
|
+
}
|
|
82
|
+
const { parseDocument } = await import('yaml');
|
|
83
|
+
const document = parseDocument(input, { strict: true, uniqueKeys: true,
|
|
84
|
+
schema: 'core', customTags: [] });
|
|
85
|
+
if (document.errors.length || document.warnings.length) {
|
|
86
|
+
throw new Error('property-test-review-unverified');
|
|
87
|
+
}
|
|
88
|
+
const { acceptPropertyTestSemanticReview } = await import('../private-execution/property-test-review.js');
|
|
89
|
+
const result = acceptPropertyTestSemanticReview(projectRoot, JSON.parse(input));
|
|
90
|
+
if (format === 'json')
|
|
91
|
+
console.log(JSON.stringify(result));
|
|
92
|
+
else
|
|
93
|
+
console.log(`property-test review accepted: ${result.invariantCount} invariants, ${result.passedTests} passed and ${result.causalFailedTests} causal failures`);
|
|
94
|
+
}
|
|
95
|
+
else if (action === 'review-status') {
|
|
96
|
+
const { readPropertyTestReviewReceipt } = await import('../private-execution/property-test-review.js');
|
|
97
|
+
const result = readPropertyTestReviewReceipt(projectRoot);
|
|
98
|
+
if (format === 'json')
|
|
99
|
+
console.log(JSON.stringify(result));
|
|
100
|
+
else
|
|
101
|
+
console.log(`property-test review accepted: ${result.invariantCount} invariants at ${result.candidateSha256}`);
|
|
102
|
+
}
|
|
103
|
+
else if (action === 'candidate') {
|
|
104
|
+
const { inspectPropertyTestCandidate } = await import('../private-execution/property-test-candidate.js');
|
|
105
|
+
const result = inspectPropertyTestCandidate(projectRoot);
|
|
106
|
+
if (format === 'json')
|
|
107
|
+
console.log(JSON.stringify(result));
|
|
108
|
+
else
|
|
109
|
+
console.log(`property-test candidate ${result.artifactSha256}: ${result.testFileCount} test files; execution and QA unverified`);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
let input = '';
|
|
113
|
+
for await (const chunk of process.stdin) {
|
|
114
|
+
input += String(chunk);
|
|
115
|
+
if (Buffer.byteLength(input) > 32_768)
|
|
116
|
+
throw new Error('property-test-choices-too-large');
|
|
117
|
+
}
|
|
118
|
+
const choices = JSON.parse(input);
|
|
119
|
+
const result = action === 'save'
|
|
120
|
+
? savePropertyTestChoices(projectRoot, choices)
|
|
121
|
+
: confirmPropertyTestPlan(projectRoot, choices);
|
|
122
|
+
if (format === 'json')
|
|
123
|
+
console.log(JSON.stringify(result));
|
|
124
|
+
else {
|
|
125
|
+
console.log(`property-test plan ${result.planSha256}: ${result.writeSet.join(', ')}`);
|
|
126
|
+
console.log(action === 'save'
|
|
127
|
+
? 'Choices saved in the private Git common-dir; no tests were written and no QA checkpoint was accepted.'
|
|
128
|
+
: 'Read-only preflight: no tests were written and no QA checkpoint was accepted.');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
const message = error instanceof Error && /^property-test-[a-z-]+$/.test(error.message)
|
|
135
|
+
? error.message : 'property-test-preflight-failed';
|
|
136
|
+
console.error(message);
|
|
137
|
+
return 1;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/** Signed mechanical QA control; no stages, paths or verdicts are uploaded. */
|
|
2
|
+
import { requestRootControl, refactorControlCliHandler } from './refactor-control.js';
|
|
3
|
+
export async function requestQaControl(input, fetchFn = fetch) {
|
|
4
|
+
try {
|
|
5
|
+
return await requestRootControl('qa', input, fetchFn);
|
|
6
|
+
}
|
|
7
|
+
catch (error) {
|
|
8
|
+
if (error instanceof Error && /^refactor-root-control-[a-z-]+$/.test(error.message)) {
|
|
9
|
+
throw new Error(error.message.replace(/^refactor-/, 'qa-'));
|
|
10
|
+
}
|
|
11
|
+
throw error;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function qaControlCliHandler(args) {
|
|
15
|
+
return refactorControlCliHandler(args, 'qa');
|
|
16
|
+
}
|