@ornexus/neocortex 4.64.2 → 4.64.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/install.ps1 CHANGED
@@ -17,7 +17,7 @@ param(
17
17
  [string]$ServerUrl = ('https://{0}.{1}.{2}' -f 'api','neocortex','sh')
18
18
  )
19
19
 
20
- $VERSION = "4.64.2"
20
+ $VERSION = "4.64.4"
21
21
 
22
22
  # =============================================================================
23
23
  # CONFIGURACOES
@@ -1259,6 +1259,15 @@ function Install-Agent {
1259
1259
  $stubResult2 = Copy-Silent "$claudeTargetDir\neocortex.agent.yaml" "$script:DestDir\"
1260
1260
  if (-not $stubResult2) { Write-Fail "Falha ao copiar neocortex.agent.yaml de $claudeTargetDir" }
1261
1261
  Write-Dbg "Install-Agent: Copy neocortex.agent.yaml result=$stubResult2"
1262
+ # 4.64.3: the root profile (owns *yoloop) ships beside the subagent stub.
1263
+ if (Test-Path "$claudeTargetDir\neocortex-root.md") {
1264
+ $destRootMd = Join-Path $script:AgentsDir "neocortex-root.md"
1265
+ $stubResultRoot = Copy-ManagedFile -Source "$claudeTargetDir\neocortex-root.md" -Destination $destRootMd -ManagedId "profile-claude-neocortex-root-agent" -BaseDir $env:USERPROFILE
1266
+ if (-not $stubResultRoot) { $script:Errors++; Write-Fail "Falha ao copiar neocortex-root.md de $claudeTargetDir" }
1267
+ if (Test-Path "$claudeTargetDir\neocortex-root.agent.yaml") {
1268
+ $null = Copy-Silent "$claudeTargetDir\neocortex-root.agent.yaml" "$script:DestDir\"
1269
+ }
1270
+ }
1262
1271
 
1263
1272
  # Epic 65: Post-copy verification -- belt and suspenders
1264
1273
  $destYaml = Join-Path $script:DestDir "neocortex.agent.yaml"
package/install.sh CHANGED
@@ -4,7 +4,7 @@
4
4
  # Development Orchestrator
5
5
 
6
6
  # Versao do instalador
7
- VERSION="4.64.2"
7
+ VERSION="4.64.4"
8
8
 
9
9
  # Flags
10
10
  MIGRATION_DETECTED=false
@@ -1237,6 +1237,14 @@ install_agent() {
1237
1237
  managed_copy_file "$CLAUDE_TARGET_DIR/neocortex.md" "$AGENTS_DIR/neocortex.md" "profile-claude-neocortex-agent" "$HOME" || ((errors++))
1238
1238
  local claude_agent_action="${NEOCORTEX_MANAGED_ACTION:-}"
1239
1239
  copy_file "$CLAUDE_TARGET_DIR/neocortex.agent.yaml" "$DEST_DIR/" || ((errors++))
1240
+ # 4.64.3: the root profile (owns *yoloop) ships beside the subagent stub;
1241
+ # without it a fresh install had no `neocortex-root` agent in Claude Code.
1242
+ if [ -f "$CLAUDE_TARGET_DIR/neocortex-root.md" ]; then
1243
+ managed_copy_file "$CLAUDE_TARGET_DIR/neocortex-root.md" "$AGENTS_DIR/neocortex-root.md" "profile-claude-neocortex-root-agent" "$HOME" || ((errors++))
1244
+ if [ -f "$CLAUDE_TARGET_DIR/neocortex-root.agent.yaml" ]; then
1245
+ copy_file "$CLAUDE_TARGET_DIR/neocortex-root.agent.yaml" "$DEST_DIR/" || ((errors++))
1246
+ fi
1247
+ fi
1240
1248
 
1241
1249
  # Epic 65: Post-copy verification
1242
1250
  if [ ! -f "$AGENTS_DIR/neocortex.md" ]; then
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ornexus/neocortex",
3
- "version": "4.64.2",
4
- "description": "Neocortex v4.64.2",
3
+ "version": "4.64.4",
4
+ "description": "Neocortex v4.64.4",
5
5
  "keywords": [
6
6
  "claude",
7
7
  "claude-code",
@@ -1,2 +1,2 @@
1
- import{readFileSync as m,writeFileSync as I,existsSync as i,mkdirSync as C,renameSync as z,unlinkSync as M}from"node:fs";import{join as t,dirname as j,relative as L,isAbsolute as Q}from"node:path";import{homedir as l}from"node:os";import{createRequire as Z}from"node:module";import{fileURLToPath as ee}from"node:url";import{setSecureFilePermissions as P}from"../config/secure-config.js";const te=60,re=25,oe=Z(import.meta.url),ne={"codex:AGENTS.md":"profile-codex-root","codex:neocortex.toml":"profile-codex-neocortex"};function ie(o,e){const r=e?.CODEX_HOME;return r&&Q(r)?r:t(o,".codex")}function ce(o){try{const e=JSON.parse(m(t(o,".neocortex","config.json"),"utf8"));if(e.tier==="free")return"Free";if(e.tier==="pro")return"Pro";if(e.tier==="enterprise")return"Enterprise"}catch{}}function ve(o,e){try{const r=m(o,"utf-8"),c=r,d=B(r,e);d!==c&&I(o,d,"utf-8")}catch{}}function B(o,e){try{let r=o.replace(/🧠 Neocortex v[\d.]+/g,`\u{1F9E0} Neocortex v${e}`);return r=r.replace(/# Neocortex v[\d.]+/g,`# Neocortex v${e}`),r=r.replace(/^(│ ### ######## v)[\d.]+(\s*│)$/gm,()=>{const c=`v${e}`,d=te-re-c.length;return`\u2502 ### ######## ${c}${" ".repeat(Math.max(0,d))}\u2502`}),r=r.replace(/version: '[\d.]+'/g,`version: '${e}'`),r}catch{return o}}const se="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`.",ae="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.",Ee="`--args` remains the default input path; `--stdin` and `--args-file` are limited to oversized explicit user payloads";function Ne(o){const e=o.replace(/\s+/g," ").trim();return e.includes(se)&&e.includes(ae)}const G=/^(---(?:\r\n|\n)[\s\S]*?(?:\r\n|\n)---)(?=\r\n|\n|$)/;function le(o,e){if(e===void 0)return o;const r=o.match(G)?.[1],c=e.match(G)?.[1];return!r||!c?o:`${c}${o.slice(r.length)}`}const _=t(l(),".claude","agents"),de=[{destDir:t(_,"neocortex"),sourceDir:"claude-code",files:["neocortex.md","neocortex.agent.yaml","neocortex-root.md","neocortex-root.agent.yaml"],fileDestDirs:{"neocortex.md":_,"neocortex-root.md":_}},{destDir:t(l(),".gemini","agents"),sourceDir:"gemini-cli",files:["agent.md"]},{destDir:t(l(),".cursor","agents"),sourceDir:"cursor",files:["agent.md"]},{destDir:t(l(),".kimi-code","agents"),sourceDir:"kimi",files:["neocortex.md"]},{destDir:t(l(),".opencode","agents"),sourceDir:"opencode",files:["neocortex.md","neocortex-root.md"]},{destDir:t(l(),".codex"),sourceDir:"codex",files:["AGENTS.md"]},{destDir:t(l(),".codex","agents"),sourceDir:"codex",files:["neocortex.toml"]},{destDir:t(l(),".copilot","agents"),sourceDir:"vscode",files:["neocortex.agent.md"]},{destDir:t(l(),".agent","skills","neocortex"),sourceDir:"antigravity",files:["skill/SKILL.md"]},{destDir:t(l(),".gemini","config","agents"),sourceDir:"antigravity",files:["neocortex.md"]},{destDir:t(l(),".grok","skills","neocortex"),sourceDir:"grok",files:["SKILL.md"]}];function ue(){try{const o=ee(import.meta.url);let e=j(o);for(let r=0;r<10;r++){try{if(JSON.parse(m(t(e,"package.json"),"utf-8")).name==="@ornexus/neocortex")return e}catch{}e=j(e)}}catch{}return null}function fe(o){try{const e=t(o,".version");if(i(e))return m(e,"utf-8").trim()||null}catch{}return null}function me(o,e){const r=`${o}.tmp-${process.pid}`;try{I(r,e,"utf8"),P(r),z(r,o),P(o)}catch(c){try{i(r)&&M(r)}catch{}throw c}}function Ae(o,e){try{const r=e?.forceCreate??!1,c=e?.targetFilter,d=e?.dryRun??!1,v=l(),s=e?.homeDir??v,R=e?.packageRoot??ue();if(!R)return 0;const E=t(R,"targets-stubs");if(!i(E))return 0;const F=t(E,"lib","managed-config-merge.js");if(!i(F))return 0;const N=oe(F),T=t(s,".neocortex","managed-config-manifest.json"),U=ce(s),H=e?.env??(e?.homeDir?void 0:process.env),A=ie(s,H),Y=t(v,".codex");try{N.applyPolicy({configFile:t(s,".neocortex","config.json"),manifestFile:T,baseDir:s,dryRun:d})}catch{}let y=0;for(const a of de)try{const p=a.sourceDir==="codex",$=n=>p?t(A,L(Y,n)):e?.homeDir?t(s,L(v,n)):n,u=$(a.destDir);if(c&&a.sourceDir!==c)continue;if(!i(u)){if(r&&!d)C(u,{recursive:!0});else if(!(r&&d))continue}const S=t(E,a.sourceDir),b=n=>{const x=a.fileDestDirs?.[n];return x?t($(x),n):t(u,n)},W=fe(u),X=a.files.every(n=>!i(t(S,n))||i(b(n)));if(W===o&&X||!i(S))continue;let g=s;if(p){if(!i(A))continue;g=N.resolveManagedBase(A,s)}const q=g===s?T:t(g,".neocortex","managed-config-manifest.json");let k=!1;for(const n of a.files){const x=t(S,n),J=a.fileDestDirs?.[n],D=b(n),f=J?t(u,n):null;if(i(x)){let h=m(x,"utf8");if(n.endsWith(".md")){const w=i(D)?D:f&&i(f)?f:null,V=w?m(w,"utf8"):void 0;h=le(h,V)}(n.endsWith(".md")||n.endsWith(".yaml")||n.endsWith(".yml"))&&(h=B(h,o));const K=L(s,D).split("\\").join("/"),O=N.applyProfileBytes({id:ne[`${a.sourceDir}:${n}`]??`profile-${a.sourceDir}-${K}`,content:h,destination:D,manifestFile:q,baseDir:g,dryRun:d,allowLegacyAdoption:!0,tierLabel:U,adoptExistingOwner:!0,legacyBaseDir:g===s?null:s});if(O.action!=="failed"&&(k=!0),f&&!d&&O.action!=="failed"&&i(D)&&i(f))try{M(f)}catch{}}}if(k&&!d){const n=t(u,".version");me(n,o+`
2
- `),y++}else k&&y++}catch{}if(y>0)try{const a=t(s,".neocortex");C(a,{recursive:!0});const p=t(a,".update-check");I(p,"",{flag:"w"}),P(p)}catch{}return y}catch{return 0}}export{se as SELECTED_PAYLOAD_BOUNDARY_SNIPPET,ae as SELECTED_PAYLOAD_EXCLUSION_SNIPPET,Ee as SELECTED_PAYLOAD_LARGE_INPUT_SNIPPET,de as STUB_TARGETS,Ne as containsSelectedPayloadBoundary,ue as findPackageRoot,B as patchVersionInContent,ve as patchVersionInFile,le as preserveInstalledMarkdownFrontmatter,Ae as refreshStubs};
1
+ import{readFileSync as m,writeFileSync as k,existsSync as i,mkdirSync as C,renameSync as z,unlinkSync as M}from"node:fs";import{join as t,dirname as j,relative as I,isAbsolute as Q}from"node:path";import{homedir as l}from"node:os";import{createRequire as Z}from"node:module";import{fileURLToPath as ee}from"node:url";import{setSecureFilePermissions as L}from"../config/secure-config.js";const te=60,re=25,oe=Z(import.meta.url),ne={"codex:AGENTS.md":"profile-codex-root","codex:neocortex.toml":"profile-codex-neocortex"};function ie(o,e){const r=e?.CODEX_HOME;return r&&Q(r)?r:t(o,".codex")}function ce(o){try{const e=JSON.parse(m(t(o,".neocortex","config.json"),"utf8"));if(e.tier==="free")return"Free";if(e.tier==="pro")return"Pro";if(e.tier==="enterprise")return"Enterprise"}catch{}}function ve(o,e){try{const r=m(o,"utf-8"),c=r,d=B(r,e);d!==c&&k(o,d,"utf-8")}catch{}}function B(o,e){try{let r=o.replace(/🧠 Neocortex v[\d.]+/g,`\u{1F9E0} Neocortex v${e}`);return r=r.replace(/🧠 Neocortex Root Agent v[\d.]+/g,`\u{1F9E0} Neocortex Root Agent v${e}`),r=r.replace(/# Neocortex v[\d.]+/g,`# Neocortex v${e}`),r=r.replace(/^(│ ### ######## v)[\d.]+(\s*│)$/gm,()=>{const c=`v${e}`,d=te-re-c.length;return`\u2502 ### ######## ${c}${" ".repeat(Math.max(0,d))}\u2502`}),r=r.replace(/version: '[\d.]+'/g,`version: '${e}'`),r}catch{return o}}const se="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`.",ae="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.",Ee="`--args` remains the default input path; `--stdin` and `--args-file` are limited to oversized explicit user payloads";function Ne(o){const e=o.replace(/\s+/g," ").trim();return e.includes(se)&&e.includes(ae)}const G=/^(---(?:\r\n|\n)[\s\S]*?(?:\r\n|\n)---)(?=\r\n|\n|$)/;function le(o,e){if(e===void 0)return o;const r=o.match(G)?.[1],c=e.match(G)?.[1];return!r||!c?o:`${c}${o.slice(r.length)}`}const P=t(l(),".claude","agents"),de=[{destDir:t(P,"neocortex"),sourceDir:"claude-code",files:["neocortex.md","neocortex.agent.yaml","neocortex-root.md","neocortex-root.agent.yaml"],fileDestDirs:{"neocortex.md":P,"neocortex-root.md":P}},{destDir:t(l(),".gemini","agents"),sourceDir:"gemini-cli",files:["agent.md"]},{destDir:t(l(),".cursor","agents"),sourceDir:"cursor",files:["agent.md"]},{destDir:t(l(),".kimi-code","agents"),sourceDir:"kimi",files:["neocortex.md"]},{destDir:t(l(),".opencode","agents"),sourceDir:"opencode",files:["neocortex.md","neocortex-root.md"]},{destDir:t(l(),".codex"),sourceDir:"codex",files:["AGENTS.md"]},{destDir:t(l(),".codex","agents"),sourceDir:"codex",files:["neocortex.toml"]},{destDir:t(l(),".copilot","agents"),sourceDir:"vscode",files:["neocortex.agent.md"]},{destDir:t(l(),".agent","skills","neocortex"),sourceDir:"antigravity",files:["skill/SKILL.md"]},{destDir:t(l(),".gemini","config","agents"),sourceDir:"antigravity",files:["neocortex.md"]},{destDir:t(l(),".grok","skills","neocortex"),sourceDir:"grok",files:["SKILL.md"]}];function ue(){try{const o=ee(import.meta.url);let e=j(o);for(let r=0;r<10;r++){try{if(JSON.parse(m(t(e,"package.json"),"utf-8")).name==="@ornexus/neocortex")return e}catch{}e=j(e)}}catch{}return null}function fe(o){try{const e=t(o,".version");if(i(e))return m(e,"utf-8").trim()||null}catch{}return null}function me(o,e){const r=`${o}.tmp-${process.pid}`;try{k(r,e,"utf8"),L(r),z(r,o),L(o)}catch(c){try{i(r)&&M(r)}catch{}throw c}}function Ae(o,e){try{const r=e?.forceCreate??!1,c=e?.targetFilter,d=e?.dryRun??!1,v=l(),s=e?.homeDir??v,_=e?.packageRoot??ue();if(!_)return 0;const E=t(_,"targets-stubs");if(!i(E))return 0;const F=t(E,"lib","managed-config-merge.js");if(!i(F))return 0;const N=oe(F),T=t(s,".neocortex","managed-config-manifest.json"),U=ce(s),H=e?.env??(e?.homeDir?void 0:process.env),A=ie(s,H),Y=t(v,".codex");try{N.applyPolicy({configFile:t(s,".neocortex","config.json"),manifestFile:T,baseDir:s,dryRun:d})}catch{}let y=0;for(const a of de)try{const g=a.sourceDir==="codex",$=n=>g?t(A,I(Y,n)):e?.homeDir?t(s,I(v,n)):n,u=$(a.destDir);if(c&&a.sourceDir!==c)continue;if(!i(u)){if(r&&!d)C(u,{recursive:!0});else if(!(r&&d))continue}const S=t(E,a.sourceDir),b=n=>{const x=a.fileDestDirs?.[n];return x?t($(x),n):t(u,n)},W=fe(u),X=a.files.every(n=>!i(t(S,n))||i(b(n)));if(W===o&&X||!i(S))continue;let p=s;if(g){if(!i(A))continue;p=N.resolveManagedBase(A,s)}const q=p===s?T:t(p,".neocortex","managed-config-manifest.json");let R=!1;for(const n of a.files){const x=t(S,n),J=a.fileDestDirs?.[n],D=b(n),f=J?t(u,n):null;if(i(x)){let h=m(x,"utf8");if(n.endsWith(".md")){const w=i(D)?D:f&&i(f)?f:null,V=w?m(w,"utf8"):void 0;h=le(h,V)}(n.endsWith(".md")||n.endsWith(".yaml")||n.endsWith(".yml"))&&(h=B(h,o));const K=I(s,D).split("\\").join("/"),O=N.applyProfileBytes({id:ne[`${a.sourceDir}:${n}`]??`profile-${a.sourceDir}-${K}`,content:h,destination:D,manifestFile:q,baseDir:p,dryRun:d,allowLegacyAdoption:!0,tierLabel:U,adoptExistingOwner:!0,legacyBaseDir:p===s?null:s});if(O.action!=="failed"&&(R=!0),f&&!d&&O.action!=="failed"&&i(D)&&i(f))try{M(f)}catch{}}}if(R&&!d){const n=t(u,".version");me(n,o+`
2
+ `),y++}else R&&y++}catch{}if(y>0)try{const a=t(s,".neocortex");C(a,{recursive:!0});const g=t(a,".update-check");k(g,"",{flag:"w"}),L(g)}catch{}return y}catch{return 0}}export{se as SELECTED_PAYLOAD_BOUNDARY_SNIPPET,ae as SELECTED_PAYLOAD_EXCLUSION_SNIPPET,Ee as SELECTED_PAYLOAD_LARGE_INPUT_SNIPPET,de as STUB_TARGETS,Ne as containsSelectedPayloadBoundary,ue as findPackageRoot,B as patchVersionInContent,ve as patchVersionInFile,le as preserveInstalledMarkdownFrontmatter,Ae as refreshStubs};
@@ -492,6 +492,8 @@ export interface StateSnapshot {
492
492
  readonly runnerBootstrap?: InvokeRunnerBootstrapMetadata;
493
493
  /** P222.21: request-only local scheduler observation, never canonical state. */
494
494
  readonly runnerOperationalStatus?: RunnerOperationalStatusV1;
495
+ /** 4.64.3: request-only observation that gates the v4 story-worktree plan. */
496
+ readonly storyWorktreeReadiness?: StoryWorktreeReadinessV1;
495
497
  /**
496
498
  * Request-only bounded structural evidence for architecture and UI review.
497
499
  * It is never persisted, requires explicit --project-evidence opt-in, and
@@ -685,6 +687,29 @@ export interface EpicAwareStateShapeResult {
685
687
  readonly lifecycleDeclared: boolean;
686
688
  readonly runtimeMissing: boolean;
687
689
  }
690
+ export interface StoryWorktreeExecutionBaseV1 {
691
+ readonly epicId: string;
692
+ readonly executionBranch: string;
693
+ readonly originHeadSha: string;
694
+ readonly executionHeadSha: string;
695
+ /** Committed story heads (checkpoint or scheduling evidence) proven to be ancestors of the execution head. */
696
+ readonly containedHeadShas?: readonly string[];
697
+ }
698
+ export interface StoryWorktreeReadinessV1 {
699
+ readonly schemaVersion: 1;
700
+ readonly stateFileTracked: boolean;
701
+ /**
702
+ * Execution-branch heads proven to descend from the epic's recorded
703
+ * origin_binding. Before any story progress the server bases story
704
+ * worktrees on this head, so planning commits (epic/story docs) that exist
705
+ * only on the epic branch are present in every worktree.
706
+ */
707
+ readonly executionBases?: readonly StoryWorktreeExecutionBaseV1[];
708
+ }
709
+ /** Epic targeted by `*yoloop @docs/epics/epic-P…md` or `*yolo @docs/stories/P….NN.story.md`. */
710
+ export declare function storyWorktreeReadinessTargetEpic(args: string): string | undefined;
711
+ /** Undefined outside a Git work tree or when Git cannot answer. */
712
+ export declare function observeStoryWorktreeReadiness(projectRoot: string, epics?: Readonly<Record<string, unknown>>, stories?: Readonly<Record<string, unknown>>, targetEpicId?: string): StoryWorktreeReadinessV1 | undefined;
688
713
  export declare function isEpicAwareCommandId(commandId: string | null | undefined): boolean;
689
714
  /**
690
715
  * Epic-aware commands cannot let generic repair turn a missing/truncated state