@lucascouts/claude-agent-tui 0.12.2 → 0.13.0
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/auth-status.d.ts +34 -0
- package/dist/auth-status.js +63 -0
- package/dist/hide-claude-auth.d.ts +39 -0
- package/dist/hide-claude-auth.js +76 -0
- package/dist/model-catalog.js +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* R7.4 — which half of `#1080` was CUT, and why, stated where a caller will see it.
|
|
3
|
+
*/
|
|
4
|
+
export declare const CUT_FROM_UPSTREAM: {
|
|
5
|
+
readonly commit: "eb5ca9f";
|
|
6
|
+
readonly pr: 1080;
|
|
7
|
+
readonly cut: readonly ["_auth/status_update", "authStatusCapability"];
|
|
8
|
+
readonly why: string;
|
|
9
|
+
};
|
|
10
|
+
/** How the agent is authenticated. `external` covers backends whose credentials live outside
|
|
11
|
+
* the agent entirely (AWS creds, gcloud ADC, …). */
|
|
12
|
+
export type AuthStatusKind = "account" | "api_key" | "gateway" | "external" | "none";
|
|
13
|
+
export type AuthStatus = {
|
|
14
|
+
kind: AuthStatusKind;
|
|
15
|
+
/** Short human-readable identity, safe to show in a picker. */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Optional qualifier — a gateway host, an organisation, a key source. */
|
|
18
|
+
detail?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A fresh signed-out identity.
|
|
22
|
+
*
|
|
23
|
+
* Returns a COPY deliberately: handing out the shared constant would let one caller's edit reach
|
|
24
|
+
* every other caller, and this value is short-lived and passed around freely.
|
|
25
|
+
*/
|
|
26
|
+
export declare function notLoggedInAuthStatus(): AuthStatus;
|
|
27
|
+
/**
|
|
28
|
+
* ACP-level gateway auth (`authenticate` with `gateway` / `gateway-bedrock`). The gateway owns
|
|
29
|
+
* the credentials, so it wins over anything the CLI reports.
|
|
30
|
+
*
|
|
31
|
+
* A malformed `baseUrl` falls back to the raw string rather than throwing: the gateway is
|
|
32
|
+
* authenticated either way, and losing the identity to a URL typo would be the worse failure.
|
|
33
|
+
*/
|
|
34
|
+
export declare function gatewayAuthStatus(baseUrl?: string): AuthStatus;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Story 009 / Task 8.2 — the reachable half of upstream `#1080` (`eb5ca9f`), R7.3/R7.4.
|
|
2
|
+
//
|
|
3
|
+
// WHAT UPSTREAM'S COMMIT DOES. It reports the agent's auth identity over ACP through an
|
|
4
|
+
// `_auth/status_update` notification, gated by an `authStatusCapability` negotiated at
|
|
5
|
+
// `initialize`, and probes the local CLI to build that identity.
|
|
6
|
+
//
|
|
7
|
+
// WHAT LANDED HERE. The identity model and its pure constructors. The notification did NOT — see
|
|
8
|
+
// {@link CUT_FROM_UPSTREAM}. That is a measurement, not a guess: `authStatus` and
|
|
9
|
+
// `_auth/status_update` are ZERO occurrences in the packaged Zed's `crates/` tree AND in the
|
|
10
|
+
// pinned `agent-client-protocol-schema-1.5.0`. No client in this chain can receive it.
|
|
11
|
+
//
|
|
12
|
+
// The half that IS here is the half a PTY bridge is better placed for than an SDK adapter: this
|
|
13
|
+
// fork already runs the real `claude` client, so asking that client what identity it holds is a
|
|
14
|
+
// local question, not a protocol one. See §16.4 of `docs/REBASE-AND-DRIFT.md`.
|
|
15
|
+
/**
|
|
16
|
+
* R7.4 — which half of `#1080` was CUT, and why, stated where a caller will see it.
|
|
17
|
+
*/
|
|
18
|
+
export const CUT_FROM_UPSTREAM = {
|
|
19
|
+
commit: "eb5ca9f",
|
|
20
|
+
pr: 1080,
|
|
21
|
+
cut: ["_auth/status_update", "authStatusCapability"],
|
|
22
|
+
why: "The notification is capability-negotiated and no client in this chain negotiates it: " +
|
|
23
|
+
"`authStatus` is 0 occurrences in the packaged Zed's crates/ tree and 0 in the pinned " +
|
|
24
|
+
"agent-client-protocol-schema-1.5.0, so the wire type does not exist yet. This is stronger " +
|
|
25
|
+
"than 'not wired': there is nowhere to send it. Reopens when the schema carries it.",
|
|
26
|
+
};
|
|
27
|
+
/** The signed-out identity. */
|
|
28
|
+
const NOT_LOGGED_IN = {
|
|
29
|
+
kind: "none",
|
|
30
|
+
label: "Not logged in",
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A fresh signed-out identity.
|
|
34
|
+
*
|
|
35
|
+
* Returns a COPY deliberately: handing out the shared constant would let one caller's edit reach
|
|
36
|
+
* every other caller, and this value is short-lived and passed around freely.
|
|
37
|
+
*/
|
|
38
|
+
export function notLoggedInAuthStatus() {
|
|
39
|
+
return { ...NOT_LOGGED_IN };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* ACP-level gateway auth (`authenticate` with `gateway` / `gateway-bedrock`). The gateway owns
|
|
43
|
+
* the credentials, so it wins over anything the CLI reports.
|
|
44
|
+
*
|
|
45
|
+
* A malformed `baseUrl` falls back to the raw string rather than throwing: the gateway is
|
|
46
|
+
* authenticated either way, and losing the identity to a URL typo would be the worse failure.
|
|
47
|
+
*/
|
|
48
|
+
export function gatewayAuthStatus(baseUrl) {
|
|
49
|
+
let host;
|
|
50
|
+
if (baseUrl) {
|
|
51
|
+
try {
|
|
52
|
+
host = new URL(baseUrl).host;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
host = baseUrl;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
kind: "gateway",
|
|
60
|
+
label: "Custom model gateway",
|
|
61
|
+
...(host ? { detail: host } : {}),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AccountInfo } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* R7.4 — which half of `#1079` was CUT, and why, stated where a caller will see it rather than
|
|
4
|
+
* only in the ledger. §16.3 of `docs/REBASE-AND-DRIFT.md` is the long form.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CUT_FROM_UPSTREAM: {
|
|
7
|
+
readonly commit: "da9f7e5";
|
|
8
|
+
readonly pr: 1079;
|
|
9
|
+
readonly cut: readonly ["refuseClaudeSubscriptionTurn", "ClaudeSubscriptionGuardState"];
|
|
10
|
+
readonly why: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* True when a turn on this account is paid by a claude.ai subscription.
|
|
14
|
+
*
|
|
15
|
+
* The SDK types `apiKeySource` and `tokenSource` as open strings, so this is an ALLOWLIST: an
|
|
16
|
+
* account bills the subscription only when every field proves it, and an unknown value keeps the
|
|
17
|
+
* guard on rather than assuming the safe case.
|
|
18
|
+
*
|
|
19
|
+
* - `subscriptionType` must be set — without it the CLI reports no subscription.
|
|
20
|
+
* - `tokenSource` must be absent — the CLI sets it in place of the subscription when a bearer or
|
|
21
|
+
* OAuth environment token pays for the turn.
|
|
22
|
+
* - `apiProvider` must be absent or `firstParty` — the Anthropic OAuth login applies only there;
|
|
23
|
+
* for `bedrock`, `vertex`, `foundry` or `gateway` the other fields are absent and auth is
|
|
24
|
+
* external.
|
|
25
|
+
* - `apiKeySource` must not be one of {@link API_KEY_SOURCES_ABOVE_SUBSCRIPTION} — credential
|
|
26
|
+
* precedence puts those above the `/login` subscription, so the key pays and the stored
|
|
27
|
+
* subscription is inert.
|
|
28
|
+
*/
|
|
29
|
+
export declare function billsClaudeSubscription(account: AccountInfo | undefined): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* True when the account already holds a credential this integration accepts: a third-party
|
|
32
|
+
* backend, a bearer/OAuth environment token, or one of the API key sources in
|
|
33
|
+
* {@link API_KEY_SOURCES_ABOVE_SUBSCRIPTION}.
|
|
34
|
+
*
|
|
35
|
+
* False therefore covers BOTH the signed-out CLI and the account whose only credential is a
|
|
36
|
+
* claude.ai subscription. {@link billsClaudeSubscription} runs first and separates the two, so a
|
|
37
|
+
* caller reaching `false` here is looking at a session with no way to pay.
|
|
38
|
+
*/
|
|
39
|
+
export declare function holdsNonSubscriptionCredential(account: AccountInfo | undefined): boolean;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* R7.4 — which half of `#1079` was CUT, and why, stated where a caller will see it rather than
|
|
3
|
+
* only in the ledger. §16.3 of `docs/REBASE-AND-DRIFT.md` is the long form.
|
|
4
|
+
*/
|
|
5
|
+
export const CUT_FROM_UPSTREAM = {
|
|
6
|
+
commit: "da9f7e5",
|
|
7
|
+
pr: 1079,
|
|
8
|
+
cut: ["refuseClaudeSubscriptionTurn", "ClaudeSubscriptionGuardState"],
|
|
9
|
+
why: "Both act on a turn in flight. This fork's engine is story 011's no-op stub — createSession() " +
|
|
10
|
+
"and the ~590-line prompt() loop are CUT pending story 023 — so there is no turn to refuse. " +
|
|
11
|
+
"The classification below is exact and callerless; wire it when 023 lands a turn loop.",
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The `apiKeySource` values that outrank a stored claude.ai subscription.
|
|
15
|
+
*
|
|
16
|
+
* The SDK documents `ApiKeySource` as the origin of the credential used for API requests.
|
|
17
|
+
* `ANTHROPIC_API_KEY` is the environment variable, `apiKeyHelper` the configured helper command,
|
|
18
|
+
* and `/login managed key` a key `/login` created against an Anthropic Console account. Each is
|
|
19
|
+
* an API key that pays INSTEAD of the subscription. Every other member means no API key is in
|
|
20
|
+
* use: `none`, and the legacy `user`/`project`/`org`/`temporary`/`oauth` current CLIs never emit.
|
|
21
|
+
*/
|
|
22
|
+
const API_KEY_SOURCES_ABOVE_SUBSCRIPTION = new Set([
|
|
23
|
+
"ANTHROPIC_API_KEY",
|
|
24
|
+
"apiKeyHelper",
|
|
25
|
+
"/login managed key",
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* True when a turn on this account is paid by a claude.ai subscription.
|
|
29
|
+
*
|
|
30
|
+
* The SDK types `apiKeySource` and `tokenSource` as open strings, so this is an ALLOWLIST: an
|
|
31
|
+
* account bills the subscription only when every field proves it, and an unknown value keeps the
|
|
32
|
+
* guard on rather than assuming the safe case.
|
|
33
|
+
*
|
|
34
|
+
* - `subscriptionType` must be set — without it the CLI reports no subscription.
|
|
35
|
+
* - `tokenSource` must be absent — the CLI sets it in place of the subscription when a bearer or
|
|
36
|
+
* OAuth environment token pays for the turn.
|
|
37
|
+
* - `apiProvider` must be absent or `firstParty` — the Anthropic OAuth login applies only there;
|
|
38
|
+
* for `bedrock`, `vertex`, `foundry` or `gateway` the other fields are absent and auth is
|
|
39
|
+
* external.
|
|
40
|
+
* - `apiKeySource` must not be one of {@link API_KEY_SOURCES_ABOVE_SUBSCRIPTION} — credential
|
|
41
|
+
* precedence puts those above the `/login` subscription, so the key pays and the stored
|
|
42
|
+
* subscription is inert.
|
|
43
|
+
*/
|
|
44
|
+
export function billsClaudeSubscription(account) {
|
|
45
|
+
if (!account?.subscriptionType) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if (account.tokenSource) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (account.apiProvider !== undefined && account.apiProvider !== "firstParty") {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return !API_KEY_SOURCES_ABOVE_SUBSCRIPTION.has(account.apiKeySource ?? "");
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* True when the account already holds a credential this integration accepts: a third-party
|
|
58
|
+
* backend, a bearer/OAuth environment token, or one of the API key sources in
|
|
59
|
+
* {@link API_KEY_SOURCES_ABOVE_SUBSCRIPTION}.
|
|
60
|
+
*
|
|
61
|
+
* False therefore covers BOTH the signed-out CLI and the account whose only credential is a
|
|
62
|
+
* claude.ai subscription. {@link billsClaudeSubscription} runs first and separates the two, so a
|
|
63
|
+
* caller reaching `false` here is looking at a session with no way to pay.
|
|
64
|
+
*/
|
|
65
|
+
export function holdsNonSubscriptionCredential(account) {
|
|
66
|
+
if (!account) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (account.apiProvider !== undefined && account.apiProvider !== "firstParty") {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
if (account.tokenSource) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
return API_KEY_SOURCES_ABOVE_SUBSCRIPTION.has(account.apiKeySource ?? "");
|
|
76
|
+
}
|
package/dist/model-catalog.js
CHANGED
|
@@ -48,6 +48,22 @@ export const MODEL_CATALOG = [
|
|
|
48
48
|
supportedEffortLevels: REASONING_EFFORT_LEVELS,
|
|
49
49
|
supportsAutoMode: true,
|
|
50
50
|
},
|
|
51
|
+
{
|
|
52
|
+
value: "fable51",
|
|
53
|
+
// Bare family name in the title, like fable5/Opus/Sonnet/Haiku; the "Fable 5.1" version lives
|
|
54
|
+
// in the MODEL_VERSION_LABELS prefix that composes the selector description.
|
|
55
|
+
displayName: "Fable",
|
|
56
|
+
// Fable 5.1 (Claude 5 family). Alias and id READ FROM THE INSTALLED BINARY, not guessed:
|
|
57
|
+
// `strings /opt/bin/claude` carries `fable51`, `claude-fable-5-1` and a
|
|
58
|
+
// VERTEX_REGION_CLAUDE_FABLE_5_1 region entry, so the CLI treats it as first class.
|
|
59
|
+
// The description is the same string the live `/model` picker shows for the top of the
|
|
60
|
+
// family — the CLI ships exactly three taglines and none is 5.1-specific, so this is
|
|
61
|
+
// verbatim rather than invented.
|
|
62
|
+
description: "Most capable for your hardest and longest-running tasks",
|
|
63
|
+
supportsEffort: true,
|
|
64
|
+
supportedEffortLevels: REASONING_EFFORT_LEVELS,
|
|
65
|
+
supportsAutoMode: true,
|
|
66
|
+
},
|
|
51
67
|
{
|
|
52
68
|
value: "fable5",
|
|
53
69
|
// Bare family name in the title (like Opus/Sonnet/Haiku); the "Fable 5" version lives in the
|
|
@@ -98,6 +114,7 @@ export const MODEL_CATALOG = [
|
|
|
98
114
|
*/
|
|
99
115
|
export const MODEL_CONTEXT_WINDOWS = {
|
|
100
116
|
default: 1_000_000,
|
|
117
|
+
fable51: 1_000_000,
|
|
101
118
|
fable5: 1_000_000,
|
|
102
119
|
opus: 1_000_000,
|
|
103
120
|
sonnet: 1_000_000,
|
|
@@ -114,6 +131,7 @@ export const MODEL_ID_CONTEXT_WINDOWS = {
|
|
|
114
131
|
"claude-opus-4-8": 1_000_000,
|
|
115
132
|
"claude-opus-4-7": 1_000_000,
|
|
116
133
|
"claude-opus-4-6": 200_000,
|
|
134
|
+
"claude-fable-5-1": 1_000_000,
|
|
117
135
|
"claude-fable-5": 1_000_000,
|
|
118
136
|
"claude-sonnet-5": 1_000_000,
|
|
119
137
|
"claude-sonnet-4-6": 200_000,
|
|
@@ -165,6 +183,7 @@ export function resolveCatalogValueFromModelId(id) {
|
|
|
165
183
|
*/
|
|
166
184
|
export const MODEL_VERSION_LABELS = {
|
|
167
185
|
default: "Opus 4.8 with 1M context",
|
|
186
|
+
fable51: "Fable 5.1 with 1M context",
|
|
168
187
|
fable5: "Fable 5 with 1M context",
|
|
169
188
|
opus: "Opus 4.8 with 1M context",
|
|
170
189
|
sonnet: "Sonnet 5 with 1M context",
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.13.0",
|
|
7
7
|
"description": "Run the official Claude Code TUI in Zed's agent panel on your Claude Pro/Max subscription — an ACP-over-PTY bridge created for Anthropic's billing split (paused June 15; see README).",
|
|
8
8
|
"main": "dist/lib.js",
|
|
9
9
|
"types": "dist/lib.d.ts",
|