@jambonz/llm 0.6.7 → 0.6.8

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-4l2etrW-.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-4l2etrW-.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,39 @@ 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
+ };
3769
+
3721
3770
  // src/adapters/index.ts
3722
3771
  registerAdapter(openAIFactory);
3723
3772
  registerAdapter(deepseekFactory);
@@ -3735,6 +3784,7 @@ registerAdapter(azureOpenAIFactory);
3735
3784
  registerAdapter(groqFactory);
3736
3785
  registerAdapter(huggingfaceFactory);
3737
3786
  registerAdapter(openRouterFactory);
3787
+ registerCredentialVendor(harnessManifest);
3738
3788
 
3739
3789
  // src/index.ts
3740
3790
  async function createLlm(args) {