@rubytech/create-maxy-code 0.1.175 → 0.1.179
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/index.js +13 -4
- package/package.json +1 -1
- package/payload/platform/plugins/email/skills/email-composition/SKILL.md +1 -1
- package/payload/platform/plugins/memory/bin/conversation-archive-ingest.mjs +38 -3
- package/payload/platform/plugins/memory/mcp/dist/index.js +17 -7
- package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/turn-text-cache-path.d.ts +8 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/turn-text-cache-path.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/turn-text-cache-path.js +27 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/turn-text-cache-path.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/section-types.d.ts +15 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/section-types.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-body-server-sliced.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-body-server-sliced.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-body-server-sliced.test.js +95 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-body-server-sliced.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-chat-body-server-sliced.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-chat-body-server-sliced.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-chat-body-server-sliced.test.js +124 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-chat-body-server-sliced.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-section-properties-strip.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-section-properties-strip.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-section-properties-strip.test.js +104 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-section-properties-strip.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest-web.d.ts +12 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest-web.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest-web.js +38 -13
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest-web.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.d.ts +23 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.js +234 -20
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.js.map +1 -1
- package/payload/platform/plugins/memory/skills/conversation-archive/SKILL.md +7 -3
- package/payload/platform/plugins/memory/skills/document-ingest/SKILL.md +12 -3
- package/payload/platform/plugins/substack-import/skills/substack-import/SKILL.md +1 -0
- package/payload/premium-plugins/venture-studio/skills/investor-data-room/SKILL.md +1 -1
- package/payload/premium-plugins/writer-craft/PLUGIN.md +2 -2
- package/payload/premium-plugins/writer-craft/mcp/dist/index.js +3 -3
- package/payload/premium-plugins/writer-craft/mcp/dist/index.js.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.d.ts +4 -22
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.d.ts.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.js +4 -36
- package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.js.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.d.ts.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.js +34 -2
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.js.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.d.ts.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js +24 -5
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.d.ts +2 -2
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.d.ts.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.js +14 -28
- package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.js.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/scripts/smoke.mjs +21 -41
- package/payload/premium-plugins/writer-craft/mcp/src/index.ts +5 -5
- package/payload/premium-plugins/writer-craft/mcp/src/lib/voice-corpus.ts +4 -41
- package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-distil-profile.ts +32 -2
- package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-retrieve-conditioning.ts +25 -5
- package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-tag-content.ts +16 -31
- package/payload/premium-plugins/writer-craft/skills/voice-mirror/SKILL.md +16 -19
|
@@ -112,7 +112,6 @@ You produce typed-section JSON yourself from the cached text and the loaded onto
|
|
|
112
112
|
{
|
|
113
113
|
"kind": "<from closed enumeration>",
|
|
114
114
|
"title": "<short title>",
|
|
115
|
-
"body": "<documentText.slice(sourceStart, sourceEnd)>",
|
|
116
115
|
"summary": "<≤500 chars>",
|
|
117
116
|
"sourceStart": <int>,
|
|
118
117
|
"sourceEnd": <int>,
|
|
@@ -127,7 +126,7 @@ You produce typed-section JSON yourself from the cached text and the loaded onto
|
|
|
127
126
|
}
|
|
128
127
|
```
|
|
129
128
|
|
|
130
|
-
Use the natural-edge map below to pick `anchorEdge` per kind.
|
|
129
|
+
Use the natural-edge map below to pick `anchorEdge` per kind. The writer derives `:Section.body` from `cachedText.slice(sourceStart, sourceEnd)` — you emit offsets, not body text. Any `body` field you supply is logged and ignored. `summary` ≤ 500 chars.
|
|
131
130
|
|
|
132
131
|
```
|
|
133
132
|
Section kind | Anchor edge (direction = from-anchor unless noted)
|
|
@@ -148,7 +147,7 @@ Other (label fallback) | anchorEdge: null — section-kind closure mis
|
|
|
148
147
|
|
|
149
148
|
`orphanCandidates` is the list of entities you wanted to emit but could not natural-edge. Surface them so the ontology can grow.
|
|
150
149
|
|
|
151
|
-
**Chat mode.** Same top-level shape with every `sections[].kind = "Conversation"` and per-chunk
|
|
150
|
+
**Chat mode.** Same top-level shape with every `sections[].kind = "Conversation"`. `summary` is the per-section top-level field (already required by the schema) — the writer reads it from there and stamps `:Section.summary`. The `properties` bag is for non-authoritative per-chunk metadata only: `keywords`, `firstMessageAt`, `lastMessageAt`, `participantNames`, `messageCount`. The writer strips reserved writer-owned keys (`summary`, `title`, `body`, `bodyPreview`, `embedding`, provenance fields, etc.) from `properties` and logs the attempt — so duplicating an authoritative field into `properties` is a noisy no-op. Cover every message in chronological order with no gaps. Drop `anchorEdge` (always null) and `related`. Use the participant elementIds from § Participant confirmation; do not invent new ones.
|
|
152
151
|
|
|
153
152
|
**Chunking — long inputs.** For inputs > ~525K chars, work through the cached text in deterministic ~525K-char windows with ~17.5K-char overlap, emit sections per window, and merge same-kind boundary straddlers yourself before calling `memory-ingest`. Inputs > 682K chars in chat mode are too large to keep within one turn — abort with `cause:"input-too-large"` and ask the operator to sessionize the export before re-dispatch.
|
|
154
153
|
|
|
@@ -247,6 +246,16 @@ The operator always sees what was attempted and where it stopped.
|
|
|
247
246
|
|
|
248
247
|
For URL-based ingestion, run `memory-ingest-web` first with the URL and the WebFetch result. It writes the content to a temp file and routes through `memory-ingest-extract`, returning a fresh `attachmentId`. The rest of the pipeline (classify + ingest) is identical to a file upload. Pass `sourceUrl` and `sourceType: 'web'` to `memory-ingest`.
|
|
249
248
|
|
|
249
|
+
**Page title is mandatory input — parse it before the call.** `KnowledgeDocument.name` is what shows up everywhere the document is referenced (`pickShortLabel` / `pickDisplayName` check `name` first), so it must be an editorial title, never body prose. Before calling `memory-ingest-web`, scan the WebFetch result for the page's title and pass it as the `title` parameter:
|
|
250
|
+
|
|
251
|
+
- The readability output often starts with the page's `<title>` or `og:title` as a literal H1 (e.g. `# I am no longer the Official Representative for Reform UK`). Use that line verbatim — strip the leading `# ` and any trailing site name suffix (e.g. ` - Substack`, ` | Medium`).
|
|
252
|
+
- When the readability output strips the title entirely (rare; some publishers prefix the body with marketing chrome), look at the URL's final path segment — `…/i-am-no-longer-the-official-representative` is the slug the publisher chose for the article.
|
|
253
|
+
- Never invent a title from the article's opening paragraph. Body prose is exactly what this parameter exists to avoid.
|
|
254
|
+
|
|
255
|
+
The server's fallback chain when `title` is absent: markdown H1 in the cached text → URL-derived slug → the URL itself. The librarian's job is to make the `caller` branch the common case; the server-side fallbacks are last-resort, not the default path. The response includes `titleSource` (`caller` / `h1` / `url-slug` / `url`) so the operator can see which path fired.
|
|
256
|
+
|
|
257
|
+
**WebFetch limitation — subscriber-gated and JS-rendered pages (Substack, Medium-locked, paywalled news, gated PDFs, single-page apps).** `WebFetch` retrieves only the public, server-rendered surface. For gated articles the return is the meta-description / preview blurb / third-person summary that the publisher exposes to scrapers — not the author's original prose. Verbatim text is unrecoverable through this path. **Detect this before ingesting:** if the WebFetch result looks like a third-person synopsis of an article whose author would have written in first person, or carries publisher-summary framing (`# <Title> - Full Article Text` headers, marketing blurbs, "Subscribe to read"), abort the ingest and surface the gap to the dispatching agent in one line: *"WebFetch for `<url>` returned a publisher summary, not the article body. Ask the operator for a different input shape — for a Substack URL on the operator's own publication, use the `substack-import` plugin's export-archive flow (Substack admin → 'Export your data' → drop the ZIP); otherwise paste the article text into chat or attach a PDF / .txt export."* The dispatching agent relays this to the operator and re-dispatches with the pasted text, uploaded file, or Substack archive as the input. Do NOT proceed to `memory-ingest-web` with the summary — `:Section.body` will faithfully reproduce that summary downstream, defeating the verbatim-prose contract.
|
|
258
|
+
|
|
250
259
|
## Attachment metadata format
|
|
251
260
|
|
|
252
261
|
Your task description contains attachment metadata in this format:
|
|
@@ -179,4 +179,5 @@ Audit query: `MATCH ()-[r]->() WHERE r.createdByAgent='substack-import' RETURN D
|
|
|
179
179
|
- **Comments.** Substack export does not include reader comments.
|
|
180
180
|
- **Inbound newsletter ingestion.** A Substack post landing in the operator's Gmail goes through `conversation-archive --source email` (Task 426), not this plugin.
|
|
181
181
|
- **Live API or RSS poll.** Operator-dropped export only.
|
|
182
|
+
- **Single-URL ingestion via `WebFetch`.** A Substack URL passed to `document-ingest` via `memory-ingest-web` will NOT recover the article's verbatim prose for gated / paywalled / subscriber-only posts — `WebFetch` retrieves only the public, server-rendered surface (meta-description, preview blurb, third-person publisher summary). Even for free public posts, JS-rendering on Substack means the WebFetch return is unreliable for verbatim capture. **If the operator hands over a Substack URL, advise:** (a) for the operator's own publication — run the export-archive flow this skill owns (Substack admin → "Export your data" → drop the ZIP); (b) for a third-party publication — paste the article text into chat, or save the page as PDF / `.txt` and attach the file. Then re-dispatch the librarian on the pasted text or attached file. Do not attempt URL-based ingestion as a fallback — the prose will be lost. (Recurring failure surfaced on session `d725df52` 2026-05-27; see `.tasks/465-memory-ingest-body-server-sliced-from-offsets.md` and the WebFetch-limitation note in `document-ingest/SKILL.md`.)
|
|
182
183
|
- **Audio / video enclosures.** Substack podcast / video posts use additional file shapes the v1 plugin does not handle; only images referenced from post-body `<img>` tags are enclosed.
|
|
@@ -117,7 +117,7 @@ References: `references/data-room-structure.md` for the section-by-section purpo
|
|
|
117
117
|
|
|
118
118
|
## Stage 3 — Business plan synthesis
|
|
119
119
|
|
|
120
|
-
**Before drafting any narrative prose**, call `voice-retrieve-conditioning` with `format: "
|
|
120
|
+
**Before drafting any narrative prose**, call `voice-retrieve-conditioning` with `format: "article"`, `length: "long"`, and `topic` set to the venture's domain (e.g. "AI estate-agent operating system"). When the tool returns a non-null `styleCard`, the founder has a voice profile on file — condition every prose section on the style card and exemplars so the business plan reads as the founder's own writing, not generic VC boilerplate. When the tool returns `{styleCard: null, exemplars: []}` (no profile, or `writer-craft` not enabled), draft in the formal-yet-direct register implied by the section purpose statements without further conditioning. Emit narration `[investor-data-room] voice-mirror styleCardBytes=<n> exemplars=<k>` when conditioning was applied.
|
|
121
121
|
|
|
122
122
|
Generate `01-narrative/business-plan.md` with **16 sections** following the canonical structure:
|
|
123
123
|
|
|
@@ -90,7 +90,7 @@ The user is:
|
|
|
90
90
|
|
|
91
91
|
| Skill | Purpose |
|
|
92
92
|
|-------|---------|
|
|
93
|
-
| `voice-mirror` | Capture the operator's voice from their own writing (`human-only` corpus) and condition agent drafts on it. Five tools: tag historical content (
|
|
93
|
+
| `voice-mirror` | Capture the operator's voice from their own writing (`human-only` corpus) and condition agent drafts on it. Five tools: tag historical content (operator supplies `format`), distil a per-format style card, retrieve conditioning for a drafting brief (requires `brief.format`), record operator edits as feedback, and auto-ingest PTY turns at SessionEnd. Other drafting skills (email composition, Postiz, property-brochure, prospectus) call it transparently — opt-out via `voiceMirror: false` in the calling skill's frontmatter. |
|
|
94
94
|
|
|
95
95
|
## Specialist Agent
|
|
96
96
|
|
|
@@ -106,7 +106,7 @@ Voice-mirror introduces five deterministic plugin tools. They route writes throu
|
|
|
106
106
|
|
|
107
107
|
| Tool | Purpose |
|
|
108
108
|
|------|---------|
|
|
109
|
-
| `voice-tag-content` | Stamp `authorshipMode ∈ {human-only, human-led-agent-assisted, agent-led-human-reviewed, agent-only, unknown}` and
|
|
109
|
+
| `voice-tag-content` | Stamp `authorshipMode ∈ {human-only, human-led-agent-assisted, agent-led-human-reviewed, agent-only, unknown}` and `format ∈ {text, email, social-post, article, note, marketing-copy}` on one or many `:KnowledgeDocument | :Message | :SocialPost` nodes (email threads live as `:KnowledgeDocument {source:'email'}` since Task 321). Bulk-mode for backfill batches. `format` is required — the operator's editorial classification of the content. |
|
|
110
110
|
| `voice-distil-profile` | Walk the operator's `human-only` corpus for the given `format` and persist a `:VoiceProfile {styleCard, generatedAt, corpusSize, feedbackEntries, format}` linked to the `:AdminUser`. Omit `format` to enumerate all formats in the corpus and distil each. Cadence-guarded per format: re-runs on ≥20% corpus growth or ≥30 days, otherwise no-op. |
|
|
111
111
|
| `voice-retrieve-conditioning` | Return `{styleCard, exemplars[]}` for a drafting brief. Requires `brief.format` (one of the six corpus formats). K=5 short-form (`brief.length:'short'`), K=15 long-form (`brief.length:'long'`). Token-budget bounded. Graceful degradation: empty profile → `{styleCard: null, exemplars: []}`. |
|
|
112
112
|
| `voice-record-feedback` | Capture an operator edit on an agent draft as a `:VoiceEdit {format}` with a Haiku-summarised `intent`, linked back to the operator's per-format `:VoiceProfile` via `:FEEDBACK_FOR`. Requires `format`. |
|
|
@@ -40,7 +40,7 @@ function resolveUserId() {
|
|
|
40
40
|
}
|
|
41
41
|
// Format enum schema — shared across tools that accept VoiceFormat.
|
|
42
42
|
const zFormat = z.enum([...FORMAT_VALUES]).describe("Writing format: text | email | social-post | article | marketing-copy | note. One :VoiceProfile per (accountId, userId, format).");
|
|
43
|
-
server.tool("voice-tag-content", "Stamp authorshipMode
|
|
43
|
+
server.tool("voice-tag-content", "Stamp authorshipMode and format 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. Valid formats: text, email, social-post, article, marketing-copy, note. format is editorial — the operator chooses it per node; the tool does not infer it.", {
|
|
44
44
|
nodeIds: z.array(z.string()).min(1).describe("Element IDs of nodes to tag"),
|
|
45
45
|
mode: z
|
|
46
46
|
.enum([
|
|
@@ -51,7 +51,7 @@ server.tool("voice-tag-content", "Stamp authorshipMode (and optionally format) o
|
|
|
51
51
|
"unknown",
|
|
52
52
|
])
|
|
53
53
|
.describe("Authorship mode to apply"),
|
|
54
|
-
format: zFormat.
|
|
54
|
+
format: zFormat.describe("Writing format. Required — the operator's editorial classification of the content."),
|
|
55
55
|
}, async ({ nodeIds, mode, format }) => {
|
|
56
56
|
if (!accountId)
|
|
57
57
|
return refuseNoAccount("voice-tag-content");
|
|
@@ -66,7 +66,7 @@ server.tool("voice-tag-content", "Stamp authorshipMode (and optionally format) o
|
|
|
66
66
|
content: [
|
|
67
67
|
{
|
|
68
68
|
type: "text",
|
|
69
|
-
text: `voice-tag: mode=${mode} format=${format
|
|
69
|
+
text: `voice-tag: mode=${mode} format=${format} updated=${result.updated} skipped=${result.skipped}`,
|
|
70
70
|
},
|
|
71
71
|
],
|
|
72
72
|
};
|
|
@@ -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,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,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,C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AA4C,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"}
|
|
@@ -45,7 +45,10 @@ export declare const TAGGABLE_PRIMARY_LABELS: readonly ["KnowledgeDocument", "Me
|
|
|
45
45
|
* Closed enum of writing-format values. One `:VoiceProfile` exists per
|
|
46
46
|
* `(accountId, userId, format)`. Adding a new value is a separate task.
|
|
47
47
|
*
|
|
48
|
-
*
|
|
48
|
+
* Format is an editorial classification set by the operator at tag time.
|
|
49
|
+
* The only auto-tagged path is `voice-ingest-session-text`, which hard-codes
|
|
50
|
+
* `format='text'` on `:Message` because chat turns are unambiguously text and
|
|
51
|
+
* the operator is not in the loop on session end.
|
|
49
52
|
*/
|
|
50
53
|
export declare const FORMAT_VALUES: readonly ["text", "email", "social-post", "article", "marketing-copy", "note"];
|
|
51
54
|
export type VoiceFormat = (typeof FORMAT_VALUES)[number];
|
|
@@ -59,25 +62,4 @@ export type VoiceFormat = (typeof FORMAT_VALUES)[number];
|
|
|
59
62
|
* walks use this function.
|
|
60
63
|
*/
|
|
61
64
|
export declare function voiceCorpusWhereWithFormat(format: VoiceFormat): string;
|
|
62
|
-
/**
|
|
63
|
-
* Derives the default writing format for a corpus node from its labels
|
|
64
|
-
* and properties. Used by ingest writers and `voice-tag-content` when the
|
|
65
|
-
* operator does not specify a format explicitly.
|
|
66
|
-
*
|
|
67
|
-
* Derivation rules (first match wins):
|
|
68
|
-
*
|
|
69
|
-
* | Node shape | format |
|
|
70
|
-
* |-------------------------------------------------------------|---------------|
|
|
71
|
-
* | :Message | 'text' |
|
|
72
|
-
* | :SocialPost | 'social-post' |
|
|
73
|
-
* | :KnowledgeDocument {source:'email'} | 'email' |
|
|
74
|
-
* | :ConversationArchive {source:'email'} | 'email' |
|
|
75
|
-
* | :KnowledgeDocument (non-email), body.length > 1500 | 'article' |
|
|
76
|
-
* | :KnowledgeDocument (non-email), body.length ≤ 1500 | 'note' |
|
|
77
|
-
* | :Section (conversation-document chunk) | 'text' |
|
|
78
|
-
* | fallback | 'text' |
|
|
79
|
-
*
|
|
80
|
-
* `marketing-copy` has no auto-derivation path.
|
|
81
|
-
*/
|
|
82
|
-
export declare function deriveFormat(labels: string[], source?: string | null, body?: string | null): VoiceFormat;
|
|
83
65
|
//# sourceMappingURL=voice-corpus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-corpus.d.ts","sourceRoot":"","sources":["../../src/lib/voice-corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,kBAAkB,8WAQ3B,CAAC;AAEL;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,yDAI1B,CAAC;AAEX
|
|
1
|
+
{"version":3,"file":"voice-corpus.d.ts","sourceRoot":"","sources":["../../src/lib/voice-corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,kBAAkB,8WAQ3B,CAAC;AAEL;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,yDAI1B,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,gFAOhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAEtE"}
|
|
@@ -57,7 +57,10 @@ export const TAGGABLE_PRIMARY_LABELS = [
|
|
|
57
57
|
* Closed enum of writing-format values. One `:VoiceProfile` exists per
|
|
58
58
|
* `(accountId, userId, format)`. Adding a new value is a separate task.
|
|
59
59
|
*
|
|
60
|
-
*
|
|
60
|
+
* Format is an editorial classification set by the operator at tag time.
|
|
61
|
+
* The only auto-tagged path is `voice-ingest-session-text`, which hard-codes
|
|
62
|
+
* `format='text'` on `:Message` because chat turns are unambiguously text and
|
|
63
|
+
* the operator is not in the loop on session end.
|
|
61
64
|
*/
|
|
62
65
|
export const FORMAT_VALUES = [
|
|
63
66
|
"text",
|
|
@@ -79,39 +82,4 @@ export const FORMAT_VALUES = [
|
|
|
79
82
|
export function voiceCorpusWhereWithFormat(format) {
|
|
80
83
|
return `${VOICE_CORPUS_WHERE}\n AND n.format = $format`;
|
|
81
84
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Derives the default writing format for a corpus node from its labels
|
|
84
|
-
* and properties. Used by ingest writers and `voice-tag-content` when the
|
|
85
|
-
* operator does not specify a format explicitly.
|
|
86
|
-
*
|
|
87
|
-
* Derivation rules (first match wins):
|
|
88
|
-
*
|
|
89
|
-
* | Node shape | format |
|
|
90
|
-
* |-------------------------------------------------------------|---------------|
|
|
91
|
-
* | :Message | 'text' |
|
|
92
|
-
* | :SocialPost | 'social-post' |
|
|
93
|
-
* | :KnowledgeDocument {source:'email'} | 'email' |
|
|
94
|
-
* | :ConversationArchive {source:'email'} | 'email' |
|
|
95
|
-
* | :KnowledgeDocument (non-email), body.length > 1500 | 'article' |
|
|
96
|
-
* | :KnowledgeDocument (non-email), body.length ≤ 1500 | 'note' |
|
|
97
|
-
* | :Section (conversation-document chunk) | 'text' |
|
|
98
|
-
* | fallback | 'text' |
|
|
99
|
-
*
|
|
100
|
-
* `marketing-copy` has no auto-derivation path.
|
|
101
|
-
*/
|
|
102
|
-
export function deriveFormat(labels, source, body) {
|
|
103
|
-
if (labels.includes("Message"))
|
|
104
|
-
return "text";
|
|
105
|
-
if (labels.includes("SocialPost"))
|
|
106
|
-
return "social-post";
|
|
107
|
-
if ((labels.includes("KnowledgeDocument") || labels.includes("ConversationArchive")) &&
|
|
108
|
-
source === "email") {
|
|
109
|
-
return "email";
|
|
110
|
-
}
|
|
111
|
-
if (labels.includes("KnowledgeDocument")) {
|
|
112
|
-
return (body?.length ?? 0) > 1500 ? "article" : "note";
|
|
113
|
-
}
|
|
114
|
-
// :Section (conversation-document chunk) and any other label → text.
|
|
115
|
-
return "text";
|
|
116
|
-
}
|
|
117
85
|
//# sourceMappingURL=voice-corpus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-corpus.js","sourceRoot":"","sources":["../../src/lib/voice-corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;IAQ9B,CAAC;AAEL;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,mBAAmB;IACnB,SAAS;IACT,YAAY;CACJ,CAAC;AAEX
|
|
1
|
+
{"version":3,"file":"voice-corpus.js","sourceRoot":"","sources":["../../src/lib/voice-corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;IAQ9B,CAAC;AAEL;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,mBAAmB;IACnB,SAAS;IACT,YAAY;CACJ,CAAC;AAEX;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,MAAM;IACN,OAAO;IACP,aAAa;IACb,SAAS;IACT,gBAAgB;IAChB,MAAM;CACE,CAAC;AAIX;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAmB;IAC5D,OAAO,GAAG,kBAAkB,4BAA4B,CAAC;AAC3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-distil-profile.d.ts","sourceRoot":"","sources":["../../src/tools/voice-distil-profile.ts"],"names":[],"mappings":"AA2BA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,wBAAwB,CAAC;AA0BhC,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;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,EACP,iBAAiB,GACjB,QAAQ,GACR,cAAc,GACd,oBAAoB,GACpB,0BAA0B,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAClC,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"voice-distil-profile.d.ts","sourceRoot":"","sources":["../../src/tools/voice-distil-profile.ts"],"names":[],"mappings":"AA2BA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,wBAAwB,CAAC;AA0BhC,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;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,EACP,iBAAiB,GACjB,QAAQ,GACR,cAAc,GACd,oBAAoB,GACpB,0BAA0B,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAClC,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AA2OD,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,wBAAwB,GAAG,wBAAwB,EAAE,CAAC,CAmDhE"}
|
|
@@ -113,24 +113,51 @@ async function distilForFormat(params) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
// 4. Sample corpus bodies up to the char cap. Pick recent first.
|
|
116
|
+
//
|
|
117
|
+
// Body resolution (Task 471):
|
|
118
|
+
// - For a :KnowledgeDocument with HAS_SECTION children, concatenate
|
|
119
|
+
// child :Section bodies in `position` order — KD.body itself is
|
|
120
|
+
// null after the Task 465 server-slicing change.
|
|
121
|
+
// - Other labels (:Message, :SocialPost, :Section chat chunks) read
|
|
122
|
+
// n.body directly via the existing COALESCE fallback chain.
|
|
123
|
+
//
|
|
124
|
+
// `collect(s.body)` is null-skipping in Cypher, so KDs with no children
|
|
125
|
+
// produce sectionBodies = [] and fall through to the COALESCE branch
|
|
126
|
+
// correctly. The `usedSectionWalk` flag is returned for per-exemplar
|
|
127
|
+
// observability.
|
|
116
128
|
const sampled = await session.run(`MATCH (n)
|
|
117
129
|
WHERE ${corpusWhere}
|
|
118
130
|
WITH n, coalesce(n.dateSent, n.datePublished, n.firstMessageAt, n.dateCreated, n.createdAt) AS ts
|
|
119
131
|
OPTIONAL MATCH (parent:KnowledgeDocument)-[:HAS_SECTION]->(n)
|
|
120
132
|
WHERE 'Section' IN labels(n) AND parent.conversationIdentity IS NOT NULL
|
|
133
|
+
WITH n, ts, parent
|
|
134
|
+
OPTIONAL MATCH (n)-[:HAS_SECTION]->(s:Section)
|
|
135
|
+
WITH n, ts, parent, s ORDER BY s.position
|
|
136
|
+
WITH n, ts, parent, collect(s.body) AS sectionBodies
|
|
137
|
+
WITH n, ts, parent,
|
|
138
|
+
'KnowledgeDocument' IN labels(n) AND size(sectionBodies) > 0 AS usedSectionWalk,
|
|
139
|
+
CASE
|
|
140
|
+
WHEN 'KnowledgeDocument' IN labels(n) AND size(sectionBodies) > 0
|
|
141
|
+
THEN reduce(acc = '', b IN sectionBodies | acc + b + '\n\n')
|
|
142
|
+
ELSE coalesce(n.body, n.abstract, n.subject, n.title, n.summary, '')
|
|
143
|
+
END AS body
|
|
121
144
|
RETURN elementId(n) AS id,
|
|
122
145
|
labels(n) AS labels,
|
|
123
|
-
|
|
146
|
+
body,
|
|
147
|
+
usedSectionWalk,
|
|
124
148
|
parent.conversationIdentity IS NOT NULL AS isConversationChunk,
|
|
125
149
|
ts
|
|
126
150
|
ORDER BY ts IS NULL, ts DESC
|
|
127
151
|
LIMIT 500`, { accountId, format });
|
|
128
152
|
const samples = [];
|
|
153
|
+
let sectionWalkCount = 0;
|
|
154
|
+
let nBodyCount = 0;
|
|
129
155
|
let charBudget = SAMPLE_CHAR_CAP;
|
|
130
156
|
for (const r of sampled.records) {
|
|
131
157
|
const body = r.get("body") ?? "";
|
|
132
158
|
const labels = r.get("labels") ?? [];
|
|
133
159
|
const isConversationChunk = Boolean(r.get("isConversationChunk"));
|
|
160
|
+
const usedSectionWalk = Boolean(r.get("usedSectionWalk"));
|
|
134
161
|
const label = isConversationChunk
|
|
135
162
|
? "Conversation"
|
|
136
163
|
: (labels.find((l) => ["KnowledgeDocument", "Message", "SocialPost"].includes(l)) ?? labels[0] ?? "Unknown");
|
|
@@ -138,6 +165,10 @@ async function distilForFormat(params) {
|
|
|
138
165
|
continue;
|
|
139
166
|
const trimmed = body.length > charBudget ? body.slice(0, charBudget) : body;
|
|
140
167
|
samples.push({ id: r.get("id"), label, body: trimmed });
|
|
168
|
+
if (usedSectionWalk)
|
|
169
|
+
sectionWalkCount += 1;
|
|
170
|
+
else
|
|
171
|
+
nBodyCount += 1;
|
|
141
172
|
charBudget -= trimmed.length;
|
|
142
173
|
if (charBudget <= 0)
|
|
143
174
|
break;
|
|
@@ -152,7 +183,8 @@ async function distilForFormat(params) {
|
|
|
152
183
|
const mode = params.mode ?? "sample";
|
|
153
184
|
if (mode === "sample") {
|
|
154
185
|
process.stderr.write(`[voice-distil] adminUser=${userId} format=${format} mode=sample corpusSize=${corpusSize} ` +
|
|
155
|
-
`exemplars=${samples.length} feedbackEntries=${feedbackIntents.length}
|
|
186
|
+
`exemplars=${samples.length} feedbackEntries=${feedbackIntents.length} ` +
|
|
187
|
+
`sample-body-source=section-walk:${sectionWalkCount} n.body:${nBodyCount}\n`);
|
|
156
188
|
return {
|
|
157
189
|
profileId: prevProfileId,
|
|
158
190
|
corpusSize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-distil-profile.js","sourceRoot":"","sources":["../../src/tools/voice-distil-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,aAAa,GAEd,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;GAQG;AACH,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAQ,KAAoC,CAAC,QAAQ,EAAE,CAAC;IAChF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM,sBAAsB,GAAG,GAAG,CA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,0BAA0B;SACvC,CAAC;IACJ,CAAC;IAED,8CAA8C;IAC9C,MAAM,OAAO,GAA+B,EAAE,CAAC;IAC/C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACnE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-retrieve-conditioning.d.ts","sourceRoot":"","sources":["../../src/tools/voice-retrieve-conditioning.ts"],"names":[],"mappings":"AA2BA,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,
|
|
1
|
+
{"version":3,"file":"voice-retrieve-conditioning.d.ts","sourceRoot":"","sources":["../../src/tools/voice-retrieve-conditioning.ts"],"names":[],"mappings":"AA2BA,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,CAmH1C"}
|
|
@@ -49,26 +49,45 @@ export async function voiceRetrieveConditioning(params) {
|
|
|
49
49
|
RETURN p.styleCard AS styleCard`, { accountId, userId, format });
|
|
50
50
|
const styleCard = profile.records[0]?.get("styleCard") ?? null;
|
|
51
51
|
// 2. Exemplars — filtered to brief.format. Keyword-aware when topic is set.
|
|
52
|
+
//
|
|
53
|
+
// Body resolution (Task 471):
|
|
54
|
+
// - For :KnowledgeDocument with HAS_SECTION children, concatenate
|
|
55
|
+
// child :Section bodies in `position` order. KD.body is null after
|
|
56
|
+
// Task 465 server-slicing.
|
|
57
|
+
// - Other labels read n.body directly via the COALESCE fallback chain.
|
|
58
|
+
//
|
|
59
|
+
// The topic filter runs against the computed body, so a topic that
|
|
60
|
+
// appears only in n.summary (LLM abstract) no longer matches — by
|
|
61
|
+
// design: the corpus surfaces verbatim prose, not the abstract.
|
|
52
62
|
const topic = (brief.topic ?? "").trim();
|
|
53
63
|
const usesTopic = topic.length > 0;
|
|
64
|
+
const bodyComputeBlock = `WITH n, coalesce(n.dateSent, n.datePublished, n.firstMessageAt, n.dateCreated, n.createdAt) AS ts
|
|
65
|
+
OPTIONAL MATCH (n)-[:HAS_SECTION]->(s:Section)
|
|
66
|
+
WITH n, ts, s ORDER BY s.position
|
|
67
|
+
WITH n, ts, collect(s.body) AS sectionBodies
|
|
68
|
+
WITH n, ts, CASE
|
|
69
|
+
WHEN 'KnowledgeDocument' IN labels(n) AND size(sectionBodies) > 0
|
|
70
|
+
THEN reduce(acc = '', b IN sectionBodies | acc + b + '\n\n')
|
|
71
|
+
ELSE coalesce(n.body, n.abstract, n.subject, n.title, n.summary, '')
|
|
72
|
+
END AS body`;
|
|
54
73
|
const cypher = usesTopic
|
|
55
74
|
? `MATCH (n)
|
|
56
75
|
WHERE ${corpusWhere}
|
|
57
|
-
|
|
58
|
-
|
|
76
|
+
${bodyComputeBlock}
|
|
77
|
+
WHERE toLower(body) CONTAINS toLower($topic)
|
|
59
78
|
RETURN elementId(n) AS id,
|
|
60
79
|
labels(n) AS labels,
|
|
61
|
-
|
|
80
|
+
body,
|
|
62
81
|
coalesce(n.subject, n.title, n.name, '') AS source,
|
|
63
82
|
ts
|
|
64
83
|
ORDER BY ts IS NULL, ts DESC
|
|
65
84
|
LIMIT $k`
|
|
66
85
|
: `MATCH (n)
|
|
67
86
|
WHERE ${corpusWhere}
|
|
68
|
-
|
|
87
|
+
${bodyComputeBlock}
|
|
69
88
|
RETURN elementId(n) AS id,
|
|
70
89
|
labels(n) AS labels,
|
|
71
|
-
|
|
90
|
+
body,
|
|
72
91
|
coalesce(n.subject, n.title, n.name, '') AS source,
|
|
73
92
|
ts
|
|
74
93
|
ORDER BY ts IS NULL, ts DESC
|
package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js.map
CHANGED
|
@@ -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,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,C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AAS,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,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IAClC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,2BAA2B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAChF,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -5,8 +5,8 @@ export interface VoiceTagContentParams {
|
|
|
5
5
|
nodeIds: string[];
|
|
6
6
|
mode: AuthorshipMode;
|
|
7
7
|
accountId: string;
|
|
8
|
-
/**
|
|
9
|
-
format
|
|
8
|
+
/** Writing format (required). Editorial classification — operator-supplied. */
|
|
9
|
+
format: VoiceFormat;
|
|
10
10
|
}
|
|
11
11
|
export interface VoiceTagContentResult {
|
|
12
12
|
updated: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-tag-content.d.ts","sourceRoot":"","sources":["../../src/tools/voice-tag-content.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"voice-tag-content.d.ts","sourceRoot":"","sources":["../../src/tools/voice-tag-content.ts"],"names":[],"mappings":"AAeA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,cAAc,GACtB,YAAY,GACZ,0BAA0B,GAC1B,0BAA0B,GAC1B,YAAY,GACZ,SAAS,CAAC;AAEd,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,cAAc,CAMvD,CAAC;AAEH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAsFhC"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* voice-tag-content — set `authorshipMode`
|
|
3
|
-
*
|
|
2
|
+
* voice-tag-content — set `authorshipMode` and `format` on one or many
|
|
3
|
+
* content nodes.
|
|
4
4
|
*
|
|
5
5
|
* The tool routes through neo4j directly with an account-scoped MERGE so
|
|
6
6
|
* the operator can only mutate their own nodes. We do not go through
|
|
7
7
|
* `memory-update` because that tool re-embeds and re-validates on every
|
|
8
8
|
* call — overkill for a single-property authorship stamp.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* each node's labels and `source` property, matching the `deriveFormat()`
|
|
15
|
-
* rule table in voice-corpus.ts. This keeps tag and ingest in lockstep.
|
|
10
|
+
* `format` is an editorial classification only the operator can set; it is
|
|
11
|
+
* therefore required. The sole hard-coded exception lives in
|
|
12
|
+
* `voice-ingest-session-text`, which stamps `format='text'` on auto-ingested
|
|
13
|
+
* `:Message` rows where the operator is not in the loop (Task 471).
|
|
16
14
|
*/
|
|
17
15
|
import { getSession } from "../lib/neo4j.js";
|
|
18
16
|
import { TAGGABLE_PRIMARY_LABELS, FORMAT_VALUES, } from "../lib/voice-corpus.js";
|
|
@@ -23,17 +21,6 @@ export const AUTHORSHIP_MODES = new Set([
|
|
|
23
21
|
"agent-only",
|
|
24
22
|
"unknown",
|
|
25
23
|
]);
|
|
26
|
-
// Cypher CASE expression that mirrors deriveFormat() for in-query derivation.
|
|
27
|
-
// Used when the caller does not supply an explicit format.
|
|
28
|
-
const FORMAT_DERIVE_CASE = `CASE
|
|
29
|
-
WHEN 'Message' IN labels(n) THEN 'text'
|
|
30
|
-
WHEN 'SocialPost' IN labels(n) THEN 'social-post'
|
|
31
|
-
WHEN ('KnowledgeDocument' IN labels(n) OR 'ConversationArchive' IN labels(n))
|
|
32
|
-
AND n.source = 'email' THEN 'email'
|
|
33
|
-
WHEN 'KnowledgeDocument' IN labels(n) AND size(coalesce(n.body, '')) > 1500 THEN 'article'
|
|
34
|
-
WHEN 'KnowledgeDocument' IN labels(n) THEN 'note'
|
|
35
|
-
ELSE 'text'
|
|
36
|
-
END`;
|
|
37
24
|
export async function voiceTagContent(params) {
|
|
38
25
|
const { nodeIds, mode, accountId, format } = params;
|
|
39
26
|
if (!AUTHORSHIP_MODES.has(mode)) {
|
|
@@ -44,7 +31,10 @@ export async function voiceTagContent(params) {
|
|
|
44
31
|
if (!accountId) {
|
|
45
32
|
throw new Error("voice-tag-content: accountId is required");
|
|
46
33
|
}
|
|
47
|
-
if (format
|
|
34
|
+
if (format === undefined || format === null) {
|
|
35
|
+
throw new Error("voice-tag-content: format is required");
|
|
36
|
+
}
|
|
37
|
+
if (!FORMAT_VALUES.includes(format)) {
|
|
48
38
|
throw new Error(`voice-tag-content: invalid format '${format}'. Valid values: ${FORMAT_VALUES.join(", ")}`);
|
|
49
39
|
}
|
|
50
40
|
if (!Array.isArray(nodeIds) || nodeIds.length === 0) {
|
|
@@ -60,16 +50,12 @@ export async function voiceTagContent(params) {
|
|
|
60
50
|
for (let i = 0; i < nodeIds.length; i += BATCH) {
|
|
61
51
|
const batch = nodeIds.slice(i, i + BATCH);
|
|
62
52
|
const result = await session.run(
|
|
63
|
-
// Tag any of the
|
|
53
|
+
// Tag any of the three primary content labels, or a conversation-
|
|
64
54
|
// document :Section chunk (parent :KnowledgeDocument carries
|
|
65
55
|
// `conversationIdentity`). The EXISTS sub-pattern guards against
|
|
66
56
|
// accidentally tagging document-path :Section rows AND parent
|
|
67
57
|
// `:Conversation` / `:AdminConversation` nodes (which are not
|
|
68
58
|
// body-bearing content).
|
|
69
|
-
//
|
|
70
|
-
// Format is either the caller-supplied constant ($format is non-null)
|
|
71
|
-
// or derived per-node via the CASE expression that mirrors
|
|
72
|
-
// deriveFormat() in voice-corpus.ts.
|
|
73
59
|
`UNWIND $ids AS id
|
|
74
60
|
MATCH (n) WHERE elementId(n) = id AND n.accountId = $accountId
|
|
75
61
|
WITH n
|
|
@@ -80,13 +66,13 @@ export async function voiceTagContent(params) {
|
|
|
80
66
|
})
|
|
81
67
|
SET n.authorshipMode = $mode,
|
|
82
68
|
n.authorshipTaggedAt = $now,
|
|
83
|
-
n.format =
|
|
69
|
+
n.format = $format
|
|
84
70
|
RETURN elementId(n) AS id`, {
|
|
85
71
|
ids: batch,
|
|
86
72
|
accountId,
|
|
87
73
|
mode,
|
|
88
74
|
now,
|
|
89
|
-
format
|
|
75
|
+
format,
|
|
90
76
|
primaryLabels: [...TAGGABLE_PRIMARY_LABELS],
|
|
91
77
|
});
|
|
92
78
|
const matched = new Set(result.records.map((r) => r.get("id")));
|
|
@@ -102,7 +88,7 @@ export async function voiceTagContent(params) {
|
|
|
102
88
|
finally {
|
|
103
89
|
await session.close();
|
|
104
90
|
}
|
|
105
|
-
process.stderr.write(`[voice-tag] mode=${mode} format=${format
|
|
91
|
+
process.stderr.write(`[voice-tag] mode=${mode} format=${format} accountId=${accountId} updated=${updated} skipped=${nodeIds.length - updated}\n`);
|
|
106
92
|
return {
|
|
107
93
|
updated,
|
|
108
94
|
skipped: nodeIds.length - updated,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-tag-content.js","sourceRoot":"","sources":["../../src/tools/voice-tag-content.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"voice-tag-content.js","sourceRoot":"","sources":["../../src/tools/voice-tag-content.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,uBAAuB,EACvB,aAAa,GAEd,MAAM,wBAAwB,CAAC;AAShC,MAAM,CAAC,MAAM,gBAAgB,GAAgC,IAAI,GAAG,CAAC;IACnE,YAAY;IACZ,0BAA0B;IAC1B,0BAA0B;IAC1B,YAAY;IACZ,SAAS;CACV,CAAC,CAAC;AAgBH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAA6B;IAE7B,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAEpD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,8CAA8C,IAAI,oBAAoB;YACpE,GAAG,gBAAgB;SACpB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACf,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,CAAE,aAAmC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CACb,sCAAsC,MAAM,oBAAoB,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3F,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAA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