@dsmm/dsmm 0.2.0 → 0.2.2
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 +38 -66
- package/agent-presets/dsmm-builder/agent.cordis.yml +10 -2015
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +24 -343
- package/agent-presets/dsmm-code-search/agent.cordis.yml +19 -6
- package/agent-presets/dsmm-coding/agent.cordis.yml +19 -438
- package/agent-presets/dsmm-complex/agent.cordis.yml +23 -1009
- package/agent-presets/dsmm-creative/agent.cordis.yml +25 -442
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +29 -1013
- package/agent-presets/dsmm-deep/agent.cordis.yml +24 -1008
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +19 -6
- package/agent-presets/dsmm-documenting/agent.cordis.yml +26 -439
- package/agent-presets/dsmm-frontend/agent.cordis.yml +21 -440
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +22 -441
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +19 -6
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +19 -438
- package/agent-presets/dsmm-oracle/agent.cordis.yml +25 -340
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +25 -340
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +29 -2025
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +24 -341
- package/agent-presets/dsmm-planner/agent.cordis.yml +14 -344
- package/agent-presets/dsmm-quick/agent.cordis.yml +19 -6
- package/agent-presets/dsmm-research/agent.cordis.yml +23 -8
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +25 -340
- package/docs/agent-presets.md +36 -52
- package/docs/compatibility.md +50 -108
- package/docs/deferred-native-approval-risk.md +19 -0
- package/docs/design.md +2 -2
- package/docs/lsp.md +11 -21
- package/docs/migration-from-ocmm.md +2 -2
- package/docs/model-routing.md +84 -59
- package/docs/native-permissions.md +35 -0
- package/docs/profiles.md +40 -87
- package/docs/releasing.md +83 -2
- package/docs/roadmap.md +71 -17
- package/docs/settings-status.md +34 -169
- package/docs/skill-sync.md +52 -15
- package/lib/child-admission-contract.d.ts +37 -0
- package/lib/child-admission-contract.js +2 -0
- package/lib/child-admission.d.ts +42 -0
- package/lib/child-admission.js +162 -0
- package/lib/child-capture.d.ts +81 -0
- package/lib/child-capture.js +203 -0
- package/lib/child-evidence.d.ts +17 -0
- package/lib/child-evidence.js +43 -0
- package/lib/client/ChildrenPanel.d.ts +43 -0
- package/lib/client/ChildrenPanel.js +82 -0
- package/lib/client/DeploymentPage.js +15 -8
- package/lib/client/EditableChoice.d.ts +17 -0
- package/lib/client/EditableChoice.js +49 -0
- package/lib/client/PermissionsPanel.d.ts +14 -0
- package/lib/client/PermissionsPanel.js +46 -0
- package/lib/client/ProfilesSection.js +30 -15
- package/lib/client/RoleAvailability.d.ts +7 -0
- package/lib/client/RoleAvailability.js +19 -0
- package/lib/client/SessionProfiles.js +27 -9
- package/lib/client/StructuredEditor.js +15 -7
- package/lib/client/children-controller.d.ts +98 -0
- package/lib/client/children-controller.js +296 -0
- package/lib/client/children-locales.d.ts +367 -0
- package/lib/client/children-locales.js +69 -0
- package/lib/client/controller.d.ts +6 -1
- package/lib/client/controller.js +14 -8
- package/lib/client/deployment-data.d.ts +2 -1
- package/lib/client/deployment-data.js +34 -5
- package/lib/client/deployment-locales.d.ts +4 -0
- package/lib/client/deployment-locales.js +11 -2
- package/lib/client/diagnostics.d.ts +14 -0
- package/lib/client/diagnostics.js +53 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +96 -2
- package/lib/client/locales.d.ts +54 -0
- package/lib/client/locales.js +34 -16
- package/lib/client/permission-client.d.ts +16 -0
- package/lib/client/permission-client.js +38 -0
- package/lib/client/permission-controller.d.ts +62 -0
- package/lib/client/permission-controller.js +149 -0
- package/lib/client/permission-locales.d.ts +114 -0
- package/lib/client/permission-locales.js +75 -0
- package/lib/client/session-labels.js +4 -4
- package/lib/client/structured.js +19 -5
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +20 -0
- package/lib/client.js +5780 -1679
- package/lib/core-permission-authority.d.ts +18 -0
- package/lib/core-permission-authority.js +255 -0
- package/lib/core-permissions.d.ts +8 -0
- package/lib/core-permissions.js +33 -0
- package/lib/delivery-authority.d.ts +68 -0
- package/lib/delivery-authority.js +260 -0
- package/lib/deployment-config.d.ts +23 -0
- package/lib/deployment-config.js +61 -40
- package/lib/deployment-permission-rules.d.ts +55 -0
- package/lib/deployment-permission-rules.js +306 -0
- package/lib/dsh-types.d.ts +10 -4
- package/lib/guards.d.ts +1 -1
- package/lib/guards.js +29 -8
- package/lib/host-llm-startup.d.ts +41 -0
- package/lib/host-llm-startup.js +65 -0
- package/lib/host-llm.d.ts +92 -0
- package/lib/host-llm.js +325 -0
- package/lib/index.d.ts +15 -4
- package/lib/index.js +300 -47
- package/lib/legacy-child-policy.d.ts +51 -0
- package/lib/legacy-child-policy.js +123 -0
- package/lib/legacy-read-composition.d.ts +20 -0
- package/lib/legacy-read-composition.js +144 -0
- package/lib/legacy-read-contracts.d.ts +157 -0
- package/lib/legacy-read-contracts.js +39 -0
- package/lib/legacy-read-host.d.ts +19 -0
- package/lib/legacy-read-host.js +67 -0
- package/lib/legacy-read-integration.d.ts +121 -0
- package/lib/legacy-read-integration.js +522 -0
- package/lib/legacy-read-proxy.d.ts +26 -0
- package/lib/legacy-read-proxy.js +237 -0
- package/lib/live-pi-ai-owner.d.ts +18 -0
- package/lib/live-pi-ai-owner.js +144 -0
- package/lib/llm-runtime.d.ts +11 -0
- package/lib/llm-runtime.js +21 -0
- package/lib/managed-settings.d.ts +5 -0
- package/lib/managed-settings.js +14 -0
- package/lib/model-parameter-policy.d.ts +11 -0
- package/lib/model-parameter-policy.js +27 -0
- package/lib/model-routing.js +28 -17
- package/lib/modules.d.ts +13 -5
- package/lib/modules.js +17 -1
- package/lib/native-child-evidence.d.ts +42 -0
- package/lib/native-child-evidence.js +133 -0
- package/lib/native-pi-ai-wire.d.ts +37 -0
- package/lib/native-pi-ai-wire.js +261 -0
- package/lib/native-scope.js +1 -1
- package/lib/permission-bash.d.ts +6 -0
- package/lib/permission-bash.js +7 -0
- package/lib/permission-control.d.ts +73 -0
- package/lib/permission-control.js +205 -0
- package/lib/permission-controller.d.ts +68 -0
- package/lib/permission-controller.js +317 -0
- package/lib/permission-errors.d.ts +7 -0
- package/lib/permission-errors.js +21 -0
- package/lib/permission-fs-search.d.ts +5 -0
- package/lib/permission-fs-search.js +7 -0
- package/lib/permission-fs.d.ts +5 -0
- package/lib/permission-fs.js +7 -0
- package/lib/permission-native-access.d.ts +11 -0
- package/lib/permission-native-access.js +6 -0
- package/lib/permission-native-command.d.ts +10 -0
- package/lib/permission-native-command.js +93 -0
- package/lib/permission-native-rules.d.ts +75 -0
- package/lib/permission-native-rules.js +278 -0
- package/lib/permission-pwsh.d.ts +6 -0
- package/lib/permission-pwsh.js +7 -0
- package/lib/permission-remote.d.ts +26 -0
- package/lib/permission-remote.js +53 -0
- package/lib/permission-rpc.d.ts +29 -0
- package/lib/permission-rpc.js +152 -0
- package/lib/permission-rules.d.ts +115 -0
- package/lib/permission-rules.js +256 -0
- package/lib/permission-settings.d.ts +45 -0
- package/lib/permission-settings.js +48 -0
- package/lib/permission-shell.d.ts +38 -0
- package/lib/permission-shell.js +150 -0
- package/lib/permission-web.d.ts +5 -0
- package/lib/permission-web.js +7 -0
- package/lib/preset-registry.js +36 -25
- package/lib/profile-diagnostics.d.ts +45 -0
- package/lib/profile-diagnostics.js +148 -0
- package/lib/profile-locale.d.ts +3 -0
- package/lib/profile-locale.js +2 -0
- package/lib/profile-remote.d.ts +8 -0
- package/lib/profile-remote.js +163 -39
- package/lib/profile-rpc.d.ts +4 -3
- package/lib/profile-rpc.js +14 -12
- package/lib/profile-runtime.d.ts +40 -1
- package/lib/profile-runtime.js +368 -93
- package/lib/profile-store.d.ts +11 -0
- package/lib/profile-store.js +143 -11
- package/lib/profile-types.d.ts +70 -1
- package/lib/profile-types.js +1 -0
- package/lib/profiles.d.ts +16 -2
- package/lib/profiles.js +156 -79
- package/lib/prompt-content.js +1 -1
- package/lib/prompts.d.ts +37 -2
- package/lib/prompts.js +111 -9
- package/lib/recovery-policy.js +20 -7
- package/lib/role-control-remote.d.ts +38 -0
- package/lib/role-control-remote.js +211 -0
- package/lib/role-control-rpc.d.ts +51 -0
- package/lib/role-control-rpc.js +377 -0
- package/lib/role-control-types.d.ts +92 -0
- package/lib/role-control-types.js +8 -0
- package/lib/role-invocation.d.ts +47 -0
- package/lib/role-invocation.js +135 -0
- package/lib/role-llm-runtime.d.ts +17 -0
- package/lib/role-llm-runtime.js +62 -0
- package/lib/role-llm.d.ts +31 -0
- package/lib/role-llm.js +66 -0
- package/lib/role-policy.d.ts +49 -8
- package/lib/role-policy.js +437 -60
- package/lib/role-providers.d.ts +1 -1
- package/lib/role-providers.js +30 -35
- package/lib/role-routing.d.ts +11 -2
- package/lib/role-routing.js +42 -25
- package/lib/role-runs.d.ts +135 -0
- package/lib/role-runs.js +304 -0
- package/lib/role-subagents.d.ts +58 -3
- package/lib/role-subagents.js +169 -56
- package/lib/roles.d.ts +5 -6
- package/lib/roles.js +10 -39
- package/lib/route-json.d.ts +19 -0
- package/lib/route-json.js +129 -0
- package/lib/routing-policy.d.ts +2 -0
- package/lib/routing-policy.js +12 -2
- package/lib/runtime-integration.d.ts +112 -0
- package/lib/runtime-integration.js +784 -0
- package/lib/runtime-recovery.js +18 -8
- package/lib/settings.d.ts +47 -13
- package/lib/settings.js +217 -82
- package/lib/skills.js +2 -2
- package/lib/status.d.ts +10 -1
- package/lib/status.js +11 -8
- package/lib/subagent-runtime.d.ts +45 -0
- package/lib/subagent-runtime.js +131 -0
- package/package.json +106 -56
- package/patches/subagent-runtime.yml +15 -0
- package/prompts/deepseek-flash.md +1 -1
- package/prompts/deepseek-v4-pro.md +2 -2
- package/prompts/deepwork.md +27 -18
- package/prompts/source/agents/clarifier.md +5 -3
- package/prompts/source/agents/orchestrator.md +18 -9
- package/prompts/source/agents/plan-critic.md +5 -1
- package/prompts/source/agents/planner.md +4 -2
- package/prompts/source/agents/reviewer.md +6 -0
- package/prompts/source/category/complex.md +4 -4
- package/prompts/source/category/creative.md +6 -4
- package/prompts/source/category/cross-cutting.md +10 -8
- package/prompts/source/category/deep.md +5 -3
- package/prompts/source/category/documenting.md +7 -1
- package/prompts/source/category/frontend.md +2 -2
- package/prompts/source/category/hard-reasoning.md +3 -3
- package/prompts/source/category/research.md +4 -2
- package/prompts/source/deepwork/claude-opus-5.md +2 -2
- package/prompts/source/deepwork/codex.md +1 -1
- package/prompts/source/deepwork/default.md +22 -15
- package/prompts/source/deepwork/gemini.md +23 -16
- package/prompts/source/deepwork/glm.md +21 -14
- package/prompts/source/deepwork/gpt.md +12 -6
- package/prompts/source/deepwork/planner.md +8 -5
- package/prompts/source/manifest.json +178 -63
- package/prompts/source/shared/dsh-host-contract.md +5 -3
- package/prompts/source/shared/locale.md +2 -2
- package/prompts/source/terminal/orchestrator.md +1 -1
- package/scripts/cold-profile-composition.mjs +329 -0
- package/scripts/cold-profile-sources.mjs +238 -0
- package/scripts/migrate-cold-profile.mjs +315 -0
- package/skills/ast-grep/SKILL.md +7 -4
- package/skills/brainstorming/SKILL.md +43 -22
- package/skills/coding-agent-sessions/SKILL.md +7 -4
- package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -46
- package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -130
- package/skills/debugging/SKILL.md +14 -9
- package/skills/debugging/references/methodology/00-setup.md +14 -62
- package/skills/debugging/references/methodology/02-investigate.md +4 -4
- package/skills/debugging/references/methodology/03-flaky-triage.md +3 -3
- package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +2 -14
- package/skills/debugging/references/methodology/06-fix.md +6 -6
- package/skills/debugging/references/methodology/08-qa.md +5 -5
- package/skills/debugging/references/methodology/09-cleanup.md +15 -153
- package/skills/debugging/references/methodology/partial-runtime-evidence.md +3 -16
- package/skills/debugging/references/runtimes/bundled-js-binary.md +1 -16
- package/skills/debugging/references/runtimes/native-binary.md +9 -54
- package/skills/debugging/references/runtimes/node.md +4 -15
- package/skills/debugging/references/runtimes/python.md +3 -15
- package/skills/debugging/references/runtimes/rust.md +2 -18
- package/skills/debugging/references/tools/dap.md +1 -1
- package/skills/debugging/references/tools/ghidra.md +4 -15
- package/skills/debugging/references/tools/playwright-cli.md +3 -15
- package/skills/debugging/references/tools/pwntools.md +4 -16
- package/skills/dispatching-parallel-agents/SKILL.md +18 -16
- package/skills/frontend/SKILL.md +7 -4
- package/skills/frontend/references/design/react-dev-tooling-skill.md +1 -1
- package/skills/git-master/SKILL.md +7 -4
- package/skills/init-deep/SKILL.md +7 -4
- package/skills/receiving-code-review/SKILL.md +17 -12
- package/skills/remove-ai-slops/SKILL.md +39 -38
- package/skills/requesting-code-review/SKILL.md +19 -17
- package/skills/requesting-code-review/code-reviewer.md +13 -1
- package/skills/subagent-driven-development/SKILL.md +29 -26
- package/skills/subagent-driven-development/implementer-prompt.md +29 -11
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +6 -1
- package/skills/using-git-worktrees/SKILL.md +7 -4
- package/skills/writing-plans/SKILL.md +29 -24
- package/skills/writing-plans/plan-document-reviewer-prompt.md +10 -1
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import { symbols } from "@deepseek-ai/cordis";
|
|
36
|
+
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
37
|
+
import { SubagentError } from "@deepseek-ai/dsh-subagent";
|
|
38
|
+
import { Remote, RemoteError, TypertRemoteService, remoteErrorOf } from "@deepseek-ai/dsh-typert-protocol";
|
|
39
|
+
import { scopeLifetime } from "./delivery-authority.js";
|
|
40
|
+
import { ROLE_CONTROL_HOST, parseChildSessionSnapshot, parseRoleControlBackgroundRequest, parseRoleControlCapabilities, parseRoleControlDescendants, parseRoleControlErrorInfo, parseRoleControlInterruptRequest, parseRoleControlPromptRequest, parseRoleControlSessionId } from "./role-control-remote.js";
|
|
41
|
+
import { parseDsmmInvocationView, parseDsmmRoleRouteComparison } from "./profile-remote.js";
|
|
42
|
+
class ControlRefusal extends Error {
|
|
43
|
+
info;
|
|
44
|
+
constructor(code, field, reason) {
|
|
45
|
+
super("The Host refused the child control operation.");
|
|
46
|
+
this.info = { code, ...(field === undefined ? {} : { field }), ...(reason === undefined ? {} : { reason }) };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const disabled = (reason) => ({ enabled: false, reason });
|
|
50
|
+
function requireEnabled(value) { if (!value.enabled)
|
|
51
|
+
throw new ControlRefusal("disabled", undefined, value.reason); }
|
|
52
|
+
function original(value) { return Reflect.get(value, symbols.original) ?? value; }
|
|
53
|
+
function terminalTransition(state, runId) {
|
|
54
|
+
return state === "settled" ? { status: "already-settled", runId } : state === "cancelled" ? { status: "cancelled", runId } : undefined;
|
|
55
|
+
}
|
|
56
|
+
function boundedChildLabel(label) {
|
|
57
|
+
const high = label.charCodeAt(119), low = label.charCodeAt(120);
|
|
58
|
+
// Preserve the UTF-16 wire bound without splitting a valid native code point.
|
|
59
|
+
const end = high >= 0xd800 && high <= 0xdbff && low >= 0xdc00 && low <= 0xdfff ? 119 : 120;
|
|
60
|
+
return label.slice(0, end).replace(/[\u0000-\u001f\u007f]/gu, " ");
|
|
61
|
+
}
|
|
62
|
+
/** Separate namespace: native inbox/jobs remain the sole execution owners. */
|
|
63
|
+
let DsmmChildrenHost = (() => {
|
|
64
|
+
let _classSuper = TypertRemoteService;
|
|
65
|
+
let _instanceExtraInitializers = [];
|
|
66
|
+
let _describe_decorators;
|
|
67
|
+
let _descendants_decorators;
|
|
68
|
+
let _background_decorators;
|
|
69
|
+
let _prompt_decorators;
|
|
70
|
+
let _interrupt_decorators;
|
|
71
|
+
return class DsmmChildrenHost extends _classSuper {
|
|
72
|
+
static {
|
|
73
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
74
|
+
_describe_decorators = [Remote];
|
|
75
|
+
_descendants_decorators = [Remote];
|
|
76
|
+
_background_decorators = [Remote];
|
|
77
|
+
_prompt_decorators = [Remote];
|
|
78
|
+
_interrupt_decorators = [Remote];
|
|
79
|
+
__esDecorate(this, null, _describe_decorators, { kind: "method", name: "describe", static: false, private: false, access: { has: obj => "describe" in obj, get: obj => obj.describe }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
80
|
+
__esDecorate(this, null, _descendants_decorators, { kind: "method", name: "descendants", static: false, private: false, access: { has: obj => "descendants" in obj, get: obj => obj.descendants }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
81
|
+
__esDecorate(this, null, _background_decorators, { kind: "method", name: "background", static: false, private: false, access: { has: obj => "background" in obj, get: obj => obj.background }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
82
|
+
__esDecorate(this, null, _prompt_decorators, { kind: "method", name: "prompt", static: false, private: false, access: { has: obj => "prompt" in obj, get: obj => obj.prompt }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
83
|
+
__esDecorate(this, null, _interrupt_decorators, { kind: "method", name: "interrupt", static: false, private: false, access: { has: obj => "interrupt" in obj, get: obj => obj.interrupt }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
84
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
85
|
+
}
|
|
86
|
+
lifetime = (__runInitializers(this, _instanceExtraInitializers), new AbortController());
|
|
87
|
+
backgroundJobs = new WeakMap();
|
|
88
|
+
collaborators;
|
|
89
|
+
constructor(ctx, collaborators) {
|
|
90
|
+
super(ctx, "dsmmChildren");
|
|
91
|
+
this.collaborators = collaborators;
|
|
92
|
+
scopeLifetime(ctx, "dsmm.children: close scoped controls", () => this.lifetime.abort());
|
|
93
|
+
}
|
|
94
|
+
async invoke(operation) {
|
|
95
|
+
try {
|
|
96
|
+
return await operation();
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
let info;
|
|
100
|
+
if (error instanceof ControlRefusal)
|
|
101
|
+
info = error.info;
|
|
102
|
+
else {
|
|
103
|
+
const code = String(remoteErrorOf(error)?.code ?? (error instanceof SubagentError ? error.code : ""));
|
|
104
|
+
if (["gateway/cancelled", "ABORTED"].includes(code) || error instanceof Error && error.name === "AbortError")
|
|
105
|
+
info = { code: "cancelled" };
|
|
106
|
+
else if (["subagent/unauthorized", "UNAUTHORIZED"].includes(code))
|
|
107
|
+
info = { code: "not-owned" };
|
|
108
|
+
else if (["subagent/not-resumable", "NOT_RESUMABLE"].includes(code))
|
|
109
|
+
info = { code: "not-resumable", field: "childSessionId" };
|
|
110
|
+
else if (code === "subagent/attachment-invalid" || code === "gateway/bad-request")
|
|
111
|
+
info = { code: "invalid-content", field: "content" };
|
|
112
|
+
else if (code === "subagent/invalid-time-zone")
|
|
113
|
+
info = { code: "invalid-time-zone", field: "clientTimeZone" };
|
|
114
|
+
else
|
|
115
|
+
info = { code: "unavailable" };
|
|
116
|
+
}
|
|
117
|
+
// Do not forward SDK messages, details, causes, paths, content or secrets.
|
|
118
|
+
throw new RemoteError("dsmm-children/refused", "The Host refused the child control operation.", parseRoleControlErrorInfo(info));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
decode(parse, value) {
|
|
122
|
+
try {
|
|
123
|
+
return parse(value);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
throw new ControlRefusal("validation", "request");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async scoped(sessionId, readOnly, operation) {
|
|
130
|
+
const invocation = this.ctx.invocation;
|
|
131
|
+
const connection = this.ctx.get("connection");
|
|
132
|
+
if (invocation?.peer === undefined || connection === undefined || connection.operator !== invocation.peer)
|
|
133
|
+
throw new ControlRefusal("not-owned");
|
|
134
|
+
const connectionOwner = original(connection);
|
|
135
|
+
const runtime = this.collaborators.runtime;
|
|
136
|
+
if (!runtime.authority.view().deliveryFenceReady)
|
|
137
|
+
throw new ControlRefusal("unavailable", undefined, "delivery-fence-unavailable");
|
|
138
|
+
const browserSignal = runtime.authority.acquireBrowserSignal(this.ctx);
|
|
139
|
+
const initialSignal = AbortSignal.any([invocation.signal, browserSignal, this.lifetime.signal]);
|
|
140
|
+
const checkConnection = () => {
|
|
141
|
+
if (initialSignal.aborted)
|
|
142
|
+
throw new ControlRefusal("cancelled");
|
|
143
|
+
const current = this.ctx.get("connection");
|
|
144
|
+
if (current === undefined || original(current) !== connectionOwner || current.operator !== invocation.peer)
|
|
145
|
+
throw new ControlRefusal("not-owned");
|
|
146
|
+
const bound = this.ctx.get("subagents");
|
|
147
|
+
if (bound === undefined || original(bound) !== original(runtime))
|
|
148
|
+
throw new ControlRefusal("unavailable", undefined, "delivery-fence-unavailable");
|
|
149
|
+
};
|
|
150
|
+
checkConnection();
|
|
151
|
+
const agents = this.ctx.get("agents");
|
|
152
|
+
if (agents === undefined)
|
|
153
|
+
throw new ControlRefusal("unavailable");
|
|
154
|
+
let parent = agents.get(SessionId(sessionId));
|
|
155
|
+
if (parent === undefined) {
|
|
156
|
+
// Actions never wake an ordinary parent. Only an authenticated, decoded
|
|
157
|
+
// read may use the public controller; Gateway parameter lookup cannot.
|
|
158
|
+
if (!readOnly)
|
|
159
|
+
throw new ControlRefusal("unavailable", "sessionId");
|
|
160
|
+
const controller = this.ctx.get("sessionController");
|
|
161
|
+
if (controller === undefined)
|
|
162
|
+
throw new ControlRefusal("unavailable", "sessionId");
|
|
163
|
+
const found = await controller.resolveAgent(SessionId(sessionId));
|
|
164
|
+
checkConnection();
|
|
165
|
+
if ("error" in found)
|
|
166
|
+
throw new ControlRefusal("unavailable", "sessionId");
|
|
167
|
+
parent = found.agent;
|
|
168
|
+
}
|
|
169
|
+
const exactParent = parent;
|
|
170
|
+
const checkRoot = () => {
|
|
171
|
+
checkConnection();
|
|
172
|
+
const current = this.ctx.get("agents");
|
|
173
|
+
if (current === undefined || current.get(SessionId(sessionId)) !== exactParent || exactParent.id !== sessionId || exactParent.session.id !== sessionId
|
|
174
|
+
|| exactParent.session.header.origin === "subagent" || !current.roots().includes(exactParent)
|
|
175
|
+
|| current.list().some(owner => owner !== exactParent && current.isOwnedBy(SessionId(sessionId), owner)))
|
|
176
|
+
throw new ControlRefusal("not-owned", "sessionId");
|
|
177
|
+
};
|
|
178
|
+
checkRoot();
|
|
179
|
+
const ticket = runtime.authority.acquireParentTicket(exactParent);
|
|
180
|
+
const signal = AbortSignal.any([initialSignal, ticket.signal]);
|
|
181
|
+
const scope = { parent: exactParent, ticket, signal, check() {
|
|
182
|
+
if (signal.aborted)
|
|
183
|
+
throw new ControlRefusal("cancelled");
|
|
184
|
+
checkRoot();
|
|
185
|
+
runtime.authority.assertTicket(ticket);
|
|
186
|
+
} };
|
|
187
|
+
scope.check();
|
|
188
|
+
let result;
|
|
189
|
+
try {
|
|
190
|
+
result = await operation(scope);
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
if (signal.aborted)
|
|
194
|
+
throw new ControlRefusal("cancelled");
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
// Native acceptance/handoff owns the write cutoff. Never turn a committed
|
|
198
|
+
// receipt into a failure, rollback accepted work or automatically retry.
|
|
199
|
+
if (readOnly)
|
|
200
|
+
scope.check();
|
|
201
|
+
return result;
|
|
202
|
+
}
|
|
203
|
+
capabilities(scope) {
|
|
204
|
+
scope.check();
|
|
205
|
+
const view = parseRoleControlCapabilities(this.collaborators.capabilities(scope.ticket));
|
|
206
|
+
const runtime = this.collaborators.runtime.authority.view();
|
|
207
|
+
scope.check();
|
|
208
|
+
return { ...view, runtime };
|
|
209
|
+
}
|
|
210
|
+
async childView(scope, entry, parentSessionId = scope.parent.id) {
|
|
211
|
+
scope.check();
|
|
212
|
+
const direct = parentSessionId === scope.parent.id;
|
|
213
|
+
const inactive = this.ctx.get("agents")?.get(entry.id)?.status !== "running";
|
|
214
|
+
const observation = direct ? await this.collaborators.observeChild(scope.ticket, entry, scope.signal) : undefined;
|
|
215
|
+
scope.check();
|
|
216
|
+
const reason = !direct ? "not-direct-child" : entry.mode === "one-shot" ? "one-shot" : "unknown-mode";
|
|
217
|
+
const global = this.capabilities(scope);
|
|
218
|
+
const controls = entry.mode === "continuable" && observation !== undefined
|
|
219
|
+
? { prompt: global.prompt.enabled ? observation.prompt : global.prompt, interrupt: global.interrupt.enabled ? observation.interrupt : global.interrupt }
|
|
220
|
+
: { prompt: disabled(reason), interrupt: disabled(reason) };
|
|
221
|
+
const projected = observation?.invocation === undefined ? undefined : parseDsmmInvocationView(observation.invocation);
|
|
222
|
+
const routeComparison = observation?.routeComparison === undefined ? undefined : parseDsmmRoleRouteComparison(observation.routeComparison);
|
|
223
|
+
if (projected?.childId !== undefined && projected.childId !== entry.id)
|
|
224
|
+
throw new ControlRefusal("unavailable", "childSessionId");
|
|
225
|
+
if (routeComparison !== undefined && routeComparison.childId !== entry.id)
|
|
226
|
+
throw new ControlRefusal("unavailable", "childSessionId");
|
|
227
|
+
return { id: entry.id, parentSessionId, mode: entry.mode, activity: inactive ? "inactive" : "running", readonly: !controls.prompt.enabled && !controls.interrupt.enabled,
|
|
228
|
+
...(entry.label === undefined ? {} : { label: boundedChildLabel(entry.label) }), controls,
|
|
229
|
+
...(projected === undefined ? {} : { invocation: { ...projected, childId: entry.id } }),
|
|
230
|
+
...(routeComparison === undefined ? {} : { routeComparison }),
|
|
231
|
+
...(observation?.evidence === undefined ? {} : { evidence: observation.evidence }) };
|
|
232
|
+
}
|
|
233
|
+
async runView(scope, holder) {
|
|
234
|
+
scope.check();
|
|
235
|
+
const identity = holder.invocation;
|
|
236
|
+
const background = identity === undefined ? disabled(holder.state === "cancelled" ? "cancelled" : "starting")
|
|
237
|
+
: await this.collaborators.backgroundAvailability(scope.ticket, identity, scope.signal);
|
|
238
|
+
scope.check();
|
|
239
|
+
const current = holder.invocation;
|
|
240
|
+
let invocation;
|
|
241
|
+
if (current !== undefined) {
|
|
242
|
+
const { runId: _run, childId: _child, jobId: _job, ...projected } = parseDsmmInvocationView(this.collaborators.projectRun(current));
|
|
243
|
+
const jobId = this.backgroundJobs.get(holder);
|
|
244
|
+
invocation = parseDsmmInvocationView({ ...projected, mode: "one-shot", runId: current.runId,
|
|
245
|
+
...(current.childId === undefined ? {} : { childId: current.childId }), ...(jobId === undefined ? {} : { jobId }) });
|
|
246
|
+
}
|
|
247
|
+
const globalBackground = this.capabilities(scope).background;
|
|
248
|
+
return { sessionId: holder.sessionId, toolCallId: holder.toolCallId, state: holder.state, ...(invocation === undefined ? {} : { invocation }),
|
|
249
|
+
background: holder.state === "starting" ? disabled("starting") : holder.state === "settled" ? disabled("already-settled") : holder.state === "cancelled" ? disabled("cancelled")
|
|
250
|
+
: holder.state === "background" ? disabled("already-background") : globalBackground.enabled ? background : globalBackground };
|
|
251
|
+
}
|
|
252
|
+
describe(sessionId) {
|
|
253
|
+
return this.invoke(() => this.scoped(this.decode(parseRoleControlSessionId, sessionId), true, async (scope) => {
|
|
254
|
+
const catalog = await this.collaborators.runtime.listChildren(scope.parent.id, scope.signal);
|
|
255
|
+
scope.check();
|
|
256
|
+
const children = [], runs = [];
|
|
257
|
+
for (const child of catalog)
|
|
258
|
+
children.push(await this.childView(scope, child));
|
|
259
|
+
scope.check();
|
|
260
|
+
for (const holder of this.collaborators.runs.list(scope.parent, scope.ticket.owner))
|
|
261
|
+
runs.push(await this.runView(scope, holder));
|
|
262
|
+
scope.check();
|
|
263
|
+
return parseChildSessionSnapshot({ sessionId: scope.parent.id, admissionEpoch: scope.ticket.parentEpoch, children, runs, capabilities: this.capabilities(scope) });
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
descendants(sessionId) {
|
|
267
|
+
return this.invoke(() => this.scoped(this.decode(parseRoleControlSessionId, sessionId), true, async (scope) => {
|
|
268
|
+
const catalog = await this.collaborators.runtime.listDescendants(scope.parent.id, scope.signal);
|
|
269
|
+
scope.check();
|
|
270
|
+
const descendants = [];
|
|
271
|
+
for (const entry of catalog) {
|
|
272
|
+
scope.check();
|
|
273
|
+
if (entry.kind === "diagnostic")
|
|
274
|
+
descendants.push({ kind: "diagnostic", id: entry.id, parentSessionId: entry.parentId, depth: entry.depth, reason: entry.reason });
|
|
275
|
+
else {
|
|
276
|
+
const child = await this.childView(scope, { id: entry.id, mode: entry.mode, createdAt: 0, ...("label" in entry ? { label: entry.label } : {}) }, entry.parentId);
|
|
277
|
+
descendants.push({ kind: "child", depth: entry.depth, hasChildren: entry.hasChildren, child: { ...child, activity: entry.activity } });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return parseRoleControlDescendants({ sessionId: scope.parent.id, admissionEpoch: scope.ticket.parentEpoch, descendants });
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
283
|
+
background(sessionId, input) {
|
|
284
|
+
return this.invoke(async () => {
|
|
285
|
+
const request = this.decode(parseRoleControlBackgroundRequest, input);
|
|
286
|
+
if (request.sessionId !== this.decode(parseRoleControlSessionId, sessionId))
|
|
287
|
+
throw new ControlRefusal("validation", "sessionId");
|
|
288
|
+
return this.scoped(sessionId, false, async (scope) => {
|
|
289
|
+
if (request.expectedAdmissionEpoch !== scope.ticket.parentEpoch)
|
|
290
|
+
throw new ControlRefusal("conflict", "expectedAdmissionEpoch");
|
|
291
|
+
const holder = this.collaborators.runs.get(scope.parent, scope.ticket.owner, { sessionId: scope.parent.id,
|
|
292
|
+
toolCallId: request.toolCallId, runId: request.runId });
|
|
293
|
+
if (holder?.invocation === undefined)
|
|
294
|
+
throw new ControlRefusal("not-found", "runId");
|
|
295
|
+
const terminal = terminalTransition(holder.state, holder.invocation.runId);
|
|
296
|
+
if (terminal !== undefined) {
|
|
297
|
+
scope.check();
|
|
298
|
+
return terminal;
|
|
299
|
+
}
|
|
300
|
+
requireEnabled(this.capabilities(scope).background);
|
|
301
|
+
const permitted = await this.collaborators.backgroundAvailability(scope.ticket, holder.invocation, scope.signal);
|
|
302
|
+
scope.check();
|
|
303
|
+
// Result/cancellation may win while asynchronous capability preparation
|
|
304
|
+
// is pending. Observing that terminal state never creates a new job.
|
|
305
|
+
const observed = terminalTransition(holder.state, holder.invocation.runId);
|
|
306
|
+
if (observed !== undefined)
|
|
307
|
+
return observed;
|
|
308
|
+
requireEnabled(permitted);
|
|
309
|
+
// All async preparation is fenced before the holder's native synchronous
|
|
310
|
+
// jobs.start critical section, which rechecks its own exact authority.
|
|
311
|
+
const result = holder.background({ parent: scope.parent, owner: scope.ticket.owner, sessionId: scope.parent.id,
|
|
312
|
+
toolCallId: holder.toolCallId, runId: holder.invocation.runId, expectedAdmissionEpoch: request.expectedAdmissionEpoch });
|
|
313
|
+
if ("receipt" in result) {
|
|
314
|
+
this.backgroundJobs.set(holder, result.receipt.jobId);
|
|
315
|
+
return { status: result.status, runId: result.receipt.invocation.runId, jobId: result.receipt.jobId };
|
|
316
|
+
}
|
|
317
|
+
if (result.status === "starting")
|
|
318
|
+
throw new ControlRefusal("disabled", undefined, "starting");
|
|
319
|
+
return { status: result.status, runId: request.runId };
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
async directChild(scope, childId) {
|
|
324
|
+
scope.check();
|
|
325
|
+
const catalog = await this.collaborators.runtime.listChildren(scope.parent.id, scope.signal);
|
|
326
|
+
scope.check();
|
|
327
|
+
const child = catalog.find(child => child.id === childId);
|
|
328
|
+
if (child === undefined)
|
|
329
|
+
throw new ControlRefusal("not-owned", "childSessionId");
|
|
330
|
+
if (child.mode !== "continuable")
|
|
331
|
+
throw new ControlRefusal("not-resumable", "childSessionId");
|
|
332
|
+
return this.childView(scope, child);
|
|
333
|
+
}
|
|
334
|
+
prompt(sessionId, input) {
|
|
335
|
+
return this.invoke(async () => {
|
|
336
|
+
const request = this.decode(parseRoleControlPromptRequest, input);
|
|
337
|
+
if (request.parentSessionId !== this.decode(parseRoleControlSessionId, sessionId))
|
|
338
|
+
throw new ControlRefusal("validation", "parentSessionId");
|
|
339
|
+
return this.scoped(sessionId, false, async (scope) => {
|
|
340
|
+
requireEnabled(this.capabilities(scope).prompt);
|
|
341
|
+
const child = await this.directChild(scope, request.childSessionId);
|
|
342
|
+
scope.check();
|
|
343
|
+
requireEnabled(child.controls.prompt);
|
|
344
|
+
if (request.content.some(part => part.type === "image"))
|
|
345
|
+
requireEnabled(this.capabilities(scope).images);
|
|
346
|
+
scope.check();
|
|
347
|
+
// Original browser request identity, content, images, zone and delivery
|
|
348
|
+
// enter the unique C1 public override, then native pre-inbox cutoff.
|
|
349
|
+
return this.ctx.subagents.prompt(request, scope.signal);
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
interrupt(sessionId, input) {
|
|
354
|
+
return this.invoke(async () => {
|
|
355
|
+
const request = this.decode(parseRoleControlInterruptRequest, input);
|
|
356
|
+
if (request.parentSessionId !== this.decode(parseRoleControlSessionId, sessionId))
|
|
357
|
+
throw new ControlRefusal("validation", "parentSessionId");
|
|
358
|
+
return this.scoped(sessionId, false, async (scope) => {
|
|
359
|
+
requireEnabled(this.capabilities(scope).interrupt);
|
|
360
|
+
const child = await this.directChild(scope, request.childSessionId);
|
|
361
|
+
scope.check();
|
|
362
|
+
requireEnabled(child.controls.interrupt);
|
|
363
|
+
scope.check();
|
|
364
|
+
return this.ctx.subagents.interruptByParent(SessionId(request.childSessionId), scope.parent.id, "continuable");
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
})();
|
|
370
|
+
export { DsmmChildrenHost };
|
|
371
|
+
/** Caller supplies an owned Host injection fiber; no replacement or auto-mount. */
|
|
372
|
+
export function registerRoleControlRpc(ctx, collaborators) {
|
|
373
|
+
const host = new DsmmChildrenHost(ctx, collaborators);
|
|
374
|
+
ctx.typert.register(ROLE_CONTROL_HOST);
|
|
375
|
+
return host;
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=role-control-rpc.js.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** Browser-safe child control vocabulary; no Host or filesystem authority. */
|
|
2
|
+
import type { DsmmInvocationView, DsmmRoleRouteComparison, SubagentRuntimeAdmissionView } from "./profile-types.js";
|
|
3
|
+
import type { ChildAdmissionEvidenceView } from "./child-evidence.js";
|
|
4
|
+
import type { SubagentPromptReceipt, SubagentPromptRequest, SubagentInterruptReceipt } from "@deepseek-ai/dsh-subagent";
|
|
5
|
+
export type { DsmmInvocationView, DsmmRoleRouteComparison, ChildAdmissionEvidenceView, SubagentPromptRequest, SubagentPromptReceipt, SubagentInterruptReceipt };
|
|
6
|
+
export declare const ROLE_CONTROL_DISABLED_REASONS: readonly ["module-off", "role-disabled", "read-only", "background-disabled", "jobs-unavailable", "starting", "already-background", "already-settled", "cancelled", "one-shot", "unknown-mode", "not-direct-child", "delivery-fence-unavailable", "evidence-unavailable", "legacy-capability-denied", "unavailable"];
|
|
7
|
+
export type RoleControlDisabledReason = typeof ROLE_CONTROL_DISABLED_REASONS[number];
|
|
8
|
+
export type RoleControlAvailability = {
|
|
9
|
+
enabled: true;
|
|
10
|
+
} | {
|
|
11
|
+
enabled: false;
|
|
12
|
+
reason: RoleControlDisabledReason;
|
|
13
|
+
};
|
|
14
|
+
export interface RoleControlCapabilities {
|
|
15
|
+
background: RoleControlAvailability;
|
|
16
|
+
prompt: RoleControlAvailability;
|
|
17
|
+
interrupt: RoleControlAvailability;
|
|
18
|
+
/** The native attachment/model admission still validates each image. */
|
|
19
|
+
images: RoleControlAvailability;
|
|
20
|
+
runtime: SubagentRuntimeAdmissionView;
|
|
21
|
+
}
|
|
22
|
+
export interface RoleControlRunView {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
toolCallId: string;
|
|
25
|
+
state: "starting" | "running" | "background" | "settled" | "cancelled";
|
|
26
|
+
/** Absent before the real native run is published. */
|
|
27
|
+
invocation?: DsmmInvocationView;
|
|
28
|
+
background: RoleControlAvailability;
|
|
29
|
+
}
|
|
30
|
+
export interface RoleControlChildView {
|
|
31
|
+
id: string;
|
|
32
|
+
parentSessionId: string;
|
|
33
|
+
mode: "one-shot" | "continuable" | "unknown";
|
|
34
|
+
activity: "running" | "inactive";
|
|
35
|
+
label?: string;
|
|
36
|
+
readonly: boolean;
|
|
37
|
+
invocation?: DsmmInvocationView;
|
|
38
|
+
routeComparison?: DsmmRoleRouteComparison;
|
|
39
|
+
evidence?: ChildAdmissionEvidenceView;
|
|
40
|
+
controls: {
|
|
41
|
+
prompt: RoleControlAvailability;
|
|
42
|
+
interrupt: RoleControlAvailability;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface ChildSessionSnapshot {
|
|
46
|
+
sessionId: string;
|
|
47
|
+
admissionEpoch: string;
|
|
48
|
+
runs: RoleControlRunView[];
|
|
49
|
+
children: RoleControlChildView[];
|
|
50
|
+
capabilities: RoleControlCapabilities;
|
|
51
|
+
}
|
|
52
|
+
export type RoleControlDescendantView = {
|
|
53
|
+
kind: "child";
|
|
54
|
+
depth: number;
|
|
55
|
+
hasChildren: boolean;
|
|
56
|
+
child: RoleControlChildView;
|
|
57
|
+
} | {
|
|
58
|
+
kind: "diagnostic";
|
|
59
|
+
id: string;
|
|
60
|
+
parentSessionId: string;
|
|
61
|
+
depth: number;
|
|
62
|
+
reason: "corrupt" | "unsupported" | "unavailable";
|
|
63
|
+
};
|
|
64
|
+
export interface RoleControlDescendantsSnapshot {
|
|
65
|
+
sessionId: string;
|
|
66
|
+
admissionEpoch: string;
|
|
67
|
+
descendants: RoleControlDescendantView[];
|
|
68
|
+
}
|
|
69
|
+
export interface RoleControlBackgroundRequest {
|
|
70
|
+
sessionId: string;
|
|
71
|
+
toolCallId: string;
|
|
72
|
+
runId: string;
|
|
73
|
+
expectedAdmissionEpoch: string;
|
|
74
|
+
}
|
|
75
|
+
export interface BackgroundTransitionResult {
|
|
76
|
+
status: "background" | "already-background" | "already-settled" | "cancelled";
|
|
77
|
+
runId: string;
|
|
78
|
+
jobId?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface RoleControlInterruptRequest {
|
|
81
|
+
parentSessionId: string;
|
|
82
|
+
childSessionId: string;
|
|
83
|
+
mode: "continuable";
|
|
84
|
+
}
|
|
85
|
+
export declare const ROLE_CONTROL_ERROR_CODES: readonly ["validation", "not-owned", "unavailable", "cancelled", "conflict", "not-found", "not-resumable", "invalid-content", "invalid-time-zone", "disabled"];
|
|
86
|
+
export declare const ROLE_CONTROL_ERROR_FIELDS: readonly ["sessionId", "parentSessionId", "childSessionId", "toolCallId", "runId", "expectedAdmissionEpoch", "request", "content", "clientTimeZone"];
|
|
87
|
+
export interface RoleControlErrorInfo {
|
|
88
|
+
code: typeof ROLE_CONTROL_ERROR_CODES[number];
|
|
89
|
+
field?: typeof ROLE_CONTROL_ERROR_FIELDS[number];
|
|
90
|
+
reason?: RoleControlDisabledReason;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=role-control-types.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const ROLE_CONTROL_DISABLED_REASONS = [
|
|
2
|
+
"module-off", "role-disabled", "read-only", "background-disabled", "jobs-unavailable",
|
|
3
|
+
"starting", "already-background", "already-settled", "cancelled", "one-shot", "unknown-mode", "not-direct-child",
|
|
4
|
+
"delivery-fence-unavailable", "evidence-unavailable", "legacy-capability-denied", "unavailable",
|
|
5
|
+
];
|
|
6
|
+
export const ROLE_CONTROL_ERROR_CODES = ["validation", "not-owned", "unavailable", "cancelled", "conflict", "not-found", "not-resumable", "invalid-content", "invalid-time-zone", "disabled"];
|
|
7
|
+
export const ROLE_CONTROL_ERROR_FIELDS = ["sessionId", "parentSessionId", "childSessionId", "toolCallId", "runId", "expectedAdmissionEpoch", "request", "content", "clientTimeZone"];
|
|
8
|
+
//# sourceMappingURL=role-control-types.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Agent, AgentOptions } from "@deepseek-ai/dsh-agent";
|
|
2
|
+
import type { DshAgent } from "./dsh-types.js";
|
|
3
|
+
import type { DsmmRoleId } from "./roles.js";
|
|
4
|
+
import type { DsmmInvocationOptions, DsmmInvocationLevel, DsmmModelRoute, DsmmSettings, DsmmResolvedRoleRuntimePolicy } from "./settings.js";
|
|
5
|
+
import type { DsmmRouteSource, DsmmInvocationView } from "./profile-types.js";
|
|
6
|
+
import type { ChildAdmissionCapture } from "./child-capture.js";
|
|
7
|
+
import type { ResolvedModelParameterPolicy } from "./model-parameter-policy.js";
|
|
8
|
+
export interface ResolvedRoleInvocation {
|
|
9
|
+
readonly target: DsmmRoleId;
|
|
10
|
+
readonly requestedLevel?: DsmmInvocationLevel;
|
|
11
|
+
readonly effectiveLevel: DsmmInvocationLevel;
|
|
12
|
+
readonly routeSource: DsmmRouteSource;
|
|
13
|
+
readonly initialRoute: DsmmModelRoute;
|
|
14
|
+
readonly candidates: readonly DsmmModelRoute[];
|
|
15
|
+
readonly policy: DsmmResolvedRoleRuntimePolicy;
|
|
16
|
+
readonly exactEffort: boolean;
|
|
17
|
+
readonly requestedRoute?: DsmmModelRoute;
|
|
18
|
+
readonly selectedCandidate?: DsmmModelRoute;
|
|
19
|
+
readonly requestedPolicy?: DsmmResolvedRoleRuntimePolicy;
|
|
20
|
+
readonly modelParameterPolicy?: ResolvedModelParameterPolicy;
|
|
21
|
+
readonly effortSource?: "native" | "dsmm-config";
|
|
22
|
+
}
|
|
23
|
+
export declare function duringRoleInvocation<T>(parent: DshAgent, invocation: ResolvedRoleInvocation, operation: () => T): T;
|
|
24
|
+
export declare function currentRoleInvocation(parent: DshAgent, target: DsmmRoleId): ResolvedRoleInvocation | undefined;
|
|
25
|
+
export declare function bindRoleInvocation(agent: DshAgent, invocation: ResolvedRoleInvocation, original: ChildAdmissionCapture | undefined): void;
|
|
26
|
+
export declare function capturedRoleInvocation(agent: DshAgent): ResolvedRoleInvocation | undefined;
|
|
27
|
+
export declare function capturedOriginalRoleInvocation(agent: DshAgent): ChildAdmissionCapture["invocation"] | undefined;
|
|
28
|
+
/** Complete selections replace model and effort together; effort-only selections narrow candidates. */
|
|
29
|
+
export declare function resolveRoleInvocation(parent: Agent, target: DsmmRoleId, settings: DsmmSettings, signal: AbortSignal, options?: DsmmInvocationOptions, nativeOptions?: AgentOptions): Promise<ResolvedRoleInvocation>;
|
|
30
|
+
export declare function invocationAgentOptions(invocation: ResolvedRoleInvocation, options?: AgentOptions): AgentOptions;
|
|
31
|
+
export declare function invocationView(invocation: ResolvedRoleInvocation, label: string, mode: DsmmInvocationView["mode"], ids?: Pick<DsmmInvocationView, "runId" | "childId" | "jobId">): {
|
|
32
|
+
jobId?: string | undefined;
|
|
33
|
+
runId?: string | undefined;
|
|
34
|
+
childId?: string | undefined;
|
|
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
|
+
label: string;
|
|
37
|
+
level: DsmmInvocationLevel;
|
|
38
|
+
routeSource: "primary" | "inherited" | "level" | "invocation-route";
|
|
39
|
+
route: {
|
|
40
|
+
[key: string]: import("./route-json.js").RouteJson;
|
|
41
|
+
provider: string;
|
|
42
|
+
model: string;
|
|
43
|
+
reasoningEffort?: string;
|
|
44
|
+
};
|
|
45
|
+
mode: "one-shot" | "continuable";
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=role-invocation.d.ts.map
|