@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
package/lib/profile-remote.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { DSMM_RATE_LIMIT_BOUNDS, normalizeRateLimitOverrides, normalizeRateLimitPolicy, normalizeRoutingStrategy } from "./routing-policy.js";
|
|
2
|
+
import { DSMM_MODULE_DESCRIPTORS } from "./modules.js";
|
|
3
|
+
import { parseModelParameterPolicy } from "./model-parameter-policy.js";
|
|
4
|
+
import { DSMM_ROUTE_SOURCES } from "./profile-types.js";
|
|
5
|
+
import { diagnostic, isSafeDiagnosticField, PROFILE_DIAGNOSTIC_REASONS } from "./profile-diagnostics.js";
|
|
6
|
+
import { normalizeModelRouteJson } from "./route-json.js";
|
|
2
7
|
const errorCodes = new Set(["validation", "conflict", "not-found", "lock-timeout", "unsafe-path", "io", "activation", "corrupt-selection", "limit", "busy", "maintenance", "disposed", "not-owned", "unavailable", "cancelled"]);
|
|
3
8
|
const idPattern = /^[a-z0-9][a-z0-9_-]{0,63}$/u;
|
|
4
9
|
const revisionPattern = /^[a-f0-9]{64}$/u;
|
|
@@ -48,13 +53,6 @@ function integer(value, field, maximum = Number.MAX_SAFE_INTEGER) {
|
|
|
48
53
|
fail(field);
|
|
49
54
|
return value;
|
|
50
55
|
}
|
|
51
|
-
function routeText(value, field, maximum) {
|
|
52
|
-
const result = text(value, field, maximum);
|
|
53
|
-
if (result.trim() === "" || /[\u0000-\u001f\u007f]/u.test(result)
|
|
54
|
-
|| new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(new TextEncoder().encode(result)) !== result)
|
|
55
|
-
fail(field);
|
|
56
|
-
return result;
|
|
57
|
-
}
|
|
58
56
|
function role(value) {
|
|
59
57
|
if (typeof value !== "string" || !rolePattern.test(value))
|
|
60
58
|
fail("role");
|
|
@@ -63,6 +61,8 @@ function role(value) {
|
|
|
63
61
|
function object(value, required, optional = []) {
|
|
64
62
|
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
65
63
|
fail("object");
|
|
64
|
+
if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null || Object.getOwnPropertySymbols(value).length || Object.values(Object.getOwnPropertyDescriptors(value)).some(property => !Object.hasOwn(property, "value") || !property.enumerable))
|
|
65
|
+
fail("object");
|
|
66
66
|
const result = value;
|
|
67
67
|
if (Object.keys(result).some((key) => !required.includes(key) && !optional.includes(key))
|
|
68
68
|
|| required.some((key) => !Object.hasOwn(result, key)))
|
|
@@ -72,16 +72,78 @@ function object(value, required, optional = []) {
|
|
|
72
72
|
function optional(value, key, parse) {
|
|
73
73
|
return Object.hasOwn(value, key) ? { [key]: parse(value[key]) } : {};
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
const item = object(value, ["code", "message"], ["field"]);
|
|
75
|
+
export function parseProfileErrorInfo(value) {
|
|
76
|
+
const item = object(value, ["code", "message"], ["field", "reason", "location"]);
|
|
77
77
|
const code = text(item.code, "code");
|
|
78
78
|
if (!errorCodes.has(code))
|
|
79
79
|
fail("code");
|
|
80
|
-
|
|
80
|
+
const reason = item.reason === undefined ? undefined : text(item.reason, "reason", 64);
|
|
81
|
+
if (reason !== undefined && (!Object.hasOwn(PROFILE_DIAGNOSTIC_REASONS, reason) || reason === "blank-label"))
|
|
82
|
+
fail("reason");
|
|
83
|
+
const field = item.field === undefined ? undefined : diagnosticField(item.field);
|
|
84
|
+
return { code: code, message: reason === undefined ? text(item.message, "message", 4096) : `${field ?? "document"}: ${diagnostic(reason, field ?? "document").reason}`,
|
|
85
|
+
...(field === undefined ? {} : { field }), ...(reason === undefined ? {} : { reason: reason }), ...optional(item, "location", diagnosticPosition) };
|
|
86
|
+
}
|
|
87
|
+
const errorInfo = parseProfileErrorInfo;
|
|
88
|
+
function diagnosticField(value) { if (!isSafeDiagnosticField(value))
|
|
89
|
+
fail("field"); return value; }
|
|
90
|
+
function diagnosticPosition(value) {
|
|
91
|
+
const item = object(value, ["offset", "length", "line", "column"]);
|
|
92
|
+
const result = { offset: integer(item.offset, "offset", 128 * 1024), length: integer(item.length, "length", 128 * 1024), line: integer(item.line, "line", 128 * 1024 + 1), column: integer(item.column, "column", 128 * 1024 + 1) };
|
|
93
|
+
if (result.line < 1 || result.column < 1 || result.offset + result.length > 128 * 1024)
|
|
94
|
+
fail("location");
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
export function parseProfileDiagnostic(value) {
|
|
98
|
+
const row = object(value, ["severity", "code", "field", "reason"], ["location"]);
|
|
99
|
+
if (typeof row.code !== "string" || !Object.hasOwn(PROFILE_DIAGNOSTIC_REASONS, row.code))
|
|
100
|
+
fail("diagnostic code");
|
|
101
|
+
const result = diagnostic(row.code, diagnosticField(row.field));
|
|
102
|
+
if (row.severity !== result.severity || row.reason !== result.reason)
|
|
103
|
+
fail("diagnostic severity/reason");
|
|
104
|
+
return { ...result, ...optional(row, "location", diagnosticPosition) };
|
|
105
|
+
}
|
|
106
|
+
function warnings(value) {
|
|
107
|
+
if (!Array.isArray(value) || value.length > 1)
|
|
108
|
+
fail("warnings");
|
|
109
|
+
return value.map(value => {
|
|
110
|
+
const result = parseProfileDiagnostic(value);
|
|
111
|
+
if (result.severity !== "warning" || result.code !== "blank-label" || result.field !== "label")
|
|
112
|
+
fail("warning");
|
|
113
|
+
return result;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export function parseRoleAvailability(value) {
|
|
117
|
+
const row = object(value, ["id", "required", "startupAvailable", "deploymentEnabled", "admitted", "source", "capture"], ["requiredReason", "namedEnabled", "reason"]);
|
|
118
|
+
if (typeof row.source !== "string" || !["defaults", "global", "profile", "named-session"].includes(row.source) || typeof row.capture !== "string" || !["startup", "deployment", "named-session"].includes(row.capture))
|
|
119
|
+
fail("role source/capture");
|
|
120
|
+
if (row.reason !== undefined && (typeof row.reason !== "string" || !["module-off", "deployment-disabled", "startup-unavailable", "profile-disabled", "required-role", "current-root-disabled"].includes(row.reason)))
|
|
121
|
+
fail("role reason");
|
|
122
|
+
if (row.requiredReason !== undefined && (typeof row.requiredReason !== "string" || !["deepwork-planning", "legacy-review"].includes(row.requiredReason)))
|
|
123
|
+
fail("requiredReason");
|
|
124
|
+
return { id: role(row.id), required: boolean(row.required, "required"), startupAvailable: boolean(row.startupAvailable, "startupAvailable"), deploymentEnabled: boolean(row.deploymentEnabled, "deploymentEnabled"), admitted: boolean(row.admitted, "admitted"), source: row.source, capture: row.capture,
|
|
125
|
+
...optional(row, "namedEnabled", value => boolean(value, "namedEnabled")), ...(row.reason === undefined ? {} : { reason: row.reason }), ...(row.requiredReason === undefined ? {} : { requiredReason: row.requiredReason }) };
|
|
126
|
+
}
|
|
127
|
+
function roleAvailabilityList(value) {
|
|
128
|
+
if (!Array.isArray(value) || value.length > 22)
|
|
129
|
+
fail("roles");
|
|
130
|
+
const result = value.map(parseRoleAvailability);
|
|
131
|
+
if (new Set(result.map(role => role.id)).size !== result.length)
|
|
132
|
+
fail("roles");
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
export function parseSubagentRuntimeAdmissionView(value) {
|
|
136
|
+
const row = object(value, ["binding", "deliveryFenceReady", "restartRequired"], ["reason"]);
|
|
137
|
+
if (typeof row.binding !== "string" || !["stock", "dsmm", "unavailable"].includes(row.binding) || row.reason !== undefined && (typeof row.reason !== "string" || !["explicit-composition-required", "duplicate-provider", "authority-not-ready"].includes(row.reason)))
|
|
138
|
+
fail("subagentRuntime");
|
|
139
|
+
const ready = boolean(row.deliveryFenceReady, "deliveryFenceReady");
|
|
140
|
+
if (ready && (row.binding !== "dsmm" || row.reason !== undefined))
|
|
141
|
+
fail("subagentRuntime readiness");
|
|
142
|
+
return { binding: row.binding, deliveryFenceReady: ready, restartRequired: boolean(row.restartRequired, "restartRequired"), ...(row.reason === undefined ? {} : { reason: row.reason }) };
|
|
81
143
|
}
|
|
82
144
|
function readResult(value) {
|
|
83
|
-
const item = object(value, ["id", "revision", "content"], ["label"]);
|
|
84
|
-
return { id: id(item.id), revision: revision(item.revision), content: content(item.content), ...optional(item, "label", (input) => text(input, "label", 120)) };
|
|
145
|
+
const item = object(value, ["id", "revision", "content"], ["label", "warnings"]);
|
|
146
|
+
return { id: id(item.id), revision: revision(item.revision), content: content(item.content), ...optional(item, "label", (input) => text(input, "label", 120)), ...optional(item, "warnings", warnings) };
|
|
85
147
|
}
|
|
86
148
|
function content(value) {
|
|
87
149
|
const result = text(value, "content", 128 * 1024);
|
|
@@ -90,24 +152,25 @@ function content(value) {
|
|
|
90
152
|
return result;
|
|
91
153
|
}
|
|
92
154
|
function snapshot(value) {
|
|
93
|
-
const item = object(value, ["profiles", "selectedId", "appliedRevision", "selectionRevision"], ["selectionError", "roles", "editorDefaults", "origin", "readOnly", "writeRestriction"]);
|
|
155
|
+
const item = object(value, ["profiles", "selectedId", "appliedRevision", "selectionRevision"], ["selectionError", "roles", "editorDefaults", "origin", "readOnly", "writeRestriction", "selectedWarnings"]);
|
|
94
156
|
if (!Array.isArray(item.profiles) || item.profiles.length > 128)
|
|
95
157
|
fail("profiles");
|
|
96
158
|
return {
|
|
97
159
|
profiles: item.profiles.map((input) => {
|
|
98
|
-
const row = object(input, ["id", "revision"], ["label", "error"]);
|
|
99
|
-
return { id: text(row.id, "id", 64), revision: row.revision === null ? null : revision(row.revision), ...optional(row, "label", (input) => text(input, "label", 120)), ...optional(row, "error", errorInfo) };
|
|
160
|
+
const row = object(input, ["id", "revision"], ["label", "error", "warnings"]);
|
|
161
|
+
return { id: text(row.id, "id", 64), revision: row.revision === null ? null : revision(row.revision), ...optional(row, "label", (input) => text(input, "label", 120)), ...optional(row, "error", errorInfo), ...optional(row, "warnings", warnings) };
|
|
100
162
|
}),
|
|
101
163
|
selectedId: item.selectedId === null ? null : id(item.selectedId),
|
|
102
164
|
appliedRevision: item.appliedRevision === null ? null : revision(item.appliedRevision),
|
|
103
165
|
selectionRevision: item.selectionRevision === "unavailable" && Object.hasOwn(item, "selectionError") ? "unavailable" : selectionRevision(item.selectionRevision),
|
|
104
166
|
...optional(item, "selectionError", errorInfo),
|
|
167
|
+
...optional(item, "selectedWarnings", warnings),
|
|
105
168
|
...optional(item, "roles", (input) => {
|
|
106
169
|
if (!Array.isArray(input) || input.length > 22)
|
|
107
170
|
fail("roles");
|
|
108
171
|
const result = input.map((value) => {
|
|
109
|
-
const row = object(value, ["id", "label", "enabled"], ["runtimePolicy"]);
|
|
110
|
-
return { id: role(row.id), label: text(row.label, "label", 120), enabled: boolean(row.enabled, "enabled"), ...optional(row, "runtimePolicy", (input) => {
|
|
172
|
+
const row = object(value, ["id", "label", "enabled"], ["runtimePolicy", "availability"]);
|
|
173
|
+
return { id: role(row.id), label: text(row.label, "label", 120), enabled: boolean(row.enabled, "enabled"), ...optional(row, "availability", parseRoleAvailability), ...optional(row, "runtimePolicy", (input) => {
|
|
111
174
|
const policy = object(input, [], ["strategy", "rateLimit"]);
|
|
112
175
|
return { ...optional(policy, "strategy", normalizeRoutingStrategy), ...optional(policy, "rateLimit", normalizeRateLimitOverrides) };
|
|
113
176
|
}) };
|
|
@@ -117,7 +180,7 @@ function snapshot(value) {
|
|
|
117
180
|
return result;
|
|
118
181
|
}),
|
|
119
182
|
...optional(item, "editorDefaults", runtimePolicy),
|
|
120
|
-
...optional(item, "origin", (input) => { if (!["central", "legacy", "explicit"].includes(
|
|
183
|
+
...optional(item, "origin", (input) => { if (typeof input !== "string" || !["central", "legacy", "explicit"].includes(input))
|
|
121
184
|
fail("origin"); return input; }),
|
|
122
185
|
...optional(item, "readOnly", (input) => boolean(input, "readOnly")),
|
|
123
186
|
...optional(item, "writeRestriction", (input) => text(input, "writeRestriction", 1024)),
|
|
@@ -144,19 +207,56 @@ function rolePolicy(value) {
|
|
|
144
207
|
};
|
|
145
208
|
}
|
|
146
209
|
function modelRoute(value) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
210
|
+
return normalizeModelRouteJson(value);
|
|
211
|
+
}
|
|
212
|
+
function initialRoleRoute(value) {
|
|
213
|
+
const row = object(value, ["status"], ["source", "route", "reason"]);
|
|
214
|
+
if (row.status === "known") {
|
|
215
|
+
object(row, ["status", "source", "route"]);
|
|
216
|
+
if (row.source !== "invocation-capture")
|
|
217
|
+
fail("initialRoute source");
|
|
218
|
+
return { status: "known", source: "invocation-capture", route: modelRoute(row.route) };
|
|
219
|
+
}
|
|
220
|
+
object(row, ["status", "reason"]);
|
|
221
|
+
if (row.status !== "unknown" || row.reason !== "missing-invocation-capture")
|
|
222
|
+
fail("initialRoute reason");
|
|
223
|
+
return { status: "unknown", reason: "missing-invocation-capture" };
|
|
224
|
+
}
|
|
225
|
+
function liveRoleRoute(value) {
|
|
226
|
+
const row = object(value, ["status"], ["source", "route", "reason"]);
|
|
227
|
+
if (row.status === "known") {
|
|
228
|
+
object(row, ["status", "source", "route"]);
|
|
229
|
+
if (row.source !== "own-native-request-header")
|
|
230
|
+
fail("liveRoute source");
|
|
231
|
+
return { status: "known", source: "own-native-request-header", route: modelRoute(row.route) };
|
|
232
|
+
}
|
|
233
|
+
object(row, ["status", "reason"]);
|
|
234
|
+
if (row.status !== "unknown" || typeof row.reason !== "string" || !["no-own-request-header", "invalid-own-request-header", "not-observed"].includes(row.reason))
|
|
235
|
+
fail("liveRoute reason");
|
|
236
|
+
return { status: "unknown", reason: row.reason };
|
|
237
|
+
}
|
|
238
|
+
export function parseDsmmRoleRouteComparison(value) {
|
|
239
|
+
const row = object(jsonData(value), ["childId", "initialRoute", "liveRoute"]);
|
|
240
|
+
return { childId: sessionId(row.childId), initialRoute: initialRoleRoute(row.initialRoute), liveRoute: liveRoleRoute(row.liveRoute) };
|
|
241
|
+
}
|
|
242
|
+
export function parseDsmmInvocationView(value) {
|
|
243
|
+
const row = object(jsonData(value), ["role", "label", "level", "routeSource", "mode"], ["route", "runId", "childId", "jobId", "routeComparison"]);
|
|
244
|
+
if (typeof row.level !== "string" || !["normal", "low", "high", "max"].includes(row.level) || !DSMM_ROUTE_SOURCES.includes(row.routeSource) || typeof row.mode !== "string" || !["one-shot", "continuable"].includes(row.mode))
|
|
245
|
+
fail("invocation");
|
|
246
|
+
const target = role(row.role);
|
|
247
|
+
if (target === "dsmm-orchestrator")
|
|
248
|
+
fail("invocation target");
|
|
249
|
+
const routeComparison = Object.hasOwn(row, "routeComparison") ? parseDsmmRoleRouteComparison(row.routeComparison) : undefined;
|
|
250
|
+
if (routeComparison !== undefined && (!Object.hasOwn(row, "childId") || routeComparison.childId !== row.childId))
|
|
251
|
+
fail("invocation routeComparison childId");
|
|
252
|
+
return { role: target, label: text(row.label, "label", 120), level: row.level, routeSource: row.routeSource, mode: row.mode, ...optional(row, "route", modelRoute), ...optional(row, "runId", sessionId), ...optional(row, "childId", sessionId), ...optional(row, "jobId", sessionId), ...(routeComparison === undefined ? {} : { routeComparison }) };
|
|
153
253
|
}
|
|
154
254
|
function selectionState(value) {
|
|
155
255
|
const item = object(value, ["selectedId", "appliedRevision", "selectionRevision"]);
|
|
156
256
|
return { selectedId: item.selectedId === null ? null : id(item.selectedId), appliedRevision: item.appliedRevision === null ? null : revision(item.appliedRevision), selectionRevision: selectionRevision(item.selectionRevision) };
|
|
157
257
|
}
|
|
158
258
|
function sessionSnapshot(value) {
|
|
159
|
-
const item = object(value, ["sessionId", "globalDefault", "selection", "scope", "admissionEpoch", "switchAllowed"], ["admittedSelection", "switchUnavailableReason", "rolePolicy", "profileModel", "deepwork", "modules", "configuration"]);
|
|
259
|
+
const item = object(value, ["sessionId", "globalDefault", "selection", "scope", "admissionEpoch", "switchAllowed"], ["admittedSelection", "switchUnavailableReason", "rolePolicy", "profileModel", "deepwork", "modules", "configuration", "warnings", "roles", "subagentRuntime"]);
|
|
160
260
|
if (typeof item.scope !== "string" || !["global-default", "session-override", "deployment-baseline"].includes(item.scope))
|
|
161
261
|
fail("scope");
|
|
162
262
|
return {
|
|
@@ -172,6 +272,9 @@ function sessionSnapshot(value) {
|
|
|
172
272
|
...optional(item, "profileModel", modelRoute),
|
|
173
273
|
...optional(item, "modules", moduleStates),
|
|
174
274
|
...optional(item, "configuration", admissionView),
|
|
275
|
+
...optional(item, "warnings", warnings),
|
|
276
|
+
...optional(item, "roles", roleAvailabilityList),
|
|
277
|
+
...optional(item, "subagentRuntime", parseSubagentRuntimeAdmissionView),
|
|
175
278
|
...optional(item, "deepwork", (input) => {
|
|
176
279
|
const mode = object(input, ["active", "explicit", "locked", "revision"]);
|
|
177
280
|
return { active: boolean(mode.active, "active"), explicit: boolean(mode.explicit, "explicit"), locked: boolean(mode.locked, "locked"), revision: revision(mode.revision) };
|
|
@@ -201,7 +304,7 @@ function modeSelectRequest(value) {
|
|
|
201
304
|
return { sessionId: sessionId(item.sessionId), active: boolean(item.active, "active"), expectedModeRevision: revision(item.expectedModeRevision), expectedAdmissionEpoch: revision(item.expectedAdmissionEpoch) };
|
|
202
305
|
}
|
|
203
306
|
function codec(symbol, parse) {
|
|
204
|
-
return { mode: "strict", typeSymbol: `@dsmm/dsmm#${symbol}`, create: () => ({ parse }) };
|
|
307
|
+
return { mode: "strict", typeSymbol: `@dsmm/dsmm#${symbol}`, create: () => ({ parse: value => parse(jsonData(value)) }) };
|
|
205
308
|
}
|
|
206
309
|
function descriptor(method, result, parameter) {
|
|
207
310
|
return { id: `@dsmm/dsmm#dsmmProfiles/${method}`, service: "dsmmProfiles", namespace: "dsmmProfiles", method, invocation: { kind: "direct" }, parameters: parameter === undefined ? [] : [{ name: parameter.name, wire: parameter.name, source: "json", codec: parameter.codec }], result };
|
|
@@ -215,8 +318,19 @@ function jsonData(value, depth = 0, active = new Set()) {
|
|
|
215
318
|
return value;
|
|
216
319
|
if (typeof value !== "object" || value === null || active.has(value))
|
|
217
320
|
fail("JSON value");
|
|
218
|
-
if (
|
|
321
|
+
if (Array.isArray(value) ? Object.getPrototypeOf(value) !== Array.prototype : Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)
|
|
219
322
|
fail("JSON object");
|
|
323
|
+
if (Object.getOwnPropertySymbols(value).length)
|
|
324
|
+
fail("JSON symbols");
|
|
325
|
+
const properties = Object.getOwnPropertyDescriptors(value);
|
|
326
|
+
for (const [key, property] of Object.entries(properties)) {
|
|
327
|
+
if (Array.isArray(value) && key === "length")
|
|
328
|
+
continue;
|
|
329
|
+
if (!Object.hasOwn(property, "value") || !property.enumerable || Array.isArray(value) && !/^(0|[1-9][0-9]*)$/u.test(key))
|
|
330
|
+
fail("JSON property");
|
|
331
|
+
}
|
|
332
|
+
if (Array.isArray(value) && Object.keys(value).length !== value.length)
|
|
333
|
+
fail("JSON array holes");
|
|
220
334
|
active.add(value);
|
|
221
335
|
const result = Array.isArray(value) ? value.map((child) => jsonData(child, depth + 1, active)) : Object.fromEntries(Object.entries(value).map(([key, child]) => {
|
|
222
336
|
if (["__proto__", "prototype", "constructor"].includes(key))
|
|
@@ -232,7 +346,7 @@ function globalSnapshot(value) {
|
|
|
232
346
|
return { config: jsonData(row.config), revision: selectionRevision(row.revision) };
|
|
233
347
|
}
|
|
234
348
|
function admissionView(value) {
|
|
235
|
-
const row = object(value, ["settings", "sources", "captures", "restartRequired", "named"]);
|
|
349
|
+
const row = object(value, ["settings", "sources", "captures", "restartRequired", "named"], ["modelParameterPolicy"]);
|
|
236
350
|
object(row.settings, [], Object.keys(row.settings));
|
|
237
351
|
for (const key of ["sources", "captures"]) {
|
|
238
352
|
const map = object(row[key], [], Object.keys(row[key]));
|
|
@@ -245,7 +359,7 @@ function admissionView(value) {
|
|
|
245
359
|
if (!Array.isArray(row.restartRequired) || row.restartRequired.length > 256)
|
|
246
360
|
fail("restartRequired");
|
|
247
361
|
const named = row.named === null ? null : object(row.named, ["id", "revision"]);
|
|
248
|
-
return { settings: readOnlySettingsData(row.settings), sources: jsonData(row.sources),
|
|
362
|
+
return { ...optional(row, "modelParameterPolicy", value => parseModelParameterPolicy(jsonData(value))), settings: readOnlySettingsData(row.settings), sources: jsonData(row.sources),
|
|
249
363
|
captures: jsonData(row.captures), restartRequired: row.restartRequired.map(value => text(value, "field", 256)),
|
|
250
364
|
named: named === null ? null : { id: id(named.id), revision: revision(named.revision) } };
|
|
251
365
|
}
|
|
@@ -265,7 +379,9 @@ function readOnlySettingsData(value) {
|
|
|
265
379
|
fail("private environment");
|
|
266
380
|
}
|
|
267
381
|
if (settings.presets !== undefined) {
|
|
268
|
-
const presets = object(settings.presets, ["materialize"], ["root"]);
|
|
382
|
+
const presets = object(settings.presets, ["materialize"], ["root", "plannerRootEnabled"]);
|
|
383
|
+
if (Object.hasOwn(presets, "plannerRootEnabled"))
|
|
384
|
+
boolean(presets.plannerRootEnabled, "presets.plannerRootEnabled");
|
|
269
385
|
if (presets.root !== undefined && presets.root !== "<configured>")
|
|
270
386
|
fail("private directory");
|
|
271
387
|
}
|
|
@@ -310,10 +426,10 @@ function editorSnapshot(value) {
|
|
|
310
426
|
return result;
|
|
311
427
|
}
|
|
312
428
|
function schemaNode(value) {
|
|
313
|
-
const row = object(value, ["type"], ["fields", "inner", "alternatives", "value", "min", "max", "step", "required", "keys", "nonempty"]);
|
|
314
|
-
if (!["object", "dict", "array", "union", "const", "string", "number", "boolean"].includes(
|
|
429
|
+
const row = object(value, ["type"], ["fields", "inner", "alternatives", "value", "min", "max", "step", "required", "keys", "nonempty", "additionalProperties"]);
|
|
430
|
+
if (typeof row.type !== "string" || !["object", "dict", "array", "union", "const", "string", "number", "boolean"].includes(row.type))
|
|
315
431
|
fail("schema type");
|
|
316
|
-
const node = { type:
|
|
432
|
+
const node = { type: row.type };
|
|
317
433
|
if (row.fields !== undefined)
|
|
318
434
|
node.fields = Object.fromEntries(Object.entries(object(row.fields, [], Object.keys(row.fields))).map(([key, child]) => [key, schemaNode(child)]));
|
|
319
435
|
if (row.inner !== undefined)
|
|
@@ -341,6 +457,11 @@ function schemaNode(value) {
|
|
|
341
457
|
fail("schema nonempty");
|
|
342
458
|
node.nonempty = boolean(row.nonempty, "schema nonempty");
|
|
343
459
|
}
|
|
460
|
+
if (Object.hasOwn(row, "additionalProperties")) {
|
|
461
|
+
if (row.type !== "object" || row.additionalProperties !== "json")
|
|
462
|
+
fail("schema additionalProperties");
|
|
463
|
+
node.additionalProperties = "json";
|
|
464
|
+
}
|
|
344
465
|
if (row.keys !== undefined) {
|
|
345
466
|
if (row.type !== "dict" || !Array.isArray(row.keys) || row.keys.length > 64)
|
|
346
467
|
fail("schema keys");
|
|
@@ -370,22 +491,25 @@ function configDescriptor(method, parameter) {
|
|
|
370
491
|
parameters: parameter === undefined ? [] : [{ name: "request", wire: "request", source: "json", codec: parameter }], result: codec("GlobalConfigSnapshot", globalSnapshot) };
|
|
371
492
|
}
|
|
372
493
|
function moduleStates(value) {
|
|
373
|
-
if (!Array.isArray(value) || value.length !==
|
|
494
|
+
if (!Array.isArray(value) || value.length !== DSMM_MODULE_DESCRIPTORS.length)
|
|
374
495
|
fail("modules");
|
|
496
|
+
const ids = new Set();
|
|
375
497
|
return value.map((value) => {
|
|
376
498
|
const row = object(value, ["descriptor", "hostBundleEnabled", "desired", "startupMounted", "admitted", "nextRoot", "reason", "pending"]);
|
|
377
499
|
const descriptor = object(row.descriptor, ["id", "label", "key"]);
|
|
378
|
-
|
|
500
|
+
const known = DSMM_MODULE_DESCRIPTORS.find(known => known.id === descriptor.id);
|
|
501
|
+
if (known === undefined || descriptor.label !== known.label || descriptor.key !== known.key || row.hostBundleEnabled !== "unknown" || ids.has(known.id))
|
|
379
502
|
fail("module descriptor");
|
|
503
|
+
ids.add(known.id);
|
|
380
504
|
const desired = object(row.desired, ["enabled", "source", "capture"]), next = object(row.nextRoot, ["admitted", "reason"]);
|
|
381
|
-
if (!["defaults", "global"].includes(
|
|
505
|
+
if (typeof desired.source !== "string" || !["defaults", "global", "profile"].includes(desired.source) || typeof desired.capture !== "string" || !["current-global", "admission", "startup"].includes(desired.capture)
|
|
382
506
|
|| ![null, "global-disabled", "restart-required"].includes(next.reason)
|
|
383
507
|
|| ![null, "global-disabled", "restart-required", "captured-off"].includes(row.reason))
|
|
384
508
|
fail("module state");
|
|
385
|
-
return { descriptor: {
|
|
509
|
+
return { descriptor: { ...known }, hostBundleEnabled: "unknown",
|
|
386
510
|
desired: { enabled: boolean(desired.enabled, "desired.enabled"), source: desired.source, capture: desired.capture },
|
|
387
|
-
startupMounted: boolean(row.startupMounted, "startupMounted"), admitted: row.admitted === null ? null : boolean(row.admitted, "admitted"),
|
|
388
|
-
nextRoot: { admitted: boolean(next.admitted, "nextRoot.admitted"), reason: next.reason },
|
|
511
|
+
startupMounted: row.startupMounted === null ? null : boolean(row.startupMounted, "startupMounted"), admitted: row.admitted === null ? null : boolean(row.admitted, "admitted"),
|
|
512
|
+
nextRoot: { admitted: next.admitted === null ? null : boolean(next.admitted, "nextRoot.admitted"), reason: next.reason },
|
|
389
513
|
reason: row.reason, pending: boolean(row.pending, "pending") };
|
|
390
514
|
});
|
|
391
515
|
}
|
package/lib/profile-rpc.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
|
3
3
|
import type { ProfileReadResult, ProfileSaveRequest, ProfileSelectRequest, ProfileSnapshot, SessionModeSelectRequest, SessionProfileSelectRequest, SessionProfileSnapshot } from "./profile-types.js";
|
|
4
4
|
import type { DshAgent } from "./dsh-types.js";
|
|
5
5
|
import type { DsmmDeploymentConfig, GlobalConfigSaveRequest, GlobalConfigSnapshot } from "./deployment-config.js";
|
|
6
|
-
import type { DsmmModuleState } from "./modules.js";
|
|
6
|
+
import type { DsmmModuleState, DsmmMountedPermissionGetter } from "./modules.js";
|
|
7
7
|
import type { DsmmSettings } from "./settings.js";
|
|
8
8
|
import type { DeploymentEditorSnapshot } from "./profile-types.js";
|
|
9
9
|
import type { DsmmProfileRuntime } from "./profile-runtime.js";
|
|
@@ -39,8 +39,9 @@ export declare class DsmmConfigHost extends TypertRemoteService {
|
|
|
39
39
|
private readonly startup?;
|
|
40
40
|
private readonly runtime?;
|
|
41
41
|
private readonly startupSources?;
|
|
42
|
+
private readonly getMountedPermission?;
|
|
42
43
|
private readonly lifetime;
|
|
43
|
-
constructor(ctx: Context, backend: DsmmDeploymentConfig, startup?: DsmmSettings | undefined, runtime?: (() => DsmmProfileRuntime | undefined) | undefined, startupSources?: Record<string, string> | undefined);
|
|
44
|
+
constructor(ctx: Context, backend: DsmmDeploymentConfig, startup?: DsmmSettings | undefined, runtime?: (() => DsmmProfileRuntime | undefined) | undefined, startupSources?: Record<string, string> | undefined, getMountedPermission?: DsmmMountedPermissionGetter | undefined);
|
|
44
45
|
private captureReadAuthority;
|
|
45
46
|
describeSettings(): Promise<DeploymentEditorSnapshot>;
|
|
46
47
|
describe(): Promise<GlobalConfigSnapshot>;
|
|
@@ -56,5 +57,5 @@ declare module "@deepseek-ai/cordis" {
|
|
|
56
57
|
/** The caller supplies the owned injection fiber; withdrawal stays native. */
|
|
57
58
|
export declare function registerProfilesRpc(ctx: Context, backend: ProfilesBackend, deployment?: DsmmDeploymentConfig): DsmmProfilesHost;
|
|
58
59
|
/** Core-owned injection; works without any DW or profile business service. */
|
|
59
|
-
export declare function registerConfigRpc(ctx: Context, deployment: DsmmDeploymentConfig, startup: DsmmSettings, runtime?: () => DsmmProfileRuntime | undefined, startupSources?: Record<string, string
|
|
60
|
+
export declare function registerConfigRpc(ctx: Context, deployment: DsmmDeploymentConfig, startup: DsmmSettings, runtime?: () => DsmmProfileRuntime | undefined, startupSources?: Record<string, string>, getMountedPermission?: DsmmMountedPermissionGetter): DsmmConfigHost;
|
|
60
61
|
//# sourceMappingURL=profile-rpc.d.ts.map
|
package/lib/profile-rpc.js
CHANGED
|
@@ -35,9 +35,9 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
35
35
|
import { symbols } from "@deepseek-ai/cordis";
|
|
36
36
|
import { Remote, RemoteError, TypertRemoteService, remoteErrorOf } from "@deepseek-ai/dsh-typert-protocol";
|
|
37
37
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
38
|
-
import { TYPERT_HOST } from "./profile-remote.js";
|
|
38
|
+
import { parseProfileErrorInfo, TYPERT_HOST } from "./profile-remote.js";
|
|
39
39
|
import { DsmmProfileError, profileErrorInfo } from "./profiles.js";
|
|
40
|
-
import {
|
|
40
|
+
import { projectDsmmModules } from "./modules.js";
|
|
41
41
|
import { DEFAULT_DSMM_SETTINGS, deploymentEditorSchema } from "./settings.js";
|
|
42
42
|
import { readOnlySettings, readOnlySettingSources } from "./status.js";
|
|
43
43
|
/** Business service addressed only by native Typert Gateway invocations. */
|
|
@@ -87,7 +87,7 @@ let DsmmProfilesHost = (() => {
|
|
|
87
87
|
return await operation();
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
|
-
throw new RemoteError("dsmm-profiles/refused", "The Host refused the profile operation.", profileErrorInfo(error));
|
|
90
|
+
throw new RemoteError("dsmm-profiles/refused", "The Host refused the profile operation.", parseProfileErrorInfo(profileErrorInfo(error)));
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
describe() { return this.invoke(() => this.backend.describe()); }
|
|
@@ -230,13 +230,15 @@ let DsmmConfigHost = (() => {
|
|
|
230
230
|
startup;
|
|
231
231
|
runtime;
|
|
232
232
|
startupSources;
|
|
233
|
+
getMountedPermission;
|
|
233
234
|
lifetime = new AbortController();
|
|
234
|
-
constructor(ctx, backend, startup, runtime, startupSources) {
|
|
235
|
+
constructor(ctx, backend, startup, runtime, startupSources, getMountedPermission) {
|
|
235
236
|
super(ctx, "dsmmConfig");
|
|
236
237
|
this.backend = backend;
|
|
237
238
|
this.startup = startup;
|
|
238
239
|
this.runtime = runtime;
|
|
239
240
|
this.startupSources = startupSources;
|
|
241
|
+
this.getMountedPermission = getMountedPermission;
|
|
240
242
|
ctx.effect(() => () => this.lifetime.abort());
|
|
241
243
|
}
|
|
242
244
|
captureReadAuthority() {
|
|
@@ -269,10 +271,10 @@ let DsmmConfigHost = (() => {
|
|
|
269
271
|
startup: { ...readOnlySettings(this.startup) }, defaults: DEFAULT_DSMM_SETTINGS,
|
|
270
272
|
...(this.startupSources === undefined ? {} : { startupSources: readOnlySettingSources(this.startupSources) }),
|
|
271
273
|
schema: deploymentEditorSchema(), nextRoot: runtime?.previewDeployment(desired) ?? null,
|
|
272
|
-
modules:
|
|
274
|
+
modules: projectDsmmModules(this.startup, desired, undefined, true, this.getMountedPermission) };
|
|
273
275
|
}
|
|
274
276
|
catch (error) {
|
|
275
|
-
throw new RemoteError("dsmm-profiles/refused", "The Host refused the deployment operation.", profileErrorInfo(error));
|
|
277
|
+
throw new RemoteError("dsmm-profiles/refused", "The Host refused the deployment operation.", parseProfileErrorInfo(profileErrorInfo(error)));
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
280
|
async describe() {
|
|
@@ -283,7 +285,7 @@ let DsmmConfigHost = (() => {
|
|
|
283
285
|
return snapshot;
|
|
284
286
|
}
|
|
285
287
|
catch (error) {
|
|
286
|
-
throw new RemoteError("dsmm-profiles/refused", "The Host refused the deployment operation.", profileErrorInfo(error));
|
|
288
|
+
throw new RemoteError("dsmm-profiles/refused", "The Host refused the deployment operation.", parseProfileErrorInfo(profileErrorInfo(error)));
|
|
287
289
|
}
|
|
288
290
|
}
|
|
289
291
|
async describeModules() {
|
|
@@ -293,10 +295,10 @@ let DsmmConfigHost = (() => {
|
|
|
293
295
|
throw new DsmmProfileError("unavailable", "The startup module capture is unavailable.");
|
|
294
296
|
const desired = await this.backend.readDesired();
|
|
295
297
|
assertAuthority();
|
|
296
|
-
return
|
|
298
|
+
return projectDsmmModules(this.startup, desired, undefined, true, this.getMountedPermission);
|
|
297
299
|
}
|
|
298
300
|
catch (error) {
|
|
299
|
-
throw new RemoteError("dsmm-profiles/refused", "The Host refused the deployment operation.", profileErrorInfo(error));
|
|
301
|
+
throw new RemoteError("dsmm-profiles/refused", "The Host refused the deployment operation.", parseProfileErrorInfo(profileErrorInfo(error)));
|
|
300
302
|
}
|
|
301
303
|
}
|
|
302
304
|
async save(request) {
|
|
@@ -315,7 +317,7 @@ let DsmmConfigHost = (() => {
|
|
|
315
317
|
return await this.backend.saveGlobal(request, assertAuthority);
|
|
316
318
|
}
|
|
317
319
|
catch (error) {
|
|
318
|
-
throw new RemoteError("dsmm-profiles/refused", "The Host refused the deployment operation.", profileErrorInfo(error));
|
|
320
|
+
throw new RemoteError("dsmm-profiles/refused", "The Host refused the deployment operation.", parseProfileErrorInfo(profileErrorInfo(error)));
|
|
319
321
|
}
|
|
320
322
|
}
|
|
321
323
|
};
|
|
@@ -330,8 +332,8 @@ export function registerProfilesRpc(ctx, backend, deployment) {
|
|
|
330
332
|
return service;
|
|
331
333
|
}
|
|
332
334
|
/** Core-owned injection; works without any DW or profile business service. */
|
|
333
|
-
export function registerConfigRpc(ctx, deployment, startup, runtime, startupSources) {
|
|
334
|
-
const service = new DsmmConfigHost(ctx, deployment, startup, runtime, startupSources);
|
|
335
|
+
export function registerConfigRpc(ctx, deployment, startup, runtime, startupSources, getMountedPermission) {
|
|
336
|
+
const service = new DsmmConfigHost(ctx, deployment, startup, runtime, startupSources, getMountedPermission);
|
|
335
337
|
ctx.typert.register(TYPERT_HOST);
|
|
336
338
|
return service;
|
|
337
339
|
}
|
package/lib/profile-runtime.d.ts
CHANGED
|
@@ -5,8 +5,14 @@ import type { DsmmProfileDocument } from "./profiles.js";
|
|
|
5
5
|
import type { DsmmProfileAdmission, DsmmSettings, DsmmSettingsGetter } from "./settings.js";
|
|
6
6
|
import { DeepworkModeController } from "./state.js";
|
|
7
7
|
import type { DsmmDeploymentSnapshot } from "./settings.js";
|
|
8
|
+
import type { DsmmMountedPermissionGetter } from "./modules.js";
|
|
8
9
|
import type { DeploymentAdmissionView } from "./profile-types.js";
|
|
10
|
+
import type { ChildAdmissionCompletion, DsmmChildAdmissionAuthority, LegacyChildEvidenceReader, ParentAdmissionTicket } from "./child-admission-contract.js";
|
|
11
|
+
import type { ChildAdmissionCapture, ChildAdmissionEvidence, PreparedChildAdmission } from "./child-capture.js";
|
|
9
12
|
export interface DsmmProfileRuntimeStore {
|
|
13
|
+
createChildAdmission?(capture: ChildAdmissionCapture, assertCurrent?: () => void): Promise<ChildAdmissionCapture>;
|
|
14
|
+
readChildAdmission?(childId: string, parentId: string): Promise<ChildAdmissionCapture | null>;
|
|
15
|
+
deleteChildAdmission?(childId: string, parentId: string): Promise<void>;
|
|
10
16
|
readonly readOnly?: boolean;
|
|
11
17
|
readonly origin?: "central" | "legacy" | "explicit";
|
|
12
18
|
readonly writeRestriction?: string;
|
|
@@ -25,12 +31,28 @@ export interface DsmmProfileRuntimeStore {
|
|
|
25
31
|
}>;
|
|
26
32
|
}
|
|
27
33
|
export interface DsmmProfileRuntimeOptions {
|
|
34
|
+
/** Separate Host-owned central sidecars keep legacy profile libraries read-only. */
|
|
35
|
+
childCaptureStore?: Pick<DsmmProfileRuntimeStore, "createChildAdmission" | "readChildAdmission" | "deleteChildAdmission">;
|
|
36
|
+
childAuthority?: DsmmChildAdmissionAuthority;
|
|
37
|
+
/** Exact entry identity bound by the stable Host authority; never wire input. */
|
|
38
|
+
childAuthorityOwner?: object;
|
|
39
|
+
childAdmission?: ChildAdmissionCompletion;
|
|
40
|
+
/** Pure role/ceiling validation before awaited candidate checks and before commit; never publishes identity or authority. */
|
|
41
|
+
validateRootRole?: (agent: DshAgent, admission: DsmmProfileAdmission) => void;
|
|
42
|
+
/** Host session substrate decides this; resident mode makes no restart claim. */
|
|
43
|
+
childCapturePersistence?: "durable" | "resident";
|
|
44
|
+
/** Parent composition may enable its bound policy after guards exist, before retained Agents are admitted. */
|
|
45
|
+
onAdmissionGuardsInstalled?: (runtime: DsmmProfileRuntime) => void | Promise<void>;
|
|
46
|
+
/** Core startup admits roots first; the Host DW continuation completes retained controlled children. */
|
|
47
|
+
deferRetainedChildren?: boolean;
|
|
28
48
|
/** Trusted test/integration seam, never a wire-supplied path or callback. */
|
|
29
49
|
validateCandidate?: (settings: DsmmSettings) => void | Promise<void>;
|
|
30
50
|
modeController?: DeepworkModeController;
|
|
31
51
|
/** Awaited once per new ordinary root; never used by children or idle switches. */
|
|
32
52
|
readDesired?: () => Promise<DsmmDeploymentSnapshot>;
|
|
33
53
|
startup?: DsmmDeploymentSnapshot;
|
|
54
|
+
/** Read the current live Host controller's mounted status; unknown/retired is null. */
|
|
55
|
+
getMountedPermission?: DsmmMountedPermissionGetter;
|
|
34
56
|
/** Frozen actual native startup substrate; omission is the trusted legacy seam. */
|
|
35
57
|
subagentCapabilities?: {
|
|
36
58
|
backgroundJobs: boolean;
|
|
@@ -45,6 +67,7 @@ export declare class DsmmProfileRuntime {
|
|
|
45
67
|
private readonly ctx;
|
|
46
68
|
private readonly store;
|
|
47
69
|
private readonly options;
|
|
70
|
+
readonly childCaptureStore: Pick<DsmmProfileRuntimeStore, "createChildAdmission" | "readChildAdmission" | "deleteChildAdmission">;
|
|
48
71
|
readonly getSettings: DsmmSettingsGetter;
|
|
49
72
|
private current;
|
|
50
73
|
private currentDocument;
|
|
@@ -53,12 +76,17 @@ export declare class DsmmProfileRuntime {
|
|
|
53
76
|
private readonly admitting;
|
|
54
77
|
private readonly disposedAgents;
|
|
55
78
|
private readonly switching;
|
|
79
|
+
private readonly admissionObservers;
|
|
56
80
|
private disposed;
|
|
57
81
|
private selectionQueue;
|
|
58
82
|
private readonly mode;
|
|
59
83
|
constructor(ctx: DshContext, baseline: DsmmSettings, store: DsmmProfileRuntimeStore, options?: DsmmProfileRuntimeOptions);
|
|
60
84
|
initialize(): Promise<void>;
|
|
61
85
|
admission(agent?: DshAgent): AdmittedProfile;
|
|
86
|
+
/** Host enrollment observes completed exact admissions, never an entered but unpublished policy. */
|
|
87
|
+
hasAdmission(agent: DshAgent): boolean;
|
|
88
|
+
observeAdmissions(observer: (agent: DshAgent) => void | Promise<void>): () => void;
|
|
89
|
+
private announceAdmission;
|
|
62
90
|
getSession(agent: DshAgent): Promise<SessionProfileSnapshot>;
|
|
63
91
|
/** The fourth argument is trusted native caller authority, never wire data. */
|
|
64
92
|
selectMode(request: SessionModeSelectRequest, agent: DshAgent, signal?: AbortSignal, assertAuthority?: () => void): Promise<SessionProfileSnapshot>;
|
|
@@ -80,10 +108,21 @@ export declare class DsmmProfileRuntime {
|
|
|
80
108
|
private declaredProfileModel;
|
|
81
109
|
private agents;
|
|
82
110
|
private bind;
|
|
83
|
-
private bindChild;
|
|
84
111
|
private owner;
|
|
85
112
|
private assertRoot;
|
|
113
|
+
/** Host-only awaited completion for fresh, retained and cold exact Agents; no execution occurs here. */
|
|
114
|
+
completeAdmission(agent: DshAgent, signal?: AbortSignal, startup?: DsmmDeploymentSnapshot): Promise<DsmmProfileAdmission>;
|
|
86
115
|
private admit;
|
|
116
|
+
/** Awaited native creation completion: evidence + persistence + role identity + exact-parent authority. */
|
|
117
|
+
completeChildAdmission(agent: DshAgent, parent: DshAgent, prepared: PreparedChildAdmission, signal?: AbortSignal): Promise<void>;
|
|
118
|
+
/** C's scoped resolver callback: original resident/durable evidence, then explicit trusted legacy folds. */
|
|
119
|
+
resolveOriginalChildEvidence(ticket: ParentAdmissionTicket, childId: string, signal: AbortSignal, readLegacy?: LegacyChildEvidenceReader): Promise<ChildAdmissionEvidence>;
|
|
120
|
+
private assertOwnedParentTicket;
|
|
121
|
+
private subagentRuntimeView;
|
|
122
|
+
private assertDeliveryFence;
|
|
123
|
+
private assertRootRole;
|
|
124
|
+
private validateRootRole;
|
|
125
|
+
private roleAvailability;
|
|
87
126
|
private validate;
|
|
88
127
|
}
|
|
89
128
|
/** No guessed home fallback: native deployment context owns this directory. */
|