agent-blackboard 0.9.0 → 0.9.1

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.
@@ -1,5 +1,5 @@
1
1
  import { type PartitionFormat } from './snapshot-digest.mjs';
2
- import type { SnapshotManifest, SnapshotPartition } from './snapshot-types.mjs';
2
+ import type { SnapshotManifest, SnapshotOversizedSession, SnapshotPartition } from './snapshot-types.mjs';
3
3
  type PartitionFileStats = {
4
4
  isFile(): boolean;
5
5
  nlink: bigint;
@@ -10,10 +10,14 @@ export declare function assertPartitionFile(stats: PartitionFileStats, expected:
10
10
  dev: bigint;
11
11
  ino: bigint;
12
12
  }, message: string): void;
13
- /** Replays private staged groups into bounded, immutable partition files. */
13
+ /** Replays staged groups into bounded, immutable partition files. A session too large for one
14
+ * partition is never split: it is left out and listed in `oversized`. */
14
15
  export declare function writePartitions(index: string, indexIdentity: {
15
16
  dev: string;
16
17
  ino: string;
17
18
  size: string;
18
- }, manifest: SnapshotManifest, directory: string, maxSessions: number, maxBytes: number, format?: PartitionFormat): Promise<SnapshotPartition[]>;
19
+ }, manifest: SnapshotManifest, directory: string, maxSessions: number, maxBytes: number, format?: PartitionFormat): Promise<{
20
+ partitions: SnapshotPartition[];
21
+ oversized: SnapshotOversizedSession[];
22
+ }>;
19
23
  export {};
@@ -14,9 +14,11 @@ export function assertPartitionFile(stats, expected, message) {
14
14
  stats.ino !== expected.ino)
15
15
  throw new Error(message);
16
16
  }
17
- /** Replays private staged groups into bounded, immutable partition files. */
17
+ /** Replays staged groups into bounded, immutable partition files. A session too large for one
18
+ * partition is never split: it is left out and listed in `oversized`. */
18
19
  export async function writePartitions(index, indexIdentity, manifest, directory, maxSessions, maxBytes, format = formatFor(undefined)) {
19
20
  const partitions = [];
21
+ const oversized = [];
20
22
  const stageDirectory = dirname(index);
21
23
  const stageIdentity = await captureDirectoryIdentity(stageDirectory, 'staging directory');
22
24
  const outputIdentity = await captureDirectoryIdentity(directory, 'output directory');
@@ -112,21 +114,19 @@ export async function writePartitions(index, indexIdentity, manifest, directory,
112
114
  await assertStage();
113
115
  const block = JSON.parse(sourceLine);
114
116
  assertStagedBlockPath(block, index);
117
+ if (headerBytes.byteLength + block.bytes + Buffer.byteLength(terminalFor(block)) > maxBytes) {
118
+ oversized.push({ sessionId: block.sessionId, entries: block.entries, bytes: block.bytes });
119
+ continue;
120
+ }
115
121
  if (active && active.block.sessions + block.sessions > maxSessions)
116
122
  await finish();
117
- let candidate = {
118
- ...block,
123
+ const candidate = {
119
124
  sessions: (active?.block.sessions ?? 0) + block.sessions,
120
125
  entries: (active?.block.entries ?? 0) + block.entries,
121
126
  };
122
- let terminalBytes = Buffer.byteLength(terminalFor(candidate));
123
- if (active && active.block.bytes + block.bytes + terminalBytes > maxBytes) {
127
+ const terminalBytes = Buffer.byteLength(terminalFor(candidate));
128
+ if (active && active.block.bytes + block.bytes + terminalBytes > maxBytes)
124
129
  await finish();
125
- candidate = { ...block };
126
- terminalBytes = Buffer.byteLength(terminalFor(candidate));
127
- }
128
- if (headerBytes.byteLength + block.bytes + terminalBytes > maxBytes)
129
- throw new Error(`snapshot session ${block.sessionId} is too large for one partition`);
130
130
  const target = active ?? (await start());
131
131
  target.block.sessions += block.sessions;
132
132
  target.block.entries += block.entries;
@@ -139,7 +139,7 @@ export async function writePartitions(index, indexIdentity, manifest, directory,
139
139
  await finish();
140
140
  await assertStage();
141
141
  await assertOutput();
142
- return partitions;
142
+ return { partitions, oversized };
143
143
  }
144
144
  finally {
145
145
  await indexFile.close();
@@ -79,8 +79,8 @@ export async function partitionSnapshot(options) {
79
79
  await source.close();
80
80
  source = undefined;
81
81
  assertVerification(staged.bytes, staged.checksum, staged.manifest, options);
82
- const partitions = await writePartitions(staged.index, staged.indexIdentity, staged.manifest, directory, assertLimit(options.maxSessions, MAX_SESSIONS, 'maxSessions'), assertLimit(options.maxBytes, MAX_BYTES, 'maxBytes'), formatFor(filter));
83
- return { directory, partitions, cleanupToken };
82
+ const { partitions, oversized } = await writePartitions(staged.index, staged.indexIdentity, staged.manifest, directory, assertLimit(options.maxSessions, MAX_SESSIONS, 'maxSessions'), assertLimit(options.maxBytes, MAX_BYTES, 'maxBytes'), formatFor(filter));
83
+ return { directory, partitions, oversized, cleanupToken };
84
84
  }
85
85
  catch (error) {
86
86
  /* v8 ignore next -- allocation failures before a directory exists are not deterministic in tests */
@@ -88,9 +88,18 @@ export interface SnapshotPartition {
88
88
  checksum: SnapshotChecksum;
89
89
  manifest: SnapshotManifest;
90
90
  }
91
+ /** A session left out of every partition because it alone exceeds `maxBytes`. */
92
+ export interface SnapshotOversizedSession {
93
+ sessionId: string;
94
+ entries: number;
95
+ /** The session's size in the partition format, without the partition header and trailer. */
96
+ bytes: number;
97
+ }
91
98
  export interface SnapshotPartitionResult {
92
99
  directory: string;
93
100
  partitions: SnapshotPartition[];
101
+ /** Sessions too large for one partition, never split; read one alone with `entry_get`. */
102
+ oversized: SnapshotOversizedSession[];
94
103
  /** Capability required to clean up this generated partition directory. */
95
104
  cleanupToken: string;
96
105
  }
@@ -27,7 +27,7 @@ export const SNAPSHOT_TOOLS = [
27
27
  },
28
28
  {
29
29
  name: 'snapshot_partition',
30
- description: 'Splits a generated temporary snapshot JSONL file into bounded session-preserving read-only partitions using the cleanupToken from snapshot_export.',
30
+ description: 'Splits a generated temporary snapshot JSONL file into bounded session-preserving read-only partitions using the cleanupToken from snapshot_export. A session larger than maxBytes is never split: it is left out and listed in oversized (sessionId, entries, bytes); read it alone with entry_get.',
31
31
  inputSchema: {
32
32
  type: 'object',
33
33
  properties: {
@@ -2,7 +2,7 @@
2
2
  "mcpServers": {
3
3
  "agent-blackboard": {
4
4
  "command": "npx",
5
- "args": ["-y", "agent-blackboard@0.9.0", "mcp"],
5
+ "args": ["-y", "agent-blackboard@0.9.1", "mcp"],
6
6
  "env": {
7
7
  "AGENT_BLACKBOARD_URL": "${AGENT_BLACKBOARD_URL}",
8
8
  "AGENT_BLACKBOARD_TOKEN": "${AGENT_BLACKBOARD_TOKEN}"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-blackboard",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "A session-scoped entry stream for autonomous agents working unmonitored, for Codex.",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
@@ -2,7 +2,7 @@
2
2
  "mcpServers": {
3
3
  "agent-blackboard": {
4
4
  "command": "npx",
5
- "args": ["-y", "agent-blackboard@0.9.0", "mcp"],
5
+ "args": ["-y", "agent-blackboard@0.9.1", "mcp"],
6
6
  "env_vars": ["AGENT_BLACKBOARD_URL", "AGENT_BLACKBOARD_TOKEN", "CODEX_THREAD_ID"]
7
7
  }
8
8
  }
@@ -70,17 +70,17 @@ Without MCP, or from a shell/script, run the published CLI through `npx`. This d
70
70
  local clone of the agent-blackboard repository:
71
71
 
72
72
  ```bash
73
- npx -y agent-blackboard@0.9.0 sessions create root-123 --agent claude-code --version 1.0.13
74
- npx -y agent-blackboard@0.9.0 sessions create worker-456 --parent-session-id root-123 \
73
+ npx -y agent-blackboard@0.9.1 sessions create root-123 --agent claude-code --version 1.0.13
74
+ npx -y agent-blackboard@0.9.1 sessions create worker-456 --parent-session-id root-123 \
75
75
  --agent claude-code --version 1.0.13
76
- npx -y agent-blackboard@0.9.0 sessions patch worker-456 --data '{"branch":"fix/retry"}'
77
- npx -y agent-blackboard@0.9.0 sessions patch worker-456 --data '{"repositories":["owner/name"]}'
78
- npx -y agent-blackboard@0.9.0 append --session-id worker-456 '{"repositories":["owner/name"],"note":"found the failing edge case"}'
79
- npx -y agent-blackboard@0.9.0 get --session-id worker-456 --format markdown
80
- npx -y agent-blackboard@0.9.0 snapshot export --root-only --inactive-for-hours 8
81
- npx -y agent-blackboard@0.9.0 snapshot partition --path /tmp/agent-blackboard-snapshot-<uuid>.jsonl \
76
+ npx -y agent-blackboard@0.9.1 sessions patch worker-456 --data '{"branch":"fix/retry"}'
77
+ npx -y agent-blackboard@0.9.1 sessions patch worker-456 --data '{"repositories":["owner/name"]}'
78
+ npx -y agent-blackboard@0.9.1 append --session-id worker-456 '{"repositories":["owner/name"],"note":"found the failing edge case"}'
79
+ npx -y agent-blackboard@0.9.1 get --session-id worker-456 --format markdown
80
+ npx -y agent-blackboard@0.9.1 snapshot export --root-only --inactive-for-hours 8
81
+ npx -y agent-blackboard@0.9.1 snapshot partition --path /tmp/agent-blackboard-snapshot-<uuid>.jsonl \
82
82
  --cleanup-token <cleanup-token>
83
- npx -y agent-blackboard@0.9.0 snapshot cleanup --path /tmp/agent-blackboard-snapshot-<uuid>.jsonl \
83
+ npx -y agent-blackboard@0.9.1 snapshot cleanup --path /tmp/agent-blackboard-snapshot-<uuid>.jsonl \
84
84
  --directory /tmp/agent-blackboard-partitions-<suffix> --cleanup-token <cleanup-token>
85
85
  ```
86
86
 
@@ -59,10 +59,16 @@ Run cleanup in a `finally`-style step regardless of success, empty results, or e
59
59
  `repositories`) each followed
60
60
  by that session's entries (`createdAt`, `data`). Cite an entry by its session line's `sessionId`
61
61
  plus the entry's `createdAt`.
62
- If it fails because one session is too large for one partition, report that session's id and
63
- stop (cleanup still runs); do not raise `maxBytes` past what a small model can read.
64
- Untagged entries are dropped for a repository sweep (tags are never inferred), and an empty
65
- `partitions` list means nothing matched. Record `directory` from the response so cleanup removes
62
+ A session too large for one partition is never split or included: the response lists it in
63
+ `oversized` (`sessionId`, `entries`, `bytes`) and partitions the rest. Do not raise `maxBytes`
64
+ past what a small model can read. For each oversized session, dispatch one more small-model
65
+ reader with the oversized-session prompt in the
66
+ [output schema reference](references/output-schema.md): it reads the session once with
67
+ `entry_get`, applies the sweep's repository filter itself, and reports `read: false` if the read
68
+ fails or the session does not fit. List every oversized session in `oversizedSessions`, and
69
+ never archive one in this run.
70
+ Untagged entries are dropped for a repository sweep (tags are never inferred). Nothing matched
71
+ only when both `partitions` and `oversized` are empty. Record `directory` from the response so cleanup removes
66
72
  both the snapshot and the partition directory.
67
73
 
68
74
  3. **Read partitions with small models, then group by root cause.**
@@ -95,6 +101,7 @@ Run cleanup in a `finally`-style step regardless of success, empty results, or e
95
101
  and leave it out of `archivedSessions`. Record `archivedAt` for each archived session.
96
102
  - In a repository-scoped sweep, do **not** archive a session whose `data.repositories` lists
97
103
  other repositories that were not part of this sweep.
104
+ - Never archive an oversized session: it was read live, not from the export.
98
105
 
99
106
  6. **Always clean up snapshot artifacts.**
100
107
  Call `snapshot_cleanup` before returning, even if zero sessions matched or an earlier step
@@ -114,7 +121,7 @@ Run cleanup in a `finally`-style step regardless of success, empty results, or e
114
121
 
115
122
  When MCP is unavailable, run the identical sequence through the published CLI:
116
123
 
117
- - `npx -y agent-blackboard@0.9.0 snapshot export [filters...]`
118
- - `npx -y agent-blackboard@0.9.0 snapshot partition --path <path> --cleanup-token <token> --max-bytes <caller's maxBytes, or 262144> [--max-sessions <n>] --digest [--since <iso>] [--repository <owner/name>]`
119
- - `npx -y agent-blackboard@0.9.0 sessions get <id>` and `npx -y agent-blackboard@0.9.0 sessions archive <id>` (only when explicitly asked and `lastEntryAt` still matches the export)
120
- - `npx -y agent-blackboard@0.9.0 snapshot cleanup --path <path> [--directory <dir>] --cleanup-token <token>`
124
+ - `npx -y agent-blackboard@0.9.1 snapshot export [filters...]`
125
+ - `npx -y agent-blackboard@0.9.1 snapshot partition --path <path> --cleanup-token <token> --max-bytes <caller's maxBytes, or 262144> [--max-sessions <n>] --digest [--since <iso>] [--repository <owner/name>]`
126
+ - `npx -y agent-blackboard@0.9.1 sessions get <id>` and `npx -y agent-blackboard@0.9.1 sessions archive <id>` (only when explicitly asked and `lastEntryAt` still matches the export)
127
+ - `npx -y agent-blackboard@0.9.1 snapshot cleanup --path <path> [--directory <dir>] --cleanup-token <token>`
@@ -30,6 +30,7 @@ Return one JSON object to the caller:
30
30
  "distilledSessions": ["root-1", "root-2"],
31
31
  "archivedSessions": [{ "sessionId": "root-1", "archivedAt": "2026-01-02T00:00:00.000Z" }],
32
32
  "skippedOneOffs": 1,
33
+ "oversizedSessions": [{ "sessionId": "root-3", "bytes": 2400000, "read": true }],
33
34
  "cleanedUp": true
34
35
  }
35
36
  ```
@@ -37,6 +38,8 @@ Return one JSON object to the caller:
37
38
  - `followUps`: sorted with recurring and high-severity items first. Reject vague titles like
38
39
  "improve reliability".
39
40
  - `archivedSessions`: always `[]` unless the caller explicitly requested archival.
41
+ - `oversizedSessions`: every session `snapshot_partition` listed in `oversized`, with `read`
42
+ `false` when its reader reported `read: false`. Never archived. `[]` when there were none.
40
43
  - `cleanedUp`: `true` once `snapshot_cleanup` succeeds.
41
44
 
42
45
  ## Parallel partition inspection prompt
@@ -59,6 +62,26 @@ Use null for any missing field; never invent values.
59
62
  Do not call session_archive, snapshot_cleanup, file tickets, or edit repository files.
60
63
  ```
61
64
 
65
+ ## Oversized-session prompt
66
+
67
+ A session listed in `oversized` has no partition file. Give it its own small-model reader, once
68
+ per session, with this prompt. Fill in `<repository>` for a repository sweep, or write "none":
69
+
70
+ ```text
71
+ Call entry_get once: { "sessionId": "<id>", "format": "jsonl" }. Do not call it again or page it.
72
+ These are live entries, not a pre-filtered digest. Repository filter: <repository>. When it is
73
+ not "none", first call session_search once: { "sessionId": "<id>" }, for the session's own data.
74
+ Keep only entries tagged for that repository, case-insensitively, through data.repositories
75
+ (array) or data.repository (string) on the entry or on the session. Drop every other entry; never
76
+ infer a tag.
77
+ Cite an entry by sessionId "<id>" plus the entry's createdAt.
78
+ If the call fails, returns only part of the session, or the session is too large to read whole,
79
+ return { "read": false, "observations": [] } and nothing from partial content.
80
+ Otherwise return { "read": true, "observations": [...] } with observations shaped as in the
81
+ partition prompt. Use null for any missing field; never invent values.
82
+ Do not call session_archive, snapshot_cleanup, file tickets, or edit repository files.
83
+ ```
84
+
62
85
  The coordinating agent merges observations across partitions, deduplicates root causes, applies the
63
86
  promotion threshold, optionally archives eligible sessions when explicitly requested, and runs
64
87
  `snapshot_cleanup`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-blackboard",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Client library, CLI, and MCP server for Agent Blackboard session entries.",
5
5
  "homepage": "https://github.com/jongleberry/agent-blackboard#readme",
6
6
  "bugs": {