@meetopenbot/openbot 0.1.2 → 0.1.3

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.
@@ -11,7 +11,6 @@ export declare function resolveCreditsAuthConfig(): CreditsAuthConfig | undefine
11
11
  export declare function creditsProviderBaseUrl(config: CreditsAuthConfig, provider: CreditsProviderId): string;
12
12
  export declare function shouldUseCreditsAuth(options?: {
13
13
  authMode?: OpenbotAuthMode;
14
- isCloudSystemAgent?: boolean;
15
14
  }): boolean;
16
15
  export declare function isCreditsErrorMessage(message: string): boolean;
17
16
  export declare function isAuthErrorMessage(message: string): boolean;
@@ -1,3 +1,4 @@
1
+ import { isCloudMode } from './cloud-mode.js';
1
2
  export const INTEGRATIONS_TOKEN_HEADER = 'x-openbot-integrations-token';
2
3
  export const CREDITS_API_KEY_PLACEHOLDER = 'openbot-credits';
3
4
  const CREDITS_PROVIDER_PATHS = {
@@ -16,7 +17,12 @@ export function creditsProviderBaseUrl(config, provider) {
16
17
  return `${config.baseUrl}/${CREDITS_PROVIDER_PATHS[provider]}`;
17
18
  }
18
19
  export function shouldUseCreditsAuth(options) {
19
- return options?.authMode === 'credits' && options?.isCloudSystemAgent === true;
20
+ if (options?.authMode === 'byok')
21
+ return false;
22
+ if (options?.authMode === 'credits')
23
+ return true;
24
+ // Cloud host injected integrations credentials — route through proxy even if authMode unset.
25
+ return isCloudMode() && resolveCreditsAuthConfig() !== undefined;
20
26
  }
21
27
  export function isCreditsErrorMessage(message) {
22
28
  const lower = message.toLowerCase();
package/dist/model.d.ts CHANGED
@@ -2,6 +2,5 @@ import type { LanguageModel } from 'ai';
2
2
  import type { OpenbotAuthMode } from './cloud-mode.js';
3
3
  export interface ResolveModelOptions {
4
4
  authMode?: OpenbotAuthMode;
5
- isCloudSystemAgent?: boolean;
6
5
  }
7
6
  export declare function resolveModel(modelString: string, options?: ResolveModelOptions): LanguageModel;
package/dist/model.js CHANGED
@@ -9,7 +9,8 @@ function resolveCreditsProvider(provider, modelId) {
9
9
  }
10
10
  const baseURL = creditsProviderBaseUrl(config, provider);
11
11
  const headers = { [INTEGRATIONS_TOKEN_HEADER]: config.token };
12
- const apiKey = CREDITS_API_KEY_PLACEHOLDER;
12
+ // Any non-empty key satisfies the SDK; the integrations gateway authenticates via header.
13
+ const apiKey = config.token || CREDITS_API_KEY_PLACEHOLDER;
13
14
  switch (provider) {
14
15
  case 'openai':
15
16
  return createOpenAI({ baseURL, apiKey, headers })(modelId);
package/dist/runtime.js CHANGED
@@ -69,10 +69,7 @@ function createToolBatchTracker(state, storage, channelId, threadId) {
69
69
  export const openbotRuntime = (options) => (builder) => {
70
70
  const { model: modelString = 'openai/gpt-4o-mini', authMode = 'byok', agentId, storage, toolDefinitions = {}, abortSignal, host, } = options;
71
71
  let currentModelString = modelString;
72
- const resolveCurrentModel = () => resolveModel(currentModelString, {
73
- authMode,
74
- isCloudSystemAgent: host.isCloudSystemAgent(agentId ?? ''),
75
- });
72
+ const resolveCurrentModel = () => resolveModel(currentModelString, { authMode });
76
73
  let model = resolveCurrentModel();
77
74
  const isCreditsCloudAgent = (id) => host.isCloudSystemAgent(id ?? '') && authMode === 'credits';
78
75
  const runLLM = async function* (context, threadId, trigger) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetopenbot/openbot",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Monolithic OpenBot agent runtime with batteries-included tools.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",