@rubytech/create-maxy-code 0.1.170 → 0.1.172
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/dist/__tests__/premium-mcp-discover.test.js +42 -0
- package/dist/lib/premium-mcp-discover.js +9 -2
- package/package.json +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js +24 -8
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +15 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +78 -8
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.d.ts +51 -0
- package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.d.ts.map +1 -0
- package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.js +196 -0
- package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.js.map +1 -0
- package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/package.json +7 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/index.d.ts +3 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/index.d.ts.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/index.js +257 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/index.js.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.d.ts +14 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.d.ts.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.js +47 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.js.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.d.ts +42 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.d.ts.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.js +54 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.js.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.d.ts +36 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.d.ts.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.js +225 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.js.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.d.ts +26 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.d.ts.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.js +74 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.js.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.d.ts +22 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.d.ts.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js +102 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.d.ts +14 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.d.ts.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.js +84 -0
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.js.map +1 -0
- package/payload/premium-plugins/writer-craft/mcp/package-lock.json +1327 -0
- package/payload/premium-plugins/writer-craft/mcp/scripts/smoke.mjs +2 -2
- package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-distil-profile.ts +1 -1
- package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-retrieve-conditioning.ts +2 -2
- package/payload/server/public/assets/{admin-Dal5FWaD.js → admin-DH5jp-1u.js} +1 -1
- package/payload/server/public/assets/{data-DbSORCl4.js → data-CtanHhM2.js} +1 -1
- package/payload/server/public/assets/{graph-ys_joP2o.js → graph-6DPD6be1.js} +1 -1
- package/payload/server/public/assets/graph-labels-BMU8LsOD.js +1 -0
- package/payload/server/public/assets/{page-CwmZ76U7.js → page-0lzgQWnS.js} +1 -1
- package/payload/server/public/assets/{page--bl5Y7ZI.js → page-C29S3cBt.js} +1 -1
- package/payload/server/public/data.html +3 -3
- package/payload/server/public/graph.html +3 -3
- package/payload/server/public/index.html +4 -4
- package/payload/server/server.js +15 -0
- package/payload/server/public/assets/graph-labels-BBB5jsZk.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAmB,gBAAgB,EAAuB,MAAM,8BAA8B,CAAC;AA0RtG,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -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,CA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AAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iCAAiC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;iBAC1F;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"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 const VOICE_CORPUS_WHERE = `n.accountId = $accountId
|
|
32
|
+
AND n.authorshipMode IN ['human-only', 'human-led-agent-assisted']
|
|
33
|
+
AND (
|
|
34
|
+
any(lbl IN labels(n) WHERE lbl IN ['KnowledgeDocument', 'Message', 'SocialPost'])
|
|
35
|
+
OR ('Section' IN labels(n) AND EXISTS {
|
|
36
|
+
MATCH (parent:KnowledgeDocument)-[:HAS_SECTION]->(n)
|
|
37
|
+
WHERE parent.conversationIdentity IS NOT NULL
|
|
38
|
+
})
|
|
39
|
+
)`;
|
|
40
|
+
/**
|
|
41
|
+
* The label set the tag tool accepts when stamping `authorshipMode`.
|
|
42
|
+
* Mirrors the label predicate inside VOICE_CORPUS_WHERE so the tag tool
|
|
43
|
+
* and the corpus walk stay in lockstep. The tag tool does not filter
|
|
44
|
+
* by authorshipMode (that's the property it's setting).
|
|
45
|
+
*
|
|
46
|
+
* `:Email` retired with Task 321 — email threads now land as
|
|
47
|
+
* `:KnowledgeDocument {source:'email'}` and are already covered.
|
|
48
|
+
*/
|
|
49
|
+
export const TAGGABLE_PRIMARY_LABELS = [
|
|
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"}
|