@atrib/summarize 0.4.4 → 0.4.6

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/README.md CHANGED
@@ -53,7 +53,9 @@ Without an API key, the tool returns a warnings-only response per the [§5.8](ht
53
53
 
54
54
  Same as `@atrib/trace`: every `*.jsonl` mirror under `~/.atrib/records/` (override via `ATRIB_RECORDS_DIR`). Tolerates both legacy bare-record and current envelope shapes.
55
55
 
56
- When a record lacks a `_local` sidecar (legacy entry), the prompt includes a marker telling the LLM the input is impoverished, only event_type + cryptographic metadata is available, so the synthesis can be honest about gaps. The output reports `records_with_sidecar` and `records_without_sidecar` counts so callers know how rich the input was.
56
+ Summarize reads `_local.content` first, then derives the same content shape from legacy wrapper or OpenInference sidecar fields when needed. OpenInference content can add span kind/name, tool/agent/model, prompt identifiers and templates, input/output, usage, cost, score, metadata, and topics to the synthesis prompt. Those fields stay local sidecar payload per [D108](../../DECISIONS.md#d108-observability-span-trees-are-intake-local-sidecars-are-cognitive-payload); they are not promoted to signed protocol fields.
57
+
58
+ When a record lacks usable local content (legacy entry), the prompt includes a marker telling the LLM the input is impoverished, only event_type + cryptographic metadata is available, so the synthesis can be honest about gaps. The output reports `records_with_sidecar` and `records_without_sidecar` counts so callers know how rich the input was.
57
59
 
58
60
  ## Behaviors
59
61
 
package/dist/prompt.js CHANGED
@@ -64,8 +64,18 @@ function renderRecord(r) {
64
64
  out.push(`tool: ${sc.toolName}`);
65
65
  const c = sc.content;
66
66
  if (c) {
67
+ if (typeof c['source'] === 'string')
68
+ out.push(`source: ${c['source']}`);
69
+ if (typeof c['span_kind'] === 'string')
70
+ out.push(`span_kind: ${c['span_kind']}`);
71
+ if (typeof c['span_name'] === 'string')
72
+ out.push(`span_name: ${c['span_name']}`);
67
73
  if (typeof c['tool_name'] === 'string')
68
74
  out.push(`tool: ${c['tool_name']}`);
75
+ if (typeof c['agent_name'] === 'string')
76
+ out.push(`agent: ${c['agent_name']}`);
77
+ if (typeof c['model_name'] === 'string')
78
+ out.push(`model: ${c['model_name']}`);
69
79
  if (typeof c['what'] === 'string')
70
80
  out.push(`what: ${c['what']}`);
71
81
  if (typeof c['why_noted'] === 'string')
@@ -80,10 +90,30 @@ function renderRecord(r) {
80
90
  out.push(`new_position: ${c['new_position']}`);
81
91
  if (typeof c['reason'] === 'string')
82
92
  out.push(`reason: ${c['reason']}`);
93
+ if (typeof c['prompt'] === 'string')
94
+ out.push(`prompt: ${c['prompt'].slice(0, 1200)}`);
95
+ if (typeof c['prompt_messages'] === 'string')
96
+ out.push(`prompt_messages: ${c['prompt_messages'].slice(0, 1200)}`);
97
+ if (typeof c['prompt_template'] === 'string')
98
+ out.push(`prompt_template: ${c['prompt_template'].slice(0, 1200)}`);
99
+ if (typeof c['prompt_version'] === 'string')
100
+ out.push(`prompt_version: ${c['prompt_version']}`);
101
+ if (typeof c['input'] === 'string')
102
+ out.push(`input (truncated): ${c['input'].slice(0, 1200)}`);
103
+ if (typeof c['output'] === 'string')
104
+ out.push(`output (truncated): ${c['output'].slice(0, 1200)}`);
83
105
  if (c['args'])
84
106
  out.push(`args (truncated): ${JSON.stringify(c['args']).slice(0, 1200)}`);
85
107
  if (c['result'])
86
108
  out.push(`result (truncated): ${JSON.stringify(c['result']).slice(0, 1200)}`);
109
+ if (c['usage_details'])
110
+ out.push(`usage_details: ${JSON.stringify(c['usage_details']).slice(0, 600)}`);
111
+ if (c['cost_details'])
112
+ out.push(`cost_details: ${JSON.stringify(c['cost_details']).slice(0, 600)}`);
113
+ if (c['score_details'])
114
+ out.push(`score_details: ${JSON.stringify(c['score_details']).slice(0, 600)}`);
115
+ if (c['metadata'])
116
+ out.push(`metadata: ${JSON.stringify(c['metadata']).slice(0, 600)}`);
87
117
  if (Array.isArray(c['topics'])) {
88
118
  out.push(`topics: ${c['topics'].filter((x) => typeof x === 'string').join(', ')}`);
89
119
  }
package/dist/storage.d.ts CHANGED
@@ -19,7 +19,7 @@ export interface IndexedRecord {
19
19
  * (mcp-wrap writes toolName/args/result; atrib-emit writes content).
20
20
  */
21
21
  export interface SidecarPayload extends OnRecordSidecar {
22
- content?: Record<string, unknown>;
22
+ content?: unknown;
23
23
  producer?: string;
24
24
  }
25
25
  /**
package/dist/storage.js CHANGED
@@ -12,7 +12,7 @@
12
12
  import { existsSync, readFileSync, readdirSync } from 'node:fs';
13
13
  import { homedir } from 'node:os';
14
14
  import { join } from 'node:path';
15
- import { canonicalRecord, hexEncode, sha256 } from '@atrib/mcp';
15
+ import { canonicalRecord, hexEncode, sha256, withDerivedLocalContent, } from '@atrib/mcp';
16
16
  const RECORDS_DIR = process.env.ATRIB_RECORDS_DIR ?? join(homedir(), '.atrib', 'records');
17
17
  /**
18
18
  * Read every *.jsonl mirror in ATRIB_RECORDS_DIR and return an index keyed
@@ -65,7 +65,7 @@ export function loadAllRecords(dir = RECORDS_DIR) {
65
65
  if (isEnvelope) {
66
66
  const sidecar = parsed._local;
67
67
  if (sidecar)
68
- indexed.local = sidecar;
68
+ indexed.local = withDerivedLocalContent(rec.event_type, sidecar);
69
69
  }
70
70
  byHash.set(indexed.record_hash, indexed);
71
71
  all.push(indexed);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atrib/summarize",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
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.13.0"
14
+ "@atrib/mcp": "0.15.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@types/node": "^25.9.1",