@yanlinglabs/winter-runtime-sdk 0.0.3 → 0.0.4
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/door.d.ts
CHANGED
|
@@ -68,11 +68,13 @@ export interface RouterOfficialInput {
|
|
|
68
68
|
*/
|
|
69
69
|
credentials?: readonly AuthCredentialPlan[];
|
|
70
70
|
/**
|
|
71
|
-
* NON-SECRET family variables: a gateway's `ANTHROPIC_BASE_URL`, a region, a project
|
|
71
|
+
* NON-SECRET family variables: a gateway's `ANTHROPIC_BASE_URL`, a region, a project, or (router
|
|
72
|
+
* 0.0.4, C1) a `console-profile` session's `ANTHROPIC_PROFILE` name and `ANTHROPIC_CONFIG_DIR` path.
|
|
72
73
|
*
|
|
73
74
|
* Separate from `credentials` because they are not secrets and must not travel through a keychain
|
|
74
75
|
* read — and because §12's gateway caveat ("set the full credential pair or neither") is checked
|
|
75
|
-
* across both halves by the auth validator, whichever side each variable came from.
|
|
76
|
+
* across both halves by the auth validator, whichever side each variable came from. The same shape
|
|
77
|
+
* applies to `console-profile`'s pairing rule: set both names here or neither.
|
|
76
78
|
*/
|
|
77
79
|
connectionEnv?: Readonly<Record<string, string>>;
|
|
78
80
|
/** §3's minimal OS set. Build it with `minimalOsEnvironmentFrom(process.env)` at the host's call site. */
|
|
@@ -273,16 +275,31 @@ export declare function officialUserTurn(text: string, sessionId: string): Offic
|
|
|
273
275
|
* DERIVED ONLY WHERE THE MAPPING IS UNAMBIGUOUS. `api-key` is one variable; `console-oauth` is a
|
|
274
276
|
* bearer token whose endpoint is non-secret and travels in `connectionEnv` (§12's "gateway configs
|
|
275
277
|
* MUST set the full credential pair" is then checked by the auth validator, across both halves). The
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
278
|
+
* three families that inject nothing (`claude-oauth`, `local-none`, and router 0.0.4's
|
|
279
|
+
* `console-profile` — its `ANTHROPIC_PROFILE`/`ANTHROPIC_CONFIG_DIR` pair are non-secret and travel in
|
|
280
|
+
* `connectionEnv` exactly like `console-oauth`'s base URL, never through a keychain-backed plan)
|
|
281
|
+
* inject nothing. A cloud credential chain and a `custom` family name their own variables, because
|
|
282
|
+
* their sets are the host's: a chain's variables depend on which of Bedrock's or Vertex's several auth
|
|
283
|
+
* modes the deployment uses, and `custom` is open by definition.
|
|
279
284
|
*/
|
|
280
285
|
export declare function officialCredentialPlan(args: {
|
|
281
286
|
selection: RuntimeSelection;
|
|
282
287
|
provider: ProviderSelection | undefined;
|
|
283
288
|
explicit: readonly AuthCredentialPlan[] | undefined;
|
|
284
289
|
}): readonly AuthCredentialPlan[];
|
|
285
|
-
/**
|
|
290
|
+
/**
|
|
291
|
+
* Non-secret connection variables a family sets, from the contract's own `ProviderConnectionConfig`
|
|
292
|
+
* plus whatever the host names in `RouterOfficialInput.connectionEnv`.
|
|
293
|
+
*
|
|
294
|
+
* ROUTER 0.0.4, C1: `console-profile`'s `ANTHROPIC_PROFILE` and `ANTHROPIC_CONFIG_DIR` have no
|
|
295
|
+
* counterpart on `ProviderConnectionConfig` (that shape carries only `baseUrl`, a pinned contract type
|
|
296
|
+
* this package does not extend) and are non-secret by the same reasoning `ANTHROPIC_BASE_URL` is, so a
|
|
297
|
+
* host sets them the identical way — `connectionEnv: { ANTHROPIC_PROFILE, ANTHROPIC_CONFIG_DIR }` —
|
|
298
|
+
* and they ride through `explicit` here unchanged, exactly like any other family's non-secret pair.
|
|
299
|
+
* No family-specific derivation is needed for them the way `console-oauth`'s base URL gets one below,
|
|
300
|
+
* because the host already has both values in hand (a profile name, a directory it manages) and there
|
|
301
|
+
* is no `ProviderSelection` field to read them from instead.
|
|
302
|
+
*/
|
|
286
303
|
export declare function officialConnectionEnv(args: {
|
|
287
304
|
selection: RuntimeSelection;
|
|
288
305
|
provider: ProviderSelection | undefined;
|
|
@@ -431,6 +431,7 @@ var AUTH_FAMILY_VARIABLES = {
|
|
|
431
431
|
"console-oauth": ["ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_BASE_URL"],
|
|
432
432
|
bedrock: ["CLAUDE_CODE_USE_BEDROCK", "AWS_REGION", "AWS_PROFILE", "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "AWS_BEARER_TOKEN_BEDROCK", "ANTHROPIC_BEDROCK_BASE_URL"],
|
|
433
433
|
vertex: ["CLAUDE_CODE_USE_VERTEX", "ANTHROPIC_VERTEX_PROJECT_ID", "CLOUD_ML_REGION", "GOOGLE_APPLICATION_CREDENTIALS", "ANTHROPIC_VERTEX_BASE_URL"],
|
|
434
|
+
"console-profile": ["ANTHROPIC_PROFILE", "ANTHROPIC_CONFIG_DIR"],
|
|
434
435
|
"claude-oauth": [],
|
|
435
436
|
"local-none": []
|
|
436
437
|
};
|
|
@@ -499,6 +500,13 @@ function validateAuthEnvironment(args) {
|
|
|
499
500
|
branchLabel: args.branchLabel
|
|
500
501
|
});
|
|
501
502
|
}
|
|
503
|
+
if (args.selection.authFamily === "console-profile" && names.includes("ANTHROPIC_PROFILE") !== names.includes("ANTHROPIC_CONFIG_DIR")) {
|
|
504
|
+
throw new OfficialConfigurationError({
|
|
505
|
+
option: "credentials",
|
|
506
|
+
reason: "the console-profile family sets ANTHROPIC_PROFILE and ANTHROPIC_CONFIG_DIR together or not at all — one without the other resolves against whatever the CLI's own default profile store holds, silently (router 0.0.4, C1)",
|
|
507
|
+
branchLabel: args.branchLabel
|
|
508
|
+
});
|
|
509
|
+
}
|
|
502
510
|
}
|
|
503
511
|
}
|
|
504
512
|
async function fetchAuthCredentials(args) {
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
officialToolAliases,
|
|
36
36
|
resolveSavedApprovalDisposition,
|
|
37
37
|
targetsForbiddenPath
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-294jzb3e.js";
|
|
39
39
|
|
|
40
40
|
// src/index.ts
|
|
41
41
|
export * from "@yanlinglabs/winter-agent-sdk";
|
|
@@ -456,9 +456,11 @@ function officialUserTurn(text, sessionId) {
|
|
|
456
456
|
return { type: "user", message: { role: "user", content: text }, parent_tool_use_id: null, session_id: sessionId };
|
|
457
457
|
}
|
|
458
458
|
function officialCredentialPlan(args) {
|
|
459
|
+
const family = authVariableSetKey(args.selection);
|
|
460
|
+
if (family === "console-profile")
|
|
461
|
+
return [];
|
|
459
462
|
if (args.explicit !== undefined)
|
|
460
463
|
return args.explicit;
|
|
461
|
-
const family = authVariableSetKey(args.selection);
|
|
462
464
|
if (family === "claude-oauth" || family === "local-none")
|
|
463
465
|
return [];
|
|
464
466
|
const ref = args.provider?.authRef;
|
package/dist/official/auth.d.ts
CHANGED
|
@@ -25,6 +25,17 @@ export declare const AUTH_FAMILY_VARIABLES: {
|
|
|
25
25
|
readonly "console-oauth": readonly ["ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_BASE_URL"];
|
|
26
26
|
readonly bedrock: readonly ["CLAUDE_CODE_USE_BEDROCK", "AWS_REGION", "AWS_PROFILE", "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "AWS_BEARER_TOKEN_BEDROCK", "ANTHROPIC_BEDROCK_BASE_URL"];
|
|
27
27
|
readonly vertex: readonly ["CLAUDE_CODE_USE_VERTEX", "ANTHROPIC_VERTEX_PROJECT_ID", "CLOUD_ML_REGION", "GOOGLE_APPLICATION_CREDENTIALS", "ANTHROPIC_VERTEX_BASE_URL"];
|
|
28
|
+
/**
|
|
29
|
+
* router 0.0.4, C1: the Anthropic Console CLI's own PROFILE. Both names are NON-SECRET (a profile
|
|
30
|
+
* name and a directory path, not material) and NEITHER is a bearer credential — the profile store the
|
|
31
|
+
* CLI already manages at `ANTHROPIC_CONFIG_DIR` owns the token, so this family injects nothing that
|
|
32
|
+
* could re-point billing by itself. `officialCredentialPlan` (`door.ts`) treats it exactly like
|
|
33
|
+
* `claude-oauth`/`local-none`: an EMPTY plan, even when `provider.authRef` resolves to material, so a
|
|
34
|
+
* host that also has an API key configured never leaks it in here by accident. `ANTHROPIC_API_KEY`
|
|
35
|
+
* and `ANTHROPIC_AUTH_TOKEN` are refused for this family by the same family-membership check every
|
|
36
|
+
* other row already gets (§12's "exactly one auth family").
|
|
37
|
+
*/
|
|
38
|
+
readonly "console-profile": readonly ["ANTHROPIC_PROFILE", "ANTHROPIC_CONFIG_DIR"];
|
|
28
39
|
/**
|
|
29
40
|
* §12's last row: NONE. "Claude OAuth (D14-gated) — stored subscription credentials live inside the
|
|
30
41
|
* spool namespace; no env credential injected." The empty set is the rule, not an oversight.
|
|
@@ -34,7 +34,18 @@ export interface RuntimeSelection {
|
|
|
34
34
|
*/
|
|
35
35
|
modelRef: string;
|
|
36
36
|
family: string;
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* `"console-profile"` (router 0.0.4, C1): the Anthropic Console CLI's own PROFILE — `ANTHROPIC_PROFILE`
|
|
39
|
+
* + `ANTHROPIC_CONFIG_DIR`, no bearer credential in the child at all (the profile store the CLI already
|
|
40
|
+
* manages owns the token). Distinct from `"console-oauth"`, which injects a bearer pair the router
|
|
41
|
+
* itself resolves (`ANTHROPIC_AUTH_TOKEN` + `ANTHROPIC_BASE_URL`) — reusing that family would either
|
|
42
|
+
* demand a token this flow never has or let the two mechanisms silently race on precedence. Reachable
|
|
43
|
+
* only by explicit declaration, the same as `claude-oauth`: never inferred from a credential ref's
|
|
44
|
+
* storage kind (`authFamilyFromRefKind`) and not a member of `OFFICIAL_SERVED_AUTH_FAMILIES`, so the
|
|
45
|
+
* D13 auto-selector never routes to it on its own — a host that wants this family builds the
|
|
46
|
+
* `RuntimeSelection` for it directly, the same shape a `custom` or `claude-oauth` host already does.
|
|
47
|
+
*/
|
|
48
|
+
authFamily: "api-key" | "cloud-credential-chain" | "claude-oauth" | "console-oauth" | "console-profile" | "local-none" | "custom";
|
|
38
49
|
sdkVersion: string;
|
|
39
50
|
engineVersion?: string;
|
|
40
51
|
reason: string;
|
package/dist/testing/host.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yanlinglabs/winter-runtime-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "One door over the Winter Agent SDK and the official Claude Agent SDK: runtime selection, the official-SDK adapter, the shared session store, the handoff barrier and the cross-runtime messaging router.",
|