@inkeep/open-knowledge 0.64.0-beta.5 → 0.64.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-harness-probe-Bz_Xfqhw.mjs → acp-harness-probe-BML7wGVY.mjs} +2 -2
- package/dist/cli.mjs +46 -46
- package/dist/constants-sxUfcj6G.mjs +2 -0
- package/dist/index.d.mts +63 -63
- package/dist/index.mjs +24 -27
- package/dist/{init-JIlCRbdu.mjs → init-ChQc0EZ1.mjs} +37 -35
- package/dist/init-DgJM6DnS.mjs +1 -0
- package/dist/{launch-json-removal-D1H1a769.mjs → launch-json-removal-BrdHqkRe.mjs} +2 -2
- package/dist/{loader-BkOiHFr0.mjs → loader-Bz3Pc-W1.mjs} +2 -2
- package/dist/loader-DK5Ie7sZ.mjs +1 -0
- package/dist/{open-browser-CrMsTPIV.mjs → open-browser-mXaE0V-v.mjs} +2 -2
- package/dist/{preview-BF5V_rVP.mjs → preview-UNTRk4oX.mjs} +2 -2
- package/dist/preview-Z_AS1JW8.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-CauWCpUS.js → ActivityModeContent-CrcHRSaR.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-BNouQBfs.js → AddPropertiesButton-Dhb2CS28.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-DXQNRZ8O.js → AgentDiffPane-iV_pard0.js} +1 -1
- package/dist/public/assets/AgentThreadClientBinder-BeLgy3iy.js +1 -0
- package/dist/public/assets/{CodeMirrorPropInput-DX8Yunfs.js → CodeMirrorPropInput-BtM8bLgN.js} +1 -1
- package/dist/public/assets/{ConfigSharingInfoTooltip-CmY8gl8k.js → ConfigSharingInfoTooltip-D7VVLhT-.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-C4z025ef.js → ConsentDialogBody-BcI0XBtZ.js} +1 -1
- package/dist/public/assets/{DocumentContext-BV7jb-np.js → DocumentContext-BLYhIJKb.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-B8yEewMp.js → EditorModeToggle-BuOATFco.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-uAw_zEkg.js → EnableSyncConfirmDialog-DQVZgH-e.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-DhTxtSyA.js → ExcalidrawDocEditor-BiNEXjZO.js} +1 -1
- package/dist/public/assets/FeedbackForm-Bjktf7Jt.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-BYfuLW-m.js → ImportSkillDialog-BDHGW3fP.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-pJBzAP1G.js → LintConfigEditor-BWWinty4.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-BqpLg9rc.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-D1f8Frip.js → ManagedArtifactProperties-Bt9WbztG.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-DVxgZCM4.js → MermaidDocEditor-Dlr5gtqf.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-9aYyPFhc.js → PropertyDisplayRow-CjaFUnLr.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-0hGeiywr.js → SchemaConfigEditor-CucEIur2.js} +1 -1
- package/dist/public/assets/{SessionsHost-BegjN_Wv.js → SessionsHost-LdAlgsGb.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-Bng9Ek1r.js → SettingsDialogBody-BaOeNsR9.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-C2M-0S6A.js → ShareReceiveMissDialog-BzMzXr7U.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-C5Y79gdz.js → SkillInstallMenu-CglzHAk9.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DEiTj33j.js → SkillToolbarControls-BIUtpkZb.js} +1 -1
- package/dist/public/assets/{SourceEditor-DzxE90kB.js → SourceEditor-2ULgPpJa.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-zabnp2hc.js → TerminalWindowApp-CsYceTtM.js} +1 -1
- package/dist/public/assets/{TextDocEditor-5pSurn6C.js → TextDocEditor-BG0744jP.js} +1 -1
- package/dist/public/assets/ThreadView-CmaAxNLC.js +15 -0
- package/dist/public/assets/{TimelineDiffPane-BOSthuzR.js → TimelineDiffPane-ZQbqPdw2.js} +1 -1
- package/dist/public/assets/{agent-diff-store-CWlSMAcS.js → agent-diff-store-Dy0fjBEy.js} +1 -1
- package/dist/public/assets/{auth-state-cache-DN_6SHvB.js → auth-state-cache-Cl-oEkV3.js} +1 -1
- package/dist/public/assets/{comment-chips-BtWBKUUL.js → comment-chips-BXljbVyj.js} +1 -1
- package/dist/public/assets/{config-provider-BXiukxwE.js → config-provider-CH5GabLO.js} +3 -3
- package/dist/public/assets/i18n-fff2WirB.js +1 -0
- package/dist/public/assets/{index-CEIpyn32.js → index-DETxM0cG.js} +8 -8
- package/dist/public/assets/{launch-agent-thread-J0X5JOlh.js → launch-agent-thread-CiJKMl7i.js} +1 -1
- package/dist/public/assets/messages-BA7DohGj.js +1 -0
- package/dist/public/assets/messages-BdGgYrkw.js +1 -0
- package/dist/public/assets/messages-BmJwFFk2.js +1 -0
- package/dist/public/assets/messages-CAE2zUYV.js +1 -0
- package/dist/public/assets/messages-CrVPM5E4.js +1 -0
- package/dist/public/assets/messages-D-zK8yr7.js +1 -0
- package/dist/public/assets/messages-DUPvSdtJ.js +1 -0
- package/dist/public/assets/messages-DopL6n4F.js +1 -0
- package/dist/public/assets/messages-Dqi8grxj.js +1 -0
- package/dist/public/assets/messages-MMPlXGaP.js +1 -0
- package/dist/public/assets/messages-Onfj9qmo.js +1 -0
- package/dist/public/assets/messages-tKMCe9_5.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-DLOxz1b_.js → pending-receive-nav-store-TC2l6M7Y.js} +1 -1
- package/dist/public/assets/{progress-BtHJSSZk.js → progress-i5ULe7SF.js} +1 -1
- package/dist/public/assets/{project-paths-BN2qP-Oz.js → project-paths-VEOKTjqe.js} +1 -1
- package/dist/public/assets/{selection-context-C0Dh06ez.js → selection-context-D9UxW_oI.js} +1 -1
- package/dist/public/assets/{src-XvoJ42p_.js → src-CMLgwlib.js} +1 -1
- package/dist/public/assets/thread-client-BpV1TUph.js +3 -0
- package/dist/public/assets/{typing-burst-detector-CtCPp1ik.js → typing-burst-detector-D_M-RPSc.js} +1 -1
- package/dist/public/assets/{uninstall-Be_VK869.js → uninstall-B-oOJpa1.js} +1 -1
- package/dist/public/assets/{use-activity-panel-Bat2VfJF.js → use-activity-panel-bh4GxchM.js} +1 -1
- package/dist/public/assets/{use-open-skill-B004qnQw.js → use-open-skill-CoAITmJi.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-ST2-eUch.js → use-terminal-enabled-qkqdcBcO.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-C-o8h9N3.js → use-timeline-entry-diff-BPHrBftQ.js} +1 -1
- package/dist/public/index.html +22 -22
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-BVjKD52o.mjs → repair-launch-json-BWwjyrdu.mjs} +2 -2
- package/dist/{repair-mcp-configs-BQ7U1U_I.mjs → repair-mcp-configs-D6VBK-GI.mjs} +2 -2
- package/dist/repair-skills-CBdnIHQ1.mjs +1 -0
- package/dist/{repair-skills-DPyYfXHX.mjs → repair-skills-Dbdo1dep.mjs} +2 -2
- package/dist/{resolve-project-root-suxWrGvT.mjs → resolve-project-root-BgZ293gs.mjs} +2 -2
- package/dist/{skill-teardown-D4qifTbZ.mjs → skill-teardown-BQcurw-H.mjs} +2 -2
- package/dist/{src-CnywvEPN.mjs → src-CkaS3ZCg.mjs} +2 -2
- package/dist/{src-C8wtGJxJ.mjs → src-DB7C0CZe.mjs} +1 -1
- package/dist/{src-CNSuUQTi.mjs → src-DGS-lA-C.mjs} +330 -328
- package/dist/src-DwfqRaaM.mjs +1 -0
- package/dist/{start-ClCOtrI0.mjs → start-Ce9Y7lY6.mjs} +3 -3
- package/dist/start-D_L9hslR.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-BgJb28Cb.mjs +0 -2
- package/dist/init-Cpnor43q.mjs +0 -1
- package/dist/loader-ROlCo-Nz.mjs +0 -1
- package/dist/preview-PgQuIcNJ.mjs +0 -1
- package/dist/public/assets/AgentThreadClientBinder-5zJFp5cf.js +0 -1
- package/dist/public/assets/FeedbackForm-DJ9TwFhA.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CFDGVAK1.js +0 -1
- package/dist/public/assets/ThreadView-DY925XKN.js +0 -14
- package/dist/public/assets/i18n-CHdOLU04.js +0 -1
- package/dist/public/assets/messages-B9v-Dl6o.js +0 -1
- package/dist/public/assets/messages-BNKgouAQ.js +0 -1
- package/dist/public/assets/messages-BWVpwygE.js +0 -1
- package/dist/public/assets/messages-BdoFX7Ke.js +0 -1
- package/dist/public/assets/messages-BozLzcJu.js +0 -1
- package/dist/public/assets/messages-C0rOkBCJ.js +0 -1
- package/dist/public/assets/messages-CF7zITDG.js +0 -1
- package/dist/public/assets/messages-CIBqdK6N.js +0 -1
- package/dist/public/assets/messages-CfXBJncQ.js +0 -1
- package/dist/public/assets/messages-DXdzgbRq.js +0 -1
- package/dist/public/assets/messages-G8fhkSEs.js +0 -1
- package/dist/public/assets/messages-z_LlF45n.js +0 -1
- package/dist/public/assets/thread-client-CyOBKqv0.js +0 -1
- package/dist/repair-skills-DIytACob.mjs +0 -1
- package/dist/src-7XhmCEkb.mjs +0 -1
- package/dist/start-CxNMq7dN.mjs +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -9828,23 +9828,6 @@ declare module '@tiptap/core' {
|
|
|
9828
9828
|
* special-case in the mdxJsxTextElement handler.
|
|
9829
9829
|
*/
|
|
9830
9830
|
//#endregion
|
|
9831
|
-
//#region ../../node_modules/.pnpm/@tiptap+extension-horizontal-rule@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4__@tiptap+pm@3.22.4/node_modules/@tiptap/extension-horizontal-rule/dist/index.d.ts
|
|
9832
|
-
declare module '@tiptap/core' {
|
|
9833
|
-
interface Commands<ReturnType> {
|
|
9834
|
-
horizontalRule: {
|
|
9835
|
-
/**
|
|
9836
|
-
* Add a horizontal rule
|
|
9837
|
-
* @example editor.commands.setHorizontalRule()
|
|
9838
|
-
*/
|
|
9839
|
-
setHorizontalRule: () => ReturnType;
|
|
9840
|
-
};
|
|
9841
|
-
}
|
|
9842
|
-
}
|
|
9843
|
-
/**
|
|
9844
|
-
* This extension allows you to insert horizontal rules.
|
|
9845
|
-
* @see https://www.tiptap.dev/api/nodes/horizontal-rule
|
|
9846
|
-
*/
|
|
9847
|
-
//#endregion
|
|
9848
9831
|
//#region ../../node_modules/.pnpm/@tiptap+extension-blockquote@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4_/node_modules/@tiptap/extension-blockquote/dist/index.d.ts
|
|
9849
9832
|
declare module '@tiptap/core' {
|
|
9850
9833
|
interface Commands<ReturnType> {
|
|
@@ -9868,6 +9851,23 @@ declare module '@tiptap/core' {
|
|
|
9868
9851
|
* Matches a blockquote to a `>` as input.
|
|
9869
9852
|
*/
|
|
9870
9853
|
//#endregion
|
|
9854
|
+
//#region ../../node_modules/.pnpm/@tiptap+extension-horizontal-rule@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4__@tiptap+pm@3.22.4/node_modules/@tiptap/extension-horizontal-rule/dist/index.d.ts
|
|
9855
|
+
declare module '@tiptap/core' {
|
|
9856
|
+
interface Commands<ReturnType> {
|
|
9857
|
+
horizontalRule: {
|
|
9858
|
+
/**
|
|
9859
|
+
* Add a horizontal rule
|
|
9860
|
+
* @example editor.commands.setHorizontalRule()
|
|
9861
|
+
*/
|
|
9862
|
+
setHorizontalRule: () => ReturnType;
|
|
9863
|
+
};
|
|
9864
|
+
}
|
|
9865
|
+
}
|
|
9866
|
+
/**
|
|
9867
|
+
* This extension allows you to insert horizontal rules.
|
|
9868
|
+
* @see https://www.tiptap.dev/api/nodes/horizontal-rule
|
|
9869
|
+
*/
|
|
9870
|
+
//#endregion
|
|
9871
9871
|
//#region ../../node_modules/.pnpm/@tiptap+extension-code@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4_/node_modules/@tiptap/extension-code/dist/index.d.ts
|
|
9872
9872
|
declare module '@tiptap/core' {
|
|
9873
9873
|
interface Commands<ReturnType> {
|
|
@@ -11964,8 +11964,6 @@ interface OkSharingStatusResult {
|
|
|
11964
11964
|
readonly mode: 'shared' | 'local-only' | 'no-git';
|
|
11965
11965
|
readonly excluded: readonly string[];
|
|
11966
11966
|
readonly trackedUpstream: readonly string[];
|
|
11967
|
-
/** True when local-only but `.ok/skills/` is carved back out as shareable. */
|
|
11968
|
-
readonly skillsShared: boolean;
|
|
11969
11967
|
}
|
|
11970
11968
|
type OkSharingSetModeResult = {
|
|
11971
11969
|
readonly kind: 'applied';
|
|
@@ -12550,8 +12548,7 @@ interface OkDesktopBridge {
|
|
|
12550
12548
|
*/
|
|
12551
12549
|
sharing: {
|
|
12552
12550
|
status(): Promise<OkSharingStatusResult>;
|
|
12553
|
-
setMode(mode: 'shared' | 'local-only'): Promise<OkSharingSetModeResult>;
|
|
12554
|
-
setSkillsShared(shared: boolean): Promise<OkSharingSetModeResult>;
|
|
12551
|
+
setMode(mode: 'shared' | 'local-only'): Promise<OkSharingSetModeResult>;
|
|
12555
12552
|
};
|
|
12556
12553
|
/**
|
|
12557
12554
|
* Slides (Slidev) — `status` detects a runnable `slidev`; `open` starts (or
|
|
@@ -13492,16 +13489,35 @@ interface TrackedRefusal {
|
|
|
13492
13489
|
/** Resolved sharing-mode reading derived from `.git/info/exclude` content. */
|
|
13493
13490
|
type SharingMode = 'shared' | 'local-only' | 'no-git';
|
|
13494
13491
|
/**
|
|
13495
|
-
* Return the canonical OK artifact set for a project
|
|
13492
|
+
* Return the canonical OK artifact set for a project — what the sharing
|
|
13493
|
+
* toggle may git-exclude. Artifact classes:
|
|
13496
13494
|
*
|
|
13497
13495
|
* - `.ok/` — whole-tree, config + folder configs
|
|
13498
13496
|
* - `.okignore` — project ignore file (gitignore syntax)
|
|
13499
|
-
* - `.mcp.json`
|
|
13500
|
-
* - `.cursor/mcp.json`
|
|
13501
|
-
* - `.codex/config.toml`
|
|
13502
|
-
* -
|
|
13503
|
-
*
|
|
13504
|
-
*
|
|
13497
|
+
* - `.mcp.json` — Claude Code project MCP (merged file)
|
|
13498
|
+
* - `.cursor/mcp.json` — Cursor project MCP (merged file)
|
|
13499
|
+
* - `.codex/config.toml` — Codex project MCP (merged file)
|
|
13500
|
+
* - `opencode.json` — OpenCode project config (merged file)
|
|
13501
|
+
* - `.pi/extensions/open-knowledge.ts` — Pi bridge extension (OK's own file)
|
|
13502
|
+
* - `.claude/launch.json` — Claude launcher entry (merged file)
|
|
13503
|
+
*
|
|
13504
|
+
* The merged files hold entries OK did not write, and excluding one hides the
|
|
13505
|
+
* whole file. That is deliberate and it is what keeps OK's MCP entry out of a
|
|
13506
|
+
* team's repo when a user is only trying OK: without it, `ok init` writes an
|
|
13507
|
+
* entry into `.mcp.json` and the next `git add -A` commits it. The case where
|
|
13508
|
+
* hiding a merged file would bury a teammate's work is already prevented
|
|
13509
|
+
* upstream of here — `addOkPathsToGitExclude` runs `probeTrackedOkPaths` first
|
|
13510
|
+
* and REFUSES when any candidate path is tracked, so an already-committed
|
|
13511
|
+
* `.mcp.json` is never hidden.
|
|
13512
|
+
*
|
|
13513
|
+
* NOT here: authored skills at `.{host}/skills/<name>/`. Those are the user's
|
|
13514
|
+
* own content — OK projected them, but whether they are committed is the
|
|
13515
|
+
* project's decision, not a side effect of OK's sharing mode. They were in this
|
|
13516
|
+
* set until skills were taken off the toggle; `getInstalledSkillProjectionPaths`
|
|
13517
|
+
* still names them for
|
|
13518
|
+
* `ok deinit` and for draining the lines older builds wrote.
|
|
13519
|
+
*
|
|
13520
|
+
* NOT here either: OK's built-in `open-knowledge` project-skill projection
|
|
13505
13521
|
* (`.{host}/skills/open-knowledge/`). That bundle is a LOCAL, per-machine
|
|
13506
13522
|
* artifact — the app regenerates it on every open and different builds
|
|
13507
13523
|
* version-stamp it differently — so it is ALWAYS git-excluded via a committed
|
|
@@ -13509,8 +13525,7 @@ type SharingMode = 'shared' | 'local-only' | 'no-git';
|
|
|
13509
13525
|
* `@inkeep/open-knowledge-server`), independent of this shared/local-only
|
|
13510
13526
|
* toggle. Carving it OUT here is what makes the exclusion unconditional:
|
|
13511
13527
|
* leaving it in would only hide it in local-only mode, and it must be hidden in
|
|
13512
|
-
* BOTH modes.
|
|
13513
|
-
* toggle (handled by the installed-skill marker loop below).
|
|
13528
|
+
* BOTH modes.
|
|
13514
13529
|
*
|
|
13515
13530
|
* `.ok/` and `.okignore` are emitted UNANCHORED (slash-free). gitignore
|
|
13516
13531
|
* matches a slash-free pattern at every depth, so one entry each covers the
|
|
@@ -13525,11 +13540,25 @@ type SharingMode = 'shared' | 'local-only' | 'no-git';
|
|
|
13525
13540
|
* carry a trailing `/` so the gitignore syntax in `.git/info/exclude` treats
|
|
13526
13541
|
* them as whole-tree excludes; file entries do not.
|
|
13527
13542
|
*
|
|
13528
|
-
* Derives the per-editor `projectConfigPath`
|
|
13529
|
-
*
|
|
13530
|
-
*
|
|
13543
|
+
* Derives the per-editor `projectConfigPath` slots from `EDITOR_TARGETS` so a
|
|
13544
|
+
* future editor entry with a project-scope config flows through automatically
|
|
13545
|
+
* — no hand-maintained list.
|
|
13531
13546
|
*/
|
|
13532
13547
|
declare function getOkArtifactPaths(projectRoot: string): readonly string[];
|
|
13548
|
+
/**
|
|
13549
|
+
* Project-relative paths of the authored-skill bundles OK has projected into
|
|
13550
|
+
* editor host dirs, per `.ok/local/installed-skills.json`.
|
|
13551
|
+
*
|
|
13552
|
+
* NOT part of the sharing toggle (see `getOkArtifactPaths`) — these are the
|
|
13553
|
+
* user's content. Two callers still need to name them: `ok deinit`, which
|
|
13554
|
+
* removes the projections OK created, and the legacy exclude cleanup, which
|
|
13555
|
+
* strips lines older builds wrote.
|
|
13556
|
+
*
|
|
13557
|
+
* The reserved built-in `open-knowledge` bundle is skipped — it is always
|
|
13558
|
+
* git-ignored via the committed `.gitignore` block and swept separately by
|
|
13559
|
+
* deinit. Never throws: a missing or corrupt marker reads as no projections.
|
|
13560
|
+
*/
|
|
13561
|
+
declare function getInstalledSkillProjectionPaths(projectRoot: string): readonly string[];
|
|
13533
13562
|
/**
|
|
13534
13563
|
* Append each path to `<gitdir>/info/exclude`, idempotent against the four
|
|
13535
13564
|
* recognized variants per path. Runs `probeTrackedOkPaths` FIRST — when any
|
|
@@ -13579,35 +13608,6 @@ declare function readSharingMode(projectRoot: string): SharingMode;
|
|
|
13579
13608
|
* implementation — no `excludeFileContains`-style duplicate.
|
|
13580
13609
|
*/
|
|
13581
13610
|
declare function getExcludedOkPaths(projectRoot: string): readonly string[];
|
|
13582
|
-
/**
|
|
13583
|
-
* True iff `.git/info/exclude` currently carves `.ok/skills/` OUT of a
|
|
13584
|
-
* local-only `.ok/` exclusion — the project is local-only, but skills stay
|
|
13585
|
-
* shareable. Detected by the presence of BOTH carve lines. Pure read — never
|
|
13586
|
-
* throws, never writes.
|
|
13587
|
-
*
|
|
13588
|
-
* Independent of `readSharingMode` (which reports `local-only` for both the
|
|
13589
|
-
* blanket and the carve state); this predicate distinguishes the two so the
|
|
13590
|
-
* Skills UI can render the toggle's current position.
|
|
13591
|
-
*/
|
|
13592
|
-
declare function readSkillsShared(projectRoot: string): boolean;
|
|
13593
|
-
/**
|
|
13594
|
-
* Toggle whether `.ok/skills/` stays shareable while the rest of `.ok/`
|
|
13595
|
-
* remains local-only. Swaps the `.ok/` representation in `.git/info/exclude`
|
|
13596
|
-
* between the blanket spelling (`OK_BLANKET`, skills hidden) and the carve
|
|
13597
|
-
* spelling (`OK_CARVE_CHILDREN` + `OK_CARVE_SKILLS_REINCLUDE`, skills visible).
|
|
13598
|
-
* Every OTHER OK-artifact exclude line is left untouched, so the local-only
|
|
13599
|
-
* posture for config / MCP / editor bundles is preserved.
|
|
13600
|
-
*
|
|
13601
|
-
* Mechanical — callers gate WHEN it is offered (the desktop Skills UI shows it
|
|
13602
|
-
* only in local-only mode). `shared: true` on a project that is NOT local-only
|
|
13603
|
-
* would create a partial exclusion; don't call it there.
|
|
13604
|
-
*
|
|
13605
|
-
* No tracked-files probe: turning skills sharing ON only REMOVES exclusion
|
|
13606
|
-
* (never hides a tracked file); turning it OFF re-adds the blanket, which is
|
|
13607
|
-
* inert against already-tracked skills — the same no-op the main
|
|
13608
|
-
* `shared -> local-only` refusal already documents.
|
|
13609
|
-
*/
|
|
13610
|
-
declare function setSkillsShared(projectRoot: string, shared: boolean): ExcludeWriteResult;
|
|
13611
13611
|
/**
|
|
13612
13612
|
* Pure probe — checks which of `paths` (if any) are currently tracked
|
|
13613
13613
|
* upstream via `git ls-files --error-unmatch`. Used at exactly one site
|
|
@@ -14626,5 +14626,5 @@ interface ReportBundleResult {
|
|
|
14626
14626
|
*/
|
|
14627
14627
|
declare function collectReportBundle(opts: CollectReportBundleOptions): Promise<ReportBundleResult>;
|
|
14628
14628
|
//#endregion
|
|
14629
|
-
export { ALL_EDITOR_IDS, type BundleExtraFile, type BundleLogger, type CollectReportBundleOptions, EDITOR_LABELS, EDITOR_TARGETS, type EditorId, type EditorMcpResult, type EditorMcpTarget, type EnsurePiBridgeResult, type ExcludeWriteResult, type ExpectedShareRepo, type GhAccount, type GhDetectResult, HOSTS_WITH_USER_SKILL_DIR, type IntegrationWriteOutcome, LAUNCH_CONFIG_NAME, type LanguageMetadata, type LoadConfigResult, type McpConfigDeclineEvent, type McpConfigDeclineScope, type McpConfigMigrateEvent, type McpConfigMigrateScope, type McpDeclineReason, type McpEntryClassification, type McpInstallOptions, type McpRemoveOutcome, type OwnManagedMcpEntryHit, PATH_SHIM_BEGIN, PATH_SHIM_BLOCK_RE, PATH_SHIM_END, type ParsedGitHubBlobUrl, type ParsedGitHubShareTarget, type ParsedGitHubTreeUrl, type PathDiscovery, type PathInstallConsent, type PathInstallMarker, type PiBridgeFileState, type PiBridgeState, type PiBridgeWriteAction, type PiTrustState, type PiTrustWriteAction, type PreviewResult, type ProjectAiIntegrationsResult, type ProjectSkillRemoveResult, type ProjectSkillResult, type ReportBundleLevel, type ReportBundleResult, type ReportBundleSummary, type ResolveProjectRootOptions, type ResolveProjectRootResult, type ShareFolderValidationResult, type SharingMode, type SkillBundleTarget, type TokenStore, type TrackedRefusal, type UserMcpConfigsOptions, addOkPathsToGitExclude, assertProjectPathSafe, buildManagedServerEntry, buildMcpConfigDeclineEvent, buildMcpConfigMigrateEvent, classifyExistingMcpEntry, collectReportBundle, createTokenStore, defaultBugReportZipPath, detectGh, detectGhAccounts, detectInstalledEditors, editorConfigPathDisplay, editorEntryLocator, ensurePiBridge, formatTrackedRemediation, getExcludedOkPaths, getNativeTomlMcpEditor, getOkArtifactPaths, isEntryUpToDate, isOwnManagedEntry, loadConfig, makeLazyProbeTokenStore, okBugReportsDir, parseGitHubBlobUrl, parseGitHubShareUrl, parseGitHubTreeUrl, parseGitUrl, pathInstallMarkerPath, previewContent, probeOwnManagedEditorMcpEntry, probePiBridgeState, probeTrackedOkPaths, readExistingMcpEntry, readSharingMode,
|
|
14629
|
+
export { ALL_EDITOR_IDS, type BundleExtraFile, type BundleLogger, type CollectReportBundleOptions, EDITOR_LABELS, EDITOR_TARGETS, type EditorId, type EditorMcpResult, type EditorMcpTarget, type EnsurePiBridgeResult, type ExcludeWriteResult, type ExpectedShareRepo, type GhAccount, type GhDetectResult, HOSTS_WITH_USER_SKILL_DIR, type IntegrationWriteOutcome, LAUNCH_CONFIG_NAME, type LanguageMetadata, type LoadConfigResult, type McpConfigDeclineEvent, type McpConfigDeclineScope, type McpConfigMigrateEvent, type McpConfigMigrateScope, type McpDeclineReason, type McpEntryClassification, type McpInstallOptions, type McpRemoveOutcome, type OwnManagedMcpEntryHit, PATH_SHIM_BEGIN, PATH_SHIM_BLOCK_RE, PATH_SHIM_END, type ParsedGitHubBlobUrl, type ParsedGitHubShareTarget, type ParsedGitHubTreeUrl, type PathDiscovery, type PathInstallConsent, type PathInstallMarker, type PiBridgeFileState, type PiBridgeState, type PiBridgeWriteAction, type PiTrustState, type PiTrustWriteAction, type PreviewResult, type ProjectAiIntegrationsResult, type ProjectSkillRemoveResult, type ProjectSkillResult, type ReportBundleLevel, type ReportBundleResult, type ReportBundleSummary, type ResolveProjectRootOptions, type ResolveProjectRootResult, type ShareFolderValidationResult, type SharingMode, type SkillBundleTarget, type TokenStore, type TrackedRefusal, type UserMcpConfigsOptions, addOkPathsToGitExclude, assertProjectPathSafe, buildManagedServerEntry, buildMcpConfigDeclineEvent, buildMcpConfigMigrateEvent, classifyExistingMcpEntry, collectReportBundle, createTokenStore, defaultBugReportZipPath, detectGh, detectGhAccounts, detectInstalledEditors, editorConfigPathDisplay, editorEntryLocator, ensurePiBridge, formatTrackedRemediation, getExcludedOkPaths, getInstalledSkillProjectionPaths, getNativeTomlMcpEditor, getOkArtifactPaths, isEntryUpToDate, isOwnManagedEntry, loadConfig, makeLazyProbeTokenStore, okBugReportsDir, parseGitHubBlobUrl, parseGitHubShareUrl, parseGitHubTreeUrl, parseGitUrl, pathInstallMarkerPath, previewContent, probeOwnManagedEditorMcpEntry, probePiBridgeState, probeTrackedOkPaths, readExistingMcpEntry, readSharingMode, redactSecrets as redactContent, removeOkPathsFromGitExclude, removeOwnMcpEntry, removeProjectSkill, removeUserGlobalSkillBundle, resolveProjectRoot, runStop, truncatePriorEntry, userGlobalSkillBundleTargets, validateLocalFolderForShare, writeEditorMcpConfig, writeProjectAiIntegrations, writeProjectSkill, writeUserMcpConfigs };
|
|
14630
14630
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1479,55 +1479,52 @@ export default function okBridge(pi: {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
});
|
|
1481
1481
|
}
|
|
1482
|
-
`}function HCe(e,t){let n=_e(W6(t),W6(e));return n.length>0&&!n.startsWith(`..`)&&!M(n)}const UCe=e=>{try{let t=c(`git`,[`rev-parse`,`--show-toplevel`],d3({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function WCe(e,t={}){let n=t.homeDir??oe(),r=t.gitTopLevel??UCe,i=ve(e),a;try{a=T(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(E3(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=pe(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&HCe(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}function S7(e,t){let n;try{n=_(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);C7(e,t)}function GCe(e,t){C7(e,t)}function C7(e,t){let n;try{n=T(t)}catch{n=ve(t)}let r=pe(e);for(;r.length>1&&r!==ye;){let t;try{t=T(r)}catch(e){if(e.code===`ENOENT`){r=pe(r);continue}throw e}let i=_e(n,t);if(i===``||!i.startsWith(`..`)&&!M(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function w7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function KCe(e,t,n){try{if(O(n).size>10485760)return!1}catch{return!1}let r;try{r=S(n,`utf-8`)}catch{return!1}let i=[],a=ube(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!w7(a))return!1;let o=a[e.topLevelKey];if(!w7(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;return w7(s)?w7(s[e.serverName(t)]):!1}function qCe(e,t,n={}){if(!Yl.includes(e.id))return!0;try{return KCe(e,t,e.configPath(t,n.home))}catch{return!1}}function T7(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!qCe(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=bye(`project`,{checkDesktop:!0}),i=pe(r);S7(i,t);let a=g(r)?`overwritten`:`written`;return D(i,{recursive:!0,force:!0}),v(pe(i),{recursive:!0}),m(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function JCe(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=pe(n);return g(n)?(GCe(r,t),D(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function E7(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;return t===`MODULE_NOT_FOUND`||t===`ERR_MODULE_NOT_FOUND`}function D7(e,t){if(!process.env.OK_DEBUG_NATIVE)return;let n=t instanceof Error?t.message:String(t);process.stderr.write(`[ok] native-config ${e}: ${n}\n`)}const YCe=[`native`,`index.js`];function O7(e={}){let t=e.moduleUrl??import.meta.url,n=e.requireModule??o(t);try{return n(N(pe(Se(t)),...YCe))}catch(e){E7(e)||D7(`bundled loader failed to load`,e)}try{return n(`@inkeep/open-knowledge-native-config`)}catch(e){return E7(e)||D7(`workspace addon failed to load`,e),null}}function XCe(){let e=O7();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function ZCe(e){let t=e,n=new Set;for(;;){let r;try{r=_(t).isSymbolicLink()}catch(n){return n.code===`ENOENT`?{readPath:t,writePath:t}:{readPath:null,writePath:e}}if(!r)return{readPath:t,writePath:t};if(n.has(t))return{readPath:null,writePath:e};n.add(t);let i;try{i=w(t)}catch(t){return D7(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=M(i)?i:N(pe(t),i)}}let k7;function QCe(){return k7===void 0&&(k7=XCe()),k7}function $Ce(e,t=QCe){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){D7(`resolveSymlinkWritePath threw`,e)}return ZCe(e)}function A7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ewe(){let e=O7();return e&&typeof e.parseTomlToJson==`function`?e:null}function twe(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return D7(`addon loaded but probe failed`,e),!1}}function j7(e){if(!A7(e))throw Error(`TOML root is not a table`);return e}function nwe(e){return{backend:`native`,parseToObject(t){return j7(JSON.parse(e.parseTomlToJson(t)))},upsertEntry(t,n,r){let i=e.upsertMcpServer(t,n,JSON.stringify(r));return{text:i.text,existed:i.existed}},removeEntry(t,n){let r=e.removeMcpServer(t,n);return{text:r.text,existed:r.existed}}}}function rwe(){return{backend:`fallback`,parseToObject(e){return j7(MCe(e))}}}function iwe(e=ewe){let t=e();return t&&twe(t)?nwe(t):rwe()}let M7=null;function N7(){return M7===null&&(M7=iwe()),M7}function awe(){let e=N7();return e.backend===`native`?e:void 0}const P7
|
|
1482
|
+
`}function HCe(e,t){let n=_e(W6(t),W6(e));return n.length>0&&!n.startsWith(`..`)&&!M(n)}const UCe=e=>{try{let t=c(`git`,[`rev-parse`,`--show-toplevel`],d3({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function WCe(e,t={}){let n=t.homeDir??oe(),r=t.gitTopLevel??UCe,i=ve(e),a;try{a=T(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(E3(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=pe(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&HCe(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}function S7(e,t){let n;try{n=_(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);C7(e,t)}function GCe(e,t){C7(e,t)}function C7(e,t){let n;try{n=T(t)}catch{n=ve(t)}let r=pe(e);for(;r.length>1&&r!==ye;){let t;try{t=T(r)}catch(e){if(e.code===`ENOENT`){r=pe(r);continue}throw e}let i=_e(n,t);if(i===``||!i.startsWith(`..`)&&!M(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function w7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function KCe(e,t,n){try{if(O(n).size>10485760)return!1}catch{return!1}let r;try{r=S(n,`utf-8`)}catch{return!1}let i=[],a=ube(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!w7(a))return!1;let o=a[e.topLevelKey];if(!w7(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;return w7(s)?w7(s[e.serverName(t)]):!1}function qCe(e,t,n={}){if(!Yl.includes(e.id))return!0;try{return KCe(e,t,e.configPath(t,n.home))}catch{return!1}}function T7(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!qCe(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=bye(`project`,{checkDesktop:!0}),i=pe(r);S7(i,t);let a=g(r)?`overwritten`:`written`;return D(i,{recursive:!0,force:!0}),v(pe(i),{recursive:!0}),m(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function JCe(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=pe(n);return g(n)?(GCe(r,t),D(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function E7(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;return t===`MODULE_NOT_FOUND`||t===`ERR_MODULE_NOT_FOUND`}function D7(e,t){if(!process.env.OK_DEBUG_NATIVE)return;let n=t instanceof Error?t.message:String(t);process.stderr.write(`[ok] native-config ${e}: ${n}\n`)}const YCe=[`native`,`index.js`];function O7(e={}){let t=e.moduleUrl??import.meta.url,n=e.requireModule??o(t);try{return n(N(pe(Se(t)),...YCe))}catch(e){E7(e)||D7(`bundled loader failed to load`,e)}try{return n(`@inkeep/open-knowledge-native-config`)}catch(e){return E7(e)||D7(`workspace addon failed to load`,e),null}}function XCe(){let e=O7();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function ZCe(e){let t=e,n=new Set;for(;;){let r;try{r=_(t).isSymbolicLink()}catch(n){return n.code===`ENOENT`?{readPath:t,writePath:t}:{readPath:null,writePath:e}}if(!r)return{readPath:t,writePath:t};if(n.has(t))return{readPath:null,writePath:e};n.add(t);let i;try{i=w(t)}catch(t){return D7(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=M(i)?i:N(pe(t),i)}}let k7;function QCe(){return k7===void 0&&(k7=XCe()),k7}function $Ce(e,t=QCe){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){D7(`resolveSymlinkWritePath threw`,e)}return ZCe(e)}function A7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ewe(){let e=O7();return e&&typeof e.parseTomlToJson==`function`?e:null}function twe(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return D7(`addon loaded but probe failed`,e),!1}}function j7(e){if(!A7(e))throw Error(`TOML root is not a table`);return e}function nwe(e){return{backend:`native`,parseToObject(t){return j7(JSON.parse(e.parseTomlToJson(t)))},upsertEntry(t,n,r){let i=e.upsertMcpServer(t,n,JSON.stringify(r));return{text:i.text,existed:i.existed}},removeEntry(t,n){let r=e.removeMcpServer(t,n);return{text:r.text,existed:r.existed}}}}function rwe(){return{backend:`fallback`,parseToObject(e){return j7(MCe(e))}}}function iwe(e=ewe){let t=e();return t&&twe(t)?nwe(t):rwe()}let M7=null;function N7(){return M7===null&&(M7=iwe()),M7}function awe(){let e=N7();return e.backend===`native`?e:void 0}const P7=`**/.ok/*`,F7=`!**/${Rl}/`;function I7(e){let t=[`.ok/`,`.okignore`];for(let n of P5){let r=n7[n];r.projectConfigPath&&t.push(uwe(r.projectConfigPath(e),e))}return t.push(`.claude/launch.json`),Array.from(new Set(t))}function L7(e){let t=N(e,...sX);if(!g(t))return[];try{let e=dX(S(t,`utf-8`));if(!e)return[];let n=[];for(let[t,r]of Object.entries(e.skills))if(t!==`open-knowledge`)for(let e of r.hosts){let r=Hl[e];r&&n.push(`${r}/${t}/`)}return Array.from(new Set(n))}catch{return[]}}function owe(e,t){let n=R7(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:z7(n)};let r=B7(e);if(r.kind!==`ok`)return r.result;let i=g(r.path)?S(r.path,`utf-8`):``,a=new Set(L7(e)),o=[],s=a.size===0?i:i.split(`
|
|
1483
|
+
`).filter(e=>{let t=e.trim();return a.has(t)?(o.push(t),!1):!0}).join(`
|
|
1484
|
+
`),c=U7(s),l=[],u=[];for(let e of t)H7(c,e)?u.push(e):l.push(e);if(l.length===0&&o.length===0)return{kind:`updated`,appended:l,alreadyPresent:u,removed:[]};let d=l.length===0||s.length===0||s.endsWith(`
|
|
1483
1485
|
`)?``:`
|
|
1484
|
-
`,l
|
|
1485
|
-
`)}\n`;try{te(r.path,`${
|
|
1486
|
-
`),s=new Set,c=[];for(let e of o){let t=e.trim();if(i.has(t)){s.add(t);continue}c.push(e)}let l=
|
|
1487
|
-
`);if(u!==a)try{te(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function cwe(e){let t=B7(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!g(t.path))return`shared`;let n;try{n=S(t.path,`utf-8`)}catch{return`shared`}let r=U7(n),i=
|
|
1488
|
-
`).filter(e=>!i.has(e.trim())),o=t?[F7,I7]:[P7],s=a.join(`
|
|
1489
|
-
`),c=`${s}${s.length===0||s.endsWith(`
|
|
1490
|
-
`)?``:`
|
|
1491
|
-
`}${o.join(`
|
|
1492
|
-
`)}\n`;try{te(n.path,c,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:o,alreadyPresent:[],removed:[]}}function R7(e,t){let n=[];for(let r of t)if(g(ve(e,r)))try{c(`git`,[`ls-files`,`--error-unmatch`,`--`,r],d3({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}return{tracked:n}}function z7(e){let t=[];t.push(`Cannot switch OpenKnowledge to local-only — these OK files are tracked upstream:`),t.push(``);for(let n of e)t.push(` ${n}`);t.push(``),t.push(`.git/info/exclude only hides files that git isn't already tracking. To proceed, untrack them first:`),t.push(``);for(let n of e){let e=n.replace(/\/$/,``),r=n.endsWith(`/`)?`-r `:``;t.push(` git rm --cached ${r}${e}`)}return t.push(``),t.push("Then re-run the command. Note: `git rm --cached` removes the files from the index — your teammates will see a deletion on their next pull. If you don't want that, leave sharing mode set to 'shared'."),t.join(`
|
|
1486
|
+
`,f=l.length===0?``:`${l.join(`
|
|
1487
|
+
`)}\n`;try{te(r.path,`${s}${d}${f}`,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:l,alreadyPresent:u,removed:o}}function swe(e,t){let n=B7(e);if(n.kind!==`ok`)return n.result;if(!g(n.path))return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let r=t.map(e=>V7(e)),i=new Set;for(let e of r)for(let t of e)i.add(t);i.add(P7),i.add(F7);for(let t of L7(e))i.add(t);let a;try{a=S(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let o=a.split(`
|
|
1488
|
+
`),s=new Set,c=[];for(let e of o){let t=e.trim();if(i.has(t)){s.add(t);continue}c.push(e)}let l=[...s];if(s.size===0)return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let u=c.join(`
|
|
1489
|
+
`);if(u!==a)try{te(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function cwe(e){let t=B7(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!g(t.path))return`shared`;let n;try{n=S(t.path,`utf-8`)}catch{return`shared`}let r=U7(n),i=I7(e);for(let e of i)if(H7(r,e))return`local-only`;return r.has(P7)?`local-only`:`shared`}function lwe(e){let t=B7(e);if(t.kind!==`ok`||!g(t.path))return[];let n;try{n=S(t.path,`utf-8`)}catch{return[]}let r=U7(n),i=[...I7(e),...L7(e)].filter(e=>H7(r,e)),a=new Set(i),o=[];for(let e of Object.values(Hl))e!==null&&o.push(e);let s=[];for(let e of r){if(a.has(e))continue;if(e===P7||e===F7){s.push(e);continue}let t=e.replace(/^\//,``).replace(/\/$/,``);o.some(e=>t.startsWith(`${e}/`)&&t.length>e.length+1)&&s.push(e)}return[...i,...s]}function R7(e,t){let n=[];for(let r of t)if(g(ve(e,r)))try{c(`git`,[`ls-files`,`--error-unmatch`,`--`,r],d3({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}return{tracked:n}}function z7(e){let t=[];t.push(`Cannot switch OpenKnowledge to local-only — these OK files are tracked upstream:`),t.push(``);for(let n of e)t.push(` ${n}`);t.push(``),t.push(`.git/info/exclude only hides files that git isn't already tracking. To proceed, untrack them first:`),t.push(``);for(let n of e){let e=n.replace(/\/$/,``),r=n.endsWith(`/`)?`-r `:``;t.push(` git rm --cached ${r}${e}`)}return t.push(``),t.push("Then re-run the command. Note: `git rm --cached` removes the files from the index — your teammates will see a deletion on their next pull. If you don't want that, leave sharing mode set to 'shared'."),t.join(`
|
|
1493
1490
|
`)}function B7(e){let t=AX(e);switch(t.kind){case`repository`:{let e=t.repository.readCommonDir();if(e.kind===`unreadable`)return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}};let n=N(e.path,`info`);return g(n)?{kind:`ok`,path:N(n,`exclude`)}:{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-info-dir`}}}case`absent`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-git`}};case`malformed-pointer`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`malformed-pointer`}};case`inaccessible`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}}}}function V7(e){let t=e.replace(/\/$/,``);return new Set([e,t,`/${e}`,`/${t}`])}function H7(e,t){for(let n of V7(t))if(e.has(n))return!0;return!1}function U7(e){let t=new Set;for(let n of e.split(`
|
|
1494
|
-
`)){let e=n.trim();e.length!==0&&t.add(e)}return t}function
|
|
1495
|
-
`)){let e=t.trimStart();if(!(e.length===0||e.length===t.length))return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function W7(e){let t=(e.match(/\r\n/g)??[]).length;return t===0?!1:t>=(e.match(/\n/g)??[]).length-t}function G7(e){try{return O(e).mode&511}catch{return}}function
|
|
1491
|
+
`)){let e=n.trim();e.length!==0&&t.add(e)}return t}function uwe(e,t){return dwe(_e(t,e))}function dwe(e){return ye===`/`?e:e.split(ye).join(`/`)}function fwe(e){for(let t of e.split(`
|
|
1492
|
+
`)){let e=t.trimStart();if(!(e.length===0||e.length===t.length))return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function W7(e){let t=(e.match(/\r\n/g)??[]).length;return t===0?!1:t>=(e.match(/\n/g)??[]).length-t}function G7(e){try{return O(e).mode&511}catch{return}}function pwe(e,t){let n=e.charCodeAt(0)===65279,r=n?e.slice(1):e,i=r.includes(`\r
|
|
1496
1493
|
`)?`\r
|
|
1497
1494
|
`:`
|
|
1498
|
-
`,a=u6(r,t,void 0,{formattingOptions:{...
|
|
1499
|
-
`)?n:`${n}\n`)}function
|
|
1500
|
-
`)?n:`${n}\n`)}const Y7=10*1024*1024;function X7(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>X7(e,t[n]));if(A7(e)&&A7(t)){let n=Object.keys(e);return n.length===Object.keys(t).length?n.every(n=>Object.hasOwn(t,n)&&X7(e[n],t[n])):!1}return!1}const
|
|
1501
|
-
`)){let e=t.trimStart();if(!(e.length===0||e.length===t.length))return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function Q7(e,t,n){return t===void 0?[e,n]:[e,t,n]}function $7(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function e9(e,t,n){let r=e[t];return n===void 0?r:A7(r)?r[n]:void 0}function
|
|
1495
|
+
`,a=u6(r,t,void 0,{formattingOptions:{...fwe(r),eol:i}});if(a.length===0)return{text:e,changed:!1};let o=`${n?``:``}${d6(r,a)}`;return{text:o,changed:o!==e}}const mwe={allowTrailingComma:!0,disallowComments:!1};function hwe(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function K7(e){let t=[],n=dbe(e,t,mwe);return t.some(t=>!hwe(t,e))||!n||n.type!==`object`?null:n}function q7(e,t){let n=0;for(let r of e.children??[]){let e=r.children?.[0];e!==void 0&&l6(e)===t&&(n+=1)}return n}function J7(e,t){KQ(e,`${JSON.stringify(t,null,2)}\n`)}function gwe(e,t){let n=LCe(t);KQ(e,n.endsWith(`
|
|
1496
|
+
`)?n:`${n}\n`)}function _we(e,t){let n=(0,on.stringify)(t);KQ(e,n.endsWith(`
|
|
1497
|
+
`)?n:`${n}\n`)}const Y7=10*1024*1024;function X7(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>X7(e,t[n]));if(A7(e)&&A7(t)){let n=Object.keys(e);return n.length===Object.keys(t).length?n.every(n=>Object.hasOwn(t,n)&&X7(e[n],t[n])):!1}return!1}const vwe=[`command`,`args`],ywe=[`type`,`command`];function Z7(e){return e.type===`local`&&Array.isArray(e.command)?ywe:vwe}function bwe(e,t,n){return A7(e)&&n.every(n=>X7(e[n],t[n]))}function xwe(e){for(let t of e.split(`
|
|
1498
|
+
`)){let e=t.trimStart();if(!(e.length===0||e.length===t.length))return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function Q7(e,t,n){return t===void 0?[e,n]:[e,t,n]}function $7(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function e9(e,t,n){let r=e[t];return n===void 0?r:A7(r)?r[n]:void 0}function Swe(e,t,n,r,i){if(!g(e))return J7(e,$7(t,i,n,r)),{kind:`written`};let a;try{a=S(e,`utf-8`)}catch(e){return D7(`json config read failed`,e),{kind:`declined`,reason:`unparseable`}}if(a.trim()===``)return J7(e,$7(t,i,n,r)),{kind:`written`};if(Buffer.byteLength(a,`utf-8`)>Y7)return{kind:`declined`,reason:`oversize`};let o=K7(a);if(!o)return{kind:`declined`,reason:`unparseable`};if(q7(o,t)>1)return{kind:`declined`,reason:`duplicate-container`};let s=e9(l6(o),t,i),c=A7(s)?s[n]:void 0,l=c!==void 0,u=Z7(r);if(l&&bwe(c,r,u))return{kind:`overwritten`};let d=a.charCodeAt(0)===65279,f=d?a.slice(1):a,p=f.includes(`\r
|
|
1502
1499
|
`)?`\r
|
|
1503
1500
|
`:`
|
|
1504
|
-
`,m={...
|
|
1501
|
+
`,m={...xwe(f),eol:p},h=Q7(t,i,n),_=f;if(l&&A7(c))for(let e of u){let t=u6(_,[...h,e],r[e],{formattingOptions:m});_=d6(_,t)}else{let e=u6(_,h,r,{formattingOptions:m});_=d6(_,e)}let v=`${d?``:``}${_}`;return v!==a&&KQ(e,v,{mode:G7(e)}),{kind:l?`overwritten`:`written`}}function Cwe(e,t,n,r,i){let a=``;if(g(t))try{a=S(t,`utf-8`)}catch(e){return D7(`toml config read failed`,e),{kind:`declined`,reason:`unparseable`}}let o=a.trim()===``;if(e.backend===`fallback`)return o?(gwe(t,{[n]:{[r]:i}}),{kind:`written`}):{kind:`declined`,reason:`no-native-writer`};let s=a.charCodeAt(0)===65279,c=s?a.slice(1):a,l=W7(c),u=o||c.endsWith(`
|
|
1505
1502
|
`),d;try{d=e.upsertEntry(c,r,i)}catch(e){return D7(`upsertEntry failed`,e),{kind:`declined`,reason:`unparseable`}}let f=d.text;u?f.endsWith(`
|
|
1506
1503
|
`)||(f=`${f}\n`):f=f.replace(/\n+$/,``),l&&(f=f.replace(/\r\n/g,`
|
|
1507
1504
|
`).replace(/\n/g,`\r
|
|
1508
|
-
`));let p=`${s?``:``}${f}`;return p!==a&&KQ(t,p,{mode:G7(t)}),{kind:d.existed?`overwritten`:`written`}}function
|
|
1505
|
+
`));let p=`${s?``:``}${f}`;return p!==a&&KQ(t,p,{mode:G7(t)}),{kind:d.existed?`overwritten`:`written`}}function wwe(e,t,n,r){let i=``;if(g(e))try{i=S(e,`utf-8`)}catch(e){return D7(`yaml config read failed`,e),{kind:`declined`,reason:`unparseable`}}if(i.trim()===``)return _we(e,{[t]:{[n]:r}}),{kind:`written`};if(Buffer.byteLength(i,`utf-8`)>Y7)return{kind:`declined`,reason:`oversize`};let a=i.charCodeAt(0)===65279,o=a?i.slice(1):i,s=(0,on.parseDocument)(o);if(s.errors.length>0)return{kind:`declined`,reason:`unparseable`};let c=[t,n],l=s.hasIn(c);s.hasIn([t])&&!(0,on.isCollection)(s.getIn([t],!0))&&s.deleteIn([t]);let u=s.getIn(c,!0);if(l&&(0,on.isCollection)(u))for(let e of Z7(r))s.setIn([...c,e],s.createNode(r[e]));else s.setIn(c,s.createNode(r));let d=s.toString(),f=W7(o);o.endsWith(`
|
|
1509
1506
|
`)?d.endsWith(`
|
|
1510
1507
|
`)||(d=`${d}\n`):d=d.replace(/\n+$/,``),f&&(d=d.replace(/\r\n/g,`
|
|
1511
1508
|
`).replace(/\n/g,`\r
|
|
1512
|
-
`));let p=`${a?``:``}${d}`;return p!==i&&KQ(e,p,{mode:G7(e)}),{kind:l?`overwritten`:`written`}}const Dwe=`open-knowledge-ui`;function t9(e,t,n){try{return g(e.detectPath?.(t,n)??pe(e.configPath(t,n)))}catch{return!1}}function Owe(e,t,n){try{let r=ve(pe(e.configPath(t,n))),i=ve(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+ye)}catch{return!1}}function n9(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||Owe(e,t,r);if(!i&&s&&!t9(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{S7(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Awe(e,o,a,n,{isProjectScope:i!==void 0});let c;try{c=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{v(pe(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let l={action:`written`},u;try{JQ(`${o}.lock`,()=>{let t=$Ce(o).writePath;if(v(pe(t),{recursive:!0}),e.format===`toml`){let n=Twe(N7(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}if(e.format===`yaml`){let n=Ewe(t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=wwe(t,e.topLevelKey,a,c,e.serverMapSubKey);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){u=e instanceof Error?e:Error(String(e))}return u?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:u.message,...i===void 0?{}:{configScope:`project`}}:l.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:l.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:l.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const kwe={pi:x7};function Awe(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=kwe[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{v(pe(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{JQ(`${t}.lock`,()=>{let e=null;try{e=S(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}KQ(t,c,e===null?void 0:{mode:G7(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}async function jwe(e){let t=aCe(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0};return t.map(t=>n9(t,``,n,e.home))}function r9(e,t,n,r){let i=a9(e,t,n,r);return i.kind===`present`?i.entry:null}function i9(e,t,n,r){let i=e9(e,t,r);if(!A7(i))return{kind:`no-entry`};let a=i[n];return A7(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function a9(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!g(i))return{kind:`absent`};try{if(O(i).size>Y7)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=S(i,`utf-8`)}catch{return{kind:`decline`,reason:`unparseable`}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:VCe(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=N7().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return i9(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,on.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:i9(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=K7(a);return s?q7(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:i9(l6(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}function Mwe(e,t){let n=[];for(let r of P5)t9(n7[r],e,t)&&n.push(r);return n}function Nwe(e){return e===`opencode`?YSe:JSe}function Pwe(e,t,n){let r=n7[e],i=Nwe(e),a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=r9(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}function o9(){return N(oe(),`.ok`,`bug-reports`)}function Fwe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=o9(),r=`${t}-bugreport`,i=N(n,`${r}.zip`);for(let e=2;g(i);e+=1)i=N(n,`${r}-${e}.zip`);return i}function s9(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let e=S(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return g(N(e,`.ok`))?Ae(`sha256`).update(ve(e)).digest(`hex`).slice(0,12):null}function Iwe(){let e={timestamp:new Date().toISOString(),platform:k(),osType:A(),osRelease:ce(),hostname:`[redacted]`,uptime:j(),freeMem:ae(),totalMem:ue(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=l(`sw_vers -productVersion 2>/dev/null`,d3({encoding:`utf8`})).trim()}catch{}try{let t=N(__dirname,`..`,`..`,`package.json`);g(t)&&(e.okVersion=JSON.parse(S(t,`utf8`)).version)}catch{}return e}const Lwe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function c9(e){let t=fe(e);return Lwe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function Rwe(e,t){return d9(e,t).files}const zwe=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function l9(e,t=`com.inkeep.open-knowledge`){let n=N(e,`${t}.ShipIt`);return g(n)?zwe.map(e=>N(n,e)).filter(e=>g(e)):[]}function u9(e){if(!g(e))return[];try{let t=new Map;for(let n of C(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-10):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>N(e,t))}catch{return[]}}function d9(e,t){if(!g(t))return{files:[],excludedByProjectSlug:0};let n=C(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>N(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(c9),i=[],a=r.filter(t=>{try{return S(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!c9(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Bwe(e){let t=N(e,`.ok`,`local`);return g(t)?{files:[`server.lock`,`last-spawn-error.log`,oX].map(e=>N(t,e)).filter(e=>g(e))}:{files:[]}}function Vwe(e){let t=N(e,`.ok`,`local`,`logs`);return g(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>N(t,e)).filter(e=>g(e))}:{files:[]}}function Hwe(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Ae(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function f9(e){let t=e.revealDocNames?e.content:Hwe(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=jo(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function p9(e){for(let t of e.files)try{f9({zipfile:e.zipfile,name:`${e.prefix}/${fe(t)}`,content:S(t,`utf8`),redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function Uwe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??N(oe(),`.ok`,`logs`),s=t.projectDir?s9(t.projectDir,i):null;v(pe(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=Iwe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=d9(s,o),{files:d}=t.projectDir?Bwe(t.projectDir):{files:[]},{files:f}=t.projectDir?Vwe(t.projectDir):{files:[]},p=t.shipItLogFiles??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length},`files collected`);let m=[],g=[],{ZipFile:_}=await import(`./yazl-BlMyAOcT.mjs`).then(t=>e(t.t(),1)),y=new _;p9({zipfile:y,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:g,redactions:m,logger:i}),p9({zipfile:y,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:g,redactions:m,logger:i}),p9({zipfile:y,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:g,redactions:m,logger:i}),p9({zipfile:y,files:t.bugReportLedgerFiles??[],prefix:ko,redact:n,revealDocNames:a,bundleFiles:g,redactions:m,logger:i});for(let e of t.extraFiles??[])try{let t=S(e.sourcePath),n=`extra/${e.zipName??fe(e.sourcePath)}`;y.addBuffer(t,n),g.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&f9({zipfile:y,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:g,redactions:m});let b=JSON.stringify(c,null,2);y.addBuffer(Buffer.from(b,`utf8`),`sysinfo.json`),g.push(`sysinfo.json`);let x={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:g,redactions:m,sysinfo:c};y.addBuffer(Buffer.from(JSON.stringify(x,null,2),`utf8`),`MANIFEST.json`);let C=m.reduce((e,t)=>e+t.lineCount,0),w=new Set(p.map(e=>`logs/${fe(e)}`)),T=g.filter(e=>w.has(e)),E=new Set((t.bugReportLedgerFiles??[]).map(e=>`${ko}/${fe(e)}`)),D=g.filter(e=>E.has(e)),O=s?g.filter(e=>e.startsWith(`logs/`)&&!c9(e)&&!w.has(e)):[],ee=[`# Bug Report Bundle`,``,`Generated: ${x.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${x.disciplineVersion}`,``,`## Contents`,``,...g.map(e=>`- ${e}`),``,`## Privacy`,``,...O.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...O.map(e=>`- ${e}`),``]:[],...T.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...T.map(e=>`- ${e}`),``]:[],...D.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...D.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${Kne.join(`, `)}`,C>0?`${C} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
|
|
1509
|
+
`));let p=`${a?``:``}${d}`;return p!==i&&KQ(e,p,{mode:G7(e)}),{kind:l?`overwritten`:`written`}}const Twe=`open-knowledge-ui`;function t9(e,t,n){try{return g(e.detectPath?.(t,n)??pe(e.configPath(t,n)))}catch{return!1}}function Ewe(e,t,n){try{let r=ve(pe(e.configPath(t,n))),i=ve(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+ye)}catch{return!1}}function n9(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||Ewe(e,t,r);if(!i&&s&&!t9(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{S7(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Owe(e,o,a,n,{isProjectScope:i!==void 0});let c;try{c=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{v(pe(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let l={action:`written`},u;try{JQ(`${o}.lock`,()=>{let t=$Ce(o).writePath;if(v(pe(t),{recursive:!0}),e.format===`toml`){let n=Cwe(N7(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}if(e.format===`yaml`){let n=wwe(t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=Swe(t,e.topLevelKey,a,c,e.serverMapSubKey);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){u=e instanceof Error?e:Error(String(e))}return u?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:u.message,...i===void 0?{}:{configScope:`project`}}:l.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:l.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:l.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const Dwe={pi:x7};function Owe(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=Dwe[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{v(pe(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{JQ(`${t}.lock`,()=>{let e=null;try{e=S(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}KQ(t,c,e===null?void 0:{mode:G7(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}async function kwe(e){let t=aCe(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0};return t.map(t=>n9(t,``,n,e.home))}function r9(e,t,n,r){let i=a9(e,t,n,r);return i.kind===`present`?i.entry:null}function i9(e,t,n,r){let i=e9(e,t,r);if(!A7(i))return{kind:`no-entry`};let a=i[n];return A7(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function a9(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!g(i))return{kind:`absent`};try{if(O(i).size>Y7)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=S(i,`utf-8`)}catch{return{kind:`decline`,reason:`unparseable`}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:VCe(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=N7().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return i9(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,on.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:i9(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=K7(a);return s?q7(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:i9(l6(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}function Awe(e,t){let n=[];for(let r of P5)t9(n7[r],e,t)&&n.push(r);return n}function jwe(e){return e===`opencode`?YSe:JSe}function Mwe(e,t,n){let r=n7[e],i=jwe(e),a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=r9(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}function o9(){return N(oe(),`.ok`,`bug-reports`)}function Nwe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=o9(),r=`${t}-bugreport`,i=N(n,`${r}.zip`);for(let e=2;g(i);e+=1)i=N(n,`${r}-${e}.zip`);return i}function s9(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let e=S(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return g(N(e,`.ok`))?Ae(`sha256`).update(ve(e)).digest(`hex`).slice(0,12):null}function Pwe(){let e={timestamp:new Date().toISOString(),platform:k(),osType:A(),osRelease:ce(),hostname:`[redacted]`,uptime:j(),freeMem:ae(),totalMem:ue(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=l(`sw_vers -productVersion 2>/dev/null`,d3({encoding:`utf8`})).trim()}catch{}try{let t=N(__dirname,`..`,`..`,`package.json`);g(t)&&(e.okVersion=JSON.parse(S(t,`utf8`)).version)}catch{}return e}const Fwe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function c9(e){let t=fe(e);return Fwe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function Iwe(e,t){return d9(e,t).files}const Lwe=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function l9(e,t=`com.inkeep.open-knowledge`){let n=N(e,`${t}.ShipIt`);return g(n)?Lwe.map(e=>N(n,e)).filter(e=>g(e)):[]}function u9(e){if(!g(e))return[];try{let t=new Map;for(let n of C(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-10):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>N(e,t))}catch{return[]}}function d9(e,t){if(!g(t))return{files:[],excludedByProjectSlug:0};let n=C(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>N(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(c9),i=[],a=r.filter(t=>{try{return S(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!c9(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Rwe(e){let t=N(e,`.ok`,`local`);return g(t)?{files:[`server.lock`,`last-spawn-error.log`,oX].map(e=>N(t,e)).filter(e=>g(e))}:{files:[]}}function zwe(e){let t=N(e,`.ok`,`local`,`logs`);return g(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>N(t,e)).filter(e=>g(e))}:{files:[]}}function Bwe(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Ae(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function f9(e){let t=e.revealDocNames?e.content:Bwe(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=jo(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function p9(e){for(let t of e.files)try{f9({zipfile:e.zipfile,name:`${e.prefix}/${fe(t)}`,content:S(t,`utf8`),redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function Vwe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??N(oe(),`.ok`,`logs`),s=t.projectDir?s9(t.projectDir,i):null;v(pe(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=Pwe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=d9(s,o),{files:d}=t.projectDir?Rwe(t.projectDir):{files:[]},{files:f}=t.projectDir?zwe(t.projectDir):{files:[]},p=t.shipItLogFiles??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length},`files collected`);let m=[],g=[],{ZipFile:_}=await import(`./yazl-BlMyAOcT.mjs`).then(t=>e(t.t(),1)),y=new _;p9({zipfile:y,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:g,redactions:m,logger:i}),p9({zipfile:y,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:g,redactions:m,logger:i}),p9({zipfile:y,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:g,redactions:m,logger:i}),p9({zipfile:y,files:t.bugReportLedgerFiles??[],prefix:ko,redact:n,revealDocNames:a,bundleFiles:g,redactions:m,logger:i});for(let e of t.extraFiles??[])try{let t=S(e.sourcePath),n=`extra/${e.zipName??fe(e.sourcePath)}`;y.addBuffer(t,n),g.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&f9({zipfile:y,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:g,redactions:m});let b=JSON.stringify(c,null,2);y.addBuffer(Buffer.from(b,`utf8`),`sysinfo.json`),g.push(`sysinfo.json`);let x={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:g,redactions:m,sysinfo:c};y.addBuffer(Buffer.from(JSON.stringify(x,null,2),`utf8`),`MANIFEST.json`);let C=m.reduce((e,t)=>e+t.lineCount,0),w=new Set(p.map(e=>`logs/${fe(e)}`)),T=g.filter(e=>w.has(e)),E=new Set((t.bugReportLedgerFiles??[]).map(e=>`${ko}/${fe(e)}`)),D=g.filter(e=>E.has(e)),O=s?g.filter(e=>e.startsWith(`logs/`)&&!c9(e)&&!w.has(e)):[],ee=[`# Bug Report Bundle`,``,`Generated: ${x.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${x.disciplineVersion}`,``,`## Contents`,``,...g.map(e=>`- ${e}`),``,`## Privacy`,``,...O.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...O.map(e=>`- ${e}`),``]:[],...T.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...T.map(e=>`- ${e}`),``]:[],...D.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...D.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${Kne.join(`, `)}`,C>0?`${C} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
|
|
1513
1510
|
`);y.addBuffer(Buffer.from(ee,`utf8`),`README.md`),y.end();let te=h(r);return y.outputStream.pipe(te),await new Promise((e,t)=>{te.on(`close`,e),te.on(`error`,t)}),i?.info({bundlePath:r,fileCount:g.length,redactionCount:C},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:g,redactions:m,redactedLineCount:C,generatedAt:x.generatedAt}}}function m9(e,t){let n=ve(e),r=t===void 0?e7():e7({home:t,env:{}});return{cwd:n,bridgePath:n7.pi.projectConfigPath?.(n)??``,trustPath:N(r,`trust.json`)}}function h9(e,t,n){let r=a9(n7.pi,e,n,t);if(r.kind===`absent`)return{state:`absent`,text:null};if(r.kind!==`present`)return{state:`unreadable`,text:null};let i=r.entry,a=Array.isArray(i.args)&&typeof i.args[0]==`string`?i.args[0]:null;return H5(i)?{state:`own-current`,text:a}:b7(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function g9(e,t){let n;try{n=S(e,`utf-8`)}catch(e){let t=e.code;return t===`ENOENT`||t===`ENOTDIR`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,entries:null,trailingNewline:!1}}if(n.trim()===``)return{state:`untrusted`,entries:{},trailingNewline:!1};let r;try{r=JSON.parse(n)}catch{return{state:`unreadable`,entries:null,trailingNewline:!1}}return A7(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
|
|
1514
|
-
`)}:{state:`unreadable`,entries:null,trailingNewline:!1}}function
|
|
1515
|
-
`:``),o=G7(e);KQ(e,a,o===void 0?void 0:{mode:o}),n.action=`added`})}catch(e){return{action:`failed`,error:e instanceof Error?e.message:String(e)}}return n.action===`refused-unreadable`?{action:`refused-unreadable`,error:`trust store is not a readable JSON object`}:{action:n.action}}function
|
|
1516
|
-
`:``),a=G7(n.trustPath);KQ(n.trustPath,r,a===void 0?void 0:{mode:a}),i.action=`removed`})}catch(e){return{action:`failed`,error:e instanceof Error?e.message:String(e)}}return i.action===`refused-unreadable`?{action:`refused-unreadable`,error:`trust store is not a readable JSON object`}:{action:i.action}}function
|
|
1511
|
+
`)}:{state:`unreadable`,entries:null,trailingNewline:!1}}function Hwe(e,t){let n=m9(e,t),r=h9(n.cwd,n.bridgePath,t).state,i=g9(n.trustPath,n.cwd).state;return{...n,bridge:r,trust:i,bridgeLoadable:(r===`own-current`||r===`own-stale`)&&i===`trusted`,otherExtensions:_9(n.bridgePath).names}}function _9(e){let t=pe(e),n=fe(e);try{return{names:C(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort(),verified:!0}}catch(e){let t=e.code;return{names:[],verified:t===`ENOENT`||t===`ENOTDIR`}}}async function Uwe(e,t={mode:`published`},n){let r=m9(e,n),i=h9(r.cwd,r.bridgePath,n);if(i.state===`foreign`)return{...r,ok:!1,bridge:`refused-foreign`,trust:`skipped`};if(i.state===`unreadable`)return{...r,ok:!1,bridge:`refused-unreadable`,trust:`skipped`};let a;if(i.state===`absent`)a=`written`;else{let e;try{e=x7(t)}catch{e=void 0}a=e!==void 0&&i.text===e?`unchanged`:`refreshed`}if(a!==`unchanged`){let e=n9(n7.pi,r.cwd,t,n,r.bridgePath);if(e.action!==`written`&&e.action!==`overwritten`)return{...r,ok:!1,bridge:`failed`,trust:`skipped`,error:e.error??`bridge write ${e.action}`}}let o=await Wwe(r.trustPath,r.cwd);return{...r,ok:o.action===`already-trusted`||o.action===`added`,bridge:a,trust:o.action,...o.error===void 0?{}:{error:o.error}}}async function Wwe(e,t){try{v(pe(e),{recursive:!0})}catch(e){return{action:`failed`,error:e instanceof Error?e.message:String(e)}}let n={action:`added`};try{await hhe(`${e}.lock`,async()=>{let r=g9(e,t);if(r.state===`trusted`){n.action=`already-trusted`;return}if(r.entries===null){n.action=`refused-unreadable`;return}let i={...r.entries,[t]:!0},a=JSON.stringify(i,null,2)+(r.trailingNewline?`
|
|
1512
|
+
`:``),o=G7(e);KQ(e,a,o===void 0?void 0:{mode:o}),n.action=`added`})}catch(e){return{action:`failed`,error:e instanceof Error?e.message:String(e)}}return n.action===`refused-unreadable`?{action:`refused-unreadable`,error:`trust store is not a readable JSON object`}:{action:n.action}}function Gwe(e,t){let n=m9(e,t),r=_9(n.bridgePath);if(!r.verified)return{action:`kept-unverified`,error:`could not read the Pi extensions folder`};if(r.names.length>0)return{action:`kept-shared`};if(!g(n.trustPath))return{action:`not-present`};let i={action:`removed`};try{JQ(`${n.trustPath}.lock`,()=>{let e=g9(n.trustPath,n.cwd);if(e.entries===null){i.action=e.state===`unreadable`?`refused-unreadable`:`not-present`;return}if(!(n.cwd in e.entries)){i.action=`not-present`;return}let t={...e.entries};delete t[n.cwd];let r=JSON.stringify(t,null,2)+(e.trailingNewline?`
|
|
1513
|
+
`:``),a=G7(n.trustPath);KQ(n.trustPath,r,a===void 0?void 0:{mode:a}),i.action=`removed`})}catch(e){return{action:`failed`,error:e instanceof Error?e.message:String(e)}}return i.action===`refused-unreadable`?{action:`refused-unreadable`,error:`trust store is not a readable JSON object`}:{action:i.action}}function Kwe(e){return H5(e)||G5(e)||b7(e)}const v9=10*1024*1024;function qwe(e,t,n,r){let i=a9(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!Kwe(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);if(e.format===`file`){D(a,{force:!0});let e=Gwe(t,n);return{kind:`removed`,trust:e.action,...e.error===void 0?{}:{trustError:e.error}}}return e.format===`toml`?Xwe(a,o):e.format===`yaml`?Ywe(a,e.topLevelKey,o):Jwe(a,e.topLevelKey,e.serverMapSubKey,o)}function Jwe(e,t,n,r){let i;try{i=S(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>v9)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=pwe(i,Q7(t,n,r));return o?(KQ(e,a,{mode:G7(e)}),{kind:`removed`}):{kind:`not-present`}}function Ywe(e,t,n){let r;try{r=S(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>v9)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,on.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=W7(a);a.trim()===``||a.endsWith(`
|
|
1517
1514
|
`)?c.endsWith(`
|
|
1518
1515
|
`)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
|
|
1519
1516
|
`).replace(/\n/g,`\r
|
|
1520
|
-
`));let u=`${i?``:``}${c}`;return u!==r&&KQ(e,u,{mode:G7(e)}),{kind:`removed`}}function
|
|
1517
|
+
`));let u=`${i?``:``}${c}`;return u!==r&&KQ(e,u,{mode:G7(e)}),{kind:`removed`}}function Xwe(e,t){let n=N7();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=S(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=W7(a),s=a.trim()===``||a.endsWith(`
|
|
1521
1518
|
`),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
|
|
1522
1519
|
`)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
|
|
1523
1520
|
`).replace(/\n/g,`\r
|
|
1524
|
-
`));let u=`${i?``:``}${l}`;return u!==r&&KQ(e,u,{mode:G7(e)}),{kind:`removed`}}function $we(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}function eTe(e){let{priorCommand:t,priorArgs:n}=y9(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function y9(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function b9(e,t,n={}){let r=gbe(e,t);if(!g(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(S(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!aye(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??l3)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??hbe())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??se();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}async function tTe(e,t=void 0){let n=b9(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=vbe(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500)});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function nTe(e,t={}){return{targets:iTe(e,t.isAlive??l3)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function rTe(e){let t=e.inspect??(()=>b9(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??tTe,o=e.logger??void 0,s=nTe(t(),{isAlive:e.isAlive});if(s.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:s.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let c=[],l=[];for(let e of s.targets)try{n(e.pid,`SIGTERM`),c.push(e)}catch(t){l.push({target:e,error:t instanceof Error?t.message:String(t)})}return c.length>0&&r(`Stopped: ${c.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:c.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:l.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),l.length>0&&i(`Failed to stop: ${l.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:c,failed:l,hadTargets:!0}}function iTe(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}function x9(e){if(!g(e))return{value:null,path:e,source:null,doc:null};let t;try{t=S(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,on.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return A7(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function aTe(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=al({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function oTe(e){let t=e??process.cwd(),n=[],r=[],i=[],a=[],o=XQ(`user`,t),s=GQ({absPath:o});r.push(...s.diagnostics),!s.valid&&s.sidelinedTo!==void 0&&i.push({from:o,to:s.sidelinedTo}),s.valid&&s.source!==void 0&&n.push(o);let c=(e,t=!1)=>{let i=x9(e);if(i.diagnostic!==void 0&&r.push(i.diagnostic),i.value===null)return{};let o=jl({value:i.value,file:i.path,source:i.source,doc:i.doc});r.push(...o),n.push(e);let s=o.length>0?Nl(i.value):i.value;return t&&a.push(...sl({value:s,file:i.path,source:i.source,doc:i.doc})),s},l=ve(t,`.ok`,`config.yml`),u=c(l,!0),d=c(XQ(`project-local`,t)),f=Cl(s.value,u,d),p=WSe.safeParse(f);if(!p.success){let e=x9(l),t={code:`SCHEMA_INVALID`,issues:aTe(p.error.issues,e)};throw Error(Sl(t))}return{config:p.data,sources:n,diagnostics:r,sidelined:i,ignoredCommittedKeys:a}}function S9(e){return e.replace(/:\d+$/,``)}function C9(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function w9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=Ql(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`).filter(e=>e.length>0);if(r.length<5||r[2]!==`blob`)return null;let i,a,o,s;try{i=decodeURIComponent(r[0]),a=decodeURIComponent(r[1]),o=decodeURIComponent(r[3]),s=r.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.length===0||s.some(e=>e.length===0)?null:{host:n,owner:i,repo:a,branch:o,path:s.join(`/`)}}function T9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=Ql(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`);if(r.length<5||r[0]!==``||r[3]!==`tree`)return null;let i=r.slice(5);i.length===1&&i[0]===``&&i.pop();let a,o,s,c;try{a=decodeURIComponent(r[1]),o=decodeURIComponent(r[2]),s=decodeURIComponent(r[4]),c=i.map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function sTe(e){let t=w9(e);if(t)return{kind:`doc`,...t};let n=T9(e);return n?{kind:`folder`,...n}:null}async function cTe(e,t){let n,r;try{n=await Te(ve(e)),r=await Te(ve(pe(e)))}catch{return{kind:`not-git`}}if(!E9(n,r))return{kind:`symlink-escape`};let i=N(n,`.git`),a;try{a=O(i)}catch{return{kind:`not-git`}}if(a.isDirectory()){let e;try{e=await Te(i)}catch{return{kind:`not-git`}}if(!E9(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let o=kX(n);if(o.kind!==`repository`)return{kind:`not-git`};let s=o.repository.readRemoteUrl(`origin`);if(s.kind===`unreadable`)return{kind:`not-git`};if(s.kind===`absent`)return s.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let c=s.url,l=C9(c);if(l===null)return{kind:`non-github`};let u=Ql(l.hostname);if(u===null)return{kind:`non-github`};let d=u===t.host.toLowerCase(),f=l.owner.toLowerCase()===t.owner.toLowerCase(),p=l.name.toLowerCase()===t.repo.toLowerCase();return!d&&f&&p?{kind:`wrong-host`,actualHost:u}:!d||!f||!p?{kind:`wrong-repo`,actualOwner:l.owner,actualRepo:l.name}:{kind:`ok`,gitRemoteUrl:`https://${u}/${l.owner}/${l.name}.git`}}function E9(e,t){if(e===t)return!0;let n=_e(t,e);return n.length>0&&!n.startsWith(`..`)&&!M(n)}const lTe=`# >>> open-knowledge cli >>>`,uTe=`# <<< open-knowledge cli <<<`,dTe=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function fTe(e){return N(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}[...m3.map(e=>p3[e])];function pTe(e){if(!M(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=ve(e);if(t===ye||pe(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function D9(e){let t=pTe(e),n=[];for(let e of m3){let r=p3[e];n.push({path:N(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of Jl)n.push({path:N(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function mTe(e,t){let n=[];for(let r of D9(e))if(r.bundleId===t)try{D(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}const hTe=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=n9(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=T7(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function gTe(e,t,n={},r=hTe){let i=[];for(let a of t){let t=n7[a];for(let a of r)i.push(a.write(t,e,n))}return i}function _Te(e,t,n={}){return{integrations:gTe(e,t,n)}}function vTe(e){return GQ({absPath:XQ(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function O9({home:e=oe(),env:t=process.env}={}){let n=vTe(e),{override:r,preferenceList:i}=bhe(t),{locale:a,source:o}=lse({override:r,storedPreference:n,supportedLocales:as,preferenceList:i,autoDetectableLocales:sre});return{preference:n,locale:a,source:o,systemLanguages:i}}function k9(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function yTe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A9(e,t){if(typeof e==`string`)return k9(e,t.contentDir);if(Array.isArray(e))return e.map(e=>A9(e,t));if(!yTe(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=A9(i,t);return n}function j9(e,t){let n=S(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
1521
|
+
`));let u=`${i?``:``}${l}`;return u!==r&&KQ(e,u,{mode:G7(e)}),{kind:`removed`}}function Zwe(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}function Qwe(e){let{priorCommand:t,priorArgs:n}=y9(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function y9(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function b9(e,t,n={}){let r=gbe(e,t);if(!g(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(S(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!aye(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??l3)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??hbe())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??se();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}async function $we(e,t=void 0){let n=b9(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=vbe(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500)});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function eTe(e,t={}){return{targets:nTe(e,t.isAlive??l3)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function tTe(e){let t=e.inspect??(()=>b9(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??$we,o=e.logger??void 0,s=eTe(t(),{isAlive:e.isAlive});if(s.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:s.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let c=[],l=[];for(let e of s.targets)try{n(e.pid,`SIGTERM`),c.push(e)}catch(t){l.push({target:e,error:t instanceof Error?t.message:String(t)})}return c.length>0&&r(`Stopped: ${c.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:c.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:l.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),l.length>0&&i(`Failed to stop: ${l.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:c,failed:l,hadTargets:!0}}function nTe(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}function x9(e){if(!g(e))return{value:null,path:e,source:null,doc:null};let t;try{t=S(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,on.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return A7(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function rTe(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=al({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function iTe(e){let t=e??process.cwd(),n=[],r=[],i=[],a=[],o=XQ(`user`,t),s=GQ({absPath:o});r.push(...s.diagnostics),!s.valid&&s.sidelinedTo!==void 0&&i.push({from:o,to:s.sidelinedTo}),s.valid&&s.source!==void 0&&n.push(o);let c=(e,t=!1)=>{let i=x9(e);if(i.diagnostic!==void 0&&r.push(i.diagnostic),i.value===null)return{};let o=jl({value:i.value,file:i.path,source:i.source,doc:i.doc});r.push(...o),n.push(e);let s=o.length>0?Nl(i.value):i.value;return t&&a.push(...sl({value:s,file:i.path,source:i.source,doc:i.doc})),s},l=ve(t,`.ok`,`config.yml`),u=c(l,!0),d=c(XQ(`project-local`,t)),f=Cl(s.value,u,d),p=WSe.safeParse(f);if(!p.success){let e=x9(l),t={code:`SCHEMA_INVALID`,issues:rTe(p.error.issues,e)};throw Error(Sl(t))}return{config:p.data,sources:n,diagnostics:r,sidelined:i,ignoredCommittedKeys:a}}function S9(e){return e.replace(/:\d+$/,``)}function C9(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function w9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=Ql(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`).filter(e=>e.length>0);if(r.length<5||r[2]!==`blob`)return null;let i,a,o,s;try{i=decodeURIComponent(r[0]),a=decodeURIComponent(r[1]),o=decodeURIComponent(r[3]),s=r.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.length===0||s.some(e=>e.length===0)?null:{host:n,owner:i,repo:a,branch:o,path:s.join(`/`)}}function T9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=Ql(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`);if(r.length<5||r[0]!==``||r[3]!==`tree`)return null;let i=r.slice(5);i.length===1&&i[0]===``&&i.pop();let a,o,s,c;try{a=decodeURIComponent(r[1]),o=decodeURIComponent(r[2]),s=decodeURIComponent(r[4]),c=i.map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function aTe(e){let t=w9(e);if(t)return{kind:`doc`,...t};let n=T9(e);return n?{kind:`folder`,...n}:null}async function oTe(e,t){let n,r;try{n=await Te(ve(e)),r=await Te(ve(pe(e)))}catch{return{kind:`not-git`}}if(!E9(n,r))return{kind:`symlink-escape`};let i=N(n,`.git`),a;try{a=O(i)}catch{return{kind:`not-git`}}if(a.isDirectory()){let e;try{e=await Te(i)}catch{return{kind:`not-git`}}if(!E9(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let o=kX(n);if(o.kind!==`repository`)return{kind:`not-git`};let s=o.repository.readRemoteUrl(`origin`);if(s.kind===`unreadable`)return{kind:`not-git`};if(s.kind===`absent`)return s.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let c=s.url,l=C9(c);if(l===null)return{kind:`non-github`};let u=Ql(l.hostname);if(u===null)return{kind:`non-github`};let d=u===t.host.toLowerCase(),f=l.owner.toLowerCase()===t.owner.toLowerCase(),p=l.name.toLowerCase()===t.repo.toLowerCase();return!d&&f&&p?{kind:`wrong-host`,actualHost:u}:!d||!f||!p?{kind:`wrong-repo`,actualOwner:l.owner,actualRepo:l.name}:{kind:`ok`,gitRemoteUrl:`https://${u}/${l.owner}/${l.name}.git`}}function E9(e,t){if(e===t)return!0;let n=_e(t,e);return n.length>0&&!n.startsWith(`..`)&&!M(n)}const sTe=`# >>> open-knowledge cli >>>`,cTe=`# <<< open-knowledge cli <<<`,lTe=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function uTe(e){return N(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}[...m3.map(e=>p3[e])];function dTe(e){if(!M(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=ve(e);if(t===ye||pe(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function D9(e){let t=dTe(e),n=[];for(let e of m3){let r=p3[e];n.push({path:N(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of Jl)n.push({path:N(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function fTe(e,t){let n=[];for(let r of D9(e))if(r.bundleId===t)try{D(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}const pTe=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=n9(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=T7(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function mTe(e,t,n={},r=pTe){let i=[];for(let a of t){let t=n7[a];for(let a of r)i.push(a.write(t,e,n))}return i}function hTe(e,t,n={}){return{integrations:mTe(e,t,n)}}function gTe(e){return GQ({absPath:XQ(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function O9({home:e=oe(),env:t=process.env}={}){let n=gTe(e),{override:r,preferenceList:i}=bhe(t),{locale:a,source:o}=lse({override:r,storedPreference:n,supportedLocales:as,preferenceList:i,autoDetectableLocales:sre});return{preference:n,locale:a,source:o,systemLanguages:i}}function k9(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function _Te(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A9(e,t){if(typeof e==`string`)return k9(e,t.contentDir);if(Array.isArray(e))return e.map(e=>A9(e,t));if(!_Te(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=A9(i,t);return n}function j9(e,t){let n=S(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
1525
1522
|
`),i=n.split(`
|
|
1526
1523
|
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=A9(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}te(e,r?`${a.join(`
|
|
1527
1524
|
`)}\n`:a.join(`
|
|
1528
1525
|
`))}function M9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=A9(JSON.parse(n),t),i=n.endsWith(`
|
|
1529
1526
|
`)?`
|
|
1530
|
-
`:``;te(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=k9(n,t.contentDir);r!==n&&te(e,r)}}function N9(e,t){let n=S(e,`utf-8`),r=k9(n,t.contentDir);r!==n&&te(e,r)}function P9(e){try{return C(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const
|
|
1531
|
-
`)}\n`:null}catch{return null}}function
|
|
1532
|
-
`:`not-running (${C})\n`;if(te(N(_,`state`,`server-status.txt`),ae),e.processDir&&g(e.processDir)){let t=N(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let oe=e.redact===!0;oe&&
|
|
1527
|
+
`:``;te(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=k9(n,t.contentDir);r!==n&&te(e,r)}}function N9(e,t){let n=S(e,`utf-8`),r=k9(n,t.contentDir);r!==n&&te(e,r)}function P9(e){try{return C(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const vTe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function F9(e){return/\.log\.\d+$/.test(e)}function yTe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||F9(e)}function bTe(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of P9(N(e.stagingDir,n)))yTe(r)?j9(r,t):r.endsWith(`.json`)?M9(r,t):N9(r,t);for(let n of P9(N(e.stagingDir,`state`))){let e=fe(n);n.endsWith(`.jsonl`)?j9(n,t):vTe.has(e)?M9(n,t):N9(n,t)}}const I9=[`.ok`,`local`,`telemetry`],L9=[`.ok`,`local`,`logs`],R9=[`.ok`,`local`,`loss-capture`],z9=`spans-current.jsonl`,B9=`spans-prev.jsonl`,V9=`server-current.jsonl`,H9=`server-prev.jsonl`,U9=`loss-current.jsonl`,W9=`loss-prev.jsonl`;function xTe(e){return N(e,...I9,z9)}function STe(e){return N(e,...I9,B9)}function CTe(e){return N(e,...L9,V9)}function wTe(e){return N(e,...L9,H9)}function TTe(e){return N(e,...R9,U9)}function ETe(e){return N(e,...R9,W9)}const G9=1e3;async function DTe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function OTe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function kTe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}function ATe(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
|
|
1528
|
+
`)}\n`:null}catch{return null}}function jTe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`log`,`--oneline`,`-50`],d3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function MTe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],d3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function NTe(){return{nodeVersion:process.version,platform:k(),arch:re()}}function PTe(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!g(e))return{};let t;try{t=(0,on.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function FTe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return FTe(e.maxBytes)}function ITe(e){let t=J9(XQ(`project`,e)),n=J9(XQ(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function LTe(e){return Ae(`sha256`).update(e).digest(`hex`)}function RTe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const zTe=[`"doc.name"`,`"docName"`];function BTe(e){let t=S(e,`utf-8`),n=0;for(let e of zTe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(pe(t),{recursive:!0}),m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=C(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const VTe=new Set([`.jsonl`]);function HTe(e){let t=e.lastIndexOf(`.`);return t===-1?!1:VTe.has(e.slice(t))}const UTe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`]);function WTe(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:UTe.has(e.slice(t))}function GTe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!WTe(r))continue;let{redacted:i,patterns:a,lineCount:o}=jo(S(n,`utf-8`));a.length!==0&&(te(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return _e(e,t).split(ye).join(`/`)}async function KTe(e){let t=ve(e.contentDir),n=ve(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??DTe,a=r.fetchAgentEffects??OTe,o=r.fetchWatcherRecent??kTe,s=r.readShadowHead??jTe,c=r.readCheckpointRefs??MTe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.64.0-beta.7`),d=r.readDesktopEnv??K9,f=r.readLanguage??O9,p=r.readRuntime??NTe,h=r.isOtlpPushEnabled??PTe,_=y(N(le(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(xTe(n),N(_,`telemetry`,z9)),Z9(STe(n),N(_,`telemetry`,B9)),Z9(CTe(n),N(_,`logs`,V9)),Z9(wTe(n),N(_,`logs`,H9));for(let t of e.userLogFiles??[])Z9(t,N(_,`logs`,fe(t)));for(let t of e.userStateFiles??[])Z9(t,N(_,ko,fe(t)));let y=N(n,`.ok`,`local`),b=N(y,`server.lock`),x=`not-running`,C=`no server.lock`,w=null;if(g(b)){Z9(b,N(_,`state`,`server.lock`));try{let e=S(b,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?w=t.port:C=`lock present but no port`}catch{C=`lock present but unparseable`}}if(w!==null){let e=await i(w);e===null?C=`agent-presence endpoint at :${w} unreachable`:(te(N(_,`state`,`agent-presence.json`),e),x=`running`,C=``);let t=await a(w);t!==null&&te(N(_,`state`,`agent-effects.json`),t);let n=await o(w);if(n!==null){let e=ATe(n);e!==null&&te(N(_,`state`,`watcher-recent.jsonl`),e)}}let T=s(t);T!==null&&te(N(_,`state`,`shadow-head.txt`),T);let E=c(t);E!==null&&te(N(_,`state`,`checkpoint-refs.txt`),E),Z9(TTe(n),N(_,`state`,U9)),Z9(ETe(n),N(_,`state`,W9)),Z9(N(y,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(y,aX),N(_,`state`,aX)),Z9(N(y,oX),N(_,`state`,oX));let ee=p(),ne=d(),re=f(),ie={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:re}};te(N(_,`state`,`runtime.json`),`${JSON.stringify(ie,null,2)}\n`);let ae=x===`running`?`running
|
|
1529
|
+
`:`not-running (${C})\n`;if(te(N(_,`state`,`server-status.txt`),ae),e.processDir&&g(e.processDir)){let t=N(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let oe=e.redact===!0;oe&&bTe({stagingDir:_,contentDir:t}),e.note&&te(N(_,`note.txt`),e.note);let se=null;e.scrubSecrets===!0&&(se=GTe(_));for(let t of e.extraFiles??[])Z9(t.sourcePath,N(_,`extra`,t.zipName??fe(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let k=ITe(n),ce=Q9(_),le=[],ue=0,A=0;for(let e of ce){let t=$9(_,e),n=O(e).size,r=HTe(t)?RTe(e):0;le.push({path:t,bytes:n,lines:r}),ue+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(A+=BTe(e))}let j={applied:oe};se!==null&&(j.secretScrub=se);let de={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:re},contentDir:{pathSha256:LTe(t),absolutePath:oe?`<CONTENT_DIR>`:t},telemetry:{localSink:k,otlpPushEnabled:h()},redaction:j,serverStatus:x,files:le};te(N(_,`manifest.json`),`${JSON.stringify(de,null,2)}\n`);let pe=ce.some(e=>{try{return S(e,`utf-8`).includes(t)}catch{return!1}}),me={totalBytes:ue,fileCount:le.length,docNameCount:A,contentDirVisible:pe,redacted:oe},M=!1;return{stagingDir:_,manifest:de,summary:me,cleanup:()=>{M||(M=!0,D(_,{recursive:!0,force:!0}))}}}catch(e){throw D(_,{recursive:!0,force:!0}),e}}async function qTe(e){let{collected:t,outputPath:n}=e,r=pe(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new _ye.ZipFile,a=Q9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function JTe(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,on.parse)(S(n,`utf-8`)),r=A7(t)?t.content:void 0,i=A7(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return ve(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return ve(e)}async function YTe(e,t,n,r){let i=s9(t,e.logger),a=await KTe({contentDir:JTe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...Iwe(i,e.userLogsDir??N(oe(),`.ok`,`logs`)),...l9(e.cachesDir??N(oe(),`Library`,`Caches`))],userStateFiles:u9(e.bugReportsDir??o9()),deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(pe(e.outputPath),{recursive:!0}),await qTe({collected:a,outputPath:e.outputPath});let t=a.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:i,files:a.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:a.manifest.createdAt}}}finally{a.cleanup()}}async function XTe(e){let{projectDir:t}=e,n=e.readDesktopEnv??K9,r=e.readLanguage??O9;if(e.level===`full`&&t!==void 0)return YTe(e,t,n,r);let{zipPath:i,summary:a}=await Vwe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:l9(e.cachesDir??N(oe(),`Library`,`Caches`)),bugReportLedgerFiles:u9(e.bugReportsDir??o9()),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:i,summary:{level:e.level,systemWide:t===void 0,projectSlug:a.projectSlug,files:a.files,redactions:a.redactions,redactedLineCount:a.redactedLineCount,generatedAt:a.generatedAt}}}export{P5 as ALL_EDITOR_IDS,F5 as EDITOR_LABELS,n7 as EDITOR_TARGETS,GSe as HOSTS_WITH_USER_SKILL_DIR,Twe as LAUNCH_CONFIG_NAME,sTe as PATH_SHIM_BEGIN,lTe as PATH_SHIM_BLOCK_RE,cTe as PATH_SHIM_END,owe as addOkPathsToGitExclude,S7 as assertProjectPathSafe,W5 as buildManagedServerEntry,Zwe as buildMcpConfigDeclineEvent,Qwe as buildMcpConfigMigrateEvent,a9 as classifyExistingMcpEntry,XTe as collectReportBundle,un as createTokenStore,Nwe as defaultBugReportZipPath,Be as detectGh,Ue as detectGhAccounts,Awe as detectInstalledEditors,iCe as editorConfigPathDisplay,rCe as editorEntryLocator,Uwe as ensurePiBridge,z7 as formatTrackedRemediation,lwe as getExcludedOkPaths,L7 as getInstalledSkillProjectionPaths,awe as getNativeTomlMcpEditor,I7 as getOkArtifactPaths,H5 as isEntryUpToDate,G5 as isOwnManagedEntry,iTe as loadConfig,fee as makeLazyProbeTokenStore,o9 as okBugReportsDir,w9 as parseGitHubBlobUrl,aTe as parseGitHubShareUrl,T9 as parseGitHubTreeUrl,C9 as parseGitUrl,uTe as pathInstallMarkerPath,RCe as previewContent,Mwe as probeOwnManagedEditorMcpEntry,Hwe as probePiBridgeState,R7 as probeTrackedOkPaths,r9 as readExistingMcpEntry,cwe as readSharingMode,jo as redactContent,swe as removeOkPathsFromGitExclude,qwe as removeOwnMcpEntry,JCe as removeProjectSkill,fTe as removeUserGlobalSkillBundle,WCe as resolveProjectRoot,tTe as runStop,y9 as truncatePriorEntry,D9 as userGlobalSkillBundleTargets,oTe as validateLocalFolderForShare,n9 as writeEditorMcpConfig,hTe as writeProjectAiIntegrations,T7 as writeProjectSkill,kwe as writeUserMcpConfigs};
|
|
1533
1530
|
//# sourceMappingURL=index.mjs.map
|