@dsmm/dsmm 0.3.28 → 0.3.30
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/agent-presets/dsmm-orchestrator/agent.cordis.yml +1 -1
- package/agent-presets/dsmm-planner/agent.cordis.yml +1 -1
- package/docs/agent-presets.md +2 -2
- package/docs/agent-teams.md +2 -0
- package/docs/compatibility.md +3 -1
- package/docs/maintenance.md +14 -8
- package/docs/model-routing.md +9 -3
- package/docs/testing.md +2 -0
- package/docs/web-fetch-fakeip.md +2 -2
- package/dsh-plugin.json +1 -1
- package/lib/client/children-locales.d.ts +4 -4
- package/lib/client/role-call-observations.js +2 -2
- package/lib/client.js +414 -1288
- package/lib/mode.js +27 -18
- package/lib/model-family.d.ts +5 -3
- package/lib/model-family.js +30 -15
- package/lib/native-subagents.d.ts +8 -1
- package/lib/native-subagents.js +25 -2
- package/lib/permission-schema.d.ts +40 -0
- package/lib/permission-schema.js +13 -0
- package/lib/permission-settings.d.ts +0 -38
- package/lib/permission-settings.js +23 -18
- package/lib/profile-diagnostics.js +1 -11
- package/lib/prompts.js +38 -8
- package/lib/role-subagents.js +10 -7
- package/lib/settings.js +2 -1
- package/lib/skills.js +6 -6
- package/package.json +6 -51
- package/prompts/deepwork.md +4 -4
- package/prompts/source/agents/orchestrator.md +1 -1
- package/prompts/source/agents/planner.md +1 -1
- package/prompts/source/deepwork/claude-fable-5-2.md +3 -0
- package/prompts/source/deepwork/default.md +3 -3
- package/prompts/source/deepwork/gemini.md +1 -1
- package/prompts/source/deepwork/general.md +2 -2
- package/prompts/source/deepwork/glm.md +2 -2
- package/prompts/source/deepwork/gpt.md +1 -1
- package/prompts/source/deepwork/planner.md +1 -1
- package/skills/ast-grep/README.md +3 -3
- package/skills/ast-grep/SKILL.md +9 -6
- package/skills/brainstorming/SKILL.md +1 -1
- package/skills/coding-agent-sessions/SKILL.md +2 -1
- package/skills/dispatching-parallel-agents/SKILL.md +1 -1
- package/skills/frontend/references/perfection/react-perf-tooling.md +24 -26
- package/skills/receiving-code-review/SKILL.md +1 -1
- package/skills/requesting-code-review/SKILL.md +1 -1
- package/skills/subagent-driven-development/SKILL.md +1 -1
- package/skills/writing-plans/SKILL.md +1 -1
package/lib/mode.js
CHANGED
|
@@ -3,11 +3,6 @@ import { agentForScope, nativeAgentContext } from "./native-scope.js";
|
|
|
3
3
|
import { buildDeepworkPrompt } from "./prompts.js";
|
|
4
4
|
import { resolveAdmittedDsmmRole } from "./role-policy.js";
|
|
5
5
|
const bindings = new WeakMap();
|
|
6
|
-
function routeFromAgent(agent) {
|
|
7
|
-
const header = agent.session.requestHeader?.();
|
|
8
|
-
const { provider, model } = (header === undefined ? agent.options : header.config) ?? {};
|
|
9
|
-
return typeof provider === "string" && typeof model === "string" ? { provider, model } : undefined;
|
|
10
|
-
}
|
|
11
6
|
/** The admission installer owns scope selection; assembly reads the immutable Agent configuration. */
|
|
12
7
|
export function registerDeepworkPrompt(readyCtx, controller, getSettings, config, agent, lifetime) {
|
|
13
8
|
const refresh = bindings.get(agent);
|
|
@@ -22,21 +17,35 @@ export function registerDeepworkPrompt(readyCtx, controller, getSettings, config
|
|
|
22
17
|
const registry = ctx.get("agentPresets")?.serviceFor(agent, "systemPrompt") ?? ctx.get("systemPrompt");
|
|
23
18
|
if (!registry)
|
|
24
19
|
throw new Error("Deepwork requires the native system prompt service");
|
|
25
|
-
dispose = getTraceable(ctx, registry).section({ name: "dsmm:deepwork", order: getSettings(agent).promptOrder, interpolate: false,
|
|
26
|
-
text(context) {
|
|
27
|
-
if (context.signal?.aborted || getSettings.subagentRuntime !== undefined && !getSettings.subagentRuntime().deliveryFenceReady)
|
|
28
|
-
return "";
|
|
29
|
-
if (context.scope !== agent && agentForScope(readyCtx, context.scope) !== agent)
|
|
30
|
-
return "";
|
|
31
|
-
const settings = getSettings(agent);
|
|
32
|
-
if (!settings.modules.deepwork.enabled || !controller.active(agent, settings.defaultActive))
|
|
33
|
-
return "";
|
|
34
|
-
return buildDeepworkPrompt(settings, { route: routeFromAgent(agent), roleId: resolveAdmittedDsmmRole(agent, settings, true) ?? null, overrideSection: config.section });
|
|
35
|
-
}
|
|
36
|
-
});
|
|
20
|
+
dispose = getTraceable(ctx, registry).section({ name: "dsmm:deepwork", order: getSettings(agent).promptOrder, interpolate: false, text: "" });
|
|
37
21
|
};
|
|
22
|
+
// Native selection writes this step's variables on the return path of the waterfall.
|
|
23
|
+
const stopAssembly = ctx.on("system-prompt/assemble", async (_assembly, context, next) => {
|
|
24
|
+
const assembled = await next();
|
|
25
|
+
if (context.scope !== agent && agentForScope(readyCtx, context.scope) !== agent)
|
|
26
|
+
return assembled;
|
|
27
|
+
if (context.signal?.aborted || getSettings.subagentRuntime?.().deliveryFenceReady === false)
|
|
28
|
+
return assembled;
|
|
29
|
+
const settings = getSettings(agent);
|
|
30
|
+
if (!settings.modules.deepwork.enabled || !controller.active(agent, settings.defaultActive))
|
|
31
|
+
return assembled;
|
|
32
|
+
const roleId = resolveAdmittedDsmmRole(agent, settings, true) ?? null;
|
|
33
|
+
const model = assembled.variables.model ?? agent.options?.model;
|
|
34
|
+
const provider = assembled.variables.provider ?? agent.options?.provider;
|
|
35
|
+
const route = model && provider ? { model, provider } : undefined;
|
|
36
|
+
for (const section of assembled.sections) {
|
|
37
|
+
if (section.name === "dsmm:deepwork")
|
|
38
|
+
section.text = buildDeepworkPrompt(settings, { route, roleId, overrideSection: config.section });
|
|
39
|
+
else if (roleId === null && section.name === "harness:identity")
|
|
40
|
+
section.text = "You are an AI assistant.";
|
|
41
|
+
else if (roleId === null && section.name === "deployment:persona-prefix" && section.interpolate !== false) {
|
|
42
|
+
section.text = section.text.replace("You are a coding agent powered by the {{model}} model.", "").trim();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return assembled;
|
|
46
|
+
}, { prepend: true });
|
|
38
47
|
bindings.set(agent, reconcile);
|
|
39
|
-
const retire = () => { dispose?.(); bindings.delete(agent); lifetime.removeEventListener("abort", retire); };
|
|
48
|
+
const retire = () => { stopAssembly(); dispose?.(); bindings.delete(agent); lifetime.removeEventListener("abort", retire); };
|
|
40
49
|
lifetime.addEventListener("abort", retire, { once: true });
|
|
41
50
|
ctx.effect(() => retire);
|
|
42
51
|
reconcile();
|
package/lib/model-family.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type DsmmModelFamily = "gpt" | "codex" | "claude" | "gemini" | "glm" | "kimi" | "deepseek" | "unknown";
|
|
2
|
-
type ModelIdentifier = Exclude<DsmmModelFamily, "unknown"> | "swe
|
|
2
|
+
type ModelIdentifier = Exclude<DsmmModelFamily, "unknown"> | "swe";
|
|
3
3
|
type ModelSeries = "opus" | "sonnet" | "haiku" | "sol" | "terra" | "astra" | "luna";
|
|
4
4
|
interface ModelNameRecognition {
|
|
5
5
|
identifier: ModelIdentifier;
|
|
@@ -7,8 +7,10 @@ interface ModelNameRecognition {
|
|
|
7
7
|
series: ModelSeries | undefined;
|
|
8
8
|
version: readonly [number, number, number] | undefined;
|
|
9
9
|
versionParts: number | undefined;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
fable52OrLater: boolean;
|
|
11
|
+
opus5OrLater: boolean;
|
|
12
|
+
gemini4OrLater: boolean;
|
|
13
|
+
swe2OrLater: boolean;
|
|
12
14
|
}
|
|
13
15
|
/** Model fields are complete names here; route owners separate provider metadata. */
|
|
14
16
|
export declare function recognizeModelName(model: string, options?: {
|
package/lib/model-family.js
CHANGED
|
@@ -59,26 +59,28 @@ function readVersion(name, start, family, kimiPVersion = false) {
|
|
|
59
59
|
function identifierFor(marker) {
|
|
60
60
|
if (marker.startsWith("k2"))
|
|
61
61
|
return "kimi";
|
|
62
|
-
if (marker.startsWith("swe"))
|
|
63
|
-
return "swe-2";
|
|
64
62
|
if (marker === "chatgpt")
|
|
65
63
|
return "gpt";
|
|
66
|
-
if (marker === "fable")
|
|
64
|
+
if (marker === "fable" || marker === "mythos")
|
|
67
65
|
return "claude";
|
|
68
66
|
return marker;
|
|
69
67
|
}
|
|
70
68
|
/** Model fields are complete names here; route owners separate provider metadata. */
|
|
71
69
|
export function recognizeModelName(model, options = {}) {
|
|
72
70
|
const name = model.trim().toLowerCase();
|
|
73
|
-
const markers = name.matchAll(/(?<![a-z0-9])(?:(?:chatgpt|gpt|codex|claude|fable|gemini|glm|deepseek|kimi|opus|sonnet|haiku|sol|terra|astra|luna)(?=\d|[^a-z0-9]|$)|(?:k2[-_.\s/]*p[5-8]|swe
|
|
71
|
+
const markers = name.matchAll(/(?<![a-z0-9])(?:(?:chatgpt|gpt|codex|claude|fable|mythos|gemini|glm|deepseek|kimi|opus|sonnet|haiku|sol|terra|astra|luna)(?=\d|[^a-z0-9]|$)|(?:k2[-_.\s/]*p[5-8]|swe)(?![a-z0-9])|k(?=\d)|\d+)/gu);
|
|
74
72
|
let first;
|
|
75
73
|
let consumedEnd = 0;
|
|
76
74
|
for (const marker of markers) {
|
|
77
|
-
if (marker.index < consumedEnd)
|
|
75
|
+
if (marker.index < consumedEnd || marker[0] === "mythos" && !options.promptAliases)
|
|
76
|
+
continue;
|
|
77
|
+
// Outside prompt selection, only the historical SWE-2 marker participates in classification.
|
|
78
|
+
if (marker[0] === "swe" && !options.promptAliases && !/^[-_.\s/]+2(?![a-z0-9])/u.test(name.slice(marker.index + marker[0].length)))
|
|
78
79
|
continue;
|
|
79
80
|
let identifier;
|
|
80
81
|
let parsed;
|
|
81
|
-
let
|
|
82
|
+
let geminiWildcardMajor;
|
|
83
|
+
let fable = options.promptAliases === true && (marker[0] === "fable" || marker[0] === "mythos");
|
|
82
84
|
let series = seriesAt(name, marker.index);
|
|
83
85
|
if (marker[0] === "k") {
|
|
84
86
|
if (!options.promptAliases || marker.index > 0 && name[marker.index - 1] !== "/")
|
|
@@ -112,17 +114,27 @@ export function recognizeModelName(model, options = {}) {
|
|
|
112
114
|
const kimiKVersion = options.promptAliases && identifier === "kimi" && /^k(?=\d)/u.test(name.slice(start));
|
|
113
115
|
if (kimiKVersion)
|
|
114
116
|
start++;
|
|
115
|
-
|
|
117
|
+
const claudeAlias = options.promptAliases && marker[0] === "claude" && /^(?:fable|mythos)(?=\d|[^a-z0-9]|$)/u.exec(name.slice(start));
|
|
118
|
+
if (claudeAlias) {
|
|
119
|
+
fable = true;
|
|
120
|
+
start = skipSeparators(name, start + claudeAlias[0].length);
|
|
121
|
+
}
|
|
122
|
+
series = !fable && start > markerEnd ? seriesAt(name, start, identifier) : undefined;
|
|
116
123
|
if (series !== undefined)
|
|
117
124
|
start = skipSeparators(name, start + series.length);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
125
|
+
const wildcard = identifier === "gemini" && /^(\d+)\.x/u.exec(name.slice(start));
|
|
126
|
+
if (wildcard && (options.promptAliases || wildcard[1] === "4")) {
|
|
127
|
+
const end = start + wildcard[0].length;
|
|
128
|
+
const major = Number(wildcard[1]);
|
|
129
|
+
if (Number.isSafeInteger(major) && !suffixNumber(wildcard[1]) && /^(?:$|[-_.\s/@:])/u.test(name.slice(end))
|
|
130
|
+
&& !versionStartsAt(name, skipSeparators(name, end))) {
|
|
131
|
+
geminiWildcardMajor = major;
|
|
132
|
+
}
|
|
121
133
|
parsed = { version: undefined, versionParts: undefined, series: undefined, end };
|
|
122
134
|
}
|
|
123
135
|
else {
|
|
124
|
-
const
|
|
125
|
-
parsed = start === markerEnd && identifier !== "gpt" && !
|
|
136
|
+
const compactGemini = identifier === "gemini" && (options.promptAliases || /^4(?=[^a-z0-9]|$)/u.test(name.slice(start)));
|
|
137
|
+
parsed = start === markerEnd && identifier !== "gpt" && !compactGemini && !fable
|
|
126
138
|
? { version: undefined, versionParts: undefined, series: undefined, end: markerEnd }
|
|
127
139
|
: readVersion(name, start, identifier, options.promptAliases && identifier === "kimi");
|
|
128
140
|
}
|
|
@@ -138,11 +150,14 @@ export function recognizeModelName(model, options = {}) {
|
|
|
138
150
|
consumedEnd = parsed.end;
|
|
139
151
|
continue;
|
|
140
152
|
}
|
|
141
|
-
const family = identifier === "swe
|
|
153
|
+
const family = identifier === "swe" || /^k2[-_.\s/]*p8$/u.test(marker[0]) ? "unknown" : identifier;
|
|
154
|
+
const version = /^\.x/u.test(name.slice(parsed.end)) ? undefined : parsed.version;
|
|
142
155
|
first = {
|
|
143
156
|
identifier, family, series, version: parsed.version, versionParts: parsed.versionParts,
|
|
144
|
-
|
|
145
|
-
|
|
157
|
+
fable52OrLater: fable && version !== undefined && (version[0] > 5 || version[0] === 5 && version[1] >= 2),
|
|
158
|
+
opus5OrLater: !fable && series === "opus" && (version?.[0] ?? 0) >= 5,
|
|
159
|
+
gemini4OrLater: identifier === "gemini" && (geminiWildcardMajor ?? version?.[0] ?? 0) >= 4,
|
|
160
|
+
swe2OrLater: identifier === "swe" && (version?.[0] ?? 0) >= 2
|
|
146
161
|
};
|
|
147
162
|
consumedEnd = parsed.end;
|
|
148
163
|
}
|
|
@@ -2,8 +2,15 @@ import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
|
2
2
|
import type { SessionId } from "@deepseek-ai/dsh-session";
|
|
3
3
|
import type { SubagentActivation, SubagentCatalogEntry, SubagentDescendantListEntry, SubagentInterruptReceipt, SubagentPromptReceipt, SubagentPromptRequest, SubagentRuntime } from "@deepseek-ai/dsh-subagent";
|
|
4
4
|
type ActivationSpec = Parameters<SubagentRuntime["startActivation"]>[0];
|
|
5
|
+
type AddressedActivation = SubagentActivation & {
|
|
6
|
+
readonly name?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function supportsNativeNames(runtime: SubagentRuntime): boolean;
|
|
5
9
|
/** Native tree runtimes accept task fields directly on the activation specification. */
|
|
6
|
-
export declare function startNativeActivation(runtime: SubagentRuntime, spec: ActivationSpec
|
|
10
|
+
export declare function startNativeActivation(runtime: SubagentRuntime, spec: ActivationSpec, naming?: {
|
|
11
|
+
role: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
}): Promise<AddressedActivation>;
|
|
7
14
|
export type NativeChildEntry = Pick<SubagentCatalogEntry, "id" | "mode"> & {
|
|
8
15
|
readonly label?: string;
|
|
9
16
|
};
|
package/lib/native-subagents.js
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
|
+
const childOrdinals = new WeakMap();
|
|
2
|
+
export function supportsNativeNames(runtime) {
|
|
3
|
+
return "namesOf" in runtime && typeof runtime.namesOf === "function" && "resolveName" in runtime && typeof runtime.resolveName === "function";
|
|
4
|
+
}
|
|
1
5
|
/** Native tree runtimes accept task fields directly on the activation specification. */
|
|
2
|
-
export function startNativeActivation(runtime, spec) {
|
|
6
|
+
export async function startNativeActivation(runtime, spec, naming) {
|
|
3
7
|
if (typeof runtime.rootOf !== "function")
|
|
4
8
|
return runtime.startActivation(spec);
|
|
5
9
|
const { request, ...activation } = spec;
|
|
6
|
-
|
|
10
|
+
const tree = runtime;
|
|
11
|
+
const flat = { ...request, ...activation };
|
|
12
|
+
if (!naming)
|
|
13
|
+
return tree.startActivation(flat);
|
|
14
|
+
if (naming.name !== undefined)
|
|
15
|
+
return tree.startActivation({ ...flat, name: naming.name });
|
|
16
|
+
const parent = request.parent;
|
|
17
|
+
for (;;) {
|
|
18
|
+
spec.signal.throwIfAborted();
|
|
19
|
+
const ordinal = (childOrdinals.get(parent) ?? parent.session.snapshotEvents().slice(parent.session.inheritedEventCount).filter(event => event.type === "subagent/catalog").length) + 1;
|
|
20
|
+
childOrdinals.set(parent, ordinal);
|
|
21
|
+
try {
|
|
22
|
+
return await tree.startActivation({ ...flat, name: `${naming.role}-${ordinal}` });
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
// Only a rejected name reservation precedes child startup; never replay an ambiguous start.
|
|
26
|
+
if (!(error instanceof Error && "code" in error && error.code === "DUPLICATE_AGENT_NAME"))
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
7
30
|
}
|
|
8
31
|
/** Discover direct catalog membership without loading or resuming a child. */
|
|
9
32
|
export async function listNativeChildren(runtime, parentId, signal) {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import type { PermissionControlSettings } from "./permission-settings.js";
|
|
3
|
+
export declare const nativeCommandMatchSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
4
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
5
|
+
workingDirectory: z<string, string, "defined">;
|
|
6
|
+
commandPattern: z<string, string, "defined">;
|
|
7
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
8
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
9
|
+
workingDirectory: z<string, string, "defined">;
|
|
10
|
+
commandPattern: z<string, string, "defined">;
|
|
11
|
+
}>>, "defined">;
|
|
12
|
+
export declare const nativeCommandEntrySchema: z<Schemastery.ObjectS<NoInfer<{
|
|
13
|
+
id: z<string, string, "defined">;
|
|
14
|
+
mode: z<"allow" | "ask", "allow" | "ask", "defined">;
|
|
15
|
+
match: z<Schemastery.ObjectS<NoInfer<{
|
|
16
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
17
|
+
workingDirectory: z<string, string, "defined">;
|
|
18
|
+
commandPattern: z<string, string, "defined">;
|
|
19
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
20
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
21
|
+
workingDirectory: z<string, string, "defined">;
|
|
22
|
+
commandPattern: z<string, string, "defined">;
|
|
23
|
+
}>>, "defined">;
|
|
24
|
+
sandboxMode: z<"workspace-write" | "danger-full-access", "workspace-write" | "danger-full-access", "defined">;
|
|
25
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
26
|
+
id: z<string, string, "defined">;
|
|
27
|
+
mode: z<"allow" | "ask", "allow" | "ask", "defined">;
|
|
28
|
+
match: z<Schemastery.ObjectS<NoInfer<{
|
|
29
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
30
|
+
workingDirectory: z<string, string, "defined">;
|
|
31
|
+
commandPattern: z<string, string, "defined">;
|
|
32
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
33
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
34
|
+
workingDirectory: z<string, string, "defined">;
|
|
35
|
+
commandPattern: z<string, string, "defined">;
|
|
36
|
+
}>>, "defined">;
|
|
37
|
+
sandboxMode: z<"workspace-write" | "danger-full-access", "workspace-write" | "danger-full-access", "defined">;
|
|
38
|
+
}>>, "defined">;
|
|
39
|
+
export declare const permissionControlSchema: z<PermissionControlSettings>;
|
|
40
|
+
//# sourceMappingURL=permission-schema.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { parseNativeCommands } from "./permission-settings.js";
|
|
3
|
+
import { parsePermissionRules } from "./permission-rules.js";
|
|
4
|
+
export const nativeCommandMatchSchema = z.object({ tool: z.union(["bash", "pwsh"]).required(), workingDirectory: z.string().required(), commandPattern: z.string().required() }).required();
|
|
5
|
+
export const nativeCommandEntrySchema = z.object({
|
|
6
|
+
id: z.string().required(), mode: z.union(["ask", "allow"]).required(), match: nativeCommandMatchSchema, sandboxMode: z.union(["workspace-write", "danger-full-access"]).required(),
|
|
7
|
+
}).required();
|
|
8
|
+
const nativeCommands = z.object({ enabled: z.boolean().default(false), entries: z.array(z.union([z.string(), nativeCommandEntrySchema])).default([]) });
|
|
9
|
+
const action = () => z.union(["inherit", "allow", "ask", "deny"]).default("inherit");
|
|
10
|
+
const web = () => z.object({ enabled: z.boolean().default(true), rule: action() }).default({});
|
|
11
|
+
export const permissionControlSchema = z.transform(z.object({ enabled: z.boolean().default(true), outsideReads: action(), webSearch: web(), webFetch: web(),
|
|
12
|
+
nativeCommands, rules: z.array(z.any()).default([]) }), input => Object.freeze({ ...input, webSearch: Object.freeze(input.webSearch), webFetch: Object.freeze(input.webFetch), rules: parsePermissionRules(input.rules), nativeCommands: parseNativeCommands(input.nativeCommands) }), true);
|
|
13
|
+
//# sourceMappingURL=permission-schema.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import z from "@deepseek-ai/schemastery";
|
|
2
1
|
import type { PermissionRule } from "./permission-rules.js";
|
|
3
2
|
export type PermissionRuleAction = "inherit" | "allow" | "ask" | "deny";
|
|
4
3
|
export interface PermissionWebPolicy {
|
|
@@ -47,43 +46,6 @@ export declare function parseNativeCommandPattern(input: unknown): NativeCommand
|
|
|
47
46
|
/** Literal token prefixes; only the second token may contain alternatives. */
|
|
48
47
|
export declare function parseSimpleCommandPattern(input: unknown): readonly (readonly string[])[];
|
|
49
48
|
export declare function parseNativeCommands(input?: unknown): NativeCommandsSettings;
|
|
50
|
-
export declare const nativeCommandMatchSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
51
|
-
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
52
|
-
workingDirectory: z<string, string, "defined">;
|
|
53
|
-
commandPattern: z<string, string, "defined">;
|
|
54
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
55
|
-
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
56
|
-
workingDirectory: z<string, string, "defined">;
|
|
57
|
-
commandPattern: z<string, string, "defined">;
|
|
58
|
-
}>>, "defined">;
|
|
59
|
-
export declare const nativeCommandEntrySchema: z<Schemastery.ObjectS<NoInfer<{
|
|
60
|
-
id: z<string, string, "defined">;
|
|
61
|
-
mode: z<"allow" | "ask", "allow" | "ask", "defined">;
|
|
62
|
-
match: z<Schemastery.ObjectS<NoInfer<{
|
|
63
|
-
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
64
|
-
workingDirectory: z<string, string, "defined">;
|
|
65
|
-
commandPattern: z<string, string, "defined">;
|
|
66
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
67
|
-
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
68
|
-
workingDirectory: z<string, string, "defined">;
|
|
69
|
-
commandPattern: z<string, string, "defined">;
|
|
70
|
-
}>>, "defined">;
|
|
71
|
-
sandboxMode: z<"workspace-write" | "danger-full-access", "workspace-write" | "danger-full-access", "defined">;
|
|
72
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
73
|
-
id: z<string, string, "defined">;
|
|
74
|
-
mode: z<"allow" | "ask", "allow" | "ask", "defined">;
|
|
75
|
-
match: z<Schemastery.ObjectS<NoInfer<{
|
|
76
|
-
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
77
|
-
workingDirectory: z<string, string, "defined">;
|
|
78
|
-
commandPattern: z<string, string, "defined">;
|
|
79
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
80
|
-
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
81
|
-
workingDirectory: z<string, string, "defined">;
|
|
82
|
-
commandPattern: z<string, string, "defined">;
|
|
83
|
-
}>>, "defined">;
|
|
84
|
-
sandboxMode: z<"workspace-write" | "danger-full-access", "workspace-write" | "danger-full-access", "defined">;
|
|
85
|
-
}>>, "defined">;
|
|
86
49
|
export declare const DEFAULT_PERMISSION_CONTROL: PermissionControlSettings;
|
|
87
|
-
export declare const permissionControlSchema: z<PermissionControlSettings>;
|
|
88
50
|
export declare function resolvePermissionControl(input?: PermissionControlSchemaInput): PermissionControlSettings;
|
|
89
51
|
//# sourceMappingURL=permission-settings.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import z from "@deepseek-ai/schemastery";
|
|
2
1
|
import { parsePermissionRules, permissionRuleRow } from "./permission-rules.js";
|
|
3
2
|
import { PermissionRefusal } from "./permission-errors.js";
|
|
4
3
|
/** Bounded static prefix grammar; the optional final star always denotes the whole argv tail. */
|
|
@@ -57,25 +56,31 @@ export function parseNativeCommands(input = {}) {
|
|
|
57
56
|
});
|
|
58
57
|
return Object.freeze({ enabled: row.enabled ?? false, entries: Object.freeze(entries) });
|
|
59
58
|
}
|
|
60
|
-
export const nativeCommandMatchSchema = z.object({ tool: z.union(["bash", "pwsh"]).required(), workingDirectory: z.string().required(), commandPattern: z.string().required() }).required();
|
|
61
|
-
export const nativeCommandEntrySchema = z.object({
|
|
62
|
-
id: z.string().required(), mode: z.union(["ask", "allow"]).required(), match: nativeCommandMatchSchema, sandboxMode: z.union(["workspace-write", "danger-full-access"]).required(),
|
|
63
|
-
}).required();
|
|
64
|
-
const nativeCommands = z.object({ enabled: z.boolean().default(false), entries: z.array(z.union([z.string(), nativeCommandEntrySchema])).default([]) });
|
|
65
59
|
const webDefault = Object.freeze({ enabled: true, rule: "inherit" });
|
|
66
60
|
export const DEFAULT_PERMISSION_CONTROL = Object.freeze({ enabled: true, outsideReads: "inherit", webSearch: webDefault, webFetch: webDefault, rules: Object.freeze([]), nativeCommands: parseNativeCommands() });
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
function enabled(value) {
|
|
62
|
+
if (value == null)
|
|
63
|
+
return true;
|
|
64
|
+
if (typeof value === "boolean")
|
|
65
|
+
return value;
|
|
66
|
+
throw new PermissionRefusal("validation");
|
|
67
|
+
}
|
|
68
|
+
function action(value) {
|
|
69
|
+
if (value == null)
|
|
70
|
+
return "inherit";
|
|
71
|
+
if (value === "inherit" || value === "allow" || value === "ask" || value === "deny")
|
|
72
|
+
return value;
|
|
73
|
+
throw new PermissionRefusal("validation");
|
|
74
|
+
}
|
|
75
|
+
function webPolicy(input) {
|
|
76
|
+
if (input === undefined)
|
|
77
|
+
return webDefault;
|
|
78
|
+
const row = permissionRuleRow(input, [], ["enabled", "rule"]);
|
|
79
|
+
return Object.freeze({ enabled: enabled(row.enabled), rule: action(row.rule) });
|
|
80
|
+
}
|
|
71
81
|
export function resolvePermissionControl(input = {}) {
|
|
72
|
-
permissionRuleRow(input, [], ["enabled", "outsideReads", "webSearch", "webFetch", "rules", "nativeCommands"]);
|
|
73
|
-
|
|
74
|
-
parseNativeCommands(
|
|
75
|
-
for (const web of [input.webSearch, input.webFetch])
|
|
76
|
-
if (web !== undefined)
|
|
77
|
-
permissionRuleRow(web, [], ["enabled", "rule"]);
|
|
78
|
-
const parsed = permissionControlSchema(input);
|
|
79
|
-
return Object.freeze({ ...parsed, webSearch: Object.freeze(parsed.webSearch), webFetch: Object.freeze(parsed.webFetch), rules: parsePermissionRules(parsed.rules) });
|
|
82
|
+
const row = permissionRuleRow(input, [], ["enabled", "outsideReads", "webSearch", "webFetch", "rules", "nativeCommands"]);
|
|
83
|
+
return Object.freeze({ enabled: enabled(row.enabled), outsideReads: action(row.outsideReads), webSearch: webPolicy(row.webSearch),
|
|
84
|
+
webFetch: webPolicy(row.webFetch), rules: parsePermissionRules(row.rules ?? []), nativeCommands: parseNativeCommands(row.nativeCommands) });
|
|
80
85
|
}
|
|
81
86
|
//# sourceMappingURL=permission-settings.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { findNodeAtLocation, parseTree } from "jsonc-parser";
|
|
2
2
|
import { DSMM_RATE_LIMIT_BOUNDS } from "./routing-policy.js";
|
|
3
|
-
import { permissionControlSchema } from "./permission-settings.js";
|
|
4
3
|
export const PROFILE_DIAGNOSTIC_REASONS = {
|
|
5
4
|
"invalid-jsonc": "Use one valid document with supported JSON syntax.",
|
|
6
5
|
"duplicate-field": "Remove the duplicate field.",
|
|
@@ -15,15 +14,6 @@ export const PROFILE_DIAGNOSTIC_REASONS = {
|
|
|
15
14
|
"blank-label": "The label is blank; the profile ID is used for display."
|
|
16
15
|
};
|
|
17
16
|
export const DEPRECATED_DSMM_FIELDS = ["deepseekV4ProMaxReasoningPresets", "deepseekFlashMaxReasoningPresets", "deepseekV4ProCalibration", "deepseekV4ProDefaultReasoningEffort", "deepseekFlashCalibration", "deepseekFlashDefaultReasoningEffort"];
|
|
18
|
-
function schemaFieldShape(schema) {
|
|
19
|
-
if (schema.type === "transform")
|
|
20
|
-
return schemaFieldShape(schema.inner);
|
|
21
|
-
if (schema.type === "object")
|
|
22
|
-
return Object.fromEntries(Object.entries(schema.dict ?? {}).map(([key, child]) => [key, schemaFieldShape(child)]));
|
|
23
|
-
if (schema.type === "array")
|
|
24
|
-
return [schemaFieldShape(schema.inner)];
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
17
|
// Closed wire grammar: dynamic role/skill names are declared identifiers, not arbitrary object keys.
|
|
28
18
|
const roleId = /^dsmm-(?:orchestrator|planner|plan-critic|builder|reviewer|oracle|oracle-2nd|creative|code-search|doc-search|clarifier|media-reader|frontend|hard-reasoning|research|quick|coding|normal-task|complex|deep|documenting|cross-cutting)$/u;
|
|
29
19
|
const skillId = /^(?:brainstorming|writing-plans|requesting-code-review|receiving-code-review|subagent-driven-development|dispatching-parallel-agents|avoid-ai-slop|remove-ai-slops|debugging|frontend|git-master|ast-grep|coding-agent-sessions|init-deep|using-git-worktrees|report-fidelity)$/u;
|
|
@@ -31,7 +21,7 @@ const route = { provider: null, model: null, reasoningEffort: null };
|
|
|
31
21
|
const rateLimit = Object.fromEntries(Object.keys(DSMM_RATE_LIMIT_BOUNDS).map(key => [key, null]));
|
|
32
22
|
const roleRouting = { primary: route, fallbackRoutes: [route], strategy: null, rateLimit, levels: { low: route, high: route, max: route } };
|
|
33
23
|
const configFields = {
|
|
34
|
-
permissionControl:
|
|
24
|
+
permissionControl: { enabled: null, outsideReads: null, webSearch: { enabled: null, rule: null }, webFetch: { enabled: null, rule: null }, rules: [null], nativeCommands: { enabled: null, entries: [null] } },
|
|
35
25
|
modelParameters: { passthrough: null },
|
|
36
26
|
rootModelPolicy: null,
|
|
37
27
|
locale: null, modeName: null, section: null, defaultActive: null, promptOrder: null,
|
package/lib/prompts.js
CHANGED
|
@@ -7,18 +7,45 @@ const activation = `<dsmm-deepwork-mode>
|
|
|
7
7
|
Use this workflow only while the \`{{modeName}}\` mode is effectively active. This is an opt-in boundary: ordinary presets default off; DW roles default on, but explicit off wins and retains only persona/access. Never force common workflow or skills on merely from a role name.
|
|
8
8
|
\`workflow.policy=risk-based\` follows the source workflow below. Explicit \`workflow.policy=legacy\` retains the configured \`strictGates\`, \`reviewCap\` and \`finalReviewPolicy\` gates; it is compatibility policy, not extra authorization. Role scope, output and terminal delegation policy are authoritative over all workflow/model guidance.
|
|
9
9
|
Skills are native metadata and lazy bodies, never automatically injected. Load matching skills only through the actual native skill catalog. Treat \`[dsmm safety]\` messages as binding feedback. Implementing does not authorize a commit; a commit does not authorize push/tag/rebase/release.
|
|
10
|
-
Understand the requested outcome and relevant facts first. Load the full \`brainstorming\` skill through the native catalog when
|
|
10
|
+
Understand the requested outcome and relevant facts first. Load the full \`brainstorming\` skill through the native catalog when an unresolved requirement or design choice materially affects a software change. Development workflow skills apply only at the corresponding engineering stage; use domain skills directly for other tasks. Ask only for a material scope, acceptance, security, data, API/protocol, permission or irreversible-action decision, missing input that would materially change delivery, or an explicit checkpoint. Role-first boundaries and orchestrator-owned planner/critic responsibilities remain unchanged.
|
|
11
11
|
</dsmm-deepwork-mode>`;
|
|
12
12
|
const commonDeepworkPrompt = [activation, asset("deepwork/default.md"), asset("shared/shell-safety.md")].join("\n\n---\n\n");
|
|
13
13
|
export const BASE_DEEPWORK_PROMPT = [commonDeepworkPrompt, readSharedPromptAsset("avoid-ai-slop.md")].join("\n\n---\n\n");
|
|
14
|
+
function kimiVariant(version) {
|
|
15
|
+
return version !== undefined && (version[0] > 3 || version[0] === 3 && version[1] >= 1) ? "kimi-k3-1" : "kimi";
|
|
16
|
+
}
|
|
17
|
+
function generalModelCalibration(model) {
|
|
18
|
+
const recognized = recognizeModelName(model, { promptAliases: true });
|
|
19
|
+
switch (recognized?.identifier) {
|
|
20
|
+
case "gpt":
|
|
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.";
|
|
23
|
+
case "gemini":
|
|
24
|
+
return recognized.gemini4OrLater
|
|
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."
|
|
26
|
+
: "Deliver the full requested result without adjacent cleanup or speculative additions. Keep explanations separate from changes the user asked you to make.";
|
|
27
|
+
case "glm":
|
|
28
|
+
return "Answer once the evidence settles the question. Put the conclusion first, followed by the facts that support it and any gap that changes the answer.";
|
|
29
|
+
case "kimi":
|
|
30
|
+
return kimiVariant(recognized.version) === "kimi-k3-1"
|
|
31
|
+
? "Carry the user's latest choice through to an observable result. Keep unrelated defects outside the change, and name any requested part that remains unfinished."
|
|
32
|
+
: "Once the evidence settles the next in-scope action, take it rather than comparing equivalent approaches again. Reopen the decision only if a new fact matters.";
|
|
33
|
+
case "swe":
|
|
34
|
+
return recognized.swe2OrLater ? "Use the failing case or interface contract to choose the next change. When that choice is settled, carry it out and report what happened rather than promising to act." : "";
|
|
35
|
+
case "claude":
|
|
36
|
+
if (recognized.fable52OrLater)
|
|
37
|
+
return "Complete the parts of the request that are still feasible. If one part is blocked, deliver the independent results and identify the specific blocker instead of ending with a checklist.";
|
|
38
|
+
if (recognized.opus5OrLater)
|
|
39
|
+
return "Keep the result bounded by the request. Reuse evidence that still applies, and report the outcome without extra polish or repeated checks.";
|
|
40
|
+
}
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
14
43
|
export function promptModelVariants(role, model) {
|
|
15
44
|
const recognized = recognizeModelName(model, { promptAliases: true });
|
|
16
45
|
const identifier = recognized?.identifier;
|
|
17
46
|
const gpt = identifier === "gpt" || identifier === "codex";
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const additive = gpt ? ["gpt"] : identifier === "kimi" ? [kimi] : recognized?.gemini4 ? ["gemini-4"] : identifier === "swe-2" ? ["swe-2"] : [];
|
|
21
|
-
const base = role === "planner" ? "planner" : role === "orchestrator" && recognized?.opus5 ? "claude-opus-5"
|
|
47
|
+
const additive = recognized?.fable52OrLater ? ["claude-fable-5-2"] : gpt ? ["gpt"] : recognized?.identifier === "kimi" ? [kimiVariant(recognized.version)] : recognized?.gemini4OrLater ? ["gemini-4"] : recognized?.swe2OrLater ? ["swe-2"] : [];
|
|
48
|
+
const base = role === "planner" ? "planner" : role === "orchestrator" && recognized?.opus5OrLater ? "claude-opus-5"
|
|
22
49
|
: recognized?.family === "codex" ? "codex" : gpt ? "gpt" : identifier === "gemini" ? "gemini" : identifier === "glm" ? "glm" : "default";
|
|
23
50
|
return [...new Set([base, ...additive])].filter((variant) => variant !== "default");
|
|
24
51
|
}
|
|
@@ -32,7 +59,7 @@ export function roleModelCalibration(role, model) {
|
|
|
32
59
|
: identifier === "gemini" || identifier === "glm" || identifier === "claude" ? identifier : "unknown";
|
|
33
60
|
// Categories carry only their own family layer + additive model calibration,
|
|
34
61
|
// not the base-agent Gemini/GLM/planner workflow variants.
|
|
35
|
-
return [category.calibrations.get(family), ...layers.filter((_layer, index) => ["gpt", "kimi", "kimi-k3-1", "gemini-4", "swe-2"].includes(variants[index]))].filter(Boolean).join("\n\n---\n\n");
|
|
62
|
+
return [category.calibrations.get(family), ...layers.filter((_layer, index) => ["gpt", "kimi", "kimi-k3-1", "gemini-4", "swe-2", "claude-fable-5-2"].includes(variants[index]))].filter(Boolean).join("\n\n---\n\n");
|
|
36
63
|
}
|
|
37
64
|
return layers.join("\n\n---\n\n");
|
|
38
65
|
}
|
|
@@ -124,8 +151,11 @@ export function buildDeepworkPrompt(settings, options = {}) {
|
|
|
124
151
|
const role = SOURCE_ROLE_CATALOG.find((role) => role.id === (options.roleId === undefined ? options.selectedPreset : options.roleId));
|
|
125
152
|
const common = role === undefined ? [asset("deepwork/general.md"), asset("shared/shell-safety.md")].join("\n\n---\n\n")
|
|
126
153
|
: [activation, asset("deepwork/default.md")].join("\n\n---\n\n");
|
|
127
|
-
const
|
|
128
|
-
const
|
|
154
|
+
const model = options.route?.model ?? "";
|
|
155
|
+
const family = role === undefined ? generalModelCalibration(model) : roleModelCalibration(role, model);
|
|
156
|
+
const calibration = family === "" ? "" : role === undefined ? `<model-behavior-calibration>\n${family}\n</model-behavior-calibration>`
|
|
157
|
+
: `<workflow-model-calibration>\nThe role prompt is authoritative for scope, permissions and output. Model calibration never grants tools or changes the native route.\n\n${family}\n</workflow-model-calibration>`;
|
|
158
|
+
const base = [options.overrideSection?.trim() || common, settings.skills["avoid-ai-slop"] ? readSharedPromptAsset("avoid-ai-slop.md") : "", calibration].filter(Boolean).join("\n\n---\n\n").replaceAll("{{modeName}}", settings.modeName);
|
|
129
159
|
const workflowPolicy = settings.workflow.policy === "legacy" ? `<dsmm-workflow-policy>
|
|
130
160
|
policy: legacy
|
|
131
161
|
strictGates: ${String(settings.workflow.strictGates)}
|
package/lib/role-subagents.js
CHANGED
|
@@ -13,7 +13,7 @@ import { agentForScope, nativeAgentContext, scopeParentOf } from "./native-scope
|
|
|
13
13
|
import { roleRouteRuntimeState } from "./role-routing.js";
|
|
14
14
|
import { modelRouteFromCall } from "./role-llm.js";
|
|
15
15
|
import { buildDsmmDelegationGuidance, buildDsmmTeamGuidance } from "./prompts.js";
|
|
16
|
-
import { startNativeActivation } from "./native-subagents.js";
|
|
16
|
+
import { startNativeActivation, supportsNativeNames } from "./native-subagents.js";
|
|
17
17
|
// Conditional Team tools stay in their native layer: copying a definition would discard its `when` registration.
|
|
18
18
|
const hostControls = ["send_message", "interrupt_agent", "list_agents", "wait_agent", "exit_plan_mode", "ask_user_question", "todo_write", "job_output", "job_list", "job_kill"];
|
|
19
19
|
// Agent-owned policy realms survive a bundle reinstall; do not register another
|
|
@@ -137,6 +137,7 @@ function registerRoleTool(agent, agentCtx, tools, entry, getSettings, policy, ad
|
|
|
137
137
|
const subagents = agentCtx.get("subagents");
|
|
138
138
|
if (subagents === undefined)
|
|
139
139
|
throw new Error("DSMM role tools require native subagents");
|
|
140
|
+
const named = supportsNativeNames(subagents);
|
|
140
141
|
const forcedBackground = settings.subagents.forceBackground;
|
|
141
142
|
const background = settings.subagents.enableRunInBackground || forcedBackground;
|
|
142
143
|
const admittedProviders = new Map(entry.targets.map(target => [target, subagents.getProvider(roleProviderName(target))]));
|
|
@@ -145,6 +146,7 @@ function registerRoleTool(agent, agentCtx, tools, entry, getSettings, policy, ad
|
|
|
145
146
|
name: entry.name, description: `Delegate a bounded ${entry.kind} task through native activation.${forcedBackground ? " Deployment forces background parent delivery even when run_in_background is omitted or false. Returns an accepted child/message receipt; native completion notifies the parent." : ` Waits for the useful result by default.${background ? " Set run_in_background to receive an accepted child/message receipt; native completion notifies the parent." : " Background execution is disabled."}`}`,
|
|
146
147
|
isConcurrencySafe: () => true,
|
|
147
148
|
parameters: { description: { type: "string", required: true }, prompt: { type: "string", required: true },
|
|
149
|
+
...(named ? { name: { type: "string", description: "Optional sibling name, e.g. review-api. Use 1–32 lowercase letters, digits or hyphens starting with a letter (except lead). Defaults to role-number." } } : {}),
|
|
148
150
|
...(entry.targetParameter === undefined ? {} : { [entry.targetParameter]: { type: "string", enum: entry.targets, required: true } }),
|
|
149
151
|
level: { type: "string", enum: ["normal", "low", "high", "max"] },
|
|
150
152
|
...(settings.subagents.allowRouteOverride ? { route: { oneOf: [
|
|
@@ -157,8 +159,8 @@ function registerRoleTool(agent, agentCtx, tools, entry, getSettings, policy, ad
|
|
|
157
159
|
const invocation = result.invocation;
|
|
158
160
|
const route = invocation?.route;
|
|
159
161
|
const metadata = invocation === undefined ? "" : `${invocation.role} level=${invocation.level}${route === undefined ? "" : ` route=${route.provider}/${route.model}${route.reasoningEffort === undefined ? "" : ` effort=${route.reasoningEffort}`}`}`;
|
|
160
|
-
return result.kind === "foreground" ? [{ type: "text", text: metadata }, ...result.output ?? []]
|
|
161
|
-
: [{ type: "text", text: `${metadata}\naccepted subagent ${result.subagentId}` }];
|
|
162
|
+
return result.kind === "foreground" ? [{ type: "text", text: result.name ? `${metadata}\nsubagent ${result.name}` : metadata }, ...result.output ?? []]
|
|
163
|
+
: [{ type: "text", text: `${metadata}\naccepted subagent ${result.name ?? result.subagentId}` }];
|
|
162
164
|
}, presentationMeta(_args, value) { return typeof value === "object" && value !== null && !Array.isArray(value) ? value.invocation ?? null : null; } },
|
|
163
165
|
finalizeContent(exec, result) {
|
|
164
166
|
const partial = incomplete.get(exec.token);
|
|
@@ -169,7 +171,7 @@ function registerRoleTool(agent, agentCtx, tools, entry, getSettings, policy, ad
|
|
|
169
171
|
...partial.diagnostic === undefined ? [] : [{ type: "text", text: `Provider diagnostic: ${partial.diagnostic}` }]];
|
|
170
172
|
},
|
|
171
173
|
async execute(args, exec) {
|
|
172
|
-
const fields = ["description", "prompt", "level", ...entry.targetParameter === undefined ? [] : [entry.targetParameter],
|
|
174
|
+
const fields = ["description", "prompt", "level", ...named ? ["name"] : [], ...entry.targetParameter === undefined ? [] : [entry.targetParameter],
|
|
173
175
|
...settings.subagents.allowRouteOverride ? ["route"] : [], ...background ? ["run_in_background"] : []];
|
|
174
176
|
if (Object.keys(exec.arguments).some((key) => !fields.includes(key)))
|
|
175
177
|
throw new SubagentError("DSMM delegation parameter is unsupported by this admitted tool", "UNSUPPORTED_CAPABILITY");
|
|
@@ -211,7 +213,7 @@ function registerRoleTool(agent, agentCtx, tools, entry, getSettings, policy, ad
|
|
|
211
213
|
void cancellation.catch(() => { });
|
|
212
214
|
} };
|
|
213
215
|
try {
|
|
214
|
-
activation = await startNativeActivation(subagents, { childId: pending.childId, provider: provider.name, label, request, signal: pending.signal, delivery: requestedBackground ? "parent" : "caller" });
|
|
216
|
+
activation = await startNativeActivation(subagents, { childId: pending.childId, provider: provider.name, label, request, signal: pending.signal, delivery: requestedBackground ? "parent" : "caller" }, named ? { role: role.sourceId, name: args.name } : undefined);
|
|
215
217
|
admission.track(activation);
|
|
216
218
|
pending.signal.addEventListener("abort", cancel, { once: true });
|
|
217
219
|
if (pending.signal.aborted) {
|
|
@@ -231,8 +233,9 @@ function registerRoleTool(agent, agentCtx, tools, entry, getSettings, policy, ad
|
|
|
231
233
|
throw error;
|
|
232
234
|
}
|
|
233
235
|
pending.signal.throwIfAborted();
|
|
236
|
+
const address = activation.name === undefined ? {} : { name: activation.name };
|
|
234
237
|
if (requestedBackground)
|
|
235
|
-
return { kind: "continuable", subagentId: activation.childId, messageId: activation.messageId ?? null, invocation: { ...pending.view() } };
|
|
238
|
+
return { kind: "continuable", subagentId: activation.childId, ...address, messageId: activation.messageId ?? null, invocation: { ...pending.view() } };
|
|
236
239
|
const result = await activation.result;
|
|
237
240
|
if (result.stopReason !== "completed")
|
|
238
241
|
incomplete.set(exec.token, result);
|
|
@@ -241,7 +244,7 @@ function registerRoleTool(agent, agentCtx, tools, entry, getSettings, policy, ad
|
|
|
241
244
|
pending.signal.throwIfAborted();
|
|
242
245
|
if (result.stopReason !== "completed")
|
|
243
246
|
throw new SubagentError(`Role activation ended: ${result.stopReason}`, "DSMM_INCOMPLETE");
|
|
244
|
-
return { kind: "foreground", output: result.output,
|
|
247
|
+
return { kind: "foreground", ...address, output: result.output,
|
|
245
248
|
...(result.structured === undefined ? {} : { structured: result.structured }), invocation: { ...pending.view() } };
|
|
246
249
|
}
|
|
247
250
|
finally {
|
package/lib/settings.js
CHANGED
|
@@ -6,7 +6,8 @@ import { DEFAULT_DSMM_RUNTIME_POLICY, DSMM_RATE_LIMIT_BOUNDS, normalizeRateLimit
|
|
|
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,
|
|
9
|
+
import { DEFAULT_PERMISSION_CONTROL, resolvePermissionControl } from "./permission-settings.js";
|
|
10
|
+
import { nativeCommandEntrySchema, nativeCommandMatchSchema, permissionControlSchema } from "./permission-schema.js";
|
|
10
11
|
export { DSMM_LOCALES } from "./profile-locale.js";
|
|
11
12
|
export { resolveRoleRuntimePolicy } from "./routing-policy.js";
|
|
12
13
|
export { DSMM_SKILL_NAMES, MVP_SKILL_NAMES } from "./skills.js";
|