@ornexus/neocortex 4.61.5 → 4.62.0

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 (279) hide show
  1. package/dist/release-source.json +1 -1
  2. package/dist/sbom.cdx.json +1193 -1193
  3. package/install.ps1 +31 -34
  4. package/install.sh +1 -1
  5. package/package.json +5 -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.d.ts +8 -1
  20. package/packages/client/dist/agent/update-description.js +2 -260
  21. package/packages/client/dist/cache/crypto-utils.js +1 -78
  22. package/packages/client/dist/cache/encrypted-cache.js +1 -338
  23. package/packages/client/dist/cache/in-memory-asset-cache.js +1 -73
  24. package/packages/client/dist/cache/index.js +1 -13
  25. package/packages/client/dist/cache/protected-pi-boundary.js +1 -44
  26. package/packages/client/dist/checkpoint/checkpoint-client-reader.js +2 -127
  27. package/packages/client/dist/checkpoint/index.js +1 -11
  28. package/packages/client/dist/checkpoint/shared-checkpoint-types.js +1 -32
  29. package/packages/client/dist/cli.js +5 -364
  30. package/packages/client/dist/commands/activate.js +8 -394
  31. package/packages/client/dist/commands/architecture-answers.js +7 -274
  32. package/packages/client/dist/commands/architecture-memory-terminal.js +4 -253
  33. package/packages/client/dist/commands/architecture-non-ui-continuation.js +1 -100
  34. package/packages/client/dist/commands/architecture-root-binding.js +1 -51
  35. package/packages/client/dist/commands/cache-status.js +2 -112
  36. package/packages/client/dist/commands/config.js +1 -88
  37. package/packages/client/dist/commands/doctor.js +2 -635
  38. package/packages/client/dist/commands/invoke.d.ts +17 -0
  39. package/packages/client/dist/commands/invoke.js +148 -7822
  40. package/packages/client/dist/commands/legacy-epic-terminal.js +1 -71
  41. package/packages/client/dist/commands/legacy-story-branch.js +1 -96
  42. package/packages/client/dist/commands/legacy-story-pr.js +1 -276
  43. package/packages/client/dist/commands/mutation-qa-checkpoint.js +5 -285
  44. package/packages/client/dist/commands/mutation-qa-gate.js +1 -54
  45. package/packages/client/dist/commands/mutation-qa-git.js +1 -41
  46. package/packages/client/dist/commands/mutation-qa-policy.js +1 -102
  47. package/packages/client/dist/commands/mutation-qa-run.js +3 -219
  48. package/packages/client/dist/commands/mutation-qa-verdict.js +1 -149
  49. package/packages/client/dist/commands/mutation-qa.js +1 -220
  50. package/packages/client/dist/commands/native-agent.js +2 -136
  51. package/packages/client/dist/commands/planning-diagnosis.js +1 -43
  52. package/packages/client/dist/commands/planning-generation.js +1 -53
  53. package/packages/client/dist/commands/planning-memory.js +1 -40
  54. package/packages/client/dist/commands/planning-research.js +1 -42
  55. package/packages/client/dist/commands/private-session.js +1 -75
  56. package/packages/client/dist/commands/property-qa.js +1 -139
  57. package/packages/client/dist/commands/qa-control.js +1 -16
  58. package/packages/client/dist/commands/qa-scan-browser-launch.js +1 -55
  59. package/packages/client/dist/commands/qa-scan-browser-route.js +1 -28
  60. package/packages/client/dist/commands/qa-scan-capture.js +5 -663
  61. package/packages/client/dist/commands/qa-scan-discovery.js +3 -376
  62. package/packages/client/dist/commands/qa-scan-review.js +5 -826
  63. package/packages/client/dist/commands/qa-synthetic-backend-capture.js +1 -266
  64. package/packages/client/dist/commands/qa-synthetic-backend-review.js +1 -297
  65. package/packages/client/dist/commands/qa-synthetic-backend.js +2 -340
  66. package/packages/client/dist/commands/qa-synthetic-broker-port.js +1 -85
  67. package/packages/client/dist/commands/qa-synthetic-browser.js +1 -39
  68. package/packages/client/dist/commands/refactor-characterization.js +21 -671
  69. package/packages/client/dist/commands/refactor-commit.js +13 -399
  70. package/packages/client/dist/commands/refactor-control.js +3 -142
  71. package/packages/client/dist/commands/refactor-cpp-assertions.js +3 -93
  72. package/packages/client/dist/commands/refactor-review.js +5 -283
  73. package/packages/client/dist/commands/refactor-root.js +7 -588
  74. package/packages/client/dist/commands/refresh-memory.js +3 -174
  75. package/packages/client/dist/commands/shared-architecture-non-ui.js +1 -24
  76. package/packages/client/dist/commands/story-checkpoint.d.ts +5 -1
  77. package/packages/client/dist/commands/story-checkpoint.js +1 -203
  78. package/packages/client/dist/commands/story-worktree.js +5 -258
  79. package/packages/client/dist/config/host-auth-broker.js +1 -60
  80. package/packages/client/dist/config/host-auth-reference.js +1 -93
  81. package/packages/client/dist/config/profile-directory.js +1 -13
  82. package/packages/client/dist/config/resolver-selection.js +1 -278
  83. package/packages/client/dist/config/secure-config.js +12 -281
  84. package/packages/client/dist/config.js +2 -224
  85. package/packages/client/dist/constants.js +1 -25
  86. package/packages/client/dist/context/context-collector.js +2 -222
  87. package/packages/client/dist/context/context-sanitizer.js +1 -145
  88. package/packages/client/dist/continuity/autonomous-governance.js +1 -285
  89. package/packages/client/dist/continuity/continuity-client-state-store.js +1 -1587
  90. package/packages/client/dist/continuity/invoke-hooks.js +1 -129
  91. package/packages/client/dist/continuity/migrations/001-initial-schema.js +2 -12
  92. package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +2 -12
  93. package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +2 -12
  94. package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +2 -12
  95. package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +2 -12
  96. package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +2 -10
  97. package/packages/client/dist/continuity/native-agent-store.js +1 -69
  98. package/packages/client/dist/continuity/native-agent-types.js +1 -105
  99. package/packages/client/dist/continuity/outbox.js +1 -117
  100. package/packages/client/dist/continuity/runner-bootstrap-policy.js +1 -172
  101. package/packages/client/dist/continuity/sqlite-store.js +81 -2612
  102. package/packages/client/dist/effects/invoke-effect-gateways.js +1 -62
  103. package/packages/client/dist/errors/error-messages.js +2 -258
  104. package/packages/client/dist/errors/frontmatter-diagnostics.d.ts +10 -1
  105. package/packages/client/dist/errors/frontmatter-diagnostics.js +1 -125
  106. package/packages/client/dist/evidence/collector.js +1 -347
  107. package/packages/client/dist/evidence/index.js +1 -1
  108. package/packages/client/dist/evidence/types.js +0 -2
  109. package/packages/client/dist/fs/atomic-state-replace.js +1 -152
  110. package/packages/client/dist/generated/command-registry.generated.js +1 -4076
  111. package/packages/client/dist/generated/public-projections.generated.js +1 -149
  112. package/packages/client/dist/git/direct-yolo-c01-retry.js +4 -138
  113. package/packages/client/dist/git/direct-yolo-checkpoint.d.ts +94 -9
  114. package/packages/client/dist/git/direct-yolo-checkpoint.js +3 -1592
  115. package/packages/client/dist/git/epic-operational-state.js +2 -672
  116. package/packages/client/dist/git/git-lifecycle-step-ids.js +1 -14
  117. package/packages/client/dist/git/git-lifecycle-store.d.ts +88 -0
  118. package/packages/client/dist/git/git-lifecycle-store.js +9 -2529
  119. package/packages/client/dist/git/legacy-story-branch-checkpoint.js +9 -259
  120. package/packages/client/dist/git/legacy-story-branch-setup.js +4 -348
  121. package/packages/client/dist/git/legacy-story-pr.js +70 -3538
  122. package/packages/client/dist/git/neocortex-trailers.js +2 -53
  123. package/packages/client/dist/git/release-gate-env.d.ts +62 -0
  124. package/packages/client/dist/git/release-gate-env.js +1 -0
  125. package/packages/client/dist/git/secure-filesystem-boundary.d.ts +24 -0
  126. package/packages/client/dist/git/secure-filesystem-boundary.js +20 -186
  127. package/packages/client/dist/git/story-worktree-cleanup.js +4 -1058
  128. package/packages/client/dist/git/story-worktree-integration.d.ts +62 -0
  129. package/packages/client/dist/git/story-worktree-integration.js +3 -603
  130. package/packages/client/dist/git/story-worktree-manager.js +3 -843
  131. package/packages/client/dist/git/story-worktree-paths.js +1 -150
  132. package/packages/client/dist/git/story-write-set-extension.d.ts +44 -0
  133. package/packages/client/dist/git/story-write-set-extension.js +1 -0
  134. package/packages/client/dist/graph-retrieval/pre-command-hook.js +1 -284
  135. package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +1 -237
  136. package/packages/client/dist/i18n/first-run.js +2 -60
  137. package/packages/client/dist/index.js +1 -50
  138. package/packages/client/dist/invocation/invoke-input.js +1 -24
  139. package/packages/client/dist/license/host-auth-recovery.js +1 -401
  140. package/packages/client/dist/license/index.js +1 -5
  141. package/packages/client/dist/license/license-client.js +1 -337
  142. package/packages/client/dist/machine/fingerprint.js +2 -163
  143. package/packages/client/dist/machine/index.js +1 -5
  144. package/packages/client/dist/memory/project-memory-path-scope.js +1 -62
  145. package/packages/client/dist/memory/project-memory-writer.js +41 -1117
  146. package/packages/client/dist/memory/shared-project-memory-types.js +2 -259
  147. package/packages/client/dist/migrations/epic-lifecycle-backfill.js +3 -1060
  148. package/packages/client/dist/migrations/project-identity-capability.js +1 -50
  149. package/packages/client/dist/migrations/project-identity.js +7 -493
  150. package/packages/client/dist/migrations/state-json.js +4 -393
  151. package/packages/client/dist/policy/architecture-policy.js +2 -184
  152. package/packages/client/dist/policy/index.js +1 -7
  153. package/packages/client/dist/policy/shared-policy-types.js +0 -38
  154. package/packages/client/dist/policy/subagent-approval-policy.js +1 -57
  155. package/packages/client/dist/private-execution/clean-baseline.js +2 -279
  156. package/packages/client/dist/private-execution/codex-executor.js +4 -574
  157. package/packages/client/dist/private-execution/codex-host-runtime.js +1 -137
  158. package/packages/client/dist/private-execution/codex-lifecycle-guard.js +1 -97
  159. package/packages/client/dist/private-execution/codex-scoped-permissions.js +1 -128
  160. package/packages/client/dist/private-execution/delivery.js +13 -410
  161. package/packages/client/dist/private-execution/diagnosis-root-review.js +2 -294
  162. package/packages/client/dist/private-execution/frozen-handoff.js +6 -19
  163. package/packages/client/dist/private-execution/implementation-validation.js +2 -106
  164. package/packages/client/dist/private-execution/isolated-admission.js +23 -1432
  165. package/packages/client/dist/private-execution/isolated-session.js +5 -725
  166. package/packages/client/dist/private-execution/isolated-workspace.js +1 -122
  167. package/packages/client/dist/private-execution/pact-consumer-runtime.js +3 -409
  168. package/packages/client/dist/private-execution/pact-test-source.js +1 -258
  169. package/packages/client/dist/private-execution/pact-toolchain.js +3 -290
  170. package/packages/client/dist/private-execution/pact-write-set.js +1 -172
  171. package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +5 -406
  172. package/packages/client/dist/private-execution/planning-generation-checkpoint.js +5 -462
  173. package/packages/client/dist/private-execution/planning-memory-checkpoint.js +3 -139
  174. package/packages/client/dist/private-execution/planning-research-checkpoint.js +4 -325
  175. package/packages/client/dist/private-execution/private-report-store.js +1 -42
  176. package/packages/client/dist/private-execution/property-test-candidate.js +1 -103
  177. package/packages/client/dist/private-execution/property-test-choices.js +3 -147
  178. package/packages/client/dist/private-execution/property-test-plan.js +7 -271
  179. package/packages/client/dist/private-execution/property-test-review.js +4 -258
  180. package/packages/client/dist/private-execution/property-test-runtime.js +9 -372
  181. package/packages/client/dist/private-execution/property-test-source.js +1 -139
  182. package/packages/client/dist/private-execution/root-checkpoint.js +1 -80
  183. package/packages/client/dist/private-execution/root-memory-git-evidence.js +3 -135
  184. package/packages/client/dist/private-execution/root-memory-recovery.js +1 -93
  185. package/packages/client/dist/private-execution/root-memory-request.js +1 -29
  186. package/packages/client/dist/private-execution/root-memory-scope.js +1 -178
  187. package/packages/client/dist/private-execution/root-memory-writer.js +1 -102
  188. package/packages/client/dist/private-execution/session-lease.js +1 -63
  189. package/packages/client/dist/private-execution/shared-private-admission-types.js +1 -50
  190. package/packages/client/dist/private-execution/shared-project-validation.js +1 -66
  191. package/packages/client/dist/private-execution/shared-root-memory-types.js +1 -61
  192. package/packages/client/dist/private-execution/ux-source-validation.js +1 -372
  193. package/packages/client/dist/private-execution/ux-write-set.js +2 -191
  194. package/packages/client/dist/registry/registry-reconciliation.js +1 -234
  195. package/packages/client/dist/resilience/circuit-breaker.js +1 -170
  196. package/packages/client/dist/resilience/degradation-manager.js +1 -164
  197. package/packages/client/dist/resilience/freshness-indicator.js +1 -100
  198. package/packages/client/dist/resilience/index.js +1 -8
  199. package/packages/client/dist/resilience/recovery-detector.js +1 -74
  200. package/packages/client/dist/resolvers/asset-resolver.js +0 -13
  201. package/packages/client/dist/resolvers/local-resolver.js +8 -255
  202. package/packages/client/dist/resolvers/remote-resolver.js +1 -233
  203. package/packages/client/dist/runner/binary.js +1 -404
  204. package/packages/client/dist/runner/cli.js +17 -1571
  205. package/packages/client/dist/runner/epic-background-dispatcher.js +1 -124
  206. package/packages/client/dist/runner/headless/adapters.js +1 -49
  207. package/packages/client/dist/runner/headless/background-root.js +1 -85
  208. package/packages/client/dist/runner/headless/child-env.d.ts +92 -0
  209. package/packages/client/dist/runner/headless/child-env.js +1 -0
  210. package/packages/client/dist/runner/headless/claude-code-adapter.js +1 -79
  211. package/packages/client/dist/runner/headless/continuous-story-workspace.js +11 -1776
  212. package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +1 -69
  213. package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +2 -111
  214. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.d.ts +1 -0
  215. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +10 -1464
  216. package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +2 -357
  217. package/packages/client/dist/runner/headless/fake-adapter.js +1 -62
  218. package/packages/client/dist/runner/headless/managed-environment-cleanup.js +1 -274
  219. package/packages/client/dist/runner/headless/managed-profile.js +1 -149
  220. package/packages/client/dist/runner/headless/opencode-adapter.js +2 -145
  221. package/packages/client/dist/runner/headless/prepared-story-bundle.js +1 -43
  222. package/packages/client/dist/runner/headless/resolver.js +1 -231
  223. package/packages/client/dist/runner/headless/run-yolo.js +1 -886
  224. package/packages/client/dist/runner/headless/run-yoloop.js +2 -2657
  225. package/packages/client/dist/runner/headless/types.js +2 -575
  226. package/packages/client/dist/runner/host-capacity.js +1 -59
  227. package/packages/client/dist/runner/local-console.js +13 -396
  228. package/packages/client/dist/runner/portal-sync-worker.js +1 -1487
  229. package/packages/client/dist/runner/project-identity.js +1 -106
  230. package/packages/client/dist/runner/scheduler.js +7 -995
  231. package/packages/client/dist/runner-cli.js +2 -18
  232. package/packages/client/dist/state/invocation-shape.js +1 -13
  233. package/packages/client/dist/state/project-state-snapshot.js +1 -1754
  234. package/packages/client/dist/state/state-json-repair.js +3 -785
  235. package/packages/client/dist/state/structural-dag-projection.js +1 -118
  236. package/packages/client/dist/telemetry/index.js +1 -5
  237. package/packages/client/dist/telemetry/offline-queue.js +1 -131
  238. package/packages/client/dist/tier/index.js +1 -5
  239. package/packages/client/dist/tier/tier-aware-client.js +1 -405
  240. package/packages/client/dist/types/index.js +1 -38
  241. package/packages/client/dist/version.js +1 -27
  242. package/packages/client/dist/yolo/change-evidence-collector.d.ts +10 -0
  243. package/packages/client/dist/yolo/change-evidence-collector.js +1 -262
  244. package/packages/client/dist/yolo/invoke-envelope-capability.d.ts +2 -0
  245. package/packages/client/dist/yolo/invoke-envelope-capability.js +1 -65
  246. package/packages/client/dist/yolo/project-manifest-projection-collector.d.ts +28 -0
  247. package/packages/client/dist/yolo/project-manifest-projection-collector.js +1 -0
  248. package/packages/client/dist/yolo/spec-envelope-collector.d.ts +9 -0
  249. package/packages/client/dist/yolo/spec-envelope-collector.js +5 -184
  250. package/packages/client/dist/yoloop/discovery-hook.js +2 -300
  251. package/packages/client/dist/yoloop/index.js +1 -8
  252. package/packages/client/dist/yoloop/invoke-hooks.js +12 -669
  253. package/packages/client/dist/yoloop/shared-discover-epics.d.ts +16 -0
  254. package/packages/client/dist/yoloop/shared-discover-epics.js +1 -1007
  255. package/packages/client/dist/yoloop/shared-yoloop-types.js +1 -33
  256. package/packages/client/dist/yoloop/target-normalization.js +1 -180
  257. package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -1920
  258. package/packages/shared/dist/frontmatter-context-contract.js +164 -52
  259. package/packages/shared/dist/project-manifest-projection.js +199 -0
  260. package/packages/shared/dist/project-validation-commands.js +14 -6
  261. package/packages/shared/dist/yolo/spec-envelope-rules.js +85 -0
  262. package/packages/shared/dist/yolo/spec-envelope.js +33 -7
  263. package/packages/shared/dist/yoloop/epic-terminal-git.js +94 -6
  264. package/packages/shared/dist/yoloop/story-write-scope.js +212 -0
  265. package/targets-stubs/antigravity/gemini.md +1 -1
  266. package/targets-stubs/antigravity/install-antigravity.sh +13 -4
  267. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  268. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  269. package/targets-stubs/claude-code/neocortex-root.md +2 -2
  270. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  271. package/targets-stubs/claude-code/neocortex.md +5 -5
  272. package/targets-stubs/codex/AGENTS.md +1 -1
  273. package/targets-stubs/cursor/agent.md +2 -2
  274. package/targets-stubs/gemini-cli/agent.md +2 -2
  275. package/targets-stubs/lib/managed-config-merge.js +77 -1
  276. package/targets-stubs/lib/managed-profile.sh +7 -0
  277. package/targets-stubs/opencode/neocortex-root.md +1 -1
  278. package/targets-stubs/vscode/install-vscode.sh +21 -0
  279. package/targets-stubs/vscode/neocortex.agent.md +2 -2
@@ -1,62 +1 @@
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
+ import{assertDeclaredNetworkTransport as i,resolveClosedProcessProfile as a,StrictReadOnlyError as c}from"../../../shared/dist/strict-readonly.js";function d(t,e,r){const o={phase:"client-preflight",domain:"client-persistence",category:r,operation:"update"};return Object.freeze({get:n=>e.get(n),set:(n,s,u)=>t.executeAsync(o,()=>e.set(n,s,u),async()=>{}),clear:()=>t.executeAsync(o,()=>e.clear(),async()=>{})})}function f(t,e,r,o,n="engine"){const s=a(e,r);return t.execute({phase:n,domain:"external-effect",category:"process",operation:"spawn"},()=>o(s),()=>({status:null,stdout:"",stderr:"",projected:!0}))}function h(t,e,r,o,n="engine"){const s=a(e,r);return t.execute({phase:n,domain:"external-effect",category:"git",operation:"spawn"},()=>o(s),()=>({status:null,stdout:"",stderr:"",projected:!0}))}function g(t,e){return t.execute({phase:"client-preflight",domain:"client-persistence",category:"scheduler-session",operation:"create"},()=>(e(),!0),()=>!1)}function y(t,e,r,o){if(!l(e))throw new c("readonly-physical-boundary-unsafe","boundary");return t.execute({phase:"client-preflight",domain:"external-effect",category:"process",operation:"spawn"},r,o)}function l(t){if(t.args.length>8||t.args.some(n=>n.length>512||/[\r\n\0]/u.test(n)))return!1;const e=t.args,r=n=>!!(n&&/^[A-Za-z0-9_.:@-]{1,180}$/u.test(n)),o=n=>!!(n&&(n.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(n))&&!n.split(/[\\/]/u).includes(".."));return t.command==="systemctl"?e[0]==="--user"&&(e.length===2&&e[1]==="daemon-reload"||e.length===4&&e[1]==="enable"&&e[2]==="--now"&&r(e[3])||e.length===3&&(e[1]==="start"||e[1]==="stop")&&r(e[2])||e.length===4&&e[1]==="status"&&r(e[2])&&e[3]==="--no-pager"):t.command==="launchctl"?e.length===3&&(e[0]==="load"||e[0]==="unload")&&e[1]==="-w"&&o(e[2])||e.length===2&&e[0]==="list"&&r(e[1]):t.command==="schtasks"?e.length===6&&e[0]==="/Create"&&e[1]==="/TN"&&r(e[2])&&e[3]==="/XML"&&o(e[4])&&e[5]==="/F"||e.length===3&&(e[0]==="/Run"||e[0]==="/End")&&e[1]==="/TN"&&r(e[2])||e.length===5&&e[0]==="/Query"&&e[1]==="/TN"&&r(e[2])&&e[3]==="/FO"&&e[4]==="LIST":t.command==="crontab"&&e.length===1&&e[0]==="-l"}async function x(t,e){return i(t),e()}async function m(t,e,r,o){if(e!=="secondary-mutation")throw new c("readonly-physical-boundary-unsafe","boundary");return t.executeAsync({phase:"client-preflight",domain:"external-effect",category:"network-mutation",operation:"send"},r,o)}export{d as createCapabilityCache,h as executeClosedGitInspection,f as executeClosedProcess,x as executeInvokeQueryTransport,g as executeSchedulerManifestWrite,y as executeSchedulerProcess,m as executeSecondaryNetworkMutation};
@@ -1,258 +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
- /** Cause-specific AUTH_REFRESH_REQUIRED copy. Only confirmed revocation recommends activation. */
176
- export function humanizeAuthRefreshRequired(cause, locale = detectErrorLocale()) {
177
- const pt = locale === 'pt-BR';
178
- const actions = {
179
- 'near-expiry': { en: 'Prepare authentication outside strict read-only mode, then retry once.', pt: 'Prepare a autenticação fora do modo estritamente somente leitura e tente uma vez.' },
180
- expired: { en: 'Prepare authentication outside strict read-only mode.', pt: 'Prepare a autenticação fora do modo estritamente somente leitura.' },
181
- 'store-unavailable': { en: 'Restore access to the local credential store; do not delete it.', pt: 'Restaure o acesso ao store local; não o apague.' },
182
- 'store-corrupt': { en: 'Stop and recover the credential store explicitly; do not overwrite it.', pt: 'Pare e recupere o store de credenciais explicitamente; não o sobrescreva.' },
183
- 'keychain-unavailable': { en: 'Unlock or restore the system keychain, then retry.', pt: 'Desbloqueie ou restaure o keychain do sistema e tente novamente.' },
184
- 'transport-error': { en: 'Check connectivity and retry later; the current login was preserved.', pt: 'Verifique a conexão e tente depois; o login atual foi preservado.' },
185
- timeout: { en: 'Stop the current recovery and retry only after its outcome is known.', pt: 'Pare a recuperação atual e tente novamente somente após conhecer o resultado.' },
186
- 'rate-limited': { en: 'Wait for the retry window while preserving the current login.', pt: 'Aguarde a janela de nova tentativa preservando o login atual.' },
187
- 'service-unavailable': { en: 'Retry later; do not clear local authentication.', pt: 'Tente novamente depois; não limpe a autenticação local.' },
188
- revoked: { en: 'Re-activate with an authorized license credential.', pt: 'Reative com uma credencial de licença autorizada.', command: pt ? 'neocortex activate SUA-LICENSE-KEY' : 'neocortex activate YOUR-LICENSE-KEY' },
189
- 'scope-denied': { en: 'Request the required scope; do not elevate it locally.', pt: 'Solicite o escopo necessário; não o eleve localmente.' },
190
- 'client-denied': { en: 'Stop and restore the authorized client policy.', pt: 'Pare e restaure a política de cliente autorizada.' },
191
- 'protocol-invalid': { en: 'Stop and inspect the supported authentication contract.', pt: 'Pare e inspecione o contrato de autenticação suportado.' },
192
- 'persistence-failed': { en: 'Recover explicitly; do not repeat refresh or restore an older credential.', pt: 'Recupere explicitamente; não repita o refresh nem restaure uma credencial anterior.' },
193
- 'rotation-uncertain': { en: 'Stop and recover explicitly; do not repeat refresh.', pt: 'Pare e faça recuperação explícita; não repita o refresh.' },
194
- 'capability-unavailable': { en: 'Use a supported host capability; do not export credentials.', pt: 'Use uma capability de host suportada; não exporte credenciais.' },
195
- 'revision-conflict': { en: 'Wait for the current owner and re-read the accepted generation.', pt: 'Aguarde o owner atual e releia a geração aceita.' },
196
- };
197
- const selected = actions[cause];
198
- return {
199
- summary: pt ? 'A autenticação requer uma ação causal.' : 'Authentication requires a causal action.',
200
- whatHappened: pt ? `A causa confirmada é ${cause}; nenhum segredo ou corpo bruto foi exibido.` : `The confirmed cause is ${cause}; no secret or raw response body was exposed.`,
201
- whatToDo: pt ? selected.pt : selected.en,
202
- ...(selected.command ? { command: selected.command } : {}),
203
- };
204
- }
205
- /**
206
- * Format a humanized error for stderr. Always ends with the support email.
207
- */
208
- export function formatHumanizedError(humanized, locale = detectErrorLocale()) {
209
- const lines = [];
210
- lines.push('');
211
- lines.push(`[Neocortex] ${humanized.summary}`);
212
- lines.push('');
213
- const whatHappenedLabel = locale === 'pt-BR' ? 'O que aconteceu' : 'What happened';
214
- const whatToDoLabel = locale === 'pt-BR' ? 'O que fazer' : 'What to do';
215
- const needHelpLabel = locale === 'pt-BR'
216
- ? `Precisa de ajuda? ${SUPPORT_EMAIL}`
217
- : `Need help? ${SUPPORT_EMAIL}`;
218
- lines.push(`${whatHappenedLabel}: ${humanized.whatHappened}`);
219
- lines.push(`${whatToDoLabel}: ${humanized.whatToDo}`);
220
- if (humanized.command) {
221
- lines.push('');
222
- lines.push(` ${humanized.command}`);
223
- }
224
- if (humanized.url) {
225
- lines.push('');
226
- lines.push(` ${humanized.url}`);
227
- }
228
- lines.push('');
229
- lines.push(needHelpLabel);
230
- lines.push('');
231
- return lines.join('\n');
232
- }
233
- /**
234
- * Infer an error code from a low-level error object (e.g., Node.js error
235
- * thrown by fetch / dns / pg). Returns null if we cannot classify it.
236
- */
237
- export function inferErrorCodeFromException(err) {
238
- if (!err || typeof err !== 'object')
239
- return null;
240
- const e = err;
241
- if (typeof e.code === 'string') {
242
- if (e.code === 'ECONNREFUSED')
243
- return 'ECONNREFUSED';
244
- if (e.code === 'ENOTFOUND')
245
- return 'ECONNREFUSED';
246
- if (e.code === 'ETIMEDOUT')
247
- return 'ECONNREFUSED';
248
- if (e.code === 'ECONNRESET')
249
- return 'ECONNREFUSED';
250
- }
251
- if (typeof e.message === 'string') {
252
- if (/connect/i.test(e.message) && /refus/i.test(e.message))
253
- return 'ECONNREFUSED';
254
- if (/fetch failed/i.test(e.message))
255
- return 'ECONNREFUSED';
256
- }
257
- return null;
258
- }
1
+ const r="support@neocortex.sh",c={AUTH_REFRESH_REQUIRED:{en:{summary:"Authentication must be refreshed.",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.",whatToDo:"Check the server connection and retry. If authentication remains unavailable, re-activate outside strict read-only mode.",command:"neocortex activate YOUR-LICENSE-KEY",url:"https://neocortex.sh/portal"},"pt-BR":{summary:"A autentica\xE7\xE3o precisa ser renovada.",whatHappened:"As credenciais est\xE3o configuradas, mas n\xE3o h\xE1 um token de autentica\xE7\xE3o v\xE1lido dispon\xEDvel. O token pode ter expirado ou o servi\xE7o de autentica\xE7\xE3o pode estar inacess\xEDvel. Comandos estritamente somente leitura n\xE3o renovam tokens.",whatToDo:"Verifique a conex\xE3o com o servidor e tente novamente. Se a autentica\xE7\xE3o continuar indispon\xEDvel, reative fora do modo estritamente somente leitura.",command:"neocortex activate SUA-LICENSE-KEY",url:"https://neocortex.sh/portal"}},AUTH_EXPIRED:{en:{summary:"Your session has expired.",whatHappened:"The token we use to authenticate your CLI has expired. This is normal and happens every few hours.",whatToDo:"Re-activate with the license key that was emailed to you.",command:"neocortex activate YOUR-LICENSE-KEY",url:"https://neocortex.sh/portal"},"pt-BR":{summary:"Sua sess\xE3o expirou.",whatHappened:"O token de autentica\xE7\xE3o do CLI expirou. Isso \xE9 normal e acontece a cada poucas horas.",whatToDo:"Reative o CLI com a license key que voc\xEA recebeu por email.",command:"neocortex activate SUA-LICENSE-KEY",url:"https://neocortex.sh/portal"}},UPGRADE_REQUIRED:{en:{summary:"Your CLI version is outdated.",whatHappened:"The server requires a newer CLI version. Older versions are not allowed for security and compatibility reasons.",whatToDo:"Install the latest CLI globally with npm.",command:"npm install -g @ornexus/neocortex@latest"},"pt-BR":{summary:"Sua vers\xE3o do CLI est\xE1 desatualizada.",whatHappened:"O servidor exige uma vers\xE3o mais recente do CLI. Vers\xF5es antigas n\xE3o s\xE3o permitidas por motivos de seguran\xE7a e compatibilidade.",whatToDo:"Instale a vers\xE3o mais recente globalmente via npm.",command:"npm install -g @ornexus/neocortex@latest"}},RATE_LIMITED:{en:{summary:"You sent too many requests in a short window.",whatHappened:"You hit the rate limit for your plan. This protects the service from abuse and keeps it fast for everyone.",whatToDo:"Wait a few seconds and try again. If you hit this often, upgrading your plan raises the limit.",url:"https://neocortex.sh/portal/plans"},"pt-BR":{summary:"Voc\xEA fez muitas requisi\xE7\xF5es em pouco tempo.",whatHappened:"O limite de taxa do seu plano foi atingido. Isso protege o servi\xE7o contra abuso e mant\xE9m a velocidade para todos.",whatToDo:"Espere alguns segundos e tente novamente. Se isso acontece com frequ\xEAncia, fazer upgrade do seu plano aumenta o limite.",url:"https://neocortex.sh/portal/plans"}},TRIGGER_NOT_ALLOWED:{en:{summary:"This command is not available on your current plan.",whatHappened:"You tried to use a trigger that requires a paid plan (Pro or Enterprise).",whatToDo:"See the full comparison and upgrade in the portal.",url:"https://neocortex.sh/portal/plans"},"pt-BR":{summary:"Este comando n\xE3o est\xE1 dispon\xEDvel no seu plano atual.",whatHappened:"Voc\xEA tentou usar um trigger que requer um plano pago (Pro ou Enterprise).",whatToDo:"Veja a compara\xE7\xE3o completa e fa\xE7a upgrade no portal.",url:"https://neocortex.sh/portal/plans"}},QUOTA_EXCEEDED:{en:{summary:"Daily quota reached.",whatHappened:"You have used all invocations allowed by your plan today. Quotas reset at midnight UTC.",whatToDo:"Wait for the daily reset, or upgrade your plan for a higher quota.",url:"https://neocortex.sh/portal/plans"},"pt-BR":{summary:"Quota di\xE1ria atingida.",whatHappened:"Voc\xEA usou todas as invoca\xE7\xF5es permitidas pelo seu plano hoje. As quotas s\xE3o resetadas \xE0 meia-noite UTC.",whatToDo:"Aguarde o reset di\xE1rio ou fa\xE7a upgrade do plano para uma quota maior.",url:"https://neocortex.sh/portal/plans"}},SERVER_ERROR:{en:{summary:"Server error.",whatHappened:"Something went wrong on our side. We have logged the error and will investigate.",whatToDo:`Try again in a minute. If the problem persists, please contact ${r} with the details.`},"pt-BR":{summary:"Erro do servidor.",whatHappened:"Algo deu errado no nosso lado. O erro foi registrado e vamos investigar.",whatToDo:`Tente novamente em um minuto. Se o problema persistir, entre em contato: ${r}.`}},ECONNREFUSED:{en:{summary:"Cannot reach the Neocortex server.",whatHappened:"We could not open a connection to the server. This is usually a network problem on your side.",whatToDo:"Check your internet connection, any VPN or corporate proxy, and try again."},"pt-BR":{summary:"N\xE3o foi poss\xEDvel alcan\xE7ar o servidor Neocortex.",whatHappened:"N\xE3o conseguimos abrir uma conex\xE3o com o servidor. Isso geralmente \xE9 um problema de rede do seu lado.",whatToDo:"Verifique sua conex\xE3o, qualquer VPN ou proxy corporativo, e tente novamente."}},MACHINE_LIMIT_EXCEEDED:{en:{summary:"Machine limit reached.",whatHappened:"Your plan allows a limited number of active machines, and this one would exceed it.",whatToDo:"Deactivate a machine you no longer use from the portal, then re-run activate here.",url:"https://neocortex.sh/portal/machines"},"pt-BR":{summary:"Limite de m\xE1quinas atingido.",whatHappened:"Seu plano permite um n\xFAmero limitado de m\xE1quinas ativas, e esta ultrapassaria o limite.",whatToDo:"Desative uma m\xE1quina que voc\xEA n\xE3o usa mais no portal e rode activate aqui de novo.",url:"https://neocortex.sh/portal/machines"}},NOT_CONFIGURED:{en:{summary:"Neocortex is not configured on this machine.",whatHappened:"No license key was found. You need to run `neocortex activate` once before using the CLI.",whatToDo:"Get a license key from the portal and activate.",command:"neocortex activate YOUR-LICENSE-KEY",url:"https://neocortex.sh/portal"},"pt-BR":{summary:"Neocortex n\xE3o est\xE1 configurado nesta m\xE1quina.",whatHappened:"Nenhuma license key encontrada. Voc\xEA precisa rodar `neocortex activate` uma vez antes de usar o CLI.",whatToDo:"Pegue uma license key no portal e ative.",command:"neocortex activate SUA-LICENSE-KEY",url:"https://neocortex.sh/portal"}}};function n(t=process.env){return(t.LC_ALL??t.LANG??"").toLowerCase().startsWith("pt")?"pt-BR":"en"}function u(t,o=n()){const e=c[t];return e?e[o]??e.en??null:null}function p(t,o=n()){const e=o==="pt-BR",a={"near-expiry":{en:"Prepare authentication outside strict read-only mode, then retry once.",pt:"Prepare a autentica\xE7\xE3o fora do modo estritamente somente leitura e tente uma vez."},expired:{en:"Prepare authentication outside strict read-only mode.",pt:"Prepare a autentica\xE7\xE3o fora do modo estritamente somente leitura."},"store-unavailable":{en:"Restore access to the local credential store; do not delete it.",pt:"Restaure o acesso ao store local; n\xE3o o apague."},"store-corrupt":{en:"Stop and recover the credential store explicitly; do not overwrite it.",pt:"Pare e recupere o store de credenciais explicitamente; n\xE3o o sobrescreva."},"keychain-unavailable":{en:"Unlock or restore the system keychain, then retry.",pt:"Desbloqueie ou restaure o keychain do sistema e tente novamente."},"transport-error":{en:"Check connectivity and retry later; the current login was preserved.",pt:"Verifique a conex\xE3o e tente depois; o login atual foi preservado."},timeout:{en:"Stop the current recovery and retry only after its outcome is known.",pt:"Pare a recupera\xE7\xE3o atual e tente novamente somente ap\xF3s conhecer o resultado."},"rate-limited":{en:"Wait for the retry window while preserving the current login.",pt:"Aguarde a janela de nova tentativa preservando o login atual."},"service-unavailable":{en:"Retry later; do not clear local authentication.",pt:"Tente novamente depois; n\xE3o limpe a autentica\xE7\xE3o local."},revoked:{en:"Re-activate with an authorized license credential.",pt:"Reative com uma credencial de licen\xE7a autorizada.",command:e?"neocortex activate SUA-LICENSE-KEY":"neocortex activate YOUR-LICENSE-KEY"},"scope-denied":{en:"Request the required scope; do not elevate it locally.",pt:"Solicite o escopo necess\xE1rio; n\xE3o o eleve localmente."},"client-denied":{en:"Stop and restore the authorized client policy.",pt:"Pare e restaure a pol\xEDtica de cliente autorizada."},"protocol-invalid":{en:"Stop and inspect the supported authentication contract.",pt:"Pare e inspecione o contrato de autentica\xE7\xE3o suportado."},"persistence-failed":{en:"Recover explicitly; do not repeat refresh or restore an older credential.",pt:"Recupere explicitamente; n\xE3o repita o refresh nem restaure uma credencial anterior."},"rotation-uncertain":{en:"Stop and recover explicitly; do not repeat refresh.",pt:"Pare e fa\xE7a recupera\xE7\xE3o expl\xEDcita; n\xE3o repita o refresh."},"capability-unavailable":{en:"Use a supported host capability; do not export credentials.",pt:"Use uma capability de host suportada; n\xE3o exporte credenciais."},"revision-conflict":{en:"Wait for the current owner and re-read the accepted generation.",pt:"Aguarde o owner atual e releia a gera\xE7\xE3o aceita."}}[t];return{summary:e?"A autentica\xE7\xE3o requer uma a\xE7\xE3o causal.":"Authentication requires a causal action.",whatHappened:e?`A causa confirmada \xE9 ${t}; nenhum segredo ou corpo bruto foi exibido.`:`The confirmed cause is ${t}; no secret or raw response body was exposed.`,whatToDo:e?a.pt:a.en,...a.command?{command:a.command}:{}}}function d(t,o=n()){const e=[];e.push(""),e.push(`[Neocortex] ${t.summary}`),e.push("");const i=o==="pt-BR"?"O que aconteceu":"What happened",a=o==="pt-BR"?"O que fazer":"What to do",s=o==="pt-BR"?`Precisa de ajuda? ${r}`:`Need help? ${r}`;return e.push(`${i}: ${t.whatHappened}`),e.push(`${a}: ${t.whatToDo}`),t.command&&(e.push(""),e.push(` ${t.command}`)),t.url&&(e.push(""),e.push(` ${t.url}`)),e.push(""),e.push(s),e.push(""),e.join(`
2
+ `)}function l(t){if(!t||typeof t!="object")return null;const o=t;return typeof o.code=="string"&&(o.code==="ECONNREFUSED"||o.code==="ENOTFOUND"||o.code==="ETIMEDOUT"||o.code==="ECONNRESET")||typeof o.message=="string"&&(/connect/i.test(o.message)&&/refus/i.test(o.message)||/fetch failed/i.test(o.message))?"ECONNREFUSED":null}export{n as detectErrorLocale,d as formatHumanizedError,p as humanizeAuthRefreshRequired,u as humanizeError,l as inferErrorCodeFromException};
@@ -9,9 +9,18 @@ export declare const FRONTMATTER_DIAGNOSTIC_CATEGORIES: readonly ["payload-selec
9
9
  export type FrontmatterDiagnosticCategory = (typeof FRONTMATTER_DIAGNOSTIC_CATEGORIES)[number];
10
10
  export declare const FRONTMATTER_DIAGNOSTIC_REASON_CODES: readonly ["payload-selection-ambiguous", "payload-selection-unavailable", "markdown-link-target-malformed", "markdown-link-target-ambiguous", "markdown-link-target-external", "markdown-link-target-unsafe-path", "raw-target-malformed", "raw-target-external", "raw-target-unsafe-path", "frontmatter-malformed", "frontmatter-oversized", "frontmatter-unsupported-value", "frontmatter-explicit-selection-required"];
11
11
  export type FrontmatterDiagnosticReasonCode = (typeof FRONTMATTER_DIAGNOSTIC_REASON_CODES)[number];
12
+ /**
13
+ * P226.04: dynamic per-field list limit code emitted by the shared frontmatter
14
+ * contract. Only known list-field names (or a fixed label) and integers can
15
+ * match, so a matching code never carries rejected values. The standalone
16
+ * client cannot import `@neocortex/shared` here; this pattern mirrors
17
+ * `FRONTMATTER_LIST_TOO_LONG_PATTERN` and is pinned by tests.
18
+ */
19
+ export type FrontmatterListTooLongDiagnosticCode = `frontmatter-list-too-long:${string}:${number}>${number}`;
20
+ export declare const FRONTMATTER_LIST_TOO_LONG_DIAGNOSTIC_PATTERN: RegExp;
12
21
  export interface PublicFrontmatterDiagnostic {
13
22
  readonly category: FrontmatterDiagnosticCategory;
14
- readonly reasonCode: FrontmatterDiagnosticReasonCode | 'frontmatter-diagnostic-unclassified';
23
+ readonly reasonCode: FrontmatterDiagnosticReasonCode | FrontmatterListTooLongDiagnosticCode | 'frontmatter-diagnostic-unclassified';
15
24
  readonly summary: string;
16
25
  readonly remediation: string;
17
26
  readonly example?: string;
@@ -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
- }
1
+ const d=["payload-selection","target-normalization","metadata-frontmatter"],c=["payload-selection-ambiguous","payload-selection-unavailable","markdown-link-target-malformed","markdown-link-target-ambiguous","markdown-link-target-external","markdown-link-target-unsafe-path","raw-target-malformed","raw-target-external","raw-target-unsafe-path","frontmatter-malformed","frontmatter-oversized","frontmatter-unsupported-value","frontmatter-explicit-selection-required"],i=/^frontmatter-list-too-long:(files_to_modify|depends_on|related_epics|unlisted-field):[0-9]{1,6}>[0-9]{1,6}$/,a="*yoloop @docs/epics/epic-P204.md",r="docs/epics/epic-P204.md",n=Object.freeze({"payload-selection-ambiguous":Object.freeze({category:"payload-selection",summary:"The explicit Neocortex command could not be selected unambiguously.",remediation:"Pass exactly one explicit trigger and its project-local arguments; keep host wrapper metadata outside the selected payload."}),"payload-selection-unavailable":Object.freeze({category:"payload-selection",summary:"The explicit Neocortex command could not be selected safely.",remediation:"Retry with one explicit trigger. Do not include wrapper frontmatter, conversation history or delegated prompt text."}),"markdown-link-target-malformed":Object.freeze({category:"target-normalization",summary:"The Markdown target is malformed or is not a supported Markdown path.",remediation:"Use one complete Markdown link to a project-relative .md file or a trailing-slash directory.",example:a}),"markdown-link-target-ambiguous":Object.freeze({category:"target-normalization",summary:"More than one target or mixed target syntax was supplied.",remediation:"Pass exactly one raw path or one Markdown link target.",example:a}),"markdown-link-target-external":Object.freeze({category:"target-normalization",summary:"External Markdown targets are not supported.",remediation:"Reference a file already inside the project with a project-relative path.",example:a}),"markdown-link-target-unsafe-path":Object.freeze({category:"target-normalization",summary:"The Markdown target is outside the supported project-relative path boundary.",remediation:"Remove absolute, home, drive, backslash or traversal segments and use a project-relative path.",example:a}),"raw-target-malformed":Object.freeze({category:"target-normalization",summary:"The raw target is not a supported Markdown path.",remediation:"Use one project-relative .md file or a trailing-slash directory.",example:a}),"raw-target-external":Object.freeze({category:"target-normalization",summary:"External raw targets are not supported.",remediation:"Reference a file already inside the project with a project-relative path.",example:a}),"raw-target-unsafe-path":Object.freeze({category:"target-normalization",summary:"The raw target is outside the supported project-relative path boundary.",remediation:"Remove absolute, home, drive, backslash or traversal segments and use a project-relative path.",example:a}),"frontmatter-malformed":Object.freeze({category:"metadata-frontmatter",summary:"The leading YAML frontmatter envelope is malformed.",remediation:"Repair the bounded leading --- envelope and keep generated metadata fields scalar or string-list values.",example:r}),"frontmatter-oversized":Object.freeze({category:"metadata-frontmatter",summary:"The leading YAML frontmatter exceeds the public parsing limits.",remediation:"Reduce the metadata header and keep descriptive content in the Markdown body.",example:r}),"frontmatter-unsupported-value":Object.freeze({category:"metadata-frontmatter",summary:"A frontmatter field uses an unsupported value shape.",remediation:"Use allowlisted scalar fields and bounded string lists only.",example:r}),"frontmatter-explicit-selection-required":Object.freeze({category:"metadata-frontmatter",summary:"Target metadata cannot be projected before explicit file selection.",remediation:"Select one project-relative epic or story target before metadata discovery.",example:r})}),m=Object.freeze({category:"metadata-frontmatter",reasonCode:"frontmatter-diagnostic-unclassified",summary:"The frontmatter operation could not be classified safely.",remediation:"Retry with one explicit project-relative target and a bounded YAML header.",example:r}),l=Object.freeze({category:"metadata-frontmatter",summary:"A frontmatter list exceeds its per-field item limit; the code reports the field, the item count and the limit.",remediation:"Trim the list to the reported limit (files_to_modify allows 256 items, other lists allow 32) and keep descriptive content in the Markdown body.",example:r});function s(t){if(typeof t=="string"&&i.test(t))return Object.freeze({reasonCode:t,...l});const e=n[t];return e?Object.freeze({reasonCode:t,...e}):m}function p(t){const e=s(t),o=e.example?` Example: ${e.example}.`:"";return`${e.reasonCode} [${e.category}]: ${e.summary} Remediation: ${e.remediation}${o}`}export{d as FRONTMATTER_DIAGNOSTIC_CATEGORIES,c as FRONTMATTER_DIAGNOSTIC_REASON_CODES,i as FRONTMATTER_LIST_TOO_LONG_DIAGNOSTIC_PATTERN,p as formatFrontmatterDiagnostic,s as getFrontmatterDiagnostic};