@dsmm/dsmm 0.3.33 → 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 +9 -5
- package/lib/client/child-conversation.d.ts +24 -0
- package/lib/client/child-conversation.js +39 -0
- package/lib/client.js +84 -25
- 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/prompts.js +1 -1
- 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
|
@@ -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,6 +9712,16 @@ 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;
|
|
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
|
+
);
|
|
9662
9725
|
const observedStop = actual?.phase === "settled" ? actual.stopReason : void 0;
|
|
9663
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";
|
|
9664
9727
|
const isOngoing = state === "running" || state === "preparing";
|
|
@@ -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
|
package/lib/prompts.js
CHANGED
|
@@ -19,7 +19,7 @@ function generalModelCalibration(model) {
|
|
|
19
19
|
switch (recognized?.identifier) {
|
|
20
20
|
case "gpt":
|
|
21
21
|
case "codex":
|
|
22
|
-
return "Lead with the result and its supporting evidence. Reuse checks that still cover the claim; qualify only what remains uncertain.";
|
|
22
|
+
return "Lead with the result and its supporting evidence. Reuse checks that still cover the claim; qualify only what remains uncertain. Do not write defensive code or design for imaginary failures. Never penalize the 90% normal path for a case the contract makes impossible. Trust internal guarantees; enforce required checks at real boundaries.";
|
|
23
23
|
case "gemini":
|
|
24
24
|
return recognized.gemini4OrLater
|
|
25
25
|
? "Ground claims about files and runtime behavior in what you observed. Distinguish a proposed change from an applied one, and a successful build from evidence that the requested behavior works."
|
package/lib/role-subagents.js
CHANGED
|
@@ -300,8 +300,7 @@ export function registerHeadlessRoleTools(ctx, controller, getSettings, policy,
|
|
|
300
300
|
}
|
|
301
301
|
const subagents = ctx.get("subagents");
|
|
302
302
|
const host = ctx.get("tools");
|
|
303
|
-
const
|
|
304
|
-
const definitions = names.map((name) => host?.get(name));
|
|
303
|
+
const definitions = hostControls.map(name => host?.get(name));
|
|
305
304
|
const providers = targets.map(role => {
|
|
306
305
|
const provider = subagents?.getProvider(roleProviderName(role));
|
|
307
306
|
return provider === undefined ? undefined : Reflect.get(provider, symbols.original) ?? provider;
|
|
@@ -314,6 +313,7 @@ export function registerHeadlessRoleTools(ctx, controller, getSettings, policy,
|
|
|
314
313
|
if (sameRealm && sameParent && sameProviders && signature === state.signature && definitions.length === state.hostDefinitions.length && definitions.every((definition, i) => definition === state.hostDefinitions[i]))
|
|
315
314
|
return;
|
|
316
315
|
state.signature = undefined;
|
|
316
|
+
state.stopLsp?.();
|
|
317
317
|
for (const dispose of state.owned.splice(0))
|
|
318
318
|
dispose();
|
|
319
319
|
state.restriction?.();
|
|
@@ -335,7 +335,25 @@ export function registerHeadlessRoleTools(ctx, controller, getSettings, policy,
|
|
|
335
335
|
const inventory = callableRoleInventory(settings, targets.filter(role => subagents?.getProvider(roleProviderName(role))?.capabilities.depthLimit === true));
|
|
336
336
|
for (const entry of inventory)
|
|
337
337
|
state.owned.push(registerRoleTool(agent, ctx, tools, entry, getSettings, policy, admission));
|
|
338
|
-
policy.captureTools(agent, tools, [...inventory.map(entry => entry.name), ...
|
|
338
|
+
policy.captureTools(agent, tools, [...inventory.map(entry => entry.name), ...hostControls], !sameRealm || !sameParent);
|
|
339
|
+
const hostRealm = host && (Reflect.get(host, symbols.original) ?? host) === (Reflect.get(tools, symbols.original) ?? tools);
|
|
340
|
+
state.stopLsp = ctx.get("dsmmProjectLsp")?.(definition => {
|
|
341
|
+
if (!getSettings(agent).modules.deepwork.enabled)
|
|
342
|
+
return;
|
|
343
|
+
const { name } = definition, visible = tools.get(name, agent);
|
|
344
|
+
if (visible && visible !== definition)
|
|
345
|
+
return;
|
|
346
|
+
if (policy.toolDenial(agent, name) !== undefined) {
|
|
347
|
+
return visible && tools.get(name, parentScope) === visible ? tools.restrict({ deny: [name] }) : undefined;
|
|
348
|
+
}
|
|
349
|
+
// A masked inherited registration stays masked. Only a missing tool in an
|
|
350
|
+
// independent registry needs an Agent-layer copy.
|
|
351
|
+
if (!visible && (hostRealm || tools.get(name, parentScope)))
|
|
352
|
+
return;
|
|
353
|
+
const dispose = visible ? undefined : tools.register(definition);
|
|
354
|
+
policy.captureTools(agent, tools, [name]);
|
|
355
|
+
return dispose;
|
|
356
|
+
});
|
|
339
357
|
state.signature = signature;
|
|
340
358
|
state.providers = providers;
|
|
341
359
|
state.hostDefinitions = definitions;
|
|
@@ -346,6 +364,7 @@ export function registerHeadlessRoleTools(ctx, controller, getSettings, policy,
|
|
|
346
364
|
reconcile(); });
|
|
347
365
|
const retire = ctx.effect(() => () => {
|
|
348
366
|
stopIdentity();
|
|
367
|
+
state.stopLsp?.();
|
|
349
368
|
state.restriction?.();
|
|
350
369
|
state.guard?.();
|
|
351
370
|
state.guidance?.();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsmm/dsmm",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.34",
|
|
4
4
|
"description": "Native Deepwork roles, routing, profiles, and permission controls for DeepSeek Harness.",
|
|
5
5
|
"author": "Hugefiver",
|
|
6
6
|
"license": "LicenseRef-AAAPL",
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
"main": "./lib/index.js",
|
|
27
27
|
"types": "./lib/index.d.ts",
|
|
28
28
|
"exports": {
|
|
29
|
+
"./lsp": {
|
|
30
|
+
"types": "./lib/lsp-entry.d.ts",
|
|
31
|
+
"default": "./lib/lsp-entry.js"
|
|
32
|
+
},
|
|
29
33
|
"./managed-settings": {
|
|
30
34
|
"types": "./lib/managed-settings.d.ts",
|
|
31
35
|
"default": "./lib/managed-settings.js"
|
|
@@ -22,6 +22,8 @@ Treat as blockers only issues that contradict an explicit requirement or constra
|
|
|
22
22
|
|
|
23
23
|
For a missing required safeguard, cite the governing requirement and the gap. For an additional safeguard, treat its absence as a blocker only when a concrete failure path escapes existing controls. If the plan makes valid work wait for redundant validation or approval, recommend removing that gate while retaining the actual boundary check. Hypothetical future uses and optional hardening do not hold up implementation.
|
|
24
24
|
|
|
25
|
+
Do not invent changes to internal, external, or database state. Before demanding a concurrency safeguard, identify the writer, the interval in which it can act, and the requirement it would break. Reject plans that hold database, table, or row locks through long-running application work. Keep transactions short; do not demand a pre-write reread of confirmed state or a costly database integrity scan to cover an imagined change.
|
|
26
|
+
|
|
25
27
|
Everything else is a non-blocking note and does not delay implementation. Give current findings and supporting evidence as clear prose rather than protocol fields or approval tokens. Every substantive blocker must be corrected, rebutted with concrete evidence, or escalated for clarification; it cannot be relabeled advisory and ignored. Critique informs judgment and does not authorize implementation or delivery.
|
|
26
28
|
|
|
27
29
|
Do not require another review merely because the plan changed. Revisit only affected claims and dependent risks when a blocker is newly identified or resolved, or relevant new evidence or another substantive input could change the prior conclusion. Wording changes, repeated concerns, and unchanged uncertainty are not progress; stop and return an unresolved blocker rather than continuing a no-progress loop. Do not require hashes, a fixed receipt or verdict format, a fixed iteration count, or an open-ended loop. Do not object to preference, optional polish, or a merely better approach.
|
|
@@ -10,6 +10,7 @@ You are the plan-only agent. From the agreed goal and direct evidence, produce a
|
|
|
10
10
|
- Reserve `docs/superpowers/specs/` and `docs/superpowers/plans/` for final product requirements to be delivered. Each artifact describes one final deliverable, not development decisions, rejected alternatives, assumption rationale/cost, or change history. Changed requirements use separate plans. Non-product tasks, regardless of complexity, use conversation coordination or a task-owned temporary plan outside those directories.
|
|
11
11
|
- Plan around the ideal end state, dependencies, interfaces, material risks, wave goals, and useful outcome evidence. Record decisions an implementer cannot safely infer: necessary paths and names, interface signatures and types, requirement-fixed values, and decisive test assertions or observable results. Do not transcribe implementation bodies already determined by those decisions. Treat steps and ordering as informed guidance that execution may adjust as evidence changes, not as a hard script.
|
|
12
12
|
- Choose the simplest design that delivers the approved behavior and preserves contracts outside the authorized change. Validate at trust boundaries and reuse an established guarantee for as long as it holds. Add an abstraction, retry, fallback, lock, or approval step only when a current requirement or concrete failure path needs it; keep independent work moving.
|
|
13
|
+
- Do not assume internal, external, or database state changed without evidence. Once the workflow confirms a state, use it for the write; do not plan another read or a database integrity scan just in case. Keep transactions short: never hold database, table, or row locks across long-running application work or external waits. If a known concurrent writer can invalidate a required invariant, protect that write with the narrowest atomic condition.
|
|
13
14
|
- Plan verification around valid requirements, functionality, and external interfaces, including material input classes and failure conditions implied by the approved behavior and local contracts. Attach plausible regression coverage to the owning task; when an important behavior remains unjudged, state why and what evidence is missing without imposing a fixed review-focus heading, list, or quota. Do not expand scope from speculation or add descriptive-text locks. Requirement changes update tests; removed components lose their dedicated tests rather than gaining absence tests. Git commits bound compatibility: interim uncommitted behavior need not be preserved, but existing committed contracts and API/security/data/permission/irreversible-action authorization remain binding.
|
|
14
15
|
- Return unresolved software design choices that affect implementation to the orchestrator for `brainstorming`; use `writing-plans` techniques proportionally rather than imposing ceremony.
|
|
15
16
|
- Use direct tools first. A leaf read-only `code-search`, `doc-search`, or equivalent lookup is allowed only to resolve a named fact. If evidence leaves a genuinely difficult decision, report the blocker to the orchestrator for optional `hard-reasoning`; strict or high-risk conditions alone do not qualify.
|