@mozaik-ai/core 4.0.0-beta.10 → 4.0.0-beta.12
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 +32 -23
- package/dist/index.d.ts +32 -23
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -240,6 +240,14 @@ type InterceptionOutput = {
|
|
|
240
240
|
interface InterceptionParams {
|
|
241
241
|
pendingTransition: LoopTransition;
|
|
242
242
|
}
|
|
243
|
+
type ExecutableLoopStateId = Exclude<LoopStateId, "idle">;
|
|
244
|
+
type LoopStateExecution<TStateId extends ExecutableLoopStateId = ExecutableLoopStateId> = {
|
|
245
|
+
[K in TStateId]: {
|
|
246
|
+
stateId: K;
|
|
247
|
+
input: LoopStateContract[K]["input"];
|
|
248
|
+
output: LoopStateContract[K]["output"];
|
|
249
|
+
};
|
|
250
|
+
}[TStateId];
|
|
243
251
|
type LoopTransition<TStateId extends LoopStateId = LoopStateId> = {
|
|
244
252
|
[K in TStateId]: {
|
|
245
253
|
nextStateId: K;
|
|
@@ -247,6 +255,23 @@ type LoopTransition<TStateId extends LoopStateId = LoopStateId> = {
|
|
|
247
255
|
};
|
|
248
256
|
}[TStateId];
|
|
249
257
|
|
|
258
|
+
declare class InputTokenDetails {
|
|
259
|
+
readonly cached_tokens: number;
|
|
260
|
+
constructor(cached_tokens: number);
|
|
261
|
+
}
|
|
262
|
+
declare class OutputTokenDetails {
|
|
263
|
+
readonly reasoning_tokens: number;
|
|
264
|
+
constructor(reasoning_tokens: number);
|
|
265
|
+
}
|
|
266
|
+
declare class TokenUsage {
|
|
267
|
+
readonly inputTokens: number;
|
|
268
|
+
readonly outputTokens: number;
|
|
269
|
+
readonly totalTokens: number;
|
|
270
|
+
readonly inputTokenDetails: InputTokenDetails;
|
|
271
|
+
readonly outputTokenDetails: OutputTokenDetails;
|
|
272
|
+
constructor(inputTokens: number, outputTokens: number, totalTokens: number, inputTokenDetails: InputTokenDetails, outputTokenDetails: OutputTokenDetails);
|
|
273
|
+
}
|
|
274
|
+
|
|
250
275
|
type InferenceInput = {
|
|
251
276
|
model: string;
|
|
252
277
|
maxOutputTokens?: number;
|
|
@@ -259,6 +284,7 @@ type InferenceInput = {
|
|
|
259
284
|
type InferenceItem = FunctionCallItem | ReasoningItem | ModelMessageItem;
|
|
260
285
|
type InferenceOutput = {
|
|
261
286
|
items: InferenceItem[];
|
|
287
|
+
tokenUsage: TokenUsage | undefined;
|
|
262
288
|
rowResponse: any;
|
|
263
289
|
};
|
|
264
290
|
interface InferenceRunner {
|
|
@@ -311,23 +337,6 @@ interface ModelContextRepository {
|
|
|
311
337
|
getByProjectId(projectId: string): Promise<ModelContext[]>;
|
|
312
338
|
}
|
|
313
339
|
|
|
314
|
-
declare class InputTokenDetails {
|
|
315
|
-
readonly cached_tokens: number;
|
|
316
|
-
constructor(cached_tokens: number);
|
|
317
|
-
}
|
|
318
|
-
declare class OutputTokenDetails {
|
|
319
|
-
readonly reasoning_tokens: number;
|
|
320
|
-
constructor(reasoning_tokens: number);
|
|
321
|
-
}
|
|
322
|
-
declare class TokenUsage {
|
|
323
|
-
readonly inputTokens: number;
|
|
324
|
-
readonly outputTokens: number;
|
|
325
|
-
readonly totalTokens: number;
|
|
326
|
-
readonly inputTokenDetails: InputTokenDetails;
|
|
327
|
-
readonly outputTokenDetails: OutputTokenDetails;
|
|
328
|
-
constructor(inputTokens: number, outputTokens: number, totalTokens: number, inputTokenDetails: InputTokenDetails, outputTokenDetails: OutputTokenDetails);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
340
|
interface McpServerConfig {
|
|
332
341
|
/** The MCP server URL, e.g. https://api.githubcopilot.com/mcp/ */
|
|
333
342
|
url: string;
|
|
@@ -459,11 +468,6 @@ declare abstract class RuntimeState {
|
|
|
459
468
|
getParticipants(): readonly Participant[];
|
|
460
469
|
}
|
|
461
470
|
|
|
462
|
-
interface InterceptionHandler {
|
|
463
|
-
isSatisfiedBy(transition: LoopTransition): boolean;
|
|
464
|
-
handle(transition: LoopTransition): Promise<LoopTransition>;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
471
|
declare class EventProcessor {
|
|
468
472
|
process(event: SemanticEvent, consumer: Participant): void;
|
|
469
473
|
}
|
|
@@ -615,4 +619,9 @@ declare class DefaultInferenceRunner implements InferenceRunner {
|
|
|
615
619
|
stream(input: InferenceInput): AsyncGenerator<SemanticEvent>;
|
|
616
620
|
}
|
|
617
621
|
|
|
618
|
-
|
|
622
|
+
interface InterceptionHandler {
|
|
623
|
+
isSatisfiedBy(transition: LoopTransition<ExecutableLoopStateId>): boolean;
|
|
624
|
+
handle(transition: LoopTransition<ExecutableLoopStateId>): Promise<LoopTransition<ExecutableLoopStateId>>;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export { Agent, AnthropicMessages, ContextItem, DefaultInferenceRunner, DeveloperMessageItem, type Endpoint, type ExecutableLoopStateId, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -240,6 +240,14 @@ type InterceptionOutput = {
|
|
|
240
240
|
interface InterceptionParams {
|
|
241
241
|
pendingTransition: LoopTransition;
|
|
242
242
|
}
|
|
243
|
+
type ExecutableLoopStateId = Exclude<LoopStateId, "idle">;
|
|
244
|
+
type LoopStateExecution<TStateId extends ExecutableLoopStateId = ExecutableLoopStateId> = {
|
|
245
|
+
[K in TStateId]: {
|
|
246
|
+
stateId: K;
|
|
247
|
+
input: LoopStateContract[K]["input"];
|
|
248
|
+
output: LoopStateContract[K]["output"];
|
|
249
|
+
};
|
|
250
|
+
}[TStateId];
|
|
243
251
|
type LoopTransition<TStateId extends LoopStateId = LoopStateId> = {
|
|
244
252
|
[K in TStateId]: {
|
|
245
253
|
nextStateId: K;
|
|
@@ -247,6 +255,23 @@ type LoopTransition<TStateId extends LoopStateId = LoopStateId> = {
|
|
|
247
255
|
};
|
|
248
256
|
}[TStateId];
|
|
249
257
|
|
|
258
|
+
declare class InputTokenDetails {
|
|
259
|
+
readonly cached_tokens: number;
|
|
260
|
+
constructor(cached_tokens: number);
|
|
261
|
+
}
|
|
262
|
+
declare class OutputTokenDetails {
|
|
263
|
+
readonly reasoning_tokens: number;
|
|
264
|
+
constructor(reasoning_tokens: number);
|
|
265
|
+
}
|
|
266
|
+
declare class TokenUsage {
|
|
267
|
+
readonly inputTokens: number;
|
|
268
|
+
readonly outputTokens: number;
|
|
269
|
+
readonly totalTokens: number;
|
|
270
|
+
readonly inputTokenDetails: InputTokenDetails;
|
|
271
|
+
readonly outputTokenDetails: OutputTokenDetails;
|
|
272
|
+
constructor(inputTokens: number, outputTokens: number, totalTokens: number, inputTokenDetails: InputTokenDetails, outputTokenDetails: OutputTokenDetails);
|
|
273
|
+
}
|
|
274
|
+
|
|
250
275
|
type InferenceInput = {
|
|
251
276
|
model: string;
|
|
252
277
|
maxOutputTokens?: number;
|
|
@@ -259,6 +284,7 @@ type InferenceInput = {
|
|
|
259
284
|
type InferenceItem = FunctionCallItem | ReasoningItem | ModelMessageItem;
|
|
260
285
|
type InferenceOutput = {
|
|
261
286
|
items: InferenceItem[];
|
|
287
|
+
tokenUsage: TokenUsage | undefined;
|
|
262
288
|
rowResponse: any;
|
|
263
289
|
};
|
|
264
290
|
interface InferenceRunner {
|
|
@@ -311,23 +337,6 @@ interface ModelContextRepository {
|
|
|
311
337
|
getByProjectId(projectId: string): Promise<ModelContext[]>;
|
|
312
338
|
}
|
|
313
339
|
|
|
314
|
-
declare class InputTokenDetails {
|
|
315
|
-
readonly cached_tokens: number;
|
|
316
|
-
constructor(cached_tokens: number);
|
|
317
|
-
}
|
|
318
|
-
declare class OutputTokenDetails {
|
|
319
|
-
readonly reasoning_tokens: number;
|
|
320
|
-
constructor(reasoning_tokens: number);
|
|
321
|
-
}
|
|
322
|
-
declare class TokenUsage {
|
|
323
|
-
readonly inputTokens: number;
|
|
324
|
-
readonly outputTokens: number;
|
|
325
|
-
readonly totalTokens: number;
|
|
326
|
-
readonly inputTokenDetails: InputTokenDetails;
|
|
327
|
-
readonly outputTokenDetails: OutputTokenDetails;
|
|
328
|
-
constructor(inputTokens: number, outputTokens: number, totalTokens: number, inputTokenDetails: InputTokenDetails, outputTokenDetails: OutputTokenDetails);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
340
|
interface McpServerConfig {
|
|
332
341
|
/** The MCP server URL, e.g. https://api.githubcopilot.com/mcp/ */
|
|
333
342
|
url: string;
|
|
@@ -459,11 +468,6 @@ declare abstract class RuntimeState {
|
|
|
459
468
|
getParticipants(): readonly Participant[];
|
|
460
469
|
}
|
|
461
470
|
|
|
462
|
-
interface InterceptionHandler {
|
|
463
|
-
isSatisfiedBy(transition: LoopTransition): boolean;
|
|
464
|
-
handle(transition: LoopTransition): Promise<LoopTransition>;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
471
|
declare class EventProcessor {
|
|
468
472
|
process(event: SemanticEvent, consumer: Participant): void;
|
|
469
473
|
}
|
|
@@ -615,4 +619,9 @@ declare class DefaultInferenceRunner implements InferenceRunner {
|
|
|
615
619
|
stream(input: InferenceInput): AsyncGenerator<SemanticEvent>;
|
|
616
620
|
}
|
|
617
621
|
|
|
618
|
-
|
|
622
|
+
interface InterceptionHandler {
|
|
623
|
+
isSatisfiedBy(transition: LoopTransition<ExecutableLoopStateId>): boolean;
|
|
624
|
+
handle(transition: LoopTransition<ExecutableLoopStateId>): Promise<LoopTransition<ExecutableLoopStateId>>;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export { Agent, AnthropicMessages, ContextItem, DefaultInferenceRunner, DeveloperMessageItem, type Endpoint, type ExecutableLoopStateId, 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 };
|
package/dist/index.js
CHANGED
|
@@ -633,10 +633,9 @@ var AgentLoop = class _AgentLoop {
|
|
|
633
633
|
loopVisitor.visitInterceptionStarted(transition);
|
|
634
634
|
transition = await this.interceptionHandler.handle(transition);
|
|
635
635
|
loopVisitor.visitInterceptionFinished(transition);
|
|
636
|
-
} else {
|
|
637
|
-
const execution = await this.stateExecutor.execute(transition, loopVisitor);
|
|
638
|
-
transition = this.transitionResolver.resolve(execution);
|
|
639
636
|
}
|
|
637
|
+
const execution = await this.stateExecutor.execute(transition, loopVisitor);
|
|
638
|
+
transition = this.transitionResolver.resolve(execution);
|
|
640
639
|
}
|
|
641
640
|
}
|
|
642
641
|
getLoopId() {
|
|
@@ -1131,7 +1130,7 @@ var AnthropicMessagesMapper = class {
|
|
|
1131
1130
|
);
|
|
1132
1131
|
}
|
|
1133
1132
|
}
|
|
1134
|
-
return { items, rowResponse: response };
|
|
1133
|
+
return { items, tokenUsage: this.extractTokenUsage(response), rowResponse: response };
|
|
1135
1134
|
}
|
|
1136
1135
|
};
|
|
1137
1136
|
|
|
@@ -1319,6 +1318,7 @@ var OpenAIResponsesMapper = class {
|
|
|
1319
1318
|
}
|
|
1320
1319
|
return {
|
|
1321
1320
|
items,
|
|
1321
|
+
tokenUsage: this.extractTokenUsage(response),
|
|
1322
1322
|
rowResponse: response
|
|
1323
1323
|
};
|
|
1324
1324
|
}
|
|
@@ -1507,7 +1507,7 @@ var GeminiGenerateContentMapper = class {
|
|
|
1507
1507
|
);
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
1510
|
-
return { items, rowResponse: response };
|
|
1510
|
+
return { items, tokenUsage: this.extractTokenUsage(response), rowResponse: response };
|
|
1511
1511
|
}
|
|
1512
1512
|
};
|
|
1513
1513
|
|
|
@@ -1630,7 +1630,7 @@ var OpenAIChatCompletionsMapper = class {
|
|
|
1630
1630
|
const items = [];
|
|
1631
1631
|
const message = (_b = (_a = response.choices) == null ? void 0 : _a[0]) == null ? void 0 : _b.message;
|
|
1632
1632
|
if (!message) {
|
|
1633
|
-
return { items: [], rowResponse: response };
|
|
1633
|
+
return { items: [], tokenUsage: this.extractTokenUsage(response), rowResponse: response };
|
|
1634
1634
|
}
|
|
1635
1635
|
if (message.reasoning_content) {
|
|
1636
1636
|
items.push(
|
|
@@ -1653,7 +1653,7 @@ var OpenAIChatCompletionsMapper = class {
|
|
|
1653
1653
|
})
|
|
1654
1654
|
);
|
|
1655
1655
|
}
|
|
1656
|
-
return { items, rowResponse: response };
|
|
1656
|
+
return { items, tokenUsage: this.extractTokenUsage(response), rowResponse: response };
|
|
1657
1657
|
}
|
|
1658
1658
|
};
|
|
1659
1659
|
|