@steerable/agent-shell-web 0.6.64 → 0.6.66

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.
@@ -0,0 +1,48 @@
1
+ /**
2
+ * 侧栏项目拖拽排序。显示顺序以列表下标为准;服务端再把同样的 id
3
+ * 顺序写成 sortOrder。
4
+ */
5
+
6
+ export type ProjectDropPlace = 'before' | 'after';
7
+
8
+ /**
9
+ * 把 fromId 插到 targetId 前面或后面。顺序没有变化时返回 null,
10
+ * 调用方就不必再请求保存。
11
+ */
12
+ export function nextProjectOrder(
13
+ ids: readonly string[],
14
+ fromId: string,
15
+ targetId: string,
16
+ place: ProjectDropPlace,
17
+ ): string[] | null {
18
+ if (!fromId || fromId === targetId) return null;
19
+ const without = ids.filter((id) => id !== fromId);
20
+ const targetIndex = without.indexOf(targetId);
21
+ if (targetIndex < 0) return null;
22
+ const insertAt = place === 'before' ? targetIndex : targetIndex + 1;
23
+ const next = without.slice();
24
+ next.splice(insertAt, 0, fromId);
25
+ if (next.length === ids.length && next.every((id, index) => id === ids[index])) return null;
26
+ return next;
27
+ }
28
+
29
+ /** 按 orderedIds 重排。名单里没有的项目保持原先的相对顺序,接在后面。 */
30
+ export function applyProjectIdOrder<T extends { id: string }>(
31
+ projects: readonly T[],
32
+ orderedIds: readonly string[],
33
+ ): Array<T & { sortOrder: number }> {
34
+ const byId = new Map(projects.map((project) => [project.id, project]));
35
+ const next: Array<T & { sortOrder: number }> = [];
36
+ const seen = new Set<string>();
37
+ for (const id of orderedIds) {
38
+ const project = byId.get(id);
39
+ if (!project || seen.has(id)) continue;
40
+ seen.add(id);
41
+ next.push({ ...project, sortOrder: next.length });
42
+ }
43
+ for (const project of projects) {
44
+ if (seen.has(project.id)) continue;
45
+ next.push({ ...project, sortOrder: next.length });
46
+ }
47
+ return next;
48
+ }
@@ -13,6 +13,7 @@ import type {
13
13
  PackChatSlotAutoRevealApi,
14
14
  PackChatSlotContribution,
15
15
  PackChatSlotProps,
16
+ PackChatSlotTarget,
16
17
  PackRendererContributions,
17
18
  PackRouteContribution,
18
19
  PackSettingsPanelContribution,
@@ -23,6 +24,7 @@ export type {
23
24
  PackChatSlotAutoRevealApi,
24
25
  PackChatSlotContribution,
25
26
  PackChatSlotProps,
27
+ PackChatSlotTarget,
26
28
  PackRendererContributions,
27
29
  PackRouteContribution,
28
30
  PackSettingsPanelContribution,
@@ -1190,6 +1190,12 @@ function AgentChatView({
1190
1190
  ...pendingFollowUps.map((message) => message.content),
1191
1191
  ...remoteFollowUps,
1192
1192
  ];
1193
+ const chatOutputs = useMemo(() => {
1194
+ const merged: TurnFile[] = [];
1195
+ for (const files of Object.values(turnFilesByMessageId)) merged.push(...files);
1196
+ merged.push(...currentTurnFiles);
1197
+ return merged;
1198
+ }, [turnFilesByMessageId, currentTurnFiles]);
1193
1199
  const handleRemovePendingFollowUp = (index: number) => {
1194
1200
  if (index < pendingFollowUps.length) {
1195
1201
  removeFollowUp(index);
@@ -1228,8 +1234,13 @@ function AgentChatView({
1228
1234
  tasks={tasks}
1229
1235
  chatSlots={ctx.chatSlots}
1230
1236
  rightPanel={ctx.rightPanel}
1231
- onToggleChatSlot={ctx.onToggleChatSlot}
1232
- onToggleRightPanel={ctx.onToggleChatSlot}
1237
+ openPanelIds={ctx.openPanelIds}
1238
+ onOpenRightPanel={ctx.onOpenRightPanel}
1239
+ showProject={showProjectsChrome}
1240
+ project={chatProject}
1241
+ outputs={chatOutputs}
1242
+ onShare={hasHostBridge() ? handleShare : undefined}
1243
+ onChatChanged={ctx.refreshChats}
1233
1244
  />
1234
1245
  }
1235
1246
  onRegenerate={