@agentclientprotocol/claude-agent-acp 0.103.1-preview.1 → 0.103.1-preview.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/agent-command.d.ts +9 -0
- package/dist/agent-command.d.ts.map +1 -1
- package/dist/agent-command.js +12 -0
- package/dist/auth-methods.d.ts +6 -4
- package/dist/auth-methods.d.ts.map +1 -1
- package/dist/auth-methods.js +19 -22
- package/dist/hide-claude-auth.d.ts +1 -0
- package/dist/hide-claude-auth.d.ts.map +1 -1
- package/dist/hide-claude-auth.js +2 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/dist/agent-command.d.ts
CHANGED
|
@@ -12,4 +12,13 @@ export declare function agentCommand(argv?: readonly string[]): {
|
|
|
12
12
|
command: string;
|
|
13
13
|
args: string[];
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* The arguments for the Claude CLI under `--cli`: the flags this process was
|
|
17
|
+
* started with, minus the ones the adapter owns. The terminal-auth command
|
|
18
|
+
* reruns the agent with its own flags (`--hide-claude-auth --cli auth login`),
|
|
19
|
+
* and the CLI rejects the unknown option `--hide-claude-auth`. `argv.slice(2)`
|
|
20
|
+
* is the flags under both Node and a compiled executable (see
|
|
21
|
+
* {@link agentCommand}).
|
|
22
|
+
*/
|
|
23
|
+
export declare function cliArgs(argv?: readonly string[]): string[];
|
|
15
24
|
//# sourceMappingURL=agent-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-command.d.ts","sourceRoot":"","sources":["../src/agent-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-command.d.ts","sourceRoot":"","sources":["../src/agent-command.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,GAAE,SAAS,MAAM,EAAiB,GAAG;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAKA;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,IAAI,GAAE,SAAS,MAAM,EAAiB,GAAG,MAAM,EAAE,CAExE"}
|
package/dist/agent-command.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HIDE_CLAUDE_AUTH_FLAG } from "./hide-claude-auth.js";
|
|
1
2
|
/**
|
|
2
3
|
* The command that starts this agent again with the flags it was started with,
|
|
3
4
|
* for a client to run in a terminal (e.g. `terminal-auth` login).
|
|
@@ -15,3 +16,14 @@ export function agentCommand(argv = process.argv) {
|
|
|
15
16
|
const compiled = script.includes("$bunfs") || script.includes("~BUN");
|
|
16
17
|
return { command: process.execPath, args: compiled ? flags : [script, ...flags] };
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* The arguments for the Claude CLI under `--cli`: the flags this process was
|
|
21
|
+
* started with, minus the ones the adapter owns. The terminal-auth command
|
|
22
|
+
* reruns the agent with its own flags (`--hide-claude-auth --cli auth login`),
|
|
23
|
+
* and the CLI rejects the unknown option `--hide-claude-auth`. `argv.slice(2)`
|
|
24
|
+
* is the flags under both Node and a compiled executable (see
|
|
25
|
+
* {@link agentCommand}).
|
|
26
|
+
*/
|
|
27
|
+
export function cliArgs(argv = process.argv) {
|
|
28
|
+
return argv.slice(2).filter((arg) => arg !== "--cli" && arg !== HIDE_CLAUDE_AUTH_FLAG);
|
|
29
|
+
}
|
package/dist/auth-methods.d.ts
CHANGED
|
@@ -9,10 +9,12 @@ import type { AuthMethod } from "@agentclientprotocol/sdk/unstable";
|
|
|
9
9
|
*
|
|
10
10
|
* Without either, the client cannot run a login, and the list is empty. On a
|
|
11
11
|
* remote machine (SSH, `NO_BROWSER`, `CLAUDE_CODE_REMOTE`, as the SDK's own
|
|
12
|
-
* isRemote check) the
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* isRemote check) the subscription login runs the TUI's `claude /login`:
|
|
13
|
+
* clients such as Tidewave set `NO_BROWSER` to get it. The Anthropic Console
|
|
14
|
+
* login is offered there too, because since Claude Code 2.1.126 `auth login`
|
|
15
|
+
* accepts the OAuth code pasted into the terminal when the localhost callback
|
|
16
|
+
* can't be reached. The Claude subscription method is left out when
|
|
17
|
+
* `shouldHideClaudeAuth()` says so.
|
|
16
18
|
*/
|
|
17
19
|
export declare function terminalAuthMethods({ terminal, metaTerminal, }: {
|
|
18
20
|
terminal: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-methods.d.ts","sourceRoot":"","sources":["../src/auth-methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAIpE
|
|
1
|
+
{"version":3,"file":"auth-methods.d.ts","sourceRoot":"","sources":["../src/auth-methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAIpE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,GACb,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,UAAU,EAAE,CAuDf"}
|
package/dist/auth-methods.js
CHANGED
|
@@ -10,10 +10,12 @@ import { shouldHideClaudeAuth } from "./hide-claude-auth.js";
|
|
|
10
10
|
*
|
|
11
11
|
* Without either, the client cannot run a login, and the list is empty. On a
|
|
12
12
|
* remote machine (SSH, `NO_BROWSER`, `CLAUDE_CODE_REMOTE`, as the SDK's own
|
|
13
|
-
* isRemote check) the
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* isRemote check) the subscription login runs the TUI's `claude /login`:
|
|
14
|
+
* clients such as Tidewave set `NO_BROWSER` to get it. The Anthropic Console
|
|
15
|
+
* login is offered there too, because since Claude Code 2.1.126 `auth login`
|
|
16
|
+
* accepts the OAuth code pasted into the terminal when the localhost callback
|
|
17
|
+
* can't be reached. The Claude subscription method is left out when
|
|
18
|
+
* `shouldHideClaudeAuth()` says so.
|
|
17
19
|
*/
|
|
18
20
|
export function terminalAuthMethods({ terminal, metaTerminal, }) {
|
|
19
21
|
if (!terminal && !metaTerminal)
|
|
@@ -34,29 +36,24 @@ export function terminalAuthMethods({ terminal, metaTerminal, }) {
|
|
|
34
36
|
process.env.SSH_CLIENT ||
|
|
35
37
|
process.env.SSH_TTY ||
|
|
36
38
|
process.env.CLAUDE_CODE_REMOTE);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
args: ["--cli"],
|
|
47
|
-
}, "Claude Login"),
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
const methods = [];
|
|
51
|
-
if (!shouldHideClaudeAuth()) {
|
|
52
|
-
methods.push(withMeta({
|
|
39
|
+
const subscriptionLogin = isRemote
|
|
40
|
+
? withMeta({
|
|
41
|
+
description: "Run `claude /login` in the terminal",
|
|
42
|
+
name: "Log in with Claude",
|
|
43
|
+
id: "claude-login",
|
|
44
|
+
type: "terminal",
|
|
45
|
+
args: ["--cli"],
|
|
46
|
+
}, "Claude Login")
|
|
47
|
+
: withMeta({
|
|
53
48
|
description: "Use Claude subscription ",
|
|
54
49
|
name: "Claude Subscription",
|
|
55
50
|
id: "claude-ai-login",
|
|
56
51
|
type: "terminal",
|
|
57
52
|
args: ["--cli", "auth", "login", "--claudeai"],
|
|
58
|
-
}, "Claude Login")
|
|
59
|
-
|
|
53
|
+
}, "Claude Login");
|
|
54
|
+
const methods = [];
|
|
55
|
+
if (!shouldHideClaudeAuth())
|
|
56
|
+
methods.push(subscriptionLogin);
|
|
60
57
|
methods.push(withMeta({
|
|
61
58
|
description: "Use Anthropic Console (API usage billing)",
|
|
62
59
|
name: "Anthropic Console",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import { RequestError } from "@agentclientprotocol/sdk/unstable";
|
|
35
35
|
import type { AccountInfo, Query } from "@anthropic-ai/claude-agent-sdk";
|
|
36
|
+
export declare const HIDE_CLAUDE_AUTH_FLAG = "--hide-claude-auth";
|
|
36
37
|
export declare function shouldHideClaudeAuth(): boolean;
|
|
37
38
|
/**
|
|
38
39
|
* `data.reason` carried by the `authRequired` JSON-RPC error when the flag
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hide-claude-auth.d.ts","sourceRoot":"","sources":["../src/hide-claude-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEzE,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wCAAwC,sCAAsC,CAAC;AAC5F,MAAM,MAAM,kBAAkB,GAAG,OAAO,wCAAwC,CAAC;AAEjF,eAAO,MAAM,yCAAyC,qEACc,CAAC;AAErE;;qEAEqE;AACrE,eAAO,MAAM,6BAA6B,0EAC+B,CAAC;AAmB1E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,CAWjF;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,CAWxF;AAED,wBAAgB,mCAAmC,IAAI,YAAY,CAKlE;AAED;oEACoE;AACpE,wBAAgB,wBAAwB,IAAI,YAAY,CAEvD;AAED;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC;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AE,WAAW,CAAC;IACpB;;;;+BAI2B;IAC3B,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,4BAA4B,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAavF"}
|
package/dist/hide-claude-auth.js
CHANGED
|
@@ -32,8 +32,9 @@
|
|
|
32
32
|
* until the next prompt. Awaiting it would add a CLI run to every turn.
|
|
33
33
|
*/
|
|
34
34
|
import { RequestError } from "@agentclientprotocol/sdk/unstable";
|
|
35
|
+
export const HIDE_CLAUDE_AUTH_FLAG = "--hide-claude-auth";
|
|
35
36
|
export function shouldHideClaudeAuth() {
|
|
36
|
-
return process.argv.includes(
|
|
37
|
+
return process.argv.includes(HIDE_CLAUDE_AUTH_FLAG);
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
40
|
* `data.reason` carried by the `authRequired` JSON-RPC error when the flag
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { cliArgs } from "./agent-command.js";
|
|
2
3
|
import { claudeCliPath } from "./claude-cli.js";
|
|
3
4
|
import { applyManagedPolicyEnv } from "./managed-policy.js";
|
|
4
5
|
import { acpProtocolsFromEnv, serveAcp } from "./serve.js";
|
|
@@ -10,7 +11,7 @@ import { join } from "node:path";
|
|
|
10
11
|
// handler below. Our version flag only applies when not delegating.
|
|
11
12
|
if (process.argv.includes("--cli")) {
|
|
12
13
|
const { spawn } = await import("node:child_process");
|
|
13
|
-
const args =
|
|
14
|
+
const args = cliArgs();
|
|
14
15
|
const child = spawn(await claudeCliPath(), args, { stdio: "inherit" });
|
|
15
16
|
const signals = process.platform === "win32"
|
|
16
17
|
? ["SIGINT", "SIGTERM"]
|
package/package.json
CHANGED