wiki-viewer 1.8.0 → 1.8.1

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 (45) hide show
  1. package/.next/standalone/.github/workflows/publish.yml +1 -1
  2. package/.next/standalone/.next/BUILD_ID +1 -1
  3. package/.next/standalone/.next/build-manifest.json +3 -3
  4. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  12. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  19. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/index.html +1 -1
  21. package/.next/standalone/.next/server/app/index.rsc +1 -1
  22. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  23. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  24. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  25. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  26. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  27. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0269d2e._.js +1 -1
  28. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  29. package/.next/standalone/.next/server/middleware-manifest.json +1 -1
  30. package/.next/standalone/.next/server/pages/404.html +1 -1
  31. package/.next/standalone/.next/server/pages/500.html +1 -1
  32. package/.next/standalone/agents/bootstrap-prompt.md +3 -1
  33. package/.next/standalone/agents/wiki-viewer-skill/SKILL.md +38 -11
  34. package/.next/standalone/package.json +1 -1
  35. package/.next/standalone/packages/wiki-viewer-mcp/README.md +6 -5
  36. package/.next/standalone/packages/wiki-viewer-mcp/dist/http-client.js +4 -0
  37. package/.next/standalone/packages/wiki-viewer-mcp/dist/index.js +4 -0
  38. package/.next/standalone/packages/wiki-viewer-mcp/src/http-client.ts +6 -0
  39. package/.next/standalone/packages/wiki-viewer-mcp/src/index.ts +5 -0
  40. package/.next/standalone/src/app/api/agents/install/route.ts +20 -2
  41. package/.next/standalone/tsconfig.tsbuildinfo +1 -1
  42. package/package.json +1 -1
  43. /package/.next/standalone/.next/static/{t7B6nXaoD1jo9f61t3aeK → 17VWCQ9_AhwJBT4yjkvWG}/_buildManifest.js +0 -0
  44. /package/.next/standalone/.next/static/{t7B6nXaoD1jo9f61t3aeK → 17VWCQ9_AhwJBT4yjkvWG}/_clientMiddlewareManifest.js +0 -0
  45. /package/.next/standalone/.next/static/{t7B6nXaoD1jo9f61t3aeK → 17VWCQ9_AhwJBT4yjkvWG}/_ssgManifest.js +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-viewer",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Local file viewer and wiki — view markdown, HTML, PDFs, notebooks, office docs, and more from any directory",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -90,11 +90,12 @@ node dist/index.js # start MCP server
90
90
  Set three environment variables before starting the MCP server
91
91
  (the `register` command prints them for you after approval):
92
92
 
93
- | Var | Description |
94
- | ---------------------- | ------------------------------------------------------------------------ |
95
- | `WIKI_VIEWER_URL` | Base URL of your wiki-viewer instance, e.g. `https://notes.example.com` |
96
- | `WIKI_VIEWER_TOKEN` | Bearer token obtained via `wiki-viewer-mcp register` |
97
- | `WIKI_VIEWER_AGENT_ID` | Your agent ID (e.g. `ai:myagent`), sent as `X-Agent-Id` on every request |
93
+ | Var | Description |
94
+ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
95
+ | `WIKI_VIEWER_URL` | Base URL of your wiki-viewer instance, e.g. `https://notes.example.com` |
96
+ | `WIKI_VIEWER_TOKEN` | Bearer token obtained via `wiki-viewer-mcp register` |
97
+ | `WIKI_VIEWER_AGENT_ID` | Your agent ID (e.g. `ai:myagent`), sent as `X-Agent-Id` on every request |
98
+ | `WIKI_VIEWER_WORKSPACE` | _Optional._ Workspace id, sent as `X-Workspace` on every request. Targets one root directory when the instance serves several. Omit for single-workspace instances (the server uses its default). |
98
99
 
99
100
  ## Usage in Claude Code / Cursor / Codex
100
101
 
@@ -56,11 +56,13 @@ export class WikiViewerClient {
56
56
  baseUrl;
57
57
  token;
58
58
  agentId;
59
+ workspace;
59
60
  _fetch;
60
61
  constructor(config) {
61
62
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
62
63
  this.token = config.token;
63
64
  this.agentId = config.agentId;
65
+ this.workspace = config.workspace;
64
66
  this._fetch = config.fetch ?? globalThis.fetch;
65
67
  }
66
68
  // ── Helpers ────────────────────────────────────────────────────────────────
@@ -68,6 +70,8 @@ export class WikiViewerClient {
68
70
  return {
69
71
  Authorization: `Bearer ${this.token}`,
70
72
  "X-Agent-Id": this.agentId,
73
+ // Target a specific workspace when configured. Omitted = server default.
74
+ ...(this.workspace ? { "X-Workspace": this.workspace } : {}),
71
75
  ...extra,
72
76
  };
73
77
  }
@@ -9,6 +9,7 @@
9
9
  * WIKI_VIEWER_URL Base URL of wiki-viewer instance (required)
10
10
  * WIKI_VIEWER_TOKEN Bearer token from TOFU registration (required)
11
11
  * WIKI_VIEWER_AGENT_ID X-Agent-Id header value (required)
12
+ * WIKI_VIEWER_WORKSPACE Workspace id for X-Workspace header (optional; targets one workspace)
12
13
  *
13
14
  * Mode-awareness:
14
15
  * Before any raw write to a .md file, the shim checks the cached
@@ -62,6 +63,7 @@ export function createClient(overrides) {
62
63
  baseUrl: overrides?.baseUrl ?? requireEnv("WIKI_VIEWER_URL"),
63
64
  token: overrides?.token ?? requireEnv("WIKI_VIEWER_TOKEN"),
64
65
  agentId: overrides?.agentId ?? requireEnv("WIKI_VIEWER_AGENT_ID"),
66
+ workspace: overrides?.workspace ?? process.env.WIKI_VIEWER_WORKSPACE,
65
67
  fetch: overrides?.fetch,
66
68
  });
67
69
  }
@@ -424,6 +426,7 @@ async function runRegister() {
424
426
  "scope-paths": { type: "string", default: "**/*" },
425
427
  ops: { type: "string", default: "read,mutate" },
426
428
  timeout: { type: "string", default: "300" },
429
+ workspace: { type: "string" },
427
430
  },
428
431
  allowPositionals: true,
429
432
  });
@@ -489,6 +492,7 @@ async function runRegister() {
489
492
  WIKI_VIEWER_URL: values.url,
490
493
  WIKI_VIEWER_TOKEN: result.token,
491
494
  WIKI_VIEWER_AGENT_ID: result.agentId,
495
+ ...(values.workspace ? { WIKI_VIEWER_WORKSPACE: values.workspace } : {}),
492
496
  },
493
497
  },
494
498
  },
@@ -15,6 +15,8 @@ export interface ClientConfig {
15
15
  baseUrl: string; // e.g. "https://notes.example.com"
16
16
  token: string; // Bearer token from TOFU registration
17
17
  agentId: string; // X-Agent-Id header
18
+ /** Target workspace id (X-Workspace header). Optional: omit for single-workspace instances. */
19
+ workspace?: string;
18
20
  /** Override fetch implementation (for testing) */
19
21
  fetch?: typeof fetch;
20
22
  }
@@ -116,12 +118,14 @@ export class WikiViewerClient {
116
118
  private readonly baseUrl: string;
117
119
  private readonly token: string;
118
120
  private readonly agentId: string;
121
+ private readonly workspace?: string;
119
122
  private readonly _fetch: typeof fetch;
120
123
 
121
124
  constructor(config: ClientConfig) {
122
125
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
123
126
  this.token = config.token;
124
127
  this.agentId = config.agentId;
128
+ this.workspace = config.workspace;
125
129
  this._fetch = config.fetch ?? globalThis.fetch;
126
130
  }
127
131
 
@@ -131,6 +135,8 @@ export class WikiViewerClient {
131
135
  return {
132
136
  Authorization: `Bearer ${this.token}`,
133
137
  "X-Agent-Id": this.agentId,
138
+ // Target a specific workspace when configured. Omitted = server default.
139
+ ...(this.workspace ? { "X-Workspace": this.workspace } : {}),
134
140
  ...extra,
135
141
  };
136
142
  }
@@ -9,6 +9,7 @@
9
9
  * WIKI_VIEWER_URL Base URL of wiki-viewer instance (required)
10
10
  * WIKI_VIEWER_TOKEN Bearer token from TOFU registration (required)
11
11
  * WIKI_VIEWER_AGENT_ID X-Agent-Id header value (required)
12
+ * WIKI_VIEWER_WORKSPACE Workspace id for X-Workspace header (optional; targets one workspace)
12
13
  *
13
14
  * Mode-awareness:
14
15
  * Before any raw write to a .md file, the shim checks the cached
@@ -76,12 +77,14 @@ export function createClient(overrides?: {
76
77
  baseUrl?: string;
77
78
  token?: string;
78
79
  agentId?: string;
80
+ workspace?: string;
79
81
  fetch?: typeof fetch;
80
82
  }): WikiViewerClient {
81
83
  return new WikiViewerClient({
82
84
  baseUrl: overrides?.baseUrl ?? requireEnv("WIKI_VIEWER_URL"),
83
85
  token: overrides?.token ?? requireEnv("WIKI_VIEWER_TOKEN"),
84
86
  agentId: overrides?.agentId ?? requireEnv("WIKI_VIEWER_AGENT_ID"),
87
+ workspace: overrides?.workspace ?? process.env.WIKI_VIEWER_WORKSPACE,
85
88
  fetch: overrides?.fetch,
86
89
  });
87
90
  }
@@ -524,6 +527,7 @@ async function runRegister() {
524
527
  "scope-paths": { type: "string", default: "**/*" },
525
528
  ops: { type: "string", default: "read,mutate" },
526
529
  timeout: { type: "string", default: "300" },
530
+ workspace: { type: "string" },
527
531
  },
528
532
  allowPositionals: true,
529
533
  });
@@ -595,6 +599,7 @@ async function runRegister() {
595
599
  WIKI_VIEWER_URL: values.url,
596
600
  WIKI_VIEWER_TOKEN: result.token,
597
601
  WIKI_VIEWER_AGENT_ID: result.agentId,
602
+ ...(values.workspace ? { WIKI_VIEWER_WORKSPACE: values.workspace } : {}),
598
603
  },
599
604
  },
600
605
  },
@@ -74,9 +74,25 @@ export async function GET(req: NextRequest): Promise<NextResponse> {
74
74
  { method: "GET", path: "/api/agent/fs/ls/<path>", auth: "bearer+agent-id", purpose: "Directory listing. ?recursive&limit&depth. Scope-filtered. Excludes .proof/." },
75
75
  { method: "POST", path: "/api/agent/fs/move", auth: "bearer+agent-id", purpose: "Move/rename. Body: {from, to, ifMatch?}. Moves .md sidecar too." },
76
76
  { method: "POST", path: "/api/agent/fs/search", auth: "bearer+agent-id", purpose: "Server-side grep or glob. Body: {kind:'grep'|'glob', query, path?, glob?, limit?}." },
77
+ // Settings (resolved workspace root, rate limit)
78
+ { method: "GET", path: "/api/agent/settings", auth: "bearer+agent-id", purpose: "Returns rateLimit + resolved 'root' (the active workspace's directory for the X-Workspace you send)." },
77
79
  // Human presence (for editor lease — drives active collab-state)
78
80
  { method: "POST", path: "/api/wiki/presence", auth: "session", purpose: "Human editor lease heartbeat. Body: {path, action:'open'|'heartbeat'|'close'}." },
79
81
  ],
82
+ workspaces: {
83
+ description:
84
+ "This instance can serve multiple root directories ('workspaces'). Every agent path is relative to ONE workspace root.",
85
+ header: "X-Workspace: <workspaceId>",
86
+ queryParam: "ws=<workspaceId>",
87
+ default:
88
+ "If omitted, the server resolves to the most-recently-opened workspace. Correct for single-workspace instances; be explicit when several exist.",
89
+ discoverId:
90
+ "Ask the human for the workspace id, read it from the ?ws= param of a pasted wiki-viewer URL, or call GET /api/agent/settings (with X-Workspace) to confirm the resolved 'root'.",
91
+ scoped:
92
+ "A token may be pinned to one workspace (scope.workspaceId at approval). Requests resolving to a different workspace return 403 FORBIDDEN. A token with no pin is wildcard (any workspace).",
93
+ isolation:
94
+ "Paths in one workspace never touch another, even with identical relative paths.",
95
+ },
80
96
  capabilities: {
81
97
  maxFileBytes: MAX_FILE_BYTES,
82
98
  supportsRange: true,
@@ -85,6 +101,8 @@ export async function GET(req: NextRequest): Promise<NextResponse> {
85
101
  search: ["grep", "glob"],
86
102
  globDialect: "**,*,?",
87
103
  scopeOps: ["read", "mutate", "delete"],
104
+ scopeWorkspaceId: true,
105
+ workspaceHeader: "X-Workspace",
88
106
  collabStates: ["active", "tracked", "untracked", "not-markdown"],
89
107
  collabPrecondition: "If-Collab-Match",
90
108
  },
@@ -103,8 +121,8 @@ export async function GET(req: NextRequest): Promise<NextResponse> {
103
121
  mcpAdapter: {
104
122
  package: "wiki-viewer-mcp",
105
123
  invoke: "npx wiki-viewer-mcp",
106
- env: ["WIKI_VIEWER_URL", "WIKI_VIEWER_TOKEN", "WIKI_VIEWER_AGENT_ID"],
107
- description: "Thin MCP adapter mapping standard MCP filesystem tools onto these endpoints. Reads X-Collab-State and blocks or warns on raw writes to active .md files.",
124
+ env: ["WIKI_VIEWER_URL", "WIKI_VIEWER_TOKEN", "WIKI_VIEWER_AGENT_ID", "WIKI_VIEWER_WORKSPACE"],
125
+ description: "Thin MCP adapter mapping standard MCP filesystem tools onto these endpoints. Set WIKI_VIEWER_WORKSPACE to target a specific workspace (sends X-Workspace on every call). Reads X-Collab-State and blocks or warns on raw writes to active .md files.",
108
126
  },
109
127
  ops: [
110
128
  "block.replace",