wiki-viewer 1.14.1 → 2.0.0
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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/agent/activity/route.js +6 -6
- package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js +8 -8
- package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js +9 -9
- package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js +8 -8
- package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js +8 -8
- package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/move/route.js +8 -8
- package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/search/route.js +9 -9
- package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/internal/span/route.js +8 -8
- package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/settings/route.js +7 -7
- package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js +6 -6
- package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/assets/[...path]/route.js +5 -5
- package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/share/[token]/route.js +6 -5
- package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/share/route.js +4 -4
- package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/clear-root/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/reveal/route.js +6 -6
- package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/root-status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/set-root/route.js +6 -5
- package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js +5 -4
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js +6 -5
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js +5 -4
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/route.js +7 -6
- package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/upload/[...path]/route.js +5 -5
- package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/app/route.js +7 -7
- package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js +7 -7
- package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/content/route.js +7 -7
- package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/download/route.js +6 -6
- package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/file/route.js +5 -5
- package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/folder/route.js +5 -5
- package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js +4 -4
- package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js +6 -6
- package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js +4 -4
- package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js +4 -4
- package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-history/route.js +4 -4
- package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js +8 -8
- package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/move/route.js +6 -6
- package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/new-file/route.js +5 -5
- package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js +7 -7
- package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/page/route.js +5 -5
- package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/presence/route.js +6 -6
- package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/route.js +5 -5
- package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/search/route.js +5 -5
- package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/slugs/route.js +5 -5
- package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js +5 -5
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/watch/route.js +5 -5
- package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-jzw2_._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.-oq-7._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__000spch._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__01oin-a._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__01qcera._.js +16 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__02.uul~._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__024967n._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__06booxp._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__071_pmz._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0bqpg._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_1f2cw._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0a6j6r4._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0aoqat-._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0as-u6z._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0bvtbax._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c-ee48._.js +5 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e_9pc5._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0esmskc._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fshk._._.js +20 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fu72o7._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0k9mili._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l-wu5u._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0lvz22t._.js +20 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0n-chxk._.js +16 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0n9zdf0._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nmx3k2._.js +12 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nzlmkb._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o0v6hf._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s38pid._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s_8poz._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sfrx~.._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sggstu._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0u81k~2._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0uibxf_._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wfv_by._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wlj-yw._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0w~__xz._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0yat~ul._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0yxauu6._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zbkgnr._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zv_j05._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~rntxj._.js +3 -0
- package/.next/standalone/.next/server/chunks/src_lib_search_0d-_j3u._.js +4 -4
- package/.next/standalone/.next/server/chunks/src_lib_search_0ymmp0c._.js +3 -3
- package/.next/standalone/.next/server/chunks/src_lib_workspaces_ts_0qon40u._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_029cdbg._.js → 0~w0_katex_dist_katex_mjs_0s4yb1t._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0z41nrr._.js → [root-of-the-server]__10te1ye._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_13p348f._.js → node_modules__pnpm_0-a_zjq._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0gos._c._.js → node_modules__pnpm_02l_1_8._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0ru1i2-._.js → node_modules__pnpm_03rzttw._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_08xpp3w._.js → node_modules__pnpm_04frxp9._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0b8odbc._.js → node_modules__pnpm_057-t6m._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0f_n_zp._.js → node_modules__pnpm_05_oahi._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0~i3a.i._.js → node_modules__pnpm_05ans~m._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0i2m0b.._.js → node_modules__pnpm_06-2ia.._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0aha1~u._.js → node_modules__pnpm_086.ow4._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0w.kwue._.js → node_modules__pnpm_0cahog3._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0e0r_qk._.js → node_modules__pnpm_0cxanql._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0ajqqlq._.js → node_modules__pnpm_0e09gmf._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hzzx9d._.js → node_modules__pnpm_0eqjo2f._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_02bje_g._.js → node_modules__pnpm_0f-yazg._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xk042~._.js → node_modules__pnpm_0iu44jv._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_11ede0p._.js → node_modules__pnpm_0jh8q66._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0k-7uzm._.js → node_modules__pnpm_0m39f~t._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xr.ztu._.js → node_modules__pnpm_0ma-8l.._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0i6_kfe._.js → node_modules__pnpm_0met6sx._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_04v1_ty._.js → node_modules__pnpm_0mtrsi0._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0607~kg._.js → node_modules__pnpm_0n_swwn._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0t4l89_._.js → node_modules__pnpm_0ndyy93._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0-_58b8._.js → node_modules__pnpm_0s-cj7c._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0y2h_cz._.js → node_modules__pnpm_0tr41-t._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_08edl1n._.js → node_modules__pnpm_0u.uija._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0026mgr._.js → node_modules__pnpm_0wiyn6d._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09o_spj._.js → node_modules__pnpm_0ygzt82._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_0ss2.w7._.js +2 -2
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/middleware-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/static/chunks/0ci7khnv7i~7_.js +17 -0
- package/.next/standalone/.next/static/chunks/0sx~65~lg4mgl.css +5 -0
- package/.next/standalone/package.json +1 -1
- package/README.md +88 -17
- package/bin/postbuild.js +21 -0
- package/bin/wiki-viewer.js +198 -6
- package/package.json +1 -1
- package/.next/standalone/.github/workflows/publish.yml +0 -37
- package/.next/standalone/.handoffs/archive/handoff-20260612-113332.md +0 -98
- package/.next/standalone/.handoffs/archive/handoff-20260612-141032.md +0 -73
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-.y6im._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-3_t2y._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-kjkzt._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-puax4._.js +0 -4
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__01h996g._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0329ktu._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__03_xj4r._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__05398dt._.js +0 -4
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__06lfvxh._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__06w0aet._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__070_p2a._.js +0 -4
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0905hi1._.js +0 -21
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0aa63~j._.js +0 -5
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0avcplk._.js +0 -4
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b8_kyo._.js +0 -16
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0bticq1._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0bwevvu._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c__k3q._.js +0 -4
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0cp~z4x._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fmdv9h._.js +0 -20
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0h0qbwr._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jk~oyi._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ndq77b._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nvgpuk._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ocvng2._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ps4h~.._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q7jqwp._.js +0 -12
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qew~6p._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s_9f-a._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0uv7b8u._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0uv8.9i._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vfe2io._.js +0 -4
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0w11kjy._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wc-.e4._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ymovmp._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~c6ouv._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~rhs0u._.js +0 -16
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__10h9tid._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__10yk-u1._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__11105ew._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__11a3dhw._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__13420tt._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__13h~pdf._.js +0 -3
- package/.next/standalone/.next/static/chunks/02kg.lbkfi1yc.css +0 -5
- package/.next/standalone/.next/static/chunks/0rcwd6-.iu~nd.js +0 -17
- package/.next/standalone/.pi/ownership.json +0 -3
- package/.next/standalone/AGENTS.md +0 -114
- package/.next/standalone/DESIGN.md +0 -521
- package/.next/standalone/README.md +0 -821
- package/.next/standalone/TODO.md +0 -20
- package/.next/standalone/agents/bootstrap-prompt.md +0 -14
- package/.next/standalone/agents/wiki-viewer-skill/SKILL.md +0 -456
- package/.next/standalone/bin/postbuild.js +0 -78
- package/.next/standalone/bin/wiki-viewer.js +0 -922
- package/.next/standalone/certificates/localhost-key.pem +0 -28
- package/.next/standalone/certificates/localhost.pem +0 -24
- package/.next/standalone/docs/agent-collab-plan.md +0 -1615
- package/.next/standalone/docs/agent-collab-v2-plan.md +0 -771
- package/.next/standalone/docs/agent-fs-plan.md +0 -232
- package/.next/standalone/docs/editorial-skin-spec.md +0 -242
- package/.next/standalone/docs/file-vs-collab-authority.md +0 -124
- package/.next/standalone/docs/mobile-readiness-spec.md +0 -229
- package/.next/standalone/docs/workspacing-plan.md +0 -364
- package/.next/standalone/packages/wiki-viewer-mcp/README.md +0 -195
- package/.next/standalone/packages/wiki-viewer-mcp/bench-e2e.mjs +0 -166
- package/.next/standalone/packages/wiki-viewer-mcp/bench-latency.mjs +0 -87
- package/.next/standalone/packages/wiki-viewer-mcp/bench-payload.mjs +0 -45
- package/.next/standalone/packages/wiki-viewer-mcp/dist/http-client.js +0 -331
- package/.next/standalone/packages/wiki-viewer-mcp/dist/index.js +0 -531
- package/.next/standalone/packages/wiki-viewer-mcp/dist/register.js +0 -94
- package/.next/standalone/packages/wiki-viewer-mcp/dist/state-cache.js +0 -28
- package/.next/standalone/packages/wiki-viewer-mcp/package-lock.json +0 -1716
- package/.next/standalone/packages/wiki-viewer-mcp/package.json +0 -41
- package/.next/standalone/packages/wiki-viewer-mcp/src/http-client.ts +0 -459
- package/.next/standalone/packages/wiki-viewer-mcp/src/index.ts +0 -638
- package/.next/standalone/packages/wiki-viewer-mcp/src/register.ts +0 -144
- package/.next/standalone/packages/wiki-viewer-mcp/src/state-cache.ts +0 -55
- package/.next/standalone/packages/wiki-viewer-mcp/tsconfig.json +0 -19
- package/.next/standalone/pnpm-lock.yaml +0 -6697
- package/.next/standalone/pnpm-workspace.yaml +0 -8
- package/.next/standalone/postcss.config.mjs +0 -2
- package/.next/standalone/src/app/api/agent/activity/route.ts +0 -59
- package/.next/standalone/src/app/api/agent/admin/agents/[agentId]/revoke/route.ts +0 -40
- package/.next/standalone/src/app/api/agent/admin/agents/route.ts +0 -33
- package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/approve/route.ts +0 -83
- package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/deny/route.ts +0 -36
- package/.next/standalone/src/app/api/agent/admin/registrations/route.ts +0 -27
- package/.next/standalone/src/app/api/agent/events/[...path]/route.ts +0 -148
- package/.next/standalone/src/app/api/agent/files/[...path]/route.ts +0 -219
- package/.next/standalone/src/app/api/agent/fs/file/[...path]/route.ts +0 -446
- package/.next/standalone/src/app/api/agent/fs/ls/[[...path]]/route.ts +0 -152
- package/.next/standalone/src/app/api/agent/fs/move/route.ts +0 -130
- package/.next/standalone/src/app/api/agent/fs/search/route.ts +0 -272
- package/.next/standalone/src/app/api/agent/internal/span/route.ts +0 -121
- package/.next/standalone/src/app/api/agent/register/[regId]/route.ts +0 -50
- package/.next/standalone/src/app/api/agent/register/route.ts +0 -118
- package/.next/standalone/src/app/api/agent/settings/route.ts +0 -34
- package/.next/standalone/src/app/api/agent/settings/token/regenerate/route.ts +0 -20
- package/.next/standalone/src/app/api/agent/sidecar/[...path]/route.ts +0 -53
- package/.next/standalone/src/app/api/agents/install/route.ts +0 -143
- package/.next/standalone/src/app/api/agents/skill/route.ts +0 -20
- package/.next/standalone/src/app/api/agents/skill.tar.gz/route.ts +0 -87
- package/.next/standalone/src/app/api/app-proxy/[...path]/route.ts +0 -247
- package/.next/standalone/src/app/api/assets/[...path]/route.ts +0 -75
- package/.next/standalone/src/app/api/auth/[...all]/route.ts +0 -7
- package/.next/standalone/src/app/api/owner/init/route.ts +0 -14
- package/.next/standalone/src/app/api/share/[token]/route.ts +0 -269
- package/.next/standalone/src/app/api/share/route.ts +0 -127
- package/.next/standalone/src/app/api/system/admins/route.ts +0 -103
- package/.next/standalone/src/app/api/system/auth-config/route.ts +0 -22
- package/.next/standalone/src/app/api/system/auth-settings/route.ts +0 -86
- package/.next/standalone/src/app/api/system/browse/route.ts +0 -82
- package/.next/standalone/src/app/api/system/clear-root/route.ts +0 -16
- package/.next/standalone/src/app/api/system/config/route.ts +0 -14
- package/.next/standalone/src/app/api/system/pins/route.ts +0 -38
- package/.next/standalone/src/app/api/system/reveal/route.ts +0 -36
- package/.next/standalone/src/app/api/system/root-status/route.ts +0 -13
- package/.next/standalone/src/app/api/system/set-root/route.ts +0 -53
- package/.next/standalone/src/app/api/system/users/route.ts +0 -120
- package/.next/standalone/src/app/api/system/workspaces/[id]/open/route.ts +0 -34
- package/.next/standalone/src/app/api/system/workspaces/[id]/refresh/route.ts +0 -32
- package/.next/standalone/src/app/api/system/workspaces/[id]/route.ts +0 -78
- package/.next/standalone/src/app/api/system/workspaces/route.ts +0 -128
- package/.next/standalone/src/app/api/upload/[...path]/route.ts +0 -85
- package/.next/standalone/src/app/api/wiki/app/route.ts +0 -60
- package/.next/standalone/src/app/api/wiki/backlinks/route.ts +0 -29
- package/.next/standalone/src/app/api/wiki/content/route.ts +0 -159
- package/.next/standalone/src/app/api/wiki/download/route.ts +0 -100
- package/.next/standalone/src/app/api/wiki/file/route.ts +0 -57
- package/.next/standalone/src/app/api/wiki/folder/route.ts +0 -34
- package/.next/standalone/src/app/api/wiki/git-branches/route.ts +0 -32
- package/.next/standalone/src/app/api/wiki/git-checkout/route.ts +0 -45
- package/.next/standalone/src/app/api/wiki/git-diff/route.ts +0 -33
- package/.next/standalone/src/app/api/wiki/git-file-info/route.ts +0 -27
- package/.next/standalone/src/app/api/wiki/git-history/route.ts +0 -27
- package/.next/standalone/src/app/api/wiki/git-pull/route.ts +0 -48
- package/.next/standalone/src/app/api/wiki/move/route.ts +0 -61
- package/.next/standalone/src/app/api/wiki/new-file/route.ts +0 -56
- package/.next/standalone/src/app/api/wiki/outlinks/route.ts +0 -76
- package/.next/standalone/src/app/api/wiki/page/route.ts +0 -92
- package/.next/standalone/src/app/api/wiki/presence/route.ts +0 -56
- package/.next/standalone/src/app/api/wiki/route.ts +0 -116
- package/.next/standalone/src/app/api/wiki/search/route.ts +0 -44
- package/.next/standalone/src/app/api/wiki/slugs/route.ts +0 -54
- package/.next/standalone/src/app/api/wiki/upload/route.ts +0 -95
- package/.next/standalone/src/app/api/wiki/watch/route.ts +0 -67
- package/.next/standalone/src/app/globals.css +0 -1249
- package/.next/standalone/src/app/icon.svg +0 -11
- package/.next/standalone/src/app/layout.tsx +0 -78
- package/.next/standalone/src/app/manifest.ts +0 -30
- package/.next/standalone/src/app/page.tsx +0 -3260
- package/.next/standalone/src/app/s/[token]/page.tsx +0 -357
- package/.next/standalone/src/app/signin/page.tsx +0 -16
- package/.next/standalone/src/app/signin/signin-form.tsx +0 -238
- package/.next/standalone/src/components/ai-panel/activity-row.tsx +0 -284
- package/.next/standalone/src/components/ai-panel/ai-panel.tsx +0 -311
- package/.next/standalone/src/components/ai-panel/token-section.tsx +0 -313
- package/.next/standalone/src/components/auth-settings-sheet.tsx +0 -474
- package/.next/standalone/src/components/confirm-dialog.tsx +0 -56
- package/.next/standalone/src/components/dir-picker.tsx +0 -606
- package/.next/standalone/src/components/editor/backlinks-panel.tsx +0 -139
- package/.next/standalone/src/components/editor/bubble-menu.tsx +0 -346
- package/.next/standalone/src/components/editor/callout-extension.ts +0 -36
- package/.next/standalone/src/components/editor/comment-pip.tsx +0 -56
- package/.next/standalone/src/components/editor/comment-thread.tsx +0 -254
- package/.next/standalone/src/components/editor/csv-viewer.tsx +0 -379
- package/.next/standalone/src/components/editor/document-outline.tsx +0 -230
- package/.next/standalone/src/components/editor/editor-toolbar.tsx +0 -564
- package/.next/standalone/src/components/editor/editor.tsx +0 -1327
- package/.next/standalone/src/components/editor/extensions/drag-handle.ts +0 -325
- package/.next/standalone/src/components/editor/extensions/heading-anchors.ts +0 -55
- package/.next/standalone/src/components/editor/extensions/proof-span.ts +0 -60
- package/.next/standalone/src/components/editor/extensions/resizable-image.tsx +0 -159
- package/.next/standalone/src/components/editor/extensions.ts +0 -150
- package/.next/standalone/src/components/editor/file-fallback-viewer.tsx +0 -75
- package/.next/standalone/src/components/editor/folder-index.tsx +0 -236
- package/.next/standalone/src/components/editor/google-doc-viewer.tsx +0 -73
- package/.next/standalone/src/components/editor/image-viewer.tsx +0 -57
- package/.next/standalone/src/components/editor/large-file-gate.tsx +0 -108
- package/.next/standalone/src/components/editor/link-popover.tsx +0 -111
- package/.next/standalone/src/components/editor/media-popover.tsx +0 -212
- package/.next/standalone/src/components/editor/media-viewer.tsx +0 -70
- package/.next/standalone/src/components/editor/mermaid-viewer.tsx +0 -286
- package/.next/standalone/src/components/editor/node-app-viewer.tsx +0 -328
- package/.next/standalone/src/components/editor/notebook-viewer.tsx +0 -371
- package/.next/standalone/src/components/editor/office/docx-viewer.tsx +0 -93
- package/.next/standalone/src/components/editor/office/office-chrome.tsx +0 -83
- package/.next/standalone/src/components/editor/office/pptx-viewer.tsx +0 -104
- package/.next/standalone/src/components/editor/office/xlsx-viewer.tsx +0 -192
- package/.next/standalone/src/components/editor/pdf-viewer.tsx +0 -32
- package/.next/standalone/src/components/editor/proof-span-popover.tsx +0 -162
- package/.next/standalone/src/components/editor/slash-commands.tsx +0 -629
- package/.next/standalone/src/components/editor/source-viewer.tsx +0 -289
- package/.next/standalone/src/components/editor/suggest-edit-popover.tsx +0 -229
- package/.next/standalone/src/components/editor/suggestion-card.tsx +0 -206
- package/.next/standalone/src/components/editor/table-menu.tsx +0 -232
- package/.next/standalone/src/components/editor/view-mode-comment-button.tsx +0 -77
- package/.next/standalone/src/components/editor/website-viewer.tsx +0 -75
- package/.next/standalone/src/components/editor/wiki-link-create-dialog.tsx +0 -189
- package/.next/standalone/src/components/editor/wiki-link-decorator.ts +0 -79
- package/.next/standalone/src/components/editor/wiki-link-extension.ts +0 -120
- package/.next/standalone/src/components/editor/wiki-link-picker.tsx +0 -250
- package/.next/standalone/src/components/layout/viewer-toolbar.tsx +0 -54
- package/.next/standalone/src/components/search/search-command-dialog.tsx +0 -246
- package/.next/standalone/src/components/search/sidebar-search-box.tsx +0 -121
- package/.next/standalone/src/components/search/snippet-text.tsx +0 -48
- package/.next/standalone/src/components/share-dialog.tsx +0 -307
- package/.next/standalone/src/components/theme-provider.tsx +0 -16
- package/.next/standalone/src/components/theme-toggle.tsx +0 -24
- package/.next/standalone/src/components/ui/badge.tsx +0 -35
- package/.next/standalone/src/components/ui/button.tsx +0 -56
- package/.next/standalone/src/components/ui/card.tsx +0 -63
- package/.next/standalone/src/components/ui/collapsible.tsx +0 -9
- package/.next/standalone/src/components/ui/command.tsx +0 -151
- package/.next/standalone/src/components/ui/context-menu.tsx +0 -191
- package/.next/standalone/src/components/ui/dialog.tsx +0 -119
- package/.next/standalone/src/components/ui/dropdown-menu.tsx +0 -194
- package/.next/standalone/src/components/ui/input.tsx +0 -22
- package/.next/standalone/src/components/ui/label.tsx +0 -25
- package/.next/standalone/src/components/ui/popover.tsx +0 -33
- package/.next/standalone/src/components/ui/scroll-area.tsx +0 -47
- package/.next/standalone/src/components/ui/select.tsx +0 -156
- package/.next/standalone/src/components/ui/separator.tsx +0 -30
- package/.next/standalone/src/components/ui/sheet.tsx +0 -140
- package/.next/standalone/src/components/ui/skeleton.tsx +0 -15
- package/.next/standalone/src/components/ui/switch.tsx +0 -28
- package/.next/standalone/src/components/ui/tabs.tsx +0 -54
- package/.next/standalone/src/components/ui/textarea.tsx +0 -21
- package/.next/standalone/src/components/ui/tip.tsx +0 -23
- package/.next/standalone/src/components/ui/toggle-group.tsx +0 -41
- package/.next/standalone/src/components/ui/tooltip.tsx +0 -27
- package/.next/standalone/src/components/view-width-toggle.tsx +0 -70
- package/.next/standalone/src/components/wiki/frontmatter-header.tsx +0 -164
- package/.next/standalone/src/hooks/use-is-mobile.ts +0 -14
- package/.next/standalone/src/lib/app-runner.ts +0 -272
- package/.next/standalone/src/lib/auth/admin.ts +0 -120
- package/.next/standalone/src/lib/auth/allowlist.ts +0 -50
- package/.next/standalone/src/lib/auth/client.ts +0 -4
- package/.next/standalone/src/lib/auth/csrf.ts +0 -68
- package/.next/standalone/src/lib/auth/server.ts +0 -215
- package/.next/standalone/src/lib/cabinets/tree.ts +0 -75
- package/.next/standalone/src/lib/config.ts +0 -114
- package/.next/standalone/src/lib/embeds/detect.ts +0 -142
- package/.next/standalone/src/lib/git-secrets.ts +0 -65
- package/.next/standalone/src/lib/git.ts +0 -503
- package/.next/standalone/src/lib/google/detect.ts +0 -107
- package/.next/standalone/src/lib/markdown/parse-frontmatter.ts +0 -104
- package/.next/standalone/src/lib/markdown/remark-wikilinks.ts +0 -100
- package/.next/standalone/src/lib/markdown/sanitize-schema.ts +0 -106
- package/.next/standalone/src/lib/markdown/to-html.ts +0 -282
- package/.next/standalone/src/lib/markdown/to-markdown.ts +0 -252
- package/.next/standalone/src/lib/proof/activity-shared.ts +0 -31
- package/.next/standalone/src/lib/proof/activity.ts +0 -74
- package/.next/standalone/src/lib/proof/audit.ts +0 -88
- package/.next/standalone/src/lib/proof/auth.ts +0 -143
- package/.next/standalone/src/lib/proof/block-refs.ts +0 -133
- package/.next/standalone/src/lib/proof/blocks.ts +0 -73
- package/.next/standalone/src/lib/proof/client-auth.ts +0 -23
- package/.next/standalone/src/lib/proof/collab-state.ts +0 -81
- package/.next/standalone/src/lib/proof/event-bus.ts +0 -47
- package/.next/standalone/src/lib/proof/file-lock.ts +0 -43
- package/.next/standalone/src/lib/proof/glob.ts +0 -51
- package/.next/standalone/src/lib/proof/idempotency.ts +0 -37
- package/.next/standalone/src/lib/proof/lease.ts +0 -117
- package/.next/standalone/src/lib/proof/mutex.ts +0 -36
- package/.next/standalone/src/lib/proof/ops-applier.ts +0 -727
- package/.next/standalone/src/lib/proof/owner-auth.ts +0 -2
- package/.next/standalone/src/lib/proof/pending.ts +0 -97
- package/.next/standalone/src/lib/proof/proof-span.ts +0 -141
- package/.next/standalone/src/lib/proof/rate-limit.ts +0 -53
- package/.next/standalone/src/lib/proof/raw-fs.ts +0 -197
- package/.next/standalone/src/lib/proof/register-rate-limit.ts +0 -53
- package/.next/standalone/src/lib/proof/registry.ts +0 -195
- package/.next/standalone/src/lib/proof/sidecar.ts +0 -103
- package/.next/standalone/src/lib/proof/suggest-capture.ts +0 -69
- package/.next/standalone/src/lib/proof/types.ts +0 -182
- package/.next/standalone/src/lib/proof-config.ts +0 -14
- package/.next/standalone/src/lib/root-dir.ts +0 -35
- package/.next/standalone/src/lib/search/indexable-exts.ts +0 -25
- package/.next/standalone/src/lib/search/indexer.ts +0 -634
- package/.next/standalone/src/lib/search/sanitize.ts +0 -35
- package/.next/standalone/src/lib/search/search-db.ts +0 -57
- package/.next/standalone/src/lib/search/watcher-pool.ts +0 -79
- package/.next/standalone/src/lib/shared-docs/db.ts +0 -177
- package/.next/standalone/src/lib/toast.ts +0 -9
- package/.next/standalone/src/lib/utils.ts +0 -6
- package/.next/standalone/src/lib/wiki-helpers.ts +0 -36
- package/.next/standalone/src/lib/workspace-client.ts +0 -82
- package/.next/standalone/src/lib/workspace-context.ts +0 -173
- package/.next/standalone/src/lib/workspaces.ts +0 -400
- package/.next/standalone/src/middleware.ts +0 -44
- package/.next/standalone/src/stores/ai-panel-store.ts +0 -79
- package/.next/standalone/src/stores/editor-store.ts +0 -439
- package/.next/standalone/src/stores/pin-store.ts +0 -56
- package/.next/standalone/src/stores/proof-store.ts +0 -124
- package/.next/standalone/src/stores/recent-store.ts +0 -51
- package/.next/standalone/src/stores/search-store.ts +0 -104
- package/.next/standalone/src/stores/show-hidden-store.ts +0 -26
- package/.next/standalone/src/stores/sidebar-width-store.ts +0 -39
- package/.next/standalone/src/stores/skin-store.ts +0 -42
- package/.next/standalone/src/stores/tree-store.ts +0 -52
- package/.next/standalone/src/stores/view-width-store.ts +0 -101
- package/.next/standalone/src/stores/wiki-slugs-store.ts +0 -75
- package/.next/standalone/src/tests/proof/activity-aggregator.test.ts +0 -146
- package/.next/standalone/src/tests/proof/admin-create-user.test.ts +0 -43
- package/.next/standalone/src/tests/proof/agent-fs.test.ts +0 -973
- package/.next/standalone/src/tests/proof/agent-ownership.test.ts +0 -140
- package/.next/standalone/src/tests/proof/agent-workspace-scope.test.ts +0 -134
- package/.next/standalone/src/tests/proof/agents-install.test.ts +0 -110
- package/.next/standalone/src/tests/proof/bench-write.ts +0 -179
- package/.next/standalone/src/tests/proof/better-auth.test.ts +0 -68
- package/.next/standalone/src/tests/proof/block-refs.test.ts +0 -108
- package/.next/standalone/src/tests/proof/blocks.test.ts +0 -92
- package/.next/standalone/src/tests/proof/collab-state.test.ts +0 -501
- package/.next/standalone/src/tests/proof/comments-ops.test.ts +0 -177
- package/.next/standalone/src/tests/proof/editor-roundtrip.test.ts +0 -85
- package/.next/standalone/src/tests/proof/external-edit.test.ts +0 -58
- package/.next/standalone/src/tests/proof/file-lock.test.ts +0 -80
- package/.next/standalone/src/tests/proof/git-branches-checkout.test.ts +0 -136
- package/.next/standalone/src/tests/proof/git-read-features.test.ts +0 -473
- package/.next/standalone/src/tests/proof/git-secrets.test.ts +0 -138
- package/.next/standalone/src/tests/proof/git-sparse.test.ts +0 -257
- package/.next/standalone/src/tests/proof/git-workspace.test.ts +0 -135
- package/.next/standalone/src/tests/proof/git.test.ts +0 -243
- package/.next/standalone/src/tests/proof/glob.test.ts +0 -82
- package/.next/standalone/src/tests/proof/helpers/auth-session.ts +0 -27
- package/.next/standalone/src/tests/proof/markdown-to-html.test.ts +0 -46
- package/.next/standalone/src/tests/proof/ops-applier.test.ts +0 -368
- package/.next/standalone/src/tests/proof/owner-init.test.ts +0 -2
- package/.next/standalone/src/tests/proof/parse-frontmatter.test.ts +0 -60
- package/.next/standalone/src/tests/proof/preload.ts +0 -21
- package/.next/standalone/src/tests/proof/proof-span.test.ts +0 -98
- package/.next/standalone/src/tests/proof/rate-limit.test.ts +0 -54
- package/.next/standalone/src/tests/proof/readonly-enforcement.test.ts +0 -161
- package/.next/standalone/src/tests/proof/reconcile-sidecar.test.ts +0 -195
- package/.next/standalone/src/tests/proof/registration-flow.test.ts +0 -330
- package/.next/standalone/src/tests/proof/registry.test.ts +0 -169
- package/.next/standalone/src/tests/proof/routes.test.ts +0 -516
- package/.next/standalone/src/tests/proof/search-index.test.ts +0 -376
- package/.next/standalone/src/tests/proof/sidecar-lifecycle.test.ts +0 -177
- package/.next/standalone/src/tests/proof/sidecar-trim.test.ts +0 -58
- package/.next/standalone/src/tests/proof/suggestion-ops.test.ts +0 -280
- package/.next/standalone/src/tests/proof/wiki-content-put.test.ts +0 -140
- package/.next/standalone/src/tests/proof/wiki-routes-auth.test.ts +0 -208
- package/.next/standalone/src/tests/proof/workspace-isolation.test.ts +0 -87
- package/.next/standalone/src/tests/proof/workspaces-api.test.ts +0 -227
- package/.next/standalone/src/types/index.ts +0 -47
- package/.next/standalone/tailwind.config.ts +0 -191
- package/.next/standalone/tsconfig.json +0 -41
- package/.next/standalone/tsconfig.tsbuildinfo +0 -1
- /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → ecpoWt_SP3WkUTh0NsnuT}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → ecpoWt_SP3WkUTh0NsnuT}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → ecpoWt_SP3WkUTh0NsnuT}/_ssgManifest.js +0 -0
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Search database lifecycle.
|
|
3
|
-
*
|
|
4
|
-
* Separate from auth.db: FTS5 shadow tables would pollute the auth schema and
|
|
5
|
-
* better-auth's migrator could misidentify them. search.db is rebuildable from
|
|
6
|
-
* the filesystem at any time -- deleting it only triggers a rescan on next access.
|
|
7
|
-
*
|
|
8
|
-
* Mirrors src/lib/proof/audit.ts structure.
|
|
9
|
-
*/
|
|
10
|
-
import Database from "better-sqlite3";
|
|
11
|
-
import path from "node:path";
|
|
12
|
-
import os from "node:os";
|
|
13
|
-
import { mkdirSync } from "node:fs";
|
|
14
|
-
|
|
15
|
-
function dataDir(): string {
|
|
16
|
-
return path.join(process.env.HOME ?? os.homedir(), ".wiki-viewer");
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let _db: InstanceType<typeof Database> | null = null;
|
|
20
|
-
|
|
21
|
-
export function getSearchDb(): InstanceType<typeof Database> {
|
|
22
|
-
if (_db) return _db;
|
|
23
|
-
const dir = dataDir();
|
|
24
|
-
mkdirSync(dir, { recursive: true });
|
|
25
|
-
_db = new Database(path.join(dir, "search.db"));
|
|
26
|
-
_db.pragma("journal_mode = WAL");
|
|
27
|
-
_db.pragma("synchronous = NORMAL");
|
|
28
|
-
_db.pragma("temp_store = MEMORY");
|
|
29
|
-
_db.pragma("mmap_size = 134217728"); // 128 MiB
|
|
30
|
-
_db.exec(`
|
|
31
|
-
CREATE VIRTUAL TABLE IF NOT EXISTS docs USING fts5(
|
|
32
|
-
ws UNINDEXED,
|
|
33
|
-
path UNINDEXED,
|
|
34
|
-
name,
|
|
35
|
-
frontmatter,
|
|
36
|
-
body,
|
|
37
|
-
tokenize = 'porter unicode61 remove_diacritics 2'
|
|
38
|
-
);
|
|
39
|
-
CREATE TABLE IF NOT EXISTS docs_meta (
|
|
40
|
-
ws TEXT NOT NULL,
|
|
41
|
-
path TEXT NOT NULL,
|
|
42
|
-
size INTEGER NOT NULL,
|
|
43
|
-
mtime_ns INTEGER NOT NULL,
|
|
44
|
-
sha TEXT NOT NULL,
|
|
45
|
-
indexed_at TEXT NOT NULL,
|
|
46
|
-
PRIMARY KEY (ws, path)
|
|
47
|
-
) WITHOUT ROWID;
|
|
48
|
-
CREATE INDEX IF NOT EXISTS docs_meta_ws_idx ON docs_meta(ws);
|
|
49
|
-
`);
|
|
50
|
-
return _db;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** Reset cached DB handle. Used by tests to pick up a new HOME. */
|
|
54
|
-
export function _resetSearchDb(): void {
|
|
55
|
-
try { _db?.close(); } catch { /* ignore */ }
|
|
56
|
-
_db = null;
|
|
57
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared chokidar watcher pool.
|
|
3
|
-
*
|
|
4
|
-
* Ensures exactly ONE FSWatcher per workspace regardless of how many SSE
|
|
5
|
-
* connections or indexer subscriptions are active. When the last subscriber
|
|
6
|
-
* unsubscribes, the watcher is closed.
|
|
7
|
-
*
|
|
8
|
-
* The watch route and the indexer both subscribe through this pool.
|
|
9
|
-
*/
|
|
10
|
-
import { watch, type FSWatcher } from "chokidar";
|
|
11
|
-
import path from "node:path";
|
|
12
|
-
|
|
13
|
-
export type WatchEvent = "add" | "unlink" | "addDir" | "unlinkDir" | "change";
|
|
14
|
-
export type WatchListener = (ev: WatchEvent, relPath: string) => void;
|
|
15
|
-
|
|
16
|
-
interface PoolEntry {
|
|
17
|
-
watcher: FSWatcher;
|
|
18
|
-
listeners: Set<WatchListener>;
|
|
19
|
-
rootDir: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const pool = new Map<string, PoolEntry>();
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Subscribe to file-system events for a workspace.
|
|
26
|
-
* Returns an unsubscribe function. Call it when the subscriber is done.
|
|
27
|
-
* The pool creates a watcher on first subscribe and closes it on last unsubscribe.
|
|
28
|
-
*/
|
|
29
|
-
export function subscribe(
|
|
30
|
-
wsId: string,
|
|
31
|
-
rootDir: string,
|
|
32
|
-
fn: WatchListener,
|
|
33
|
-
): () => void {
|
|
34
|
-
let entry = pool.get(wsId);
|
|
35
|
-
if (!entry) {
|
|
36
|
-
const watcher = watch(rootDir, {
|
|
37
|
-
ignoreInitial: true,
|
|
38
|
-
ignored: /(node_modules|\.git|\.next|\.proof)/,
|
|
39
|
-
persistent: true,
|
|
40
|
-
awaitWriteFinish: { stabilityThreshold: 150, pollInterval: 50 },
|
|
41
|
-
});
|
|
42
|
-
entry = { watcher, listeners: new Set(), rootDir };
|
|
43
|
-
pool.set(wsId, entry);
|
|
44
|
-
|
|
45
|
-
const emit = (ev: WatchEvent, abs: string) => {
|
|
46
|
-
const e = pool.get(wsId);
|
|
47
|
-
if (!e) return;
|
|
48
|
-
const rel = path.relative(e.rootDir, abs);
|
|
49
|
-
e.listeners.forEach((l) => {
|
|
50
|
-
try { l(ev, rel); } catch { /* listener errors must not crash the pool */ }
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
watcher.on("add", (p: string) => emit("add", p));
|
|
55
|
-
watcher.on("unlink", (p: string) => emit("unlink", p));
|
|
56
|
-
watcher.on("change", (p: string) => emit("change", p));
|
|
57
|
-
watcher.on("addDir", (p: string) => { const rel = path.relative(rootDir, p); if (rel) emit("addDir", p); });
|
|
58
|
-
watcher.on("unlinkDir", (p: string) => { const rel = path.relative(rootDir, p); if (rel) emit("unlinkDir", p); });
|
|
59
|
-
}
|
|
60
|
-
entry.listeners.add(fn);
|
|
61
|
-
|
|
62
|
-
return () => {
|
|
63
|
-
const e = pool.get(wsId);
|
|
64
|
-
if (!e) return;
|
|
65
|
-
e.listeners.delete(fn);
|
|
66
|
-
if (e.listeners.size === 0) {
|
|
67
|
-
e.watcher.close().catch(() => { /* ignore */ });
|
|
68
|
-
pool.delete(wsId);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** Reset entire pool. Used by tests. */
|
|
74
|
-
export function _resetWatcherPool(): void {
|
|
75
|
-
for (const e of pool.values()) {
|
|
76
|
-
e.watcher.close().catch(() => { /* ignore */ });
|
|
77
|
-
}
|
|
78
|
-
pool.clear();
|
|
79
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared docs DB — stores share links for public read-only access.
|
|
3
|
-
*
|
|
4
|
-
* Each share link references a (workspaceId, filePath) pair. The link
|
|
5
|
-
* can optionally be password-protected and/or time-limited.
|
|
6
|
-
*
|
|
7
|
-
* DB: ~/.wiki-viewer/shared.db (WAL mode, separate from auth.db and search.db).
|
|
8
|
-
*/
|
|
9
|
-
import Database from "better-sqlite3";
|
|
10
|
-
import path from "node:path";
|
|
11
|
-
import os from "node:os";
|
|
12
|
-
import { mkdirSync } from "node:fs";
|
|
13
|
-
import { randomBytes, scryptSync, timingSafeEqual } from "node:crypto";
|
|
14
|
-
|
|
15
|
-
export interface SharedDoc {
|
|
16
|
-
id: string;
|
|
17
|
-
workspaceId: string;
|
|
18
|
-
filePath: string;
|
|
19
|
-
token: string;
|
|
20
|
-
passwordHash: string | null;
|
|
21
|
-
expiresAt: string | null;
|
|
22
|
-
createdBy: string;
|
|
23
|
-
createdAt: string;
|
|
24
|
-
viewCount: number;
|
|
25
|
-
isRevoked: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface CreateSharedDocInput {
|
|
29
|
-
workspaceId: string;
|
|
30
|
-
filePath: string;
|
|
31
|
-
password?: string;
|
|
32
|
-
expiresAt?: string; // ISO date string, e.g. "2026-07-10T00:00:00Z"
|
|
33
|
-
createdBy: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function dataDir(): string {
|
|
37
|
-
return path.join(process.env.HOME ?? os.homedir(), ".wiki-viewer");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let _db: InstanceType<typeof Database> | null = null;
|
|
41
|
-
|
|
42
|
-
function getDb(): InstanceType<typeof Database> {
|
|
43
|
-
if (_db) return _db;
|
|
44
|
-
const dir = dataDir();
|
|
45
|
-
mkdirSync(dir, { recursive: true });
|
|
46
|
-
_db = new Database(path.join(dir, "shared.db"));
|
|
47
|
-
_db.pragma("journal_mode = WAL");
|
|
48
|
-
_db.pragma("synchronous = NORMAL");
|
|
49
|
-
_db.exec(`
|
|
50
|
-
CREATE TABLE IF NOT EXISTS shared_docs (
|
|
51
|
-
id TEXT PRIMARY KEY,
|
|
52
|
-
workspace_id TEXT NOT NULL,
|
|
53
|
-
file_path TEXT NOT NULL,
|
|
54
|
-
token TEXT NOT NULL UNIQUE,
|
|
55
|
-
password_hash TEXT,
|
|
56
|
-
expires_at TEXT,
|
|
57
|
-
created_by TEXT NOT NULL,
|
|
58
|
-
created_at TEXT NOT NULL,
|
|
59
|
-
view_count INTEGER NOT NULL DEFAULT 0,
|
|
60
|
-
is_revoked INTEGER NOT NULL DEFAULT 0
|
|
61
|
-
);
|
|
62
|
-
CREATE INDEX IF NOT EXISTS shared_docs_token_idx ON shared_docs(token);
|
|
63
|
-
CREATE INDEX IF NOT EXISTS shared_docs_file_idx ON shared_docs(workspace_id, file_path);
|
|
64
|
-
`);
|
|
65
|
-
return _db;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function createShare(input: CreateSharedDocInput): SharedDoc {
|
|
69
|
-
const db = getDb();
|
|
70
|
-
const id = "shr_" + randomBytes(8).toString("base64url");
|
|
71
|
-
const token = randomBytes(16).toString("base64url");
|
|
72
|
-
const passwordHash = input.password ? hashPassword(input.password) : null;
|
|
73
|
-
|
|
74
|
-
const shared: SharedDoc = {
|
|
75
|
-
id,
|
|
76
|
-
workspaceId: input.workspaceId,
|
|
77
|
-
filePath: input.filePath,
|
|
78
|
-
token,
|
|
79
|
-
passwordHash,
|
|
80
|
-
expiresAt: input.expiresAt ?? null,
|
|
81
|
-
createdBy: input.createdBy,
|
|
82
|
-
createdAt: new Date().toISOString(),
|
|
83
|
-
viewCount: 0,
|
|
84
|
-
isRevoked: false,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const dbValues = {
|
|
88
|
-
...shared,
|
|
89
|
-
isRevoked: shared.isRevoked ? 1 : 0,
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
db.prepare(
|
|
93
|
-
`INSERT INTO shared_docs
|
|
94
|
-
(id, workspace_id, file_path, token, password_hash, expires_at, created_by, created_at, view_count, is_revoked)
|
|
95
|
-
VALUES (@id, @workspaceId, @filePath, @token, @passwordHash, @expiresAt, @createdBy, @createdAt, @viewCount, @isRevoked)`,
|
|
96
|
-
).run(dbValues);
|
|
97
|
-
return shared;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
type DbRow = Record<string, unknown>;
|
|
101
|
-
|
|
102
|
-
function rowToShare(row: DbRow): SharedDoc {
|
|
103
|
-
return {
|
|
104
|
-
id: row.id as string,
|
|
105
|
-
workspaceId: row.workspace_id as string,
|
|
106
|
-
filePath: row.file_path as string,
|
|
107
|
-
token: row.token as string,
|
|
108
|
-
passwordHash: (row.password_hash as string | null) ?? null,
|
|
109
|
-
expiresAt: (row.expires_at as string | null) ?? null,
|
|
110
|
-
createdBy: row.created_by as string,
|
|
111
|
-
createdAt: row.created_at as string,
|
|
112
|
-
viewCount: (row.view_count as number) ?? 0,
|
|
113
|
-
isRevoked: (row.is_revoked as number) === 1,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export function getShareByToken(token: string): SharedDoc | null {
|
|
118
|
-
const db = getDb();
|
|
119
|
-
const row = db.prepare("SELECT * FROM shared_docs WHERE token = ?").get(token) as
|
|
120
|
-
| DbRow
|
|
121
|
-
| undefined;
|
|
122
|
-
return row ? rowToShare(row) : null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function listSharesForFile(
|
|
126
|
-
workspaceId: string,
|
|
127
|
-
filePath: string,
|
|
128
|
-
): SharedDoc[] {
|
|
129
|
-
const db = getDb();
|
|
130
|
-
const rows = db
|
|
131
|
-
.prepare(
|
|
132
|
-
"SELECT * FROM shared_docs WHERE workspace_id = ? AND file_path = ? AND is_revoked = 0 ORDER BY created_at DESC",
|
|
133
|
-
)
|
|
134
|
-
.all(workspaceId, filePath) as DbRow[];
|
|
135
|
-
return rows.map(rowToShare);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function revokeShare(id: string): void {
|
|
139
|
-
const db = getDb();
|
|
140
|
-
db.prepare("UPDATE shared_docs SET is_revoked = 1 WHERE id = ?").run(id);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export function incrementViewCount(token: string): void {
|
|
144
|
-
const db = getDb();
|
|
145
|
-
db.prepare(
|
|
146
|
-
"UPDATE shared_docs SET view_count = view_count + 1 WHERE token = ?",
|
|
147
|
-
).run(token);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export function isExpired(share: SharedDoc): boolean {
|
|
151
|
-
if (!share.expiresAt) return false;
|
|
152
|
-
return new Date(share.expiresAt) < new Date();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function hashPassword(password: string): string {
|
|
156
|
-
const salt = randomBytes(16).toString("hex");
|
|
157
|
-
const hash = scryptSync(password, salt, 64).toString("hex");
|
|
158
|
-
return `${salt}:${hash}`;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export function verifyPassword(password: string, stored: string): boolean {
|
|
162
|
-
const [salt, hash] = stored.split(":");
|
|
163
|
-
const expected = scryptSync(password, salt, 64);
|
|
164
|
-
const actual = Buffer.from(hash, "hex");
|
|
165
|
-
if (expected.length !== actual.length) return false;
|
|
166
|
-
return timingSafeEqual(expected, actual);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/** Reset cached DB handle (used by tests). */
|
|
170
|
-
export function _resetSharedDb(): void {
|
|
171
|
-
try {
|
|
172
|
-
_db?.close();
|
|
173
|
-
} catch {
|
|
174
|
-
/* ignore */
|
|
175
|
-
}
|
|
176
|
-
_db = null;
|
|
177
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ExternalToast, toast } from "sonner";
|
|
2
|
-
|
|
3
|
-
export function showSuccess(message: string, options?: ExternalToast) {
|
|
4
|
-
toast.success(message, options);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function showError(message: string, options?: ExternalToast) {
|
|
8
|
-
toast.error(message, options);
|
|
9
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { stat } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Returns true if the directory has a package.json — treated as a runnable node app.
|
|
6
|
-
* Checked before isAppFolder so package.json wins over index.html.
|
|
7
|
-
*/
|
|
8
|
-
export async function isNodeApp(
|
|
9
|
-
wikiDir: string,
|
|
10
|
-
relPath: string,
|
|
11
|
-
): Promise<boolean> {
|
|
12
|
-
try {
|
|
13
|
-
const pkgJson = path.join(wikiDir, relPath, "package.json");
|
|
14
|
-
const info = await stat(pkgJson);
|
|
15
|
-
return info.isFile();
|
|
16
|
-
} catch {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Returns true if `<wikiDir>/<relPath>/index.html` exists and is a regular file.
|
|
23
|
-
* Used server-side to classify a directory as a self-contained static app folder.
|
|
24
|
-
*/
|
|
25
|
-
export async function isAppFolder(
|
|
26
|
-
wikiDir: string,
|
|
27
|
-
relPath: string,
|
|
28
|
-
): Promise<boolean> {
|
|
29
|
-
try {
|
|
30
|
-
const indexHtml = path.join(wikiDir, relPath, "index.html");
|
|
31
|
-
const info = await stat(indexHtml);
|
|
32
|
-
return info.isFile();
|
|
33
|
-
} catch {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* workspace-client.ts — browser-safe ws injection helpers.
|
|
3
|
-
* No React, no server imports. Safe to use in any "use client" file.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* URL prefixes that are workspace-scoped and need ?ws= injected.
|
|
8
|
-
* Rules:
|
|
9
|
-
* include: /api/wiki, /api/assets/, /api/agent/ (except sub-paths below),
|
|
10
|
-
* /api/upload/, /api/system/reveal
|
|
11
|
-
* exclude: /api/agent/admin, /api/agent/register, /api/agents
|
|
12
|
-
* (those are global registrations, not file-workspace calls)
|
|
13
|
-
*/
|
|
14
|
-
const WS_SCOPED_PREFIXES = [
|
|
15
|
-
"/api/wiki",
|
|
16
|
-
"/api/assets/",
|
|
17
|
-
"/api/upload/",
|
|
18
|
-
"/api/system/reveal",
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
const WS_AGENT_PREFIX = "/api/agent/";
|
|
22
|
-
|
|
23
|
-
const WS_AGENT_EXCLUDED_PREFIXES = [
|
|
24
|
-
"/api/agent/admin",
|
|
25
|
-
"/api/agent/register",
|
|
26
|
-
"/api/agents",
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
export function getActiveWorkspaceId(): string | null {
|
|
30
|
-
if (typeof window === "undefined") return null;
|
|
31
|
-
return new URLSearchParams(window.location.search).get("ws");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** Returns true if this URL is workspace-scoped and needs ?ws= appended. */
|
|
35
|
-
function needsWs(pathname: string): boolean {
|
|
36
|
-
// Excluded patterns first (match on prefix + segment boundary so
|
|
37
|
-
// "/api/agent/adminfoo" is NOT treated as "/api/agent/admin").
|
|
38
|
-
for (const ex of WS_AGENT_EXCLUDED_PREFIXES) {
|
|
39
|
-
if (pathname === ex || pathname.startsWith(ex + "/")) return false;
|
|
40
|
-
}
|
|
41
|
-
if (pathname.startsWith(WS_AGENT_PREFIX)) return true;
|
|
42
|
-
for (const prefix of WS_SCOPED_PREFIXES) {
|
|
43
|
-
if (pathname.startsWith(prefix)) return true;
|
|
44
|
-
}
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Append ?ws=<activeId> to a workspace-scoped URL if:
|
|
50
|
-
* - the URL needs ws injection (needsWs)
|
|
51
|
-
* - an active workspace id exists in the current URL
|
|
52
|
-
* - the URL doesn't already carry a ws= param
|
|
53
|
-
*
|
|
54
|
-
* Handles both plain paths (/api/wiki) and paths with existing query strings
|
|
55
|
-
* (/api/wiki/content?path=foo → /api/wiki/content?path=foo&ws=<id>).
|
|
56
|
-
*/
|
|
57
|
-
export function withWs(url: string): string {
|
|
58
|
-
const wsId = getActiveWorkspaceId();
|
|
59
|
-
if (!wsId) return url;
|
|
60
|
-
|
|
61
|
-
// Split on first '?' to isolate the pathname
|
|
62
|
-
const qIdx = url.indexOf("?");
|
|
63
|
-
const pathname = qIdx === -1 ? url : url.slice(0, qIdx);
|
|
64
|
-
const search = qIdx === -1 ? "" : url.slice(qIdx + 1);
|
|
65
|
-
|
|
66
|
-
if (!needsWs(pathname)) return url;
|
|
67
|
-
|
|
68
|
-
// Don't double-inject
|
|
69
|
-
const params = new URLSearchParams(search);
|
|
70
|
-
if (params.has("ws")) return url;
|
|
71
|
-
|
|
72
|
-
params.set("ws", wsId);
|
|
73
|
-
return `${pathname}?${params.toString()}`;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* drop-in fetch replacement that injects ?ws=<activeId> on workspace-scoped
|
|
78
|
-
* URLs. Non-scoped URLs pass through unchanged.
|
|
79
|
-
*/
|
|
80
|
-
export function wsFetch(input: string, init?: RequestInit): Promise<Response> {
|
|
81
|
-
return fetch(withWs(input), init);
|
|
82
|
-
}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Request-scoped workspace resolution for browser/session routes.
|
|
3
|
-
*
|
|
4
|
-
* Determines which workspace a request targets and enforces access control.
|
|
5
|
-
* Phase B routes call this instead of getRootDir().
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import path from "node:path";
|
|
9
|
-
import { requireUser } from "@/lib/auth/server";
|
|
10
|
-
import { isAdmin } from "@/lib/auth/admin";
|
|
11
|
-
import { getRootDir } from "@/lib/root-dir";
|
|
12
|
-
import {
|
|
13
|
-
getWorkspace,
|
|
14
|
-
listWorkspaces,
|
|
15
|
-
userCanAccess,
|
|
16
|
-
migrateConfigToWorkspaces,
|
|
17
|
-
type Workspace,
|
|
18
|
-
} from "@/lib/workspaces";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Synthetic fallback workspace built from the legacy process-global rootDir
|
|
22
|
-
* (root-dir.ts). Used only when the registry has no workspaces — keeps the
|
|
23
|
-
* ROOT_DIR / CLI / test paths working until Phase E removes the global.
|
|
24
|
-
* Returns null when no global root is set either.
|
|
25
|
-
*/
|
|
26
|
-
function fallbackWorkspace(): Workspace | null {
|
|
27
|
-
const root = getRootDir();
|
|
28
|
-
if (!root) return null;
|
|
29
|
-
return {
|
|
30
|
-
id: "ws_default",
|
|
31
|
-
name: path.basename(root) || "workspace",
|
|
32
|
-
rootDir: root,
|
|
33
|
-
createdAt: new Date(0).toISOString(),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Resolve the target workspace from the request alone (no auth/access check).
|
|
39
|
-
* Selection: ?ws= query → x-workspace header → most-recent lastOpenedAt →
|
|
40
|
-
* synthetic fallback from the global rootDir. Returns null if nothing resolves.
|
|
41
|
-
*/
|
|
42
|
-
async function pickWorkspace(req: Request): Promise<Workspace | null> {
|
|
43
|
-
await migrateConfigToWorkspaces();
|
|
44
|
-
const url = new URL(req.url);
|
|
45
|
-
const wsId = url.searchParams.get("ws") ?? req.headers.get("x-workspace") ?? null;
|
|
46
|
-
if (wsId) {
|
|
47
|
-
return (await getWorkspace(wsId)) ?? null;
|
|
48
|
-
}
|
|
49
|
-
const all = await listWorkspaces();
|
|
50
|
-
if (all.length === 0) return fallbackWorkspace();
|
|
51
|
-
return all
|
|
52
|
-
.slice()
|
|
53
|
-
.sort((a, b) => {
|
|
54
|
-
const ta = a.lastOpenedAt ? new Date(a.lastOpenedAt).getTime() : 0;
|
|
55
|
-
const tb = b.lastOpenedAt ? new Date(b.lastOpenedAt).getTime() : 0;
|
|
56
|
-
if (tb !== ta) return tb - ta;
|
|
57
|
-
return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
58
|
-
})[0];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface WorkspaceContext {
|
|
62
|
-
ok: true;
|
|
63
|
-
ws: Workspace;
|
|
64
|
-
rootDir: string;
|
|
65
|
-
userId: string;
|
|
66
|
-
isAdmin: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface WorkspaceError {
|
|
70
|
-
ok: false;
|
|
71
|
-
status: number;
|
|
72
|
-
code: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Resolves the workspace for a browser/session request.
|
|
77
|
-
*
|
|
78
|
-
* Selection order:
|
|
79
|
-
* 1. `?ws=<id>` query param (preferred).
|
|
80
|
-
* 2. `x-workspace` header.
|
|
81
|
-
* 3. Fall back to the workspace with the most recent lastOpenedAt.
|
|
82
|
-
* If exactly one workspace exists, use it.
|
|
83
|
-
* If zero workspaces -> 400 WORKSPACE_REQUIRED.
|
|
84
|
-
*
|
|
85
|
-
* Pass intent="write" on any route that mutates the filesystem.
|
|
86
|
-
* Returns 403 WORKSPACE_READ_ONLY for write intent on a readOnly workspace.
|
|
87
|
-
*/
|
|
88
|
-
export async function resolveWorkspaceForUser(
|
|
89
|
-
req: Request,
|
|
90
|
-
intent: "read" | "write" = "read",
|
|
91
|
-
): Promise<WorkspaceContext | WorkspaceError> {
|
|
92
|
-
// --no-auth bypass
|
|
93
|
-
if (process.env.WIKI_NO_AUTH === "1") {
|
|
94
|
-
const ws = await pickWorkspace(req);
|
|
95
|
-
if (!ws) {
|
|
96
|
-
return {
|
|
97
|
-
ok: false,
|
|
98
|
-
status: 400,
|
|
99
|
-
code: "WORKSPACE_REQUIRED",
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
if (intent === "write" && ws.readOnly) {
|
|
103
|
-
return { ok: false, status: 403, code: "WORKSPACE_READ_ONLY" };
|
|
104
|
-
}
|
|
105
|
-
return { ok: true, ws, rootDir: ws.rootDir, userId: "local", isAdmin: true };
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Authenticate
|
|
109
|
-
const auth = await requireUser(req);
|
|
110
|
-
if (!auth.ok) return { ok: false, status: 401, code: "UNAUTHORIZED" };
|
|
111
|
-
|
|
112
|
-
const admin = await isAdmin(auth.user.id, auth.user.email);
|
|
113
|
-
const url = new URL(req.url);
|
|
114
|
-
const explicitWsId =
|
|
115
|
-
url.searchParams.get("ws") ?? req.headers.get("x-workspace") ?? null;
|
|
116
|
-
|
|
117
|
-
const ws = await pickWorkspace(req);
|
|
118
|
-
if (!ws) {
|
|
119
|
-
// No workspace and no global root configured yet.
|
|
120
|
-
return {
|
|
121
|
-
ok: false,
|
|
122
|
-
status: explicitWsId ? 404 : 400,
|
|
123
|
-
code: explicitWsId ? "WORKSPACE_NOT_FOUND" : "WORKSPACE_REQUIRED",
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (!userCanAccess(ws, auth.user.id, admin)) {
|
|
128
|
-
return { ok: false, status: 403, code: "WORKSPACE_FORBIDDEN" };
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (intent === "write" && ws.readOnly) {
|
|
132
|
-
return { ok: false, status: 403, code: "WORKSPACE_READ_ONLY" };
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return { ok: true, ws, rootDir: ws.rootDir, userId: auth.user.id, isAdmin: admin };
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export interface AgentWorkspaceContext {
|
|
139
|
-
ok: true;
|
|
140
|
-
ws: Workspace;
|
|
141
|
-
rootDir: string;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Resolve the target workspace for an AUTHENTICATED agent request.
|
|
146
|
-
*
|
|
147
|
-
* Phase B: resolution only (no per-agent workspace grant check - that is added
|
|
148
|
-
* in Phase C, which will verify the agent's scope.workspaceId === ws.id).
|
|
149
|
-
* Selection mirrors the session resolver: ?ws / x-workspace / default / global.
|
|
150
|
-
*
|
|
151
|
-
* Pass intent="write" on any route that mutates the filesystem.
|
|
152
|
-
* Returns 403 WORKSPACE_READ_ONLY for write intent on a readOnly workspace.
|
|
153
|
-
*/
|
|
154
|
-
export async function resolveWorkspaceForAgent(
|
|
155
|
-
req: Request,
|
|
156
|
-
intent: "read" | "write" = "read",
|
|
157
|
-
): Promise<AgentWorkspaceContext | WorkspaceError> {
|
|
158
|
-
const ws = await pickWorkspace(req);
|
|
159
|
-
if (!ws) {
|
|
160
|
-
const url = new URL(req.url);
|
|
161
|
-
const explicit =
|
|
162
|
-
url.searchParams.get("ws") ?? req.headers.get("x-workspace") ?? null;
|
|
163
|
-
return {
|
|
164
|
-
ok: false,
|
|
165
|
-
status: explicit ? 404 : 400,
|
|
166
|
-
code: explicit ? "WORKSPACE_NOT_FOUND" : "WORKSPACE_REQUIRED",
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
if (intent === "write" && ws.readOnly) {
|
|
170
|
-
return { ok: false, status: 403, code: "WORKSPACE_READ_ONLY" };
|
|
171
|
-
}
|
|
172
|
-
return { ok: true, ws, rootDir: ws.rootDir };
|
|
173
|
-
}
|