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,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tier-1 Raw FS — atomic move/rename.
|
|
3
|
-
*
|
|
4
|
-
* POST /api/agent/fs/move
|
|
5
|
-
* Body: { from: string, to: string, ifMatch?: string }
|
|
6
|
-
*
|
|
7
|
-
* Moves sidecar for .md files (R3).
|
|
8
|
-
* Locks source + dest in sorted order to avoid deadlock.
|
|
9
|
-
* Requires source read+mutate, dest mutate.
|
|
10
|
-
*/
|
|
11
|
-
export const runtime = "nodejs";
|
|
12
|
-
|
|
13
|
-
import { rename, stat } from "node:fs/promises";
|
|
14
|
-
import path from "node:path";
|
|
15
|
-
import { NextResponse } from "next/server";
|
|
16
|
-
import { checkAuth, enforceScope } from "@/lib/proof/auth";
|
|
17
|
-
import { resolveWorkspaceForAgent } from "@/lib/workspace-context";
|
|
18
|
-
import { safeWorkspacePath } from "@/lib/workspaces";
|
|
19
|
-
import { withFileMutex } from "@/lib/proof/mutex";
|
|
20
|
-
import { moveSidecar } from "@/lib/proof/sidecar";
|
|
21
|
-
import { writeAuditRow } from "@/lib/proof/audit";
|
|
22
|
-
import { safeAbsPath, sha256ofBuf, extractShaHex, isMarkdown } from "@/lib/proof/raw-fs";
|
|
23
|
-
import { readFile } from "node:fs/promises";
|
|
24
|
-
|
|
25
|
-
function errJson(code: string, message: string, status: number): NextResponse {
|
|
26
|
-
return NextResponse.json({ error: code, message }, { status });
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function POST(req: Request): Promise<NextResponse> {
|
|
30
|
-
const auth = await checkAuth(req);
|
|
31
|
-
if (!auth.ok) return errJson("UNAUTHORIZED", auth.message ?? "Unauthorized", 401);
|
|
32
|
-
|
|
33
|
-
let body: { from?: unknown; to?: unknown; ifMatch?: unknown };
|
|
34
|
-
try {
|
|
35
|
-
body = (await req.json()) as typeof body;
|
|
36
|
-
} catch {
|
|
37
|
-
return errJson("INVALID_PAYLOAD", "Invalid JSON body", 400);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (typeof body.from !== "string" || !body.from) {
|
|
41
|
-
return errJson("INVALID_PAYLOAD", "from (string) required", 400);
|
|
42
|
-
}
|
|
43
|
-
if (typeof body.to !== "string" || !body.to) {
|
|
44
|
-
return errJson("INVALID_PAYLOAD", "to (string) required", 400);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const fromRel = body.from;
|
|
48
|
-
const toRel = body.to;
|
|
49
|
-
const ifMatch = typeof body.ifMatch === "string" ? body.ifMatch : undefined;
|
|
50
|
-
|
|
51
|
-
const wsx = await resolveWorkspaceForAgent(req, "write");
|
|
52
|
-
if (!wsx.ok) return errJson(wsx.code, wsx.code, wsx.status);
|
|
53
|
-
const { ws, rootDir } = wsx;
|
|
54
|
-
|
|
55
|
-
// Basic traversal
|
|
56
|
-
if (!safeWorkspacePath(rootDir, fromRel)) return errJson("INVALID_PATH", "from: path traversal rejected", 400);
|
|
57
|
-
if (!safeWorkspacePath(rootDir, toRel)) return errJson("INVALID_PATH", "to: path traversal rejected", 400);
|
|
58
|
-
|
|
59
|
-
const fromAbs = await safeAbsPath(rootDir, fromRel);
|
|
60
|
-
if (!fromAbs) return errJson("INVALID_PATH", "from: path rejected (symlink escape or denied)", 400);
|
|
61
|
-
const toAbs = await safeAbsPath(rootDir, toRel);
|
|
62
|
-
if (!toAbs) return errJson("INVALID_PATH", "to: path rejected (symlink escape or denied)", 400);
|
|
63
|
-
|
|
64
|
-
// Self-move guard
|
|
65
|
-
if (fromAbs === toAbs) return errJson("INVALID_PATH", "from and to are the same path", 400);
|
|
66
|
-
if (toAbs.startsWith(fromAbs + path.sep)) {
|
|
67
|
-
return errJson("INVALID_PATH", "Cannot move a directory into itself", 400);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Scope: source requires read+mutate; dest requires mutate
|
|
71
|
-
const sc1 = enforceScope(auth.agent, { filePath: fromRel, op: "read", workspaceId: ws.id });
|
|
72
|
-
if (!sc1.ok) return errJson(sc1.code, sc1.message, 403);
|
|
73
|
-
const sc2 = enforceScope(auth.agent, { filePath: fromRel, op: "mutate", workspaceId: ws.id });
|
|
74
|
-
if (!sc2.ok) return errJson(sc2.code, sc2.message, 403);
|
|
75
|
-
const sc3 = enforceScope(auth.agent, { filePath: toRel, op: "mutate", workspaceId: ws.id });
|
|
76
|
-
if (!sc3.ok) return errJson(sc3.code, sc3.message, 403);
|
|
77
|
-
|
|
78
|
-
// Verify source exists
|
|
79
|
-
try {
|
|
80
|
-
await stat(fromAbs);
|
|
81
|
-
} catch (e) {
|
|
82
|
-
if ((e as NodeJS.ErrnoException).code === "ENOENT") {
|
|
83
|
-
return errJson("NOT_FOUND", "Source file not found", 404);
|
|
84
|
-
}
|
|
85
|
-
throw e;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// If-Match guard (R4)
|
|
89
|
-
let existingSha: string | undefined;
|
|
90
|
-
if (ifMatch) {
|
|
91
|
-
let buf: Buffer;
|
|
92
|
-
try {
|
|
93
|
-
buf = await readFile(fromAbs);
|
|
94
|
-
} catch {
|
|
95
|
-
return errJson("NOT_FOUND", "Source file not found", 404);
|
|
96
|
-
}
|
|
97
|
-
existingSha = sha256ofBuf(buf);
|
|
98
|
-
if (extractShaHex(ifMatch) !== extractShaHex(existingSha)) {
|
|
99
|
-
return errJson("PRECONDITION_FAILED", "If-Match sha256 mismatch", 412);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const isMd = isMarkdown(fromRel);
|
|
104
|
-
|
|
105
|
-
// Lock source + dest in sorted order to avoid deadlock
|
|
106
|
-
const [first, second] = [fromRel, toRel].sort();
|
|
107
|
-
|
|
108
|
-
const doMove = async () => {
|
|
109
|
-
await rename(fromAbs, toAbs);
|
|
110
|
-
if (isMd) {
|
|
111
|
-
await moveSidecar(rootDir, fromRel, toRel);
|
|
112
|
-
}
|
|
113
|
-
writeAuditRow({
|
|
114
|
-
agentId: auth.agent.id,
|
|
115
|
-
op: "move",
|
|
116
|
-
path: fromRel,
|
|
117
|
-
newSha: toRel, // store destination in newSha field for audit trail
|
|
118
|
-
forced: false,
|
|
119
|
-
workspaceId: ws.id,
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
if (first === fromRel) {
|
|
124
|
-
await withFileMutex(`${rootDir}\u0000${first}`, () => withFileMutex(`${rootDir}\u0000${second}`, doMove));
|
|
125
|
-
} else {
|
|
126
|
-
await withFileMutex(`${rootDir}\u0000${first}`, () => withFileMutex(`${rootDir}\u0000${second}`, doMove));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return NextResponse.json({ from: fromRel, to: toRel });
|
|
130
|
-
}
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tier-1 Raw FS — server-side search.
|
|
3
|
-
*
|
|
4
|
-
* POST /api/agent/fs/search
|
|
5
|
-
* Body: {
|
|
6
|
-
* kind: "grep" | "glob",
|
|
7
|
-
* query: string, // grep: regex string; glob: glob pattern
|
|
8
|
-
* path?: string, // root-relative start path (default: root)
|
|
9
|
-
* limit?: number, // max matches (default 200, hard cap 2000)
|
|
10
|
-
* }
|
|
11
|
-
*
|
|
12
|
-
* Returns { kind, query, matches: [{path, line?, col?, text?}], truncated }.
|
|
13
|
-
*
|
|
14
|
-
* - Pure JS (no shell interpolation, no rg dependency)
|
|
15
|
-
* - Skips binary files (null-byte heuristic) for grep
|
|
16
|
-
* - Skips .proof/ and .git/
|
|
17
|
-
* - Re-checks scope on every matched path
|
|
18
|
-
*/
|
|
19
|
-
export const runtime = "nodejs";
|
|
20
|
-
|
|
21
|
-
import { readdir, readFile, stat } from "node:fs/promises";
|
|
22
|
-
import { ensureIndexer, ftsSearch } from "@/lib/search/indexer";
|
|
23
|
-
import path from "node:path";
|
|
24
|
-
import { NextResponse } from "next/server";
|
|
25
|
-
import { checkAuth, enforceScope } from "@/lib/proof/auth";
|
|
26
|
-
import { resolveWorkspaceForAgent } from "@/lib/workspace-context";
|
|
27
|
-
import { safeWorkspacePath } from "@/lib/workspaces";
|
|
28
|
-
import { safeAbsPath, looksLikeBinary } from "@/lib/proof/raw-fs";
|
|
29
|
-
import { matchGlob } from "@/lib/proof/glob";
|
|
30
|
-
import type { Agent } from "@/lib/proof/registry";
|
|
31
|
-
|
|
32
|
-
const HARD_MAX_MATCHES = 2_000;
|
|
33
|
-
const HARD_MAX_SCAN_BYTES = 50 * 1024 * 1024; // 50 MB total
|
|
34
|
-
const SEARCH_TIMEOUT_MS = 10_000;
|
|
35
|
-
|
|
36
|
-
export interface SearchMatch {
|
|
37
|
-
path: string;
|
|
38
|
-
line?: number;
|
|
39
|
-
col?: number;
|
|
40
|
-
text?: string;
|
|
41
|
-
score?: number;
|
|
42
|
-
snippet?: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function errJson(code: string, message: string, status: number): NextResponse {
|
|
46
|
-
return NextResponse.json({ error: code, message }, { status });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const SKIP_DIRS = new Set([".proof", ".git", "node_modules", ".next"]);
|
|
50
|
-
|
|
51
|
-
// ── Walk helpers ──────────────────────────────────────────────────────────────
|
|
52
|
-
|
|
53
|
-
async function* walkFiles(rootDir: string, relDir: string): AsyncGenerator<string> {
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
|
-
let items: any[];
|
|
56
|
-
try {
|
|
57
|
-
items = await readdir(path.join(rootDir, relDir), { withFileTypes: true }) as any[];
|
|
58
|
-
} catch {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
for (const item of items) {
|
|
62
|
-
if (SKIP_DIRS.has(item.name as string)) continue;
|
|
63
|
-
const childRel = relDir ? `${relDir}/${item.name as string}` : item.name as string;
|
|
64
|
-
if (item.isDirectory()) {
|
|
65
|
-
yield* walkFiles(rootDir, childRel);
|
|
66
|
-
} else if (item.isFile() || item.isSymbolicLink()) {
|
|
67
|
-
yield childRel;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ── Grep ─────────────────────────────────────────────────────────────────────
|
|
73
|
-
|
|
74
|
-
async function grepSearch(
|
|
75
|
-
rootDir: string,
|
|
76
|
-
startRel: string,
|
|
77
|
-
pattern: string,
|
|
78
|
-
limit: number,
|
|
79
|
-
agent: Agent,
|
|
80
|
-
deadline: number,
|
|
81
|
-
workspaceId?: string,
|
|
82
|
-
): Promise<{ matches: SearchMatch[]; truncated: boolean }> {
|
|
83
|
-
let regex: RegExp;
|
|
84
|
-
try {
|
|
85
|
-
regex = new RegExp(pattern, "d");
|
|
86
|
-
} catch {
|
|
87
|
-
// fallback without indices flag
|
|
88
|
-
try {
|
|
89
|
-
regex = new RegExp(pattern);
|
|
90
|
-
} catch {
|
|
91
|
-
throw new Error("Invalid regex pattern");
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const matches: SearchMatch[] = [];
|
|
96
|
-
let scannedBytes = 0;
|
|
97
|
-
|
|
98
|
-
for await (const fileRel of walkFiles(rootDir, startRel)) {
|
|
99
|
-
if (matches.length >= limit) return { matches, truncated: true };
|
|
100
|
-
if (Date.now() > deadline) return { matches, truncated: true };
|
|
101
|
-
|
|
102
|
-
const sc = enforceScope(agent, { filePath: fileRel, op: "read", workspaceId });
|
|
103
|
-
if (!sc.ok) continue;
|
|
104
|
-
|
|
105
|
-
let buf: Buffer;
|
|
106
|
-
try {
|
|
107
|
-
buf = await readFile(path.join(rootDir, fileRel));
|
|
108
|
-
} catch {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
scannedBytes += buf.length;
|
|
113
|
-
if (scannedBytes > HARD_MAX_SCAN_BYTES) return { matches, truncated: true };
|
|
114
|
-
|
|
115
|
-
if (looksLikeBinary(buf)) continue;
|
|
116
|
-
|
|
117
|
-
const text = buf.toString("utf-8");
|
|
118
|
-
const lines = text.split("\n");
|
|
119
|
-
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
|
120
|
-
if (matches.length >= limit) return { matches, truncated: true };
|
|
121
|
-
const lineText = lines[lineIdx]!;
|
|
122
|
-
// Reset lastIndex for global regexes
|
|
123
|
-
regex.lastIndex = 0;
|
|
124
|
-
const m = regex.exec(lineText);
|
|
125
|
-
if (m) {
|
|
126
|
-
matches.push({
|
|
127
|
-
path: fileRel,
|
|
128
|
-
line: lineIdx + 1,
|
|
129
|
-
col: (m.index ?? 0) + 1,
|
|
130
|
-
text: lineText,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return { matches, truncated: false };
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// ── Glob ─────────────────────────────────────────────────────────────────────
|
|
140
|
-
|
|
141
|
-
async function globSearch(
|
|
142
|
-
rootDir: string,
|
|
143
|
-
startRel: string,
|
|
144
|
-
pattern: string,
|
|
145
|
-
limit: number,
|
|
146
|
-
agent: Agent,
|
|
147
|
-
deadline: number,
|
|
148
|
-
workspaceId?: string,
|
|
149
|
-
): Promise<{ matches: SearchMatch[]; truncated: boolean }> {
|
|
150
|
-
const matches: SearchMatch[] = [];
|
|
151
|
-
|
|
152
|
-
for await (const fileRel of walkFiles(rootDir, startRel)) {
|
|
153
|
-
if (matches.length >= limit) return { matches, truncated: true };
|
|
154
|
-
if (Date.now() > deadline) return { matches, truncated: true };
|
|
155
|
-
|
|
156
|
-
// Match pattern against relative path OR just the filename
|
|
157
|
-
const baseName = path.basename(fileRel);
|
|
158
|
-
if (!matchGlob(pattern, fileRel) && !matchGlob(pattern, baseName)) continue;
|
|
159
|
-
|
|
160
|
-
const sc = enforceScope(agent, { filePath: fileRel, op: "read", workspaceId });
|
|
161
|
-
if (!sc.ok) continue;
|
|
162
|
-
|
|
163
|
-
matches.push({ path: fileRel });
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return { matches, truncated: false };
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// ── Route ─────────────────────────────────────────────────────────────────────
|
|
170
|
-
|
|
171
|
-
export async function POST(req: Request): Promise<NextResponse> {
|
|
172
|
-
const auth = await checkAuth(req);
|
|
173
|
-
if (!auth.ok) return errJson("UNAUTHORIZED", auth.message ?? "Unauthorized", 401);
|
|
174
|
-
|
|
175
|
-
let body: { kind?: unknown; query?: unknown; path?: unknown; limit?: unknown };
|
|
176
|
-
try {
|
|
177
|
-
body = (await req.json()) as typeof body;
|
|
178
|
-
} catch {
|
|
179
|
-
return errJson("INVALID_PAYLOAD", "Invalid JSON body", 400);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (body.kind !== "grep" && body.kind !== "glob" && body.kind !== "fts") {
|
|
183
|
-
return errJson("INVALID_PAYLOAD", 'kind must be "grep", "glob", or "fts"', 400);
|
|
184
|
-
}
|
|
185
|
-
if (typeof body.query !== "string") {
|
|
186
|
-
return errJson("INVALID_PAYLOAD", "query (string) required", 400);
|
|
187
|
-
}
|
|
188
|
-
if (body.kind !== "fts" && !body.query) {
|
|
189
|
-
return errJson("INVALID_PAYLOAD", "query (string) required", 400);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const kind = body.kind as "grep" | "glob" | "fts";
|
|
193
|
-
const query = body.query as string;
|
|
194
|
-
const startRelRaw = typeof body.path === "string" ? body.path : "";
|
|
195
|
-
const limit = Math.min(
|
|
196
|
-
typeof body.limit === "number" ? body.limit : 200,
|
|
197
|
-
HARD_MAX_MATCHES,
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
const wsx = await resolveWorkspaceForAgent(req);
|
|
201
|
-
if (!wsx.ok) return errJson(wsx.code, wsx.code, wsx.status);
|
|
202
|
-
const { ws, rootDir } = wsx;
|
|
203
|
-
|
|
204
|
-
// Validate start path
|
|
205
|
-
if (startRelRaw) {
|
|
206
|
-
if (!safeWorkspacePath(rootDir, startRelRaw)) {
|
|
207
|
-
return errJson("INVALID_PATH", "path: traversal rejected", 400);
|
|
208
|
-
}
|
|
209
|
-
const safe = await safeAbsPath(rootDir, startRelRaw);
|
|
210
|
-
if (!safe) return errJson("INVALID_PATH", "path: rejected (symlink escape or denied)", 400);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Verify start path is a directory
|
|
214
|
-
if (startRelRaw) {
|
|
215
|
-
try {
|
|
216
|
-
const st = await stat(path.join(rootDir, startRelRaw));
|
|
217
|
-
if (!st.isDirectory()) {
|
|
218
|
-
return errJson("NOT_A_DIRECTORY", "path must be a directory", 400);
|
|
219
|
-
}
|
|
220
|
-
} catch (e) {
|
|
221
|
-
if ((e as NodeJS.ErrnoException).code === "ENOENT") {
|
|
222
|
-
return errJson("NOT_FOUND", "Start path not found", 404);
|
|
223
|
-
}
|
|
224
|
-
throw e;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// FTS branch -- handled before the grep/glob path validation below.
|
|
229
|
-
if (kind === "fts") {
|
|
230
|
-
const sc = enforceScope(auth.agent, { op: "read", workspaceId: ws.id });
|
|
231
|
-
if (!sc.ok) return errJson("FORBIDDEN", sc.message ?? "Forbidden", 403);
|
|
232
|
-
|
|
233
|
-
ensureIndexer(ws.id, rootDir).catch((e) =>
|
|
234
|
-
console.error("[search] ensureIndexer failed", e),
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
// Over-fetch so the post-filter (path scope + start-path restriction) can
|
|
238
|
-
// still return up to `limit` results when some top-ranked hits are denied.
|
|
239
|
-
const startPrefix = startRelRaw ? `${startRelRaw.replace(/\/+$/, "")}/` : "";
|
|
240
|
-
const fts = ftsSearch(ws.id, query, Math.min(limit * 4, HARD_MAX_MATCHES));
|
|
241
|
-
const filtered = fts.matches.filter((m) => {
|
|
242
|
-
if (startPrefix && !m.path.startsWith(startPrefix)) return false;
|
|
243
|
-
return enforceScope(auth.agent, { filePath: m.path, op: "read", workspaceId: ws.id }).ok;
|
|
244
|
-
});
|
|
245
|
-
const matches = filtered
|
|
246
|
-
.slice(0, limit)
|
|
247
|
-
.map((m) => ({ path: m.path, score: m.score, snippet: m.snippet }));
|
|
248
|
-
// truncated if the DB itself capped, or the scoped set still exceeds limit.
|
|
249
|
-
const truncated = fts.truncated || filtered.length > limit;
|
|
250
|
-
return NextResponse.json({ kind, query, matches, truncated });
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const deadline = Date.now() + SEARCH_TIMEOUT_MS;
|
|
254
|
-
let result: { matches: SearchMatch[]; truncated: boolean };
|
|
255
|
-
|
|
256
|
-
try {
|
|
257
|
-
if (kind === "grep") {
|
|
258
|
-
result = await grepSearch(rootDir, startRelRaw, query, limit, auth.agent, deadline, ws.id);
|
|
259
|
-
} else {
|
|
260
|
-
result = await globSearch(rootDir, startRelRaw, query, limit, auth.agent, deadline, ws.id);
|
|
261
|
-
}
|
|
262
|
-
} catch (e) {
|
|
263
|
-
return errJson("SEARCH_ERROR", (e as Error).message, 400);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
return NextResponse.json({
|
|
267
|
-
kind,
|
|
268
|
-
query,
|
|
269
|
-
matches: result.matches,
|
|
270
|
-
truncated: result.truncated,
|
|
271
|
-
});
|
|
272
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal span accept/revert. Callable by owner (browser cookie) or any agent
|
|
3
|
-
* with mutate scope. The `by` field on emitted events is the authenticated agent id.
|
|
4
|
-
*/
|
|
5
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
6
|
-
import { NextResponse } from "next/server";
|
|
7
|
-
import { revertProofSpan } from "@/lib/proof/proof-span";
|
|
8
|
-
import { readSidecar, writeSidecar, emptySidecar } from "@/lib/proof/sidecar";
|
|
9
|
-
import { withFileMutex } from "@/lib/proof/mutex";
|
|
10
|
-
import { emitEvents } from "@/lib/proof/event-bus";
|
|
11
|
-
import { resolveWorkspaceForAgent } from "@/lib/workspace-context";
|
|
12
|
-
import { safeWorkspacePath } from "@/lib/workspaces";
|
|
13
|
-
import { checkAuth, enforceScope } from "@/lib/proof/auth";
|
|
14
|
-
|
|
15
|
-
export const runtime = "nodejs";
|
|
16
|
-
|
|
17
|
-
function isMarkdown(p: string): boolean {
|
|
18
|
-
return p.endsWith(".md") || p.endsWith(".markdown");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Remove the wrapper for a specific spanId while keeping inner content.
|
|
23
|
-
*/
|
|
24
|
-
function acceptSpanById(markdown: string, spanId: string): string {
|
|
25
|
-
const escapedId = spanId.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26
|
-
const re = new RegExp(
|
|
27
|
-
`<proof-span\\b[^>]*\\bid="${escapedId}"[^>]*>([\\s\\S]*?)<\\/proof-span>`,
|
|
28
|
-
"g",
|
|
29
|
-
);
|
|
30
|
-
return markdown.replace(re, "$1");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function POST(req: Request): Promise<NextResponse> {
|
|
34
|
-
const authResult = await checkAuth(req);
|
|
35
|
-
if (!authResult.ok) {
|
|
36
|
-
return NextResponse.json({ error: "UNAUTHORIZED" }, { status: 401 });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let body: { path?: unknown; spanId?: unknown; action?: unknown };
|
|
40
|
-
try {
|
|
41
|
-
body = (await req.json()) as { path?: unknown; spanId?: unknown; action?: unknown };
|
|
42
|
-
} catch {
|
|
43
|
-
return NextResponse.json({ error: "INVALID_PAYLOAD", message: "Invalid JSON" }, { status: 400 });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (typeof body.path !== "string" || !body.path) {
|
|
47
|
-
return NextResponse.json({ error: "INVALID_PAYLOAD", message: "path (string) required" }, { status: 400 });
|
|
48
|
-
}
|
|
49
|
-
if (typeof body.spanId !== "string" || !body.spanId) {
|
|
50
|
-
return NextResponse.json({ error: "INVALID_PAYLOAD", message: "spanId (string) required" }, { status: 400 });
|
|
51
|
-
}
|
|
52
|
-
if (body.action !== "accept" && body.action !== "revert") {
|
|
53
|
-
return NextResponse.json({ error: "INVALID_PAYLOAD", message: "action must be 'accept' or 'revert'" }, { status: 400 });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const rel = body.path as string;
|
|
57
|
-
const spanId = body.spanId as string;
|
|
58
|
-
const action = body.action as "accept" | "revert";
|
|
59
|
-
|
|
60
|
-
if (rel.startsWith(".proof")) {
|
|
61
|
-
return NextResponse.json({ error: "INVALID_PATH", message: "Path must not be under .proof" }, { status: 400 });
|
|
62
|
-
}
|
|
63
|
-
if (!isMarkdown(rel)) {
|
|
64
|
-
return NextResponse.json({ error: "INVALID_PATH", message: "Path must be .md or .markdown" }, { status: 400 });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const wsx = await resolveWorkspaceForAgent(req, "write");
|
|
68
|
-
if (!wsx.ok) return NextResponse.json({ error: wsx.code }, { status: wsx.status });
|
|
69
|
-
const { ws, rootDir } = wsx;
|
|
70
|
-
|
|
71
|
-
const absPath = safeWorkspacePath(rootDir, rel);
|
|
72
|
-
if (!absPath) {
|
|
73
|
-
return NextResponse.json({ error: "INVALID_PATH", message: "Path traversal rejected" }, { status: 400 });
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const scopeCheck = enforceScope(authResult.agent, { filePath: rel, op: "mutate", workspaceId: ws.id });
|
|
77
|
-
if (!scopeCheck.ok) {
|
|
78
|
-
return NextResponse.json({ error: scopeCheck.code, message: scopeCheck.message }, { status: 403 });
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const actorId = authResult.agent.id;
|
|
82
|
-
|
|
83
|
-
let notFound = false;
|
|
84
|
-
try {
|
|
85
|
-
await withFileMutex(`${rootDir}\u0000${rel}`, async () => {
|
|
86
|
-
let content: string;
|
|
87
|
-
try {
|
|
88
|
-
content = await readFile(absPath, "utf-8");
|
|
89
|
-
} catch (err) {
|
|
90
|
-
if ((err as NodeJS.ErrnoException).code === "ENOENT") {
|
|
91
|
-
notFound = true;
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
throw err;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const newContent = action === "accept"
|
|
98
|
-
? acceptSpanById(content, spanId)
|
|
99
|
-
: revertProofSpan(content, spanId);
|
|
100
|
-
|
|
101
|
-
await writeFile(absPath, newContent, "utf-8");
|
|
102
|
-
|
|
103
|
-
const sidecar = (await readSidecar(rootDir, rel)) ?? emptySidecar(rel);
|
|
104
|
-
emitEvents(sidecar, [{
|
|
105
|
-
type: action === "accept" ? "span.accepted" : "span.reverted",
|
|
106
|
-
at: new Date().toISOString(),
|
|
107
|
-
by: actorId === "owner" ? "human" : actorId,
|
|
108
|
-
spanId,
|
|
109
|
-
}]);
|
|
110
|
-
await writeSidecar(rootDir, rel, sidecar);
|
|
111
|
-
});
|
|
112
|
-
} catch (err) {
|
|
113
|
-
return NextResponse.json({ error: "INTERNAL_ERROR", message: String(err) }, { status: 500 });
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (notFound) {
|
|
117
|
-
return NextResponse.json({ error: "NOT_FOUND", message: "File not found" }, { status: 404 });
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return NextResponse.json({ ok: true });
|
|
121
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /api/agent/register/:regId
|
|
3
|
-
*
|
|
4
|
-
* Poll registration status. No auth required — regId acts as secret.
|
|
5
|
-
*
|
|
6
|
-
* Responses:
|
|
7
|
-
* 202 { status: "pending" }
|
|
8
|
-
* 200 { status: "approved", agentId, token } — one-shot pickup, deletes token
|
|
9
|
-
* 410 { status: "consumed" | "denied" }
|
|
10
|
-
* 404 { status: "not_found" }
|
|
11
|
-
*/
|
|
12
|
-
import { NextResponse } from "next/server";
|
|
13
|
-
import { getRegistration, consumeRegistration } from "@/lib/proof/pending";
|
|
14
|
-
|
|
15
|
-
export const runtime = "nodejs";
|
|
16
|
-
|
|
17
|
-
export async function GET(
|
|
18
|
-
_req: Request,
|
|
19
|
-
{ params }: { params: Promise<{ regId: string }> },
|
|
20
|
-
): Promise<NextResponse> {
|
|
21
|
-
const { regId } = await params;
|
|
22
|
-
const reg = getRegistration(regId);
|
|
23
|
-
|
|
24
|
-
if (!reg) {
|
|
25
|
-
return NextResponse.json({ status: "not_found" }, { status: 404 });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
switch (reg.status) {
|
|
29
|
-
case "pending":
|
|
30
|
-
return NextResponse.json({ status: "pending" }, { status: 202 });
|
|
31
|
-
|
|
32
|
-
case "approved": {
|
|
33
|
-
const token = consumeRegistration(regId);
|
|
34
|
-
if (!token) {
|
|
35
|
-
// Already consumed between the get and consume (race) — treat as consumed
|
|
36
|
-
return NextResponse.json({ status: "consumed" }, { status: 410 });
|
|
37
|
-
}
|
|
38
|
-
return NextResponse.json(
|
|
39
|
-
{ status: "approved", agentId: reg.agentId, token },
|
|
40
|
-
{ status: 200 },
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
case "consumed":
|
|
45
|
-
return NextResponse.json({ status: "consumed" }, { status: 410 });
|
|
46
|
-
|
|
47
|
-
case "denied":
|
|
48
|
-
return NextResponse.json({ status: "denied" }, { status: 410 });
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /api/agent/register
|
|
3
|
-
*
|
|
4
|
-
* Anonymous registration request. No auth required.
|
|
5
|
-
* The registrationId returned acts as the agent's secret for polling.
|
|
6
|
-
*/
|
|
7
|
-
import { NextResponse } from "next/server";
|
|
8
|
-
import { createRegistration } from "@/lib/proof/pending";
|
|
9
|
-
import type { AgentScope } from "@/lib/proof/registry";
|
|
10
|
-
import { checkRegisterRateLimit } from "@/lib/proof/register-rate-limit";
|
|
11
|
-
|
|
12
|
-
export const runtime = "nodejs";
|
|
13
|
-
|
|
14
|
-
const AGENT_ID_RE = /^ai:[a-z][a-z0-9-]{0,30}$/i;
|
|
15
|
-
const VALID_OPS = new Set(["read", "mutate", "delete"]);
|
|
16
|
-
|
|
17
|
-
function validateScope(s: Record<string, unknown>): AgentScope | { error: string } {
|
|
18
|
-
if (!Array.isArray(s.paths) || s.paths.length === 0 || s.paths.length > 20) {
|
|
19
|
-
return { error: "scope.paths must be an array of 1\u201320 glob pattern strings" };
|
|
20
|
-
}
|
|
21
|
-
for (const p of s.paths) {
|
|
22
|
-
if (typeof p !== "string" || p.length < 1 || p.length > 200) {
|
|
23
|
-
return { error: "Each scope.paths entry must be a string of 1\u2013200 characters" };
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (!Array.isArray(s.ops) || s.ops.length === 0) {
|
|
27
|
-
return { error: "scope.ops must be a non-empty array" };
|
|
28
|
-
}
|
|
29
|
-
for (const op of s.ops) {
|
|
30
|
-
if (!VALID_OPS.has(op as string)) {
|
|
31
|
-
return { error: `scope.ops values must be "read", "mutate", or "delete"` };
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// Optional workspaceId: if present must be a non-empty string ≤ 64 chars.
|
|
35
|
-
let workspaceId: string | undefined;
|
|
36
|
-
if (s.workspaceId !== undefined) {
|
|
37
|
-
if (typeof s.workspaceId !== "string" || s.workspaceId.length < 1 || s.workspaceId.length > 64) {
|
|
38
|
-
return { error: "scope.workspaceId must be a string of 1\u201364 characters" };
|
|
39
|
-
}
|
|
40
|
-
workspaceId = s.workspaceId;
|
|
41
|
-
}
|
|
42
|
-
return { paths: s.paths as string[], ops: s.ops as Array<"read" | "mutate" | "delete">, ...(workspaceId !== undefined ? { workspaceId } : {}) };
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Exported for reuse in approve route. */
|
|
46
|
-
export { validateScope };
|
|
47
|
-
|
|
48
|
-
export async function POST(req: Request): Promise<NextResponse> {
|
|
49
|
-
// Rate limit by remote IP (best-effort; fall back to global key)
|
|
50
|
-
const ip =
|
|
51
|
-
(req.headers.get("x-forwarded-for") ?? "").split(",")[0]?.trim() ||
|
|
52
|
-
"__global__";
|
|
53
|
-
if (!checkRegisterRateLimit(ip)) {
|
|
54
|
-
return NextResponse.json(
|
|
55
|
-
{ error: "RATE_LIMITED", message: "Too many registration attempts" },
|
|
56
|
-
{ status: 429 },
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
let body: { id?: unknown; displayName?: unknown; scope?: unknown };
|
|
61
|
-
try {
|
|
62
|
-
body = (await req.json()) as { id?: unknown; displayName?: unknown; scope?: unknown };
|
|
63
|
-
} catch {
|
|
64
|
-
return NextResponse.json({ error: "INVALID_PAYLOAD", message: "Invalid JSON" }, { status: 400 });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (typeof body.id !== "string" || !AGENT_ID_RE.test(body.id)) {
|
|
68
|
-
return NextResponse.json(
|
|
69
|
-
{
|
|
70
|
-
error: "INVALID_PAYLOAD",
|
|
71
|
-
message: "id must match /^ai:[a-z][a-z0-9-]{0,30}$/i (e.g. ai:claude)",
|
|
72
|
-
},
|
|
73
|
-
{ status: 400 },
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// displayName: required, 1–80 chars
|
|
78
|
-
if (
|
|
79
|
-
typeof body.displayName !== "string" ||
|
|
80
|
-
body.displayName.trim().length < 1 ||
|
|
81
|
-
body.displayName.trim().length > 80
|
|
82
|
-
) {
|
|
83
|
-
return NextResponse.json(
|
|
84
|
-
{ error: "INVALID_PAYLOAD", message: "displayName must be a string of 1\u201380 characters" },
|
|
85
|
-
{ status: 400 },
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
const displayName = body.displayName.trim();
|
|
89
|
-
|
|
90
|
-
// scope: required, must pass validation
|
|
91
|
-
if (
|
|
92
|
-
body.scope === undefined ||
|
|
93
|
-
body.scope === null ||
|
|
94
|
-
typeof body.scope !== "object" ||
|
|
95
|
-
Array.isArray(body.scope)
|
|
96
|
-
) {
|
|
97
|
-
return NextResponse.json(
|
|
98
|
-
{ error: "INVALID_PAYLOAD", message: "scope is required" },
|
|
99
|
-
{ status: 400 },
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
const scopeResult = validateScope(body.scope as Record<string, unknown>);
|
|
103
|
-
if ("error" in scopeResult) {
|
|
104
|
-
return NextResponse.json({ error: "INVALID_PAYLOAD", message: scopeResult.error }, { status: 400 });
|
|
105
|
-
}
|
|
106
|
-
const requestedScope: AgentScope = scopeResult;
|
|
107
|
-
|
|
108
|
-
const reg = createRegistration({ agentId: body.id, displayName, requestedScope });
|
|
109
|
-
|
|
110
|
-
return NextResponse.json(
|
|
111
|
-
{
|
|
112
|
-
registrationId: reg.registrationId,
|
|
113
|
-
pollUrl: `/api/agent/register/${reg.registrationId}`,
|
|
114
|
-
status: "pending",
|
|
115
|
-
},
|
|
116
|
-
{ status: 202 },
|
|
117
|
-
);
|
|
118
|
-
}
|