dsh-run2skill 0.1.1-alpha → 0.2.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.
- package/README.en.md +137 -0
- package/README.md +78 -31
- package/lib/client.js +409 -168
- package/lib/index.d.ts +3887 -308
- package/lib/index.js +18448 -6067
- package/package.json +13 -4
package/lib/client.js
CHANGED
|
@@ -4219,35 +4219,41 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4219
4219
|
}
|
|
4220
4220
|
//#endregion
|
|
4221
4221
|
//#region \0run2skill-css:run2skill-settings-page.module.css.mjs
|
|
4222
|
-
const css = ".
|
|
4222
|
+
const css = ".run2skill_page_H3ahsG{width:min(100%,1040px);color:var(--dsw-alias-label-primary);gap:24px;padding:16px 0 48px;display:grid}.run2skill_intro_H3ahsG,.run2skill_muted_H3ahsG{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:1.5}.run2skill_section_H3ahsG{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);box-shadow:0 1px 2px var(--dsw-alias-border-l1);border-radius:16px;overflow:hidden}.run2skill_sectionHeader_H3ahsG{box-sizing:border-box;height:auto;min-height:56px;padding:14px 20px}.run2skill_sectionTitle_H3ahsG{font-size:15px}.run2skill_sectionBody_H3ahsG{gap:18px;padding:12px 24px 24px 56px;display:grid}.run2skill_empty_H3ahsG{min-height:56px;color:var(--dsw-alias-label-secondary);place-items:center;margin:0;font-size:13px;display:grid}.run2skill_toolbar_H3ahsG,.run2skill_actions_H3ahsG,.run2skill_modeGroup_H3ahsG{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.run2skill_attentionList_H3ahsG,.run2skill_proposalList_H3ahsG,.run2skill_activityList_H3ahsG{gap:8px;margin:0;padding:0;list-style:none;display:grid}.run2skill_activityItem_H3ahsG{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;display:flex}.run2skill_activitySummary_H3ahsG{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.run2skill_proposalLayout_H3ahsG{grid-template-columns:minmax(220px,.8fr) minmax(0,1.6fr);gap:20px;display:grid}.run2skill_proposalListButton_H3ahsG{text-align:start;white-space:normal;justify-content:flex-start;width:100%}.run2skill_detail_H3ahsG{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;min-width:0;max-height:640px;padding:18px;overflow:auto}.run2skill_detail_H3ahsG pre{white-space:pre-wrap;unicode-bidi:isolate;overflow:auto}.run2skill_status_H3ahsG{min-height:20px;margin:0;font-size:13px}.run2skill_danger_H3ahsG{color:var(--dsw-alias-state-error-primary)}.run2skill_backdrop_H3ahsG,.run2skill_rejectOverlay_H3ahsG{background:var(--dsw-alias-bg-mask-1);position:fixed;inset:0}.run2skill_backdrop_H3ahsG{z-index:999}.run2skill_rejectOverlay_H3ahsG{z-index:1001;place-items:center;padding:16px;display:grid}.run2skill_legacyDialog_H3ahsG{z-index:1000;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:0 16px 48px var(--dsw-alias-bg-mask-1);border-radius:16px;grid-template-columns:minmax(16rem,24rem) minmax(0,1fr);gap:16px;padding:16px;display:grid;position:fixed;inset:5vh 5vw;overflow:hidden}.run2skill_blocked_H3ahsG{pointer-events:none;display:contents}.run2skill_queue_H3ahsG,.run2skill_legacyDetail_H3ahsG{min-width:0;overflow:auto}.run2skill_legacyHeader_H3ahsG{justify-content:space-between;align-items:center;gap:8px;display:flex}.run2skill_legacyList_H3ahsG{margin:0;padding:0;list-style:none}.run2skill_rejectCard_H3ahsG{background:var(--dsw-alias-bg-layer-1);border-radius:16px;max-width:32rem;padding:16px}.run2skill_textBlock_H3ahsG{white-space:pre-wrap;overflow-wrap:anywhere;unicode-bidi:isolate;overflow:auto}.run2skill_previewFacts_H3ahsG{grid-template-columns:max-content 1fr;gap:6px 12px;display:grid}.run2skill_previewFacts_H3ahsG dt,.run2skill_previewFacts_H3ahsG dd{margin:0}@media (width<=720px){.run2skill_proposalLayout_H3ahsG{grid-template-columns:1fr}.run2skill_sectionBody_H3ahsG{padding:8px 18px 20px}.run2skill_activityItem_H3ahsG{flex-direction:column;align-items:flex-start}}";
|
|
4223
4223
|
if (typeof document !== "undefined") upsertRun2skillStyle(css);
|
|
4224
4224
|
var _run2skill_css_run2skill_settings_page_module_css_default = {
|
|
4225
|
-
"
|
|
4226
|
-
"
|
|
4227
|
-
"
|
|
4228
|
-
"
|
|
4229
|
-
"
|
|
4230
|
-
"
|
|
4231
|
-
"
|
|
4232
|
-
"
|
|
4233
|
-
"
|
|
4234
|
-
"
|
|
4235
|
-
"
|
|
4236
|
-
"
|
|
4237
|
-
"
|
|
4238
|
-
"
|
|
4239
|
-
"
|
|
4240
|
-
"
|
|
4241
|
-
"status": "
|
|
4242
|
-
"
|
|
4243
|
-
"
|
|
4244
|
-
"
|
|
4245
|
-
"
|
|
4246
|
-
"
|
|
4247
|
-
"
|
|
4248
|
-
"
|
|
4249
|
-
"
|
|
4250
|
-
"
|
|
4225
|
+
"danger": "run2skill_danger_H3ahsG",
|
|
4226
|
+
"rejectOverlay": "run2skill_rejectOverlay_H3ahsG",
|
|
4227
|
+
"backdrop": "run2skill_backdrop_H3ahsG",
|
|
4228
|
+
"sectionBody": "run2skill_sectionBody_H3ahsG",
|
|
4229
|
+
"legacyList": "run2skill_legacyList_H3ahsG",
|
|
4230
|
+
"muted": "run2skill_muted_H3ahsG",
|
|
4231
|
+
"activitySummary": "run2skill_activitySummary_H3ahsG",
|
|
4232
|
+
"detail": "run2skill_detail_H3ahsG",
|
|
4233
|
+
"queue": "run2skill_queue_H3ahsG",
|
|
4234
|
+
"section": "run2skill_section_H3ahsG",
|
|
4235
|
+
"rejectCard": "run2skill_rejectCard_H3ahsG",
|
|
4236
|
+
"page": "run2skill_page_H3ahsG",
|
|
4237
|
+
"activityList": "run2skill_activityList_H3ahsG",
|
|
4238
|
+
"proposalLayout": "run2skill_proposalLayout_H3ahsG",
|
|
4239
|
+
"proposalListButton": "run2skill_proposalListButton_H3ahsG",
|
|
4240
|
+
"sectionHeader": "run2skill_sectionHeader_H3ahsG",
|
|
4241
|
+
"status": "run2skill_status_H3ahsG",
|
|
4242
|
+
"modeGroup": "run2skill_modeGroup_H3ahsG",
|
|
4243
|
+
"intro": "run2skill_intro_H3ahsG",
|
|
4244
|
+
"proposalList": "run2skill_proposalList_H3ahsG",
|
|
4245
|
+
"empty": "run2skill_empty_H3ahsG",
|
|
4246
|
+
"actions": "run2skill_actions_H3ahsG",
|
|
4247
|
+
"legacyDetail": "run2skill_legacyDetail_H3ahsG",
|
|
4248
|
+
"previewFacts": "run2skill_previewFacts_H3ahsG",
|
|
4249
|
+
"toolbar": "run2skill_toolbar_H3ahsG",
|
|
4250
|
+
"blocked": "run2skill_blocked_H3ahsG",
|
|
4251
|
+
"textBlock": "run2skill_textBlock_H3ahsG",
|
|
4252
|
+
"activityItem": "run2skill_activityItem_H3ahsG",
|
|
4253
|
+
"attentionList": "run2skill_attentionList_H3ahsG",
|
|
4254
|
+
"legacyDialog": "run2skill_legacyDialog_H3ahsG",
|
|
4255
|
+
"legacyHeader": "run2skill_legacyHeader_H3ahsG",
|
|
4256
|
+
"sectionTitle": "run2skill_sectionTitle_H3ahsG"
|
|
4251
4257
|
};
|
|
4252
4258
|
//#endregion
|
|
4253
4259
|
//#region src/client/purge-settings.ts
|
|
@@ -4258,10 +4264,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4258
4264
|
const digest = string().regex(/^[a-f0-9]{64}$/);
|
|
4259
4265
|
const isoDateTime = string().datetime({ offset: true });
|
|
4260
4266
|
const count = number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
4261
|
-
const
|
|
4267
|
+
const projectBinding = object({
|
|
4262
4268
|
scope: literal("PROJECT"),
|
|
4263
4269
|
workspaceId: string().min(1).max(256)
|
|
4264
|
-
}).strict()
|
|
4270
|
+
}).strict();
|
|
4271
|
+
const scopeBinding = discriminatedUnion("scope", [
|
|
4272
|
+
object({ scope: literal("ALL") }).strict(),
|
|
4273
|
+
projectBinding,
|
|
4274
|
+
object({ scope: literal("USER") }).strict()
|
|
4275
|
+
]);
|
|
4265
4276
|
const previewSchema = object({
|
|
4266
4277
|
apiVersion: literal(1),
|
|
4267
4278
|
previewId,
|
|
@@ -4271,6 +4282,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4271
4282
|
hideBefore: isoDateTime,
|
|
4272
4283
|
workItemCount: count,
|
|
4273
4284
|
lineageCount: count,
|
|
4285
|
+
derivedRecordCount: count,
|
|
4274
4286
|
blockedOrUnprovenCount: count,
|
|
4275
4287
|
willDelete: array(object({
|
|
4276
4288
|
kind: _enum(["WORK_ITEMS", "LINEAGES"]),
|
|
@@ -4369,21 +4381,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4369
4381
|
throw new PurgeResponseError({ code: "PURGE_STORAGE_UNAVAILABLE" });
|
|
4370
4382
|
}
|
|
4371
4383
|
function completionAnnouncement(scope, receipt) {
|
|
4372
|
-
return `${scope === void 0 ? "
|
|
4384
|
+
return `${scope === "ALL" ? "Run2Skill 缓存" : scope === void 0 ? "Run2Skill 数据" : `${scope} Run2Skill 数据`}清理完成:${String(receipt.deletedWorkItems)} 条待处理数据,${String(receipt.deletedLineages)} 条 Skill 关联记录。`;
|
|
4373
4385
|
}
|
|
4374
4386
|
function polledCompletionAnnouncement(scope) {
|
|
4375
|
-
return `${scope === void 0 ? "" : `${scope} `}
|
|
4387
|
+
return scope === "ALL" ? "Run2Skill 缓存清理完成。" : `${scope === void 0 ? "" : `${scope} `}Run2Skill 数据清理完成。`;
|
|
4376
4388
|
}
|
|
4377
4389
|
function errorAnnouncement(error, durableBoundary = false) {
|
|
4378
4390
|
if (error.code === "PURGE_PREVIEW_STALE") return "清理预览已失效,请重新预览后确认。";
|
|
4379
|
-
if (error.code === "PURGE_BUSY") return `当前有 ${String(error.busyPublicationCount ?? 0)}
|
|
4391
|
+
if (error.code === "PURGE_BUSY") return `当前有 ${String(error.busyPublicationCount ?? 0)} 份技能草稿正在保存;请等待保存完成后重新预览。`;
|
|
4380
4392
|
if (error.code === "PURGE_ALREADY_RUNNING") return "已有一项数据清理正在运行,请等待完成。";
|
|
4381
4393
|
if (error.code === "PURGE_SCOPE_UNAVAILABLE") return "当前作用域无法可靠确认,未执行清理。";
|
|
4382
4394
|
if (error.code === "PURGE_INCOMPATIBLE") return "当前数据版本不兼容,未执行清理。";
|
|
4383
|
-
if (error.code === "PURGE_FENCE_LIMIT") return "
|
|
4395
|
+
if (error.code === "PURGE_FENCE_LIMIT") return "缓存清理保护记录已达上限,未执行清理。";
|
|
4384
4396
|
return durableBoundary ? "数据清理未完成;已建立的清理边界继续隐藏,可重试。" : "数据清理暂不可用;未确认已建立清理边界,请稍后重试。";
|
|
4385
4397
|
}
|
|
4386
4398
|
const initialState$1 = {
|
|
4399
|
+
hostDataEpoch: 0,
|
|
4387
4400
|
statusPhase: "LOADING",
|
|
4388
4401
|
previewPending: false,
|
|
4389
4402
|
mutationPending: false,
|
|
@@ -4523,6 +4536,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4523
4536
|
await this.#execute(async (signal) => {
|
|
4524
4537
|
this.#publish({
|
|
4525
4538
|
...this.#state,
|
|
4539
|
+
hostDataEpoch: this.#state.hostDataEpoch + 1,
|
|
4526
4540
|
mutationPending: true,
|
|
4527
4541
|
error: void 0,
|
|
4528
4542
|
announcement: ""
|
|
@@ -4558,6 +4572,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4558
4572
|
await this.#execute(async (signal) => {
|
|
4559
4573
|
this.#publish({
|
|
4560
4574
|
...this.#state,
|
|
4575
|
+
hostDataEpoch: this.#state.hostDataEpoch + 1,
|
|
4561
4576
|
mutationPending: true,
|
|
4562
4577
|
error: void 0,
|
|
4563
4578
|
announcement: "正在重试数据清理。"
|
|
@@ -4591,6 +4606,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4591
4606
|
if (receipt.state === "COMPLETED") {
|
|
4592
4607
|
this.#publish({
|
|
4593
4608
|
...this.#state,
|
|
4609
|
+
hostDataEpoch: this.#state.hostDataEpoch + 1,
|
|
4594
4610
|
statusPhase: "READY",
|
|
4595
4611
|
status: {
|
|
4596
4612
|
apiVersion: 1,
|
|
@@ -4610,7 +4626,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4610
4626
|
mutationPending: false,
|
|
4611
4627
|
preview: void 0,
|
|
4612
4628
|
inProgressReceipt: receipt,
|
|
4613
|
-
announcement: `
|
|
4629
|
+
announcement: `Run2Skill 数据清理进行中:${receipt.phase ?? "HIDING"}。`
|
|
4614
4630
|
});
|
|
4615
4631
|
}
|
|
4616
4632
|
async #readStatusAfterFailure(error, durableBoundary = false) {
|
|
@@ -4635,8 +4651,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4635
4651
|
const status = parseValue$1(statusSchema, await this.call("purge/status", { apiVersion: 1 }, abort.signal));
|
|
4636
4652
|
if (this.#disposed || abort.signal.aborted) return;
|
|
4637
4653
|
const completed = status.state === "IDLE" && (this.#state.status?.state === "IN_PROGRESS" || this.#state.inProgressReceipt?.state === "IN_PROGRESS");
|
|
4654
|
+
const started = status.state === "IN_PROGRESS" && this.#state.status?.state !== "IN_PROGRESS" && this.#state.inProgressReceipt?.state !== "IN_PROGRESS" && !this.#state.mutationPending;
|
|
4638
4655
|
this.#publish({
|
|
4639
4656
|
...this.#state,
|
|
4657
|
+
hostDataEpoch: started || completed ? this.#state.hostDataEpoch + 1 : this.#state.hostDataEpoch,
|
|
4640
4658
|
statusPhase: "READY",
|
|
4641
4659
|
status,
|
|
4642
4660
|
inProgressReceipt: status.state === "IDLE" ? void 0 : this.#state.inProgressReceipt,
|
|
@@ -4699,13 +4717,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4699
4717
|
};
|
|
4700
4718
|
const phaseCopy = {
|
|
4701
4719
|
HIDING: "正在隐藏命中数据",
|
|
4702
|
-
DELETING_LINEAGES: "
|
|
4720
|
+
DELETING_LINEAGES: "正在删除 Skill 关联记录",
|
|
4703
4721
|
DELETING_WORK_ITEMS: "正在删除待处理数据",
|
|
4704
4722
|
VERIFYING: "正在验证清理结果"
|
|
4705
4723
|
};
|
|
4706
4724
|
function PreviewSummary({ preview }) {
|
|
4707
|
-
|
|
4708
|
-
return (0, react.createElement)("dl", null, (0, react.createElement)("dt", null, "将删除"), (0, react.createElement)("dd", null, `${String(preview.workItemCount)} 条待处理数据;${String(preview.lineageCount)} 条发布沿袭记录`), (0, react.createElement)("dt", null, "将保留"), (0, react.createElement)("dd", null, `${String(keep.KEEP_NEW ?? 0)} 条边界后新数据;${String(keep.KEEP_SCOPE ?? 0)} 条其他作用域数据`), (0, react.createElement)("dt", null, "无法证明"), (0, react.createElement)("dd", null, `${String(preview.blockedOrUnprovenCount)} 条无法证明作用域的数据将保留`), (0, react.createElement)("dt", null, "正在发布"), (0, react.createElement)("dd", null, `${String(preview.busyPublicationCount)} 条;存在时确认会安全拒绝`));
|
|
4725
|
+
return (0, react.createElement)("dl", null, (0, react.createElement)("dt", null, "将删除"), (0, react.createElement)("dd", null, `${String(preview.workItemCount)} 条待处理数据;${String(preview.lineageCount)} 条 Skill 关联记录;${String(preview.derivedRecordCount)} 条其他中间缓存`), (0, react.createElement)("dt", null, "将保留"), (0, react.createElement)("dd", null, "已发布 Skill、DSH 原始会话记录和非 Run2Skill 设置"), (0, react.createElement)("dt", null, "正在保存的技能草稿"), (0, react.createElement)("dd", null, `${String(preview.busyPublicationCount)} 份;存在时不会开始清理`));
|
|
4709
4726
|
}
|
|
4710
4727
|
function PurgeConfirmationDialog(props) {
|
|
4711
4728
|
const dialogRef = (0, react.useRef)(null);
|
|
@@ -4742,8 +4759,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4742
4759
|
if (preview === void 0 || scope === void 0) return null;
|
|
4743
4760
|
return (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
4744
4761
|
open: true,
|
|
4745
|
-
title: `确认清理 ${scope}
|
|
4746
|
-
description: "
|
|
4762
|
+
title: scope === "ALL" ? "确认清理所有缓存?" : `确认清理 ${scope} Run2Skill 数据?`,
|
|
4763
|
+
description: "此操作只清理 Run2Skill 自己产生的中间缓存数据,不会卸载插件。",
|
|
4747
4764
|
closeLabel: "关闭清理确认框",
|
|
4748
4765
|
onClose: () => {
|
|
4749
4766
|
props.controller.cancelPreview();
|
|
@@ -4774,7 +4791,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4774
4791
|
event.preventDefault();
|
|
4775
4792
|
}, dialogRef.current, typeof document === "undefined" ? void 0 : document.activeElement);
|
|
4776
4793
|
}
|
|
4777
|
-
}, (0, react.createElement)("ul", null, (0, react.createElement)("li", null, "删除
|
|
4794
|
+
}, (0, react.createElement)("ul", null, (0, react.createElement)("li", null, "删除 Run2Skill 产生的中间缓存、待处理技能草稿、失败与非敏感诊断记录。"), (0, react.createElement)("li", null, "保留 DSH 的原始会话记录。"), (0, react.createElement)("li", null, "保留所有已发布的原生 Skill。"), (0, react.createElement)("li", null, "删除 Skill 关联记录后,保留的 Skill 仍可作为普通 Skill 使用。")), (0, react.createElement)(PreviewSummary, { preview })));
|
|
4778
4795
|
}
|
|
4779
4796
|
function PurgeSettingsSection(props) {
|
|
4780
4797
|
const surfaceActive = props.active ?? true;
|
|
@@ -4787,31 +4804,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4787
4804
|
else props.controller.pause();
|
|
4788
4805
|
}, [surfaceActive, props.controller]);
|
|
4789
4806
|
const state = (0, react.useSyncExternalStore)(props.controller.subscribe, props.controller.snapshot, props.controller.snapshot);
|
|
4807
|
+
const lastCompletion = (0, react.useRef)("");
|
|
4808
|
+
(0, react.useEffect)(() => {
|
|
4809
|
+
if (!state.announcement.includes("清理完成") || state.announcement === lastCompletion.current) return;
|
|
4810
|
+
lastCompletion.current = state.announcement;
|
|
4811
|
+
props.onCompleted?.();
|
|
4812
|
+
}, [props.onCompleted, state.announcement]);
|
|
4790
4813
|
const restoreRef = (0, react.useMemo)(() => ({ current: null }), []);
|
|
4791
4814
|
const active = state.status?.state === "IN_PROGRESS" ? state.status : void 0;
|
|
4792
4815
|
const activeReceipt = state.inProgressReceipt?.state === "IN_PROGRESS" ? state.inProgressReceipt : void 0;
|
|
4793
4816
|
const activePhase = active?.phase ?? activeReceipt?.phase ?? (activeReceipt === void 0 ? void 0 : "HIDING");
|
|
4794
4817
|
const disabled = state.previewPending || state.mutationPending || active !== void 0 || activeReceipt !== void 0;
|
|
4795
|
-
return (0, react.createElement)("section", { "aria-labelledby": "run2skill-purge-heading" }, (0, react.createElement)("h3", { id: "run2skill-purge-heading" }, "
|
|
4796
|
-
variant: "outline",
|
|
4797
|
-
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutline16),
|
|
4798
|
-
disabled,
|
|
4799
|
-
onClick: (event) => {
|
|
4800
|
-
restoreRef.current = event.currentTarget;
|
|
4801
|
-
props.controller.preview("PROJECT");
|
|
4802
|
-
}
|
|
4803
|
-
}, "预览并清理当前 PROJECT 数据"), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
4818
|
+
return (0, react.createElement)("section", { "aria-labelledby": "run2skill-purge-heading" }, (0, react.createElement)("h3", { id: "run2skill-purge-heading" }, "缓存清理"), (0, react.createElement)("p", null, "清理 Run2Skill 自己产生的中间缓存数据"), (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.actions }, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
4804
4819
|
variant: "outline",
|
|
4805
4820
|
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutline16),
|
|
4806
4821
|
disabled,
|
|
4807
4822
|
onClick: (event) => {
|
|
4808
4823
|
restoreRef.current = event.currentTarget;
|
|
4809
|
-
props.controller.preview("
|
|
4824
|
+
props.controller.preview("ALL");
|
|
4810
4825
|
}
|
|
4811
|
-
}, "
|
|
4826
|
+
}, "清理所有缓存")), state.statusPhase === "LOADING" ? (0, react.createElement)("p", { role: "status" }, "正在读取数据清理状态…") : null, state.statusPhase === "UNAVAILABLE" ? (0, react.createElement)("p", { role: "alert" }, "数据清理状态暂不可用") : null, state.statusPhase === "STALE" ? (0, react.createElement)("p", { role: "status" }, "数据清理状态可能已过期") : null, state.previewPending ? (0, react.createElement)("p", { role: "status" }, "正在生成清理预览…") : null, activePhase === void 0 ? null : (0, react.createElement)("div", {
|
|
4812
4827
|
role: "status",
|
|
4813
|
-
"aria-label": "
|
|
4814
|
-
}, (0, react.createElement)("p", null, phaseCopy[activePhase]), (0, react.createElement)("p", null, `已删除 ${String(active?.deletedWorkItems ?? activeReceipt?.deletedWorkItems ?? 0)} 条待处理数据和 ${String(active?.deletedLineages ?? activeReceipt?.deletedLineages ?? 0)}
|
|
4828
|
+
"aria-label": "当前数据清理状态"
|
|
4829
|
+
}, (0, react.createElement)("p", null, phaseCopy[activePhase]), (0, react.createElement)("p", null, `已删除 ${String(active?.deletedWorkItems ?? activeReceipt?.deletedWorkItems ?? 0)} 条待处理数据和 ${String(active?.deletedLineages ?? activeReceipt?.deletedLineages ?? 0)} 条 Skill 关联记录。`), active?.lastError === void 0 ? null : (0, react.createElement)(react.Fragment, null, (0, react.createElement)("p", { role: "alert" }, `清理失败:${active.lastError.code}`), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
4815
4830
|
variant: "outline",
|
|
4816
4831
|
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline16),
|
|
4817
4832
|
disabled: state.mutationPending,
|
|
@@ -4820,7 +4835,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4820
4835
|
}
|
|
4821
4836
|
}, state.mutationPending ? "正在重试…" : "重试清理"))), state.error === void 0 ? null : (0, react.createElement)("p", { role: "alert" }, state.announcement), (0, react.createElement)("div", {
|
|
4822
4837
|
role: "status",
|
|
4823
|
-
"aria-label": "
|
|
4838
|
+
"aria-label": "数据清理状态播报",
|
|
4824
4839
|
"aria-live": "polite",
|
|
4825
4840
|
"aria-atomic": true
|
|
4826
4841
|
}, state.announcement), (0, react.createElement)(PurgeConfirmationDialog, {
|
|
@@ -4899,14 +4914,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4899
4914
|
onClick: () => {
|
|
4900
4915
|
setOpen((value) => !value);
|
|
4901
4916
|
}
|
|
4902
|
-
}, "
|
|
4917
|
+
}, "Run2Skill", (0, react.createElement)("span", null, "将真实执行中的明确经验整理为待确认的技能草稿")), open ? (0, react.createElement)("div", null, (0, react.createElement)("label", null, (0, react.createElement)("input", {
|
|
4903
4918
|
type: "checkbox",
|
|
4904
4919
|
checked: state.automaticLearning === true,
|
|
4905
4920
|
disabled,
|
|
4906
4921
|
onChange: (event) => {
|
|
4907
4922
|
props.controller.setAutomaticLearning(event.currentTarget.checked);
|
|
4908
4923
|
}
|
|
4909
|
-
}), "
|
|
4924
|
+
}), "自动学习"), (0, react.createElement)("p", null, "关闭后暂停普通自动学习;显式“保存为 Skill”仍会持久保存。已开始的分析继续使用启动时快照。"), (0, react.createElement)("p", null, "分析时沿用发起会话已经选择的模型。"), state.error === void 0 ? null : (0, react.createElement)("p", { role: "status" }, "设置已变化,请刷新后重试。"), (0, react.createElement)(PurgeSettingsSection, { controller: props.purgeController })) : null);
|
|
4910
4925
|
}
|
|
4911
4926
|
function applyAutomaticLearningSettingsClient(context) {
|
|
4912
4927
|
const controller = new AutomaticLearningSettingsController(context.settingsScope.bind({ namespace: "run2skill" }));
|
|
@@ -5174,35 +5189,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5174
5189
|
confirmDiscard: "coverage/confirm-discard"
|
|
5175
5190
|
};
|
|
5176
5191
|
function describeProposalOutcome(detail) {
|
|
5177
|
-
if (detail.publicationOutcome === "PUBLISHED") return "Skill
|
|
5178
|
-
if (detail.publicationOutcome === "DISCARDED") return "
|
|
5179
|
-
if (detail.publicationOutcome === "NEEDS_REFRESH") return "
|
|
5180
|
-
if (detail.publicationOutcome === "PUBLISH_FAILED") return "
|
|
5192
|
+
if (detail.publicationOutcome === "PUBLISHED") return "Skill 已保存,DSH 已确认可以使用";
|
|
5193
|
+
if (detail.publicationOutcome === "DISCARDED") return "技能草稿已放弃,Skill 未更改";
|
|
5194
|
+
if (detail.publicationOutcome === "NEEDS_REFRESH") return "保存目标已变化,需要生成新的技能草稿";
|
|
5195
|
+
if (detail.publicationOutcome === "PUBLISH_FAILED") return "保存失败,可重试";
|
|
5181
5196
|
if (detail.processingState === "NEEDS_ATTENTION") return "需要处理后才能继续";
|
|
5182
|
-
if (detail.processingState === "PUBLISHING") return "
|
|
5197
|
+
if (detail.processingState === "PUBLISHING") return "已确认,正在保存";
|
|
5183
5198
|
return "待审核";
|
|
5184
5199
|
}
|
|
5185
5200
|
function describeProposalListItem(item) {
|
|
5186
5201
|
return describeProposalOutcome(item);
|
|
5187
5202
|
}
|
|
5188
5203
|
function describeReviewDecision(decision) {
|
|
5189
|
-
if (decision === "APPROVED") return "
|
|
5190
|
-
if (decision === "REJECTED") return "
|
|
5204
|
+
if (decision === "APPROVED") return "已确认";
|
|
5205
|
+
if (decision === "REJECTED") return "已放弃";
|
|
5191
5206
|
return "待决定";
|
|
5192
5207
|
}
|
|
5193
5208
|
function describeProcessingState(state) {
|
|
5194
|
-
if (state === "PUBLISHING") return "
|
|
5209
|
+
if (state === "PUBLISHING") return "正在保存";
|
|
5195
5210
|
if (state === "NEEDS_ATTENTION") return "需要处理";
|
|
5196
5211
|
if (state === "TERMINAL") return "已结束";
|
|
5197
5212
|
return "待审核";
|
|
5198
5213
|
}
|
|
5199
5214
|
function describePublicationOutcome(outcome) {
|
|
5200
|
-
if (outcome === "PUBLISHED") return "
|
|
5201
|
-
if (outcome === "DISCARDED") return "未修改 Skill
|
|
5202
|
-
if (outcome === "NEEDS_REFRESH") return "
|
|
5203
|
-
if (outcome === "PUBLISH_FAILED") return "
|
|
5204
|
-
if (outcome === "NEEDS_ATTENTION") return "
|
|
5205
|
-
return "
|
|
5215
|
+
if (outcome === "PUBLISHED") return "已保存,DSH 已确认可以使用";
|
|
5216
|
+
if (outcome === "DISCARDED") return "未修改 Skill,技能草稿已放弃";
|
|
5217
|
+
if (outcome === "NEEDS_REFRESH") return "保存目标已变化,需要新的技能草稿";
|
|
5218
|
+
if (outcome === "PUBLISH_FAILED") return "保存失败,可重试";
|
|
5219
|
+
if (outcome === "NEEDS_ATTENTION") return "保存前需要先处理当前问题";
|
|
5220
|
+
return "尚未产生保存结果";
|
|
5206
5221
|
}
|
|
5207
5222
|
function browserEnvironment$1() {
|
|
5208
5223
|
return {
|
|
@@ -5317,7 +5332,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5317
5332
|
open: true
|
|
5318
5333
|
});
|
|
5319
5334
|
await this.whenIdle();
|
|
5320
|
-
if (
|
|
5335
|
+
if (this.#disposed || !this.#state.open) return;
|
|
5336
|
+
if (this.options.attentionDriven === true && this.#scopeAccess().actions.length === 0) {
|
|
5337
|
+
this.#publish({
|
|
5338
|
+
...this.#state,
|
|
5339
|
+
listPhase: "READY",
|
|
5340
|
+
items: [],
|
|
5341
|
+
selectedProposalId: void 0,
|
|
5342
|
+
detailPhase: "IDLE",
|
|
5343
|
+
detail: void 0
|
|
5344
|
+
});
|
|
5345
|
+
return;
|
|
5346
|
+
}
|
|
5347
|
+
await this.#loadList();
|
|
5321
5348
|
}
|
|
5322
5349
|
close() {
|
|
5323
5350
|
if (this.#disposed) return;
|
|
@@ -5390,7 +5417,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5390
5417
|
});
|
|
5391
5418
|
const receipt = parseMutationReceipt(await this.call(targetEndpoint, request, signal));
|
|
5392
5419
|
if (receipt === void 0) throw new Error("invalid mutation receipt");
|
|
5393
|
-
const announcement = describeProposalOutcome(receipt) || "
|
|
5420
|
+
const announcement = describeProposalOutcome(receipt) || "技能草稿状态已更新";
|
|
5394
5421
|
this.#publish({
|
|
5395
5422
|
...this.#state,
|
|
5396
5423
|
mutationPending: false,
|
|
@@ -5447,6 +5474,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5447
5474
|
async #refreshWithin(signal) {
|
|
5448
5475
|
if (this.options.attentionDriven === true) {
|
|
5449
5476
|
if (!this.#state.open) return;
|
|
5477
|
+
if (this.#scopeAccess().actions.length === 0) {
|
|
5478
|
+
this.#publish({
|
|
5479
|
+
...this.#state,
|
|
5480
|
+
listPhase: "READY",
|
|
5481
|
+
items: [],
|
|
5482
|
+
selectedProposalId: void 0,
|
|
5483
|
+
detailPhase: "IDLE",
|
|
5484
|
+
detail: void 0
|
|
5485
|
+
});
|
|
5486
|
+
return;
|
|
5487
|
+
}
|
|
5450
5488
|
await this.#loadListWithin(signal);
|
|
5451
5489
|
await this.#refreshPublishingDetailWithin(signal);
|
|
5452
5490
|
return;
|
|
@@ -5496,7 +5534,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5496
5534
|
});
|
|
5497
5535
|
}
|
|
5498
5536
|
async #loadListWithin(signal) {
|
|
5499
|
-
this.#publish({
|
|
5537
|
+
if (this.#state.listPhase !== "READY") this.#publish({
|
|
5500
5538
|
...this.#state,
|
|
5501
5539
|
listPhase: "LOADING"
|
|
5502
5540
|
});
|
|
@@ -5542,7 +5580,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5542
5580
|
}
|
|
5543
5581
|
#schedule() {
|
|
5544
5582
|
if (this.#disposed || !this.#active) return;
|
|
5545
|
-
const
|
|
5583
|
+
const hasVisibleWork = this.options.attentionDriven !== true || this.#scopeAccess().actions.length > 0;
|
|
5584
|
+
const delay = this.#state.open && hasVisibleWork ? PROPOSAL_ACTIVE_POLL_INTERVAL_MS : PROPOSAL_POLL_INTERVAL_MS;
|
|
5546
5585
|
if (this.#timer !== void 0 && this.#timerDelay === delay) return;
|
|
5547
5586
|
this.#unschedule();
|
|
5548
5587
|
this.#timerDelay = delay;
|
|
@@ -5654,10 +5693,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5654
5693
|
//#endregion
|
|
5655
5694
|
//#region src/client/status-copy.ts
|
|
5656
5695
|
function describeRun2skillHealth(status) {
|
|
5657
|
-
if (status === "INCOMPATIBLE") return "
|
|
5658
|
-
if (status === "DEGRADED") return "
|
|
5659
|
-
if (status === "RECOVERING") return "
|
|
5660
|
-
return "
|
|
5696
|
+
if (status === "INCOMPATIBLE") return "Run2Skill 当前版本不兼容";
|
|
5697
|
+
if (status === "DEGRADED") return "Run2Skill 当前功能受限";
|
|
5698
|
+
if (status === "RECOVERING") return "Run2Skill 正在恢复历史观察";
|
|
5699
|
+
return "Run2Skill 已就绪";
|
|
5661
5700
|
}
|
|
5662
5701
|
//#endregion
|
|
5663
5702
|
//#region src/client/proposal-inbox-view.ts
|
|
@@ -5689,22 +5728,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5689
5728
|
}
|
|
5690
5729
|
function countLabel(state) {
|
|
5691
5730
|
const queue = state.summary?.queue;
|
|
5692
|
-
if (queue === void 0 || queue.completeness === "UNKNOWN") return "
|
|
5731
|
+
if (queue === void 0 || queue.completeness === "UNKNOWN") return "技能草稿待处理数量未知";
|
|
5693
5732
|
const total = queue.pendingReview + queue.publishing + queue.needsAttention;
|
|
5694
5733
|
const facts = [
|
|
5695
|
-
queue.pendingReview > 0 ? `${String(queue.pendingReview)}
|
|
5696
|
-
queue.publishing > 0 ? `${String(queue.publishing)}
|
|
5697
|
-
queue.needsAttention > 0 ? `${String(queue.needsAttention)}
|
|
5734
|
+
queue.pendingReview > 0 ? `${String(queue.pendingReview)} 份待审核` : void 0,
|
|
5735
|
+
queue.publishing > 0 ? `${String(queue.publishing)} 份正在保存` : void 0,
|
|
5736
|
+
queue.needsAttention > 0 ? `${String(queue.needsAttention)} 份需要处理` : void 0
|
|
5698
5737
|
].filter((fact) => fact !== void 0);
|
|
5699
|
-
return facts.length === 0 ? "
|
|
5738
|
+
return facts.length === 0 ? "当前没有待处理的技能草稿" : `${String(total)} 份技能草稿待处理:${facts.join(",")}`;
|
|
5700
5739
|
}
|
|
5701
5740
|
function describeProposalSummaryState(state) {
|
|
5702
|
-
if (state.summaryPhase === "LOADING") return "
|
|
5703
|
-
if (state.summaryPhase === "UNAVAILABLE") return "
|
|
5704
|
-
if (state.summary === void 0) return "
|
|
5741
|
+
if (state.summaryPhase === "LOADING") return "正在加载技能草稿队列";
|
|
5742
|
+
if (state.summaryPhase === "UNAVAILABLE") return "技能草稿队列暂不可用";
|
|
5743
|
+
if (state.summary === void 0) return "技能草稿队列状态未知";
|
|
5705
5744
|
const health = describeRun2skillHealth(state.summary.status);
|
|
5706
|
-
const queue = state.summary.queue.completeness === "UNKNOWN" ? "
|
|
5707
|
-
return state.summaryPhase === "STALE" ?
|
|
5745
|
+
const queue = state.summary.queue.completeness === "UNKNOWN" ? "技能草稿待处理数量未知" : countLabel(state);
|
|
5746
|
+
return state.summaryPhase === "STALE" ? `技能草稿队列状态可能已过期:${health};${queue}` : `${health};${queue}`;
|
|
5708
5747
|
}
|
|
5709
5748
|
function ProposalInboxHeaderAction(props) {
|
|
5710
5749
|
const controller = (0, react.useMemo)(() => new ProposalInboxController(props.workspaceId, props.callReview, void 0, props.scopeAccess === void 0 ? {} : { scopeAccess: props.scopeAccess }), [
|
|
@@ -5776,9 +5815,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5776
5815
|
inert: props.rejectConfirm ? "" : void 0,
|
|
5777
5816
|
className: props.rejectConfirm ? _run2skill_css_run2skill_settings_page_module_css_default.blocked : void 0
|
|
5778
5817
|
}, (0, react.createElement)("section", {
|
|
5779
|
-
"aria-label": "
|
|
5818
|
+
"aria-label": "技能草稿待处理队列",
|
|
5780
5819
|
className: _run2skill_css_run2skill_settings_page_module_css_default.queue
|
|
5781
|
-
}, (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.legacyHeader }, (0, react.createElement)("h2", { id: "run2skill-proposal-inbox-title" }, "
|
|
5820
|
+
}, (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.legacyHeader }, (0, react.createElement)("h2", { id: "run2skill-proposal-inbox-title" }, "技能草稿"), (0, react.createElement)("button", {
|
|
5782
5821
|
type: "button",
|
|
5783
5822
|
"data-initial-focus": true,
|
|
5784
5823
|
onClick: () => {
|
|
@@ -5787,7 +5826,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5787
5826
|
}, "关闭")), (0, react.createElement)("p", { role: "status" }, countLabel(state)), (0, react.createElement)("p", {
|
|
5788
5827
|
role: "status",
|
|
5789
5828
|
"aria-live": "polite"
|
|
5790
|
-
}, describeProposalSummaryState(state)), state.listPhase === "LOADING" ? (0, react.createElement)("p", null, "正在加载待处理队列…") : null, state.listPhase === "ERROR" ? (0, react.createElement)("p", { role: "alert" }, "待处理队列暂不可用") : null, state.listPhase === "READY" && state.items.length === 0 ? (0, react.createElement)("p", null, "
|
|
5829
|
+
}, describeProposalSummaryState(state)), state.listPhase === "LOADING" ? (0, react.createElement)("p", null, "正在加载待处理队列…") : null, state.listPhase === "ERROR" ? (0, react.createElement)("p", { role: "alert" }, "待处理队列暂不可用") : null, state.listPhase === "READY" && state.items.length === 0 ? (0, react.createElement)("p", null, "当前没有待处理的技能草稿") : null, (0, react.createElement)("ul", { className: _run2skill_css_run2skill_settings_page_module_css_default.legacyList }, ...state.items.map((item) => (0, react.createElement)("li", { key: item.proposalRef.proposalId }, (0, react.createElement)("button", {
|
|
5791
5830
|
type: "button",
|
|
5792
5831
|
disabled: contentBlocked || state.detailPhase === "LOADING",
|
|
5793
5832
|
"aria-current": state.selectedProposalId === item.proposalRef.proposalId ? "true" : void 0,
|
|
@@ -5796,9 +5835,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5796
5835
|
},
|
|
5797
5836
|
className: _run2skill_css_run2skill_settings_page_module_css_default.proposalListButton
|
|
5798
5837
|
}, `${item.kind} · ${makeSafeText(item.name)} · ${item.persistenceScope} · ${describeProposalListItem(item)}`))))), (0, react.createElement)("section", {
|
|
5799
|
-
"aria-label": "
|
|
5838
|
+
"aria-label": "技能草稿详情",
|
|
5800
5839
|
className: _run2skill_css_run2skill_settings_page_module_css_default.legacyDetail
|
|
5801
|
-
}, state.detailPhase === "IDLE" ? (0, react.createElement)("p", null, "
|
|
5840
|
+
}, state.detailPhase === "IDLE" ? (0, react.createElement)("p", null, "选择一份技能草稿查看完整内容") : null, state.detailPhase === "LOADING" ? (0, react.createElement)("p", null, "正在加载技能草稿详情…") : null, state.detailPhase === "ERROR" ? (0, react.createElement)("p", { role: "alert" }, "技能草稿详情暂不可用") : null, state.detail === void 0 ? null : (0, react.createElement)(ProposalDetailView, {
|
|
5802
5841
|
detail: state.detail,
|
|
5803
5842
|
textMode: props.textMode,
|
|
5804
5843
|
setTextMode: props.setTextMode,
|
|
@@ -5832,35 +5871,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5832
5871
|
function factsFromAction(detail) {
|
|
5833
5872
|
const action = detail.proposal.actionBinding;
|
|
5834
5873
|
if (action.kind === "CREATE") return [
|
|
5835
|
-
`
|
|
5836
|
-
`
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
`Skill
|
|
5841
|
-
`Skill
|
|
5842
|
-
|
|
5843
|
-
"
|
|
5844
|
-
"
|
|
5845
|
-
"
|
|
5874
|
+
`Skill 存储规则版本:${action.rootBinding.rootContractVersion}`,
|
|
5875
|
+
`Skill 存储定位器版本:${action.rootBinding.resolverVersion}`,
|
|
5876
|
+
`预期存储方式 / 来源:${action.rootBinding.expectedProvider} / ${action.rootBinding.expectedSource}`,
|
|
5877
|
+
`存储定位规则校验值:${action.rootBinding.resolutionContractDigest}`,
|
|
5878
|
+
`存储目录状态:${action.rootBinding.state}`,
|
|
5879
|
+
`Skill 名称:${action.targetBinding.skillName}`,
|
|
5880
|
+
`Skill 内容校验值:${detail.proposal.skillBytesDigest}`,
|
|
5881
|
+
`确认目标不存在的时间:${action.expectedAbsence.observedAt}`,
|
|
5882
|
+
"目标文件夹不存在:是",
|
|
5883
|
+
"目标 SKILL.md 不存在:是",
|
|
5884
|
+
"同名扁平 Skill 文件不存在:是"
|
|
5846
5885
|
].join("\n");
|
|
5847
5886
|
if (action.kind === "MERGE") return [
|
|
5848
|
-
`
|
|
5849
|
-
`
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
`Skill
|
|
5855
|
-
|
|
5856
|
-
|
|
5887
|
+
`Skill 存储规则版本:${action.rootBinding.rootContractVersion}`,
|
|
5888
|
+
`Skill 存储定位器版本:${action.rootBinding.resolverVersion}`,
|
|
5889
|
+
`预期存储方式 / 来源:${action.rootBinding.expectedProvider} / ${action.rootBinding.expectedSource}`,
|
|
5890
|
+
`存储定位规则校验值:${action.rootBinding.resolutionContractDigest}`,
|
|
5891
|
+
`存储目录状态:${action.rootBinding.state}`,
|
|
5892
|
+
`现有 Skill 标识:${action.baseBinding.candidateKey}`,
|
|
5893
|
+
`Skill 名称:${action.targetBinding.skillName}`,
|
|
5894
|
+
`原内容校验值:${action.baseBinding.bytesDigest}`,
|
|
5895
|
+
`原内容确认时间:${action.baseBinding.observedAt}`
|
|
5857
5896
|
].join("\n");
|
|
5858
5897
|
return [
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5898
|
+
`匹配到的现有 Skill 标识:${action.coveringCandidateBinding.candidateKey}`,
|
|
5899
|
+
`名称:${action.coveringCandidateBinding.name}`,
|
|
5900
|
+
`来源:${action.coveringCandidateBinding.source}`,
|
|
5901
|
+
`内容校验值:${action.coveringCandidateBinding.contentDigest}`,
|
|
5902
|
+
`确认时间:${action.coveringCandidateBinding.observedAt}`
|
|
5864
5903
|
].join("\n");
|
|
5865
5904
|
}
|
|
5866
5905
|
function proposalDetailAction(detail, mutationPending) {
|
|
@@ -5878,14 +5917,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5878
5917
|
const baseBytes = proposal.actionBinding.kind === "MERGE" ? proposal.actionBinding.baseBinding.exactBytes : void 0;
|
|
5879
5918
|
const coveringBytes = proposal.actionBinding.kind === "DISCARD" ? proposal.actionBinding.coveringCandidateBinding.content : void 0;
|
|
5880
5919
|
const diff = baseBytes === void 0 ? [] : makeExactLineDiff(baseBytes, proposal.exactSkillBytes);
|
|
5881
|
-
return (0, react.createElement)(react.Fragment, null, (0, react.createElement)("h3", null, `${proposal.kind}: ${makeSafeText(proposal.name)}`), (0, react.createElement)("dl", null, (0, react.createElement)("dt", null, "说明"), (0, react.createElement)("dd", null, makeSafeText(proposal.description)), (0, react.createElement)("dt", null, "何时使用"), (0, react.createElement)("dd", null, makeSafeText(proposal.whenToUse)), (0, react.createElement)("dt", null, "
|
|
5920
|
+
return (0, react.createElement)(react.Fragment, null, (0, react.createElement)("h3", null, `${proposal.kind}: ${makeSafeText(proposal.name)}`), (0, react.createElement)("dl", null, (0, react.createElement)("dt", null, "说明"), (0, react.createElement)("dd", null, makeSafeText(proposal.description)), (0, react.createElement)("dt", null, "何时使用"), (0, react.createElement)("dd", null, makeSafeText(proposal.whenToUse)), (0, react.createElement)("dt", null, "保存范围"), (0, react.createElement)("dd", null, proposal.persistenceScope === "PROJECT" ? "当前项目(PROJECT)" : "当前用户(USER)"), (0, react.createElement)("dt", null, "草稿版本"), (0, react.createElement)("dd", null, String(proposal.revision)), (0, react.createElement)("dt", null, "草稿校验值"), (0, react.createElement)("dd", null, proposal.digest), (0, react.createElement)("dt", null, "会话位置"), (0, react.createElement)("dd", null, `${coordinate.rootSessionId} / 回合 ${String(coordinate.turn)} / 消息序号 ${String(coordinate.turnEndSeq)}`), proposal.workspaceBinding === void 0 ? null : (0, react.createElement)(react.Fragment, null, (0, react.createElement)("dt", null, "项目工作区"), (0, react.createElement)("dd", null, `当前项目(PROJECT)· ${proposal.workspaceBinding.workspaceId}`)), proposal.dshHomeBinding === void 0 ? null : (0, react.createElement)(react.Fragment, null, (0, react.createElement)("dt", null, "DSH 用户目录"), (0, react.createElement)("dd", null, `当前用户(USER)· ${proposal.dshHomeBinding.resolutionKind}`), (0, react.createElement)("dt", null, "DSH 用户目录校验值"), (0, react.createElement)("dd", null, proposal.dshHomeBinding.identityDigest)), (0, react.createElement)("dt", null, "审核决定"), (0, react.createElement)("dd", null, describeReviewDecision(detail.reviewDecision)), (0, react.createElement)("dt", null, "处理状态"), (0, react.createElement)("dd", null, describeProcessingState(detail.processingState)), (0, react.createElement)("dt", null, "保存结果"), (0, react.createElement)("dd", null, describePublicationOutcome(detail.publicationOutcome))), (0, react.createElement)("h4", null, "为什么生成这份草稿"), (0, react.createElement)("p", null, makeSafeText(proposal.curationRationale)), ...detail.experiences.map((experience) => (0, react.createElement)("article", { key: experience.experienceId }, (0, react.createElement)("strong", null, `${experience.type} · ${experience.evidenceStrength}`), (0, react.createElement)("p", null, makeSafeText(experience.lesson)))), (0, react.createElement)("h4", null, "相关对话片段(已过滤)"), ...detail.evidenceRefs.map((evidence) => (0, react.createElement)("article", { key: `${String(evidence.messageSeq)}:${evidence.excerptDigest}` }, (0, react.createElement)("strong", null, `消息序号 ${String(evidence.messageSeq)}${evidence.truncated ? " · 已截断" : ""}`), (0, react.createElement)(ProposalTextView, {
|
|
5882
5921
|
value: evidence.excerpt,
|
|
5883
5922
|
mode: "SAFE",
|
|
5884
|
-
label:
|
|
5885
|
-
}))), (0, react.createElement)("h4", null, "
|
|
5923
|
+
label: `相关对话片段 ${String(evidence.messageSeq)}`
|
|
5924
|
+
}))), (0, react.createElement)("h4", null, "保存前核对信息"), (0, react.createElement)(ProposalTextView, {
|
|
5886
5925
|
value: factsFromAction(detail),
|
|
5887
5926
|
mode: "SAFE",
|
|
5888
|
-
label: "
|
|
5927
|
+
label: "保存前核对信息"
|
|
5889
5928
|
}), (0, react.createElement)("div", {
|
|
5890
5929
|
role: "group",
|
|
5891
5930
|
"aria-label": "内容显示方式",
|
|
@@ -5902,27 +5941,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5902
5941
|
onClick: () => {
|
|
5903
5942
|
props.setTextMode("RAW");
|
|
5904
5943
|
}
|
|
5905
|
-
}, "原始内容")), (0, react.createElement)("h4", null, "
|
|
5944
|
+
}, "原始内容")), (0, react.createElement)("h4", null, "将要保存的完整 SKILL.md"), (0, react.createElement)(ProposalTextView, {
|
|
5906
5945
|
value: proposal.exactSkillBytes,
|
|
5907
5946
|
mode: props.textMode,
|
|
5908
|
-
label: "
|
|
5909
|
-
}), baseBytes === void 0 ? null : (0, react.createElement)(react.Fragment, null, (0, react.createElement)("h4", null, "
|
|
5947
|
+
label: "将要保存的完整 SKILL.md"
|
|
5948
|
+
}), baseBytes === void 0 ? null : (0, react.createElement)(react.Fragment, null, (0, react.createElement)("h4", null, "合并前的 Skill 内容"), (0, react.createElement)(ProposalTextView, {
|
|
5910
5949
|
value: baseBytes,
|
|
5911
5950
|
mode: props.textMode,
|
|
5912
|
-
label: "
|
|
5913
|
-
}), (0, react.createElement)("h4", null, "
|
|
5951
|
+
label: "合并前的 Skill 内容"
|
|
5952
|
+
}), (0, react.createElement)("h4", null, "内容差异(精确对比)"), (0, react.createElement)("pre", { "aria-label": "内容差异(精确对比)" }, diff.map((line) => `${line.kind === "ADD" ? "+" : line.kind === "REMOVE" ? "-" : " "} ${makeSafeText(line.text)}`).join("\n"))), coveringBytes === void 0 ? null : (0, react.createElement)(react.Fragment, null, (0, react.createElement)("h4", null, "覆盖已有 Skill 的完整内容"), (0, react.createElement)(ProposalTextView, {
|
|
5914
5953
|
value: coveringBytes,
|
|
5915
5954
|
mode: props.textMode,
|
|
5916
5955
|
label: "覆盖已有 Skill 的完整内容"
|
|
5917
5956
|
})), (0, react.createElement)("div", {
|
|
5918
5957
|
role: "group",
|
|
5919
|
-
"aria-label": "
|
|
5958
|
+
"aria-label": "技能草稿操作",
|
|
5920
5959
|
className: _run2skill_css_run2skill_settings_page_module_css_default.actions
|
|
5921
5960
|
}, action === "RETRY_PUBLICATION" ? (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
5922
5961
|
variant: "primary",
|
|
5923
5962
|
disabled: mutationPending,
|
|
5924
5963
|
onClick: props.onRetry
|
|
5925
|
-
}, "
|
|
5964
|
+
}, "重试保存") : proposal.kind === "DISCARD" ? (0, react.createElement)(react.Fragment, null, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
5926
5965
|
variant: "primary",
|
|
5927
5966
|
disabled: !actionable,
|
|
5928
5967
|
onClick: props.onConfirmDiscard
|
|
@@ -5934,16 +5973,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5934
5973
|
variant: "primary",
|
|
5935
5974
|
disabled: !actionable,
|
|
5936
5975
|
onClick: props.onApprove
|
|
5937
|
-
}, detail.processingState === "PUBLISHING" ? "
|
|
5976
|
+
}, detail.processingState === "PUBLISHING" ? "正在保存…" : "确认并保存"), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
5938
5977
|
variant: "outline",
|
|
5939
5978
|
disabled: !actionable,
|
|
5940
5979
|
onClick: (event) => {
|
|
5941
5980
|
props.onReject(event.currentTarget);
|
|
5942
5981
|
}
|
|
5943
|
-
}, "
|
|
5982
|
+
}, "放弃草稿"))));
|
|
5944
5983
|
}
|
|
5945
5984
|
function RejectConfirmationBody(props) {
|
|
5946
|
-
return (0, react.createElement)(react.Fragment, null, (0, react.createElement)("h3", { id: "run2skill-reject-title" }, "
|
|
5985
|
+
return (0, react.createElement)(react.Fragment, null, (0, react.createElement)("h3", { id: "run2skill-reject-title" }, "确认放弃这份技能草稿?"), (0, react.createElement)("p", { id: "run2skill-reject-description" }, "现有 Skill 不会改变;这份技能草稿将离开待处理队列;经过筛选的学习材料仍按项目规则保留。"), (0, react.createElement)("button", {
|
|
5947
5986
|
type: "button",
|
|
5948
5987
|
"data-initial-focus": true,
|
|
5949
5988
|
disabled: props.disabled,
|
|
@@ -5952,7 +5991,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5952
5991
|
type: "button",
|
|
5953
5992
|
disabled: props.disabled,
|
|
5954
5993
|
onClick: props.onConfirm
|
|
5955
|
-
}, "
|
|
5994
|
+
}, "确认放弃"));
|
|
5956
5995
|
}
|
|
5957
5996
|
function RejectConfirmation(props) {
|
|
5958
5997
|
const dialogRef = (0, react.useRef)(null);
|
|
@@ -5991,6 +6030,155 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5991
6030
|
}
|
|
5992
6031
|
//#endregion
|
|
5993
6032
|
//#region src/client/run2skill-settings-page.ts
|
|
6033
|
+
const recentSkillActivityResultSchema = object({
|
|
6034
|
+
ok: literal(true),
|
|
6035
|
+
value: object({
|
|
6036
|
+
apiVersion: literal(1),
|
|
6037
|
+
visibilityRevision: string().regex(/^visibility_[a-f0-9]{64}$/),
|
|
6038
|
+
items: array(object({
|
|
6039
|
+
activityId: string().regex(/^activity_[a-f0-9]{64}$/),
|
|
6040
|
+
skillName: string().min(1).max(128),
|
|
6041
|
+
operation: _enum(["CREATED", "UPDATED"]),
|
|
6042
|
+
scope: _enum(["PROJECT", "USER"]),
|
|
6043
|
+
occurredAt: string().datetime({ offset: true })
|
|
6044
|
+
}).strict()).max(256)
|
|
6045
|
+
}).strict()
|
|
6046
|
+
}).strict();
|
|
6047
|
+
const recentSkillActivityVisibilityStaleSchema = object({
|
|
6048
|
+
ok: literal(false),
|
|
6049
|
+
error: object({ code: literal("visibility-stale") }).passthrough()
|
|
6050
|
+
}).passthrough();
|
|
6051
|
+
const RECENT_SKILL_ACTIVITY_VISIBILITY_POLL_MS = 2e3;
|
|
6052
|
+
function waitForActivityVisibilityPoll(signal, delayMs) {
|
|
6053
|
+
if (signal.aborted) return Promise.resolve();
|
|
6054
|
+
return new Promise((resolve) => {
|
|
6055
|
+
const finish = () => {
|
|
6056
|
+
globalThis.clearTimeout(timer);
|
|
6057
|
+
signal.removeEventListener("abort", finish);
|
|
6058
|
+
resolve();
|
|
6059
|
+
};
|
|
6060
|
+
const timer = globalThis.setTimeout(finish, delayMs);
|
|
6061
|
+
signal.addEventListener("abort", finish, { once: true });
|
|
6062
|
+
});
|
|
6063
|
+
}
|
|
6064
|
+
function formatActivityTime(value) {
|
|
6065
|
+
return new Intl.DateTimeFormat("zh-CN", {
|
|
6066
|
+
dateStyle: "medium",
|
|
6067
|
+
timeStyle: "short"
|
|
6068
|
+
}).format(new Date(value));
|
|
6069
|
+
}
|
|
6070
|
+
function usefulActivityScope(items, selected) {
|
|
6071
|
+
return items.some((item) => item.skillName === selected.skillName && item.scope !== selected.scope);
|
|
6072
|
+
}
|
|
6073
|
+
function RecentSkillActivitySection(props) {
|
|
6074
|
+
const scopeIdentity = JSON.stringify([
|
|
6075
|
+
props.workspaceId ?? null,
|
|
6076
|
+
props.scopeGeneration,
|
|
6077
|
+
props.hostDataEpoch ?? 0
|
|
6078
|
+
]);
|
|
6079
|
+
const [state, setState] = (0, react.useState)({
|
|
6080
|
+
phase: "IDLE",
|
|
6081
|
+
items: []
|
|
6082
|
+
});
|
|
6083
|
+
const visibleState = state.scopeIdentity === scopeIdentity ? state : {
|
|
6084
|
+
phase: "IDLE",
|
|
6085
|
+
items: []
|
|
6086
|
+
};
|
|
6087
|
+
(0, react.useEffect)(() => {
|
|
6088
|
+
if (!props.active) return;
|
|
6089
|
+
const abort = new AbortController();
|
|
6090
|
+
setState({
|
|
6091
|
+
phase: "LOADING",
|
|
6092
|
+
items: [],
|
|
6093
|
+
scopeIdentity
|
|
6094
|
+
});
|
|
6095
|
+
(async () => {
|
|
6096
|
+
const readStable = async () => {
|
|
6097
|
+
let expectedVisibilityRevision;
|
|
6098
|
+
let confirmedReads = 0;
|
|
6099
|
+
for (let attempt = 0; attempt < 8; attempt += 1) {
|
|
6100
|
+
const result = await props.call({
|
|
6101
|
+
apiVersion: 1,
|
|
6102
|
+
currentScope: currentScope(props.workspaceId, props.scopeGeneration),
|
|
6103
|
+
...expectedVisibilityRevision === void 0 ? {} : { expectedVisibilityRevision }
|
|
6104
|
+
}, abort.signal);
|
|
6105
|
+
if (abort.signal.aborted) return void 0;
|
|
6106
|
+
if (recentSkillActivityVisibilityStaleSchema.safeParse(result).success) {
|
|
6107
|
+
expectedVisibilityRevision = void 0;
|
|
6108
|
+
confirmedReads = 0;
|
|
6109
|
+
continue;
|
|
6110
|
+
}
|
|
6111
|
+
const parsed = recentSkillActivityResultSchema.safeParse(result);
|
|
6112
|
+
if (!parsed.success) throw new Error("RECENT_ACTIVITY_UNAVAILABLE");
|
|
6113
|
+
if (parsed.data.value.visibilityRevision === expectedVisibilityRevision) {
|
|
6114
|
+
confirmedReads += 1;
|
|
6115
|
+
if (confirmedReads >= 2) return parsed.data.value;
|
|
6116
|
+
} else {
|
|
6117
|
+
expectedVisibilityRevision = parsed.data.value.visibilityRevision;
|
|
6118
|
+
confirmedReads = 0;
|
|
6119
|
+
}
|
|
6120
|
+
}
|
|
6121
|
+
throw new Error("RECENT_ACTIVITY_VISIBILITY_UNSTABLE");
|
|
6122
|
+
};
|
|
6123
|
+
let current = await readStable();
|
|
6124
|
+
if (current === void 0 || abort.signal.aborted) return;
|
|
6125
|
+
setState({
|
|
6126
|
+
phase: "READY",
|
|
6127
|
+
items: current.items,
|
|
6128
|
+
scopeIdentity
|
|
6129
|
+
});
|
|
6130
|
+
while (!abort.signal.aborted) {
|
|
6131
|
+
await waitForActivityVisibilityPoll(abort.signal, props.visibilityPollMs ?? RECENT_SKILL_ACTIVITY_VISIBILITY_POLL_MS);
|
|
6132
|
+
if (abort.signal.aborted) return;
|
|
6133
|
+
const result = await props.call({
|
|
6134
|
+
apiVersion: 1,
|
|
6135
|
+
currentScope: currentScope(props.workspaceId, props.scopeGeneration),
|
|
6136
|
+
expectedVisibilityRevision: current.visibilityRevision
|
|
6137
|
+
}, abort.signal);
|
|
6138
|
+
if (abort.signal.aborted) return;
|
|
6139
|
+
const parsed = recentSkillActivityResultSchema.safeParse(result);
|
|
6140
|
+
if (recentSkillActivityVisibilityStaleSchema.safeParse(result).success || !parsed.success || parsed.data.value.visibilityRevision !== current.visibilityRevision) {
|
|
6141
|
+
setState({
|
|
6142
|
+
phase: "LOADING",
|
|
6143
|
+
items: [],
|
|
6144
|
+
scopeIdentity
|
|
6145
|
+
});
|
|
6146
|
+
current = await readStable();
|
|
6147
|
+
if (current === void 0 || abort.signal.aborted) return;
|
|
6148
|
+
} else current = parsed.data.value;
|
|
6149
|
+
setState({
|
|
6150
|
+
phase: "READY",
|
|
6151
|
+
items: current.items,
|
|
6152
|
+
scopeIdentity
|
|
6153
|
+
});
|
|
6154
|
+
}
|
|
6155
|
+
})().catch(() => {
|
|
6156
|
+
if (!abort.signal.aborted) setState({
|
|
6157
|
+
phase: "ERROR",
|
|
6158
|
+
items: [],
|
|
6159
|
+
scopeIdentity
|
|
6160
|
+
});
|
|
6161
|
+
});
|
|
6162
|
+
return () => {
|
|
6163
|
+
abort.abort();
|
|
6164
|
+
};
|
|
6165
|
+
}, [
|
|
6166
|
+
props.active,
|
|
6167
|
+
props.call,
|
|
6168
|
+
props.hostDataEpoch,
|
|
6169
|
+
props.scopeGeneration,
|
|
6170
|
+
props.visibilityPollMs,
|
|
6171
|
+
props.workspaceId,
|
|
6172
|
+
scopeIdentity
|
|
6173
|
+
]);
|
|
6174
|
+
return (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.sectionBody }, (0, react.createElement)("p", { className: _run2skill_css_run2skill_settings_page_module_css_default.muted }, "展示最近沉淀的 Skill"), visibleState.phase === "LOADING" ? (0, react.createElement)("p", { role: "status" }, "正在读取最近活动…") : null, visibleState.phase === "ERROR" ? (0, react.createElement)("p", { role: "alert" }, "最近活动暂不可用。") : null, visibleState.phase === "READY" && visibleState.items.length === 0 ? (0, react.createElement)("p", null, "最近 7 天没有成功沉淀的 Skill。") : null, visibleState.items.length === 0 ? null : (0, react.createElement)("ul", { className: _run2skill_css_run2skill_settings_page_module_css_default.activityList }, ...visibleState.items.map((item) => (0, react.createElement)("li", {
|
|
6175
|
+
className: _run2skill_css_run2skill_settings_page_module_css_default.activityItem,
|
|
6176
|
+
key: item.activityId
|
|
6177
|
+
}, (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.activitySummary }, (0, react.createElement)("strong", null, item.skillName), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, item.operation === "CREATED" ? "创建" : "更新"), usefulActivityScope(visibleState.items, item) ? (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, item.scope === "PROJECT" ? "项目" : "用户") : null), (0, react.createElement)("time", {
|
|
6178
|
+
dateTime: item.occurredAt,
|
|
6179
|
+
className: _run2skill_css_run2skill_settings_page_module_css_default.muted
|
|
6180
|
+
}, formatActivityTime(item.occurredAt))))));
|
|
6181
|
+
}
|
|
5994
6182
|
const learningIssueSchema = object({
|
|
5995
6183
|
workItemId: string().regex(/^wi_[a-f0-9]{64}$/),
|
|
5996
6184
|
workItemRevision: number().int().safe().positive(),
|
|
@@ -6028,6 +6216,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6028
6216
|
return projection;
|
|
6029
6217
|
}
|
|
6030
6218
|
const seenAttentionKeys = /* @__PURE__ */ new Set();
|
|
6219
|
+
const ATTENTION_SETTINGS_POLL_INTERVAL_MS = 1e4;
|
|
6031
6220
|
function currentScope(workspaceId, generation) {
|
|
6032
6221
|
return workspaceId === void 0 ? {
|
|
6033
6222
|
kind: "USER_ONLY",
|
|
@@ -6083,7 +6272,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6083
6272
|
return (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
|
|
6084
6273
|
key: toast.sequence,
|
|
6085
6274
|
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutline16),
|
|
6086
|
-
text: `
|
|
6275
|
+
text: `Run2Skill 有 ${String(toast.count)} 项需要处理,请前往设置 → 插件 → Run2Skill`,
|
|
6087
6276
|
onDone: () => {
|
|
6088
6277
|
setToast(void 0);
|
|
6089
6278
|
}
|
|
@@ -6092,14 +6281,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6092
6281
|
function AutomaticLearningSection(props) {
|
|
6093
6282
|
const state = (0, react.useSyncExternalStore)(props.controller.subscribe, props.controller.getSnapshot, props.controller.getSnapshot);
|
|
6094
6283
|
const disabled = state.status !== "ready" || !state.writable || state.saving;
|
|
6095
|
-
return (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.sectionBody }, (0, react.createElement)("p", { className: _run2skill_css_run2skill_settings_page_module_css_default.muted }, "
|
|
6284
|
+
return (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.sectionBody }, (0, react.createElement)("p", { className: _run2skill_css_run2skill_settings_page_module_css_default.muted }, "在后台识别可复用经验并生成待确认的技能草稿;关闭后,明确说“保存为 Skill”仍然有效。"), (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.actions }, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
6096
6285
|
variant: state.automaticLearning ? "primary" : "outline",
|
|
6097
6286
|
"aria-pressed": state.automaticLearning === true,
|
|
6098
6287
|
disabled,
|
|
6099
6288
|
onClick: () => {
|
|
6100
6289
|
props.controller.setAutomaticLearning(state.automaticLearning !== true);
|
|
6101
6290
|
}
|
|
6102
|
-
}, state.saving ? "正在保存…" : state.automaticLearning ? "自动学习已开启" : "自动学习已关闭"), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, "
|
|
6291
|
+
}, state.saving ? "正在保存…" : state.automaticLearning ? "自动学习已开启" : "自动学习已关闭"), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, "沿用当前会话模型")), state.error === void 0 ? null : (0, react.createElement)("p", {
|
|
6103
6292
|
role: "status",
|
|
6104
6293
|
className: _run2skill_css_run2skill_settings_page_module_css_default.danger
|
|
6105
6294
|
}, "设置已变化,请刷新后重试。"));
|
|
@@ -6149,10 +6338,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6149
6338
|
const rejectTriggerRef = (0, react.useRef)(null);
|
|
6150
6339
|
const items = actionableProposalItems(props.actions, state.items).filter((item) => `${item.name} ${item.description} ${item.kind}`.toLocaleLowerCase().includes(filter.trim().toLocaleLowerCase()));
|
|
6151
6340
|
const selectedActionable = items.some((item) => item.proposalRef.proposalId === state.selectedProposalId);
|
|
6341
|
+
if (props.actions.length === 0) return (0, react.createElement)(react.Fragment);
|
|
6152
6342
|
return (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.sectionBody }, (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.toolbar }, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
6153
6343
|
value: filter,
|
|
6154
|
-
placeholder: "
|
|
6155
|
-
"aria-label": "
|
|
6344
|
+
placeholder: "筛选技能草稿",
|
|
6345
|
+
"aria-label": "筛选技能草稿",
|
|
6156
6346
|
onChange: (event) => {
|
|
6157
6347
|
setFilter(event.currentTarget.value);
|
|
6158
6348
|
}
|
|
@@ -6163,7 +6353,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6163
6353
|
onClick: () => {
|
|
6164
6354
|
controller.open();
|
|
6165
6355
|
}
|
|
6166
|
-
}, "刷新")), state.listPhase === "LOADING" ? (0, react.createElement)("p", { role: "status" }, "正在加载待处理事项…") : null, state.listPhase === "ERROR" ? (0, react.createElement)("p", { role: "alert" }, "待处理事项暂不可用。") : null,
|
|
6356
|
+
}, "刷新")), state.listPhase === "LOADING" ? (0, react.createElement)("p", { role: "status" }, "正在加载待处理事项…") : null, state.listPhase === "ERROR" ? (0, react.createElement)("p", { role: "alert" }, "待处理事项暂不可用。") : null, (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.proposalLayout }, (0, react.createElement)("ul", { className: _run2skill_css_run2skill_settings_page_module_css_default.proposalList }, ...items.map((item) => (0, react.createElement)("li", { key: item.proposalRef.proposalId }, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
6167
6357
|
variant: state.selectedProposalId === item.proposalRef.proposalId ? "primary" : "outline",
|
|
6168
6358
|
className: _run2skill_css_run2skill_settings_page_module_css_default.proposalListButton,
|
|
6169
6359
|
disabled: state.mutationPending || state.detailPhase === "LOADING",
|
|
@@ -6323,7 +6513,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6323
6513
|
}), (0, react.createElement)(ManagedConfirmationModal, {
|
|
6324
6514
|
open: dismiss !== void 0,
|
|
6325
6515
|
title: "确认关闭此学习失败?",
|
|
6326
|
-
description: "该失败会从待处理列表隐藏;已有 Skill 和 DSH
|
|
6516
|
+
description: "该失败会从待处理列表隐藏;已有 Skill 和 DSH 的原始会话记录不会改变。",
|
|
6327
6517
|
disabled: pending !== void 0,
|
|
6328
6518
|
triggerRef: dismissTriggerRef,
|
|
6329
6519
|
onClose: () => {
|
|
@@ -6340,9 +6530,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6340
6530
|
function RejectProposalModal(props) {
|
|
6341
6531
|
return (0, react.createElement)(ManagedConfirmationModal, {
|
|
6342
6532
|
...props,
|
|
6343
|
-
title: "
|
|
6344
|
-
description: "现有 Skill
|
|
6345
|
-
confirmLabel: "
|
|
6533
|
+
title: "确认放弃这份技能草稿?",
|
|
6534
|
+
description: "现有 Skill 不会改变;这份技能草稿将离开待处理队列。",
|
|
6535
|
+
confirmLabel: "确认放弃"
|
|
6346
6536
|
});
|
|
6347
6537
|
}
|
|
6348
6538
|
function ManagedConfirmationModal(props) {
|
|
@@ -6431,13 +6621,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6431
6621
|
const [state, setState] = (0, react.useState)({ phase: "LOADING" });
|
|
6432
6622
|
const requestGeneration = (0, react.useRef)(0);
|
|
6433
6623
|
const activeAbort = (0, react.useRef)();
|
|
6624
|
+
const currentValue = (0, react.useRef)();
|
|
6625
|
+
const currentScopeIdentity = (0, react.useRef)();
|
|
6626
|
+
const scopeIdentity = `${props.sessionId ?? ""}:${props.workspaceId ?? ""}`;
|
|
6434
6627
|
const refresh = (0, react.useCallback)(() => {
|
|
6435
6628
|
activeAbort.current?.abort();
|
|
6436
6629
|
const abort = new AbortController();
|
|
6437
6630
|
activeAbort.current = abort;
|
|
6438
6631
|
const generation = ++requestGeneration.current;
|
|
6439
|
-
|
|
6440
|
-
|
|
6632
|
+
const scopeChanged = currentScopeIdentity.current !== scopeIdentity;
|
|
6633
|
+
currentScopeIdentity.current = scopeIdentity;
|
|
6634
|
+
if (scopeChanged) currentValue.current = void 0;
|
|
6635
|
+
if (currentValue.current === void 0) {
|
|
6636
|
+
setState({ phase: "LOADING" });
|
|
6637
|
+
props.onProjection(void 0);
|
|
6638
|
+
}
|
|
6441
6639
|
props.callAttention({
|
|
6442
6640
|
apiVersion: 1,
|
|
6443
6641
|
currentScope: currentScope(props.workspaceId, generation),
|
|
@@ -6445,15 +6643,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6445
6643
|
}, abort.signal).then((result) => {
|
|
6446
6644
|
if (abort.signal.aborted || requestGeneration.current !== generation) return;
|
|
6447
6645
|
const value = attentionValue(result);
|
|
6448
|
-
|
|
6646
|
+
if (value === void 0) {
|
|
6647
|
+
if (currentValue.current === void 0) {
|
|
6648
|
+
setState({ phase: "UNAVAILABLE" });
|
|
6649
|
+
props.onProjection(void 0);
|
|
6650
|
+
}
|
|
6651
|
+
return;
|
|
6652
|
+
}
|
|
6653
|
+
currentValue.current = value;
|
|
6654
|
+
setState({
|
|
6449
6655
|
phase: "READY",
|
|
6450
6656
|
value
|
|
6451
6657
|
});
|
|
6452
6658
|
props.onProjection(value);
|
|
6453
6659
|
}, () => {
|
|
6454
6660
|
if (abort.signal.aborted || requestGeneration.current !== generation) return;
|
|
6455
|
-
|
|
6456
|
-
|
|
6661
|
+
if (currentValue.current === void 0) {
|
|
6662
|
+
setState({ phase: "UNAVAILABLE" });
|
|
6663
|
+
props.onProjection(void 0);
|
|
6664
|
+
}
|
|
6457
6665
|
});
|
|
6458
6666
|
return () => {
|
|
6459
6667
|
abort.abort();
|
|
@@ -6464,21 +6672,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6464
6672
|
props.onProjection,
|
|
6465
6673
|
props.refreshGeneration,
|
|
6466
6674
|
props.sessionId,
|
|
6467
|
-
props.workspaceId
|
|
6675
|
+
props.workspaceId,
|
|
6676
|
+
scopeIdentity
|
|
6468
6677
|
]);
|
|
6469
|
-
(0, react.useEffect)(() =>
|
|
6678
|
+
(0, react.useEffect)(() => {
|
|
6679
|
+
if (props.active === false) {
|
|
6680
|
+
activeAbort.current?.abort();
|
|
6681
|
+
activeAbort.current = void 0;
|
|
6682
|
+
return;
|
|
6683
|
+
}
|
|
6684
|
+
refresh();
|
|
6685
|
+
const timer = setInterval(() => {
|
|
6686
|
+
refresh();
|
|
6687
|
+
}, ATTENTION_SETTINGS_POLL_INTERVAL_MS);
|
|
6688
|
+
return () => {
|
|
6689
|
+
clearInterval(timer);
|
|
6690
|
+
activeAbort.current?.abort();
|
|
6691
|
+
activeAbort.current = void 0;
|
|
6692
|
+
};
|
|
6693
|
+
}, [props.active, refresh]);
|
|
6470
6694
|
const value = state.value;
|
|
6471
|
-
|
|
6695
|
+
if (value === void 0 || value.actions.length === 0 && value.runtimeWarnings.length === 0 && value.projectCompleteness !== "UNKNOWN" && value.runtimeCompleteness !== "UNKNOWN") return (0, react.createElement)(react.Fragment);
|
|
6696
|
+
return (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.toolbar }, (0, react.createElement)(react.Fragment, null, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, `${String(value.actions.length)} 项可操作事项`), value.projectCompleteness === "UNAVAILABLE" ? (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, "未选择当前项目") : value.projectCompleteness === "UNKNOWN" ? (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, "PROJECT 状态未知") : null, value.runtimeCompleteness === "UNKNOWN" ? (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, "未保存数量未知") : null, ...value.runtimeWarnings.map((warning) => (0, react.createElement)("span", {
|
|
6472
6697
|
key: warning.noticeKey,
|
|
6473
6698
|
role: "alert"
|
|
6474
|
-
}, warning.message ?? "存在尚未持久化的学习信号。")))
|
|
6475
|
-
variant: "outline",
|
|
6476
|
-
size: "sm",
|
|
6477
|
-
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline16),
|
|
6478
|
-
onClick: () => {
|
|
6479
|
-
refresh();
|
|
6480
|
-
}
|
|
6481
|
-
}, "刷新状态"));
|
|
6699
|
+
}, warning.message ?? "存在尚未持久化的学习信号。"))));
|
|
6482
6700
|
}
|
|
6483
6701
|
function Run2skillSettingsPage(props) {
|
|
6484
6702
|
const liveSessionId = props.useSessions?.((state) => state.current);
|
|
@@ -6490,16 +6708,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6490
6708
|
const [attention, setAttention] = (0, react.useState)();
|
|
6491
6709
|
const [attentionRefresh, setAttentionRefresh] = (0, react.useState)(0);
|
|
6492
6710
|
const [scopeGeneration, setScopeGeneration] = (0, react.useState)(1);
|
|
6711
|
+
const purgeState = (0, react.useSyncExternalStore)(props.purgeController.subscribe, props.purgeController.snapshot, props.purgeController.snapshot);
|
|
6712
|
+
const purgeDataChanging = purgeState.mutationPending || purgeState.status?.state === "IN_PROGRESS" || purgeState.inProgressReceipt?.state === "IN_PROGRESS";
|
|
6493
6713
|
(0, react.useEffect)(() => {
|
|
6494
6714
|
setAttention(void 0);
|
|
6495
6715
|
setScopeGeneration((value) => value + 1);
|
|
6496
6716
|
}, [sessionId, workspaceId]);
|
|
6717
|
+
const attentionEmpty = attention !== void 0 && attention.actions.length === 0 && attention.runtimeWarnings.length === 0 && attention.projectCompleteness !== "UNKNOWN" && attention.runtimeCompleteness !== "UNKNOWN";
|
|
6497
6718
|
const disclosure = (id, title, icon, content, collapsedContent) => (0, react.createElement)("section", {
|
|
6498
6719
|
className: _run2skill_css_run2skill_settings_page_module_css_default.section,
|
|
6499
6720
|
key: id
|
|
6500
6721
|
}, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
|
|
6501
6722
|
icon,
|
|
6502
6723
|
title,
|
|
6724
|
+
rowClassName: _run2skill_css_run2skill_settings_page_module_css_default.sectionHeader,
|
|
6725
|
+
titleClassName: _run2skill_css_run2skill_settings_page_module_css_default.sectionTitle,
|
|
6503
6726
|
open: open.has(id),
|
|
6504
6727
|
expandable: true,
|
|
6505
6728
|
expandOnRowClick: true,
|
|
@@ -6517,23 +6740,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6517
6740
|
ref: hostTab.ref,
|
|
6518
6741
|
className: _run2skill_css_run2skill_settings_page_module_css_default.page,
|
|
6519
6742
|
"data-run2skill-settings-page": true
|
|
6520
|
-
}, (0, react.createElement)("p", { className: _run2skill_css_run2skill_settings_page_module_css_default.intro }, "
|
|
6743
|
+
}, (0, react.createElement)("p", { className: _run2skill_css_run2skill_settings_page_module_css_default.intro }, "Run2Skill 在后台自动沉淀经验;这里只展示需要处理的事项和持久设置。"), disclosure("attention", "需要处理", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutline16), (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.sectionBody }, (0, react.createElement)(AttentionSettingsSummary, {
|
|
6744
|
+
active: hostTab.visible && open.has("attention"),
|
|
6521
6745
|
...sessionId === void 0 ? {} : { sessionId },
|
|
6522
6746
|
...workspaceId === void 0 ? {} : { workspaceId },
|
|
6523
6747
|
callAttention: props.callAttention,
|
|
6524
6748
|
refreshGeneration: attentionRefresh,
|
|
6525
6749
|
onProjection: setAttention
|
|
6526
|
-
}), (0, react.createElement)(ProposalSettingsSection, {
|
|
6750
|
+
}), attention?.actions.some((action) => ["REVIEW_PROPOSAL", "RETRY_PUBLICATION"].includes(action.kind ?? "")) === true ? (0, react.createElement)(ProposalSettingsSection, {
|
|
6527
6751
|
...workspaceId === void 0 ? {} : { workspaceId },
|
|
6528
6752
|
callReview: props.callReview,
|
|
6529
6753
|
active: hostTab.visible && open.has("attention"),
|
|
6530
|
-
actions: attention
|
|
6531
|
-
attentionAvailable: attention !== void 0,
|
|
6754
|
+
actions: attention.actions,
|
|
6532
6755
|
onMutationSettled: () => {
|
|
6533
6756
|
setAttentionRefresh((value) => value + 1);
|
|
6534
6757
|
},
|
|
6535
6758
|
scopeGeneration
|
|
6536
|
-
}), (0, react.createElement)(LearningFailureSection, {
|
|
6759
|
+
}) : null, (0, react.createElement)(LearningFailureSection, {
|
|
6537
6760
|
...workspaceId === void 0 ? {} : { workspaceId },
|
|
6538
6761
|
call: props.callReview,
|
|
6539
6762
|
active: hostTab.visible && open.has("attention"),
|
|
@@ -6542,9 +6765,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6542
6765
|
setAttentionRefresh((value) => value + 1);
|
|
6543
6766
|
},
|
|
6544
6767
|
scopeGeneration
|
|
6545
|
-
})
|
|
6768
|
+
}), attentionEmpty ? (0, react.createElement)("p", { className: _run2skill_css_run2skill_settings_page_module_css_default.empty }, "暂无") : null)), disclosure("activity", "最近活动", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconSparkle16), (0, react.createElement)(RecentSkillActivitySection, {
|
|
6769
|
+
key: JSON.stringify([
|
|
6770
|
+
workspaceId ?? null,
|
|
6771
|
+
scopeGeneration,
|
|
6772
|
+
purgeState.hostDataEpoch,
|
|
6773
|
+
hostTab.visible && open.has("activity") && !purgeDataChanging
|
|
6774
|
+
]),
|
|
6775
|
+
...workspaceId === void 0 ? {} : { workspaceId },
|
|
6776
|
+
call: props.callActivity,
|
|
6777
|
+
active: hostTab.visible && open.has("activity") && !purgeDataChanging,
|
|
6778
|
+
scopeGeneration,
|
|
6779
|
+
hostDataEpoch: purgeState.hostDataEpoch
|
|
6780
|
+
}), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, "最近 7 天")), disclosure("automatic", "自动学习", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconSettingsOutline16), (0, react.createElement)(AutomaticLearningSection, { controller: props.controller })), disclosure("purge", "缓存清理", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutline16), (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.sectionBody }, (0, react.createElement)(PurgeSettingsSection, {
|
|
6546
6781
|
controller: props.purgeController,
|
|
6547
|
-
active: hostTab.visible && open.has("
|
|
6782
|
+
active: hostTab.visible && open.has("purge"),
|
|
6783
|
+
onCompleted: () => {
|
|
6784
|
+
setAttentionRefresh((value) => value + 1);
|
|
6785
|
+
}
|
|
6548
6786
|
}))));
|
|
6549
6787
|
}
|
|
6550
6788
|
function currentSessionId(context) {
|
|
@@ -6558,6 +6796,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6558
6796
|
const controller = new AutomaticLearningSettingsController(context.settingsScope.bind({ namespace: "run2skill" }));
|
|
6559
6797
|
const callReview = async (endpoint, payload, signal) => await context.connection.rpc.call(RUN2SKILL_RPC_CHANNEL, endpoint, payload, signal);
|
|
6560
6798
|
const callAttention = async (payload, signal) => await context.connection.rpc.call(RUN2SKILL_RPC_CHANNEL, "attention", payload, signal);
|
|
6799
|
+
const callActivity = async (payload, signal) => await context.connection.rpc.call(RUN2SKILL_RPC_CHANNEL, "recent-activity/list", payload, signal);
|
|
6561
6800
|
const callPurge = async (endpoint, payload, signal) => await context.connection.rpc.call(RUN2SKILL_RPC_CHANNEL, endpoint, payload, signal);
|
|
6562
6801
|
const purgeController = new PurgeSettingsController(callPurge, () => workspaceFor(context, currentSessionId(context)));
|
|
6563
6802
|
context.effect(() => {
|
|
@@ -6572,14 +6811,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6572
6811
|
name: "settings.plugins.tab",
|
|
6573
6812
|
id: "run2skill",
|
|
6574
6813
|
order: 20,
|
|
6575
|
-
label: "
|
|
6814
|
+
label: "Run2Skill",
|
|
6576
6815
|
inject: () => ({
|
|
6577
6816
|
controller,
|
|
6578
6817
|
purgeController,
|
|
6579
6818
|
workspaceId: workspaceFor(context, currentSessionId(context)),
|
|
6580
6819
|
sessionId: currentSessionId(context),
|
|
6581
6820
|
callAttention,
|
|
6582
|
-
callReview
|
|
6821
|
+
callReview,
|
|
6822
|
+
callActivity
|
|
6583
6823
|
})
|
|
6584
6824
|
}, Run2skillSettingsPage));
|
|
6585
6825
|
context.slots.inject("conversation.session.header.actions", () => context.slots.register({
|
|
@@ -6759,6 +6999,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6759
6999
|
exports.ProposalTextView = ProposalTextView;
|
|
6760
7000
|
exports.PurgeSettingsController = PurgeSettingsController;
|
|
6761
7001
|
exports.PurgeSettingsSection = PurgeSettingsSection;
|
|
7002
|
+
exports.RecentSkillActivitySection = RecentSkillActivitySection;
|
|
6762
7003
|
exports.RejectConfirmationBody = RejectConfirmationBody;
|
|
6763
7004
|
exports.RejectProposalModal = RejectProposalModal;
|
|
6764
7005
|
exports.Run2skillAttentionToast = Run2skillAttentionToast;
|