@waq666/pneuma 0.8.0 → 0.8.1

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 (84) hide show
  1. package/README.md +10 -5
  2. package/lib/adapter/transcript.js +12 -1
  3. package/lib/app/Composer.js +14 -2
  4. package/lib/contract/plugin.d.ts +8 -0
  5. package/lib/contract/session.d.ts +8 -0
  6. package/lib/contract/snapshot.d.ts +5 -0
  7. package/lib/core/agent-roles.js +3 -2
  8. package/lib/core/commands-completion.d.ts +17 -0
  9. package/lib/core/commands-completion.js +56 -3
  10. package/lib/core/compact.d.ts +36 -6
  11. package/lib/core/compact.js +89 -17
  12. package/lib/core/events.d.ts +5 -0
  13. package/lib/core/git-info.d.ts +127 -15
  14. package/lib/core/git-info.js +307 -32
  15. package/lib/core/host-methods.d.ts +1 -1
  16. package/lib/core/host-methods.js +1 -0
  17. package/lib/core/llm.d.ts +9 -0
  18. package/lib/core/llm.js +1 -0
  19. package/lib/core/loop.js +8 -2
  20. package/lib/core/permission-scope.d.ts +12 -1
  21. package/lib/core/permission-scope.js +26 -1
  22. package/lib/core/presets.js +30 -2
  23. package/lib/core/session.d.ts +48 -7
  24. package/lib/core/session.js +263 -9
  25. package/lib/core/ui-methods.d.ts +1 -1
  26. package/lib/core/ui-methods.js +6 -0
  27. package/lib/plugins/agent.js +47 -6
  28. package/lib/plugins/commands.js +118 -14
  29. package/lib/plugins/compact.d.ts +2 -2
  30. package/lib/plugins/compact.js +150 -22
  31. package/lib/plugins/git.js +15 -1
  32. package/lib/plugins/goal.js +8 -4
  33. package/lib/plugins/host-stdio.js +11 -1
  34. package/lib/plugins/microcompact.d.ts +3 -0
  35. package/lib/plugins/microcompact.js +26 -0
  36. package/lib/plugins/remote.js +7 -1
  37. package/lib/plugins/runtime.js +5 -0
  38. package/lib/plugins/session.js +81 -7
  39. package/lib/plugins/skills.js +16 -0
  40. package/lib/plugins/subagent.js +47 -11
  41. package/lib/services/types.d.ts +66 -8
  42. package/lib/ui/assets/{app-MhfBFsp-.js → app-B-Jx5dnh.js} +60 -59
  43. package/lib/ui/assets/{chunk-Cq7xGE-D.js → chunk-Bfdlo8Me.js} +1 -1
  44. package/lib/ui/assets/{chunk-CA5f1pGf.js → chunk-DGX-i4eb.js} +1 -1
  45. package/lib/ui/assets/index.html +2 -2
  46. package/lib/ui/assets/style-WzxwEPaE.css +1 -0
  47. package/lib/ui/plugins/actions/bundle.json +2 -2
  48. package/lib/ui/plugins/ask/bundle.json +2 -2
  49. package/lib/ui/plugins/browser/bundle.json +2 -2
  50. package/lib/ui/plugins/composer/bundle.json +2 -2
  51. package/lib/ui/plugins/composer/client.js +57 -4
  52. package/lib/ui/plugins/files/bundle.json +2 -2
  53. package/lib/ui/plugins/manifest.json +1 -1
  54. package/lib/ui/plugins/palette/bundle.json +2 -2
  55. package/lib/ui/plugins/plugins/bundle.json +2 -2
  56. package/lib/ui/plugins/preview/bundle.json +2 -2
  57. package/lib/ui/plugins/prompt/bundle.json +2 -2
  58. package/lib/ui/plugins/sessions/bundle.json +2 -2
  59. package/lib/ui/plugins/sessions/client.js +41 -13
  60. package/lib/ui/plugins/settings/bundle.json +2 -2
  61. package/lib/ui/plugins/skills/bundle.json +2 -2
  62. package/lib/ui/plugins/status/bundle.json +2 -2
  63. package/lib/ui/plugins/status/client.js +162 -9
  64. package/lib/ui/plugins/statusbar/bundle.json +2 -2
  65. package/lib/ui/plugins/tasks/bundle.json +2 -2
  66. package/lib/ui/plugins/team/bundle.json +2 -2
  67. package/lib/ui/plugins/terminal/bundle.json +2 -2
  68. package/lib/ui/plugins/trace/bundle.json +2 -2
  69. package/lib/ui/plugins/transcript/bundle.json +2 -2
  70. package/lib/ui/plugins/transcript/client.js +156 -96
  71. package/lib/ui/sdk/@dsc/ui/package.json +1 -1
  72. package/lib/ui/sdk/@dsc/ui-core/package.json +1 -1
  73. package/lib/ui/sdk/@dsc/ui-dockkit/package.json +1 -1
  74. package/lib/ui/sdk/@dsc/ui-layout/package.json +1 -1
  75. package/lib/ui/sdk/@dsc/ui-primitives/icons.d.ts +13 -2
  76. package/lib/ui/sdk/@dsc/ui-primitives/image-lightbox.d.ts +21 -0
  77. package/lib/ui/sdk/@dsc/ui-primitives/index.d.ts +3 -0
  78. package/lib/ui/sdk/@dsc/ui-primitives/package.json +1 -1
  79. package/lib/ui/sdk/@dsc/ui-primitives/review-findings-card.d.ts +25 -0
  80. package/lib/ui/sdk/@dsc/ui-primitives/review-findings.d.ts +64 -0
  81. package/lib/ui/sdk/@dsc/ui-renderer/package.json +1 -1
  82. package/lib/ui/sdk/@dsc/ui-slots/package.json +1 -1
  83. package/package.json +1 -1
  84. package/lib/ui/assets/style-CIJVQKkj.css +0 -1
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -1,9 +1,9 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0",
7
+ "api": "^0.8.1",
8
8
  "phase": "early"
9
9
  }
@@ -157,6 +157,21 @@ function insertCommand(command) {
157
157
  function blockedNow(command, working) {
158
158
  return working && command.duringTask === "deny";
159
159
  }
160
+ function claimInput(commands, value) {
161
+ const trimmed = value.trimEnd();
162
+ if (!trimmed.startsWith("/")) return null;
163
+ const body = trimmed.slice(1);
164
+ const match = /^(\S+)(?:\s+([\s\S]*))?$/.exec(body);
165
+ if (match === null) return null;
166
+ const word = match[1] ?? "";
167
+ if ((match[2] ?? "").trim() !== "") return null;
168
+ const lower = word.toLowerCase();
169
+ const exact = commands.find((command) => command.name === word);
170
+ const prefix = commands.filter((command) => command.name.toLowerCase().startsWith(lower));
171
+ const spec = exact ?? (prefix.length === 1 ? prefix[0] : void 0) ?? (prefix.filter((command) => command.input !== void 0).length === 1 ? prefix.find((command) => command.input !== void 0) : void 0);
172
+ if (spec === void 0 || spec.input === void 0) return null;
173
+ return { insert: `/${spec.name} `, hint: spec.input.hint };
174
+ }
160
175
  let cache = null;
161
176
  let unavailable = false;
162
177
  function useCommandMenu(options) {
@@ -224,17 +239,24 @@ function useCommandMenu(options) {
224
239
  const pick = () => {
225
240
  const inserted = insertText();
226
241
  if (inserted === null) return;
242
+ adopt(inserted);
243
+ };
244
+ const adopt = (text) => {
227
245
  latest.current = null;
228
246
  dismissed.current = null;
229
247
  setOpen(false);
230
- apply(inserted, inserted.length);
248
+ apply(text, text.length);
249
+ };
250
+ const claim = (value) => {
251
+ if (cache === null) return null;
252
+ return claimInput(cache, value);
231
253
  };
232
254
  const insertText = () => {
233
255
  if (latest.current === null) return null;
234
256
  const command = current.current[at];
235
257
  return command === void 0 ? null : insertCommand(command);
236
258
  };
237
- return { open, rows, loading, at, track, move, pick, close, hide, insertText };
259
+ return { open, rows, loading, at, track, move, pick, close, hide, insertText, claim, adopt };
238
260
  }
239
261
  const GLYPHS = {
240
262
  new: ui$1.IconNewChat,
@@ -1802,6 +1824,7 @@ function ComposerBox() {
1802
1824
  const [sending, setSending] = react.useState(false);
1803
1825
  const [attachments, setAttachments] = react.useState([]);
1804
1826
  const [dragOver, setDragOver] = react.useState(false);
1827
+ const [zoom, setZoom] = react.useState(null);
1805
1828
  const [permOpen, setPermOpen] = react.useState(false);
1806
1829
  const [presetOpen, setPresetOpen] = react.useState(false);
1807
1830
  const [branchOpen, setBranchOpen] = react.useState(false);
@@ -1909,6 +1932,12 @@ function ComposerBox() {
1909
1932
  const picked = command.open && typed !== "/" ? command.insertText()?.trim() ?? null : null;
1910
1933
  const value = picked ?? typed;
1911
1934
  if (value === "" && attachments.length === 0 || blocked || sending) return;
1935
+ const claim = attachments.length === 0 ? command.claim(value) : null;
1936
+ if (claim !== null) {
1937
+ setFault(null);
1938
+ command.adopt(claim.insert);
1939
+ return;
1940
+ }
1912
1941
  if (value.startsWith("/") && attachments.length === 0) {
1913
1942
  command.hide();
1914
1943
  const target = value;
@@ -2090,6 +2119,7 @@ function ComposerBox() {
2090
2119
  else mention.close();
2091
2120
  };
2092
2121
  const sendable = text.trim() !== "" || attachments.length > 0;
2122
+ const inputHint = command.claim(text)?.hint ?? null;
2093
2123
  const queueing = working && sendable;
2094
2124
  const permOption = permissionPresets.options.find((item) => item.name === permissionPresets.current);
2095
2125
  const presetOption = preset.options.find((item) => item.name === preset.current);
@@ -2226,7 +2256,19 @@ function ComposerBox() {
2226
2256
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "attach-name", title: item.name, children: item.name }),
2227
2257
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "attach-bytes", children: uiPrimitives.formatBytes(item.bytes) })
2228
2258
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2229
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "attach-thumb", children: item.kind === "image" ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: item.previewUrl, alt: item.name }) : /* @__PURE__ */ jsxRuntime.jsx(
2259
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "attach-thumb", children: item.kind === "image" ? /* @__PURE__ */ jsxRuntime.jsx(
2260
+ "button",
2261
+ {
2262
+ type: "button",
2263
+ className: "attach-zoom",
2264
+ "data-tip": "点开看大图",
2265
+ "aria-label": `预览 ${item.name}`,
2266
+ onClick: () => {
2267
+ setZoom({ src: item.previewUrl, alt: item.name });
2268
+ },
2269
+ children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: item.previewUrl, alt: item.name })
2270
+ }
2271
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2230
2272
  "video",
2231
2273
  {
2232
2274
  muted: true,
@@ -2501,7 +2543,18 @@ function ComposerBox() {
2501
2543
  ]
2502
2544
  }
2503
2545
  ),
2504
- fault === null ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shell-composer-fault", children: fault })
2546
+ inputHint === null ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shell-composer-hint", children: inputHint }),
2547
+ fault === null ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shell-composer-fault", children: fault }),
2548
+ zoom === null ? null : /* @__PURE__ */ jsxRuntime.jsx(
2549
+ uiPrimitives.ImageLightbox,
2550
+ {
2551
+ src: zoom.src,
2552
+ alt: zoom.alt,
2553
+ onClose: () => {
2554
+ setZoom(null);
2555
+ }
2556
+ }
2557
+ )
2505
2558
  ] })
2506
2559
  );
2507
2560
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "version": 1,
3
- "apiVersion": "0.8.0"
3
+ "apiVersion": "0.8.1"
4
4
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -173,6 +173,8 @@ function SessionList() {
173
173
  const sessions = ui$1.useHostSelector(uiPrimitives.readSessions);
174
174
  const states = ui$1.useHostSelector(readStates);
175
175
  const currentPath = ui$1.useHostSelector(readCurrentPath);
176
+ const [pendingOpen, setPendingOpen] = react.useState(null);
177
+ const shownPath = pendingOpen ?? currentPath;
176
178
  const loading = ui$1.useHostSelector(readLoading);
177
179
  const cwd = ui$1.useHostSelector(uiPrimitives.readCwd);
178
180
  const page = ui$1.useShellPage();
@@ -253,6 +255,10 @@ function SessionList() {
253
255
  };
254
256
  const open = (id) => {
255
257
  ui$1.setShellPage(null);
258
+ setPendingOpen(id ?? null);
259
+ if (id === void 0 && cwd !== null && cwd !== "" && prefs.expansion[cwd] === false) {
260
+ patchPrefs({ expansion: { ...prefs.expansion, [cwd]: true } });
261
+ }
256
262
  void (async () => {
257
263
  await run("openSession", id === void 0 ? [] : [id]);
258
264
  await run("refreshSessions", []);
@@ -284,7 +290,8 @@ function SessionList() {
284
290
  };
285
291
  const deleteWorkspace = (target, sessionsOfGroup) => {
286
292
  void (async () => {
287
- const count = sessionsOfGroup.length;
293
+ const real = sessionsOfGroup.filter((session) => session.unsaved !== true);
294
+ const count = real.length;
288
295
  const detail = count > 0 ? `其下 ${String(count)} 个会话会全部归档(移进「设置 → 归档」,消息一个字不删,可恢复),工作区从侧边栏移除。` : "该工作区还没有会话,将从侧边栏移除。";
289
296
  const current = target === (cwd ?? "") ? "它仍是当前目录,新建会话后会重新出现在侧边栏。" : "";
290
297
  const ok = await ui$1.confirmAction({
@@ -303,7 +310,7 @@ function SessionList() {
303
310
  return;
304
311
  }
305
312
  try {
306
- await channel.invoke("archiveSessions", [sessionsOfGroup.map((session) => session.id)]);
313
+ await channel.invoke("archiveSessions", [real.map((session) => session.id)]);
307
314
  await run("refreshSessions", []);
308
315
  ui$1.toastOk(`工作区已删除,${String(count)} 个会话已归档`);
309
316
  } catch {
@@ -426,12 +433,25 @@ function SessionList() {
426
433
  const flatSessions = react.useMemo(() => groups.flatMap((group) => group.sessions), [groups]);
427
434
  const parents = react.useMemo(() => new Set(groups.filter((item) => item.hasChildren).map((item) => item.cwd)), [groups]);
428
435
  const activeCwd = react.useMemo(() => {
429
- if (currentPath !== null) {
430
- const owner = sessions.find((session) => session.id === currentPath);
436
+ if (shownPath !== null) {
437
+ const owner = sessions.find((session) => session.id === shownPath);
431
438
  if (owner !== void 0) return owner.cwd;
432
439
  }
433
440
  return cwd;
434
- }, [sessions, currentPath, cwd]);
441
+ }, [sessions, shownPath, cwd]);
442
+ react.useEffect(() => {
443
+ if (pendingOpen === null) return;
444
+ if (currentPath === pendingOpen) {
445
+ setPendingOpen(null);
446
+ return;
447
+ }
448
+ const timer = setTimeout(() => {
449
+ setPendingOpen(null);
450
+ }, 4e3);
451
+ return () => {
452
+ clearTimeout(timer);
453
+ };
454
+ }, [pendingOpen, currentPath]);
435
455
  react.useEffect(() => {
436
456
  if (cwd === null || cwd === "") return;
437
457
  const chain = [cwd];
@@ -505,7 +525,9 @@ function SessionList() {
505
525
  const dragFor = (groupCwd, session) => {
506
526
  const compatible = sessDrag !== null && sessDrag.cwd === groupCwd && sessDrag.pinned === (session.pinnedAt !== void 0);
507
527
  return {
508
- enabled: prefs.sort === "manual" && session.archivedAt === void 0,
528
+ // 临时行(还没落盘)不参与拖拽:拖完要写 sessionOrder,而它在列表里的位置只由
529
+ // 「谁是当前会话」决定,拖了也不会被记住。
530
+ enabled: prefs.sort === "manual" && session.archivedAt === void 0 && session.unsaved !== true,
509
531
  mark: sessDrag !== null && sessDrag.over !== null && sessDrag.over.id === session.id ? sessDrag.over.half : null,
510
532
  onStart: (event) => {
511
533
  event.dataTransfer.effectAllowed = "move";
@@ -660,7 +682,7 @@ function SessionList() {
660
682
  {
661
683
  session,
662
684
  state: states[session.id],
663
- current: currentPath !== null && session.id === currentPath,
685
+ current: shownPath !== null && session.id === shownPath,
664
686
  sort: prefs.sort,
665
687
  renameRequest: renaming === session.id,
666
688
  onOpen: open,
@@ -806,7 +828,7 @@ function SessionList() {
806
828
  {
807
829
  session,
808
830
  state: states[session.id],
809
- current: currentPath !== null && session.id === currentPath,
831
+ current: shownPath !== null && session.id === shownPath,
810
832
  sort: prefs.sort,
811
833
  renameRequest: renaming === session.id,
812
834
  drag: dragFor(group.cwd, session),
@@ -1242,6 +1264,7 @@ function SessionRow({
1242
1264
  const [draft, setDraft] = react.useState(null);
1243
1265
  const pinned = session.pinnedAt !== void 0;
1244
1266
  const archived = session.archivedAt !== void 0;
1267
+ const unsaved = session.unsaved === true;
1245
1268
  const title = session.title ?? "新会话";
1246
1269
  const dot = state === void 0 ? void 0 : DOT_CLASS[state];
1247
1270
  const dotLabel = state === void 0 ? "" : DOT_LABEL[state];
@@ -1274,6 +1297,7 @@ function SessionRow({
1274
1297
  openRow();
1275
1298
  return;
1276
1299
  }
1300
+ if (unsaved) return;
1277
1301
  if (!event.ctrlKey && !event.metaKey) return;
1278
1302
  const lower = event.key.toLowerCase();
1279
1303
  if (event.ctrlKey && event.altKey && lower === "r") {
@@ -1302,7 +1326,7 @@ function SessionRow({
1302
1326
  className: `sess-item${current ? " active" : ""}${archived ? " archived" : ""}${drag?.mark === "before" ? " drop-above" : ""}${drag?.mark === "after" ? " drop-below" : ""}`,
1303
1327
  role: "button",
1304
1328
  tabIndex: 0,
1305
- "data-tip": archived ? `${title}(已归档);恢复后才能在对话里打开` : `${title};双击标题改名 · Ctrl+Alt+F 分叉 · Ctrl+Shift+A 归档`,
1329
+ "data-tip": unsaved ? `${title}:还没发过消息,发出第一条后才会存进磁盘` : archived ? `${title}(已归档);恢复后才能在对话里打开` : `${title};双击标题改名 · Ctrl+Alt+F 分叉 · Ctrl+Shift+A 归档`,
1306
1330
  draggable: drag?.enabled === true && draft === null,
1307
1331
  onDragStart: drag?.enabled === true && draft === null ? drag.onStart : void 0,
1308
1332
  onDragOver: drag?.enabled === true && draft === null ? drag.onOver : void 0,
@@ -1316,10 +1340,14 @@ function SessionRow({
1316
1340
  },
1317
1341
  onContextMenu: (event) => {
1318
1342
  event.preventDefault();
1343
+ if (unsaved) return;
1319
1344
  onMenu(event.clientX, event.clientY);
1320
1345
  },
1321
1346
  children: [
1322
- dot === void 0 ? (
1347
+ dot === void 0 ? unsaved ? (
1348
+ // 临时行不给图钉:置顶要写 jsonl,文件还没有。占位撑住行首宽度,视觉不塌。
1349
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "row-slot" })
1350
+ ) : (
1323
1351
  // 没有运行状态时才给图钉:旧界面里这一格是「状态点 / 图钉」二选一,
1324
1352
  // 两样同时画会把行首撑宽。
1325
1353
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "row-slot", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -1333,7 +1361,7 @@ function SessionRow({
1333
1361
  stop(event);
1334
1362
  onPin(!pinned);
1335
1363
  },
1336
- children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconPin, { size: 13 })
1364
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconPin, { size: 14, filled: pinned })
1337
1365
  }
1338
1366
  ) })
1339
1367
  ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: `row-slot session-dot ${dot}`, "data-tip": dotLabel, "aria-label": dotLabel, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dot" }) }),
@@ -1346,7 +1374,7 @@ function SessionRow({
1346
1374
  style: titleShift > 0 ? { "--title-shift": `${String(-titleShift)}px`, "--title-dur": `${String(titleDur)}ms` } : void 0,
1347
1375
  onDoubleClick: (event) => {
1348
1376
  event.stopPropagation();
1349
- if (!archived) setDraft(session.title ?? "");
1377
+ if (!archived && !unsaved) setDraft(session.title ?? "");
1350
1378
  },
1351
1379
  children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "title-text", children: title })
1352
1380
  }
@@ -1379,7 +1407,7 @@ function SessionRow({
1379
1407
  }
1380
1408
  ),
1381
1409
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "when", children: relativeTime(sort === "created" ? session.createdAt : session.archivedAt ?? session.updatedAt) }),
1382
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "row-actions", onClick: stop, children: archived ? /* @__PURE__ */ jsxRuntime.jsx(
1410
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "row-actions", onClick: stop, children: unsaved ? null : archived ? /* @__PURE__ */ jsxRuntime.jsx(
1383
1411
  "button",
1384
1412
  {
1385
1413
  type: "button",
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "apiVersion": "0.8.0",
2
+ "apiVersion": "0.8.1",
3
3
  "file": "client.js",
4
4
  "platforms": [
5
5
  "web"
6
6
  ],
7
- "api": "^0.8.0"
7
+ "api": "^0.8.1"
8
8
  }
@@ -108,7 +108,12 @@ const CLOCK_FAST_MS = 1e3;
108
108
  const CLOCK_SLOW_MS = 1e4;
109
109
  const AUTO_PANEL_MIN_WIDTH = 1280;
110
110
  const THREAD_AREA_SELECTOR = "[data-thread-area]";
111
+ const TOPBAR_TABS_SELECTOR = ".topbar .tabs";
111
112
  const MODE_KEY = "dsc.statusPanel.mode";
113
+ const POS_KEY = "dsc.statusPanel.pos";
114
+ const DRAG_SLOP = 4;
115
+ const SNAP_BACK_PX = 24;
116
+ const DRAG_MARGIN = 8;
112
117
  const PREVIEW_OPEN_MS = 120;
113
118
  const PREVIEW_CLOSE_MS = 80;
114
119
  const MODE_LABEL = {
@@ -131,6 +136,49 @@ function writeMode(mode) {
131
136
  } catch {
132
137
  }
133
138
  }
139
+ function readPos() {
140
+ try {
141
+ const raw = globalThis.localStorage?.getItem(POS_KEY);
142
+ if (raw === null || raw === void 0) return null;
143
+ const parsed = JSON.parse(raw);
144
+ if (typeof parsed !== "object" || parsed === null) return null;
145
+ const x = parsed.x;
146
+ const y = parsed.y;
147
+ if (typeof x !== "number" || typeof y !== "number" || !Number.isFinite(x) || !Number.isFinite(y)) return null;
148
+ return { x, y };
149
+ } catch {
150
+ return null;
151
+ }
152
+ }
153
+ function writePos(pos) {
154
+ try {
155
+ globalThis.localStorage?.setItem(POS_KEY, JSON.stringify(pos));
156
+ } catch {
157
+ }
158
+ }
159
+ function clearPos() {
160
+ try {
161
+ globalThis.localStorage?.removeItem(POS_KEY);
162
+ } catch {
163
+ }
164
+ }
165
+ function clampIn(value, min, max) {
166
+ return min > max ? min : Math.min(Math.max(value, min), max);
167
+ }
168
+ function dragBounds(hostEl, applied) {
169
+ const container = hostEl.closest(".main") ?? hostEl.closest(THREAD_AREA_SELECTOR);
170
+ if (container === null) return null;
171
+ const frame = container.getBoundingClientRect();
172
+ const rect = hostEl.getBoundingClientRect();
173
+ const left = rect.left - applied.x;
174
+ const top = rect.top - applied.y;
175
+ return {
176
+ minX: frame.left + DRAG_MARGIN - left,
177
+ maxX: frame.right - DRAG_MARGIN - rect.width - left,
178
+ minY: frame.top + DRAG_MARGIN - top,
179
+ maxY: frame.bottom - DRAG_MARGIN - rect.height - top
180
+ };
181
+ }
134
182
  const DEFAULT_SECTION_OPEN = {
135
183
  git: true,
136
184
  goal: true,
@@ -311,18 +359,26 @@ function StatusPanel({ slots }) {
311
359
  const sentinel = react.useRef(null);
312
360
  const box = react.useRef(null);
313
361
  const [host, setHost] = react.useState(null);
362
+ const [area, setArea] = react.useState(null);
363
+ const [pos, setPos] = react.useState(() => readPos() ?? { x: 0, y: 0 });
364
+ const posRef = react.useRef(pos);
365
+ const dragRef = react.useRef(null);
366
+ const suppressClickRef = react.useRef(false);
314
367
  const [avail, setAvail] = react.useState(() => {
315
- const area = typeof document === "undefined" ? null : document.querySelector(THREAD_AREA_SELECTOR);
316
- return area instanceof HTMLElement && area.clientWidth > 0 ? area.clientWidth : AUTO_PANEL_MIN_WIDTH;
368
+ const el = typeof document === "undefined" ? null : document.querySelector(THREAD_AREA_SELECTOR);
369
+ return el instanceof HTMLElement && el.clientWidth > 0 ? el.clientWidth : AUTO_PANEL_MIN_WIDTH;
317
370
  });
318
371
  react.useEffect(() => {
319
372
  const node = sentinel.current;
320
- const found = node?.closest(THREAD_AREA_SELECTOR);
321
- setHost(found instanceof HTMLElement ? found : null);
373
+ const tabs = document.querySelector(TOPBAR_TABS_SELECTOR);
374
+ const nextHost = tabs ?? node?.closest(THREAD_AREA_SELECTOR) ?? null;
375
+ setHost(nextHost instanceof HTMLElement ? nextHost : null);
376
+ const nextArea = node?.closest(THREAD_AREA_SELECTOR) ?? null;
377
+ setArea(nextArea instanceof HTMLElement ? nextArea : null);
322
378
  }, [view]);
323
379
  react.useEffect(() => {
324
- if (host === null) return void 0;
325
- const element = host;
380
+ if (area === null) return void 0;
381
+ const element = area;
326
382
  const measure = () => setAvail(element.clientWidth);
327
383
  measure();
328
384
  if (typeof ResizeObserver === "undefined") {
@@ -332,7 +388,93 @@ function StatusPanel({ slots }) {
332
388
  const observer = new ResizeObserver(measure);
333
389
  observer.observe(element);
334
390
  return () => observer.disconnect();
335
- }, [host]);
391
+ }, [area]);
392
+ const commitPos = react.useCallback((next) => {
393
+ posRef.current = next;
394
+ setPos(next);
395
+ if (next.x === 0 && next.y === 0) clearPos();
396
+ else writePos(next);
397
+ }, []);
398
+ const onMiniPointerDown = react.useCallback((event) => {
399
+ if (event.button !== 0) return;
400
+ const hostEl = box.current;
401
+ if (hostEl === null) return;
402
+ const bounds = dragBounds(hostEl, posRef.current);
403
+ if (bounds === null) return;
404
+ try {
405
+ event.currentTarget.setPointerCapture(event.pointerId);
406
+ } catch {
407
+ }
408
+ hostEl.setAttribute("data-dragging", "1");
409
+ dragRef.current = {
410
+ pointerId: event.pointerId,
411
+ startX: event.clientX,
412
+ startY: event.clientY,
413
+ baseX: posRef.current.x,
414
+ baseY: posRef.current.y,
415
+ bounds,
416
+ moved: false,
417
+ frame: null,
418
+ nextX: posRef.current.x,
419
+ nextY: posRef.current.y
420
+ };
421
+ }, []);
422
+ const onMiniPointerMove = react.useCallback((event) => {
423
+ const drag = dragRef.current;
424
+ if (drag === null || event.pointerId !== drag.pointerId) return;
425
+ const dx = event.clientX - drag.startX;
426
+ const dy = event.clientY - drag.startY;
427
+ if (!drag.moved && Math.abs(dx) < DRAG_SLOP && Math.abs(dy) < DRAG_SLOP) return;
428
+ drag.moved = true;
429
+ drag.nextX = clampIn(drag.baseX + dx, drag.bounds.minX, drag.bounds.maxX);
430
+ drag.nextY = clampIn(drag.baseY + dy, drag.bounds.minY, drag.bounds.maxY);
431
+ if (drag.frame !== null) return;
432
+ drag.frame = window.requestAnimationFrame(() => {
433
+ drag.frame = null;
434
+ const hostEl = box.current;
435
+ if (hostEl === null) return;
436
+ hostEl.style.transform = `translate3d(${String(drag.nextX)}px, ${String(drag.nextY)}px, 0)`;
437
+ });
438
+ }, []);
439
+ const onMiniPointerUp = react.useCallback((event) => {
440
+ const drag = dragRef.current;
441
+ if (drag === null || event.pointerId !== drag.pointerId) return;
442
+ dragRef.current = null;
443
+ if (drag.frame !== null) {
444
+ window.cancelAnimationFrame(drag.frame);
445
+ drag.frame = null;
446
+ }
447
+ try {
448
+ event.currentTarget.releasePointerCapture(event.pointerId);
449
+ } catch {
450
+ }
451
+ box.current?.removeAttribute("data-dragging");
452
+ if (!drag.moved) return;
453
+ suppressClickRef.current = true;
454
+ const moved = { x: drag.nextX, y: drag.nextY };
455
+ const final = Math.hypot(moved.x, moved.y) < SNAP_BACK_PX ? { x: 0, y: 0 } : moved;
456
+ const hostEl = box.current;
457
+ if (hostEl !== null) hostEl.style.transform = `translate3d(${String(final.x)}px, ${String(final.y)}px, 0)`;
458
+ commitPos(final);
459
+ }, [commitPos]);
460
+ react.useEffect(() => {
461
+ if (host === null) return void 0;
462
+ const onResize = () => {
463
+ const hostEl = box.current;
464
+ if (hostEl === null) return;
465
+ const bounds = dragBounds(hostEl, posRef.current);
466
+ if (bounds === null) return;
467
+ const current = posRef.current;
468
+ const clamped = {
469
+ x: clampIn(current.x, bounds.minX, bounds.maxX),
470
+ y: clampIn(current.y, bounds.minY, bounds.maxY)
471
+ };
472
+ if (clamped.x === current.x && clamped.y === current.y) return;
473
+ commitPos(clamped);
474
+ };
475
+ window.addEventListener("resize", onResize);
476
+ return () => window.removeEventListener("resize", onResize);
477
+ }, [host, commitPos]);
336
478
  react.useEffect(() => {
337
479
  if (usingShared) return void 0;
338
480
  let alive = true;
@@ -558,7 +700,10 @@ function StatusPanel({ slots }) {
558
700
  {
559
701
  className: "sp-host",
560
702
  ref: box,
561
- style: { "--sp-avail": `${String(avail)}px` },
703
+ style: {
704
+ "--sp-avail": `${String(avail)}px`,
705
+ transform: `translate3d(${String(pos.x)}px, ${String(pos.y)}px, 0)`
706
+ },
562
707
  children: [
563
708
  /* @__PURE__ */ jsxRuntime.jsxs(
564
709
  "aside",
@@ -578,8 +723,16 @@ function StatusPanel({ slots }) {
578
723
  "aria-hidden": expanded,
579
724
  tabIndex: expanded ? -1 : 0,
580
725
  inert: expanded,
581
- "data-tip": "展开状态面板",
726
+ "data-tip": "展开状态面板(按住可以拖动)",
727
+ onPointerDown: onMiniPointerDown,
728
+ onPointerMove: onMiniPointerMove,
729
+ onPointerUp: onMiniPointerUp,
730
+ onPointerCancel: onMiniPointerUp,
582
731
  onClick: () => {
732
+ if (suppressClickRef.current) {
733
+ suppressClickRef.current = false;
734
+ return;
735
+ }
583
736
  chooseMode("panel");
584
737
  },
585
738
  children: /* @__PURE__ */ jsxRuntime.jsx(MiniSummary, { summary })