@ornexus/neocortex 4.66.8 → 4.66.9

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.8"
22
+ $VERSION = "4.66.9"
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.8"
7
+ VERSION="4.66.9"
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.8",
4
- "description": "Neocortex v4.66.8",
3
+ "version": "4.66.9",
4
+ "description": "Neocortex v4.66.9",
5
5
  "keywords": [
6
6
  "claude",
7
7
  "claude-code",
@@ -29,6 +29,7 @@ export declare const DOCTOR_REASON_CODES: Readonly<{
29
29
  readonly MALFORMED_RESPONSE: "malformed-response";
30
30
  readonly AUTHORITY_UNAVAILABLE: "compatibility-authority-unavailable";
31
31
  readonly RELEASE_LIFECYCLE_UNAVAILABLE: "release-lifecycle-unavailable";
32
+ readonly ACTIVE_PRODUCTION_VERIFIED: "active-production-verified";
32
33
  readonly REQUIRED_DIMENSION_BLOCKED: "required-release-dimension-blocked";
33
34
  readonly CLAUDE_WORKTREE_BASEREF_NOT_HEAD: "claude-worktree-baseref-not-head";
34
35
  }>;
@@ -53,6 +54,12 @@ export interface DoctorReleaseDimension {
53
54
  readonly reasonCodes: readonly string[];
54
55
  readonly evidenceRefs: readonly string[];
55
56
  }
57
+ export interface DoctorActiveProduction {
58
+ readonly version: string;
59
+ readonly sourceRevision: string;
60
+ readonly imageDigest: string;
61
+ readonly releaseBindingDigest: string;
62
+ }
56
63
  export interface DoctorReport {
57
64
  readonly schemaVersion: typeof DOCTOR_SCHEMA_VERSION;
58
65
  readonly publicSafe: true;
@@ -80,6 +87,8 @@ export interface DoctorReport {
80
87
  readonly lineageSha256: string | null;
81
88
  readonly requiredDimension: ReleaseDimensionName | null;
82
89
  readonly dimensions: Readonly<Record<ReleaseDimensionName, DoctorReleaseDimension>>;
90
+ /** Current OCI runtime evidence, separate from project candidate receipts. */
91
+ readonly activeProduction?: DoctorActiveProduction;
83
92
  };
84
93
  readonly findings: readonly DoctorFinding[];
85
94
  /** P229.03 (CON-P229.03-DOCTOR): additive; never affects `overall`/`exitCode`. */
@@ -1,2 +1,2 @@
1
- import{Buffer as I}from"node:buffer";import{createHash as x}from"node:crypto";import{execFileSync as J}from"node:child_process";import{readFileSync as Z,statSync as K}from"node:fs";import{join as Q,resolve as ee}from"node:path";import{COMMAND_REGISTRY_CHECKSUM as A,COMMAND_REGISTRY_VERSION as C}from"../generated/command-registry.generated.js";import{DEFAULT_SERVER_URL as U}from"../constants.js";import{getClientVersion as re}from"../version.js";import{inspectClaudeWorktreeBaseRef as te}from"../agent/claude-worktree-base.js";import{PRIVATE_EXECUTION_HOST_KINDS as oe}from"../../../shared/dist/compatibility/index.js";import{createPrivateHarnessExecutorPort as ie,resolvePrivateHarnessDecision as P}from"../private-execution/harness-adapters/index.js";const ne="CompatibilityReleaseDoctor/1.0",se="CompatibilityDoctorResponse/1.0",L=Object.freeze({SUCCESS:0,BLOCKED:1,USAGE:2}),s=Object.freeze({HEALTHY:"doctor-healthy",OFFLINE:"doctor-offline",SERVER_UNREACHABLE:"server-unreachable",CLIENT_TOO_OLD:"client-too-old",SERVER_TOO_OLD:"server-too-old",PROTOCOL_MISMATCH:"protocol-mismatch",SCHEMA_MISMATCH:"schema-mismatch",CAPABILITY_MISMATCH:"capability-mismatch",REGISTRY_DRIFT:"registry-drift",MALFORMED_RESPONSE:"malformed-response",AUTHORITY_UNAVAILABLE:"compatibility-authority-unavailable",RELEASE_LIFECYCLE_UNAVAILABLE:"release-lifecycle-unavailable",REQUIRED_DIMENSION_BLOCKED:"required-release-dimension-blocked",CLAUDE_WORKTREE_BASEREF_NOT_HEAD:"claude-worktree-baseref-not-head"}),D=Object.freeze(["implementationComplete","betaOperable","releaseReady","productionPromoted"]),ae=64*1024,ce=32,le=5e3,T=/^[a-z][a-z0-9-]{0,63}$/u,V=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,79}$/u,v=/^\d{1,6}\.\d{1,6}\.\d{1,6}(?:[-+][A-Za-z0-9.-]{1,40})?$/u,ue=/^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/u,F=/^[a-f0-9]{64}$/u,de=/^[A-Za-z0-9][A-Za-z0-9_-]{15,127}$/u,fe=/^[a-f0-9]{40}(?:[a-f0-9]{24})?$/u,me=/^(?:local-gate|beta-receipt|release-gate|promotion-receipt|sha256):[a-f0-9]{64}$/u,l=Object.freeze({healthy:"No compatibility remediation is required.",offline:"Rerun without --offline when read-only server evidence is available.",unreachable:"Check read-only server reachability, then rerun doctor.",clientTooOld:"Run a separately authorized client update, then rerun doctor.",serverTooOld:"Ask an authorized server operator to update the server, then rerun doctor.",protocol:"Align client and server protocol releases before invoking protected operations.",schema:"Use a client and server pair that supports the required public schemas.",capability:"Enable no feature here; use a release pair with the required capability set.",registry:"Install an exact release pair with the same command-registry checksum.",malformed:"Contact support with the reason code only; do not attach raw response data.",authority:"Integrate the P223.01 shared compatibility authority, then rerun doctor.",lifecycle:"Obtain bounded physical release evidence through separately authorized operations.",required:"Satisfy and verify the required physical release dimension through a separately authorized operation.",claudeWorktree:'Set Claude Code worktree.baseRef to "head" in ~/.claude/settings.json (neocortex refresh adds it when absent) so v4 story worktrees start from the epic checkout.'}),H=new Map([[s.MALFORMED_RESPONSE,0],[s.AUTHORITY_UNAVAILABLE,1],[s.CLIENT_TOO_OLD,2],[s.SERVER_TOO_OLD,3],[s.PROTOCOL_MISMATCH,4],[s.SCHEMA_MISMATCH,5],[s.CAPABILITY_MISMATCH,6],[s.REGISTRY_DRIFT,7],[s.SERVER_UNREACHABLE,8],[s.OFFLINE,9],[s.RELEASE_LIFECYCLE_UNAVAILABLE,10],[s.REQUIRED_DIMENSION_BLOCKED,11],[s.HEALTHY,100]]);function $(e="release-evidence-unavailable"){const r=()=>Object.freeze({value:"unknown",freshness:"unknown",reasonCodes:Object.freeze([e]),evidenceRefs:Object.freeze([])});return Object.freeze({implementationComplete:r(),betaOperable:r(),releaseReady:r(),productionPromoted:r()})}function pe(e){const r=Object.freeze({implementation:"implementationComplete","implementation-complete":"implementationComplete",beta:"betaOperable","beta-operable":"betaOperable",release:"releaseReady","release-ready":"releaseReady",production:"productionPromoted","production-promoted":"productionPromoted"});return e?r[e]??null:null}function ye(e,r=process.env){let t="online",o=!1,i=r.NEOCORTEX_SERVER_URL??U,c=!1,m=null,d=process.cwd();for(let n=0;n<e.length;n+=1){const a=e[n];if(a==="--offline")t="offline";else if(a==="--json")o=!0;else if(a==="--server-url"){const p=e[n+1];if(!p)throw new Error("doctor-server-url-required");i=p,c=!0,n+=1}else if(a==="--require"){const p=e[n+1],f=pe(p);if(!p||!f)throw new Error("doctor-required-dimension-invalid");m=f,n+=1}else if(a==="--project-root"){const p=e[n+1];if(!p||p.length>4096||p.includes("\0"))throw new Error("doctor-project-root-invalid");d=ee(p),n+=1}else throw new Error("doctor-argument-invalid")}if(t==="offline"&&c)throw new Error("doctor-offline-server-url-conflict");if(t==="offline")return Object.freeze({mode:t,json:o,serverUrl:U,requiredDimension:m,projectRoot:d});if(i.length>2048)throw new Error("doctor-server-url-invalid");try{const n=new URL(i);if(n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password||n.search||n.hash)throw new Error("url")}catch{throw new Error("doctor-server-url-invalid")}return Object.freeze({mode:t,json:o,serverUrl:i.replace(/\/+$/u,""),requiredDimension:m,projectRoot:d})}function Ee(e){if(!e||typeof e!="object")return!1;const r=e;return typeof r.createCompatibilityOffer=="function"&&typeof r.isCompatibilityResultV1=="function"&&typeof r.validateReleaseLifecycle=="function"}async function be(){const e=["@neocortex/shared/compatibility","../../../shared/dist/compatibility/index.js"];for(const r of e)try{const t=await import(r);if(Ee(t))return t}catch{}return null}function he(e,r){if(typeof r.createReleaseLifecycleContext!="function")return null;try{const t=Q(e,".neocortex","state.json"),o=K(t);if(!o.isFile()||o.size<=0||o.size>1024*1024)return null;const i=JSON.parse(Z(t,"utf8")),m=(i.config&&typeof i.config=="object"&&!Array.isArray(i.config)?i.config:i.project&&typeof i.project=="object"&&!Array.isArray(i.project)?i.project:null)?.project_id;if(typeof m!="string"||!de.test(m))return null;const d=J("git",["rev-parse","--verify","HEAD"],{cwd:e,encoding:"utf8",timeout:2e3,maxBuffer:1024,stdio:["ignore","pipe","ignore"]}).trim().toLowerCase();if(!fe.test(d))return null;const n=x("sha256").update("git-lineage-v1\0").update(d).digest("hex"),a=`candidate-${x("sha256").update("release-candidate-v1\0").update(m).update("\0").update(d).digest("hex").slice(0,32)}`;return r.createReleaseLifecycleContext({projectId:m,candidateId:a,lineageSha256:n})}catch{return null}}function u(e,r,t,o,i=null){return Object.freeze({severity:e,reasonCode:r,affectedDimension:t,evidenceRef:i,remediation:o})}function Re(e,r){if(!v.test(e)||!v.test(r))return null;const t=c=>c.split(/[-+]/u,1)[0].split(".").map(Number),o=t(e),i=t(r);for(let c=0;c<3;c+=1)if(o[c]!==i[c])return o[c]<i[c]?-1:1;return 0}function g(e){return Object.freeze([...new Set(e.filter(r=>T.test(r)))].slice(0,8).sort())}function q(e){return Object.freeze([...new Set(e.filter(r=>V.test(r)))].slice(0,32).sort())}function B(e){return Object.freeze([...new Set(e.filter(r=>me.test(r)))].slice(0,8).sort())}function Oe(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const r=e,t=r.commandRegistry;return!["compatible","degraded","incompatible"].includes(String(r.status))||typeof r.clientVersion!="string"||!v.test(r.clientVersion)||typeof r.serverVersion!="string"||!v.test(r.serverVersion)||!(r.protocolVersion===null||typeof r.protocolVersion=="string"&&V.test(r.protocolVersion))||!Array.isArray(r.schemaVersions)||!r.schemaVersions.every(o=>typeof o=="string")||!Array.isArray(r.capabilityIds)||!r.capabilityIds.every(o=>typeof o=="string")||!Array.isArray(r.reasonCodes)||!r.reasonCodes.every(o=>typeof o=="string")||!t||typeof t.version!="string"||!ue.test(t.version)||typeof t.checksum!="string"||!F.test(t.checksum)||!["matched","mismatched","unknown"].includes(String(t.status))?null:r}function Ae(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const r=e;if(typeof r.candidateId!="string"||!V.test(r.candidateId)||typeof r.lineageSha256!="string"||!F.test(r.lineageSha256))return null;for(const t of D){const o=r[t];if(!o||typeof o!="object"||Array.isArray(o))return null;const i=o;if(!(typeof i.value=="boolean"||i.value==="unknown")||!["fresh","stale","unknown"].includes(String(i.freshness))||!Array.isArray(i.reasonCodes)||!i.reasonCodes.every(c=>typeof c=="string")||!Array.isArray(i.evidenceRefs)||!i.evidenceRefs.every(c=>typeof c=="string"))return null}return r}function Ce(e){const r={error:0,warning:1,info:2},t=new Map([["compatibility",0],["releaseLifecycle",1],["implementationComplete",2],["betaOperable",3],["releaseReady",4],["productionPromoted",5]]);return Object.freeze([...e].sort((o,i)=>r[o.severity]-r[i.severity]||(H.get(o.reasonCode)??50)-(H.get(i.reasonCode)??50)||(t.get(o.affectedDimension)??99)-(t.get(i.affectedDimension)??99)||o.reasonCode.localeCompare(i.reasonCode)).slice(0,ce))}function ve(e){return Object.freeze({status:"unknown",clientVersion:e,serverVersion:null,protocolVersion:null,schemaVersions:Object.freeze([]),capabilityIds:Object.freeze([]),registry:Object.freeze({localVersion:C,localChecksum:A,remoteVersion:null,remoteChecksum:null,status:"unknown"})})}let w=()=>te();function Be(e){const r=w;return w=e,r}function ge(){let e;try{e=w()}catch{e="unknown"}return e==="absent"||e==="user-value"||e==="settings-invalid"?[u("warning",s.CLAUDE_WORKTREE_BASEREF_NOT_HEAD,"compatibility",l.claudeWorktree,null)]:[]}function E(e){const r=[...e.findings,...ge()],t=e.dimensions??$();let o=e.incompatible;e.requiredDimension&&t[e.requiredDimension].value!==!0&&(o=!0,r.push(u("error",s.REQUIRED_DIMENSION_BLOCKED,e.requiredDimension,l.required,t[e.requiredDimension].evidenceRefs[0]??null)));const i=Ce(r),c=o?"incompatible":i.some(m=>m.severity==="warning")?"degraded":"healthy";return Object.freeze({schemaVersion:ne,publicSafe:!0,readOnly:!0,mode:e.mode,overall:c,exitCode:o?L.BLOCKED:L.SUCCESS,compatibility:e.compatibility??ve(e.clientVersion),release:Object.freeze({candidateId:e.candidateId??null,lineageSha256:e.lineageSha256??null,requiredDimension:e.requiredDimension,dimensions:t}),findings:i})}function Se(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const r=e;return"compatibility"in r?r.schemaVersion!==void 0&&r.schemaVersion!==se?null:{compatibility:r.compatibility,...r.releaseLifecycle!==void 0?{releaseLifecycle:r.releaseLifecycle}:{}}:{compatibility:e}}async function _e(e,r,t,o){const i=new AbortController,c=setTimeout(()=>i.abort(),le);try{const m=I.from(JSON.stringify(t),"utf8").toString("base64url");if(m.length>8192)return{kind:"malformed"};const d=o===null?null:I.from(JSON.stringify(o),"utf8").toString("base64url");if(d&&d.length>2048)return{kind:"malformed"};const n=await e(`${r}/api/v1/compatibility`,{method:"GET",headers:Object.freeze({Accept:"application/json","Cache-Control":"no-store","X-Neocortex-Compatibility-Offer":m,...d?{"X-Neocortex-Release-Context":d}:{}}),signal:i.signal});if(n.status===404||n.status===405||n.status===426)return{kind:"server-too-old"};if(!n.ok)return n.status>=500?{kind:"unreachable"}:{kind:"malformed"};const a=await n.text();if(I.byteLength(a,"utf8")>ae)return{kind:"malformed"};try{return{kind:"ok",value:JSON.parse(a)}}catch{return{kind:"malformed"}}}catch{return{kind:"unreachable"}}finally{clearTimeout(c)}}function Ie(e,r){return E({mode:"offline",clientVersion:e,requiredDimension:r,incompatible:!1,findings:[u("warning",s.OFFLINE,"compatibility",l.offline),u("warning",s.RELEASE_LIFECYCLE_UNAVAILABLE,"releaseLifecycle",l.lifecycle)]})}const Y="private-executor-headless-unavailable",G="private-executor-version-unsupported",X=/^\d{1,9}\.\d{1,9}\.\d{1,9}$/u,S=Object.freeze({availability:"absent",version:null,refusalReasonCode:null});async function Le(e,r={}){try{const o=P(e)?.kind==="adapter"?ie(e,r):void 0;if(o===void 0)return Object.freeze({availability:"refused",version:null,refusalReasonCode:Y});const i=await o.preflight();return X.test(i.hostVersion)?Object.freeze({availability:"available",version:i.hostVersion,refusalReasonCode:null}):S}catch(t){return t instanceof Error&&t.message===G?Object.freeze({availability:"refused",version:null,refusalReasonCode:G}):S}}function De(e){if(!e||typeof e!="object"||Array.isArray(e))return S;const r=e,t=r.version,o=r.refusalReasonCode;return r.availability==="available"&&typeof t=="string"&&X.test(t)&&o===null?Object.freeze({availability:"available",version:t,refusalReasonCode:null}):r.availability==="refused"&&t===null&&typeof o=="string"&&T.test(o)?Object.freeze({availability:"refused",version:null,refusalReasonCode:o}):S}async function Te(e,r){const t=r.probePrivateExecutor,o=await Promise.all(oe.map(async i=>{if(t===void 0)return Object.freeze({hostKind:i,...P(i)?.kind==="refusal"?{availability:"refused",version:null,refusalReasonCode:Y}:{availability:"not-probed",version:null,refusalReasonCode:null}});let c;try{c=await t(i)}catch{c=void 0}return Object.freeze({hostKind:i,...De(c)})}));return Object.freeze(o)}async function Ve(e,r={}){const[t,o]=await Promise.all([we(e,r),Te(e.projectRoot,r)]);return Object.freeze({...t,privateExecutors:o})}async function we(e,r){const t=(r.getClientVersion??re)();if(e.mode==="offline")return Ie(t,e.requiredDimension);const o=await(r.loadCompatibilityAuthority??be)();if(!o)return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",s.AUTHORITY_UNAVAILABLE,"compatibility",l.authority)]});let i;try{i=o.createCompatibilityOffer({clientVersion:t,registryVersion:C,registryChecksum:A})}catch{return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",s.AUTHORITY_UNAVAILABLE,"compatibility",l.authority)]})}const c=(r.collectReleaseContext??he)(e.projectRoot,o),m=r.fetch??globalThis.fetch,d=await _e(m,e.serverUrl,i,c);if(d.kind==="unreachable")return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!1,findings:[u("warning",s.SERVER_UNREACHABLE,"compatibility",l.unreachable),u("warning",s.RELEASE_LIFECYCLE_UNAVAILABLE,"releaseLifecycle",l.lifecycle)]});if(d.kind==="server-too-old")return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",s.SERVER_TOO_OLD,"compatibility",l.serverTooOld),u("warning",s.RELEASE_LIFECYCLE_UNAVAILABLE,"releaseLifecycle",l.lifecycle)]});if(d.kind==="malformed")return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",s.MALFORMED_RESPONSE,"compatibility",l.malformed)]});const n=Se(d.value);if(!n||!o.isCompatibilityResultV1(n.compatibility))return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",s.MALFORMED_RESPONSE,"compatibility",l.malformed)]});const a=Oe(n.compatibility);if(!a||a.clientVersion!==t)return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",s.MALFORMED_RESPONSE,"compatibility",l.malformed)]});const p=Object.freeze({status:a.status,clientVersion:t,serverVersion:a.serverVersion,protocolVersion:a.protocolVersion,schemaVersions:q(a.schemaVersions),capabilityIds:q(a.capabilityIds),registry:Object.freeze({localVersion:C,localChecksum:A,remoteVersion:a.commandRegistry.version,remoteChecksum:a.commandRegistry.checksum,status:a.commandRegistry.status})}),f=[],h=g(a.reasonCodes),j=Re(t,a.serverVersion);if(a.status==="incompatible"&&j===-1?f.push(u("error",s.CLIENT_TOO_OLD,"compatibility",l.clientTooOld,`client-version:${t}`)):a.status==="incompatible"&&j===1&&f.push(u("error",s.SERVER_TOO_OLD,"compatibility",l.serverTooOld,`server-version:${a.serverVersion}`)),h.some(y=>y.includes("protocol"))&&f.push(u("error",s.PROTOCOL_MISMATCH,"compatibility",l.protocol)),h.some(y=>y.includes("schema"))&&f.push(u("error",s.SCHEMA_MISMATCH,"compatibility",l.schema)),h.some(y=>y.includes("capability"))&&f.push(u("error",s.CAPABILITY_MISMATCH,"compatibility",l.capability)),(a.commandRegistry.status==="mismatched"||a.commandRegistry.version!==C||a.commandRegistry.checksum!==A)&&f.push(u("error",s.REGISTRY_DRIFT,"compatibility",l.registry,`sha256:${a.commandRegistry.checksum}`)),a.status==="incompatible"&&f.length===0)f.push(u("error",s.MALFORMED_RESPONSE,"compatibility",l.malformed));else if(a.status==="degraded")for(const y of h)f.push(u("warning",y,"compatibility",l.lifecycle));let N=$(),M=null,z=null,k=!1;if(n.releaseLifecycle===void 0)f.push(u("warning",s.RELEASE_LIFECYCLE_UNAVAILABLE,"releaseLifecycle",l.lifecycle));else{const y=o.validateReleaseLifecycle(n.releaseLifecycle),R=y.accepted?Ae(y.projection):null;if(R){M=R.candidateId,z=R.lineageSha256;const O={};for(const _ of D){const b=R[_];if(O[_]=Object.freeze({value:b.value,freshness:b.freshness,reasonCodes:g(b.reasonCodes),evidenceRefs:B(b.evidenceRefs)}),b.value!==!0||b.freshness!=="fresh")for(const W of g(b.reasonCodes))f.push(u("warning",W,_,l.lifecycle,B(b.evidenceRefs)[0]??null))}N=Object.freeze(O)}else{k=!0,f.push(u("error",s.MALFORMED_RESPONSE,"releaseLifecycle",l.malformed));for(const O of g(y.reasonCodes))f.push(u("error",O,"releaseLifecycle",l.lifecycle))}}return f.length===0&&f.push(u("info",s.HEALTHY,"compatibility",l.healthy)),E({mode:"online",clientVersion:t,compatibility:p,dimensions:N,candidateId:M,lineageSha256:z,requiredDimension:e.requiredDimension,findings:f,incompatible:a.status==="incompatible"||k})}function je(e){const r=["Neocortex compatibility and release doctor (read-only)",`Result: ${e.overall} (exit ${e.exitCode})`,`Mode: ${e.mode}`,`Compatibility: ${e.compatibility.status}`,`Client: ${e.compatibility.clientVersion}`,`Server: ${e.compatibility.serverVersion??"unknown"}`,`Registry: ${e.compatibility.registry.status}`,"","Release lifecycle:"];for(const t of D){const o=e.release.dimensions[t];r.push(` ${t}: ${String(o.value)} (${o.freshness}) [${o.reasonCodes.join(",")||"none"}]`)}r.push("","Ordered findings:");for(const t of e.findings)r.push(` ${t.severity.toUpperCase()} ${t.reasonCode} dimension=${t.affectedDimension} evidence=${t.evidenceRef??"none"}`),r.push(` ${t.remediation}`);r.push("","Private executors:");for(const t of e.privateExecutors)r.push(` ${t.hostKind}: ${t.availability} version=${t.version??"unknown"} refusal=${t.refusalReasonCode??"none"}`);return r.push("","Doctor made no repairs or state changes."),r.join(`
2
- `)}async function Ye(e,r){const t=r??{},o=t.stdout??console.log,i=t.stderr??console.error;let c;try{c=ye(e,t.env??process.env)}catch(n){const a=n instanceof Error&&T.test(n.message)?n.message:"doctor-argument-invalid";return i(`Error: ${a}`),L.USAGE}const m=c.projectRoot,d=await Ve(c,r===void 0?{...t,probePrivateExecutor:n=>Le(n,{cwd:m})}:t);return o(c.json?JSON.stringify(d,null,2):je(d)),d.exitCode}export{L as DOCTOR_EXIT_CODES,s as DOCTOR_REASON_CODES,se as DOCTOR_RESPONSE_SCHEMA_VERSION,ne as DOCTOR_SCHEMA_VERSION,Be as __setDoctorClaudeWorktreeInspector,he as collectLocalReleaseLifecycleContext,Le as defaultProbePrivateExecutor,Ye as doctorCliHandler,be as loadSharedCompatibilityAuthority,ye as parseDoctorArgs,je as renderDoctorReport,Ve as runDoctor};
1
+ import{Buffer as A}from"node:buffer";import{createHash as U}from"node:crypto";import{execFileSync as Q}from"node:child_process";import{readFileSync as ee,statSync as re}from"node:fs";import{join as te,resolve as ie}from"node:path";import{COMMAND_REGISTRY_CHECKSUM as _,COMMAND_REGISTRY_VERSION as C}from"../generated/command-registry.generated.js";import{DEFAULT_SERVER_URL as h}from"../constants.js";import{getClientVersion as oe}from"../version.js";import{inspectClaudeWorktreeBaseRef as ne}from"../agent/claude-worktree-base.js";import{PRIVATE_EXECUTION_HOST_KINDS as se}from"../../../shared/dist/compatibility/index.js";import{createPrivateHarnessExecutorPort as ae,resolvePrivateHarnessDecision as F}from"../private-execution/harness-adapters/index.js";const ce="CompatibilityReleaseDoctor/1.0",le="CompatibilityDoctorResponse/1.0",T=Object.freeze({SUCCESS:0,BLOCKED:1,USAGE:2}),a=Object.freeze({HEALTHY:"doctor-healthy",OFFLINE:"doctor-offline",SERVER_UNREACHABLE:"server-unreachable",CLIENT_TOO_OLD:"client-too-old",SERVER_TOO_OLD:"server-too-old",PROTOCOL_MISMATCH:"protocol-mismatch",SCHEMA_MISMATCH:"schema-mismatch",CAPABILITY_MISMATCH:"capability-mismatch",REGISTRY_DRIFT:"registry-drift",MALFORMED_RESPONSE:"malformed-response",AUTHORITY_UNAVAILABLE:"compatibility-authority-unavailable",RELEASE_LIFECYCLE_UNAVAILABLE:"release-lifecycle-unavailable",ACTIVE_PRODUCTION_VERIFIED:"active-production-verified",REQUIRED_DIMENSION_BLOCKED:"required-release-dimension-blocked",CLAUDE_WORKTREE_BASEREF_NOT_HEAD:"claude-worktree-baseref-not-head"}),V=Object.freeze(["implementationComplete","betaOperable","releaseReady","productionPromoted"]),$=64*1024,ue=32,q=5e3,w=/^[a-z][a-z0-9-]{0,63}$/u,j=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,79}$/u,S=/^\d{1,6}\.\d{1,6}\.\d{1,6}(?:[-+][A-Za-z0-9.-]{1,40})?$/u,de=/^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/u,H=/^[a-f0-9]{64}$/u,fe=/^[A-Za-z0-9][A-Za-z0-9_-]{15,127}$/u,me=/^[a-f0-9]{40}(?:[a-f0-9]{24})?$/u,pe=/^(?:local-gate|beta-receipt|release-gate|promotion-receipt|sha256):[a-f0-9]{64}$/u,d=Object.freeze({healthy:"No compatibility remediation is required.",offline:"Rerun without --offline when read-only server evidence is available.",unreachable:"Check read-only server reachability, then rerun doctor.",clientTooOld:"Run a separately authorized client update, then rerun doctor.",serverTooOld:"Ask an authorized server operator to update the server, then rerun doctor.",protocol:"Align client and server protocol releases before invoking protected operations.",schema:"Use a client and server pair that supports the required public schemas.",capability:"Enable no feature here; use a release pair with the required capability set.",registry:"Install an exact release pair with the same command-registry checksum.",malformed:"Contact support with the reason code only; do not attach raw response data.",authority:"Integrate the P223.01 shared compatibility authority, then rerun doctor.",lifecycle:"Obtain bounded physical release evidence through separately authorized operations.",required:"Satisfy and verify the required physical release dimension through a separately authorized operation.",claudeWorktree:'Set Claude Code worktree.baseRef to "head" in ~/.claude/settings.json (neocortex refresh adds it when absent) so v4 story worktrees start from the epic checkout.'}),B=new Map([[a.MALFORMED_RESPONSE,0],[a.AUTHORITY_UNAVAILABLE,1],[a.CLIENT_TOO_OLD,2],[a.SERVER_TOO_OLD,3],[a.PROTOCOL_MISMATCH,4],[a.SCHEMA_MISMATCH,5],[a.CAPABILITY_MISMATCH,6],[a.REGISTRY_DRIFT,7],[a.SERVER_UNREACHABLE,8],[a.OFFLINE,9],[a.RELEASE_LIFECYCLE_UNAVAILABLE,10],[a.REQUIRED_DIMENSION_BLOCKED,11],[a.HEALTHY,100]]);function Y(e="release-evidence-unavailable"){const r=()=>Object.freeze({value:"unknown",freshness:"unknown",reasonCodes:Object.freeze([e]),evidenceRefs:Object.freeze([])});return Object.freeze({implementationComplete:r(),betaOperable:r(),releaseReady:r(),productionPromoted:r()})}function ye(e){const r=Object.freeze({implementation:"implementationComplete","implementation-complete":"implementationComplete",beta:"betaOperable","beta-operable":"betaOperable",release:"releaseReady","release-ready":"releaseReady",production:"productionPromoted","production-promoted":"productionPromoted"});return e?r[e]??null:null}function Ee(e,r=process.env){let t="online",i=!1,o=r.NEOCORTEX_SERVER_URL??h,c=!1,f=null,l=process.cwd();for(let n=0;n<e.length;n+=1){const s=e[n];if(s==="--offline")t="offline";else if(s==="--json")i=!0;else if(s==="--server-url"){const y=e[n+1];if(!y)throw new Error("doctor-server-url-required");o=y,c=!0,n+=1}else if(s==="--require"){const y=e[n+1],m=ye(y);if(!y||!m)throw new Error("doctor-required-dimension-invalid");f=m,n+=1}else if(s==="--project-root"){const y=e[n+1];if(!y||y.length>4096||y.includes("\0"))throw new Error("doctor-project-root-invalid");l=ie(y),n+=1}else throw new Error("doctor-argument-invalid")}if(t==="offline"&&c)throw new Error("doctor-offline-server-url-conflict");if(t==="offline")return Object.freeze({mode:t,json:i,serverUrl:h,requiredDimension:f,projectRoot:l});if(o.length>2048)throw new Error("doctor-server-url-invalid");try{const n=new URL(o);if(n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password||n.search||n.hash)throw new Error("url")}catch{throw new Error("doctor-server-url-invalid")}return Object.freeze({mode:t,json:i,serverUrl:o.replace(/\/+$/u,""),requiredDimension:f,projectRoot:l})}function be(e){if(!e||typeof e!="object")return!1;const r=e;return typeof r.createCompatibilityOffer=="function"&&typeof r.isCompatibilityResultV1=="function"&&typeof r.validateReleaseLifecycle=="function"}async function he(){const e=["@neocortex/shared/compatibility","../../../shared/dist/compatibility/index.js"];for(const r of e)try{const t=await import(r);if(be(t))return t}catch{}return null}function Re(e,r){if(typeof r.createReleaseLifecycleContext!="function")return null;try{const t=te(e,".neocortex","state.json"),i=re(t);if(!i.isFile()||i.size<=0||i.size>1024*1024)return null;const o=JSON.parse(ee(t,"utf8")),f=(o.config&&typeof o.config=="object"&&!Array.isArray(o.config)?o.config:o.project&&typeof o.project=="object"&&!Array.isArray(o.project)?o.project:null)?.project_id;if(typeof f!="string"||!fe.test(f))return null;const l=Q("git",["rev-parse","--verify","HEAD"],{cwd:e,encoding:"utf8",timeout:2e3,maxBuffer:1024,stdio:["ignore","pipe","ignore"]}).trim().toLowerCase();if(!me.test(l))return null;const n=U("sha256").update("git-lineage-v1\0").update(l).digest("hex"),s=`candidate-${U("sha256").update("release-candidate-v1\0").update(f).update("\0").update(l).digest("hex").slice(0,32)}`;return r.createReleaseLifecycleContext({projectId:f,candidateId:s,lineageSha256:n})}catch{return null}}function u(e,r,t,i,o=null){return Object.freeze({severity:e,reasonCode:r,affectedDimension:t,evidenceRef:o,remediation:i})}function Oe(e,r){if(!S.test(e)||!S.test(r))return null;const t=c=>c.split(/[-+]/u,1)[0].split(".").map(Number),i=t(e),o=t(r);for(let c=0;c<3;c+=1)if(i[c]!==o[c])return i[c]<o[c]?-1:1;return 0}function I(e){return Object.freeze([...new Set(e.filter(r=>w.test(r)))].slice(0,8).sort())}function G(e){return Object.freeze([...new Set(e.filter(r=>j.test(r)))].slice(0,32).sort())}function X(e){return Object.freeze([...new Set(e.filter(r=>pe.test(r)))].slice(0,8).sort())}function ve(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const r=e,t=r.commandRegistry;return!["compatible","degraded","incompatible"].includes(String(r.status))||typeof r.clientVersion!="string"||!S.test(r.clientVersion)||typeof r.serverVersion!="string"||!S.test(r.serverVersion)||!(r.protocolVersion===null||typeof r.protocolVersion=="string"&&j.test(r.protocolVersion))||!Array.isArray(r.schemaVersions)||!r.schemaVersions.every(i=>typeof i=="string")||!Array.isArray(r.capabilityIds)||!r.capabilityIds.every(i=>typeof i=="string")||!Array.isArray(r.reasonCodes)||!r.reasonCodes.every(i=>typeof i=="string")||!t||typeof t.version!="string"||!de.test(t.version)||typeof t.checksum!="string"||!H.test(t.checksum)||!["matched","mismatched","unknown"].includes(String(t.status))?null:r}function ge(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const r=e;if(typeof r.candidateId!="string"||!j.test(r.candidateId)||typeof r.lineageSha256!="string"||!H.test(r.lineageSha256))return null;for(const t of V){const i=r[t];if(!i||typeof i!="object"||Array.isArray(i))return null;const o=i;if(!(typeof o.value=="boolean"||o.value==="unknown")||!["fresh","stale","unknown"].includes(String(o.freshness))||!Array.isArray(o.reasonCodes)||!o.reasonCodes.every(c=>typeof c=="string")||!Array.isArray(o.evidenceRefs)||!o.evidenceRefs.every(c=>typeof c=="string"))return null}return r}function Ae(e){const r={error:0,warning:1,info:2},t=new Map([["compatibility",0],["releaseLifecycle",1],["implementationComplete",2],["betaOperable",3],["releaseReady",4],["productionPromoted",5]]);return Object.freeze([...e].sort((i,o)=>r[i.severity]-r[o.severity]||(B.get(i.reasonCode)??50)-(B.get(o.reasonCode)??50)||(t.get(i.affectedDimension)??99)-(t.get(o.affectedDimension)??99)||i.reasonCode.localeCompare(o.reasonCode)).slice(0,ue))}function _e(e){return Object.freeze({status:"unknown",clientVersion:e,serverVersion:null,protocolVersion:null,schemaVersions:Object.freeze([]),capabilityIds:Object.freeze([]),registry:Object.freeze({localVersion:C,localChecksum:_,remoteVersion:null,remoteChecksum:null,status:"unknown"})})}let N=()=>ne();function Ge(e){const r=N;return N=e,r}function Ce(){let e;try{e=N()}catch{e="unknown"}return e==="absent"||e==="user-value"||e==="settings-invalid"?[u("warning",a.CLAUDE_WORKTREE_BASEREF_NOT_HEAD,"compatibility",d.claudeWorktree,null)]:[]}function E(e){const r=[...e.findings,...Ce()],t=e.dimensions??Y();let i=e.incompatible;const o=e.requiredDimension==="productionPromoted"&&e.activeProduction!==void 0;e.requiredDimension&&t[e.requiredDimension].value!==!0&&!o&&(i=!0,r.push(u("error",a.REQUIRED_DIMENSION_BLOCKED,e.requiredDimension,d.required,t[e.requiredDimension].evidenceRefs[0]??null)));const c=Ae(r),f=i?"incompatible":c.some(l=>l.severity==="warning")?"degraded":"healthy";return Object.freeze({schemaVersion:ce,publicSafe:!0,readOnly:!0,mode:e.mode,overall:f,exitCode:i?T.BLOCKED:T.SUCCESS,compatibility:e.compatibility??_e(e.clientVersion),release:Object.freeze({candidateId:e.candidateId??null,lineageSha256:e.lineageSha256??null,requiredDimension:e.requiredDimension,dimensions:t,...e.activeProduction?{activeProduction:e.activeProduction}:{}}),findings:c})}function Se(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const r=e;return"compatibility"in r?r.schemaVersion!==void 0&&r.schemaVersion!==le?null:{compatibility:r.compatibility,...r.releaseLifecycle!==void 0?{releaseLifecycle:r.releaseLifecycle}:{}}:{compatibility:e}}async function Ie(e,r,t,i){const o=new AbortController,c=setTimeout(()=>o.abort(),q);try{const f=A.from(JSON.stringify(t),"utf8").toString("base64url");if(f.length>8192)return{kind:"malformed"};const l=i===null?null:A.from(JSON.stringify(i),"utf8").toString("base64url");if(l&&l.length>2048)return{kind:"malformed"};const n=await e(`${r}/api/v1/compatibility`,{method:"GET",headers:Object.freeze({Accept:"application/json","Cache-Control":"no-store","X-Neocortex-Compatibility-Offer":f,...l?{"X-Neocortex-Release-Context":l}:{}}),signal:o.signal,...r===h?{redirect:"error"}:{}});if(n.status===404||n.status===405||n.status===426)return{kind:"server-too-old"};if(!n.ok)return n.status>=500?{kind:"unreachable"}:{kind:"malformed"};const s=await n.text();if(A.byteLength(s,"utf8")>$)return{kind:"malformed"};try{return{kind:"ok",value:JSON.parse(s)}}catch{return{kind:"malformed"}}}catch{return{kind:"unreachable"}}finally{clearTimeout(c)}}async function Le(e,r){const t=/^sha256:[a-f0-9]{64}$/u,i=o=>typeof o=="string"&&t.test(o);try{const o=await e(`${h}/health?deep=true`,{method:"GET",headers:{Accept:"application/json","Cache-Control":"no-store"},cache:"no-store",redirect:"error",signal:AbortSignal.timeout(q)});if(!o.ok)return;const c=await o.text();if(A.byteLength(c,"utf8")>$)return;const f=JSON.parse(c),l=f?.supply_chain,n=f?.asset_authority,s=f?.asset_canary;return f?.status!=="ok"||f.version!==r||l?.verification_enabled!==!0||l.provenance_verified!==!0||l.release_binding_complete!==!0||l.sbom_present!==!0||typeof l.source_revision!="string"||!/^[a-f0-9]{40}$/u.test(l.source_revision)||!i(l.image_digest)||!i(l.sbom_digest)||!i(l.release_binding_digest)||n?.schema_version!==1||n.public_safe!==!0||n.release_generation_compatible!==!0||!i(n.generation)||s?.schema_version!==1||s.public_safe!==!0||s.outcome!=="passed"||s.generation!==n.generation?void 0:Object.freeze({version:r,sourceRevision:l.source_revision,imageDigest:l.image_digest,releaseBindingDigest:l.release_binding_digest})}catch{return}}function De(e,r){return E({mode:"offline",clientVersion:e,requiredDimension:r,incompatible:!1,findings:[u("warning",a.OFFLINE,"compatibility",d.offline),u("warning",a.RELEASE_LIFECYCLE_UNAVAILABLE,"releaseLifecycle",d.lifecycle)]})}const J="private-executor-headless-unavailable",W="private-executor-version-unsupported",Z=/^\d{1,9}\.\d{1,9}\.\d{1,9}$/u,L=Object.freeze({availability:"absent",version:null,refusalReasonCode:null});async function Te(e,r={}){try{const i=F(e)?.kind==="adapter"?ae(e,r):void 0;if(i===void 0)return Object.freeze({availability:"refused",version:null,refusalReasonCode:J});const o=await i.preflight();return Z.test(o.hostVersion)?Object.freeze({availability:"available",version:o.hostVersion,refusalReasonCode:null}):L}catch(t){return t instanceof Error&&t.message===W?Object.freeze({availability:"refused",version:null,refusalReasonCode:W}):L}}function Ve(e){if(!e||typeof e!="object"||Array.isArray(e))return L;const r=e,t=r.version,i=r.refusalReasonCode;return r.availability==="available"&&typeof t=="string"&&Z.test(t)&&i===null?Object.freeze({availability:"available",version:t,refusalReasonCode:null}):r.availability==="refused"&&t===null&&typeof i=="string"&&w.test(i)?Object.freeze({availability:"refused",version:null,refusalReasonCode:i}):L}async function we(e,r){const t=r.probePrivateExecutor,i=await Promise.all(se.map(async o=>{if(t===void 0)return Object.freeze({hostKind:o,...F(o)?.kind==="refusal"?{availability:"refused",version:null,refusalReasonCode:J}:{availability:"not-probed",version:null,refusalReasonCode:null}});let c;try{c=await t(o)}catch{c=void 0}return Object.freeze({hostKind:o,...Ve(c)})}));return Object.freeze(i)}async function je(e,r={}){const[t,i]=await Promise.all([Ne(e,r),we(e.projectRoot,r)]);return Object.freeze({...t,privateExecutors:i})}async function Ne(e,r){const t=(r.getClientVersion??oe)();if(e.mode==="offline")return De(t,e.requiredDimension);const i=await(r.loadCompatibilityAuthority??he)();if(!i)return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",a.AUTHORITY_UNAVAILABLE,"compatibility",d.authority)]});let o;try{o=i.createCompatibilityOffer({clientVersion:t,registryVersion:C,registryChecksum:_})}catch{return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",a.AUTHORITY_UNAVAILABLE,"compatibility",d.authority)]})}const c=(r.collectReleaseContext??Re)(e.projectRoot,i),f=r.fetch??globalThis.fetch,l=await Ie(f,e.serverUrl,o,c);if(l.kind==="unreachable")return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!1,findings:[u("warning",a.SERVER_UNREACHABLE,"compatibility",d.unreachable),u("warning",a.RELEASE_LIFECYCLE_UNAVAILABLE,"releaseLifecycle",d.lifecycle)]});if(l.kind==="server-too-old")return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",a.SERVER_TOO_OLD,"compatibility",d.serverTooOld),u("warning",a.RELEASE_LIFECYCLE_UNAVAILABLE,"releaseLifecycle",d.lifecycle)]});if(l.kind==="malformed")return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",a.MALFORMED_RESPONSE,"compatibility",d.malformed)]});const n=Se(l.value);if(!n||!i.isCompatibilityResultV1(n.compatibility))return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",a.MALFORMED_RESPONSE,"compatibility",d.malformed)]});const s=ve(n.compatibility);if(!s||s.clientVersion!==t)return E({mode:"online",clientVersion:t,requiredDimension:e.requiredDimension,incompatible:!0,findings:[u("error",a.MALFORMED_RESPONSE,"compatibility",d.malformed)]});const y=Object.freeze({status:s.status,clientVersion:t,serverVersion:s.serverVersion,protocolVersion:s.protocolVersion,schemaVersions:G(s.schemaVersions),capabilityIds:G(s.capabilityIds),registry:Object.freeze({localVersion:C,localChecksum:_,remoteVersion:s.commandRegistry.version,remoteChecksum:s.commandRegistry.checksum,status:s.commandRegistry.status})}),m=[],R=I(s.reasonCodes),P=Oe(t,s.serverVersion);if(s.status==="incompatible"&&P===-1?m.push(u("error",a.CLIENT_TOO_OLD,"compatibility",d.clientTooOld,`client-version:${t}`)):s.status==="incompatible"&&P===1&&m.push(u("error",a.SERVER_TOO_OLD,"compatibility",d.serverTooOld,`server-version:${s.serverVersion}`)),R.some(p=>p.includes("protocol"))&&m.push(u("error",a.PROTOCOL_MISMATCH,"compatibility",d.protocol)),R.some(p=>p.includes("schema"))&&m.push(u("error",a.SCHEMA_MISMATCH,"compatibility",d.schema)),R.some(p=>p.includes("capability"))&&m.push(u("error",a.CAPABILITY_MISMATCH,"compatibility",d.capability)),(s.commandRegistry.status==="mismatched"||s.commandRegistry.version!==C||s.commandRegistry.checksum!==_)&&m.push(u("error",a.REGISTRY_DRIFT,"compatibility",d.registry,`sha256:${s.commandRegistry.checksum}`)),s.status==="incompatible"&&m.length===0)m.push(u("error",a.MALFORMED_RESPONSE,"compatibility",d.malformed));else if(s.status==="degraded")for(const p of R)m.push(u("warning",p,"compatibility",d.lifecycle));let M=Y(),k=null,z=null,x=!1,O;if(n.releaseLifecycle===void 0)c===null&&e.serverUrl===h&&(e.requiredDimension===null||e.requiredDimension==="productionPromoted")&&s.status==="compatible"&&m.every(p=>p.severity!=="error")&&(O=await Le(f,s.serverVersion)),O?m.push(u("info",a.ACTIVE_PRODUCTION_VERIFIED,"productionPromoted","The active OCI release reports verified provenance and a complete deployment binding.",O.releaseBindingDigest)):m.push(u("warning",a.RELEASE_LIFECYCLE_UNAVAILABLE,"releaseLifecycle",d.lifecycle));else{const p=i.validateReleaseLifecycle(n.releaseLifecycle),v=p.accepted?ge(p.projection):null;if(v){k=v.candidateId,z=v.lineageSha256;const g={};for(const D of V){const b=v[D];if(g[D]=Object.freeze({value:b.value,freshness:b.freshness,reasonCodes:I(b.reasonCodes),evidenceRefs:X(b.evidenceRefs)}),b.value!==!0||b.freshness!=="fresh")for(const K of I(b.reasonCodes))m.push(u("warning",K,D,d.lifecycle,X(b.evidenceRefs)[0]??null))}M=Object.freeze(g)}else{x=!0,m.push(u("error",a.MALFORMED_RESPONSE,"releaseLifecycle",d.malformed));for(const g of I(p.reasonCodes))m.push(u("error",g,"releaseLifecycle",d.lifecycle))}}return m.length===0&&m.push(u("info",a.HEALTHY,"compatibility",d.healthy)),E({mode:"online",clientVersion:t,compatibility:y,dimensions:M,candidateId:k,lineageSha256:z,activeProduction:O,requiredDimension:e.requiredDimension,findings:m,incompatible:s.status==="incompatible"||x})}function Pe(e){const r=["Neocortex compatibility and release doctor (read-only)",`Result: ${e.overall} (exit ${e.exitCode})`,`Mode: ${e.mode}`,`Compatibility: ${e.compatibility.status}`,`Client: ${e.compatibility.clientVersion}`,`Server: ${e.compatibility.serverVersion??"unknown"}`,`Registry: ${e.compatibility.registry.status}`,"","Project candidate lifecycle:"];for(const t of V){const i=e.release.dimensions[t];r.push(` ${t}: ${String(i.value)} (${i.freshness}) [${i.reasonCodes.join(",")||"none"}]`)}if(e.release.activeProduction){const t=e.release.activeProduction;r.push(` Active production: v${t.version} at ${t.sourceRevision} [${t.releaseBindingDigest}]`)}r.push("","Ordered findings:");for(const t of e.findings)r.push(` ${t.severity.toUpperCase()} ${t.reasonCode} dimension=${t.affectedDimension} evidence=${t.evidenceRef??"none"}`),r.push(` ${t.remediation}`);r.push("","Private executors:");for(const t of e.privateExecutors)r.push(` ${t.hostKind}: ${t.availability} version=${t.version??"unknown"} refusal=${t.refusalReasonCode??"none"}`);return r.push("","Doctor made no repairs or state changes."),r.join(`
2
+ `)}async function Xe(e,r){const t=r??{},i=t.stdout??console.log,o=t.stderr??console.error;let c;try{c=Ee(e,t.env??process.env)}catch(n){const s=n instanceof Error&&w.test(n.message)?n.message:"doctor-argument-invalid";return o(`Error: ${s}`),T.USAGE}const f=c.projectRoot,l=await je(c,r===void 0?{...t,probePrivateExecutor:n=>Te(n,{cwd:f})}:t);return i(c.json?JSON.stringify(l,null,2):Pe(l)),l.exitCode}export{T as DOCTOR_EXIT_CODES,a as DOCTOR_REASON_CODES,le as DOCTOR_RESPONSE_SCHEMA_VERSION,ce as DOCTOR_SCHEMA_VERSION,Ge as __setDoctorClaudeWorktreeInspector,Re as collectLocalReleaseLifecycleContext,Te as defaultProbePrivateExecutor,Xe as doctorCliHandler,he as loadSharedCompatibilityAuthority,Ee as parseDoctorArgs,Pe as renderDoctorReport,je as runDoctor};
@@ -1,4 +1,4 @@
1
- # 🧠 Neocortex v4.66.8 | OrNexus Team
1
+ # 🧠 Neocortex v4.66.9 | 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.8 | OrNexus Team — Development orchestrator candidate (native-needs-validation)."
3
+ description: "🧠 Neocortex v4.66.9 | 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.8 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.66.9 | 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.8'
7
+ version: '4.66.9'
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.8 | OrNexus Team"
3
+ description: "🧠 Neocortex Root Agent v4.66.9 | 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.8 │
116
+ │ ### ######## v4.66.9 │
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.8 │
105
+ │ ### ######## v4.66.9 │
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.8'
7
+ version: '4.66.9'
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.8 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.66.9 | 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.8 │
116
+ │ ### ######## v4.66.9 │
117
117
  │ ######### ##### │
118
118
  │ ## ############## Development Orchestrator │
119
119
  │ ## ### ###### ## OrNexus Team │
@@ -32,7 +32,7 @@ Codex built-in commands or actions.
32
32
 
33
33
  <!-- END: Plugin Conflict Prevention -->
34
34
 
35
- # Neocortex v4.66.8 | OrNexus Team
35
+ # Neocortex v4.66.9 | OrNexus Team
36
36
 
37
37
  You are a Development Orchestrator. All orchestration logic is delivered by the remote Neocortex server.
38
38
 
@@ -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.8 | OrNexus Team — Development orchestrator for direct @neocortex requests."
4
+ description = "🧠 Neocortex v4.66.9 | 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.8 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.66.9 | 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.8 │
118
+ │ ### ######## v4.66.9 │
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.8 | OrNexus Team — Route explicit Neocortex *commands through the public thin client in DeepSeek Harness."
3
+ description: "🧠 Neocortex v4.66.9 | 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.8 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.66.9 | 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.8 │
76
+ │ ### ######## v4.66.9 │
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.8 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.66.9 | 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.8 │
75
+ │ ### ######## v4.66.9 │
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.8 | OrNexus Team — Run development orchestration commands through the public thin client."
3
+ description: "🧠 Neocortex v4.66.9 | 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.8 | OrNexus Team — Development orchestrator candidate (native-needs-validation)."
3
+ description: "🧠 Neocortex v4.66.9 | 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.8 | OrNexus Team — Run Neocortex commands through the public thin client in OpenClaw."
3
+ description: "🧠 Neocortex v4.66.9 | 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.8 (Pro) | OrNexus Team — Development orchestrator for *yoloop."
3
+ description: "🧠 Neocortex Root Agent v4.66.9 (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.8 │
77
+ │ ### ######## v4.66.9 │
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.8 (Pro) | OrNexus Team — Development orchestrator for *yoloop."
3
+ description: "🧠 Neocortex v4.66.9 (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.8 │
76
+ │ ### ######## v4.66.9 │
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.8 | OrNexus Team"
3
+ description: "Neocortex v4.66.9 | 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.8 │
85
+ │ ### ######## v4.66.9 │
86
86
  │ ######### ##### │
87
87
  │ ## ############## Development Orchestrator │
88
88
  │ ## ### ###### ## OrNexus Team │