@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.
package/dist/index.cjs CHANGED
@@ -34,6 +34,7 @@ __export(src_exports, {
34
34
  createLlm: () => createLlm,
35
35
  getAdapterFactory: () => getAdapterFactory,
36
36
  getManifest: () => getManifest,
37
+ getVendorManifest: () => getVendorManifest,
37
38
  listVendors: () => listVendors,
38
39
  normalizeAuth: () => normalizeAuth,
39
40
  pickAuthKind: () => pickAuthKind,
@@ -45,8 +46,9 @@ module.exports = __toCommonJS(src_exports);
45
46
 
46
47
  // src/registry.ts
47
48
  var registry = /* @__PURE__ */ new Map();
49
+ var credentialVendors = /* @__PURE__ */ new Map();
48
50
  function registerAdapter(factory) {
49
- if (registry.has(factory.vendor)) {
51
+ if (registry.has(factory.vendor) || credentialVendors.has(factory.vendor)) {
50
52
  throw new Error(
51
53
  `Adapter already registered for vendor '${factory.vendor}'. Use replaceAdapter() if you intended to override.`
52
54
  );
@@ -58,6 +60,15 @@ function registerAdapter(factory) {
58
60
  }
59
61
  registry.set(factory.vendor, factory);
60
62
  }
63
+ function registerCredentialVendor(manifest) {
64
+ if (!manifest.credentialOnly) {
65
+ throw new Error(`Vendor '${manifest.vendor}' manifest is not marked credentialOnly.`);
66
+ }
67
+ if (registry.has(manifest.vendor) || credentialVendors.has(manifest.vendor)) {
68
+ throw new Error(`Vendor '${manifest.vendor}' is already registered.`);
69
+ }
70
+ credentialVendors.set(manifest.vendor, manifest);
71
+ }
61
72
  function replaceAdapter(factory) {
62
73
  registry.set(factory.vendor, factory);
63
74
  }
@@ -67,6 +78,11 @@ function unregisterAdapter(vendor) {
67
78
  function getAdapterFactory(vendor) {
68
79
  const factory = registry.get(vendor);
69
80
  if (!factory) {
81
+ if (credentialVendors.has(vendor)) {
82
+ throw new Error(
83
+ `Vendor '${vendor}' is credential-only: @jambonz/llm has no adapter for it.`
84
+ );
85
+ }
70
86
  const known = Array.from(registry.keys()).sort().join(", ") || "(none)";
71
87
  throw new Error(
72
88
  `Unknown vendor '${vendor}'. Registered vendors: ${known}`
@@ -74,11 +90,22 @@ function getAdapterFactory(vendor) {
74
90
  }
75
91
  return factory;
76
92
  }
93
+ function getVendorManifest(vendor) {
94
+ const manifest = registry.get(vendor)?.manifest ?? credentialVendors.get(vendor);
95
+ if (!manifest) {
96
+ const known = [...registry.keys(), ...credentialVendors.keys()].sort().join(", ") || "(none)";
97
+ throw new Error(`Unknown vendor '${vendor}'. Registered vendors: ${known}`);
98
+ }
99
+ return manifest;
100
+ }
77
101
  function listVendors() {
78
102
  return Array.from(registry.keys()).sort();
79
103
  }
80
104
  function getManifest() {
81
- const vendors = Array.from(registry.values()).map((f) => f.manifest).sort((a, b) => a.vendor.localeCompare(b.vendor));
105
+ const vendors = [
106
+ ...Array.from(registry.values()).map((f) => f.manifest),
107
+ ...credentialVendors.values()
108
+ ].map((m) => ({ ...m, category: m.category ?? "llm" })).sort((a, b) => a.vendor.localeCompare(b.vendor));
82
109
  return { vendors };
83
110
  }
84
111
 
@@ -3764,6 +3791,92 @@ var openRouterFactory = {
3764
3791
  create: () => new OpenRouterAdapter()
3765
3792
  };
3766
3793
 
3794
+ // src/vendors/harness.ts
3795
+ var harnessManifest = {
3796
+ vendor: "harness",
3797
+ displayName: "Harness",
3798
+ authKinds: [
3799
+ {
3800
+ // Only the form schema matters for a credential-only vendor; no
3801
+ // AuthSpec is ever built from it.
3802
+ kind: "apiKey",
3803
+ displayName: "API Key",
3804
+ fields: [
3805
+ {
3806
+ name: "url",
3807
+ label: "WebSocket URL",
3808
+ type: "url",
3809
+ required: true,
3810
+ help: "wss:// URL of your harness. ws:// is accepted only for a private or localhost address."
3811
+ },
3812
+ {
3813
+ name: "apiKey",
3814
+ label: "API Key",
3815
+ type: "password",
3816
+ required: true,
3817
+ help: 'Sent to the harness as "Authorization: Bearer <key>" when each call connects.'
3818
+ }
3819
+ ]
3820
+ }
3821
+ ],
3822
+ knownModels: [],
3823
+ supportsModelListing: false,
3824
+ credentialOnly: true,
3825
+ category: "llm"
3826
+ };
3827
+
3828
+ // src/vendors/dialogflow-ces.ts
3829
+ var dialogflowCesManifest = {
3830
+ vendor: "dialogflow_ces",
3831
+ displayName: "Dialogflow CES",
3832
+ authKinds: [
3833
+ {
3834
+ kind: "googleServiceAccount",
3835
+ displayName: "Service Account JSON",
3836
+ fields: [
3837
+ {
3838
+ name: "credentials",
3839
+ label: "Service Account Key (JSON)",
3840
+ type: "json-file",
3841
+ required: true,
3842
+ help: "The key of a service account allowed to run your CES agents (Customer Engagement Suite)."
3843
+ }
3844
+ ]
3845
+ }
3846
+ ],
3847
+ knownModels: [],
3848
+ supportsModelListing: false,
3849
+ docsUrl: "https://cloud.google.com/customer-engagement-ai/conversational-agents/ps",
3850
+ credentialOnly: true,
3851
+ category: "hosted"
3852
+ };
3853
+
3854
+ // src/vendors/openai-s2s.ts
3855
+ var openaiS2sManifest = {
3856
+ vendor: "openai_s2s",
3857
+ displayName: "OpenAI Realtime",
3858
+ authKinds: [
3859
+ {
3860
+ kind: "apiKey",
3861
+ displayName: "API Key",
3862
+ fields: [
3863
+ {
3864
+ name: "apiKey",
3865
+ label: "API Key",
3866
+ type: "password",
3867
+ required: true,
3868
+ help: "An OpenAI API key with access to the Realtime API."
3869
+ }
3870
+ ]
3871
+ }
3872
+ ],
3873
+ knownModels: [],
3874
+ supportsModelListing: false,
3875
+ docsUrl: "https://platform.openai.com/docs/guides/realtime",
3876
+ credentialOnly: true,
3877
+ category: "s2s"
3878
+ };
3879
+
3767
3880
  // src/adapters/index.ts
3768
3881
  registerAdapter(openAIFactory);
3769
3882
  registerAdapter(deepseekFactory);
@@ -3781,6 +3894,9 @@ registerAdapter(azureOpenAIFactory);
3781
3894
  registerAdapter(groqFactory);
3782
3895
  registerAdapter(huggingfaceFactory);
3783
3896
  registerAdapter(openRouterFactory);
3897
+ registerCredentialVendor(harnessManifest);
3898
+ registerCredentialVendor(openaiS2sManifest);
3899
+ registerCredentialVendor(dialogflowCesManifest);
3784
3900
 
3785
3901
  // src/normalize-auth.ts
3786
3902
  function normalizeAuth(vendor, raw) {
@@ -3928,8 +4044,7 @@ function parseServiceKey(value) {
3928
4044
 
3929
4045
  // src/pick-auth-kind.ts
3930
4046
  function pickAuthKind(vendor, raw) {
3931
- const factory = getAdapterFactory(vendor);
3932
- const { authKinds } = factory.manifest;
4047
+ const { authKinds } = getVendorManifest(vendor);
3933
4048
  if (authKinds.length === 1) {
3934
4049
  return authKinds[0];
3935
4050
  }
@@ -3990,6 +4105,7 @@ async function createLlm(args) {
3990
4105
  createLlm,
3991
4106
  getAdapterFactory,
3992
4107
  getManifest,
4108
+ getVendorManifest,
3993
4109
  listVendors,
3994
4110
  normalizeAuth,
3995
4111
  pickAuthKind,