@ornexus/neocortex 4.60.73 → 4.60.75

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 (269) hide show
  1. package/dist/release-source.json +1 -1
  2. package/dist/sbom.cdx.json +1216 -1210
  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 -212
  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 -417
  18. package/packages/client/dist/agent/update-agent-yaml.js +1 -102
  19. package/packages/client/dist/agent/update-description.js +1 -251
  20. package/packages/client/dist/cache/crypto-utils.js +1 -78
  21. package/packages/client/dist/cache/encrypted-cache.d.ts +27 -0
  22. package/packages/client/dist/cache/encrypted-cache.js +1 -108
  23. package/packages/client/dist/cache/in-memory-asset-cache.js +1 -73
  24. package/packages/client/dist/cache/index.js +1 -13
  25. package/packages/client/dist/cache/protected-pi-boundary.js +1 -44
  26. package/packages/client/dist/checkpoint/checkpoint-client-reader.js +2 -127
  27. package/packages/client/dist/checkpoint/index.js +1 -11
  28. package/packages/client/dist/checkpoint/shared-checkpoint-types.js +1 -32
  29. package/packages/client/dist/cli.js +5 -358
  30. package/packages/client/dist/commands/activate.js +8 -394
  31. package/packages/client/dist/commands/architecture-answers.js +7 -274
  32. package/packages/client/dist/commands/architecture-memory-terminal.js +4 -253
  33. package/packages/client/dist/commands/architecture-non-ui-continuation.js +1 -100
  34. package/packages/client/dist/commands/architecture-root-binding.js +1 -51
  35. package/packages/client/dist/commands/cache-status.js +2 -112
  36. package/packages/client/dist/commands/config.js +1 -88
  37. package/packages/client/dist/commands/doctor.js +2 -635
  38. package/packages/client/dist/commands/invoke.d.ts +38 -1
  39. package/packages/client/dist/commands/invoke.js +143 -7200
  40. package/packages/client/dist/commands/legacy-epic-terminal.js +1 -71
  41. package/packages/client/dist/commands/legacy-story-branch.js +1 -96
  42. package/packages/client/dist/commands/legacy-story-pr.js +1 -276
  43. package/packages/client/dist/commands/mutation-qa-checkpoint.js +5 -285
  44. package/packages/client/dist/commands/mutation-qa-gate.js +1 -54
  45. package/packages/client/dist/commands/mutation-qa-git.js +1 -41
  46. package/packages/client/dist/commands/mutation-qa-policy.js +1 -102
  47. package/packages/client/dist/commands/mutation-qa-run.js +3 -219
  48. package/packages/client/dist/commands/mutation-qa-verdict.js +1 -149
  49. package/packages/client/dist/commands/mutation-qa.js +1 -220
  50. package/packages/client/dist/commands/native-agent.js +2 -136
  51. package/packages/client/dist/commands/planning-diagnosis.js +1 -43
  52. package/packages/client/dist/commands/planning-generation.js +1 -53
  53. package/packages/client/dist/commands/planning-memory.js +1 -40
  54. package/packages/client/dist/commands/planning-research.js +1 -42
  55. package/packages/client/dist/commands/private-session.js +1 -75
  56. package/packages/client/dist/commands/property-qa.js +1 -139
  57. package/packages/client/dist/commands/qa-control.js +1 -16
  58. package/packages/client/dist/commands/qa-scan-browser-launch.js +1 -55
  59. package/packages/client/dist/commands/qa-scan-browser-route.js +1 -28
  60. package/packages/client/dist/commands/qa-scan-capture.js +5 -663
  61. package/packages/client/dist/commands/qa-scan-discovery.js +3 -376
  62. package/packages/client/dist/commands/qa-scan-review.js +5 -826
  63. package/packages/client/dist/commands/qa-synthetic-backend-capture.js +1 -266
  64. package/packages/client/dist/commands/qa-synthetic-backend-review.js +1 -297
  65. package/packages/client/dist/commands/qa-synthetic-backend.js +2 -340
  66. package/packages/client/dist/commands/qa-synthetic-broker-port.js +1 -85
  67. package/packages/client/dist/commands/qa-synthetic-browser.js +1 -39
  68. package/packages/client/dist/commands/refactor-characterization.js +21 -671
  69. package/packages/client/dist/commands/refactor-commit.js +13 -399
  70. package/packages/client/dist/commands/refactor-control.js +3 -142
  71. package/packages/client/dist/commands/refactor-cpp-assertions.js +3 -93
  72. package/packages/client/dist/commands/refactor-review.js +5 -283
  73. package/packages/client/dist/commands/refactor-root.js +7 -588
  74. package/packages/client/dist/commands/refresh-memory.js +3 -156
  75. package/packages/client/dist/commands/shared-architecture-non-ui.js +1 -24
  76. package/packages/client/dist/commands/story-checkpoint.js +1 -171
  77. package/packages/client/dist/config/host-auth-broker.d.ts +31 -0
  78. package/packages/client/dist/config/host-auth-broker.js +1 -0
  79. package/packages/client/dist/config/host-auth-reference.d.ts +32 -0
  80. package/packages/client/dist/config/host-auth-reference.js +1 -0
  81. package/packages/client/dist/config/profile-directory.js +1 -13
  82. package/packages/client/dist/config/resolver-selection.js +1 -278
  83. package/packages/client/dist/config/secure-config.js +12 -281
  84. package/packages/client/dist/config.js +2 -223
  85. package/packages/client/dist/constants.js +1 -25
  86. package/packages/client/dist/context/context-collector.js +2 -222
  87. package/packages/client/dist/context/context-sanitizer.js +1 -145
  88. package/packages/client/dist/continuity/autonomous-governance.js +1 -285
  89. package/packages/client/dist/continuity/continuity-client-state-store.js +1 -1587
  90. package/packages/client/dist/continuity/invoke-hooks.js +1 -129
  91. package/packages/client/dist/continuity/migrations/001-initial-schema.js +2 -12
  92. package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +2 -12
  93. package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +2 -12
  94. package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +2 -12
  95. package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +2 -12
  96. package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +2 -10
  97. package/packages/client/dist/continuity/native-agent-store.js +1 -69
  98. package/packages/client/dist/continuity/native-agent-types.d.ts +11 -0
  99. package/packages/client/dist/continuity/native-agent-types.js +1 -90
  100. package/packages/client/dist/continuity/outbox.js +1 -117
  101. package/packages/client/dist/continuity/runner-bootstrap-policy.js +1 -172
  102. package/packages/client/dist/continuity/sqlite-store.js +81 -2612
  103. package/packages/client/dist/effects/invoke-effect-gateways.js +1 -62
  104. package/packages/client/dist/errors/error-messages.d.ts +3 -0
  105. package/packages/client/dist/errors/error-messages.js +2 -228
  106. package/packages/client/dist/errors/frontmatter-diagnostics.js +1 -125
  107. package/packages/client/dist/evidence/collector.js +1 -347
  108. package/packages/client/dist/evidence/index.js +1 -1
  109. package/packages/client/dist/evidence/types.js +0 -2
  110. package/packages/client/dist/fs/atomic-state-replace.js +1 -152
  111. package/packages/client/dist/generated/command-registry.generated.js +1 -4076
  112. package/packages/client/dist/generated/public-projections.generated.js +1 -149
  113. package/packages/client/dist/git/direct-yolo-c01-retry.js +4 -138
  114. package/packages/client/dist/git/direct-yolo-checkpoint.d.ts +11 -1
  115. package/packages/client/dist/git/direct-yolo-checkpoint.js +4 -1234
  116. package/packages/client/dist/git/epic-operational-state.js +2 -672
  117. package/packages/client/dist/git/git-lifecycle-step-ids.js +1 -14
  118. package/packages/client/dist/git/git-lifecycle-store.d.ts +23 -0
  119. package/packages/client/dist/git/git-lifecycle-store.js +10 -1981
  120. package/packages/client/dist/git/legacy-story-branch-checkpoint.js +9 -259
  121. package/packages/client/dist/git/legacy-story-branch-setup.js +4 -348
  122. package/packages/client/dist/git/legacy-story-pr.js +70 -3538
  123. package/packages/client/dist/git/secure-filesystem-boundary.js +5 -182
  124. package/packages/client/dist/graph-retrieval/pre-command-hook.js +1 -284
  125. package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +1 -237
  126. package/packages/client/dist/i18n/first-run.js +2 -60
  127. package/packages/client/dist/index.d.ts +2 -0
  128. package/packages/client/dist/index.js +1 -47
  129. package/packages/client/dist/invocation/invoke-input.js +1 -24
  130. package/packages/client/dist/license/host-auth-recovery.d.ts +158 -0
  131. package/packages/client/dist/license/host-auth-recovery.js +1 -0
  132. package/packages/client/dist/license/index.js +1 -5
  133. package/packages/client/dist/license/license-client.d.ts +10 -1
  134. package/packages/client/dist/license/license-client.js +1 -304
  135. package/packages/client/dist/machine/fingerprint.js +2 -163
  136. package/packages/client/dist/machine/index.js +1 -5
  137. package/packages/client/dist/memory/project-memory-path-scope.js +1 -62
  138. package/packages/client/dist/memory/project-memory-writer.js +40 -1007
  139. package/packages/client/dist/memory/shared-project-memory-types.js +2 -253
  140. package/packages/client/dist/migrations/epic-lifecycle-backfill.js +3 -1060
  141. package/packages/client/dist/migrations/project-identity-capability.js +1 -50
  142. package/packages/client/dist/migrations/project-identity.js +7 -493
  143. package/packages/client/dist/migrations/state-json.js +4 -393
  144. package/packages/client/dist/policy/architecture-policy.js +2 -184
  145. package/packages/client/dist/policy/index.js +1 -7
  146. package/packages/client/dist/policy/shared-policy-types.js +0 -38
  147. package/packages/client/dist/policy/subagent-approval-policy.js +1 -55
  148. package/packages/client/dist/private-execution/clean-baseline.js +2 -279
  149. package/packages/client/dist/private-execution/codex-executor.js +4 -574
  150. package/packages/client/dist/private-execution/codex-host-runtime.js +1 -137
  151. package/packages/client/dist/private-execution/codex-lifecycle-guard.js +1 -97
  152. package/packages/client/dist/private-execution/codex-scoped-permissions.js +1 -128
  153. package/packages/client/dist/private-execution/delivery.js +13 -410
  154. package/packages/client/dist/private-execution/diagnosis-root-review.js +2 -294
  155. package/packages/client/dist/private-execution/frozen-handoff.js +6 -19
  156. package/packages/client/dist/private-execution/implementation-validation.js +2 -106
  157. package/packages/client/dist/private-execution/isolated-admission.js +23 -1432
  158. package/packages/client/dist/private-execution/isolated-session.js +5 -725
  159. package/packages/client/dist/private-execution/isolated-workspace.js +1 -122
  160. package/packages/client/dist/private-execution/pact-consumer-runtime.js +3 -409
  161. package/packages/client/dist/private-execution/pact-test-source.js +1 -258
  162. package/packages/client/dist/private-execution/pact-toolchain.js +3 -290
  163. package/packages/client/dist/private-execution/pact-write-set.js +1 -172
  164. package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +5 -406
  165. package/packages/client/dist/private-execution/planning-generation-checkpoint.js +5 -462
  166. package/packages/client/dist/private-execution/planning-memory-checkpoint.js +3 -139
  167. package/packages/client/dist/private-execution/planning-research-checkpoint.js +4 -325
  168. package/packages/client/dist/private-execution/private-report-store.js +1 -42
  169. package/packages/client/dist/private-execution/property-test-candidate.js +1 -103
  170. package/packages/client/dist/private-execution/property-test-choices.js +3 -147
  171. package/packages/client/dist/private-execution/property-test-plan.js +7 -271
  172. package/packages/client/dist/private-execution/property-test-review.js +4 -258
  173. package/packages/client/dist/private-execution/property-test-runtime.js +9 -372
  174. package/packages/client/dist/private-execution/property-test-source.js +1 -139
  175. package/packages/client/dist/private-execution/root-checkpoint.js +1 -80
  176. package/packages/client/dist/private-execution/root-memory-git-evidence.js +3 -135
  177. package/packages/client/dist/private-execution/root-memory-recovery.js +1 -93
  178. package/packages/client/dist/private-execution/root-memory-request.js +1 -29
  179. package/packages/client/dist/private-execution/root-memory-scope.js +1 -178
  180. package/packages/client/dist/private-execution/root-memory-writer.js +1 -102
  181. package/packages/client/dist/private-execution/session-lease.js +1 -63
  182. package/packages/client/dist/private-execution/shared-private-admission-types.js +1 -50
  183. package/packages/client/dist/private-execution/shared-project-validation.js +1 -66
  184. package/packages/client/dist/private-execution/shared-root-memory-types.js +1 -61
  185. package/packages/client/dist/private-execution/ux-source-validation.js +1 -372
  186. package/packages/client/dist/private-execution/ux-write-set.js +2 -191
  187. package/packages/client/dist/registry/registry-reconciliation.js +1 -234
  188. package/packages/client/dist/resilience/circuit-breaker.js +1 -170
  189. package/packages/client/dist/resilience/degradation-manager.js +1 -164
  190. package/packages/client/dist/resilience/freshness-indicator.js +1 -100
  191. package/packages/client/dist/resilience/index.js +1 -8
  192. package/packages/client/dist/resilience/recovery-detector.js +1 -74
  193. package/packages/client/dist/resolvers/asset-resolver.js +0 -13
  194. package/packages/client/dist/resolvers/local-resolver.js +8 -255
  195. package/packages/client/dist/resolvers/remote-resolver.js +1 -233
  196. package/packages/client/dist/runner/binary.js +1 -404
  197. package/packages/client/dist/runner/cli.js +17 -1571
  198. package/packages/client/dist/runner/epic-background-dispatcher.d.ts +61 -0
  199. package/packages/client/dist/runner/epic-background-dispatcher.js +1 -0
  200. package/packages/client/dist/runner/headless/adapters.js +1 -49
  201. package/packages/client/dist/runner/headless/background-root.d.ts +65 -0
  202. package/packages/client/dist/runner/headless/background-root.js +1 -0
  203. package/packages/client/dist/runner/headless/claude-code-adapter.js +1 -79
  204. package/packages/client/dist/runner/headless/continuous-story-workspace.js +11 -1628
  205. package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +1 -69
  206. package/packages/client/dist/runner/headless/epic-merge-candidate-qa.d.ts +1 -1
  207. package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +2 -110
  208. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.d.ts +2 -0
  209. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +10 -1236
  210. package/packages/client/dist/runner/headless/epic-terminal-git-runner.d.ts +27 -2
  211. package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +2 -318
  212. package/packages/client/dist/runner/headless/fake-adapter.js +1 -62
  213. package/packages/client/dist/runner/headless/managed-environment-cleanup.d.ts +95 -0
  214. package/packages/client/dist/runner/headless/managed-environment-cleanup.js +1 -0
  215. package/packages/client/dist/runner/headless/managed-profile.js +1 -132
  216. package/packages/client/dist/runner/headless/opencode-adapter.js +2 -145
  217. package/packages/client/dist/runner/headless/prepared-story-bundle.js +1 -43
  218. package/packages/client/dist/runner/headless/resolver.js +1 -231
  219. package/packages/client/dist/runner/headless/run-yolo.js +1 -885
  220. package/packages/client/dist/runner/headless/run-yoloop.d.ts +1 -0
  221. package/packages/client/dist/runner/headless/run-yoloop.js +2 -2574
  222. package/packages/client/dist/runner/headless/types.js +2 -574
  223. package/packages/client/dist/runner/local-console.js +13 -396
  224. package/packages/client/dist/runner/portal-sync-worker.js +1 -1487
  225. package/packages/client/dist/runner/project-identity.js +1 -106
  226. package/packages/client/dist/runner/scheduler.js +7 -995
  227. package/packages/client/dist/runner-cli.js +2 -18
  228. package/packages/client/dist/state/invocation-shape.js +1 -13
  229. package/packages/client/dist/state/project-state-snapshot.d.ts +7 -0
  230. package/packages/client/dist/state/project-state-snapshot.js +1 -1731
  231. package/packages/client/dist/state/state-json-repair.js +3 -785
  232. package/packages/client/dist/state/structural-dag-projection.js +1 -118
  233. package/packages/client/dist/telemetry/index.js +1 -5
  234. package/packages/client/dist/telemetry/offline-queue.js +1 -131
  235. package/packages/client/dist/tier/index.js +1 -5
  236. package/packages/client/dist/tier/tier-aware-client.js +1 -405
  237. package/packages/client/dist/types/index.js +1 -38
  238. package/packages/client/dist/version.js +1 -27
  239. package/packages/client/dist/yolo/change-evidence-collector.d.ts +21 -1
  240. package/packages/client/dist/yolo/change-evidence-collector.js +1 -126
  241. package/packages/client/dist/yolo/invoke-envelope-capability.js +1 -62
  242. package/packages/client/dist/yolo/spec-envelope-collector.js +5 -184
  243. package/packages/client/dist/yoloop/discovery-hook.js +2 -300
  244. package/packages/client/dist/yoloop/index.js +1 -8
  245. package/packages/client/dist/yoloop/invoke-hooks.js +12 -669
  246. package/packages/client/dist/yoloop/shared-discover-epics.js +1 -1007
  247. package/packages/client/dist/yoloop/shared-yoloop-types.js +1 -33
  248. package/packages/client/dist/yoloop/target-normalization.js +1 -180
  249. package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -1920
  250. package/packages/shared/dist/invocation/explicit-intent-recovery.d.ts +83 -0
  251. package/packages/shared/dist/invocation/explicit-intent-recovery.js +187 -0
  252. package/packages/shared/dist/invocation/index.d.ts +7 -0
  253. package/packages/shared/dist/invocation/index.js +22 -0
  254. package/packages/shared/dist/yolo/change-evidence.js +1 -1
  255. package/packages/shared/dist/yoloop/epic-terminal-git.js +144 -2
  256. package/targets-stubs/antigravity/gemini.md +1 -1
  257. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  258. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  259. package/targets-stubs/claude-code/neocortex-root.md +2 -2
  260. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  261. package/targets-stubs/claude-code/neocortex.md +2 -2
  262. package/targets-stubs/codex/AGENTS.md +24 -21
  263. package/targets-stubs/codex/README.md +6 -1
  264. package/targets-stubs/codex/neocortex.toml +7 -2
  265. package/targets-stubs/cursor/agent.md +2 -2
  266. package/targets-stubs/gemini-cli/agent.md +2 -2
  267. package/targets-stubs/opencode/neocortex-root.md +16 -1
  268. package/targets-stubs/opencode/neocortex.md +6 -0
  269. package/targets-stubs/vscode/neocortex.agent.md +2 -2
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Contract-first admission for root-owned native background execution.
3
+ *
4
+ * This module deliberately does not spawn, persist tracked state, select graph
5
+ * work, or perform Git effects. It only converts an exact server-owned task
6
+ * directive into closed per-story entries for the host root.
7
+ */
8
+ import { type NativeBackgroundDispatchContractV1, type NativeDispatchBindingV1, type NativeHostAttestationV1 } from '../continuity/native-agent-types.js';
9
+ export declare const NATIVE_BACKGROUND_REASON_CODES: Readonly<{
10
+ readonly CONTRACT_INVALID: "directive-background-contract-invalid";
11
+ readonly BINDING_MISSING: "directive-background-binding-missing";
12
+ readonly WAVE_MISMATCH: "directive-background-wave-mismatch";
13
+ readonly GRAPH_STALE: "directive-background-graph-stale";
14
+ readonly CAPABILITY_UNVALIDATED: "native-background-capability-unvalidated";
15
+ readonly DEPTH_DENIED: "native-background-depth-denied";
16
+ readonly SETTLEMENT_INVALID: "native-background-settlement-invalid";
17
+ }>;
18
+ export type NativeBackgroundReasonCode = (typeof NATIVE_BACKGROUND_REASON_CODES)[keyof typeof NATIVE_BACKGROUND_REASON_CODES];
19
+ export interface NativeBackgroundTaskDirectiveV1 {
20
+ readonly kind: 'task';
21
+ readonly subagentType: 'neocortex';
22
+ readonly promptTemplate: string;
23
+ readonly storyIds: readonly string[];
24
+ readonly promptTemplates: readonly string[];
25
+ readonly dispatchBinding: NativeDispatchBindingV1;
26
+ readonly dispatchBindings: readonly NativeDispatchBindingV1[];
27
+ readonly backgroundDispatch: NativeBackgroundDispatchContractV1;
28
+ readonly rationale?: string;
29
+ }
30
+ export interface NativeBackgroundAdmissionInput {
31
+ readonly directive: unknown;
32
+ readonly supportsTaskDelegation: boolean;
33
+ readonly taskDelegationCapability: 'native_safe' | 'unsupported' | 'unvalidated' | 'disabled_by_override';
34
+ readonly hostAttestation: unknown;
35
+ readonly currentGraphRevision: string;
36
+ }
37
+ export interface AuthorizedNativeBackgroundEntryV1 {
38
+ readonly storyId: string;
39
+ readonly prompt: string;
40
+ readonly binding: NativeDispatchBindingV1;
41
+ }
42
+ export type EpicBackgroundDispatchDecisionV1 = Readonly<{
43
+ kind: 'launch';
44
+ entries: readonly AuthorizedNativeBackgroundEntryV1[];
45
+ hostAttestation: NativeHostAttestationV1;
46
+ }> | Readonly<{
47
+ kind: 'reconcile-existing';
48
+ dispatchKeys: readonly string[];
49
+ reasonCode: 'native-background-reconcile-existing';
50
+ }> | Readonly<{
51
+ kind: 'inline';
52
+ reasonCode: NativeBackgroundReasonCode;
53
+ }> | Readonly<{
54
+ kind: 'denied';
55
+ reasonCode: NativeBackgroundReasonCode;
56
+ }>;
57
+ /**
58
+ * Admit only the exact P224-CON-DISPATCH chain. Missing native authority is an
59
+ * explicit inline fallback; malformed or stale authority is denied.
60
+ */
61
+ export declare function planEpicBackgroundDispatch(input: NativeBackgroundAdmissionInput): EpicBackgroundDispatchDecisionV1;
@@ -0,0 +1 @@
1
+ import{isNativeBackgroundDispatchContractV1 as b,isNativeDispatchBindingV1 as h,isNativeHostAttestationV1 as I}from"../continuity/native-agent-types.js";const i=Object.freeze({CONTRACT_INVALID:"directive-background-contract-invalid",BINDING_MISSING:"directive-background-binding-missing",WAVE_MISMATCH:"directive-background-wave-mismatch",GRAPH_STALE:"directive-background-graph-stale",CAPABILITY_UNVALIDATED:"native-background-capability-unvalidated",DEPTH_DENIED:"native-background-depth-denied",SETTLEMENT_INVALID:"native-background-settlement-invalid"}),v=/^[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)+$/,f=/^\*yolo @docs\/stories\/([A-Za-z0-9._-]+)\.story\.md(?: branchless-preparation)?$/,y=/^(?:sha256:)?[a-f0-9]{64}$/i;function D(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function C(e,t){return e.schemaVersion===t.schemaVersion&&e.storyId===t.storyId&&e.graphRevision.toLowerCase()===t.graphRevision.toLowerCase()&&e.dispatchKey.toLowerCase()===t.dispatchKey.toLowerCase()&&e.requiredCapability===t.requiredCapability&&e.maxDepth===t.maxDepth&&e.publicSafe===t.publicSafe}function p(e){return e.toLowerCase().replace(/^sha256:/,"")}function T(e,t,n){return Object.freeze({storyId:e,prompt:t,binding:Object.freeze({...n})})}function _(e){if(!e.supportsTaskDelegation||e.taskDelegationCapability!=="native_safe"||!I(e.hostAttestation))return Object.freeze({kind:"inline",reasonCode:i.CAPABILITY_UNVALIDATED});if(!D(e.directive)||e.directive.kind!=="task"||e.directive.subagentType!=="neocortex"||!b(e.directive.backgroundDispatch))return Object.freeze({kind:"denied",reasonCode:i.CONTRACT_INVALID});if(!h(e.directive.dispatchBinding)||!Array.isArray(e.directive.dispatchBindings)||e.directive.dispatchBindings.length===0||!e.directive.dispatchBindings.every(h))return Object.freeze({kind:"denied",reasonCode:i.BINDING_MISSING});if(!y.test(e.currentGraphRevision))return Object.freeze({kind:"denied",reasonCode:i.GRAPH_STALE});const t=e.directive.storyIds,n=e.directive.promptTemplates,a=e.directive.dispatchBindings;if(!Array.isArray(t)||!Array.isArray(n)||t.length===0||t.length!==n.length||t.length!==a.length||new Set(t).size!==t.length||new Set(a.map(r=>r.dispatchKey)).size!==a.length||!C(e.directive.dispatchBinding,a[0]))return Object.freeze({kind:"denied",reasonCode:i.WAVE_MISMATCH});const g=p(e.currentGraphRevision),c=[];for(let r=0;r<t.length;r+=1){const s=t[r],d=n[r],o=a[r],A=typeof d=="string"?d.match(f):null;if(typeof s!="string"||!v.test(s)||!A||A[1]!==s||o.storyId!==s)return Object.freeze({kind:"denied",reasonCode:i.WAVE_MISMATCH});if(p(o.graphRevision)!==g)return Object.freeze({kind:"denied",reasonCode:i.GRAPH_STALE});if(o.maxDepth!==1||e.directive.backgroundDispatch.maxDepth!==1)return Object.freeze({kind:"denied",reasonCode:i.DEPTH_DENIED});c.push(T(s,d,o))}return Object.freeze({kind:"launch",entries:Object.freeze(c),hostAttestation:Object.freeze({...e.hostAttestation})})}export{i as NATIVE_BACKGROUND_REASON_CODES,_ as planEpicBackgroundDispatch};
@@ -1,49 +1 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- *
5
- * P190.04 -- allowlisted headless adapter registry.
6
- */
7
- import { HEADLESS_ADAPTER_IDS, HEADLESS_REASON_CODES, isHeadlessAdapterId, redaction, } from './types.js';
8
- import { createClaudeCodeHeadlessAdapter } from './claude-code-adapter.js';
9
- import { createFakeHeadlessAdapter } from './fake-adapter.js';
10
- import { createOpenCodeHeadlessAdapter } from './opencode-adapter.js';
11
- export class HeadlessAdapterRegistry {
12
- adapters;
13
- constructor(adapters) {
14
- const map = new Map();
15
- for (const adapter of adapters) {
16
- if (!isHeadlessAdapterId(adapter.id))
17
- continue;
18
- map.set(adapter.id, adapter);
19
- }
20
- this.adapters = map;
21
- }
22
- listAdapterIds() {
23
- return HEADLESS_ADAPTER_IDS.filter((id) => this.adapters.has(id));
24
- }
25
- hasAdapter(id) {
26
- return isHeadlessAdapterId(id) && this.adapters.has(id);
27
- }
28
- getAdapter(id) {
29
- if (!isHeadlessAdapterId(id) || !this.adapters.has(id)) {
30
- return {
31
- ok: false,
32
- reasonCode: HEADLESS_REASON_CODES.RUNTIME_UNTRUSTED,
33
- reasonCodes: [HEADLESS_REASON_CODES.RUNTIME_UNTRUSTED],
34
- publicSummary: 'Headless adapter id is not allowlisted.',
35
- redactionSummary: [redaction('runtimeId', 'unsafe_key', 'value-denied')],
36
- publicSafe: true,
37
- };
38
- }
39
- return { ok: true, adapter: this.adapters.get(id), publicSafe: true };
40
- }
41
- }
42
- export function createDefaultHeadlessAdapterRegistry() {
43
- return new HeadlessAdapterRegistry([
44
- createFakeHeadlessAdapter('fake'),
45
- createFakeHeadlessAdapter('test'),
46
- createOpenCodeHeadlessAdapter(),
47
- createClaudeCodeHeadlessAdapter(),
48
- ]);
49
- }
1
+ import{HEADLESS_ADAPTER_IDS as o,HEADLESS_REASON_CODES as s,isHeadlessAdapterId as a,redaction as p}from"./types.js";import{createClaudeCodeHeadlessAdapter as i}from"./claude-code-adapter.js";import{createFakeHeadlessAdapter as d}from"./fake-adapter.js";import{createOpenCodeHeadlessAdapter as n}from"./opencode-adapter.js";class u{adapters;constructor(e){const r=new Map;for(const t of e)a(t.id)&&r.set(t.id,t);this.adapters=r}listAdapterIds(){return o.filter(e=>this.adapters.has(e))}hasAdapter(e){return a(e)&&this.adapters.has(e)}getAdapter(e){return!a(e)||!this.adapters.has(e)?{ok:!1,reasonCode:s.RUNTIME_UNTRUSTED,reasonCodes:[s.RUNTIME_UNTRUSTED],publicSummary:"Headless adapter id is not allowlisted.",redactionSummary:[p("runtimeId","unsafe_key","value-denied")],publicSafe:!0}:{ok:!0,adapter:this.adapters.get(e),publicSafe:!0}}}function S(){return new u([d("fake"),d("test"),n(),i()])}export{u as HeadlessAdapterRegistry,S as createDefaultHeadlessAdapterRegistry};
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Root-owned execution of an already admitted native background frontier.
3
+ * Host-specific APIs are injected; raw handles never leave the launch/observe
4
+ * bridge and are absent from this module's public result.
5
+ */
6
+ import { type NativeAgentDispatchReceiptV1, type NativeHostAttestationV1 } from '../../continuity/native-agent-types.js';
7
+ import { type AuthorizedNativeBackgroundEntryV1 } from '../epic-background-dispatcher.js';
8
+ export declare const NATIVE_BACKGROUND_MAX_POLLS = 30;
9
+ export interface NativeBackgroundReservationV1 {
10
+ readonly action: 'spawn-once' | 'reconcile-existing';
11
+ readonly receipt: NativeAgentDispatchReceiptV1;
12
+ }
13
+ interface PrivateNativeHostLaunchV1 {
14
+ readonly rawHandle: string;
15
+ readonly rawParentHandle?: string | null;
16
+ }
17
+ export interface NativeBackgroundRootPorts {
18
+ /**
19
+ * Root-owned continuation/session/auth preflight. Implementations may use the
20
+ * supported P224.02/P224.03 interfaces, but must return only a public reason.
21
+ */
22
+ readonly preflight: (entries: readonly AuthorizedNativeBackgroundEntryV1[], hostAttestation: NativeHostAttestationV1) => Promise<Readonly<{
23
+ ok: true;
24
+ } | {
25
+ ok: false;
26
+ reasonCode: string;
27
+ }>>;
28
+ readonly reserve: (entry: AuthorizedNativeBackgroundEntryV1, hostAttestation: NativeHostAttestationV1) => Promise<NativeBackgroundReservationV1>;
29
+ readonly launch: (entry: AuthorizedNativeBackgroundEntryV1) => Promise<PrivateNativeHostLaunchV1>;
30
+ readonly recordSpawned: (entry: AuthorizedNativeBackgroundEntryV1, reservation: NativeBackgroundReservationV1, launch: PrivateNativeHostLaunchV1) => Promise<NativeAgentDispatchReceiptV1>;
31
+ readonly reconcileExisting: (entry: AuthorizedNativeBackgroundEntryV1, reservation: NativeBackgroundReservationV1) => Promise<NativeAgentDispatchReceiptV1>;
32
+ readonly awaitSettlement: (entry: AuthorizedNativeBackgroundEntryV1, receipt: NativeAgentDispatchReceiptV1, options: Readonly<{
33
+ maxPolls: 30;
34
+ signal?: AbortSignal;
35
+ }>) => Promise<NativeAgentDispatchReceiptV1>;
36
+ }
37
+ export interface NativeBackgroundRootResultV1 {
38
+ readonly kind: 'settled';
39
+ readonly settlement: NativeAgentDispatchReceiptV1;
40
+ readonly started: readonly NativeAgentDispatchReceiptV1[];
41
+ readonly publicSafe: true;
42
+ }
43
+ export declare class NativeBackgroundRootError extends Error {
44
+ readonly reasonCode: string;
45
+ constructor(reasonCode: string);
46
+ }
47
+ /**
48
+ * Reserve the whole frontier, launch only `spawn-once` entries, reconcile
49
+ * existing dispatches, then begin settlement. No settlement is awaited before
50
+ * every entry has produced a launch/reconciliation receipt.
51
+ */
52
+ export declare function runNativeBackgroundRoot(entries: readonly AuthorizedNativeBackgroundEntryV1[], hostAttestation: NativeHostAttestationV1, ports: NativeBackgroundRootPorts, options?: Readonly<{
53
+ signal?: AbortSignal;
54
+ }>): Promise<NativeBackgroundRootResultV1>;
55
+ export interface BoundedNativeBackgroundPollResultV1 {
56
+ readonly receipt: NativeAgentDispatchReceiptV1 | null;
57
+ readonly polls: number;
58
+ readonly exhausted: boolean;
59
+ }
60
+ /** Sequential by construction: at most one poll is in flight for one dispatch. */
61
+ export declare function boundedNativeBackgroundPoll(poll: (attempt: number) => Promise<NativeAgentDispatchReceiptV1 | null>, options?: Readonly<{
62
+ maxPolls?: number;
63
+ signal?: AbortSignal;
64
+ }>): Promise<BoundedNativeBackgroundPollResultV1>;
65
+ export {};
@@ -0,0 +1 @@
1
+ import{isNativeAgentDispatchReceiptV1 as m,NATIVE_AGENT_TERMINAL_STATES as g}from"../../continuity/native-agent-types.js";import{NATIVE_BACKGROUND_REASON_CODES as d}from"../epic-background-dispatcher.js";const w=30;class c extends Error{reasonCode;constructor(a){super(a),this.reasonCode=a,this.name="NativeBackgroundRootError"}}function u(e,a){if(!m(e)||e.storyId!==a.storyId||e.dispatchKey!==a.binding.dispatchKey||e.graphRevision.replace(/^sha256:/,"").toLowerCase()!==a.binding.graphRevision.replace(/^sha256:/,"").toLowerCase()||e.topology!=="native-agent")throw new c(d.SETTLEMENT_INVALID);return e}async function T(e,a,r,o={}){if(e.length===0)throw new c(d.WAVE_MISMATCH);const n=await r.preflight(e,a);if(!n.ok)throw new c(n.reasonCode);const i=await Promise.all(e.map(t=>r.reserve(t,a))),E=await Promise.all(e.map(async(t,l)=>{const s=i[l];if(u(s.receipt,t),s.action==="reconcile-existing")return u(await r.reconcileExisting(t,s),t);const h=await r.launch(t);return u(await r.recordSpawned(t,s,h),t)}));let f;try{f=await Promise.any(E.map((t,l)=>r.awaitSettlement(e[l],t,{maxPolls:w,...o.signal?{signal:o.signal}:{}}).then(s=>{const h=u(s,e[l]);if(!g.has(h.state))throw new c(d.SETTLEMENT_INVALID);return h})))}catch{throw new c(d.SETTLEMENT_INVALID)}return Object.freeze({kind:"settled",settlement:f,started:Object.freeze([...E]),publicSafe:!0})}async function A(e,a={}){const r=Math.max(1,Math.min(w,a.maxPolls??w));let o=null,n=0;for(let i=1;i<=r&&!a.signal?.aborted;i+=1)if(o=await e(i),n=i,o&&g.has(o.state))return Object.freeze({receipt:o,polls:n,exhausted:!1});return Object.freeze({receipt:o,polls:n,exhausted:n>=r})}export{w as NATIVE_BACKGROUND_MAX_POLLS,c as NativeBackgroundRootError,A as boundedNativeBackgroundPoll,T as runNativeBackgroundRoot};
@@ -1,79 +1 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- *
5
- * P190.04 -- trusted Claude Code headless adapter interface.
6
- */
7
- import { createRejectedExecutionResult, createUnavailableExecutionResult, normalizeHeadlessCommandResult, runHeadlessCommand, validateHeadlessAdapterExecutionInput, } from './types.js';
8
- import { checkRuntimeAvailability } from './opencode-adapter.js';
9
- import { governedPreflightFailureResult, preflightManagedHeadlessProfile, withGovernedHeadlessEvidence, } from './managed-profile.js';
10
- const CLAUDE_CODE_ADAPTER_ID = 'claude-code';
11
- const CLAUDE_CODE_COMMAND = 'claude';
12
- const CLAUDE_CODE_AGENT_PROFILE = 'neocortex';
13
- export function createClaudeCodeHeadlessAdapter() {
14
- return {
15
- id: CLAUDE_CODE_ADAPTER_ID,
16
- displayName: 'Claude Code Headless Adapter',
17
- async checkAvailability(options = {}) {
18
- return checkRuntimeAvailability(CLAUDE_CODE_ADAPTER_ID, CLAUDE_CODE_COMMAND, options, {
19
- realpathBasenamePolicy: 'claude-code-versioned',
20
- versionEvidence: 'claude-code',
21
- });
22
- },
23
- buildInvocation(input) {
24
- const validation = validateHeadlessAdapterExecutionInput(input, CLAUDE_CODE_ADAPTER_ID);
25
- if (!validation.ok)
26
- return validation;
27
- return {
28
- ok: true,
29
- invocation: {
30
- adapterId: CLAUDE_CODE_ADAPTER_ID,
31
- commandName: CLAUDE_CODE_COMMAND,
32
- args: buildClaudeCodeArgs(validation.prompt, validation.input.modelId),
33
- promptHash: validation.promptHash,
34
- ...(validation.input.modelId ? { modelId: validation.input.modelId } : {}),
35
- timeoutMs: validation.input.timeoutMs ?? 10 * 60 * 1000,
36
- publicSafe: true,
37
- },
38
- publicSafe: true,
39
- };
40
- },
41
- async execute(input, options = {}) {
42
- const validation = validateHeadlessAdapterExecutionInput(input, CLAUDE_CODE_ADAPTER_ID);
43
- if (!validation.ok)
44
- return createRejectedExecutionResult(CLAUDE_CODE_ADAPTER_ID, CLAUDE_CODE_ADAPTER_ID, validation);
45
- const preflight = preflightManagedHeadlessProfile(CLAUDE_CODE_ADAPTER_ID, options);
46
- if (!preflight.ok)
47
- return governedPreflightFailureResult(CLAUDE_CODE_ADAPTER_ID, validation.input, preflight);
48
- if (options.signal?.aborted) {
49
- return withGovernedHeadlessEvidence(normalizeHeadlessCommandResult(CLAUDE_CODE_ADAPTER_ID, validation.input, {
50
- exitCode: null, signal: 'SIGTERM', timedOut: false, cancelled: true, durationMs: 0,
51
- stdout: '', stderr: '', stdoutBytes: 0, stderrBytes: 0,
52
- }));
53
- }
54
- const availability = await this.checkAvailability(options);
55
- if (!availability.ok)
56
- return withGovernedHeadlessEvidence(createUnavailableExecutionResult(CLAUDE_CODE_ADAPTER_ID, validation.input, availability));
57
- const invocation = this.buildInvocation(validation.input);
58
- if (!invocation.ok)
59
- return createRejectedExecutionResult(CLAUDE_CODE_ADAPTER_ID, CLAUDE_CODE_ADAPTER_ID, invocation);
60
- const runner = options.commandRunner ?? runHeadlessCommand;
61
- const result = await runner(availability.executablePath ?? CLAUDE_CODE_COMMAND, invocation.invocation.args, {
62
- cwd: options.cwd,
63
- env: options.env,
64
- timeoutMs: invocation.invocation.timeoutMs,
65
- maxOutputBytes: options.maxOutputBytes,
66
- signal: options.signal,
67
- ...(validation.input.receipt?.jobId ? { localConsole: { projectRoot: options.cwd, jobId: validation.input.receipt.jobId, attemptId: validation.input.receipt.attemptId, executionId: validation.input.receipt.executionId, publicSafe: true } } : {}),
68
- });
69
- return withGovernedHeadlessEvidence(normalizeHeadlessCommandResult(CLAUDE_CODE_ADAPTER_ID, validation.input, result));
70
- },
71
- };
72
- }
73
- function buildClaudeCodeArgs(prompt, modelId) {
74
- const args = ['--agent', CLAUDE_CODE_AGENT_PROFILE];
75
- if (modelId)
76
- args.push('--model', modelId);
77
- args.push('-p', prompt);
78
- return args;
79
- }
1
+ import{createRejectedExecutionResult as c,createUnavailableExecutionResult as m,normalizeHeadlessCommandResult as l,runHeadlessCommand as v,validateHeadlessAdapterExecutionInput as s}from"./types.js";import{checkRuntimeAvailability as f}from"./opencode-adapter.js";import{governedPreflightFailureResult as C,preflightManagedHeadlessProfile as I,withGovernedHeadlessEvidence as u}from"./managed-profile.js";const a="claude-code",o="claude",b="neocortex";function y(){return{id:a,displayName:"Claude Code Headless Adapter",async checkAvailability(i={}){return f(a,o,i,{realpathBasenamePolicy:"claude-code-versioned",versionEvidence:"claude-code"})},buildInvocation(i){const e=s(i,a);return e.ok?{ok:!0,invocation:{adapterId:a,commandName:o,args:h(e.prompt,e.input.modelId),promptHash:e.promptHash,...e.input.modelId?{modelId:e.input.modelId}:{},timeoutMs:e.input.timeoutMs??600*1e3,publicSafe:!0},publicSafe:!0}:e},async execute(i,e={}){const t=s(i,a);if(!t.ok)return c(a,a,t);const d=I(a,e);if(!d.ok)return C(a,t.input,d);if(e.signal?.aborted)return u(l(a,t.input,{exitCode:null,signal:"SIGTERM",timedOut:!1,cancelled:!0,durationMs:0,stdout:"",stderr:"",stdoutBytes:0,stderrBytes:0}));const r=await this.checkAvailability(e);if(!r.ok)return u(m(a,t.input,r));const n=this.buildInvocation(t.input);if(!n.ok)return c(a,a,n);const p=await(e.commandRunner??v)(r.executablePath??o,n.invocation.args,{cwd:e.cwd,env:e.env,timeoutMs:n.invocation.timeoutMs,maxOutputBytes:e.maxOutputBytes,signal:e.signal,...t.input.receipt?.jobId?{localConsole:{projectRoot:e.cwd,jobId:t.input.receipt.jobId,attemptId:t.input.receipt.attemptId,executionId:t.input.receipt.executionId,publicSafe:!0}}:{}});return u(l(a,t.input,p))}}}function h(i,e){const t=["--agent",b];return e&&t.push("--model",e),t.push("-p",i),t}export{y as createClaudeCodeHeadlessAdapter};