drafted 1.11.26 → 1.11.28

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/install-mcp.sh CHANGED
@@ -215,7 +215,23 @@ export PATH="$HOME/.drafted/npm-global/bin:$PATH"
215
215
 
216
216
  step "Installing Drafted"
217
217
 
218
- npm install -g drafted@latest --force
218
+ # Retry with back-off: a fresh `npm publish` can briefly 404/ETARGET on the CDN
219
+ # edge before the tarball propagates, so an updater that fires the instant a new
220
+ # version lands would otherwise report a spurious "update failed". Ride it out.
221
+ install_drafted_pkg() {
222
+ attempts=5; delay=4; n=1
223
+ while :; do
224
+ if npm install -g drafted@latest --force; then return 0; fi
225
+ if [ "$n" -ge "$attempts" ]; then return 1; fi
226
+ echo -e " ${YELLOW}npm install failed (attempt $n/$attempts) — retrying in ${delay}s (a new release may still be propagating to the npm CDN)...${RESET}"
227
+ sleep "$delay"
228
+ n=$((n + 1)); delay=$((delay * 2))
229
+ done
230
+ }
231
+ if ! install_drafted_pkg; then
232
+ echo -e " ${RED}npm install -g drafted@latest failed after multiple attempts.${RESET}"
233
+ exit 1
234
+ fi
219
235
  hash -r 2>/dev/null || true
220
236
  NPM_ROOT="$(npm root -g 2>/dev/null || true)"
221
237
  MCP_SERVER_MODULE="$NPM_ROOT/drafted/mcp/server.mjs"
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.28",
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": [