@ornexus/neocortex 4.60.62 → 4.60.64

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 (137) hide show
  1. package/dist/release-source.json +1 -1
  2. package/dist/sbom.cdx.json +77 -50
  3. package/install.ps1 +1 -1
  4. package/install.sh +1 -1
  5. package/package.json +12 -5
  6. package/packages/client/dist/cli.js +8 -3
  7. package/packages/client/dist/commands/activate.js +8 -8
  8. package/packages/client/dist/commands/architecture-memory-terminal.js +4 -2
  9. package/packages/client/dist/commands/architecture-non-ui-continuation.d.ts +3 -0
  10. package/packages/client/dist/commands/architecture-non-ui-continuation.js +1 -0
  11. package/packages/client/dist/commands/invoke.d.ts +19 -16
  12. package/packages/client/dist/commands/invoke.js +86 -79
  13. package/packages/client/dist/commands/planning-generation.js +1 -1
  14. package/packages/client/dist/commands/planning-memory.d.ts +1 -0
  15. package/packages/client/dist/commands/planning-memory.js +1 -0
  16. package/packages/client/dist/commands/private-session.d.ts +1 -0
  17. package/packages/client/dist/commands/private-session.js +1 -0
  18. package/packages/client/dist/commands/qa-control.d.ts +4 -0
  19. package/packages/client/dist/commands/qa-control.js +1 -0
  20. package/packages/client/dist/commands/qa-scan-browser-launch.d.ts +8 -0
  21. package/packages/client/dist/commands/qa-scan-browser-launch.js +1 -0
  22. package/packages/client/dist/commands/qa-scan-browser-route.d.ts +3 -0
  23. package/packages/client/dist/commands/qa-scan-browser-route.js +1 -0
  24. package/packages/client/dist/commands/qa-scan-capture.d.ts +43 -0
  25. package/packages/client/dist/commands/qa-scan-capture.js +5 -5
  26. package/packages/client/dist/commands/qa-scan-discovery.d.ts +7 -0
  27. package/packages/client/dist/commands/qa-scan-discovery.js +3 -3
  28. package/packages/client/dist/commands/qa-scan-review.d.ts +8 -1
  29. package/packages/client/dist/commands/qa-scan-review.js +5 -5
  30. package/packages/client/dist/commands/qa-synthetic-backend-capture.d.ts +62 -0
  31. package/packages/client/dist/commands/qa-synthetic-backend-capture.js +1 -0
  32. package/packages/client/dist/commands/qa-synthetic-backend-review.d.ts +104 -0
  33. package/packages/client/dist/commands/qa-synthetic-backend-review.js +1 -0
  34. package/packages/client/dist/commands/qa-synthetic-backend.d.ts +52 -0
  35. package/packages/client/dist/commands/qa-synthetic-backend.js +7 -0
  36. package/packages/client/dist/commands/qa-synthetic-broker-port.d.ts +30 -0
  37. package/packages/client/dist/commands/qa-synthetic-broker-port.js +1 -0
  38. package/packages/client/dist/commands/qa-synthetic-browser.d.ts +1 -0
  39. package/packages/client/dist/commands/qa-synthetic-browser.js +1 -0
  40. package/packages/client/dist/commands/refactor-characterization.d.ts +12 -3
  41. package/packages/client/dist/commands/refactor-characterization.js +21 -12
  42. package/packages/client/dist/commands/refactor-control.d.ts +17 -0
  43. package/packages/client/dist/commands/refactor-control.js +3 -0
  44. package/packages/client/dist/commands/refactor-cpp-assertions.d.ts +4 -0
  45. package/packages/client/dist/commands/refactor-cpp-assertions.js +3 -0
  46. package/packages/client/dist/commands/refactor-review.d.ts +13 -0
  47. package/packages/client/dist/commands/refactor-review.js +6 -5
  48. package/packages/client/dist/commands/refactor-root.d.ts +165 -1
  49. package/packages/client/dist/commands/refactor-root.js +12 -7
  50. package/packages/client/dist/commands/refresh-memory.d.ts +1 -0
  51. package/packages/client/dist/commands/refresh-memory.js +3 -3
  52. package/packages/client/dist/commands/shared-architecture-non-ui-contract.d.ts +19 -0
  53. package/packages/client/dist/commands/shared-architecture-non-ui-contract.js +1 -0
  54. package/packages/client/dist/errors/error-messages.js +1 -1
  55. package/packages/client/dist/git/direct-yolo-checkpoint.js +4 -4
  56. package/packages/client/dist/git/git-lifecycle-store.js +7 -7
  57. package/packages/client/dist/license/license-client.d.ts +3 -1
  58. package/packages/client/dist/license/license-client.js +1 -1
  59. package/packages/client/dist/memory/project-memory-path-scope.d.ts +4 -0
  60. package/packages/client/dist/memory/project-memory-path-scope.js +1 -0
  61. package/packages/client/dist/memory/project-memory-writer.d.ts +4 -1
  62. package/packages/client/dist/memory/project-memory-writer.js +16 -16
  63. package/packages/client/dist/package.json +1 -0
  64. package/packages/client/dist/private-execution/clean-baseline.d.ts +7 -0
  65. package/packages/client/dist/private-execution/clean-baseline.js +2 -2
  66. package/packages/client/dist/private-execution/codex-executor.d.ts +48 -4
  67. package/packages/client/dist/private-execution/codex-executor.js +9 -2
  68. package/packages/client/dist/private-execution/codex-host-runtime.d.ts +10 -0
  69. package/packages/client/dist/private-execution/codex-host-runtime.js +1 -0
  70. package/packages/client/dist/private-execution/codex-lifecycle-guard.d.ts +4 -0
  71. package/packages/client/dist/private-execution/codex-lifecycle-guard.js +1 -0
  72. package/packages/client/dist/private-execution/codex-scoped-permissions.d.ts +8 -0
  73. package/packages/client/dist/private-execution/codex-scoped-permissions.js +1 -0
  74. package/packages/client/dist/private-execution/delivery.d.ts +18 -1
  75. package/packages/client/dist/private-execution/delivery.js +11 -3
  76. package/packages/client/dist/private-execution/diagnosis-root-review.d.ts +112 -0
  77. package/packages/client/dist/private-execution/diagnosis-root-review.js +2 -0
  78. package/packages/client/dist/private-execution/frozen-handoff.d.ts +2 -0
  79. package/packages/client/dist/private-execution/frozen-handoff.js +7 -0
  80. package/packages/client/dist/private-execution/implementation-validation.d.ts +24 -0
  81. package/packages/client/dist/private-execution/implementation-validation.js +2 -0
  82. package/packages/client/dist/private-execution/isolated-admission.d.ts +11 -7
  83. package/packages/client/dist/private-execution/isolated-admission.js +17 -10
  84. package/packages/client/dist/private-execution/isolated-session.d.ts +68 -0
  85. package/packages/client/dist/private-execution/isolated-session.js +5 -2
  86. package/packages/client/dist/private-execution/pact-test-source.d.ts +1 -1
  87. package/packages/client/dist/private-execution/pact-test-source.js +1 -1
  88. package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.d.ts +2 -0
  89. package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +5 -5
  90. package/packages/client/dist/private-execution/planning-generation-checkpoint.d.ts +13 -0
  91. package/packages/client/dist/private-execution/planning-generation-checkpoint.js +4 -3
  92. package/packages/client/dist/private-execution/planning-memory-checkpoint.d.ts +32 -0
  93. package/packages/client/dist/private-execution/planning-memory-checkpoint.js +3 -0
  94. package/packages/client/dist/private-execution/planning-research-checkpoint.js +4 -4
  95. package/packages/client/dist/private-execution/root-checkpoint.js +1 -1
  96. package/packages/client/dist/private-execution/root-memory-git-evidence.d.ts +30 -0
  97. package/packages/client/dist/private-execution/root-memory-git-evidence.js +3 -0
  98. package/packages/client/dist/private-execution/root-memory-recovery.d.ts +16 -0
  99. package/packages/client/dist/private-execution/root-memory-recovery.js +1 -0
  100. package/packages/client/dist/private-execution/root-memory-request.d.ts +28 -0
  101. package/packages/client/dist/private-execution/root-memory-request.js +1 -0
  102. package/packages/client/dist/private-execution/root-memory-scope.d.ts +28 -0
  103. package/packages/client/dist/private-execution/root-memory-scope.js +1 -0
  104. package/packages/client/dist/private-execution/root-memory-writer.d.ts +22 -0
  105. package/packages/client/dist/private-execution/root-memory-writer.js +1 -0
  106. package/packages/client/dist/private-execution/session-lease.d.ts +19 -0
  107. package/packages/client/dist/private-execution/session-lease.js +1 -0
  108. package/packages/client/dist/private-execution/ux-source-validation.js +1 -1
  109. package/packages/client/dist/runner-cli.js +0 -0
  110. package/packages/client/dist/yolo/change-evidence-collector.d.ts +2 -2
  111. package/packages/client/dist/yolo/change-evidence-collector.js +1 -1
  112. package/packages/client/dist/yolo/spec-envelope-collector.js +2 -2
  113. package/packages/shared/dist/invocation/index.js +4 -2
  114. package/packages/shared/dist/invocation/packed-invoke.d.ts +12 -0
  115. package/packages/shared/dist/invocation/packed-invoke.js +58 -0
  116. package/packages/shared/dist/invocation/packed-invoke.test.d.ts +1 -0
  117. package/packages/shared/dist/invocation/packed-invoke.test.js +21 -0
  118. package/packages/shared/dist/package.json +1 -0
  119. package/packages/shared/dist/planning/diagnosis-state.js +5 -2
  120. package/packages/shared/dist/private-qa-structural-admission.js +14 -0
  121. package/packages/shared/dist/private-yolo-predecessor-decision.js +32 -0
  122. package/packages/shared/dist/project-memory-targets.js +243 -0
  123. package/packages/shared/dist/project-validation-commands.js +96 -0
  124. package/packages/shared/dist/yolo/change-evidence.js +35 -0
  125. package/packages/shared/dist/yoloop/branch-unit.js +10 -1
  126. package/packages/shared/dist/yoloop/root-memory-effect.js +57 -0
  127. package/targets-stubs/antigravity/gemini.md +1 -1
  128. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  129. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  130. package/targets-stubs/claude-code/neocortex-root.md +2 -2
  131. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  132. package/targets-stubs/claude-code/neocortex.md +2 -2
  133. package/targets-stubs/codex/AGENTS.md +1 -1
  134. package/targets-stubs/cursor/agent.md +2 -2
  135. package/targets-stubs/gemini-cli/agent.md +2 -2
  136. package/targets-stubs/opencode/neocortex-root.md +1 -1
  137. package/targets-stubs/vscode/neocortex.agent.md +2 -2
@@ -1 +1 @@
1
- {"schemaVersion":1,"sourceRevision":"cbfefb5eb68691cb9b76a6b94a4317cb5075c481","version":"4.60.62"}
1
+ {"schemaVersion":1,"sourceRevision":"679552f191d498e43109ae2dda12ef9b940e969a","version":"4.60.64"}
@@ -276,7 +276,20 @@
276
276
  "version": "7.29.7"
277
277
  },
278
278
  {
279
- "bom-ref": "@clack/core@1.0.1",
279
+ "bom-ref": "@clack/core@0.5.0",
280
+ "externalReferences": [
281
+ {
282
+ "comment": "as detected from npm-ls property \"resolved\" and property \"integrity\"",
283
+ "hashes": [
284
+ {
285
+ "alg": "SHA-512",
286
+ "content": "a77cb41483b06984543d170c3bbf9d9662e1f0f49172b8ee4e776c880d160056d6112d262d996b8d5a01459f43ce43c52591ba2869099a810063465c5564e4a3"
287
+ }
288
+ ],
289
+ "type": "distribution",
290
+ "url": "https://registry.npmjs.org/@clack/core/-/core-0.5.0.tgz"
291
+ }
292
+ ],
280
293
  "group": "@clack",
281
294
  "licenses": [
282
295
  {
@@ -292,12 +305,25 @@
292
305
  "value": "node_modules/@clack/core"
293
306
  }
294
307
  ],
295
- "purl": "pkg:npm/%40clack/core@1.0.1",
308
+ "purl": "pkg:npm/%40clack/core@0.5.0",
296
309
  "type": "library",
297
- "version": "1.0.1"
310
+ "version": "0.5.0"
298
311
  },
299
312
  {
300
- "bom-ref": "@clack/prompts@1.0.1",
313
+ "bom-ref": "@clack/prompts@0.11.0",
314
+ "externalReferences": [
315
+ {
316
+ "comment": "as detected from npm-ls property \"resolved\" and property \"integrity\"",
317
+ "hashes": [
318
+ {
319
+ "alg": "SHA-512",
320
+ "content": "a4c37915cac4c3d8549190387feccb9738af4127907f97511898d251bbd56032efa4a09d431e4e6a49ef2b381bb573a2ce13fe4892498ea11b39ee79b8a29f03"
321
+ }
322
+ ],
323
+ "type": "distribution",
324
+ "url": "https://registry.npmjs.org/@clack/prompts/-/prompts-0.11.0.tgz"
325
+ }
326
+ ],
301
327
  "group": "@clack",
302
328
  "licenses": [
303
329
  {
@@ -313,9 +339,9 @@
313
339
  "value": "node_modules/@clack/prompts"
314
340
  }
315
341
  ],
316
- "purl": "pkg:npm/%40clack/prompts@1.0.1",
342
+ "purl": "pkg:npm/%40clack/prompts@0.11.0",
317
343
  "type": "library",
318
- "version": "1.0.1"
344
+ "version": "0.11.0"
319
345
  },
320
346
  {
321
347
  "bom-ref": "@fastify/accept-negotiator@2.0.1",
@@ -1133,7 +1159,7 @@
1133
1159
  "version": "1.31.0"
1134
1160
  },
1135
1161
  {
1136
- "bom-ref": "@neocortex/client@4.60.62",
1162
+ "bom-ref": "@neocortex/client@4.60.64",
1137
1163
  "group": "@neocortex",
1138
1164
  "name": "client",
1139
1165
  "properties": [
@@ -1142,9 +1168,9 @@
1142
1168
  "value": "node_modules/@neocortex/client"
1143
1169
  }
1144
1170
  ],
1145
- "purl": "pkg:npm/%40neocortex/client@4.60.62",
1171
+ "purl": "pkg:npm/%40neocortex/client@4.60.64",
1146
1172
  "type": "library",
1147
- "version": "4.60.62"
1173
+ "version": "4.60.64"
1148
1174
  },
1149
1175
  {
1150
1176
  "bom-ref": "@neocortex/core@0.1.0",
@@ -1161,7 +1187,7 @@
1161
1187
  "version": "0.1.0"
1162
1188
  },
1163
1189
  {
1164
- "bom-ref": "@neocortex/server@4.60.62",
1190
+ "bom-ref": "@neocortex/server@4.60.64",
1165
1191
  "group": "@neocortex",
1166
1192
  "name": "server",
1167
1193
  "properties": [
@@ -1170,12 +1196,12 @@
1170
1196
  "value": "node_modules/@neocortex/server"
1171
1197
  }
1172
1198
  ],
1173
- "purl": "pkg:npm/%40neocortex/server@4.60.62",
1199
+ "purl": "pkg:npm/%40neocortex/server@4.60.64",
1174
1200
  "type": "library",
1175
- "version": "4.60.62"
1201
+ "version": "4.60.64"
1176
1202
  },
1177
1203
  {
1178
- "bom-ref": "@neocortex/shared@4.60.62",
1204
+ "bom-ref": "@neocortex/shared@4.60.64",
1179
1205
  "group": "@neocortex",
1180
1206
  "name": "shared",
1181
1207
  "properties": [
@@ -1184,9 +1210,9 @@
1184
1210
  "value": "node_modules/@neocortex/shared"
1185
1211
  }
1186
1212
  ],
1187
- "purl": "pkg:npm/%40neocortex/shared@4.60.62",
1213
+ "purl": "pkg:npm/%40neocortex/shared@4.60.64",
1188
1214
  "type": "library",
1189
- "version": "4.60.62"
1215
+ "version": "4.60.64"
1190
1216
  },
1191
1217
  {
1192
1218
  "bom-ref": "@opentelemetry/api-logs@0.214.0",
@@ -2350,18 +2376,18 @@
2350
2376
  "version": "3.0.3"
2351
2377
  },
2352
2378
  {
2353
- "bom-ref": "better-sqlite3@12.11.1",
2379
+ "bom-ref": "better-sqlite3@11.10.0",
2354
2380
  "externalReferences": [
2355
2381
  {
2356
2382
  "comment": "as detected from npm-ls property \"resolved\" and property \"integrity\"",
2357
2383
  "hashes": [
2358
2384
  {
2359
2385
  "alg": "SHA-512",
2360
- "content": "76af40b40a608393c616d0733c54819771d94231e893981a40233ace1d989346929830acd426e7548f3f1e001242434ab16169b1e20ef5b7a0e71c696216c87c"
2386
+ "content": "13084ea725e23842ff94acc7cfd016d66b1614dcc673fcfe2f3781dff8e7149a71bbeb61db2aafcec4966acd6ff6382cf7ec625c9703e40f02271006d936a085"
2361
2387
  }
2362
2388
  ],
2363
2389
  "type": "distribution",
2364
- "url": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-12.11.1.tgz"
2390
+ "url": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.10.0.tgz"
2365
2391
  }
2366
2392
  ],
2367
2393
  "licenses": [
@@ -2378,10 +2404,10 @@
2378
2404
  "value": "node_modules/better-sqlite3"
2379
2405
  }
2380
2406
  ],
2381
- "purl": "pkg:npm/better-sqlite3@12.11.1",
2407
+ "purl": "pkg:npm/better-sqlite3@11.10.0",
2382
2408
  "scope": "optional",
2383
2409
  "type": "library",
2384
- "version": "12.11.1"
2410
+ "version": "11.10.0"
2385
2411
  },
2386
2412
  {
2387
2413
  "bom-ref": "bindings@1.5.0",
@@ -7113,18 +7139,18 @@
7113
7139
  "version": "5.0.1"
7114
7140
  },
7115
7141
  {
7116
- "bom-ref": "playwright-core@1.64.0",
7142
+ "bom-ref": "playwright-core@1.55.0",
7117
7143
  "externalReferences": [
7118
7144
  {
7119
7145
  "comment": "as detected from npm-ls property \"resolved\" and property \"integrity\"",
7120
7146
  "hashes": [
7121
7147
  {
7122
7148
  "alg": "SHA-512",
7123
- "content": "4fdafe319913102976fa851c676e98819cd3ad889d4ec2216189098b1fba8833b298e6f5141d912cb48ec511a7646bf90d2b6df9a76e2156edf84f16ca05d8a6"
7149
+ "content": "1af66ce2f537539ae8da76697a2c326f4cee15aa9bf6c522009bb2ad6a5c1a8b83f32f7f1cb8066cd46322987bcd4f43de19cf6a2b0c97dcc6f428058bf6e222"
7124
7150
  }
7125
7151
  ],
7126
7152
  "type": "distribution",
7127
- "url": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.0.tgz"
7153
+ "url": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.55.0.tgz"
7128
7154
  }
7129
7155
  ],
7130
7156
  "licenses": [
@@ -7141,9 +7167,9 @@
7141
7167
  "value": "node_modules/playwright-core"
7142
7168
  }
7143
7169
  ],
7144
- "purl": "pkg:npm/playwright-core@1.64.0",
7170
+ "purl": "pkg:npm/playwright-core@1.55.0",
7145
7171
  "type": "library",
7146
- "version": "1.64.0"
7172
+ "version": "1.55.0"
7147
7173
  },
7148
7174
  {
7149
7175
  "bom-ref": "postgres-array@2.0.0",
@@ -9631,36 +9657,37 @@
9631
9657
  {
9632
9658
  "dependsOn": [
9633
9659
  "@babel/parser@7.29.7",
9634
- "@clack/prompts@1.0.1",
9660
+ "@clack/prompts@0.11.0",
9661
+ "@hono/node-server@1.19.17",
9635
9662
  "@modelcontextprotocol/sdk@1.31.0",
9636
- "@neocortex/client@4.60.62",
9663
+ "@neocortex/client@4.60.64",
9637
9664
  "@neocortex/core@0.1.0",
9638
- "@neocortex/server@4.60.62",
9639
- "@neocortex/shared@4.60.62",
9665
+ "@neocortex/server@4.60.64",
9666
+ "@neocortex/shared@4.60.64",
9640
9667
  "axe-core@4.14.0",
9641
- "better-sqlite3@12.11.1",
9668
+ "better-sqlite3@11.10.0",
9642
9669
  "execa@9.6.1",
9643
9670
  "express@5.2.1",
9644
9671
  "node-cache@5.1.2",
9645
9672
  "picocolors@1.1.1",
9646
- "playwright-core@1.64.0",
9673
+ "playwright-core@1.55.0",
9647
9674
  "yaml@2.9.0",
9648
9675
  "zod@4.4.3"
9649
9676
  ],
9650
- "ref": "@ornexus/neocortex@4.60.62"
9677
+ "ref": "@ornexus/neocortex@4.60.64"
9651
9678
  },
9652
9679
  {
9653
9680
  "dependsOn": [
9654
9681
  "@babel/parser@7.29.7",
9655
- "@neocortex/shared@4.60.62",
9682
+ "@neocortex/shared@4.60.64",
9656
9683
  "axe-core@4.14.0",
9657
- "better-sqlite3@12.11.1",
9684
+ "better-sqlite3@11.10.0",
9658
9685
  "jose@6.2.2",
9659
9686
  "keytar@7.9.0",
9660
- "playwright-core@1.64.0",
9687
+ "playwright-core@1.55.0",
9661
9688
  "yaml@2.9.0"
9662
9689
  ],
9663
- "ref": "@neocortex/client@4.60.62"
9690
+ "ref": "@neocortex/client@4.60.64"
9664
9691
  },
9665
9692
  {
9666
9693
  "dependsOn": [
@@ -9670,11 +9697,11 @@
9670
9697
  },
9671
9698
  {
9672
9699
  "dependsOn": [
9673
- "@clack/core@1.0.1",
9700
+ "@clack/core@0.5.0",
9674
9701
  "picocolors@1.1.1",
9675
9702
  "sisteransi@1.0.5"
9676
9703
  ],
9677
- "ref": "@clack/prompts@1.0.1"
9704
+ "ref": "@clack/prompts@0.11.0"
9678
9705
  },
9679
9706
  {
9680
9707
  "dependsOn": [
@@ -9715,7 +9742,7 @@
9715
9742
  "@fastify/jwt@10.2.2",
9716
9743
  "@fastify/rate-limit@10.3.0",
9717
9744
  "@fastify/static@10.1.3",
9718
- "@neocortex/shared@4.60.62",
9745
+ "@neocortex/shared@4.60.64",
9719
9746
  "@sentry/node@10.62.0",
9720
9747
  "bcryptjs@3.0.3",
9721
9748
  "drizzle-orm@0.45.2",
@@ -9728,7 +9755,7 @@
9728
9755
  "stripe@20.4.1",
9729
9756
  "yaml@2.9.0"
9730
9757
  ],
9731
- "ref": "@neocortex/server@4.60.62"
9758
+ "ref": "@neocortex/server@4.60.64"
9732
9759
  },
9733
9760
  {
9734
9761
  "dependsOn": [
@@ -9849,7 +9876,7 @@
9849
9876
  },
9850
9877
  {
9851
9878
  "dependsOn": [
9852
- "@neocortex/shared@4.60.62"
9879
+ "@neocortex/shared@4.60.64"
9853
9880
  ],
9854
9881
  "ref": "@neocortex/core@0.1.0"
9855
9882
  },
@@ -9936,7 +9963,7 @@
9936
9963
  "dependsOn": [
9937
9964
  "@opentelemetry/api@1.9.1",
9938
9965
  "@types/pg@8.20.0",
9939
- "better-sqlite3@12.11.1",
9966
+ "better-sqlite3@11.10.0",
9940
9967
  "gel@2.2.0",
9941
9968
  "pg@8.22.0"
9942
9969
  ],
@@ -10126,7 +10153,7 @@
10126
10153
  "bindings@1.5.0",
10127
10154
  "prebuild-install@7.1.3"
10128
10155
  ],
10129
- "ref": "better-sqlite3@12.11.1"
10156
+ "ref": "better-sqlite3@11.10.0"
10130
10157
  },
10131
10158
  {
10132
10159
  "dependsOn": [
@@ -10744,7 +10771,7 @@
10744
10771
  "picocolors@1.1.1",
10745
10772
  "sisteransi@1.0.5"
10746
10773
  ],
10747
- "ref": "@clack/core@1.0.1"
10774
+ "ref": "@clack/core@0.5.0"
10748
10775
  },
10749
10776
  {
10750
10777
  "dependsOn": [
@@ -10909,7 +10936,7 @@
10909
10936
  "ref": "@lukeed/ms@2.0.2"
10910
10937
  },
10911
10938
  {
10912
- "ref": "@neocortex/shared@4.60.62"
10939
+ "ref": "@neocortex/shared@4.60.64"
10913
10940
  },
10914
10941
  {
10915
10942
  "ref": "@opentelemetry/api@1.9.1"
@@ -11251,7 +11278,7 @@
11251
11278
  "ref": "pkce-challenge@5.0.1"
11252
11279
  },
11253
11280
  {
11254
- "ref": "playwright-core@1.64.0"
11281
+ "ref": "playwright-core@1.55.0"
11255
11282
  },
11256
11283
  {
11257
11284
  "ref": "postgres-array@2.0.0"
@@ -11398,8 +11425,8 @@
11398
11425
  "metadata": {
11399
11426
  "component": {
11400
11427
  "author": "OrNexus Team",
11401
- "bom-ref": "@ornexus/neocortex@4.60.62",
11402
- "description": "Neocortex v4.60.62 - Orquestrador de Desenvolvimento de Epics & Stories para Claude Code",
11428
+ "bom-ref": "@ornexus/neocortex@4.60.64",
11429
+ "description": "Neocortex v4.60.64 - Orquestrador de Desenvolvimento de Epics & Stories para Claude Code",
11403
11430
  "externalReferences": [
11404
11431
  {
11405
11432
  "comment": "as detected from PackageJson property \"bugs.url\"",
@@ -11432,9 +11459,9 @@
11432
11459
  "value": ""
11433
11460
  }
11434
11461
  ],
11435
- "purl": "pkg:npm/%40ornexus/neocortex@4.60.62?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FOrNexus-AI%2Fneocortex.git",
11462
+ "purl": "pkg:npm/%40ornexus/neocortex@4.60.64?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FOrNexus-AI%2Fneocortex.git",
11436
11463
  "type": "application",
11437
- "version": "4.60.62"
11464
+ "version": "4.60.64"
11438
11465
  },
11439
11466
  "tools": {
11440
11467
  "components": [
package/install.ps1 CHANGED
@@ -17,7 +17,7 @@ param(
17
17
  [string]$ServerUrl = ('https://{0}.{1}.{2}' -f 'api','neocortex','sh')
18
18
  )
19
19
 
20
- $VERSION = "4.60.62"
20
+ $VERSION = "4.60.64"
21
21
 
22
22
  # =============================================================================
23
23
  # CONFIGURACOES
package/install.sh CHANGED
@@ -4,7 +4,7 @@
4
4
  # Development Orchestrator
5
5
 
6
6
  # Versao do instalador
7
- VERSION="4.60.62"
7
+ VERSION="4.60.64"
8
8
 
9
9
  # Flags
10
10
  MIGRATION_DETECTED=false
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ornexus/neocortex",
3
- "version": "4.60.62",
4
- "description": "Neocortex v4.60.62 - Orquestrador de Desenvolvimento de Epics & Stories para Claude Code",
3
+ "version": "4.60.64",
4
+ "description": "Neocortex v4.60.64 - Orquestrador de Desenvolvimento de Epics & Stories para Claude Code",
5
5
  "keywords": [
6
6
  "claude",
7
7
  "claude-code",
@@ -60,6 +60,7 @@
60
60
  "docs/install/installer-diagnostics.md",
61
61
  "postinstall.js",
62
62
  "packages/client/dist/",
63
+ "packages/shared/dist/package.json",
63
64
  "packages/shared/dist/nx-invoke-signature.js",
64
65
  "packages/shared/dist/command-registry-contract.js",
65
66
  "packages/shared/dist/strict-readonly.js",
@@ -77,7 +78,12 @@
77
78
  "packages/shared/dist/generated/invocation-schema.generated.js",
78
79
  "packages/shared/dist/generated/public-projections.generated.js",
79
80
  "packages/shared/dist/executable-graph-catalog/contracts.js",
81
+ "packages/shared/dist/private-yolo-predecessor-decision.js",
82
+ "packages/shared/dist/private-qa-structural-admission.js",
83
+ "packages/shared/dist/project-memory-targets.js",
84
+ "packages/shared/dist/project-validation-commands.js",
80
85
  "packages/shared/dist/yoloop/branch-unit.js",
86
+ "packages/shared/dist/yoloop/root-memory-effect.js",
81
87
  "packages/shared/dist/yoloop/canonical.js",
82
88
  "packages/shared/dist/yoloop/epic-terminal-git.js",
83
89
  "packages/shared/dist/yoloop/operational-budget.js",
@@ -153,19 +159,20 @@
153
159
  },
154
160
  "dependencies": {
155
161
  "@babel/parser": "^7.29.7",
156
- "@clack/prompts": "^1.0.1",
162
+ "@clack/prompts": "0.11.0",
163
+ "@hono/node-server": "1.19.17",
157
164
  "@modelcontextprotocol/sdk": "1.31.0",
158
165
  "axe-core": "^4.14.0",
159
166
  "execa": "^9.6.1",
160
167
  "express": "5.2.1",
161
168
  "node-cache": "^5.1.2",
162
169
  "picocolors": "^1.1.1",
163
- "playwright-core": "^1.64.0",
170
+ "playwright-core": "1.55.0",
164
171
  "yaml": "^2.8.3",
165
172
  "zod": "^4.3.6"
166
173
  },
167
174
  "optionalDependencies": {
168
- "better-sqlite3": "^12.11.1"
175
+ "better-sqlite3": "11.10.0"
169
176
  },
170
177
  "overrides": {
171
178
  "qs": "6.16.0"
@@ -12,7 +12,9 @@ Commands:
12
12
  architecture-memory seal Seal committed Update Memory evidence into local root state
13
13
  planning-diagnosis seal Seal an independently reviewed P01 checkpoint from stdin
14
14
  planning-research seal Seal an independently reviewed P02 checkpoint from stdin
15
- planning-generation seal Seal an independently reviewed P03 checkpoint from stdin
15
+ planning-generation <seal|verify> Seal a reviewed P03 or verify its committed evidence from stdin
16
+ planning-memory <seal|verify> Seal reviewed committed memory or reopen its physical receipt
17
+ private-session <inspect-rejected|discard-rejected|renew-lease|accept-diagnosis|accept-research|accept-specification|accept-tasks|validate-implementation|accept-implementation|accept-refactor-advisory|accept-test-validation|accept-qa|accept-project-memory> Root recovery and phase validation
16
18
  story-checkpoint Root-owned direct-*yolo commit/checkpoint boundary
17
19
  legacy-story-branch Root-owned setup and C01 checkpoint for recorded story-branch projects
18
20
  legacy-story-pr Root-owned legacy C08/C09 checkpoint, C10 PR, C11 review and C12 merge boundary
@@ -20,6 +22,8 @@ Commands:
20
22
  mutation-qa Root-owned mutation-test scope, Stryker checkpoint and local QA decision
21
23
  property-qa Local-only property-test preflight, sandbox proof and root semantic QA review
22
24
  qa-scan-review Root-only loopback browser capture, physical QA review and multi-surface reconciliation
25
+ qa-synthetic-backend Separately granted no-network synthetic backend observations; JSON stdin
26
+ qa-root Authenticated control of an operator-registered isolated QA worker
23
27
  refactor-root Root-only scope, Node characterization, semantic QA and Git checkpoint
24
28
  native-agent Reserve and observe authorized native child dispatches
25
29
  architecture-answers Save explicit Pact decisions in the local private store
@@ -40,6 +44,7 @@ Invoke Options:
40
44
  --watch Keep invoke open and poll local continuity summaries
41
45
  --server-url <url> Server URL override
42
46
  --platform-target <id> Explicit host override (default: fail-closed runtime detection)
47
+ --private-execution-model <id> Explicit model for private beta; no fallback or global config change
43
48
 
44
49
  Refresh Memory Options:
45
50
  --project-root <path> Project root directory (default: cwd)
@@ -196,5 +201,5 @@ Invocation payload boundary:
196
201
 
197
202
  License:
198
203
  Licensed under BSL-1.1 (Business Source License 1.1)
199
- `.trim(),m=new Set(["pm","install","postinstall","preinstall","prepublish","postpublish","preuninstall","postuninstall","preprepare","prepare","postprepare"]);async function d(){const c=process.argv.slice(2),a=c[0];a&&m.has(a.toLowerCase())&&process.exit(0),(!a||a==="--help"||a==="-h")&&(console.log(l),process.exit(0)),(a==="--version"||a==="-v")&&(console.log(p()),process.stderr.write(`Licensed under BSL-1.1 (Business Source License 1.1)
200
- `),process.exit(0));const t=c.slice(1);switch(a){case"invoke":{const{invokeCliHandler:o}=await import("./commands/invoke.js"),e=await o(t);process.exit(e);break}case"activate":{const{activate:o}=await import("./commands/activate.js");let e,n,i=!1;for(let r=0;r<t.length;r++){const s=t[r];s==="--server-url"?n=t[++r]:s==="--non-interactive"?i=!0:s==="--help"||s==="-h"?(console.log(l),process.exit(0)):s.startsWith("-")||(e=s)}e||(console.error("Error: License key is required."),console.error("Usage: neocortex-client activate <license-key>"),console.error("Example: neocortex-client activate NX-PRO-ABC-123"),process.exit(1));try{const r=await o({licenseKey:e,serverUrl:n,nonInteractive:i});r.success?(console.log(r.message),process.exit(0)):(console.error(r.message),process.exit(1))}catch(r){const s=r instanceof Error?r.message:String(r);console.error(`Activation failed: ${s}`),process.exit(1)}break}case"cache-status":{console.log("Cache status requires an active client session."),console.log("Use this command within a running Neocortex client context."),process.exit(0);break}case"config":{const{configCliHandler:o}=await import("./commands/config.js"),e=await o(t);process.exit(e);break}case"refresh-memory":{const{refreshMemoryCliHandler:o}=await import("./commands/refresh-memory.js"),e=await o(t);process.exit(e);break}case"architecture-memory":{const{architectureMemoryTerminalCliHandler:o}=await import("./commands/architecture-memory-terminal.js"),e=await o(t);process.exit(e);break}case"planning-diagnosis":{const{planningDiagnosisCliHandler:o}=await import("./commands/planning-diagnosis.js"),e=await o(t);process.exit(e);break}case"planning-research":{const{planningResearchCliHandler:o}=await import("./commands/planning-research.js"),e=await o(t);process.exit(e);break}case"planning-generation":{const{planningGenerationCliHandler:o}=await import("./commands/planning-generation.js"),e=await o(t);process.exit(e);break}case"story-checkpoint":{const{storyCheckpointCliHandler:o}=await import("./commands/story-checkpoint.js"),e=await o(t);process.exit(e);break}case"legacy-story-branch":{const{legacyStoryBranchCliHandler:o}=await import("./commands/legacy-story-branch.js"),e=await o(t);process.exit(e);break}case"legacy-story-pr":{const{legacyStoryPrCliHandler:o}=await import("./commands/legacy-story-pr.js"),e=await o(t);process.exit(e);break}case"legacy-epic-terminal":{const{legacyEpicTerminalCliHandler:o}=await import("./commands/legacy-epic-terminal.js"),e=await o(t);process.exit(e);break}case"mutation-qa":{const{mutationQaCliHandler:o}=await import("./commands/mutation-qa.js"),e=await o(t);process.exit(e);break}case"property-qa":{const{propertyQaCliHandler:o}=await import("./commands/property-qa.js"),e=await o(t);process.exit(e);break}case"qa-scan-review":{const{qaScanReviewCliHandler:o}=await import("./commands/qa-scan-review.js"),e=await o(t);process.exit(e);break}case"refactor-root":{if(t[0]==="characterize"){const{refactorCharacterizationCliHandler:n}=await import("./commands/refactor-characterization.js");process.exit(n(t))}if(t[0]==="review-accept"||t[0]==="review-status"){const{refactorReviewCliHandler:n}=await import("./commands/refactor-review.js");process.exit(await n(t))}if(t[0]?.startsWith("commit-")){const{refactorCommitCliHandler:n}=await import("./commands/refactor-commit.js");process.exit(n(t))}const{refactorRootCliHandler:o}=await import("./commands/refactor-root.js"),e=o(t);process.exit(e);break}case"native-agent":{const{nativeAgentCliHandler:o}=await import("./commands/native-agent.js"),e=await o(t);process.exit(e);break}case"architecture-answers":{const{architectureAnswersCliHandler:o}=await import("./commands/architecture-answers.js"),e=await o(t);process.exit(e);break}case"update":{console.log("To update Neocortex, run:"),console.log(" neocortex update"),console.log(""),console.log("Or manually:"),console.log(" npm install -g @ornexus/neocortex@latest"),process.exit(0);break}default:console.error(`Unknown command: ${a}`),console.error('Run "neocortex-client --help" for usage information.'),process.exit(1)}}d().catch(c=>{console.error(`Fatal error: ${c instanceof Error?c.message:String(c)}`),process.exit(1)});
204
+ `.trim(),m=new Set(["pm","install","postinstall","preinstall","prepublish","postpublish","preuninstall","postuninstall","preprepare","prepare","postprepare"]);async function d(){const s=process.argv.slice(2),n=s[0];n&&m.has(n.toLowerCase())&&process.exit(0),(!n||n==="--help"||n==="-h")&&(console.log(l),process.exit(0)),(n==="--version"||n==="-v")&&(console.log(p()),process.stderr.write(`Licensed under BSL-1.1 (Business Source License 1.1)
205
+ `),process.exit(0));const o=s.slice(1);switch(n){case"invoke":{const{invokeCliHandler:e,flushInvokeCliOutput:t}=await import("./commands/invoke.js"),r=await e(o),i=await t();process.exitCode=i?r:1;break}case"activate":{const{activate:e}=await import("./commands/activate.js");let t,r,i=!1;for(let a=0;a<o.length;a++){const c=o[a];c==="--server-url"?r=o[++a]:c==="--non-interactive"?i=!0:c==="--help"||c==="-h"?(console.log(l),process.exit(0)):c.startsWith("-")||(t=c)}t||(console.error("Error: License key is required."),console.error("Usage: neocortex-client activate <license-key>"),console.error("Example: neocortex-client activate NX-PRO-ABC-123"),process.exit(1));try{const a=await e({licenseKey:t,serverUrl:r,nonInteractive:i});a.success?(console.log(a.message),process.exit(0)):(console.error(a.message),process.exit(1))}catch(a){const c=a instanceof Error?a.message:String(a);console.error(`Activation failed: ${c}`),process.exit(1)}break}case"cache-status":{console.log("Cache status requires an active client session."),console.log("Use this command within a running Neocortex client context."),process.exit(0);break}case"config":{const{configCliHandler:e}=await import("./commands/config.js"),t=await e(o);process.exit(t);break}case"refresh-memory":{const{refreshMemoryCliHandler:e}=await import("./commands/refresh-memory.js"),t=await e(o);process.exit(t);break}case"architecture-memory":{const{architectureMemoryTerminalCliHandler:e}=await import("./commands/architecture-memory-terminal.js"),t=await e(o);process.exit(t);break}case"planning-diagnosis":{const{planningDiagnosisCliHandler:e}=await import("./commands/planning-diagnosis.js"),t=await e(o);process.exit(t);break}case"planning-research":{const{planningResearchCliHandler:e}=await import("./commands/planning-research.js"),t=await e(o);process.exit(t);break}case"private-session":{const{privateSessionCliHandler:e}=await import("./commands/private-session.js"),t=await e(o);process.exit(t);break}case"planning-memory":{const{planningMemoryCliHandler:e}=await import("./commands/planning-memory.js"),t=await e(o);process.exit(t);break}case"planning-generation":{const{planningGenerationCliHandler:e}=await import("./commands/planning-generation.js"),t=await e(o);process.exit(t);break}case"story-checkpoint":{const{storyCheckpointCliHandler:e}=await import("./commands/story-checkpoint.js"),t=await e(o);process.exit(t);break}case"legacy-story-branch":{const{legacyStoryBranchCliHandler:e}=await import("./commands/legacy-story-branch.js"),t=await e(o);process.exit(t);break}case"legacy-story-pr":{const{legacyStoryPrCliHandler:e}=await import("./commands/legacy-story-pr.js"),t=await e(o);process.exit(t);break}case"legacy-epic-terminal":{const{legacyEpicTerminalCliHandler:e}=await import("./commands/legacy-epic-terminal.js"),t=await e(o);process.exit(t);break}case"mutation-qa":{const{mutationQaCliHandler:e}=await import("./commands/mutation-qa.js"),t=await e(o);process.exit(t);break}case"property-qa":{const{propertyQaCliHandler:e}=await import("./commands/property-qa.js"),t=await e(o);process.exit(t);break}case"qa-synthetic-backend":{const{syntheticBackendCliHandler:e}=await import("./commands/qa-synthetic-backend.js");process.exitCode=await e(s.slice(1));break}case"qa-scan-review":{const{qaScanReviewCliHandler:e}=await import("./commands/qa-scan-review.js"),t=await e(o);process.exit(t);break}case"qa-root":{const{qaControlCliHandler:e}=await import("./commands/qa-control.js");process.exit(await e(o));break}case"refactor-root":{if(o[0]==="control"){const{refactorControlCliHandler:r}=await import("./commands/refactor-control.js");process.exit(await r(o))}if(o[0]==="characterize"){const{refactorCharacterizationCliHandler:r}=await import("./commands/refactor-characterization.js");process.exit(r(o))}if(o[0]==="review-accept"||o[0]==="review-status"){const{refactorReviewCliHandler:r}=await import("./commands/refactor-review.js");process.exit(await r(o))}if(o[0]?.startsWith("commit-")){const{refactorCommitCliHandler:r}=await import("./commands/refactor-commit.js");process.exit(r(o))}const{refactorRootCliHandler:e}=await import("./commands/refactor-root.js"),t=e(o);process.exit(t);break}case"native-agent":{const{nativeAgentCliHandler:e}=await import("./commands/native-agent.js"),t=await e(o);process.exit(t);break}case"architecture-answers":{const{architectureAnswersCliHandler:e}=await import("./commands/architecture-answers.js"),t=await e(o);process.exit(t);break}case"update":{console.log("To update Neocortex, run:"),console.log(" neocortex update"),console.log(""),console.log("Or manually:"),console.log(" npm install -g @ornexus/neocortex@latest"),process.exit(0);break}default:console.error(`Unknown command: ${n}`),console.error('Run "neocortex-client --help" for usage information.'),process.exit(1)}}d().catch(s=>{console.error(`Fatal error: ${s instanceof Error?s.message:String(s)}`),process.exit(1)});
@@ -1,8 +1,8 @@
1
- import{existsSync as V,mkdirSync as x,writeFileSync as Y,readFileSync as I}from"node:fs";import{join as o,dirname as C}from"node:path";import{homedir as X}from"node:os";import{fileURLToPath as W}from"node:url";import{LicenseClient as J}from"../license/license-client.js";import{EncryptedCache as P}from"../cache/encrypted-cache.js";import{getMachineFingerprint as S}from"../machine/fingerprint.js";import{updateAgentDescription as E}from"../agent/update-description.js";import{refreshStubs as h}from"../agent/refresh-stubs.js";import{updateAgentYaml as N}from"../agent/update-agent-yaml.js";import{saveSecureConfig as B,setSecureDirPermissions as _}from"../config/secure-config.js";import{DEFAULT_SERVER_URL as G}from"../constants.js";function b(){try{const e=W(import.meta.url);let t=C(e);for(let r=0;r<5;r++){try{const n=JSON.parse(I(o(t,"package.json"),"utf-8"));if(n.name==="@ornexus/neocortex"||n.name==="@neocortex/client")return n.version??"0.0.0"}catch{}t=C(t)}}catch{}return"0.0.0"}const i=o(X(),".neocortex"),c=o(i,"config.json"),z=/^NX-(F|P|E)-[a-f0-9]+-[a-f0-9]+$/i,q=/^nxk_(?:[a-z]+_)?[a-f0-9]+_[a-f0-9]+$/;function H(e){if(!e||e.trim().length===0)return{valid:!1,error:"License key cannot be empty"};const t=e.trim().toUpperCase();return t.startsWith("NX-")?z.test(t)?{valid:!0}:{valid:!1,error:"Invalid license key format. Expected: NX-{TIER}-{ID} (e.g., NX-PRO-ABC-123)"}:{valid:!1,error:'License key must start with "NX-"'}}function Q(e){if(!e||e.trim().length===0)return{valid:!1,error:"API key cannot be empty"};const t=e.trim();return t.startsWith("nxk_")?t.length<20?{valid:!1,error:"API key is too short"}:q.test(t)?{valid:!0}:{valid:!1,error:"Invalid API key format. Expected: nxk_{id}_{check} (e.g., nxk_abc123def456...)"}:{valid:!1,error:'API key must start with "nxk_"'}}function pe(){try{if(V(c)){const e=I(c,"utf-8");return JSON.parse(e)}}catch{}return null}function A(e){x(i,{recursive:!0}),_(i);const t=o(i,"cache");if(x(t,{recursive:!0}),_(t),e.licenseKey||e.apiKey)B({serverUrl:e.serverUrl,mode:e.mode,machineId:e.machineId,activatedAt:e.activatedAt,tier:e.tier,licenseKey:e.licenseKey??e.apiKey});else{const r={configVersion:1,...e};Y(c,JSON.stringify(r,null,2)+`
2
- `,"utf-8")}}async function he(e){const{licenseKey:t,serverUrl:r=G}=e;if(!t)return{success:!1,message:["No key provided.","","Get your license key at https://neocortex.sh/portal/login","","Usage:"," neocortex activate YOUR-LICENSE-KEY"," neocortex activate YOUR-API-KEY"].join(`
3
- `)};const n=t.trim();if(n.startsWith("nxk_")){const a=Q(n);if(!a.valid)return{success:!1,message:`Invalid API key: ${a.error}`};const k=n.match(/^nxk_(free|pro|ent)_/),R={free:"free",pro:"pro",ent:"enterprise"},T=k?.[1]?R[k[1]]??"unknown":"unknown",w=S(),l=b();let m;try{const s=await fetch(`${r}/api/v1/license/activate-key`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:n,machine_id:w,client_version:l})});if(!s.ok)return{success:!1,message:`API key activation failed: ${(await s.json().catch(()=>({}))).message??`HTTP ${s.status}`}`};m=await s.json()}catch{return{success:!1,message:["Failed to connect to IP Protection Server.","","Possible causes:",` - Server at ${r} is unreachable`," - Network connectivity issue","","Workaround: Use --local flag to run in local mode"].join(`
4
- `)}}const p=m.tier??T,L=o(i,"cache");try{await new P({cacheDir:L,passphrase:n}).set("neocortex:jwt:token",m.token,m.expires_in*1e3)}catch{}const $={serverUrl:r,mode:"remote",machineId:w,activatedAt:new Date().toISOString(),tier:p,apiKey:n};try{A($)}catch(s){return{success:!1,message:`Failed to save configuration: ${s instanceof Error?s.message:"unknown error"}`}}const M=h(l,{forceCreate:!0,targetFilter:"claude-code"})+h(l);return E(l,p),N(l,p),{success:!0,message:["Neocortex activated successfully.","","Open your preferred platform (Claude Code, Cursor, VS Code, etc.)","and reference the Neocortex agent.",...M>0?["","Managed agent wrappers were refreshed while preserving existing Markdown frontmatter and unrelated platform files."]:[],"","Use *menu to see available commands or check the Docs in your Dashboard."].join(`
5
- `),tier:p,serverUrl:r,configPath:c}}const y=H(n);if(!y.valid)return{success:!1,message:`Invalid license key: ${y.error}`};const d=n,v=d.match(/^NX-(F|P|E)-/i),F={F:"free",P:"pro",E:"enterprise"},u=v?.[1]?F[v[1].toUpperCase()]??"unknown":"unknown",K=o(i,"cache"),U=new P({cacheDir:K,passphrase:d}),j=new J({serverUrl:r,licenseKey:d,cacheProvider:U});let g;try{g=await j.activate()}catch{return{success:!1,message:["Failed to connect to IP Protection Server.","","Possible causes:",` - Server at ${r} is unreachable`," - Network connectivity issue"," - Server is still being deployed","","Workaround: Use --local flag to run in local mode"].join(`
6
- `)}}if(!g)return{success:!1,message:["License activation failed.","","Possible causes:"," - Invalid or expired license key"," - License already activated on another machine"," - Server rejected the activation request","","Check your license key and try again.","Contact support if the problem persists."].join(`
7
- `)};const D={serverUrl:r,mode:"remote",machineId:S(),activatedAt:new Date().toISOString(),tier:u,licenseKey:d};try{A(D)}catch(a){return{success:!1,message:`Failed to save config to ${c}: ${a instanceof Error?a.message:String(a)}`}}const f=b(),O=h(f,{forceCreate:!0,targetFilter:"claude-code"})+h(f);return E(f,u),N(f,u),{success:!0,message:["Neocortex activated successfully.","","Open your preferred platform (Claude Code, Cursor, VS Code, etc.)","and reference the Neocortex agent.",...O>0?["","Managed agent wrappers were refreshed while preserving existing Markdown frontmatter and unrelated platform files."]:[],"","Use *menu to see available commands or check the Docs in your Dashboard."].join(`
8
- `),tier:u,serverUrl:r,configPath:c}}export{he as activate,Q as validateApiKeyFormat,H as validateLicenseKeyFormat};
1
+ import{existsSync as Y,mkdirSync as x,writeFileSync as X,readFileSync as I}from"node:fs";import{join as i,dirname as C}from"node:path";import{homedir as W}from"node:os";import{fileURLToPath as J}from"node:url";import{LicenseClient as B}from"../license/license-client.js";import{EncryptedCache as P}from"../cache/encrypted-cache.js";import{getMachineFingerprint as S}from"../machine/fingerprint.js";import{updateAgentDescription as E}from"../agent/update-description.js";import{refreshStubs as h}from"../agent/refresh-stubs.js";import{updateAgentYaml as N}from"../agent/update-agent-yaml.js";import{saveSecureConfig as G,setSecureDirPermissions as _}from"../config/secure-config.js";import{DEFAULT_SERVER_URL as z}from"../constants.js";function b(){try{const e=J(import.meta.url);let t=C(e);for(let r=0;r<5;r++){try{const n=JSON.parse(I(i(t,"package.json"),"utf-8"));if(n.name==="@ornexus/neocortex"||n.name==="@neocortex/client")return n.version??"0.0.0"}catch{}t=C(t)}}catch{}return"0.0.0"}const o=i(W(),".neocortex"),c=i(o,"config.json"),q=/^NX-(F|P|E)-[a-f0-9]+-[a-f0-9]+$/i,H=/^nxk_(?:[a-z]+_)?[a-f0-9]+_[a-f0-9]+$/;function Q(e){if(!e||e.trim().length===0)return{valid:!1,error:"License key cannot be empty"};const t=e.trim().toUpperCase();return t.startsWith("NX-")?q.test(t)?{valid:!0}:{valid:!1,error:"Invalid license key format. Expected: NX-{TIER}-{ID} (e.g., NX-PRO-ABC-123)"}:{valid:!1,error:'License key must start with "NX-"'}}function Z(e){if(!e||e.trim().length===0)return{valid:!1,error:"API key cannot be empty"};const t=e.trim();return t.startsWith("nxk_")?t.length<20?{valid:!1,error:"API key is too short"}:H.test(t)?{valid:!0}:{valid:!1,error:"Invalid API key format. Expected: nxk_{id}_{check} (e.g., nxk_abc123def456...)"}:{valid:!1,error:'API key must start with "nxk_"'}}function he(){try{if(Y(c)){const e=I(c,"utf-8");return JSON.parse(e)}}catch{}return null}function A(e){x(o,{recursive:!0}),_(o);const t=i(o,"cache");if(x(t,{recursive:!0}),_(t),e.licenseKey||e.apiKey)G({serverUrl:e.serverUrl,mode:e.mode,machineId:e.machineId,activatedAt:e.activatedAt,tier:e.tier,licenseKey:e.licenseKey??e.apiKey});else{const r={configVersion:1,...e};X(c,JSON.stringify(r,null,2)+`
2
+ `,"utf-8")}}async function ye(e){const{licenseKey:t,serverUrl:r=z}=e;if(!t)return{success:!1,message:["No key provided.","","Get your license key at https://neocortex.sh/portal/login","","Usage:"," neocortex activate YOUR-LICENSE-KEY"," neocortex activate YOUR-API-KEY"].join(`
3
+ `)};const n=t.trim();if(n.startsWith("nxk_")){const s=Z(n);if(!s.valid)return{success:!1,message:`Invalid API key: ${s.error}`};const k=n.match(/^nxk_(free|pro|ent)_/),T={free:"free",pro:"pro",ent:"enterprise"},L=k?.[1]?T[k[1]]??"unknown":"unknown",w=S(),l=b();let m;try{const a=await fetch(`${r}/api/v1/license/activate-key`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:n,machine_id:w,client_version:l})});if(!a.ok)return{success:!1,message:`API key activation failed: ${(await a.json().catch(()=>({}))).message??`HTTP ${a.status}`}`};m=await a.json()}catch{return{success:!1,message:["Failed to connect to IP Protection Server.","","Possible causes:",` - Server at ${r} is unreachable`," - Network connectivity issue","","Workaround: Use --local flag to run in local mode"].join(`
4
+ `)}}const p=m.tier??L,$=i(o,"cache");try{await new P({cacheDir:$,passphrase:n}).set("neocortex:jwt:token",m.token,m.expires_in*1e3)}catch{}const M={serverUrl:r,mode:"remote",machineId:w,activatedAt:new Date().toISOString(),tier:p,apiKey:n};try{A(M)}catch(a){return{success:!1,message:`Failed to save configuration: ${a instanceof Error?a.message:"unknown error"}`}}const V=h(l,{forceCreate:!0,targetFilter:"claude-code"})+h(l);return E(l,p),N(l,p),{success:!0,message:["Neocortex activated successfully.","","Open your preferred platform (Claude Code, Cursor, VS Code, etc.)","and reference the Neocortex agent.",...V>0?["","Managed agent wrappers were refreshed while preserving existing Markdown frontmatter and unrelated platform files."]:[],"","Use *menu to see available commands or check the Docs in your Dashboard."].join(`
5
+ `),tier:p,serverUrl:r,configPath:c}}const v=Q(n);if(!v.valid)return{success:!1,message:`Invalid license key: ${v.error}`};const d=n,g=d.match(/^NX-(F|P|E)-/i),F={F:"free",P:"pro",E:"enterprise"},K=g?.[1]?F[g[1].toUpperCase()]??"unknown":"unknown",U=i(o,"cache"),j=new P({cacheDir:U,passphrase:d}),D=new B({serverUrl:r,licenseKey:d,cacheProvider:j});let y;try{y=await D.activate()}catch{return{success:!1,message:["Failed to connect to IP Protection Server.","","Possible causes:",` - Server at ${r} is unreachable`," - Network connectivity issue"," - Server is still being deployed","","Workaround: Use --local flag to run in local mode"].join(`
6
+ `)}}if(!y)return{success:!1,message:["License activation failed.","","Possible causes:"," - Invalid or expired license key"," - License already activated on another machine"," - Server rejected the activation request","","Check your license key and try again.","Contact support if the problem persists."].join(`
7
+ `)};const u=y.tier??K,O={serverUrl:r,mode:"remote",machineId:S(),activatedAt:new Date().toISOString(),tier:u,licenseKey:d};try{A(O)}catch(s){return{success:!1,message:`Failed to save config to ${c}: ${s instanceof Error?s.message:String(s)}`}}const f=b(),R=h(f,{forceCreate:!0,targetFilter:"claude-code"})+h(f);return E(f,u),N(f,u),{success:!0,message:["Neocortex activated successfully.","","Open your preferred platform (Claude Code, Cursor, VS Code, etc.)","and reference the Neocortex agent.",...R>0?["","Managed agent wrappers were refreshed while preserving existing Markdown frontmatter and unrelated platform files."]:[],"","Use *menu to see available commands or check the Docs in your Dashboard."].join(`
8
+ `),tier:u,serverUrl:r,configPath:c}}export{ye as activate,Z as validateApiKeyFormat,Q as validateLicenseKeyFormat};
@@ -1,2 +1,4 @@
1
- import{execFileSync as l}from"node:child_process";import{createHash as F,randomUUID as V}from"node:crypto";import{closeSync as h,fsyncSync as w,lstatSync as b,mkdirSync as J,openSync as y,readFileSync as I,realpathSync as O,renameSync as L,unlinkSync as T,writeFileSync as H}from"node:fs";import{isAbsolute as X,join as p,resolve as S}from"node:path";import{listProjectMemoryTargets as q}from"../memory/shared-project-memory-types.js";import{parseRefreshMemoryArgs as U,verifyProjectMemoryTargets as B}from"./refresh-memory.js";function Z(e,t){if(!c(e)||!c(t)||Object.keys(e).sort().join(",")!==["schemaVersion","targetEpicId","graphRevision","sourceHead","canonicalSha256","projectionSha256","fileCount","completionReceiptId","validationReceiptId","receiptId","status","evidenceIds","publicSafe"].sort().join(",")||e.schemaVersion!=="ArchitectureTerminalMemoryReceipt/1"||e.targetEpicId!==t.targetEpicId||e.graphRevision!==t.graphRevision||e.completionReceiptId!==t.completionEvidence?.receiptId||e.validationReceiptId!==t.validationEvidence?.receiptId||typeof e.sourceHead!="string"||!/^[a-f0-9]{40}$/.test(e.sourceHead)||![e.graphRevision,e.canonicalSha256,e.projectionSha256,e.completionReceiptId,e.validationReceiptId,e.receiptId].every(i=>typeof i=="string"&&/^[a-f0-9]{64}$/.test(i))||!Number.isInteger(e.fileCount)||e.fileCount<1||e.fileCount>64||e.status!=="passed"||e.publicSafe!==!0||!Array.isArray(e.evidenceIds)||e.evidenceIds.length!==1)return!1;const n={schemaVersion:e.schemaVersion,targetEpicId:e.targetEpicId,graphRevision:e.graphRevision,sourceHead:e.sourceHead,canonicalSha256:e.canonicalSha256,projectionSha256:e.projectionSha256,fileCount:e.fileCount,completionReceiptId:e.completionReceiptId,validationReceiptId:e.validationReceiptId},o=C(JSON.stringify(n));return e.receiptId===o&&e.evidenceIds[0]===`memory-physical-${o.slice(0,24)}`}function c(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function C(e){return F("sha256").update(e).digest("hex")}function M(e,t){if(!c(t)||t.owner!=="root"||t.currentStageCommand!=="update-memory"||t.continuationState!=="delegate"||t.childStatus!=="succeeded"||t.evidencePolicy!=="v2-required"||typeof t.targetEpicId!="string"||!/^P[1-9][0-9]{0,11}$/.test(t.targetEpicId)||typeof t.graphRevision!="string"||!/^[a-f0-9]{64}$/.test(t.graphRevision)||!Array.isArray(t.acceptedStages)||t.acceptedStages.length!==14||!c(t.reviewDecision)||t.reviewDecision.decision!=="approved"||!c(t.completionEvidence)||t.completionEvidence.status!=="succeeded"||t.completionEvidence.stageCommand!=="update-memory"||!c(t.validationEvidence)||t.validationEvidence.status!=="passed"||t.validationEvidence.stageCommand!=="update-memory"||typeof t.completionEvidence.receiptId!="string"||!/^[a-f0-9]{64}$/.test(t.completionEvidence.receiptId)||typeof t.validationEvidence.receiptId!="string"||!/^[a-f0-9]{64}$/.test(t.validationEvidence.receiptId))throw new Error("architecture-terminal-memory-evidence-incomplete");const n=B(U(["--verify","--project-root",e])),o=l("git",["rev-parse","HEAD"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(!/^[a-f0-9]{40}$/.test(o))throw new Error("architecture-terminal-memory-head-invalid");const i=I(p(e,"NEOCORTEX.md")),f=l("git",["show","HEAD:NEOCORTEX.md"],{cwd:e,stdio:["ignore","pipe","ignore"],maxBuffer:65536});if(!i.equals(f)||C(i)!==n.canonicalSha256)throw new Error("architecture-terminal-memory-uncommitted");const v=[...new Set(["NEOCORTEX.md",...q().flatMap(r=>[r.primaryFile,...r.secondaryFiles.filter(d=>d.scope==="project").map(d=>d.path)])])];if(l("git",["diff","--name-only","HEAD","--",...v],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim())throw new Error("architecture-terminal-memory-uncommitted");const m={schemaVersion:"ArchitectureTerminalMemoryReceipt/1",targetEpicId:t.targetEpicId,graphRevision:t.graphRevision,sourceHead:o,canonicalSha256:n.canonicalSha256,projectionSha256:n.projectionSha256,fileCount:n.fileCount,completionReceiptId:t.completionEvidence.receiptId,validationReceiptId:t.validationEvidence.receiptId},s=C(JSON.stringify(m));return{...m,receiptId:s,status:"passed",evidenceIds:[`memory-physical-${s.slice(0,24)}`],publicSafe:!0}}function _(e){const t=S(e),n=l("git",["rev-parse","--show-toplevel"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(O(t)!==t||S(n)!==t)throw new Error("architecture-terminal-memory-project-root-invalid");const o=p(t,".neocortex"),i=p(o,"state.json"),f=p(o,"state.json.architecture.lock"),v=y(f,"wx",384);let a;try{const m=b(i);if(!m.isFile()||m.isSymbolicLink())throw new Error("architecture-terminal-memory-state-invalid");const s=I(i,"utf8"),r=JSON.parse(s);if(!c(r)||!c(r.archPlan)||!c(r.archPlan.execution)||!c(r.epics)||r.scope&&c(r.scope)&&r.scope.kind==="projected"||!Object.hasOwn(r.epics,String(r.archPlan.execution.targetEpicId))||r.archPlan.execution.terminalMemoryCheckpoint!==void 0)throw new Error("architecture-terminal-memory-state-invalid");const d=M(t,r.archPlan.execution),R=l("git",["rev-parse","--git-common-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),g=X(R)?S(R):S(t,R);if(O(g)!==g||b(g).isSymbolicLink())throw new Error("architecture-terminal-memory-backup-dir-invalid");const E=p(g,"neocortex-architecture");J(E,{recursive:!0,mode:448});const u=b(E);if(!u.isDirectory()||u.isSymbolicLink()||u.uid!==process.getuid?.()||(u.mode&63)!==0)throw new Error("architecture-terminal-memory-backup-dir-invalid");if(I(i,"utf8")!==s)throw new Error("architecture-terminal-memory-state-conflict");const P=V(),D=p(E,`state-backup-${P}.json`),k=y(D,"wx",384);try{H(k,s),w(k)}finally{h(k)}const A=y(E,"r");try{w(A)}finally{h(A)}const N={...r,archPlan:{...r.archPlan,execution:{...r.archPlan.execution,terminalMemoryCheckpoint:d}}};a=p(o,`state.json.architecture-tmp-${P}`);const j=y(a,"wx",384);try{H(j,`${JSON.stringify(N,null,2)}
2
- `),w(j)}finally{h(j)}if(I(i,"utf8")!==s)throw new Error("architecture-terminal-memory-state-conflict");if(M(t,r.archPlan.execution).receiptId!==d.receiptId)throw new Error("architecture-terminal-memory-physical-conflict");L(a,i),a=void 0;const $=y(o,"r");try{w($)}finally{h($)}return d}finally{if(a)try{T(a)}catch{}h(v),T(f)}}async function x(e){try{if(e[0]!=="seal"||e.length!==1&&e.length!==3||e.length===3&&e[1]!=="--project-root")throw new Error("usage: architecture-memory seal [--project-root <path>]");const t=_(e.length===3?e[2]:process.cwd());return console.log(`Architecture memory sealed: receipt=${t.receiptId} head=${t.sourceHead} files=${t.fileCount}`),0}catch(t){return console.error(t instanceof Error?t.message:String(t)),1}}export{Z as acceptedArchitectureTerminalMemoryReceipt,x as architectureMemoryTerminalCliHandler,M as deriveArchitectureTerminalMemoryReceipt,_ as sealArchitectureTerminalMemory};
1
+ import{architectureMemoryPredecessorCount as F}from"./architecture-non-ui-continuation.js";import{execFileSync as g}from"node:child_process";import{createHash as V,randomUUID as B}from"node:crypto";import{closeSync as w,fsyncSync as I,lstatSync as j,mkdirSync as J,openSync as E,readFileSync as S,realpathSync as M,renameSync as L,unlinkSync as H,writeFileSync as O}from"node:fs";import{isAbsolute as X,join as f,resolve as v}from"node:path";import{listProjectMemoryTargets as q}from"../memory/shared-project-memory-types.js";import{parseRefreshMemoryArgs as U,verifyProjectMemoryTargets as _}from"./refresh-memory.js";function z(r,e){if(!c(r)||!c(e)||Object.keys(r).sort().join(",")!==["schemaVersion","targetEpicId","graphRevision","sourceHead","canonicalSha256","projectionSha256","fileCount","completionReceiptId","validationReceiptId","receiptId","status","evidenceIds","publicSafe"].sort().join(",")||r.schemaVersion!=="ArchitectureTerminalMemoryReceipt/1"||r.targetEpicId!==e.targetEpicId||r.graphRevision!==e.graphRevision||r.completionReceiptId!==e.completionEvidence?.receiptId||r.validationReceiptId!==e.validationEvidence?.receiptId||typeof r.sourceHead!="string"||!/^[a-f0-9]{40}$/.test(r.sourceHead)||![r.graphRevision,r.canonicalSha256,r.projectionSha256,r.completionReceiptId,r.validationReceiptId,r.receiptId].every(n=>typeof n=="string"&&/^[a-f0-9]{64}$/.test(n))||!Number.isInteger(r.fileCount)||r.fileCount<1||r.fileCount>64||r.status!=="passed"||r.publicSafe!==!0||!Array.isArray(r.evidenceIds)||r.evidenceIds.length!==1)return!1;const s={schemaVersion:r.schemaVersion,targetEpicId:r.targetEpicId,graphRevision:r.graphRevision,sourceHead:r.sourceHead,canonicalSha256:r.canonicalSha256,projectionSha256:r.projectionSha256,fileCount:r.fileCount,completionReceiptId:r.completionReceiptId,validationReceiptId:r.validationReceiptId},i=b(JSON.stringify(s));return r.receiptId===i&&r.evidenceIds[0]===`memory-physical-${i.slice(0,24)}`}function c(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function b(r){return V("sha256").update(r).digest("hex")}function T(r,e){if(!c(e)||e.owner!=="root"||e.currentStageCommand!=="update-memory"||e.continuationState!=="delegate"||e.childStatus!=="succeeded"||e.evidencePolicy!=="v2-required"||typeof e.targetEpicId!="string"||!/^P[1-9][0-9]{0,11}$/.test(e.targetEpicId)||typeof e.graphRevision!="string"||!/^[a-f0-9]{64}$/.test(e.graphRevision)||!Array.isArray(e.acceptedStages)||e.acceptedStages.length!==F(e)||!c(e.reviewDecision)||e.reviewDecision.decision!=="approved"||!c(e.completionEvidence)||e.completionEvidence.status!=="succeeded"||e.completionEvidence.stageCommand!=="update-memory"||!c(e.validationEvidence)||e.validationEvidence.status!=="passed"||e.validationEvidence.stageCommand!=="update-memory"||typeof e.completionEvidence.receiptId!="string"||!/^[a-f0-9]{64}$/.test(e.completionEvidence.receiptId)||typeof e.validationEvidence.receiptId!="string"||!/^[a-f0-9]{64}$/.test(e.validationEvidence.receiptId))throw new Error("architecture-terminal-memory-evidence-incomplete");const s=_(U(["--verify","--project-root",r])),i=g("git",["rev-parse","HEAD"],{cwd:r,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(!/^[a-f0-9]{40}$/.test(i))throw new Error("architecture-terminal-memory-head-invalid");const n=S(f(r,"NEOCORTEX.md")),u=g("git",["show","HEAD:NEOCORTEX.md"],{cwd:r,stdio:["ignore","pipe","ignore"],maxBuffer:65536});if(!n.equals(u)||b(n)!==s.canonicalSha256)throw new Error("architecture-terminal-memory-uncommitted");const k=[...new Set(["NEOCORTEX.md",...q().flatMap(a=>[a.primaryFile,...a.secondaryFiles.filter(o=>o.scope==="project").map(o=>o.path)])])];if(g("git",["diff","--name-only","HEAD","--",...k],{cwd:r,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim())throw new Error("architecture-terminal-memory-uncommitted");let p=i;if(e.terminalMemoryCheckpoint!==void 0){if(!z(e.terminalMemoryCheckpoint,e))throw new Error("architecture-terminal-memory-checkpoint-invalid");p=e.terminalMemoryCheckpoint.sourceHead;const a=o=>g("git",o,{cwd:r,encoding:"utf8",stdio:["ignore","pipe","ignore"],maxBuffer:1024*1024}).trim();try{a(["merge-base","--is-ancestor",p,i]);const o=a(["rev-list","--max-count=257","--reverse","--parents",`${p}..${i}`]).split(`
2
+ `).filter(Boolean);if(o.length>256)throw new Error("checkpoint-range-too-large");for(const y of o){const l=y.split(" ");if(l.length!==2)throw new Error("checkpoint-merge-unverified");const h=a(["diff-tree","--no-commit-id","--name-only","-r",l[0]]).split(`
3
+ `).filter(Boolean);if(h.length!==1||h[0]!==".neocortex/state.json")throw new Error("checkpoint-range-not-state-only")}}catch{throw new Error("architecture-terminal-memory-checkpoint-range-invalid")}}const m={schemaVersion:"ArchitectureTerminalMemoryReceipt/1",targetEpicId:e.targetEpicId,graphRevision:e.graphRevision,sourceHead:p,canonicalSha256:s.canonicalSha256,projectionSha256:s.projectionSha256,fileCount:s.fileCount,completionReceiptId:e.completionEvidence.receiptId,validationReceiptId:e.validationEvidence.receiptId},t=b(JSON.stringify(m));return{...m,receiptId:t,status:"passed",evidenceIds:[`memory-physical-${t.slice(0,24)}`],publicSafe:!0}}function G(r){const e=v(r),s=g("git",["rev-parse","--show-toplevel"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(M(e)!==e||v(s)!==e)throw new Error("architecture-terminal-memory-project-root-invalid");const i=f(e,".neocortex"),n=f(i,"state.json"),u=f(i,"state.json.architecture.lock"),k=E(u,"wx",384);let d;try{const p=j(n);if(!p.isFile()||p.isSymbolicLink())throw new Error("architecture-terminal-memory-state-invalid");const m=S(n,"utf8"),t=JSON.parse(m);if(!c(t)||!c(t.archPlan)||!c(t.archPlan.execution)||!c(t.epics)||t.scope&&c(t.scope)&&t.scope.kind==="projected"||!Object.hasOwn(t.epics,String(t.archPlan.execution.targetEpicId))||t.archPlan.execution.terminalMemoryCheckpoint!==void 0)throw new Error("architecture-terminal-memory-state-invalid");const a=T(e,t.archPlan.execution),o=g("git",["rev-parse","--git-common-dir"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),y=X(o)?v(o):v(e,o);if(M(y)!==y||j(y).isSymbolicLink())throw new Error("architecture-terminal-memory-backup-dir-invalid");const l=f(y,"neocortex-architecture");J(l,{recursive:!0,mode:448});const h=j(l);if(!h.isDirectory()||h.isSymbolicLink()||h.uid!==process.getuid?.()||(h.mode&63)!==0)throw new Error("architecture-terminal-memory-backup-dir-invalid");if(S(n,"utf8")!==m)throw new Error("architecture-terminal-memory-state-conflict");const P=B(),D=f(l,`state-backup-${P}.json`),R=E(D,"wx",384);try{O(R,m),I(R)}finally{w(R)}const A=E(l,"r");try{I(A)}finally{w(A)}const N={...t,archPlan:{...t.archPlan,execution:{...t.archPlan.execution,terminalMemoryCheckpoint:a}}};d=f(i,`state.json.architecture-tmp-${P}`);const C=E(d,"wx",384);try{O(C,`${JSON.stringify(N,null,2)}
4
+ `),I(C)}finally{w(C)}if(S(n,"utf8")!==m)throw new Error("architecture-terminal-memory-state-conflict");if(T(e,t.archPlan.execution).receiptId!==a.receiptId)throw new Error("architecture-terminal-memory-physical-conflict");L(d,n),d=void 0;const $=E(i,"r");try{I($)}finally{w($)}return a}finally{if(d)try{H(d)}catch{}w(k),H(u)}}async function re(r){try{if(r[0]!=="seal"||r.length!==1&&r.length!==3||r.length===3&&r[1]!=="--project-root")throw new Error("usage: architecture-memory seal [--project-root <path>]");const e=G(r.length===3?r[2]:process.cwd());return console.log(`Architecture memory sealed: receipt=${e.receiptId} head=${e.sourceHead} files=${e.fileCount}`),0}catch(e){return console.error(e instanceof Error?e.message:String(e)),1}}export{z as acceptedArchitectureTerminalMemoryReceipt,re as architectureMemoryTerminalCliHandler,T as deriveArchitectureTerminalMemoryReceipt,G as sealArchitectureTerminalMemory};
@@ -0,0 +1,3 @@
1
+ export declare function architectureMemoryPredecessorCount(execution: Record<string, unknown>): number;
2
+ export type NonUiClientTransition = 'advance' | 'delegate' | 'ask-user' | 'complete' | 'complete-replay';
3
+ export declare function classifyNonUiArchitectureTransition(request: Record<string, unknown>, execution: Record<string, unknown>, memoryReceiptValid?: boolean): NonUiClientTransition | undefined;
@@ -0,0 +1 @@
1
+ import{isDeepStrictEqual as d}from"node:util";import{ARCHITECTURE_PUBLIC_STAGE_COMMANDS as A,NON_UI_ARCHITECTURE_STAGE_COMMANDS as R,parseArchitectureNonUiScopeReceipt as y}from"./shared-architecture-non-ui-contract.js";const a=e=>!!e&&typeof e=="object"&&!Array.isArray(e),r=R;function C(e){const t=y(e.nonUiScopeReceipt);return t&&t.targetEpicId===e.targetEpicId&&t.graphRevision===e.graphRevision&&a(e.accounting)&&t.accountingId===e.accounting.accountingId&&a(e.evidenceExpectation)&&t.rootInputSha256===e.evidenceExpectation.inputHash?t:void 0}function D(e){if(e.nonUiScopeReceipt===void 0)return A.length-1;if(!C(e))throw new Error("architecture-non-ui-scope-invalid");return r.length-1}function f(e,t,c,n){return Array.isArray(e)&&e.length===t&&e.every((i,o)=>a(i)&&i.targetEpicId===c&&i.stageCommand===r[o]&&a(i.completionEvidence)&&a(i.validationEvidence)&&i.completionEvidence.stageCommand===i.stageCommand&&i.completionEvidence.status==="succeeded"&&i.validationEvidence.stageCommand===i.stageCommand&&i.validationEvidence.status==="passed"&&i.completionEvidence.targetEpicId===c&&i.validationEvidence.targetEpicId===c&&i.completionEvidence.artifactHash===i.validationEvidence.artifactHash&&a(i.validationEvidence.isolated)&&a(i.validationEvidence.regression)&&i.validationEvidence.isolated.graphHash===n&&i.validationEvidence.regression.graphHash===n)}function H(e){const t=e.reviewDecision,c=e.completionEvidence,n=e.validationEvidence;return a(t)&&a(c)&&a(n)&&t.schemaVersion==="ArchitectureReviewDecision/1"&&t.decision==="approved"&&t.targetEpicId===e.targetEpicId&&t.graphRevision===e.graphRevision&&t.artifactHash===c.artifactHash&&t.artifactHash===n.artifactHash&&t.completionReceiptId===c.receiptId&&t.validationReceiptId===n.receiptId}function O(e,t,c=!1){const n=t.checkpoint;if(!a(n))return;const i=C(n);if(!i||i.targetEpicId!==e.targetEpicId||i.graphRevision!==e.graphRevision||!a(e.evidenceExpectation)||i.rootInputSha256!==e.evidenceExpectation.inputHash||!a(e.accounting)||i.accountingId!==e.accounting.accountingId||e.nonUiScopeReceipt!==void 0&&!d(e.nonUiScopeReceipt,i))return;const o=e.acceptedStages,s=n.acceptedStages,l=r.indexOf(String(e.currentStageCommand)),p=e.targetEpicId,u=e.graphRevision,g=S=>d(n[S],e[S]),h=e.childStatus===void 0&&e.completionEvidence===void 0&&e.validationEvidence===void 0,E=n.childStatus===void 0&&n.completionEvidence===void 0&&n.validationEvidence===void 0;if(e.currentStageCommand==="arch-design-system"&&e.continuationState==="advance"&&h&&E&&n.currentStageCommand==="arch-performance"&&n.continuationState==="advance"&&t.nextAction==="resume"&&f(o,r.indexOf("arch-performance"),p,u)&&d(s,o))return"advance";if(l<r.indexOf("arch-security")||e.nonUiScopeReceipt===void 0&&e.currentStageCommand!=="arch-security")return;if(e.continuationState==="complete"&&e.currentStageCommand==="update-memory"&&n.continuationState==="complete"&&n.currentStageCommand==="update-memory"&&t.nextAction==="complete"&&f(o,r.length,p,u)&&d(s,o)&&["childStatus","completionEvidence","validationEvidence","reviewDecision","terminalMemoryCheckpoint"].every(g)&&c)return"complete-replay";if(!f(o,l,p,u))return;if(h&&E&&["advance","delegate"].includes(String(e.continuationState))&&n.currentStageCommand===e.currentStageCommand&&n.continuationState==="delegate"&&t.nextAction==="delegate"&&d(s,o)&&g("reviewDecision"))return"delegate";const m=e.completionEvidence,v=e.validationEvidence;if(e.childStatus!=="succeeded"||!a(m)||!a(v)||m.status!=="succeeded"||v.status!=="passed"||m.stageCommand!==e.currentStageCommand||v.stageCommand!==e.currentStageCommand||m.targetEpicId!==p||v.targetEpicId!==p||m.artifactHash!==v.artifactHash)return;if(e.currentStageCommand==="arch-review"&&!H(e))return n.currentStageCommand==="arch-review"&&n.continuationState==="ask-user"&&t.nextAction==="ask-user"&&d(s,o)&&["childStatus","completionEvidence","validationEvidence"].every(g)&&d(n.questionIds,["ARCH-REVIEW-A09-APPROVAL"])&&e.reviewDecision===void 0?"ask-user":void 0;if(e.currentStageCommand==="arch-review"&&(e.continuationState!=="ask-user"||!d(e.questionIds,["ARCH-REVIEW-A09-APPROVAL"])))return;const I=[...o,{targetEpicId:p,stageCommand:e.currentStageCommand,completionEvidence:m,validationEvidence:v}];if(!(!d(s,I)||!g("reviewDecision"))){if(e.currentStageCommand==="update-memory")return n.currentStageCommand==="update-memory"&&n.continuationState==="complete"&&t.nextAction==="complete"&&["childStatus","completionEvidence","validationEvidence","terminalMemoryCheckpoint"].every(g)&&c?"complete":void 0;if(E&&n.currentStageCommand===r[l+1]&&n.continuationState==="advance"&&t.nextAction==="resume")return"advance"}}export{D as architectureMemoryPredecessorCount,O as classifyNonUiArchitectureTransition};