@ornexus/neocortex 4.60.68 → 4.60.69
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.
- package/dist/release-source.json +1 -1
- package/dist/sbom.cdx.json +1194 -1194
- package/install.ps1 +1 -1
- package/install.sh +1 -1
- package/package.json +2 -2
- package/packages/client/dist/adapters/adapter-registry.js +1 -108
- package/packages/client/dist/adapters/antigravity-adapter.js +2 -77
- package/packages/client/dist/adapters/claude-code-adapter.js +3 -79
- package/packages/client/dist/adapters/codex-adapter.js +2 -80
- package/packages/client/dist/adapters/cursor-adapter.js +4 -115
- package/packages/client/dist/adapters/gemini-adapter.js +2 -71
- package/packages/client/dist/adapters/grok-adapter.js +2 -42
- package/packages/client/dist/adapters/index.js +1 -22
- package/packages/client/dist/adapters/platform-detector.js +1 -212
- package/packages/client/dist/adapters/target-adapter.js +0 -12
- package/packages/client/dist/adapters/vscode-adapter.js +2 -72
- package/packages/client/dist/agent/refresh-stubs.js +2 -417
- package/packages/client/dist/agent/update-agent-yaml.js +1 -102
- package/packages/client/dist/agent/update-description.js +1 -251
- package/packages/client/dist/cache/crypto-utils.js +1 -78
- package/packages/client/dist/cache/encrypted-cache.js +1 -108
- package/packages/client/dist/cache/in-memory-asset-cache.js +1 -73
- package/packages/client/dist/cache/index.js +1 -13
- package/packages/client/dist/cache/protected-pi-boundary.js +1 -44
- package/packages/client/dist/checkpoint/checkpoint-client-reader.js +2 -127
- package/packages/client/dist/checkpoint/index.js +1 -11
- package/packages/client/dist/checkpoint/shared-checkpoint-types.js +1 -32
- package/packages/client/dist/cli.js +3 -290
- package/packages/client/dist/commands/activate.js +8 -394
- package/packages/client/dist/commands/architecture-answers.js +7 -274
- package/packages/client/dist/commands/architecture-memory-terminal.js +4 -253
- package/packages/client/dist/commands/architecture-non-ui-continuation.js +1 -100
- package/packages/client/dist/commands/architecture-root-binding.js +1 -51
- package/packages/client/dist/commands/cache-status.js +2 -112
- package/packages/client/dist/commands/config.js +1 -88
- package/packages/client/dist/commands/doctor.js +2 -635
- package/packages/client/dist/commands/invoke.d.ts +6 -0
- package/packages/client/dist/commands/invoke.js +142 -7140
- package/packages/client/dist/commands/legacy-epic-terminal.js +1 -71
- package/packages/client/dist/commands/legacy-story-branch.js +1 -96
- package/packages/client/dist/commands/legacy-story-pr.js +1 -276
- package/packages/client/dist/commands/mutation-qa-checkpoint.js +5 -285
- package/packages/client/dist/commands/mutation-qa-gate.js +1 -54
- package/packages/client/dist/commands/mutation-qa-git.js +1 -41
- package/packages/client/dist/commands/mutation-qa-policy.js +1 -102
- package/packages/client/dist/commands/mutation-qa-run.js +3 -219
- package/packages/client/dist/commands/mutation-qa-verdict.js +1 -149
- package/packages/client/dist/commands/mutation-qa.js +1 -220
- package/packages/client/dist/commands/native-agent.js +2 -136
- package/packages/client/dist/commands/planning-diagnosis.js +1 -43
- package/packages/client/dist/commands/planning-generation.js +1 -53
- package/packages/client/dist/commands/planning-memory.js +1 -40
- package/packages/client/dist/commands/planning-research.js +1 -42
- package/packages/client/dist/commands/private-session.js +1 -75
- package/packages/client/dist/commands/property-qa.js +1 -139
- package/packages/client/dist/commands/qa-control.js +1 -16
- package/packages/client/dist/commands/qa-scan-browser-launch.js +1 -55
- package/packages/client/dist/commands/qa-scan-browser-route.js +1 -28
- package/packages/client/dist/commands/qa-scan-capture.js +5 -663
- package/packages/client/dist/commands/qa-scan-discovery.js +3 -376
- package/packages/client/dist/commands/qa-scan-review.js +5 -826
- package/packages/client/dist/commands/qa-synthetic-backend-capture.js +1 -266
- package/packages/client/dist/commands/qa-synthetic-backend-review.js +1 -297
- package/packages/client/dist/commands/qa-synthetic-backend.js +2 -340
- package/packages/client/dist/commands/qa-synthetic-broker-port.js +1 -85
- package/packages/client/dist/commands/qa-synthetic-browser.js +1 -39
- package/packages/client/dist/commands/refactor-characterization.js +21 -671
- package/packages/client/dist/commands/refactor-commit.js +13 -399
- package/packages/client/dist/commands/refactor-control.js +3 -142
- package/packages/client/dist/commands/refactor-cpp-assertions.js +3 -93
- package/packages/client/dist/commands/refactor-review.js +5 -283
- package/packages/client/dist/commands/refactor-root.js +7 -588
- package/packages/client/dist/commands/refresh-memory.js +3 -156
- package/packages/client/dist/commands/shared-architecture-non-ui.js +1 -24
- package/packages/client/dist/commands/story-checkpoint.js +1 -171
- package/packages/client/dist/config/profile-directory.js +1 -13
- package/packages/client/dist/config/resolver-selection.js +1 -278
- package/packages/client/dist/config/secure-config.js +12 -281
- package/packages/client/dist/config.js +2 -223
- package/packages/client/dist/constants.js +1 -25
- package/packages/client/dist/context/context-collector.js +2 -222
- package/packages/client/dist/context/context-sanitizer.js +1 -145
- package/packages/client/dist/continuity/autonomous-governance.js +1 -285
- package/packages/client/dist/continuity/continuity-client-state-store.js +1 -1587
- package/packages/client/dist/continuity/invoke-hooks.js +1 -129
- package/packages/client/dist/continuity/migrations/001-initial-schema.js +2 -12
- package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +2 -12
- package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +2 -12
- package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +2 -12
- package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +2 -12
- package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +2 -10
- package/packages/client/dist/continuity/native-agent-store.js +1 -69
- package/packages/client/dist/continuity/native-agent-types.js +1 -90
- package/packages/client/dist/continuity/outbox.js +1 -117
- package/packages/client/dist/continuity/runner-bootstrap-policy.js +1 -172
- package/packages/client/dist/continuity/sqlite-store.js +81 -2536
- package/packages/client/dist/effects/invoke-effect-gateways.js +1 -62
- package/packages/client/dist/errors/error-messages.js +2 -228
- package/packages/client/dist/errors/frontmatter-diagnostics.js +1 -125
- package/packages/client/dist/evidence/collector.js +1 -347
- package/packages/client/dist/evidence/index.js +1 -1
- package/packages/client/dist/evidence/types.js +0 -2
- package/packages/client/dist/fs/atomic-state-replace.js +1 -152
- package/packages/client/dist/generated/command-registry.generated.js +1 -4076
- package/packages/client/dist/generated/public-projections.generated.js +1 -149
- package/packages/client/dist/git/direct-yolo-c01-retry.js +4 -138
- package/packages/client/dist/git/direct-yolo-checkpoint.js +4 -1234
- package/packages/client/dist/git/git-lifecycle-step-ids.js +1 -14
- package/packages/client/dist/git/git-lifecycle-store.js +9 -1938
- package/packages/client/dist/git/legacy-story-branch-checkpoint.js +9 -259
- package/packages/client/dist/git/legacy-story-branch-setup.js +4 -348
- package/packages/client/dist/git/legacy-story-pr.js +70 -3538
- package/packages/client/dist/git/secure-filesystem-boundary.js +5 -182
- package/packages/client/dist/graph-retrieval/pre-command-hook.js +1 -284
- package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +1 -237
- package/packages/client/dist/i18n/first-run.js +2 -60
- package/packages/client/dist/index.js +1 -47
- package/packages/client/dist/invocation/invoke-input.js +1 -24
- package/packages/client/dist/license/index.js +1 -5
- package/packages/client/dist/license/license-client.js +1 -304
- package/packages/client/dist/machine/fingerprint.js +2 -163
- package/packages/client/dist/machine/index.js +1 -5
- package/packages/client/dist/memory/project-memory-path-scope.js +1 -62
- package/packages/client/dist/memory/project-memory-writer.js +40 -1007
- package/packages/client/dist/memory/shared-project-memory-types.js +2 -253
- package/packages/client/dist/migrations/project-identity-capability.js +1 -50
- package/packages/client/dist/migrations/project-identity.js +7 -493
- package/packages/client/dist/migrations/state-json.js +4 -344
- package/packages/client/dist/policy/architecture-policy.js +2 -184
- package/packages/client/dist/policy/index.js +1 -7
- package/packages/client/dist/policy/shared-policy-types.js +0 -38
- package/packages/client/dist/policy/subagent-approval-policy.js +1 -55
- package/packages/client/dist/private-execution/clean-baseline.js +2 -279
- package/packages/client/dist/private-execution/codex-executor.js +4 -574
- package/packages/client/dist/private-execution/codex-host-runtime.js +1 -137
- package/packages/client/dist/private-execution/codex-lifecycle-guard.js +1 -97
- package/packages/client/dist/private-execution/codex-scoped-permissions.js +1 -128
- package/packages/client/dist/private-execution/delivery.js +13 -410
- package/packages/client/dist/private-execution/diagnosis-root-review.js +2 -294
- package/packages/client/dist/private-execution/frozen-handoff.js +6 -19
- package/packages/client/dist/private-execution/implementation-validation.js +2 -106
- package/packages/client/dist/private-execution/isolated-admission.js +23 -1432
- package/packages/client/dist/private-execution/isolated-session.js +5 -725
- package/packages/client/dist/private-execution/isolated-workspace.js +1 -122
- package/packages/client/dist/private-execution/pact-consumer-runtime.js +3 -409
- package/packages/client/dist/private-execution/pact-test-source.js +1 -258
- package/packages/client/dist/private-execution/pact-toolchain.js +3 -290
- package/packages/client/dist/private-execution/pact-write-set.js +1 -172
- package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +5 -406
- package/packages/client/dist/private-execution/planning-generation-checkpoint.js +5 -462
- package/packages/client/dist/private-execution/planning-memory-checkpoint.js +3 -139
- package/packages/client/dist/private-execution/planning-research-checkpoint.js +4 -325
- package/packages/client/dist/private-execution/private-report-store.js +1 -42
- package/packages/client/dist/private-execution/property-test-candidate.js +1 -103
- package/packages/client/dist/private-execution/property-test-choices.js +3 -147
- package/packages/client/dist/private-execution/property-test-plan.js +7 -271
- package/packages/client/dist/private-execution/property-test-review.js +4 -258
- package/packages/client/dist/private-execution/property-test-runtime.js +9 -372
- package/packages/client/dist/private-execution/property-test-source.js +1 -139
- package/packages/client/dist/private-execution/root-checkpoint.js +1 -80
- package/packages/client/dist/private-execution/root-memory-git-evidence.js +3 -135
- package/packages/client/dist/private-execution/root-memory-recovery.js +1 -93
- package/packages/client/dist/private-execution/root-memory-request.js +1 -29
- package/packages/client/dist/private-execution/root-memory-scope.js +1 -178
- package/packages/client/dist/private-execution/root-memory-writer.js +1 -102
- package/packages/client/dist/private-execution/session-lease.js +1 -63
- package/packages/client/dist/private-execution/shared-private-admission-types.js +1 -50
- package/packages/client/dist/private-execution/shared-project-validation.js +1 -66
- package/packages/client/dist/private-execution/shared-root-memory-types.js +1 -61
- package/packages/client/dist/private-execution/ux-source-validation.js +1 -372
- package/packages/client/dist/private-execution/ux-write-set.js +2 -191
- package/packages/client/dist/resilience/circuit-breaker.js +1 -170
- package/packages/client/dist/resilience/degradation-manager.js +1 -164
- package/packages/client/dist/resilience/freshness-indicator.js +1 -100
- package/packages/client/dist/resilience/index.js +1 -8
- package/packages/client/dist/resilience/recovery-detector.js +1 -74
- package/packages/client/dist/resolvers/asset-resolver.js +0 -13
- package/packages/client/dist/resolvers/local-resolver.js +8 -255
- package/packages/client/dist/resolvers/remote-resolver.js +1 -233
- package/packages/client/dist/runner/binary.js +1 -404
- package/packages/client/dist/runner/cli.js +17 -1571
- package/packages/client/dist/runner/headless/adapters.js +1 -49
- package/packages/client/dist/runner/headless/claude-code-adapter.js +1 -79
- package/packages/client/dist/runner/headless/continuous-story-workspace.js +11 -1628
- package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +1 -69
- package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +2 -110
- package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +8 -1236
- package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +2 -318
- package/packages/client/dist/runner/headless/fake-adapter.js +1 -62
- package/packages/client/dist/runner/headless/managed-profile.js +1 -132
- package/packages/client/dist/runner/headless/opencode-adapter.js +2 -145
- package/packages/client/dist/runner/headless/prepared-story-bundle.js +1 -43
- package/packages/client/dist/runner/headless/resolver.js +1 -231
- package/packages/client/dist/runner/headless/run-yolo.js +1 -885
- package/packages/client/dist/runner/headless/run-yoloop.js +2 -2574
- package/packages/client/dist/runner/headless/types.js +2 -574
- package/packages/client/dist/runner/local-console.js +13 -396
- package/packages/client/dist/runner/portal-sync-worker.js +1 -1487
- package/packages/client/dist/runner/project-identity.js +1 -106
- package/packages/client/dist/runner/scheduler.js +7 -995
- package/packages/client/dist/runner-cli.js +2 -18
- package/packages/client/dist/state/invocation-shape.js +1 -13
- package/packages/client/dist/state/project-state-snapshot.js +1 -1677
- package/packages/client/dist/state/state-json-repair.js +3 -785
- package/packages/client/dist/state/structural-dag-projection.js +1 -118
- package/packages/client/dist/telemetry/index.js +1 -5
- package/packages/client/dist/telemetry/offline-queue.js +1 -131
- package/packages/client/dist/tier/index.js +1 -5
- package/packages/client/dist/tier/tier-aware-client.js +1 -405
- package/packages/client/dist/types/index.js +1 -38
- package/packages/client/dist/version.js +1 -27
- package/packages/client/dist/yolo/change-evidence-collector.js +1 -126
- package/packages/client/dist/yolo/invoke-envelope-capability.js +1 -62
- package/packages/client/dist/yolo/spec-envelope-collector.js +5 -185
- package/packages/client/dist/yoloop/discovery-hook.js +2 -300
- package/packages/client/dist/yoloop/index.js +1 -8
- package/packages/client/dist/yoloop/invoke-hooks.js +12 -669
- package/packages/client/dist/yoloop/shared-discover-epics.js +1 -1007
- package/packages/client/dist/yoloop/shared-yoloop-types.js +1 -33
- package/packages/client/dist/yoloop/target-normalization.js +1 -180
- package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -1723
- package/targets-stubs/antigravity/gemini.md +1 -1
- package/targets-stubs/antigravity/skill/SKILL.md +1 -1
- package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex-root.md +2 -2
- package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex.md +2 -2
- package/targets-stubs/codex/AGENTS.md +1 -1
- package/targets-stubs/cursor/agent.md +2 -2
- package/targets-stubs/gemini-cli/agent.md +2 -2
- package/targets-stubs/opencode/neocortex-root.md +1 -1
- package/targets-stubs/vscode/neocortex.agent.md +2 -2
|
@@ -1,118 +1 @@
|
|
|
1
|
-
|
|
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,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};
|