agent-blackboard 0.6.1 → 0.8.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.
Files changed (78) hide show
  1. package/README.md +32 -13
  2. package/dist/cli/append.mjs +16 -5
  3. package/dist/cli/args.d.mts +3 -2
  4. package/dist/cli/args.mjs +4 -3
  5. package/dist/cli/context.d.mts +2 -0
  6. package/dist/cli/env.d.mts +4 -4
  7. package/dist/cli/env.mjs +6 -6
  8. package/dist/cli/get.mjs +6 -6
  9. package/dist/cli/index.d.mts +1 -0
  10. package/dist/cli/index.mjs +10 -2
  11. package/dist/cli/revision-notice.d.mts +6 -0
  12. package/dist/cli/revision-notice.mjs +19 -0
  13. package/dist/cli/schemas-shadow.d.mts +3 -0
  14. package/dist/cli/schemas-shadow.mjs +47 -0
  15. package/dist/cli/schemas.d.mts +2 -0
  16. package/dist/cli/schemas.mjs +168 -0
  17. package/dist/cli/session-resolution.d.mts +19 -0
  18. package/dist/cli/session-resolution.mjs +63 -0
  19. package/dist/cli/sessions.mjs +23 -15
  20. package/dist/cli/snapshot.mjs +2 -1
  21. package/dist/cli/usage.d.mts +1 -1
  22. package/dist/cli/usage.mjs +18 -5
  23. package/dist/client/append.d.mts +2 -2
  24. package/dist/client/append.mjs +5 -1
  25. package/dist/client/entries.d.mts +2 -2
  26. package/dist/client/http.d.mts +2 -0
  27. package/dist/client/http.mjs +26 -8
  28. package/dist/client/schema-types.d.mts +119 -0
  29. package/dist/client/schema-types.mjs +1 -0
  30. package/dist/client/schemas-client.d.mts +21 -0
  31. package/dist/client/schemas-client.mjs +62 -0
  32. package/dist/client/schemas.d.mts +23 -0
  33. package/dist/client/schemas.mjs +68 -0
  34. package/dist/client/types.d.mts +10 -0
  35. package/dist/index.d.mts +19 -1
  36. package/dist/index.mjs +11 -0
  37. package/dist/mcp/dispatch.d.mts +2 -1
  38. package/dist/mcp/dispatch.mjs +14 -5
  39. package/dist/mcp/schema-fields.d.mts +37 -0
  40. package/dist/mcp/schema-fields.mjs +41 -0
  41. package/dist/mcp/schemas-registry-tools.d.mts +2 -0
  42. package/dist/mcp/schemas-registry-tools.mjs +63 -0
  43. package/dist/mcp/schemas.mjs +20 -41
  44. package/dist/mcp/server.d.mts +3 -2
  45. package/dist/mcp/server.mjs +5 -4
  46. package/dist/mcp/session-resolution.d.mts +23 -0
  47. package/dist/mcp/session-resolution.mjs +40 -0
  48. package/dist/mcp/tool-append.d.mts +3 -2
  49. package/dist/mcp/tool-append.mjs +11 -3
  50. package/dist/mcp/tool-get.d.mts +2 -1
  51. package/dist/mcp/tool-get.mjs +4 -3
  52. package/dist/mcp/tool-schemas.d.mts +7 -0
  53. package/dist/mcp/tool-schemas.mjs +26 -0
  54. package/dist/mcp/tool-sessions.d.mts +3 -2
  55. package/dist/mcp/tool-sessions.mjs +10 -11
  56. package/dist/plugin/.claude-mcp.json +1 -1
  57. package/dist/plugin/.codex-plugin/plugin.json +6 -6
  58. package/dist/plugin/.mcp.json +2 -2
  59. package/dist/plugin/skills/agent-blackboard/SKILL.md +23 -14
  60. package/dist/schemas/id.d.mts +8 -0
  61. package/dist/schemas/id.mjs +32 -0
  62. package/dist/schemas/local-store.d.mts +22 -0
  63. package/dist/schemas/local-store.mjs +159 -0
  64. package/dist/schemas/validate.d.mts +3 -0
  65. package/dist/schemas/validate.mjs +70 -0
  66. package/dist/session-id/harness.d.mts +44 -0
  67. package/dist/session-id/harness.mjs +61 -0
  68. package/dist/session-id/hook-payload.d.mts +19 -0
  69. package/dist/session-id/hook-payload.mjs +52 -0
  70. package/dist/session-id/persist.d.mts +53 -0
  71. package/dist/session-id/persist.mjs +127 -0
  72. package/dist/session-id/resolve.d.mts +46 -0
  73. package/dist/session-id/resolve.mjs +131 -0
  74. package/dist/session-id/root-codex-options.d.mts +9 -0
  75. package/dist/session-id/root-codex-options.mjs +13 -0
  76. package/dist/session-id/valid-id.d.mts +8 -0
  77. package/dist/session-id/valid-id.mjs +16 -0
  78. package/package.json +7 -5
@@ -1,13 +1,14 @@
1
1
  import { handleEntryAppend } from './tool-append.mjs';
2
2
  import { handleEntryGet } from './tool-get.mjs';
3
+ import { handleSchemaGet, handleSchemaList, handleSchemaPull, handleSchemaValidate, } from './tool-schemas.mjs';
3
4
  import { handleSnapshotExport } from './tool-snapshot.mjs';
4
5
  import { handleSessionArchive, handleSessionCreate, handleSessionEnsure, handleSessionPatch, handleSessionSearch, } from './tool-sessions.mjs';
5
- export function dispatchTool(name, args, config) {
6
+ export function dispatchTool(name, args, config, resolution) {
6
7
  switch (name) {
7
8
  case 'session_create':
8
- return handleSessionCreate(args, config);
9
+ return handleSessionCreate(args, config, resolution);
9
10
  case 'session_ensure':
10
- return handleSessionEnsure(args, config);
11
+ return handleSessionEnsure(args, config, resolution);
11
12
  case 'session_archive':
12
13
  return handleSessionArchive(args, config);
13
14
  case 'session_search':
@@ -15,11 +16,19 @@ export function dispatchTool(name, args, config) {
15
16
  case 'session_patch':
16
17
  return handleSessionPatch(args, config);
17
18
  case 'entry_append':
18
- return handleEntryAppend(args, config);
19
+ return handleEntryAppend(args, config, resolution);
19
20
  case 'entry_get':
20
- return handleEntryGet(args, config);
21
+ return handleEntryGet(args, config, resolution);
21
22
  case 'snapshot_export':
22
23
  return handleSnapshotExport(args, config);
24
+ case 'schema_list':
25
+ return handleSchemaList(config);
26
+ case 'schema_get':
27
+ return handleSchemaGet(args, config);
28
+ case 'schema_pull':
29
+ return handleSchemaPull(args, config, resolution);
30
+ case 'schema_validate':
31
+ return handleSchemaValidate(args, config, resolution);
23
32
  default:
24
33
  throw new Error(`Unknown tool: ${name}`);
25
34
  }
@@ -0,0 +1,37 @@
1
+ /** Shared property schemas and annotation sets for `schemas.mts`. */
2
+ export declare const SESSION_ID: {
3
+ type: 'string';
4
+ description: string;
5
+ };
6
+ export declare const RESOLVABLE_SESSION_ID: {
7
+ type: 'string';
8
+ description: string;
9
+ };
10
+ export declare const AGENT: {
11
+ type: 'string';
12
+ description: string;
13
+ };
14
+ export declare const READ_ONLY: {
15
+ readonly readOnlyHint: true;
16
+ readonly destructiveHint: false;
17
+ readonly idempotentHint: true;
18
+ readonly openWorldHint: false;
19
+ };
20
+ export declare const ADDITIVE: {
21
+ readonly readOnlyHint: false;
22
+ readonly destructiveHint: false;
23
+ readonly idempotentHint: false;
24
+ readonly openWorldHint: false;
25
+ };
26
+ export declare const IDEMPOTENT_ADDITIVE: {
27
+ readonly readOnlyHint: false;
28
+ readonly destructiveHint: false;
29
+ readonly idempotentHint: true;
30
+ readonly openWorldHint: false;
31
+ };
32
+ export declare const MUTATING: {
33
+ readonly readOnlyHint: false;
34
+ readonly destructiveHint: true;
35
+ readonly idempotentHint: true;
36
+ readonly openWorldHint: false;
37
+ };
@@ -0,0 +1,41 @@
1
+ /** Shared property schemas and annotation sets for `schemas.mts`. */
2
+ export const SESSION_ID = {
3
+ type: 'string',
4
+ description: 'Caller-supplied session id.',
5
+ };
6
+ export const RESOLVABLE_SESSION_ID = {
7
+ type: 'string',
8
+ description: 'Session id. An explicit value always wins; when omitted, it is resolved from the MCP ' +
9
+ "server's harness environment (CLAUDE_CODE_SESSION_ID, CODEX_THREAD_ID, ...) or the " +
10
+ 'per-worktree .local/<harness>-session-id file, and the call fails if none resolves.',
11
+ };
12
+ export const AGENT = {
13
+ type: 'string',
14
+ description: 'Agent name, for example claude-code. When omitted, derived from the same harness ' +
15
+ 'environment that resolves sessionId.',
16
+ };
17
+ // Keep all four hints explicit so clients do not rely on protocol defaults.
18
+ export const READ_ONLY = {
19
+ readOnlyHint: true,
20
+ destructiveHint: false,
21
+ idempotentHint: true,
22
+ openWorldHint: false,
23
+ };
24
+ export const ADDITIVE = {
25
+ readOnlyHint: false,
26
+ destructiveHint: false,
27
+ idempotentHint: false,
28
+ openWorldHint: false,
29
+ };
30
+ export const IDEMPOTENT_ADDITIVE = {
31
+ readOnlyHint: false,
32
+ destructiveHint: false,
33
+ idempotentHint: true,
34
+ openWorldHint: false,
35
+ };
36
+ export const MUTATING = {
37
+ readOnlyHint: false,
38
+ destructiveHint: true,
39
+ idempotentHint: true,
40
+ openWorldHint: false,
41
+ };
@@ -0,0 +1,2 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const SCHEMA_REGISTRY_TOOLS: Tool[];
@@ -0,0 +1,63 @@
1
+ import { MUTATING, READ_ONLY } from './schema-fields.mjs';
2
+ export const SCHEMA_REGISTRY_TOOLS = [
3
+ {
4
+ name: 'schema_list',
5
+ description: 'Lists all registered JSON Schemas and the current schema registry revision.',
6
+ inputSchema: { type: 'object', properties: {} },
7
+ annotations: READ_ONLY,
8
+ },
9
+ {
10
+ name: 'schema_get',
11
+ description: 'Fetches one registered JSON Schema by id (latest version by default, or a pinned positive integer version).',
12
+ inputSchema: {
13
+ type: 'object',
14
+ properties: {
15
+ id: { type: 'string', description: 'Registered schema id, for example "finding".' },
16
+ version: {
17
+ type: 'integer',
18
+ minimum: 1,
19
+ description: 'Optional pinned schema version number.',
20
+ },
21
+ },
22
+ required: ['id'],
23
+ },
24
+ annotations: READ_ONLY,
25
+ },
26
+ {
27
+ name: 'schema_pull',
28
+ description: 'Pulls the full JSON Schema registry into the local cache using If-None-Match so offline validation stays current.',
29
+ inputSchema: {
30
+ type: 'object',
31
+ properties: {
32
+ dir: {
33
+ type: 'string',
34
+ description: 'Optional local schema cache directory override.',
35
+ },
36
+ },
37
+ },
38
+ annotations: MUTATING,
39
+ },
40
+ {
41
+ name: 'schema_validate',
42
+ description: 'Validates an entry payload offline against a locally pulled schema (<id> or <id>@<version>).',
43
+ inputSchema: {
44
+ type: 'object',
45
+ properties: {
46
+ schema: {
47
+ type: 'string',
48
+ description: 'Schema reference (<id> or <id>@<version>), for example "finding" or "finding@1".',
49
+ },
50
+ data: {
51
+ type: 'object',
52
+ description: 'Entry JSON payload to validate.',
53
+ },
54
+ dir: {
55
+ type: 'string',
56
+ description: 'Optional local schema cache directory override.',
57
+ },
58
+ },
59
+ required: ['schema', 'data'],
60
+ },
61
+ annotations: READ_ONLY,
62
+ },
63
+ ];
@@ -1,32 +1,5 @@
1
- const SESSION_ID = {
2
- type: 'string',
3
- description: 'Caller-supplied session id. Never inferred or generated.',
4
- };
5
- // Keep all four hints explicit so clients do not rely on protocol defaults.
6
- const READ_ONLY = {
7
- readOnlyHint: true,
8
- destructiveHint: false,
9
- idempotentHint: true,
10
- openWorldHint: false,
11
- };
12
- const ADDITIVE = {
13
- readOnlyHint: false,
14
- destructiveHint: false,
15
- idempotentHint: false,
16
- openWorldHint: false,
17
- };
18
- const IDEMPOTENT_ADDITIVE = {
19
- readOnlyHint: false,
20
- destructiveHint: false,
21
- idempotentHint: true,
22
- openWorldHint: false,
23
- };
24
- const MUTATING = {
25
- readOnlyHint: false,
26
- destructiveHint: true,
27
- idempotentHint: true,
28
- openWorldHint: false,
29
- };
1
+ import { ADDITIVE, AGENT, IDEMPOTENT_ADDITIVE, MUTATING, READ_ONLY, RESOLVABLE_SESSION_ID, SESSION_ID, } from './schema-fields.mjs';
2
+ import { SCHEMA_REGISTRY_TOOLS } from './schemas-registry-tools.mjs';
30
3
  export const ENTRY_TOOLS = [
31
4
  {
32
5
  name: 'snapshot_export',
@@ -59,15 +32,15 @@ export const ENTRY_TOOLS = [
59
32
  inputSchema: {
60
33
  type: 'object',
61
34
  properties: {
62
- sessionId: SESSION_ID,
35
+ sessionId: RESOLVABLE_SESSION_ID,
63
36
  parentSessionId: {
64
37
  type: ['string', 'null'],
65
38
  description: 'Null for a root session; the direct parent session id for a subagent.',
66
39
  },
67
- agent: { type: 'string', description: 'Agent name, for example claude-code.' },
40
+ agent: AGENT,
68
41
  version: { type: 'string', description: 'Agent version, for example 1.0.13.' },
69
42
  },
70
- required: ['sessionId', 'parentSessionId', 'agent', 'version'],
43
+ required: ['parentSessionId', 'version'],
71
44
  },
72
45
  annotations: ADDITIVE,
73
46
  },
@@ -78,15 +51,15 @@ export const ENTRY_TOOLS = [
78
51
  inputSchema: {
79
52
  type: 'object',
80
53
  properties: {
81
- sessionId: SESSION_ID,
54
+ sessionId: RESOLVABLE_SESSION_ID,
82
55
  parentSessionId: {
83
56
  type: ['string', 'null'],
84
57
  description: 'Null for a root session; the direct parent session id for a subagent.',
85
58
  },
86
- agent: { type: 'string', description: 'Agent name, for example claude-code.' },
59
+ agent: AGENT,
87
60
  version: { type: 'string', description: 'Agent version, for example 1.0.13.' },
88
61
  },
89
- required: ['sessionId', 'parentSessionId', 'agent', 'version'],
62
+ required: ['parentSessionId', 'version'],
90
63
  },
91
64
  annotations: IDEMPOTENT_ADDITIVE,
92
65
  },
@@ -159,14 +132,20 @@ export const ENTRY_TOOLS = [
159
132
  },
160
133
  {
161
134
  name: 'entry_append',
162
- description: 'Appends unstructured data to an existing session, including an archived one.',
135
+ description: 'Appends an entry to an existing session, including an archived one. Optionally names a registered schemaId (and schemaVersion) for server-side validation.',
163
136
  inputSchema: {
164
137
  type: 'object',
165
138
  properties: {
166
- sessionId: SESSION_ID,
167
- data: { type: 'object', description: 'Unstructured JSON payload.' },
139
+ sessionId: RESOLVABLE_SESSION_ID,
140
+ data: { type: 'object', description: 'Entry JSON payload.' },
141
+ schemaId: { type: 'string', description: 'Optional registered JSON Schema id.' },
142
+ schemaVersion: {
143
+ type: 'integer',
144
+ minimum: 1,
145
+ description: 'Optional pinned schema version number (requires schemaId).',
146
+ },
168
147
  },
169
- required: ['sessionId', 'data'],
148
+ required: ['data'],
170
149
  },
171
150
  annotations: ADDITIVE,
172
151
  },
@@ -176,11 +155,11 @@ export const ENTRY_TOOLS = [
176
155
  inputSchema: {
177
156
  type: 'object',
178
157
  properties: {
179
- sessionId: SESSION_ID,
158
+ sessionId: RESOLVABLE_SESSION_ID,
180
159
  format: { type: 'string', enum: ['json', 'jsonl'] },
181
160
  },
182
- required: ['sessionId'],
183
161
  },
184
162
  annotations: READ_ONLY,
185
163
  },
164
+ ...SCHEMA_REGISTRY_TOOLS,
186
165
  ];
@@ -1,10 +1,11 @@
1
1
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
2
  import type { ClientConfig } from '../client/types.mjs';
3
+ import type { SessionResolutionContext } from './session-resolution.mjs';
3
4
  /**
4
5
  * Builds the MCP server with the session and entry tools registered, but does
5
6
  * not connect a transport — kept separate so tests can drive it over an
6
7
  * `InMemoryTransport` instead of real stdio.
7
8
  */
8
- export declare function createMcpServer(config: ClientConfig): Server;
9
+ export declare function createMcpServer(config: ClientConfig, resolution?: SessionResolutionContext): Server;
9
10
  /** Starts the MCP stdio server — the `agent-blackboard mcp` entrypoint. */
10
- export declare function startMcpServer(config: ClientConfig): Promise<void>;
11
+ export declare function startMcpServer(config: ClientConfig, resolution: SessionResolutionContext): Promise<void>;
@@ -4,18 +4,19 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprot
4
4
  import { formatError } from '../format-error.mjs';
5
5
  import { dispatchTool } from './dispatch.mjs';
6
6
  import { ENTRY_TOOLS } from './schemas.mjs';
7
+ import { withClientHarnessMarker } from './session-resolution.mjs';
7
8
  const SERVER_INFO = { name: 'agent-blackboard', version: '0.0.0' };
8
9
  /**
9
10
  * Builds the MCP server with the session and entry tools registered, but does
10
11
  * not connect a transport — kept separate so tests can drive it over an
11
12
  * `InMemoryTransport` instead of real stdio.
12
13
  */
13
- export function createMcpServer(config) {
14
+ export function createMcpServer(config, resolution) {
14
15
  const server = new Server(SERVER_INFO, { capabilities: { tools: {} } });
15
16
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: ENTRY_TOOLS }));
16
17
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
17
18
  try {
18
- const result = await dispatchTool(request.params.name, request.params.arguments ?? {}, config);
19
+ const result = await dispatchTool(request.params.name, request.params.arguments ?? {}, config, withClientHarnessMarker(resolution, server.getClientVersion()?.name));
19
20
  return { content: [{ type: 'text', text: JSON.stringify(result) }] };
20
21
  }
21
22
  catch (err) {
@@ -28,8 +29,8 @@ export function createMcpServer(config) {
28
29
  stdin/stdout, which vitest can't drive. `createMcpServer` above (the tested logic) is exercised
29
30
  directly via InMemoryTransport in server.test.mts. */
30
31
  /** Starts the MCP stdio server — the `agent-blackboard mcp` entrypoint. */
31
- export async function startMcpServer(config) {
32
- const server = createMcpServer(config);
32
+ export async function startMcpServer(config, resolution) {
33
+ const server = createMcpServer(config, resolution);
33
34
  await server.connect(new StdioServerTransport());
34
35
  }
35
36
  /* v8 ignore stop */
@@ -0,0 +1,23 @@
1
+ /** The MCP server process's own environment and cwd, used when a tool call omits `sessionId`. */
2
+ export interface SessionResolutionContext {
3
+ env: Readonly<Record<string, string | undefined>>;
4
+ cwd: string;
5
+ }
6
+ /**
7
+ * A Cursor-launched MCP server usually gets only the URL and token from `mcp.json`, not
8
+ * `CURSOR_AGENT`. When the MCP client identifies itself as Cursor, mark the resolution env as
9
+ * Cursor so an omitted `sessionId` can fall back to the persisted Cursor id. Only the marker is
10
+ * set, never a runtime hint, so explicit harness env still takes precedence as usual.
11
+ */
12
+ export declare function withClientHarnessMarker(resolution: SessionResolutionContext | undefined, clientName: string | undefined): SessionResolutionContext | undefined;
13
+ /**
14
+ * An explicit `sessionId` wins and is passed through (the server validates it). When omitted and
15
+ * a resolution context is available, the id is resolved from the harness environment or the
16
+ * per-worktree persisted file; otherwise `sessionId` is required.
17
+ */
18
+ export declare function toolSessionId(args: Record<string, unknown>, resolution: SessionResolutionContext | undefined): string;
19
+ /** `sessionId` and `agent` for `session_create`/`session_ensure`, resolved as a pair. */
20
+ export declare function toolSessionIdentity(args: Record<string, unknown>, resolution: SessionResolutionContext | undefined): {
21
+ sessionId: string;
22
+ agent: string;
23
+ };
@@ -0,0 +1,40 @@
1
+ import { requireSessionAgent, requireSessionId, requireSessionIdentity, } from '../session-id/resolve.mjs';
2
+ import { requiredString } from './validate.mjs';
3
+ /**
4
+ * A Cursor-launched MCP server usually gets only the URL and token from `mcp.json`, not
5
+ * `CURSOR_AGENT`. When the MCP client identifies itself as Cursor, mark the resolution env as
6
+ * Cursor so an omitted `sessionId` can fall back to the persisted Cursor id. Only the marker is
7
+ * set, never a runtime hint, so explicit harness env still takes precedence as usual.
8
+ */
9
+ export function withClientHarnessMarker(resolution, clientName) {
10
+ if (resolution === undefined || resolution.env.CURSOR_AGENT)
11
+ return resolution;
12
+ if (!clientName?.toLowerCase().includes('cursor'))
13
+ return resolution;
14
+ return { ...resolution, env: { ...resolution.env, CURSOR_AGENT: '1' } };
15
+ }
16
+ /**
17
+ * An explicit `sessionId` wins and is passed through (the server validates it). When omitted and
18
+ * a resolution context is available, the id is resolved from the harness environment or the
19
+ * per-worktree persisted file; otherwise `sessionId` is required.
20
+ */
21
+ export function toolSessionId(args, resolution) {
22
+ if (args.sessionId !== undefined || resolution === undefined)
23
+ return requiredString(args.sessionId, 'sessionId');
24
+ return requireSessionId(resolution);
25
+ }
26
+ /** `sessionId` and `agent` for `session_create`/`session_ensure`, resolved as a pair. */
27
+ export function toolSessionIdentity(args, resolution) {
28
+ const sessionIdArg = args.sessionId === undefined ? undefined : requiredString(args.sessionId, 'sessionId');
29
+ const agentArg = args.agent === undefined ? undefined : requiredString(args.agent, 'agent');
30
+ if (resolution === undefined || (sessionIdArg !== undefined && agentArg !== undefined)) {
31
+ return {
32
+ sessionId: requiredString(sessionIdArg, 'sessionId'),
33
+ agent: requiredString(agentArg, 'agent'),
34
+ };
35
+ }
36
+ const options = { ...resolution, agentArg };
37
+ if (sessionIdArg === undefined)
38
+ return requireSessionIdentity(options);
39
+ return { sessionId: sessionIdArg, agent: requireSessionAgent({ ...options, sessionIdArg }) };
40
+ }
@@ -1,2 +1,3 @@
1
- import type { ClientConfig, SessionEntry } from '../client/types.mjs';
2
- export declare function handleEntryAppend(args: Record<string, unknown>, config: ClientConfig): Promise<SessionEntry>;
1
+ import { type SessionResolutionContext } from './session-resolution.mjs';
2
+ import type { AppendEntryResult, ClientConfig } from '../client/types.mjs';
3
+ export declare function handleEntryAppend(args: Record<string, unknown>, config: ClientConfig, resolution?: SessionResolutionContext): Promise<AppendEntryResult>;
@@ -1,8 +1,16 @@
1
1
  import { appendEntry } from '../client/append.mjs';
2
- import { expectObject, requiredString } from './validate.mjs';
3
- export function handleEntryAppend(args, config) {
2
+ import { toolSessionId } from './session-resolution.mjs';
3
+ import { expectObject, optionalPositiveInt, requiredString } from './validate.mjs';
4
+ export function handleEntryAppend(args, config, resolution) {
5
+ const schemaId = args.schemaId === undefined ? undefined : requiredString(args.schemaId, 'schemaId');
6
+ const schemaVersion = optionalPositiveInt(args.schemaVersion, 'schemaVersion');
7
+ if (schemaVersion !== undefined && schemaId === undefined) {
8
+ throw new Error('"schemaVersion" requires "schemaId".');
9
+ }
4
10
  return appendEntry(config, {
5
- sessionId: requiredString(args.sessionId, 'sessionId'),
11
+ sessionId: toolSessionId(args, resolution),
6
12
  data: expectObject(args.data, 'data'),
13
+ ...(schemaId !== undefined ? { schemaId } : {}),
14
+ ...(schemaVersion !== undefined ? { schemaVersion } : {}),
7
15
  });
8
16
  }
@@ -1,4 +1,5 @@
1
+ import { type SessionResolutionContext } from './session-resolution.mjs';
1
2
  import type { ClientConfig, SessionEntry } from '../client/types.mjs';
2
- export declare function handleEntryGet(args: Record<string, unknown>, config: ClientConfig): Promise<{
3
+ export declare function handleEntryGet(args: Record<string, unknown>, config: ClientConfig, resolution?: SessionResolutionContext): Promise<{
3
4
  entries: SessionEntry[];
4
5
  }>;
@@ -1,10 +1,11 @@
1
1
  import { streamEntries } from '../client/stream.mjs';
2
- import { optionalEntryFormat, requiredString } from './validate.mjs';
3
- export async function handleEntryGet(args, config) {
2
+ import { toolSessionId } from './session-resolution.mjs';
3
+ import { optionalEntryFormat } from './validate.mjs';
4
+ export async function handleEntryGet(args, config, resolution) {
4
5
  const entries = [];
5
6
  const format = optionalEntryFormat(args.format);
6
7
  const query = {
7
- sessionId: requiredString(args.sessionId, 'sessionId'),
8
+ sessionId: toolSessionId(args, resolution),
8
9
  ...(format === undefined ? {} : { format }),
9
10
  };
10
11
  for await (const entry of streamEntries(config, query)) {
@@ -0,0 +1,7 @@
1
+ import type { ListSchemasResult, PullSchemasResult, SchemaValidationResult, SchemaVersionDetail } from '../client/schema-types.mjs';
2
+ import type { ClientConfig } from '../client/types.mjs';
3
+ import type { SessionResolutionContext } from './session-resolution.mjs';
4
+ export declare function handleSchemaList(config: ClientConfig): Promise<ListSchemasResult>;
5
+ export declare function handleSchemaGet(args: Record<string, unknown>, config: ClientConfig): Promise<SchemaVersionDetail>;
6
+ export declare function handleSchemaPull(args: Record<string, unknown>, config: ClientConfig, resolution?: SessionResolutionContext): Promise<PullSchemasResult>;
7
+ export declare function handleSchemaValidate(args: Record<string, unknown>, config: ClientConfig, resolution?: SessionResolutionContext): Promise<SchemaValidationResult>;
@@ -0,0 +1,26 @@
1
+ import { Schemas } from '../client/schemas.mjs';
2
+ import { expectObject, optionalPositiveInt, requiredString } from './validate.mjs';
3
+ function localOptions(args, resolution) {
4
+ const dir = args.dir === undefined ? undefined : requiredString(args.dir, 'dir');
5
+ return {
6
+ ...(dir !== undefined ? { dir } : {}),
7
+ ...(resolution?.cwd !== undefined ? { cwd: resolution.cwd } : {}),
8
+ ...(resolution?.env !== undefined ? { env: resolution.env } : {}),
9
+ };
10
+ }
11
+ export function handleSchemaList(config) {
12
+ return new Schemas(config).list();
13
+ }
14
+ export function handleSchemaGet(args, config) {
15
+ const id = requiredString(args.id, 'id');
16
+ const version = optionalPositiveInt(args.version, 'version');
17
+ return new Schemas(config).get(id, version);
18
+ }
19
+ export function handleSchemaPull(args, config, resolution) {
20
+ return new Schemas(config).pull(localOptions(args, resolution));
21
+ }
22
+ export async function handleSchemaValidate(args, config, resolution) {
23
+ const schema = requiredString(args.schema, 'schema');
24
+ const data = expectObject(args.data, 'data');
25
+ return new Schemas(config).validateLocal(schema, data, localOptions(args, resolution));
26
+ }
@@ -1,10 +1,11 @@
1
1
  import type { ClientConfig, Session } from '../client/types.mjs';
2
2
  import type { EnsureSessionResult } from '../client/sessions.mjs';
3
+ import { type SessionResolutionContext } from './session-resolution.mjs';
3
4
  export declare function handleSessionSearch(args: Record<string, unknown>, config: ClientConfig, now?: Date): Promise<{
4
5
  sessions: Session[];
5
6
  nextCursor: string | null;
6
7
  }>;
7
- export declare function handleSessionCreate(args: Record<string, unknown>, config: ClientConfig): Promise<Session>;
8
- export declare function handleSessionEnsure(args: Record<string, unknown>, config: ClientConfig): Promise<EnsureSessionResult>;
8
+ export declare function handleSessionCreate(args: Record<string, unknown>, config: ClientConfig, resolution?: SessionResolutionContext): Promise<Session>;
9
+ export declare function handleSessionEnsure(args: Record<string, unknown>, config: ClientConfig, resolution?: SessionResolutionContext): Promise<EnsureSessionResult>;
9
10
  export declare function handleSessionPatch(args: Record<string, unknown>, config: ClientConfig): Promise<Session>;
10
11
  export declare function handleSessionArchive(args: Record<string, unknown>, config: ClientConfig): Promise<Session>;
@@ -2,6 +2,7 @@ import { isDeepStrictEqual } from 'node:util';
2
2
  import { AgentBlackboardError } from '../client/errors.mjs';
3
3
  import { Sessions } from '../client/sessions.mjs';
4
4
  import { expectObject, nullableString, optionalPositiveInt, optionalPositiveNumber, requiredString, } from './validate.mjs';
5
+ import { toolSessionIdentity } from './session-resolution.mjs';
5
6
  function parseSessionSearchArgs(args) {
6
7
  if (args.archived !== undefined && args.archived !== 0 && args.archived !== 1) {
7
8
  throw new Error('"archived" must be 0 or 1.');
@@ -110,19 +111,17 @@ export async function handleSessionSearch(args, config, now = new Date()) {
110
111
  return new Sessions(config).list(query);
111
112
  }
112
113
  /** Shared by `session_create` and `session_ensure`, which take identical args. */
113
- function parseCreateSessionArgs(args) {
114
- return {
115
- id: requiredString(args.sessionId, 'sessionId'),
116
- parentSessionId: nullableString(args.parentSessionId, 'parentSessionId'),
117
- agent: requiredString(args.agent, 'agent'),
118
- version: requiredString(args.version, 'version'),
119
- };
114
+ function parseCreateSessionArgs(args, resolution) {
115
+ const parentSessionId = nullableString(args.parentSessionId, 'parentSessionId');
116
+ const version = requiredString(args.version, 'version');
117
+ const { sessionId, agent } = toolSessionIdentity(args, resolution);
118
+ return { id: sessionId, parentSessionId, agent, version };
120
119
  }
121
- export function handleSessionCreate(args, config) {
122
- return new Sessions(config).create(parseCreateSessionArgs(args));
120
+ export function handleSessionCreate(args, config, resolution) {
121
+ return new Sessions(config).create(parseCreateSessionArgs(args, resolution));
123
122
  }
124
- export function handleSessionEnsure(args, config) {
125
- return new Sessions(config).ensure(parseCreateSessionArgs(args));
123
+ export function handleSessionEnsure(args, config, resolution) {
124
+ return new Sessions(config).ensure(parseCreateSessionArgs(args, resolution));
126
125
  }
127
126
  export function handleSessionPatch(args, config) {
128
127
  const data = expectObject(args.data, 'data');
@@ -2,7 +2,7 @@
2
2
  "mcpServers": {
3
3
  "agent-blackboard": {
4
4
  "command": "npx",
5
- "args": ["-y", "agent-blackboard@0.6.1", "mcp"],
5
+ "args": ["-y", "agent-blackboard@0.8.0", "mcp"],
6
6
  "env": {
7
7
  "AGENT_BLACKBOARD_URL": "${AGENT_BLACKBOARD_URL}",
8
8
  "AGENT_BLACKBOARD_TOKEN": "${AGENT_BLACKBOARD_TOKEN}"
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "agent-blackboard",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
4
4
  "description": "A session-scoped entry stream for autonomous agents working unmonitored, for Codex.",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
7
7
  "email": "jonathanrichardong@gmail.com",
8
8
  "url": "https://github.com/jonathanong"
9
9
  },
10
- "homepage": "https://github.com/jonathanong/agent-blackboard",
11
- "repository": "https://github.com/jonathanong/agent-blackboard",
10
+ "homepage": "https://github.com/jongleberry/agent-blackboard",
11
+ "repository": "https://github.com/jongleberry/agent-blackboard",
12
12
  "license": "MIT",
13
13
  "keywords": ["entries", "agent", "mcp", "retrospective", "codex"],
14
14
  "skills": "./skills/",
@@ -20,9 +20,9 @@
20
20
  "developerName": "Jonathan Ong",
21
21
  "category": "Coding",
22
22
  "capabilities": ["Interactive", "Write"],
23
- "websiteURL": "https://github.com/jonathanong/agent-blackboard",
24
- "privacyPolicyURL": "https://github.com/jonathanong/agent-blackboard",
25
- "termsOfServiceURL": "https://github.com/jonathanong/agent-blackboard",
23
+ "websiteURL": "https://github.com/jongleberry/agent-blackboard",
24
+ "privacyPolicyURL": "https://github.com/jongleberry/agent-blackboard",
25
+ "termsOfServiceURL": "https://github.com/jongleberry/agent-blackboard",
26
26
  "defaultPrompt": [
27
27
  "Record a note about what I just did",
28
28
  "Get my entries for this session",
@@ -2,8 +2,8 @@
2
2
  "mcpServers": {
3
3
  "agent-blackboard": {
4
4
  "command": "npx",
5
- "args": ["-y", "agent-blackboard@0.6.1", "mcp"],
6
- "env_vars": ["AGENT_BLACKBOARD_URL", "AGENT_BLACKBOARD_TOKEN"]
5
+ "args": ["-y", "agent-blackboard@0.8.0", "mcp"],
6
+ "env_vars": ["AGENT_BLACKBOARD_URL", "AGENT_BLACKBOARD_TOKEN", "CODEX_THREAD_ID"]
7
7
  }
8
8
  }
9
9
  }