@ornexus/neocortex 4.60.73 → 4.60.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/dist/release-source.json +1 -1
  2. package/dist/sbom.cdx.json +1216 -1210
  3. package/install.ps1 +1 -1
  4. package/install.sh +1 -1
  5. package/package.json +2 -2
  6. package/packages/client/dist/adapters/adapter-registry.js +1 -108
  7. package/packages/client/dist/adapters/antigravity-adapter.js +2 -77
  8. package/packages/client/dist/adapters/claude-code-adapter.js +3 -79
  9. package/packages/client/dist/adapters/codex-adapter.js +2 -80
  10. package/packages/client/dist/adapters/cursor-adapter.js +4 -115
  11. package/packages/client/dist/adapters/gemini-adapter.js +2 -71
  12. package/packages/client/dist/adapters/grok-adapter.js +2 -42
  13. package/packages/client/dist/adapters/index.js +1 -22
  14. package/packages/client/dist/adapters/platform-detector.js +1 -212
  15. package/packages/client/dist/adapters/target-adapter.js +0 -12
  16. package/packages/client/dist/adapters/vscode-adapter.js +2 -72
  17. package/packages/client/dist/agent/refresh-stubs.js +2 -417
  18. package/packages/client/dist/agent/update-agent-yaml.js +1 -102
  19. package/packages/client/dist/agent/update-description.js +1 -251
  20. package/packages/client/dist/cache/crypto-utils.js +1 -78
  21. package/packages/client/dist/cache/encrypted-cache.d.ts +27 -0
  22. package/packages/client/dist/cache/encrypted-cache.js +1 -108
  23. package/packages/client/dist/cache/in-memory-asset-cache.js +1 -73
  24. package/packages/client/dist/cache/index.js +1 -13
  25. package/packages/client/dist/cache/protected-pi-boundary.js +1 -44
  26. package/packages/client/dist/checkpoint/checkpoint-client-reader.js +2 -127
  27. package/packages/client/dist/checkpoint/index.js +1 -11
  28. package/packages/client/dist/checkpoint/shared-checkpoint-types.js +1 -32
  29. package/packages/client/dist/cli.js +5 -358
  30. package/packages/client/dist/commands/activate.js +8 -394
  31. package/packages/client/dist/commands/architecture-answers.js +7 -274
  32. package/packages/client/dist/commands/architecture-memory-terminal.js +4 -253
  33. package/packages/client/dist/commands/architecture-non-ui-continuation.js +1 -100
  34. package/packages/client/dist/commands/architecture-root-binding.js +1 -51
  35. package/packages/client/dist/commands/cache-status.js +2 -112
  36. package/packages/client/dist/commands/config.js +1 -88
  37. package/packages/client/dist/commands/doctor.js +2 -635
  38. package/packages/client/dist/commands/invoke.d.ts +38 -1
  39. package/packages/client/dist/commands/invoke.js +143 -7200
  40. package/packages/client/dist/commands/legacy-epic-terminal.js +1 -71
  41. package/packages/client/dist/commands/legacy-story-branch.js +1 -96
  42. package/packages/client/dist/commands/legacy-story-pr.js +1 -276
  43. package/packages/client/dist/commands/mutation-qa-checkpoint.js +5 -285
  44. package/packages/client/dist/commands/mutation-qa-gate.js +1 -54
  45. package/packages/client/dist/commands/mutation-qa-git.js +1 -41
  46. package/packages/client/dist/commands/mutation-qa-policy.js +1 -102
  47. package/packages/client/dist/commands/mutation-qa-run.js +3 -219
  48. package/packages/client/dist/commands/mutation-qa-verdict.js +1 -149
  49. package/packages/client/dist/commands/mutation-qa.js +1 -220
  50. package/packages/client/dist/commands/native-agent.js +2 -136
  51. package/packages/client/dist/commands/planning-diagnosis.js +1 -43
  52. package/packages/client/dist/commands/planning-generation.js +1 -53
  53. package/packages/client/dist/commands/planning-memory.js +1 -40
  54. package/packages/client/dist/commands/planning-research.js +1 -42
  55. package/packages/client/dist/commands/private-session.js +1 -75
  56. package/packages/client/dist/commands/property-qa.js +1 -139
  57. package/packages/client/dist/commands/qa-control.js +1 -16
  58. package/packages/client/dist/commands/qa-scan-browser-launch.js +1 -55
  59. package/packages/client/dist/commands/qa-scan-browser-route.js +1 -28
  60. package/packages/client/dist/commands/qa-scan-capture.js +5 -663
  61. package/packages/client/dist/commands/qa-scan-discovery.js +3 -376
  62. package/packages/client/dist/commands/qa-scan-review.js +5 -826
  63. package/packages/client/dist/commands/qa-synthetic-backend-capture.js +1 -266
  64. package/packages/client/dist/commands/qa-synthetic-backend-review.js +1 -297
  65. package/packages/client/dist/commands/qa-synthetic-backend.js +2 -340
  66. package/packages/client/dist/commands/qa-synthetic-broker-port.js +1 -85
  67. package/packages/client/dist/commands/qa-synthetic-browser.js +1 -39
  68. package/packages/client/dist/commands/refactor-characterization.js +21 -671
  69. package/packages/client/dist/commands/refactor-commit.js +13 -399
  70. package/packages/client/dist/commands/refactor-control.js +3 -142
  71. package/packages/client/dist/commands/refactor-cpp-assertions.js +3 -93
  72. package/packages/client/dist/commands/refactor-review.js +5 -283
  73. package/packages/client/dist/commands/refactor-root.js +7 -588
  74. package/packages/client/dist/commands/refresh-memory.js +3 -156
  75. package/packages/client/dist/commands/shared-architecture-non-ui.js +1 -24
  76. package/packages/client/dist/commands/story-checkpoint.js +1 -171
  77. package/packages/client/dist/config/host-auth-broker.d.ts +31 -0
  78. package/packages/client/dist/config/host-auth-broker.js +1 -0
  79. package/packages/client/dist/config/host-auth-reference.d.ts +32 -0
  80. package/packages/client/dist/config/host-auth-reference.js +1 -0
  81. package/packages/client/dist/config/profile-directory.js +1 -13
  82. package/packages/client/dist/config/resolver-selection.js +1 -278
  83. package/packages/client/dist/config/secure-config.js +12 -281
  84. package/packages/client/dist/config.js +2 -223
  85. package/packages/client/dist/constants.js +1 -25
  86. package/packages/client/dist/context/context-collector.js +2 -222
  87. package/packages/client/dist/context/context-sanitizer.js +1 -145
  88. package/packages/client/dist/continuity/autonomous-governance.js +1 -285
  89. package/packages/client/dist/continuity/continuity-client-state-store.js +1 -1587
  90. package/packages/client/dist/continuity/invoke-hooks.js +1 -129
  91. package/packages/client/dist/continuity/migrations/001-initial-schema.js +2 -12
  92. package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +2 -12
  93. package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +2 -12
  94. package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +2 -12
  95. package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +2 -12
  96. package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +2 -10
  97. package/packages/client/dist/continuity/native-agent-store.js +1 -69
  98. package/packages/client/dist/continuity/native-agent-types.d.ts +11 -0
  99. package/packages/client/dist/continuity/native-agent-types.js +1 -90
  100. package/packages/client/dist/continuity/outbox.js +1 -117
  101. package/packages/client/dist/continuity/runner-bootstrap-policy.js +1 -172
  102. package/packages/client/dist/continuity/sqlite-store.js +81 -2612
  103. package/packages/client/dist/effects/invoke-effect-gateways.js +1 -62
  104. package/packages/client/dist/errors/error-messages.d.ts +3 -0
  105. package/packages/client/dist/errors/error-messages.js +2 -228
  106. package/packages/client/dist/errors/frontmatter-diagnostics.js +1 -125
  107. package/packages/client/dist/evidence/collector.js +1 -347
  108. package/packages/client/dist/evidence/index.js +1 -1
  109. package/packages/client/dist/evidence/types.js +0 -2
  110. package/packages/client/dist/fs/atomic-state-replace.js +1 -152
  111. package/packages/client/dist/generated/command-registry.generated.js +1 -4076
  112. package/packages/client/dist/generated/public-projections.generated.js +1 -149
  113. package/packages/client/dist/git/direct-yolo-c01-retry.js +4 -138
  114. package/packages/client/dist/git/direct-yolo-checkpoint.d.ts +11 -1
  115. package/packages/client/dist/git/direct-yolo-checkpoint.js +4 -1234
  116. package/packages/client/dist/git/epic-operational-state.js +2 -672
  117. package/packages/client/dist/git/git-lifecycle-step-ids.js +1 -14
  118. package/packages/client/dist/git/git-lifecycle-store.d.ts +23 -0
  119. package/packages/client/dist/git/git-lifecycle-store.js +10 -1981
  120. package/packages/client/dist/git/legacy-story-branch-checkpoint.js +9 -259
  121. package/packages/client/dist/git/legacy-story-branch-setup.js +4 -348
  122. package/packages/client/dist/git/legacy-story-pr.js +70 -3538
  123. package/packages/client/dist/git/secure-filesystem-boundary.js +5 -182
  124. package/packages/client/dist/graph-retrieval/pre-command-hook.js +1 -284
  125. package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +1 -237
  126. package/packages/client/dist/i18n/first-run.js +2 -60
  127. package/packages/client/dist/index.d.ts +2 -0
  128. package/packages/client/dist/index.js +1 -47
  129. package/packages/client/dist/invocation/invoke-input.js +1 -24
  130. package/packages/client/dist/license/host-auth-recovery.d.ts +158 -0
  131. package/packages/client/dist/license/host-auth-recovery.js +1 -0
  132. package/packages/client/dist/license/index.js +1 -5
  133. package/packages/client/dist/license/license-client.d.ts +10 -1
  134. package/packages/client/dist/license/license-client.js +1 -304
  135. package/packages/client/dist/machine/fingerprint.js +2 -163
  136. package/packages/client/dist/machine/index.js +1 -5
  137. package/packages/client/dist/memory/project-memory-path-scope.js +1 -62
  138. package/packages/client/dist/memory/project-memory-writer.js +40 -1007
  139. package/packages/client/dist/memory/shared-project-memory-types.js +2 -253
  140. package/packages/client/dist/migrations/epic-lifecycle-backfill.js +3 -1060
  141. package/packages/client/dist/migrations/project-identity-capability.js +1 -50
  142. package/packages/client/dist/migrations/project-identity.js +7 -493
  143. package/packages/client/dist/migrations/state-json.js +4 -393
  144. package/packages/client/dist/policy/architecture-policy.js +2 -184
  145. package/packages/client/dist/policy/index.js +1 -7
  146. package/packages/client/dist/policy/shared-policy-types.js +0 -38
  147. package/packages/client/dist/policy/subagent-approval-policy.js +1 -55
  148. package/packages/client/dist/private-execution/clean-baseline.js +2 -279
  149. package/packages/client/dist/private-execution/codex-executor.js +4 -574
  150. package/packages/client/dist/private-execution/codex-host-runtime.js +1 -137
  151. package/packages/client/dist/private-execution/codex-lifecycle-guard.js +1 -97
  152. package/packages/client/dist/private-execution/codex-scoped-permissions.js +1 -128
  153. package/packages/client/dist/private-execution/delivery.js +13 -410
  154. package/packages/client/dist/private-execution/diagnosis-root-review.js +2 -294
  155. package/packages/client/dist/private-execution/frozen-handoff.js +6 -19
  156. package/packages/client/dist/private-execution/implementation-validation.js +2 -106
  157. package/packages/client/dist/private-execution/isolated-admission.js +23 -1432
  158. package/packages/client/dist/private-execution/isolated-session.js +5 -725
  159. package/packages/client/dist/private-execution/isolated-workspace.js +1 -122
  160. package/packages/client/dist/private-execution/pact-consumer-runtime.js +3 -409
  161. package/packages/client/dist/private-execution/pact-test-source.js +1 -258
  162. package/packages/client/dist/private-execution/pact-toolchain.js +3 -290
  163. package/packages/client/dist/private-execution/pact-write-set.js +1 -172
  164. package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +5 -406
  165. package/packages/client/dist/private-execution/planning-generation-checkpoint.js +5 -462
  166. package/packages/client/dist/private-execution/planning-memory-checkpoint.js +3 -139
  167. package/packages/client/dist/private-execution/planning-research-checkpoint.js +4 -325
  168. package/packages/client/dist/private-execution/private-report-store.js +1 -42
  169. package/packages/client/dist/private-execution/property-test-candidate.js +1 -103
  170. package/packages/client/dist/private-execution/property-test-choices.js +3 -147
  171. package/packages/client/dist/private-execution/property-test-plan.js +7 -271
  172. package/packages/client/dist/private-execution/property-test-review.js +4 -258
  173. package/packages/client/dist/private-execution/property-test-runtime.js +9 -372
  174. package/packages/client/dist/private-execution/property-test-source.js +1 -139
  175. package/packages/client/dist/private-execution/root-checkpoint.js +1 -80
  176. package/packages/client/dist/private-execution/root-memory-git-evidence.js +3 -135
  177. package/packages/client/dist/private-execution/root-memory-recovery.js +1 -93
  178. package/packages/client/dist/private-execution/root-memory-request.js +1 -29
  179. package/packages/client/dist/private-execution/root-memory-scope.js +1 -178
  180. package/packages/client/dist/private-execution/root-memory-writer.js +1 -102
  181. package/packages/client/dist/private-execution/session-lease.js +1 -63
  182. package/packages/client/dist/private-execution/shared-private-admission-types.js +1 -50
  183. package/packages/client/dist/private-execution/shared-project-validation.js +1 -66
  184. package/packages/client/dist/private-execution/shared-root-memory-types.js +1 -61
  185. package/packages/client/dist/private-execution/ux-source-validation.js +1 -372
  186. package/packages/client/dist/private-execution/ux-write-set.js +2 -191
  187. package/packages/client/dist/registry/registry-reconciliation.js +1 -234
  188. package/packages/client/dist/resilience/circuit-breaker.js +1 -170
  189. package/packages/client/dist/resilience/degradation-manager.js +1 -164
  190. package/packages/client/dist/resilience/freshness-indicator.js +1 -100
  191. package/packages/client/dist/resilience/index.js +1 -8
  192. package/packages/client/dist/resilience/recovery-detector.js +1 -74
  193. package/packages/client/dist/resolvers/asset-resolver.js +0 -13
  194. package/packages/client/dist/resolvers/local-resolver.js +8 -255
  195. package/packages/client/dist/resolvers/remote-resolver.js +1 -233
  196. package/packages/client/dist/runner/binary.js +1 -404
  197. package/packages/client/dist/runner/cli.js +17 -1571
  198. package/packages/client/dist/runner/epic-background-dispatcher.d.ts +61 -0
  199. package/packages/client/dist/runner/epic-background-dispatcher.js +1 -0
  200. package/packages/client/dist/runner/headless/adapters.js +1 -49
  201. package/packages/client/dist/runner/headless/background-root.d.ts +65 -0
  202. package/packages/client/dist/runner/headless/background-root.js +1 -0
  203. package/packages/client/dist/runner/headless/claude-code-adapter.js +1 -79
  204. package/packages/client/dist/runner/headless/continuous-story-workspace.js +11 -1628
  205. package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +1 -69
  206. package/packages/client/dist/runner/headless/epic-merge-candidate-qa.d.ts +1 -1
  207. package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +2 -110
  208. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.d.ts +2 -0
  209. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +10 -1236
  210. package/packages/client/dist/runner/headless/epic-terminal-git-runner.d.ts +27 -2
  211. package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +2 -318
  212. package/packages/client/dist/runner/headless/fake-adapter.js +1 -62
  213. package/packages/client/dist/runner/headless/managed-environment-cleanup.d.ts +95 -0
  214. package/packages/client/dist/runner/headless/managed-environment-cleanup.js +1 -0
  215. package/packages/client/dist/runner/headless/managed-profile.js +1 -132
  216. package/packages/client/dist/runner/headless/opencode-adapter.js +2 -145
  217. package/packages/client/dist/runner/headless/prepared-story-bundle.js +1 -43
  218. package/packages/client/dist/runner/headless/resolver.js +1 -231
  219. package/packages/client/dist/runner/headless/run-yolo.js +1 -885
  220. package/packages/client/dist/runner/headless/run-yoloop.d.ts +1 -0
  221. package/packages/client/dist/runner/headless/run-yoloop.js +2 -2574
  222. package/packages/client/dist/runner/headless/types.js +2 -574
  223. package/packages/client/dist/runner/local-console.js +13 -396
  224. package/packages/client/dist/runner/portal-sync-worker.js +1 -1487
  225. package/packages/client/dist/runner/project-identity.js +1 -106
  226. package/packages/client/dist/runner/scheduler.js +7 -995
  227. package/packages/client/dist/runner-cli.js +2 -18
  228. package/packages/client/dist/state/invocation-shape.js +1 -13
  229. package/packages/client/dist/state/project-state-snapshot.d.ts +7 -0
  230. package/packages/client/dist/state/project-state-snapshot.js +1 -1731
  231. package/packages/client/dist/state/state-json-repair.js +3 -785
  232. package/packages/client/dist/state/structural-dag-projection.js +1 -118
  233. package/packages/client/dist/telemetry/index.js +1 -5
  234. package/packages/client/dist/telemetry/offline-queue.js +1 -131
  235. package/packages/client/dist/tier/index.js +1 -5
  236. package/packages/client/dist/tier/tier-aware-client.js +1 -405
  237. package/packages/client/dist/types/index.js +1 -38
  238. package/packages/client/dist/version.js +1 -27
  239. package/packages/client/dist/yolo/change-evidence-collector.d.ts +21 -1
  240. package/packages/client/dist/yolo/change-evidence-collector.js +1 -126
  241. package/packages/client/dist/yolo/invoke-envelope-capability.js +1 -62
  242. package/packages/client/dist/yolo/spec-envelope-collector.js +5 -184
  243. package/packages/client/dist/yoloop/discovery-hook.js +2 -300
  244. package/packages/client/dist/yoloop/index.js +1 -8
  245. package/packages/client/dist/yoloop/invoke-hooks.js +12 -669
  246. package/packages/client/dist/yoloop/shared-discover-epics.js +1 -1007
  247. package/packages/client/dist/yoloop/shared-yoloop-types.js +1 -33
  248. package/packages/client/dist/yoloop/target-normalization.js +1 -180
  249. package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -1920
  250. package/packages/shared/dist/invocation/explicit-intent-recovery.d.ts +83 -0
  251. package/packages/shared/dist/invocation/explicit-intent-recovery.js +187 -0
  252. package/packages/shared/dist/invocation/index.d.ts +7 -0
  253. package/packages/shared/dist/invocation/index.js +22 -0
  254. package/packages/shared/dist/yolo/change-evidence.js +1 -1
  255. package/packages/shared/dist/yoloop/epic-terminal-git.js +144 -2
  256. package/targets-stubs/antigravity/gemini.md +1 -1
  257. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  258. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  259. package/targets-stubs/claude-code/neocortex-root.md +2 -2
  260. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  261. package/targets-stubs/claude-code/neocortex.md +2 -2
  262. package/targets-stubs/codex/AGENTS.md +24 -21
  263. package/targets-stubs/codex/README.md +6 -1
  264. package/targets-stubs/codex/neocortex.toml +7 -2
  265. package/targets-stubs/cursor/agent.md +2 -2
  266. package/targets-stubs/gemini-cli/agent.md +2 -2
  267. package/targets-stubs/opencode/neocortex-root.md +16 -1
  268. package/targets-stubs/opencode/neocortex.md +6 -0
  269. package/targets-stubs/vscode/neocortex.agent.md +2 -2
@@ -1,118 +1 @@
1
- export class StructuralDagError extends Error {
2
- code;
3
- publicDetails;
4
- constructor(code, publicDetails) {
5
- super(code);
6
- this.code = code;
7
- this.publicDetails = publicDetails;
8
- this.name = 'StructuralDagError';
9
- }
10
- }
11
- const DEFAULT_MAX_NODES = 10_000;
12
- const DEFAULT_MAX_EDGES = 50_000;
13
- const DEFAULT_MAX_DEPTH = 1_024;
14
- const DEFAULT_MAX_BYTES = 192 * 1024;
15
- function dependencyIds(node) {
16
- if (node.depends_on === undefined)
17
- return [];
18
- if (!Array.isArray(node.depends_on)
19
- || node.depends_on.some((value) => typeof value !== 'string' || value.length === 0)) {
20
- throw new StructuralDagError('STRUCTURAL_DEPENDENCY_MISSING', {
21
- nodes: 0,
22
- edges: 0,
23
- malformedDependencies: 1,
24
- });
25
- }
26
- return [...new Set(node.depends_on)].sort((left, right) => left.localeCompare(right, 'en'));
27
- }
28
- /**
29
- * Deterministic three-colour traversal used by YOLO and yoloop projections.
30
- * Public diagnostics expose counts only; node names can contain customer data
31
- * and must not escape through errors or telemetry.
32
- */
33
- export function analyzeDependencyDag(nodes, roots, budgets = {}) {
34
- const maxNodes = budgets.maxNodes ?? DEFAULT_MAX_NODES;
35
- const maxEdges = budgets.maxEdges ?? DEFAULT_MAX_EDGES;
36
- const depthBudget = budgets.maxDepth ?? DEFAULT_MAX_DEPTH;
37
- const byteBudget = budgets.maxBytes ?? DEFAULT_MAX_BYTES;
38
- const colors = new Map();
39
- const orderedIds = [];
40
- let edgeCount = 0;
41
- let visitedCount = 0;
42
- let structuralBytes = 0;
43
- let observedMaxDepth = 0;
44
- const visit = (id, depth) => {
45
- const color = colors.get(id) ?? 0;
46
- if (color === 2)
47
- return;
48
- if (color === 1) {
49
- throw new StructuralDagError('STRUCTURAL_DEPENDENCY_CYCLE', {
50
- nodes: visitedCount,
51
- edges: edgeCount,
52
- cycles: 1,
53
- });
54
- }
55
- const node = nodes[id];
56
- if (!node) {
57
- throw new StructuralDagError('STRUCTURAL_DEPENDENCY_MISSING', {
58
- nodes: visitedCount,
59
- edges: edgeCount,
60
- missingDependencies: 1,
61
- });
62
- }
63
- if (depth > depthBudget) {
64
- throw new StructuralDagError('STRUCTURAL_CONTEXT_TOO_LARGE', {
65
- nodes: visitedCount,
66
- edges: edgeCount,
67
- maxDepth: depthBudget,
68
- observedDepth: depth,
69
- });
70
- }
71
- colors.set(id, 1);
72
- visitedCount += 1;
73
- observedMaxDepth = Math.max(observedMaxDepth, depth);
74
- const dependencies = dependencyIds(node);
75
- structuralBytes += Buffer.byteLength(JSON.stringify({ id, depends_on: dependencies }), 'utf8');
76
- if (visitedCount > maxNodes) {
77
- throw new StructuralDagError('STRUCTURAL_CONTEXT_TOO_LARGE', {
78
- nodes: visitedCount,
79
- edges: edgeCount,
80
- maxNodes,
81
- maxEdges,
82
- });
83
- }
84
- if (structuralBytes > byteBudget) {
85
- throw new StructuralDagError('STRUCTURAL_CONTEXT_TOO_LARGE', {
86
- nodes: visitedCount,
87
- edges: edgeCount,
88
- structuralBytes,
89
- maxBytes: byteBudget,
90
- });
91
- }
92
- for (const dependencyId of dependencies) {
93
- edgeCount += 1;
94
- if (edgeCount > maxEdges) {
95
- throw new StructuralDagError('STRUCTURAL_CONTEXT_TOO_LARGE', {
96
- nodes: visitedCount,
97
- edges: edgeCount,
98
- maxNodes,
99
- maxEdges,
100
- });
101
- }
102
- visit(dependencyId, depth + 1);
103
- }
104
- colors.set(id, 2);
105
- orderedIds.push(id);
106
- };
107
- const selectedRoots = roots === undefined
108
- ? Object.keys(nodes).sort((left, right) => left.localeCompare(right, 'en'))
109
- : [...new Set(roots)].sort((left, right) => left.localeCompare(right, 'en'));
110
- for (const root of selectedRoots)
111
- visit(root, 1);
112
- return Object.freeze({
113
- orderedIds: Object.freeze(orderedIds),
114
- edgeCount,
115
- structuralBytes,
116
- maxDepth: observedMaxDepth,
117
- });
118
- }
1
+ class c extends Error{code;publicDetails;constructor(t,o){super(t),this.code=t,this.publicDetails=o,this.name="StructuralDagError"}}const g=1e4,m=5e4,U=1024,h=192*1024;function w(s){if(s.depends_on===void 0)return[];if(!Array.isArray(s.depends_on)||s.depends_on.some(t=>typeof t!="string"||t.length===0))throw new c("STRUCTURAL_DEPENDENCY_MISSING",{nodes:0,edges:0,malformedDependencies:1});return[...new Set(s.depends_on)].sort((t,o)=>t.localeCompare(o,"en"))}function L(s,t,o={}){const a=o.maxNodes??g,E=o.maxEdges??m,D=o.maxDepth??U,f=o.maxBytes??h,T=new Map,p=[];let n=0,r=0,_=0,i=0;const l=(e,d)=>{const u=T.get(e)??0;if(u===2)return;if(u===1)throw new c("STRUCTURAL_DEPENDENCY_CYCLE",{nodes:r,edges:n,cycles:1});const A=s[e];if(!A)throw new c("STRUCTURAL_DEPENDENCY_MISSING",{nodes:r,edges:n,missingDependencies:1});if(d>D)throw new c("STRUCTURAL_CONTEXT_TOO_LARGE",{nodes:r,edges:n,maxDepth:D,observedDepth:d});T.set(e,1),r+=1,i=Math.max(i,d);const C=w(A);if(_+=Buffer.byteLength(JSON.stringify({id:e,depends_on:C}),"utf8"),r>a)throw new c("STRUCTURAL_CONTEXT_TOO_LARGE",{nodes:r,edges:n,maxNodes:a,maxEdges:E});if(_>f)throw new c("STRUCTURAL_CONTEXT_TOO_LARGE",{nodes:r,edges:n,structuralBytes:_,maxBytes:f});for(const S of C){if(n+=1,n>E)throw new c("STRUCTURAL_CONTEXT_TOO_LARGE",{nodes:r,edges:n,maxNodes:a,maxEdges:E});l(S,d+1)}T.set(e,2),p.push(e)},R=t===void 0?Object.keys(s).sort((e,d)=>e.localeCompare(d,"en")):[...new Set(t)].sort((e,d)=>e.localeCompare(d,"en"));for(const e of R)l(e,1);return Object.freeze({orderedIds:Object.freeze(p),edgeCount:n,structuralBytes:_,maxDepth:i})}export{c as StructuralDagError,L as analyzeDependencyDag};
@@ -1,5 +1 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- */
5
- export { OfflineTelemetryQueue } from './offline-queue.js';
1
+ import{OfflineTelemetryQueue as r}from"./offline-queue.js";export{r as OfflineTelemetryQueue};
@@ -1,131 +1 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- *
5
- * This file is part of Neocortex CLI, licensed under the
6
- * Functional Source License, Version 1.1 (FSL-1.1).
7
- *
8
- * Change Date: February 20, 2029
9
- * Change License: MIT
10
- *
11
- * See the LICENSE file in the project root for full license text.
12
- */
13
- /**
14
- * @neocortex/client - Offline Telemetry Queue
15
- *
16
- * Persistent FIFO queue for telemetry events when the CLI operates offline.
17
- * Events are stored in a JSON file and flushed when connection is restored.
18
- * Respects configurable limits on event count (1000) and file size (5MB).
19
- *
20
- * Story 42.9
21
- */
22
- import { readFile, writeFile, mkdir } from 'node:fs/promises';
23
- import { dirname } from 'node:path';
24
- import { join } from 'node:path';
25
- import { homedir } from 'node:os';
26
- // ── Defaults ──────────────────────────────────────────────────────────────
27
- const DEFAULT_CONFIG = {
28
- queueFilePath: join(homedir(), '.neocortex', '.telemetry-queue'),
29
- maxEvents: 1_000,
30
- maxSizeBytes: 5_242_880, // 5MB
31
- };
32
- // ── OfflineTelemetryQueue ────────────────────────────────────────────────
33
- export class OfflineTelemetryQueue {
34
- config;
35
- constructor(config) {
36
- this.config = { ...DEFAULT_CONFIG, ...config };
37
- }
38
- /**
39
- * Add a telemetry event to the queue.
40
- * Evicts oldest events if limits are reached.
41
- */
42
- async enqueue(event) {
43
- try {
44
- const events = await this.loadQueue();
45
- events.push(event);
46
- // Evict oldest events if count limit exceeded
47
- while (events.length > this.config.maxEvents) {
48
- events.shift();
49
- }
50
- // Evict oldest events if size limit exceeded
51
- let serialized = JSON.stringify(events);
52
- while (Buffer.byteLength(serialized, 'utf8') > this.config.maxSizeBytes && events.length > 0) {
53
- events.shift();
54
- serialized = JSON.stringify(events);
55
- }
56
- await this.saveQueue(events);
57
- }
58
- catch {
59
- // Queue write failures are non-critical
60
- }
61
- }
62
- /**
63
- * Flush all queued events using the provided send function.
64
- * Returns count of sent and failed events.
65
- */
66
- async flush(sendFn) {
67
- try {
68
- const events = await this.loadQueue();
69
- if (events.length === 0) {
70
- return { sent: 0, failed: 0 };
71
- }
72
- const success = await sendFn(events);
73
- if (success) {
74
- await this.saveQueue([]);
75
- return { sent: events.length, failed: 0 };
76
- }
77
- return { sent: 0, failed: events.length };
78
- }
79
- catch {
80
- return { sent: 0, failed: 0 };
81
- }
82
- }
83
- /**
84
- * Get queue statistics.
85
- */
86
- async getStats() {
87
- try {
88
- const events = await this.loadQueue();
89
- const serialized = JSON.stringify(events);
90
- return {
91
- count: events.length,
92
- sizeBytes: Buffer.byteLength(serialized, 'utf8'),
93
- };
94
- }
95
- catch {
96
- return { count: 0, sizeBytes: 0 };
97
- }
98
- }
99
- /**
100
- * Clear all queued events.
101
- */
102
- async clear() {
103
- try {
104
- await this.saveQueue([]);
105
- }
106
- catch {
107
- // Clear failures are non-critical
108
- }
109
- }
110
- // ── Private ─────────────────────────────────────────────────────────
111
- async loadQueue() {
112
- try {
113
- const raw = await readFile(this.config.queueFilePath, 'utf8');
114
- const data = JSON.parse(raw);
115
- if (!Array.isArray(data))
116
- return [];
117
- return data;
118
- }
119
- catch {
120
- return [];
121
- }
122
- }
123
- async saveQueue(events) {
124
- const dir = dirname(this.config.queueFilePath);
125
- await mkdir(dir, { recursive: true });
126
- const tmpPath = `${this.config.queueFilePath}.tmp`;
127
- await writeFile(tmpPath, JSON.stringify(events), 'utf8');
128
- const { rename } = await import('node:fs/promises');
129
- await rename(tmpPath, this.config.queueFilePath);
130
- }
131
- }
1
+ import{readFile as a,writeFile as n,mkdir as r}from"node:fs/promises";import{dirname as u}from"node:path";import{join as c}from"node:path";import{homedir as o}from"node:os";const h={queueFilePath:c(o(),".neocortex",".telemetry-queue"),maxEvents:1e3,maxSizeBytes:5242880};class d{config;constructor(t){this.config={...h,...t}}async enqueue(t){try{const e=await this.loadQueue();for(e.push(t);e.length>this.config.maxEvents;)e.shift();let i=JSON.stringify(e);for(;Buffer.byteLength(i,"utf8")>this.config.maxSizeBytes&&e.length>0;)e.shift(),i=JSON.stringify(e);await this.saveQueue(e)}catch{}}async flush(t){try{const e=await this.loadQueue();return e.length===0?{sent:0,failed:0}:await t(e)?(await this.saveQueue([]),{sent:e.length,failed:0}):{sent:0,failed:e.length}}catch{return{sent:0,failed:0}}}async getStats(){try{const t=await this.loadQueue(),e=JSON.stringify(t);return{count:t.length,sizeBytes:Buffer.byteLength(e,"utf8")}}catch{return{count:0,sizeBytes:0}}}async clear(){try{await this.saveQueue([])}catch{}}async loadQueue(){try{const t=await a(this.config.queueFilePath,"utf8"),e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}async saveQueue(t){const e=u(this.config.queueFilePath);await r(e,{recursive:!0});const i=`${this.config.queueFilePath}.tmp`;await n(i,JSON.stringify(t),"utf8");const{rename:s}=await import("node:fs/promises");await s(i,this.config.queueFilePath)}}export{d as OfflineTelemetryQueue};
@@ -1,5 +1 @@
1
- /**
2
- * @license FSL-1.1
3
- * Copyright (c) 2026 OrNexus AI
4
- */
5
- export { TierAwareClient, } from './tier-aware-client.js';
1
+ import{TierAwareClient as i}from"./tier-aware-client.js";export{i as TierAwareClient};