wiki-viewer 1.7.0 → 1.7.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.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +1 -0
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +29 -0
- package/.next/standalone/.next/routes-manifest.json +6 -0
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +2 -2
- 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 +2 -2
- 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.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- 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 +1 -1
- 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 +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/system/browse/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/upload/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 +1 -1
- 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 +1 -1
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/manifest.webmanifest/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +9 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route.js.map +5 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest.body +1 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest.meta +1 -0
- package/.next/standalone/.next/server/app-paths-manifest.json +1 -0
- package/.next/standalone/.next/server/chunks/0p91_next_dist_1195ub1._.js +18 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__06yp.08._.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_manifest_webmanifest_route_actions_04wfv0d.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_042apsk.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_08q3u1e.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_0nflz3~.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_0p5k29e.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hvvps3._.js +1 -1
- 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/docs/agent-fs-plan.md +3 -1
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/packages/wiki-viewer-mcp/dist/http-client.js +78 -0
- package/.next/standalone/packages/wiki-viewer-mcp/dist/index.js +25 -18
- package/.next/standalone/packages/wiki-viewer-mcp/package.json +1 -1
- package/.next/standalone/public/icon-192.png +0 -0
- package/.next/standalone/public/icon-512.png +0 -0
- package/.next/standalone/public/icon-maskable-512.png +0 -0
- package/.next/standalone/src/app/layout.tsx +15 -1
- package/.next/standalone/src/app/manifest.ts +30 -0
- package/.next/standalone/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- /package/.next/standalone/.next/static/{uQH5T9TFHOhO0NJbO4QGI → 0XvNCOSEq7cbARTLtAolL}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{uQH5T9TFHOhO0NJbO4QGI → 0XvNCOSEq7cbARTLtAolL}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{uQH5T9TFHOhO0NJbO4QGI → 0XvNCOSEq7cbARTLtAolL}/_ssgManifest.js +0 -0
|
@@ -22,7 +22,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
22
22
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
23
23
|
import * as z from "zod";
|
|
24
24
|
import { parseArgs } from "node:util";
|
|
25
|
-
import { WikiViewerClient, IfMatchError, CollabActiveError, WikiViewerError } from "./http-client.js";
|
|
25
|
+
import { WikiViewerClient, IfMatchError, CollabActiveError, WikiViewerError, PatchUnsupportedError, MatchCountError } from "./http-client.js";
|
|
26
26
|
import * as stateCache from "./state-cache.js";
|
|
27
27
|
/**
|
|
28
28
|
* Enable pooled HTTP keep-alive for the global fetch the client uses.
|
|
@@ -246,30 +246,37 @@ export function createServer(client) {
|
|
|
246
246
|
const block = checkCollabBlock(path);
|
|
247
247
|
if (block)
|
|
248
248
|
return err(block);
|
|
249
|
-
//
|
|
250
|
-
//
|
|
251
|
-
//
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
cached.sha256 &&
|
|
257
|
-
cached.collabState !== "active" &&
|
|
258
|
-
cached.body.includes(find)) {
|
|
259
|
-
const newContent = cached.body.replace(find, replace);
|
|
249
|
+
// Best path: server-side PATCH str-replace — sends only {find,replace}
|
|
250
|
+
// (~hundreds of bytes) instead of the whole file. One small request.
|
|
251
|
+
// Requires a known sha (If-Match); use cached sha if present, else the
|
|
252
|
+
// server's 412-recover path handles it. Falls back to read+PUT if the
|
|
253
|
+
// server has no PATCH route (older version).
|
|
254
|
+
const cachedForPatch = stateCache.get(path);
|
|
255
|
+
if (cachedForPatch?.collabState !== "active") {
|
|
260
256
|
try {
|
|
261
|
-
const
|
|
262
|
-
ifMatch:
|
|
257
|
+
const r = await client.patchFile(path, find, replace, {
|
|
258
|
+
ifMatch: cachedForPatch?.sha256,
|
|
263
259
|
});
|
|
264
|
-
return ok(`Edited: ${path}\nReplaced ${JSON.stringify(find)} → ${JSON.stringify(replace)}\nNew sha256: ${
|
|
260
|
+
return ok(`Edited: ${path}\nReplaced ${JSON.stringify(find)} → ${JSON.stringify(replace)}\nNew sha256: ${r.sha256}`);
|
|
265
261
|
}
|
|
266
262
|
catch (e) {
|
|
267
|
-
if (
|
|
263
|
+
if (e instanceof MatchCountError) {
|
|
264
|
+
return err(`edit_file: expected to replace exactly 1 occurrence of ${JSON.stringify(find)} in "${path}", ` +
|
|
265
|
+
`but found ${e.found}. Re-read the file or make the search string unique.`);
|
|
266
|
+
}
|
|
267
|
+
if (e instanceof CollabActiveError) {
|
|
268
|
+
return err(collabActiveMessage(path, e.snapshotUrl));
|
|
269
|
+
}
|
|
270
|
+
if (e instanceof IfMatchError) {
|
|
271
|
+
// sha was stale — fall through to read+retry below.
|
|
272
|
+
}
|
|
273
|
+
else if (!(e instanceof PatchUnsupportedError)) {
|
|
268
274
|
throw e;
|
|
269
|
-
|
|
275
|
+
}
|
|
276
|
+
// PatchUnsupportedError or stale If-Match → fall back to read+PUT.
|
|
270
277
|
}
|
|
271
278
|
}
|
|
272
|
-
//
|
|
279
|
+
// Fallback path: read → transform → PUT with If-Match.
|
|
273
280
|
const readResult = await client.readFile(path);
|
|
274
281
|
if (readResult.text === null) {
|
|
275
282
|
return err(`edit_file: "${path}" appears to be binary — cannot do text replacement.`);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Metadata } from "next";
|
|
1
|
+
import type { Metadata, Viewport } from "next";
|
|
2
2
|
import { Inter } from "next/font/google";
|
|
3
3
|
import "./globals.css";
|
|
4
4
|
import { Toaster } from "sonner";
|
|
@@ -9,6 +9,20 @@ const inter = Inter({ subsets: ["latin"], variable: "--font-inter" });
|
|
|
9
9
|
export const metadata: Metadata = {
|
|
10
10
|
title: "Wiki Viewer",
|
|
11
11
|
description: "Local file browser, viewer, and editor",
|
|
12
|
+
manifest: "/manifest.webmanifest",
|
|
13
|
+
appleWebApp: {
|
|
14
|
+
capable: true,
|
|
15
|
+
title: "Wiki",
|
|
16
|
+
statusBarStyle: "black-translucent",
|
|
17
|
+
},
|
|
18
|
+
icons: {
|
|
19
|
+
icon: "/icon-192.png",
|
|
20
|
+
apple: "/icon-192.png",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const viewport: Viewport = {
|
|
25
|
+
themeColor: "#0c0a09",
|
|
12
26
|
};
|
|
13
27
|
|
|
14
28
|
export default function RootLayout({
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MetadataRoute } from "next";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Web app manifest. Makes iOS/Android "Add to Home Screen" install a real
|
|
5
|
+
* standalone PWA (display: standalone) with persistent storage, instead of a
|
|
6
|
+
* plain bookmark. Without this, iOS treats the shortcut as ephemeral and evicts
|
|
7
|
+
* its cookie jar, forcing re-login on every reopen.
|
|
8
|
+
*/
|
|
9
|
+
export default function manifest(): MetadataRoute.Manifest {
|
|
10
|
+
return {
|
|
11
|
+
name: "Wiki Viewer",
|
|
12
|
+
short_name: "Wiki",
|
|
13
|
+
description: "Local file browser, viewer, and editor",
|
|
14
|
+
start_url: "/",
|
|
15
|
+
scope: "/",
|
|
16
|
+
display: "standalone",
|
|
17
|
+
background_color: "#0c0a09",
|
|
18
|
+
theme_color: "#0c0a09",
|
|
19
|
+
icons: [
|
|
20
|
+
{ src: "/icon-192.png", sizes: "192x192", type: "image/png", purpose: "any" },
|
|
21
|
+
{ src: "/icon-512.png", sizes: "512x512", type: "image/png", purpose: "any" },
|
|
22
|
+
{
|
|
23
|
+
src: "/icon-maskable-512.png",
|
|
24
|
+
sizes: "512x512",
|
|
25
|
+
type: "image/png",
|
|
26
|
+
purpose: "maskable",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
}
|