@mozaik-ai/core 3.9.5 → 3.10.0

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
@@ -127,6 +127,11 @@ interface ReasoningEffort<Effort extends string> {
127
127
  getReasoningEffort(): Effort;
128
128
  }
129
129
 
130
+ interface StreamingCapability {
131
+ setStreaming(streaming: boolean): void;
132
+ getStreaming(): boolean;
133
+ }
134
+
130
135
  interface FunctionTool {
131
136
  type: "function";
132
137
  name: string;
@@ -151,7 +156,7 @@ type ModelSpecification = {
151
156
  maxOutputTokens: number;
152
157
  supportFunctionCalling: boolean;
153
158
  };
154
- interface GenerativeModel extends ReasoningEffort<string>, ToolCallingCapability {
159
+ interface GenerativeModel extends ReasoningEffort<string>, ToolCallingCapability, StreamingCapability {
155
160
  readonly specification: ModelSpecification;
156
161
  }
157
162
 
@@ -174,51 +179,9 @@ interface ModelContextRepository {
174
179
  getByProjectId(projectId: string): Promise<ModelContext[]>;
175
180
  }
176
181
 
177
- declare class InferenceRequest {
178
- readonly model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability;
179
- readonly context: ModelContext;
180
- constructor(model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: ModelContext);
181
- }
182
-
183
- declare class InputTokenDetails {
184
- readonly cached_tokens: number;
185
- constructor(cached_tokens: number);
186
- }
187
- declare class OutputTokenDetails {
188
- readonly reasoning_tokens: number;
189
- constructor(reasoning_tokens: number);
190
- }
191
- declare class TokenUsage {
192
- readonly inputTokens: number;
193
- readonly outputTokens: number;
194
- readonly totalTokens: number;
195
- readonly inputTokenDetails: InputTokenDetails;
196
- readonly outputTokenDetails: OutputTokenDetails;
197
- constructor(inputTokens: number, outputTokens: number, totalTokens: number, inputTokenDetails: InputTokenDetails, outputTokenDetails: OutputTokenDetails);
198
- }
199
-
200
- declare class InferenceResponse {
201
- readonly contextItems: ContextItem[];
202
- readonly tokenUsage?: TokenUsage;
203
- constructor(contextItems: ContextItem[], tokenUsage: TokenUsage | undefined);
204
- }
205
-
206
- interface ModelRuntime {
207
- infer(request: InferenceRequest): Promise<InferenceResponse>;
208
- }
209
-
210
- declare class OpenAIResponses implements ModelRuntime {
211
- private readonly client;
212
- constructor();
213
- infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse>;
214
- extractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined;
215
- mapContextToRequest(context: ModelContext): any[];
216
- extractContextItems(response: any): ContextItem[];
217
- }
218
-
219
182
  type OpenAIReasoningEffortType = "xhigh" | "high" | "medium" | "low" | "none";
220
183
 
221
- declare class Gpt54Nano implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {
184
+ declare class Gpt54Nano implements GenerativeModel {
222
185
  readonly specification: {
223
186
  name: string;
224
187
  supportReasoningEffort: boolean;
@@ -230,13 +193,16 @@ declare class Gpt54Nano implements GenerativeModel, ReasoningEffort<OpenAIReason
230
193
  };
231
194
  private tools;
232
195
  private readonly effort;
196
+ private streaming;
197
+ setStreaming(streaming: boolean): void;
198
+ getStreaming(): boolean;
233
199
  setTools(tools: Tool[]): void;
234
200
  getTools(): Tool[];
235
201
  setReasoningEffort(effort: OpenAIReasoningEffortType): void;
236
202
  getReasoningEffort(): OpenAIReasoningEffortType;
237
203
  }
238
204
 
239
- declare class Gpt54 implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {
205
+ declare class Gpt54 implements GenerativeModel {
240
206
  readonly specification: {
241
207
  name: string;
242
208
  supportReasoningEffort: boolean;
@@ -247,6 +213,9 @@ declare class Gpt54 implements GenerativeModel, ReasoningEffort<OpenAIReasoningE
247
213
  supportFunctionCalling: boolean;
248
214
  };
249
215
  private tools;
216
+ private streaming;
217
+ setStreaming(streaming: boolean): void;
218
+ getStreaming(): boolean;
250
219
  setTools(tools: Tool[]): void;
251
220
  getTools(): Tool[];
252
221
  private readonly effort;
@@ -254,7 +223,7 @@ declare class Gpt54 implements GenerativeModel, ReasoningEffort<OpenAIReasoningE
254
223
  getReasoningEffort(): OpenAIReasoningEffortType;
255
224
  }
256
225
 
257
- declare class Gpt54Mini implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {
226
+ declare class Gpt54Mini implements GenerativeModel {
258
227
  readonly specification: {
259
228
  name: string;
260
229
  supportReasoningEffort: boolean;
@@ -266,12 +235,32 @@ declare class Gpt54Mini implements GenerativeModel, ReasoningEffort<OpenAIReason
266
235
  };
267
236
  private tools;
268
237
  private readonly effort;
238
+ private streaming;
239
+ setStreaming(streaming: boolean): void;
240
+ getStreaming(): boolean;
269
241
  setReasoningEffort(effort: OpenAIReasoningEffortType): void;
270
242
  getReasoningEffort(): OpenAIReasoningEffortType;
271
243
  setTools(tools: Tool[]): void;
272
244
  getTools(): Tool[];
273
245
  }
274
246
 
247
+ declare class InputTokenDetails {
248
+ readonly cached_tokens: number;
249
+ constructor(cached_tokens: number);
250
+ }
251
+ declare class OutputTokenDetails {
252
+ readonly reasoning_tokens: number;
253
+ constructor(reasoning_tokens: number);
254
+ }
255
+ declare class TokenUsage {
256
+ readonly inputTokens: number;
257
+ readonly outputTokens: number;
258
+ readonly totalTokens: number;
259
+ readonly inputTokenDetails: InputTokenDetails;
260
+ readonly outputTokenDetails: OutputTokenDetails;
261
+ constructor(inputTokens: number, outputTokens: number, totalTokens: number, inputTokenDetails: InputTokenDetails, outputTokenDetails: OutputTokenDetails);
262
+ }
263
+
275
264
  declare class InMemoryModelContextRepository implements ModelContextRepository {
276
265
  private readonly store;
277
266
  private readonly projectIndex;
@@ -293,6 +282,13 @@ declare class SystemMessageItem extends ContextItem {
293
282
  }): SystemMessageItem;
294
283
  }
295
284
 
285
+ declare class SemanticEvent<T> {
286
+ readonly type: string;
287
+ readonly data: T;
288
+ constructor(type: string, data: T);
289
+ getType(): string;
290
+ }
291
+
296
292
  declare class AgenticEnvironment {
297
293
  protected subscribers: Participant[];
298
294
  private isActive;
@@ -303,6 +299,7 @@ declare class AgenticEnvironment {
303
299
  deliverReasoning(source: Participant, item: ReasoningItem): void;
304
300
  deliverFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): void;
305
301
  deliverMessage(source: Participant, message: string): void;
302
+ deliverSemanticEvent(source: Participant, item: SemanticEvent<unknown>): void;
306
303
  start(): Promise<void>;
307
304
  stop(): void;
308
305
  }
@@ -326,35 +323,27 @@ declare abstract class Participant {
326
323
  abstract onModelMessage(item: ModelMessageItem): Promise<void> | void;
327
324
  abstract onExternalModelMessage(source: Participant, item: ModelMessageItem): Promise<void> | void;
328
325
  abstract onMessage(message: string): Promise<void> | void;
329
- }
330
-
331
- interface InputCapable {
332
- streamInput(environment: AgenticEnvironment): Promise<void>;
333
- }
334
- interface InferenceCapable {
335
- runInference(environment: AgenticEnvironment, context: ModelContext, model: GenerativeModel, signal?: AbortSignal): Promise<void>;
336
- }
337
- interface FunctionCallCapable {
338
- executeFunctionCall(environment: AgenticEnvironment, functionCallItem: FunctionCallItem, signal?: AbortSignal): Promise<void>;
326
+ abstract onInternalEvent(item: SemanticEvent<unknown>): Promise<void> | void;
327
+ abstract onExternalEvent(source: Participant, item: SemanticEvent<unknown>): Promise<void> | void;
339
328
  }
340
329
 
341
330
  interface InferenceRunner {
342
- run(context: ModelContext, model: GenerativeModel, signal?: AbortSignal): AsyncIterable<ReasoningItem | FunctionCallItem | ModelMessageItem>;
331
+ run(context: ModelContext, model: GenerativeModel, signal?: AbortSignal): AsyncIterable<ReasoningItem | FunctionCallItem | ModelMessageItem | SemanticEvent<unknown>>;
343
332
  }
344
333
 
345
334
  interface FunctionCallRunner {
346
335
  run(functionCallItem: FunctionCallItem, signal?: AbortSignal): AsyncIterable<FunctionCallOutputItem>;
347
336
  }
348
337
 
349
- interface InputStream {
350
- stream(signal?: AbortSignal): AsyncIterable<string>;
338
+ declare abstract class Agent extends Participant {
339
+ abstract executeFunctionCall(environment: AgenticEnvironment, functionCallItem: FunctionCallItem, signal?: AbortSignal): Promise<void>;
340
+ abstract runInference(environment: AgenticEnvironment, context: ModelContext, model: GenerativeModel, signal?: AbortSignal): Promise<void>;
351
341
  }
352
342
 
353
- declare class BaseAgentParticipant extends Participant implements InputCapable, InferenceCapable, FunctionCallCapable {
354
- private inputSource;
343
+ declare class BaseAgent extends Agent {
355
344
  private inferenceRunner;
356
345
  private functionCallRunner;
357
- constructor(inputSource: InputStream, inferenceRunner: InferenceRunner, functionCallRunner: FunctionCallRunner);
346
+ constructor(inferenceRunner: InferenceRunner, functionCallRunner: FunctionCallRunner);
358
347
  onJoined(): void;
359
348
  onLeft(): void;
360
349
  onParticipantJoined(participant: Participant): void;
@@ -368,14 +357,17 @@ declare class BaseAgentParticipant extends Participant implements InputCapable,
368
357
  onModelMessage(item: ModelMessageItem): void;
369
358
  onExternalModelMessage(source: Participant, item: ModelMessageItem): void;
370
359
  onMessage(message: string): void;
360
+ onInternalEvent(item: SemanticEvent<unknown>): void;
361
+ onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
371
362
  executeFunctionCall(environment: AgenticEnvironment, functionCallItem: FunctionCallItem, signal?: AbortSignal): Promise<void>;
372
363
  runInference(environment: AgenticEnvironment, context: ModelContext, model: GenerativeModel, signal?: AbortSignal): Promise<void>;
373
- streamInput(environment: AgenticEnvironment): Promise<void>;
374
364
  }
375
365
 
376
- declare class BaseHumanParticipant extends Participant implements InputCapable {
377
- private inputSource;
378
- constructor(inputSource: InputStream);
366
+ declare abstract class Human extends Participant {
367
+ sendMessage(environment: AgenticEnvironment, message: string): void;
368
+ }
369
+
370
+ declare class BaseHuman extends Human {
379
371
  onJoined(): void;
380
372
  onLeft(): void;
381
373
  onParticipantJoined(participant: Participant): void;
@@ -389,13 +381,16 @@ declare class BaseHumanParticipant extends Participant implements InputCapable {
389
381
  onExternalFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): void;
390
382
  onExternalReasoning(source: Participant, item: ReasoningItem): void;
391
383
  onExternalModelMessage(source: Participant, item: ModelMessageItem): void;
392
- streamInput(environment: AgenticEnvironment): Promise<void>;
384
+ onInternalEvent(item: SemanticEvent<unknown>): void;
385
+ onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
393
386
  }
394
387
 
395
- type InferenceItem = ReasoningItem | FunctionCallItem | ModelMessageItem;
388
+ type InferenceItem = ReasoningItem | FunctionCallItem | ModelMessageItem | SemanticEvent<unknown>;
396
389
  declare class OpenAIInferenceRunner implements InferenceRunner {
397
- private readonly runtime;
398
390
  run(context: ModelContext, model: GenerativeModel, signal?: AbortSignal): AsyncIterable<InferenceItem>;
391
+ extractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined;
392
+ mapContextToRequest(context: ModelContext): any[];
393
+ extractContextItems(response: any): ContextItem[];
399
394
  }
400
395
 
401
396
  declare class DefaultFunctionCallRunner implements FunctionCallRunner {
@@ -404,7 +399,7 @@ declare class DefaultFunctionCallRunner implements FunctionCallRunner {
404
399
  run(call: FunctionCallItem, signal?: AbortSignal): AsyncIterable<FunctionCallOutputItem>;
405
400
  }
406
401
 
407
- declare class Gpt55 implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {
402
+ declare class Gpt55 implements GenerativeModel {
408
403
  readonly specification: {
409
404
  name: string;
410
405
  supportReasoningEffort: boolean;
@@ -415,6 +410,9 @@ declare class Gpt55 implements GenerativeModel, ReasoningEffort<OpenAIReasoningE
415
410
  supportFunctionCalling: boolean;
416
411
  };
417
412
  private tools;
413
+ private streaming;
414
+ setStreaming(streaming: boolean): void;
415
+ getStreaming(): boolean;
418
416
  setTools(tools: Tool[]): void;
419
417
  getTools(): Tool[];
420
418
  private readonly effort;
@@ -422,7 +420,10 @@ declare class Gpt55 implements GenerativeModel, ReasoningEffort<OpenAIReasoningE
422
420
  getReasoningEffort(): OpenAIReasoningEffortType;
423
421
  }
424
422
 
425
- declare class BaseObserverParticipant extends Participant {
423
+ declare abstract class Observer extends Participant {
424
+ }
425
+
426
+ declare class BaseObserver extends Observer {
426
427
  onFunctionCall(item: FunctionCallItem): void;
427
428
  onExternalFunctionCall(source: Participant, item: FunctionCallItem): void;
428
429
  onFunctionCallOutput(item: FunctionCallOutputItem): void;
@@ -436,6 +437,8 @@ declare class BaseObserverParticipant extends Participant {
436
437
  onLeft(): void;
437
438
  onParticipantJoined(participant: Participant): void;
438
439
  onParticipantLeft(participant: Participant): void;
440
+ onInternalEvent(item: SemanticEvent<unknown>): void;
441
+ onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
439
442
  }
440
443
 
441
- export { AgenticEnvironment, BaseAgentParticipant, BaseHumanParticipant, BaseObserverParticipant, ContextItem, DefaultFunctionCallRunner, DeveloperMessageItem, FunctionCallItem, FunctionCallOutputItem, type FunctionCallRunner, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, Gpt55, InMemoryModelContextRepository, InferenceRequest, InferenceResponse, type InferenceRunner, type InputStream, InputTokenDetails, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIInferenceRunner, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, SystemMessageItem, TokenUsage, type Tool, UserMessageItem };
444
+ export { Agent, AgenticEnvironment, BaseAgent, BaseHuman, BaseObserver, ContextItem, DefaultFunctionCallRunner, DeveloperMessageItem, FunctionCallItem, FunctionCallOutputItem, type FunctionCallRunner, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, Gpt55, Human, InMemoryModelContextRepository, type InferenceRunner, InputTokenDetails, ModelContext, type ModelContextRepository, ModelMessageItem, Observer, OpenAIInferenceRunner, OutputTokenDetails, Participant, ReasoningItem, SystemMessageItem, TokenUsage, type Tool, UserMessageItem };
package/dist/index.d.ts CHANGED
@@ -127,6 +127,11 @@ interface ReasoningEffort<Effort extends string> {
127
127
  getReasoningEffort(): Effort;
128
128
  }
129
129
 
130
+ interface StreamingCapability {
131
+ setStreaming(streaming: boolean): void;
132
+ getStreaming(): boolean;
133
+ }
134
+
130
135
  interface FunctionTool {
131
136
  type: "function";
132
137
  name: string;
@@ -151,7 +156,7 @@ type ModelSpecification = {
151
156
  maxOutputTokens: number;
152
157
  supportFunctionCalling: boolean;
153
158
  };
154
- interface GenerativeModel extends ReasoningEffort<string>, ToolCallingCapability {
159
+ interface GenerativeModel extends ReasoningEffort<string>, ToolCallingCapability, StreamingCapability {
155
160
  readonly specification: ModelSpecification;
156
161
  }
157
162
 
@@ -174,51 +179,9 @@ interface ModelContextRepository {
174
179
  getByProjectId(projectId: string): Promise<ModelContext[]>;
175
180
  }
176
181
 
177
- declare class InferenceRequest {
178
- readonly model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability;
179
- readonly context: ModelContext;
180
- constructor(model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: ModelContext);
181
- }
182
-
183
- declare class InputTokenDetails {
184
- readonly cached_tokens: number;
185
- constructor(cached_tokens: number);
186
- }
187
- declare class OutputTokenDetails {
188
- readonly reasoning_tokens: number;
189
- constructor(reasoning_tokens: number);
190
- }
191
- declare class TokenUsage {
192
- readonly inputTokens: number;
193
- readonly outputTokens: number;
194
- readonly totalTokens: number;
195
- readonly inputTokenDetails: InputTokenDetails;
196
- readonly outputTokenDetails: OutputTokenDetails;
197
- constructor(inputTokens: number, outputTokens: number, totalTokens: number, inputTokenDetails: InputTokenDetails, outputTokenDetails: OutputTokenDetails);
198
- }
199
-
200
- declare class InferenceResponse {
201
- readonly contextItems: ContextItem[];
202
- readonly tokenUsage?: TokenUsage;
203
- constructor(contextItems: ContextItem[], tokenUsage: TokenUsage | undefined);
204
- }
205
-
206
- interface ModelRuntime {
207
- infer(request: InferenceRequest): Promise<InferenceResponse>;
208
- }
209
-
210
- declare class OpenAIResponses implements ModelRuntime {
211
- private readonly client;
212
- constructor();
213
- infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse>;
214
- extractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined;
215
- mapContextToRequest(context: ModelContext): any[];
216
- extractContextItems(response: any): ContextItem[];
217
- }
218
-
219
182
  type OpenAIReasoningEffortType = "xhigh" | "high" | "medium" | "low" | "none";
220
183
 
221
- declare class Gpt54Nano implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {
184
+ declare class Gpt54Nano implements GenerativeModel {
222
185
  readonly specification: {
223
186
  name: string;
224
187
  supportReasoningEffort: boolean;
@@ -230,13 +193,16 @@ declare class Gpt54Nano implements GenerativeModel, ReasoningEffort<OpenAIReason
230
193
  };
231
194
  private tools;
232
195
  private readonly effort;
196
+ private streaming;
197
+ setStreaming(streaming: boolean): void;
198
+ getStreaming(): boolean;
233
199
  setTools(tools: Tool[]): void;
234
200
  getTools(): Tool[];
235
201
  setReasoningEffort(effort: OpenAIReasoningEffortType): void;
236
202
  getReasoningEffort(): OpenAIReasoningEffortType;
237
203
  }
238
204
 
239
- declare class Gpt54 implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {
205
+ declare class Gpt54 implements GenerativeModel {
240
206
  readonly specification: {
241
207
  name: string;
242
208
  supportReasoningEffort: boolean;
@@ -247,6 +213,9 @@ declare class Gpt54 implements GenerativeModel, ReasoningEffort<OpenAIReasoningE
247
213
  supportFunctionCalling: boolean;
248
214
  };
249
215
  private tools;
216
+ private streaming;
217
+ setStreaming(streaming: boolean): void;
218
+ getStreaming(): boolean;
250
219
  setTools(tools: Tool[]): void;
251
220
  getTools(): Tool[];
252
221
  private readonly effort;
@@ -254,7 +223,7 @@ declare class Gpt54 implements GenerativeModel, ReasoningEffort<OpenAIReasoningE
254
223
  getReasoningEffort(): OpenAIReasoningEffortType;
255
224
  }
256
225
 
257
- declare class Gpt54Mini implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {
226
+ declare class Gpt54Mini implements GenerativeModel {
258
227
  readonly specification: {
259
228
  name: string;
260
229
  supportReasoningEffort: boolean;
@@ -266,12 +235,32 @@ declare class Gpt54Mini implements GenerativeModel, ReasoningEffort<OpenAIReason
266
235
  };
267
236
  private tools;
268
237
  private readonly effort;
238
+ private streaming;
239
+ setStreaming(streaming: boolean): void;
240
+ getStreaming(): boolean;
269
241
  setReasoningEffort(effort: OpenAIReasoningEffortType): void;
270
242
  getReasoningEffort(): OpenAIReasoningEffortType;
271
243
  setTools(tools: Tool[]): void;
272
244
  getTools(): Tool[];
273
245
  }
274
246
 
247
+ declare class InputTokenDetails {
248
+ readonly cached_tokens: number;
249
+ constructor(cached_tokens: number);
250
+ }
251
+ declare class OutputTokenDetails {
252
+ readonly reasoning_tokens: number;
253
+ constructor(reasoning_tokens: number);
254
+ }
255
+ declare class TokenUsage {
256
+ readonly inputTokens: number;
257
+ readonly outputTokens: number;
258
+ readonly totalTokens: number;
259
+ readonly inputTokenDetails: InputTokenDetails;
260
+ readonly outputTokenDetails: OutputTokenDetails;
261
+ constructor(inputTokens: number, outputTokens: number, totalTokens: number, inputTokenDetails: InputTokenDetails, outputTokenDetails: OutputTokenDetails);
262
+ }
263
+
275
264
  declare class InMemoryModelContextRepository implements ModelContextRepository {
276
265
  private readonly store;
277
266
  private readonly projectIndex;
@@ -293,6 +282,13 @@ declare class SystemMessageItem extends ContextItem {
293
282
  }): SystemMessageItem;
294
283
  }
295
284
 
285
+ declare class SemanticEvent<T> {
286
+ readonly type: string;
287
+ readonly data: T;
288
+ constructor(type: string, data: T);
289
+ getType(): string;
290
+ }
291
+
296
292
  declare class AgenticEnvironment {
297
293
  protected subscribers: Participant[];
298
294
  private isActive;
@@ -303,6 +299,7 @@ declare class AgenticEnvironment {
303
299
  deliverReasoning(source: Participant, item: ReasoningItem): void;
304
300
  deliverFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): void;
305
301
  deliverMessage(source: Participant, message: string): void;
302
+ deliverSemanticEvent(source: Participant, item: SemanticEvent<unknown>): void;
306
303
  start(): Promise<void>;
307
304
  stop(): void;
308
305
  }
@@ -326,35 +323,27 @@ declare abstract class Participant {
326
323
  abstract onModelMessage(item: ModelMessageItem): Promise<void> | void;
327
324
  abstract onExternalModelMessage(source: Participant, item: ModelMessageItem): Promise<void> | void;
328
325
  abstract onMessage(message: string): Promise<void> | void;
329
- }
330
-
331
- interface InputCapable {
332
- streamInput(environment: AgenticEnvironment): Promise<void>;
333
- }
334
- interface InferenceCapable {
335
- runInference(environment: AgenticEnvironment, context: ModelContext, model: GenerativeModel, signal?: AbortSignal): Promise<void>;
336
- }
337
- interface FunctionCallCapable {
338
- executeFunctionCall(environment: AgenticEnvironment, functionCallItem: FunctionCallItem, signal?: AbortSignal): Promise<void>;
326
+ abstract onInternalEvent(item: SemanticEvent<unknown>): Promise<void> | void;
327
+ abstract onExternalEvent(source: Participant, item: SemanticEvent<unknown>): Promise<void> | void;
339
328
  }
340
329
 
341
330
  interface InferenceRunner {
342
- run(context: ModelContext, model: GenerativeModel, signal?: AbortSignal): AsyncIterable<ReasoningItem | FunctionCallItem | ModelMessageItem>;
331
+ run(context: ModelContext, model: GenerativeModel, signal?: AbortSignal): AsyncIterable<ReasoningItem | FunctionCallItem | ModelMessageItem | SemanticEvent<unknown>>;
343
332
  }
344
333
 
345
334
  interface FunctionCallRunner {
346
335
  run(functionCallItem: FunctionCallItem, signal?: AbortSignal): AsyncIterable<FunctionCallOutputItem>;
347
336
  }
348
337
 
349
- interface InputStream {
350
- stream(signal?: AbortSignal): AsyncIterable<string>;
338
+ declare abstract class Agent extends Participant {
339
+ abstract executeFunctionCall(environment: AgenticEnvironment, functionCallItem: FunctionCallItem, signal?: AbortSignal): Promise<void>;
340
+ abstract runInference(environment: AgenticEnvironment, context: ModelContext, model: GenerativeModel, signal?: AbortSignal): Promise<void>;
351
341
  }
352
342
 
353
- declare class BaseAgentParticipant extends Participant implements InputCapable, InferenceCapable, FunctionCallCapable {
354
- private inputSource;
343
+ declare class BaseAgent extends Agent {
355
344
  private inferenceRunner;
356
345
  private functionCallRunner;
357
- constructor(inputSource: InputStream, inferenceRunner: InferenceRunner, functionCallRunner: FunctionCallRunner);
346
+ constructor(inferenceRunner: InferenceRunner, functionCallRunner: FunctionCallRunner);
358
347
  onJoined(): void;
359
348
  onLeft(): void;
360
349
  onParticipantJoined(participant: Participant): void;
@@ -368,14 +357,17 @@ declare class BaseAgentParticipant extends Participant implements InputCapable,
368
357
  onModelMessage(item: ModelMessageItem): void;
369
358
  onExternalModelMessage(source: Participant, item: ModelMessageItem): void;
370
359
  onMessage(message: string): void;
360
+ onInternalEvent(item: SemanticEvent<unknown>): void;
361
+ onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
371
362
  executeFunctionCall(environment: AgenticEnvironment, functionCallItem: FunctionCallItem, signal?: AbortSignal): Promise<void>;
372
363
  runInference(environment: AgenticEnvironment, context: ModelContext, model: GenerativeModel, signal?: AbortSignal): Promise<void>;
373
- streamInput(environment: AgenticEnvironment): Promise<void>;
374
364
  }
375
365
 
376
- declare class BaseHumanParticipant extends Participant implements InputCapable {
377
- private inputSource;
378
- constructor(inputSource: InputStream);
366
+ declare abstract class Human extends Participant {
367
+ sendMessage(environment: AgenticEnvironment, message: string): void;
368
+ }
369
+
370
+ declare class BaseHuman extends Human {
379
371
  onJoined(): void;
380
372
  onLeft(): void;
381
373
  onParticipantJoined(participant: Participant): void;
@@ -389,13 +381,16 @@ declare class BaseHumanParticipant extends Participant implements InputCapable {
389
381
  onExternalFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): void;
390
382
  onExternalReasoning(source: Participant, item: ReasoningItem): void;
391
383
  onExternalModelMessage(source: Participant, item: ModelMessageItem): void;
392
- streamInput(environment: AgenticEnvironment): Promise<void>;
384
+ onInternalEvent(item: SemanticEvent<unknown>): void;
385
+ onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
393
386
  }
394
387
 
395
- type InferenceItem = ReasoningItem | FunctionCallItem | ModelMessageItem;
388
+ type InferenceItem = ReasoningItem | FunctionCallItem | ModelMessageItem | SemanticEvent<unknown>;
396
389
  declare class OpenAIInferenceRunner implements InferenceRunner {
397
- private readonly runtime;
398
390
  run(context: ModelContext, model: GenerativeModel, signal?: AbortSignal): AsyncIterable<InferenceItem>;
391
+ extractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined;
392
+ mapContextToRequest(context: ModelContext): any[];
393
+ extractContextItems(response: any): ContextItem[];
399
394
  }
400
395
 
401
396
  declare class DefaultFunctionCallRunner implements FunctionCallRunner {
@@ -404,7 +399,7 @@ declare class DefaultFunctionCallRunner implements FunctionCallRunner {
404
399
  run(call: FunctionCallItem, signal?: AbortSignal): AsyncIterable<FunctionCallOutputItem>;
405
400
  }
406
401
 
407
- declare class Gpt55 implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {
402
+ declare class Gpt55 implements GenerativeModel {
408
403
  readonly specification: {
409
404
  name: string;
410
405
  supportReasoningEffort: boolean;
@@ -415,6 +410,9 @@ declare class Gpt55 implements GenerativeModel, ReasoningEffort<OpenAIReasoningE
415
410
  supportFunctionCalling: boolean;
416
411
  };
417
412
  private tools;
413
+ private streaming;
414
+ setStreaming(streaming: boolean): void;
415
+ getStreaming(): boolean;
418
416
  setTools(tools: Tool[]): void;
419
417
  getTools(): Tool[];
420
418
  private readonly effort;
@@ -422,7 +420,10 @@ declare class Gpt55 implements GenerativeModel, ReasoningEffort<OpenAIReasoningE
422
420
  getReasoningEffort(): OpenAIReasoningEffortType;
423
421
  }
424
422
 
425
- declare class BaseObserverParticipant extends Participant {
423
+ declare abstract class Observer extends Participant {
424
+ }
425
+
426
+ declare class BaseObserver extends Observer {
426
427
  onFunctionCall(item: FunctionCallItem): void;
427
428
  onExternalFunctionCall(source: Participant, item: FunctionCallItem): void;
428
429
  onFunctionCallOutput(item: FunctionCallOutputItem): void;
@@ -436,6 +437,8 @@ declare class BaseObserverParticipant extends Participant {
436
437
  onLeft(): void;
437
438
  onParticipantJoined(participant: Participant): void;
438
439
  onParticipantLeft(participant: Participant): void;
440
+ onInternalEvent(item: SemanticEvent<unknown>): void;
441
+ onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
439
442
  }
440
443
 
441
- export { AgenticEnvironment, BaseAgentParticipant, BaseHumanParticipant, BaseObserverParticipant, ContextItem, DefaultFunctionCallRunner, DeveloperMessageItem, FunctionCallItem, FunctionCallOutputItem, type FunctionCallRunner, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, Gpt55, InMemoryModelContextRepository, InferenceRequest, InferenceResponse, type InferenceRunner, type InputStream, InputTokenDetails, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIInferenceRunner, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, SystemMessageItem, TokenUsage, type Tool, UserMessageItem };
444
+ export { Agent, AgenticEnvironment, BaseAgent, BaseHuman, BaseObserver, ContextItem, DefaultFunctionCallRunner, DeveloperMessageItem, FunctionCallItem, FunctionCallOutputItem, type FunctionCallRunner, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, Gpt55, Human, InMemoryModelContextRepository, type InferenceRunner, InputTokenDetails, ModelContext, type ModelContextRepository, ModelMessageItem, Observer, OpenAIInferenceRunner, OutputTokenDetails, Participant, ReasoningItem, SystemMessageItem, TokenUsage, type Tool, UserMessageItem };