wiki-viewer 1.14.1 → 1.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  4. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  11. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/index.html +1 -1
  61. package/.next/standalone/.next/server/app/index.rsc +1 -1
  62. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  63. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  64. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  65. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  66. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  67. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  68. package/.next/standalone/.next/server/middleware-manifest.json +1 -1
  69. package/.next/standalone/.next/server/pages/404.html +1 -1
  70. package/.next/standalone/.next/server/pages/500.html +1 -1
  71. package/.next/standalone/package.json +1 -1
  72. package/bin/postbuild.js +21 -0
  73. package/package.json +1 -1
  74. package/.next/standalone/.github/workflows/publish.yml +0 -37
  75. package/.next/standalone/.handoffs/archive/handoff-20260612-113332.md +0 -98
  76. package/.next/standalone/.handoffs/archive/handoff-20260612-141032.md +0 -73
  77. package/.next/standalone/.pi/ownership.json +0 -3
  78. package/.next/standalone/AGENTS.md +0 -114
  79. package/.next/standalone/DESIGN.md +0 -521
  80. package/.next/standalone/README.md +0 -821
  81. package/.next/standalone/TODO.md +0 -20
  82. package/.next/standalone/agents/bootstrap-prompt.md +0 -14
  83. package/.next/standalone/agents/wiki-viewer-skill/SKILL.md +0 -456
  84. package/.next/standalone/bin/postbuild.js +0 -78
  85. package/.next/standalone/bin/wiki-viewer.js +0 -922
  86. package/.next/standalone/certificates/localhost-key.pem +0 -28
  87. package/.next/standalone/certificates/localhost.pem +0 -24
  88. package/.next/standalone/docs/agent-collab-plan.md +0 -1615
  89. package/.next/standalone/docs/agent-collab-v2-plan.md +0 -771
  90. package/.next/standalone/docs/agent-fs-plan.md +0 -232
  91. package/.next/standalone/docs/editorial-skin-spec.md +0 -242
  92. package/.next/standalone/docs/file-vs-collab-authority.md +0 -124
  93. package/.next/standalone/docs/mobile-readiness-spec.md +0 -229
  94. package/.next/standalone/docs/workspacing-plan.md +0 -364
  95. package/.next/standalone/packages/wiki-viewer-mcp/README.md +0 -195
  96. package/.next/standalone/packages/wiki-viewer-mcp/bench-e2e.mjs +0 -166
  97. package/.next/standalone/packages/wiki-viewer-mcp/bench-latency.mjs +0 -87
  98. package/.next/standalone/packages/wiki-viewer-mcp/bench-payload.mjs +0 -45
  99. package/.next/standalone/packages/wiki-viewer-mcp/dist/http-client.js +0 -331
  100. package/.next/standalone/packages/wiki-viewer-mcp/dist/index.js +0 -531
  101. package/.next/standalone/packages/wiki-viewer-mcp/dist/register.js +0 -94
  102. package/.next/standalone/packages/wiki-viewer-mcp/dist/state-cache.js +0 -28
  103. package/.next/standalone/packages/wiki-viewer-mcp/package-lock.json +0 -1716
  104. package/.next/standalone/packages/wiki-viewer-mcp/package.json +0 -41
  105. package/.next/standalone/packages/wiki-viewer-mcp/src/http-client.ts +0 -459
  106. package/.next/standalone/packages/wiki-viewer-mcp/src/index.ts +0 -638
  107. package/.next/standalone/packages/wiki-viewer-mcp/src/register.ts +0 -144
  108. package/.next/standalone/packages/wiki-viewer-mcp/src/state-cache.ts +0 -55
  109. package/.next/standalone/packages/wiki-viewer-mcp/tsconfig.json +0 -19
  110. package/.next/standalone/pnpm-lock.yaml +0 -6697
  111. package/.next/standalone/pnpm-workspace.yaml +0 -8
  112. package/.next/standalone/postcss.config.mjs +0 -2
  113. package/.next/standalone/src/app/api/agent/activity/route.ts +0 -59
  114. package/.next/standalone/src/app/api/agent/admin/agents/[agentId]/revoke/route.ts +0 -40
  115. package/.next/standalone/src/app/api/agent/admin/agents/route.ts +0 -33
  116. package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/approve/route.ts +0 -83
  117. package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/deny/route.ts +0 -36
  118. package/.next/standalone/src/app/api/agent/admin/registrations/route.ts +0 -27
  119. package/.next/standalone/src/app/api/agent/events/[...path]/route.ts +0 -148
  120. package/.next/standalone/src/app/api/agent/files/[...path]/route.ts +0 -219
  121. package/.next/standalone/src/app/api/agent/fs/file/[...path]/route.ts +0 -446
  122. package/.next/standalone/src/app/api/agent/fs/ls/[[...path]]/route.ts +0 -152
  123. package/.next/standalone/src/app/api/agent/fs/move/route.ts +0 -130
  124. package/.next/standalone/src/app/api/agent/fs/search/route.ts +0 -272
  125. package/.next/standalone/src/app/api/agent/internal/span/route.ts +0 -121
  126. package/.next/standalone/src/app/api/agent/register/[regId]/route.ts +0 -50
  127. package/.next/standalone/src/app/api/agent/register/route.ts +0 -118
  128. package/.next/standalone/src/app/api/agent/settings/route.ts +0 -34
  129. package/.next/standalone/src/app/api/agent/settings/token/regenerate/route.ts +0 -20
  130. package/.next/standalone/src/app/api/agent/sidecar/[...path]/route.ts +0 -53
  131. package/.next/standalone/src/app/api/agents/install/route.ts +0 -143
  132. package/.next/standalone/src/app/api/agents/skill/route.ts +0 -20
  133. package/.next/standalone/src/app/api/agents/skill.tar.gz/route.ts +0 -87
  134. package/.next/standalone/src/app/api/app-proxy/[...path]/route.ts +0 -247
  135. package/.next/standalone/src/app/api/assets/[...path]/route.ts +0 -75
  136. package/.next/standalone/src/app/api/auth/[...all]/route.ts +0 -7
  137. package/.next/standalone/src/app/api/owner/init/route.ts +0 -14
  138. package/.next/standalone/src/app/api/share/[token]/route.ts +0 -269
  139. package/.next/standalone/src/app/api/share/route.ts +0 -127
  140. package/.next/standalone/src/app/api/system/admins/route.ts +0 -103
  141. package/.next/standalone/src/app/api/system/auth-config/route.ts +0 -22
  142. package/.next/standalone/src/app/api/system/auth-settings/route.ts +0 -86
  143. package/.next/standalone/src/app/api/system/browse/route.ts +0 -82
  144. package/.next/standalone/src/app/api/system/clear-root/route.ts +0 -16
  145. package/.next/standalone/src/app/api/system/config/route.ts +0 -14
  146. package/.next/standalone/src/app/api/system/pins/route.ts +0 -38
  147. package/.next/standalone/src/app/api/system/reveal/route.ts +0 -36
  148. package/.next/standalone/src/app/api/system/root-status/route.ts +0 -13
  149. package/.next/standalone/src/app/api/system/set-root/route.ts +0 -53
  150. package/.next/standalone/src/app/api/system/users/route.ts +0 -120
  151. package/.next/standalone/src/app/api/system/workspaces/[id]/open/route.ts +0 -34
  152. package/.next/standalone/src/app/api/system/workspaces/[id]/refresh/route.ts +0 -32
  153. package/.next/standalone/src/app/api/system/workspaces/[id]/route.ts +0 -78
  154. package/.next/standalone/src/app/api/system/workspaces/route.ts +0 -128
  155. package/.next/standalone/src/app/api/upload/[...path]/route.ts +0 -85
  156. package/.next/standalone/src/app/api/wiki/app/route.ts +0 -60
  157. package/.next/standalone/src/app/api/wiki/backlinks/route.ts +0 -29
  158. package/.next/standalone/src/app/api/wiki/content/route.ts +0 -159
  159. package/.next/standalone/src/app/api/wiki/download/route.ts +0 -100
  160. package/.next/standalone/src/app/api/wiki/file/route.ts +0 -57
  161. package/.next/standalone/src/app/api/wiki/folder/route.ts +0 -34
  162. package/.next/standalone/src/app/api/wiki/git-branches/route.ts +0 -32
  163. package/.next/standalone/src/app/api/wiki/git-checkout/route.ts +0 -45
  164. package/.next/standalone/src/app/api/wiki/git-diff/route.ts +0 -33
  165. package/.next/standalone/src/app/api/wiki/git-file-info/route.ts +0 -27
  166. package/.next/standalone/src/app/api/wiki/git-history/route.ts +0 -27
  167. package/.next/standalone/src/app/api/wiki/git-pull/route.ts +0 -48
  168. package/.next/standalone/src/app/api/wiki/move/route.ts +0 -61
  169. package/.next/standalone/src/app/api/wiki/new-file/route.ts +0 -56
  170. package/.next/standalone/src/app/api/wiki/outlinks/route.ts +0 -76
  171. package/.next/standalone/src/app/api/wiki/page/route.ts +0 -92
  172. package/.next/standalone/src/app/api/wiki/presence/route.ts +0 -56
  173. package/.next/standalone/src/app/api/wiki/route.ts +0 -116
  174. package/.next/standalone/src/app/api/wiki/search/route.ts +0 -44
  175. package/.next/standalone/src/app/api/wiki/slugs/route.ts +0 -54
  176. package/.next/standalone/src/app/api/wiki/upload/route.ts +0 -95
  177. package/.next/standalone/src/app/api/wiki/watch/route.ts +0 -67
  178. package/.next/standalone/src/app/globals.css +0 -1249
  179. package/.next/standalone/src/app/icon.svg +0 -11
  180. package/.next/standalone/src/app/layout.tsx +0 -78
  181. package/.next/standalone/src/app/manifest.ts +0 -30
  182. package/.next/standalone/src/app/page.tsx +0 -3260
  183. package/.next/standalone/src/app/s/[token]/page.tsx +0 -357
  184. package/.next/standalone/src/app/signin/page.tsx +0 -16
  185. package/.next/standalone/src/app/signin/signin-form.tsx +0 -238
  186. package/.next/standalone/src/components/ai-panel/activity-row.tsx +0 -284
  187. package/.next/standalone/src/components/ai-panel/ai-panel.tsx +0 -311
  188. package/.next/standalone/src/components/ai-panel/token-section.tsx +0 -313
  189. package/.next/standalone/src/components/auth-settings-sheet.tsx +0 -474
  190. package/.next/standalone/src/components/confirm-dialog.tsx +0 -56
  191. package/.next/standalone/src/components/dir-picker.tsx +0 -606
  192. package/.next/standalone/src/components/editor/backlinks-panel.tsx +0 -139
  193. package/.next/standalone/src/components/editor/bubble-menu.tsx +0 -346
  194. package/.next/standalone/src/components/editor/callout-extension.ts +0 -36
  195. package/.next/standalone/src/components/editor/comment-pip.tsx +0 -56
  196. package/.next/standalone/src/components/editor/comment-thread.tsx +0 -254
  197. package/.next/standalone/src/components/editor/csv-viewer.tsx +0 -379
  198. package/.next/standalone/src/components/editor/document-outline.tsx +0 -230
  199. package/.next/standalone/src/components/editor/editor-toolbar.tsx +0 -564
  200. package/.next/standalone/src/components/editor/editor.tsx +0 -1327
  201. package/.next/standalone/src/components/editor/extensions/drag-handle.ts +0 -325
  202. package/.next/standalone/src/components/editor/extensions/heading-anchors.ts +0 -55
  203. package/.next/standalone/src/components/editor/extensions/proof-span.ts +0 -60
  204. package/.next/standalone/src/components/editor/extensions/resizable-image.tsx +0 -159
  205. package/.next/standalone/src/components/editor/extensions.ts +0 -150
  206. package/.next/standalone/src/components/editor/file-fallback-viewer.tsx +0 -75
  207. package/.next/standalone/src/components/editor/folder-index.tsx +0 -236
  208. package/.next/standalone/src/components/editor/google-doc-viewer.tsx +0 -73
  209. package/.next/standalone/src/components/editor/image-viewer.tsx +0 -57
  210. package/.next/standalone/src/components/editor/large-file-gate.tsx +0 -108
  211. package/.next/standalone/src/components/editor/link-popover.tsx +0 -111
  212. package/.next/standalone/src/components/editor/media-popover.tsx +0 -212
  213. package/.next/standalone/src/components/editor/media-viewer.tsx +0 -70
  214. package/.next/standalone/src/components/editor/mermaid-viewer.tsx +0 -286
  215. package/.next/standalone/src/components/editor/node-app-viewer.tsx +0 -328
  216. package/.next/standalone/src/components/editor/notebook-viewer.tsx +0 -371
  217. package/.next/standalone/src/components/editor/office/docx-viewer.tsx +0 -93
  218. package/.next/standalone/src/components/editor/office/office-chrome.tsx +0 -83
  219. package/.next/standalone/src/components/editor/office/pptx-viewer.tsx +0 -104
  220. package/.next/standalone/src/components/editor/office/xlsx-viewer.tsx +0 -192
  221. package/.next/standalone/src/components/editor/pdf-viewer.tsx +0 -32
  222. package/.next/standalone/src/components/editor/proof-span-popover.tsx +0 -162
  223. package/.next/standalone/src/components/editor/slash-commands.tsx +0 -629
  224. package/.next/standalone/src/components/editor/source-viewer.tsx +0 -289
  225. package/.next/standalone/src/components/editor/suggest-edit-popover.tsx +0 -229
  226. package/.next/standalone/src/components/editor/suggestion-card.tsx +0 -206
  227. package/.next/standalone/src/components/editor/table-menu.tsx +0 -232
  228. package/.next/standalone/src/components/editor/view-mode-comment-button.tsx +0 -77
  229. package/.next/standalone/src/components/editor/website-viewer.tsx +0 -75
  230. package/.next/standalone/src/components/editor/wiki-link-create-dialog.tsx +0 -189
  231. package/.next/standalone/src/components/editor/wiki-link-decorator.ts +0 -79
  232. package/.next/standalone/src/components/editor/wiki-link-extension.ts +0 -120
  233. package/.next/standalone/src/components/editor/wiki-link-picker.tsx +0 -250
  234. package/.next/standalone/src/components/layout/viewer-toolbar.tsx +0 -54
  235. package/.next/standalone/src/components/search/search-command-dialog.tsx +0 -246
  236. package/.next/standalone/src/components/search/sidebar-search-box.tsx +0 -121
  237. package/.next/standalone/src/components/search/snippet-text.tsx +0 -48
  238. package/.next/standalone/src/components/share-dialog.tsx +0 -307
  239. package/.next/standalone/src/components/theme-provider.tsx +0 -16
  240. package/.next/standalone/src/components/theme-toggle.tsx +0 -24
  241. package/.next/standalone/src/components/ui/badge.tsx +0 -35
  242. package/.next/standalone/src/components/ui/button.tsx +0 -56
  243. package/.next/standalone/src/components/ui/card.tsx +0 -63
  244. package/.next/standalone/src/components/ui/collapsible.tsx +0 -9
  245. package/.next/standalone/src/components/ui/command.tsx +0 -151
  246. package/.next/standalone/src/components/ui/context-menu.tsx +0 -191
  247. package/.next/standalone/src/components/ui/dialog.tsx +0 -119
  248. package/.next/standalone/src/components/ui/dropdown-menu.tsx +0 -194
  249. package/.next/standalone/src/components/ui/input.tsx +0 -22
  250. package/.next/standalone/src/components/ui/label.tsx +0 -25
  251. package/.next/standalone/src/components/ui/popover.tsx +0 -33
  252. package/.next/standalone/src/components/ui/scroll-area.tsx +0 -47
  253. package/.next/standalone/src/components/ui/select.tsx +0 -156
  254. package/.next/standalone/src/components/ui/separator.tsx +0 -30
  255. package/.next/standalone/src/components/ui/sheet.tsx +0 -140
  256. package/.next/standalone/src/components/ui/skeleton.tsx +0 -15
  257. package/.next/standalone/src/components/ui/switch.tsx +0 -28
  258. package/.next/standalone/src/components/ui/tabs.tsx +0 -54
  259. package/.next/standalone/src/components/ui/textarea.tsx +0 -21
  260. package/.next/standalone/src/components/ui/tip.tsx +0 -23
  261. package/.next/standalone/src/components/ui/toggle-group.tsx +0 -41
  262. package/.next/standalone/src/components/ui/tooltip.tsx +0 -27
  263. package/.next/standalone/src/components/view-width-toggle.tsx +0 -70
  264. package/.next/standalone/src/components/wiki/frontmatter-header.tsx +0 -164
  265. package/.next/standalone/src/hooks/use-is-mobile.ts +0 -14
  266. package/.next/standalone/src/lib/app-runner.ts +0 -272
  267. package/.next/standalone/src/lib/auth/admin.ts +0 -120
  268. package/.next/standalone/src/lib/auth/allowlist.ts +0 -50
  269. package/.next/standalone/src/lib/auth/client.ts +0 -4
  270. package/.next/standalone/src/lib/auth/csrf.ts +0 -68
  271. package/.next/standalone/src/lib/auth/server.ts +0 -215
  272. package/.next/standalone/src/lib/cabinets/tree.ts +0 -75
  273. package/.next/standalone/src/lib/config.ts +0 -114
  274. package/.next/standalone/src/lib/embeds/detect.ts +0 -142
  275. package/.next/standalone/src/lib/git-secrets.ts +0 -65
  276. package/.next/standalone/src/lib/git.ts +0 -503
  277. package/.next/standalone/src/lib/google/detect.ts +0 -107
  278. package/.next/standalone/src/lib/markdown/parse-frontmatter.ts +0 -104
  279. package/.next/standalone/src/lib/markdown/remark-wikilinks.ts +0 -100
  280. package/.next/standalone/src/lib/markdown/sanitize-schema.ts +0 -106
  281. package/.next/standalone/src/lib/markdown/to-html.ts +0 -282
  282. package/.next/standalone/src/lib/markdown/to-markdown.ts +0 -252
  283. package/.next/standalone/src/lib/proof/activity-shared.ts +0 -31
  284. package/.next/standalone/src/lib/proof/activity.ts +0 -74
  285. package/.next/standalone/src/lib/proof/audit.ts +0 -88
  286. package/.next/standalone/src/lib/proof/auth.ts +0 -143
  287. package/.next/standalone/src/lib/proof/block-refs.ts +0 -133
  288. package/.next/standalone/src/lib/proof/blocks.ts +0 -73
  289. package/.next/standalone/src/lib/proof/client-auth.ts +0 -23
  290. package/.next/standalone/src/lib/proof/collab-state.ts +0 -81
  291. package/.next/standalone/src/lib/proof/event-bus.ts +0 -47
  292. package/.next/standalone/src/lib/proof/file-lock.ts +0 -43
  293. package/.next/standalone/src/lib/proof/glob.ts +0 -51
  294. package/.next/standalone/src/lib/proof/idempotency.ts +0 -37
  295. package/.next/standalone/src/lib/proof/lease.ts +0 -117
  296. package/.next/standalone/src/lib/proof/mutex.ts +0 -36
  297. package/.next/standalone/src/lib/proof/ops-applier.ts +0 -727
  298. package/.next/standalone/src/lib/proof/owner-auth.ts +0 -2
  299. package/.next/standalone/src/lib/proof/pending.ts +0 -97
  300. package/.next/standalone/src/lib/proof/proof-span.ts +0 -141
  301. package/.next/standalone/src/lib/proof/rate-limit.ts +0 -53
  302. package/.next/standalone/src/lib/proof/raw-fs.ts +0 -197
  303. package/.next/standalone/src/lib/proof/register-rate-limit.ts +0 -53
  304. package/.next/standalone/src/lib/proof/registry.ts +0 -195
  305. package/.next/standalone/src/lib/proof/sidecar.ts +0 -103
  306. package/.next/standalone/src/lib/proof/suggest-capture.ts +0 -69
  307. package/.next/standalone/src/lib/proof/types.ts +0 -182
  308. package/.next/standalone/src/lib/proof-config.ts +0 -14
  309. package/.next/standalone/src/lib/root-dir.ts +0 -35
  310. package/.next/standalone/src/lib/search/indexable-exts.ts +0 -25
  311. package/.next/standalone/src/lib/search/indexer.ts +0 -634
  312. package/.next/standalone/src/lib/search/sanitize.ts +0 -35
  313. package/.next/standalone/src/lib/search/search-db.ts +0 -57
  314. package/.next/standalone/src/lib/search/watcher-pool.ts +0 -79
  315. package/.next/standalone/src/lib/shared-docs/db.ts +0 -177
  316. package/.next/standalone/src/lib/toast.ts +0 -9
  317. package/.next/standalone/src/lib/utils.ts +0 -6
  318. package/.next/standalone/src/lib/wiki-helpers.ts +0 -36
  319. package/.next/standalone/src/lib/workspace-client.ts +0 -82
  320. package/.next/standalone/src/lib/workspace-context.ts +0 -173
  321. package/.next/standalone/src/lib/workspaces.ts +0 -400
  322. package/.next/standalone/src/middleware.ts +0 -44
  323. package/.next/standalone/src/stores/ai-panel-store.ts +0 -79
  324. package/.next/standalone/src/stores/editor-store.ts +0 -439
  325. package/.next/standalone/src/stores/pin-store.ts +0 -56
  326. package/.next/standalone/src/stores/proof-store.ts +0 -124
  327. package/.next/standalone/src/stores/recent-store.ts +0 -51
  328. package/.next/standalone/src/stores/search-store.ts +0 -104
  329. package/.next/standalone/src/stores/show-hidden-store.ts +0 -26
  330. package/.next/standalone/src/stores/sidebar-width-store.ts +0 -39
  331. package/.next/standalone/src/stores/skin-store.ts +0 -42
  332. package/.next/standalone/src/stores/tree-store.ts +0 -52
  333. package/.next/standalone/src/stores/view-width-store.ts +0 -101
  334. package/.next/standalone/src/stores/wiki-slugs-store.ts +0 -75
  335. package/.next/standalone/src/tests/proof/activity-aggregator.test.ts +0 -146
  336. package/.next/standalone/src/tests/proof/admin-create-user.test.ts +0 -43
  337. package/.next/standalone/src/tests/proof/agent-fs.test.ts +0 -973
  338. package/.next/standalone/src/tests/proof/agent-ownership.test.ts +0 -140
  339. package/.next/standalone/src/tests/proof/agent-workspace-scope.test.ts +0 -134
  340. package/.next/standalone/src/tests/proof/agents-install.test.ts +0 -110
  341. package/.next/standalone/src/tests/proof/bench-write.ts +0 -179
  342. package/.next/standalone/src/tests/proof/better-auth.test.ts +0 -68
  343. package/.next/standalone/src/tests/proof/block-refs.test.ts +0 -108
  344. package/.next/standalone/src/tests/proof/blocks.test.ts +0 -92
  345. package/.next/standalone/src/tests/proof/collab-state.test.ts +0 -501
  346. package/.next/standalone/src/tests/proof/comments-ops.test.ts +0 -177
  347. package/.next/standalone/src/tests/proof/editor-roundtrip.test.ts +0 -85
  348. package/.next/standalone/src/tests/proof/external-edit.test.ts +0 -58
  349. package/.next/standalone/src/tests/proof/file-lock.test.ts +0 -80
  350. package/.next/standalone/src/tests/proof/git-branches-checkout.test.ts +0 -136
  351. package/.next/standalone/src/tests/proof/git-read-features.test.ts +0 -473
  352. package/.next/standalone/src/tests/proof/git-secrets.test.ts +0 -138
  353. package/.next/standalone/src/tests/proof/git-sparse.test.ts +0 -257
  354. package/.next/standalone/src/tests/proof/git-workspace.test.ts +0 -135
  355. package/.next/standalone/src/tests/proof/git.test.ts +0 -243
  356. package/.next/standalone/src/tests/proof/glob.test.ts +0 -82
  357. package/.next/standalone/src/tests/proof/helpers/auth-session.ts +0 -27
  358. package/.next/standalone/src/tests/proof/markdown-to-html.test.ts +0 -46
  359. package/.next/standalone/src/tests/proof/ops-applier.test.ts +0 -368
  360. package/.next/standalone/src/tests/proof/owner-init.test.ts +0 -2
  361. package/.next/standalone/src/tests/proof/parse-frontmatter.test.ts +0 -60
  362. package/.next/standalone/src/tests/proof/preload.ts +0 -21
  363. package/.next/standalone/src/tests/proof/proof-span.test.ts +0 -98
  364. package/.next/standalone/src/tests/proof/rate-limit.test.ts +0 -54
  365. package/.next/standalone/src/tests/proof/readonly-enforcement.test.ts +0 -161
  366. package/.next/standalone/src/tests/proof/reconcile-sidecar.test.ts +0 -195
  367. package/.next/standalone/src/tests/proof/registration-flow.test.ts +0 -330
  368. package/.next/standalone/src/tests/proof/registry.test.ts +0 -169
  369. package/.next/standalone/src/tests/proof/routes.test.ts +0 -516
  370. package/.next/standalone/src/tests/proof/search-index.test.ts +0 -376
  371. package/.next/standalone/src/tests/proof/sidecar-lifecycle.test.ts +0 -177
  372. package/.next/standalone/src/tests/proof/sidecar-trim.test.ts +0 -58
  373. package/.next/standalone/src/tests/proof/suggestion-ops.test.ts +0 -280
  374. package/.next/standalone/src/tests/proof/wiki-content-put.test.ts +0 -140
  375. package/.next/standalone/src/tests/proof/wiki-routes-auth.test.ts +0 -208
  376. package/.next/standalone/src/tests/proof/workspace-isolation.test.ts +0 -87
  377. package/.next/standalone/src/tests/proof/workspaces-api.test.ts +0 -227
  378. package/.next/standalone/src/types/index.ts +0 -47
  379. package/.next/standalone/tailwind.config.ts +0 -191
  380. package/.next/standalone/tsconfig.json +0 -41
  381. package/.next/standalone/tsconfig.tsbuildinfo +0 -1
  382. /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_buildManifest.js +0 -0
  383. /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_clientMiddlewareManifest.js +0 -0
  384. /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_ssgManifest.js +0 -0
@@ -1,20 +0,0 @@
1
- # TODO
2
- <!-- pi-todo-md:schema=1 -->
3
-
4
- ## Tasks
5
-
6
- ## Agent Presence (Theme 2)
7
- - [ ] Live agent orb — drifting pastel orb in editor margin when agent holds Tier-2 write lock on current doc. Poll /api/agent/files/{path} collab-state or reuse presence heartbeat; render orb anchored to the active block position. Use gradient-orb pastel tokens (mint/peach/lavender). Hover = agent id + op type + elapsed time. <!-- pi-todo-md:id=1 -->
8
- - note: Source of truth for "is agent active here": X-Collab-State header from /api/agent/files/{path} (active/tracked/untracked). Owner UI should poll this for currently-open file. No new backend needed, just a frontend polling hook + orb component. Wow ★★★★ / effort M.
9
- - [ ] Watch-mode — when another agent is editing the open doc, auto-poll the event-stream (SSE or poll /api/agent/activity?file=) and apply incoming proof-span diffs to the TipTap view in near-real-time. Toggle: <!-- pi-todo-md:id=2 -->
10
- - note: Toggle button in editor toolbar: "Watch live" on/off. SSE from /api/agent/events or poll /api/agent/activity?file=&since=. Render incoming proof-spans as fading highlights before they settle. Prereq: verify event-log completeness (not GC'd mid-session). Wow ★★★★ / effort M.
11
- - [x] Activity newsfeed — replace the current raw activity panel with an editorial changelog. Each entry: agent avatar chip + human-readable summary ("Claude appended 3 blocks to notes.md · 2 pending your review") + relative timestamp. Group by file. Link to pending proof-spans. Data already exists in /api/agent/activity. Wow ★★★ / effort S. <!-- pi-todo-md:id=3 -->
12
-
13
- ## Local Wiki Graph
14
- - [ ] Mini force-graph in backlinks panel — add a "Graph" tab alongside the existing backlinks list. Render a small D3/vis-network force graph: current doc = center node, backlinkers + outgoing [[links]] = surrounding nodes, edges = link direction. Click node = navigate. Backlinks panel + wikilink parser both already exist; missing piece = graph renderer + outgoing-links API endpoint. Wow ★★★★ / effort M. <!-- pi-todo-md:id=4 -->
15
- - [x] Outgoing links API — new /api/wiki/outlinks?path= endpoint: parse [[wikilinks]] from a file using remark-wikilinks, return list of {slug, resolved_path, exists} entries. Needed by the graph tab. remark-wikilinks.ts already parses them; need to expose via HTTP + resolve slugs against the file index. Effort S. <!-- pi-todo-md:id=5 -->
16
-
17
- ## Comment on Share
18
- - [ ] Share comment DB schema — add share_comments table to shared.db: id, share_token, body (text), author_name (nullable, visitor-supplied), created_at, status (pending|approved|rejected). Owner-only read/approve/reject via /api/share/[token]/comments (auth-gated). Visitors POST via public /api/share/[token]/comment (rate-limited, no auth). Wow ★★★★ / effort M. <!-- pi-todo-md:id=6 -->
19
- - [ ] Share page comment UI — comment box at the bottom of the share viewer page. Name field (optional) + body textarea + submit. Pending state: 'Sent for review'. Rate-limit feedback. No JS framework gymnastics — simple form submit or fetch POST. <!-- pi-todo-md:id=7 -->
20
- - [ ] Owner comment inbox — notification badge on shared-links panel when there are pending comments. Inline approve/reject with the comment body shown. On approve: comment becomes visible on the share page to all future visitors. On reject: silently dropped. <!-- pi-todo-md:id=8 -->
@@ -1,14 +0,0 @@
1
- You are connecting to a running wiki-viewer instance at $WIKI_URL (e.g. `http://localhost:3000`). Fetch `$WIKI_URL/api/agents/install` and follow the instructions there to register, wait for human approval, then work with files via its HTTP API.
2
-
3
- **Two tiers — pick by `X-Collab-State`:**
4
-
5
- - **Tier 1 Raw FS** (`/api/agent/fs/*`) — all file types, fast read/write/ls/search. Use for code, binaries, and markdown that isn't being actively co-edited.
6
- - **Tier 2 Collab** (`/api/agent/files/*.md`) — markdown only, reviewable proof-spans. Use when `X-Collab-State: active` (human has the doc open or it has pending suggestions).
7
-
8
- **Mode rule:** Every file read returns `X-Collab-State`. If `active` → use Tier-2 block-ops so the human can review. Otherwise → use Tier-1 raw fs. A raw write to an `active` .md is rejected 409 `COLLAB_ACTIVE` with the Tier-2 URL.
9
-
10
- **Workspaces:** this instance may serve several root directories. Send `X-Workspace: <workspaceId>` (or `?ws=<id>`) on every request to target one; omit it only on a single-workspace instance (the server falls back to the default). Ask the human for the workspace id or read it from the `?ws=` param of the URL they shared. A token may be pinned to one workspace — a mismatched workspace returns 403.
11
-
12
- Set `basis` and `basisDetail` on every Tier-2 content op so the human can see where your changes came from. Prefer `suggestion.add` over direct block ops unless told otherwise.
13
-
14
- MCP-capable agents: `npx wiki-viewer-mcp` (set `WIKI_VIEWER_URL`, `WIKI_VIEWER_TOKEN`, `WIKI_VIEWER_AGENT_ID`, and optionally `WIKI_VIEWER_WORKSPACE` to target a workspace) gives native **Tier-1 file tools** (read/write/edit/list/search/move/delete) and refuses to overwrite an `active` doc. It has **no Tier-2 collab tools** — to co-write a doc (suggestions/comments), call the Tier-2 HTTP endpoints directly. MCP = fast filework; Tier-2 HTTP = reviewable collaboration.
@@ -1,456 +0,0 @@
1
- ---
2
- name: wiki-viewer
3
- description: Read and edit markdown files in a running wiki-viewer instance over its HTTP collab API. Use when the user mentions wiki-viewer, asks you to edit local notes, or shares a localhost wiki-viewer URL. Handles agent registration, scoped capabilities, block-level edits with provenance marks, comments, and suggestions.
4
- license: MIT
5
- ---
6
-
7
- # wiki-viewer agent skill
8
-
9
- You are working with **wiki-viewer**, a local-first markdown viewer that exposes a Proof-SDK-compatible HTTP API for agents. Files on disk are the source of truth. Every AI-authored edit is wrapped in an inline `<proof-span>` mark so the human can see, accept, or revert your contribution.
10
-
11
- ## Quick orientation: two tiers
12
-
13
- | Tier | Routes | File types | When to use |
14
- | ------------------- | ----------------------- | ----------------------------------- | --------------------------------------------------------------------------------- |
15
- | **Tier 1 — Raw FS** | `/api/agent/fs/*` | All types (markdown, code, binary…) | Fast filework. Read, write, list, move, delete, search. Audited but no review UI. |
16
- | **Tier 2 — Collab** | `/api/agent/files/*.md` | Markdown only | Reviewable prose. Edits become proof-spans the human can accept/revert. |
17
-
18
- Both tiers use the same auth (TOFU token). Pick the tier based on `X-Collab-State` (see [Which tier do I use?](#which-tier-do-i-use)).
19
-
20
- ---
21
-
22
- ## Discovery
23
-
24
- The server publishes everything you need at one URL:
25
-
26
- ```
27
- GET http://<host>:<port>/api/agents/install
28
- ```
29
-
30
- This returns JSON with: bootstrap instructions, route table, op vocabulary, the current registration endpoint, and the human-facing approval workflow. Fetch this first and treat it as authoritative for the running instance you're talking to.
31
-
32
- If the user pasted only the wiki-viewer URL, append `/api/agents/install` and fetch it before doing anything else.
33
-
34
- ## Authentication
35
-
36
- wiki-viewer uses **TOFU (Trust On First Use)**:
37
-
38
- 1. You register anonymously. Server stores a pending request.
39
- 2. The human approves you in the wiki-viewer AI Panel.
40
- 3. You poll, receive a one-shot token, and use it from then on.
41
-
42
- ### Register
43
-
44
- ```
45
- POST /api/agent/register
46
- Content-Type: application/json
47
-
48
- {
49
- "id": "ai:<your-name>",
50
- "displayName": "<readable name>",
51
- "scope": {
52
- "paths": ["**/*"],
53
- "ops": ["read", "mutate"]
54
- }
55
- }
56
- ```
57
-
58
- - `id` must match `^ai:[a-z][a-z0-9-]{0,30}$`. Pick something stable per agent identity (e.g. `ai:claude`, `ai:cursor`, `ai:my-script`).
59
- - `displayName` 1-80 chars. What the human sees in the approval UI.
60
- - `scope.paths` is a glob list. Use `**/*` for full repo access, or restrict to a subtree like `notes/**`.
61
- - `scope.ops` ⊆ `["read", "mutate"]` (add `"delete"` if you need to remove files).
62
- - `scope.workspaceId` (optional): pin this grant to a single workspace id. Omit
63
- to request a wildcard grant usable in any workspace (the human can still narrow
64
- it at approval time).
65
-
66
- Response:
67
-
68
- ```json
69
- {
70
- "registrationId": "reg_<32hex>",
71
- "pollUrl": "/api/agent/register/<regId>",
72
- "status": "pending"
73
- }
74
- ```
75
-
76
- **Tell the human**: "Open the wiki-viewer AI Panel and approve my registration."
77
-
78
- ### Poll
79
-
80
- ```
81
- GET /api/agent/register/<registrationId>
82
- ```
83
-
84
- - `202 {status:"pending"}` — keep polling, every 2-5s.
85
- - `200 {status:"approved", agentId, token}` — capture token immediately. Pickup is **one-shot**; you cannot fetch it again.
86
- - `410 {status:"denied"}` or `{status:"consumed"}` — abort or restart registration.
87
- - `404` — registration expired, re-register.
88
-
89
- ### Use the token
90
-
91
- Every subsequent request:
92
-
93
- ```
94
- Authorization: Bearer <token>
95
- X-Agent-Id: ai:<your-name>
96
- X-Workspace: <workspaceId> # optional but recommended (see Workspaces)
97
- ```
98
-
99
- The `X-Agent-Id` must match the id the token was issued for. Spoofing rejected with `401`.
100
-
101
- ## Workspaces
102
-
103
- A wiki-viewer instance can serve **multiple root directories ("workspaces")**
104
- at once. Every file path you use is relative to **one** workspace's root.
105
-
106
- - **Targeting a workspace:** send an `X-Workspace: <workspaceId>` header on every
107
- request (or append `?ws=<workspaceId>` to the URL). If you omit it, the server
108
- resolves to a default (the most-recently-opened workspace), which is correct
109
- for a single-workspace instance but ambiguous when several exist — so prefer
110
- to be explicit.
111
- - **Discovering workspace ids:** `GET /api/agent/settings` returns the resolved
112
- `root` (the active workspace's directory) for whatever `X-Workspace` you send.
113
- The human picks/creates workspaces in the UI; ask them for the id, or read it
114
- from the `?ws=` param in a wiki-viewer URL they pasted.
115
- - **Scoped grants:** your token may be pinned to one workspace at approval time.
116
- A request that resolves to a different workspace is rejected `403 FORBIDDEN`.
117
- A token with no workspace pin works against any workspace (wildcard).
118
- - **Isolation:** paths in workspace A never touch workspace B, even if they share
119
- the same relative path (`notes.md` in A ≠ `notes.md` in B).
120
-
121
- Whenever the human is working in a specific workspace, capture its id once and
122
- send `X-Workspace: <id>` on all subsequent calls.
123
-
124
- ## Reading
125
-
126
- ```
127
- GET /api/agent/files/<url-encoded-path>.md
128
- ```
129
-
130
- Returns a Snapshot:
131
-
132
- ```json
133
- {
134
- "path": "notes/plan.md",
135
- "revision": 7,
136
- "fingerprint": "sha256:...",
137
- "blocks": [
138
- { "ref": "b1a3f0", "type": "heading", "level": 1, "markdown": "# Plan" },
139
- { "ref": "b7f2c1", "type": "paragraph", "markdown": "Ship in June." }
140
- ],
141
- "comments": [...],
142
- "suggestions": [...],
143
- "lastEventId": 12
144
- }
145
- ```
146
-
147
- Block `ref` strings are stable across edits. Use them to target mutations. **Always read a fresh snapshot before mutating** so you have the current `revision`.
148
-
149
- ## Mutating
150
-
151
- ```
152
- POST /api/agent/files/<path>.md
153
- Authorization: Bearer <token>
154
- X-Agent-Id: ai:<your-name>
155
- Content-Type: application/json
156
- Idempotency-Key: <uuid you generate per request>
157
-
158
- {
159
- "baseRevision": <revision from snapshot>,
160
- "by": "ai:<your-name>",
161
- "ops": [ <op>, ... ]
162
- }
163
- ```
164
-
165
- Requirements:
166
-
167
- - `Idempotency-Key` header mandatory. Same key + same body within 5 minutes returns the cached response. Same key + different body returns `409 IDEMPOTENCY_KEY_REUSED`.
168
- - `by` must equal your `X-Agent-Id` or you get `403 FORBIDDEN`.
169
- - If `baseRevision` is stale, response is `409 STALE_REVISION` with a fresh snapshot. Read the new revision, rebuild your op against current refs, retry.
170
-
171
- ### Op vocabulary
172
-
173
- **Block ops** — content edits:
174
-
175
- ```json
176
- { "type": "block.replace", "ref": "b7f2c1", "markdown": "New content." }
177
- { "type": "block.insertAfter", "ref": "b7f2c1", "markdown": "..." }
178
- { "type": "block.insertBefore", "ref": "b7f2c1", "markdown": "..." }
179
- { "type": "block.delete", "ref": "b7f2c1" }
180
- { "type": "block.append", "markdown": "..." }
181
- { "type": "block.prepend", "markdown": "..." }
182
- ```
183
-
184
- Any text you insert is automatically wrapped in a `<proof-span>` mark by the server. Provide optional metadata to make your contribution legible:
185
-
186
- ```json
187
- {
188
- "type": "block.insertAfter",
189
- "ref": "b7f2c1",
190
- "markdown": "Three pillars: infra, tooling, launch.",
191
- "basis": "described",
192
- "basisDetail": "user asked for an opening paragraph",
193
- "inResponseTo": "c4a1"
194
- }
195
- ```
196
-
197
- `basis` ∈ `"described" | "inferred" | "suggested"`. Defaults to `"inferred"`. Always set `basis` and a short `basisDetail` so the human reviewer knows where your edit came from.
198
-
199
- **Comment ops** — threaded discussion attached to a block:
200
-
201
- ```json
202
- { "type": "comment.add", "ref": "b7f2c1", "text": "Why end of June?" }
203
- { "type": "comment.reply", "commentId": "c4a1", "text": "Because of API freeze." }
204
- { "type": "comment.resolve", "commentId": "c4a1" }
205
- { "type": "comment.reopen", "commentId": "c4a1" }
206
- ```
207
-
208
- **Suggestion ops** — proposed edits the human must accept:
209
-
210
- ```json
211
- {
212
- "type": "suggestion.add",
213
- "ref": "b7f2c1",
214
- "kind": "replace",
215
- "markdown": "Ship the rewrite by July 15.",
216
- "basis": "described",
217
- "basisDetail": "user mentioned slippage in chat"
218
- }
219
- ```
220
-
221
- Suggestion kinds: `"replace" | "insertAfter" | "insertBefore" | "delete"`.
222
-
223
- Default for AI-initiated content edits: **prefer suggestions over direct block ops** unless the human explicitly asked you to write directly. Suggestions render as inline cards in the editor with Accept / Reject buttons. Block ops apply immediately and only show up as proof-span decorations.
224
-
225
- ## Polling events
226
-
227
- ```
228
- GET /api/agent/events/<path>.md?after=<lastEventId>
229
- ```
230
-
231
- Returns events emitted since `lastEventId`: human comments, accepted suggestions, external file edits (the human opened the file in vim), and so on. Use this to react when the human responds to one of your comments or suggestions.
232
-
233
- Acknowledge:
234
-
235
- ```
236
- POST /api/agent/events/<path>.md
237
- { "upToId": <id>, "by": "ai:<your-name>" }
238
- ```
239
-
240
- Acks are advisory; events are never deleted.
241
-
242
- ## Error codes
243
-
244
- | Status | Code | Meaning |
245
- | ------ | ---------------------- | --------------------------------------------------------------------------------------- |
246
- | 401 | UNAUTHORIZED | bad/missing token or X-Agent-Id |
247
- | 403 | FORBIDDEN | scope/path mismatch, workspace not covered by grant, or `by` doesn't match `X-Agent-Id` |
248
- | 404 | FILE_NOT_FOUND | path doesn't exist under server root |
249
- | 409 | STALE_REVISION | `baseRevision` wrong, retry with included snapshot |
250
- | 409 | BLOCK_NOT_FOUND | ref no longer exists, refetch snapshot |
251
- | 409 | IDEMPOTENCY_KEY_REUSED | same key, different body |
252
- | 422 | INVALID_MARKDOWN | op's markdown failed to parse |
253
- | 429 | RATE_LIMITED | bucket exhausted, honor `Retry-After` header |
254
-
255
- ---
256
-
257
- ## Working with files (raw filesystem — Tier 1)
258
-
259
- All Tier-1 routes require `Authorization: Bearer <token>` + `X-Agent-Id: ai:<name>` (same as Tier 2). The agent's `scope.paths` glob applies to every surface (reads, ls results, search results, move, delete).
260
-
261
- ### Scope ops
262
-
263
- When registering, `scope.ops` can include:
264
-
265
- - `read` — read files + list + search
266
- - `mutate` — create / overwrite / move
267
- - `delete` — remove files/dirs (separate from mutate so a human can grant edit-but-never-delete)
268
-
269
- Example registration with full access:
270
-
271
- ```json
272
- {
273
- "id": "ai:claude",
274
- "scope": { "paths": ["**/*"], "ops": ["read", "mutate", "delete"] }
275
- }
276
- ```
277
-
278
- ### Read a file
279
-
280
- ```
281
- GET /api/agent/fs/file/<path>
282
- ```
283
-
284
- Returns raw bytes. Metadata in response headers:
285
-
286
- ```
287
- ETag: "<sha256>"
288
- X-File-Size: <bytes>
289
- X-File-Mtime: <ISO-8601>
290
- Content-Type: <mime>
291
- X-Collab-State: active | tracked | untracked | not-markdown
292
- X-Collab-Revision: <n>
293
- X-Collab-Snapshot: /api/agent/files/<path>.md # when applicable
294
- ```
295
-
296
- Supports `Range` header for large/binary files.
297
-
298
- ### Write a file
299
-
300
- ```
301
- PUT /api/agent/fs/file/<path>
302
- If-Match: "<sha256>" # required for overwrites; omit for creates
303
- Content-Type: <mime>
304
- <raw bytes body>
305
- ```
306
-
307
- - **Create** (file doesn't exist): omit `If-Match`. Creating a file that already exists without `If-Match` → 412 (no blind clobber).
308
- - **Overwrite** (file exists): send `If-Match` with the sha256 you read. Mismatch → 412.
309
- - `?mkdirs=true` — create parent directories.
310
- - `?force=true` — bypass `If-Match` check (audited; use sparingly).
311
-
312
- For `.md` files, also send:
313
-
314
- ```
315
- If-Collab-Match: <X-Collab-Revision> # prevents writing into a live collab session
316
- ```
317
-
318
- (See [Which tier do I use?](#which-tier-do-i-use).)
319
-
320
- Response:
321
-
322
- ```json
323
- {
324
- "path": "...",
325
- "sha256": "...",
326
- "size": 1234,
327
- "mtime": "...",
328
- "created": false
329
- }
330
- ```
331
-
332
- ### Delete a file
333
-
334
- ```
335
- DELETE /api/agent/fs/file/<path>
336
- If-Match: "<sha256>" # required — you must have read the file first
337
- ```
338
-
339
- Requires `delete` in `scope.ops`. Deletes the `.proof/` sidecar too for `.md` files. For directories: `?recursive=true`.
340
-
341
- ### List a directory
342
-
343
- ```
344
- GET /api/agent/fs/ls/<path>?recursive=true&limit=500&depth=3
345
- ```
346
-
347
- Returns `{ entries: [{name, type, path, size, mtime}] }`. Unauthorized paths silently omitted. Excludes `.proof/`.
348
-
349
- ### Move / rename
350
-
351
- ```
352
- POST /api/agent/fs/move
353
- Content-Type: application/json
354
-
355
- { "from": "notes/old.md", "to": "notes/new.md", "ifMatch": "<sha256>" }
356
- ```
357
-
358
- Moves the `.proof/` sidecar for `.md` files automatically.
359
-
360
- ### Search (grep / glob)
361
-
362
- ```
363
- POST /api/agent/fs/search
364
- Content-Type: application/json
365
-
366
- { "kind": "grep", "query": "TODO", "path": "src", "glob": "*.ts", "limit": 100 }
367
- ```
368
-
369
- ```
370
- POST /api/agent/fs/search
371
- Content-Type: application/json
372
-
373
- { "kind": "glob", "query": "**/*.test.ts" }
374
- ```
375
-
376
- Server-side: one call replaces dozens of `ls`+`read` round-trips. Results are scope-filtered. Glob dialect: `**`, `*`, `?` only (no braces/negation in v1).
377
-
378
- ### Error codes (Tier 1)
379
-
380
- | Status | Code | Meaning |
381
- | ------ | ------------------- | --------------------------------------------------------------------------- |
382
- | 400 | BAD_REQUEST | Invalid path or body |
383
- | 401 | UNAUTHORIZED | Bad/missing token or X-Agent-Id |
384
- | 403 | FORBIDDEN | Scope mismatch or missing `delete` op |
385
- | 404 | NOT_FOUND | Path doesn't exist |
386
- | 409 | COLLAB_ACTIVE | Raw PUT rejected — doc is active-collab; use Tier-2 or send If-Collab-Match |
387
- | 412 | PRECONDITION_FAILED | If-Match sha mismatch (concurrent modification) |
388
- | 413 | PAYLOAD_TOO_LARGE | File exceeds 50 MB limit |
389
- | 429 | RATE_LIMITED | Honor `Retry-After` |
390
-
391
- ---
392
-
393
- ## Which tier do I use?
394
-
395
- Every `GET /api/agent/fs/file/<path>` (and every Tier-2 snapshot read) returns `X-Collab-State`.
396
-
397
- | `X-Collab-State` | Meaning | Use |
398
- | ---------------- | --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
399
- | `active` | Human has this `.md` open in the editor, OR it has pending suggestions / unresolved comments. | **Tier 2 block-ops only.** A raw `PUT` returns `409 COLLAB_ACTIVE`. |
400
- | `tracked` | `.md` has a sidecar (prior collab history), no active session. | Prefer Tier-2 for prose/semantic edits. Raw ok for mechanical/whole-file ops (reformat, regenerate). |
401
- | `untracked` | `.md`, no sidecar yet. | Raw is fine. Tier-2 creates a sidecar (starts provenance tracking). |
402
- | `not-markdown` | Any non-`.md` file. | **Tier-1 raw only.** Tier 2 does not apply. |
403
-
404
- **Rule (one sentence):** Read the file, check `X-Collab-State`, use Tier-2 if `active`, else use Tier-1. For non-markdown, always Tier-1.
405
-
406
- **Editing a `.md` safely:**
407
-
408
- ```
409
- 1. GET /api/agent/fs/file/<path>.md
410
- → note ETag (sha256) and X-Collab-Revision + X-Collab-State
411
-
412
- 2a. If X-Collab-State == "active":
413
- → POST /api/agent/files/<path>.md (block-ops, Tier-2)
414
- Use the X-Collab-Snapshot URL. See "Mutating" section below.
415
-
416
- 2b. Otherwise (tracked / untracked):
417
- → PUT /api/agent/fs/file/<path>.md (raw Tier-1)
418
- If-Match: "<ETag from step 1>"
419
- If-Collab-Match: <X-Collab-Revision from step 1>
420
-
421
- 3. If you get 409 COLLAB_ACTIVE: the doc became active after your read.
422
- Switch to Tier-2 (block-ops) using the URL in the response body.
423
- ```
424
-
425
- **MCP-capable agents:** run `npx wiki-viewer-mcp` (set `WIKI_VIEWER_URL`, `WIKI_VIEWER_TOKEN`, `WIKI_VIEWER_AGENT_ID`). It exposes **Tier-1 file tools only** — `read_file`, `write_file`, `edit_file`, `list_directory`, `search`, `move_file`, `delete_file` — and reads `X-Collab-State` so it won't clobber an active doc: it blocks the write and tells you to use the collaborative path instead. The MCP shim has **no Tier-2 (block-ops / suggestion / comment) tools** — to co-write a doc, use the Tier-2 HTTP endpoints described above directly (the skill instructions cover them). Use the MCP for fast filework; use Tier-2 HTTP for reviewable doc collaboration.
426
-
427
- ---
428
-
429
- ## Working style
430
-
431
- - Read before write. Always GET a fresh snapshot to capture current `revision` and block `ref`s.
432
- - One file per request. There is no batch-across-files endpoint.
433
- - Atomic ops. Each POST applies all its ops or none. Order matters within a batch.
434
- - Be transparent. Set `basis` + `basisDetail` on every content op.
435
- - Prefer comments and suggestions over silent edits. The human is your collaborator, not your reviewer-of-last-resort.
436
- - Poll events between turns when the human is reviewing your work; respond to their comments rather than re-litigating.
437
-
438
- ## Sample first interaction
439
-
440
- ```
441
- 1. GET /api/agents/install # discovery
442
- 2. POST /api/agent/register # register (include "delete" in ops if needed)
443
- 3. tell human: "approve me in the AI Panel"
444
- 4. GET /api/agent/register/<regId> # poll until approved
445
-
446
- # Working mode (Tier-1, e.g. code files or untracked .md)
447
- 5. GET /api/agent/fs/ls/src?recursive=true # list
448
- 6. GET /api/agent/fs/file/src/main.ts # read -> capture ETag
449
- 7. PUT /api/agent/fs/file/src/main.ts (If-Match: <sha>) # write
450
-
451
- # Collaborating mode (Tier-2, active .md)
452
- 5. GET /api/agent/fs/file/notes/plan.md # read -> X-Collab-State: active
453
- 6. GET /api/agent/files/notes/plan.md # read snapshot (Tier-2)
454
- 7. POST /api/agent/files/notes/plan.md # suggest or mutate (Tier-2)
455
- 8. GET /api/agent/events/notes/plan.md?after=<id> # listen for replies
456
- ```
@@ -1,78 +0,0 @@
1
- #!/usr/bin/env node
2
- // Post-build fixups for the Next.js standalone bundle so it survives `npm pack`
3
- // and runs from a clean install. Run after `next build`.
4
- //
5
- // Three problems this addresses:
6
- //
7
- // 1. Static assets and public/ are not copied into the standalone output by
8
- // Next, so we copy them in.
9
- //
10
- // 2. Next writes a .gitignore into .next/standalone that lists node_modules/
11
- // and .next/. npm honors nested .gitignore files when packing, which strips
12
- // the bundled runtime and compiled server from the tarball. Remove it.
13
- //
14
- // 3. Next 16.1+ with Turbopack emits content-hashed require ids for external
15
- // packages, e.g. require("better-sqlite3-cf218e5bd1d5f04c"). That hashed id
16
- // does not exist in node_modules, so the server throws "Cannot find module"
17
- // at runtime. Rewrite every hashed external require back to its real package
18
- // name. See vercel/next.js#88844 and #91654.
19
-
20
- import { cpSync, rmSync, existsSync, readdirSync, statSync, readFileSync, writeFileSync } from "node:fs";
21
- import path from "node:path";
22
- import { fileURLToPath } from "node:url";
23
-
24
- const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
25
- const standalone = path.join(root, ".next", "standalone");
26
- const serverDir = path.join(standalone, ".next", "server");
27
-
28
- function copy(from, to) {
29
- if (!existsSync(from)) return;
30
- cpSync(from, to, { recursive: true });
31
- console.log(`postbuild: copied ${path.relative(root, from)} -> ${path.relative(root, to)}`);
32
- }
33
-
34
- // 1. static + public
35
- copy(path.join(root, ".next", "static"), path.join(standalone, ".next", "static"));
36
- copy(path.join(root, "public"), path.join(standalone, "public"));
37
-
38
- // 2. drop the nested .gitignore that would exclude node_modules/.next from npm pack
39
- const nestedGitignore = path.join(standalone, ".gitignore");
40
- if (existsSync(nestedGitignore)) {
41
- rmSync(nestedGitignore);
42
- console.log("postbuild: removed .next/standalone/.gitignore");
43
- }
44
-
45
- // 3. strip Turbopack content hashes from external require ids.
46
- // Only rewrite inside require("...") and the Turbopack external helper
47
- // e.x("...") so we never touch unrelated 16-hex string literals (e.g. a
48
- // dev fallback secret). Matches `<pkg>-<16 hex>` as the quoted argument.
49
- const HASH_RE = /((?:require|\.x)\(\s*["'])((?:@[\w.-]+\/)?[\w.-]+)-[0-9a-f]{16}(["'])/g;
50
-
51
- function walk(dir) {
52
- for (const entry of readdirSync(dir)) {
53
- const full = path.join(dir, entry);
54
- const st = statSync(full);
55
- if (st.isDirectory()) walk(full);
56
- else if (entry.endsWith(".js")) stripHashes(full);
57
- }
58
- }
59
-
60
- let rewrites = 0;
61
- function stripHashes(file) {
62
- const src = readFileSync(file, "utf8");
63
- HASH_RE.lastIndex = 0;
64
- if (!HASH_RE.test(src)) return;
65
- HASH_RE.lastIndex = 0;
66
- const out = src.replace(HASH_RE, "$1$2$3");
67
- if (out !== src) {
68
- writeFileSync(file, out);
69
- rewrites++;
70
- }
71
- }
72
-
73
- if (existsSync(serverDir)) {
74
- walk(serverDir);
75
- console.log(`postbuild: stripped Turbopack hashes in ${rewrites} file(s)`);
76
- }
77
-
78
- console.log("postbuild: done");