@dsmm/dsmm 0.2.0 → 0.3.0
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 +37 -67
- 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/cordis.patch.yml +14 -0
- package/docs/agent-presets.md +36 -52
- package/docs/compatibility.md +47 -110
- 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 +123 -2
- package/docs/roadmap.md +71 -17
- package/docs/settings-status.md +34 -169
- package/docs/skill-sync.md +52 -15
- package/lib/agent-registry.d.ts +36 -0
- package/lib/agent-registry.js +75 -0
- package/lib/child-admission-contract.d.ts +37 -0
- package/lib/child-admission-contract.js +2 -0
- package/lib/child-admission.d.ts +40 -0
- package/lib/child-admission.js +151 -0
- package/lib/child-capture.d.ts +85 -0
- package/lib/child-capture.js +205 -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-controller.js +1 -1
- 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 +83 -0
- package/lib/delivery-authority.js +397 -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 +288 -48
- 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 +40 -0
- package/lib/native-child-evidence.js +104 -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 +20 -16
- 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 +381 -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 +46 -8
- package/lib/role-policy.js +421 -61
- package/lib/role-providers.d.ts +2 -2
- package/lib/role-providers.js +27 -72
- package/lib/role-routing.d.ts +11 -2
- package/lib/role-routing.js +42 -25
- package/lib/role-runs.d.ts +138 -0
- package/lib/role-runs.js +335 -0
- package/lib/role-subagents.d.ts +58 -3
- package/lib/role-subagents.js +179 -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 +81 -0
- package/lib/runtime-integration.js +702 -0
- package/lib/runtime-recovery.js +18 -8
- package/lib/session-persistence.d.ts +2 -1
- package/lib/session-persistence.js +1 -1
- package/lib/session-scope.js +4 -1
- 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 +57 -0
- package/lib/subagent-runtime.js +257 -0
- package/package.json +149 -89
- 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/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/scripts/repair-session-log.mjs +0 -476
- package/scripts/session-repair-native-verifier.mjs +0 -367
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DshAgent } from "./dsh-types.js";
|
|
2
|
+
import type { DsmmProfileAdmission } from "./settings.js";
|
|
3
|
+
import type { ChildAdmissionEvidence, LegacyChildEvidence, PreparedChildAdmission } from "./child-capture.js";
|
|
4
|
+
import type { SubagentRuntimeAdmissionView } from "./profile-types.js";
|
|
5
|
+
export interface ParentAdmissionTicket {
|
|
6
|
+
readonly parent: DshAgent;
|
|
7
|
+
readonly owner: object;
|
|
8
|
+
readonly admission: DsmmProfileAdmission;
|
|
9
|
+
readonly parentEpoch: string;
|
|
10
|
+
readonly signal: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
/** Implemented by the explicit Host composition; no default or stock fallback. */
|
|
13
|
+
export interface DsmmChildAdmissionAuthority {
|
|
14
|
+
view(): SubagentRuntimeAdmissionView;
|
|
15
|
+
registerParent(parent: DshAgent, admission: DsmmProfileAdmission, owner: object): void;
|
|
16
|
+
acquireParentTicket(parent: DshAgent): ParentAdmissionTicket;
|
|
17
|
+
resolveChildEvidence(ticket: ParentAdmissionTicket, childId: string, signal: AbortSignal): Promise<ChildAdmissionEvidence>;
|
|
18
|
+
/** Preparation may fail before durable commit. Publication is synchronous and nonthrowing after it. */
|
|
19
|
+
prepareParentAdmission(parent: DshAgent, expectedEpoch: string, nextAdmission: DsmmProfileAdmission): void;
|
|
20
|
+
/** Host-only non-delivery CAS; it never issues or authorizes a delivery ticket. */
|
|
21
|
+
assertCoreParentAdmission?(parent: DshAgent, owner: object, expected: DsmmProfileAdmission): void;
|
|
22
|
+
prepareCoreParentAdmission?(parent: DshAgent, owner: object, expected: DsmmProfileAdmission, next: DsmmProfileAdmission): void;
|
|
23
|
+
publishParentAdmission(parent: DshAgent, expectedEpoch: string, nextAdmission: DsmmProfileAdmission, install: () => void): void;
|
|
24
|
+
revokeParent(parent: DshAgent, reason: string): void;
|
|
25
|
+
}
|
|
26
|
+
export interface ChildAdmissionCompletion {
|
|
27
|
+
/** A/C resolve immutable original evidence; B verifies identity and target ceiling in validateRole. */
|
|
28
|
+
prepare(agent: DshAgent, parent: DshAgent, ticket: ParentAdmissionTicket, signal: AbortSignal): Promise<PreparedChildAdmission>;
|
|
29
|
+
validateRole(agent: DshAgent, parent: DshAgent, prepared: ChildRoleAdmissionCandidate): void;
|
|
30
|
+
}
|
|
31
|
+
export interface ChildRoleAdmissionCandidate extends PreparedChildAdmission {
|
|
32
|
+
/** Derived from the exact live residency cache, not supplied by a caller or inferred from epoch equality. */
|
|
33
|
+
readonly retained: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** Trusted physical native folds; called only after verified absence of a new capture. */
|
|
36
|
+
export type LegacyChildEvidenceReader = (ticket: ParentAdmissionTicket, childId: string, signal: AbortSignal) => Promise<LegacyChildEvidence>;
|
|
37
|
+
//# sourceMappingURL=child-admission-contract.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
3
|
+
import type { ChildAdmissionCompletion, DsmmChildAdmissionAuthority, LegacyChildEvidenceReader, ParentAdmissionTicket } from "./child-admission-contract.js";
|
|
4
|
+
import type { ChildAdmissionEvidence, ChildAdmissionEvidenceView, ChildEvidenceField } from "./child-capture.js";
|
|
5
|
+
import type { DeliveryPolicyBinding, DsmmDeliveryAuthority } from "./delivery-authority.js";
|
|
6
|
+
import type { DshAgent } from "./dsh-types.js";
|
|
7
|
+
import type { NativeChildHistory } from "./native-child-evidence.js";
|
|
8
|
+
import type { DsmmProfileAdmission, DsmmSettings } from "./settings.js";
|
|
9
|
+
export interface ChildAdmissionCollaborators {
|
|
10
|
+
/** A owns resident/durable capture lookup and corruption-vs-absence decisions. */
|
|
11
|
+
resolveOriginalChildEvidence(ticket: ParentAdmissionTicket, childId: string, signal: AbortSignal, readLegacy: LegacyChildEvidenceReader): Promise<ChildAdmissionEvidence>;
|
|
12
|
+
/** B owns fresh invocation capture, role identity and target ceiling validation. */
|
|
13
|
+
childAdmission: ChildAdmissionCompletion;
|
|
14
|
+
assertDelivery(ticket: ParentAdmissionTicket, childId: string, evidence: ChildAdmissionEvidence): void;
|
|
15
|
+
classifyParent(parent: Agent): "dsmm" | "native";
|
|
16
|
+
}
|
|
17
|
+
export interface ChildAdmissionBindingOptions {
|
|
18
|
+
readonly ctx: Context;
|
|
19
|
+
readonly owner: object;
|
|
20
|
+
readonly deliveryAuthority: DsmmDeliveryAuthority<DsmmProfileAdmission, ChildAdmissionEvidence>;
|
|
21
|
+
readonly collaborators: ChildAdmissionCollaborators;
|
|
22
|
+
readonly nativeSubstrate: DsmmSettings;
|
|
23
|
+
/** The exact public Host query service, borrowed in the same scope as the native catalog. */
|
|
24
|
+
readonly nativeHistory: NativeChildHistory;
|
|
25
|
+
}
|
|
26
|
+
/** Connects A's structural contract to C1's opaque ticket provenance without manufacturing Agents. */
|
|
27
|
+
export declare function createChildAdmissionBinding(options: ChildAdmissionBindingOptions): {
|
|
28
|
+
authority: DsmmChildAdmissionAuthority;
|
|
29
|
+
policy: DeliveryPolicyBinding<DsmmProfileAdmission, ChildAdmissionEvidence>;
|
|
30
|
+
childAdmission: ChildAdmissionCompletion;
|
|
31
|
+
readLegacy: LegacyChildEvidenceReader;
|
|
32
|
+
resolveOriginalEvidence: (ticket: ParentAdmissionTicket, id: string, signal: AbortSignal) => Promise<ChildAdmissionEvidence>;
|
|
33
|
+
bind(scope: Context): () => void;
|
|
34
|
+
onAdmissionGuardsInstalled(): void;
|
|
35
|
+
/** Holder owner calls this before native disposal/drain; no replacement residency is revoked. */
|
|
36
|
+
revokeBeforeDispose(parent: DshAgent, dispose: () => void | Promise<void>): Promise<void>;
|
|
37
|
+
};
|
|
38
|
+
/** DTO consumers supply the CURRENT direct-parent epoch; original epochs are not an authorization equality test. */
|
|
39
|
+
export declare function projectChildAdmissionEvidence(evidence: ChildAdmissionEvidence, parentAdmissionEpoch: string, parentDenied?: readonly ChildEvidenceField[]): ChildAdmissionEvidenceView;
|
|
40
|
+
//# sourceMappingURL=child-admission.d.ts.map
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
2
|
+
import { SubagentError } from "@deepseek-ai/dsh-subagent";
|
|
3
|
+
import { parseChildAdmissionCapture, parseChildAdmissionEvidenceView, parseLegacyChildEvidence } from "./child-capture.js";
|
|
4
|
+
import { NativeChildEvidenceReader, assertNativeChildCapture } from "./native-child-evidence.js";
|
|
5
|
+
function unauthorized() { throw new SubagentError("Child admission requires an issued ticket and exact native Agent owner", "UNAUTHORIZED"); }
|
|
6
|
+
/** Connects A's structural contract to C1's opaque ticket provenance without manufacturing Agents. */
|
|
7
|
+
export function createChildAdmissionBinding(options) {
|
|
8
|
+
const { ctx, owner, deliveryAuthority: delivery, collaborators } = options;
|
|
9
|
+
const nativeTickets = new WeakMap();
|
|
10
|
+
const profileTickets = new WeakMap();
|
|
11
|
+
const registeredParents = new WeakMap();
|
|
12
|
+
const exact = (parent) => {
|
|
13
|
+
if (parent.id === undefined)
|
|
14
|
+
unauthorized();
|
|
15
|
+
const actual = ctx.agents.get(SessionId(parent.id));
|
|
16
|
+
if (actual === undefined || actual !== parent)
|
|
17
|
+
unauthorized();
|
|
18
|
+
return actual;
|
|
19
|
+
};
|
|
20
|
+
const assertNative = (ticket) => {
|
|
21
|
+
delivery.assertTicket(ticket);
|
|
22
|
+
if (ticket.owner !== owner || exact(ticket.parent) !== ticket.parent)
|
|
23
|
+
unauthorized();
|
|
24
|
+
};
|
|
25
|
+
const profileTicket = (ticket) => {
|
|
26
|
+
assertNative(ticket);
|
|
27
|
+
let borrowed = profileTickets.get(ticket);
|
|
28
|
+
if (borrowed === undefined) {
|
|
29
|
+
borrowed = Object.freeze({ parent: ticket.parent, owner: ticket.owner, admission: ticket.admission,
|
|
30
|
+
parentEpoch: ticket.parentEpoch, signal: ticket.signal });
|
|
31
|
+
profileTickets.set(ticket, borrowed);
|
|
32
|
+
nativeTickets.set(borrowed, ticket);
|
|
33
|
+
}
|
|
34
|
+
return borrowed;
|
|
35
|
+
};
|
|
36
|
+
const nativeTicket = (ticket) => {
|
|
37
|
+
const actual = nativeTickets.get(ticket);
|
|
38
|
+
if (actual === undefined)
|
|
39
|
+
unauthorized();
|
|
40
|
+
assertNative(actual);
|
|
41
|
+
return actual;
|
|
42
|
+
};
|
|
43
|
+
const reader = new NativeChildEvidenceReader(ctx, assertNative, options.nativeHistory);
|
|
44
|
+
const readLegacy = () => { throw new SubagentError("Child admission without a current capture or trusted fresh invocation is unsupported; no evidence is synthesized", "UNSUPPORTED_CAPABILITY"); };
|
|
45
|
+
const resolve = async (ticket, id, callerSignal) => {
|
|
46
|
+
assertNative(ticket);
|
|
47
|
+
const signal = AbortSignal.any([ticket.signal, callerSignal]);
|
|
48
|
+
signal.throwIfAborted();
|
|
49
|
+
const evidence = await collaborators.resolveOriginalChildEvidence(profileTicket(ticket), id, signal, readLegacy);
|
|
50
|
+
signal.throwIfAborted();
|
|
51
|
+
assertNative(ticket);
|
|
52
|
+
if ("mode" in evidence || evidence.version !== 3)
|
|
53
|
+
throw new SubagentError("Only current child capture V3 is supported", "UNSUPPORTED_CAPABILITY");
|
|
54
|
+
const parsed = parseChildAdmissionCapture(evidence);
|
|
55
|
+
const facts = await reader.read(ticket, id, signal);
|
|
56
|
+
signal.throwIfAborted();
|
|
57
|
+
assertNative(ticket);
|
|
58
|
+
assertNativeChildCapture(parsed, facts);
|
|
59
|
+
return evidence;
|
|
60
|
+
};
|
|
61
|
+
const authority = {
|
|
62
|
+
view: () => delivery.view(),
|
|
63
|
+
registerParent: (parent, admission, requestedOwner) => {
|
|
64
|
+
if (requestedOwner !== owner)
|
|
65
|
+
unauthorized();
|
|
66
|
+
const actual = exact(parent);
|
|
67
|
+
delivery.registerParent(actual, admission, owner);
|
|
68
|
+
registeredParents.set(parent, actual);
|
|
69
|
+
},
|
|
70
|
+
acquireParentTicket: parent => profileTicket(delivery.acquireParentTicket(exact(parent))),
|
|
71
|
+
resolveChildEvidence: async (ticket, id, signal) => resolve(nativeTicket(ticket), id, signal),
|
|
72
|
+
prepareParentAdmission: (parent, epoch, next) => delivery.prepareParentAdmission(exact(parent), epoch, next),
|
|
73
|
+
assertCoreParentAdmission: (parent, requestedOwner, expected) => {
|
|
74
|
+
if (requestedOwner !== owner)
|
|
75
|
+
unauthorized();
|
|
76
|
+
delivery.assertCoreParentAdmission(exact(parent), owner, expected);
|
|
77
|
+
},
|
|
78
|
+
prepareCoreParentAdmission: (parent, requestedOwner, expected, next) => {
|
|
79
|
+
if (requestedOwner !== owner)
|
|
80
|
+
unauthorized();
|
|
81
|
+
delivery.prepareCoreParentAdmission(exact(parent), owner, expected, next);
|
|
82
|
+
},
|
|
83
|
+
publishParentAdmission: (parent, epoch, next, install) => delivery.publishParentAdmission(exact(parent), epoch, next, install),
|
|
84
|
+
// Revocation may run during registry removal: use the exact object, never look up a replacement by ID.
|
|
85
|
+
revokeParent: (parent, reason) => {
|
|
86
|
+
const actual = registeredParents.get(parent);
|
|
87
|
+
if (actual !== undefined) {
|
|
88
|
+
delivery.withdrawParent(actual, reason);
|
|
89
|
+
registeredParents.delete(parent);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
const policy = {
|
|
94
|
+
classifyParent: collaborators.classifyParent,
|
|
95
|
+
resolveChildEvidence: resolve,
|
|
96
|
+
assertDelivery(ticket, id, evidence) { assertNative(ticket); collaborators.assertDelivery(profileTicket(ticket), id, evidence); assertNative(ticket); },
|
|
97
|
+
};
|
|
98
|
+
const childAdmission = {
|
|
99
|
+
async prepare(agent, parent, ticket, signal) {
|
|
100
|
+
const issued = nativeTicket(ticket);
|
|
101
|
+
if (exact(parent) !== issued.parent || ctx.agents.get(SessionId(agent.id)) !== agent || !ctx.agents.isOwnedBy(SessionId(agent.id), issued.parent))
|
|
102
|
+
unauthorized();
|
|
103
|
+
const merged = AbortSignal.any([signal, issued.signal]);
|
|
104
|
+
merged.throwIfAborted();
|
|
105
|
+
const prepared = await collaborators.childAdmission.prepare(agent, parent, ticket, merged);
|
|
106
|
+
merged.throwIfAborted();
|
|
107
|
+
assertNative(issued);
|
|
108
|
+
if ("mode" in prepared.evidence || prepared.evidence.version !== 3)
|
|
109
|
+
throw new SubagentError("Only current child capture V3 is supported", "UNSUPPORTED_CAPABILITY");
|
|
110
|
+
return prepared;
|
|
111
|
+
},
|
|
112
|
+
validateRole(agent, parent, candidate) {
|
|
113
|
+
if ("mode" in candidate.evidence || candidate.evidence.version !== 3)
|
|
114
|
+
throw new SubagentError("Only current child capture V3 is supported", "UNSUPPORTED_CAPABILITY");
|
|
115
|
+
collaborators.childAdmission.validateRole(agent, parent, candidate);
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
return { authority, policy, childAdmission, readLegacy,
|
|
119
|
+
resolveOriginalEvidence: (ticket, id, signal) => resolve(nativeTicket(ticket), id, signal),
|
|
120
|
+
bind(scope) { return delivery.bindPolicy(scope, owner, policy); },
|
|
121
|
+
onAdmissionGuardsInstalled() { delivery.enablePolicy(owner); },
|
|
122
|
+
/** Holder owner calls this before native disposal/drain; no replacement residency is revoked. */
|
|
123
|
+
async revokeBeforeDispose(parent, dispose) {
|
|
124
|
+
delivery.revokeParent(parent, "holder-disposed");
|
|
125
|
+
await dispose();
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/** DTO consumers supply the CURRENT direct-parent epoch; original epochs are not an authorization equality test. */
|
|
130
|
+
export function projectChildAdmissionEvidence(evidence, parentAdmissionEpoch, parentDenied = []) {
|
|
131
|
+
let view;
|
|
132
|
+
if ("mode" in evidence) {
|
|
133
|
+
const legacy = parseLegacyChildEvidence(evidence);
|
|
134
|
+
view = parseChildAdmissionEvidenceView({ mode: "legacy-conservative", parentAdmissionEpoch, provenFields: legacy.provenFields, limitations: legacy.limitations });
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const capture = parseChildAdmissionCapture(evidence);
|
|
138
|
+
const provenFields = ["lineage", "role", "route", "profile-pin", "admission-epoch", "invocation-level", "runtime-policy", "modules", "roles",
|
|
139
|
+
"read-only", "route-override", "max-depth", "locale", "tool-topology", "guards", "git-write", "shell", "delegation"];
|
|
140
|
+
if (capture.authorityCeiling.toolFilter !== undefined)
|
|
141
|
+
provenFields.push("tool-filter");
|
|
142
|
+
view = parseChildAdmissionEvidenceView({ mode: "captured", parentAdmissionEpoch, originalAdmissionEpoch: capture.originalAdmissionEpoch, provenFields,
|
|
143
|
+
limitations: [{ field: "active-intent", code: "missing-evidence", effect: "display-only" }, { field: "max-tokens", code: "not-persisted", effect: "native-default" },
|
|
144
|
+
{ field: "output-schema", code: "unverified", effect: "capability-denied" }] });
|
|
145
|
+
}
|
|
146
|
+
const limitations = new Map(view.limitations.map(item => [item.field, item]));
|
|
147
|
+
for (const field of parentDenied)
|
|
148
|
+
limitations.set(field, { field, code: "parent-denied", effect: "capability-denied" });
|
|
149
|
+
return parseChildAdmissionEvidenceView({ ...view, limitations: [...limitations.values()] });
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=child-admission.js.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { DsmmInvocationLevel, DsmmLocale, DsmmModelRoute, DsmmProfileAdmission, DsmmSettings, DsmmToolTopology } from "./settings.js";
|
|
2
|
+
import type { ResolvedModelParameterPolicy } from "./model-parameter-policy.js";
|
|
3
|
+
import type { DsmmRoleId } from "./roles.js";
|
|
4
|
+
import type { ChildAdmissionLimitation, ChildEvidenceField } from "./child-evidence.js";
|
|
5
|
+
export { CHILD_EVIDENCE_FIELDS, parseChildAdmissionEvidenceView } from "./child-evidence.js";
|
|
6
|
+
export type { ChildAdmissionEvidenceView, ChildAdmissionLimitation, ChildEvidenceField } from "./child-evidence.js";
|
|
7
|
+
import type { DsmmRouteSource } from "./profile-types.js";
|
|
8
|
+
export { DSMM_ROUTE_SOURCES } from "./profile-types.js";
|
|
9
|
+
export type { DsmmRouteSource } from "./profile-types.js";
|
|
10
|
+
export interface ChildToolFilter {
|
|
11
|
+
allow?: string[];
|
|
12
|
+
deny?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface ChildAuthorityCeiling {
|
|
15
|
+
roles: DsmmRoleId[];
|
|
16
|
+
readOnly: boolean;
|
|
17
|
+
toolFilter?: ChildToolFilter;
|
|
18
|
+
allowRouteOverride: boolean;
|
|
19
|
+
maxDepth: number;
|
|
20
|
+
}
|
|
21
|
+
export type ChildRuntimePolicyCapture = Pick<DsmmSettings, "modules" | "roleRouting" | "runtimePolicy" | "workflow" | "guards" | "runtimeRecovery" | "defaultActive" | "deepseekV4ProCalibration" | "deepseekV4ProDefaultReasoningEffort" | "deepseekFlashCalibration" | "deepseekFlashDefaultReasoningEffort" | "skills"> & {
|
|
22
|
+
subagents: Pick<DsmmSettings["subagents"], "enableRunInBackground" | "backgroundMode">;
|
|
23
|
+
};
|
|
24
|
+
interface ChildAdmissionCaptureBase {
|
|
25
|
+
childSessionId: string;
|
|
26
|
+
parentSessionId: string;
|
|
27
|
+
role: DsmmRoleId;
|
|
28
|
+
profilePin: {
|
|
29
|
+
id: string;
|
|
30
|
+
revision: string;
|
|
31
|
+
} | null;
|
|
32
|
+
originalAdmissionEpoch: string;
|
|
33
|
+
invocation: {
|
|
34
|
+
level: DsmmInvocationLevel;
|
|
35
|
+
initialRoute: DsmmModelRoute;
|
|
36
|
+
routeSource: DsmmRouteSource;
|
|
37
|
+
};
|
|
38
|
+
runtimePolicyCapture: ChildRuntimePolicyCapture;
|
|
39
|
+
authorityCeiling: ChildAuthorityCeiling;
|
|
40
|
+
locale?: DsmmLocale;
|
|
41
|
+
toolTopology: DsmmToolTopology;
|
|
42
|
+
}
|
|
43
|
+
export interface ChildAdmissionCaptureV1 extends ChildAdmissionCaptureBase {
|
|
44
|
+
version: 1;
|
|
45
|
+
}
|
|
46
|
+
export interface ChildAdmissionCaptureV2 extends ChildAdmissionCaptureBase {
|
|
47
|
+
version: 2;
|
|
48
|
+
modelParameterPolicy: ResolvedModelParameterPolicy;
|
|
49
|
+
invocation: ChildAdmissionCaptureBase["invocation"] & {
|
|
50
|
+
requestedRoute: DsmmModelRoute;
|
|
51
|
+
effortSource: "native" | "dsmm-config";
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface ChildAdmissionCaptureV3 extends Omit<ChildAdmissionCaptureV2, "version"> {
|
|
55
|
+
version: 3;
|
|
56
|
+
delegationMode: "one-shot" | "continuable";
|
|
57
|
+
}
|
|
58
|
+
export type ChildAdmissionCapture = ChildAdmissionCaptureV1 | ChildAdmissionCaptureV2 | ChildAdmissionCaptureV3;
|
|
59
|
+
/** Trusted native folds only; never synthesized from the current parent's settings. */
|
|
60
|
+
export interface LegacyChildEvidence {
|
|
61
|
+
version: 1;
|
|
62
|
+
mode: "legacy-conservative";
|
|
63
|
+
childSessionId: string;
|
|
64
|
+
parentSessionId: string;
|
|
65
|
+
role: DsmmRoleId;
|
|
66
|
+
route: DsmmModelRoute;
|
|
67
|
+
depth: number;
|
|
68
|
+
toolFilter?: ChildToolFilter;
|
|
69
|
+
active?: boolean;
|
|
70
|
+
provenFields: ChildEvidenceField[];
|
|
71
|
+
limitations: ChildAdmissionLimitation[];
|
|
72
|
+
}
|
|
73
|
+
export type ChildAdmissionEvidence = ChildAdmissionCapture | LegacyChildEvidence;
|
|
74
|
+
export interface PreparedChildAdmission {
|
|
75
|
+
evidence: ChildAdmissionEvidence;
|
|
76
|
+
/** The trusted resolver supplies legacy's conservative intersection, not a parent clone. */
|
|
77
|
+
admission: DsmmProfileAdmission;
|
|
78
|
+
/** Only new creation writes a capture. Retained/cold evidence never rewrites it. */
|
|
79
|
+
creation: boolean;
|
|
80
|
+
}
|
|
81
|
+
export declare function parseLegacyChildEvidence(input: unknown): LegacyChildEvidence;
|
|
82
|
+
export declare function parseChildAdmissionCapture(input: unknown): ChildAdmissionCapture;
|
|
83
|
+
/** Native service substrate stays Host-owned; all executable policy comes from original capture. */
|
|
84
|
+
export declare function admissionFromChildCapture(input: ChildAdmissionCapture, nativeSubstrate: DsmmSettings): DsmmProfileAdmission;
|
|
85
|
+
//# sourceMappingURL=child-capture.d.ts.map
|
|
@@ -0,0 +1,205 @@
|
|
|
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 && version !== 3)
|
|
92
|
+
fail();
|
|
93
|
+
const row = object(plain, ["version", "childSessionId", "parentSessionId", "role", "profilePin", "originalAdmissionEpoch", "invocation", "runtimePolicyCapture", "authorityCeiling", "toolTopology", ...version !== 1 ? ["modelParameterPolicy"] : [], ...version === 3 ? ["delegationMode"] : []], ["locale"]);
|
|
94
|
+
if (version !== 1)
|
|
95
|
+
parseModelParameterPolicy(row.modelParameterPolicy);
|
|
96
|
+
if (version === 3 && row.delegationMode !== "one-shot" && row.delegationMode !== "continuable")
|
|
97
|
+
fail();
|
|
98
|
+
text(row.childSessionId, 256);
|
|
99
|
+
text(row.parentSessionId, 256);
|
|
100
|
+
role(row.role);
|
|
101
|
+
epoch(row.originalAdmissionEpoch);
|
|
102
|
+
if (row.childSessionId === row.parentSessionId)
|
|
103
|
+
fail();
|
|
104
|
+
if (row.profilePin !== null) {
|
|
105
|
+
const pin = object(row.profilePin, ["id", "revision"]);
|
|
106
|
+
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))
|
|
107
|
+
fail();
|
|
108
|
+
epoch(pin.revision);
|
|
109
|
+
}
|
|
110
|
+
const invocation = object(row.invocation, ["level", "initialRoute", "routeSource", ...version !== 1 ? ["requestedRoute", "effortSource"] : []]);
|
|
111
|
+
if (typeof invocation.level !== "string" || !["normal", "low", "high", "max"].includes(invocation.level) || !DSMM_ROUTE_SOURCES.includes(invocation.routeSource))
|
|
112
|
+
fail();
|
|
113
|
+
(version === 1 ? legacyRoute : route)(invocation.initialRoute);
|
|
114
|
+
if (version !== 1) {
|
|
115
|
+
route(invocation.requestedRoute);
|
|
116
|
+
if (invocation.effortSource !== "native" && invocation.effortSource !== "dsmm-config")
|
|
117
|
+
fail();
|
|
118
|
+
}
|
|
119
|
+
const policyKeys = ["modules", "roleRouting", "runtimePolicy", "workflow", "guards", "runtimeRecovery", "defaultActive", "deepseekV4ProCalibration", "deepseekV4ProDefaultReasoningEffort", "deepseekFlashCalibration", "deepseekFlashDefaultReasoningEffort", "skills", "subagents"];
|
|
120
|
+
const policy = object(row.runtimePolicyCapture, policyKeys);
|
|
121
|
+
if (version === 1)
|
|
122
|
+
validateLegacyRoutes(policy);
|
|
123
|
+
const { modules, skills, subagents, ...overlay } = policy;
|
|
124
|
+
validateProfileOverlay(overlay);
|
|
125
|
+
object(modules, ["deepwork"]);
|
|
126
|
+
boolean(object(modules.deepwork, ["enabled"]).enabled);
|
|
127
|
+
const skillMap = object(skills, CAPTURE_SKILLS);
|
|
128
|
+
Object.values(skillMap).forEach(boolean);
|
|
129
|
+
const background = object(subagents, ["enableRunInBackground", "backgroundMode"]);
|
|
130
|
+
boolean(background.enableRunInBackground);
|
|
131
|
+
if (typeof background.backgroundMode !== "string" || !["one-shot", "continuable"].includes(background.backgroundMode))
|
|
132
|
+
fail();
|
|
133
|
+
const ceiling = object(row.authorityCeiling, ["roles", "readOnly", "allowRouteOverride", "maxDepth"], ["toolFilter"]);
|
|
134
|
+
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)))
|
|
135
|
+
fail();
|
|
136
|
+
boolean(ceiling.readOnly);
|
|
137
|
+
boolean(ceiling.allowRouteOverride);
|
|
138
|
+
integer(ceiling.maxDepth);
|
|
139
|
+
if (Object.hasOwn(ceiling, "toolFilter"))
|
|
140
|
+
filter(ceiling.toolFilter);
|
|
141
|
+
if (!ceiling.roles.includes(row.role) || !modules.deepwork.enabled)
|
|
142
|
+
fail();
|
|
143
|
+
if (typeof row.toolTopology !== "string" || !["per-role", "parameterized"].includes(row.toolTopology))
|
|
144
|
+
fail();
|
|
145
|
+
validateSparseConfig({ ...policy, ...(Object.hasOwn(row, "locale") ? { locale: row.locale } : {}), subagents: { ...background, toolTopology: row.toolTopology, allowRouteOverride: ceiling.allowRouteOverride, maxDepth: ceiling.maxDepth } }, true);
|
|
146
|
+
for (const key of ["modules", "runtimePolicy", "workflow", "guards", "runtimeRecovery"])
|
|
147
|
+
completeResolvedObject(policy[key], CAPTURE_POLICY_SHAPE[key]);
|
|
148
|
+
return freezeSettings(row);
|
|
149
|
+
}
|
|
150
|
+
// Persisted protocol completeness is independent of current configuration defaults.
|
|
151
|
+
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"];
|
|
152
|
+
const CAPTURE_POLICY_SHAPE = {
|
|
153
|
+
modules: { deepwork: { enabled: null } },
|
|
154
|
+
runtimePolicy: { strategy: null, rateLimit: { maxRetries: null, initialDelayMs: null, maxDelayMs: null, maxTotalDelayMs: null, switchAfterRateLimits: null, maxSwitches: null } },
|
|
155
|
+
workflow: { policy: null, strictGates: null, reviewCap: null, finalReviewPolicy: null },
|
|
156
|
+
guards: { scope: null, shellCommandSafety: null, gitWriteGuard: null, toolOutputTruncation: { enabled: null, maxInlineBytes: null }, planFormatValidation: null, questionLabelHelper: { enabled: null, maxLabelChars: null }, todoDisciplineHelper: null },
|
|
157
|
+
runtimeRecovery: { enabled: null, retryOnStatusCodes: null, retryOnCodes: null, fallbackRoutes: null, maxFallbackAttempts: null, idleContinuation: { enabled: null, maxContinuations: null, prompt: null } },
|
|
158
|
+
};
|
|
159
|
+
function validateLegacyRoutes(policy) {
|
|
160
|
+
const routing = object(policy.roleRouting, [], DSMM_ROLE_IDS);
|
|
161
|
+
for (const value of Object.values(routing)) {
|
|
162
|
+
const row = object(value, [], ["primary", "fallbackRoutes", "levels", "strategy", "rateLimit"]);
|
|
163
|
+
if (row.primary !== undefined)
|
|
164
|
+
legacyRoute(row.primary);
|
|
165
|
+
if (row.fallbackRoutes !== undefined) {
|
|
166
|
+
if (!Array.isArray(row.fallbackRoutes))
|
|
167
|
+
fail();
|
|
168
|
+
row.fallbackRoutes.forEach(legacyRoute);
|
|
169
|
+
}
|
|
170
|
+
if (row.levels !== undefined)
|
|
171
|
+
for (const level of Object.values(object(row.levels, [], ["low", "high", "max"]))) {
|
|
172
|
+
const entry = object(level, [], ["provider", "model", "reasoningEffort"]);
|
|
173
|
+
if (Object.hasOwn(entry, "provider") || Object.hasOwn(entry, "model"))
|
|
174
|
+
legacyRoute(entry);
|
|
175
|
+
else {
|
|
176
|
+
object(entry, ["reasoningEffort"]);
|
|
177
|
+
text(entry.reasoningEffort, 64);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const recovery = policy.runtimeRecovery;
|
|
182
|
+
if (!Array.isArray(recovery?.fallbackRoutes))
|
|
183
|
+
fail();
|
|
184
|
+
recovery.fallbackRoutes.forEach(legacyRoute);
|
|
185
|
+
}
|
|
186
|
+
function completeResolvedObject(input, template) {
|
|
187
|
+
if (template === null || typeof template !== "object" || Array.isArray(template))
|
|
188
|
+
return;
|
|
189
|
+
const row = object(input, Object.keys(template));
|
|
190
|
+
for (const [key, value] of Object.entries(template))
|
|
191
|
+
completeResolvedObject(row[key], value);
|
|
192
|
+
}
|
|
193
|
+
/** Native service substrate stays Host-owned; all executable policy comes from original capture. */
|
|
194
|
+
export function admissionFromChildCapture(input, nativeSubstrate) {
|
|
195
|
+
const capture = parseChildAdmissionCapture(input);
|
|
196
|
+
const { locale: _locale, ...substrate } = nativeSubstrate;
|
|
197
|
+
const settings = resolveConfig({ ...substrate, ...capture.runtimePolicyCapture,
|
|
198
|
+
modelParameters: { passthrough: capture.version === 1 || capture.modelParameterPolicy.mode !== "native-defaults" },
|
|
199
|
+
roles: Object.fromEntries(DSMM_ROLE_IDS.map(role => [role, capture.authorityCeiling.roles.includes(role)])),
|
|
200
|
+
...(capture.locale === undefined ? {} : { locale: capture.locale }), subagents: { ...capture.runtimePolicyCapture.subagents,
|
|
201
|
+
toolTopology: capture.toolTopology, allowRouteOverride: capture.authorityCeiling.allowRouteOverride, maxDepth: capture.authorityCeiling.maxDepth } });
|
|
202
|
+
return freezeSettings({ settings, profile: capture.profilePin, epoch: capture.originalAdmissionEpoch,
|
|
203
|
+
scope: capture.profilePin === null ? "deployment-baseline" : "session-override", childCapture: capture });
|
|
204
|
+
}
|
|
205
|
+
//# 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
|