@mozaik-ai/core 4.1.0 → 4.2.0-beta.1

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.ts CHANGED
@@ -1,139 +1,8 @@
1
- declare abstract class ContextItem {
2
- abstract readonly type: string;
3
- getType(): string;
4
- }
5
-
6
- declare class FunctionCallItem extends ContextItem {
7
- readonly type = "function_call";
8
- readonly callId: string;
9
- readonly name: string;
10
- readonly args: string;
11
- private constructor();
12
- static rehydrate(data: {
13
- callId: string;
14
- name: string;
15
- args: string;
16
- }): FunctionCallItem;
17
- }
18
-
19
- declare abstract class ItemContent {
20
- abstract readonly type: string;
21
- }
22
-
23
- declare class OutputText extends ItemContent {
24
- readonly text: string;
25
- readonly type = "output_text";
26
- private constructor();
27
- static rehydrate(data: {
28
- text: string;
29
- }): OutputText;
30
- }
31
-
32
- declare class ModelMessageItem extends ContextItem {
33
- readonly type = "message";
34
- readonly role = "assistant";
35
- readonly content: OutputText;
36
- private constructor();
37
- static rehydrate(data: {
38
- text: string;
39
- }): ModelMessageItem;
40
- }
41
-
42
- declare class InputText extends ItemContent {
43
- readonly text: string;
44
- readonly type = "input_text";
45
- private constructor();
46
- static create(text: string): InputText;
47
- static rehydrate(data: {
48
- text: string;
49
- }): InputText;
50
- }
51
-
52
- declare class SummaryText extends ItemContent {
53
- readonly text: string;
54
- readonly type = "summary_text";
55
- private constructor();
56
- static rehydrate(data: {
57
- text: string;
58
- }): SummaryText;
59
- }
60
-
61
- declare class ReasoningItem extends ContextItem {
62
- readonly type = "reasoning";
63
- readonly content: InputText | undefined;
64
- readonly encryptedContent: string | undefined;
65
- readonly summary: SummaryText[];
66
- private constructor();
67
- static rehydrate(data: {
68
- content: InputText | undefined;
69
- encryptedContent: string | undefined;
70
- summary: SummaryText[];
71
- }): ReasoningItem;
72
- }
73
-
74
- declare class ModelContext {
75
- readonly id: string;
76
- readonly items: ContextItem[];
77
- constructor(id: string, items: ContextItem[]);
78
- getItems(): ContextItem[];
79
- addContextItems(contextItems: ContextItem[]): ModelContext;
80
- addContextItem(item: ContextItem): ModelContext;
81
- static create(): ModelContext;
82
- static rehydrate(data: {
83
- id: string;
84
- items: ContextItem[];
85
- }): ModelContext;
86
- }
87
-
88
- declare class UserMessageItem extends ContextItem {
89
- readonly type = "message";
90
- readonly role = "user";
91
- readonly content: InputText;
92
- private constructor();
93
- static create(text: string): UserMessageItem;
94
- static rehydrate(data: {
95
- text: string;
96
- }): UserMessageItem;
97
- }
98
-
99
- declare class DeveloperMessageItem extends ContextItem {
100
- readonly type = "message";
101
- readonly role = "developer";
102
- readonly content: InputText;
103
- private constructor();
104
- static create(text: string): DeveloperMessageItem;
105
- static rehydrate(data: {
106
- text: string;
107
- }): DeveloperMessageItem;
108
- }
109
-
110
- declare class FunctionCallOutputItem extends ContextItem {
111
- readonly type = "function_call_output";
112
- readonly callId: string;
113
- readonly output: InputText;
114
- private constructor();
115
- static create(callId: string, output: string): FunctionCallOutputItem;
116
- static rehydrate(data: {
117
- callId: string;
118
- output: InputText;
119
- }): FunctionCallOutputItem;
120
- }
121
-
122
- interface FunctionTool {
123
- type: "function";
124
- name: string;
125
- description: string;
126
- parameters: Record<string, any>;
127
- strict: boolean;
128
- invoke: (args: any) => Promise<any>;
129
- }
130
- type Tool = FunctionTool;
131
-
132
- type SituationContext$1<TEvent extends SemanticEvent = SemanticEvent> = {
1
+ type SituationContext$1<TEvent extends SpaceEvent = SpaceEvent> = {
133
2
  readonly event: TEvent;
134
3
  readonly participant: Participant;
135
4
  };
136
- declare abstract class SituationSpecification<TEvent extends SemanticEvent = SemanticEvent> {
5
+ declare abstract class SituationSpecification<TEvent extends SpaceEvent = SpaceEvent> {
137
6
  abstract isSatisfiedBy(situationContext: SituationContext$1<TEvent>): boolean;
138
7
  and(other: SituationSpecification<TEvent>): SituationSpecification<TEvent>;
139
8
  or(other: SituationSpecification<TEvent>): SituationSpecification<TEvent>;
@@ -144,7 +13,7 @@ interface SituationHandler {
144
13
  readonly specification: SituationSpecification;
145
14
  readonly processor: SituationProcessor;
146
15
  }
147
- type SituationContext<TEvent extends SemanticEvent = SemanticEvent> = {
16
+ type SituationContext<TEvent extends SpaceEvent = SpaceEvent> = {
148
17
  readonly event: TEvent;
149
18
  readonly participant: Participant;
150
19
  };
@@ -152,486 +21,85 @@ interface SituationProcessor {
152
21
  apply(context: SituationContext): void | Promise<void>;
153
22
  }
154
23
 
155
- type ParticipantRole = "agent" | "human";
24
+ type ParticipantRole = "agent" | "external";
156
25
  type ParticipantManifest = {
157
26
  readonly id: string;
158
27
  readonly name: string;
159
28
  readonly role: ParticipantRole;
160
29
  readonly capabilities?: readonly string[];
161
30
  };
162
- declare abstract class Participant {
163
- private readonly manifest;
31
+ declare class Participant {
32
+ private manifest;
164
33
  private handlers;
165
- protected constructor(manifest: ParticipantManifest, handlers: SituationHandler[]);
34
+ constructor(manifest: ParticipantManifest, handlers: SituationHandler[]);
166
35
  getManifest(): ParticipantManifest;
36
+ setManifest(manifest: ParticipantManifest): void;
167
37
  getId(): string;
168
38
  getHandlers(): SituationHandler[];
169
39
  setHandlers(handlers: SituationHandler[]): void;
170
40
  }
171
41
 
172
- declare class SemanticEvent<TType extends string = string, TPayload = unknown> {
42
+ declare class SpaceEvent<TType extends string = string, TPayload = unknown> {
173
43
  readonly type: TType;
174
44
  readonly producerId: string;
175
45
  readonly occurredAt: Date;
176
46
  readonly payload: TPayload;
177
47
  constructor(type: TType, producerId: string, occurredAt: Date, payload: TPayload);
178
- static create<TType extends string = string, TPayload = unknown>(type: TType, producerId: string, payload: TPayload): SemanticEvent<TType, TPayload>;
179
- }
180
-
181
- interface FunctionCallRunner {
182
- run(call: FunctionCallItem, tool: Tool): Promise<FunctionCallOutputItem>;
183
- }
184
- interface FunctionCallParams {
185
- call: FunctionCallItem;
186
- inferenceInput: InferenceInput;
187
- }
188
-
189
- interface InterceptionHandler {
190
- isSatisfiedBy(transition: ExecutableTransition): boolean;
191
- handle(transition: ExecutableTransition): Promise<ExecutableTransition>;
192
- }
193
- type InterceptionOutput = {
194
- type: "continue";
195
- transition: LoopTransition;
196
- } | {
197
- type: "pause";
198
- pendingTransition: LoopTransition;
199
- } | {
200
- type: "stop";
201
- reason?: string;
202
- };
203
- interface InterceptionParams {
204
- pendingTransition: LoopTransition;
205
- }
206
-
207
- type LoopStateId = "message_received" | "inference" | "inference_streaming" | "function_call" | "model_message" | "idle";
208
- type ReceivedMessage = {
209
- content: string;
210
- input: InferenceInput;
211
- };
212
- interface FunctionCallExecutionOutput {
213
- item: FunctionCallOutputItem;
214
- }
215
- interface ModelMessageParams {
216
- answer: ModelMessageItem;
217
- }
218
- interface LoopStateContract {
219
- message_received: {
220
- input: ReceivedMessage;
221
- output: InferenceInput;
222
- };
223
- inference: {
224
- input: InferenceInput;
225
- output: InferenceOutput;
226
- };
227
- inference_streaming: {
228
- input: InferenceInput;
229
- output: InferenceOutput;
230
- };
231
- function_call: {
232
- input: FunctionCallParams;
233
- output: FunctionCallExecutionOutput;
234
- };
235
- model_message: {
236
- input: ModelMessageParams;
237
- output: void;
238
- };
239
- interception: {
240
- input: InterceptionParams;
241
- output: InterceptionOutput;
242
- };
243
- idle: {
244
- input: undefined;
245
- output: void;
246
- };
247
- }
248
- type ExecutableLoopStateId = Exclude<LoopStateId, "idle">;
249
- type ExecutableTransition = LoopTransition<ExecutableLoopStateId>;
250
- type LoopStateExecution<TStateId extends ExecutableLoopStateId = ExecutableLoopStateId> = {
251
- [K in TStateId]: {
252
- stateId: K;
253
- input: LoopStateContract[K]["input"];
254
- output: LoopStateContract[K]["output"];
255
- };
256
- }[TStateId];
257
- type LoopTransition<TStateId extends LoopStateId = LoopStateId> = {
258
- [K in TStateId]: {
259
- nextStateId: K;
260
- input: LoopStateContract[K]["input"];
261
- };
262
- }[TStateId];
263
-
264
- declare class InputTokenDetails {
265
- readonly cached_tokens: number;
266
- constructor(cached_tokens: number);
267
- }
268
- declare class OutputTokenDetails {
269
- readonly reasoning_tokens: number;
270
- constructor(reasoning_tokens: number);
271
- }
272
- declare class TokenUsage {
273
- readonly inputTokens: number;
274
- readonly outputTokens: number;
275
- readonly totalTokens: number;
276
- readonly inputTokenDetails: InputTokenDetails;
277
- readonly outputTokenDetails: OutputTokenDetails;
278
- constructor(inputTokens: number, outputTokens: number, totalTokens: number, inputTokenDetails: InputTokenDetails, outputTokenDetails: OutputTokenDetails);
279
- }
280
-
281
- type InferenceInput = {
282
- model: string;
283
- maxOutputTokens?: number;
284
- reasoningEffort?: string;
285
- tools?: Tool[];
286
- streaming?: boolean;
287
- structuredOutput?: StructuredOutputFormat;
288
- context: ModelContext;
289
- };
290
- type InferenceItem = FunctionCallItem | ReasoningItem | ModelMessageItem;
291
- type InferenceOutput = {
292
- items: InferenceItem[];
293
- tokenUsage: TokenUsage | undefined;
294
- rowResponse: any;
295
- };
296
- interface InferenceRunner {
297
- run(request: InferenceInput): Promise<InferenceOutput>;
298
- stream(request: InferenceInput): AsyncGenerator<SemanticEvent>;
299
- }
300
-
301
- interface InferenceEndpointMapper {
302
- toRequest(inferenceInput: InferenceInput): any;
303
- toResponse(response: any): InferenceOutput;
304
- }
305
-
306
- interface Endpoint {
307
- endpointMapper: InferenceEndpointMapper;
308
- infer(requestParams: InferenceInput): Promise<InferenceOutput>;
309
- stream(requestParams: InferenceInput): AsyncIterable<SemanticEvent>;
310
- }
311
-
312
- type GenerativeModel = {
313
- endpoint: Endpoint;
314
- specification: ModelSpecification;
315
- };
316
- type ModelSpecification = {
317
- name: string;
318
- provider: string;
319
- supportsReasoningEffort: boolean;
320
- supportedReasoningEfforts: string[];
321
- supportsStreaming: boolean;
322
- contextWindowSize: number;
323
- supportedContextItemTypes: string[];
324
- maxOutputTokens: number;
325
- supportsFunctionCalling: boolean;
326
- supportsStructuredOutput: boolean;
327
- };
328
-
329
- interface RequestValidationRule {
330
- readonly name: string;
331
- isValid(inferenceInput: InferenceInput, model: ModelSpecification): boolean;
48
+ static create<TType extends string = string, TPayload = unknown>(type: TType, producerId: string, occurredAt: Date, payload: TPayload): SpaceEvent<TType, TPayload>;
332
49
  }
333
50
 
334
- type StructuredOutputFormat = {
335
- name?: string;
336
- schema: Record<string, any>;
337
- strict?: boolean;
338
- };
339
-
340
- interface ModelContextRepository {
341
- save(context: ModelContext): Promise<void>;
342
- get(id: string): Promise<ModelContext>;
343
- getByProjectId(projectId: string): Promise<ModelContext[]>;
51
+ interface SharedState {
344
52
  }
345
53
 
346
- interface McpServerConfig {
347
- /** The MCP server URL, e.g. https://api.githubcopilot.com/mcp/ */
348
- url: string;
349
- /** Bearer token sent as `Authorization: Bearer <token>` (e.g. a GitHub token). */
350
- authToken?: string;
351
- /** Extra headers merged into every request (overridden by `authToken` for Authorization). */
352
- headers?: Record<string, string>;
353
- /** Client name reported to the server (defaults to "mozaik"). */
354
- name?: string;
355
- }
356
- interface McpToolSpec {
54
+ interface FunctionTool {
55
+ type: "function";
357
56
  name: string;
358
57
  description: string;
359
- /** JSON Schema for the tool's arguments (maps 1:1 to FunctionTool.parameters). */
360
- inputSchema: Record<string, any>;
361
- }
362
- /**
363
- * A thin wrapper over the MCP TypeScript SDK using the Streamable HTTP transport — what
364
- * remote MCP servers (e.g. GitHub's `api.githubcopilot.com/mcp/`) speak. One client per
365
- * server; lazily connects on first use. Infrastructure-only: the domain never sees this.
366
- */
367
- declare class McpClient {
368
- private readonly config;
369
- private readonly client;
370
- private readonly transport;
371
- private connected;
372
- constructor(config: McpServerConfig);
373
- connect(): Promise<void>;
374
- /** The tools this server exposes. */
375
- listTools(): Promise<McpToolSpec[]>;
376
- /** Call a tool by name; returns its text output. Throws if the server flags an error. */
377
- callTool(name: string, args: Record<string, any>): Promise<string>;
378
- close(): Promise<void>;
379
- }
380
-
381
- /** The slice of an MCP client the registry needs — lets tests inject a fake. */
382
- interface McpClientLike {
383
- listTools(): Promise<Array<{
384
- name: string;
385
- description: string;
386
- inputSchema: Record<string, any>;
387
- }>>;
388
- callTool(name: string, args: Record<string, any>): Promise<string>;
389
- close(): Promise<void>;
390
- }
391
- /**
392
- * Connects to one or more MCP servers and exposes their tools as mozaik `FunctionTool`s.
393
- * Each tool's `invoke()` proxies the call back to its MCP server. Because they are plain
394
- * FunctionTools, every provider mapper and the existing function-call loop handle them
395
- * with no changes — MCP support adds no new tool type and touches no provider code.
396
- *
397
- * `strict` is false: MCP servers publish arbitrary JSON Schemas that won't always satisfy
398
- * a provider's strict function-calling mode.
399
- */
400
- declare class McpToolRegistry {
401
- private readonly servers;
402
- private readonly createClient;
403
- private readonly clients;
404
- constructor(servers: McpServerConfig[], createClient?: (config: McpServerConfig) => McpClientLike);
405
- /** Discover every tool across the configured servers, as FunctionTools ready to pass to a model. */
406
- discoverTools(): Promise<FunctionTool[]>;
407
- /** Close all underlying MCP connections. */
408
- close(): Promise<void>;
409
- }
410
-
411
- declare class SystemMessageItem extends ContextItem {
412
- readonly type = "message";
413
- readonly role = "system";
414
- readonly content: InputText;
415
- private constructor();
416
- static create(text: string): SystemMessageItem;
417
- static rehydrate(data: {
418
- text: string;
419
- }): SystemMessageItem;
420
- }
421
-
422
- declare class Memory {
423
- private readonly context;
424
- private constructor();
425
- getContext(): ModelContext;
426
- static create(): Memory;
427
- }
428
-
429
- declare class Agent extends Participant {
430
- private memory;
431
- private developerMessage;
432
- private tools;
433
- constructor(manifest: ParticipantManifest, developerMessage: string, tools: Tool[], memory: Memory, handlers: SituationHandler[]);
434
- static create({ name, instruction, tools, capabilities, handlers, }: {
435
- instruction: string;
436
- tools: Tool[];
437
- name: string;
438
- capabilities: readonly string[];
439
- handlers: SituationHandler[];
440
- }): Agent;
441
- getTools(): Tool[];
442
- getDeveloperMessage(): string;
443
- getMemory(): Memory;
444
- }
445
-
446
- declare function createAgent({ name, capabilities, instruction, tools, handlers, }: {
447
- name: string;
448
- capabilities: readonly string[];
449
- instruction: string;
450
- tools: Tool[];
451
- handlers: SituationHandler[];
452
- }): Agent;
453
-
454
- declare class Human extends Participant {
455
- constructor(manifest: ParticipantManifest, handlers: SituationHandler[]);
456
- static create({ name, capabilities, handlers, }: {
457
- name: string;
458
- capabilities: readonly string[];
459
- handlers: SituationHandler[];
460
- }): Human;
58
+ parameters: Record<string, any>;
59
+ strict: boolean;
60
+ invoke: (args: any) => Promise<any> | any;
461
61
  }
462
62
 
463
- declare function createHuman({ name, capabilities, handlers, }: {
63
+ type SpaceRecord = {
64
+ id: string;
464
65
  name: string;
465
- capabilities: readonly string[];
466
- handlers: SituationHandler[];
467
- }): Human;
468
-
469
- declare abstract class RuntimeState {
470
- participants: Map<string, Participant>;
471
- addParticipant(participant: Participant): void;
472
- removeParticipant(participant: Participant): void;
66
+ participants: Participant[];
67
+ };
68
+ declare class Space {
69
+ private readonly id;
70
+ private name;
71
+ private participants;
72
+ private events;
73
+ constructor(id: string, name: string, participants: Participant[], events?: SpaceEvent[]);
74
+ getId(): string;
75
+ getName(): string;
76
+ addParticipant(participant: Participant): SpaceEvent | undefined;
473
77
  getParticipant(id: string): Participant | undefined;
474
- getParticipants(): readonly Participant[];
78
+ removeParticipant(participant: Participant): SpaceEvent;
79
+ getParticipants(): Participant[];
80
+ sendMessage(participant: Participant, message: string, occurredAt: Date): SpaceEvent;
81
+ getEvents(): SpaceEvent[];
82
+ static create(name: string, participants?: Participant[]): Space;
83
+ get record(): SpaceRecord;
84
+ static rehydrate({ id, name, participants }: SpaceRecord): Space;
475
85
  }
476
86
 
477
- declare class EventProcessor {
478
- process(event: SemanticEvent, consumer: Participant): void;
87
+ declare class RuntimeService<TSharedState extends SharedState> {
88
+ readonly state: TSharedState;
89
+ constructor(state: TSharedState);
479
90
  }
480
91
 
481
- declare class RuntimeService<TRuntimeState extends RuntimeState> {
482
- readonly state: TRuntimeState;
483
- private readonly processor;
484
- private readonly inferenceRunner;
485
- private readonly functionCallRunner;
486
- constructor(state: TRuntimeState, processor: EventProcessor, inferenceRunner: InferenceRunner, functionCallRunner: FunctionCallRunner);
487
- join(participant: Participant): void;
488
- leave(participant: Participant): void;
489
- publish(event: SemanticEvent): void;
490
- getParticipant(id: string): Participant | undefined;
491
- getInferenceRunner(): InferenceRunner;
492
- getFunctionCallRunner(): FunctionCallRunner;
493
- }
494
-
495
- type InferenceRunnerConfig = {
496
- supportedModels?: GenerativeModel[];
497
- runner?: InferenceRunner;
498
- };
499
- declare function defineRuntime<TRuntimeState extends RuntimeState>(): {
92
+ declare function defineRuntime<TSharedState extends SharedState>(): {
500
93
  initializeRuntime: (config: {
501
- state: TRuntimeState;
502
- inferenceRunnerConfig?: InferenceRunnerConfig;
503
- }) => RuntimeService<TRuntimeState>;
504
- resolveRuntime: () => RuntimeService<TRuntimeState>;
505
- resolveParticipant: (id: string) => Participant;
506
- join: (participant: Participant) => void;
507
- leave: (participant: Participant) => void;
508
- sendMessage: (message: string, senderId: string) => void;
509
- sendEvent: (event: SemanticEvent, senderId: string) => void;
510
- runLoop: (agentId: string, message: string, inferenceInput: InferenceInput, interceptionHandler?: InterceptionHandler) => void;
94
+ state: TSharedState;
95
+ }) => RuntimeService<TSharedState>;
96
+ resolveRuntime: () => RuntimeService<TSharedState>;
97
+ createParticipant: (name: string, capabilities: readonly string[], handlers: SituationHandler[]) => Promise<Participant>;
98
+ createSpace: (name: string) => Promise<Space>;
99
+ join: (spaceId: string, participantId: string) => Promise<void>;
100
+ leave: (spaceId: string, participantId: string) => Promise<void>;
101
+ sendMessage: (spaceId: string, participantId: string, message: string) => Promise<void>;
102
+ sendMessageTool: FunctionTool;
511
103
  };
512
104
 
513
- declare const supportedModels: GenerativeModel[];
514
-
515
- /**
516
- * Optional connection config. When omitted, the `openai` SDK reads
517
- * `OPENAI_API_KEY` and `OPENAI_BASE_URL` from the environment.
518
- */
519
- interface OpenAIResponsesConfig {
520
- baseURL?: string;
521
- apiKey?: string;
522
- }
523
- declare class OpenAIResponses implements Endpoint {
524
- endpointMapper: InferenceEndpointMapper;
525
- private _client?;
526
- private readonly clientConfig;
527
- constructor(endpointMapper?: InferenceEndpointMapper, config?: OpenAIResponsesConfig);
528
- private get client();
529
- infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
530
- stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
531
- }
532
-
533
- /**
534
- * Optional connection config. When omitted, the `openai` SDK reads
535
- * `OPENAI_API_KEY` and `OPENAI_BASE_URL` from the environment, so the
536
- * default-constructed runtime targets whatever `OPENAI_BASE_URL` points
537
- * at (real OpenAI when unset). Provider presets (e.g. DeepSeek) pass an
538
- * explicit base URL + credential.
539
- */
540
- interface OpenAICompatibleConfig {
541
- baseURL?: string;
542
- apiKey?: string;
543
- /**
544
- * Extra request-body fields merged into every `chat.completions`
545
- * call. This is how provider-specific quirks are handled **without
546
- * a per-provider subclass in mozaik** — the consumer supplies the
547
- * vendor-only fields (e.g. DeepSeek's `{ thinking: { type } }`,
548
- * safety flags, routing hints). Standard fields the runtime already
549
- * sets (`model`, `messages`, `tools`, `reasoning_effort`) take
550
- * precedence and are not overwritten.
551
- */
552
- extraBody?: Record<string, unknown>;
553
- }
554
- /**
555
- * Generic adapter for any **OpenAI Chat Completions**-compatible
556
- * endpoint — real OpenAI, DeepSeek, Xiaomi MiMo, OpenRouter, vLLM,
557
- * Ollama, etc. It speaks `/chat/completions` (not the Responses API),
558
- * which is the dialect third-party OpenAI-compatible providers expose.
559
- *
560
- * The base URL and credential are configurable; everything else (the
561
- * `ModelContext` ⇄ chat-message conversion, tool-call round-trip, token
562
- * usage extraction) is provider-agnostic. Provider-specific request
563
- * shaping (e.g. DeepSeek's `thinking` field) is supplied by the
564
- * consumer via {@link OpenAICompatibleConfig.extraBody} — mozaik stays
565
- * generic and gains no per-provider subclasses.
566
- *
567
- * Was `DeepSeekChatCompletions`; generalized so consumers can point it
568
- * at any OpenAI-compatible endpoint.
569
- */
570
- declare class OpenAIChatCompletions implements Endpoint {
571
- endpointMapper: InferenceEndpointMapper;
572
- private _client?;
573
- private readonly clientConfig;
574
- private readonly extraBody;
575
- constructor(endpointMapper?: InferenceEndpointMapper, config?: OpenAICompatibleConfig);
576
- private get client();
577
- private buildRequest;
578
- infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
579
- stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
580
- }
581
-
582
- interface AnthropicConnectionConfig {
583
- baseURL?: string;
584
- apiKey?: string;
585
- }
586
- /**
587
- * Native Anthropic adapter on the `@anthropic-ai/sdk` (`messages.create`).
588
- * Maps domain context to Anthropic's `messages`/`content` blocks shape,
589
- * system prompt, tools, adaptive thinking, and structured output config.
590
- */
591
- declare class AnthropicMessages implements Endpoint {
592
- endpointMapper: InferenceEndpointMapper;
593
- private _client?;
594
- private readonly clientConfig;
595
- constructor(endpointMapper?: InferenceEndpointMapper, config?: AnthropicConnectionConfig);
596
- private get client();
597
- infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
598
- stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
599
- }
600
-
601
- interface GeminiConnectionConfig {
602
- baseURL?: string;
603
- apiKey?: string;
604
- }
605
- /**
606
- * Native Gemini adapter on the `@google/genai` SDK (`generateContent` /
607
- * `generateContentStream`). Unlike an OpenAI-compat shim this maps our
608
- * domain context to Gemini's native `contents`/`parts` shape, system
609
- * instruction, `functionDeclarations`, and `thinkingConfig`, and reads
610
- * thought parts + native usage metadata back out. Another `ModelRuntime`
611
- * — no runner or port changes.
612
- */
613
- declare class GeminiGenerateContent implements Endpoint {
614
- endpointMapper: InferenceEndpointMapper;
615
- private _client?;
616
- private readonly clientConfig;
617
- constructor(endpointMapper?: InferenceEndpointMapper, config?: GeminiConnectionConfig);
618
- private get client();
619
- infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
620
- stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
621
- }
622
-
623
- declare class InferenceInputValidator {
624
- private readonly rules;
625
- constructor(rules?: RequestValidationRule[]);
626
- validate(inferenceInput: InferenceInput, model: ModelSpecification): void;
627
- }
628
-
629
- declare class DefaultInferenceRunner implements InferenceRunner {
630
- private readonly supportedModels;
631
- private readonly requestValidator;
632
- constructor(supportedModels: GenerativeModel[], requestValidator: InferenceInputValidator);
633
- run(input: InferenceInput): Promise<InferenceOutput>;
634
- stream(input: InferenceInput): AsyncGenerator<SemanticEvent>;
635
- }
636
-
637
- export { Agent, AnthropicMessages, ContextItem, DefaultInferenceRunner, DeveloperMessageItem, type Endpoint, type ExecutableLoopStateId, type ExecutableTransition, FunctionCallItem, FunctionCallOutputItem, GeminiGenerateContent, Human, type InferenceInput, type InferenceOutput, type InferenceRunner, type InferenceRunnerConfig, InputTokenDetails, type InterceptionHandler, type LoopStateExecution, type LoopTransition, McpClient, type McpServerConfig, McpToolRegistry, type McpToolSpec, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIChatCompletions, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, RuntimeState, SemanticEvent, type SituationContext, type SituationHandler, type SituationProcessor, SituationSpecification, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, createAgent, createHuman, defineRuntime, supportedModels };
105
+ export { Participant, type SharedState, type SituationContext, type SituationHandler, type SituationProcessor, SituationSpecification, SpaceEvent, defineRuntime };