@tangle-network/harness-sessions 1.0.1 → 1.0.2
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/capture.js +13 -14
- package/package.json +1 -1
package/dist/capture.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { isRecord } from '@tangle-network/agent-core';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* The sidecar's raw-evidence archive v2 lists each execution's native session copies in
|
|
6
|
-
* `nativeSessions[]`, with the harness, the session id recorded at spawn, the copy kind and the
|
|
7
|
-
* files. A capture taken before v2 (provider-tangle's retention layout, `tangle-native-session-
|
|
8
|
-
* evidence.v1`) has no such list: it holds each execution's private runtime HOME under
|
|
9
|
-
* `__retention__/sessions/<sandbox session>/native/<source>/<root scope>/`, and its manifest names
|
|
10
|
-
* the harness and, once an attempt settled, the native session ids. Both are read through the
|
|
11
|
-
* store layouts the readers declare; no consumer matches session paths itself.
|
|
2
|
+
/** Read sidecar v2 native copies and historical provider retention through their
|
|
3
|
+
* declared stores, preserving recorded execution identities and native families.
|
|
12
4
|
*/
|
|
13
5
|
import { readdir, readFile } from 'node:fs/promises';
|
|
14
6
|
import { join } from 'node:path';
|
|
@@ -63,11 +55,18 @@ async function fromV2(archiveDir, manifest, listing) {
|
|
|
63
55
|
}
|
|
64
56
|
const path = join(archiveDir, db.path);
|
|
65
57
|
const refs = await opencodeSessionsInStore(path, null, {});
|
|
66
|
-
const
|
|
67
|
-
// Child sessions of the execution's session live in the same store.
|
|
58
|
+
const children = new Map();
|
|
68
59
|
for (const ref of refs)
|
|
69
|
-
if (ref.parentNativeSessionId
|
|
70
|
-
|
|
60
|
+
if (ref.parentNativeSessionId) {
|
|
61
|
+
const group = children.get(ref.parentNativeSessionId) ?? [];
|
|
62
|
+
group.push(ref.nativeSessionId);
|
|
63
|
+
children.set(ref.parentNativeSessionId, group);
|
|
64
|
+
}
|
|
65
|
+
const ids = new Set([copy.nativeSessionId]);
|
|
66
|
+
// Set iteration visits newly added children once, independent of store order.
|
|
67
|
+
for (const id of ids)
|
|
68
|
+
for (const child of children.get(id) ?? [])
|
|
69
|
+
ids.add(child);
|
|
71
70
|
for (const ref of refs.filter((r) => ids.has(r.nativeSessionId))) {
|
|
72
71
|
listing.sessions.push(captured({ ...ref, truncated }, copy, ref.nativeSessionId === copy.nativeSessionId, archiveDir, path));
|
|
73
72
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/harness-sessions",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "One reader for every coding-agent harness's native session (Claude Code, Codex, OpenCode, Pi): store layouts, a normalized session with messages, tool calls, served models, usage and ending errors, and projections to chat messages, OTLP spans and turns",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|