@arcforge/axon 2.0.157 → 2.0.158

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/declare-worker.js CHANGED
@@ -445,7 +445,7 @@ Project '${G.projectName}' (${Hb[G.projectKind]}) ${W}
445
445
  `,W++};this.projectService.externalProjects.forEach(Q),this.projectService.configuredProjects.forEach(Q),this.projectService.inferredProjects.forEach(Q)}}this.logger.msg(Z,"Err")}send(K){if(K.type==="event"&&!this.canUseEvents){if(this.logger.hasLevel(3))this.logger.info(`Session does not support events: ignored event: ${x_(K)}`);return}this.writeMessage(K)}writeMessage(K){let $=i60(K,this.logger,this.byteLength,this.host.newLine);this.host.write($)}event(K,$){this.send(n60($,K))}doOutput(K,$,J,Z,W,Q){let G={seq:0,type:"response",command:$,request_seq:J,success:Z,performanceData:W&&MP0(W)};if(Z){let H;if(DK(K))G.body=K,H=K.metadata,delete K.metadata;else if(typeof K==="object")if(K.metadata){let{metadata:U,...E}=K;G.body=E,H=U}else G.body=K;else G.body=K;if(H)G.metadata=H}else k.assert(K===void 0);if(Q)G.message=Q;this.send(G)}semanticCheck(K,$){var J,Z;let W=U$();(J=G1)==null||J.push(G1.Phase.Session,"semanticCheck",{file:K,configFilePath:$.canonicalConfigFilePath});let Q=AP0($,K)?yZ:$.getLanguageService().getSemanticDiagnostics(K).filter((G)=>!!G.file);this.sendDiagnosticsEvent(K,$,Q,"semanticDiag",W),(Z=G1)==null||Z.pop()}syntacticCheck(K,$){var J,Z;let W=U$();(J=G1)==null||J.push(G1.Phase.Session,"syntacticCheck",{file:K,configFilePath:$.canonicalConfigFilePath}),this.sendDiagnosticsEvent(K,$,$.getLanguageService().getSyntacticDiagnostics(K),"syntaxDiag",W),(Z=G1)==null||Z.pop()}suggestionCheck(K,$){var J,Z;let W=U$();(J=G1)==null||J.push(G1.Phase.Session,"suggestionCheck",{file:K,configFilePath:$.canonicalConfigFilePath}),this.sendDiagnosticsEvent(K,$,$.getLanguageService().getSuggestionDiagnostics(K),"suggestionDiag",W),(Z=G1)==null||Z.pop()}regionSemanticCheck(K,$,J){var Z,W,Q;let G=U$();(Z=G1)==null||Z.push(G1.Phase.Session,"regionSemanticCheck",{file:K,configFilePath:$.canonicalConfigFilePath});let H;if(!this.shouldDoRegionCheck(K)||!(H=$.getLanguageService().getRegionSemanticDiagnostics(K,J))){(W=G1)==null||W.pop();return}this.sendDiagnosticsEvent(K,$,H.diagnostics,"regionSemanticDiag",G,H.spans),(Q=G1)==null||Q.pop();return}shouldDoRegionCheck(K){var $;let J=($=this.projectService.getScriptInfoForNormalizedPath(K))==null?void 0:$.textStorage.getLineInfo().getLineCount();return!!(J&&J>=this.regionDiagLineCountThreshold)}sendDiagnosticsEvent(K,$,J,Z,W,Q){try{let G=k.checkDefined($.getScriptInfo(K)),H=U$()-W,U={file:K,diagnostics:J.map((E)=>jP0(K,$,E)),spans:Q==null?void 0:Q.map((E)=>dW(E,G))};this.event(U,Z),this.addDiagnosticsPerformanceData(K,Z,H)}catch(G){this.logError(G,Z)}}updateErrorCheck(K,$,J,Z=!0){if($.length===0)return;k.assert(!this.suppressDiagnosticEvents);let W=this.changeSeq,Q=Math.min(J,200),G=0,H=()=>{if(G++,$.length>G)return K.delay("checkOne",Q,E)},U=(O,A)=>{if(this.semanticCheck(O,A),this.changeSeq!==W)return;if(this.getPreferences(O).disableSuggestions)return H();K.immediate("suggestionCheck",()=>{this.suggestionCheck(O,A),H()})},E=()=>{if(this.changeSeq!==W)return;let O,A=$[G];if(bK(A))A=this.toPendingErrorCheck(A);else if("ranges"in A)O=A.ranges,A=this.toPendingErrorCheck(A.file);if(!A)return H();let{fileName:j,project:b}=A;if(X5(b),!b.containsFile(j,Z))return;if(this.syntacticCheck(j,b),this.changeSeq!==W)return;if(b.projectService.serverMode!==0)return H();if(O)return K.immediate("regionSemanticCheck",()=>{let y=this.projectService.getScriptInfoForNormalizedPath(j);if(y)this.regionSemanticCheck(j,b,O.map((R)=>this.getRange({file:j,...R},y)));if(this.changeSeq!==W)return;K.immediate("semanticCheck",()=>U(j,b))});K.immediate("semanticCheck",()=>U(j,b))};if($.length>G&&this.changeSeq===W)K.delay("checkOne",J,E)}cleanProjects(K,$){if(!$)return;this.logger.info(`cleaning ${K}`);for(let J of $)J.getLanguageService(!1).cleanupSemanticCache(),J.cleanupProgram()}cleanup(){if(this.cleanProjects("inferred projects",this.projectService.inferredProjects),this.cleanProjects("configured projects",GK(this.projectService.configuredProjects.values())),this.cleanProjects("external projects",this.projectService.externalProjects),this.host.gc)this.logger.info("host.gc()"),this.host.gc()}getEncodedSyntacticClassifications(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K);return J.getEncodedSyntacticClassifications($,K)}getEncodedSemanticClassifications(K){let{file:$,project:J}=this.getFileAndProject(K),Z=K.format==="2020"?"2020":"original";return J.getLanguageService().getEncodedSemanticClassifications($,K,Z)}getProject(K){return K===void 0?void 0:this.projectService.findProject(K)}getConfigFileAndProject(K){let $=this.getProject(K.projectFileName),J=_$(K.file);return{configFile:$&&$.hasConfigFile(J)?J:void 0,project:$}}getConfigFileDiagnostics(K,$,J){let Z=$.getAllProjectErrors(),W=$.getLanguageService().getCompilerOptionsDiagnostics(),Q=v1(p9(Z,W),(G)=>!!G.file&&G.file.fileName===K);return J?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(Q):wY(Q,(G)=>GR(G,!1))}convertToDiagnosticsWithLinePositionFromDiagnosticFile(K){return K.map(($)=>({message:xW($.messageText,this.host.newLine),start:$.start,length:$.length,category:GB($),code:$.code,source:$.source,startLocation:$.file&&vF(oK($.file,$.start)),endLocation:$.file&&vF(oK($.file,$.start+$.length)),reportsUnnecessary:$.reportsUnnecessary,reportsDeprecated:$.reportsDeprecated,relatedInformation:wY($.relatedInformation,Et)}))}getCompilerOptionsDiagnostics(K){let $=this.getProject(K.projectFileName);return this.convertToDiagnosticsWithLinePosition(v1($.getLanguageService().getCompilerOptionsDiagnostics(),(J)=>!J.file),void 0)}convertToDiagnosticsWithLinePosition(K,$){return K.map((J)=>({message:xW(J.messageText,this.host.newLine),start:J.start,length:J.length,category:GB(J),code:J.code,source:J.source,startLocation:$&&$.positionToLineOffset(J.start),endLocation:$&&$.positionToLineOffset(J.start+J.length),reportsUnnecessary:J.reportsUnnecessary,reportsDeprecated:J.reportsDeprecated,relatedInformation:wY(J.relatedInformation,Et)}))}getDiagnosticsWorker(K,$,J,Z){let{project:W,file:Q}=this.getFileAndProject(K);if($&&AP0(W,Q))return yZ;let G=W.getScriptInfoForNormalizedPath(Q),H=J(W,Q);return Z?this.convertToDiagnosticsWithLinePosition(H,G):H.map((U)=>jP0(Q,W,U))}getDefinition(K,$){let{file:J,project:Z}=this.getFileAndProject(K),W=this.getPositionInFile(K,J),Q=this.mapDefinitionInfoLocations(Z.getLanguageService().getDefinitionAtPosition(J,W)||yZ,Z);return $?this.mapDefinitionInfo(Q,Z):Q.map(Y.mapToOriginalLocation)}mapDefinitionInfoLocations(K,$){return K.map((J)=>{let Z=RP0(J,$);return!Z?J:{...Z,containerKind:J.containerKind,containerName:J.containerName,kind:J.kind,name:J.name,failedAliasResolution:J.failedAliasResolution,...J.unverified&&{unverified:J.unverified}}})}getDefinitionAndBoundSpan(K,$){let{file:J,project:Z}=this.getFileAndProject(K),W=this.getPositionInFile(K,J),Q=k.checkDefined(Z.getScriptInfo(J)),G=Z.getLanguageService().getDefinitionAndBoundSpan(J,W);if(!G||!G.definitions)return{definitions:yZ,textSpan:void 0};let H=this.mapDefinitionInfoLocations(G.definitions,Z),{textSpan:U}=G;if($)return{definitions:this.mapDefinitionInfo(H,Z),textSpan:dW(U,Q)};return{definitions:H.map(Y.mapToOriginalLocation),textSpan:U}}findSourceDefinition(K){var $;let{file:J,project:Z}=this.getFileAndProject(K),W=this.getPositionInFile(K,J),Q=Z.getLanguageService().getDefinitionAtPosition(J,W),G=this.mapDefinitionInfoLocations(Q||yZ,Z).slice();if(this.projectService.serverMode===0&&(!V8(G,(j)=>_$(j.fileName)!==J&&!j.isAmbient)||V8(G,(j)=>!!j.failedAliasResolution))){let j=Bh((N)=>N.textSpan.start,yl(this.host.useCaseSensitiveFileNames));G==null||G.forEach((N)=>j.add(N));let b=Z.getNoDtsResolutionProject(J),y=b.getLanguageService(),R=($=y.getDefinitionAtPosition(J,W,!0,!1))==null?void 0:$.filter((N)=>_$(N.fileName)!==J);if(V8(R))for(let N of R){if(N.unverified){let x=O(N,Z.getLanguageService().getProgram(),y.getProgram());if(V8(x)){for(let C of x)j.add(C);continue}}j.add(N)}else{let N=G.filter((x)=>_$(x.fileName)!==J&&x.isAmbient);for(let x of V8(N)?N:E()){let C=U(x.fileName,J,b);if(!C)continue;let h=this.projectService.getOrCreateScriptInfoNotOpenedByClient(C,b.currentDirectory,b.directoryStructureHost,!1);if(!h)continue;if(!b.containsScriptInfo(h))b.addRoot(h),b.updateGraph();let u=y.getProgram(),o=k.checkDefined(u.getSourceFile(C));for(let i of A(x.name,o,u))j.add(i)}}G=GK(j.values())}return G=G.filter((j)=>!j.isAmbient&&!j.failedAliasResolution),this.mapDefinitionInfo(G,Z);function U(j,b,y){var R,N,x;let C=SM(j);if(C&&j.lastIndexOf($7)===C.topLevelNodeModulesIndex){let h=j.substring(0,C.packageRootIndex),u=(R=Z.getModuleResolutionCache())==null?void 0:R.getPackageJsonInfoCache(),o=Z.getCompilationSettings(),i=Uw($K(h,Z.getCurrentDirectory()),Bw(u,Z,o));if(!i)return;let c=ig(i,{moduleResolution:2},Z,Z.getModuleResolutionCache()),_0=j.substring(C.topLevelPackageNameIndex+1,C.packageRootIndex),Y0=Ow(Cy(_0)),p=Z.toPath(j);if(c&&V8(c,(Q0)=>Z.toPath(Q0)===p))return(N=y.resolutionCache.resolveSingleModuleNameWithoutWatching(Y0,b).resolvedModule)==null?void 0:N.resolvedFileName;else{let Q0=j.substring(C.packageRootIndex+1),z0=`${Y0}/${Y4(Q0)}`;return(x=y.resolutionCache.resolveSingleModuleNameWithoutWatching(z0,b).resolvedModule)==null?void 0:x.resolvedFileName}}return}function E(){let j=Z.getLanguageService(),b=j.getProgram(),y=f4(b.getSourceFile(J),W);if((tX(y)||S0(y))&&R$(y.parent))return Y80(y,(R)=>{var N;if(R===y)return;let x=(N=j.getDefinitionAtPosition(J,R.getStart(),!0,!1))==null?void 0:N.filter((C)=>_$(C.fileName)!==J&&C.isAmbient).map((C)=>({fileName:C.fileName,name:Uz(y)}));if(V8(x))return x})||yZ;return yZ}function O(j,b,y){var R;let N=y.getSourceFile(j.fileName);if(!N)return;let x=f4(b.getSourceFile(J),W),C=b.getTypeChecker().getSymbolAtLocation(x),h=C&&u$(C,277);if(!h)return;let u=((R=h.propertyName)==null?void 0:R.text)||h.name.text;return A(u,N,y)}function A(j,b,y){let R=N$.Core.getTopMostDeclarationNamesInFile(j,b);return m9(R,(N)=>{let x=y.getTypeChecker().getSymbolAtLocation(N),C=Dj(N);if(x&&C)return PF.createDefinitionInfo(C,y.getTypeChecker(),x,C,!0)})}}getEmitOutput(K){let{file:$,project:J}=this.getFileAndProject(K);if(!J.shouldEmitFile(J.getScriptInfo($)))return{emitSkipped:!0,outputFiles:[],diagnostics:[]};let Z=J.getLanguageService().getEmitOutput($);return K.richResponse?{...Z,diagnostics:K.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(Z.diagnostics):Z.diagnostics.map((W)=>GR(W,!0))}:Z}mapJSDocTagInfo(K,$,J){return K?K.map((Z)=>{var W;return{...Z,text:J?this.mapDisplayParts(Z.text,$):(W=Z.text)==null?void 0:W.map((Q)=>Q.text).join("")}}):[]}mapDisplayParts(K,$){if(!K)return[];return K.map((J)=>J.kind!=="linkName"?J:{...J,target:this.toFileSpan(J.target.fileName,J.target.textSpan,$)})}mapSignatureHelpItems(K,$,J){return K.map((Z)=>({...Z,documentation:this.mapDisplayParts(Z.documentation,$),parameters:Z.parameters.map((W)=>({...W,documentation:this.mapDisplayParts(W.documentation,$)})),tags:this.mapJSDocTagInfo(Z.tags,$,J)}))}mapDefinitionInfo(K,$){return K.map((J)=>({...this.toFileSpanWithContext(J.fileName,J.textSpan,J.contextSpan,$),...J.unverified&&{unverified:J.unverified}}))}static mapToOriginalLocation(K){if(K.originalFileName)return k.assert(K.originalTextSpan!==void 0,"originalTextSpan should be present if originalFileName is"),{...K,fileName:K.originalFileName,textSpan:K.originalTextSpan,targetFileName:K.fileName,targetTextSpan:K.textSpan,contextSpan:K.originalContextSpan,targetContextSpan:K.contextSpan};return K}toFileSpan(K,$,J){let Z=J.getLanguageService(),W=Z.toLineColumnOffset(K,$.start),Q=Z.toLineColumnOffset(K,WJ($));return{file:K,start:{line:W.line+1,offset:W.character+1},end:{line:Q.line+1,offset:Q.character+1}}}toFileSpanWithContext(K,$,J,Z){let W=this.toFileSpan(K,$,Z),Q=J&&this.toFileSpan(K,J,Z);return Q?{...W,contextStart:Q.start,contextEnd:Q.end}:W}getTypeDefinition(K){let{file:$,project:J}=this.getFileAndProject(K),Z=this.getPositionInFile(K,$),W=this.mapDefinitionInfoLocations(J.getLanguageService().getTypeDefinitionAtPosition($,Z)||yZ,J);return this.mapDefinitionInfo(W,J)}mapImplementationLocations(K,$){return K.map((J)=>{let Z=RP0(J,$);return!Z?J:{...Z,kind:J.kind,displayParts:J.displayParts}})}getImplementation(K,$){let{file:J,project:Z}=this.getFileAndProject(K),W=this.getPositionInFile(K,J),Q=this.mapImplementationLocations(Z.getLanguageService().getImplementationAtPosition(J,W)||yZ,Z);return $?Q.map(({fileName:G,textSpan:H,contextSpan:U})=>this.toFileSpanWithContext(G,H,U,Z)):Q.map(Y.mapToOriginalLocation)}getSyntacticDiagnosticsSync(K){let{configFile:$}=this.getConfigFileAndProject(K);if($)return yZ;return this.getDiagnosticsWorker(K,!1,(J,Z)=>J.getLanguageService().getSyntacticDiagnostics(Z),!!K.includeLinePosition)}getSemanticDiagnosticsSync(K){let{configFile:$,project:J}=this.getConfigFileAndProject(K);if($)return this.getConfigFileDiagnostics($,J,!!K.includeLinePosition);return this.getDiagnosticsWorker(K,!0,(Z,W)=>Z.getLanguageService().getSemanticDiagnostics(W).filter((Q)=>!!Q.file),!!K.includeLinePosition)}getSuggestionDiagnosticsSync(K){let{configFile:$}=this.getConfigFileAndProject(K);if($)return yZ;return this.getDiagnosticsWorker(K,!0,(J,Z)=>J.getLanguageService().getSuggestionDiagnostics(Z),!!K.includeLinePosition)}getJsxClosingTag(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=this.getPositionInFile(K,$),W=J.getJsxClosingTagAtPosition($,Z);return W===void 0?void 0:{newText:W.newText,caretOffset:0}}getLinkedEditingRange(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=this.getPositionInFile(K,$),W=J.getLinkedEditingRangeAtPosition($,Z),Q=this.projectService.getScriptInfoForNormalizedPath($);if(Q===void 0||W===void 0)return;return d88(W,Q)}getDocumentHighlights(K,$){let{file:J,project:Z}=this.getFileAndProject(K),W=this.getPositionInFile(K,J),Q=Z.getLanguageService().getDocumentHighlights(J,W,K.filesToSearch);if(!Q)return yZ;if(!$)return Q;return Q.map(({fileName:G,highlightSpans:H})=>{let U=Z.getScriptInfo(G);return{file:G,highlightSpans:H.map(({textSpan:E,kind:O,contextSpan:A})=>({...a60(E,A,U),kind:O}))}})}provideInlayHints(K){let{file:$,project:J}=this.getFileAndProject(K),Z=this.projectService.getScriptInfoForNormalizedPath($);return J.getLanguageService().provideInlayHints($,K,this.getPreferences($)).map((Q)=>{let{position:G,displayParts:H}=Q;return{...Q,position:Z.positionToLineOffset(G),displayParts:H==null?void 0:H.map(({text:U,span:E,file:O})=>{if(E){k.assertIsDefined(O,"Target file should be defined together with its span.");let A=this.projectService.getScriptInfo(O);return{text:U,span:{start:A.positionToLineOffset(E.start),end:A.positionToLineOffset(E.start+E.length),file:O}}}else return{text:U}})}})}mapCode(K){var $;let J=this.getHostFormatOptions(),Z=this.getHostPreferences(),{file:W,languageService:Q}=this.getFileAndLanguageServiceForSyntacticOperation(K),G=this.projectService.getScriptInfoForNormalizedPath(W),H=($=K.mapping.focusLocations)==null?void 0:$.map((E)=>{return E.map((O)=>{let A=G.lineOffsetToPosition(O.start.line,O.start.offset),j=G.lineOffsetToPosition(O.end.line,O.end.offset);return{start:A,length:j-A}})}),U=Q.mapCode(W,K.mapping.contents,H,J,Z);return this.mapTextChangesToCodeEdits(U)}getCopilotRelatedInfo(){return{relatedFiles:[]}}setCompilerOptionsForInferredProjects(K){this.projectService.setCompilerOptionsForInferredProjects(K.options,K.projectRootPath)}getProjectInfo(K){return this.getProjectInfoWorker(K.file,K.projectFileName,K.needFileNameList,K.needDefaultConfiguredProjectInfo,!1)}getProjectInfoWorker(K,$,J,Z,W){let{project:Q}=this.getFileAndProjectWorker(K,$);return X5(Q),{configFileName:Q.getProjectName(),languageServiceDisabled:!Q.languageServiceEnabled,fileNames:J?Q.getFileNames(!1,W):void 0,configuredProjectInfo:Z?this.getDefaultConfiguredProjectInfo(K):void 0}}getDefaultConfiguredProjectInfo(K){var $;let J=this.projectService.getScriptInfo(K);if(!J)return;let Z=this.projectService.findDefaultConfiguredProjectWorker(J,3);if(!Z)return;let W,Q;return Z.seenProjects.forEach((G,H)=>{if(H!==Z.defaultProject)if(G!==3)(W??(W=[])).push(_$(H.getConfigFilePath()));else(Q??(Q=[])).push(_$(H.getConfigFilePath()))}),($=Z.seenConfigs)==null||$.forEach((G)=>(W??(W=[])).push(G)),{notMatchedByConfig:W,notInProject:Q,defaultProject:Z.defaultProject&&_$(Z.defaultProject.getConfigFilePath())}}getRenameInfo(K){let{file:$,project:J}=this.getFileAndProject(K),Z=this.getPositionInFile(K,$),W=this.getPreferences($);return J.getLanguageService().getRenameInfo($,Z,W)}getProjects(K,$,J){let Z,W;if(K.projectFileName){let Q=this.getProject(K.projectFileName);if(Q)Z=[Q]}else{let Q=$?this.projectService.getScriptInfoEnsuringProjectsUptoDate(K.file):this.projectService.getScriptInfo(K.file);if(!Q){if(J)return yZ;return this.projectService.logErrorForScriptInfoNotFound(K.file),i7.ThrowNoProject()}else if(!$)this.projectService.ensureDefaultProjectForFile(Q);Z=Q.containingProjects,W=this.projectService.getSymlinkedProjects(Q)}if(Z=v1(Z,(Q)=>Q.languageServiceEnabled&&!Q.isOrphan()),!J&&(!Z||!Z.length)&&!W)return this.projectService.logErrorForScriptInfoNotFound(K.file??K.projectFileName),i7.ThrowNoProject();return W?{projects:Z,symLinkedProjects:W}:Z}getDefaultProject(K){if(K.projectFileName){let J=this.getProject(K.projectFileName);if(J)return J;if(!K.file)return i7.ThrowNoProject()}return this.projectService.getScriptInfo(K.file).getDefaultProject()}getRenameLocations(K,$){let J=_$(K.file),Z=this.getPositionInFile(K,J),W=this.getProjects(K),Q=this.getDefaultProject(K),G=this.getPreferences(J),H=this.mapRenameInfo(Q.getLanguageService().getRenameInfo(J,Z,G),k.checkDefined(this.projectService.getScriptInfo(J)));if(!H.canRename)return $?{info:H,locs:[]}:[];let U=x88(W,Q,{fileName:K.file,pos:Z},!!K.findInStrings,!!K.findInComments,G,this.host.useCaseSensitiveFileNames);if(!$)return U;return{info:H,locs:this.toSpanGroups(U)}}mapRenameInfo(K,$){if(K.canRename){let{canRename:J,fileToRename:Z,displayName:W,fullDisplayName:Q,kind:G,kindModifiers:H,triggerSpan:U}=K;return D$({canRename:J,fileToRename:Z,displayName:W,fullDisplayName:Q,kind:G,kindModifiers:H,triggerSpan:dW(U,$)})}else return K}toSpanGroups(K){let $=new Map;for(let{fileName:J,textSpan:Z,contextSpan:W,originalContextSpan:Q,originalTextSpan:G,originalFileName:H,...U}of K){let E=$.get(J);if(!E)$.set(J,E={file:J,locs:[]});let O=k.checkDefined(this.projectService.getScriptInfo(J));E.locs.push({...a60(Z,W,O),...U})}return GK($.values())}getReferences(K,$){let J=_$(K.file),Z=this.getProjects(K),W=this.getPositionInFile(K,J),Q=S88(Z,this.getDefaultProject(K),{fileName:K.file,pos:W},this.host.useCaseSensitiveFileNames,this.logger);if(!$)return Q;let G=this.getPreferences(J),H=this.getDefaultProject(K),U=H.getScriptInfoForNormalizedPath(J),E=H.getLanguageService().getQuickInfoAtPosition(J,W),O=E?xL(E.displayParts):"",A=E&&E.textSpan,j=A?U.positionToLineOffset(A.start).offset:0,b=A?U.getSnapshot().getText(A.start,WJ(A)):"";return{refs:MX(Q,(R)=>{return R.references.map((N)=>CP0(this.projectService,N,G))}),symbolName:b,symbolStartOffset:j,symbolDisplayString:O}}getFileReferences(K,$){let J=this.getProjects(K),Z=_$(K.file),W=this.getPreferences(Z),Q={fileName:Z,pos:0},G=r60(J,this.getDefaultProject(K),Q,Q,kP0,(E)=>{return this.logger.info(`Finding references to file ${Z} in project ${E.getProjectName()}`),E.getLanguageService().getFileReferences(Z)}),H;if(DK(G))H=G;else{H=[];let E=Bt(this.host.useCaseSensitiveFileNames);G.forEach((O)=>{for(let A of O)if(!E.has(A))H.push(A),E.add(A)})}if(!$)return H;return{refs:H.map((E)=>CP0(this.projectService,E,W)),symbolName:`"${K.file}"`}}openClientFile(K,$,J,Z){this.projectService.openClientFileWithNormalizedPath(K,$,J,!1,Z)}getPosition(K,$){return K.position!==void 0?K.position:$.lineOffsetToPosition(K.line,K.offset)}getPositionInFile(K,$){let J=this.projectService.getScriptInfoForNormalizedPath($);return this.getPosition(K,J)}getFileAndProject(K){return this.getFileAndProjectWorker(K.file,K.projectFileName)}getFileAndLanguageServiceForSyntacticOperation(K){let{file:$,project:J}=this.getFileAndProject(K);return{file:$,languageService:J.getLanguageService(!1)}}getFileAndProjectWorker(K,$){let J=_$(K),Z=this.getProject($)||this.projectService.ensureDefaultProjectForFile(J);return{file:J,project:Z}}getOutliningSpans(K,$){let{file:J,languageService:Z}=this.getFileAndLanguageServiceForSyntacticOperation(K),W=Z.getOutliningSpans(J);if($){let Q=this.projectService.getScriptInfoForNormalizedPath(J);return W.map((G)=>({textSpan:dW(G.textSpan,Q),hintSpan:dW(G.hintSpan,Q),bannerText:G.bannerText,autoCollapse:G.autoCollapse,kind:G.kind}))}else return W}getTodoComments(K){let{file:$,project:J}=this.getFileAndProject(K);return J.getLanguageService().getTodoComments($,K.descriptors)}getDocCommentTemplate(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=this.getPositionInFile(K,$);return J.getDocCommentTemplateAtPosition($,Z,this.getPreferences($),this.getFormatOptions($))}getSpanOfEnclosingComment(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=K.onlyMultiLine,W=this.getPositionInFile(K,$);return J.getSpanOfEnclosingComment($,W,Z)}getIndentation(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=this.getPositionInFile(K,$),W=K.options?RF(K.options):this.getFormatOptions($),Q=J.getIndentationAtPosition($,Z,W);return{position:Z,indentation:Q}}getBreakpointStatement(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=this.getPositionInFile(K,$);return J.getBreakpointStatementAtPosition($,Z)}getNameOrDottedNameSpan(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=this.getPositionInFile(K,$);return J.getNameOrDottedNameSpan($,Z,Z)}isValidBraceCompletion(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=this.getPositionInFile(K,$);return J.isValidBraceCompletionAtPosition($,Z,K.openingBrace.charCodeAt(0))}getQuickInfoWorker(K,$){let{file:J,project:Z}=this.getFileAndProject(K),W=this.projectService.getScriptInfoForNormalizedPath(J),Q=this.getPreferences(J),G=Z.getLanguageService().getQuickInfoAtPosition(J,this.getPosition(K,W),Q.maximumHoverLength,K.verbosityLevel);if(!G)return;let H=!!Q.displayPartsForJSDoc;if($){let U=xL(G.displayParts);return{kind:G.kind,kindModifiers:G.kindModifiers,start:W.positionToLineOffset(G.textSpan.start),end:W.positionToLineOffset(WJ(G.textSpan)),displayString:U,documentation:H?this.mapDisplayParts(G.documentation,Z):xL(G.documentation),tags:this.mapJSDocTagInfo(G.tags,Z,H),canIncreaseVerbosityLevel:G.canIncreaseVerbosityLevel}}else return H?G:{...G,tags:this.mapJSDocTagInfo(G.tags,Z,!1)}}getFormattingEditsForRange(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=this.projectService.getScriptInfoForNormalizedPath($),W=Z.lineOffsetToPosition(K.line,K.offset),Q=Z.lineOffsetToPosition(K.endLine,K.endOffset),G=J.getFormattingEditsForRange($,W,Q,this.getFormatOptions($));if(!G)return;return G.map((H)=>this.convertTextChangeToCodeEdit(H,Z))}getFormattingEditsForRangeFull(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=K.options?RF(K.options):this.getFormatOptions($);return J.getFormattingEditsForRange($,K.position,K.endPosition,Z)}getFormattingEditsForDocumentFull(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=K.options?RF(K.options):this.getFormatOptions($);return J.getFormattingEditsForDocument($,Z)}getFormattingEditsAfterKeystrokeFull(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=K.options?RF(K.options):this.getFormatOptions($);return J.getFormattingEditsAfterKeystroke($,K.position,K.key,Z)}getFormattingEditsAfterKeystroke(K){let{file:$,languageService:J}=this.getFileAndLanguageServiceForSyntacticOperation(K),Z=this.projectService.getScriptInfoForNormalizedPath($),W=Z.lineOffsetToPosition(K.line,K.offset),Q=this.getFormatOptions($),G=J.getFormattingEditsAfterKeystroke($,W,K.key,Q);if(K.key===`
446
446
  `&&(!G||G.length===0||M88(G,W))){let{lineText:H,absolutePosition:U}=Z.textStorage.getAbsolutePositionAndLineText(K.line);if(H&&H.search("\\S")<0){let E=J.getIndentationAtPosition($,W,Q),O=0,A,j;for(A=0,j=H.length;A<j;A++)if(H.charAt(A)===" ")O++;else if(H.charAt(A)==="\t")O+=Q.tabSize;else break;if(E!==O){let b=U+A;G.push({span:hJ(U,b),newText:HZ.getIndentationString(E,Q)})}}}if(!G)return;return G.map((H)=>{return{start:Z.positionToLineOffset(H.span.start),end:Z.positionToLineOffset(WJ(H.span)),newText:H.newText?H.newText:""}})}getCompletions(K,$){let{file:J,project:Z}=this.getFileAndProject(K),W=this.projectService.getScriptInfoForNormalizedPath(J),Q=this.getPosition(K,W),G=Z.getLanguageService().getCompletionsAtPosition(J,Q,{...I60(this.getPreferences(J)),triggerCharacter:K.triggerCharacter,triggerKind:K.triggerKind,includeExternalModuleExports:K.includeExternalModuleExports,includeInsertTextCompletions:K.includeInsertTextCompletions},Z.projectService.getFormatCodeOptions(J));if(G===void 0)return;if($==="completions-full")return G;let H=K.prefix||"",U=m9(G.entries,(O)=>{if(G.isMemberCompletion||t9(O.name.toLowerCase(),H.toLowerCase())){let A=O.replacementSpan?dW(O.replacementSpan,W):void 0;return{...O,replacementSpan:A,hasAction:O.hasAction||void 0,symbol:void 0}}});if($==="completions"){if(G.metadata)U.metadata=G.metadata;return U}return{...G,optionalReplacementSpan:G.optionalReplacementSpan&&dW(G.optionalReplacementSpan,W),entries:U}}getCompletionEntryDetails(K,$){let{file:J,project:Z}=this.getFileAndProject(K),W=this.projectService.getScriptInfoForNormalizedPath(J),Q=this.getPosition(K,W),G=Z.projectService.getFormatCodeOptions(J),H=!!this.getPreferences(J).displayPartsForJSDoc,U=m9(K.entryNames,(E)=>{let{name:O,source:A,data:j}=typeof E==="string"?{name:E,source:void 0,data:void 0}:E;return Z.getLanguageService().getCompletionEntryDetails(J,Q,O,G,A,this.getPreferences(J),j?rK(j,o88):void 0)});return $?H?U:U.map((E)=>({...E,tags:this.mapJSDocTagInfo(E.tags,Z,!1)})):U.map((E)=>({...E,codeActions:wY(E.codeActions,(O)=>this.mapCodeAction(O)),documentation:this.mapDisplayParts(E.documentation,Z),tags:this.mapJSDocTagInfo(E.tags,Z,H)}))}getCompileOnSaveAffectedFileList(K){let $=this.getProjects(K,!0,!0),J=this.projectService.getScriptInfo(K.file);if(!J)return yZ;return C88(J,(Z)=>this.projectService.getScriptInfoForPath(Z),$,(Z,W)=>{if(!Z.compileOnSaveEnabled||!Z.languageServiceEnabled||Z.isOrphan())return;let Q=Z.getCompilationSettings();if(!!Q.noEmit||uZ(W.fileName)&&!N88(Q))return;return{projectFileName:Z.getProjectName(),fileNames:Z.getCompileOnSaveAffectedFileList(W),projectUsesOutFile:!!Q.outFile}})}emitFile(K){let{file:$,project:J}=this.getFileAndProject(K);if(!J)i7.ThrowNoProject();if(!J.languageServiceEnabled)return K.richResponse?{emitSkipped:!0,diagnostics:[]}:!1;let Z=J.getScriptInfo($),{emitSkipped:W,diagnostics:Q}=J.emitFile(Z,(G,H,U)=>this.host.writeFile(G,H,U));return K.richResponse?{emitSkipped:W,diagnostics:K.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(Q):Q.map((G)=>GR(G,!0))}:!W}getSignatureHelpItems(K,$){let{file:J,project:Z}=this.getFileAndProject(K),W=this.projectService.getScriptInfoForNormalizedPath(J),Q=this.getPosition(K,W),G=Z.getLanguageService().getSignatureHelpItems(J,Q,K),H=!!this.getPreferences(J).displayPartsForJSDoc;if(G&&$){let U=G.applicableSpan;return{...G,applicableSpan:{start:W.positionToLineOffset(U.start),end:W.positionToLineOffset(U.start+U.length)},items:this.mapSignatureHelpItems(G.items,Z,H)}}else if(H||!G)return G;else return{...G,items:G.items.map((U)=>({...U,tags:this.mapJSDocTagInfo(U.tags,Z,!1)}))}}toPendingErrorCheck(K){let $=_$(K),J=this.projectService.tryGetDefaultProjectForFile($);return J&&{fileName:$,project:J}}getDiagnostics(K,$,J){if(this.suppressDiagnosticEvents)return;if(J.length>0)this.updateErrorCheck(K,J,$)}change(K){let $=this.projectService.getScriptInfo(K.file);k.assert(!!$),$.textStorage.switchToScriptVersionCache();let J=$.lineOffsetToPosition(K.line,K.offset),Z=$.lineOffsetToPosition(K.endLine,K.endOffset);if(J>=0)this.changeSeq++,this.projectService.applyChangesToFile($,Sn({span:{start:J,length:Z-J},newText:K.insertString}))}reload(K){let $=_$(K.file),J=K.tmpfile===void 0?void 0:_$(K.tmpfile),Z=this.projectService.getScriptInfoForNormalizedPath($);if(Z)this.changeSeq++,Z.reloadFromFile(J)}saveToTmp(K,$){let J=this.projectService.getScriptInfo(K);if(J)J.saveTo($)}closeClientFile(K){if(!K)return;let $=YX(K);this.projectService.closeClientFile($)}mapLocationNavigationBarItems(K,$){return wY(K,(J)=>({text:J.text,kind:J.kind,kindModifiers:J.kindModifiers,spans:J.spans.map((Z)=>dW(Z,$)),childItems:this.mapLocationNavigationBarItems(J.childItems,$),indent:J.indent}))}getNavigationBarItems(K,$){let{file:J,languageService:Z}=this.getFileAndLanguageServiceForSyntacticOperation(K),W=Z.getNavigationBarItems(J);return!W?void 0:$?this.mapLocationNavigationBarItems(W,this.projectService.getScriptInfoForNormalizedPath(J)):W}toLocationNavigationTree(K,$){return{text:K.text,kind:K.kind,kindModifiers:K.kindModifiers,spans:K.spans.map((J)=>dW(J,$)),nameSpan:K.nameSpan&&dW(K.nameSpan,$),childItems:wY(K.childItems,(J)=>this.toLocationNavigationTree(J,$))}}getNavigationTree(K,$){let{file:J,languageService:Z}=this.getFileAndLanguageServiceForSyntacticOperation(K),W=Z.getNavigationTree(J);return!W?void 0:$?this.toLocationNavigationTree(W,this.projectService.getScriptInfoForNormalizedPath(J)):W}getNavigateToItems(K,$){let J=this.getFullNavigateToItems(K);return!$?MX(J,({navigateToItems:Z})=>Z):MX(J,({project:Z,navigateToItems:W})=>W.map((Q)=>{let G=Z.getScriptInfo(Q.fileName),H={name:Q.name,kind:Q.kind,kindModifiers:Q.kindModifiers,isCaseSensitive:Q.isCaseSensitive,matchKind:Q.matchKind,file:Q.fileName,start:G.positionToLineOffset(Q.textSpan.start),end:G.positionToLineOffset(WJ(Q.textSpan))};if(Q.kindModifiers&&Q.kindModifiers!=="")H.kindModifiers=Q.kindModifiers;if(Q.containerName&&Q.containerName.length>0)H.containerName=Q.containerName;if(Q.containerKind&&Q.containerKind.length>0)H.containerKind=Q.containerKind;return H}))}getFullNavigateToItems(K){let{currentFileOnly:$,searchValue:J,maxResultCount:Z,projectFileName:W}=K;if($){k.assertIsDefined(K.file);let{file:A,project:j}=this.getFileAndProject(K);return[{project:j,navigateToItems:j.getLanguageService().getNavigateToItems(J,Z,A)}]}let Q=this.getHostPreferences(),G=[],H=new Map;if(!K.file&&!W)this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject((A)=>U(A));else{let A=this.getProjects(K);PP0(A,void 0,(j)=>U(j))}return G;function U(A){let j=A.getLanguageService().getNavigateToItems(J,Z,void 0,A.isNonTsProject(),Q.excludeLibrarySymbolsInNavTo),b=v1(j,(y)=>E(y)&&!Ut(Gb(y),A));if(b.length)G.push({project:A,navigateToItems:b})}function E(A){let j=A.name;if(!H.has(j))return H.set(j,[A]),!0;let b=H.get(j);for(let y of b)if(O(y,A))return!1;return b.push(A),!0}function O(A,j){if(A===j)return!0;if(!A||!j)return!1;return A.containerKind===j.containerKind&&A.containerName===j.containerName&&A.fileName===j.fileName&&A.isCaseSensitive===j.isCaseSensitive&&A.kind===j.kind&&A.kindModifiers===j.kindModifiers&&A.matchKind===j.matchKind&&A.name===j.name&&A.textSpan.start===j.textSpan.start&&A.textSpan.length===j.textSpan.length}}getSupportedCodeFixes(K){if(!K)return Mo();if(K.file){let{file:J,project:Z}=this.getFileAndProject(K);return Z.getLanguageService().getSupportedCodeFixes(J)}let $=this.getProject(K.projectFileName);if(!$)i7.ThrowNoProject();return $.getLanguageService().getSupportedCodeFixes()}isLocation(K){return K.line!==void 0}extractPositionOrRange(K,$){let J,Z;if(this.isLocation(K))J=W(K);else Z=this.getRange(K,$);return k.checkDefined(J===void 0?Z:J);function W(Q){return Q.position!==void 0?Q.position:$.lineOffsetToPosition(Q.line,Q.offset)}}getRange(K,$){let{startPosition:J,endPosition:Z}=this.getStartAndEndPosition(K,$);return{pos:J,end:Z}}getApplicableRefactors(K){let{file:$,project:J}=this.getFileAndProject(K),Z=J.getScriptInfoForNormalizedPath($);return J.getLanguageService().getApplicableRefactors($,this.extractPositionOrRange(K,Z),this.getPreferences($),K.triggerReason,K.kind,K.includeInteractiveActions).map((Q)=>({...Q,actions:Q.actions.map((G)=>({...G,range:G.range?{start:vF({line:G.range.start.line,character:G.range.start.offset}),end:vF({line:G.range.end.line,character:G.range.end.offset})}:void 0}))}))}getEditsForRefactor(K,$){let{file:J,project:Z}=this.getFileAndProject(K),W=Z.getScriptInfoForNormalizedPath(J),Q=Z.getLanguageService().getEditsForRefactor(J,this.getFormatOptions(J),this.extractPositionOrRange(K,W),K.refactor,K.action,this.getPreferences(J),K.interactiveRefactorArguments);if(Q===void 0)return{edits:[]};if($){let{renameFilename:G,renameLocation:H,edits:U}=Q,E;if(G!==void 0&&H!==void 0){let O=Z.getScriptInfoForNormalizedPath(_$(G));E=e60(RO(O.getSnapshot()),G,H,U)}return{renameLocation:E,renameFilename:G,edits:this.mapTextChangesToCodeEdits(U),notApplicableReason:Q.notApplicableReason}}return Q}getMoveToRefactoringFileSuggestions(K){let{file:$,project:J}=this.getFileAndProject(K),Z=J.getScriptInfoForNormalizedPath($);return J.getLanguageService().getMoveToRefactoringFileSuggestions($,this.extractPositionOrRange(K,Z),this.getPreferences($))}preparePasteEdits(K){let{file:$,project:J}=this.getFileAndProject(K);return J.getLanguageService().preparePasteEditsForFile($,K.copiedTextSpan.map((Z)=>this.getRange({file:$,startLine:Z.start.line,startOffset:Z.start.offset,endLine:Z.end.line,endOffset:Z.end.offset},this.projectService.getScriptInfoForNormalizedPath($))))}getPasteEdits(K){let{file:$,project:J}=this.getFileAndProject(K);if(Vb($))return;let Z=K.copiedFrom?{file:K.copiedFrom.file,range:K.copiedFrom.spans.map((Q)=>this.getRange({file:K.copiedFrom.file,startLine:Q.start.line,startOffset:Q.start.offset,endLine:Q.end.line,endOffset:Q.end.offset},J.getScriptInfoForNormalizedPath(_$(K.copiedFrom.file))))}:void 0,W=J.getLanguageService().getPasteEdits({targetFile:$,pastedText:K.pastedText,pasteLocations:K.pasteLocations.map((Q)=>this.getRange({file:$,startLine:Q.start.line,startOffset:Q.start.offset,endLine:Q.end.line,endOffset:Q.end.offset},J.getScriptInfoForNormalizedPath($))),copiedFrom:Z,preferences:this.getPreferences($)},this.getFormatOptions($));return W&&this.mapPasteEditsAction(W)}organizeImports(K,$){k.assert(K.scope.type==="file");let{file:J,project:Z}=this.getFileAndProject(K.scope.args),W=Z.getLanguageService().organizeImports({fileName:J,mode:K.mode??(K.skipDestructiveCodeActions?"SortAndCombine":void 0),type:"file"},this.getFormatOptions(J),this.getPreferences(J));if($)return this.mapTextChangesToCodeEdits(W);else return W}getEditsForFileRename(K,$){let J=_$(K.oldFilePath),Z=_$(K.newFilePath),W=this.getHostFormatOptions(),Q=this.getHostPreferences(),G=new Set,H=[];return this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject((U)=>{let E=U.getLanguageService().getEditsForFileRename(J,Z,W,Q),O=[];for(let A of E)if(!G.has(A.fileName))H.push(A),O.push(A.fileName);for(let A of O)G.add(A)}),$?H.map((U)=>this.mapTextChangeToCodeEdit(U)):H}getCodeFixes(K,$){let{file:J,project:Z}=this.getFileAndProject(K),W=Z.getScriptInfoForNormalizedPath(J),{startPosition:Q,endPosition:G}=this.getStartAndEndPosition(K,W),H;try{H=Z.getLanguageService().getCodeFixesAtPosition(J,Q,G,K.errorCodes,this.getFormatOptions(J),this.getPreferences(J))}catch(U){let E=U instanceof Error?U:Error(U),O=Z.getLanguageService(),A=[...O.getSyntacticDiagnostics(J),...O.getSemanticDiagnostics(J),...O.getSuggestionDiagnostics(J)].filter((b)=>PP(Q,G-Q,b.start,b.length)).map((b)=>b.code),j=K.errorCodes.find((b)=>!A.includes(b));if(j!==void 0)E.message+=`
447
447
  Additional information: BADCLIENT: Bad error code, ${j} not found in range ${Q}..${G} (found: ${A.join(", ")})`;throw E}return $?H.map((U)=>this.mapCodeFixAction(U)):H}getCombinedCodeFix({scope:K,fixId:$},J){k.assert(K.type==="file");let{file:Z,project:W}=this.getFileAndProject(K.args),Q=W.getLanguageService().getCombinedCodeFix({type:"file",fileName:Z},$,this.getFormatOptions(Z),this.getPreferences(Z));if(J)return{changes:this.mapTextChangesToCodeEdits(Q.changes),commands:Q.commands};else return Q}applyCodeActionCommand(K){let $=K.command;for(let J of D3($)){let{file:Z,project:W}=this.getFileAndProject(J);W.getLanguageService().applyCodeActionCommand(J,this.getFormatOptions(Z)).then((Q)=>{},(Q)=>{})}return{}}getStartAndEndPosition(K,$){let J,Z;if(K.startPosition!==void 0)J=K.startPosition;else J=$.lineOffsetToPosition(K.startLine,K.startOffset),K.startPosition=J;if(K.endPosition!==void 0)Z=K.endPosition;else Z=$.lineOffsetToPosition(K.endLine,K.endOffset),K.endPosition=Z;return{startPosition:J,endPosition:Z}}mapCodeAction({description:K,changes:$,commands:J}){return{description:K,changes:this.mapTextChangesToCodeEdits($),commands:J}}mapCodeFixAction({fixName:K,description:$,changes:J,commands:Z,fixId:W,fixAllDescription:Q}){return{fixName:K,description:$,changes:this.mapTextChangesToCodeEdits(J),commands:Z,fixId:W,fixAllDescription:Q}}mapPasteEditsAction({edits:K,fixId:$}){return{edits:this.mapTextChangesToCodeEdits(K),fixId:$}}mapTextChangesToCodeEdits(K){return K.map(($)=>this.mapTextChangeToCodeEdit($))}mapTextChangeToCodeEdit(K){let $=this.projectService.getScriptInfoOrConfig(K.fileName);if(!!K.isNewFile===!!$){if(!$)this.projectService.logErrorForScriptInfoNotFound(K.fileName);k.fail("Expected isNewFile for (only) new files. "+JSON.stringify({isNewFile:!!K.isNewFile,hasScriptInfo:!!$}))}return $?{fileName:K.fileName,textChanges:K.textChanges.map((J)=>u88(J,$))}:c88(K)}convertTextChangeToCodeEdit(K,$){return{start:$.positionToLineOffset(K.span.start),end:$.positionToLineOffset(K.span.start+K.span.length),newText:K.newText?K.newText:""}}getBraceMatching(K,$){let{file:J,languageService:Z}=this.getFileAndLanguageServiceForSyntacticOperation(K),W=this.projectService.getScriptInfoForNormalizedPath(J),Q=this.getPosition(K,W),G=Z.getBraceMatchingAtPosition(J,Q);return!G?void 0:$?G.map((H)=>dW(H,W)):G}getDiagnosticsForProject(K,$,J){if(this.suppressDiagnosticEvents)return;let{fileNames:Z,languageServiceDisabled:W}=this.getProjectInfoWorker(J,void 0,!0,void 0,!0);if(W)return;let Q=Z.filter((y)=>!y.includes("lib.d.ts"));if(Q.length===0)return;let G=[],H=[],U=[],E=[],O=_$(J),A=this.projectService.ensureDefaultProjectForFile(O);for(let y of Q)if(this.getCanonicalFileName(y)===this.getCanonicalFileName(J))G.push(y);else if(!this.projectService.getScriptInfo(y).isScriptOpen())if(uZ(y))E.push(y);else U.push(y);else H.push(y);let b=[...G,...H,...U,...E].map((y)=>({fileName:y,project:A}));this.updateErrorCheck(K,b,$,!1)}configurePlugin(K){this.projectService.configurePlugin(K)}getSmartSelectionRange(K,$){let{locations:J}=K,{file:Z,languageService:W}=this.getFileAndLanguageServiceForSyntacticOperation(K),Q=k.checkDefined(this.projectService.getScriptInfo(Z));return wY(J,(G)=>{let H=this.getPosition(G,Q),U=W.getSmartSelectionRange(Z,H);return $?this.mapSelectionRange(U,Q):U})}toggleLineComment(K,$){let{file:J,languageService:Z}=this.getFileAndLanguageServiceForSyntacticOperation(K),W=this.projectService.getScriptInfo(J),Q=this.getRange(K,W),G=Z.toggleLineComment(J,Q);if($){let H=this.projectService.getScriptInfoForNormalizedPath(J);return G.map((U)=>this.convertTextChangeToCodeEdit(U,H))}return G}toggleMultilineComment(K,$){let{file:J,languageService:Z}=this.getFileAndLanguageServiceForSyntacticOperation(K),W=this.projectService.getScriptInfoForNormalizedPath(J),Q=this.getRange(K,W),G=Z.toggleMultilineComment(J,Q);if($){let H=this.projectService.getScriptInfoForNormalizedPath(J);return G.map((U)=>this.convertTextChangeToCodeEdit(U,H))}return G}commentSelection(K,$){let{file:J,languageService:Z}=this.getFileAndLanguageServiceForSyntacticOperation(K),W=this.projectService.getScriptInfoForNormalizedPath(J),Q=this.getRange(K,W),G=Z.commentSelection(J,Q);if($){let H=this.projectService.getScriptInfoForNormalizedPath(J);return G.map((U)=>this.convertTextChangeToCodeEdit(U,H))}return G}uncommentSelection(K,$){let{file:J,languageService:Z}=this.getFileAndLanguageServiceForSyntacticOperation(K),W=this.projectService.getScriptInfoForNormalizedPath(J),Q=this.getRange(K,W),G=Z.uncommentSelection(J,Q);if($){let H=this.projectService.getScriptInfoForNormalizedPath(J);return G.map((U)=>this.convertTextChangeToCodeEdit(U,H))}return G}mapSelectionRange(K,$){let J={textSpan:dW(K.textSpan,$)};if(K.parent)J.parent=this.mapSelectionRange(K.parent,$);return J}getScriptInfoFromProjectService(K){let $=_$(K),J=this.projectService.getScriptInfoForNormalizedPath($);if(!J)return this.projectService.logErrorForScriptInfoNotFound($),i7.ThrowNoProject();return J}toProtocolCallHierarchyItem(K){let $=this.getScriptInfoFromProjectService(K.file);return{name:K.name,kind:K.kind,kindModifiers:K.kindModifiers,file:K.file,containerName:K.containerName,span:dW(K.span,$),selectionSpan:dW(K.selectionSpan,$)}}toProtocolCallHierarchyIncomingCall(K){let $=this.getScriptInfoFromProjectService(K.from.file);return{from:this.toProtocolCallHierarchyItem(K.from),fromSpans:K.fromSpans.map((J)=>dW(J,$))}}toProtocolCallHierarchyOutgoingCall(K,$){return{to:this.toProtocolCallHierarchyItem(K.to),fromSpans:K.fromSpans.map((J)=>dW(J,$))}}prepareCallHierarchy(K){let{file:$,project:J}=this.getFileAndProject(K),Z=this.projectService.getScriptInfoForNormalizedPath($);if(Z){let W=this.getPosition(K,Z),Q=J.getLanguageService().prepareCallHierarchy($,W);return Q&&gl(Q,(G)=>this.toProtocolCallHierarchyItem(G))}return}provideCallHierarchyIncomingCalls(K){let{file:$,project:J}=this.getFileAndProject(K),Z=this.getScriptInfoFromProjectService($);return J.getLanguageService().provideCallHierarchyIncomingCalls($,this.getPosition(K,Z)).map((Q)=>this.toProtocolCallHierarchyIncomingCall(Q))}provideCallHierarchyOutgoingCalls(K){let{file:$,project:J}=this.getFileAndProject(K),Z=this.getScriptInfoFromProjectService($);return J.getLanguageService().provideCallHierarchyOutgoingCalls($,this.getPosition(K,Z)).map((Q)=>this.toProtocolCallHierarchyOutgoingCall(Q,Z))}getCanonicalFileName(K){let $=this.host.useCaseSensitiveFileNames?K:RH(K);return YX($)}exit(){}notRequired(K){if(K)this.doOutput(void 0,K.command,K.seq,!0,this.performanceData);return{responseRequired:!1,performanceData:this.performanceData}}requiredResponse(K){return{response:K,responseRequired:!0,performanceData:this.performanceData}}addProtocolHandler(K,$){if(this.handlers.has(K))throw Error(`Protocol handler already exists for command "${K}"`);this.handlers.set(K,$)}setCurrentRequest(K){k.assert(this.currentRequestId===void 0),this.currentRequestId=K,this.cancellationToken.setRequest(K)}resetCurrentRequest(K){k.assert(this.currentRequestId===K),this.currentRequestId=void 0,this.cancellationToken.resetRequest(K)}executeWithRequestId(K,$,J){let Z=this.performanceData;try{return this.performanceData=J,this.setCurrentRequest(K),$()}finally{this.resetCurrentRequest(K),this.performanceData=Z}}executeCommand(K){let $=this.handlers.get(K.command);if($){let J=this.executeWithRequestId(K.seq,()=>$(K),void 0);return this.projectService.enableRequestedPlugins(),J}else return this.logger.msg(`Unrecognized JSON command:${x_(K)}`,"Err"),this.doOutput(void 0,"unknown",K.seq,!1,void 0,`Unrecognized JSON command: ${K.command}`),{responseRequired:!1}}onMessage(K){var $,J,Z,W,Q,G,H;this.gcTimer.scheduleCollect();let U,E=this.performanceData;if(this.logger.hasLevel(2)){if(U=this.hrtime(),this.logger.hasLevel(3))this.logger.info(`request:${xw(this.toStringMessage(K))}`)}let O,A;try{O=this.parseMessage(K),A=O.arguments&&O.arguments.file?O.arguments:void 0,($=G1)==null||$.instant(G1.Phase.Session,"request",{seq:O.seq,command:O.command}),(J=G1)==null||J.push(G1.Phase.Session,"executeCommand",{seq:O.seq,command:O.command},!0);let{response:j,responseRequired:b,performanceData:y}=this.executeCommand(O);if((Z=G1)==null||Z.pop(),this.logger.hasLevel(2)){let R=v88(this.hrtime(U)).toFixed(4);if(b)this.logger.perftrc(`${O.seq}::${O.command}: elapsed time (in milliseconds) ${R}`);else this.logger.perftrc(`${O.seq}::${O.command}: async elapsed time (in milliseconds) ${R}`)}if((W=G1)==null||W.instant(G1.Phase.Session,"response",{seq:O.seq,command:O.command,success:!!j}),j)this.doOutput(j,O.command,O.seq,!0,y);else if(b)this.doOutput(void 0,O.command,O.seq,!1,y,"No content available.")}catch(j){if((Q=G1)==null||Q.popAll(),j instanceof NA){(G=G1)==null||G.instant(G1.Phase.Session,"commandCanceled",{seq:O==null?void 0:O.seq,command:O==null?void 0:O.command}),this.doOutput({canceled:!0},O.command,O.seq,!0,this.performanceData);return}this.logErrorWorker(j,this.toStringMessage(K),A),(H=G1)==null||H.instant(G1.Phase.Session,"commandError",{seq:O==null?void 0:O.seq,command:O==null?void 0:O.command,message:j.message}),this.doOutput(void 0,O?O.command:"unknown",O?O.seq:0,!1,this.performanceData,"Error processing request. "+j.message+`
448
- `+j.stack)}finally{this.performanceData=E}}parseMessage(K){return JSON.parse(K)}toStringMessage(K){return K}getFormatOptions(K){return this.projectService.getFormatCodeOptions(K)}getPreferences(K){return this.projectService.getPreferences(K)}getHostFormatOptions(){return this.projectService.getHostFormatCodeOptions()}getHostPreferences(){return this.projectService.getHostPreferences()}};function MP0(Y){let K=Y.diagnosticsDuration&&GK(Y.diagnosticsDuration,([$,J])=>({...J,file:$}));return{...Y,diagnosticsDuration:K}}function dW(Y,K){return{start:K.positionToLineOffset(Y.start),end:K.positionToLineOffset(WJ(Y))}}function a60(Y,K,$){let J=dW(Y,$),Z=K&&dW(K,$);return Z?{...J,contextStart:Z.start,contextEnd:Z.end}:J}function u88(Y,K){return{start:IP0(K,Y.span.start),end:IP0(K,WJ(Y.span)),newText:Y.newText}}function IP0(Y,K){return l60(Y)?g88(Y.getLineAndCharacterOfPosition(K)):Y.positionToLineOffset(K)}function d88(Y,K){let $=Y.ranges.map((J)=>{return{start:K.positionToLineOffset(J.start),end:K.positionToLineOffset(J.start+J.length)}});if(!Y.wordPattern)return{ranges:$};return{ranges:$,wordPattern:Y.wordPattern}}function g88(Y){return{line:Y.line+1,offset:Y.character+1}}function c88(Y){k.assert(Y.textChanges.length===1);let K=IX(Y.textChanges);return k.assert(K.span.start===0&&K.span.length===0),{fileName:Y.fileName,textChanges:[{start:{line:0,offset:0},end:{line:0,offset:0},newText:K.newText}]}}function e60(Y,K,$,J){let Z=p88(Y,K,J),{line:W,character:Q}=lq(F3(Z),$);return{line:W+1,offset:Q+1}}function p88(Y,K,$){for(let{fileName:J,textChanges:Z}of $){if(J!==K)continue;for(let W=Z.length-1;W>=0;W--){let{newText:Q,span:{start:G,length:H}}=Z[W];Y=Y.slice(0,G)+Q+Y.slice(G+H)}}return Y}function CP0(Y,{fileName:K,textSpan:$,contextSpan:J,isWriteAccess:Z,isDefinition:W},{disableLineTextInReferences:Q}){let G=k.checkDefined(Y.getScriptInfo(K)),H=a60($,J,G),U=Q?void 0:l88(G,H);return{file:K,...H,lineText:U,isWriteAccess:Z,isDefinition:W}}function l88(Y,K){let $=Y.lineToTextSpan(K.start.line-1);return Y.getSnapshot().getText($.start,WJ($)).replace(/\r|\n/g,"")}function o88(Y){return Y===void 0||Y&&typeof Y==="object"&&typeof Y.exportName==="string"&&(Y.fileName===void 0||typeof Y.fileName==="string")&&(Y.ambientModuleName===void 0||typeof Y.ambientModuleName==="string"&&(Y.isPackageJsonImport===void 0||typeof Y.isPackageJsonImport==="boolean"))}var NF=4,Yz0=((Y)=>{return Y[Y.PreStart=0]="PreStart",Y[Y.Start=1]="Start",Y[Y.Entire=2]="Entire",Y[Y.Mid=3]="Mid",Y[Y.End=4]="End",Y[Y.PostEnd=5]="PostEnd",Y})(Yz0||{}),s88=class{constructor(){this.goSubtree=!0,this.lineIndex=new _R,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new MF,this.startPath=[this.lineIndex.root],this.stack=[this.lineIndex.root]}get done(){return!1}insertLines(Y,K){if(K)this.trailingText="";if(Y)Y=this.initialText+Y+this.trailingText;else Y=this.initialText+this.trailingText;let J=_R.linesFromText(Y).lines;if(J.length>1&&J[J.length-1]==="")J.pop();let Z,W;for(let G=this.endBranch.length-1;G>=0;G--)if(this.endBranch[G].updateCounts(),this.endBranch[G].charCount()===0)if(W=this.endBranch[G],G>0)Z=this.endBranch[G-1];else Z=this.branchNode;if(W)Z.remove(W);let Q=this.startPath[this.startPath.length-1];if(J.length>0)if(Q.text=J[0],J.length>1){let G=Array(J.length-1),H=Q;for(let O=1;O<J.length;O++)G[O-1]=new qS(J[O]);let U=this.startPath.length-2;while(U>=0){let O=this.startPath[U];G=O.insertAt(H,G),U--,H=O}let E=G.length;while(E>0){let O=new MF;O.add(this.lineIndex.root),G=O.insertAt(this.lineIndex.root,G),E=G.length,this.lineIndex.root=O}this.lineIndex.root.updateCounts()}else for(let G=this.startPath.length-2;G>=0;G--)this.startPath[G].updateCounts();else{this.startPath[this.startPath.length-2].remove(Q);for(let H=this.startPath.length-2;H>=0;H--)this.startPath[H].updateCounts()}return this.lineIndex}post(Y,K,$){if($===this.lineCollectionAtBranch)this.state=4;this.stack.pop()}pre(Y,K,$,J,Z){let W=this.stack[this.stack.length-1];if(this.state===2&&Z===1)this.state=1,this.branchNode=W,this.lineCollectionAtBranch=$;let Q;function G(H){if(H.isLeaf())return new qS("");else return new MF}switch(Z){case 0:if(this.goSubtree=!1,this.state!==4)W.add($);break;case 1:if(this.state===4)this.goSubtree=!1;else Q=G($),W.add(Q),this.startPath.push(Q);break;case 2:if(this.state!==4)Q=G($),W.add(Q),this.startPath.push(Q);else if(!$.isLeaf())Q=G($),W.add(Q),this.endBranch.push(Q);break;case 3:this.goSubtree=!1;break;case 4:if(this.state!==4)this.goSubtree=!1;else if(!$.isLeaf())Q=G($),W.add(Q),this.endBranch.push(Q);break;case 5:if(this.goSubtree=!1,this.state!==1)W.add($);break}if(this.goSubtree)this.stack.push(Q)}leaf(Y,K,$){if(this.state===1)this.initialText=$.text.substring(0,Y);else if(this.state===2)this.initialText=$.text.substring(0,Y),this.trailingText=$.text.substring(Y+K);else this.trailingText=$.text.substring(Y+K)}},t88=class{constructor(Y,K,$){this.pos=Y,this.deleteLen=K,this.insertedText=$}getTextChangeRange(){return kP(z2(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},Ot=class Y{constructor(){this.changes=[],this.versions=Array(Y.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(K){if(K<this.minVersion||K>this.currentVersion)return;return K%Y.maxVersions}currentVersionToIndex(){return this.currentVersion%Y.maxVersions}edit(K,$,J){if(this.changes.push(new t88(K,$,J)),this.changes.length>Y.changeNumberThreshold||$>Y.changeLengthThreshold||J&&J.length>Y.changeLengthThreshold)this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let K=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let $=K.index;for(let J of this.changes)$=$.edit(J.pos,J.deleteLen,J.insertedText);if(K=new xP0(this.currentVersion+1,this,$,this.changes),this.currentVersion=K.version,this.versions[this.currentVersionToIndex()]=K,this.changes=[],this.currentVersion-this.minVersion>=Y.maxVersions)this.minVersion=this.currentVersion-Y.maxVersions+1}return K}getSnapshotVersion(){return this._getSnapshot().version}getAbsolutePositionAndLineText(K){return this._getSnapshot().index.lineNumberToInfo(K)}lineOffsetToPosition(K,$){return this._getSnapshot().index.absolutePositionOfStartOfLine(K)+($-1)}positionToLineOffset(K){return this._getSnapshot().index.positionToLineOffset(K)}lineToTextSpan(K){let $=this._getSnapshot().index,{lineText:J,absolutePosition:Z}=$.lineNumberToInfo(K+1),W=J!==void 0?J.length:$.absolutePositionOfStartOfLine(K+2)-Z;return z2(Z,W)}getTextChangesBetweenVersions(K,$){if(K<$)if(K>=this.minVersion){let J=[];for(let Z=K+1;Z<=$;Z++){let W=this.versions[this.versionToIndex(Z)];for(let Q of W.changesSincePreviousVersion)J.push(Q.getTextChangeRange())}return fa(J)}else return;else return pv}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(K){let $=new Y,J=new xP0(0,$,new _R);$.versions[$.currentVersion]=J;let Z=_R.linesFromText(K);return J.index.load(Z.lines),$}};Ot.changeNumberThreshold=8,Ot.changeLengthThreshold=256,Ot.maxVersions=8;var qt=Ot,xP0=class Y{constructor(K,$,J,Z=yZ){this.version=K,this.cache=$,this.index=J,this.changesSincePreviousVersion=Z}getText(K,$){return this.index.getText(K,$-K)}getLength(){return this.index.getLength()}getChangeRange(K){if(K instanceof Y&&this.cache===K.cache)if(this.version<=K.version)return pv;else return this.cache.getTextChangesBetweenVersions(K.version,this.version)}},_R=class Y{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(K){return this.lineNumberToInfo(K).absolutePosition}positionToLineOffset(K){let{oneBasedLine:$,zeroBasedColumn:J}=this.root.charOffsetToLineInfo(1,K);return{line:$,offset:J+1}}positionToColumnAndLineText(K){return this.root.charOffsetToLineInfo(1,K)}getLineCount(){return this.root.lineCount()}lineNumberToInfo(K){let $=this.getLineCount();if(K<=$){let{position:J,leaf:Z}=this.root.lineNumberToInfo(K,0);return{absolutePosition:J,lineText:Z&&Z.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(K){if(K.length>0){let $=[];for(let J=0;J<K.length;J++)$[J]=new qS(K[J]);this.root=Y.buildTreeFromBottom($)}else this.root=new MF}walk(K,$,J){this.root.walk(K,$,J)}getText(K,$){let J="";if($>0&&K<this.root.charCount())this.walk(K,$,{goSubtree:!0,done:!1,leaf:(Z,W,Q)=>{J=J.concat(Q.text.substring(Z,Z+W))}});return J}getLength(){return this.root.charCount()}every(K,$,J){if(!J)J=this.root.charCount();let Z={goSubtree:!0,done:!1,leaf(W,Q,G){if(!K(G,W,Q))this.done=!0}};return this.walk($,J-$,Z),!Z.done}edit(K,$,J){if(this.root.charCount()===0){if(k.assert($===0),J!==void 0)return this.load(Y.linesFromText(J).lines),this;return}else{let Z;if(this.checkEdits){let G=this.getText(0,this.root.charCount());Z=G.slice(0,K)+J+G.slice(K+$)}let W=new s88,Q=!1;if(K>=this.root.charCount()){K=this.root.charCount()-1;let G=this.getText(K,1);if(J)J=G+J;else J=G;$=0,Q=!0}else if($>0){let G=K+$,{zeroBasedColumn:H,lineText:U}=this.positionToColumnAndLineText(G);if(H===0)$+=U.length,J=J?J+U:U}if(this.root.walk(K,$,W),W.insertLines(J,Q),this.checkEdits){let G=W.lineIndex.getText(0,W.lineIndex.getLength());k.assert(Z===G,"buffer edit mismatch")}return W.lineIndex}}static buildTreeFromBottom(K){if(K.length<NF)return new MF(K);let $=Array(Math.ceil(K.length/NF)),J=0;for(let Z=0;Z<$.length;Z++){let W=Math.min(J+NF,K.length);$[Z]=new MF(K.slice(J,W)),J=W}return this.buildTreeFromBottom($)}static linesFromText(K){let $=F3(K);if($.length===0)return{lines:[],lineMap:$};let J=Array($.length),Z=$.length-1;for(let Q=0;Q<Z;Q++)J[Q]=K.substring($[Q],$[Q+1]);let W=K.substring($[Z]);if(W.length>0)J[Z]=W;else J.pop();return{lines:J,lineMap:$}}},MF=class Y{constructor(K=[]){if(this.children=K,this.totalChars=0,this.totalLines=0,K.length)this.updateCounts()}isLeaf(){return!1}updateCounts(){this.totalChars=0,this.totalLines=0;for(let K of this.children)this.totalChars+=K.charCount(),this.totalLines+=K.lineCount()}execWalk(K,$,J,Z,W){if(J.pre)J.pre(K,$,this.children[Z],this,W);if(J.goSubtree){if(this.children[Z].walk(K,$,J),J.post)J.post(K,$,this.children[Z],this,W)}else J.goSubtree=!0;return J.done}skipChild(K,$,J,Z,W){if(Z.pre&&!Z.done)Z.pre(K,$,this.children[J],this,W),Z.goSubtree=!0}walk(K,$,J){if(this.children.length===0)return;let Z=0,W=this.children[Z].charCount(),Q=K;while(Q>=W)this.skipChild(Q,$,Z,J,0),Q-=W,Z++,W=this.children[Z].charCount();if(Q+$<=W){if(this.execWalk(Q,$,J,Z,2))return}else{if(this.execWalk(Q,W-Q,J,Z,1))return;let G=$-(W-Q);Z++,W=this.children[Z].charCount();while(G>W){if(this.execWalk(0,W,J,Z,3))return;G-=W,Z++,W=this.children[Z].charCount()}if(G>0){if(this.execWalk(0,G,J,Z,4))return}}if(J.pre){let G=this.children.length;if(Z<G-1)for(let H=Z+1;H<G;H++)this.skipChild(0,0,H,J,5)}}charOffsetToLineInfo(K,$){if(this.children.length===0)return{oneBasedLine:K,zeroBasedColumn:$,lineText:void 0};for(let W of this.children)if(W.charCount()>$)if(W.isLeaf())return{oneBasedLine:K,zeroBasedColumn:$,lineText:W.text};else return W.charOffsetToLineInfo(K,$);else $-=W.charCount(),K+=W.lineCount();let J=this.lineCount();if(J===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};let Z=k.checkDefined(this.lineNumberToInfo(J,0).leaf);return{oneBasedLine:J,zeroBasedColumn:Z.charCount(),lineText:void 0}}lineNumberToInfo(K,$){for(let J of this.children){let Z=J.lineCount();if(Z>=K)return J.isLeaf()?{position:$,leaf:J}:J.lineNumberToInfo(K,$);else K-=Z,$+=J.charCount()}return{position:$,leaf:void 0}}splitAfter(K){let $,J=this.children.length;K++;let Z=K;if(K<J){$=new Y;while(K<J)$.add(this.children[K]),K++;$.updateCounts()}return this.children.length=Z,$}remove(K){let $=this.findChildIndex(K),J=this.children.length;if($<J-1)for(let Z=$;Z<J-1;Z++)this.children[Z]=this.children[Z+1];this.children.pop()}findChildIndex(K){let $=this.children.indexOf(K);return k.assert($!==-1),$}insertAt(K,$){let J=this.findChildIndex(K),Z=this.children.length,W=$.length;if(Z<NF&&J===Z-1&&W===1)return this.add($[0]),this.updateCounts(),[];else{let Q=this.splitAfter(J),G=0;J++;while(J<NF&&G<W)this.children[J]=$[G],J++,G++;let H=[],U=0;if(G<W){U=Math.ceil((W-G)/NF),H=Array(U);let E=0;for(let A=0;A<U;A++)H[A]=new Y;let O=H[0];while(G<W)if(O.add($[G]),G++,O.children.length===NF)E++,O=H[E];for(let A=H.length-1;A>=0;A--)if(H[A].children.length===0)H.pop()}if(Q)H.push(Q);this.updateCounts();for(let E=0;E<U;E++)H[E].updateCounts();return H}}add(K){this.children.push(K),k.assert(this.children.length<=NF)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},qS=class{constructor(Y){this.text=Y}isLeaf(){return!0}walk(Y,K,$){$.leaf(Y,K,this)}charCount(){return this.text.length}lineCount(){return 1}},SP0=class Y{constructor(K,$,J,Z,W,Q){this.telemetryEnabled=K,this.logger=$,this.host=J,this.globalTypingsCacheLocation=Z,this.event=W,this.maxActiveRequestCount=Q,this.activeRequestCount=0,this.requestQueue=HP(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(K){var $;if(BG.validatePackageName(K)!==BG.NameValidationResult.Ok)return!1;if(!this.requestedRegistry)this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"});return!!(($=this.typesRegistryCache)==null?void 0:$.has(K))}installPackage(K){this.packageInstallId++;let $={kind:"installPackage",...K,id:this.packageInstallId},J=new Promise((Z,W)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:Z,reject:W})});return this.installer.send($),J}attach(K){this.projectService=K,this.installer=this.createInstallerProcess()}onProjectClosed(K){this.installer.send({projectName:K.getProjectName(),kind:"closeProject"})}enqueueInstallTypingsRequest(K,$,J){let Z=W60(K,$,J);if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Scheduling throttled operation:${x_(Z)}`);if(this.activeRequestCount<this.maxActiveRequestCount)this.scheduleRequest(Z);else{if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Deferring request for: ${Z.projectName}`);this.requestQueue.enqueue(Z),this.requestMap.set(Z.projectName,Z)}}handleMessage(K){var $,J;if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Received response:${x_(K)}`);switch(K.kind){case dp:this.typesRegistryCache=new Map(Object.entries(K.typesRegistry));break;case fC:{let Z=($=this.packageInstalledPromise)==null?void 0:$.get(K.id);if(k.assertIsDefined(Z,"Should find the promise for package install"),(J=this.packageInstalledPromise)==null||J.delete(K.id),K.success)Z.resolve({successMessage:K.message});else Z.reject(K.message);this.projectService.updateTypingsForProject(K),this.event(K,"setTypings");break}case DX0:{let Z={message:K.message},W="typesInstallerInitializationFailed";this.event(Z,"typesInstallerInitializationFailed");break}case gp:{let Z={eventId:K.eventId,packages:K.packagesToInstall},W="beginInstallTypes";this.event(Z,"beginInstallTypes");break}case cp:{if(this.telemetryEnabled){let Q={telemetryEventName:"typingsInstalled",payload:{installedPackages:K.packagesToInstall.join(","),installSuccess:K.installSuccess,typingsInstallerVersion:K.typingsInstallerVersion}},G="telemetry";this.event(Q,"telemetry")}let Z={eventId:K.eventId,packages:K.packagesToInstall,success:K.installSuccess},W="endInstallTypes";this.event(Z,W);break}case SC:{this.projectService.updateTypingsForProject(K);break}case xC:{if(this.activeRequestCount>0)this.activeRequestCount--;else k.fail("TIAdapter:: Received too many responses");while(!this.requestQueue.isEmpty()){let Z=this.requestQueue.dequeue();if(this.requestMap.get(Z.projectName)===Z){this.requestMap.delete(Z.projectName),this.scheduleRequest(Z);break}if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Skipping defunct request for: ${Z.projectName}`)}this.projectService.updateTypingsForProject(K),this.event(K,"setTypings");break}case WL:this.projectService.watchTypingLocations(K);break;default:Y_(K)}}scheduleRequest(K){if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Scheduling request for: ${K.projectName}`);this.activeRequestCount++,this.host.setTimeout(()=>{if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Sending request:${x_(K)}`);this.installer.send(K)},Y.requestDelayMillis,`${K.projectName}::${K.kind}`)}};SP0.requestDelayMillis=100;var fP0=SP0,hP0={};if(KY(hP0,{ActionInvalidate:()=>SC,ActionPackageInstalled:()=>fC,ActionSet:()=>xC,ActionWatchTypingLocations:()=>WL,Arguments:()=>pp,AutoImportProviderProject:()=>L60,AuxiliaryProject:()=>k60,CharRangeSection:()=>Yz0,CloseFileWatcherEvent:()=>zt,CommandNames:()=>wP0,ConfigFileDiagEvent:()=>Kt,ConfiguredProject:()=>R60,ConfiguredProjectLoadKind:()=>x60,CreateDirectoryWatcherEvent:()=>Zt,CreateFileWatcherEvent:()=>Jt,Errors:()=>i7,EventBeginInstallTypes:()=>gp,EventEndInstallTypes:()=>cp,EventInitializationFailed:()=>DX0,EventTypesRegistry:()=>dp,ExternalProject:()=>is,GcTimer:()=>E60,InferredProject:()=>P60,LargeFileReferencedEvent:()=>Yt,LineIndex:()=>_R,LineLeaf:()=>qS,LineNode:()=>MF,LogLevel:()=>Z60,Msg:()=>z60,OpenFileInfoTelemetryEvent:()=>v60,Project:()=>cO,ProjectInfoTelemetryEvent:()=>$t,ProjectKind:()=>Hb,ProjectLanguageServiceStateEvent:()=>Xt,ProjectLoadingFinishEvent:()=>es,ProjectLoadingStartEvent:()=>as,ProjectService:()=>p60,ProjectsUpdatedInBackgroundEvent:()=>BS,ScriptInfo:()=>q60,ScriptVersionCache:()=>qt,Session:()=>NP0,TextStorage:()=>O60,ThrottledOperations:()=>D60,TypingsInstallerAdapter:()=>fP0,allFilesAreJsOrDts:()=>j60,allRootFilesAreJsOrDts:()=>A60,asNormalizedPath:()=>uW,convertCompilerOptions:()=>US,convertFormatOptions:()=>RF,convertScriptKindName:()=>Qt,convertTypeAcquisition:()=>M60,convertUserPreferences:()=>I60,convertWatchOptions:()=>HR,countEachFileTypes:()=>zR,createInstallTypingsRequest:()=>W60,createModuleSpecifierCache:()=>s60,createNormalizedPathMap:()=>nb0,createPackageJsonCache:()=>t60,createSortedArray:()=>_60,emptyArray:()=>yZ,findArgument:()=>rE0,formatDiagnosticToProtocol:()=>GR,formatMessage:()=>i60,getBaseConfigFileName:()=>ts,getDetailWatchInfo:()=>_t,getLocationInNewDocument:()=>e60,hasArgument:()=>nE0,hasNoTypeScriptSource:()=>w60,indent:()=>xw,isBackgroundProject:()=>QR,isConfigFile:()=>l60,isConfiguredProject:()=>sV,isDynamicFileName:()=>Vb,isExternalProject:()=>WR,isInferredProject:()=>LF,isInferredProjectName:()=>Q60,isProjectDeferredClose:()=>VR,makeAutoImportProviderProjectName:()=>H60,makeAuxiliaryProjectName:()=>G60,makeInferredProjectName:()=>V60,maxFileSize:()=>rs,maxProgramSizeForNonTsFiles:()=>ns,normalizedPathToPath:()=>yF,nowString:()=>aE0,nullCancellationToken:()=>FP0,nullTypingsInstaller:()=>OS,protocol:()=>B60,scriptInfoIsContainedByBackgroundProject:()=>T60,scriptInfoIsContainedByDeferredClosedProject:()=>F60,stringifyIndented:()=>x_,toEvent:()=>n60,toNormalizedPath:()=>_$,tryConvertScriptKindName:()=>Wt,typingsInstaller:()=>J60,updateProjectIfDirty:()=>X5}),typeof console<"u")k.loggingHost={log(Y,K){switch(Y){case 1:return console.error(K);case 2:return console.warn(K);case 3:return console.log(K);case 4:return console.log(K)}}}})({get exports(){return QI0},set exports(v0){if(QI0=v0,typeof vn<"u"&&vn.exports)vn.exports=v0}})});var y4=NM0(V70(),1);var Nn={UNKNOWN:{code:"AX-UNKNOWN-001",title:"Unclassified Error",description:"An error occurred that hasn't been given a proper code yet. This is itself worth fixing \u2014 see the err(cause) call site that produced it.",source:"runtime",severity:"fatal"},PROMPT_NOT_FOUND:{code:"AX-PROMPT-001",title:"Prompt Not Found",description:"The requested prompt could not be resolved \u2014 it is not declared by the agent, or the published package it names ships no prompt by that name.",source:"runtime",severity:"fatal",expected:!0},PROMPT_FILE_NOT_FOUND:{code:"AX-PROMPT-002",title:"Prompt File Missing",description:"The prompt is declared but its source file no longer exists on disk.",source:"runtime",severity:"fatal",expected:!0},PROMPT_RENDER_FAILED:{code:"AX-PROMPT-003",title:"Prompt Render Failed",description:"The prompt's source file failed to compile or render \u2014 likely a malformed SFC (content outside <template>/<script>/<style>) or an error thrown while rendering. See the cause for the underlying parser/render error.",source:"runtime",severity:"fatal"},OUTPUT_INVALID:{code:"AX-OUTPUT-001",title:"Invalid Output Type",description:"The `output` type passed to request() is not valid TypeScript, or references a type that does not exist. Checked before the model is called, so no inference was spent \u2014 fix the type string at the call site.",source:"runtime",severity:"fatal"},OUTPUT_UNSATISFIED:{code:"AX-OUTPUT-002",title:"Output Type Not Satisfied",description:"The model could not produce a response matching the declared `output` type within its retry budget. The accumulated TypeScript diagnostics describe what it got wrong on each attempt.",source:"runtime",severity:"fatal"},OUTPUT_EMPTY:{code:"AX-OUTPUT-003",title:"Model Produced No Output Block",description:"Every reply must wrap its content in a <text> or <script> block \u2014 text outside a block is discarded by the parser. The model replied with none, on every attempt in its retry budget, so there was nothing to render or run. Usually means the model is not following the block protocol rather than that anything is misconfigured: the reply itself is often correct, just unwrapped. Try a different model, or check that the protocol the cognet renders matches the one it parses with.",source:"runtime",severity:"fatal",expected:!0},SCRIPT_NOT_FOUND:{code:"AX-SCRIPT-001",title:"Script Not Found",description:"The requested script was not found in the agent's blueprint. It may not be declared, or the agent needs to be re-prepared.",source:"runtime",severity:"fatal",expected:!0},SCRIPT_FILE_NOT_FOUND:{code:"AX-SCRIPT-002",title:"Script File Missing",description:"The script is declared but its source file no longer exists on disk.",source:"runtime",severity:"fatal",expected:!0},SCRIPT_AGENT_NOT_LOCAL:{code:"AX-SCRIPT-003",title:"Script Agent Is Not In-Process",description:"A script's agent must run in the same process as the script. Scripts() booted a linked (confined) agent instead, so there is no in-heap runtime for the script's proxy to forward to. This is a wiring fault, not a user error.",source:"runtime",severity:"fatal"},SUBAGENT_LINK_UNSUPPORTED:{code:"AX-SCRIPT-004",title:"Subagent Not Supported Over The Link",description:"An agent asked to spawn a subagent whose child runs as a confined process. `axon.request()` returns a wake's collected entries, while the link's `stimulus` verb returns only admission \u2014 the supervisor needs a verb that collects a wake and answers when it settles. Until that exists this fails rather than returning an admission receipt the caller would read as a result.",source:"runtime",severity:"fatal"},AGENT_BOOT_FAILED:{code:"AX-AGENT-006",title:"Agent Failed To Boot",description:"The agent process exited before it connected to its supervisor. Its own stderr is carried as the detail \u2014 the agent usually knows exactly what went wrong (a missing cognet, a tool that would not compile), and without this that diagnosis died in a pipe while the supervisor reported only a closed socket.",source:"runtime",severity:"fatal"},LINK_NO_HANDLER:{code:"AX-LINK-001",title:"No Handler For Link Verb",description:"The peer sent a verb this side does not implement. Both ends speak a versioned contract, so this means they disagree about it \u2014 a wiring fault, not something a user did.",source:"runtime",severity:"fatal"},LINK_PEER_CLOSED:{code:"AX-LINK-002",title:"Agent Disconnected",description:"The agent process closed its side of the link. Every call still in flight is rejected rather than left hanging \u2014 a dead peer must be an error, never a wait that never ends.",source:"runtime",severity:"fatal"},LINK_CLOSED:{code:"AX-LINK-003",title:"Link Closed",description:"The link to the agent was torn down by this side \u2014 a shutdown, a dispose, or a failed boot. Outstanding calls are rejected with this rather than hanging.",source:"runtime",severity:"fatal"},LINK_FRAME_TOO_LARGE:{code:"AX-LINK-004",title:"Link Frame Too Large",description:"A message on the link exceeded the maximum frame size, or a length prefix declared one that did. The prefix is peer-controlled input, so an oversized declaration is refused rather than allocated \u2014 a desynchronised stream cannot be recovered by reading past it.",source:"runtime",severity:"fatal"},LINK_UNKNOWN_PROMPT_ACTION:{code:"AX-LINK-005",title:"Unknown Prompt Action",description:"The prompt verb was called with an action this side does not know. Loud rather than silent: an unrecognised action would otherwise return undefined, which a caller renders as an empty prompt list.",source:"runtime",severity:"fatal"},AGENT_LINK_MISSING:{code:"AX-AGENT-001",title:"Agent Started Without A Supervisor",description:"An agent process was started with no link paths in its environment, which means nothing is supervising it. It cannot guess a socket path \u2014 doing so risks connecting to a different agent's supervisor entirely.",source:"runtime",severity:"fatal"},AGENT_LINK_MALFORMED:{code:"AX-AGENT-002",title:"Malformed Agent Link",description:"The link carrier in the agent's environment is not valid JSON, or does not name both a control and a data socket. Both are required \u2014 an agent with only one connected can accept work it has no way to answer.",source:"runtime",severity:"fatal"},AGENT_BLUEPRINT_MISSING:{code:"AX-AGENT-003",title:"Agent Started Without A Blueprint",description:"An agent process was started with no blueprint path in its environment. The supervisor writes the blueprint beside the sockets before spawning; its absence means the spawn path is broken.",source:"runtime",severity:"fatal"},AGENT_NOT_READY:{code:"AX-AGENT-004",title:"Agent Still Booting",description:"A verb arrived before the agent's runtime finished booting. The link connects first so that boot failures are reportable, which leaves a brief window where the agent can be addressed but cannot answer.",source:"runtime",severity:"fatal"},CLI_AGENT_NOT_LOCAL:{code:"AX-AGENT-005",title:"Command Needs An In-Process Agent",description:"A headless CLI command booted an agent that runs as a separate process, but the command reaches into the runtime directly. This is a wiring fault: the command needs either an in-process agent or a link verb.",source:"runtime",severity:"fatal"},ENGINE_ROLE_UNBOUND_LINK:{code:"AX-ENGINE-010",title:"No Engine For Role",description:"A confined agent asked for inference on a role the supervisor has no engine bound to. Roles are resolved on the supervisor's side before the agent starts, so an unbound one here means resolution and the cognet's declaration disagree.",source:"runtime",severity:"fatal"},ENGINE_KIND_MISMATCH_LINK:{code:"AX-ENGINE-011",title:"Engine Kind Mismatch",description:"A role bound to a transform or session engine was asked to serve a generate call. Resolution already matched the declared type, so reaching here means a provider's create() disagreed with the capability it was handed.",source:"runtime",severity:"fatal"},ENGINE_MISSING:{code:"AX-ENGINE-001",title:"No Engine Configured",description:"The agent's blueprint has no engine \u2014 it cannot dispatch to a model. Set `engine` in axon.config.ts.",source:"runtime",severity:"fatal"},ENGINE_ROLE_UNBOUND:{code:"AX-ENGINE-002",title:"Engine Role Not Bound",description:"The cognet asked for an engine role that resolution did not fill. A required role stops the boot, so reaching this means an OPTIONAL role was used without checking `kernel.engine.has()` first \u2014 or the role was never declared in the cognet's `engines:` block.",source:"runtime",severity:"fatal"},RESOURCES_EXHAUSTED:{code:"AX-RES-001",title:"Not Enough Memory",description:"A local model does not fit in what is left of this machine's video memory. Nothing was evicted: another agent is using it, and taking memory out from under a running agent would slow it down invisibly. Stop an agent that is holding a model, or raise the ceiling in your profile's `resources`.",source:"runtime",severity:"degraded",expected:!0},ENGINE_PIN_UNAVAILABLE:{code:"AX-ENGINE-004",title:"Model Not Available",description:"The agent pins a model no declared provider can supply. The agent still runs \u2014 resolution picked the best available model instead \u2014 but it is NOT the one that was asked for. Declare the provider that supplies it in your profile, or pick a model from a provider you have.",source:"runtime",severity:"degraded",expected:!0},ENGINE_REQUIREMENTS_UNMET:{code:"AX-ENGINE-003",title:"Inference Requirements Unmet",description:"This cognet declares engine roles that nothing among the user's providers can fill. Add a provider that supplies what is missing, or run a cognet whose requirements this machine meets.",source:"runtime",severity:"fatal",expected:!0},INJECT_OUTSIDE_RUNTIME:{code:"AX-RUNTIME-001",title:"Runtime Accessed Before Boot",description:"A runtime global (axon, args) was read before the runtime finished booting.",source:"runtime",severity:"fatal"},BOOT_FAILED:{code:"AX-BOOT-001",title:"Agent Failed To Start",description:"The agent's runtime crashed while starting, before it could accept requests.",source:"runtime",severity:"fatal"},BOOT_SCRIPT_FAILED:{code:"AX-BOOT-002",title:"Boot Script Failed",description:"The agent's boot.vue threw while rendering \u2014 check the script setup block for the error.",source:"runtime",severity:"fatal"},BOOT_SCRIPT_INVALID:{code:"AX-BOOT-003",title:"Boot Script Malformed",description:"The agent's boot.vue has content outside its recognized <script>/<template> blocks, or otherwise failed to parse as a valid SFC.",source:"runtime",severity:"fatal"},COGNET_ACCESSED_BEFORE_LOAD:{code:"AX-COGNET-001",title:"Cognet Accessed Before Load",description:"A cognet global (kernel, phase, system, blueprint) was read before the brain finished loading, or outside the loop body that owns it.",source:"cognet",severity:"fatal"},COGNET_LOOP_ALREADY_DECLARED:{code:"AX-COGNET-002",title:"Loop Already Declared",description:"A cognet's main() called loop() more than once \u2014 the loop is the program's entire main body and can only be declared once.",source:"cognet",severity:"fatal"},COGNET_ALREADY_LOADED:{code:"AX-COGNET-003",title:"Cognet Bound To A Different Kernel",description:"This cognet instance already loaded against a different kernel ABI \u2014 a reload produced a conflicting bind instead of a clean swap.",source:"cognet",severity:"fatal"},COGNET_NO_LOOP:{code:"AX-COGNET-004",title:"Cognet Declared No Loop",description:"The cognet's main() ran (or was woken) without ever declaring loop() \u2014 there is no program to run.",source:"cognet",severity:"fatal"},COGNET_MAX_TICKS:{code:"AX-COGNET-005",title:"Cognet Exceeded Max Ticks",description:"The cognet's loop ran more ticks in one wake than its configured limit allows \u2014 likely a runaway loop that never calls stop().",source:"cognet",severity:"fatal"},COGNET_ABI_MISMATCH:{code:"AX-COGNET-006",title:"Cognet ABI Mismatch",description:"The compiled cognet targets a kernel ABI version the running kernel doesn't provide \u2014 rebuild the cognet against the current framework version.",source:"cognet",severity:"fatal"},COGNET_MISSING:{code:"AX-COGNET-007",title:"No Compiled Cognet",description:"The blueprint points at a compiled cognet bundle that doesn't exist on disk yet \u2014 run `axon prepare` before booting.",source:"cognet",severity:"fatal"},COGNET_HASH_MISMATCH:{code:"AX-COGNET-008",title:"Cognet Bundle Hash Mismatch",description:"The compiled cognet bundle on disk doesn't match the hash the blueprint expects \u2014 it's stale or was tampered with. Run `axon prepare` again.",source:"cognet",severity:"fatal"},COGNET_INVALID:{code:"AX-COGNET-009",title:"Invalid Cognet Bundle",description:"The compiled cognet's default export isn't a real cognet definition \u2014 the compile step produced something malformed.",source:"cognet",severity:"fatal"},COGNET_IDENTITY_MISMATCH:{code:"AX-COGNET-010",title:"Cognet Identity Mismatch",description:"The compiled cognet artifact's own name doesn't match what the blueprint declared \u2014 the wrong bundle may be at this path.",source:"cognet",severity:"fatal"},COGNET_CONFIG_MISSING:{code:"AX-COGNET-011",title:"Cognet Config Missing",description:"No cognet.config.ts was found in the cognet's source directory \u2014 every cognet needs one to declare its identity.",source:"cognet",severity:"fatal"},COGNET_BUILD_FAILED:{code:"AX-COGNET-012",title:"Cognet Failed To Compile",description:"Bundling the cognet's source into a runnable artifact failed \u2014 check the build log for the underlying syntax or import error.",source:"cognet",severity:"fatal"},COGNET_RUNTIME_UNAVAILABLE:{code:"AX-COGNET-014",title:"Cognet Runtime Temporarily Unavailable",description:"The cognet runtime is declared but not present on disk \u2014 the dependency tree is mid-rewrite. Transient: the reload keeps the previous blueprint and picks the change up on the next watch event.",source:"cognet",severity:"recovered"},COGNET_AMBIGUOUS:{code:"AX-COGNET-015",title:"Two Cognets Declared",description:"The agent both declares `cognet:` in axon.config.ts and holds an inline cognet at `cognet/`. An agent has exactly one brain, and choosing between them silently would either ignore a directory of source or overrule what the author wrote. Keep one.",source:"cognet",severity:"fatal"},COGNET_NOT_FOUND:{code:"AX-COGNET-013",title:"Cognet Not Found",description:"The cognet named by `cognet:` in axon.config.ts could not be located. The detail says where it was looked for \u2014 a registry that answered 404, or a node_modules tree it was missing from. Check the specifier for a typo, and check which registry the CLI is pointed at (AXON_API_BASE).",source:"cognet",severity:"fatal",expected:!0},MODULE_SPECIFIER_INVALID:{code:"AX-PROJECT-005",title:"Invalid Module Specifier",description:"Module names must be scoped as @scope/name. The registry does not accept unscoped packages, so an unscoped specifier can never resolve.",source:"manifest",severity:"fatal"},CONFIG_MODULES_UNPARSEABLE:{code:"AX-PROJECT-006",title:"Could Not Edit axon.config.ts",description:"The install succeeded but the module entry could not be written into the config's modules array automatically \u2014 add or remove it by hand.",source:"manifest",severity:"fatal"},CONFIG_ENGINE_DEPRECATED:{code:"AX-PROJECT-033",title:"`engine:` Is Deprecated And Ignored",description:"This agent's axon.config.ts declares `engine:`, which the runtime no longer reads \u2014 inference is resolving against the profile's providers instead. Use `model: \"codex:gpt-5.6-terra\"` for a cortex pin, and `providers: [...]` for a source the user would not otherwise have.",source:"manifest",severity:"degraded"},MODULE_DEPENDENCY_INSTALL_FAILED:{code:"AX-PROJECT-004",title:"Module Dependencies Failed To Install",description:"The module source was downloaded, but its npm dependencies could not be materialized for the agent. Resolve the package-manager error and run the install again.",source:"manifest",severity:"fatal"},BLUEPRINT_NOT_LOADED:{code:"AX-PROJECT-002",title:"Blueprint Accessed Before Load",description:"Something read the blueprint's current value before load() had ever run.",source:"manifest",severity:"fatal"},AGENT_INVALID:{code:"AX-PROJECT-003",title:"Invalid Agent Directory",description:"The agent root has no package.json \u2014 every agent is a real package, this one isn't.",source:"manifest",severity:"fatal"},CORRUPT_JSON:{code:"AX-PROJECT-016",title:"Corrupt JSON File",description:"A stored JSON file failed to parse \u2014 it may have been hand-edited into an invalid state, or a write was interrupted mid-flight.",source:"manifest",severity:"fatal"},FILE_UNREADABLE:{code:"AX-PROJECT-032",title:"File Could Not Be Read",description:"A file exists but could not be read \u2014 most often a permissions problem, a directory where a file was expected, or a disk error. Distinct from a missing file, which is an ordinary absent-surface state.",source:"manifest",severity:"fatal"},PROVIDER_NOT_CONNECTED:{code:"AX-TUI-011",title:"Provider Not Connected",description:"The selected model routes through a provider (OpenRouter, Codex) that isn't connected yet \u2014 connect it before picking a model on that route.",source:"tui",severity:"fatal",expected:!0},PALETTE_INPUT_REQUIRED:{code:"AX-TUI-012",title:"Required Input Missing",description:"A palette command needs a value for this field before it can run.",source:"tui",severity:"fatal",expected:!0},BENCH_NO_CASES:{code:"AX-TUI-013",title:"Bench Declared No Cases",description:"The bench's test file ran to completion under Bun but never declared a single benchmark case.",source:"tui",severity:"fatal"},PROJECT_NOT_FOUND:{code:"AX-PROJECT-017",title:"Project Not Found",description:"No axon.config.ts, module.config.ts, cognet.config.ts, bench.config.ts, or prompt.config.ts was found at this path \u2014 it isn't a recognized project directory.",source:"manifest",severity:"fatal",expected:!0},PROJECT_WRONG_KIND:{code:"AX-PROJECT-011",title:"Wrong Project Kind",description:"This command targets one project kind, and the directory holds another \u2014 run the command that matches what is actually here.",source:"manifest",severity:"fatal",expected:!0},PROJECT_EXISTS:{code:"AX-PROJECT-018",title:"Project Already Exists",description:"Scaffolding refused to overwrite a directory that already exists \u2014 remove it or pick a different name first.",source:"manifest",severity:"fatal"},TYPEGEN_NO_BLUEPRINT:{code:"AX-PROJECT-007",title:"Typegen Needs A Loaded Blueprint",description:"Agent-kind typegen was called without a blueprint \u2014 its declared surfaces are the source of the generated types.",source:"manifest",severity:"fatal"},DEPLOY_AGENTS_ONLY:{code:"AX-PROJECT-008",title:"Only Agents Can Deploy",description:"A module was asked to deploy on its own \u2014 modules only run installed inside an agent, deploy the agent instead.",source:"manifest",severity:"fatal"},PUBLISH_UNSUPPORTED_KIND:{code:"AX-PROJECT-009",title:"This Project Kind Cannot Publish",description:"The registry accepts agents, modules, cognets, benches and prompts. Extensions are not accepted yet \u2014 the `registry_artifact_kind` enum needs the value first, and publishing before then would register under the wrong kind and claim the name in the shared namespace. A profile is never publishable: it holds one person's credentials, history and agents. See KINDS[kind].publishable.",source:"manifest",severity:"fatal"},MODEL_SPECIFIER_INVALID:{code:"AX-MODEL-001",title:"Malformed Model Specifier",description:"A `models:` entry in cognet.config.ts could not be parsed. The short form is `hf:owner/repo/path/to/file` \u2014 a repo alone is ambiguous, since one repo holds many weights.",source:"manifest",severity:"fatal"},MODEL_FETCH_FAILED:{code:"AX-MODEL-002",title:"Model Weights Could Not Be Fetched",description:"A declared model could not be downloaded. Check the repo, file path and revision, and that the machine can reach the registry. A brain without its weights is broken rather than degraded, so this fails at prepare instead of at first inference.",source:"manifest",severity:"fatal"},MODEL_HASH_MISMATCH:{code:"AX-MODEL-003",title:"Model Weights Failed Verification",description:"Downloaded bytes did not hash to the expected value \u2014 the upstream file changed, or the download was corrupted. Nothing is cached: storing unverified weights would make every later run trust them.",source:"manifest",severity:"fatal"},MODEL_NOT_CACHED:{code:"AX-MODEL-004",title:"Declared Model Is Not Cached",description:"`--frozen` asserts the machine is already provisioned, so it will not fetch. Run `axon prepare` without --frozen to populate the model cache.",source:"manifest",severity:"fatal"},PREPARE_FROZEN_DRIFT:{code:"AX-PROJECT-014",title:"Dependencies Drifted From The Lockfile",description:"`--frozen` asserts that package.json, the lockfile and node_modules already agree. Something did not: a dependency is missing, at a version outside its declared range, or declared but no longer selected. Run `axon prepare` without --frozen to reconcile, and commit the result.",source:"manifest",severity:"fatal"},PUBLISH_VERIFY_FAILED:{code:"AX-PROJECT-013",title:"Artifact Does Not Compile",description:"The package was built, but compiling it the way a consumer would failed \u2014 so publishing it would ship something nobody can install. Usually a file the source imports was left out of the package. Published versions are immutable, so this is caught before upload rather than after.",source:"manifest",severity:"fatal"},DEPLOY_PROVISION_FAILED:{code:"AX-PROJECT-012",title:"Deployment Provisioning Failed",description:"The agent was published, but the cloud control plane could not provision its runtime. The request ID identifies the server-side failure.",source:"manifest",severity:"fatal"},DEPLOY_RUNTIME_FAILED:{code:"AX-PROJECT-035",title:"Agent Failed To Start",description:"Cloud infrastructure was provisioned, but the agent process failed during boot. The reported runtime diagnostic identifies the immediate cause.",source:"runtime",severity:"fatal"},DEPLOY_ENV_RESERVED:{code:"AX-PROJECT-036",title:"Reserved Deployment Variable",description:"The production .env file attempts to override a variable owned by the Axon runtime or Cloud Run.",source:"manifest",severity:"fatal"},DEPLOY_ENV_INVALID:{code:"AX-PROJECT-015",title:"Invalid Deployment Variable",description:"The production .env file contains a key that is not a valid environment variable name.",source:"manifest",severity:"fatal"},BUNDLE_MODULE_COLLISION:{code:"AX-PROJECT-019",title:"Module Name Collision",description:"A hard-imported source module's name collides with an already-installed registry module of the same name.",source:"manifest",severity:"fatal"},BUNDLE_INVALID:{code:"AX-PROJECT-010",title:"Invalid Bundle Source",description:"The directory being bundled has no package.json, or its package.json has no name \u2014 every bundle needs a real package identity.",source:"manifest",severity:"fatal"},BUNDLE_TAR_MISSING:{code:"AX-PROJECT-020",title:"tar Not Found",description:"Bundling shells out to the system's tar binary, which isn't on PATH \u2014 install Git for Windows or use WSL on that platform.",source:"manifest",severity:"fatal"},BUNDLE_TAR_FAILED:{code:"AX-PROJECT-021",title:"tar Failed",description:"The tar subprocess exited non-zero while building a bundle archive.",source:"manifest",severity:"fatal"},BENCH_RUN_NOT_FOUND:{code:"AX-BENCH-001",title:"Bench Run Not Found",description:"No recorded bench run exists with this id.",source:"bench",severity:"fatal",expected:!0},BENCH_NOT_FOUND:{code:"AX-BENCH-002",title:"Bench Not Found",description:"No bench.config.ts was found at this path \u2014 it isn't a recognized bench project.",source:"bench",severity:"fatal",expected:!0},BENCH_TESTS_NOT_FOUND:{code:"AX-BENCH-003",title:"Bench Test Files Not Found",description:"The bench config declares test files that don't exist on disk.",source:"bench",severity:"fatal",expected:!0},BENCH_LOCAL_REF_NOT_FOUND:{code:"AX-BENCH-004",title:"Bench Local Reference Not Found",description:"A factor variable references a local file/directory that doesn't exist.",source:"bench",severity:"fatal",expected:!0},BENCH_CONFIG_INVALID:{code:"AX-BENCH-005",title:"Bench Config Invalid",description:"bench.config.ts failed to evaluate or didn't produce a valid bench definition.",source:"bench",severity:"fatal"},BENCH_PACKAGE_NOT_FOUND:{code:"AX-BENCH-006",title:"Bench Package Not Found",description:"No package.json exists at the bench root \u2014 every bench project needs one for identity.",source:"bench",severity:"fatal",expected:!0},BENCH_PACKAGE_NAME_REQUIRED:{code:"AX-BENCH-007",title:"Bench Package Name Required",description:"The bench's package.json has no name field.",source:"bench",severity:"fatal",expected:!0},BENCH_PACKAGE_VERSION_REQUIRED:{code:"AX-BENCH-008",title:"Bench Package Version Required",description:"The bench's package.json has no version field.",source:"bench",severity:"fatal",expected:!0},BENCH_CONTEXT_MISSING:{code:"AX-BENCH-009",title:"Bench Context Missing",description:"The benchmark preload needs AXON_BENCH_CONTEXT set \u2014 it was run outside the bench harness.",source:"bench",severity:"fatal"},BENCH_NO_ACTIVE_CASE:{code:"AX-BENCH-010",title:"No Active Bench Case",description:"A bench emission (measurement, artifact) happened outside any running Bun test \u2014 these calls must occur inside a test case.",source:"bench",severity:"fatal"},BENCH_WORKSPACE_UNAVAILABLE:{code:"AX-BENCH-011",title:"Bench Workspace Unavailable",description:"The bench's workspace directory hasn't been materialized yet for this run.",source:"bench",severity:"fatal"},BENCH_AGENT_UNRESOLVED:{code:"AX-BENCH-012",title:"Bench Agent Unresolved",description:"The bench's declared subject agent isn't a prepared local agent \u2014 run `axon prepare` on it first.",source:"bench",severity:"fatal"},BENCH_MEASUREMENT_UNKNOWN:{code:"AX-BENCH-013",title:"Unknown Bench Measurement",description:"A measurement was emitted under an id the bench config never declared.",source:"bench",severity:"fatal"},BENCH_MEASUREMENT_TYPE:{code:"AX-BENCH-014",title:"Bench Measurement Type Mismatch",description:"A measurement's emitted value doesn't match the type its bench config declaration expects.",source:"bench",severity:"fatal"},BENCH_MEASUREMENT_DOMAIN:{code:"AX-BENCH-015",title:"Bench Measurement Out Of Domain",description:"A measurement's emitted value falls outside the range or category the bench config declares for it.",source:"bench",severity:"fatal"},BENCH_DIMENSION_UNKNOWN:{code:"AX-BENCH-016",title:"Unknown Bench Dimension",description:"A dimension value was set under an id the bench config never declared.",source:"bench",severity:"fatal"},BENCH_DIMENSION_DOMAIN:{code:"AX-BENCH-017",title:"Bench Dimension Out Of Domain",description:"A dimension's set value isn't one of the categories its bench config declares.",source:"bench",severity:"fatal"},BENCH_AXIS_UNKNOWN:{code:"AX-BENCH-018",title:"Unknown Bench Factor",description:"Something referenced a factor id the running bench's coordinate never assigned a value to.",source:"bench",severity:"fatal"},BENCH_ARTIFACT_UNKNOWN:{code:"AX-BENCH-019",title:"Unknown Bench Artifact",description:"An artifact was emitted under an id the bench config never declared.",source:"bench",severity:"fatal"},BENCH_ARTIFACT_MEDIA_TYPE:{code:"AX-BENCH-020",title:"Bench Artifact Media Type Not Allowed",description:"An artifact was emitted with a media type its bench config declaration doesn't allow.",source:"bench",severity:"fatal"},BENCH_SCHEMA_UNREADABLE:{code:"AX-BENCH-030",title:"Bench Schema Unreadable",description:"bench.config.ts could not be parsed while extracting the measurement schema.",source:"bench",severity:"fatal"},BENCH_SCHEMA_EMPTY:{code:"AX-BENCH-031",title:"Bench Schema Empty",description:"defineBench<Schema> was given a type with no properties \u2014 an empty schema and a failed extraction must never look alike.",source:"bench",severity:"fatal"},BENCH_SCHEMA_UNSUPPORTED_TYPE:{code:"AX-BENCH-032",title:"Bench Measurement Type Unsupported",description:"A measurement is not a boolean, number, union of string literals, or string.",source:"bench",severity:"fatal"},BENCH_SCHEMA_EXTRACTION_FAILED:{code:"AX-BENCH-033",title:"Bench Schema Extraction Failed",description:"The schema worker did not return a schema. Prepare fails rather than continuing with an empty one, which would silently make every measurement undeclared.",source:"bench",severity:"fatal"},BENCH_AXIS_NOT_FOUND:{code:"AX-BENCH-021",title:"Bench Axis Not Found",description:"The bench config's matrix has no axis with this key.",source:"bench",severity:"fatal",expected:!0},BENCH_AXIS_VALUE_NOT_FOUND:{code:"AX-BENCH-022",title:"Bench Axis Value Not Found",description:"The bench config's matrix axis has no declared value with this id.",source:"bench",severity:"fatal",expected:!0},BENCH_WORKSPACE_ESCAPE:{code:"AX-BENCH-023",title:"Bench Workspace Path Escapes Root",description:"A workspace source entry resolved to a path outside the workspace directory \u2014 refused rather than materialized.",source:"bench",severity:"fatal"},BENCH_WORKSPACE_SYMLINK_UNSUPPORTED:{code:"AX-BENCH-024",title:"Bench Workspace Symlinks Unsupported",description:"A workspace source contains a symlink \u2014 not supported when materializing a bench workspace.",source:"bench",severity:"fatal"},BENCH_WORKSPACE_OUTSIDE_ROOT:{code:"AX-BENCH-025",title:"Bench Template Outside Root",description:"A workspace template's declared source path resolves outside the bench project root.",source:"bench",severity:"fatal"},BENCH_WORKSPACE_SOURCE_NOT_FOUND:{code:"AX-BENCH-026",title:"Bench Template Not Found",description:"A workspace template's declared source path isn't a real directory.",source:"bench",severity:"fatal",expected:!0},BENCH_LOG_INVALID:{code:"AX-BENCH-027",title:"Bench Log Invalid",description:"A bench run's event log is missing an entry its projection requires \u2014 the log is incomplete or was written out of order.",source:"bench",severity:"fatal"},TOOL_DECLARE_FAILED:{code:"AX-BLUEPRINT-002",title:"Tool Declaration Failed",description:"Compiling a src/tools/*.ts file's TypeScript declarations failed \u2014 the worker subprocess reported a compile error.",source:"manifest",severity:"fatal"},TOOL_BUNDLE_FAILED:{code:"AX-BLUEPRINT-006",title:"Tool Bundle Failed",description:"Bundling a src/tools/*.ts file to self-contained source failed \u2014 the bundler subprocess reported an error. Tools are bundled so the sandbox loads them without mounting the project; a bundle failure means the tool cannot enter the box.",source:"manifest",severity:"fatal"},ROUTE_LOAD_FAILED:{code:"AX-BLUEPRINT-007",title:"Route Load Failed",description:"A file in server/api/ could not be imported. The agent would serve an endpoint set that is not the declared one \u2014 a caller gets a 404 for a route whose file exists.",source:"manifest",severity:"fatal"},SCRIPT_LOAD_FAILED:{code:"AX-BLUEPRINT-008",title:"Script Load Failed",description:"A file in src/scripts/ could not be processed. `axon run <name>` would report the script as not found while its file sits in the project.",source:"manifest",severity:"fatal"},PLUGIN_LOAD_FAILED:{code:"AX-BLUEPRINT-009",title:"Plugin Load Failed",description:"A plugin could not be imported. Plugins wire server behaviour at boot; one silently missing means the agent runs without behaviour its author declared.",source:"manifest",severity:"fatal"},MIDDLEWARE_LOAD_FAILED:{code:"AX-BLUEPRINT-010",title:"Middleware Load Failed",description:"A middleware file could not be imported. Middleware commonly carries auth and validation, so a silently skipped one is a request path running without the checks its author wrote.",source:"manifest",severity:"fatal"},PROMPT_INTROSPECT_FAILED:{code:"AX-BLUEPRINT-011",title:"Prompt Introspection Failed",description:"A .vue prompt could not be introspected for its props. The prompt would render without the inputs it declares, or not at all.",source:"manifest",severity:"fatal"},CONFIG_NOT_FOUND:{code:"AX-BLUEPRINT-003",title:"Config Not Found",description:"No axon.config.ts exists at this path.",source:"manifest",severity:"fatal",expected:!0},CONFIG_LOAD_FAILED:{code:"AX-BLUEPRINT-004",title:"Config Failed To Load",description:"axon.config.ts threw or failed to evaluate \u2014 check the file for a syntax or runtime error.",source:"manifest",severity:"fatal"},CONFIG_INVALID:{code:"AX-BLUEPRINT-005",title:"Config Invalid",description:"axon.config.ts evaluated but never called defineAgent() \u2014 every agent config must produce one.",source:"manifest",severity:"fatal"},ENGINE_NO_DONE:{code:"AX-KERNEL-001",title:"Engine Stream Ended Without Completing",description:"The model driver's stream ended without ever emitting a completion event \u2014 the engine likely disconnected or crashed mid-response.",source:"kernel",severity:"fatal"},ENGINE_NOT_CONNECTED:{code:"AX-KERNEL-015",title:"Provider Not Connected",description:"This model's route is not connected to your account yet \u2014 run `:provider <name> connect` for the provider named below, or pick a model on a route you are already signed in to.",source:"kernel",severity:"fatal",expected:!0},ENGINE_AUTH_FAILED:{code:"AX-KERNEL-016",title:"Provider Rejected Your Credentials",description:"The provider refused the credential this agent is using \u2014 it has expired, been revoked, or is for a different account. Reconnect the provider, or pick a model on a route you are signed in to.",source:"kernel",severity:"fatal",expected:!0},ENGINE_RATE_LIMITED:{code:"AX-KERNEL-017",title:"Provider Rate Limit Reached",description:"The provider is refusing further calls right now \u2014 either too many requests in a short window, or a subscription whose allowance is spent. Waiting usually clears the first; the second needs a plan change or a different model.",source:"kernel",severity:"fatal",expected:!0},ENGINE_QUOTA_EXHAUSTED:{code:"AX-KERNEL-018",title:"Provider Credits Exhausted",description:"This route has no credit left to spend. Top it up, or switch to a model on a route that does \u2014 the conversation is intact either way.",source:"kernel",severity:"fatal",expected:!0},ENGINE_REQUEST_REJECTED:{code:"AX-KERNEL-019",title:"Provider Rejected The Request",description:"The provider refused this call as malformed or unsupported \u2014 commonly a model id it does not serve, a context window this conversation has outgrown, or a parameter that route does not accept.",source:"kernel",severity:"fatal",expected:!0},ENGINE_UNREACHABLE:{code:"AX-KERNEL-020",title:"Could Not Reach The Provider",description:"The provider could not be reached, or kept failing, across every retry \u2014 usually a network problem on this machine or an outage on their side. Nothing about this agent needs changing; try again.",source:"kernel",severity:"fatal",expected:!0},ENGINE_STREAM_FAILED:{code:"AX-KERNEL-008",title:"Engine Stream Failed",description:"The model driver's stream failed and exhausted its retries (or the failure wasn't retryable) \u2014 see context for the provider's fault code.",source:"kernel",severity:"fatal"},CODEX_NOT_CONNECTED:{code:"AX-KERNEL-012",title:"Codex Subscription Not Connected",description:"This agent uses a Codex model, but your Axon account is not connected to ChatGPT \u2014 run :provider codex connect and try again.",source:"kernel",severity:"fatal",expected:!0},RUN_IN_PROGRESS:{code:"AX-KERNEL-002",title:"A Wake Is Already Running",description:"The kernel only executes one wake at a time \u2014 a new run was requested while the previous one was still active.",source:"kernel",severity:"recovered"},RUN_RESERVATION_EXPIRED:{code:"AX-KERNEL-003",title:"Wake Reservation Expired",description:"The reserved execution slot for this wake is no longer active \u2014 it was released before the run could start.",source:"kernel",severity:"fatal"},NO_COGNET_LOADED:{code:"AX-KERNEL-004",title:"No Cognet Loaded",description:"The kernel tried to execute a wake, but the blueprint carried no cognet definition to run it against.",source:"kernel",severity:"fatal"},SYSCALL_OUTSIDE_RUN:{code:"AX-KERNEL-005",title:"Syscall Outside An Active Run",description:"A kernel syscall (engine.stream and similar) was made with no active wake to attribute it to.",source:"kernel",severity:"fatal"},CAPSULE_ACCESSED_BEFORE_BOOT:{code:"AX-KERNEL-007",title:"Capsule Accessed Before Boot",description:"Something reached for the live capsule instance before boot() had run \u2014 there is no sandbox yet to hand back.",source:"kernel",severity:"fatal"},COGNET_EMIT_FORBIDDEN:{code:"AX-KERNEL-009",title:"Cognet Emit Forbidden",description:"A cognet tried to emit an event outside the cognet:* namespace \u2014 the ABI only lets a cognet narrate its own telemetry, never forge kernel machinery events.",source:"kernel",severity:"fatal"},KNOWLEDGE_NOT_FOUND:{code:"AX-KERNEL-011",title:"Knowledge Entry Not Found",description:"A cognet read a knowledge entry that does not exist. The knowledge store is not a cache \u2014 a brain reading something the catalogue advertised has hit a real inconsistency, so this is loud rather than an empty result.",source:"kernel",severity:"fatal",expected:!0},KNOWLEDGE_READONLY:{code:"AX-KERNEL-013",title:"Knowledge Entry Is Read-Only",description:"A cognet tried to write or remove knowledge contributed by a module. Module material lives inside its own package and the next install would destroy any change \u2014 so this fails loudly rather than succeeding and vanishing later. An agent's own data/knowledge/ is writable.",source:"kernel",severity:"fatal",expected:!0},KNOWLEDGE_RECORD_FAILED:{code:"AX-KERNEL-014",title:"Knowledge Mutation Went Unrecorded",description:"A knowledge write or remove succeeded on disk, but the session record of it could not be committed. The mutation is real and already visible to the agent; only its audit trail is missing, so this is reported rather than thrown \u2014 the caller cannot undo a completed write. It matters because 'the agent rewrote its own memory' is the fact you want weeks later when behaviour drifts, and here the ledger and the filesystem disagree.",source:"kernel",severity:"degraded"},KNOWLEDGE_ESCAPE:{code:"AX-KERNEL-021",title:"Knowledge Path Escapes Store",description:"A knowledge name resolved outside the store root. Names are identifiers, not paths \u2014 traversal is refused at the boundary rather than trusted not to happen.",source:"kernel",severity:"fatal"},SCHEDULER_MODE_MISMATCH:{code:"AX-KERNEL-010",title:"Scheduler Mode Mismatch",description:"A caller used the wrong wake verb for the cognet's mode: continuous cognets advance via tick(), driven by the body's clock; invocation cognets wake on a stimulus via request()/stream().",source:"kernel",severity:"fatal"},THREAD_UNKNOWN_PARENT:{code:"AX-SESSION-001",title:"Thread Branched From Unknown Parent",description:"A thread's recorded lineage points at a parent thread id that isn't registered in this session \u2014 the session index is inconsistent.",source:"thread",severity:"fatal"},THREAD_NOT_FOUND:{code:"AX-SESSION-002",title:"Thread Not Found",description:"The requested thread id isn't registered in this session.",source:"thread",severity:"fatal",expected:!0},THREAD_BRANCH_UNKNOWN:{code:"AX-SESSION-003",title:"Cannot Branch Unknown Thread",description:"A branch was requested from a parent thread id that isn't registered in this session.",source:"thread",severity:"fatal"},SENSORY_WRITE_FAILED:{code:"AX-SESSION-004",title:"Sensory Ring Write Failed",description:"A dense sense entry (audio or visual) could not be written to the session's sensory ring \u2014 usually a full or read-only data directory. Delivery to the cognet is unaffected; the debug window for this session will have a gap.",source:"runtime",severity:"degraded"},NO_COGNET:{code:"AX-BLUEPRINT-001",title:"No Cognet Declared",description:"The blueprint carries no cognet definition \u2014 an agent cannot run without a brain. The CLI or test harness must construct and pass one.",source:"runtime",severity:"fatal"},CONTROL_PATH_NOT_FOUND:{code:"AX-CONTROL-001",title:"Control Path Not Found",description:"A control-channel call named a method the peer does not expose. The two ends disagree about the surface \u2014 usually a TUI and an extension built from different versions.",source:"server",severity:"fatal",expected:!0},CONTROL_PATH_NOT_CALLABLE:{code:"AX-CONTROL-002",title:"Control Path Not Callable",description:"A control-channel call resolved to a value on the peer's handle that is not a function.",source:"server",severity:"fatal"},CONTROL_CALL_FAILED:{code:"AX-CONTROL-003",title:"Control Call Failed",description:"The peer served a control-channel call and it threw. The remote message is carried here \u2014 the failure surfaces at the local call site rather than being returned as a falsy value.",source:"server",severity:"fatal"},CONTROL_CLOSED:{code:"AX-CONTROL-004",title:"Control Channel Closed",description:"A control-channel call was made, or was still in flight, when the channel closed. In-flight calls reject on close rather than hanging forever on an answer that is no longer coming.",source:"server",severity:"fatal"},CONTROL_UNAUTHORIZED:{code:"AX-CONTROL-005",title:"Control Handshake Rejected",description:"A connection to the control socket presented a missing or incorrect token. The token lives in the instance record, which is readable only by the owning user \u2014 a mismatch means the caller is not the local Fleet extension.",source:"server",severity:"fatal"},PLUGIN_BOOT_FAILED:{code:"AX-SERVER-001",title:"Plugin Failed During Boot",description:"A server plugin threw while running at boot \u2014 plugins are the one place in server startup where a failure must abort the boot rather than being warned and skipped.",source:"server",severity:"fatal"},HANDLE_SHUTDOWN_FAILED:{code:"AX-RUNTIME-002",title:"Handle Failed To Shut Down",description:"One of the runtime's owned handles (kernel, etc.) threw during shutdown \u2014 teardown is error-isolated, so the others still ran, but this one didn't close cleanly.",source:"runtime",severity:"fatal"},BUS_HANDLER_FAILED:{code:"AX-RUNTIME-004",title:"Bus Handler Failed",description:"A handler subscribed to a runtime bus event threw. Handler failures are non-fatal by design \u2014 the remaining handlers still run \u2014 but they are recorded rather than swallowed, since plugins and modules register handlers and a silently-broken one is invisible rot.",source:"runtime",severity:"degraded"},TOOL_CALL_FAILED:{code:"AX-RUNTIME-003",title:"Tool Call Failed",description:"An axon.tools.<namespace>.<fn>() call from script-land completed with a non-ok result from the capsule \u2014 unwrapped here into a normal throw, since script-land expects the ordinary call/throw contract, not the kernel's own stable-result shape.",source:"runtime",severity:"fatal"},CAPSULE_TOOL_TIMEOUT:{code:"AX-CAPSULE-001",title:"Tool Load Timed Out",description:"The sandbox never confirmed loading a declared tool within the timeout \u2014 it may be stuck on a slow import or the subprocess is unresponsive.",source:"capsule",severity:"fatal"},CAPSULE_TOOL_SCOPE_MISMATCH:{code:"AX-CAPSULE-002",title:"Tool Scope Mismatch",description:"A tool's declared exports don't match what it actually exported once loaded in the sandbox \u2014 the bundled source and its declaration have drifted apart.",source:"capsule",severity:"fatal"},CAPSULE_TOOL_FAILED:{code:"AX-CAPSULE-003",title:"Tool Failed To Load",description:"A declared tool failed to load into the sandbox \u2014 its source may be malformed, too large to import, or the subprocess exited before confirming.",source:"capsule",severity:"fatal"},CAPSULE_CONFINE_UNAVAILABLE:{code:"AX-CAPSULE-004",title:"OS Confinement Unavailable",description:"The policy requested OS confinement (isolation: auto) but the host is missing a required primitive (bubblewrap, systemd, nft, or the axon-agent user). Run `axon install`, or set isolation: none to opt out explicitly. The capsule refuses to boot rather than silently run unconfined.",source:"capsule",severity:"fatal"},CAPSULE_CONFINE_USER_UNRESOLVED:{code:"AX-CAPSULE-005",title:"Confinement User Unresolved",description:"The confinement user exists but its numeric uid/gid could not be read \u2014 the box cannot drop privileges without them. The host user database may be inconsistent.",source:"capsule",severity:"fatal"},CAPSULE_BOOT_FAILED:{code:"AX-CAPSULE-006",title:"Capsule Failed To Boot",description:"The sandbox subprocess exited or reported failure before completing the boot handshake. The captured stderr in the error context is the real cause \u2014 most often a confinement mount that could not be satisfied (a declared fs path that does not exist) or a runtime that could not start.",source:"capsule",severity:"fatal"},CAPSULE_BOOT_TIMEOUT:{code:"AX-CAPSULE-007",title:"Capsule Boot Timed Out",description:"The sandbox subprocess did not report ready within the boot timeout. Its captured stderr is in the error context; if empty, the subprocess may be hung rather than crashed.",source:"capsule",severity:"fatal"},CAPSULE_SPAWN_FAILED:{code:"AX-CAPSULE-008",title:"Capsule Spawn Failed",description:"The capsule subprocess command could not be spawned at all \u2014 the interpreter or confinement wrapper was not found, or PATH is unset. Check that bun (and, under confinement, bwrap/systemd-run) are on PATH.",source:"capsule",severity:"fatal"},CAPSULE_WIRE_CLOSED:{code:"AX-CAPSULE-009",title:"Capsule Wire Closed",description:"A command was sent to the sandbox after its stdin pipe was gone \u2014 the subprocess has exited or is mid-teardown. The caller is racing the capsule lifecycle.",source:"capsule",severity:"fatal"},CAPSULE_DOWN:{code:"AX-CAPSULE-010",title:"No Live Capsule",description:"An operation needed a running sandbox subprocess, but none is live \u2014 it is booting, restarting after a crash, or has been declared dead.",source:"capsule",severity:"fatal"},CAPSULE_ALREADY_BOOTED:{code:"AX-CAPSULE-011",title:"Capsule Already Booted",description:"boot() was called on a capsule that already has a live subprocess. Boot is once per lifetime; use update()/reload() to replace a running incarnation.",source:"capsule",severity:"fatal"},CAPSULE_INSTALL_FAILED:{code:"AX-CAPSULE-013",title:"Confinement Install Failed",description:"Provisioning the host for the hardened confinement tier failed \u2014 most often because creating the dedicated system user needs root. Re-run `axon install` with sufficient privilege.",source:"capsule",severity:"fatal"},CAPSULE_HOST_UNAVAILABLE:{code:"AX-CAPSULE-014",title:"Host Bridge Unavailable",description:"Sandboxed code called a host service, but this capsule was built with no host provider. Host calls require a wired host bridge on the manager side.",source:"capsule",severity:"fatal"},CAPSULE_CRASHED:{code:"AX-CAPSULE-015",title:"Capsule Crashed",description:"An unhandled error escaped inside the sandbox subprocess. The capsule reports it on the wire and exits immediately \u2014 after an unhandled throw the sandbox's state is unknown, and a capsule that keeps serving is worse than one that dies loudly.",source:"capsule",severity:"fatal"},CAPSULE_DEAD:{code:"AX-CAPSULE-016",title:"Capsule Dead",description:"The capsule subprocess is gone and supervision gave up restarting it. Every subsequent execution request fails until a new capsule is booted.",source:"capsule",severity:"fatal"},CAPSULE_PARSE_ERROR:{code:"AX-CAPSULE-017",title:"Capsule Wire Parse Error",description:"A line arriving from the sandbox was not a valid protocol event. The sandbox is speaking garbage \u2014 a protocol mismatch or corrupted output \u2014 and the line is dropped rather than acted on, never silently.",source:"capsule",severity:"degraded"},CAPSULE_CMD_FAILED:{code:"AX-CAPSULE-018",title:"Capsule Command Failed",description:"Code executed in the sandbox threw. This is the ordinary failure path for an agent-emitted block or a script-land run() \u2014 the error is the sandboxed code's own, surfaced verbatim.",source:"capsule",severity:"degraded"},CAPSULE_FN_FAILED:{code:"AX-CAPSULE-019",title:"Tool Call Threw",description:"A mediated tool function threw inside the sandbox. The failure is the tool's own; it propagates to the calling code unchanged and is recorded as the closing half of the call's span.",source:"capsule",severity:"degraded"},CAPSULE_PROC_DENIED:{code:"AX-CAPSULE-020",title:"Process Spawn Denied",description:"A process the sandbox tried to start was refused \u2014 denied by policy, killed before it could spawn, or the spawn itself failed. No process was created.",source:"capsule",severity:"degraded"},CAPSULE_PROC_FAILED:{code:"AX-CAPSULE-022",title:"Managed Process Failed",description:"A spawned child process errored without ever producing an exit code \u2014 an exec failure or a broken IPC channel. Distinct from a non-zero exit, which is the process running correctly and reporting a result.",source:"capsule",severity:"degraded"},CAPSULE_PROC_STDIN_FAILED:{code:"AX-CAPSULE-021",title:"Process Stdin Write Failed",description:"Writing to a managed child process's stdin failed \u2014 the process is no longer running, or its stdin has already closed.",source:"capsule",severity:"degraded"},NOT_BOOTED:{code:"AX-TUI-001",title:"No Agent Running",description:"A message was sent, or an action requiring a live agent was taken, before any agent finished booting.",source:"tui",severity:"fatal"},NOT_AUTHENTICATED:{code:"AX-TUI-002",title:"Not Logged In",description:"The action needs an active profile, but none is logged in yet.",source:"tui",severity:"fatal",expected:!0},PROFILE_NOT_AUTHENTICATED:{code:"AX-TUI-003",title:"Profile Has No Session",description:"The target profile exists but has no stored session \u2014 it has never logged in, or its session was cleared.",source:"tui",severity:"fatal",expected:!0},BACKEND_UNREACHABLE:{code:"AX-TUI-044",title:"Backend Unreachable",description:"A stored credential could not be verified because the backend could not be reached. The credential is NOT discarded \u2014 it may be perfectly valid \u2014 but it cannot be trusted until it is checked, so the action is refused rather than proceeding unverified.",source:"tui",severity:"fatal",expected:!0},PROFILE_UNKNOWN:{code:"AX-TUI-004",title:"Unknown Profile",description:"The requested profile id isn't one of the profiles stored on this machine.",source:"tui",severity:"fatal",expected:!0},SESSION_NOT_FOUND:{code:"AX-SESSION-005",title:"Session Not Found",description:"No session log exists at that path. A session is a .jsonl file under the agent's frame (`.agent/data/sessions/`); it may have been deleted, or belong to an agent that has since been removed.",source:"runtime",severity:"fatal",expected:!0},SESSION_UNREADABLE:{code:"AX-SESSION-006",title:"Session Log Unreadable",description:"The session log does not begin with a `session:header` line, so it cannot be forked or renamed. Either the file is truncated, or it was written by a version predating the header \u2014 an older log can still be read and resumed, just not copied.",source:"runtime",severity:"fatal",expected:!0},SESSION_ALREADY_RUNNING:{code:"AX-TUI-005",title:"Session Is Already Running",description:"spawn() was asked to resume a session that already has a live instance. Focus the running instance instead of booting a second runtime over the same log.",source:"tui",severity:"fatal",expected:!0},SESSION_NOT_RUNNING:{code:"AX-TUI-016",title:"Session Is Not Running",description:"focus() was pointed at a sessionId with no live instance behind it. Spawn (or resume) it first \u2014 focus is pure selection over running instances.",source:"tui",severity:"fatal",expected:!0},NO_ACTIVE_AGENT:{code:"AX-TUI-045",title:"No Active Agent",description:"The action needs a running agent, but none is active \u2014 start one first.",source:"tui",severity:"fatal",expected:!0},NO_LOCAL_PROJECT:{code:"AX-TUI-050",title:"No Local Project",description:"This agent has no project directory on this machine \u2014 it was attached over the network, so its source lives wherever it is running. Opening its config, or any other file verb, has to happen there. Focus a local agent instead.",source:"tui",severity:"fatal",expected:!0},NO_FOCUSED_INSTANCE:{code:"AX-TUI-017",title:"No Focused Agent Instance",description:"A module install/uninstall was requested with no running agent instance focused \u2014 spawn or focus one first.",source:"tui",severity:"fatal",expected:!0},MODEL_UNAVAILABLE:{code:"AX-TUI-051",title:"Model Not Available From Any Declared Provider",description:"The picked model was saved to the agent's config, but no provider this profile declares can supply it \u2014 so the running agent still uses its previous model. Connect the provider that serves it, or pick a model from the offered list.",source:"tui",severity:"fatal",expected:!0},MODEL_IMMUTABLE_DEPLOYED:{code:"AX-TUI-006",title:"Cannot Change A Deployment's Model",description:"A deployed agent's config lives in the cloud, not on this machine \u2014 its model is fixed at deploy time. Change it in the local project and deploy again.",source:"tui",severity:"fatal",expected:!0},MODULE_INSTALL_FAILED:{code:"AX-TUI-018",title:"Module Install Failed",description:"The registry installer returned an error for this module specifier \u2014 check the specifier and registry connectivity.",source:"tui",severity:"fatal"},NO_MODULES_INSTALLED:{code:"AX-TUI-019",title:"No Modules Installed",description:"The `:module uninstall` command was opened with no modules resolved into the focused instance's blueprint.",source:"tui",severity:"fatal"},SETTINGS_NOT_WRITABLE:{code:"AX-EXT-027",title:"Settings Cannot Be Written",description:"A settings change was requested on a store with no profile config behind it \u2014 nobody is logged in, or this Store was built without one (tests). Settings live in `profile.config.ts`, so there is nowhere to write them; the change was refused rather than saved somewhere nothing reads back.",source:"tui",severity:"fatal",expected:!0},REGISTRY_EMPTY:{code:"AX-TUI-047",title:"Nothing To Install",description:"The install palette was opened with no rows to show \u2014 the catalogue is still loading, the registry could not be reached, or everything published for that kind is already installed. The row itself says which.",source:"tui",severity:"fatal",expected:!0},NO_EXTENSIONS_INSTALLED:{code:"AX-TUI-046",title:"No Extensions Installed",description:"The `:ext uninstall` command was opened with no extensions declared in the active profile's profile.config.ts.",source:"tui",severity:"fatal",expected:!0},ATTACH_URL_REQUIRED:{code:"AX-TUI-048",title:"Attach URL Required",description:"`:attach` needs the address of a running agent \u2014 e.g. `:attach http://localhost:3010`. The agent must already be serving; attach binds to it and never boots anything.",source:"tui",severity:"fatal"},ATTACH_URL_INVALID:{code:"AX-TUI-049",title:"Attach URL Invalid",description:"The address is not a usable agent URL. An agent is reached over http or https and the scheme is required \u2014 `localhost:3010` is a path, `http://localhost:3010` is an address. Checked before anything connects, so a typo fails immediately rather than as a transport error.",source:"tui",severity:"fatal"},DEPLOYMENT_NOT_CONNECTABLE:{code:"AX-TUI-028",title:"Deployment Not Connectable",description:"The deployment is not in the connectable list \u2014 it may have stopped, errored, or never finished provisioning. Refresh the deployment list and try again.",source:"tui",severity:"fatal"},SUBAGENT_REMOTE_PARENT:{code:"AX-TUI-027",title:"Cannot Spawn A Subagent From A Deployment",description:"A subagent is forked from its parent's local project, and an attached deployment has no local project here \u2014 the deployed agent runs its own subagents inside its own capsule.",source:"tui",severity:"fatal"},BASE_MODEL_INSTANCE_CONFLICT:{code:"AX-TUI-026",title:"Managed Model Instance Already Running",description:"A managed base instance is already running on a different engine. The base workspace holds one shared config, so spawning a second naked model would rewrite it underneath the live instance \u2014 close the running one first.",source:"tui",severity:"fatal"},NOT_WIRED:{code:"AX-TUI-008",title:"Not Wired Yet",description:"This surface is a declared stub \u2014 the real implementation hasn't been built yet.",source:"tui",severity:"fatal"},MIC_ALREADY_CAPTURING:{code:"AX-TUI-009",title:"Mic Already Capturing",description:"capture.start() was called while a capture was already in progress \u2014 stop the current one first.",source:"tui",severity:"fatal"},MIC_CAPTURE_UNAVAILABLE:{code:"AX-TUI-010",title:"No Audio Capture Tool Found",description:"Voice input needs one of arecord, sox, or ffmpeg installed and on PATH.",source:"tui",severity:"fatal"},MIC_FFT_SIZE_MISMATCH:{code:"AX-TUI-014",title:"FFT Sample Size Mismatch",description:"computeBuckets() was called with a sample buffer that isn't exactly config.fftSize long \u2014 an internal invariant, callers must pad/trim first.",source:"tui",severity:"fatal"},MIC_CAPTURE_FAILED:{code:"AX-TUI-015",title:"Mic Capture Failed",description:"The audio capture subprocess produced no output or exited immediately \u2014 check that a microphone is available.",source:"tui",severity:"fatal"},WATCH_PATH_REQUIRED:{code:"AX-TUI-021",title:"Watch Path Required",description:"`axon watch`/`axon unwatch` need a directory argument.",source:"tui",severity:"fatal",expected:!0},WATCH_PATH_NOT_FOUND:{code:"AX-TUI-022",title:"Watch Path Not Found",description:"`axon watch` was given a directory that doesn't exist on disk.",source:"tui",severity:"fatal",expected:!0},EDITOR_NOT_SET:{code:"AX-TUI-023",title:"No Editor Configured",description:"`axon settings` needs the $EDITOR environment variable set to know which editor to open.",source:"tui",severity:"fatal"},EDITOR_LAUNCH_FAILED:{code:"AX-TUI-024",title:"Editor Failed To Launch",description:"The command in $EDITOR could not be spawned \u2014 check that it's installed and on PATH.",source:"tui",severity:"fatal"},WATCH_AND_INIT_ARGS_REQUIRED:{code:"AX-TUI-025",title:"Directory And Name Required",description:`The init palette's "watch a new directory" entry needs both a directory path and an agent name, space-separated.`,source:"tui",severity:"fatal",expected:!0},MODULE_CONFIG_LOAD_FAILED:{code:"AX-MODULE-001",title:"Module Config Failed To Load",description:"The runtime could not import a module's module.config.ts at boot \u2014 the file is missing at its resolved path, or importing it threw. A module that cannot load contributes nothing, so boot fails rather than run a partially-wired agent.",source:"runtime",severity:"fatal"},MODULE_SOURCE_DECLARED:{code:"AX-MODULE-008",title:"Module Declared As Source",description:"Uninstall was asked to remove a module that axon.config.ts declares as an IMPORT rather than by registry name. The import statement is the author's own code, so uninstall does not rewrite it \u2014 and removing the dependency alone would leave the config importing a package that is no longer declared, with the agent still loading it. Nothing was changed: delete the import and its entry in modules: [...] by hand.",source:"cli",severity:"fatal"},MODULE_NOT_INSTALLED:{code:"AX-MODULE-003",title:"Module Not Installed",description:"A plugin asked for the options of a module this agent does not have installed \u2014 almost always a name mismatch between the plugin and the module that ships it. Reported rather than defaulted: handing back an empty options bag would let a hardware module open the wrong device and never say so.",source:"runtime",severity:"fatal"},MODULE_OPTIONS_INVALID:{code:"AX-MODULE-002",title:"Invalid Module Options",description:"The options declared for a module under modules.<name> in axon.config.ts do not satisfy the module's options schema \u2014 a required option is missing or a value has the wrong type.",source:"runtime",severity:"fatal"},MODULE_SETUP_FAILED:{code:"AX-MODULE-007",title:"Module Setup Failed",description:"A module's setup() threw during agent boot. Setup runs sequentially in blueprint order and a failure is total \u2014 no later module is wired, and the agent does not boot half-configured.",source:"runtime",severity:"fatal"},MODULE_SERVER_NOT_WIRED:{code:"AX-MODULE-004",title:"Module Server API Not Wired",description:"A module's setup() called ctx.server.addRoute/addMiddleware or ctx.tools.get, but that surface is not implemented yet. Declare routes as server/api/ files in the module instead.",source:"runtime",severity:"fatal"},MODULE_ENV_REQUIRED:{code:"AX-MODULE-005",title:"Module Env Var Missing",description:"A module's setup() called ctx.env.require() for a variable the agent's resolved environment does not provide. The module declares required env in module.config.ts; the agent must supply it (e.g. in .env).",source:"runtime",severity:"fatal",expected:!0},MODULE_POLICY_IMMUTABLE:{code:"AX-MODULE-006",title:"Module Policy Is Immutable At Boot",description:"A module's setup() called ctx.policy.update(). The resolved agent policy is authoritative and cannot be mutated at boot \u2014 declare policy needs statically in module.config.ts so the CLI reconciles them at install.",source:"runtime",severity:"fatal",expected:!0},CLONE_REF_REQUIRED:{code:"AX-PROJECT-022",title:"No Artifact Named",description:"`axon clone` was run without an artifact to clone. Name one, for example: axon clone @axon/arxiv",source:"cli",severity:"fatal",expected:!0},FORK_REF_REQUIRED:{code:"AX-PROJECT-023",title:"No Artifact Named",description:"`axon fork` was run without an artifact to fork. Name one, for example: axon fork @axon/arxiv --as @you/arxiv",source:"cli",severity:"fatal"},FORK_NAME_REQUIRED:{code:"AX-PROJECT-024",title:"Fork Needs A New Name",description:"A fork is published under your own namespace, so it needs a name: pass --as <package-name>, for example: axon fork @axon/arxiv --as @you/arxiv",source:"cli",severity:"fatal"},CLONE_TARGET_EXISTS:{code:"AX-PROJECT-025",title:"Clone Target Not Empty",description:"The directory the artifact would be cloned into already has files in it. Clone into a new directory, or clear this one first.",source:"cli",severity:"fatal"},ARTIFACT_DOWNLOAD_FAILED:{code:"AX-PROJECT-026",title:"Artifact Download Failed",description:"The registry did not serve the artifact's source archive. The version may have been unpublished, or the network request failed.",source:"cli",severity:"fatal"},ARTIFACT_EXTRACT_FAILED:{code:"AX-PROJECT-027",title:"Artifact Extract Failed",description:"The downloaded archive could not be unpacked. It may be truncated, or `tar` is unavailable on this machine.",source:"cli",severity:"fatal"},VERSION_INVALID:{code:"AX-PROJECT-028",title:"Invalid Version",description:"The project's package.json version is not valid semver, so the next version cannot be derived from it. Fix the version field by hand.",source:"cli",severity:"fatal"},FRAMEWORK_NOT_INSTALLED:{code:"AX-PROJECT-029",title:"Framework Packages Not Installed",description:"The generated type frame references @arcforge/types, @arcforge/engines and h3, none of which resolve from this project. Run `bun install` before `axon prepare`.",source:"cli",severity:"fatal"},FRAME_MIGRATION_CONFLICT:{code:"AX-PROJECT-034",title:"Frame Migration Cannot Proceed Safely",description:"Runtime output exists in BOTH the old location and the new one, so migrating would have to merge or overwrite two sets of session history. Nothing was moved. Inspect both directories and remove or merge them by hand.",source:"cli",severity:"fatal"},CONFIG_EVALUATION_ESCAPED:{code:"AX-PROJECT-030",title:"defineAgent() Called Outside Config Evaluation",description:"defineAgent() ran outside the loader that evaluates axon.config.ts \u2014 it is a declaration helper, not a runtime function, and cannot be called from application code.",source:"cli",severity:"fatal"},PROMPT_NOT_INSTALLABLE:{code:"AX-PROJECT-037",title:"Prompts Are Not Installed Into Agents",description:"A prompt is content, not a capability: it resolves from the global cache and renders on demand, so every agent can already use it without declaring anything. Installing one into an agent would put content through the code path \u2014 an ABI check, a node_modules link, an agent reload \u2014 for something that needs none of it.",source:"manifest",severity:"fatal"},ASSET_TYPE_REFUSED:{code:"AX-PROJECT-038",title:"Unsupported Asset Type",description:"A file in assets/ is not a type the registry serves. Images (png, jpg, jpeg, webp, gif) and video (mp4, webm, mov) are accepted. SVG is deliberately refused: it is an executable document that would be served from our own storage origin, so a published SVG is a script-injection surface for every visitor reading that README.",source:"manifest",severity:"fatal",expected:!0},ASSET_TOO_LARGE:{code:"AX-PROJECT-039",title:"Asset Exceeds Size Limit",description:"A single file in assets/ is over the per-asset limit. Assets exist to illustrate a README, not to distribute media \u2014 compress the file or link to it externally.",source:"manifest",severity:"fatal",expected:!0},ASSETS_BUDGET_EXCEEDED:{code:"AX-PROJECT-040",title:"Assets Exceed Total Budget",description:"The assets/ folder as a whole is over budget for one published version. Every version stores its own copy of every asset, so the total is what determines how much a package costs to host forever.",source:"manifest",severity:"fatal",expected:!0},ASSET_PATH_INVALID:{code:"AX-PROJECT-041",title:"Unsafe Asset Path",description:"An entry under assets/ is a symlink, or its name escapes the assets directory. Both are refused: a published asset must be a real file that lands where its name says it does, or extraction on the server could write outside the target directory.",source:"manifest",severity:"fatal",expected:!0},ASSET_UNREADABLE:{code:"AX-PROJECT-042",title:"Asset Could Not Be Processed",description:"A file in assets/ has an image extension but could not be decoded, so it is either corrupt or not the format its name claims. Publishing it would ship a broken image into a README.",source:"manifest",severity:"fatal",expected:!0},PORT_UNAVAILABLE:{code:"AX-PROJECT-031",title:"No Free Port",description:"Every port in the range the agent scanned is already in use. Stop whatever is holding them, or start the agent on a different port.",source:"cli",severity:"fatal"},PARENT_INSTANCE_NOT_RUNNING:{code:"AX-RUNTIME-005",title:"Parent Agent Not Running",description:"A subagent was requested against a parent session that is no longer live \u2014 the parent shut down, crashed, or was never booted by this process.",source:"runtime",severity:"fatal"},SUBAGENT_DEPTH_EXCEEDED:{code:"AX-RUNTIME-006",title:"Subagent Depth Limit Reached",description:"An agent tried to spawn a subagent beyond the maximum nesting depth. The limit exists so a recursive delegation cannot spawn processes without bound.",source:"runtime",severity:"fatal"},SUBAGENT_CHILD_LIMIT_EXCEEDED:{code:"AX-RUNTIME-007",title:"Subagent Child Limit Reached",description:"One agent tried to hold more live children than the limit allows. Existing children must finish before more can be spawned.",source:"runtime",severity:"fatal"},SUBAGENT_DESCENDANT_LIMIT_EXCEEDED:{code:"AX-RUNTIME-008",title:"Subagent Descendant Limit Reached",description:"The whole subagent tree beneath one root exceeded its live-descendant budget. The limit bounds total concurrent processes, not just direct children.",source:"runtime",severity:"fatal"},SUBAGENT_REQUEST_INVALID:{code:"AX-RUNTIME-009",title:"Malformed Subagent Request",description:"A subagent request did not carry a usable prompt. It must be an object with `prompt` as a string or an array of strings.",source:"runtime",severity:"fatal"},INSTANCE_NOT_LOCAL:{code:"AX-RUNTIME-010",title:"Agent Instance Is Not Local",description:"An operation that only works against a locally booted agent was given a remote one. Subagent spawning and the managed base workspace both require a local process.",source:"runtime",severity:"fatal"},HOST_METHOD_UNKNOWN:{code:"AX-RUNTIME-011",title:"Unknown Host Method",description:"A booted agent called a host method this platform does not implement. The agent's framework version is likely newer than the CLI running it.",source:"runtime",severity:"fatal"},UPDATE_CURRENT_VERSION_INVALID:{code:"AX-TUI-029",title:"Running Version Is Not Semver",description:"The version this app reports for itself is not valid semver, so it cannot be compared against the latest release.",source:"cli",severity:"fatal"},UPDATE_RELEASE_INVALID:{code:"AX-TUI-030",title:"Malformed Release Record",description:"The backend's release record did not describe a valid @arcforge/axon `latest` version, so there is nothing safe to update to.",source:"cli",severity:"fatal"},UPDATE_UNAVAILABLE_IN_DEVELOPMENT:{code:"AX-TUI-031",title:"Update Not Available Here",description:"Self-update needs the packaged update helper and a supervisor request path, neither of which exists in a source checkout. Update the installed app instead.",source:"cli",severity:"fatal"},UPDATE_SUPERVISOR_UNAVAILABLE:{code:"AX-TUI-032",title:"Update Supervisor Unavailable",description:"The running app has no supervisor request path, so it cannot hand an update off to be applied after exit.",source:"cli",severity:"fatal"},UPDATE_HELPER_ARGS_INVALID:{code:"AX-TUI-033",title:"Malformed Update Helper Arguments",description:"The update helper was invoked without the --from/--to/--bun/--axon/--state arguments it requires. It is spawned by the app, not run by hand.",source:"cli",severity:"fatal"},UPDATE_HELPER_VERSION_INVALID:{code:"AX-TUI-034",title:"Update Helper Given Bad Versions",description:"The update helper received a --from or --to value that is not valid semver, so it refused to install anything.",source:"cli",severity:"fatal"},TEST_FILES_NOT_FOUND:{code:"AX-TUI-035",title:"No Test Files Matched",description:"No files matched the requested test patterns, so there was nothing to run. Check the pattern, or the directory it was resolved against.",source:"cli",severity:"fatal"},OLLAMA_UNAVAILABLE:{code:"AX-TUI-037",title:"Ollama Is Not Running",description:"No Ollama daemon answered on this machine. Start it with `ollama serve`, or install Ollama from https://ollama.com to run models locally.",source:"cli",severity:"fatal"},OLLAMA_REQUEST_FAILED:{code:"AX-TUI-038",title:"Ollama Request Failed",description:"The local Ollama daemon is running but refused a request \u2014 most often an unknown model name. The daemon's own message is included.",source:"cli",severity:"fatal"},OLLAMA_REGISTRY_UNREACHABLE:{code:"AX-TUI-039",title:"Ollama Registry Unreachable",description:"Could not reach the Ollama model registry to look a model up. Downloading needs a network connection; models already on disk still work offline.",source:"cli",severity:"fatal"},NO_EDITOR_ATTACHED:{code:"AX-TUI-042",title:"No Editor Attached",description:"Opening a pane hands it to a connected editor, and none is listening. Open this project in an editor running the Axon Fleet extension \u2014 it dials each running TUI itself, so the connection appears on its own once the window is up.",source:"tui",severity:"fatal"},NO_SESSION_TO_OPEN:{code:"AX-TUI-043",title:"No Session To Open",description:"A runtime pane is a view of one conversation, and no agent is focused yet \u2014 so there is nothing to point it at. Start or focus an agent first.",source:"tui",severity:"fatal"},CLEAR_IMMUTABLE_DEPLOYED:{code:"AX-TUI-041",title:"Cannot Clear A Deployment's Conversation",description:"A deployed agent owns its own session in the cloud \u2014 the TUI attaches to whatever session it is already running, so there is no fresh one to start from here. Use `:close` to detach, or clear it on a local instance of the same agent.",source:"tui",severity:"fatal"},OLLAMA_PULL_FAILED:{code:"AX-TUI-040",title:"Model Download Failed",description:"Ollama could not finish downloading the model. The name may not exist in the registry, or the transfer was interrupted \u2014 a retry resumes from whatever was already fetched.",source:"cli",severity:"fatal"},TEST_PRELOAD_MISSING:{code:"AX-TUI-036",title:"Test API Loaded Without Its Preload",description:"The instrumented test API was imported without the preload that installs it. Tests must run through `axon test`, which wires the preload.",source:"cli",severity:"fatal"},PROFILE_CONFIG_INVALID:{code:"AX-EXT-001",title:"profile.config.ts Did Not Call defineProfile()",description:"A profile's config must default-export defineProfile({ ... }). Without it there is no extension list to read, so nothing can be installed, enabled or disabled. The rest of the profile \u2014 main.ts and plugins/ \u2014 still loads.",source:"tui",severity:"fatal",expected:!0},PROFILE_CONFIG_FAILED:{code:"AX-EXT-002",title:"profile.config.ts Failed to Load",description:"The file threw while being evaluated, so its extension list could not be read and no extensions were loaded. The profile's own main.ts and plugins/ are unaffected \u2014 a typo in an extension list must not cost you the config you already had working.",source:"tui",severity:"degraded",expected:!0},EXTENSION_ENTRY_INVALID:{code:"AX-EXT-003",title:"Malformed Extension Entry",description:'An entry in profile.config.ts\'s `extensions` array is neither a string nor an object with a `source`. Accepted forms are "@scope/name" for a registry extension and "./extensions/name" for a local one.',source:"tui",severity:"degraded",expected:!0},EXTENSION_NOT_FOUND:{code:"AX-EXT-004",title:"Extension Not Found",description:"An extension listed in profile.config.ts is not on disk. A local path may have moved or been deleted; a registry name may never have been installed. Everything else in the list still loads.",source:"tui",severity:"degraded",expected:!0},EXTENSION_INSTALL_FAILED:{code:"AX-EXT-005",title:"Extension Install Failed",description:"A registry extension could not be fetched or prepared \u2014 most often no network, or a name that does not exist in the registry. It is skipped for this session and retried on the next launch.",source:"tui",severity:"degraded",expected:!0},EXTENSION_UNINSTALL_FAILED:{code:"AX-EXT-028",title:"Extension Uninstall Failed",description:"An extension could not be removed from profile.config.ts \u2014 most often the file is unreadable or has been edited into a shape the editor cannot find the extensions list in. The extension is still declared and will load on the next launch.",source:"tui",severity:"degraded",expected:!0},EXTENSION_NOT_AN_EXTENSION:{code:"AX-EXT-006",title:"Not an Extension",description:"The directory has no extension.config.ts, which is the file that marks a directory as an extension. A path pointing at an agent, a module, or an ordinary folder is not loadable as one.",source:"tui",severity:"degraded",expected:!0},EXTENSION_LOAD_FAILED:{code:"AX-EXT-007",title:"Extension Failed to Load",description:"An extension's main.ts threw while it was being loaded, so whatever it had not yet registered is missing. Its commands, keys and palettes are removed and the rest of your config loads normally.",source:"tui",severity:"degraded",expected:!0},PROFILE_MAIN_FAILED:{code:"AX-EXT-008",title:"main.ts Failed to Load",description:"Your profile's main.ts threw while being evaluated. Anything it registered before the error survives; everything after it did not run. Plugins and extensions still load.",source:"tui",severity:"degraded",expected:!0},PLUGIN_FAILED:{code:"AX-EXT-009",title:"Plugin Failed to Load",description:"A file in plugins/ threw while being imported, so its hooks were not registered. Other plugins in the same folder are unaffected \u2014 each file is loaded independently.",source:"tui",severity:"degraded",expected:!0},HOOK_FAILED:{code:"AX-EXT-010",title:"Lifecycle Hook Failed",description:"A tui.hook() handler threw while the event it listens for was firing. For a notification hook nothing else is affected; for a gating hook (tui:boot, tui:shutdown) the operation continues anyway rather than leaving the terminal stuck.",source:"tui",severity:"degraded",expected:!0},HOOK_TIMED_OUT:{code:"AX-EXT-011",title:"Hook Blocked Too Long",description:"A gating hook (tui:boot or tui:shutdown) did not finish within its budget, so the TUI continued without waiting. A config must never be able to hang the terminal silently \u2014 whatever the handler was doing may not have completed.",source:"tui",severity:"degraded",expected:!0},COMMAND_NOT_FOUND:{code:"AX-EXT-012",title:"No Such Command",description:"commands.run() was given a path that resolves to nothing in the command tree. The path must name a leaf, spelled exactly as it appears in the `:` palette.",source:"tui",severity:"fatal",expected:!0},PALETTE_NOT_FOUND:{code:"AX-EXT-013",title:"No Such Palette",description:"palette.open() was given a name no palette was registered under. Palettes are created with palette.create(name, ...) \u2014 a name is only openable once its registration has run.",source:"tui",severity:"fatal",expected:!0},PALETTE_NAME_TAKEN:{code:"AX-EXT-014",title:"Palette Name Already Registered",description:"Two palettes tried to claim the same name. Names are how palette.open() addresses one, so they have to be unique \u2014 silently replacing the first would make whichever loaded last win, invisibly.",source:"tui",severity:"degraded",expected:!0},PALETTE_ALREADY_OPEN:{code:"AX-EXT-015",title:"A Palette Is Already Open",description:"Something tried to open a palette, or ask a question, while the user was already navigating one. Stealing it mid-navigation would drop whatever they were doing, so the call fails instead \u2014 check palette.isOpen first.",source:"tui",severity:"degraded",expected:!0},KEY_CHORD_UNBOUND:{code:"AX-EXT-022",title:"No Such Key Binding",description:"keys.send() was given a chord nothing is bound to \u2014 neither a mode key nor a registered binding. Sending it would do nothing at all, which is indistinguishable from a binding that ran and had no effect.",source:"tui",severity:"fatal",expected:!0},AGENT_SPAWN_NO_INSTANCE:{code:"AX-EXT-023",title:"Agent Started but No Instance Appeared",description:"A spawn reported success without producing a focused instance, so there is no id to hand back. This is a fault in Axon rather than in your config \u2014 the agent may or may not be running.",source:"tui",severity:"fatal"},PROFILE_CONFIG_MISSING:{code:"AX-EXT-025",title:"No profile.config.ts",description:"The profile has no config file to record the extension in. It is normally created on first launch \u2014 starting Axon once will scaffold it.",source:"tui",severity:"fatal",expected:!0},PROFILE_CONFIG_UNEDITABLE:{code:"AX-EXT-026",title:"profile.config.ts Could Not Be Edited",description:"The `defineProfile({ ... })` call could not be located, or editing it would have produced invalid TypeScript. Nothing was written \u2014 this file is yours, and a botched edit costs your whole TUI config. Add or remove the entry by hand.",source:"tui",severity:"fatal",expected:!0},COMMAND_INVALID:{code:"AX-EXT-029",title:"Command Is Not Registerable",description:"A command was registered with no path, or with no `run` to call. Both are caught here rather than when someone presses Enter on it \u2014 a command that registers cleanly and then does nothing reads as a broken terminal instead of a config mistake, and gives no clue which file to open. Use `commands.register(path, fn)` or `commands.register(path, { run })`.",source:"tui",severity:"degraded",expected:!0},COMPONENT_NAME_TAKEN:{code:"AX-EXT-030",title:"Component Already Registered",description:"Two sources registered the same line component name. The first one loaded keeps it \u2014 your own config beats any extension. A silently shadowed component would render someone else's value under your name, so the second registration fails instead. Component names are `provider:name`; pick a prefix of your own.",source:"tui",severity:"degraded",expected:!0},COMPONENT_UNKNOWN:{code:"AX-EXT-031",title:"No Such Component",description:"A line named a component that is not registered. Caught when the line is created rather than when it paints, because a missing component renders as an empty gap \u2014 which reads as a layout bug instead of a typo, and gives no clue which name was wrong. components.list() returns everything available.",source:"tui",severity:"degraded",expected:!0},LINE_NAME_TAKEN:{code:"AX-EXT-032",title:"Line Already Registered",description:"Two sources registered the same line name. The first one loaded keeps it, the same rule commands and key chords follow.",source:"tui",severity:"degraded",expected:!0},LINE_UNKNOWN:{code:"AX-EXT-033",title:"No Such Line",description:"lines.set(), move(), show(), hide() or toggle() named a line that is not registered. Doing nothing would be indistinguishable from a line that registered and then rendered empty, so this fails instead. lines.list() returns what exists.",source:"tui",severity:"degraded",expected:!0},COMMAND_PATH_TAKEN:{code:"AX-EXT-020",title:"Command Already Registered",description:"Two sources registered the same command path. The first one loaded keeps it \u2014 your own config beats any extension, and between extensions the one listed earlier in profile.config.ts wins. Rename one of them.",source:"tui",severity:"degraded",expected:!0},KEY_CHORD_TAKEN:{code:"AX-EXT-021",title:"Key Chord Already Bound",description:"Two sources bound the same key chord. The first one loaded keeps it. A silently shadowed binding is unbearable to debug in someone else's config, so the second registration fails instead of replacing it.",source:"tui",severity:"degraded",expected:!0},MODE_KEY_TAKEN:{code:"AX-EXT-016",title:"Mode Key Already Bound",description:"A palette asked for a mode key that is already in use \u2014 either by a built-in mode or by another extension. A silently shadowed key is unbearable to debug in someone else's config, so the registration fails loudly instead.",source:"tui",severity:"degraded",expected:!0},MODE_UNKNOWN:{code:"AX-EXT-017",title:"No Such Mode",description:"mode.set() was given a name that is neither a built-in mode nor a registered palette. Doing nothing would look identical to a mode that simply does not render, so this fails instead.",source:"tui",severity:"fatal",expected:!0},NO_FOCUSED_AGENT:{code:"AX-EXT-018",title:"No Agent Focused",description:"A verb that acts on the focused agent \u2014 send, stop, reboot \u2014 was called while nothing was running. Start one with agents.spawn(name) or tui.nav(name) first.",source:"tui",severity:"fatal",expected:!0},INSTANCE_NOT_RUNNING:{code:"AX-EXT-019",title:"Instance Not Running",description:"An instance id was given for a conversation that is not live \u2014 it may already have been stopped, or it belongs to an earlier session. agents.list() returns what is currently running.",source:"tui",severity:"fatal",expected:!0},CONNECT_REJECTED:{code:"AX-EXT-020",title:"Connector Credential Rejected",description:"The platform refused the credential pasted during `:connect`. Verification runs before the value is written, so nothing was stored \u2014 the detail carries the platform's own reason, and the most common cause is copying the wrong secret from the developer portal.",source:"tui",severity:"fatal",expected:!0}};import{readFileSync as FQ8}from"fs";var AQ8=/at\s+(.*?)\s+\((.*?):(\d+):(\d+)\)/,jQ8=/at\s+(.*?):(\d+):(\d+)/,wQ8=["node_modules","native:","internal","bun:"],VI0=2;function H70(v0=1){let N0=Error().stack;if(!N0)return[];return N0.split(`
448
+ `+j.stack)}finally{this.performanceData=E}}parseMessage(K){return JSON.parse(K)}toStringMessage(K){return K}getFormatOptions(K){return this.projectService.getFormatCodeOptions(K)}getPreferences(K){return this.projectService.getPreferences(K)}getHostFormatOptions(){return this.projectService.getHostFormatCodeOptions()}getHostPreferences(){return this.projectService.getHostPreferences()}};function MP0(Y){let K=Y.diagnosticsDuration&&GK(Y.diagnosticsDuration,([$,J])=>({...J,file:$}));return{...Y,diagnosticsDuration:K}}function dW(Y,K){return{start:K.positionToLineOffset(Y.start),end:K.positionToLineOffset(WJ(Y))}}function a60(Y,K,$){let J=dW(Y,$),Z=K&&dW(K,$);return Z?{...J,contextStart:Z.start,contextEnd:Z.end}:J}function u88(Y,K){return{start:IP0(K,Y.span.start),end:IP0(K,WJ(Y.span)),newText:Y.newText}}function IP0(Y,K){return l60(Y)?g88(Y.getLineAndCharacterOfPosition(K)):Y.positionToLineOffset(K)}function d88(Y,K){let $=Y.ranges.map((J)=>{return{start:K.positionToLineOffset(J.start),end:K.positionToLineOffset(J.start+J.length)}});if(!Y.wordPattern)return{ranges:$};return{ranges:$,wordPattern:Y.wordPattern}}function g88(Y){return{line:Y.line+1,offset:Y.character+1}}function c88(Y){k.assert(Y.textChanges.length===1);let K=IX(Y.textChanges);return k.assert(K.span.start===0&&K.span.length===0),{fileName:Y.fileName,textChanges:[{start:{line:0,offset:0},end:{line:0,offset:0},newText:K.newText}]}}function e60(Y,K,$,J){let Z=p88(Y,K,J),{line:W,character:Q}=lq(F3(Z),$);return{line:W+1,offset:Q+1}}function p88(Y,K,$){for(let{fileName:J,textChanges:Z}of $){if(J!==K)continue;for(let W=Z.length-1;W>=0;W--){let{newText:Q,span:{start:G,length:H}}=Z[W];Y=Y.slice(0,G)+Q+Y.slice(G+H)}}return Y}function CP0(Y,{fileName:K,textSpan:$,contextSpan:J,isWriteAccess:Z,isDefinition:W},{disableLineTextInReferences:Q}){let G=k.checkDefined(Y.getScriptInfo(K)),H=a60($,J,G),U=Q?void 0:l88(G,H);return{file:K,...H,lineText:U,isWriteAccess:Z,isDefinition:W}}function l88(Y,K){let $=Y.lineToTextSpan(K.start.line-1);return Y.getSnapshot().getText($.start,WJ($)).replace(/\r|\n/g,"")}function o88(Y){return Y===void 0||Y&&typeof Y==="object"&&typeof Y.exportName==="string"&&(Y.fileName===void 0||typeof Y.fileName==="string")&&(Y.ambientModuleName===void 0||typeof Y.ambientModuleName==="string"&&(Y.isPackageJsonImport===void 0||typeof Y.isPackageJsonImport==="boolean"))}var NF=4,Yz0=((Y)=>{return Y[Y.PreStart=0]="PreStart",Y[Y.Start=1]="Start",Y[Y.Entire=2]="Entire",Y[Y.Mid=3]="Mid",Y[Y.End=4]="End",Y[Y.PostEnd=5]="PostEnd",Y})(Yz0||{}),s88=class{constructor(){this.goSubtree=!0,this.lineIndex=new _R,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new MF,this.startPath=[this.lineIndex.root],this.stack=[this.lineIndex.root]}get done(){return!1}insertLines(Y,K){if(K)this.trailingText="";if(Y)Y=this.initialText+Y+this.trailingText;else Y=this.initialText+this.trailingText;let J=_R.linesFromText(Y).lines;if(J.length>1&&J[J.length-1]==="")J.pop();let Z,W;for(let G=this.endBranch.length-1;G>=0;G--)if(this.endBranch[G].updateCounts(),this.endBranch[G].charCount()===0)if(W=this.endBranch[G],G>0)Z=this.endBranch[G-1];else Z=this.branchNode;if(W)Z.remove(W);let Q=this.startPath[this.startPath.length-1];if(J.length>0)if(Q.text=J[0],J.length>1){let G=Array(J.length-1),H=Q;for(let O=1;O<J.length;O++)G[O-1]=new qS(J[O]);let U=this.startPath.length-2;while(U>=0){let O=this.startPath[U];G=O.insertAt(H,G),U--,H=O}let E=G.length;while(E>0){let O=new MF;O.add(this.lineIndex.root),G=O.insertAt(this.lineIndex.root,G),E=G.length,this.lineIndex.root=O}this.lineIndex.root.updateCounts()}else for(let G=this.startPath.length-2;G>=0;G--)this.startPath[G].updateCounts();else{this.startPath[this.startPath.length-2].remove(Q);for(let H=this.startPath.length-2;H>=0;H--)this.startPath[H].updateCounts()}return this.lineIndex}post(Y,K,$){if($===this.lineCollectionAtBranch)this.state=4;this.stack.pop()}pre(Y,K,$,J,Z){let W=this.stack[this.stack.length-1];if(this.state===2&&Z===1)this.state=1,this.branchNode=W,this.lineCollectionAtBranch=$;let Q;function G(H){if(H.isLeaf())return new qS("");else return new MF}switch(Z){case 0:if(this.goSubtree=!1,this.state!==4)W.add($);break;case 1:if(this.state===4)this.goSubtree=!1;else Q=G($),W.add(Q),this.startPath.push(Q);break;case 2:if(this.state!==4)Q=G($),W.add(Q),this.startPath.push(Q);else if(!$.isLeaf())Q=G($),W.add(Q),this.endBranch.push(Q);break;case 3:this.goSubtree=!1;break;case 4:if(this.state!==4)this.goSubtree=!1;else if(!$.isLeaf())Q=G($),W.add(Q),this.endBranch.push(Q);break;case 5:if(this.goSubtree=!1,this.state!==1)W.add($);break}if(this.goSubtree)this.stack.push(Q)}leaf(Y,K,$){if(this.state===1)this.initialText=$.text.substring(0,Y);else if(this.state===2)this.initialText=$.text.substring(0,Y),this.trailingText=$.text.substring(Y+K);else this.trailingText=$.text.substring(Y+K)}},t88=class{constructor(Y,K,$){this.pos=Y,this.deleteLen=K,this.insertedText=$}getTextChangeRange(){return kP(z2(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},Ot=class Y{constructor(){this.changes=[],this.versions=Array(Y.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(K){if(K<this.minVersion||K>this.currentVersion)return;return K%Y.maxVersions}currentVersionToIndex(){return this.currentVersion%Y.maxVersions}edit(K,$,J){if(this.changes.push(new t88(K,$,J)),this.changes.length>Y.changeNumberThreshold||$>Y.changeLengthThreshold||J&&J.length>Y.changeLengthThreshold)this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let K=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let $=K.index;for(let J of this.changes)$=$.edit(J.pos,J.deleteLen,J.insertedText);if(K=new xP0(this.currentVersion+1,this,$,this.changes),this.currentVersion=K.version,this.versions[this.currentVersionToIndex()]=K,this.changes=[],this.currentVersion-this.minVersion>=Y.maxVersions)this.minVersion=this.currentVersion-Y.maxVersions+1}return K}getSnapshotVersion(){return this._getSnapshot().version}getAbsolutePositionAndLineText(K){return this._getSnapshot().index.lineNumberToInfo(K)}lineOffsetToPosition(K,$){return this._getSnapshot().index.absolutePositionOfStartOfLine(K)+($-1)}positionToLineOffset(K){return this._getSnapshot().index.positionToLineOffset(K)}lineToTextSpan(K){let $=this._getSnapshot().index,{lineText:J,absolutePosition:Z}=$.lineNumberToInfo(K+1),W=J!==void 0?J.length:$.absolutePositionOfStartOfLine(K+2)-Z;return z2(Z,W)}getTextChangesBetweenVersions(K,$){if(K<$)if(K>=this.minVersion){let J=[];for(let Z=K+1;Z<=$;Z++){let W=this.versions[this.versionToIndex(Z)];for(let Q of W.changesSincePreviousVersion)J.push(Q.getTextChangeRange())}return fa(J)}else return;else return pv}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(K){let $=new Y,J=new xP0(0,$,new _R);$.versions[$.currentVersion]=J;let Z=_R.linesFromText(K);return J.index.load(Z.lines),$}};Ot.changeNumberThreshold=8,Ot.changeLengthThreshold=256,Ot.maxVersions=8;var qt=Ot,xP0=class Y{constructor(K,$,J,Z=yZ){this.version=K,this.cache=$,this.index=J,this.changesSincePreviousVersion=Z}getText(K,$){return this.index.getText(K,$-K)}getLength(){return this.index.getLength()}getChangeRange(K){if(K instanceof Y&&this.cache===K.cache)if(this.version<=K.version)return pv;else return this.cache.getTextChangesBetweenVersions(K.version,this.version)}},_R=class Y{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(K){return this.lineNumberToInfo(K).absolutePosition}positionToLineOffset(K){let{oneBasedLine:$,zeroBasedColumn:J}=this.root.charOffsetToLineInfo(1,K);return{line:$,offset:J+1}}positionToColumnAndLineText(K){return this.root.charOffsetToLineInfo(1,K)}getLineCount(){return this.root.lineCount()}lineNumberToInfo(K){let $=this.getLineCount();if(K<=$){let{position:J,leaf:Z}=this.root.lineNumberToInfo(K,0);return{absolutePosition:J,lineText:Z&&Z.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(K){if(K.length>0){let $=[];for(let J=0;J<K.length;J++)$[J]=new qS(K[J]);this.root=Y.buildTreeFromBottom($)}else this.root=new MF}walk(K,$,J){this.root.walk(K,$,J)}getText(K,$){let J="";if($>0&&K<this.root.charCount())this.walk(K,$,{goSubtree:!0,done:!1,leaf:(Z,W,Q)=>{J=J.concat(Q.text.substring(Z,Z+W))}});return J}getLength(){return this.root.charCount()}every(K,$,J){if(!J)J=this.root.charCount();let Z={goSubtree:!0,done:!1,leaf(W,Q,G){if(!K(G,W,Q))this.done=!0}};return this.walk($,J-$,Z),!Z.done}edit(K,$,J){if(this.root.charCount()===0){if(k.assert($===0),J!==void 0)return this.load(Y.linesFromText(J).lines),this;return}else{let Z;if(this.checkEdits){let G=this.getText(0,this.root.charCount());Z=G.slice(0,K)+J+G.slice(K+$)}let W=new s88,Q=!1;if(K>=this.root.charCount()){K=this.root.charCount()-1;let G=this.getText(K,1);if(J)J=G+J;else J=G;$=0,Q=!0}else if($>0){let G=K+$,{zeroBasedColumn:H,lineText:U}=this.positionToColumnAndLineText(G);if(H===0)$+=U.length,J=J?J+U:U}if(this.root.walk(K,$,W),W.insertLines(J,Q),this.checkEdits){let G=W.lineIndex.getText(0,W.lineIndex.getLength());k.assert(Z===G,"buffer edit mismatch")}return W.lineIndex}}static buildTreeFromBottom(K){if(K.length<NF)return new MF(K);let $=Array(Math.ceil(K.length/NF)),J=0;for(let Z=0;Z<$.length;Z++){let W=Math.min(J+NF,K.length);$[Z]=new MF(K.slice(J,W)),J=W}return this.buildTreeFromBottom($)}static linesFromText(K){let $=F3(K);if($.length===0)return{lines:[],lineMap:$};let J=Array($.length),Z=$.length-1;for(let Q=0;Q<Z;Q++)J[Q]=K.substring($[Q],$[Q+1]);let W=K.substring($[Z]);if(W.length>0)J[Z]=W;else J.pop();return{lines:J,lineMap:$}}},MF=class Y{constructor(K=[]){if(this.children=K,this.totalChars=0,this.totalLines=0,K.length)this.updateCounts()}isLeaf(){return!1}updateCounts(){this.totalChars=0,this.totalLines=0;for(let K of this.children)this.totalChars+=K.charCount(),this.totalLines+=K.lineCount()}execWalk(K,$,J,Z,W){if(J.pre)J.pre(K,$,this.children[Z],this,W);if(J.goSubtree){if(this.children[Z].walk(K,$,J),J.post)J.post(K,$,this.children[Z],this,W)}else J.goSubtree=!0;return J.done}skipChild(K,$,J,Z,W){if(Z.pre&&!Z.done)Z.pre(K,$,this.children[J],this,W),Z.goSubtree=!0}walk(K,$,J){if(this.children.length===0)return;let Z=0,W=this.children[Z].charCount(),Q=K;while(Q>=W)this.skipChild(Q,$,Z,J,0),Q-=W,Z++,W=this.children[Z].charCount();if(Q+$<=W){if(this.execWalk(Q,$,J,Z,2))return}else{if(this.execWalk(Q,W-Q,J,Z,1))return;let G=$-(W-Q);Z++,W=this.children[Z].charCount();while(G>W){if(this.execWalk(0,W,J,Z,3))return;G-=W,Z++,W=this.children[Z].charCount()}if(G>0){if(this.execWalk(0,G,J,Z,4))return}}if(J.pre){let G=this.children.length;if(Z<G-1)for(let H=Z+1;H<G;H++)this.skipChild(0,0,H,J,5)}}charOffsetToLineInfo(K,$){if(this.children.length===0)return{oneBasedLine:K,zeroBasedColumn:$,lineText:void 0};for(let W of this.children)if(W.charCount()>$)if(W.isLeaf())return{oneBasedLine:K,zeroBasedColumn:$,lineText:W.text};else return W.charOffsetToLineInfo(K,$);else $-=W.charCount(),K+=W.lineCount();let J=this.lineCount();if(J===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};let Z=k.checkDefined(this.lineNumberToInfo(J,0).leaf);return{oneBasedLine:J,zeroBasedColumn:Z.charCount(),lineText:void 0}}lineNumberToInfo(K,$){for(let J of this.children){let Z=J.lineCount();if(Z>=K)return J.isLeaf()?{position:$,leaf:J}:J.lineNumberToInfo(K,$);else K-=Z,$+=J.charCount()}return{position:$,leaf:void 0}}splitAfter(K){let $,J=this.children.length;K++;let Z=K;if(K<J){$=new Y;while(K<J)$.add(this.children[K]),K++;$.updateCounts()}return this.children.length=Z,$}remove(K){let $=this.findChildIndex(K),J=this.children.length;if($<J-1)for(let Z=$;Z<J-1;Z++)this.children[Z]=this.children[Z+1];this.children.pop()}findChildIndex(K){let $=this.children.indexOf(K);return k.assert($!==-1),$}insertAt(K,$){let J=this.findChildIndex(K),Z=this.children.length,W=$.length;if(Z<NF&&J===Z-1&&W===1)return this.add($[0]),this.updateCounts(),[];else{let Q=this.splitAfter(J),G=0;J++;while(J<NF&&G<W)this.children[J]=$[G],J++,G++;let H=[],U=0;if(G<W){U=Math.ceil((W-G)/NF),H=Array(U);let E=0;for(let A=0;A<U;A++)H[A]=new Y;let O=H[0];while(G<W)if(O.add($[G]),G++,O.children.length===NF)E++,O=H[E];for(let A=H.length-1;A>=0;A--)if(H[A].children.length===0)H.pop()}if(Q)H.push(Q);this.updateCounts();for(let E=0;E<U;E++)H[E].updateCounts();return H}}add(K){this.children.push(K),k.assert(this.children.length<=NF)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},qS=class{constructor(Y){this.text=Y}isLeaf(){return!0}walk(Y,K,$){$.leaf(Y,K,this)}charCount(){return this.text.length}lineCount(){return 1}},SP0=class Y{constructor(K,$,J,Z,W,Q){this.telemetryEnabled=K,this.logger=$,this.host=J,this.globalTypingsCacheLocation=Z,this.event=W,this.maxActiveRequestCount=Q,this.activeRequestCount=0,this.requestQueue=HP(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(K){var $;if(BG.validatePackageName(K)!==BG.NameValidationResult.Ok)return!1;if(!this.requestedRegistry)this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"});return!!(($=this.typesRegistryCache)==null?void 0:$.has(K))}installPackage(K){this.packageInstallId++;let $={kind:"installPackage",...K,id:this.packageInstallId},J=new Promise((Z,W)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:Z,reject:W})});return this.installer.send($),J}attach(K){this.projectService=K,this.installer=this.createInstallerProcess()}onProjectClosed(K){this.installer.send({projectName:K.getProjectName(),kind:"closeProject"})}enqueueInstallTypingsRequest(K,$,J){let Z=W60(K,$,J);if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Scheduling throttled operation:${x_(Z)}`);if(this.activeRequestCount<this.maxActiveRequestCount)this.scheduleRequest(Z);else{if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Deferring request for: ${Z.projectName}`);this.requestQueue.enqueue(Z),this.requestMap.set(Z.projectName,Z)}}handleMessage(K){var $,J;if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Received response:${x_(K)}`);switch(K.kind){case dp:this.typesRegistryCache=new Map(Object.entries(K.typesRegistry));break;case fC:{let Z=($=this.packageInstalledPromise)==null?void 0:$.get(K.id);if(k.assertIsDefined(Z,"Should find the promise for package install"),(J=this.packageInstalledPromise)==null||J.delete(K.id),K.success)Z.resolve({successMessage:K.message});else Z.reject(K.message);this.projectService.updateTypingsForProject(K),this.event(K,"setTypings");break}case DX0:{let Z={message:K.message},W="typesInstallerInitializationFailed";this.event(Z,"typesInstallerInitializationFailed");break}case gp:{let Z={eventId:K.eventId,packages:K.packagesToInstall},W="beginInstallTypes";this.event(Z,"beginInstallTypes");break}case cp:{if(this.telemetryEnabled){let Q={telemetryEventName:"typingsInstalled",payload:{installedPackages:K.packagesToInstall.join(","),installSuccess:K.installSuccess,typingsInstallerVersion:K.typingsInstallerVersion}},G="telemetry";this.event(Q,"telemetry")}let Z={eventId:K.eventId,packages:K.packagesToInstall,success:K.installSuccess},W="endInstallTypes";this.event(Z,W);break}case SC:{this.projectService.updateTypingsForProject(K);break}case xC:{if(this.activeRequestCount>0)this.activeRequestCount--;else k.fail("TIAdapter:: Received too many responses");while(!this.requestQueue.isEmpty()){let Z=this.requestQueue.dequeue();if(this.requestMap.get(Z.projectName)===Z){this.requestMap.delete(Z.projectName),this.scheduleRequest(Z);break}if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Skipping defunct request for: ${Z.projectName}`)}this.projectService.updateTypingsForProject(K),this.event(K,"setTypings");break}case WL:this.projectService.watchTypingLocations(K);break;default:Y_(K)}}scheduleRequest(K){if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Scheduling request for: ${K.projectName}`);this.activeRequestCount++,this.host.setTimeout(()=>{if(this.logger.hasLevel(3))this.logger.info(`TIAdapter:: Sending request:${x_(K)}`);this.installer.send(K)},Y.requestDelayMillis,`${K.projectName}::${K.kind}`)}};SP0.requestDelayMillis=100;var fP0=SP0,hP0={};if(KY(hP0,{ActionInvalidate:()=>SC,ActionPackageInstalled:()=>fC,ActionSet:()=>xC,ActionWatchTypingLocations:()=>WL,Arguments:()=>pp,AutoImportProviderProject:()=>L60,AuxiliaryProject:()=>k60,CharRangeSection:()=>Yz0,CloseFileWatcherEvent:()=>zt,CommandNames:()=>wP0,ConfigFileDiagEvent:()=>Kt,ConfiguredProject:()=>R60,ConfiguredProjectLoadKind:()=>x60,CreateDirectoryWatcherEvent:()=>Zt,CreateFileWatcherEvent:()=>Jt,Errors:()=>i7,EventBeginInstallTypes:()=>gp,EventEndInstallTypes:()=>cp,EventInitializationFailed:()=>DX0,EventTypesRegistry:()=>dp,ExternalProject:()=>is,GcTimer:()=>E60,InferredProject:()=>P60,LargeFileReferencedEvent:()=>Yt,LineIndex:()=>_R,LineLeaf:()=>qS,LineNode:()=>MF,LogLevel:()=>Z60,Msg:()=>z60,OpenFileInfoTelemetryEvent:()=>v60,Project:()=>cO,ProjectInfoTelemetryEvent:()=>$t,ProjectKind:()=>Hb,ProjectLanguageServiceStateEvent:()=>Xt,ProjectLoadingFinishEvent:()=>es,ProjectLoadingStartEvent:()=>as,ProjectService:()=>p60,ProjectsUpdatedInBackgroundEvent:()=>BS,ScriptInfo:()=>q60,ScriptVersionCache:()=>qt,Session:()=>NP0,TextStorage:()=>O60,ThrottledOperations:()=>D60,TypingsInstallerAdapter:()=>fP0,allFilesAreJsOrDts:()=>j60,allRootFilesAreJsOrDts:()=>A60,asNormalizedPath:()=>uW,convertCompilerOptions:()=>US,convertFormatOptions:()=>RF,convertScriptKindName:()=>Qt,convertTypeAcquisition:()=>M60,convertUserPreferences:()=>I60,convertWatchOptions:()=>HR,countEachFileTypes:()=>zR,createInstallTypingsRequest:()=>W60,createModuleSpecifierCache:()=>s60,createNormalizedPathMap:()=>nb0,createPackageJsonCache:()=>t60,createSortedArray:()=>_60,emptyArray:()=>yZ,findArgument:()=>rE0,formatDiagnosticToProtocol:()=>GR,formatMessage:()=>i60,getBaseConfigFileName:()=>ts,getDetailWatchInfo:()=>_t,getLocationInNewDocument:()=>e60,hasArgument:()=>nE0,hasNoTypeScriptSource:()=>w60,indent:()=>xw,isBackgroundProject:()=>QR,isConfigFile:()=>l60,isConfiguredProject:()=>sV,isDynamicFileName:()=>Vb,isExternalProject:()=>WR,isInferredProject:()=>LF,isInferredProjectName:()=>Q60,isProjectDeferredClose:()=>VR,makeAutoImportProviderProjectName:()=>H60,makeAuxiliaryProjectName:()=>G60,makeInferredProjectName:()=>V60,maxFileSize:()=>rs,maxProgramSizeForNonTsFiles:()=>ns,normalizedPathToPath:()=>yF,nowString:()=>aE0,nullCancellationToken:()=>FP0,nullTypingsInstaller:()=>OS,protocol:()=>B60,scriptInfoIsContainedByBackgroundProject:()=>T60,scriptInfoIsContainedByDeferredClosedProject:()=>F60,stringifyIndented:()=>x_,toEvent:()=>n60,toNormalizedPath:()=>_$,tryConvertScriptKindName:()=>Wt,typingsInstaller:()=>J60,updateProjectIfDirty:()=>X5}),typeof console<"u")k.loggingHost={log(Y,K){switch(Y){case 1:return console.error(K);case 2:return console.warn(K);case 3:return console.log(K);case 4:return console.log(K)}}}})({get exports(){return QI0},set exports(v0){if(QI0=v0,typeof vn<"u"&&vn.exports)vn.exports=v0}})});var y4=NM0(V70(),1);var Nn={UNKNOWN:{code:"AX-UNKNOWN-001",title:"Unclassified Error",description:"An error occurred that hasn't been given a proper code yet. This is itself worth fixing \u2014 see the err(cause) call site that produced it.",source:"runtime",severity:"fatal"},PROMPT_NOT_FOUND:{code:"AX-PROMPT-001",title:"Prompt Not Found",description:"The requested prompt could not be resolved \u2014 it is not declared by the agent, or the published package it names ships no prompt by that name.",source:"runtime",severity:"fatal",expected:!0},PROMPT_FILE_NOT_FOUND:{code:"AX-PROMPT-002",title:"Prompt File Missing",description:"The prompt is declared but its source file no longer exists on disk.",source:"runtime",severity:"fatal",expected:!0},PROMPT_RENDER_FAILED:{code:"AX-PROMPT-003",title:"Prompt Render Failed",description:"The prompt's source file failed to compile or render \u2014 likely a malformed SFC (content outside <template>/<script>/<style>) or an error thrown while rendering. See the cause for the underlying parser/render error.",source:"runtime",severity:"fatal"},OUTPUT_INVALID:{code:"AX-OUTPUT-001",title:"Invalid Output Type",description:"The `output` type passed to request() is not valid TypeScript, or references a type that does not exist. Checked before the model is called, so no inference was spent \u2014 fix the type string at the call site.",source:"runtime",severity:"fatal"},OUTPUT_UNSATISFIED:{code:"AX-OUTPUT-002",title:"Output Type Not Satisfied",description:"The model could not produce a response matching the declared `output` type within its retry budget. The accumulated TypeScript diagnostics describe what it got wrong on each attempt.",source:"runtime",severity:"fatal"},OUTPUT_EMPTY:{code:"AX-OUTPUT-003",title:"Model Produced No Output Block",description:"Every reply must wrap its content in a <text> or <script> block \u2014 text outside a block is discarded by the parser. The model replied with none, on every attempt in its retry budget, so there was nothing to render or run. Usually means the model is not following the block protocol rather than that anything is misconfigured: the reply itself is often correct, just unwrapped. Try a different model, or check that the protocol the cognet renders matches the one it parses with.",source:"runtime",severity:"fatal",expected:!0},SCRIPT_NOT_FOUND:{code:"AX-SCRIPT-001",title:"Script Not Found",description:"The requested script was not found in the agent's blueprint. It may not be declared, or the agent needs to be re-prepared.",source:"runtime",severity:"fatal",expected:!0},SCRIPT_FILE_NOT_FOUND:{code:"AX-SCRIPT-002",title:"Script File Missing",description:"The script is declared but its source file no longer exists on disk.",source:"runtime",severity:"fatal",expected:!0},SCRIPT_AGENT_NOT_LOCAL:{code:"AX-SCRIPT-003",title:"Script Agent Is Not In-Process",description:"A script's agent must run in the same process as the script. Scripts() booted a linked (confined) agent instead, so there is no in-heap runtime for the script's proxy to forward to. This is a wiring fault, not a user error.",source:"runtime",severity:"fatal"},SUBAGENT_LINK_UNSUPPORTED:{code:"AX-SCRIPT-004",title:"Subagent Not Supported Over The Link",description:"An agent asked to spawn a subagent whose child runs as a confined process. `axon.request()` returns a wake's collected entries, while the link's `stimulus` verb returns only admission \u2014 the supervisor needs a verb that collects a wake and answers when it settles. Until that exists this fails rather than returning an admission receipt the caller would read as a result.",source:"runtime",severity:"fatal"},AGENT_BOOT_FAILED:{code:"AX-AGENT-006",title:"Agent Failed To Boot",description:"The agent process exited before it connected to its supervisor. Its own stderr is carried as the detail \u2014 the agent usually knows exactly what went wrong (a missing cognet, a tool that would not compile), and without this that diagnosis died in a pipe while the supervisor reported only a closed socket.",source:"runtime",severity:"fatal"},CAPSULE_NOT_LOCAL:{code:"AX-AGENT-007",title:"No Capsule On This Machine",description:'A console eval was requested against an attached deployment. Its capsule runs wherever the deployment is hosted, so there is nothing here to execute in \u2014 and quietly resolving would read as "it ran and did nothing".',source:"runtime",severity:"fatal",expected:!0},LINK_NO_HANDLER:{code:"AX-LINK-001",title:"No Handler For Link Verb",description:"The peer sent a verb this side does not implement. Both ends speak a versioned contract, so this means they disagree about it \u2014 a wiring fault, not something a user did.",source:"runtime",severity:"fatal"},LINK_PEER_CLOSED:{code:"AX-LINK-002",title:"Agent Disconnected",description:"The agent process closed its side of the link. Every call still in flight is rejected rather than left hanging \u2014 a dead peer must be an error, never a wait that never ends.",source:"runtime",severity:"fatal"},LINK_CLOSED:{code:"AX-LINK-003",title:"Link Closed",description:"The link to the agent was torn down by this side \u2014 a shutdown, a dispose, or a failed boot. Outstanding calls are rejected with this rather than hanging.",source:"runtime",severity:"fatal"},LINK_FRAME_TOO_LARGE:{code:"AX-LINK-004",title:"Link Frame Too Large",description:"A message on the link exceeded the maximum frame size, or a length prefix declared one that did. The prefix is peer-controlled input, so an oversized declaration is refused rather than allocated \u2014 a desynchronised stream cannot be recovered by reading past it.",source:"runtime",severity:"fatal"},LINK_UNKNOWN_PROMPT_ACTION:{code:"AX-LINK-005",title:"Unknown Prompt Action",description:"The prompt verb was called with an action this side does not know. Loud rather than silent: an unrecognised action would otherwise return undefined, which a caller renders as an empty prompt list.",source:"runtime",severity:"fatal"},AGENT_LINK_MISSING:{code:"AX-AGENT-001",title:"Agent Started Without A Supervisor",description:"An agent process was started with no link paths in its environment, which means nothing is supervising it. It cannot guess a socket path \u2014 doing so risks connecting to a different agent's supervisor entirely.",source:"runtime",severity:"fatal"},AGENT_LINK_MALFORMED:{code:"AX-AGENT-002",title:"Malformed Agent Link",description:"The link carrier in the agent's environment is not valid JSON, or does not name both a control and a data socket. Both are required \u2014 an agent with only one connected can accept work it has no way to answer.",source:"runtime",severity:"fatal"},AGENT_BLUEPRINT_MISSING:{code:"AX-AGENT-003",title:"Agent Started Without A Blueprint",description:"An agent process was started with no blueprint path in its environment. The supervisor writes the blueprint beside the sockets before spawning; its absence means the spawn path is broken.",source:"runtime",severity:"fatal"},AGENT_NOT_READY:{code:"AX-AGENT-004",title:"Agent Still Booting",description:"A verb arrived before the agent's runtime finished booting. The link connects first so that boot failures are reportable, which leaves a brief window where the agent can be addressed but cannot answer.",source:"runtime",severity:"fatal"},CLI_AGENT_NOT_LOCAL:{code:"AX-AGENT-005",title:"Command Needs An In-Process Agent",description:"A headless CLI command booted an agent that runs as a separate process, but the command reaches into the runtime directly. This is a wiring fault: the command needs either an in-process agent or a link verb.",source:"runtime",severity:"fatal"},ENGINE_ROLE_UNBOUND_LINK:{code:"AX-ENGINE-010",title:"No Engine For Role",description:"A confined agent asked for inference on a role the supervisor has no engine bound to. Roles are resolved on the supervisor's side before the agent starts, so an unbound one here means resolution and the cognet's declaration disagree.",source:"runtime",severity:"fatal"},ENGINE_KIND_MISMATCH_LINK:{code:"AX-ENGINE-011",title:"Engine Kind Mismatch",description:"A role bound to a transform or session engine was asked to serve a generate call. Resolution already matched the declared type, so reaching here means a provider's create() disagreed with the capability it was handed.",source:"runtime",severity:"fatal"},ENGINE_MISSING:{code:"AX-ENGINE-001",title:"No Engine Configured",description:"The agent's blueprint has no engine \u2014 it cannot dispatch to a model. Set `engine` in axon.config.ts.",source:"runtime",severity:"fatal"},ENGINE_ROLE_UNBOUND:{code:"AX-ENGINE-002",title:"Engine Role Not Bound",description:"The cognet asked for an engine role that resolution did not fill. A required role stops the boot, so reaching this means an OPTIONAL role was used without checking `kernel.engine.has()` first \u2014 or the role was never declared in the cognet's `engines:` block.",source:"runtime",severity:"fatal"},RESOURCES_EXHAUSTED:{code:"AX-RES-001",title:"Not Enough Memory",description:"A local model does not fit in what is left of this machine's video memory. Nothing was evicted: another agent is using it, and taking memory out from under a running agent would slow it down invisibly. Stop an agent that is holding a model, or raise the ceiling in your profile's `resources`.",source:"runtime",severity:"degraded",expected:!0},ENGINE_PIN_UNAVAILABLE:{code:"AX-ENGINE-004",title:"Model Not Available",description:"The agent pins a model no declared provider can supply. The agent still runs \u2014 resolution picked the best available model instead \u2014 but it is NOT the one that was asked for. Declare the provider that supplies it in your profile, or pick a model from a provider you have.",source:"runtime",severity:"degraded",expected:!0},ENGINE_REQUIREMENTS_UNMET:{code:"AX-ENGINE-003",title:"Inference Requirements Unmet",description:"This cognet declares engine roles that nothing among the user's providers can fill. Add a provider that supplies what is missing, or run a cognet whose requirements this machine meets.",source:"runtime",severity:"fatal",expected:!0},INJECT_OUTSIDE_RUNTIME:{code:"AX-RUNTIME-001",title:"Runtime Accessed Before Boot",description:"A runtime global (axon, args) was read before the runtime finished booting.",source:"runtime",severity:"fatal"},BOOT_FAILED:{code:"AX-BOOT-001",title:"Agent Failed To Start",description:"The agent's runtime crashed while starting, before it could accept requests.",source:"runtime",severity:"fatal"},BOOT_SCRIPT_FAILED:{code:"AX-BOOT-002",title:"Boot Script Failed",description:"The agent's boot.vue threw while rendering \u2014 check the script setup block for the error.",source:"runtime",severity:"fatal"},BOOT_SCRIPT_INVALID:{code:"AX-BOOT-003",title:"Boot Script Malformed",description:"The agent's boot.vue has content outside its recognized <script>/<template> blocks, or otherwise failed to parse as a valid SFC.",source:"runtime",severity:"fatal"},COGNET_ACCESSED_BEFORE_LOAD:{code:"AX-COGNET-001",title:"Cognet Accessed Before Load",description:"A cognet global (kernel, phase, system, blueprint) was read before the brain finished loading, or outside the loop body that owns it.",source:"cognet",severity:"fatal"},COGNET_LOOP_ALREADY_DECLARED:{code:"AX-COGNET-002",title:"Loop Already Declared",description:"A cognet's main() called loop() more than once \u2014 the loop is the program's entire main body and can only be declared once.",source:"cognet",severity:"fatal"},COGNET_ALREADY_LOADED:{code:"AX-COGNET-003",title:"Cognet Bound To A Different Kernel",description:"This cognet instance already loaded against a different kernel ABI \u2014 a reload produced a conflicting bind instead of a clean swap.",source:"cognet",severity:"fatal"},COGNET_NO_LOOP:{code:"AX-COGNET-004",title:"Cognet Declared No Loop",description:"The cognet's main() ran (or was woken) without ever declaring loop() \u2014 there is no program to run.",source:"cognet",severity:"fatal"},COGNET_MAX_TICKS:{code:"AX-COGNET-005",title:"Cognet Exceeded Max Ticks",description:"The cognet's loop ran more ticks in one wake than its configured limit allows \u2014 likely a runaway loop that never calls stop().",source:"cognet",severity:"fatal"},COGNET_ABI_MISMATCH:{code:"AX-COGNET-006",title:"Cognet ABI Mismatch",description:"The compiled cognet targets a kernel ABI version the running kernel doesn't provide \u2014 rebuild the cognet against the current framework version.",source:"cognet",severity:"fatal"},COGNET_MISSING:{code:"AX-COGNET-007",title:"No Compiled Cognet",description:"The blueprint points at a compiled cognet bundle that doesn't exist on disk yet \u2014 run `axon prepare` before booting.",source:"cognet",severity:"fatal"},COGNET_HASH_MISMATCH:{code:"AX-COGNET-008",title:"Cognet Bundle Hash Mismatch",description:"The compiled cognet bundle on disk doesn't match the hash the blueprint expects \u2014 it's stale or was tampered with. Run `axon prepare` again.",source:"cognet",severity:"fatal"},COGNET_INVALID:{code:"AX-COGNET-009",title:"Invalid Cognet Bundle",description:"The compiled cognet's default export isn't a real cognet definition \u2014 the compile step produced something malformed.",source:"cognet",severity:"fatal"},COGNET_IDENTITY_MISMATCH:{code:"AX-COGNET-010",title:"Cognet Identity Mismatch",description:"The compiled cognet artifact's own name doesn't match what the blueprint declared \u2014 the wrong bundle may be at this path.",source:"cognet",severity:"fatal"},COGNET_CONFIG_MISSING:{code:"AX-COGNET-011",title:"Cognet Config Missing",description:"No cognet.config.ts was found in the cognet's source directory \u2014 every cognet needs one to declare its identity.",source:"cognet",severity:"fatal"},COGNET_BUILD_FAILED:{code:"AX-COGNET-012",title:"Cognet Failed To Compile",description:"Bundling the cognet's source into a runnable artifact failed \u2014 check the build log for the underlying syntax or import error.",source:"cognet",severity:"fatal"},COGNET_RUNTIME_UNAVAILABLE:{code:"AX-COGNET-014",title:"Cognet Runtime Temporarily Unavailable",description:"The cognet runtime is declared but not present on disk \u2014 the dependency tree is mid-rewrite. Transient: the reload keeps the previous blueprint and picks the change up on the next watch event.",source:"cognet",severity:"recovered"},COGNET_AMBIGUOUS:{code:"AX-COGNET-015",title:"Two Cognets Declared",description:"The agent both declares `cognet:` in axon.config.ts and holds an inline cognet at `cognet/`. An agent has exactly one brain, and choosing between them silently would either ignore a directory of source or overrule what the author wrote. Keep one.",source:"cognet",severity:"fatal"},COGNET_NOT_FOUND:{code:"AX-COGNET-013",title:"Cognet Not Found",description:"The cognet named by `cognet:` in axon.config.ts could not be located. The detail says where it was looked for \u2014 a registry that answered 404, or a node_modules tree it was missing from. Check the specifier for a typo, and check which registry the CLI is pointed at (AXON_API_BASE).",source:"cognet",severity:"fatal",expected:!0},MODULE_SPECIFIER_INVALID:{code:"AX-PROJECT-005",title:"Invalid Module Specifier",description:"Module names must be scoped as @scope/name. The registry does not accept unscoped packages, so an unscoped specifier can never resolve.",source:"manifest",severity:"fatal"},CONFIG_MODULES_UNPARSEABLE:{code:"AX-PROJECT-006",title:"Could Not Edit axon.config.ts",description:"The install succeeded but the module entry could not be written into the config's modules array automatically \u2014 add or remove it by hand.",source:"manifest",severity:"fatal"},CONFIG_ENGINE_DEPRECATED:{code:"AX-PROJECT-033",title:"`engine:` Is Deprecated And Ignored",description:"This agent's axon.config.ts declares `engine:`, which the runtime no longer reads \u2014 inference is resolving against the profile's providers instead. Use `model: \"codex:gpt-5.6-terra\"` for a cortex pin, and `providers: [...]` for a source the user would not otherwise have.",source:"manifest",severity:"degraded"},MODULE_DEPENDENCY_INSTALL_FAILED:{code:"AX-PROJECT-004",title:"Module Dependencies Failed To Install",description:"The module source was downloaded, but its npm dependencies could not be materialized for the agent. Resolve the package-manager error and run the install again.",source:"manifest",severity:"fatal"},BLUEPRINT_NOT_LOADED:{code:"AX-PROJECT-002",title:"Blueprint Accessed Before Load",description:"Something read the blueprint's current value before load() had ever run.",source:"manifest",severity:"fatal"},AGENT_INVALID:{code:"AX-PROJECT-003",title:"Invalid Agent Directory",description:"The agent root has no package.json \u2014 every agent is a real package, this one isn't.",source:"manifest",severity:"fatal"},CORRUPT_JSON:{code:"AX-PROJECT-016",title:"Corrupt JSON File",description:"A stored JSON file failed to parse \u2014 it may have been hand-edited into an invalid state, or a write was interrupted mid-flight.",source:"manifest",severity:"fatal"},FILE_UNREADABLE:{code:"AX-PROJECT-032",title:"File Could Not Be Read",description:"A file exists but could not be read \u2014 most often a permissions problem, a directory where a file was expected, or a disk error. Distinct from a missing file, which is an ordinary absent-surface state.",source:"manifest",severity:"fatal"},PROVIDER_NOT_CONNECTED:{code:"AX-TUI-011",title:"Provider Not Connected",description:"The selected model routes through a provider (OpenRouter, Codex) that isn't connected yet \u2014 connect it before picking a model on that route.",source:"tui",severity:"fatal",expected:!0},PALETTE_INPUT_REQUIRED:{code:"AX-TUI-012",title:"Required Input Missing",description:"A palette command needs a value for this field before it can run.",source:"tui",severity:"fatal",expected:!0},BENCH_NO_CASES:{code:"AX-TUI-013",title:"Bench Declared No Cases",description:"The bench's test file ran to completion under Bun but never declared a single benchmark case.",source:"tui",severity:"fatal"},PROJECT_NOT_FOUND:{code:"AX-PROJECT-017",title:"Project Not Found",description:"No axon.config.ts, module.config.ts, cognet.config.ts, bench.config.ts, or prompt.config.ts was found at this path \u2014 it isn't a recognized project directory.",source:"manifest",severity:"fatal",expected:!0},PROJECT_WRONG_KIND:{code:"AX-PROJECT-011",title:"Wrong Project Kind",description:"This command targets one project kind, and the directory holds another \u2014 run the command that matches what is actually here.",source:"manifest",severity:"fatal",expected:!0},PROJECT_EXISTS:{code:"AX-PROJECT-018",title:"Project Already Exists",description:"Scaffolding refused to overwrite a directory that already exists \u2014 remove it or pick a different name first.",source:"manifest",severity:"fatal"},TYPEGEN_NO_BLUEPRINT:{code:"AX-PROJECT-007",title:"Typegen Needs A Loaded Blueprint",description:"Agent-kind typegen was called without a blueprint \u2014 its declared surfaces are the source of the generated types.",source:"manifest",severity:"fatal"},DEPLOY_AGENTS_ONLY:{code:"AX-PROJECT-008",title:"Only Agents Can Deploy",description:"A module was asked to deploy on its own \u2014 modules only run installed inside an agent, deploy the agent instead.",source:"manifest",severity:"fatal"},PUBLISH_UNSUPPORTED_KIND:{code:"AX-PROJECT-009",title:"This Project Kind Cannot Publish",description:"The registry accepts agents, modules, cognets, benches and prompts. Extensions are not accepted yet \u2014 the `registry_artifact_kind` enum needs the value first, and publishing before then would register under the wrong kind and claim the name in the shared namespace. A profile is never publishable: it holds one person's credentials, history and agents. See KINDS[kind].publishable.",source:"manifest",severity:"fatal"},MODEL_SPECIFIER_INVALID:{code:"AX-MODEL-001",title:"Malformed Model Specifier",description:"A `models:` entry in cognet.config.ts could not be parsed. The short form is `hf:owner/repo/path/to/file` \u2014 a repo alone is ambiguous, since one repo holds many weights.",source:"manifest",severity:"fatal"},MODEL_FETCH_FAILED:{code:"AX-MODEL-002",title:"Model Weights Could Not Be Fetched",description:"A declared model could not be downloaded. Check the repo, file path and revision, and that the machine can reach the registry. A brain without its weights is broken rather than degraded, so this fails at prepare instead of at first inference.",source:"manifest",severity:"fatal"},MODEL_HASH_MISMATCH:{code:"AX-MODEL-003",title:"Model Weights Failed Verification",description:"Downloaded bytes did not hash to the expected value \u2014 the upstream file changed, or the download was corrupted. Nothing is cached: storing unverified weights would make every later run trust them.",source:"manifest",severity:"fatal"},MODEL_NOT_CACHED:{code:"AX-MODEL-004",title:"Declared Model Is Not Cached",description:"`--frozen` asserts the machine is already provisioned, so it will not fetch. Run `axon prepare` without --frozen to populate the model cache.",source:"manifest",severity:"fatal"},PREPARE_FROZEN_DRIFT:{code:"AX-PROJECT-014",title:"Dependencies Drifted From The Lockfile",description:"`--frozen` asserts that package.json, the lockfile and node_modules already agree. Something did not: a dependency is missing, at a version outside its declared range, or declared but no longer selected. Run `axon prepare` without --frozen to reconcile, and commit the result.",source:"manifest",severity:"fatal"},PUBLISH_VERIFY_FAILED:{code:"AX-PROJECT-013",title:"Artifact Does Not Compile",description:"The package was built, but compiling it the way a consumer would failed \u2014 so publishing it would ship something nobody can install. Usually a file the source imports was left out of the package. Published versions are immutable, so this is caught before upload rather than after.",source:"manifest",severity:"fatal"},DEPLOY_PROVISION_FAILED:{code:"AX-PROJECT-012",title:"Deployment Provisioning Failed",description:"The agent was published, but the cloud control plane could not provision its runtime. The request ID identifies the server-side failure.",source:"manifest",severity:"fatal"},DEPLOY_RUNTIME_FAILED:{code:"AX-PROJECT-035",title:"Agent Failed To Start",description:"Cloud infrastructure was provisioned, but the agent process failed during boot. The reported runtime diagnostic identifies the immediate cause.",source:"runtime",severity:"fatal"},DEPLOY_ENV_RESERVED:{code:"AX-PROJECT-036",title:"Reserved Deployment Variable",description:"The production .env file attempts to override a variable owned by the Axon runtime or Cloud Run.",source:"manifest",severity:"fatal"},DEPLOY_ENV_INVALID:{code:"AX-PROJECT-015",title:"Invalid Deployment Variable",description:"The production .env file contains a key that is not a valid environment variable name.",source:"manifest",severity:"fatal"},BUNDLE_MODULE_COLLISION:{code:"AX-PROJECT-019",title:"Module Name Collision",description:"A hard-imported source module's name collides with an already-installed registry module of the same name.",source:"manifest",severity:"fatal"},BUNDLE_INVALID:{code:"AX-PROJECT-010",title:"Invalid Bundle Source",description:"The directory being bundled has no package.json, or its package.json has no name \u2014 every bundle needs a real package identity.",source:"manifest",severity:"fatal"},BUNDLE_TAR_MISSING:{code:"AX-PROJECT-020",title:"tar Not Found",description:"Bundling shells out to the system's tar binary, which isn't on PATH \u2014 install Git for Windows or use WSL on that platform.",source:"manifest",severity:"fatal"},BUNDLE_TAR_FAILED:{code:"AX-PROJECT-021",title:"tar Failed",description:"The tar subprocess exited non-zero while building a bundle archive.",source:"manifest",severity:"fatal"},BENCH_RUN_NOT_FOUND:{code:"AX-BENCH-001",title:"Bench Run Not Found",description:"No recorded bench run exists with this id.",source:"bench",severity:"fatal",expected:!0},BENCH_NOT_FOUND:{code:"AX-BENCH-002",title:"Bench Not Found",description:"No bench.config.ts was found at this path \u2014 it isn't a recognized bench project.",source:"bench",severity:"fatal",expected:!0},BENCH_TESTS_NOT_FOUND:{code:"AX-BENCH-003",title:"Bench Test Files Not Found",description:"The bench config declares test files that don't exist on disk.",source:"bench",severity:"fatal",expected:!0},BENCH_LOCAL_REF_NOT_FOUND:{code:"AX-BENCH-004",title:"Bench Local Reference Not Found",description:"A factor variable references a local file/directory that doesn't exist.",source:"bench",severity:"fatal",expected:!0},BENCH_CONFIG_INVALID:{code:"AX-BENCH-005",title:"Bench Config Invalid",description:"bench.config.ts failed to evaluate or didn't produce a valid bench definition.",source:"bench",severity:"fatal"},BENCH_PACKAGE_NOT_FOUND:{code:"AX-BENCH-006",title:"Bench Package Not Found",description:"No package.json exists at the bench root \u2014 every bench project needs one for identity.",source:"bench",severity:"fatal",expected:!0},BENCH_PACKAGE_NAME_REQUIRED:{code:"AX-BENCH-007",title:"Bench Package Name Required",description:"The bench's package.json has no name field.",source:"bench",severity:"fatal",expected:!0},BENCH_PACKAGE_VERSION_REQUIRED:{code:"AX-BENCH-008",title:"Bench Package Version Required",description:"The bench's package.json has no version field.",source:"bench",severity:"fatal",expected:!0},BENCH_CONTEXT_MISSING:{code:"AX-BENCH-009",title:"Bench Context Missing",description:"The benchmark preload needs AXON_BENCH_CONTEXT set \u2014 it was run outside the bench harness.",source:"bench",severity:"fatal"},BENCH_NO_ACTIVE_CASE:{code:"AX-BENCH-010",title:"No Active Bench Case",description:"A bench emission (measurement, artifact) happened outside any running Bun test \u2014 these calls must occur inside a test case.",source:"bench",severity:"fatal"},BENCH_WORKSPACE_UNAVAILABLE:{code:"AX-BENCH-011",title:"Bench Workspace Unavailable",description:"The bench's workspace directory hasn't been materialized yet for this run.",source:"bench",severity:"fatal"},BENCH_AGENT_UNRESOLVED:{code:"AX-BENCH-012",title:"Bench Agent Unresolved",description:"The bench's declared subject agent isn't a prepared local agent \u2014 run `axon prepare` on it first.",source:"bench",severity:"fatal"},BENCH_MEASUREMENT_UNKNOWN:{code:"AX-BENCH-013",title:"Unknown Bench Measurement",description:"A measurement was emitted under an id the bench config never declared.",source:"bench",severity:"fatal"},BENCH_MEASUREMENT_TYPE:{code:"AX-BENCH-014",title:"Bench Measurement Type Mismatch",description:"A measurement's emitted value doesn't match the type its bench config declaration expects.",source:"bench",severity:"fatal"},BENCH_MEASUREMENT_DOMAIN:{code:"AX-BENCH-015",title:"Bench Measurement Out Of Domain",description:"A measurement's emitted value falls outside the range or category the bench config declares for it.",source:"bench",severity:"fatal"},BENCH_DIMENSION_UNKNOWN:{code:"AX-BENCH-016",title:"Unknown Bench Dimension",description:"A dimension value was set under an id the bench config never declared.",source:"bench",severity:"fatal"},BENCH_DIMENSION_DOMAIN:{code:"AX-BENCH-017",title:"Bench Dimension Out Of Domain",description:"A dimension's set value isn't one of the categories its bench config declares.",source:"bench",severity:"fatal"},BENCH_AXIS_UNKNOWN:{code:"AX-BENCH-018",title:"Unknown Bench Factor",description:"Something referenced a factor id the running bench's coordinate never assigned a value to.",source:"bench",severity:"fatal"},BENCH_ARTIFACT_UNKNOWN:{code:"AX-BENCH-019",title:"Unknown Bench Artifact",description:"An artifact was emitted under an id the bench config never declared.",source:"bench",severity:"fatal"},BENCH_ARTIFACT_MEDIA_TYPE:{code:"AX-BENCH-020",title:"Bench Artifact Media Type Not Allowed",description:"An artifact was emitted with a media type its bench config declaration doesn't allow.",source:"bench",severity:"fatal"},BENCH_SCHEMA_UNREADABLE:{code:"AX-BENCH-030",title:"Bench Schema Unreadable",description:"bench.config.ts could not be parsed while extracting the measurement schema.",source:"bench",severity:"fatal"},BENCH_SCHEMA_EMPTY:{code:"AX-BENCH-031",title:"Bench Schema Empty",description:"defineBench<Schema> was given a type with no properties \u2014 an empty schema and a failed extraction must never look alike.",source:"bench",severity:"fatal"},BENCH_SCHEMA_UNSUPPORTED_TYPE:{code:"AX-BENCH-032",title:"Bench Measurement Type Unsupported",description:"A measurement is not a boolean, number, union of string literals, or string.",source:"bench",severity:"fatal"},BENCH_SCHEMA_EXTRACTION_FAILED:{code:"AX-BENCH-033",title:"Bench Schema Extraction Failed",description:"The schema worker did not return a schema. Prepare fails rather than continuing with an empty one, which would silently make every measurement undeclared.",source:"bench",severity:"fatal"},BENCH_AXIS_NOT_FOUND:{code:"AX-BENCH-021",title:"Bench Axis Not Found",description:"The bench config's matrix has no axis with this key.",source:"bench",severity:"fatal",expected:!0},BENCH_AXIS_VALUE_NOT_FOUND:{code:"AX-BENCH-022",title:"Bench Axis Value Not Found",description:"The bench config's matrix axis has no declared value with this id.",source:"bench",severity:"fatal",expected:!0},BENCH_WORKSPACE_ESCAPE:{code:"AX-BENCH-023",title:"Bench Workspace Path Escapes Root",description:"A workspace source entry resolved to a path outside the workspace directory \u2014 refused rather than materialized.",source:"bench",severity:"fatal"},BENCH_WORKSPACE_SYMLINK_UNSUPPORTED:{code:"AX-BENCH-024",title:"Bench Workspace Symlinks Unsupported",description:"A workspace source contains a symlink \u2014 not supported when materializing a bench workspace.",source:"bench",severity:"fatal"},BENCH_WORKSPACE_OUTSIDE_ROOT:{code:"AX-BENCH-025",title:"Bench Template Outside Root",description:"A workspace template's declared source path resolves outside the bench project root.",source:"bench",severity:"fatal"},BENCH_WORKSPACE_SOURCE_NOT_FOUND:{code:"AX-BENCH-026",title:"Bench Template Not Found",description:"A workspace template's declared source path isn't a real directory.",source:"bench",severity:"fatal",expected:!0},BENCH_LOG_INVALID:{code:"AX-BENCH-027",title:"Bench Log Invalid",description:"A bench run's event log is missing an entry its projection requires \u2014 the log is incomplete or was written out of order.",source:"bench",severity:"fatal"},TOOL_DECLARE_FAILED:{code:"AX-BLUEPRINT-002",title:"Tool Declaration Failed",description:"Compiling a src/tools/*.ts file's TypeScript declarations failed \u2014 the worker subprocess reported a compile error.",source:"manifest",severity:"fatal"},TOOL_BUNDLE_FAILED:{code:"AX-BLUEPRINT-006",title:"Tool Bundle Failed",description:"Bundling a src/tools/*.ts file to self-contained source failed \u2014 the bundler subprocess reported an error. Tools are bundled so the sandbox loads them without mounting the project; a bundle failure means the tool cannot enter the box.",source:"manifest",severity:"fatal"},ROUTE_LOAD_FAILED:{code:"AX-BLUEPRINT-007",title:"Route Load Failed",description:"A file in server/api/ could not be imported. The agent would serve an endpoint set that is not the declared one \u2014 a caller gets a 404 for a route whose file exists.",source:"manifest",severity:"fatal"},SCRIPT_LOAD_FAILED:{code:"AX-BLUEPRINT-008",title:"Script Load Failed",description:"A file in src/scripts/ could not be processed. `axon run <name>` would report the script as not found while its file sits in the project.",source:"manifest",severity:"fatal"},PLUGIN_LOAD_FAILED:{code:"AX-BLUEPRINT-009",title:"Plugin Load Failed",description:"A plugin could not be imported. Plugins wire server behaviour at boot; one silently missing means the agent runs without behaviour its author declared.",source:"manifest",severity:"fatal"},MIDDLEWARE_LOAD_FAILED:{code:"AX-BLUEPRINT-010",title:"Middleware Load Failed",description:"A middleware file could not be imported. Middleware commonly carries auth and validation, so a silently skipped one is a request path running without the checks its author wrote.",source:"manifest",severity:"fatal"},PROMPT_INTROSPECT_FAILED:{code:"AX-BLUEPRINT-011",title:"Prompt Introspection Failed",description:"A .vue prompt could not be introspected for its props. The prompt would render without the inputs it declares, or not at all.",source:"manifest",severity:"fatal"},CONFIG_NOT_FOUND:{code:"AX-BLUEPRINT-003",title:"Config Not Found",description:"No axon.config.ts exists at this path.",source:"manifest",severity:"fatal",expected:!0},CONFIG_LOAD_FAILED:{code:"AX-BLUEPRINT-004",title:"Config Failed To Load",description:"axon.config.ts threw or failed to evaluate \u2014 check the file for a syntax or runtime error.",source:"manifest",severity:"fatal"},CONFIG_INVALID:{code:"AX-BLUEPRINT-005",title:"Config Invalid",description:"axon.config.ts evaluated but never called defineAgent() \u2014 every agent config must produce one.",source:"manifest",severity:"fatal"},ENGINE_NO_DONE:{code:"AX-KERNEL-001",title:"Engine Stream Ended Without Completing",description:"The model driver's stream ended without ever emitting a completion event \u2014 the engine likely disconnected or crashed mid-response.",source:"kernel",severity:"fatal"},ENGINE_NOT_CONNECTED:{code:"AX-KERNEL-015",title:"Provider Not Connected",description:"This model's route is not connected to your account yet \u2014 run `:provider <name> connect` for the provider named below, or pick a model on a route you are already signed in to.",source:"kernel",severity:"fatal",expected:!0},ENGINE_AUTH_FAILED:{code:"AX-KERNEL-016",title:"Provider Rejected Your Credentials",description:"The provider refused the credential this agent is using \u2014 it has expired, been revoked, or is for a different account. Reconnect the provider, or pick a model on a route you are signed in to.",source:"kernel",severity:"fatal",expected:!0},ENGINE_RATE_LIMITED:{code:"AX-KERNEL-017",title:"Provider Rate Limit Reached",description:"The provider is refusing further calls right now \u2014 either too many requests in a short window, or a subscription whose allowance is spent. Waiting usually clears the first; the second needs a plan change or a different model.",source:"kernel",severity:"fatal",expected:!0},ENGINE_QUOTA_EXHAUSTED:{code:"AX-KERNEL-018",title:"Provider Credits Exhausted",description:"This route has no credit left to spend. Top it up, or switch to a model on a route that does \u2014 the conversation is intact either way.",source:"kernel",severity:"fatal",expected:!0},ENGINE_REQUEST_REJECTED:{code:"AX-KERNEL-019",title:"Provider Rejected The Request",description:"The provider refused this call as malformed or unsupported \u2014 commonly a model id it does not serve, a context window this conversation has outgrown, or a parameter that route does not accept.",source:"kernel",severity:"fatal",expected:!0},ENGINE_UNREACHABLE:{code:"AX-KERNEL-020",title:"Could Not Reach The Provider",description:"The provider could not be reached, or kept failing, across every retry \u2014 usually a network problem on this machine or an outage on their side. Nothing about this agent needs changing; try again.",source:"kernel",severity:"fatal",expected:!0},ENGINE_STREAM_FAILED:{code:"AX-KERNEL-008",title:"Engine Stream Failed",description:"The model driver's stream failed and exhausted its retries (or the failure wasn't retryable) \u2014 see context for the provider's fault code.",source:"kernel",severity:"fatal"},CODEX_NOT_CONNECTED:{code:"AX-KERNEL-012",title:"Codex Subscription Not Connected",description:"This agent uses a Codex model, but your Axon account is not connected to ChatGPT \u2014 run :provider codex connect and try again.",source:"kernel",severity:"fatal",expected:!0},RUN_IN_PROGRESS:{code:"AX-KERNEL-002",title:"A Wake Is Already Running",description:"The kernel only executes one wake at a time \u2014 a new run was requested while the previous one was still active.",source:"kernel",severity:"recovered"},RUN_RESERVATION_EXPIRED:{code:"AX-KERNEL-003",title:"Wake Reservation Expired",description:"The reserved execution slot for this wake is no longer active \u2014 it was released before the run could start.",source:"kernel",severity:"fatal"},NO_COGNET_LOADED:{code:"AX-KERNEL-004",title:"No Cognet Loaded",description:"The kernel tried to execute a wake, but the blueprint carried no cognet definition to run it against.",source:"kernel",severity:"fatal"},SYSCALL_OUTSIDE_RUN:{code:"AX-KERNEL-005",title:"Syscall Outside An Active Run",description:"A kernel syscall (engine.stream and similar) was made with no active wake to attribute it to.",source:"kernel",severity:"fatal"},CAPSULE_ACCESSED_BEFORE_BOOT:{code:"AX-KERNEL-007",title:"Capsule Accessed Before Boot",description:"Something reached for the live capsule instance before boot() had run \u2014 there is no sandbox yet to hand back.",source:"kernel",severity:"fatal"},COGNET_EMIT_FORBIDDEN:{code:"AX-KERNEL-009",title:"Cognet Emit Forbidden",description:"A cognet tried to emit an event outside the cognet:* namespace \u2014 the ABI only lets a cognet narrate its own telemetry, never forge kernel machinery events.",source:"kernel",severity:"fatal"},KNOWLEDGE_NOT_FOUND:{code:"AX-KERNEL-011",title:"Knowledge Entry Not Found",description:"A cognet read a knowledge entry that does not exist. The knowledge store is not a cache \u2014 a brain reading something the catalogue advertised has hit a real inconsistency, so this is loud rather than an empty result.",source:"kernel",severity:"fatal",expected:!0},KNOWLEDGE_READONLY:{code:"AX-KERNEL-013",title:"Knowledge Entry Is Read-Only",description:"A cognet tried to write or remove knowledge contributed by a module. Module material lives inside its own package and the next install would destroy any change \u2014 so this fails loudly rather than succeeding and vanishing later. An agent's own data/knowledge/ is writable.",source:"kernel",severity:"fatal",expected:!0},KNOWLEDGE_RECORD_FAILED:{code:"AX-KERNEL-014",title:"Knowledge Mutation Went Unrecorded",description:"A knowledge write or remove succeeded on disk, but the session record of it could not be committed. The mutation is real and already visible to the agent; only its audit trail is missing, so this is reported rather than thrown \u2014 the caller cannot undo a completed write. It matters because 'the agent rewrote its own memory' is the fact you want weeks later when behaviour drifts, and here the ledger and the filesystem disagree.",source:"kernel",severity:"degraded"},KNOWLEDGE_ESCAPE:{code:"AX-KERNEL-021",title:"Knowledge Path Escapes Store",description:"A knowledge name resolved outside the store root. Names are identifiers, not paths \u2014 traversal is refused at the boundary rather than trusted not to happen.",source:"kernel",severity:"fatal"},SCHEDULER_MODE_MISMATCH:{code:"AX-KERNEL-010",title:"Scheduler Mode Mismatch",description:"A caller used the wrong wake verb for the cognet's mode: continuous cognets advance via tick(), driven by the body's clock; invocation cognets wake on a stimulus via request()/stream().",source:"kernel",severity:"fatal"},THREAD_UNKNOWN_PARENT:{code:"AX-SESSION-001",title:"Thread Branched From Unknown Parent",description:"A thread's recorded lineage points at a parent thread id that isn't registered in this session \u2014 the session index is inconsistent.",source:"thread",severity:"fatal"},THREAD_NOT_FOUND:{code:"AX-SESSION-002",title:"Thread Not Found",description:"The requested thread id isn't registered in this session.",source:"thread",severity:"fatal",expected:!0},THREAD_BRANCH_UNKNOWN:{code:"AX-SESSION-003",title:"Cannot Branch Unknown Thread",description:"A branch was requested from a parent thread id that isn't registered in this session.",source:"thread",severity:"fatal"},SENSORY_WRITE_FAILED:{code:"AX-SESSION-004",title:"Sensory Ring Write Failed",description:"A dense sense entry (audio or visual) could not be written to the session's sensory ring \u2014 usually a full or read-only data directory. Delivery to the cognet is unaffected; the debug window for this session will have a gap.",source:"runtime",severity:"degraded"},NO_COGNET:{code:"AX-BLUEPRINT-001",title:"No Cognet Declared",description:"The blueprint carries no cognet definition \u2014 an agent cannot run without a brain. The CLI or test harness must construct and pass one.",source:"runtime",severity:"fatal"},CONTROL_PATH_NOT_FOUND:{code:"AX-CONTROL-001",title:"Control Path Not Found",description:"A control-channel call named a method the peer does not expose. The two ends disagree about the surface \u2014 usually a TUI and an extension built from different versions.",source:"server",severity:"fatal",expected:!0},CONTROL_PATH_NOT_CALLABLE:{code:"AX-CONTROL-002",title:"Control Path Not Callable",description:"A control-channel call resolved to a value on the peer's handle that is not a function.",source:"server",severity:"fatal"},CONTROL_CALL_FAILED:{code:"AX-CONTROL-003",title:"Control Call Failed",description:"The peer served a control-channel call and it threw. The remote message is carried here \u2014 the failure surfaces at the local call site rather than being returned as a falsy value.",source:"server",severity:"fatal"},CONTROL_CLOSED:{code:"AX-CONTROL-004",title:"Control Channel Closed",description:"A control-channel call was made, or was still in flight, when the channel closed. In-flight calls reject on close rather than hanging forever on an answer that is no longer coming.",source:"server",severity:"fatal"},CONTROL_UNAUTHORIZED:{code:"AX-CONTROL-005",title:"Control Handshake Rejected",description:"A connection to the control socket presented a missing or incorrect token. The token lives in the instance record, which is readable only by the owning user \u2014 a mismatch means the caller is not the local Fleet extension.",source:"server",severity:"fatal"},PLUGIN_BOOT_FAILED:{code:"AX-SERVER-001",title:"Plugin Failed During Boot",description:"A server plugin threw while running at boot \u2014 plugins are the one place in server startup where a failure must abort the boot rather than being warned and skipped.",source:"server",severity:"fatal"},HANDLE_SHUTDOWN_FAILED:{code:"AX-RUNTIME-002",title:"Handle Failed To Shut Down",description:"One of the runtime's owned handles (kernel, etc.) threw during shutdown \u2014 teardown is error-isolated, so the others still ran, but this one didn't close cleanly.",source:"runtime",severity:"fatal"},BUS_HANDLER_FAILED:{code:"AX-RUNTIME-004",title:"Bus Handler Failed",description:"A handler subscribed to a runtime bus event threw. Handler failures are non-fatal by design \u2014 the remaining handlers still run \u2014 but they are recorded rather than swallowed, since plugins and modules register handlers and a silently-broken one is invisible rot.",source:"runtime",severity:"degraded"},TOOL_CALL_FAILED:{code:"AX-RUNTIME-003",title:"Tool Call Failed",description:"An axon.tools.<namespace>.<fn>() call from script-land completed with a non-ok result from the capsule \u2014 unwrapped here into a normal throw, since script-land expects the ordinary call/throw contract, not the kernel's own stable-result shape.",source:"runtime",severity:"fatal"},CAPSULE_TOOL_TIMEOUT:{code:"AX-CAPSULE-001",title:"Tool Load Timed Out",description:"The sandbox never confirmed loading a declared tool within the timeout \u2014 it may be stuck on a slow import or the subprocess is unresponsive.",source:"capsule",severity:"fatal"},CAPSULE_TOOL_SCOPE_MISMATCH:{code:"AX-CAPSULE-002",title:"Tool Scope Mismatch",description:"A tool's declared exports don't match what it actually exported once loaded in the sandbox \u2014 the bundled source and its declaration have drifted apart.",source:"capsule",severity:"fatal"},CAPSULE_TOOL_FAILED:{code:"AX-CAPSULE-003",title:"Tool Failed To Load",description:"A declared tool failed to load into the sandbox \u2014 its source may be malformed, too large to import, or the subprocess exited before confirming.",source:"capsule",severity:"fatal"},CAPSULE_CONFINE_UNAVAILABLE:{code:"AX-CAPSULE-004",title:"OS Confinement Unavailable",description:"The policy requested OS confinement (isolation: auto) but the host is missing a required primitive (bubblewrap, systemd, nft, or the axon-agent user). Run `axon install`, or set isolation: none to opt out explicitly. The capsule refuses to boot rather than silently run unconfined.",source:"capsule",severity:"fatal"},CAPSULE_CONFINE_USER_UNRESOLVED:{code:"AX-CAPSULE-005",title:"Confinement User Unresolved",description:"The confinement user exists but its numeric uid/gid could not be read \u2014 the box cannot drop privileges without them. The host user database may be inconsistent.",source:"capsule",severity:"fatal"},CAPSULE_BOOT_FAILED:{code:"AX-CAPSULE-006",title:"Capsule Failed To Boot",description:"The sandbox subprocess exited or reported failure before completing the boot handshake. The captured stderr in the error context is the real cause \u2014 most often a confinement mount that could not be satisfied (a declared fs path that does not exist) or a runtime that could not start.",source:"capsule",severity:"fatal"},CAPSULE_BOOT_TIMEOUT:{code:"AX-CAPSULE-007",title:"Capsule Boot Timed Out",description:"The sandbox subprocess did not report ready within the boot timeout. Its captured stderr is in the error context; if empty, the subprocess may be hung rather than crashed.",source:"capsule",severity:"fatal"},CAPSULE_SPAWN_FAILED:{code:"AX-CAPSULE-008",title:"Capsule Spawn Failed",description:"The capsule subprocess command could not be spawned at all \u2014 the interpreter or confinement wrapper was not found, or PATH is unset. Check that bun (and, under confinement, bwrap/systemd-run) are on PATH.",source:"capsule",severity:"fatal"},CAPSULE_WIRE_CLOSED:{code:"AX-CAPSULE-009",title:"Capsule Wire Closed",description:"A command was sent to the sandbox after its stdin pipe was gone \u2014 the subprocess has exited or is mid-teardown. The caller is racing the capsule lifecycle.",source:"capsule",severity:"fatal"},CAPSULE_DOWN:{code:"AX-CAPSULE-010",title:"No Live Capsule",description:"An operation needed a running sandbox subprocess, but none is live \u2014 it is booting, restarting after a crash, or has been declared dead.",source:"capsule",severity:"fatal"},CAPSULE_ALREADY_BOOTED:{code:"AX-CAPSULE-011",title:"Capsule Already Booted",description:"boot() was called on a capsule that already has a live subprocess. Boot is once per lifetime; use update()/reload() to replace a running incarnation.",source:"capsule",severity:"fatal"},CAPSULE_INSTALL_FAILED:{code:"AX-CAPSULE-013",title:"Confinement Install Failed",description:"Provisioning the host for the hardened confinement tier failed \u2014 most often because creating the dedicated system user needs root. Re-run `axon install` with sufficient privilege.",source:"capsule",severity:"fatal"},CAPSULE_HOST_UNAVAILABLE:{code:"AX-CAPSULE-014",title:"Host Bridge Unavailable",description:"Sandboxed code called a host service, but this capsule was built with no host provider. Host calls require a wired host bridge on the manager side.",source:"capsule",severity:"fatal"},CAPSULE_CRASHED:{code:"AX-CAPSULE-015",title:"Capsule Crashed",description:"An unhandled error escaped inside the sandbox subprocess. The capsule reports it on the wire and exits immediately \u2014 after an unhandled throw the sandbox's state is unknown, and a capsule that keeps serving is worse than one that dies loudly.",source:"capsule",severity:"fatal"},CAPSULE_DEAD:{code:"AX-CAPSULE-016",title:"Capsule Dead",description:"The capsule subprocess is gone and supervision gave up restarting it. Every subsequent execution request fails until a new capsule is booted.",source:"capsule",severity:"fatal"},CAPSULE_PARSE_ERROR:{code:"AX-CAPSULE-017",title:"Capsule Wire Parse Error",description:"A line arriving from the sandbox was not a valid protocol event. The sandbox is speaking garbage \u2014 a protocol mismatch or corrupted output \u2014 and the line is dropped rather than acted on, never silently.",source:"capsule",severity:"degraded"},CAPSULE_CMD_FAILED:{code:"AX-CAPSULE-018",title:"Capsule Command Failed",description:"Code executed in the sandbox threw. This is the ordinary failure path for an agent-emitted block or a script-land run() \u2014 the error is the sandboxed code's own, surfaced verbatim.",source:"capsule",severity:"degraded"},CAPSULE_FN_FAILED:{code:"AX-CAPSULE-019",title:"Tool Call Threw",description:"A mediated tool function threw inside the sandbox. The failure is the tool's own; it propagates to the calling code unchanged and is recorded as the closing half of the call's span.",source:"capsule",severity:"degraded"},CAPSULE_PROC_DENIED:{code:"AX-CAPSULE-020",title:"Process Spawn Denied",description:"A process the sandbox tried to start was refused \u2014 denied by policy, killed before it could spawn, or the spawn itself failed. No process was created.",source:"capsule",severity:"degraded"},CAPSULE_PROC_FAILED:{code:"AX-CAPSULE-022",title:"Managed Process Failed",description:"A spawned child process errored without ever producing an exit code \u2014 an exec failure or a broken IPC channel. Distinct from a non-zero exit, which is the process running correctly and reporting a result.",source:"capsule",severity:"degraded"},CAPSULE_PROC_STDIN_FAILED:{code:"AX-CAPSULE-021",title:"Process Stdin Write Failed",description:"Writing to a managed child process's stdin failed \u2014 the process is no longer running, or its stdin has already closed.",source:"capsule",severity:"degraded"},NOT_BOOTED:{code:"AX-TUI-001",title:"No Agent Running",description:"A message was sent, or an action requiring a live agent was taken, before any agent finished booting.",source:"tui",severity:"fatal"},NOT_AUTHENTICATED:{code:"AX-TUI-002",title:"Not Logged In",description:"The action needs an active profile, but none is logged in yet.",source:"tui",severity:"fatal",expected:!0},PROFILE_NOT_AUTHENTICATED:{code:"AX-TUI-003",title:"Profile Has No Session",description:"The target profile exists but has no stored session \u2014 it has never logged in, or its session was cleared.",source:"tui",severity:"fatal",expected:!0},BACKEND_UNREACHABLE:{code:"AX-TUI-044",title:"Backend Unreachable",description:"A stored credential could not be verified because the backend could not be reached. The credential is NOT discarded \u2014 it may be perfectly valid \u2014 but it cannot be trusted until it is checked, so the action is refused rather than proceeding unverified.",source:"tui",severity:"fatal",expected:!0},PROFILE_UNKNOWN:{code:"AX-TUI-004",title:"Unknown Profile",description:"The requested profile id isn't one of the profiles stored on this machine.",source:"tui",severity:"fatal",expected:!0},SESSION_NOT_FOUND:{code:"AX-SESSION-005",title:"Session Not Found",description:"No session log exists at that path. A session is a .jsonl file under the agent's frame (`.agent/data/sessions/`); it may have been deleted, or belong to an agent that has since been removed.",source:"runtime",severity:"fatal",expected:!0},SESSION_UNREADABLE:{code:"AX-SESSION-006",title:"Session Log Unreadable",description:"The session log does not begin with a `session:header` line, so it cannot be forked or renamed. Either the file is truncated, or it was written by a version predating the header \u2014 an older log can still be read and resumed, just not copied.",source:"runtime",severity:"fatal",expected:!0},SESSION_ALREADY_RUNNING:{code:"AX-TUI-005",title:"Session Is Already Running",description:"spawn() was asked to resume a session that already has a live instance. Focus the running instance instead of booting a second runtime over the same log.",source:"tui",severity:"fatal",expected:!0},SESSION_NOT_RUNNING:{code:"AX-TUI-016",title:"Session Is Not Running",description:"focus() was pointed at a sessionId with no live instance behind it. Spawn (or resume) it first \u2014 focus is pure selection over running instances.",source:"tui",severity:"fatal",expected:!0},NO_ACTIVE_AGENT:{code:"AX-TUI-045",title:"No Active Agent",description:"The action needs a running agent, but none is active \u2014 start one first.",source:"tui",severity:"fatal",expected:!0},NO_LOCAL_PROJECT:{code:"AX-TUI-050",title:"No Local Project",description:"This agent has no project directory on this machine \u2014 it was attached over the network, so its source lives wherever it is running. Opening its config, or any other file verb, has to happen there. Focus a local agent instead.",source:"tui",severity:"fatal",expected:!0},NO_FOCUSED_INSTANCE:{code:"AX-TUI-017",title:"No Focused Agent Instance",description:"A module install/uninstall was requested with no running agent instance focused \u2014 spawn or focus one first.",source:"tui",severity:"fatal",expected:!0},MODEL_UNAVAILABLE:{code:"AX-TUI-051",title:"Model Not Available From Any Declared Provider",description:"The picked model was saved to the agent's config, but no provider this profile declares can supply it \u2014 so the running agent still uses its previous model. Connect the provider that serves it, or pick a model from the offered list.",source:"tui",severity:"fatal",expected:!0},MODEL_IMMUTABLE_DEPLOYED:{code:"AX-TUI-006",title:"Cannot Change A Deployment's Model",description:"A deployed agent's config lives in the cloud, not on this machine \u2014 its model is fixed at deploy time. Change it in the local project and deploy again.",source:"tui",severity:"fatal",expected:!0},MODULE_INSTALL_FAILED:{code:"AX-TUI-018",title:"Module Install Failed",description:"The registry installer returned an error for this module specifier \u2014 check the specifier and registry connectivity.",source:"tui",severity:"fatal"},NO_MODULES_INSTALLED:{code:"AX-TUI-019",title:"No Modules Installed",description:"The `:module uninstall` command was opened with no modules resolved into the focused instance's blueprint.",source:"tui",severity:"fatal"},SETTINGS_NOT_WRITABLE:{code:"AX-EXT-027",title:"Settings Cannot Be Written",description:"A settings change was requested on a store with no profile config behind it \u2014 nobody is logged in, or this Store was built without one (tests). Settings live in `profile.config.ts`, so there is nowhere to write them; the change was refused rather than saved somewhere nothing reads back.",source:"tui",severity:"fatal",expected:!0},REGISTRY_EMPTY:{code:"AX-TUI-047",title:"Nothing To Install",description:"The install palette was opened with no rows to show \u2014 the catalogue is still loading, the registry could not be reached, or everything published for that kind is already installed. The row itself says which.",source:"tui",severity:"fatal",expected:!0},NO_EXTENSIONS_INSTALLED:{code:"AX-TUI-046",title:"No Extensions Installed",description:"The `:ext uninstall` command was opened with no extensions declared in the active profile's profile.config.ts.",source:"tui",severity:"fatal",expected:!0},ATTACH_URL_REQUIRED:{code:"AX-TUI-048",title:"Attach URL Required",description:"`:attach` needs the address of a running agent \u2014 e.g. `:attach http://localhost:3010`. The agent must already be serving; attach binds to it and never boots anything.",source:"tui",severity:"fatal"},ATTACH_URL_INVALID:{code:"AX-TUI-049",title:"Attach URL Invalid",description:"The address is not a usable agent URL. An agent is reached over http or https and the scheme is required \u2014 `localhost:3010` is a path, `http://localhost:3010` is an address. Checked before anything connects, so a typo fails immediately rather than as a transport error.",source:"tui",severity:"fatal"},DEPLOYMENT_NOT_CONNECTABLE:{code:"AX-TUI-028",title:"Deployment Not Connectable",description:"The deployment is not in the connectable list \u2014 it may have stopped, errored, or never finished provisioning. Refresh the deployment list and try again.",source:"tui",severity:"fatal"},SUBAGENT_REMOTE_PARENT:{code:"AX-TUI-027",title:"Cannot Spawn A Subagent From A Deployment",description:"A subagent is forked from its parent's local project, and an attached deployment has no local project here \u2014 the deployed agent runs its own subagents inside its own capsule.",source:"tui",severity:"fatal"},BASE_MODEL_INSTANCE_CONFLICT:{code:"AX-TUI-026",title:"Managed Model Instance Already Running",description:"A managed base instance is already running on a different engine. The base workspace holds one shared config, so spawning a second naked model would rewrite it underneath the live instance \u2014 close the running one first.",source:"tui",severity:"fatal"},NOT_WIRED:{code:"AX-TUI-008",title:"Not Wired Yet",description:"This surface is a declared stub \u2014 the real implementation hasn't been built yet.",source:"tui",severity:"fatal"},MIC_ALREADY_CAPTURING:{code:"AX-TUI-009",title:"Mic Already Capturing",description:"capture.start() was called while a capture was already in progress \u2014 stop the current one first.",source:"tui",severity:"fatal"},MIC_CAPTURE_UNAVAILABLE:{code:"AX-TUI-010",title:"No Audio Capture Tool Found",description:"Voice input needs one of arecord, sox, or ffmpeg installed and on PATH.",source:"tui",severity:"fatal"},MIC_FFT_SIZE_MISMATCH:{code:"AX-TUI-014",title:"FFT Sample Size Mismatch",description:"computeBuckets() was called with a sample buffer that isn't exactly config.fftSize long \u2014 an internal invariant, callers must pad/trim first.",source:"tui",severity:"fatal"},MIC_CAPTURE_FAILED:{code:"AX-TUI-015",title:"Mic Capture Failed",description:"The audio capture subprocess produced no output or exited immediately \u2014 check that a microphone is available.",source:"tui",severity:"fatal"},WATCH_PATH_REQUIRED:{code:"AX-TUI-021",title:"Watch Path Required",description:"`axon watch`/`axon unwatch` need a directory argument.",source:"tui",severity:"fatal",expected:!0},WATCH_PATH_NOT_FOUND:{code:"AX-TUI-022",title:"Watch Path Not Found",description:"`axon watch` was given a directory that doesn't exist on disk.",source:"tui",severity:"fatal",expected:!0},EDITOR_NOT_SET:{code:"AX-TUI-023",title:"No Editor Configured",description:"`axon settings` needs the $EDITOR environment variable set to know which editor to open.",source:"tui",severity:"fatal"},EDITOR_LAUNCH_FAILED:{code:"AX-TUI-024",title:"Editor Failed To Launch",description:"The command in $EDITOR could not be spawned \u2014 check that it's installed and on PATH.",source:"tui",severity:"fatal"},WATCH_AND_INIT_ARGS_REQUIRED:{code:"AX-TUI-025",title:"Directory And Name Required",description:`The init palette's "watch a new directory" entry needs both a directory path and an agent name, space-separated.`,source:"tui",severity:"fatal",expected:!0},MODULE_CONFIG_LOAD_FAILED:{code:"AX-MODULE-001",title:"Module Config Failed To Load",description:"The runtime could not import a module's module.config.ts at boot \u2014 the file is missing at its resolved path, or importing it threw. A module that cannot load contributes nothing, so boot fails rather than run a partially-wired agent.",source:"runtime",severity:"fatal"},MODULE_SOURCE_DECLARED:{code:"AX-MODULE-008",title:"Module Declared As Source",description:"Uninstall was asked to remove a module that axon.config.ts declares as an IMPORT rather than by registry name. The import statement is the author's own code, so uninstall does not rewrite it \u2014 and removing the dependency alone would leave the config importing a package that is no longer declared, with the agent still loading it. Nothing was changed: delete the import and its entry in modules: [...] by hand.",source:"cli",severity:"fatal"},MODULE_NOT_INSTALLED:{code:"AX-MODULE-003",title:"Module Not Installed",description:"A plugin asked for the options of a module this agent does not have installed \u2014 almost always a name mismatch between the plugin and the module that ships it. Reported rather than defaulted: handing back an empty options bag would let a hardware module open the wrong device and never say so.",source:"runtime",severity:"fatal"},MODULE_OPTIONS_INVALID:{code:"AX-MODULE-002",title:"Invalid Module Options",description:"The options declared for a module under modules.<name> in axon.config.ts do not satisfy the module's options schema \u2014 a required option is missing or a value has the wrong type.",source:"runtime",severity:"fatal"},MODULE_SETUP_FAILED:{code:"AX-MODULE-007",title:"Module Setup Failed",description:"A module's setup() threw during agent boot. Setup runs sequentially in blueprint order and a failure is total \u2014 no later module is wired, and the agent does not boot half-configured.",source:"runtime",severity:"fatal"},MODULE_SERVER_NOT_WIRED:{code:"AX-MODULE-004",title:"Module Server API Not Wired",description:"A module's setup() called ctx.server.addRoute/addMiddleware or ctx.tools.get, but that surface is not implemented yet. Declare routes as server/api/ files in the module instead.",source:"runtime",severity:"fatal"},MODULE_ENV_REQUIRED:{code:"AX-MODULE-005",title:"Module Env Var Missing",description:"A module's setup() called ctx.env.require() for a variable the agent's resolved environment does not provide. The module declares required env in module.config.ts; the agent must supply it (e.g. in .env).",source:"runtime",severity:"fatal",expected:!0},MODULE_POLICY_IMMUTABLE:{code:"AX-MODULE-006",title:"Module Policy Is Immutable At Boot",description:"A module's setup() called ctx.policy.update(). The resolved agent policy is authoritative and cannot be mutated at boot \u2014 declare policy needs statically in module.config.ts so the CLI reconciles them at install.",source:"runtime",severity:"fatal",expected:!0},CLONE_REF_REQUIRED:{code:"AX-PROJECT-022",title:"No Artifact Named",description:"`axon clone` was run without an artifact to clone. Name one, for example: axon clone @axon/arxiv",source:"cli",severity:"fatal",expected:!0},FORK_REF_REQUIRED:{code:"AX-PROJECT-023",title:"No Artifact Named",description:"`axon fork` was run without an artifact to fork. Name one, for example: axon fork @axon/arxiv --as @you/arxiv",source:"cli",severity:"fatal"},FORK_NAME_REQUIRED:{code:"AX-PROJECT-024",title:"Fork Needs A New Name",description:"A fork is published under your own namespace, so it needs a name: pass --as <package-name>, for example: axon fork @axon/arxiv --as @you/arxiv",source:"cli",severity:"fatal"},CLONE_TARGET_EXISTS:{code:"AX-PROJECT-025",title:"Clone Target Not Empty",description:"The directory the artifact would be cloned into already has files in it. Clone into a new directory, or clear this one first.",source:"cli",severity:"fatal"},ARTIFACT_DOWNLOAD_FAILED:{code:"AX-PROJECT-026",title:"Artifact Download Failed",description:"The registry did not serve the artifact's source archive. The version may have been unpublished, or the network request failed.",source:"cli",severity:"fatal"},ARTIFACT_EXTRACT_FAILED:{code:"AX-PROJECT-027",title:"Artifact Extract Failed",description:"The downloaded archive could not be unpacked. It may be truncated, or `tar` is unavailable on this machine.",source:"cli",severity:"fatal"},VERSION_INVALID:{code:"AX-PROJECT-028",title:"Invalid Version",description:"The project's package.json version is not valid semver, so the next version cannot be derived from it. Fix the version field by hand.",source:"cli",severity:"fatal"},FRAMEWORK_NOT_INSTALLED:{code:"AX-PROJECT-029",title:"Framework Packages Not Installed",description:"The generated type frame references @arcforge/types, @arcforge/engines and h3, none of which resolve from this project. Run `bun install` before `axon prepare`.",source:"cli",severity:"fatal"},FRAME_MIGRATION_CONFLICT:{code:"AX-PROJECT-034",title:"Frame Migration Cannot Proceed Safely",description:"Runtime output exists in BOTH the old location and the new one, so migrating would have to merge or overwrite two sets of session history. Nothing was moved. Inspect both directories and remove or merge them by hand.",source:"cli",severity:"fatal"},CONFIG_EVALUATION_ESCAPED:{code:"AX-PROJECT-030",title:"defineAgent() Called Outside Config Evaluation",description:"defineAgent() ran outside the loader that evaluates axon.config.ts \u2014 it is a declaration helper, not a runtime function, and cannot be called from application code.",source:"cli",severity:"fatal"},PROMPT_NOT_INSTALLABLE:{code:"AX-PROJECT-037",title:"Prompts Are Not Installed Into Agents",description:"A prompt is content, not a capability: it resolves from the global cache and renders on demand, so every agent can already use it without declaring anything. Installing one into an agent would put content through the code path \u2014 an ABI check, a node_modules link, an agent reload \u2014 for something that needs none of it.",source:"manifest",severity:"fatal"},ASSET_TYPE_REFUSED:{code:"AX-PROJECT-038",title:"Unsupported Asset Type",description:"A file in assets/ is not a type the registry serves. Images (png, jpg, jpeg, webp, gif) and video (mp4, webm, mov) are accepted. SVG is deliberately refused: it is an executable document that would be served from our own storage origin, so a published SVG is a script-injection surface for every visitor reading that README.",source:"manifest",severity:"fatal",expected:!0},ASSET_TOO_LARGE:{code:"AX-PROJECT-039",title:"Asset Exceeds Size Limit",description:"A single file in assets/ is over the per-asset limit. Assets exist to illustrate a README, not to distribute media \u2014 compress the file or link to it externally.",source:"manifest",severity:"fatal",expected:!0},ASSETS_BUDGET_EXCEEDED:{code:"AX-PROJECT-040",title:"Assets Exceed Total Budget",description:"The assets/ folder as a whole is over budget for one published version. Every version stores its own copy of every asset, so the total is what determines how much a package costs to host forever.",source:"manifest",severity:"fatal",expected:!0},ASSET_PATH_INVALID:{code:"AX-PROJECT-041",title:"Unsafe Asset Path",description:"An entry under assets/ is a symlink, or its name escapes the assets directory. Both are refused: a published asset must be a real file that lands where its name says it does, or extraction on the server could write outside the target directory.",source:"manifest",severity:"fatal",expected:!0},ASSET_UNREADABLE:{code:"AX-PROJECT-042",title:"Asset Could Not Be Processed",description:"A file in assets/ has an image extension but could not be decoded, so it is either corrupt or not the format its name claims. Publishing it would ship a broken image into a README.",source:"manifest",severity:"fatal",expected:!0},PORT_UNAVAILABLE:{code:"AX-PROJECT-031",title:"No Free Port",description:"Every port in the range the agent scanned is already in use. Stop whatever is holding them, or start the agent on a different port.",source:"cli",severity:"fatal"},PARENT_INSTANCE_NOT_RUNNING:{code:"AX-RUNTIME-005",title:"Parent Agent Not Running",description:"A subagent was requested against a parent session that is no longer live \u2014 the parent shut down, crashed, or was never booted by this process.",source:"runtime",severity:"fatal"},SUBAGENT_DEPTH_EXCEEDED:{code:"AX-RUNTIME-006",title:"Subagent Depth Limit Reached",description:"An agent tried to spawn a subagent beyond the maximum nesting depth. The limit exists so a recursive delegation cannot spawn processes without bound.",source:"runtime",severity:"fatal"},SUBAGENT_CHILD_LIMIT_EXCEEDED:{code:"AX-RUNTIME-007",title:"Subagent Child Limit Reached",description:"One agent tried to hold more live children than the limit allows. Existing children must finish before more can be spawned.",source:"runtime",severity:"fatal"},SUBAGENT_DESCENDANT_LIMIT_EXCEEDED:{code:"AX-RUNTIME-008",title:"Subagent Descendant Limit Reached",description:"The whole subagent tree beneath one root exceeded its live-descendant budget. The limit bounds total concurrent processes, not just direct children.",source:"runtime",severity:"fatal"},SUBAGENT_REQUEST_INVALID:{code:"AX-RUNTIME-009",title:"Malformed Subagent Request",description:"A subagent request did not carry a usable prompt. It must be an object with `prompt` as a string or an array of strings.",source:"runtime",severity:"fatal"},INSTANCE_NOT_LOCAL:{code:"AX-RUNTIME-010",title:"Agent Instance Is Not Local",description:"An operation that only works against a locally booted agent was given a remote one. Subagent spawning and the managed base workspace both require a local process.",source:"runtime",severity:"fatal"},HOST_METHOD_UNKNOWN:{code:"AX-RUNTIME-011",title:"Unknown Host Method",description:"A booted agent called a host method this platform does not implement. The agent's framework version is likely newer than the CLI running it.",source:"runtime",severity:"fatal"},UPDATE_CURRENT_VERSION_INVALID:{code:"AX-TUI-029",title:"Running Version Is Not Semver",description:"The version this app reports for itself is not valid semver, so it cannot be compared against the latest release.",source:"cli",severity:"fatal"},UPDATE_RELEASE_INVALID:{code:"AX-TUI-030",title:"Malformed Release Record",description:"The backend's release record did not describe a valid @arcforge/axon `latest` version, so there is nothing safe to update to.",source:"cli",severity:"fatal"},UPDATE_UNAVAILABLE_IN_DEVELOPMENT:{code:"AX-TUI-031",title:"Update Not Available Here",description:"Self-update needs the packaged update helper and a supervisor request path, neither of which exists in a source checkout. Update the installed app instead.",source:"cli",severity:"fatal"},UPDATE_SUPERVISOR_UNAVAILABLE:{code:"AX-TUI-032",title:"Update Supervisor Unavailable",description:"The running app has no supervisor request path, so it cannot hand an update off to be applied after exit.",source:"cli",severity:"fatal"},UPDATE_HELPER_ARGS_INVALID:{code:"AX-TUI-033",title:"Malformed Update Helper Arguments",description:"The update helper was invoked without the --from/--to/--bun/--axon/--state arguments it requires. It is spawned by the app, not run by hand.",source:"cli",severity:"fatal"},UPDATE_HELPER_VERSION_INVALID:{code:"AX-TUI-034",title:"Update Helper Given Bad Versions",description:"The update helper received a --from or --to value that is not valid semver, so it refused to install anything.",source:"cli",severity:"fatal"},TEST_FILES_NOT_FOUND:{code:"AX-TUI-035",title:"No Test Files Matched",description:"No files matched the requested test patterns, so there was nothing to run. Check the pattern, or the directory it was resolved against.",source:"cli",severity:"fatal"},OLLAMA_UNAVAILABLE:{code:"AX-TUI-037",title:"Ollama Is Not Running",description:"No Ollama daemon answered on this machine. Start it with `ollama serve`, or install Ollama from https://ollama.com to run models locally.",source:"cli",severity:"fatal"},OLLAMA_REQUEST_FAILED:{code:"AX-TUI-038",title:"Ollama Request Failed",description:"The local Ollama daemon is running but refused a request \u2014 most often an unknown model name. The daemon's own message is included.",source:"cli",severity:"fatal"},OLLAMA_REGISTRY_UNREACHABLE:{code:"AX-TUI-039",title:"Ollama Registry Unreachable",description:"Could not reach the Ollama model registry to look a model up. Downloading needs a network connection; models already on disk still work offline.",source:"cli",severity:"fatal"},NO_EDITOR_ATTACHED:{code:"AX-TUI-042",title:"No Editor Attached",description:"Opening a pane hands it to a connected editor, and none is listening. Open this project in an editor running the Axon Fleet extension \u2014 it dials each running TUI itself, so the connection appears on its own once the window is up.",source:"tui",severity:"fatal"},NO_SESSION_TO_OPEN:{code:"AX-TUI-043",title:"No Session To Open",description:"A runtime pane is a view of one conversation, and no agent is focused yet \u2014 so there is nothing to point it at. Start or focus an agent first.",source:"tui",severity:"fatal"},CLEAR_IMMUTABLE_DEPLOYED:{code:"AX-TUI-041",title:"Cannot Clear A Deployment's Conversation",description:"A deployed agent owns its own session in the cloud \u2014 the TUI attaches to whatever session it is already running, so there is no fresh one to start from here. Use `:close` to detach, or clear it on a local instance of the same agent.",source:"tui",severity:"fatal"},OLLAMA_PULL_FAILED:{code:"AX-TUI-040",title:"Model Download Failed",description:"Ollama could not finish downloading the model. The name may not exist in the registry, or the transfer was interrupted \u2014 a retry resumes from whatever was already fetched.",source:"cli",severity:"fatal"},TEST_PRELOAD_MISSING:{code:"AX-TUI-036",title:"Test API Loaded Without Its Preload",description:"The instrumented test API was imported without the preload that installs it. Tests must run through `axon test`, which wires the preload.",source:"cli",severity:"fatal"},PROFILE_CONFIG_INVALID:{code:"AX-EXT-001",title:"profile.config.ts Did Not Call defineProfile()",description:"A profile's config must default-export defineProfile({ ... }). Without it there is no extension list to read, so nothing can be installed, enabled or disabled. The rest of the profile \u2014 main.ts and plugins/ \u2014 still loads.",source:"tui",severity:"fatal",expected:!0},PROFILE_CONFIG_FAILED:{code:"AX-EXT-002",title:"profile.config.ts Failed to Load",description:"The file threw while being evaluated, so its extension list could not be read and no extensions were loaded. The profile's own main.ts and plugins/ are unaffected \u2014 a typo in an extension list must not cost you the config you already had working.",source:"tui",severity:"degraded",expected:!0},EXTENSION_ENTRY_INVALID:{code:"AX-EXT-003",title:"Malformed Extension Entry",description:'An entry in profile.config.ts\'s `extensions` array is neither a string nor an object with a `source`. Accepted forms are "@scope/name" for a registry extension and "./extensions/name" for a local one.',source:"tui",severity:"degraded",expected:!0},EXTENSION_NOT_FOUND:{code:"AX-EXT-004",title:"Extension Not Found",description:"An extension listed in profile.config.ts is not on disk. A local path may have moved or been deleted; a registry name may never have been installed. Everything else in the list still loads.",source:"tui",severity:"degraded",expected:!0},EXTENSION_INSTALL_FAILED:{code:"AX-EXT-005",title:"Extension Install Failed",description:"A registry extension could not be fetched or prepared \u2014 most often no network, or a name that does not exist in the registry. It is skipped for this session and retried on the next launch.",source:"tui",severity:"degraded",expected:!0},EXTENSION_UNINSTALL_FAILED:{code:"AX-EXT-028",title:"Extension Uninstall Failed",description:"An extension could not be removed from profile.config.ts \u2014 most often the file is unreadable or has been edited into a shape the editor cannot find the extensions list in. The extension is still declared and will load on the next launch.",source:"tui",severity:"degraded",expected:!0},EXTENSION_NOT_AN_EXTENSION:{code:"AX-EXT-006",title:"Not an Extension",description:"The directory has no extension.config.ts, which is the file that marks a directory as an extension. A path pointing at an agent, a module, or an ordinary folder is not loadable as one.",source:"tui",severity:"degraded",expected:!0},EXTENSION_LOAD_FAILED:{code:"AX-EXT-007",title:"Extension Failed to Load",description:"An extension's main.ts threw while it was being loaded, so whatever it had not yet registered is missing. Its commands, keys and palettes are removed and the rest of your config loads normally.",source:"tui",severity:"degraded",expected:!0},PROFILE_MAIN_FAILED:{code:"AX-EXT-008",title:"main.ts Failed to Load",description:"Your profile's main.ts threw while being evaluated. Anything it registered before the error survives; everything after it did not run. Plugins and extensions still load.",source:"tui",severity:"degraded",expected:!0},PLUGIN_FAILED:{code:"AX-EXT-009",title:"Plugin Failed to Load",description:"A file in plugins/ threw while being imported, so its hooks were not registered. Other plugins in the same folder are unaffected \u2014 each file is loaded independently.",source:"tui",severity:"degraded",expected:!0},HOOK_FAILED:{code:"AX-EXT-010",title:"Lifecycle Hook Failed",description:"A tui.hook() handler threw while the event it listens for was firing. For a notification hook nothing else is affected; for a gating hook (tui:boot, tui:shutdown) the operation continues anyway rather than leaving the terminal stuck.",source:"tui",severity:"degraded",expected:!0},HOOK_TIMED_OUT:{code:"AX-EXT-011",title:"Hook Blocked Too Long",description:"A gating hook (tui:boot or tui:shutdown) did not finish within its budget, so the TUI continued without waiting. A config must never be able to hang the terminal silently \u2014 whatever the handler was doing may not have completed.",source:"tui",severity:"degraded",expected:!0},COMMAND_NOT_FOUND:{code:"AX-EXT-012",title:"No Such Command",description:"commands.run() was given a path that resolves to nothing in the command tree. The path must name a leaf, spelled exactly as it appears in the `:` palette.",source:"tui",severity:"fatal",expected:!0},PALETTE_NOT_FOUND:{code:"AX-EXT-013",title:"No Such Palette",description:"palette.open() was given a name no palette was registered under. Palettes are created with palette.create(name, ...) \u2014 a name is only openable once its registration has run.",source:"tui",severity:"fatal",expected:!0},PALETTE_NAME_TAKEN:{code:"AX-EXT-014",title:"Palette Name Already Registered",description:"Two palettes tried to claim the same name. Names are how palette.open() addresses one, so they have to be unique \u2014 silently replacing the first would make whichever loaded last win, invisibly.",source:"tui",severity:"degraded",expected:!0},PALETTE_ALREADY_OPEN:{code:"AX-EXT-015",title:"A Palette Is Already Open",description:"Something tried to open a palette, or ask a question, while the user was already navigating one. Stealing it mid-navigation would drop whatever they were doing, so the call fails instead \u2014 check palette.isOpen first.",source:"tui",severity:"degraded",expected:!0},KEY_CHORD_UNBOUND:{code:"AX-EXT-022",title:"No Such Key Binding",description:"keys.send() was given a chord nothing is bound to \u2014 neither a mode key nor a registered binding. Sending it would do nothing at all, which is indistinguishable from a binding that ran and had no effect.",source:"tui",severity:"fatal",expected:!0},AGENT_SPAWN_NO_INSTANCE:{code:"AX-EXT-023",title:"Agent Started but No Instance Appeared",description:"A spawn reported success without producing a focused instance, so there is no id to hand back. This is a fault in Axon rather than in your config \u2014 the agent may or may not be running.",source:"tui",severity:"fatal"},PROFILE_CONFIG_MISSING:{code:"AX-EXT-025",title:"No profile.config.ts",description:"The profile has no config file to record the extension in. It is normally created on first launch \u2014 starting Axon once will scaffold it.",source:"tui",severity:"fatal",expected:!0},PROFILE_CONFIG_UNEDITABLE:{code:"AX-EXT-026",title:"profile.config.ts Could Not Be Edited",description:"The `defineProfile({ ... })` call could not be located, or editing it would have produced invalid TypeScript. Nothing was written \u2014 this file is yours, and a botched edit costs your whole TUI config. Add or remove the entry by hand.",source:"tui",severity:"fatal",expected:!0},COMMAND_INVALID:{code:"AX-EXT-029",title:"Command Is Not Registerable",description:"A command was registered with no path, or with no `run` to call. Both are caught here rather than when someone presses Enter on it \u2014 a command that registers cleanly and then does nothing reads as a broken terminal instead of a config mistake, and gives no clue which file to open. Use `commands.register(path, fn)` or `commands.register(path, { run })`.",source:"tui",severity:"degraded",expected:!0},COMPONENT_NAME_TAKEN:{code:"AX-EXT-030",title:"Component Already Registered",description:"Two sources registered the same line component name. The first one loaded keeps it \u2014 your own config beats any extension. A silently shadowed component would render someone else's value under your name, so the second registration fails instead. Component names are `provider:name`; pick a prefix of your own.",source:"tui",severity:"degraded",expected:!0},COMPONENT_UNKNOWN:{code:"AX-EXT-031",title:"No Such Component",description:"A line named a component that is not registered. Caught when the line is created rather than when it paints, because a missing component renders as an empty gap \u2014 which reads as a layout bug instead of a typo, and gives no clue which name was wrong. components.list() returns everything available.",source:"tui",severity:"degraded",expected:!0},LINE_NAME_TAKEN:{code:"AX-EXT-032",title:"Line Already Registered",description:"Two sources registered the same line name. The first one loaded keeps it, the same rule commands and key chords follow.",source:"tui",severity:"degraded",expected:!0},LINE_UNKNOWN:{code:"AX-EXT-033",title:"No Such Line",description:"lines.set(), move(), show(), hide() or toggle() named a line that is not registered. Doing nothing would be indistinguishable from a line that registered and then rendered empty, so this fails instead. lines.list() returns what exists.",source:"tui",severity:"degraded",expected:!0},COMMAND_PATH_TAKEN:{code:"AX-EXT-020",title:"Command Already Registered",description:"Two sources registered the same command path. The first one loaded keeps it \u2014 your own config beats any extension, and between extensions the one listed earlier in profile.config.ts wins. Rename one of them.",source:"tui",severity:"degraded",expected:!0},KEY_CHORD_TAKEN:{code:"AX-EXT-021",title:"Key Chord Already Bound",description:"Two sources bound the same key chord. The first one loaded keeps it. A silently shadowed binding is unbearable to debug in someone else's config, so the second registration fails instead of replacing it.",source:"tui",severity:"degraded",expected:!0},MODE_KEY_TAKEN:{code:"AX-EXT-016",title:"Mode Key Already Bound",description:"A palette asked for a mode key that is already in use \u2014 either by a built-in mode or by another extension. A silently shadowed key is unbearable to debug in someone else's config, so the registration fails loudly instead.",source:"tui",severity:"degraded",expected:!0},MODE_UNKNOWN:{code:"AX-EXT-017",title:"No Such Mode",description:"mode.set() was given a name that is neither a built-in mode nor a registered palette. Doing nothing would look identical to a mode that simply does not render, so this fails instead.",source:"tui",severity:"fatal",expected:!0},NO_FOCUSED_AGENT:{code:"AX-EXT-018",title:"No Agent Focused",description:"A verb that acts on the focused agent \u2014 send, stop, reboot \u2014 was called while nothing was running. Start one with agents.spawn(name) or tui.nav(name) first.",source:"tui",severity:"fatal",expected:!0},INSTANCE_NOT_RUNNING:{code:"AX-EXT-019",title:"Instance Not Running",description:"An instance id was given for a conversation that is not live \u2014 it may already have been stopped, or it belongs to an earlier session. agents.list() returns what is currently running.",source:"tui",severity:"fatal",expected:!0},CONNECT_REJECTED:{code:"AX-EXT-020",title:"Connector Credential Rejected",description:"The platform refused the credential pasted during `:connect`. Verification runs before the value is written, so nothing was stored \u2014 the detail carries the platform's own reason, and the most common cause is copying the wrong secret from the developer portal.",source:"tui",severity:"fatal",expected:!0}};import{readFileSync as FQ8}from"fs";var AQ8=/at\s+(.*?)\s+\((.*?):(\d+):(\d+)\)/,jQ8=/at\s+(.*?):(\d+):(\d+)/,wQ8=["node_modules","native:","internal","bun:"],VI0=2;function H70(v0=1){let N0=Error().stack;if(!N0)return[];return N0.split(`
449
449
  `).slice(1+v0).map(GI0).filter(_I0).map(DI0)}function HI0(v0){return v0.split(`
450
450
  `).slice(1).map(GI0).filter(_I0).map(DI0)}function G70(v0){if(!v0)return null;return HI0(v0)[0]??null}function GI0(v0){let N0=v0.match(AQ8);if(N0){let[,P8,I8,KY,k1]=N0;return{functionName:P8??null,fileName:I8??null,lineNumber:Mn(KY),columnNumber:Mn(k1)}}let i0=v0.match(jQ8);if(i0){let[,P8,I8,KY]=i0;return{functionName:null,fileName:P8??null,lineNumber:Mn(I8),columnNumber:Mn(KY)}}return{functionName:null,fileName:null,lineNumber:null,columnNumber:null}}function Mn(v0){if(v0===void 0)return null;let N0=parseInt(v0,10);return Number.isNaN(N0)?null:N0}function _I0(v0){if(!v0.fileName)return!1;return!wQ8.some((N0)=>v0.fileName.includes(N0))}function DI0(v0){return{...v0,source:bQ8(v0.fileName,v0.lineNumber)}}function bQ8(v0,N0){if(!v0||N0===null)return null;let i0;try{i0=FQ8(v0,"utf-8")}catch{return null}let P8=i0.split(`
451
451
  `),I8=N0-1;if(I8<0||I8>=P8.length)return null;let KY=Math.max(0,I8-VI0),k1=Math.min(P8.length-1,I8+VI0),KK=[];for(let s9=KY;s9<=k1;s9++)KK.push({lineNumber:s9+1,text:P8[s9]??""});return KK}function BI0(v0){if(!v0.fileName||v0.lineNumber===null)return v0.functionName?`at ${v0.functionName}`:"at <unknown>";let N0=`${v0.fileName}:${v0.lineNumber}:${v0.columnNumber??0}`,i0=v0.functionName?`at ${v0.functionName} (${N0})`:`at ${N0}`,P8=v0.source?RQ8(v0.source,v0.lineNumber,v0.columnNumber):null;return P8?`${i0}