@collective-intelligence/external-apps-server-sdk 0.1.18 → 0.1.21
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 +31 -0
- package/dist/gateway.js +2 -2
- package/dist/persistence/drizzle.js +2 -2
- package/dist/runtime/effect.js +2 -2
- package/dist/runtime/next.d.ts +22 -1
- package/dist/runtime/next.js +2 -2
- package/dist/runtime/web.d.ts +22 -1
- package/dist/runtime/web.js +2 -2
- package/dist/tools/ai-sdk.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1540,6 +1540,37 @@ and is not forwarded. A local `defineEntityResource` binding answers
|
|
|
1540
1540
|
`capability_not_supported`, and a `defineCrudResource` handler answers 404 for
|
|
1541
1541
|
this path. The client SDK README documents the write form.
|
|
1542
1542
|
|
|
1543
|
+
### Realtime ticket route
|
|
1544
|
+
|
|
1545
|
+
A browser opens the CI realtime stream with a single-use ticket, never with the
|
|
1546
|
+
user's token. Add `realtime` to the BFF; it mounts
|
|
1547
|
+
`POST {basePath}/realtime/ticket` (`basePath` defaults to `/api`) ahead of the
|
|
1548
|
+
dedicated Capability prefix:
|
|
1549
|
+
|
|
1550
|
+
```ts
|
|
1551
|
+
createExternalApplicationBffNextHandlers({
|
|
1552
|
+
auth,
|
|
1553
|
+
publicOrigin: env.APP_ORIGIN,
|
|
1554
|
+
realtime: {
|
|
1555
|
+
organizationId: env.CI_ORGANIZATION_ID,
|
|
1556
|
+
tenantUrl: env.CI_TENANT_URL,
|
|
1557
|
+
// Optional: the origin the browser opens the stream on.
|
|
1558
|
+
host: "https://realtime.example.com"
|
|
1559
|
+
}
|
|
1560
|
+
})
|
|
1561
|
+
```
|
|
1562
|
+
|
|
1563
|
+
The route accepts `{ topics }` as JSON from the application's own origin
|
|
1564
|
+
(cross-site requests answer 403), reads the signed-in user's server-held
|
|
1565
|
+
delegated token, and calls CI `POST /application/v1/realtime/tickets` with it.
|
|
1566
|
+
It answers `{ ticket, expiresAt, streamUrl }`; `streamUrl` is
|
|
1567
|
+
`{host}/application/v1/realtime/events?ticket=…`, and `host` defaults to
|
|
1568
|
+
`tenantUrl`. Without a session it answers 401 before calling CI. CI refusals
|
|
1569
|
+
keep their status, body, and `Retry-After`: 429 `too_many_connections` at the
|
|
1570
|
+
per-user connection cap, 503 `unavailable`. Use
|
|
1571
|
+
`createRealtimeTicketHandler` from `/runtime/web` or `/runtime/next` to mount
|
|
1572
|
+
the route yourself. The client SDK README documents the browser client.
|
|
1573
|
+
|
|
1543
1574
|
## Optional local user authentication
|
|
1544
1575
|
|
|
1545
1576
|
Import `createBetterAuth` only from
|