@atrib/trace 0.5.3 → 0.5.5
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 +5 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +18 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +2 -2
- package/package.json +16 -2
package/README.md
CHANGED
|
@@ -30,7 +30,10 @@ mcp__atrib-trace__trace_forward({ // FORWARD — what was informed by this?
|
|
|
30
30
|
event_type, context_id, creator_key, timestamp,
|
|
31
31
|
next_informed_by, next_resolved, next_dangling,
|
|
32
32
|
informed_by?, tool_name?, args_hash?, result_hash?,
|
|
33
|
-
sidecar_summary?: {
|
|
33
|
+
sidecar_summary?: {
|
|
34
|
+
tool_name?, topics?, what?, importance?, producer?,
|
|
35
|
+
span_kind?, span_name?, model_name?, prompt_version?
|
|
36
|
+
},
|
|
34
37
|
local_content?, local_producer? // only when include_content=true
|
|
35
38
|
}
|
|
36
39
|
],
|
|
@@ -51,7 +54,7 @@ Every `*.jsonl` mirror under `~/.atrib/records/` (override via `ATRIB_RECORDS_DI
|
|
|
51
54
|
- Bare `AtribRecord` per line (legacy / wrapper convention pre-sidecar)
|
|
52
55
|
- `{ record, _local?, written_at }` envelope (current shape)
|
|
53
56
|
|
|
54
|
-
When the envelope carries an optional `_local` sidecar (per the local-mirror sidecar pattern shipped in `@atrib/mcp` v0.2.x), trace surfaces a compact `sidecar_summary` per record: `tool_name`, `topics`, first ~200 chars of `what`/`summary`,
|
|
57
|
+
When the envelope carries an optional `_local` sidecar (per the local-mirror sidecar pattern shipped in `@atrib/mcp` v0.2.x), trace surfaces a compact `sidecar_summary` per record: `tool_name`, `topics`, first ~200 chars of `what`/`summary`, `importance` for annotations, and OpenInference fields such as `span_kind`, `span_name`, `model_name`, and `prompt_version` when present. Trace reads `_local.content` first, then derives the same content shape from legacy wrapper or OpenInference sidecar fields when needed. When `include_content=true`, trace also returns the full [D062](../../DECISIONS.md#d062-local-mirror-sidecar--two-tier-private-local--public-canonical-persistence) local mirror body as `local_content` plus `local_producer`; this is intended for harness-mediated causal replay where the agent needs rich expected/actual outcome context. Without the sidecar (legacy entries), the per-record output still includes the cryptographic evidence (event_type, hashes, creator_key, timestamp), just without semantic context.
|
|
55
58
|
|
|
56
59
|
## Behaviors
|
|
57
60
|
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,10 @@ interface CompactVisited {
|
|
|
37
37
|
*/
|
|
38
38
|
sidecar_summary?: {
|
|
39
39
|
tool_name?: string;
|
|
40
|
+
span_kind?: string;
|
|
41
|
+
span_name?: string;
|
|
42
|
+
model_name?: string;
|
|
43
|
+
prompt_version?: string;
|
|
40
44
|
topics?: string[];
|
|
41
45
|
/**
|
|
42
46
|
* First 200 chars of the record's human-readable content, derived
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,17 @@ export function summarizeSidecar(loadedRecord) {
|
|
|
54
54
|
if (sc.producer)
|
|
55
55
|
out.producer = sc.producer;
|
|
56
56
|
const c = sc.content;
|
|
57
|
+
if (!out.tool_name && c && typeof c['tool_name'] === 'string') {
|
|
58
|
+
out.tool_name = c['tool_name'];
|
|
59
|
+
}
|
|
60
|
+
if (c && typeof c['span_kind'] === 'string')
|
|
61
|
+
out.span_kind = c['span_kind'];
|
|
62
|
+
if (c && typeof c['span_name'] === 'string')
|
|
63
|
+
out.span_name = c['span_name'];
|
|
64
|
+
if (c && typeof c['model_name'] === 'string')
|
|
65
|
+
out.model_name = c['model_name'];
|
|
66
|
+
if (c && typeof c['prompt_version'] === 'string')
|
|
67
|
+
out.prompt_version = c['prompt_version'];
|
|
57
68
|
if (c && Array.isArray(c['topics'])) {
|
|
58
69
|
out.topics = c['topics'].filter((t) => typeof t === 'string').slice(0, 6);
|
|
59
70
|
}
|
|
@@ -63,7 +74,7 @@ export function summarizeSidecar(loadedRecord) {
|
|
|
63
74
|
// an explicit final fallback to `summary` for legacy records.
|
|
64
75
|
// observation: content.what
|
|
65
76
|
// annotation: content.summary
|
|
66
|
-
// revision: content.new_position (D086-normative)
|
|
77
|
+
// revision: content.new_position (D086-normative). Surface this
|
|
67
78
|
// so trace consumers can read the agent's stance shift
|
|
68
79
|
// without a separate recall call
|
|
69
80
|
// legacy: content.summary (catches pre-D086 extractor records)
|
|
@@ -78,6 +89,12 @@ export function summarizeSidecar(loadedRecord) {
|
|
|
78
89
|
else if (typeof c['summary'] === 'string') {
|
|
79
90
|
primary = c['summary'];
|
|
80
91
|
}
|
|
92
|
+
else if (typeof c['prompt'] === 'string') {
|
|
93
|
+
primary = c['prompt'];
|
|
94
|
+
}
|
|
95
|
+
else if (typeof c['output'] === 'string') {
|
|
96
|
+
primary = c['output'];
|
|
97
|
+
}
|
|
81
98
|
if (primary) {
|
|
82
99
|
out.what = primary.length > 200 ? primary.slice(0, 197) + '…' : primary;
|
|
83
100
|
}
|
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?:
|
|
22
|
+
content?: unknown;
|
|
23
23
|
producer?: string;
|
|
24
24
|
}
|
|
25
25
|
/**
|
package/dist/storage.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
14
14
|
import { homedir } from 'node:os';
|
|
15
15
|
import { basename, join } from 'node:path';
|
|
16
|
-
import { canonicalRecord, hexEncode, sha256 } from '@atrib/mcp';
|
|
16
|
+
import { canonicalRecord, hexEncode, sha256, withDerivedLocalContent, } from '@atrib/mcp';
|
|
17
17
|
const RECORDS_FILE = process.env.ATRIB_RECORD_FILE;
|
|
18
18
|
const RECORDS_DIR = process.env.ATRIB_RECORDS_DIR ?? join(homedir(), '.atrib', 'records');
|
|
19
19
|
/**
|
|
@@ -73,7 +73,7 @@ export function loadAllRecords(dir = RECORDS_DIR) {
|
|
|
73
73
|
if (isEnvelope) {
|
|
74
74
|
const sidecar = parsed._local;
|
|
75
75
|
if (sidecar)
|
|
76
|
-
indexed.local = sidecar;
|
|
76
|
+
indexed.local = withDerivedLocalContent(rec.event_type, sidecar);
|
|
77
77
|
}
|
|
78
78
|
byHash.set(indexed.record_hash, indexed);
|
|
79
79
|
all.push(indexed);
|
package/package.json
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atrib/trace",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "MCP server for atrib. Walks informed_by chains backward from a record_hash to surface the reasoning chain that produced it.",
|
|
5
|
+
"author": "atrib <hello@atrib.dev>",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"atrib",
|
|
8
|
+
"mcp",
|
|
9
|
+
"model-context-protocol",
|
|
10
|
+
"attribution",
|
|
11
|
+
"verifiable",
|
|
12
|
+
"agent",
|
|
13
|
+
"cognitive-primitive",
|
|
14
|
+
"trace",
|
|
15
|
+
"provenance",
|
|
16
|
+
"causal-chain"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://atrib.dev",
|
|
5
19
|
"license": "Apache-2.0",
|
|
6
20
|
"type": "module",
|
|
7
21
|
"main": "./dist/index.js",
|
|
@@ -11,7 +25,7 @@
|
|
|
11
25
|
"dependencies": {
|
|
12
26
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
13
27
|
"zod": "^3.25.76",
|
|
14
|
-
"@atrib/mcp": "0.
|
|
28
|
+
"@atrib/mcp": "0.15.0"
|
|
15
29
|
},
|
|
16
30
|
"devDependencies": {
|
|
17
31
|
"@types/node": "^25.9.1",
|