@ornexus/neocortex 4.66.7 → 4.66.8

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 (43) hide show
  1. package/dist/release-source.json +1 -1
  2. package/dist/sbom.cdx.json +1194 -1194
  3. package/install.ps1 +1 -1
  4. package/install.sh +1 -1
  5. package/package.json +2 -2
  6. package/packages/client/dist/agent/refresh-stubs.d.ts +2 -2
  7. package/packages/client/dist/agent/refresh-stubs.js +2 -2
  8. package/packages/client/dist/commands/invoke.d.ts +7 -1
  9. package/packages/client/dist/commands/invoke.js +98 -96
  10. package/packages/client/dist/errors/frontmatter-diagnostics.d.ts +1 -1
  11. package/packages/client/dist/errors/frontmatter-diagnostics.js +1 -1
  12. package/packages/client/dist/git/git-lifecycle-store.d.ts +23 -0
  13. package/packages/client/dist/git/git-lifecycle-store.js +9 -9
  14. package/packages/client/dist/git/published-story-reconciliation.d.ts +13 -0
  15. package/packages/client/dist/git/published-story-reconciliation.js +2 -0
  16. package/packages/client/dist/git/story-worktree-integration.js +3 -3
  17. package/packages/client/dist/yoloop/target-normalization.d.ts +8 -2
  18. package/packages/client/dist/yoloop/target-normalization.js +1 -1
  19. package/packages/shared/dist/compatibility/index.js +3 -0
  20. package/packages/shared/dist/invocation/diagnose-degraded-continuation.d.ts +13 -1
  21. package/packages/shared/dist/invocation/diagnose-degraded-continuation.js +20 -12
  22. package/packages/shared/dist/invocation/diagnose-degraded-continuation.test.js +30 -1
  23. package/targets-stubs/antigravity/gemini.md +1 -1
  24. package/targets-stubs/antigravity/neocortex.md +7 -13
  25. package/targets-stubs/antigravity/skill/SKILL.md +7 -13
  26. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  27. package/targets-stubs/claude-code/neocortex-root.md +8 -8
  28. package/targets-stubs/claude-code/neocortex-sentinel.md +1 -1
  29. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  30. package/targets-stubs/claude-code/neocortex.md +8 -8
  31. package/targets-stubs/codex/AGENTS.md +7 -11
  32. package/targets-stubs/codex/neocortex.toml +7 -13
  33. package/targets-stubs/cursor/agent.md +8 -14
  34. package/targets-stubs/deepseek-harness/SKILL.md +7 -13
  35. package/targets-stubs/gemini-cli/agent.md +8 -14
  36. package/targets-stubs/gemini-cli/agents/neocortex.md +8 -14
  37. package/targets-stubs/grok/SKILL.md +7 -13
  38. package/targets-stubs/kimi/neocortex.md +7 -13
  39. package/targets-stubs/lib/managed-config-merge.js +16 -3
  40. package/targets-stubs/openclaw/SKILL.md +7 -13
  41. package/targets-stubs/opencode/neocortex-root.md +8 -13
  42. package/targets-stubs/opencode/neocortex.md +8 -13
  43. package/targets-stubs/vscode/neocortex.agent.md +8 -14
package/install.ps1 CHANGED
@@ -19,7 +19,7 @@ param(
19
19
  [string]$ServerUrl = ('https://{0}.{1}.{2}' -f 'api','neocortex','sh')
20
20
  )
21
21
 
22
- $VERSION = "4.66.7"
22
+ $VERSION = "4.66.8"
23
23
 
24
24
  # =============================================================================
25
25
  # CONFIGURACOES
package/install.sh CHANGED
@@ -4,7 +4,7 @@
4
4
  # Development Orchestrator
5
5
 
6
6
  # Versao do instalador
7
- VERSION="4.66.7"
7
+ VERSION="4.66.8"
8
8
 
9
9
  # Flags
10
10
  MIGRATION_DETECTED=false
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ornexus/neocortex",
3
- "version": "4.66.7",
4
- "description": "Neocortex v4.66.7",
3
+ "version": "4.66.8",
4
+ "description": "Neocortex v4.66.8",
5
5
  "keywords": [
6
6
  "claude",
7
7
  "claude-code",
@@ -42,7 +42,7 @@ export declare const AGENT_ROLE_IDS: Readonly<Record<string, string>>;
42
42
  * Replace all version strings in a stub file with the given version.
43
43
  * Handles 4 patterns:
44
44
  * 1. Emoji description: 🧠 Neocortex vX.Y.Z
45
- * 2. Plain markdown header: # Neocortex vX.Y.Z
45
+ * 2. Plain Markdown header or YAML description: Neocortex vX.Y.Z
46
46
  * 3. Banner line: │ ### ######## vX.Y.Z ...│
47
47
  * 4. YAML version field: version: 'X.Y.Z'
48
48
  *
@@ -62,7 +62,7 @@ export declare const SELECTED_PAYLOAD_EXCLUSION_SNIPPET = "Ambient platform/tool
62
62
  export declare const SELECTED_PAYLOAD_LARGE_INPUT_SNIPPET = "`--args` remains the default input path; `--stdin` and `--args-file` are limited to oversized explicit user payloads";
63
63
  export declare function containsSelectedPayloadBoundary(content: string): boolean;
64
64
  /**
65
- * Refresh a managed Markdown body without replacing host-owned frontmatter.
65
+ * Refresh a managed Markdown body and migrate the exact prior descriptions.
66
66
  * Preservation is intentionally limited to files whose packaged source also
67
67
  * declares YAML frontmatter, avoiding accidental treatment of body separators
68
68
  * in plain wrappers such as Codex AGENTS.md.
@@ -1,2 +1,2 @@
1
- import{readFileSync as F,writeFileSync as X,existsSync as a,mkdirSync as te,renameSync as ge,unlinkSync as xe,realpathSync as oe}from"node:fs";import{join as o,dirname as ne,relative as T,isAbsolute as re}from"node:path";import{homedir as x}from"node:os";import{createRequire as pe}from"node:module";import{fileURLToPath as De}from"node:url";import{setSecureFilePermissions as Y}from"../config/secure-config.js";const he=60,ye=25,ce=pe(import.meta.url),Se={"codex:AGENTS.md":"profile-codex-root","codex:neocortex-sentinel.toml":"profile-codex-neocortex-sentinel","codex:neocortex.toml":"profile-codex-neocortex","claude-code:neocortex-sentinel.md":"profile-claude-neocortex-sentinel-agent","claude-code:neocortex.md":"profile-claude-neocortex-agent","claude-code:neocortex-root.md":"profile-claude-neocortex-root-agent","gemini-cli:neocortex-sentinel.md":"profile-gemini-neocortex-sentinel","gemini-cli:neocortex.md":"profile-gemini-neocortex","gemini-cli:neocortex-root.md":"profile-gemini-neocortex-root","grok:neocortex-sentinel.md":"profile-grok-agent-neocortex-sentinel"},be={"codex:neocortex-sentinel.toml":"profile-codex-neocortex-sentinel","codex:neocortex.toml":"profile-codex-neocortex","claude-code:neocortex-sentinel.md":"profile-claude-neocortex-sentinel-agent","claude-code:neocortex.md":"profile-claude-neocortex-agent","claude-code:neocortex-root.md":"profile-claude-neocortex-root-agent","opencode:neocortex-sentinel.md":"profile-opencode-neocortex-sentinel","opencode:neocortex.md":"profile-opencode-neocortex","opencode:neocortex-root.md":"profile-opencode-neocortex-root"},ie={"claude-code":"neocortex-sentinel.md","gemini-cli":"agents/neocortex-sentinel.md",grok:"agents/neocortex-sentinel.md",opencode:"neocortex-sentinel.md",codex:"neocortex-sentinel.toml"},Ee=["b3efacd202482c4fe0ff18cd6c115dfb1ea7252b5bddcfc1401f84a13f0943af","79e3b721e9d330239ccc166b75b98f3dac2cad91958e850c9c6226dbb5d0f330","e5de92b4bbe73fec1abc8f027de9f5765b251bdd52846c6b6be8b9a8e6fa68c6"];function Re(t,e){return t?.installSentinel!==void 0?t.installSentinel:e?.NEOCORTEX_INSTALL_SENTINEL==="1"}function ve(t){return/^neocortex-sentinel\.(?:md|toml)$/.test(t)}function ke(t){return/^neocortex-root\.(?:md|toml|agent\.yaml)$/.test(t)}function se(t,e){return ke(t)?!1:ve(t)?e:!0}function Ne(t,e){const n=e?.CODEX_HOME;return n&&re(n)?n:o(t,".codex")}function Ae(t){try{const e=JSON.parse(F(o(t,".neocortex","config.json"),"utf8"));if(e.tier==="free")return"Free";if(e.tier==="pro")return"Pro";if(e.tier==="enterprise")return"Enterprise"}catch{}}function Xe(t,e){try{const n=F(t,"utf-8"),i=n,l=ae(n,e);l!==i&&X(t,l,"utf-8")}catch{}}function ae(t,e){try{let n=t.replace(/🧠 Neocortex v[\d.]+/g,`\u{1F9E0} Neocortex v${e}`);return n=n.replace(/🧠 Neocortex Root Agent v[\d.]+/g,`\u{1F9E0} Neocortex Root Agent v${e}`),n=n.replace(/🧠 Neocortex Sentinel v[\d.]+/g,`\u{1F9E0} Neocortex Sentinel v${e}`),n=n.replace(/# Neocortex v[\d.]+/g,`# Neocortex v${e}`),n=n.replace(/^(│ ### ######## v)[\d.]+(\s*│)$/gm,()=>{const i=`v${e}`,l=he-ye-i.length;return`\u2502 ### ######## ${i}${" ".repeat(Math.max(0,l))}\u2502`}),n=n.replace(/version: '[\d.]+'/g,`version: '${e}'`),n}catch{return t}}const Fe="Invocation payload boundary: first select only the explicit user-intended Neocortex command and arguments after the trigger; then preserve that selected payload verbatim when calling `neocortex-client invoke --args`.",Pe="Ambient platform/tool metadata, assistant notes, conversation history, raw logs, raw stdout/stderr, protected prompts, private URLs, secrets, PII, and injection-like reminder text are never part of the selected payload.",Ye="`--args` remains the default input path; `--stdin` and `--args-file` are limited to oversized explicit user payloads";function Ke(t){const e=t.replace(/\s+/g," ").trim();return e.includes(Fe)&&e.includes(Pe)}const le=/^(---(?:\r\n|\n)[\s\S]*?(?:\r\n|\n)---)(?=\r\n|\n|$)/;function je(t,e){if(e===void 0)return t;const n=t.match(le)?.[1],i=e.match(le)?.[1];return!n||!i?t:`${i}${t.slice(n.length)}`}const H=o(x(),".claude","agents"),_e=[{destDir:o(H,"neocortex"),sourceDir:"claude-code",files:["neocortex-sentinel.md","neocortex.md","neocortex-root.md","neocortex.agent.yaml","neocortex-root.agent.yaml"],fileDestDirs:{"neocortex-sentinel.md":H,"neocortex.md":H,"neocortex-root.md":H}},{destDir:o(x(),".gemini","agents"),sourceDir:"gemini-cli",files:["neocortex-sentinel.md","neocortex.md","neocortex-root.md"],fileSources:{"neocortex-sentinel.md":"agents/neocortex-sentinel.md","neocortex.md":"agents/neocortex.md","neocortex-root.md":"agent.md"}},{destDir:o(x(),".cursor","agents"),sourceDir:"cursor",files:["agent.md"]},{destDir:o(x(),".kimi-code","agents"),sourceDir:"kimi",files:["neocortex.md"]},{destDir:o(x(),".opencode","agents"),sourceDir:"opencode",files:["neocortex-sentinel.md","neocortex.md","neocortex-root.md"]},{destDir:o(x(),".codex"),sourceDir:"codex",files:["AGENTS.md"]},{destDir:o(x(),".codex","agents"),sourceDir:"codex",files:["neocortex-sentinel.toml","neocortex.toml"]},{destDir:o(x(),".copilot","agents"),sourceDir:"vscode",files:["neocortex.agent.md"]},{destDir:o(x(),".agent","skills","neocortex"),sourceDir:"antigravity",files:["skill/SKILL.md"]},{destDir:o(x(),".gemini","config","agents"),sourceDir:"antigravity",files:["neocortex.md"]},{destDir:o(x(),".grok","skills","neocortex"),sourceDir:"grok",files:["SKILL.md"]},{destDir:o(x(),".grok","agents"),sourceDir:"grok",files:["neocortex-sentinel.md"],fileSources:{"neocortex-sentinel.md":"agents/neocortex-sentinel.md"}}],Le=[{stubDir:"gemini-cli",agentsDir:o(".gemini","agents"),roleFiles:[["neocortex-sentinel.md","project-gemini-neocortex-sentinel",!0],["neocortex.md","project-gemini-neocortex",!0],["neocortex-root.md","project-gemini-neocortex-root",!1]],fileSources:{"neocortex-sentinel.md":"agents/neocortex-sentinel.md","neocortex.md":"agents/neocortex.md","neocortex-root.md":"agent.md"}},{stubDir:"grok",agentsDir:o(".grok","agents"),roleFiles:[["neocortex-sentinel.md","project-grok-agent-neocortex-sentinel",!0]],fileSources:{"neocortex-sentinel.md":"agents/neocortex-sentinel.md"}},{stubDir:"claude-code",agentsDir:o(".claude","agents"),roleFiles:[["neocortex-sentinel.md","project-claude-neocortex-sentinel-agent",!0],["neocortex.md","project-claude-neocortex-agent",!0]],legacyDir:o(".claude","agents","neocortex")},{stubDir:"opencode",agentsDir:o(".opencode","agents"),roleFiles:[["neocortex-sentinel.md","project-opencode-neocortex-sentinel",!0],["neocortex.md","project-opencode-neocortex",!0],["neocortex-root.md","project-opencode-neocortex-root",!1]]},{stubDir:"codex",agentsDir:o(".codex","agents"),roleFiles:[["neocortex-sentinel.toml","project-codex-neocortex-sentinel",!0],["neocortex.toml","project-codex-neocortex",!0]]}];function Ie(){try{const t=De(import.meta.url);let e=ne(t);for(let n=0;n<10;n++){try{if(JSON.parse(F(o(e,"package.json"),"utf-8")).name==="@ornexus/neocortex")return e}catch{}e=ne(e)}}catch{}return null}function Ce(t){try{const e=o(t,".version");if(a(e))return F(e,"utf-8").trim()||null}catch{}return null}function Te(t,e){const n=`${t}.tmp-${process.pid}`;try{X(n,e,"utf8"),Y(n),ge(n,t),Y(t)}catch(i){try{a(n)&&xe(n)}catch{}throw i}}function Je(t,e){return we(t,e).refreshed}function de(t,e,n,i,l,s=!0){let f=F(t,"utf8");if(e.endsWith(".md")&&s){const c=a(n)?n:i&&a(i)?i:null,S=c?F(c,"utf8"):void 0;f=je(f,S)}return(e.endsWith(".md")||e.endsWith(".yaml")||e.endsWith(".yml"))&&(f=ae(f,l)),f}function K(t,e,n){return{id:t.id??e,scope:n,relativePath:t.relativePath??"",action:t.action,reasonCode:t.reasonCode,...t.nextStep?{nextStep:t.nextStep}:{}}}function Oe(t,e){try{return oe.native(t)===oe.native(e)}catch{return!1}}function P(t){const{managed:e,destination:n,manifestFile:i,baseDir:l,id:s,scope:f,dryRun:c,results:S,knownHashes:h}=t;try{const p=e.retireLegacy({destination:n,manifestFile:i,baseDir:l,id:s,dryRun:c,...h?{knownHashes:h}:{}});p.action!=="none"&&S.push(K(p,s,f))}catch(p){const u=p?.reasonCode;S.push({id:s,scope:f,relativePath:T(l,n).split("\\").join("/"),action:"failed",reasonCode:typeof u=="string"?u:"managed-retirement-failed"})}}function $e(t){const{projectRoot:e,home:n,stubsRoot:i,managed:l,cliVersion:s,dryRun:f,tierLabel:c,targetFilter:S,installSentinel:h,results:p}=t;if(!re(e)||!a(e)||Oe(e,n))return;const u=o(e,".neocortex","managed-config-manifest.json");for(const g of Le)if(!(S&&g.stubDir!==S))try{const j=o(i,g.stubDir),k=o(e,g.agentsDir),R=g.stubDir==="gemini-cli"?o(k,"agent.md"):null;if(!(g.roleFiles.slice(0,2).some(([r])=>a(o(k,r)))||!!(R&&a(R))))continue;const $=ie[g.stubDir],N=h&&!!($&&a(o(j,$)));for(const[r,y,w]of g.roleFiles){const D=o(j,g.fileSources?.[r]??r),b=o(k,r);if(!se(r,h)){P({managed:l,destination:b,manifestFile:u,baseDir:e,id:y,scope:"project",dryRun:f,results:p});continue}if(!a(D)||!w&&!a(b))continue;const A=g.legacyDir?o(e,g.legacyDir,r):null,G=N&&l.agentRoleMigrationPending?.({id:y,destination:b,manifestFile:u,baseDir:e})===!0,U=de(D,r,b,A,s,!G);try{const m=l.applyProfileBytes({id:y,content:U,destination:b,manifestFile:u,baseDir:e,dryRun:f,allowLegacyAdoption:!0,tierLabel:c,adoptExistingOwner:!0,agentRoles:N,legacyCopyPath:A&&a(A)?A:null,contentVersion:s});p.push(K(m,y,"project"))}catch(m){const E=m?.reasonCode;p.push({id:y,scope:"project",relativePath:T(e,b).split("\\").join("/"),action:"failed",reasonCode:typeof E=="string"?E:"managed-operation-failed"})}}R&&a(o(k,"neocortex.md"))&&P({managed:l,destination:R,manifestFile:u,baseDir:e,id:"project-gemini-cli-.gemini-agents-agent.md",scope:"project",dryRun:f,results:p})}catch{}}function we(t,e){const n=[];try{const i=e?.forceCreate??!1,l=e?.targetFilter,s=e?.dryRun??!1,f=x(),c=e?.homeDir??f,S=e?.packageRoot??Ie();if(!S)return{refreshed:0,results:n};const h=o(S,"targets-stubs");if(!a(h))return{refreshed:0,results:n};const p=o(h,"lib","managed-config-merge.js");if(!a(p))return{refreshed:0,results:n};const u=ce(p),g=o(c,".neocortex","managed-config-manifest.json"),j=Ae(c),k=e?.env??(e?.homeDir?void 0:process.env),R=Re(e,k),O=Ne(c,k),$=o(f,".codex");try{u.applyPolicy({configFile:o(c,".neocortex","config.json"),manifestFile:g,baseDir:c,dryRun:s})}catch{}if(e?.projectRoot&&$e({projectRoot:e.projectRoot,home:c,stubsRoot:h,managed:u,cliVersion:t,dryRun:s,tierLabel:j,targetFilter:l,installSentinel:R,results:n}),!l||l==="claude-code")try{const r=o(h,"lib","claude-worktree-setting.js");a(r)&&ce(r).ensureClaudeWorktreeBaseRef(c,{dryRun:s})}catch{}let N=0;for(const r of _e)try{const y=r.sourceDir==="codex",w=d=>y?o(O,T($,d)):e?.homeDir?o(c,T(f,d)):d,D=w(r.destDir);if(l&&r.sourceDir!==l)continue;if(!a(D)){if(i&&!s)te(D,{recursive:!0});else if(!(i&&s))continue}const b=o(h,r.sourceDir),A=d=>o(b,r.fileSources?.[d]??d),G=d=>{const L=r.fileDestDirs?.[d];return L?o(w(L),d):o(D,d)},U=Ce(D);if(!a(b))continue;let m=c;if(y){if(!a(O))continue;m=u.resolveManagedBase(O,c)}const E=m===c?g:o(m,".neocortex","managed-config-manifest.json"),J=ie[r.sourceDir],V=R&&!!(J&&a(o(b,J)));r.sourceDir==="codex"&&r.files.includes("neocortex.toml")&&P({managed:u,destination:o(D,"neocortex-worker.toml"),manifestFile:E,baseDir:m,id:"profile-codex-neocortex-worker-retired",scope:"user",dryRun:s,results:n,knownHashes:Ee});let W=!1,q=!1,_=!1;for(const d of r.files){const L=A(d),ue=r.fileDestDirs?.[d],I=G(d),B=ue?o(D,d):null,Q=T(c,I).split("\\").join("/"),Z=`${r.sourceDir}:${d}`,C=Se[Z]??`profile-${r.sourceDir}-${Q}`;if(!se(d,R)){P({managed:u,destination:I,manifestFile:E,baseDir:m,id:C,scope:"user",dryRun:s,results:n});continue}if(a(L)){const M=be[Z],fe=!!M&&V&&u.agentRoleMigrationPending?.({id:C,agentRoleId:M,destination:I,manifestFile:E,baseDir:m})===!0,me=de(L,d,I,B,t,!fe);try{const v=u.applyProfileBytes({id:C,content:me,destination:I,manifestFile:E,baseDir:m,dryRun:s,allowLegacyAdoption:!0,tierLabel:j,adoptExistingOwner:!0,legacyBaseDir:m===c?null:c,...M?{agentRoles:V,agentRoleId:M}:{},legacyCopyPath:B&&a(B)?B:null,contentVersion:t});n.push(K(v,C,"user")),v.action==="skipped"||v.action==="failed"?_=!0:(W=!0,v.action!=="noop"&&v.action!=="planned-noop"&&(q=!0))}catch(v){const ee=v?.reasonCode;throw n.push({id:C,scope:"user",relativePath:Q,action:"failed",reasonCode:typeof ee=="string"?ee:"managed-operation-failed"}),_=!0,v}}}!_&&W&&r.sourceDir==="gemini-cli"&&P({managed:u,destination:o(D,"agent.md"),manifestFile:E,baseDir:m,id:"profile-gemini-cli-.gemini-agents-agent.md",scope:"user",dryRun:s,results:n}),!_&&r.sourceDir==="grok"&&r.files.includes("neocortex-sentinel.md")&&P({managed:u,destination:o(D,"neocortex.md"),manifestFile:E,baseDir:m,id:"profile-grok-agent-neocortex",scope:"user",dryRun:s,results:n});const z=W&&!_&&(q||U!==t);if(z&&!s){const d=o(D,".version");Te(d,t+`
2
- `),N++}else z&&N++}catch{}if(N>0&&!s)try{const r=o(c,".neocortex");te(r,{recursive:!0});const y=o(r,".update-check");X(y,"",{flag:"w"}),Y(y)}catch{}return{refreshed:N,results:n}}catch{return{refreshed:0,results:n}}}export{be as AGENT_ROLE_IDS,Se as CANONICAL_MANAGED_IDS,Le as PROJECT_ROLE_TARGETS,Fe as SELECTED_PAYLOAD_BOUNDARY_SNIPPET,Pe as SELECTED_PAYLOAD_EXCLUSION_SNIPPET,Ye as SELECTED_PAYLOAD_LARGE_INPUT_SNIPPET,_e as STUB_TARGETS,Ke as containsSelectedPayloadBoundary,Ie as findPackageRoot,ae as patchVersionInContent,Xe as patchVersionInFile,je as preserveInstalledMarkdownFrontmatter,Je as refreshStubs,we as refreshStubsReport};
1
+ import{readFileSync as k,writeFileSync as Y,existsSync as d,mkdirSync as te,renameSync as ge,unlinkSync as xe,realpathSync as oe}from"node:fs";import{join as n,dirname as ne,relative as T,isAbsolute as re}from"node:path";import{homedir as D}from"node:os";import{createRequire as he}from"node:module";import{fileURLToPath as De}from"node:url";import{setSecureFilePermissions as X}from"../config/secure-config.js";const ye=60,Se=25,ce=he(import.meta.url),Ee={"codex:AGENTS.md":"profile-codex-root","codex:neocortex-sentinel.toml":"profile-codex-neocortex-sentinel","codex:neocortex.toml":"profile-codex-neocortex","claude-code:neocortex-sentinel.md":"profile-claude-neocortex-sentinel-agent","claude-code:neocortex.md":"profile-claude-neocortex-agent","claude-code:neocortex-root.md":"profile-claude-neocortex-root-agent","gemini-cli:neocortex-sentinel.md":"profile-gemini-neocortex-sentinel","gemini-cli:neocortex.md":"profile-gemini-neocortex","gemini-cli:neocortex-root.md":"profile-gemini-neocortex-root","grok:neocortex-sentinel.md":"profile-grok-agent-neocortex-sentinel"},be={"codex:neocortex-sentinel.toml":"profile-codex-neocortex-sentinel","codex:neocortex.toml":"profile-codex-neocortex","claude-code:neocortex-sentinel.md":"profile-claude-neocortex-sentinel-agent","claude-code:neocortex.md":"profile-claude-neocortex-agent","claude-code:neocortex-root.md":"profile-claude-neocortex-root-agent","opencode:neocortex-sentinel.md":"profile-opencode-neocortex-sentinel","opencode:neocortex.md":"profile-opencode-neocortex","opencode:neocortex-root.md":"profile-opencode-neocortex-root"},ie={"claude-code":"neocortex-sentinel.md","gemini-cli":"agents/neocortex-sentinel.md",grok:"agents/neocortex-sentinel.md",opencode:"neocortex-sentinel.md",codex:"neocortex-sentinel.toml"},Re=["b3efacd202482c4fe0ff18cd6c115dfb1ea7252b5bddcfc1401f84a13f0943af","79e3b721e9d330239ccc166b75b98f3dac2cad91958e850c9c6226dbb5d0f330","e5de92b4bbe73fec1abc8f027de9f5765b251bdd52846c6b6be8b9a8e6fa68c6"];function ve(t,e){return t?.installSentinel!==void 0?t.installSentinel:e?.NEOCORTEX_INSTALL_SENTINEL==="1"}function Ne(t){return/^neocortex-sentinel\.(?:md|toml)$/.test(t)}function Pe(t){return/^neocortex-root\.(?:md|toml|agent\.yaml)$/.test(t)}function se(t,e){return Pe(t)?!1:Ne(t)?e:!0}function Ae(t,e){const o=e?.CODEX_HOME;return o&&re(o)?o:n(t,".codex")}function ke(t){try{const e=JSON.parse(k(n(t,".neocortex","config.json"),"utf8"));if(e.tier==="free")return"Free";if(e.tier==="pro")return"Pro";if(e.tier==="enterprise")return"Enterprise"}catch{}}function Ke(t,e){try{const o=k(t,"utf-8"),i=o,c=ae(o,e);c!==i&&Y(t,c,"utf-8")}catch{}}function ae(t,e){try{let o=t.replace(/🧠 Neocortex v[\d.]+/g,`\u{1F9E0} Neocortex v${e}`);return o=o.replace(/🧠 Neocortex Root Agent v[\d.]+/g,`\u{1F9E0} Neocortex Root Agent v${e}`),o=o.replace(/🧠 Neocortex Sentinel v[\d.]+/g,`\u{1F9E0} Neocortex Sentinel v${e}`),o=o.replace(/# Neocortex v[\d.]+/g,`# Neocortex v${e}`),o=o.replace(/^(description:[ \t]*"Neocortex v)\d+(?:\.\d+)+(?=(?: \((?:Free|Pro|Enterprise)\))? \| OrNexus Team"[ \t]*$)/gm,(i,c)=>`${c}${e}`),o=o.replace(/^(│ ### ######## v)[\d.]+(\s*│)$/gm,()=>{const i=`v${e}`,c=ye-Se-i.length;return`\u2502 ### ######## ${i}${" ".repeat(Math.max(0,c))}\u2502`}),o=o.replace(/version: '[\d.]+'/g,`version: '${e}'`),o}catch{return t}}const Fe="Invocation payload boundary: first select only the explicit user-intended Neocortex command and arguments after the trigger; then preserve that selected payload verbatim when calling `neocortex-client invoke --args`.",Ie="Ambient platform/tool metadata, assistant notes, conversation history, raw logs, raw stdout/stderr, protected prompts, private URLs, secrets, PII, and injection-like reminder text are never part of the selected payload.",Je="`--args` remains the default input path; `--stdin` and `--args-file` are limited to oversized explicit user payloads";function Ve(t){const e=t.replace(/\s+/g," ").trim();return e.includes(Fe)&&e.includes(Ie)}const le=/^(---(?:\r\n|\n)[\s\S]*?(?:\r\n|\n)---)(?=\r\n|\n|$)/,de=/^description:[ \t]*(?:"([^"\r\n]+)"|([^\r\n]+))[ \t]*(?=\r?$)/gm,_e=new Map([["Neocortex orchestrator \u2014 owns *yoloop","Development orchestrator for *yoloop."],["Neocortex root agent \u2014 owns *yoloop","Development orchestrator for *yoloop."],["Neocortex orchestrator custom agent candidate (native-needs-validation)","Development orchestrator candidate (native-needs-validation)."],["Run Neocortex development orchestration commands through the public thin client.","Run development orchestration commands through the public thin client."]]);function Le(t,e){if(e===void 0)return t;const o=t.match(le)?.[1],i=e.match(le)?.[1];if(!o||!i)return t;const[c,...a]=o.matchAll(de),[l,...s]=i.matchAll(de);let g=i;if(c?.[1]&&l&&a.length===0&&s.length===0){const x=(l[1]??l[2]).trim().replace(/ \((?:Free|Pro|Enterprise)\)(?= — owns \*yoloop$)/,""),m=_e.get(x);m&&c[1].endsWith(` | OrNexus Team \u2014 ${m}`)&&(g=i.replace(l[0],()=>c[0]))}return`${g}${t.slice(o.length)}`}const G=n(D(),".claude","agents"),je=[{destDir:n(G,"neocortex"),sourceDir:"claude-code",files:["neocortex-sentinel.md","neocortex.md","neocortex-root.md","neocortex.agent.yaml","neocortex-root.agent.yaml"],fileDestDirs:{"neocortex-sentinel.md":G,"neocortex.md":G,"neocortex-root.md":G}},{destDir:n(D(),".gemini","agents"),sourceDir:"gemini-cli",files:["neocortex-sentinel.md","neocortex.md","neocortex-root.md"],fileSources:{"neocortex-sentinel.md":"agents/neocortex-sentinel.md","neocortex.md":"agents/neocortex.md","neocortex-root.md":"agent.md"}},{destDir:n(D(),".cursor","agents"),sourceDir:"cursor",files:["agent.md"]},{destDir:n(D(),".kimi-code","agents"),sourceDir:"kimi",files:["neocortex.md"]},{destDir:n(D(),".opencode","agents"),sourceDir:"opencode",files:["neocortex-sentinel.md","neocortex.md","neocortex-root.md"]},{destDir:n(D(),".codex"),sourceDir:"codex",files:["AGENTS.md"]},{destDir:n(D(),".codex","agents"),sourceDir:"codex",files:["neocortex-sentinel.toml","neocortex.toml"]},{destDir:n(D(),".copilot","agents"),sourceDir:"vscode",files:["neocortex.agent.md"]},{destDir:n(D(),".agent","skills","neocortex"),sourceDir:"antigravity",files:["skill/SKILL.md"]},{destDir:n(D(),".gemini","config","agents"),sourceDir:"antigravity",files:["neocortex.md"]},{destDir:n(D(),".grok","skills","neocortex"),sourceDir:"grok",files:["SKILL.md"]},{destDir:n(D(),".grok","agents"),sourceDir:"grok",files:["neocortex-sentinel.md"],fileSources:{"neocortex-sentinel.md":"agents/neocortex-sentinel.md"}}],Ce=[{stubDir:"gemini-cli",agentsDir:n(".gemini","agents"),roleFiles:[["neocortex-sentinel.md","project-gemini-neocortex-sentinel",!0],["neocortex.md","project-gemini-neocortex",!0],["neocortex-root.md","project-gemini-neocortex-root",!1]],fileSources:{"neocortex-sentinel.md":"agents/neocortex-sentinel.md","neocortex.md":"agents/neocortex.md","neocortex-root.md":"agent.md"}},{stubDir:"grok",agentsDir:n(".grok","agents"),roleFiles:[["neocortex-sentinel.md","project-grok-agent-neocortex-sentinel",!0]],fileSources:{"neocortex-sentinel.md":"agents/neocortex-sentinel.md"}},{stubDir:"claude-code",agentsDir:n(".claude","agents"),roleFiles:[["neocortex-sentinel.md","project-claude-neocortex-sentinel-agent",!0],["neocortex.md","project-claude-neocortex-agent",!0]],legacyDir:n(".claude","agents","neocortex")},{stubDir:"opencode",agentsDir:n(".opencode","agents"),roleFiles:[["neocortex-sentinel.md","project-opencode-neocortex-sentinel",!0],["neocortex.md","project-opencode-neocortex",!0],["neocortex-root.md","project-opencode-neocortex-root",!1]]},{stubDir:"codex",agentsDir:n(".codex","agents"),roleFiles:[["neocortex-sentinel.toml","project-codex-neocortex-sentinel",!0],["neocortex.toml","project-codex-neocortex",!0]]}];function Te(){try{const t=De(import.meta.url);let e=ne(t);for(let o=0;o<10;o++){try{if(JSON.parse(k(n(e,"package.json"),"utf-8")).name==="@ornexus/neocortex")return e}catch{}e=ne(e)}}catch{}return null}function Oe(t){try{const e=n(t,".version");if(d(e))return k(e,"utf-8").trim()||null}catch{}return null}function $e(t,e){const o=`${t}.tmp-${process.pid}`;try{Y(o,e,"utf8"),X(o),ge(o,t),X(t)}catch(i){try{d(o)&&xe(o)}catch{}throw i}}function qe(t,e){return Me(t,e).refreshed}function ue(t,e,o,i,c,a=!0){let l=k(t,"utf8");if(e.endsWith(".md")&&a){const s=d(o)?o:i&&d(i)?i:null,g=s?k(s,"utf8"):void 0;l=Le(l,g)}return(e.endsWith(".md")||e.endsWith(".yaml")||e.endsWith(".yml")||e.endsWith(".toml"))&&(l=ae(l,c)),l}function K(t,e,o){return{id:t.id??e,scope:o,relativePath:t.relativePath??"",action:t.action,reasonCode:t.reasonCode,...t.nextStep?{nextStep:t.nextStep}:{}}}function we(t,e){try{return oe.native(t)===oe.native(e)}catch{return!1}}function F(t){const{managed:e,destination:o,manifestFile:i,baseDir:c,id:a,scope:l,dryRun:s,results:g,knownHashes:x}=t;try{const m=e.retireLegacy({destination:o,manifestFile:i,baseDir:c,id:a,dryRun:s,...x?{knownHashes:x}:{}});m.action!=="none"&&g.push(K(m,a,l))}catch(m){const f=m?.reasonCode;g.push({id:a,scope:l,relativePath:T(c,o).split("\\").join("/"),action:"failed",reasonCode:typeof f=="string"?f:"managed-retirement-failed"})}}function Be(t){const{projectRoot:e,home:o,stubsRoot:i,managed:c,cliVersion:a,dryRun:l,tierLabel:s,targetFilter:g,installSentinel:x,results:m}=t;if(!re(e)||!d(e)||we(e,o))return;const f=n(e,".neocortex","managed-config-manifest.json");for(const h of Ce)if(!(g&&h.stubDir!==g))try{const I=n(i,h.stubDir),N=n(e,h.agentsDir),R=h.stubDir==="gemini-cli"?n(N,"agent.md"):null;if(!(h.roleFiles.slice(0,2).some(([r])=>d(n(N,r)))||!!(R&&d(R))))continue;const $=ie[h.stubDir],P=x&&!!($&&d(n(I,$)));for(const[r,S,w]of h.roleFiles){const y=n(I,h.fileSources?.[r]??r),E=n(N,r);if(!se(r,x)){F({managed:c,destination:E,manifestFile:f,baseDir:e,id:S,scope:"project",dryRun:l,results:m});continue}if(!d(y)||!w&&!d(E))continue;const A=h.legacyDir?n(e,h.legacyDir,r):null,H=P&&c.agentRoleMigrationPending?.({id:S,destination:E,manifestFile:f,baseDir:e})===!0,U=ue(y,r,E,A,a,!H);try{const p=c.applyProfileBytes({id:S,content:U,destination:E,manifestFile:f,baseDir:e,dryRun:l,allowLegacyAdoption:!0,tierLabel:s,adoptExistingOwner:!0,agentRoles:P,legacyCopyPath:A&&d(A)?A:null,contentVersion:a});m.push(K(p,S,"project"))}catch(p){const b=p?.reasonCode;m.push({id:S,scope:"project",relativePath:T(e,E).split("\\").join("/"),action:"failed",reasonCode:typeof b=="string"?b:"managed-operation-failed"})}}R&&d(n(N,"neocortex.md"))&&F({managed:c,destination:R,manifestFile:f,baseDir:e,id:"project-gemini-cli-.gemini-agents-agent.md",scope:"project",dryRun:l,results:m})}catch{}}function Me(t,e){const o=[];try{const i=e?.forceCreate??!1,c=e?.targetFilter,a=e?.dryRun??!1,l=D(),s=e?.homeDir??l,g=e?.packageRoot??Te();if(!g)return{refreshed:0,results:o};const x=n(g,"targets-stubs");if(!d(x))return{refreshed:0,results:o};const m=n(x,"lib","managed-config-merge.js");if(!d(m))return{refreshed:0,results:o};const f=ce(m),h=n(s,".neocortex","managed-config-manifest.json"),I=ke(s),N=e?.env??(e?.homeDir?void 0:process.env),R=ve(e,N),O=Ae(s,N),$=n(l,".codex");try{f.applyPolicy({configFile:n(s,".neocortex","config.json"),manifestFile:h,baseDir:s,dryRun:a})}catch{}if(e?.projectRoot&&Be({projectRoot:e.projectRoot,home:s,stubsRoot:x,managed:f,cliVersion:t,dryRun:a,tierLabel:I,targetFilter:c,installSentinel:R,results:o}),!c||c==="claude-code")try{const r=n(x,"lib","claude-worktree-setting.js");d(r)&&ce(r).ensureClaudeWorktreeBaseRef(s,{dryRun:a})}catch{}let P=0;for(const r of je)try{const S=r.sourceDir==="codex",w=u=>S?n(O,T($,u)):e?.homeDir?n(s,T(l,u)):u,y=w(r.destDir);if(c&&r.sourceDir!==c)continue;if(!d(y)){if(i&&!a)te(y,{recursive:!0});else if(!(i&&a))continue}const E=n(x,r.sourceDir),A=u=>n(E,r.fileSources?.[u]??u),H=u=>{const L=r.fileDestDirs?.[u];return L?n(w(L),u):n(y,u)},U=Oe(y);if(!d(E))continue;let p=s;if(S){if(!d(O))continue;p=f.resolveManagedBase(O,s)}const b=p===s?h:n(p,".neocortex","managed-config-manifest.json"),J=ie[r.sourceDir],V=R&&!!(J&&d(n(E,J)));r.sourceDir==="codex"&&r.files.includes("neocortex.toml")&&F({managed:f,destination:n(y,"neocortex-worker.toml"),manifestFile:b,baseDir:p,id:"profile-codex-neocortex-worker-retired",scope:"user",dryRun:a,results:o,knownHashes:Re});let W=!1,q=!1,_=!1;for(const u of r.files){const L=A(u),fe=r.fileDestDirs?.[u],j=H(u),B=fe?n(y,u):null,Q=T(s,j).split("\\").join("/"),Z=`${r.sourceDir}:${u}`,C=Ee[Z]??`profile-${r.sourceDir}-${Q}`;if(!se(u,R)){F({managed:f,destination:j,manifestFile:b,baseDir:p,id:C,scope:"user",dryRun:a,results:o});continue}if(d(L)){const M=be[Z],me=!!M&&V&&f.agentRoleMigrationPending?.({id:C,agentRoleId:M,destination:j,manifestFile:b,baseDir:p})===!0,pe=ue(L,u,j,B,t,!me);try{const v=f.applyProfileBytes({id:C,content:pe,destination:j,manifestFile:b,baseDir:p,dryRun:a,allowLegacyAdoption:!0,tierLabel:I,adoptExistingOwner:!0,legacyBaseDir:p===s?null:s,...M?{agentRoles:V,agentRoleId:M}:{},legacyCopyPath:B&&d(B)?B:null,contentVersion:t});o.push(K(v,C,"user")),v.action==="skipped"||v.action==="failed"?_=!0:(W=!0,v.action!=="noop"&&v.action!=="planned-noop"&&(q=!0))}catch(v){const ee=v?.reasonCode;throw o.push({id:C,scope:"user",relativePath:Q,action:"failed",reasonCode:typeof ee=="string"?ee:"managed-operation-failed"}),_=!0,v}}}!_&&W&&r.sourceDir==="gemini-cli"&&F({managed:f,destination:n(y,"agent.md"),manifestFile:b,baseDir:p,id:"profile-gemini-cli-.gemini-agents-agent.md",scope:"user",dryRun:a,results:o}),!_&&r.sourceDir==="grok"&&r.files.includes("neocortex-sentinel.md")&&F({managed:f,destination:n(y,"neocortex.md"),manifestFile:b,baseDir:p,id:"profile-grok-agent-neocortex",scope:"user",dryRun:a,results:o});const z=W&&!_&&(q||U!==t);if(z&&!a){const u=n(y,".version");$e(u,t+`
2
+ `),P++}else z&&P++}catch{}if(P>0&&!a)try{const r=n(s,".neocortex");te(r,{recursive:!0});const S=n(r,".update-check");Y(S,"",{flag:"w"}),X(S)}catch{}return{refreshed:P,results:o}}catch{return{refreshed:0,results:o}}}export{be as AGENT_ROLE_IDS,Ee as CANONICAL_MANAGED_IDS,Ce as PROJECT_ROLE_TARGETS,Fe as SELECTED_PAYLOAD_BOUNDARY_SNIPPET,Ie as SELECTED_PAYLOAD_EXCLUSION_SNIPPET,Je as SELECTED_PAYLOAD_LARGE_INPUT_SNIPPET,je as STUB_TARGETS,Ve as containsSelectedPayloadBoundary,Te as findPackageRoot,ae as patchVersionInContent,Ke as patchVersionInFile,Le as preserveInstalledMarkdownFrontmatter,qe as refreshStubs,Me as refreshStubsReport};
@@ -16,6 +16,7 @@ import { type InvokeEffectContext, type StrictReadOnlyInvokeEnvelope } from '../
16
16
  import { type ExplicitIntentRecoveryBindingV1, type ExplicitIntentRecoveryResultV1, type InvokeInputEvidenceV1, type InvokeInputEnvelopeV2, type InvokeInputSourceV2, type InvocationMalformedInputReasonV1, type InvocationAdmissionResultV1, type ProjectIdentityMigrationRequestV1 } from '../../../shared/dist/invocation/index.js';
17
17
  import { COMPATIBILITY_CAPABILITIES, type CompatibilityOfferV1, type CompatibilityResultV1, type PrivateExecutionHostKind } from '../../../shared/dist/compatibility/index.js';
18
18
  import { type P205TransientExecutionAuthority } from '../git/git-lifecycle-store.js';
19
+ import type { PublishedStoryReconciliation } from '../git/published-story-reconciliation.js';
19
20
  /**
20
21
  * P226.04: the collector may fail with the bounded per-field frontmatter code
21
22
  * (`frontmatter-list-too-long:<field>:<n>><limit>`); surface it verbatim instead
@@ -65,6 +66,8 @@ export interface InvokeOptions {
65
66
  readonly environment?: NodeJS.ProcessEnv;
66
67
  /** P205.05 exact outer transport policy; never inferred from response metadata. */
67
68
  readonly strictReadOnly?: boolean;
69
+ /** Explicit opt-in from a wrapper that can consume the scoped diagnose receipt. */
70
+ readonly diagnoseScopedContinuation?: boolean;
68
71
  /** Explicit P222.16 beta; never inferred from Codex being installed. */
69
72
  readonly privateExecutionBeta?: boolean;
70
73
  /** Explicit local subscription model override; never part of server args or a fallback. */
@@ -345,6 +348,7 @@ export interface InvokeCliParsedOptions {
345
348
  readonly serverUrl?: string;
346
349
  readonly platformTarget?: string;
347
350
  readonly strictReadOnly: boolean;
351
+ readonly diagnoseScopedContinuation?: true;
348
352
  readonly privateExecutionBeta: boolean;
349
353
  readonly privateExecutionModel?: string;
350
354
  }
@@ -667,7 +671,7 @@ export type InvokeRequestBody = InvokeRequestBodyBase & ({
667
671
  readonly args?: never;
668
672
  readonly argsRef: InvokeArgsRef;
669
673
  });
670
- export declare function buildInvokeCompatibilityOffer(): CompatibilityOfferV1;
674
+ export declare function buildInvokeCompatibilityOffer(diagnoseScopedContinuation?: boolean): CompatibilityOfferV1;
671
675
  export interface InvokePayloadTelemetry {
672
676
  readonly schemaVersion: 1;
673
677
  readonly payloadBytes: number;
@@ -758,6 +762,8 @@ export interface StateSnapshotCollectionOptions {
758
762
  readonly p205Authorities?: Readonly<Record<string, P205TransientExecutionAuthority>>;
759
763
  /** P230.07: count-only P205 order diagnostics projected on the affected epic. */
760
764
  readonly p205AuthorityDiagnostics?: readonly P205AuthorityEpicDiagnostic[];
765
+ /** Public scheduling proof revalidated against the remote for this request. */
766
+ readonly publishedStoryReconciliations?: readonly PublishedStoryReconciliation[];
761
767
  }
762
768
  export declare class StateSnapshotIntegrityError extends Error {
763
769
  readonly reasonCode: string;