@morlay/ui-conversation-manager 0.1.10 → 0.1.11-alpha.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.
- package/README.md +2 -2
- package/dist/client.cjs +1288 -574
- package/dist/client.d.cts +11 -20
- package/dist/client.d.mts +11 -20
- package/dist/client.mjs +71 -76
- package/dist/index.cjs +1 -2
- package/dist/index.d.mts +1 -3
- package/dist/index.mjs +1 -2
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +15 -15
- package/src/client/ConversationManagerPage.tsx +32 -26
- package/src/client/controller.ts +10 -7
- package/src/client/locales.ts +18 -16
package/dist/client.d.cts
CHANGED
|
@@ -3,7 +3,6 @@ import { MainPanelId } from "@deepseek-ai/dsh-client-ui-layout/client";
|
|
|
3
3
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
4
4
|
import { InjectFace, PropsLocale, PropsRuntime } from "@deepseek-ai/dsh-client-ui-slots";
|
|
5
5
|
import "react";
|
|
6
|
-
//#region src/client/locales.d.ts
|
|
7
6
|
declare const zh: {
|
|
8
7
|
panel: string;
|
|
9
8
|
title: string;
|
|
@@ -57,13 +56,13 @@ declare const zh: {
|
|
|
57
56
|
"page.previous": string;
|
|
58
57
|
"page.next": string;
|
|
59
58
|
"page.label": string;
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
59
|
+
"organize.button": string;
|
|
60
|
+
"organize.title": string;
|
|
61
|
+
"organize.description": string;
|
|
62
|
+
"organize.confirm": string;
|
|
63
|
+
"organize.cancel": string;
|
|
64
|
+
"organize.running": string;
|
|
65
|
+
"organize.done": string;
|
|
67
66
|
import: string;
|
|
68
67
|
importing: string;
|
|
69
68
|
imported: string;
|
|
@@ -84,8 +83,6 @@ declare const zh: {
|
|
|
84
83
|
"time.years": string;
|
|
85
84
|
};
|
|
86
85
|
type ConversationManagerKey = keyof typeof zh;
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/client/controller.d.ts
|
|
89
86
|
interface SessionRowRecord {
|
|
90
87
|
sessionId: string;
|
|
91
88
|
title: string | null;
|
|
@@ -151,9 +148,10 @@ interface ConversationManagerPorts {
|
|
|
151
148
|
unarchiveSession(sessionId: SessionId): Promise<void>;
|
|
152
149
|
refresh(): Promise<void>;
|
|
153
150
|
}
|
|
154
|
-
interface
|
|
151
|
+
interface ConversationManagerOrganizeResult {
|
|
155
152
|
orphanSessions: number;
|
|
156
153
|
orphanEvents: number;
|
|
154
|
+
rebuiltSessions: number;
|
|
157
155
|
stoppedAgents: number;
|
|
158
156
|
}
|
|
159
157
|
interface ConversationManagerFace {
|
|
@@ -163,7 +161,7 @@ interface ConversationManagerFace {
|
|
|
163
161
|
remove: (sessionId: SessionId) => Promise<void>;
|
|
164
162
|
exportZip: (sessionId: SessionId) => Promise<void>;
|
|
165
163
|
importZip: (file: File) => Promise<SessionId>;
|
|
166
|
-
|
|
164
|
+
organizeData: () => Promise<ConversationManagerOrganizeResult>;
|
|
167
165
|
loadUsage: (range: UsageRangeKey) => Promise<SessionUsageReport>;
|
|
168
166
|
}
|
|
169
167
|
export declare class ConversationManagerRequestError extends Error {
|
|
@@ -178,17 +176,11 @@ export declare class ConversationManagerController {
|
|
|
178
176
|
private remove;
|
|
179
177
|
private exportZip;
|
|
180
178
|
private importZip;
|
|
181
|
-
private
|
|
179
|
+
private organizeData;
|
|
182
180
|
private loadUsage;
|
|
183
181
|
}
|
|
184
|
-
//#endregion
|
|
185
|
-
//#region src/client/ConversationManagerIcon.d.ts
|
|
186
182
|
type ConversationManagerIconProps = PropsRuntime<"sidebar.panellist">;
|
|
187
|
-
//#endregion
|
|
188
|
-
//#region src/client/ConversationManagerPage.d.ts
|
|
189
183
|
type ConversationManagerPageProps = PropsRuntime<"main"> & PropsLocale<"conversationManager"> & InjectFace<ConversationManagerFace>;
|
|
190
|
-
//#endregion
|
|
191
|
-
//#region src/client/index.d.ts
|
|
192
184
|
declare module "@deepseek-ai/dsh-client-ui-slots" {
|
|
193
185
|
interface LocaleNamespaceMap {
|
|
194
186
|
conversationManager: ConversationManagerKey;
|
|
@@ -199,5 +191,4 @@ export declare const PANEL_ID: MainPanelId;
|
|
|
199
191
|
export declare const PANEL_ORDER = 1;
|
|
200
192
|
export declare const inject: string[];
|
|
201
193
|
export declare function apply(ctx: Context): void;
|
|
202
|
-
//#endregion
|
|
203
194
|
export type { ConversationManagerFace, ConversationManagerIconProps, ConversationManagerKey, ConversationManagerPageProps, ConversationManagerPorts };
|
package/dist/client.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ import { MainPanelId } from "@deepseek-ai/dsh-client-ui-layout/client";
|
|
|
3
3
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
4
4
|
import { InjectFace, PropsLocale, PropsRuntime } from "@deepseek-ai/dsh-client-ui-slots";
|
|
5
5
|
import "react";
|
|
6
|
-
//#region src/client/locales.d.ts
|
|
7
6
|
declare const zh: {
|
|
8
7
|
panel: string;
|
|
9
8
|
title: string;
|
|
@@ -57,13 +56,13 @@ declare const zh: {
|
|
|
57
56
|
"page.previous": string;
|
|
58
57
|
"page.next": string;
|
|
59
58
|
"page.label": string;
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
59
|
+
"organize.button": string;
|
|
60
|
+
"organize.title": string;
|
|
61
|
+
"organize.description": string;
|
|
62
|
+
"organize.confirm": string;
|
|
63
|
+
"organize.cancel": string;
|
|
64
|
+
"organize.running": string;
|
|
65
|
+
"organize.done": string;
|
|
67
66
|
import: string;
|
|
68
67
|
importing: string;
|
|
69
68
|
imported: string;
|
|
@@ -84,8 +83,6 @@ declare const zh: {
|
|
|
84
83
|
"time.years": string;
|
|
85
84
|
};
|
|
86
85
|
type ConversationManagerKey = keyof typeof zh;
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/client/controller.d.ts
|
|
89
86
|
interface SessionRowRecord {
|
|
90
87
|
sessionId: string;
|
|
91
88
|
title: string | null;
|
|
@@ -151,9 +148,10 @@ interface ConversationManagerPorts {
|
|
|
151
148
|
unarchiveSession(sessionId: SessionId): Promise<void>;
|
|
152
149
|
refresh(): Promise<void>;
|
|
153
150
|
}
|
|
154
|
-
interface
|
|
151
|
+
interface ConversationManagerOrganizeResult {
|
|
155
152
|
orphanSessions: number;
|
|
156
153
|
orphanEvents: number;
|
|
154
|
+
rebuiltSessions: number;
|
|
157
155
|
stoppedAgents: number;
|
|
158
156
|
}
|
|
159
157
|
interface ConversationManagerFace {
|
|
@@ -163,7 +161,7 @@ interface ConversationManagerFace {
|
|
|
163
161
|
remove: (sessionId: SessionId) => Promise<void>;
|
|
164
162
|
exportZip: (sessionId: SessionId) => Promise<void>;
|
|
165
163
|
importZip: (file: File) => Promise<SessionId>;
|
|
166
|
-
|
|
164
|
+
organizeData: () => Promise<ConversationManagerOrganizeResult>;
|
|
167
165
|
loadUsage: (range: UsageRangeKey) => Promise<SessionUsageReport>;
|
|
168
166
|
}
|
|
169
167
|
export declare class ConversationManagerRequestError extends Error {
|
|
@@ -178,17 +176,11 @@ export declare class ConversationManagerController {
|
|
|
178
176
|
private remove;
|
|
179
177
|
private exportZip;
|
|
180
178
|
private importZip;
|
|
181
|
-
private
|
|
179
|
+
private organizeData;
|
|
182
180
|
private loadUsage;
|
|
183
181
|
}
|
|
184
|
-
//#endregion
|
|
185
|
-
//#region src/client/ConversationManagerIcon.d.ts
|
|
186
182
|
type ConversationManagerIconProps = PropsRuntime<"sidebar.panellist">;
|
|
187
|
-
//#endregion
|
|
188
|
-
//#region src/client/ConversationManagerPage.d.ts
|
|
189
183
|
type ConversationManagerPageProps = PropsRuntime<"main"> & PropsLocale<"conversationManager"> & InjectFace<ConversationManagerFace>;
|
|
190
|
-
//#endregion
|
|
191
|
-
//#region src/client/index.d.ts
|
|
192
184
|
declare module "@deepseek-ai/dsh-client-ui-slots" {
|
|
193
185
|
interface LocaleNamespaceMap {
|
|
194
186
|
conversationManager: ConversationManagerKey;
|
|
@@ -199,5 +191,4 @@ export declare const PANEL_ID: MainPanelId;
|
|
|
199
191
|
export declare const PANEL_ORDER = 1;
|
|
200
192
|
export declare const inject: string[];
|
|
201
193
|
export declare function apply(ctx: Context): void;
|
|
202
|
-
//#endregion
|
|
203
194
|
export type { ConversationManagerFace, ConversationManagerIconProps, ConversationManagerKey, ConversationManagerPageProps, ConversationManagerPorts };
|
package/dist/client.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
2
2
|
import { Button, IconCloseOutlineRegular, IconSearchOutlineRegular, Input, Modal, Row, Spinner, Stack, Tag, Text, relativeTime } from "@morlay/dsh-client-ui-primitives";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { IconArchiveOutlineRegular } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
5
|
-
|
|
5
|
+
// src/client/controller.ts
|
|
6
6
|
const SESSION_DELETE_PATH = "/api/morlay/v1/session/delete";
|
|
7
7
|
const SESSION_IMPORT_PATH = "/api/morlay/v1/session/import";
|
|
8
8
|
const SESSION_EXPORT_PATH = "/api/morlay/v1/session/export";
|
|
9
|
-
const
|
|
9
|
+
const SESSION_ORGANIZE_PATH = "/api/morlay/v1/session/organize";
|
|
10
10
|
const SESSION_USAGE_PATH = "/api/morlay/v1/session/usage";
|
|
11
11
|
const SESSION_ROWS_PATH = "/api/morlay/v1/session/rows";
|
|
12
12
|
var ConversationManagerRequestError = class extends Error {
|
|
@@ -56,7 +56,7 @@ var ConversationManagerController = class {
|
|
|
56
56
|
remove: (sessionId) => this.remove(sessionId),
|
|
57
57
|
exportZip: (sessionId) => this.exportZip(sessionId),
|
|
58
58
|
importZip: (file) => this.importZip(file),
|
|
59
|
-
|
|
59
|
+
organizeData: () => this.organizeData(),
|
|
60
60
|
loadUsage: (range) => this.loadUsage(range)
|
|
61
61
|
};
|
|
62
62
|
}
|
|
@@ -96,12 +96,13 @@ var ConversationManagerController = class {
|
|
|
96
96
|
await this.ports.refresh();
|
|
97
97
|
return value["sessionId"];
|
|
98
98
|
}
|
|
99
|
-
async
|
|
100
|
-
const value = await postJson(
|
|
99
|
+
async organizeData() {
|
|
100
|
+
const value = await postJson(SESSION_ORGANIZE_PATH, {});
|
|
101
101
|
await this.ports.refresh();
|
|
102
102
|
return {
|
|
103
103
|
orphanSessions: typeof value["orphanSessions"] === "number" ? value["orphanSessions"] : 0,
|
|
104
104
|
orphanEvents: typeof value["orphanEvents"] === "number" ? value["orphanEvents"] : 0,
|
|
105
|
+
rebuiltSessions: typeof value["rebuiltSessions"] === "number" ? value["rebuiltSessions"] : 0,
|
|
105
106
|
stoppedAgents: typeof value["stoppedAgents"] === "number" ? value["stoppedAgents"] : 0
|
|
106
107
|
};
|
|
107
108
|
}
|
|
@@ -127,9 +128,8 @@ function downloadBlob(blob, filename) {
|
|
|
127
128
|
URL.revokeObjectURL(url);
|
|
128
129
|
}, 0);
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const css = ".AmU5Dq_page{width:100%;min-width:0;height:100%;min-height:0;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);font-size:14px;line-height:1.6;display:flex;overflow:hidden}.AmU5Dq_listPane{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.AmU5Dq_pageScroll{scrollbar-gutter:stable;flex:1;min-height:0;overflow:auto}.AmU5Dq_pageContent{max-width:960px;margin:0 auto;padding:0 clamp(24px,4vw,48px) 48px}.AmU5Dq_pageHeading{justify-content:space-between;align-items:center;gap:16px;margin-bottom:24px;padding-top:28px;display:flex}[data-platform=darwin] .AmU5Dq_pageHeading{padding-top:calc(28px + var(--dsh-frame-top-clearance,0px))}.AmU5Dq_pageHeading h1{flex:1;min-width:0;margin:0;font-size:20px;font-weight:500;line-height:28px}.AmU5Dq_headingActions{flex:none;align-items:center;gap:8px;display:flex}.AmU5Dq_filters{flex-wrap:wrap;align-items:center;gap:8px 20px;margin-bottom:14px;display:flex}.AmU5Dq_filterTabs{flex-wrap:wrap;align-items:center;gap:8px 12px;display:flex}.AmU5Dq_filterTab{height:28px;color:var(--dsw-alias-label-tertiary);font:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:14px;flex:none;align-items:center;padding:0 10px;font-size:14px;line-height:22px;display:inline-flex}.AmU5Dq_filterTab:hover{background:var(--dsw-alias-interactive-bg-hover)}.AmU5Dq_filterTabActive{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.AmU5Dq_searchField{border:.5px solid var(--dsw-alias-border-l3);height:36px;color:var(--dsw-alias-label-tertiary);border-radius:12px;align-items:center;margin:0 0 16px;padding:0 10px;transition:border-color .15s;display:flex}.AmU5Dq_searchField:hover{border-color:var(--dsw-alias-border-l2)}.AmU5Dq_searchField:focus-within{border-color:var(--dsw-alias-state-business-primary)}.AmU5Dq_searchField>:first-child{background:0 0;border:0;border-radius:0;flex:1;min-width:0;height:100%;padding:0}.AmU5Dq_searchField>:first-child:focus-within{border-color:#0000}.AmU5Dq_searchField>:first-child svg{width:14px;height:14px}.AmU5Dq_searchField input::placeholder{color:var(--dsw-alias-label-caption)}.AmU5Dq_searchField input:focus-visible{outline:none}.AmU5Dq_searchField input::-webkit-search-cancel-button{display:none}.AmU5Dq_searchClear{width:28px;height:28px;color:var(--dsw-alias-label-tertiary);flex:none;margin-right:-6px;padding:0}.AmU5Dq_searchClear svg{width:14px;height:14px}.AmU5Dq_list{flex-direction:column;gap:4px;min-width:0;display:flex}.AmU5Dq_status{text-align:center;flex:1;place-items:center;min-width:0;min-height:0;padding:24px;display:grid}.AmU5Dq_statusBody{flex-direction:column;align-items:center;gap:12px;display:flex}.AmU5Dq_statusText{color:var(--dsw-alias-label-tertiary);margin:0;font-size:14px;line-height:22px}.AmU5Dq_statusFailure{color:var(--dsw-alias-state-error-primary)}.AmU5Dq_listStatus{text-align:center;place-items:center;padding:32px 0;display:grid}";
|
|
131
|
+
// \0dsh-css-modules:/Users/morlay/src/github.com/morlay/dsh-plugin-main/packages/session/ui-conversation-manager/src/client/ConversationManagerPage.module.css.mjs
|
|
132
|
+
const css = ".hENcOW_page{width:100%;min-width:0;height:100%;min-height:0;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);font-size:14px;line-height:1.6;display:flex;overflow:hidden}.hENcOW_listPane{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.hENcOW_pageScroll{scrollbar-gutter:stable;flex:1;min-height:0;overflow:auto}.hENcOW_pageContent{max-width:960px;margin:0 auto;padding:0 clamp(24px,4vw,48px) 48px}.hENcOW_pageHeading{justify-content:space-between;align-items:center;gap:16px;margin-bottom:24px;padding-top:28px;display:flex}[data-platform=darwin] .hENcOW_pageHeading{padding-top:calc(28px + var(--dsh-frame-top-clearance,0px))}.hENcOW_pageHeading h1{flex:1;min-width:0;margin:0;font-size:20px;font-weight:500;line-height:28px}.hENcOW_headingActions{flex:none;align-items:center;gap:8px;display:flex}.hENcOW_filters{flex-wrap:wrap;align-items:center;gap:8px 20px;margin-bottom:14px;display:flex}.hENcOW_filterTabs{flex-wrap:wrap;align-items:center;gap:8px 12px;display:flex}.hENcOW_filterTab{height:28px;color:var(--dsw-alias-label-tertiary);font:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:14px;flex:none;align-items:center;padding:0 10px;font-size:14px;line-height:22px;display:inline-flex}.hENcOW_filterTab:hover{background:var(--dsw-alias-interactive-bg-hover)}.hENcOW_filterTabActive{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.hENcOW_searchField{border:.5px solid var(--dsw-alias-border-l3);height:36px;color:var(--dsw-alias-label-tertiary);border-radius:12px;align-items:center;margin:0 0 16px;padding:0 10px;transition:border-color .15s;display:flex}.hENcOW_searchField:hover{border-color:var(--dsw-alias-border-l2)}.hENcOW_searchField:focus-within{border-color:var(--dsw-alias-state-business-primary)}.hENcOW_searchField>:first-child{background:0 0;border:0;border-radius:0;flex:1;min-width:0;height:100%;padding:0}.hENcOW_searchField>:first-child:focus-within{border-color:#0000}.hENcOW_searchField>:first-child svg{width:14px;height:14px}.hENcOW_searchField input::placeholder{color:var(--dsw-alias-label-caption)}.hENcOW_searchField input:focus-visible{outline:none}.hENcOW_searchField input::-webkit-search-cancel-button{display:none}.hENcOW_searchClear{width:28px;height:28px;color:var(--dsw-alias-label-tertiary);flex:none;margin-right:-6px;padding:0}.hENcOW_searchClear svg{width:14px;height:14px}.hENcOW_list{flex-direction:column;gap:4px;min-width:0;display:flex}.hENcOW_status{text-align:center;flex:1;place-items:center;min-width:0;min-height:0;padding:24px;display:grid}.hENcOW_statusBody{flex-direction:column;align-items:center;gap:12px;display:flex}.hENcOW_statusText{color:var(--dsw-alias-label-tertiary);margin:0;font-size:14px;line-height:22px}.hENcOW_statusFailure{color:var(--dsw-alias-state-error-primary)}.hENcOW_listStatus{text-align:center;place-items:center;padding:32px 0;display:grid}";
|
|
133
133
|
const tagId = "@morlay/ui-conversation-manager/ConversationManagerPage.module.css";
|
|
134
134
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"@morlay/ui-conversation-manager/ConversationManagerPage.module.css\"]") === null) {
|
|
135
135
|
const tag = document.createElement("style");
|
|
@@ -139,27 +139,26 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
139
139
|
document.head.appendChild(tag);
|
|
140
140
|
}
|
|
141
141
|
var ConversationManagerPage_module_css_default = {
|
|
142
|
-
"
|
|
143
|
-
"headingActions": "
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
142
|
+
"pageContent": "hENcOW_pageContent",
|
|
143
|
+
"headingActions": "hENcOW_headingActions",
|
|
144
|
+
"filterTab": "hENcOW_filterTab",
|
|
145
|
+
"filterTabs": "hENcOW_filterTabs",
|
|
146
|
+
"searchField": "hENcOW_searchField",
|
|
147
|
+
"statusBody": "hENcOW_statusBody",
|
|
148
|
+
"listPane": "hENcOW_listPane",
|
|
149
|
+
"filterTabActive": "hENcOW_filterTabActive",
|
|
150
|
+
"filters": "hENcOW_filters",
|
|
151
|
+
"pageScroll": "hENcOW_pageScroll",
|
|
152
|
+
"listStatus": "hENcOW_listStatus",
|
|
153
|
+
"statusText": "hENcOW_statusText",
|
|
154
|
+
"page": "hENcOW_page",
|
|
155
|
+
"list": "hENcOW_list",
|
|
156
|
+
"status": "hENcOW_status",
|
|
157
|
+
"pageHeading": "hENcOW_pageHeading",
|
|
158
|
+
"searchClear": "hENcOW_searchClear",
|
|
159
|
+
"statusFailure": "hENcOW_statusFailure"
|
|
160
160
|
};
|
|
161
|
-
|
|
162
|
-
//#region src/client/format.ts
|
|
161
|
+
// src/client/format.ts
|
|
163
162
|
function trim(value) {
|
|
164
163
|
return value >= 100 ? String(Math.round(value)) : value.toFixed(1).replace(/\.0$/u, "");
|
|
165
164
|
}
|
|
@@ -178,8 +177,7 @@ function formatPercent(value) {
|
|
|
178
177
|
if (!Number.isFinite(value) || value <= 0) return "0%";
|
|
179
178
|
return `${value >= 100 ? Math.round(value) : Math.round(value * 10) / 10}%`;
|
|
180
179
|
}
|
|
181
|
-
|
|
182
|
-
//#region src/client/ConversationManagerPage.tsx
|
|
180
|
+
// src/client/ConversationManagerPage.tsx
|
|
183
181
|
const PAGE_SIZE = 20;
|
|
184
182
|
const USAGE_SESSION_ROWS = 20;
|
|
185
183
|
function timeLabel(updatedAt, now, t) {
|
|
@@ -224,7 +222,7 @@ function PageStatus({ t, status, text, spinner = false, failure = false }) {
|
|
|
224
222
|
})
|
|
225
223
|
});
|
|
226
224
|
}
|
|
227
|
-
function ConversationManagerPage({ t, listRows, archive, unarchive, remove, exportZip, importZip,
|
|
225
|
+
function ConversationManagerPage({ t, listRows, archive, unarchive, remove, exportZip, importZip, organizeData, loadUsage }) {
|
|
228
226
|
const [rowsPage, setRowsPage] = useState(null);
|
|
229
227
|
const [rowsFailure, setRowsFailure] = useState(null);
|
|
230
228
|
const [query, setQuery] = useState("");
|
|
@@ -239,7 +237,7 @@ function ConversationManagerPage({ t, listRows, archive, unarchive, remove, expo
|
|
|
239
237
|
const [usageLoading, setUsageLoading] = useState(false);
|
|
240
238
|
const [usageError, setUsageError] = useState(null);
|
|
241
239
|
const [confirming, setConfirming] = useState(null);
|
|
242
|
-
const [
|
|
240
|
+
const [organizePhase, setOrganizePhase] = useState("idle");
|
|
243
241
|
const [importing, setImporting] = useState(false);
|
|
244
242
|
const [notice, setNotice] = useState(null);
|
|
245
243
|
const [failure, setFailure] = useState(null);
|
|
@@ -296,19 +294,20 @@ function ConversationManagerPage({ t, listRows, archive, unarchive, remove, expo
|
|
|
296
294
|
setFailure(failureText(error, t));
|
|
297
295
|
});
|
|
298
296
|
};
|
|
299
|
-
const
|
|
300
|
-
|
|
297
|
+
const startOrganize = () => {
|
|
298
|
+
setOrganizePhase("running");
|
|
301
299
|
setFailure(null);
|
|
302
300
|
setNotice(null);
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
setNotice(t("
|
|
301
|
+
organizeData().then((result) => {
|
|
302
|
+
setOrganizePhase("idle");
|
|
303
|
+
setNotice(t("organize.done", {
|
|
306
304
|
sessions: result.orphanSessions,
|
|
307
|
-
events: result.orphanEvents
|
|
305
|
+
events: result.orphanEvents,
|
|
306
|
+
rebuilt: result.rebuiltSessions
|
|
308
307
|
}));
|
|
309
308
|
reloadRows();
|
|
310
309
|
}, (error) => {
|
|
311
|
-
|
|
310
|
+
setOrganizePhase("idle");
|
|
312
311
|
setFailure(failureText(error, t));
|
|
313
312
|
});
|
|
314
313
|
};
|
|
@@ -383,14 +382,14 @@ function ConversationManagerPage({ t, listRows, archive, unarchive, remove, expo
|
|
|
383
382
|
variant: "outline",
|
|
384
383
|
size: "sm",
|
|
385
384
|
"data-action": "gc",
|
|
386
|
-
disabled:
|
|
387
|
-
"aria-label": t("
|
|
385
|
+
disabled: organizePhase !== "idle",
|
|
386
|
+
"aria-label": t("organize.button"),
|
|
388
387
|
onClick: () => {
|
|
389
388
|
setFailure(null);
|
|
390
389
|
setNotice(null);
|
|
391
|
-
|
|
390
|
+
setOrganizePhase("confirm");
|
|
392
391
|
},
|
|
393
|
-
children: t("
|
|
392
|
+
children: t("organize.button")
|
|
394
393
|
})]
|
|
395
394
|
})]
|
|
396
395
|
}),
|
|
@@ -675,38 +674,38 @@ function ConversationManagerPage({ t, listRows, archive, unarchive, remove, expo
|
|
|
675
674
|
})] })
|
|
676
675
|
}),
|
|
677
676
|
/* @__PURE__ */ jsx(Modal, {
|
|
678
|
-
open:
|
|
677
|
+
open: organizePhase === "confirm",
|
|
679
678
|
onClose: () => {
|
|
680
|
-
|
|
679
|
+
setOrganizePhase("idle");
|
|
681
680
|
},
|
|
682
|
-
title: t("
|
|
681
|
+
title: t("organize.title"),
|
|
683
682
|
closeLabel: t("close"),
|
|
684
|
-
description: t("
|
|
683
|
+
description: t("organize.description"),
|
|
685
684
|
footer: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
|
|
686
685
|
variant: "ghost",
|
|
687
686
|
onClick: () => {
|
|
688
|
-
|
|
687
|
+
setOrganizePhase("idle");
|
|
689
688
|
},
|
|
690
|
-
children: t("
|
|
689
|
+
children: t("organize.cancel")
|
|
691
690
|
}), /* @__PURE__ */ jsx(Button, {
|
|
692
691
|
variant: "primary",
|
|
693
|
-
onClick:
|
|
694
|
-
children: t("
|
|
692
|
+
onClick: startOrganize,
|
|
693
|
+
children: t("organize.confirm")
|
|
695
694
|
})] })
|
|
696
695
|
}),
|
|
697
696
|
/* @__PURE__ */ jsx(Modal, {
|
|
698
|
-
open:
|
|
697
|
+
open: organizePhase === "running",
|
|
699
698
|
onClose: () => {},
|
|
700
699
|
headless: true,
|
|
701
|
-
title: t("
|
|
700
|
+
title: t("organize.title"),
|
|
702
701
|
children: /* @__PURE__ */ jsxs(Stack, {
|
|
703
702
|
align: "center",
|
|
704
703
|
gap: 14,
|
|
705
704
|
pad: "blocking",
|
|
706
|
-
children: [/* @__PURE__ */ jsx(Spinner, { label: t("
|
|
705
|
+
children: [/* @__PURE__ */ jsx(Spinner, { label: t("organize.running") }), /* @__PURE__ */ jsx(Text, {
|
|
707
706
|
as: "p",
|
|
708
707
|
size: "md",
|
|
709
|
-
children: t("
|
|
708
|
+
children: t("organize.running")
|
|
710
709
|
})]
|
|
711
710
|
})
|
|
712
711
|
})
|
|
@@ -1002,13 +1001,11 @@ function UsageView({ report, loading, error, tab, onTab, range, onRange, onlySub
|
|
|
1002
1001
|
]
|
|
1003
1002
|
});
|
|
1004
1003
|
}
|
|
1005
|
-
|
|
1006
|
-
//#region src/client/ConversationManagerIcon.tsx
|
|
1004
|
+
// src/client/ConversationManagerIcon.tsx
|
|
1007
1005
|
function ConversationManagerIcon({ size }) {
|
|
1008
1006
|
return /* @__PURE__ */ jsx(IconArchiveOutlineRegular, { size });
|
|
1009
1007
|
}
|
|
1010
|
-
|
|
1011
|
-
//#region src/client/locales.ts
|
|
1008
|
+
// src/client/locales.ts
|
|
1012
1009
|
const zh = {
|
|
1013
1010
|
panel: "对话管理",
|
|
1014
1011
|
title: "对话管理",
|
|
@@ -1062,13 +1059,13 @@ const zh = {
|
|
|
1062
1059
|
"page.previous": "上一页",
|
|
1063
1060
|
"page.next": "下一页",
|
|
1064
1061
|
"page.label": "第 {page} / {total} 页",
|
|
1065
|
-
"
|
|
1066
|
-
"
|
|
1067
|
-
"
|
|
1068
|
-
"
|
|
1069
|
-
"
|
|
1070
|
-
"
|
|
1071
|
-
"
|
|
1062
|
+
"organize.button": "整理数据",
|
|
1063
|
+
"organize.title": "整理数据",
|
|
1064
|
+
"organize.description": "会先停止所有运行中的 Agent,期间界面不可操作;随后回收孤儿 subagent 会话与孤儿数据,重算全部会话的统计数据(token 用量与活动计数),最后执行 VACUUM。",
|
|
1065
|
+
"organize.confirm": "开始整理",
|
|
1066
|
+
"organize.cancel": "取消",
|
|
1067
|
+
"organize.running": "正在整理,请稍候…",
|
|
1068
|
+
"organize.done": "已回收 {sessions} 条孤儿会话、{events} 行孤儿数据,并重算 {rebuilt} 个会话的统计数据。",
|
|
1072
1069
|
import: "导入对话",
|
|
1073
1070
|
importing: "导入中…",
|
|
1074
1071
|
imported: "已导入为新会话。",
|
|
@@ -1141,13 +1138,13 @@ const en = {
|
|
|
1141
1138
|
"page.previous": "Previous",
|
|
1142
1139
|
"page.next": "Next",
|
|
1143
1140
|
"page.label": "Page {page} / {total}",
|
|
1144
|
-
"
|
|
1145
|
-
"
|
|
1146
|
-
"
|
|
1147
|
-
"
|
|
1148
|
-
"
|
|
1149
|
-
"
|
|
1150
|
-
"
|
|
1141
|
+
"organize.button": "Organize data",
|
|
1142
|
+
"organize.title": "Organize data",
|
|
1143
|
+
"organize.description": "Stops every running Agent first — the UI is blocked meanwhile — then reclaims orphan subagent sessions and orphan rows, recomputes usage and activity statistics for all sessions, and runs VACUUM.",
|
|
1144
|
+
"organize.confirm": "Start",
|
|
1145
|
+
"organize.cancel": "Cancel",
|
|
1146
|
+
"organize.running": "Organizing, please wait…",
|
|
1147
|
+
"organize.done": "Reclaimed {sessions} orphan sessions and {events} orphan rows; recomputed statistics for {rebuilt} sessions.",
|
|
1151
1148
|
import: "Import conversation",
|
|
1152
1149
|
importing: "Importing…",
|
|
1153
1150
|
imported: "Imported as a new session.",
|
|
@@ -1167,8 +1164,7 @@ const en = {
|
|
|
1167
1164
|
"time.months": "{n}mo",
|
|
1168
1165
|
"time.years": "{n}y"
|
|
1169
1166
|
};
|
|
1170
|
-
|
|
1171
|
-
//#region src/client/index.ts
|
|
1167
|
+
// src/client/index.ts
|
|
1172
1168
|
const NS = "conversationManager";
|
|
1173
1169
|
const PANEL_ID = "conversations";
|
|
1174
1170
|
const PANEL_ORDER = 1;
|
|
@@ -1207,5 +1203,4 @@ function apply(ctx) {
|
|
|
1207
1203
|
locale: NS
|
|
1208
1204
|
}, ConversationManagerIcon));
|
|
1209
1205
|
}
|
|
1210
|
-
//#endregion
|
|
1211
1206
|
export { ConversationManagerController, ConversationManagerRequestError, NS, PANEL_ID, PANEL_ORDER, apply, inject };
|
package/dist/index.cjs
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Conversation Manager",
|
|
4
|
-
"description": "Full-page conversation management panel (browser half): two tab levels over sessions and usage — search, paging, archive / unarchive / export / delete, import as a new session and
|
|
4
|
+
"description": "Full-page conversation management panel (browser half): two tab levels over sessions and usage — search, paging, archive / unarchive / export / delete, import as a new session and data organization (orphan reclaim + statistics rebuild) in the session view, token usage across all conversations in the usage view."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "对话管理页",
|
|
4
|
-
"description": "「对话管理」全局面板页(浏览器半):会话与统计两层 Tabs——会话视图给出全量会话(含已归档)的搜索、分页、归档 / 取消归档 / 导出 /
|
|
4
|
+
"description": "「对话管理」全局面板页(浏览器半):会话与统计两层 Tabs——会话视图给出全量会话(含已归档)的搜索、分页、归档 / 取消归档 / 导出 / 删除、导入为新会话与整理数据(孤儿回收 + 统计重算),统计视图给出全部对话的 token 用量。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morlay/ui-conversation-manager",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "「对话管理」全局面板页(浏览器半):会话与统计两层 Tabs——会话视图给出全量会话(含已归档)的搜索、分页、归档 / 取消归档 / 导出 /
|
|
3
|
+
"version": "0.1.11-alpha.2",
|
|
4
|
+
"description": "「对话管理」全局面板页(浏览器半):会话与统计两层 Tabs——会话视图给出全量会话(含已归档)的搜索、分页、归档 / 取消归档 / 导出 / 删除、导入为新会话与整理数据(孤儿回收 + 统计重算),统计视图给出全部对话的 token 用量。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"archived-sessions",
|
|
7
7
|
"conversation-manager",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"./locale/*.json": "./locale/*.json"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@morlay/dsh-client-ui-primitives": "0.0.
|
|
39
|
+
"@morlay/dsh-client-ui-primitives": "0.0.14-alpha.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@testing-library/react": "^16.1.0",
|
|
@@ -45,21 +45,21 @@
|
|
|
45
45
|
"react-dom": "^18.2.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
49
|
-
"@deepseek-ai/dsh-api-session-controller": "^0.2.
|
|
50
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.
|
|
51
|
-
"@deepseek-ai/dsh-client-ui-layout": "^0.2.
|
|
52
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.
|
|
53
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.
|
|
54
|
-
"@deepseek-ai/dsh-client-ui-session": "^0.2.
|
|
55
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "^0.2.
|
|
56
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.
|
|
57
|
-
"@deepseek-ai/dsh-client-ui-workspace": "^0.2.
|
|
58
|
-
"@deepseek-ai/dsh-session": "^0.2.
|
|
48
|
+
"@deepseek-ai/cordis": "^4.0.6-alpha.1",
|
|
49
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.2.2-alpha.2",
|
|
50
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.2-alpha.2",
|
|
51
|
+
"@deepseek-ai/dsh-client-ui-layout": "^0.2.2-alpha.2",
|
|
52
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.2-alpha.2",
|
|
53
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-alpha.2",
|
|
54
|
+
"@deepseek-ai/dsh-client-ui-session": "^0.2.2-alpha.2",
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.2.2-alpha.2",
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.2-alpha.2",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-workspace": "^0.2.2-alpha.2",
|
|
58
|
+
"@deepseek-ai/dsh-session": "^0.2.2-alpha.2",
|
|
59
59
|
"react": "^18.2.0"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
|
-
"dsh": ">= 0.2.
|
|
62
|
+
"dsh": ">= 0.2.2-alpha.2 < 0.2.3"
|
|
63
63
|
},
|
|
64
64
|
"dsh": {
|
|
65
65
|
"client": {
|