@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
@@ -1,63 +1 @@
1
- /** Bounded host renewal preserves the existing C01 owner, origin and session pin. */
2
- import { resolve } from 'node:path';
3
- import { acquireGitLifecyclePhysicalIntegrationLock, mutateGitLifecycleRuntime, readGitLifecycleRuntime, releaseGitLifecyclePhysicalIntegrationLock } from '../git/git-lifecycle-store.js';
4
- import { resumePrivateYoloIsolatedSession } from './isolated-session.js';
5
- export async function renewPrivateYoloSessionLease(projectRoot, storyId, graphRevision, input) {
6
- const root = resolve(projectRoot), now = Date.now(), requested = Date.parse(input.expiresAt);
7
- if (input.executorStopped !== true || !/^[a-f0-9]{40,64}$/.test(input.expectedSnapshotSha)
8
- || !Number.isFinite(requested) || requested <= now || requested > now + 60 * 60 * 1000) {
9
- throw new Error('private-execution-session-renewal-input-invalid');
10
- }
11
- const before = await readGitLifecycleRuntime(root, { required: true });
12
- const epicId = storyId.split('.')[0], epic = before.epics[epicId], rawLease = epic?.branch_lease;
13
- const lease = rawLease && typeof rawLease === 'object' && !Array.isArray(rawLease)
14
- ? rawLease : undefined;
15
- if (!lease || lease.schemaVersion !== 1 || lease.ownerStoryId !== storyId || lease.sessionId !== lease.idempotencyKey
16
- || typeof lease.sessionId !== 'string' || epic?.graph_revision !== graphRevision
17
- || typeof lease.expiresAt !== 'string' || !Number.isFinite(Date.parse(lease.expiresAt)) || Date.parse(lease.expiresAt) <= now
18
- || requested < Date.parse(lease.expiresAt) || !epic.origin_binding) {
19
- throw new Error('private-execution-session-renewal-authority-invalid');
20
- }
21
- const sessionId = lease.sessionId, previousExpiresAt = lease.expiresAt;
22
- const lock = await acquireGitLifecyclePhysicalIntegrationLock(root, { kind: 'direct', storyId,
23
- sessionId, idempotencyKey: sessionId,
24
- expiresAt: new Date(now + 5 * 60_000).toISOString(), persistent: false });
25
- if (!lock.ok)
26
- throw new Error('private-execution-session-renewal-backpressure');
27
- try {
28
- const session = await resumePrivateYoloIsolatedSession(root, storyId, graphRevision);
29
- if (session.snapshotSha !== input.expectedSnapshotSha || session.setupSessionId !== sessionId
30
- || session.workspace.baseSha !== lease.setupHeadSha)
31
- throw new Error('private-execution-session-renewal-pin-invalid');
32
- const expiresAt = new Date(requested).toISOString();
33
- let revision = before.revision;
34
- if (Date.parse(previousExpiresAt) !== requested) {
35
- const mutation = await mutateGitLifecycleRuntime(root, document => {
36
- const current = document.epics[epicId];
37
- if (!current || JSON.stringify(current.origin_binding) !== JSON.stringify(epic.origin_binding)
38
- || JSON.stringify(current.branch_lease) !== JSON.stringify(lease)
39
- || current.graph_revision !== graphRevision)
40
- throw new Error('private-execution-session-renewal-raced');
41
- current.branch_lease = { ...lease, expiresAt };
42
- }, { expectedRevision: before.revision, preCommit: async () => {
43
- if (Date.parse(previousExpiresAt) <= Date.now())
44
- throw new Error('private-execution-session-renewal-expired');
45
- const fresh = await resumePrivateYoloIsolatedSession(root, storyId, graphRevision);
46
- if (fresh.snapshotSha !== input.expectedSnapshotSha || fresh.setupSessionId !== sessionId) {
47
- throw new Error('private-execution-session-renewal-raced');
48
- }
49
- } });
50
- revision = mutation.document.revision;
51
- }
52
- return { schemaVersion: 'PrivateYoloSessionLeaseRenewal/1', storyId, graphRevision,
53
- snapshotSha: session.snapshotSha, sourceHead: session.workspace.baseSha,
54
- previousExpiresAt, expiresAt, revision,
55
- reused: Date.parse(previousExpiresAt) === requested, sessionPinPreserved: true,
56
- originPreserved: true, checkpointAccepted: false, publicSafe: true };
57
- }
58
- finally {
59
- if (!await releaseGitLifecyclePhysicalIntegrationLock(lock.path, lock.owner)) {
60
- throw new Error('private-execution-session-renewal-lock-unverified');
61
- }
62
- }
63
- }
1
+ import{resolve as g}from"node:path";import{acquireGitLifecyclePhysicalIntegrationLock as b,mutateGitLifecycleRuntime as A,readGitLifecycleRuntime as D,releaseGitLifecyclePhysicalIntegrationLock as k}from"../git/git-lifecycle-store.js";import{resumePrivateYoloIsolatedSession as m}from"./isolated-session.js";async function P(y,r,s,t){const n=g(y),c=Date.now(),i=Date.parse(t.expiresAt);if(t.executorStopped!==!0||!/^[a-f0-9]{40,64}$/.test(t.expectedSnapshotSha)||!Number.isFinite(i)||i<=c||i>c+3600*1e3)throw new Error("private-execution-session-renewal-input-invalid");const h=await D(n,{required:!0}),S=r.split(".")[0],p=h.epics[S],w=p?.branch_lease,e=w&&typeof w=="object"&&!Array.isArray(w)?w:void 0;if(!e||e.schemaVersion!==1||e.ownerStoryId!==r||e.sessionId!==e.idempotencyKey||typeof e.sessionId!="string"||p?.graph_revision!==s||typeof e.expiresAt!="string"||!Number.isFinite(Date.parse(e.expiresAt))||Date.parse(e.expiresAt)<=c||i<Date.parse(e.expiresAt)||!p.origin_binding)throw new Error("private-execution-session-renewal-authority-invalid");const l=e.sessionId,u=e.expiresAt,f=await b(n,{kind:"direct",storyId:r,sessionId:l,idempotencyKey:l,expiresAt:new Date(c+5*6e4).toISOString(),persistent:!1});if(!f.ok)throw new Error("private-execution-session-renewal-backpressure");try{const o=await m(n,r,s);if(o.snapshotSha!==t.expectedSnapshotSha||o.setupSessionId!==l||o.workspace.baseSha!==e.setupHeadSha)throw new Error("private-execution-session-renewal-pin-invalid");const x=new Date(i).toISOString();let v=h.revision;return Date.parse(u)!==i&&(v=(await A(n,d=>{const a=d.epics[S];if(!a||JSON.stringify(a.origin_binding)!==JSON.stringify(p.origin_binding)||JSON.stringify(a.branch_lease)!==JSON.stringify(e)||a.graph_revision!==s)throw new Error("private-execution-session-renewal-raced");a.branch_lease={...e,expiresAt:x}},{expectedRevision:h.revision,preCommit:async()=>{if(Date.parse(u)<=Date.now())throw new Error("private-execution-session-renewal-expired");const d=await m(n,r,s);if(d.snapshotSha!==t.expectedSnapshotSha||d.setupSessionId!==l)throw new Error("private-execution-session-renewal-raced")}})).document.revision),{schemaVersion:"PrivateYoloSessionLeaseRenewal/1",storyId:r,graphRevision:s,snapshotSha:o.snapshotSha,sourceHead:o.workspace.baseSha,previousExpiresAt:u,expiresAt:x,revision:v,reused:Date.parse(u)===i,sessionPinPreserved:!0,originPreserved:!0,checkpointAccepted:!1,publicSafe:!0}}finally{if(!await k(f.path,f.owner))throw new Error("private-execution-session-renewal-lock-unverified")}}export{P as renewPrivateYoloSessionLease};
@@ -1,50 +1 @@
1
- /** Standalone-client shadows of public private-execution admission contracts. */
2
- const PROPERTY_STEP = `step-${'a8ce5c64'}`;
3
- const VALIDATE_STEP = `step-${'b2fe7cb5'}`;
4
- const QA_STEP = `step-${'8721319d'}`;
5
- export function isPrivateYoloSkippedPredecessors(value) {
6
- return Array.isArray(value) && value.length <= 1 && value.every(item => {
7
- if (!item || typeof item !== 'object' || Array.isArray(item))
8
- return false;
9
- const record = item;
10
- return Object.keys(record).sort().join('|') === ['stepId', 'featureFlagId', 'enabled', 'tier', 'publicSafe'].sort().join('|')
11
- && record.stepId === PROPERTY_STEP && record.featureFlagId === 'property-testing'
12
- && typeof record.enabled === 'boolean' && ['free', 'pro', 'enterprise'].includes(String(record.tier))
13
- && (record.enabled === false || record.tier === 'free') && record.publicSafe === true;
14
- });
15
- }
16
- export function isPrivateQaSkippedPredecessors(value) {
17
- if (!Array.isArray(value) || value.length > 2)
18
- return false;
19
- const ids = [];
20
- for (const item of value) {
21
- if (isPrivateYoloSkippedPredecessors([item])) {
22
- ids.push(item.stepId);
23
- continue;
24
- }
25
- if (!item || typeof item !== 'object' || Array.isArray(item))
26
- return false;
27
- const record = item;
28
- if (Object.keys(record).sort().join('|') !== ['stepId', 'featureGate', 'reason', 'tier', 'publicSafe'].sort().join('|')
29
- || record.stepId !== VALIDATE_STEP || record.featureGate !== 'validate-tests'
30
- || record.reason !== 'subscription-tier' || record.tier !== 'free' || record.publicSafe !== true)
31
- return false;
32
- ids.push(record.stepId);
33
- }
34
- return new Set(ids).size === ids.length && (value.length < 2
35
- || ids[0] === PROPERTY_STEP && ids[1] === VALIDATE_STEP && value[0].tier === 'free');
36
- }
37
- export function isPrivateQaStructuralAdmission(value) {
38
- if (!value || typeof value !== 'object' || Array.isArray(value))
39
- return false;
40
- const record = value, checks = record.checks;
41
- return Object.keys(record).sort().join('|') === ['schemaVersion', 'kind', 'stepId', 'generationId', 'graphRevision', 'topologyGenerationId', 'tier', 'checks', 'publicSafe'].sort().join('|')
42
- && record.schemaVersion === 1 && record.kind === 'server-private-qa-structural-admission' && record.stepId === QA_STEP
43
- && typeof record.generationId === 'string' && /^sha256:[a-f0-9]{64}$/.test(record.generationId)
44
- && typeof record.graphRevision === 'string' && /^[a-f0-9]{64}$/.test(record.graphRevision)
45
- && typeof record.topologyGenerationId === 'string' && /^sha256:[a-f0-9]{64}$/.test(record.topologyGenerationId)
46
- && ['free', 'pro', 'enterprise'].includes(String(record.tier)) && record.publicSafe === true
47
- && !!checks && typeof checks === 'object' && !Array.isArray(checks)
48
- && Object.keys(checks).sort().join('|') === ['classifiedAssetDelivery', 'licensedCommandAdmission', 'registeredStatusMapping', 'prerequisiteStateAdmitted'].sort().join('|')
49
- && Object.values(checks).every(result => result === true);
50
- }
1
+ const i="step-a8ce5c64",o="step-b2fe7cb5",n="step-8721319d";function a(t){return Array.isArray(t)&&t.length<=1&&t.every(e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;const r=e;return Object.keys(r).sort().join("|")===["stepId","featureFlagId","enabled","tier","publicSafe"].sort().join("|")&&r.stepId===i&&r.featureFlagId==="property-testing"&&typeof r.enabled=="boolean"&&["free","pro","enterprise"].includes(String(r.tier))&&(r.enabled===!1||r.tier==="free")&&r.publicSafe===!0})}function p(t){if(!Array.isArray(t)||t.length>2)return!1;const e=[];for(const r of t){if(a([r])){e.push(r.stepId);continue}if(!r||typeof r!="object"||Array.isArray(r))return!1;const s=r;if(Object.keys(s).sort().join("|")!==["stepId","featureGate","reason","tier","publicSafe"].sort().join("|")||s.stepId!==o||s.featureGate!=="validate-tests"||s.reason!=="subscription-tier"||s.tier!=="free"||s.publicSafe!==!0)return!1;e.push(s.stepId)}return new Set(e).size===e.length&&(t.length<2||e[0]===i&&e[1]===o&&t[0].tier==="free")}function c(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t,r=e.checks;return Object.keys(e).sort().join("|")===["schemaVersion","kind","stepId","generationId","graphRevision","topologyGenerationId","tier","checks","publicSafe"].sort().join("|")&&e.schemaVersion===1&&e.kind==="server-private-qa-structural-admission"&&e.stepId===n&&typeof e.generationId=="string"&&/^sha256:[a-f0-9]{64}$/.test(e.generationId)&&typeof e.graphRevision=="string"&&/^[a-f0-9]{64}$/.test(e.graphRevision)&&typeof e.topologyGenerationId=="string"&&/^sha256:[a-f0-9]{64}$/.test(e.topologyGenerationId)&&["free","pro","enterprise"].includes(String(e.tier))&&e.publicSafe===!0&&!!r&&typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).sort().join("|")===["classifiedAssetDelivery","licensedCommandAdmission","registeredStatusMapping","prerequisiteStateAdmitted"].sort().join("|")&&Object.values(r).every(s=>s===!0)}export{p as isPrivateQaSkippedPredecessors,c as isPrivateQaStructuralAdmission,a as isPrivateYoloSkippedPredecessors};
@@ -1,66 +1 @@
1
- /** Standalone-client shadow of bounded project validation declarations. */
2
- export const PROJECT_VALIDATION_KINDS = ['unit', 'integration', 'contract', 'bdd-example', 'e2e'];
3
- export function readProjectValidationCommands(storyId, sources) {
4
- const byKind = new Map();
5
- let declared = false, invalid = false;
6
- const allowedPaths = new Set(['story', 'spec', 'tasks'].map(suffix => `docs/stories/${storyId}.${suffix}.md`));
7
- if (sources.length > 3 || new Set(sources.map(source => source.path)).size !== sources.length) {
8
- return { declared: true, invalid: true, commands: [] };
9
- }
10
- for (const source of sources) {
11
- if (!allowedPaths.has(source.path) || Buffer.byteLength(source.content) > 131072) {
12
- invalid = true;
13
- declared = true;
14
- continue;
15
- }
16
- let active = false, fenced = false, headings = 0, entries = 0;
17
- for (const raw of source.content.split(/\r?\n/)) {
18
- const line = raw.trim();
19
- if (/^(?:```|~~~)/.test(line)) {
20
- fenced = !fenced;
21
- continue;
22
- }
23
- if (fenced)
24
- continue;
25
- if (/^##\s+/.test(line)) {
26
- if (active && entries === 0)
27
- invalid = true;
28
- active = line === '## Validation Commands';
29
- if (active) {
30
- declared = true;
31
- headings++;
32
- entries = 0;
33
- if (headings > 1)
34
- invalid = true;
35
- }
36
- continue;
37
- }
38
- if (!active || !line)
39
- continue;
40
- const match = /^- (unit|integration|contract|bdd-example|e2e): `([^`]{1,220})`$/.exec(line);
41
- if (!match) {
42
- invalid = true;
43
- continue;
44
- }
45
- const kind = match[1], command = match[2];
46
- if (!/^[A-Za-z0-9_./-]+(?: [A-Za-z0-9_./:@%+=,-]+)*$/.test(command)
47
- || /(?:token|password|license_key|secret|credential)=|(?:https?|ssh):\/\/|@[^ /]+\.[A-Za-z]/i.test(command)
48
- || command.split(' ').some(argument => argument.split('/').includes('..'))) {
49
- invalid = true;
50
- continue;
51
- }
52
- entries++;
53
- const prior = byKind.get(kind);
54
- if (prior && prior.command !== command || prior?.sourcePaths.includes(source.path)) {
55
- invalid = true;
56
- continue;
57
- }
58
- byKind.set(kind, { kind, command, sourcePaths: [...(prior?.sourcePaths ?? []), source.path] });
59
- }
60
- if (active && entries === 0)
61
- invalid = true;
62
- }
63
- if (declared && !byKind.has('unit'))
64
- invalid = true;
65
- return { declared, invalid, commands: [...byKind.values()] };
66
- }
1
+ const P=["unit","integration","contract","bdd-example","e2e"];function x(p,a){const o=new Map;let c=!1,t=!1;const h=new Set(["story","spec","tasks"].map(e=>`docs/stories/${p}.${e}.md`));if(a.length>3||new Set(a.map(e=>e.path)).size!==a.length)return{declared:!0,invalid:!0,commands:[]};for(const e of a){if(!h.has(e.path)||Buffer.byteLength(e.content)>131072){t=!0,c=!0;continue}let n=!1,d=!1,m=0,r=0;for(const g of e.content.split(/\r?\n/)){const i=g.trim();if(/^(?:```|~~~)/.test(i)){d=!d;continue}if(d)continue;if(/^##\s+/.test(i)){n&&r===0&&(t=!0),n=i==="## Validation Commands",n&&(c=!0,m++,r=0,m>1&&(t=!0));continue}if(!n||!i)continue;const l=/^- (unit|integration|contract|bdd-example|e2e): `([^`]{1,220})`$/.exec(i);if(!l){t=!0;continue}const f=l[1],s=l[2];if(!/^[A-Za-z0-9_./-]+(?: [A-Za-z0-9_./:@%+=,-]+)*$/.test(s)||/(?:token|password|license_key|secret|credential)=|(?:https?|ssh):\/\/|@[^ /]+\.[A-Za-z]/i.test(s)||s.split(" ").some(w=>w.split("/").includes(".."))){t=!0;continue}r++;const u=o.get(f);if(u&&u.command!==s||u?.sourcePaths.includes(e.path)){t=!0;continue}o.set(f,{kind:f,command:s,sourcePaths:[...u?.sourcePaths??[],e.path]})}n&&r===0&&(t=!0)}return c&&!o.has("unit")&&(t=!0),{declared:c,invalid:t,commands:[...o.values()]}}export{P as PROJECT_VALIDATION_KINDS,x as readProjectValidationCommands};
@@ -1,61 +1 @@
1
- /** Standalone-client shadow of the public root-memory effect contract. */
2
- import { getProjectMemoryTarget, listProjectMemoryTargets } from '../memory/shared-project-memory-types.js';
3
- export { getProjectMemoryTarget, listProjectMemoryTargets };
4
- export function canonicalRootMemoryEffectJson(effect) {
5
- const ordered = (value) => Array.isArray(value) ? value.map(ordered)
6
- : value !== null && typeof value === 'object'
7
- ? Object.fromEntries(Object.keys(value).sort().map(key => [key, ordered(value[key])]))
8
- : value;
9
- return JSON.stringify(ordered(effect));
10
- }
11
- export function rootProjectMemoryPaths() {
12
- return [...new Set(['NEOCORTEX.md', ...listProjectMemoryTargets().flatMap(target => [target.primaryFile,
13
- ...target.secondaryFiles.filter(file => file.scope === 'project').map(file => file.path)])])].sort();
14
- }
15
- export function isRootProjectMemoryEffect(value) {
16
- const record = (candidate) => candidate !== null && typeof candidate === 'object' && !Array.isArray(candidate)
17
- ? candidate : undefined;
18
- const effect = record(value);
19
- const keys = ['schemaVersion', 'producer', 'storyId', 'epicId', 'executionBranch', 'sourceHeadSha',
20
- 'sourceSnapshotSha', 'memorySnapshotSha', 'graphRevision', 'childClaimRevision', 'setupSessionId',
21
- 'rootQaReceiptId', 'proposalSha256', 'canonicalSha256', 'projectionSha256', 'projectionFileCount', 'files', 'recordedAt', 'publicSafe'];
22
- if (!effect || Object.keys(effect).sort().join('|') !== keys.sort().join('|')
23
- || effect.schemaVersion !== 'RootProjectMemoryEffect/1' || effect.producer !== 'root-project-memory'
24
- || effect.publicSafe !== true || typeof effect.storyId !== 'string'
25
- || !/^P[1-9][0-9]*\.[0-9]+$/.test(effect.storyId) || effect.epicId !== effect.storyId.split('.')[0]
26
- || effect.executionBranch !== `epic/${effect.epicId}`
27
- || ['sourceHeadSha', 'sourceSnapshotSha', 'memorySnapshotSha'].some(key => typeof effect[key] !== 'string' || !/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(effect[key]))
28
- || ['graphRevision', 'childClaimRevision', 'rootQaReceiptId', 'proposalSha256', 'canonicalSha256', 'projectionSha256'].some(key => typeof effect[key] !== 'string' || !/^[a-f0-9]{64}$/.test(effect[key]))
29
- || typeof effect.setupSessionId !== 'string' || !/^setup-[a-f0-9]{64}$/.test(effect.setupSessionId)
30
- || typeof effect.recordedAt !== 'string' || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(effect.recordedAt)
31
- || !Number.isFinite(Date.parse(effect.recordedAt)) || new Date(effect.recordedAt).toISOString() !== effect.recordedAt
32
- || !Number.isSafeInteger(effect.projectionFileCount) || effect.projectionFileCount < 1
33
- || effect.projectionFileCount > 128 || !Array.isArray(effect.files) || effect.files.length > 128)
34
- return false;
35
- const allowed = new Set(rootProjectMemoryPaths()), seen = new Set();
36
- const state = (candidate, path, after) => {
37
- const item = record(candidate);
38
- if (!item || !['absent', 'regular', 'symlink'].includes(String(item.kind))
39
- || Object.keys(item).sort().join('|') !== ['kind', 'sha256', ...(item.kind === 'symlink' ? ['linkTarget'] : [])].sort().join('|'))
40
- return false;
41
- if (item.kind === 'absent')
42
- return !after && item.sha256 === null;
43
- if (typeof item.sha256 !== 'string' || !/^[a-f0-9]{64}$/.test(item.sha256))
44
- return false;
45
- if (path === 'NEOCORTEX.md' && item.kind !== 'regular')
46
- return false;
47
- const canonicalTarget = '../'.repeat(path.split('/').length - 1) + 'NEOCORTEX.md';
48
- return item.kind !== 'symlink' || typeof item.linkTarget === 'string' && item.linkTarget.length <= 1024
49
- && (after ? item.linkTarget === canonicalTarget
50
- : item.linkTarget.split('/').filter(part => part !== '.').join('/') === canonicalTarget);
51
- };
52
- return effect.files.every(candidate => {
53
- const file = record(candidate);
54
- if (!file || Object.keys(file).sort().join('|') !== 'after|before|path' || typeof file.path !== 'string'
55
- || !allowed.has(file.path) || seen.has(file.path) || !state(file.before, file.path, false)
56
- || !state(file.after, file.path, true))
57
- return false;
58
- seen.add(file.path);
59
- return true;
60
- });
61
- }
1
+ import{getProjectMemoryTarget as u,listProjectMemoryTargets as l}from"../memory/shared-project-memory-types.js";function S(n){const s=e=>Array.isArray(e)?e.map(s):e!==null&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(i=>[i,s(e[i])])):e;return JSON.stringify(s(n))}function y(){return[...new Set(["NEOCORTEX.md",...l().flatMap(n=>[n.primaryFile,...n.secondaryFiles.filter(s=>s.scope==="project").map(s=>s.path)])])].sort()}function g(n){const s=t=>t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0,e=s(n),i=["schemaVersion","producer","storyId","epicId","executionBranch","sourceHeadSha","sourceSnapshotSha","memorySnapshotSha","graphRevision","childClaimRevision","setupSessionId","rootQaReceiptId","proposalSha256","canonicalSha256","projectionSha256","projectionFileCount","files","recordedAt","publicSafe"];if(!e||Object.keys(e).sort().join("|")!==i.sort().join("|")||e.schemaVersion!=="RootProjectMemoryEffect/1"||e.producer!=="root-project-memory"||e.publicSafe!==!0||typeof e.storyId!="string"||!/^P[1-9][0-9]*\.[0-9]+$/.test(e.storyId)||e.epicId!==e.storyId.split(".")[0]||e.executionBranch!==`epic/${e.epicId}`||["sourceHeadSha","sourceSnapshotSha","memorySnapshotSha"].some(t=>typeof e[t]!="string"||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(e[t]))||["graphRevision","childClaimRevision","rootQaReceiptId","proposalSha256","canonicalSha256","projectionSha256"].some(t=>typeof e[t]!="string"||!/^[a-f0-9]{64}$/.test(e[t]))||typeof e.setupSessionId!="string"||!/^setup-[a-f0-9]{64}$/.test(e.setupSessionId)||typeof e.recordedAt!="string"||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e.recordedAt)||!Number.isFinite(Date.parse(e.recordedAt))||new Date(e.recordedAt).toISOString()!==e.recordedAt||!Number.isSafeInteger(e.projectionFileCount)||e.projectionFileCount<1||e.projectionFileCount>128||!Array.isArray(e.files)||e.files.length>128)return!1;const d=new Set(y()),a=new Set,c=(t,o,p)=>{const r=s(t);if(!r||!["absent","regular","symlink"].includes(String(r.kind))||Object.keys(r).sort().join("|")!==["kind","sha256",...r.kind==="symlink"?["linkTarget"]:[]].sort().join("|"))return!1;if(r.kind==="absent")return!p&&r.sha256===null;if(typeof r.sha256!="string"||!/^[a-f0-9]{64}$/.test(r.sha256)||o==="NEOCORTEX.md"&&r.kind!=="regular")return!1;const f="../".repeat(o.split("/").length-1)+"NEOCORTEX.md";return r.kind!=="symlink"||typeof r.linkTarget=="string"&&r.linkTarget.length<=1024&&(p?r.linkTarget===f:r.linkTarget.split("/").filter(h=>h!==".").join("/")===f)};return e.files.every(t=>{const o=s(t);return!o||Object.keys(o).sort().join("|")!=="after|before|path"||typeof o.path!="string"||!d.has(o.path)||a.has(o.path)||!c(o.before,o.path,!1)||!c(o.after,o.path,!0)?!1:(a.add(o.path),!0)})}export{S as canonicalRootMemoryEffectJson,u as getProjectMemoryTarget,g as isRootProjectMemoryEffect,l as listProjectMemoryTargets,y as rootProjectMemoryPaths};