@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,203 @@
|
|
|
1
|
+
import { copyJson, freezeSettings, resolveConfig, validateSparseConfig } from "./settings.js";
|
|
2
|
+
import { parseModelParameterPolicy } from "./model-parameter-policy.js";
|
|
3
|
+
import { validateProfileOverlay } from "./profiles.js";
|
|
4
|
+
import { DSMM_ROLE_IDS } from "./roles.js";
|
|
5
|
+
import { CHILD_EVIDENCE_FIELDS } from "./child-evidence.js";
|
|
6
|
+
export { CHILD_EVIDENCE_FIELDS, parseChildAdmissionEvidenceView } from "./child-evidence.js";
|
|
7
|
+
import { DSMM_ROUTE_SOURCES } from "./profile-types.js";
|
|
8
|
+
import { normalizeModelRouteJson } from "./route-json.js";
|
|
9
|
+
export { DSMM_ROUTE_SOURCES } from "./profile-types.js";
|
|
10
|
+
function fail() { throw new TypeError("Invalid child admission data"); }
|
|
11
|
+
function object(value, required, optional = []) {
|
|
12
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
13
|
+
fail();
|
|
14
|
+
const row = value;
|
|
15
|
+
if (required.some(key => !Object.hasOwn(row, key)) || Object.keys(row).some(key => !required.includes(key) && !optional.includes(key)))
|
|
16
|
+
fail();
|
|
17
|
+
return row;
|
|
18
|
+
}
|
|
19
|
+
function text(value, max) {
|
|
20
|
+
if (typeof value !== "string" || !value.length || value.length > max || /[\u0000-\u001f\u007f]/u.test(value) || new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(new TextEncoder().encode(value)) !== value)
|
|
21
|
+
fail();
|
|
22
|
+
}
|
|
23
|
+
function epoch(value) { if (typeof value !== "string" || !/^[a-f0-9]{64}$/u.test(value))
|
|
24
|
+
fail(); }
|
|
25
|
+
function role(value) { if (!DSMM_ROLE_IDS.includes(value) || value === "dsmm-orchestrator")
|
|
26
|
+
fail(); }
|
|
27
|
+
function boolean(value) { if (typeof value !== "boolean")
|
|
28
|
+
fail(); }
|
|
29
|
+
function integer(value) { if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0)
|
|
30
|
+
fail(); }
|
|
31
|
+
function route(value) {
|
|
32
|
+
normalizeModelRouteJson(value);
|
|
33
|
+
}
|
|
34
|
+
function legacyRoute(value) {
|
|
35
|
+
const row = object(value, ["provider", "model"], ["reasoningEffort"]);
|
|
36
|
+
text(row.provider, 128);
|
|
37
|
+
text(row.model, 512);
|
|
38
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/u.test(row.provider) || row.model.includes("://"))
|
|
39
|
+
fail();
|
|
40
|
+
if (Object.hasOwn(row, "reasoningEffort"))
|
|
41
|
+
text(row.reasoningEffort, 64);
|
|
42
|
+
}
|
|
43
|
+
function filter(value) {
|
|
44
|
+
const row = object(value, [], ["allow", "deny"]);
|
|
45
|
+
for (const list of Object.values(row)) {
|
|
46
|
+
if (!Array.isArray(list) || list.length > 256 || new Set(list).size !== list.length)
|
|
47
|
+
fail();
|
|
48
|
+
list.forEach(value => text(value, 128));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function fields(value) {
|
|
52
|
+
if (!Array.isArray(value) || value.length > CHILD_EVIDENCE_FIELDS.length || new Set(value).size !== value.length || value.some(field => !CHILD_EVIDENCE_FIELDS.includes(field)))
|
|
53
|
+
fail();
|
|
54
|
+
}
|
|
55
|
+
function limitations(value) {
|
|
56
|
+
if (!Array.isArray(value) || value.length > CHILD_EVIDENCE_FIELDS.length)
|
|
57
|
+
fail();
|
|
58
|
+
for (const input of value) {
|
|
59
|
+
const row = object(input, ["field", "code", "effect"]);
|
|
60
|
+
if (!CHILD_EVIDENCE_FIELDS.includes(row.field) || typeof row.code !== "string" || !["missing-evidence", "not-persisted", "unverified", "parent-denied"].includes(row.code) || typeof row.effect !== "string" || !["capability-denied", "native-default", "display-only"].includes(row.effect))
|
|
61
|
+
fail();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export function parseLegacyChildEvidence(input) {
|
|
65
|
+
const row = object(copyJson(input), ["version", "mode", "childSessionId", "parentSessionId", "role", "route", "depth", "provenFields", "limitations"], ["toolFilter", "active"]);
|
|
66
|
+
if (row.version !== 1 || row.mode !== "legacy-conservative")
|
|
67
|
+
fail();
|
|
68
|
+
text(row.childSessionId, 256);
|
|
69
|
+
text(row.parentSessionId, 256);
|
|
70
|
+
role(row.role);
|
|
71
|
+
legacyRoute(row.route);
|
|
72
|
+
integer(row.depth);
|
|
73
|
+
if (row.childSessionId === row.parentSessionId)
|
|
74
|
+
fail();
|
|
75
|
+
if (Object.hasOwn(row, "toolFilter"))
|
|
76
|
+
filter(row.toolFilter);
|
|
77
|
+
if (Object.hasOwn(row, "active"))
|
|
78
|
+
boolean(row.active);
|
|
79
|
+
fields(row.provenFields);
|
|
80
|
+
limitations(row.limitations);
|
|
81
|
+
const proven = row.provenFields;
|
|
82
|
+
if (!["lineage", "role", "route"].every(field => proven.includes(field)) || proven.includes("admission-epoch") || proven.includes("profile-pin") || proven.includes("invocation-level"))
|
|
83
|
+
fail();
|
|
84
|
+
if (Object.hasOwn(row, "toolFilter") !== proven.includes("tool-filter") || Object.hasOwn(row, "active") !== proven.includes("active-intent"))
|
|
85
|
+
fail();
|
|
86
|
+
return freezeSettings(row);
|
|
87
|
+
}
|
|
88
|
+
export function parseChildAdmissionCapture(input) {
|
|
89
|
+
const plain = copyJson(input);
|
|
90
|
+
const version = plain?.version;
|
|
91
|
+
if (version !== 1 && version !== 2)
|
|
92
|
+
fail();
|
|
93
|
+
const row = object(plain, ["version", "childSessionId", "parentSessionId", "role", "profilePin", "originalAdmissionEpoch", "invocation", "runtimePolicyCapture", "authorityCeiling", "toolTopology", ...version === 2 ? ["modelParameterPolicy"] : []], ["locale"]);
|
|
94
|
+
if (version === 2)
|
|
95
|
+
parseModelParameterPolicy(row.modelParameterPolicy);
|
|
96
|
+
text(row.childSessionId, 256);
|
|
97
|
+
text(row.parentSessionId, 256);
|
|
98
|
+
role(row.role);
|
|
99
|
+
epoch(row.originalAdmissionEpoch);
|
|
100
|
+
if (row.childSessionId === row.parentSessionId)
|
|
101
|
+
fail();
|
|
102
|
+
if (row.profilePin !== null) {
|
|
103
|
+
const pin = object(row.profilePin, ["id", "revision"]);
|
|
104
|
+
if (typeof pin.id !== "string" || !/^[a-z0-9][a-z0-9_-]{0,63}$/u.test(pin.id) || /^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])$/iu.test(pin.id))
|
|
105
|
+
fail();
|
|
106
|
+
epoch(pin.revision);
|
|
107
|
+
}
|
|
108
|
+
const invocation = object(row.invocation, ["level", "initialRoute", "routeSource", ...version === 2 ? ["requestedRoute", "effortSource"] : []]);
|
|
109
|
+
if (typeof invocation.level !== "string" || !["normal", "low", "high", "max"].includes(invocation.level) || !DSMM_ROUTE_SOURCES.includes(invocation.routeSource))
|
|
110
|
+
fail();
|
|
111
|
+
(version === 1 ? legacyRoute : route)(invocation.initialRoute);
|
|
112
|
+
if (version === 2) {
|
|
113
|
+
route(invocation.requestedRoute);
|
|
114
|
+
if (invocation.effortSource !== "native" && invocation.effortSource !== "dsmm-config")
|
|
115
|
+
fail();
|
|
116
|
+
}
|
|
117
|
+
const policyKeys = ["modules", "roleRouting", "runtimePolicy", "workflow", "guards", "runtimeRecovery", "defaultActive", "deepseekV4ProCalibration", "deepseekV4ProDefaultReasoningEffort", "deepseekFlashCalibration", "deepseekFlashDefaultReasoningEffort", "skills", "subagents"];
|
|
118
|
+
const policy = object(row.runtimePolicyCapture, policyKeys);
|
|
119
|
+
if (version === 1)
|
|
120
|
+
validateLegacyRoutes(policy);
|
|
121
|
+
const { modules, skills, subagents, ...overlay } = policy;
|
|
122
|
+
validateProfileOverlay(overlay);
|
|
123
|
+
object(modules, ["deepwork"]);
|
|
124
|
+
boolean(object(modules.deepwork, ["enabled"]).enabled);
|
|
125
|
+
const skillMap = object(skills, CAPTURE_SKILLS);
|
|
126
|
+
Object.values(skillMap).forEach(boolean);
|
|
127
|
+
const background = object(subagents, ["enableRunInBackground", "backgroundMode"]);
|
|
128
|
+
boolean(background.enableRunInBackground);
|
|
129
|
+
if (typeof background.backgroundMode !== "string" || !["one-shot", "continuable"].includes(background.backgroundMode))
|
|
130
|
+
fail();
|
|
131
|
+
const ceiling = object(row.authorityCeiling, ["roles", "readOnly", "allowRouteOverride", "maxDepth"], ["toolFilter"]);
|
|
132
|
+
if (!Array.isArray(ceiling.roles) || ceiling.roles.length > DSMM_ROLE_IDS.length || new Set(ceiling.roles).size !== ceiling.roles.length || ceiling.roles.some(role => !DSMM_ROLE_IDS.includes(role)))
|
|
133
|
+
fail();
|
|
134
|
+
boolean(ceiling.readOnly);
|
|
135
|
+
boolean(ceiling.allowRouteOverride);
|
|
136
|
+
integer(ceiling.maxDepth);
|
|
137
|
+
if (Object.hasOwn(ceiling, "toolFilter"))
|
|
138
|
+
filter(ceiling.toolFilter);
|
|
139
|
+
if (!ceiling.roles.includes(row.role) || !modules.deepwork.enabled)
|
|
140
|
+
fail();
|
|
141
|
+
if (typeof row.toolTopology !== "string" || !["per-role", "parameterized"].includes(row.toolTopology))
|
|
142
|
+
fail();
|
|
143
|
+
validateSparseConfig({ ...policy, ...(Object.hasOwn(row, "locale") ? { locale: row.locale } : {}), subagents: { ...background, toolTopology: row.toolTopology, allowRouteOverride: ceiling.allowRouteOverride, maxDepth: ceiling.maxDepth } }, true);
|
|
144
|
+
for (const key of ["modules", "runtimePolicy", "workflow", "guards", "runtimeRecovery"])
|
|
145
|
+
completeResolvedObject(policy[key], CAPTURE_POLICY_SHAPE[key]);
|
|
146
|
+
return freezeSettings(row);
|
|
147
|
+
}
|
|
148
|
+
// Persisted protocol completeness is independent of current configuration defaults.
|
|
149
|
+
const CAPTURE_SKILLS = ["brainstorming", "writing-plans", "requesting-code-review", "receiving-code-review", "subagent-driven-development", "dispatching-parallel-agents", "remove-ai-slops", "debugging", "frontend", "git-master", "ast-grep", "coding-agent-sessions", "init-deep", "using-git-worktrees"];
|
|
150
|
+
const CAPTURE_POLICY_SHAPE = {
|
|
151
|
+
modules: { deepwork: { enabled: null } },
|
|
152
|
+
runtimePolicy: { strategy: null, rateLimit: { maxRetries: null, initialDelayMs: null, maxDelayMs: null, maxTotalDelayMs: null, switchAfterRateLimits: null, maxSwitches: null } },
|
|
153
|
+
workflow: { policy: null, strictGates: null, reviewCap: null, finalReviewPolicy: null },
|
|
154
|
+
guards: { scope: null, shellCommandSafety: null, gitWriteGuard: null, toolOutputTruncation: { enabled: null, maxInlineBytes: null }, planFormatValidation: null, questionLabelHelper: { enabled: null, maxLabelChars: null }, todoDisciplineHelper: null },
|
|
155
|
+
runtimeRecovery: { enabled: null, retryOnStatusCodes: null, retryOnCodes: null, fallbackRoutes: null, maxFallbackAttempts: null, idleContinuation: { enabled: null, maxContinuations: null, prompt: null } },
|
|
156
|
+
};
|
|
157
|
+
function validateLegacyRoutes(policy) {
|
|
158
|
+
const routing = object(policy.roleRouting, [], DSMM_ROLE_IDS);
|
|
159
|
+
for (const value of Object.values(routing)) {
|
|
160
|
+
const row = object(value, [], ["primary", "fallbackRoutes", "levels", "strategy", "rateLimit"]);
|
|
161
|
+
if (row.primary !== undefined)
|
|
162
|
+
legacyRoute(row.primary);
|
|
163
|
+
if (row.fallbackRoutes !== undefined) {
|
|
164
|
+
if (!Array.isArray(row.fallbackRoutes))
|
|
165
|
+
fail();
|
|
166
|
+
row.fallbackRoutes.forEach(legacyRoute);
|
|
167
|
+
}
|
|
168
|
+
if (row.levels !== undefined)
|
|
169
|
+
for (const level of Object.values(object(row.levels, [], ["low", "high", "max"]))) {
|
|
170
|
+
const entry = object(level, [], ["provider", "model", "reasoningEffort"]);
|
|
171
|
+
if (Object.hasOwn(entry, "provider") || Object.hasOwn(entry, "model"))
|
|
172
|
+
legacyRoute(entry);
|
|
173
|
+
else {
|
|
174
|
+
object(entry, ["reasoningEffort"]);
|
|
175
|
+
text(entry.reasoningEffort, 64);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const recovery = policy.runtimeRecovery;
|
|
180
|
+
if (!Array.isArray(recovery?.fallbackRoutes))
|
|
181
|
+
fail();
|
|
182
|
+
recovery.fallbackRoutes.forEach(legacyRoute);
|
|
183
|
+
}
|
|
184
|
+
function completeResolvedObject(input, template) {
|
|
185
|
+
if (template === null || typeof template !== "object" || Array.isArray(template))
|
|
186
|
+
return;
|
|
187
|
+
const row = object(input, Object.keys(template));
|
|
188
|
+
for (const [key, value] of Object.entries(template))
|
|
189
|
+
completeResolvedObject(row[key], value);
|
|
190
|
+
}
|
|
191
|
+
/** Native service substrate stays Host-owned; all executable policy comes from original capture. */
|
|
192
|
+
export function admissionFromChildCapture(input, nativeSubstrate) {
|
|
193
|
+
const capture = parseChildAdmissionCapture(input);
|
|
194
|
+
const { locale: _locale, ...substrate } = nativeSubstrate;
|
|
195
|
+
const settings = resolveConfig({ ...substrate, ...capture.runtimePolicyCapture,
|
|
196
|
+
modelParameters: { passthrough: capture.version === 1 || capture.modelParameterPolicy.mode !== "native-defaults" },
|
|
197
|
+
roles: Object.fromEntries(DSMM_ROLE_IDS.map(role => [role, capture.authorityCeiling.roles.includes(role)])),
|
|
198
|
+
...(capture.locale === undefined ? {} : { locale: capture.locale }), subagents: { ...capture.runtimePolicyCapture.subagents,
|
|
199
|
+
toolTopology: capture.toolTopology, allowRouteOverride: capture.authorityCeiling.allowRouteOverride, maxDepth: capture.authorityCeiling.maxDepth } });
|
|
200
|
+
return freezeSettings({ settings, profile: capture.profilePin, epoch: capture.originalAdmissionEpoch,
|
|
201
|
+
scope: capture.profilePin === null ? "deployment-baseline" : "session-override", childCapture: capture });
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=child-capture.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Wire-only evidence projection; no native service or filesystem imports. */
|
|
2
|
+
export declare const CHILD_EVIDENCE_FIELDS: readonly ["lineage", "role", "route", "profile-pin", "admission-epoch", "invocation-level", "runtime-policy", "modules", "roles", "read-only", "tool-filter", "route-override", "max-depth", "locale", "tool-topology", "guards", "git-write", "shell", "delegation", "active-intent", "max-tokens", "output-schema"];
|
|
3
|
+
export type ChildEvidenceField = typeof CHILD_EVIDENCE_FIELDS[number];
|
|
4
|
+
export interface ChildAdmissionLimitation {
|
|
5
|
+
field: ChildEvidenceField;
|
|
6
|
+
code: "missing-evidence" | "not-persisted" | "unverified" | "parent-denied";
|
|
7
|
+
effect: "capability-denied" | "native-default" | "display-only";
|
|
8
|
+
}
|
|
9
|
+
export interface ChildAdmissionEvidenceView {
|
|
10
|
+
mode: "captured" | "legacy-conservative";
|
|
11
|
+
originalAdmissionEpoch?: string;
|
|
12
|
+
parentAdmissionEpoch: string;
|
|
13
|
+
provenFields: ChildEvidenceField[];
|
|
14
|
+
limitations: ChildAdmissionLimitation[];
|
|
15
|
+
}
|
|
16
|
+
export declare function parseChildAdmissionEvidenceView(input: unknown): ChildAdmissionEvidenceView;
|
|
17
|
+
//# sourceMappingURL=child-evidence.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Wire-only evidence projection; no native service or filesystem imports. */
|
|
2
|
+
export const CHILD_EVIDENCE_FIELDS = ["lineage", "role", "route", "profile-pin", "admission-epoch", "invocation-level", "runtime-policy", "modules", "roles", "read-only", "tool-filter", "route-override", "max-depth", "locale", "tool-topology", "guards", "git-write", "shell", "delegation", "active-intent", "max-tokens", "output-schema"];
|
|
3
|
+
function object(value, required, optional = []) {
|
|
4
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null
|
|
5
|
+
|| Object.getOwnPropertySymbols(value).length || Object.values(Object.getOwnPropertyDescriptors(value)).some(property => !Object.hasOwn(property, "value") || !property.enumerable))
|
|
6
|
+
throw new TypeError("Invalid child evidence object");
|
|
7
|
+
const row = value;
|
|
8
|
+
if (required.some(key => !Object.hasOwn(row, key)) || Object.keys(row).some(key => !required.includes(key) && !optional.includes(key)))
|
|
9
|
+
throw new TypeError("Invalid child evidence fields");
|
|
10
|
+
return row;
|
|
11
|
+
}
|
|
12
|
+
function epoch(value) {
|
|
13
|
+
if (typeof value !== "string" || !/^[a-f0-9]{64}$/u.test(value))
|
|
14
|
+
throw new TypeError("Invalid child evidence epoch");
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function array(value, maximum) {
|
|
18
|
+
if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype || value.length > maximum || Object.getOwnPropertySymbols(value).length || Object.keys(value).length !== value.length
|
|
19
|
+
|| Object.entries(Object.getOwnPropertyDescriptors(value)).some(([key, property]) => key !== "length" && (!/^(0|[1-9][0-9]*)$/u.test(key) || !Object.hasOwn(property, "value") || !property.enumerable)))
|
|
20
|
+
throw new TypeError("Invalid child evidence array");
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
export function parseChildAdmissionEvidenceView(input) {
|
|
24
|
+
const row = object(input, ["mode", "parentAdmissionEpoch", "provenFields", "limitations"], ["originalAdmissionEpoch"]);
|
|
25
|
+
if (row.mode !== "captured" && row.mode !== "legacy-conservative")
|
|
26
|
+
throw new TypeError("Invalid child evidence mode");
|
|
27
|
+
if (row.mode === "legacy-conservative" && Object.hasOwn(row, "originalAdmissionEpoch"))
|
|
28
|
+
throw new TypeError("Legacy evidence has no original admission epoch");
|
|
29
|
+
const proven = array(row.provenFields, CHILD_EVIDENCE_FIELDS.length);
|
|
30
|
+
if (new Set(proven).size !== proven.length || proven.some(field => !CHILD_EVIDENCE_FIELDS.includes(field)))
|
|
31
|
+
throw new TypeError("Invalid proven evidence fields");
|
|
32
|
+
const limitations = array(row.limitations, CHILD_EVIDENCE_FIELDS.length).map(input => {
|
|
33
|
+
const limitation = object(input, ["field", "code", "effect"]);
|
|
34
|
+
if (!CHILD_EVIDENCE_FIELDS.includes(limitation.field) || typeof limitation.code !== "string" || !["missing-evidence", "not-persisted", "unverified", "parent-denied"].includes(limitation.code)
|
|
35
|
+
|| typeof limitation.effect !== "string" || !["capability-denied", "native-default", "display-only"].includes(limitation.effect))
|
|
36
|
+
throw new TypeError("Invalid child evidence limitation");
|
|
37
|
+
return { field: limitation.field, code: limitation.code, effect: limitation.effect };
|
|
38
|
+
});
|
|
39
|
+
if (row.mode === "legacy-conservative" && proven.some(field => ["admission-epoch", "profile-pin", "invocation-level"].includes(field)))
|
|
40
|
+
throw new TypeError("Legacy evidence cannot synthesize original capture identity");
|
|
41
|
+
return { mode: row.mode, parentAdmissionEpoch: epoch(row.parentAdmissionEpoch), ...(row.mode === "captured" ? { originalAdmissionEpoch: epoch(row.originalAdmissionEpoch) } : {}), provenFields: [...proven], limitations };
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=child-evidence.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { InjectFace, PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
|
|
2
|
+
import type { ChildAdmissionEvidenceView, DsmmInvocationView, RoleControlAvailability, RoleControlChildView } from "../role-control-types.js";
|
|
3
|
+
import type { DsmmRoleRouteComparison } from "../profile-types.js";
|
|
4
|
+
import type { ChildrenActions, ChildrenController, ChildrenSnapshot } from "./children-controller.js";
|
|
5
|
+
import type { ChildrenLocaleKey } from "./children-locales.js";
|
|
6
|
+
type Locale = PropsLocale<"conversation.dsmm-children">;
|
|
7
|
+
export type ChildrenInjected = ChildrenActions & {
|
|
8
|
+
hooks: {
|
|
9
|
+
children: ChildrenController["store"];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type ChildrenPanelProps = InjectFace<ChildrenInjected> & Locale & {
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function ControlAvailability({ value, label, t }: Locale & {
|
|
16
|
+
value?: RoleControlAvailability;
|
|
17
|
+
label: ChildrenLocaleKey;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
export declare function RouteComparisonDetails({ value, t }: Locale & {
|
|
20
|
+
value?: DsmmRoleRouteComparison;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
export declare function InvocationDetails({ value, t, showComparison }: Locale & {
|
|
23
|
+
value?: DsmmInvocationView;
|
|
24
|
+
showComparison?: boolean;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
export declare function EvidenceDetails({ value, t }: Locale & {
|
|
27
|
+
value?: ChildAdmissionEvidenceView;
|
|
28
|
+
}): import("react").JSX.Element;
|
|
29
|
+
export declare function ChildComposer({ child, state, actions, t }: Locale & {
|
|
30
|
+
child: RoleControlChildView;
|
|
31
|
+
state: ChildrenSnapshot;
|
|
32
|
+
actions: ChildrenActions;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
34
|
+
export declare function ChildDetails({ child, state, actions, t, inspection }: Locale & {
|
|
35
|
+
child: RoleControlChildView;
|
|
36
|
+
state: ChildrenSnapshot;
|
|
37
|
+
actions: ChildrenActions;
|
|
38
|
+
inspection?: boolean;
|
|
39
|
+
}): import("react").JSX.Element;
|
|
40
|
+
/** Native session-scoped Conversation View, not a replacement composer or navigation shell. */
|
|
41
|
+
export declare function ChildrenPanel(props: ChildrenPanelProps): import("react").JSX.Element;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=ChildrenPanel.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useRef } from "react";
|
|
3
|
+
import { Button } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
|
+
import { childActionKey, EMPTY_CHILD_DRAFT, enabled, runActionKey } from "./children-controller.js";
|
|
5
|
+
export function ControlAvailability({ value, label, t }) {
|
|
6
|
+
return _jsxs("div", { className: "dsmm-availability", children: [_jsxs("p", { children: [t(label), ": ", t(value?.enabled === true ? "enabled" : "disabled")] }), value?.enabled !== true && _jsx("p", { className: "dsmm-hint", children: t(`reason:${value?.reason ?? "unavailable"}`) })] });
|
|
7
|
+
}
|
|
8
|
+
function routeText(route) {
|
|
9
|
+
return `${route.provider}/${route.model}${route.reasoningEffort === undefined ? "" : ` (${route.reasoningEffort})`}`;
|
|
10
|
+
}
|
|
11
|
+
export function RouteComparisonDetails({ value, t }) {
|
|
12
|
+
const initial = value?.initialRoute, live = value?.liveRoute;
|
|
13
|
+
const liveReasons = { "no-own-request-header": "routeNoOwnHeader", "invalid-own-request-header": "routeInvalidOwnHeader", "not-observed": "routeNotObserved" };
|
|
14
|
+
return _jsxs("div", { className: "dsmm-availability", children: [value === undefined && _jsx("p", { className: "dsmm-hint", children: t("comparisonUnobserved") }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("initialRoute") }), _jsx("dd", { children: initial?.status === "known" ? routeText(initial.route) : t("routeUnknown") }), initial?.status === "known" ? _jsxs(_Fragment, { children: [_jsx("dt", { children: t("initialRouteSource") }), _jsxs("dd", { children: [t("routeCaptureSource"), " \u00B7 ", initial.source] })] })
|
|
15
|
+
: initial !== undefined && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("initialRouteReason") }), _jsxs("dd", { children: [t("routeMissingCapture"), " \u00B7 ", initial.reason] })] }), _jsx("dt", { children: t("liveRoute") }), _jsx("dd", { children: live?.status === "known" ? routeText(live.route) : t("routeUnknown") }), live?.status === "known" ? _jsxs(_Fragment, { children: [_jsx("dt", { children: t("liveRouteSource") }), _jsxs("dd", { children: [t("routeOwnHeaderSource"), " \u00B7 ", live.source] })] })
|
|
16
|
+
: live !== undefined && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("liveRouteReason") }), _jsxs("dd", { children: [t(liveReasons[live.reason]), " \u00B7 ", live.reason] })] })] })] });
|
|
17
|
+
}
|
|
18
|
+
export function InvocationDetails({ value, t, showComparison = true }) {
|
|
19
|
+
if (value === undefined)
|
|
20
|
+
return _jsx("p", { className: "dsmm-hint", children: t("invocationUnavailable") });
|
|
21
|
+
return _jsxs(_Fragment, { children: [showComparison && _jsx(RouteComparisonDetails, { value: value.routeComparison, t: t }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("role") }), _jsxs("dd", { children: [value.label, " \u00B7 ", value.role] }), _jsx("dt", { children: t("level") }), _jsx("dd", { children: value.level }), _jsx("dt", { children: t("mode") }), _jsx("dd", { children: value.mode }), _jsx("dt", { children: t("reportedRoute") }), _jsx("dd", { children: value.route === undefined ? t("routeUnreported") : routeText(value.route) }), _jsx("dt", { children: t("routeSource") }), _jsx("dd", { children: value.routeSource }), value.runId !== undefined && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("runId") }), _jsx("dd", { children: value.runId })] }), value.childId !== undefined && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("childId") }), _jsx("dd", { children: value.childId })] }), value.jobId !== undefined && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("jobId") }), _jsx("dd", { children: value.jobId })] })] })] });
|
|
22
|
+
}
|
|
23
|
+
export function EvidenceDetails({ value, t }) {
|
|
24
|
+
if (value === undefined)
|
|
25
|
+
return _jsx("p", { className: "dsmm-hint", children: t("evidenceMissing") });
|
|
26
|
+
const codes = { "missing-evidence": "missingEvidence", "not-persisted": "notPersisted", unverified: "unverified", "parent-denied": "parentDenied" };
|
|
27
|
+
const effects = { "capability-denied": "capabilityDenied", "native-default": "nativeDefault", "display-only": "displayOnly" };
|
|
28
|
+
return _jsxs("section", { className: "dsmm-availability", "aria-label": t("evidence"), children: [_jsx("p", { children: t(value.mode === "captured" ? "captured" : "legacy") }), value.originalAdmissionEpoch !== undefined && _jsxs("p", { children: [t("originalEpoch"), ": ", value.originalAdmissionEpoch] }), _jsxs("p", { children: [t("epoch"), ": ", value.parentAdmissionEpoch] }), _jsxs("p", { children: [t("proven"), ": ", value.provenFields.length ? value.provenFields.join(", ") : t("noneProven")] }), _jsx("p", { children: t("limitations") }), value.limitations.length === 0 ? _jsx("p", { className: "dsmm-hint", children: t("noLimitations") }) : _jsx("ul", { className: "dsmm-profile-list", children: value.limitations.map((item, index) => _jsxs("li", { children: [_jsxs("p", { children: [item.field, " \u00B7 ", item.code, " \u00B7 ", t(codes[item.code])] }), _jsxs("p", { children: [item.effect, " \u00B7 ", t(effects[item.effect])] })] }, `${item.field}-${index}`)) })] });
|
|
29
|
+
}
|
|
30
|
+
function Issue({ value, t }) {
|
|
31
|
+
if (!value)
|
|
32
|
+
return null;
|
|
33
|
+
return _jsxs("div", { className: "dsmm-issue", role: "alert", children: [_jsx("p", { children: t(value.unknown ? "unknownAction" : "error", { code: value.code }) }), _jsxs("p", { children: [value.code, value.field === undefined ? "" : ` · ${t("field")}: ${value.field}`] }), value.reason !== undefined && _jsx("p", { children: t(`reason:${value.reason}`) })] });
|
|
34
|
+
}
|
|
35
|
+
function Outcome({ value, t }) {
|
|
36
|
+
if (!value)
|
|
37
|
+
return null;
|
|
38
|
+
return _jsx("div", { className: "dsmm-availability", role: "status", "aria-live": "polite", children: value.kind === "prompt" ? _jsx("p", { children: t("promptAccepted", { id: value.receipt.messageId }) })
|
|
39
|
+
: value.kind === "interrupt" ? _jsx("p", { children: t("interruptAccepted") }) : _jsxs(_Fragment, { children: [_jsx("p", { children: t("backgroundReceipt", { status: value.receipt.status, id: value.receipt.runId }) }), value.receipt.jobId !== undefined && _jsxs("p", { children: [t("jobId"), ": ", value.receipt.jobId] })] }) });
|
|
40
|
+
}
|
|
41
|
+
export function ChildComposer({ child, state, actions, t }) {
|
|
42
|
+
const prefix = useId(), picker = useRef(null), generation = state.generation, key = childActionKey(child.id);
|
|
43
|
+
const draft = state.drafts.get(child.id) ?? EMPTY_CHILD_DRAFT;
|
|
44
|
+
const pending = state.pending.has(key), available = state.fresh && !state.reading && !pending;
|
|
45
|
+
const canPrompt = available && enabled(state.snapshot?.capabilities.prompt) && enabled(child.controls.prompt) && !child.readonly && child.mode === "continuable";
|
|
46
|
+
const canImages = canPrompt && enabled(state.snapshot?.capabilities.images) && !draft.imageBusy;
|
|
47
|
+
const submit = canPrompt && !draft.uncertain && !draft.imageBusy && (draft.text.trim() !== "" || draft.images.length > 0)
|
|
48
|
+
&& (draft.images.length === 0 || enabled(state.snapshot?.capabilities.images));
|
|
49
|
+
return _jsxs("form", { className: "dsmm-child-composer", "aria-label": t("prompt"), onSubmit: event => { event.preventDefault(); if (submit)
|
|
50
|
+
void actions.prompt(generation, child.id); }, children: [!state.fresh && _jsx("p", { className: "dsmm-hint", children: t(state.reading ? "reading" : "stale") }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-message`, children: t("text") }), _jsx("textarea", { id: `${prefix}-message`, className: "dsmm-child-message", rows: 4, value: draft.text, disabled: pending, "aria-describedby": `${prefix}-delivery-hint${draft.uncertain ? ` ${prefix}-unknown` : ""}`, onChange: event => actions.editText(generation, child.id, event.currentTarget.value) })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-delivery`, children: t("delivery") }), _jsxs("select", { id: `${prefix}-delivery`, value: draft.delivery, disabled: !canPrompt, "aria-describedby": `${prefix}-delivery-hint`, onChange: event => {
|
|
51
|
+
const value = event.currentTarget.value;
|
|
52
|
+
if (value === "queue" || value === "steer")
|
|
53
|
+
actions.setDelivery(generation, child.id, value);
|
|
54
|
+
}, children: [_jsx("option", { value: "queue", children: t("queue") }), _jsx("option", { value: "steer", children: t("steer") })] }), _jsx("p", { id: `${prefix}-delivery-hint`, className: "dsmm-hint", children: t("deliveryHint") })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("p", { id: `${prefix}-images-hint`, className: "dsmm-hint", children: t("imagesHint") }), _jsx("input", { ref: picker, hidden: true, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", multiple: true, disabled: !canImages, "aria-label": t("images"), onChange: event => {
|
|
55
|
+
const files = Array.from(event.currentTarget.files ?? []);
|
|
56
|
+
event.currentTarget.value = "";
|
|
57
|
+
if (canImages)
|
|
58
|
+
void actions.addImages(generation, child.id, files);
|
|
59
|
+
} }), _jsx(Button, { type: "button", variant: "outline", disabled: !canImages, "aria-describedby": `${prefix}-images-hint`, onClick: () => { if (canImages)
|
|
60
|
+
picker.current?.click(); }, children: t("images") }), _jsx(ControlAvailability, { value: state.snapshot?.capabilities.images, label: "imageAvailability", t: t }), draft.images.length > 0 && _jsx("ul", { className: "dsmm-profile-list", children: draft.images.map((image, index) => _jsxs("li", { children: [_jsxs("p", { children: [image.name ?? image.mediaType, " \u00B7 ", image.mediaType] }), _jsx(Button, { type: "button", variant: "outline", disabled: pending || draft.imageBusy, onClick: () => actions.removeImage(generation, child.id, image), "aria-label": `${t("removeImage")}: ${image.name ?? image.mediaType}`, children: t("removeImage") })] }, index)) })] }), draft.uncertain && _jsxs("div", { className: "dsmm-warning", children: [_jsx("p", { id: `${prefix}-unknown`, children: t("unknown") }), _jsx(Button, { type: "button", variant: "outline", disabled: !state.fresh || state.reading || pending, onClick: () => actions.acknowledgeUnknown(generation, child.id), children: t("acknowledge") })] }), _jsx(ControlAvailability, { value: !enabled(state.snapshot?.capabilities.prompt) ? state.snapshot?.capabilities.prompt : child.controls.prompt, label: "promptAvailability", t: t }), draft.text.trim() === "" && draft.images.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("emptyMessage") }), draft.images.length > 0 && !enabled(state.snapshot?.capabilities.images) && _jsx("p", { className: "dsmm-hint", children: t("deniedImages") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "submit", variant: "primary", disabled: !submit, children: t("send") }), _jsx(Button, { type: "button", variant: "outline", disabled: !available || !enabled(state.snapshot?.capabilities.interrupt) || !enabled(child.controls.interrupt) || child.readonly || child.mode !== "continuable", onClick: () => void actions.interrupt(generation, child.id), children: t("interrupt") })] }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: pending ? t("pending") : draft.imageBusy ? t("imageReading") : "" })] });
|
|
61
|
+
}
|
|
62
|
+
export function ChildDetails({ child, state, actions, t, inspection = false }) {
|
|
63
|
+
return _jsxs("fieldset", { children: [_jsx("legend", { children: child.label?.trim() ? child.label : child.id }), _jsxs("p", { children: [t("childId"), ": ", child.id] }), _jsxs("p", { children: [t("parentId"), ": ", child.parentSessionId] }), _jsxs("p", { children: [t("mode"), ": ", child.mode] }), _jsxs("p", { children: [t("activity"), ": ", child.activity] }), (inspection || child.readonly) && _jsx("p", { children: t("readonly") }), child.mode === "one-shot" && _jsx("p", { className: "dsmm-hint", children: t("oneShot") }), _jsx(RouteComparisonDetails, { value: child.routeComparison, t: t }), _jsx(InvocationDetails, { value: child.invocation, t: t, showComparison: false }), _jsx(EvidenceDetails, { value: child.evidence, t: t }), (!inspection || !child.controls.prompt.enabled) && _jsx(ControlAvailability, { value: child.controls.prompt, label: "promptAvailability", t: t }), (!inspection || !child.controls.interrupt.enabled) && _jsx(ControlAvailability, { value: child.controls.interrupt, label: "interruptAvailability", t: t }), !inspection && child.mode === "continuable" && !child.readonly && _jsx(ChildComposer, { child: child, state: state, actions: actions, t: t }), !inspection && _jsxs(_Fragment, { children: [_jsx(Issue, { value: state.issues.get(childActionKey(child.id)), t: t }), _jsx(Outcome, { value: state.outcomes.get(childActionKey(child.id)), t: t })] })] });
|
|
64
|
+
}
|
|
65
|
+
/** Native session-scoped Conversation View, not a replacement composer or navigation shell. */
|
|
66
|
+
export function ChildrenPanel(props) {
|
|
67
|
+
const state = props.useChildren(snapshot => snapshot), { t } = props, generation = state.generation;
|
|
68
|
+
if (props.sessionId === undefined || props.sessionId !== state.sessionId)
|
|
69
|
+
return _jsxs("section", { className: "dsmm-profiles dsmm-children", children: [_jsx("h2", { children: t("title") }), _jsx("p", { children: t(state.sessionId === null ? "noSession" : "foreign") })] });
|
|
70
|
+
const data = state.snapshot;
|
|
71
|
+
const refreshingDisabled = state.reading || state.pending.size > 0 || [...state.drafts.values()].some(draft => draft.imageBusy);
|
|
72
|
+
return _jsxs("section", { className: "dsmm-profiles dsmm-children", "aria-label": t("title"), "aria-busy": state.reading, children: [_jsx("h2", { children: t("title") }), _jsx("p", { className: "dsmm-hint", children: t("description") }), _jsxs("p", { children: [t("session"), ": ", state.sessionId] }), _jsx("div", { className: "dsmm-actions", children: _jsx(Button, { type: "button", variant: "outline", disabled: refreshingDisabled, onClick: () => void props.refresh(generation), children: t("refresh") }) }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: state.reading ? t("reading") : state.pending.size > 0 ? t("pending") : !state.fresh ? t(data === null ? "unavailable" : "stale") : "" }), _jsx(Issue, { value: state.issue, t: t }), data !== null && _jsxs(_Fragment, { children: [_jsxs("p", { children: [t("epoch"), ": ", data.admissionEpoch] }), _jsxs("section", { className: "dsmm-availability", children: [_jsxs("p", { children: [t("runtime"), ": ", data.capabilities.runtime.binding] }), _jsxs("p", { children: [t("fence"), ": ", t(data.capabilities.runtime.deliveryFenceReady ? "yes" : "no")] }), _jsxs("p", { children: [t("restart"), ": ", t(data.capabilities.runtime.restartRequired ? "yes" : "no")] }), data.capabilities.runtime.reason !== undefined && _jsx("p", { children: t(data.capabilities.runtime.reason === "explicit-composition-required" ? "composition" : data.capabilities.runtime.reason === "duplicate-provider" ? "duplicate" : "authority") }), _jsx(ControlAvailability, { value: data.capabilities.background, label: "backgroundAvailability", t: t }), _jsx(ControlAvailability, { value: data.capabilities.prompt, label: "promptAvailability", t: t }), _jsx(ControlAvailability, { value: data.capabilities.interrupt, label: "interruptAvailability", t: t })] }), _jsxs("section", { className: "dsmm-zone", "aria-label": t("runs"), children: [_jsx("h3", { children: t("runs") }), data.runs.length === 0 ? _jsx("p", { className: "dsmm-hint", children: t("emptyRuns") }) : data.runs.map(run => {
|
|
73
|
+
const runId = run.invocation?.runId, key = runId === undefined ? null : runActionKey(run.toolCallId, runId);
|
|
74
|
+
const disabled = !state.fresh || state.reading || run.state !== "running" || !enabled(run.background) || !enabled(data.capabilities.background)
|
|
75
|
+
|| key === null || state.pending.has(key) || state.outcomes.get(key)?.kind === "background";
|
|
76
|
+
return _jsxs("fieldset", { children: [_jsx("legend", { children: run.invocation?.label ?? t(run.state === "starting" ? "starting" : "invocationUnavailable") }), _jsxs("p", { children: [t("toolCallId"), ": ", run.toolCallId] }), _jsxs("p", { children: [t("runState"), ": ", run.state] }), run.invocation !== undefined && _jsx(InvocationDetails, { value: run.invocation, t: t }), _jsx(ControlAvailability, { value: run.background, label: "backgroundAvailability", t: t }), _jsx("p", { className: "dsmm-hint", children: t("backgroundHint") }), runId !== undefined && _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => void props.background(generation, run.toolCallId, runId), children: t("background") }), key !== null && _jsxs(_Fragment, { children: [_jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: state.pending.has(key) ? t("pending") : "" }), _jsx(Issue, { value: state.issues.get(key), t: t }), _jsx(Outcome, { value: state.outcomes.get(key), t: t })] })] }, run.toolCallId);
|
|
77
|
+
})] }), _jsxs("section", { className: "dsmm-zone", "aria-label": t("children"), children: [_jsx("h3", { children: t("children") }), data.children.length === 0 ? _jsx("p", { className: "dsmm-hint", children: t("emptyChildren") })
|
|
78
|
+
: data.children.map(child => _jsx(ChildDetails, { child: child, state: state, actions: props, t: t }, child.id))] })] }), _jsxs("section", { className: "dsmm-zone", "aria-label": t("descendants"), children: [_jsx("h3", { children: t("descendants") }), _jsx(Issue, { value: state.descendantIssue, t: t }), state.descendants === null ? _jsx("p", { className: "dsmm-hint", children: t("treeUnavailable") }) : state.descendants.descendants.length === 0 ? _jsx("p", { className: "dsmm-hint", children: t("emptyDescendants") })
|
|
79
|
+
: state.descendants.descendants.map((entry, index) => _jsxs("div", { className: "dsmm-availability", children: [_jsxs("p", { children: [t("depth"), ": ", entry.depth] }), entry.kind === "diagnostic" ? _jsxs("div", { className: "dsmm-issue", children: [_jsx("p", { children: t("diagnostic", { reason: entry.reason }) }), _jsxs("p", { children: [t("childId"), ": ", entry.id] }), _jsxs("p", { children: [t("parentId"), ": ", entry.parentSessionId] })] })
|
|
80
|
+
: _jsxs(_Fragment, { children: [_jsxs("p", { children: [t("subtree"), ": ", t(entry.hasChildren ? "yes" : "no")] }), _jsx(ChildDetails, { child: entry.child, state: state, actions: props, t: t, inspection: true })] })] }, index))] })] });
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=ChildrenPanel.js.map
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useEffect, useId, useMemo, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { Button, Input } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
4
|
import { DeploymentController } from "./deployment-controller.js";
|
|
5
|
-
import { at, enumValues, equal, inspectorPaths, mergeLayer, parseAdvanced, validateEditorValue } from "./deployment-data.js";
|
|
5
|
+
import { at, enumValues, equal, inspectorPaths, mergeLayer, parseAdvanced, validateEditorValue, visibleDeploymentPath } from "./deployment-data.js";
|
|
6
6
|
import { deploymentFieldLabels } from "./deployment-locales.js";
|
|
7
7
|
function label(path, t) {
|
|
8
8
|
const key = path.at(-1);
|
|
@@ -59,16 +59,19 @@ function ScalarField({ schema, path, controller, disabled, inherited, invalid, t
|
|
|
59
59
|
} }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || value === undefined && !bad, onClick: () => { setText(String(inherited ?? "")); setBad(false); invalid(name, false); controller.edit(path, undefined); }, children: t("inherit") })] }), _jsxs("p", { id: `${id}-error`, className: "dsmm-hint", children: [bad ? t("invalid") : "", schema.type === "number" && (schema.min !== undefined || schema.max !== undefined) ? ` ${schema.min ?? "—"} – ${schema.max ?? "—"}` : ""] })] });
|
|
60
60
|
}
|
|
61
61
|
function Field({ schema, path, controller, invalid, t }) {
|
|
62
|
+
if (schema.type === "transform" && schema.inner !== undefined)
|
|
63
|
+
schema = schema.inner;
|
|
62
64
|
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), snapshot = state.snapshot;
|
|
63
65
|
const id = useId(), name = path.join("."), explicit = at(state.draft, path);
|
|
64
66
|
const inherited = controller.layer === "global" ? at(snapshot.defaults, path) : at(mergeLayer(mergeLayer(snapshot.defaults, snapshot.global), snapshot.nativeForm?.base ?? {}), path);
|
|
65
67
|
const disabled = state.busy || state.issue === "not-owned" || state.issue === "unavailable" || state.issue === "transport" || controller.layer === "profile" && !controller.canWriteProfile();
|
|
66
68
|
const choices = enumValues(schema);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
const hint = name === "modelParameters.passthrough" ? "modelParametersHint" : name === "permissionControl.enabled" ? "permissionControlHint" : null;
|
|
70
|
+
if (schema.type === "object" && schema.fields !== undefined && path[0] !== "roleRouting")
|
|
71
|
+
return _jsxs("details", { className: "dsmm-deployment-group", children: [_jsxs("summary", { children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsx("div", { children: Object.entries(schema.fields).filter(([key]) => visibleDeploymentPath([...path, key])).map(([key, node]) => _jsx(Field, { schema: node, path: [...path, key], controller: controller, invalid: invalid, t: t }, key)) })] });
|
|
69
72
|
if (!["boolean", "string", "number"].includes(schema.type) && choices === null)
|
|
70
73
|
return _jsx(AdvancedField, { schema: schema, path: path, value: explicit, inherited: inherited, upper: controller.layer === "global" ? at(snapshot.profile, path) : undefined, reset: snapshot, disabled: disabled, t: t, onChange: value => controller.edit(path, value), setInvalid: invalid });
|
|
71
|
-
return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: id, children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsxs("select", { id: id, disabled: disabled, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsxs("option", { value: "inherit", children: [t("inherit"), " \u00B7 ", displayValue(inherited, t)] }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: displayValue(choice, t) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, disabled: disabled, inherited: inherited, invalid: invalid, t: t }), (explicit !== undefined || controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined) && _jsxs("p", { className: "dsmm-hint", children: [explicit === undefined ? "" : equal(explicit, at(snapshot.defaults, path)) ? t("defaultPin") : t("explicit"), controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined ? `${explicit === undefined ? "" : " · "}${t("hostPin")}` : ""] })] });
|
|
74
|
+
return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: id, children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsxs("select", { id: id, disabled: disabled, "aria-describedby": hint === null ? undefined : `${id}-hint`, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsxs("option", { value: "inherit", children: [t("inherit"), " \u00B7 ", displayValue(inherited, t)] }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: displayValue(choice, t) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, disabled: disabled, inherited: inherited, invalid: invalid, t: t }), hint !== null && _jsx("p", { id: `${id}-hint`, className: "dsmm-hint", children: t(hint) }), (explicit !== undefined || controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined) && _jsxs("p", { className: "dsmm-hint", children: [explicit === undefined ? "" : equal(explicit, at(snapshot.defaults, path)) ? t("defaultPin") : t("explicit"), controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined ? `${explicit === undefined ? "" : " · "}${t("hostPin")}` : ""] })] });
|
|
72
75
|
}
|
|
73
76
|
function Layer({ controller, t }) {
|
|
74
77
|
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
|
|
@@ -80,7 +83,7 @@ function Layer({ controller, t }) {
|
|
|
80
83
|
next.delete(path); return next; }); };
|
|
81
84
|
const title = controller.layer === "global" ? "global" : "profile";
|
|
82
85
|
const disabled = state.busy || state.snapshot === null || state.issue !== null || invalid.size > 0 || controller.layer === "profile" && !controller.canWriteProfile();
|
|
83
|
-
return _jsxs("div", { "data-dsmm-layer": controller.layer, "aria-busy": state.busy, children: [_jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t(title), _jsx("span", { role: "status", "aria-live": "polite", className: "dsmm-hint", children: state.busy ? t("saving") : state.dirty ? t("dirty") : state.saved ? t("saved") : "" })] }), _jsxs("fieldset", { children: [_jsx("legend", { children: t(title) }), _jsx("p", { className: "dsmm-hint", children: t(title === "global" ? "globalHint" : "profileHint") }), state.snapshot !== null && Object.entries(state.snapshot.schema.fields ?? {}).filter(([key]) => controller.layer === "global" || key !== "modules").sort(([a], [b]) => a === "modules" ? -1 : b === "modules" ? 1 : 0).map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, invalid: updateInvalid, t: t }, key)), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: disabled || !state.dirty, onClick: () => { void controller.save(); }, children: t(state.busy ? "saving" : title === "global" ? "saveGlobal" : "saveProfile") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => { void controller.refresh(); }, children: t("refresh") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null, onClick: () => { setInvalid(new Set()); void controller.refresh(true); }, children: t("discard") })] })] })] }), state.issue !== null && _jsx("p", { className: "dsmm-issue", role: "alert", children: t(state.issue) }), invalid.size > 0 && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("invalid") }), controller.layer === "profile" && !controller.canWriteProfile() && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") })] });
|
|
86
|
+
return _jsxs("div", { "data-dsmm-layer": controller.layer, "aria-busy": state.busy, children: [_jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t(title), _jsx("span", { role: "status", "aria-live": "polite", className: "dsmm-hint", children: state.busy ? t("saving") : state.dirty ? t("dirty") : state.saved ? t("saved") : "" })] }), _jsxs("fieldset", { children: [_jsx("legend", { children: t(title) }), _jsx("p", { className: "dsmm-hint", children: t(title === "global" ? "globalHint" : "profileHint") }), state.snapshot !== null && _jsxs(_Fragment, { children: [_jsxs("details", { className: "dsmm-deployment-group", children: [_jsx("summary", { children: t("core") }), _jsxs("div", { children: [_jsx("p", { className: "dsmm-hint", children: t("coreHint") }), Object.entries(state.snapshot.schema.fields ?? {}).filter(([key]) => key === "modelParameters" || key === "permissionControl").map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, invalid: updateInvalid, t: t }, key))] })] }), Object.entries(state.snapshot.schema.fields ?? {}).filter(([key]) => visibleDeploymentPath([key]) && key !== "modelParameters" && key !== "permissionControl" && (controller.layer === "global" || key !== "modules")).sort(([a], [b]) => a === "modules" ? -1 : b === "modules" ? 1 : 0).map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, invalid: updateInvalid, t: t }, key))] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: disabled || !state.dirty, onClick: () => { void controller.save(); }, children: t(state.busy ? "saving" : title === "global" ? "saveGlobal" : "saveProfile") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => { void controller.refresh(); }, children: t("refresh") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null, onClick: () => { setInvalid(new Set()); void controller.refresh(true); }, children: t("discard") })] })] })] }), state.issue !== null && _jsx("p", { className: "dsmm-issue", role: "alert", children: t(state.issue) }), invalid.size > 0 && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("invalid") }), controller.layer === "profile" && !controller.canWriteProfile() && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") })] });
|
|
84
87
|
}
|
|
85
88
|
function NativeProfileLayer({ namespace, forms, remote, form, core, t }) {
|
|
86
89
|
const shared = useMemo(() => forms.get(namespace), [forms, namespace]);
|
|
@@ -101,10 +104,11 @@ function StateInspector({ controller, session, t }) {
|
|
|
101
104
|
if (snapshot === null)
|
|
102
105
|
return null;
|
|
103
106
|
const admitted = session?.configuration ?? null;
|
|
107
|
+
const restartRequired = (snapshot.nextRoot?.restartRequired ?? []).filter(path => visibleDeploymentPath(path.split(".")));
|
|
104
108
|
const source = (value) => t(value === "profile" ? "profileSource" : value === "global" ? "globalSource" : value === "defaults" ? "defaultsSource" : value === "named-session" ? "namedSource" : value === "startup" ? "startupSource" : value === "deployment" ? "deploymentCapture" : value === "mixed" ? "mixedSource" : "unknown");
|
|
105
109
|
const value = (layer, path) => layer === undefined ? t("unknown") : at(layer, path.split(".")) === undefined ? t("absent") : displayValue(at(layer, path.split(".")), t);
|
|
106
110
|
const metadata = (layer, path, entry) => layer !== undefined && at(layer, path.split(".")) === undefined && entry === undefined ? t("absent") : source(entry);
|
|
107
|
-
return _jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t("state"), _jsx("span", { className: "dsmm-hint", children:
|
|
111
|
+
return _jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t("state"), _jsx("span", { className: "dsmm-hint", children: restartRequired.length > 0 ? t("pending") : dirty || issue !== null ? t("inspectorStale") : "" })] }), _jsxs("div", { children: [_jsx("p", { role: "status", "aria-live": "polite", children: session === null ? t("noSession") : admitted === null ? t("sessionUnavailable") : `${t("namedSource")}: ${admitted.named?.id ?? "—"}` }), session !== null && _jsxs("p", { children: [t("session"), ": ", _jsx("code", { children: session.sessionId }), " \u00B7 ", _jsx("code", { children: session.admissionEpoch }), " \u00B7 ", session.scope] }), (dirty || issue !== null) && _jsx("p", { className: "dsmm-hint", children: t("inspectorStale") }), _jsxs("p", { className: "dsmm-hint", children: ["Global CAS: ", _jsx("code", { children: snapshot.globalRevision }), " \u00B7 native CAS: ", _jsx("code", { children: snapshot.nativeRevision }), " \u00B7 Host form: ", snapshot.nativeFormRevision ?? "—"] }), inspectorPaths(snapshot, admitted).map(path => _jsxs("dl", { className: "dsmm-deployment-state", children: [_jsx("dt", { children: _jsx("code", { children: path }) }), _jsxs("dd", { children: [t("globalSource"), ": ", at(snapshot.global, path.split(".")) === undefined ? t("absent") : t("globalSource")] }), _jsxs("dd", { children: [t("desired"), ": ", value(snapshot.desired, path), " \u00B7 ", metadata(snapshot.desired, path, snapshot.sources[path])] }), _jsxs("dd", { children: [t("startup"), ": ", value(snapshot.startup, path), " \u00B7 ", metadata(snapshot.startup, path, snapshot.startupSources?.[path]), " / ", at(snapshot.startup, path.split(".")) === undefined ? t("absent") : t("startupSource")] }), _jsxs("dd", { children: [t("next"), ": ", value(snapshot.nextRoot?.settings, path), " \u00B7 ", metadata(snapshot.nextRoot?.settings, path, snapshot.nextRoot?.sources[path]), " / ", metadata(snapshot.nextRoot?.settings, path, snapshot.nextRoot?.captures[path])] }), _jsxs("dd", { children: [t("session"), ": ", value(admitted?.settings, path), " \u00B7 ", metadata(admitted?.settings, path, admitted?.sources[path]), " / ", metadata(admitted?.settings, path, admitted?.captures[path])] })] }, path)), restartRequired.length > 0 && _jsxs("p", { children: [t("pending"), ": ", restartRequired.join(", ")] })] })] });
|
|
108
112
|
}
|
|
109
113
|
export function DeploymentPage(props) {
|
|
110
114
|
const state = useSyncExternalStore(props.core.subscribe, props.core.getSnapshot);
|
|
@@ -112,8 +116,11 @@ export function DeploymentPage(props) {
|
|
|
112
116
|
void props.core.refresh(); }, [props.core, props.view]);
|
|
113
117
|
if (props.view === "summary")
|
|
114
118
|
return _jsx("span", { children: props.t("summary") });
|
|
115
|
-
const { t } = props, snapshot = state.snapshot
|
|
116
|
-
return _jsxs("section", { className: "dsmm-profiles dsmm-deployment", "data-dsmm-page": true, "aria-label": t("title"), children: [_jsx("p", { className: "dsmm-hint", children: t("description") }), _jsx("p", { className: "dsmm-hint", children: t("boundaries") }),
|
|
119
|
+
const { t } = props, snapshot = state.snapshot;
|
|
120
|
+
return _jsxs("section", { className: "dsmm-profiles dsmm-deployment", "data-dsmm-page": true, "aria-label": t("title"), children: [_jsx("p", { className: "dsmm-hint", children: t("description") }), _jsx("p", { className: "dsmm-hint", children: t("boundaries") }), snapshot?.modules.map(module => {
|
|
121
|
+
const admitted = state.session?.modules?.find(value => value.descriptor.id === module.descriptor.id)?.admitted;
|
|
122
|
+
return _jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [module.descriptor.label, _jsx("span", { className: "dsmm-hint", children: module.pending ? t("pending") : t(module.desired.enabled ? "on" : "off") })] }), _jsxs("div", { children: [_jsx("p", { children: t("hostUnknown") }), _jsxs("p", { children: [t("desired"), ": ", t(module.desired.enabled ? "on" : "off"), " \u00B7 ", module.desired.source] }), _jsxs("p", { children: [t("startup"), ": ", module.startupMounted == null ? t("unknown") : t(module.startupMounted ? "on" : "off"), " \u00B7 ", t("next"), ": ", module.nextRoot.admitted == null ? t("unknown") : t(module.nextRoot.admitted ? "on" : "off")] }), _jsxs("p", { children: [t("session"), ": ", admitted == null ? t("unknown") : t(admitted ? "on" : "off")] }), _jsx("p", { className: "dsmm-hint", children: t(module.descriptor.id === "deepwork" ? "ceiling" : "permissionControlHint") })] })] }, module.descriptor.id);
|
|
123
|
+
}), _jsx(Layer, { controller: props.core, t: t }), props.profilePage && props.forms !== undefined && snapshot?.namespace !== null && snapshot?.namespace !== undefined && (props.rowNamespace === undefined || props.rowNamespace === snapshot.namespace)
|
|
117
124
|
? _jsx(NativeProfileLayer, { namespace: snapshot.namespace, forms: props.forms, remote: props.remote, form: props.form, core: props.core, t: t }, `${snapshot.hostProfileKey}:${snapshot.entryId}`)
|
|
118
125
|
: _jsxs("div", { children: [_jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t("profile"), _jsx("span", { className: "dsmm-hint", children: t("profileUnavailable") })] }), _jsx("div", { children: _jsx("p", { children: t("profileHint") }) })] }), _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") })] }), _jsx(StateInspector, { controller: props.core, session: state.session, t: t })] });
|
|
119
126
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface EditableChoiceOption {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export interface EditableChoiceProps {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
options: readonly EditableChoiceOption[];
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
onChange(value: string): void;
|
|
13
|
+
onSelect?(value: string): void;
|
|
14
|
+
}
|
|
15
|
+
/** Suggestions are advisory; the one input always retains the exact typed value. */
|
|
16
|
+
export declare function EditableChoice({ id, label, value, options, disabled, placeholder, onChange, onSelect }: EditableChoiceProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=EditableChoice.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { Button, IconChevronDownOutlineRegular, Input } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
|
+
/** Suggestions are advisory; the one input always retains the exact typed value. */
|
|
5
|
+
export function EditableChoice({ id, label, value, options, disabled, placeholder, onChange, onSelect }) {
|
|
6
|
+
const input = useRef(null);
|
|
7
|
+
const [open, setOpen] = useState(false);
|
|
8
|
+
const [activeId, setActiveId] = useState(null);
|
|
9
|
+
const distinct = new Map(options.map(option => [option.id, option]));
|
|
10
|
+
if (value !== "" && !distinct.has(value))
|
|
11
|
+
distinct.set(value, { id: value, name: value });
|
|
12
|
+
const choices = [...distinct.values()];
|
|
13
|
+
const activeIndex = choices.findIndex(option => option.id === activeId);
|
|
14
|
+
const visible = open && !disabled && choices.length > 0;
|
|
15
|
+
const close = () => { setOpen(false); setActiveId(null); };
|
|
16
|
+
const choose = (next) => { if (next !== value)
|
|
17
|
+
(onSelect ?? onChange)(next); close(); };
|
|
18
|
+
useEffect(() => { if (disabled)
|
|
19
|
+
close(); }, [disabled]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (activeId !== null && activeIndex < 0)
|
|
22
|
+
setActiveId(null);
|
|
23
|
+
}, [activeId, activeIndex]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (visible && activeIndex >= 0)
|
|
26
|
+
document.getElementById(`${id}-choice-${activeIndex}`)?.scrollIntoView({ block: "nearest" });
|
|
27
|
+
}, [id, visible, activeIndex]);
|
|
28
|
+
return _jsxs("div", { className: "dsmm-choice", children: [_jsx(Input, { ref: input, id: id, className: "dsmm-input", role: "combobox", "aria-autocomplete": "list", "aria-expanded": visible, "aria-controls": visible ? `${id}-choices` : undefined, "aria-activedescendant": visible && activeIndex >= 0 ? `${id}-choice-${activeIndex}` : undefined, value: value, disabled: disabled, placeholder: placeholder, autoComplete: "off", onBlur: close, onChange: event => { onChange(event.currentTarget.value); setOpen(true); setActiveId(null); }, onKeyDown: event => {
|
|
29
|
+
if (event.nativeEvent.isComposing)
|
|
30
|
+
return;
|
|
31
|
+
if ((event.key === "ArrowDown" || event.key === "ArrowUp") && choices.length > 0) {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
setOpen(true);
|
|
35
|
+
const next = event.key === "ArrowDown" ? !visible || activeIndex < 0 ? 0 : (activeIndex + 1) % choices.length
|
|
36
|
+
: !visible || activeIndex < 0 ? choices.length - 1 : (activeIndex - 1 + choices.length) % choices.length;
|
|
37
|
+
setActiveId(choices[next].id);
|
|
38
|
+
}
|
|
39
|
+
else if (visible && (event.key === "Escape" || event.key === "Enter")) {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
event.stopPropagation();
|
|
42
|
+
if (event.key === "Enter" && activeIndex >= 0)
|
|
43
|
+
choose(choices[activeIndex].id);
|
|
44
|
+
else
|
|
45
|
+
close();
|
|
46
|
+
}
|
|
47
|
+
} }), _jsx(Button, { type: "button", size: "sm", variant: "toolbar", tabIndex: -1, className: "dsmm-choice-toggle", "aria-label": label, "aria-haspopup": "listbox", "aria-expanded": visible, disabled: disabled || choices.length === 0, icon: _jsx(IconChevronDownOutlineRegular, {}), onMouseDown: event => event.preventDefault(), onClick: () => { input.current?.focus(); setOpen(!visible); setActiveId(null); } }), visible && _jsx("ul", { className: "dsmm-choice-list", id: `${id}-choices`, role: "listbox", "aria-label": label, children: choices.map((option, index) => _jsx("li", { id: `${id}-choice-${index}`, role: "option", "data-value": option.id, "aria-selected": option.id === activeId, onMouseDown: event => event.preventDefault(), onClick: () => choose(option.id), children: option.name === option.id ? option.id : `${option.name} (${option.id})` }, option.id)) })] });
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=EditableChoice.js.map
|