@agentclientprotocol/claude-agent-acp 0.112.1-preview.1 → 0.112.1-preview.3
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/README.md +1 -0
- package/dist/adapter-command.d.ts +56 -0
- package/dist/adapter-command.d.ts.map +1 -0
- package/dist/adapter-command.js +74 -0
- package/dist/claude-cli.d.ts +2 -0
- package/dist/claude-cli.d.ts.map +1 -1
- package/dist/claude-cli.js +5 -1
- package/dist/mcp-command.d.ts.map +1 -1
- package/dist/mcp-command.js +1 -14
- package/dist/plugin-command.d.ts +94 -0
- package/dist/plugin-command.d.ts.map +1 -0
- package/dist/plugin-command.js +633 -0
- package/dist/slash-commands.d.ts +1 -1
- package/dist/slash-commands.d.ts.map +1 -1
- package/dist/slash-commands.js +5 -12
- package/dist/usage-markdown.d.ts +4 -0
- package/dist/usage-markdown.d.ts.map +1 -1
- package/dist/usage-markdown.js +13 -0
- package/dist/v1/acp-agent.d.ts +16 -10
- package/dist/v1/acp-agent.d.ts.map +1 -1
- package/dist/v1/acp-agent.js +125 -77
- package/dist/v1/adapter-commands.d.ts +78 -0
- package/dist/v1/adapter-commands.d.ts.map +1 -0
- package/dist/v1/adapter-commands.js +124 -0
- package/dist/v1/remote-control.d.ts +10 -34
- package/dist/v1/remote-control.d.ts.map +1 -1
- package/dist/v1/remote-control.js +6 -26
- package/dist/v2/{remote-control.d.ts → adapter-commands.d.ts} +34 -17
- package/dist/v2/adapter-commands.d.ts.map +1 -0
- package/dist/v2/adapter-commands.js +121 -0
- package/dist/v2/agent.d.ts.map +1 -1
- package/dist/v2/agent.js +3 -2
- package/dist/v2/commands.d.ts +5 -4
- package/dist/v2/commands.d.ts.map +1 -1
- package/dist/v2/commands.js +4 -2
- package/dist/v2/session.d.ts +14 -8
- package/dist/v2/session.d.ts.map +1 -1
- package/dist/v2/session.js +68 -38
- package/dist/v2/subscription-guard.d.ts +2 -1
- package/dist/v2/subscription-guard.d.ts.map +1 -1
- package/dist/v2/tasks.d.ts +9 -2
- package/dist/v2/tasks.d.ts.map +1 -1
- package/dist/v2/tasks.js +80 -15
- package/package.json +1 -1
- package/dist/v2/remote-control.d.ts.map +0 -1
- package/dist/v2/remote-control.js +0 -97
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote-control.d.ts","sourceRoot":"","sources":["../../src/v2/remote-control.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAGL,yBAAyB,EACzB,sBAAsB,EAEvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,KAAK,IAAI,KAAK,GAAG,SAAS,CAAC;IAC3B,sEAAsE;IACtE,gBAAgB,IAAI,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAClD,gHAAgH;IAChH,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACzB,oDAAoD;IACpD,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,2FAA2F;IAC3F,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,uEAAuE;IACvE,OAAO,IAAI,OAAO,CAAC;IACnB,oCAAoC;IACpC,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;CACrC;AAED,qBAAa,oBAAoB;IAUnB,OAAO,CAAC,QAAQ,CAAC,IAAI;IATjC,sFAAsF;IACtF,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;IAE1C;;;OAGG;IACH,SAAS,yBAAqC;gBAEjB,IAAI,EAAE,iBAAiB;IAEpD;;;;;;;;OAQG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKvC;;;;OAIG;IACH,aAAa,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI;IAInD,qFAAqF;IACrF,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO;IAIxE;;;;;;OAMG;IACG,GAAG,CACP,MAAM,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,EACvD,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,OAAO,GAC1B,OAAO,CAAC,OAAO,CAAC;IAiBnB,yDAAyD;IACzD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI1B;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,SAAS;CAIzF"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The adapter's `/remote-control` on the v2 core, and the messages that
|
|
3
|
-
* a person types in another client of the session over Remote Control.
|
|
4
|
-
*
|
|
5
|
-
* The command, its listing, and its reply are the v1 core's
|
|
6
|
-
* (`remote-control.ts`). The command
|
|
7
|
-
* runs as a local command of its own turn, as v2 asks of one ("Local handling
|
|
8
|
-
* still uses the foreground lifecycle"): its prompt is inserted as a
|
|
9
|
-
* live-only `user_message`, the turn reports `running`, the reply goes out,
|
|
10
|
-
* and the turn ends `idle` with `end_turn`. It waits until no turn is open
|
|
11
|
-
* and no prompt waits in Claude Code's queue, and the prompts after it wait
|
|
12
|
-
* for it: v2 asks to hold a prompt rather than reject it while Claude works.
|
|
13
|
-
*
|
|
14
|
-
* Remote Control also starts with a query that Claude Code asked to start
|
|
15
|
-
* with it (`remoteControlAtStartup` in the settings, else the policy default or
|
|
16
|
-
* a rollout; see `startsWithRemoteControl`). That is no turn: it reports in a
|
|
17
|
-
* notice, as v1 does.
|
|
18
|
-
*/
|
|
19
|
-
import { randomUUID } from "node:crypto";
|
|
20
|
-
import { adapterRemoteControlCommand, isRemoteHumanMessage, parseRemoteControlCommand, RemoteControlAtStartup, runRemoteControlCommand, } from "../remote-control.js";
|
|
21
|
-
export class SessionRemoteControl {
|
|
22
|
-
host;
|
|
23
|
-
/** The uuids of the prompts that this session sent, until Claude Code echoes them. */
|
|
24
|
-
sent = new Set();
|
|
25
|
-
/**
|
|
26
|
-
* Remote Control at the start of this query, which Claude Code can ask for
|
|
27
|
-
* at `initialize` (see `V2Session.setRemoteControlAtStartup`).
|
|
28
|
-
*/
|
|
29
|
-
atStartup = new RemoteControlAtStartup(false);
|
|
30
|
-
constructor(host) {
|
|
31
|
-
this.host = host;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Starts Remote Control after the setup response of a query that Claude
|
|
35
|
-
* Code asked to start with it, and reports how it went in a notice (see
|
|
36
|
-
* `RemoteControlAtStartup`). It runs once per query, so a later resume of
|
|
37
|
-
* the live session starts nothing, while a restart of the query (see
|
|
38
|
-
* `restarts.ts`), whose new query asks again, starts it again, unless the
|
|
39
|
-
* user turned it off before (see {@link restartedFrom}). The session holds
|
|
40
|
-
* its prompts back until the notice is sent.
|
|
41
|
-
*/
|
|
42
|
-
async connectAtStartup() {
|
|
43
|
-
const notice = this.atStartup.connect(this.host);
|
|
44
|
-
if (notice)
|
|
45
|
-
this.host.notice(await notice);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A restart replaced the query of `previous` with this one: Remote Control
|
|
49
|
-
* that the user turned off there stays off (see
|
|
50
|
-
* `RemoteControlAtStartup.restartedFrom`).
|
|
51
|
-
*/
|
|
52
|
-
restartedFrom(previous) {
|
|
53
|
-
this.atStartup.restartedFrom(previous.atStartup);
|
|
54
|
-
}
|
|
55
|
-
/** Whether `prompt` may be the adapter's command, which {@link run} then decides. */
|
|
56
|
-
mayRun(prompt) {
|
|
57
|
-
return parseRemoteControlCommand(prompt) !== null;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Runs `prompt` as the adapter's command, as its turn, once the session is
|
|
61
|
-
* idle. Resolves `false` without running it when Claude Code serves the
|
|
62
|
-
* command itself or the query has no Remote Control: the prompt then goes
|
|
63
|
-
* to Claude Code. `stillPending` tells whether a cancel or close answered
|
|
64
|
-
* the prompt meanwhile.
|
|
65
|
-
*/
|
|
66
|
-
async run(prompt, uuid, stillPending) {
|
|
67
|
-
const query = this.host.query();
|
|
68
|
-
if (!query)
|
|
69
|
-
return false;
|
|
70
|
-
const command = await adapterRemoteControlCommand(prompt, query, this.host.terminalCommands());
|
|
71
|
-
if (!command)
|
|
72
|
-
return false;
|
|
73
|
-
if (!(await this.host.idle()) || !stillPending())
|
|
74
|
-
return true;
|
|
75
|
-
this.host.begin(uuid);
|
|
76
|
-
// A restart of the query keeps what the user chose last.
|
|
77
|
-
this.atStartup.commandRan(command.command);
|
|
78
|
-
// The turn is open across the network call, so the session reads as busy.
|
|
79
|
-
const text = await runRemoteControlCommand(command.query, command.command, (message) => this.host.logger.error(message));
|
|
80
|
-
this.host.end(text, randomUUID());
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
/** The session sent the prompt `uuid` to Claude Code. */
|
|
84
|
-
pushed(uuid) {
|
|
85
|
-
this.sent.add(uuid);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* The content of a prompt echo to show as a user message: one that a
|
|
89
|
-
* person typed in another client of the session. `undefined` for the
|
|
90
|
-
* echo of a prompt that this session sent, and for any other echo.
|
|
91
|
-
*/
|
|
92
|
-
remoteMessage(message) {
|
|
93
|
-
if (message.uuid && this.sent.delete(message.uuid))
|
|
94
|
-
return undefined;
|
|
95
|
-
return isRemoteHumanMessage(message) ? message.message.content : undefined;
|
|
96
|
-
}
|
|
97
|
-
}
|