You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9073c52
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: services/www/src/docs/content/build/plugins/effect.mdx
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1277,6 +1277,26 @@ effect: (ctx) =>
1277
1277
}),
1278
1278
```
1279
1279
1280
+
`experimental.ws.send` and `experimental.ws.receive` expose the frames themselves: `send` runs after the provider
1281
+
driver builds an outbound frame, `receive` runs on each inbound frame before the driver observes it. Whatever `frame` holds when the hook returns is what crosses the wire or reaches the driver;
1282
+
OpenCode does not validate it.
1283
+
1284
+
```ts
1285
+
effect: (ctx) =>
1286
+
Effect.gen(function* () {
1287
+
yield*ctx.session.hook(
1288
+
"experimental.ws.send",
1289
+
(event) =>
1290
+
Effect.sync(() => {
1291
+
const body =JSON.parse(event.frame)
1292
+
if (body.type==="response.create") body.metadata= { ...body.metadata, session: event.sessionID }
1293
+
event.frame=JSON.stringify(body)
1294
+
}),
1295
+
{ providerID: "openai" },
1296
+
)
1297
+
}),
1298
+
```
1299
+
1280
1300
Override the retry decision for a provider failure or replace its delay in milliseconds. The hook runs after OpenCode
1281
1301
classifies the failure and proposes its policy, but before any retry is scheduled. It does not expose how OpenCode
0 commit comments