@mozaik-ai/core 3.8.1 → 3.8.3
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/README.md +6 -64
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,48 +58,6 @@ Mozaik ships two ready-to-use participants:
|
|
|
58
58
|
| `BaseHumanParticipant` | `InputCapable` | `InputStream` |
|
|
59
59
|
| `BaseAgentParticipant` | `InputCapable`, `InferenceCapable`, `FunctionCallCapable` | `InputStream`, `InferenceRunner`, `FunctionCallRunner` |
|
|
60
60
|
|
|
61
|
-
Each capability method is **non-blocking**: it returns `Promise<void>`, and as the underlying generator yields, every yielded value is forwarded into the environment through the matching typed `deliverX` method.
|
|
62
|
-
|
|
63
|
-
`streamInput` pulls plain-text messages from an `InputStream` and routes each one to `deliverMessage` — participants exchange raw text on the wire, not `UserMessageItem` / `DeveloperMessageItem` / `SystemMessageItem` envelopes:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
async streamInput(environment: AgenticEnvironment): Promise<void> {
|
|
67
|
-
if (!this.isJoinedTo(environment)) return
|
|
68
|
-
|
|
69
|
-
const stream = this.inputSource.stream()
|
|
70
|
-
for await (const message of stream) {
|
|
71
|
-
await environment.deliverMessage(this, message)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
`runInference` does the same for model output, dispatching each yielded item to `deliverReasoning`, `deliverFunctionCall`, or `deliverModelMessage`:
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
async runInference(
|
|
80
|
-
environment: AgenticEnvironment,
|
|
81
|
-
context: ModelContext,
|
|
82
|
-
model: GenerativeModel,
|
|
83
|
-
signal?: AbortSignal,
|
|
84
|
-
): Promise<void> {
|
|
85
|
-
if (!this.isJoinedTo(environment)) return
|
|
86
|
-
|
|
87
|
-
const stream = this.inferenceRunner.run(context, model, signal)
|
|
88
|
-
|
|
89
|
-
for await (const item of stream) {
|
|
90
|
-
if (item.type === "reasoning") {
|
|
91
|
-
await environment.deliverReasoning(this, item)
|
|
92
|
-
} else if (item.type === "function_call") {
|
|
93
|
-
await environment.deliverFunctionCall(this, item)
|
|
94
|
-
} else if (item.type === "message" && item.role === "assistant") {
|
|
95
|
-
await environment.deliverModelMessage(this, item)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Because each call is a fresh promise that wraps an async iterable, multiple participants can act on the same environment **concurrently**:
|
|
102
|
-
|
|
103
61
|
```ts
|
|
104
62
|
import {
|
|
105
63
|
AgenticEnvironment,
|
|
@@ -139,28 +97,6 @@ Instead of a single catch-all callback, `Participant` exposes **one typed handle
|
|
|
139
97
|
- **React** to its own outputs via the self handlers (e.g. execute a `FunctionCallItem` it just produced), or to others' outputs via the external handlers.
|
|
140
98
|
- **Ignore** events it doesn't care about — every handler defaults to a no-op in the bundled participants.
|
|
141
99
|
|
|
142
|
-
The intercept surface, taken from `Participant`:
|
|
143
|
-
|
|
144
|
-
```ts
|
|
145
|
-
abstract onFunctionCall(item: FunctionCallItem): Promise<void>
|
|
146
|
-
|
|
147
|
-
abstract onExternalFunctionCall(source: Participant, item: FunctionCallItem): Promise<void>
|
|
148
|
-
|
|
149
|
-
abstract onFunctionCallOutput(item: FunctionCallOutputItem): Promise<void>
|
|
150
|
-
|
|
151
|
-
abstract onExternalFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): Promise<void>
|
|
152
|
-
|
|
153
|
-
abstract onReasoning(item: ReasoningItem): Promise<void>
|
|
154
|
-
|
|
155
|
-
abstract onExternalReasoning(source: Participant, item: ReasoningItem): Promise<void>
|
|
156
|
-
|
|
157
|
-
abstract onModelMessage(item: ModelMessageItem): Promise<void>
|
|
158
|
-
|
|
159
|
-
abstract onExternalModelMessage(source: Participant, item: ModelMessageItem): Promise<void>
|
|
160
|
-
|
|
161
|
-
abstract onMessage(message: string): Promise<void>
|
|
162
|
-
```
|
|
163
|
-
|
|
164
100
|
The typed `ContextItem`s involved are defined in [src/domain/model-context/context-item](src/domain/model-context/context-item):
|
|
165
101
|
|
|
166
102
|
- Client-produced: `FunctionCallOutputItem` (and `UserMessageItem` / `DeveloperMessageItem` / `SystemMessageItem` when building a `ModelContext` directly)
|
|
@@ -411,6 +347,12 @@ You now own input, inference, and tool execution end-to-end while keeping the sa
|
|
|
411
347
|
|
|
412
348
|
---
|
|
413
349
|
|
|
350
|
+
## Made with Mozaik
|
|
351
|
+
|
|
352
|
+
- **[baro](https://github.com/Lotus015/baro)** — a Claude agent orchestrator where ten specialized participants (planner, executors, reviewer, fixer, librarian, auditor, and more) work fully concurrently on the same goal, like a team collaborating in real time instead of a single agent doing everything alone.
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
414
356
|
## Author & License
|
|
415
357
|
|
|
416
358
|
Created by the [JigJoy](https://jigjoy.io) team.
|