@octavus/docs 0.0.3 → 0.0.4

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.
@@ -173,48 +173,6 @@ type StreamEvent =
173
173
  | ToolRequestEvent;
174
174
  ```
175
175
 
176
- ## Handling Streams Manually
177
-
178
- If you need to process the stream server-side:
179
-
180
- ```typescript
181
- import { safeParseStreamEvent } from '@octavus/core';
182
-
183
- const { stream } = session.trigger('user-message', { USER_MESSAGE: 'Hello' });
184
-
185
- const reader = stream.getReader();
186
- const decoder = new TextDecoder();
187
-
188
- let buffer = '';
189
-
190
- while (true) {
191
- const { done, value } = await reader.read();
192
- if (done) break;
193
-
194
- buffer += decoder.decode(value, { stream: true });
195
- const lines = buffer.split('\n');
196
- buffer = lines.pop() ?? '';
197
-
198
- for (const line of lines) {
199
- if (line.startsWith('data: ') && line !== 'data: [DONE]') {
200
- const parsed = safeParseStreamEvent(JSON.parse(line.slice(6)));
201
- if (parsed.success) {
202
- const event = parsed.data;
203
-
204
- switch (event.type) {
205
- case 'text-delta':
206
- process.stdout.write(event.delta);
207
- break;
208
- case 'finish':
209
- console.log('\nDone:', event.finishReason);
210
- break;
211
- }
212
- }
213
- }
214
- }
215
- }
216
- ```
217
-
218
176
  ## Error Recovery
219
177
 
220
178
  The SDK handles common error scenarios: