@ornexus/neocortex 4.61.5 → 4.61.6

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