@dsmm/dsmm 0.3.25 → 0.3.27
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 +21 -8
- package/docs/agent-presets.md +7 -7
- package/docs/agent-teams.md +27 -0
- package/docs/compatibility.md +7 -5
- package/docs/lsp.md +10 -12
- package/docs/maintenance.md +29 -0
- package/docs/roadmap.md +25 -9
- package/docs/runtime-recovery.md +3 -3
- package/docs/testing.md +2 -1
- package/docs/web-fetch-fakeip.md +1 -1
- package/dsh-plugin.json +1 -1
- package/lib/client/NativeToolView-data.d.ts +8 -0
- package/lib/client/NativeToolView-data.js +19 -0
- package/lib/client/NativeToolView.d.ts +19 -0
- package/lib/client/NativeToolView.js +46 -0
- package/lib/client/RoleToolView-data.js +1 -1
- package/lib/client/RoleToolView-locales.d.ts +7 -0
- package/lib/client/RoleToolView-locales.js +6 -0
- package/lib/client/RoleToolView.js +2 -0
- package/lib/client/children-locales.d.ts +5 -5
- package/lib/client/controller.js +20 -0
- package/lib/client.js +347 -186
- package/lib/core-permission-authority.js +19 -8
- package/lib/deployment-permission-rules.js +2 -1
- package/lib/dsh-types.d.ts +2 -2
- package/lib/mode.js +2 -2
- package/lib/native-admission.d.ts +8 -0
- package/lib/native-admission.js +285 -48
- package/lib/native-ownership.d.ts +20 -0
- package/lib/native-ownership.js +92 -0
- package/lib/native-subagents.d.ts +21 -0
- package/lib/native-subagents.js +31 -0
- package/lib/permission-rpc.js +3 -2
- package/lib/preset-registry.js +2 -1
- package/lib/profile-rpc.js +4 -3
- package/lib/profile-runtime.d.ts +1 -1
- package/lib/profile-runtime.js +2 -1
- package/lib/prompts.d.ts +2 -0
- package/lib/prompts.js +14 -8
- package/lib/role-control-remote.js +19 -8
- package/lib/role-control-rpc.js +11 -9
- package/lib/role-control-types.d.ts +18 -5
- package/lib/role-identity.js +3 -19
- package/lib/role-invocation.d.ts +1 -1
- package/lib/role-policy.d.ts +11 -3
- package/lib/role-policy.js +64 -23
- package/lib/role-subagents.js +26 -6
- package/lib/session-metadata.d.ts +27 -1
- package/lib/session-metadata.js +46 -0
- package/lib/session-scope.d.ts +1 -1
- package/lib/session-scope.js +2 -2
- package/package.json +116 -114
- package/prompts/source/deepwork/general.md +19 -0
- package/prompts/source/shared/native-teams.md +11 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { symbols } from "@deepseek-ai/cordis";
|
|
2
|
+
import { SubagentError } from "@deepseek-ai/dsh-subagent";
|
|
3
|
+
const edges = new WeakMap();
|
|
4
|
+
const original = (value) => Reflect.get(value, symbols.original) ?? value;
|
|
5
|
+
function runtimeOf(agent) {
|
|
6
|
+
const ctx = agent.ctx;
|
|
7
|
+
const runtime = ctx?.get?.("subagents");
|
|
8
|
+
return typeof runtime?.rootOf === "function" ? runtime : undefined;
|
|
9
|
+
}
|
|
10
|
+
/** Root membership is native runtime evidence, never durable session lineage. */
|
|
11
|
+
export function nativeRoots(registry) {
|
|
12
|
+
if (typeof registry.roots === "function")
|
|
13
|
+
return registry.roots();
|
|
14
|
+
return registry.list().filter(agent => {
|
|
15
|
+
if (agent.id === undefined || registry.get(agent.id) !== agent)
|
|
16
|
+
return false;
|
|
17
|
+
try {
|
|
18
|
+
return runtimeOf(agent)?.rootOf(agent) === agent;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** A tree root is authority only while both exact objects remain registered. */
|
|
26
|
+
export function nativeTreeRoot(registry, agent) {
|
|
27
|
+
if (agent.id === undefined || registry.get(agent.id) !== agent)
|
|
28
|
+
return undefined;
|
|
29
|
+
try {
|
|
30
|
+
const root = runtimeOf(agent)?.rootOf(agent);
|
|
31
|
+
if (root?.id === undefined)
|
|
32
|
+
return undefined;
|
|
33
|
+
const live = registry.get(root.id);
|
|
34
|
+
return live === root && runtimeOf(live)?.rootOf(live) === live ? live : undefined;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function nativeSameTree(registry, left, right) {
|
|
41
|
+
const root = nativeTreeRoot(registry, left);
|
|
42
|
+
return root !== undefined && nativeTreeRoot(registry, right) === root;
|
|
43
|
+
}
|
|
44
|
+
/** New runtimes require an authenticated creation edge in addition to native tree residency. */
|
|
45
|
+
export function nativeIsOwnedBy(registry, childId, parent) {
|
|
46
|
+
if (registry === undefined)
|
|
47
|
+
return false;
|
|
48
|
+
if (typeof registry.isOwnedBy === "function")
|
|
49
|
+
return registry.isOwnedBy(childId, parent);
|
|
50
|
+
const child = registry.get(childId);
|
|
51
|
+
if (child === undefined || parent.id === undefined || registry.get(parent.id) !== parent)
|
|
52
|
+
return false;
|
|
53
|
+
const edge = edges.get(original(registry))?.get(child);
|
|
54
|
+
if (edge?.parent !== parent || original(runtimeOf(child) ?? {}) !== original(edge.runtime))
|
|
55
|
+
return false;
|
|
56
|
+
try {
|
|
57
|
+
return edge.root.id !== undefined && registry.get(edge.root.id) === edge.root
|
|
58
|
+
&& edge.runtime.rootOf(child) === edge.root && edge.runtime.rootOf(parent) === edge.root;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Call only after authenticating the native start's direct creator, not from a session header. */
|
|
65
|
+
export function bindNativeParent(registry, child, parent) {
|
|
66
|
+
const deny = () => { throw new SubagentError("Exact native parent binding is unavailable", "UNAUTHORIZED"); };
|
|
67
|
+
if (child === parent || child.id === undefined || parent.id === undefined
|
|
68
|
+
|| registry.get(child.id) !== child || registry.get(parent.id) !== parent)
|
|
69
|
+
deny();
|
|
70
|
+
if (typeof registry.isOwnedBy === "function") {
|
|
71
|
+
if (!registry.isOwnedBy(child.id, parent))
|
|
72
|
+
deny();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const runtime = runtimeOf(child);
|
|
76
|
+
if (runtime === undefined)
|
|
77
|
+
deny();
|
|
78
|
+
const owner = runtime;
|
|
79
|
+
const root = owner.rootOf(child);
|
|
80
|
+
if (root === child || owner.rootOf(parent) !== root || root.id === undefined || registry.get(root.id) !== root)
|
|
81
|
+
deny();
|
|
82
|
+
let bindings = edges.get(original(registry));
|
|
83
|
+
if (bindings === undefined) {
|
|
84
|
+
bindings = new WeakMap();
|
|
85
|
+
edges.set(original(registry), bindings);
|
|
86
|
+
}
|
|
87
|
+
const previous = bindings.get(child);
|
|
88
|
+
if (previous !== undefined && (previous.parent !== parent || original(previous.runtime) !== original(owner) || previous.root !== root))
|
|
89
|
+
deny();
|
|
90
|
+
bindings.set(child, { parent, runtime: owner, root });
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=native-ownership.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
2
|
+
import type { SessionId } from "@deepseek-ai/dsh-session";
|
|
3
|
+
import type { SubagentActivation, SubagentCatalogEntry, SubagentDescendantListEntry, SubagentInterruptReceipt, SubagentPromptReceipt, SubagentPromptRequest, SubagentRuntime } from "@deepseek-ai/dsh-subagent";
|
|
4
|
+
type ActivationSpec = Parameters<SubagentRuntime["startActivation"]>[0];
|
|
5
|
+
/** Native tree runtimes accept task fields directly on the activation specification. */
|
|
6
|
+
export declare function startNativeActivation(runtime: SubagentRuntime, spec: ActivationSpec): Promise<SubagentActivation>;
|
|
7
|
+
export type NativeChildEntry = Pick<SubagentCatalogEntry, "id" | "mode"> & {
|
|
8
|
+
readonly label?: string;
|
|
9
|
+
};
|
|
10
|
+
type ChildDiscovery = {
|
|
11
|
+
listChildren?(parentId: SessionId, signal?: AbortSignal): Promise<NativeChildEntry[]>;
|
|
12
|
+
listDescendants(parentId: SessionId, signal?: AbortSignal): Promise<SubagentDescendantListEntry[]>;
|
|
13
|
+
};
|
|
14
|
+
/** Discover direct catalog membership without loading or resuming a child. */
|
|
15
|
+
export declare function listNativeChildren(runtime: ChildDiscovery, parentId: SessionId, signal?: AbortSignal): Promise<NativeChildEntry[]>;
|
|
16
|
+
/** Transport an already-authorized direct-child prompt through the Host's control contract. */
|
|
17
|
+
export declare function promptNativeChild(runtime: SubagentRuntime, request: SubagentPromptRequest, signal: AbortSignal): Promise<SubagentPromptReceipt>;
|
|
18
|
+
/** Caller-side catalog and exact-parent checks remain authoritative for this interrupt. */
|
|
19
|
+
export declare function interruptNativeChild(runtime: SubagentRuntime, childId: SessionId, caller: Agent): SubagentInterruptReceipt;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=native-subagents.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Native tree runtimes accept task fields directly on the activation specification. */
|
|
2
|
+
export function startNativeActivation(runtime, spec) {
|
|
3
|
+
if (typeof runtime.rootOf !== "function")
|
|
4
|
+
return runtime.startActivation(spec);
|
|
5
|
+
const { request, ...activation } = spec;
|
|
6
|
+
return runtime.startActivation({ ...request, ...activation });
|
|
7
|
+
}
|
|
8
|
+
/** Discover direct catalog membership without loading or resuming a child. */
|
|
9
|
+
export async function listNativeChildren(runtime, parentId, signal) {
|
|
10
|
+
if (typeof runtime.listChildren === "function")
|
|
11
|
+
return runtime.listChildren(parentId, signal);
|
|
12
|
+
const descendants = await runtime.listDescendants(parentId, signal);
|
|
13
|
+
return descendants.filter(row => row.parentId === parentId).map(row => row.kind === "diagnostic"
|
|
14
|
+
? { id: row.id, mode: "unknown" }
|
|
15
|
+
: { id: row.id, mode: row.mode, ...row.label === undefined ? {} : { label: row.label } });
|
|
16
|
+
}
|
|
17
|
+
/** Transport an already-authorized direct-child prompt through the Host's control contract. */
|
|
18
|
+
export function promptNativeChild(runtime, request, signal) {
|
|
19
|
+
if (typeof runtime.rootOf !== "function")
|
|
20
|
+
return runtime.prompt(request, signal);
|
|
21
|
+
const { parentSessionId: _parent, mode: _mode, ...prompt } = request;
|
|
22
|
+
return runtime.prompt(prompt, signal);
|
|
23
|
+
}
|
|
24
|
+
/** Caller-side catalog and exact-parent checks remain authoritative for this interrupt. */
|
|
25
|
+
export function interruptNativeChild(runtime, childId, caller) {
|
|
26
|
+
if (typeof runtime.rootOf !== "function")
|
|
27
|
+
return runtime.interruptByParent(childId, caller.id, "continuable");
|
|
28
|
+
runtime.interrupt(childId, { kind: "ancestor", agent: caller });
|
|
29
|
+
return { accepted: true };
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=native-subagents.js.map
|
package/lib/permission-rpc.js
CHANGED
|
@@ -32,6 +32,7 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
32
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
33
|
done = true;
|
|
34
34
|
};
|
|
35
|
+
import { nativeRoots, nativeIsOwnedBy } from "./native-ownership.js";
|
|
35
36
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
36
37
|
import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
37
38
|
import { PermissionRefusal, permissionOriginal } from "./permission-control.js";
|
|
@@ -74,8 +75,8 @@ let DsmmPermissionsHost = (() => {
|
|
|
74
75
|
if (signal.aborted)
|
|
75
76
|
throw new PermissionRefusal("cancelled");
|
|
76
77
|
if (current === undefined || permissionOriginal(current) !== owner || current.browserPeer !== peer || registry?.get(id) !== root
|
|
77
|
-
|| root.id !== sessionId || root.session.id !== sessionId || root.session.header.origin === "subagent" || !registry
|
|
78
|
-
|| registry.list().some(agent => agent !== root && registry
|
|
78
|
+
|| root.id !== sessionId || root.session.id !== sessionId || root.session.header.origin === "subagent" || !nativeRoots(registry).includes(root)
|
|
79
|
+
|| registry.list().some(agent => agent !== root && nativeIsOwnedBy(registry, id, agent)))
|
|
79
80
|
throw new PermissionRefusal("not-owned");
|
|
80
81
|
};
|
|
81
82
|
check();
|
package/lib/preset-registry.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nativeIsOwnedBy } from "./native-ownership.js";
|
|
1
2
|
import { Context as NativeContext, getTraceable } from "@deepseek-ai/cordis";
|
|
2
3
|
import { DSMM_ROLES, DSMM_ROLE_IDS, rolePluginRows } from "./roles.js";
|
|
3
4
|
import { enabledSkillNames } from "./skills.js";
|
|
@@ -64,7 +65,7 @@ export function registerRolePresets(ctx, getSettings, roleIdentity) {
|
|
|
64
65
|
// reconcile. A parented agent with no bound identity stays pending
|
|
65
66
|
// instead of concluding "not read-only" from a not-yet-bound role.
|
|
66
67
|
const agentId = agent.id;
|
|
67
|
-
const parented = agentId !== undefined && agents.list().some(other => other !== agent && agents
|
|
68
|
+
const parented = agentId !== undefined && agents.list().some(other => other !== agent && nativeIsOwnedBy(agents, agentId, other));
|
|
68
69
|
const pendingIdentity = roleIdentity !== undefined && identityRole === undefined && parented;
|
|
69
70
|
const selected = pendingIdentity ? undefined : identityRole ?? registry.composedPreset(agent.ctx);
|
|
70
71
|
const previous = states.get(agent);
|
package/lib/profile-rpc.js
CHANGED
|
@@ -32,6 +32,7 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
32
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
33
|
done = true;
|
|
34
34
|
};
|
|
35
|
+
import { nativeRoots, nativeIsOwnedBy } from "./native-ownership.js";
|
|
35
36
|
import { symbols } from "@deepseek-ai/cordis";
|
|
36
37
|
import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
37
38
|
import { parseProfileErrorInfo, TYPERT_HOST } from "./profile-remote.js";
|
|
@@ -140,7 +141,7 @@ let DsmmProfilesHost = (() => {
|
|
|
140
141
|
throw new DsmmProfileError("not-owned", "The native Host operator connection is no longer active.");
|
|
141
142
|
}
|
|
142
143
|
const agents = this.ctx.get("agents");
|
|
143
|
-
if (agents === undefined || typeof agents.get !== "function" || typeof agents.
|
|
144
|
+
if (agents === undefined || typeof agents.get !== "function" || typeof agents.list !== "function") {
|
|
144
145
|
throw new DsmmProfileError("unavailable", "Native session authority is unavailable.");
|
|
145
146
|
}
|
|
146
147
|
return agents;
|
|
@@ -153,8 +154,8 @@ let DsmmProfilesHost = (() => {
|
|
|
153
154
|
const checkCaptured = () => {
|
|
154
155
|
const current = checkAuthority();
|
|
155
156
|
if (agent.id !== sessionId || agent.session.id !== sessionId || current.get(sessionId) !== agent
|
|
156
|
-
|| agent.session.header?.origin === "subagent" || !current
|
|
157
|
-
|| current.list().some((owner) => owner !== agent && current
|
|
157
|
+
|| agent.session.header?.origin === "subagent" || !nativeRoots(current).includes(agent)
|
|
158
|
+
|| current.list().some((owner) => owner !== agent && nativeIsOwnedBy(current, sessionId, owner))) {
|
|
158
159
|
throw new DsmmProfileError("not-owned", "Only an exact live ordinary root session can select a profile.", "sessionId");
|
|
159
160
|
}
|
|
160
161
|
};
|
package/lib/profile-runtime.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export declare class DsmmProfileRuntime {
|
|
|
76
76
|
prepareHistory(profileId: string | null, signal: AbortSignal): Promise<PreparedHistoryProfile>;
|
|
77
77
|
prepareRoot(agent: DshAgent, signal: AbortSignal): Promise<AdmittedProfile>;
|
|
78
78
|
readChildIdentity(childId: string, parentId: string): Promise<ChildAdmissionIdentity | null>;
|
|
79
|
-
prepareChild(agent: DshAgent, parent: DsmmProfileAdmission, signal: AbortSignal, identity?: ChildAdmissionIdentity | null): Promise<AdmittedProfile>;
|
|
79
|
+
prepareChild(agent: DshAgent, parent: DsmmProfileAdmission, signal: AbortSignal, identity?: Pick<ChildAdmissionIdentity, "profileId"> | null): Promise<AdmittedProfile>;
|
|
80
80
|
private currentSelection;
|
|
81
81
|
private prepareActivation;
|
|
82
82
|
revalidateActivation(admission: DsmmProfileAdmission): Promise<void>;
|
package/lib/profile-runtime.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nativeRoots } from "./native-ownership.js";
|
|
1
2
|
import { join } from "node:path";
|
|
2
3
|
import { randomBytes } from "node:crypto";
|
|
3
4
|
import { lstatSync, realpathSync } from "node:fs";
|
|
@@ -320,7 +321,7 @@ export class DsmmProfileRuntime {
|
|
|
320
321
|
this.assertCurrent();
|
|
321
322
|
validateSessionProfileId(agent.id);
|
|
322
323
|
const agents = this.ctx.get?.("agents");
|
|
323
|
-
if (agents?.get(agent.id) !== agent || !agents
|
|
324
|
+
if (agents?.get(agent.id) !== agent || !nativeRoots(agents).includes(agent) || agent.session.header?.origin === "subagent")
|
|
324
325
|
throw new DsmmProfileError("not-owned", "The exact live root Agent is required.");
|
|
325
326
|
}
|
|
326
327
|
async describe() {
|
package/lib/prompts.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export interface DsmmPromptObservation {
|
|
|
33
33
|
continuable?: boolean;
|
|
34
34
|
/** Existing exact live child delivery; never a cold-recovery claim. */
|
|
35
35
|
nativeChildDelivery?: boolean;
|
|
36
|
+
nativeTree?: boolean;
|
|
36
37
|
nativeBrowserPrompt?: {
|
|
37
38
|
surface: string;
|
|
38
39
|
};
|
|
@@ -40,6 +41,7 @@ export interface DsmmPromptObservation {
|
|
|
40
41
|
}
|
|
41
42
|
/** Render callable delegation and lifecycle observations without repeating Agent locale. */
|
|
42
43
|
export declare function buildDsmmDelegationGuidance(settings: DsmmSettings, observed: DsmmPromptObservation): string;
|
|
44
|
+
export declare function buildDsmmTeamGuidance(admittedNames: readonly string[]): string;
|
|
43
45
|
export declare function buildDsmmAgentGuidance(settings: DsmmSettings, observed: DsmmPromptObservation): string;
|
|
44
46
|
export declare function buildDeepworkPrompt(settings: DsmmSettings, options?: DeepworkPromptOptions): string;
|
|
45
47
|
//# sourceMappingURL=prompts.d.ts.map
|
package/lib/prompts.js
CHANGED
|
@@ -72,7 +72,7 @@ export function buildDsmmDelegationGuidance(settings, observed) {
|
|
|
72
72
|
background: backgroundEnabled && properties.run_in_background !== undefined,
|
|
73
73
|
forceBackground: settings.subagents.forceBackground && properties.run_in_background !== undefined }];
|
|
74
74
|
});
|
|
75
|
-
const controls = observed.tools.filter(tool => ["send_message", "interrupt_agent", "job_output", "job_list", "job_kill", "dsmm_children"].includes(tool.name));
|
|
75
|
+
const controls = observed.tools.filter(tool => ["send_message", "interrupt_agent", "list_agents", "wait_agent", "job_output", "job_list", "job_kill", "dsmm_children"].includes(tool.name));
|
|
76
76
|
const runtime = observed.runtimeAdmission === undefined ? undefined : {
|
|
77
77
|
binding: observed.runtimeAdmission.binding, deliveryFenceReady: observed.runtimeAdmission.deliveryFenceReady,
|
|
78
78
|
restartRequired: observed.runtimeAdmission.restartRequired,
|
|
@@ -85,6 +85,7 @@ export function buildDsmmDelegationGuidance(settings, observed) {
|
|
|
85
85
|
forceBackground: settings.subagents.forceBackground,
|
|
86
86
|
continuable: observed.capabilities?.continuable === true && ready,
|
|
87
87
|
nativeChildDelivery: liveDelivery,
|
|
88
|
+
nativeTree: ready && observed.capabilities?.nativeTree === true,
|
|
88
89
|
sendMessage: liveDelivery && controls.some(tool => tool.name === "send_message"),
|
|
89
90
|
childToParentReporting: observed.scope === "child" && controls.some(tool => tool.name === "send_message"),
|
|
90
91
|
browserPromptSurface: liveDelivery ? observed.capabilities?.nativeBrowserPrompt?.surface ?? null : null,
|
|
@@ -95,7 +96,7 @@ ${JSON.stringify({ scope: observed.scope, topology: settings.subagents.toolTopol
|
|
|
95
96
|
controls: controls.map(tool => ({ tool: tool.name, parameters: Object.keys(toolProperties(tool)) })),
|
|
96
97
|
...(observed.roleAvailability === undefined ? {} : { roleAvailability: observed.roleAvailability.map(row => ({ id: row.id, admitted: row.admitted, ...(row.reason === undefined ? {} : { reason: row.reason }) })) }) }, null, 2)}
|
|
97
98
|
</dsmm-admitted-delegation>
|
|
98
|
-
Only the listed callable entries and target enums are observed here. Role availability alone is not tool availability. Inspect their native schemas; do not invent suffix roles, fields or tools. Omitted level and normal retain the default route; low/high/max are selectable only for the listed configured target levels, not workflow rigor or a fixed reasoning effort. Each level is a complete provider/model selection or an effort-only override with exact native preflight. Route override is deployment opt-in and additionally requires an exposed route parameter: provider/model must be paired; changing models discards the previous effort; effort-only uses the selected model's exact supported effort. An explicit complete invocation route does not silently use role fallback.
|
|
99
|
+
Only the listed callable entries and target enums are observed here. Role availability alone is not tool availability. Inspect their native schemas; do not invent suffix roles, fields or tools. Omitted level and normal retain the default route; low/high/max are selectable only for the listed configured target levels, not workflow rigor or a fixed reasoning effort. Each level is a complete provider/model selection or an effort-only override with exact native preflight. Route override is deployment opt-in and additionally requires an exposed route parameter: provider/model must be paired; changing models discards the previous effort; effort-only uses the selected model's exact supported effort. An explicit complete invocation route does not silently use role fallback. Resident reuse retains its captured role, level and route policy; cold activation resolves the selected profile's current role route under the original ceilings. Layout/level never enlarge target, read-only, inherited tool, ownership or depth authority. The ordinary root native model picker remains authoritative. Missing required planning/review capability returns to the stage owner, not a bypass.
|
|
99
100
|
`];
|
|
100
101
|
if (observed.invocation !== undefined)
|
|
101
102
|
sections.push(`<dsmm-observed-invocation>\n${JSON.stringify(projectInvocation(observed.invocation), null, 2)}\n</dsmm-observed-invocation>\nThe routeKind labels this observation: initial is preflighted start, not a claim about the current fallback route; actual is supplied by observed native request/status. Level is resource selection, never added permissions or a smaller verification obligation.`);
|
|
@@ -103,22 +104,27 @@ Only the listed callable entries and target enums are observed here. Role availa
|
|
|
103
104
|
<dsmm-child-lifecycle-state>\n${JSON.stringify(lifecycle, null, 2)}\n</dsmm-child-lifecycle-state>
|
|
104
105
|
${settings.subagents.forceBackground ? "This Agent's captured deployment policy forces all admitted role/category calls into background parent delivery, whether run_in_background is omitted, true or false. This takes priority over enableRunInBackground." : backgroundEnabled ? "Background is enabled in this Agent's captured deployment policy; only tools that expose run_in_background may request it." : "Background is disabled in this Agent's captured policy; do not request it."}
|
|
105
106
|
${settings.subagents.forceBackground ? "Forced background calls choose native parent delivery before starting and return accepted child/message identity, not a completion or a job handle." : "Role calls wait for the native activation result by default. Explicit run_in_background:true chooses native parent delivery before starting and returns accepted child/message identity, not a completion or a job handle."} Running calls cannot transfer foreground/background ownership. Partial output with a non-completed stop reason is not success and must not be replayed automatically.
|
|
106
|
-
${lifecycle.sendMessage ? "Exposed send_message can address
|
|
107
|
+
${lifecycle.sendMessage ? `${lifecycle.nativeTree ? "Exposed send_message uses the actual sender and can address another member of the same native tree. Native list_agents discovers members; wait_agent waits for new input when exposed. Supported cold members can resume with their original ID without recreating absent creators, subject to verified native identity, current role/provider policy and persisted restriction ceilings." : "Exposed send_message follows the Host's exact live adjacency contract. Legacy continuation requires its exact live creator."} Running delivery reaches the nearest step; an idle member can accept a next turn. An inbox receipt means accepted, not executed/completed. Resident admissions remain immutable. Cold activation resolves current selected-profile content and role routing; messages, task ownership and historical approvals grant no authority.` : "No live child messaging tool is observed here; do not invent one or infer it from role metadata."}
|
|
107
108
|
${lifecycle.browserPromptSurface !== null ? `The actual native user surface ${lifecycle.browserPromptSurface} uses queue/steer for continuable children, with native attachment validation. Its operator/connection/session/epoch/lifetime gate precedes inbox acceptance. Do not impersonate an Agent sender. After acceptance do not automatically retry; an unknown disconnect outcome needs verification, not a guessed idempotency guarantee.` : "No operator-gated native user queue/steer surface is established here; do not announce an unconnected DSMM RPC."}
|
|
108
|
-
${controls.some(tool => tool.name === "interrupt_agent") ?
|
|
109
|
-
${lifecycle.childToParentReporting ? "Native
|
|
109
|
+
${controls.some(tool => tool.name === "interrupt_agent") ? `Exposed interrupt_agent requests cancellation${lifecycle.nativeTree ? " only for the caller's descendants, using ancestor authority" : " under the Host's direct-child authority"}; it is not proof of completion or a message-delivery fence.` : "No child interruption tool is observed here."}
|
|
110
|
+
${lifecycle.childToParentReporting ? "Native reporting preserves the actual sender and the Host's membership checks; reporting grants no delegation authority." : ""}
|
|
110
111
|
Official Registry, SubagentRuntime and JSONL services own execution, result delivery and persistence. DSMM execution guards require a trusted live admission; they do not claim to veto every native inbox acceptance. Owner teardown cancels owned work and surviving Agent guards remain fail-closed. Do not replace native services, recover permissions from logs, or change Host configuration automatically.
|
|
111
|
-
Native capacity/depth, provider support,
|
|
112
|
+
Native capacity/depth, provider support, captured permissions and cancellation remain mandatory. New delegation requires its exact live creator. Tree continuation keeps durable creator identity separate from the live root admission owner; root retirement revokes its owned work. No OpenCode task_id/resume/retry protocol is supplied.
|
|
112
113
|
</dsmm-child-lifecycle>`);
|
|
113
114
|
return sections.join("\n\n---\n\n");
|
|
114
115
|
}
|
|
116
|
+
export function buildDsmmTeamGuidance(admittedNames) {
|
|
117
|
+
const tools = admittedNames.filter(name => ["team_task_create", "team_task_list", "team_task_get", "team_task_update"].includes(name));
|
|
118
|
+
return tools.length === 0 ? "" : `<dsmm-native-teams>\nObserved native Team tools for this step: ${tools.join(", ")}.\n\n${asset("shared/native-teams.md")}\n</dsmm-native-teams>`;
|
|
119
|
+
}
|
|
115
120
|
export function buildDsmmAgentGuidance(settings, observed) {
|
|
116
121
|
return [buildDsmmLocaleGuidance(settings), buildDsmmDelegationGuidance(settings, observed)].join("\n\n---\n\n");
|
|
117
122
|
}
|
|
118
123
|
export function buildDeepworkPrompt(settings, options = {}) {
|
|
119
124
|
const role = SOURCE_ROLE_CATALOG.find((role) => role.id === (options.roleId === undefined ? options.selectedPreset : options.roleId));
|
|
120
|
-
const common = role === undefined ?
|
|
121
|
-
|
|
125
|
+
const common = role === undefined ? [asset("deepwork/general.md"), asset("shared/shell-safety.md")].join("\n\n---\n\n")
|
|
126
|
+
: [activation, asset("deepwork/default.md")].join("\n\n---\n\n");
|
|
127
|
+
const family = role === undefined ? "" : roleModelCalibration(role, options.route?.model ?? "");
|
|
122
128
|
const base = [options.overrideSection?.trim() || common, settings.skills["avoid-ai-slop"] ? readSharedPromptAsset("avoid-ai-slop.md") : "", family === "" ? "" : `<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>`].filter(Boolean).join("\n\n---\n\n").replaceAll("{{modeName}}", settings.modeName);
|
|
123
129
|
const workflowPolicy = settings.workflow.policy === "legacy" ? `<dsmm-workflow-policy>
|
|
124
130
|
policy: legacy
|
|
@@ -125,22 +125,33 @@ function observedActualRoute(value) {
|
|
|
125
125
|
return { status: "unknown", reason: row.reason };
|
|
126
126
|
}
|
|
127
127
|
function roleCall(value) {
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
fail();
|
|
128
|
+
const native = typeof value === "object" && value !== null && "kind" in value && value.kind === "native";
|
|
129
|
+
const commonKeys = ["parentSessionId", "parentAdmissionEpoch", "callId", "rootCallId", "childId", "initialRoute", "actualRoute", "phase", "delivery"];
|
|
130
|
+
const row = object(value, [...commonKeys, ...native ? ["kind", "toolName"] : ["role", "level", "routeSource"]], ["childAdmissionEpoch", "runId", "stopReason", ...native ? ["provider", "nativeName"] : ["kind"]]);
|
|
132
131
|
const childId = identity(row.childId), initialRoute = observedInitialRoute(row.initialRoute), actualRoute = observedActualRoute(row.actualRoute);
|
|
133
132
|
const phase = choice(row.phase, ROLE_CALL_PHASES), delivery = choice(row.delivery, ROLE_CALL_DELIVERIES);
|
|
134
133
|
const stopReason = Object.hasOwn(row, "stopReason") ? choice(row.stopReason, ROLE_CALL_STOP_REASONS) : undefined;
|
|
135
134
|
if (stopReason !== undefined && phase !== "settled")
|
|
136
135
|
fail();
|
|
137
|
-
|
|
136
|
+
const common = { parentSessionId: identity(row.parentSessionId), parentAdmissionEpoch: epoch(row.parentAdmissionEpoch),
|
|
138
137
|
...(Object.hasOwn(row, "childAdmissionEpoch") ? { childAdmissionEpoch: epoch(row.childAdmissionEpoch) } : {}),
|
|
139
138
|
callId: callIdentity(row.callId), rootCallId: callIdentity(row.rootCallId), childId,
|
|
140
|
-
...(Object.hasOwn(row, "runId") ? { runId: identity(row.runId) } : {}),
|
|
141
|
-
level: choice(row.level, ["normal", "low", "high", "max"]), routeSource: choice(row.routeSource, DSMM_ROUTE_SOURCES),
|
|
142
|
-
initialRoute, actualRoute, phase, delivery,
|
|
139
|
+
...(Object.hasOwn(row, "runId") ? { runId: identity(row.runId) } : {}), actualRoute, phase, delivery,
|
|
143
140
|
...(stopReason === undefined ? {} : { stopReason }) };
|
|
141
|
+
if (native) {
|
|
142
|
+
if (initialRoute.status !== "unknown")
|
|
143
|
+
fail();
|
|
144
|
+
return { ...common, kind: "native", toolName: callIdentity(row.toolName), initialRoute,
|
|
145
|
+
...(Object.hasOwn(row, "provider") ? { provider: callIdentity(row.provider) } : {}),
|
|
146
|
+
...(Object.hasOwn(row, "nativeName") ? { nativeName: callIdentity(row.nativeName) } : {}) };
|
|
147
|
+
}
|
|
148
|
+
if (Object.hasOwn(row, "kind") && row.kind !== "role")
|
|
149
|
+
fail();
|
|
150
|
+
const role = parseDsmmRoleId(row.role);
|
|
151
|
+
if (role === "dsmm-orchestrator")
|
|
152
|
+
fail();
|
|
153
|
+
return { ...common, ...(row.kind === "role" ? { kind: "role" } : {}), role,
|
|
154
|
+
level: choice(row.level, ["normal", "low", "high", "max"]), routeSource: choice(row.routeSource, DSMM_ROUTE_SOURCES), initialRoute };
|
|
144
155
|
}
|
|
145
156
|
function observationFrame(value) {
|
|
146
157
|
const row = object(value, ["type", "sessionId", "admissionEpoch"], ["calls", "call", "callId"]), sessionId = identity(row.sessionId), admissionEpoch = epoch(row.admissionEpoch);
|
package/lib/role-control-rpc.js
CHANGED
|
@@ -32,6 +32,8 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
32
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
33
|
done = true;
|
|
34
34
|
};
|
|
35
|
+
import { nativeRoots, nativeIsOwnedBy } from "./native-ownership.js";
|
|
36
|
+
import { listNativeChildren, promptNativeChild, interruptNativeChild } from "./native-subagents.js";
|
|
35
37
|
import { symbols } from "@deepseek-ai/cordis";
|
|
36
38
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
37
39
|
import { SubagentError } from "@deepseek-ai/dsh-subagent";
|
|
@@ -102,7 +104,7 @@ let DsmmChildrenHost = (() => {
|
|
|
102
104
|
const parent = agents.get(SessionId(sessionId));
|
|
103
105
|
if (!parent)
|
|
104
106
|
throw new ControlRefusal("not-found", "sessionId");
|
|
105
|
-
if (!agents
|
|
107
|
+
if (!nativeRoots(agents).includes(parent) || parent.session.header.origin === "subagent" || parent.session.id !== parent.id)
|
|
106
108
|
throw new ControlRefusal("not-owned", "sessionId");
|
|
107
109
|
const captured = this.admission.assert(parent);
|
|
108
110
|
const signal = AbortSignal.any([invocation.signal, invocation.peer.signal, this.lifetime.signal, this.admission.lifetime.signal,
|
|
@@ -118,13 +120,13 @@ let DsmmChildrenHost = (() => {
|
|
|
118
120
|
return { parent, admission: captured, epoch: captured.epoch, signal, check };
|
|
119
121
|
}
|
|
120
122
|
observationRoot(target, agents) {
|
|
121
|
-
const roots = agents
|
|
123
|
+
const roots = nativeRoots(agents), residents = agents.list(), seen = new Set();
|
|
122
124
|
let current = target;
|
|
123
125
|
while (!roots.includes(current)) {
|
|
124
126
|
if (seen.has(current))
|
|
125
127
|
throw new ControlRefusal("not-owned", "sessionId");
|
|
126
128
|
seen.add(current);
|
|
127
|
-
const parents = residents.filter(candidate => candidate !== current && agents
|
|
129
|
+
const parents = residents.filter(candidate => candidate !== current && nativeIsOwnedBy(agents, current.id, candidate));
|
|
128
130
|
if (parents.length !== 1)
|
|
129
131
|
throw new ControlRefusal("not-owned", "sessionId");
|
|
130
132
|
current = parents[0];
|
|
@@ -206,7 +208,7 @@ let DsmmChildrenHost = (() => {
|
|
|
206
208
|
const live = child && this.admission.get(child), invocation = child && this.admission.invocation(child);
|
|
207
209
|
const available = this.capabilities(scope);
|
|
208
210
|
const reason = !direct ? "not-direct-child" : entry.mode !== "continuable" ? entry.mode === "one-shot" ? "one-shot" : "unknown-mode" : child && !live ? "evidence-unavailable" : undefined;
|
|
209
|
-
const control = reason !== undefined ? disabled(reason) : child && !this.ctx.get("agents")
|
|
211
|
+
const control = reason !== undefined ? disabled(reason) : child && !nativeIsOwnedBy(this.ctx.get("agents"), child.id, scope.parent) ? disabled("not-direct-child") : available.prompt;
|
|
210
212
|
return { id: entry.id, parentSessionId: parentId, mode: entry.mode === "external" ? "unknown" : entry.mode, activity: child?.status === "running" ? "running" : "inactive",
|
|
211
213
|
readonly: !control.enabled, controls: { prompt: control, interrupt: child ? control : disabled("evidence-unavailable") }, ...(entry.label === undefined ? {} : { label: boundedLabel(entry.label) }),
|
|
212
214
|
...(invocation === undefined ? {} : { invocation: invocationView(invocation, boundedLabel(entry.label ?? invocation.target), "continuable", { childId: entry.id }) }),
|
|
@@ -235,7 +237,7 @@ let DsmmChildrenHost = (() => {
|
|
|
235
237
|
}
|
|
236
238
|
describe(sessionId) {
|
|
237
239
|
return this.scoped(sessionId, async (scope) => {
|
|
238
|
-
const rows = await this.ctx.get("subagents")
|
|
240
|
+
const rows = await listNativeChildren(this.ctx.get("subagents"), scope.parent.id, scope.signal);
|
|
239
241
|
scope.check();
|
|
240
242
|
return parseChildSessionSnapshot({ sessionId, admissionEpoch: scope.epoch, children: rows.map(row => this.child(scope, row)), capabilities: this.capabilities(scope) });
|
|
241
243
|
});
|
|
@@ -254,7 +256,7 @@ let DsmmChildrenHost = (() => {
|
|
|
254
256
|
const child = this.ctx.get("agents")?.get(SessionId(childId));
|
|
255
257
|
if (!child)
|
|
256
258
|
throw new ControlRefusal("not-resumable", "childSessionId", "evidence-unavailable");
|
|
257
|
-
if (!this.ctx.get("agents")
|
|
259
|
+
if (!nativeIsOwnedBy(this.ctx.get("agents"), child.id, scope.parent))
|
|
258
260
|
throw new ControlRefusal("not-owned", "childSessionId");
|
|
259
261
|
this.admission.assert(child);
|
|
260
262
|
return child;
|
|
@@ -269,7 +271,7 @@ let DsmmChildrenHost = (() => {
|
|
|
269
271
|
throw new ControlRefusal("disabled", undefined, capabilities.prompt.reason);
|
|
270
272
|
if (request.content.some(part => part.type === "image") && !capabilities.images.enabled)
|
|
271
273
|
throw new ControlRefusal("disabled", "content", capabilities.images.reason);
|
|
272
|
-
const rows = await this.ctx.get("subagents")
|
|
274
|
+
const rows = await listNativeChildren(this.ctx.get("subagents"), scope.parent.id, scope.signal);
|
|
273
275
|
scope.check();
|
|
274
276
|
const row = rows.find(row => row.id === request.childSessionId);
|
|
275
277
|
if (!row)
|
|
@@ -280,7 +282,7 @@ let DsmmChildrenHost = (() => {
|
|
|
280
282
|
this.direct(scope, request.childSessionId);
|
|
281
283
|
return this.admission.duringCall(scope.parent, scope.signal, async (signal) => {
|
|
282
284
|
scope.check();
|
|
283
|
-
const receipt = await this.ctx.get("subagents")
|
|
285
|
+
const receipt = await promptNativeChild(this.ctx.get("subagents"), request, signal);
|
|
284
286
|
scope.check();
|
|
285
287
|
return receipt;
|
|
286
288
|
});
|
|
@@ -295,7 +297,7 @@ let DsmmChildrenHost = (() => {
|
|
|
295
297
|
if (!capabilities.interrupt.enabled)
|
|
296
298
|
throw new ControlRefusal("disabled", undefined, capabilities.interrupt.reason);
|
|
297
299
|
this.direct(scope, request.childSessionId);
|
|
298
|
-
return this.ctx.get("subagents")
|
|
300
|
+
return interruptNativeChild(this.ctx.get("subagents"), SessionId(request.childSessionId), scope.parent);
|
|
299
301
|
});
|
|
300
302
|
}
|
|
301
303
|
};
|
|
@@ -30,7 +30,7 @@ export type RoleCallActualRoute = {
|
|
|
30
30
|
readonly status: "unknown";
|
|
31
31
|
readonly reason: "no-own-request-header" | "invalid-own-request-header" | "not-observed";
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
interface CallObservationBase {
|
|
34
34
|
readonly parentSessionId: string;
|
|
35
35
|
readonly parentAdmissionEpoch: string;
|
|
36
36
|
readonly childAdmissionEpoch?: string;
|
|
@@ -38,15 +38,28 @@ export interface RoleCallObservation {
|
|
|
38
38
|
readonly rootCallId: string;
|
|
39
39
|
readonly childId: string;
|
|
40
40
|
readonly runId?: string;
|
|
41
|
-
readonly role: Exclude<import("./roles.js").DsmmRoleId, "dsmm-orchestrator">;
|
|
42
|
-
readonly level: DsmmInvocationLevel;
|
|
43
|
-
readonly routeSource: DsmmRouteSource;
|
|
44
|
-
readonly initialRoute: RoleCallInitialRoute;
|
|
45
41
|
readonly actualRoute: RoleCallActualRoute;
|
|
46
42
|
readonly phase: RoleCallPhase;
|
|
47
43
|
readonly delivery: RoleCallDelivery;
|
|
48
44
|
readonly stopReason?: RoleCallStopReason;
|
|
49
45
|
}
|
|
46
|
+
export interface RoleInvocationObservation extends CallObservationBase {
|
|
47
|
+
readonly kind?: "role";
|
|
48
|
+
readonly role: Exclude<import("./roles.js").DsmmRoleId, "dsmm-orchestrator">;
|
|
49
|
+
readonly level: DsmmInvocationLevel;
|
|
50
|
+
readonly routeSource: DsmmRouteSource;
|
|
51
|
+
readonly initialRoute: RoleCallInitialRoute;
|
|
52
|
+
}
|
|
53
|
+
export interface NativeCallObservation extends CallObservationBase {
|
|
54
|
+
readonly kind: "native";
|
|
55
|
+
readonly toolName: string;
|
|
56
|
+
readonly provider?: string;
|
|
57
|
+
readonly nativeName?: string;
|
|
58
|
+
readonly initialRoute: Extract<RoleCallInitialRoute, {
|
|
59
|
+
status: "unknown";
|
|
60
|
+
}>;
|
|
61
|
+
}
|
|
62
|
+
export type RoleCallObservation = RoleInvocationObservation | NativeCallObservation;
|
|
50
63
|
export type RoleCallObservationFrame = {
|
|
51
64
|
readonly type: "snapshot";
|
|
52
65
|
readonly sessionId: string;
|
package/lib/role-identity.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTraceable } from "@deepseek-ai/cordis";
|
|
2
2
|
import { nativeAgentContext } from "./native-scope.js";
|
|
3
|
-
import { buildRoleIdentity
|
|
4
|
-
import { DSMM_ROLES
|
|
3
|
+
import { buildRoleIdentity } from "./prompt-content.js";
|
|
4
|
+
import { DSMM_ROLES } from "./roles.js";
|
|
5
5
|
/** The caller supplies the policy-admitted identity; only its Agent layer is changed. */
|
|
6
6
|
export function registerRoleHarnessIdentity(agent, role, child = false) {
|
|
7
7
|
const ctx = nativeAgentContext(agent);
|
|
@@ -9,28 +9,12 @@ export function registerRoleHarnessIdentity(agent, role, child = false) {
|
|
|
9
9
|
const definition = DSMM_ROLES.find(row => row.id === role);
|
|
10
10
|
const identity = prompt.section({ name: "harness:identity", order: prompt.getSectionOrder("HARNESS_IDENTITY"),
|
|
11
11
|
text: buildRoleIdentity(definition) });
|
|
12
|
-
let locale;
|
|
13
|
-
let neutralize;
|
|
14
12
|
try {
|
|
15
|
-
if (!child && !isDsmmRoleId(ctx.get("agentPresets")?.composedPreset(ctx))) {
|
|
16
|
-
locale = prompt.section({ name: "dsmm:locale-guidance", order: 48, interpolate: false, text: readPromptAsset("shared/locale.md") });
|
|
17
|
-
// The standard preset's model identity belongs to its persona, not harness:identity.
|
|
18
|
-
neutralize = ctx.on("system-prompt/assemble", async (_assembly, context, next) => {
|
|
19
|
-
const assembly = await next();
|
|
20
|
-
if (context.scope !== agent)
|
|
21
|
-
return assembly;
|
|
22
|
-
return { ...assembly, sections: assembly.sections.map(section => section.name === "deployment:persona-prefix" && section.interpolate !== false
|
|
23
|
-
? { ...section, text: section.text.replace("You are a coding agent powered by the {{model}} model.", "You are a coding agent.") }
|
|
24
|
-
: section) };
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
13
|
const persona = child ? prompt.section({ name: "deployment:persona-prefix", order: prompt.getSectionOrder("DEPLOYMENT_PERSONA_PREFIX"),
|
|
28
14
|
text: definition.persona }) : undefined;
|
|
29
|
-
return () => { persona?.();
|
|
15
|
+
return () => { persona?.(); identity(); };
|
|
30
16
|
}
|
|
31
17
|
catch (error) {
|
|
32
|
-
neutralize?.();
|
|
33
|
-
locale?.();
|
|
34
18
|
identity();
|
|
35
19
|
throw error;
|
|
36
20
|
}
|
package/lib/role-invocation.d.ts
CHANGED
|
@@ -29,8 +29,8 @@ export declare function capturedOriginalRoleInvocation(agent: DshAgent): ChildAd
|
|
|
29
29
|
export declare function resolveRoleInvocation(parent: Agent, target: DsmmRoleId, settings: DsmmSettings, signal: AbortSignal, options?: DsmmInvocationOptions, nativeOptions?: AgentOptions, parameterPolicy?: ResolvedModelParameterPolicy): Promise<ResolvedRoleInvocation>;
|
|
30
30
|
export declare function invocationAgentOptions(invocation: ResolvedRoleInvocation, options?: AgentOptions): AgentOptions;
|
|
31
31
|
export declare function invocationView(invocation: ResolvedRoleInvocation, label: string, mode: DsmmInvocationView["mode"], ids?: Pick<DsmmInvocationView, "runId" | "childId" | "jobId">): {
|
|
32
|
-
runId?: string | undefined;
|
|
33
32
|
childId?: string | undefined;
|
|
33
|
+
runId?: string | undefined;
|
|
34
34
|
jobId?: string | undefined;
|
|
35
35
|
role: "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";
|
|
36
36
|
label: string;
|
package/lib/role-policy.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DsmmDelegationCeiling } from "./session-metadata.js";
|
|
1
2
|
import type { ToolRestriction, ToolRuntime, ToolExecution } from "@deepseek-ai/dsh-tools";
|
|
2
3
|
import type { DshAgent, DshContext } from "./dsh-types.js";
|
|
3
4
|
export { allowedRoleChildren } from "./roles.js";
|
|
@@ -10,6 +11,10 @@ export interface DsmmRoleIdentity {
|
|
|
10
11
|
readonly child: boolean;
|
|
11
12
|
readonly epoch: string;
|
|
12
13
|
readonly parent?: DshAgent;
|
|
14
|
+
readonly owner?: DshAgent;
|
|
15
|
+
readonly creatorId?: string;
|
|
16
|
+
readonly maxDepth?: number;
|
|
17
|
+
readonly targetCeiling?: readonly DsmmRoleId[];
|
|
13
18
|
readonly readOnly?: boolean;
|
|
14
19
|
readonly toolFilter?: ToolRestriction;
|
|
15
20
|
readonly preset?: string;
|
|
@@ -25,17 +30,20 @@ export declare function resolveAdmittedDsmmRole(agent: DshAgent, settings: DsmmS
|
|
|
25
30
|
export declare class DsmmRolePolicy {
|
|
26
31
|
private readonly ctx;
|
|
27
32
|
private readonly getSettings;
|
|
28
|
-
private readonly mode;
|
|
29
33
|
private readonly executions;
|
|
30
34
|
private readonly toolCalls;
|
|
31
|
-
constructor(ctx: DshContext, getSettings: DsmmSettingsGetter,
|
|
35
|
+
constructor(ctx: DshContext, getSettings: DsmmSettingsGetter, _mode: DeepworkModeController);
|
|
32
36
|
private agents;
|
|
33
37
|
assertLive(agent: DshAgent): void;
|
|
34
38
|
private selected;
|
|
35
39
|
validateRootRole(agent: DshAgent, admission: DsmmProfileAdmission): void;
|
|
36
40
|
bindChild(agent: DshAgent, parent: DshAgent, admission: DsmmProfileAdmission, invocation: ResolvedRoleInvocation, maximum: number | undefined, toolFilter: ToolRestriction, independentComposition?: boolean): void;
|
|
41
|
+
/** Cold identity is proven by native catalog/descriptor evidence before this binding. */
|
|
42
|
+
bindContinuedChild(agent: DshAgent, owner: DshAgent, admission: DsmmProfileAdmission, invocation: ResolvedRoleInvocation | undefined, ceiling: DsmmDelegationCeiling, maximum: number | undefined, independentComposition: boolean): void;
|
|
43
|
+
maximumDepth(agent: DshAgent, ...limits: Array<number | undefined>): number | undefined;
|
|
44
|
+
delegationCeiling(agent: DshAgent): Pick<DsmmDelegationCeiling, "readOnly" | "allow" | "deny" | "targets" | "maxDepth">;
|
|
37
45
|
/** Ordinary native inheritance captures ceilings without inventing a role invocation. */
|
|
38
|
-
bindInheritedChild(agent: DshAgent, parent: DshAgent, admission: DsmmProfileAdmission, continuation?: boolean): void;
|
|
46
|
+
bindInheritedChild(agent: DshAgent, parent: DshAgent, admission: DsmmProfileAdmission, continuation?: boolean, maximum?: number): void;
|
|
39
47
|
release(agent: DshAgent): void;
|
|
40
48
|
assertModuleAdmission(agent: DshAgent): void;
|
|
41
49
|
identity(agent: DshAgent): DsmmRoleIdentity;
|