@recursiv/sdk 0.7.31 → 0.7.32
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/resources/protocols.d.ts +73 -1
- package/dist/resources/protocols.js +22 -0
- package/llm.md +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ for await (const chunk of r.agents.chatStream(agent.id, { message: 'Hello!' }))
|
|
|
111
111
|
| `r.admin` | User management, stats, content reports (`listReports`, `resolveReport`, `dismissReport`) |
|
|
112
112
|
| `r.dispatcher` | Task queue, claims, signals, outcomes, webhooks |
|
|
113
113
|
| `r.goals` | Org goals with task rollups (group dispatcher tasks) |
|
|
114
|
-
| `r.protocols` | Private Minds safety: `sourceControls` (current enablement and saved choices), `setSourceControl`, `onSourceControlChange`, `reportSource`. Delegated accounts: `nativeSocialAccounts`, `startNativeSocialConnection`, `finishNativeSocialConnection`, `disconnectNativeSocialAccount`. 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: `publicNetworks`, `searchPublicProfiles`, `getPublicProfile`, `getPublicAuthorFeed`, `getFollowingFeed`, `getPublicConversation`, `getPublicTrends`, `getPublicTrendFeed`; 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` |
|
|
114
|
+
| `r.protocols` | Private Minds safety: `sourceControls` (current enablement and saved choices), `setSourceControl`, `onSourceControlChange`, `reportSource`. Delegated accounts: `nativeSocialAccounts`, `startNativeSocialConnection`, `finishNativeSocialConnection`, `disconnectNativeSocialAccount`. Native follows: `nativeFollowState`, `prepareNativeFollow`, `submitNativeFollow`, `nativeFollowStatus` (native following or pending approval, distinct from a Minds feed subscription; preserve the complete signed Nostr list). 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: `publicNetworks`, `searchPublicProfiles`, `getPublicProfile`, `getPublicAuthorFeed`, `getFollowingFeed`, `getPublicConversation`, `getPublicTrends`, `getPublicTrendFeed`; 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` |
|
|
115
115
|
|
|
116
116
|
Full reference: see [llm.md](./llm.md) (ships with this package) or the type definitions in `dist/`.
|
|
117
117
|
|
package/dist/index.d.ts
CHANGED
|
@@ -194,7 +194,7 @@ export type { UploadMediaInput, UploadUrlInput, UploadUrlResult } from './resour
|
|
|
194
194
|
export { WalletResource } from './resources/wallet.js';
|
|
195
195
|
export { ProtocolsResource } from './resources/protocols.js';
|
|
196
196
|
export { PROTOCOL_ADAPTER_MATURITIES, PROTOCOL_CAPABILITY_OPERATIONS, PROTOCOL_CAPABILITY_STATUSES, } from './resources/protocols.js';
|
|
197
|
-
export type { SocialProfile, SocialSubscription, SocialSubscriptionChange, SocialProfilePage, SocialNetwork, SocialPost, SocialConversation, SocialTrend, SocialTrendProvenance, SocialTrends, SocialTrendFeed, SocialPopularProfiles, SocialAuthorFeed, SocialFollowingFeed, SocialFollowingSource, SearchPublicProfilesParams, HostedProtocolConnections, HostedProtocol, HostedProtocolIdentity, HostedNostrChallenge, HostedNostrIdentityProof, NativeNostrPrepareInput, NativeNostrPrepared, NativeNostrAccount, NativeNostrPostState, NativeNostrReceipt, NativeSocialProtocol, FederationIdentity, FederationIdentityView, NativeSocialAccount, NativeSocialCallbackInput, NativeReplyPrepareInput, NativeLikeSourceInput, NativeLikePrepareInput, NativeLikeTarget, NativeLikeReceipt, NativeLikeState, NativeLikeReview, NativeReplyReceipt, NativeReplyBatch, NativeReplyHistory, NativeDelegatedReplyHistoryItem, NativeNostrReplyResult, NativeNostrReplyHistoryItem, NativeReplyRemovalReceipt, NativeReplyRemovalPreview, SocialSourceRef, SocialSourceControl, SocialSourceControlChange, HostedPostPreview, ConnectHostedIdentityInput, PreviewHostedPostInput, PublishHostedPostInput, ListProtocolCandidatesParams, ProtocolAdapterMaturity, ProtocolAdapterMetadata, ProtocolCandidateListResponse, ProtocolCandidatePageMeta, ProtocolCapabilityOperation, ProtocolCapabilityStatus, ProtocolCollectionStatus, ProtocolIngestionReplayResult, ProtocolIngestionStatus, ProtocolQuarantinedCandidate, ProtocolRefreshResult, ProtocolSettings, ProtocolSettingsUpdateResult, ReplayProtocolIngestionJobInput, UpdateSettingsInput as UpdateProtocolSettingsInput, } from './resources/protocols.js';
|
|
197
|
+
export type { SocialProfile, SocialSubscription, SocialSubscriptionChange, SocialProfilePage, SocialNetwork, SocialPost, SocialConversation, SocialTrend, SocialTrendProvenance, SocialTrends, SocialTrendFeed, SocialPopularProfiles, SocialAuthorFeed, SocialFollowingFeed, SocialFollowingSource, SearchPublicProfilesParams, HostedProtocolConnections, HostedProtocol, HostedProtocolIdentity, HostedNostrChallenge, HostedNostrIdentityProof, NativeNostrPrepareInput, NativeNostrPrepared, NativeNostrAccount, NativeNostrPostState, NativeNostrReceipt, NativeSocialProtocol, FederationIdentity, FederationIdentityView, NativeSocialAccount, NativeSocialCallbackInput, NativeReplyPrepareInput, NativeFollowSourceInput, NativeFollowPrepareInput, NativeFollowTarget, NativeFollowReceipt, NativeFollowState, NativeFollowReview, NativeLikeSourceInput, NativeLikePrepareInput, NativeLikeTarget, NativeLikeReceipt, NativeLikeState, NativeLikeReview, NativeReplyReceipt, NativeReplyBatch, NativeReplyHistory, NativeDelegatedReplyHistoryItem, NativeNostrReplyResult, NativeNostrReplyHistoryItem, NativeReplyRemovalReceipt, NativeReplyRemovalPreview, SocialSourceRef, SocialSourceControl, SocialSourceControlChange, HostedPostPreview, ConnectHostedIdentityInput, PreviewHostedPostInput, PublishHostedPostInput, ListProtocolCandidatesParams, ProtocolAdapterMaturity, ProtocolAdapterMetadata, ProtocolCandidateListResponse, ProtocolCandidatePageMeta, ProtocolCapabilityOperation, ProtocolCapabilityStatus, ProtocolCollectionStatus, ProtocolIngestionReplayResult, ProtocolIngestionStatus, ProtocolQuarantinedCandidate, ProtocolRefreshResult, ProtocolSettings, ProtocolSettingsUpdateResult, ReplayProtocolIngestionJobInput, UpdateSettingsInput as UpdateProtocolSettingsInput, } from './resources/protocols.js';
|
|
198
198
|
export { InboxResource } from './resources/inbox.js';
|
|
199
199
|
export { NetworkResource } from './resources/network.js';
|
|
200
200
|
export { SimulatorResource } from './resources/simulator.js';
|
|
@@ -317,6 +317,67 @@ export interface NativeReplyPrepareInput {
|
|
|
317
317
|
deliveryIds: string[];
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
+
export interface NativeFollowSourceInput {
|
|
321
|
+
accountId: string;
|
|
322
|
+
protocol: SocialSourceRef['protocol'];
|
|
323
|
+
nativeId: string;
|
|
324
|
+
}
|
|
325
|
+
export interface NativeFollowPrepareInput extends NativeFollowSourceInput {
|
|
326
|
+
clientMutationId: string;
|
|
327
|
+
action: 'follow' | 'unfollow';
|
|
328
|
+
}
|
|
329
|
+
export type NativeFollowTarget = {
|
|
330
|
+
nativeId: string;
|
|
331
|
+
sourceUrl: string;
|
|
332
|
+
handle: string;
|
|
333
|
+
revision: string;
|
|
334
|
+
followAllowed: boolean;
|
|
335
|
+
} & ({
|
|
336
|
+
protocol: 'bluesky';
|
|
337
|
+
} | {
|
|
338
|
+
protocol: 'activitypub';
|
|
339
|
+
localId: string;
|
|
340
|
+
} | {
|
|
341
|
+
protocol: 'nostr';
|
|
342
|
+
});
|
|
343
|
+
export interface NativeFollowReceipt {
|
|
344
|
+
state: 'following' | 'requested' | 'unfollowed' | 'unknown' | 'rejected';
|
|
345
|
+
acknowledged: boolean;
|
|
346
|
+
reference: {
|
|
347
|
+
nativeId: string;
|
|
348
|
+
revision: string;
|
|
349
|
+
} | null;
|
|
350
|
+
}
|
|
351
|
+
export interface NativeFollowState extends NativeFollowReceipt {
|
|
352
|
+
accountId: string;
|
|
353
|
+
account: {
|
|
354
|
+
nativeId: string;
|
|
355
|
+
handle: string;
|
|
356
|
+
serverUrl: string;
|
|
357
|
+
};
|
|
358
|
+
target: NativeFollowTarget;
|
|
359
|
+
/** Resume this account's unresolved review after a browser refresh. Never start a duplicate action. */
|
|
360
|
+
pendingActionId: string | null;
|
|
361
|
+
/** An earlier connection or another target profile has an unresolved attempt. Read again to reconcile; do not prepare a new write. */
|
|
362
|
+
pendingActionBlocked: boolean;
|
|
363
|
+
}
|
|
364
|
+
export interface NativeFollowReview {
|
|
365
|
+
id: string;
|
|
366
|
+
clientMutationId: string;
|
|
367
|
+
expiresAt: string;
|
|
368
|
+
accountId: string;
|
|
369
|
+
account: NativeFollowState['account'];
|
|
370
|
+
target: NativeFollowTarget;
|
|
371
|
+
action: 'follow' | 'unfollow';
|
|
372
|
+
attemptedAt: string | null;
|
|
373
|
+
receipt: NativeFollowReceipt | null;
|
|
374
|
+
checkedAt: string | null;
|
|
375
|
+
/** Sign this exact event with the displayed account. Never send a private key. */
|
|
376
|
+
signing?: {
|
|
377
|
+
event: Omit<HostedNostrIdentityProof, 'sig'>;
|
|
378
|
+
relay: string;
|
|
379
|
+
};
|
|
380
|
+
}
|
|
320
381
|
export interface NativeLikeSourceInput {
|
|
321
382
|
accountId: string;
|
|
322
383
|
protocol: SocialSourceRef['protocol'];
|
|
@@ -549,7 +610,7 @@ export interface NativeNostrPrepared {
|
|
|
549
610
|
export interface NativeNostrAccount {
|
|
550
611
|
enabled: boolean;
|
|
551
612
|
identity: HostedProtocolIdentity | null;
|
|
552
|
-
capabilities: Array<'publish_original_text' | 'request_own_post_deletion' | 'reply_text_note' | 'publish_linked_text' | 'like' | 'unlike'>;
|
|
613
|
+
capabilities: Array<'publish_original_text' | 'request_own_post_deletion' | 'reply_text_note' | 'publish_linked_text' | 'like' | 'unlike' | 'follow' | 'unfollow'>;
|
|
553
614
|
signing?: 'client';
|
|
554
615
|
}
|
|
555
616
|
export interface NativeNostrPostState {
|
|
@@ -818,6 +879,17 @@ export declare class ProtocolsResource {
|
|
|
818
879
|
limit?: number;
|
|
819
880
|
cursor?: string;
|
|
820
881
|
}): Promise<SingleResponse<SocialPopularProfiles>>;
|
|
882
|
+
/** Read this connected account's current native following; never infer it from a public count. */
|
|
883
|
+
nativeFollowState(input: NativeFollowSourceInput): Promise<SingleResponse<NativeFollowState>>;
|
|
884
|
+
/** Prepare a follow/unfollow for explicit approval. Preserve the mutation ID after a lost response. */
|
|
885
|
+
prepareNativeFollow(input: NativeFollowPrepareInput): Promise<SingleResponse<NativeFollowReview>>;
|
|
886
|
+
/** Submit one approved action. Only Nostr supplies a public signed event. Automatic retries are disabled. */
|
|
887
|
+
submitNativeFollow(id: string, input: {
|
|
888
|
+
approve: true;
|
|
889
|
+
event?: HostedNostrIdentityProof;
|
|
890
|
+
}): Promise<SingleResponse<NativeFollowReview>>;
|
|
891
|
+
/** Reconcile the saved action without sending another native write. */
|
|
892
|
+
nativeFollowStatus(id: string): Promise<SingleResponse<NativeFollowReview>>;
|
|
821
893
|
/** Read this connected account's current native like; never infer it from a public count. */
|
|
822
894
|
nativeLikeState(input: NativeLikeSourceInput): Promise<SingleResponse<NativeLikeState>>;
|
|
823
895
|
/** Prepare a like/unlike for explicit approval. Preserve the mutation ID after a lost response. */
|
|
@@ -110,6 +110,28 @@ export class ProtocolsResource {
|
|
|
110
110
|
getPublicPopularProfiles(params) {
|
|
111
111
|
return this.client.get('/protocols/social/popular-profiles', { protocol: params.protocol, limit: params.limit, cursor: params.cursor });
|
|
112
112
|
}
|
|
113
|
+
/** Read this connected account's current native following; never infer it from a public count. */
|
|
114
|
+
nativeFollowState(input) {
|
|
115
|
+
return this.client.get('/protocols/social/follows/state', { accountId: input.accountId, protocol: input.protocol, nativeId: input.nativeId });
|
|
116
|
+
}
|
|
117
|
+
/** Prepare a follow/unfollow for explicit approval. Preserve the mutation ID after a lost response. */
|
|
118
|
+
prepareNativeFollow(input) {
|
|
119
|
+
return this.client.post('/protocols/social/follows/prepare', { clientMutationId: input.clientMutationId, accountId: input.accountId,
|
|
120
|
+
protocol: input.protocol, nativeId: input.nativeId, action: input.action }, { retry: false });
|
|
121
|
+
}
|
|
122
|
+
/** Submit one approved action. Only Nostr supplies a public signed event. Automatic retries are disabled. */
|
|
123
|
+
submitNativeFollow(id, input) {
|
|
124
|
+
hostedIdentityPath(id);
|
|
125
|
+
const event = input.event;
|
|
126
|
+
return this.client.post(`/protocols/social/follows/${encodeURIComponent(id)}/submit`, { approve: input.approve,
|
|
127
|
+
...(event ? { event: { id: event.id, pubkey: event.pubkey, sig: event.sig, kind: event.kind,
|
|
128
|
+
created_at: event.created_at, content: event.content, tags: event.tags } } : {}) }, { retry: false });
|
|
129
|
+
}
|
|
130
|
+
/** Reconcile the saved action without sending another native write. */
|
|
131
|
+
nativeFollowStatus(id) {
|
|
132
|
+
hostedIdentityPath(id);
|
|
133
|
+
return this.client.get(`/protocols/social/follows/${encodeURIComponent(id)}`);
|
|
134
|
+
}
|
|
113
135
|
/** Read this connected account's current native like; never infer it from a public count. */
|
|
114
136
|
nativeLikeState(input) {
|
|
115
137
|
return this.client.get('/protocols/social/likes/state', { accountId: input.accountId, protocol: input.protocol, nativeId: input.nativeId });
|
package/llm.md
CHANGED
|
@@ -632,6 +632,7 @@ if (subscription.active) {
|
|
|
632
632
|
- `r.admin` — Admin operations (user management, stats, network settings); content reports: `listReports({ status? })`, `resolveReport(id)`, `dismissReport(id)` (project-bound keys see only their app's reports)
|
|
633
633
|
- `r.inviteCodes` / `r.inviteCodesAdmin` — Invite code management
|
|
634
634
|
- `r.organizationSettings` / `r.organizationSecurity` — Org configuration
|
|
635
|
+
- Native follows: `nativeFollowState({ accountId, protocol, nativeId })`, `prepareNativeFollow({ clientMutationId, accountId, protocol, nativeId, action: "follow" | "unfollow" })`, `submitNativeFollow(id, { approve: true, event? })`, `nativeFollowStatus(id)`. Show the acting identity and native following/requested/unfollowed state separately from the Minds feed subscription. Nostr must sign the complete review event without dropping other contacts; stale lists require a fresh review. Keep mutation IDs and reconcile ambiguous outcomes without replay. Requires current follow scopes and API `NATIVE_SOCIAL_FOLLOW_PROJECTS` plus source controls.
|
|
635
636
|
- Native likes: `nativeLikeState({ accountId, protocol, nativeId })`, `prepareNativeLike({ clientMutationId, accountId, protocol, nativeId, action: "like" | "unlike" })`, `submitNativeLike(id, { approve: true, event? })`, and `nativeLikeStatus(id)`. Display the selected account, source and action before approval. Only Nostr supplies `event`: sign the exact public `signing.event` in the review; never transmit a private key. Preserve mutation IDs on ambiguous responses and refresh unknown results instead of resending. Read capabilities before offering actions; old reply-only connections need reconnecting for likes. Nostr results describe the connected relay, not every public relay. The app-specific `NATIVE_SOCIAL_LIKE_PROJECTS` switch and source controls must be enabled on the API.
|
|
636
637
|
- Delegated social accounts: `r.protocols.nativeSocialAccounts()`, `startNativeSocialConnection({ protocol, identifier })`, `finishNativeSocialConnection({ protocol, state, code?, iss?, error? })`, `disconnectNativeSocialAccount(id)`. Example: `const { data } = await r.protocols.startNativeSocialConnection({ protocol: "bluesky", identifier: "alice.bsky.social" })`; open `data.authorizationUrl`, then complete with the same signed-in app user. Never log callback codes, send passwords, or auto-retry OAuth callbacks. Shared replies (off until schema/API deployment and live verification): `prepareNativeReply({ clientMutationId, text, parent: { protocol, nativeId, readRef? }, accountIds, linkedPostAccountIds?, recoverFrom?: { batchId, deliveryIds } })`, `submitNativeReply(id, { approve: true, deliveryIds })`, `nativeReplyStatus(id)`, `nativeReplyHistory({ limit?, cursor? })`, `prepareNativeReplyRemoval(id, { deliveryIds })`, `removeNativeReply(id, { approve: true, removals })`. Review account, destination, `kind`, source and exact `wireText`; connection is not publication approval. `linkedPostAccountIds` explicitly selects different-network standalone posts with a source link, never matching threaded replies or a same-network denial fallback. Preserve mutation IDs, show per-destination results and reconcile uncertain attempts without reposting. To review selected unsent or definitively rejected deliveries again, use recoverFrom with a new mutation ID, the same source/accounts and freshly reviewed text; preserve that ID on uncertain preparation. Only saved recoverable destinations qualify, current gates still apply, and replacedBy disables old sends atomically. Never restart unknown, accepted or published deliveries. The new preview still needs explicit approval. Saved delegated drafts/results: `const { data: history } = await r.protocols.nativeReplyHistory({ limit: 20 })`; use its opaque cursor for the next page and `nativeReplyStatus(item.id)` for details. This is a private read, not a write or provider refresh, and includes Nostr results marked type=nostr. Use nativeNostrReplyResult(item.id) to check that recorded event on its relay without signing or resending. Discard page state on owner/app changes. See README for examples and the callback, revocation and removal contracts.
|
|
637
638
|
- `r.protocols` — Private app safety: `sourceControls` returns current `enabled` plus paged saved choices; `setSourceControl`, `onSourceControlChange` and `reportSource` share app scope. Example: `const choices = new Map(); const stop = r.protocols.onSourceControlChange(change => choices.set(JSON.stringify([change.source, change.control]), change.enabled));` then `await r.protocols.setSourceControl({ source: { protocol: "bluesky", kind: "actor", nativeId: "did:plc:aaaaaaaaaaaaaaaaaaaaaaaa" }, control: "mute", enabled: true, scope: "minds" });` and call `stop(); choices.clear()` on account change/unmount. Notifications follow an exact server confirmation, never an uncertain response. These preferences and reports apply in Minds, not on the remote network. Keyless post links: `const visitor = new Recursiv({ anonymous: true }); const { data: thread } = await visitor.protocols.getSharedConversation(projectId, { protocol: 'nostr', post: publicEventId })`; `sharedNetworks(projectId)` lists public conversation capabilities. Only configured apps; app moderation and rate limits apply, no member state or write authority. Member public reading: `publicNetworks`, `searchPublicProfiles`, `getPublicProfile`, `getPublicAuthorFeed`, `getFollowingFeed`, `getPublicConversation`, `getPublicTrends`, `getPublicTrendFeed`; private app subscriptions: `listSubscriptions`, `subscribeToProfile`, `unsubscribeFromProfile`, `onSubscriptionChange`. Example after selecting a returned source post: `const { data: thread } = await r.protocols.getPublicConversation({ protocol: post.protocol, post: post.nativeId, readRef: post.readRef })`. Render `focus`, oldest-first `ancestors` and direct `replies`; `public_provider_window` never promises every reply, and `limited` marks known omissions. Requires both `users:read` and `posts:read` on the current human app key. Protocol discovery/settings: `const { data: adapters } = await r.protocols.list()` returns bounded `{ id, name, icon, color, maturity, capabilities, limitations }` metadata; `supported` means implemented, not configured, healthy, authorized, or enabled. Methods: `list`, `status`, `listCandidates`, `getCandidate`, `search`, `getSettings`, `refresh`, `updateSettings`.
|