@ornexus/neocortex 4.60.67 → 4.60.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/dist/release-source.json +1 -1
  2. package/dist/sbom.cdx.json +1194 -1194
  3. package/install.sh +1 -1
  4. package/package.json +2 -2
  5. package/packages/client/dist/adapters/adapter-registry.js +108 -1
  6. package/packages/client/dist/adapters/antigravity-adapter.js +77 -2
  7. package/packages/client/dist/adapters/claude-code-adapter.js +79 -3
  8. package/packages/client/dist/adapters/codex-adapter.js +80 -2
  9. package/packages/client/dist/adapters/cursor-adapter.js +115 -4
  10. package/packages/client/dist/adapters/gemini-adapter.js +71 -2
  11. package/packages/client/dist/adapters/grok-adapter.js +42 -2
  12. package/packages/client/dist/adapters/index.js +22 -1
  13. package/packages/client/dist/adapters/platform-detector.js +212 -1
  14. package/packages/client/dist/adapters/target-adapter.js +12 -0
  15. package/packages/client/dist/adapters/vscode-adapter.js +72 -2
  16. package/packages/client/dist/agent/refresh-stubs.js +417 -2
  17. package/packages/client/dist/agent/update-agent-yaml.js +102 -1
  18. package/packages/client/dist/agent/update-description.js +251 -1
  19. package/packages/client/dist/cache/crypto-utils.js +78 -1
  20. package/packages/client/dist/cache/encrypted-cache.js +108 -1
  21. package/packages/client/dist/cache/in-memory-asset-cache.js +73 -1
  22. package/packages/client/dist/cache/index.js +13 -1
  23. package/packages/client/dist/cache/protected-pi-boundary.js +44 -1
  24. package/packages/client/dist/checkpoint/checkpoint-client-reader.js +127 -2
  25. package/packages/client/dist/checkpoint/index.js +11 -1
  26. package/packages/client/dist/checkpoint/shared-checkpoint-types.js +32 -1
  27. package/packages/client/dist/cli.js +290 -3
  28. package/packages/client/dist/commands/activate.js +394 -8
  29. package/packages/client/dist/commands/architecture-answers.js +274 -7
  30. package/packages/client/dist/commands/architecture-memory-terminal.js +253 -4
  31. package/packages/client/dist/commands/architecture-non-ui-continuation.js +100 -1
  32. package/packages/client/dist/commands/architecture-root-binding.js +51 -1
  33. package/packages/client/dist/commands/cache-status.js +112 -2
  34. package/packages/client/dist/commands/config.js +88 -1
  35. package/packages/client/dist/commands/doctor.js +635 -2
  36. package/packages/client/dist/commands/invoke.js +7140 -142
  37. package/packages/client/dist/commands/legacy-epic-terminal.js +71 -1
  38. package/packages/client/dist/commands/legacy-story-branch.js +96 -1
  39. package/packages/client/dist/commands/legacy-story-pr.js +276 -1
  40. package/packages/client/dist/commands/mutation-qa-checkpoint.js +285 -5
  41. package/packages/client/dist/commands/mutation-qa-gate.js +54 -1
  42. package/packages/client/dist/commands/mutation-qa-git.js +41 -1
  43. package/packages/client/dist/commands/mutation-qa-policy.js +102 -1
  44. package/packages/client/dist/commands/mutation-qa-run.js +219 -3
  45. package/packages/client/dist/commands/mutation-qa-verdict.js +149 -1
  46. package/packages/client/dist/commands/mutation-qa.js +220 -1
  47. package/packages/client/dist/commands/native-agent.js +136 -2
  48. package/packages/client/dist/commands/planning-diagnosis.js +43 -1
  49. package/packages/client/dist/commands/planning-generation.js +53 -1
  50. package/packages/client/dist/commands/planning-memory.js +40 -1
  51. package/packages/client/dist/commands/planning-research.js +42 -1
  52. package/packages/client/dist/commands/private-session.js +75 -1
  53. package/packages/client/dist/commands/property-qa.js +139 -1
  54. package/packages/client/dist/commands/qa-control.js +16 -1
  55. package/packages/client/dist/commands/qa-scan-browser-launch.js +55 -1
  56. package/packages/client/dist/commands/qa-scan-browser-route.js +28 -1
  57. package/packages/client/dist/commands/qa-scan-capture.js +663 -5
  58. package/packages/client/dist/commands/qa-scan-discovery.js +376 -3
  59. package/packages/client/dist/commands/qa-scan-review.js +826 -5
  60. package/packages/client/dist/commands/qa-synthetic-backend-capture.js +266 -1
  61. package/packages/client/dist/commands/qa-synthetic-backend-review.js +297 -1
  62. package/packages/client/dist/commands/qa-synthetic-backend.js +340 -2
  63. package/packages/client/dist/commands/qa-synthetic-broker-port.js +85 -1
  64. package/packages/client/dist/commands/qa-synthetic-browser.js +39 -1
  65. package/packages/client/dist/commands/refactor-characterization.js +671 -21
  66. package/packages/client/dist/commands/refactor-commit.js +399 -13
  67. package/packages/client/dist/commands/refactor-control.js +142 -3
  68. package/packages/client/dist/commands/refactor-cpp-assertions.js +93 -3
  69. package/packages/client/dist/commands/refactor-review.js +283 -5
  70. package/packages/client/dist/commands/refactor-root.js +588 -7
  71. package/packages/client/dist/commands/refresh-memory.js +156 -3
  72. package/packages/client/dist/commands/shared-architecture-non-ui.js +24 -1
  73. package/packages/client/dist/commands/story-checkpoint.js +171 -1
  74. package/packages/client/dist/config/profile-directory.js +13 -1
  75. package/packages/client/dist/config/resolver-selection.js +278 -1
  76. package/packages/client/dist/config/secure-config.js +281 -12
  77. package/packages/client/dist/config.js +223 -2
  78. package/packages/client/dist/constants.js +25 -1
  79. package/packages/client/dist/context/context-collector.js +222 -2
  80. package/packages/client/dist/context/context-sanitizer.js +145 -1
  81. package/packages/client/dist/continuity/autonomous-governance.js +285 -1
  82. package/packages/client/dist/continuity/continuity-client-state-store.js +1587 -1
  83. package/packages/client/dist/continuity/invoke-hooks.js +129 -1
  84. package/packages/client/dist/continuity/migrations/001-initial-schema.js +12 -2
  85. package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +12 -2
  86. package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +12 -2
  87. package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +12 -2
  88. package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +12 -2
  89. package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +10 -2
  90. package/packages/client/dist/continuity/native-agent-store.js +69 -1
  91. package/packages/client/dist/continuity/native-agent-types.js +90 -1
  92. package/packages/client/dist/continuity/outbox.js +117 -1
  93. package/packages/client/dist/continuity/runner-bootstrap-policy.js +172 -1
  94. package/packages/client/dist/continuity/sqlite-store.js +2536 -81
  95. package/packages/client/dist/effects/invoke-effect-gateways.js +62 -1
  96. package/packages/client/dist/errors/error-messages.js +228 -2
  97. package/packages/client/dist/errors/frontmatter-diagnostics.js +125 -1
  98. package/packages/client/dist/evidence/collector.js +347 -1
  99. package/packages/client/dist/evidence/index.js +1 -1
  100. package/packages/client/dist/evidence/types.js +2 -0
  101. package/packages/client/dist/fs/atomic-state-replace.js +152 -1
  102. package/packages/client/dist/generated/command-registry.generated.js +4076 -1
  103. package/packages/client/dist/generated/public-projections.generated.js +149 -1
  104. package/packages/client/dist/git/direct-yolo-c01-retry.js +138 -4
  105. package/packages/client/dist/git/direct-yolo-checkpoint.js +1234 -4
  106. package/packages/client/dist/git/git-lifecycle-step-ids.js +14 -1
  107. package/packages/client/dist/git/git-lifecycle-store.js +1938 -9
  108. package/packages/client/dist/git/legacy-story-branch-checkpoint.js +259 -9
  109. package/packages/client/dist/git/legacy-story-branch-setup.js +348 -4
  110. package/packages/client/dist/git/legacy-story-pr.js +3538 -70
  111. package/packages/client/dist/git/secure-filesystem-boundary.js +182 -5
  112. package/packages/client/dist/graph-retrieval/pre-command-hook.js +284 -1
  113. package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +237 -1
  114. package/packages/client/dist/i18n/first-run.js +60 -2
  115. package/packages/client/dist/index.js +47 -1
  116. package/packages/client/dist/invocation/invoke-input.js +24 -1
  117. package/packages/client/dist/license/index.js +5 -1
  118. package/packages/client/dist/license/license-client.js +304 -1
  119. package/packages/client/dist/machine/fingerprint.js +163 -2
  120. package/packages/client/dist/machine/index.js +5 -1
  121. package/packages/client/dist/memory/project-memory-path-scope.js +62 -1
  122. package/packages/client/dist/memory/project-memory-writer.js +1007 -40
  123. package/packages/client/dist/memory/shared-project-memory-types.js +253 -2
  124. package/packages/client/dist/migrations/project-identity-capability.js +50 -1
  125. package/packages/client/dist/migrations/project-identity.js +493 -7
  126. package/packages/client/dist/migrations/state-json.js +344 -4
  127. package/packages/client/dist/policy/architecture-policy.js +184 -2
  128. package/packages/client/dist/policy/index.js +7 -1
  129. package/packages/client/dist/policy/shared-policy-types.js +38 -0
  130. package/packages/client/dist/policy/subagent-approval-policy.js +55 -1
  131. package/packages/client/dist/private-execution/clean-baseline.js +279 -2
  132. package/packages/client/dist/private-execution/codex-executor.js +574 -4
  133. package/packages/client/dist/private-execution/codex-host-runtime.js +137 -1
  134. package/packages/client/dist/private-execution/codex-lifecycle-guard.js +97 -1
  135. package/packages/client/dist/private-execution/codex-scoped-permissions.js +128 -1
  136. package/packages/client/dist/private-execution/delivery.js +410 -13
  137. package/packages/client/dist/private-execution/diagnosis-root-review.js +294 -2
  138. package/packages/client/dist/private-execution/frozen-handoff.js +19 -6
  139. package/packages/client/dist/private-execution/implementation-validation.js +106 -2
  140. package/packages/client/dist/private-execution/isolated-admission.js +1432 -23
  141. package/packages/client/dist/private-execution/isolated-session.js +725 -5
  142. package/packages/client/dist/private-execution/isolated-workspace.js +122 -1
  143. package/packages/client/dist/private-execution/pact-consumer-runtime.js +409 -3
  144. package/packages/client/dist/private-execution/pact-test-source.js +258 -1
  145. package/packages/client/dist/private-execution/pact-toolchain.js +290 -3
  146. package/packages/client/dist/private-execution/pact-write-set.js +172 -1
  147. package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +406 -5
  148. package/packages/client/dist/private-execution/planning-generation-checkpoint.js +462 -5
  149. package/packages/client/dist/private-execution/planning-memory-checkpoint.js +139 -3
  150. package/packages/client/dist/private-execution/planning-research-checkpoint.js +325 -4
  151. package/packages/client/dist/private-execution/private-report-store.js +42 -1
  152. package/packages/client/dist/private-execution/property-test-candidate.js +103 -1
  153. package/packages/client/dist/private-execution/property-test-choices.js +147 -3
  154. package/packages/client/dist/private-execution/property-test-plan.js +271 -7
  155. package/packages/client/dist/private-execution/property-test-review.js +258 -4
  156. package/packages/client/dist/private-execution/property-test-runtime.js +372 -9
  157. package/packages/client/dist/private-execution/property-test-source.js +139 -1
  158. package/packages/client/dist/private-execution/root-checkpoint.js +80 -1
  159. package/packages/client/dist/private-execution/root-memory-git-evidence.js +135 -3
  160. package/packages/client/dist/private-execution/root-memory-recovery.js +93 -1
  161. package/packages/client/dist/private-execution/root-memory-request.js +29 -1
  162. package/packages/client/dist/private-execution/root-memory-scope.js +178 -1
  163. package/packages/client/dist/private-execution/root-memory-writer.js +102 -1
  164. package/packages/client/dist/private-execution/session-lease.js +63 -1
  165. package/packages/client/dist/private-execution/shared-private-admission-types.js +50 -1
  166. package/packages/client/dist/private-execution/shared-project-validation.js +66 -1
  167. package/packages/client/dist/private-execution/shared-root-memory-types.js +61 -1
  168. package/packages/client/dist/private-execution/ux-source-validation.js +372 -1
  169. package/packages/client/dist/private-execution/ux-write-set.js +191 -2
  170. package/packages/client/dist/resilience/circuit-breaker.js +170 -1
  171. package/packages/client/dist/resilience/degradation-manager.js +164 -1
  172. package/packages/client/dist/resilience/freshness-indicator.js +100 -1
  173. package/packages/client/dist/resilience/index.js +8 -1
  174. package/packages/client/dist/resilience/recovery-detector.js +74 -1
  175. package/packages/client/dist/resolvers/asset-resolver.js +13 -0
  176. package/packages/client/dist/resolvers/local-resolver.js +255 -8
  177. package/packages/client/dist/resolvers/remote-resolver.js +233 -1
  178. package/packages/client/dist/runner/binary.js +404 -1
  179. package/packages/client/dist/runner/cli.js +1571 -17
  180. package/packages/client/dist/runner/headless/adapters.js +49 -1
  181. package/packages/client/dist/runner/headless/claude-code-adapter.js +79 -1
  182. package/packages/client/dist/runner/headless/continuous-story-workspace.js +1628 -11
  183. package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +69 -1
  184. package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +110 -2
  185. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +1236 -8
  186. package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +318 -2
  187. package/packages/client/dist/runner/headless/fake-adapter.js +62 -1
  188. package/packages/client/dist/runner/headless/managed-profile.js +132 -1
  189. package/packages/client/dist/runner/headless/opencode-adapter.js +145 -2
  190. package/packages/client/dist/runner/headless/prepared-story-bundle.js +43 -1
  191. package/packages/client/dist/runner/headless/resolver.js +231 -1
  192. package/packages/client/dist/runner/headless/run-yolo.js +885 -1
  193. package/packages/client/dist/runner/headless/run-yoloop.js +2574 -2
  194. package/packages/client/dist/runner/headless/types.js +574 -2
  195. package/packages/client/dist/runner/local-console.js +396 -13
  196. package/packages/client/dist/runner/portal-sync-worker.js +1487 -1
  197. package/packages/client/dist/runner/project-identity.js +106 -1
  198. package/packages/client/dist/runner/scheduler.js +995 -7
  199. package/packages/client/dist/runner-cli.js +18 -2
  200. package/packages/client/dist/state/invocation-shape.js +13 -1
  201. package/packages/client/dist/state/project-state-snapshot.js +1677 -1
  202. package/packages/client/dist/state/state-json-repair.js +785 -3
  203. package/packages/client/dist/state/structural-dag-projection.js +118 -1
  204. package/packages/client/dist/telemetry/index.js +5 -1
  205. package/packages/client/dist/telemetry/offline-queue.js +131 -1
  206. package/packages/client/dist/tier/index.js +5 -1
  207. package/packages/client/dist/tier/tier-aware-client.js +405 -1
  208. package/packages/client/dist/types/index.js +38 -1
  209. package/packages/client/dist/version.js +27 -1
  210. package/packages/client/dist/yolo/change-evidence-collector.js +126 -1
  211. package/packages/client/dist/yolo/invoke-envelope-capability.js +62 -1
  212. package/packages/client/dist/yolo/spec-envelope-collector.js +185 -5
  213. package/packages/client/dist/yoloop/discovery-hook.js +300 -2
  214. package/packages/client/dist/yoloop/index.js +8 -1
  215. package/packages/client/dist/yoloop/invoke-hooks.js +669 -12
  216. package/packages/client/dist/yoloop/shared-discover-epics.js +1007 -1
  217. package/packages/client/dist/yoloop/shared-yoloop-types.js +33 -1
  218. package/packages/client/dist/yoloop/target-normalization.js +180 -1
  219. package/packages/client/dist/yoloop/yoloop-client-state-store.js +1723 -1
  220. package/targets-stubs/antigravity/gemini.md +1 -1
  221. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  222. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  223. package/targets-stubs/claude-code/neocortex-root.md +2 -2
  224. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  225. package/targets-stubs/claude-code/neocortex.md +2 -2
  226. package/targets-stubs/codex/AGENTS.md +1 -1
  227. package/targets-stubs/cursor/agent.md +2 -2
  228. package/targets-stubs/gemini-cli/agent.md +2 -2
  229. package/targets-stubs/opencode/neocortex-root.md +1 -1
  230. package/targets-stubs/vscode/neocortex.agent.md +2 -2
@@ -1 +1,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
+ /** 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 +1,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
+ /** 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 +1,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
+ /** 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 +1,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};
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
+ }