dsh-taskbridge 1.3.1 → 1.4.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/lib/client.js CHANGED
@@ -345,7 +345,17 @@ window.__ModuleLoader__.load({
345
345
  const whole = (value, fallback) => Number.isFinite(value) ? Math.trunc(value) : fallback;
346
346
  return {
347
347
  selfCheckSeconds: whole(block.selfCheckSeconds, MONITORING_DEFAULTS.selfCheckSeconds),
348
- attentionSeconds: whole(block.attentionSeconds, MONITORING_DEFAULTS.attentionSeconds)
348
+ attentionSeconds: whole(block.attentionSeconds, MONITORING_DEFAULTS.attentionSeconds),
349
+ repeatFailureThreshold: whole(block.repeatFailureThreshold, MONITORING_DEFAULTS.repeatFailureThreshold)
350
+ };
351
+ }
352
+ function monitoringDraftOf(source) {
353
+ const block = source?.monitoring;
354
+ if (block === null || typeof block !== "object" || Array.isArray(block)) return { ...MONITORING_DEFAULTS };
355
+ return {
356
+ selfCheckSeconds: block.selfCheckSeconds,
357
+ attentionSeconds: block.attentionSeconds,
358
+ repeatFailureThreshold: block.repeatFailureThreshold === void 0 ? MONITORING_DEFAULTS.repeatFailureThreshold : block.repeatFailureThreshold
349
359
  };
350
360
  }
351
361
  function secondsToMinutes(seconds) {
@@ -443,11 +453,15 @@ window.__ModuleLoader__.load({
443
453
  selfCheckSecondsMin: 30,
444
454
  selfCheckSecondsMax: 3600,
445
455
  attentionSecondsMin: 31,
446
- attentionSecondsMax: 7200
456
+ attentionSecondsMax: 7200,
457
+ // Repeated-failure reminder: a COUNT of consecutive identical failures, 0 = off.
458
+ repeatFailureThresholdMin: 0,
459
+ repeatFailureThresholdMax: 20
447
460
  });
448
461
  var MONITORING_DEFAULTS = Object.freeze({
449
462
  selfCheckSeconds: 300,
450
- attentionSeconds: 600
463
+ attentionSeconds: 600,
464
+ repeatFailureThreshold: 3
451
465
  });
452
466
  var SELF_CHECK_LABELS = Object.freeze({
453
467
  "executor-alive-silent": "执行器健在,这段时间没有新输出",
@@ -457,6 +471,15 @@ window.__ModuleLoader__.load({
457
471
  "waiting-for-permission": "正在等待本次调用授权决定",
458
472
  settled: "任务已经结束"
459
473
  });
474
+ function repeatFailureLine(activity) {
475
+ const block = activity?.repeatFailure;
476
+ if (block === null || block === void 0) return "未采集到";
477
+ const reported = Array.isArray(block.reported) ? block.reported : [];
478
+ if (reported.length === 0) {
479
+ return block.threshold === 0 ? "已关闭" : `尚未触发(连续 ${block.threshold} 次才提醒)`;
480
+ }
481
+ return reported.map((entry) => `${entry.toolName ?? "工具"} · ${entry.failureCode ?? "error"} 连续 ${entry.consecutive} 次`).join(";");
482
+ }
460
483
  var WAIT_REASON_LABELS = Object.freeze({
461
484
  heartbeat: "没有需要处理的事(内部心跳)",
462
485
  attention: "长时间没有任何新进展,需要你判断",
@@ -726,21 +749,7 @@ window.__ModuleLoader__.load({
726
749
  if (!Number.isInteger(parallelism) || parallelism < LIMITS.maxParallelismMin || parallelism > LIMITS.maxParallelismMax) {
727
750
  problems.push(`最大并发需为 ${LIMITS.maxParallelismMin}–${LIMITS.maxParallelismMax} 之间的整数`);
728
751
  }
729
- const monitoring = monitoringOf(draft);
730
- for (const [field, label] of [
731
- ["selfCheckSeconds", "程序自检间隔"],
732
- ["attentionSeconds", "提醒你的间隔"]
733
- ]) {
734
- const value = monitoring[field];
735
- const min = field === "selfCheckSeconds" ? LIMITS.selfCheckSecondsMin : LIMITS.attentionSecondsMin;
736
- const max = field === "selfCheckSeconds" ? LIMITS.selfCheckSecondsMax : LIMITS.attentionSecondsMax;
737
- if (!Number.isInteger(value) || value < min || value > max) {
738
- problems.push(`${label}需为 ${min}–${max} 秒之间的整数`);
739
- }
740
- }
741
- if (Number.isInteger(monitoring.selfCheckSeconds) && Number.isInteger(monitoring.attentionSeconds) && monitoring.attentionSeconds <= monitoring.selfCheckSeconds) {
742
- problems.push("提醒你的间隔必须大于程序自检间隔");
743
- }
752
+ problems.push(...precheckMonitoring(monitoringDraftOf(draft)));
744
753
  return problems;
745
754
  }
746
755
  function taskStateLabel(state) {
@@ -833,7 +842,8 @@ window.__ModuleLoader__.load({
833
842
  }
834
843
  function taskProgress(task) {
835
844
  const activity = taskActivity(task);
836
- const phase = taskPhaseLabel(task?.phase);
845
+ const outcome = taskOutcome(task);
846
+ const phase = outcome.label;
837
847
  if (activity === null) {
838
848
  return {
839
849
  available: false,
@@ -894,6 +904,7 @@ window.__ModuleLoader__.load({
894
904
  const problems = [];
895
905
  const self = monitoring?.selfCheckSeconds;
896
906
  const attention = monitoring?.attentionSeconds;
907
+ const repeat = monitoring?.repeatFailureThreshold === void 0 ? MONITORING_DEFAULTS.repeatFailureThreshold : monitoring.repeatFailureThreshold;
897
908
  if (!Number.isInteger(self) || self < LIMITS.selfCheckSecondsMin || self > LIMITS.selfCheckSecondsMax) {
898
909
  problems.push(`程序自检间隔需为 ${LIMITS.selfCheckSecondsMin}–${LIMITS.selfCheckSecondsMax} 秒之间的整数`);
899
910
  }
@@ -903,14 +914,61 @@ window.__ModuleLoader__.load({
903
914
  if (Number.isInteger(self) && Number.isInteger(attention) && attention <= self) {
904
915
  problems.push("提醒你的间隔必须大于程序自检间隔");
905
916
  }
917
+ if (!Number.isInteger(repeat) || repeat < LIMITS.repeatFailureThresholdMin || repeat > LIMITS.repeatFailureThresholdMax) {
918
+ problems.push(`重复失败提醒次数需为 ${LIMITS.repeatFailureThresholdMin}–${LIMITS.repeatFailureThresholdMax} 之间的整数(0 表示关闭)`);
919
+ }
906
920
  return problems;
907
921
  }
908
922
  function taskOutcome(task) {
909
923
  const state = String(task?.state ?? "");
910
- const accepted = task?.hostAcceptance !== null && task?.hostAcceptance !== void 0;
911
- const executed = state === "awaiting-host-review" || accepted === true;
912
- const note = state === "awaiting-host-review" ? "执行已完成,等待宿主(Codex)审查;插件不会自行验收。" : accepted === true ? "宿主已记录验收结论。" : state === "failed" ? "执行失败;错误详情见下方证据。" : state === "cancelled" ? "任务已取消,未产生验收结论。" : "任务尚未产生结果。";
913
- return { label: taskStateLabel(state), executed, accepted, note };
924
+ const acceptance = task?.hostAcceptance;
925
+ const accepted = acceptance !== null && acceptance !== void 0 && acceptance.accepted === true;
926
+ const decided = acceptance !== null && acceptance !== void 0;
927
+ const executed = state === "awaiting-host-review" || decided;
928
+ let label;
929
+ let tone;
930
+ let note;
931
+ let phaseLabel;
932
+ if (accepted) {
933
+ label = "审查通过";
934
+ tone = "on";
935
+ note = "宿主已记录验收结论:审查通过。";
936
+ phaseLabel = null;
937
+ } else if (decided) {
938
+ label = "需要修正";
939
+ tone = "warn";
940
+ note = "宿主已记录验收结论:需要修正(本任务的执行结果未被接受)。";
941
+ phaseLabel = null;
942
+ } else if (state === "awaiting-host-review") {
943
+ label = "等待宿主审查";
944
+ tone = "warn";
945
+ note = "执行已完成,等待宿主(Codex)审查;插件不会自行验收。";
946
+ phaseLabel = null;
947
+ } else if (state === "failed") {
948
+ label = taskStateLabel(state);
949
+ tone = "warn";
950
+ note = "执行失败;错误详情见下方证据。";
951
+ phaseLabel = null;
952
+ } else if (state === "cancelled") {
953
+ label = taskStateLabel(state);
954
+ tone = "off";
955
+ note = "任务已取消,未产生验收结论。";
956
+ phaseLabel = null;
957
+ } else {
958
+ label = taskStateLabel(state);
959
+ tone = state === "running" ? "on" : "off";
960
+ note = "任务尚未产生结果。";
961
+ phaseLabel = taskPhaseLabel(task?.phase);
962
+ }
963
+ return { label, tone, executed, accepted, decided, phaseLabel, note };
964
+ }
965
+ function hostReviewLine(task, formatTime2) {
966
+ const acceptance = task?.hostAcceptance;
967
+ if (acceptance === null || acceptance === void 0) return "未记录(插件不会自行验收)";
968
+ const label = acceptance.accepted === true ? "审查通过" : "需要修正";
969
+ const at = typeof acceptance.acceptedAt === "number" ? `(${formatTime2(acceptance.acceptedAt)})` : "";
970
+ const note = typeof acceptance.note === "string" && acceptance.note !== "" ? `:${boundedText(acceptance.note, 200)}` : "";
971
+ return `${label}${at}${note}`;
914
972
  }
915
973
  function changedFiles(task) {
916
974
  const candidates = [task?.diff?.files, task?.diff?.changedFiles, task?.changedFiles];
@@ -1633,22 +1691,26 @@ window.__ModuleLoader__.load({
1633
1691
  });
1634
1692
  },
1635
1693
  /**
1636
- * Replace only the two silence thresholds.
1694
+ * Replace the silence thresholds and the repeated-failure count.
1637
1695
  *
1638
1696
  * The narrow route exists so an operator adjusting a timer cannot rewrite a
1639
1697
  * provider list. On success the committed document is adopted for `settings` and
1640
1698
  * the draft's monitoring block, and OTHER unsaved draft edits are left alone —
1641
1699
  * a timer save must never discard a half-finished provider edit.
1642
- * @param {{ selfCheckSeconds: number, attentionSeconds: number }} monitoring - already-validated block.
1700
+ *
1701
+ * Order matters: the RAW block is validated first and only then normalized for the
1702
+ * wire. Validating the normalized block would accept a cleared field, because
1703
+ * `monitoringOf` replaces it with the documented default.
1704
+ * @param {{ selfCheckSeconds: number, attentionSeconds: number, repeatFailureThreshold: number }} monitoring - the block as the operator typed it.
1643
1705
  * @returns {Promise<{ ok: boolean, error?: unknown }>} outcome.
1644
1706
  */
1645
1707
  async saveMonitoring(monitoring) {
1646
- const normalized = monitoringOf({ monitoring });
1647
- const problems = precheckMonitoring(normalized);
1708
+ const problems = precheckMonitoring(monitoring);
1648
1709
  if (problems.length > 0) {
1649
1710
  notify("error", `未保存:${problems.join(";")}`);
1650
1711
  return { ok: false, problems };
1651
1712
  }
1713
+ const normalized = monitoringOf({ monitoring });
1652
1714
  return await track("monitoring", async () => {
1653
1715
  try {
1654
1716
  const body = await api.putMonitoring(normalized);
@@ -2550,14 +2612,22 @@ window.__ModuleLoader__.load({
2550
2612
  }
2551
2613
  function MonitoringCard({ store, snapshot }) {
2552
2614
  const draft = snapshot.draft;
2553
- const monitoring = monitoringOf(draft);
2615
+ const raw = monitoringDraftOf(draft);
2554
2616
  const saved = monitoringOf(snapshot.settings);
2555
2617
  const [saving, setSaving] = (0, import_react.useState)(false);
2556
- const problems = precheckMonitoring(monitoring);
2557
- const dirty = monitoring.selfCheckSeconds !== saved.selfCheckSeconds || monitoring.attentionSeconds !== saved.attentionSeconds;
2558
- const edit = (field, raw) => {
2618
+ const problems = precheckMonitoring(raw);
2619
+ const dirty = raw.selfCheckSeconds !== saved.selfCheckSeconds || raw.attentionSeconds !== saved.attentionSeconds || raw.repeatFailureThreshold !== saved.repeatFailureThreshold;
2620
+ const edit = (field, rawMinutes) => {
2559
2621
  store.editDraft((current) => {
2560
- current.monitoring = { ...monitoringOf(current), [field]: minutesToSeconds(raw) };
2622
+ current.monitoring = { ...monitoringDraftOf(current), [field]: minutesToSeconds(rawMinutes) };
2623
+ });
2624
+ };
2625
+ const editFailureCount = (value) => {
2626
+ store.editDraft((current) => {
2627
+ current.monitoring = {
2628
+ ...monitoringDraftOf(current),
2629
+ repeatFailureThreshold: value === "" ? "" : Number(value)
2630
+ };
2561
2631
  });
2562
2632
  };
2563
2633
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshdg-card", "data-dshdg-monitoring": "", children: [
@@ -2572,7 +2642,7 @@ window.__ModuleLoader__.load({
2572
2642
  {
2573
2643
  label: "程序自检间隔(分钟)",
2574
2644
  htmlFor: "dshdg-monitoring-selfcheck",
2575
- hint: `${LIMITS.selfCheckSecondsMin / 60}–${LIMITS.selfCheckSecondsMax / 60} 分钟;存成整秒(当前 ${monitoring.selfCheckSeconds} 秒)`,
2645
+ hint: `${LIMITS.selfCheckSecondsMin / 60}–${LIMITS.selfCheckSecondsMax / 60} 分钟;存成整秒(当前 ${raw.selfCheckSeconds === "" ? "未填" : `${raw.selfCheckSeconds} 秒`})`,
2576
2646
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2577
2647
  "input",
2578
2648
  {
@@ -2582,10 +2652,10 @@ window.__ModuleLoader__.load({
2582
2652
  min: LIMITS.selfCheckSecondsMin / 60,
2583
2653
  max: LIMITS.selfCheckSecondsMax / 60,
2584
2654
  step: 0.5,
2585
- value: String(Number.isFinite(secondsToMinutes(monitoring.selfCheckSeconds)) ? secondsToMinutes(monitoring.selfCheckSeconds) : ""),
2655
+ value: String(Number.isFinite(secondsToMinutes(raw.selfCheckSeconds)) ? secondsToMinutes(raw.selfCheckSeconds) : ""),
2586
2656
  onChange: (event) => {
2587
- const raw = event.target.value;
2588
- edit("selfCheckSeconds", raw === "" ? "" : raw);
2657
+ const value = event.target.value;
2658
+ edit("selfCheckSeconds", value === "" ? "" : value);
2589
2659
  }
2590
2660
  }
2591
2661
  )
@@ -2596,7 +2666,7 @@ window.__ModuleLoader__.load({
2596
2666
  {
2597
2667
  label: "提醒你的间隔(分钟)",
2598
2668
  htmlFor: "dshdg-monitoring-attention",
2599
- hint: `${LIMITS.attentionSecondsMin / 60}–${LIMITS.attentionSecondsMax / 60} 分钟,且必须大于自检间隔;存成整秒(当前 ${monitoring.attentionSeconds} 秒)`,
2669
+ hint: `${LIMITS.attentionSecondsMin / 60}–${LIMITS.attentionSecondsMax / 60} 分钟,且必须大于自检间隔;存成整秒(当前 ${raw.attentionSeconds === "" ? "未填" : `${raw.attentionSeconds} 秒`})`,
2600
2670
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2601
2671
  "input",
2602
2672
  {
@@ -2606,10 +2676,33 @@ window.__ModuleLoader__.load({
2606
2676
  min: LIMITS.attentionSecondsMin / 60,
2607
2677
  max: LIMITS.attentionSecondsMax / 60,
2608
2678
  step: 0.5,
2609
- value: String(Number.isFinite(secondsToMinutes(monitoring.attentionSeconds)) ? secondsToMinutes(monitoring.attentionSeconds) : ""),
2679
+ value: String(Number.isFinite(secondsToMinutes(raw.attentionSeconds)) ? secondsToMinutes(raw.attentionSeconds) : ""),
2610
2680
  onChange: (event) => {
2611
- const raw = event.target.value;
2612
- edit("attentionSeconds", raw === "" ? "" : raw);
2681
+ const value = event.target.value;
2682
+ edit("attentionSeconds", value === "" ? "" : value);
2683
+ }
2684
+ }
2685
+ )
2686
+ }
2687
+ ),
2688
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2689
+ Field,
2690
+ {
2691
+ label: "重复失败提醒(次)",
2692
+ htmlFor: "dshdg-monitoring-repeat",
2693
+ hint: `同一工具、同一操作、同一失败连续这么多次时提醒一次;${LIMITS.repeatFailureThresholdMin} 表示关闭(当前 ${raw.repeatFailureThreshold === "" ? "未填" : `${raw.repeatFailureThreshold} 次`})`,
2694
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2695
+ "input",
2696
+ {
2697
+ id: "dshdg-monitoring-repeat",
2698
+ type: "number",
2699
+ inputMode: "numeric",
2700
+ min: LIMITS.repeatFailureThresholdMin,
2701
+ max: LIMITS.repeatFailureThresholdMax,
2702
+ step: 1,
2703
+ value: String(raw.repeatFailureThreshold),
2704
+ onChange: (event) => {
2705
+ editFailureCount(event.target.value);
2613
2706
  }
2614
2707
  }
2615
2708
  )
@@ -2620,6 +2713,11 @@ window.__ModuleLoader__.load({
2620
2713
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { className: "dshdg-hint", children: [
2621
2714
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "「没有新进展」本身不等于失败:插件不会因为安静、也不会因为单个工具跑得久就判定任务失败。" }),
2622
2715
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "只有确实没有进展、并且超过「提醒你的间隔」之后,才会把这件事报告给派工方。" }),
2716
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
2717
+ "重复失败提醒与上面两个间隔",
2718
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "互相独立" }),
2719
+ ":它数的是同一操作连续失败了几次,而不是安静了多久,所以正在忙碌地反复失败也会被提醒。它只提醒一次,不会自动取消任务、更换模型或改动超时。"
2720
+ ] }),
2623
2721
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
2624
2722
  "修改只影响",
2625
2723
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "之后新提交" }),
@@ -2636,7 +2734,7 @@ window.__ModuleLoader__.load({
2636
2734
  onClick: async () => {
2637
2735
  setSaving(true);
2638
2736
  try {
2639
- await store.saveMonitoring(monitoring);
2737
+ await store.saveMonitoring(monitoringDraftOf(draft));
2640
2738
  } finally {
2641
2739
  setSaving(false);
2642
2740
  }
@@ -2829,11 +2927,11 @@ window.__ModuleLoader__.load({
2829
2927
  const permission = permissionSummary(task);
2830
2928
  const pending = pendingPermission(task);
2831
2929
  const evidence = Array.isArray(task.permission?.evidence) ? task.permission.evidence : [];
2832
- const badgeTone = isAwaitingPermission(task) ? "warn" : task.state === "awaiting-host-review" ? "warn" : task.state === "failed" ? "warn" : "off";
2930
+ const badgeTone = isAwaitingPermission(task) ? "warn" : outcome.tone;
2833
2931
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshdg-item", children: [
2834
2932
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshdg-item-head", children: [
2835
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { className: "dshdg-mono", children: task.taskId }),
2836
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { tone: badgeTone, children: taskStateLabel(task.state) }),
2933
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: task.title || task.taskId }),
2934
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { tone: badgeTone, children: outcome.label }),
2837
2935
  isAwaitingPermission(task) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { tone: "warn", children: PERMISSION_STATE_LABELS.pending }) : null,
2838
2936
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshdg-spacer" }),
2839
2937
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -2869,7 +2967,7 @@ window.__ModuleLoader__.load({
2869
2967
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "对话" }),
2870
2968
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: execution?.conversation === null || execution?.conversation === void 0 ? task.continueFromTaskId === null || task.continueFromTaskId === void 0 ? "(未放置对话)" : `(未放置对话;本任务声明续接 ${task.continueFromTaskId})` : execution.conversation.reused === true ? `续接 ${execution.conversation.continuedFromTaskId ?? "上一任务"} · 工作区 ${execution.conversation.workspaceId ?? "—"}` : `新开 · 工作区 ${execution.conversation.workspaceId ?? "—"}` }),
2871
2969
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "阶段" }),
2872
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: taskPhaseLabel(task.phase) }),
2970
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: outcome.decided || task.state === "awaiting-host-review" ? "执行已结束" : taskPhaseLabel(task.phase) }),
2873
2971
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "最近进展" }),
2874
2972
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: activity === null || activity.lastActivityAt === null ? "未采集到" : `${formatTime(activity.lastActivityAt)}(距上次进展 ${formatDuration(activity.idleForMs)})` }),
2875
2973
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "当前工具" }),
@@ -2878,6 +2976,8 @@ window.__ModuleLoader__.load({
2878
2976
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: activity === null || activity.selfCheck === null || activity.selfCheck.verdict === null ? activity === null ? "未采集到" : "尚未触发程序自检(安静时间还没到自检间隔)" : `${SELF_CHECK_LABELS[activity.selfCheck.verdict] ?? activity.selfCheck.verdict}` + (activity.selfCheck.checkedAt === null ? "" : `(${formatTime(activity.selfCheck.checkedAt)})`) }),
2879
2977
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "监控间隔" }),
2880
2978
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: activity === null || activity.selfCheckSeconds === null ? "未采集到" : `自检 ${formatDuration(activity.selfCheckSeconds * 1e3)} · 提醒 ${formatDuration((activity.attentionSeconds ?? 0) * 1e3)}` }),
2979
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "重复失败提醒" }),
2980
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: repeatFailureLine(activity) }),
2881
2981
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "创建" }),
2882
2982
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: formatTime(task.createdAt) }),
2883
2983
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "结束" }),
@@ -2890,7 +2990,7 @@ window.__ModuleLoader__.load({
2890
2990
  review?.verdict === null || review?.verdict === void 0 ? "" : ` · ${REVIEW_VERDICT_LABELS[review.verdict] ?? review.verdict}`
2891
2991
  ] }),
2892
2992
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "宿主验收" }),
2893
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: task.hostAcceptance === null || task.hostAcceptance === void 0 ? "未记录(插件不会自行验收)" : "已由宿主记录" })
2993
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: hostReviewLine(task, formatTime) })
2894
2994
  ] }),
2895
2995
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { children: "改动文件" }),
2896
2996
  files === null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dshdg-faint", children: "宿主未回报可识别的文件摘要,请以下方原始 diff 为准。" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "dshdg-mono", children: files.map((file) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: file }, file)) }),
@@ -2995,11 +3095,13 @@ window.__ModuleLoader__.load({
2995
3095
  ] }),
2996
3096
  tasks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dshdg-faint", children: "还没有任务记录。" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dshdg-list", children: tasks.map((task) => {
2997
3097
  const progress = taskProgress(task);
3098
+ const outcome = taskOutcome(task);
3099
+ const phase = outcome.phaseLabel;
2998
3100
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshdg-item", children: [
2999
3101
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshdg-item-head", children: [
3000
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshdg-mono", children: task.taskId }),
3001
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { tone: isAwaitingPermission(task) ? "warn" : task.state === "awaiting-host-review" ? "warn" : task.state === "failed" ? "warn" : "off", children: taskStateLabel(task.state) }),
3002
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { tone: progress.tone, children: taskPhaseLabel(task.phase) }),
3102
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: task.title || task.taskId }),
3103
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { tone: isAwaitingPermission(task) ? "warn" : outcome.tone, children: outcome.label }),
3104
+ phase === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { tone: progress.tone, children: phase }),
3003
3105
  isAwaitingPermission(task) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { tone: "warn", children: PERMISSION_STATE_LABELS.pending }) : null,
3004
3106
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshdg-mono dshdg-faint", children: [
3005
3107
  task.config?.worker?.model ?? task.effective?.worker?.model ?? "—",
@@ -3072,7 +3174,7 @@ window.__ModuleLoader__.load({
3072
3174
  ] }),
3073
3175
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "dshdg-muted", children: [
3074
3176
  "点下面的按钮,把 ",
3075
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshdg-mono", children: "agents/dsh-delegate.toml" }),
3177
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshdg-mono", children: "agents/dsh-taskbridge.toml" }),
3076
3178
  " 装进 Codex 目录,并在 Codex 的 ",
3077
3179
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshdg-mono", children: "config.toml" }),
3078
3180
  " 里登记本插件的 stdio MCP 服务(delegate_status / delegate_submit / delegate_result / delegate_wait / delegate_cancel)。首次安装只会由你点击触发:打开本页、安装或升级本插件都不会自动创建子智能体文件或 MCP 条目。已经安装过的情况下,插件下次启动会把本插件自己写入的过期托管条目就地更新(例如补上 tool_timeout_sec);它不会改写非托管、被你改过的条目,也不会触碰 Codex 的其他设置。下面会显示当前条目缺了什么。"
@@ -3092,7 +3194,7 @@ window.__ModuleLoader__.load({
3092
3194
  codex.mcp?.state === "outdated" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "dshdg-hint", "data-dshdg-codex-drift": "", children: [
3093
3195
  "这个托管 MCP 条目已经过期:",
3094
3196
  codexMcpDriftText(codex.mcp),
3095
- "。插件下次启动会自动在原地更新;也可以点上面的「安装 / 更新 Codex 集成」。"
3197
+ "。插件下次启动会自动在原地更新;也可以点上面的「安装 / 更新 TaskBridge 智能体」。"
3096
3198
  ] }) : null,
3097
3199
  notes.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "dshdg-hint", children: notes.map((note) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: note.text }, note.code)) }),
3098
3200
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshdg-row", children: [
@@ -3101,7 +3203,7 @@ window.__ModuleLoader__.load({
3101
3203
  }, children: refreshing ? "读取中…" : "刷新状态" }),
3102
3204
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dshdg-primary", disabled, onClick: () => {
3103
3205
  void store.runCodexAction("install");
3104
- }, children: busy ? "处理中…" : "安装 / 更新 Codex 集成" }),
3206
+ }, children: busy ? "处理中…" : "安装 / 更新 TaskBridge 智能体" }),
3105
3207
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled, onClick: () => {
3106
3208
  void store.runCodexAction("repair");
3107
3209
  }, children: "仅修复 MCP 配置" }),
@@ -3111,7 +3213,7 @@ window.__ModuleLoader__.load({
3111
3213
  ] }),
3112
3214
  snapshot.codexOutcome === null || snapshot.codexOutcome === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dshdg-hint", children: describeCodexOutcome(snapshot.codexOutcome) })
3113
3215
  ] }),
3114
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dshdg-hint", children: "安装后需要让 Codex 重新载入:新开会话或重启 Codex,才会读到新的子智能体和 MCP 条目。本插件不宣称当前 Codex 桌面版/CLI 能在输入框用 @dsh-delegate 直接选中该子智能体——这取决于 Codex 版本自身是否提供提及选择;这里只保证子智能体文件与 MCP 工具存在,并由你在 Codex 提供的选择方式中指派它。子智能体只在明确指派时派发任务,并在提交前先检查上面的本机调用开关;本页不会替你打开该开关。同名的自定义 agent 会被保留并报告为冲突;没有本插件托管标记注释的同名 MCP 条目也视为你自己写的,不会被覆盖或删除。" })
3216
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dshdg-hint", children: "安装后需要让 Codex 重新载入:新开会话或重启 Codex,才会读到新的子智能体和 MCP 条目。本插件不宣称当前 Codex 桌面版/CLI 能在输入框用 @dsh-taskbridge 直接选中该子智能体——这取决于 Codex 版本自身是否提供提及选择;这里只保证子智能体文件与 MCP 工具存在,并由你在 Codex 提供的选择方式中指派它。子智能体只在明确指派时派发任务,并在提交前先检查上面的本机调用开关;本页不会替你打开该开关。同名的自定义 agent 会被保留并报告为冲突;没有本插件托管标记注释的同名 MCP 条目也视为你自己写的,不会被覆盖或删除。" })
3115
3217
  ] });
3116
3218
  }
3117
3219
  var TABS = Object.freeze([