@geoly-ai/social-hub-sdk 0.1.16 → 0.1.17

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 CHANGED
@@ -1,3 +1,5 @@
1
+ import type { ConfirmSubredditRestrictionInput, CreateSubredditRestrictionInput, ListSubredditRestrictionsParams, ListSubredditRestrictionsResponse, OpsBlockedJobAck, OpsBlockedReceipt, ReportSubredditRestrictionInput, ReportSubredditRestrictionResponse, RevokeSubredditRestrictionInput, SubredditRestriction, SubredditRestrictionCheckResult, SubredditRestrictionFanoutParams, SubredditRestrictionFanoutResponse } from "./subreddit-restrictions.js";
2
+ export * from "./subreddit-restrictions.js";
1
3
  /**
2
4
  * 「返回了不完整结果、但看起来像完整的」这一族缺陷的统一探针。
3
5
  *
@@ -267,6 +269,15 @@ export type AccountPoolsResponse = {
267
269
  personaPools?: unknown;
268
270
  systemPools?: unknown;
269
271
  fallback?: unknown;
272
+ /**
273
+ * 分页方案 B8b:本次生效的 limit / 返回条数 / 是否被截断(配额、limit 或单 key 行数上限)。
274
+ * 该端点没有 offset。配额 / limit 截断可调大 limit 或收窄 industry/tier;单 key 行数上限是
275
+ * 上游固定帽,调 limit 补不全,只能收窄 industry 或人工处理。
276
+ * 旧服务端不返回这三个字段。
277
+ */
278
+ selectionLimit?: number;
279
+ returned?: number;
280
+ truncated?: boolean;
270
281
  };
271
282
  export type DeviceCodeResponse = {
272
283
  device_code: string;
@@ -382,6 +393,113 @@ export type ContentReviewRequestInput = {
382
393
  /** 第几次送审;服务端强制上限 2(防重写循环)。 */
383
394
  attempt?: 1 | 2;
384
395
  traceId?: string;
396
+ } & ReviewScopeDeclaration;
397
+ /**
398
+ * ── Aporro Native Copy:四象限声明 / 逐稿 Card / acceptance 回执(手抄镜像)──
399
+ *
400
+ * 🔴 SDK **不能** re-export contracts(contracts 是 `private: true`,直接引用会生成
401
+ * 消费者装不上的 `.d.ts`),所以这组类型是手抄的,真源在
402
+ * `packages/contracts/src/review-scope.ts` 与 `knowledge-boundary.ts`。
403
+ * 手抄就会漂移 —— `index.test.ts` 里有对应的 `expectTypeOf` 编译期锁。
404
+ *
405
+ * 线上请求体一直是**原样透传**的(服务端 zod 校验);补这组类型之前,TS 调用方
406
+ * 传这几个字段会在编译期就被 SDK 自己的类型拦下 —— 能力在服务端,SDK 这层把门关上了。
407
+ */
408
+ export type ReviewAccountBinding = "account_bound" | "persona_less";
409
+ export type ReviewBrandTreatment = "managed_brand" | "organic";
410
+ export type ReviewScopeSource = "declared" | "legacy_derived";
411
+ export type ReviewBrandResolutionStatus = "resolved" | "none" | "unresolved";
412
+ export type ReviewAcceptanceProfile = "default" | "native_copy";
413
+ /** 调用方**声明**的象限(意图,不是事实)。 */
414
+ export type ReviewRequestedScope = {
415
+ accountBinding: ReviewAccountBinding;
416
+ brandTreatment: ReviewBrandTreatment;
417
+ };
418
+ /** 服务端解析后的权威象限 + 可用性事实。 */
419
+ export type ReviewResolvedScope = {
420
+ accountBinding: ReviewAccountBinding;
421
+ brandTreatment: ReviewBrandTreatment;
422
+ /** ⚠️ `legacy_derived` 不满足 Native Copy profile,也不满足发布 gate。 */
423
+ scopeSource: ReviewScopeSource;
424
+ /** `unresolved` 是覆盖态:声明 organic 却识别到已登记品牌 → 转人工,不豁免。 */
425
+ brandResolutionStatus: ReviewBrandResolutionStatus;
426
+ brandResolutionDetail: {
427
+ detectedBrandId: string | null;
428
+ detectedBrandKey: string | null;
429
+ reason: string;
430
+ resolverVersion: string;
431
+ } | null;
432
+ personaVoiceEvidenceAvailable: boolean;
433
+ knowledgeContextAvailable: boolean;
434
+ rulesEvidenceAvailable: boolean;
435
+ styleProfileAvailable: boolean;
436
+ };
437
+ /**
438
+ * 逐稿知识边界(Persona Card)。服务端内容寻址后固化,worker 发布前复审时完整恢复。
439
+ * ⚠️ 当前 **不影响 verdict**:`knowledge_boundary_consistency` 维度尚未激活
440
+ * (方案块 2a 口径下的 v5 原子提交),本字段现阶段只留痕、只决定 Gate 0 是否齐备。
441
+ */
442
+ export type KnowledgeBoundaryContextInput = {
443
+ schemaVersion: 1;
444
+ knowledgeAccess: "research" | "owned" | "used" | "observed" | "supplied_by_brand";
445
+ /** 最多 4 项。 */
446
+ permittedExperienceClaims: Array<"ownership" | "delivery" | "wear" | "service">;
447
+ postingWhy: string;
448
+ knows: string[];
449
+ doesNotKnow: string[];
450
+ attentionFocus?: string;
451
+ questionIntent?: string;
452
+ permittedFactVersionIds?: string[];
453
+ archetypeLabels?: string[];
454
+ };
455
+ export type KnowledgeContextRef = {
456
+ id: string;
457
+ hash: string;
458
+ schemaVersion: number;
459
+ };
460
+ /** 本次生效的 acceptance profile(可能被降级,原因在 downgradedReason)。 */
461
+ export type ResolvedAcceptanceProfile = {
462
+ profile: ReviewAcceptanceProfile;
463
+ policyVersion: string;
464
+ /** 非 null = 请求了 native_copy 但被降级(`legacy_derived_scope` / `incomplete_gate0`)。 */
465
+ downgradedReason: string | null;
466
+ };
467
+ export type ReviewProfileVerdictDetail = {
468
+ profile: ReviewAcceptanceProfile;
469
+ policyVersion: string;
470
+ verdict: "pass" | "revise" | "block" | "required_missing" | "not_applicable";
471
+ findings: Array<{
472
+ rule: string;
473
+ dimension: string | null;
474
+ threshold: number | null;
475
+ actual: number | null;
476
+ detail: string | null;
477
+ }>;
478
+ missingGateItems: string[];
479
+ };
480
+ /**
481
+ * 审核响应里的 Aporro 回执(帖/评共用)。全部可选:旧 pod / 旧 engine 下服务端会
482
+ * fail-closed **省略**它们,调用方应把「字段不在」读成「没有这项能力」,⛔ 不是「通过」。
483
+ */
484
+ export type ReviewScopeReceipt = {
485
+ resolvedScope?: ReviewResolvedScope;
486
+ capabilities?: string[];
487
+ knowledgeContextRef?: KnowledgeContextRef | null;
488
+ resolvedAcceptanceProfile?: ResolvedAcceptanceProfile;
489
+ profileVerdictDetail?: ReviewProfileVerdictDetail | null;
490
+ };
491
+ /** 审核请求里的 Aporro 声明字段(帖/评共用)。 */
492
+ export type ReviewScopeDeclaration = {
493
+ requestedScope?: ReviewRequestedScope;
494
+ /**
495
+ * ⚠️ 两类入口约束**不同**(Codex 块 5 P1 纠正了我原来写的「需同时声明」):
496
+ * - 同步 `postReview` / `contentReview`:三个字段各自可选,不要求成对;只传 Card
497
+ * 不传 requestedScope 时服务端照收,按 `legacy_derived` 象限审(不满足 native_copy)。
498
+ * - 异步 `createReviewTarget`:Card 与 requestedAcceptanceProfile **必须**伴随
499
+ * requestedScope,否则 400 —— 因为只有声明分支会被固化,不拦就是「接受后丢数据」。
500
+ */
501
+ knowledgeContext?: KnowledgeBoundaryContextInput;
502
+ requestedAcceptanceProfile?: ReviewAcceptanceProfile;
385
503
  };
386
504
  export type ContentReviewResponse = {
387
505
  reviewId: string;
@@ -406,7 +524,7 @@ export type ContentReviewResponse = {
406
524
  thresholdSnapshot: Record<string, unknown>;
407
525
  latencyMs: number;
408
526
  degradedReason: string | null;
409
- };
527
+ } & ReviewScopeReceipt;
410
528
  /** 审核目标状态(mirrors contracts REVIEW_TARGET_STATUSES;SDK 不 hard-dep contracts)。 */
411
529
  export type ReviewTargetStatusLike = "pending" | "running" | "passed" | "needs_revision" | "blocked" | "degraded" | "superseded";
412
530
  /**
@@ -459,10 +577,11 @@ export type CreateReviewTargetBody = {
459
577
  subject: {
460
578
  title?: string;
461
579
  body: string;
580
+ /** ⚠️ Gate 0 的版规证据读的是这里的 `subredditRules`(worker 重建请求也读这个位置)。 */
462
581
  threadContext?: Record<string, unknown>;
463
582
  subreddit?: string;
464
583
  };
465
- };
584
+ } & ReviewScopeDeclaration;
466
585
  export type CommentDraftStatusLike = "draft" | "scheduled" | "approved" | "archived" | "published";
467
586
  /**
468
587
  * 评论审核语境快照(mirrors contracts commentDraftThreadContextSchema;严格对象——
@@ -1071,6 +1190,24 @@ export type EnableSubredditMonitorBody = {
1071
1190
  watchlistId: string;
1072
1191
  fetchLimit?: number;
1073
1192
  };
1193
+ /**
1194
+ * 监听配置更新 body。
1195
+ *
1196
+ * 🔴 **没有 `enabled`,也不许加**:改配置绝不隐式改启停 —— 启停走
1197
+ * `enableSubredditMonitor`(启用)与 `disableSubredditMonitor`(软停)两个显式入口。
1198
+ * 🔴 **没有 `sort`**:DDL 的 CHECK 只允许 `'new'` 一个值,加了就是「改了就 400」的面。
1199
+ */
1200
+ export type UpdateSubredditMonitorConfigBody = {
1201
+ /**
1202
+ * 单页抓取条数上限,1–100(与 `EnableSubredditMonitorBody` 同一套边界)。
1203
+ *
1204
+ * 🔴 **必填,⛔ 不要写成可选。** 服务端 schema 要求「至少给一个可更新字段」,
1205
+ * 而当前可更新字段只有它一个 —— 声明成可选会让 `updateSubredditMonitorConfig(id, {})`
1206
+ * 通过类型检查、运行时必然 400。将来真的加了第二个可更新字段,再把这里
1207
+ * 改成「二选一」的联合类型。
1208
+ */
1209
+ fetchLimit: number;
1210
+ };
1074
1211
  export type ListHotPostsParams = {
1075
1212
  limit?: number;
1076
1213
  offset?: number;
@@ -2784,6 +2921,17 @@ export declare class SocialHubClient {
2784
2921
  * observation ledger 因此保留,重启后已报告过的帖子不会重复报告。
2785
2922
  */
2786
2923
  enableSubredditMonitor(body: EnableSubredditMonitorBody): Promise<SubredditMonitorConfig>;
2924
+ /**
2925
+ * **只改监听配置,⛔ 不碰启停。**
2926
+ *
2927
+ * 🔴 与 {@link SocialOpsHubClient.enableSubredditMonitor} 的区别就是全部要点:
2928
+ * 那个 `POST` 是 upsert,`DO UPDATE` 里写死 `enabled = true`,所以在一个**被软停**的
2929
+ * 监听上用它改 `fetchLimit` 会把监听静默重新启用。本方法背后的 SQL 里不出现
2930
+ * `enabled` 列,改完启停状态原样不动。
2931
+ *
2932
+ * ⚠️ **不 upsert**:该 watchlist 没配置过监听 -> 404(不会被悄悄创建成监听)。
2933
+ */
2934
+ updateSubredditMonitorConfig(watchlistId: string, body: UpdateSubredditMonitorConfigBody): Promise<SubredditMonitorConfig>;
2787
2935
  /**
2788
2936
  * 停止监听:DELETE 语义但服务端做**软停**(enabled=false),不删 observation ledger。
2789
2937
  * 幂等 —— 本来就没在监听时返回 `{ ok: true, updated: false }`,不是 404。
@@ -3276,6 +3424,9 @@ export declare class SocialHubClient {
3276
3424
  calendarEntryId?: string;
3277
3425
  redditPostSnapshotId?: string;
3278
3426
  payload?: Record<string, unknown>;
3427
+ /** execution fencing token pair(认领时拿到的;两者须同时给出或同时省略)。 */
3428
+ executionGeneration?: number;
3429
+ executionId?: string;
3279
3430
  }): Promise<{
3280
3431
  ok: boolean;
3281
3432
  jobId: string;
@@ -3284,33 +3435,39 @@ export declare class SocialHubClient {
3284
3435
  alreadyCompleted?: boolean;
3285
3436
  trace: Record<string, unknown>;
3286
3437
  updated: Record<string, unknown>;
3287
- }>;
3438
+ } | OpsBlockedReceipt>;
3288
3439
  opsFail(teamId: string, body: {
3289
3440
  agentId: string;
3290
3441
  jobId: string;
3291
3442
  reason: string;
3292
3443
  message?: string;
3293
3444
  payload?: Record<string, unknown>;
3445
+ /** execution fencing token pair(认领时拿到的;两者须同时给出或同时省略)。 */
3446
+ executionGeneration?: number;
3447
+ executionId?: string;
3294
3448
  }): Promise<{
3295
3449
  ok: boolean;
3296
3450
  jobId: string;
3297
3451
  status: string;
3298
3452
  /** True when the job was already in this terminal — idempotent retry. */
3299
3453
  alreadyTerminal?: boolean;
3300
- }>;
3454
+ } | OpsBlockedJobAck>;
3301
3455
  opsSkip(teamId: string, body: {
3302
3456
  agentId: string;
3303
3457
  jobId: string;
3304
3458
  reason: string;
3305
3459
  message?: string;
3306
3460
  payload?: Record<string, unknown>;
3461
+ /** execution fencing token pair(认领时拿到的;两者须同时给出或同时省略)。 */
3462
+ executionGeneration?: number;
3463
+ executionId?: string;
3307
3464
  }): Promise<{
3308
3465
  ok: boolean;
3309
3466
  jobId: string;
3310
3467
  status: string;
3311
3468
  /** True when the job was already in this terminal — idempotent retry. */
3312
3469
  alreadyTerminal?: boolean;
3313
- }>;
3470
+ } | OpsBlockedJobAck>;
3314
3471
  /**
3315
3472
  * 评论内容复审:独立 LLM 六维评审+服务端权威计分。
3316
3473
  * executionStatus=degraded 时 verdict 不可作为权威判定,调用方应降级本地自审。
@@ -3342,7 +3499,7 @@ export declare class SocialHubClient {
3342
3499
  thresholdSnapshot: Record<string, unknown>;
3343
3500
  latencyMs: number;
3344
3501
  degradedReason: string | null;
3345
- }>;
3502
+ } & ReviewScopeReceipt>;
3346
3503
  /** 互动时序 P2:批量调度上下文(team 级,best_effort 一致性,keyset 分页)。 */
3347
3504
  getInteractionScheduleContext(teamId: string, params?: {
3348
3505
  limit?: number;
@@ -3373,6 +3530,16 @@ export declare class SocialHubClient {
3373
3530
  systemPools?: unknown;
3374
3531
  fallback?: unknown;
3375
3532
  exhaustion?: SubredditCandidatesExhaustion;
3533
+ /**
3534
+ * 分页方案 B8b:本次生效的 limit / 返回条数 / 是否被截断(配额、limit 或单 key 行数上限)。
3535
+ * 该端点没有 offset。配额 / limit 截断可调大 limit 或收窄 industry/tier;单 key 行数上限是
3536
+ * 上游固定帽,调 limit 补不全,只能收窄 industry 或人工处理。评论动作下配额阶段尚未过冷却 /
3537
+ * affinity,`truncated: true` 可能偏多报;`false` 是精确的「没被截」。
3538
+ * 旧服务端不返回这三个字段。
3539
+ */
3540
+ selectionLimit?: number;
3541
+ returned?: number;
3542
+ truncated?: boolean;
3376
3543
  }>;
3377
3544
  listSubredditPostAnnotations(teamId: string, params?: {
3378
3545
  subreddit?: string;
@@ -3896,7 +4063,20 @@ export declare class SocialHubClient {
3896
4063
  }): Promise<{
3897
4064
  purpose: string;
3898
4065
  activeSpecId: string | null;
4066
+ /**
4067
+ * ⚠️ 本页条数,**不是总数**。保留仅为兼容,与 `returned` 恒相等;新代码读 `returned`。
4068
+ * @deprecated 用 `returned`。
4069
+ */
3899
4070
  count: number;
4071
+ /** 本页实际返回的条数。 */
4072
+ returned: number;
4073
+ /** 本次生效的条数上限(请求的 limit,缺省 20)。 */
4074
+ selectionLimit: number;
4075
+ /**
4076
+ * 是否还有更多未返回的 run(服务端多取一条哨兵判定,精确)。
4077
+ * 这是 recent 投影,**没有分页** —— 为 true 时请调大 limit 或改用精确查询,⛔ 不要自拼 offset。
4078
+ */
4079
+ truncated: boolean;
3900
4080
  runs: unknown[];
3901
4081
  }>;
3902
4082
  /**
@@ -4373,6 +4553,40 @@ export declare class SocialHubClient {
4373
4553
  availability: string;
4374
4554
  availabilityCheckedAt: string;
4375
4555
  }>;
4556
+ /** GET /v1/system/subreddit-restrictions — 列表(state 多值、updatedSince 增量拉取)。 */
4557
+ listSubredditRestrictions(params?: ListSubredditRestrictionsParams): Promise<ListSubredditRestrictionsResponse>;
4558
+ /** GET /v1/system/subreddit-restrictions/:id — 单条(含全量 evidence)。 */
4559
+ getSubredditRestriction(id: string): Promise<SubredditRestriction>;
4560
+ /** POST /v1/system/subreddit-restrictions — 新建(已有活跃限制 → 409 RESTRICTION_EXISTS)。 */
4561
+ createSubredditRestriction(body: CreateSubredditRestrictionInput): Promise<SubredditRestriction>;
4562
+ /** POST .../:id/confirm — provisional / verification_overdue → confirmed(409 VERSION_MISMATCH / INVALID_STATE)。 */
4563
+ confirmSubredditRestriction(id: string, body?: ConfirmSubredditRestrictionInput): Promise<SubredditRestriction>;
4564
+ /** POST .../:id/revoke — 解封(唯一的解封路径)。 */
4565
+ revokeSubredditRestriction(id: string, body: RevokeSubredditRestrictionInput): Promise<SubredditRestriction>;
4566
+ /** GET .../:id/fanout — 扇出汇总 + 回执明细(阶段 B 之前为空、complete=false)。 */
4567
+ getSubredditRestrictionFanout(id: string, params?: SubredditRestrictionFanoutParams): Promise<SubredditRestrictionFanoutResponse>;
4568
+ /**
4569
+ * GET /v1/teams/:teamId/subreddit-restrictions — team 级只读列表(`compliance:read`,manager 可用)。
4570
+ * 过滤参数与系统级 list 相同,只回证据摘要。运营侧 agent 拉取状态走这个,不走系统级 admin 面。
4571
+ */
4572
+ listTeamSubredditRestrictions(teamId: string, params?: ListSubredditRestrictionsParams): Promise<ListSubredditRestrictionsResponse>;
4573
+ /**
4574
+ * GET /v1/teams/:teamId/subreddit-restrictions/:id/fanout — 只统计、只返回**本 team** 的回执;
4575
+ * outbox 的 summary / lastError 为 null(跨 team 信息)。complete 仍按全局 outbox 判断。
4576
+ */
4577
+ getTeamSubredditRestrictionFanout(teamId: string, id: string, params?: Omit<SubredditRestrictionFanoutParams, "teamId">): Promise<SubredditRestrictionFanoutResponse>;
4578
+ /** POST /v1/teams/:teamId/subreddit-restrictions/report — runner 上报(只写 provisional 或 sanction)。 */
4579
+ reportSubredditRestriction(teamId: string, body: ReportSubredditRestrictionInput): Promise<ReportSubredditRestrictionResponse>;
4580
+ /**
4581
+ * GET /v1/teams/:teamId/subreddit-restrictions/check — runner 动手前自查。
4582
+ * 账号可以用 `socialAccountId`(与 contracts 同名)或 `account`(CLI flag 同名)给;两者都给且不同
4583
+ * → 直接抛错,绝不静默丢掉其中一个 —— 丢了账号就只判系统级,会得到假的 `allowed:true`。
4584
+ */
4585
+ checkSubredditRestriction(teamId: string, params: {
4586
+ subreddit: string;
4587
+ socialAccountId?: string;
4588
+ account?: string;
4589
+ }): Promise<SubredditRestrictionCheckResult>;
4376
4590
  }
4377
4591
  export type NotificationSubscriptionStatus = "active" | "paused"
4378
4592
  /** 游标落后于保留 floor,已无法保证不漏;需人工确认后 reset。 */
@@ -4978,5 +5192,4 @@ export type CalendarEntryStatus = "draft" | "scheduled" | "exported" | "running"
4978
5192
  export type ReviewTargetStatus = "pending" | "running" | "passed" | "needs_revision" | "blocked" | "degraded" | "superseded";
4979
5193
  /** 契约 `reviewGateStateSchema` 的镜像(日历条目上的审核门投影)。 */
4980
5194
  export type ReviewGateState = "passed" | "waiting" | "revision_required" | "blocked" | "stale" | "untracked";
4981
- export {};
4982
5195
  //# sourceMappingURL=index.d.ts.map