@rubytech/create-maxy-code 0.1.151 → 0.1.152
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/lib/graph-search/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/graph-search/dist/index.js +10 -9
- package/payload/platform/lib/graph-search/dist/index.js.map +1 -1
- package/payload/platform/lib/graph-search/src/index.ts +10 -9
- package/payload/platform/package.json +2 -2
- package/payload/platform/plugins/admin/PLUGIN.md +1 -1
- package/payload/platform/plugins/admin/hooks/__tests__/pre-turn-graph-pass.test.sh +26 -129
- package/payload/platform/plugins/admin/hooks/pre-turn-graph-pass.sh +64 -131
- package/payload/platform/plugins/docs/PLUGIN.md +1 -1
- package/payload/platform/plugins/docs/references/admin-session.md +2 -2
- package/payload/platform/plugins/docs/references/internals.md +1 -64
- package/payload/platform/plugins/docs/references/platform.md +1 -1
- package/payload/platform/plugins/docs/references/plugins-guide.md +2 -2
- package/payload/platform/plugins/email/mcp/dist/lib/graph.d.ts +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/graph.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js +25 -45
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js.map +1 -1
- package/payload/platform/plugins/memory/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/memory/PLUGIN.md +8 -16
- package/payload/platform/plugins/memory/bin/conversation-archive-ingest.mjs +14 -11
- package/payload/platform/plugins/memory/mcp/dist/index.js +13 -269
- package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/dream-cycle/phase-citation-audit.d.ts +1 -24
- package/payload/platform/plugins/memory/mcp/dist/lib/dream-cycle/phase-citation-audit.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/dream-cycle/phase-citation-audit.js +8 -211
- package/payload/platform/plugins/memory/mcp/dist/lib/dream-cycle/phase-citation-audit.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/section-types.d.ts +99 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/section-types.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/section-types.js +56 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/section-types.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.d.ts +12 -32
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.js +19 -281
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js +0 -3
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js +15 -14
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.d.ts +1 -1
- 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 +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.d.ts +1 -76
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js +73 -329
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js +10 -12
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/vitest.config.ts +4 -3
- package/payload/platform/plugins/memory/references/graph-primitives.md +2 -2
- package/payload/platform/plugins/memory/references/schema-base.md +2 -7
- package/payload/platform/plugins/memory/skills/document-ingest/SKILL.md +71 -46
- package/payload/platform/plugins/scheduling/skills/briefing/SKILL.md +2 -2
- package/payload/platform/scripts/seed-neo4j.sh +0 -49
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +3 -2
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +1 -1
- package/payload/platform/templates/specialists/agents/citation-auditor.md +37 -0
- package/payload/platform/templates/specialists/agents/compiled-truth-rewriter.md +42 -0
- package/payload/platform/templates/specialists/agents/database-operator.md +2 -30
- package/payload/platform/templates/specialists/agents/research-assistant.md +2 -2
- package/payload/platform/templates/specialists/agents/typed-edge-classifier.md +37 -0
- package/payload/server/{adminuser-self-heal-YC47O34W.js → adminuser-self-heal-WSFCOEII.js} +1 -1
- package/payload/server/{chunk-T3DJD5QR.js → chunk-AXOL2PPG.js} +1 -1
- package/payload/server/{chunk-HYQNUVGO.js → chunk-PFF6I7KP.js} +1 -8
- package/payload/server/maxy-edge.js +2 -2
- package/payload/server/public/assets/{admin-CnLGltuE.js → admin-kh_oCHeS.js} +54 -54
- package/payload/server/public/assets/{data-MB2EWZUP.js → data-BHASh0_Y.js} +1 -1
- package/payload/server/public/assets/{graph-B2FnDRz-.js → graph-BhEI09tF.js} +1 -1
- package/payload/server/public/assets/graph-labels-DXlmm1og.js +1 -0
- package/payload/server/public/assets/{page-BJKRa6Db.js → page-CDWu1Aft.js} +3 -3
- package/payload/server/public/assets/{page-Bx2p3W1k.js → page-cyvshX4Z.js} +1 -1
- package/payload/server/public/data.html +3 -3
- package/payload/server/public/graph.html +3 -3
- package/payload/server/public/index.html +4 -4
- package/payload/server/server.js +319 -1286
- package/payload/platform/lib/graph-search/src/__tests__/query-expansion.test.ts +0 -96
- package/payload/platform/lib/graph-search/src/query-expansion.ts +0 -129
- package/payload/platform/lib/oauth-llm/src/index.ts +0 -583
- package/payload/platform/lib/oauth-llm/tsconfig.json +0 -8
- package/payload/platform/lib/screening-patterns/src/index.ts +0 -51
- package/payload/platform/lib/screening-patterns/tsconfig.json +0 -8
- package/payload/server/public/assets/graph-labels-DDYqDlu3.js +0 -1
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
|
|
3
|
-
const callMock = vi.fn();
|
|
4
|
-
|
|
5
|
-
vi.mock("../../../oauth-llm/dist/index.js", () => ({
|
|
6
|
-
callOauthLlm: (...args: unknown[]) => callMock(...args),
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
|
-
import { clearExpansionCache, expandQuery } from "../query-expansion.js";
|
|
10
|
-
|
|
11
|
-
describe("expandQuery", () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
callMock.mockReset();
|
|
14
|
-
clearExpansionCache();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
afterEach(() => {
|
|
18
|
-
callMock.mockReset();
|
|
19
|
-
clearExpansionCache();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("returns [original, ...paraphrases] on Haiku success", async () => {
|
|
23
|
-
callMock.mockResolvedValueOnce({
|
|
24
|
-
kind: "ok-tool",
|
|
25
|
-
toolName: "emit_paraphrases",
|
|
26
|
-
input: {
|
|
27
|
-
paraphrases: ["who is adam langley", "adam langley bio", "adam langley founder"],
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
const out = await expandQuery({ query: "Adam Langley", accountId: "acc-1" });
|
|
31
|
-
expect(out[0]).toBe("Adam Langley");
|
|
32
|
-
expect(out.slice(1)).toEqual([
|
|
33
|
-
"who is adam langley",
|
|
34
|
-
"adam langley bio",
|
|
35
|
-
"adam langley founder",
|
|
36
|
-
]);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("serves the second identical call from cache (no second LLM call)", async () => {
|
|
40
|
-
callMock.mockResolvedValueOnce({
|
|
41
|
-
kind: "ok-tool",
|
|
42
|
-
toolName: "emit_paraphrases",
|
|
43
|
-
input: { paraphrases: ["p1", "p2", "p3"] },
|
|
44
|
-
});
|
|
45
|
-
const first = await expandQuery({ query: "X", accountId: "a" });
|
|
46
|
-
const second = await expandQuery({ query: "X", accountId: "a" });
|
|
47
|
-
expect(first).toEqual(second);
|
|
48
|
-
expect(callMock).toHaveBeenCalledTimes(1);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("caches per retrievalClass — different class re-invokes Haiku", async () => {
|
|
52
|
-
callMock.mockResolvedValueOnce({
|
|
53
|
-
kind: "ok-tool",
|
|
54
|
-
toolName: "emit_paraphrases",
|
|
55
|
-
input: { paraphrases: ["p1", "p2", "p3"] },
|
|
56
|
-
});
|
|
57
|
-
callMock.mockResolvedValueOnce({
|
|
58
|
-
kind: "ok-tool",
|
|
59
|
-
toolName: "emit_paraphrases",
|
|
60
|
-
input: { paraphrases: ["q1", "q2", "q3"] },
|
|
61
|
-
});
|
|
62
|
-
const entityCall = await expandQuery({
|
|
63
|
-
query: "X",
|
|
64
|
-
accountId: "a",
|
|
65
|
-
retrievalClass: "entity",
|
|
66
|
-
});
|
|
67
|
-
const temporalCall = await expandQuery({
|
|
68
|
-
query: "X",
|
|
69
|
-
accountId: "a",
|
|
70
|
-
retrievalClass: "temporal",
|
|
71
|
-
});
|
|
72
|
-
expect(entityCall.slice(1)).toEqual(["p1", "p2", "p3"]);
|
|
73
|
-
expect(temporalCall.slice(1)).toEqual(["q1", "q2", "q3"]);
|
|
74
|
-
expect(callMock).toHaveBeenCalledTimes(2);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("falls back to [query] on LLM fallback result", async () => {
|
|
78
|
-
callMock.mockResolvedValueOnce({
|
|
79
|
-
kind: "fallback",
|
|
80
|
-
cause: "missing-creds",
|
|
81
|
-
reason: "no oauth",
|
|
82
|
-
});
|
|
83
|
-
const out = await expandQuery({ query: "X", accountId: "a", useCache: false });
|
|
84
|
-
expect(out).toEqual(["X"]);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it("falls back to [query] when the tool input is malformed", async () => {
|
|
88
|
-
callMock.mockResolvedValueOnce({
|
|
89
|
-
kind: "ok-tool",
|
|
90
|
-
toolName: "emit_paraphrases",
|
|
91
|
-
input: { paraphrases: "not an array" },
|
|
92
|
-
});
|
|
93
|
-
const out = await expandQuery({ query: "X", accountId: "a", useCache: false });
|
|
94
|
-
expect(out).toEqual(["X"]);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Multi-query expansion via Haiku (Task 308).
|
|
3
|
-
*
|
|
4
|
-
* Generates 3-5 paraphrases of the user query so the hybrid pipeline runs
|
|
5
|
-
* each paraphrase against vector + BM25 in parallel and unions the
|
|
6
|
-
* candidate sets before fusion. Recovers recall on terse queries where the
|
|
7
|
-
* embedding's nearest-neighbour is unstable.
|
|
8
|
-
*
|
|
9
|
-
* The expansion runs through `@rubytech/oauth-llm` against Claude Haiku —
|
|
10
|
-
* the same OAuth-bearer path the admin classifiers use; no new SDK
|
|
11
|
-
* dependency and no Anthropic-API-key path. Cache is in-process, keyed by
|
|
12
|
-
* (accountId, normalisedQuery, retrievalClass), with a 1-hour TTL.
|
|
13
|
-
*
|
|
14
|
-
* Graceful degrade: if the LLM call fails, returns just the original
|
|
15
|
-
* query. The caller's hybrid pipeline still runs — just on one query
|
|
16
|
-
* instead of N — so missing paraphrases are a recall regression, not a
|
|
17
|
-
* fault.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { callOauthLlm } from "../../oauth-llm/dist/index.js";
|
|
21
|
-
|
|
22
|
-
const CACHE_TTL_MS = 60 * 60 * 1000;
|
|
23
|
-
const HAIKU_MODEL = "claude-haiku-4-5";
|
|
24
|
-
const MAX_PARAPHRASES = 5;
|
|
25
|
-
|
|
26
|
-
interface CacheEntry {
|
|
27
|
-
expansions: string[];
|
|
28
|
-
expiresAt: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const cache = new Map<string, CacheEntry>();
|
|
32
|
-
|
|
33
|
-
export function clearExpansionCache(): void {
|
|
34
|
-
cache.clear();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface ExpandQueryParams {
|
|
38
|
-
query: string;
|
|
39
|
-
retrievalClass?: string;
|
|
40
|
-
accountId?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Override the cache or skip it entirely (useful in tests). When
|
|
43
|
-
* `false`, the cache is read but never written; when `true` (default),
|
|
44
|
-
* both reads and writes are active.
|
|
45
|
-
*/
|
|
46
|
-
useCache?: boolean;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Return `[query, ...paraphrases]` (original always first). On LLM
|
|
51
|
-
* failure returns `[query]` only and writes a single stderr line so the
|
|
52
|
-
* operator can see expansion is degrading without breaking search.
|
|
53
|
-
*/
|
|
54
|
-
export async function expandQuery(
|
|
55
|
-
params: ExpandQueryParams,
|
|
56
|
-
): Promise<string[]> {
|
|
57
|
-
const { query, retrievalClass = "general", accountId = "", useCache = true } = params;
|
|
58
|
-
const normalised = query.trim().toLowerCase();
|
|
59
|
-
const cacheKey = `${accountId}::${retrievalClass}::${normalised}`;
|
|
60
|
-
|
|
61
|
-
if (useCache) {
|
|
62
|
-
const hit = cache.get(cacheKey);
|
|
63
|
-
if (hit && hit.expiresAt > Date.now()) {
|
|
64
|
-
return [query, ...hit.expansions];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const systemPrompt = [
|
|
69
|
-
"You generate paraphrases of a user query for hybrid graph search.",
|
|
70
|
-
"Return 3-5 alternative phrasings that preserve the user's intent but vary the surface form (synonyms, word order, entity-vs-attribute framing).",
|
|
71
|
-
"Do not change the entity names. Do not invent constraints the user did not state.",
|
|
72
|
-
"Output ONLY a JSON object via the provided tool; never free text.",
|
|
73
|
-
].join("\n");
|
|
74
|
-
|
|
75
|
-
const classHint = retrievalClass === "general"
|
|
76
|
-
? ""
|
|
77
|
-
: `The retrieval class is '${retrievalClass}' — tailor paraphrases accordingly.`;
|
|
78
|
-
const userMessage = [
|
|
79
|
-
`Original query: ${query}`,
|
|
80
|
-
classHint,
|
|
81
|
-
].filter((s) => s.length > 0).join("\n");
|
|
82
|
-
|
|
83
|
-
const result = await callOauthLlm({
|
|
84
|
-
model: HAIKU_MODEL,
|
|
85
|
-
system: systemPrompt,
|
|
86
|
-
userMessage,
|
|
87
|
-
maxTokens: 512,
|
|
88
|
-
timeoutMs: 15_000,
|
|
89
|
-
tools: [
|
|
90
|
-
{
|
|
91
|
-
name: "emit_paraphrases",
|
|
92
|
-
description: "Emit 3-5 paraphrases of the user query.",
|
|
93
|
-
input_schema: {
|
|
94
|
-
type: "object",
|
|
95
|
-
properties: {
|
|
96
|
-
paraphrases: {
|
|
97
|
-
type: "array",
|
|
98
|
-
items: { type: "string" },
|
|
99
|
-
minItems: 3,
|
|
100
|
-
maxItems: MAX_PARAPHRASES,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
required: ["paraphrases"],
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
],
|
|
107
|
-
toolChoiceName: "emit_paraphrases",
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
if (result.kind !== "ok-tool") {
|
|
111
|
-
process.stderr.write(
|
|
112
|
-
`[graph-search:expansion-failed] cause=${result.kind === "fallback" ? result.cause : "unexpected"} query=${query.slice(0, 60).replace(/\s+/g, " ")}\n`,
|
|
113
|
-
);
|
|
114
|
-
return [query];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const raw = (result.input as { paraphrases?: unknown }).paraphrases;
|
|
118
|
-
if (!Array.isArray(raw)) return [query];
|
|
119
|
-
const expansions = raw
|
|
120
|
-
.filter((p): p is string => typeof p === "string" && p.trim().length > 0)
|
|
121
|
-
.map((p) => p.trim())
|
|
122
|
-
.slice(0, MAX_PARAPHRASES);
|
|
123
|
-
|
|
124
|
-
if (useCache) {
|
|
125
|
-
cache.set(cacheKey, { expansions, expiresAt: Date.now() + CACHE_TTL_MS });
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return [query, ...expansions];
|
|
129
|
-
}
|