pluribus-context 0.3.33 → 0.3.34
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/CHANGELOG.md +4 -0
- package/README.md +5 -5
- package/docs/community-review-packet.md +11 -11
- package/docs/context-budget-receipts.md +22 -0
- package/docs/context-input-evidence.md +15 -0
- package/examples/agent-skills/context-receipts/SKILL.md +21 -0
- package/examples/context-input-evidence/code-search-retrieval-otel-trace.json +879 -0
- package/examples/context-input-evidence/code-search-retrieval-receipt.ndjson +8 -0
- package/examples/context-input-evidence/convert-code-search-retrieval-log.mjs +280 -0
- package/examples/context-input-evidence/sample-code-search-retrieval-log.jsonl +5 -0
- package/package.json +1 -1
- package/src/utils/version.js +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{"trace_id":"02c8df97e575ea76a89acf4fe9194925","span_id":"9568b542931d5d73","name":"code.index.snapshot.used","time":"2026-05-26T14:00:01.000Z","attributes":{"session.id":"session-code-search-demo-001","gen_ai.conversation.id":"conv-code-search-demo-001","agent.name":"claude-code","code_search.index.snapshot_id_hash":"sha256:6a0d5bd7e10e","code_search.codebase.path_hash":"sha256:747ff961f5c565013d2b43aa6393ee4f328ed3d6a82f28fc4ca06b417c47ebfb","code_search.git.commit_hash":"sha256:87fe0690312cb4a86c9f9256ff9e1863118a67b44f286e3510c7816d430caae0","code_search.indexed_file_count_bucket":"over_1k","code_search.indexed_chunk_count_bucket":"over_1k","code_search.embedding.provider_hash":"sha256:15c5b8267d43","code_search.embedding.model_hash":"sha256:dbb48b3aa923","code_search.snapshot.status":"fresh","privacy.raw_codebase_path_recorded":false,"privacy.raw_embedding_config_recorded":false}}
|
|
2
|
+
{"trace_id":"02c8df97e575ea76a89acf4fe9194925","span_id":"9568b542931d5d73","name":"code.search.performed","time":"2026-05-26T14:00:03.000Z","attributes":{"session.id":"session-code-search-demo-001","gen_ai.conversation.id":"conv-code-search-demo-001","code_search.query_hash":"sha256:436d2a7ed0737815a485101149ac0b2f0257573dc4a7d65cc3f5d1495bdb001a","code_search.query_category":"auth_session_debug","code_search.filter_hash":"sha256:823b6b5cedb4858291cc68b8eeaccd69cd4a8e4f54cbe62c6ca99bc590847335","code_search.top_k":8,"code_search.candidate_count_bucket":"over_1k","code_search.index.snapshot_id_hash":"sha256:6a0d5bd7e10e","privacy.raw_query_recorded":false,"privacy.raw_filter_recorded":false,"audit_gap":"proves search request identity and candidate scale, not semantic relevance"}}
|
|
3
|
+
{"trace_id":"02c8df97e575ea76a89acf4fe9194925","span_id":"9568b542931d5d73","name":"code.search.result.returned","time":"2026-05-26T14:00:04.000Z","attributes":{"session.id":"session-code-search-demo-001","gen_ai.conversation.id":"conv-code-search-demo-001","code_search.index.snapshot_id_hash":"sha256:6a0d5bd7e10e","code_search.result.rank":1,"code_search.result.score_bucket":"very_high","code_search.result.chunk_id_hash":"sha256:9b5a0917012a","code_search.result.chunk_text_hash":"sha256:89f80a544ab501d52eb4f3cb9ff1aefe496570db864b06011895db06009142ce","code_search.result.path_hash":"sha256:d730007d6c0f93605282b288e74d7f544c7f6f341a3f3c4a38a82903df69766d","code_search.result.path_extension":"ts","code_search.result.line_range_bucket":"under_100_lines","code_search.result.stale":false,"code_search.result.duplicate_of_hash":"","code_search.result.loaded_into_agent_context":true,"code_search.result.suppressed_before_agent_context":false,"code_search.result.suppression_reason":"","privacy.raw_code_chunk_recorded":false,"privacy.raw_path_recorded":false}}
|
|
4
|
+
{"trace_id":"02c8df97e575ea76a89acf4fe9194925","span_id":"9568b542931d5d73","name":"code.search.result.returned","time":"2026-05-26T14:00:04.000Z","attributes":{"session.id":"session-code-search-demo-001","gen_ai.conversation.id":"conv-code-search-demo-001","code_search.index.snapshot_id_hash":"sha256:6a0d5bd7e10e","code_search.result.rank":2,"code_search.result.score_bucket":"high","code_search.result.chunk_id_hash":"sha256:813c55aef28e","code_search.result.chunk_text_hash":"sha256:d73fdad68b67584cd00466261369d2c8bf41c7518ef39699c3962f6819a840b3","code_search.result.path_hash":"sha256:74915fb212979bb303ee810c9190a0d316ab17f1946975e3d1af57ed3001f058","code_search.result.path_extension":"ts","code_search.result.line_range_bucket":"under_100_lines","code_search.result.stale":false,"code_search.result.duplicate_of_hash":"","code_search.result.loaded_into_agent_context":true,"code_search.result.suppressed_before_agent_context":false,"code_search.result.suppression_reason":"","privacy.raw_code_chunk_recorded":false,"privacy.raw_path_recorded":false}}
|
|
5
|
+
{"trace_id":"02c8df97e575ea76a89acf4fe9194925","span_id":"9568b542931d5d73","name":"code.search.result.returned","time":"2026-05-26T14:00:04.000Z","attributes":{"session.id":"session-code-search-demo-001","gen_ai.conversation.id":"conv-code-search-demo-001","code_search.index.snapshot_id_hash":"sha256:6a0d5bd7e10e","code_search.result.rank":3,"code_search.result.score_bucket":"high","code_search.result.chunk_id_hash":"sha256:0570aa4bf0e9","code_search.result.chunk_text_hash":"sha256:39b430127a752702d78ec3180e183f90732310d13e15bcc1adf44cfba2861152","code_search.result.path_hash":"sha256:504efd04322190f19e8d6268b79713d4f7ce890fe9279e76f69d8f18a1e20eb3","code_search.result.path_extension":"ts","code_search.result.line_range_bucket":"under_100_lines","code_search.result.stale":false,"code_search.result.duplicate_of_hash":"","code_search.result.loaded_into_agent_context":true,"code_search.result.suppressed_before_agent_context":false,"code_search.result.suppression_reason":"","privacy.raw_code_chunk_recorded":false,"privacy.raw_path_recorded":false}}
|
|
6
|
+
{"trace_id":"02c8df97e575ea76a89acf4fe9194925","span_id":"9568b542931d5d73","name":"code.search.result.returned","time":"2026-05-26T14:00:04.000Z","attributes":{"session.id":"session-code-search-demo-001","gen_ai.conversation.id":"conv-code-search-demo-001","code_search.index.snapshot_id_hash":"sha256:6a0d5bd7e10e","code_search.result.rank":4,"code_search.result.score_bucket":"high","code_search.result.chunk_id_hash":"sha256:8f6ad990276d","code_search.result.chunk_text_hash":"sha256:fa92fc454797f886864101bdc4032b930d3243320829e4cab48b4f130f95c6b3","code_search.result.path_hash":"sha256:201aa087ff7e0ae80320fea83e0ab68442f48898f199564286804131f9cb9725","code_search.result.path_extension":"ts","code_search.result.line_range_bucket":"under_100_lines","code_search.result.stale":false,"code_search.result.duplicate_of_hash":"sha256:9b5a0917012a","code_search.result.loaded_into_agent_context":false,"code_search.result.suppressed_before_agent_context":true,"code_search.result.suppression_reason":"duplicate","privacy.raw_code_chunk_recorded":false,"privacy.raw_path_recorded":false}}
|
|
7
|
+
{"trace_id":"02c8df97e575ea76a89acf4fe9194925","span_id":"9568b542931d5d73","name":"code.search.result.returned","time":"2026-05-26T14:00:04.000Z","attributes":{"session.id":"session-code-search-demo-001","gen_ai.conversation.id":"conv-code-search-demo-001","code_search.index.snapshot_id_hash":"sha256:6a0d5bd7e10e","code_search.result.rank":5,"code_search.result.score_bucket":"medium","code_search.result.chunk_id_hash":"sha256:cfc00599f288","code_search.result.chunk_text_hash":"sha256:ce03d90b6be534b863cda68baa527cd8067d2cc2b17909d224badc35aaea09a0","code_search.result.path_hash":"sha256:fec2453a62f266008a8ec7ca36bdaf87ff3da8a6e16a1af58f3e67a06eee3db1","code_search.result.path_extension":"md","code_search.result.line_range_bucket":"under_100_lines","code_search.result.stale":true,"code_search.result.duplicate_of_hash":"","code_search.result.loaded_into_agent_context":false,"code_search.result.suppressed_before_agent_context":true,"code_search.result.suppression_reason":"stale_snapshot_chunk","privacy.raw_code_chunk_recorded":false,"privacy.raw_path_recorded":false}}
|
|
8
|
+
{"trace_id":"02c8df97e575ea76a89acf4fe9194925","span_id":"9568b542931d5d73","name":"context.input.loaded","time":"2026-05-26T14:00:06.000Z","attributes":{"session.id":"session-code-search-demo-001","gen_ai.conversation.id":"conv-code-search-demo-001","context.input.kind":"retrieved_code_chunks","context.input.source":"code_search","context.input.client_transform":"top_k_then_dedupe_then_stale_filter","context.input.loaded_chunk_count":3,"context.input.suppressed_chunk_count":2,"context.input.loaded_chunk_ids_hash":"sha256:65ecc531bcad826933c08dc1be4429a6c02f68f446517f6c16f06c9ba5492a72","context.input.suppressed_chunk_ids_hash":"sha256:f4baf0b7d5a2c8a337242746cc1bb6a0473761b4319c10b46c7332356d695c4e","context.input.prompt_token_bucket":"under_5k","context.input.raw_prompt_hash":"sha256:5d992588057a1ae2b6cb5675315c4804a23f1eb2724527d5036be185e3ce161d","privacy.raw_prompt_recorded":false,"privacy.raw_code_chunks_recorded":false,"privacy.raw_paths_recorded":false,"audit_gap":"proves returned-vs-loaded boundary, not answer correctness or retrieval optimality"}}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, extname, join, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const inputPath = process.argv[2] ? resolve(process.argv[2]) : join(here, 'sample-code-search-retrieval-log.jsonl');
|
|
9
|
+
const receiptPath = process.argv[3] ? resolve(process.argv[3]) : join(here, 'code-search-retrieval-receipt.ndjson');
|
|
10
|
+
const tracePath = process.argv[4] ? resolve(process.argv[4]) : join(here, 'code-search-retrieval-otel-trace.json');
|
|
11
|
+
|
|
12
|
+
function sha256(value) {
|
|
13
|
+
return `sha256:${createHash('sha256').update(value ?? '').digest('hex')}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function hashRef(value) {
|
|
17
|
+
return sha256(value ?? '').slice(0, 19);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function readJsonl(path) {
|
|
21
|
+
return readFileSync(path, 'utf8')
|
|
22
|
+
.trim()
|
|
23
|
+
.split('\n')
|
|
24
|
+
.filter(Boolean)
|
|
25
|
+
.map((line, index) => {
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(line);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
throw new Error(`Invalid JSONL at ${path}:${index + 1}: ${error.message}`);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function unixNano(isoTimestamp) {
|
|
35
|
+
return `${BigInt(Date.parse(isoTimestamp)) * 1_000_000n}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function otelValue(value) {
|
|
39
|
+
if (typeof value === 'boolean') return { boolValue: value };
|
|
40
|
+
if (typeof value === 'number' && Number.isInteger(value)) return { intValue: String(value) };
|
|
41
|
+
if (typeof value === 'number') return { doubleValue: value };
|
|
42
|
+
if (value == null) return { stringValue: '' };
|
|
43
|
+
return { stringValue: String(value) };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function attributesToOtel(attributes) {
|
|
47
|
+
return Object.entries(attributes).map(([key, value]) => ({ key, value: otelValue(value) }));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function countBucket(value) {
|
|
51
|
+
if (value === 0) return 'zero';
|
|
52
|
+
if (value <= 5) return 'under_5';
|
|
53
|
+
if (value <= 25) return 'under_25';
|
|
54
|
+
if (value <= 100) return 'under_100';
|
|
55
|
+
if (value <= 1_000) return 'under_1k';
|
|
56
|
+
return 'over_1k';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function tokenBucket(value) {
|
|
60
|
+
if (value < 1_000) return 'under_1k';
|
|
61
|
+
if (value < 5_000) return 'under_5k';
|
|
62
|
+
if (value < 10_000) return 'under_10k';
|
|
63
|
+
return 'over_10k';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function scoreBucket(score) {
|
|
67
|
+
if (score >= 0.9) return 'very_high';
|
|
68
|
+
if (score >= 0.8) return 'high';
|
|
69
|
+
if (score >= 0.6) return 'medium';
|
|
70
|
+
return 'low';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function lineRangeBucket(result) {
|
|
74
|
+
const lineCount = Math.max(0, Number(result.end_line) - Number(result.start_line) + 1);
|
|
75
|
+
if (lineCount <= 25) return 'under_25_lines';
|
|
76
|
+
if (lineCount <= 100) return 'under_100_lines';
|
|
77
|
+
return 'over_100_lines';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const records = readJsonl(inputPath);
|
|
81
|
+
const session = records.find((record) => record.type === 'session.start');
|
|
82
|
+
const snapshot = records.find((record) => record.type === 'code.index.snapshot.used');
|
|
83
|
+
const search = records.find((record) => record.type === 'code.search.performed');
|
|
84
|
+
const returned = records.find((record) => record.type === 'code.search.results.returned');
|
|
85
|
+
const loaded = records.find((record) => record.type === 'context.input.loaded');
|
|
86
|
+
|
|
87
|
+
if (!session || !snapshot || !search || !returned || !loaded) {
|
|
88
|
+
throw new Error(`Expected session.start, code.index.snapshot.used, code.search.performed, code.search.results.returned, and context.input.loaded records in ${inputPath}`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const results = returned.results ?? [];
|
|
92
|
+
const traceSeed = `${session.session_id}:${session.conversation_id}:code-search-retrieval`;
|
|
93
|
+
const traceId = sha256(traceSeed).replace('sha256:', '').slice(0, 32);
|
|
94
|
+
const spanId = sha256(`${traceSeed}:span`).replace('sha256:', '').slice(0, 16);
|
|
95
|
+
const loadedIds = new Set(loaded.loaded_chunk_ids ?? []);
|
|
96
|
+
const suppressedIds = new Set(loaded.suppressed_chunk_ids ?? []);
|
|
97
|
+
|
|
98
|
+
const snapshotEvent = {
|
|
99
|
+
trace_id: traceId,
|
|
100
|
+
span_id: spanId,
|
|
101
|
+
name: 'code.index.snapshot.used',
|
|
102
|
+
time: snapshot.time,
|
|
103
|
+
attributes: {
|
|
104
|
+
'session.id': session.session_id,
|
|
105
|
+
'gen_ai.conversation.id': session.conversation_id,
|
|
106
|
+
'agent.name': session.agent,
|
|
107
|
+
'code_search.index.snapshot_id_hash': hashRef(snapshot.index_snapshot_id),
|
|
108
|
+
'code_search.codebase.path_hash': sha256(snapshot.codebase_path),
|
|
109
|
+
'code_search.git.commit_hash': sha256(snapshot.git_commit),
|
|
110
|
+
'code_search.indexed_file_count_bucket': countBucket(snapshot.indexed_file_count),
|
|
111
|
+
'code_search.indexed_chunk_count_bucket': countBucket(snapshot.indexed_chunk_count),
|
|
112
|
+
'code_search.embedding.provider_hash': hashRef(snapshot.embedding_provider),
|
|
113
|
+
'code_search.embedding.model_hash': hashRef(snapshot.embedding_model),
|
|
114
|
+
'code_search.snapshot.status': snapshot.snapshot_status,
|
|
115
|
+
'privacy.raw_codebase_path_recorded': false,
|
|
116
|
+
'privacy.raw_embedding_config_recorded': false
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const searchEvent = {
|
|
121
|
+
trace_id: traceId,
|
|
122
|
+
span_id: spanId,
|
|
123
|
+
name: 'code.search.performed',
|
|
124
|
+
time: search.time,
|
|
125
|
+
attributes: {
|
|
126
|
+
'session.id': session.session_id,
|
|
127
|
+
'gen_ai.conversation.id': session.conversation_id,
|
|
128
|
+
'code_search.query_hash': sha256(search.raw_query),
|
|
129
|
+
'code_search.query_category': search.query_category,
|
|
130
|
+
'code_search.filter_hash': sha256(search.filter),
|
|
131
|
+
'code_search.top_k': search.top_k,
|
|
132
|
+
'code_search.candidate_count_bucket': countBucket(search.candidate_count),
|
|
133
|
+
'code_search.index.snapshot_id_hash': hashRef(search.index_snapshot_id),
|
|
134
|
+
'privacy.raw_query_recorded': false,
|
|
135
|
+
'privacy.raw_filter_recorded': false,
|
|
136
|
+
'audit_gap': 'proves search request identity and candidate scale, not semantic relevance'
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const resultEvents = results.map((result) => ({
|
|
141
|
+
trace_id: traceId,
|
|
142
|
+
span_id: spanId,
|
|
143
|
+
name: 'code.search.result.returned',
|
|
144
|
+
time: returned.time,
|
|
145
|
+
attributes: {
|
|
146
|
+
'session.id': session.session_id,
|
|
147
|
+
'gen_ai.conversation.id': session.conversation_id,
|
|
148
|
+
'code_search.index.snapshot_id_hash': hashRef(returned.index_snapshot_id),
|
|
149
|
+
'code_search.result.rank': result.rank,
|
|
150
|
+
'code_search.result.score_bucket': scoreBucket(result.score),
|
|
151
|
+
'code_search.result.chunk_id_hash': hashRef(result.chunk_id),
|
|
152
|
+
'code_search.result.chunk_text_hash': sha256(result.raw_chunk_text),
|
|
153
|
+
'code_search.result.path_hash': sha256(result.path),
|
|
154
|
+
'code_search.result.path_extension': extname(result.path).slice(1) || 'none',
|
|
155
|
+
'code_search.result.line_range_bucket': lineRangeBucket(result),
|
|
156
|
+
'code_search.result.stale': Boolean(result.stale),
|
|
157
|
+
'code_search.result.duplicate_of_hash': result.duplicate_of ? hashRef(result.duplicate_of) : '',
|
|
158
|
+
'code_search.result.loaded_into_agent_context': loadedIds.has(result.chunk_id),
|
|
159
|
+
'code_search.result.suppressed_before_agent_context': suppressedIds.has(result.chunk_id),
|
|
160
|
+
'code_search.result.suppression_reason': loaded.suppression_reasons?.[result.chunk_id] ?? '',
|
|
161
|
+
'privacy.raw_code_chunk_recorded': false,
|
|
162
|
+
'privacy.raw_path_recorded': false
|
|
163
|
+
}
|
|
164
|
+
}));
|
|
165
|
+
|
|
166
|
+
const loadedEvent = {
|
|
167
|
+
trace_id: traceId,
|
|
168
|
+
span_id: spanId,
|
|
169
|
+
name: 'context.input.loaded',
|
|
170
|
+
time: loaded.time,
|
|
171
|
+
attributes: {
|
|
172
|
+
'session.id': session.session_id,
|
|
173
|
+
'gen_ai.conversation.id': session.conversation_id,
|
|
174
|
+
'context.input.kind': 'retrieved_code_chunks',
|
|
175
|
+
'context.input.source': 'code_search',
|
|
176
|
+
'context.input.client_transform': loaded.client_transform,
|
|
177
|
+
'context.input.loaded_chunk_count': loadedIds.size,
|
|
178
|
+
'context.input.suppressed_chunk_count': suppressedIds.size,
|
|
179
|
+
'context.input.loaded_chunk_ids_hash': sha256([...loadedIds].sort().join('\n')),
|
|
180
|
+
'context.input.suppressed_chunk_ids_hash': sha256([...suppressedIds].sort().join('\n')),
|
|
181
|
+
'context.input.prompt_token_bucket': tokenBucket(loaded.prompt_token_count),
|
|
182
|
+
'context.input.raw_prompt_hash': sha256(loaded.raw_prompt_fragment),
|
|
183
|
+
'privacy.raw_prompt_recorded': false,
|
|
184
|
+
'privacy.raw_code_chunks_recorded': false,
|
|
185
|
+
'privacy.raw_paths_recorded': false,
|
|
186
|
+
'audit_gap': 'proves returned-vs-loaded boundary, not answer correctness or retrieval optimality'
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const events = [snapshotEvent, searchEvent, ...resultEvents, loadedEvent]
|
|
191
|
+
.sort((left, right) => Date.parse(left.time) - Date.parse(right.time) || left.name.localeCompare(right.name));
|
|
192
|
+
|
|
193
|
+
writeFileSync(receiptPath, `${events.map((event) => JSON.stringify(event)).join('\n')}\n`);
|
|
194
|
+
|
|
195
|
+
const trace = {
|
|
196
|
+
resourceSpans: [
|
|
197
|
+
{
|
|
198
|
+
resource: {
|
|
199
|
+
attributes: attributesToOtel({
|
|
200
|
+
'service.name': 'pluribus-code-search-retrieval-receipt-demo',
|
|
201
|
+
'service.version': '0.0.0-fixture',
|
|
202
|
+
'deployment.environment.name': 'local-fixture'
|
|
203
|
+
})
|
|
204
|
+
},
|
|
205
|
+
scopeSpans: [
|
|
206
|
+
{
|
|
207
|
+
scope: {
|
|
208
|
+
name: 'pluribus.context_input_evidence.code_search_retrieval_demo',
|
|
209
|
+
version: '0.0.0-fixture'
|
|
210
|
+
},
|
|
211
|
+
spans: [
|
|
212
|
+
{
|
|
213
|
+
traceId,
|
|
214
|
+
spanId,
|
|
215
|
+
parentSpanId: '',
|
|
216
|
+
name: 'agent.session.code_search_retrieval',
|
|
217
|
+
kind: 1,
|
|
218
|
+
startTimeUnixNano: unixNano(snapshot.time),
|
|
219
|
+
endTimeUnixNano: unixNano(loaded.time),
|
|
220
|
+
attributes: attributesToOtel({
|
|
221
|
+
'session.id': session.session_id,
|
|
222
|
+
'gen_ai.conversation.id': session.conversation_id,
|
|
223
|
+
'agent.name': session.agent,
|
|
224
|
+
'workspace.name_hash': hashRef(session.workspace),
|
|
225
|
+
'gen_ai.request.model': session.model,
|
|
226
|
+
'code_search.query_category': search.query_category
|
|
227
|
+
}),
|
|
228
|
+
events: events.map((event) => ({
|
|
229
|
+
name: event.name,
|
|
230
|
+
timeUnixNano: unixNano(event.time),
|
|
231
|
+
attributes: attributesToOtel(event.attributes)
|
|
232
|
+
}))
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
writeFileSync(tracePath, `${JSON.stringify(trace, null, 2)}\n`);
|
|
242
|
+
|
|
243
|
+
const forbiddenRawStrings = [
|
|
244
|
+
'/Users/alex/src/acme-payments/private-monorepo',
|
|
245
|
+
'Acme-Co',
|
|
246
|
+
'sk_live_private_fixture',
|
|
247
|
+
'finance-vp@acme.example',
|
|
248
|
+
'sso.internal.acme.example',
|
|
249
|
+
'tok_private_fixture',
|
|
250
|
+
'ACME-7391',
|
|
251
|
+
'+1-555-0100',
|
|
252
|
+
'https://acme.example/private/sso',
|
|
253
|
+
'src/auth/session-renewal.ts',
|
|
254
|
+
'src/auth/sso/failover.ts',
|
|
255
|
+
'src/billing/stripe-session.ts',
|
|
256
|
+
'docs/runbooks/sso-failover.md'
|
|
257
|
+
];
|
|
258
|
+
|
|
259
|
+
const receiptText = readFileSync(receiptPath, 'utf8');
|
|
260
|
+
const traceText = readFileSync(tracePath, 'utf8');
|
|
261
|
+
const leaked = forbiddenRawStrings.filter((value) => receiptText.includes(value) || traceText.includes(value));
|
|
262
|
+
if (leaked.length > 0) {
|
|
263
|
+
throw new Error(`Receipt leaked raw private fixture strings: ${leaked.join(', ')}`);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
console.log(JSON.stringify({
|
|
267
|
+
schema: 'pluribus.codeSearchRetrievalReceipt.demo.v0',
|
|
268
|
+
eventCount: events.length,
|
|
269
|
+
returnedResultCount: results.length,
|
|
270
|
+
loadedChunkCount: loadedIds.size,
|
|
271
|
+
suppressedChunkCount: suppressedIds.size,
|
|
272
|
+
staleReturnedCount: results.filter((result) => result.stale).length,
|
|
273
|
+
duplicateReturnedCount: results.filter((result) => result.duplicate_of).length,
|
|
274
|
+
rawCodeCopiedToReceipt: false,
|
|
275
|
+
rawPathsCopiedToReceipt: false,
|
|
276
|
+
rawQueryCopiedToReceipt: false,
|
|
277
|
+
receiptPath: 'examples/context-input-evidence/code-search-retrieval-receipt.ndjson',
|
|
278
|
+
tracePath: 'examples/context-input-evidence/code-search-retrieval-otel-trace.json',
|
|
279
|
+
lesson: 'Code-search tools should attest returned result identities separately from what the agent actually loaded, without exposing raw code or private paths.'
|
|
280
|
+
}, null, 2));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{"type":"session.start","time":"2026-05-26T14:00:00.000Z","session_id":"session-code-search-demo-001","conversation_id":"conv-code-search-demo-001","agent":"claude-code","workspace":"private-monorepo-fixture","model":"claude-opus-4.6"}
|
|
2
|
+
{"type":"code.index.snapshot.used","time":"2026-05-26T14:00:01.000Z","index_snapshot_id":"snapshot-2026-05-26T13-55Z","codebase_path":"/Users/alex/src/acme-payments/private-monorepo","git_commit":"d34db33fd34db33fd34db33fd34db33fd34db33f","embedding_provider":"zilliz-cloud-openai","embedding_model":"text-embedding-3-large","indexed_file_count":1842,"indexed_chunk_count":12678,"snapshot_status":"fresh"}
|
|
3
|
+
{"type":"code.search.performed","time":"2026-05-26T14:00:03.000Z","raw_query":"why does Acme-Co session renewal fail for enterprise SSO customers after region failover? include Stripe payment token path","query_category":"auth_session_debug","top_k":8,"candidate_count":12678,"filter":"language:typescript path:src/auth","index_snapshot_id":"snapshot-2026-05-26T13-55Z"}
|
|
4
|
+
{"type":"code.search.results.returned","time":"2026-05-26T14:00:04.000Z","index_snapshot_id":"snapshot-2026-05-26T13-55Z","results":[{"rank":1,"score":0.912,"path":"src/auth/session-renewal.ts","start_line":42,"end_line":91,"chunk_id":"chunk-auth-renewal-42-91","raw_chunk_text":"const ACME_INTERNAL_SSO_CLIENT_SECRET = 'sk_live_private_fixture'; const customerEmail = 'finance-vp@acme.example'; renewSessionAfterRegionFailover();","stale":false,"duplicate_of":null},{"rank":2,"score":0.887,"path":"src/auth/sso/failover.ts","start_line":14,"end_line":66,"chunk_id":"chunk-sso-failover-14-66","raw_chunk_text":"handle failover for sso tenant acme-co with payment token tok_private_fixture and internal host sso.internal.acme.example","stale":false,"duplicate_of":null},{"rank":3,"score":0.861,"path":"src/billing/stripe-session.ts","start_line":108,"end_line":143,"chunk_id":"chunk-billing-stripe-108-143","raw_chunk_text":"stripe payment renewal path for customer acme-co. contains ticket ACME-7391 and private webhook payload.","stale":false,"duplicate_of":null},{"rank":4,"score":0.858,"path":"src/auth/session-renewal-copy.ts","start_line":42,"end_line":91,"chunk_id":"chunk-auth-renewal-copy-42-91","raw_chunk_text":"duplicate copy of the private Acme-Co session renewal fixture with sk_live_private_fixture","stale":false,"duplicate_of":"chunk-auth-renewal-42-91"},{"rank":5,"score":0.792,"path":"docs/runbooks/sso-failover.md","start_line":5,"end_line":38,"chunk_id":"chunk-runbook-sso-5-38","raw_chunk_text":"runbook says page oncall at +1-555-0100 and include customer URL https://acme.example/private/sso","stale":true,"duplicate_of":null}]}
|
|
5
|
+
{"type":"context.input.loaded","time":"2026-05-26T14:00:06.000Z","index_snapshot_id":"snapshot-2026-05-26T13-55Z","loaded_chunk_ids":["chunk-auth-renewal-42-91","chunk-sso-failover-14-66","chunk-billing-stripe-108-143"],"suppressed_chunk_ids":["chunk-auth-renewal-copy-42-91","chunk-runbook-sso-5-38"],"suppression_reasons":{"chunk-auth-renewal-copy-42-91":"duplicate","chunk-runbook-sso-5-38":"stale_snapshot_chunk"},"prompt_token_count":2860,"raw_prompt_fragment":"User asked about Acme-Co private SSO failover and sk_live_private_fixture; include webhook payload from https://acme.example/private/sso","client_transform":"top_k_then_dedupe_then_stale_filter"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pluribus-context",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.34",
|
|
4
4
|
"description": "AI context and rules sync CLI for Claude.md, Claude Code, Cursor, and Copilot instructions, with privacy-safe context receipts that prove what memory, tools, skills, compactions, and security findings crossed agent boundaries without logging raw content.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/caioribeiroclw-pixel/pluribus#readme",
|
package/src/utils/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.3.
|
|
1
|
+
export const VERSION = '0.3.34'
|