@agentskit/adapters 0.13.12 → 0.13.16

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.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { G as GenericAdapterConfig } from './createAdapter-Dfnf3Iio.cjs';
2
- export { C as CreateAdapterConfig, c as createAdapter } from './createAdapter-Dfnf3Iio.cjs';
1
+ import { G as GenericAdapterConfig } from './createAdapter-C-pKR1aO.cjs';
2
+ export { C as CreateAdapterConfig, c as createAdapter } from './createAdapter-C-pKR1aO.cjs';
3
3
  import * as _agentskit_core from '@agentskit/core';
4
4
  import { AdapterFactory, AdapterRequest, DataRegion, AdapterCapabilities, StreamChunk, EmbedFn } from '@agentskit/core';
5
5
  export { DataRegion } from '@agentskit/core';
@@ -284,10 +284,15 @@ interface BedrockConfig {
284
284
  /**
285
285
  * Minimal structural type for `BedrockRuntimeClient` so we don't take a hard
286
286
  * dep on `@aws-sdk/client-bedrock-runtime`.
287
+ *
288
+ * Second options argument is optional so existing one-argument injected
289
+ * clients remain structurally valid.
287
290
  */
288
291
  interface BedrockRuntimeClientLike {
289
292
  send(command: {
290
293
  input: BedrockInvokeInput;
294
+ }, options?: {
295
+ abortSignal?: AbortSignal;
291
296
  }): Promise<{
292
297
  body?: AsyncIterable<{
293
298
  chunk?: {
@@ -349,7 +354,13 @@ interface WebLlmEngineLike {
349
354
  content?: string;
350
355
  };
351
356
  }>;
352
- }>;
357
+ }> | Promise<AsyncIterable<{
358
+ choices: Array<{
359
+ delta?: {
360
+ content?: string;
361
+ };
362
+ }>;
363
+ }>>;
353
364
  };
354
365
  };
355
366
  }
@@ -731,20 +742,25 @@ declare function withDeprecationPolicy<F extends AdapterFactory>(factory: F, opt
731
742
  } & DeprecationPolicy): F;
732
743
 
733
744
  /**
734
- * Credential rotation hook for adapters. Today rotating a provider key
735
- * means bouncing the runtime — unacceptable for 24/7 production.
745
+ * Opt-in credential rotation primitives.
736
746
  *
737
- * Adapters opt in by accepting `apiKey` as either a `string`, a
738
- * `() => string | Promise<string>`, or a `RotatingCredentials` holder.
739
- * The holder lets external code (Vault, AWS Secrets Manager, KMS)
740
- * push a new value without restart, and `refreshCredentials()` is the
741
- * one-call API that performs the swap and emits an audit event.
747
+ * These utilities do **not** automatically wire into stock adapters. Built-in
748
+ * factories (openai, anthropic, bedrock, vertex, …) still take a plain
749
+ * `apiKey` / `accessToken` string (or a caller-supplied resolver) at
750
+ * construction. Use `createRotatingCredentials` / `refreshCredentials` only
751
+ * when you explicitly opt in — e.g. custom wrappers that call `current()` on
752
+ * every request, or adapters you implement that expose
753
+ * `CredentialRefreshable.refreshCredentials`.
742
754
  *
743
- * Closes issue #799.
755
+ * Without that opt-in, rotating a provider key still means reconstructing the
756
+ * adapter (or restarting the process). The helpers stay exported so production
757
+ * apps can build that layer without re-inventing the holder + audit event shape.
758
+ *
759
+ * Closes issue #799 (primitives only; adapter adoption is opt-in).
744
760
  */
745
761
  type CredentialResolver = () => string | Promise<string>;
746
762
  interface RotatingCredentials {
747
- /** Resolve the current secret. Adapters call this on every request. */
763
+ /** Resolve the current secret. Opt-in adapters call this on every request. */
748
764
  current: CredentialResolver;
749
765
  /** Replace the in-memory secret. Returns the new value. */
750
766
  rotate: (next: string) => Promise<string>;
@@ -761,7 +777,8 @@ interface CredentialRotationEvent {
761
777
  }
762
778
  interface CredentialRefreshable {
763
779
  /**
764
- * Adapters that support credential rotation expose this method.
780
+ * Opt-in adapters that support credential rotation expose this method.
781
+ * Stock AgentsKit adapters do not implement it unless documented otherwise.
765
782
  * Calling it replaces the in-memory secret. The next request uses
766
783
  * the new value; in-flight requests are unaffected.
767
784
  */
@@ -775,6 +792,9 @@ declare function createRotatingCredentials(initial: string, options: {
775
792
  * `CredentialRefreshable`. A no-op (with a debug log) if the adapter
776
793
  * doesn't support rotation, so callers can run the rotation playbook
777
794
  * across a heterogeneous set of adapters without branching.
795
+ *
796
+ * Most stock adapters do **not** implement `refreshCredentials` — this
797
+ * remains an opt-in primitive unless an adapter documents support.
778
798
  */
779
799
  declare function refreshCredentials(adapter: unknown, next: string, options?: {
780
800
  id?: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { G as GenericAdapterConfig } from './createAdapter-Dfnf3Iio.js';
2
- export { C as CreateAdapterConfig, c as createAdapter } from './createAdapter-Dfnf3Iio.js';
1
+ import { G as GenericAdapterConfig } from './createAdapter-C-pKR1aO.js';
2
+ export { C as CreateAdapterConfig, c as createAdapter } from './createAdapter-C-pKR1aO.js';
3
3
  import * as _agentskit_core from '@agentskit/core';
4
4
  import { AdapterFactory, AdapterRequest, DataRegion, AdapterCapabilities, StreamChunk, EmbedFn } from '@agentskit/core';
5
5
  export { DataRegion } from '@agentskit/core';
@@ -284,10 +284,15 @@ interface BedrockConfig {
284
284
  /**
285
285
  * Minimal structural type for `BedrockRuntimeClient` so we don't take a hard
286
286
  * dep on `@aws-sdk/client-bedrock-runtime`.
287
+ *
288
+ * Second options argument is optional so existing one-argument injected
289
+ * clients remain structurally valid.
287
290
  */
288
291
  interface BedrockRuntimeClientLike {
289
292
  send(command: {
290
293
  input: BedrockInvokeInput;
294
+ }, options?: {
295
+ abortSignal?: AbortSignal;
291
296
  }): Promise<{
292
297
  body?: AsyncIterable<{
293
298
  chunk?: {
@@ -349,7 +354,13 @@ interface WebLlmEngineLike {
349
354
  content?: string;
350
355
  };
351
356
  }>;
352
- }>;
357
+ }> | Promise<AsyncIterable<{
358
+ choices: Array<{
359
+ delta?: {
360
+ content?: string;
361
+ };
362
+ }>;
363
+ }>>;
353
364
  };
354
365
  };
355
366
  }
@@ -731,20 +742,25 @@ declare function withDeprecationPolicy<F extends AdapterFactory>(factory: F, opt
731
742
  } & DeprecationPolicy): F;
732
743
 
733
744
  /**
734
- * Credential rotation hook for adapters. Today rotating a provider key
735
- * means bouncing the runtime — unacceptable for 24/7 production.
745
+ * Opt-in credential rotation primitives.
736
746
  *
737
- * Adapters opt in by accepting `apiKey` as either a `string`, a
738
- * `() => string | Promise<string>`, or a `RotatingCredentials` holder.
739
- * The holder lets external code (Vault, AWS Secrets Manager, KMS)
740
- * push a new value without restart, and `refreshCredentials()` is the
741
- * one-call API that performs the swap and emits an audit event.
747
+ * These utilities do **not** automatically wire into stock adapters. Built-in
748
+ * factories (openai, anthropic, bedrock, vertex, …) still take a plain
749
+ * `apiKey` / `accessToken` string (or a caller-supplied resolver) at
750
+ * construction. Use `createRotatingCredentials` / `refreshCredentials` only
751
+ * when you explicitly opt in — e.g. custom wrappers that call `current()` on
752
+ * every request, or adapters you implement that expose
753
+ * `CredentialRefreshable.refreshCredentials`.
742
754
  *
743
- * Closes issue #799.
755
+ * Without that opt-in, rotating a provider key still means reconstructing the
756
+ * adapter (or restarting the process). The helpers stay exported so production
757
+ * apps can build that layer without re-inventing the holder + audit event shape.
758
+ *
759
+ * Closes issue #799 (primitives only; adapter adoption is opt-in).
744
760
  */
745
761
  type CredentialResolver = () => string | Promise<string>;
746
762
  interface RotatingCredentials {
747
- /** Resolve the current secret. Adapters call this on every request. */
763
+ /** Resolve the current secret. Opt-in adapters call this on every request. */
748
764
  current: CredentialResolver;
749
765
  /** Replace the in-memory secret. Returns the new value. */
750
766
  rotate: (next: string) => Promise<string>;
@@ -761,7 +777,8 @@ interface CredentialRotationEvent {
761
777
  }
762
778
  interface CredentialRefreshable {
763
779
  /**
764
- * Adapters that support credential rotation expose this method.
780
+ * Opt-in adapters that support credential rotation expose this method.
781
+ * Stock AgentsKit adapters do not implement it unless documented otherwise.
765
782
  * Calling it replaces the in-memory secret. The next request uses
766
783
  * the new value; in-flight requests are unaffected.
767
784
  */
@@ -775,6 +792,9 @@ declare function createRotatingCredentials(initial: string, options: {
775
792
  * `CredentialRefreshable`. A no-op (with a debug log) if the adapter
776
793
  * doesn't support rotation, so callers can run the rotation playbook
777
794
  * across a heterogeneous set of adapters without branching.
795
+ *
796
+ * Most stock adapters do **not** implement `refreshCredentials` — this
797
+ * remains an opt-in primitive unless an adapter documents support.
778
798
  */
779
799
  declare function refreshCredentials(adapter: unknown, next: string, options?: {
780
800
  id?: string;