@inkeep/open-knowledge 0.25.0-beta.20 → 0.25.0-beta.22

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.
Files changed (91) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +6 -6
  4. package/dist/constants-BUU-f5cR.mjs +2 -0
  5. package/dist/{dist-t4ugaFF0.mjs → dist-CDX3FPEf.mjs} +1 -1
  6. package/dist/{dist-CgoRMunD.mjs → dist-TG9U-N9P.mjs} +10 -10
  7. package/dist/index.mjs +1 -1
  8. package/dist/init-DXxXuTdF.mjs +1 -0
  9. package/dist/{init-DGGa0Poi.mjs → init-OSum2tdu.mjs} +4 -4
  10. package/dist/loader-CTgKrU6h.mjs +1 -0
  11. package/dist/{loader-D1yXqf8H.mjs → loader-OqBg2MkQ.mjs} +2 -2
  12. package/dist/{preview-Ar8Am8Lv.mjs → preview-DgLBzg0c.mjs} +2 -2
  13. package/dist/preview-DvHkfk9B.mjs +1 -0
  14. package/dist/public/assets/{ActivityModeContent-D48vVOLP.js → ActivityModeContent-Bq2-szSy.js} +1 -1
  15. package/dist/public/assets/{ConsentDialogBody-CGxx7K6d.js → ConsentDialogBody-Cw7ziXls.js} +1 -1
  16. package/dist/public/assets/{DocumentContext-CJ22lSnF.js → DocumentContext-Cp5LrwUt.js} +1 -1
  17. package/dist/public/assets/{EnableSyncConfirmDialog-O-QyePZs.js → EnableSyncConfirmDialog-D6td4gmM.js} +1 -1
  18. package/dist/public/assets/{GraphPanel-PKzv55Hr.js → GraphPanel-CzvW16mF.js} +1 -1
  19. package/dist/public/assets/{ManagedArtifactProperties-Cb9g3XUL.js → ManagedArtifactProperties-7tx2h5fh.js} +1 -1
  20. package/dist/public/assets/{McpConsentDialogBody-D0V6I7sX.js → McpConsentDialogBody-BNMbefiw.js} +1 -1
  21. package/dist/public/assets/{PropertyPanel-lSIKHRqy.js → PropertyPanel-BYMeaHwv.js} +2 -2
  22. package/dist/public/assets/{SettingsDialogBody-Df7GQEXC.js → SettingsDialogBody-C4TH7Apf.js} +1 -1
  23. package/dist/public/assets/{ShareBranchSwitchDialog-6YHbhuib.js → ShareBranchSwitchDialog-CAYidTth.js} +1 -1
  24. package/dist/public/assets/{ShareReceiveDialog-DodAWemk.js → ShareReceiveDialog-B_g3WoKU.js} +1 -1
  25. package/dist/public/assets/{ShareReceiveMissDialog-BERnm3PE.js → ShareReceiveMissDialog-Bi8yB_Er.js} +1 -1
  26. package/dist/public/assets/{SkillEditorActions-CNMkj80k.js → SkillEditorActions-zGJNqarO.js} +1 -1
  27. package/dist/public/assets/{SourceEditor-D5AjvnZ3.js → SourceEditor-z66BI1TW.js} +1 -1
  28. package/dist/public/assets/{TerminalPanel-DGdTOOBW.js → TerminalPanel-vd5LQunA.js} +1 -1
  29. package/dist/public/assets/{agent-presence-DzX-AMwj.js → agent-presence-0f5jUZHx.js} +1 -1
  30. package/dist/public/assets/{auth-state-cache-DDPu-Wza.js → auth-state-cache-CBnUAJVI.js} +1 -1
  31. package/dist/public/assets/{button-Cw_0dYAP.js → button-cneJOVxD.js} +1 -1
  32. package/dist/public/assets/{calendar-Br-BjNEv.js → calendar-BSusn3yJ.js} +1 -1
  33. package/dist/public/assets/check-Dqb-7gfx.js +1 -0
  34. package/dist/public/assets/{checkbox--aCx_VEt.js → checkbox-CF2d2zZW.js} +1 -1
  35. package/dist/public/assets/chevron-down-D3nis7uo.js +1 -0
  36. package/dist/public/assets/chevron-left-C6Q_NKVx.js +1 -0
  37. package/dist/public/assets/chevron-right-BfmqRYl8.js +1 -0
  38. package/dist/public/assets/{collapsible-C2BV6FHW.js → collapsible-NtcTfAgP.js} +1 -1
  39. package/dist/public/assets/{config-context-B6QjZ1RW.js → config-context-CVpOcWSZ.js} +1 -1
  40. package/dist/public/assets/{config-provider-AZSpuXXy.js → config-provider-VM6ptPr5.js} +1 -1
  41. package/dist/public/assets/{cursor-DWg4aKeS.js → cursor-CGeB2PU5.js} +1 -1
  42. package/dist/public/assets/{dialog-YBH5PjUS.js → dialog-DqxKeWl_.js} +1 -1
  43. package/dist/public/assets/{dist-D2AYnwsl.js → dist-BHLnUfd3.js} +1 -1
  44. package/dist/public/assets/{dist-C5Xa8yL1.js → dist-BpbMCVke.js} +1 -1
  45. package/dist/public/assets/{dist-DBck2Wni.js → dist-D6OstNsL.js} +1 -1
  46. package/dist/public/assets/{dist-CMd99jCo.js → dist-DFcaTwzj.js} +1 -1
  47. package/dist/public/assets/{dist-DoPCS53q.js → dist-Dk6VEDeZ.js} +1 -1
  48. package/dist/public/assets/{git-branch-3nYAHKh5.js → git-branch-DtntyZcb.js} +1 -1
  49. package/dist/public/assets/{index-aIqgABmi.js → index-BuvV9Y-n.js} +98 -98
  50. package/dist/public/assets/index-DJtUU5yP.css +1 -0
  51. package/dist/public/assets/{input-DkflumBI.js → input-DaVPmsWF.js} +1 -1
  52. package/dist/public/assets/{label-TedtbqkV.js → label-C2i80316.js} +1 -1
  53. package/dist/public/assets/loader-circle-CiIO3Fk-.js +1 -0
  54. package/dist/public/assets/{miss-dialog-store-D4V6ccBu.js → miss-dialog-store-Ay7SdCdU.js} +1 -1
  55. package/dist/public/assets/{open-managed-artifact-tab-C6BHQB0v.js → open-managed-artifact-tab-C0CwefFo.js} +1 -1
  56. package/dist/public/assets/{panel-BIPkPKNj.js → panel-BH2RZRZQ.js} +1 -1
  57. package/dist/public/assets/{pending-receive-nav-store-tesr5n6G.js → pending-receive-nav-store-BPFyzD9L.js} +1 -1
  58. package/dist/public/assets/{project-paths-CuasytRc.js → project-paths-CXBtKZyA.js} +1 -1
  59. package/dist/public/assets/{prop-types-DIo-gx4O.js → prop-types-DgIMu1uN.js} +1 -1
  60. package/dist/public/assets/{radio-group-DDwGQ5DT.js → radio-group-Cn-Ci2Ym.js} +1 -1
  61. package/dist/public/assets/{refresh-cw-BHaAFbCQ.js → refresh-cw-EVALIeLp.js} +1 -1
  62. package/dist/public/assets/{selection-context-BPs74l1N.js → selection-context-B7L1o08O.js} +1 -1
  63. package/dist/public/assets/{skill-actions-CFGl3BfZ.js → skill-actions-BWXoXFJf.js} +1 -1
  64. package/dist/public/assets/{skill-scope-D_YpwXm9.js → skill-scope-Bt2TwqtA.js} +1 -1
  65. package/dist/public/assets/{skills-api-D8o77mG3.js → skills-api-C8U58cr0.js} +1 -1
  66. package/dist/public/assets/{textarea-rwbHA8E5.js → textarea-CHe7do1z.js} +1 -1
  67. package/dist/public/assets/{toggle-group-hi4Tembn.js → toggle-group-DFnOh2oq.js} +1 -1
  68. package/dist/public/assets/{tooltip-DaINFyme.js → tooltip-DY1syGNr.js} +1 -1
  69. package/dist/public/assets/{typing-burst-detector-xkKqYj3i.js → typing-burst-detector-g8ADg4Q2.js} +1 -1
  70. package/dist/public/index.html +43 -43
  71. package/dist/{repair-launch-json-BYyble1D.mjs → repair-launch-json-e3Xal7gR.mjs} +2 -2
  72. package/dist/{repair-mcp-configs-BBygiH0z.mjs → repair-mcp-configs-uJr9vJYZ.mjs} +2 -2
  73. package/dist/{repair-skills-B_7y-_86.mjs → repair-skills-BEfm4X9B.mjs} +2 -2
  74. package/dist/repair-skills-Bz8yC6_P.mjs +1 -0
  75. package/dist/{src-DkOsQ2G0.mjs → src-BlGVwaKa.mjs} +2 -2
  76. package/dist/start-B8B-OPqe.mjs +1 -0
  77. package/dist/{start-xUVUMhK7.mjs → start-BL2OEs-Z.mjs} +2 -2
  78. package/dist/{write-project-skill-DRxDENrm.mjs → write-project-skill-qMcfR4xG.mjs} +2 -2
  79. package/package.json +1 -1
  80. package/dist/constants-DKK5Ti8D.mjs +0 -2
  81. package/dist/init-Cp3rQ4fC.mjs +0 -1
  82. package/dist/loader-BNb29T7L.mjs +0 -1
  83. package/dist/preview-CVDn-KrD.mjs +0 -1
  84. package/dist/public/assets/check-SPk0tvuH.js +0 -1
  85. package/dist/public/assets/chevron-down-DxD_aY5H.js +0 -1
  86. package/dist/public/assets/chevron-left-BqTNmlIi.js +0 -1
  87. package/dist/public/assets/chevron-right-B5-WDYn2.js +0 -1
  88. package/dist/public/assets/index-CiDjoHbL.css +0 -1
  89. package/dist/public/assets/loader-circle-BFgDr9-d.js +0 -1
  90. package/dist/repair-skills-qrIBetAi.mjs +0 -1
  91. package/dist/start-BsKqWH7z.mjs +0 -1
@@ -1 +1 @@
1
- import{An as e,J as t,Ri as n,Tn as r,Vt as i,a,c as o,d as s,f as c,fn as l,g as u,h as d,i as f,ji as p,l as m,m as h,n as g,o as _,on as v,p as y,r as b,s as x,si as S,t as C,tn as w,u as T}from"./server-lock-ltHt39S2-FrJuEUby.mjs";import{$ as E,$i as D,$n as O,$r as k,$t as A,A as j,Ai as M,An as N,Ar as P,At as F,B as I,Bi as L,Bn as R,Br as z,Bt as B,C as V,Ci as H,Cn as U,Cr as W,Ct as G,D as K,Di as q,Dn as J,Dr as Y,Dt as X,E as Z,Ei as Q,En as $,Er as ee,Et as te,F as ne,Fi as re,Fn as ie,Fr as ae,Ft as oe,G as se,Gi as ce,Gn as le,Gr as ue,Gt as de,H as fe,Hi as pe,Hn as me,Hr as he,Ht as ge,I as _e,Ii as ve,In as ye,Ir as be,It as xe,J as Se,Ji as Ce,Jn as we,Jr as Te,Jt as Ee,K as De,Ki as Oe,Kn as ke,Kr as Ae,Kt as je,L as Me,Li as Ne,Ln as Pe,Lr as Fe,Lt as Ie,M as Le,Mi as Re,Mn as ze,Mr as Be,Mt as Ve,N as He,Ni as Ue,Nn as We,Nr as Ge,Nt as Ke,O as qe,Oi as Je,On as Ye,Or as Xe,Ot as Ze,P as Qe,Pi as $e,Pn as et,Pr as tt,Pt as nt,Q as rt,Qi as it,Qn as at,Qr as ot,Qt as st,R as ct,Ri as lt,Rn as ut,Rr as dt,Rt as ft,S as pt,Si as mt,Sn as ht,Sr as gt,St as _t,T as vt,Ti as yt,Tn as bt,Tr as xt,Tt as St,U as Ct,Ui as wt,Un as Tt,Ur as Et,Ut as Dt,V as Ot,Vi as kt,Vn as At,Vr as jt,Vt as Mt,W as Nt,Wi as Pt,Wn as Ft,Wr as It,Wt as Lt,X as Rt,Xi as zt,Xn as Bt,Xr as Vt,Xt as Ht,Y as Ut,Yi as Wt,Yn as Gt,Yr as Kt,Yt as qt,Z as Jt,Zi as Yt,Zn as Xt,Zr as Zt,Zt as Qt,_ as $t,_a as en,_i as tn,_n as nn,_r as rn,_t as an,a as on,aa as sn,ai as cn,an as ln,ar as un,at as dn,b as fn,bi as pn,bn as mn,br as hn,bt as gn,c as _n,ci as vn,cn as yn,cr as bn,ct as xn,d as Sn,di as Cn,dn as wn,dr as Tn,dt as En,ea as Dn,ei as On,en as kn,er as An,et as jn,f as Mn,fi as Nn,fn as Pn,fr as Fn,ft as In,g as Ln,gi as Rn,gn as zn,gr as Bn,gt as Vn,h as Hn,hi as Un,hn as Wn,hr as Gn,ht as Kn,i as qn,ia as Jn,ii as Yn,in as Xn,ir as Zn,it as Qn,j as $n,ji as er,jn as tr,jr as nr,jt as rr,k as ir,ki as ar,kn as or,kr as sr,kt as cr,l as lr,li as ur,ln as dr,lr as fr,lt as pr,m as mr,mi as hr,mn as gr,mr as _r,mt as vr,n as yr,na as br,ni as xr,nn as Sr,nr as Cr,nt as wr,o as Tr,oi as Er,on as Dr,or as Or,ot as kr,p as Ar,pi as jr,pn as Mr,pr as Nr,pt as Pr,q as Fr,qi as Ir,qn as Lr,qr as Rr,qt as zr,r as Br,ra as Vr,ri as Hr,rn as Ur,rr as Wr,rt as Gr,s as Kr,si as qr,sn as Jr,sr as Yr,st as Xr,t as Zr,ta as Qr,ti as $r,tn as ei,tr as ti,tt as ni,u as ri,ui as ii,un as ai,ur as oi,ut as si,v as ci,va as li,vi as ui,vn as di,vr as fi,vt as pi,w as mi,wi as hi,wn as gi,wr as _i,wt as vi,x as yi,xi as bi,xn as xi,xr as Si,xt as Ci,y as wi,yi as Ti,yn as Ei,yr as Di,yt as Oi,z as ki,zi as Ai,zn as ji,zr as Mi,zt as Ni}from"./dist-CgoRMunD.mjs";export{Zr as AGENT_ID_MAX_LEN,yr as AGENT_ID_RE,Br as AGENT_WRITE_ORIGIN,qn as AgentFocusBroadcaster,on as AgentPresenceBroadcaster,Tr as AgentSessionCapacityError,Kr as AgentSessionManager,_n as AutoStartDisabledError,lr as BUNDLE_IDS,ri as BUNDLE_SCOPE,Sn as BUNDLE_SKILL_NAME,Mn as BacklinkIndex,Ar as CC1Broadcaster,t as CC1_CONTRACT_VERSION,mr as CONFIG_FILENAME,Hn as CONFLICT_MARKER_RE,Ln as CURSOR_BUNDLE_PATHS_BY_PLATFORM,$t as ConfigSchema,ci as DEFAULT_CHECKPOINT_RETENTION,wi as DEFAULT_EMBEDDINGS_DIMENSIONS,fn as DEFAULT_PACK_ID,yi as EMBEDDINGS_API_KEY_ENV,pt as FILE_SYSTEM_WRITER,V as FILE_WATCHER_ORIGIN,mi as FileEmbeddingsBackend,vt as GIT_PREFLIGHT_FAIL_SPAN_NAME,Z as GIT_UPSTREAM_WRITER,en as GitDirAccessError,K as GitNotAvailableError,qe as GitTooOldError,ir as HOCUSPOCUS_AUTH_REJECTION_REASONS,j as HocuspocusAuthRejection,$n as HocuspocusAuthTokenSchema,Le as INSTALLED_AGENTS_SCHEMES,i as LINEAGE_EPOCH_KEY,He as LIVE_DERIVED_INDEX_DEBOUNCE_MS,Qe as LOG_MD_TEMPLATE,ne as MANAGED_RENAME_ORIGIN,_e as MAX_AGENT_SESSIONS,Me as MCP_CONNECTION_ID_HEADER,w as MCP_SERVER_NAME,ct as MIN_GIT_VERSION,ki as MISSING_OK_CONFIG_MESSAGE,li as MalformedGitPointerError,I as McpLogger,Ot as MissingOkConfigError,fe as OBSERVER_SYNC_ORIGIN,Ct as OK_OKIGNORE_TEMPLATE,v as ORPHAN_MODES,Nt as PANE_TARGET_TTL_MS,l as PROTOCOL_VERSION,se as PinoLogger,C as ProcessLockCollisionError,De as ProjectGitInitError,Fr as ROLLBACK_ORIGIN,Se as ROOT_GITIGNORE_TEMPLATE,g as RUNTIME_VERSION,Ut as SERVICE_WRITER,Rt as SKILL_INSTALL_EVENTS_FILE_REL,r as SKILL_STATE_TARGETS,Jt as STARTER_FOLDERS,rt as STARTER_FOLDER_FRONTMATTER_FILENAME,E as STARTER_PACKS,jn as STARTER_PACK_IDS,ni as STARTER_TEMPLATES,wr as STATE_MANIFEST_FILENAME,b as STATE_SCHEMA_VERSION,e as SYSTEM_DOC_NAME,Gr as SeedPrerequisiteError,Qn as SeedRootDirError,f as ServerLockCollisionError,dn as SingleFileNotAFileError,kr as SingleFileNotFoundError,Xr as SingleFileNotMarkdownError,xn as StateManifestError,pr as TagIndex,si as USER_GLOBAL_BUNDLE_IDS,En as UiLockCollisionError,In as __getShowAllWalkStatsForTesting,Pr as __resetShowAllWalkStatsForTesting,a as acquireProcessLock,_ as acquireServerLock,vr as acquireUiLock,Kn as applyAgentMarkdownWrite,Vn as applyExternalChange,an as applySeed,pi as armPaneTarget,Oi as assertCompatibleStateManifest,gn as assertGitAvailable,Ci as assertNeverDiskEvent,_t as attachIdleShutdown,G as bootServer,vi as buildAndOpenSkill,St as buildConfigYmlContent,te as buildExecResult,X as buildSkillZip,Ze as buildStarterFolderFrontmatterYaml,cr as buildWipTree,F as bundleSkillMdPath,rr as classifyEvents,Ve as classifyFsPath,Ke as clearArmedPaneTarget,nt as clearContributors,oe as clearEmbeddingsKeyFromAllBackends,xe as coercePackId,S as colorFromSeed,Ie as commitUpstreamImport,ft as commitWip,Ni as commitWipFromTree,B as compareSemver,Mt as containsConflictMarkers,ge as contentHash,Dt as contributorCount,Lt as countShadowObjects,de as countStaleAgentWipRefs,je as countWipRefs,zr as createApiExtension,Ee as createAssetServeMiddleware,qt as createContentFilter,Ht as createContentFilterAsync,Qt as createEmbeddingsSecretStore,st as createEphemeralProjectDir,A as createExternalChangeHandler,kn as createFileLogger,ei as createLiveDerivedIndexExtension,Sr as createMcpHttpHandler,Ur as createOsProbe,Xn as createPersistenceExtension,ln as createServer,Dr as createServerObserverExtension,Jr as createStreamingErrorWriter,yn as createTestLogger,dr as describeStoredEmbeddingsKey,ai as detectClaudeDesktopPresence,wn as detectGit,Pn as detectProjectShape,Mr as discoverLockDirs,gr as emitPreflightFailureSpan,Wn as encodeDocName,zn as encodeFolderRoute,nn as encodeSkillRoute,di as ensureProjectGit,Ei as errorResponse,mn as evictStaleTrackerEntries,xi as extractOkBinaryPath,ht as extractWikiLinksFromMarkdown,U as fallbackPaths,gi as findEnclosingGitRoot,bt as findEnclosingProjectRoot,$ as flushFileLogger,J as formatAuthRejectionWire,Ye as formatContributors,or as formatContributorsFrom,N as formatPackRationale,tr as gcCheckpointRefs,ze as getCurrentMcpLogger,We as getLocalDir,et as getLogFilePath,ie as getLogger,ye as getLogsDir,Pe as getMeter,ut as getMetrics,ji as getTracer,R as handleCollabSocketError,At as handleSpawnCursor,me as hasGcLogLatch,p as iconFromClientName,Tt as incrementCollabSocketFilteredError,Ft as incrementServerObserverFire,le as initContent,ke as initShadowRepo,Lr as initTelemetry,we as initToleranceTelemetryWriter,Gt as installPrettyZodErrors,Bt as installTestLoggers,Xt as installUserSkill,at as isAllowedApiOrigin,O as isAllowedWorkspaceHostHeader,An as isConfigDoc,ti as isHocuspocusAuthRejectionReason,Cr as isKnownPackId,Wr as isLinkIndexExcludedDoc,Zn as isLoopbackAddress,un as isManagedArtifactDoc,n as isOrphanMode,Or as isPairedWriteOrigin,Yr as isPathWithinDir,x as isProcessAlive,bn as isProjectRoot,fr as isProjectSkillManaged,oi as isReservedForUserTree,Tn as isSelfWrite,Fn as isSystemDoc,Nr as isToleranceTelemetryEnabled,o as isValidLockPid,_r as lastKnownHash,Gn as listRescueCheckpoints,Bn as listStarterPacks,rn as loadPrincipal,m as lockFilePath,fi as loggerFactory,Di as logsCurrentPath,hn as logsPreviousPath,Si as makeLazyEmbeddingsKeyStore,gt as mountMcpAndApi,W as normalizeFsPath,_i as packageVersionMajorMinor,xt as parseAuthRejectionWire,ee as parseGitVersion,Y as parseHocuspocusAuthToken,Xe as parseKeepaliveConnectionId,sr as pathToDocName,P as planSeed,nr as prepareSingleFileOpen,Be as processCommand,Ge as processUsage,tt as readAllTargets,ae as readArmedPaneTarget,be as readBranchFromHead,T as readProcessLock,s as readProcessLockDetailed,Fe as readProjectLocalSemanticConfig,c as readServerLock,dt as readServerPackageVersion,Mi as readSkillInstallStateSnapshot,z as readSkillManagement,jt as readStateManifest,he as readTargetRecordedAt,Et as readTargetVersion,It as readUiLock,ue as reconcile,Ae as recordContributor,Rr as recordSkillInstallEvent,Te as registerAllTools,Kt as registerWrite,y as releaseProcessLock,h as releaseServerLock,Vt as releaseUiLock,Zt as removeLastKnownHash,ot as resetMetrics,k as resolveBundledSkillDir,On as resolveContentDir,$r as resolveCursorBinaryDefault,xr as resolveCursorSpawnInvocation,Hr as resolveLockDir,Yn as resolvePack,cn as resolvePackageVersion,Er as resolveUiInfo,qr as restoreContributors,vn as restoreLifecycleFromConflictsJson,ur as rewriteMarkdownLinksForDocumentRename,ii as rewriteWikiLinksForDocumentRename,Cn as runAuthReposSubprocess,Nn as runAuthStatusSubprocess,jr as runCloneSubprocess,hr as runDeviceFlowSubprocess,Un as runWithMcpLogger,Rn as safeContentPath,tn as safeSubdir,ui as safetyCheckpoint,Ti as sanitizeClientName,pn as saveInMemoryCheckpoint,bi as saveVersion,mt as seedBasenameIndex,H as serializeError,hi as setActiveSpanAttributes,yt as shadowGit,Q as shutdownTelemetry,q as skillManagementPath,Je as spansCurrentPath,ar as spansPreviousPath,M as spawnDetached,er as splitMarkdownBlocks,Re as startWatcher,Ue as streamingProblemEvent,$e as swapContributors,re as teardownToleranceTelemetryWriter,ve as toBroadcasterKey,Ne as tracedAppendFileSync,lt as tracedLinkSync,Ai as tracedMkdir,L as tracedMkdirSync,kt as tracedRename,pe as tracedRenameSync,wt as tracedRmSync,Pt as tracedRmdirSync,ce as tracedUnlinkSync,Oe as tracedWriteFile,Ir as tracedWriteFileSync,Ce as updateLastKnownHash,d as updateProcessLockPort,u as updateServerLockPort,Wt as updateUiLockPort,zt as validateAgentId,Yt as validateCloneInputs,it as validateSkillZip,D as withSpan,Dn as withSpanSync,Qr as writeRootGitignoreForNewRepo,br as writeSkillManagement,Vr as writeStateManifest,Jn as writeTargetVersion,sn as writeTracker};
1
+ import{An as e,J as t,Ri as n,Tn as r,Vt as i,a,c as o,d as s,f as c,fn as l,g as u,h as d,i as f,ji as p,l as m,m as h,n as g,o as _,on as v,p as y,r as b,s as x,si as S,t as C,tn as w,u as T}from"./server-lock-ltHt39S2-FrJuEUby.mjs";import{$ as E,$i as D,$n as O,$r as k,$t as A,A as j,Ai as M,An as N,Ar as P,At as F,B as I,Bi as L,Bn as R,Br as z,Bt as B,C as V,Ci as H,Cn as U,Cr as W,Ct as G,D as K,Di as q,Dn as J,Dr as Y,Dt as X,E as Z,Ei as Q,En as $,Er as ee,Et as te,F as ne,Fi as re,Fn as ie,Fr as ae,Ft as oe,G as se,Gi as ce,Gn as le,Gr as ue,Gt as de,H as fe,Hi as pe,Hn as me,Hr as he,Ht as ge,I as _e,Ii as ve,In as ye,Ir as be,It as xe,J as Se,Ji as Ce,Jn as we,Jr as Te,Jt as Ee,K as De,Ki as Oe,Kn as ke,Kr as Ae,Kt as je,L as Me,Li as Ne,Ln as Pe,Lr as Fe,Lt as Ie,M as Le,Mi as Re,Mn as ze,Mr as Be,Mt as Ve,N as He,Ni as Ue,Nn as We,Nr as Ge,Nt as Ke,O as qe,Oi as Je,On as Ye,Or as Xe,Ot as Ze,P as Qe,Pi as $e,Pn as et,Pr as tt,Pt as nt,Q as rt,Qi as it,Qn as at,Qr as ot,Qt as st,R as ct,Ri as lt,Rn as ut,Rr as dt,Rt as ft,S as pt,Si as mt,Sn as ht,Sr as gt,St as _t,T as vt,Ti as yt,Tn as bt,Tr as xt,Tt as St,U as Ct,Ui as wt,Un as Tt,Ur as Et,Ut as Dt,V as Ot,Vi as kt,Vn as At,Vr as jt,Vt as Mt,W as Nt,Wi as Pt,Wn as Ft,Wr as It,Wt as Lt,X as Rt,Xi as zt,Xn as Bt,Xr as Vt,Xt as Ht,Y as Ut,Yi as Wt,Yn as Gt,Yr as Kt,Yt as qt,Z as Jt,Zi as Yt,Zn as Xt,Zr as Zt,Zt as Qt,_ as $t,_a as en,_i as tn,_n as nn,_r as rn,_t as an,a as on,aa as sn,ai as cn,an as ln,ar as un,at as dn,b as fn,bi as pn,bn as mn,br as hn,bt as gn,c as _n,ci as vn,cn as yn,cr as bn,ct as xn,d as Sn,di as Cn,dn as wn,dr as Tn,dt as En,ea as Dn,ei as On,en as kn,er as An,et as jn,f as Mn,fi as Nn,fn as Pn,fr as Fn,ft as In,g as Ln,gi as Rn,gn as zn,gr as Bn,gt as Vn,h as Hn,hi as Un,hn as Wn,hr as Gn,ht as Kn,i as qn,ia as Jn,ii as Yn,in as Xn,ir as Zn,it as Qn,j as $n,ji as er,jn as tr,jr as nr,jt as rr,k as ir,ki as ar,kn as or,kr as sr,kt as cr,l as lr,li as ur,ln as dr,lr as fr,lt as pr,m as mr,mi as hr,mn as gr,mr as _r,mt as vr,n as yr,na as br,ni as xr,nn as Sr,nr as Cr,nt as wr,o as Tr,oi as Er,on as Dr,or as Or,ot as kr,p as Ar,pi as jr,pn as Mr,pr as Nr,pt as Pr,q as Fr,qi as Ir,qn as Lr,qr as Rr,qt as zr,r as Br,ra as Vr,ri as Hr,rn as Ur,rr as Wr,rt as Gr,s as Kr,si as qr,sn as Jr,sr as Yr,st as Xr,t as Zr,ta as Qr,ti as $r,tn as ei,tr as ti,tt as ni,u as ri,ui as ii,un as ai,ur as oi,ut as si,v as ci,va as li,vi as ui,vn as di,vr as fi,vt as pi,w as mi,wi as hi,wn as gi,wr as _i,wt as vi,x as yi,xi as bi,xn as xi,xr as Si,xt as Ci,y as wi,yi as Ti,yn as Ei,yr as Di,yt as Oi,z as ki,zi as Ai,zn as ji,zr as Mi,zt as Ni}from"./dist-TG9U-N9P.mjs";export{Zr as AGENT_ID_MAX_LEN,yr as AGENT_ID_RE,Br as AGENT_WRITE_ORIGIN,qn as AgentFocusBroadcaster,on as AgentPresenceBroadcaster,Tr as AgentSessionCapacityError,Kr as AgentSessionManager,_n as AutoStartDisabledError,lr as BUNDLE_IDS,ri as BUNDLE_SCOPE,Sn as BUNDLE_SKILL_NAME,Mn as BacklinkIndex,Ar as CC1Broadcaster,t as CC1_CONTRACT_VERSION,mr as CONFIG_FILENAME,Hn as CONFLICT_MARKER_RE,Ln as CURSOR_BUNDLE_PATHS_BY_PLATFORM,$t as ConfigSchema,ci as DEFAULT_CHECKPOINT_RETENTION,wi as DEFAULT_EMBEDDINGS_DIMENSIONS,fn as DEFAULT_PACK_ID,yi as EMBEDDINGS_API_KEY_ENV,pt as FILE_SYSTEM_WRITER,V as FILE_WATCHER_ORIGIN,mi as FileEmbeddingsBackend,vt as GIT_PREFLIGHT_FAIL_SPAN_NAME,Z as GIT_UPSTREAM_WRITER,en as GitDirAccessError,K as GitNotAvailableError,qe as GitTooOldError,ir as HOCUSPOCUS_AUTH_REJECTION_REASONS,j as HocuspocusAuthRejection,$n as HocuspocusAuthTokenSchema,Le as INSTALLED_AGENTS_SCHEMES,i as LINEAGE_EPOCH_KEY,He as LIVE_DERIVED_INDEX_DEBOUNCE_MS,Qe as LOG_MD_TEMPLATE,ne as MANAGED_RENAME_ORIGIN,_e as MAX_AGENT_SESSIONS,Me as MCP_CONNECTION_ID_HEADER,w as MCP_SERVER_NAME,ct as MIN_GIT_VERSION,ki as MISSING_OK_CONFIG_MESSAGE,li as MalformedGitPointerError,I as McpLogger,Ot as MissingOkConfigError,fe as OBSERVER_SYNC_ORIGIN,Ct as OK_OKIGNORE_TEMPLATE,v as ORPHAN_MODES,Nt as PANE_TARGET_TTL_MS,l as PROTOCOL_VERSION,se as PinoLogger,C as ProcessLockCollisionError,De as ProjectGitInitError,Fr as ROLLBACK_ORIGIN,Se as ROOT_GITIGNORE_TEMPLATE,g as RUNTIME_VERSION,Ut as SERVICE_WRITER,Rt as SKILL_INSTALL_EVENTS_FILE_REL,r as SKILL_STATE_TARGETS,Jt as STARTER_FOLDERS,rt as STARTER_FOLDER_FRONTMATTER_FILENAME,E as STARTER_PACKS,jn as STARTER_PACK_IDS,ni as STARTER_TEMPLATES,wr as STATE_MANIFEST_FILENAME,b as STATE_SCHEMA_VERSION,e as SYSTEM_DOC_NAME,Gr as SeedPrerequisiteError,Qn as SeedRootDirError,f as ServerLockCollisionError,dn as SingleFileNotAFileError,kr as SingleFileNotFoundError,Xr as SingleFileNotMarkdownError,xn as StateManifestError,pr as TagIndex,si as USER_GLOBAL_BUNDLE_IDS,En as UiLockCollisionError,In as __getShowAllWalkStatsForTesting,Pr as __resetShowAllWalkStatsForTesting,a as acquireProcessLock,_ as acquireServerLock,vr as acquireUiLock,Kn as applyAgentMarkdownWrite,Vn as applyExternalChange,an as applySeed,pi as armPaneTarget,Oi as assertCompatibleStateManifest,gn as assertGitAvailable,Ci as assertNeverDiskEvent,_t as attachIdleShutdown,G as bootServer,vi as buildAndOpenSkill,St as buildConfigYmlContent,te as buildExecResult,X as buildSkillZip,Ze as buildStarterFolderFrontmatterYaml,cr as buildWipTree,F as bundleSkillMdPath,rr as classifyEvents,Ve as classifyFsPath,Ke as clearArmedPaneTarget,nt as clearContributors,oe as clearEmbeddingsKeyFromAllBackends,xe as coercePackId,S as colorFromSeed,Ie as commitUpstreamImport,ft as commitWip,Ni as commitWipFromTree,B as compareSemver,Mt as containsConflictMarkers,ge as contentHash,Dt as contributorCount,Lt as countShadowObjects,de as countStaleAgentWipRefs,je as countWipRefs,zr as createApiExtension,Ee as createAssetServeMiddleware,qt as createContentFilter,Ht as createContentFilterAsync,Qt as createEmbeddingsSecretStore,st as createEphemeralProjectDir,A as createExternalChangeHandler,kn as createFileLogger,ei as createLiveDerivedIndexExtension,Sr as createMcpHttpHandler,Ur as createOsProbe,Xn as createPersistenceExtension,ln as createServer,Dr as createServerObserverExtension,Jr as createStreamingErrorWriter,yn as createTestLogger,dr as describeStoredEmbeddingsKey,ai as detectClaudeDesktopPresence,wn as detectGit,Pn as detectProjectShape,Mr as discoverLockDirs,gr as emitPreflightFailureSpan,Wn as encodeDocName,zn as encodeFolderRoute,nn as encodeSkillRoute,di as ensureProjectGit,Ei as errorResponse,mn as evictStaleTrackerEntries,xi as extractOkBinaryPath,ht as extractWikiLinksFromMarkdown,U as fallbackPaths,gi as findEnclosingGitRoot,bt as findEnclosingProjectRoot,$ as flushFileLogger,J as formatAuthRejectionWire,Ye as formatContributors,or as formatContributorsFrom,N as formatPackRationale,tr as gcCheckpointRefs,ze as getCurrentMcpLogger,We as getLocalDir,et as getLogFilePath,ie as getLogger,ye as getLogsDir,Pe as getMeter,ut as getMetrics,ji as getTracer,R as handleCollabSocketError,At as handleSpawnCursor,me as hasGcLogLatch,p as iconFromClientName,Tt as incrementCollabSocketFilteredError,Ft as incrementServerObserverFire,le as initContent,ke as initShadowRepo,Lr as initTelemetry,we as initToleranceTelemetryWriter,Gt as installPrettyZodErrors,Bt as installTestLoggers,Xt as installUserSkill,at as isAllowedApiOrigin,O as isAllowedWorkspaceHostHeader,An as isConfigDoc,ti as isHocuspocusAuthRejectionReason,Cr as isKnownPackId,Wr as isLinkIndexExcludedDoc,Zn as isLoopbackAddress,un as isManagedArtifactDoc,n as isOrphanMode,Or as isPairedWriteOrigin,Yr as isPathWithinDir,x as isProcessAlive,bn as isProjectRoot,fr as isProjectSkillManaged,oi as isReservedForUserTree,Tn as isSelfWrite,Fn as isSystemDoc,Nr as isToleranceTelemetryEnabled,o as isValidLockPid,_r as lastKnownHash,Gn as listRescueCheckpoints,Bn as listStarterPacks,rn as loadPrincipal,m as lockFilePath,fi as loggerFactory,Di as logsCurrentPath,hn as logsPreviousPath,Si as makeLazyEmbeddingsKeyStore,gt as mountMcpAndApi,W as normalizeFsPath,_i as packageVersionMajorMinor,xt as parseAuthRejectionWire,ee as parseGitVersion,Y as parseHocuspocusAuthToken,Xe as parseKeepaliveConnectionId,sr as pathToDocName,P as planSeed,nr as prepareSingleFileOpen,Be as processCommand,Ge as processUsage,tt as readAllTargets,ae as readArmedPaneTarget,be as readBranchFromHead,T as readProcessLock,s as readProcessLockDetailed,Fe as readProjectLocalSemanticConfig,c as readServerLock,dt as readServerPackageVersion,Mi as readSkillInstallStateSnapshot,z as readSkillManagement,jt as readStateManifest,he as readTargetRecordedAt,Et as readTargetVersion,It as readUiLock,ue as reconcile,Ae as recordContributor,Rr as recordSkillInstallEvent,Te as registerAllTools,Kt as registerWrite,y as releaseProcessLock,h as releaseServerLock,Vt as releaseUiLock,Zt as removeLastKnownHash,ot as resetMetrics,k as resolveBundledSkillDir,On as resolveContentDir,$r as resolveCursorBinaryDefault,xr as resolveCursorSpawnInvocation,Hr as resolveLockDir,Yn as resolvePack,cn as resolvePackageVersion,Er as resolveUiInfo,qr as restoreContributors,vn as restoreLifecycleFromConflictsJson,ur as rewriteMarkdownLinksForDocumentRename,ii as rewriteWikiLinksForDocumentRename,Cn as runAuthReposSubprocess,Nn as runAuthStatusSubprocess,jr as runCloneSubprocess,hr as runDeviceFlowSubprocess,Un as runWithMcpLogger,Rn as safeContentPath,tn as safeSubdir,ui as safetyCheckpoint,Ti as sanitizeClientName,pn as saveInMemoryCheckpoint,bi as saveVersion,mt as seedBasenameIndex,H as serializeError,hi as setActiveSpanAttributes,yt as shadowGit,Q as shutdownTelemetry,q as skillManagementPath,Je as spansCurrentPath,ar as spansPreviousPath,M as spawnDetached,er as splitMarkdownBlocks,Re as startWatcher,Ue as streamingProblemEvent,$e as swapContributors,re as teardownToleranceTelemetryWriter,ve as toBroadcasterKey,Ne as tracedAppendFileSync,lt as tracedLinkSync,Ai as tracedMkdir,L as tracedMkdirSync,kt as tracedRename,pe as tracedRenameSync,wt as tracedRmSync,Pt as tracedRmdirSync,ce as tracedUnlinkSync,Oe as tracedWriteFile,Ir as tracedWriteFileSync,Ce as updateLastKnownHash,d as updateProcessLockPort,u as updateServerLockPort,Wt as updateUiLockPort,zt as validateAgentId,Yt as validateCloneInputs,it as validateSkillZip,D as withSpan,Dn as withSpanSync,Qr as writeRootGitignoreForNewRepo,br as writeSkillManagement,Vr as writeStateManifest,Jn as writeTargetVersion,sn as writeTracker};
@@ -955,7 +955,7 @@ last-spawn-error.log
955
955
  `,ROOT_GITIGNORE_TEMPLATE=`# Seeded by OpenKnowledge when this project was created. Edit freely.
956
956
  .DS_Store
957
957
  `;function initContent(e,t){let s=resolve(e,`.ok`),g=[],S=[],w=[];assertNotSymlink(s,`.ok/`),tracedMkdirSync(s,{recursive:!0});let E=ensureGitignoreEntries(join(s,`.gitignore`),OK_GITIGNORE_CONTENT);return E===`created`?g.push(`.gitignore`):E===`updated`?S.push(`.gitignore`):w.push(`.gitignore`),writeIfMissing(join(s,`config.yml`),buildConfigYmlContent(t?.packageVersion??`0.0.0`,{contentDir:t?.contentDir}),`.ok/config.yml`)?g.push(CONFIG_FILENAME):w.push(CONFIG_FILENAME),writeIfMissing(join(e,`.okignore`),OK_OKIGNORE_TEMPLATE,`.okignore`)?g.push(`.okignore`):w.push(`.okignore`),{created:g,updated:S,skipped:w}}function writeRootGitignoreForNewRepo(e){return writeIfMissing(join(e,`.gitignore`),ROOT_GITIGNORE_TEMPLATE,`.gitignore`)?`created`:`skipped`}const ALLOWED_URL_PATTERNS=[/^https?:\/\//i,/^ssh:\/\//i,/^git:\/\//i,/^git@[^:]+:/],BLOCKED_URL_PATTERNS=[/^file:\/\//i,/^javascript:/i,/^ext::/i,/^data:/i,/^vbscript:/i];function isAllowedGitUrl(e){return!e||typeof e!=`string`||BLOCKED_URL_PATTERNS.some(t=>t.test(e))?!1:ALLOWED_URL_PATTERNS.some(t=>t.test(e))}function expandTilde(e){return e===`~`?homedir():e.startsWith(`~/`)?join(homedir(),e.slice(2)):e}function ancestorChainHasSymlink(e,t){let s=dirname(e);for(;s!==t&&s!==dirname(s);){let e;try{e=lstatSync(s)}catch(e){let t=e.code;return console.warn(`[local-op-security] ancestorChainHasSymlink: lstat failed on ${s} (${t??`unknown`}); treating as symlink (fail-closed)`),!0}if(e.isSymbolicLink())return console.warn(`[local-op-security] ancestorChainHasSymlink: symlink detected at ${s}`),!0;s=dirname(s)}return!1}function isPathWithinHome(e,t){if(!e||typeof e!=`string`||e.includes(`\0`))return!1;let s;try{s=realpathSync(t)}catch(e){let s=e.code;return console.warn(`[local-op-security] realpath failed on home dir ${t} (${s??`unknown`}); rejecting all paths`),!1}let g=resolve(expandTilde(e)),S=[],w=g;for(;;){let e=null;try{e=lstatSync(w)}catch(e){let t=e.code;if(t!==`ENOENT`)return console.warn(`[local-op-security] lstat error at ${w} (${t??`unknown`}); rejecting`),!1}if(e!==null){let g;try{g=realpathSync(w)}catch(s){let S=s.code;if(e.isSymbolicLink())return console.warn(`[local-op-security] realpath failed on symlink leaf at ${w} (${S??`unknown`}); rejecting`),!1;if(S===`EPERM`||S===`EACCES`){if(ancestorChainHasSymlink(w,t))return console.warn(`[local-op-security] EPERM accept-branch refused at ${w}: symlinked ancestor in chain; rejecting`),!1;console.warn(`[local-op-security] realpath denied on non-symlink leaf at ${w} (${S??`unknown`}); trusting lexical path (TCC-class)`),g=w}else return console.warn(`[local-op-security] realpath failed on non-symlink leaf at ${w} (${S??`unknown`}); rejecting`),!1}let E=S.length===0?g:join(g,...S),D=relative(s,E);return D===``||!D.startsWith(`..`)&&!isAbsolute(D)}let g=dirname(w);if(g===w)return!1;S.unshift(basename(w)),w=g}}function isSafeLocalPath(e){return isPathWithinHome(e,homedir())}function isLoopbackRequest(e){let t=e.socket.remoteAddress;return t===`127.0.0.1`||t===`::1`||t===`::ffff:127.0.0.1`}function hasValidLocalOpOrigin(e){let t=e.headers.origin;if(!t)return!0;try{let{hostname:e}=new URL(t);return e===`127.0.0.1`||e===`localhost`||e===`[::1]`||e===`::1`}catch{return!1}}function checkLocalOpSecurity(e,t,s){return isLoopbackRequest(e)?hasValidLocalOpOrigin(e)?!0:(errorResponse(t,403,`urn:ok:error:invalid-origin`,`Origin header is not a permitted loopback origin.`,{handler:s.handler}),!1):(errorResponse(t,403,`urn:ok:error:loopback-required`,`Local-op endpoints require a loopback connection.`,{handler:s.handler}),!1)}function createConcurrencyGuard(){let e=new Set;return{tryAcquire(t){return e.has(t)?!1:(e.add(t),!0)},release(t){e.delete(t)}}}function runSubprocess(e){let[t,...s]=e.cliArgs;if(!t)return{done:Promise.resolve({code:-1,stderr:`no command provided`,timedOut:!1,cancelled:!1}),cancel:()=>{}};let g=[...s,...e.trailingArgs],S=!1,w=!1,E=``,D=[],O={...process.env};e.extraPathDirs&&e.extraPathDirs.length>0&&(O.PATH=[...e.extraPathDirs,process.env.PATH??``].filter(Boolean).join(delimiter));let k=spawn(t,g,{cwd:e.cwd,stdio:[`ignore`,`pipe`,`pipe`],env:O}),j=setTimeout(()=>{S=!0,k.kill(`SIGTERM`)},e.timeoutMs),F=t=>{if(!t.trim())return;let s=null;try{let e=JSON.parse(t);s=e&&typeof e==`object`?e:null}catch{s=null}e.onLine({raw:t,parsed:s})};return k.stdout.on(`data`,e=>{E+=e.toString(`utf-8`);let t=E.split(`
958
- `);E=t.pop()??``;for(let e of t)F(e)}),k.stderr.on(`data`,t=>{D.push(t),e.onStderr?.(t)}),{done:new Promise(e=>{k.on(`close`,t=>{clearTimeout(j),E.trim()&&F(E),E=``,e({code:t,stderr:Buffer.concat(D).toString(`utf-8`).trim(),timedOut:S,cancelled:w})}),k.on(`error`,t=>{clearTimeout(j),D.push(Buffer.from(t.message,`utf-8`)),e({code:-1,stderr:Buffer.concat(D).toString(`utf-8`).trim(),timedOut:S,cancelled:w})})}),cancel:()=>{if(!w&&(w=!0,!k.killed))try{k.kill(`SIGTERM`)}catch{}}}}const DEFAULT_TIMEOUT_MS$3=600*1e3;function asAuthEvent(e){let t=e.type;return t===`verification`?typeof e.user_code==`string`&&typeof e.verification_uri==`string`&&typeof e.expires_in==`number`?{type:`verification`,user_code:e.user_code,verification_uri:e.verification_uri,expires_in:e.expires_in}:null:t===`complete`?{type:`complete`,host:typeof e.host==`string`?e.host:``,login:typeof e.login==`string`?e.login:``,name:typeof e.name==`string`?e.name:void 0,email:typeof e.email==`string`?e.email:void 0,avatarUrl:typeof e.avatarUrl==`string`?e.avatarUrl:void 0}:t===`error`?{type:`error`,message:typeof e.message==`string`?e.message:`Unknown error`}:null}function runDeviceFlowSubprocess(e){let t=e.host??`github.com`,s=e.timeoutMs??DEFAULT_TIMEOUT_MS$3,g=!1,S=runSubprocess({cliArgs:e.cliArgs,trailingArgs:[`auth`,`login`,`--json`,`--host`,t],timeoutMs:s,onLine:({parsed:t})=>{if(!t)return;let s=asAuthEvent(t);s&&((s.type===`complete`||s.type===`error`)&&(g=!0),e.onEvent(s))}});return{done:S.done.then(s=>{g||(s.code===0?e.onEvent({type:`complete`,host:t,login:``}):e.onEvent({type:`error`,message:s.timedOut?`Sign-in timed out`:`auth login exited with code ${s.code??-1}`}))}),cancel:S.cancel}}const DEFAULT_TIMEOUT_MS$2=3e4;async function runAuthStatusSubprocess(e){let t=e.host??`github.com`,s=[],g=await runSubprocess({cliArgs:e.cliArgs,trailingArgs:[`auth`,`status`,`--json`,`--host`,t],timeoutMs:e.timeoutMs??DEFAULT_TIMEOUT_MS$2,onLine:({parsed:e})=>{e&&s.push(e)}}).done;for(let e=s.length-1;e>=0;e--){let g=s[e];if(g.type!==`status`)continue;let S=typeof g.host==`string`?g.host:t;if(g.authenticated===!0&&typeof g.login==`string`){let e=g.tier===`A`||g.tier===`B`||g.tier===`C`?g.tier:void 0;return{authenticated:!0,host:S,login:g.login,tier:e,name:typeof g.name==`string`?g.name:void 0,email:typeof g.email==`string`?g.email:void 0}}return{authenticated:!1,host:S,error:typeof g.error==`string`?g.error:void 0}}return{authenticated:!1,host:t,error:g.timedOut?`auth status timed out`:g.code===0?void 0:g.stderr||`auth status exited with code ${g.code??-1}`}}async function runAuthReposSubprocess(e){let t=e.host??`github.com`,s=[],g=await runSubprocess({cliArgs:e.cliArgs,trailingArgs:[`auth`,`repos`,`--json`,`--host`,t],timeoutMs:e.timeoutMs??DEFAULT_TIMEOUT_MS$2,onLine:({parsed:e})=>{e&&s.push(e)}}).done;if(g.timedOut)return{ok:!1,error:`auth repos timed out`};if(g.code!==0)return{ok:!1,error:g.stderr||`auth repos exited with code ${g.code??-1}`};for(let e=s.length-1;e>=0;e--){let g=s[e];if(g.type!==`repos`||!Array.isArray(g.repos))continue;let S=[];for(let e of g.repos){if(!e||typeof e!=`object`)continue;let t=e;typeof t.full_name!=`string`||typeof t.clone_url!=`string`||S.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof g.host==`string`?g.host:t,repos:S}}return{ok:!1,error:`auth repos returned no data`}}const GENERIC_TITLE=`Clone subprocess reported an error.`,MAX_DETAIL_LEN=500;function classifyCloneError(e){let t=redactShareSubprocessStderr(e).trim().slice(0,MAX_DETAIL_LEN);return t.length===0?{title:GENERIC_TITLE,detail:``}:/repository not found|returned error:\s*404/i.test(t)?{title:`Can't access this repository. It may be private, or you may not have access.`,detail:t}:/permission denied|access denied|returned error:\s*403/i.test(t)?{title:`You don't have access to this repository.`,detail:t}:/authentication failed/i.test(t)?{title:`GitHub authentication failed. Try signing in again.`,detail:t}:{title:GENERIC_TITLE,detail:t}}const GIT_PREFLIGHT_FAIL_SPAN_NAME=`ok.preflight.git.fail`;function emitPreflightFailureSpan(e){let t=e instanceof GitTooOldError?`too_old`:`not_available`,s=e instanceof GitTooOldError?e.detected:``;withSpanSync(GIT_PREFLIGHT_FAIL_SPAN_NAME,{attributes:{"ok.platform":e.platform,"ok.preflight.git.reason":t,"ok.preflight.git.detected_version":s}},()=>{})}const log$8=getLogger(`clone-flow`),DEFAULT_TIMEOUT_MS$1=600*1e3;function validateCloneInputs(e,t){return isAllowedGitUrl(e)?isSafeLocalPath(t)?{ok:!0}:{ok:!1,reason:`invalid-dir`}:{ok:!1,reason:`invalid-url`}}function asRawCloneEvent(e){let t=e.type;return t===`progress`?typeof e.phase==`string`&&typeof e.pct==`number`?{type:`progress`,phase:e.phase,pct:e.pct}:null:t===`complete`?typeof e.dir==`string`?{type:`complete`,dir:e.dir}:null:t===`branch-fallback`?typeof e.branch==`string`&&e.branch.length>0?{type:`branch-fallback`,branch:e.branch}:null:t===`error`?{type:`error`,message:typeof e.message==`string`?e.message:`Unknown error`}:null}function runCloneSubprocess(e){let t=expandTilde(e.dir),s=e.timeoutMs??DEFAULT_TIMEOUT_MS$1,g;try{g=assertGitAvailable()}catch(t){t instanceof GitNotAvailableError||t instanceof GitTooOldError?(emitPreflightFailureSpan(t),log$8.warn({event:`git_preflight_fail`,platform:t.platform,reason:t instanceof GitTooOldError?`too_old`:`not_available`,detectedVersion:t instanceof GitTooOldError?t.detected:``},t instanceof GitTooOldError?`git binary too old`:`git binary not found`)):log$8.error({event:`clone_preflight_unexpected_error`,err:t},`unexpected error during clone preflight`);let s=t instanceof Error?t.message:String(t);return{done:Promise.resolve().then(()=>{e.onEvent({type:`error`,message:s})}),cancel:()=>{}}}let S=isAbsolute(g.resolvedPath)?[dirname(g.resolvedPath)]:[],w=!1,E=typeof e.branch==`string`&&e.branch.length>0?[`-b`,e.branch]:[],D=runSubprocess({cliArgs:e.cliArgs,trailingArgs:[`clone`,`--json`,...E,e.url,t],extraPathDirs:S,timeoutMs:s,onLine:({parsed:t})=>{if(!t)return;let s=asRawCloneEvent(t);s&&((s.type===`complete`||s.type===`error`)&&(w=!0),e.onEvent(s))}});return{done:D.done.then(s=>{if(!w){if(s.timedOut){e.onEvent({type:`error`,message:`Clone timed out after 10 minutes`});return}if(s.code!==0){let t=s.stderr?` — ${s.stderr}`:``;e.onEvent({type:`error`,message:`Clone process exited with code ${s.code??-1}${t}`});return}e.onEvent({type:`complete`,dir:t})}}),cancel:D.cancel}}function isLoopbackAddress(e){return e?!!(e===`::1`||e.startsWith(`::ffff:127.`)||e.startsWith(`127.`)):!1}function isAllowedWorkspaceHostHeader(e){if(!e)return!1;if(e.startsWith(`[`)){let t=e.indexOf(`]`);if(t<0)return!1;let s=e.slice(1,t),g=e.slice(t+1);return g!==``&&!/^:\d+$/.test(g)?!1:s===`::1`}let t=e.lastIndexOf(`:`),s=t>=0?e.slice(0,t):e,g=t>=0?e.slice(t+1):null;return g!==null&&!/^\d+$/.test(g)?!1:!!(s===`localhost`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(s))}const MANAGED_RENAME_JOURNAL_FILENAME=`managed-rename.json`;function journalDir(e){return getLocalDir(e)}function managedRenameJournalPath(e){return resolve(journalDir(e),MANAGED_RENAME_JOURNAL_FILENAME)}function createManagedRenameRecoveryJournal(e){let t={version:2,fromPath:e.fromPath,toPath:e.toPath,affectedDocs:e.affectedDocs,createdAt:e.createdAt??new Date().toISOString(),snapshots:e.snapshots};return e.pathSnapshots&&e.pathSnapshots.length>0&&(t.pathSnapshots=e.pathSnapshots),e.cleanupPaths&&e.cleanupPaths.length>0&&(t.cleanupPaths=e.cleanupPaths),t}function isManagedRenameSnapshot(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.docName==`string`&&typeof t.content==`string`}function isManagedRenamePathSnapshot(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.path==`string`&&typeof t.content==`string`}function isManagedRenameCleanupPath(e){return typeof e==`string`&&e.length>0}function isManagedRenameAffectedDoc(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.from==`string`&&typeof t.to==`string`}function parseV2(e){if(typeof e.fromPath!=`string`||e.fromPath.length===0)throw Error(`Managed rename journal v2 is missing fromPath`);if(typeof e.toPath!=`string`||e.toPath.length===0)throw Error(`Managed rename journal v2 is missing toPath`);if(typeof e.createdAt!=`string`||e.createdAt.length===0)throw Error(`Managed rename journal v2 is missing createdAt`);let t=e.affectedDocs,s=e.pathSnapshots,g=e.cleanupPaths,S=Array.isArray(s)&&s.length>0,w=Array.isArray(g)&&g.length>0;if(!Array.isArray(t)||!t.every(isManagedRenameAffectedDoc)||t.length===0&&!S&&!w)throw Error(`Managed rename journal v2 has invalid affectedDocs`);if(!Array.isArray(e.snapshots)||t.length>0&&e.snapshots.length===0||!e.snapshots.every(isManagedRenameSnapshot))throw Error(`Managed rename journal v2 has invalid snapshots`);if(s!==void 0&&(!Array.isArray(s)||!s.every(isManagedRenamePathSnapshot)))throw Error(`Managed rename journal v2 has invalid pathSnapshots`);if(g!==void 0&&(!Array.isArray(g)||!g.every(isManagedRenameCleanupPath)))throw Error(`Managed rename journal v2 has invalid cleanupPaths`);for(let s of t)if(!e.snapshots.some(e=>e.docName===s.from))throw Error(`Managed rename journal v2 is missing snapshot for affected doc: ${s.from}`);return{version:2,fromPath:e.fromPath,toPath:e.toPath,affectedDocs:t,createdAt:e.createdAt,snapshots:e.snapshots,...S?{pathSnapshots:s}:{},...w?{cleanupPaths:g}:{}}}function parseV1(e){if(typeof e.sourceDocName!=`string`||e.sourceDocName.length===0)throw Error(`Managed rename journal v1 is missing sourceDocName`);if(typeof e.destinationDocName!=`string`||e.destinationDocName.length===0)throw Error(`Managed rename journal v1 is missing destinationDocName`);if(typeof e.createdAt!=`string`||e.createdAt.length===0)throw Error(`Managed rename journal v1 is missing createdAt`);if(!Array.isArray(e.snapshots)||e.snapshots.length===0||!e.snapshots.every(isManagedRenameSnapshot))throw Error(`Managed rename journal v1 has invalid snapshots`);if(!e.snapshots.some(t=>t.docName===e.sourceDocName))throw Error(`Managed rename journal v1 must include the source document snapshot`);return{version:1,sourceDocName:e.sourceDocName,destinationDocName:e.destinationDocName,createdAt:e.createdAt,snapshots:e.snapshots}}function parseManagedRenameRecoveryJournal(e){if(!e||typeof e!=`object`)throw Error(`Managed rename journal must be an object`);let t=e;if(t.version===2)return parseV2(t);if(t.version===1)return parseV1(t);throw Error(`Unsupported managed rename journal version: ${String(t.version)}`)}function readManagedRenameJournal(e){let t=managedRenameJournalPath(e);if(!existsSync(t))return null;try{let e=readFileSync(t,`utf-8`);return parseManagedRenameRecoveryJournal(JSON.parse(e))}catch(e){throw Error(`Managed rename journal at ${t} is corrupt: ${e instanceof Error?e.message:String(e)}`)}}function writeManagedRenameJournal(e,t){let s=managedRenameJournalPath(e);tracedMkdirSync(dirname(s),{recursive:!0});let g=`${s}.tmp`;tracedWriteFileSync(g,JSON.stringify(t,null,2),`utf-8`),tracedRenameSync(g,s)}function clearManagedRenameJournal(e){tracedRmSync(managedRenameJournalPath(e),{force:!0})}async function withManagedRenameRecovery(e,t,s){writeManagedRenameJournal(e,t);let g=await s();return clearManagedRenameJournal(e),g}function destinationsToCleanV1(e){return[e.destinationDocName]}function destinationsToCleanV2(e){return e.affectedDocs.map(e=>e.to)}function resolveRecoveryPath(e,t){let s=resolve(e),g=resolve(s,t);if(t.includes(`\0`)||g===s||!g.startsWith(`${s}${sep}`))throw Error(`Invalid recovery path: ${t}`);return g}function pruneEmptyAncestors(e,t){let s=resolve(t),g=`${s}${sep}`,S=dirname(e);for(;S.startsWith(g)&&S!==s;){let e;try{e=readdirSync(S)}catch(e){console.warn(`[managed-rename] pruneEmptyAncestors: cannot read ${S}:`,e);return}if(e.length>0)return;try{tracedRmdirSync(S)}catch(e){console.warn(`[managed-rename] pruneEmptyAncestors: cannot rmdir ${S}:`,e);return}S=dirname(S)}}function recoverPendingManagedRename(e,t=e){let s=readManagedRenameJournal(t);if(!s)return{recovered:!1,journal:null,restoredDocNames:[]};let g=new Set,S=new Set,w=[];for(let t of s.snapshots)try{let s=safeContentPath(t.docName,e);tracedMkdirSync(dirname(s),{recursive:!0}),tracedWriteFileSync(s,t.content,`utf-8`),g.add(t.docName)}catch(e){w.push({docName:t.docName,cause:e}),console.warn(`[managed-rename] Failed to restore ${t.docName}:`,e)}if(w.length>0){let e=w.map(e=>e.docName).join(`, `);console.warn(`[managed-rename] Recovery incomplete; keeping journal for retry (${e})`);let t=w.map(e=>e.cause instanceof Error?e.cause:Error(String(e.cause)));throw AggregateError(t,`Managed rename recovery incomplete; failed to restore: ${e}`)}if(s.version===2){let t=[];for(let g of s.pathSnapshots??[])try{let t=resolveRecoveryPath(e,g.path);tracedMkdirSync(dirname(t),{recursive:!0}),tracedWriteFileSync(t,g.content,`utf-8`),S.add(g.path)}catch(e){t.push({path:g.path,cause:e}),console.warn(`[managed-rename] Failed to restore path ${g.path}:`,e)}if(t.length>0){let e=t.map(e=>e.path).join(`, `);console.warn(`[managed-rename] Recovery incomplete; keeping journal for retry (${e})`);let s=t.map(e=>e.cause instanceof Error?e.cause:Error(String(e.cause)));throw AggregateError(s,`Managed rename recovery incomplete; failed to restore paths: ${e}`)}}let E=s.version===2?destinationsToCleanV2(s):destinationsToCleanV1(s),D=[];for(let t of E){if(g.has(t))continue;let s=safeContentPath(t,e);try{tracedRmSync(s,{force:!0}),pruneEmptyAncestors(s,e)}catch(e){existsSync(s)&&console.warn(`[managed-rename] Both source and destination files exist after partial recovery for ${t}`),console.warn(`[managed-rename] Recovery incomplete; failed to clean destination ${t}:`,e),D.push({destination:t,cause:e})}}if(s.version===2)for(let t of s.cleanupPaths??[]){if(S.has(t))continue;let s=null;try{s=resolveRecoveryPath(e,t),tracedRmSync(s,{force:!0}),pruneEmptyAncestors(s,e)}catch(e){s&&existsSync(s)&&console.warn(`[managed-rename] Both source and destination paths exist after partial recovery for ${t}`),console.warn(`[managed-rename] Recovery incomplete; failed to clean destination path ${t}:`,e),D.push({destination:t,cause:e})}}if(D.length>0){let e=D.map(e=>e.destination).join(`, `),t=D.map(e=>e.cause instanceof Error?e.cause:Error(String(e.cause)));throw AggregateError(t,`Managed rename recovery incomplete; failed to clean destinations: ${e}`)}return clearManagedRenameJournal(t),{recovered:!0,journal:s,restoredDocNames:[...g].sort((e,t)=>e.localeCompare(t))}}const PROJECT_SKILL_EDITOR_LABELS={claude:`Claude Code`,cursor:`Cursor`,codex:`Codex`},PLATFORM_SKILL_NAME=BUNDLE_SKILL_NAME.project;function resolvePackSkillSource(e){let t;try{t=resolveBundledSkillDir(`packs/${e}`,{checkDesktop:!0})}catch{return null}return{name:`open-knowledge-pack-${e}`,sourceDir:t}}async function installPackSkill(e,t){let s=resolvePackSkillSource(t);if(!s)return[];let{name:g,sourceDir:S}=s,w=join(e,`.ok`,`skills`,g);if(!existsSync(join(w,`SKILL.md`)))try{tracedRmSync(w,{recursive:!0,force:!0}),tracedMkdirSync(join(e,`.ok`,`skills`),{recursive:!0}),tracedCpSync(S,w,{recursive:!0})}catch(e){return getLogger(`seed`).warn({err:e,packId:t,okSkillDir:w},`pack skill source authoring failed — skill not installed`),[]}let E=projectSkill(w,g,e,PROJECT_SKILL_EDITOR_IDS.filter(t=>{let s=EDITOR_PROJECT_SKILL_ROOT[t];return s===null?!1:existsSync(join(e,s,PLATFORM_SKILL_NAME,`SKILL.md`))})),D=E.map(e=>PROJECT_SKILL_EDITOR_LABELS[e]??e);if(E.length>0)try{await recordSkillInstall(e,g,{hosts:E,scope:`project`,scripts:existsSync(join(w,`scripts`)),installedAt:new Date().toISOString()})}catch{}return D}var SeedPrerequisiteError=class extends Error{constructor(e){super(e),this.name=`SeedPrerequisiteError`}},SeedRootDirError=class extends Error{constructor(e){super(e),this.name=`SeedRootDirError`}};function assertEntryPathInProject(e,t){if(typeof t!=`string`||t===``)throw new SeedRootDirError(`entry path must be a non-empty string, got: ${typeof t}`);if(t.includes(`\0`))throw new SeedRootDirError(`entry path must not contain null bytes`);if(isAbsolute(t))throw new SeedRootDirError(`entry path must be relative, got: ${t}`);if(t.split(/[/\\]/).some(e=>e===`..`))throw new SeedRootDirError(`entry path must not contain '..' segments, got: ${t}`);let s=resolve(e),g=resolve(s,t);if(g!==s&&!g.startsWith(s+sep))throw new SeedRootDirError(`entry path must resolve inside the project directory, got: ${t}`);return assertNoSymlinkEscape$1(g,s),g}function assertNoSymlinkEscape$1(e,t){let s;try{s=realpathSync(t)}catch{return}let g=e;for(;;){if(existsSync(g)){let t;try{t=realpathSync(g)}catch(t){throw t.code===`ELOOP`?new SeedRootDirError(`entry path traverses a symlink cycle: ${e}`):t}if(t!==s&&!t.startsWith(s+sep))throw new SeedRootDirError(`entry path resolves outside the project directory via symlink: ${e}`);return}let t=dirname(g);if(t===g)throw new SeedRootDirError(`entry path has no existing ancestor inside the project directory: ${e}`);g=t}}const DEFAULT_PACK_ID=`knowledge-base`,KNOWLEDGE_BASE_FOLDERS=[{path:`external-sources`,title:`External Sources`,description:"Raw sources saved verbatim — the fetched text of URLs, extracted PDFs, and copied files, each with the original URL and access date in frontmatter. Produced by `ingest`. Immutable after capture; no analysis here (that goes in `research/`).",tags:[`source`,`immutable`,`layer-ingest`],starterTemplate:`clip`},{path:`research`,title:`Research`,description:"Provisional analysis that synthesizes the external sources. Every claim cites a doc in `external-sources/`; `status: provisional`. Promoted to `articles/` via `consolidate` once the findings are stable.",tags:[`research`,`provisional`,`layer-research`],starterTemplate:`research-log`},{path:`articles`,title:`Articles`,description:"Canonical knowledge, committed after a team decision. The source of truth for the domain; carries a `supersedes:` chain back to the `research/` docs it replaces.",tags:[`article`,`canonical`,`layer-consolidate`],starterTemplate:`article`}],KNOWLEDGE_BASE_TEMPLATES={clip:`---
958
+ `);E=t.pop()??``;for(let e of t)F(e)}),k.stderr.on(`data`,t=>{D.push(t),e.onStderr?.(t)}),{done:new Promise(e=>{k.on(`close`,t=>{clearTimeout(j),E.trim()&&F(E),E=``,e({code:t,stderr:Buffer.concat(D).toString(`utf-8`).trim(),timedOut:S,cancelled:w})}),k.on(`error`,t=>{clearTimeout(j),D.push(Buffer.from(t.message,`utf-8`)),e({code:-1,stderr:Buffer.concat(D).toString(`utf-8`).trim(),timedOut:S,cancelled:w})})}),cancel:()=>{if(!w&&(w=!0,!k.killed))try{k.kill(`SIGTERM`)}catch{}}}}const DEFAULT_TIMEOUT_MS$3=600*1e3;function asAuthEvent(e){let t=e.type;return t===`verification`?typeof e.user_code==`string`&&typeof e.verification_uri==`string`&&typeof e.expires_in==`number`?{type:`verification`,user_code:e.user_code,verification_uri:e.verification_uri,expires_in:e.expires_in}:null:t===`complete`?{type:`complete`,host:typeof e.host==`string`?e.host:``,login:typeof e.login==`string`?e.login:``,name:typeof e.name==`string`?e.name:void 0,email:typeof e.email==`string`?e.email:void 0,avatarUrl:typeof e.avatarUrl==`string`?e.avatarUrl:void 0}:t===`error`?{type:`error`,message:typeof e.message==`string`?e.message:`Unknown error`}:null}function runDeviceFlowSubprocess(e){let t=e.host??`github.com`,s=e.timeoutMs??DEFAULT_TIMEOUT_MS$3,g=!1,S=runSubprocess({cliArgs:e.cliArgs,trailingArgs:[`auth`,`login`,`--json`,`--host`,t],timeoutMs:s,onLine:({parsed:t})=>{if(!t)return;let s=asAuthEvent(t);s&&((s.type===`complete`||s.type===`error`)&&(g=!0),e.onEvent(s))}});return{done:S.done.then(s=>{g||(s.code===0?e.onEvent({type:`complete`,host:t,login:``}):e.onEvent({type:`error`,message:s.timedOut?`Sign-in timed out`:`auth login exited with code ${s.code??-1}`}))}),cancel:S.cancel}}const DEFAULT_TIMEOUT_MS$2=3e4;async function runAuthStatusSubprocess(e){let t=e.host??`github.com`,s=[],g=await runSubprocess({cliArgs:e.cliArgs,trailingArgs:[`auth`,`status`,`--json`,`--host`,t],timeoutMs:e.timeoutMs??DEFAULT_TIMEOUT_MS$2,onLine:({parsed:e})=>{e&&s.push(e)}}).done;for(let e=s.length-1;e>=0;e--){let g=s[e];if(g.type!==`status`)continue;let S=typeof g.host==`string`?g.host:t;if(g.authenticated===!0&&typeof g.login==`string`){let e=g.tier===`A`||g.tier===`B`||g.tier===`C`?g.tier:void 0;return{authenticated:!0,host:S,login:g.login,tier:e,name:typeof g.name==`string`?g.name:void 0,email:typeof g.email==`string`?g.email:void 0}}return{authenticated:!1,host:S,error:typeof g.error==`string`?g.error:void 0}}return{authenticated:!1,host:t,error:g.timedOut?`auth status timed out`:g.code===0?void 0:g.stderr||`auth status exited with code ${g.code??-1}`}}async function runAuthReposSubprocess(e){let t=e.host??`github.com`,s=[],g=await runSubprocess({cliArgs:e.cliArgs,trailingArgs:[`auth`,`repos`,`--json`,`--host`,t],timeoutMs:e.timeoutMs??DEFAULT_TIMEOUT_MS$2,onLine:({parsed:e})=>{e&&s.push(e)}}).done;if(g.timedOut)return{ok:!1,error:`auth repos timed out`};if(g.code!==0)return{ok:!1,error:g.stderr||`auth repos exited with code ${g.code??-1}`};for(let e=s.length-1;e>=0;e--){let g=s[e];if(g.type!==`repos`||!Array.isArray(g.repos))continue;let S=[];for(let e of g.repos){if(!e||typeof e!=`object`)continue;let t=e;typeof t.full_name!=`string`||typeof t.clone_url!=`string`||S.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof g.host==`string`?g.host:t,repos:S}}return{ok:!1,error:`auth repos returned no data`}}const GENERIC_TITLE=`Clone subprocess reported an error.`,MAX_DETAIL_LEN=500;function classifyCloneError(e){let t=redactShareSubprocessStderr(e).trim().slice(0,MAX_DETAIL_LEN);return t.length===0?{title:GENERIC_TITLE,detail:``}:/repository not found|returned error:\s*404/i.test(t)?{title:`Can't access this repository. It may be private, or you may not have access.`,detail:t}:/permission denied|access denied|returned error:\s*403/i.test(t)?{title:`You don't have access to this repository.`,detail:t}:/authentication failed/i.test(t)?{title:`GitHub authentication failed. Try signing in again.`,detail:t}:{title:GENERIC_TITLE,detail:t}}const GIT_PREFLIGHT_FAIL_SPAN_NAME=`ok.preflight.git.fail`;function emitPreflightFailureSpan(e){let t=e instanceof GitTooOldError?`too_old`:`not_available`,s=e instanceof GitTooOldError?e.detected:``;withSpanSync(GIT_PREFLIGHT_FAIL_SPAN_NAME,{attributes:{"ok.platform":e.platform,"ok.preflight.git.reason":t,"ok.preflight.git.detected_version":s}},()=>{})}const log$8=getLogger(`clone-flow`),DEFAULT_TIMEOUT_MS$1=600*1e3;function validateCloneInputs(e,t){return isAllowedGitUrl(e)?isSafeLocalPath(t)?{ok:!0}:{ok:!1,reason:`invalid-dir`}:{ok:!1,reason:`invalid-url`}}function asRawCloneEvent(e){let t=e.type;return t===`progress`?typeof e.phase==`string`&&typeof e.pct==`number`?{type:`progress`,phase:e.phase,pct:e.pct}:null:t===`complete`?typeof e.dir==`string`?{type:`complete`,dir:e.dir}:null:t===`branch-fallback`?typeof e.branch==`string`&&e.branch.length>0?{type:`branch-fallback`,branch:e.branch}:null:t===`error`?{type:`error`,message:typeof e.message==`string`?e.message:`Unknown error`}:null}function runCloneSubprocess(e){let t=expandTilde(e.dir),s=e.timeoutMs??DEFAULT_TIMEOUT_MS$1,g;try{g=assertGitAvailable()}catch(t){t instanceof GitNotAvailableError||t instanceof GitTooOldError?(emitPreflightFailureSpan(t),log$8.warn({event:`git_preflight_fail`,platform:t.platform,reason:t instanceof GitTooOldError?`too_old`:`not_available`,detectedVersion:t instanceof GitTooOldError?t.detected:``},t instanceof GitTooOldError?`git binary too old`:`git binary not found`)):log$8.error({event:`clone_preflight_unexpected_error`,err:t},`unexpected error during clone preflight`);let s=t instanceof Error?t.message:String(t);return{done:Promise.resolve().then(()=>{e.onEvent({type:`error`,message:s})}),cancel:()=>{}}}let S=isAbsolute(g.resolvedPath)?[dirname(g.resolvedPath)]:[],w=!1,E=typeof e.branch==`string`&&e.branch.length>0?[`-b`,e.branch]:[],D=runSubprocess({cliArgs:e.cliArgs,trailingArgs:[`clone`,`--json`,...E,e.url,t],extraPathDirs:S,timeoutMs:s,onLine:({parsed:t})=>{if(!t)return;let s=asRawCloneEvent(t);s&&((s.type===`complete`||s.type===`error`)&&(w=!0),e.onEvent(s))}});return{done:D.done.then(s=>{if(!w){if(s.timedOut){e.onEvent({type:`error`,message:`Clone timed out after 10 minutes`});return}if(s.code!==0){let t=s.stderr?` — ${s.stderr}`:``;e.onEvent({type:`error`,message:`Clone process exited with code ${s.code??-1}${t}`});return}e.onEvent({type:`complete`,dir:t})}}),cancel:D.cancel}}function isLoopbackAddress(e){return e?!!(e===`::1`||e.startsWith(`::ffff:127.`)||e.startsWith(`127.`)):!1}function isAllowedWorkspaceHostHeader(e){if(!e)return!1;if(e.startsWith(`[`)){let t=e.indexOf(`]`);if(t<0)return!1;let s=e.slice(1,t),g=e.slice(t+1);return g!==``&&!/^:\d+$/.test(g)?!1:s===`::1`}let t=e.lastIndexOf(`:`),s=t>=0?e.slice(0,t):e,g=t>=0?e.slice(t+1):null;return g!==null&&!/^\d+$/.test(g)?!1:!!(s===`localhost`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(s))}const MANAGED_RENAME_JOURNAL_FILENAME=`managed-rename.json`;function journalDir(e){return getLocalDir(e)}function managedRenameJournalPath(e){return resolve(journalDir(e),MANAGED_RENAME_JOURNAL_FILENAME)}function createManagedRenameRecoveryJournal(e){let t={version:2,fromPath:e.fromPath,toPath:e.toPath,affectedDocs:e.affectedDocs,createdAt:e.createdAt??new Date().toISOString(),snapshots:e.snapshots};return e.pathSnapshots&&e.pathSnapshots.length>0&&(t.pathSnapshots=e.pathSnapshots),e.cleanupPaths&&e.cleanupPaths.length>0&&(t.cleanupPaths=e.cleanupPaths),t}function isManagedRenameSnapshot(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.docName==`string`&&typeof t.content==`string`}function isManagedRenamePathSnapshot(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.path==`string`&&typeof t.content==`string`}function isManagedRenameCleanupPath(e){return typeof e==`string`&&e.length>0}function isManagedRenameAffectedDoc(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.from==`string`&&typeof t.to==`string`}function parseV2(e){if(typeof e.fromPath!=`string`||e.fromPath.length===0)throw Error(`Managed rename journal v2 is missing fromPath`);if(typeof e.toPath!=`string`||e.toPath.length===0)throw Error(`Managed rename journal v2 is missing toPath`);if(typeof e.createdAt!=`string`||e.createdAt.length===0)throw Error(`Managed rename journal v2 is missing createdAt`);let t=e.affectedDocs,s=e.pathSnapshots,g=e.cleanupPaths,S=Array.isArray(s)&&s.length>0,w=Array.isArray(g)&&g.length>0;if(!Array.isArray(t)||!t.every(isManagedRenameAffectedDoc)||t.length===0&&!S&&!w)throw Error(`Managed rename journal v2 has invalid affectedDocs`);if(!Array.isArray(e.snapshots)||t.length>0&&e.snapshots.length===0||!e.snapshots.every(isManagedRenameSnapshot))throw Error(`Managed rename journal v2 has invalid snapshots`);if(s!==void 0&&(!Array.isArray(s)||!s.every(isManagedRenamePathSnapshot)))throw Error(`Managed rename journal v2 has invalid pathSnapshots`);if(g!==void 0&&(!Array.isArray(g)||!g.every(isManagedRenameCleanupPath)))throw Error(`Managed rename journal v2 has invalid cleanupPaths`);for(let s of t)if(!e.snapshots.some(e=>e.docName===s.from))throw Error(`Managed rename journal v2 is missing snapshot for affected doc: ${s.from}`);return{version:2,fromPath:e.fromPath,toPath:e.toPath,affectedDocs:t,createdAt:e.createdAt,snapshots:e.snapshots,...S?{pathSnapshots:s}:{},...w?{cleanupPaths:g}:{}}}function parseV1(e){if(typeof e.sourceDocName!=`string`||e.sourceDocName.length===0)throw Error(`Managed rename journal v1 is missing sourceDocName`);if(typeof e.destinationDocName!=`string`||e.destinationDocName.length===0)throw Error(`Managed rename journal v1 is missing destinationDocName`);if(typeof e.createdAt!=`string`||e.createdAt.length===0)throw Error(`Managed rename journal v1 is missing createdAt`);if(!Array.isArray(e.snapshots)||e.snapshots.length===0||!e.snapshots.every(isManagedRenameSnapshot))throw Error(`Managed rename journal v1 has invalid snapshots`);if(!e.snapshots.some(t=>t.docName===e.sourceDocName))throw Error(`Managed rename journal v1 must include the source document snapshot`);return{version:1,sourceDocName:e.sourceDocName,destinationDocName:e.destinationDocName,createdAt:e.createdAt,snapshots:e.snapshots}}function parseManagedRenameRecoveryJournal(e){if(!e||typeof e!=`object`)throw Error(`Managed rename journal must be an object`);let t=e;if(t.version===2)return parseV2(t);if(t.version===1)return parseV1(t);throw Error(`Unsupported managed rename journal version: ${String(t.version)}`)}function readManagedRenameJournal(e){let t=managedRenameJournalPath(e);if(!existsSync(t))return null;try{let e=readFileSync(t,`utf-8`);return parseManagedRenameRecoveryJournal(JSON.parse(e))}catch(e){throw Error(`Managed rename journal at ${t} is corrupt: ${e instanceof Error?e.message:String(e)}`)}}function writeManagedRenameJournal(e,t){let s=managedRenameJournalPath(e);tracedMkdirSync(dirname(s),{recursive:!0});let g=`${s}.tmp`;tracedWriteFileSync(g,JSON.stringify(t,null,2),`utf-8`),tracedRenameSync(g,s)}function clearManagedRenameJournal(e){tracedRmSync(managedRenameJournalPath(e),{force:!0})}async function withManagedRenameRecovery(e,t,s){writeManagedRenameJournal(e,t);let g=await s();return clearManagedRenameJournal(e),g}function destinationsToCleanV1(e){return[e.destinationDocName]}function destinationsToCleanV2(e){return e.affectedDocs.map(e=>e.to)}function resolveRecoveryPath(e,t){let s=resolve(e),g=resolve(s,t);if(t.includes(`\0`)||g===s||!g.startsWith(`${s}${sep}`))throw Error(`Invalid recovery path: ${t}`);return g}function pruneEmptyAncestors(e,t){let s=resolve(t),g=`${s}${sep}`,S=dirname(e);for(;S.startsWith(g)&&S!==s;){let e;try{e=readdirSync(S)}catch(e){console.warn(`[managed-rename] pruneEmptyAncestors: cannot read ${S}:`,e);return}if(e.length>0)return;try{tracedRmdirSync(S)}catch(e){console.warn(`[managed-rename] pruneEmptyAncestors: cannot rmdir ${S}:`,e);return}S=dirname(S)}}function recoverPendingManagedRename(e,t=e){let s=readManagedRenameJournal(t);if(!s)return{recovered:!1,journal:null,restoredDocNames:[]};let g=new Set,S=new Set,w=[];for(let t of s.snapshots)try{let s=safeContentPath(t.docName,e);tracedMkdirSync(dirname(s),{recursive:!0}),tracedWriteFileSync(s,t.content,`utf-8`),g.add(t.docName)}catch(e){w.push({docName:t.docName,cause:e}),console.warn(`[managed-rename] Failed to restore ${t.docName}:`,e)}if(w.length>0){let e=w.map(e=>e.docName).join(`, `);console.warn(`[managed-rename] Recovery incomplete; keeping journal for retry (${e})`);let t=w.map(e=>e.cause instanceof Error?e.cause:Error(String(e.cause)));throw AggregateError(t,`Managed rename recovery incomplete; failed to restore: ${e}`)}if(s.version===2){let t=[];for(let g of s.pathSnapshots??[])try{let t=resolveRecoveryPath(e,g.path);tracedMkdirSync(dirname(t),{recursive:!0}),tracedWriteFileSync(t,g.content,`utf-8`),S.add(g.path)}catch(e){t.push({path:g.path,cause:e}),console.warn(`[managed-rename] Failed to restore path ${g.path}:`,e)}if(t.length>0){let e=t.map(e=>e.path).join(`, `);console.warn(`[managed-rename] Recovery incomplete; keeping journal for retry (${e})`);let s=t.map(e=>e.cause instanceof Error?e.cause:Error(String(e.cause)));throw AggregateError(s,`Managed rename recovery incomplete; failed to restore paths: ${e}`)}}let E=s.version===2?destinationsToCleanV2(s):destinationsToCleanV1(s),D=[];for(let t of E){if(g.has(t))continue;let s=safeContentPath(t,e);try{tracedRmSync(s,{force:!0}),pruneEmptyAncestors(s,e)}catch(e){existsSync(s)&&console.warn(`[managed-rename] Both source and destination files exist after partial recovery for ${t}`),console.warn(`[managed-rename] Recovery incomplete; failed to clean destination ${t}:`,e),D.push({destination:t,cause:e})}}if(s.version===2)for(let t of s.cleanupPaths??[]){if(S.has(t))continue;let s=null;try{s=resolveRecoveryPath(e,t),tracedRmSync(s,{force:!0}),pruneEmptyAncestors(s,e)}catch(e){s&&existsSync(s)&&console.warn(`[managed-rename] Both source and destination paths exist after partial recovery for ${t}`),console.warn(`[managed-rename] Recovery incomplete; failed to clean destination path ${t}:`,e),D.push({destination:t,cause:e})}}if(D.length>0){let e=D.map(e=>e.destination).join(`, `),t=D.map(e=>e.cause instanceof Error?e.cause:Error(String(e.cause)));throw AggregateError(t,`Managed rename recovery incomplete; failed to clean destinations: ${e}`)}return clearManagedRenameJournal(t),{recovered:!0,journal:s,restoredDocNames:[...g].sort((e,t)=>e.localeCompare(t))}}const PROJECT_SKILL_EDITOR_LABELS={claude:`Claude Code`,cursor:`Cursor`,codex:`Codex`},PLATFORM_SKILL_NAME=BUNDLE_SKILL_NAME.project;function resolvePackSkillSource(e){let t;try{t=resolveBundledSkillDir(`packs/${e}`,{checkDesktop:!0})}catch{return null}return{name:`open-knowledge-pack-${e}`,sourceDir:t}}async function installPackSkill(e,t){let s=resolvePackSkillSource(t);if(!s)return[];let{name:g,sourceDir:S}=s,w=join(e,`.ok`,`skills`,g);if(!existsSync(join(w,`SKILL.md`)))try{tracedRmSync(w,{recursive:!0,force:!0}),tracedMkdirSync(join(e,`.ok`,`skills`),{recursive:!0}),tracedCpSync(S,w,{recursive:!0})}catch(e){return getLogger(`seed`).warn({err:e,packId:t,okSkillDir:w},`pack skill source authoring failed — skill not installed`),[]}let E=projectSkill(w,g,e,PROJECT_SKILL_EDITOR_IDS.filter(t=>{let s=EDITOR_PROJECT_SKILL_ROOT[t];return s===null?!1:existsSync(join(e,s,PLATFORM_SKILL_NAME,`SKILL.md`))})),D=E.map(e=>PROJECT_SKILL_EDITOR_LABELS[e]??e);if(E.length>0)try{await recordSkillInstall(e,g,{hosts:E,scope:`project`,scripts:existsSync(join(w,`scripts`)),installedAt:new Date().toISOString()})}catch{}return D}var SeedPrerequisiteError=class extends Error{constructor(e){super(e),this.name=`SeedPrerequisiteError`}},SeedRootDirError=class extends Error{constructor(e){super(e),this.name=`SeedRootDirError`}};function assertEntryPathInProject(e,t){if(typeof t!=`string`||t===``)throw new SeedRootDirError(`entry path must be a non-empty string, got: ${typeof t}`);if(t.includes(`\0`))throw new SeedRootDirError(`entry path must not contain null bytes`);if(isAbsolute(t))throw new SeedRootDirError(`entry path must be relative, got: ${t}`);if(t.split(/[/\\]/).some(e=>e===`..`))throw new SeedRootDirError(`entry path must not contain '..' segments, got: ${t}`);let s=resolve(e),g=resolve(s,t);if(g!==s&&!g.startsWith(s+sep))throw new SeedRootDirError(`entry path must resolve inside the project directory, got: ${t}`);return assertNoSymlinkEscape$1(g,s),g}function assertNoSymlinkEscape$1(e,t){let s;try{s=realpathSync(t)}catch{return}let g=e;for(;;){if(existsSync(g)){let t;try{t=realpathSync(g)}catch(t){throw t.code===`ELOOP`?new SeedRootDirError(`entry path traverses a symlink cycle: ${e}`):t}if(t!==s&&!t.startsWith(s+sep))throw new SeedRootDirError(`entry path resolves outside the project directory via symlink: ${e}`);return}let t=dirname(g);if(t===g)throw new SeedRootDirError(`entry path has no existing ancestor inside the project directory: ${e}`);g=t}}const DEFAULT_PACK_ID=`knowledge-base`,KNOWLEDGE_BASE_FOLDERS=[{path:`external-sources`,title:`External Sources`,uiSummary:`The original sources, saved word-for-word.`,description:"Raw sources saved verbatim — the fetched text of URLs, extracted PDFs, and copied files, each with the original URL and access date in frontmatter. Produced by `ingest`. Immutable after capture; no analysis here (that goes in `research/`).",tags:[`source`,`immutable`,`layer-ingest`],starterTemplate:`clip`},{path:`research`,title:`Research`,uiSummary:`Your work-in-progress take on what the sources mean.`,description:"Provisional analysis that synthesizes the external sources. Every claim cites a doc in `external-sources/`; `status: provisional`. Promoted to `articles/` via `consolidate` once the findings are stable.",tags:[`research`,`provisional`,`layer-research`],starterTemplate:`research-log`},{path:`articles`,title:`Articles`,uiSummary:`The finished, trusted version you can rely on.`,description:"Canonical knowledge, committed after a team decision. The source of truth for the domain; carries a `supersedes:` chain back to the `research/` docs it replaces.",tags:[`article`,`canonical`,`layer-consolidate`],starterTemplate:`article`}],KNOWLEDGE_BASE_TEMPLATES={clip:`---
959
959
  template:
960
960
  title: External Source
961
961
  description: Capture a URL or article text verbatim as raw reference material. For binary files (PDFs, images, audio), use the \`ingest\` tool instead — this \`clip\` template is for text sources only.
@@ -1018,7 +1018,7 @@ description: Append-only audit trail of changes to this knowledge base.
1018
1018
  # Work Log
1019
1019
 
1020
1020
  Append-only audit trail. Add one dated entry per turn that creates, edits, or restructures content. The knowledge-base skill describes what to log and the entry shape.
1021
- `,SOFTWARE_LIFECYCLE_FOLDERS=[{path:`proposals`,title:`Proposals`,description:"In-flight design proposals (RFC-shape), one file per proposal (`0001-feature-name.md`). Status flows `draft → fcp → accepted/rejected`; accepted proposals graduate to a record in `decisions/`.",tags:[`proposal`,`design`,`in-flight`],starterTemplate:`proposal`},{path:`decisions`,title:`Decisions`,description:"Architecture Decision Records (MADR / Nygard shape), frozen once accepted. One file per decision (`NNNN-title.md`); a new decision links back via `Supersedes:` to the one it replaces.",tags:[`decision`,`adr`,`frozen`],starterTemplate:`decision`},{path:`specs`,title:`Specs`,description:"Implementation specs derived from accepted proposals. Prefer the `github/spec-kit` triple — one folder per spec with `spec.md` + `plan.md` + `tasks.md` (the folder ships all three templates). References the parent proposal.",tags:[`spec`,`implementation`],starterTemplate:`spec`,extraTemplates:[`spec-plan`,`spec-tasks`]},{path:`postmortems`,title:`Postmortems`,description:"Blameless incident write-ups, one file per incident (`YYYY-MM-DD-name.md`): Summary / Timeline / Root cause / What went well / Action items (Google SRE shape).",tags:[`postmortem`,`incident`,`blameless`],starterTemplate:`postmortem`},{path:`guides`,title:`Guides`,description:'How-to guides, onboarding docs, and service runbooks (Diátaxis "how-to"). Ships `guide`, `onboarding-guide`, and `runbook` templates; carries `last_verified`.',tags:[`guide`,`how-to`,`onboarding`],starterTemplate:`guide`,extraTemplates:[`onboarding-guide`,`runbook`]}],SOFTWARE_LIFECYCLE_TEMPLATES={proposal:`---
1021
+ `,SOFTWARE_LIFECYCLE_FOLDERS=[{path:`proposals`,title:`Proposals`,uiSummary:`Ideas you're putting forward for discussion.`,description:"In-flight design proposals (RFC-shape), one file per proposal (`0001-feature-name.md`). Status flows `draft → fcp → accepted/rejected`; accepted proposals graduate to a record in `decisions/`.",tags:[`proposal`,`design`,`in-flight`],starterTemplate:`proposal`},{path:`decisions`,title:`Decisions`,uiSummary:`Decisions you've made, and why.`,description:"Architecture Decision Records (MADR / Nygard shape), frozen once accepted. One file per decision (`NNNN-title.md`); a new decision links back via `Supersedes:` to the one it replaces.",tags:[`decision`,`adr`,`frozen`],starterTemplate:`decision`},{path:`specs`,title:`Specs`,uiSummary:`Detailed plans for what you're building.`,description:"Implementation specs derived from accepted proposals. Prefer the `github/spec-kit` triple — one folder per spec with `spec.md` + `plan.md` + `tasks.md` (the folder ships all three templates). References the parent proposal.",tags:[`spec`,`implementation`],starterTemplate:`spec`,extraTemplates:[`spec-plan`,`spec-tasks`]},{path:`postmortems`,title:`Postmortems`,uiSummary:`Write-ups of what broke and what you learned.`,description:"Blameless incident write-ups, one file per incident (`YYYY-MM-DD-name.md`): Summary / Timeline / Root cause / What went well / Action items (Google SRE shape).",tags:[`postmortem`,`incident`,`blameless`],starterTemplate:`postmortem`},{path:`guides`,title:`Guides`,uiSummary:`How-to guides, onboarding, and runbooks.`,description:'How-to guides, onboarding docs, and service runbooks (Diátaxis "how-to"). Ships `guide`, `onboarding-guide`, and `runbook` templates; carries `last_verified`.',tags:[`guide`,`how-to`,`onboarding`],starterTemplate:`guide`,extraTemplates:[`onboarding-guide`,`runbook`]}],SOFTWARE_LIFECYCLE_TEMPLATES={proposal:`---
1022
1022
  template:
1023
1023
  title: Proposal Title
1024
1024
  description: One-line summary of the proposal.
@@ -1209,7 +1209,7 @@ tags: [postmortem]
1209
1209
  ## What went well
1210
1210
 
1211
1211
  ## Action items
1212
- `},CODEBASE_WIKI_FOLDERS=[{path:`wiki/architecture`,title:`Architecture`,description:"System boundaries, layers, subsystems, and cross-cutting concerns — the big-picture structure. One page per architectural area, each with a `mermaid` system-context or component diagram, the key components, and the design decisions behind them. Uses the `architecture-page` template. Cross-link the modules and flows each area touches. Reference source files per the wiki source-reference convention (relative links + symbol code-spans for `internal`; GitHub blob URLs for `public`).",tags:[`wiki`,`architecture`],starterTemplate:`architecture-page`},{path:`wiki/modules`,title:`Modules`,description:"One page per package or module: purpose, responsibilities, public API / entry points, key files (linked per the source-reference convention), dependencies, and the flows it participates in. Uses the `module-page` template. At `depth: tour` these fold into the architecture pages; at `standard`+ each package gets its own page. Cross-link concepts and flows.",tags:[`wiki`,`module`],starterTemplate:`module-page`},{path:`wiki/flows`,title:`Flows`,description:"Key end-to-end flows as `mermaid` sequence or flow diagrams plus narrative — how a request, job, or interaction moves through the system. Uses the `flow-page` template; record failure modes at `depth: exhaustive`. Link every module and concept the flow crosses.",tags:[`wiki`,`flow`],starterTemplate:`flow-page`},{path:`wiki/concepts`,title:`Concepts`,description:"Glossary of atomic pages for domain terms and core abstractions — the vocabulary a newcomer needs. Uses the `concept-page` template: definition, why it matters, where it lives in the code. Keep pages small and densely cross-linked so concepts become hubs for everywhere they appear.",tags:[`wiki`,`concept`],starterTemplate:`concept-page`},{path:`wiki/guides`,title:`Guides`,description:'Task-oriented "how / where do I change X" walkthroughs. Uses the `guide-page` template: goal, steps, relevant code, gotchas. Populated at `depth: standard` and rich at `exhaustive`; thin or empty at `tour`. Link the modules and flows each guide touches.',tags:[`wiki`,`guide`,`how-to`],starterTemplate:`guide-page`}],CODEBASE_WIKI_TEMPLATES={"architecture-page":`---
1212
+ `},CODEBASE_WIKI_FOLDERS=[{path:`wiki/architecture`,title:`Architecture`,uiSummary:`The big-picture structure of your codebase.`,description:"System boundaries, layers, subsystems, and cross-cutting concerns — the big-picture structure. One page per architectural area, each with a `mermaid` system-context or component diagram, the key components, and the design decisions behind them. Uses the `architecture-page` template. Cross-link the modules and flows each area touches. Reference source files per the wiki source-reference convention (relative links + symbol code-spans for `internal`; GitHub blob URLs for `public`).",tags:[`wiki`,`architecture`],starterTemplate:`architecture-page`},{path:`wiki/modules`,title:`Modules`,uiSummary:`What each package or module does.`,description:"One page per package or module: purpose, responsibilities, public API / entry points, key files (linked per the source-reference convention), dependencies, and the flows it participates in. Uses the `module-page` template. At `depth: tour` these fold into the architecture pages; at `standard`+ each package gets its own page. Cross-link concepts and flows.",tags:[`wiki`,`module`],starterTemplate:`module-page`},{path:`wiki/flows`,title:`Flows`,uiSummary:`How key actions move through the system.`,description:"Key end-to-end flows as `mermaid` sequence or flow diagrams plus narrative — how a request, job, or interaction moves through the system. Uses the `flow-page` template; record failure modes at `depth: exhaustive`. Link every module and concept the flow crosses.",tags:[`wiki`,`flow`],starterTemplate:`flow-page`},{path:`wiki/concepts`,title:`Concepts`,uiSummary:`Plain definitions of the terms and ideas in your code.`,description:"Glossary of atomic pages for domain terms and core abstractions — the vocabulary a newcomer needs. Uses the `concept-page` template: definition, why it matters, where it lives in the code. Keep pages small and densely cross-linked so concepts become hubs for everywhere they appear.",tags:[`wiki`,`concept`],starterTemplate:`concept-page`},{path:`wiki/guides`,title:`Guides`,uiSummary:`How and where to make common changes.`,description:'Task-oriented "how / where do I change X" walkthroughs. Uses the `guide-page` template: goal, steps, relevant code, gotchas. Populated at `depth: standard` and rich at `exhaustive`; thin or empty at `tour`. Link the modules and flows each guide touches.',tags:[`wiki`,`guide`,`how-to`],starterTemplate:`guide-page`}],CODEBASE_WIKI_TEMPLATES={"architecture-page":`---
1213
1213
  template:
1214
1214
  title: Architecture Page
1215
1215
  description: One subsystem, layer, or cross-cutting concern — boundaries, a diagram, and the key components.
@@ -1331,7 +1331,7 @@ description: Append-only audit trail of wiki generation and refresh runs.
1331
1331
  # Wiki Log
1332
1332
 
1333
1333
  Append-only audit trail. Add one dated entry per generation or refresh run, recording the profile, the \`source_commit\` it was anchored to, and the coverage. The codebase-wiki skill describes the entry shape.
1334
- `,PLAIN_NOTES_FOLDERS=[{path:`notes`,title:`Notes`,description:`Flat notes, one file per topic. The "I just want to write" home base — link freely and the graph builds itself.`,tags:[`notes`,`flat`],starterTemplate:`note`},{path:`daily`,title:`Daily`,description:"Daily journal entries, one file per day (`YYYY-MM-DD.md`): morning intentions, evening reflection.",tags:[`daily`,`journal`],starterTemplate:`daily`}],PLAIN_NOTES_TEMPLATES={note:`---
1334
+ `,PLAIN_NOTES_FOLDERS=[{path:`notes`,title:`Notes`,uiSummary:`One file per topic. Just write.`,description:`Flat notes, one file per topic. The "I just want to write" home base — link freely and the graph builds itself.`,tags:[`notes`,`flat`],starterTemplate:`note`},{path:`daily`,title:`Daily`,uiSummary:`One journal entry per day.`,description:"Daily journal entries, one file per day (`YYYY-MM-DD.md`): morning intentions, evening reflection.",tags:[`daily`,`journal`],starterTemplate:`daily`}],PLAIN_NOTES_TEMPLATES={note:`---
1335
1335
  template:
1336
1336
  title: Note title
1337
1337
  description: One-line summary.
@@ -1365,7 +1365,7 @@ tags: [daily]
1365
1365
  - What shipped:
1366
1366
  - What stalled:
1367
1367
  - Gratitude:
1368
- `},WORLDBUILDING_FOLDERS=[{path:`characters`,title:`Characters`,description:"One file per character (PC + NPC); frontmatter carries `type`, status, faction, first appearance.",tags:[`character`,`fiction`,`entity`],starterTemplate:`character`},{path:`settings`,title:`Settings`,description:`Locations, regions, and world-rules — the "where" of the story. Frontmatter carries region, controlling faction, danger level.`,tags:[`setting`,`location`,`world`],starterTemplate:`setting`},{path:`themes`,title:`Themes`,description:`Recurring narrative concerns (love, betrayal, identity) — the "why" of the story. Each entry captures the theme and its tension.`,tags:[`theme`,`narrative`,`meaning`],starterTemplate:`theme`},{path:`factions`,title:`Factions`,description:'Political, social, criminal, magical, or religious groups — the "who-vs-who" of the story. Ships `faction`, `political-faction`, and `religion` templates.',tags:[`faction`,`group`,`politics`],starterTemplate:`faction`,extraTemplates:[`political-faction`,`religion`]},{path:`lore`,title:`Lore`,description:"History, mythology, cosmology, and magic systems — the foundational fabric the story stands on. Ships `lore`, `magic-system`, and `historical-event` templates.",tags:[`lore`,`history`,`world`],starterTemplate:`lore`,extraTemplates:[`magic-system`,`historical-event`]}],WORLDBUILDING_TEMPLATES={character:`---
1368
+ `},WORLDBUILDING_FOLDERS=[{path:`characters`,title:`Characters`,uiSummary:`The people in your story.`,description:"One file per character (PC + NPC); frontmatter carries `type`, status, faction, first appearance.",tags:[`character`,`fiction`,`entity`],starterTemplate:`character`},{path:`settings`,title:`Settings`,uiSummary:`The places and regions of your world.`,description:`Locations, regions, and world-rules — the "where" of the story. Frontmatter carries region, controlling faction, danger level.`,tags:[`setting`,`location`,`world`],starterTemplate:`setting`},{path:`themes`,title:`Themes`,uiSummary:`The big ideas your story keeps returning to.`,description:`Recurring narrative concerns (love, betrayal, identity) — the "why" of the story. Each entry captures the theme and its tension.`,tags:[`theme`,`narrative`,`meaning`],starterTemplate:`theme`},{path:`factions`,title:`Factions`,uiSummary:`The groups and their rivalries.`,description:'Political, social, criminal, magical, or religious groups — the "who-vs-who" of the story. Ships `faction`, `political-faction`, and `religion` templates.',tags:[`faction`,`group`,`politics`],starterTemplate:`faction`,extraTemplates:[`political-faction`,`religion`]},{path:`lore`,title:`Lore`,uiSummary:`History, myth, and how the world works.`,description:"History, mythology, cosmology, and magic systems — the foundational fabric the story stands on. Ships `lore`, `magic-system`, and `historical-event` templates.",tags:[`lore`,`history`,`world`],starterTemplate:`lore`,extraTemplates:[`magic-system`,`historical-event`]}],WORLDBUILDING_TEMPLATES={character:`---
1369
1369
  template:
1370
1370
  title: Character Name
1371
1371
  description: One-line characterization.
@@ -1564,7 +1564,7 @@ tags: [lore, history]
1564
1564
  ## In-world tellings
1565
1565
 
1566
1566
  ## Source
1567
- `},WRITING_PIPELINE_FOLDERS=[{path:`ideas`,title:`Ideas`,description:"One-line ideas captured before they fade — premises, headlines, fragments. Not a draft folder; promote an idea into `drafts/` when you commit to writing it.",tags:[`idea`,`inbox`,`pre-draft`],starterTemplate:`idea`},{path:`drafts`,title:`Drafts`,description:"Active prose. Frontmatter tracks `status`, word count, and parent idea. CRDT history covers every revision, so no named-revision folders.",tags:[`draft`,`prose`],starterTemplate:`draft`},{path:`published`,title:`Published`,description:"Shipped work; carries `published_at`, `canonical_url`, `channel`. Treat as immutable — to revise, copy to a new draft.",tags:[`published`,`live`],starterTemplate:`published`}],WRITING_PIPELINE_TEMPLATES={idea:`---
1567
+ `},WRITING_PIPELINE_FOLDERS=[{path:`ideas`,title:`Ideas`,uiSummary:`Quick sparks to write about later.`,description:"One-line ideas captured before they fade — premises, headlines, fragments. Not a draft folder; promote an idea into `drafts/` when you commit to writing it.",tags:[`idea`,`inbox`,`pre-draft`],starterTemplate:`idea`},{path:`drafts`,title:`Drafts`,uiSummary:`Pieces you're actively writing.`,description:"Active prose. Frontmatter tracks `status`, word count, and parent idea. CRDT history covers every revision, so no named-revision folders.",tags:[`draft`,`prose`],starterTemplate:`draft`},{path:`published`,title:`Published`,uiSummary:`Finished work you've shared.`,description:"Shipped work; carries `published_at`, `canonical_url`, `channel`. Treat as immutable — to revise, copy to a new draft.",tags:[`published`,`live`],starterTemplate:`published`}],WRITING_PIPELINE_TEMPLATES={idea:`---
1568
1568
  template:
1569
1569
  title: Idea title
1570
1570
  description: One-line hook.
@@ -1606,7 +1606,7 @@ author: {{user}}
1606
1606
  tags: [published]
1607
1607
  ---
1608
1608
 
1609
- `},ENTITY_VAULT_FOLDERS=[{path:`people`,title:`People`,description:"Person dossiers. Compiled-truth section above `--- timeline ---` (rewritten as understanding changes); append-only timeline below using `- **YYYY-MM-DD** | source | @author — evidence` bullets. Frontmatter `type: person`. Prefer path-qualified links such as `[[companies/acme|Acme]]` and `[[meetings/2026-05-12-acme|meeting]]` when identity matters. Agent: when a meeting note mentions a person not yet captured, stub a file here; route new facts into either compiled-truth (current synthesis) or timeline (raw evidence). Never rewrite the timeline.",tags:[`person`,`entity`,`dossier`],starterTemplate:`person`},{path:`companies`,title:`Companies`,description:"Company dossiers. Same body convention as `people/`: compiled-truth above `--- timeline ---`, append-only parseable timeline below. Frontmatter `type: company`. Prefer path-qualified links to `people/`, `meetings/`, and `concepts/`. Agent: when a person dossier references a company not yet captured, stub a file here; surface company-to-person edges when both exist.",tags:[`company`,`entity`,`dossier`],starterTemplate:`company`},{path:`meetings`,title:`Meetings`,description:"Meeting notes. Filename `YYYY-MM-DD-<slug>.md`. Frontmatter carries `title`, `date`, `attendees:` (prefer person slugs/names that resolve to `people/` dossiers), and `type: meeting`. Body is raw notes with path-qualified links to the people, companies, and concepts mentioned. Agent: after a meeting note lands, extract entity mentions and append dated timeline bullets to each referenced dossier. Do NOT rewrite the meeting note; it is the verbatim record.",tags:[`meeting`,`note`],starterTemplate:`meeting`},{path:`concepts`,title:`Concepts`,description:'Evergreen idea pages: abstract patterns, frameworks, recurring concepts that surface across people / companies / meetings. Compiled-truth above `--- timeline ---`, append-only parseable timeline below. Frontmatter `type: concept`. Agent: when a meeting note or person dossier references a concept (e.g. "agent-runtime observability") not yet captured, stub a file here; thread path-qualified links so the concept becomes a hub for everywhere it appears.',tags:[`concept`,`idea`,`evergreen`],starterTemplate:`concept`},{path:`originals`,title:`Originals`,description:"Your own thinking, untransformed. Frontmatter `type: original`. Use freely; link to anything that should become its own entity. Agent: treat originals as authoritative source material when extracting facts; these are the user's words, not inferences. Append timeline entries to referenced dossiers when a clear new claim appears, citing the original by markdown link.",tags:[`original`,`thinking`,`user`],starterTemplate:`original`},{path:`media`,title:`Media`,description:"Bulk transcripts, voice notes, articles, large attachments. Frontmatter `type: transcript` (template provided). Often `.okignore`-d so the OK index stays light. Keep raw media/source material here; analysis belongs in dossiers, not here. If you also run Garry Tan's `gbrain`, import/sync can index these Markdown transcripts alongside the entity dossiers.",tags:[`media`,`transcript`,`bulk`],starterTemplate:`transcript`}],ENTITY_VAULT_TEMPLATES={person:`---
1609
+ `},ENTITY_VAULT_FOLDERS=[{path:`people`,title:`People`,uiSummary:`The people you know and work with.`,description:"Person dossiers. Compiled-truth section above `--- timeline ---` (rewritten as understanding changes); append-only timeline below using `- **YYYY-MM-DD** | source | @author — evidence` bullets. Frontmatter `type: person`. Prefer path-qualified links such as `[[companies/acme|Acme]]` and `[[meetings/2026-05-12-acme|meeting]]` when identity matters. Agent: when a meeting note mentions a person not yet captured, stub a file here; route new facts into either compiled-truth (current synthesis) or timeline (raw evidence). Never rewrite the timeline.",tags:[`person`,`entity`,`dossier`],starterTemplate:`person`},{path:`companies`,title:`Companies`,uiSummary:`The companies on your radar.`,description:"Company dossiers. Same body convention as `people/`: compiled-truth above `--- timeline ---`, append-only parseable timeline below. Frontmatter `type: company`. Prefer path-qualified links to `people/`, `meetings/`, and `concepts/`. Agent: when a person dossier references a company not yet captured, stub a file here; surface company-to-person edges when both exist.",tags:[`company`,`entity`,`dossier`],starterTemplate:`company`},{path:`meetings`,title:`Meetings`,uiSummary:`Notes from your meetings.`,description:"Meeting notes. Filename `YYYY-MM-DD-<slug>.md`. Frontmatter carries `title`, `date`, `attendees:` (prefer person slugs/names that resolve to `people/` dossiers), and `type: meeting`. Body is raw notes with path-qualified links to the people, companies, and concepts mentioned. Agent: after a meeting note lands, extract entity mentions and append dated timeline bullets to each referenced dossier. Do NOT rewrite the meeting note; it is the verbatim record.",tags:[`meeting`,`note`],starterTemplate:`meeting`},{path:`concepts`,title:`Concepts`,uiSummary:`Recurring ideas that connect people and companies.`,description:'Evergreen idea pages: abstract patterns, frameworks, recurring concepts that surface across people / companies / meetings. Compiled-truth above `--- timeline ---`, append-only parseable timeline below. Frontmatter `type: concept`. Agent: when a meeting note or person dossier references a concept (e.g. "agent-runtime observability") not yet captured, stub a file here; thread path-qualified links so the concept becomes a hub for everywhere it appears.',tags:[`concept`,`idea`,`evergreen`],starterTemplate:`concept`},{path:`originals`,title:`Originals`,uiSummary:`Your own raw thinking.`,description:"Your own thinking, untransformed. Frontmatter `type: original`. Use freely; link to anything that should become its own entity. Agent: treat originals as authoritative source material when extracting facts; these are the user's words, not inferences. Append timeline entries to referenced dossiers when a clear new claim appears, citing the original by markdown link.",tags:[`original`,`thinking`,`user`],starterTemplate:`original`},{path:`media`,title:`Media`,uiSummary:`Transcripts, voice notes, and long attachments.`,description:"Bulk transcripts, voice notes, articles, large attachments. Frontmatter `type: transcript` (template provided). Often `.okignore`-d so the OK index stays light. Keep raw media/source material here; analysis belongs in dossiers, not here. If you also run Garry Tan's `gbrain`, import/sync can index these Markdown transcripts alongside the entity dossiers.",tags:[`media`,`transcript`,`bulk`],starterTemplate:`transcript`}],ENTITY_VAULT_TEMPLATES={person:`---
1610
1610
  template:
1611
1611
  title: Person Name
1612
1612
  description: One-line characterization. Who they are, why they matter to you.
@@ -1838,7 +1838,7 @@ description: "When the agent does scheduled work: daily briefings, end-of-day do
1838
1838
 
1839
1839
  - Run OK's \`links({ kind: "dead" })\` across the vault. Triage redlinks into new entities (agents create dossiers through OK), typo fixes (OK edits in place), or removal (drop the link; a tracked task captures any future-doc intent).
1840
1840
 
1841
- `,OKF_FOLDERS=[{path:`concepts`,title:`Concepts`,description:"Durable ideas and definitions, one file per concept. Each doc carries `type: concept` in its frontmatter. Link related concepts so the graph builds itself.",tags:[`concept`,`okf`],starterTemplate:`concept`},{path:`references`,title:`References`,description:"External sources and citations you rely on, one file per source. Each doc carries `type: reference`. Link the docs that cite a reference so the evidence trail stays navigable.",tags:[`reference`,`okf`],starterTemplate:`reference`},{path:`notes`,title:`Notes`,description:"Working notes and observations, one file per note. Each doc carries `type: note`. The lightest section — capture first, link as ideas connect.",tags:[`note`,`okf`],starterTemplate:`note`}],OKF_TEMPLATES={concept:`---
1841
+ `,OKF_FOLDERS=[{path:`concepts`,title:`Concepts`,uiSummary:`Ideas and definitions worth keeping.`,description:"Durable ideas and definitions, one file per concept. Each doc carries `type: concept` in its frontmatter. Link related concepts so the graph builds itself.",tags:[`concept`,`okf`],starterTemplate:`concept`},{path:`references`,title:`References`,uiSummary:`Sources and citations you rely on.`,description:"External sources and citations you rely on, one file per source. Each doc carries `type: reference`. Link the docs that cite a reference so the evidence trail stays navigable.",tags:[`reference`,`okf`],starterTemplate:`reference`},{path:`notes`,title:`Notes`,uiSummary:`Working notes and observations.`,description:"Working notes and observations, one file per note. Each doc carries `type: note`. The lightest section — capture first, link as ideas connect.",tags:[`note`,`okf`],starterTemplate:`note`}],OKF_TEMPLATES={concept:`---
1842
1842
  template:
1843
1843
  title: Concept Name
1844
1844
  description: One-line definition of the concept.
@@ -1925,7 +1925,7 @@ Every document outside this file and \`log.md\` carries a non-empty \`type\` in
1925
1925
  `,OKF_LOG_MD=`# Log
1926
1926
 
1927
1927
  Change history for this knowledge base, newest entry first. Add a dated entry (\`## YYYY-MM-DD: <summary>\`) whenever you create, edit, or restructure content — one entry per working session, not per file.
1928
- `,STARTER_PACKS={"knowledge-base":{id:`knowledge-base`,name:`Knowledge base`,description:`Trusted articles from your sources.`,defaultSubfolder:`brain`,folders:KNOWLEDGE_BASE_FOLDERS,templates:KNOWLEDGE_BASE_TEMPLATES,rootFiles:{"log.md":KNOWLEDGE_BASE_LOG_MD}},"software-lifecycle":{id:`software-lifecycle`,name:`Software lifecycle`,description:`Proposals, decisions, and specs.`,defaultSubfolder:`project-docs`,folders:SOFTWARE_LIFECYCLE_FOLDERS,templates:SOFTWARE_LIFECYCLE_TEMPLATES},"codebase-wiki":{id:`codebase-wiki`,name:`Codebase wiki`,description:`A wiki to help navigate your codebase.`,defaultSubfolder:void 0,folders:CODEBASE_WIKI_FOLDERS,templates:CODEBASE_WIKI_TEMPLATES,rootFiles:{"wiki/OVERVIEW.md":CODEBASE_WIKI_OVERVIEW_MD,"wiki/log.md":CODEBASE_WIKI_LOG_MD}},"plain-notes":{id:`plain-notes`,name:`Plain notes`,description:`Notes and daily entries.`,defaultSubfolder:void 0,folders:PLAIN_NOTES_FOLDERS,templates:PLAIN_NOTES_TEMPLATES},okf:{id:`okf`,name:`Open Knowledge Format`,description:`Wiki using Google's Open Knowledge Format.`,defaultSubfolder:void 0,folders:OKF_FOLDERS,templates:OKF_TEMPLATES,rootFiles:{"welcome.md":OKF_WELCOME_MD,"index.md":OKF_INDEX_MD,"log.md":OKF_LOG_MD}},"writing-pipeline":{id:`writing-pipeline`,name:`Writing pipeline`,description:`From first draft to finished piece.`,defaultSubfolder:`writing`,folders:WRITING_PIPELINE_FOLDERS,templates:WRITING_PIPELINE_TEMPLATES},"entity-vault":{id:`entity-vault`,name:`Personal CRM`,description:`Track the people, companies, and meetings.`,defaultSubfolder:`vault`,folders:ENTITY_VAULT_FOLDERS,templates:ENTITY_VAULT_TEMPLATES,rootFiles:{"log.md":ENTITY_VAULT_LOG_MD,"USER.md":ENTITY_VAULT_USER_MD,"SOUL.md":ENTITY_VAULT_SOUL_MD,"ACCESS_POLICY.md":ENTITY_VAULT_ACCESS_POLICY_MD,"HEARTBEAT.md":ENTITY_VAULT_HEARTBEAT_MD}},worldbuilding:{id:`worldbuilding`,name:`Worldbuilding`,description:`A wiki for your story world.`,defaultSubfolder:`world`,folders:WORLDBUILDING_FOLDERS,templates:WORLDBUILDING_TEMPLATES}},STARTER_PACK_IDS=Object.keys(STARTER_PACKS);function resolvePack(e){return e&&STARTER_PACKS[e]||STARTER_PACKS[DEFAULT_PACK_ID]}function isKnownPackId(e){return typeof e==`string`&&STARTER_PACK_IDS.includes(e)}function coercePackId(e){return isKnownPackId(e)?e:void 0}function deriveFolderSummary(e){let t=e.trim(),s=(/^([^.!?]+[.!?])/.exec(t)?.[1]??t).trim();return s.length<=140?s:`${s.slice(0,137)}…`}function listStarterPacks(){return STARTER_PACK_IDS.map(e=>{let t=STARTER_PACKS[e];return{id:t.id,name:t.name,description:t.description,defaultSubfolder:t.defaultSubfolder,folders:t.folders.map(e=>({path:e.path,summary:deriveFolderSummary(e.description)})),entryCounts:computePackEntryCounts(t)}})}function computePackEntryCounts(e){let t=e.folders.length,s=0;for(let t of e.folders)s+=1+(t.extraTemplates?.length??0);return s+=e.rootFiles?Object.keys(e.rootFiles).length:0,{files:s,folders:t}}const STARTER_FOLDERS=KNOWLEDGE_BASE_FOLDERS,STARTER_TEMPLATES=KNOWLEDGE_BASE_TEMPLATES,LOG_MD_TEMPLATE=KNOWLEDGE_BASE_LOG_MD,STARTER_FOLDER_FRONTMATTER_FILENAME=`frontmatter.yml`;function buildStarterFolderFrontmatterYaml(e){let t=[];t.push(`title: ${yamlScalar(e.title)}`),t.push(`description: ${yamlScalar(e.description)}`),t.push(`tags:`);for(let s of e.tags)t.push(` - ${yamlScalar(s)}`);return`${t.join(`
1928
+ `,STARTER_PACKS={"knowledge-base":{id:`knowledge-base`,name:`Knowledge base`,description:`Trusted articles from your sources.`,defaultSubfolder:`brain`,folders:KNOWLEDGE_BASE_FOLDERS,templates:KNOWLEDGE_BASE_TEMPLATES,rootFiles:{"log.md":KNOWLEDGE_BASE_LOG_MD}},"software-lifecycle":{id:`software-lifecycle`,name:`Software lifecycle`,description:`Proposals, decisions, and specs.`,defaultSubfolder:`project-docs`,folders:SOFTWARE_LIFECYCLE_FOLDERS,templates:SOFTWARE_LIFECYCLE_TEMPLATES},"codebase-wiki":{id:`codebase-wiki`,name:`Codebase wiki`,description:`A wiki to help navigate your codebase.`,defaultSubfolder:void 0,folders:CODEBASE_WIKI_FOLDERS,templates:CODEBASE_WIKI_TEMPLATES,rootFiles:{"wiki/OVERVIEW.md":CODEBASE_WIKI_OVERVIEW_MD,"wiki/log.md":CODEBASE_WIKI_LOG_MD}},"plain-notes":{id:`plain-notes`,name:`Plain notes`,description:`Notes and daily entries.`,defaultSubfolder:void 0,folders:PLAIN_NOTES_FOLDERS,templates:PLAIN_NOTES_TEMPLATES},okf:{id:`okf`,name:`Open Knowledge Format`,description:`Wiki using Google's Open Knowledge Format.`,defaultSubfolder:void 0,folders:OKF_FOLDERS,templates:OKF_TEMPLATES,rootFiles:{"welcome.md":OKF_WELCOME_MD,"index.md":OKF_INDEX_MD,"log.md":OKF_LOG_MD}},"writing-pipeline":{id:`writing-pipeline`,name:`Writing pipeline`,description:`From first draft to finished piece.`,defaultSubfolder:`writing`,folders:WRITING_PIPELINE_FOLDERS,templates:WRITING_PIPELINE_TEMPLATES},"entity-vault":{id:`entity-vault`,name:`Personal CRM`,description:`Track the people, companies, and meetings.`,defaultSubfolder:`vault`,folders:ENTITY_VAULT_FOLDERS,templates:ENTITY_VAULT_TEMPLATES,rootFiles:{"log.md":ENTITY_VAULT_LOG_MD,"USER.md":ENTITY_VAULT_USER_MD,"SOUL.md":ENTITY_VAULT_SOUL_MD,"ACCESS_POLICY.md":ENTITY_VAULT_ACCESS_POLICY_MD,"HEARTBEAT.md":ENTITY_VAULT_HEARTBEAT_MD}},worldbuilding:{id:`worldbuilding`,name:`Worldbuilding`,description:`A wiki for your story world.`,defaultSubfolder:`world`,folders:WORLDBUILDING_FOLDERS,templates:WORLDBUILDING_TEMPLATES}},STARTER_PACK_IDS=Object.keys(STARTER_PACKS);function resolvePack(e){return e&&STARTER_PACKS[e]||STARTER_PACKS[DEFAULT_PACK_ID]}function isKnownPackId(e){return typeof e==`string`&&STARTER_PACK_IDS.includes(e)}function coercePackId(e){return isKnownPackId(e)?e:void 0}function deriveFolderSummary(e){let t=e.trim(),s=(/^([^.!?]+[.!?])/.exec(t)?.[1]??t).trim();return s.length<=140?s:`${s.slice(0,137)}…`}function listStarterPacks(){return STARTER_PACK_IDS.map(e=>{let t=STARTER_PACKS[e];return{id:t.id,name:t.name,description:t.description,defaultSubfolder:t.defaultSubfolder,folders:t.folders.map(e=>({path:e.path,summary:e.uiSummary??deriveFolderSummary(e.description)})),entryCounts:computePackEntryCounts(t)}})}function computePackEntryCounts(e){let t=e.folders.length,s=0;for(let t of e.folders)s+=1+(t.extraTemplates?.length??0);return s+=e.rootFiles?Object.keys(e.rootFiles).length:0,{files:s,folders:t}}const STARTER_FOLDERS=KNOWLEDGE_BASE_FOLDERS,STARTER_TEMPLATES=KNOWLEDGE_BASE_TEMPLATES,LOG_MD_TEMPLATE=KNOWLEDGE_BASE_LOG_MD,STARTER_FOLDER_FRONTMATTER_FILENAME=`frontmatter.yml`;function buildStarterFolderFrontmatterYaml(e){let t=[];t.push(`title: ${yamlScalar(e.title)}`),t.push(`description: ${yamlScalar(e.description)}`),t.push(`tags:`);for(let s of e.tags)t.push(` - ${yamlScalar(s)}`);return`${t.join(`
1929
1929
  `)}\n`}function yamlScalar(e){return e===``?`""`:/[:#\n"'\\]|^\s|\s$/.test(e)?`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`:e}function resolveFileContent(e,t){if(t.rootFiles?.[e]!==void 0)return t.rootFiles[e];let s=/^(.+)\/\.ok\/frontmatter\.yml$/.exec(e);if(s){let e=t.folders.find(e=>e.path===s[1]);return e?buildStarterFolderFrontmatterYaml(e):void 0}let g=/^(.+)\/\.ok\/templates\/([^/]+)\.md$/.exec(e);if(g){let e=g[2]??``;return t.templates[e]}}async function applySeed(e,t={}){let s=Date.now(),g=resolve(t.projectDir??process.cwd()),S=resolvePack(t.packId??`knowledge-base`),w=0,E=[],D=[];for(let t of e.created)try{let e=assertEntryPathInProject(g,t.path);D.push({entry:t,absPath:e})}catch(e){E.push({path:typeof t.path==`string`?t.path:String(t.path),error:e instanceof SeedRootDirError||e instanceof Error?e.message:String(e)})}for(let{entry:e,absPath:t}of D.filter(e=>e.entry.kind===`folder`))try{mkdirSync(t,{recursive:!0}),w+=1}catch(t){E.push({path:e.path,error:t instanceof Error?t.message:String(t)})}for(let{entry:e,absPath:t}of D.filter(e=>e.entry.kind===`file`)){let s=e.template??e.path,g=resolveFileContent(s,S);if(g===void 0){E.push({path:e.path,error:`No content template registered for template id "${s}" in pack "${S.id}"`});continue}if(!existsSync(t))try{writeFileSync(t,g,`utf-8`),w+=1}catch(t){E.push({path:e.path,error:t instanceof Error?t.message:String(t)})}}let O=await installPackSkill(g,S.id);return{applied:w,errors:E,durationMs:Date.now()-s,packSkillsInstalled:O}}function frontmatterTemplateId(e){return`${e}/.ok/frontmatter.yml`}function templateFileTemplateId(e,t){return`${e}/.ok/templates/${t}.md`}function normalizeRootDir(e,t){if(!e)return``;let s=e.trim();if(s===``||s===`.`||s===`./`)return``;if(s.startsWith(`/`))throw new SeedRootDirError(`rootDir must be relative to the project directory, got: ${e}`);let g=s.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/\/+$/,``);if(g.split(`/`).some(e=>e===`..`))throw new SeedRootDirError(`rootDir must not contain '..' segments, got: ${e}`);return assertEntryPathInProject(t,g),g}function joinRelative(e,t){return e===``?t:`${e}/${t}`}async function planSeed(e={}){let t=resolve(e.projectDir??process.cwd());if(!e.skipPrerequisite&&!isProjectRoot(t))throw new SeedPrerequisiteError(`No ${OK_PROJECT_MARKER} found at ${t}. Run \`ok init\` first to scaffold the tool config.`);let s=normalizeRootDir(e.rootDir,t),g=resolvePack(e.packId??`knowledge-base`),S=[],w=[],E=[];s!==``&&(existsSync(join(t,s))?w.push({path:s,reason:`already-exists`}):S.push({path:s,kind:`folder`}));for(let e of g.folders){let D=joinRelative(s,e.path);existsSync(join(t,D))?w.push({path:D,reason:`already-exists`}):S.push({path:D,kind:`folder`});let O=`${D}/.ok`;existsSync(join(t,O))?w.push({path:O,reason:`already-exists`}):S.push({path:O,kind:`folder`});let k=`${O}/${STARTER_FOLDER_FRONTMATTER_FILENAME}`;existsSync(join(t,k))?w.push({path:k,reason:`already-exists`}):S.push({path:k,kind:`file`,template:frontmatterTemplateId(e.path)});let j=`${O}/templates`;existsSync(join(t,j))?w.push({path:j,reason:`already-exists`}):S.push({path:j,kind:`folder`});let F=[e.starterTemplate,...e.extraTemplates??[]];for(let s of F){let D=`${j}/${s}.md`;if(existsSync(join(t,D))){w.push({path:D,reason:`already-exists`});continue}if(g.templates[s]===void 0){let t=s===e.starterTemplate;E.push(t?`No starter template body registered for "${s}" in pack "${g.id}". The folder will land without a pre-selected template.`:`No body registered for extra template "${s}" in pack "${g.id}". The folder will land without that optional variant.`);continue}S.push({path:D,kind:`file`,template:templateFileTemplateId(e.path,s)})}}if(g.rootFiles)for(let e of Object.keys(g.rootFiles)){let g=joinRelative(s,e);existsSync(join(t,g))?w.push({path:g,reason:`already-exists`}):S.push({path:g,kind:`file`,template:e})}let D=resolvePackSkillSource(g.id),O=D?{name:D.name,pending:!existsSync(join(t,`.ok`,`skills`,D.name,`SKILL.md`))}:void 0;return{created:S,skipped:w,warnings:E,...O?{packSkill:O}:{}}}const PACK_INSPIRATION_NOTE=[`These are patterns to adapt to your domain, not a layout to copy verbatim.`,"To build a variant: create your own folders (via `write` or your editor) and reuse only the ideas that fit.","To adopt this pack as-is: re-run without `--dry-run`."].join(`
1930
1930
  `);function folderTemplateNames(e){return[e.starterTemplate,...e.extraTemplates??[]].join(`, `)}function formatPackRationale(e){let t=[`Pack: ${e.name} — ${e.description}`,``,PACK_INSPIRATION_NOTE,``];t.push(`Layout & rationale:`);for(let s of e.folders)t.push(` ${s.path}/ — ${s.title}`),t.push(` why: ${s.description}`),t.push(` templates: ${folderTemplateNames(s)}`);let s=e.rootFiles?Object.keys(e.rootFiles):[];return s.length>0&&t.push(``,`Root files: ${s.join(`, `)}`),t.join(`
1931
1931
  `)}function createSingleFlight(){let e=new Map;return{run(t,s){let g=e.get(t);if(g)return{promise:g,coalesced:!0};let S=s();e.set(t,S);let w=()=>{e.get(t)===S&&e.delete(t)};return S.then(w,w),{promise:S,coalesced:!1}},get size(){return e.size}}}function skillShadowPath(e,t){let s=e===`.`?``:e.replace(/^\.\//,``);return s?`${s}/.ok/skills/${t}`:`.ok/skills/${t}`}function isGitObjectNotFound(e){return/not a valid object name|not a tree object|bad revision|unknown revision|invalid object name/i.test(e)}async function restoreSkillVersion(e){let{shadow:t,contentDir:s,contentRoot:g,name:S,version:w}=e;if(!existsSync(t.workTree)||!existsSync(t.gitDir))return{ok:!1,code:`no-shadow`,error:`No shadow repo — nothing to restore from.`};let E=skillShadowPath(g,S),D=shadowGit(t),O;try{O=await D.raw(`ls-tree`,`-r`,`--name-only`,w,`--`,E)}catch(e){let t=e instanceof Error?e.message:String(e);return isGitObjectNotFound(t)?{ok:!1,code:`version-not-found`,error:`Version ${w.slice(0,8)} not found.`}:{ok:!1,code:`io-error`,error:`Failed to read version ${w.slice(0,8)}: ${t}`}}let k=O.split(`
@@ -3266,4 +3266,4 @@ Incremental by default — don't re-read the whole repo.
3266
3266
  `))e&&await t.raw(`update-ref`,`-d`,e);Y.info({context:e.oldBranch},`[branch-switch] cleaned up detached context ${e.oldBranch}`)}}catch(e){Y.error({err:e},`[branch-switch] detached cleanup failed`)}setBatchInProgress(!1),await we.flushDeferredStores(`discard-stale`),je?.emitBranchSwitched(g)}if(e.headMoved&&e.newHead&&ye.current&&s>0){let t=L??`.`;try{let s=await commitUpstreamImport(ye.current,t,e.oldHead,e.newHead,g);incrementUpstreamImport(),Y.info({oldHead:e.oldHead?.slice(0,8)??`null`,newHead:e.newHead.slice(0,8),sha:s.slice(0,8)},`[history] upstream-import from ${e.oldHead?.slice(0,8)??`null`}..${e.newHead.slice(0,8)} → ${s.slice(0,8)}`)}catch(e){Y.error({err:e},`[shadow] upstream-import failed`)}}})}catch(e){Y.error({err:e},`[server] HEAD watcher failed to start`),Lr.push(`head-watcher`)}function O(e){for(let g of e)try{let e=toPosix(relative(t,join(s,g)));if(e.startsWith(`..`))continue;let S=stripDocExtension(e),w=Te.documents.get(S);if(!w)continue;let E=Ft(S);E===null?Y.warn({docName:S,file:g},`[sync] content conflict: serializeDoc returned null; reconciledBase snapshot skipped`):setReconciledBase(S,E);let D=w.getMap(`lifecycle`);D.set(`status`,`conflict`),D.set(`reason`,`sync-merge-conflict`),Y.info({docName:S,file:g},`[sync] marked loaded content conflict`)}catch(e){Y.warn({err:e,file:g},`[sync] failed to mark loaded content conflict`)}}let j=buildSyncCredentialArgs(H);try{jr=new SyncEngine({projectDir:s,contentDir:t,contentFilter:ge,contentRoot:L,syncEnabled:ne(),credentialArgs:j,cc1Broadcaster:je,detectGh:e.detectGh,tokenStore:e.tokenStore,checkPushPermissionFn:e.checkPushPermissionFn,setBatchInProgress:e=>{setBatchInProgress(e),e||we.flushDeferredStores(`within-branch`).catch(e=>{Y.error({err:e},`[persistence] deferred store drain failed after sync batch`)})},onStateChange:e=>{Y.info({state:e},`[sync] state → ${e}`)},onContentConflictsDetected:O,onAutoDisable:async e=>{Y.warn({reason:e},`[sync] auto-disabled — persisting to project-local config`);let t=await writeConfigPatch({cwd:s,scope:`project-local`,patch:{autoSync:{enabled:!1}}});t.ok||Y.error({result:t,reason:e,humanError:humanFormat(t.error),configPath:resolveConfigPath(`project-local`,s)},`[sync] failed to persist auto-disable — next restart WILL re-enable sync and re-trigger the same failure. Check permissions on the config path.`)}}),await jr.start()}catch(e){Y.warn({err:e},`[server] SyncEngine failed to start — sync disabled`),jr=null}$e(`files`),$e(`backlinks`),$e(`graph`),$e(`tags`);let F=bootElapsedMs();F!==void 0&&recordBootPhase(`readyMs`,F)}return zr().then(Ge,Ke),{hocuspocus:Te,sessionManager:De,cc1Broadcaster:je,agentFocusBroadcaster:Me,agentPresenceBroadcaster:Pe,maintenanceCoordinator:Ce,contentFilter:ge,basenameIndex:de,serverInstanceId:ce,destroy:Ir,ready:Xe,degraded:Lr,lockDir:ue,get syncEngine(){return jr}}}const SERVER_MEMORY_SCHEMA_VERSION=1,BYTES_PER_MB=1024*1024;function toMb(e){return e/BYTES_PER_MB}function captureServerMemorySnapshot(){let e=process.memoryUsage();return{schemaVersion:SERVER_MEMORY_SCHEMA_VERSION,capturedAt:new Date().toISOString(),snapshot:{rssMb:toMb(e.rss),heapTotalMb:toMb(e.heapTotal),heapUsedMb:toMb(e.heapUsed),externalMb:toMb(e.external),arrayBuffersMb:toMb(e.arrayBuffers)}}}let cachedGauge=null;onTelemetryShutdown(()=>{cachedGauge=null});function installServerMemoryGauge(){if(cachedGauge)return;let e=getMeter().createObservableGauge(`ok.server.memory.usage_megabytes`,{description:`Server process memory by section. Bounded labels: section ∈ {heap_used, heap_total, rss}.`,unit:`MB`});e.addCallback(e=>{let{snapshot:t}=captureServerMemorySnapshot();e.observe(t.heapUsedMb,{section:`heap_used`}),e.observe(t.heapTotalMb,{section:`heap_total`}),e.observe(t.rssMb,{section:`rss`})}),cachedGauge=e}const TELEMETRY_FILENAME=`tolerance-telemetry.jsonl`,TELEMETRY_PREV_FILENAME=`tolerance-telemetry.prev.jsonl`,TELEMETRY_MAX_BYTES=8*1024*1024;let appender=null,appendFailureWarned=!1;function isToleranceTelemetryEnabled(e=process.env){return e.OK_BRIDGE_TOLERANCE_TELEMETRY===`1`}function initToleranceTelemetryWriter(e){if(!isToleranceTelemetryEnabled())return;let t=getLocalDir(e);appender=new RotatingAppender({currentPath:resolve(t,TELEMETRY_FILENAME),previousPath:resolve(t,TELEMETRY_PREV_FILENAME),maxBytes:TELEMETRY_MAX_BYTES}),setToleranceTelemetryHook(e=>{let t={event:`bridge-tolerance-fire`,timestamp:e.timestamp,class:e.className,document:e.documentName??null,codeUnitPosition:e.codeUnitPosition,severity:e.severity};appender?.append(`${JSON.stringify(t)}\n`).catch(e=>{appendFailureWarned||(appendFailureWarned=!0,console.warn(`[tolerance-telemetry] append failed; further failures are silent:`,e instanceof Error?e.message:String(e)))})})}async function teardownToleranceTelemetryWriter(){setToleranceTelemetryHook(null),await appender?.drain(),appender=null,appendFailureWarned=!1}const LEGACY_RUNTIME_FILENAMES=[`server.lock`,`ui.lock`,`state.json`,`principal.json`,`sync-state.json`,`conflicts.json`,`last-spawn-error.log`],LEGACY_RUNTIME_DIRNAMES=[`cache`,`tmp`];function findLegacyRuntimeFiles(e){let t=resolve(e,LOCAL_DIR);if(!(()=>{if(!existsSync(t))return!0;try{return readdirSync(t).length===0}catch{return!0}})())return[];let s=[];for(let t of LEGACY_RUNTIME_FILENAMES)existsSync(resolve(e,t))&&s.push(t);for(let t of LEGACY_RUNTIME_DIRNAMES){let g=resolve(e,t);try{existsSync(g)&&statSync(g).isDirectory()&&s.push(`${t}/`)}catch{}}return s}function computeWorktreeAttributes(e){let t=resolveGitDirDetailed(e);switch(t.kind){case`directory`:return{kind:`main`,gitdir:t.path};case`linked`:return{kind:`linked`,gitdir:t.path};case`malformed-pointer`:return{kind:`linked`,gitdir:null};case`inaccessible`:case`absent`:return{kind:`main`,gitdir:null}}}const DEFAULT_IDLE_THRESHOLD_MS=1800*1e3,DESTROY_STEP_TIMEOUT_MS=5e3,PINO_REDACT_MAX_DEPTH=5;async function bootServer(e){startBootTimings();let t=e.projectDir??e.contentDir,s=resolveLocalSinkConfig({projectDir:t});if(s){let e=s.telemetry.attributeDenylist,t=[];for(let s of e){t.push(s);for(let e=1;e<=PINO_REDACT_MAX_DEPTH;e++)t.push(`${`*.`.repeat(e)}${s}`)}loggerFactory.configure({pinoConfig:{fileSink:s.logs,redactPaths:t}})}initTelemetry({localSink:s?.telemetry}),initToleranceTelemetryWriter(t),installServerMemoryGauge();let{kind:g,gitdir:S}=computeWorktreeAttributes(e.projectDir??e.contentDir),w={"ok.worktree.kind":g};S!==null&&(w[`ok.worktree.gitdir`]=normalizeFsPath(S));let E=process.env.OK_STARTUP_TRACEPARENT,D=()=>withSpan(`ok.boot`,{attributes:w},async()=>bootServerInner(e));if(E)try{let e=propagation.extract(context.active(),{traceparent:E});return context.with(e,D)}catch(e){getLogger(`boot`).warn({err:e instanceof Error?e.message:String(e)},`ok.boot trace-join failed — starting unparented boot`)}return D()}async function bootServerInner(e){let t=e.skipAutoInit??!1,s=e.attachUiSibling??!0,g=e.idleShutdownMs,S=e.log??getLogger(`boot`),w=process.env.OK_LOCK_KIND===`mcp-spawned`||process.env.OK_LOCK_KIND===`interactive`?process.env.OK_LOCK_KIND:void 0,E=e.lockKind??w??`interactive`,{createServer:D}=await import(`node:http`),{updateServerLockPort:O}=await import(`./server-lock-LsXsWtim-BLIrqdzC.mjs`),k=!1;if(!t&&e.autoInitFn)try{k=!!await e.autoInitFn()}catch(e){S.warn({err:e},`autoInitFn failed`)}let j=e.projectDir??e.contentDir,F=resolve(j,`.ok`);if(!existsSync(resolve(F,`config.yml`)))throw new MissingOkConfigError(existsSync(F)?`config`:`okdir`,j);existsSync(resolve(F,`.gitignore`))||console.warn("[boot] Note: .ok/.gitignore is missing — per-machine state files in .ok/ may show up as untracked changes. Run `ok init` to add the recommended ignore entries.");let L=e.gitPreflight??assertGitAvailable;try{e.gitEnabled!==!1&&L()}catch(e){if(e instanceof GitNotAvailableError||e instanceof GitTooOldError){let t=e instanceof GitTooOldError?e.detected:``,s=e instanceof GitTooOldError?`too_old`:`not_available`;emitPreflightFailureSpan(e),S.warn({event:`git_preflight_fail`,platform:e.platform,reason:s,detectedVersion:t},s===`not_available`?`git binary not found`:`git binary too old`),process.stderr.write(`${e.message}\n`)}throw await shutdownTelemetry(),await Promise.race([teardownToleranceTelemetryWriter(),new Promise(e=>setTimeout(e,DESTROY_STEP_TIMEOUT_MS))]),e}let B=findLegacyRuntimeFiles(F);B.length>0&&console.warn(`[boot] Found legacy runtime files at .ok/${B.join(`, `)}. Delete .ok/ and re-init — these files moved to .ok/${LOCAL_DIR}/.`);let H=createServer$1({contentDir:e.contentDir,projectDir:e.projectDir,contentRoot:e.contentRoot,port:e.port,host:e.host,quiet:e.quiet??!1,debounce:e.debounce,maxDebounce:e.maxDebounce,gitEnabled:e.gitEnabled,commitDebounceMs:e.commitDebounceMs,wipRef:e.wipRef,enableTestRoutes:e.enableTestRoutes,shadowRepo:e.shadowRepo,destroyTimeoutMs:e.destroyTimeoutMs,localOpCliArgs:e.localOpCliArgs,onAgentWrite:e.onAgentWrite,lockKind:E,skipStateManifestCheck:e.skipStateManifestCheck,detectGh:e.detectGh,tokenStore:e.tokenStore,embeddingsKeyStore:e.embeddingsKeyStore,singleDocRelPath:e.singleDocRelPath,ephemeral:e.ephemeral}),{hocuspocus:q,destroy:ee,ready:J,degraded:Y,lockDir:te,sessionManager:ne,agentFocusBroadcaster:ae,agentPresenceBroadcaster:oe,maintenanceCoordinator:se}=H,ce=(()=>{let t=e.host??`localhost`;return t===`0.0.0.0`||t===`::`?`localhost`:t.includes(`:`)&&!t.startsWith(`[`)?`[${t}]`:t})(),ue=e.port??0,de=e.ephemeral?void 0:createMcpHttpHandler({contentDir:e.contentDir,projectDir:e.projectDir??e.contentDir,config:e.config,getServerUrl:()=>`http://${ce}:${ue}`,log:S}),fe=D();fe.headersTimeout=3e4,fe.requestTimeout=6e4;let me=e.serveContentAssets?createAssetServeMiddleware({contentFilter:H.contentFilter,contentSirv:build_default(e.contentDir,{dev:!0,dotfiles:!1}),inlineExtensions:INLINE_RENDERABLE_EXTENSIONS,assetExtensions:ASSET_EXTENSIONS,blocklistExtensions:EXECUTABLE_BLOCKLIST_EXTENSIONS}):void 0,ge=!1;if(e.reactShellDistDir)try{acquireUiLock(te,{port:0,worktreeRoot:e.projectDir??e.contentDir}),ge=!0}catch(e){if(e instanceof UiLockCollisionError)S.info({event:`ui-lock-yielded-to-live-holder`,pid:process.pid,existingPid:e.existing.pid,existingPort:e.existing.port,lockDir:te},`ui.lock already held by a live process — yielding (advertisement is fulfilled)`);else throw await ee().catch(()=>{}),e}let _e=e.reactShellDistDir?build_default(e.reactShellDistDir,{single:!0,gzip:!0,immutable:!0}):void 0,ve=mountMcpAndApi({httpServer:fe,hocuspocus:q,mcpHttpHandler:de,log:S,sessionManager:ne,agentFocusBroadcaster:ae,agentPresenceBroadcaster:oe,maintenanceCoordinator:se,keepaliveGraceMs:e.keepaliveGraceMs,contentAssetMiddleware:me,reactShellMiddleware:_e,ephemeral:e.ephemeral}),ye=async()=>{throw Error(`bootServer: destroy() invoked before initialization — boot did not complete`)},Ce=null;g!==null&&(Ce=attachIdleShutdown({httpServer:fe,thresholdMs:g??DEFAULT_IDLE_THRESHOLD_MS,log:S,onShutdown:(e.idleShutdownHandler??(e=>async()=>{await e()}))(async()=>{await ye()})})),await restoreLifecycleFromConflictsJson({hocuspocus:q,projectDir:e.projectDir??e.contentDir,log:S});try{await new Promise((t,s)=>{let g=e=>s(e);fe.once(`error`,g),fe.listen(e.port,e.host,()=>{fe.removeListener(`error`,g),t()})})}catch(e){if(ge)try{releaseUiLock(te)}catch(e){S.warn({err:e},`releaseUiLock failed during listen-error cleanup`)}throw await ee().catch(()=>{}),e}let we=bootElapsedMs();we!==void 0&&recordBootPhase(`httpListenMs`,we);let Te=fe.address(),De=typeof Te==`object`&&Te?Te.port:e.port??0;if(ue=De,O(te,De),ge&&updateUiLockPort(te,De),s&&e.spawnUiSiblingFn)try{await e.spawnUiSiblingFn({lockDir:te,log:S})}catch(e){S.warn({err:e},`spawnUiSiblingFn failed`)}let je=!1,Me=async(e,t)=>{let s;try{await Promise.race([t(),new Promise((t,g)=>{s=setTimeout(()=>{g(Error(`${e} timed out after ${DESTROY_STEP_TIMEOUT_MS}ms`))},DESTROY_STEP_TIMEOUT_MS),s.unref?.()})])}finally{s!==void 0&&clearTimeout(s)}};ye=async()=>{if(je)return;je=!0;let e=[],t=async(t,s)=>{try{await Me(t,s)}catch(s){e.push(s),S.warn({err:s,step:t},`bootServer destroy step failed`)}};try{Ce?.detach()}catch(t){e.push(t),S.warn({err:t,step:`idleHandle.detach`},`bootServer destroy step failed`)}if(await t(`mount.shutdown`,()=>ve.shutdown()),de!==void 0&&await t(`mcpHttpHandler.close`,()=>de.close()),await t(`mount.wss.close`,()=>new Promise((e,t)=>{ve.wss.close(s=>s?t(s):e())})),await t(`httpServer.closeAllConnections`,async()=>{fe.closeAllConnections?.()}),await t(`httpServer.close`,()=>new Promise((e,t)=>{fe.close(s=>s&&s.code!==`ERR_SERVER_NOT_RUNNING`?t(s):e())})),await t(`destroyHocuspocus`,()=>ee()),ge&&await t(`releaseUiLock`,async()=>releaseUiLock(te)),await t(`shutdownTelemetry`,()=>shutdownTelemetry()),await t(`teardownToleranceTelemetry`,()=>teardownToleranceTelemetryWriter()),await t(`flushLogFileSinks`,()=>loggerFactory.flushAllFileSinks()),e.length>0)throw AggregateError(e,`bootServer destroy completed with errors`)};try{let t=await reconcileSkillInstalls({projectDir:j,skillsRoot:resolve(e.contentDir,`.ok`,`skills`)}),s=t.healed.length+t.adopted.length+t.replaced.length+t.collided.length+t.orphansRemoved.length;s>0&&S.info?.({event:`installed-skills-reconciled`,healed:t.healed.length,adopted:t.adopted.length,replaced:t.replaced.length,collided:t.collided.length,orphansRemoved:t.orphansRemoved.length},`Reconciled ${s} editor skill entr${s===1?`y`:`ies`} to the symlink model.`)}catch(e){S.warn?.({event:`installed-skills-reconcile-failed`,error:String(e)},`Installed-skills reconcile failed (non-fatal).`)}return{httpServer:fe,destroy:ye,lockDir:te,contentDir:e.contentDir,port:De,ready:J,degraded:Y,didAutoInit:k,serverInstance:H}}async function restoreLifecycleFromConflictsJson(e){let{hocuspocus:t,projectDir:s,log:g}=e,S,w;try{S=new ConflictStore(s),w=S.list()}catch(e){g.warn({err:e,projectDir:s},`[boot] lifecycle restore: failed to read conflicts.json — skipping`);return}if(w.length===0)return;let E=null;try{let e=resolveGitDir(s),t=e?join(e,`MERGE_HEAD`):null;if(!t||!existsSync(t)){S.clear(),console.warn(JSON.stringify({event:`lifecycle-restore-cleared-stale-conflicts`,reason:`no-merge-head`,count:w.length}));return}let g=(await simpleGit({baseDir:s,timeout:{block:5e3}}).raw([`diff`,`--name-only`,`--diff-filter=U`])).trim();E=new Set(g?g.split(`
3267
3267
  `).map(e=>e.trim()).filter(Boolean):[])}catch(e){g.warn({err:e,projectDir:s},`[boot] lifecycle restore: git unmerged probe failed — restoring all entries`)}if(E!==null){let e=0;for(let t of w)E.has(t.file)||(S.removeConflict(t.file),e++);if(e>0&&console.warn(JSON.stringify({event:`lifecycle-restore-pruned-resolved-entries`,pruned:e,remaining:w.length-e})),w=w.filter(e=>E?.has(e.file)),w.length===0)return}for(let e of w){let s=stripDocExtension(e.file),S=null,w=!1;try{S=await t.openDirectConnection(s);let e=S.document;if(!e)continue;let g=e.getMap(`lifecycle`);g.set(`status`,`conflict`),g.set(`reason`,`conflict-markers`),w=!0,console.warn(JSON.stringify({event:`lifecycle-restored-from-conflicts-json`,"doc.name":s}))}catch(e){g.warn({err:e,docName:s},`[boot] lifecycle restore: failed to set lifecycle for doc — skipping`)}finally{if(S)try{await S.disconnect()}catch(e){g.warn({err:e,docName:s,restored:w},`[boot] lifecycle restore: disconnect failed after lifecycle write`)}}}}const ConfigSchema=ConfigSchema$1;function detectClaudeDesktopPresence(e={}){let t=e.home??homedir(),s=e.platformName??process.platform,g=e.env??process.env;return s===`darwin`?existsSync(join(t,`Library`,`Application Support`,`Claude`)):s===`win32`?existsSync(join(g.APPDATA??join(t,`AppData`,`Roaming`),`Claude`)):!1}const OK_LOGS_DIR=join(homedir(),`.ok`,`logs`),MAX_ROTATED_FILES=2,MAX_AGE_DAYS=7,MAX_DIR_SIZE_BYTES=45*1024*1024,REDACT_PATHS=[`authorization`,`password`,`token`,`apiKey`,`secret`,`*.authorization`,`*.password`,`*.token`,`*.apiKey`,`*.secret`];function resolveLogLevel(){let e=process.env.OK_LOG_LEVEL??process.env.LOG_LEVEL;if(e){let t=[`fatal`,`error`,`warn`,`info`,`debug`],s=e.toLowerCase();if(t.includes(s))return s}return process.env.NODE_ENV===`test`?`silent`:`info`}function ensureDir(e){mkdirSync(e,{recursive:!0})}function todayDateString(){return new Date().toISOString().slice(0,10)}function rotateIfNeeded(e){try{if(statSync(e).size<5242880)return}catch{return}for(let t=MAX_ROTATED_FILES;t>=1;t--){let s=t===1?e:`${e}.${t-1}`,g=`${e}.${t}`;try{renameSync(s,g)}catch{}}try{unlinkSync(`${e}.${MAX_ROTATED_FILES+1}`)}catch{}}function pruneLogsDir(e){try{let t=Date.now(),s=MAX_AGE_DAYS*24*60*60*1e3,g=readdirSync(e).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(t=>{try{let s=statSync(join(e,t));return{name:t,mtime:s.mtimeMs,size:s.size}}catch{return null}}).filter(Boolean);for(let S of g)if(t-S.mtime>s)try{unlinkSync(join(e,S.name))}catch{}let S=g.filter(e=>t-e.mtime<=s).sort((e,t)=>e.mtime-t.mtime),w=S.reduce((e,t)=>e+t.size,0);for(let t of S){if(w<=MAX_DIR_SIZE_BYTES)break;try{unlinkSync(join(e,t.name)),w-=t.size}catch{}}}catch{}}function createFileLogger(e){ensureDir(OK_LOGS_DIR);let t=todayDateString(),s=e.filePath??join(OK_LOGS_DIR,`${e.name}.${t}.log`);rotateIfNeeded(s),(e._setTimeout??setTimeout)(()=>pruneLogsDir(OK_LOGS_DIR),5e3).unref();let g=import_pino.default.destination({dest:s,append:!0,sync:!0});return(0,import_pino.default)({level:resolveLogLevel(),name:e.name,redact:{paths:REDACT_PATHS,censor:`[REDACTED]`},base:{pid:process.pid,hostname:void 0,runtime:`cli`,project:e.project??`<no-project>`},timestamp:import_pino.default.stdTimeFunctions.isoTime,...e.additionalOptions},g)}function flushFileLogger(e,t=250){return new Promise(s=>{if(!e){s();return}let g=e[import_pino.default.symbols.streamSym],S=!1,w=()=>{S||(S=!0,s())};if(!g||typeof g.flushSync!=`function`){w();return}let E=()=>{try{g.flushSync?.()}catch{}w()},D=setTimeout(w,t);typeof D.unref==`function`&&D.unref(),typeof g.fd==`number`&&g.fd>=0?(clearTimeout(D),E()):typeof g.once==`function`?g.once(`ready`,()=>{clearTimeout(D),E()}):(clearTimeout(D),E())})}function getLogFilePath(e){return join(OK_LOGS_DIR,`${e}.${todayDateString()}.log`)}function getLogsDir(){return OK_LOGS_DIR}const ANCESTOR_WALK_DEPTH_LIMIT=30,GIT_MARKER=`.git`;function findEnclosingGitRoot(e){let t=resolve(e),s=0;for(;s<ANCESTOR_WALK_DEPTH_LIMIT;){let e=!1;try{e=existsSync(resolve(t,GIT_MARKER))}catch{e=!1}if(e)return{gitRoot:t,distance:s};let g=dirname(t);if(g===t)return null;t=g,s+=1}return null}const execFileAsync=promisify(execFile),log=getLogger(`project-git`);var ProjectGitInitError=class extends Error{stderr;constructor(e,t=``,s){super(e,s),this.name=`ProjectGitInitError`,this.stderr=t}};async function isInsideExistingWorkTree(e,t){try{let{stdout:s}=await execFileAsync(e,[`rev-parse`,`--is-inside-work-tree`],{cwd:t});return s.trim()===`true`}catch{return!1}}async function ensureProjectGit(e){let t=resolve(e),s=resolve(t,`.git`),g=resolve(s,`HEAD`),S=!1;if(existsSync(s)){if(!statSync(s).isDirectory()||existsSync(g))return{didInit:!1};log.info({},`detected partial .git/ — running git init to repair`),S=!0}let w;try{w=assertGitAvailable()}catch(e){throw e instanceof GitNotAvailableError||e instanceof GitTooOldError?(emitPreflightFailureSpan(e),log.warn({event:`git_preflight_fail`,platform:e.platform,reason:e instanceof GitTooOldError?`too_old`:`not_available`,detectedVersion:e instanceof GitTooOldError?e.detected:``},e instanceof GitTooOldError?`git binary too old`:`git binary not found`)):log.warn({event:`git_preflight_unexpected_error`,message:e instanceof Error?e.message:String(e)},`unexpected error during git preflight`),e}let E=w.resolvedPath;if(!S&&await isInsideExistingWorkTree(E,t))return{didInit:!1};let D=``;try{D=(await execFileAsync(E,[`init`,`--initial-branch=main`,t])).stderr??``}catch(e){let s=typeof e==`object`&&e&&`stderr`in e?String(e.stderr??``):``;throw new ProjectGitInitError(`git init failed at ${t}: ${e instanceof Error?e.message:String(e)}`,s,{cause:e})}if(!existsSync(g))throw new ProjectGitInitError(`git init reported success but ${s}/HEAD is missing (partial init detected)`,D);return S?(log.info({path:t},`backfilled missing .git/HEAD`),{didInit:!0,repaired:!0}):(log.info({path:t,branch:`main`},`initialized .git/`),{didInit:!0})}async function resolvePackageVersion(e,t){let s;try{s=createRequire(t).resolve(e)}catch(e){if(e?.code===`MODULE_NOT_FOUND`)return;throw e}for(let t=dirname(s),g=0;g<32;g+=1){let s=join(t,`package.json`);if(existsSync(s))try{let t=JSON.parse(await readFile$1(s,`utf-8`));if(t.name===e&&typeof t.version==`string`)return t.version}catch{}let g=dirname(t);if(g===t)return;t=g}}const MAX_CAUSE_DEPTH=5,HOME_PATH_PATTERNS=[{regex:/\/Users\/[^/]+\//g,replacement:`~/`},{regex:/\/home\/[^/]+\//g,replacement:`~/`},{regex:/C:\\\\Users\\\\[^\\\\]+\\\\/g,replacement:`~\\`},{regex:/C:\\Users\\[^\\]+\\/g,replacement:`~\\`}];function scrubPaths(e){if(e===void 0)return;let t=e;for(let{regex:e,replacement:s}of HOME_PATH_PATTERNS)t=t.replace(e,s);return t}function serializeError(e,t=0,s=new WeakSet){if(t>=MAX_CAUSE_DEPTH)return{name:`SerializedError.CauseDepthExceeded`,message:`cause chain depth > ${MAX_CAUSE_DEPTH}; truncated`};if(typeof e==`object`&&e){if(s.has(e))return{name:`SerializedError.CauseCycle`,message:`cyclic cause; truncated`};s.add(e)}if(e instanceof Error)return{name:e.name,message:scrubPaths(e.message)??``,stack:scrubPaths(e.stack),code:e.code,cause:e.cause===void 0?void 0:serializeError(e.cause,t+1,s)};if(e==null)return{name:`UnknownError`,message:String(e)};if(typeof e==`string`)return{name:`StringError`,message:scrubPaths(e)??e};if(typeof e==`object`){let g=e;return{name:String(g.name??`ObjectError`),message:scrubPaths(String(g.message??``))??``,stack:scrubPaths(g.stack),code:g.code,cause:g.cause===void 0?void 0:serializeError(g.cause,t+1,s)}}return{name:`UnknownError`,message:String(e)}}var SingleFileNotFoundError=class extends Error{constructor(e){super(`File not found: ${e}`),this.filePath=e,this.name=`SingleFileNotFoundError`}},SingleFileNotAFileError=class extends Error{constructor(e){super(`Not a file: ${e}. \`ok <file>\` opens a single markdown file.`),this.filePath=e,this.name=`SingleFileNotAFileError`}},SingleFileNotMarkdownError=class extends Error{constructor(e){super(`OpenKnowledge edits markdown files (.md / .mdx): ${e}`),this.filePath=e,this.name=`SingleFileNotMarkdownError`}};function prepareSingleFileOpen(e){if(!isSupportedDocFile(e))throw new SingleFileNotMarkdownError(e);let t;try{t=realpathSync(resolve(e))}catch(t){throw t.code===`ENOENT`?new SingleFileNotFoundError(e):t}if(!statSync(t).isFile())throw new SingleFileNotAFileError(e);let s=dirname(t),g=findEnclosingProjectRoot(s);if(g){let e=g.rootPath;return{mode:`project`,projectRoot:e,docName:stripDocExtension(relative(resolveProjectContentDir(e),t).split(sep).join(`/`)),canonicalFilePath:t}}let S=basename(t);return{mode:`ephemeral`,canonicalFilePath:t,contentDir:s,singleDocRelPath:S,docName:stripDocExtension(S)}}function resolveProjectContentDir(e){return resolve(e,readConfigSafely({absPath:resolveConfigPath(`project`,e),sideline:!1,warn:()=>{}}).value.content?.dir??`.`)}function createEphemeralProjectDir(e){let t=mkdtempSync(resolve(tmpdir(),`ok-ephemeral-`)),s=resolve(t,`.ok`);return mkdirSync(s,{recursive:!0}),writeFileSync(resolve(s,`config.yml`),`# Ephemeral single-file session (\`ok <file>\`). Throwaway — safe to delete.\ncontent:\n dir: ${JSON.stringify(e)}\n`,`utf-8`),writeFileSync(resolve(s,`.gitignore`),`local/
3268
3268
  `,`utf-8`),t}export{STARTER_PACKS as $,withSpan as $i,isAllowedWorkspaceHostHeader as $n,resolveBundledSkillDir as $r,createExternalChangeHandler as $t,HocuspocusAuthRejection as A,spawnDetached as Ai,formatPackRationale as An,planSeed as Ar,bundleSkillMdPath as At,McpLogger as B,tracedMkdirSync as Bi,handleCollabSocketError as Bn,readSkillManagement as Br,compareSemver as Bt,FILE_WATCHER_ORIGIN as C,serializeError as Ci,fallbackPaths as Cn,normalizeFsPath as Cr,bootServer as Ct,GitNotAvailableError as D,skillManagementPath as Di,formatAuthRejectionWire as Dn,parseHocuspocusAuthToken as Dr,buildSkillZip as Dt,GIT_UPSTREAM_WRITER as E,shutdownTelemetry as Ei,flushFileLogger as En,parseGitVersion as Er,buildExecResult as Et,MANAGED_RENAME_ORIGIN as F,teardownToleranceTelemetryWriter as Fi,getLogger as Fn,readArmedPaneTarget as Fr,clearEmbeddingsKeyFromAllBackends as Ft,PinoLogger as G,tracedUnlinkSync as Gi,initContent as Gn,reconcile as Gr,countStaleAgentWipRefs as Gt,OBSERVER_SYNC_ORIGIN as H,tracedRenameSync as Hi,hasGcLogLatch as Hn,readTargetRecordedAt as Hr,contentHash as Ht,MAX_AGENT_SESSIONS as I,toBroadcasterKey as Ii,getLogsDir as In,readBranchFromHead as Ir,coercePackId as It,ROOT_GITIGNORE_TEMPLATE as J,updateLastKnownHash as Ji,initToleranceTelemetryWriter as Jn,registerAllTools as Jr,createAssetServeMiddleware as Jt,ProjectGitInitError as K,tracedWriteFile as Ki,initShadowRepo as Kn,recordContributor as Kr,countWipRefs as Kt,MCP_CONNECTION_ID_HEADER as L,tracedAppendFileSync as Li,getMeter as Ln,readProjectLocalSemanticConfig as Lr,commitUpstreamImport as Lt,INSTALLED_AGENTS_SCHEMES as M,startWatcher as Mi,getCurrentMcpLogger as Mn,processCommand as Mr,classifyFsPath as Mt,LIVE_DERIVED_INDEX_DEBOUNCE_MS as N,streamingProblemEvent as Ni,getLocalDir as Nn,processUsage as Nr,clearArmedPaneTarget as Nt,GitTooOldError as O,spansCurrentPath as Oi,formatContributors as On,parseKeepaliveConnectionId as Or,buildStarterFolderFrontmatterYaml as Ot,LOG_MD_TEMPLATE as P,swapContributors as Pi,getLogFilePath as Pn,readAllTargets as Pr,clearContributors as Pt,STARTER_FOLDER_FRONTMATTER_FILENAME as Q,validateSkillZip as Qi,isAllowedApiOrigin as Qn,resetMetrics as Qr,createEphemeralProjectDir as Qt,MIN_GIT_VERSION as R,tracedLinkSync as Ri,getMetrics as Rn,readServerPackageVersion as Rr,commitWip as Rt,FILE_SYSTEM_WRITER as S,seedBasenameIndex as Si,extractWikiLinksFromMarkdown as Sn,mountMcpAndApi as Sr,attachIdleShutdown as St,GIT_PREFLIGHT_FAIL_SPAN_NAME as T,shadowGit as Ti,findEnclosingProjectRoot as Tn,parseAuthRejectionWire as Tr,buildConfigYmlContent as Tt,OK_OKIGNORE_TEMPLATE as U,tracedRmSync as Ui,incrementCollabSocketFilteredError as Un,readTargetVersion as Ur,contributorCount as Ut,MissingOkConfigError as V,tracedRename as Vi,handleSpawnCursor as Vn,readStateManifest as Vr,containsConflictMarkers as Vt,PANE_TARGET_TTL_MS as W,tracedRmdirSync as Wi,incrementServerObserverFire as Wn,readUiLock as Wr,countShadowObjects as Wt,SKILL_INSTALL_EVENTS_FILE_REL as X,validateAgentId as Xi,installTestLoggers as Xn,releaseUiLock as Xr,createContentFilterAsync as Xt,SERVICE_WRITER as Y,updateUiLockPort as Yi,installPrettyZodErrors as Yn,registerWrite as Yr,createContentFilter as Yt,STARTER_FOLDERS as Z,validateCloneInputs as Zi,installUserSkill as Zn,removeLastKnownHash as Zr,createEmbeddingsSecretStore as Zt,ConfigSchema as _,GitDirAccessError as _a,safeSubdir as _i,encodeSkillRoute as _n,loadPrincipal as _r,applySeed as _t,AgentPresenceBroadcaster as a,writeTracker as aa,resolvePackageVersion as ai,createServer$1 as an,isManagedArtifactDoc as ar,SingleFileNotAFileError as at,DEFAULT_PACK_ID as b,resolveGitDirDetailed as ba,saveInMemoryCheckpoint as bi,evictStaleTrackerEntries as bn,logsPreviousPath as br,assertGitAvailable as bt,AutoStartDisabledError as c,LATEST_PROTOCOL_VERSION as ca,restoreLifecycleFromConflictsJson as ci,createTestLogger as cn,isProjectRoot as cr,StateManifestError as ct,BUNDLE_SKILL_NAME as d,isJSONRPCResultResponse as da,runAuthReposSubprocess as di,detectGit as dn,isSelfWrite as dr,UiLockCollisionError as dt,withSpanSync as ea,resolveContentDir as ei,createFileLogger as en,isConfigDoc as er,STARTER_PACK_IDS as et,BacklinkIndex as f,atomicWriteFileSync as fa,runAuthStatusSubprocess as fi,detectProjectShape as fn,isSystemDoc as fr,__getShowAllWalkStatsForTesting as ft,CURSOR_BUNDLE_PATHS_BY_PLATFORM as g,writeConfigPatch as ga,safeContentPath as gi,encodeFolderRoute as gn,listStarterPacks as gr,applyExternalChange as gt,CONFLICT_MARKER_RE as h,withFileLockSync as ha,runWithMcpLogger as hi,encodeDocName as hn,listRescueCheckpoints as hr,applyAgentMarkdownWrite as ht,AgentFocusBroadcaster as i,writeTargetVersion as ia,resolvePack as ii,createPersistenceExtension as in,isLoopbackAddress as ir,SeedRootDirError as it,HocuspocusAuthTokenSchema as j,splitMarkdownBlocks as ji,gcCheckpointRefs as jn,prepareSingleFileOpen as jr,classifyEvents as jt,HOCUSPOCUS_AUTH_REJECTION_REASONS as k,spansPreviousPath as ki,formatContributorsFrom as kn,pathToDocName as kr,buildWipTree as kt,BUNDLE_IDS as l,isInitializedNotification as la,rewriteMarkdownLinksForDocumentRename as li,describeStoredEmbeddingsKey as ln,isProjectSkillManaged as lr,TagIndex as lt,CONFIG_FILENAME as m,resolveConfigPath as ma,runDeviceFlowSubprocess as mi,emitPreflightFailureSpan as mn,lastKnownHash as mr,acquireUiLock as mt,AGENT_ID_RE as n,writeSkillManagement as na,resolveCursorSpawnInvocation as ni,createMcpHttpHandler as nn,isKnownPackId as nr,STATE_MANIFEST_FILENAME as nt,AgentSessionCapacityError as o,McpServer as oa,resolveUiInfo as oi,createServerObserverExtension as on,isPairedWriteOrigin as or,SingleFileNotFoundError as ot,CC1Broadcaster as p,readConfigSafely as pa,runCloneSubprocess as pi,discoverLockDirs as pn,isToleranceTelemetryEnabled as pr,__resetShowAllWalkStatsForTesting as pt,ROLLBACK_ORIGIN as q,tracedWriteFileSync as qi,initTelemetry as qn,recordSkillInstallEvent as qr,createApiExtension as qt,AGENT_WRITE_ORIGIN as r,writeStateManifest as ra,resolveLockDir as ri,createOsProbe as rn,isLinkIndexExcludedDoc as rr,SeedPrerequisiteError as rt,AgentSessionManager as s,JSONRPCMessageSchema as sa,restoreContributors as si,createStreamingErrorWriter as sn,isPathWithinDir as sr,SingleFileNotMarkdownError as st,AGENT_ID_MAX_LEN as t,writeRootGitignoreForNewRepo as ta,resolveCursorBinaryDefault as ti,createLiveDerivedIndexExtension as tn,isHocuspocusAuthRejectionReason as tr,STARTER_TEMPLATES as tt,BUNDLE_SCOPE as u,isJSONRPCRequest as ua,rewriteWikiLinksForDocumentRename as ui,detectClaudeDesktopPresence as un,isReservedForUserTree as ur,USER_GLOBAL_BUNDLE_IDS as ut,DEFAULT_CHECKPOINT_RETENTION as v,MalformedGitPointerError as va,safetyCheckpoint as vi,ensureProjectGit as vn,loggerFactory as vr,armPaneTarget as vt,FileEmbeddingsBackend as w,setActiveSpanAttributes as wi,findEnclosingGitRoot as wn,packageVersionMajorMinor as wr,buildAndOpenSkill as wt,EMBEDDINGS_API_KEY_ENV as x,resolveShadowDir as xa,saveVersion as xi,extractOkBinaryPath as xn,makeLazyEmbeddingsKeyStore as xr,assertNeverDiskEvent as xt,DEFAULT_EMBEDDINGS_DIMENSIONS as y,parseCheckpoint as ya,sanitizeClientName as yi,errorResponse as yn,logsCurrentPath as yr,assertCompatibleStateManifest as yt,MISSING_OK_CONFIG_MESSAGE as z,tracedMkdir as zi,getTracer as zn,readSkillInstallStateSnapshot as zr,commitWipFromTree as zt};
3269
- //# sourceMappingURL=dist-CgoRMunD.mjs.map
3269
+ //# sourceMappingURL=dist-TG9U-N9P.mjs.map
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{i as e,r as t,t as n}from"./gh-detect-agW-_3XF.mjs";import{F as r,I as i,L as a,M as o,N as s,P as c,a as l,b as u,c as d,i as f,j as p,l as m,n as h,p as g,v as _,w as v,x as y}from"./init-DGGa0Poi.mjs";import{_ as b,d as x,g as S,i as C,l as w,n as T,p as E,r as D,t as O,u as k,v as A,y as j}from"./src-DkOsQ2G0.mjs";import{c as M,d as N,l as P,o as F,r as I,s as L,t as R,u as z}from"./write-project-skill-DRxDENrm.mjs";import{n as B}from"./loader-D1yXqf8H.mjs";import{n as V}from"./preview-Ar8Am8Lv.mjs";import{n as H,t as U}from"./mcp-migrate-event-D0NrGjvc.mjs";export{I as ALL_EDITOR_IDS,F as EDITOR_LABELS,L as EDITOR_TARGETS,M as HOSTS_WITH_USER_SKILL_DIR,h as LAUNCH_CONFIG_NAME,f as LAUNCH_UI_CHAIN_SENTINEL,l as LAUNCH_UI_CHAIN_V1,w as PATH_SHIM_BEGIN,k as PATH_SHIM_BLOCK_RE,x as PATH_SHIM_END,p as addOkPathsToGitExclude,R as assertProjectPathSafe,P as buildManagedServerEntry,D as buildMcpConfigDeclineEvent,U as buildMcpConfigMigrateEvent,d as classifyExistingMcpEntry,t as createTokenStore,n as detectGh,m as detectInstalledEditors,o as formatTrackedRemediation,s as getExcludedOkPaths,c as getOkArtifactPaths,z as isEntryUpToDate,N as isOwnManagedEntry,B as loadConfig,e as makeLazyProbeTokenStore,S as parseGitHubBlobUrl,b as parseGitHubShareUrl,A as parseGitHubTreeUrl,j as parseGitUrl,E as pathInstallMarkerPath,V as previewContent,r as probeTrackedOkPaths,g as readExistingMcpEntry,i as readSharingMode,a as removeOkPathsFromGitExclude,v as resolveProjectRoot,C as runStop,_ as scaffoldLaunchJson,H as truncatePriorEntry,T as validateLocalFolderForShare,u as writeEditorMcpConfig,O as writeProjectAiIntegrations,y as writeUserMcpConfigs};
1
+ import{i as e,r as t,t as n}from"./gh-detect-agW-_3XF.mjs";import{F as r,I as i,L as a,M as o,N as s,P as c,a as l,b as u,c as d,i as f,j as p,l as m,n as h,p as g,v as _,w as v,x as y}from"./init-OSum2tdu.mjs";import{_ as b,d as x,g as S,i as C,l as w,n as T,p as E,r as D,t as O,u as k,v as A,y as j}from"./src-BlGVwaKa.mjs";import{c as M,d as N,l as P,o as F,r as I,s as L,t as R,u as z}from"./write-project-skill-qMcfR4xG.mjs";import{n as B}from"./loader-OqBg2MkQ.mjs";import{n as V}from"./preview-DgLBzg0c.mjs";import{n as H,t as U}from"./mcp-migrate-event-D0NrGjvc.mjs";export{I as ALL_EDITOR_IDS,F as EDITOR_LABELS,L as EDITOR_TARGETS,M as HOSTS_WITH_USER_SKILL_DIR,h as LAUNCH_CONFIG_NAME,f as LAUNCH_UI_CHAIN_SENTINEL,l as LAUNCH_UI_CHAIN_V1,w as PATH_SHIM_BEGIN,k as PATH_SHIM_BLOCK_RE,x as PATH_SHIM_END,p as addOkPathsToGitExclude,R as assertProjectPathSafe,P as buildManagedServerEntry,D as buildMcpConfigDeclineEvent,U as buildMcpConfigMigrateEvent,d as classifyExistingMcpEntry,t as createTokenStore,n as detectGh,m as detectInstalledEditors,o as formatTrackedRemediation,s as getExcludedOkPaths,c as getOkArtifactPaths,z as isEntryUpToDate,N as isOwnManagedEntry,B as loadConfig,e as makeLazyProbeTokenStore,S as parseGitHubBlobUrl,b as parseGitHubShareUrl,A as parseGitHubTreeUrl,j as parseGitUrl,E as pathInstallMarkerPath,V as previewContent,r as probeTrackedOkPaths,g as readExistingMcpEntry,i as readSharingMode,a as removeOkPathsFromGitExclude,v as resolveProjectRoot,C as runStop,_ as scaffoldLaunchJson,H as truncatePriorEntry,T as validateLocalFolderForShare,u as writeEditorMcpConfig,O as writeProjectAiIntegrations,y as writeUserMcpConfigs};
@@ -0,0 +1 @@
1
+ import{_ as e}from"./init-OSum2tdu.mjs";export{e as runInit};