dsh-plugin-core-demo 0.29.2 → 0.30.0
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/dist/client.js +142 -109
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -5247,11 +5247,15 @@ var ModelCatalogStore = class {
|
|
|
5247
5247
|
}
|
|
5248
5248
|
};
|
|
5249
5249
|
var modelCatalog = new ModelCatalogStore();
|
|
5250
|
+
var NO_ARCHIVED_SESSIONS = [];
|
|
5250
5251
|
var WorkspaceListStore = class {
|
|
5251
5252
|
constructor() {
|
|
5252
5253
|
this.items = [];
|
|
5254
|
+
this.archivedSessionIds = NO_ARCHIVED_SESSIONS;
|
|
5253
5255
|
this.listeners = /* @__PURE__ */ new Set();
|
|
5254
5256
|
this.getSnapshot = () => this.items;
|
|
5257
|
+
this.getArchiveSnapshot = () => this.archivedSessionIds;
|
|
5258
|
+
this.isSessionArchived = (sessionId) => this.archivedSessionIds.includes(sessionId);
|
|
5255
5259
|
this.subscribe = (listener) => {
|
|
5256
5260
|
this.listeners.add(listener);
|
|
5257
5261
|
return () => {
|
|
@@ -5263,7 +5267,9 @@ var WorkspaceListStore = class {
|
|
|
5263
5267
|
setSource(source) {
|
|
5264
5268
|
this.unsubscribe?.();
|
|
5265
5269
|
const pull = () => {
|
|
5266
|
-
|
|
5270
|
+
const snap = source.getSnapshot();
|
|
5271
|
+
this.items = snap.items;
|
|
5272
|
+
this.archivedSessionIds = snap.archivedSessionIds ?? NO_ARCHIVED_SESSIONS;
|
|
5267
5273
|
for (const listener of this.listeners)
|
|
5268
5274
|
listener();
|
|
5269
5275
|
};
|
|
@@ -59841,8 +59847,95 @@ function pendingFiles(item) {
|
|
|
59841
59847
|
return out;
|
|
59842
59848
|
}
|
|
59843
59849
|
|
|
59850
|
+
// dist/session/tail-follow.js
|
|
59851
|
+
var TAIL_NEAR_BOTTOM_PX = 24;
|
|
59852
|
+
var TAIL_STABLE_FRAMES = 3;
|
|
59853
|
+
function createTailFollower(host) {
|
|
59854
|
+
let following = true;
|
|
59855
|
+
let lastTop = host.metrics().scrollTop;
|
|
59856
|
+
let lastHeight = host.metrics().scrollHeight;
|
|
59857
|
+
let stableFrames = 0;
|
|
59858
|
+
let windowOpen = false;
|
|
59859
|
+
let animating = false;
|
|
59860
|
+
let raf = 0;
|
|
59861
|
+
let disposed = false;
|
|
59862
|
+
const targetOf = () => {
|
|
59863
|
+
const m = host.metrics();
|
|
59864
|
+
return Math.max(0, m.scrollHeight - m.clientHeight);
|
|
59865
|
+
};
|
|
59866
|
+
const nearBottom = () => {
|
|
59867
|
+
const m = host.metrics();
|
|
59868
|
+
return m.scrollHeight - m.scrollTop - m.clientHeight <= TAIL_NEAR_BOTTOM_PX;
|
|
59869
|
+
};
|
|
59870
|
+
const stop = () => {
|
|
59871
|
+
if (animating)
|
|
59872
|
+
host.cancelFrame(raf);
|
|
59873
|
+
animating = false;
|
|
59874
|
+
windowOpen = false;
|
|
59875
|
+
stableFrames = 0;
|
|
59876
|
+
};
|
|
59877
|
+
const step = () => {
|
|
59878
|
+
if (disposed || !following || !windowOpen) {
|
|
59879
|
+
stop();
|
|
59880
|
+
return;
|
|
59881
|
+
}
|
|
59882
|
+
const m = host.metrics();
|
|
59883
|
+
const target = Math.max(0, m.scrollHeight - m.clientHeight);
|
|
59884
|
+
const delta = target - m.scrollTop;
|
|
59885
|
+
if (delta > 1)
|
|
59886
|
+
host.setScrollTop(m.scrollTop + Math.max(1, delta * 0.28));
|
|
59887
|
+
else
|
|
59888
|
+
host.setScrollTop(target);
|
|
59889
|
+
stableFrames = m.scrollHeight === lastHeight && delta <= 1 ? stableFrames + 1 : 0;
|
|
59890
|
+
lastHeight = m.scrollHeight;
|
|
59891
|
+
if (stableFrames >= TAIL_STABLE_FRAMES) {
|
|
59892
|
+
stop();
|
|
59893
|
+
return;
|
|
59894
|
+
}
|
|
59895
|
+
raf = host.frame(step);
|
|
59896
|
+
};
|
|
59897
|
+
return {
|
|
59898
|
+
open() {
|
|
59899
|
+
if (disposed)
|
|
59900
|
+
return;
|
|
59901
|
+
host.setScrollTop(targetOf());
|
|
59902
|
+
lastTop = host.metrics().scrollTop;
|
|
59903
|
+
lastHeight = host.metrics().scrollHeight;
|
|
59904
|
+
},
|
|
59905
|
+
content() {
|
|
59906
|
+
if (disposed || !following)
|
|
59907
|
+
return;
|
|
59908
|
+
windowOpen = true;
|
|
59909
|
+
stableFrames = 0;
|
|
59910
|
+
lastHeight = host.metrics().scrollHeight;
|
|
59911
|
+
if (animating)
|
|
59912
|
+
return;
|
|
59913
|
+
animating = true;
|
|
59914
|
+
raf = host.frame(step);
|
|
59915
|
+
},
|
|
59916
|
+
scrolled() {
|
|
59917
|
+
if (disposed)
|
|
59918
|
+
return;
|
|
59919
|
+
const top2 = host.metrics().scrollTop;
|
|
59920
|
+
if (top2 < lastTop - 1) {
|
|
59921
|
+
following = false;
|
|
59922
|
+
stop();
|
|
59923
|
+
} else if (nearBottom())
|
|
59924
|
+
following = true;
|
|
59925
|
+
lastTop = top2;
|
|
59926
|
+
},
|
|
59927
|
+
dispose() {
|
|
59928
|
+
if (disposed)
|
|
59929
|
+
return;
|
|
59930
|
+
disposed = true;
|
|
59931
|
+
stop();
|
|
59932
|
+
}
|
|
59933
|
+
};
|
|
59934
|
+
}
|
|
59935
|
+
|
|
59844
59936
|
// dist/session/SessionViewModal.js
|
|
59845
59937
|
var EMPTY_ORDER = [];
|
|
59938
|
+
var NOT_ARCHIVED = () => false;
|
|
59846
59939
|
var officialWarned = false;
|
|
59847
59940
|
function safeJson(value) {
|
|
59848
59941
|
try {
|
|
@@ -60335,7 +60428,9 @@ function makeFileMentions(paths, open) {
|
|
|
60335
60428
|
function SessionViewModal(props) {
|
|
60336
60429
|
ensureComponentStyles("session", SESSION_CSS);
|
|
60337
60430
|
const tt = props.t ?? t;
|
|
60338
|
-
const { heading: heading2, sessionId, view, onClose,
|
|
60431
|
+
const { heading: heading2, sessionId, view, onClose, forkSession, openHostSession, onContinue, onOpenFile } = props;
|
|
60432
|
+
const archivedNow = (0, import_react82.useCallback)(() => workspaceList.isSessionArchived(sessionId), [sessionId]);
|
|
60433
|
+
const isArchived = (0, import_react82.useSyncExternalStore)(workspaceList.subscribe, archivedNow, NOT_ARCHIVED);
|
|
60339
60434
|
const subscribe = (0, import_react82.useMemo)(() => (onChange) => view.target.subscribe(onChange), [view]);
|
|
60340
60435
|
const getSnapshot = (0, import_react82.useMemo)(() => () => view.target.getSnapshot(), [view]);
|
|
60341
60436
|
const chat = (0, import_react82.useSyncExternalStore)(subscribe, getSnapshot);
|
|
@@ -60353,7 +60448,6 @@ function SessionViewModal(props) {
|
|
|
60353
60448
|
return next;
|
|
60354
60449
|
});
|
|
60355
60450
|
}, []);
|
|
60356
|
-
const isArchived = archived === true;
|
|
60357
60451
|
const canFork = forkSession !== void 0 && openHostSession !== void 0;
|
|
60358
60452
|
const canDirectOpen = openHostSession !== void 0;
|
|
60359
60453
|
const showContinue = isArchived ? canFork : canDirectOpen;
|
|
@@ -60364,83 +60458,49 @@ function SessionViewModal(props) {
|
|
|
60364
60458
|
(0, import_react82.useEffect)(() => () => {
|
|
60365
60459
|
aliveRef.current = false;
|
|
60366
60460
|
}, []);
|
|
60461
|
+
(0, import_react82.useEffect)(() => {
|
|
60462
|
+
if (!isArchived && !forking && forkTarget !== null && forkTarget.atSeq === void 0)
|
|
60463
|
+
setForkTarget(null);
|
|
60464
|
+
}, [isArchived, forking, forkTarget]);
|
|
60367
60465
|
const flowRef = (0, import_react82.useRef)(null);
|
|
60368
|
-
const
|
|
60369
|
-
(0, import_react82.
|
|
60370
|
-
contentBumpRef.current = true;
|
|
60371
|
-
}, [chat, sessionSnap]);
|
|
60466
|
+
const tailRef = (0, import_react82.useRef)(null);
|
|
60467
|
+
const firstSnapRef = (0, import_react82.useRef)(true);
|
|
60372
60468
|
(0, import_react82.useLayoutEffect)(() => {
|
|
60373
60469
|
const flow = flowRef.current;
|
|
60374
60470
|
const scroller = flow === null ? null : flow.closest(".dshpc-modal__body");
|
|
60375
60471
|
if (scroller === null)
|
|
60376
60472
|
return;
|
|
60377
|
-
|
|
60378
|
-
|
|
60379
|
-
|
|
60380
|
-
|
|
60381
|
-
|
|
60382
|
-
|
|
60383
|
-
|
|
60384
|
-
|
|
60385
|
-
|
|
60386
|
-
|
|
60387
|
-
|
|
60388
|
-
|
|
60389
|
-
|
|
60390
|
-
}
|
|
60391
|
-
const target = scroller.scrollHeight - scroller.clientHeight;
|
|
60392
|
-
const delta = target - scroller.scrollTop;
|
|
60393
|
-
if (delta <= 1) {
|
|
60394
|
-
scroller.scrollTop = target;
|
|
60395
|
-
animating = false;
|
|
60396
|
-
return;
|
|
60397
|
-
}
|
|
60398
|
-
scroller.scrollTop += Math.max(1, delta * 0.28);
|
|
60399
|
-
raf = requestAnimationFrame(step);
|
|
60400
|
-
};
|
|
60401
|
-
const follow = () => {
|
|
60402
|
-
if (!following || animating)
|
|
60403
|
-
return;
|
|
60404
|
-
animating = true;
|
|
60405
|
-
raf = requestAnimationFrame(step);
|
|
60406
|
-
};
|
|
60473
|
+
const tail = createTailFollower({
|
|
60474
|
+
metrics: () => ({
|
|
60475
|
+
scrollTop: scroller.scrollTop,
|
|
60476
|
+
scrollHeight: scroller.scrollHeight,
|
|
60477
|
+
clientHeight: scroller.clientHeight
|
|
60478
|
+
}),
|
|
60479
|
+
setScrollTop: (top2) => {
|
|
60480
|
+
scroller.scrollTop = top2;
|
|
60481
|
+
},
|
|
60482
|
+
frame: (fn) => requestAnimationFrame(fn),
|
|
60483
|
+
cancelFrame: (id3) => cancelAnimationFrame(id3)
|
|
60484
|
+
});
|
|
60485
|
+
tailRef.current = tail;
|
|
60407
60486
|
const onScroll = () => {
|
|
60408
|
-
|
|
60409
|
-
if (top2 < lastTop - 1)
|
|
60410
|
-
following = false;
|
|
60411
|
-
else if (nearBottom()) {
|
|
60412
|
-
following = true;
|
|
60413
|
-
follow();
|
|
60414
|
-
}
|
|
60415
|
-
lastTop = top2;
|
|
60487
|
+
tail.scrolled();
|
|
60416
60488
|
};
|
|
60417
60489
|
scroller.addEventListener("scroll", onScroll, { passive: true });
|
|
60418
|
-
|
|
60419
|
-
const height = flow === null ? 0 : flow.scrollHeight;
|
|
60420
|
-
if (height === lastHeight) {
|
|
60421
|
-
contentBumpRef.current = false;
|
|
60422
|
-
return;
|
|
60423
|
-
}
|
|
60424
|
-
const firstPaint = lastHeight === 0;
|
|
60425
|
-
lastHeight = height;
|
|
60426
|
-
if (!firstPaint && !contentBumpRef.current)
|
|
60427
|
-
return;
|
|
60428
|
-
if (!following)
|
|
60429
|
-
return;
|
|
60430
|
-
if (firstPaint)
|
|
60431
|
-
jump2();
|
|
60432
|
-
else
|
|
60433
|
-
follow();
|
|
60434
|
-
});
|
|
60435
|
-
if (flow !== null)
|
|
60436
|
-
observer.observe(flow);
|
|
60437
|
-
jump2();
|
|
60490
|
+
tail.open();
|
|
60438
60491
|
return () => {
|
|
60439
|
-
|
|
60440
|
-
|
|
60492
|
+
tail.dispose();
|
|
60493
|
+
tailRef.current = null;
|
|
60441
60494
|
scroller.removeEventListener("scroll", onScroll);
|
|
60442
60495
|
};
|
|
60443
60496
|
}, []);
|
|
60497
|
+
(0, import_react82.useLayoutEffect)(() => {
|
|
60498
|
+
if (firstSnapRef.current) {
|
|
60499
|
+
firstSnapRef.current = false;
|
|
60500
|
+
return;
|
|
60501
|
+
}
|
|
60502
|
+
tailRef.current?.content();
|
|
60503
|
+
}, [chat, sessionSnap]);
|
|
60444
60504
|
const onForkAccept = (0, import_react82.useCallback)(() => {
|
|
60445
60505
|
if (forking || forkSession === void 0 || openHostSession === void 0)
|
|
60446
60506
|
return;
|
|
@@ -60705,7 +60765,7 @@ function SessionViewModal(props) {
|
|
|
60705
60765
|
title: tt("continueBranch"),
|
|
60706
60766
|
icon: isArchived ? (0, import_react82.createElement)(official_exports.IconBranchOutlineRegular, { size: 14 }) : (0, import_react82.createElement)(official_exports.IconNewChatOutlineRegular, { size: 14 }),
|
|
60707
60767
|
onClick: () => {
|
|
60708
|
-
if (
|
|
60768
|
+
if (archivedNow()) {
|
|
60709
60769
|
setForkErr(null);
|
|
60710
60770
|
setForkTarget({});
|
|
60711
60771
|
} else if (openHostSession !== void 0) {
|
|
@@ -60911,11 +60971,6 @@ var RealSessionsStore = class {
|
|
|
60911
60971
|
}
|
|
60912
60972
|
};
|
|
60913
60973
|
var realSessions = new RealSessionsStore();
|
|
60914
|
-
var workspacesService = null;
|
|
60915
|
-
function archivedSet() {
|
|
60916
|
-
const ids = workspacesService?.list?.getSnapshot().archivedSessionIds;
|
|
60917
|
-
return ids === void 0 ? /* @__PURE__ */ new Set() : new Set(ids);
|
|
60918
|
-
}
|
|
60919
60974
|
function repullRows() {
|
|
60920
60975
|
const list = sessionsService?.list;
|
|
60921
60976
|
if (list === void 0 || typeof list.getSnapshot !== "function") return;
|
|
@@ -60924,7 +60979,6 @@ function repullRows() {
|
|
|
60924
60979
|
realSessions.markReady();
|
|
60925
60980
|
return;
|
|
60926
60981
|
}
|
|
60927
|
-
const archived = archivedSet();
|
|
60928
60982
|
const rows = [];
|
|
60929
60983
|
for (const id3 of snap.ids) {
|
|
60930
60984
|
const row = snap.byId[id3];
|
|
@@ -60934,8 +60988,7 @@ function repullRows() {
|
|
|
60934
60988
|
displayTitle: row.displayTitle === "" ? id3 : row.displayTitle,
|
|
60935
60989
|
updatedAt: row.updatedAt,
|
|
60936
60990
|
running: row.running,
|
|
60937
|
-
blank: row.blank
|
|
60938
|
-
archived: archived.has(id3)
|
|
60991
|
+
blank: row.blank
|
|
60939
60992
|
});
|
|
60940
60993
|
}
|
|
60941
60994
|
rows.sort((left, right) => right.updatedAt - left.updatedAt);
|
|
@@ -60981,16 +61034,6 @@ function connectRealSessions(ctx) {
|
|
|
60981
61034
|
pull();
|
|
60982
61035
|
list.subscribe(pull);
|
|
60983
61036
|
});
|
|
60984
|
-
ctx.inject(["workspaces"], (sub) => {
|
|
60985
|
-
const workspaces = sub.workspaces;
|
|
60986
|
-
const list = workspaces?.list;
|
|
60987
|
-
if (workspaces === void 0 || list === void 0 || typeof list.getSnapshot !== "function") return;
|
|
60988
|
-
workspacesService = workspaces;
|
|
60989
|
-
repullRows();
|
|
60990
|
-
if (typeof list.subscribe === "function") list.subscribe(() => {
|
|
60991
|
-
repullRows();
|
|
60992
|
-
});
|
|
60993
|
-
});
|
|
60994
61037
|
}
|
|
60995
61038
|
|
|
60996
61039
|
// packages/demo/src/dock.ts
|
|
@@ -62116,8 +62159,8 @@ var docData = {
|
|
|
62116
62159
|
"en": "Renders one session as a **read-only dialog** that looks like the official session page. First `openSessionView` builds the chain and returns a `view` (`null` when unresolvable), then hand it to `SessionViewModal`; **call `view.dispose()` on close**."
|
|
62117
62160
|
},
|
|
62118
62161
|
{
|
|
62119
|
-
"zh": "\
|
|
62120
|
-
"en":
|
|
62162
|
+
"zh": "\u5F52\u6863\u6001\u4E0D\u9700\u8981\u8C03\u7528\u65B9\u4F20\uFF1A\u6838\u5FC3\u8BA2\u9605\u5B98\u65B9 `workspaces.list` \u5FEB\u7167\u7684 `archivedSessionIds`\uFF08\u5BBF\u4E3B `domain/changed` \u2192 `workspace/follow` \u589E\u91CF\u63A8\u9001\uFF09\uFF0C\u5F39\u7A97\u5F00\u7740\u671F\u95F4\u5F52\u6863\u5FBD\u6807\u4E0E\u300C\u7EE7\u7EED\u5BF9\u8BDD\u300D\u5B9E\u65F6\u8DDF\u968F\uFF1B\u70B9\u51FB\u524D\u8FD8\u4F1A\u7528\u6743\u5A01\u5FEB\u7167\u590D\u6838\uFF0C\u4E0D\u4F1A\u76F4\u5F00\u5DF2\u5F52\u6863\u4F1A\u8BDD\u3002\u524D\u63D0\u662F\u63D2\u4EF6 client `apply` \u8C03\u8FC7\u4E00\u6B21 `connectHost(ctx)`\u3002\u5F52\u6863\u4F1A\u8BDD\u8D70\u540C\u4E00\u6761\u6570\u636E\u94FE\uFF0C\u540C\u6837\u53EF\u8BFB\u3002",
|
|
62163
|
+
"en": 'Archive state needs no prop: core subscribes to `archivedSessionIds` on the official `workspaces.list` snapshot (host `domain/changed` \u2192 `workspace/follow` increments), so the badge and "Continue" follow changes while the dialog stays open; the click re-checks the authoritative snapshot so an archived session is never opened directly. Call `connectHost(ctx)` once in the plugin client `apply`. Archived sessions use the same data chain and read fine.'
|
|
62121
62164
|
},
|
|
62122
62165
|
{
|
|
62123
62166
|
"zh": "\u5FEB\u7167\u53EA\u8BFB\uFF0C\u6846\u5185\u4E0D\u80FD\u6253\u5B57\u7EED\u804A\u3002\u7EED\u804A = `forkSession` \u5F00\u5206\u652F + `openHostSession` \u8DF3\u5B98\u65B9\u4F1A\u8BDD\u533A\uFF1B\u6682\u5B58\u8F93\u5165\u6846\u7684\u786E\u5B9A\u8D70 `onContinue`\uFF08fork + \u53D1\u9996\u8F6E + \u8DF3\u8F6C\uFF09\u3002",
|
|
@@ -62231,16 +62274,6 @@ var docData = {
|
|
|
62231
62274
|
"en": "Dialog title, usually the displayTitle from the host sessions.list; the session id sits on the monospace subtitle line below it"
|
|
62232
62275
|
}
|
|
62233
62276
|
},
|
|
62234
|
-
{
|
|
62235
|
-
"name": "archived",
|
|
62236
|
-
"type": "boolean",
|
|
62237
|
-
"def": "false",
|
|
62238
|
-
"required": "\u5426",
|
|
62239
|
-
"desc": {
|
|
62240
|
-
"zh": "\u5DF2\u5F52\u6863\u65F6\u6807\u9898\u65C1\u663E\u793A\u5F52\u6863\u5FBD\u6807\uFF0C\u4E14\u300C\u7EE7\u7EED\u5BF9\u8BDD\u300D\u5148\u5F39 fork \u786E\u8BA4\u6846\uFF1B\u672A\u5F52\u6863\u5219\u76F4\u8DF3\u5B98\u65B9\u4F1A\u8BDD\u9875",
|
|
62241
|
-
"en": 'When true an archive badge appears beside the title and "Continue" asks to fork first; when false it jumps straight to the official session page'
|
|
62242
|
-
}
|
|
62243
|
-
},
|
|
62244
62277
|
{
|
|
62245
62278
|
"name": "forkSession",
|
|
62246
62279
|
"type": "(sessionId, atSeq?) => Promise<string>",
|
|
@@ -62302,7 +62335,7 @@ var docData = {
|
|
|
62302
62335
|
{
|
|
62303
62336
|
"id": "session-usage",
|
|
62304
62337
|
"lang": "tsx",
|
|
62305
|
-
"src": "import { openSessionView, openSessionReview, SessionViewModal } from 'dsh-plugin-core/session'\n\n// \u5BBF\u4E3B\u670D\u52A1\u7531\u8C03\u7528\u65B9\u6CE8\u5165\uFF1Asessions \u2190 dsh-api-session-controller\u3001\n// uiConversation \u2190 dsh-client-ui-conversation\nconst view = openSessionView(sessions, uiConversation, sessionId, 'dsh-task-reminder')\nif (view !== null) {\n h(SessionViewModal, {\n sessionId,\n view,\n heading: '\u955C\u50CF\u5347\u7EA7\u65E5\u62A5', // \u6807\u9898\uFF0C\u7F3A\u7701\u300C\u4F1A\u8BDD\u9884\u89C8\u300D\n onClose: () => { view.dispose(); setOpen(false) }, // \u5173\u95ED\u5FC5\u987B dispose\n // \u7EED\u804A\uFF08\u53EF\u9009\uFF09\uFF1Afork \u5F00\u5206\u652F \u2192 \u8DF3\u5B98\u65B9\u4F1A\u8BDD\u533A\uFF1B\u4E24\u8005\u7F3A\u4E00\u5373\u4E0D\u6E32\u67D3\u8BE5\u5165\u53E3\n forkSession: (id, atSeq) => sessions.fork({ sessionId: id, increaseTitle: true, atSeq }),\n openHostSession: (id) => uiWorkspace.openSession(id),\n // \u6682\u5B58\u8F93\u5165\u6846\uFF08\u53EF\u9009\uFF09\uFF1A\u7531\u8C03\u7528\u65B9 fork + \u53D1\u9996\u8F6E + \u8DF3\u8F6C\n onContinue: async (message) => {\n const child = await forkSession(sessionId)\n await hostContinue(child, message)\n openHostSession(child)\n },\n // \u6587\u4EF6\u6253\u5F00\u51FA\u53E3\uFF1A\u7ED9\u4E00\u4E2A\u843D\u70B9\u5373\u53EF\uFF08\u5143\u7D20\u6216\u9009\u62E9\u5668\uFF09\uFF0C\u6838\u5FC3\u81EA\u5E26\u53F3\u4FA7\u5206\u680F\n onOpenFile: (path, sid, opts) => openFilePreview({ mount: '#page-row', path, sessionId: sid, line: opts?.line }),\n // \u53D8\u66F4\u6587\u4EF6\u5BA1\u9605\uFF1A\u4E00\u884C\u6253\u5F00\u90A3\u6B21\u6539\u52A8\u7684 diff\uFF08\u9762\u677F / \u5173\u95ED\u94AE\u5168\u5F52\u6838\u5FC3\uFF09\n onOpenReview: (locator) => openSessionReview({ mount: '#page-row', locator }),\n
|
|
62338
|
+
"src": "import { openSessionView, openSessionReview, SessionViewModal } from 'dsh-plugin-core/session'\n\n// \u5BBF\u4E3B\u670D\u52A1\u7531\u8C03\u7528\u65B9\u6CE8\u5165\uFF1Asessions \u2190 dsh-api-session-controller\u3001\n// uiConversation \u2190 dsh-client-ui-conversation\nconst view = openSessionView(sessions, uiConversation, sessionId, 'dsh-task-reminder')\nif (view !== null) {\n h(SessionViewModal, {\n sessionId,\n view,\n heading: '\u955C\u50CF\u5347\u7EA7\u65E5\u62A5', // \u6807\u9898\uFF0C\u7F3A\u7701\u300C\u4F1A\u8BDD\u9884\u89C8\u300D\n onClose: () => { view.dispose(); setOpen(false) }, // \u5173\u95ED\u5FC5\u987B dispose\n // \u7EED\u804A\uFF08\u53EF\u9009\uFF09\uFF1Afork \u5F00\u5206\u652F \u2192 \u8DF3\u5B98\u65B9\u4F1A\u8BDD\u533A\uFF1B\u4E24\u8005\u7F3A\u4E00\u5373\u4E0D\u6E32\u67D3\u8BE5\u5165\u53E3\n forkSession: (id, atSeq) => sessions.fork({ sessionId: id, increaseTitle: true, atSeq }),\n openHostSession: (id) => uiWorkspace.openSession(id),\n // \u6682\u5B58\u8F93\u5165\u6846\uFF08\u53EF\u9009\uFF09\uFF1A\u7531\u8C03\u7528\u65B9 fork + \u53D1\u9996\u8F6E + \u8DF3\u8F6C\n onContinue: async (message) => {\n const child = await forkSession(sessionId)\n await hostContinue(child, message)\n openHostSession(child)\n },\n // \u6587\u4EF6\u6253\u5F00\u51FA\u53E3\uFF1A\u7ED9\u4E00\u4E2A\u843D\u70B9\u5373\u53EF\uFF08\u5143\u7D20\u6216\u9009\u62E9\u5668\uFF09\uFF0C\u6838\u5FC3\u81EA\u5E26\u53F3\u4FA7\u5206\u680F\n onOpenFile: (path, sid, opts) => openFilePreview({ mount: '#page-row', path, sessionId: sid, line: opts?.line }),\n // \u53D8\u66F4\u6587\u4EF6\u5BA1\u9605\uFF1A\u4E00\u884C\u6253\u5F00\u90A3\u6B21\u6539\u52A8\u7684 diff\uFF08\u9762\u677F / \u5173\u95ED\u94AE\u5168\u5F52\u6838\u5FC3\uFF09\n onOpenReview: (locator) => openSessionReview({ mount: '#page-row', locator }),\n // \u5F52\u6863\u6001\u4E0D\u7528\u4F20\uFF1A\u6838\u5FC3\u8BA2\u9605\u5B98\u65B9 workspaces \u5FEB\u7167\uFF08apply \u91CC connectHost \u63A5\u7EBF\u4E00\u6B21\u5373\u53EF\uFF09\n t, // \u53EF\u9009\uFF0C\u8986\u76D6\u6587\u6848\n })\n}"
|
|
62306
62339
|
},
|
|
62307
62340
|
{
|
|
62308
62341
|
"id": "session-data-chain",
|
|
@@ -68454,7 +68487,7 @@ h(SessionViewModal, {
|
|
|
68454
68487
|
sessionId: row.sessionId,
|
|
68455
68488
|
view,
|
|
68456
68489
|
heading: row.displayTitle, // \u6807\u9898\u53EF\u81EA\u5B9A\u4E49\uFF1B\u4F1A\u8BDD id \u81EA\u52A8\u663E\u793A\u5728\u6807\u9898\u4E0B\u65B9\uFF08\u526F\u6807\u9898\u884C\uFF09
|
|
68457
|
-
|
|
68490
|
+
// \u5F52\u6863\u6001\u4E0D\u4F20\uFF1A\u6838\u5FC3\u8BA2\u9605\u5B98\u65B9 workspaces \u5FEB\u7167\uFF0C\u5F39\u7A97\u5F00\u7740\u671F\u95F4\u5FBD\u6807\u4E0E\u300C\u7EE7\u7EED\u5BF9\u8BDD\u300D\u5B9E\u65F6\u8DDF\u968F
|
|
68458
68491
|
onClose: () => { view.dispose(); setOpenId(null) },
|
|
68459
68492
|
forkSession: (id, atSeq) => sessions.fork({ sessionId: id, increaseTitle: true, atSeq }),
|
|
68460
68493
|
openHostSession: (id) => uiWorkspace.openSession(id),
|
|
@@ -68575,6 +68608,7 @@ function RealSessionListDemo() {
|
|
|
68575
68608
|
const state = (0, import_react89.useSyncExternalStore)(realSessions.subscribe, realSessions.getSnapshot);
|
|
68576
68609
|
const files = (0, import_react89.useSyncExternalStore)(fileServices.subscribe, fileServices.getSnapshot);
|
|
68577
68610
|
const wsItems = (0, import_react89.useSyncExternalStore)(workspaceList.subscribe, workspaceList.getSnapshot);
|
|
68611
|
+
const archivedIds = (0, import_react89.useSyncExternalStore)(workspaceList.subscribe, workspaceList.getArchiveSnapshot);
|
|
68578
68612
|
const anchor = pickWorkspaceAnchor(wsItems);
|
|
68579
68613
|
const [openId, setOpenId] = (0, import_react89.useState)(null);
|
|
68580
68614
|
const view = (0, import_react89.useMemo)(() => openId === null ? null : openRealSessionView(openId), [openId]);
|
|
@@ -68636,7 +68670,7 @@ function RealSessionListDemo() {
|
|
|
68636
68670
|
},
|
|
68637
68671
|
(0, import_react89.createElement)("span", { style: { flex: "1", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, row.displayTitle),
|
|
68638
68672
|
row.running ? (0, import_react89.createElement)(Chip, { size: "xs", tone: "warning" }, t3("sessionListRunning")) : null,
|
|
68639
|
-
row.
|
|
68673
|
+
archivedIds.includes(row.sessionId) ? (0, import_react89.createElement)(
|
|
68640
68674
|
Chip,
|
|
68641
68675
|
{ size: "xs" },
|
|
68642
68676
|
(0, import_react89.createElement)(
|
|
@@ -68652,9 +68686,8 @@ function RealSessionListDemo() {
|
|
|
68652
68686
|
openId !== null && view !== null ? (0, import_react89.createElement)(SessionViewModal, {
|
|
68653
68687
|
sessionId: openId,
|
|
68654
68688
|
view,
|
|
68655
|
-
// 标题 =
|
|
68689
|
+
// 标题 = 会话自己的标题;归档态由核心订阅官方快照,不在这里传。
|
|
68656
68690
|
heading: state.rows.find((row) => row.sessionId === openId)?.displayTitle,
|
|
68657
|
-
archived: state.rows.find((row) => row.sessionId === openId)?.archived,
|
|
68658
68691
|
onClose: () => {
|
|
68659
68692
|
view.dispose();
|
|
68660
68693
|
setOpenId(null);
|
|
@@ -69383,9 +69416,9 @@ function ReferencePage() {
|
|
|
69383
69416
|
"tbody",
|
|
69384
69417
|
null,
|
|
69385
69418
|
[
|
|
69386
|
-
[t3("buildCore"), `v${"0.
|
|
69387
|
-
[t3("buildDemo"), `v${"0.
|
|
69388
|
-
[t3("buildStamp"), "261104-
|
|
69419
|
+
[t3("buildCore"), `v${"0.30.0"}`],
|
|
69420
|
+
[t3("buildDemo"), `v${"0.30.0"}`],
|
|
69421
|
+
[t3("buildStamp"), "261104-115235-188"]
|
|
69389
69422
|
].map(
|
|
69390
69423
|
([label, value]) => (0, import_react93.createElement)(
|
|
69391
69424
|
"tr",
|
|
@@ -69697,9 +69730,9 @@ function DemoPage() {
|
|
|
69697
69730
|
lineHeight: "14px"
|
|
69698
69731
|
}
|
|
69699
69732
|
},
|
|
69700
|
-
(0, import_react95.createElement)("span", null, `core v${"0.
|
|
69701
|
-
(0, import_react95.createElement)("span", null, `demo v${"0.
|
|
69702
|
-
(0, import_react95.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261104-
|
|
69733
|
+
(0, import_react95.createElement)("span", null, `core v${"0.30.0"}`),
|
|
69734
|
+
(0, import_react95.createElement)("span", null, `demo v${"0.30.0"}`),
|
|
69735
|
+
(0, import_react95.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261104-115235-188")
|
|
69703
69736
|
)
|
|
69704
69737
|
)
|
|
69705
69738
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-core-demo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "The shared UI foundation for DSH plugins, with a live component preview: design tokens, common controls, workspace browsing and notifications maintained in one place — install it to preview every component in a real host.",
|
|
5
5
|
"icon": "./assets/icon-components.svg",
|
|
6
6
|
"keywords": [
|