dsh-shiori 0.2.0 → 0.3.0

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.
@@ -18,7 +18,10 @@
18
18
  // - 候选队列持久快照跨重启恢复(queueStore);plan 账不可变(planStore)。
19
19
 
20
20
  import { analyzeCandidates } from "../organize/analyze.mjs";
21
- import { createCandidateQueue, buildDraft as buildOrganizeDraft, buildForgetArchiveDiff } from "../organize/queue.mjs";
21
+ import {
22
+ createCandidateQueue, buildDraft as buildOrganizeDraft, buildArchiveTopicPlan,
23
+ buildForgetArchiveDiff, listQueue,
24
+ } from "../organize/queue.mjs";
22
25
  import { digestPlan as organizeDigestPlan, createOrganizerExecutor } from "../organize/executor.mjs";
23
26
  import { analyzeForgetting } from "../forgetting/decay.mjs";
24
27
  import { createForgetExecutor } from "../forgetting/executor.mjs";
@@ -183,13 +186,41 @@ export function createManagement(deps) {
183
186
  return timelineReader;
184
187
  }
185
188
 
186
- async function queueDto(scopeId, queue) {
189
+ /**
190
+ * planStore.list 投影 → wire 形状(P2-B3):store kind "archive-topic" 是
191
+ * 归档计划的独立落库 kind,wire(protocol.mjs planSummary,additionalProperties
192
+ * :false 的闭形状,kind enum 只有 organize/forgetting)不认识新 store kind——
193
+ * 仅映射家族名 kind:"organize",不补任何 schema 外字段(proposalKind 只存在于
194
+ * previewPlan 的 planView 形状,plans 列表客户端只读 planId/executed/superseded
195
+ * /summary,加了也不读,反而造成协议面与实现不一致)。
196
+ *
197
+ * 旧条目识别:升级前归档计划以 kind:"organize" + plan.kind:"archive-topic"
198
+ * 落库,但 planStore.list 投影不含 plan.kind(且 list 有 listCandidates /
199
+ * forgetting analyze / queueDto 三条 wire 路径,不宜为它扩投影)——按 store
200
+ * kind 判定:旧条目 store kind 本就是 "organize",映射后形状不变,与本次
201
+ * 新落库计划在 wire 上同为 organize 家族行。
202
+ */
203
+ function plansToWire(plans) {
204
+ return plans.map((p) => p.kind === "archive-topic"
205
+ ? { ...p, kind: "organize" }
206
+ : p);
207
+ }
208
+
209
+ /**
210
+ * 队列 DTO:items 经 organize/queue.mjs 的 listQueue 投影——候选 sources 补
211
+ * 卡片 title(取不到给 null),其余字段原样(只增不改)。records 缺省时
212
+ * 不投影(保持旧形状,供无需标题的内部路径复用)。
213
+ */
214
+ async function queueDto(scopeId, queue, records) {
187
215
  const snapshot = queue.snapshot();
188
216
  const plans = await state.planStore.list(scopeId);
217
+ const items = records === undefined
218
+ ? snapshot.items
219
+ : listQueue({ items: snapshot.items, records }).items;
189
220
  return {
190
221
  queueRevision: snapshot.revision,
191
- items: snapshot.items,
192
- plans,
222
+ items,
223
+ plans: plansToWire(plans),
193
224
  };
194
225
  }
195
226
 
@@ -395,13 +426,34 @@ export function createManagement(deps) {
395
426
  return executeToolForScope(scope, payload.name, payload.args ?? {});
396
427
  },
397
428
 
398
- /** 候选队列与计划摘要(同 scope;不泄露别卡)。 */
429
+ /**
430
+ * 候选队列与计划摘要(同 scope;不泄露别卡)。可选 limit / offset 分页
431
+ * (缺省不分页,行为与旧版完全一致);候选项 sources 补卡片 title、
432
+ * 条目补 stale(源 revision 与 records 不一致 / 源卡不在 records 即过期)、
433
+ * 顶层补 total / groups / statusCounts / staleCount(计数不受分页影响,
434
+ * staleCount 为分页前全量口径),客户端一次请求即可渲染分组与标题,
435
+ * 无需二次取卡比对。投影走 organize/queue.mjs 的 listQueue(纯只读),
436
+ * 不改变队列状态。
437
+ */
399
438
  async listCandidates(trustedContext, payload) {
400
- validateManagementPayload("listCandidates", payload ?? {});
439
+ const p = payload ?? {};
440
+ validateManagementPayload("listCandidates", p);
401
441
  requireActiveDataAccess("listCandidates");
402
442
  const scope = await scopeFromTrustedContext(trustedContext);
443
+ const resources = await resourcesFor(scope.scopeId, sessionEvidenceFromRpc(trustedContext).agent);
444
+ const records = await resources.sparkStore.listActive();
403
445
  const queue = await loadQueue(scope.scopeId);
404
- return queueDto(scope.scopeId, queue);
446
+ const snapshot = queue.snapshot();
447
+ const page = listQueue({ items: snapshot.items, records, limit: p.limit, offset: p.offset });
448
+ return {
449
+ queueRevision: snapshot.revision,
450
+ items: page.items,
451
+ plans: plansToWire(await state.planStore.list(scope.scopeId)),
452
+ total: page.total,
453
+ groups: page.groups,
454
+ statusCounts: page.statusCounts,
455
+ staleCount: page.staleCount,
456
+ };
405
457
  },
406
458
 
407
459
  /**
@@ -445,7 +497,8 @@ export function createManagement(deps) {
445
497
  }
446
498
  }
447
499
  const queue = await loadQueue(scope.scopeId);
448
- const dto = await queueDto(scope.scopeId, queue);
500
+ const replayRecords = await resources.sparkStore.listActive();
501
+ const dto = await queueDto(scope.scopeId, queue, replayRecords);
449
502
  return { ...dto, analysis: prior.analysis };
450
503
  }
451
504
 
@@ -498,7 +551,7 @@ export function createManagement(deps) {
498
551
  keepPlanId: null,
499
552
  operationId: payload.operationId,
500
553
  });
501
- const dto = await queueDto(scope.scopeId, queue);
554
+ const dto = await queueDto(scope.scopeId, queue, records);
502
555
  return { ...dto, analysis };
503
556
  }
504
557
 
@@ -552,13 +605,12 @@ export function createManagement(deps) {
552
605
  keepPlanId: planId,
553
606
  operationId: payload.operationId,
554
607
  });
555
- const plans = await state.planStore.list(scope.scopeId);
556
608
  const queue = await loadQueue(scope.scopeId);
557
- const dto = await queueDto(scope.scopeId, queue);
609
+ const dto = await queueDto(scope.scopeId, queue, records);
558
610
  return {
559
611
  queueRevision: dto.queueRevision,
560
612
  items: dto.items,
561
- plans,
613
+ plans: plansToWire(await state.planStore.list(scope.scopeId)),
562
614
  analysis: analysisView,
563
615
  };
564
616
  },
@@ -571,6 +623,8 @@ export function createManagement(deps) {
571
623
  assertHostWritable("reviewCandidate");
572
624
  requireModule("organize");
573
625
  const scope = await scopeFromTrustedContext(trustedContext);
626
+ const resources = await resourcesFor(scope.scopeId, sessionEvidenceFromRpc(trustedContext).agent);
627
+ const records = await resources.sparkStore.listActive();
574
628
  const queue = await loadQueue(scope.scopeId);
575
629
  queue.review(payload.candidateId, {
576
630
  decision: payload.decision,
@@ -578,10 +632,10 @@ export function createManagement(deps) {
578
632
  operationId: payload.operationId,
579
633
  });
580
634
  await state.queueStore.save(scope.scopeId, queue.snapshot());
581
- return queueDto(scope.scopeId, queue);
635
+ return queueDto(scope.scopeId, queue, records);
582
636
  },
583
637
 
584
- /** 计划预览:organize proposal 走 buildDraft;forgetting 用 planId 取回 analyze 保存的计划。 */
638
+ /** 计划预览:organize proposal 走 buildDraft;forgetting 用 planId 取回 analyze 保存的计划;archive-topic 由 service fresh topic 现建归档/恢复计划。 */
585
639
  async previewPlan(trustedContext, payload) {
586
640
  validateManagementPayload("previewPlan", payload);
587
641
  requireActiveDataAccess("previewPlan");
@@ -613,6 +667,69 @@ export function createManagement(deps) {
613
667
  };
614
668
  }
615
669
 
670
+ if (payload.kind === "archive-topic") {
671
+ // 0.2.2 专题归档/恢复:不依赖候选队列(candidateId 是确定性别名,
672
+ // 不在队列里),直接从 service 读 fresh topic 构建计划,走既有
673
+ // previewPlan → executePlan 通道(P2-B3 起独立落库 kind:"archive-topic",
674
+ // executePlan 与 organize 一样走 organizer executor,由其按 plan.kind
675
+ // 分派),不另开写接口。
676
+ requireModule("organize");
677
+ const resources = await resourcesFor(scope.scopeId, sessionEvidenceFromRpc(trustedContext).agent);
678
+ const fresh = await resources.service.readTopic(payload.topicKey);
679
+ if (fresh.scopeId !== scope.scopeId) {
680
+ fail("INVALID_STATE", `topic "${payload.topicKey}" belongs to scope "${fresh.scopeId}", not "${scope.scopeId}"`, {
681
+ topicKey: payload.topicKey,
682
+ topicScopeId: fresh.scopeId,
683
+ scopeId: scope.scopeId,
684
+ });
685
+ }
686
+ const currentArchivedAt = fresh.archivedAt ?? null;
687
+ if ((payload.archive && currentArchivedAt !== null) || (!payload.archive && currentArchivedAt === null)) {
688
+ fail("INVALID_INPUT", `topic "${payload.topicKey}" is already in the target archive state`, {
689
+ topicKey: payload.topicKey,
690
+ archive: payload.archive,
691
+ currentArchivedAt,
692
+ });
693
+ }
694
+ const target = payload.archive ? nowIso() : null;
695
+ const built = buildArchiveTopicPlan({
696
+ scopeId: scope.scopeId,
697
+ key: payload.topicKey,
698
+ expectedRevision: fresh.revision,
699
+ archivedAt: target,
700
+ currentArchivedAt,
701
+ });
702
+ const planId = `op-${built.digest}`;
703
+ await state.planStore.save(scope.scopeId, planId, {
704
+ kind: "archive-topic",
705
+ planDigest: built.digest,
706
+ queueRevision: null,
707
+ plan: built.plan,
708
+ diff: built.diff,
709
+ changedItems: built.changedItems,
710
+ summary: "archive-topic plan over 1 topic",
711
+ });
712
+ // P-A:计划收敛——独立计划族(P2-B3):只作废其它仍 open 的归档计划
713
+ // (含升级前以 kind:"organize" 落库的旧归档条目),不动整理预览。
714
+ // payload.operationId 可选(schema required 三键),缺省落
715
+ // null:supersededWith !== undefined 的 executePlan 硬闸仍生效。
716
+ await state.planStore.supersedeOpen(scope.scopeId, {
717
+ kind: "archive-topic",
718
+ keepPlanId: planId,
719
+ operationId: payload.operationId ?? null,
720
+ });
721
+ return {
722
+ planId,
723
+ kind: "organize",
724
+ proposalKind: "archive-topic",
725
+ planDigest: built.digest,
726
+ queueRevision: null,
727
+ diff: built.diff,
728
+ changedItems: built.changedItems,
729
+ summary: "archive-topic plan over 1 topic",
730
+ };
731
+ }
732
+
616
733
  requireModule("organize");
617
734
  const resources = await resourcesFor(scope.scopeId, sessionEvidenceFromRpc(trustedContext).agent);
618
735
  const queue = await loadQueue(scope.scopeId);
@@ -650,6 +767,7 @@ export function createManagement(deps) {
650
767
  return {
651
768
  planId,
652
769
  kind: "organize",
770
+ proposalKind: built.plan.kind,
653
771
  planDigest: built.digest,
654
772
  queueRevision: snapshot.revision,
655
773
  diff: built.diff,
@@ -726,7 +844,9 @@ export function createManagement(deps) {
726
844
  const resources = await resourcesFor(scope.scopeId, sessionEvidenceFromRpc(trustedContext).agent);
727
845
  let result;
728
846
  try {
729
- if (entry.kind === "organize") {
847
+ // P2-B3:archive-topic 独立计划族后,organize 与 archive-topic 两种
848
+ // store kind 都走 organizer executor(执行器按 plan.kind 分派具体动作)。
849
+ if (entry.kind === "organize" || entry.kind === "archive-topic") {
730
850
  requireModule("organize");
731
851
  const executor = await createOrganizerExecutor({
732
852
  root: dataRoot,
@@ -767,25 +887,48 @@ export function createManagement(deps) {
767
887
  fail("AUTHORIZATION_REQUIRED", "executePlan cancelled before execution was recorded", { planId: payload.planId });
768
888
  }
769
889
  await state.planStore.markExecuted(scope.scopeId, payload.planId, payload.operationId);
770
- // P-A:执行后立即收敛队列——移除引用「已不再是 active」源卡的候选
771
- // (merge 退休 / forgetting 归档后,面板不再把失效条目画成可审阅;
772
- // link 计划源卡仍 active,不动队列)。确定性/重放安全:移除集合由
773
- // 「队列项 ∩ 非 active 源卡」决定;重放同 operationId 时首轮已移除、
774
- // 幸存集合不变 → 不动队列、不记队列事务。队列 operationId 复用本次
775
- // 执行 operationId(面板各操作生成唯一 operationId)。
890
+ // P-A:执行后立即收敛队列——移除两类候选:
891
+ // 1) 引用「已不再是 active」源卡的候选(merge 退休 / forgetting 归档后,
892
+ // 面板不再把失效条目画成可审阅);
893
+ // 2) 本次执行的候选本身(organize plan.candidateId 指向的那条):它已
894
+ // 被执行完毕,留在队列里只会让用户再点一个注定 REVISION_CONFLICT
895
+ // 的按钮(link 计划源卡仍 active,旧逻辑因此漏掉它)。收敛/保存后
896
+ // queueRevision 前进,客户端 load() 刷新即拿不到旧候选。
897
+ // forgetting 计划(archive-ephemeral)没有 candidateId → executedCandidateId
898
+ // 为 null,此时行为与只按 active 过滤完全一致。
899
+ // 确定性/重放安全:移除集合由「队列项 ∩ (非 active 源卡 ∪ 已执行候选)」
900
+ // 决定;重放同 operationId 时首轮已移除、幸存集合不变 → 不动队列、不记
901
+ // 队列事务。队列 operationId 复用本次执行 operationId(面板各操作生成
902
+ // 唯一 operationId)。
776
903
  // P-A 残留收紧:收敛/保存抛错时 grant 也必须撤销(merge 已落盘但
777
904
  // 调用报错——grant 泄漏会放大授权窗口),finally 保证两条路径都撤销。
905
+ // B1(audit B P2-1):markExecuted 已落账、执行结果已定,收敛阶段再抛
906
+ // 错不得翻转回执——把成功伪装成失败会让客户端拿不到执行回执,且重试
907
+ // 恒撞「already executed」硬闸(幂等判据:planStore.executed 标志先于
908
+ // 收敛落账,同 planId 重试必被上方 executed 硬闸拒绝,不会二次执行)。
909
+ // 收敛失败降级为回执内 queueConvergence.applied=false + 可读告警;残留
910
+ // 失效候选由下一次 organize analyze 的收敛清理,队列正确性不受损
911
+ // (失效候选只会导致一次注定 REVISION_CONFLICT 的执行,无数据风险)。
912
+ const executedCandidateId = typeof entry.plan?.candidateId === "string" ? entry.plan.candidateId : null;
913
+ let queueConvergence = { applied: true };
778
914
  try {
779
915
  const queue = await loadQueue(scope.scopeId);
780
916
  const snapshot = queue.snapshot();
781
917
  const activeIds = new Set((await resources.sparkStore.listActive()).map((r) => r.id));
782
918
  const survivors = snapshot.items
919
+ .filter((it) => executedCandidateId === null || it.candidate.id !== executedCandidateId)
783
920
  .filter((it) => it.candidate.sources.every((s) => activeIds.has(s.id)))
784
921
  .map((it) => it.candidate);
785
922
  if (survivors.length !== snapshot.items.length) {
786
923
  queue.converge(survivors, { operationId: payload.operationId, expectedRevision: snapshot.revision });
787
924
  await state.queueStore.save(scope.scopeId, queue.snapshot());
788
925
  }
926
+ } catch (error) {
927
+ const reason = error instanceof Error ? error.message : String(error);
928
+ queueConvergence = {
929
+ applied: false,
930
+ warning: `计划已执行,但执行后的队列收敛失败(失效候选留待下次 analyze 清理):${reason}`,
931
+ };
789
932
  } finally {
790
933
  grant.revoke();
791
934
  }
@@ -794,6 +937,7 @@ export function createManagement(deps) {
794
937
  planDigest: payload.planDigest,
795
938
  operationId: payload.operationId,
796
939
  result,
940
+ queueConvergence,
797
941
  };
798
942
  },
799
943
 
@@ -9,7 +9,7 @@
9
9
  // 规则:
10
10
  // - queueRevision 为非负整数;operationId 沿现校验(1..128 可见 ASCII);
11
11
  // planId 不透明稳定字符串;planDigest 小写 64 hex;
12
- // - organize proposal 严格沿用 buildDraft 形状;thin-core 明确 UNSUPPORTED;
12
+ // - organize proposal 严格沿用 buildDraft 形状(link / merge-topic 两种 kind);
13
13
  // - 所有顶层 payload 闭合拒绝未知键;
14
14
  // - Error.code 词表:INVALID_INPUT / NOT_CONFIGURED / UNSUPPORTED /
15
15
  // UNAUTHORIZED / NOT_FOUND / REVISION_CONFLICT / BUDGET_EXCEEDED。
@@ -100,6 +100,10 @@ const planView = {
100
100
  properties: {
101
101
  planId,
102
102
  kind: { enum: ["organize", "forgetting"] },
103
+ // 真实计划类型(link / merge-topic / archive-topic):kind 恒为
104
+ // 家族名(organize / forgetting),客户端文案按 proposalKind 出。可选字段,
105
+ // 老服务端与 forgetting 预览不带。
106
+ proposalKind: { enum: ["link", "merge-topic", "archive-topic"] },
103
107
  planDigest,
104
108
  queueRevision: { oneOf: [queueRevision, { type: "null" }] },
105
109
  diff: { type: "array", items: diffEntry },
@@ -132,9 +136,13 @@ const organizeProposal = {
132
136
  additionalProperties: false,
133
137
  properties: {
134
138
  target: nonEmptyString,
135
- rel: { oneOf: [{ type: "string" }, { type: "null" }] },
139
+ // B2(audit B P2-2):与 buildDraft 同口径(queue.mjs
140
+ // assertExactKeys(pair, ['target','rel']) + checkText rel
141
+ // 1..CARD_LIMITS.relChars=64)——rel 缺省/null/超限在 wire
142
+ // 层即拒(INVALID_INPUT),不再放行草案层必拒的形状。
143
+ rel: { type: "string", minLength: 1, maxLength: 64 },
136
144
  },
137
- required: ["target"],
145
+ required: ["target", "rel"],
138
146
  },
139
147
  },
140
148
  },
@@ -154,7 +162,10 @@ const organizeProposal = {
154
162
  additionalProperties: false,
155
163
  properties: {
156
164
  key: nonEmptyString,
157
- expectedRevision: { oneOf: [{ type: "string" }, { type: "null" }] },
165
+ // B2(audit B P2-2):与 buildDraft 的 validatePlanTopic 同口径
166
+ // (checkText 1..16384)——expectedRevision 为 null 放行 wire、
167
+ // 草案层必拒的矛盾消除。
168
+ expectedRevision: { type: "string", minLength: 1, maxLength: 16384 },
158
169
  before: { type: "string" },
159
170
  after: { type: "string" },
160
171
  title: nonEmptyString,
@@ -363,7 +374,20 @@ export const MANAGEMENT_METHODS = Object.freeze({
363
374
  },
364
375
 
365
376
  listCandidates: {
366
- inputSchema: { type: "object", additionalProperties: false, properties: {} },
377
+ // 可选 limit / offset 分页(缺省都不传 = 不分页,行为与旧版一致)。
378
+ inputSchema: {
379
+ type: "object",
380
+ additionalProperties: false,
381
+ properties: {
382
+ limit: { type: "integer", minimum: 0 },
383
+ offset: { type: "integer", minimum: 0 },
384
+ },
385
+ },
386
+ // total/groups/statusCounts/staleCount 为增量字段(groups/statusCounts/
387
+ // staleCount 按分页前全量 items 计数);items 内 candidate.sources 增量补
388
+ // title、条目增量补 stale(该候选任一源的 revision 与 records 不一致、
389
+ // 源卡已不在 records 或 ref.revision 缺失/非整数即过期,fail-closed;
390
+ // queueItemEntry 为 additionalProperties:true,无需改条目形状)。
367
391
  outputSchema: {
368
392
  type: "object",
369
393
  additionalProperties: false,
@@ -371,8 +395,30 @@ export const MANAGEMENT_METHODS = Object.freeze({
371
395
  queueRevision,
372
396
  items: { type: "array", items: queueItemEntry },
373
397
  plans: { type: "array", items: planSummary },
398
+ total: { type: "integer", minimum: 0 },
399
+ staleCount: { type: "integer", minimum: 0 },
400
+ groups: {
401
+ type: "object",
402
+ additionalProperties: false,
403
+ properties: {
404
+ cluster: { type: "integer", minimum: 0 },
405
+ link: { type: "integer", minimum: 0 },
406
+ isolated: { type: "integer", minimum: 0 },
407
+ },
408
+ required: ["cluster", "link", "isolated"],
409
+ },
410
+ statusCounts: {
411
+ type: "object",
412
+ additionalProperties: false,
413
+ properties: {
414
+ pending: { type: "integer", minimum: 0 },
415
+ reviewed: { type: "integer", minimum: 0 },
416
+ dismissed: { type: "integer", minimum: 0 },
417
+ },
418
+ required: ["pending", "reviewed", "dismissed"],
419
+ },
374
420
  },
375
- required: ["queueRevision", "items", "plans"],
421
+ required: ["queueRevision", "items", "plans", "total", "groups", "statusCounts", "staleCount"],
376
422
  },
377
423
  },
378
424
 
@@ -448,6 +494,20 @@ export const MANAGEMENT_METHODS = Object.freeze({
448
494
  },
449
495
  required: ["kind", "planId"],
450
496
  },
497
+ {
498
+ // 0.2.2 专题归档/恢复:archive:true = 归档,false = 恢复。
499
+ // 无候选/无队列事务,required 三键;operationId 可选——P-A 作废
500
+ // 标记(supersedeOpen)用它,缺省落 null,executePlan 硬闸仍生效。
501
+ type: "object",
502
+ additionalProperties: false,
503
+ properties: {
504
+ kind: { enum: ["archive-topic"] },
505
+ topicKey: nonEmptyString,
506
+ archive: { type: "boolean" },
507
+ operationId,
508
+ },
509
+ required: ["kind", "topicKey", "archive"],
510
+ },
451
511
  ],
452
512
  },
453
513
  outputSchema: planView,
@@ -473,6 +533,17 @@ export const MANAGEMENT_METHODS = Object.freeze({
473
533
  planDigest,
474
534
  operationId,
475
535
  result: { type: "object", additionalProperties: true },
536
+ // B1(audit B P2-1):执行后的队列收敛结果——applied=false 时收敛
537
+ // 失败但计划已执行(回执不翻转),warning 为可读告警。
538
+ queueConvergence: {
539
+ type: "object",
540
+ additionalProperties: false,
541
+ properties: {
542
+ applied: { type: "boolean" },
543
+ warning: { type: "string" },
544
+ },
545
+ required: ["applied"],
546
+ },
476
547
  },
477
548
  required: ["planId", "planDigest", "operationId", "result"],
478
549
  },
@@ -589,6 +660,17 @@ function validateNode(value, spec, where, field) {
589
660
  validateNode(value[key], sub, where, field ? `${field}.${key}` : key);
590
661
  }
591
662
  }
663
+ // B2:required 在嵌套层同样生效(此前只在顶层检查,嵌套 required 是
664
+ // 死元数据——organize proposal 的 after[].required=['target','rel'] 若
665
+ // 不在此强制,缺 rel 仍会漏到草案层才被拒)。
666
+ for (const required of spec.required ?? []) {
667
+ if (!Object.hasOwn(value, required)) {
668
+ failInvalid(`${where}${field ? `.${field}` : ""}.${required} is required`, {
669
+ where,
670
+ field: field ? `${field}.${required}` : required,
671
+ });
672
+ }
673
+ }
592
674
  return;
593
675
  }
594
676
  if (spec.type === "array") {
@@ -611,7 +693,8 @@ function validateNode(value, spec, where, field) {
611
693
  /**
612
694
  * 校验管理 payload(wire 层闭包校验;Q 在 RPC 入口调用,P 在 management
613
695
  * 入口再调用一次)。通过返回 payload 原引用;失败抛 code=INVALID_INPUT。
614
- * thin-core proposal 在此被拒绝(UNSUPPORTED,不以 INVALID_INPUT 冒名)。
696
+ * organize proposal 两种 kind(link / merge-topic)全部照
697
+ * schema 校验,无额外早退。
615
698
  */
616
699
  export function validateManagementPayload(name, payload) {
617
700
  const method = MANAGEMENT_METHODS[name];
@@ -620,12 +703,6 @@ export function validateManagementPayload(name, payload) {
620
703
  error.code = "INVALID_INPUT";
621
704
  throw error;
622
705
  }
623
- // thin-core 明确 UNSUPPORTED(先于形状匹配,避免被误报 INVALID_INPUT)。
624
- if (name === "previewPlan" && payload?.proposal?.kind === "thin-core") {
625
- const error = new Error("thin-core proposals are not executable and unsupported by previewPlan");
626
- error.code = "UNSUPPORTED";
627
- throw error;
628
- }
629
706
  const schema = method.inputSchema;
630
707
  if (schema.oneOf !== undefined) {
631
708
  const violations = [];
@@ -664,7 +741,6 @@ export function validateManagementPayload(name, payload) {
664
741
  }
665
742
  }
666
743
  }
667
- // thin-core 已在上方拦截(UNSUPPORTED)。
668
744
  return payload;
669
745
  }
670
746