@geoly-ai/social-hub-sdk 0.1.5 → 0.1.7
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 +124 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +135 -2
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +128 -0
- package/dist/index.test.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1056,6 +1056,58 @@ export type UpsertFeishuIdentitiesResponse = {
|
|
|
1056
1056
|
* 四眼 registry proposal API 的结构化错误(D2):携带 HTTP status + 稳定 code + staleCode。
|
|
1057
1057
|
* apply 的 409 + code PROPOSAL_STALE → isStale=true(消费方据此重新提案,保留 staleCode)。
|
|
1058
1058
|
*/
|
|
1059
|
+
/**
|
|
1060
|
+
* `subreddit-candidates` 的候选耗尽诊断 —— 回答「`items` 为空到底是哪一类空」。
|
|
1061
|
+
*
|
|
1062
|
+
* ⛔ **这不是准入依据。** 它是诊断快照,可能因并发变更、查询上限或数据不完整而滞后。
|
|
1063
|
+
* 实际可执行性**只由**服务端硬闸、`items` 与 `allowedActions` 决定。
|
|
1064
|
+
* (`account_subreddit_affinities` 就曾差点被当成「可去板块」的依据 —— 别再踩一次。)
|
|
1065
|
+
*
|
|
1066
|
+
* 🔴 **`complete: false` 时任何 `all_*` 都不成立**,`reason` 会是 `resolution_incomplete`:
|
|
1067
|
+
* 源集合没被完整枚举时,「没查到」和「查了但都被拦掉」长得一样,而处置方式完全相反。
|
|
1068
|
+
*
|
|
1069
|
+
* 判「要不要惊动人」的最小用法:
|
|
1070
|
+
* · `all_comment_cooldown` —— 良性,近 24h 已在这些板评论过,**不要**告警;
|
|
1071
|
+
* · `all_action_not_permitted` —— 结构性(系统共享池不作评论目标),**不要**告警;
|
|
1072
|
+
* · `all_sanctioned` / `all_blocklisted` —— 被闸拦光,**要**人工换板;
|
|
1073
|
+
* · `pool_empty` / `persona_unavailable` —— 配置问题,**要**修数据;
|
|
1074
|
+
* · `resolution_incomplete` / `mixed_exhausted` —— 说不清,按要惊动人处理。
|
|
1075
|
+
*/
|
|
1076
|
+
export type SubredditCandidatesExhaustion = {
|
|
1077
|
+
reason: "not_exhausted" | "resolution_incomplete" | "pool_empty" | "persona_unavailable" | "all_blocklisted" | "all_sanctioned" | "all_tier_filtered" | "all_quota_truncated" | "all_affinity_blocked" | "all_comment_cooldown" | "all_action_not_permitted" | "all_limit_truncated" | "mixed_exhausted";
|
|
1078
|
+
complete: boolean;
|
|
1079
|
+
incompleteReasons: string[];
|
|
1080
|
+
eligibleBeforeFilters: number;
|
|
1081
|
+
returnedBoards: number;
|
|
1082
|
+
returned: number;
|
|
1083
|
+
/** 互斥且守恒:`Σ terminal + returnedBoards === eligibleBeforeFilters`。 */
|
|
1084
|
+
terminal: Record<string, number>;
|
|
1085
|
+
/** 各闸 raw 命中数,**允许重叠**,仅供排障 —— 不要用它选 reason。 */
|
|
1086
|
+
filtered: Record<string, number>;
|
|
1087
|
+
};
|
|
1088
|
+
export type SubredditPostAnnotationType = "style_fit" | "brand_friendliness";
|
|
1089
|
+
export type SubredditPostAnnotationSource = "llm" | "human";
|
|
1090
|
+
/** `subreddit-style-profiles` 的行视图;写操作要回传 `rowVersion` 作 If-Match。 */
|
|
1091
|
+
export type SubredditStyleProfileView = {
|
|
1092
|
+
id: string;
|
|
1093
|
+
status: "proposed" | "approved" | "retired";
|
|
1094
|
+
summary: string | null;
|
|
1095
|
+
proposedByUserId: string | null;
|
|
1096
|
+
/** If-Match 的值。状态每次合法迁移必变。 */
|
|
1097
|
+
rowVersion: string;
|
|
1098
|
+
[key: string]: unknown;
|
|
1099
|
+
};
|
|
1100
|
+
export type SubredditStyleProfileTransitionInput = {
|
|
1101
|
+
id: string;
|
|
1102
|
+
/** 来自 `getSubredditStyleProfile(id).profile.rowVersion`;**必传**,见方法说明。 */
|
|
1103
|
+
rowVersion: string;
|
|
1104
|
+
};
|
|
1105
|
+
/**
|
|
1106
|
+
* If-Match token 归一,**fail-closed**:只接受单个 strong token(可带成对引号)。
|
|
1107
|
+
* 拒 `W/` 弱 ETag、`*` 通配、多值(含逗号)、引号不成对 —— 非法形状本地即拒,
|
|
1108
|
+
* 不留给服务端猜。与 CLI 的 `normalizeRowVersionToken` 同一口径。
|
|
1109
|
+
*/
|
|
1110
|
+
export declare function normalizeStyleProfileRowVersion(raw: string | undefined): string | undefined;
|
|
1059
1111
|
export declare class RegistryProposalSdkError extends Error {
|
|
1060
1112
|
readonly status: number;
|
|
1061
1113
|
readonly code?: string;
|
|
@@ -2808,7 +2860,79 @@ export declare class SocialHubClient {
|
|
|
2808
2860
|
personaPools?: unknown;
|
|
2809
2861
|
systemPools?: unknown;
|
|
2810
2862
|
fallback?: unknown;
|
|
2863
|
+
exhaustion?: SubredditCandidatesExhaustion;
|
|
2811
2864
|
}>;
|
|
2865
|
+
listSubredditPostAnnotations(teamId: string, params?: {
|
|
2866
|
+
subreddit?: string;
|
|
2867
|
+
permalink?: string;
|
|
2868
|
+
annotationType?: SubredditPostAnnotationType;
|
|
2869
|
+
brandId?: string;
|
|
2870
|
+
source?: SubredditPostAnnotationSource;
|
|
2871
|
+
limit?: number;
|
|
2872
|
+
offset?: number;
|
|
2873
|
+
}): Promise<{
|
|
2874
|
+
items: unknown[];
|
|
2875
|
+
total?: number;
|
|
2876
|
+
}>;
|
|
2877
|
+
upsertSubredditPostAnnotation(teamId: string, body: Record<string, unknown>): Promise<unknown>;
|
|
2878
|
+
listSubredditStyleProfiles(params?: {
|
|
2879
|
+
subreddit?: string;
|
|
2880
|
+
scope?: string;
|
|
2881
|
+
brandId?: string;
|
|
2882
|
+
/** 逗号分隔多值,如 `proposed,approved`。 */
|
|
2883
|
+
status?: string;
|
|
2884
|
+
limit?: number;
|
|
2885
|
+
offset?: number;
|
|
2886
|
+
}): Promise<{
|
|
2887
|
+
items: unknown[];
|
|
2888
|
+
total?: number;
|
|
2889
|
+
}>;
|
|
2890
|
+
/** 响应里的 `profile.rowVersion` 就是写操作要回传的 If-Match 值。 */
|
|
2891
|
+
getSubredditStyleProfile(id: string): Promise<{
|
|
2892
|
+
profile: SubredditStyleProfileView;
|
|
2893
|
+
}>;
|
|
2894
|
+
getActiveSubredditStyleProfile(params: {
|
|
2895
|
+
subreddit: string;
|
|
2896
|
+
scope?: string;
|
|
2897
|
+
brandId?: string;
|
|
2898
|
+
}): Promise<unknown>;
|
|
2899
|
+
proposeSubredditStyleProfile(body: Record<string, unknown>): Promise<{
|
|
2900
|
+
profile: SubredditStyleProfileView;
|
|
2901
|
+
}>;
|
|
2902
|
+
/** 四眼审批 `proposed → approved`。提案人本人不可批(服务端 409 SELF_APPROVE)。 */
|
|
2903
|
+
approveSubredditStyleProfile(input: SubredditStyleProfileTransitionInput): Promise<{
|
|
2904
|
+
profile: SubredditStyleProfileView;
|
|
2905
|
+
}>;
|
|
2906
|
+
/** 审批人驳回 `proposed → retired`(`retire_reason=rejected:<reason>`)。 */
|
|
2907
|
+
rejectSubredditStyleProfile(input: SubredditStyleProfileTransitionInput & {
|
|
2908
|
+
reason: string;
|
|
2909
|
+
}): Promise<{
|
|
2910
|
+
profile: SubredditStyleProfileView;
|
|
2911
|
+
}>;
|
|
2912
|
+
/** 提案人本人撤回。worker/LLM 提案(proposedByUserId=NULL)不可 cancel,请用 reject。 */
|
|
2913
|
+
cancelSubredditStyleProfile(input: SubredditStyleProfileTransitionInput & {
|
|
2914
|
+
reason: string;
|
|
2915
|
+
}): Promise<{
|
|
2916
|
+
profile: SubredditStyleProfileView;
|
|
2917
|
+
}>;
|
|
2918
|
+
/** 停用已生效画像 `approved → retired`。 */
|
|
2919
|
+
retireSubredditStyleProfile(input: SubredditStyleProfileTransitionInput & {
|
|
2920
|
+
reason: string;
|
|
2921
|
+
}): Promise<{
|
|
2922
|
+
profile: SubredditStyleProfileView;
|
|
2923
|
+
}>;
|
|
2924
|
+
/**
|
|
2925
|
+
* 四个 transition 的共同形状。
|
|
2926
|
+
*
|
|
2927
|
+
* 🔴 **`rowVersion` 是必传的,SDK 刻意不提供「缺省自动 GET 当前值」那种便利。**
|
|
2928
|
+
* CLI 有这个便利(交互式使用,人就在现场),但库里自动 GET 会让一个**本意保护
|
|
2929
|
+
* 特定版本**的写悄悄作用到最新版本 —— 乐观锁就此被架空,而且失败时毫无痕迹。
|
|
2930
|
+
* 调用方要先 `getSubredditStyleProfile` 拿 `profile.rowVersion` 再传进来。
|
|
2931
|
+
*
|
|
2932
|
+
* 🔴 **409 PROFILE_STALE 一律原样抛出,绝不自动重取重试。** 自动重试等于替用户
|
|
2933
|
+
* 认可了他没看过的那一版内容。
|
|
2934
|
+
*/
|
|
2935
|
+
private styleProfileTransition;
|
|
2812
2936
|
listSettings(): Promise<{
|
|
2813
2937
|
items: Array<{
|
|
2814
2938
|
key: string;
|