@jambonz/llm 0.6.7 → 0.6.9

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.
@@ -1,4 +1,4 @@
1
- import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-dbgrfviJ.cjs';
1
+ import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-C_yrWq_0.cjs';
2
2
 
3
3
  /**
4
4
  * Named scenarios the harness must be able to stage. Each scenario configures
@@ -1,4 +1,4 @@
1
- import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-dbgrfviJ.js';
1
+ import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-C_yrWq_0.js';
2
2
 
3
3
  /**
4
4
  * Named scenarios the harness must be able to stage. Each scenario configures
@@ -3,8 +3,9 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";
3
3
 
4
4
  // src/registry.ts
5
5
  var registry = /* @__PURE__ */ new Map();
6
+ var credentialVendors = /* @__PURE__ */ new Map();
6
7
  function registerAdapter(factory) {
7
- if (registry.has(factory.vendor)) {
8
+ if (registry.has(factory.vendor) || credentialVendors.has(factory.vendor)) {
8
9
  throw new Error(
9
10
  `Adapter already registered for vendor '${factory.vendor}'. Use replaceAdapter() if you intended to override.`
10
11
  );
@@ -16,9 +17,23 @@ function registerAdapter(factory) {
16
17
  }
17
18
  registry.set(factory.vendor, factory);
18
19
  }
20
+ function registerCredentialVendor(manifest) {
21
+ if (!manifest.credentialOnly) {
22
+ throw new Error(`Vendor '${manifest.vendor}' manifest is not marked credentialOnly.`);
23
+ }
24
+ if (registry.has(manifest.vendor) || credentialVendors.has(manifest.vendor)) {
25
+ throw new Error(`Vendor '${manifest.vendor}' is already registered.`);
26
+ }
27
+ credentialVendors.set(manifest.vendor, manifest);
28
+ }
19
29
  function getAdapterFactory(vendor) {
20
30
  const factory = registry.get(vendor);
21
31
  if (!factory) {
32
+ if (credentialVendors.has(vendor)) {
33
+ throw new Error(
34
+ `Vendor '${vendor}' is credential-only: @jambonz/llm has no adapter for it.`
35
+ );
36
+ }
22
37
  const known = Array.from(registry.keys()).sort().join(", ") || "(none)";
23
38
  throw new Error(
24
39
  `Unknown vendor '${vendor}'. Registered vendors: ${known}`
@@ -28,6 +43,7 @@ function getAdapterFactory(vendor) {
28
43
  }
29
44
  function _resetRegistryForTests() {
30
45
  registry.clear();
46
+ credentialVendors.clear();
31
47
  }
32
48
 
33
49
  // src/adapters/openai/adapter.ts
@@ -3718,6 +3734,92 @@ var openRouterFactory = {
3718
3734
  create: () => new OpenRouterAdapter()
3719
3735
  };
3720
3736
 
3737
+ // src/vendors/harness.ts
3738
+ var harnessManifest = {
3739
+ vendor: "harness",
3740
+ displayName: "Harness",
3741
+ authKinds: [
3742
+ {
3743
+ // Only the form schema matters for a credential-only vendor; no
3744
+ // AuthSpec is ever built from it.
3745
+ kind: "apiKey",
3746
+ displayName: "API Key",
3747
+ fields: [
3748
+ {
3749
+ name: "url",
3750
+ label: "WebSocket URL",
3751
+ type: "url",
3752
+ required: true,
3753
+ help: "wss:// URL of your harness. ws:// is accepted only for a private or localhost address."
3754
+ },
3755
+ {
3756
+ name: "apiKey",
3757
+ label: "API Key",
3758
+ type: "password",
3759
+ required: true,
3760
+ help: 'Sent to the harness as "Authorization: Bearer <key>" when each call connects.'
3761
+ }
3762
+ ]
3763
+ }
3764
+ ],
3765
+ knownModels: [],
3766
+ supportsModelListing: false,
3767
+ credentialOnly: true,
3768
+ category: "llm"
3769
+ };
3770
+
3771
+ // src/vendors/dialogflow-ces.ts
3772
+ var dialogflowCesManifest = {
3773
+ vendor: "dialogflow_ces",
3774
+ displayName: "Dialogflow CES",
3775
+ authKinds: [
3776
+ {
3777
+ kind: "googleServiceAccount",
3778
+ displayName: "Service Account JSON",
3779
+ fields: [
3780
+ {
3781
+ name: "credentials",
3782
+ label: "Service Account Key (JSON)",
3783
+ type: "json-file",
3784
+ required: true,
3785
+ help: "The key of a service account allowed to run your CES agents (Customer Engagement Suite)."
3786
+ }
3787
+ ]
3788
+ }
3789
+ ],
3790
+ knownModels: [],
3791
+ supportsModelListing: false,
3792
+ docsUrl: "https://cloud.google.com/customer-engagement-ai/conversational-agents/ps",
3793
+ credentialOnly: true,
3794
+ category: "hosted"
3795
+ };
3796
+
3797
+ // src/vendors/openai-s2s.ts
3798
+ var openaiS2sManifest = {
3799
+ vendor: "openai_s2s",
3800
+ displayName: "OpenAI Realtime",
3801
+ authKinds: [
3802
+ {
3803
+ kind: "apiKey",
3804
+ displayName: "API Key",
3805
+ fields: [
3806
+ {
3807
+ name: "apiKey",
3808
+ label: "API Key",
3809
+ type: "password",
3810
+ required: true,
3811
+ help: "An OpenAI API key with access to the Realtime API."
3812
+ }
3813
+ ]
3814
+ }
3815
+ ],
3816
+ knownModels: [],
3817
+ supportsModelListing: false,
3818
+ docsUrl: "https://platform.openai.com/docs/guides/realtime",
3819
+ credentialOnly: true,
3820
+ category: "s2s"
3821
+ };
3822
+
3721
3823
  // src/adapters/index.ts
3722
3824
  registerAdapter(openAIFactory);
3723
3825
  registerAdapter(deepseekFactory);
@@ -3735,6 +3837,9 @@ registerAdapter(azureOpenAIFactory);
3735
3837
  registerAdapter(groqFactory);
3736
3838
  registerAdapter(huggingfaceFactory);
3737
3839
  registerAdapter(openRouterFactory);
3840
+ registerCredentialVendor(harnessManifest);
3841
+ registerCredentialVendor(openaiS2sManifest);
3842
+ registerCredentialVendor(dialogflowCesManifest);
3738
3843
 
3739
3844
  // src/index.ts
3740
3845
  async function createLlm(args) {