@inkeep/open-knowledge 0.57.2 → 0.57.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-harness-probe-CeLGZgZF.mjs → acp-harness-probe-CZSyRPim.mjs} +2 -2
- package/dist/cli.mjs +61 -61
- package/dist/constants-DDu-Neuo.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-D0Jw_Flt.mjs → init-Beh4YlsY.mjs} +11 -11
- package/dist/init-CS2K6kmO.mjs +1 -0
- package/dist/{launch-json-removal-D7S3TARA.mjs → launch-json-removal-WWA1e8-A.mjs} +2 -2
- package/dist/{loader-8jTgMHWn.mjs → loader-BT-NuJoH.mjs} +2 -2
- package/dist/loader-CjUVp1G3.mjs +1 -0
- package/dist/{open-browser-CXZADc20.mjs → open-browser-GXA2v45Q.mjs} +2 -2
- package/dist/preview-CLtBqyur.mjs +1 -0
- package/dist/{preview-CsOdYI9R.mjs → preview-DzmbRdvf.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-ZdWHpW9R.js → ActivityModeContent-DtoUWb1c.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-5R8mVOBa.js → AgentDiffPane-0NV8wGXH.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-ChxqWHn_.js → AgentThreadClientBinder-B7BMwPdk.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-Bt-PKLsp.js → CodeMirrorPropInput-DRIXyyO3.js} +1 -1
- package/dist/public/assets/{DocumentContext-B9iq4BNd.js → DocumentContext-BzOkOcsd.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-BE5bbSlA.js → EditorModeToggle-B_J4DJWs.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-beSVOz70.js → EnableSyncConfirmDialog-CFk3AHnv.js} +1 -1
- package/dist/public/assets/FeedbackForm-srcVmSOs.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-BUFsAYfq.js → ImportSkillDialog-DVl5vnNu.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-D1WYmiU_.js → LintConfigEditor-MWJgrpYU.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-DABZzygh.js → ManagedArtifactProperties-E_X-hSBL.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-WUogeRZ9.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-BvqLgtA3.js → MermaidDocEditor-CMojAadB.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-fGfvgDmi.js → PropertyDisplayRow-nYf3Nzvv.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-obDkIsd-.js → SchemaConfigEditor-COUOzPXp.js} +1 -1
- package/dist/public/assets/{SessionsHost-B1am5Max.js → SessionsHost-BgY2S9NG.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-XCtxwjDO.js → SettingsDialogBody-NFfs-Exd.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-l_zhdKTD.js → ShareReceiveMissDialog-CX3klyil.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-BIyNr3N5.js → SkillInstallMenu-CT53ITFp.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-BWpjUjn2.js → SkillToolbarControls-D3v2Hs4j.js} +1 -1
- package/dist/public/assets/{SourceEditor-Bz5v3S3i.js → SourceEditor-CN-TUPAh.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-DD8gJu95.js → TerminalWindowApp-BZemj599.js} +1 -1
- package/dist/public/assets/{TextDocEditor-CGA4IVxM.js → TextDocEditor-CbRGs1HT.js} +1 -1
- package/dist/public/assets/{ThreadView-xFlwNrph.js → ThreadView-BQPg9S8A.js} +8 -5
- package/dist/public/assets/{TimelineDiffPane-R_bywv7U.js → TimelineDiffPane-U-Xtvkw6.js} +1 -1
- package/dist/public/assets/{agent-diff-store-D7P2tv4j.js → agent-diff-store-iABbjLTR.js} +1 -1
- package/dist/public/assets/{auth-state-cache-Dmxci_Yi.js → auth-state-cache-ZDnOSM98.js} +1 -1
- package/dist/public/assets/{comment-chips-B8SZVYp5.js → comment-chips-DTsOTJH8.js} +1 -1
- package/dist/public/assets/{config-provider-DVTAY9Vz.js → config-provider-CFTiAtpH.js} +3 -3
- package/dist/public/assets/{follow-file-D0KRvizI.js → follow-file-BvKFjLSz.js} +1 -1
- package/dist/public/assets/i18n-B1dD_x6I.js +1 -0
- package/dist/public/assets/{index-CGCpZOtz.js → index-DAEjqhX2.js} +8 -8
- package/dist/public/assets/messages-31YqY4SS.js +1 -0
- package/dist/public/assets/messages-BVHIx_qK.js +1 -0
- package/dist/public/assets/messages-C7nddMWQ.js +1 -0
- package/dist/public/assets/{messages-Biy2FMnD.js → messages-CL4xikKQ.js} +1 -1
- package/dist/public/assets/messages-C_8WTeHE.js +1 -0
- package/dist/public/assets/{messages-H2nLj2X-.js → messages-CrwpWrRW.js} +1 -1
- package/dist/public/assets/messages-Cs6jyHNU.js +1 -0
- package/dist/public/assets/messages-D2XUrFhu.js +1 -0
- package/dist/public/assets/messages-DPWJimCT.js +1 -0
- package/dist/public/assets/messages-VnNooCHl.js +1 -0
- package/dist/public/assets/messages-e1iGNZ1R.js +1 -0
- package/dist/public/assets/messages-f9-p4BhX.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-CznOAcng.js → pending-receive-nav-store-CMgNWqay.js} +1 -1
- package/dist/public/assets/{selection-context-DVHitt8X.js → selection-context-BajeGoV5.js} +1 -1
- package/dist/public/assets/{skill-actions-Ciecrdl9.js → skill-actions-Dg0c2EFw.js} +1 -1
- package/dist/public/assets/{src-Bpz6hbcV.js → src-CJl_A7Op.js} +1 -1
- package/dist/public/assets/thread-client-CfT0-9Kx.js +1 -0
- package/dist/public/assets/{typing-burst-detector-DHCJpINv.js → typing-burst-detector-DBj9oKSQ.js} +1 -1
- package/dist/public/assets/{uninstall-BZMjlyAF.js → uninstall-Cvh4Iu4I.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DFk8Um2P.js → use-activity-panel-Bh3C3n8-.js} +1 -1
- package/dist/public/assets/{use-open-skill-NnqEgk0v.js → use-open-skill-C9ju-IL1.js} +1 -1
- package/dist/public/assets/{use-popular-skills-BZaA-ls7.js → use-popular-skills-DHiWi3V2.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-BuyfII4_.js → use-terminal-enabled-Dh008W1x.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-DQcSimR1.js → use-timeline-entry-diff-ooVH_oUf.js} +1 -1
- package/dist/public/index.html +21 -21
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-D-Y4IbdA.mjs → repair-launch-json-CnftZb4L.mjs} +2 -2
- package/dist/{repair-mcp-configs-BUTTfIPz.mjs → repair-mcp-configs-OWloa-0a.mjs} +2 -2
- package/dist/repair-skills-DkWeVK32.mjs +1 -0
- package/dist/{repair-skills-B1yLGVCl.mjs → repair-skills-QvrITfPH.mjs} +2 -2
- package/dist/{skill-teardown-CJl8M28h.mjs → skill-teardown-BCPQ2Dk-.mjs} +2 -2
- package/dist/src-CIybHNrk.mjs +20 -0
- package/dist/{src-C6s1YGEs.mjs → src-CxbTYUO_.mjs} +285 -285
- package/dist/src-QmetzQVN.mjs +1 -0
- package/dist/src-U-uNgNMB.mjs +1 -0
- package/dist/start-BtVE5Slm.mjs +1 -0
- package/dist/{start-Uw9UGGLL.mjs → start-LRnuRI-U.mjs} +4 -4
- package/dist/{ui-CSid4Ybi.mjs → ui-Cdqdpi6t.mjs} +3 -3
- package/dist/{write-project-skill-G2p_hc1u.mjs → write-project-skill-C8l8tRLv.mjs} +3 -3
- package/package.json +5 -5
- package/dist/constants-DMPdZA-V.mjs +0 -2
- package/dist/init-DrSFaNwj.mjs +0 -1
- package/dist/loader-BnfuGv9T.mjs +0 -1
- package/dist/preview-ld1lLiyk.mjs +0 -1
- package/dist/public/assets/FeedbackForm-DAMqh8_y.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-LYcjZ0-Q.js +0 -1
- package/dist/public/assets/i18n-xmPTRUdA.js +0 -1
- package/dist/public/assets/messages-2b0x7qJR.js +0 -1
- package/dist/public/assets/messages-4LHyoP9C.js +0 -1
- package/dist/public/assets/messages-95-nzhW9.js +0 -1
- package/dist/public/assets/messages-CfuqAa9t.js +0 -1
- package/dist/public/assets/messages-DLenzTlL.js +0 -1
- package/dist/public/assets/messages-DkLAKTWM.js +0 -1
- package/dist/public/assets/messages-DpELtdBZ.js +0 -1
- package/dist/public/assets/messages-L9EG6wMs.js +0 -1
- package/dist/public/assets/messages-Y1T6q4nq.js +0 -1
- package/dist/public/assets/messages-o6mVf0CQ.js +0 -1
- package/dist/public/assets/thread-client-B1jXINMp.js +0 -1
- package/dist/repair-skills-nLLLv3za.mjs +0 -1
- package/dist/src--C17TQmO.mjs +0 -1
- package/dist/src-BbuqzOpI.mjs +0 -20
- package/dist/src-CK1WyOz0.mjs +0 -1
- package/dist/start-CEKLyQNR.mjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./dist-DoS8xGN6.js";import{n as i}from"./dist-BLaUOTRG.js";var a=e(t(),1),o=n(),s=`ok-acp-agent-settings-v1`;function c(e){return`${e.source}:${e.id}`}function l(){try{let e=localStorage.getItem(s);if(e===null)return{};let t=JSON.parse(e);return typeof t==`object`&&t?t:{}}catch{return{}}}function u(e){try{localStorage.setItem(s,JSON.stringify(e))}catch(e){console.warn(`[acp-settings] could not persist agent settings`,e)}}function d(e,t,n){let r=l(),i=r[e]??{};r[e]={...i,config:{...i.config,[t]:n}},u(r)}function f(e){let t=l()[e]?.config;if(typeof t!=`object`||!t)return;let n={};for(let[e,r]of Object.entries(t))(typeof r==`string`||typeof r==`boolean`)&&(n[e]=r);return Object.keys(n).length>0?n:void 0}function p(e,t){if(t===``)return;let n=l();n[e]={...n[e]??{},modeId:t},u(n)}function m(e){let t=l()[e]?.modeId;return typeof t==`string`&&t!==``?t:void 0}var h=64e3;function g(e){if(typeof e!=`object`||!e)return null;let t=e;return t.type===`text`&&typeof t.text==`string`?t.text:null}function _(e){return e!==null&&(e.reason===`connect`||e.reason===`session-setup`||e.reason===`auth-required`)}var v=class{items=[];plan=[];turnActive=!1;tokenUsage=null;terminals={};toolCallIndex=new Map;permissionIndex=new Map;permissionByToolCall=new Map;permissionsByToolCall={};messageIndex=new Map;runtimeConsentIndex=new Map;lastConsentIndex=null;appliedCount=0;dirty=!1;snapshot={items:[],plan:[],turnActive:!1,tokenUsage:null,terminals:{},permissionsByToolCall:{}};sync(e){e.length<this.appliedCount&&this.reset();for(let t=this.appliedCount;t<e.length;t++)this.applyEvent(e[t]);return this.appliedCount=e.length,this.dirty&&=(this.snapshot={items:[...this.items],plan:this.plan,turnActive:this.turnActive,tokenUsage:this.tokenUsage,terminals:{...this.terminals},permissionsByToolCall:{...this.permissionsByToolCall}},!1),this.snapshot}reset(){this.items=[],this.plan=[],this.turnActive=!1,this.tokenUsage=null,this.terminals={},this.toolCallIndex=new Map,this.permissionIndex=new Map,this.permissionByToolCall=new Map,this.permissionsByToolCall={},this.messageIndex=new Map,this.runtimeConsentIndex=new Map,this.lastConsentIndex=null,this.appliedCount=0,this.dirty=!0}applyEvent(e){switch(this.dirty=!0,e.kind){case`user_message`:{let t={kind:`message`,role:`user`,text:e.content,messageId:`user-${this.items.length}`};e.attachments!==void 0&&e.attachments.length>0&&(t.attachments=e.attachments),this.items.push(t),this.messageIndex.clear();break}case`turn_started`:this.turnActive=!0;break;case`turn_ended`:this.turnActive=!1,this.messageIndex.clear();break;case`status`:if(e.status===`exited`&&(this.turnActive=!1),this.lastConsentIndex!==null){let t=this.items[this.lastConsentIndex];t?.kind===`runtime_consent`&&t.install===`running`&&(e.status===`spawning`||e.status===`ready`||e.status===`running`?this.items[this.lastConsentIndex]={...t,install:`done`}:(e.status===`error`||e.status===`exited`)&&(this.items[this.lastConsentIndex]={...t,install:`failed`}))}if(e.status===`ready`)for(let e=0;e<this.items.length;e+=1){let t=this.items[e];t?.kind===`notice`&&t.superseded!==!0&&_(t.failure)&&(this.items[e]={...t,superseded:!0})}(e.status===`error`||e.status===`auth_required`)&&(e.failure!==void 0||(e.detail??``)!==``)&&this.items.push({kind:`notice`,text:e.detail??``,tone:e.status===`error`?`error`:`info`,failure:e.failure??null});break;case`permission_request`:{let t=e.toolCall.toolCallId??null,n={kind:`permission`,requestId:e.requestId,title:e.toolCall.title??r._({id:`Ya3PlJ`}),toolKind:e.toolCall.kind??`other`,options:e.options,resolved:null,toolCallId:t,mergedIntoToolCall:t!==null&&this.toolCallIndex.has(t)};this.permissionIndex.set(e.requestId,this.items.length),t!==null&&(this.permissionByToolCall.set(t,this.items.length),this.permissionsByToolCall[t]=n),this.items.push(n);break}case`permission_resolved`:{let t=this.permissionIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`permission`)break;let r={...n,resolved:{optionId:e.optionId,auto:e.auto}};this.items[t]=r,r.toolCallId!==null&&(this.permissionsByToolCall[r.toolCallId]=r);break}case`runtime_consent_request`:this.runtimeConsentIndex.set(e.requestId,this.items.length),this.lastConsentIndex=this.items.length,this.items.push({kind:`runtime_consent`,requestId:e.requestId,runtime:e.runtime,displayName:e.displayName,provides:e.provides,version:e.version,approxSizeMB:e.approxSizeMB,sourceHost:e.sourceHost,agentName:e.agentName,reason:e.reason??`missing`,resolved:null,install:null,progress:null});break;case`runtime_consent_resolved`:{let t=this.runtimeConsentIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`runtime_consent`)break;this.items[t]={...n,resolved:e.decision,install:e.decision===`granted`?`running`:null};break}case`runtime_install_progress`:{if(this.lastConsentIndex===null)break;let t=this.items[this.lastConsentIndex];if(t===void 0||t.kind!==`runtime_consent`)break;this.items[this.lastConsentIndex]={...t,progress:{receivedBytes:e.receivedBytes??0,totalBytes:e.totalBytes??null}};break}case`terminal_created`:this.terminals[e.terminalId]={terminalId:e.terminalId,command:e.command,args:e.args,output:``,truncated:!1,exit:null};break;case`terminal_output`:{let t=this.terminals[e.terminalId];if(t===void 0)break;let n=t.output+e.chunk,r=t.truncated;n.length>h&&(n=n.slice(-h),r=!0),this.terminals[e.terminalId]={...t,output:n,truncated:r};break}case`terminal_exit`:{let t=this.terminals[e.terminalId];if(t===void 0)break;this.terminals[e.terminalId]={...t,exit:{exitCode:e.exitCode,signal:e.signal}};break}case`session_update`:this.applyUpdate(e.update);break;default:break}}mergePermissionInto(e){let t=this.permissionByToolCall.get(e);if(t===void 0)return;let n=this.items[t];if(n===void 0||n.kind!==`permission`||n.mergedIntoToolCall)return;let r={...n,mergedIntoToolCall:!0};this.items[t]=r,this.permissionsByToolCall[e]=r}pushMessageChunk(e,t,n){let r=`${e}:${t}`,i=this.messageIndex.get(r);if(i!==void 0&&i===this.items.length-1){let e=this.items[i];this.items[i]={...e,text:e.text+n};return}this.messageIndex.set(r,this.items.length),this.items.push({kind:`message`,role:e,text:n,messageId:t})}applyUpdate(e){switch(e.sessionUpdate){case`agent_message_chunk`:{let t=g(e.content);t!==null&&this.pushMessageChunk(`agent`,b(e),t);break}case`agent_thought_chunk`:{let t=g(e.content);t!==null&&this.pushMessageChunk(`thought`,b(e),t);break}case`user_message_chunk`:{let t=g(e.content);t!==null&&this.pushMessageChunk(`user`,b(e),t);break}case`tool_call`:{let t={kind:`tool_call`,toolCallId:e.toolCallId,title:e.title??r._({id:`EvIJVD`}),toolKind:e.kind??`other`,status:e.status??`pending`,diffs:[],terminalIds:[],content:[],locations:x(e.locations),rawInput:e.rawInput};S(t,e.content),this.toolCallIndex.set(e.toolCallId,this.items.length),this.items.push(t),this.mergePermissionInto(e.toolCallId);break}case`tool_call_update`:{let t=this.toolCallIndex.get(e.toolCallId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`tool_call`)break;let r={...n,diffs:[...n.diffs],terminalIds:[...n.terminalIds],content:[...n.content]};e.status&&(r.status=e.status),e.title&&(r.title=e.title),e.locations&&(r.locations=x(e.locations));let i=e.rawInput;i!==void 0&&(r.rawInput=i),S(r,e.content),this.items[t]=r;break}case`plan`:{let t=e.entries;Array.isArray(t)&&(this.plan=t.map(e=>e).filter(e=>typeof e.content==`string`).map(e=>({content:e.content,priority:typeof e.priority==`string`?e.priority:void 0,status:typeof e.status==`string`?e.status:void 0})));break}case`usage_update`:{let t=e;this.tokenUsage={used:typeof t.used==`number`?t.used:void 0,size:typeof t.size==`number`?t.size:void 0};break}default:{let t=e.usage;t!==void 0&&(this.tokenUsage={used:t.used,size:t.size});break}}}};function y(e){let t=e.resolved;if(t===null)return null;if(t.optionId===null)return t.auto?{kind:`dismissed`}:{kind:`denied`,auto:!1,optionName:null};let n=e.options.find(e=>e.optionId===t.optionId);if(n===void 0)return{kind:`dismissed`};let r=n.kind.startsWith(`reject`),i=n.kind.startsWith(`allow`);return!r&&!i?{kind:`dismissed`}:{kind:r?`denied`:`approved`,auto:t.auto,optionName:n.name}}function b(e){let t=e.messageId;return typeof t==`string`?t:`default`}function x(e){return Array.isArray(e)?e.map(e=>e).filter(e=>typeof e.path==`string`).map(e=>({path:e.path,line:typeof e.line==`number`?e.line:void 0})):[]}function S(e,t){if(Array.isArray(t))for(let n of t){let t=n;if(t.type===`diff`&&typeof t.path==`string`&&typeof t.newText==`string`)e.diffs.push({path:t.path,oldText:typeof t.oldText==`string`?t.oldText:null,newText:t.newText});else if(t.type===`terminal`&&typeof t.terminalId==`string`)e.terminalIds.includes(t.terminalId)||e.terminalIds.push(t.terminalId);else if(t.type===`content`){let n=g(t.content);n!==null&&e.content.push(n)}else{let n=g(t);n!==null&&e.content.push(n)}}}var C=500,w=15e3,T=3e4,E=9e4,D=9e4,O=18e4,k=8e3,A=1e4,j=class extends Error{code;constructor(e,t){super(t),this.name=`ThreadResumeError`,this.code=e}},M=class extends Error{constructor(){super(`agent-thread channel is not connected`),this.name=`ThreadChannelUnavailableError`}},N=class{url=null;ws=null;reconnectDelay=C;reconnectTimer=null;threads=new Map;listeners=new Set;pendingCreates=new Map;pendingResumes=new Map;pendingRetries=new Map;pendingAuths=new Map;pendingQueueEdits=new Map;openedArchived=new Set;reqCounter=0;status=`idle`;version=0;setUrl(e){e!==this.url&&(this.url=e,this.teardownSocket(),e===null?this.setStatus(`idle`):this.connect())}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));threadsSnapshot=[];threadsSnapshotVersion=-1;getThreads=()=>(this.threadsSnapshotVersion!==this.version&&(this.threadsSnapshot=[...this.threads.values()].map(e=>e.info).sort((e,t)=>e.createdAt-t.createdAt),this.threadsSnapshotVersion=this.version),this.threadsSnapshot);openTabsSnapshot=[];openTabsSnapshotVersion=-1;getOpenTabs=()=>(this.openTabsSnapshotVersion!==this.version&&(this.openTabsSnapshot=[...this.threads.values()].map(e=>e.info).filter(e=>e.archived!==!0||this.openedArchived.has(e.threadId)).sort((e,t)=>e.createdAt-t.createdAt),this.openTabsSnapshotVersion=this.version),this.openTabsSnapshot);archivedSnapshot=[];archivedSnapshotVersion=-1;getArchivedThreads=()=>(this.archivedSnapshotVersion!==this.version&&(this.archivedSnapshot=[...this.threads.values()].map(e=>e.info).filter(e=>e.archived===!0).sort((e,t)=>t.lastActivityAt-e.lastActivityAt),this.archivedSnapshotVersion=this.version),this.archivedSnapshot);getThread=e=>this.threads.get(e)??null;modelBuilders=new Map;getThreadModel=e=>{let t=this.threads.get(e);if(t===void 0)return null;let n=this.modelBuilders.get(e);return n===void 0&&(n=new v,this.modelBuilders.set(e,n)),n.sync(t.events)};getConnectionStatus=()=>this.status;async createThread(e){this.connectNow(),await this.waitForOpen(k),this.reqCounter+=1;let t=`create-${this.reqCounter}`,n=new Promise((e,n)=>{let r=setTimeout(()=>{this.pendingCreates.delete(t),n(Error(`thread creation timed out`))},T);this.pendingCreates.set(t,{resolve:e,reject:n,timer:r})}),r=c(e.agent),i=f(r),a=m(r),o=i!==void 0||a!==void 0?{...i===void 0?{}:{config:i},...a===void 0?{}:{modeId:a}}:void 0;return this.send({op:`create`,reqId:t,...e,...o===void 0?{}:{settings:o}}),n}prompt(e,t,n){let r=t.trim(),i=n!==void 0&&n.length>0;r===``&&!i||(this.reqCounter+=1,this.send({op:`prompt`,threadId:e,reqId:`prompt-${this.reqCounter}`,content:r,...i?{attachments:n}:{}}))}steer(e,t,n){let r=t.trim(),i=n!==void 0&&n.length>0;r===``&&!i||(this.reqCounter+=1,this.send({op:`steer`,threadId:e,reqId:`steer-${this.reqCounter}`,content:r,...i?{attachments:n}:{}}))}editQueued(e,t,n){let r=n.trim();if(r===``)return Promise.resolve();this.reqCounter+=1;let i=`queue-edit-${this.reqCounter}`,a=new Promise((e,t)=>{let n=setTimeout(()=>{this.pendingQueueEdits.delete(i),e()},A);this.pendingQueueEdits.set(i,{resolve:e,reject:t,timer:n})});return this.send({op:`queue_edit`,threadId:e,id:t,content:r,reqId:i}),a}holdQueued(e,t,n){this.send({op:`queue_hold`,threadId:e,id:t,held:n})}removeQueued(e,t){this.send({op:`queue_remove`,threadId:e,id:t})}respondPermission(e,t,n){this.send({op:`permission_response`,threadId:e,requestId:t,outcome:n})}respondRuntimeConsent(e,t,n){this.send({op:`runtime_consent_response`,threadId:e,requestId:t,outcome:n})}cancel(e){this.send({op:`cancel`,threadId:e})}setMode(e,t){this.send({op:`set_mode`,threadId:e,modeId:t})}renameThread(e,t){let n=t.trim();n!==``&&this.send({op:`rename`,threadId:e,title:n})}setConfigOption(e,t,n){this.send({op:`set_config_option`,threadId:e,configId:t,value:n})}closeThread(e){let t=this.threads.get(e);if(t?.info.archived===!0){this.send({op:`unsubscribe`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.set(e,{info:t.info,events:[],lastSeq:-1}),this.bump();return}this.send({op:`close`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.delete(e)&&this.bump()}openArchivedThread(e){let t=this.threads.get(e);t===void 0||t.info.archived!==!0||this.openedArchived.has(e)||(this.openedArchived.add(e),this.send({op:`subscribe`,threadId:e,sinceSeq:t.lastSeq+1}),this.bump())}deleteThread(e){this.send({op:`delete`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.delete(e)&&this.bump()}async resumeThread(e,t,n){this.connectNow(),await this.waitForOpen(k),this.reqCounter+=1;let r=`resume-${this.reqCounter}`,i=new Promise((e,t)=>{let n=setTimeout(()=>{this.pendingResumes.delete(r),t(new j(`timeout`,`resume timed out`))},E);this.pendingResumes.set(r,{resolve:e,reject:t,timer:n})});return this.send({op:`resume`,threadId:e,reqId:r,prompt:t,...n!==void 0&&n.length>0?{attachments:n}:{}}),i}async retryThread(e){this.connectNow(),await this.waitForOpen(k),this.reqCounter+=1;let t=`retry-${this.reqCounter}`,n=new Promise((e,n)=>{let r=setTimeout(()=>{this.pendingRetries.delete(t),n(Error(`retry timed out`))},D);this.pendingRetries.set(t,{resolve:e,reject:n,timer:r})});return this.send({op:`retry`,threadId:e,reqId:t}),n}async authenticateThread(e,t){this.connectNow(),await this.waitForOpen(k),this.reqCounter+=1;let n=`authenticate-${this.reqCounter}`,r=new Promise((e,t)=>{let r=setTimeout(()=>{this.pendingAuths.delete(n),t(Error(`sign-in timed out`))},O);this.pendingAuths.set(n,{resolve:e,reject:t,timer:r})});return this.send({op:`authenticate`,threadId:e,reqId:n,methodId:t}),r}connectNow(){this.url===null||this.ws!==null||(this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectDelay=C,this.connect())}waitForOpen(e){return this.ws!==null&&this.ws.readyState===WebSocket.OPEN?Promise.resolve():new Promise((t,n)=>{let r=e=>{clearTimeout(a),i(),e?t():n(new M)},i=this.subscribe(()=>{this.ws!==null&&this.ws.readyState===WebSocket.OPEN&&r(!0)}),a=setTimeout(()=>r(!1),e)})}connect(){if(this.url===null)return;this.setStatus(`connecting`);let e;try{e=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=e,e.onopen=()=>{if(this.ws===e){this.reconnectDelay=C,this.setStatus(`open`),this.send({op:`list`});for(let[e,t]of this.threads)t.info.archived===!0&&!this.openedArchived.has(e)||this.send({op:`subscribe`,threadId:e,sinceSeq:t.lastSeq+1})}},e.onmessage=t=>{if(this.ws!==e||typeof t.data!=`string`)return;let n;try{n=JSON.parse(t.data)}catch{return}this.handleFrame(n)},e.onclose=()=>{this.ws===e&&(this.ws=null,this.setStatus(`closed`),this.scheduleReconnect())},e.onerror=()=>{}}teardownSocket(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);for(let e of this.pendingCreates.values())clearTimeout(e.timer),e.reject(new M);this.pendingCreates.clear();for(let e of this.pendingResumes.values())clearTimeout(e.timer),e.reject(new M);this.pendingResumes.clear();for(let e of this.pendingRetries.values())clearTimeout(e.timer),e.reject(new M);this.pendingRetries.clear();for(let e of this.pendingAuths.values())clearTimeout(e.timer),e.reject(new M);this.pendingAuths.clear();for(let e of this.pendingQueueEdits.values())clearTimeout(e.timer),e.resolve();this.pendingQueueEdits.clear();let e=this.ws;if(this.ws=null,e!==null)try{e.close()}catch{}}scheduleReconnect(){if(this.url===null||this.reconnectTimer!==null)return;let e=this.reconnectDelay;this.reconnectDelay=Math.min(this.reconnectDelay*2,w),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}send(e){let t=this.ws;if(!(t===null||t.readyState!==WebSocket.OPEN))try{t.send(JSON.stringify(e))}catch{}}handleFrame(e){switch(e.op){case`created`:{let t=this.pendingCreates.get(e.reqId);t!==void 0&&(this.pendingCreates.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`threads`:{let t=new Set;for(let n of e.threads){t.add(n.threadId);let e=this.threads.has(n.threadId);this.upsertInfo(n),!e&&n.archived!==!0&&this.send({op:`subscribe`,threadId:n.threadId,sinceSeq:0})}let n=!1;for(let e of Array.from(this.threads.keys()))t.has(e)||(this.threads.delete(e),this.modelBuilders.delete(e),this.openedArchived.delete(e),n=!0);n&&this.bump();return}case`resumed`:{let t=this.pendingResumes.get(e.reqId);t!==void 0&&(this.pendingResumes.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`retried`:{let t=this.pendingRetries.get(e.reqId);t!==void 0&&(this.pendingRetries.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`authenticated`:{let t=this.pendingAuths.get(e.reqId);t!==void 0&&(this.pendingAuths.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`subscribed`:this.upsertInfo(e.info);return;case`queue_edited`:{let t=this.pendingQueueEdits.get(e.reqId);t!==void 0&&(this.pendingQueueEdits.delete(e.reqId),clearTimeout(t.timer),t.resolve());return}case`info`:this.upsertInfo(e.info);return;case`event`:this.appendEvents(e.threadId,e.seq,[e.event]);return;case`events`:this.appendEvents(e.threadId,e.fromSeq,e.events);return;case`error`:if(e.reqId!==void 0){let t=this.pendingCreates.get(e.reqId);if(t!==void 0){this.pendingCreates.delete(e.reqId),clearTimeout(t.timer),t.reject(Error(e.message));return}let n=this.pendingResumes.get(e.reqId);if(n!==void 0){this.pendingResumes.delete(e.reqId),clearTimeout(n.timer),n.reject(new j(e.code,e.message));return}let a=this.pendingRetries.get(e.reqId);if(a!==void 0){this.pendingRetries.delete(e.reqId),clearTimeout(a.timer),a.reject(Error(e.message));return}let o=this.pendingAuths.get(e.reqId);if(o!==void 0){this.pendingAuths.delete(e.reqId),clearTimeout(o.timer),o.reject(Error(e.message));return}let s=this.pendingQueueEdits.get(e.reqId);if(s!==void 0){this.pendingQueueEdits.delete(e.reqId),clearTimeout(s.timer),s.reject(Error(e.message));return}if(e.reqId.startsWith(`prompt-`)||e.reqId.startsWith(`steer-`)){i.error(r._({id:`XNBGZw`,values:{0:e.message}}));return}}console.warn(`[agent-threads] server error frame:`,e.code,e.message);return;default:return}}appendEvents(e,t,n){let r=this.threads.get(e);if(r===void 0||n.length===0)return;let i=Math.max(r.lastSeq+1-t,0);if(i>=n.length)return;let a=i===0?n:n.slice(i),o=r.info;for(let e of a)o=P(o,e);this.threads.set(e,{info:o,events:[...r.events,...a],lastSeq:t+n.length-1}),this.bump()}upsertInfo(e){let t=this.threads.get(e.threadId);t===void 0?this.threads.set(e.threadId,{info:e,events:[],lastSeq:-1}):e.archived===!0&&t.info.archived!==!0?(this.openedArchived.delete(e.threadId),this.modelBuilders.delete(e.threadId),this.threads.set(e.threadId,{info:e,events:[],lastSeq:-1})):this.threads.set(e.threadId,{...t,info:e}),this.bump()}setStatus(e){this.status!==e&&(this.status=e,this.bump())}bump(){this.version+=1;for(let e of this.listeners)e()}};function P(e,t){switch(t.kind){case`status`:return{...e,status:t.status,lastActivityAt:t.ts};case`title_changed`:return{...e,title:t.title,lastActivityAt:t.ts};default:return{...e,lastActivityAt:t.ts}}}var F=new N;function I(){return F}function L(){return(0,a.useSyncExternalStore)(F.subscribe,F.getOpenTabs,F.getOpenTabs)}function R(){return(0,a.useSyncExternalStore)(F.subscribe,F.getArchivedThreads,F.getArchivedThreads)}function z(e){let t=(0,o.c)(2),n;t[0]===e?n=t[1]:(n=()=>F.getThread(e),t[0]=e,t[1]=n);let r=n;return(0,a.useSyncExternalStore)(F.subscribe,r,r)}function B(e){let t=(0,o.c)(2),n;t[0]===e?n=t[1]:(n=()=>F.getThreadModel(e),t[0]=e,t[1]=n);let r=n;return(0,a.useSyncExternalStore)(F.subscribe,r,r)}function V(){return(0,a.useSyncExternalStore)(F.subscribe,F.getConnectionStatus,F.getConnectionStatus)}function H(e){if(e===null)return null;try{let t=new URL(e);return t.pathname=`/collab/thread`,t.search=``,t.toString()}catch{return null}}export{z as a,R as c,c as d,d as f,H as i,L as l,j as n,V as o,p,I as r,B as s,M as t,y as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./repair-skills-B1yLGVCl.mjs";export{e as repairSkills};
|
package/dist/src--C17TQmO.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{B as e,Ns as t,Us as n,W as r,ds as i,g as a,hs as o,js as s,ms as c,v as l,yc as u}from"./src-DMi2O7yV.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,Ar as y,At as b,B as x,Bi as S,Bn as C,Bt as w,C as T,Ca as E,Ci as D,Cn as O,Cr as k,Ct as A,D as j,Di as M,Dn as N,Dr as P,Dt as F,E as I,Ei as L,En as R,Er as z,Et as B,F as V,Fi as H,Fn as U,Fr as W,Ft as G,G as K,Gi as q,Gn as J,Gr as Y,Gt as X,H as Z,Hi as Q,Hn as $,Hr as ee,Ht as te,I as ne,Ii as re,In as ie,It as ae,J as oe,Ji as se,Jn as ce,Jr as le,Jt as ue,K as de,Ki as fe,Kn as pe,Kr as me,Kt as he,L as ge,Li as _e,Ln as ve,Lt as ye,M as be,Mi as xe,Mn as Se,Mr as Ce,Mt as we,N as Te,Ni as Ee,Nn as De,Nr as Oe,Nt as ke,O as Ae,Oi as je,On as Me,Or as Ne,Ot as Pe,P as Fe,Pi as Ie,Pn as Le,Pr as Re,Pt as ze,Q as Be,Qi as Ve,Qn as He,Qr as Ue,Qt as We,R as Ge,Ri as Ke,Rn as qe,Rt as Je,S as Ye,Sa as Xe,Si as Ze,Sn as Qe,Sr as $e,St as et,T as tt,Ti as nt,Tn as rt,Tr as it,Tt as at,U as ot,Ui as st,Un as ct,Ur as lt,Ut as ut,V as dt,Vi as ft,Vn as pt,Vr as mt,Vt as ht,W as gt,Wi as _t,Wn as vt,Wr as yt,Wt as bt,X as xt,Xi as St,Xn as Ct,Xr as wt,Xt as Tt,Y as Et,Yi as Dt,Yn as Ot,Yr as kt,Yt as At,Z as jt,Zi as Mt,Zn as Nt,Zr as Pt,Zt as Ft,_ as It,_a as Lt,_i as Rt,_n as zt,_r as Bt,_t as Vt,a as Ht,aa as Ut,ai as Wt,an as Gt,ar as Kt,at as qt,b as Jt,ba as Yt,bi as Xt,bn as Zt,br as Qt,bt as $t,c as en,ca as tn,ci as nn,cn as rn,cr as an,d as on,da as sn,di as cn,dn as ln,dr as un,ea as dn,ei as fn,en as pn,er as mn,et as hn,f as gn,fa as _n,fi as vn,fn as yn,fr as bn,g as xn,ga as Sn,gi as Cn,gn as wn,gr as Tn,gt as En,h as Dn,ha as On,hi as kn,hn as An,hr as jn,ht as Mn,i as Nn,ia as Pn,ii as Fn,in as In,ir as Ln,it as Rn,j as zn,ji as Bn,jn as Vn,jr as Hn,jt as Un,k as Wn,ki as Gn,kn as Kn,kr as qn,kt as Jn,l as Yn,la as Xn,li as Zn,ln as Qn,lr as $n,m as er,ma as tr,mi as nr,mn as rr,mr as ir,mt as ar,n as or,na as sr,ni as cr,nn as lr,nr as ur,nt as dr,o as fr,oa as pr,oi as mr,on as hr,or as gr,ot as _r,p as vr,pa as yr,pi as br,pn as xr,pr as Sr,q as Cr,qi as wr,qn as Tr,qr as Er,qt as Dr,r as Or,ra as kr,ri as Ar,rn as jr,rr as Mr,rt as Nr,s as Pr,sa as Fr,si as Ir,sn as Lr,sr as Rr,st as zr,t as Br,ta as Vr,ti as Hr,tn as Ur,tr as Wr,tt as Gr,u as Kr,ua as qr,ui as Jr,un as Yr,ur as Xr,v as Zr,va as Qr,vi as $r,vn as ei,vr as ti,vt as ni,w as ri,wi as ii,wn as ai,wr as oi,wt as si,x as ci,xa as li,xn as ui,xr as di,xt as fi,y as pi,ya as mi,yi as hi,yn as gi,yr as _i,yt as vi,z as yi,zi as bi,zn as xi,zt as Si}from"./src-C6s1YGEs.mjs";import{C as Ci,E as wi,T as Ti,_ as Ei,b as Di,c as Oi,d as ki,g as Ai,i as ji,l as Mi,m as Ni,n as Pi,p as Fi,s as Ii,t as Li,u as Ri,v as zi,w as Bi,x as Vi,y as Hi}from"./fs-traced-xJfl5Rxd.mjs";import{a as Ui,d as Wi,f as Gi,i as Ki,l as qi,n as Ji,r as Yi,t as Xi,u as Zi}from"./logger-DFxEUjvj.mjs";import{C as Qi,S as $i,_ as ea,a as ta,c as na,d as ra,g as ia,h as aa,i as oa,l as sa,m as ca,n as la,o as ua,p as da,r as fa,s as pa,t as ma,u as ha,v as ga,y as _a}from"./server-lock-BHY1C3dW.mjs";export{tr as AGENT_ID_MAX_LEN,On as AGENT_ID_RE,_ as AGENT_WRITE_ORIGIN,li as AcpPermissionStore,Qr as AcpRegistry,nt as AcpThreadManager,D as AgentFocusBroadcaster,Ze as AgentPresenceBroadcaster,Bn as AgentSessionCapacityError,xe as AgentSessionManager,Mn as AutoStartDisabledError,di as BUNDLE_IDS,$e as BUNDLE_SCOPE,k as BUNDLE_SKILL_NAME,Wr as BacklinkIndex,Q as CC1Broadcaster,t as CC1_CONTRACT_VERSION,An as CONFIG_FILENAME,Ot as CONFLICT_MARKER_RE,lt as CURSOR_BUNDLE_PATHS_BY_PLATFORM,It as ConfigSchema,se as DEFAULT_CHECKPOINT_RETENTION,nn as DEFAULT_EMBEDDINGS_DIMENSIONS,w as DEFAULT_PACK_ID,dt as DocumentDurabilityState,Zn as EMBEDDINGS_API_KEY_ENV,O as ExposureConsentError,mi as FEATURED_AGENT_IDS,Dt as FILE_SYSTEM_WRITER,p as FILE_WATCHER_ORIGIN,cr as FileEmbeddingsBackend,lr as GIT_PREFLIGHT_FAIL_SPAN_NAME,St as GIT_UPSTREAM_WRITER,Xe as GitDirAccessError,In as GitNotAvailableError,Gt as GitTooOldError,En as HOCUSPOCUS_AUTH_REJECTION_REASONS,Vt as HocuspocusAuthRejection,ni as HocuspocusAuthTokenSchema,kt as INSTALLED_AGENTS_SCHEMES,s as LINEAGE_EPOCH_KEY,Ge as LIVE_DERIVED_INDEX_DEBOUNCE_MS,ht as LOG_MD_TEMPLATE,at as MANAGED_RENAME_ORIGIN,L as MAX_ACP_THREADS,Ee as MAX_AGENT_SESSIONS,je as MCP_CONNECTION_ID_HEADER,i as MCP_SERVER_NAME,Ie as MIN_EVICTABLE_IDLE_MS,hr as MIN_GIT_VERSION,Z as MISSING_OK_CONFIG_MESSAGE,E as MalformedGitPointerError,hn as McpLogger,ot as MissingOkConfigError,re as OBSERVER_SYNC_ORIGIN,wn as OK_OKIGNORE_TEMPLATE,c as ORPHAN_MODES,u as PROTOCOL_VERSION,Xi as PinoLogger,na as ProcessLockCollisionError,Yn as ProjectGitInitError,B as ROLLBACK_ORIGIN,zt as ROOT_GITIGNORE_TEMPLATE,ea as RUNTIME_VERSION,Mt as SERVICE_WRITER,Tn as SKILL_INSTALL_EVENTS_FILE_REL,e as SKILL_STATE_TARGETS,te as STARTER_FOLDERS,ut as STARTER_FOLDER_FRONTMATTER_FILENAME,bt as STARTER_PACKS,X as STARTER_PACK_IDS,he as STARTER_TEMPLATES,tt as STATE_MANIFEST_FILENAME,ga as STATE_SCHEMA_VERSION,n as SYSTEM_DOC_NAME,We as SeedPrerequisiteError,h as SeedRootDirError,ma as ServerLockCollisionError,Br as SingleFileNotAFileError,or as SingleFileNotFoundError,Or as SingleFileNotMarkdownError,I as StateManifestError,mn as TagIndex,oi as USER_GLOBAL_BUNDLE_IDS,we as UiLockCollisionError,F as __getShowAllWalkStatsForTesting,Pe as __resetShowAllWalkStatsForTesting,sa as acquireProcessLock,la as acquireServerLock,ke as acquireUiLock,H as applyAgentMarkdownWrite,Tr as applyExternalChange,Si as applySeed,j as assertCompatibleStateManifest,Lr as assertGitAvailable,U as assertNeverDiskEvent,ii as attachAcpThreadSocket,ar as attachIdleShutdown,Zr as bootServer,Mr as buildAndOpenSkill,ei as buildConfigYmlContent,Et as buildExecResult,ai as buildIngressPolicy,M as buildOkMcpStdioCommand,ti as buildSkillZip,Dr as buildStarterFolderFrontmatterYaml,Ve as buildWipTree,it as bundleSkillMdPath,Ar as canonicalProjectKey,ie as classifyEvents,Li as classifyFsPath,Fn as clearAllEmbeddingsKeys,cn as clearContributors,ue as coercePackId,a as colorFromSeed,f as commitUpstreamImport,dn as commitWip,Vr as commitWipFromTree,rn as compareSemver,Ne as composeEffectiveLinterConfig,qn as composeFrontmatterSchemasConfig,Ct as containsConflictMarkers,ve as contentHash,vn as contributorCount,Fe as countShadowObjects,V as countStaleAgentWipRefs,ne as countWipRefs,Jn as createApiExtension,si as createAssetServeMiddleware,K as createCollaborationHost,mt as createContentFilter,ee as createContentFilterAsync,Wt as createEmbeddingsSecretStore,Nn as createEphemeralProjectDir,ce as createExternalChangeHandler,gn as createFileLogger,yi as createLiveDerivedIndexExtension,Cr as createMcpHttpHandler,wt as createOsProbe,Te as createPersistenceExtension,T as createServer,zn as createServerObserverExtension,bi as createStreamingErrorWriter,Ji as createTestLogger,mr as describeStoredEmbeddingsKey,xn as detectClaudeDesktopPresence,Qn as detectGit,Ae as detectProjectShape,Ln as detectUserSkillHosts,Nr as discoverLockDirs,Ce as discoverMarkdownlintConfig,jr as emitPreflightFailureSpan,xt as encodeDocName,jt as encodeFolderRoute,Be as encodeSkillRoute,Kr as ensureProjectGit,gi as ensureProjectSkillGitignore,S as errorResponse,qe as evictStaleTrackerEntries,b as extractHeadings,Rn as extractOkBinaryPath,ur as extractWikiLinksFromMarkdown,Yr as fallbackPaths,on as findEnclosingGitRoot,De as findEnclosingProjectRoot,Oe as findNativeMarkdownlintFile,vr as flushFileLogger,vi as formatAuthRejectionWire,br as formatContributors,nr as formatContributorsFrom,ye as formatPackRationale,sr as gcCheckpointRefs,Gr as getCurrentMcpLogger,rt as getIngressContext,$r as getLocalDir,er as getLogFilePath,Yi as getLogger,Dn as getLogsDir,_a as getMachineId,Hi as getMeter,Xn as getMetrics,Di as getTracer,qr as handleCollabSocketError,yt as handleSpawnCursor,R as hasForwardingHeaders,ge as hasGcLogLatch,l as iconFromClientName,sn as incrementCollabSocketFilteredError,_n as incrementServerObserverFire,Zt as initContent,kr as initShadowRepo,Vi as initTelemetry,Jt as initToleranceTelemetryWriter,zr as installPrettyZodErrors,Ki as installTestLoggers,Kt as installUserSkill,Se as isAllowedApiOrigin,v as isAllowedWorkspaceHostHeader,st as isConfigDoc,$t as isHocuspocusAuthRejectionReason,N as isHostAdmitted,At as isKnownPackId,_t as isLinkIndexExcludedDoc,Vn as isLoopbackAddress,q as isManagedArtifactDoc,Me as isOriginAdmitted,o as isOrphanMode,_e as isPairedWriteOrigin,Y as isPathWithinDir,Kn as isPeerAdmitted,$i as isProcessAlive,Le as isProjectRoot,fe as isReservedForUserTree,xi as isSelfWrite,wr as isSystemDoc,ci as isToleranceTelemetryEnabled,Qi as isValidLockPid,C as lastKnownHash,Pn as listRescueCheckpoints,Tt as listStarterPacks,Yt as loadCustomAgents,be as loadPrincipal,ha as lockBaseUrl,ra as lockFilePath,Ui as loggerFactory,qi as logsCurrentPath,Zi as logsPreviousPath,Ir as makeLazyEmbeddingsKeyStore,fa as markServerLockDraining,gt as mountMcpAndApi,Pi as normalizeFsPath,z as originGitHubHost,ui as packageVersionMajorMinor,fi as parseAuthRejectionWire,ln as parseGitVersion,et as parseHocuspocusAuthToken,de as parseKeepaliveConnectionId,pt as pathToDocName,Je as planSeed,Ht as prepareSingleFileOpen,qt as processCommand,_r as processUsage,Rr as readAllTargets,an as readBundleDecision,Re as readOwnNativeRules,da as readProcessLock,ca as readProcessLockDetailed,x as readProjectHeadState,Hr as readProjectLocalSemanticConfig,oa as readServerLock,$n as readServerPackageVersion,Xr as readSkillInstallStateSnapshot,Wn as readStateManifest,un as readTargetRecordedAt,bn as readTargetVersion,ze as readUiLock,Nt as reconcile,kn as recordContributor,Bt as recordSkillInstallEvent,oe as registerAllTools,$ as registerWrite,aa as releaseProcessLock,ta as releaseServerLock,G as releaseUiLock,ct as removeLastKnownHash,gr as reportSkillInstall,yr as resetMetrics,r as resolveBundleEnabled,_i as resolveBundledSkillDir,hi as resolveContentDir,me as resolveCursorBinaryDefault,Er as resolveCursorSpawnInvocation,y as resolveEffectiveLinterConfig,Jr as resolveEmbeddingsCredential,Xt as resolveLockDir,Hn as resolveNativeConfigForDoc,W as resolveNativeMarkdownlintConfig,Ft as resolvePack,Pr as resolvePackageVersion,jn as resolveSkillInstallReportSettings,d as resolveUiInfo,Cn as restoreContributors,pi as restoreLifecycleFromConflictsJson,m as rewriteMarkdownLinksForDocumentRename,fn as rewriteWikiLinksForDocumentRename,yn as runAuthReposSubprocess,xr as runAuthStatusSubprocess,pn as runCloneSubprocess,rr as runDeviceFlowSubprocess,dr as runWithMcpLogger,Ue as safeContentPath,Un as safeSubdir,Ut as safetyCheckpoint,Gn as sanitizeClientName,pr as saveInMemoryCheckpoint,Fr as saveVersion,A as seedBasenameIndex,fr as serializeError,Ci as setActiveSpanAttributes,Ke as setupServerObservers,tn as shadowGit,Bi as shutdownTelemetry,Wi as spansCurrentPath,Gi as spansPreviousPath,le as spawnDetached,He as splitMarkdownBlocks,vt as startWatcher,ft as streamingProblemEvent,Rt as swapContributors,Ye as teardownToleranceTelemetryWriter,Sn as toBroadcasterKey,ji as tracedAppendFileSync,Ii as tracedLinkSync,Oi as tracedMkdir,Mi as tracedMkdirSync,Ri as tracedRename,ki as tracedRenameSync,Fi as tracedRmSync,Ni as tracedRmdirSync,Ai as tracedUnlinkSync,Ei as tracedWriteFile,zi as tracedWriteFileSync,ri as trustSystemCertificates,en as untrackTrackedProjectSkillProjection,J as updateLastKnownHash,ia as updateProcessLockPort,ua as updateServerLockPort,ae as updateUiLockPort,Lt as validateAgentId,Ur as validateCloneInputs,Qt as validateSkillZip,pa as waitForServerLockDrain,Pt as withHiddenWindowsConsole,Ti as withSpan,wi as withSpanSync,Sr as writeBundleDecision,P as writeMarkdownlintRule,Qe as writeRootGitignoreForNewRepo,g as writeStateManifest,ir as writeTargetVersion,pe as writeTracker};
|
package/dist/src-BbuqzOpI.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,ft as n,q as r}from"./sleep-D_nNc7T_.mjs";import{gc as i,hc as a,nt as o,po as s,rt as c}from"./src-DMi2O7yV.mjs";import{Nn as l,Zr as u,at as d,bi as f,it as p,ot as m,rt as h}from"./src-C6s1YGEs.mjs";import{D as ee,F as g,I as _,k as v}from"./fs-traced-xJfl5Rxd.mjs";import{C as y,S as b,d as x,y as S}from"./server-lock-BHY1C3dW.mjs";import{t as C}from"./yazl-DZr4PyKA.mjs";import{m as w,p as te,v as T}from"./write-project-skill-G2p_hc1u.mjs";import{c as ne}from"./colors-BsmVIwfM.mjs";import{n as re}from"./acp-harness-probe-CeLGZgZF.mjs";import{E,T as D,_ as ie,o as O,w as k,x as ae,y as oe}from"./init-D0Jw_Flt.mjs";import{n as se}from"./constants-DMPdZA-V.mjs";import{t as A}from"./is-object-ByG7RnjH.mjs";import"./loader-8jTgMHWn.mjs";import"./skill-teardown-CJl8M28h.mjs";import"./preview-CsOdYI9R.mjs";import{execSync as ce,spawnSync as j}from"node:child_process";import{basename as M,dirname as N,join as P,relative as le,resolve as F,sep as ue}from"node:path";import{cpSync as de,createWriteStream as fe,existsSync as I,lstatSync as pe,mkdirSync as L,mkdtempSync as me,readFileSync as R,readdirSync as z,readlinkSync as he,rmSync as B,statSync as ge,writeFileSync as V}from"node:fs";import{arch as _e,freemem as ve,homedir as H,hostname as ye,platform as be,release as xe,tmpdir as Se,totalmem as Ce,type as we,uptime as Te}from"node:os";import"node:fs/promises";import{createHash as Ee}from"node:crypto";var U=n();const De=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Oe(e,t,n=l){if(e!==void 0&&!De.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let ke=null;function Ae(e){ke=e}function je(){return ke??process.cwd()}function Me(){return P(H(),`.ok`,`bug-reports`)}function Ne(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Me(),r=`${t}-bugreport`,i=P(n,`${r}.zip`);for(let e=2;I(i);e+=1)i=P(n,`${r}-${e}.zip`);return i}function Pe(e,t){let n=P(e,`.ok`,`config.yml`);if(I(n))try{let e=R(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return I(P(e,`.ok`))?Ee(`sha256`).update(F(e)).digest(`hex`).slice(0,12):null}function Fe(){let e={timestamp:new Date().toISOString(),platform:be(),osType:we(),osRelease:xe(),hostname:`[redacted]`,uptime:Te(),freeMem:ve(),totalMem:Ce(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ce(`sw_vers -productVersion 2>/dev/null`,u({encoding:`utf8`})).trim()}catch{}try{let t=P(__dirname,`..`,`..`,`package.json`);I(t)&&(e.okVersion=JSON.parse(R(t,`utf8`)).version)}catch{}return e}const Ie=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function W(e){let t=M(e);return Ie.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function Le(e,t){return Be(e,t).files}const Re=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function ze(e,t=re){let n=P(e,`${t}.ShipIt`);return I(n)?Re.map(e=>P(n,e)).filter(e=>I(e)):[]}function Be(e,t){if(!I(t))return{files:[],excludedByProjectSlug:0};let n=z(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>P(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(W),i=[],a=r.filter(t=>{try{return R(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!W(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Ve(e){let t=P(e,`.ok`,`local`);return I(t)?{files:[`server.lock`,`last-spawn-error.log`,o].map(e=>P(t,e)).filter(e=>I(e))}:{files:[]}}function He(e){let t=P(e,`.ok`,`local`,`logs`);return I(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>P(t,e)).filter(e=>I(e))}:{files:[]}}function Ue(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=i(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function G(e){for(let t of e.files)try{Ue({zipfile:e.zipfile,name:`${e.prefix}/${M(t)}`,content:R(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function We(t){let{redact:n,outputPath:r,logger:i}=t,o=t.userLogsDir??P(H(),`.ok`,`logs`),s=t.projectDir?Pe(t.projectDir,i):null;L(N(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=Fe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=Be(s,o),{files:d}=t.projectDir?Ve(t.projectDir):{files:[]},{files:f}=t.projectDir?He(t.projectDir):{files:[]},p=t.shipItLogFiles??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length},`files collected`);let m=[],h=[],{ZipFile:ee}=await import(`./yazl-jVENrf5i.mjs`).then(t=>e(t.default,1)),g=new ee;G({zipfile:g,files:[...l,...p],prefix:`logs`,redact:n,bundleFiles:h,redactions:m,logger:i}),G({zipfile:g,files:d,prefix:`lockdir`,redact:n,bundleFiles:h,redactions:m,logger:i}),G({zipfile:g,files:f,prefix:`local-logs`,redact:n,bundleFiles:h,redactions:m,logger:i});for(let e of t.extraFiles??[])try{let t=R(e.sourcePath),n=`extra/${e.zipName??M(e.sourcePath)}`;g.addBuffer(t,n),h.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Ue({zipfile:g,name:`note.txt`,content:t.note,redact:n,bundleFiles:h,redactions:m});let _=JSON.stringify(c,null,2);g.addBuffer(Buffer.from(_,`utf8`),`sysinfo.json`),h.push(`sysinfo.json`);let v={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:h,redactions:m,sysinfo:c};g.addBuffer(Buffer.from(JSON.stringify(v,null,2),`utf8`),`MANIFEST.json`);let y=m.reduce((e,t)=>e+t.lineCount,0),b=new Set(p.map(e=>`logs/${M(e)}`)),x=h.filter(e=>b.has(e)),S=s?h.filter(e=>e.startsWith(`logs/`)&&!W(e)&&!b.has(e)):[],C=[`# Bug Report Bundle`,``,`Generated: ${v.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${v.disciplineVersion}`,``,`## Contents`,``,...h.map(e=>`- ${e}`),``,`## Privacy`,``,...S.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...S.map(e=>`- ${e}`),``]:[],...x.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...x.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${a.join(`, `)}`,y>0?`${y} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
|
|
2
|
-
`);g.addBuffer(Buffer.from(C,`utf8`),`README.md`),g.end();let w=fe(r);return g.outputStream.pipe(w),await new Promise((e,t)=>{w.on(`close`,e),w.on(`error`,t)}),i?.info({bundlePath:r,fileCount:h.length,redactionCount:y},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:h,redactions:m,redactedLineCount:y,generatedAt:v.generatedAt}}}var Ge=e(C(),1),K=e(ne(),1);function Ke(e){return _({absPath:v(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function qe({home:e=H(),env:n=process.env}={}){let i=Ke(e),{override:a,preferenceList:o}=ee(n),{locale:c,source:l}=s({override:a,storedPreference:i,supportedLocales:r,preferenceList:o,autoDetectableLocales:t});return{preference:i,locale:c,source:l,systemLanguages:o}}function Je(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Ye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e,t){if(typeof e==`string`)return Je(e,t.contentDir);if(Array.isArray(e))return e.map(e=>q(e,t));if(!Ye(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=q(i,t);return n}function Xe(e,t){let n=R(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
3
|
-
`),i=n.split(`
|
|
4
|
-
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=q(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}V(e,r?`${a.join(`
|
|
5
|
-
`)}\n`:a.join(`
|
|
6
|
-
`))}function Ze(e,t){let n=R(e,`utf-8`);if(n.trim().length!==0)try{let r=q(JSON.parse(n),t),i=n.endsWith(`
|
|
7
|
-
`)?`
|
|
8
|
-
`:``;V(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=Je(n,t.contentDir);r!==n&&V(e,r)}}function Qe(e,t){let n=R(e,`utf-8`),r=Je(n,t.contentDir);r!==n&&V(e,r)}function $e(e){try{return z(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>P(e,t.name))}catch{return[]}}const et=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function tt(e){return/\.log\.\d+$/.test(e)}function nt(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||tt(e)}function rt(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of $e(P(e.stagingDir,n)))nt(r)?Xe(r,t):r.endsWith(`.json`)?Ze(r,t):Qe(r,t);for(let n of $e(P(e.stagingDir,`state`))){let e=M(n);n.endsWith(`.jsonl`)?Xe(n,t):et.has(e)?Ze(n,t):Qe(n,t)}}const it=[`.ok`,`local`,`telemetry`],at=[`.ok`,`local`,`logs`],ot=[`.ok`,`local`,`loss-capture`],st=`spans-current.jsonl`,ct=`spans-prev.jsonl`,lt=`server-current.jsonl`,ut=`server-prev.jsonl`,dt=`loss-current.jsonl`,ft=`loss-prev.jsonl`;function pt(e){return P(e,...it,st)}function mt(e){return P(e,...it,ct)}function ht(e){return P(e,...at,lt)}function gt(e){return P(e,...at,ut)}function _t(e){return P(e,...ot,dt)}function vt(e){return P(e,...ot,ft)}const yt=1e3;async function bt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(yt)});return t.ok?await t.text():null}catch{return null}}async function xt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(yt)});return t.ok?await t.text():null}catch{return null}}async function St(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(yt)});return t.ok?await t.text():null}catch{return null}}function Ct(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
|
|
9
|
-
`)}\n`:null}catch{return null}}function wt(e){let t=P(e,`.git`,`ok`);if(!I(t))return null;let n=j(`git`,[`-C`,t,`log`,`--oneline`,`-50`],u({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Tt(e){let t=P(e,`.git`,`ok`);if(!I(t))return null;let n=j(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],u({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Et(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function Dt(){return{nodeVersion:process.version,platform:be(),arch:_e()}}function Ot(){return process.env.OTEL_SDK_DISABLED===`false`}function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function kt(e){if(!I(e))return{};let t;try{t=(0,U.parse)(R(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!J(t))return{};let n=t.telemetry;if(!J(n))return{};let r=n.localSink;return J(r)?r:{}}function At(e){return typeof e==`boolean`?e:void 0}function jt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y(e){if(J(e))return jt(e.maxBytes)}function Mt(e){let t=kt(v(`project`,e)),n=kt(v(`project-local`,e));return{enabled:At(n.enabled)??At(t.enabled)??!0,spansMaxBytes:Y(n.spans)??Y(t.spans)??52428800,logsMaxBytes:Y(n.logs)??Y(t.logs)??26214400}}function Nt(e){return Ee(`sha256`).update(e).digest(`hex`)}function Pt(e){let t=R(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Ft(e){let t=R(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function X(e,t){if(!I(e))return!1;try{return L(N(t),{recursive:!0}),de(e,t),!0}catch{return!1}}function It(e){let t=[],n=e=>{let r=z(e,{withFileTypes:!0});for(let i of r){let r=P(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Lt=new Set([`.jsonl`]);function Rt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Lt.has(e.slice(t))}const zt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Bt(e){if(tt(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:zt.has(e.slice(t))}function Vt(e){let t=[];for(let n of It(e)){let r=Ht(e,n);if(!Bt(r))continue;let{redacted:a,patterns:o,lineCount:s}=i(R(n,`utf-8`));o.length!==0&&(V(n,a),t.push({file:r,lineCount:s,patterns:o}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function Ht(e,t){return le(e,t).split(ue).join(`/`)}async function Ut(e){let t=F(e.contentDir),n=F(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??bt,a=r.fetchAgentEffects??xt,s=r.fetchWatcherRecent??St,l=r.readShadowHead??wt,u=r.readCheckpointRefs??Tt,d=r.now??(()=>new Date),f=r.okVersion??(()=>se),p=r.readDesktopEnv??Et,m=r.readLanguage??qe,h=r.readRuntime??Dt,ee=r.isOtlpPushEnabled??Ot,g=me(P(Se(),`ok-bundle-`));try{L(P(g,`telemetry`),{recursive:!0}),L(P(g,`logs`),{recursive:!0}),L(P(g,`state`),{recursive:!0}),X(pt(n),P(g,`telemetry`,st)),X(mt(n),P(g,`telemetry`,ct)),X(ht(n),P(g,`logs`,lt)),X(gt(n),P(g,`logs`,ut));for(let t of e.userLogFiles??[])X(t,P(g,`logs`,M(t)));let _=P(n,`.ok`,`local`),v=P(_,`server.lock`),y=`not-running`,b=`no server.lock`,x=null;if(I(v)){X(v,P(g,`state`,`server.lock`));try{let e=R(v,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?x=t.port:b=`lock present but no port`}catch{b=`lock present but unparseable`}}if(x!==null){let e=await i(x);e===null?b=`agent-presence endpoint at :${x} unreachable`:(V(P(g,`state`,`agent-presence.json`),e),y=`running`,b=``);let t=await a(x);t!==null&&V(P(g,`state`,`agent-effects.json`),t);let n=await s(x);if(n!==null){let e=Ct(n);e!==null&&V(P(g,`state`,`watcher-recent.jsonl`),e)}}let S=l(t);S!==null&&V(P(g,`state`,`shadow-head.txt`),S);let C=u(t);C!==null&&V(P(g,`state`,`checkpoint-refs.txt`),C),X(_t(n),P(g,`state`,dt)),X(vt(n),P(g,`state`,ft)),X(P(_,`last-spawn-error.log`),P(g,`state`,`last-spawn-error.log`)),X(P(_,c),P(g,`state`,c)),X(P(_,o),P(g,`state`,o));let w=h(),te=p(),T=m(),ne={ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:te,language:T}};V(P(g,`state`,`runtime.json`),`${JSON.stringify(ne,null,2)}\n`);let re=y===`running`?`running
|
|
10
|
-
`:`not-running (${b})\n`;if(V(P(g,`state`,`server-status.txt`),re),e.processDir&&I(e.processDir)){let t=P(g,`process`);L(t,{recursive:!0}),de(e.processDir,t,{recursive:!0})}let E=e.redact===!0;E&&rt({stagingDir:g,contentDir:t}),e.note&&V(P(g,`note.txt`),e.note);let D=null;e.scrubSecrets===!0&&(D=Vt(g));for(let t of e.extraFiles??[])X(t.sourcePath,P(g,`extra`,t.zipName??M(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let ie=Mt(n),O=It(g),k=[],ae=0,oe=0;for(let e of O){let t=Ht(g,e),n=ge(e).size,r=Rt(t)?Pt(e):0;k.push({path:t,bytes:n,lines:r}),ae+=n,t.startsWith(`telemetry/`)&&Rt(t)&&(oe+=Ft(e))}let se={applied:E};D!==null&&(se.secretScrub=D);let A={schemaVersion:2,createdAt:d().toISOString(),ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:te,language:T},contentDir:{pathSha256:Nt(t),absolutePath:E?`<CONTENT_DIR>`:t},telemetry:{localSink:ie,otlpPushEnabled:ee()},redaction:se,serverStatus:y,files:k};V(P(g,`manifest.json`),`${JSON.stringify(A,null,2)}\n`);let ce=O.some(e=>{try{return R(e,`utf-8`).includes(t)}catch{return!1}}),j={totalBytes:ae,fileCount:k.length,docNameCount:oe,contentDirVisible:ce,redacted:E},N=!1;return{stagingDir:g,manifest:A,summary:j,cleanup:()=>{N||(N=!0,B(g,{recursive:!0,force:!0}))}}}catch(e){throw B(g,{recursive:!0,force:!0}),e}}async function Wt(e){let{collected:t,outputPath:n}=e,r=N(n);if(!I(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new Ge.ZipFile,a=It(t.stagingDir);for(let e of a){let n=Ht(t.stagingDir,e);i.addFile(e,n)}i.end();let o=fe(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function Gt(e,t){let n=P(e,`.ok`,`config.yml`);if(I(n))try{let t=(0,U.parse)(R(n,`utf-8`)),r=A(t)?t.content:void 0,i=A(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return F(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return F(e)}async function Kt(e,t,n,r){let i=Pe(t,e.logger),a=await Ut({contentDir:Gt(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...Le(i,e.userLogsDir??P(H(),`.ok`,`logs`)),...ze(e.cachesDir??P(H(),`Library`,`Caches`))],deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{L(N(e.outputPath),{recursive:!0}),await Wt({collected:a,outputPath:e.outputPath});let t=a.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:i,files:a.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:a.manifest.createdAt}}}finally{a.cleanup()}}async function qt(e){let{projectDir:t}=e,n=e.readDesktopEnv??Et,r=e.readLanguage??qe;if(e.level===`full`&&t!==void 0)return Kt(e,t,n,r);let{zipPath:i,summary:a}=await We({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:ze(e.cachesDir??P(H(),`Library`,`Caches`)),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:i,summary:{level:e.level,systemWide:t===void 0,projectSlug:a.projectSlug,files:a.files,redactions:a.redactions,redactedLineCount:a.redactedLineCount,generatedAt:a.generatedAt}}}function Z(e,t,n={}){let r=x(e,t);if(!I(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(R(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!y(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??b)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??S())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??ye();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function Jt(e){return e.replace(/:\d+$/,``)}function Yt(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Jt(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Jt(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Jt(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}const Xt=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Zt(e){return P(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const Qt={existsSync:e=>I(e),readFileSync:(e,t)=>R(e,t),lstatSync:e=>pe(e),readlinkSync:e=>he(e)};function $t(e,t=Qt){let n=Zt(e);if(!t.existsSync(n))return null;try{let e=JSON.parse(t.readFileSync(n,`utf8`));return e?.version===1?e:null}catch{return null}}function en(e){let t=e.replace(Xt,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function tn(e,t,n=Qt){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function nn(e){return te(e)||w(e)||ae(e)}const rn=10*1024*1024;function an(e,t,n,r){let i=O(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!nn(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);return e.format===`file`?(B(a,{force:!0}),{kind:`removed`}):e.format===`toml`?cn(a,o):e.format===`yaml`?sn(a,e.topLevelKey,o):on(a,e.topLevelKey,e.serverMapSubKey,o)}function on(e,t,n,r){let i;try{i=R(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>rn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=E(i,ie(t,n,r));return o?(g(e,a,{mode:k(e)}),{kind:`removed`}):{kind:`not-present`}}function sn(e,t,n){let r;try{r=R(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>rn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,U.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=D(a);a.trim()===``||a.endsWith(`
|
|
11
|
-
`)?c.endsWith(`
|
|
12
|
-
`)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
|
|
13
|
-
`).replace(/\n/g,`\r
|
|
14
|
-
`));let u=`${i?``:``}${c}`;return u!==r&&g(e,u,{mode:k(e)}),{kind:`removed`}}function cn(e,t){let n=oe();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=R(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=D(a),s=a.trim()===``||a.endsWith(`
|
|
15
|
-
`),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
|
|
16
|
-
`)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
|
|
17
|
-
`).replace(/\n/g,`\r
|
|
18
|
-
`));let u=`${i?``:``}${l}`;return u!==r&&g(e,u,{mode:k(e)}),{kind:`removed`}}function ln(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function un(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function dn(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:p(r),command:r,isDesktop:ln(r)}}function fn(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&fn(e)?`ui-orphan`:`stale`}const pn=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function mn(e){switch(e){case`running`:return K.default.green(e);case`desktop`:return K.default.blue(e);case`foreign`:return K.default.cyan(e);case`ui-orphan`:return K.default.magenta(e);case`stale`:return K.default.yellow(e)}}function hn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function gn(e){return`${hn(e.server.usage)} | ${hn(e.ui?.usage??null)}`}function _n(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function vn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=Q(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,_n(e),gn(e),t,String(n),un(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=mn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=K.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
19
|
-
`)}async function yn(e={}){let t=e.discover??h,n=e.inspect??Z,r=e.log??(e=>console.log(e)),i=e.resolveCommand??d,a=e.resolveUsage??m,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=dn(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&s.push(o)}if(e.json){let e=s.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(vn(e.all?s:s.filter(e=>pn.has(Q(e)))))}function bn(){return new T(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await yn({all:t.all===!0||e===`all`,json:t.json===!0})})}function xn(e,t,n={}){let r=n.isAlive??b,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function Sn(e){let t=e.inspect??(t=>Z(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=xn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function Cn(e,t=b){let n=await h(),r=null;for(let i of n){let n=Z(i,`server`),a=Z(i,`ui`);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function wn(e){let t=Sn({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function Tn(e){return new T(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=Sn({lockDir:f(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await yn({});return}if(n===`all`){let e=await h();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=Z(n,`server`),r=Z(n,`ui`);!$(e,b)&&!$(r,b)||(wn(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await Cn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}wn(t);return}wn(f(F(je(),n)))})}export{je as _,Xt as a,$t as c,Z as d,qt as f,Me as g,Ne as h,an as i,en as l,Wt as m,Tn as n,tn as o,Ut as p,bn as r,Zt as s,Sn as t,Yt as u,Ae as v,Oe as y};
|
|
20
|
-
//# sourceMappingURL=src-BbuqzOpI.mjs.map
|
package/dist/src-CK1WyOz0.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./src-DMi2O7yV.mjs";import"./write-project-skill-G2p_hc1u.mjs";import"./src-BbuqzOpI.mjs";import"./acp-harness-probe-CeLGZgZF.mjs";import"./init-D0Jw_Flt.mjs";import{n as e}from"./loader-8jTgMHWn.mjs";import"./skill-teardown-CJl8M28h.mjs";import"./preview-CsOdYI9R.mjs";import"./mcp-migrate-event-B1gJf6bG.mjs";export{e as loadConfig};
|
package/dist/start-CEKLyQNR.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{T as e,_ as t,m as n,n as r}from"./start-Uw9UGGLL.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};
|