@recursiv/sdk 0.7.14 → 0.7.15
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 +23 -4
- package/dist/client.d.ts +0 -1
- package/dist/client.js +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +0 -1
- package/dist/lib/sse.d.ts +0 -1
- package/dist/lib/sse.js +0 -1
- package/dist/lib/webhooks.d.ts +0 -1
- package/dist/lib/webhooks.js +0 -1
- package/dist/next/index.d.ts +0 -1
- package/dist/next/index.js +0 -1
- package/dist/next/scopes.d.ts +0 -1
- package/dist/next/scopes.js +0 -1
- package/dist/next/server-auth.d.ts +0 -1
- package/dist/next/server-auth.js +0 -1
- package/dist/react/index.d.ts +0 -1
- package/dist/react/index.js +0 -1
- package/dist/react/useChat.d.ts +0 -1
- package/dist/react/useChat.js +0 -1
- package/dist/realtime.d.ts +1 -2
- package/dist/realtime.js +23 -11
- package/dist/resources/accounts.d.ts +0 -1
- package/dist/resources/accounts.js +0 -1
- package/dist/resources/admin.d.ts +0 -1
- package/dist/resources/admin.js +0 -1
- package/dist/resources/agents.d.ts +11 -2
- package/dist/resources/agents.js +12 -1
- package/dist/resources/app-subscriptions.d.ts +0 -1
- package/dist/resources/app-subscriptions.js +0 -1
- package/dist/resources/auth.d.ts +25 -1
- package/dist/resources/auth.js +75 -4
- package/dist/resources/billing.d.ts +0 -1
- package/dist/resources/billing.js +0 -1
- package/dist/resources/brain.d.ts +0 -1
- package/dist/resources/brain.js +0 -1
- package/dist/resources/brief.d.ts +0 -1
- package/dist/resources/brief.js +0 -1
- package/dist/resources/chat.d.ts +0 -1
- package/dist/resources/chat.js +0 -1
- package/dist/resources/commands.d.ts +0 -1
- package/dist/resources/commands.js +0 -1
- package/dist/resources/communities.d.ts +66 -4
- package/dist/resources/communities.js +62 -2
- package/dist/resources/curator.d.ts +0 -1
- package/dist/resources/curator.js +0 -1
- package/dist/resources/databases.d.ts +0 -1
- package/dist/resources/databases.js +0 -1
- package/dist/resources/deployments.d.ts +0 -1
- package/dist/resources/deployments.js +0 -1
- package/dist/resources/dispatcher.d.ts +18 -2
- package/dist/resources/dispatcher.js +6 -2
- package/dist/resources/email.d.ts +0 -1
- package/dist/resources/email.js +0 -1
- package/dist/resources/env-vars.d.ts +0 -1
- package/dist/resources/env-vars.js +0 -1
- package/dist/resources/evidence.d.ts +26 -4
- package/dist/resources/evidence.js +8 -1
- package/dist/resources/free-tier.d.ts +0 -1
- package/dist/resources/free-tier.js +0 -1
- package/dist/resources/github.d.ts +0 -1
- package/dist/resources/github.js +0 -1
- package/dist/resources/goals.d.ts +0 -1
- package/dist/resources/goals.js +0 -1
- package/dist/resources/human-asks.d.ts +0 -1
- package/dist/resources/human-asks.js +0 -1
- package/dist/resources/human-input.d.ts +0 -1
- package/dist/resources/human-input.js +0 -1
- package/dist/resources/inbox.d.ts +0 -1
- package/dist/resources/inbox.js +0 -1
- package/dist/resources/integrations.d.ts +0 -1
- package/dist/resources/integrations.js +0 -1
- package/dist/resources/invite-codes-admin.d.ts +0 -1
- package/dist/resources/invite-codes-admin.js +0 -1
- package/dist/resources/invite-codes.d.ts +0 -1
- package/dist/resources/invite-codes.js +0 -1
- package/dist/resources/jobs.d.ts +0 -1
- package/dist/resources/jobs.js +0 -1
- package/dist/resources/link-preview.d.ts +0 -1
- package/dist/resources/link-preview.js +0 -1
- package/dist/resources/media.d.ts +0 -1
- package/dist/resources/media.js +0 -1
- package/dist/resources/memory.d.ts +0 -1
- package/dist/resources/memory.js +0 -1
- package/dist/resources/moderation.d.ts +0 -1
- package/dist/resources/moderation.js +0 -1
- package/dist/resources/network.d.ts +0 -1
- package/dist/resources/network.js +0 -1
- package/dist/resources/notifications.d.ts +14 -2
- package/dist/resources/notifications.js +5 -3
- package/dist/resources/organization-security.d.ts +0 -1
- package/dist/resources/organization-security.js +0 -1
- package/dist/resources/organization-settings.d.ts +18 -1
- package/dist/resources/organization-settings.js +4 -1
- package/dist/resources/organizations.d.ts +0 -1
- package/dist/resources/organizations.js +0 -1
- package/dist/resources/posts.d.ts +0 -1
- package/dist/resources/posts.js +0 -1
- package/dist/resources/profiles.d.ts +8 -1
- package/dist/resources/profiles.js +8 -1
- package/dist/resources/project-brain.d.ts +18 -1
- package/dist/resources/project-brain.js +11 -1
- package/dist/resources/project-settings.d.ts +0 -1
- package/dist/resources/project-settings.js +0 -1
- package/dist/resources/projects.d.ts +0 -1
- package/dist/resources/projects.js +0 -1
- package/dist/resources/protocols.d.ts +54 -1
- package/dist/resources/protocols.js +29 -1
- package/dist/resources/reports.d.ts +0 -1
- package/dist/resources/reports.js +0 -1
- package/dist/resources/sandbox.d.ts +0 -1
- package/dist/resources/sandbox.js +0 -1
- package/dist/resources/settings.d.ts +0 -1
- package/dist/resources/settings.js +0 -1
- package/dist/resources/simulator.d.ts +0 -1
- package/dist/resources/simulator.js +0 -1
- package/dist/resources/storage.d.ts +0 -1
- package/dist/resources/storage.js +0 -1
- package/dist/resources/swarms.d.ts +0 -1
- package/dist/resources/swarms.js +0 -1
- package/dist/resources/tags.d.ts +0 -1
- package/dist/resources/tags.js +0 -1
- package/dist/resources/templates.d.ts +0 -1
- package/dist/resources/templates.js +0 -1
- package/dist/resources/uploads.d.ts +0 -1
- package/dist/resources/uploads.js +0 -1
- package/dist/resources/users.d.ts +0 -1
- package/dist/resources/users.js +0 -1
- package/dist/resources/video.d.ts +0 -1
- package/dist/resources/video.js +0 -1
- package/dist/resources/wallet.d.ts +16 -1
- package/dist/resources/wallet.js +12 -1
- package/dist/resources/webhooks.d.ts +0 -1
- package/dist/resources/webhooks.js +0 -1
- package/dist/types.d.ts +34 -1
- package/dist/types.js +0 -1
- package/llm.md +29 -2
- package/package.json +13 -7
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/sse.d.ts.map +0 -1
- package/dist/lib/sse.js.map +0 -1
- package/dist/lib/webhooks.d.ts.map +0 -1
- package/dist/lib/webhooks.js.map +0 -1
- package/dist/next/index.d.ts.map +0 -1
- package/dist/next/index.js.map +0 -1
- package/dist/next/scopes.d.ts.map +0 -1
- package/dist/next/scopes.js.map +0 -1
- package/dist/next/server-auth.d.ts.map +0 -1
- package/dist/next/server-auth.js.map +0 -1
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js.map +0 -1
- package/dist/react/useChat.d.ts.map +0 -1
- package/dist/react/useChat.js.map +0 -1
- package/dist/realtime.d.ts.map +0 -1
- package/dist/realtime.js.map +0 -1
- package/dist/resources/accounts.d.ts.map +0 -1
- package/dist/resources/accounts.js.map +0 -1
- package/dist/resources/admin.d.ts.map +0 -1
- package/dist/resources/admin.js.map +0 -1
- package/dist/resources/agents.d.ts.map +0 -1
- package/dist/resources/agents.js.map +0 -1
- package/dist/resources/app-subscriptions.d.ts.map +0 -1
- package/dist/resources/app-subscriptions.js.map +0 -1
- package/dist/resources/auth.d.ts.map +0 -1
- package/dist/resources/auth.js.map +0 -1
- package/dist/resources/billing.d.ts.map +0 -1
- package/dist/resources/billing.js.map +0 -1
- package/dist/resources/brain.d.ts.map +0 -1
- package/dist/resources/brain.js.map +0 -1
- package/dist/resources/brief.d.ts.map +0 -1
- package/dist/resources/brief.js.map +0 -1
- package/dist/resources/chat.d.ts.map +0 -1
- package/dist/resources/chat.js.map +0 -1
- package/dist/resources/commands.d.ts.map +0 -1
- package/dist/resources/commands.js.map +0 -1
- package/dist/resources/communities.d.ts.map +0 -1
- package/dist/resources/communities.js.map +0 -1
- package/dist/resources/curator.d.ts.map +0 -1
- package/dist/resources/curator.js.map +0 -1
- package/dist/resources/databases.d.ts.map +0 -1
- package/dist/resources/databases.js.map +0 -1
- package/dist/resources/deployments.d.ts.map +0 -1
- package/dist/resources/deployments.js.map +0 -1
- package/dist/resources/dispatcher.d.ts.map +0 -1
- package/dist/resources/dispatcher.js.map +0 -1
- package/dist/resources/email.d.ts.map +0 -1
- package/dist/resources/email.js.map +0 -1
- package/dist/resources/env-vars.d.ts.map +0 -1
- package/dist/resources/env-vars.js.map +0 -1
- package/dist/resources/evidence.d.ts.map +0 -1
- package/dist/resources/evidence.js.map +0 -1
- package/dist/resources/free-tier.d.ts.map +0 -1
- package/dist/resources/free-tier.js.map +0 -1
- package/dist/resources/github.d.ts.map +0 -1
- package/dist/resources/github.js.map +0 -1
- package/dist/resources/goals.d.ts.map +0 -1
- package/dist/resources/goals.js.map +0 -1
- package/dist/resources/human-asks.d.ts.map +0 -1
- package/dist/resources/human-asks.js.map +0 -1
- package/dist/resources/human-input.d.ts.map +0 -1
- package/dist/resources/human-input.js.map +0 -1
- package/dist/resources/inbox.d.ts.map +0 -1
- package/dist/resources/inbox.js.map +0 -1
- package/dist/resources/integrations.d.ts.map +0 -1
- package/dist/resources/integrations.js.map +0 -1
- package/dist/resources/invite-codes-admin.d.ts.map +0 -1
- package/dist/resources/invite-codes-admin.js.map +0 -1
- package/dist/resources/invite-codes.d.ts.map +0 -1
- package/dist/resources/invite-codes.js.map +0 -1
- package/dist/resources/jobs.d.ts.map +0 -1
- package/dist/resources/jobs.js.map +0 -1
- package/dist/resources/link-preview.d.ts.map +0 -1
- package/dist/resources/link-preview.js.map +0 -1
- package/dist/resources/media.d.ts.map +0 -1
- package/dist/resources/media.js.map +0 -1
- package/dist/resources/memory.d.ts.map +0 -1
- package/dist/resources/memory.js.map +0 -1
- package/dist/resources/moderation.d.ts.map +0 -1
- package/dist/resources/moderation.js.map +0 -1
- package/dist/resources/network.d.ts.map +0 -1
- package/dist/resources/network.js.map +0 -1
- package/dist/resources/notifications.d.ts.map +0 -1
- package/dist/resources/notifications.js.map +0 -1
- package/dist/resources/organization-security.d.ts.map +0 -1
- package/dist/resources/organization-security.js.map +0 -1
- package/dist/resources/organization-settings.d.ts.map +0 -1
- package/dist/resources/organization-settings.js.map +0 -1
- package/dist/resources/organizations.d.ts.map +0 -1
- package/dist/resources/organizations.js.map +0 -1
- package/dist/resources/posts.d.ts.map +0 -1
- package/dist/resources/posts.js.map +0 -1
- package/dist/resources/profiles.d.ts.map +0 -1
- package/dist/resources/profiles.js.map +0 -1
- package/dist/resources/project-brain.d.ts.map +0 -1
- package/dist/resources/project-brain.js.map +0 -1
- package/dist/resources/project-settings.d.ts.map +0 -1
- package/dist/resources/project-settings.js.map +0 -1
- package/dist/resources/projects.d.ts.map +0 -1
- package/dist/resources/projects.js.map +0 -1
- package/dist/resources/protocols.d.ts.map +0 -1
- package/dist/resources/protocols.js.map +0 -1
- package/dist/resources/reports.d.ts.map +0 -1
- package/dist/resources/reports.js.map +0 -1
- package/dist/resources/sandbox.d.ts.map +0 -1
- package/dist/resources/sandbox.js.map +0 -1
- package/dist/resources/settings.d.ts.map +0 -1
- package/dist/resources/settings.js.map +0 -1
- package/dist/resources/simulator.d.ts.map +0 -1
- package/dist/resources/simulator.js.map +0 -1
- package/dist/resources/storage.d.ts.map +0 -1
- package/dist/resources/storage.js.map +0 -1
- package/dist/resources/swarms.d.ts.map +0 -1
- package/dist/resources/swarms.js.map +0 -1
- package/dist/resources/tags.d.ts.map +0 -1
- package/dist/resources/tags.js.map +0 -1
- package/dist/resources/templates.d.ts.map +0 -1
- package/dist/resources/templates.js.map +0 -1
- package/dist/resources/uploads.d.ts.map +0 -1
- package/dist/resources/uploads.js.map +0 -1
- package/dist/resources/users.d.ts.map +0 -1
- package/dist/resources/users.js.map +0 -1
- package/dist/resources/video.d.ts.map +0 -1
- package/dist/resources/video.js.map +0 -1
- package/dist/resources/wallet.d.ts.map +0 -1
- package/dist/resources/wallet.js.map +0 -1
- package/dist/resources/webhooks.d.ts.map +0 -1
- package/dist/resources/webhooks.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
npm install @recursiv/sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Node.js >= 18. ESM only. Zero runtime dependencies.
|
|
11
|
+
Node.js >= 18. ESM only (`import` works on 18+; `require()` needs Node >= 22, which can require ES modules). Zero runtime dependencies; realtime and the Next.js helpers each declare one optional peer, installed only if you use them.
|
|
12
12
|
|
|
13
13
|
## 60-second quickstart
|
|
14
14
|
|
|
@@ -109,10 +109,27 @@ for await (const chunk of r.agents.chatStream(agent.id, { message: 'Hello!' }))
|
|
|
109
109
|
| `r.admin` | User management, stats, content reports (`listReports`, `resolveReport`, `dismissReport`) |
|
|
110
110
|
| `r.dispatcher` | Task queue, claims, signals, outcomes, webhooks |
|
|
111
111
|
| `r.goals` | Org goals with task rollups (group dispatcher tasks) |
|
|
112
|
-
| `r.protocols` | `list` returns bounded adapter `maturity`, `limitations`, and exhaustive `supported`/`planned`/`unsupported` implementation capabilities (not provider health or enablement); settings, candidate refresh/status, and
|
|
112
|
+
| `r.protocols` | `list` returns bounded adapter `maturity`, `limitations`, and exhaustive `supported`/`planned`/`unsupported` implementation capabilities (not provider health or enablement); settings, candidate refresh/status, search, and read-only quarantined candidate review via `listCandidates` / `getCandidate` |
|
|
113
113
|
|
|
114
114
|
Full reference: see [llm.md](./llm.md) (ships with this package) or the type definitions in `dist/`.
|
|
115
115
|
|
|
116
|
+
### Quarantined protocol candidates
|
|
117
|
+
|
|
118
|
+
`r.protocols.listCandidates({ protocol?, limit?, cursor? })` and
|
|
119
|
+
`r.protocols.getCandidate(id)` read unpublished candidates, not feed posts.
|
|
120
|
+
Both require an `admin`-scoped, project-bound key, a live admin role, and
|
|
121
|
+
existing project-admin access. App/network scope is not a caller parameter.
|
|
122
|
+
These GET methods do not collect content, update settings, or publish anything.
|
|
123
|
+
|
|
124
|
+
Lists return `{ data, meta: { limit, has_more, next_cursor } }` with no offset;
|
|
125
|
+
the API defaults to 20 rows and permits at most 50. Details return `{ data }`.
|
|
126
|
+
Render candidate `content` as plain text and respect
|
|
127
|
+
`content_truncated`. Safe source IDs are preserved byte-exact. A null
|
|
128
|
+
`external_id` means unsafe or malformed provenance was withheld; an author's
|
|
129
|
+
`native_id` may likewise be absent or withheld. Do not invent replacement IDs.
|
|
130
|
+
API failures, including routes absent from an older
|
|
131
|
+
deployment, throw the normal SDK errors; do not present them as an empty queue.
|
|
132
|
+
|
|
116
133
|
## Configuration
|
|
117
134
|
|
|
118
135
|
```typescript
|
|
@@ -281,6 +298,8 @@ with the returned API key; omit it for flows that still need the cookie session.
|
|
|
281
298
|
|
|
282
299
|
Cookie-session helpers for the App Router (Next 14 and 15). Each user signs in once, gets a **project-scoped per-user API key** in an httpOnly cookie, and every request acts as that user — no platform key on the server.
|
|
283
300
|
|
|
301
|
+
This subpath uses the optional `server-only` peer to keep its exports out of Client Components. Install it alongside the SDK in Next.js apps: `npm install server-only`.
|
|
302
|
+
|
|
284
303
|
```typescript
|
|
285
304
|
// src/lib/recursiv.ts (server-only module)
|
|
286
305
|
import 'server-only';
|
|
@@ -359,9 +378,9 @@ if (page1.meta.has_more) {
|
|
|
359
378
|
|
|
360
379
|
| Environment | Status | Notes |
|
|
361
380
|
|-------------|--------|-------|
|
|
362
|
-
| Node.js >= 18 | Full support | ESM only. Uses native fetch. |
|
|
381
|
+
| Node.js >= 18 | Full support | ESM only (`require()` needs Node >= 22). Uses native fetch. |
|
|
363
382
|
| Next.js | Full support | Server components, server actions, and route handlers. Use `@recursiv/sdk/next` for cookie-session auth (Next 14 and 15). |
|
|
364
|
-
| React (Vite, CRA) | Full support | Bundle-friendly, zero dependencies |
|
|
383
|
+
| React (Vite, CRA) | Full support | Bundle-friendly, zero dependencies. Realtime needs the optional `socket.io-client` peer. |
|
|
365
384
|
| React Native / Expo | Supported with caveats | `chatStream()` requires manual SSE handling. See [React Native guide](./docs/guide-react-native.md). |
|
|
366
385
|
| Deno | Full support | ESM native, fetch native |
|
|
367
386
|
| Bun | Full support | ESM native, fetch native |
|
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
package/dist/errors.d.ts
CHANGED
package/dist/errors.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -186,7 +186,7 @@ export type { UploadMediaInput, UploadUrlInput, UploadUrlResult } from './resour
|
|
|
186
186
|
export { WalletResource } from './resources/wallet.js';
|
|
187
187
|
export { ProtocolsResource } from './resources/protocols.js';
|
|
188
188
|
export { PROTOCOL_ADAPTER_MATURITIES, PROTOCOL_CAPABILITY_OPERATIONS, PROTOCOL_CAPABILITY_STATUSES, } from './resources/protocols.js';
|
|
189
|
-
export type { ProtocolAdapterMaturity, ProtocolAdapterMetadata, ProtocolCapabilityOperation, ProtocolCapabilityStatus, ProtocolCollectionStatus, ProtocolRefreshResult, ProtocolSettings, ProtocolSettingsUpdateResult, UpdateSettingsInput as UpdateProtocolSettingsInput, } from './resources/protocols.js';
|
|
189
|
+
export type { ListProtocolCandidatesParams, ProtocolAdapterMaturity, ProtocolAdapterMetadata, ProtocolCandidateListResponse, ProtocolCandidatePageMeta, ProtocolCapabilityOperation, ProtocolCapabilityStatus, ProtocolCollectionStatus, ProtocolQuarantinedCandidate, ProtocolRefreshResult, ProtocolSettings, ProtocolSettingsUpdateResult, UpdateSettingsInput as UpdateProtocolSettingsInput, } from './resources/protocols.js';
|
|
190
190
|
export { InboxResource } from './resources/inbox.js';
|
|
191
191
|
export { NetworkResource } from './resources/network.js';
|
|
192
192
|
export { SimulatorResource } from './resources/simulator.js';
|
|
@@ -213,4 +213,3 @@ export { RecursivError, AuthenticationError, AuthorizationError, NotFoundError,
|
|
|
213
213
|
export { parseSSE } from './lib/sse.js';
|
|
214
214
|
export * from './lib/webhooks.js';
|
|
215
215
|
export type * from './types.js';
|
|
216
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -252,4 +252,3 @@ export { MediaResource } from './resources/media.js';
|
|
|
252
252
|
export { RecursivError, AuthenticationError, AuthorizationError, NotFoundError, ValidationError, InsufficientCreditsError, RateLimitError, ConflictError, } from './errors.js';
|
|
253
253
|
export { parseSSE } from './lib/sse.js';
|
|
254
254
|
export * from './lib/webhooks.js';
|
|
255
|
-
//# sourceMappingURL=index.js.map
|
package/dist/lib/sse.d.ts
CHANGED
package/dist/lib/sse.js
CHANGED
package/dist/lib/webhooks.d.ts
CHANGED
package/dist/lib/webhooks.js
CHANGED
package/dist/next/index.d.ts
CHANGED
|
@@ -8,4 +8,3 @@ import 'server-only';
|
|
|
8
8
|
export { createRecursivAuth, RecursivNextAuth } from './server-auth.js';
|
|
9
9
|
export { DEFAULT_USER_KEY_SCOPES } from './scopes.js';
|
|
10
10
|
export type { RecursivNextAuthConfig, SessionUser, AuthResult, WriteOptions, SessionCookieOptions, SessionCookieDescriptor, CookieWriter, RequestCookiesLike, } from './server-auth.js';
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/next/index.js
CHANGED
package/dist/next/scopes.d.ts
CHANGED
package/dist/next/scopes.js
CHANGED
package/dist/next/server-auth.js
CHANGED
package/dist/react/index.d.ts
CHANGED
package/dist/react/index.js
CHANGED
package/dist/react/useChat.d.ts
CHANGED
|
@@ -23,4 +23,3 @@ export declare function useChat(recursiv: Recursiv, options?: UseChatOptions): {
|
|
|
23
23
|
fetchHistory: (limit?: number, cursor?: string) => Promise<import("../types.js").PaginatedResponse<import("../types.js").Message>>;
|
|
24
24
|
sendMessage: (content: string, replyToId?: string) => Promise<import("../types.js").SingleResponse<import("../types.js").SentMessage>>;
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=useChat.d.ts.map
|
package/dist/react/useChat.js
CHANGED
package/dist/realtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Socket } from 'socket.io-client';
|
|
1
|
+
import type { Socket } from 'socket.io-client';
|
|
2
2
|
import { HttpClient } from './client.js';
|
|
3
3
|
export interface ChatMessageEvent {
|
|
4
4
|
id: string;
|
|
@@ -88,4 +88,3 @@ export declare class RealtimeClient {
|
|
|
88
88
|
onTyping(callback: (event: TypingEvent) => void): (() => void) | undefined;
|
|
89
89
|
onAgentThinking(callback: (event: AgentThinkingEvent) => void): (() => void) | undefined;
|
|
90
90
|
}
|
|
91
|
-
//# sourceMappingURL=realtime.d.ts.map
|
package/dist/realtime.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
// socket.io-client is an optional peer: only realtime needs it, so importing
|
|
2
|
+
// the SDK must not require it. The type-only import above erases at build;
|
|
3
|
+
// the factory loads here, on first connect, with an actionable error when
|
|
4
|
+
// the peer is absent.
|
|
5
|
+
let cachedIo;
|
|
6
|
+
async function loadIo() {
|
|
7
|
+
if (cachedIo)
|
|
8
|
+
return cachedIo;
|
|
9
|
+
try {
|
|
10
|
+
const mod = await import('socket.io-client');
|
|
11
|
+
cachedIo = mod.io;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
throw new Error("Realtime requires the optional peer dependency 'socket.io-client'. " +
|
|
15
|
+
'Install it alongside the SDK: npm install socket.io-client');
|
|
16
|
+
}
|
|
17
|
+
return cachedIo;
|
|
18
|
+
}
|
|
2
19
|
export class RealtimeClient {
|
|
3
20
|
socket = null;
|
|
4
21
|
client;
|
|
@@ -8,17 +25,12 @@ export class RealtimeClient {
|
|
|
8
25
|
this.client = client;
|
|
9
26
|
}
|
|
10
27
|
async fetchTokenWithClientKey() {
|
|
28
|
+
// Only the REST route can mint a token. The old fallback asked for a tRPC
|
|
29
|
+
// procedure under the REST base URL, which no API host serves, so every
|
|
30
|
+
// failed token fetch also logged a 404 in the browser console.
|
|
11
31
|
try {
|
|
12
32
|
const response = await this.client.get('/realtime/ws-token');
|
|
13
|
-
|
|
14
|
-
return response.data.token;
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
// Fall through to the tRPC endpoint for session-based auth.
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const response = await this.client.get('/trpc/sessionManagement.getWebSocketToken');
|
|
21
|
-
return response.result?.data?.token;
|
|
33
|
+
return response.data?.token || undefined;
|
|
22
34
|
}
|
|
23
35
|
catch {
|
|
24
36
|
return undefined;
|
|
@@ -54,6 +66,7 @@ export class RealtimeClient {
|
|
|
54
66
|
return this.connectionPromise;
|
|
55
67
|
}
|
|
56
68
|
this.connectionPromise = (async () => {
|
|
69
|
+
const io = await loadIo();
|
|
57
70
|
const provider = this.tokenProvider ?? (() => this.fetchTokenWithClientKey());
|
|
58
71
|
const token = await provider();
|
|
59
72
|
if (!token) {
|
|
@@ -150,4 +163,3 @@ export class RealtimeClient {
|
|
|
150
163
|
return () => this.socket?.off('agent_thinking', callback);
|
|
151
164
|
}
|
|
152
165
|
}
|
|
153
|
-
//# sourceMappingURL=realtime.js.map
|
package/dist/resources/admin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HttpClient } from '../client.js';
|
|
2
|
-
import type { PaginatedResponse, SingleResponse, DeleteResponse, Agent, AgentDetail, CreateAgentInput, CreatedAgent, UpdateAgentInput, UpdatedAgent, AgentChatInput, AgentChatResult, AgentConversation, PaginationParams, StreamChunk } from '../types.js';
|
|
2
|
+
import type { PaginatedResponse, SingleResponse, DeleteResponse, Agent, AgentDetail, CreateAgentInput, CreatedAgent, UpdateAgentInput, UpdatedAgent, AgentChatInput, AgentChatResult, AgentConversation, AgentConversationMessage, PaginationParams, StreamChunk } from '../types.js';
|
|
3
3
|
export interface AgentMessage {
|
|
4
4
|
id: string;
|
|
5
5
|
networkId: string;
|
|
@@ -127,6 +127,16 @@ export declare class AgentsResource {
|
|
|
127
127
|
chat(id: string, input: AgentChatInput): Promise<SingleResponse<AgentChatResult>>;
|
|
128
128
|
/** List an agent's conversations */
|
|
129
129
|
conversations(id: string, params?: PaginationParams): Promise<PaginatedResponse<AgentConversation>>;
|
|
130
|
+
/**
|
|
131
|
+
* Read the messages in one of an agent's conversations, oldest first.
|
|
132
|
+
*
|
|
133
|
+
* `chat` returns as soon as the message is accepted and the agent works
|
|
134
|
+
* asynchronously, so this is how a caller finds out what happened — including
|
|
135
|
+
* the exact error text when a step failed. Without it the only observable
|
|
136
|
+
* signals are task status and claims, which say that an agent ran and that
|
|
137
|
+
* nothing landed, but never why.
|
|
138
|
+
*/
|
|
139
|
+
conversationMessages(id: string, conversationId: string, params?: PaginationParams): Promise<PaginatedResponse<AgentConversationMessage>>;
|
|
130
140
|
/** List discoverable agents (public + same-org) */
|
|
131
141
|
listDiscoverable(params?: PaginationParams & {
|
|
132
142
|
organization_id?: string;
|
|
@@ -278,4 +288,3 @@ export declare class AgentsResource {
|
|
|
278
288
|
chunks: StreamChunk[];
|
|
279
289
|
}>;
|
|
280
290
|
}
|
|
281
|
-
//# sourceMappingURL=agents.d.ts.map
|
package/dist/resources/agents.js
CHANGED
|
@@ -80,6 +80,18 @@ export class AgentsResource {
|
|
|
80
80
|
conversations(id, params) {
|
|
81
81
|
return this.client.get(`/agents/${id}/conversations`, params);
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Read the messages in one of an agent's conversations, oldest first.
|
|
85
|
+
*
|
|
86
|
+
* `chat` returns as soon as the message is accepted and the agent works
|
|
87
|
+
* asynchronously, so this is how a caller finds out what happened — including
|
|
88
|
+
* the exact error text when a step failed. Without it the only observable
|
|
89
|
+
* signals are task status and claims, which say that an agent ran and that
|
|
90
|
+
* nothing landed, but never why.
|
|
91
|
+
*/
|
|
92
|
+
conversationMessages(id, conversationId, params) {
|
|
93
|
+
return this.client.get(`/agents/${id}/conversations/${conversationId}/messages`, params);
|
|
94
|
+
}
|
|
83
95
|
/** List discoverable agents (public + same-org) */
|
|
84
96
|
listDiscoverable(params) {
|
|
85
97
|
return this.client.get('/agents/discoverable', params);
|
|
@@ -275,4 +287,3 @@ export class AgentsResource {
|
|
|
275
287
|
return { content: fullText, conversationId, chunks };
|
|
276
288
|
}
|
|
277
289
|
}
|
|
278
|
-
//# sourceMappingURL=agents.js.map
|
package/dist/resources/auth.d.ts
CHANGED
|
@@ -242,6 +242,22 @@ export declare class AuthResource {
|
|
|
242
242
|
user: AuthSession['user'];
|
|
243
243
|
session: AuthSession;
|
|
244
244
|
}>;
|
|
245
|
+
/**
|
|
246
|
+
* Exchange a legacy Minds session (the OAuth access token or minds_sess JWT
|
|
247
|
+
* the legacy mobile app stored) for a session on this stack. Only answers
|
|
248
|
+
* during the cutover window; every failure means "show the OTP screen".
|
|
249
|
+
*/
|
|
250
|
+
legacyHandoff(legacyToken: string, appContext?: {
|
|
251
|
+
projectId?: string;
|
|
252
|
+
organizationId?: string;
|
|
253
|
+
}): Promise<AuthSession>;
|
|
254
|
+
/** legacyHandoff, then the app API key, exactly like verifyOtpAndCreateKey. */
|
|
255
|
+
legacyHandoffAndCreateKey(legacyToken: string, keyInput: CreateApiKeyInput): Promise<{
|
|
256
|
+
apiKey: string;
|
|
257
|
+
apiKeyId: string;
|
|
258
|
+
user: AuthSession['user'];
|
|
259
|
+
session: AuthSession;
|
|
260
|
+
}>;
|
|
245
261
|
/**
|
|
246
262
|
* Complete mobile OTP auth flow: verify OTP → create API key → return key.
|
|
247
263
|
* Combines verifyOtp + createApiKey for passwordless mobile auth.
|
|
@@ -259,10 +275,18 @@ export declare class AuthResource {
|
|
|
259
275
|
user: AuthSession['user'];
|
|
260
276
|
session: AuthSession;
|
|
261
277
|
}>;
|
|
278
|
+
/**
|
|
279
|
+
* The key-mint leg of the `*AndCreateKey` flows. When the mint fails, the
|
|
280
|
+
* caller receives only the thrown error — the session created one step
|
|
281
|
+
* earlier is not in it, so no caller can revoke that session no matter how
|
|
282
|
+
* carefully they handle the failure. Retire it here (best-effort) instead
|
|
283
|
+
* of stranding a live server-side credential; the mint's own error is what
|
|
284
|
+
* surfaces either way.
|
|
285
|
+
*/
|
|
286
|
+
private createApiKeyOrRetireSession;
|
|
262
287
|
/**
|
|
263
288
|
* Extract session token from response.
|
|
264
289
|
* Better Auth returns it in Set-Cookie header and/or response body.
|
|
265
290
|
*/
|
|
266
291
|
private extractToken;
|
|
267
292
|
}
|
|
268
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/dist/resources/auth.js
CHANGED
|
@@ -574,7 +574,7 @@ export class AuthResource {
|
|
|
574
574
|
projectId: keyInput.projectId,
|
|
575
575
|
organizationId: keyInput.organizationId,
|
|
576
576
|
});
|
|
577
|
-
const key = await this.
|
|
577
|
+
const key = await this.createApiKeyOrRetireSession(keyInput, session);
|
|
578
578
|
return { apiKey: key.key, apiKeyId: key.id, user: session.user, session };
|
|
579
579
|
}
|
|
580
580
|
/**
|
|
@@ -590,7 +590,55 @@ export class AuthResource {
|
|
|
590
590
|
projectId: keyInput.projectId,
|
|
591
591
|
organizationId: keyInput.organizationId,
|
|
592
592
|
});
|
|
593
|
-
const key = await this.
|
|
593
|
+
const key = await this.createApiKeyOrRetireSession(keyInput, session);
|
|
594
|
+
return { apiKey: key.key, apiKeyId: key.id, user: session.user, session };
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Exchange a legacy Minds session (the OAuth access token or minds_sess JWT
|
|
598
|
+
* the legacy mobile app stored) for a session on this stack. Only answers
|
|
599
|
+
* during the cutover window; every failure means "show the OTP screen".
|
|
600
|
+
*/
|
|
601
|
+
async legacyHandoff(legacyToken, appContext) {
|
|
602
|
+
const res = await this.fetchWithTimeout(`${this.baseOrigin}/api/auth/legacy-handoff`, {
|
|
603
|
+
method: 'POST',
|
|
604
|
+
headers: {
|
|
605
|
+
'Content-Type': 'application/json',
|
|
606
|
+
...originHeader(this.baseOrigin),
|
|
607
|
+
...(appContext?.projectId ? { 'x-recursiv-app-project': appContext.projectId } : {}),
|
|
608
|
+
...(appContext?.organizationId
|
|
609
|
+
? { 'x-recursiv-app-organization': appContext.organizationId }
|
|
610
|
+
: {}),
|
|
611
|
+
},
|
|
612
|
+
body: JSON.stringify({ legacy_token: legacyToken }),
|
|
613
|
+
});
|
|
614
|
+
let data = null;
|
|
615
|
+
try {
|
|
616
|
+
data = await res.json();
|
|
617
|
+
}
|
|
618
|
+
catch {
|
|
619
|
+
data = null;
|
|
620
|
+
}
|
|
621
|
+
if (!res.ok) {
|
|
622
|
+
const { code, message } = serverErrorInfo(data);
|
|
623
|
+
throw new AuthenticationError({
|
|
624
|
+
type: 'auth_error',
|
|
625
|
+
message: message || `Legacy handoff failed: HTTP ${res.status}`,
|
|
626
|
+
code: code || 'legacy_handoff_failed',
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
const token = this.extractToken(res, data);
|
|
630
|
+
if (!token) {
|
|
631
|
+
throw new AuthenticationError({ type: 'auth_error', message: 'Legacy handoff returned no session', code: 'legacy_handoff_failed' });
|
|
632
|
+
}
|
|
633
|
+
return { token, user: data.user };
|
|
634
|
+
}
|
|
635
|
+
/** legacyHandoff, then the app API key, exactly like verifyOtpAndCreateKey. */
|
|
636
|
+
async legacyHandoffAndCreateKey(legacyToken, keyInput) {
|
|
637
|
+
const session = await this.legacyHandoff(legacyToken, {
|
|
638
|
+
projectId: keyInput.projectId,
|
|
639
|
+
organizationId: keyInput.organizationId,
|
|
640
|
+
});
|
|
641
|
+
const key = await this.createApiKeyOrRetireSession(keyInput, session);
|
|
594
642
|
return { apiKey: key.key, apiKeyId: key.id, user: session.user, session };
|
|
595
643
|
}
|
|
596
644
|
/**
|
|
@@ -609,9 +657,33 @@ export class AuthResource {
|
|
|
609
657
|
projectId: keyInput.projectId,
|
|
610
658
|
organizationId: keyInput.organizationId,
|
|
611
659
|
});
|
|
612
|
-
const key = await this.
|
|
660
|
+
const key = await this.createApiKeyOrRetireSession(keyInput, session);
|
|
613
661
|
return { apiKey: key.key, apiKeyId: key.id, user: session.user, session };
|
|
614
662
|
}
|
|
663
|
+
/**
|
|
664
|
+
* The key-mint leg of the `*AndCreateKey` flows. When the mint fails, the
|
|
665
|
+
* caller receives only the thrown error — the session created one step
|
|
666
|
+
* earlier is not in it, so no caller can revoke that session no matter how
|
|
667
|
+
* carefully they handle the failure. Retire it here (best-effort) instead
|
|
668
|
+
* of stranding a live server-side credential; the mint's own error is what
|
|
669
|
+
* surfaces either way.
|
|
670
|
+
*/
|
|
671
|
+
async createApiKeyOrRetireSession(keyInput, session) {
|
|
672
|
+
try {
|
|
673
|
+
return await this.createApiKey(keyInput, session.token);
|
|
674
|
+
}
|
|
675
|
+
catch (err) {
|
|
676
|
+
if (session.token) {
|
|
677
|
+
try {
|
|
678
|
+
await this.signOut(session.token);
|
|
679
|
+
}
|
|
680
|
+
catch {
|
|
681
|
+
// Nothing more can be done from here; the session expires on its own.
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
throw err;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
615
687
|
/**
|
|
616
688
|
* Extract session token from response.
|
|
617
689
|
* Better Auth returns it in Set-Cookie header and/or response body.
|
|
@@ -636,4 +708,3 @@ export class AuthResource {
|
|
|
636
708
|
return null;
|
|
637
709
|
}
|
|
638
710
|
}
|
|
639
|
-
//# sourceMappingURL=auth.js.map
|
package/dist/resources/brain.js
CHANGED
package/dist/resources/brief.js
CHANGED
package/dist/resources/chat.d.ts
CHANGED
package/dist/resources/chat.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { HttpClient } from '../client.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Community, CommunityBannedMember, CommunityDetail, CommunityMember, CreateCommunityInput, CreatedCommunity, JoinResult, LeaveResult, ListCommunitiesParams, PaginatedResponse, PaginationParams, SingleResponse } from '../types.js';
|
|
3
3
|
export declare class CommunitiesResource {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: HttpClient);
|
|
6
|
-
/** List public communities */
|
|
7
|
-
list(params?:
|
|
6
|
+
/** List public communities, or only the authenticated caller's memberships. */
|
|
7
|
+
list(params?: ListCommunitiesParams): Promise<PaginatedResponse<Community>>;
|
|
8
8
|
/** Get a community by ID */
|
|
9
9
|
get(id: string): Promise<SingleResponse<CommunityDetail>>;
|
|
10
10
|
/** List members of a community */
|
|
@@ -15,5 +15,67 @@ export declare class CommunitiesResource {
|
|
|
15
15
|
join(id: string): Promise<SingleResponse<JoinResult>>;
|
|
16
16
|
/** Leave a community */
|
|
17
17
|
leave(id: string): Promise<SingleResponse<LeaveResult>>;
|
|
18
|
+
/** Update name, description, image, banner or privacy. Owner or admin. */
|
|
19
|
+
update(id: string, input: Partial<Pick<CreateCommunityInput, 'name' | 'description' | 'privacy'>> & {
|
|
20
|
+
image?: string | null;
|
|
21
|
+
banner?: string | null;
|
|
22
|
+
}): Promise<SingleResponse<CommunityDetail>>;
|
|
23
|
+
/** Delete a community. Owner only. */
|
|
24
|
+
delete(id: string): Promise<SingleResponse<{
|
|
25
|
+
deleted: boolean;
|
|
26
|
+
}>>;
|
|
27
|
+
/** People waiting to join a private group. Moderator or higher. */
|
|
28
|
+
requests(id: string, params?: PaginationParams): Promise<PaginatedResponse<CommunityMember>>;
|
|
29
|
+
/** Active bans an admin can review and lift. Admin or higher. */
|
|
30
|
+
bans(id: string, params?: PaginationParams): Promise<PaginatedResponse<CommunityBannedMember>>;
|
|
31
|
+
/** Let a pending member in. Admin or higher. */
|
|
32
|
+
approveMember(id: string, userId: string): Promise<SingleResponse<{
|
|
33
|
+
status: string;
|
|
34
|
+
}>>;
|
|
35
|
+
/** Turn a pending member away. Admin or higher. */
|
|
36
|
+
declineMember(id: string, userId: string): Promise<SingleResponse<{
|
|
37
|
+
declined: boolean;
|
|
38
|
+
}>>;
|
|
39
|
+
/** Remove a member. Moderator or higher, and only members below your role. */
|
|
40
|
+
removeMember(id: string, userId: string): Promise<SingleResponse<{
|
|
41
|
+
removed: boolean;
|
|
42
|
+
}>>;
|
|
43
|
+
/** Ban a member, with an optional reason. Moderator or higher. */
|
|
44
|
+
banMember(id: string, userId: string, reason?: string): Promise<SingleResponse<{
|
|
45
|
+
banned: boolean;
|
|
46
|
+
}>>;
|
|
47
|
+
/** Lift a ban. Admin or higher. */
|
|
48
|
+
unbanMember(id: string, userId: string): Promise<SingleResponse<{
|
|
49
|
+
banned: boolean;
|
|
50
|
+
}>>;
|
|
51
|
+
/** Change a member's role. Admin or higher; only the owner makes admins. */
|
|
52
|
+
setMemberRole(id: string, userId: string, role: 'admin' | 'moderator' | 'member'): Promise<SingleResponse<{
|
|
53
|
+
role: string;
|
|
54
|
+
}>>;
|
|
55
|
+
/** Pin a post to the top of the group. Moderator or higher. */
|
|
56
|
+
pinPost(id: string, postId: string): Promise<SingleResponse<{
|
|
57
|
+
pinned: boolean;
|
|
58
|
+
}>>;
|
|
59
|
+
/** Unpin a post. Moderator or higher. */
|
|
60
|
+
unpinPost(id: string, postId: string): Promise<SingleResponse<{
|
|
61
|
+
pinned: boolean;
|
|
62
|
+
}>>;
|
|
63
|
+
/** Remove a post from the group. Moderator or higher. */
|
|
64
|
+
removePost(id: string, postId: string): Promise<SingleResponse<{
|
|
65
|
+
removed: boolean;
|
|
66
|
+
}>>;
|
|
67
|
+
/**
|
|
68
|
+
* Mint an invite code that joins the redeemer to this group. Any member of
|
|
69
|
+
* a public group; moderator or higher for a private one. Admins can mint a
|
|
70
|
+
* code that joins people as moderators.
|
|
71
|
+
*/
|
|
72
|
+
createInvite(id: string, input?: {
|
|
73
|
+
role?: 'member' | 'moderator';
|
|
74
|
+
expires_days?: number;
|
|
75
|
+
}): Promise<SingleResponse<{
|
|
76
|
+
code: string;
|
|
77
|
+
community_id: string;
|
|
78
|
+
role: string;
|
|
79
|
+
expires_at: string | null;
|
|
80
|
+
}>>;
|
|
18
81
|
}
|
|
19
|
-
//# sourceMappingURL=communities.d.ts.map
|