vouchington-tooling 1.2.0 → 1.2.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/mcp-server/fake-blackboard.test-helpers.d.mts +2 -0
- package/dist/mcp-server/fake-blackboard.test-helpers.mjs +2 -0
- package/dist/mcp-server/handlers-session.mjs +22 -5
- package/dist/mcp-server/run.d.mts +1 -1
- package/dist/mcp-server/run.mjs +13 -3
- package/dist/mcp-server/tools.mjs +2 -2
- package/package.json +1 -1
- package/scripts/__pycache__/run_bounded_process.cpython-314.pyc +0 -0
|
@@ -24,6 +24,8 @@ export type FakeOptions = {
|
|
|
24
24
|
agent: string;
|
|
25
25
|
version: string;
|
|
26
26
|
};
|
|
27
|
+
/** Makes every `ensure` reject with this error. */
|
|
28
|
+
ensureError?: unknown;
|
|
27
29
|
entries?: StoredEntry[];
|
|
28
30
|
entriesError?: unknown;
|
|
29
31
|
/** Fails the read of just these sessions, keyed by session id. */
|
|
@@ -26,6 +26,8 @@ export function fakeBlackboard(options = {}) {
|
|
|
26
26
|
calls.ensure.push(input);
|
|
27
27
|
if (typeof input.id !== 'string')
|
|
28
28
|
throw new Error('ensure requires id');
|
|
29
|
+
if (options.ensureError !== undefined)
|
|
30
|
+
throw options.ensureError;
|
|
29
31
|
if (options.conflictingSession &&
|
|
30
32
|
(options.conflictingSession.parentSessionId !== input.parentSessionId ||
|
|
31
33
|
options.conflictingSession.agent !== input.agent ||
|
|
@@ -24,11 +24,28 @@ function readSelection(args) {
|
|
|
24
24
|
...(inactiveForHours === undefined ? {} : { inactiveForHours }),
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
/** The blackboard client is loaded dynamically, so its error class is matched by shape. */
|
|
28
|
+
function isParentNotFound(error) {
|
|
29
|
+
if (!isObject(error) || error.status !== 404 || !isObject(error.body))
|
|
30
|
+
return false;
|
|
31
|
+
return error.body.code === 'parent_not_found';
|
|
32
|
+
}
|
|
33
|
+
export const sessionEnsure = async (args, context) => {
|
|
34
|
+
const identity = readIdentity(args, context.sessionId);
|
|
35
|
+
try {
|
|
36
|
+
return await ensureBlackboardSession({
|
|
37
|
+
...identity,
|
|
38
|
+
env: context.env,
|
|
39
|
+
dependencies: context.dependencies,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (identity.parentSessionId !== null && isParentNotFound(error))
|
|
44
|
+
throw new Error(`parent session ${identity.parentSessionId} does not exist on the blackboard; ` +
|
|
45
|
+
'ensure the parent session first (session_ensure with its own id) and retry', { cause: error });
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
32
49
|
export const sessionArchive = async (_args, context) => archiveBlackboardSession({
|
|
33
50
|
sessionId: context.sessionId,
|
|
34
51
|
env: context.env,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type BlackboardClientDependencies } from '../agent-blackboard/client.mts';
|
|
3
3
|
import type { RunTextCommand } from '../gh-cli/exec.mts';
|
|
4
4
|
import { type SdkImporter } from './sdk.mts';
|
|
5
5
|
export type RunMcpServerOptions = {
|
package/dist/mcp-server/run.mjs
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import { loadClient } from "../agent-blackboard/client.mjs";
|
|
1
2
|
import { assertBlackboardInstalled, loadMcpSdk } from "./sdk.mjs";
|
|
2
3
|
import { captureInstall } from "./install-info.mjs";
|
|
3
4
|
import { createMcpServer } from "./server.mjs";
|
|
4
5
|
import { launchWorktreeRoot, runIsolatedGit } from "./worktree.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Imports the agent-blackboard client once, at startup, and hands every tool call that module.
|
|
8
|
+
* Re-importing per call would break a running server whose install directory was evicted.
|
|
9
|
+
*/
|
|
10
|
+
async function importBlackboard(resolveFrom) {
|
|
11
|
+
assertBlackboardInstalled(resolveFrom);
|
|
12
|
+
// Resolve from this package's install, never the worktree, matching tool dispatch.
|
|
13
|
+
const client = await loadClient({ resolveFrom: resolveFrom ?? import.meta.url });
|
|
14
|
+
return { loadClient: () => Promise.resolve(client) };
|
|
15
|
+
}
|
|
5
16
|
/**
|
|
6
17
|
* Starts the server and resolves once it is connected. Nothing on this path may write to stdout:
|
|
7
18
|
* stdout is the protocol channel, so diagnostics go to stderr.
|
|
@@ -9,8 +20,7 @@ import { launchWorktreeRoot, runIsolatedGit } from "./worktree.mjs";
|
|
|
9
20
|
export async function runMcpServer(options) {
|
|
10
21
|
const runGit = options.runGit ?? runIsolatedGit;
|
|
11
22
|
const sdk = await loadMcpSdk(options.importSdk);
|
|
12
|
-
|
|
13
|
-
assertBlackboardInstalled(options.resolveFrom);
|
|
23
|
+
const blackboard = options.blackboard ?? (await importBlackboard(options.resolveFrom));
|
|
14
24
|
const launchRoot = await launchWorktreeRoot(options.cwd, runGit);
|
|
15
25
|
const environment = {
|
|
16
26
|
launchRoot,
|
|
@@ -18,7 +28,7 @@ export async function runMcpServer(options) {
|
|
|
18
28
|
runGit,
|
|
19
29
|
install: captureInstall(options.version),
|
|
20
30
|
...(options.resolveFrom === undefined ? {} : { resolveFrom: options.resolveFrom }),
|
|
21
|
-
|
|
31
|
+
blackboard,
|
|
22
32
|
};
|
|
23
33
|
const server = createMcpServer(sdk, environment, options.version);
|
|
24
34
|
/* v8 ignore next -- the stdio default is exercised by the spawned-process test */
|
|
@@ -44,8 +44,8 @@ export const TOOLS = [
|
|
|
44
44
|
'records of the caller sessionId; worktreePendingCount covers every session. ' +
|
|
45
45
|
'A record with a permanent rejection moves to the rejected area and is listed in rejected ' +
|
|
46
46
|
'as sourceEventId and diagnostic.', IDEMPOTENT_ADDITIVE),
|
|
47
|
-
tool('session_ensure', 'Idempotently creates a session, or verifies
|
|
48
|
-
|
|
47
|
+
tool('session_ensure', 'Idempotently creates a session, or verifies an existing one has the same identity. Child or ' +
|
|
48
|
+
"worker sessions must pass their orchestrator's session id as parentSessionId.", IDEMPOTENT_ADDITIVE, IDENTITY, IDENTITY_REQUIRED),
|
|
49
49
|
...RETROSPECTIVE_TOOLS,
|
|
50
50
|
...PR_TOOLS,
|
|
51
51
|
tool('snapshot_export', 'Exports non-archived sessions into a private local JSONL file chosen by the blackboard ' +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vouchington-tooling",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Vouchington CLI and extractable tooling libraries.",
|
|
5
5
|
"homepage": "https://github.com/vouchington/vouchington-tooling/tree/main/packages/vouchington-tooling#readme",
|
|
6
6
|
"bugs": {
|
|
Binary file
|