@qlairoslabs/acp-client 0.12.0 → 0.12.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.
- package/CHANGELOG-consumer-fixes.md +7 -0
- package/CONSUMER_GUIDE.md +2 -1
- package/package.json +1 -1
- package/src/adapters.ts +5 -0
- package/src/checkpointing/recovery.ts +7 -0
- package/src/client.ts +16 -4
|
@@ -13,6 +13,13 @@ Released in 0.12.0. Upgrading from 0.10.x: see `MIGRATION-0.10-to-0.12.md`.
|
|
|
13
13
|
failing the turn. See the consumer guide for store and out-of-band delivery contracts.
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
- **Grok Build preset.** `ADAPTERS.grok` launches xAI's Grok Build over ACP
|
|
17
|
+
(`grok --no-auto-update agent stdio`). A Grok session that no longer exists is recognised as
|
|
18
|
+
missing, so checkpoint recovery applies to it.
|
|
19
|
+
- **Additional directories only when advertised.** The client sends `additionalDirectories` only to an
|
|
20
|
+
agent that advertises `sessionCapabilities.additionalDirectories`, as ACP requires; otherwise they
|
|
21
|
+
are left out with a warning (`additional_directories_unsupported`). Grok refused session requests
|
|
22
|
+
that carried them.
|
|
16
23
|
- **Message boundaries.** A new tool call now ends the assistant message before it, also when the
|
|
17
24
|
agent sends no message ids (before, message → tool → message was one message). Tool updates
|
|
18
25
|
do not split. Applies to the live `result.messages` and to stored messages.
|
package/CONSUMER_GUIDE.md
CHANGED
|
@@ -179,7 +179,8 @@ copies are refused using the agent's prompt capabilities; an automatic path sour
|
|
|
179
179
|
to a link. PTY mode refuses media parts.
|
|
180
180
|
|
|
181
181
|
Declare shared directories with `conversationDefaults: { additionalDirectories: ["/shared"] }`
|
|
182
|
-
or a conversation's `runtime.additionalDirectories`. They
|
|
182
|
+
or a conversation's `runtime.additionalDirectories`. They are sent only to an agent that advertises
|
|
183
|
+
`sessionCapabilities.additionalDirectories` (otherwise left out, with a warning). They reach ACP session creation/load;
|
|
183
184
|
the harness applies its own permissions. The library does not restrict pointers. A harness on
|
|
184
185
|
another machine or in an isolated container needs a shared mount or a copy.
|
|
185
186
|
|
package/package.json
CHANGED
package/src/adapters.ts
CHANGED
|
@@ -57,6 +57,11 @@ export const ADAPTERS = {
|
|
|
57
57
|
// @automatalabs/pi-acp embeds Pi through its SDK and publishes the `pi-acp` binary.
|
|
58
58
|
// Pi itself remains the interactive PTY command for bridge/degraded mode.
|
|
59
59
|
pi: { command: ["pi-acp"], ptyCommand: ["pi"], displayName: "Pi" },
|
|
60
|
+
// verified — xAI's Grok Build (`grok` CLI, 1.0.70). ACP over `grok agent stdio`; xAI advises
|
|
61
|
+
// `--no-auto-update` for ACP in automated use, so a session does not start a background update.
|
|
62
|
+
// No `session/delete`: its sessions live in folders under ~/.grok/sessions/. Only the ACP command
|
|
63
|
+
// is verified; the pty command (its interactive TUI) has not been run in degraded mode.
|
|
64
|
+
grok: { command: ["grok", "--no-auto-update", "agent", "stdio"], ptyCommand: ["grok"], displayName: "Grok Build" },
|
|
60
65
|
// Below: from each project's docs, not spawned here. Correct at time of writing, unverified.
|
|
61
66
|
gemini: { command: ["gemini", "--acp", "--stdio"], ptyCommand: ["gemini"], displayName: "Gemini" },
|
|
62
67
|
copilot: { command: ["copilot", "--acp", "--stdio"], ptyCommand: ["copilot"], displayName: "Copilot" },
|
|
@@ -35,6 +35,13 @@ export function isMissingProviderSessionError(
|
|
|
35
35
|
&& message.toLowerCase() === "internal error: opencode service failure"
|
|
36
36
|
&& data?.service === "session"
|
|
37
37
|
) return true;
|
|
38
|
+
// Grok Build reports a session file it cannot find as a generic internal error; its error code
|
|
39
|
+
// `FS_NOT_FOUND` is the machine-readable signal, so match it exactly, with the message.
|
|
40
|
+
if (
|
|
41
|
+
value?.code === -32603
|
|
42
|
+
&& message === "Path not found."
|
|
43
|
+
&& data?.code === "FS_NOT_FOUND"
|
|
44
|
+
) return true;
|
|
38
45
|
// ACP's standard "resource not found". This classifier only sees `session/load` failures, so the
|
|
39
46
|
// resource is the session (Claude reports a missing session this way).
|
|
40
47
|
if (value?.code === -32002) return true;
|
package/src/client.ts
CHANGED
|
@@ -497,7 +497,7 @@ export class AcpClient implements AgentClient {
|
|
|
497
497
|
sessionId,
|
|
498
498
|
cwd: this.config.cwd ?? process.cwd(),
|
|
499
499
|
mcpServers: options.mcpServers ?? [],
|
|
500
|
-
|
|
500
|
+
...this.additionalDirectoriesParam(options.additionalDirectories ?? this.config.additionalDirectories),
|
|
501
501
|
} as schema.LoadSessionRequest);
|
|
502
502
|
} catch (err) {
|
|
503
503
|
this.abortCommandTransition();
|
|
@@ -534,7 +534,7 @@ export class AcpClient implements AgentClient {
|
|
|
534
534
|
sessionId,
|
|
535
535
|
cwd: this.config.cwd ?? process.cwd(),
|
|
536
536
|
mcpServers: options.mcpServers ?? [],
|
|
537
|
-
|
|
537
|
+
...this.additionalDirectoriesParam(options.additionalDirectories ?? this.config.additionalDirectories),
|
|
538
538
|
} as schema.ResumeSessionRequest);
|
|
539
539
|
} catch (err) {
|
|
540
540
|
this.abortCommandTransition();
|
|
@@ -583,7 +583,7 @@ export class AcpClient implements AgentClient {
|
|
|
583
583
|
sessionId,
|
|
584
584
|
cwd: this.config.cwd ?? process.cwd(),
|
|
585
585
|
mcpServers: options.mcpServers ?? [],
|
|
586
|
-
|
|
586
|
+
...this.additionalDirectoriesParam(options.additionalDirectories ?? this.config.additionalDirectories),
|
|
587
587
|
} as schema.ForkSessionRequest);
|
|
588
588
|
} catch (err) {
|
|
589
589
|
this.abortCommandTransition();
|
|
@@ -667,6 +667,18 @@ export class AcpClient implements AgentClient {
|
|
|
667
667
|
return { sessionId, resumed: false };
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
+
/**
|
|
671
|
+
* ACP only allows `additionalDirectories` when the agent advertises it. Sending it anyway can make the
|
|
672
|
+
* agent refuse the whole session request (Grok answers "Invalid params"), so unadvertised directories
|
|
673
|
+
* are left out, with a warning: the agent then sees only its working directory.
|
|
674
|
+
*/
|
|
675
|
+
private additionalDirectoriesParam(directories: string[] | undefined): { additionalDirectories?: string[] } {
|
|
676
|
+
if (!directories?.length) return {};
|
|
677
|
+
if (this._capabilities?.agent.sessionCapabilities.additionalDirectories) return { additionalDirectories: directories };
|
|
678
|
+
this.log.warn("additional_directories_unsupported", { directories: directories.length });
|
|
679
|
+
return {};
|
|
680
|
+
}
|
|
681
|
+
|
|
670
682
|
private async newSessionInternal(
|
|
671
683
|
transport: AcpTransport,
|
|
672
684
|
cwd: string,
|
|
@@ -679,7 +691,7 @@ export class AcpClient implements AgentClient {
|
|
|
679
691
|
res = await transport.newSession({
|
|
680
692
|
cwd,
|
|
681
693
|
mcpServers,
|
|
682
|
-
...(additionalDirectories
|
|
694
|
+
...this.additionalDirectoriesParam(additionalDirectories),
|
|
683
695
|
} as schema.NewSessionRequest);
|
|
684
696
|
} catch (err) {
|
|
685
697
|
this.abortCommandTransition();
|