drafted 1.11.26 → 1.11.27

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 (2) hide show
  1. package/mcp/server.mjs +17 -5
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -3174,7 +3174,7 @@ tool('wiki', 'Per-org wiki. Markdown pages with paths as hierarchy. You and othe
3174
3174
  action: z.enum(['ls', 'recent', 'read', 'search', 'links', 'log', 'health', 'write', 'edit', 'mv', 'rm', 'source-register', 'source-list', 'source-get', 'bulk-write']).describe('Operation to perform.'),
3175
3175
  path: z.string().optional().describe('[ls|read|links] wiki path. For ls: default / (root). For read: required. For links: required.'),
3176
3176
  pageId: z.string().optional().describe('[read|edit|mv|rm|links] page UUID (from read/search). UUID-first: addresses the page directly, org auto-derives — no org needed and no path lookup. Preferred over path for an existing page.'),
3177
- org: z.string().optional().describe('[write] org slug or id to create/target the page in, without switching the session. Required to create a page when you belong to more than one org and none is bound.'),
3177
+ org: z.string().optional().describe('[write] org slug or id to create/target the page in, without switching the session. [search] scope the search to this org (default: search ALL your orgs). Required to create a page when you belong to more than one org and none is bound.'),
3178
3178
  recursive: z.boolean().optional().describe('[ls] list recursively with depth indicators'),
3179
3179
  limit: z.number().optional().describe('[recent|search] max results (recent default 10, search default 25)'),
3180
3180
  query: z.string().optional().describe('[search] term to search in title, path, and content'),
@@ -3349,11 +3349,23 @@ tool('wiki', 'Per-org wiki. Markdown pages with paths as hierarchy. You and othe
3349
3349
 
3350
3350
  // ── search ──────────────────────────────────────────────────
3351
3351
  case 'search': {
3352
- const { query: searchQuery, limit: searchLimit = 25 } = args;
3352
+ const { query: searchQuery, limit: searchLimit = 25, org: searchOrg } = args;
3353
3353
  if (!searchQuery) throw new Error('query required for action=search');
3354
- const result = await api('GET', `/api/wiki/search?q=${encodeURIComponent(searchQuery)}&limit=${searchLimit}`, undefined, orgHeader);
3355
- // Surface pageId so the agent can re-address the page by UUID (org-free).
3356
- const hits = (result.hits || []).map(h => ({ id: h.id, path: h.path, title: h.title, url: wikiBrowserUrl(h.path) }));
3354
+ // Default: search ALL the caller's orgs (discovery needs no bound org).
3355
+ // An explicit `org` scopes to that one org.
3356
+ const qp = new URLSearchParams({ q: searchQuery, limit: String(searchLimit) });
3357
+ if (!searchOrg) qp.set('scope', 'all');
3358
+ const result = await api('GET', `/api/wiki/search?${qp.toString()}`, undefined, orgHeader);
3359
+ // Surface pageId (re-address by UUID, org-free) + the hit's own org, and
3360
+ // build the URL from the hit's org so cross-org links are correct.
3361
+ const hits = (result.hits || []).map(h => ({
3362
+ id: h.id,
3363
+ path: h.path,
3364
+ title: h.title,
3365
+ org: h.orgName || h.orgSlug || undefined,
3366
+ orgId: h.orgId || undefined,
3367
+ url: wikiPageUrl(h.path, h.orgId || orgId),
3368
+ }));
3357
3369
  markSearched(getSessionState().gates, 'wiki');
3358
3370
  return ok({ hits });
3359
3371
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.11.26",
3
+ "version": "1.11.27",
4
4
  "description": "Drafted — visual thinking surface for humans and AI agents. Renders HTML, markdown, images, and code as frames on a zoomable canvas, with MCP tools for AI agents and real-time sync for humans.",
5
5
  "type": "module",
6
6
  "files": [