@mozaik-ai/core 0.9.4 → 2.0.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,132 +1,148 @@
1
- import { ZodObject } from 'zod';
2
-
3
- declare class Workflow extends WorkUnit {
4
- readonly mode: "parallel" | "sequential";
5
- readonly units: WorkUnit[];
6
- constructor(mode: "parallel" | "sequential", units: WorkUnit[]);
7
- execute(hook?: ExecutionHook): Promise<any>;
1
+ declare abstract class ContextItem {
2
+ abstract readonly type: string;
3
+ getType(): string;
4
+ abstract toJSON(): any;
8
5
  }
9
6
 
10
- declare class Task extends WorkUnit {
11
- private task;
12
- private model;
13
- constructor(task: string, model: Model);
14
- getTask(): string;
15
- getModel(): Model;
16
- execute(hook?: ExecutionHook): Promise<any>;
7
+ declare class Context {
8
+ readonly id: string;
9
+ readonly projectId: string;
10
+ readonly items: ContextItem[];
11
+ constructor(id: string, projectId: string, items: ContextItem[]);
12
+ addItem(item: ContextItem): Context;
13
+ addItems(items: ContextItem[]): Context;
14
+ getItems(): ContextItem[];
15
+ static create(projectId: string): Context;
16
+ static rehydrate(data: {
17
+ id: string;
18
+ projectId: string;
19
+ items: ContextItem[];
20
+ }): Context;
21
+ toJSON(): any;
17
22
  }
18
23
 
19
- interface ExecutionHook {
20
- beforeWorkflow(wf: Workflow): void;
21
- afterWorkflow(wf: Workflow, result: any): void;
22
- beforeTask(task: Task): void;
23
- afterTask(task: Task, result: any): void;
24
+ declare abstract class Content {
25
+ abstract readonly type: string;
24
26
  }
25
27
 
26
- declare abstract class WorkUnit {
27
- constructor();
28
- abstract execute(hook: ExecutionHook): Promise<any>;
28
+ declare class InputText extends Content {
29
+ readonly text: string;
30
+ readonly type = "input_text";
31
+ private constructor();
32
+ static create(text: string): InputText;
33
+ static rehydrate(data: {
34
+ text: string;
35
+ }): InputText;
36
+ toJSON(): any[];
29
37
  }
30
38
 
31
- interface TextPart {
32
- type: "text";
33
- text: string;
34
- }
35
- interface ImagePart {
36
- type: "image_url";
37
- url: string;
38
- }
39
- interface Message {
40
- role: "system" | "user" | "assistant" | "tool";
41
- content: string | Array<TextPart | ImagePart>;
39
+ declare class UserMessage extends ContextItem {
40
+ readonly type = "message";
41
+ readonly role = "user";
42
+ readonly content: InputText;
43
+ private constructor();
44
+ static create(text: string): UserMessage;
45
+ static rehydrate(data: {
46
+ text: string;
47
+ }): UserMessage;
48
+ toJSON(): any;
42
49
  }
43
50
 
44
- declare const OPENAI_MODELS: readonly ["gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5.1", "gpt-5.2", "gpt-5.4"];
45
- type OpenAIModel = (typeof OPENAI_MODELS)[number];
46
- declare const ANTHROPIC_MODELS: readonly ["claude-sonnet-4.5", "claude-haiku-4.5", "claude-opus-4.5"];
47
- type AnthropicModel = (typeof ANTHROPIC_MODELS)[number];
48
- type Model = OpenAIModel | AnthropicModel;
49
-
50
- interface Tool {
51
- name: string;
52
- description: string;
53
- schema: Record<string, any>;
54
- invoke: (args: any) => Promise<any>;
51
+ declare class DeveloperMessage extends ContextItem {
52
+ readonly type = "message";
53
+ readonly role = "developer";
54
+ readonly content: InputText;
55
+ private constructor();
56
+ toJSON(): any;
57
+ static create(text: string): DeveloperMessage;
58
+ static rehydrate(data: {
59
+ text: string;
60
+ }): DeveloperMessage;
55
61
  }
56
62
 
57
- type MozaikRequest = {
58
- model: Model;
59
- messages?: Message[];
60
- task?: string;
61
- structuredOutput?: ZodObject<any>;
62
- tools?: Tool[];
63
- reasoningEffort?: ReasoningEffort;
64
- };
65
- declare enum ReasoningEffort {
66
- NONE = "none",
67
- LOW = "low",
68
- MEDIUM = "medium",
69
- HIGH = "high",
70
- MAX = "max"
63
+ declare class OutputText extends Content {
64
+ readonly text: string;
65
+ readonly type = "output_text";
66
+ private constructor();
67
+ static rehydrate(data: {
68
+ text: string;
69
+ }): OutputText;
70
+ toJSON(): any[];
71
71
  }
72
72
 
73
- declare abstract class RequestBuilder {
74
- request: any;
75
- initialize(): void;
76
- abstract addModel(model: string): RequestBuilder;
77
- abstract addTask(task: string): RequestBuilder;
78
- abstract addMessages(messages: Message[]): RequestBuilder;
79
- abstract addStructuredOutput(schema: ZodObject<any>): RequestBuilder;
80
- abstract addTools(tools: Tool[]): RequestBuilder;
81
- abstract addReasoningEffort(effort: ReasoningEffort): RequestBuilder;
82
- build(): any;
73
+ declare class ModelMessage extends ContextItem {
74
+ readonly type = "message";
75
+ readonly role = "assistant";
76
+ readonly content: OutputText;
77
+ private constructor();
78
+ static rehydrate(data: {
79
+ text: string;
80
+ }): ModelMessage;
81
+ toJSON(): any;
83
82
  }
84
83
 
85
- declare abstract class Endpoint {
86
- abstract requestBuilder: RequestBuilder;
87
- request: MozaikRequest | null;
88
- buildRequest(request: MozaikRequest): any;
89
- abstract sendRequest(providerRequest: any): any;
84
+ declare class FunctionCall extends ContextItem {
85
+ readonly type = "function_call";
86
+ readonly callId: string;
87
+ readonly name: string;
88
+ readonly args: string;
89
+ private constructor();
90
+ static rehydrate(data: {
91
+ callId: string;
92
+ name: string;
93
+ args: string;
94
+ }): FunctionCall;
95
+ toJSON(): any;
90
96
  }
91
97
 
92
- declare abstract class EndpointResolver {
93
- abstract resolve(model: string): Endpoint;
98
+ declare class SummaryText extends Content {
99
+ readonly text: string;
100
+ readonly type = "summary_text";
101
+ private constructor();
102
+ static rehydrate(data: {
103
+ text: string;
104
+ }): SummaryText;
105
+ toJSON(): Record<string, any>;
94
106
  }
95
107
 
96
- declare class RequestGateway {
97
- readonly endpointResolver: EndpointResolver;
98
- endpoint: Endpoint;
99
- constructor(endpointResolver: EndpointResolver);
100
- invoke(request: MozaikRequest): Promise<any>;
108
+ declare class Reasoning extends ContextItem {
109
+ readonly type = "reasoning";
110
+ readonly content: InputText | undefined;
111
+ readonly encryptedContent: string | undefined;
112
+ readonly summary: SummaryText[];
113
+ private constructor();
114
+ static rehydrate(data: {
115
+ content: InputText | undefined;
116
+ encryptedContent: string | undefined;
117
+ summary: SummaryText[];
118
+ }): Reasoning;
119
+ toJSON(): any;
101
120
  }
102
121
 
103
- declare class MozaikAgent {
104
- private request;
105
- gateway: RequestGateway;
106
- constructor(request: MozaikRequest);
107
- setModel(model: Model): void;
108
- setMessages(messages: Message[]): void;
109
- setTask(task: string): void;
110
- setStructuredOutput(schema: ZodObject<any>): void;
111
- act(task?: string): Promise<any>;
122
+ declare abstract class GenerativeModel {
123
+ abstract mapContextToRequest(context: Context): any[];
124
+ abstract extractContextItems(response: any): ContextItem[];
125
+ abstract infer(request: any): Promise<any>;
126
+ call(context: Context): Promise<ContextItem[]>;
112
127
  }
113
128
 
114
- declare class PlanningAgent extends MozaikAgent {
115
- constructor(request: MozaikRequest);
116
- planFromGoal(goal: string): Promise<Workflow>;
129
+ declare class FunctionCallOutput extends ContextItem {
130
+ readonly type = "function_call_output";
131
+ readonly callId: string;
132
+ readonly output: InputText[];
133
+ private constructor();
134
+ static create(callId: string, output: InputText[]): FunctionCallOutput;
135
+ static rehydrate(data: {
136
+ callId: string;
137
+ output: InputText[];
138
+ }): FunctionCallOutput;
139
+ toJSON(): any;
117
140
  }
118
141
 
119
- type UsageEntry = {
120
- inputTokens: number;
121
- outputTokens: number;
122
- model: string;
123
- };
124
- type MozaikResponse = {
125
- data: any;
126
- usage: {
127
- entries: UsageEntry[];
128
- totalUsdCost: number;
129
- };
130
- };
142
+ interface ContextRepository {
143
+ save(context: Context): Promise<void>;
144
+ get(id: string): Promise<Context>;
145
+ getByProjectId(projectId: string): Promise<Context[]>;
146
+ }
131
147
 
132
- export { type Message, type Model, MozaikAgent, type MozaikRequest, type MozaikResponse, PlanningAgent, ReasoningEffort, Task, type Tool, WorkUnit, Workflow };
148
+ export { Context, ContextItem, type ContextRepository, DeveloperMessage, FunctionCall, FunctionCallOutput, GenerativeModel, ModelMessage, Reasoning, UserMessage };