@dsmm/dsmm 0.3.32 → 0.3.34
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 +6 -4
- package/agent-presets/dsmm-oracle/agent.cordis.yml +2 -0
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +2 -0
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +2 -0
- package/agent-presets/dsmm-planner/agent.cordis.yml +1 -0
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +2 -0
- package/cordis.patch.yml +3 -0
- package/docs/compatibility.md +1 -1
- package/docs/lsp.md +6 -6
- package/docs/maintenance.md +2 -0
- package/docs/roadmap.md +14 -11
- package/docs/settings-status.md +1 -1
- package/docs/testing.md +3 -4
- package/dsh-plugin.json +1 -1
- package/lib/client/NativeToolView-data.js +2 -2
- package/lib/client/NativeToolView.d.ts +5 -9
- package/lib/client/NativeToolView.js +23 -14
- package/lib/client/RoleToolView-locales.d.ts +1 -1
- package/lib/client/RoleToolView-locales.js +2 -2
- package/lib/client/RoleToolView.d.ts +3 -12
- package/lib/client/RoleToolView.js +18 -13
- package/lib/client/child-conversation.d.ts +24 -0
- package/lib/client/child-conversation.js +39 -0
- package/lib/client.js +89 -30
- package/lib/index.js +2 -3
- package/lib/lsp-entry.d.ts +5 -0
- package/lib/lsp-entry.js +6 -0
- package/lib/lsp.d.ts +6 -3
- package/lib/lsp.js +125 -57
- package/lib/native-admission.js +16 -8
- package/lib/prompts.js +1 -1
- package/lib/resident-root.d.ts +1 -1
- package/lib/resident-root.js +39 -6
- package/lib/role-subagents.js +22 -3
- package/package.json +5 -1
- package/prompts/source/agents/plan-critic.md +2 -0
- package/prompts/source/agents/planner.md +1 -0
- package/prompts/source/agents/reviewer.md +2 -0
- package/prompts/source/deepwork/gpt.md +3 -1
- package/skills/avoid-ai-slop/SKILL.md +2 -0
- package/skills/brainstorming/SKILL.md +2 -0
- package/skills/receiving-code-review/SKILL.md +2 -0
- package/skills/requesting-code-review/SKILL.md +1 -1
- package/skills/writing-plans/SKILL.md +1 -1
|
@@ -4,6 +4,7 @@ import { Button, CodeBlock, DisclosureRow, IconAgentPresetOutlineRegular, Segmen
|
|
|
4
4
|
import { actualRoleTool, observedRoleTool, preparingRoleTool, requestedRoleTool, roleToolDisplay, roleToolKeys, technicalJsonData, technicalTableRows } from "./RoleToolView-data.js";
|
|
5
5
|
import { ROLE_TOOL_NS, roleToolEn, roleToolZh } from "./RoleToolView-locales.js";
|
|
6
6
|
import { registerNativeToolViews } from "./NativeToolView.js";
|
|
7
|
+
import { childConversationAction, childConversationInjection, useCardObservation } from "./child-conversation.js";
|
|
7
8
|
const styles = `
|
|
8
9
|
.dsmm-role-tool{min-width:0;color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);font-size:14px;line-height:22px}
|
|
9
10
|
.dsmm-role-tool .dsmm-role-heading{color:var(--dsw-alias-label-primary);height:auto;min-height:32px}
|
|
@@ -40,7 +41,7 @@ export function RoleToolView(props) {
|
|
|
40
41
|
const { t } = props;
|
|
41
42
|
const raw = props.phase === "preparing" ? partial.preview : props.phase === "start" ? props.block.argsRaw : props.block.call?.argsRaw ?? "";
|
|
42
43
|
const requested = partial?.requested ?? requestedRoleTool(props.toolName, raw);
|
|
43
|
-
const observation =
|
|
44
|
+
const observation = useCardObservation(props);
|
|
44
45
|
const observationStatus = props.useRoleCalls(state => state.status);
|
|
45
46
|
const observationIssue = props.useRoleCalls(state => state.issue);
|
|
46
47
|
const result = props.phase === "result" ? props.block : undefined;
|
|
@@ -57,17 +58,21 @@ export function RoleToolView(props) {
|
|
|
57
58
|
const actual = persisted?.phase === "settled" ? persisted : observed ?? inactivePersisted;
|
|
58
59
|
const comparison = actual?.routeComparison;
|
|
59
60
|
const target = actual?.role ?? requested.target;
|
|
60
|
-
const
|
|
61
|
+
const receipt = persisted?.phase === "reserved" ? undefined : persisted;
|
|
62
|
+
const observedChildId = observed?.phase === "reserved" ? undefined : observed?.childId;
|
|
63
|
+
const openChild = childConversationAction(props.useChildWorkspace(workspace => workspace), props.sessionId, props.useProjection("subagentCatalog"), receipt?.childId, observedChildId, receipt?.childId === undefined ? "unknown" : receipt.mode);
|
|
64
|
+
const observedStop = actual?.phase === "settled" ? actual.stopReason : undefined;
|
|
65
|
+
const state = result?.error?.code === "interrupted" || observedStop === "aborted" ? "stopped"
|
|
66
|
+
: failed || observedStop !== undefined && observedStop !== "completed" ? "error"
|
|
67
|
+
: result !== undefined && actual?.delivery === "parent" && actual.phase !== "settled" ? "background"
|
|
68
|
+
: actual?.phase === "settled" || result !== undefined ? "result"
|
|
69
|
+
: props.phase === "preparing" ? "preparing" : "running";
|
|
70
|
+
const isOngoing = state === "running" || state === "preparing";
|
|
71
|
+
const action = state === "preparing" ? t("calling") : t("call");
|
|
61
72
|
const targetLabel = target === undefined ? t("unknownTarget") : roleToolDisplay(target);
|
|
62
73
|
const rawDesc = requested.description?.trim();
|
|
63
74
|
const singleLineDesc = rawDesc ? rawDesc.replace(/\s+/gu, " ") : undefined;
|
|
64
75
|
const title = `${action} ${targetLabel}`;
|
|
65
|
-
const observedStop = actual?.phase === "settled" ? actual.stopReason : undefined;
|
|
66
|
-
const state = result?.error?.code === "interrupted" || observedStop === "aborted" ? "stopped"
|
|
67
|
-
: failed || observedStop !== undefined && observedStop !== "completed" ? "error"
|
|
68
|
-
: result === undefined ? props.phase === "preparing" ? "preparing" : "running"
|
|
69
|
-
: actual?.delivery === "parent" && actual.phase !== "settled" ? "background" : "result";
|
|
70
|
-
const isOngoing = state === "running" || props.phase === "preparing";
|
|
71
76
|
const code = (value) => _jsx(CodeBlock, { code: value, copyLabel: t("copy"), copiedLabel: t("copied") });
|
|
72
77
|
const [viewMode, setViewMode] = useState("table");
|
|
73
78
|
const controlId = `dsmm-tech-${props.callId || "call"}`;
|
|
@@ -84,10 +89,10 @@ export function RoleToolView(props) {
|
|
|
84
89
|
const actualRoute = comparison?.liveRoute;
|
|
85
90
|
const routeLabel = (route, missingEffort = false) => `${route.provider}/${route.model}${route.reasoningEffort === undefined ? missingEffort ? ` · ${t("effortUnreported")}` : "" : ` · ${route.reasoningEffort}`}`;
|
|
86
91
|
const collapsedContent = singleLineDesc ? _jsxs(_Fragment, { children: [_jsx("span", { className: "dsmm-role-sep", "aria-hidden": "true" }), _jsx("span", { className: "dsmm-role-summary", children: _jsx(TextShimmer, { active: isOngoing, children: singleLineDesc }) })] }) : undefined;
|
|
87
|
-
const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" :
|
|
92
|
+
const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" : state === "background" ? "idle" : state === "result" ? "done" : "ongoing";
|
|
88
93
|
return _jsxs("div", { className: "dsmm-role-tool", "data-dsmm-role-tool": props.toolName, "data-identity": actual === undefined ? "requested" : "actual", "data-state": state, "data-delivery": actual?.delivery, "data-phase": actual?.phase, "data-expanded": expanded ? "true" : "false", children: [_jsx(DisclosureRow, { title: title, titleClassName: "dsmm-role-title", rowClassName: "dsmm-role-heading", contentClassName: "dsmm-role-text", icon: _jsx(IconAgentPresetOutlineRegular, { size: 14, className: "dsmm-role-icon" }), collapsedContent: collapsedContent, keepContentWhenOpen: true, running: isOngoing, open: expanded, expandable: true, onToggle: toggle, expandOnRowClick: true, children: _jsxs("div", { className: "dsmm-role-body", children: [_jsxs("p", { className: "dsmm-role-identity", children: [showRequestedVsActual ? _jsxs(_Fragment, { children: [_jsxs("span", { className: "dsmm-role-dim", children: [t("requested"), ": "] }), _jsxs("span", { children: [requested.target === undefined ? t("unknown") : roleToolDisplay(requested.target), requested.level ? ` (${requested.level})` : ""] }), _jsx("span", { className: "dsmm-role-dim", children: " \u2192 " }), _jsxs("span", { className: "dsmm-role-dim", children: [t("actual"), ": "] }), _jsxs("span", { children: [roleToolDisplay(actual.role), " (", actual.level, ")"] })] }) : _jsxs("span", { children: [actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [t("requested"), ": "] }), actual !== undefined ? roleToolDisplay(actual.role) : requested.target === undefined ? t("unknownTarget") : roleToolDisplay(requested.target), (actual?.level ?? requested.level) !== undefined && ` · ${actual?.level ?? requested.level}`, props.phase !== "preparing" && actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [" \u00B7 ", t("actualUnknown")] })] }), initialRoute !== undefined && _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("initialRoute"), ": ", initialRoute.status === "known" ? routeLabel(initialRoute.route) : t("routeUnknown")] }), actualRoute !== undefined ? _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("actualRoute"), ": ", actualRoute.status === "known" ? routeLabel(actualRoute.route, true) : t("routeUnknown")] }) : props.phase !== "preparing" && _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("actualRoute"), ": ", t("routeUnknown")] })] }), _jsxs("p", { className: "dsmm-role-identity", "data-observation-status": observationStatus, children: [t("observation"), ": ", t({ unavailable: "observationUnavailable", connecting: "observationConnecting", live: "observationLive", stale: "observationStale" }[observationStatus]), observationIssue !== undefined && ` · ${observationIssue.kind}/${observationIssue.code}`] }), requested.description !== undefined && _jsx("p", { className: "dsmm-role-task", children: requested.description }), result?.error != null && _jsxs("div", { className: "dsmm-role-failure", children: [_jsx("p", { className: "dsmm-role-section-title", children: t("failure") }), code(JSON.stringify(result.error, null, 2))] }), _jsxs("details", { className: "dsmm-role-details", children: [_jsx("summary", { children: t("technicalDetails") }), _jsxs("div", { className: "dsmm-role-details-body", children: [_jsx("div", { className: "dsmm-role-details-header", children: _jsx(SegmentedControl, { id: controlId, value: viewMode, options: viewOptions, onChange: setViewMode, label: t("viewMode"), className: "dsmm-role-view-switch" }) }), _jsx("div", { id: `${controlId}-table-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-table`, hidden: viewMode !== "table", tabIndex: 0, children: viewMode === "table" && _jsxs("table", { className: "dsmm-role-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: t("property") }), _jsx("th", { scope: "col", children: t("value") })] }) }), _jsx("tbody", { children: tableRows.map(row => _jsxs("tr", { children: [_jsx("td", { className: "dsmm-role-prop-cell", children: row.property }), _jsx("td", { className: "dsmm-role-val-cell", children: row.isComplex ? _jsx("pre", { className: "dsmm-role-cell-code", children: JSON.stringify(row.value, null, 2) })
|
|
89
94
|
: typeof row.value === "string" ? _jsx("span", { className: "dsmm-role-cell-text", children: row.value })
|
|
90
|
-
: _jsx("span", { children: row.value === null ? "null" : row.value === undefined ? "undefined" : String(row.value) }) })] }, row.property)) })] }) }), _jsx("div", { id: `${controlId}-json-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-json`, hidden: viewMode !== "json", tabIndex: 0, children: viewMode === "json" && code(JSON.stringify(jsonData, null, 2)) })] })] })] }) }), _jsxs("div", { className: "dsmm-role-actions", children: [_jsx(StateDot, { state: stateDotState }), _jsx("p", { className: "dsmm-role-status", role: "status", children: t(state) }),
|
|
95
|
+
: _jsx("span", { children: row.value === null ? "null" : row.value === undefined ? "undefined" : String(row.value) }) })] }, row.property)) })] }) }), _jsx("div", { id: `${controlId}-json-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-json`, hidden: viewMode !== "json", tabIndex: 0, children: viewMode === "json" && code(JSON.stringify(jsonData, null, 2)) })] })] })] }) }), _jsxs("div", { className: "dsmm-role-actions", children: [_jsx(StateDot, { state: stateDotState }), _jsx("p", { className: "dsmm-role-status", role: "status", children: t(state) }), openChild !== undefined && _jsx(Button, { variant: "ghost", size: "sm", onClick: openChild, children: t("openConversation") })] })] });
|
|
91
96
|
}
|
|
92
97
|
/** Called once by the parent client apply(ctx), alongside the other slot registrations. */
|
|
93
98
|
export function registerRoleToolViews(ctx, observations) {
|
|
@@ -99,10 +104,10 @@ export function registerRoleToolViews(ctx, observations) {
|
|
|
99
104
|
document.head.append(style);
|
|
100
105
|
return () => style.remove();
|
|
101
106
|
}, "dsmm: role tool styles");
|
|
107
|
+
const inject = childConversationInjection(ctx, observations);
|
|
102
108
|
ctx.slots.inject("tool.call.toolview", () => {
|
|
103
|
-
const disposers = [...Object.keys(roleToolKeys), "dsmm_role", "dsmm_category"].map(key => ctx.slots.register({ name: "tool.call.toolview", key, locale: ROLE_TOOL_NS,
|
|
104
|
-
|
|
105
|
-
disposers.push(registerNativeToolViews(ctx, observations));
|
|
109
|
+
const disposers = [...Object.keys(roleToolKeys), "dsmm_role", "dsmm_category"].map(key => ctx.slots.register({ name: "tool.call.toolview", key, locale: ROLE_TOOL_NS, inject }, RoleToolView));
|
|
110
|
+
disposers.push(registerNativeToolViews(ctx, inject));
|
|
106
111
|
return () => { for (const dispose of disposers.reverse())
|
|
107
112
|
dispose(); };
|
|
108
113
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { SessionTarget } from "@deepseek-ai/dsh-api-session-controller/client";
|
|
3
|
+
import type { ToolCallViewProps } from "@deepseek-ai/dsh-client-ui-tool/client";
|
|
4
|
+
import type { HostObservable, InjectFace, PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
|
|
5
|
+
import type { SessionId } from "@deepseek-ai/dsh-session/types";
|
|
6
|
+
import type { SubagentCatalogEntry } from "@deepseek-ai/dsh-subagent/client";
|
|
7
|
+
import type { ROLE_TOOL_NS } from "./RoleToolView-locales.js";
|
|
8
|
+
import type { RoleCallObservationController, RoleCallObservationState } from "./role-call-observations.js";
|
|
9
|
+
type ChildAddress = Exclude<SessionTarget, SessionId>;
|
|
10
|
+
type WorkspaceNavigation = {
|
|
11
|
+
openSession(target: SessionTarget): void;
|
|
12
|
+
};
|
|
13
|
+
type CardInjection = {
|
|
14
|
+
hooks: {
|
|
15
|
+
roleCalls: HostObservable<RoleCallObservationState>;
|
|
16
|
+
childWorkspace: HostObservable<WorkspaceNavigation | undefined>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type ChildConversationCardProps = ToolCallViewProps & PropsLocale<typeof ROLE_TOOL_NS> & InjectFace<CardInjection>;
|
|
20
|
+
export declare function childConversationInjection(ctx: Context, observations: RoleCallObservationController): (sessionId: SessionId) => CardInjection;
|
|
21
|
+
export declare function useCardObservation({ useRoleCalls, sessionId, callId }: ChildConversationCardProps): import("../role-control-types.js").RoleCallObservation | undefined;
|
|
22
|
+
export declare function childConversationAction(workspace: WorkspaceNavigation | undefined, parentSessionId: SessionId, catalog: readonly SubagentCatalogEntry[] | undefined, receiptChildId: string | undefined, observedChildId: string | undefined, fallbackMode?: ChildAddress["mode"]): (() => void) | undefined;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=child-conversation.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function childConversationInjection(ctx, observations) {
|
|
2
|
+
let workspace;
|
|
3
|
+
const listeners = new Set();
|
|
4
|
+
const publish = (next) => {
|
|
5
|
+
workspace = next;
|
|
6
|
+
for (const listener of listeners)
|
|
7
|
+
listener();
|
|
8
|
+
};
|
|
9
|
+
const childWorkspace = {
|
|
10
|
+
getSnapshot: () => workspace,
|
|
11
|
+
subscribe(listener) { listeners.add(listener); return () => { listeners.delete(listener); }; },
|
|
12
|
+
};
|
|
13
|
+
void ctx.inject(["uiWorkspace"], scope => {
|
|
14
|
+
const navigation = scope.get("uiWorkspace");
|
|
15
|
+
scope.effect(() => {
|
|
16
|
+
publish(navigation);
|
|
17
|
+
return () => publish(undefined);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
return sessionId => ({ hooks: { roleCalls: observations.source(sessionId), childWorkspace } });
|
|
21
|
+
}
|
|
22
|
+
export function useCardObservation({ useRoleCalls, sessionId, callId }) {
|
|
23
|
+
return useRoleCalls(state => {
|
|
24
|
+
const call = state.calls.get(callId);
|
|
25
|
+
return call?.parentSessionId === sessionId && call?.callId === callId ? call : undefined;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function childConversationAction(workspace, parentSessionId, catalog, receiptChildId, observedChildId, fallbackMode) {
|
|
29
|
+
if (workspace === undefined || receiptChildId !== undefined && observedChildId !== undefined && receiptChildId !== observedChildId)
|
|
30
|
+
return undefined;
|
|
31
|
+
const childSessionId = receiptChildId ?? observedChildId;
|
|
32
|
+
if (childSessionId === undefined || childSessionId === parentSessionId)
|
|
33
|
+
return undefined;
|
|
34
|
+
const mode = catalog?.find(entry => entry.id === childSessionId)?.mode ?? fallbackMode;
|
|
35
|
+
if (mode === undefined || mode === "external")
|
|
36
|
+
return undefined;
|
|
37
|
+
return () => workspace.openSession({ parentSessionId, childSessionId: childSessionId, mode });
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=child-conversation.js.map
|
package/lib/client.js
CHANGED
|
@@ -9428,7 +9428,7 @@ var roleToolEn = {
|
|
|
9428
9428
|
output: "Complete result content",
|
|
9429
9429
|
failure: "Error details",
|
|
9430
9430
|
metadata: "Invocation metadata",
|
|
9431
|
-
|
|
9431
|
+
openConversation: "Open child conversation",
|
|
9432
9432
|
copy: "Copy",
|
|
9433
9433
|
copied: "Copied",
|
|
9434
9434
|
emptyArgs: "Arguments not available yet",
|
|
@@ -9480,7 +9480,7 @@ var roleToolZh = {
|
|
|
9480
9480
|
output: "完整结果内容",
|
|
9481
9481
|
failure: "错误详情",
|
|
9482
9482
|
metadata: "调用元数据",
|
|
9483
|
-
|
|
9483
|
+
openConversation: "打开子对话",
|
|
9484
9484
|
copy: "复制",
|
|
9485
9485
|
copied: "已复制",
|
|
9486
9486
|
emptyArgs: "参数尚不可用",
|
|
@@ -9507,8 +9507,8 @@ function nativeActivationIdentity(meta) {
|
|
|
9507
9507
|
if (meta === null || typeof meta !== "object" || Array.isArray(meta)) return void 0;
|
|
9508
9508
|
const value = meta;
|
|
9509
9509
|
if (value.kind !== "activation") return void 0;
|
|
9510
|
-
if (typeof value.name === "string" && value.name.trim() !== "") return { kind: "name", value: value.name };
|
|
9511
9510
|
if (typeof value.subagentId === "string" && value.subagentId.trim() !== "") return { kind: "id", value: value.subagentId };
|
|
9511
|
+
if (typeof value.name === "string" && value.name.trim() !== "") return { kind: "name", value: value.name };
|
|
9512
9512
|
return void 0;
|
|
9513
9513
|
}
|
|
9514
9514
|
function observedNativeTool(toolName, callId, identity2, observation) {
|
|
@@ -9517,22 +9517,74 @@ function observedNativeTool(toolName, callId, identity2, observation) {
|
|
|
9517
9517
|
return observedIdentity === identity2.value ? observation : void 0;
|
|
9518
9518
|
}
|
|
9519
9519
|
|
|
9520
|
+
// src/client/child-conversation.ts
|
|
9521
|
+
function childConversationInjection(ctx, observations) {
|
|
9522
|
+
let workspace;
|
|
9523
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
9524
|
+
const publish = (next) => {
|
|
9525
|
+
workspace = next;
|
|
9526
|
+
for (const listener of listeners) listener();
|
|
9527
|
+
};
|
|
9528
|
+
const childWorkspace = {
|
|
9529
|
+
getSnapshot: () => workspace,
|
|
9530
|
+
subscribe(listener) {
|
|
9531
|
+
listeners.add(listener);
|
|
9532
|
+
return () => {
|
|
9533
|
+
listeners.delete(listener);
|
|
9534
|
+
};
|
|
9535
|
+
}
|
|
9536
|
+
};
|
|
9537
|
+
void ctx.inject(["uiWorkspace"], (scope) => {
|
|
9538
|
+
const navigation = scope.get("uiWorkspace");
|
|
9539
|
+
scope.effect(() => {
|
|
9540
|
+
publish(navigation);
|
|
9541
|
+
return () => publish(void 0);
|
|
9542
|
+
});
|
|
9543
|
+
});
|
|
9544
|
+
return (sessionId2) => ({ hooks: { roleCalls: observations.source(sessionId2), childWorkspace } });
|
|
9545
|
+
}
|
|
9546
|
+
function useCardObservation({ useRoleCalls, sessionId: sessionId2, callId }) {
|
|
9547
|
+
return useRoleCalls((state) => {
|
|
9548
|
+
const call = state.calls.get(callId);
|
|
9549
|
+
return call?.parentSessionId === sessionId2 && call?.callId === callId ? call : void 0;
|
|
9550
|
+
});
|
|
9551
|
+
}
|
|
9552
|
+
function childConversationAction(workspace, parentSessionId, catalog, receiptChildId, observedChildId, fallbackMode) {
|
|
9553
|
+
if (workspace === void 0 || receiptChildId !== void 0 && observedChildId !== void 0 && receiptChildId !== observedChildId) return void 0;
|
|
9554
|
+
const childSessionId = receiptChildId ?? observedChildId;
|
|
9555
|
+
if (childSessionId === void 0 || childSessionId === parentSessionId) return void 0;
|
|
9556
|
+
const mode = catalog?.find((entry) => entry.id === childSessionId)?.mode ?? fallbackMode;
|
|
9557
|
+
if (mode === void 0 || mode === "external") return void 0;
|
|
9558
|
+
return () => workspace.openSession({ parentSessionId, childSessionId, mode });
|
|
9559
|
+
}
|
|
9560
|
+
|
|
9520
9561
|
// src/client/NativeToolView.tsx
|
|
9521
9562
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
9522
9563
|
function NativeToolView(props) {
|
|
9523
|
-
const { nativeView: NativeView, nativeT, t } = props;
|
|
9524
|
-
const observation =
|
|
9525
|
-
const status =
|
|
9564
|
+
const { nativeView: NativeView, nativeT, t, useRoleCalls, useChildWorkspace, ...nativeProps } = props;
|
|
9565
|
+
const observation = useCardObservation(props);
|
|
9566
|
+
const status = useRoleCalls((state2) => state2.status);
|
|
9526
9567
|
const { expanded, toggle } = props.useDisclosure();
|
|
9527
|
-
const result = props.phase === "result" ? props.block : void 0;
|
|
9528
|
-
const
|
|
9529
|
-
const
|
|
9568
|
+
const result = props.phase === "result" && !props.block.isError && props.block.error == null ? props.block : void 0;
|
|
9569
|
+
const receipt = result === void 0 ? void 0 : nativeActivationIdentity(result.meta);
|
|
9570
|
+
const nativeCall = result !== void 0 && observation?.kind === "native" && observation.toolName === props.toolName && observation.phase !== "reserved" ? observation : void 0;
|
|
9571
|
+
const actual = receipt === void 0 ? nativeCall : observedNativeTool(props.toolName, props.callId, receipt, nativeCall);
|
|
9572
|
+
const identity2 = receipt ?? (actual === void 0 ? void 0 : { kind: "id", value: actual.childId });
|
|
9530
9573
|
const settled = actual?.phase === "settled";
|
|
9531
9574
|
const live = status === "live";
|
|
9532
9575
|
const state = settled ? actual.stopReason === void 0 ? "accepted" : actual.stopReason === "aborted" ? "stopped" : actual.stopReason === "completed" ? "completed" : "error" : actual !== void 0 && live ? "running" : "accepted";
|
|
9533
9576
|
const route3 = settled || live ? actual?.actualRoute : void 0;
|
|
9577
|
+
const receiptChildId = receipt?.kind === "id" ? receipt.value : void 0;
|
|
9578
|
+
const observedChildId = (receiptChildId === void 0 ? actual : nativeCall)?.childId;
|
|
9579
|
+
const openChild = childConversationAction(
|
|
9580
|
+
useChildWorkspace((workspace) => workspace),
|
|
9581
|
+
props.sessionId,
|
|
9582
|
+
props.useProjection("subagentCatalog"),
|
|
9583
|
+
receiptChildId,
|
|
9584
|
+
observedChildId
|
|
9585
|
+
);
|
|
9534
9586
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
9535
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NativeView, { ...
|
|
9587
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NativeView, { ...nativeProps, t: nativeT }),
|
|
9536
9588
|
identity2 !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "dsmm-role-tool", "data-dsmm-native-tool": props.toolName, "data-state": state, "data-identity": "native", children: [
|
|
9537
9589
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
9538
9590
|
import_dsh_client_ui_primitives11.DisclosureRow,
|
|
@@ -9569,18 +9621,19 @@ function NativeToolView(props) {
|
|
|
9569
9621
|
),
|
|
9570
9622
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "dsmm-role-actions", children: [
|
|
9571
9623
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.StateDot, { state: state === "error" ? "error" : state === "stopped" ? "warning" : state === "completed" ? "done" : state === "running" ? "ongoing" : "idle" }),
|
|
9572
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "dsmm-role-status", role: "status", children: t(state) })
|
|
9624
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "dsmm-role-status", role: "status", children: t(state) }),
|
|
9625
|
+
openChild !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.Button, { variant: "ghost", size: "sm", onClick: openChild, children: t("openConversation") })
|
|
9573
9626
|
] })
|
|
9574
9627
|
] })
|
|
9575
9628
|
] });
|
|
9576
9629
|
}
|
|
9577
|
-
function registerNativeToolViews(ctx,
|
|
9630
|
+
function registerNativeToolViews(ctx, inject2) {
|
|
9578
9631
|
const mounted = /* @__PURE__ */ new Map();
|
|
9579
9632
|
const reconcile = () => {
|
|
9580
9633
|
const entries = ctx.slots.entries("tool.call.toolview");
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9634
|
+
const nativeEntry = (key) => entries.filter((entry) => entry.component !== NativeToolView && entry.options.key === key).sort((a, b) => (a.options.priority ?? 0) - (b.options.priority ?? 0))[0];
|
|
9635
|
+
const subagent = nativeEntry("subagent");
|
|
9636
|
+
for (const [key, source] of [["subagent", subagent], ["subagent_fork", nativeEntry("subagent_fork") ?? subagent]]) {
|
|
9584
9637
|
const previous = mounted.get(key);
|
|
9585
9638
|
if (previous?.source === source) continue;
|
|
9586
9639
|
previous?.dispose();
|
|
@@ -9592,7 +9645,7 @@ function registerNativeToolViews(ctx, observations) {
|
|
|
9592
9645
|
key,
|
|
9593
9646
|
priority: (source.options.priority ?? 0) - 1,
|
|
9594
9647
|
locale: ROLE_TOOL_NS,
|
|
9595
|
-
inject: (sessionId2) => ({
|
|
9648
|
+
inject: (sessionId2) => ({ ...inject2(sessionId2), nativeView, nativeT: ctx.locale.bind("conversation") })
|
|
9596
9649
|
}, NativeToolView);
|
|
9597
9650
|
mounted.set(key, { source, dispose });
|
|
9598
9651
|
}
|
|
@@ -9644,7 +9697,7 @@ function RoleToolView(props) {
|
|
|
9644
9697
|
const { t } = props;
|
|
9645
9698
|
const raw = props.phase === "preparing" ? partial.preview : props.phase === "start" ? props.block.argsRaw : props.block.call?.argsRaw ?? "";
|
|
9646
9699
|
const requested = partial?.requested ?? requestedRoleTool(props.toolName, raw);
|
|
9647
|
-
const observation =
|
|
9700
|
+
const observation = useCardObservation(props);
|
|
9648
9701
|
const observationStatus = props.useRoleCalls((state2) => state2.status);
|
|
9649
9702
|
const observationIssue2 = props.useRoleCalls((state2) => state2.issue);
|
|
9650
9703
|
const result = props.phase === "result" ? props.block : void 0;
|
|
@@ -9659,14 +9712,24 @@ function RoleToolView(props) {
|
|
|
9659
9712
|
const actual = persisted?.phase === "settled" ? persisted : observed ?? inactivePersisted;
|
|
9660
9713
|
const comparison = actual?.routeComparison;
|
|
9661
9714
|
const target = actual?.role ?? requested.target;
|
|
9662
|
-
const
|
|
9715
|
+
const receipt = persisted?.phase === "reserved" ? void 0 : persisted;
|
|
9716
|
+
const observedChildId = observed?.phase === "reserved" ? void 0 : observed?.childId;
|
|
9717
|
+
const openChild = childConversationAction(
|
|
9718
|
+
props.useChildWorkspace((workspace) => workspace),
|
|
9719
|
+
props.sessionId,
|
|
9720
|
+
props.useProjection("subagentCatalog"),
|
|
9721
|
+
receipt?.childId,
|
|
9722
|
+
observedChildId,
|
|
9723
|
+
receipt?.childId === void 0 ? "unknown" : receipt.mode
|
|
9724
|
+
);
|
|
9725
|
+
const observedStop = actual?.phase === "settled" ? actual.stopReason : void 0;
|
|
9726
|
+
const state = result?.error?.code === "interrupted" || observedStop === "aborted" ? "stopped" : failed || observedStop !== void 0 && observedStop !== "completed" ? "error" : result !== void 0 && actual?.delivery === "parent" && actual.phase !== "settled" ? "background" : actual?.phase === "settled" || result !== void 0 ? "result" : props.phase === "preparing" ? "preparing" : "running";
|
|
9727
|
+
const isOngoing = state === "running" || state === "preparing";
|
|
9728
|
+
const action2 = state === "preparing" ? t("calling") : t("call");
|
|
9663
9729
|
const targetLabel = target === void 0 ? t("unknownTarget") : roleToolDisplay(target);
|
|
9664
9730
|
const rawDesc = requested.description?.trim();
|
|
9665
9731
|
const singleLineDesc = rawDesc ? rawDesc.replace(/\s+/gu, " ") : void 0;
|
|
9666
9732
|
const title = `${action2} ${targetLabel}`;
|
|
9667
|
-
const observedStop = actual?.phase === "settled" ? actual.stopReason : void 0;
|
|
9668
|
-
const state = result?.error?.code === "interrupted" || observedStop === "aborted" ? "stopped" : failed || observedStop !== void 0 && observedStop !== "completed" ? "error" : result === void 0 ? props.phase === "preparing" ? "preparing" : "running" : actual?.delivery === "parent" && actual.phase !== "settled" ? "background" : "result";
|
|
9669
|
-
const isOngoing = state === "running" || props.phase === "preparing";
|
|
9670
9733
|
const code = (value) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_dsh_client_ui_primitives12.CodeBlock, { code: value, copyLabel: t("copy"), copiedLabel: t("copied") });
|
|
9671
9734
|
const [viewMode, setViewMode] = (0, import_react11.useState)("table");
|
|
9672
9735
|
const controlId = `dsmm-tech-${props.callId || "call"}`;
|
|
@@ -9686,7 +9749,7 @@ function RoleToolView(props) {
|
|
|
9686
9749
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "dsmm-role-sep", "aria-hidden": "true" }),
|
|
9687
9750
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "dsmm-role-summary", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_dsh_client_ui_primitives12.TextShimmer, { active: isOngoing, children: singleLineDesc }) })
|
|
9688
9751
|
] }) : void 0;
|
|
9689
|
-
const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" :
|
|
9752
|
+
const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" : state === "background" ? "idle" : state === "result" ? "done" : "ongoing";
|
|
9690
9753
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
9691
9754
|
"div",
|
|
9692
9755
|
{
|
|
@@ -9799,7 +9862,7 @@ function RoleToolView(props) {
|
|
|
9799
9862
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "dsmm-role-actions", children: [
|
|
9800
9863
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_dsh_client_ui_primitives12.StateDot, { state: stateDotState }),
|
|
9801
9864
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "dsmm-role-status", role: "status", children: t(state) }),
|
|
9802
|
-
|
|
9865
|
+
openChild !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_dsh_client_ui_primitives12.Button, { variant: "ghost", size: "sm", onClick: openChild, children: t("openConversation") })
|
|
9803
9866
|
] })
|
|
9804
9867
|
]
|
|
9805
9868
|
}
|
|
@@ -9814,14 +9877,10 @@ function registerRoleToolViews(ctx, observations) {
|
|
|
9814
9877
|
document.head.append(style);
|
|
9815
9878
|
return () => style.remove();
|
|
9816
9879
|
}, "dsmm: role tool styles");
|
|
9880
|
+
const inject2 = childConversationInjection(ctx, observations);
|
|
9817
9881
|
ctx.slots.inject("tool.call.toolview", () => {
|
|
9818
|
-
const disposers = [...Object.keys(roleToolKeys), "dsmm_role", "dsmm_category"].map((key) => ctx.slots.register({
|
|
9819
|
-
|
|
9820
|
-
key,
|
|
9821
|
-
locale: ROLE_TOOL_NS,
|
|
9822
|
-
inject: (sessionId2) => ({ hooks: { roleCalls: observations.source(sessionId2) } })
|
|
9823
|
-
}, RoleToolView));
|
|
9824
|
-
disposers.push(registerNativeToolViews(ctx, observations));
|
|
9882
|
+
const disposers = [...Object.keys(roleToolKeys), "dsmm_role", "dsmm_category"].map((key) => ctx.slots.register({ name: "tool.call.toolview", key, locale: ROLE_TOOL_NS, inject: inject2 }, RoleToolView));
|
|
9883
|
+
disposers.push(registerNativeToolViews(ctx, inject2));
|
|
9825
9884
|
return () => {
|
|
9826
9885
|
for (const dispose of disposers.reverse()) dispose();
|
|
9827
9886
|
};
|
package/lib/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import { CommandApprovals } from "./command-approval.js";
|
|
|
23
23
|
import { registerRoleControlRpc } from "./role-control-rpc.js";
|
|
24
24
|
import { nativeStandingFullAccess } from "./permission-native-access.js";
|
|
25
25
|
import { DsmmProfileError } from "./profiles.js";
|
|
26
|
-
import {
|
|
26
|
+
import { configureLspLifecycle } from "./lsp.js";
|
|
27
27
|
import { registerAgentPromptScope } from "./agent-prompt-scope.js";
|
|
28
28
|
export const name = "dsmm";
|
|
29
29
|
export const inject = ["profileContext", "agents"];
|
|
@@ -134,8 +134,7 @@ export async function apply(input, config = {}, startupOptions = {}) {
|
|
|
134
134
|
if (ctx.get("agentPresets") !== undefined)
|
|
135
135
|
await presets.await();
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
await registerLspRuntime(ctx, startup.settings.lsp, getSettings);
|
|
137
|
+
await configureLspLifecycle(ctx, getSettings);
|
|
139
138
|
lifetime.signal.throwIfAborted();
|
|
140
139
|
const installed = new WeakSet();
|
|
141
140
|
admission.activate(async (agent, candidate, scope) => {
|
package/lib/lsp-entry.js
ADDED
package/lib/lsp.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { ToolDefinition } from "@deepseek-ai/dsh-tools";
|
|
3
|
+
import type { DsmmSettingsGetter } from "./settings.js";
|
|
1
4
|
export declare const DSMM_LSP_SERVER_NAME = "dsmm_lsp";
|
|
2
5
|
export declare const DSMM_LSP_TOOL_NAMES: readonly ["status", "diagnostics", "goto_definition", "find_references", "find_symbol_related", "symbols", "prepare_rename", "rename", "format"];
|
|
3
6
|
export type DsmmLspToolName = (typeof DSMM_LSP_TOOL_NAMES)[number];
|
|
@@ -9,10 +12,11 @@ export interface DsmmLspRuntimeState {
|
|
|
9
12
|
declare module "@deepseek-ai/cordis" {
|
|
10
13
|
interface Context {
|
|
11
14
|
dsmmLspState: () => DsmmLspRuntimeState;
|
|
15
|
+
dsmmLspEntry: (scope: Context) => Promise<void>;
|
|
16
|
+
dsmmProjectLsp: (install: (definition: ToolDefinition) => (() => void) | undefined) => () => void;
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
|
-
|
|
15
|
-
export declare function registerLspRuntime(ctx: Context, settings: DsmmLspSettings, getSettings?: import("./settings.js").DsmmSettingsGetter): Promise<void>;
|
|
19
|
+
export declare function configureLspLifecycle(core: Context, getSettings: DsmmSettingsGetter): Promise<void>;
|
|
16
20
|
export interface DsmmLspSettings {
|
|
17
21
|
enabled: boolean;
|
|
18
22
|
serverName: string;
|
|
@@ -39,5 +43,4 @@ export declare function toDshMcpClientConfig(input?: Partial<DsmmLspSettings>):
|
|
|
39
43
|
export declare function publicLspToolName(rawName: DsmmLspToolName, serverName?: string): string;
|
|
40
44
|
export declare function renderLspMcpPatch(input?: Partial<DsmmLspSettings>): string;
|
|
41
45
|
export declare function parseLspSmokeCommand(raw: string | undefined, fallback: readonly string[]): string[];
|
|
42
|
-
import type { Context } from "@deepseek-ai/cordis";
|
|
43
46
|
//# sourceMappingURL=lsp.d.ts.map
|
package/lib/lsp.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
1
3
|
export const DSMM_LSP_SERVER_NAME = "dsmm_lsp";
|
|
2
4
|
export const DSMM_LSP_TOOL_NAMES = [
|
|
3
5
|
"status",
|
|
@@ -10,63 +12,131 @@ export const DSMM_LSP_TOOL_NAMES = [
|
|
|
10
12
|
"rename",
|
|
11
13
|
"format"
|
|
12
14
|
];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const unavailable = (diagnostic) => {
|
|
21
|
-
state = { state: "unavailable", tools: [], diagnostic };
|
|
22
|
-
if (settings.failOnStartupError)
|
|
23
|
-
throw new Error(`DSMM LSP startup unavailable: ${diagnostic}`);
|
|
24
|
-
};
|
|
25
|
-
if (anchor === undefined) {
|
|
26
|
-
unavailable("host-anchor-unavailable");
|
|
15
|
+
export async function configureLspLifecycle(core, getSettings) {
|
|
16
|
+
const startup = getSettings();
|
|
17
|
+
const group = core.fiber.entry?.parent;
|
|
18
|
+
// Loader publishes the whole group's configuration before starting any child,
|
|
19
|
+
// including disabled entries that never acquire a fiber.
|
|
20
|
+
const row = group?.data.find(entry => entry.name === "@dsmm/dsmm/lsp");
|
|
21
|
+
if (!row && !startup.modules.deepwork.enabled)
|
|
27
22
|
return;
|
|
28
|
-
|
|
29
|
-
let
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const dispose = tools.guard((execution) => execution.agent !== undefined
|
|
59
|
-
&& owned.has(execution.name) && owned.get(execution.name) === tools.get(execution.name, execution.agent)
|
|
60
|
-
&& !getSettings(execution.agent).modules.deepwork.enabled
|
|
61
|
-
? "Deepwork LSP is not admitted in this Agent" : undefined);
|
|
62
|
-
ctx.effect(() => dispose);
|
|
63
|
-
}
|
|
64
|
-
state = { state: "ready", tools: names };
|
|
65
|
-
ctx.on("tools/change", () => {
|
|
66
|
-
const names = tools.schemas().map((tool) => tool.name).filter((name) => name.startsWith(`mcp__${settings.serverName}__`));
|
|
67
|
-
state = names.length === 0 ? { state: "unavailable", diagnostic: "native-tools-unavailable", tools: [] } : { state: "ready", tools: names };
|
|
23
|
+
let current;
|
|
24
|
+
let diagnostic = "native-tools-unavailable";
|
|
25
|
+
core.provide("dsmmLspState", () => current?.() ?? (startup.modules.deepwork.enabled && row && group?.tree.store[row.id]?.disabled === false
|
|
26
|
+
? { state: "unavailable", diagnostic, tools: [] } : { state: "disabled", tools: [] }));
|
|
27
|
+
const owned = new Map();
|
|
28
|
+
const observers = new Set();
|
|
29
|
+
core.provide("dsmmProjectLsp", install => {
|
|
30
|
+
const copies = new Map();
|
|
31
|
+
const update = (definition, added) => {
|
|
32
|
+
if (!added) {
|
|
33
|
+
copies.get(definition)?.();
|
|
34
|
+
copies.delete(definition);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const dispose = install(definition);
|
|
38
|
+
if (dispose)
|
|
39
|
+
copies.set(definition, dispose);
|
|
40
|
+
};
|
|
41
|
+
const stop = () => { observers.delete(update); for (const dispose of copies.values())
|
|
42
|
+
dispose(); copies.clear(); };
|
|
43
|
+
try {
|
|
44
|
+
for (const definition of owned.values())
|
|
45
|
+
update(definition, true);
|
|
46
|
+
observers.add(update);
|
|
47
|
+
return stop;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
stop();
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
68
53
|
});
|
|
69
|
-
|
|
54
|
+
const withdraw = (definition) => {
|
|
55
|
+
if (owned.get(definition.name) !== definition)
|
|
56
|
+
return;
|
|
57
|
+
owned.delete(definition.name);
|
|
58
|
+
for (const update of observers)
|
|
59
|
+
update(definition, false);
|
|
60
|
+
};
|
|
61
|
+
const mount = async (ctx) => {
|
|
62
|
+
if (!startup.modules.deepwork.enabled)
|
|
63
|
+
return;
|
|
64
|
+
if (current)
|
|
65
|
+
throw new Error("DSMM LSP already has an active entry");
|
|
66
|
+
const settings = startup.lsp;
|
|
67
|
+
const tools = ctx.get("tools");
|
|
68
|
+
diagnostic = "native-tools-unavailable";
|
|
69
|
+
const status = () => {
|
|
70
|
+
const names = [...owned].filter(([name, definition]) => tools?.get(name) === definition).map(([name]) => name);
|
|
71
|
+
return names.length ? { state: "ready", tools: names } : { state: "unavailable", diagnostic, tools: [] };
|
|
72
|
+
};
|
|
73
|
+
ctx.effect(() => {
|
|
74
|
+
current = status;
|
|
75
|
+
return () => {
|
|
76
|
+
if (current !== status)
|
|
77
|
+
return;
|
|
78
|
+
current = undefined;
|
|
79
|
+
for (const definition of owned.values())
|
|
80
|
+
withdraw(definition);
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
const unavailable = (reason) => {
|
|
84
|
+
diagnostic = reason;
|
|
85
|
+
if (settings.failOnStartupError)
|
|
86
|
+
throw new Error(`DSMM LSP startup unavailable: ${reason}`);
|
|
87
|
+
};
|
|
88
|
+
const anchor = ctx.get("profileContext")?.installAnchor;
|
|
89
|
+
if (anchor === undefined)
|
|
90
|
+
return unavailable("host-anchor-unavailable");
|
|
91
|
+
let plugin;
|
|
92
|
+
try {
|
|
93
|
+
const modulePath = createRequire(anchor).resolve("@deepseek-ai/dsh-mcp-client");
|
|
94
|
+
plugin = await import(pathToFileURL(modulePath).href);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return unavailable("native-package-unavailable");
|
|
98
|
+
}
|
|
99
|
+
if (typeof plugin.apply !== "function")
|
|
100
|
+
return unavailable("native-package-unavailable");
|
|
101
|
+
if (!tools)
|
|
102
|
+
return unavailable("native-tools-unavailable");
|
|
103
|
+
tools.guard(exec => exec.agent !== undefined && owned.has(exec.name) && owned.get(exec.name) === tools.get(exec.name, exec.agent)
|
|
104
|
+
&& !getSettings(exec.agent).modules.deepwork.enabled ? "Deepwork LSP is not admitted in this Agent" : undefined);
|
|
105
|
+
// Observe only this client's registrations, including reconnects. The Host
|
|
106
|
+
// registry still performs registration and its disposer owns withdrawal.
|
|
107
|
+
const client = { ...plugin, async apply(scope, config) {
|
|
108
|
+
const registry = scope.tools;
|
|
109
|
+
const register = (definition) => {
|
|
110
|
+
const dispose = registry.register(definition);
|
|
111
|
+
owned.set(definition.name, definition);
|
|
112
|
+
const release = () => { withdraw(definition); dispose(); };
|
|
113
|
+
try {
|
|
114
|
+
for (const update of observers)
|
|
115
|
+
update(definition, true);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
release();
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
return release;
|
|
122
|
+
};
|
|
123
|
+
await plugin.apply(scope.extend({ tools: new Proxy(registry, {
|
|
124
|
+
get: (target, key) => key === "register" ? register : Reflect.get(target, key),
|
|
125
|
+
}) }), config);
|
|
126
|
+
} };
|
|
127
|
+
try {
|
|
128
|
+
await ctx.plugin(client, toDshMcpClientConfig(settings)).await();
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return unavailable("native-tools-unavailable");
|
|
132
|
+
}
|
|
133
|
+
if (status().state !== "ready")
|
|
134
|
+
unavailable("native-tools-unavailable");
|
|
135
|
+
};
|
|
136
|
+
if (row)
|
|
137
|
+
core.provide("dsmmLspEntry", mount);
|
|
138
|
+
else if (startup.lsp.enabled)
|
|
139
|
+
await mount(core);
|
|
70
140
|
}
|
|
71
141
|
export const DEFAULT_DSMM_LSP_SETTINGS = {
|
|
72
142
|
enabled: false,
|
|
@@ -209,6 +279,4 @@ function isPlainYamlScalar(value) {
|
|
|
209
279
|
return false;
|
|
210
280
|
return !value.startsWith("---") && !value.startsWith("...");
|
|
211
281
|
}
|
|
212
|
-
import { createRequire } from "node:module";
|
|
213
|
-
import { pathToFileURL } from "node:url";
|
|
214
282
|
//# sourceMappingURL=lsp.js.map
|