@ornexus/neocortex 4.60.67 → 4.60.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/release-source.json +1 -1
- package/dist/sbom.cdx.json +1194 -1194
- package/install.sh +1 -1
- package/package.json +2 -2
- package/packages/client/dist/adapters/adapter-registry.js +108 -1
- package/packages/client/dist/adapters/antigravity-adapter.js +77 -2
- package/packages/client/dist/adapters/claude-code-adapter.js +79 -3
- package/packages/client/dist/adapters/codex-adapter.js +80 -2
- package/packages/client/dist/adapters/cursor-adapter.js +115 -4
- package/packages/client/dist/adapters/gemini-adapter.js +71 -2
- package/packages/client/dist/adapters/grok-adapter.js +42 -2
- package/packages/client/dist/adapters/index.js +22 -1
- package/packages/client/dist/adapters/platform-detector.js +212 -1
- package/packages/client/dist/adapters/target-adapter.js +12 -0
- package/packages/client/dist/adapters/vscode-adapter.js +72 -2
- package/packages/client/dist/agent/refresh-stubs.js +417 -2
- package/packages/client/dist/agent/update-agent-yaml.js +102 -1
- package/packages/client/dist/agent/update-description.js +251 -1
- package/packages/client/dist/cache/crypto-utils.js +78 -1
- package/packages/client/dist/cache/encrypted-cache.js +108 -1
- package/packages/client/dist/cache/in-memory-asset-cache.js +73 -1
- package/packages/client/dist/cache/index.js +13 -1
- package/packages/client/dist/cache/protected-pi-boundary.js +44 -1
- package/packages/client/dist/checkpoint/checkpoint-client-reader.js +127 -2
- package/packages/client/dist/checkpoint/index.js +11 -1
- package/packages/client/dist/checkpoint/shared-checkpoint-types.js +32 -1
- package/packages/client/dist/cli.js +290 -3
- package/packages/client/dist/commands/activate.js +394 -8
- package/packages/client/dist/commands/architecture-answers.js +274 -7
- package/packages/client/dist/commands/architecture-memory-terminal.js +253 -4
- package/packages/client/dist/commands/architecture-non-ui-continuation.js +100 -1
- package/packages/client/dist/commands/architecture-root-binding.js +51 -1
- package/packages/client/dist/commands/cache-status.js +112 -2
- package/packages/client/dist/commands/config.js +88 -1
- package/packages/client/dist/commands/doctor.js +635 -2
- package/packages/client/dist/commands/invoke.js +7140 -142
- package/packages/client/dist/commands/legacy-epic-terminal.js +71 -1
- package/packages/client/dist/commands/legacy-story-branch.js +96 -1
- package/packages/client/dist/commands/legacy-story-pr.js +276 -1
- package/packages/client/dist/commands/mutation-qa-checkpoint.js +285 -5
- package/packages/client/dist/commands/mutation-qa-gate.js +54 -1
- package/packages/client/dist/commands/mutation-qa-git.js +41 -1
- package/packages/client/dist/commands/mutation-qa-policy.js +102 -1
- package/packages/client/dist/commands/mutation-qa-run.js +219 -3
- package/packages/client/dist/commands/mutation-qa-verdict.js +149 -1
- package/packages/client/dist/commands/mutation-qa.js +220 -1
- package/packages/client/dist/commands/native-agent.js +136 -2
- package/packages/client/dist/commands/planning-diagnosis.js +43 -1
- package/packages/client/dist/commands/planning-generation.js +53 -1
- package/packages/client/dist/commands/planning-memory.js +40 -1
- package/packages/client/dist/commands/planning-research.js +42 -1
- package/packages/client/dist/commands/private-session.js +75 -1
- package/packages/client/dist/commands/property-qa.js +139 -1
- package/packages/client/dist/commands/qa-control.js +16 -1
- package/packages/client/dist/commands/qa-scan-browser-launch.js +55 -1
- package/packages/client/dist/commands/qa-scan-browser-route.js +28 -1
- package/packages/client/dist/commands/qa-scan-capture.js +663 -5
- package/packages/client/dist/commands/qa-scan-discovery.js +376 -3
- package/packages/client/dist/commands/qa-scan-review.js +826 -5
- package/packages/client/dist/commands/qa-synthetic-backend-capture.js +266 -1
- package/packages/client/dist/commands/qa-synthetic-backend-review.js +297 -1
- package/packages/client/dist/commands/qa-synthetic-backend.js +340 -2
- package/packages/client/dist/commands/qa-synthetic-broker-port.js +85 -1
- package/packages/client/dist/commands/qa-synthetic-browser.js +39 -1
- package/packages/client/dist/commands/refactor-characterization.js +671 -21
- package/packages/client/dist/commands/refactor-commit.js +399 -13
- package/packages/client/dist/commands/refactor-control.js +142 -3
- package/packages/client/dist/commands/refactor-cpp-assertions.js +93 -3
- package/packages/client/dist/commands/refactor-review.js +283 -5
- package/packages/client/dist/commands/refactor-root.js +588 -7
- package/packages/client/dist/commands/refresh-memory.js +156 -3
- package/packages/client/dist/commands/shared-architecture-non-ui.js +24 -1
- package/packages/client/dist/commands/story-checkpoint.js +171 -1
- package/packages/client/dist/config/profile-directory.js +13 -1
- package/packages/client/dist/config/resolver-selection.js +278 -1
- package/packages/client/dist/config/secure-config.js +281 -12
- package/packages/client/dist/config.js +223 -2
- package/packages/client/dist/constants.js +25 -1
- package/packages/client/dist/context/context-collector.js +222 -2
- package/packages/client/dist/context/context-sanitizer.js +145 -1
- package/packages/client/dist/continuity/autonomous-governance.js +285 -1
- package/packages/client/dist/continuity/continuity-client-state-store.js +1587 -1
- package/packages/client/dist/continuity/invoke-hooks.js +129 -1
- package/packages/client/dist/continuity/migrations/001-initial-schema.js +12 -2
- package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +12 -2
- package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +12 -2
- package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +12 -2
- package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +12 -2
- package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +10 -2
- package/packages/client/dist/continuity/native-agent-store.js +69 -1
- package/packages/client/dist/continuity/native-agent-types.js +90 -1
- package/packages/client/dist/continuity/outbox.js +117 -1
- package/packages/client/dist/continuity/runner-bootstrap-policy.js +172 -1
- package/packages/client/dist/continuity/sqlite-store.js +2536 -81
- package/packages/client/dist/effects/invoke-effect-gateways.js +62 -1
- package/packages/client/dist/errors/error-messages.js +228 -2
- package/packages/client/dist/errors/frontmatter-diagnostics.js +125 -1
- package/packages/client/dist/evidence/collector.js +347 -1
- package/packages/client/dist/evidence/index.js +1 -1
- package/packages/client/dist/evidence/types.js +2 -0
- package/packages/client/dist/fs/atomic-state-replace.js +152 -1
- package/packages/client/dist/generated/command-registry.generated.js +4076 -1
- package/packages/client/dist/generated/public-projections.generated.js +149 -1
- package/packages/client/dist/git/direct-yolo-c01-retry.js +138 -4
- package/packages/client/dist/git/direct-yolo-checkpoint.js +1234 -4
- package/packages/client/dist/git/git-lifecycle-step-ids.js +14 -1
- package/packages/client/dist/git/git-lifecycle-store.js +1938 -9
- package/packages/client/dist/git/legacy-story-branch-checkpoint.js +259 -9
- package/packages/client/dist/git/legacy-story-branch-setup.js +348 -4
- package/packages/client/dist/git/legacy-story-pr.js +3538 -70
- package/packages/client/dist/git/secure-filesystem-boundary.js +182 -5
- package/packages/client/dist/graph-retrieval/pre-command-hook.js +284 -1
- package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +237 -1
- package/packages/client/dist/i18n/first-run.js +60 -2
- package/packages/client/dist/index.js +47 -1
- package/packages/client/dist/invocation/invoke-input.js +24 -1
- package/packages/client/dist/license/index.js +5 -1
- package/packages/client/dist/license/license-client.js +304 -1
- package/packages/client/dist/machine/fingerprint.js +163 -2
- package/packages/client/dist/machine/index.js +5 -1
- package/packages/client/dist/memory/project-memory-path-scope.js +62 -1
- package/packages/client/dist/memory/project-memory-writer.js +1007 -40
- package/packages/client/dist/memory/shared-project-memory-types.js +253 -2
- package/packages/client/dist/migrations/project-identity-capability.js +50 -1
- package/packages/client/dist/migrations/project-identity.js +493 -7
- package/packages/client/dist/migrations/state-json.js +344 -4
- package/packages/client/dist/policy/architecture-policy.js +184 -2
- package/packages/client/dist/policy/index.js +7 -1
- package/packages/client/dist/policy/shared-policy-types.js +38 -0
- package/packages/client/dist/policy/subagent-approval-policy.js +55 -1
- package/packages/client/dist/private-execution/clean-baseline.js +279 -2
- package/packages/client/dist/private-execution/codex-executor.js +574 -4
- package/packages/client/dist/private-execution/codex-host-runtime.js +137 -1
- package/packages/client/dist/private-execution/codex-lifecycle-guard.js +97 -1
- package/packages/client/dist/private-execution/codex-scoped-permissions.js +128 -1
- package/packages/client/dist/private-execution/delivery.js +410 -13
- package/packages/client/dist/private-execution/diagnosis-root-review.js +294 -2
- package/packages/client/dist/private-execution/frozen-handoff.js +19 -6
- package/packages/client/dist/private-execution/implementation-validation.js +106 -2
- package/packages/client/dist/private-execution/isolated-admission.js +1432 -23
- package/packages/client/dist/private-execution/isolated-session.js +725 -5
- package/packages/client/dist/private-execution/isolated-workspace.js +122 -1
- package/packages/client/dist/private-execution/pact-consumer-runtime.js +409 -3
- package/packages/client/dist/private-execution/pact-test-source.js +258 -1
- package/packages/client/dist/private-execution/pact-toolchain.js +290 -3
- package/packages/client/dist/private-execution/pact-write-set.js +172 -1
- package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +406 -5
- package/packages/client/dist/private-execution/planning-generation-checkpoint.js +462 -5
- package/packages/client/dist/private-execution/planning-memory-checkpoint.js +139 -3
- package/packages/client/dist/private-execution/planning-research-checkpoint.js +325 -4
- package/packages/client/dist/private-execution/private-report-store.js +42 -1
- package/packages/client/dist/private-execution/property-test-candidate.js +103 -1
- package/packages/client/dist/private-execution/property-test-choices.js +147 -3
- package/packages/client/dist/private-execution/property-test-plan.js +271 -7
- package/packages/client/dist/private-execution/property-test-review.js +258 -4
- package/packages/client/dist/private-execution/property-test-runtime.js +372 -9
- package/packages/client/dist/private-execution/property-test-source.js +139 -1
- package/packages/client/dist/private-execution/root-checkpoint.js +80 -1
- package/packages/client/dist/private-execution/root-memory-git-evidence.js +135 -3
- package/packages/client/dist/private-execution/root-memory-recovery.js +93 -1
- package/packages/client/dist/private-execution/root-memory-request.js +29 -1
- package/packages/client/dist/private-execution/root-memory-scope.js +178 -1
- package/packages/client/dist/private-execution/root-memory-writer.js +102 -1
- package/packages/client/dist/private-execution/session-lease.js +63 -1
- package/packages/client/dist/private-execution/shared-private-admission-types.js +50 -1
- package/packages/client/dist/private-execution/shared-project-validation.js +66 -1
- package/packages/client/dist/private-execution/shared-root-memory-types.js +61 -1
- package/packages/client/dist/private-execution/ux-source-validation.js +372 -1
- package/packages/client/dist/private-execution/ux-write-set.js +191 -2
- package/packages/client/dist/resilience/circuit-breaker.js +170 -1
- package/packages/client/dist/resilience/degradation-manager.js +164 -1
- package/packages/client/dist/resilience/freshness-indicator.js +100 -1
- package/packages/client/dist/resilience/index.js +8 -1
- package/packages/client/dist/resilience/recovery-detector.js +74 -1
- package/packages/client/dist/resolvers/asset-resolver.js +13 -0
- package/packages/client/dist/resolvers/local-resolver.js +255 -8
- package/packages/client/dist/resolvers/remote-resolver.js +233 -1
- package/packages/client/dist/runner/binary.js +404 -1
- package/packages/client/dist/runner/cli.js +1571 -17
- package/packages/client/dist/runner/headless/adapters.js +49 -1
- package/packages/client/dist/runner/headless/claude-code-adapter.js +79 -1
- package/packages/client/dist/runner/headless/continuous-story-workspace.js +1628 -11
- package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +69 -1
- package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +110 -2
- package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +1236 -8
- package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +318 -2
- package/packages/client/dist/runner/headless/fake-adapter.js +62 -1
- package/packages/client/dist/runner/headless/managed-profile.js +132 -1
- package/packages/client/dist/runner/headless/opencode-adapter.js +145 -2
- package/packages/client/dist/runner/headless/prepared-story-bundle.js +43 -1
- package/packages/client/dist/runner/headless/resolver.js +231 -1
- package/packages/client/dist/runner/headless/run-yolo.js +885 -1
- package/packages/client/dist/runner/headless/run-yoloop.js +2574 -2
- package/packages/client/dist/runner/headless/types.js +574 -2
- package/packages/client/dist/runner/local-console.js +396 -13
- package/packages/client/dist/runner/portal-sync-worker.js +1487 -1
- package/packages/client/dist/runner/project-identity.js +106 -1
- package/packages/client/dist/runner/scheduler.js +995 -7
- package/packages/client/dist/runner-cli.js +18 -2
- package/packages/client/dist/state/invocation-shape.js +13 -1
- package/packages/client/dist/state/project-state-snapshot.js +1677 -1
- package/packages/client/dist/state/state-json-repair.js +785 -3
- package/packages/client/dist/state/structural-dag-projection.js +118 -1
- package/packages/client/dist/telemetry/index.js +5 -1
- package/packages/client/dist/telemetry/offline-queue.js +131 -1
- package/packages/client/dist/tier/index.js +5 -1
- package/packages/client/dist/tier/tier-aware-client.js +405 -1
- package/packages/client/dist/types/index.js +38 -1
- package/packages/client/dist/version.js +27 -1
- package/packages/client/dist/yolo/change-evidence-collector.js +126 -1
- package/packages/client/dist/yolo/invoke-envelope-capability.js +62 -1
- package/packages/client/dist/yolo/spec-envelope-collector.js +185 -5
- package/packages/client/dist/yoloop/discovery-hook.js +300 -2
- package/packages/client/dist/yoloop/index.js +8 -1
- package/packages/client/dist/yoloop/invoke-hooks.js +669 -12
- package/packages/client/dist/yoloop/shared-discover-epics.js +1007 -1
- package/packages/client/dist/yoloop/shared-yoloop-types.js +33 -1
- package/packages/client/dist/yoloop/target-normalization.js +180 -1
- package/packages/client/dist/yoloop/yoloop-client-state-store.js +1723 -1
- 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 +1,62 @@
|
|
|
1
|
-
import{assertDeclaredNetworkTransport
|
|
1
|
+
import { assertDeclaredNetworkTransport, resolveClosedProcessProfile, StrictReadOnlyError, } from '../../../shared/dist/strict-readonly.js';
|
|
2
|
+
export function createCapabilityCache(authority, delegate, category) {
|
|
3
|
+
const descriptor = { phase: 'client-preflight', domain: 'client-persistence', category, operation: 'update' };
|
|
4
|
+
return Object.freeze({
|
|
5
|
+
get: (key) => delegate.get(key),
|
|
6
|
+
set: (key, value, ttlMs) => authority.executeAsync(descriptor, () => delegate.set(key, value, ttlMs), async () => undefined),
|
|
7
|
+
clear: () => authority.executeAsync(descriptor, () => delegate.clear(), async () => undefined),
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export function executeClosedProcess(authority, profileName, cwd, writer, phase = 'engine') {
|
|
11
|
+
const profile = resolveClosedProcessProfile(profileName, cwd);
|
|
12
|
+
return authority.execute({ phase, domain: 'external-effect', category: 'process', operation: 'spawn' }, () => writer(profile), () => ({ status: null, stdout: '', stderr: '', projected: true }));
|
|
13
|
+
}
|
|
14
|
+
export function executeClosedGitInspection(authority, profileName, cwd, writer, phase = 'engine') {
|
|
15
|
+
const profile = resolveClosedProcessProfile(profileName, cwd);
|
|
16
|
+
return authority.execute({ phase, domain: 'external-effect', category: 'git', operation: 'spawn' }, () => writer(profile), () => ({ status: null, stdout: '', stderr: '', projected: true }));
|
|
17
|
+
}
|
|
18
|
+
export function executeSchedulerManifestWrite(authority, writer) {
|
|
19
|
+
return authority.execute({ phase: 'client-preflight', domain: 'client-persistence', category: 'scheduler-session', operation: 'create' }, () => { writer(); return true; }, () => false);
|
|
20
|
+
}
|
|
21
|
+
export function executeSchedulerProcess(authority, command, writer, projected) {
|
|
22
|
+
if (!isClosedSchedulerCommand(command)) {
|
|
23
|
+
throw new StrictReadOnlyError('readonly-physical-boundary-unsafe', 'boundary');
|
|
24
|
+
}
|
|
25
|
+
return authority.execute({ phase: 'client-preflight', domain: 'external-effect', category: 'process', operation: 'spawn' }, writer, projected);
|
|
26
|
+
}
|
|
27
|
+
function isClosedSchedulerCommand(command) {
|
|
28
|
+
if (command.args.length > 8
|
|
29
|
+
|| command.args.some((arg) => arg.length > 512 || /[\r\n\0]/u.test(arg)))
|
|
30
|
+
return false;
|
|
31
|
+
const args = command.args;
|
|
32
|
+
const safeName = (value) => Boolean(value && /^[A-Za-z0-9_.:@-]{1,180}$/u.test(value));
|
|
33
|
+
const safePath = (value) => Boolean(value
|
|
34
|
+
&& (value.startsWith('/') || /^[A-Za-z]:[\\/]/u.test(value))
|
|
35
|
+
&& !value.split(/[\\/]/u).includes('..'));
|
|
36
|
+
if (command.command === 'systemctl') {
|
|
37
|
+
return args[0] === '--user' && ((args.length === 2 && args[1] === 'daemon-reload')
|
|
38
|
+
|| (args.length === 4 && args[1] === 'enable' && args[2] === '--now' && safeName(args[3]))
|
|
39
|
+
|| (args.length === 3 && (args[1] === 'start' || args[1] === 'stop') && safeName(args[2]))
|
|
40
|
+
|| (args.length === 4 && args[1] === 'status' && safeName(args[2]) && args[3] === '--no-pager'));
|
|
41
|
+
}
|
|
42
|
+
if (command.command === 'launchctl') {
|
|
43
|
+
return (args.length === 3 && (args[0] === 'load' || args[0] === 'unload') && args[1] === '-w' && safePath(args[2]))
|
|
44
|
+
|| (args.length === 2 && args[0] === 'list' && safeName(args[1]));
|
|
45
|
+
}
|
|
46
|
+
if (command.command === 'schtasks') {
|
|
47
|
+
return (args.length === 6 && args[0] === '/Create' && args[1] === '/TN' && safeName(args[2]) && args[3] === '/XML' && safePath(args[4]) && args[5] === '/F')
|
|
48
|
+
|| (args.length === 3 && (args[0] === '/Run' || args[0] === '/End') && args[1] === '/TN' && safeName(args[2]))
|
|
49
|
+
|| (args.length === 5 && args[0] === '/Query' && args[1] === '/TN' && safeName(args[2]) && args[3] === '/FO' && args[4] === 'LIST');
|
|
50
|
+
}
|
|
51
|
+
return command.command === 'crontab' && args.length === 1 && args[0] === '-l';
|
|
52
|
+
}
|
|
53
|
+
/** The primary invoke request is a declared query transport, not a mutation. */
|
|
54
|
+
export async function executeInvokeQueryTransport(transportKind, writer) {
|
|
55
|
+
assertDeclaredNetworkTransport(transportKind);
|
|
56
|
+
return writer();
|
|
57
|
+
}
|
|
58
|
+
export async function executeSecondaryNetworkMutation(authority, transportKind, writer, projected) {
|
|
59
|
+
if (transportKind !== 'secondary-mutation')
|
|
60
|
+
throw new StrictReadOnlyError('readonly-physical-boundary-unsafe', 'boundary');
|
|
61
|
+
return authority.executeAsync({ phase: 'client-preflight', domain: 'external-effect', category: 'network-mutation', operation: 'send' }, writer, projected);
|
|
62
|
+
}
|
|
@@ -1,2 +1,228 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license FSL-1.1
|
|
3
|
+
* Copyright (c) 2026 OrNexus AI
|
|
4
|
+
*
|
|
5
|
+
* Central, localized error message helpers for CLI output. Turns
|
|
6
|
+
* server error codes and low-level exceptions into friendly, actionable
|
|
7
|
+
* messages with "What happened" + "What to do" + support email.
|
|
8
|
+
*
|
|
9
|
+
* Story P76.06.
|
|
10
|
+
*/
|
|
11
|
+
const SUPPORT_EMAIL = 'support@neocortex.sh';
|
|
12
|
+
/** Localized copy per error code. */
|
|
13
|
+
const MESSAGES = {
|
|
14
|
+
AUTH_REFRESH_REQUIRED: {
|
|
15
|
+
en: {
|
|
16
|
+
summary: 'Authentication must be refreshed.',
|
|
17
|
+
whatHappened: 'Credentials are configured, but a valid authentication token is unavailable. The token may have expired or the authentication service may be unreachable. Strict read-only commands do not refresh tokens.',
|
|
18
|
+
whatToDo: 'Check the server connection and retry. If authentication remains unavailable, re-activate outside strict read-only mode.',
|
|
19
|
+
command: 'neocortex activate YOUR-LICENSE-KEY',
|
|
20
|
+
url: 'https://neocortex.sh/portal',
|
|
21
|
+
},
|
|
22
|
+
'pt-BR': {
|
|
23
|
+
summary: 'A autenticação precisa ser renovada.',
|
|
24
|
+
whatHappened: 'As credenciais estão configuradas, mas não há um token de autenticação válido disponível. O token pode ter expirado ou o serviço de autenticação pode estar inacessível. Comandos estritamente somente leitura não renovam tokens.',
|
|
25
|
+
whatToDo: 'Verifique a conexão com o servidor e tente novamente. Se a autenticação continuar indisponível, reative fora do modo estritamente somente leitura.',
|
|
26
|
+
command: 'neocortex activate SUA-LICENSE-KEY',
|
|
27
|
+
url: 'https://neocortex.sh/portal',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
AUTH_EXPIRED: {
|
|
31
|
+
en: {
|
|
32
|
+
summary: 'Your session has expired.',
|
|
33
|
+
whatHappened: 'The token we use to authenticate your CLI has expired. This is normal and happens every few hours.',
|
|
34
|
+
whatToDo: 'Re-activate with the license key that was emailed to you.',
|
|
35
|
+
command: 'neocortex activate YOUR-LICENSE-KEY',
|
|
36
|
+
url: 'https://neocortex.sh/portal',
|
|
37
|
+
},
|
|
38
|
+
'pt-BR': {
|
|
39
|
+
summary: 'Sua sessão expirou.',
|
|
40
|
+
whatHappened: 'O token de autenticação do CLI expirou. Isso é normal e acontece a cada poucas horas.',
|
|
41
|
+
whatToDo: 'Reative o CLI com a license key que você recebeu por email.',
|
|
42
|
+
command: 'neocortex activate SUA-LICENSE-KEY',
|
|
43
|
+
url: 'https://neocortex.sh/portal',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
UPGRADE_REQUIRED: {
|
|
47
|
+
en: {
|
|
48
|
+
summary: 'Your CLI version is outdated.',
|
|
49
|
+
whatHappened: 'The server requires a newer CLI version. Older versions are not allowed for security and compatibility reasons.',
|
|
50
|
+
whatToDo: 'Install the latest CLI globally with npm.',
|
|
51
|
+
command: 'npm install -g @ornexus/neocortex@latest',
|
|
52
|
+
},
|
|
53
|
+
'pt-BR': {
|
|
54
|
+
summary: 'Sua versão do CLI está desatualizada.',
|
|
55
|
+
whatHappened: 'O servidor exige uma versão mais recente do CLI. Versões antigas não são permitidas por motivos de segurança e compatibilidade.',
|
|
56
|
+
whatToDo: 'Instale a versão mais recente globalmente via npm.',
|
|
57
|
+
command: 'npm install -g @ornexus/neocortex@latest',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
RATE_LIMITED: {
|
|
61
|
+
en: {
|
|
62
|
+
summary: 'You sent too many requests in a short window.',
|
|
63
|
+
whatHappened: 'You hit the rate limit for your plan. This protects the service from abuse and keeps it fast for everyone.',
|
|
64
|
+
whatToDo: 'Wait a few seconds and try again. If you hit this often, upgrading your plan raises the limit.',
|
|
65
|
+
url: 'https://neocortex.sh/portal/plans',
|
|
66
|
+
},
|
|
67
|
+
'pt-BR': {
|
|
68
|
+
summary: 'Você fez muitas requisições em pouco tempo.',
|
|
69
|
+
whatHappened: 'O limite de taxa do seu plano foi atingido. Isso protege o serviço contra abuso e mantém a velocidade para todos.',
|
|
70
|
+
whatToDo: 'Espere alguns segundos e tente novamente. Se isso acontece com frequência, fazer upgrade do seu plano aumenta o limite.',
|
|
71
|
+
url: 'https://neocortex.sh/portal/plans',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
TRIGGER_NOT_ALLOWED: {
|
|
75
|
+
en: {
|
|
76
|
+
summary: 'This command is not available on your current plan.',
|
|
77
|
+
whatHappened: 'You tried to use a trigger that requires a paid plan (Pro or Enterprise).',
|
|
78
|
+
whatToDo: 'See the full comparison and upgrade in the portal.',
|
|
79
|
+
url: 'https://neocortex.sh/portal/plans',
|
|
80
|
+
},
|
|
81
|
+
'pt-BR': {
|
|
82
|
+
summary: 'Este comando não está disponível no seu plano atual.',
|
|
83
|
+
whatHappened: 'Você tentou usar um trigger que requer um plano pago (Pro ou Enterprise).',
|
|
84
|
+
whatToDo: 'Veja a comparação completa e faça upgrade no portal.',
|
|
85
|
+
url: 'https://neocortex.sh/portal/plans',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
QUOTA_EXCEEDED: {
|
|
89
|
+
en: {
|
|
90
|
+
summary: 'Daily quota reached.',
|
|
91
|
+
whatHappened: 'You have used all invocations allowed by your plan today. Quotas reset at midnight UTC.',
|
|
92
|
+
whatToDo: 'Wait for the daily reset, or upgrade your plan for a higher quota.',
|
|
93
|
+
url: 'https://neocortex.sh/portal/plans',
|
|
94
|
+
},
|
|
95
|
+
'pt-BR': {
|
|
96
|
+
summary: 'Quota diária atingida.',
|
|
97
|
+
whatHappened: 'Você usou todas as invocações permitidas pelo seu plano hoje. As quotas são resetadas à meia-noite UTC.',
|
|
98
|
+
whatToDo: 'Aguarde o reset diário ou faça upgrade do plano para uma quota maior.',
|
|
99
|
+
url: 'https://neocortex.sh/portal/plans',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
SERVER_ERROR: {
|
|
103
|
+
en: {
|
|
104
|
+
summary: 'Server error.',
|
|
105
|
+
whatHappened: 'Something went wrong on our side. We have logged the error and will investigate.',
|
|
106
|
+
whatToDo: `Try again in a minute. If the problem persists, please contact ${SUPPORT_EMAIL} with the details.`,
|
|
107
|
+
},
|
|
108
|
+
'pt-BR': {
|
|
109
|
+
summary: 'Erro do servidor.',
|
|
110
|
+
whatHappened: 'Algo deu errado no nosso lado. O erro foi registrado e vamos investigar.',
|
|
111
|
+
whatToDo: `Tente novamente em um minuto. Se o problema persistir, entre em contato: ${SUPPORT_EMAIL}.`,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
ECONNREFUSED: {
|
|
115
|
+
en: {
|
|
116
|
+
summary: 'Cannot reach the Neocortex server.',
|
|
117
|
+
whatHappened: 'We could not open a connection to the server. This is usually a network problem on your side.',
|
|
118
|
+
whatToDo: 'Check your internet connection, any VPN or corporate proxy, and try again.',
|
|
119
|
+
},
|
|
120
|
+
'pt-BR': {
|
|
121
|
+
summary: 'Não foi possível alcançar o servidor Neocortex.',
|
|
122
|
+
whatHappened: 'Não conseguimos abrir uma conexão com o servidor. Isso geralmente é um problema de rede do seu lado.',
|
|
123
|
+
whatToDo: 'Verifique sua conexão, qualquer VPN ou proxy corporativo, e tente novamente.',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
MACHINE_LIMIT_EXCEEDED: {
|
|
127
|
+
en: {
|
|
128
|
+
summary: 'Machine limit reached.',
|
|
129
|
+
whatHappened: 'Your plan allows a limited number of active machines, and this one would exceed it.',
|
|
130
|
+
whatToDo: 'Deactivate a machine you no longer use from the portal, then re-run activate here.',
|
|
131
|
+
url: 'https://neocortex.sh/portal/machines',
|
|
132
|
+
},
|
|
133
|
+
'pt-BR': {
|
|
134
|
+
summary: 'Limite de máquinas atingido.',
|
|
135
|
+
whatHappened: 'Seu plano permite um número limitado de máquinas ativas, e esta ultrapassaria o limite.',
|
|
136
|
+
whatToDo: 'Desative uma máquina que você não usa mais no portal e rode activate aqui de novo.',
|
|
137
|
+
url: 'https://neocortex.sh/portal/machines',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
NOT_CONFIGURED: {
|
|
141
|
+
en: {
|
|
142
|
+
summary: 'Neocortex is not configured on this machine.',
|
|
143
|
+
whatHappened: 'No license key was found. You need to run `neocortex activate` once before using the CLI.',
|
|
144
|
+
whatToDo: 'Get a license key from the portal and activate.',
|
|
145
|
+
command: 'neocortex activate YOUR-LICENSE-KEY',
|
|
146
|
+
url: 'https://neocortex.sh/portal',
|
|
147
|
+
},
|
|
148
|
+
'pt-BR': {
|
|
149
|
+
summary: 'Neocortex não está configurado nesta máquina.',
|
|
150
|
+
whatHappened: 'Nenhuma license key encontrada. Você precisa rodar `neocortex activate` uma vez antes de usar o CLI.',
|
|
151
|
+
whatToDo: 'Pegue uma license key no portal e ative.',
|
|
152
|
+
command: 'neocortex activate SUA-LICENSE-KEY',
|
|
153
|
+
url: 'https://neocortex.sh/portal',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
/** Detect the best locale from LC_ALL / LANG. Falls back to 'en'. */
|
|
158
|
+
export function detectErrorLocale(env = process.env) {
|
|
159
|
+
const raw = (env.LC_ALL ?? env.LANG ?? '').toLowerCase();
|
|
160
|
+
if (raw.startsWith('pt'))
|
|
161
|
+
return 'pt-BR';
|
|
162
|
+
return 'en';
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Look up a humanized message for an error code.
|
|
166
|
+
* Returns null if the code is unknown -- caller should fall back to the
|
|
167
|
+
* raw server message.
|
|
168
|
+
*/
|
|
169
|
+
export function humanizeError(code, locale = detectErrorLocale()) {
|
|
170
|
+
const group = MESSAGES[code];
|
|
171
|
+
if (!group)
|
|
172
|
+
return null;
|
|
173
|
+
return group[locale] ?? group.en ?? null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Format a humanized error for stderr. Always ends with the support email.
|
|
177
|
+
*/
|
|
178
|
+
export function formatHumanizedError(humanized, locale = detectErrorLocale()) {
|
|
179
|
+
const lines = [];
|
|
180
|
+
lines.push('');
|
|
181
|
+
lines.push(`[Neocortex] ${humanized.summary}`);
|
|
182
|
+
lines.push('');
|
|
183
|
+
const whatHappenedLabel = locale === 'pt-BR' ? 'O que aconteceu' : 'What happened';
|
|
184
|
+
const whatToDoLabel = locale === 'pt-BR' ? 'O que fazer' : 'What to do';
|
|
185
|
+
const needHelpLabel = locale === 'pt-BR'
|
|
186
|
+
? `Precisa de ajuda? ${SUPPORT_EMAIL}`
|
|
187
|
+
: `Need help? ${SUPPORT_EMAIL}`;
|
|
188
|
+
lines.push(`${whatHappenedLabel}: ${humanized.whatHappened}`);
|
|
189
|
+
lines.push(`${whatToDoLabel}: ${humanized.whatToDo}`);
|
|
190
|
+
if (humanized.command) {
|
|
191
|
+
lines.push('');
|
|
192
|
+
lines.push(` ${humanized.command}`);
|
|
193
|
+
}
|
|
194
|
+
if (humanized.url) {
|
|
195
|
+
lines.push('');
|
|
196
|
+
lines.push(` ${humanized.url}`);
|
|
197
|
+
}
|
|
198
|
+
lines.push('');
|
|
199
|
+
lines.push(needHelpLabel);
|
|
200
|
+
lines.push('');
|
|
201
|
+
return lines.join('\n');
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Infer an error code from a low-level error object (e.g., Node.js error
|
|
205
|
+
* thrown by fetch / dns / pg). Returns null if we cannot classify it.
|
|
206
|
+
*/
|
|
207
|
+
export function inferErrorCodeFromException(err) {
|
|
208
|
+
if (!err || typeof err !== 'object')
|
|
209
|
+
return null;
|
|
210
|
+
const e = err;
|
|
211
|
+
if (typeof e.code === 'string') {
|
|
212
|
+
if (e.code === 'ECONNREFUSED')
|
|
213
|
+
return 'ECONNREFUSED';
|
|
214
|
+
if (e.code === 'ENOTFOUND')
|
|
215
|
+
return 'ECONNREFUSED';
|
|
216
|
+
if (e.code === 'ETIMEDOUT')
|
|
217
|
+
return 'ECONNREFUSED';
|
|
218
|
+
if (e.code === 'ECONNRESET')
|
|
219
|
+
return 'ECONNREFUSED';
|
|
220
|
+
}
|
|
221
|
+
if (typeof e.message === 'string') {
|
|
222
|
+
if (/connect/i.test(e.message) && /refus/i.test(e.message))
|
|
223
|
+
return 'ECONNREFUSED';
|
|
224
|
+
if (/fetch failed/i.test(e.message))
|
|
225
|
+
return 'ECONNREFUSED';
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
@@ -1 +1,125 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Public-safe diagnostics for the P204 frontmatter boundary.
|
|
3
|
+
*
|
|
4
|
+
* Diagnostic construction intentionally accepts a reason code only. Rejected
|
|
5
|
+
* source text, wrapper bodies, argv and filesystem paths are never inputs, so
|
|
6
|
+
* callers cannot accidentally reflect private content into logs.
|
|
7
|
+
*/
|
|
8
|
+
export const FRONTMATTER_DIAGNOSTIC_CATEGORIES = [
|
|
9
|
+
'payload-selection',
|
|
10
|
+
'target-normalization',
|
|
11
|
+
'metadata-frontmatter',
|
|
12
|
+
];
|
|
13
|
+
export const FRONTMATTER_DIAGNOSTIC_REASON_CODES = [
|
|
14
|
+
'payload-selection-ambiguous',
|
|
15
|
+
'payload-selection-unavailable',
|
|
16
|
+
'markdown-link-target-malformed',
|
|
17
|
+
'markdown-link-target-ambiguous',
|
|
18
|
+
'markdown-link-target-external',
|
|
19
|
+
'markdown-link-target-unsafe-path',
|
|
20
|
+
'raw-target-malformed',
|
|
21
|
+
'raw-target-external',
|
|
22
|
+
'raw-target-unsafe-path',
|
|
23
|
+
'frontmatter-malformed',
|
|
24
|
+
'frontmatter-oversized',
|
|
25
|
+
'frontmatter-unsupported-value',
|
|
26
|
+
'frontmatter-explicit-selection-required',
|
|
27
|
+
];
|
|
28
|
+
const TARGET_EXAMPLE = '*yoloop @docs/epics/epic-P204.md';
|
|
29
|
+
const FRONTMATTER_EXAMPLE = 'docs/epics/epic-P204.md';
|
|
30
|
+
const DIAGNOSTICS = Object.freeze({
|
|
31
|
+
'payload-selection-ambiguous': Object.freeze({
|
|
32
|
+
category: 'payload-selection',
|
|
33
|
+
summary: 'The explicit Neocortex command could not be selected unambiguously.',
|
|
34
|
+
remediation: 'Pass exactly one explicit trigger and its project-local arguments; keep host wrapper metadata outside the selected payload.',
|
|
35
|
+
}),
|
|
36
|
+
'payload-selection-unavailable': Object.freeze({
|
|
37
|
+
category: 'payload-selection',
|
|
38
|
+
summary: 'The explicit Neocortex command could not be selected safely.',
|
|
39
|
+
remediation: 'Retry with one explicit trigger. Do not include wrapper frontmatter, conversation history or delegated prompt text.',
|
|
40
|
+
}),
|
|
41
|
+
'markdown-link-target-malformed': Object.freeze({
|
|
42
|
+
category: 'target-normalization',
|
|
43
|
+
summary: 'The Markdown target is malformed or is not a supported Markdown path.',
|
|
44
|
+
remediation: 'Use one complete Markdown link to a project-relative .md file or a trailing-slash directory.',
|
|
45
|
+
example: TARGET_EXAMPLE,
|
|
46
|
+
}),
|
|
47
|
+
'markdown-link-target-ambiguous': Object.freeze({
|
|
48
|
+
category: 'target-normalization',
|
|
49
|
+
summary: 'More than one target or mixed target syntax was supplied.',
|
|
50
|
+
remediation: 'Pass exactly one raw path or one Markdown link target.',
|
|
51
|
+
example: TARGET_EXAMPLE,
|
|
52
|
+
}),
|
|
53
|
+
'markdown-link-target-external': Object.freeze({
|
|
54
|
+
category: 'target-normalization',
|
|
55
|
+
summary: 'External Markdown targets are not supported.',
|
|
56
|
+
remediation: 'Reference a file already inside the project with a project-relative path.',
|
|
57
|
+
example: TARGET_EXAMPLE,
|
|
58
|
+
}),
|
|
59
|
+
'markdown-link-target-unsafe-path': Object.freeze({
|
|
60
|
+
category: 'target-normalization',
|
|
61
|
+
summary: 'The Markdown target is outside the supported project-relative path boundary.',
|
|
62
|
+
remediation: 'Remove absolute, home, drive, backslash or traversal segments and use a project-relative path.',
|
|
63
|
+
example: TARGET_EXAMPLE,
|
|
64
|
+
}),
|
|
65
|
+
'raw-target-malformed': Object.freeze({
|
|
66
|
+
category: 'target-normalization',
|
|
67
|
+
summary: 'The raw target is not a supported Markdown path.',
|
|
68
|
+
remediation: 'Use one project-relative .md file or a trailing-slash directory.',
|
|
69
|
+
example: TARGET_EXAMPLE,
|
|
70
|
+
}),
|
|
71
|
+
'raw-target-external': Object.freeze({
|
|
72
|
+
category: 'target-normalization',
|
|
73
|
+
summary: 'External raw targets are not supported.',
|
|
74
|
+
remediation: 'Reference a file already inside the project with a project-relative path.',
|
|
75
|
+
example: TARGET_EXAMPLE,
|
|
76
|
+
}),
|
|
77
|
+
'raw-target-unsafe-path': Object.freeze({
|
|
78
|
+
category: 'target-normalization',
|
|
79
|
+
summary: 'The raw target is outside the supported project-relative path boundary.',
|
|
80
|
+
remediation: 'Remove absolute, home, drive, backslash or traversal segments and use a project-relative path.',
|
|
81
|
+
example: TARGET_EXAMPLE,
|
|
82
|
+
}),
|
|
83
|
+
'frontmatter-malformed': Object.freeze({
|
|
84
|
+
category: 'metadata-frontmatter',
|
|
85
|
+
summary: 'The leading YAML frontmatter envelope is malformed.',
|
|
86
|
+
remediation: 'Repair the bounded leading --- envelope and keep generated metadata fields scalar or string-list values.',
|
|
87
|
+
example: FRONTMATTER_EXAMPLE,
|
|
88
|
+
}),
|
|
89
|
+
'frontmatter-oversized': Object.freeze({
|
|
90
|
+
category: 'metadata-frontmatter',
|
|
91
|
+
summary: 'The leading YAML frontmatter exceeds the public parsing limits.',
|
|
92
|
+
remediation: 'Reduce the metadata header and keep descriptive content in the Markdown body.',
|
|
93
|
+
example: FRONTMATTER_EXAMPLE,
|
|
94
|
+
}),
|
|
95
|
+
'frontmatter-unsupported-value': Object.freeze({
|
|
96
|
+
category: 'metadata-frontmatter',
|
|
97
|
+
summary: 'A frontmatter field uses an unsupported value shape.',
|
|
98
|
+
remediation: 'Use allowlisted scalar fields and bounded string lists only.',
|
|
99
|
+
example: FRONTMATTER_EXAMPLE,
|
|
100
|
+
}),
|
|
101
|
+
'frontmatter-explicit-selection-required': Object.freeze({
|
|
102
|
+
category: 'metadata-frontmatter',
|
|
103
|
+
summary: 'Target metadata cannot be projected before explicit file selection.',
|
|
104
|
+
remediation: 'Select one project-relative epic or story target before metadata discovery.',
|
|
105
|
+
example: FRONTMATTER_EXAMPLE,
|
|
106
|
+
}),
|
|
107
|
+
});
|
|
108
|
+
const UNKNOWN_DIAGNOSTIC = Object.freeze({
|
|
109
|
+
category: 'metadata-frontmatter',
|
|
110
|
+
reasonCode: 'frontmatter-diagnostic-unclassified',
|
|
111
|
+
summary: 'The frontmatter operation could not be classified safely.',
|
|
112
|
+
remediation: 'Retry with one explicit project-relative target and a bounded YAML header.',
|
|
113
|
+
example: FRONTMATTER_EXAMPLE,
|
|
114
|
+
});
|
|
115
|
+
export function getFrontmatterDiagnostic(reasonCode) {
|
|
116
|
+
const definition = DIAGNOSTICS[reasonCode];
|
|
117
|
+
if (!definition)
|
|
118
|
+
return UNKNOWN_DIAGNOSTIC;
|
|
119
|
+
return Object.freeze({ reasonCode: reasonCode, ...definition });
|
|
120
|
+
}
|
|
121
|
+
export function formatFrontmatterDiagnostic(reasonCode) {
|
|
122
|
+
const diagnostic = getFrontmatterDiagnostic(reasonCode);
|
|
123
|
+
const example = diagnostic.example ? ` Example: ${diagnostic.example}.` : '';
|
|
124
|
+
return `${diagnostic.reasonCode} [${diagnostic.category}]: ${diagnostic.summary} Remediation: ${diagnostic.remediation}${example}`;
|
|
125
|
+
}
|