You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Bailian credentials come from bl's auth chain: --api-key > DASHSCOPE_API_KEY > `bl auth login` (active config profile).",
53
53
"Other providers read the env vars referenced in agents.yaml (e.g. ${ANTHROPIC_API_KEY}), including .env and ~/.agents/config.json.",
54
+
"Only the providers this run involves (--provider, or the config's default provider chain) need credentials; other configured providers are not checked.",
54
55
"Resolved credentials are injected into the SDK in-memory and cleared from the environment; they never persist in process env.",
55
56
];
56
57
58
+
/**
59
+
* Shared `--help` note for commands that never talk to a provider: they load
60
+
* agents.yaml / local state only, so no login or provider key is required.
61
+
*/
62
+
exportconstOFFLINE_NOTE=[
63
+
"Runs fully offline against local files: no login or provider credentials required.",
64
+
];
65
+
57
66
/**
58
67
* Load the SDK's env-based credential sources (`.env`, `~/.agents/config.json`)
59
68
* for non-bailian providers, then placeholder every credential var that is still
@@ -72,15 +81,18 @@ export function prepareProviderEnv(): void {
72
81
/**
73
82
* Override the bailian provider block with bl's authStage-resolved credential, so
74
83
* the bailian API key is authoritatively the CLI auth chain's — never a config
75
-
* file bare-read or a stale env value. `api_key` is replaced unconditionally;
76
-
* `base_url` / `workspace_id` are filled only when the block references them and
77
-
* the interpolated value is empty (a literal in agents.yaml is respected).
84
+
* file bare-read or a stale env value. `api_key` is replaced unconditionally
85
+
* when a credential resolved; `base_url` / `workspace_id` are filled only when
86
+
* the block references them and the interpolated value is empty (a literal in
87
+
* agents.yaml is respected).
78
88
*
79
89
* `base_url` carries {@link AGENTSTUDIO_API_PATH} because the SDK appends resource
80
90
* paths onto it verbatim; a value already ending in the suffix is left as-is.
81
-
* With no credential (only under --dry-run: authStage hard-gates otherwise) the
82
-
* bailian block is left untouched. Non-bailian blocks keep their interpolated
83
-
* (env-sourced) values.
91
+
* It is filled even without a credential — `client.baseUrl` is readable
92
+
* credential-less (defaults to the CLI's model-domain base URL) — so offline /
93
+
* out-of-scope runs still satisfy the SDK's "workspace_id or base_url" schema.
94
+
* With no credential the `api_key` is left untouched: an in-scope empty key is
95
+
* rejected by {@link assertProviderCredentials}, out-of-scope ones may stay empty.
84
96
*/
85
97
exportfunctioninjectProviderCredentials(
86
98
providers: Record<string,unknown>,
@@ -91,16 +103,14 @@ export function injectProviderCredentials(
91
103
constblock=bailianasRecord<string,unknown>;
92
104
93
105
constcred=host.client.exportApiCredential();
94
-
if(cred){
95
-
block.api_key=cred.token;
96
-
if("base_url"inblock&&!block.base_url){
97
-
// Defensive normalization: the auth chain already normalizes base_url to
98
-
// an origin, but never let a trailing slash produce "//api/v1/agentstudio".
0 commit comments