@ornexus/neocortex 4.66.49 → 4.66.51

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 (45) hide show
  1. package/dist/release-source.json +1 -1
  2. package/dist/sbom.cdx.json +1191 -1191
  3. package/install.js +8 -8
  4. package/install.ps1 +188 -162
  5. package/install.sh +1 -1
  6. package/package.json +2 -2
  7. package/packages/client/dist/commands/activate.js +6 -7
  8. package/packages/client/dist/commands/invoke.js +82 -82
  9. package/packages/client/dist/config/secure-config.d.ts +4 -0
  10. package/packages/client/dist/config/secure-config.js +6 -6
  11. package/packages/client/dist/git/git-lifecycle-store.d.ts +3 -1
  12. package/packages/client/dist/git/git-lifecycle-store.js +8 -8
  13. package/packages/client/dist/git/story-worktree-manager.d.ts +2 -0
  14. package/packages/client/dist/git/story-worktree-manager.js +3 -3
  15. package/packages/client/dist/migrations/project-identity.d.ts +3 -0
  16. package/packages/client/dist/migrations/project-identity.js +7 -7
  17. package/packages/client/dist/private-execution/isolated-admission.js +11 -11
  18. package/packages/client/dist/private-execution/isolated-workspace.js +1 -1
  19. package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +5 -5
  20. package/packages/client/dist/private-execution/planning-memory-checkpoint.js +3 -3
  21. package/packages/client/dist/runner/headless/run-yoloop.d.ts +2 -0
  22. package/packages/client/dist/runner/headless/run-yoloop.js +4 -4
  23. package/packages/shared/dist/invocation/semantic-gate-remediation.d.ts +45 -0
  24. package/packages/shared/dist/invocation/semantic-gate-remediation.js +51 -0
  25. package/targets-stubs/antigravity/gemini.md +1 -1
  26. package/targets-stubs/antigravity/neocortex.md +1 -1
  27. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  28. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  29. package/targets-stubs/claude-code/neocortex-root.md +2 -2
  30. package/targets-stubs/claude-code/neocortex-sentinel.md +1 -1
  31. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  32. package/targets-stubs/claude-code/neocortex.md +2 -2
  33. package/targets-stubs/codex/AGENTS.md +1 -1
  34. package/targets-stubs/codex/neocortex.toml +1 -1
  35. package/targets-stubs/cursor/agent.md +2 -2
  36. package/targets-stubs/deepseek-harness/SKILL.md +1 -1
  37. package/targets-stubs/gemini-cli/agent.md +2 -2
  38. package/targets-stubs/gemini-cli/agents/neocortex.md +2 -2
  39. package/targets-stubs/grok/SKILL.md +1 -1
  40. package/targets-stubs/kimi/neocortex.md +1 -1
  41. package/targets-stubs/lib/managed-config-merge.js +12 -4
  42. package/targets-stubs/openclaw/SKILL.md +1 -1
  43. package/targets-stubs/opencode/neocortex-root.md +2 -2
  44. package/targets-stubs/opencode/neocortex.md +2 -2
  45. package/targets-stubs/vscode/neocortex.agent.md +2 -2
@@ -1,7 +1,6 @@
1
- import{existsSync as V,mkdirSync as x,writeFileSync as $,readFileSync as I}from"node:fs";import{join as a,dirname as C}from"node:path";import{homedir as X}from"node:os";import{fileURLToPath as Y}from"node:url";import{LicenseClient as w}from"../license/license-client.js";import{EncryptedCache as E}from"../cache/encrypted-cache.js";import{getMachineFingerprint as P}from"../machine/fingerprint.js";import{refreshStubs as l}from"../agent/refresh-stubs.js";import{saveSecureConfig as W,setSecureDirPermissions as S}from"../config/secure-config.js";import{DEFAULT_SERVER_URL as G}from"../constants.js";function N(){try{const e=Y(import.meta.url);let t=C(e);for(let r=0;r<5;r++){try{const n=JSON.parse(I(a(t,"package.json"),"utf-8"));if(n.name==="@ornexus/neocortex"||n.name==="@neocortex/client")return n.version??"0.0.0"}catch{}t=C(t)}}catch{}return"0.0.0"}const i=a(X(),".neocortex"),o=a(i,"config.json"),J=/^NX-(F|P|E)-[a-f0-9]+-[a-f0-9]+$/i,z=/^nxk_(?:[a-z]+_)?[a-f0-9]+_[a-f0-9]+$/;function q(e){if(!e||e.trim().length===0)return{valid:!1,error:"License key cannot be empty"};const t=e.trim().toUpperCase();return t.startsWith("NX-")?J.test(t)?{valid:!0}:{valid:!1,error:"Invalid license key format. Expected: NX-{TIER}-{ID} (e.g., NX-PRO-ABC-123)"}:{valid:!1,error:'License key must start with "NX-"'}}function B(e){if(!e||e.trim().length===0)return{valid:!1,error:"API key cannot be empty"};const t=e.trim();return t.startsWith("nxk_")?t.length<20?{valid:!1,error:"API key is too short"}:z.test(t)?{valid:!0}:{valid:!1,error:"Invalid API key format. Expected: nxk_{id}_{check} (e.g., nxk_abc123def456...)"}:{valid:!1,error:'API key must start with "nxk_"'}}function ue(){try{if(V(o)){const e=I(o,"utf-8");return JSON.parse(e)}}catch{}return null}function A(e){x(i,{recursive:!0}),S(i);const t=a(i,"cache");if(x(t,{recursive:!0}),S(t),e.licenseKey||e.apiKey)W({serverUrl:e.serverUrl,mode:e.mode,machineId:e.machineId,activatedAt:e.activatedAt,tier:e.tier,licenseKey:e.licenseKey??e.apiKey});else{const r={configVersion:1,...e};$(o,JSON.stringify(r,null,2)+`
2
- `,"utf-8")}}async function fe(e){const{licenseKey:t,serverUrl:r=G}=e;if(!t)return{success:!1,message:["No key provided.","","Get your license key at https://neocortex.sh/portal/login","","Usage:"," neocortex activate YOUR-LICENSE-KEY"," neocortex activate YOUR-API-KEY"].join(`
3
- `)};const n=t.trim();if(n.startsWith("nxk_")){const s=B(n);if(!s.valid)return{success:!1,message:`Invalid API key: ${s.error}`};const v=n.match(/^nxk_(free|pro|ent)_/),D={free:"free",pro:"pro",ent:"enterprise"},L=v?.[1]?D[v[1]]??"unknown":"unknown",O=P(),u=N(),T=a(i,"cache"),j=new E({cacheDir:T,passphrase:n}),y=await new w({serverUrl:r,licenseKey:n,cacheProvider:j,clientVersion:u,causalAuthRecovery:!0}).activate();if(!y)return{success:!1,message:"API key activation failed. Run neocortex-client auth-doctor --format plain and retry only after the reported cause is resolved."};const g=y.tier??L,M={serverUrl:r,mode:"remote",machineId:O,activatedAt:new Date().toISOString(),tier:g,apiKey:n};try{A(M)}catch(k){return{success:!1,message:`Failed to save configuration: ${k instanceof Error?k.message:"unknown error"}`}}return{success:!0,message:["Neocortex activated successfully.","","Open your preferred platform (Claude Code, Cursor, VS Code, etc.)","and reference the Neocortex agent.",...l(u,{forceCreate:!0,targetFilter:"claude-code"})+l(u)>0?["","Managed agent wrappers were refreshed while preserving existing Markdown frontmatter and unrelated platform files."]:[],"","Use *menu to see available commands or check the Docs in your Dashboard."].join(`
4
- `),tier:g,serverUrl:r,configPath:o}}const f=q(n);if(!f.valid)return{success:!1,message:`Invalid license key: ${f.error}`};const c=n,m=c.match(/^NX-(F|P|E)-/i),K={F:"free",P:"pro",E:"enterprise"},R=m?.[1]?K[m[1].toUpperCase()]??"unknown":"unknown",_=a(i,"cache"),b=new E({cacheDir:_,passphrase:c}),F=new w({serverUrl:r,licenseKey:c,cacheProvider:b});let d;try{d=await F.activate()}catch{return{success:!1,message:["Failed to connect to IP Protection Server.","","Possible causes:",` - Server at ${r} is unreachable`," - Network connectivity issue"," - Server is still being deployed","","Workaround: Use --local flag to run in local mode"].join(`
5
- `)}}if(!d)return{success:!1,message:["License activation failed.","","Possible causes:"," - Invalid or expired license key"," - License already activated on another machine"," - Server rejected the activation request","","Check your license key and try again.","Contact support if the problem persists."].join(`
6
- `)};const p=d.tier??R,U={serverUrl:r,mode:"remote",machineId:P(),activatedAt:new Date().toISOString(),tier:p,licenseKey:c};try{A(U)}catch(s){return{success:!1,message:`Failed to save config to ${o}: ${s instanceof Error?s.message:String(s)}`}}const h=N();return{success:!0,message:["Neocortex activated successfully.","","Open your preferred platform (Claude Code, Cursor, VS Code, etc.)","and reference the Neocortex agent.",...l(h,{forceCreate:!0,targetFilter:"claude-code"})+l(h)>0?["","Managed agent wrappers were refreshed while preserving existing Markdown frontmatter and unrelated platform files."]:[],"","Use *menu to see available commands or check the Docs in your Dashboard."].join(`
7
- `),tier:p,serverUrl:r,configPath:o}}export{fe as activate,B as validateApiKeyFormat,q as validateLicenseKeyFormat};
1
+ import{readFileSync as M}from"node:fs";import{join as a,dirname as y}from"node:path";import{fileURLToPath as G}from"node:url";import{LicenseClient as g}from"../license/license-client.js";import{EncryptedCache as I}from"../cache/encrypted-cache.js";import{getMachineFingerprint as E}from"../machine/fingerprint.js";import{refreshStubs as c}from"../agent/refresh-stubs.js";import{saveSecureConfig as k,SecureConfigError as Y}from"../config/secure-config.js";import{neocortexProfileDirectory as $}from"../config/profile-directory.js";import{DEFAULT_SERVER_URL as V}from"../constants.js";function C(){try{const e=G(import.meta.url);let t=y(e);for(let r=0;r<5;r++){try{const n=JSON.parse(M(a(t,"package.json"),"utf-8"));if(n.name==="@ornexus/neocortex"||n.name==="@neocortex/client")return n.version??"0.0.0"}catch{}t=y(t)}}catch{}return"0.0.0"}const l=$(),x=a(l,"config.json"),W=/^NX-(F|P|E)-[a-f0-9]+-[a-f0-9]+$/i,X=/^nxk_(?:[a-z]+_)?[a-f0-9]+_[a-f0-9]+$/;function H(e){if(!e||e.trim().length===0)return{valid:!1,error:"License key cannot be empty"};const t=e.trim().toUpperCase();return t.startsWith("NX-")?W.test(t)?{valid:!0}:{valid:!1,error:"Invalid license key format. Expected: NX-{TIER}-{ID} (e.g., NX-PRO-ABC-123)"}:{valid:!1,error:'License key must start with "NX-"'}}function z(e){if(!e||e.trim().length===0)return{valid:!1,error:"API key cannot be empty"};const t=e.trim();return t.startsWith("nxk_")?t.length<20?{valid:!1,error:"API key is too short"}:X.test(t)?{valid:!0}:{valid:!1,error:"Invalid API key format. Expected: nxk_{id}_{check} (e.g., nxk_abc123def456...)"}:{valid:!1,error:'API key must start with "nxk_"'}}function _(e){if(e instanceof Y){const r=e.code==="AUTH_PROFILE_CONFIG_CHANGED"?"Close concurrent Neocortex operations and retry the same activation.":"Check the existing profile configuration with support before retrying activation.";return{success:!1,message:`${e.code} \u2014 ${r}`}}const t=e?.code;return t==="EACCES"||t==="EPERM"||t==="EBUSY"?{success:!1,message:"AUTH_PROFILE_CONFIG_WRITE_DENIED \u2014 Use the account that owns your Neocortex profile. Close applications using its config.json and verify write access before retrying the same activation."}:{success:!1,message:"AUTH_PROFILE_CONFIG_WRITE_FAILED \u2014 Check the profile directory and available disk space before retrying."}}function P(e){return process.platform==="win32"?c(e):c(e,{forceCreate:!0,targetFilter:"claude-code"})+c(e)}async function le(e){const{licenseKey:t,serverUrl:r=V}=e;if(!t)return{success:!1,message:["No key provided.","","Get your license key at https://neocortex.sh/portal/login","","Usage:"," neocortex activate YOUR-LICENSE-KEY"," neocortex activate YOUR-API-KEY"].join(`
2
+ `)};const n=t.trim();if(n.startsWith("nxk_")){const s=z(n);if(!s.valid)return{success:!1,message:`Invalid API key: ${s.error}`};const m=n.match(/^nxk_(free|pro|ent)_/),U={free:"free",pro:"pro",ent:"enterprise"},D=m?.[1]?U[m[1]]??"unknown":"unknown",L=E(),p=C(),O=a(l,"cache"),K=new I({cacheDir:O,passphrase:n}),h=await new g({serverUrl:r,licenseKey:n,cacheProvider:K,clientVersion:p,causalAuthRecovery:!0}).activate();if(!h)return{success:!1,message:"API key activation failed. Run neocortex-client auth-doctor --format plain and retry only after the reported cause is resolved."};const v=h.tier??D,T={serverUrl:r,mode:"remote",machineId:L,activatedAt:new Date().toISOString(),tier:v,licenseKey:n};try{k(T)}catch(j){return _(j)}return{success:!0,message:["Neocortex activated successfully.","","Open your preferred platform (Claude Code, Cursor, VS Code, etc.)","and reference the Neocortex agent.",...P(p)>0?["","Managed agent wrappers were refreshed while preserving existing Markdown frontmatter and unrelated platform files."]:[],"","Use *menu to see available commands or check the Docs in your Dashboard."].join(`
3
+ `),tier:v,serverUrl:r,configPath:x}}const f=H(n);if(!f.valid)return{success:!1,message:`Invalid license key: ${f.error}`};const o=n,u=o.match(/^NX-(F|P|E)-/i),w={F:"free",P:"pro",E:"enterprise"},N=u?.[1]?w[u[1].toUpperCase()]??"unknown":"unknown",A=a(l,"cache"),R=new I({cacheDir:A,passphrase:o}),F=new g({serverUrl:r,licenseKey:o,cacheProvider:R});let i;try{i=await F.activate()}catch{return{success:!1,message:["Failed to connect to IP Protection Server.","","Possible causes:",` - Server at ${r} is unreachable`," - Network connectivity issue"," - Server is still being deployed","","Workaround: Use --local flag to run in local mode"].join(`
4
+ `)}}if(!i)return{success:!1,message:["License activation failed.","","Possible causes:"," - Invalid or expired license key"," - License already activated on another machine"," - Server rejected the activation request","","Check your license key and try again.","Contact support if the problem persists."].join(`
5
+ `)};const d=i.tier??N,b={serverUrl:r,mode:"remote",machineId:E(),activatedAt:new Date().toISOString(),tier:d,licenseKey:o};try{k(b)}catch(s){return _(s)}const S=C();return{success:!0,message:["Neocortex activated successfully.","","Open your preferred platform (Claude Code, Cursor, VS Code, etc.)","and reference the Neocortex agent.",...P(S)>0?["","Managed agent wrappers were refreshed while preserving existing Markdown frontmatter and unrelated platform files."]:[],"","Use *menu to see available commands or check the Docs in your Dashboard."].join(`
6
+ `),tier:d,serverUrl:r,configPath:x}}export{le as activate,z as validateApiKeyFormat,H as validateLicenseKeyFormat};