@inkeep/open-knowledge 0.47.0-beta.11 → 0.47.0-beta.12
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-DKIFh12x.mjs → acp-harness-probe-B5ZcoZhq.mjs} +2 -2
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/assets/skills/project/references/preview.md +2 -2
- package/dist/cli.mjs +56 -56
- package/dist/constants-B93DvGEZ.mjs +2 -0
- package/dist/{git-handle-B9cFlvR2.mjs → git-handle-C1UjT-hk.mjs} +2 -2
- package/dist/git-handle-DGQcA7NB.mjs +1 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-W5BDE-8h.mjs → init-Ch0s16Xk.mjs} +36 -36
- package/dist/init-TT3HW7rx.mjs +1 -0
- package/dist/{launch-json-removal-C96QiRd5.mjs → launch-json-removal-BtzADSct.mjs} +2 -2
- package/dist/{loader-CCTIiJpG.mjs → loader-B1a2xkMa.mjs} +2 -2
- package/dist/loader-CAPwK1SH.mjs +1 -0
- package/dist/md-manager-BWRwfd0O.mjs +2 -0
- package/dist/{open-browser-DtS0SaFA.mjs → open-browser-EaffNuIE.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-C74xQCME.mjs → preview-BMnnTNrY.mjs} +2 -2
- package/dist/preview-DrBiF2Ga.mjs +1 -0
- package/dist/{repair-launch-json-Cqa59vJC.mjs → repair-launch-json-BpHR3uVh.mjs} +2 -2
- package/dist/{repair-mcp-configs-u2Xm-tk7.mjs → repair-mcp-configs-Be47TZrL.mjs} +2 -2
- package/dist/{repair-skills-BXCsRRL9.mjs → repair-skills-Dr7H3Str.mjs} +2 -2
- package/dist/repair-skills-G-dWeWp2.mjs +1 -0
- package/dist/server-lock-Du8KJQk8.mjs +1 -0
- package/dist/{server-lock-B1IPSV1G.mjs → server-lock-kWlPDbSb.mjs} +2 -2
- package/dist/{src-xqnWcl6h.mjs → src-AR0NVXFF.mjs} +122 -122
- package/dist/src-B5ZyZgxt.mjs +20 -0
- package/dist/{src-CHGk5YB-.mjs → src-BhR9uzLi.mjs} +320 -320
- package/dist/src-DD75GxXa.mjs +1 -0
- package/dist/start-DI3dV6ef.mjs +1 -0
- package/dist/{start-DSWtN4nT.mjs → start-z0TeQ0Wa.mjs} +3 -3
- package/dist/{write-project-skill-d8JhYDYY.mjs → write-project-skill-B8VIn_27.mjs} +4 -4
- package/package.json +5 -5
- package/dist/constants-CCNO9YjO.mjs +0 -2
- package/dist/git-handle-pq-bTXGz.mjs +0 -1
- package/dist/init-DbHa8G3k.mjs +0 -1
- package/dist/loader-DIHTuCOS.mjs +0 -1
- package/dist/md-manager-CQwbqiDq.mjs +0 -2
- package/dist/preview-Dk57h_lZ.mjs +0 -1
- package/dist/repair-skills-xur4yCYG.mjs +0 -1
- package/dist/server-lock-BWO8zIgq.mjs +0 -1
- package/dist/src-A114o3oA.mjs +0 -20
- package/dist/src-DjMcdwEK.mjs +0 -1
- package/dist/start-DLXcsxoT.mjs +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Y as e}from"./sleep-ByqzSHar.mjs";import{S as t,d as n,y as r}from"./write-project-skill-
|
|
1
|
+
import{Y as e}from"./sleep-ByqzSHar.mjs";import{S as t,d as n,y as r}from"./write-project-skill-B8VIn_27.mjs";import{d as i}from"./init-Ch0s16Xk.mjs";import{execFileSync as a}from"node:child_process";import{dirname as o,join as s}from"node:path";import{existsSync as c,mkdirSync as l,readFileSync as u,writeFileSync as d}from"node:fs";import{homedir as f}from"node:os";var p=e();const m=`open-knowledge`;function h(e){try{e()}catch{}}var g=class{backend=`keyring`;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(m,e).getPassword()}catch(t){return h(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return h(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return h(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(m,e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(m,e).deletePassword()}catch{}}},_=class{backend=`file`;authFile;constructor(e){this.authFile=e??s(f(),`.ok`,`auth.yml`)}read(){if(!c(this.authFile))return{};try{return(0,p.parse)(u(this.authFile,`utf-8`))??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=o(this.authFile);c(t)||l(t,{recursive:!0,mode:448}),d(this.authFile,(0,p.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},v=class{backend=`keyring`;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ~/.ok/auth.yml to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function y(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(m,`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
|
|
2
2
|
`),h(()=>t?.onBackendSelected?.({backend:`keyring`})),new v(new g(t?.onKeychainRead),new _(e))}catch(n){let r=n instanceof Error?`${n.name}: ${n.message}`:String(n);return process.stderr.write(`[auth] token storage: file (~/.ok/auth.yml) — OS keychain unavailable: ${r}\n`),h(()=>t?.onBackendSelected?.({backend:`file`,reason:r})),new _(e)}}function b(e){let t=null;return function(){if(t)return t;let n=2e3;return t=(async()=>{let t=null,r=new Promise(r=>{t=setTimeout(()=>{process.stderr.write(`[auth] token storage: keyring init exceeded ${n}ms; falling back to file (~/.ok/auth.yml)\n`),r(new _(e))},n)});try{return await Promise.race([y(e),r])}catch{return new _(e)}finally{t!==null&&clearTimeout(t)}})(),t}}function x(e){let t=b(e);return{async get(e){let n=await(await t()).get(e);return n===null?null:{token:n.token}}}}function S(e){let t=b(e);return{backend:`file`,async get(e){return(await t()).get(e)},async set(e,n,r,i){return(await t()).set(e,n,r,i)},async clear(e){return(await t()).clear(e)}}}async function C(e,t){let n=[],r=new _(t);await r.get(e)!=null&&(await r.clear(e),n.push(`file`));let i;try{let{Entry:t}=await import(`@napi-rs/keyring`);new t(m,`__probe__`);let r,a=await new g(e=>{e.kind===`read-error`&&(r=e.error??`read-error`)}).get(e);if(r!==void 0)i=r;else if(a!=null)try{new t(m,e).deletePassword(),n.push(`keychain`)}catch(e){i=e instanceof Error?e.name:`delete-error`}}catch{}return{touched:n,keychainError:i}}const w=[`/opt/homebrew/bin/gh`,`/usr/local/bin/gh`,`/opt/local/bin/gh`,`/snap/bin/gh`,`/usr/bin/gh`],T={encoding:`utf-8`,stdio:[`ignore`,`pipe`,`pipe`],timeout:5e3,windowsHide:!0};function E(e,t={}){let n=t._exec??a,r=t._fileExists??c,i=[`auth`,`token`,...e?[`--hostname`,e]:[]],o=[`gh`,...w.filter(r)];for(let e of o)try{let t=n(e,i,T).toString().trim();if(t.length>0)return{available:!0,token:t}}catch{}return{available:!1}}function D(e,a,o){let s=n[e],c=e===`opencode`?t:r,l=[],u=s.projectConfigPath?.(a);u!==void 0&&l.push({scope:`project`,configPath:u});try{l.push({scope:`user`,configPath:s.configPath(a,o)})}catch{}for(let t of l){let n=i(s,a,o,t.configPath);if(n!==null&&c(n))return{editorId:e,scope:t.scope,configPath:t.configPath}}return null}export{x as a,y as i,E as n,S as o,C as r,D as t};
|
|
3
|
-
//# sourceMappingURL=acp-harness-probe-
|
|
3
|
+
//# sourceMappingURL=acp-harness-probe-B5ZcoZhq.mjs.map
|
|
@@ -18,7 +18,7 @@ OpenKnowledge (OK) is a markdown-CRDT collaboration platform exposed via MCP. Th
|
|
|
18
18
|
|
|
19
19
|
1. **Reads:** `exec("cat …")` for one doc, `exec("ls -A …")` for a directory (folder defaults + template menu), `exec("grep …")` for literal, `search` for ranked retrieval. Native `Read` / `Grep` only on source code (`.ts` / `.py` / …), never on in-scope `.md` / `.mdx`.
|
|
20
20
|
2. **Writes:** `write({ document: { path, content } })` for a new or full-replace doc; `edit({ document: { path, find, replace } })` for a body find/replace; `edit({ document: { path, frontmatter } })` for a frontmatter merge-patch (`null` deletes a key). `delete({ document })` removes, `move({ from, to })` moves/renames. Body find/replace is body-only. Pass a one-line `summary` (≤80 chars, user-facing outcome) on every content write.
|
|
21
|
-
3. **Preview / open a doc — determine your ONE surface FIRST (once per session).** Stop at first match: **`OK_DESKTOP_TERMINAL` set** →
|
|
21
|
+
3. **Preview / open a doc — determine your ONE surface FIRST (once per session).** Stop at first match: **`OK_DESKTOP_TERMINAL` or `OK_HOSTED_AGENT` set** → you're inside OpenKnowledge (desktop terminal / in-app agent panel) → `ok open <name>` (switches the window the user is already looking at); never paste a `localhost` URL into your reply here · in-app browser (Claude Code Desktop's Browser pane, Cursor, Codex) → `preview_url`, then open/navigate it to the doc · else plain CLI → `ok open <name>`. `ok open <name>` opens a doc or folder (auto-detected); `--skill <name>` for a skill. The `previewUrl` field is a route id, **not** your open mechanism. Don't `preview_screenshot` to confirm edits. Full Step-0 procedure + per-surface how-to: `references/preview.md`.
|
|
22
22
|
4. **Knowledge layers:** capturing a source (ingest), synthesizing findings (research), promoting a decision (consolidate) — procedures, **not tool calls**; there is no `ingest` tool. Ingest ships here (`references/ingest-and-sources.md`); research + consolidate come with the `knowledge-base` pack. Layer model + packs: `references/starter-packs.md`.
|
|
23
23
|
5. **Direct questions:** a plain business question ("which customers…", "what did we decide about…") routes to `search` / `exec` + a cited chat answer — no "research" keyword needed. Persist only when durable + multi-doc + not already covered, and *offer* first. See `references/corpus-qa.md`.
|
|
24
24
|
6. **Authoring or improving a skill** ("write/make a skill", "improve this skill", "turn this into a skill"): STOP and invoke the **`open-knowledge-write-skill`** skill — it owns scope choice (project vs global), the SKILL.md contract, evaluation, and install; don't improvise here. Author through the `skill` target (`write({ skill })`), never a raw path document. Skills are REAL folders under the editor dirs' `skills/` (`.claude` · `.cursor` · `.codex` · `.opencode` · `.pi` · `.agents`): ONE is the source, the rest are managed copies/symlinks. **Read and edit via the tools (`skills`, `edit({ skill })`) — they route to the source.** Never hand-edit a non-source copy: unedited copies refresh from the source, and editing one forks it into its own skill that stops refreshing.
|
|
@@ -21,7 +21,7 @@ The user watches your edits land in a live browser preview. Open it once at sess
|
|
|
21
21
|
|
|
22
22
|
Your host doesn't change mid-session, so determine this **once**, the first time you're asked to open/show/preview a doc, and use that one surface for the rest of the session. Run the checks **top-to-bottom and stop at the first match** — earlier rungs win:
|
|
23
23
|
|
|
24
|
-
1. **Is `OK_DESKTOP_TERMINAL` set in your environment?**
|
|
24
|
+
1. **Is `OK_DESKTOP_TERMINAL` or `OK_HOSTED_AGENT` set in your environment?** Actually check (`echo "$OK_DESKTOP_TERMINAL$OK_HOSTED_AGENT"`, or read your env), don't assume. **Either one set → you are running inside OpenKnowledge itself** — `OK_DESKTOP_TERMINAL` in the desktop app's built-in terminal, `OK_HOSTED_AGENT` in its in-app agent panel. Open a doc or folder with `ok open <name>` (auto-detected; `--skill <name>` for a skill) — it switches the window the user is already looking at to the target. **Never resolve a preview URL here, and never paste one into your reply**: the user is looking at the app that URL points to, so a `localhost` link is noise at best. (This rung is the one agents miss most — check the env first, before anything else.)
|
|
25
25
|
2. **Do you have any URL-navigation / in-app browser tool** (Claude Code Desktop's **Browser pane**, Cursor's `Navigate`, Codex's `@Browser`, or `browser` / `open_url` / `view_url` / …)? → **Claude Code Desktop / Cursor / Codex desktop** → `preview_url` once, then open/navigate that browser to the `url` (per-surface how-to below — Claude Desktop opens the pane with `preview_start({ url })` then `navigate({ url })` to move; Cursor/Codex navigate directly).
|
|
26
26
|
3. **None of the above** → you're a **plain CLI** (Claude Code CLI, Codex CLI, Cursor CLI, OpenCode, Pi, any shell agent) → `ok open <name>` for a doc or folder (auto-detected; `--skill <name>` for a skill); deep-links a separate OK Desktop window, system browser only if no desktop.
|
|
27
27
|
|
|
@@ -42,7 +42,7 @@ Decide once; then every "open / show / preview this doc" this session uses that
|
|
|
42
42
|
- **`ok open <skill-name> --skill [--scope project|global]`** — opens a **skill** in the skill editor (skills are addressed by name + scope, not a content path, so they need the flag).
|
|
43
43
|
- All three deep-link into OK Desktop when a bundle is installed, and fall back to the browser UI (`ok ui`) otherwise. No `ok` on PATH or no shell → `preview_url`, then `open <url>` in the system browser as a last resort, and say so plainly. The system browser is the fallback, never the default.
|
|
44
44
|
|
|
45
|
-
(The same vendors' *desktop apps* with a built-in browser — Cursor, Codex desktop — are NOT here; they navigate their own browser per the in-app branch above. Codex **IDE extension** / **Cloud** are web-search-only → they're on this CLI track too.) **Running inside the
|
|
45
|
+
(The same vendors' *desktop apps* with a built-in browser — Cursor, Codex desktop — are NOT here; they navigate their own browser per the in-app branch above. Codex **IDE extension** / **Cloud** are web-search-only → they're on this CLI track too.) **Running inside OpenKnowledge itself — the desktop built-in terminal (`OK_DESKTOP_TERMINAL`) or the in-app agent panel (`OK_HOSTED_AGENT`)? Same track — `ok open <name>` re-targets the surface you're already in** (switches it to the doc/folder; when that surface is a desktop window there's no second window, and no need to raise it since it's already frontmost). Don't resolve preview URLs in that case; `ok open` is the whole answer.
|
|
46
46
|
|
|
47
47
|
**Opening or reading a file IS a preview navigation.** On any "open `<file>`" / "read `<file>`" request, navigate the browser to that doc's `previewUrl` route from the tool response — not a separate fetch, not a fresh system-browser launch.
|
|
48
48
|
|