@recursiv/sdk 0.7.51 → 0.7.53

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.
Files changed (37) hide show
  1. package/README.md +43 -5
  2. package/dist/client.d.ts +6 -2
  3. package/dist/client.js +10 -9
  4. package/dist/index.d.ts +15 -4
  5. package/dist/index.js +11 -1
  6. package/dist/resources/admin.d.ts +13 -0
  7. package/dist/resources/agents.d.ts +13 -2
  8. package/dist/resources/agents.js +7 -1
  9. package/dist/resources/app-subscriptions.d.ts +48 -2
  10. package/dist/resources/app-subscriptions.js +18 -2
  11. package/dist/resources/bookmarks.d.ts +172 -0
  12. package/dist/resources/bookmarks.js +44 -0
  13. package/dist/resources/boosts.d.ts +23 -1
  14. package/dist/resources/boosts.js +6 -1
  15. package/dist/resources/communities.d.ts +12 -2
  16. package/dist/resources/communities.js +15 -1
  17. package/dist/resources/curator.d.ts +24 -6
  18. package/dist/resources/curator.js +2 -1
  19. package/dist/resources/discovery.d.ts +104 -2
  20. package/dist/resources/discovery.js +111 -20
  21. package/dist/resources/invite-codes-admin.d.ts +13 -0
  22. package/dist/resources/invite-codes.d.ts +10 -0
  23. package/dist/resources/invite-codes.js +6 -6
  24. package/dist/resources/link-preview.d.ts +11 -4
  25. package/dist/resources/link-preview.js +4 -3
  26. package/dist/resources/notifications.d.ts +26 -0
  27. package/dist/resources/posts.d.ts +45 -6
  28. package/dist/resources/posts.js +29 -4
  29. package/dist/resources/profiles.d.ts +23 -14
  30. package/dist/resources/profiles.js +18 -5
  31. package/dist/resources/protocols.d.ts +54 -7
  32. package/dist/resources/protocols.js +10 -4
  33. package/dist/resources/search.d.ts +159 -0
  34. package/dist/resources/search.js +21 -0
  35. package/dist/types.d.ts +146 -5
  36. package/llm.md +41 -8
  37. package/package.json +2 -2
package/README.md CHANGED
@@ -93,7 +93,8 @@ for await (const chunk of r.agents.chatStream(agent.id, { message: 'Hello!' }))
93
93
  ### Social
94
94
  | Resource | Key methods |
95
95
  |----------|------------|
96
- | `r.posts` | `create`, `update`, `list`, `liked`, `search`, `replies`, `react` |
96
+ | `r.posts` | `create`, `update`, `list`, `liked`, `bookmarked`, `bookmark`, `unbookmark`, `search`, `replies`, `react` |
97
+ | `r.bookmarks` | `save`, `unsave`, `posts`, `list`, `keys`, `merge` — the member's saved posts, open-network posts and articles, synced across devices |
97
98
  | `r.communities` | `create`, `join`, `search`, `members` |
98
99
  | `r.chat` | `send`, `dm`, `createGroup`, `messages` (cursor paging), `acceptRequest`, `declineRequest`, `leave`, `deleteConversation` |
99
100
  | `r.tags` | `create`, `list` |
@@ -114,7 +115,7 @@ for await (const chunk of r.agents.chatStream(agent.id, { message: 'Hello!' }))
114
115
  | `r.admin` | User management, stats, content reports (`listReports`, `resolveReport`, `dismissReport`) |
115
116
  | `r.dispatcher` | Task queue, claims, signals, outcomes, webhooks |
116
117
  | `r.goals` | Org goals with task rollups (group dispatcher tasks) |
117
- | `r.protocols` | Private Minds safety: `sourceControls` (current enablement and saved choices; filter with `control`, each item may carry a `display` label), `setSourceControl`, `onSourceControlChange`, `reportSource`. Delegated accounts: `nativeSocialAccounts`, `startNativeSocialConnection`, `finishNativeSocialConnection`, `disconnectNativeSocialAccount`. Native follows: `nativeFollowStates` (every connected account's state for one source, one read), `nativeFollowState`, `prepareNativeFollow`, `submitNativeFollow`, `nativeFollowStatus` (native following or pending approval, distinct from a Minds feed subscription; preserve the complete signed Nostr list). Native reposts and undo: `nativeRepostState`, `prepareNativeRepost`, `submitNativeRepost`, `nativeRepostStatus` (public posts, explicit approval, connected account, no uncertain retries). Native likes and unlikes: `nativeLikeState`, `prepareNativeLike`, `submitNativeLike`, `nativeLikeStatus` (connected authority, app enablement and explicit approval; resume pending actions instead of duplicating them). Reviewed replies and optional linked posts: `prepareNativeReply`, `submitNativeReply`, `nativeReplyStatus`, `nativeReplyHistory`, `prepareNativeReplyRemoval`, `removeNativeReply` (require deployed API support and app enablement). Keyless shared post links: `sharedNetworks(projectId)`, `getSharedConversation(projectId, { protocol, post, readRef? })`. Member public reading: `searchPublicPosts` (selected account required for Bluesky/ActivityPub; public Nostr search), `getConnectedSocialConversation` (preserve result readerAccountId/readRef), `publicNetworks`, `searchPublicProfiles`, `getPublicProfile`, `getPublicAuthorFeed`, `getFollowingFeed`, `getPublicConversation`, `getPublicTrends`, `getPublicTrendFeed`; radar stories: `getPublicRadarStory` (one story by id with its posts), keyless `getSharedRadarStory(projectId, { cluster })` and `getSharedRadarPosts(projectId, { cluster })`; private app subscriptions: `listSubscriptions`, `subscribeToProfile`, `unsubscribeFromProfile`, `onSubscriptionChange`. `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` |
118
+ | `r.protocols` | Private Minds safety: `sourceControls` (current enablement and saved choices; filter with `control`, each item may carry a `display` label), `setSourceControl`, `onSourceControlChange`, `reportSource`. Delegated accounts: `nativeSocialAccounts`, `startNativeSocialConnection`, `finishNativeSocialConnection`, `disconnectNativeSocialAccount`. Native follows: `nativeFollowStates` (every connected account's state for one source, one read), `nativeFollowState`, `prepareNativeFollow`, `submitNativeFollow`, `nativeFollowStatus` (native following or pending approval, distinct from a Minds feed subscription; preserve the complete signed Nostr list). Native reposts and undo: `nativeRepostState`, `prepareNativeRepost`, `submitNativeRepost`, `nativeRepostStatus` (public posts, explicit approval, connected account, no uncertain retries). Native likes and unlikes: `nativeLikeState`, `prepareNativeLike`, `submitNativeLike`, `nativeLikeStatus` (connected authority, app enablement and explicit approval; resume pending actions instead of duplicating them). Reviewed replies and optional linked posts: `prepareNativeReply`, `submitNativeReply`, `nativeReplyStatus`, `nativeReplyHistory`, `prepareNativeReplyRemoval`, `removeNativeReply` (require deployed API support and app enablement). Keyless shared post links: `sharedNetworks(projectId)`, `getSharedConversation(projectId, { protocol, post, readRef? })`. Member public reading: `searchPublicPosts` (selected account required for Bluesky/ActivityPub; public Nostr search), `getConnectedSocialConversation` (preserve result readerAccountId/readRef), `publicNetworks`, `searchPublicProfiles`, `getPublicProfile`, `getPublicAuthorFeed`, `getFollowingFeed`, `getPublicConversation`, `getPublicTrends`, `getPublicTrendFeed`; radar stories: `getPublicRadarStory` (one story by id with its posts; one that has left the radar comes with its archived copy and the live story it continues as), keyless `getSharedRadarStory(projectId, { cluster })` and `getSharedRadarPosts(projectId, { cluster })`; private app subscriptions: `listSubscriptions`, `subscribeToProfile`, `unsubscribeFromProfile`, `onSubscriptionChange`. `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` |
118
119
 
119
120
  Full reference: see [llm.md](./llm.md) (ships with this package) or the type definitions in `dist/`.
120
121
 
@@ -140,6 +141,7 @@ deployment, throw the normal SDK errors; do not present them as an empty queue.
140
141
  ```typescript
141
142
  const r = new Recursiv({
142
143
  apiKey: 'sk_live_...', // or set RECURSIV_API_KEY env var
144
+ inheritEnvironmentApiKey: true, // default; false guarantees keyless operation
143
145
  baseUrl: 'https://api.recursiv.io/api/v1', // default
144
146
  timeout: 30000, // request timeout in ms
145
147
  maxRetries: 2, // auto-retry on 429/5xx
@@ -148,9 +150,12 @@ const r = new Recursiv({
148
150
  // Zero-arg works when RECURSIV_API_KEY is set
149
151
  const r = new Recursiv()
150
152
 
151
- // Anonymous sandbox (no API key needed)
153
+ // Anonymous sandbox (no API key required; inherits RECURSIV_API_KEY when set)
152
154
  const r = new Recursiv({ anonymous: true })
153
155
 
156
+ // Guaranteed keyless public client, even inside a credentialed server process
157
+ const visitor = new Recursiv({ anonymous: true, inheritEnvironmentApiKey: false })
158
+
154
159
  // Self-hosted
155
160
  const r = new Recursiv({ baseUrl: 'https://my-instance.com/api/v1' })
156
161
  ```
@@ -613,7 +618,10 @@ state and obtain a fresh review before a new write.
613
618
  Visitors can read a public conversation in an explicitly configured app without signing in:
614
619
 
615
620
  ```ts
616
- const visitor = new Recursiv({ anonymous: true });
621
+ const visitor = new Recursiv({
622
+ anonymous: true,
623
+ inheritEnvironmentApiKey: false,
624
+ });
617
625
  const { data: networks } = await visitor.protocols.sharedNetworks(projectId);
618
626
  const { data: conversation } = await visitor.protocols.getSharedConversation(projectId, {
619
627
  protocol: 'nostr', post: publicEventId,
@@ -641,7 +649,37 @@ per signed-in viewer and filter. Pass the app-advertised network catalog, then c
641
649
  `next()` as the reader approaches the end. Each page contains safe json-render
642
650
  module specs and native or protocol post objects. Preserve their existing source
643
651
  authority and interactive controls. `retryFailed()` explicitly retries unavailable
644
- sources; create a new session to refresh exhausted source windows.
652
+ sources; create a new session to refresh exhausted source windows. A topics network
653
+ (Bluesky) is read one topic page at a time; in a category the catalog's previews are not
654
+ judged to be in it, so a read walks into the topics at once, and walks past a topic the
655
+ provider no longer lists (`trend_unavailable`) or one with nothing in the category, up
656
+ to five topic pages a read, so a page reaches a topic that carries posts. Any other
657
+ failure marks the source failed until `retryFailed()`.
658
+
659
+ `sdk.discovery.createPersonalFeed({ networks, category?, learning?, recommend? })`
660
+ builds the same kind of session for a member's For you tab: its Minds slot reads
661
+ `sdk.curator.forYou({ surface: 'discover', discovery: true, cursor })`, which ranks
662
+ fresher and past the member's follows, pages a stored ranking by `meta.next_cursor`,
663
+ and says whether the member is personalized yet (`meta.personalized`). With a
664
+ `category` (the member's first), the session also reads open-network posts from it;
665
+ without, it is Minds only. It never carries the radar.
666
+
667
+ `sdk.discovery.recommendations({ kind, category?, limit?, session?, exclude? })` is
668
+ the app's one recommender for suggestion rails: `kind` is `member`, `group`, `tag`,
669
+ `network_account` or `story`, and `category` is `all` or a browse category id. It
670
+ suggests only active or warm entities that pass the server's gates (no link feeds,
671
+ bursts, mirrored `name@host` feeds, single-poster groups or unsafe names), leaves out
672
+ what the viewer follows, joined, blocked or muted, and says why a list is empty in
673
+ `meta.reason`. Call `sdk.discovery.recordImpressions({ kind, keys, event })` with
674
+ `shown` when suggestions are on screen and `engaged` on a tap, follow or join: three
675
+ showings without a tap rest a suggestion for fourteen days, and engaging clears it.
676
+ Keep one `session` token per app session so a rail does not reshuffle on every render.
677
+
678
+ `sdk.posts.categories()` answers the app's categories in the order this member
679
+ should see them. `meta.order` is `personal`, `popular` or `static`; `meta.reason`
680
+ says why an answer is not personal (`low_signal`, `deadline`, `requested`,
681
+ `experiment_off`), and `meta.order_id` changes only when the order does. The order
682
+ is private to the member; show it as returned rather than sorting it again.
645
683
 
646
684
  Optional `DiscoveryLearning` consumes real visible impressions and explicit
647
685
  engagement/hide outcomes. Persist its count-only snapshot per viewer; never share
package/dist/client.d.ts CHANGED
@@ -36,8 +36,12 @@ export declare class HttpClient {
36
36
  post<T>(path: string, body?: unknown, options?: {
37
37
  retry?: boolean;
38
38
  }): Promise<T>;
39
- put<T>(path: string, body?: unknown): Promise<T>;
39
+ put<T>(path: string, body?: unknown, options?: {
40
+ retry?: boolean;
41
+ }): Promise<T>;
40
42
  patch<T>(path: string, body?: unknown): Promise<T>;
41
- delete<T>(path: string): Promise<T>;
43
+ delete<T>(path: string, options?: {
44
+ retry?: boolean;
45
+ }): Promise<T>;
42
46
  fetchRaw(path: string, options: RequestInit): Promise<Response>;
43
47
  }
package/dist/client.js CHANGED
@@ -11,7 +11,9 @@ export class HttpClient {
11
11
  clientName;
12
12
  constructor(config) {
13
13
  const apiKey = config?.apiKey ||
14
- (typeof process !== 'undefined' ? process.env?.RECURSIV_API_KEY : undefined);
14
+ (config?.inheritEnvironmentApiKey !== false && typeof process !== 'undefined'
15
+ ? process.env?.RECURSIV_API_KEY
16
+ : undefined);
15
17
  this.anonymous = config?.anonymous ?? false;
16
18
  if (!apiKey && !this.anonymous && !config?.allowNoKey) {
17
19
  throw new RecursivError(0, {
@@ -186,16 +188,17 @@ export class HttpClient {
186
188
  const response = await (options?.retry === false ? this.fetchWithTimeout(url, request) : this.fetchWithRetry(url, request));
187
189
  return this.handleResponse(response);
188
190
  }
189
- async put(path, body) {
191
+ async put(path, body, options) {
190
192
  const url = this.buildUrl(path);
191
- const response = await this.fetchWithRetry(url, {
193
+ const request = {
192
194
  method: 'PUT',
193
195
  headers: {
194
196
  ...this.getAuthHeaders(),
195
197
  'Content-Type': 'application/json',
196
198
  },
197
199
  body: body ? JSON.stringify(body) : undefined,
198
- });
200
+ };
201
+ const response = await (options?.retry === false ? this.fetchWithTimeout(url, request) : this.fetchWithRetry(url, request));
199
202
  return this.handleResponse(response);
200
203
  }
201
204
  async patch(path, body) {
@@ -210,12 +213,10 @@ export class HttpClient {
210
213
  });
211
214
  return this.handleResponse(response);
212
215
  }
213
- async delete(path) {
216
+ async delete(path, options) {
214
217
  const url = this.buildUrl(path);
215
- const response = await this.fetchWithRetry(url, {
216
- method: 'DELETE',
217
- headers: this.getAuthHeaders(),
218
- });
218
+ const request = { method: 'DELETE', headers: this.getAuthHeaders() };
219
+ const response = await (options?.retry === false ? this.fetchWithTimeout(url, request) : this.fetchWithRetry(url, request));
219
220
  return this.handleResponse(response);
220
221
  }
221
222
  async fetchRaw(path, options) {
package/dist/index.d.ts CHANGED
@@ -59,6 +59,8 @@ import { CuratorResource } from './resources/curator.js';
59
59
  import { ReportsResource } from './resources/reports.js';
60
60
  import { ModerationResource } from './resources/moderation.js';
61
61
  import { LinkPreviewResource } from './resources/link-preview.js';
62
+ import { SearchResource } from './resources/search.js';
63
+ import { BookmarksResource } from './resources/bookmarks.js';
62
64
  import { AccountsResource } from './resources/accounts.js';
63
65
  import { RealtimeClient } from './realtime.js';
64
66
  import type { RecursivConfig } from './types.js';
@@ -124,6 +126,10 @@ export declare class Recursiv {
124
126
  readonly reports: ReportsResource;
125
127
  readonly moderation: ModerationResource;
126
128
  readonly linkPreview: LinkPreviewResource;
129
+ /** Blended search: posts, open network, people, groups, topics, stories, related and trending in one answer. */
130
+ readonly search: SearchResource;
131
+ /** Synced bookmarks: the member's saved posts, open-network posts and articles in this app, across devices. */
132
+ readonly bookmarks: BookmarksResource;
127
133
  readonly accounts: AccountsResource;
128
134
  readonly realtime: RealtimeClient;
129
135
  constructor(config?: Partial<RecursivConfig>);
@@ -143,6 +149,7 @@ export type { RealtimeConnectOptions } from './realtime.js';
143
149
  export { AuthResource } from './resources/auth.js';
144
150
  export type { AuthSession, SignUpInput, SignInInput, UsernameSignInInput, AppContext, ResetPasswordInput, TwoFactorConfirmation, TwoFactorEnrollment, TwoFactorChallenge, CompleteTwoFactorSignInInput, OAuthClientInfo, SendOtpInput, VerifyOtpInput, CreateApiKeyInput, ApiKeyResult, } from './resources/auth.js';
145
151
  export { PostsResource } from './resources/posts.js';
152
+ export type { CategoryOrder, CategoryOrderMeta, CategoryOrderReason } from './resources/posts.js';
146
153
  export { UsersResource } from './resources/users.js';
147
154
  export { CommunitiesResource } from './resources/communities.js';
148
155
  export { ChatResource } from './resources/chat.js';
@@ -182,13 +189,17 @@ export { CuratorResource } from './resources/curator.js';
182
189
  export { VideoResource } from './resources/video.js';
183
190
  export type { VideoUploadCreds, CreateVideoUploadResult, VideoStatusInfo, VideoPlaybackToken, VideoEntitlement, } from './resources/video.js';
184
191
  export { AppSubscriptionsResource } from './resources/app-subscriptions.js';
185
- export type { AppSubscriptionCheckoutResult, AppSubscriptionPortalResult, AppSubscriptionStatusResult, AppSubscriptionTierChangePreview, AppSubscriptionTierChangeResult, } from './resources/app-subscriptions.js';
186
- export type { CuratorSource, CuratorPrompt, CuratorRunInput, CuratorRunResult, CuratorTodayEdition, CuratorTodayExcerpt, CuratorTodayLeadImage, CuratorTodayRadar, CuratorTodayReaction, CuratorTodayResponse, CuratorTodaySource, CuratorTodayStory, } from './resources/curator.js';
192
+ export type { AppSubscriptionBoostCredit, AppSubscriptionCheckoutResult, AppSubscriptionPortalResult, AppSubscriptionStatusResult, AppSubscriptionTierChangePreview, AppSubscriptionTierChangeResult, } from './resources/app-subscriptions.js';
193
+ export type { CuratorSource, CuratorPrompt, CuratorRunInput, CuratorRunResult, CuratorTodayEdition, CuratorTodayExcerpt, CuratorTodayLeadImage, CuratorTodayRadar, CuratorTodayReaction, CuratorTodayResponse, CuratorTodaySource, CuratorTodayStory, ForYouMeta, ForYouParams, ForYouSurface, } from './resources/curator.js';
187
194
  export { ReportsResource } from './resources/reports.js';
188
195
  export type { ReportTargetType, ReportStatus, CreateReportInput, ReportRecord, ResolveReportInput, } from './resources/reports.js';
189
196
  export { ModerationResource } from './resources/moderation.js';
190
197
  export type { ModerationTargetType, ModerationActionType, ModerationAppealStatus, ModerationPrinciple, PublicModerationAction, PublicModerationLog, OwnModerationAppeal, OwnModerationAction, OwnModerationLog, ApplyModerationActionInput, } from './resources/moderation.js';
191
198
  export { LinkPreviewResource } from './resources/link-preview.js';
199
+ export { SEARCH_SECTIONS, SearchResource } from './resources/search.js';
200
+ export type { SearchAnswer, SearchGroup, SearchOmitReason, SearchParams, SearchPerson, SearchRelated, SearchResponse, SearchSection, SearchStory, SearchTopic } from './resources/search.js';
201
+ export { BOOKMARK_MERGE_MAX_ITEMS, BookmarksResource } from './resources/bookmarks.js';
202
+ export type { BookmarkedPost, BookmarkInput, BookmarkItem, BookmarkKey, BookmarkKeyRow, BookmarkKind, BookmarkMergeItem, BookmarkMergeResult, BookmarkProtocol, BookmarkRequestOptions, BookmarksPage, SavedBookmark, UnsavedBookmark, } from './resources/bookmarks.js';
192
203
  export { AccountsResource } from './resources/accounts.js';
193
204
  export type { SiblingAccount, SiblingAccountsResponse, SwitchAccountResult, } from './resources/accounts.js';
194
205
  export type { LinkPreview, LinkPreviewResponse, } from './resources/link-preview.js';
@@ -201,10 +212,10 @@ export type { UploadMediaInput, UploadUrlInput, UploadUrlResult } from './resour
201
212
  export { WalletResource } from './resources/wallet.js';
202
213
  export type { LinkedTokenWallet, PayoutState, TokenBalance, TokenLedgerEntry } from './resources/wallet.js';
203
214
  export { BoostsResource } from './resources/boosts.js';
204
- export type { BoostBalance, BoostBalanceResponse, BoostCampaign, BoostCampaignResponse, BoostEventResult, BoostLedgerEntry, BoostLedgerKind, BoostRejectionReason, BoostReviewStatus, BoostStatus, BoostTopupCheckout, BoostTopupConfirmation, BoostTopupLimits, } from './resources/boosts.js';
215
+ export type { BoostBalance, BoostBalanceResponse, BoostCampaign, BoostCampaignResponse, BoostEventResult, BoostLedgerEntry, BoostLedgerKind, BoostPlanCredit, BoostRejectionReason, BoostReviewStatus, BoostStatus, BoostTopupCheckout, BoostTopupConfirmation, BoostTopupLimits, } from './resources/boosts.js';
205
216
  export { ProtocolsResource } from './resources/protocols.js';
206
217
  export { PROTOCOL_ADAPTER_MATURITIES, PROTOCOL_CAPABILITY_OPERATIONS, PROTOCOL_CAPABILITY_STATUSES, } from './resources/protocols.js';
207
- export type { SocialProfile, SocialSubscription, SocialSubscriptionChange, SocialProfilePage, SocialRadar, SocialRadarCluster, SocialRadarMember, SocialRadarParams, SocialRadarPosts, SocialRadarStory, SocialNetwork, SocialPost, SocialConversation, SocialTrend, SocialTrendProvenance, SocialTrends, SocialTrendSourceIndex, SocialTrendFeed, SocialPopularProfiles, SocialAuthorFeed, SocialFollowingFeed, SocialFollowingSource, SearchPublicProfilesParams, SearchPublicPostsParams, SocialPostSearch, HostedProtocolConnections, HostedProtocol, HostedProtocolIdentity, HostedNostrChallenge, HostedNostrIdentityProof, NativeNostrPrepareInput, NativeNostrPrepared, NativeNostrAccount, NativeNostrPostState, NativeNostrReceipt, NativeSocialProtocol, FederationIdentity, FederationIdentityView, NativeSocialAccount, NativeSocialCallbackInput, NativeReplyPrepareInput, NativePostPrepareInput, NativeMediaInput, NativeMediaItem, NativePostBatch, NativePostHistory, NativeDelegatedPostHistoryItem, NativeNostrPostHistoryItem, NativeFollowSourceInput, NativeFollowPrepareInput, NativeFollowTarget, NativeFollowReceipt, NativeFollowState, NativeFollowAccount, NativeFollowStates, NativeFollowReview, NativeLikeSourceInput, NativeRepostSourceInput, NativeLikePrepareInput, NativeRepostPrepareInput, NativeLikeTarget, NativeRepostTarget, NativeLikeReceipt, NativeRepostReceipt, NativeLikeState, NativeRepostState, NativeLikeReview, NativeRepostReview, NativeReplyReceipt, NativeReplyBatch, NativeReplyHistory, NativeDelegatedReplyHistoryItem, NativeNostrReplyResult, NativeNostrReplyHistoryItem, NativeReplyRemovalReceipt, NativeReplyRemovalPreview, SocialSourceRef, SocialSourceControl, SocialSourceControlDisplay, SocialSourceControlChange, HostedPostPreview, ConnectHostedIdentityInput, CreateHostedIdentityInput, CreatedHostedProtocolIdentity, PreviewHostedPostInput, PublishHostedPostInput, ListProtocolCandidatesParams, ProtocolAdapterMaturity, ProtocolAdapterMetadata, ProtocolCandidateListResponse, ProtocolCandidatePageMeta, ProtocolCapabilityOperation, ProtocolCapabilityStatus, ProtocolCollectionStatus, ProtocolIngestionReplayResult, ProtocolIngestionStatus, ProtocolQuarantinedCandidate, ProtocolRefreshResult, ProtocolSettings, ProtocolSettingsUpdateResult, ReplayProtocolIngestionJobInput, UpdateSettingsInput as UpdateProtocolSettingsInput, } from './resources/protocols.js';
218
+ export type { SocialProfile, SocialSubscription, SocialSubscriptionChange, SocialProfilePage, SocialRadar, SocialRadarCluster, SocialRadarMember, SocialRadarParams, SocialRadarPosts, SocialRadarStory, SocialRadarStoryArchive, SocialNetwork, SocialPost, SocialConversation, SocialTrend, SocialTrendProvenance, SocialTrends, SocialTrendSourceIndex, SocialTrendFeed, SocialPopularProfiles, SocialAuthorFeed, SocialFollowingFeed, SocialFollowingSource, SearchPublicProfilesParams, SearchPublicPostsParams, SocialPostSearch, HostedProtocolConnections, HostedProtocol, HostedProtocolIdentity, HostedNostrChallenge, HostedNostrIdentityProof, NativeNostrPrepareInput, NativeNostrPrepared, NativeNostrAccount, NativeNostrPostState, NativeNostrReceipt, NativeSocialProtocol, FederationIdentity, FederationIdentityView, NativeSocialAccount, NativeSocialCallbackInput, NativeReplyPrepareInput, NativePostPrepareInput, NativeMediaInput, NativeMediaItem, NativePostBatch, NativePostHistory, NativeDelegatedPostHistoryItem, NativeNostrPostHistoryItem, NativeFollowSourceInput, NativeFollowPrepareInput, NativeFollowTarget, NativeFollowReceipt, NativeFollowState, NativeFollowAccount, NativeFollowStates, NativeFollowReview, NativeLikeSourceInput, NativeRepostSourceInput, NativeLikePrepareInput, NativeRepostPrepareInput, NativeLikeTarget, NativeRepostTarget, NativeLikeReceipt, NativeRepostReceipt, NativeLikeState, NativeRepostState, NativeLikeReview, NativeRepostReview, NativeReplyReceipt, NativeReplyBatch, NativeReplyHistory, NativeDelegatedReplyHistoryItem, NativeNostrReplyResult, NativeNostrReplyHistoryItem, NativeReplyRemovalReceipt, NativeReplyRemovalPreview, SocialSourceRef, SocialSourceControl, SocialSourceControlDisplay, SocialSourceControlChange, HostedPostPreview, ConnectHostedIdentityInput, CreateHostedIdentityInput, CreatedHostedProtocolIdentity, PreviewHostedPostInput, PublishHostedPostInput, ListProtocolCandidatesParams, ProtocolAdapterMaturity, ProtocolAdapterMetadata, ProtocolCandidateListResponse, ProtocolCandidatePageMeta, ProtocolCapabilityOperation, ProtocolCapabilityStatus, ProtocolCollectionStatus, ProtocolIngestionReplayResult, ProtocolIngestionStatus, ProtocolQuarantinedCandidate, ProtocolRefreshResult, ProtocolSettings, ProtocolSettingsUpdateResult, ReplayProtocolIngestionJobInput, UpdateSettingsInput as UpdateProtocolSettingsInput, } from './resources/protocols.js';
208
219
  export { InboxResource } from './resources/inbox.js';
209
220
  export { NetworkResource } from './resources/network.js';
210
221
  export { SimulatorResource } from './resources/simulator.js';
package/dist/index.js CHANGED
@@ -60,6 +60,8 @@ import { CuratorResource } from './resources/curator.js';
60
60
  import { ReportsResource } from './resources/reports.js';
61
61
  import { ModerationResource } from './resources/moderation.js';
62
62
  import { LinkPreviewResource } from './resources/link-preview.js';
63
+ import { SearchResource } from './resources/search.js';
64
+ import { BookmarksResource } from './resources/bookmarks.js';
63
65
  import { AccountsResource } from './resources/accounts.js';
64
66
  import { RealtimeClient } from './realtime.js';
65
67
  export class Recursiv {
@@ -125,6 +127,10 @@ export class Recursiv {
125
127
  reports;
126
128
  moderation;
127
129
  linkPreview;
130
+ /** Blended search: posts, open network, people, groups, topics, stories, related and trending in one answer. */
131
+ search;
132
+ /** Synced bookmarks: the member's saved posts, open-network posts and articles in this app, across devices. */
133
+ bookmarks;
128
134
  accounts;
129
135
  realtime;
130
136
  constructor(config) {
@@ -181,13 +187,15 @@ export class Recursiv {
181
187
  this.webhooks = new WebhooksResource(client);
182
188
  this.jobs = new JobsResource(client);
183
189
  this.curator = new CuratorResource(client);
184
- this.discovery = new DiscoveryResource(this.posts, this.protocols);
190
+ this.discovery = new DiscoveryResource(this.posts, this.protocols, this.curator, client);
185
191
  this.video = new VideoResource(client);
186
192
  this.appSubscriptions = new AppSubscriptionsResource(client);
187
193
  this.boosts = new BoostsResource(client);
188
194
  this.reports = new ReportsResource(client);
189
195
  this.moderation = new ModerationResource(client);
190
196
  this.linkPreview = new LinkPreviewResource(client);
197
+ this.search = new SearchResource(client);
198
+ this.bookmarks = new BookmarksResource(client);
191
199
  this.accounts = new AccountsResource(client);
192
200
  this.realtime = new RealtimeClient(client);
193
201
  this.#http = client;
@@ -243,6 +251,8 @@ export { AppSubscriptionsResource } from './resources/app-subscriptions.js';
243
251
  export { ReportsResource } from './resources/reports.js';
244
252
  export { ModerationResource } from './resources/moderation.js';
245
253
  export { LinkPreviewResource } from './resources/link-preview.js';
254
+ export { SEARCH_SECTIONS, SearchResource } from './resources/search.js';
255
+ export { BOOKMARK_MERGE_MAX_ITEMS, BookmarksResource } from './resources/bookmarks.js';
246
256
  export { AccountsResource } from './resources/accounts.js';
247
257
  export { OrganizationSettingsResource } from './resources/organization-settings.js';
248
258
  export { ProjectSettingsResource } from './resources/project-settings.js';
@@ -158,12 +158,25 @@ export interface InviteSystemStats {
158
158
  used: number;
159
159
  expired: number;
160
160
  revoked: number;
161
+ /** @deprecated Use `total`. */
162
+ total_codes: number;
163
+ /** @deprecated Use `active`. */
164
+ active_codes: number;
165
+ /** @deprecated Use `used`. */
166
+ used_codes: number;
167
+ /** @deprecated Use `expired`. */
168
+ expired_codes: number;
169
+ /** @deprecated Use `revoked`. */
170
+ revoked_codes: number;
161
171
  };
162
172
  waitlist: Record<string, number>;
163
173
  current_wave: {
164
174
  id: string;
165
175
  wave: number;
166
176
  name: string;
177
+ max_codes: number;
178
+ invites_per_user: number;
179
+ reward_tokens: number;
167
180
  is_active: boolean;
168
181
  } | null;
169
182
  }
@@ -65,7 +65,7 @@ export interface SalesLead {
65
65
  * Validation happens server-side too; this list lets apps validate or
66
66
  * surface choices client-side without round-tripping the API.
67
67
  */
68
- export declare const SUPPORTED_MODELS: readonly ["anthropic/claude-fable-5", "anthropic/claude-opus-4.6", "anthropic/claude-opus-4.8", "anthropic/claude-sonnet-4.6", "anthropic/claude-sonnet-5", "deepseek/deepseek-v3.2", "deepseek/deepseek-v4-pro", "google/gemini-3-flash-preview", "google/gemini-3.1-pro-preview", "google/gemini-3.5-flash", "minimax/minimax-m2.5", "minimax/minimax-m3", "moonshotai/kimi-k3", "openai/gpt-4o-mini", "openai/gpt-5.5", "openai/gpt-5.6-sol", "openai/gpt-5.6-terra", "x-ai/grok-4.3"];
68
+ export declare const SUPPORTED_MODELS: readonly ["anthropic/claude-fable-5", "anthropic/claude-fable-5.1", "anthropic/claude-opus-4.6", "anthropic/claude-opus-4.8", "anthropic/claude-opus-5", "anthropic/claude-opus-5.5", "anthropic/claude-sonnet-4.6", "anthropic/claude-sonnet-5", "deepseek/deepseek-v3.2", "deepseek/deepseek-v4-pro", "google/gemini-3-flash-preview", "google/gemini-3.1-pro-preview", "google/gemini-3.5-flash", "google/gemini-3.8-flash", "minimax/minimax-m2.5", "minimax/minimax-m3", "moonshotai/kimi-k3", "openai/gpt-4o-mini", "openai/gpt-5.5", "openai/gpt-5.6-sol", "openai/gpt-5.6-terra", "openai/gpt-6-astra", "openai/gpt-6-sol", "x-ai/grok-4.3"];
69
69
  export type SupportedModel = (typeof SUPPORTED_MODELS)[number];
70
70
  export interface EnsurePersonalAgentOverrides {
71
71
  /** Override the agent's display name. Defaults to 'Agent'. */
@@ -74,6 +74,17 @@ export interface EnsurePersonalAgentOverrides {
74
74
  model?: string;
75
75
  /** Override the system prompt. Apps like Minds can set their own voice. */
76
76
  system_prompt?: string;
77
+ /**
78
+ * Whether the agent may post publicly (reply to @mentions). The platform
79
+ * default for a new personal agent is 'chat_post'; pass 'chat_only' to keep
80
+ * it to private chat.
81
+ */
82
+ social_mode?: 'chat_only' | 'chat_post';
83
+ /**
84
+ * How the agent uses tools. The platform default for a new personal agent is
85
+ * 'autonomous'; 'permission' asks the owner before a tool acts.
86
+ */
87
+ tool_mode?: 'chat_only' | 'permission' | 'autonomous';
77
88
  }
78
89
  export interface EnsurePersonalAgentInput {
79
90
  /**
@@ -105,7 +116,7 @@ export declare class AgentsResource {
105
116
  }): Promise<PaginatedResponse<Agent>>;
106
117
  /** Get an agent by ID */
107
118
  get(id: string): Promise<SingleResponse<AgentDetail>>;
108
- /** Create a new AI agent */
119
+ /** Create a new AI agent. Omit username for a server-generated collision-resistant handle. */
109
120
  create(input: CreateAgentInput): Promise<SingleResponse<CreatedAgent>>;
110
121
  /** Update an agent's configuration */
111
122
  update(id: string, input: UpdateAgentInput): Promise<SingleResponse<UpdatedAgent>>;
@@ -12,8 +12,11 @@ import { parseSSE } from '../lib/sse.js';
12
12
  export const SUPPORTED_MODELS = [
13
13
  // <<< GENERATED: openrouter-sync — do not edit by hand (npm run models:sync)
14
14
  'anthropic/claude-fable-5',
15
+ 'anthropic/claude-fable-5.1',
15
16
  'anthropic/claude-opus-4.6',
16
17
  'anthropic/claude-opus-4.8',
18
+ 'anthropic/claude-opus-5',
19
+ 'anthropic/claude-opus-5.5',
17
20
  'anthropic/claude-sonnet-4.6',
18
21
  'anthropic/claude-sonnet-5',
19
22
  'deepseek/deepseek-v3.2',
@@ -21,6 +24,7 @@ export const SUPPORTED_MODELS = [
21
24
  'google/gemini-3-flash-preview',
22
25
  'google/gemini-3.1-pro-preview',
23
26
  'google/gemini-3.5-flash',
27
+ 'google/gemini-3.8-flash',
24
28
  'minimax/minimax-m2.5',
25
29
  'minimax/minimax-m3',
26
30
  'moonshotai/kimi-k3',
@@ -28,6 +32,8 @@ export const SUPPORTED_MODELS = [
28
32
  'openai/gpt-5.5',
29
33
  'openai/gpt-5.6-sol',
30
34
  'openai/gpt-5.6-terra',
35
+ 'openai/gpt-6-astra',
36
+ 'openai/gpt-6-sol',
31
37
  'x-ai/grok-4.3',
32
38
  // >>> GENERATED
33
39
  ];
@@ -51,7 +57,7 @@ export class AgentsResource {
51
57
  get(id) {
52
58
  return this.client.get(`/agents/${id}`);
53
59
  }
54
- /** Create a new AI agent */
60
+ /** Create a new AI agent. Omit username for a server-generated collision-resistant handle. */
55
61
  create(input) {
56
62
  return this.client.post('/agents', input);
57
63
  }
@@ -6,6 +6,30 @@ export interface AppSubscriptionCheckoutResult {
6
6
  export interface AppSubscriptionPortalResult {
7
7
  /** Stripe Billing Portal URL for the current app user. */
8
8
  url: string;
9
+ /**
10
+ * The page the portal opens on: `cancel` for the plan's cancel confirmation, null for the
11
+ * portal home. A plan already set to end opens the home, where the member can renew it.
12
+ * Absent from older servers.
13
+ */
14
+ flow?: 'cancel' | null;
15
+ }
16
+ /** The boost credit a paid plan on this app adds to the member's boost balance. */
17
+ export interface AppSubscriptionBoostCredit {
18
+ /** Micro-USD (1 USD = 1,000,000) each paid billing period of a plan adds, by tier key (e.g. `plus`, `pro`). */
19
+ perPeriodMicros: Record<string, number>;
20
+ /** What the member's current plan adds each paid period; 0 without a paid plan here. */
21
+ currentMicros: number;
22
+ /**
23
+ * When the next paid period starts and adds `currentMicros`. Null without a plan that adds
24
+ * credit, or while a payment is overdue. A plan set to end at the period's end still shows it.
25
+ */
26
+ nextGrantAt: string | null;
27
+ /**
28
+ * Plan credit the member owes: taken back after their plan dropped or ended inside a period, but
29
+ * already spent. The next plan credit repays it before adding anything. 0 when nothing is owed
30
+ * (absent from older servers).
31
+ */
32
+ owedMicros?: number;
9
33
  }
10
34
  export interface AppSubscriptionStatusResult {
11
35
  tier: string;
@@ -15,6 +39,11 @@ export interface AppSubscriptionStatusResult {
15
39
  currentPeriodEnd: string | null;
16
40
  /** Where the entitlement comes from: a Stripe subscription here, or the legacy import. */
17
41
  source?: 'stripe' | 'legacy';
42
+ /**
43
+ * The boost credit each paid period of a plan adds (once per period, from the payment that
44
+ * starts it). Null when this app's plans include none; absent from older servers.
45
+ */
46
+ boostCredit?: AppSubscriptionBoostCredit | null;
18
47
  }
19
48
  export interface AppSubscriptionTierChangePreview {
20
49
  /** The plan the preview prices. */
@@ -47,6 +76,13 @@ export declare class AppSubscriptionsResource {
47
76
  * Start a Stripe Checkout for the current user to subscribe to a plan tier ('plus' | 'pro').
48
77
  * Answers 409 `subscription_exists` when the member already has a subscription:
49
78
  * use `changeTier` for them instead, so they are never billed twice.
79
+ *
80
+ * Only one checkout can be paid at a time. Repeating the same request (same tier and
81
+ * `return_url`) returns the checkout already open; any other request expires the
82
+ * member's earlier open checkouts for this app. Answers 503 `checkout_busy` when
83
+ * Stripe is too slow to finish safely: retry. `return_url` keeps its own query and fragment;
84
+ * `sub=success&tier=<tier>` or `sub=cancelled` is added to its query (to the
85
+ * fragment's query for a hash route such as `#/billing`).
50
86
  */
51
87
  checkout(input: {
52
88
  tier: string;
@@ -79,13 +115,23 @@ export declare class AppSubscriptionsResource {
79
115
  }): Promise<{
80
116
  data: AppSubscriptionTierChangeResult;
81
117
  }>;
82
- /** Open the current app user's Stripe Billing Portal for this project. */
118
+ /**
119
+ * Open the current app user's Stripe Billing Portal for this project.
120
+ *
121
+ * `flow: 'cancel'` opens it straight on the cancel confirmation for the member's plan, and
122
+ * returns to `return_url` once they confirm. Answers 409 `no_subscription` when there is no
123
+ * plan to cancel, and 409 `legacy_membership` for a carried-over member with nothing to manage.
124
+ */
83
125
  createPortalSession(input: {
84
126
  return_url: string;
127
+ flow?: 'cancel';
85
128
  }): Promise<{
86
129
  data: AppSubscriptionPortalResult;
87
130
  }>;
88
- /** Read the current user's app-subscription status for this project-scoped key. */
131
+ /**
132
+ * Read the current user's app-subscription status for this project-scoped key, with the
133
+ * boost credit the app's plans include (`boostCredit`).
134
+ */
89
135
  status(): Promise<{
90
136
  data: AppSubscriptionStatusResult;
91
137
  }>;
@@ -11,6 +11,13 @@ export class AppSubscriptionsResource {
11
11
  * Start a Stripe Checkout for the current user to subscribe to a plan tier ('plus' | 'pro').
12
12
  * Answers 409 `subscription_exists` when the member already has a subscription:
13
13
  * use `changeTier` for them instead, so they are never billed twice.
14
+ *
15
+ * Only one checkout can be paid at a time. Repeating the same request (same tier and
16
+ * `return_url`) returns the checkout already open; any other request expires the
17
+ * member's earlier open checkouts for this app. Answers 503 `checkout_busy` when
18
+ * Stripe is too slow to finish safely: retry. `return_url` keeps its own query and fragment;
19
+ * `sub=success&tier=<tier>` or `sub=cancelled` is added to its query (to the
20
+ * fragment's query for a hash route such as `#/billing`).
14
21
  */
15
22
  checkout(input) {
16
23
  return this.client.post('/app-subscriptions/checkout', input);
@@ -35,11 +42,20 @@ export class AppSubscriptionsResource {
35
42
  changeTier(input) {
36
43
  return this.client.post('/app-subscriptions/change-tier', input, { retry: false });
37
44
  }
38
- /** Open the current app user's Stripe Billing Portal for this project. */
45
+ /**
46
+ * Open the current app user's Stripe Billing Portal for this project.
47
+ *
48
+ * `flow: 'cancel'` opens it straight on the cancel confirmation for the member's plan, and
49
+ * returns to `return_url` once they confirm. Answers 409 `no_subscription` when there is no
50
+ * plan to cancel, and 409 `legacy_membership` for a carried-over member with nothing to manage.
51
+ */
39
52
  createPortalSession(input) {
40
53
  return this.client.post('/app-subscriptions/portal', input);
41
54
  }
42
- /** Read the current user's app-subscription status for this project-scoped key. */
55
+ /**
56
+ * Read the current user's app-subscription status for this project-scoped key, with the
57
+ * boost credit the app's plans include (`boostCredit`).
58
+ */
43
59
  status() {
44
60
  return this.client.get('/app-subscriptions/status');
45
61
  }