@rulvar/anthropic 1.16.0 → 1.16.1

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/index.d.ts CHANGED
@@ -93,11 +93,14 @@ interface AnthropicAdapterOptions {
93
93
  * credentials itself: `ANTHROPIC_API_KEY`, then bearer
94
94
  * `ANTHROPIC_AUTH_TOKEN`, then its config-file credential chain. When
95
95
  * `sdkOptions` carries structured auth (`credentials`, `config`, or
96
- * `profile`) and no `apiKey`/`authToken` is set anywhere, ambient
97
- * environment credentials are suppressed (explicit `apiKey: null,
98
- * authToken: null` are passed to the SDK), so the configured provider
99
- * is the one that authenticates; the SDK itself would otherwise let an
100
- * environment `ANTHROPIC_API_KEY` win over the provider.
96
+ * `profile`) and no `apiKey`/`authToken` is set to a string anywhere,
97
+ * ambient environment credentials are suppressed (explicit
98
+ * `apiKey: null, authToken: null` are passed to the SDK), so the
99
+ * configured provider is the one that authenticates; the SDK itself
100
+ * would otherwise let an environment `ANTHROPIC_API_KEY` or
101
+ * `ANTHROPIC_AUTH_TOKEN` win over the provider. An explicit
102
+ * `apiKey: null` or `authToken: null` counts as absence for this rule,
103
+ * never as a chosen credential.
101
104
  */
102
105
  declare function anthropic(options?: AnthropicAdapterOptions): ProviderAdapter;
103
106
  //#endregion
package/dist/index.js CHANGED
@@ -675,7 +675,7 @@ function resolveAnthropicClient(options) {
675
675
  const sdkOptions = options.sdkOptions ?? {};
676
676
  if (options.apiKey !== void 0 && sdkOptions.apiKey !== void 0) throw new ConfigError("anthropic(): 'apiKey' and 'sdkOptions.apiKey' are both set; pick one place");
677
677
  if (options.baseURL !== void 0 && sdkOptions.baseURL !== void 0) throw new ConfigError("anthropic(): 'baseURL' and 'sdkOptions.baseURL' are both set; pick one place");
678
- const suppressAmbientEnv = (sdkOptions.credentials != null || sdkOptions.config != null || sdkOptions.profile != null) && options.apiKey === void 0 && sdkOptions.apiKey === void 0 && sdkOptions.authToken === void 0;
678
+ const suppressAmbientEnv = (sdkOptions.credentials != null || sdkOptions.config != null || sdkOptions.profile != null) && options.apiKey == null && sdkOptions.apiKey == null && sdkOptions.authToken == null;
679
679
  return new Anthropic({
680
680
  ...sdkOptions,
681
681
  ...suppressAmbientEnv ? {
@@ -694,11 +694,14 @@ function resolveAnthropicClient(options) {
694
694
  * credentials itself: `ANTHROPIC_API_KEY`, then bearer
695
695
  * `ANTHROPIC_AUTH_TOKEN`, then its config-file credential chain. When
696
696
  * `sdkOptions` carries structured auth (`credentials`, `config`, or
697
- * `profile`) and no `apiKey`/`authToken` is set anywhere, ambient
698
- * environment credentials are suppressed (explicit `apiKey: null,
699
- * authToken: null` are passed to the SDK), so the configured provider
700
- * is the one that authenticates; the SDK itself would otherwise let an
701
- * environment `ANTHROPIC_API_KEY` win over the provider.
697
+ * `profile`) and no `apiKey`/`authToken` is set to a string anywhere,
698
+ * ambient environment credentials are suppressed (explicit
699
+ * `apiKey: null, authToken: null` are passed to the SDK), so the
700
+ * configured provider is the one that authenticates; the SDK itself
701
+ * would otherwise let an environment `ANTHROPIC_API_KEY` or
702
+ * `ANTHROPIC_AUTH_TOKEN` win over the provider. An explicit
703
+ * `apiKey: null` or `authToken: null` counts as absence for this rule,
704
+ * never as a chosen credential.
702
705
  */
703
706
  function anthropic(options = {}) {
704
707
  const client = resolveAnthropicClient(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/anthropic",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "Rulvar first-class provider adapter over @anthropic-ai/sdk.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -23,13 +23,13 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@anthropic-ai/sdk": "^0.110.0",
26
- "@rulvar/core": "1.16.0"
26
+ "@rulvar/core": "1.16.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^22.20.0",
30
30
  "tsdown": "^0.22.3",
31
31
  "typescript": "~6.0.3",
32
- "@rulvar/testing": "1.16.0"
32
+ "@rulvar/testing": "1.16.1"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",