@ornexus/neocortex 4.60.72 → 4.60.73

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 (243) hide show
  1. package/dist/release-source.json +1 -1
  2. package/dist/sbom.cdx.json +24 -24
  3. package/install.ps1 +1 -1
  4. package/install.sh +1 -1
  5. package/package.json +2 -2
  6. package/packages/client/dist/adapters/adapter-registry.js +108 -1
  7. package/packages/client/dist/adapters/antigravity-adapter.js +77 -2
  8. package/packages/client/dist/adapters/claude-code-adapter.js +79 -3
  9. package/packages/client/dist/adapters/codex-adapter.js +80 -2
  10. package/packages/client/dist/adapters/cursor-adapter.js +115 -4
  11. package/packages/client/dist/adapters/gemini-adapter.js +71 -2
  12. package/packages/client/dist/adapters/grok-adapter.js +42 -2
  13. package/packages/client/dist/adapters/index.js +22 -1
  14. package/packages/client/dist/adapters/platform-detector.js +212 -1
  15. package/packages/client/dist/adapters/target-adapter.js +12 -0
  16. package/packages/client/dist/adapters/vscode-adapter.js +72 -2
  17. package/packages/client/dist/agent/refresh-stubs.js +417 -2
  18. package/packages/client/dist/agent/update-agent-yaml.js +102 -1
  19. package/packages/client/dist/agent/update-description.js +251 -1
  20. package/packages/client/dist/cache/crypto-utils.js +78 -1
  21. package/packages/client/dist/cache/encrypted-cache.js +108 -1
  22. package/packages/client/dist/cache/in-memory-asset-cache.js +73 -1
  23. package/packages/client/dist/cache/index.js +13 -1
  24. package/packages/client/dist/cache/protected-pi-boundary.js +44 -1
  25. package/packages/client/dist/checkpoint/checkpoint-client-reader.js +127 -2
  26. package/packages/client/dist/checkpoint/index.js +11 -1
  27. package/packages/client/dist/checkpoint/shared-checkpoint-types.js +32 -1
  28. package/packages/client/dist/cli.js +358 -5
  29. package/packages/client/dist/commands/activate.js +394 -8
  30. package/packages/client/dist/commands/architecture-answers.js +274 -7
  31. package/packages/client/dist/commands/architecture-memory-terminal.js +253 -4
  32. package/packages/client/dist/commands/architecture-non-ui-continuation.js +100 -1
  33. package/packages/client/dist/commands/architecture-root-binding.js +51 -1
  34. package/packages/client/dist/commands/cache-status.js +112 -2
  35. package/packages/client/dist/commands/config.js +88 -1
  36. package/packages/client/dist/commands/doctor.js +635 -2
  37. package/packages/client/dist/commands/invoke.js +7200 -143
  38. package/packages/client/dist/commands/legacy-epic-terminal.js +71 -1
  39. package/packages/client/dist/commands/legacy-story-branch.js +96 -1
  40. package/packages/client/dist/commands/legacy-story-pr.js +276 -1
  41. package/packages/client/dist/commands/mutation-qa-checkpoint.js +285 -5
  42. package/packages/client/dist/commands/mutation-qa-gate.js +54 -1
  43. package/packages/client/dist/commands/mutation-qa-git.js +41 -1
  44. package/packages/client/dist/commands/mutation-qa-policy.js +102 -1
  45. package/packages/client/dist/commands/mutation-qa-run.js +219 -3
  46. package/packages/client/dist/commands/mutation-qa-verdict.js +149 -1
  47. package/packages/client/dist/commands/mutation-qa.js +220 -1
  48. package/packages/client/dist/commands/native-agent.js +136 -2
  49. package/packages/client/dist/commands/planning-diagnosis.js +43 -1
  50. package/packages/client/dist/commands/planning-generation.js +53 -1
  51. package/packages/client/dist/commands/planning-memory.js +40 -1
  52. package/packages/client/dist/commands/planning-research.js +42 -1
  53. package/packages/client/dist/commands/private-session.js +75 -1
  54. package/packages/client/dist/commands/property-qa.js +139 -1
  55. package/packages/client/dist/commands/qa-control.js +16 -1
  56. package/packages/client/dist/commands/qa-scan-browser-launch.js +55 -1
  57. package/packages/client/dist/commands/qa-scan-browser-route.js +28 -1
  58. package/packages/client/dist/commands/qa-scan-capture.js +663 -5
  59. package/packages/client/dist/commands/qa-scan-discovery.js +376 -3
  60. package/packages/client/dist/commands/qa-scan-review.js +826 -5
  61. package/packages/client/dist/commands/qa-synthetic-backend-capture.js +266 -1
  62. package/packages/client/dist/commands/qa-synthetic-backend-review.js +297 -1
  63. package/packages/client/dist/commands/qa-synthetic-backend.js +340 -2
  64. package/packages/client/dist/commands/qa-synthetic-broker-port.js +85 -1
  65. package/packages/client/dist/commands/qa-synthetic-browser.js +39 -1
  66. package/packages/client/dist/commands/refactor-characterization.js +671 -21
  67. package/packages/client/dist/commands/refactor-commit.js +399 -13
  68. package/packages/client/dist/commands/refactor-control.js +142 -3
  69. package/packages/client/dist/commands/refactor-cpp-assertions.js +93 -3
  70. package/packages/client/dist/commands/refactor-review.js +283 -5
  71. package/packages/client/dist/commands/refactor-root.js +588 -7
  72. package/packages/client/dist/commands/refresh-memory.js +156 -3
  73. package/packages/client/dist/commands/shared-architecture-non-ui.js +24 -1
  74. package/packages/client/dist/commands/story-checkpoint.js +171 -1
  75. package/packages/client/dist/config/profile-directory.js +13 -1
  76. package/packages/client/dist/config/resolver-selection.js +278 -1
  77. package/packages/client/dist/config/secure-config.js +281 -12
  78. package/packages/client/dist/config.js +223 -2
  79. package/packages/client/dist/constants.js +25 -1
  80. package/packages/client/dist/context/context-collector.js +222 -2
  81. package/packages/client/dist/context/context-sanitizer.js +145 -1
  82. package/packages/client/dist/continuity/autonomous-governance.js +285 -1
  83. package/packages/client/dist/continuity/continuity-client-state-store.js +1587 -1
  84. package/packages/client/dist/continuity/invoke-hooks.js +129 -1
  85. package/packages/client/dist/continuity/migrations/001-initial-schema.js +12 -2
  86. package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +12 -2
  87. package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +12 -2
  88. package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +12 -2
  89. package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +12 -2
  90. package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +10 -2
  91. package/packages/client/dist/continuity/native-agent-store.js +69 -1
  92. package/packages/client/dist/continuity/native-agent-types.js +90 -1
  93. package/packages/client/dist/continuity/outbox.js +117 -1
  94. package/packages/client/dist/continuity/runner-bootstrap-policy.js +172 -1
  95. package/packages/client/dist/continuity/sqlite-store.d.ts +22 -1
  96. package/packages/client/dist/continuity/sqlite-store.js +2612 -81
  97. package/packages/client/dist/effects/invoke-effect-gateways.js +62 -1
  98. package/packages/client/dist/errors/error-messages.js +228 -2
  99. package/packages/client/dist/errors/frontmatter-diagnostics.js +125 -1
  100. package/packages/client/dist/evidence/collector.js +347 -1
  101. package/packages/client/dist/evidence/index.js +1 -1
  102. package/packages/client/dist/evidence/types.js +2 -0
  103. package/packages/client/dist/fs/atomic-state-replace.js +152 -1
  104. package/packages/client/dist/generated/command-registry.generated.js +4076 -1
  105. package/packages/client/dist/generated/public-projections.generated.js +149 -1
  106. package/packages/client/dist/git/direct-yolo-c01-retry.js +138 -4
  107. package/packages/client/dist/git/direct-yolo-checkpoint.js +1234 -4
  108. package/packages/client/dist/git/epic-operational-state.d.ts +198 -0
  109. package/packages/client/dist/git/epic-operational-state.js +672 -0
  110. package/packages/client/dist/git/git-lifecycle-step-ids.js +14 -1
  111. package/packages/client/dist/git/git-lifecycle-store.d.ts +9 -1
  112. package/packages/client/dist/git/git-lifecycle-store.js +1981 -9
  113. package/packages/client/dist/git/legacy-story-branch-checkpoint.js +259 -9
  114. package/packages/client/dist/git/legacy-story-branch-setup.js +348 -4
  115. package/packages/client/dist/git/legacy-story-pr.js +3538 -70
  116. package/packages/client/dist/git/secure-filesystem-boundary.js +182 -5
  117. package/packages/client/dist/graph-retrieval/pre-command-hook.js +284 -1
  118. package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +237 -1
  119. package/packages/client/dist/i18n/first-run.js +60 -2
  120. package/packages/client/dist/index.js +47 -1
  121. package/packages/client/dist/invocation/invoke-input.js +24 -1
  122. package/packages/client/dist/license/index.js +5 -1
  123. package/packages/client/dist/license/license-client.js +304 -1
  124. package/packages/client/dist/machine/fingerprint.js +163 -2
  125. package/packages/client/dist/machine/index.js +5 -1
  126. package/packages/client/dist/memory/project-memory-path-scope.js +62 -1
  127. package/packages/client/dist/memory/project-memory-writer.js +1007 -40
  128. package/packages/client/dist/memory/shared-project-memory-types.js +253 -2
  129. package/packages/client/dist/migrations/epic-lifecycle-backfill.d.ts +97 -0
  130. package/packages/client/dist/migrations/epic-lifecycle-backfill.js +1060 -0
  131. package/packages/client/dist/migrations/project-identity-capability.js +50 -1
  132. package/packages/client/dist/migrations/project-identity.js +493 -7
  133. package/packages/client/dist/migrations/state-json.d.ts +22 -0
  134. package/packages/client/dist/migrations/state-json.js +393 -4
  135. package/packages/client/dist/policy/architecture-policy.js +184 -2
  136. package/packages/client/dist/policy/index.js +7 -1
  137. package/packages/client/dist/policy/shared-policy-types.js +38 -0
  138. package/packages/client/dist/policy/subagent-approval-policy.js +55 -1
  139. package/packages/client/dist/private-execution/clean-baseline.js +279 -2
  140. package/packages/client/dist/private-execution/codex-executor.js +574 -4
  141. package/packages/client/dist/private-execution/codex-host-runtime.js +137 -1
  142. package/packages/client/dist/private-execution/codex-lifecycle-guard.js +97 -1
  143. package/packages/client/dist/private-execution/codex-scoped-permissions.js +128 -1
  144. package/packages/client/dist/private-execution/delivery.js +410 -13
  145. package/packages/client/dist/private-execution/diagnosis-root-review.js +294 -2
  146. package/packages/client/dist/private-execution/frozen-handoff.js +19 -6
  147. package/packages/client/dist/private-execution/implementation-validation.js +106 -2
  148. package/packages/client/dist/private-execution/isolated-admission.js +1432 -23
  149. package/packages/client/dist/private-execution/isolated-session.js +725 -5
  150. package/packages/client/dist/private-execution/isolated-workspace.js +122 -1
  151. package/packages/client/dist/private-execution/pact-consumer-runtime.js +409 -3
  152. package/packages/client/dist/private-execution/pact-test-source.js +258 -1
  153. package/packages/client/dist/private-execution/pact-toolchain.js +290 -3
  154. package/packages/client/dist/private-execution/pact-write-set.js +172 -1
  155. package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +406 -5
  156. package/packages/client/dist/private-execution/planning-generation-checkpoint.js +462 -5
  157. package/packages/client/dist/private-execution/planning-memory-checkpoint.js +139 -3
  158. package/packages/client/dist/private-execution/planning-research-checkpoint.js +325 -4
  159. package/packages/client/dist/private-execution/private-report-store.js +42 -1
  160. package/packages/client/dist/private-execution/property-test-candidate.js +103 -1
  161. package/packages/client/dist/private-execution/property-test-choices.js +147 -3
  162. package/packages/client/dist/private-execution/property-test-plan.js +271 -7
  163. package/packages/client/dist/private-execution/property-test-review.js +258 -4
  164. package/packages/client/dist/private-execution/property-test-runtime.js +372 -9
  165. package/packages/client/dist/private-execution/property-test-source.js +139 -1
  166. package/packages/client/dist/private-execution/root-checkpoint.js +80 -1
  167. package/packages/client/dist/private-execution/root-memory-git-evidence.js +135 -3
  168. package/packages/client/dist/private-execution/root-memory-recovery.js +93 -1
  169. package/packages/client/dist/private-execution/root-memory-request.js +29 -1
  170. package/packages/client/dist/private-execution/root-memory-scope.js +178 -1
  171. package/packages/client/dist/private-execution/root-memory-writer.js +102 -1
  172. package/packages/client/dist/private-execution/session-lease.js +63 -1
  173. package/packages/client/dist/private-execution/shared-private-admission-types.js +50 -1
  174. package/packages/client/dist/private-execution/shared-project-validation.js +66 -1
  175. package/packages/client/dist/private-execution/shared-root-memory-types.js +61 -1
  176. package/packages/client/dist/private-execution/ux-source-validation.js +372 -1
  177. package/packages/client/dist/private-execution/ux-write-set.js +191 -2
  178. package/packages/client/dist/registry/registry-reconciliation.js +234 -1
  179. package/packages/client/dist/resilience/circuit-breaker.js +170 -1
  180. package/packages/client/dist/resilience/degradation-manager.js +164 -1
  181. package/packages/client/dist/resilience/freshness-indicator.js +100 -1
  182. package/packages/client/dist/resilience/index.js +8 -1
  183. package/packages/client/dist/resilience/recovery-detector.js +74 -1
  184. package/packages/client/dist/resolvers/asset-resolver.js +13 -0
  185. package/packages/client/dist/resolvers/local-resolver.js +255 -8
  186. package/packages/client/dist/resolvers/remote-resolver.js +233 -1
  187. package/packages/client/dist/runner/binary.js +404 -1
  188. package/packages/client/dist/runner/cli.js +1571 -17
  189. package/packages/client/dist/runner/headless/adapters.js +49 -1
  190. package/packages/client/dist/runner/headless/claude-code-adapter.js +79 -1
  191. package/packages/client/dist/runner/headless/continuous-story-workspace.js +1628 -11
  192. package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +69 -1
  193. package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +110 -2
  194. package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +1236 -8
  195. package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +318 -2
  196. package/packages/client/dist/runner/headless/fake-adapter.js +62 -1
  197. package/packages/client/dist/runner/headless/managed-profile.js +132 -1
  198. package/packages/client/dist/runner/headless/opencode-adapter.js +145 -2
  199. package/packages/client/dist/runner/headless/prepared-story-bundle.js +43 -1
  200. package/packages/client/dist/runner/headless/resolver.js +231 -1
  201. package/packages/client/dist/runner/headless/run-yolo.js +885 -1
  202. package/packages/client/dist/runner/headless/run-yoloop.js +2574 -2
  203. package/packages/client/dist/runner/headless/types.js +574 -2
  204. package/packages/client/dist/runner/local-console.js +396 -13
  205. package/packages/client/dist/runner/portal-sync-worker.js +1487 -1
  206. package/packages/client/dist/runner/project-identity.js +106 -1
  207. package/packages/client/dist/runner/scheduler.js +995 -7
  208. package/packages/client/dist/runner-cli.js +18 -2
  209. package/packages/client/dist/state/invocation-shape.js +13 -1
  210. package/packages/client/dist/state/project-state-snapshot.d.ts +8 -0
  211. package/packages/client/dist/state/project-state-snapshot.js +1731 -1
  212. package/packages/client/dist/state/state-json-repair.js +785 -3
  213. package/packages/client/dist/state/structural-dag-projection.js +118 -1
  214. package/packages/client/dist/telemetry/index.js +5 -1
  215. package/packages/client/dist/telemetry/offline-queue.js +131 -1
  216. package/packages/client/dist/tier/index.js +5 -1
  217. package/packages/client/dist/tier/tier-aware-client.js +405 -1
  218. package/packages/client/dist/types/index.js +38 -1
  219. package/packages/client/dist/version.js +27 -1
  220. package/packages/client/dist/yolo/change-evidence-collector.js +126 -1
  221. package/packages/client/dist/yolo/invoke-envelope-capability.js +62 -1
  222. package/packages/client/dist/yolo/spec-envelope-collector.js +184 -5
  223. package/packages/client/dist/yoloop/discovery-hook.js +300 -2
  224. package/packages/client/dist/yoloop/index.js +8 -1
  225. package/packages/client/dist/yoloop/invoke-hooks.js +669 -12
  226. package/packages/client/dist/yoloop/shared-discover-epics.js +1007 -1
  227. package/packages/client/dist/yoloop/shared-yoloop-types.d.ts +65 -1
  228. package/packages/client/dist/yoloop/shared-yoloop-types.js +33 -1
  229. package/packages/client/dist/yoloop/target-normalization.js +180 -1
  230. package/packages/client/dist/yoloop/yoloop-client-state-store.d.ts +8 -0
  231. package/packages/client/dist/yoloop/yoloop-client-state-store.js +1920 -1
  232. package/packages/shared/dist/yolo/spec-envelope.js +3 -6
  233. package/targets-stubs/antigravity/gemini.md +1 -1
  234. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  235. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  236. package/targets-stubs/claude-code/neocortex-root.md +2 -2
  237. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  238. package/targets-stubs/claude-code/neocortex.md +2 -2
  239. package/targets-stubs/codex/AGENTS.md +1 -1
  240. package/targets-stubs/cursor/agent.md +2 -2
  241. package/targets-stubs/gemini-cli/agent.md +2 -2
  242. package/targets-stubs/opencode/neocortex-root.md +1 -1
  243. package/targets-stubs/vscode/neocortex.agent.md +2 -2
@@ -1 +1,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
+ 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
- const t="support@neocortex.sh",u={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 ${t} 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: ${t}.`}},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 r(o=process.env){return(o.LC_ALL??o.LANG??"").toLowerCase().startsWith("pt")?"pt-BR":"en"}function p(o,a=r()){const e=u[o];return e?e[a]??e.en??null:null}function c(o,a=r()){const e=[];e.push(""),e.push(`[Neocortex] ${o.summary}`),e.push("");const n=a==="pt-BR"?"O que aconteceu":"What happened",s=a==="pt-BR"?"O que fazer":"What to do",i=a==="pt-BR"?`Precisa de ajuda? ${t}`:`Need help? ${t}`;return e.push(`${n}: ${o.whatHappened}`),e.push(`${s}: ${o.whatToDo}`),o.command&&(e.push(""),e.push(` ${o.command}`)),o.url&&(e.push(""),e.push(` ${o.url}`)),e.push(""),e.push(i),e.push(""),e.join(`
2
- `)}function m(o){if(!o||typeof o!="object")return null;const a=o;return typeof a.code=="string"&&(a.code==="ECONNREFUSED"||a.code==="ENOTFOUND"||a.code==="ETIMEDOUT"||a.code==="ECONNRESET")||typeof a.message=="string"&&(/connect/i.test(a.message)&&/refus/i.test(a.message)||/fetch failed/i.test(a.message))?"ECONNREFUSED":null}export{r as detectErrorLocale,c as formatHumanizedError,p as humanizeError,m as inferErrorCodeFromException};
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
- const l=["payload-selection","target-normalization","metadata-frontmatter"],d=["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"],t="*yoloop @docs/epics/epic-P204.md",a="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:t}),"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:t}),"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:t}),"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:t}),"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:t}),"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:t}),"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:t}),"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:a}),"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:a}),"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:a}),"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:a})}),i=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:a});function m(r){const e=n[r];return e?Object.freeze({reasonCode:r,...e}):i}function s(r){const e=m(r),o=e.example?` Example: ${e.example}.`:"";return`${e.reasonCode} [${e.category}]: ${e.summary} Remediation: ${e.remediation}${o}`}export{l as FRONTMATTER_DIAGNOSTIC_CATEGORIES,d as FRONTMATTER_DIAGNOSTIC_REASON_CODES,s as formatFrontmatterDiagnostic,m as getFrontmatterDiagnostic};
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
+ }