@nextclaw/ui 0.12.24 → 0.12.26
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/CHANGELOG.md +136 -29
- package/dist/assets/api-DGD9_Bg4.js +15 -0
- package/dist/assets/app-manager-provider-oYdeYPSv.js +1 -0
- package/dist/assets/{book-open-DDlN5MvX.js → book-open-BcnAiKde.js} +1 -1
- package/dist/assets/channels-list-page-HgLgrEg4.js +8 -0
- package/dist/assets/chat-page-DAKMFDrS.js +1 -0
- package/dist/assets/config-split-page-CcrEUtwu.js +1 -0
- package/dist/assets/cpu-DPPwMzoC.js +3 -0
- package/dist/assets/{createLucideIcon-BLMK3QUd.js → createLucideIcon-DzY6wN61.js} +1 -1
- package/dist/assets/desktop-DVUbOWbR.js +3 -0
- package/dist/assets/desktop-update-config-CP8dFYXK.js +1 -0
- package/dist/assets/{dialog-C3D7Be0p.js → dialog-BKo0RItd.js} +1 -1
- package/dist/assets/{dist-CPlbUgwU.js → dist-CFiwgaLs.js} +1 -1
- package/dist/assets/doc-browser-CAhfnm0D.js +1 -0
- package/dist/assets/{doc-browser-context-BJuMaI3o.js → doc-browser-context-FukQHvyo.js} +1 -1
- package/dist/assets/doc-browser-p9DDNPWB.js +1 -0
- package/dist/assets/doc-browser-rZIQIjuw.js +1 -0
- package/dist/assets/download-CMM8po31.js +1 -0
- package/dist/assets/{es2015-xqN1slyW.js → es2015-BhznEEyJ.js} +1 -1
- package/dist/assets/{external-link-DwfSfTLB.js → external-link-CpEvG65F.js} +1 -1
- package/dist/assets/i18n-D1144VAA.js +1 -0
- package/dist/assets/index-Cuwst6cc.js +100 -0
- package/dist/assets/index-dlcqieQ0.css +1 -0
- package/dist/assets/{key-round-CJ5gDAAG.js → key-round-DUq47t0P.js} +1 -1
- package/dist/assets/marketplace-page-BeFbwxR-.js +105 -0
- package/dist/assets/marketplace-page-CR4xq-TM.js +1 -0
- package/dist/assets/mcp-marketplace-page-DlRrSCj3.js +1 -0
- package/dist/assets/mcp-marketplace-page-DwnaLNTx.js +40 -0
- package/dist/assets/model-config-L2l6YAlQ.js +1 -0
- package/dist/assets/{notice-card-BFDbKQDA.js → notice-card-Dr6xCwva.js} +1 -1
- package/dist/assets/play-AqrNslHI.js +1 -0
- package/dist/assets/plus-B-YHtTNC.js +1 -0
- package/dist/assets/{popover-B86Dbfhf.js → popover-BDFNiLlg.js} +1 -1
- package/dist/assets/provider-scoped-model-input-BMTp4BEH.js +1 -0
- package/dist/assets/providers-list-DYAEunOp.js +1 -0
- package/dist/assets/refresh-cw-CrbD8EkT.js +1 -0
- package/dist/assets/remote-Dr3jcfWP.js +1 -0
- package/dist/assets/{rotate-cw-BZ2JObNs.js → rotate-cw-BN9yjccP.js} +1 -1
- package/dist/assets/runtime-config-page-BdeU8PEK.js +1 -0
- package/dist/assets/{save-euRxl8pI.js → save-CO_4qf6b.js} +1 -1
- package/dist/assets/{search-CLd7m0M7.js → search-CRtQwr-h.js} +1 -1
- package/dist/assets/search-config-CQUhd5RU.js +1 -0
- package/dist/assets/secrets-config-D-NWlW9q.js +3 -0
- package/dist/assets/{select-CJ0wbo3D.js → select-BUTwE_lC.js} +1 -1
- package/dist/assets/{setting-row-D1Yygqp7.js → setting-row-BavcnXw1.js} +1 -1
- package/dist/assets/settings-MWL2SMyk.js +1 -0
- package/dist/assets/{sparkles-DVfeSVJQ.js → sparkles-BmgOD4nY.js} +1 -1
- package/dist/assets/{status-dot-ChvPCib9.js → status-dot-l3kPFdq_.js} +1 -1
- package/dist/assets/{tabs-custom-Hia_ong0.js → tabs-custom-D48zdZoc.js} +1 -1
- package/dist/assets/{tag-chip-FrkmkT8r.js → tag-chip-Dm2Lqnpu.js} +1 -1
- package/dist/assets/use-config-Cyv5IuSt.js +1 -0
- package/dist/assets/use-infinite-scroll-loader-CFVdPpNv.js +1 -0
- package/dist/assets/x-BeyYA_h6.js +1 -0
- package/dist/index.html +29 -40
- package/package.json +9 -9
- package/src/app/components/layout/sidebar.layout.test.tsx +2 -4
- package/src/app/components/theme-provider.tsx +1 -0
- package/src/app/configs/app-navigation.config.ts +0 -6
- package/src/app/index.tsx +4 -7
- package/src/features/agents/components/agents-page.test.tsx +25 -15
- package/src/features/agents/components/agents-page.tsx +133 -172
- package/src/features/channels/components/config/channel-form.test.tsx +1 -0
- package/src/features/channels/components/config/channel-form.tsx +4 -3
- package/src/features/channels/components/config/weixin-channel-auth-section.test.tsx +38 -1
- package/src/features/channels/components/config/weixin-channel-auth-section.tsx +137 -40
- package/src/features/channels/index.ts +1 -1
- package/src/features/channels/utils/channel-form-fields.utils.test.ts +26 -0
- package/src/features/channels/utils/channel-form-fields.utils.ts +32 -18
- package/src/features/chat/components/chat-session-workspace-panel-nav.tsx +23 -4
- package/src/features/chat/components/chat-session-workspace-panel.tsx +53 -35
- package/src/features/chat/components/chat-sidebar-session-item.tsx +16 -12
- package/src/features/chat/components/conversation/chat-conversation-header.test.tsx +74 -0
- package/src/features/chat/components/conversation/chat-conversation-header.tsx +8 -2
- package/src/features/chat/components/conversation/chat-conversation-panel.test.tsx +262 -114
- package/src/features/chat/components/conversation/chat-conversation-panel.tsx +210 -174
- package/src/features/chat/components/conversation/chat-input-bar.container.tsx +11 -1
- package/src/features/chat/components/conversation/session-header/chat-session-header-actions.test.tsx +24 -0
- package/src/features/chat/components/conversation/session-header/chat-session-header-actions.tsx +27 -6
- package/src/features/chat/components/layout/chat-sidebar-utility-menu.tsx +174 -0
- package/src/features/chat/components/layout/chat-sidebar.test.tsx +45 -8
- package/src/features/chat/components/layout/chat-sidebar.tsx +29 -46
- package/src/features/chat/components/providers/chat-presenter.provider.tsx +4 -0
- package/src/features/chat/components/workspace/session-cron-job-content.tsx +103 -0
- package/src/features/chat/hooks/use-ncp-agent-runtime.test.tsx +153 -80
- package/src/features/chat/hooks/use-ncp-chat-page-data.test.tsx +70 -0
- package/src/features/chat/hooks/use-ncp-chat-page-data.ts +1 -1
- package/src/features/chat/hooks/use-ncp-child-session-tabs-view.ts +2 -8
- package/src/features/chat/hooks/use-ncp-session-list-view.ts +1 -2
- package/src/features/chat/managers/chat-session-list.manager.test.ts +7 -9
- package/src/features/chat/managers/chat-session-list.manager.ts +5 -10
- package/src/features/chat/managers/ncp-chat-input.manager.test.ts +20 -2
- package/src/features/chat/managers/ncp-chat-input.manager.ts +18 -0
- package/src/features/chat/managers/ncp-chat-presenter.manager.ts +7 -0
- package/src/features/chat/managers/ncp-chat-thread.manager.test.ts +52 -1
- package/src/features/chat/managers/ncp-chat-thread.manager.ts +21 -0
- package/src/features/chat/pages/ncp-chat-page.tsx +9 -5
- package/src/features/chat/stores/chat-input.store.ts +3 -1
- package/src/features/chat/stores/chat-session-list.store.ts +0 -2
- package/src/features/chat/stores/chat-thread.store.ts +4 -0
- package/src/features/chat/utils/chat-session-display.utils.test.ts +83 -1
- package/src/features/chat/utils/chat-session-display.utils.ts +73 -0
- package/src/features/chat/utils/ncp-chat-input-availability.utils.test.ts +1 -0
- package/src/features/chat/utils/ncp-session-adapter.utils.test.ts +22 -0
- package/src/features/chat/utils/ncp-session-adapter.utils.ts +32 -0
- package/src/features/marketplace/components/curated-shelves/marketplace-curated-scene-route.test.tsx +235 -0
- package/src/features/marketplace/components/curated-shelves/marketplace-curated-shelves.config.ts +162 -0
- package/src/features/marketplace/components/curated-shelves/marketplace-curated-shelves.tsx +355 -0
- package/src/features/marketplace/components/curated-shelves/marketplace-shelf-card.tsx +118 -0
- package/src/features/marketplace/components/detail-doc/marketplace-detail-doc-renderer.ts +201 -0
- package/src/features/marketplace/components/detail-doc/marketplace-detail-doc.test.ts +40 -0
- package/src/features/marketplace/components/marketplace-catalog-grid.tsx +114 -0
- package/src/features/marketplace/components/marketplace-detail-doc.ts +73 -24
- package/src/features/marketplace/components/marketplace-item-icon.tsx +45 -0
- package/src/features/marketplace/components/marketplace-list-card.tsx +177 -93
- package/src/features/marketplace/components/marketplace-page-detail.test.tsx +9 -2
- package/src/features/marketplace/components/marketplace-page-parts.tsx +1 -1
- package/src/features/marketplace/components/marketplace-page.test.tsx +25 -6
- package/src/features/marketplace/components/marketplace-page.tsx +154 -132
- package/src/features/marketplace/hooks/use-marketplace-curated-scene-route.ts +97 -0
- package/src/features/marketplace/hooks/use-marketplace.ts +59 -3
- package/src/features/system-status/components/config/runtime-agent-list-card.tsx +4 -8
- package/src/features/system-status/components/config/runtime-binding-list-card.tsx +5 -7
- package/src/features/system-status/components/config/runtime-config-editor.tsx +1 -19
- package/src/features/system-status/components/config/runtime-entry-list-card.tsx +10 -11
- package/src/features/system-status/components/config/runtime-settings-card.tsx +15 -23
- package/src/features/system-status/components/runtime-control-card.test.tsx +8 -6
- package/src/features/system-status/components/runtime-control-card.tsx +7 -6
- package/src/features/system-status/pages/runtime-config-page.test.tsx +19 -9
- package/src/features/system-status/pages/runtime-config-page.tsx +2 -3
- package/src/features/system-status/utils/runtime-config-agent.utils.ts +4 -4
- package/src/features/system-status/utils/system-status.utils.ts +31 -6
- package/src/index.css +8 -0
- package/src/platforms/desktop/components/desktop-app-shell.test.tsx +68 -0
- package/src/platforms/desktop/components/desktop-app-shell.tsx +46 -18
- package/src/platforms/desktop/components/desktop-window-chrome.tsx +30 -0
- package/src/platforms/desktop/index.ts +6 -0
- package/src/platforms/desktop/types/desktop-update.types.ts +3 -0
- package/src/platforms/desktop/utils/desktop-host.utils.ts +56 -0
- package/src/shared/components/common/brand-header.tsx +36 -16
- package/src/shared/components/config/provider-form-support.ts +2 -22
- package/src/shared/components/cron-config.tsx +12 -58
- package/src/shared/components/doc-browser/doc-browser.tsx +4 -4
- package/src/shared/components/ui/select.tsx +19 -7
- package/src/shared/lib/api/channel-auth.types.ts +1 -0
- package/src/shared/lib/api/ncp-session.types.ts +9 -0
- package/src/shared/lib/api/types.ts +12 -1
- package/src/shared/lib/api/utils/marketplace.utils.ts +7 -1
- package/src/shared/lib/cron/cron-job-view.utils.ts +59 -0
- package/src/shared/lib/cron/index.ts +1 -0
- package/src/shared/lib/i18n/{channel-auth.ts → channel-auth.constants.ts} +31 -0
- package/src/shared/lib/i18n/chat-labels.utils.ts +3 -2
- package/src/shared/lib/i18n/index.ts +20 -59
- package/src/shared/lib/i18n/{runtime-control.ts → runtime-control-labels.utils.ts} +30 -1
- package/src/shared/lib/provider-models/index.test.ts +39 -0
- package/src/shared/lib/provider-models/index.ts +1 -3
- package/src/shared/lib/ui-document-title/index.ts +0 -1
- package/tsconfig.json +1 -0
- package/vite.config.ts +1 -1
- package/vitest.config.ts +1 -1
- package/dist/assets/api-D2xRKmZd.js +0 -15
- package/dist/assets/app-manager-provider-CNaZboG4.js +0 -1
- package/dist/assets/app-navigation.config-Ihhrrt--.js +0 -1
- package/dist/assets/channels-list-page-p26lgxLk.js +0 -8
- package/dist/assets/chat-Dkh2qtuz.js +0 -61
- package/dist/assets/chat-page-DoTmE2wx.js +0 -1
- package/dist/assets/chunk-JZWAC4HX-Kydj4yEz.js +0 -3
- package/dist/assets/config-split-page-DIOCjj2Q.js +0 -1
- package/dist/assets/desktop-update-config-DlpzDfKM.js +0 -1
- package/dist/assets/doc-browser-C8FM5fC0.js +0 -1
- package/dist/assets/doc-browser-RJUOL_GO.js +0 -1
- package/dist/assets/doc-browser-p82AdNO-.js +0 -1
- package/dist/assets/folder-CeJKPx5P.js +0 -1
- package/dist/assets/hash-BqxRTZW5.js +0 -1
- package/dist/assets/i18n-DnTGDIRw.js +0 -1
- package/dist/assets/index-D8MKmXtO.css +0 -1
- package/dist/assets/index-pBvbJ5Mt.js +0 -2
- package/dist/assets/loader-circle-fd-vQKtW.js +0 -1
- package/dist/assets/logo-badge-KAe-7d8c.js +0 -1
- package/dist/assets/logos-C4sYP1Vl.js +0 -1
- package/dist/assets/marketplace-page-Cql0kDi-.js +0 -1
- package/dist/assets/marketplace-page-m4P5g_Ht.js +0 -49
- package/dist/assets/mcp-marketplace-page-9WVKl1m1.js +0 -1
- package/dist/assets/mcp-marketplace-page-ByzBQZcx.js +0 -40
- package/dist/assets/message-square-z_osm9c0.js +0 -1
- package/dist/assets/model-config-Dbr_0APb.js +0 -1
- package/dist/assets/play-Dv6Nr1Ew.js +0 -1
- package/dist/assets/plus-D8eKFY7h.js +0 -1
- package/dist/assets/provider-scoped-model-input-DFm6N2f7.js +0 -1
- package/dist/assets/providers-list-BJcLOjun.js +0 -1
- package/dist/assets/refresh-ccw-ByVwmnN_.js +0 -1
- package/dist/assets/refresh-cw-PcqoYB3K.js +0 -1
- package/dist/assets/remote-BOxo9iwd.js +0 -1
- package/dist/assets/runtime-config-page-CjLhnbSl.js +0 -1
- package/dist/assets/search-config-J4Htco-P.js +0 -1
- package/dist/assets/secrets-config-CUdERjco.js +0 -3
- package/dist/assets/sessions-config-page-DpK991fs.js +0 -2
- package/dist/assets/settings-drbWqzA4.js +0 -1
- package/dist/assets/skeleton-BK1SOSRA.js +0 -1
- package/dist/assets/theme-provider-0hxjiPc_.js +0 -2
- package/dist/assets/tooltip-Cj4yA0gH.js +0 -1
- package/dist/assets/trash-2-CBsHCfqq.js +0 -1
- package/dist/assets/use-config-38Ur-89i.js +0 -1
- package/dist/assets/use-confirm-dialog-DPQThaeU.js +0 -1
- package/dist/assets/use-infinite-scroll-loader-5Gf1xQi7.js +0 -1
- package/dist/assets/use-viewport-layout-D1XzKeip.js +0 -1
- package/dist/assets/x-CM-XDMpk.js +0 -1
- package/src/features/chat/components/config/sessions-config-detail-pane.tsx +0 -244
- package/src/features/chat/pages/sessions-config-page.test.tsx +0 -152
- package/src/features/chat/pages/sessions-config-page.tsx +0 -192
- /package/dist/assets/{config-hints-MogHYQ8G.js → config-hints-BNfpOL4J.js} +0 -0
|
@@ -4,6 +4,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
4
4
|
import { ChatConversationPanel } from "@/features/chat/components/conversation/chat-conversation-panel";
|
|
5
5
|
import { ChatSessionWorkspacePanel } from "@/features/chat";
|
|
6
6
|
import type { ResolvedChildSessionTab } from "@/features/chat/hooks/use-ncp-child-session-tabs-view";
|
|
7
|
+
import type { CronJobView } from "@/shared/lib/api";
|
|
7
8
|
import { useChatInputStore } from "@/features/chat/stores/chat-input.store";
|
|
8
9
|
import { useChatSessionListStore } from "@/features/chat/stores/chat-session-list.store";
|
|
9
10
|
import { useChatThreadStore } from "@/features/chat/stores/chat-thread.store";
|
|
@@ -12,7 +13,11 @@ const mocks = vi.hoisted(() => ({
|
|
|
12
13
|
deleteSession: vi.fn(),
|
|
13
14
|
goToProviders: vi.fn(),
|
|
14
15
|
createSession: vi.fn(() => "draft-session-2"),
|
|
16
|
+
goToChatRoot: vi.fn(),
|
|
15
17
|
goToSession: vi.fn(),
|
|
18
|
+
openSessionCronPanel: vi.fn(),
|
|
19
|
+
deleteCronJob: vi.fn(),
|
|
20
|
+
cronJobs: [] as CronJobView[],
|
|
16
21
|
setSelectedAgentId: vi.fn(),
|
|
17
22
|
setPendingSessionType: vi.fn(),
|
|
18
23
|
stickyBottomScroll: vi.fn(() => ({
|
|
@@ -43,21 +48,40 @@ vi.mock("@nextclaw/agent-chat-ui", async (importOriginal) => {
|
|
|
43
48
|
};
|
|
44
49
|
});
|
|
45
50
|
|
|
46
|
-
vi.mock(
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
vi.mock(
|
|
52
|
+
"@/features/chat/components/conversation/chat-input-bar.container",
|
|
53
|
+
() => ({
|
|
54
|
+
ChatInputBarContainer: () => <div data-testid="chat-input-bar" />,
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
49
57
|
|
|
50
|
-
vi.mock(
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
vi.mock(
|
|
59
|
+
"@/features/chat/components/conversation/chat-message-list.container",
|
|
60
|
+
() => ({
|
|
61
|
+
ChatMessageListContainer: ({
|
|
62
|
+
isSending,
|
|
63
|
+
messages,
|
|
64
|
+
}: {
|
|
65
|
+
isSending: boolean;
|
|
66
|
+
messages: readonly unknown[];
|
|
67
|
+
}) => (
|
|
68
|
+
<div
|
|
69
|
+
data-testid="chat-message-list"
|
|
70
|
+
data-message-count={String(messages.length)}
|
|
71
|
+
data-sending={String(isSending)}
|
|
72
|
+
/>
|
|
73
|
+
),
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
53
76
|
|
|
54
|
-
vi.mock(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
77
|
+
vi.mock(
|
|
78
|
+
"@/features/chat/components/chat-session-workspace-file-preview",
|
|
79
|
+
() => ({
|
|
80
|
+
ChatSessionWorkspaceFilePreview: ({ file }: { file: { path: string } }) => (
|
|
81
|
+
<div data-testid="workspace-file-preview">{file.path}</div>
|
|
82
|
+
),
|
|
83
|
+
}),
|
|
84
|
+
);
|
|
61
85
|
|
|
62
86
|
vi.mock("@/features/chat/components/chat-welcome", () => ({
|
|
63
87
|
ChatWelcome: ({
|
|
@@ -81,12 +105,14 @@ vi.mock("@/features/chat/components/chat-welcome", () => ({
|
|
|
81
105
|
vi.mock("@/features/chat/components/providers/chat-presenter.provider", () => ({
|
|
82
106
|
usePresenter: () => ({
|
|
83
107
|
chatUiManager: {
|
|
108
|
+
goToChatRoot: mocks.goToChatRoot,
|
|
84
109
|
goToSession: mocks.goToSession,
|
|
85
110
|
},
|
|
86
111
|
chatThreadManager: {
|
|
87
112
|
deleteSession: mocks.deleteSession,
|
|
88
113
|
goToProviders: mocks.goToProviders,
|
|
89
114
|
openChildSessionPanel: vi.fn(),
|
|
115
|
+
openSessionCronPanel: mocks.openSessionCronPanel,
|
|
90
116
|
openFilePreview: vi.fn(),
|
|
91
117
|
openSessionFromToolAction: vi.fn(),
|
|
92
118
|
selectChildSessionDetail: vi.fn(),
|
|
@@ -104,10 +130,9 @@ vi.mock("@/features/chat/components/providers/chat-presenter.provider", () => ({
|
|
|
104
130
|
readAt: string | null | undefined,
|
|
105
131
|
) =>
|
|
106
132
|
sessionKey
|
|
107
|
-
? useChatSessionListStore
|
|
108
|
-
|
|
109
|
-
readAt
|
|
110
|
-
)
|
|
133
|
+
? useChatSessionListStore
|
|
134
|
+
.getState()
|
|
135
|
+
.markSessionRead(sessionKey, readAt)
|
|
111
136
|
: undefined,
|
|
112
137
|
},
|
|
113
138
|
chatInputManager: {
|
|
@@ -116,35 +141,45 @@ vi.mock("@/features/chat/components/providers/chat-presenter.provider", () => ({
|
|
|
116
141
|
}),
|
|
117
142
|
}));
|
|
118
143
|
|
|
119
|
-
vi.mock("@/
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
),
|
|
144
|
+
vi.mock("@/shared/hooks/use-config", () => ({
|
|
145
|
+
useCronJobs: () => ({
|
|
146
|
+
data: { jobs: mocks.cronJobs, total: mocks.cronJobs.length },
|
|
147
|
+
}),
|
|
148
|
+
useDeleteCronJob: () => ({
|
|
149
|
+
mutate: mocks.deleteCronJob,
|
|
150
|
+
isPending: false,
|
|
151
|
+
}),
|
|
127
152
|
}));
|
|
128
153
|
|
|
129
154
|
vi.mock(
|
|
130
|
-
"@/features/chat/
|
|
155
|
+
"@/features/chat/components/conversation/session-header/chat-session-header-actions",
|
|
131
156
|
() => ({
|
|
132
|
-
|
|
157
|
+
ChatSessionHeaderActions: () => <button aria-label="More actions" />,
|
|
133
158
|
}),
|
|
134
159
|
);
|
|
135
160
|
|
|
136
161
|
vi.mock(
|
|
137
|
-
"@/features/chat/
|
|
162
|
+
"@/features/chat/components/conversation/session-header/chat-session-project-badge",
|
|
138
163
|
() => ({
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
hydrateError: null,
|
|
143
|
-
isRunning: false,
|
|
144
|
-
}),
|
|
164
|
+
ChatSessionProjectBadge: ({ projectName }: { projectName: string }) => (
|
|
165
|
+
<button>{projectName}</button>
|
|
166
|
+
),
|
|
145
167
|
}),
|
|
146
168
|
);
|
|
147
169
|
|
|
170
|
+
vi.mock("@/features/chat/hooks/use-ncp-child-session-tabs-view", () => ({
|
|
171
|
+
useNcpChildSessionTabsView: () => mocks.resolvedChildTabs,
|
|
172
|
+
}));
|
|
173
|
+
|
|
174
|
+
vi.mock("@/features/chat/hooks/use-ncp-session-conversation", () => ({
|
|
175
|
+
useNcpSessionConversation: () => ({
|
|
176
|
+
visibleMessages: [],
|
|
177
|
+
isHydrating: false,
|
|
178
|
+
hydrateError: null,
|
|
179
|
+
isRunning: false,
|
|
180
|
+
}),
|
|
181
|
+
}));
|
|
182
|
+
|
|
148
183
|
vi.mock("@/shared/components/common/agent-avatar", () => ({
|
|
149
184
|
AgentAvatar: ({ agentId }: { agentId: string }) => (
|
|
150
185
|
<div data-testid="agent-avatar">{agentId}</div>
|
|
@@ -157,66 +192,73 @@ vi.mock("@/shared/components/common/agent-identity", () => ({
|
|
|
157
192
|
),
|
|
158
193
|
}));
|
|
159
194
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
...useChatSessionListStore.getState().snapshot,
|
|
217
|
-
},
|
|
218
|
-
});
|
|
195
|
+
function resetChatConversationPanelTestState() {
|
|
196
|
+
mocks.deleteSession.mockReset();
|
|
197
|
+
mocks.goToProviders.mockReset();
|
|
198
|
+
mocks.createSession.mockReset();
|
|
199
|
+
mocks.createSession.mockReturnValue("draft-session-2");
|
|
200
|
+
mocks.goToChatRoot.mockReset();
|
|
201
|
+
mocks.goToSession.mockReset();
|
|
202
|
+
mocks.openSessionCronPanel.mockReset();
|
|
203
|
+
mocks.deleteCronJob.mockReset();
|
|
204
|
+
mocks.cronJobs = [];
|
|
205
|
+
mocks.setSelectedAgentId.mockReset();
|
|
206
|
+
mocks.setPendingSessionType.mockReset();
|
|
207
|
+
mocks.stickyBottomScroll.mockClear();
|
|
208
|
+
useChatInputStore.setState({
|
|
209
|
+
snapshot: {
|
|
210
|
+
...useChatInputStore.getState().snapshot,
|
|
211
|
+
defaultSessionType: "native",
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
useChatThreadStore.setState({
|
|
215
|
+
snapshot: {
|
|
216
|
+
...useChatThreadStore.getState().snapshot,
|
|
217
|
+
isProviderStateResolved: true,
|
|
218
|
+
modelOptions: [
|
|
219
|
+
{
|
|
220
|
+
value: "openai/gpt-5.1",
|
|
221
|
+
modelLabel: "gpt-5.1",
|
|
222
|
+
providerLabel: "OpenAI",
|
|
223
|
+
} as never,
|
|
224
|
+
],
|
|
225
|
+
sessionTypeLabel: "Codex",
|
|
226
|
+
sessionKey: "draft-session-1",
|
|
227
|
+
sessionDisplayName: undefined,
|
|
228
|
+
agentId: null,
|
|
229
|
+
agentDisplayName: null,
|
|
230
|
+
sessionProjectRoot: null,
|
|
231
|
+
sessionProjectName: null,
|
|
232
|
+
canDeleteSession: false,
|
|
233
|
+
isDeletePending: false,
|
|
234
|
+
isHistoryLoading: false,
|
|
235
|
+
messages: [],
|
|
236
|
+
isSending: false,
|
|
237
|
+
isAwaitingAssistantOutput: false,
|
|
238
|
+
hasSubmittedDraftMessage: false,
|
|
239
|
+
parentSessionKey: null,
|
|
240
|
+
parentSessionLabel: null,
|
|
241
|
+
workspacePanelParentKey: null,
|
|
242
|
+
availableAgents: [
|
|
243
|
+
{ id: "main", displayName: "Main", runtime: "native" },
|
|
244
|
+
{ id: "engineer", displayName: "Engineer", runtime: "codex" },
|
|
245
|
+
],
|
|
246
|
+
childSessionTabs: [],
|
|
247
|
+
activeChildSessionKey: null,
|
|
248
|
+
workspaceFileTabs: [],
|
|
249
|
+
activeWorkspaceFileKey: null,
|
|
250
|
+
},
|
|
219
251
|
});
|
|
252
|
+
useChatSessionListStore.setState({
|
|
253
|
+
optimisticReadAtBySessionKey: {},
|
|
254
|
+
snapshot: {
|
|
255
|
+
...useChatSessionListStore.getState().snapshot,
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
describe("ChatConversationPanel", () => {
|
|
261
|
+
beforeEach(resetChatConversationPanelTestState);
|
|
220
262
|
|
|
221
263
|
it("shows the draft session type in the conversation header", () => {
|
|
222
264
|
render(<ChatConversationPanel />);
|
|
@@ -244,10 +286,12 @@ describe("ChatConversationPanel", () => {
|
|
|
244
286
|
|
|
245
287
|
render(<ChatConversationPanel layoutMode="mobile" />);
|
|
246
288
|
|
|
247
|
-
await user.click(
|
|
289
|
+
await user.click(
|
|
290
|
+
screen.getByRole("button", { name: "create draft session" }),
|
|
291
|
+
);
|
|
248
292
|
|
|
249
293
|
expect(mocks.createSession).toHaveBeenCalledWith("native");
|
|
250
|
-
expect(mocks.
|
|
294
|
+
expect(mocks.goToChatRoot).toHaveBeenCalledTimes(1);
|
|
251
295
|
});
|
|
252
296
|
|
|
253
297
|
it("shows the selected session project badge and more actions trigger", () => {
|
|
@@ -331,7 +375,79 @@ describe("ChatConversationPanel", () => {
|
|
|
331
375
|
expect(
|
|
332
376
|
screen.queryByRole("status", { name: "Loading session history..." }),
|
|
333
377
|
).toBeNull();
|
|
334
|
-
expect(
|
|
378
|
+
expect(
|
|
379
|
+
screen.queryByText("No messages yet. Send one to start."),
|
|
380
|
+
).toBeNull();
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
it("keeps the message list mounted while waiting for the first assistant token", () => {
|
|
384
|
+
useChatThreadStore.setState({
|
|
385
|
+
snapshot: {
|
|
386
|
+
...useChatThreadStore.getState().snapshot,
|
|
387
|
+
sessionKey: "session-1",
|
|
388
|
+
messages: [
|
|
389
|
+
{
|
|
390
|
+
id: "user-1",
|
|
391
|
+
sessionId: "session-1",
|
|
392
|
+
role: "user",
|
|
393
|
+
status: "final",
|
|
394
|
+
parts: [{ type: "text", text: "hello" }],
|
|
395
|
+
timestamp: "2026-05-19T00:00:00.000Z",
|
|
396
|
+
} as never,
|
|
397
|
+
],
|
|
398
|
+
isSending: true,
|
|
399
|
+
isAwaitingAssistantOutput: true,
|
|
400
|
+
},
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
render(<ChatConversationPanel />);
|
|
404
|
+
|
|
405
|
+
expect(screen.getByTestId("chat-message-list").dataset).toMatchObject({
|
|
406
|
+
messageCount: "1",
|
|
407
|
+
sending: "true",
|
|
408
|
+
});
|
|
409
|
+
expect(
|
|
410
|
+
screen.queryByText("No messages yet. Send one to start."),
|
|
411
|
+
).toBeNull();
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
it("does not show assistant waiting copy before the first message is visible", () => {
|
|
415
|
+
useChatThreadStore.setState({
|
|
416
|
+
snapshot: {
|
|
417
|
+
...useChatThreadStore.getState().snapshot,
|
|
418
|
+
sessionKey: "session-1",
|
|
419
|
+
messages: [],
|
|
420
|
+
isSending: true,
|
|
421
|
+
isAwaitingAssistantOutput: true,
|
|
422
|
+
},
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
render(<ChatConversationPanel />);
|
|
426
|
+
|
|
427
|
+
expect(screen.queryByTestId("chat-message-list")).toBeNull();
|
|
428
|
+
expect(
|
|
429
|
+
screen.queryByText("No messages yet. Send one to start."),
|
|
430
|
+
).toBeNull();
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
it("does not reopen the welcome panel after a root draft send fails", () => {
|
|
434
|
+
useChatThreadStore.setState({
|
|
435
|
+
snapshot: {
|
|
436
|
+
...useChatThreadStore.getState().snapshot,
|
|
437
|
+
sessionKey: null,
|
|
438
|
+
messages: [],
|
|
439
|
+
isSending: false,
|
|
440
|
+
isAwaitingAssistantOutput: false,
|
|
441
|
+
hasSubmittedDraftMessage: true,
|
|
442
|
+
},
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
render(<ChatConversationPanel />);
|
|
446
|
+
|
|
447
|
+
expect(screen.queryByTestId("chat-welcome")).toBeNull();
|
|
448
|
+
expect(
|
|
449
|
+
screen.queryByText("No messages yet. Send one to start."),
|
|
450
|
+
).toBeNull();
|
|
335
451
|
});
|
|
336
452
|
|
|
337
453
|
it("does not render runtime lifecycle copy in the conversation alert strip", () => {
|
|
@@ -423,6 +539,7 @@ describe("ChatSessionWorkspacePanel", () => {
|
|
|
423
539
|
|
|
424
540
|
render(
|
|
425
541
|
<ChatSessionWorkspacePanel
|
|
542
|
+
sessionKey="parent-session-1"
|
|
426
543
|
childSessionTabs={[
|
|
427
544
|
{
|
|
428
545
|
sessionKey: "child-session-1",
|
|
@@ -435,12 +552,6 @@ describe("ChatSessionWorkspacePanel", () => {
|
|
|
435
552
|
workspaceFileTabs={[]}
|
|
436
553
|
activeWorkspaceFileKey={null}
|
|
437
554
|
sessionProjectRoot="/Users/demo/project-alpha"
|
|
438
|
-
onSelectSession={vi.fn()}
|
|
439
|
-
onSelectFile={vi.fn()}
|
|
440
|
-
onCloseFile={vi.fn()}
|
|
441
|
-
onClose={vi.fn()}
|
|
442
|
-
onBackToParent={vi.fn()}
|
|
443
|
-
onFileOpen={vi.fn()}
|
|
444
555
|
/>,
|
|
445
556
|
);
|
|
446
557
|
|
|
@@ -491,6 +602,7 @@ describe("ChatSessionWorkspacePanel", () => {
|
|
|
491
602
|
|
|
492
603
|
render(
|
|
493
604
|
<ChatSessionWorkspacePanel
|
|
605
|
+
sessionKey="parent-session-1"
|
|
494
606
|
childSessionTabs={[
|
|
495
607
|
{
|
|
496
608
|
sessionKey: "child-session-1",
|
|
@@ -509,12 +621,6 @@ describe("ChatSessionWorkspacePanel", () => {
|
|
|
509
621
|
workspaceFileTabs={[]}
|
|
510
622
|
activeWorkspaceFileKey={null}
|
|
511
623
|
sessionProjectRoot="/Users/demo/project-alpha"
|
|
512
|
-
onSelectSession={vi.fn()}
|
|
513
|
-
onSelectFile={vi.fn()}
|
|
514
|
-
onCloseFile={vi.fn()}
|
|
515
|
-
onClose={vi.fn()}
|
|
516
|
-
onBackToParent={vi.fn()}
|
|
517
|
-
onFileOpen={vi.fn()}
|
|
518
624
|
/>,
|
|
519
625
|
);
|
|
520
626
|
|
|
@@ -524,6 +630,7 @@ describe("ChatSessionWorkspacePanel", () => {
|
|
|
524
630
|
it("shows opened files as top tabs and renders the file preview pane", () => {
|
|
525
631
|
render(
|
|
526
632
|
<ChatSessionWorkspacePanel
|
|
633
|
+
sessionKey="parent-session-1"
|
|
527
634
|
childSessionTabs={[]}
|
|
528
635
|
activeChildSessionKey={null}
|
|
529
636
|
workspaceFileTabs={[
|
|
@@ -537,12 +644,6 @@ describe("ChatSessionWorkspacePanel", () => {
|
|
|
537
644
|
]}
|
|
538
645
|
activeWorkspaceFileKey="parent-session-1::preview::README.md"
|
|
539
646
|
sessionProjectRoot="/Users/demo/project-alpha"
|
|
540
|
-
onSelectSession={vi.fn()}
|
|
541
|
-
onSelectFile={vi.fn()}
|
|
542
|
-
onCloseFile={vi.fn()}
|
|
543
|
-
onClose={vi.fn()}
|
|
544
|
-
onBackToParent={vi.fn()}
|
|
545
|
-
onFileOpen={vi.fn()}
|
|
546
647
|
/>,
|
|
547
648
|
);
|
|
548
649
|
|
|
@@ -555,4 +656,51 @@ describe("ChatSessionWorkspacePanel", () => {
|
|
|
555
656
|
"workspace-horizontal-scrollbar",
|
|
556
657
|
);
|
|
557
658
|
});
|
|
659
|
+
|
|
660
|
+
it("renders session cron jobs in the workspace sidebar and deletes with a neutral confirmation", async () => {
|
|
661
|
+
const user = userEvent.setup();
|
|
662
|
+
const job: CronJobView = {
|
|
663
|
+
id: "job-1",
|
|
664
|
+
name: "Follow up",
|
|
665
|
+
enabled: true,
|
|
666
|
+
schedule: { kind: "every", everyMs: 3600000 },
|
|
667
|
+
payload: {
|
|
668
|
+
kind: "agent_turn",
|
|
669
|
+
message: "Continue this session later",
|
|
670
|
+
sessionId: "parent-session-1",
|
|
671
|
+
},
|
|
672
|
+
state: {
|
|
673
|
+
nextRunAt: "2026-05-15T10:00:00.000Z",
|
|
674
|
+
lastRunAt: null,
|
|
675
|
+
lastStatus: null,
|
|
676
|
+
lastError: null,
|
|
677
|
+
},
|
|
678
|
+
createdAt: "2026-05-15T09:00:00.000Z",
|
|
679
|
+
updatedAt: "2026-05-15T09:00:00.000Z",
|
|
680
|
+
deleteAfterRun: false,
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
render(
|
|
684
|
+
<ChatSessionWorkspacePanel
|
|
685
|
+
sessionKey="parent-session-1"
|
|
686
|
+
childSessionTabs={[]}
|
|
687
|
+
activeChildSessionKey={null}
|
|
688
|
+
workspaceFileTabs={[]}
|
|
689
|
+
activeWorkspaceFileKey={null}
|
|
690
|
+
activePanelKind="cron"
|
|
691
|
+
sessionCronJobs={[job]}
|
|
692
|
+
sessionProjectRoot="/Users/demo/project-alpha"
|
|
693
|
+
/>,
|
|
694
|
+
);
|
|
695
|
+
|
|
696
|
+
expect(screen.getAllByText("Session cron jobs").length).toBeGreaterThan(0);
|
|
697
|
+
expect(screen.getByText("Follow up")).toBeTruthy();
|
|
698
|
+
expect(screen.getByText("Continue this session later")).toBeTruthy();
|
|
699
|
+
|
|
700
|
+
await user.click(screen.getByRole("button", { name: "Delete" }));
|
|
701
|
+
expect(screen.getByText("Delete cron job?")).toBeTruthy();
|
|
702
|
+
await user.click(screen.getAllByRole("button", { name: "Delete" }).at(-1)!);
|
|
703
|
+
|
|
704
|
+
expect(mocks.deleteCronJob).toHaveBeenCalledWith({ id: "job-1" });
|
|
705
|
+
});
|
|
558
706
|
});
|