dsh-lowtide 0.3.0 → 0.3.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.
- package/cordis.patch.yml +47 -47
- package/lib/client.js +1570 -1428
- package/lib/client.js.map +1 -1
- package/lib/index.js +154 -20
- package/lib/types/client/better-sidebar.d.ts +67 -0
- package/lib/types/client/components/QueueDock.d.ts +9 -1
- package/lib/types/client/i18n.d.ts +1 -0
- package/lib/types/client/store.d.ts +6 -0
- package/lib/types/src/turns.d.ts +54 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -5608,6 +5608,87 @@ function forkSeedBoundary(events) {
|
|
|
5608
5608
|
function sleep(ms) {
|
|
5609
5609
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5610
5610
|
}
|
|
5611
|
+
/** Longest a busy source conversation may hold a task up before the runner
|
|
5612
|
+
* falls back to a fork. Capped at 30s and applied with min(timeoutMs, this):
|
|
5613
|
+
* spending the whole off-peak budget waiting on someone's live conversation
|
|
5614
|
+
* would silently eat the window. */
|
|
5615
|
+
const LIVE_WAIT_MAX_MS = 3e4;
|
|
5616
|
+
/**
|
|
5617
|
+
* Resolve once `agent` is idle, or `false` after `timeoutMs`. The losing timer
|
|
5618
|
+
* is cleared as soon as the race settles, so an idle wait leaves no pending
|
|
5619
|
+
* handle (and no lingering ref) behind.
|
|
5620
|
+
*/
|
|
5621
|
+
async function waitIdleFor(agent, timeoutMs) {
|
|
5622
|
+
let timer;
|
|
5623
|
+
const timeout = new Promise((resolve) => {
|
|
5624
|
+
timer = setTimeout(() => resolve(false), timeoutMs);
|
|
5625
|
+
});
|
|
5626
|
+
try {
|
|
5627
|
+
return await Promise.race([agent.whenIdle().then(() => true, () => false), timeout]);
|
|
5628
|
+
} finally {
|
|
5629
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
5630
|
+
}
|
|
5631
|
+
}
|
|
5632
|
+
/**
|
|
5633
|
+
* Canonical form of a directory for comparison. `fs.realpath` folds symlinks,
|
|
5634
|
+
* `..` segments and short/long spellings; on Windows the result is case-folded
|
|
5635
|
+
* because NTFS is case-insensitive (a task recorded as `C:\\Repo` must match
|
|
5636
|
+
* the live session's `C:\\repo`). Unresolvable paths are compared as written.
|
|
5637
|
+
*/
|
|
5638
|
+
function canonicalPath(path) {
|
|
5639
|
+
let resolved = path;
|
|
5640
|
+
try {
|
|
5641
|
+
resolved = realpathSync(path);
|
|
5642
|
+
} catch {}
|
|
5643
|
+
const trimmed = resolved.replace(/[\\/]+$/, "");
|
|
5644
|
+
return process.platform === "win32" ? trimmed.toLowerCase() : trimmed;
|
|
5645
|
+
}
|
|
5646
|
+
/**
|
|
5647
|
+
* Capture the preset a borrowed conversation must be handed back with.
|
|
5648
|
+
* `custom` has no catalog entry (set(session, 'custom') throws), and an empty,
|
|
5649
|
+
* unreadable or unknown value cannot be proven equivalent — all of those mean
|
|
5650
|
+
* the conversation must NOT be driven in place.
|
|
5651
|
+
*/
|
|
5652
|
+
function captureRestorablePreset(ctx, session) {
|
|
5653
|
+
let previous;
|
|
5654
|
+
try {
|
|
5655
|
+
previous = ctx.permissionPresets.current(session);
|
|
5656
|
+
} catch {
|
|
5657
|
+
return { reason: "无法读取原会话的权限档,跑完无法还原" };
|
|
5658
|
+
}
|
|
5659
|
+
if (previous === "custom") return { reason: "原会话的权限档是自定义档,跑完无法还原" };
|
|
5660
|
+
if (previous === void 0 || previous === "") return { reason: "无法确定原会话的权限档,跑完无法还原" };
|
|
5661
|
+
try {
|
|
5662
|
+
const names = ctx.permissionPresets.names;
|
|
5663
|
+
if (names.length > 0 && !names.includes(previous)) return { reason: `原会话的权限档「${previous}」不在预设表里,跑完无法还原` };
|
|
5664
|
+
} catch {}
|
|
5665
|
+
return { previous };
|
|
5666
|
+
}
|
|
5667
|
+
/** Hand a borrowed conversation's preset back. Never throws. */
|
|
5668
|
+
function presetRestore(ctx, session, previous) {
|
|
5669
|
+
return () => {
|
|
5670
|
+
try {
|
|
5671
|
+
ctx.permissionPresets.set(session, previous);
|
|
5672
|
+
} catch (error) {
|
|
5673
|
+
console.error("[lowtide] permission preset restore failed:", error);
|
|
5674
|
+
}
|
|
5675
|
+
};
|
|
5676
|
+
}
|
|
5677
|
+
function liveAgentBlocker(ctx, agent, expected, preset) {
|
|
5678
|
+
const captured = preset ?? captureRestorablePreset(ctx, agent.session);
|
|
5679
|
+
if (captured.reason !== void 0) return captured.reason;
|
|
5680
|
+
const inbox = agent.inbox;
|
|
5681
|
+
if ((inbox?.nextTurn?.length ?? 0) > 0 || (inbox?.nextStep?.length ?? 0) > 0) return "原会话里还有排队未处理的消息";
|
|
5682
|
+
const liveCwd = agent.session.header?.cwd;
|
|
5683
|
+
if (expected.cwd !== void 0) {
|
|
5684
|
+
if (liveCwd === void 0 || liveCwd === "") return "原会话没有记录工作目录,无法确认与任务工作目录一致";
|
|
5685
|
+
if (canonicalPath(liveCwd) !== canonicalPath(expected.cwd)) return `原会话的工作目录是 ${liveCwd},与任务工作目录 ${expected.cwd} 不一致`;
|
|
5686
|
+
}
|
|
5687
|
+
const options = agent.options;
|
|
5688
|
+
if (options?.provider !== expected.provider) return options?.provider === void 0 ? `原会话没有记录模型线路,与任务的 ${expected.provider} 线路不一致` : `原会话走 ${options.provider} 线路,与任务的 ${expected.provider} 线路不一致`;
|
|
5689
|
+
if (options?.model !== expected.model) return options?.model === void 0 ? `原会话没有记录模型,与任务的 ${expected.model} 模型不一致` : `原会话用 ${options.model} 模型,与任务的 ${expected.model} 模型不一致`;
|
|
5690
|
+
if (expected.reasoning !== void 0 && String(options?.reasoningEffort ?? "") !== expected.reasoning) return `原会话的推理档是 ${options?.reasoningEffort === void 0 ? "未设置" : String(options.reasoningEffort)},与任务的 ${expected.reasoning} 不一致`;
|
|
5691
|
+
}
|
|
5611
5692
|
function usageOf(raw) {
|
|
5612
5693
|
const u = raw;
|
|
5613
5694
|
const toNum = (v) => typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
@@ -5757,21 +5838,64 @@ async function executeTurns(ctx, task, nextMessage, timeoutMs, reasoning, resume
|
|
|
5757
5838
|
let resumeNote;
|
|
5758
5839
|
let resumed = false;
|
|
5759
5840
|
let forked = false;
|
|
5841
|
+
let borrowedSession = false;
|
|
5842
|
+
let liveBlocker;
|
|
5760
5843
|
let handle;
|
|
5844
|
+
/** The borrowed session's preset, captured once and reused by the restore. */
|
|
5845
|
+
let borrowedPreset;
|
|
5846
|
+
/** Hand the borrowed conversation's preset back (first thing in finally). */
|
|
5847
|
+
let restorePreset;
|
|
5761
5848
|
if (resumeSessionId !== void 0) try {
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5849
|
+
const liveAgent = ctx.agents.get(SessionId(resumeSessionId));
|
|
5850
|
+
if (liveAgent !== void 0) {
|
|
5851
|
+
borrowedPreset = captureRestorablePreset(ctx, liveAgent.session);
|
|
5852
|
+
liveBlocker = liveAgentBlocker(ctx, liveAgent, {
|
|
5853
|
+
...task.workspace === "" ? {} : { cwd: workspacePath },
|
|
5765
5854
|
provider: selection.provider,
|
|
5766
|
-
model: selection.model
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
}
|
|
5770
|
-
|
|
5771
|
-
|
|
5855
|
+
model: selection.model,
|
|
5856
|
+
...selection.reasoningEffort === void 0 ? {} : { reasoning: String(selection.reasoningEffort) }
|
|
5857
|
+
}, borrowedPreset);
|
|
5858
|
+
}
|
|
5859
|
+
if (liveAgent !== void 0 && liveBlocker === void 0) {
|
|
5860
|
+
const waitMs = Math.min(timeoutMs, LIVE_WAIT_MAX_MS);
|
|
5861
|
+
if (await waitIdleFor(liveAgent, waitMs)) {
|
|
5862
|
+
handle = {
|
|
5863
|
+
agent: liveAgent,
|
|
5864
|
+
dispose: async () => {}
|
|
5865
|
+
};
|
|
5866
|
+
borrowedSession = true;
|
|
5867
|
+
resumed = true;
|
|
5868
|
+
if (borrowedPreset?.previous !== void 0) restorePreset = presetRestore(ctx, liveAgent.session, borrowedPreset.previous);
|
|
5869
|
+
console.log(`[lowtide] ✓ driving the live conversation ${resumeSessionId} in place`);
|
|
5870
|
+
} else liveBlocker = `原会话仍在执行中(等待 ${Math.round(waitMs / 1e3)}s 未空闲)`;
|
|
5871
|
+
}
|
|
5872
|
+
if (handle === void 0) {
|
|
5873
|
+
const resumedHandle = await ctx.agents.resume({
|
|
5874
|
+
resumeSessionId: SessionId(resumeSessionId),
|
|
5875
|
+
agentOptions: {
|
|
5876
|
+
provider: selection.provider,
|
|
5877
|
+
model: selection.model
|
|
5878
|
+
},
|
|
5879
|
+
setup
|
|
5880
|
+
});
|
|
5881
|
+
borrowedPreset = captureRestorablePreset(ctx, resumedHandle.agent.session);
|
|
5882
|
+
if (borrowedPreset.reason !== void 0) {
|
|
5883
|
+
resumeNote = `原会话不能原地续接(${borrowedPreset.reason}),本次改为分支续接`;
|
|
5884
|
+
const refusal = new Error(borrowedPreset.reason);
|
|
5885
|
+
refusal.presetNotRestorable = true;
|
|
5886
|
+
throw refusal;
|
|
5887
|
+
}
|
|
5888
|
+
handle = resumedHandle;
|
|
5889
|
+
resumed = true;
|
|
5890
|
+
borrowedSession = true;
|
|
5891
|
+
if (borrowedPreset.previous !== void 0) restorePreset = presetRestore(ctx, resumedHandle.agent.session, borrowedPreset.previous);
|
|
5892
|
+
resumeNote = void 0;
|
|
5893
|
+
console.log(`[lowtide] ✓ resumed conversation ${resumeSessionId} in place`);
|
|
5894
|
+
}
|
|
5772
5895
|
} catch (error) {
|
|
5896
|
+
const refused = error?.presetNotRestorable === true;
|
|
5773
5897
|
const reason = error instanceof Error ? error.message : String(error);
|
|
5774
|
-
console.error(`[lowtide] resume ${resumeSessionId} failed (${reason}) — trying fork-style continuation`);
|
|
5898
|
+
console.error(refused ? `[lowtide] refusing to drive ${resumeSessionId} in place (${reason}) — trying fork-style continuation` : `[lowtide] resume ${resumeSessionId} failed (${reason}) — trying fork-style continuation`);
|
|
5775
5899
|
const live = ctx.sessions.get(SessionId(resumeSessionId));
|
|
5776
5900
|
const liveCompat = live;
|
|
5777
5901
|
const newSessionApi = typeof liveCompat?.snapshotEvents === "function";
|
|
@@ -5810,9 +5934,11 @@ async function executeTurns(ctx, task, nextMessage, timeoutMs, reasoning, resume
|
|
|
5810
5934
|
setup
|
|
5811
5935
|
});
|
|
5812
5936
|
forked = true;
|
|
5937
|
+
if (liveBlocker !== void 0) resumeNote = `原会话不能原地续接(${liveBlocker}),本次改为分支续接`;
|
|
5813
5938
|
console.log(`[lowtide] ✓ continuation session ${handle.agent.session.id} seeded with ${seed.length} events from ${resumeSessionId} (lossless fork)`);
|
|
5814
5939
|
} else {
|
|
5815
|
-
|
|
5940
|
+
const because = live === void 0 ? `会话续接失败(${reason}),且源会话不在运行中` : "所选会话还没有完整的对话轮次,无法续接其上下文";
|
|
5941
|
+
resumeNote ??= liveBlocker === void 0 ? `${because},已新建会话执行` : `${because}(${liveBlocker}),已新建会话执行`;
|
|
5816
5942
|
console.error(`[lowtide] fork-style continuation unavailable for ${resumeSessionId} (live=${live !== void 0}), using a fresh session:`, error);
|
|
5817
5943
|
handle = await ctx.agents.create({
|
|
5818
5944
|
sessionId: SessionId(`lt-${task.id}-${Date.now()}`),
|
|
@@ -5834,20 +5960,23 @@ async function executeTurns(ctx, task, nextMessage, timeoutMs, reasoning, resume
|
|
|
5834
5960
|
},
|
|
5835
5961
|
setup
|
|
5836
5962
|
});
|
|
5963
|
+
if (handle === void 0) throw new Error("continuation produced no agent handle");
|
|
5837
5964
|
const { agent } = handle;
|
|
5838
|
-
if (workspaceEntity !== void 0) try {
|
|
5965
|
+
if (!borrowedSession && workspaceEntity !== void 0) try {
|
|
5839
5966
|
await workspaceEntity.attachSession(agent.session.id);
|
|
5840
5967
|
console.log(`[lowtide] ✓ session ${agent.session.id} attached to workspace "${workspacePath}"`);
|
|
5841
5968
|
} catch (error) {
|
|
5842
5969
|
console.error(`[lowtide] ✗ attach failed for session ${agent.session.id}:`, error);
|
|
5843
5970
|
}
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5971
|
+
if (!borrowedSession) {
|
|
5972
|
+
const titleService = ctx.get("sessionTitle");
|
|
5973
|
+
if (titleService !== void 0) try {
|
|
5974
|
+
titleService.rename(agent.session, taskSessionTitle(task, resumed ? "resumed" : forked ? "forked" : "task"));
|
|
5975
|
+
} catch (error) {
|
|
5976
|
+
console.error(`[lowtide] session title set failed for ${agent.session.id}:`, error);
|
|
5977
|
+
}
|
|
5978
|
+
else console.warn("[lowtide] sessionTitle service unavailable — sessions keep auto-generated titles");
|
|
5849
5979
|
}
|
|
5850
|
-
else console.warn("[lowtide] sessionTitle service unavailable — sessions keep auto-generated titles");
|
|
5851
5980
|
try {
|
|
5852
5981
|
await agent.whenIdle();
|
|
5853
5982
|
ctx.permissionPresets.set(agent.session, task.permissionPreset);
|
|
@@ -5926,6 +6055,7 @@ async function executeTurns(ctx, task, nextMessage, timeoutMs, reasoning, resume
|
|
|
5926
6055
|
...forked ? { forked: true } : {}
|
|
5927
6056
|
};
|
|
5928
6057
|
} finally {
|
|
6058
|
+
if (restorePreset !== void 0) restorePreset();
|
|
5929
6059
|
const sessions = ctx.get("sessions");
|
|
5930
6060
|
if (sessions !== void 0) try {
|
|
5931
6061
|
await sessions.flush(agent.session);
|
|
@@ -5933,7 +6063,7 @@ async function executeTurns(ctx, task, nextMessage, timeoutMs, reasoning, resume
|
|
|
5933
6063
|
console.error("[lowtide] session flush failed:", error);
|
|
5934
6064
|
}
|
|
5935
6065
|
else console.error("[lowtide] sessions service not available — session may not persist");
|
|
5936
|
-
if (workspaceEntity !== void 0) try {
|
|
6066
|
+
if (workspaceEntity !== void 0 && !borrowedSession) try {
|
|
5937
6067
|
await workspaceEntity.attachSession(agent.session.id);
|
|
5938
6068
|
} catch (error) {
|
|
5939
6069
|
console.error(`[lowtide] re-attach failed for session ${agent.session.id}:`, error);
|
|
@@ -6343,6 +6473,8 @@ async function executeStrategy(ctx, store, task, timeoutMs) {
|
|
|
6343
6473
|
if (strategy === "review") {
|
|
6344
6474
|
const res = await executeTurns(ctx, task, (index) => index === 0 ? prompt : null, timeoutMs, reasoning, resumeSessionId);
|
|
6345
6475
|
if (res.resumeNote !== void 0) resumeNote = res.resumeNote;
|
|
6476
|
+
if (res.resumed) resumed = true;
|
|
6477
|
+
if (res.forked) forked = true;
|
|
6346
6478
|
if (res.status !== "done") return {
|
|
6347
6479
|
final: res.status,
|
|
6348
6480
|
elapsedMs: res.elapsedMs,
|
|
@@ -6356,7 +6488,7 @@ async function executeStrategy(ctx, store, task, timeoutMs) {
|
|
|
6356
6488
|
};
|
|
6357
6489
|
const resultText = res.turns[0]?.text ?? "";
|
|
6358
6490
|
const reviewPrompt = reviewPromptOf(task.prompt, resultText, task.strategyHint);
|
|
6359
|
-
const rev = await executeTurns(ctx, task, (index) => index === 0 ? reviewPrompt : null, timeoutMs, reasoning
|
|
6491
|
+
const rev = await executeTurns(ctx, task, (index) => index === 0 ? reviewPrompt : null, timeoutMs, reasoning);
|
|
6360
6492
|
if (rev.resumeNote !== void 0) resumeNote = rev.resumeNote;
|
|
6361
6493
|
if (rev.resumed) resumed = true;
|
|
6362
6494
|
if (rev.forked) forked = true;
|
|
@@ -6400,6 +6532,8 @@ async function executeStrategy(ctx, store, task, timeoutMs) {
|
|
|
6400
6532
|
const next = (index) => index === 0 ? prompt : null;
|
|
6401
6533
|
const res = await executeTurns(ctx, task, next, timeoutMs, reasoning, resumeSessionId);
|
|
6402
6534
|
if (res.resumeNote !== void 0) resumeNote = res.resumeNote;
|
|
6535
|
+
if (res.resumed) resumed = true;
|
|
6536
|
+
if (res.forked) forked = true;
|
|
6403
6537
|
const totalUsage = sumTurns(res.turns);
|
|
6404
6538
|
const finalText = res.turns.length > 0 ? res.turns[res.turns.length - 1].text : "";
|
|
6405
6539
|
return {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional dsh-better-sidebar bridge: contributes the queue panel as a tab, so
|
|
3
|
+
* the same panel can live in the native right sidebar and in the host's bottom
|
|
4
|
+
* workbench instead of (or alongside) the composer dock.
|
|
5
|
+
*
|
|
6
|
+
* A plain descriptor (no `hidden`, no `bottomOnly`) is listed by BOTH "+" menus
|
|
7
|
+
* — DSH's native right sidebar guide and better-sidebar's own bottom workbench
|
|
8
|
+
* — so one registration serves the sidebar and the bottom bar.
|
|
9
|
+
*
|
|
10
|
+
* better-sidebar is optional and its service lives in the browser half only
|
|
11
|
+
* (`ctx.provide('betterSidebar', …)`). Cordis has no "optional inject", so a
|
|
12
|
+
* static `inject` entry would keep this whole client half dormant on installs
|
|
13
|
+
* without the host; `ctx.inject` waits for the service instead and re-runs when
|
|
14
|
+
* it appears or disappears (HMR / disable), which is the pattern the host's own
|
|
15
|
+
* client code uses for its tab registries.
|
|
16
|
+
*
|
|
17
|
+
* The host API used here (0.28.x): `registerTab` returns a disposer;
|
|
18
|
+
* `openTab` silently no-ops for an unregistered type or a session-less
|
|
19
|
+
* snapshot; `isTabEnabled` reports the user's per-type switch; `subscribe`
|
|
20
|
+
* fires on registry changes and `subscribeState` on enablement/session changes.
|
|
21
|
+
* Nothing from the host package is imported — the service is described by a
|
|
22
|
+
* local structural interface so the plugin adds no dependency.
|
|
23
|
+
*/
|
|
24
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
25
|
+
/** Structural view of the host's tab descriptor. */
|
|
26
|
+
interface SidebarTab {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string | (() => string);
|
|
29
|
+
icon?: React.ReactNode | ((size: number) => React.ReactNode);
|
|
30
|
+
order?: number;
|
|
31
|
+
single?: boolean;
|
|
32
|
+
badge?: () => string | number | null;
|
|
33
|
+
component: () => React.JSX.Element;
|
|
34
|
+
}
|
|
35
|
+
/** The slice of the host's client service this plugin uses. Declared locally,
|
|
36
|
+
* like the other optional host services read here, so the integration adds no
|
|
37
|
+
* dependency and the plugin still loads on installs without the host.
|
|
38
|
+
* `getTab` / `getSnapshot` / `subscribeState` are newer and optional: an older
|
|
39
|
+
* host simply makes those checks fall back to `isTabEnabled`. */
|
|
40
|
+
interface SidebarHost {
|
|
41
|
+
registerTab(tab: SidebarTab): () => void;
|
|
42
|
+
openTab(seed: {
|
|
43
|
+
type: string;
|
|
44
|
+
}): void;
|
|
45
|
+
isTabEnabled(type: string): boolean;
|
|
46
|
+
subscribe(listener: () => void): () => void;
|
|
47
|
+
getTab?(id: string): SidebarTab | undefined;
|
|
48
|
+
getSnapshot?(): {
|
|
49
|
+
sessionId: string | undefined;
|
|
50
|
+
};
|
|
51
|
+
subscribeState?(listener: () => void): () => void;
|
|
52
|
+
}
|
|
53
|
+
/** Tab type of the queue panel (also its `SidebarTab.id`). */
|
|
54
|
+
export declare const QUEUE_TAB_ID = "dsh-lowtide:queue";
|
|
55
|
+
/**
|
|
56
|
+
* True when the host would actually put this tab on screen: the type is
|
|
57
|
+
* registered, the user has not switched it off, and a session is in view.
|
|
58
|
+
* Anything else means `openTab` is a silent no-op, so the dock has to stay.
|
|
59
|
+
*/
|
|
60
|
+
export declare function hostedNow(sidebar: SidebarHost): boolean;
|
|
61
|
+
/** Open (or focus) the queue tab. Falls back to expanding the composer dock
|
|
62
|
+
* when no sidebar host is present or the host would not show the tab, so
|
|
63
|
+
* "enqueued" always lands somewhere visible. */
|
|
64
|
+
export declare function openQueueTab(): void;
|
|
65
|
+
/** Wire the queue tab into better-sidebar when — and only when — it is there. */
|
|
66
|
+
export declare function installQueueTab(ctx: ClientContext): void;
|
|
67
|
+
export {};
|
|
@@ -4,5 +4,13 @@ import { NewTaskModal } from './NewTaskModal.tsx';
|
|
|
4
4
|
export type QueueDockProps = PropsRuntime<'conversation.input.dock'> & {
|
|
5
5
|
t: NsTranslate;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
/** Body props: `t` comes from the slot seat or from a locale-bound thunk. */
|
|
8
|
+
export interface QueueDockViewProps {
|
|
9
|
+
t: NsTranslate;
|
|
10
|
+
/** `dock` = composer chrome; `panel` = fill a sidebar tab. */
|
|
11
|
+
seat?: 'dock' | 'panel';
|
|
12
|
+
}
|
|
13
|
+
/** Slot entry (conversation.input.dock). */
|
|
14
|
+
export declare function QueueDock(props: QueueDockProps): React.JSX.Element | null;
|
|
15
|
+
export declare function QueueDockView(props: QueueDockViewProps): React.JSX.Element | null;
|
|
8
16
|
export { NewTaskModal };
|
|
@@ -182,6 +182,12 @@ export interface ClientUiState {
|
|
|
182
182
|
/** Last state-fetch error message (null when the last poll succeeded). */
|
|
183
183
|
error: string | null;
|
|
184
184
|
queueOpen: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* True while an external sidebar host (dsh-better-sidebar) really shows the
|
|
187
|
+
* queue tab: the type is registered, the user has not switched it off and a
|
|
188
|
+
* session is in view. The composer dock then yields to the tab.
|
|
189
|
+
*/
|
|
190
|
+
sidebarHosted: boolean;
|
|
185
191
|
reportOpen: boolean;
|
|
186
192
|
reportHistoryOpen: boolean;
|
|
187
193
|
reportUnread: boolean;
|
package/lib/types/src/turns.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SessionId } from '@deepseek-ai/dsh-session';
|
|
2
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
2
3
|
import type { Context } from '@deepseek-ai/cordis';
|
|
3
4
|
import { type ReasoningEffort, type Task, type UsageLike } from 'lowtide-core';
|
|
4
5
|
export interface TurnOutcome {
|
|
@@ -52,6 +53,59 @@ export declare function forkSeedBoundary(events: readonly {
|
|
|
52
53
|
seq: number;
|
|
53
54
|
}[]): number | null;
|
|
54
55
|
export declare function sleep(ms: number): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Resolve once `agent` is idle, or `false` after `timeoutMs`. The losing timer
|
|
58
|
+
* is cleared as soon as the race settles, so an idle wait leaves no pending
|
|
59
|
+
* handle (and no lingering ref) behind.
|
|
60
|
+
*/
|
|
61
|
+
export declare function waitIdleFor(agent: Agent, timeoutMs: number): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* Canonical form of a directory for comparison. `fs.realpath` folds symlinks,
|
|
64
|
+
* `..` segments and short/long spellings; on Windows the result is case-folded
|
|
65
|
+
* because NTFS is case-insensitive (a task recorded as `C:\\Repo` must match
|
|
66
|
+
* the live session's `C:\\repo`). Unresolvable paths are compared as written.
|
|
67
|
+
*/
|
|
68
|
+
export declare function canonicalPath(path: string): string;
|
|
69
|
+
export interface LiveExpectation {
|
|
70
|
+
/** Canonical task workspace; undefined = the task has no workspace. */
|
|
71
|
+
cwd?: string;
|
|
72
|
+
provider: string;
|
|
73
|
+
model: string;
|
|
74
|
+
/** The task's EXPLICIT reasoning effort; undefined = no requirement. */
|
|
75
|
+
reasoning?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Why the source conversation cannot be driven in place — undefined means it
|
|
79
|
+
* can. Everything checked here is something a run would otherwise CHANGE on
|
|
80
|
+
* the user's own conversation: the permission preset (restored afterwards,
|
|
81
|
+
* but only if it maps back into the preset table), the workspace (fixed per
|
|
82
|
+
* session), the model route and the reasoning effort. A live conversation
|
|
83
|
+
* whose settings cannot be proven equivalent must be forked, never silently
|
|
84
|
+
* reconfigured.
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* The borrowed conversation's permission preset, captured ONCE. The same value
|
|
88
|
+
* feeds the guard and the finally restore, so a state change between two reads
|
|
89
|
+
* can never leave the user's conversation parked on the task's preset.
|
|
90
|
+
*/
|
|
91
|
+
export interface PresetCapture {
|
|
92
|
+
/** The preset to hand back afterwards; undefined when it is unrestorable. */
|
|
93
|
+
previous?: string;
|
|
94
|
+
/** Why the preset cannot be restored; undefined when it can. */
|
|
95
|
+
reason?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Capture the preset a borrowed conversation must be handed back with.
|
|
99
|
+
* `custom` has no catalog entry (set(session, 'custom') throws), and an empty,
|
|
100
|
+
* unreadable or unknown value cannot be proven equivalent — all of those mean
|
|
101
|
+
* the conversation must NOT be driven in place.
|
|
102
|
+
*/
|
|
103
|
+
export declare function captureRestorablePreset(ctx: Context, session: unknown): PresetCapture;
|
|
104
|
+
/** Hand a borrowed conversation's preset back. Never throws. */
|
|
105
|
+
export declare function presetRestore(ctx: Context, session: unknown, previous: string): () => void;
|
|
106
|
+
export declare function liveAgentBlocker(ctx: Context, agent: Agent, expected: LiveExpectation,
|
|
107
|
+
/** Reuse the caller's single capture instead of reading the preset again. */
|
|
108
|
+
preset?: PresetCapture): string | undefined;
|
|
55
109
|
export declare function usageOf(raw: unknown): UsageLike;
|
|
56
110
|
/** Best-effort human-readable summary of a failed turn/end reason. */
|
|
57
111
|
export declare function summarizeReason(reason: unknown, kind: string): string;
|