dsh-duet 0.3.1 → 0.3.2

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.
Files changed (40) hide show
  1. package/assets/avatar/desktop/companion.mjs +3 -4
  2. package/assets/avatar/desktop/manifest.json +1 -1
  3. package/desktop/bin/darwin-arm64/duet-avatar.app/Contents/MacOS/duet-avatar +0 -0
  4. package/desktop/bin/darwin-arm64/manifest.json +3 -3
  5. package/desktop/bin/win32-x64/duet-avatar.exe +0 -0
  6. package/desktop/bin/win32-x64/manifest.json +3 -3
  7. package/node_modules/dsh-duet-superagent/lib/duet.d.ts +17 -2
  8. package/node_modules/dsh-duet-superagent/lib/duet.js +99 -4
  9. package/node_modules/dsh-duet-superagent/lib/{feishu-rAGM9U9b.js → feishu-CwKBb-B_.js} +1 -1
  10. package/node_modules/dsh-duet-superagent/lib/feishu-watch.d.ts +1 -1
  11. package/node_modules/dsh-duet-superagent/lib/feishu-watch.js +1 -1
  12. package/node_modules/dsh-duet-superagent/lib/{github-pull-gSbjzypm.js → github-pull-DyfAy0yE.js} +1 -1
  13. package/node_modules/dsh-duet-superagent/lib/github-watch.d.ts +1 -1
  14. package/node_modules/dsh-duet-superagent/lib/github-watch.js +2 -2
  15. package/node_modules/dsh-duet-superagent/lib/index.js +2 -2
  16. package/node_modules/dsh-duet-superagent/lib/{poll-Dh7J1cdM.js → poll-BBkmV_GM.js} +4 -1
  17. package/node_modules/dsh-duet-superagent/lib/{registry-BTgyFZ8S.d.ts → registry-Ehgir8LC.d.ts} +70 -61
  18. package/node_modules/dsh-duet-superagent/lib/{runtime-mbw1-2iK.js → runtime-Ow0S-7ZZ.js} +44 -4
  19. package/package.json +1 -1
  20. package/src/avatar/surface.mjs +6 -1
  21. package/src/client/agent-tasks.mjs +34 -5
  22. package/src/client/audio.mjs +1 -1
  23. package/src/client/avatar-surfaces.mjs +3 -3
  24. package/src/client/browser.mjs +22 -22
  25. package/src/client/composer-bridge.mjs +1 -1
  26. package/src/client/connection-hint.mjs +1 -1
  27. package/src/client/entry.js +2 -2
  28. package/src/client/feedback.mjs +1 -1
  29. package/src/client/identity.mjs +1 -1
  30. package/src/client/settings.html +4 -4
  31. package/src/client/tutorial-adapter.mjs +5 -5
  32. package/src/client/tutorial.mjs +1 -1
  33. package/src/client/work-mode.mjs +12 -6
  34. package/src/host/plugin.mjs +4 -2
  35. package/src/shared/avatar-menu-ui.mjs +30 -12
  36. package/src/shared/avatar-menu.mjs +4 -1
  37. package/src/shared/avatar-surface.mjs +1 -0
  38. package/src/shared/avatar-ui.mjs +2 -0
  39. package/src/shared/state.mjs +1 -1
  40. package/src/shared/work-mode.mjs +20 -0
@@ -12,6 +12,71 @@ declare const ADMISSION_OPTIONS: {
12
12
  };
13
13
  type AdmissionRow = { [C in AdmissionCell]?: typeof ADMISSION_OPTIONS[C][number]; };
14
14
  //#endregion
15
+ //#region src/policy.d.ts
16
+ declare const RoleModelSchema: z.ZodObject<{
17
+ provider: z.ZodString;
18
+ model: z.ZodString;
19
+ reasoningEffort: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strict>;
21
+ type RoleModel = z.infer<typeof RoleModelSchema>;
22
+ declare const SettingsSchema: z.ZodObject<{
23
+ paused: z.ZodDefault<z.ZodBoolean>;
24
+ sources: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
25
+ enabled: z.ZodDefault<z.ZodBoolean>;
26
+ config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
+ }, z.core.$strict>>>;
28
+ policy: z.ZodDefault<z.ZodObject<{
29
+ rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
30
+ id: z.ZodString;
31
+ name: z.ZodString;
32
+ enabled: z.ZodBoolean;
33
+ instruction: z.ZodString;
34
+ }, z.core.$strict>>>;
35
+ sources: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
36
+ allowed: z.ZodDefault<z.ZodArray<z.ZodObject<{
37
+ id: z.ZodString;
38
+ name: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strict>>>;
40
+ admission: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<AdmissionRow, unknown, z.core.$ZodTypeInternals<AdmissionRow, unknown>>>>;
41
+ }, z.core.$catchall<z.ZodUnknown>>>>;
42
+ }, z.core.$strict>>;
43
+ eval: z.ZodDefault<z.ZodObject<{
44
+ mode: z.ZodDefault<z.ZodEnum<{
45
+ off: "off";
46
+ observe: "observe";
47
+ auto: "auto";
48
+ }>>;
49
+ timeoutSeconds: z.ZodDefault<z.ZodNumber>;
50
+ model: z.ZodDefault<z.ZodNullable<z.ZodObject<{
51
+ provider: z.ZodString;
52
+ model: z.ZodString;
53
+ reasoningEffort: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strict>>>;
55
+ }, z.core.$strict>>;
56
+ executor: z.ZodDefault<z.ZodObject<{
57
+ model: z.ZodDefault<z.ZodNullable<z.ZodObject<{
58
+ provider: z.ZodString;
59
+ model: z.ZodString;
60
+ reasoningEffort: z.ZodOptional<z.ZodString>;
61
+ }, z.core.$strict>>>;
62
+ maxWorkers: z.ZodDefault<z.ZodNumber>;
63
+ directory: z.ZodDefault<z.ZodString>;
64
+ prepare: z.ZodDefault<z.ZodString>;
65
+ blockedCommands: z.ZodDefault<z.ZodArray<z.ZodString>>;
66
+ }, z.core.$strict>>;
67
+ }, z.core.$strict>;
68
+ type Settings = z.infer<typeof SettingsSchema>;
69
+ type SettingsBlock = 'policy' | 'eval' | 'executor' | `source:${string}`;
70
+ type SettingsSave = SettingsBlock | 'pause';
71
+ type SettingsOrigin = 'panel' | 'tool' | 'sync';
72
+ //#endregion
73
+ //#region src/app/role-models.d.ts
74
+ type ModelDisplay = {
75
+ provider: string;
76
+ model: string;
77
+ source: 'response' | 'request' | 'selection' | 'configured';
78
+ };
79
+ //#endregion
15
80
  //#region src/infra/commands.d.ts
16
81
  interface Tally {
17
82
  skipped: number;
@@ -82,64 +147,6 @@ interface SetupProblem {
82
147
  detail: string;
83
148
  }
84
149
  //#endregion
85
- //#region src/policy.d.ts
86
- declare const RoleModelSchema: z.ZodObject<{
87
- provider: z.ZodString;
88
- model: z.ZodString;
89
- reasoningEffort: z.ZodOptional<z.ZodString>;
90
- }, z.core.$strict>;
91
- type RoleModel = z.infer<typeof RoleModelSchema>;
92
- declare const SettingsSchema: z.ZodObject<{
93
- paused: z.ZodDefault<z.ZodBoolean>;
94
- sources: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
95
- enabled: z.ZodDefault<z.ZodBoolean>;
96
- config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
97
- }, z.core.$strict>>>;
98
- policy: z.ZodDefault<z.ZodObject<{
99
- rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
100
- id: z.ZodString;
101
- name: z.ZodString;
102
- enabled: z.ZodBoolean;
103
- instruction: z.ZodString;
104
- }, z.core.$strict>>>;
105
- sources: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
106
- allowed: z.ZodDefault<z.ZodArray<z.ZodObject<{
107
- id: z.ZodString;
108
- name: z.ZodOptional<z.ZodString>;
109
- }, z.core.$strict>>>;
110
- admission: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<AdmissionRow, unknown, z.core.$ZodTypeInternals<AdmissionRow, unknown>>>>;
111
- }, z.core.$catchall<z.ZodUnknown>>>>;
112
- }, z.core.$strict>>;
113
- eval: z.ZodDefault<z.ZodObject<{
114
- mode: z.ZodDefault<z.ZodEnum<{
115
- off: "off";
116
- observe: "observe";
117
- auto: "auto";
118
- }>>;
119
- timeoutSeconds: z.ZodDefault<z.ZodNumber>;
120
- model: z.ZodDefault<z.ZodNullable<z.ZodObject<{
121
- provider: z.ZodString;
122
- model: z.ZodString;
123
- reasoningEffort: z.ZodOptional<z.ZodString>;
124
- }, z.core.$strict>>>;
125
- }, z.core.$strict>>;
126
- executor: z.ZodDefault<z.ZodObject<{
127
- model: z.ZodDefault<z.ZodNullable<z.ZodObject<{
128
- provider: z.ZodString;
129
- model: z.ZodString;
130
- reasoningEffort: z.ZodOptional<z.ZodString>;
131
- }, z.core.$strict>>>;
132
- maxWorkers: z.ZodDefault<z.ZodNumber>;
133
- directory: z.ZodDefault<z.ZodString>;
134
- prepare: z.ZodDefault<z.ZodString>;
135
- blockedCommands: z.ZodDefault<z.ZodArray<z.ZodString>>;
136
- }, z.core.$strict>>;
137
- }, z.core.$strict>;
138
- type Settings = z.infer<typeof SettingsSchema>;
139
- type SettingsBlock = 'policy' | 'eval' | 'executor' | `source:${string}`;
140
- type SettingsSave = SettingsBlock | 'pause';
141
- type SettingsOrigin = 'panel' | 'tool' | 'sync';
142
- //#endregion
143
150
  //#region src/app/execution-environment.d.ts
144
151
  interface Variable {
145
152
  key: string;
@@ -555,6 +562,8 @@ declare class Sessions {
555
562
  } | {
556
563
  model_retry?: undefined;
557
564
  };
565
+ /** Observed request/response first; a pending selection is never labelled as executed. */
566
+ modelInfo(sessionId: string): ModelDisplay | null;
558
567
  private updateModelHealth;
559
568
  private ticketOf;
560
569
  private decorate;
@@ -661,7 +670,7 @@ declare class Prompts {
661
670
  key: string;
662
671
  text: string;
663
672
  } | {
664
- name: "scope" | "communication" | "delivery";
673
+ name: "scope" | "delivery" | "communication";
665
674
  kind: "team";
666
675
  heading: string;
667
676
  text: string;
@@ -677,7 +686,7 @@ declare class Prompts {
677
686
  key: string;
678
687
  text: string;
679
688
  } | {
680
- name: "scope" | "communication" | "delivery";
689
+ name: "scope" | "delivery" | "communication";
681
690
  kind: "team";
682
691
  heading: string;
683
692
  text: string;
@@ -1506,4 +1515,4 @@ declare class SourceRegistry implements SourceScope {
1506
1515
  private resolve;
1507
1516
  }
1508
1517
  //#endregion
1509
- export { SettingsOrigin as A, Store as C, RoleModel as D, Variable as E, Commands as M, Tally as N, Settings as O, Effects as S, HealthEntry as T, pollTicketPulls as _, Health as a, Prompts as b, GithubConfig as c, githubKind as d, inject as f, pollThreads as g, pollRound as h, TriggerContext as i, SetupProblem as j, SettingsBlock as k, Retry as l, pollFailure as m, ChannelLink as n, SourceContext as o, name as p, SourceKind as r, SourceHost as s, SourceRegistry as t, apply as u, GithubComment as v, HealthBoard as w, Sessions as x, commentTrigger as y };
1518
+ export { ModelDisplay as A, Store as C, SetupProblem as D, Variable as E, Settings as M, SettingsBlock as N, Commands as O, SettingsOrigin as P, Effects as S, HealthEntry as T, pollTicketPulls as _, Health as a, Prompts as b, GithubConfig as c, githubKind as d, inject as f, pollThreads as g, pollRound as h, TriggerContext as i, RoleModel as j, Tally as k, Retry as l, pollFailure as m, ChannelLink as n, SourceContext as o, name as p, SourceKind as r, SourceHost as s, SourceRegistry as t, apply as u, GithubComment as v, HealthBoard as w, Sessions as x, commentTrigger as y };
@@ -1,6 +1,6 @@
1
- import { A as checkedImText, B as liveTicket, C as withoutDirectory, D as Commands, F as key, G as threadKey, H as readUntil, I as followupOwners, K as ticketOutcome, L as isoTime, M as sameName, N as wordCount, P as LIMITS, R as latestAssignment, S as verifyEnvironment, T as writeEnvironment, U as runningAssignment, V as reached, W as settled, _ as WORKER_COMMANDS, b as runAsWorker, f as SETUP_FIELDS, g as workerProbe, h as resolveFeishuBot, k as SetupError, m as resolveDeployment, o as KV, q as waitsForPerson, s as health, v as agentVariables, w as workerBin, x as verifyDirectory, y as applyEnvironment, z as latestReport } from "./poll-Dh7J1cdM.js";
2
- import { i as pullOf, m as readRepositoryPath, o as readPull, p as readGithub, r as pullEndNotices, t as claimPull } from "./github-pull-gSbjzypm.js";
3
- import { b as feishuTriggerId, d as feishuChatLink, f as feishuRead, g as feishuRef, m as readFeishuLink, p as feishuReferences, r as feishuSettings } from "./feishu-rAGM9U9b.js";
1
+ import { A as checkedImText, B as liveTicket, C as withoutDirectory, D as Commands, F as key, G as threadKey, H as readUntil, I as followupOwners, K as ticketOutcome, L as isoTime, M as sameName, N as wordCount, P as LIMITS, R as latestAssignment, S as verifyEnvironment, T as writeEnvironment, U as runningAssignment, V as reached, W as settled, _ as WORKER_COMMANDS, b as runAsWorker, f as SETUP_FIELDS, g as workerProbe, h as resolveFeishuBot, k as SetupError, m as resolveDeployment, o as KV, q as waitsForPerson, s as health, v as agentVariables, w as workerBin, x as verifyDirectory, y as applyEnvironment, z as latestReport } from "./poll-BBkmV_GM.js";
2
+ import { i as pullOf, m as readRepositoryPath, o as readPull, p as readGithub, r as pullEndNotices, t as claimPull } from "./github-pull-DyfAy0yE.js";
3
+ import { b as feishuTriggerId, d as feishuChatLink, f as feishuRead, g as feishuRef, m as readFeishuLink, p as feishuReferences, r as feishuSettings } from "./feishu-CwKBb-B_.js";
4
4
  import { Service } from "@deepseek-ai/cordis";
5
5
  import { chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
6
6
  import { basename, dirname, join } from "node:path";
@@ -2838,6 +2838,7 @@ function triggerCard(trigger, disposition) {
2838
2838
  preview: preview$1(trigger.text),
2839
2839
  chars: trigger.text.length,
2840
2840
  read: `trigger/${trigger.id}`,
2841
+ ...trigger.source === "duet" && trigger.meta.duet_session ? { duet_session: trigger.meta.duet_session } : {},
2841
2842
  ...disposition ? { disposition: {
2842
2843
  ...disposition.filtered ? { filtered: reasonText(disposition.filtered) } : {},
2843
2844
  ...disposition.decisionId ? { decision_id: disposition.decisionId } : {},
@@ -5209,6 +5210,7 @@ function triggerMessage(trigger, link, note, repliesTo) {
5209
5210
  from: trigger.actor.id,
5210
5211
  thread: threadKey(trigger.threads[0]),
5211
5212
  at: trigger.at,
5213
+ ...trigger.source === "duet" && trigger.meta.duet_session ? { duet_session: trigger.meta.duet_session } : {},
5212
5214
  ...capped(trigger.text, TRIGGER_CHARS, `trigger/${trigger.id}`),
5213
5215
  ...link,
5214
5216
  ...note ? { routing_note: note } : {},
@@ -7566,6 +7568,22 @@ const THREAD_FILTERS = [
7566
7568
  ];
7567
7569
  //#endregion
7568
7570
  //#region src/app/role-models.ts
7571
+ /** A small display projection, never the request envelope or provider credentials. */
7572
+ function modelDisplay(value, source) {
7573
+ if (!value || typeof value !== "object") return null;
7574
+ const { provider, model } = value;
7575
+ return typeof provider === "string" && provider.length > 0 && typeof model === "string" && model.length > 0 ? {
7576
+ provider,
7577
+ model,
7578
+ source
7579
+ } : null;
7580
+ }
7581
+ function eventModelDisplay(event) {
7582
+ const data = event.data;
7583
+ if (event.type === "request/header") return modelDisplay(data?.header?.config, "request");
7584
+ if (event.type === "assistant/message" && data?.message?.source?.kind === "model") return modelDisplay(data.message.source, "response");
7585
+ return null;
7586
+ }
7569
7587
  /** Resolve a configured route through the live provider; catalog membership is not a restriction. */
7570
7588
  async function resolveRoleModel(ctx, model) {
7571
7589
  const effort = model.reasoningEffort === void 0 ? {} : { reasoningEffort: ReasoningEffortId(model.reasoningEffort) };
@@ -9311,6 +9329,8 @@ var Sessions = class {
9311
9329
  const agent = ctx.agents.get(session.id);
9312
9330
  const binding = agent && agent.session === session ? this.bindings.get(agent) : void 0;
9313
9331
  if (!agent || !binding || binding.subagent) return;
9332
+ const model = eventModelDisplay(event);
9333
+ if (model) this.host.store.set(KV.sessions.model(agent.id), model);
9314
9334
  this.retryHealth.observe(agent.id, event);
9315
9335
  this.updateModelHealth();
9316
9336
  });
@@ -9463,6 +9483,24 @@ var Sessions = class {
9463
9483
  const retry = sessionId ? this.retryHealth.get(sessionId) : void 0;
9464
9484
  return retry ? { model_retry: retry } : {};
9465
9485
  }
9486
+ /** Observed request/response first; a pending selection is never labelled as executed. */
9487
+ modelInfo(sessionId) {
9488
+ const observed = this.host.store.get(KV.sessions.model(sessionId));
9489
+ if (observed) return observed;
9490
+ const agent = this.ctx.agents.get(sessionId);
9491
+ const requested = modelDisplay(agent?.session.requestHeader()?.config, "request");
9492
+ if (requested) return requested;
9493
+ const selected = agent?.session.snapshotEvents().filter((e) => e.type === "model/selection").at(-1);
9494
+ if (selected) {
9495
+ const value = modelDisplay(selected.data, "selection");
9496
+ if (value) return value;
9497
+ }
9498
+ const saved = ticketOfSession(sessionId) ? this.host.store.get(`duet:worker-model:${sessionId}`) : null;
9499
+ if (saved) try {
9500
+ return modelDisplay(JSON.parse(String(saved)), "configured");
9501
+ } catch {}
9502
+ return modelDisplay(sessionId === this.host.masterId ? this.host.store.settings().eval.model : this.host.store.settings().executor.model, "configured");
9503
+ }
9466
9504
  updateModelHealth() {
9467
9505
  const retries = this.retryHealth.list();
9468
9506
  this.host.health.set(retries.length ? {
@@ -9489,6 +9527,8 @@ var Sessions = class {
9489
9527
  }
9490
9528
  const binding = { disposers: [] };
9491
9529
  this.bindings.set(agent, binding);
9530
+ const recorded = agent.session.snapshotEvents().map(eventModelDisplay).filter(Boolean).at(-1);
9531
+ if (recorded) this.host.store.set(KV.sessions.model(agent.id), recorded);
9492
9532
  this.retryHealth.restore(agent.id, agent.session.snapshotEvents());
9493
9533
  if (agent.status === "idle") this.retryHealth.clear(agent.id);
9494
9534
  this.updateModelHealth();
@@ -10650,4 +10690,4 @@ var Runtime = class extends Service {
10650
10690
  }
10651
10691
  };
10652
10692
  //#endregion
10653
- export { REASONS as a, canRetry as c, UserError as d, Engine as i, ticketStage as l, resolveRoleModel as n, reasonText as o, guides as r, said as s, Runtime as t, USER_ERRORS as u };
10693
+ export { Engine as a, said as c, USER_ERRORS as d, UserError as f, guides as i, canRetry as l, resolveRoleModel as n, REASONS as o, followupNotice as r, reasonText as s, Runtime as t, ticketStage as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-duet",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "duet(二重奏):只用语音就能操作 DSH,边听边说、随时插话的全双工语音助手。",
5
5
  "keywords": [
6
6
  "dsh-plugin",
@@ -24,7 +24,12 @@ export function mountCompanionSurface(root,{send,changed}) {
24
24
  const tag=n.kind==='break'?'br':n.kind==='heading'?'h3':n.kind==='button'?'button':n.kind==='checkbox'?'input':'span'
25
25
  const e=element(n.action||'node'+index,tag)
26
26
  if(n.taskState)e.dataset.taskState=n.taskState;else delete e.dataset.taskState
27
- if(e.textContent!==n.text)e.textContent=n.text
27
+ if(n.countdown!==undefined){
28
+ let copy=e.querySelector('[data-task-copy]'),count=e.querySelector('[data-task-countdown-label]')
29
+ if(!copy||!count){copy=document.createElement('span');copy.dataset.taskCopy='';count=document.createElement('small');count.dataset.taskCountdownLabel='';e.replaceChildren(copy,count)}
30
+ copy.textContent=n.text;copy.style.cssText='min-width:0;white-space:pre-line;overflow-wrap:anywhere'
31
+ count.textContent=`${n.countdown}s 后消失`;count.style.cssText='margin-left:auto;flex-shrink:0;color:#737b85;font:400 10px/1.4 system-ui;white-space:nowrap'
32
+ }else if(e.textContent!==n.text||e.querySelector('[data-task-countdown-label]'))e.textContent=n.text
28
33
  if(n.kind==='checkbox'){e.type='checkbox';e.checked=n.checked}
29
34
  if(n.kind==='button'||n.kind==='checkbox'){
30
35
  e.dataset.surfaceAction=n.action
@@ -1,5 +1,6 @@
1
1
  import {focusedSession,openLocalSession} from './composer.mjs'
2
- import {TASK_STATES as states, noteTaskNoticeVisit, taskCardState, visibleTaskRows} from '../shared/work-mode.mjs'
2
+ import {taskBubbleCardStyle} from '../shared/avatar-ui.mjs'
3
+ import {TASK_STATES as states, noteTaskNoticeVisit, taskCardState, visibleTaskRows, taskModelLabel, taskCompletionSeconds} from '../shared/work-mode.mjs'
3
4
  const active=new Set(['queued','pending','running','progress','waiting','waiting_user','blocked'])
4
5
  const bubbleCSS=`
5
6
  [data-duet-agent-tasks]{position:fixed;isolation:isolate;z-index:2147483599;margin:0;color:CanvasText;font:13px/1.35 -apple-system,BlinkMacSystemFont,system-ui,sans-serif}
@@ -17,7 +18,7 @@ const bubbleCSS=`
17
18
  [data-duet-agent-tasks][data-inline] summary{display:none}
18
19
  [data-duet-agent-tasks][data-inline] [data-task-list]{position:static;width:100%;max-height:65vh;overflow:auto}
19
20
  [data-duet-agent-tasks] [data-task-list]{background:transparent!important;border:0;box-shadow:none;padding:0;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
20
- [data-duet-agent-tasks] [data-task-list] button{display:flex;align-items:center;gap:12px;width:100%;box-sizing:border-box;padding:14px 16px;margin:0 0 8px;border:1px solid #ffffff90;border-radius:20px;background:#f7f9fbe8;color:#253344;text-align:left;cursor:pointer;box-shadow:0 6px 18px -8px #172c4938;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px)}
21
+ [data-duet-agent-tasks] [data-task-list] button{${taskBubbleCardStyle};margin-bottom:8px}
21
22
  [data-duet-agent-tasks] [data-task-list] button span{font-size:13px;font-weight:550;line-height:1.5;overflow-wrap:anywhere}
22
23
  [data-task-state]::before{content:'';display:block;flex:0 0 18px;width:18px;height:18px;box-sizing:border-box;border:2px solid #62a0cd45;border-top-color:#468abf;border-radius:50%;animation:duet-task-spin 1s linear infinite}
23
24
  [data-task-state=completed]::before{content:'✓';border:0;background:#dcefe8;color:#23845e;text-align:center;font:600 14px/18px system-ui;animation:none}
@@ -33,8 +34,10 @@ const bubbleCSS=`
33
34
 
34
35
  /** A local, connection-owned projection; never turn the model's short handles into UI routes. */
35
36
  export function agentTaskPanel(ctx,anchor,notice,presentation=()=>null){
36
- let box,summary,title,statusLine,count,list,attempt,currentFrame,limit=50,lifecycle,resize,mutations,raf=0,tracked
37
+ let box,summary,title,statusLine,count,list,attempt,currentFrame,limit=50,lifecycle,resize,mutations,raf=0,tracked,timer
38
+ let countdowns=[]
37
39
  function reset(){
40
+ clearInterval(timer);timer=null;countdowns=[]
38
41
  attempt?.abort();lifecycle?.abort();resize?.disconnect();mutations?.disconnect();cancelAnimationFrame(raf)
39
42
  box?.remove();box=null;currentFrame=null;tracked=null;raf=0;limit=50
40
43
  }
@@ -73,6 +76,15 @@ export function agentTaskPanel(ctx,anchor,notice,presentation=()=>null){
73
76
  maxHeight:Math.max(32,Math.min(innerHeight*.46,up?above:below))+'px'})
74
77
  }
75
78
  function schedule(){if(!raf)raf=requestAnimationFrame(()=>{raf=0;place()})}
79
+ function tick(){
80
+ for(const {row,button,label} of countdowns){
81
+ const seconds=taskCompletionSeconds(row)
82
+ if(seconds===0){update({...currentFrame,focus:null},false);return}
83
+ if(button.dataset.taskCountdown!==String(seconds)){
84
+ button.dataset.taskCountdown=String(seconds);label.textContent=`${seconds}s 后消失`
85
+ }
86
+ }
87
+ }
76
88
  function observe(){
77
89
  if(!currentFrame || document.hidden || !document.hasFocus())return
78
90
  const id=focusedSession(ctx)
@@ -148,20 +160,37 @@ export function agentTaskPanel(ctx,anchor,notice,presentation=()=>null){
148
160
  if(inline)box.open=true;else if(wasInline)box.open=false
149
161
  if(box.hidden)box.open=false
150
162
  list.replaceChildren()
163
+ countdowns=[]
151
164
  if(!rows.length)list.textContent='还没有任务'
152
165
  for(const r of rows.slice(0,limit)){
153
166
  const button=document.createElement('button');button.type='button'
154
- const label=document.createElement('span');label.textContent=r.name||'未命名任务'
167
+ const label=document.createElement('span');label.dataset.taskCopy='';label.textContent=r.name||'未命名任务'
168
+ const model=document.createElement('small');model.textContent=taskModelLabel(r.model_info)
169
+ model.style.cssText='display:block;font-size:10px;font-weight:400;opacity:.7;overflow-wrap:anywhere'
155
170
  button.dataset.taskState=taskCardState(r)
156
171
  button.title=label.textContent+' · '+(states[r.state]||'状态待确认')
157
172
  button.setAttribute('aria-label',button.title)
158
- button.append(label);button.onclick=()=>void open(r.session_id,false);list.append(button)
173
+ label.append(document.createTextNode('\n'),model)
174
+ button.append(label)
175
+ const seconds=taskCompletionSeconds(r)
176
+ if(seconds!==null){
177
+ const countdown=document.createElement('small');countdown.dataset.taskCountdownLabel=''
178
+ countdown.style.cssText='margin-left:auto;flex-shrink:0;color:#737b85;font:400 10px/1.4 system-ui;white-space:nowrap'
179
+ countdown.textContent=`${seconds}s 后消失`;button.dataset.taskCountdown=String(seconds)
180
+ button.append(countdown);countdowns.push({row:r,button,label:countdown})
181
+ }
182
+ button.onclick=()=>void open(r.session_id,false);list.append(button)
159
183
  }
160
184
  if(rows.length>limit){
161
185
  const more=document.createElement('button');more.type='button';more.textContent='查看更多任务(剩余 '+(rows.length-limit)+')'
162
186
  more.onclick=()=>{limit+=50;update({...currentFrame,focus:null},false)};list.append(more)
163
187
  }
164
188
  if(follow&&rows.some(r=>r.session_id===frame.focus))void open(frame.focus,true)
189
+ // Expire every completed row, including those behind the collapsed summary.
190
+ clearInterval(timer);timer=rows.some(r=>taskCompletionSeconds(r)!==null)?setInterval(()=>{
191
+ if(rows.some(r=>taskCompletionSeconds(r)===0))update({...currentFrame,focus:null},false)
192
+ else tick()
193
+ },1000):null
165
194
  place()
166
195
  }
167
196
  return {update,reset,observe}
@@ -1,4 +1,4 @@
1
- import { microphoneConstraints } from './microphone.mjs?v=0.3.1'
1
+ import { microphoneConstraints } from './microphone.mjs?v=0.3.2'
2
2
  import { captionCue, captionAt, AudioCaptionTimeline } from '../shared/avatar.mjs'
3
3
 
4
4
  export const AUDIO_STOP_PROTOCOL = 'audio_stop_candidates_v1'
@@ -19,8 +19,8 @@ export function mountAvatarSurfaces({avatar,canActivate=()=>false}) {
19
19
  let action=actionIds.get(node);if(!action){action=`a${++actionSerial}`;actionIds.set(node,action)}
20
20
  const gesture=node.hasAttribute('data-duet-user-gesture')&&!canActivate()
21
21
  actions.set(action,node)
22
- const text=node.matches('summary')?[...node.children].map(n=>n.textContent).join('\n'):node.textContent
23
- nodes.push({kind:node.matches('input')?'checkbox':'button',text:node.matches('input')?'':text.slice(0,4000),action,disabled:node.disabled===true,checked:node.checked===true,gesture,label:node.getAttribute('aria-label')||node.closest('label')?.textContent.slice(0,100)||'',...(node.dataset.taskState?{taskState:node.dataset.taskState}:{})})
22
+ const text=node.matches('summary')?[...node.children].map(n=>n.textContent).join('\n'):(node.querySelector('[data-task-copy]')||node).textContent
23
+ nodes.push({kind:node.matches('input')?'checkbox':'button',text:node.matches('input')?'':text.slice(0,4000),action,disabled:node.disabled===true,checked:node.checked===true,gesture,label:node.getAttribute('aria-label')||node.closest('label')?.textContent.slice(0,100)||'',...(node.dataset.taskState?{taskState:node.dataset.taskState}:{}),...(node.hasAttribute('data-task-countdown')?{countdown:Number(node.dataset.taskCountdown)}:{})})
24
24
  return
25
25
  }
26
26
  if(/^H[1-6]$/.test(node.tagName)){nodes.push({kind:'heading',text:node.textContent.slice(0,4000)});return}
@@ -46,7 +46,7 @@ export function mountAvatarSurfaces({avatar,canActivate=()=>false}) {
46
46
  const key=JSON.stringify({id,nodes,target,layout}),changed=key!==last
47
47
  // Cosmetic countdown text does not invalidate an in-flight click. All other
48
48
  // content and action state still fence stale confirmations.
49
- const actionKey=JSON.stringify({id,target,nodes:nodes.map(n=>n.action&&actions.get(n.action)?.hasAttribute('data-duet-live-text')?{...n,text:''}:n)})
49
+ const actionKey=JSON.stringify({id,target,nodes:nodes.map(({countdown,...n})=>n.action&&actions.get(n.action)?.hasAttribute('data-duet-live-text')?{...n,text:''}:n)})
50
50
  if(changed)current={id,revision:(current?.revision||0)+(actionKey!==semantic?1:0),nodes,target,...(layout?{layout}:{})}
51
51
  semantic=actionKey
52
52
  // A real click must happen in the playback document. Keep that counterpart visible.
@@ -1,29 +1,29 @@
1
- import { DuetState, PLUGIN_VERSION } from '../shared/state.mjs?v=0.3.1'
2
- import { DuetAudio, AUDIO_STOP_PROTOCOL } from './audio.mjs?v=0.3.1'
3
- import { HarnessRPCExecutor, rpcNavigationSession } from './rpc.mjs?v=0.3.1'
4
- import { composerAccess, observeComposer, focusedSession, openLocalSession } from './composer.mjs?v=0.3.1'
5
- import { startComposerBridge } from './composer-bridge.mjs?v=0.3.1'
6
- import { mountTutorial } from './tutorial.mjs?v=0.3.1'
1
+ import { DuetState, PLUGIN_VERSION } from '../shared/state.mjs?v=0.3.2'
2
+ import { DuetAudio, AUDIO_STOP_PROTOCOL } from './audio.mjs?v=0.3.2'
3
+ import { HarnessRPCExecutor, rpcNavigationSession } from './rpc.mjs?v=0.3.2'
4
+ import { composerAccess, observeComposer, focusedSession, openLocalSession } from './composer.mjs?v=0.3.2'
5
+ import { startComposerBridge } from './composer-bridge.mjs?v=0.3.2'
6
+ import { mountTutorial } from './tutorial.mjs?v=0.3.2'
7
7
  import { mountAvatarTasks } from './avatar-tasks.mjs'
8
- import { tutorialAdapter } from './tutorial-adapter.mjs?v=0.3.1'
9
- import { mountRating } from './feedback.mjs?v=0.3.1'
10
- import { createAudioUploadConsent } from './consent.mjs?v=0.3.1'
11
- import { bindDuetShortcuts } from './shortcuts.mjs?v=0.3.1'
12
- import { nativeInteractions } from './interactions.mjs?v=0.3.1'
13
- import { mountConnectionHint } from './connection-hint.mjs?v=0.3.1'
14
- import { mountControlsLayout } from './controls-layout.mjs?v=0.3.1'
15
- import { mountNotice } from './notice.mjs?v=0.3.1'
16
- import { browserSessionCatalog, sessionCreationPayload } from './workspaces.mjs?v=0.3.1'
8
+ import { tutorialAdapter } from './tutorial-adapter.mjs?v=0.3.2'
9
+ import { mountRating } from './feedback.mjs?v=0.3.2'
10
+ import { createAudioUploadConsent } from './consent.mjs?v=0.3.2'
11
+ import { bindDuetShortcuts } from './shortcuts.mjs?v=0.3.2'
12
+ import { nativeInteractions } from './interactions.mjs?v=0.3.2'
13
+ import { mountConnectionHint } from './connection-hint.mjs?v=0.3.2'
14
+ import { mountControlsLayout } from './controls-layout.mjs?v=0.3.2'
15
+ import { mountNotice } from './notice.mjs?v=0.3.2'
16
+ import { browserSessionCatalog, sessionCreationPayload } from './workspaces.mjs?v=0.3.2'
17
17
  import { workModeOnboarding } from './work-mode.mjs'
18
18
  import { agentEntryNavigation } from './agent-entry.mjs'
19
19
  import { workModeIssue, noteTaskVisit } from '../shared/work-mode.mjs'
20
- import { voiceSocketUrl, bindSettingsLink } from './transport.mjs?v=0.3.1'
21
- import { identityFetch, identityVoiceProtocols } from './identity.mjs?v=0.3.1'
22
- import { sessionLabel } from '../shared/catalog.mjs?v=0.3.1'
23
- import { resultNotification } from '../shared/result-notification.mjs?v=0.3.1'
24
- import { HarnessSync } from './harness-sync.mjs?v=0.3.1'
25
- import { LocalSync } from './local-sync.mjs?v=0.3.1'
26
- import { diagnosticPayload } from '../shared/diagnostics.mjs?v=0.3.1'
20
+ import { voiceSocketUrl, bindSettingsLink } from './transport.mjs?v=0.3.2'
21
+ import { identityFetch, identityVoiceProtocols } from './identity.mjs?v=0.3.2'
22
+ import { sessionLabel } from '../shared/catalog.mjs?v=0.3.2'
23
+ import { resultNotification } from '../shared/result-notification.mjs?v=0.3.2'
24
+ import { HarnessSync } from './harness-sync.mjs?v=0.3.2'
25
+ import { LocalSync } from './local-sync.mjs?v=0.3.2'
26
+ import { diagnosticPayload } from '../shared/diagnostics.mjs?v=0.3.2'
27
27
  import { mountAvatar } from './avatar.mjs'
28
28
  import { mountAvatarSurfaces } from './avatar-surfaces.mjs'
29
29
  import { audioUnlockPanel } from '../shared/avatar-ui.mjs'
@@ -1,5 +1,5 @@
1
1
  /** Composer requests belong to one explicit voice/tutorial connection, never all tabs. */
2
- import { focusedSession as currentSession } from './composer.mjs?v=0.3.1'
2
+ import { focusedSession as currentSession } from './composer.mjs?v=0.3.2'
3
3
 
4
4
  export function startComposerBridge(ctx, clientId, fetchImpl = fetch, feed = null, onWrite = () => {}) {
5
5
  const focusedSession = () => currentSession(ctx)
@@ -1,5 +1,5 @@
1
1
  /** A brief, non-modal invitation after the microphone is actually ready. */
2
- import {normalizeGuidance} from '../shared/connection-guidance.mjs?v=0.3.1'
2
+ import {normalizeGuidance} from '../shared/connection-guidance.mjs?v=0.3.2'
3
3
  import {AGENT_WORKSPACE_NOTICE,agentEntryReminder} from '../shared/work-mode.mjs'
4
4
  export function mountConnectionHint(controls, { duration = 8000, onShown = ()=>{}, onSettings = ()=>{} } = {}) {
5
5
  const hint = document.createElement('div')
@@ -10,7 +10,7 @@ window.__ModuleLoader__.load({
10
10
  function apply(ctx) {
11
11
  ctx.effect(() => {
12
12
  let active=true,dispose
13
- import('/duet/assets/client/agent-tool-views.mjs?v=0.3.1').then(module=>{
13
+ import('/duet/assets/client/agent-tool-views.mjs?v=0.3.2').then(module=>{
14
14
  if(active&&ctx.slots&&typeof require==='function')dispose=module.mountAgentToolViews(ctx,require('react'))
15
15
  }).catch(error=>console.warn('duet task cards could not load:',error))
16
16
  return ()=>{active=false;dispose?.()}
@@ -20,7 +20,7 @@ window.__ModuleLoader__.load({
20
20
  ctx.effect(() => {
21
21
  let active = true
22
22
  let dispose
23
- import('/duet/assets/client/browser.mjs?v=0.3.1').then(module => {
23
+ import('/duet/assets/client/browser.mjs?v=0.3.2').then(module => {
24
24
  if (active) dispose = module.mountDuet(ctx)
25
25
  }).catch(error => {
26
26
  console.warn('duet controls could not load:', error)
@@ -1,5 +1,5 @@
1
1
  /** Optional, explicit rating; never opens voice or submits without a user click. */
2
- import { identityFetch } from './identity.mjs?v=0.3.1'
2
+ import { identityFetch } from './identity.mjs?v=0.3.2'
3
3
 
4
4
  export function mountRating(anchor, sessionTicket, {origin='page'} = {}) {
5
5
  if(!sessionTicket)return null
@@ -1,5 +1,5 @@
1
1
  import { IDENTITY_HEADER, IDENTITY_TRANSPORT_HEADER, IDENTITY_TRANSPORT, IDENTITY_STORAGE,
2
- VOICE_PROTOCOL, IDENTITY_PROTOCOL_PREFIX, validIdentityToken } from '../shared/identity.mjs?v=0.3.1'
2
+ VOICE_PROTOCOL, IDENTITY_PROTOCOL_PREFIX, validIdentityToken } from '../shared/identity.mjs?v=0.3.2'
3
3
 
4
4
  /** Desktop strips plugin cookies. Keep the Host-signed value in its origin storage. */
5
5
  export function createIdentityClient(globals = globalThis) {
@@ -252,7 +252,7 @@
252
252
  if(enabled||await avatarConfirm.ask())avatarSave({enabled});
253
253
  };
254
254
  window.addEventListener('pagehide',()=>{avatarConfirm.dispose();avatarChannel?.close();window.removeEventListener('storage',avatarStorage);},{once:true});
255
- import { identityFetch } from '/duet/assets/client/identity.mjs?v=0.3.1';
255
+ import { identityFetch } from '/duet/assets/client/identity.mjs?v=0.3.2';
256
256
  import { mountWorkMode, workModeOnboarding } from '/duet/assets/client/work-mode.mjs';
257
257
  const modePreview=workModeOnboarding(undefined,{preview:true});
258
258
  let previewRequested=new URL(location.href).searchParams.get('preview')==='work-mode';
@@ -502,7 +502,7 @@
502
502
  }
503
503
  $('openTutorial').onclick = async () => {
504
504
  try {
505
- const {requestTutorial} = await import('/duet/assets/client/tutorial-request.mjs?v=0.3.1');
505
+ const {requestTutorial} = await import('/duet/assets/client/tutorial-request.mjs?v=0.3.2');
506
506
  requestTutorial(localStorage);
507
507
  $('tutorialStatus').textContent = '请回到 DSH 页面继续教学。';
508
508
  } catch { $('tutorialStatus').textContent = '暂时无法打开教学,请允许浏览器存储后重试。'; }
@@ -511,11 +511,11 @@
511
511
  setInterval(() => { loadDuetConfig().catch(showConnectionUnavailable); }, 2000);
512
512
  void loadNotices();
513
513
  setInterval(loadNotices, 60000);
514
- import('/duet/assets/client/shortcuts.mjs?v=0.3.1').then(({mountShortcutSettings}) => {
514
+ import('/duet/assets/client/shortcuts.mjs?v=0.3.2').then(({mountShortcutSettings}) => {
515
515
  const dispose = mountShortcutSettings({speaker:$('speakerShortcut'),mic:$('micShortcut'),clearSpeaker:$('clearSpeakerShortcut'),clearMic:$('clearMicShortcut'),status:$('shortcutStatus')});
516
516
  window.addEventListener('pagehide', e => {if(!e.persisted)dispose()}, {once:true});
517
517
  }).catch(() => { $('shortcutStatus').textContent = '暂时无法加载快捷键设置,请刷新重试。'; });
518
- import('/duet/assets/client/microphone.mjs?v=0.3.1').then(({mountMicrophoneSettings}) => {
518
+ import('/duet/assets/client/microphone.mjs?v=0.3.2').then(({mountMicrophoneSettings}) => {
519
519
  const dispose = mountMicrophoneSettings({select:$('microphoneDevice'),refresh:$('refreshMicrophones'),status:$('microphoneStatus')});
520
520
  window.addEventListener('pagehide', dispose, {once:true});
521
521
  }).catch(() => { $('microphoneStatus').textContent = '暂时无法加载麦克风设置,请刷新重试。'; });
@@ -1,9 +1,9 @@
1
1
  /** DSH browser services plus existing voice connection; never opens a microphone. */
2
- import { PLUGIN_VERSION } from '../shared/state.mjs?v=0.3.1'
3
- import { focusedSession } from './composer.mjs?v=0.3.1'
4
- import { sessionCreationPayload, workspaceIssue } from './workspaces.mjs?v=0.3.1'
5
- import { startComposerBridge } from './composer-bridge.mjs?v=0.3.1'
6
- import { identityFetch } from './identity.mjs?v=0.3.1'
2
+ import { PLUGIN_VERSION } from '../shared/state.mjs?v=0.3.2'
3
+ import { focusedSession } from './composer.mjs?v=0.3.2'
4
+ import { sessionCreationPayload, workspaceIssue } from './workspaces.mjs?v=0.3.2'
5
+ import { startComposerBridge } from './composer-bridge.mjs?v=0.3.2'
6
+ import { identityFetch } from './identity.mjs?v=0.3.2'
7
7
  export function tutorialAdapter(ctx, state, audio, pollReady, startBridge = startComposerBridge) {
8
8
  let narration
9
9
  const completed = new Map()
@@ -1,5 +1,5 @@
1
1
  /** Opt-in walkthrough. All writes are limited to sessions created by this run. */
2
- import {consumeTutorialRequest} from './tutorial-request.mjs?v=0.3.1'
2
+ import {consumeTutorialRequest} from './tutorial-request.mjs?v=0.3.2'
3
3
  export const TUTORIAL_KEY = 'dsh-duplex-tutorial-v1'
4
4
  export const QUESTION = '什么是语音交互?请用一句话简单解释,不使用工具。'
5
5
  export const INPUT = '用一句话介绍语音助手。'
@@ -1,5 +1,5 @@
1
- import { WORK_MODES, AGENT_PERMISSION_TEXT, AGENT_WORKSPACE_NOTICE, workModeIssue, TASK_STATES, visibleTaskRows } from '../shared/work-mode.mjs'
2
- import { identityFetch } from './identity.mjs?v=0.3.1'
1
+ import { WORK_MODES, AGENT_PERMISSION_TEXT, AGENT_WORKSPACE_NOTICE, workModeIssue, TASK_STATES, taskModelLabel } from '../shared/work-mode.mjs'
2
+ import { identityFetch } from './identity.mjs?v=0.3.2'
3
3
 
4
4
  const styles = `
5
5
  .dt-work{--ink:light-dark(#20392d,#e3eee7);--muted:light-dark(#53695c,#a7b9ae);--edge:light-dark(#cbd7cf,#3b4a40);--surface:light-dark(#fff,#191f1d);--tint:light-dark(#eef7f0,#203329);--accent:light-dark(#236548,#b3e9cb);color:var(--ink);font:normal 14px/1.5 system-ui,sans-serif;text-align:start;display:grid;gap:16px;container-type:inline-size}
@@ -147,16 +147,22 @@ export async function mountWorkMode(container, {saved=()=>{}, cancel=null, initi
147
147
  const tasks=document.createElement('details')
148
148
  if(!cancel&&!preview){
149
149
  const title=document.createElement('summary'),list=document.createElement('ul'),refresh=document.createElement('button')
150
- title.textContent='任务状态';refresh.type='button';refresh.textContent='刷新'
150
+ title.textContent='会话与模型';refresh.type='button';refresh.textContent='刷新'
151
151
  const load=async()=>{
152
152
  refresh.disabled=true
153
153
  try{
154
- const rows=visibleTaskRows((await api('agent-tasks')).rows)
154
+ const {rows=[],main}=await api('agent-tasks')
155
155
  list.replaceChildren()
156
+ const append=(name,info)=>{
157
+ const li=document.createElement('li'),label=document.createElement('strong'),model=document.createElement('small')
158
+ label.textContent=name;model.textContent=taskModelLabel(info);model.style.cssText='display:block;overflow-wrap:anywhere;color:var(--muted)'
159
+ li.style.cssText='margin:10px 0;list-style:none';li.append(label,model);list.append(li)
160
+ }
161
+ if(main)append('dsh-duet 主会话',main.model_info)
156
162
  for(const row of rows){
157
- const li=document.createElement('li');li.textContent=(row.name||'未命名任务')+' · '+(TASK_STATES[row.state]||'状态待确认');list.append(li)
163
+ append((row.name||'未命名任务')+' · '+(TASK_STATES[row.state]||'状态待确认'),row.model_info)
158
164
  }
159
- if(!rows.length)list.textContent='还没有任务'
165
+ if(!rows.length&&!main)list.textContent='还没有任务'
160
166
  }catch{list.textContent='暂时无法读取任务状态'}
161
167
  finally{refresh.disabled=false}
162
168
  }
@@ -676,8 +676,10 @@ export function apply(ctx, options = {}) {
676
676
  const policy=effectiveWorkPolicy(settings.public(),await workPolicy.get())
677
677
  if(policy.work_mode!=='agent'||policy.agent_permission_version!==1){sendJson(res,200,{rows:[]});return}
678
678
  try{
679
- const rows=await ctx.get('duetAgent').taskRows(policy.agent_options.workspace_id)
680
- sendJson(res,200,{rows:rows.map(({name,state,session_id,finished_at})=>({name,state,
679
+ const service=ctx.get('duetAgent'),workspace=policy.agent_options.workspace_id
680
+ const rows=await service.taskRows(workspace)
681
+ const main=await service.mainRow?.(workspace)??null
682
+ sendJson(res,200,{main,rows:rows.map(({name,state,session_id,finished_at,model_info})=>({name,state,model_info,
681
683
  ...(/^worker-[a-f0-9]{32}$/.test(session_id)?{session_id,finished_at}:{} )}))})
682
684
  }catch{sendError(res,503,'任务状态暂不可用')}
683
685
  return