@rubytech/create-maxy-code 0.1.184 → 0.1.185

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 (64) hide show
  1. package/dist/__tests__/platform-port-stamp.test.js +4 -0
  2. package/dist/index.js +1 -0
  3. package/dist/port-resolution.js +1 -0
  4. package/package.json +1 -1
  5. package/payload/platform/config/brand.json +1 -1
  6. package/payload/platform/package-lock.json +178 -0
  7. package/payload/platform/plugins/.claude-plugin/marketplace.json +15 -0
  8. package/payload/platform/plugins/admin/PLUGIN.md +0 -1
  9. package/payload/platform/plugins/browser/.claude-plugin/plugin.json +17 -0
  10. package/payload/platform/plugins/browser/PLUGIN.md +44 -0
  11. package/payload/platform/plugins/browser/mcp/dist/index.d.ts +2 -0
  12. package/payload/platform/plugins/browser/mcp/dist/index.d.ts.map +1 -0
  13. package/payload/platform/plugins/browser/mcp/dist/index.js +61 -0
  14. package/payload/platform/plugins/browser/mcp/dist/index.js.map +1 -0
  15. package/payload/platform/plugins/browser/mcp/dist/lib/cdp-render.d.ts +66 -0
  16. package/payload/platform/plugins/browser/mcp/dist/lib/cdp-render.d.ts.map +1 -0
  17. package/payload/platform/plugins/browser/mcp/dist/lib/cdp-render.js +248 -0
  18. package/payload/platform/plugins/browser/mcp/dist/lib/cdp-render.js.map +1 -0
  19. package/payload/platform/plugins/browser/mcp/package.json +19 -0
  20. package/payload/platform/plugins/docs/references/internals.md +1 -1
  21. package/payload/platform/plugins/docs/references/plugins-guide.md +3 -0
  22. package/payload/platform/plugins/docs/references/troubleshooting.md +4 -4
  23. package/payload/platform/plugins/prompt-optimiser/.claude-plugin/plugin.json +8 -0
  24. package/payload/platform/plugins/prompt-optimiser/PLUGIN.md +14 -0
  25. package/payload/platform/plugins/prompt-optimiser/skills/prompt-optimiser/SKILL.md +301 -0
  26. package/payload/platform/plugins/url-get/.claude-plugin/plugin.json +17 -0
  27. package/payload/platform/plugins/url-get/PLUGIN.md +86 -0
  28. package/payload/platform/plugins/url-get/mcp/dist/index.d.ts +9 -0
  29. package/payload/platform/plugins/url-get/mcp/dist/index.d.ts.map +1 -0
  30. package/payload/platform/plugins/url-get/mcp/dist/index.js +53 -0
  31. package/payload/platform/plugins/url-get/mcp/dist/index.js.map +1 -0
  32. package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.d.ts +8 -0
  33. package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.d.ts.map +1 -0
  34. package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.js +83 -0
  35. package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.js.map +1 -0
  36. package/payload/platform/plugins/url-get/mcp/dist/tools/url-get.d.ts +21 -0
  37. package/payload/platform/plugins/url-get/mcp/dist/tools/url-get.d.ts.map +1 -0
  38. package/payload/platform/plugins/url-get/mcp/dist/tools/url-get.js +147 -0
  39. package/payload/platform/plugins/url-get/mcp/dist/tools/url-get.js.map +1 -0
  40. package/payload/platform/plugins/url-get/mcp/package.json +22 -0
  41. package/payload/platform/scripts/setup-account.sh +0 -6
  42. package/payload/platform/scripts/vnc.sh +1 -1
  43. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  44. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +8 -0
  45. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  46. package/payload/platform/services/claude-session-manager/dist/specialist-drift.js +2 -2
  47. package/payload/platform/services/claude-session-manager/dist/specialist-drift.js.map +1 -1
  48. package/payload/platform/templates/specialists/agents/content-producer.md +3 -3
  49. package/payload/platform/templates/specialists/agents/librarian.md +1 -1
  50. package/payload/platform/templates/specialists/agents/personal-assistant.md +3 -3
  51. package/payload/platform/templates/specialists/agents/research-assistant.md +3 -3
  52. package/payload/premium-plugins/writer-craft/mcp/dist/index.d.ts.map +1 -1
  53. package/payload/premium-plugins/writer-craft/mcp/dist/index.js +20 -6
  54. package/payload/premium-plugins/writer-craft/mcp/dist/index.js.map +1 -1
  55. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.d.ts +14 -0
  56. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.d.ts.map +1 -1
  57. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js +28 -34
  58. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js.map +1 -1
  59. package/payload/premium-plugins/writer-craft/mcp/scripts/smoke.mjs +43 -8
  60. package/payload/premium-plugins/writer-craft/mcp/src/index.ts +20 -8
  61. package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-retrieve-conditioning.ts +51 -12
  62. package/payload/premium-plugins/writer-craft/skills/voice-mirror/SKILL.md +7 -1
  63. package/payload/platform/plugins/admin/hooks/__tests__/playwright-file-guard.test.sh +0 -278
  64. package/payload/platform/plugins/admin/hooks/playwright-file-guard.sh +0 -214
@@ -3,7 +3,7 @@ name: personal-assistant
3
3
  description: "Scheduling, platform settings, messaging channels (Telegram, WhatsApp, email, Outlook), tunnel and domain setup, and browser automation. Delegate when the work is on your calendar, configuring the platform, sending or reading messages, or driving a browser."
4
4
  summary: "Handles the operational tasks you'd give a personal assistant: scheduling meetings, managing your platform settings, connecting messaging channels, and completing browser-based tasks on your behalf."
5
5
  model: claude-sonnet-4-6
6
- tools: Skill, mcp__admin__system-status, mcp__admin__brand-settings, mcp__admin__account-manage, mcp__admin__account-update, mcp__admin__logs-read, mcp__admin__plugin-read, mcp__admin__file-attach, mcp__admin__wifi, mcp__contacts__contact-create, mcp__contacts__contact-lookup, mcp__contacts__contact-update, mcp__contacts__contact-delete, mcp__contacts__contact-list, mcp__contacts__contact-export, mcp__contacts__contact-erase, mcp__contacts__group-create, mcp__contacts__group-manage, mcp__telegram__message, mcp__telegram__message-history, mcp__telegram__telegram-webhook-register, mcp__whatsapp__whatsapp-login-start, mcp__whatsapp__whatsapp-login-wait, mcp__whatsapp__whatsapp-status, mcp__whatsapp__whatsapp-disconnect, mcp__whatsapp__whatsapp-send, mcp__whatsapp__whatsapp-send-document, mcp__whatsapp__whatsapp-config, mcp__whatsapp__whatsapp-activity, mcp__whatsapp__whatsapp-conversations, mcp__whatsapp__whatsapp-messages, mcp__whatsapp__whatsapp-conversation-graph-state, mcp__whatsapp__whatsapp-group-info, mcp__email__email-setup, mcp__email__email-read, mcp__email__email-send, mcp__email__email-reply, mcp__email__email-search, mcp__email__email-graph-query, mcp__email__email-otp-extract, mcp__email__email-status, mcp__email__email-fetch, mcp__email__email-ingest, mcp__outlook__outlook-account-register, mcp__outlook__outlook-mail-list, mcp__outlook__outlook-mail-search, mcp__outlook__outlook-calendar-list, mcp__outlook__outlook-calendar-event, mcp__outlook__outlook-contacts-list, mcp__outlook__outlook-mailbox-info, mcp__scheduling__schedule-event, mcp__scheduling__schedule-list, mcp__scheduling__schedule-get, mcp__scheduling__schedule-update, mcp__scheduling__schedule-cancel, mcp__scheduling__schedule-export-ics, mcp__scheduling__schedule-import-ics, mcp__scheduling__time-resolve, mcp__memory__memory-search, mcp__memory__profile-update, mcp__plugin_playwright_playwright__browser_navigate, mcp__plugin_playwright_playwright__browser_navigate_back, mcp__plugin_playwright_playwright__browser_snapshot, mcp__plugin_playwright_playwright__browser_click, mcp__plugin_playwright_playwright__browser_fill, mcp__plugin_playwright_playwright__browser_fill_form, mcp__plugin_playwright_playwright__browser_type, mcp__plugin_playwright_playwright__browser_press_key, mcp__plugin_playwright_playwright__browser_hover, mcp__plugin_playwright_playwright__browser_select_option, mcp__plugin_playwright_playwright__browser_wait_for, mcp__plugin_playwright_playwright__browser_handle_dialog, mcp__plugin_playwright_playwright__browser_evaluate, mcp__plugin_playwright_playwright__browser_console_messages, mcp__plugin_playwright_playwright__browser_resize, mcp__plugin_playwright_playwright__browser_tabs, mcp__plugin_playwright_playwright__browser_close
6
+ tools: Skill, mcp__admin__system-status, mcp__admin__brand-settings, mcp__admin__account-manage, mcp__admin__account-update, mcp__admin__logs-read, mcp__admin__plugin-read, mcp__admin__file-attach, mcp__admin__wifi, mcp__contacts__contact-create, mcp__contacts__contact-lookup, mcp__contacts__contact-update, mcp__contacts__contact-delete, mcp__contacts__contact-list, mcp__contacts__contact-export, mcp__contacts__contact-erase, mcp__contacts__group-create, mcp__contacts__group-manage, mcp__telegram__message, mcp__telegram__message-history, mcp__telegram__telegram-webhook-register, mcp__whatsapp__whatsapp-login-start, mcp__whatsapp__whatsapp-login-wait, mcp__whatsapp__whatsapp-status, mcp__whatsapp__whatsapp-disconnect, mcp__whatsapp__whatsapp-send, mcp__whatsapp__whatsapp-send-document, mcp__whatsapp__whatsapp-config, mcp__whatsapp__whatsapp-activity, mcp__whatsapp__whatsapp-conversations, mcp__whatsapp__whatsapp-messages, mcp__whatsapp__whatsapp-conversation-graph-state, mcp__whatsapp__whatsapp-group-info, mcp__email__email-setup, mcp__email__email-read, mcp__email__email-send, mcp__email__email-reply, mcp__email__email-search, mcp__email__email-graph-query, mcp__email__email-otp-extract, mcp__email__email-status, mcp__email__email-fetch, mcp__email__email-ingest, mcp__outlook__outlook-account-register, mcp__outlook__outlook-mail-list, mcp__outlook__outlook-mail-search, mcp__outlook__outlook-calendar-list, mcp__outlook__outlook-calendar-event, mcp__outlook__outlook-contacts-list, mcp__outlook__outlook-mailbox-info, mcp__scheduling__schedule-event, mcp__scheduling__schedule-list, mcp__scheduling__schedule-get, mcp__scheduling__schedule-update, mcp__scheduling__schedule-cancel, mcp__scheduling__schedule-export-ics, mcp__scheduling__schedule-import-ics, mcp__scheduling__time-resolve, mcp__memory__memory-search, mcp__memory__profile-update, mcp__url-get__url-get, mcp__browser__browser-render
7
7
  ---
8
8
 
9
9
  # Personal Assistant
@@ -38,9 +38,9 @@ Each domain has a small set of tools and, where it exists, a skill that drives t
38
38
 
39
39
  **WhatsApp ToS.** Automated broadcast is forbidden. The platform blocks broadcast for WhatsApp regardless of channel config; do not try to design around it.
40
40
 
41
- **Cloudflare lives in the operator's browser.** Cloudflare exposes zero MCP tools. The operator's logged-in dashboard is the single source of truth. Do not drive the dashboard via Playwright. Do not synthesise `cloudflared` flag combinations. Do not call the Cloudflare API or SDK. Do not edit `cert.pem`, `tunnel.state`, `config.yml`, or `alias-domains.json` directly. When a sanctioned surface fails, report with evidence and cite `plugins/cloudflare/references/reset-guide.md`. User-facing language: "Cloudflare account", "domain", "address", "sign in", "browser". Never say "zone", "CNAME", "account ID", "API", "SDK", or any hexadecimal identifier. After a tunnel script finishes, verify with `curl -I https://<hostname>`; a non-530 response means the tunnel is live.
41
+ **Cloudflare lives in the operator's browser.** Cloudflare exposes zero MCP tools. The operator's logged-in dashboard is the single source of truth. Do not drive the dashboard with a browser tool. Do not synthesise `cloudflared` flag combinations. Do not call the Cloudflare API or SDK. Do not edit `cert.pem`, `tunnel.state`, `config.yml`, or `alias-domains.json` directly. When a sanctioned surface fails, report with evidence and cite `plugins/cloudflare/references/reset-guide.md`. User-facing language: "Cloudflare account", "domain", "address", "sign in", "browser". Never say "zone", "CNAME", "account ID", "API", "SDK", or any hexadecimal identifier. After a tunnel script finishes, verify with `curl -I https://<hostname>`; a non-530 response means the tunnel is live.
42
42
 
43
- **Browser is visible.** Playwright is rendered to the operator's VNC viewer. They see every navigation, every fill, every click. After `browser_navigate`, call `browser_tabs` with `action: "select"` on the current tab index so the VNC viewer shows the page you just opened. Prefer `browser_snapshot` (accessibility tree with `ref` IDs) over `browser_take_screenshot`; take a screenshot only when you need to verify layout, colour, image, or canvas content. Use `browser_fill_form` over repeated `browser_fill`. Use `browser_evaluate` for state checks. Check `browser_console_messages` when something behaves unexpectedly. Dismiss cookie consent before the main task. Report CAPTCHA or bot detection as a blocker; do not try to solve it.
43
+ **Reading JavaScript-rendered pages.** When a page needs JavaScript to show its content and `url-get` comes back empty or as a shell use `browser-render` with the page URL. It renders the page in the device's Chromium and returns the rendered HTML plus the visible text. It is read-only: it does not click, fill, or navigate within a page, and it does not save PDFs or screenshots (an interactive automation surface is tracked in Task 496). Report CAPTCHA or bot detection as a blocker; do not try to solve it.
44
44
 
45
45
  ## Optional capabilities
46
46
 
@@ -3,7 +3,7 @@ name: research-assistant
3
3
  description: "Deep research on the web, knowledge management, and writing structured summaries with citations from multiple sources. Delegate when the operator wants you to research a topic, read web pages, combine findings into a summary, or reorganise stored knowledge."
4
4
  summary: "Researches topics online, manages your knowledge graph, and produces supporting visuals."
5
5
  model: claude-opus-4-7
6
- tools: WebSearch, WebFetch, Skill, mcp__memory__memory-search, mcp__memory__memory-write, mcp__memory__memory-reindex, mcp__replicate__image-generate, mcp__plugin_playwright_playwright__browser_navigate, mcp__plugin_playwright_playwright__browser_snapshot, mcp__plugin_playwright_playwright__browser_evaluate
6
+ tools: WebSearch, WebFetch, Skill, mcp__memory__memory-search, mcp__memory__memory-write, mcp__memory__memory-reindex, mcp__replicate__image-generate, mcp__browser__browser-render, mcp__url-get__url-get
7
7
  ---
8
8
 
9
9
  # Research Assistant
@@ -30,7 +30,7 @@ These three rules win when anything else in this prompt conflicts with them.
30
30
 
31
31
  **Source hierarchy.** Official docs, then primary research, then reputable press, then forums or SEO farms or undated pages. Flag anything older than 18 months as `[possibly outdated]`.
32
32
 
33
- **Fetch and extract.** Pull full page content, extract only what answers the sub-question, note publication date, paraphrase. Use `browser_navigate` + `browser_snapshot` when pages need JavaScript rendering or `WebFetch` returns incomplete content.
33
+ **Fetch and extract.** Pull full page content, extract only what answers the sub-question, note publication date, paraphrase. Use `browser-render` when pages need JavaScript rendering or `WebFetch` returns incomplete content — it renders the page in the device Chromium and returns the rendered HTML and visible text.
34
34
 
35
35
  **Synthesise.** Write a structured response that answers the original question. Cite sources inline as `[1]`, `[2]`. List full sources at the end with title and URL.
36
36
 
@@ -66,7 +66,7 @@ Return to the admin agent: sources (numbered list with title and URL); key findi
66
66
 
67
67
  ## When a tool returns an error
68
68
 
69
- Name the tool, the target URL, and the `[tool-failure-diag]` block if present. State why the alternative you try next should succeed where the first did not. A second identical failure against the same URL is evidence the path is broken: adapt or escalate, do not retry a third time. Silent fallback between `WebFetch` and `browser_navigate` is not acceptable.
69
+ Name the tool, the target URL, and the `[tool-failure-diag]` block if present. State why the alternative you try next should succeed where the first did not. A second identical failure against the same URL is evidence the path is broken: adapt or escalate, do not retry a third time. Silent fallback between `WebFetch` and `browser-render` is not acceptable.
70
70
 
71
71
  ## Plain English
72
72
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAmB,gBAAgB,EAAuB,MAAM,8BAA8B,CAAC;AAsYtG,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAmB,gBAAgB,EAAuB,MAAM,8BAA8B,CAAC;AAkZtG,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -171,7 +171,7 @@ server.tool("voice-distil-profile", "Three-mode tool. mode='sample' (default) wa
171
171
  };
172
172
  }
173
173
  });
174
- server.tool("voice-retrieve-conditioning", "Return the operator's per-format style card and K voice-matched exemplars for a drafting brief. K=5 short-form (length='short'), K=15 long-form (length='long'). Token-budget bounded. format is required (the writing type: text|email|social-post|article|marketing-copy|note). Returns empty {styleCard:null,exemplars:[]} when no profile exists.", {
174
+ server.tool("voice-retrieve-conditioning", "Return the operator's per-format style card and K voice-matched exemplars for a drafting brief. K=5 short-form (length='short'), K=15 long-form (length='long'). Token-budget bounded. format is required (the writing type: text|email|social-post|article|marketing-copy|note). Returns {styleCard, exemplars, status} where status is one of: 'ok' (profile and/or exemplars returned), 'no-data' (no profile exists and the corpus is empty), 'error' (the lookup failed — carries an error message). Drafting falls back to default register on both 'no-data' and 'error', but only 'no-data' means 'you have no voice profile yet' — never report no-profile on 'error'.", {
175
175
  userId: z
176
176
  .string()
177
177
  .optional()
@@ -192,11 +192,18 @@ server.tool("voice-retrieve-conditioning", "Return the operator's per-format sty
192
192
  return refuseNoAccount("voice-retrieve-conditioning");
193
193
  const resolvedUserId = userId ?? resolveUserId();
194
194
  if (!resolvedUserId) {
195
+ // Soft (no isError) so drafting degrades, but status:error keeps this
196
+ // distinct from genuine no-data (Task 493).
195
197
  return {
196
198
  content: [
197
199
  {
198
200
  type: "text",
199
- text: JSON.stringify({ styleCard: null, exemplars: [] }),
201
+ text: JSON.stringify({
202
+ styleCard: null,
203
+ exemplars: [],
204
+ status: "error",
205
+ error: "no userId (no ADMIN_USER_ID in spawn env)",
206
+ }),
200
207
  },
201
208
  ],
202
209
  };
@@ -220,14 +227,21 @@ server.tool("voice-retrieve-conditioning", "Return the operator's per-format sty
220
227
  };
221
228
  }
222
229
  catch (err) {
223
- // Graceful degradation: callers expect {styleCard:null,exemplars:[]}
224
- // on failure, never an error response.
225
- process.stderr.write(`[voice-retrieve] tool error: ${err instanceof Error ? err.message : String(err)}\n`);
230
+ // Graceful degradation: never an error response (no isError) so drafting
231
+ // does not crash but the payload carries status:error so the failure
232
+ // is not masquerading as no-data (Task 493).
233
+ const message = err instanceof Error ? err.message : String(err);
234
+ process.stderr.write(`[voice-retrieve] tool error: ${message}\n`);
226
235
  return {
227
236
  content: [
228
237
  {
229
238
  type: "text",
230
- text: JSON.stringify({ styleCard: null, exemplars: [] }),
239
+ text: JSON.stringify({
240
+ styleCard: null,
241
+ exemplars: [],
242
+ status: "error",
243
+ error: message,
244
+ }),
231
245
  },
232
246
  ],
233
247
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AACtF,aAAa,CAAC,cAAc,CAAC,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,gBAAgB,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OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,6EAA6E;iBACpF;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC;YAC1C,gBAAgB;YAChB,SAAS;YACT,MAAM,EAAE,cAAc;YACtB,SAAS;SACV,CAAC,CAAC;QACH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,4CAA4C,MAAM,CAAC,aAAa,iBAAiB,MAAM,CAAC,YAAY,cAAc,MAAM,CAAC,SAAS,IAAI,SAAS,EAAE;iBACxJ;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,qCAAqC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;iBAC9F;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CACF,CAAC;AAEF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAEhC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IAC/B,MAAM,WAAW,EAAE,CAAC;IACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,0DAA0D;AAC1D,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -25,9 +25,23 @@ export interface VoiceExemplar {
25
25
  body: string;
26
26
  source: string;
27
27
  }
28
+ /**
29
+ * Outcome discriminator (Task 493). Three mutually-exclusive states so the
30
+ * drafting agent and operator can tell genuine no-data apart from a failed
31
+ * lookup — both previously collapsed into the same empty payload:
32
+ * - "ok" — query ran; a style card and/or exemplars were returned.
33
+ * - "no-data" — query ran; no profile exists and the corpus is empty.
34
+ * - "error" — the lookup failed (blank identity, driver/connection
35
+ * fault, or Cypher error). `error` carries the message.
36
+ * Drafting degrades gracefully to default register on both "no-data" and
37
+ * "error"; the caller must only report "no profile exists" on "no-data".
38
+ */
39
+ export type VoiceRetrieveStatus = "ok" | "no-data" | "error";
28
40
  export interface VoiceRetrieveConditioningResult {
29
41
  styleCard: string | null;
30
42
  exemplars: VoiceExemplar[];
43
+ status: VoiceRetrieveStatus;
44
+ error?: string;
31
45
  }
32
46
  export declare function voiceRetrieveConditioning(params: VoiceRetrieveConditioningParams): Promise<VoiceRetrieveConditioningResult>;
33
47
  //# sourceMappingURL=voice-retrieve-conditioning.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"voice-retrieve-conditioning.d.ts","sourceRoot":"","sources":["../../src/tools/voice-retrieve-conditioning.ts"],"names":[],"mappings":"AA4BA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,wBAAwB,CAAC;AAMhC,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;;WAGG;QACH,MAAM,EAAE,WAAW,CAAC;QACpB;;;;WAIG;QACH,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,aAAa,EAAE,CAAC;CAC5B;AAID,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,+BAA+B,CAAC,CAoH1C"}
1
+ {"version":3,"file":"voice-retrieve-conditioning.d.ts","sourceRoot":"","sources":["../../src/tools/voice-retrieve-conditioning.ts"],"names":[],"mappings":"AA+BA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,wBAAwB,CAAC;AAMhC,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;;WAGG;QACH,MAAM,EAAE,WAAW,CAAC;QACpB;;;;WAIG;QACH,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,+BAA+B,CAAC,CAuI1C"}
@@ -1,40 +1,22 @@
1
- /**
2
- * voice-retrieve-conditioning — return the operator's style card plus K
3
- * voice-matched exemplars for a drafting brief.
4
- *
5
- * Task 462 changes:
6
- * - `brief.format` (K-selector: 'short'|'long') renamed to `brief.length`
7
- * to free the name for the new `brief.format: VoiceFormat` axis.
8
- * - `brief.format: VoiceFormat` (required) — corpus exemplars are filtered
9
- * to this writing format; the `:VoiceProfile` is the per-format profile.
10
- * - All callers updated in the same commit.
11
- *
12
- * Retrieval order (best to worst):
13
- * 1. If brief.topic is provided AND keyword search on the per-format corpus
14
- * returns ≥K matches → use those (ordered by recency).
15
- * 2. Otherwise, return the K most-recent per-format corpus nodes.
16
- *
17
- * Embeddings are not used in v1: the corpus is small (single operator's
18
- * personal writing — typically <500 docs), and recency-with-keyword-filter
19
- * is both faster and more predictable than vector ANN at that scale.
20
- * Vector-search is a Task 365-follow-up if the corpus grows beyond the
21
- * 500-doc breakeven point.
22
- *
23
- * Graceful degradation: missing profile, empty corpus, and DB errors all
24
- * return `{styleCard: null, exemplars: []}` rather than throwing — the
25
- * calling drafting skill falls back to its existing default register.
26
- */
27
1
  import { getSession } from "../lib/neo4j.js";
28
2
  import { notTrashed } from "../lib/voice-corpus.js";
29
3
  import { voiceCorpusWhereWithFormat, } from "../lib/voice-corpus.js";
30
4
  const DEFAULT_TOKEN_BUDGET_SHORT = 16_000;
31
5
  const DEFAULT_TOKEN_BUDGET_LONG = 96_000;
32
6
  const CHARS_PER_TOKEN = 4;
33
- const EMPTY = { styleCard: null, exemplars: [] };
7
+ function errorResult(error) {
8
+ return { styleCard: null, exemplars: [], status: "error", error };
9
+ }
34
10
  export async function voiceRetrieveConditioning(params) {
35
11
  const { accountId, userId, brief } = params;
36
- if (!accountId || !userId)
37
- return EMPTY;
12
+ // Blank identity is an error, never genuine no-data — index.ts guards both
13
+ // accountId and userId before calling, so a blank value reaching here is a
14
+ // precondition failure, not "you have no profile". Emit a line so this path
15
+ // is no longer silent (Task 493 — closes the 06:46 path-1 ambiguity).
16
+ if (!accountId || !userId) {
17
+ process.stderr.write(`[voice-retrieve] error: missing-identity accountId=${Boolean(accountId)} userId=${Boolean(userId)}\n`);
18
+ return errorResult("missing accountId/userId");
19
+ }
38
20
  const length = brief.length ?? "short";
39
21
  const k = length === "long" ? 15 : 5;
40
22
  const tokenBudget = params.tokenBudget ??
@@ -42,8 +24,13 @@ export async function voiceRetrieveConditioning(params) {
42
24
  const charBudget = tokenBudget * CHARS_PER_TOKEN;
43
25
  const format = brief.format;
44
26
  const corpusWhere = voiceCorpusWhereWithFormat(format);
45
- const session = getSession();
27
+ // getSession() is inside the try so driver-construction / connection-config
28
+ // faults (NEO4J_URI unset, password file missing) are caught, logged, and
29
+ // returned as the error state rather than escaping the function silently
30
+ // (Task 493).
31
+ let session;
46
32
  try {
33
+ session = getSession();
47
34
  // 1. Style card — per-format profile.
48
35
  const profile = await session.run(`MATCH (a:AdminUser {accountId: $accountId, userId: $userId})
49
36
  OPTIONAL MATCH (a)-[:HAS_VOICE_PROFILE]->(p:VoiceProfile {accountId: $accountId, userId: $userId, format: $format})
@@ -121,14 +108,21 @@ export async function voiceRetrieveConditioning(params) {
121
108
  charsUsed += truncated.length;
122
109
  }
123
110
  process.stderr.write(`[voice-retrieve] task=${brief.topic ?? length} format=${format} styleCardBytes=${styleCard?.length ?? 0} exemplarCount=${exemplars.length} tokenBudget=${tokenBudget}\n`);
124
- return { styleCard, exemplars };
111
+ // An empty-string styleCard with no exemplars is no-data, not ok — a blank
112
+ // card conditions nothing, so reporting "ok" would be the same lie this
113
+ // discriminator exists to prevent (Task 493).
114
+ const hasStyleCard = styleCard !== null && styleCard.length > 0;
115
+ const status = hasStyleCard || exemplars.length > 0 ? "ok" : "no-data";
116
+ return { styleCard, exemplars, status };
125
117
  }
126
118
  catch (err) {
127
- process.stderr.write(`[voice-retrieve] error: ${err instanceof Error ? err.message : String(err)}\n`);
128
- return EMPTY;
119
+ const message = err instanceof Error ? err.message : String(err);
120
+ process.stderr.write(`[voice-retrieve] error: ${message}\n`);
121
+ return errorResult(message);
129
122
  }
130
123
  finally {
131
- await session.close();
124
+ if (session)
125
+ await session.close();
132
126
  }
133
127
  }
134
128
  //# sourceMappingURL=voice-retrieve-conditioning.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"voice-retrieve-conditioning.js","sourceRoot":"","sources":["../../src/tools/voice-retrieve-conditioning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAEL,0BAA0B,GAE3B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAC1C,MAAM,yBAAyB,GAAG,MAAM,CAAC;AACzC,MAAM,eAAe,GAAG,CAAC,CAAC;AAmC1B,MAAM,KAAK,GAAoC,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAElF,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,MAAuC;IAEvC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAC5C,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAExC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,OAAO,CAAC;IACvC,MAAM,CAAC,GAAG,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,WAAW,GACf,MAAM,CAAC,WAAW;QAClB,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC;IAC/E,MAAM,UAAU,GAAG,WAAW,GAAG,eAAe,CAAC;IACjD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,MAAM,WAAW,GAAG,0BAA0B,CAAC,MAAM,C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EAAE,GAAG,CAAC;aACjE,CAAC,CAAC;YACH,SAAS,IAAI,SAAS,CAAC,MAAM,CAAC;QAChC,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,yBAAyB,KAAK,CAAC,KAAK,IAAI,MAAM,WAAW,MAAM,mBAC7D,SAAS,EAAE,MAAM,IAAI,CACvB,kBAAkB,SAAS,CAAC,MAAM,gBAAgB,WAAW,IAAI,CAClE,CAAC;QAEF,2EAA2E;QAC3E,wEAAwE;QACxE,8CAA8C;QAC9C,MAAM,YAAY,GAAG,SAAS,KAAK,IAAI,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;QAChE,MAAM,MAAM,GACV,YAAY,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,OAAO,IAAI,CAAC,CAAC;QAC7D,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;YAAS,CAAC;QACT,IAAI,OAAO;YAAE,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACrC,CAAC;AACH,CAAC"}
@@ -11,8 +11,9 @@
11
11
  * 5. TAGGABLE_PRIMARY_LABELS covers the three content labels.
12
12
  * 6. FORMAT_VALUES covers the six writing-format values (Task 462).
13
13
  * 7. voiceCorpusWhereWithFormat() appends the format predicate.
14
- * * 8. voice-retrieve-conditioning returns the graceful-degradation shape
15
- * {styleCard: null, exemplars: []} on empty accountId/userId.
14
+ * * 8. voice-retrieve-conditioning discriminates error from no-data (Task 493):
15
+ * status:"error" on blank identity and on a forced lookup throw, never
16
+ * collapsing a failed lookup into the no-data payload.
16
17
  * 9. voice-tag-content validates mode and format enums, requires format,
17
18
  * and returns zero counts on empty nodeIds (with format supplied).
18
19
  * 11. voice-ingest-session-text: extractOperatorTurns() extracts real turns
@@ -171,29 +172,63 @@ await check("deriveFormat export is removed from voice-corpus", () => {
171
172
  });
172
173
 
173
174
  // ---------------------------------------------------------------------------
174
- // 5. Graceful-degradation contract for voice-retrieve-conditioning.
175
+ // 5. Error-vs-no-data discrimination for voice-retrieve-conditioning (Task 493).
176
+ // Blank identity and a forced lookup failure must both return status:"error",
177
+ // distinct from the genuine no-data state — so the drafting agent never
178
+ // reports "no profile exists" when the lookup actually errored.
175
179
  // ---------------------------------------------------------------------------
176
- console.log("\n-- graceful-degradation contracts --");
180
+ console.log("\n-- error-vs-no-data discrimination --");
177
181
  await check(
178
- "voice-retrieve-conditioning returns empty shape on missing accountId",
182
+ "voice-retrieve-conditioning returns status:error on missing accountId",
179
183
  async () => {
180
184
  const result = await retrieveMod.voiceRetrieveConditioning({
181
185
  accountId: "",
182
186
  userId: "u",
183
187
  brief: { format: "text", length: "short" },
184
188
  });
185
- assert.deepEqual(result, { styleCard: null, exemplars: [] });
189
+ assert.equal(result.status, "error");
190
+ assert.equal(result.styleCard, null);
191
+ assert.deepEqual(result.exemplars, []);
186
192
  },
187
193
  );
188
194
  await check(
189
- "voice-retrieve-conditioning returns empty shape on missing userId",
195
+ "voice-retrieve-conditioning returns status:error on missing userId",
190
196
  async () => {
191
197
  const result = await retrieveMod.voiceRetrieveConditioning({
192
198
  accountId: "acc",
193
199
  userId: "",
194
200
  brief: { format: "email", length: "long" },
195
201
  });
196
- assert.deepEqual(result, { styleCard: null, exemplars: [] });
202
+ assert.equal(result.status, "error");
203
+ assert.equal(result.styleCard, null);
204
+ assert.deepEqual(result.exemplars, []);
205
+ },
206
+ );
207
+ await check(
208
+ "voice-retrieve-conditioning returns status:error (not no-data) when the lookup throws",
209
+ async () => {
210
+ // Force the Neo4j call to fail: an empty NEO4J_URI makes getSession()
211
+ // throw inside the try block. Save/restore the env and reset the driver
212
+ // singleton so neither this check nor later checks inherit the empty URI.
213
+ const { closeDriver } = await import("../dist/lib/neo4j.js");
214
+ const savedUri = process.env.NEO4J_URI;
215
+ try {
216
+ process.env.NEO4J_URI = "";
217
+ await closeDriver();
218
+ const result = await retrieveMod.voiceRetrieveConditioning({
219
+ accountId: "acc",
220
+ userId: "user",
221
+ brief: { format: "text", length: "short" },
222
+ });
223
+ assert.equal(result.status, "error");
224
+ assert.notEqual(result.status, "no-data");
225
+ assert.equal(result.styleCard, null);
226
+ assert.deepEqual(result.exemplars, []);
227
+ } finally {
228
+ if (savedUri === undefined) delete process.env.NEO4J_URI;
229
+ else process.env.NEO4J_URI = savedUri;
230
+ await closeDriver();
231
+ }
197
232
  },
198
233
  );
199
234
 
@@ -207,7 +207,7 @@ server.tool(
207
207
 
208
208
  server.tool(
209
209
  "voice-retrieve-conditioning",
210
- "Return the operator's per-format style card and K voice-matched exemplars for a drafting brief. K=5 short-form (length='short'), K=15 long-form (length='long'). Token-budget bounded. format is required (the writing type: text|email|social-post|article|marketing-copy|note). Returns empty {styleCard:null,exemplars:[]} when no profile exists.",
210
+ "Return the operator's per-format style card and K voice-matched exemplars for a drafting brief. K=5 short-form (length='short'), K=15 long-form (length='long'). Token-budget bounded. format is required (the writing type: text|email|social-post|article|marketing-copy|note). Returns {styleCard, exemplars, status} where status is one of: 'ok' (profile and/or exemplars returned), 'no-data' (no profile exists and the corpus is empty), 'error' (the lookup failed — carries an error message). Drafting falls back to default register on both 'no-data' and 'error', but only 'no-data' means 'you have no voice profile yet' — never report no-profile on 'error'.",
211
211
  {
212
212
  userId: z
213
213
  .string()
@@ -229,11 +229,18 @@ server.tool(
229
229
  if (!accountId) return refuseNoAccount("voice-retrieve-conditioning");
230
230
  const resolvedUserId = userId ?? resolveUserId();
231
231
  if (!resolvedUserId) {
232
+ // Soft (no isError) so drafting degrades, but status:error keeps this
233
+ // distinct from genuine no-data (Task 493).
232
234
  return {
233
235
  content: [
234
236
  {
235
237
  type: "text" as const,
236
- text: JSON.stringify({ styleCard: null, exemplars: [] }),
238
+ text: JSON.stringify({
239
+ styleCard: null,
240
+ exemplars: [],
241
+ status: "error",
242
+ error: "no userId (no ADMIN_USER_ID in spawn env)",
243
+ }),
237
244
  },
238
245
  ],
239
246
  };
@@ -256,16 +263,21 @@ server.tool(
256
263
  ],
257
264
  };
258
265
  } catch (err) {
259
- // Graceful degradation: callers expect {styleCard:null,exemplars:[]}
260
- // on failure, never an error response.
261
- process.stderr.write(
262
- `[voice-retrieve] tool error: ${err instanceof Error ? err.message : String(err)}\n`,
263
- );
266
+ // Graceful degradation: never an error response (no isError) so drafting
267
+ // does not crash but the payload carries status:error so the failure
268
+ // is not masquerading as no-data (Task 493).
269
+ const message = err instanceof Error ? err.message : String(err);
270
+ process.stderr.write(`[voice-retrieve] tool error: ${message}\n`);
264
271
  return {
265
272
  content: [
266
273
  {
267
274
  type: "text" as const,
268
- text: JSON.stringify({ styleCard: null, exemplars: [] }),
275
+ text: JSON.stringify({
276
+ styleCard: null,
277
+ exemplars: [],
278
+ status: "error",
279
+ error: message,
280
+ }),
269
281
  },
270
282
  ],
271
283
  };
@@ -20,10 +20,13 @@
20
20
  * Vector-search is a Task 365-follow-up if the corpus grows beyond the
21
21
  * 500-doc breakeven point.
22
22
  *
23
- * Graceful degradation: missing profile, empty corpus, and DB errors all
24
- * return `{styleCard: null, exemplars: []}` rather than throwing the
25
- * calling drafting skill falls back to its existing default register.
23
+ * Graceful degradation, discriminated (Task 493): the function never throws.
24
+ * Missing profile / empty corpus returns status "no-data"; a failed lookup
25
+ * (blank identity, driver/connection fault, Cypher error) returns status
26
+ * "error" with the message. The calling drafting skill falls back to its
27
+ * default register on both, but only "no-data" means "you have no profile".
26
28
  */
29
+ import type { Session } from "neo4j-driver";
27
30
  import { getSession } from "../lib/neo4j.js";
28
31
  import { notTrashed } from "../lib/voice-corpus.js";
29
32
  import {
@@ -64,18 +67,44 @@ export interface VoiceExemplar {
64
67
  source: string;
65
68
  }
66
69
 
70
+ /**
71
+ * Outcome discriminator (Task 493). Three mutually-exclusive states so the
72
+ * drafting agent and operator can tell genuine no-data apart from a failed
73
+ * lookup — both previously collapsed into the same empty payload:
74
+ * - "ok" — query ran; a style card and/or exemplars were returned.
75
+ * - "no-data" — query ran; no profile exists and the corpus is empty.
76
+ * - "error" — the lookup failed (blank identity, driver/connection
77
+ * fault, or Cypher error). `error` carries the message.
78
+ * Drafting degrades gracefully to default register on both "no-data" and
79
+ * "error"; the caller must only report "no profile exists" on "no-data".
80
+ */
81
+ export type VoiceRetrieveStatus = "ok" | "no-data" | "error";
82
+
67
83
  export interface VoiceRetrieveConditioningResult {
68
84
  styleCard: string | null;
69
85
  exemplars: VoiceExemplar[];
86
+ status: VoiceRetrieveStatus;
87
+ error?: string;
70
88
  }
71
89
 
72
- const EMPTY: VoiceRetrieveConditioningResult = { styleCard: null, exemplars: [] };
90
+ function errorResult(error: string): VoiceRetrieveConditioningResult {
91
+ return { styleCard: null, exemplars: [], status: "error", error };
92
+ }
73
93
 
74
94
  export async function voiceRetrieveConditioning(
75
95
  params: VoiceRetrieveConditioningParams,
76
96
  ): Promise<VoiceRetrieveConditioningResult> {
77
97
  const { accountId, userId, brief } = params;
78
- if (!accountId || !userId) return EMPTY;
98
+ // Blank identity is an error, never genuine no-data — index.ts guards both
99
+ // accountId and userId before calling, so a blank value reaching here is a
100
+ // precondition failure, not "you have no profile". Emit a line so this path
101
+ // is no longer silent (Task 493 — closes the 06:46 path-1 ambiguity).
102
+ if (!accountId || !userId) {
103
+ process.stderr.write(
104
+ `[voice-retrieve] error: missing-identity accountId=${Boolean(accountId)} userId=${Boolean(userId)}\n`,
105
+ );
106
+ return errorResult("missing accountId/userId");
107
+ }
79
108
 
80
109
  const length = brief.length ?? "short";
81
110
  const k = length === "long" ? 15 : 5;
@@ -86,8 +115,13 @@ export async function voiceRetrieveConditioning(
86
115
  const format = brief.format;
87
116
  const corpusWhere = voiceCorpusWhereWithFormat(format);
88
117
 
89
- const session = getSession();
118
+ // getSession() is inside the try so driver-construction / connection-config
119
+ // faults (NEO4J_URI unset, password file missing) are caught, logged, and
120
+ // returned as the error state rather than escaping the function silently
121
+ // (Task 493).
122
+ let session: Session | undefined;
90
123
  try {
124
+ session = getSession();
91
125
  // 1. Style card — per-format profile.
92
126
  const profile = await session.run(
93
127
  `MATCH (a:AdminUser {accountId: $accountId, userId: $userId})
@@ -180,13 +214,18 @@ export async function voiceRetrieveConditioning(
180
214
  } exemplarCount=${exemplars.length} tokenBudget=${tokenBudget}\n`,
181
215
  );
182
216
 
183
- return { styleCard, exemplars };
217
+ // An empty-string styleCard with no exemplars is no-data, not ok — a blank
218
+ // card conditions nothing, so reporting "ok" would be the same lie this
219
+ // discriminator exists to prevent (Task 493).
220
+ const hasStyleCard = styleCard !== null && styleCard.length > 0;
221
+ const status: VoiceRetrieveStatus =
222
+ hasStyleCard || exemplars.length > 0 ? "ok" : "no-data";
223
+ return { styleCard, exemplars, status };
184
224
  } catch (err) {
185
- process.stderr.write(
186
- `[voice-retrieve] error: ${err instanceof Error ? err.message : String(err)}\n`,
187
- );
188
- return EMPTY;
225
+ const message = err instanceof Error ? err.message : String(err);
226
+ process.stderr.write(`[voice-retrieve] error: ${message}\n`);
227
+ return errorResult(message);
189
228
  } finally {
190
- await session.close();
229
+ if (session) await session.close();
191
230
  }
192
231
  }
@@ -126,7 +126,13 @@ exemplars:
126
126
 
127
127
  Drafting skills inject both blocks into their prompt. Opt-out is per-skill: declare `voiceMirror: false` in the skill's frontmatter and the calling site skips the fetch. Default is on.
128
128
 
129
- If the `:VoiceProfile` for the requested format does not yet exist (corpus too small, or distillation never run), the tool returns `{styleCard: null, exemplars: []}` and the calling skill falls back to its existing default register. No error, no draft refusal.
129
+ The tool returns `{styleCard, exemplars, status}` with a discriminated `status` (Task 493):
130
+
131
+ - **`ok`** — a profile and/or exemplars were returned; inject both blocks.
132
+ - **`no-data`** — the lookup ran but no `:VoiceProfile` exists for this format and the corpus is empty (too small, or distillation never run). Fall back to default register; if the operator asks, this is the only state where you say "you have no voice profile yet".
133
+ - **`error`** — the lookup failed (the payload carries an `error` message). Fall back to default register *exactly as for no-data* so drafting never crashes — but **never** tell the operator they have no profile; the profile state is unknown because the lookup errored.
134
+
135
+ In all three states drafting proceeds: `no-data` and `error` both degrade to the default register, no draft refusal. The distinction matters only for what you tell the operator about *why* their voice was not applied.
130
136
 
131
137
  Emit `[voice-retrieve] task=<brief> format=<format> styleCardBytes=<n> exemplarCount=<k> tokenBudget=<n>` per call.
132
138