@mozaik-ai/core 4.0.0-beta.1 → 4.0.0-beta.2

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.d.mts CHANGED
@@ -422,4 +422,98 @@ declare function defineRuntime<TRuntimeState extends RuntimeState>(): {
422
422
  runLoop: (agentId: string, message: string, inferenceInput: InferenceInput) => void;
423
423
  };
424
424
 
425
- export { ContextItem, DeveloperMessageItem, type Endpoint, FunctionCallItem, FunctionCallOutputItem, type InferenceInput, type InferenceOutput, InputTokenDetails, McpClient, type McpServerConfig, McpToolRegistry, type McpToolSpec, ModelContext, type ModelContextRepository, ModelMessageItem, OutputTokenDetails, Participant, ReasoningItem, RuntimeState, SemanticEvent, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, createAgent, createHuman, defineRuntime };
425
+ declare const supportedModels: GenerativeModel[];
426
+
427
+ declare class OpenAIResponses implements Endpoint {
428
+ endpointMapper: InferenceEndpointMapper;
429
+ private readonly client;
430
+ constructor(endpointMapper?: InferenceEndpointMapper);
431
+ infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
432
+ stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
433
+ }
434
+
435
+ /**
436
+ * Optional connection config. When omitted, the `openai` SDK reads
437
+ * `OPENAI_API_KEY` and `OPENAI_BASE_URL` from the environment, so the
438
+ * default-constructed runtime targets whatever `OPENAI_BASE_URL` points
439
+ * at (real OpenAI when unset). Provider presets (e.g. DeepSeek) pass an
440
+ * explicit base URL + credential.
441
+ */
442
+ interface OpenAICompatibleConfig {
443
+ baseURL?: string;
444
+ apiKey?: string;
445
+ /**
446
+ * Extra request-body fields merged into every `chat.completions`
447
+ * call. This is how provider-specific quirks are handled **without
448
+ * a per-provider subclass in mozaik** — the consumer supplies the
449
+ * vendor-only fields (e.g. DeepSeek's `{ thinking: { type } }`,
450
+ * safety flags, routing hints). Standard fields the runtime already
451
+ * sets (`model`, `messages`, `tools`, `reasoning_effort`) take
452
+ * precedence and are not overwritten.
453
+ */
454
+ extraBody?: Record<string, unknown>;
455
+ }
456
+ /**
457
+ * Generic adapter for any **OpenAI Chat Completions**-compatible
458
+ * endpoint — real OpenAI, DeepSeek, Xiaomi MiMo, OpenRouter, vLLM,
459
+ * Ollama, etc. It speaks `/chat/completions` (not the Responses API),
460
+ * which is the dialect third-party OpenAI-compatible providers expose.
461
+ *
462
+ * The base URL and credential are configurable; everything else (the
463
+ * `ModelContext` ⇄ chat-message conversion, tool-call round-trip, token
464
+ * usage extraction) is provider-agnostic. Provider-specific request
465
+ * shaping (e.g. DeepSeek's `thinking` field) is supplied by the
466
+ * consumer via {@link OpenAICompatibleConfig.extraBody} — mozaik stays
467
+ * generic and gains no per-provider subclasses.
468
+ *
469
+ * Was `DeepSeekChatCompletions`; generalized so consumers can point it
470
+ * at any OpenAI-compatible endpoint.
471
+ */
472
+ declare class OpenAIChatCompletions implements Endpoint {
473
+ endpointMapper: InferenceEndpointMapper;
474
+ private readonly client;
475
+ private readonly extraBody;
476
+ constructor(endpointMapper?: InferenceEndpointMapper, config?: OpenAICompatibleConfig);
477
+ private buildRequest;
478
+ infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
479
+ stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
480
+ }
481
+
482
+ interface AnthropicConnectionConfig {
483
+ baseURL?: string;
484
+ apiKey?: string;
485
+ }
486
+ /**
487
+ * Native Anthropic adapter on the `@anthropic-ai/sdk` (`messages.create`).
488
+ * Maps domain context to Anthropic's `messages`/`content` blocks shape,
489
+ * system prompt, tools, adaptive thinking, and structured output config.
490
+ */
491
+ declare class AnthropicMessages implements Endpoint {
492
+ endpointMapper: InferenceEndpointMapper;
493
+ private readonly client;
494
+ constructor(endpointMapper?: InferenceEndpointMapper, config?: AnthropicConnectionConfig);
495
+ infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
496
+ stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
497
+ }
498
+
499
+ interface GeminiConnectionConfig {
500
+ baseURL?: string;
501
+ apiKey?: string;
502
+ }
503
+ /**
504
+ * Native Gemini adapter on the `@google/genai` SDK (`generateContent` /
505
+ * `generateContentStream`). Unlike an OpenAI-compat shim this maps our
506
+ * domain context to Gemini's native `contents`/`parts` shape, system
507
+ * instruction, `functionDeclarations`, and `thinkingConfig`, and reads
508
+ * thought parts + native usage metadata back out. Another `ModelRuntime`
509
+ * — no runner or port changes.
510
+ */
511
+ declare class GeminiGenerateContent implements Endpoint {
512
+ endpointMapper: InferenceEndpointMapper;
513
+ private readonly client;
514
+ constructor(endpointMapper?: InferenceEndpointMapper, config?: GeminiConnectionConfig);
515
+ infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
516
+ stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
517
+ }
518
+
519
+ export { AnthropicMessages, ContextItem, DeveloperMessageItem, type Endpoint, FunctionCallItem, FunctionCallOutputItem, GeminiGenerateContent, type InferenceInput, type InferenceOutput, InputTokenDetails, McpClient, type McpServerConfig, McpToolRegistry, type McpToolSpec, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIChatCompletions, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, RuntimeState, SemanticEvent, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, createAgent, createHuman, defineRuntime, supportedModels };
package/dist/index.d.ts CHANGED
@@ -422,4 +422,98 @@ declare function defineRuntime<TRuntimeState extends RuntimeState>(): {
422
422
  runLoop: (agentId: string, message: string, inferenceInput: InferenceInput) => void;
423
423
  };
424
424
 
425
- export { ContextItem, DeveloperMessageItem, type Endpoint, FunctionCallItem, FunctionCallOutputItem, type InferenceInput, type InferenceOutput, InputTokenDetails, McpClient, type McpServerConfig, McpToolRegistry, type McpToolSpec, ModelContext, type ModelContextRepository, ModelMessageItem, OutputTokenDetails, Participant, ReasoningItem, RuntimeState, SemanticEvent, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, createAgent, createHuman, defineRuntime };
425
+ declare const supportedModels: GenerativeModel[];
426
+
427
+ declare class OpenAIResponses implements Endpoint {
428
+ endpointMapper: InferenceEndpointMapper;
429
+ private readonly client;
430
+ constructor(endpointMapper?: InferenceEndpointMapper);
431
+ infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
432
+ stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
433
+ }
434
+
435
+ /**
436
+ * Optional connection config. When omitted, the `openai` SDK reads
437
+ * `OPENAI_API_KEY` and `OPENAI_BASE_URL` from the environment, so the
438
+ * default-constructed runtime targets whatever `OPENAI_BASE_URL` points
439
+ * at (real OpenAI when unset). Provider presets (e.g. DeepSeek) pass an
440
+ * explicit base URL + credential.
441
+ */
442
+ interface OpenAICompatibleConfig {
443
+ baseURL?: string;
444
+ apiKey?: string;
445
+ /**
446
+ * Extra request-body fields merged into every `chat.completions`
447
+ * call. This is how provider-specific quirks are handled **without
448
+ * a per-provider subclass in mozaik** — the consumer supplies the
449
+ * vendor-only fields (e.g. DeepSeek's `{ thinking: { type } }`,
450
+ * safety flags, routing hints). Standard fields the runtime already
451
+ * sets (`model`, `messages`, `tools`, `reasoning_effort`) take
452
+ * precedence and are not overwritten.
453
+ */
454
+ extraBody?: Record<string, unknown>;
455
+ }
456
+ /**
457
+ * Generic adapter for any **OpenAI Chat Completions**-compatible
458
+ * endpoint — real OpenAI, DeepSeek, Xiaomi MiMo, OpenRouter, vLLM,
459
+ * Ollama, etc. It speaks `/chat/completions` (not the Responses API),
460
+ * which is the dialect third-party OpenAI-compatible providers expose.
461
+ *
462
+ * The base URL and credential are configurable; everything else (the
463
+ * `ModelContext` ⇄ chat-message conversion, tool-call round-trip, token
464
+ * usage extraction) is provider-agnostic. Provider-specific request
465
+ * shaping (e.g. DeepSeek's `thinking` field) is supplied by the
466
+ * consumer via {@link OpenAICompatibleConfig.extraBody} — mozaik stays
467
+ * generic and gains no per-provider subclasses.
468
+ *
469
+ * Was `DeepSeekChatCompletions`; generalized so consumers can point it
470
+ * at any OpenAI-compatible endpoint.
471
+ */
472
+ declare class OpenAIChatCompletions implements Endpoint {
473
+ endpointMapper: InferenceEndpointMapper;
474
+ private readonly client;
475
+ private readonly extraBody;
476
+ constructor(endpointMapper?: InferenceEndpointMapper, config?: OpenAICompatibleConfig);
477
+ private buildRequest;
478
+ infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
479
+ stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
480
+ }
481
+
482
+ interface AnthropicConnectionConfig {
483
+ baseURL?: string;
484
+ apiKey?: string;
485
+ }
486
+ /**
487
+ * Native Anthropic adapter on the `@anthropic-ai/sdk` (`messages.create`).
488
+ * Maps domain context to Anthropic's `messages`/`content` blocks shape,
489
+ * system prompt, tools, adaptive thinking, and structured output config.
490
+ */
491
+ declare class AnthropicMessages implements Endpoint {
492
+ endpointMapper: InferenceEndpointMapper;
493
+ private readonly client;
494
+ constructor(endpointMapper?: InferenceEndpointMapper, config?: AnthropicConnectionConfig);
495
+ infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
496
+ stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
497
+ }
498
+
499
+ interface GeminiConnectionConfig {
500
+ baseURL?: string;
501
+ apiKey?: string;
502
+ }
503
+ /**
504
+ * Native Gemini adapter on the `@google/genai` SDK (`generateContent` /
505
+ * `generateContentStream`). Unlike an OpenAI-compat shim this maps our
506
+ * domain context to Gemini's native `contents`/`parts` shape, system
507
+ * instruction, `functionDeclarations`, and `thinkingConfig`, and reads
508
+ * thought parts + native usage metadata back out. Another `ModelRuntime`
509
+ * — no runner or port changes.
510
+ */
511
+ declare class GeminiGenerateContent implements Endpoint {
512
+ endpointMapper: InferenceEndpointMapper;
513
+ private readonly client;
514
+ constructor(endpointMapper?: InferenceEndpointMapper, config?: GeminiConnectionConfig);
515
+ infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
516
+ stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
517
+ }
518
+
519
+ export { AnthropicMessages, ContextItem, DeveloperMessageItem, type Endpoint, FunctionCallItem, FunctionCallOutputItem, GeminiGenerateContent, type InferenceInput, type InferenceOutput, InputTokenDetails, McpClient, type McpServerConfig, McpToolRegistry, type McpToolSpec, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIChatCompletions, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, RuntimeState, SemanticEvent, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, createAgent, createHuman, defineRuntime, supportedModels };
package/dist/index.js CHANGED
@@ -30,15 +30,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ AnthropicMessages: () => AnthropicMessages,
33
34
  ContextItem: () => ContextItem,
34
35
  DeveloperMessageItem: () => DeveloperMessageItem,
35
36
  FunctionCallItem: () => FunctionCallItem,
36
37
  FunctionCallOutputItem: () => FunctionCallOutputItem,
38
+ GeminiGenerateContent: () => GeminiGenerateContent,
37
39
  InputTokenDetails: () => InputTokenDetails,
38
40
  McpClient: () => McpClient,
39
41
  McpToolRegistry: () => McpToolRegistry,
40
42
  ModelContext: () => ModelContext,
41
43
  ModelMessageItem: () => ModelMessageItem,
44
+ OpenAIChatCompletions: () => OpenAIChatCompletions,
45
+ OpenAIResponses: () => OpenAIResponses,
42
46
  OutputTokenDetails: () => OutputTokenDetails,
43
47
  Participant: () => Participant,
44
48
  ReasoningItem: () => ReasoningItem,
@@ -49,7 +53,8 @@ __export(index_exports, {
49
53
  UserMessageItem: () => UserMessageItem,
50
54
  createAgent: () => createAgent,
51
55
  createHuman: () => createHuman,
52
- defineRuntime: () => defineRuntime
56
+ defineRuntime: () => defineRuntime,
57
+ supportedModels: () => supportedModels
53
58
  });
54
59
  module.exports = __toCommonJS(index_exports);
55
60
 
@@ -2057,15 +2062,19 @@ function defineRuntime() {
2057
2062
  }
2058
2063
  // Annotate the CommonJS export names for ESM import in node:
2059
2064
  0 && (module.exports = {
2065
+ AnthropicMessages,
2060
2066
  ContextItem,
2061
2067
  DeveloperMessageItem,
2062
2068
  FunctionCallItem,
2063
2069
  FunctionCallOutputItem,
2070
+ GeminiGenerateContent,
2064
2071
  InputTokenDetails,
2065
2072
  McpClient,
2066
2073
  McpToolRegistry,
2067
2074
  ModelContext,
2068
2075
  ModelMessageItem,
2076
+ OpenAIChatCompletions,
2077
+ OpenAIResponses,
2069
2078
  OutputTokenDetails,
2070
2079
  Participant,
2071
2080
  ReasoningItem,
@@ -2076,6 +2085,7 @@ function defineRuntime() {
2076
2085
  UserMessageItem,
2077
2086
  createAgent,
2078
2087
  createHuman,
2079
- defineRuntime
2088
+ defineRuntime,
2089
+ supportedModels
2080
2090
  });
2081
2091
  //# sourceMappingURL=index.js.map