@dsmm/dsmm 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/agent-presets/dsmm-builder/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-code-search/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-coding/agent.cordis.yml +3 -2
- package/agent-presets/dsmm-complex/agent.cordis.yml +2 -1
- package/agent-presets/dsmm-creative/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-deep/agent.cordis.yml +2 -1
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-documenting/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-frontend/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +3 -2
- package/agent-presets/dsmm-oracle/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +11 -1
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-planner/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-quick/agent.cordis.yml +2 -1
- package/agent-presets/dsmm-research/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +1 -1
- package/cordis.patch.yml +0 -9
- package/docs/agent-presets.md +5 -5
- package/docs/compatibility.md +2 -6
- package/docs/migration-from-ocmm.md +1 -1
- package/docs/native-permissions.md +11 -3
- package/docs/roadmap.md +31 -11
- package/docs/runtime-recovery.md +30 -2
- package/docs/settings-status.md +7 -5
- package/docs/skill-sync.md +13 -14
- package/lib/client/ChildrenPanel.d.ts +1 -4
- package/lib/client/ChildrenPanel.js +3 -3
- package/lib/client/DeploymentFields.js +12 -1
- package/lib/client/DeploymentPage.d.ts +1 -3
- package/lib/client/DeploymentPage.js +30 -18
- package/lib/client/NativeCommandEntries.js +47 -37
- package/lib/client/PermissionRuleEntries.d.ts +17 -0
- package/lib/client/PermissionRuleEntries.js +70 -0
- package/lib/client/PermissionsPanel.d.ts +1 -3
- package/lib/client/PermissionsPanel.js +5 -4
- package/lib/client/children-locales.d.ts +4 -4
- package/lib/client/controller.js +4 -1
- package/lib/client/deployment-locales.d.ts +2 -2
- package/lib/client/deployment-locales.js +8 -9
- package/lib/client/deployment-modules.d.ts +5 -3
- package/lib/client/deployment-modules.js +4 -4
- package/lib/client/deployment-workspace.d.ts +4 -0
- package/lib/client/deployment-workspace.js +37 -11
- package/lib/client/index.js +2 -7
- package/lib/client/locales.js +131 -119
- package/lib/client/permission-controller.d.ts +13 -0
- package/lib/client/permission-controller.js +50 -23
- package/lib/client/permission-locales.d.ts +28 -30
- package/lib/client/permission-locales.js +38 -38
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +8 -8
- package/lib/client.js +2272 -3773
- package/lib/core-permission-authority.js +28 -16
- package/lib/index.d.ts +0 -2
- package/lib/index.js +11 -31
- package/lib/native-admission.d.ts +3 -3
- package/lib/native-admission.js +67 -66
- package/lib/permission-controller.js +1 -1
- package/lib/permission-fs-search.js +1 -2
- package/lib/permission-fs.js +1 -2
- package/lib/permission-native-command.js +6 -4
- package/lib/permission-settings.d.ts +21 -7
- package/lib/permission-settings.js +21 -9
- package/lib/permission-web.js +1 -2
- package/lib/preset-materializer.js +3 -3
- package/lib/preset-registry.d.ts +20 -2
- package/lib/preset-registry.js +46 -17
- package/lib/profile-diagnostics.js +1 -1
- package/lib/profile-remote.js +1 -3
- package/lib/role-identity.d.ts +1 -1
- package/lib/role-identity.js +16 -4
- package/lib/role-policy.d.ts +3 -0
- package/lib/role-policy.js +30 -6
- package/lib/role-subagents.js +6 -4
- package/lib/roles.d.ts +2 -0
- package/lib/roles.js +2 -0
- package/lib/runtime-integration.js +4 -4
- package/lib/settings.d.ts +1 -3
- package/lib/settings.js +8 -10
- package/lib/state.d.ts +4 -1
- package/lib/state.js +37 -6
- package/package.json +1 -5
- package/prompts/deepwork.md +13 -1
- package/prompts/source/agents/orchestrator.md +10 -0
- package/prompts/source/category/coding.md +2 -1
- package/prompts/source/category/complex.md +1 -0
- package/prompts/source/category/deep.md +1 -0
- package/prompts/source/category/frontend.md +3 -1
- package/prompts/source/category/normal-task.md +2 -1
- package/prompts/source/category/quick.md +1 -0
- package/prompts/source/deepwork/claude-opus-5.md +2 -0
- package/prompts/source/deepwork/default.md +12 -0
- package/prompts/source/deepwork/gemini.md +6 -1
- package/prompts/source/deepwork/glm.md +5 -1
- package/prompts/source/deepwork/gpt.md +22 -2
- package/prompts/source/deepwork/kimi-k27.md +2 -0
- package/prompts/source/deepwork/planner.md +3 -1
- package/prompts/source/deepwork/swe-2.md +2 -0
- package/prompts/source/manifest.json +3 -68
- package/prompts/source/shared/dsh-host-contract.md +1 -1
- package/skills/ast-grep/SKILL.md +1 -1
- package/skills/brainstorming/SKILL.md +1 -1
- package/skills/coding-agent-sessions/SKILL.md +1 -1
- package/skills/debugging/SKILL.md +1 -1
- package/skills/dispatching-parallel-agents/SKILL.md +1 -1
- package/skills/frontend/SKILL.md +1 -1
- package/skills/git-master/SKILL.md +1 -1
- package/skills/init-deep/SKILL.md +1 -1
- package/skills/receiving-code-review/SKILL.md +1 -1
- package/skills/remove-ai-slops/SKILL.md +1 -1
- package/skills/requesting-code-review/SKILL.md +1 -1
- package/skills/subagent-driven-development/SKILL.md +1 -1
- package/skills/using-git-worktrees/SKILL.md +1 -1
- package/skills/writing-plans/SKILL.md +1 -1
- package/lib/client/ChildPermissions.d.ts +0 -43
- package/lib/client/ChildPermissions.js +0 -100
- package/lib/client/HistoryContinuation.d.ts +0 -7
- package/lib/client/HistoryContinuation.js +0 -22
- package/lib/client/PermissionPanelEntry.d.ts +0 -8
- package/lib/client/PermissionPanelEntry.js +0 -11
- package/lib/client/TemporaryPermissions.d.ts +0 -21
- package/lib/client/TemporaryPermissions.js +0 -94
- package/lib/client/history-controller.d.ts +0 -29
- package/lib/client/history-controller.js +0 -111
- package/lib/client/history-entry.d.ts +0 -11
- package/lib/client/history-entry.js +0 -106
- package/lib/client/history-locales.d.ts +0 -95
- package/lib/client/history-locales.js +0 -41
- package/lib/client/temporary-permission-client.d.ts +0 -20
- package/lib/client/temporary-permission-client.js +0 -52
- package/lib/client/temporary-permission-entry.d.ts +0 -6
- package/lib/client/temporary-permission-entry.js +0 -56
- package/lib/history-candidates.d.ts +0 -30
- package/lib/history-candidates.js +0 -176
- package/lib/history-codec.d.ts +0 -11
- package/lib/history-codec.js +0 -102
- package/lib/history-contract.d.ts +0 -44
- package/lib/history-contract.js +0 -2
- package/lib/history-controller.d.ts +0 -42
- package/lib/history-controller.js +0 -329
- package/lib/history-policy.d.ts +0 -4
- package/lib/history-policy.js +0 -8
- package/lib/history-remote.d.ts +0 -28
- package/lib/history-remote.js +0 -17
- package/lib/history-rpc.d.ts +0 -24
- package/lib/history-rpc.js +0 -136
- package/lib/history-support.d.ts +0 -15
- package/lib/history-support.js +0 -21
- package/lib/history-types.d.ts +0 -67
- package/lib/history-types.js +0 -2
- package/lib/permission-child-control.d.ts +0 -36
- package/lib/permission-child-control.js +0 -164
- package/lib/permission-exec-argv.d.ts +0 -32
- package/lib/permission-exec-argv.js +0 -171
- package/lib/permission-temporary-files.d.ts +0 -19
- package/lib/permission-temporary-files.js +0 -248
- package/lib/permission-temporary-grants.d.ts +0 -106
- package/lib/permission-temporary-grants.js +0 -198
- package/lib/permission-temporary-install.d.ts +0 -25
- package/lib/permission-temporary-install.js +0 -86
- package/lib/permission-temporary-remote.d.ts +0 -19
- package/lib/permission-temporary-remote.js +0 -75
- package/lib/permission-temporary-rpc.d.ts +0 -37
- package/lib/permission-temporary-rpc.js +0 -154
- package/lib/permission-temporary-types.d.ts +0 -47
- package/lib/permission-temporary-types.js +0 -2
- package/lib/permission-temporary-web.d.ts +0 -11
- package/lib/permission-temporary-web.js +0 -154
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-gateway@0.2.1-rc.2.patch +0 -13291
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-remotes@0.2.1-rc.2.patch +0 -9133
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-client-ui-approval@0.2.1-rc.2.patch +0 -156
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-subagent@0.2.1-rc.2.patch +0 -3546
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-user-approval@0.2.1-rc.2.patch +0 -431
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-web@0.2.1-rc.2.patch +0 -119
- package/patches/dsh-approval-settlement/README.md +0 -41
- package/patches/dsh-approval-settlement/metadata.json +0 -10
- package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-loop@0.2.1-rc.2.patch +0 -383
- package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-preset-registry@0.2.1-rc.2.patch +0 -55
- package/patches/dsh-session-activation/@deepseek-ai__dsh-api-session-controller@0.2.1-rc.2.patch +0 -16673
- package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-subagent@0.2.1-rc.2.patch +0 -29
- package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-workspace@0.2.1-rc.2.patch +0 -196
- package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence-jsonl@0.2.1-rc.2.patch +0 -35
- package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence@0.2.1-rc.2.patch +0 -40
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
2
|
import { parsePermissionRules, permissionRuleRow } from "./permission-rules.js";
|
|
3
3
|
import { PermissionRefusal } from "./permission-errors.js";
|
|
4
|
+
/** Bounded static prefix grammar; the optional final star always denotes the whole argv tail. */
|
|
5
|
+
export function parseNativeCommandPattern(input) {
|
|
6
|
+
if (typeof input !== "string" || input.length > 32768)
|
|
7
|
+
throw new PermissionRefusal("validation");
|
|
8
|
+
const tokens = input.replace(/^[ \t]+|[ \t]+$/gu, "").split(/[ \t]+/u);
|
|
9
|
+
if (tokens.length !== 2 && (tokens.length !== 3 || tokens[2] !== "*")
|
|
10
|
+
|| tokens[0].length === 0 || /[^\p{L}\p{M}\p{N}_./:=+%\\\-]/u.test(tokens[0]))
|
|
11
|
+
throw new PermissionRefusal("validation");
|
|
12
|
+
const subcommands = tokens[1].split("|");
|
|
13
|
+
if (subcommands.some(value => value.length === 0 || /[^\p{L}\p{M}\p{N}_./:=+%\-]/u.test(value)))
|
|
14
|
+
throw new PermissionRefusal("validation");
|
|
15
|
+
return Object.freeze({ executable: tokens[0], subcommands: Object.freeze(subcommands) });
|
|
16
|
+
}
|
|
4
17
|
export function parseNativeCommands(input = {}) {
|
|
5
18
|
const row = permissionRuleRow(input, [], ["enabled", "entries"]);
|
|
6
19
|
if (row.enabled !== undefined && typeof row.enabled !== "boolean" || row.entries !== undefined && (!Array.isArray(row.entries) || row.entries.length > 1024))
|
|
@@ -9,25 +22,24 @@ export function parseNativeCommands(input = {}) {
|
|
|
9
22
|
throw new PermissionRefusal("validation"); return value; };
|
|
10
23
|
const ids = new Set();
|
|
11
24
|
const entries = (row.entries ?? []).map(value => {
|
|
12
|
-
const entry = permissionRuleRow(value, ["id", "mode", "match", "sandboxMode"])
|
|
25
|
+
const entry = permissionRuleRow(value, ["id", "mode", "match", "sandboxMode"]);
|
|
26
|
+
const match = permissionRuleRow(entry.match, ["tool", "workingDirectory", "commandPattern"]);
|
|
13
27
|
const id = text(entry.id), cwd = text(match.workingDirectory);
|
|
14
28
|
if (ids.has(id) || !["ask", "allow"].includes(entry.mode) || !["bash", "pwsh"].includes(match.tool)
|
|
15
29
|
|| !["workspace-write", "danger-full-access"].includes(entry.sandboxMode)
|
|
16
30
|
// Wire paths belong to the Host, not the browser's platform. The Host validates and canonicalizes them before use.
|
|
17
|
-
|| !/^(?:\/|[a-z]:[\\/]|\\\\[^\\/]+[\\/][^\\/]+(?:[\\/]|$))/iu.test(cwd)
|
|
31
|
+
|| !/^(?:\/|[a-z]:[\\/]|\\\\[^\\/]+[\\/][^\\/]+(?:[\\/]|$))/iu.test(cwd))
|
|
18
32
|
throw new PermissionRefusal("validation");
|
|
19
33
|
ids.add(id);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}) });
|
|
34
|
+
parseNativeCommandPattern(match.commandPattern);
|
|
35
|
+
const parsed = { tool: match.tool, workingDirectory: cwd, commandPattern: match.commandPattern };
|
|
36
|
+
return Object.freeze({ id, mode: entry.mode, sandboxMode: entry.sandboxMode, match: Object.freeze(parsed) });
|
|
24
37
|
});
|
|
25
38
|
return Object.freeze({ enabled: row.enabled ?? false, entries: Object.freeze(entries) });
|
|
26
39
|
}
|
|
40
|
+
export const nativeCommandMatchSchema = z.object({ tool: z.union(["bash", "pwsh"]).required(), workingDirectory: z.string().required(), commandPattern: z.string().required() }).required();
|
|
27
41
|
const nativeCommands = z.object({ enabled: z.boolean().default(false), entries: z.array(z.object({
|
|
28
|
-
id: z.string().required(), mode: z.union(["ask", "allow"]).required(), match: z.
|
|
29
|
-
tool: z.union(["bash", "pwsh"]).required(), executable: z.string().required(), subcommand: z.string(), args: z.array(z.string()).required(), workingDirectory: z.string().required(),
|
|
30
|
-
}).required(), sandboxMode: z.union(["workspace-write", "danger-full-access"]).required(),
|
|
42
|
+
id: z.string().required(), mode: z.union(["ask", "allow"]).required(), match: nativeCommandMatchSchema, sandboxMode: z.union(["workspace-write", "danger-full-access"]).required(),
|
|
31
43
|
})).default([]) });
|
|
32
44
|
const webDefault = Object.freeze({ enabled: true, rule: "inherit" });
|
|
33
45
|
export const DEFAULT_PERMISSION_CONTROL = Object.freeze({ enabled: true, outsideReads: "inherit", webSearch: webDefault, webFetch: webDefault, rules: Object.freeze([]), nativeCommands: parseNativeCommands() });
|
package/lib/permission-web.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as Native from "@deepseek-ai/dsh-tool-web";
|
|
2
2
|
import { DsmmPermissionController } from "./permission-controller.js";
|
|
3
|
-
import { temporaryWebToolScope } from "./permission-temporary-web.js";
|
|
4
3
|
export { Config, inject, name } from "@deepseek-ai/dsh-tool-web";
|
|
5
4
|
export function apply(ctx, config) {
|
|
6
|
-
return Native.apply(
|
|
5
|
+
return Native.apply(DsmmPermissionController.toolScope(ctx, "web"), config);
|
|
7
6
|
}
|
|
8
7
|
//# sourceMappingURL=permission-web.js.map
|
|
@@ -2,7 +2,7 @@ import { lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSy
|
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { isAbsolute, join, relative, sep } from "node:path";
|
|
4
4
|
import { DSMM_ROLES, DSMM_ROLE_IDS, renderAgentCordis, renderPresetMetadata } from "./roles.js";
|
|
5
|
-
import { isRoleEnabled } from "./settings.js";
|
|
5
|
+
import { isRoleEnabled, isRootRoleEnabled } from "./settings.js";
|
|
6
6
|
import { enabledSkillNames } from "./skills.js";
|
|
7
7
|
export const DSMM_MANAGED_PRESET_MARKER = ".dsmm-managed-preset";
|
|
8
8
|
export const DSMM_MANAGED_PRESET_MARKER_VERSION = 1;
|
|
@@ -71,12 +71,12 @@ export function reconcileRolePresets({ root, settings, filesystem: filesystemOve
|
|
|
71
71
|
};
|
|
72
72
|
});
|
|
73
73
|
for (const knownDirectory of knownDirectories) {
|
|
74
|
-
if (settings.presets.materialize &&
|
|
74
|
+
if (settings.presets.materialize && isRootRoleEnabled(settings, knownDirectory.role.id) && knownDirectory.ownership === "foreign") {
|
|
75
75
|
throw new Error(`dsmm preset directory is foreign and will not be claimed: ${knownDirectory.directory}`);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
for (const knownDirectory of knownDirectories) {
|
|
79
|
-
if (settings.presets.materialize &&
|
|
79
|
+
if (settings.presets.materialize && isRootRoleEnabled(settings, knownDirectory.role.id)) {
|
|
80
80
|
if (knownDirectory.ownership === "absent") {
|
|
81
81
|
publishNewRoleDirectory(canonicalRoot, root, knownDirectory.role.id, settings, filesystem);
|
|
82
82
|
}
|
package/lib/preset-registry.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import type { DshContext } from "./dsh-types.js";
|
|
2
2
|
import type { DsmmSettings } from "./settings.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
interface NativeScopedTools {
|
|
4
|
+
get(name: string, scope?: object): unknown;
|
|
5
|
+
restrict(filter: {
|
|
6
|
+
deny: string[];
|
|
7
|
+
}): () => void;
|
|
8
|
+
}
|
|
9
|
+
interface NativeAgent {
|
|
10
|
+
ctx: {
|
|
11
|
+
tools?: NativeScopedTools;
|
|
12
|
+
get?<T>(name: string): T | undefined;
|
|
13
|
+
};
|
|
14
|
+
id?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Declare the selectable dispatcher composition to DSH 0.2's native registry;
|
|
18
|
+
* directories are not discovery inputs. `roleIdentity` reports the admitted
|
|
19
|
+
* delegation role of an Agent, whose composition is shared with its parent.
|
|
20
|
+
*/
|
|
21
|
+
export declare function registerRolePresets(ctx: DshContext, getSettings: () => DsmmSettings, roleIdentity?: (agent: NativeAgent) => string | undefined): void | Promise<void>;
|
|
22
|
+
export {};
|
|
5
23
|
//# sourceMappingURL=preset-registry.d.ts.map
|
package/lib/preset-registry.js
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import { Context as NativeContext, getTraceable } from "@deepseek-ai/cordis";
|
|
2
2
|
import { DSMM_ROLES, DSMM_ROLE_IDS, rolePluginRows } from "./roles.js";
|
|
3
3
|
import { enabledSkillNames } from "./skills.js";
|
|
4
|
+
import { isRootRoleEnabled } from "./settings.js";
|
|
4
5
|
import { allowedRoleChildren, readonlyRoleTool, roleFromToolName, READONLY_ROLE_DENIED_TOOLS } from "./role-policy.js";
|
|
5
6
|
import { nativeStandingFullAccess } from "./permission-native-access.js";
|
|
6
7
|
import { scopeParentOf } from "./native-scope.js";
|
|
7
|
-
/**
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Declare the selectable dispatcher composition to DSH 0.2's native registry;
|
|
10
|
+
* directories are not discovery inputs. `roleIdentity` reports the admitted
|
|
11
|
+
* delegation role of an Agent, whose composition is shared with its parent.
|
|
12
|
+
*/
|
|
13
|
+
export function registerRolePresets(ctx, getSettings, roleIdentity) {
|
|
9
14
|
const install = async (readyCtx) => {
|
|
10
15
|
const registry = readyCtx.get?.("agentPresets")
|
|
11
16
|
?? readyCtx.agentPresets;
|
|
12
17
|
if (registry === undefined)
|
|
13
18
|
throw new Error("dsmm requires the native DSH agentPresets registry");
|
|
14
19
|
const settings = getSettings();
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
// Only the dispatcher is a user-selectable composition. Delegation targets
|
|
21
|
+
// share their parent's standing composition and carry their role entirely
|
|
22
|
+
// through the admitted invocation and per-Agent registrations.
|
|
23
|
+
// Only the dispatcher is a user-selectable composition. Delegation targets
|
|
24
|
+
// share their parent's standing composition and carry their role entirely
|
|
25
|
+
// through the admitted invocation and per-Agent registrations.
|
|
26
|
+
const active = DSMM_ROLES.filter((role) => isRootRoleEnabled(settings, role.id));
|
|
17
27
|
const disposers = [];
|
|
18
28
|
try {
|
|
19
29
|
for (const role of active) {
|
|
@@ -24,16 +34,23 @@ export function registerRolePresets(ctx, getSettings) {
|
|
|
24
34
|
order: role.order,
|
|
25
35
|
// Profiles do not replace standing native compositions. Child routes
|
|
26
36
|
// are admitted by the role provider from the parent's fixed snapshot.
|
|
27
|
-
plugins: rolePluginRows(role, enabledSkillNames(settings), enabled)
|
|
37
|
+
plugins: rolePluginRows(role, enabledSkillNames(settings), DSMM_ROLE_IDS.filter((id) => settings.modules.deepwork.enabled && settings.roles[id]))
|
|
28
38
|
}));
|
|
29
39
|
}
|
|
30
|
-
// A
|
|
31
|
-
//
|
|
32
|
-
//
|
|
40
|
+
// A directly selected read-only preset and a delegated read-only child
|
|
41
|
+
// must both be restricted at the Agent scope: preset-local fs
|
|
42
|
+
// registrations cannot be filtered within their own layer. Delegation
|
|
43
|
+
// children share their parent's composition, so their role comes from
|
|
44
|
+
// the admitted invocation identity, not from composedPreset.
|
|
45
|
+
const roleOf = (agent) => roleIdentity?.(agent) ?? registry.composedPreset(agent.ctx);
|
|
46
|
+
const agents = readyCtx.get?.("agents")
|
|
47
|
+
?? readyCtx.agents;
|
|
48
|
+
if (agents === undefined)
|
|
49
|
+
throw new Error("dsmm native preset restriction requires DSH Agent registry");
|
|
33
50
|
const states = new WeakMap();
|
|
34
51
|
const restrictedAgents = new Set();
|
|
35
52
|
const denial = (agent, name) => {
|
|
36
|
-
const role =
|
|
53
|
+
const role = roleOf(agent);
|
|
37
54
|
if (!isReadonlyRole(role))
|
|
38
55
|
return undefined;
|
|
39
56
|
const target = roleFromToolName(name);
|
|
@@ -41,13 +58,23 @@ export function registerRolePresets(ctx, getSettings) {
|
|
|
41
58
|
: allowedRoleChildren(role).includes(target) && settings.roles[target] ? undefined : "dsmm read-only role does not permit this delegation";
|
|
42
59
|
};
|
|
43
60
|
const reconcile = (agent) => {
|
|
44
|
-
const
|
|
61
|
+
const identityRole = roleIdentity?.(agent);
|
|
62
|
+
// A delegation child's identity is bound by native admission's created
|
|
63
|
+
// guard, which may still be in flight during this synchronous
|
|
64
|
+
// reconcile. A parented agent with no bound identity stays pending
|
|
65
|
+
// instead of concluding "not read-only" from a not-yet-bound role.
|
|
66
|
+
const agentId = agent.id;
|
|
67
|
+
const parented = agentId !== undefined && agents.list().some(other => other !== agent && agents.isOwnedBy(agentId, other));
|
|
68
|
+
const pendingIdentity = roleIdentity !== undefined && identityRole === undefined && parented;
|
|
69
|
+
const selected = pendingIdentity ? undefined : identityRole ?? registry.composedPreset(agent.ctx);
|
|
45
70
|
const previous = states.get(agent);
|
|
46
71
|
if (previous !== undefined && previous.role === selected && (previous.pending || !isReadonlyRole(selected) || previous.disposeRestriction !== undefined))
|
|
47
72
|
return;
|
|
48
|
-
states.set(agent, { role: selected, pending:
|
|
73
|
+
states.set(agent, { role: selected, pending: pendingIdentity || undefined });
|
|
49
74
|
previous?.disposeRestriction?.();
|
|
50
75
|
restrictedAgents.delete(agent);
|
|
76
|
+
if (pendingIdentity)
|
|
77
|
+
return;
|
|
51
78
|
if (!isReadonlyRole(selected)) {
|
|
52
79
|
states.set(agent, { role: selected });
|
|
53
80
|
return;
|
|
@@ -63,9 +90,15 @@ export function registerRolePresets(ctx, getSettings) {
|
|
|
63
90
|
if (tools?.restrict === undefined)
|
|
64
91
|
throw new Error(`dsmm read-only role requires DSH tools restrict: ${selected}`);
|
|
65
92
|
restrictedAgents.add(agent);
|
|
66
|
-
//
|
|
93
|
+
// A delegation child shares its parent's standing composition realm,
|
|
94
|
+
// where a realm-level restriction would also mask the writable
|
|
95
|
+
// parent. Such children are fenced per-Agent through the runtime
|
|
96
|
+
// denial above instead; schema masking applies only to a directly
|
|
97
|
+
// selected read-only composition with its own realm.
|
|
67
98
|
const inheritedScope = scopeParentOf(agent);
|
|
68
|
-
const
|
|
99
|
+
const sharedRealmChild = roleIdentity !== undefined && roleIdentity(agent) === selected;
|
|
100
|
+
const maskable = READONLY_ROLE_DENIED_TOOLS.filter(name => tools.get(name, inheritedScope) !== undefined);
|
|
101
|
+
const disposeRestriction = sharedRealmChild || maskable.length === 0 ? () => { } : tools.restrict({ deny: maskable });
|
|
69
102
|
states.set(agent, { role: selected, disposeRestriction });
|
|
70
103
|
}
|
|
71
104
|
catch (error) {
|
|
@@ -74,10 +107,6 @@ export function registerRolePresets(ctx, getSettings) {
|
|
|
74
107
|
throw error;
|
|
75
108
|
}
|
|
76
109
|
};
|
|
77
|
-
const agents = readyCtx.get?.("agents")
|
|
78
|
-
?? readyCtx.agents;
|
|
79
|
-
if (agents === undefined)
|
|
80
|
-
throw new Error("dsmm native preset restriction requires DSH Agent registry");
|
|
81
110
|
const onPreExecute = readyCtx.on?.("tools/pre-execute", async (execution, next) => {
|
|
82
111
|
const agent = execution.agent;
|
|
83
112
|
if (agent === undefined || agents.get(agent.id) !== agent)
|
|
@@ -38,7 +38,7 @@ const configFields = {
|
|
|
38
38
|
deepseekV4ProMaxReasoningPresets: null, deepseekFlashMaxReasoningPresets: null,
|
|
39
39
|
modules: { deepwork: { enabled: null } },
|
|
40
40
|
skills: "skills", roles: "roles", roleRouting: "role-routing", runtimePolicy: { strategy: null, rateLimit },
|
|
41
|
-
presets: { materialize: null,
|
|
41
|
+
presets: { materialize: null, root: null }, subagents: { toolTopology: null, allowRouteOverride: null, enableRunInBackground: null, backgroundMode: null, maxDepth: null },
|
|
42
42
|
workflow: { policy: null, strictGates: null, reviewCap: null, finalReviewPolicy: null },
|
|
43
43
|
guards: { scope: null, shellCommandSafety: null, gitWriteGuard: null, toolOutputTruncation: { enabled: null, maxInlineBytes: null }, planFormatValidation: null, questionLabelHelper: { enabled: null, maxLabelChars: null }, todoDisciplineHelper: null },
|
|
44
44
|
runtimeRecovery: { enabled: null, retryOnStatusCodes: [null], retryOnCodes: [null], fallbackRoutes: [route], maxFallbackAttempts: null, idleContinuation: { enabled: null, maxContinuations: null, prompt: null } },
|
package/lib/profile-remote.js
CHANGED
|
@@ -413,9 +413,7 @@ function readOnlySettingsData(value) {
|
|
|
413
413
|
fail("private environment");
|
|
414
414
|
}
|
|
415
415
|
if (settings.presets !== undefined) {
|
|
416
|
-
const presets = object(settings.presets, ["materialize"], ["root"
|
|
417
|
-
if (Object.hasOwn(presets, "plannerRootEnabled"))
|
|
418
|
-
boolean(presets.plannerRootEnabled, "presets.plannerRootEnabled");
|
|
416
|
+
const presets = object(settings.presets, ["materialize"], ["root"]);
|
|
419
417
|
if (presets.root !== undefined && presets.root !== "<configured>")
|
|
420
418
|
fail("private directory");
|
|
421
419
|
}
|
package/lib/role-identity.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DshAgent } from "./dsh-types.js";
|
|
2
2
|
import type { DsmmRoleId } from "./roles.js";
|
|
3
3
|
/** The caller supplies the policy-admitted identity; only its Agent layer is changed. */
|
|
4
|
-
export declare function registerRoleHarnessIdentity(agent: DshAgent, role: DsmmRoleId): () => void;
|
|
4
|
+
export declare function registerRoleHarnessIdentity(agent: DshAgent, role: DsmmRoleId, child?: boolean): () => void;
|
|
5
5
|
//# sourceMappingURL=role-identity.d.ts.map
|
package/lib/role-identity.js
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
import { getTraceable } from "@deepseek-ai/cordis";
|
|
1
2
|
import { nativeAgentContext } from "./native-scope.js";
|
|
2
3
|
import { buildRoleIdentity } from "./prompt-content.js";
|
|
3
4
|
import { DSMM_ROLES } from "./roles.js";
|
|
4
5
|
/** The caller supplies the policy-admitted identity; only its Agent layer is changed. */
|
|
5
|
-
export function registerRoleHarnessIdentity(agent, role) {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export function registerRoleHarnessIdentity(agent, role, child = false) {
|
|
7
|
+
const ctx = nativeAgentContext(agent);
|
|
8
|
+
const prompt = getTraceable(ctx, ctx.get("agentPresets")?.serviceFor({ ctx }, "systemPrompt") ?? ctx.get("systemPrompt"));
|
|
9
|
+
const definition = DSMM_ROLES.find(row => row.id === role);
|
|
10
|
+
const identity = prompt.section({ name: "harness:identity", order: prompt.getSectionOrder("HARNESS_IDENTITY"),
|
|
11
|
+
text: buildRoleIdentity(definition) });
|
|
12
|
+
try {
|
|
13
|
+
const persona = child ? prompt.section({ name: "deployment:persona-prefix", order: prompt.getSectionOrder("DEPLOYMENT_PERSONA_PREFIX"),
|
|
14
|
+
text: definition.persona }) : undefined;
|
|
15
|
+
return () => { persona?.(); identity(); };
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
identity();
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
9
21
|
}
|
|
10
22
|
//# sourceMappingURL=role-identity.js.map
|
package/lib/role-policy.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface DsmmRoleIdentity {
|
|
|
12
12
|
readonly parent?: DshAgent;
|
|
13
13
|
readonly readOnly?: boolean;
|
|
14
14
|
readonly toolFilter?: ToolRestriction;
|
|
15
|
+
readonly preset?: string;
|
|
15
16
|
}
|
|
16
17
|
export declare const READONLY_ROLE_DENIED_TOOLS: readonly ["write", "edit", "bash", "pwsh"];
|
|
17
18
|
export declare function roleToolName(role: DsmmRoleId): string;
|
|
@@ -32,6 +33,8 @@ export declare class DsmmRolePolicy {
|
|
|
32
33
|
private selected;
|
|
33
34
|
validateRootRole(agent: DshAgent, admission: DsmmProfileAdmission): void;
|
|
34
35
|
bindChild(agent: DshAgent, parent: DshAgent, admission: DsmmProfileAdmission, invocation: ResolvedRoleInvocation, maximum: number | undefined, toolFilter: ToolRestriction): void;
|
|
36
|
+
/** Ordinary native inheritance captures ceilings without inventing a role invocation. */
|
|
37
|
+
bindInheritedChild(agent: DshAgent, parent: DshAgent, admission: DsmmProfileAdmission): void;
|
|
35
38
|
release(agent: DshAgent): void;
|
|
36
39
|
assertModuleAdmission(agent: DshAgent): void;
|
|
37
40
|
identity(agent: DshAgent): DsmmRoleIdentity;
|
package/lib/role-policy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
import { SubagentError, delegationDepthOf } from "@deepseek-ai/dsh-subagent";
|
|
3
|
-
import { symbols } from "@deepseek-ai/cordis";
|
|
3
|
+
import { Context, symbols } from "@deepseek-ai/cordis";
|
|
4
4
|
import { DSMM_ROLES, allowedRoleChildren, isDsmmRoleId } from "./roles.js";
|
|
5
5
|
export { allowedRoleChildren } from "./roles.js";
|
|
6
6
|
import { isRootRoleEnabled } from "./settings.js";
|
|
@@ -24,7 +24,17 @@ export function inheritToolFilter(parent, requested) {
|
|
|
24
24
|
return Object.freeze({ ...(allow === undefined ? {} : { allow: Object.freeze([...allow]) }), deny: Object.freeze([...new Set([...parent?.deny ?? [], ...requested?.deny ?? []])]) });
|
|
25
25
|
}
|
|
26
26
|
export function resolveAdmittedDsmmRole(agent, settings, active) {
|
|
27
|
-
|
|
27
|
+
const identity = liveIdentities.get(agent);
|
|
28
|
+
if (identity !== undefined)
|
|
29
|
+
return identity.role;
|
|
30
|
+
if (Context.is(agent.ctx)) {
|
|
31
|
+
if (!settings.modules.deepwork.enabled || !agent.ctx.get("dsmmNativeAdmission")?.owns(agent) || agent.session.header?.origin === "subagent")
|
|
32
|
+
return undefined;
|
|
33
|
+
const preset = agent.ctx.get("agentPresets")?.composedPreset(agent.ctx);
|
|
34
|
+
const role = isDsmmRoleId(preset) ? preset : active ? "dsmm-orchestrator" : undefined;
|
|
35
|
+
return role !== undefined && settings.roles[role] ? role : undefined;
|
|
36
|
+
}
|
|
37
|
+
return resolveEffectiveDsmmRole(agent, settings, active);
|
|
28
38
|
}
|
|
29
39
|
/** Role and exact-call restrictions; no child creation or execution owner. */
|
|
30
40
|
export class DsmmRolePolicy {
|
|
@@ -42,7 +52,9 @@ export class DsmmRolePolicy {
|
|
|
42
52
|
throw new SubagentError("Native registry unavailable", "UNAUTHORIZED"); return agents; }
|
|
43
53
|
assertLive(agent) { if (!agent.id || this.agents().get(agent.id) !== agent)
|
|
44
54
|
throw new SubagentError("Exact live Agent required", "UNAUTHORIZED"); }
|
|
45
|
-
selected(agent) {
|
|
55
|
+
selected(agent) {
|
|
56
|
+
return Context.is(agent.ctx) ? agent.ctx.get("agentPresets")?.composedPreset(agent.ctx) : resolveSelectedAgentPreset(agent.session);
|
|
57
|
+
}
|
|
46
58
|
validateRootRole(agent, admission) {
|
|
47
59
|
this.assertLive(agent);
|
|
48
60
|
const selected = this.selected(agent);
|
|
@@ -53,24 +65,36 @@ export class DsmmRolePolicy {
|
|
|
53
65
|
this.assertLive(agent);
|
|
54
66
|
this.assertLive(parent);
|
|
55
67
|
this.assertDelegation(parent, invocation.target);
|
|
56
|
-
if (!this.agents().isOwnedBy(agent.id, parent) || agent.session.header?.parentSession !== parent.id || this.selected(agent) !==
|
|
68
|
+
if (!this.agents().isOwnedBy(agent.id, parent) || agent.session.header?.parentSession !== parent.id || this.selected(agent) !== this.selected(parent))
|
|
57
69
|
throw new SubagentError("Child lineage or composition mismatch", "UNAUTHORIZED");
|
|
58
70
|
if (maximum !== undefined && delegationDepthOf(agent) > maximum)
|
|
59
71
|
throw new SubagentError("Delegation depth exceeded", "UNAUTHORIZED");
|
|
60
72
|
const upstream = this.identity(parent);
|
|
61
|
-
liveIdentities.set(agent, Object.freeze({ role: invocation.target, child: true, parent, epoch: admission.epoch,
|
|
73
|
+
liveIdentities.set(agent, Object.freeze({ role: invocation.target, child: true, parent, preset: this.selected(agent), epoch: admission.epoch,
|
|
62
74
|
readOnly: this.readOnly(upstream) || DSMM_ROLES.find(row => row.id === invocation.target).access === "read-only",
|
|
63
75
|
toolFilter: inheritToolFilter(inheritToolFilter(upstream.toolFilter, toolFilter), this.visibleToolCeiling(parent)) }));
|
|
64
76
|
bindRoleInvocation(agent, invocation);
|
|
65
77
|
captureRoleRuntimePolicy(admission.settings, invocation.target, invocation.policy);
|
|
66
78
|
}
|
|
79
|
+
/** Ordinary native inheritance captures ceilings without inventing a role invocation. */
|
|
80
|
+
bindInheritedChild(agent, parent, admission) {
|
|
81
|
+
this.assertLive(agent);
|
|
82
|
+
this.assertModuleAdmission(parent);
|
|
83
|
+
const upstream = this.identity(parent), preset = this.selected(agent);
|
|
84
|
+
if (upstream.role !== undefined || preset?.startsWith("dsmm-") || !this.agents().isOwnedBy(agent.id, parent)
|
|
85
|
+
|| agent.session.header?.origin !== "subagent" || agent.session.header.parentSession !== parent.id)
|
|
86
|
+
throw new SubagentError("Ordinary inheritance requires its exact non-controlled parent", "UNAUTHORIZED");
|
|
87
|
+
liveIdentities.set(agent, Object.freeze({ child: true, parent, preset, epoch: admission.epoch,
|
|
88
|
+
readOnly: this.readOnly(upstream), toolFilter: inheritToolFilter(upstream.toolFilter, this.visibleToolCeiling(parent)) }));
|
|
89
|
+
}
|
|
67
90
|
release(agent) { liveIdentities.delete(agent); toolIdentities.delete(agent); }
|
|
68
91
|
assertModuleAdmission(agent) {
|
|
69
92
|
this.assertLive(agent);
|
|
70
93
|
const settings = this.getSettings(agent), identity = liveIdentities.get(agent), selected = this.selected(agent);
|
|
71
94
|
if (identity?.child) {
|
|
72
95
|
this.assertLive(identity.parent);
|
|
73
|
-
if (!this.agents().isOwnedBy(agent.id, identity.parent) || selected !== identity.
|
|
96
|
+
if (!this.agents().isOwnedBy(agent.id, identity.parent) || selected !== identity.preset
|
|
97
|
+
|| identity.role !== undefined && selected !== this.selected(identity.parent))
|
|
74
98
|
throw new SubagentError("Child admission no longer matches composition", "UNAUTHORIZED");
|
|
75
99
|
}
|
|
76
100
|
else if (agent.session.header?.origin !== "subagent")
|
package/lib/role-subagents.js
CHANGED
|
@@ -188,7 +188,8 @@ function registerRoleTool(agent, agentCtx, tools, entry, getSettings, policy, ad
|
|
|
188
188
|
return admission.duringCall(parent, exec.signal, async (signal) => {
|
|
189
189
|
const invocation = await resolveRoleInvocation(parent, role.id, current, signal, { ...(args.level === undefined ? {} : { level: args.level }), ...(args.route === undefined ? {} : { route: args.route }) });
|
|
190
190
|
const capturedProvider = provider;
|
|
191
|
-
const
|
|
191
|
+
const parentComposition = parent.ctx.get?.("agentPresets")?.composedPreset(parent.ctx);
|
|
192
|
+
const request = { parent, ...(parentComposition === undefined ? {} : { agentPreset: parentComposition }), prompt: [{ type: "text", text: args.prompt }],
|
|
192
193
|
agentOptions: invocationAgentOptions(invocation), maxDepth: subagents.resolveMaxDepth(current.subagents.maxDepth) };
|
|
193
194
|
const assertCurrent = () => {
|
|
194
195
|
if (policy.assertDelegation(parent, role.id).epoch !== admitted.epoch)
|
|
@@ -249,12 +250,13 @@ export async function registerHeadlessRoleTools(ctx, controller, getSettings, po
|
|
|
249
250
|
return;
|
|
250
251
|
}
|
|
251
252
|
const states = new WeakMap();
|
|
252
|
-
const reconcileIdentity = (agent,
|
|
253
|
+
const reconcileIdentity = (agent, identity = policy.identity(agent)) => {
|
|
254
|
+
const role = identity.role;
|
|
253
255
|
const state = states.get(agent);
|
|
254
256
|
if (state === undefined || state.identityRole === role)
|
|
255
257
|
return;
|
|
256
258
|
state.identityPrompt?.();
|
|
257
|
-
state.identityPrompt = role === undefined ? undefined : registerRoleHarnessIdentity(agent, role);
|
|
259
|
+
state.identityPrompt = role === undefined ? undefined : registerRoleHarnessIdentity(agent, role, identity.child);
|
|
258
260
|
state.identityRole = role;
|
|
259
261
|
};
|
|
260
262
|
const reconcile = (agent) => {
|
|
@@ -288,7 +290,7 @@ export async function registerHeadlessRoleTools(ctx, controller, getSettings, po
|
|
|
288
290
|
} });
|
|
289
291
|
state.promptRealm = promptRealm;
|
|
290
292
|
}
|
|
291
|
-
reconcileIdentity(agent, identity
|
|
293
|
+
reconcileIdentity(agent, identity);
|
|
292
294
|
const subagents = agentCtx.get("subagents");
|
|
293
295
|
const host = ctx.get?.("tools");
|
|
294
296
|
const names = [...hostControls, ...host?.schemas().map((row) => row.name).filter((name) => name.startsWith(`mcp__${settings.lsp.serverName}__`)) ?? []];
|
package/lib/roles.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { DsmmSkillName } from "./skills.js";
|
|
|
2
2
|
import type { DsmmRoleRouting } from "./settings.js";
|
|
3
3
|
export declare const DSMM_ROLE_IDS: readonly ["dsmm-orchestrator", "dsmm-planner", "dsmm-plan-critic", "dsmm-builder", "dsmm-reviewer", "dsmm-oracle", "dsmm-oracle-2nd", "dsmm-creative", "dsmm-code-search", "dsmm-doc-search", "dsmm-clarifier", "dsmm-media-reader", "dsmm-frontend", "dsmm-hard-reasoning", "dsmm-research", "dsmm-quick", "dsmm-coding", "dsmm-normal-task", "dsmm-complex", "dsmm-deep", "dsmm-documenting", "dsmm-cross-cutting"];
|
|
4
4
|
export type DsmmRoleId = (typeof DSMM_ROLE_IDS)[number];
|
|
5
|
+
/** The one user-selectable composition; every other role is an internal delegation target. */
|
|
6
|
+
export declare const DSMM_DISPATCHER_ROLE: DsmmRoleId;
|
|
5
7
|
export type DsmmRoleMode = "primary" | "all" | "subagent";
|
|
6
8
|
export type DsmmDelegationGroup = "primary-coordinator" | "utility-leaf" | "read-only-workflow" | "standard-workflow" | "local-coordinator";
|
|
7
9
|
export interface DsmmRoleDefinition {
|
package/lib/roles.js
CHANGED
|
@@ -8,6 +8,8 @@ export const DSMM_ROLE_IDS = [
|
|
|
8
8
|
"dsmm-coding", "dsmm-normal-task", "dsmm-complex", "dsmm-deep",
|
|
9
9
|
"dsmm-documenting", "dsmm-cross-cutting"
|
|
10
10
|
];
|
|
11
|
+
/** The one user-selectable composition; every other role is an internal delegation target. */
|
|
12
|
+
export const DSMM_DISPATCHER_ROLE = "dsmm-orchestrator";
|
|
11
13
|
// Generated source catalog is checked against the exact literal ID inventory.
|
|
12
14
|
// It carries no OCMM provider/model default and requires only package assets.
|
|
13
15
|
export const DSMM_ROLES = SOURCE_ROLE_CATALOG.map((row) => ({
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { capturedRoleInvocation } from "./role-invocation.js";
|
|
2
|
-
import { resolveSelectedAgentPreset } from "./session-scope.js";
|
|
3
2
|
export function assertSupportedHostStartup(options) {
|
|
4
3
|
if (options === null || typeof options !== "object" || Object.keys(options).length)
|
|
5
4
|
throw new Error("DSMM uses official native services; runtime replacement options are unsupported");
|
|
6
5
|
}
|
|
7
6
|
export function classifyDsmmAgent(agent) {
|
|
8
|
-
const preset = agent.ctx.get("agentPresets")?.composedPreset(agent.ctx)
|
|
9
|
-
return preset?.startsWith("dsmm-")
|
|
7
|
+
const admission = agent.ctx.get("dsmmNativeAdmission"), preset = agent.ctx.get("agentPresets")?.composedPreset(agent.ctx);
|
|
8
|
+
return capturedRoleInvocation(agent) || admission?.owns(agent) && preset?.startsWith("dsmm-") ? "dsmm" : "native";
|
|
10
9
|
}
|
|
11
10
|
export function runtimeAdmissionView(ctx) {
|
|
12
|
-
const native = ctx.get("subagents"), admission = ctx.get("dsmmNativeAdmission")
|
|
11
|
+
const native = ctx.get("subagents"), admission = ctx.get("dsmmNativeAdmission");
|
|
12
|
+
const ready = native !== undefined && admission?.isReady === true;
|
|
13
13
|
return { binding: native === undefined ? "unavailable" : "stock", deliveryFenceReady: ready,
|
|
14
14
|
restartRequired: !ready, ...ready ? {} : { reason: "authority-not-ready" } };
|
|
15
15
|
}
|
package/lib/settings.d.ts
CHANGED
|
@@ -36,8 +36,6 @@ export interface DsmmWorkflowSettings {
|
|
|
36
36
|
}
|
|
37
37
|
export interface DsmmPresetSettings {
|
|
38
38
|
materialize: boolean;
|
|
39
|
-
/** Startup-pinned root exposure only; workflow Planner delegation stays enabled. */
|
|
40
|
-
plannerRootEnabled: boolean;
|
|
41
39
|
root?: string;
|
|
42
40
|
}
|
|
43
41
|
export interface DsmmSubagentSettings {
|
|
@@ -238,7 +236,7 @@ export declare function validateLocale(value: unknown, field?: string): asserts
|
|
|
238
236
|
export declare function normalizeLevelOverride(value: unknown, field?: string): DsmmLevelOverride;
|
|
239
237
|
export declare function resolveRoleRouting(input: DsmmRoleRouting | undefined): DsmmRoleRouting;
|
|
240
238
|
export declare function isRoleEnabled(settings: DsmmSettings, role: DsmmRoleId): boolean;
|
|
241
|
-
/**
|
|
239
|
+
/** Only the dispatcher is a selectable standing root; every other role stays an internal delegation target. */
|
|
242
240
|
export declare function isRootRoleEnabled(settings: DsmmSettings, id: DsmmRoleId): boolean;
|
|
243
241
|
export declare function resolveGuardSettings(config: DsmmPluginConfig["guards"]): DsmmGuardSettings;
|
|
244
242
|
export declare function registerSettings(ctx: DshContext, config?: DsmmPluginConfig, options?: RegisterSettingsOptions): () => DsmmSettings;
|
package/lib/settings.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Schema from "@deepseek-ai/schemastery";
|
|
2
2
|
import { DEFAULT_DSMM_LSP_SETTINGS, resolveLspSettings } from "./lsp.js";
|
|
3
|
-
import { DSMM_ROLES, DSMM_ROLE_IDS
|
|
3
|
+
import { DSMM_DISPATCHER_ROLE, DSMM_ROLES, DSMM_ROLE_IDS } from "./roles.js";
|
|
4
4
|
import { DSMM_SKILL_NAMES } from "./skills.js";
|
|
5
5
|
import { DEFAULT_DSMM_RUNTIME_POLICY, DSMM_RATE_LIMIT_BOUNDS, normalizeRateLimitOverrides, normalizeRoutingStrategy, normalizeRuntimePolicy, resolveRoleRuntimePolicy } from "./routing-policy.js";
|
|
6
6
|
import { DEPRECATED_DSMM_FIELDS, DsmmConfigValidationError, safeDiagnosticField } from "./profile-diagnostics.js";
|
|
7
7
|
import { DSMM_LOCALES } from "./profile-locale.js";
|
|
8
8
|
import { normalizeModelRouteJson, validateModelRouteFieldName } from "./route-json.js";
|
|
9
|
-
import { DEFAULT_PERMISSION_CONTROL, permissionControlSchema, resolvePermissionControl } from "./permission-settings.js";
|
|
9
|
+
import { DEFAULT_PERMISSION_CONTROL, nativeCommandMatchSchema, permissionControlSchema, resolvePermissionControl } from "./permission-settings.js";
|
|
10
10
|
export { DSMM_LOCALES } from "./profile-locale.js";
|
|
11
11
|
export { resolveRoleRuntimePolicy } from "./routing-policy.js";
|
|
12
12
|
export { DSMM_SKILL_NAMES, MVP_SKILL_NAMES } from "./skills.js";
|
|
@@ -23,8 +23,7 @@ export const DEFAULT_DSMM_SETTINGS = {
|
|
|
23
23
|
roleRouting: {},
|
|
24
24
|
runtimePolicy: DEFAULT_DSMM_RUNTIME_POLICY,
|
|
25
25
|
presets: {
|
|
26
|
-
materialize: false
|
|
27
|
-
plannerRootEnabled: false
|
|
26
|
+
materialize: false
|
|
28
27
|
},
|
|
29
28
|
subagents: { enableRunInBackground: false, backgroundMode: "one-shot", toolTopology: "per-role", allowRouteOverride: false },
|
|
30
29
|
workflow: {
|
|
@@ -117,7 +116,6 @@ const ROLE_ROUTING_VALIDATION_SCHEMA = Schema.transform(Schema.any(), (input) =>
|
|
|
117
116
|
});
|
|
118
117
|
const PRESETS_SCHEMA = Schema.object({
|
|
119
118
|
materialize: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.presets.materialize),
|
|
120
|
-
plannerRootEnabled: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.presets.plannerRootEnabled),
|
|
121
119
|
root: Schema.string()
|
|
122
120
|
});
|
|
123
121
|
const SUBAGENTS_SCHEMA = Schema.object({
|
|
@@ -251,6 +249,9 @@ export function deploymentEditorSchema(native = false) {
|
|
|
251
249
|
function sparseSchema(schema) {
|
|
252
250
|
if (schema === permissionControlSchema && schema.type === "transform")
|
|
253
251
|
return sparseSchema(schema.inner);
|
|
252
|
+
// Whole command entries are never partial overlays; retain the match's required fields.
|
|
253
|
+
if (schema === nativeCommandMatchSchema)
|
|
254
|
+
return schema;
|
|
254
255
|
const { default: _default, required: _required, ...meta } = schema.meta;
|
|
255
256
|
return new Schema({ ...schema, meta,
|
|
256
257
|
...(schema.dict === undefined ? {} : { dict: Object.fromEntries(Object.entries(schema.dict).map(([key, child]) => [key, sparseSchema(child)])) }),
|
|
@@ -649,18 +650,15 @@ function normalizeExplicitRoute(value) {
|
|
|
649
650
|
export function isRoleEnabled(settings, role) {
|
|
650
651
|
return settings.roles[role];
|
|
651
652
|
}
|
|
652
|
-
/**
|
|
653
|
+
/** Only the dispatcher is a selectable standing root; every other role stays an internal delegation target. */
|
|
653
654
|
export function isRootRoleEnabled(settings, id) {
|
|
654
|
-
|
|
655
|
-
return settings.modules.deepwork.enabled && settings.roles[id] && isRootRole(role)
|
|
656
|
-
&& (id !== "dsmm-planner" || settings.presets.plannerRootEnabled);
|
|
655
|
+
return id === DSMM_DISPATCHER_ROLE && settings.modules.deepwork.enabled && settings.roles[id];
|
|
657
656
|
}
|
|
658
657
|
function resolvePresetSettings(config) {
|
|
659
658
|
if (config !== undefined)
|
|
660
659
|
validateShape(config, PRESETS_SCHEMA, ["presets"]);
|
|
661
660
|
return {
|
|
662
661
|
materialize: config?.materialize ?? DEFAULT_DSMM_SETTINGS.presets.materialize,
|
|
663
|
-
plannerRootEnabled: config?.plannerRootEnabled ?? DEFAULT_DSMM_SETTINGS.presets.plannerRootEnabled,
|
|
664
662
|
...(config?.root === undefined ? {} : { root: config.root })
|
|
665
663
|
};
|
|
666
664
|
}
|
package/lib/state.d.ts
CHANGED
|
@@ -5,15 +5,18 @@ export type DeepworkSelectionOutcome = "committed" | "unchanged";
|
|
|
5
5
|
export declare function isDeepworkActive(events?: readonly DshSessionEvent[], defaultActive?: boolean, selectedPreset?: string): boolean;
|
|
6
6
|
export declare function hasOpenTurn(events?: readonly DshSessionEvent[]): boolean;
|
|
7
7
|
export declare class DeepworkModeController {
|
|
8
|
+
private readonly ctx;
|
|
8
9
|
private readonly moduleEnabled;
|
|
9
10
|
private readonly runtimeReady;
|
|
10
11
|
private readonly listeners;
|
|
11
12
|
private readonly versions;
|
|
12
|
-
constructor(
|
|
13
|
+
constructor(ctx: DshContext, moduleEnabled?: (agent: DshAgent) => boolean, runtimeReady?: () => boolean);
|
|
13
14
|
watch(listener: (agent: DshAgent) => void): () => void;
|
|
14
15
|
/** Profile commits have no native session event; notify their Agent mount. */
|
|
15
16
|
changed(agent: DshAgent): void;
|
|
16
17
|
active(agent: DshAgent | undefined, defaultActive: boolean): boolean;
|
|
18
|
+
private selectedPreset;
|
|
19
|
+
private childDefaultActive;
|
|
17
20
|
describe(agent: DshAgent, defaultActive: boolean): SessionDeepworkState;
|
|
18
21
|
private intent;
|
|
19
22
|
select(agent: DshAgent, active: boolean, defaultActive?: boolean): Promise<DeepworkSelectionOutcome>;
|