@tangle-network/harness-sessions 0.1.7 → 0.2.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/builder.d.ts +0 -1
- package/dist/builder.js +1 -1
- package/dist/capture.js +2 -1
- package/dist/formats/claude-code.js +2 -1
- package/dist/formats/codex.js +2 -1
- package/dist/formats/factory.js +2 -1
- package/dist/formats/kimi.js +2 -1
- package/dist/formats/opencode.js +2 -1
- package/dist/formats/pi.js +2 -1
- package/dist/projections/turns.js +1 -1
- package/package.json +2 -1
package/dist/builder.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { SourceStats } from './source.js';
|
|
|
3
3
|
export type BuildMode = 'full' | 'summary';
|
|
4
4
|
/** An ISO-8601 instant from an ISO string, epoch milliseconds or epoch seconds; null otherwise. */
|
|
5
5
|
export declare function isoTime(value: unknown): string | null;
|
|
6
|
-
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
7
6
|
export declare const str: (value: unknown) => string | null;
|
|
8
7
|
export declare function count(value: unknown): number | null;
|
|
9
8
|
/** Parse tool arguments recorded as text; keep the text when it is not JSON. */
|
package/dist/builder.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRecord } from '@tangle-network/agent-core';
|
|
1
2
|
import { HARNESS_SESSION_SCHEMA } from './schema.js';
|
|
2
3
|
/** An ISO-8601 instant from an ISO string, epoch milliseconds or epoch seconds; null otherwise. */
|
|
3
4
|
export function isoTime(value) {
|
|
@@ -11,7 +12,6 @@ export function isoTime(value) {
|
|
|
11
12
|
}
|
|
12
13
|
return null;
|
|
13
14
|
}
|
|
14
|
-
export const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
15
15
|
export const str = (value) => (typeof value === 'string' ? value : null);
|
|
16
16
|
export function count(value) {
|
|
17
17
|
return typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : null;
|
package/dist/capture.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRecord } from '@tangle-network/agent-core';
|
|
1
2
|
/**
|
|
2
3
|
* Reading the native sessions in a capture.
|
|
3
4
|
*
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
*/
|
|
12
13
|
import { readdir, readFile } from 'node:fs/promises';
|
|
13
14
|
import { join } from 'node:path';
|
|
14
|
-
import {
|
|
15
|
+
import { str } from './builder.js';
|
|
15
16
|
import { opencodeSessionsInStore } from './formats/opencode.js';
|
|
16
17
|
import { maybeReaderFor, readerFor, readerForFormat } from './registry.js';
|
|
17
18
|
import { isMissing } from './source.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRecord } from '@tangle-network/agent-core';
|
|
1
2
|
/**
|
|
2
3
|
* Claude Code: `~/.claude/projects/<cwd slug>/<session id>.jsonl`, one JSON record per line, and
|
|
3
4
|
* each subagent's own transcript at `<session id>/subagents/agent-<agent id>.jsonl`.
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
* the API answered with.
|
|
10
11
|
*/
|
|
11
12
|
import { basename, join } from 'node:path';
|
|
12
|
-
import { SessionBuilder, count,
|
|
13
|
+
import { SessionBuilder, count, sessionError, str, textOf, usageOrNull } from '../builder.js';
|
|
13
14
|
import { fileRecords } from '../source.js';
|
|
14
15
|
import { runFold } from './fold.js';
|
|
15
16
|
import { EVIDENCE, LOCATE_READS, STORES, mapLimit, mtimeMs, storeGlob, walkFiles, withinPath } from '../stores.js';
|
package/dist/formats/codex.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRecord } from '@tangle-network/agent-core';
|
|
1
2
|
/**
|
|
2
3
|
* Codex: `~/.codex/sessions/YYYY/MM/DD/rollout-<timestamp>-<thread id>.jsonl`, one
|
|
3
4
|
* `{timestamp, type, payload}` record per line.
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
* (`total_token_usage`); the cumulative counter is the session total.
|
|
11
12
|
*/
|
|
12
13
|
import { basename } from 'node:path';
|
|
13
|
-
import { SessionBuilder, argumentsOf, count,
|
|
14
|
+
import { SessionBuilder, argumentsOf, count, sessionError, str, textOf, usageOrNull, } from '../builder.js';
|
|
14
15
|
import { fileRecords, isMissing } from '../source.js';
|
|
15
16
|
import { runFold } from './fold.js';
|
|
16
17
|
import { CODEX_HOME_RULE, EVIDENCE, LOCATE_READS, STORES, codexHomes, mapLimit, storeGlob, walkFiles, withinPath } from '../stores.js';
|
package/dist/formats/factory.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRecord } from '@tangle-network/agent-core';
|
|
1
2
|
/**
|
|
2
3
|
* Factory Droid: `~/.factory/sessions/<encoded cwd>/<session id>.jsonl` plus a
|
|
3
4
|
* `<session id>.settings.json` beside it.
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
*/
|
|
11
12
|
import { readFile } from 'node:fs/promises';
|
|
12
13
|
import { basename, join } from 'node:path';
|
|
13
|
-
import { SessionBuilder, count,
|
|
14
|
+
import { SessionBuilder, count, str, textOf, usageOrNull } from '../builder.js';
|
|
14
15
|
import { fileRecords, isMissing } from '../source.js';
|
|
15
16
|
import { EVIDENCE, STORES, mtimeMs, storeGlob, walkFiles, withinPath } from '../stores.js';
|
|
16
17
|
import { runFold } from './fold.js';
|
package/dist/formats/kimi.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRecord } from '@tangle-network/agent-core';
|
|
1
2
|
/**
|
|
2
3
|
* Kimi Code: one directory per session, `~/.kimi/sessions/<workdir hash>/<session id>/`, holding
|
|
3
4
|
* `wire.jsonl` (the event stream this reader folds) and `context.jsonl` (the model context).
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
* subagent's events arrive wrapped in `SubagentEvent`. The wire records no model.
|
|
12
13
|
*/
|
|
13
14
|
import { basename, dirname, join } from 'node:path';
|
|
14
|
-
import { SessionBuilder, count,
|
|
15
|
+
import { SessionBuilder, count, sessionError, str, textOf, usageOrNull } from '../builder.js';
|
|
15
16
|
import { fileRecords } from '../source.js';
|
|
16
17
|
import { EVIDENCE, STORES, mtimeMs, storeGlob, walkFiles } from '../stores.js';
|
|
17
18
|
import { runFold } from './fold.js';
|
package/dist/formats/opencode.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRecord } from '@tangle-network/agent-core';
|
|
1
2
|
/**
|
|
2
3
|
* OpenCode 1.x: one SQLite store for every session in the HOME,
|
|
3
4
|
* `~/.local/share/opencode/opencode.db` (with `-wal` and `-shm` siblings while it is open).
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
*/
|
|
13
14
|
import { createHash } from 'node:crypto';
|
|
14
15
|
import { join } from 'node:path';
|
|
15
|
-
import { SessionBuilder, count,
|
|
16
|
+
import { SessionBuilder, count, isoTime, sessionError, str, usageOrNull } from '../builder.js';
|
|
16
17
|
import { isMissing, withSqlite } from '../source.js';
|
|
17
18
|
import { EVIDENCE, STORES, mtimeMs, withinPath } from '../stores.js';
|
|
18
19
|
const FORMAT = 'opencode.sqlite';
|
package/dist/formats/pi.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRecord } from '@tangle-network/agent-core';
|
|
1
2
|
/**
|
|
2
3
|
* Pi: `~/.pi/agent/sessions/<encoded cwd>/<timestamp>_<session id>.jsonl`, one entry per line.
|
|
3
4
|
*
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
* `toolCallId`. Entries form a tree through `parentId`; branches share one file.
|
|
10
11
|
*/
|
|
11
12
|
import { basename, join } from 'node:path';
|
|
12
|
-
import { SessionBuilder, count,
|
|
13
|
+
import { SessionBuilder, count, sessionError, str, textOf, usageOrNull } from '../builder.js';
|
|
13
14
|
import { fileRecords } from '../source.js';
|
|
14
15
|
import { runFold } from './fold.js';
|
|
15
16
|
import { EVIDENCE, STORES, mtimeMs, storeGlob, walkFiles, withinPath } from '../stores.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/harness-sessions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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,
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"@tangle-network/agent-core": "^0.13.0",
|
|
43
44
|
"@tangle-network/agent-trace-contract": "^2.0.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|