@recursiv/sdk 0.7.27 → 0.7.29
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/dist/index.d.ts +2 -2
- package/dist/resources/accounts.d.ts +8 -2
- package/dist/resources/accounts.js +1 -1
- package/dist/resources/curator.d.ts +68 -0
- package/dist/resources/curator.js +8 -0
- package/dist/resources/protocols.d.ts +145 -2
- package/dist/resources/protocols.js +61 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -171,7 +171,7 @@ export { VideoResource } from './resources/video.js';
|
|
|
171
171
|
export type { VideoUploadCreds, CreateVideoUploadResult, VideoStatusInfo, VideoPlaybackToken, } from './resources/video.js';
|
|
172
172
|
export { AppSubscriptionsResource } from './resources/app-subscriptions.js';
|
|
173
173
|
export type { AppSubscriptionCheckoutResult, AppSubscriptionPortalResult, AppSubscriptionStatusResult, } from './resources/app-subscriptions.js';
|
|
174
|
-
export type { CuratorSource, CuratorPrompt, CuratorRunInput, CuratorRunResult, } from './resources/curator.js';
|
|
174
|
+
export type { CuratorSource, CuratorPrompt, CuratorRunInput, CuratorRunResult, CuratorTodayEdition, CuratorTodayResponse, CuratorTodaySource, CuratorTodayStory, } from './resources/curator.js';
|
|
175
175
|
export { ReportsResource } from './resources/reports.js';
|
|
176
176
|
export type { ReportTargetType, ReportStatus, CreateReportInput, ReportRecord, ResolveReportInput, } from './resources/reports.js';
|
|
177
177
|
export { ModerationResource } from './resources/moderation.js';
|
|
@@ -189,7 +189,7 @@ export type { UploadMediaInput, UploadUrlInput, UploadUrlResult } from './resour
|
|
|
189
189
|
export { WalletResource } from './resources/wallet.js';
|
|
190
190
|
export { ProtocolsResource } from './resources/protocols.js';
|
|
191
191
|
export { PROTOCOL_ADAPTER_MATURITIES, PROTOCOL_CAPABILITY_OPERATIONS, PROTOCOL_CAPABILITY_STATUSES, } from './resources/protocols.js';
|
|
192
|
-
export type { SocialProfile, SocialSubscription, SocialSubscriptionChange, SocialProfilePage, SocialNetwork, SocialPost, SocialConversation, SocialTrend, SocialTrendProvenance, SocialTrends, SocialTrendFeed, SocialAuthorFeed, SocialFollowingFeed, SocialFollowingSource, SearchPublicProfilesParams, HostedProtocolConnections, HostedProtocol, HostedProtocolIdentity, HostedNostrChallenge, HostedNostrIdentityProof, NativeNostrPrepareInput, NativeNostrPrepared, NativeNostrAccount, NativeNostrPostState, NativeNostrReceipt, NativeSocialProtocol, FederationIdentity, FederationIdentityView, NativeSocialAccount, NativeSocialCallbackInput, NativeReplyPrepareInput, NativeReplyReceipt, NativeReplyBatch, NativeReplyHistory, NativeDelegatedReplyHistoryItem, NativeNostrReplyResult, NativeNostrReplyHistoryItem, NativeReplyRemovalReceipt, NativeReplyRemovalPreview, SocialSourceRef, SocialSourceControl, SocialSourceControlChange, HostedPostPreview, ConnectHostedIdentityInput, PreviewHostedPostInput, PublishHostedPostInput, ListProtocolCandidatesParams, ProtocolAdapterMaturity, ProtocolAdapterMetadata, ProtocolCandidateListResponse, ProtocolCandidatePageMeta, ProtocolCapabilityOperation, ProtocolCapabilityStatus, ProtocolCollectionStatus, ProtocolQuarantinedCandidate, ProtocolRefreshResult, ProtocolSettings, ProtocolSettingsUpdateResult, UpdateSettingsInput as UpdateProtocolSettingsInput, } from './resources/protocols.js';
|
|
192
|
+
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, 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';
|
|
193
193
|
export { InboxResource } from './resources/inbox.js';
|
|
194
194
|
export { NetworkResource } from './resources/network.js';
|
|
195
195
|
export { SimulatorResource } from './resources/simulator.js';
|
|
@@ -6,11 +6,15 @@ export interface SiblingAccount {
|
|
|
6
6
|
username: string;
|
|
7
7
|
name: string;
|
|
8
8
|
image: string | null;
|
|
9
|
-
created_at: string;
|
|
9
|
+
created_at: string | null;
|
|
10
|
+
/** Followers on this account. The main-account rule reads this field. */
|
|
11
|
+
follower_count: number;
|
|
10
12
|
/** The stored primary email is a migration placeholder, not a real inbox. */
|
|
11
13
|
is_placeholder_email: boolean;
|
|
12
14
|
/** Server heuristic used to collapse test/demo identities in account pickers. */
|
|
13
15
|
looks_like_test: boolean;
|
|
16
|
+
/** The account OTP sign-in lands on. Exactly one row carries it. */
|
|
17
|
+
is_primary: boolean;
|
|
14
18
|
is_current: boolean;
|
|
15
19
|
}
|
|
16
20
|
export interface SiblingAccountsResponse {
|
|
@@ -19,6 +23,8 @@ export interface SiblingAccountsResponse {
|
|
|
19
23
|
/** The verified real address shared by the returned accounts. */
|
|
20
24
|
email: string;
|
|
21
25
|
count: number;
|
|
26
|
+
/** Id of the main account, or null when the caller has no usable address. */
|
|
27
|
+
primary_id?: string | null;
|
|
22
28
|
};
|
|
23
29
|
}
|
|
24
30
|
export interface SwitchAccountResult {
|
|
@@ -36,7 +42,7 @@ export interface SwitchAccountResult {
|
|
|
36
42
|
export declare class AccountsResource {
|
|
37
43
|
private client;
|
|
38
44
|
constructor(client: HttpClient);
|
|
39
|
-
/** List every account controlled by the caller's verified real email. */
|
|
45
|
+
/** List every account controlled by the caller's verified real email, main account first. */
|
|
40
46
|
listSiblings(): Promise<SiblingAccountsResponse>;
|
|
41
47
|
/** Mint a replacement key for a sibling account in the caller's project. */
|
|
42
48
|
switchAccount(targetUserId: string): Promise<SingleResponse<SwitchAccountResult>>;
|
|
@@ -11,7 +11,7 @@ export class AccountsResource {
|
|
|
11
11
|
constructor(client) {
|
|
12
12
|
this.client = client;
|
|
13
13
|
}
|
|
14
|
-
/** List every account controlled by the caller's verified real email. */
|
|
14
|
+
/** List every account controlled by the caller's verified real email, main account first. */
|
|
15
15
|
listSiblings() {
|
|
16
16
|
return this.client.get('/accounts/siblings');
|
|
17
17
|
}
|
|
@@ -105,9 +105,77 @@ export interface CuratorSeedDeckResponse {
|
|
|
105
105
|
data: CuratorSeedDeckItem[];
|
|
106
106
|
meta: CuratorSeedDeckMeta;
|
|
107
107
|
}
|
|
108
|
+
/** Which half of the press an outlet belongs to. */
|
|
109
|
+
export type CuratorOutletLane = 'mainstream' | 'independent';
|
|
110
|
+
/** One outlet item behind a world story. Headline and link only, never an article body. */
|
|
111
|
+
export interface CuratorTodaySource {
|
|
112
|
+
outlet: string;
|
|
113
|
+
/** The outlet's lane. Absent on stories written before lanes existed. */
|
|
114
|
+
lane?: CuratorOutletLane;
|
|
115
|
+
title: string;
|
|
116
|
+
url: string;
|
|
117
|
+
published_at: string | null;
|
|
118
|
+
}
|
|
119
|
+
/** Distinct outlets per lane behind a world story. */
|
|
120
|
+
export interface CuratorTodayLaneMix {
|
|
121
|
+
mainstream: number;
|
|
122
|
+
independent: number;
|
|
123
|
+
}
|
|
124
|
+
export interface CuratorTodayStory {
|
|
125
|
+
id: string;
|
|
126
|
+
/** 1 = lead. World stories hold 1..N, Minds stories follow. */
|
|
127
|
+
rank: number;
|
|
128
|
+
/**
|
|
129
|
+
* 'world': the open web set it, ranked by how many outlets moved on it in
|
|
130
|
+
* the last 24 h with an independent outlet weighted above a mainstream one.
|
|
131
|
+
* 'minds': a group of real Minds posts.
|
|
132
|
+
*/
|
|
133
|
+
kind: 'world' | 'minds';
|
|
134
|
+
kicker: string;
|
|
135
|
+
headline: string;
|
|
136
|
+
dek: string | null;
|
|
137
|
+
topic: string | null;
|
|
138
|
+
/** Outlet links for a world story; null for a Minds story. */
|
|
139
|
+
sources: CuratorTodaySource[] | null;
|
|
140
|
+
/** Distinct outlets behind a world story; null for a Minds story. */
|
|
141
|
+
outlet_count: number | null;
|
|
142
|
+
/** Distinct outlets per lane behind a world story; null for a Minds story. */
|
|
143
|
+
lane_mix: CuratorTodayLaneMix | null;
|
|
144
|
+
/**
|
|
145
|
+
* Which lanes carry a world story: 'mainstream', 'independent' (nobody in
|
|
146
|
+
* the mainstream lane ran it) or 'both'. Null for a Minds story.
|
|
147
|
+
*/
|
|
148
|
+
lane: CuratorOutletLane | 'both' | null;
|
|
149
|
+
/** The discussion-room post when one exists. */
|
|
150
|
+
discussion_post_id: string | null;
|
|
151
|
+
/** Replies on the discussion post; 0 when there is none. */
|
|
152
|
+
reply_count: number;
|
|
153
|
+
/** Minds posts in the same shape as `sdk.posts.list()`. May be empty for a world story. */
|
|
154
|
+
posts: Post[];
|
|
155
|
+
}
|
|
156
|
+
export interface CuratorTodayEdition {
|
|
157
|
+
id: string;
|
|
158
|
+
edition_date: string;
|
|
159
|
+
status: 'draft' | 'published';
|
|
160
|
+
generated_at: string;
|
|
161
|
+
stories: CuratorTodayStory[];
|
|
162
|
+
}
|
|
163
|
+
export interface CuratorTodayResponse {
|
|
164
|
+
/** null when the network has no published edition yet. */
|
|
165
|
+
data: CuratorTodayEdition | null;
|
|
166
|
+
meta: {
|
|
167
|
+
generating: boolean;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
108
170
|
export declare class CuratorResource {
|
|
109
171
|
private client;
|
|
110
172
|
constructor(client: HttpClient);
|
|
173
|
+
/**
|
|
174
|
+
* Today: the daily front page for the caller's network. World stories
|
|
175
|
+
* (set by the open web, ranked by outlet count) come first; Minds
|
|
176
|
+
* conversation stories follow. Requires `posts:read`.
|
|
177
|
+
*/
|
|
178
|
+
today(): Promise<CuratorTodayResponse>;
|
|
111
179
|
/**
|
|
112
180
|
* Fetch the supplied sources in parallel, annotate each top item with
|
|
113
181
|
* the supplied prompt template, and insert audience-scoped posts into
|
|
@@ -3,6 +3,14 @@ export class CuratorResource {
|
|
|
3
3
|
constructor(client) {
|
|
4
4
|
this.client = client;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Today: the daily front page for the caller's network. World stories
|
|
8
|
+
* (set by the open web, ranked by outlet count) come first; Minds
|
|
9
|
+
* conversation stories follow. Requires `posts:read`.
|
|
10
|
+
*/
|
|
11
|
+
today() {
|
|
12
|
+
return this.client.get('/curator/today');
|
|
13
|
+
}
|
|
6
14
|
/**
|
|
7
15
|
* Fetch the supplied sources in parallel, annotate each top item with
|
|
8
16
|
* the supplied prompt template, and insert audience-scoped posts into
|
|
@@ -82,7 +82,12 @@ export interface ProtocolQuarantinedCandidate {
|
|
|
82
82
|
provider: string;
|
|
83
83
|
/** Safe IDs are byte-exact; null means unsafe or malformed provenance was withheld. */
|
|
84
84
|
external_id: string | null;
|
|
85
|
-
state:
|
|
85
|
+
state: ProtocolCandidateState;
|
|
86
|
+
/** Increments whenever the payload digest changes; decisions and verdicts are keyed by it. */
|
|
87
|
+
revision: number;
|
|
88
|
+
revision_digest: string | null;
|
|
89
|
+
/** Latest screening verdict on the current revision, or null when unscreened. */
|
|
90
|
+
latest_verdict: ProtocolCandidateVerdictSummary | null;
|
|
86
91
|
title: string | null;
|
|
87
92
|
content: string;
|
|
88
93
|
content_format: 'plain';
|
|
@@ -99,9 +104,88 @@ export interface ProtocolQuarantinedCandidate {
|
|
|
99
104
|
observed_at: string;
|
|
100
105
|
created_at: string;
|
|
101
106
|
}
|
|
107
|
+
export type ProtocolCandidateState = 'quarantined' | 'approved' | 'rejected' | 'escalated' | 'tombstoned';
|
|
108
|
+
export type ProtocolScreeningVerdict = 'pass' | 'hold' | 'fail';
|
|
109
|
+
export type ProtocolCandidateDecision = 'approved' | 'rejected' | 'escalated';
|
|
110
|
+
export interface ProtocolCandidateVerdictSummary {
|
|
111
|
+
verdict: ProtocolScreeningVerdict;
|
|
112
|
+
line: string;
|
|
113
|
+
category: string | null;
|
|
114
|
+
high_risk: boolean;
|
|
115
|
+
reason: string | null;
|
|
116
|
+
created_at: string;
|
|
117
|
+
}
|
|
118
|
+
export interface ProtocolCandidateVerdict extends ProtocolCandidateVerdictSummary {
|
|
119
|
+
id: string;
|
|
120
|
+
revision: number;
|
|
121
|
+
model: string | null;
|
|
122
|
+
confidence: number | null;
|
|
123
|
+
}
|
|
124
|
+
export interface DecideProtocolCandidateInput {
|
|
125
|
+
decision: ProtocolCandidateDecision;
|
|
126
|
+
/** Required for escalation; recorded on every decision. */
|
|
127
|
+
reason?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface ProtocolCandidateDecisionResult {
|
|
130
|
+
candidate: ProtocolQuarantinedCandidate;
|
|
131
|
+
decision_id: string;
|
|
132
|
+
}
|
|
133
|
+
/** Operator view of the durable ingestion runtime for the authenticated app (goal ed3759f0 row 7). */
|
|
134
|
+
export interface ProtocolIngestionStatus {
|
|
135
|
+
/** Exactly one ingestion writer per process: the legacy collector or the runtime. */
|
|
136
|
+
mode: 'collector' | 'runtime';
|
|
137
|
+
enabled: boolean;
|
|
138
|
+
simulation: boolean;
|
|
139
|
+
/** Process-wide PROTOCOL_INGESTION_KILL_SWITCH. */
|
|
140
|
+
global_kill_switch: boolean;
|
|
141
|
+
controls_valid: boolean;
|
|
142
|
+
/** Whether this app's tuple is on the PROTOCOL_INGESTION_PROJECTS allow-list. */
|
|
143
|
+
project_allowed: boolean;
|
|
144
|
+
/** This app's operator kill switch (protocol_collection_setting.kill_switch). */
|
|
145
|
+
kill_switch: boolean;
|
|
146
|
+
jobs: {
|
|
147
|
+
queued: number;
|
|
148
|
+
leased: number;
|
|
149
|
+
done: number;
|
|
150
|
+
dead: number;
|
|
151
|
+
};
|
|
152
|
+
quotas: Array<{
|
|
153
|
+
provider_id: string;
|
|
154
|
+
window: 'run' | 'hour' | 'day';
|
|
155
|
+
killed: boolean;
|
|
156
|
+
circuit_open_until: string | null;
|
|
157
|
+
circuit_failures: number;
|
|
158
|
+
consumed: {
|
|
159
|
+
calls: number;
|
|
160
|
+
items: number;
|
|
161
|
+
bytes: number;
|
|
162
|
+
};
|
|
163
|
+
ceilings: {
|
|
164
|
+
calls: number | null;
|
|
165
|
+
items: number | null;
|
|
166
|
+
bytes: number | null;
|
|
167
|
+
};
|
|
168
|
+
}>;
|
|
169
|
+
lanes: Array<{
|
|
170
|
+
provider_id: string;
|
|
171
|
+
source_key: string;
|
|
172
|
+
source_subscription_key: string;
|
|
173
|
+
active: boolean;
|
|
174
|
+
}>;
|
|
175
|
+
}
|
|
176
|
+
export interface ReplayProtocolIngestionJobInput {
|
|
177
|
+
/** Operator note recorded on the audit row; 8 to 1024 characters. */
|
|
178
|
+
reason: string;
|
|
179
|
+
}
|
|
180
|
+
export interface ProtocolIngestionReplayResult {
|
|
181
|
+
job_id: string;
|
|
182
|
+
status: 'replayed';
|
|
183
|
+
}
|
|
102
184
|
/** App/network scope comes only from the authenticated project-bound key. */
|
|
103
185
|
export interface ListProtocolCandidatesParams {
|
|
104
186
|
protocol?: string;
|
|
187
|
+
/** Candidate state to list; the API defaults to quarantined. */
|
|
188
|
+
state?: ProtocolCandidateState;
|
|
105
189
|
/** Page size, default 20 and maximum 50; enforced by the API. */
|
|
106
190
|
limit?: number;
|
|
107
191
|
/** Opaque cursor from this endpoint's previous page; never an offset. */
|
|
@@ -464,7 +548,7 @@ export interface SocialNetwork {
|
|
|
464
548
|
url: string;
|
|
465
549
|
};
|
|
466
550
|
coverage: string;
|
|
467
|
-
capabilities: Array<'profile_search' | 'profile_read' | 'original_author_posts' | 'minds_subscription' | 'following_feed' | 'conversation_read' | 'public_trends' | 'trend_feed'>;
|
|
551
|
+
capabilities: Array<'profile_search' | 'profile_read' | 'original_author_posts' | 'minds_subscription' | 'following_feed' | 'conversation_read' | 'public_trends' | 'trend_feed' | 'popular_accounts'>;
|
|
468
552
|
profileSearchPagination: boolean;
|
|
469
553
|
conversationCoverage?: string;
|
|
470
554
|
}
|
|
@@ -565,6 +649,24 @@ export interface SocialTrendFeed extends SocialTrendProvenance {
|
|
|
565
649
|
items: SocialPost[];
|
|
566
650
|
cursor: string | null;
|
|
567
651
|
}
|
|
652
|
+
/** Provider-ranked accounts. `source` says whether this page is the app's hourly index snapshot or a live read. */
|
|
653
|
+
export interface SocialPopularProfiles {
|
|
654
|
+
items: SocialProfile[];
|
|
655
|
+
cursor: string | null;
|
|
656
|
+
provenance: {
|
|
657
|
+
provider: {
|
|
658
|
+
name: string;
|
|
659
|
+
url: string;
|
|
660
|
+
};
|
|
661
|
+
/** The provider's own ranking label, never a Minds popularity score. */
|
|
662
|
+
ranking: string;
|
|
663
|
+
fetchedAt: string;
|
|
664
|
+
coverage: 'provider_ranked_window';
|
|
665
|
+
source: 'index' | 'live';
|
|
666
|
+
/** Provider read time of the served snapshot; null for live reads. */
|
|
667
|
+
snapshotAt: string | null;
|
|
668
|
+
};
|
|
669
|
+
}
|
|
568
670
|
export interface SocialConversation {
|
|
569
671
|
focus: SocialPost;
|
|
570
672
|
/** Oldest available ancestor first, ending with the immediate parent. */
|
|
@@ -636,6 +738,12 @@ export declare class ProtocolsResource {
|
|
|
636
738
|
limit?: number;
|
|
637
739
|
cursor?: string;
|
|
638
740
|
}): Promise<SingleResponse<SocialTrendFeed>>;
|
|
741
|
+
/** Provider-ranked public accounts with explicit provenance; served from the app's index when a fresh snapshot exists. */
|
|
742
|
+
getPublicPopularProfiles(params: {
|
|
743
|
+
protocol: string;
|
|
744
|
+
limit?: number;
|
|
745
|
+
cursor?: string;
|
|
746
|
+
}): Promise<SingleResponse<SocialPopularProfiles>>;
|
|
639
747
|
/** Prepare one exact shared reply preview. Keep the mutation ID across uncertain responses. */
|
|
640
748
|
prepareNativeReply(input: NativeReplyPrepareInput): Promise<SingleResponse<NativeReplyBatch>>;
|
|
641
749
|
/** Send only explicitly approved delivery IDs from this preview. Repeated submissions reconcile; they do not replay a write. */
|
|
@@ -784,6 +892,41 @@ export declare class ProtocolsResource {
|
|
|
784
892
|
* unsupported deployed route) propagate; they are never an empty page.
|
|
785
893
|
*/
|
|
786
894
|
listCandidates(params?: ListProtocolCandidatesParams): Promise<ProtocolCandidateListResponse>;
|
|
895
|
+
/**
|
|
896
|
+
* Run fail-closed screening on a candidate's current revision. Requires the
|
|
897
|
+
* app's content_intelligence_admin binding (404 otherwise) and the same
|
|
898
|
+
* project-admin authorization as listCandidates. A failed or unconfigured
|
|
899
|
+
* classifier records hold, never pass.
|
|
900
|
+
*/
|
|
901
|
+
screenCandidate(id: string): Promise<SingleResponse<ProtocolQuarantinedCandidate>>;
|
|
902
|
+
/** Screening verdict history for a candidate, newest first. */
|
|
903
|
+
listCandidateVerdicts(id: string): Promise<SingleResponse<ProtocolCandidateVerdict[]>>;
|
|
904
|
+
/**
|
|
905
|
+
* Record a decision on the candidate's current revision. Approval needs a
|
|
906
|
+
* signed-in human project admin and a pass verdict on the current digest;
|
|
907
|
+
* an agent key may only reject or escalate; escalation needs a reason.
|
|
908
|
+
*/
|
|
909
|
+
decideCandidate(id: string, input: DecideProtocolCandidateInput): Promise<SingleResponse<ProtocolCandidateDecisionResult>>;
|
|
910
|
+
/**
|
|
911
|
+
* Read the ingestion runtime status for the key's app: mode, switches, job
|
|
912
|
+
* counts, quota ledger and lanes. Read-only. Requires the app's
|
|
913
|
+
* content_intelligence_admin binding (404 otherwise) and the same
|
|
914
|
+
* project-admin authorization as listCandidates.
|
|
915
|
+
*/
|
|
916
|
+
ingestionStatus(): Promise<SingleResponse<ProtocolIngestionStatus>>;
|
|
917
|
+
/** Turn the app's ingestion kill switch on: no reservation, screening or approval proceeds. */
|
|
918
|
+
killIngestion(): Promise<SingleResponse<{
|
|
919
|
+
kill_switch: true;
|
|
920
|
+
}>>;
|
|
921
|
+
/** Turn the app's ingestion kill switch off. Does not enable the runtime by itself. */
|
|
922
|
+
resumeIngestion(): Promise<SingleResponse<{
|
|
923
|
+
kill_switch: false;
|
|
924
|
+
}>>;
|
|
925
|
+
/**
|
|
926
|
+
* Requeue one dead ingestion job. Refused (409) while the runtime is
|
|
927
|
+
* disabled, simulating or killed; 404 when no dead job matches in this app.
|
|
928
|
+
*/
|
|
929
|
+
replayIngestionJob(jobId: string, input: ReplayProtocolIngestionJobInput): Promise<SingleResponse<ProtocolIngestionReplayResult>>;
|
|
787
930
|
/**
|
|
788
931
|
* Read one quarantined candidate under the same authorization as listCandidates.
|
|
789
932
|
* Empty and URL dot-segment IDs reject with ValidationError before any request;
|
|
@@ -96,6 +96,10 @@ export class ProtocolsResource {
|
|
|
96
96
|
getPublicTrendFeed(params) {
|
|
97
97
|
return this.client.get('/protocols/social/trend-feed', { protocol: params.protocol, topic: params.topic, limit: params.limit, cursor: params.cursor });
|
|
98
98
|
}
|
|
99
|
+
/** Provider-ranked public accounts with explicit provenance; served from the app's index when a fresh snapshot exists. */
|
|
100
|
+
getPublicPopularProfiles(params) {
|
|
101
|
+
return this.client.get('/protocols/social/popular-profiles', { protocol: params.protocol, limit: params.limit, cursor: params.cursor });
|
|
102
|
+
}
|
|
99
103
|
/** Prepare one exact shared reply preview. Keep the mutation ID across uncertain responses. */
|
|
100
104
|
prepareNativeReply(input) {
|
|
101
105
|
return this.client.post('/protocols/social/replies/prepare', { clientMutationId: input.clientMutationId, text: input.text,
|
|
@@ -282,24 +286,63 @@ export class ProtocolsResource {
|
|
|
282
286
|
listCandidates(params) {
|
|
283
287
|
return this.client.get('/protocols/candidates', params ? {
|
|
284
288
|
protocol: params.protocol,
|
|
289
|
+
state: params.state,
|
|
285
290
|
limit: params.limit,
|
|
286
291
|
cursor: params.cursor,
|
|
287
292
|
} : undefined);
|
|
288
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Run fail-closed screening on a candidate's current revision. Requires the
|
|
296
|
+
* app's content_intelligence_admin binding (404 otherwise) and the same
|
|
297
|
+
* project-admin authorization as listCandidates. A failed or unconfigured
|
|
298
|
+
* classifier records hold, never pass.
|
|
299
|
+
*/
|
|
300
|
+
async screenCandidate(id) {
|
|
301
|
+
return this.client.post(`/protocols/candidates/${encodeURIComponent(assertCandidateId(id))}/screen`, {});
|
|
302
|
+
}
|
|
303
|
+
/** Screening verdict history for a candidate, newest first. */
|
|
304
|
+
async listCandidateVerdicts(id) {
|
|
305
|
+
return this.client.get(`/protocols/candidates/${encodeURIComponent(assertCandidateId(id))}/verdicts`);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Record a decision on the candidate's current revision. Approval needs a
|
|
309
|
+
* signed-in human project admin and a pass verdict on the current digest;
|
|
310
|
+
* an agent key may only reject or escalate; escalation needs a reason.
|
|
311
|
+
*/
|
|
312
|
+
async decideCandidate(id, input) {
|
|
313
|
+
return this.client.post(`/protocols/candidates/${encodeURIComponent(assertCandidateId(id))}/decision`, input);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Read the ingestion runtime status for the key's app: mode, switches, job
|
|
317
|
+
* counts, quota ledger and lanes. Read-only. Requires the app's
|
|
318
|
+
* content_intelligence_admin binding (404 otherwise) and the same
|
|
319
|
+
* project-admin authorization as listCandidates.
|
|
320
|
+
*/
|
|
321
|
+
ingestionStatus() {
|
|
322
|
+
return this.client.get('/protocols/ingestion/status');
|
|
323
|
+
}
|
|
324
|
+
/** Turn the app's ingestion kill switch on: no reservation, screening or approval proceeds. */
|
|
325
|
+
killIngestion() {
|
|
326
|
+
return this.client.post('/protocols/ingestion/kill', {});
|
|
327
|
+
}
|
|
328
|
+
/** Turn the app's ingestion kill switch off. Does not enable the runtime by itself. */
|
|
329
|
+
resumeIngestion() {
|
|
330
|
+
return this.client.post('/protocols/ingestion/resume', {});
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Requeue one dead ingestion job. Refused (409) while the runtime is
|
|
334
|
+
* disabled, simulating or killed; 404 when no dead job matches in this app.
|
|
335
|
+
*/
|
|
336
|
+
async replayIngestionJob(jobId, input) {
|
|
337
|
+
return this.client.post(`/protocols/ingestion/replay/${encodeURIComponent(assertCandidateId(jobId))}`, input);
|
|
338
|
+
}
|
|
289
339
|
/**
|
|
290
340
|
* Read one quarantined candidate under the same authorization as listCandidates.
|
|
291
341
|
* Empty and URL dot-segment IDs reject with ValidationError before any request;
|
|
292
342
|
* all other IDs are encoded as one path segment and validated by the API.
|
|
293
343
|
*/
|
|
294
344
|
async getCandidate(id) {
|
|
295
|
-
|
|
296
|
-
throw new ValidationError({
|
|
297
|
-
type: 'validation_error',
|
|
298
|
-
code: 'invalid_candidate_id',
|
|
299
|
-
message: 'Candidate ID must be a non-empty identifier, not a URL dot segment.',
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
return this.client.get(`/protocols/candidates/${encodeURIComponent(id)}`);
|
|
345
|
+
return this.client.get(`/protocols/candidates/${encodeURIComponent(assertCandidateId(id))}`);
|
|
303
346
|
}
|
|
304
347
|
/** Cross-protocol full-text search */
|
|
305
348
|
search(params) {
|
|
@@ -318,3 +361,13 @@ export class ProtocolsResource {
|
|
|
318
361
|
return this.client.put('/protocols/settings', input);
|
|
319
362
|
}
|
|
320
363
|
}
|
|
364
|
+
function assertCandidateId(id) {
|
|
365
|
+
if (typeof id !== 'string' || !id.trim() || id === '.' || id === '..') {
|
|
366
|
+
throw new ValidationError({
|
|
367
|
+
type: 'validation_error',
|
|
368
|
+
code: 'invalid_candidate_id',
|
|
369
|
+
message: 'Candidate ID must be a non-empty identifier, not a URL dot segment.',
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
return id;
|
|
373
|
+
}
|