@mindstudio-ai/agent 0.1.54 → 0.1.55
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/cli.js +19 -11
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +19 -11
- package/llms.txt +12 -0
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -156,6 +156,18 @@ await mindstudio.generateImage({ prompt: '...' }, {
|
|
|
156
156
|
// event: { value: string, tag: string, ts: number }
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
+
**`stream()` — push real-time updates to the frontend:**
|
|
160
|
+
```typescript
|
|
161
|
+
import { mindstudio, stream } from '@mindstudio-ai/agent';
|
|
162
|
+
|
|
163
|
+
// String → 'token' event (frontend receives via onToken, accumulated text)
|
|
164
|
+
await stream('Processing...');
|
|
165
|
+
|
|
166
|
+
// Object → 'data' event (frontend receives via onStreamData, NOT onToken)
|
|
167
|
+
await stream({ status: 'generating', progress: 50 });
|
|
168
|
+
```
|
|
169
|
+
These are different event types — do not mix them up. `stream()` is silently ignored when no SSE connection is active (safe to include unconditionally). For long-running steps, combine `onLog` with `stream()` to push progress to the frontend.
|
|
170
|
+
|
|
159
171
|
**Results are returned flat** — output fields are spread at the top level alongside metadata:
|
|
160
172
|
|
|
161
173
|
```typescript
|