@ornexus/neocortex 4.61.4 → 4.61.6

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.
Files changed (254) hide show
  1. package/dist/release-source.json +1 -1
  2. package/dist/sbom.cdx.json +1193 -1193
  3. package/install.ps1 +1 -1
  4. package/install.sh +1 -1
  5. package/package.json +2 -2
  6. package/packages/client/dist/adapters/adapter-registry.js +1 -108
  7. package/packages/client/dist/adapters/antigravity-adapter.js +2 -77
  8. package/packages/client/dist/adapters/claude-code-adapter.js +3 -79
  9. package/packages/client/dist/adapters/codex-adapter.js +2 -80
  10. package/packages/client/dist/adapters/cursor-adapter.js +4 -115
  11. package/packages/client/dist/adapters/gemini-adapter.js +2 -71
  12. package/packages/client/dist/adapters/grok-adapter.js +2 -42
  13. package/packages/client/dist/adapters/index.js +1 -22
  14. package/packages/client/dist/adapters/platform-detector.js +1 -220
  15. package/packages/client/dist/adapters/target-adapter.js +0 -12
  16. package/packages/client/dist/adapters/vscode-adapter.js +2 -72
  17. package/packages/client/dist/agent/refresh-stubs.js +2 -443
  18. package/packages/client/dist/agent/update-agent-yaml.js +1 -102
  19. package/packages/client/dist/agent/update-description.js +1 -260
  20. package/packages/client/dist/cache/crypto-utils.js +1 -78
  21. package/packages/client/dist/cache/encrypted-cache.js +1 -338
  22. package/packages/client/dist/cache/in-memory-asset-cache.js +1 -73
  23. package/packages/client/dist/cache/index.js +1 -13
  24. package/packages/client/dist/cache/protected-pi-boundary.js +1 -44
  25. package/packages/client/dist/checkpoint/checkpoint-client-reader.js +2 -127
  26. package/packages/client/dist/checkpoint/index.js +1 -11
  27. package/packages/client/dist/checkpoint/shared-checkpoint-types.js +1 -32
  28. package/packages/client/dist/cli.js +5 -364
  29. package/packages/client/dist/commands/activate.js +8 -394
  30. package/packages/client/dist/commands/architecture-answers.js +7 -274
  31. package/packages/client/dist/commands/architecture-memory-terminal.js +4 -253
  32. package/packages/client/dist/commands/architecture-non-ui-continuation.js +1 -100
  33. package/packages/client/dist/commands/architecture-root-binding.js +1 -51
  34. package/packages/client/dist/commands/cache-status.js +2 -112
  35. package/packages/client/dist/commands/config.js +1 -88
  36. package/packages/client/dist/commands/doctor.js +2 -635
  37. package/packages/client/dist/commands/invoke.js +148 -7822
  38. package/packages/client/dist/commands/legacy-epic-terminal.js +1 -71
  39. package/packages/client/dist/commands/legacy-story-branch.js +1 -96
  40. package/packages/client/dist/commands/legacy-story-pr.js +1 -276
  41. package/packages/client/dist/commands/mutation-qa-checkpoint.js +5 -285
  42. package/packages/client/dist/commands/mutation-qa-gate.js +1 -54
  43. package/packages/client/dist/commands/mutation-qa-git.js +1 -41
  44. package/packages/client/dist/commands/mutation-qa-policy.js +1 -102
  45. package/packages/client/dist/commands/mutation-qa-run.js +3 -219
  46. package/packages/client/dist/commands/mutation-qa-verdict.js +1 -149
  47. package/packages/client/dist/commands/mutation-qa.js +1 -220
  48. package/packages/client/dist/commands/native-agent.js +2 -136
  49. package/packages/client/dist/commands/planning-diagnosis.js +1 -43
  50. package/packages/client/dist/commands/planning-generation.js +1 -53
  51. package/packages/client/dist/commands/planning-memory.js +1 -40
  52. package/packages/client/dist/commands/planning-research.js +1 -42
  53. package/packages/client/dist/commands/private-session.js +1 -75
  54. package/packages/client/dist/commands/property-qa.js +1 -139
  55. package/packages/client/dist/commands/qa-control.js +1 -16
  56. package/packages/client/dist/commands/qa-scan-browser-launch.js +1 -55
  57. package/packages/client/dist/commands/qa-scan-browser-route.js +1 -28
  58. package/packages/client/dist/commands/qa-scan-capture.js +5 -663
  59. package/packages/client/dist/commands/qa-scan-discovery.js +3 -376
  60. package/packages/client/dist/commands/qa-scan-review.js +5 -826
  61. package/packages/client/dist/commands/qa-synthetic-backend-capture.js +1 -266
  62. package/packages/client/dist/commands/qa-synthetic-backend-review.js +1 -297
  63. package/packages/client/dist/commands/qa-synthetic-backend.js +2 -340
  64. package/packages/client/dist/commands/qa-synthetic-broker-port.js +1 -85
  65. package/packages/client/dist/commands/qa-synthetic-browser.js +1 -39
  66. package/packages/client/dist/commands/refactor-characterization.js +21 -671
  67. package/packages/client/dist/commands/refactor-commit.js +13 -399
  68. package/packages/client/dist/commands/refactor-control.js +3 -142
  69. package/packages/client/dist/commands/refactor-cpp-assertions.js +3 -93
  70. package/packages/client/dist/commands/refactor-review.js +5 -283
  71. package/packages/client/dist/commands/refactor-root.js +7 -588
  72. package/packages/client/dist/commands/refresh-memory.js +3 -174
  73. package/packages/client/dist/commands/shared-architecture-non-ui.js +1 -24
  74. package/packages/client/dist/commands/story-checkpoint.d.ts +5 -1
  75. package/packages/client/dist/commands/story-checkpoint.js +1 -203
  76. package/packages/client/dist/commands/story-worktree.js +5 -258
  77. package/packages/client/dist/config/host-auth-broker.js +1 -60
  78. package/packages/client/dist/config/host-auth-reference.js +1 -93
  79. package/packages/client/dist/config/profile-directory.js +1 -13
  80. package/packages/client/dist/config/resolver-selection.js +1 -278
  81. package/packages/client/dist/config/secure-config.js +12 -281
  82. package/packages/client/dist/config.js +2 -224
  83. package/packages/client/dist/constants.js +1 -25
  84. package/packages/client/dist/context/context-collector.js +2 -222
  85. package/packages/client/dist/context/context-sanitizer.js +1 -145
  86. package/packages/client/dist/continuity/autonomous-governance.js +1 -285
  87. package/packages/client/dist/continuity/continuity-client-state-store.js +1 -1587
  88. package/packages/client/dist/continuity/invoke-hooks.js +1 -129
  89. package/packages/client/dist/continuity/migrations/001-initial-schema.js +2 -12
  90. package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +2 -12
  91. package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +2 -12
  92. package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +2 -12
  93. package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +2 -12
  94. package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +2 -10
  95. package/packages/client/dist/continuity/native-agent-store.js +1 -69
  96. package/packages/client/dist/continuity/native-agent-types.js +1 -105
  97. package/packages/client/dist/continuity/outbox.js +1 -117
  98. package/packages/client/dist/continuity/runner-bootstrap-policy.js +1 -172
  99. package/packages/client/dist/continuity/sqlite-store.js +81 -2612
  100. package/packages/client/dist/effects/invoke-effect-gateways.js +1 -62
  101. package/packages/client/dist/errors/error-messages.js +2 -258
  102. package/packages/client/dist/errors/frontmatter-diagnostics.js +1 -125
  103. package/packages/client/dist/evidence/collector.js +1 -347
  104. package/packages/client/dist/evidence/index.js +1 -1
  105. package/packages/client/dist/evidence/types.js +0 -2
  106. package/packages/client/dist/fs/atomic-state-replace.js +1 -152
  107. package/packages/client/dist/generated/command-registry.generated.js +1 -4076
  108. package/packages/client/dist/generated/public-projections.generated.js +1 -149
  109. package/packages/client/dist/git/direct-yolo-c01-retry.js +4 -138
  110. package/packages/client/dist/git/direct-yolo-checkpoint.d.ts +70 -0
  111. package/packages/client/dist/git/direct-yolo-checkpoint.js +4 -1592
  112. package/packages/client/dist/git/epic-operational-state.js +2 -672
  113. package/packages/client/dist/git/git-lifecycle-step-ids.js +1 -14
  114. package/packages/client/dist/git/git-lifecycle-store.d.ts +22 -0
  115. package/packages/client/dist/git/git-lifecycle-store.js +8 -2500
  116. package/packages/client/dist/git/legacy-story-branch-checkpoint.js +9 -259
  117. package/packages/client/dist/git/legacy-story-branch-setup.js +4 -348
  118. package/packages/client/dist/git/legacy-story-pr.js +70 -3538
  119. package/packages/client/dist/git/neocortex-trailers.js +2 -53
  120. package/packages/client/dist/git/secure-filesystem-boundary.js +5 -182
  121. package/packages/client/dist/git/story-worktree-cleanup.js +4 -1058
  122. package/packages/client/dist/git/story-worktree-integration.d.ts +62 -0
  123. package/packages/client/dist/git/story-worktree-integration.js +3 -603
  124. package/packages/client/dist/git/story-worktree-manager.js +3 -843
  125. package/packages/client/dist/git/story-worktree-paths.js +1 -150
  126. package/packages/client/dist/git/story-write-set-extension.d.ts +44 -0
  127. package/packages/client/dist/git/story-write-set-extension.js +1 -0
  128. package/packages/client/dist/graph-retrieval/pre-command-hook.js +1 -284
  129. package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +1 -237
  130. package/packages/client/dist/i18n/first-run.js +2 -60
  131. package/packages/client/dist/index.js +1 -50
  132. package/packages/client/dist/invocation/invoke-input.js +1 -24
  133. package/packages/client/dist/license/host-auth-recovery.js +1 -401
  134. package/packages/client/dist/license/index.js +1 -5
  135. package/packages/client/dist/license/license-client.js +1 -337
  136. package/packages/client/dist/machine/fingerprint.js +2 -163
  137. package/packages/client/dist/machine/index.js +1 -5
  138. package/packages/client/dist/memory/project-memory-path-scope.js +1 -62
  139. package/packages/client/dist/memory/project-memory-writer.js +41 -1117
  140. package/packages/client/dist/memory/shared-project-memory-types.js +2 -259
  141. package/packages/client/dist/migrations/epic-lifecycle-backfill.js +3 -1060
  142. package/packages/client/dist/migrations/project-identity-capability.js +1 -50
  143. package/packages/client/dist/migrations/project-identity.js +7 -493
  144. package/packages/client/dist/migrations/state-json.js +4 -393
  145. package/packages/client/dist/policy/architecture-policy.js +2 -184
  146. package/packages/client/dist/policy/index.js +1 -7
  147. package/packages/client/dist/policy/shared-policy-types.js +0 -38
  148. package/packages/client/dist/policy/subagent-approval-policy.js +1 -57
  149. package/packages/client/dist/private-execution/clean-baseline.js +2 -279
  150. package/packages/client/dist/private-execution/codex-executor.js +4 -574
  151. package/packages/client/dist/private-execution/codex-host-runtime.js +1 -137
  152. package/packages/client/dist/private-execution/codex-lifecycle-guard.js +1 -97
  153. package/packages/client/dist/private-execution/codex-scoped-permissions.js +1 -128
  154. package/packages/client/dist/private-execution/delivery.js +13 -410
  155. package/packages/client/dist/private-execution/diagnosis-root-review.js +2 -294
  156. package/packages/client/dist/private-execution/frozen-handoff.js +6 -19
  157. package/packages/client/dist/private-execution/implementation-validation.js +2 -106
  158. package/packages/client/dist/private-execution/isolated-admission.js +23 -1432
  159. package/packages/client/dist/private-execution/isolated-session.js +5 -725
  160. package/packages/client/dist/private-execution/isolated-workspace.js +1 -122
  161. package/packages/client/dist/private-execution/pact-consumer-runtime.js +3 -409
  162. package/packages/client/dist/private-execution/pact-test-source.js +1 -258
  163. package/packages/client/dist/private-execution/pact-toolchain.js +3 -290
  164. package/packages/client/dist/private-execution/pact-write-set.js +1 -172
  165. package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +5 -406
  166. package/packages/client/dist/private-execution/planning-generation-checkpoint.js +5 -462
  167. package/packages/client/dist/private-execution/planning-memory-checkpoint.js +3 -139
  168. package/packages/client/dist/private-execution/planning-research-checkpoint.js +4 -325
  169. package/packages/client/dist/private-execution/private-report-store.js +1 -42
  170. package/packages/client/dist/private-execution/property-test-candidate.js +1 -103
  171. package/packages/client/dist/private-execution/property-test-choices.js +3 -147
  172. package/packages/client/dist/private-execution/property-test-plan.js +7 -271
  173. package/packages/client/dist/private-execution/property-test-review.js +4 -258
  174. package/packages/client/dist/private-execution/property-test-runtime.js +9 -372
  175. package/packages/client/dist/private-execution/property-test-source.js +1 -139
  176. package/packages/client/dist/private-execution/root-checkpoint.js +1 -80
  177. package/packages/client/dist/private-execution/root-memory-git-evidence.js +3 -135
  178. package/packages/client/dist/private-execution/root-memory-recovery.js +1 -93
  179. package/packages/client/dist/private-execution/root-memory-request.js +1 -29
  180. package/packages/client/dist/private-execution/root-memory-scope.js +1 -178
  181. package/packages/client/dist/private-execution/root-memory-writer.js +1 -102
  182. package/packages/client/dist/private-execution/session-lease.js +1 -63
  183. package/packages/client/dist/private-execution/shared-private-admission-types.js +1 -50
  184. package/packages/client/dist/private-execution/shared-project-validation.js +1 -66
  185. package/packages/client/dist/private-execution/shared-root-memory-types.js +1 -61
  186. package/packages/client/dist/private-execution/ux-source-validation.js +1 -372
  187. package/packages/client/dist/private-execution/ux-write-set.js +2 -191
  188. package/packages/client/dist/registry/registry-reconciliation.js +1 -234
  189. package/packages/client/dist/resilience/circuit-breaker.js +1 -170
  190. package/packages/client/dist/resilience/degradation-manager.js +1 -164
  191. package/packages/client/dist/resilience/freshness-indicator.js +1 -100
  192. package/packages/client/dist/resilience/index.js +1 -8
  193. package/packages/client/dist/resilience/recovery-detector.js +1 -74
  194. package/packages/client/dist/resolvers/asset-resolver.js +0 -13
  195. package/packages/client/dist/resolvers/local-resolver.js +8 -255
  196. package/packages/client/dist/resolvers/remote-resolver.js +1 -233
  197. package/packages/client/dist/runner/binary.js +1 -404
  198. package/packages/client/dist/runner/cli.js +17 -1571
  199. package/packages/client/dist/runner/epic-background-dispatcher.js +1 -124
  200. package/packages/client/dist/runner/headless/adapters.js +1 -49
  201. package/packages/client/dist/runner/headless/background-root.js +1 -85
  202. package/packages/client/dist/runner/headless/claude-code-adapter.js +1 -79
  203. package/packages/client/dist/runner/headless/continuous-story-workspace.js +11 -1776
  204. package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +1 -69
  205. package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +2 -111
  206. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +10 -1464
  207. package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +2 -357
  208. package/packages/client/dist/runner/headless/fake-adapter.js +1 -62
  209. package/packages/client/dist/runner/headless/managed-environment-cleanup.js +1 -274
  210. package/packages/client/dist/runner/headless/managed-profile.js +1 -149
  211. package/packages/client/dist/runner/headless/opencode-adapter.js +2 -145
  212. package/packages/client/dist/runner/headless/prepared-story-bundle.js +1 -43
  213. package/packages/client/dist/runner/headless/resolver.js +1 -231
  214. package/packages/client/dist/runner/headless/run-yolo.js +1 -886
  215. package/packages/client/dist/runner/headless/run-yoloop.js +2 -2657
  216. package/packages/client/dist/runner/headless/types.js +2 -575
  217. package/packages/client/dist/runner/host-capacity.js +1 -59
  218. package/packages/client/dist/runner/local-console.js +13 -396
  219. package/packages/client/dist/runner/portal-sync-worker.js +1 -1487
  220. package/packages/client/dist/runner/project-identity.js +1 -106
  221. package/packages/client/dist/runner/scheduler.js +7 -995
  222. package/packages/client/dist/runner-cli.js +2 -18
  223. package/packages/client/dist/state/invocation-shape.js +1 -13
  224. package/packages/client/dist/state/project-state-snapshot.js +1 -1754
  225. package/packages/client/dist/state/state-json-repair.js +3 -785
  226. package/packages/client/dist/state/structural-dag-projection.js +1 -118
  227. package/packages/client/dist/telemetry/index.js +1 -5
  228. package/packages/client/dist/telemetry/offline-queue.js +1 -131
  229. package/packages/client/dist/tier/index.js +1 -5
  230. package/packages/client/dist/tier/tier-aware-client.js +1 -405
  231. package/packages/client/dist/types/index.js +1 -38
  232. package/packages/client/dist/version.js +1 -27
  233. package/packages/client/dist/yolo/change-evidence-collector.d.ts +10 -0
  234. package/packages/client/dist/yolo/change-evidence-collector.js +1 -245
  235. package/packages/client/dist/yolo/invoke-envelope-capability.js +1 -65
  236. package/packages/client/dist/yolo/spec-envelope-collector.js +5 -184
  237. package/packages/client/dist/yoloop/discovery-hook.js +2 -300
  238. package/packages/client/dist/yoloop/index.js +1 -8
  239. package/packages/client/dist/yoloop/invoke-hooks.js +12 -669
  240. package/packages/client/dist/yoloop/shared-discover-epics.js +1 -1007
  241. package/packages/client/dist/yoloop/shared-yoloop-types.js +1 -33
  242. package/packages/client/dist/yoloop/target-normalization.js +1 -180
  243. package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -1920
  244. package/targets-stubs/antigravity/gemini.md +1 -1
  245. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  246. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  247. package/targets-stubs/claude-code/neocortex-root.md +2 -2
  248. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  249. package/targets-stubs/claude-code/neocortex.md +2 -2
  250. package/targets-stubs/codex/AGENTS.md +1 -1
  251. package/targets-stubs/cursor/agent.md +2 -2
  252. package/targets-stubs/gemini-cli/agent.md +2 -2
  253. package/targets-stubs/opencode/neocortex-root.md +1 -1
  254. package/targets-stubs/vscode/neocortex.agent.md +2 -2
@@ -1,136 +1,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
+ import{isNativeDispatchBindingV1 as b,isNativeHostAttestationV1 as A}from"../continuity/native-agent-types.js";import{deriveOpaqueNativeAgentHandle as v,openNativeAgentPrivateStore as m}from"../continuity/native-agent-store.js";const k=64*1024,E=new Set(["requested","spawned","running","completed","failed","interrupted","unknown","lost"]),g=new Set(["native-agent","headless-process","inline"]),N=new Set(["fresh","stale","unknown"]),H=new Set(["host-event","host-list","bounded-poll","local-reservation"]);function l(t,o){const i=t.indexOf(o);return i>=0?t[i+1]:void 0}function h(t,o,i=[]){const n=new Set([...o,...i]);return o.every(a=>Object.prototype.hasOwnProperty.call(t,a))&&Object.keys(t).every(a=>n.has(a))}async function w(){const t=[];let o=0;for await(const n of process.stdin){const a=Buffer.isBuffer(n)?n:Buffer.from(String(n));if(o+=a.length,o>k)throw new Error("native-agent-input-too-large");t.push(a)}const i=JSON.parse(Buffer.concat(t).toString("utf8"));if(!i||typeof i!="object"||Array.isArray(i))throw new Error("native-agent-input-invalid");return i}function r(t){process.stdout.write(`${JSON.stringify(t)}
2
+ `)}function O(t){return t&&typeof t=="object"&&"code"in t&&typeof t.code=="string"?t.code:t instanceof SyntaxError?"native-agent-input-invalid":t instanceof Error&&/^native-agent-[a-z0-9-]+$/.test(t.message)?t.message:"native-agent-operation-failed"}async function C(t){const o=t[0],i=l(t,"--project-root")??process.cwd();let n;try{if(o!=="reserve"&&o!=="observe"&&o!=="status")return r({ok:!1,reasonCode:"native-agent-action-invalid",publicSafe:!0}),1;if(n=await m(i),o==="reserve"){const e=await w();if(!h(e,["directiveKind","supportsTaskDelegation","taskDelegationCapability","binding","hostAttestation"],["requestedAt","topology"]))throw new Error("native-agent-input-invalid");if(e.directiveKind!=="task"||e.supportsTaskDelegation!==!0||e.taskDelegationCapability!=="native_safe"||!b(e.binding)||!A(e.hostAttestation))throw new Error("native-agent-dispatch-not-authorized");const s=e.topology??"native-agent";if(!g.has(s))throw new Error("native-agent-input-invalid");const c=n.store.reserveNativeAgentDispatch({binding:e.binding,hostAttestation:e.hostAttestation,requestedAt:typeof e.requestedAt=="string"?e.requestedAt:new Date().toISOString(),topology:s});return r({ok:!0,authorized:!0,action:c.reserved?"spawn-once":"reconcile-existing",...c,publicSafe:!0}),0}if(o==="observe"){const e=await w();if(!h(e,["dispatchKey","expectedRevision","state","topology","observedAt","freshness","observationSource","reasonCode"],["rawHandle","rawParentHandle","terminalAt"]))throw new Error("native-agent-input-invalid");const s=e.state,c=e.topology,u=e.freshness,d=e.observationSource;if(!E.has(s)||!g.has(c)||!N.has(u)||!H.has(d))throw new Error("native-agent-input-invalid");const p=typeof e.rawHandle=="string"?e.rawHandle:null,f=typeof e.rawParentHandle=="string"?e.rawParentHandle:null,y=n.store.observeNativeAgentDispatch({dispatchKey:String(e.dispatchKey),expectedRevision:Number(e.expectedRevision),state:s,handle:p?v(p,n.paths.handleKeyPath):null,parentHandle:f?v(f,n.paths.handleKeyPath):null,topology:c,observedAt:String(e.observedAt),terminalAt:e.terminalAt===null||typeof e.terminalAt=="string"?e.terminalAt:void 0,freshness:u,observationSource:d,reasonCode:String(e.reasonCode)});return r({ok:!0,...y,publicSafe:!0}),0}const a=l(t,"--dispatch-key"),S=Number(l(t,"--stale-after-ms")??3e4);if(a){const e=n.store.getNativeAgentDispatchStatus(a,{staleAfterMs:S});r({ok:!0,receipt:e,publicSafe:!0})}else{const e=n.store.listRecentNativeAgentDispatches(Number(l(t,"--limit")??20));r({ok:!0,receipts:e,publicSafe:!0})}return 0}catch(a){return r({ok:!1,reasonCode:O(a),publicSafe:!0}),1}finally{n?.store.close()}}export{C as nativeAgentCliHandler};
@@ -1,43 +1 @@
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
+ import{sealPlanningDiagnosis as t}from"../private-execution/planning-diagnosis-checkpoint.js";const a=64*1024;async function c(n){const o=[];let r=0;for await(const i of n){const e=Buffer.isBuffer(i)?i:Buffer.from(i);if(r+=e.length,r>a)throw new Error("planning-diagnosis-review-too-large");o.push(e)}if(r===0)throw new Error("planning-diagnosis-review-missing");return JSON.parse(Buffer.concat(o).toString("utf8"))}async function g(n){return l(n,process.stdin,console)}async function l(n,o,r){if(n[0]!=="seal"||n.length!==1&&n.length!==3||n.length===3&&n[1]!=="--project-root")return r.error("usage: planning-diagnosis seal [--project-root <path>] < review.json"),1;try{const i=await c(o),e=t(n.length===3?n[2]:process.cwd(),i);return r.log(JSON.stringify({ok:!0,epicId:e.epicId,diagnosisReceiptId:e.diagnosisReceiptId,qaEvidenceId:e.qaEvidenceId,publicSafe:!0})),0}catch(i){const e=i instanceof Error?i.message:"",s=/^planning-diagnosis-[a-z-]+$/.test(e)?e:"planning-diagnosis-seal-failed";return r.error(JSON.stringify({ok:!1,reasonCode:s,publicSafe:!0})),1}}export{g as planningDiagnosisCliHandler,l as planningDiagnosisCliHandlerWithIO};
@@ -1,53 +1 @@
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
+ import{sealPlanningGeneration as c,verifyCommittedPlanningGeneration as s}from"../private-execution/planning-generation-checkpoint.js";const f=64*1024;async function l(e){const o=[];let r=0;for await(const n of e){const i=Buffer.isBuffer(n)?n:Buffer.from(n);if(r+=i.length,r>f)throw new Error("planning-generation-review-too-large");o.push(i)}if(r===0)throw new Error("planning-generation-review-missing");return JSON.parse(Buffer.concat(o).toString("utf8"))}async function u(e){return p(e,process.stdin,console)}async function p(e,o,r){if(e[0]!=="seal"&&e[0]!=="verify"||e.length!==1&&e.length!==3||e.length===3&&e[1]!=="--project-root")return r.error("usage: planning-generation <seal|verify> [--project-root <path>] < input.json"),1;try{const n=await l(o),i=e.length===3?e[2]:process.cwd();let t;if(e[0]==="verify"){if(!n||typeof n!="object"||Array.isArray(n)||Object.keys(n).sort().join("|")!=="claimId|epicId|schemaVersion"||n.schemaVersion!=="PlanningGenerationVerification/1"||typeof n.claimId!="string"||typeof n.epicId!="string")throw new Error("planning-generation-verification-input-invalid");const a=n;t=s(i,a.claimId,a.epicId)}else t=c(i,n);return r.log(JSON.stringify({ok:!0,...t,publicSafe:!0})),0}catch(n){const i=n instanceof Error?n.message:"",t=/^planning-generation-[a-z-]+$/.test(i)?i:e[0]==="verify"?"planning-generation-verification-failed":"planning-generation-seal-failed";return r.error(JSON.stringify({ok:!1,reasonCode:t,publicSafe:!0})),1}}export{u as planningGenerationCliHandler,p as planningGenerationCliHandlerWithIO};
@@ -1,40 +1 @@
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
+ import{sealPlanningMemory as s,verifyCommittedPlanningMemory as f}from"../private-execution/planning-memory-checkpoint.js";async function p(n){if(!["seal","verify"].includes(n[0]??"")||n.length!==1&&n.length!==3||n.length===3&&n[1]!=="--project-root")return console.error("usage: planning-memory <seal|verify> [--project-root <path>] < input.json"),1;try{const t=[];let i=0;for await(const o of process.stdin){const l=Buffer.from(o);if(i+=l.length,i>16384)throw new Error("planning-memory-input-too-large");t.push(l)}const e=JSON.parse(Buffer.concat(t).toString("utf8")),c=n.length===3?n[2]:process.cwd();let r;if(n[0]==="verify"){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).sort().join("|")!=="claimId|epicId|schemaVersion"||e.schemaVersion!=="PlanningMemoryVerification/1"||typeof e.claimId!="string"||typeof e.epicId!="string")throw new Error("planning-memory-input-invalid");const o=e;r=f(c,o.claimId,o.epicId)}else r=s(c,e);return console.log(JSON.stringify({ok:!0,receipt:r,publicSafe:!0})),0}catch{return console.error(JSON.stringify({ok:!1,reasonCode:"planning-memory-evidence-unverified",publicSafe:!0})),1}}export{p as planningMemoryCliHandler};
@@ -1,42 +1 @@
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
+ import{sealPlanningResearch as o}from"../private-execution/planning-research-checkpoint.js";const s=64*1024;async function a(e){const c=[];let t=0;for await(const n of e){const r=Buffer.isBuffer(n)?n:Buffer.from(n);if(t+=r.length,t>s)throw new Error("planning-research-review-too-large");c.push(r)}if(t===0)throw new Error("planning-research-review-missing");return JSON.parse(Buffer.concat(c).toString("utf8"))}async function h(e){return l(e,process.stdin,console)}async function l(e,c,t){if(e[0]!=="seal"||e.length!==1&&e.length!==3||e.length===3&&e[1]!=="--project-root")return t.error("usage: planning-research seal [--project-root <path>] < review.json"),1;try{const n=await a(c),r=o(e.length===3?e[2]:process.cwd(),n);return t.log(JSON.stringify({ok:!0,epicId:r.epicId,researchReceiptId:r.researchReceiptId,qaEvidenceId:r.qaEvidenceId,publicSafe:!0})),0}catch(n){const r=n instanceof Error?n.message:"",i=/^planning-research-[a-z-]+$/.test(r)?r:"planning-research-seal-failed";return t.error(JSON.stringify({ok:!1,reasonCode:i,publicSafe:!0})),1}}export{h as planningResearchCliHandler,l as planningResearchCliHandlerWithIO};
@@ -1,75 +1 @@
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
+ import{validatePrivateYoloImplementation as l}from"../private-execution/implementation-validation.js";import{renewPrivateYoloSessionLease as f}from"../private-execution/session-lease.js";import{acceptPrivateYoloDiagnosisRootReview as m,acceptPrivateYoloResearchRootReview as h,acceptPrivateYoloSpecificationRootReview as w,acceptPrivateYoloTasksRootReview as y,acceptPrivateYoloImplementationRootReview as R,acceptPrivateYoloRefactorAdvisoryRootReview as x,acceptPrivateYoloTestValidationRootReview as S,acceptPrivateYoloQaRootReview as j}from"../private-execution/diagnosis-root-review.js";const s={"accept-project-memory":P,"accept-qa":j,"accept-test-validation":S,"accept-refactor-advisory":x,"validate-implementation":l,"accept-implementation":R,"accept-diagnosis":m,"accept-research":h,"accept-specification":w,"accept-tasks":y};import{acceptPrivateYoloProjectMemoryRootReview as P,discardPrivateYoloRejectedCandidate as Y,inspectPrivateYoloRejectedCandidate as k}from"../private-execution/isolated-session.js";async function O(e){if(!["inspect-rejected","discard-rejected","renew-lease",...Object.keys(s)].includes(e[0]??"")||e.length!==1&&e.length!==3||e.length===3&&e[1]!=="--project-root")return 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"),1;try{const o=[];let d=0;for await(const p of process.stdin){const a=Buffer.from(p);if(d+=a.length,d>16384)throw new Error("input-too-large");o.push(a)}const i=JSON.parse(Buffer.concat(o).toString("utf8"));if(Object.hasOwn(s,e[0])){const p=s[e[0]],a=await p(e.length===3?e[2]:process.cwd(),i);return console.log(JSON.stringify({ok:!0,result:a,publicSafe:!0})),0}if(!i||typeof i!="object"||Array.isArray(i))throw new Error("input-invalid");const t=i,c=e[0]==="discard-rejected",r=e[0]==="renew-lease",v=["schemaVersion","storyId","graphRevision","executorStopped",...c?["expectedCandidateDigest","authorizeDiscard"]:[],...r?["expectedSnapshotSha","expiresAt"]:[]];if(Object.keys(t).sort().join("|")!==v.sort().join("|")||t.schemaVersion!==(r?"PrivateYoloSessionLeaseRequest/1":"PrivateYoloRejectedCandidateRequest/1")||typeof t.storyId!="string"||typeof t.graphRevision!="string"||!/^[a-f0-9]{64}$/.test(t.graphRevision)||t.executorStopped!==!0||c&&(t.authorizeDiscard!==!0||typeof t.expectedCandidateDigest!="string")||r&&(typeof t.expectedSnapshotSha!="string"||typeof t.expiresAt!="string"))throw new Error("input-invalid");const n=e.length===3?e[2]:process.cwd(),u=r?await f(n,t.storyId,t.graphRevision,{executorStopped:!0,expectedSnapshotSha:t.expectedSnapshotSha,expiresAt:t.expiresAt}):c?await Y(n,t.storyId,t.graphRevision,{expectedCandidateDigest:t.expectedCandidateDigest,executorStopped:!0,authorizeDiscard:!0}):await k(n,t.storyId,t.graphRevision,!0);return console.log(JSON.stringify({ok:!0,result:u,publicSafe:!0})),0}catch{const o=e[0]==="accept-project-memory"?"private-root-memory-acceptance-unverified":e[0]==="accept-qa"?"private-execution-qa-root-review-unverified":e[0]==="accept-test-validation"?"private-execution-test-validation-root-review-unverified":e[0]==="accept-refactor-advisory"?"private-execution-refactor-advisory-root-review-unverified":e[0]==="validate-implementation"?"private-execution-implementation-validation-unverified":e[0]==="accept-implementation"?"private-execution-implementation-root-review-unverified":e[0]==="accept-diagnosis"?"private-execution-diagnosis-root-review-unverified":e[0]==="accept-research"?"private-execution-research-root-review-unverified":e[0]==="accept-specification"?"private-execution-specification-root-review-unverified":e[0]==="accept-tasks"?"private-execution-tasks-root-review-unverified":e[0]==="renew-lease"?"private-execution-session-renewal-unverified":"private-execution-rejected-candidate-unverified";return console.error(JSON.stringify({ok:!1,reasonCode:o,publicSafe:!0})),1}}export{O as privateSessionCliHandler};
@@ -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
+ import{inspectPropertyTestCatalog as d,confirmPropertyTestPlan as w}from"../private-execution/property-test-plan.js";import{savePropertyTestChoices as g}from"../private-execution/property-test-choices.js";async function h(n){const r=n[0];let o=process.cwd(),i="plain",p=!1,c=!1;const f=new Set;for(let e=1;e<n.length;e++){const t=n[e];if(f.has(t))return console.error("property-test-invalid-cli-argument"),1;if(f.add(t),t==="--project-root"&&n[e+1])o=n[++e];else if(t==="--format"&&(n[e+1]==="plain"||n[e+1]==="json"))i=n[++e];else if(t==="--authorize-run")p=!0;else if(t==="--authorize-review")c=!0;else return console.error("property-test-invalid-cli-argument"),1}if(r!=="inspect"&&r!=="confirm"&&r!=="save"&&r!=="candidate"&&r!=="verify"&&r!=="review-plan"&&r!=="review-accept"&&r!=="review-status")return console.error("Usage: neocortex-client property-qa inspect|confirm|save|candidate|verify|review-plan|review-accept|review-status --project-root <path> --format json|plain"),1;if(p!==(r==="verify")||c!==(r==="review-accept"))return console.error(r==="review-accept"||c?"property-test-review-authorization-required":"property-test-run-authorization-required"),1;try{if(r==="inspect"){const e=d(o);if(i==="json")console.log(JSON.stringify(e));else{console.log(`PRD: ${e.prdPath} (${e.prdSha256})`);for(const t of e.aggregates)console.log(`${t.name}: ${t.invariantCount} invariants; candidates: ${t.suggestedFiles.join(", ")||"(none)"}`);console.log("Explicit mapping, language and numRuns are required for confirm. No tests were written.")}}else if(r==="verify"){const{verifyPropertyTestRuntime:e}=await import("../private-execution/property-test-runtime.js"),t=e(o);return console.log(i==="json"?JSON.stringify(t):`property-test runtime ${t.outcome}: ${t.reasonCode}; QA not accepted`),t.executionVerified?0:1}else if(r==="review-plan"){const{inspectPropertyTestReviewPlan:e}=await import("../private-execution/property-test-review.js"),t=e(o);console.log(i==="json"?JSON.stringify(t):`property-test review plan ${t.candidateSha256}: ${t.invariants.length} invariant hashes; no QA accepted`)}else if(r==="review-accept"){let e="";for await(const u of process.stdin)if(e+=String(u),Buffer.byteLength(e)>256*1024)throw new Error("property-test-review-too-large");const{parseDocument:t}=await import("yaml"),s=t(e,{strict:!0,uniqueKeys:!0,schema:"core",customTags:[]});if(s.errors.length||s.warnings.length)throw new Error("property-test-review-unverified");const{acceptPropertyTestSemanticReview:l}=await import("../private-execution/property-test-review.js"),a=l(o,JSON.parse(e));console.log(i==="json"?JSON.stringify(a):`property-test review accepted: ${a.invariantCount} invariants, ${a.passedTests} passed and ${a.causalFailedTests} causal failures`)}else if(r==="review-status"){const{readPropertyTestReviewReceipt:e}=await import("../private-execution/property-test-review.js"),t=e(o);console.log(i==="json"?JSON.stringify(t):`property-test review accepted: ${t.invariantCount} invariants at ${t.candidateSha256}`)}else if(r==="candidate"){const{inspectPropertyTestCandidate:e}=await import("../private-execution/property-test-candidate.js"),t=e(o);console.log(i==="json"?JSON.stringify(t):`property-test candidate ${t.artifactSha256}: ${t.testFileCount} test files; execution and QA unverified`)}else{let e="";for await(const l of process.stdin)if(e+=String(l),Buffer.byteLength(e)>32768)throw new Error("property-test-choices-too-large");const t=JSON.parse(e),s=r==="save"?g(o,t):w(o,t);i==="json"?console.log(JSON.stringify(s)):(console.log(`property-test plan ${s.planSha256}: ${s.writeSet.join(", ")}`),console.log(r==="save"?"Choices saved in the private Git common-dir; no tests were written and no QA checkpoint was accepted.":"Read-only preflight: no tests were written and no QA checkpoint was accepted."))}return 0}catch(e){const t=e instanceof Error&&/^property-test-[a-z-]+$/.test(e.message)?e.message:"property-test-preflight-failed";return console.error(t),1}}export{h as propertyQaCliHandler};
@@ -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
- }
1
+ import{requestRootControl as e,refactorControlCliHandler as a}from"./refactor-control.js";async function c(o,t=fetch){try{return await e("qa",o,t)}catch(r){throw r instanceof Error&&/^refactor-root-control-[a-z-]+$/.test(r.message)?new Error(r.message.replace(/^refactor-/,"qa-")):r}}function l(o){return a(o,"qa")}export{l as qaControlCliHandler,c as requestQaControl};