agent-loft 0.2.79 → 0.2.80

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-loft",
3
- "version": "0.2.79",
3
+ "version": "0.2.80",
4
4
  "type": "module",
5
5
  "description": "多个 agent 的工作台:把本机 Claude Code / Codex 放到一处统一管理,用飞书和 Web 页面随时驱动——会话、审批、模型切换都共用",
6
6
  "keywords": [
@@ -193,7 +193,7 @@ export class ClaudeDriver implements AgentDriver {
193
193
  };
194
194
  /** 问了、还没对上回答的:tool_use id → 那条 question */
195
195
  const asked = new Map<string, HistoryMessage>();
196
- /** 任务清单:哪条回复里改过,就在那条上挂一份改完的(页面取最后一份显示进度) */
196
+ /** 任务清单:哪条回复里改过,就在那条上挂一份改完的(页面只恢复最后一轮的进度) */
197
197
  const todos = new TodoTracker();
198
198
  for (const msg of raw) {
199
199
  if (msg.parent_tool_use_id) continue;
@@ -256,7 +256,7 @@ button.conv-group:hover {
256
256
  display: grid;
257
257
  }
258
258
 
259
- /* 飞书分组的同一位置:平时显示飞书,悬停或键盘聚焦时显示新建加号。 */
259
+ /* IM 分组常驻渠道图标,桌面悬停或键盘聚焦时显示新建加号。 */
260
260
  .bot-row .conv-item.proj {
261
261
  padding-right: 36px;
262
262
  }
@@ -280,14 +280,16 @@ button.conv-group:hover {
280
280
  visibility: hidden;
281
281
  }
282
282
 
283
- .bot-row:hover .bot-new .feishu-mark,
284
- .bot-row:focus-within .bot-new .feishu-mark {
285
- visibility: hidden;
286
- }
283
+ @media (hover: hover) and (pointer: fine) {
284
+ .bot-row:hover .bot-new .feishu-mark,
285
+ .bot-row:focus-within .bot-new .feishu-mark {
286
+ visibility: hidden;
287
+ }
287
288
 
288
- .bot-row:hover .bot-new .bot-plus,
289
- .bot-row:focus-within .bot-new .bot-plus {
290
- visibility: visible;
289
+ .bot-row:hover .bot-new .bot-plus,
290
+ .bot-row:focus-within .bot-new .bot-plus {
291
+ visibility: visible;
292
+ }
291
293
  }
292
294
 
293
295
  /* 鼠标挪到右边的加号上时,整行的 hover 底色还留着 */
@@ -301,14 +303,6 @@ button.conv-group:hover {
301
303
  .proj-new {
302
304
  display: grid;
303
305
  }
304
-
305
- .bot-new .bot-plus {
306
- visibility: visible;
307
- }
308
-
309
- .bot-new .feishu-mark {
310
- visibility: hidden;
311
- }
312
306
  }
313
307
 
314
308
  .conv-item {
@@ -411,12 +405,6 @@ button.conv-group:hover {
411
405
  color: var(--fg-soft);
412
406
  }
413
407
 
414
- /* 有状态点时由状态点推到右侧,专家图标紧随其后 */
415
- .conv-item > .dot + .expert-mark,
416
- .conv-item > .conv-spin + .expert-mark {
417
- margin-left: 0;
418
- }
419
-
420
408
  .conv-item .task-mark,
421
409
  .conv-item .feishu-mark {
422
410
  flex-shrink: 0;
@@ -432,10 +420,9 @@ button.conv-group:hover {
432
420
  height: 14px;
433
421
  }
434
422
 
435
- .conv-item > .dot ~ .task-mark,
436
- .conv-item > .conv-spin ~ .task-mark,
437
- .conv-item > .dot ~ .feishu-mark,
438
- .conv-item > .conv-spin ~ .feishu-mark {
423
+ /* 尾部图标共用右侧空间,状态始终排在最后。 */
424
+ .conv-item > .task-mark ~ .dot,
425
+ .conv-item > .task-mark ~ .conv-spin {
439
426
  margin-left: 0;
440
427
  }
441
428
 
@@ -457,6 +444,11 @@ button.conv-group:hover {
457
444
  display: inline-grid;
458
445
  }
459
446
 
447
+ .conv-item:hover > .expert-mark ~ .dot,
448
+ .conv-item:hover > .expert-mark ~ .conv-spin {
449
+ margin-left: 0;
450
+ }
451
+
460
452
  .conv-item:hover .task-mark,
461
453
  .conv-item:hover .expert-mark ~ .feishu-mark {
462
454
  display: none;
@@ -214,13 +214,17 @@ export async function openConversation(key) {
214
214
  // 历史一次性加进来,最后再统一排版,免得每加一条就强制排版一次
215
215
  bulk = true;
216
216
  try {
217
+ let todos = null;
217
218
  for (const m of data.messages) {
219
+ // 面板只属于最后一轮;提问卡切开的多段回复仍算同一轮。
220
+ if (m.role === "user") todos = null;
221
+ else if (m.todos) todos = m.todos;
218
222
  if (m.role === "user") addItem({ type: "user", text: m.text, files: m.attachments ?? [], origin: null, anchor: m.anchor });
219
223
  else if (m.role === "question") addItem({ type: "ix", id: m.question.id, ix: historyQuestion(key, m) });
220
224
  else addItem({ type: "ai", steps: m.steps ?? [], committed: m.text, partial: "", done: true, footer: m.footer, at: m.ts, anchor: m.anchor, segment: m.segment });
221
225
  }
222
- // 任务清单:最后改过的那一份(进行中这一轮又改了的话,下面重放 todos 事件时换成新的)
223
- setTodos(data.messages.findLast((m) => m.todos)?.todos ?? null);
226
+ // 进行中这一轮的清单由下面重放 todos 事件恢复。
227
+ setTodos(todos);
224
228
  S.seq.set(key, 0);
225
229
  // 进行中这一轮弹过的卡(含已处理的):重放到 ix 事件时放回原位
226
230
  replayCards = new Map((data.interactions ?? []).map((ix) => [ix.id, ix]));
@@ -799,7 +803,10 @@ export function applyEvent(env) {
799
803
  S.items = S.items.filter((i) => i !== S.turnAi);
800
804
  S.turnAi = null;
801
805
  }
802
- if (!queued && (!S.turnAi || S.turnAi.done)) turnStartAt = env.ts;
806
+ if (!queued && (!S.turnAi || S.turnAi.done)) {
807
+ setTodos(null);
808
+ turnStartAt = env.ts;
809
+ }
803
810
  const it = addItem({ type: "user", text: ev.text, files: ev.files ?? ev.attachments, origin: ev.origin, id: ev.id, queued });
804
811
  // 这个页面刚发的:普通消息顶到最上面,排队消息等轮到它时再定位。
805
812
  if (S.pinNext && ev.origin?.channel === "web") {
@@ -834,11 +841,16 @@ export function applyEvent(env) {
834
841
  }
835
842
  // 轮到它了(上一轮刚出结果):挂上「思考中」占位,用时从现在算。被当成提问的回答时那一轮还在跑,不用挂
836
843
  if (ev.state === "started" && (!S.turnAi || S.turnAi.done)) {
844
+ setTodos(null);
837
845
  turnStartAt = env.ts;
838
846
  currentAi(env.ts);
839
847
  }
840
848
  return;
841
849
  }
850
+ case "turn_start":
851
+ // 包括没有新用户消息、由后台任务触发的轮次。
852
+ setTodos(null);
853
+ return;
842
854
  case "step": {
843
855
  const ai = currentAi(env.ts);
844
856
  ai.steps.push(ev.text);
@@ -539,9 +539,9 @@ export function renderSidebar() {
539
539
  orphan ? h("span", { class: "brand-icon lead fork-mark", html: ICON.fork }) : null,
540
540
  h("span", { class: "title" }, convTitle(c)),
541
541
  fold ? caret(fold.folded, fold.toggle) : null,
542
- status(fold?.folded ? fold.keys : [c.key]),
543
542
  convExpertMark(c),
544
543
  c.taskId ? h("span", { class: "brand-icon task-mark", title: "定时任务的对话", html: ICON.clock }) : null,
544
+ status(fold?.folded ? fold.keys : [c.key]),
545
545
  );
546
546
 
547
547
  // 飞书和项目共用排序,展开后的会话跟随所属分组。
@@ -10,7 +10,7 @@ let open = localStorage.getItem("aim.todosOpen") !== "0";
10
10
  /** 当前这份清单点过 ×:清单再变才重新出来 */
11
11
  let dismissed = false;
12
12
 
13
- /** 换了一份清单(null = 清空:换会话、开新对话) */
13
+ /** 换了一份清单(null = 清空:换会话、开始新一轮) */
14
14
  export function setTodos(list) {
15
15
  S.todos = list?.length ? list : null;
16
16
  dismissed = false;