@atrib/summarize 0.2.4 → 0.3.0
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.d.ts +2 -14
- package/dist/index.js +14 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -18,23 +18,11 @@ import { z } from 'zod';
|
|
|
18
18
|
import { type IndexedRecord } from './storage.js';
|
|
19
19
|
declare const SummarizeInput: z.ZodObject<{
|
|
20
20
|
context_id: z.ZodOptional<z.ZodString>;
|
|
21
|
-
record_hashes: z.ZodOptional<z.ZodArray<z.ZodString
|
|
21
|
+
record_hashes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
22
|
focus: z.ZodOptional<z.ZodString>;
|
|
23
23
|
max_records: z.ZodOptional<z.ZodNumber>;
|
|
24
24
|
model: z.ZodOptional<z.ZodString>;
|
|
25
|
-
},
|
|
26
|
-
context_id?: string | undefined;
|
|
27
|
-
model?: string | undefined;
|
|
28
|
-
record_hashes?: string[] | undefined;
|
|
29
|
-
focus?: string | undefined;
|
|
30
|
-
max_records?: number | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
context_id?: string | undefined;
|
|
33
|
-
model?: string | undefined;
|
|
34
|
-
record_hashes?: string[] | undefined;
|
|
35
|
-
focus?: string | undefined;
|
|
36
|
-
max_records?: number | undefined;
|
|
37
|
-
}>;
|
|
25
|
+
}, z.core.$strip>;
|
|
38
26
|
interface SummarizeOutput {
|
|
39
27
|
narrative: string | null;
|
|
40
28
|
cited_record_hashes: string[];
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,19 @@ export async function createAtribSummarizeServer() {
|
|
|
59
59
|
async function handleSummarize(input) {
|
|
60
60
|
const warnings = [];
|
|
61
61
|
const maxRecords = input.max_records ?? 50;
|
|
62
|
-
|
|
62
|
+
// ATRIB_CONTEXT_ID env-var default: when the caller omitted context_id
|
|
63
|
+
// AND did not supply record_hashes, fall back to the env var if it
|
|
64
|
+
// carries a valid 32-hex value. Lets Inspect-style harnesses scope
|
|
65
|
+
// summarize to a per-arm context_id via the MCP env block (per D072's
|
|
66
|
+
// per-arm isolation contract). Explicit input.context_id always wins.
|
|
67
|
+
const envContextId = process.env['ATRIB_CONTEXT_ID'];
|
|
68
|
+
const effectiveContextId = input.context_id ??
|
|
69
|
+
(envContextId && HEX_32_PATTERN.test(envContextId) ? envContextId : undefined);
|
|
70
|
+
const effective = {
|
|
71
|
+
...input,
|
|
72
|
+
...(effectiveContextId ? { context_id: effectiveContextId } : {}),
|
|
73
|
+
};
|
|
74
|
+
if (!effective.context_id && !effective.record_hashes) {
|
|
63
75
|
warnings.push('one of context_id or record_hashes is required');
|
|
64
76
|
return emptyOutput(warnings);
|
|
65
77
|
}
|
|
@@ -70,7 +82,7 @@ async function handleSummarize(input) {
|
|
|
70
82
|
}
|
|
71
83
|
// Load local mirror once; filter to the requested set.
|
|
72
84
|
const { byHash, newestFirst } = loadAllRecords();
|
|
73
|
-
const selected = selectRecords(
|
|
85
|
+
const selected = selectRecords(effective, byHash, newestFirst);
|
|
74
86
|
if (selected.length === 0) {
|
|
75
87
|
warnings.push('no records matched the request');
|
|
76
88
|
return { ...emptyOutput(warnings), model_used: llmCfg.model };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atrib/summarize",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "MCP server for atrib. Synthesizes a narrative across N records via an OpenAI-compatible LLM so agents read context, not raw record bytes.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
13
13
|
"zod": "^3.25.76",
|
|
14
|
-
"@atrib/mcp": "0.6.
|
|
14
|
+
"@atrib/mcp": "0.6.2"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/node": "^22.19.17",
|