@rubytech/create-maxy-code 0.1.169 → 0.1.171

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 (169) hide show
  1. package/dist/__tests__/premium-mcp-discover.test.js +42 -0
  2. package/dist/lib/premium-mcp-discover.js +9 -2
  3. package/package.json +1 -1
  4. package/payload/platform/plugins/.claude-plugin/marketplace.json +0 -15
  5. package/payload/platform/plugins/docs/references/platform.md +1 -1
  6. package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.d.ts +51 -0
  7. package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.d.ts.map +1 -0
  8. package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.js +196 -0
  9. package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.js.map +1 -0
  10. package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/package.json +7 -0
  11. package/payload/premium-plugins/writer-craft/mcp/dist/index.d.ts +3 -0
  12. package/payload/premium-plugins/writer-craft/mcp/dist/index.d.ts.map +1 -0
  13. package/payload/premium-plugins/writer-craft/mcp/dist/index.js +257 -0
  14. package/payload/premium-plugins/writer-craft/mcp/dist/index.js.map +1 -0
  15. package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.d.ts +14 -0
  16. package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.d.ts.map +1 -0
  17. package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.js +47 -0
  18. package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.js.map +1 -0
  19. package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.d.ts +42 -0
  20. package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.d.ts.map +1 -0
  21. package/payload/{platform/plugins/writer-craft/mcp/src/lib/voice-corpus.ts → premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.js} +5 -5
  22. package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.js.map +1 -0
  23. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.d.ts +36 -0
  24. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.d.ts.map +1 -0
  25. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.js +225 -0
  26. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.js.map +1 -0
  27. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.d.ts +26 -0
  28. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.d.ts.map +1 -0
  29. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.js +74 -0
  30. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.js.map +1 -0
  31. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.d.ts +22 -0
  32. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.d.ts.map +1 -0
  33. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js +102 -0
  34. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js.map +1 -0
  35. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.d.ts +14 -0
  36. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.d.ts.map +1 -0
  37. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.js +84 -0
  38. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.js.map +1 -0
  39. package/payload/premium-plugins/writer-craft/mcp/package-lock.json +1327 -0
  40. package/payload/server/{chunk-3TRIXQSJ.js → chunk-L2YK2VK3.js} +17 -29
  41. package/payload/server/maxy-edge.js +1 -1
  42. package/payload/server/server.js +1 -1
  43. package/payload/platform/plugins/teaching/.claude-plugin/plugin.json +0 -8
  44. package/payload/platform/plugins/teaching/PLUGIN.md +0 -58
  45. package/payload/platform/plugins/teaching/skills/interactive-tutor/SKILL.md +0 -59
  46. package/payload/platform/plugins/teaching/skills/interactive-tutor/references/assessment.md +0 -70
  47. package/payload/platform/plugins/teaching/skills/interactive-tutor/references/classroom-conduct.md +0 -43
  48. package/payload/platform/plugins/teaching/skills/interactive-tutor/references/teaching-modes.md +0 -83
  49. package/payload/platform/plugins/teaching/skills/lesson-planner/SKILL.md +0 -48
  50. package/payload/platform/plugins/teaching/skills/lesson-planner/references/context-gathering.md +0 -41
  51. package/payload/platform/plugins/teaching/skills/lesson-planner/references/plan-structure.md +0 -94
  52. package/payload/platform/plugins/teaching/skills/study-pack-builder/SKILL.md +0 -52
  53. package/payload/platform/plugins/teaching/skills/study-pack-builder/references/disaggregation.md +0 -49
  54. package/payload/platform/plugins/teaching/skills/study-pack-builder/references/materials.md +0 -116
  55. package/payload/platform/plugins/venture-studio/.claude-plugin/plugin.json +0 -8
  56. package/payload/platform/plugins/venture-studio/PLUGIN.md +0 -119
  57. package/payload/platform/plugins/venture-studio/bin/scaffold.sh +0 -116
  58. package/payload/platform/plugins/venture-studio/skills/brand-pack/SKILL.md +0 -256
  59. package/payload/platform/plugins/venture-studio/skills/brand-pack/references/color-psychology.md +0 -118
  60. package/payload/platform/plugins/venture-studio/skills/investor-data-room/SKILL.md +0 -376
  61. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/business-plan-template.md +0 -64
  62. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/compliance-research-checklist.md +0 -53
  63. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/data-room-structure.md +0 -88
  64. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/deck-blueprint-template.md +0 -39
  65. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/design-tokens-application.md +0 -79
  66. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/html-pdf-pipeline.md +0 -236
  67. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/internal-workings-scrub.md +0 -33
  68. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/termsheet-template.md +0 -88
  69. package/payload/platform/plugins/venture-studio/skills/investor-data-room/templates/prospectus/index.html +0 -1565
  70. package/payload/platform/plugins/venture-studio/skills/investor-data-room/templates/prospectus/render-pdf.mjs +0 -91
  71. package/payload/platform/plugins/venture-studio/skills/investor-data-room/templates/prospectus/term_sheet.html +0 -715
  72. package/payload/platform/plugins/venture-studio/skills/office-hours/SKILL.md +0 -587
  73. package/payload/platform/plugins/venture-studio/skills/prototype-host/SKILL.md +0 -179
  74. package/payload/platform/plugins/venture-studio/skills/prototype-host/references/cloudflared-ingress-edit.md +0 -81
  75. package/payload/platform/plugins/venture-studio/skills/prototype-host/references/scaffold-frameworks.md +0 -60
  76. package/payload/platform/plugins/venture-studio/skills/prototype-host/references/systemd-user-service.md +0 -104
  77. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/SKILL.md +0 -336
  78. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/aarrr-metrics.md +0 -275
  79. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/assumption-testing.md +0 -93
  80. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/boolean-search.md +0 -308
  81. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/build-measure-learn.md +0 -262
  82. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/business-model-canvas.md +0 -171
  83. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/commitment-signals.md +0 -246
  84. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/design-thinking.md +0 -183
  85. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/earlyvangelist.md +0 -190
  86. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/first-principles.md +0 -58
  87. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/fishbone.md +0 -114
  88. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/five-whys.md +0 -43
  89. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/ice-scoring.md +0 -237
  90. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/innovation-accounting.md +0 -290
  91. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/jtbd.md +0 -105
  92. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/landing-page.md +0 -361
  93. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/market-type.md +0 -167
  94. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/mom-test.md +0 -193
  95. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/mvp-types.md +0 -200
  96. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/og-images.md +0 -239
  97. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/pareto.md +0 -103
  98. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/persona-development.md +0 -291
  99. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/pivot-types.md +0 -225
  100. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/positioning-statement.md +0 -179
  101. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/prd.md +0 -363
  102. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/pre-mortem.md +0 -74
  103. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/problem-validation.md +0 -253
  104. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/product-market-fit.md +0 -256
  105. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/research-synthesis.md +0 -276
  106. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/three-engines-of-growth.md +0 -248
  107. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/validation-tests.md +0 -89
  108. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/value-proposition-canvas.md +0 -121
  109. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/win-loss-analysis.md +0 -242
  110. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/workflow-mapping.md +0 -271
  111. package/payload/platform/plugins/writer-craft/.claude-plugin/plugin.json +0 -17
  112. package/payload/platform/plugins/writer-craft/PLUGIN.md +0 -130
  113. package/payload/platform/plugins/writer-craft/agents/writer-craft--manuscript-reviewer.md +0 -96
  114. package/payload/platform/plugins/writer-craft/mcp/package.json +0 -19
  115. package/payload/platform/plugins/writer-craft/mcp/scripts/smoke.mjs +0 -152
  116. package/payload/platform/plugins/writer-craft/mcp/src/index.ts +0 -289
  117. package/payload/platform/plugins/writer-craft/mcp/src/lib/neo4j.ts +0 -56
  118. package/payload/platform/plugins/writer-craft/mcp/src/tools/voice-distil-profile.ts +0 -303
  119. package/payload/platform/plugins/writer-craft/mcp/src/tools/voice-record-feedback.ts +0 -114
  120. package/payload/platform/plugins/writer-craft/mcp/src/tools/voice-retrieve-conditioning.ts +0 -145
  121. package/payload/platform/plugins/writer-craft/mcp/src/tools/voice-tag-content.ts +0 -117
  122. package/payload/platform/plugins/writer-craft/mcp/tsconfig.json +0 -8
  123. package/payload/platform/plugins/writer-craft/skills/citation-style/SKILL.md +0 -94
  124. package/payload/platform/plugins/writer-craft/skills/citation-style/references/book-and-chapter-models.md +0 -77
  125. package/payload/platform/plugins/writer-craft/skills/citation-style/references/citation-rules.md +0 -103
  126. package/payload/platform/plugins/writer-craft/skills/citation-style/references/journal-article-models.md +0 -74
  127. package/payload/platform/plugins/writer-craft/skills/citation-style/references/other-source-models.md +0 -146
  128. package/payload/platform/plugins/writer-craft/skills/citation-style/references/reference-list-rules.md +0 -70
  129. package/payload/platform/plugins/writer-craft/skills/editorial-practice/SKILL.md +0 -108
  130. package/payload/platform/plugins/writer-craft/skills/editorial-practice/references/copyediting.md +0 -73
  131. package/payload/platform/plugins/writer-craft/skills/editorial-practice/references/developmental-editing.md +0 -85
  132. package/payload/platform/plugins/writer-craft/skills/editorial-practice/references/genre-specific-editing.md +0 -78
  133. package/payload/platform/plugins/writer-craft/skills/editorial-practice/references/line-editing.md +0 -55
  134. package/payload/platform/plugins/writer-craft/skills/editorial-practice/references/self-editing.md +0 -89
  135. package/payload/platform/plugins/writer-craft/skills/persuasive-storytelling/SKILL.md +0 -114
  136. package/payload/platform/plugins/writer-craft/skills/persuasive-storytelling/references/audience-analysis.md +0 -73
  137. package/payload/platform/plugins/writer-craft/skills/persuasive-storytelling/references/crafting-persuasive-story.md +0 -76
  138. package/payload/platform/plugins/writer-craft/skills/persuasive-storytelling/references/persuasion-case-studies.md +0 -67
  139. package/payload/platform/plugins/writer-craft/skills/persuasive-storytelling/references/transformation-framework.md +0 -86
  140. package/payload/platform/plugins/writer-craft/skills/point-of-view/SKILL.md +0 -97
  141. package/payload/platform/plugins/writer-craft/skills/point-of-view/references/indirect-narration.md +0 -72
  142. package/payload/platform/plugins/writer-craft/skills/point-of-view/references/pov-types-and-voice.md +0 -91
  143. package/payload/platform/plugins/writer-craft/skills/point-of-view/references/protagonist-filter.md +0 -71
  144. package/payload/platform/plugins/writer-craft/skills/point-of-view/references/tense-and-person.md +0 -85
  145. package/payload/platform/plugins/writer-craft/skills/prose-craft/SKILL.md +0 -100
  146. package/payload/platform/plugins/writer-craft/skills/prose-craft/references/punctuation-and-grammar.md +0 -72
  147. package/payload/platform/plugins/writer-craft/skills/prose-craft/references/repetition.md +0 -71
  148. package/payload/platform/plugins/writer-craft/skills/prose-craft/references/sound-and-rhythm.md +0 -64
  149. package/payload/platform/plugins/writer-craft/skills/prose-craft/references/word-economy.md +0 -93
  150. package/payload/platform/plugins/writer-craft/skills/reader-engagement/SKILL.md +0 -100
  151. package/payload/platform/plugins/writer-craft/skills/reader-engagement/references/cause-effect-setup-payoff.md +0 -79
  152. package/payload/platform/plugins/writer-craft/skills/reader-engagement/references/conflict-escalation.md +0 -81
  153. package/payload/platform/plugins/writer-craft/skills/reader-engagement/references/hooking-readers.md +0 -67
  154. package/payload/platform/plugins/writer-craft/skills/reader-engagement/references/neurochemistry-of-engagement.md +0 -94
  155. package/payload/platform/plugins/writer-craft/skills/review-manuscript/SKILL.md +0 -111
  156. package/payload/platform/plugins/writer-craft/skills/review-manuscript/references/review-manuscript-checklist.md +0 -119
  157. package/payload/platform/plugins/writer-craft/skills/review-prose/SKILL.md +0 -99
  158. package/payload/platform/plugins/writer-craft/skills/review-prose/references/prose-review-checklist.md +0 -112
  159. package/payload/platform/plugins/writer-craft/skills/review-scene/SKILL.md +0 -99
  160. package/payload/platform/plugins/writer-craft/skills/review-scene/references/scene-analysis-framework.md +0 -95
  161. package/payload/platform/plugins/writer-craft/skills/story-architecture/SKILL.md +0 -106
  162. package/payload/platform/plugins/writer-craft/skills/story-architecture/references/blueprinting-and-scene-cards.md +0 -118
  163. package/payload/platform/plugins/writer-craft/skills/story-architecture/references/inner-issue-and-protagonist-goal.md +0 -66
  164. package/payload/platform/plugins/writer-craft/skills/story-architecture/references/misbelief-desire-worldview.md +0 -87
  165. package/payload/platform/plugins/writer-craft/skills/story-architecture/references/origin-scenes-and-escalation.md +0 -82
  166. package/payload/platform/plugins/writer-craft/skills/story-blueprint/SKILL.md +0 -133
  167. package/payload/platform/plugins/writer-craft/skills/story-blueprint/references/blueprinting-exercises.md +0 -118
  168. package/payload/platform/plugins/writer-craft/skills/story-blueprint/references/blueprinting-process.md +0 -128
  169. package/payload/platform/plugins/writer-craft/skills/voice-mirror/SKILL.md +0 -166
@@ -0,0 +1,257 @@
1
+ import { initStderrTee } from "../../lib/mcp-stderr-tee/dist/index.js";
2
+ initStderrTee("writer-craft");
3
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
+ import { z } from "zod";
6
+ import { voiceTagContent, AUTHORSHIP_MODES } from "./tools/voice-tag-content.js";
7
+ import { voiceDistilProfile } from "./tools/voice-distil-profile.js";
8
+ import { voiceRetrieveConditioning } from "./tools/voice-retrieve-conditioning.js";
9
+ import { voiceRecordFeedback } from "./tools/voice-record-feedback.js";
10
+ import { closeDriver } from "./lib/neo4j.js";
11
+ const server = new McpServer({
12
+ name: "maxy-writer-craft",
13
+ version: "0.1.0",
14
+ });
15
+ // Plugin-system boot tolerance — module-init must never throw. Per-call
16
+ // refusal preserves account isolation. Mirrors the memory plugin's
17
+ // pattern (Task 202).
18
+ const accountId = process.env.ACCOUNT_ID ?? null;
19
+ const adminUserIdEnv = process.env.ADMIN_USER_ID ?? null;
20
+ process.stderr.write(`[writer-craft] boot accountId=${accountId ?? "null"} adminUserId=${adminUserIdEnv ?? "null"}\n`);
21
+ function refuseNoAccount(toolName) {
22
+ process.stderr.write(`[writer-craft] tool=${toolName} refuse reason=no-account-context\n`);
23
+ return {
24
+ content: [
25
+ {
26
+ type: "text",
27
+ text: `${toolName} cannot execute: this MCP instance was launched without ACCOUNT_ID. Per-account graph access requires ACCOUNT_ID at spawn.`,
28
+ },
29
+ ],
30
+ isError: true,
31
+ };
32
+ }
33
+ function resolveAdminUserId() {
34
+ // ADMIN_USER_ID is stamped by the admin session manager at spawn time.
35
+ // When absent (e.g. specialist subagents), the operator must pass it as
36
+ // a tool argument or the tools refuse rather than orphan a profile.
37
+ return adminUserIdEnv;
38
+ }
39
+ server.tool("voice-tag-content", "Stamp authorshipMode on one or many content nodes (:KnowledgeDocument | :Message | :SocialPost) the operator owns. Email threads live as :KnowledgeDocument {source:'email'} since Task 321. Valid modes: human-only, human-led-agent-assisted, agent-led-human-reviewed, agent-only, unknown.", {
40
+ nodeIds: z.array(z.string()).min(1).describe("Element IDs of nodes to tag"),
41
+ mode: z
42
+ .enum([
43
+ "human-only",
44
+ "human-led-agent-assisted",
45
+ "agent-led-human-reviewed",
46
+ "agent-only",
47
+ "unknown",
48
+ ])
49
+ .describe("Authorship mode to apply"),
50
+ }, async ({ nodeIds, mode }) => {
51
+ if (!accountId)
52
+ return refuseNoAccount("voice-tag-content");
53
+ try {
54
+ const result = await voiceTagContent({
55
+ nodeIds,
56
+ mode: mode,
57
+ accountId,
58
+ });
59
+ return {
60
+ content: [
61
+ {
62
+ type: "text",
63
+ text: `voice-tag: mode=${mode} updated=${result.updated} skipped=${result.skipped}`,
64
+ },
65
+ ],
66
+ };
67
+ }
68
+ catch (err) {
69
+ return {
70
+ content: [
71
+ {
72
+ type: "text",
73
+ text: `voice-tag-content failed: ${err instanceof Error ? err.message : String(err)}`,
74
+ },
75
+ ],
76
+ isError: true,
77
+ };
78
+ }
79
+ });
80
+ server.tool("voice-distil-profile", "Two-mode tool (Task 424). mode='sample' (default) walks the operator's human-only corpus, returns the exemplars + recent operator-edit intents for the agent to read. mode='write' persists the YAML style card the agent composed from the sample-mode response. Cadence-guarded: returns skip in 'write' mode without writing if corpus didn't grow ≥20% AND <30 days passed (pass force=true to override).", {
81
+ adminUserId: z
82
+ .string()
83
+ .optional()
84
+ .describe("Operator AdminUser identifier. Defaults to ADMIN_USER_ID env from spawn context."),
85
+ force: z
86
+ .boolean()
87
+ .optional()
88
+ .describe("Override cadence guard; rebuild even if recent."),
89
+ mode: z
90
+ .enum(["sample", "write"])
91
+ .optional()
92
+ .describe("'sample' returns corpus exemplars + feedback for in-turn distillation; 'write' persists the agent-produced styleCardYaml."),
93
+ styleCardYaml: z
94
+ .string()
95
+ .optional()
96
+ .describe("Required for mode='write'. The YAML style card the agent composed from the sample-mode exemplars + feedback intents."),
97
+ }, async ({ adminUserId, force, mode, styleCardYaml }) => {
98
+ if (!accountId)
99
+ return refuseNoAccount("voice-distil-profile");
100
+ const resolvedAdminUserId = adminUserId ?? resolveAdminUserId();
101
+ if (!resolvedAdminUserId) {
102
+ return {
103
+ content: [
104
+ {
105
+ type: "text",
106
+ text: "voice-distil-profile: adminUserId required (no ADMIN_USER_ID in spawn env).",
107
+ },
108
+ ],
109
+ isError: true,
110
+ };
111
+ }
112
+ try {
113
+ const result = await voiceDistilProfile({
114
+ accountId,
115
+ adminUserId: resolvedAdminUserId,
116
+ force: force === true,
117
+ mode,
118
+ styleCardYaml,
119
+ });
120
+ const summary = result.skipped
121
+ ? (result.exemplars
122
+ ? `voice-distil sample: corpusSize=${result.corpusSize} exemplars=${result.exemplars.length} feedbackEntries=${result.feedbackEntries}\n${JSON.stringify({ exemplars: result.exemplars, feedbackIntents: result.feedbackIntents }, null, 2)}`
123
+ : `voice-distil: skipped reason=${result.skipReason} corpusSize=${result.corpusSize}`)
124
+ : `voice-distil: ok profileId=${result.profileId} corpusSize=${result.corpusSize} feedbackEntries=${result.feedbackEntries} generatedAt=${result.generatedAt}`;
125
+ return { content: [{ type: "text", text: summary }] };
126
+ }
127
+ catch (err) {
128
+ return {
129
+ content: [
130
+ {
131
+ type: "text",
132
+ text: `voice-distil-profile failed: ${err instanceof Error ? err.message : String(err)}`,
133
+ },
134
+ ],
135
+ isError: true,
136
+ };
137
+ }
138
+ });
139
+ server.tool("voice-retrieve-conditioning", "Return the operator's style card and K voice-matched exemplars for a drafting brief. K=5 short-form, K=15 long-form. Token-budget bounded. Returns empty {styleCard:null,exemplars:[]} when no profile exists.", {
140
+ adminUserId: z
141
+ .string()
142
+ .optional()
143
+ .describe("Operator AdminUser identifier. Defaults to ADMIN_USER_ID env."),
144
+ topic: z
145
+ .string()
146
+ .optional()
147
+ .describe("Drafting topic keyword (filters exemplars to relevant ones)"),
148
+ format: z
149
+ .enum(["short", "long"])
150
+ .describe("Short = email/post (K=5, 16k tokens); long = brochure/prospectus (K=15, 96k tokens)"),
151
+ register: z.string().optional().describe("Optional register hint"),
152
+ tokenBudget: z.number().int().positive().optional(),
153
+ }, async ({ adminUserId, topic, format, register, tokenBudget }) => {
154
+ if (!accountId)
155
+ return refuseNoAccount("voice-retrieve-conditioning");
156
+ const resolvedAdminUserId = adminUserId ?? resolveAdminUserId();
157
+ if (!resolvedAdminUserId) {
158
+ return {
159
+ content: [
160
+ {
161
+ type: "text",
162
+ text: JSON.stringify({ styleCard: null, exemplars: [] }),
163
+ },
164
+ ],
165
+ };
166
+ }
167
+ try {
168
+ const result = await voiceRetrieveConditioning({
169
+ accountId,
170
+ adminUserId: resolvedAdminUserId,
171
+ brief: { topic, format, register },
172
+ tokenBudget,
173
+ });
174
+ return {
175
+ content: [
176
+ { type: "text", text: JSON.stringify(result) },
177
+ ],
178
+ };
179
+ }
180
+ catch (err) {
181
+ // Graceful degradation: callers expect {styleCard:null,exemplars:[]}
182
+ // on failure, never an error response.
183
+ process.stderr.write(`[voice-retrieve] tool error: ${err instanceof Error ? err.message : String(err)}\n`);
184
+ return {
185
+ content: [
186
+ {
187
+ type: "text",
188
+ text: JSON.stringify({ styleCard: null, exemplars: [] }),
189
+ },
190
+ ],
191
+ };
192
+ }
193
+ });
194
+ server.tool("voice-record-feedback", "Capture an operator's edit on an agent draft. Writes :VoiceEdit linked to :VoiceProfile via :FEEDBACK_FOR. The calling agent supplies `intent` (one sentence describing what the operator changed and what voice preference it reveals); Task 424 moved the diff-intent summarisation into the agent's turn.", {
195
+ adminUserId: z.string().optional(),
196
+ originalText: z.string().min(1),
197
+ editedText: z.string().min(1),
198
+ intent: z
199
+ .string()
200
+ .min(1)
201
+ .describe("One sentence summarising what changed and what voice preference it reveals — produced by the calling agent in-turn from originalText vs editedText (Task 424)."),
202
+ skill: z.string().optional().describe("Calling skill name, for provenance"),
203
+ brief: z.string().optional().describe("Drafting brief that produced the original"),
204
+ }, async ({ adminUserId, originalText, editedText, intent, skill, brief }) => {
205
+ if (!accountId)
206
+ return refuseNoAccount("voice-record-feedback");
207
+ const resolvedAdminUserId = adminUserId ?? resolveAdminUserId();
208
+ if (!resolvedAdminUserId) {
209
+ return {
210
+ content: [
211
+ {
212
+ type: "text",
213
+ text: "voice-record-feedback: adminUserId required (no ADMIN_USER_ID in spawn env).",
214
+ },
215
+ ],
216
+ isError: true,
217
+ };
218
+ }
219
+ try {
220
+ const result = await voiceRecordFeedback({
221
+ accountId,
222
+ adminUserId: resolvedAdminUserId,
223
+ originalText,
224
+ editedText,
225
+ intent,
226
+ context: { skill, brief },
227
+ });
228
+ return {
229
+ content: [
230
+ {
231
+ type: "text",
232
+ text: `voice-record-feedback: editId=${result.editId} intent="${result.intent}" hadProfile=${result.hadProfile}`,
233
+ },
234
+ ],
235
+ };
236
+ }
237
+ catch (err) {
238
+ return {
239
+ content: [
240
+ {
241
+ type: "text",
242
+ text: `voice-record-feedback failed: ${err instanceof Error ? err.message : String(err)}`,
243
+ },
244
+ ],
245
+ isError: true,
246
+ };
247
+ }
248
+ });
249
+ const transport = new StdioServerTransport();
250
+ await server.connect(transport);
251
+ process.on("SIGTERM", async () => {
252
+ await closeDriver();
253
+ process.exit(0);
254
+ });
255
+ // Surface AUTHORSHIP_MODES for downstream callers / docs.
256
+ export { AUTHORSHIP_MODES };
257
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,EAAuB,MAAM,8BAA8B,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,mBAAmB;IACzB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,wEAAwE;AACxE,mEAAmE;AACnE,sBAAsB;AACtB,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI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EH,0DAA0D;AAC1D,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Minimal neo4j driver wrapper for the writer-craft MCP server.
3
+ *
4
+ * Mirrors the public surface of `platform/plugins/memory/mcp/src/lib/neo4j.ts`:
5
+ * `getSession()` returns a session, `closeDriver()` releases the singleton.
6
+ * Password resolution follows the same `PLATFORM_ROOT/config/.neo4j-password`
7
+ * convention, with an explicit `NEO4J_URI` requirement to avoid silent
8
+ * cross-account orphaning.
9
+ */
10
+ import { Driver, Session } from "neo4j-driver";
11
+ export declare function getDriver(): Driver;
12
+ export declare function getSession(): Session;
13
+ export declare function closeDriver(): Promise<void>;
14
+ //# sourceMappingURL=neo4j.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neo4j.d.ts","sourceRoot":"","sources":["../../src/lib/neo4j.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAqBtD,wBAAgB,SAAS,IAAI,MAAM,CAclC;AAED,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAKjD"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Minimal neo4j driver wrapper for the writer-craft MCP server.
3
+ *
4
+ * Mirrors the public surface of `platform/plugins/memory/mcp/src/lib/neo4j.ts`:
5
+ * `getSession()` returns a session, `closeDriver()` releases the singleton.
6
+ * Password resolution follows the same `PLATFORM_ROOT/config/.neo4j-password`
7
+ * convention, with an explicit `NEO4J_URI` requirement to avoid silent
8
+ * cross-account orphaning.
9
+ */
10
+ import neo4j from "neo4j-driver";
11
+ import { readFileSync } from "node:fs";
12
+ import { resolve } from "node:path";
13
+ let driver = null;
14
+ function readPassword() {
15
+ if (process.env.NEO4J_PASSWORD)
16
+ return process.env.NEO4J_PASSWORD;
17
+ const passwordFile = resolve(process.env.PLATFORM_ROOT ?? resolve(import.meta.dirname, "../../../../../platform"), "config/.neo4j-password");
18
+ try {
19
+ return readFileSync(passwordFile, "utf-8").trim();
20
+ }
21
+ catch {
22
+ throw new Error(`Neo4j password not found. Expected at ${passwordFile} or in NEO4J_PASSWORD env var.`);
23
+ }
24
+ }
25
+ export function getDriver() {
26
+ if (!driver) {
27
+ const uri = process.env.NEO4J_URI;
28
+ if (!uri) {
29
+ throw new Error("[writer-craft] NEO4J_URI unset — refusing to default to bolt://localhost:7687");
30
+ }
31
+ const user = process.env.NEO4J_USER ?? "neo4j";
32
+ const password = readPassword();
33
+ process.stderr.write(`[writer-craft] resolved neo4j_uri=${uri}\n`);
34
+ driver = neo4j.driver(uri, neo4j.auth.basic(user, password));
35
+ }
36
+ return driver;
37
+ }
38
+ export function getSession() {
39
+ return getDriver().session();
40
+ }
41
+ export async function closeDriver() {
42
+ if (driver) {
43
+ await driver.close();
44
+ driver = null;
45
+ }
46
+ }
47
+ //# sourceMappingURL=neo4j.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neo4j.js","sourceRoot":"","sources":["../../src/lib/neo4j.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAA0B,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,IAAI,MAAM,GAAkB,IAAI,CAAC;AAEjC,SAAS,YAAY;IACnB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAClE,MAAM,YAAY,GAAG,OAAO,CAC1B,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,yBAAyB,CAAC,EACpF,wBAAwB,CACzB,CAAC;IACF,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,yCAAyC,YAAY,gCAAgC,CACtF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC;QAC/C,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;QAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,GAAG,IAAI,CAAC,CAAC;QACnE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Shared corpus-filter clause for the voice-mirror tools.
3
+ *
4
+ * Imported by `voice-distil-profile` (count + sample walks) and
5
+ * `voice-retrieve-conditioning` (exemplar walk). The single load-bearing
6
+ * filter — when the corpus rules change, this is the only place to edit.
7
+ *
8
+ * Two predicates:
9
+ *
10
+ * 1. `authorshipMode IN ['human-only', 'human-led-agent-assisted']`.
11
+ * `human-only` is the operator's own writing verbatim;
12
+ * `human-led-agent-assisted` is operator-authored with light agent
13
+ * polish, which still carries voice signal (the operator chose the
14
+ * claims and the structure). Including this expands the available
15
+ * corpus to match how most modern writing actually happens.
16
+ *
17
+ * 2. Label is one of the four primary content labels OR is a
18
+ * conversation-document `:Section` chunk (unguarded chat voice from
19
+ * WhatsApp / Telegram / Signal / Granola / Otter / Circleback etc.
20
+ * archives). After the Task 324 collapse, conversation transcripts
21
+ * land as `:KnowledgeDocument` parents carrying `conversationIdentity`
22
+ * with plain `:Section` children — no `:Conversation` secondary label.
23
+ * Conversation-document sections are identified by their parent's
24
+ * `conversationIdentity` property via an EXISTS sub-pattern.
25
+ * Chat captures voice in a way email rarely does — this is the
26
+ * single highest-leverage corpus addition for voice fidelity.
27
+ *
28
+ * The clause expects `$accountId` to be bound in the calling cypher
29
+ * parameters. It does not bind any other parameters.
30
+ */
31
+ export declare const VOICE_CORPUS_WHERE = "n.accountId = $accountId\n AND n.authorshipMode IN ['human-only', 'human-led-agent-assisted']\n AND (\n any(lbl IN labels(n) WHERE lbl IN ['KnowledgeDocument', 'Message', 'SocialPost'])\n OR ('Section' IN labels(n) AND EXISTS {\n MATCH (parent:KnowledgeDocument)-[:HAS_SECTION]->(n)\n WHERE parent.conversationIdentity IS NOT NULL\n })\n )";
32
+ /**
33
+ * The label set the tag tool accepts when stamping `authorshipMode`.
34
+ * Mirrors the label predicate inside VOICE_CORPUS_WHERE so the tag tool
35
+ * and the corpus walk stay in lockstep. The tag tool does not filter
36
+ * by authorshipMode (that's the property it's setting).
37
+ *
38
+ * `:Email` retired with Task 321 — email threads now land as
39
+ * `:KnowledgeDocument {source:'email'}` and are already covered.
40
+ */
41
+ export declare const TAGGABLE_PRIMARY_LABELS: readonly ["KnowledgeDocument", "Message", "SocialPost"];
42
+ //# sourceMappingURL=voice-corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-corpus.d.ts","sourceRoot":"","sources":["../../src/lib/voice-corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,kBAAkB,8WAQ3B,CAAC;AAEL;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,yDAI1B,CAAC"}
@@ -37,7 +37,6 @@ export const VOICE_CORPUS_WHERE = `n.accountId = $accountId
37
37
  WHERE parent.conversationIdentity IS NOT NULL
38
38
  })
39
39
  )`;
40
-
41
40
  /**
42
41
  * The label set the tag tool accepts when stamping `authorshipMode`.
43
42
  * Mirrors the label predicate inside VOICE_CORPUS_WHERE so the tag tool
@@ -48,7 +47,8 @@ export const VOICE_CORPUS_WHERE = `n.accountId = $accountId
48
47
  * `:KnowledgeDocument {source:'email'}` and are already covered.
49
48
  */
50
49
  export const TAGGABLE_PRIMARY_LABELS = [
51
- "KnowledgeDocument",
52
- "Message",
53
- "SocialPost",
54
- ] as const;
50
+ "KnowledgeDocument",
51
+ "Message",
52
+ "SocialPost",
53
+ ];
54
+ //# sourceMappingURL=voice-corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-corpus.js","sourceRoot":"","sources":["../../src/lib/voice-corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;IAQ9B,CAAC;AAEL;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,mBAAmB;IACnB,SAAS;IACT,YAAY;CACJ,CAAC"}
@@ -0,0 +1,36 @@
1
+ export interface VoiceDistilProfileParams {
2
+ accountId: string;
3
+ adminUserId: string;
4
+ force?: boolean;
5
+ /**
6
+ * Operation mode (Task 424):
7
+ * - `'sample'` (default) — read the corpus + feedback intents and return
8
+ * them. No write. The calling agent composes the style-card YAML
9
+ * in-turn from the returned exemplars.
10
+ * - `'write'` — persist the style card the agent produced. Requires
11
+ * `styleCardYaml`.
12
+ */
13
+ mode?: "sample" | "write";
14
+ /** Required when `mode='write'`. The style-card YAML produced by the agent. */
15
+ styleCardYaml?: string;
16
+ }
17
+ export interface VoiceCorpusExemplar {
18
+ id: string;
19
+ label: string;
20
+ body: string;
21
+ }
22
+ export interface VoiceDistilProfileResult {
23
+ profileId: string | null;
24
+ corpusSize: number;
25
+ generatedAt: string | null;
26
+ feedbackEntries: number;
27
+ skipped: boolean;
28
+ skipReason?: "below-threshold" | "recent" | "empty-corpus" | "missing-style-card";
29
+ errorReason?: string;
30
+ /** Present when `mode='sample'`: corpus exemplars for the agent to read. */
31
+ exemplars?: VoiceCorpusExemplar[];
32
+ /** Present when `mode='sample'`: operator-edit intents to fold into the style card. */
33
+ feedbackIntents?: string[];
34
+ }
35
+ export declare function voiceDistilProfile(params: VoiceDistilProfileParams): Promise<VoiceDistilProfileResult>;
36
+ //# sourceMappingURL=voice-distil-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-distil-profile.d.ts","sourceRoot":"","sources":["../../src/tools/voice-distil-profile.ts"],"names":[],"mappings":"AA4CA,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,iBAAiB,GAAG,QAAQ,GAAG,cAAc,GAAG,oBAAoB,CAAC;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAClC,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAOD,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,wBAAwB,CAAC,CAsNnC"}