@zvada/agent-server 0.3.27 → 0.3.30
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/CHANGELOG.md +61 -0
- package/README.md +6 -4
- package/dist/core/agents/acp/account.js +111 -0
- package/dist/core/agents/acp/acp-agent.js +249 -158
- package/dist/core/agents/acp/adapter.js +103 -34
- package/dist/core/agents/acp/client.js +169 -42
- package/dist/core/agents/acp/known-agents.js +12 -5
- package/dist/core/agents/acp/mappings.js +84 -20
- package/dist/core/agents/acp/models.js +59 -0
- package/dist/core/agents/acp/profile.js +36 -0
- package/dist/core/agents/acp/prompts.js +248 -0
- package/dist/core/agents/acp/requests.js +4 -4
- package/dist/core/agents/claude-code/claude-agent.js +2 -12
- package/dist/core/agents/claude-code/login.js +4 -1
- package/dist/core/agents/claude-code/session.js +50 -18
- package/dist/core/agents/claude-code/spawn.js +0 -26
- package/dist/core/agents/claude-code/turn.js +6 -2
- package/dist/core/agents/codex-app-server/client.js +12 -13
- package/dist/core/agents/codex-app-server/login.js +4 -1
- package/dist/core/agents/gemini/failures.js +133 -0
- package/dist/core/agents/gemini/login.js +173 -0
- package/dist/core/agents/gemini/profile.js +138 -0
- package/dist/core/agents/gemini/tools.js +91 -0
- package/dist/core/agents/login.js +8 -6
- package/dist/core/agents/stderr-tail.js +5 -2
- package/dist/core/presets.js +13 -0
- package/dist/core/processes/native-processes.js +23 -1
- package/dist/core/provision/install-build.js +70 -26
- package/dist/core/provision/pins.js +5 -0
- package/dist/core/provision/provisioner.js +39 -16
- package/dist/core/provision/releases.js +39 -1
- package/dist/core/provision/tools.js +87 -28
- package/dist/operator/errors.js +2 -2
- package/dist/operator/operator.js +201 -90
- package/dist/operator/render.js +34 -28
- package/dist/operator/session-tools.js +2 -1
- package/dist/protocol/account.js +5 -1
- package/dist/protocol/auth.js +5 -1
- package/dist/protocol/config.js +4 -2
- package/dist/protocol/credentials.js +9 -1
- package/dist/protocol/harness.js +9 -1
- package/dist/protocol/part-input.js +2 -6
- package/dist/protocol/text-parts.js +10 -0
- package/dist/server/bin.js +22 -7
- package/dist/server/install.js +6 -4
- package/dist/types/core/agents/acp/account.d.ts +55 -0
- package/dist/types/core/agents/acp/account.d.ts.map +1 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts +65 -36
- package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
- package/dist/types/core/agents/acp/adapter.d.ts +28 -3
- package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
- package/dist/types/core/agents/acp/client.d.ts +66 -4
- package/dist/types/core/agents/acp/client.d.ts.map +1 -1
- package/dist/types/core/agents/acp/known-agents.d.ts +4 -2
- package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -1
- package/dist/types/core/agents/acp/mappings.d.ts +53 -7
- package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
- package/dist/types/core/agents/acp/models.d.ts +22 -0
- package/dist/types/core/agents/acp/models.d.ts.map +1 -0
- package/dist/types/core/agents/acp/profile.d.ts +97 -0
- package/dist/types/core/agents/acp/profile.d.ts.map +1 -0
- package/dist/types/core/agents/acp/prompts.d.ts +108 -0
- package/dist/types/core/agents/acp/prompts.d.ts.map +1 -0
- package/dist/types/core/agents/acp/requests.d.ts +7 -1
- package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/claude-agent.d.ts +1 -2
- package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/options.d.ts +1 -1
- package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/session.d.ts +7 -6
- package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/spawn.d.ts +0 -8
- package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/turn.d.ts +3 -2
- package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
- package/dist/types/core/agents/gemini/failures.d.ts +25 -0
- package/dist/types/core/agents/gemini/failures.d.ts.map +1 -0
- package/dist/types/core/agents/gemini/login.d.ts +28 -0
- package/dist/types/core/agents/gemini/login.d.ts.map +1 -0
- package/dist/types/core/agents/gemini/profile.d.ts +30 -0
- package/dist/types/core/agents/gemini/profile.d.ts.map +1 -0
- package/dist/types/core/agents/gemini/tools.d.ts +18 -0
- package/dist/types/core/agents/gemini/tools.d.ts.map +1 -0
- package/dist/types/core/agents/login.d.ts +15 -5
- package/dist/types/core/agents/login.d.ts.map +1 -1
- package/dist/types/core/agents/stderr-tail.d.ts +1 -1
- package/dist/types/core/agents/stderr-tail.d.ts.map +1 -1
- package/dist/types/core/presets.d.ts +2 -2
- package/dist/types/core/presets.d.ts.map +1 -1
- package/dist/types/core/processes/native-processes.d.ts +6 -0
- package/dist/types/core/processes/native-processes.d.ts.map +1 -1
- package/dist/types/core/provision/checksums.d.ts +7 -1
- package/dist/types/core/provision/checksums.d.ts.map +1 -1
- package/dist/types/core/provision/install-build.d.ts +32 -6
- package/dist/types/core/provision/install-build.d.ts.map +1 -1
- package/dist/types/core/provision/pins.d.ts +4 -0
- package/dist/types/core/provision/pins.d.ts.map +1 -1
- package/dist/types/core/provision/provisioner.d.ts +18 -7
- package/dist/types/core/provision/provisioner.d.ts.map +1 -1
- package/dist/types/core/provision/releases.d.ts +2 -1
- package/dist/types/core/provision/releases.d.ts.map +1 -1
- package/dist/types/core/provision/tools.d.ts +36 -7
- package/dist/types/core/provision/tools.d.ts.map +1 -1
- package/dist/types/operator/errors.d.ts +5 -1
- package/dist/types/operator/errors.d.ts.map +1 -1
- package/dist/types/operator/operator.d.ts.map +1 -1
- package/dist/types/operator/render.d.ts +11 -6
- package/dist/types/operator/render.d.ts.map +1 -1
- package/dist/types/operator/session-tools.d.ts.map +1 -1
- package/dist/types/operator/types.d.ts +5 -4
- package/dist/types/operator/types.d.ts.map +1 -1
- package/dist/types/protocol/account.d.ts +4 -2
- package/dist/types/protocol/account.d.ts.map +1 -1
- package/dist/types/protocol/auth.d.ts +10 -7
- package/dist/types/protocol/auth.d.ts.map +1 -1
- package/dist/types/protocol/clis.d.ts +4 -3
- package/dist/types/protocol/clis.d.ts.map +1 -1
- package/dist/types/protocol/config.d.ts +6 -2
- package/dist/types/protocol/config.d.ts.map +1 -1
- package/dist/types/protocol/conversation.d.ts +3 -3
- package/dist/types/protocol/credentials.d.ts +8 -0
- package/dist/types/protocol/credentials.d.ts.map +1 -1
- package/dist/types/protocol/execution.d.ts +1 -1
- package/dist/types/protocol/harness.d.ts +5 -2
- package/dist/types/protocol/harness.d.ts.map +1 -1
- package/dist/types/protocol/lifecycle.d.ts +8 -8
- package/dist/types/protocol/models.d.ts +3 -0
- package/dist/types/protocol/models.d.ts.map +1 -1
- package/dist/types/protocol/part-input.d.ts.map +1 -1
- package/dist/types/protocol/text-parts.d.ts +10 -0
- package/dist/types/protocol/text-parts.d.ts.map +1 -0
- package/dist/types/protocol/wire-api.d.ts +39 -29
- package/dist/types/protocol/wire-api.d.ts.map +1 -1
- package/dist/types/protocol/wire.d.ts +13 -10
- package/dist/types/protocol/wire.d.ts.map +1 -1
- package/dist/types/server/install.d.ts +2 -1
- package/dist/types/server/install.d.ts.map +1 -1
- package/docs/consuming.md +8 -1
- package/docs/deploy.md +17 -8
- package/docs/harnesses.md +173 -44
- package/package.json +1 -1
- package/src/core/agents/acp/account.ts +158 -0
- package/src/core/agents/acp/acp-agent.ts +290 -178
- package/src/core/agents/acp/adapter.ts +126 -35
- package/src/core/agents/acp/client.ts +196 -49
- package/src/core/agents/acp/known-agents.ts +14 -5
- package/src/core/agents/acp/mappings.ts +112 -21
- package/src/core/agents/acp/models.ts +72 -0
- package/src/core/agents/acp/profile.ts +133 -0
- package/src/core/agents/acp/prompts.ts +287 -0
- package/src/core/agents/acp/requests.ts +16 -9
- package/src/core/agents/claude-code/claude-agent.ts +2 -13
- package/src/core/agents/claude-code/login.ts +4 -1
- package/src/core/agents/claude-code/options.ts +1 -1
- package/src/core/agents/claude-code/session.ts +50 -16
- package/src/core/agents/claude-code/spawn.ts +0 -26
- package/src/core/agents/claude-code/turn.ts +7 -2
- package/src/core/agents/codex-app-server/client.ts +11 -18
- package/src/core/agents/codex-app-server/login.ts +4 -5
- package/src/core/agents/gemini/failures.ts +148 -0
- package/src/core/agents/gemini/login.ts +188 -0
- package/src/core/agents/gemini/profile.ts +163 -0
- package/src/core/agents/gemini/tools.ts +99 -0
- package/src/core/agents/login.ts +14 -8
- package/src/core/agents/stderr-tail.ts +5 -2
- package/src/core/presets.ts +15 -2
- package/src/core/processes/native-processes.ts +32 -1
- package/src/core/provision/checksums.ts +12 -2
- package/src/core/provision/install-build.ts +122 -55
- package/src/core/provision/pins.ts +5 -0
- package/src/core/provision/provisioner.ts +62 -27
- package/src/core/provision/releases.ts +47 -1
- package/src/core/provision/tools.ts +124 -31
- package/src/operator/errors.ts +5 -2
- package/src/operator/operator.ts +208 -91
- package/src/operator/render.ts +61 -33
- package/src/operator/session-tools.ts +2 -1
- package/src/operator/types.ts +5 -4
- package/src/protocol/account.ts +5 -2
- package/src/protocol/auth.ts +5 -1
- package/src/protocol/config.ts +4 -2
- package/src/protocol/credentials.ts +11 -2
- package/src/protocol/harness.ts +9 -1
- package/src/protocol/part-input.ts +2 -5
- package/src/protocol/text-parts.ts +10 -0
- package/src/server/bin.ts +20 -6
- package/src/server/install.ts +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,67 @@ and the measurements. Evidence lives in the LLP, not here. A release groups
|
|
|
7
7
|
its bullets under Breaking, Added, Changed and Fixed, breaking first. The
|
|
8
8
|
released sections below that predate this convention are kept as written.
|
|
9
9
|
|
|
10
|
+
## 0.3.30
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Dismissing a Claude tool or plan approval ends the turn `cancelled`. Steers Claude has not
|
|
15
|
+
read are returned in `turn.ended.undeliveredSteers` and never run later. Dismissing a question
|
|
16
|
+
still lets the turn continue (LLP 0001, D4 and D13).
|
|
17
|
+
- Operator `onError` receives unexpected write errors, including failed send attempts and
|
|
18
|
+
writes that reject after the call has answered. A write whose outcome is unknown still
|
|
19
|
+
answers `not confirmed` (LLP 0019, Errors).
|
|
20
|
+
- When workspace setup fails before its first task, `start_session` reports the host's
|
|
21
|
+
reason in its own answer (LLP 0019, One call, one message).
|
|
22
|
+
- Session reads and wait replies put a blank line between non-empty text parts (LLP 0019).
|
|
23
|
+
|
|
24
|
+
## 0.3.29
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- In `bypass_permissions`, Gemini runs outside Antigravity's terminal sandbox, as Claude and Codex do:
|
|
29
|
+
network, git in a worktree, writes outside the folder. A product that relied on that sandbox supplies
|
|
30
|
+
its own: in `default` an approved command is not sandboxed either, unless the person set
|
|
31
|
+
`enableTerminalSandbox`. A switch into or out of the mode restarts agy and resumes (LLP 0020).
|
|
32
|
+
|
|
33
|
+
## 0.3.28
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Claude, Codex and ACP report an unexpected process exit as `process_exit` in one sentence: the
|
|
38
|
+
exit status, any unanswered request, and a one-line redacted stderr summary or that it printed
|
|
39
|
+
nothing. A Claude exit whose stderr named an authentication failure was `auth`; a refused resume
|
|
40
|
+
stays `resume_failed`; Codex's `initialize` timeout shows stderr (LLP 0016.000).
|
|
41
|
+
- `archive` asks the host first and stops a member only when the host answers `busy` naming the
|
|
42
|
+
caller's own sessions, once per member: a host checks everything a stop cannot change before it
|
|
43
|
+
answers `busy` (LLP 0019).
|
|
44
|
+
- `list_models` with an unknown agent, and `list_sessions` with an unknown project or workspace,
|
|
45
|
+
are refused naming the valid choices, where they answered an empty list (LLP 0019).
|
|
46
|
+
- An unsettled `wait_for_sessions` says how long it waited and why it was cut short (the per-call
|
|
47
|
+
limit, the connection's end, the caller), and its retry hint keeps `until`. A wait quotes the
|
|
48
|
+
agent's latest reply (LLP 0019).
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
|
|
52
|
+
- `gemini`, a harness in the default set: Gemini on Google's Antigravity CLI, `agy` 1.5.14, installed and pinned as the
|
|
53
|
+
other CLIs are (`$ANTIGRAVITY_CLI_PATH`; the person's own only in `system`). On every ACP agent `accept_edits` asks for
|
|
54
|
+
a command, no turn runs in a mode it did not ask, a level is fitted to the model and reported as run, and parts keep
|
|
55
|
+
their order; `AcpLaunch` takes `fixedEnv`. ACP agent `gemini` is now `gemini-cli` (LLP 0020, LLP 0016.000, LLP 0010).
|
|
56
|
+
- `read_session` takes `full: true` for whole message text and `page`, copied from its hint, to
|
|
57
|
+
continue a long read (a result holds 20,000 characters). A read that changed between pages is
|
|
58
|
+
`stale_cursor` with the call to start again; a clipped message names the call that reads it
|
|
59
|
+
whole (LLP 0019).
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
|
|
63
|
+
- A Claude turn whose CLI exits before its result fails with `process_exit`, where it ended
|
|
64
|
+
`end_turn` with nothing: partial replies stay, unread steers are listed undelivered, a stopped
|
|
65
|
+
turn stays cancelled. Under an operator's own spawner the error says the turn ended without a
|
|
66
|
+
result (LLP 0013 F14, LLP 0016.000).
|
|
67
|
+
- `start_session` calls that differ only in thinking level or title start separate sessions, and
|
|
68
|
+
a session whose `send_message` finds the session that started it busy is told to end its turn
|
|
69
|
+
with the report (LLP 0019).
|
|
70
|
+
|
|
10
71
|
## 0.3.27
|
|
11
72
|
|
|
12
73
|
### Breaking
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @zvada/agent-server
|
|
2
2
|
|
|
3
3
|
A standardized, harness-agnostic **agent execution engine**: run Claude Code,
|
|
4
|
-
OpenAI Codex (app-server), and any
|
|
5
|
-
agent behind one interface with a single normalized event stream, multi-turn
|
|
4
|
+
OpenAI Codex (app-server), Gemini through Google's Antigravity CLI, and any
|
|
5
|
+
[ACP](https://agentclientprotocol.com) agent behind one interface with a single normalized event stream, multi-turn
|
|
6
6
|
sessions, resume, engine-brokered permissions, and pinned CLI provisioning.
|
|
7
7
|
|
|
8
8
|
One package, seven seats — pick the subpath for how you consume it:
|
|
@@ -43,7 +43,9 @@ await runtime.run(
|
|
|
43
43
|
|
|
44
44
|
Agent SDKs (`@anthropic-ai/claude-agent-sdk`, `@agentclientprotocol/sdk`) are
|
|
45
45
|
**optional peer dependencies**, loaded lazily — a harness only needs its own
|
|
46
|
-
SDK present. Codex needs none: its harness drives the `codex` CLI directly.
|
|
46
|
+
SDK present. Codex needs none: its harness drives the `codex` CLI directly. The
|
|
47
|
+
`gemini` harness runs Google's `agy` through the ACP SDK; the engine installs
|
|
48
|
+
and pins it as it does `claude` and `codex`.
|
|
47
49
|
|
|
48
50
|
## Run the wire server
|
|
49
51
|
|
|
@@ -54,7 +56,7 @@ with `bunx @zvada/agent-server`.
|
|
|
54
56
|
bunx @zvada/agent-server --listen 4747 # WebSocket wire on 127.0.0.1
|
|
55
57
|
bunx @zvada/agent-server --stdio # stdio wire (for spawners)
|
|
56
58
|
bunx @zvada/agent-server --acp # act as an ACP v1 agent (Zed-spawnable)
|
|
57
|
-
bunx @zvada/agent-server install # prefetch pinned claude/codex CLIs
|
|
59
|
+
bunx @zvada/agent-server install # prefetch pinned claude/codex/agy CLIs
|
|
58
60
|
```
|
|
59
61
|
|
|
60
62
|
Under Node, run the compiled bin:
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { onAbort, untilAborted } from "../../utils/deadline.js";
|
|
5
|
+
import { AcpClient } from "./client.js";
|
|
6
|
+
/** ACP protocol major version this harness speaks. */
|
|
7
|
+
const PROTOCOL_VERSION = 1;
|
|
8
|
+
/** Deadline for `initialize` on a freshly spawned agent (mirrors codex startup). */
|
|
9
|
+
const INITIALIZE_TIMEOUT_MS = 15_000;
|
|
10
|
+
/** Deadline for session lifecycle requests (`session/new`, `session/resume`). */
|
|
11
|
+
export const SESSION_REQUEST_TIMEOUT_MS = 30_000;
|
|
12
|
+
/** The profile's launch, refused when it has none; a cancel ends the wait. */
|
|
13
|
+
export async function launchOf(profile, signal) {
|
|
14
|
+
signal?.throwIfAborted();
|
|
15
|
+
const launch = await untilAborted(Promise.resolve(profile.launch()), signal);
|
|
16
|
+
signal?.throwIfAborted();
|
|
17
|
+
if (!launch) {
|
|
18
|
+
throw new Error(`${profile.harness} harness is not configured: it has no agent launch command`);
|
|
19
|
+
}
|
|
20
|
+
return launch;
|
|
21
|
+
}
|
|
22
|
+
/** Start an agent of the profile's harness on the engine's processes. */
|
|
23
|
+
export function startClient(start, options) {
|
|
24
|
+
const clientOptions = {
|
|
25
|
+
...options,
|
|
26
|
+
clientName: start.clientName,
|
|
27
|
+
processes: start.processes,
|
|
28
|
+
harness: start.profile.harness,
|
|
29
|
+
};
|
|
30
|
+
return start.createClient ? start.createClient(clientOptions) : AcpClient.create(clientOptions);
|
|
31
|
+
}
|
|
32
|
+
/** `initialize` the agent, and refuse one its profile cannot drive. */
|
|
33
|
+
export async function initialize(client, start) {
|
|
34
|
+
const init = await client.request("initialize", {
|
|
35
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
36
|
+
// The engine brokers the agent's requests for input, form or URL;
|
|
37
|
+
// a turn whose client cannot answer declines them.
|
|
38
|
+
clientCapabilities: { elicitation: { form: {}, url: {} } },
|
|
39
|
+
clientInfo: {
|
|
40
|
+
name: start.clientName ?? "agent-server",
|
|
41
|
+
version: start.clientVersion ?? "0.0.0",
|
|
42
|
+
},
|
|
43
|
+
}, INITIALIZE_TIMEOUT_MS);
|
|
44
|
+
start.profile.accept?.(init);
|
|
45
|
+
return init;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A folder of no project for an agent to start in, since an agent loads the
|
|
49
|
+
* rules, skills and hooks of the folder it runs in (Antigravity takes it as
|
|
50
|
+
* its workspace): a new one each time (`mkdtemp`, 0700), which nobody else
|
|
51
|
+
* can plant a project in, removed once `gone` settles (its process exited).
|
|
52
|
+
*/
|
|
53
|
+
export function privateFolder() {
|
|
54
|
+
const path = mkdtempSync(join(tmpdir(), "agent-server-acp-"));
|
|
55
|
+
return {
|
|
56
|
+
path,
|
|
57
|
+
removeAfter: async (gone) => {
|
|
58
|
+
await gone;
|
|
59
|
+
rmSync(path, { recursive: true, force: true });
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The account an agent runs on, read through a session with no turn: the
|
|
65
|
+
* agent starts in a folder of no project, opens a session, is used, and ends.
|
|
66
|
+
* Its model list and its login read it this way.
|
|
67
|
+
*/
|
|
68
|
+
export class AcpAccount {
|
|
69
|
+
start;
|
|
70
|
+
constructor(start) {
|
|
71
|
+
this.start = start;
|
|
72
|
+
}
|
|
73
|
+
get processes() {
|
|
74
|
+
return this.start.processes;
|
|
75
|
+
}
|
|
76
|
+
launch(signal) {
|
|
77
|
+
return launchOf(this.start.profile, signal);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Start the agent in a folder of its own (`privateFolder`), `initialize`
|
|
81
|
+
* it, run `use`, and end it; `signal` ends it sooner.
|
|
82
|
+
*/
|
|
83
|
+
async connect(options, use) {
|
|
84
|
+
const launch = await this.launch(options.signal);
|
|
85
|
+
const folder = privateFolder();
|
|
86
|
+
const cwd = folder.path;
|
|
87
|
+
let client;
|
|
88
|
+
const offAbort = onAbort(options.signal, () => client?.close());
|
|
89
|
+
try {
|
|
90
|
+
client = await startClient(this.start, {
|
|
91
|
+
launch,
|
|
92
|
+
cwd,
|
|
93
|
+
...(options.env && { env: options.env }),
|
|
94
|
+
});
|
|
95
|
+
options.signal?.throwIfAborted();
|
|
96
|
+
return await use(client, await initialize(client, this.start), cwd);
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
offAbort();
|
|
100
|
+
client?.close();
|
|
101
|
+
await folder.removeAfter(client?.gone());
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** As `connect`, with a session opened in its folder for `use`, and never prompted. */
|
|
105
|
+
open(options, use) {
|
|
106
|
+
return this.connect(options, async (client, init, cwd) => {
|
|
107
|
+
const session = await client.request("session/new", { cwd, mcpServers: [] }, SESSION_REQUEST_TIMEOUT_MS);
|
|
108
|
+
return use(client, { init, session });
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|