@omnicross/contracts 0.1.1 → 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.
Files changed (47) hide show
  1. package/dist/account-tokens-types.d.cts +181 -1
  2. package/dist/account-tokens-types.d.ts +181 -1
  3. package/dist/audit-types.cjs +36 -0
  4. package/dist/audit-types.d.cts +98 -0
  5. package/dist/audit-types.d.ts +98 -0
  6. package/dist/audit-types.js +11 -0
  7. package/dist/billing-types.cjs +33 -0
  8. package/dist/billing-types.d.cts +98 -0
  9. package/dist/billing-types.d.ts +98 -0
  10. package/dist/billing-types.js +8 -0
  11. package/dist/canonical-models.d.cts +1 -1
  12. package/dist/canonical-models.d.ts +1 -1
  13. package/dist/endpoint-resolver.d.cts +1 -1
  14. package/dist/endpoint-resolver.d.ts +1 -1
  15. package/dist/health-logging-types.cjs +32 -0
  16. package/dist/health-logging-types.d.cts +68 -0
  17. package/dist/health-logging-types.d.ts +68 -0
  18. package/dist/health-logging-types.js +7 -0
  19. package/dist/index.cjs +53 -0
  20. package/dist/index.d.cts +9 -2
  21. package/dist/index.d.ts +9 -2
  22. package/dist/index.js +46 -0
  23. package/dist/{llm-config-D1jKQLVp.d.ts → llm-config-CKOaFFdy.d.ts} +8 -1
  24. package/dist/{llm-config-CQjOimv2.d.cts → llm-config-DeWNx1ig.d.cts} +8 -1
  25. package/dist/llm-config.d.cts +1 -1
  26. package/dist/llm-config.d.ts +1 -1
  27. package/dist/pricing-types.cjs +30 -0
  28. package/dist/pricing-types.d.cts +84 -0
  29. package/dist/pricing-types.d.ts +84 -0
  30. package/dist/pricing-types.js +5 -0
  31. package/dist/provider-presets/index.d.cts +2 -2
  32. package/dist/provider-presets/index.d.ts +2 -2
  33. package/dist/thinking-config.d.cts +1 -1
  34. package/dist/thinking-config.d.ts +1 -1
  35. package/dist/usage-stats-types.cjs +18 -0
  36. package/dist/usage-stats-types.d.cts +164 -0
  37. package/dist/usage-stats-types.d.ts +164 -0
  38. package/dist/usage-stats-types.js +0 -0
  39. package/dist/voucher-types.cjs +32 -0
  40. package/dist/voucher-types.d.cts +153 -0
  41. package/dist/voucher-types.d.ts +153 -0
  42. package/dist/voucher-types.js +7 -0
  43. package/dist/webhook-types.cjs +40 -0
  44. package/dist/webhook-types.d.cts +122 -0
  45. package/dist/webhook-types.d.ts +122 -0
  46. package/dist/webhook-types.js +14 -0
  47. package/package.json +36 -1
package/dist/index.cjs CHANGED
@@ -24,9 +24,13 @@ __export(index_exports, {
24
24
  CANNOT_DISABLE_THINKING_PATTERNS: () => CANNOT_DISABLE_THINKING_PATTERNS,
25
25
  CATALOG_VERSION: () => CATALOG_VERSION,
26
26
  CODING_PLAN_URL_PRESETS: () => CODING_PLAN_URL_PRESETS,
27
+ DEFAULT_AUDIT_CONFIG: () => DEFAULT_AUDIT_CONFIG,
28
+ DEFAULT_BILLING_CONFIG: () => DEFAULT_BILLING_CONFIG,
29
+ DEFAULT_LITELLM_PRICING_URL: () => DEFAULT_LITELLM_PRICING_URL,
27
30
  DEFAULT_MAX_TOKENS: () => DEFAULT_MAX_TOKENS,
28
31
  DEFAULT_MCP_SESSION_CONFIG: () => DEFAULT_MCP_SESSION_CONFIG,
29
32
  DEFAULT_SEED_PRESET_IDS: () => DEFAULT_SEED_PRESET_IDS,
33
+ DEFAULT_VOUCHER_CONFIG: () => DEFAULT_VOUCHER_CONFIG,
30
34
  EFFORT_RATIO: () => EFFORT_RATIO,
31
35
  EXTENDED_CONTEXT_CAPABLE_MODELS: () => EXTENDED_CONTEXT_CAPABLE_MODELS,
32
36
  KNOWN_MODELS: () => KNOWN_MODELS,
@@ -37,6 +41,8 @@ __export(index_exports, {
37
41
  PROVIDER_SEARCH_CONFIGS: () => PROVIDER_SEARCH_CONFIGS,
38
42
  REASONING_MODEL_PATTERNS: () => REASONING_MODEL_PATTERNS,
39
43
  THINKING_TOKEN_MAP: () => THINKING_TOKEN_MAP,
44
+ WEBHOOK_DESTINATION_TYPES: () => WEBHOOK_DESTINATION_TYPES,
45
+ WEBHOOK_EVENT_KINDS: () => WEBHOOK_EVENT_KINDS,
40
46
  applyAlias: () => applyAlias,
41
47
  buildAnthropicThinking: () => buildAnthropicThinking,
42
48
  buildGeminiThinkingConfig: () => buildGeminiThinkingConfig,
@@ -51,6 +57,7 @@ __export(index_exports, {
51
57
  getPresetById: () => getPresetById,
52
58
  getPresetRevision: () => getPresetRevision,
53
59
  getProviderSearchConfig: () => getProviderSearchConfig,
60
+ healthHttpStatus: () => healthHttpStatus,
54
61
  isApiProvider: () => isApiProvider,
55
62
  isExtendedContextCapable: () => isExtendedContextCapable,
56
63
  isLocalProvider: () => isLocalProvider,
@@ -65,6 +72,21 @@ __export(index_exports, {
65
72
  });
66
73
  module.exports = __toCommonJS(index_exports);
67
74
 
75
+ // src/audit-types.ts
76
+ var DEFAULT_AUDIT_CONFIG = {
77
+ enabled: false,
78
+ captureBodies: false,
79
+ maxBodyBytes: 8192,
80
+ retentionDays: 7,
81
+ trustForwardedFor: false
82
+ };
83
+
84
+ // src/billing-types.ts
85
+ var DEFAULT_BILLING_CONFIG = {
86
+ enabled: false,
87
+ maxRetryAgeMs: 24 * 60 * 6e4
88
+ };
89
+
68
90
  // src/canonical-models.ts
69
91
  var OPENAI_MODELS = {
70
92
  "gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
@@ -327,12 +349,20 @@ function isExtendedContextCapable(model) {
327
349
  return EXTENDED_CONTEXT_CAPABLE_MODELS.has(model);
328
350
  }
329
351
 
352
+ // src/health-logging-types.ts
353
+ function healthHttpStatus(status) {
354
+ return status === "ok" ? 200 : 503;
355
+ }
356
+
330
357
  // src/mcp-types.ts
331
358
  var DEFAULT_MCP_SESSION_CONFIG = {
332
359
  mode: "auto",
333
360
  selectedServers: []
334
361
  };
335
362
 
363
+ // src/pricing-types.ts
364
+ var DEFAULT_LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
365
+
336
366
  // src/provider-presets/catalog.json
337
367
  var catalog_default = {
338
368
  version: 1,
@@ -2670,6 +2700,22 @@ function buildQwenThinkingConfig(level, userMaxTokens) {
2670
2700
  };
2671
2701
  }
2672
2702
 
2703
+ // src/voucher-types.ts
2704
+ var DEFAULT_VOUCHER_CONFIG = {
2705
+ enabled: false
2706
+ };
2707
+
2708
+ // src/webhook-types.ts
2709
+ var WEBHOOK_EVENT_KINDS = [
2710
+ "account.recovery",
2711
+ "account.anomaly",
2712
+ "key.quotaWarning",
2713
+ "key.quotaExceeded",
2714
+ "server.error",
2715
+ "test"
2716
+ ];
2717
+ var WEBHOOK_DESTINATION_TYPES = ["custom", "feishu"];
2718
+
2673
2719
  // src/websearch-types.ts
2674
2720
  function isApiProvider(id) {
2675
2721
  return !id.startsWith("local-");
@@ -2683,9 +2729,13 @@ function isLocalProvider(id) {
2683
2729
  CANNOT_DISABLE_THINKING_PATTERNS,
2684
2730
  CATALOG_VERSION,
2685
2731
  CODING_PLAN_URL_PRESETS,
2732
+ DEFAULT_AUDIT_CONFIG,
2733
+ DEFAULT_BILLING_CONFIG,
2734
+ DEFAULT_LITELLM_PRICING_URL,
2686
2735
  DEFAULT_MAX_TOKENS,
2687
2736
  DEFAULT_MCP_SESSION_CONFIG,
2688
2737
  DEFAULT_SEED_PRESET_IDS,
2738
+ DEFAULT_VOUCHER_CONFIG,
2689
2739
  EFFORT_RATIO,
2690
2740
  EXTENDED_CONTEXT_CAPABLE_MODELS,
2691
2741
  KNOWN_MODELS,
@@ -2696,6 +2746,8 @@ function isLocalProvider(id) {
2696
2746
  PROVIDER_SEARCH_CONFIGS,
2697
2747
  REASONING_MODEL_PATTERNS,
2698
2748
  THINKING_TOKEN_MAP,
2749
+ WEBHOOK_DESTINATION_TYPES,
2750
+ WEBHOOK_EVENT_KINDS,
2699
2751
  applyAlias,
2700
2752
  buildAnthropicThinking,
2701
2753
  buildGeminiThinkingConfig,
@@ -2710,6 +2762,7 @@ function isLocalProvider(id) {
2710
2762
  getPresetById,
2711
2763
  getPresetRevision,
2712
2764
  getProviderSearchConfig,
2765
+ healthHttpStatus,
2713
2766
  isApiProvider,
2714
2767
  isExtendedContextCapable,
2715
2768
  isLocalProvider,
package/dist/index.d.cts CHANGED
@@ -1,14 +1,21 @@
1
- export { AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, TokenExchangeRequest, TokenStatus } from './account-tokens-types.cjs';
1
+ export { AccountClientIdentity, AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, ProxyConfig, SanitizedProxyConfig, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, SyncWarningCode, TokenExchangeRequest, TokenStatus } from './account-tokens-types.cjs';
2
+ export { AuditConfig, AuditQueryResult, AuditRecord, DEFAULT_AUDIT_CONFIG } from './audit-types.cjs';
3
+ export { BillingConfig, BillingDeliveryStatus, BillingEvent, DEFAULT_BILLING_CONFIG } from './billing-types.cjs';
2
4
  export { KNOWN_MODELS, KnownModelCapabilities, MODEL_ALIASES, ResolvedModelCapabilities, applyAlias, lookupCanonicalCapabilities, normalizeModelId, resolveModelCapabilities } from './canonical-models.cjs';
3
5
  export { AnthropicAudioContent, AnthropicChatRequest, AnthropicChatResponse, AnthropicContentPart, AnthropicImageContent, AnthropicMessage, AnthropicSystemContent, AnthropicTextContent, AnthropicThinkingContent, AnthropicTool, AnthropicToolResultContent, AnthropicToolUseContent, AnthropicVideoContent, ConversionConfig, OpenAIChatRequest, OpenAIChatResponse, OpenAIContentPart, OpenAIMessage, OpenAIStreamChunk, OpenAITool, OpenAIToolCall, SimpleChatAudio, SimpleChatImage, SimpleChatMessage, SimpleChatSession, SimpleChatVideo } from './completion-types.cjs';
4
6
  export { R as ReasoningConfig, T as ThinkLevel, a as ThinkingContent } from './thinking-CBWSLel8.cjs';
5
7
  export { ResolvedEndpoint, resolveProviderEndpoint } from './endpoint-resolver.cjs';
6
8
  export { EXTENDED_CONTEXT_CAPABLE_MODELS, isExtendedContextCapable } from './extended-context.cjs';
7
- export { A as API_MODE_IDS, a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, d as ApiMode, e as ApiModeId, C as ChatApiFormat, f as CodingPlanConfig, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, P as PresetProviderTemplate, o as ProviderApiType, p as ProviderModelMapping, q as ProviderSearchConfig, r as ProviderTemplate, S as SearchCapability, T as TransformerConfig, s as TransformerEntry } from './llm-config-CQjOimv2.cjs';
9
+ export { HealthReport, HealthStatus, LogFormat, LogLevel, LoggingConfig, healthHttpStatus } from './health-logging-types.cjs';
10
+ export { A as API_MODE_IDS, a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, d as ApiMode, e as ApiModeId, C as ChatApiFormat, f as CodingPlanConfig, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, P as PresetProviderTemplate, o as ProviderApiType, p as ProviderModelMapping, q as ProviderSearchConfig, r as ProviderTemplate, S as SearchCapability, T as TransformerConfig, s as TransformerEntry } from './llm-config-DeWNx1ig.cjs';
8
11
  export { DEFAULT_MCP_SESSION_CONFIG, MCPCallToolResponse, MCPTool, MCPToolResponseContent, McpActionResult, McpDiscoverResult, McpMode, McpServerConfig, McpServerInput, McpServerJsonInput, McpServerList, McpServerRecord, McpServerRemoveInput, McpServerScope, McpServerTransport, McpSessionConfig, McpTestResult, McpToolInfo } from './mcp-types.cjs';
9
12
  export { MessageBlock, MessageBlockBase, MessageBlockType, TextBlock, ThinkingBlock, ToolResultBlock, ToolUseBlock } from './message-blocks.cjs';
13
+ export { DEFAULT_LITELLM_PRICING_URL, PricingConflict, PricingConflictDecision, PricingEntry, PricingEntryInput, PricingFetchResult, PricingResolution, PricingSource } from './pricing-types.cjs';
10
14
  export { CATALOG_VERSION, CODING_PLAN_URL_PRESETS, DEFAULT_SEED_PRESET_IDS, LLM_PROVIDER_PRESETS, MAX_CONCURRENCY_DEFAULTS, PROVIDER_MODEL_MAPPINGS, PROVIDER_SEARCH_CONFIGS, getAllProviderPresets, getCodingPlanBaseUrl, getPresetById, getPresetRevision, getProviderSearchConfig, resolveFollowProviderModel } from './provider-presets/index.cjs';
11
15
  export { OpenCodeGoModelEntry, OpenCodeGoScenario, OpenCodeGoTokenConfig, OpenCodeGoTokenSanitized, ProviderChannel, SubscriptionListEntry, SubscriptionProviderId, SubscriptionStatusEntry, legacyCliBackendToSubscriptionProvider, subscriptionTargetForSession } from './subscription-types.cjs';
12
16
  export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel } from './thinking-config.cjs';
17
+ export { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTimeBucket, UsageTimeSeriesBucket, UsageTotals } from './usage-stats-types.cjs';
13
18
  export { UsageEngineOrigin, UsageTokens } from './usage-types.cjs';
19
+ export { DEFAULT_VOUCHER_CONFIG, VoucherConfig, VoucherCreated, VoucherGrant, VoucherInfo, VoucherRecord, VoucherRedeemResult, VoucherStatus, VoucherType } from './voucher-types.cjs';
20
+ export { SanitizedWebhookConfig, SanitizedWebhookDestination, WEBHOOK_DESTINATION_TYPES, WEBHOOK_EVENT_KINDS, WebhookAnomalyState, WebhookConfig, WebhookDestination, WebhookDestinationType, WebhookEvent, WebhookEventKind, WebhookQuotaScope } from './webhook-types.cjs';
14
21
  export { JinaReaderResponse, WebSearchOptions, WebSearchProviderConfig, WebSearchProviderId, WebSearchProviderType, WebSearchResponse, WebSearchResult, isApiProvider, isLocalProvider } from './websearch-types.cjs';
package/dist/index.d.ts CHANGED
@@ -1,14 +1,21 @@
1
- export { AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, TokenExchangeRequest, TokenStatus } from './account-tokens-types.js';
1
+ export { AccountClientIdentity, AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, ProxyConfig, SanitizedProxyConfig, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, SyncWarningCode, TokenExchangeRequest, TokenStatus } from './account-tokens-types.js';
2
+ export { AuditConfig, AuditQueryResult, AuditRecord, DEFAULT_AUDIT_CONFIG } from './audit-types.js';
3
+ export { BillingConfig, BillingDeliveryStatus, BillingEvent, DEFAULT_BILLING_CONFIG } from './billing-types.js';
2
4
  export { KNOWN_MODELS, KnownModelCapabilities, MODEL_ALIASES, ResolvedModelCapabilities, applyAlias, lookupCanonicalCapabilities, normalizeModelId, resolveModelCapabilities } from './canonical-models.js';
3
5
  export { AnthropicAudioContent, AnthropicChatRequest, AnthropicChatResponse, AnthropicContentPart, AnthropicImageContent, AnthropicMessage, AnthropicSystemContent, AnthropicTextContent, AnthropicThinkingContent, AnthropicTool, AnthropicToolResultContent, AnthropicToolUseContent, AnthropicVideoContent, ConversionConfig, OpenAIChatRequest, OpenAIChatResponse, OpenAIContentPart, OpenAIMessage, OpenAIStreamChunk, OpenAITool, OpenAIToolCall, SimpleChatAudio, SimpleChatImage, SimpleChatMessage, SimpleChatSession, SimpleChatVideo } from './completion-types.js';
4
6
  export { R as ReasoningConfig, T as ThinkLevel, a as ThinkingContent } from './thinking-CBWSLel8.js';
5
7
  export { ResolvedEndpoint, resolveProviderEndpoint } from './endpoint-resolver.js';
6
8
  export { EXTENDED_CONTEXT_CAPABLE_MODELS, isExtendedContextCapable } from './extended-context.js';
7
- export { A as API_MODE_IDS, a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, d as ApiMode, e as ApiModeId, C as ChatApiFormat, f as CodingPlanConfig, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, P as PresetProviderTemplate, o as ProviderApiType, p as ProviderModelMapping, q as ProviderSearchConfig, r as ProviderTemplate, S as SearchCapability, T as TransformerConfig, s as TransformerEntry } from './llm-config-D1jKQLVp.js';
9
+ export { HealthReport, HealthStatus, LogFormat, LogLevel, LoggingConfig, healthHttpStatus } from './health-logging-types.js';
10
+ export { A as API_MODE_IDS, a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, d as ApiMode, e as ApiModeId, C as ChatApiFormat, f as CodingPlanConfig, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, P as PresetProviderTemplate, o as ProviderApiType, p as ProviderModelMapping, q as ProviderSearchConfig, r as ProviderTemplate, S as SearchCapability, T as TransformerConfig, s as TransformerEntry } from './llm-config-CKOaFFdy.js';
8
11
  export { DEFAULT_MCP_SESSION_CONFIG, MCPCallToolResponse, MCPTool, MCPToolResponseContent, McpActionResult, McpDiscoverResult, McpMode, McpServerConfig, McpServerInput, McpServerJsonInput, McpServerList, McpServerRecord, McpServerRemoveInput, McpServerScope, McpServerTransport, McpSessionConfig, McpTestResult, McpToolInfo } from './mcp-types.js';
9
12
  export { MessageBlock, MessageBlockBase, MessageBlockType, TextBlock, ThinkingBlock, ToolResultBlock, ToolUseBlock } from './message-blocks.js';
13
+ export { DEFAULT_LITELLM_PRICING_URL, PricingConflict, PricingConflictDecision, PricingEntry, PricingEntryInput, PricingFetchResult, PricingResolution, PricingSource } from './pricing-types.js';
10
14
  export { CATALOG_VERSION, CODING_PLAN_URL_PRESETS, DEFAULT_SEED_PRESET_IDS, LLM_PROVIDER_PRESETS, MAX_CONCURRENCY_DEFAULTS, PROVIDER_MODEL_MAPPINGS, PROVIDER_SEARCH_CONFIGS, getAllProviderPresets, getCodingPlanBaseUrl, getPresetById, getPresetRevision, getProviderSearchConfig, resolveFollowProviderModel } from './provider-presets/index.js';
11
15
  export { OpenCodeGoModelEntry, OpenCodeGoScenario, OpenCodeGoTokenConfig, OpenCodeGoTokenSanitized, ProviderChannel, SubscriptionListEntry, SubscriptionProviderId, SubscriptionStatusEntry, legacyCliBackendToSubscriptionProvider, subscriptionTargetForSession } from './subscription-types.js';
12
16
  export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel } from './thinking-config.js';
17
+ export { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTimeBucket, UsageTimeSeriesBucket, UsageTotals } from './usage-stats-types.js';
13
18
  export { UsageEngineOrigin, UsageTokens } from './usage-types.js';
19
+ export { DEFAULT_VOUCHER_CONFIG, VoucherConfig, VoucherCreated, VoucherGrant, VoucherInfo, VoucherRecord, VoucherRedeemResult, VoucherStatus, VoucherType } from './voucher-types.js';
20
+ export { SanitizedWebhookConfig, SanitizedWebhookDestination, WEBHOOK_DESTINATION_TYPES, WEBHOOK_EVENT_KINDS, WebhookAnomalyState, WebhookConfig, WebhookDestination, WebhookDestinationType, WebhookEvent, WebhookEventKind, WebhookQuotaScope } from './webhook-types.js';
14
21
  export { JinaReaderResponse, WebSearchOptions, WebSearchProviderConfig, WebSearchProviderId, WebSearchProviderType, WebSearchResponse, WebSearchResult, isApiProvider, isLocalProvider } from './websearch-types.js';
package/dist/index.js CHANGED
@@ -1,3 +1,18 @@
1
+ // src/audit-types.ts
2
+ var DEFAULT_AUDIT_CONFIG = {
3
+ enabled: false,
4
+ captureBodies: false,
5
+ maxBodyBytes: 8192,
6
+ retentionDays: 7,
7
+ trustForwardedFor: false
8
+ };
9
+
10
+ // src/billing-types.ts
11
+ var DEFAULT_BILLING_CONFIG = {
12
+ enabled: false,
13
+ maxRetryAgeMs: 24 * 60 * 6e4
14
+ };
15
+
1
16
  // src/canonical-models.ts
2
17
  var OPENAI_MODELS = {
3
18
  "gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
@@ -260,12 +275,20 @@ function isExtendedContextCapable(model) {
260
275
  return EXTENDED_CONTEXT_CAPABLE_MODELS.has(model);
261
276
  }
262
277
 
278
+ // src/health-logging-types.ts
279
+ function healthHttpStatus(status) {
280
+ return status === "ok" ? 200 : 503;
281
+ }
282
+
263
283
  // src/mcp-types.ts
264
284
  var DEFAULT_MCP_SESSION_CONFIG = {
265
285
  mode: "auto",
266
286
  selectedServers: []
267
287
  };
268
288
 
289
+ // src/pricing-types.ts
290
+ var DEFAULT_LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
291
+
269
292
  // src/provider-presets/catalog.json
270
293
  var catalog_default = {
271
294
  version: 1,
@@ -2603,6 +2626,22 @@ function buildQwenThinkingConfig(level, userMaxTokens) {
2603
2626
  };
2604
2627
  }
2605
2628
 
2629
+ // src/voucher-types.ts
2630
+ var DEFAULT_VOUCHER_CONFIG = {
2631
+ enabled: false
2632
+ };
2633
+
2634
+ // src/webhook-types.ts
2635
+ var WEBHOOK_EVENT_KINDS = [
2636
+ "account.recovery",
2637
+ "account.anomaly",
2638
+ "key.quotaWarning",
2639
+ "key.quotaExceeded",
2640
+ "server.error",
2641
+ "test"
2642
+ ];
2643
+ var WEBHOOK_DESTINATION_TYPES = ["custom", "feishu"];
2644
+
2606
2645
  // src/websearch-types.ts
2607
2646
  function isApiProvider(id) {
2608
2647
  return !id.startsWith("local-");
@@ -2615,9 +2654,13 @@ export {
2615
2654
  CANNOT_DISABLE_THINKING_PATTERNS,
2616
2655
  CATALOG_VERSION,
2617
2656
  CODING_PLAN_URL_PRESETS,
2657
+ DEFAULT_AUDIT_CONFIG,
2658
+ DEFAULT_BILLING_CONFIG,
2659
+ DEFAULT_LITELLM_PRICING_URL,
2618
2660
  DEFAULT_MAX_TOKENS,
2619
2661
  DEFAULT_MCP_SESSION_CONFIG,
2620
2662
  DEFAULT_SEED_PRESET_IDS,
2663
+ DEFAULT_VOUCHER_CONFIG,
2621
2664
  EFFORT_RATIO,
2622
2665
  EXTENDED_CONTEXT_CAPABLE_MODELS,
2623
2666
  KNOWN_MODELS,
@@ -2628,6 +2671,8 @@ export {
2628
2671
  PROVIDER_SEARCH_CONFIGS,
2629
2672
  REASONING_MODEL_PATTERNS,
2630
2673
  THINKING_TOKEN_MAP,
2674
+ WEBHOOK_DESTINATION_TYPES,
2675
+ WEBHOOK_EVENT_KINDS,
2631
2676
  applyAlias,
2632
2677
  buildAnthropicThinking,
2633
2678
  buildGeminiThinkingConfig,
@@ -2642,6 +2687,7 @@ export {
2642
2687
  getPresetById,
2643
2688
  getPresetRevision,
2644
2689
  getProviderSearchConfig,
2690
+ healthHttpStatus,
2645
2691
  isApiProvider,
2646
2692
  isExtendedContextCapable,
2647
2693
  isLocalProvider,
@@ -286,6 +286,14 @@ interface LLMProvider {
286
286
  modelGroups?: ModelGroup[];
287
287
  modelsEndpoint?: string;
288
288
  enabled: boolean;
289
+ /**
290
+ * For `apiFormat: 'anthropic'` providers, authenticate with
291
+ * `Authorization: Bearer <apiKey>` instead of the default `x-api-key` header.
292
+ * Set this for third-party Anthropic-Messages relays that gate on a Bearer
293
+ * token (the native/base header path; the transformer path uses the
294
+ * `UseBearer` transformer option independently).
295
+ */
296
+ useBearer?: boolean;
289
297
  transformer?: TransformerConfig;
290
298
  rerouterEnabled?: boolean;
291
299
  icon?: string;
@@ -294,7 +302,6 @@ interface LLMProvider {
294
302
  defaultSettings?: CompletionSettings;
295
303
  isSystem?: boolean;
296
304
  isOfficial?: boolean;
297
- rateLimit?: number;
298
305
  maxConcurrency?: number;
299
306
  notes?: string;
300
307
  apiVersion?: string;
@@ -286,6 +286,14 @@ interface LLMProvider {
286
286
  modelGroups?: ModelGroup[];
287
287
  modelsEndpoint?: string;
288
288
  enabled: boolean;
289
+ /**
290
+ * For `apiFormat: 'anthropic'` providers, authenticate with
291
+ * `Authorization: Bearer <apiKey>` instead of the default `x-api-key` header.
292
+ * Set this for third-party Anthropic-Messages relays that gate on a Bearer
293
+ * token (the native/base header path; the transformer path uses the
294
+ * `UseBearer` transformer option independently).
295
+ */
296
+ useBearer?: boolean;
289
297
  transformer?: TransformerConfig;
290
298
  rerouterEnabled?: boolean;
291
299
  icon?: string;
@@ -294,7 +302,6 @@ interface LLMProvider {
294
302
  defaultSettings?: CompletionSettings;
295
303
  isSystem?: boolean;
296
304
  isOfficial?: boolean;
297
- rateLimit?: number;
298
305
  maxConcurrency?: number;
299
306
  notes?: string;
300
307
  apiVersion?: string;
@@ -1,2 +1,2 @@
1
1
  import './thinking-CBWSLel8.cjs';
2
- export { a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, C as ChatApiFormat, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, o as ProviderApiType, r as ProviderTemplate, T as TransformerConfig, s as TransformerEntry } from './llm-config-CQjOimv2.cjs';
2
+ export { a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, C as ChatApiFormat, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, o as ProviderApiType, r as ProviderTemplate, T as TransformerConfig, s as TransformerEntry } from './llm-config-DeWNx1ig.cjs';
@@ -1,2 +1,2 @@
1
1
  import './thinking-CBWSLel8.js';
2
- export { a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, C as ChatApiFormat, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, o as ProviderApiType, r as ProviderTemplate, T as TransformerConfig, s as TransformerEntry } from './llm-config-D1jKQLVp.js';
2
+ export { a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, C as ChatApiFormat, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, o as ProviderApiType, r as ProviderTemplate, T as TransformerConfig, s as TransformerEntry } from './llm-config-CKOaFFdy.js';
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/pricing-types.ts
21
+ var pricing_types_exports = {};
22
+ __export(pricing_types_exports, {
23
+ DEFAULT_LITELLM_PRICING_URL: () => DEFAULT_LITELLM_PRICING_URL
24
+ });
25
+ module.exports = __toCommonJS(pricing_types_exports);
26
+ var DEFAULT_LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ DEFAULT_LITELLM_PRICING_URL
30
+ });
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Model pricing types — provider-generic pricing-table contracts.
3
+ *
4
+ * Pricing rows are keyed by (providerId, modelId) and persisted by the
5
+ * embedding host's own store. The serving core's pricing engine uses them to
6
+ * derive `costUsd` for each captured usage event; hosts may also surface the
7
+ * rows in their own pricing-management UI.
8
+ *
9
+ * @module pricing-types
10
+ */
11
+ /** Where this pricing entry came from. */
12
+ type PricingSource =
13
+ /** Built-in fallback shipped by the host, seeded on first run. */
14
+ 'builtin'
15
+ /** Auto-fetched from the LiteLLM JSON URL. */
16
+ | 'litellm'
17
+ /** Hand-edited by the user; protected from auto-overwrite. */
18
+ | 'user';
19
+ /**
20
+ * Per-model pricing row keyed by (providerId, modelId). Prices are in USD per
21
+ * 1,000,000 tokens. `cache_read` / `cache_write` are optional — providers
22
+ * without prompt caching leave them null.
23
+ */
24
+ interface PricingEntry {
25
+ providerId: string;
26
+ modelId: string;
27
+ inputPricePer1m: number;
28
+ outputPricePer1m: number;
29
+ cacheReadPricePer1m: number | null;
30
+ cacheWritePricePer1m: number | null;
31
+ source: PricingSource;
32
+ /** True when the row has been hand-edited. Protects it from auto-overwrite during a source refresh. */
33
+ userEdited: boolean;
34
+ /** Unix-millis of the most recent user edit, or null if never. */
35
+ editedAt: number | null;
36
+ /** Unix-millis of the most recent write of any kind. */
37
+ updatedAt: number;
38
+ }
39
+ /** Upsert input shape (manual edits and parsed source entries). */
40
+ type PricingEntryInput = {
41
+ providerId: string;
42
+ modelId: string;
43
+ inputPricePer1m: number;
44
+ outputPricePer1m: number;
45
+ cacheReadPricePer1m?: number | null;
46
+ cacheWritePricePer1m?: number | null;
47
+ };
48
+ /** Conflict reported during a source refresh — local row was user-edited. */
49
+ interface PricingConflict {
50
+ providerId: string;
51
+ modelId: string;
52
+ /** Existing row in the local store (before any change). */
53
+ current: PricingEntry;
54
+ /** Incoming row from the pricing source. */
55
+ incoming: PricingEntryInput;
56
+ }
57
+ /** Result of a source refresh. The auto-applied entries are already written. */
58
+ interface PricingFetchResult {
59
+ /** Rows that were upserted automatically (new or non-userEdited). */
60
+ applied: PricingEntry[];
61
+ /** Rows where the local copy is userEdited — surfaced to the UI for resolution. */
62
+ conflicts: PricingConflict[];
63
+ /** When the fetch started (unix-millis). */
64
+ fetchedAt: number;
65
+ /** Source URL that was fetched. */
66
+ sourceUrl: string;
67
+ }
68
+ /** Per-row decision passed back from the host's conflict-resolution UI. */
69
+ interface PricingConflictDecision {
70
+ providerId: string;
71
+ modelId: string;
72
+ action: 'overwrite' | 'skip';
73
+ }
74
+ /** Outcome of resolving a list of conflict decisions. */
75
+ interface PricingResolution {
76
+ /** Number of rows overwritten with the incoming source values. */
77
+ overwrittenCount: number;
78
+ /** Number of rows left unchanged (skipped). */
79
+ skippedCount: number;
80
+ }
81
+ /** Default LiteLLM source URL — public model_prices_and_context_window.json. */
82
+ declare const DEFAULT_LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
83
+
84
+ export { DEFAULT_LITELLM_PRICING_URL, type PricingConflict, type PricingConflictDecision, type PricingEntry, type PricingEntryInput, type PricingFetchResult, type PricingResolution, type PricingSource };
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Model pricing types — provider-generic pricing-table contracts.
3
+ *
4
+ * Pricing rows are keyed by (providerId, modelId) and persisted by the
5
+ * embedding host's own store. The serving core's pricing engine uses them to
6
+ * derive `costUsd` for each captured usage event; hosts may also surface the
7
+ * rows in their own pricing-management UI.
8
+ *
9
+ * @module pricing-types
10
+ */
11
+ /** Where this pricing entry came from. */
12
+ type PricingSource =
13
+ /** Built-in fallback shipped by the host, seeded on first run. */
14
+ 'builtin'
15
+ /** Auto-fetched from the LiteLLM JSON URL. */
16
+ | 'litellm'
17
+ /** Hand-edited by the user; protected from auto-overwrite. */
18
+ | 'user';
19
+ /**
20
+ * Per-model pricing row keyed by (providerId, modelId). Prices are in USD per
21
+ * 1,000,000 tokens. `cache_read` / `cache_write` are optional — providers
22
+ * without prompt caching leave them null.
23
+ */
24
+ interface PricingEntry {
25
+ providerId: string;
26
+ modelId: string;
27
+ inputPricePer1m: number;
28
+ outputPricePer1m: number;
29
+ cacheReadPricePer1m: number | null;
30
+ cacheWritePricePer1m: number | null;
31
+ source: PricingSource;
32
+ /** True when the row has been hand-edited. Protects it from auto-overwrite during a source refresh. */
33
+ userEdited: boolean;
34
+ /** Unix-millis of the most recent user edit, or null if never. */
35
+ editedAt: number | null;
36
+ /** Unix-millis of the most recent write of any kind. */
37
+ updatedAt: number;
38
+ }
39
+ /** Upsert input shape (manual edits and parsed source entries). */
40
+ type PricingEntryInput = {
41
+ providerId: string;
42
+ modelId: string;
43
+ inputPricePer1m: number;
44
+ outputPricePer1m: number;
45
+ cacheReadPricePer1m?: number | null;
46
+ cacheWritePricePer1m?: number | null;
47
+ };
48
+ /** Conflict reported during a source refresh — local row was user-edited. */
49
+ interface PricingConflict {
50
+ providerId: string;
51
+ modelId: string;
52
+ /** Existing row in the local store (before any change). */
53
+ current: PricingEntry;
54
+ /** Incoming row from the pricing source. */
55
+ incoming: PricingEntryInput;
56
+ }
57
+ /** Result of a source refresh. The auto-applied entries are already written. */
58
+ interface PricingFetchResult {
59
+ /** Rows that were upserted automatically (new or non-userEdited). */
60
+ applied: PricingEntry[];
61
+ /** Rows where the local copy is userEdited — surfaced to the UI for resolution. */
62
+ conflicts: PricingConflict[];
63
+ /** When the fetch started (unix-millis). */
64
+ fetchedAt: number;
65
+ /** Source URL that was fetched. */
66
+ sourceUrl: string;
67
+ }
68
+ /** Per-row decision passed back from the host's conflict-resolution UI. */
69
+ interface PricingConflictDecision {
70
+ providerId: string;
71
+ modelId: string;
72
+ action: 'overwrite' | 'skip';
73
+ }
74
+ /** Outcome of resolving a list of conflict decisions. */
75
+ interface PricingResolution {
76
+ /** Number of rows overwritten with the incoming source values. */
77
+ overwrittenCount: number;
78
+ /** Number of rows left unchanged (skipped). */
79
+ skippedCount: number;
80
+ }
81
+ /** Default LiteLLM source URL — public model_prices_and_context_window.json. */
82
+ declare const DEFAULT_LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
83
+
84
+ export { DEFAULT_LITELLM_PRICING_URL, type PricingConflict, type PricingConflictDecision, type PricingEntry, type PricingEntryInput, type PricingFetchResult, type PricingResolution, type PricingSource };
@@ -0,0 +1,5 @@
1
+ // src/pricing-types.ts
2
+ var DEFAULT_LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
3
+ export {
4
+ DEFAULT_LITELLM_PRICING_URL
5
+ };
@@ -1,5 +1,5 @@
1
- import { p as ProviderModelMapping, q as ProviderSearchConfig, P as PresetProviderTemplate } from '../llm-config-CQjOimv2.cjs';
2
- export { A as API_MODE_IDS, d as ApiMode, e as ApiModeId, f as CodingPlanConfig, S as SearchCapability } from '../llm-config-CQjOimv2.cjs';
1
+ import { p as ProviderModelMapping, q as ProviderSearchConfig, P as PresetProviderTemplate } from '../llm-config-DeWNx1ig.cjs';
2
+ export { A as API_MODE_IDS, d as ApiMode, e as ApiModeId, f as CodingPlanConfig, S as SearchCapability } from '../llm-config-DeWNx1ig.cjs';
3
3
  import '../thinking-CBWSLel8.cjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { p as ProviderModelMapping, q as ProviderSearchConfig, P as PresetProviderTemplate } from '../llm-config-D1jKQLVp.js';
2
- export { A as API_MODE_IDS, d as ApiMode, e as ApiModeId, f as CodingPlanConfig, S as SearchCapability } from '../llm-config-D1jKQLVp.js';
1
+ import { p as ProviderModelMapping, q as ProviderSearchConfig, P as PresetProviderTemplate } from '../llm-config-CKOaFFdy.js';
2
+ export { A as API_MODE_IDS, d as ApiMode, e as ApiModeId, f as CodingPlanConfig, S as SearchCapability } from '../llm-config-CKOaFFdy.js';
3
3
  import '../thinking-CBWSLel8.js';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { T as ThinkLevel } from './thinking-CBWSLel8.cjs';
2
- import { M as ModelConfig } from './llm-config-CQjOimv2.cjs';
2
+ import { M as ModelConfig } from './llm-config-DeWNx1ig.cjs';
3
3
 
4
4
  /**
5
5
  * thinking-config — dependency-light thinking-budget / reasoning-effort helpers.
@@ -1,5 +1,5 @@
1
1
  import { T as ThinkLevel } from './thinking-CBWSLel8.js';
2
- import { M as ModelConfig } from './llm-config-D1jKQLVp.js';
2
+ import { M as ModelConfig } from './llm-config-CKOaFFdy.js';
3
3
 
4
4
  /**
5
5
  * thinking-config — dependency-light thinking-budget / reasoning-effort helpers.
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/usage-stats-types.ts
17
+ var usage_stats_types_exports = {};
18
+ module.exports = __toCommonJS(usage_stats_types_exports);