@rubytech/create-realagent 1.0.829 → 1.0.831
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/package.json +1 -1
- package/payload/platform/config/brand.json +1 -1
- package/payload/platform/lib/oauth-llm/dist/index.d.ts +9 -2
- package/payload/platform/lib/oauth-llm/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/oauth-llm/dist/index.js +26 -1
- package/payload/platform/lib/oauth-llm/dist/index.js.map +1 -1
- package/payload/platform/lib/oauth-llm/src/index.ts +43 -4
- package/payload/platform/neo4j/migrations/007-conversation-archive-source.ts +116 -0
- package/payload/platform/neo4j/migrations/008-adminuser-accountid-backfill.ts +85 -0
- package/payload/platform/neo4j/schema.cypher +12 -3
- package/payload/platform/plugins/admin/hooks/__tests__/archive-ingest-surface-gate.test.sh +54 -39
- package/payload/platform/plugins/admin/hooks/archive-ingest-surface-gate.sh +64 -26
- package/payload/platform/plugins/admin/mcp/dist/index.js +25 -3
- package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/index.js +5 -5
- package/payload/platform/plugins/contacts/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.d.ts +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.d.ts.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.js +29 -23
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.js.map +1 -1
- package/payload/platform/plugins/docs/references/internals.md +1 -1
- package/payload/platform/plugins/docs/references/plugins-guide.md +1 -1
- package/payload/platform/plugins/memory/PLUGIN.md +2 -1
- package/payload/platform/plugins/memory/bin/conversation-archive-ingest.mjs +564 -0
- package/payload/platform/plugins/memory/bin/conversation-archive-ingest.sh +106 -0
- package/payload/platform/plugins/memory/mcp/dist/index.js +30 -16
- package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.js +4 -3
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-loader.test.js +11 -6
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-loader.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/index.d.ts +5 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/index.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/index.js +30 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/index.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/timestamp-scanner.d.ts +49 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/timestamp-scanner.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/timestamp-scanner.js +35 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/timestamp-scanner.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/types.d.ts +47 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/types.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/types.js +31 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/types.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/whatsapp-text.d.ts +3 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/whatsapp-text.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/whatsapp-text.js +155 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-normalisers/whatsapp-text.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/delta-cursor.d.ts +11 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/delta-cursor.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/delta-cursor.js +20 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/delta-cursor.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/derive-keys.d.ts +14 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/derive-keys.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/derive-keys.js +38 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/derive-keys.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/sender-bind.d.ts +16 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/sender-bind.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/sender-bind.js +59 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/sender-bind.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/sessionize.d.ts +9 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/sessionize.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/sessionize.js +32 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/sessionize.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/to-turn-text.d.ts +3 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/to-turn-text.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/to-turn-text.js +29 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/conversation-pipeline/to-turn-text.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/document-chunker.d.ts +45 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/document-chunker.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/document-chunker.js +125 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/document-chunker.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.d.ts +34 -9
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.js +360 -35
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.d.ts +3 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.js +46 -17
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-source-agnosticism.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-source-agnosticism.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-source-agnosticism.test.js +73 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-source-agnosticism.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-whatsapp-text.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-whatsapp-text.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-whatsapp-text.test.js +109 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-normalisers-whatsapp-text.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest.test.js +34 -3
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.d.ts +17 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.js +34 -13
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.d.ts +18 -7
- 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 +24 -8
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-rank.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-rank.js.map +1 -1
- package/payload/platform/plugins/memory/references/schema-base.md +2 -2
- package/payload/platform/plugins/memory/skills/conversation-archive/SKILL.md +133 -0
- package/payload/platform/plugins/memory/skills/document-ingest/SKILL.md +5 -2
- package/payload/platform/plugins/whatsapp/PLUGIN.md +1 -1
- package/payload/platform/scripts/seed-neo4j.sh +15 -15
- package/payload/platform/templates/specialists/agents/database-operator.md +8 -9
- package/payload/server/chunk-7BO5HDJC.js +10093 -0
- package/payload/server/chunk-BCFM2UPH.js +2305 -0
- package/payload/server/chunk-CV3HPX46.js +10097 -0
- package/payload/server/chunk-EL4DZ56X.js +1116 -0
- package/payload/server/chunk-J6YWEJBN.js +1116 -0
- package/payload/server/chunk-OCPJGZ6S.js +654 -0
- package/payload/server/chunk-QOJ2D26Z.js +654 -0
- package/payload/server/chunk-RC46ZYGT.js +2305 -0
- package/payload/server/client-pool-7NTEFNVQ.js +32 -0
- package/payload/server/client-pool-ZNGN66GN.js +32 -0
- package/payload/server/cloudflare-task-tracker-MHALDN54.js +19 -0
- package/payload/server/cloudflare-task-tracker-WE77WXSI.js +19 -0
- package/payload/server/maxy-edge.js +3 -3
- package/payload/server/neo4j-migrations-4XPNJNM6.js +490 -0
- package/payload/server/neo4j-migrations-6RW423E2.js +530 -0
- package/payload/server/server.js +30 -19
|
@@ -17,16 +17,81 @@
|
|
|
17
17
|
* Hallucination defence: every returned `kind` is verified against the
|
|
18
18
|
* loaded ontology label set. Sections whose `kind` is not a real label
|
|
19
19
|
* are tagged `UNMAPPED`. Failure of the LLM call (missing creds, network,
|
|
20
|
-
* malformed JSON) returns `{kind: "
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* malformed JSON) returns `{kind: "error", reason}` (Task 897 vocabulary
|
|
21
|
+
* — was `kind: "fallback"`). The caller decides whether to abort the
|
|
22
|
+
* ingest or degrade-on-error per session; classifier never silently
|
|
23
|
+
* substitutes a degraded write.
|
|
23
24
|
*/
|
|
24
25
|
import { callOauthLlm } from "../../../../../lib/oauth-llm/dist/index.js";
|
|
25
26
|
import { HAIKU_MODEL } from "../../../../../lib/models/dist/index.js";
|
|
27
|
+
import { chunkDocument, mergeOverlappingSections } from "./document-chunker.js";
|
|
26
28
|
// ---------------------------------------------------------------------------
|
|
27
29
|
// Constants
|
|
28
30
|
// ---------------------------------------------------------------------------
|
|
29
31
|
const MAX_OUTPUT_TOKENS = 8192;
|
|
32
|
+
/**
|
|
33
|
+
* Per-section summary cap (Task 896 clause 1; tightened by Task 897 sub-scope F).
|
|
34
|
+
* Reduced 500 → 100 because the offsets-only schema's per-section JSON now
|
|
35
|
+
* has tiny structural overhead, and a 500-char summary made a 30-section
|
|
36
|
+
* document blow past the prompt's 6000-token output budget. The classifier
|
|
37
|
+
* prompt advertises this cap; the server truncates oversize summaries with
|
|
38
|
+
* an ellipsis. `summaryTruncated` counter on the haiku-ok line surfaces the
|
|
39
|
+
* rate of model misbehaviour without aborting.
|
|
40
|
+
*/
|
|
41
|
+
const SUMMARY_MAX_CHARS = 100;
|
|
42
|
+
/**
|
|
43
|
+
* Output budget the prompt advertises to the model. ≈6000 tokens leaves
|
|
44
|
+
* headroom under MAX_OUTPUT_TOKENS=8192 for a few hundred sections of
|
|
45
|
+
* offsets + short summaries without re-emitting body text. Pre-Task-896
|
|
46
|
+
* the verbatim-body schema made output ≈ input — a 251K-char Adam Mackay
|
|
47
|
+
* archive truncated mid-word at 8K.
|
|
48
|
+
*/
|
|
49
|
+
const PROMPT_OUTPUT_TOKEN_BUDGET = 6000;
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Task 896 clause 3 — chunker constants for oversize prose.
|
|
52
|
+
//
|
|
53
|
+
// Haiku 4.5: 200K input tokens. Reserve ~5K for prompt + system overhead
|
|
54
|
+
// → ~195K usable tokens × ~3.5 chars/token = ~682K char input ceiling per
|
|
55
|
+
// Haiku call. The chunker emits chunks of ~150K tokens (~525K chars) with
|
|
56
|
+
// ~5K-token (~17.5K-char) overlap so a section straddling the boundary
|
|
57
|
+
// surfaces in both surrounding chunks for the merge step.
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
const CHARS_PER_TOKEN_ESTIMATE = 3.5;
|
|
60
|
+
const HAIKU_INPUT_TOKEN_BUDGET = 195_000;
|
|
61
|
+
/** Per-Haiku-call hard ceiling on `documentText` characters — enforced regardless of mode. */
|
|
62
|
+
const INPUT_CHAR_CEILING = Math.floor(HAIKU_INPUT_TOKEN_BUDGET * CHARS_PER_TOKEN_ESTIMATE);
|
|
63
|
+
const CHUNK_TOKEN_SIZE = 150_000;
|
|
64
|
+
const CHUNK_OVERLAP_TOKENS = 5_000;
|
|
65
|
+
/** Target chunk char size for the prose chunker (Task 896 clause 3). */
|
|
66
|
+
const CHUNK_CHAR_SIZE = Math.floor(CHUNK_TOKEN_SIZE * CHARS_PER_TOKEN_ESTIMATE);
|
|
67
|
+
const CHUNK_OVERLAP_CHARS = Math.floor(CHUNK_OVERLAP_TOKENS * CHARS_PER_TOKEN_ESTIMATE);
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Task 897 sub-scope F — projected-output chunker gate.
|
|
70
|
+
//
|
|
71
|
+
// Pre-897 dispatch was `documentText.length > CHUNK_CHAR_SIZE` (≈525K chars).
|
|
72
|
+
// That gate fires only on >525K-char inputs, but a 251K-char Adam Mackay
|
|
73
|
+
// archive with ~62 dense chat sessions still produced an 8K-token-truncated
|
|
74
|
+
// response — the input wasn't oversize, the OUTPUT was. Task 896's
|
|
75
|
+
// offsets-only schema cut per-section JSON down dramatically, but a dense
|
|
76
|
+
// archive at avg ~1500 chars per section still emits ~170 sections, and at
|
|
77
|
+
// ~75 tokens per section that's ~12K output tokens — twice the prompt's
|
|
78
|
+
// advertised 6K budget.
|
|
79
|
+
//
|
|
80
|
+
// New gate: project output tokens before the call. With SUMMARY_MAX_CHARS=100
|
|
81
|
+
// the per-section JSON shape is roughly:
|
|
82
|
+
// { kind, title (≤120), summary (≤100), sourceStart, sourceEnd, properties }
|
|
83
|
+
// ≈ 250–300 chars ≈ 75 tokens worst case. Conservative chars-per-section is
|
|
84
|
+
// ~1500 (covers contract-clause documents and dense chat). Project sections
|
|
85
|
+
// from input length and force chunked dispatch when the projection exceeds
|
|
86
|
+
// PROMPT_OUTPUT_TOKEN_BUDGET. The threshold lands at ~120K chars input —
|
|
87
|
+
// well below CHUNK_CHAR_SIZE, which now serves as a defence-in-depth ceiling.
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
const PROJECTED_CHARS_PER_SECTION = 1_500;
|
|
90
|
+
const PROJECTED_TOKENS_PER_SECTION = 75;
|
|
91
|
+
function projectOutputTokens(documentTextLength) {
|
|
92
|
+
const estimatedSections = Math.ceil(documentTextLength / PROJECTED_CHARS_PER_SECTION);
|
|
93
|
+
return estimatedSections * PROJECTED_TOKENS_PER_SECTION;
|
|
94
|
+
}
|
|
30
95
|
/**
|
|
31
96
|
* Closed enumeration of section `kind` values. Each becomes a secondary
|
|
32
97
|
* label on the `:Section` node (e.g. `:Section:Position`). Anything outside
|
|
@@ -55,10 +120,7 @@ export const STRUCTURAL_SECTION_KINDS = [
|
|
|
55
120
|
"Bibliography",
|
|
56
121
|
"Glossary",
|
|
57
122
|
"Acknowledgments",
|
|
58
|
-
// Task 891
|
|
59
|
-
// The chat-mode system prompt restricts output to this single kind; the
|
|
60
|
-
// document-mode prompt never names it. Listed here so the validator's closed
|
|
61
|
-
// enumeration accepts it without a per-mode dictionary split.
|
|
123
|
+
// Task 891: chat-mode kind. Emitted only when mode==='chat'; listed here so the validator's closed enumeration accepts it.
|
|
62
124
|
"Conversation",
|
|
63
125
|
];
|
|
64
126
|
export const CONTRACT_SECTION_KINDS = [
|
|
@@ -115,14 +177,17 @@ const CHAT_SYSTEM_PROMPT = [
|
|
|
115
177
|
" [DD/MM/YYYY, HH:MM:SS] <Sender>: <body>",
|
|
116
178
|
" [DD/MM/YY, HH:MM:SS] <Sender>: <body>",
|
|
117
179
|
" [YYYY-MM-DD HH:MM:SS] <Sender>: <body>",
|
|
118
|
-
"Body lines without a leading bracketed timestamp belong to the previous message (multi-line bodies). System messages (no sender) and media-only lines (e.g. '<Media omitted>')
|
|
180
|
+
"Body lines without a leading bracketed timestamp belong to the previous message (multi-line bodies). System messages (no sender) and media-only lines (e.g. '<Media omitted>') belong inside the chunk that covers their position.",
|
|
181
|
+
"",
|
|
182
|
+
`OUTPUT BUDGET — your JSON response must fit within ~${PROMPT_OUTPUT_TOKEN_BUDGET} output tokens. Use offsets — NEVER re-emit body text. The server reconstructs each chunk's body from your offsets via documentText.slice(sourceStart, sourceEnd) and stores it on the node, so byte-equal recovery works without you transmitting the bytes.`,
|
|
119
183
|
"",
|
|
120
184
|
"Each chunk is a JSON object with:",
|
|
121
185
|
"- 'kind': MUST be exactly 'Conversation'. No other kinds are legal in chat mode.",
|
|
122
186
|
"- 'title': short human-readable topic label for the chunk (max 120 chars).",
|
|
123
|
-
|
|
187
|
+
`- 'summary': 1-3 sentences describing what this chunk is about. Hard ceiling ${SUMMARY_MAX_CHARS} characters — the server truncates anything longer.`,
|
|
188
|
+
"- 'sourceStart': INTEGER character offset into the supplied archive text where this chunk's first message begins (0-indexed, inclusive). MUST point at the opening '[' of the bracketed timestamp prefix.",
|
|
189
|
+
"- 'sourceEnd': INTEGER character offset where this chunk ends (exclusive). MUST be > sourceStart and ≤ total length of the supplied text.",
|
|
124
190
|
"- 'properties': required typed properties on the chunk node:",
|
|
125
|
-
" summary : 1-3 sentences describing what this chunk is about (this is your one chance to summarise; the body stays verbatim).",
|
|
126
191
|
" keywords : array of 3-10 lowercase topic keywords for retrieval.",
|
|
127
192
|
" firstMessageAt : timestamp of the first message in the chunk, copied verbatim from the line prefix (preserve the file's native format and any offset).",
|
|
128
193
|
" lastMessageAt : timestamp of the last message in the chunk, copied verbatim from the line prefix.",
|
|
@@ -142,7 +207,7 @@ const CHAT_SYSTEM_PROMPT = [
|
|
|
142
207
|
"- Split at topic transitions, not at message count or arbitrary intervals. A coherent exchange ('let's discuss the deck') is one chunk; a separate exchange ('what time tomorrow?') is another.",
|
|
143
208
|
"- An archive of fewer than ~10 messages is usually one chunk.",
|
|
144
209
|
"- Even a one-message archive must produce one chunk — never return zero chunks for non-empty input.",
|
|
145
|
-
"-
|
|
210
|
+
"- Offset coverage: chunks MUST cover every message in chronological order. Adjacent chunks should be contiguous (chunk N's sourceEnd equals chunk N+1's sourceStart) so no message is skipped. messageCount summed across chunks equals total archive messages.",
|
|
146
211
|
"",
|
|
147
212
|
"Respond with ONLY the JSON object, no prose, no markdown fences.",
|
|
148
213
|
].join("\n");
|
|
@@ -154,6 +219,8 @@ const SYSTEM_PROMPT = [
|
|
|
154
219
|
"2. The natural-edge map naming the anchor edge for identity-kind sections.",
|
|
155
220
|
"3. The full document text.",
|
|
156
221
|
"",
|
|
222
|
+
`OUTPUT BUDGET — your JSON response must fit within ~${PROMPT_OUTPUT_TOKEN_BUDGET} output tokens. Use offsets — NEVER re-emit body text. The server reconstructs each section's body from your offsets via documentText.slice(sourceStart, sourceEnd) and stores it on the node. Per-section 'summary' is hard-capped at ${SUMMARY_MAX_CHARS} chars.`,
|
|
223
|
+
"",
|
|
157
224
|
"Closed enumeration of section `kind` values:",
|
|
158
225
|
` Identity (anchor edge to subject): ${IDENTITY_SECTION_KINDS.join(", ")}`,
|
|
159
226
|
` Document-structural (no anchor edge; HAS_SECTION + NEXT only): ${STRUCTURAL_SECTION_KINDS.join(", ")}`,
|
|
@@ -164,7 +231,9 @@ const SYSTEM_PROMPT = [
|
|
|
164
231
|
"For each meaningful section, return a JSON object with:",
|
|
165
232
|
"- 'kind': one of the closed-enumeration values above. Never invent new kinds; use 'Other' with a 'classifierReason' if nothing fits.",
|
|
166
233
|
"- 'title': short human-readable title (max 120 chars).",
|
|
167
|
-
|
|
234
|
+
`- 'summary': 1-3 sentences describing the section. Hard ceiling ${SUMMARY_MAX_CHARS} characters — the server truncates anything longer.`,
|
|
235
|
+
"- 'sourceStart': INTEGER character offset into the supplied document text where this section begins (0-indexed, inclusive).",
|
|
236
|
+
"- 'sourceEnd': INTEGER character offset where this section ends (exclusive). MUST be > sourceStart and ≤ total length of the supplied text.",
|
|
168
237
|
"- 'properties': any typed properties for the section node (e.g. for Position: jobTitle, startDate, endDate; for Education: degree, fieldOfStudy; do NOT include accountId, embedding, createdAt, or other system fields — the writer adds them).",
|
|
169
238
|
"- 'anchorEdge': for identity-kind sections (Position, Education, Credential, Skill, Biography) and for standalone Project, an object { type, direction, properties } naming the natural edge to the document subject (e.g. UserProfile -[HAS_POSITION]-> the Section). 'direction' is 'from-anchor' if the subject points at the section, 'to-anchor' if the section points at the subject. Set to null for structural + contract-clause kinds and for 'Other'.",
|
|
170
239
|
"- 'related': optional array of additional entity nodes this section references (e.g. a Position section's employer Organization via AT, an Education section's school Organization via ATTENDED). Each entry: { kind, properties, edge: { type, direction, properties }, merge: true|false }. Direction is 'outgoing' (section -> related) or 'incoming' (section <- related). Use 'merge': true for entities reused across documents (Organization by name, Person by email/telephone).",
|
|
@@ -186,19 +255,38 @@ const SYSTEM_PROMPT = [
|
|
|
186
255
|
"- 'kind' values are restricted to the closed enumeration above. If a section truly fits no listed kind, use 'Other' with a 'classifierReason'. Never emit a kind not on the list.",
|
|
187
256
|
"- Never invent edge names. Use the natural-edge map exactly as given. The graph validator rejects writes with unknown edge types.",
|
|
188
257
|
"- Be conservative with 'related' entities — only include them when the section explicitly names them.",
|
|
189
|
-
"-
|
|
258
|
+
"- Offsets cover the source: sourceStart and sourceEnd are integer character positions in the supplied document text. Do not re-emit body text — the server reconstructs it from your offsets.",
|
|
190
259
|
"- Respond with ONLY the JSON object, no prose, no markdown fences.",
|
|
191
260
|
].join("\n");
|
|
192
261
|
// ---------------------------------------------------------------------------
|
|
193
262
|
// Helpers
|
|
194
263
|
// ---------------------------------------------------------------------------
|
|
264
|
+
/**
|
|
265
|
+
* Strip a balanced markdown fence from a JSON response. Returns:
|
|
266
|
+
* { kind: "ok", json } when the text was bare JSON or fully fenced.
|
|
267
|
+
* { kind: "truncated", reason } when the text opens a fence but never closes
|
|
268
|
+
* it — a structural fingerprint of `max_tokens` mid-response (Task 897
|
|
269
|
+
* sub-scope G, replacing the pre-897 silent fall-through to JSON.parse
|
|
270
|
+
* which masked truncation as `malformed JSON`).
|
|
271
|
+
*/
|
|
195
272
|
function extractJson(raw) {
|
|
196
273
|
const trimmed = raw.trim();
|
|
197
|
-
const
|
|
198
|
-
|
|
274
|
+
const balanced = trimmed.match(/^```(?:json)?\s*([\s\S]*?)```$/);
|
|
275
|
+
if (balanced)
|
|
276
|
+
return { kind: "ok", json: balanced[1].trim() };
|
|
277
|
+
// One-sided fence — opens with ``` (optionally `json`) but no closing fence.
|
|
278
|
+
// This is the truncation fingerprint: the model started a fenced response
|
|
279
|
+
// and ran out of output tokens before closing it.
|
|
280
|
+
if (/^```(?:json)?/.test(trimmed) && !/```\s*$/.test(trimmed)) {
|
|
281
|
+
return {
|
|
282
|
+
kind: "truncated",
|
|
283
|
+
reason: "response-truncated: opening ``` fence with no closing — model likely hit max_tokens mid-response",
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
return { kind: "ok", json: trimmed };
|
|
199
287
|
}
|
|
200
|
-
function
|
|
201
|
-
process.stderr.write(`[memory-classify] [${accountId}]
|
|
288
|
+
function logError(accountId, reason) {
|
|
289
|
+
process.stderr.write(`[memory-classify] [${accountId}] ERROR reason="${reason}"\n`);
|
|
202
290
|
}
|
|
203
291
|
function asString(v) {
|
|
204
292
|
return typeof v === "string" ? v : null;
|
|
@@ -206,6 +294,22 @@ function asString(v) {
|
|
|
206
294
|
function asObject(v) {
|
|
207
295
|
return v && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
208
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Coerce a JSON value into a non-negative integer character offset, or null
|
|
299
|
+
* if it isn't one. Floats, NaN, negatives, and non-numbers all return null —
|
|
300
|
+
* Haiku has been observed emitting `null` and stringly-typed offsets when
|
|
301
|
+
* stressed; we drop the section silently and let the missing-offsets
|
|
302
|
+
* diagnostic surface the rate.
|
|
303
|
+
*/
|
|
304
|
+
function asNonNegativeInt(v) {
|
|
305
|
+
if (typeof v !== "number")
|
|
306
|
+
return null;
|
|
307
|
+
if (!Number.isFinite(v) || !Number.isInteger(v))
|
|
308
|
+
return null;
|
|
309
|
+
if (v < 0)
|
|
310
|
+
return null;
|
|
311
|
+
return v;
|
|
312
|
+
}
|
|
209
313
|
/**
|
|
210
314
|
* Classify a document into typed sections via Haiku (Task 740).
|
|
211
315
|
*
|
|
@@ -215,14 +319,48 @@ function asObject(v) {
|
|
|
215
319
|
* Sections the classifier could not natural-edge appear in
|
|
216
320
|
* `output.orphanCandidates`. The skill surfaces orphans loudly to
|
|
217
321
|
* the operator.
|
|
218
|
-
* { kind: "
|
|
219
|
-
* malformed JSON
|
|
220
|
-
*
|
|
221
|
-
*
|
|
322
|
+
* { kind: "error", reason } when the LLM is unavailable, returns
|
|
323
|
+
* malformed JSON, or hits an input-too-large guard. The caller
|
|
324
|
+
* decides whether to abort the ingest entirely (document mode) or
|
|
325
|
+
* degrade-on-error per session (chat mode, Task 897). Classifier
|
|
326
|
+
* never silently substitutes a degraded write.
|
|
222
327
|
*/
|
|
223
328
|
export async function classifyDocument(params) {
|
|
224
329
|
const { accountId, anchorDescription, ontologyLabels, naturalEdgeMap, documentText } = params;
|
|
225
330
|
const mode = params.mode ?? "document";
|
|
331
|
+
// Task 896 clause 3 + Task 897 sub-scope F dispatch.
|
|
332
|
+
//
|
|
333
|
+
// Document mode forces the chunked path when EITHER:
|
|
334
|
+
// - the input exceeds CHUNK_CHAR_SIZE (input-size gate, defence-in-depth), OR
|
|
335
|
+
// - the projected output tokens exceed PROMPT_OUTPUT_TOKEN_BUDGET
|
|
336
|
+
// (output-size gate, the primary trigger post-Task-896 since the
|
|
337
|
+
// offsets-only schema means input size no longer predicts output size).
|
|
338
|
+
//
|
|
339
|
+
// Oversize chat mode loud-fails (sessionize must keep sessions under
|
|
340
|
+
// the ceiling, per eng review). Single-shot path stays unchanged below.
|
|
341
|
+
if (mode === "document") {
|
|
342
|
+
const projected = projectOutputTokens(documentText.length);
|
|
343
|
+
if (documentText.length > CHUNK_CHAR_SIZE || projected > PROMPT_OUTPUT_TOKEN_BUDGET) {
|
|
344
|
+
process.stderr.write(`[memory-classify] [${accountId}] dispatch=chunked chars=${documentText.length} projectedOutputTokens=${projected} budget=${PROMPT_OUTPUT_TOKEN_BUDGET}\n`);
|
|
345
|
+
return classifyDocumentChunked(params);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (documentText.length > INPUT_CHAR_CEILING) {
|
|
349
|
+
const overage = `chars=${documentText.length}, ceiling=${INPUT_CHAR_CEILING}`;
|
|
350
|
+
if (mode === "chat") {
|
|
351
|
+
logError(accountId, `input-too-large: chat session exceeds Haiku input ceiling (${overage}). Sessionize must split sessions before classify (Task 894).`);
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
// Document mode > INPUT_CHAR_CEILING but ≤ CHUNK_CHAR_SIZE shouldn't
|
|
355
|
+
// happen since CHUNK_CHAR_SIZE < INPUT_CHAR_CEILING — kept as
|
|
356
|
+
// defence-in-depth in case constants drift.
|
|
357
|
+
logError(accountId, `input-too-large: document exceeds Haiku input ceiling without chunking (${overage}). Constants drift between CHUNK_CHAR_SIZE and INPUT_CHAR_CEILING.`);
|
|
358
|
+
}
|
|
359
|
+
return {
|
|
360
|
+
kind: "error",
|
|
361
|
+
reason: `Input is ${documentText.length} chars; classifier ceiling is ${INPUT_CHAR_CEILING}.`,
|
|
362
|
+
};
|
|
363
|
+
}
|
|
226
364
|
// System prompt + user message branch on mode. Chat mode strips the
|
|
227
365
|
// natural-edge map and reframes the input as a session of turn-attributed
|
|
228
366
|
// text; document mode is unchanged from Task 740.
|
|
@@ -266,24 +404,47 @@ export async function classifyDocument(params) {
|
|
|
266
404
|
});
|
|
267
405
|
const haikuMs = Date.now() - haikuStart;
|
|
268
406
|
if (llmResult.kind === "fallback") {
|
|
269
|
-
|
|
270
|
-
return { kind: "
|
|
407
|
+
logError(accountId, `${llmResult.cause}: ${llmResult.reason}`);
|
|
408
|
+
return { kind: "error", reason: llmResult.reason };
|
|
271
409
|
}
|
|
272
410
|
const responseText = llmResult.text;
|
|
411
|
+
// Task 897 sub-scope G — surface finish-reason + output-tokens per call so
|
|
412
|
+
// a `max_tokens` from Haiku appears directly in observability instead of
|
|
413
|
+
// surfacing downstream as `malformed JSON`.
|
|
414
|
+
const stopReason = llmResult.stopReason ?? "(unknown)";
|
|
415
|
+
const outputTokens = llmResult.outputTokens ?? -1;
|
|
416
|
+
process.stderr.write(`[memory-classify] [${accountId}] response-finish-reason=${stopReason} output-tokens=${outputTokens}\n`);
|
|
273
417
|
// --- Parse + validate ---
|
|
274
|
-
|
|
418
|
+
// Task 897 sub-scope G — fence handling is structural now. A one-sided
|
|
419
|
+
// fence (opening ``` with no closing) is the `max_tokens` truncation
|
|
420
|
+
// fingerprint; surface it as `response-truncated` instead of falling
|
|
421
|
+
// through to JSON.parse and reporting `malformed JSON`.
|
|
422
|
+
const fence = extractJson(responseText);
|
|
423
|
+
if (fence.kind === "truncated") {
|
|
424
|
+
logError(accountId, `${fence.reason} stop-reason=${stopReason} output-tokens=${outputTokens} len=${responseText.length} pre-strip-tail=${JSON.stringify(responseText.slice(-200))}`);
|
|
425
|
+
return { kind: "error", reason: "Haiku response truncated mid-fence (likely max_tokens hit)" };
|
|
426
|
+
}
|
|
427
|
+
const jsonText = fence.json;
|
|
275
428
|
let parsed;
|
|
276
429
|
try {
|
|
277
430
|
parsed = JSON.parse(jsonText);
|
|
278
431
|
}
|
|
279
|
-
catch {
|
|
280
|
-
|
|
281
|
-
|
|
432
|
+
catch (err) {
|
|
433
|
+
// Task 896 clause 5: surface diagnostics so a malformed-JSON error
|
|
434
|
+
// distinguishes fence drift and genuine model junk. The truncation case
|
|
435
|
+
// is now caught above by `extractJson` returning `kind: "truncated"`,
|
|
436
|
+
// so this branch covers genuinely malformed JSON only.
|
|
437
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
438
|
+
const fenceStripped = jsonText !== responseText;
|
|
439
|
+
logError(accountId, `malformed JSON: parse-error=${JSON.stringify(message)} len=${responseText.length} fence-stripped=${fenceStripped} stop-reason=${stopReason} ` +
|
|
440
|
+
`pre-strip-head=${JSON.stringify(responseText.slice(0, 200))} ` +
|
|
441
|
+
`pre-strip-tail=${JSON.stringify(responseText.slice(-200))}`);
|
|
442
|
+
return { kind: "error", reason: "Haiku returned malformed JSON" };
|
|
282
443
|
}
|
|
283
444
|
const root = asObject(parsed);
|
|
284
445
|
if (!root) {
|
|
285
|
-
|
|
286
|
-
return { kind: "
|
|
446
|
+
logError(accountId, "response is not an object");
|
|
447
|
+
return { kind: "error", reason: "invalid response shape" };
|
|
287
448
|
}
|
|
288
449
|
const documentSummary = asString(root.documentSummary) ?? "";
|
|
289
450
|
const documentKeywords = Array.isArray(root.documentKeywords)
|
|
@@ -291,20 +452,49 @@ export async function classifyDocument(params) {
|
|
|
291
452
|
: [];
|
|
292
453
|
const rawSections = Array.isArray(root.sections) ? root.sections : null;
|
|
293
454
|
if (!rawSections) {
|
|
294
|
-
|
|
295
|
-
return { kind: "
|
|
455
|
+
logError(accountId, "missing sections array");
|
|
456
|
+
return { kind: "error", reason: "invalid response shape (no sections)" };
|
|
296
457
|
}
|
|
297
458
|
const sections = [];
|
|
298
459
|
let hallucinatedRelated = 0;
|
|
460
|
+
// Task 896 clause 1 diagnostics — counters for offset/summary post-validation
|
|
461
|
+
// failures so the haiku-ok log line names the rate of model misbehaviour.
|
|
462
|
+
// Per-section drops are silent; the aggregate count tells the operator
|
|
463
|
+
// whether the prompt is degrading.
|
|
464
|
+
let droppedForOffsets = 0;
|
|
465
|
+
let summaryTruncated = 0;
|
|
299
466
|
for (const raw of rawSections) {
|
|
300
467
|
const obj = asObject(raw);
|
|
301
468
|
if (!obj)
|
|
302
469
|
continue;
|
|
470
|
+
// Task 896 clause 1: read offsets and reconstruct body server-side.
|
|
471
|
+
// Pre-Task-896 the LLM emitted body verbatim, making output ≈ input
|
|
472
|
+
// and causing 8K-token truncation on >80K-char inputs.
|
|
473
|
+
const sourceStart = asNonNegativeInt(obj.sourceStart);
|
|
474
|
+
const sourceEnd = asNonNegativeInt(obj.sourceEnd);
|
|
475
|
+
if (sourceStart === null || sourceEnd === null) {
|
|
476
|
+
droppedForOffsets += 1;
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
if (sourceEnd <= sourceStart || sourceEnd > documentText.length) {
|
|
480
|
+
droppedForOffsets += 1;
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
const body = documentText.slice(sourceStart, sourceEnd);
|
|
484
|
+
if (body.length === 0) {
|
|
485
|
+
droppedForOffsets += 1;
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
303
488
|
const title = asString(obj.title) ?? "";
|
|
304
|
-
const body = asString(obj.body) ?? "";
|
|
305
489
|
const properties = asObject(obj.properties) ?? {};
|
|
306
|
-
|
|
307
|
-
|
|
490
|
+
let summary = asString(obj.summary) ?? "";
|
|
491
|
+
if (summary.length > SUMMARY_MAX_CHARS) {
|
|
492
|
+
summary = summary.slice(0, SUMMARY_MAX_CHARS - 1) + "…";
|
|
493
|
+
summaryTruncated += 1;
|
|
494
|
+
}
|
|
495
|
+
// Mirror summary into properties so the Neo4j section node carries it
|
|
496
|
+
// (chat-mode parity — pre-Task-896 chunks stored summary as properties.summary).
|
|
497
|
+
properties.summary = summary;
|
|
308
498
|
if (mode === "chat") {
|
|
309
499
|
// Chat mode: only `Conversation` is legal. Haiku is instructed to emit
|
|
310
500
|
// exactly that kind; force it here so a misfire still produces a valid
|
|
@@ -315,6 +505,9 @@ export async function classifyDocument(params) {
|
|
|
315
505
|
kind: "Conversation",
|
|
316
506
|
title: title.slice(0, 200),
|
|
317
507
|
body,
|
|
508
|
+
summary,
|
|
509
|
+
sourceStart,
|
|
510
|
+
sourceEnd,
|
|
318
511
|
properties,
|
|
319
512
|
anchorEdge: null,
|
|
320
513
|
});
|
|
@@ -376,6 +569,9 @@ export async function classifyDocument(params) {
|
|
|
376
569
|
kind,
|
|
377
570
|
title: title.slice(0, 200),
|
|
378
571
|
body,
|
|
572
|
+
summary,
|
|
573
|
+
sourceStart,
|
|
574
|
+
sourceEnd,
|
|
379
575
|
properties,
|
|
380
576
|
anchorEdge: kind === SECTION_KIND_OTHER ? null : anchorEdge,
|
|
381
577
|
related: related.length > 0 ? related : undefined,
|
|
@@ -384,6 +580,19 @@ export async function classifyDocument(params) {
|
|
|
384
580
|
: {}),
|
|
385
581
|
});
|
|
386
582
|
}
|
|
583
|
+
// Missing-offsets fallback (Task 896 clause 1, surfaced by CEO review):
|
|
584
|
+
// if Haiku emitted sections but every one failed offset validation, we'd
|
|
585
|
+
// otherwise return an empty `sections` array silently and the writer would
|
|
586
|
+
// happily produce zero `:Section` nodes. Loud-fail instead so the operator
|
|
587
|
+
// sees the regression — typically caused by a model that ignored the new
|
|
588
|
+
// offset contract and reverted to emitting `body`.
|
|
589
|
+
if (rawSections.length > 0 && sections.length === 0) {
|
|
590
|
+
logError(accountId, `missing-offsets: every section failed offset validation (rawSections=${rawSections.length}, droppedForOffsets=${droppedForOffsets}). Likely cause: Haiku emitted body text instead of sourceStart/sourceEnd offsets, or the prompt update didn't reach the model.`);
|
|
591
|
+
return {
|
|
592
|
+
kind: "error",
|
|
593
|
+
reason: "Haiku response had no parseable section offsets",
|
|
594
|
+
};
|
|
595
|
+
}
|
|
387
596
|
// Top-level orphan candidates and document-level edges are document-mode
|
|
388
597
|
// concepts. In chat mode the operator confirms participants up front and
|
|
389
598
|
// attaches them as :PARTICIPANT_IN edges off the :ConversationArchive
|
|
@@ -432,7 +641,7 @@ export async function classifyDocument(params) {
|
|
|
432
641
|
}
|
|
433
642
|
}
|
|
434
643
|
}
|
|
435
|
-
process.stderr.write(`[memory-classify] [${accountId}] haiku ok (mode=${mode}, sections=${sections.length}, orphanCandidates=${orphanCandidates.length}, hallucinatedRelated=${hallucinatedRelated}, elapsedMs=${haikuMs})\n`);
|
|
644
|
+
process.stderr.write(`[memory-classify] [${accountId}] haiku ok (mode=${mode}, sections=${sections.length}, orphanCandidates=${orphanCandidates.length}, hallucinatedRelated=${hallucinatedRelated}, droppedForOffsets=${droppedForOffsets}, summaryTruncated=${summaryTruncated}, elapsedMs=${haikuMs})\n`);
|
|
436
645
|
return {
|
|
437
646
|
kind: "ok",
|
|
438
647
|
output: {
|
|
@@ -445,4 +654,120 @@ export async function classifyDocument(params) {
|
|
|
445
654
|
},
|
|
446
655
|
};
|
|
447
656
|
}
|
|
657
|
+
// ---------------------------------------------------------------------------
|
|
658
|
+
// Chunked classification path (Task 896 clause 3).
|
|
659
|
+
//
|
|
660
|
+
// Used only for document mode when the input exceeds CHUNK_CHAR_SIZE. Each
|
|
661
|
+
// chunk is classified independently via the same single-shot path; the
|
|
662
|
+
// per-chunk results are stitched back together with offset translation and
|
|
663
|
+
// a same-kind merge to fix sections that straddled a chunk boundary.
|
|
664
|
+
//
|
|
665
|
+
// documentSummary is dropped in chunked mode (Haiku only sees one chunk at
|
|
666
|
+
// a time, so no per-chunk summary describes the whole document) — see
|
|
667
|
+
// 896-followup if a downstream consumer needs a synthesised whole-doc
|
|
668
|
+
// summary later.
|
|
669
|
+
// ---------------------------------------------------------------------------
|
|
670
|
+
async function classifyDocumentChunked(params) {
|
|
671
|
+
const { accountId, documentText } = params;
|
|
672
|
+
const chunks = chunkDocument(documentText, {
|
|
673
|
+
chunkSize: CHUNK_CHAR_SIZE,
|
|
674
|
+
overlap: CHUNK_OVERLAP_CHARS,
|
|
675
|
+
});
|
|
676
|
+
process.stderr.write(`[memory-classify] [${accountId}] chunked path: chunks=${chunks.length} chars=${documentText.length} chunkSize=${CHUNK_CHAR_SIZE} overlap=${CHUNK_OVERLAP_CHARS}\n`);
|
|
677
|
+
// Defence-in-depth: chunkSize < INPUT_CHAR_CEILING by construction, so
|
|
678
|
+
// no chunk should exceed the per-call ceiling. If one does, that's a
|
|
679
|
+
// chunker bug or constants-drift — loud-fail instead of pretending.
|
|
680
|
+
for (const c of chunks) {
|
|
681
|
+
if (c.chunkText.length > INPUT_CHAR_CEILING) {
|
|
682
|
+
logError(accountId, `input-too-large: chunker emitted oversize chunk (chars=${c.chunkText.length}, ceiling=${INPUT_CHAR_CEILING}). Chunker invariant violated.`);
|
|
683
|
+
return {
|
|
684
|
+
kind: "error",
|
|
685
|
+
reason: `Chunker produced an oversize chunk (${c.chunkText.length} > ${INPUT_CHAR_CEILING})`,
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
const allSections = [];
|
|
690
|
+
const allKeywords = new Set();
|
|
691
|
+
const allOrphans = [];
|
|
692
|
+
const allDocumentEdges = [];
|
|
693
|
+
let totalHallucinatedRelated = 0;
|
|
694
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
695
|
+
const c = chunks[i];
|
|
696
|
+
process.stderr.write(`[memory-classify] [${accountId}] classify-chunk ${i + 1}/${chunks.length} (chars=${c.chunkText.length}, baseOffset=${c.baseOffset})\n`);
|
|
697
|
+
// Recurse into the single-shot path — chunkSize < CHUNK_CHAR_SIZE is the
|
|
698
|
+
// dispatch threshold so the recursive call lands in the existing logic.
|
|
699
|
+
const chunkResult = await classifyDocument({ ...params, documentText: c.chunkText });
|
|
700
|
+
if (chunkResult.kind === "error") {
|
|
701
|
+
// One chunk failure aborts the whole ingest (loud-failure doctrine).
|
|
702
|
+
return chunkResult;
|
|
703
|
+
}
|
|
704
|
+
for (const s of chunkResult.output.sections) {
|
|
705
|
+
const wholeStart = s.sourceStart + c.baseOffset;
|
|
706
|
+
const wholeEnd = s.sourceEnd + c.baseOffset;
|
|
707
|
+
allSections.push({
|
|
708
|
+
...s,
|
|
709
|
+
sourceStart: wholeStart,
|
|
710
|
+
sourceEnd: wholeEnd,
|
|
711
|
+
body: documentText.slice(wholeStart, wholeEnd),
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
chunkResult.output.documentKeywords.forEach((k) => allKeywords.add(k));
|
|
715
|
+
allOrphans.push(...chunkResult.output.orphanCandidates);
|
|
716
|
+
if (chunkResult.output.documentEdges) {
|
|
717
|
+
allDocumentEdges.push(...chunkResult.output.documentEdges);
|
|
718
|
+
}
|
|
719
|
+
totalHallucinatedRelated += chunkResult.output.hallucinatedRelated;
|
|
720
|
+
}
|
|
721
|
+
// Same-kind boundary-straddler merge. Cross-kind overlap is preserved as
|
|
722
|
+
// distinct sections per eng review — disagreement about kind is operator-
|
|
723
|
+
// visible signal, not noise to collapse.
|
|
724
|
+
const mergedSections = mergeOverlappingSections(allSections);
|
|
725
|
+
// After the merge, any merged section whose range was unioned needs its
|
|
726
|
+
// body re-sliced from the whole document so it covers the union, not just
|
|
727
|
+
// one of the contributing chunks. Walk the result and re-slice — cheap.
|
|
728
|
+
for (const s of mergedSections) {
|
|
729
|
+
s.body = documentText.slice(s.sourceStart, s.sourceEnd);
|
|
730
|
+
}
|
|
731
|
+
// documentEdges dedupe — a Parties / PARTICIPANT / FROM-TO target named
|
|
732
|
+
// across multiple chunks would otherwise be appended N times and the
|
|
733
|
+
// writer would attempt N edge writes against the same MERGEd target.
|
|
734
|
+
// Stable key = (type, targetKind, JSON.stringify(targetProperties))
|
|
735
|
+
// since two chunks emitting "PARTY of Person {givenName, familyName}"
|
|
736
|
+
// for the same party will produce identical targetProperties shapes.
|
|
737
|
+
const dedupedDocumentEdges = [];
|
|
738
|
+
const seenEdgeKeys = new Set();
|
|
739
|
+
for (const edge of allDocumentEdges) {
|
|
740
|
+
const key = `${edge.type}|${edge.direction}|${edge.targetKind}|${JSON.stringify(edge.targetProperties)}`;
|
|
741
|
+
if (seenEdgeKeys.has(key))
|
|
742
|
+
continue;
|
|
743
|
+
seenEdgeKeys.add(key);
|
|
744
|
+
dedupedDocumentEdges.push(edge);
|
|
745
|
+
}
|
|
746
|
+
// Orphan candidates similarly may repeat across chunks (same hallucinated
|
|
747
|
+
// node mentioned in two adjacent windows). Dedupe on (kind, label).
|
|
748
|
+
const dedupedOrphans = [];
|
|
749
|
+
const seenOrphanKeys = new Set();
|
|
750
|
+
for (const o of allOrphans) {
|
|
751
|
+
const key = `${o.kind}|${o.label}`;
|
|
752
|
+
if (seenOrphanKeys.has(key))
|
|
753
|
+
continue;
|
|
754
|
+
seenOrphanKeys.add(key);
|
|
755
|
+
dedupedOrphans.push(o);
|
|
756
|
+
}
|
|
757
|
+
process.stderr.write(`[memory-classify] [${accountId}] chunked merge: rawSections=${allSections.length} mergedSections=${mergedSections.length} rawEdges=${allDocumentEdges.length} mergedEdges=${dedupedDocumentEdges.length} rawOrphans=${allOrphans.length} mergedOrphans=${dedupedOrphans.length} hallucinatedRelated=${totalHallucinatedRelated}\n`);
|
|
758
|
+
return {
|
|
759
|
+
kind: "ok",
|
|
760
|
+
output: {
|
|
761
|
+
// documentSummary is dropped in chunked mode — Haiku never saw the
|
|
762
|
+
// whole document. Downstream consumers that need a whole-doc summary
|
|
763
|
+
// should call a separate reduce step (out of scope for this change).
|
|
764
|
+
documentSummary: "",
|
|
765
|
+
documentKeywords: Array.from(allKeywords),
|
|
766
|
+
sections: mergedSections,
|
|
767
|
+
orphanCandidates: dedupedOrphans,
|
|
768
|
+
...(dedupedDocumentEdges.length > 0 ? { documentEdges: dedupedDocumentEdges } : {}),
|
|
769
|
+
hallucinatedRelated: totalHallucinatedRelated,
|
|
770
|
+
},
|
|
771
|
+
};
|
|
772
|
+
}
|
|
448
773
|
//# sourceMappingURL=llm-classifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-classifier.js","sourceRoot":"","sources":["../../src/lib/llm-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAgItE,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,UAAU;IACV,WAAW;IACX,YAAY;IACZ,OAAO;IACP,WAAW;CACH,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS;IACT,UAAU;IACV,cAAc;IACd,iBAAiB;IACjB,SAAS;IACT,YAAY;IACZ,UAAU;IACV,cAAc;IACd,UAAU;IACV,iBAAiB;IACjB,+EAA+E;IAC/E,wEAAwE;IACxE,6EAA6E;IAC7E,8DAA8D;IAC9D,cAAc;CACN,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS;IACT,UAAU;IACV,aAAa;IACb,OAAO;IACP,MAAM;IACN,SAAS;IACT,iBAAiB;IACjB,sBAAsB;IACtB,YAAY;IACZ,iBAAiB;IACjB,WAAW;IACX,aAAa;IACb,cAAc;IACd,cAAc;IACd,SAAS;IACT,iBAAiB;IACjB,WAAW;IACX,Y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AAC,MAAM,mBAAmB,cAAc,CAAC,MAAM,aAAa,gBAAgB,CAAC,MAAM,gBAAgB,oBAAoB,CAAC,MAAM,eAAe,UAAU,CAAC,MAAM,kBAAkB,cAAc,CAAC,MAAM,wBAAwB,wBAAwB,IAAI,CACpU,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE;YACN,mEAAmE;YACnE,qEAAqE;YACrE,qEAAqE;YACrE,eAAe,EAAE,EAAE;YACnB,gBAAgB,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC;YACzC,QAAQ,EAAE,cAAc;YACxB,gBAAgB,EAAE,cAAc;YAChC,GAAG,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnF,mBAAmB,EAAE,wBAAwB;SAC9C;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -37,7 +37,7 @@ export type RankResult = {
|
|
|
37
37
|
rankings: Ranking[];
|
|
38
38
|
hallucinated: number;
|
|
39
39
|
} | {
|
|
40
|
-
kind: "
|
|
40
|
+
kind: "error";
|
|
41
41
|
reason: string;
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
@@ -46,9 +46,10 @@ export type RankResult = {
|
|
|
46
46
|
* Returns:
|
|
47
47
|
* { kind: "ranked", rankings, hallucinated } on success (hallucinated counts
|
|
48
48
|
* nodeIds Haiku invented that were filtered out)
|
|
49
|
-
* { kind: "
|
|
49
|
+
* { kind: "error", reason } when the LLM is unavailable or its output
|
|
50
50
|
* cannot be used — callers should return the unranked memory-search
|
|
51
51
|
* results prefixed with "[Ranking unavailable: <reason>]".
|
|
52
|
+
* (Task 897 vocabulary — was `kind: "fallback"`.)
|
|
52
53
|
*/
|
|
53
54
|
export declare function rankCandidates(candidates: RankCandidate[], criteria: string, accountId: string): Promise<RankResult>;
|
|
54
55
|
//# sourceMappingURL=llm-ranker.d.ts.map
|