@ornexus/neocortex 4.66.22 → 4.66.23

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
@@ -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.22"
22
+ $VERSION = "4.66.23"
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.22"
7
+ VERSION="4.66.23"
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.22",
4
- "description": "Neocortex v4.66.22",
3
+ "version": "4.66.23",
4
+ "description": "Neocortex v4.66.23",
5
5
  "keywords": [
6
6
  "claude",
7
7
  "claude-code",
File without changes
@@ -1,5 +1,5 @@
1
- import{execFile as se}from"node:child_process";import{createHash as ce}from"node:crypto";import{realpath as z}from"node:fs/promises";import{promisify as ue}from"node:util";import{parseYoloopInvocation as de,parseYoloStoryInvocation as he}from"../yoloop/target-normalization.js";import{resolveEpicExecutionCheckout as G}from"./epic-execution-checkout.js";import{recoverLegacyDirectYoloStoryCheckpoint as fe,resolveDirectYoloIntegrationAuthority as le,verifyDirectYoloIntegrationCommit as pe}from"./direct-yolo-checkpoint.js";import{resolveRemoteHeadFreshOptional as Z}from"./epic-lifecycle-evidence.js";import{appendStoryWorktreeEvidence as ye,isStoryWorktreeEvidenceReceiptRecord as we,mutateGitLifecycleRuntime as me,publishedStoryReconciliationId as W,readGitLifecycleRuntime as b,readStoryWorktreeEvidence as V}from"./git-lifecycle-store.js";import{readGovernanceStateSourceSync as ve}from"./governance-runtime-store.js";import{parseNeocortexTrailers as K,trailerValue as C}from"./neocortex-trailers.js";import{StoryWorktreeManager as U}from"./story-worktree-manager.js";const ge=ue(se),q=/^[a-f0-9]{64}$/,H=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/,Se=16;function Y(e){return ce("sha256").update(e).digest("hex")}function k(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function xe(e,t){let r;try{r=k(JSON.parse(e))}catch{return}if(!(r?.schemaVersion!==2||r.storyId!==t||r.publicSafe!==!0||r.status!=="qa-passed"||r.safeToContinueYoloop!==!0||!Array.isArray(r.blockingChecks)||r.blockingChecks.length!==0))return Y(e)}function X(e){const t=de(e)?.remainder;return t?.match(/^@?(?:\.\/)?docs\/epics\/epic-([A-Za-z][A-Za-z0-9_-]{0,63})\.md$/)?.[1]??t?.match(/^@?((?:P|EPIC-)[0-9]+)$/i)?.[1]?.toUpperCase()}function j(e){const t=he(e)?.remainder,r=t?.match(/^@?(?:\.\/)?docs\/stories\/([A-Za-z][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]+)+)\.story\.md(?:[ \t]+(story-worktree-phase-[12]))?$/)??t?.match(/^@?([A-Za-z][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]+)+)$/);return r?{storyId:r[1],phase:!!r[2]}:void 0}async function ke(e,t){const r=X(t);return r?R(e,r,!0):[]}async function Ie(e,t,r){const i=X(t);return i?ee(e,i,r):void 0}async function ee(e,t,r,i){const s=te(e);let u;try{const l=(await s("symbolic-ref","--quiet","--short","HEAD")).trim(),n=await b(e,{required:!0}),v=n.epics[t];if(v?.branch_mode!=="epic"||v.execution_branch!==l||await G(e,t,n)!==await z(e))return;const A=(await s("log","--first-parent","--max-count=16","--format=%H","--fixed-strings",`--grep=Neocortex-Epic: ${t}`,"HEAD")).trim().split(`
2
- `).filter(Boolean),a=ve(e);if(!a.ok||!a.value)return;const p=k(k(JSON.parse(a.value.toString("utf8")))?.stories),w=[];for(const N of A){if(!H.test(N))continue;const[$,...B]=(await s("show","-s","--format=%P%n%B",N)).split(`
3
- `);if(!$||!H.test($))continue;const I=K(B.join(`
4
- `),["Neocortex-Story","Neocortex-Epic","Neocortex-Execution-Branch","Neocortex-Prepared-Base","Neocortex-Bundle-Digest","Neocortex-Graph-Revision","Neocortex-Claim-Revision"]);if(!I.ok)continue;const y=x=>C(I.values,x),h=y("Neocortex-Story");!h||i&&h!==i||!/^[A-Za-z][A-Za-z0-9_-]*\.[A-Za-z0-9._-]+$/.test(h)||y("Neocortex-Epic")!==t||y("Neocortex-Execution-Branch")!==l||y("Neocortex-Prepared-Base")!==$||!["Neocortex-Bundle-Digest","Neocortex-Graph-Revision","Neocortex-Claim-Revision"].every(x=>q.test(y(x)??""))||n.stories[h]?.checkpoint||r.some(x=>x.storyId===h)||k(p?.[h])?.epic_id!==t||w.push({storyId:h,headSha:N,executionBranch:l})}if(w.length!==1)return;u=w[0]}catch{return}const{storyId:f,headSha:c,executionBranch:d}=u;try{const l=await Z(s,d);if(!l)return;try{await s("merge-base","--is-ancestor",c,l)}catch{return}}catch{return{status:"pending",storyId:f,headSha:c,reasonCode:"direct-yolo-recovery-remote-proof-unavailable"}}const m=await fe({projectRoot:e,storyId:f,commitSha:c});if(m.ok)return{status:"recovered",storyId:f,headSha:c};if(m.reasonCode==="direct-yolo-checkpoint-conflict"){const l=await b(e,{required:!0});if(k(l.stories[f]?.checkpoint)?.headSha===c)return}return{status:"pending",storyId:f,headSha:c,reasonCode:m.reasonCode}}function te(e){return async(...t)=>(await ge("git",[...t],{cwd:e,encoding:"utf8",timeout:8e3,maxBuffer:4*1024*1024,env:{...process.env,GIT_OPTIONAL_LOCKS:"0",GIT_TERMINAL_PROMPT:"0"}})).stdout}async function Ge(e,t){return j(t)?.phase!==!0?[]:(await be(e,t)).reconciliations}async function be(e,t){const r=j(t);if(!r){const s=await ke(e,t),u=await Ie(e,t,s);return{reconciliations:s,checkpoint:u}}const i=r.storyId.split(".")[0];if(!r.phase){const s=await R(e,i,!0),u=await ee(e,i,s,r.storyId);return{reconciliations:s,checkpoint:u}}try{const s=await b(e,{required:!0}),u=await G(e,i,s),f=await z(e),c=Object.values(s.storyWorktrees?.entries??{}).filter(d=>d.storyId===r.storyId&&d.state==="active"&&d.worktreePath===f);return{reconciliations:u&&c.length===1?await Ae(u,i):[]}}catch{return{reconciliations:[]}}}function Ae(e,t){return R(e,t,!1)}async function R(e,t,r){const i=te(e),s=async c=>(await i("rev-parse","--verify","--quiet",`${c}^{commit}`)).trim(),u=async(c,d)=>{try{return await i("merge-base","--is-ancestor",c,d),!0}catch{return!1}},f=[];try{const c=(await i("symbolic-ref","--quiet","--short","HEAD")).trim(),d=await s("HEAD"),m=await b(e,{required:!0});if(m.epics[t]?.execution_branch!==c||await G(e,t,m)!==await z(e))return[];const l=Object.values(m.storyWorktrees?.entries??{}).filter(n=>n.epicId===t&&n.executionBranch===c&&n.state==="active");if(l.length>Se)return[];for(const n of l)try{const v=await b(e,{required:!0});if(v.stories[n.storyId]?.checkpoint||l.filter(o=>o.storyId===n.storyId).length!==1||Date.parse(n.expiresAt)>Date.now())continue;const A=k(v.epics[t]?.branch_lease);if(A&&Date.parse(String(A.expiresAt))>Date.now())continue;const a=V(v,t)?.receipts??[];if(a.some(o=>o.kind==="integration-receipt"&&o.storyId===n.storyId))continue;const p=a.filter(o=>o.kind==="phase-one-receipt"&&o.storyId===n.storyId&&o.leaseId===n.leaseId&&o.graphRevision===n.graphRevision);if(p.length!==1)continue;const w=p[0],N=String(w.graphRevision),$=String(w.receiptId);if(!q.test(N)||!H.test(String(w.headSha))||w.specRef!==`docs/stories/${n.storyId}.spec.md`)continue;const B=a.filter(o=>o.kind==="published-story-reconciliation"&&o.storyId===n.storyId&&o.graphRevision===N);if(B.length>1||!r&&B.length===0)continue;const I=await le(e,n.storyId),y=I.originBinding;if(I.epicId!==t||I.executionBranch!==c||!y||y.originBranch===c||!await u(y.originHeadSha,d))continue;const h=await new U({projectRoot:e}).probe(n.leaseId);if(!h.ok||h.value.ownership!=="proven"||h.value.clean!==!0||!h.value.headSha||!H.test(h.value.headSha)||!await u(String(w.headSha),h.value.headSha))continue;const x=(await i("log","--max-count=2","--fixed-strings","--format=%H",`--grep=Neocortex-Story-Worktree-Tip: ${h.value.headSha}`,`${y.originHeadSha}..${d}`)).trim().split(`
5
- `).filter(Boolean);if(x.length!==1||!H.test(x[0]))continue;const g=x[0],re=(await i("show","-s","--format=%P",g)).trim();if(!H.test(re))continue;const D=K(await i("show","-s","--format=%B",g),["Neocortex-Story-Worktree-Tip","Neocortex-Graph-Revision","Neocortex-Review-Artifact-Digest"]);if(!D.ok||C(D.values,"Neocortex-Story-Worktree-Tip")!==h.value.headSha)continue;const E=C(D.values,"Neocortex-Graph-Revision"),F=C(D.values,"Neocortex-Review-Artifact-Digest");if(!E||!q.test(E)||!F||!q.test(F))continue;const ie=(await i("rev-parse",`${g}^{tree}`)).trim(),ne=(await i("rev-parse",`${h.value.headSha}^{tree}`)).trim();if(ie!==ne)continue;const L=await pe(I,n.storyId,g,{expectedGraphRevision:E});if(!L.ok)continue;const oe=k(JSON.parse(await i("show",`${g}:.neocortex/state.json`))),J=k(k(oe?.stories)?.[n.storyId]);if(J?.epic_id!==t||JSON.stringify(J.depends_on??[])!==JSON.stringify(I.story.depends_on??[]))continue;const _=String(w.specRef),P=`docs/stories/${n.storyId}.story.md`;if(Y(await i("show",`${g}:${_}`))!==w.specDigest||Y(await i("show",`${d}:${_}`))!==w.specDigest||await i("show",`${g}:${P}`)!==await i("show",`${d}:${P}`))continue;await i("diff","--quiet","HEAD","--",".neocortex/state.json",_,P);const M=xe(await i("show",`${g}:.neocortex/stories/${n.storyId}/qa-gate-result.json`),n.storyId);if(!M)continue;const S=await Z(i,y.originBranch);if(!S)continue;try{await s(S)}catch{if(!r||(await i("fetch","--quiet","--no-tags","--no-write-fetch-head","--refmap=","origin",S),await s(S)!==S))continue}if(!await u(y.originHeadSha,S)||!await u(g,S))continue;const O={schemaVersion:1,kind:"published-story-reconciliation",epicId:t,storyId:n.storyId,graphRevision:N,historicalGraphRevision:E,phaseOneReceiptId:$,executionBranch:c,executionHeadSha:d,originBranch:y.originBranch,originHeadSha:S,commitSha:g,bundleDigest:L.value.bundleDigest,historicalQaDigest:M},Q=async()=>{if(await s("HEAD")!==d||await s(`refs/heads/${c}`)!==d||await Z(i,y.originBranch)!==S)throw new Error("published-story-reconciliation-ref-raced");const o=await new U({projectRoot:e}).probe(n.leaseId);if(!o.ok||o.value.ownership!=="proven"||o.value.clean!==!0||o.value.headSha!==h.value.headSha)throw new Error("published-story-reconciliation-worktree-raced");await i("diff","--quiet","HEAD","--",".neocortex/state.json",_,P)};if(B[0]){const o=B[0],ae={...O,executionHeadSha:o.executionHeadSha,originHeadSha:o.originHeadSha};if(o.receiptId!==W(ae)||!await u(o.executionHeadSha,d)||!await u(o.originHeadSha,S)||(await Q(),(await b(e,{required:!0})).revision!==v.revision))continue;f.push(o);continue}const T=Object.freeze({...O,receiptId:W(O)});if(!we(T))continue;await me(e,o=>{ye(o,t,{receipts:[T]})},{expectedRevision:v.revision,preCommit:Q}),f.push(T)}catch{}}catch{}return f.length===0?f:Ne(e,t,f,i)}async function Ne(e,t,r,i){try{const s=await b(e,{required:!0}),u=(V(s,t)?.receipts??[]).filter(a=>a.kind==="integration-receipt"&&a.outcome==="integrated").sort((a,p)=>Number(p.integrationIndex)-Number(a.integrationIndex));if(u.length===0)return r;const f=String(u[0].epicHeadAfterSha),c=r[0].executionBranch;if(s.epics[t]?.execution_branch!==c)return r;const d=`refs/heads/${c}`,m=(await i("rev-parse","--verify",d)).trim(),l=async(a,p)=>{if(a===p)return!0;try{return await i("merge-base","--is-ancestor",a,p),!0}catch{return!1}},n=[...new Set([f,...r.map(a=>a.commitSha)])],v=[...n,...r.map(a=>a.executionHeadSha)];if(!(await Promise.all(v.map(a=>l(a,m)))).every(Boolean))return r;let A=m;for(const a of n)if((await Promise.all(n.map(p=>l(p,a)))).every(Boolean)){A=a;break}return(await i("rev-parse","--verify",d)).trim()!==m||(await b(e,{required:!0})).revision!==s.revision?r:r.map(a=>{const p={...a,syncBaseSha:A,syncIntegrationHeadSha:f};return Object.freeze({...p,receiptId:W(p)})})}catch{return r}}export{xe as historicalStoryQaDigest,ke as reconcilePublishedStoriesForYoloop,be as reconcilePublishedWorkflowState,Ie as recoverPublishedCheckpointForYoloop,Ge as revalidatePublishedStoriesForYolo,Ae as revalidatePublishedStoryDependencies};
1
+ import{execFile as ue}from"node:child_process";import{createHash as de}from"node:crypto";import{realpath as T}from"node:fs/promises";import{isDeepStrictEqual as he,promisify as fe}from"node:util";import{parseYoloopInvocation as le,parseYoloStoryInvocation as pe}from"../yoloop/target-normalization.js";import{resolveEpicExecutionCheckout as z}from"./epic-execution-checkout.js";import{recoverLegacyDirectYoloStoryCheckpoint as ye,resolveDirectYoloIntegrationAuthority as we,verifyDirectYoloIntegrationCommit as me}from"./direct-yolo-checkpoint.js";import{resolveRemoteHeadFreshOptional as W}from"./epic-lifecycle-evidence.js";import{appendStoryWorktreeEvidence as ve,isStoryWorktreeEvidenceReceiptRecord as ge,mutateGitLifecycleRuntime as Se,publishedStoryReconciliationId as Y,readGitLifecycleRuntime as I,readStoryWorktreeEvidence as V}from"./git-lifecycle-store.js";import{readGovernanceStateSourceSync as U}from"./governance-runtime-store.js";import{parseNeocortexTrailers as K,trailerValue as P}from"./neocortex-trailers.js";import{StoryWorktreeManager as X}from"./story-worktree-manager.js";const xe=fe(ue),q=/^[a-f0-9]{64}$/,H=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/,be=16;function Z(e){return de("sha256").update(e).digest("hex")}function y(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function ke(e,t){let r;try{r=y(JSON.parse(e))}catch{return}if(!(r?.schemaVersion!==2||r.storyId!==t||r.publicSafe!==!0||r.status!=="qa-passed"||r.safeToContinueYoloop!==!0||!Array.isArray(r.blockingChecks)||r.blockingChecks.length!==0))return Z(e)}function j(e){const t=le(e)?.remainder;return t?.match(/^@?(?:\.\/)?docs\/epics\/epic-([A-Za-z][A-Za-z0-9_-]{0,63})\.md$/)?.[1]??t?.match(/^@?((?:P|EPIC-)[0-9]+)$/i)?.[1]?.toUpperCase()}function ee(e){const t=pe(e)?.remainder,r=t?.match(/^@?(?:\.\/)?docs\/stories\/([A-Za-z][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]+)+)\.story\.md(?:[ \t]+(story-worktree-phase-[12]))?$/)??t?.match(/^@?([A-Za-z][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]+)+)$/);return r?{storyId:r[1],phase:!!r[2]}:void 0}async function Ae(e,t){const r=j(t);return r?J(e,r,!0):[]}async function Ie(e,t,r){const i=j(t);return i?te(e,i,r):void 0}async function te(e,t,r,i){const o=re(e);let d;try{const f=(await o("symbolic-ref","--quiet","--short","HEAD")).trim(),n=await I(e,{required:!0}),p=n.epics[t];if(p?.branch_mode!=="epic"||p.execution_branch!==f||await z(e,t,n)!==await T(e))return;const S=(await o("log","--first-parent","--max-count=16","--format=%H","--fixed-strings",`--grep=Neocortex-Epic: ${t}`,"HEAD")).trim().split(`
2
+ `).filter(Boolean),s=U(e);if(!s.ok||!s.value)return;const m=y(y(JSON.parse(s.value.toString("utf8")))?.stories),g=[];for(const N of S){if(!H.test(N))continue;const[$,...E]=(await o("show","-s","--format=%P%n%B",N)).split(`
3
+ `);if(!$||!H.test($))continue;const A=K(E.join(`
4
+ `),["Neocortex-Story","Neocortex-Epic","Neocortex-Execution-Branch","Neocortex-Prepared-Base","Neocortex-Bundle-Digest","Neocortex-Graph-Revision","Neocortex-Claim-Revision"]);if(!A.ok)continue;const v=k=>P(A.values,k),l=v("Neocortex-Story");!l||i&&l!==i||!/^[A-Za-z][A-Za-z0-9_-]*\.[A-Za-z0-9._-]+$/.test(l)||v("Neocortex-Epic")!==t||v("Neocortex-Execution-Branch")!==f||v("Neocortex-Prepared-Base")!==$||!["Neocortex-Bundle-Digest","Neocortex-Graph-Revision","Neocortex-Claim-Revision"].every(k=>q.test(v(k)??""))||n.stories[l]?.checkpoint||r.some(k=>k.storyId===l)||y(m?.[l])?.epic_id!==t||g.push({storyId:l,headSha:N,executionBranch:f})}if(g.length!==1)return;d=g[0]}catch{return}const{storyId:h,headSha:c,executionBranch:u}=d;try{const f=await W(o,u);if(!f)return;try{await o("merge-base","--is-ancestor",c,f)}catch{return}}catch{return{status:"pending",storyId:h,headSha:c,reasonCode:"direct-yolo-recovery-remote-proof-unavailable"}}const w=await ye({projectRoot:e,storyId:h,commitSha:c});if(w.ok)return{status:"recovered",storyId:h,headSha:c};if(w.reasonCode==="direct-yolo-checkpoint-conflict"){const f=await I(e,{required:!0});if(y(f.stories[h]?.checkpoint)?.headSha===c)return}return{status:"pending",storyId:h,headSha:c,reasonCode:w.reasonCode}}function re(e){return async(...t)=>(await xe("git",[...t],{cwd:e,encoding:"utf8",timeout:8e3,maxBuffer:4*1024*1024,env:{...process.env,GIT_OPTIONAL_LOCKS:"0",GIT_TERMINAL_PROMPT:"0"}})).stdout}async function ie(e,t,r,i){try{await i("diff","--quiet","HEAD","--",".neocortex/state.json");return}catch{}const o=U(e);if(!o.ok||!o.value)throw new Error("published-story-governance-unavailable");const d=y(JSON.parse(await i("show","HEAD:.neocortex/state.json"))),h=y(JSON.parse(o.value.toString("utf8")));if(!d||!h)throw new Error("published-story-governance-invalid");const c=u=>{const w=y(u.epics),f=y(u.stories),n=y(u.inlineYolo);if(!w?.[t]||!f?.[r])throw new Error("published-story-governance-target-missing");return{root:Object.fromEntries(Object.entries(u).filter(([p])=>!["epics","stories","inlineYolo","last_updated"].includes(p))),epic:w[t],stories:Object.fromEntries(Object.entries(f).filter(([p,S])=>p.startsWith(`${t}.`)||y(S)?.epic_id===t)),inline:Object.fromEntries(Object.entries(n??{}).filter(([p,S])=>p===t||p.startsWith(`${t}.`)||y(S)?.epicId===t))}};if(!he(c(d),c(h)))throw new Error("published-story-governance-target-dirty")}async function Ye(e,t){return ee(t)?.phase!==!0?[]:(await Ne(e,t)).reconciliations}async function Ne(e,t){const r=ee(t);if(!r){const o=await Ae(e,t),d=await Ie(e,t,o);return{reconciliations:o,checkpoint:d}}const i=r.storyId.split(".")[0];if(!r.phase){const o=await J(e,i,!0),d=await te(e,i,o,r.storyId);return{reconciliations:o,checkpoint:d}}try{const o=await I(e,{required:!0}),d=await z(e,i,o),h=await T(e),c=Object.values(o.storyWorktrees?.entries??{}).filter(u=>u.storyId===r.storyId&&u.state==="active"&&u.worktreePath===h);return{reconciliations:d&&c.length===1?await Ee(d,i):[]}}catch{return{reconciliations:[]}}}function Ee(e,t){return J(e,t,!1)}async function J(e,t,r){const i=re(e),o=async c=>(await i("rev-parse","--verify","--quiet",`${c}^{commit}`)).trim(),d=async(c,u)=>{try{return await i("merge-base","--is-ancestor",c,u),!0}catch{return!1}},h=[];try{const c=(await i("symbolic-ref","--quiet","--short","HEAD")).trim(),u=await o("HEAD"),w=await I(e,{required:!0});if(w.epics[t]?.execution_branch!==c||await z(e,t,w)!==await T(e))return[];const f=Object.values(w.storyWorktrees?.entries??{}).filter(n=>n.epicId===t&&n.executionBranch===c&&n.state==="active");if(f.length>be)return[];for(const n of f)try{const p=await I(e,{required:!0});if(p.stories[n.storyId]?.checkpoint||f.filter(a=>a.storyId===n.storyId).length!==1||Date.parse(n.expiresAt)>Date.now())continue;const S=y(p.epics[t]?.branch_lease);if(S&&Date.parse(String(S.expiresAt))>Date.now())continue;const s=V(p,t)?.receipts??[];if(s.some(a=>a.kind==="integration-receipt"&&a.storyId===n.storyId))continue;const m=s.filter(a=>a.kind==="phase-one-receipt"&&a.storyId===n.storyId&&a.leaseId===n.leaseId&&a.graphRevision===n.graphRevision);if(m.length!==1)continue;const g=m[0],N=String(g.graphRevision),$=String(g.receiptId);if(!q.test(N)||!H.test(String(g.headSha))||g.specRef!==`docs/stories/${n.storyId}.spec.md`)continue;const E=s.filter(a=>a.kind==="published-story-reconciliation"&&a.storyId===n.storyId&&a.graphRevision===N);if(E.length>1||!r&&E.length===0)continue;const A=await we(e,n.storyId),v=A.originBinding;if(A.epicId!==t||A.executionBranch!==c||!v||v.originBranch===c||!await d(v.originHeadSha,u))continue;const l=await new X({projectRoot:e}).probe(n.leaseId);if(!l.ok||l.value.ownership!=="proven"||l.value.clean!==!0||!l.value.headSha||!H.test(l.value.headSha)||!await d(String(g.headSha),l.value.headSha))continue;const k=(await i("log","--max-count=2","--fixed-strings","--format=%H",`--grep=Neocortex-Story-Worktree-Tip: ${l.value.headSha}`,`${v.originHeadSha}..${u}`)).trim().split(`
5
+ `).filter(Boolean);if(k.length!==1||!H.test(k[0]))continue;const x=k[0],ne=(await i("show","-s","--format=%P",x)).trim();if(!H.test(ne))continue;const B=K(await i("show","-s","--format=%B",x),["Neocortex-Story-Worktree-Tip","Neocortex-Graph-Revision","Neocortex-Review-Artifact-Digest"]);if(!B.ok||P(B.values,"Neocortex-Story-Worktree-Tip")!==l.value.headSha)continue;const D=P(B.values,"Neocortex-Graph-Revision"),F=P(B.values,"Neocortex-Review-Artifact-Digest");if(!D||!q.test(D)||!F||!q.test(F))continue;const oe=(await i("rev-parse",`${x}^{tree}`)).trim(),ae=(await i("rev-parse",`${l.value.headSha}^{tree}`)).trim();if(oe!==ae)continue;const L=await me(A,n.storyId,x,{expectedGraphRevision:D});if(!L.ok)continue;const se=y(JSON.parse(await i("show",`${x}:.neocortex/state.json`))),R=y(y(se?.stories)?.[n.storyId]);if(R?.epic_id!==t||JSON.stringify(R.depends_on??[])!==JSON.stringify(A.story.depends_on??[]))continue;const _=String(g.specRef),O=`docs/stories/${n.storyId}.story.md`;if(Z(await i("show",`${x}:${_}`))!==g.specDigest||Z(await i("show",`${u}:${_}`))!==g.specDigest||await i("show",`${x}:${O}`)!==await i("show",`${u}:${O}`))continue;await ie(e,t,n.storyId,i),await i("diff","--quiet","HEAD","--",_,O);const M=ke(await i("show",`${x}:.neocortex/stories/${n.storyId}/qa-gate-result.json`),n.storyId);if(!M)continue;const b=await W(i,v.originBranch);if(!b)continue;try{await o(b)}catch{if(!r||(await i("fetch","--quiet","--no-tags","--no-write-fetch-head","--refmap=","origin",b),await o(b)!==b))continue}if(!await d(v.originHeadSha,b)||!await d(x,b))continue;const C={schemaVersion:1,kind:"published-story-reconciliation",epicId:t,storyId:n.storyId,graphRevision:N,historicalGraphRevision:D,phaseOneReceiptId:$,executionBranch:c,executionHeadSha:u,originBranch:v.originBranch,originHeadSha:b,commitSha:x,bundleDigest:L.value.bundleDigest,historicalQaDigest:M},Q=async()=>{if(await o("HEAD")!==u||await o(`refs/heads/${c}`)!==u||await W(i,v.originBranch)!==b)throw new Error("published-story-reconciliation-ref-raced");const a=await new X({projectRoot:e}).probe(n.leaseId);if(!a.ok||a.value.ownership!=="proven"||a.value.clean!==!0||a.value.headSha!==l.value.headSha)throw new Error("published-story-reconciliation-worktree-raced");await ie(e,t,n.storyId,i),await i("diff","--quiet","HEAD","--",_,O)};if(E[0]){const a=E[0],ce={...C,executionHeadSha:a.executionHeadSha,originHeadSha:a.originHeadSha};if(a.receiptId!==Y(ce)||!await d(a.executionHeadSha,u)||!await d(a.originHeadSha,b)||(await Q(),(await I(e,{required:!0})).revision!==p.revision))continue;h.push(a);continue}const G=Object.freeze({...C,receiptId:Y(C)});if(!ge(G))continue;await Se(e,a=>{ve(a,t,{receipts:[G]})},{expectedRevision:p.revision,preCommit:Q}),h.push(G)}catch{}}catch{}return h.length===0?h:He(e,t,h,i)}async function He(e,t,r,i){try{const o=await I(e,{required:!0}),d=(V(o,t)?.receipts??[]).filter(s=>s.kind==="integration-receipt"&&s.outcome==="integrated").sort((s,m)=>Number(m.integrationIndex)-Number(s.integrationIndex));if(d.length===0)return r;const h=String(d[0].epicHeadAfterSha),c=r[0].executionBranch;if(o.epics[t]?.execution_branch!==c)return r;const u=`refs/heads/${c}`,w=(await i("rev-parse","--verify",u)).trim(),f=async(s,m)=>{if(s===m)return!0;try{return await i("merge-base","--is-ancestor",s,m),!0}catch{return!1}},n=[...new Set([h,...r.map(s=>s.commitSha)])],p=[...n,...r.map(s=>s.executionHeadSha)];if(!(await Promise.all(p.map(s=>f(s,w)))).every(Boolean))return r;let S=w;for(const s of n)if((await Promise.all(n.map(m=>f(m,s)))).every(Boolean)){S=s;break}return(await i("rev-parse","--verify",u)).trim()!==w||(await I(e,{required:!0})).revision!==o.revision?r:r.map(s=>{const m={...s,syncBaseSha:S,syncIntegrationHeadSha:h};return Object.freeze({...m,receiptId:Y(m)})})}catch{return r}}export{ke as historicalStoryQaDigest,Ae as reconcilePublishedStoriesForYoloop,Ne as reconcilePublishedWorkflowState,Ie as recoverPublishedCheckpointForYoloop,Ye as revalidatePublishedStoriesForYolo,Ee as revalidatePublishedStoryDependencies};
File without changes
@@ -1,4 +1,4 @@
1
- # 🧠 Neocortex v4.66.22 | OrNexus Team
1
+ # 🧠 Neocortex v4.66.23 | OrNexus Team
2
2
 
3
3
  This project uses Neocortex, a Development Orchestrator.
4
4
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.66.22 | OrNexus Team — Development orchestrator candidate (native-needs-validation)."
3
+ description: "🧠 Neocortex v4.66.23 | OrNexus Team — Development orchestrator candidate (native-needs-validation)."
4
4
  status: native-needs-validation
5
5
  source: https://antigravity.google/docs/subagents
6
6
  tools:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.66.22 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.66.23 | OrNexus Team"
4
4
  ---
5
5
 
6
6
  <!--
@@ -4,7 +4,7 @@ agent:
4
4
  name: 'Neocortex Root Agent'
5
5
  title: 'Development Orchestrator (Root alias of neocortex)'
6
6
  icon: '>'
7
- version: '4.66.22'
7
+ version: '4.66.23'
8
8
  architecture: 'thin-client'
9
9
  module: stand-alone
10
10
  hasSidecar: false
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex-root
3
- description: "🧠 Neocortex Root Agent v4.66.22 | OrNexus Team"
3
+ description: "🧠 Neocortex Root Agent v4.66.23 | OrNexus Team"
4
4
  model: opus
5
5
  color: blue
6
6
  tools:
@@ -113,7 +113,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
113
113
  ┌────────────────────────────────────────────────────────────┐
114
114
  │ │
115
115
  │ ####### N E O C O R T E X │
116
- │ ### ######## v4.66.22 │
116
+ │ ### ######## v4.66.23 │
117
117
  │ ######### ##### │
118
118
  │ ## ############## Development Orchestrator │
119
119
  │ ## ### ###### ## OrNexus Team │
@@ -102,7 +102,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
102
102
  ┌────────────────────────────────────────────────────────────┐
103
103
  │ │
104
104
  │ ####### N E O C O R T E X │
105
- │ ### ######## v4.66.22 │
105
+ │ ### ######## v4.66.23 │
106
106
  │ ######### ##### │
107
107
  │ ## ############## Development Orchestrator │
108
108
  │ ## ### ###### ## OrNexus Team │
@@ -4,7 +4,7 @@ agent:
4
4
  name: 'Neocortex'
5
5
  title: 'Development Orchestrator'
6
6
  icon: '>'
7
- version: '4.66.22'
7
+ version: '4.66.23'
8
8
  architecture: 'thin-client'
9
9
  module: stand-alone
10
10
  hasSidecar: false
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.66.22 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.66.23 | OrNexus Team"
4
4
  model: opus
5
5
  color: blue
6
6
  permissionMode: bypassPermissions
@@ -113,7 +113,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
113
113
  ┌────────────────────────────────────────────────────────────┐
114
114
  │ │
115
115
  │ ####### N E O C O R T E X │
116
- │ ### ######## v4.66.22 │
116
+ │ ### ######## v4.66.23 │
117
117
  │ ######### ##### │
118
118
  │ ## ############## Development Orchestrator │
119
119
  │ ## ### ###### ## OrNexus Team │
@@ -28,7 +28,7 @@ returned instructions.
28
28
 
29
29
  <!-- END: Plugin Conflict Prevention -->
30
30
 
31
- # Neocortex v4.66.22 | OrNexus Team
31
+ # Neocortex v4.66.23 | OrNexus Team
32
32
 
33
33
  You are a Development Orchestrator. All orchestration logic is delivered by the remote Neocortex server.
34
34
 
@@ -1,7 +1,7 @@
1
1
  # Codex custom agent reference:
2
2
  # https://developers.openai.com/codex/subagents
3
3
  name = "neocortex"
4
- description = "🧠 Neocortex v4.66.22 | OrNexus Team — Development orchestrator for direct @neocortex requests."
4
+ description = "🧠 Neocortex v4.66.23 | OrNexus Team — Development orchestrator for direct @neocortex requests."
5
5
  # [P201-EV-CODEX-GEMINI] Approval and sandbox keys are intentionally omitted.
6
6
  # Codex reapplies the parent turn's live sandbox/approval settings, including
7
7
  # --yolo, when spawning this profile. This profile must not claim child-only max.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.66.22 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.66.23 | OrNexus Team"
4
4
  model: inherit
5
5
  readonly: false
6
6
  is_background: false
@@ -115,7 +115,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
115
115
  ┌────────────────────────────────────────────────────────────┐
116
116
  │ │
117
117
  │ ####### N E O C O R T E X │
118
- │ ### ######## v4.66.22 │
118
+ │ ### ######## v4.66.23 │
119
119
  │ ######### ##### │
120
120
  │ ## ############## Development Orchestrator │
121
121
  │ ## ### ###### ## OrNexus Team │
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.66.22 | OrNexus Team — Route explicit Neocortex *commands through the public thin client in DeepSeek Harness."
3
+ description: "🧠 Neocortex v4.66.23 | OrNexus Team — Route explicit Neocortex *commands through the public thin client in DeepSeek Harness."
4
4
  user-invocable: true
5
5
  disable-model-invocation: false
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex-root
3
- description: "🧠 Neocortex v4.66.22 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.66.23 | OrNexus Team"
4
4
  kind: local
5
5
  tools:
6
6
  # File operations (Gemini CLI built-ins)
@@ -73,7 +73,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
73
73
  ┌────────────────────────────────────────────────────────────┐
74
74
  │ │
75
75
  │ ####### N E O C O R T E X │
76
- │ ### ######## v4.66.22 │
76
+ │ ### ######## v4.66.23 │
77
77
  │ ######### ##### │
78
78
  │ ## ############## Development Orchestrator │
79
79
  │ ## ### ###### ## OrNexus Team │
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.66.22 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.66.23 | OrNexus Team"
4
4
  kind: local
5
5
  tools:
6
6
  # File operations (Gemini CLI built-ins)
@@ -72,7 +72,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
72
72
  ┌────────────────────────────────────────────────────────────┐
73
73
  │ │
74
74
  │ ####### N E O C O R T E X │
75
- │ ### ######## v4.66.22 │
75
+ │ ### ######## v4.66.23 │
76
76
  │ ######### ##### │
77
77
  │ ## ############## Development Orchestrator │
78
78
  │ ## ### ###### ## OrNexus Team │
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.66.22 | OrNexus Team — Run development orchestration commands through the public thin client."
3
+ description: "🧠 Neocortex v4.66.23 | OrNexus Team — Run development orchestration commands through the public thin client."
4
4
  ---
5
5
 
6
6
  # Neocortex for Grok Build
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.66.22 | OrNexus Team — Development orchestrator candidate (native-needs-validation)."
3
+ description: "🧠 Neocortex v4.66.23 | OrNexus Team — Development orchestrator candidate (native-needs-validation)."
4
4
  status: native-needs-validation
5
5
  source: https://www.kimi.com/code/docs/en/kimi-code-cli/customization/agents.html
6
6
  model_preference: primary
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.66.22 | OrNexus Team — Run Neocortex commands through the public thin client in OpenClaw."
3
+ description: "🧠 Neocortex v4.66.23 | OrNexus Team — Run Neocortex commands through the public thin client in OpenClaw."
4
4
  status: skill-fallback
5
5
  user-invocable: true
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex-root
3
- description: "🧠 Neocortex Root Agent v4.66.22 (Pro) | OrNexus Team — Development orchestrator for *yoloop."
3
+ description: "🧠 Neocortex Root Agent v4.66.23 (Pro) | OrNexus Team — Development orchestrator for *yoloop."
4
4
  mode: primary
5
5
  color: "#00B4FF"
6
6
  permission:
@@ -74,7 +74,7 @@ user's own `*yolo @docs/stories/<id>.story.md` is never refused.
74
74
  ┌────────────────────────────────────────────────────────────┐
75
75
  │ │
76
76
  │ ####### N E O C O R T E X │
77
- │ ### ######## v4.66.22 │
77
+ │ ### ######## v4.66.23 │
78
78
  │ ######### ##### │
79
79
  │ ## ############## Development Orchestrator │
80
80
  │ ## ### ###### ## OrNexus Team │
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.66.22 (Pro) | OrNexus Team — Development orchestrator for *yoloop."
3
+ description: "🧠 Neocortex v4.66.23 (Pro) | OrNexus Team — Development orchestrator for *yoloop."
4
4
  mode: primary
5
5
  color: "#00B4FF"
6
6
  permission:
@@ -73,7 +73,7 @@ user's own `*yolo @docs/stories/<id>.story.md` is never refused.
73
73
  ┌────────────────────────────────────────────────────────────┐
74
74
  │ │
75
75
  │ ####### N E O C O R T E X │
76
- │ ### ######## v4.66.22 │
76
+ │ ### ######## v4.66.23 │
77
77
  │ ######### ##### │
78
78
  │ ## ############## Development Orchestrator │
79
79
  │ ## ### ###### ## OrNexus Team │
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: "neocortex"
3
- description: "Neocortex v4.66.22 | OrNexus Team"
3
+ description: "Neocortex v4.66.23 | OrNexus Team"
4
4
  tools:
5
5
  # Read / Edit (built-in tool sets)
6
6
  - read
@@ -82,7 +82,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
82
82
  ┌────────────────────────────────────────────────────────────┐
83
83
  │ │
84
84
  │ ####### N E O C O R T E X │
85
- │ ### ######## v4.66.22 │
85
+ │ ### ######## v4.66.23 │
86
86
  │ ######### ##### │
87
87
  │ ## ############## Development Orchestrator │
88
88
  │ ## ### ###### ## OrNexus Team │