@dsmm/dsmm 0.3.0 → 0.3.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 +26 -40
- package/cordis.patch.yml +9 -13
- package/docs/agent-presets.md +26 -14
- package/docs/compatibility.md +24 -68
- package/docs/deferred-native-approval-risk.md +8 -12
- package/docs/design.md +25 -254
- package/docs/lsp.md +2 -2
- package/docs/migration-from-ocmm.md +38 -51
- package/docs/model-routing.md +21 -21
- package/docs/native-permissions.md +17 -7
- package/docs/profiles.md +13 -9
- package/docs/releasing.md +25 -311
- package/docs/roadmap.md +52 -241
- package/docs/runtime-recovery.md +29 -91
- package/docs/safety-guards.md +19 -16
- package/docs/settings-status.md +23 -11
- package/docs/skill-sync.md +17 -17
- package/docs/web-fetch-fakeip.md +82 -0
- package/lib/child-capture.d.ts +12 -2
- package/lib/child-capture.js +22 -5
- package/lib/client/ChildPermissions.d.ts +43 -0
- package/lib/client/ChildPermissions.js +100 -0
- package/lib/client/ChildrenPanel.d.ts +5 -5
- package/lib/client/ChildrenPanel.js +6 -18
- package/lib/client/DeploymentFields.d.ts +32 -0
- package/lib/client/DeploymentFields.js +70 -0
- package/lib/client/DeploymentPage.d.ts +21 -6
- package/lib/client/DeploymentPage.js +80 -112
- package/lib/client/HistoryContinuation.d.ts +7 -0
- package/lib/client/HistoryContinuation.js +22 -0
- package/lib/client/NativeCommandEntries.d.ts +17 -0
- package/lib/client/NativeCommandEntries.js +68 -0
- package/lib/client/PermissionPanelEntry.d.ts +8 -0
- package/lib/client/PermissionPanelEntry.js +11 -0
- package/lib/client/PermissionsPanel.d.ts +3 -1
- package/lib/client/PermissionsPanel.js +10 -9
- package/lib/client/ProfilesSection.js +8 -6
- package/lib/client/RoleAvailability.js +1 -1
- package/lib/client/RoleToolView-data.d.ts +35 -0
- package/lib/client/RoleToolView-data.js +52 -0
- package/lib/client/RoleToolView-locales.d.ts +36 -0
- package/lib/client/RoleToolView-locales.js +20 -0
- package/lib/client/RoleToolView.d.ts +10 -0
- package/lib/client/RoleToolView.js +47 -0
- package/lib/client/SessionProfiles.js +51 -24
- package/lib/client/TemporaryPermissions.d.ts +21 -0
- package/lib/client/TemporaryPermissions.js +94 -0
- package/lib/client/children-controller.d.ts +2 -8
- package/lib/client/children-controller.js +1 -26
- package/lib/client/children-locales.d.ts +27 -52
- package/lib/client/children-locales.js +8 -12
- package/lib/client/configuration-display.d.ts +5 -0
- package/lib/client/configuration-display.js +11 -0
- package/lib/client/controller.d.ts +18 -0
- package/lib/client/controller.js +118 -28
- package/lib/client/deployment-controller.d.ts +13 -1
- package/lib/client/deployment-controller.js +84 -24
- package/lib/client/deployment-data.d.ts +1 -0
- package/lib/client/deployment-data.js +4 -1
- package/lib/client/deployment-locales.d.ts +43 -0
- package/lib/client/deployment-locales.js +45 -19
- package/lib/client/deployment-modules.d.ts +9 -0
- package/lib/client/deployment-modules.js +24 -0
- package/lib/client/deployment-workspace.d.ts +48 -0
- package/lib/client/deployment-workspace.js +123 -0
- package/lib/client/history-controller.d.ts +29 -0
- package/lib/client/history-controller.js +111 -0
- package/lib/client/history-entry.d.ts +11 -0
- package/lib/client/history-entry.js +106 -0
- package/lib/client/history-locales.d.ts +95 -0
- package/lib/client/history-locales.js +41 -0
- package/lib/client/index.js +26 -76
- package/lib/client/locales.d.ts +13 -0
- package/lib/client/locales.js +104 -86
- package/lib/client/permission-controller.d.ts +1 -0
- package/lib/client/permission-controller.js +3 -2
- package/lib/client/permission-locales.d.ts +51 -0
- package/lib/client/permission-locales.js +59 -19
- package/lib/client/session-labels.js +4 -3
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +9 -8
- package/lib/client/temporary-permission-client.d.ts +20 -0
- package/lib/client/temporary-permission-client.js +52 -0
- package/lib/client/temporary-permission-entry.d.ts +6 -0
- package/lib/client/temporary-permission-entry.js +56 -0
- package/lib/client.js +5691 -3439
- package/lib/commands.js +2 -0
- package/lib/config-file-store.d.ts +3 -0
- package/lib/config-file-store.js +4 -2
- package/lib/config-revision.d.ts +5 -0
- package/lib/config-revision.js +11 -0
- package/lib/core-permission-authority.js +11 -41
- package/lib/deployment-config.d.ts +9 -2
- package/lib/deployment-config.js +35 -8
- package/lib/deployment-permission-rules.js +19 -7
- package/lib/dsh-types.d.ts +1 -1
- package/lib/history-candidates.d.ts +30 -0
- package/lib/history-candidates.js +176 -0
- package/lib/history-codec.d.ts +11 -0
- package/lib/history-codec.js +102 -0
- package/lib/history-contract.d.ts +44 -0
- package/lib/history-contract.js +2 -0
- package/lib/history-controller.d.ts +42 -0
- package/lib/history-controller.js +329 -0
- package/lib/history-policy.d.ts +4 -0
- package/lib/history-policy.js +8 -0
- package/lib/history-remote.d.ts +28 -0
- package/lib/history-remote.js +17 -0
- package/lib/history-rpc.d.ts +24 -0
- package/lib/history-rpc.js +136 -0
- package/lib/history-support.d.ts +15 -0
- package/lib/history-support.js +21 -0
- package/lib/history-types.d.ts +67 -0
- package/lib/history-types.js +2 -0
- package/lib/host-llm-startup.js +3 -3
- package/lib/host-llm.d.ts +9 -3
- package/lib/host-llm.js +48 -8
- package/lib/index.d.ts +18 -20
- package/lib/index.js +147 -415
- package/lib/lifetime.d.ts +4 -0
- package/lib/lifetime.js +22 -0
- package/lib/live-pi-ai-owner.d.ts +1 -0
- package/lib/live-pi-ai-owner.js +8 -4
- package/lib/mode.d.ts +3 -2
- package/lib/mode.js +28 -41
- package/lib/model-routing.d.ts +2 -8
- package/lib/model-routing.js +59 -175
- package/lib/native-admission.d.ts +77 -0
- package/lib/native-admission.js +503 -0
- package/lib/native-pi-ai-wire.d.ts +3 -1
- package/lib/native-pi-ai-wire.js +47 -13
- package/lib/permission-child-control.d.ts +36 -0
- package/lib/permission-child-control.js +164 -0
- package/lib/permission-control.d.ts +2 -3
- package/lib/permission-control.js +7 -0
- package/lib/permission-controller.js +2 -2
- package/lib/permission-exec-argv.d.ts +32 -0
- package/lib/permission-exec-argv.js +171 -0
- package/lib/permission-fs-search.js +2 -1
- package/lib/permission-fs.js +2 -1
- package/lib/permission-native-rules.js +3 -3
- package/lib/permission-temporary-files.d.ts +19 -0
- package/lib/permission-temporary-files.js +248 -0
- package/lib/permission-temporary-grants.d.ts +106 -0
- package/lib/permission-temporary-grants.js +198 -0
- package/lib/permission-temporary-install.d.ts +25 -0
- package/lib/permission-temporary-install.js +86 -0
- package/lib/permission-temporary-remote.d.ts +19 -0
- package/lib/permission-temporary-remote.js +75 -0
- package/lib/permission-temporary-rpc.d.ts +37 -0
- package/lib/permission-temporary-rpc.js +154 -0
- package/lib/permission-temporary-types.d.ts +47 -0
- package/lib/permission-temporary-types.js +2 -0
- package/lib/permission-temporary-web.d.ts +11 -0
- package/lib/permission-temporary-web.js +154 -0
- package/lib/permission-web.js +2 -1
- package/lib/preset-registry.js +3 -2
- package/lib/preset-skills.d.ts +3 -12
- package/lib/preset-skills.js +28 -58
- package/lib/profile-diagnostics.d.ts +1 -1
- package/lib/profile-diagnostics.js +2 -2
- package/lib/profile-remote.js +61 -22
- package/lib/profile-rpc.d.ts +4 -3
- package/lib/profile-rpc.js +35 -37
- package/lib/profile-runtime.d.ts +42 -74
- package/lib/profile-runtime.js +314 -617
- package/lib/profile-store.d.ts +20 -8
- package/lib/profile-store.js +112 -63
- package/lib/profile-types.d.ts +19 -4
- package/lib/profiles.d.ts +3 -1
- package/lib/profiles.js +9 -7
- package/lib/prompt-content.d.ts +1 -0
- package/lib/prompt-content.js +4 -1
- package/lib/prompts.d.ts +2 -12
- package/lib/prompts.js +11 -66
- package/lib/role-control-remote.d.ts +1 -4
- package/lib/role-control-remote.js +8 -36
- package/lib/role-control-rpc.d.ts +10 -36
- package/lib/role-control-rpc.js +112 -269
- package/lib/role-control-types.d.ts +3 -26
- package/lib/role-control-types.js +3 -4
- package/lib/role-identity.d.ts +5 -0
- package/lib/role-identity.js +10 -0
- package/lib/role-invocation.d.ts +3 -3
- package/lib/role-invocation.js +2 -2
- package/lib/role-llm-runtime.js +5 -11
- package/lib/role-policy.d.ts +19 -50
- package/lib/role-policy.js +136 -508
- package/lib/role-providers.d.ts +5 -8
- package/lib/role-providers.js +20 -86
- package/lib/role-routing.d.ts +1 -3
- package/lib/role-routing.js +24 -34
- package/lib/role-subagents.d.ts +5 -14
- package/lib/role-subagents.js +163 -108
- package/lib/runtime-integration.d.ts +5 -78
- package/lib/runtime-integration.js +11 -697
- package/lib/session-metadata.d.ts +13 -12
- package/lib/session-metadata.js +6 -31
- package/lib/session-scope.js +2 -1
- package/lib/settings.d.ts +5 -18
- package/lib/settings.js +19 -43
- package/lib/skills.d.ts +1 -0
- package/lib/skills.js +5 -1
- package/lib/state.d.ts +3 -2
- package/lib/state.js +26 -10
- package/lib/status.d.ts +1 -9
- package/lib/status.js +3 -55
- package/lib/web-fetch-address-policy.d.ts +24 -0
- package/lib/web-fetch-address-policy.js +189 -0
- package/lib/web-fetch-fakeip.d.ts +25 -0
- package/lib/web-fetch-fakeip.js +107 -0
- package/package.json +124 -106
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-gateway@0.2.1-rc.2.patch +13291 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-remotes@0.2.1-rc.2.patch +9133 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-client-ui-approval@0.2.1-rc.2.patch +156 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-subagent@0.2.1-rc.2.patch +3546 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-user-approval@0.2.1-rc.2.patch +431 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-web@0.2.1-rc.2.patch +119 -0
- package/patches/dsh-approval-settlement/README.md +41 -0
- package/patches/dsh-approval-settlement/metadata.json +10 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-loop@0.2.1-rc.2.patch +383 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-preset-registry@0.2.1-rc.2.patch +55 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-api-session-controller@0.2.1-rc.2.patch +16673 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-subagent@0.2.1-rc.2.patch +29 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-workspace@0.2.1-rc.2.patch +196 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence-jsonl@0.2.1-rc.2.patch +35 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence@0.2.1-rc.2.patch +40 -0
- package/docs/research/deepseek-v4-pro.md +0 -74
- package/docs/research/oh-dsh.md +0 -96
- package/lib/agent-registry.d.ts +0 -36
- package/lib/agent-registry.js +0 -75
- package/lib/child-admission.d.ts +0 -40
- package/lib/child-admission.js +0 -151
- package/lib/delivery-authority.d.ts +0 -83
- package/lib/delivery-authority.js +0 -397
- package/lib/native-child-evidence.d.ts +0 -40
- package/lib/native-child-evidence.js +0 -104
- package/lib/role-runs.d.ts +0 -138
- package/lib/role-runs.js +0 -335
- package/lib/session-persistence.d.ts +0 -36
- package/lib/session-persistence.js +0 -304
- package/lib/subagent-runtime.d.ts +0 -57
- package/lib/subagent-runtime.js +0 -257
- package/prompts/deepseek-flash.md +0 -11
- package/prompts/deepseek-v4-pro.md +0 -14
package/lib/preset-skills.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { DshContext } from "./dsh-types.js";
|
|
3
|
-
import type { DsmmSkillName } from "./skills.js";
|
|
1
|
+
import type { DshAgent, DshContext } from "./dsh-types.js";
|
|
4
2
|
import type { DsmmSettingsGetter } from "./settings.js";
|
|
5
3
|
import type { DeepworkModeController } from "./state.js";
|
|
6
|
-
|
|
7
|
-
export declare
|
|
8
|
-
export interface PresetSkillsConfig {
|
|
9
|
-
skills?: DsmmSkillName[];
|
|
10
|
-
}
|
|
11
|
-
export declare const Config: Schema<PresetSkillsConfig>;
|
|
12
|
-
export declare function apply(ctx: DshContext, config?: PresetSkillsConfig): void;
|
|
13
|
-
export declare function registerAgentSkills(ctx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter): void;
|
|
14
|
-
export default apply;
|
|
4
|
+
/** Admission owns installation; mode changes only invalidate this Agent's lazy provider. */
|
|
5
|
+
export declare function registerAgentSkills(ctx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter, agent: DshAgent, lifetime: AbortSignal, catalogReady?: () => boolean): void;
|
|
15
6
|
//# sourceMappingURL=preset-skills.d.ts.map
|
package/lib/preset-skills.js
CHANGED
|
@@ -1,69 +1,39 @@
|
|
|
1
|
-
import Schema from "@deepseek-ai/schemastery";
|
|
2
1
|
import { getTraceable } from "@deepseek-ai/cordis";
|
|
3
|
-
import {
|
|
2
|
+
import { registerBundledSkills } from "./skills.js";
|
|
4
3
|
import { nativeAgentContext, scopeParentOf } from "./native-scope.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const mounted = new Map();
|
|
18
|
-
const remove = (agent) => { mounted.get(agent)?.provider.dispose(); mounted.delete(agent); };
|
|
19
|
-
const reconcile = (agent) => {
|
|
20
|
-
const agentCtx = nativeAgentContext(agent);
|
|
21
|
-
const presets = ctx.get?.("agentPresets");
|
|
22
|
-
const raw = presets?.serviceFor(agent, "skills") ?? agentCtx.get("skills");
|
|
23
|
-
const previous = mounted.get(agent), parent = scopeParentOf(agent);
|
|
24
|
-
const settings = getSettings(agent);
|
|
4
|
+
const bindings = new WeakMap();
|
|
5
|
+
/** Admission owns installation; mode changes only invalidate this Agent's lazy provider. */
|
|
6
|
+
export function registerAgentSkills(ctx, controller, getSettings, agent, lifetime, catalogReady) {
|
|
7
|
+
const refresh = bindings.get(agent);
|
|
8
|
+
if (refresh) {
|
|
9
|
+
refresh();
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let mounted;
|
|
13
|
+
const remove = () => { mounted?.provider.dispose(); mounted = undefined; };
|
|
14
|
+
const reconcile = () => {
|
|
15
|
+
const agentCtx = nativeAgentContext(agent), settings = getSettings(agent);
|
|
25
16
|
if (!settings.modules.deepwork.enabled || !controller.active(agent, settings.defaultActive)) {
|
|
26
|
-
remove(
|
|
17
|
+
remove();
|
|
27
18
|
return;
|
|
28
19
|
}
|
|
20
|
+
const presets = ctx.get?.("agentPresets");
|
|
21
|
+
const raw = presets?.serviceFor(agent, "skills") ?? agentCtx.get("skills"), parent = scopeParentOf(agent);
|
|
29
22
|
if (raw === undefined)
|
|
30
|
-
throw new Error("
|
|
31
|
-
if (
|
|
32
|
-
|
|
23
|
+
throw new Error("Active skills require the native skill registry");
|
|
24
|
+
if (mounted?.parent === parent && mounted?.registry === raw) {
|
|
25
|
+
mounted.provider.invalidate();
|
|
33
26
|
return;
|
|
34
27
|
}
|
|
35
|
-
remove(
|
|
36
|
-
|
|
37
|
-
const provider = registerBundledSkills(agentCtx, registry, { agent, controller, getSettings });
|
|
38
|
-
mounted.set(agent, { parent, registry: raw, provider });
|
|
28
|
+
remove();
|
|
29
|
+
mounted = { parent, registry: raw, provider: registerBundledSkills(agentCtx, getTraceable(agentCtx, raw), { agent, controller, getSettings, catalogReady }) };
|
|
39
30
|
};
|
|
40
|
-
const stopMode = controller.watch(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
}, { global: true });
|
|
49
|
-
const disposed = ctx.on?.("agent/disposed", ({ agent }) => remove(agent), { global: true });
|
|
50
|
-
const modeEvent = ctx.on?.("session/event", (session, event) => {
|
|
51
|
-
if (event.type !== "deepwork/mode")
|
|
52
|
-
return;
|
|
53
|
-
const agent = ctx.get?.("agents")?.list().find((agent) => agent.session === session);
|
|
54
|
-
if (agent !== undefined)
|
|
55
|
-
reconcile(agent);
|
|
56
|
-
}, { global: true });
|
|
57
|
-
ctx.effect?.(() => () => {
|
|
58
|
-
stopMode();
|
|
59
|
-
for (const stop of [created, selected, disposed, modeEvent])
|
|
60
|
-
if (typeof stop === "function")
|
|
61
|
-
stop();
|
|
62
|
-
for (const agent of [...mounted.keys()])
|
|
63
|
-
remove(agent);
|
|
64
|
-
});
|
|
65
|
-
for (const agent of ctx.get?.("agents")?.list() ?? [])
|
|
66
|
-
reconcile(agent);
|
|
31
|
+
const stopMode = controller.watch(changed => { if (changed === agent)
|
|
32
|
+
reconcile(); });
|
|
33
|
+
bindings.set(agent, reconcile);
|
|
34
|
+
const dispose = () => { stopMode(); remove(); bindings.delete(agent); lifetime.removeEventListener("abort", dispose); };
|
|
35
|
+
lifetime.addEventListener("abort", dispose, { once: true });
|
|
36
|
+
ctx.effect?.(() => dispose);
|
|
37
|
+
reconcile();
|
|
67
38
|
}
|
|
68
|
-
export default apply;
|
|
69
39
|
//# sourceMappingURL=preset-skills.js.map
|
|
@@ -26,7 +26,7 @@ export interface ProfileDiagnostic {
|
|
|
26
26
|
reason: string;
|
|
27
27
|
location?: ProfileDiagnosticLocation;
|
|
28
28
|
}
|
|
29
|
-
export declare const DEPRECATED_DSMM_FIELDS: readonly ["deepseekV4ProMaxReasoningPresets", "deepseekFlashMaxReasoningPresets"];
|
|
29
|
+
export declare const DEPRECATED_DSMM_FIELDS: readonly ["deepseekV4ProMaxReasoningPresets", "deepseekFlashMaxReasoningPresets", "deepseekV4ProCalibration", "deepseekV4ProDefaultReasoningEffort", "deepseekFlashCalibration", "deepseekFlashDefaultReasoningEffort"];
|
|
30
30
|
/** Host parser location provenance only; never serialized on an error or DTO. */
|
|
31
31
|
export declare function diagnosticSourcePath(error: object): readonly (string | number)[] | undefined;
|
|
32
32
|
export declare function safeDiagnosticField(parts: readonly (string | number)[]): string;
|
|
@@ -14,7 +14,7 @@ export const PROFILE_DIAGNOSTIC_REASONS = {
|
|
|
14
14
|
"deployment-ceiling": "A named profile cannot enable capabilities outside its captured deployment ceiling.",
|
|
15
15
|
"blank-label": "The label is blank; the profile ID is used for display."
|
|
16
16
|
};
|
|
17
|
-
export const DEPRECATED_DSMM_FIELDS = ["deepseekV4ProMaxReasoningPresets", "deepseekFlashMaxReasoningPresets"];
|
|
17
|
+
export const DEPRECATED_DSMM_FIELDS = ["deepseekV4ProMaxReasoningPresets", "deepseekFlashMaxReasoningPresets", "deepseekV4ProCalibration", "deepseekV4ProDefaultReasoningEffort", "deepseekFlashCalibration", "deepseekFlashDefaultReasoningEffort"];
|
|
18
18
|
function schemaFieldShape(schema) {
|
|
19
19
|
if (schema.type === "transform")
|
|
20
20
|
return schemaFieldShape(schema.inner);
|
|
@@ -36,7 +36,7 @@ const configFields = {
|
|
|
36
36
|
locale: null, modeName: null, section: null, defaultActive: null, promptOrder: null,
|
|
37
37
|
deepseekV4ProCalibration: null, deepseekV4ProDefaultReasoningEffort: null, deepseekFlashCalibration: null, deepseekFlashDefaultReasoningEffort: null,
|
|
38
38
|
deepseekV4ProMaxReasoningPresets: null, deepseekFlashMaxReasoningPresets: null,
|
|
39
|
-
modules: { deepwork: { enabled: null } },
|
|
39
|
+
modules: { deepwork: { enabled: null } },
|
|
40
40
|
skills: "skills", roles: "roles", roleRouting: "role-routing", runtimePolicy: { strategy: null, rateLimit },
|
|
41
41
|
presets: { materialize: null, plannerRootEnabled: null, root: null }, subagents: { toolTopology: null, allowRouteOverride: null, enableRunInBackground: null, backgroundMode: null, maxDepth: null },
|
|
42
42
|
workflow: { policy: null, strictGates: null, reviewCap: null, finalReviewPolicy: null },
|
package/lib/profile-remote.js
CHANGED
|
@@ -4,6 +4,7 @@ import { parseModelParameterPolicy } from "./model-parameter-policy.js";
|
|
|
4
4
|
import { DSMM_ROUTE_SOURCES } from "./profile-types.js";
|
|
5
5
|
import { diagnostic, isSafeDiagnosticField, PROFILE_DIAGNOSTIC_REASONS } from "./profile-diagnostics.js";
|
|
6
6
|
import { normalizeModelRouteJson } from "./route-json.js";
|
|
7
|
+
import { isConfigRevision, isProfileReference } from "./config-revision.js";
|
|
7
8
|
const errorCodes = new Set(["validation", "conflict", "not-found", "lock-timeout", "unsafe-path", "io", "activation", "corrupt-selection", "limit", "busy", "maintenance", "disposed", "not-owned", "unavailable", "cancelled"]);
|
|
8
9
|
const idPattern = /^[a-z0-9][a-z0-9_-]{0,63}$/u;
|
|
9
10
|
const revisionPattern = /^[a-f0-9]{64}$/u;
|
|
@@ -26,11 +27,31 @@ function id(value) {
|
|
|
26
27
|
return result;
|
|
27
28
|
}
|
|
28
29
|
function revision(value) {
|
|
29
|
-
const result = text(value, "revision",
|
|
30
|
-
if (!
|
|
30
|
+
const result = text(value, "revision", 128);
|
|
31
|
+
if (!isConfigRevision(result))
|
|
31
32
|
fail("revision");
|
|
32
33
|
return result;
|
|
33
34
|
}
|
|
35
|
+
function epoch(value) {
|
|
36
|
+
if (typeof value !== "string" || !revisionPattern.test(value))
|
|
37
|
+
fail("epoch");
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
function reference(value) {
|
|
41
|
+
if (!isProfileReference(value))
|
|
42
|
+
fail("reference");
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
function modeRevision(value) {
|
|
46
|
+
if (typeof value !== "string" || !(/^(?:[a-f0-9]{64}|mode-v1-[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12})$/u).test(value))
|
|
47
|
+
fail("mode revision");
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
function refresh(value) { if (value !== true)
|
|
51
|
+
fail("refreshRequired"); return true; }
|
|
52
|
+
function observedRevision(value, row) {
|
|
53
|
+
return value === "unavailable" && row.refreshRequired === true ? value : selectionRevision(value);
|
|
54
|
+
}
|
|
34
55
|
function selectionRevision(value) { return value === "absent" ? value : revision(value); }
|
|
35
56
|
/** Opaque native identities are never interpreted as paths. */
|
|
36
57
|
export function isNativeSessionId(value) {
|
|
@@ -134,16 +155,16 @@ function roleAvailabilityList(value) {
|
|
|
134
155
|
}
|
|
135
156
|
export function parseSubagentRuntimeAdmissionView(value) {
|
|
136
157
|
const row = object(value, ["binding", "deliveryFenceReady", "restartRequired"], ["reason"]);
|
|
137
|
-
if (typeof row.binding !== "string" || !["stock", "
|
|
158
|
+
if (typeof row.binding !== "string" || !["stock", "unavailable"].includes(row.binding) || row.reason !== undefined && row.reason !== "authority-not-ready")
|
|
138
159
|
fail("subagentRuntime");
|
|
139
160
|
const ready = boolean(row.deliveryFenceReady, "deliveryFenceReady");
|
|
140
|
-
if (ready && (row.binding
|
|
161
|
+
if (ready && (row.binding === "unavailable" || row.reason !== undefined))
|
|
141
162
|
fail("subagentRuntime readiness");
|
|
142
163
|
return { binding: row.binding, deliveryFenceReady: ready, restartRequired: boolean(row.restartRequired, "restartRequired"), ...(row.reason === undefined ? {} : { reason: row.reason }) };
|
|
143
164
|
}
|
|
144
165
|
function readResult(value) {
|
|
145
|
-
const item = object(value, ["id", "revision", "content"], ["label", "warnings"]);
|
|
146
|
-
return { id: id(item.id), revision: revision(item.revision), content: content(item.content), ...optional(item, "label", (input) => text(input, "label", 120)), ...optional(item, "warnings", warnings) };
|
|
166
|
+
const item = object(value, ["id", "revision", "content"], ["label", "warnings", "refreshRequired"]);
|
|
167
|
+
return { id: id(item.id), revision: item.revision === "unavailable" && item.refreshRequired === true ? "unavailable" : revision(item.revision), content: content(item.content), ...optional(item, "refreshRequired", refresh), ...optional(item, "label", (input) => text(input, "label", 120)), ...optional(item, "warnings", warnings) };
|
|
147
168
|
}
|
|
148
169
|
function content(value) {
|
|
149
170
|
const result = text(value, "content", 128 * 1024);
|
|
@@ -152,7 +173,7 @@ function content(value) {
|
|
|
152
173
|
return result;
|
|
153
174
|
}
|
|
154
175
|
function snapshot(value) {
|
|
155
|
-
const item = object(value, ["profiles", "selectedId", "appliedRevision", "selectionRevision"], ["selectionError", "roles", "editorDefaults", "origin", "readOnly", "writeRestriction", "selectedWarnings"]);
|
|
176
|
+
const item = object(value, ["profiles", "selectedId", "appliedRevision", "selectionRevision"], ["selectionError", "roles", "editorDefaults", "origin", "readOnly", "writeRestriction", "selectedWarnings", "sourceRevision", "refreshRequired"]);
|
|
156
177
|
if (!Array.isArray(item.profiles) || item.profiles.length > 128)
|
|
157
178
|
fail("profiles");
|
|
158
179
|
return {
|
|
@@ -161,8 +182,9 @@ function snapshot(value) {
|
|
|
161
182
|
return { id: text(row.id, "id", 64), revision: row.revision === null ? null : revision(row.revision), ...optional(row, "label", (input) => text(input, "label", 120)), ...optional(row, "error", errorInfo), ...optional(row, "warnings", warnings) };
|
|
162
183
|
}),
|
|
163
184
|
selectedId: item.selectedId === null ? null : id(item.selectedId),
|
|
164
|
-
appliedRevision: item.appliedRevision === null ? null :
|
|
165
|
-
selectionRevision: item.selectionRevision === "unavailable" && Object.hasOwn(item, "selectionError") ? "unavailable" :
|
|
185
|
+
appliedRevision: item.appliedRevision === null ? null : reference(item.appliedRevision),
|
|
186
|
+
selectionRevision: item.selectionRevision === "unavailable" && Object.hasOwn(item, "selectionError") ? "unavailable" : observedRevision(item.selectionRevision, item),
|
|
187
|
+
...optional(item, "sourceRevision", revision), ...optional(item, "refreshRequired", refresh),
|
|
166
188
|
...optional(item, "selectionError", errorInfo),
|
|
167
189
|
...optional(item, "selectedWarnings", warnings),
|
|
168
190
|
...optional(item, "roles", (input) => {
|
|
@@ -252,16 +274,28 @@ export function parseDsmmInvocationView(value) {
|
|
|
252
274
|
return { role: target, label: text(row.label, "label", 120), level: row.level, routeSource: row.routeSource, mode: row.mode, ...optional(row, "route", modelRoute), ...optional(row, "runId", sessionId), ...optional(row, "childId", sessionId), ...optional(row, "jobId", sessionId), ...(routeComparison === undefined ? {} : { routeComparison }) };
|
|
253
275
|
}
|
|
254
276
|
function selectionState(value) {
|
|
255
|
-
const item = object(value, ["selectedId", "appliedRevision", "selectionRevision"]);
|
|
256
|
-
return { selectedId: item.selectedId === null ? null : id(item.selectedId), appliedRevision: item.appliedRevision === null ? null :
|
|
277
|
+
const item = object(value, ["selectedId", "appliedRevision", "selectionRevision"], ["sourceRevision", "refreshRequired"]);
|
|
278
|
+
return { selectedId: item.selectedId === null ? null : id(item.selectedId), appliedRevision: item.appliedRevision === null ? null : reference(item.appliedRevision), selectionRevision: observedRevision(item.selectionRevision, item), ...optional(item, "sourceRevision", revision), ...optional(item, "refreshRequired", refresh) };
|
|
279
|
+
}
|
|
280
|
+
function actionUnavailableReason(value) {
|
|
281
|
+
if (typeof value !== "string" || !["busy", "maintenance", "module-off", "runtime-unavailable", "model-unconfigured", "model-service-unavailable", "new-session-required"].includes(value))
|
|
282
|
+
fail("actionUnavailableReason");
|
|
283
|
+
return value;
|
|
257
284
|
}
|
|
258
285
|
function sessionSnapshot(value) {
|
|
259
|
-
const item = object(value, ["sessionId", "globalDefault", "selection", "scope", "admissionEpoch", "switchAllowed"], ["admittedSelection", "switchUnavailableReason", "rolePolicy", "profileModel", "deepwork", "modules", "configuration", "warnings", "roles", "subagentRuntime"]);
|
|
286
|
+
const item = object(value, ["sessionId", "globalDefault", "selection", "scope", "admissionEpoch", "switchAllowed", "canSelectModel", "canToggleMode", "canApplyOverlay"], ["admittedSelection", "switchUnavailableReason", "selectModelUnavailableReason", "toggleModeUnavailableReason", "applyOverlayUnavailableReason", "rolePolicy", "profileModel", "deepwork", "modules", "configuration", "warnings", "roles", "subagentRuntime", "refreshRequired"]);
|
|
260
287
|
if (typeof item.scope !== "string" || !["global-default", "session-override", "deployment-baseline"].includes(item.scope))
|
|
261
288
|
fail("scope");
|
|
262
289
|
return {
|
|
263
290
|
sessionId: sessionId(item.sessionId), globalDefault: selectionState(item.globalDefault), selection: selectionState(item.selection),
|
|
264
|
-
scope: item.scope, admissionEpoch:
|
|
291
|
+
scope: item.scope, admissionEpoch: epoch(item.admissionEpoch), switchAllowed: boolean(item.switchAllowed, "switchAllowed"),
|
|
292
|
+
canSelectModel: boolean(item.canSelectModel, "canSelectModel"),
|
|
293
|
+
canToggleMode: boolean(item.canToggleMode, "canToggleMode"),
|
|
294
|
+
canApplyOverlay: boolean(item.canApplyOverlay, "canApplyOverlay"),
|
|
295
|
+
...optional(item, "selectModelUnavailableReason", actionUnavailableReason),
|
|
296
|
+
...optional(item, "toggleModeUnavailableReason", actionUnavailableReason),
|
|
297
|
+
...optional(item, "applyOverlayUnavailableReason", actionUnavailableReason),
|
|
298
|
+
...optional(item, "refreshRequired", refresh),
|
|
265
299
|
...optional(item, "admittedSelection", selectionState),
|
|
266
300
|
...optional(item, "switchUnavailableReason", (input) => {
|
|
267
301
|
if (typeof input !== "string" || !["busy", "maintenance", "disposed", "not-owned", "unavailable"].includes(input))
|
|
@@ -277,7 +311,7 @@ function sessionSnapshot(value) {
|
|
|
277
311
|
...optional(item, "subagentRuntime", parseSubagentRuntimeAdmissionView),
|
|
278
312
|
...optional(item, "deepwork", (input) => {
|
|
279
313
|
const mode = object(input, ["active", "explicit", "locked", "revision"]);
|
|
280
|
-
return { active: boolean(mode.active, "active"), explicit: boolean(mode.explicit, "explicit"), locked: boolean(mode.locked, "locked"), revision:
|
|
314
|
+
return { active: boolean(mode.active, "active"), explicit: boolean(mode.explicit, "explicit"), locked: boolean(mode.locked, "locked"), revision: modeRevision(mode.revision) };
|
|
281
315
|
}),
|
|
282
316
|
};
|
|
283
317
|
}
|
|
@@ -297,11 +331,11 @@ function selectRequest(value) {
|
|
|
297
331
|
function sessionSelectRequest(value) {
|
|
298
332
|
const item = object(value, ["sessionId", "id", "expectedSelectionRevision", "expectedAdmissionEpoch"], ["expectedRevision"]);
|
|
299
333
|
const { sessionId: inputSessionId, expectedAdmissionEpoch, ...profileRequest } = item;
|
|
300
|
-
return { ...selectRequest(profileRequest), sessionId: sessionId(inputSessionId), expectedAdmissionEpoch:
|
|
334
|
+
return { ...selectRequest(profileRequest), sessionId: sessionId(inputSessionId), expectedAdmissionEpoch: epoch(expectedAdmissionEpoch) };
|
|
301
335
|
}
|
|
302
336
|
function modeSelectRequest(value) {
|
|
303
337
|
const item = object(value, ["sessionId", "active", "expectedModeRevision", "expectedAdmissionEpoch"]);
|
|
304
|
-
return { sessionId: sessionId(item.sessionId), active: boolean(item.active, "active"), expectedModeRevision:
|
|
338
|
+
return { sessionId: sessionId(item.sessionId), active: boolean(item.active, "active"), expectedModeRevision: modeRevision(item.expectedModeRevision), expectedAdmissionEpoch: epoch(item.expectedAdmissionEpoch) };
|
|
305
339
|
}
|
|
306
340
|
function codec(symbol, parse) {
|
|
307
341
|
return { mode: "strict", typeSymbol: `@dsmm/dsmm#${symbol}`, create: () => ({ parse: value => parse(jsonData(value)) }) };
|
|
@@ -341,9 +375,9 @@ function jsonData(value, depth = 0, active = new Set()) {
|
|
|
341
375
|
return result;
|
|
342
376
|
}
|
|
343
377
|
function globalSnapshot(value) {
|
|
344
|
-
const row = object(value, ["config", "revision"]);
|
|
378
|
+
const row = object(value, ["config", "revision"], ["refreshRequired"]);
|
|
345
379
|
object(row.config, [], Object.keys(row.config));
|
|
346
|
-
return { config: jsonData(row.config), revision:
|
|
380
|
+
return { config: jsonData(row.config), revision: observedRevision(row.revision, row), ...optional(row, "refreshRequired", refresh) };
|
|
347
381
|
}
|
|
348
382
|
function admissionView(value) {
|
|
349
383
|
const row = object(value, ["settings", "sources", "captures", "restartRequired", "named"], ["modelParameterPolicy"]);
|
|
@@ -361,7 +395,7 @@ function admissionView(value) {
|
|
|
361
395
|
const named = row.named === null ? null : object(row.named, ["id", "revision"]);
|
|
362
396
|
return { ...optional(row, "modelParameterPolicy", value => parseModelParameterPolicy(jsonData(value))), settings: readOnlySettingsData(row.settings), sources: jsonData(row.sources),
|
|
363
397
|
captures: jsonData(row.captures), restartRequired: row.restartRequired.map(value => text(value, "field", 256)),
|
|
364
|
-
named: named === null ? null : { id: id(named.id), revision:
|
|
398
|
+
named: named === null ? null : { id: id(named.id), revision: reference(named.revision) } };
|
|
365
399
|
}
|
|
366
400
|
function readOnlySettingsData(value) {
|
|
367
401
|
const settings = jsonData(value);
|
|
@@ -393,14 +427,15 @@ function readOnlySettingsData(value) {
|
|
|
393
427
|
return settings;
|
|
394
428
|
}
|
|
395
429
|
function editorSnapshot(value) {
|
|
396
|
-
const row = object(value, ["entryId", "namespace", "hostProfileKey", "global", "globalRevision", "profile", "nativeRevision", "nativeFormRevision", "nativeForm", "desired", "sources", "startup", "defaults", "schema", "nextRoot", "modules"], ["startupSources"]);
|
|
430
|
+
const row = object(value, ["entryId", "namespace", "hostProfileKey", "global", "globalRevision", "profile", "nativeRevision", "nativeFormRevision", "nativeForm", "desired", "sources", "startup", "defaults", "schema", "nextRoot", "modules"], ["startupSources", "nativeSchema", "subagentRuntime"]);
|
|
397
431
|
const result = jsonData(row);
|
|
398
432
|
text(row.entryId, "entryId", 256);
|
|
399
433
|
if (row.namespace !== null)
|
|
400
434
|
text(row.namespace, "namespace", 256);
|
|
401
|
-
|
|
435
|
+
epoch(row.hostProfileKey);
|
|
402
436
|
selectionRevision(row.globalRevision);
|
|
403
|
-
|
|
437
|
+
if (row.nativeRevision !== "unavailable" && (typeof row.nativeRevision !== "string" || !/^native-v1-\d+$/u.test(row.nativeRevision)))
|
|
438
|
+
fail("nativeRevision");
|
|
404
439
|
if (row.nativeFormRevision !== null)
|
|
405
440
|
integer(row.nativeFormRevision, "nativeFormRevision");
|
|
406
441
|
for (const key of ["global", "profile", "desired", "sources", "startup", "defaults", "schema"])
|
|
@@ -412,6 +447,10 @@ function editorSnapshot(value) {
|
|
|
412
447
|
result.desired = readOnlySettingsData(row.desired);
|
|
413
448
|
result.startup = readOnlySettingsData(row.startup);
|
|
414
449
|
result.schema = schemaNode(row.schema);
|
|
450
|
+
if (row.nativeSchema !== undefined)
|
|
451
|
+
result.nativeSchema = schemaNode(row.nativeSchema);
|
|
452
|
+
if (row.subagentRuntime !== undefined)
|
|
453
|
+
result.subagentRuntime = parseSubagentRuntimeAdmissionView(row.subagentRuntime);
|
|
415
454
|
for (const map of [result.sources, result.startupSources]) {
|
|
416
455
|
if (map === undefined)
|
|
417
456
|
continue;
|
package/lib/profile-rpc.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import type { DsmmProfileRuntime } from "./profile-runtime.js";
|
|
|
10
10
|
export interface ProfilesBackend {
|
|
11
11
|
describe(): Promise<ProfileSnapshot>;
|
|
12
12
|
read(id: string): Promise<ProfileReadResult>;
|
|
13
|
-
save(request: ProfileSaveRequest): Promise<ProfileReadResult>;
|
|
14
|
-
select(request: ProfileSelectRequest): Promise<ProfileSnapshot>;
|
|
13
|
+
save(request: ProfileSaveRequest, assertAuthority?: () => void): Promise<ProfileReadResult>;
|
|
14
|
+
select(request: ProfileSelectRequest, assertAuthority?: () => void): Promise<ProfileSnapshot>;
|
|
15
15
|
getSession(agent: DshAgent): Promise<SessionProfileSnapshot>;
|
|
16
16
|
selectSession(request: SessionProfileSelectRequest, capturedAgent: DshAgent, signal?: AbortSignal, assertAuthority?: () => void): Promise<SessionProfileSnapshot>;
|
|
17
17
|
selectMode?(request: SessionModeSelectRequest, capturedAgent: DshAgent, signal?: AbortSignal, assertAuthority?: () => void): Promise<SessionProfileSnapshot>;
|
|
@@ -22,11 +22,12 @@ export declare class DsmmProfilesHost extends TypertRemoteService {
|
|
|
22
22
|
private readonly lifetime;
|
|
23
23
|
constructor(ctx: Context, backend: ProfilesBackend);
|
|
24
24
|
private invoke;
|
|
25
|
+
private captureAuthority;
|
|
25
26
|
describe(): Promise<ProfileSnapshot>;
|
|
26
27
|
read(id: string): Promise<ProfileReadResult>;
|
|
27
28
|
save(request: ProfileSaveRequest): Promise<ProfileReadResult>;
|
|
28
29
|
select(request: ProfileSelectRequest): Promise<ProfileSnapshot>;
|
|
29
|
-
/** Native Connection's exact
|
|
30
|
+
/** Native Connection's exact browser Peer is authority, not a claimed Peer ID. */
|
|
30
31
|
private invokeSession;
|
|
31
32
|
describeSession(sessionId: string): Promise<SessionProfileSnapshot>;
|
|
32
33
|
selectSession(sessionId: string, request: SessionProfileSelectRequest): Promise<SessionProfileSnapshot>;
|
package/lib/profile-rpc.js
CHANGED
|
@@ -33,12 +33,12 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
33
33
|
done = true;
|
|
34
34
|
};
|
|
35
35
|
import { symbols } from "@deepseek-ai/cordis";
|
|
36
|
-
import { Remote, RemoteError, TypertRemoteService
|
|
37
|
-
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
36
|
+
import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
38
37
|
import { parseProfileErrorInfo, TYPERT_HOST } from "./profile-remote.js";
|
|
39
38
|
import { DsmmProfileError, profileErrorInfo } from "./profiles.js";
|
|
40
39
|
import { projectDsmmModules } from "./modules.js";
|
|
41
40
|
import { DEFAULT_DSMM_SETTINGS, deploymentEditorSchema } from "./settings.js";
|
|
41
|
+
import { runtimeAdmissionView } from "./runtime-integration.js";
|
|
42
42
|
import { readOnlySettings, readOnlySettingSources } from "./status.js";
|
|
43
43
|
/** Business service addressed only by native Typert Gateway invocations. */
|
|
44
44
|
let DsmmProfilesHost = (() => {
|
|
@@ -91,11 +91,33 @@ let DsmmProfilesHost = (() => {
|
|
|
91
91
|
throw new RemoteError("dsmm-profiles/refused", "The Host refused the profile operation.", parseProfileErrorInfo(profileErrorInfo(error)));
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
captureAuthority() {
|
|
95
|
+
assertLocalSettingsOperator(this.ctx);
|
|
96
|
+
const invocation = this.ctx.invocation;
|
|
97
|
+
const connection = this.ctx.get("connection");
|
|
98
|
+
const owner = Reflect.get(connection, symbols.original) ?? connection;
|
|
99
|
+
const signal = AbortSignal.any([invocation.signal, invocation.peer.signal, this.lifetime.signal]);
|
|
100
|
+
const assertAuthority = () => {
|
|
101
|
+
if (signal.aborted)
|
|
102
|
+
throw new DsmmProfileError("cancelled", "The profile operation was cancelled before commit.");
|
|
103
|
+
assertLocalSettingsOperator(this.ctx);
|
|
104
|
+
const current = this.ctx.get("connection");
|
|
105
|
+
if ((Reflect.get(current, symbols.original) ?? current) !== owner || current.browserPeer !== invocation.peer) {
|
|
106
|
+
throw new DsmmProfileError("not-owned", "The operator connection changed before committing the profile operation.");
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
assertAuthority();
|
|
110
|
+
return assertAuthority;
|
|
111
|
+
}
|
|
94
112
|
describe() { return this.invoke(() => this.backend.describe()); }
|
|
95
113
|
read(id) { return this.invoke(() => this.backend.read(id)); }
|
|
96
|
-
save(request) {
|
|
97
|
-
|
|
98
|
-
|
|
114
|
+
save(request) {
|
|
115
|
+
return this.invoke(() => this.backend.save(request, this.captureAuthority()));
|
|
116
|
+
}
|
|
117
|
+
select(request) {
|
|
118
|
+
return this.invoke(() => this.backend.select(request, this.captureAuthority()));
|
|
119
|
+
}
|
|
120
|
+
/** Native Connection's exact browser Peer is authority, not a claimed Peer ID. */
|
|
99
121
|
async invokeSession(sessionId, operation, readOnly = false) {
|
|
100
122
|
return this.invoke(async () => {
|
|
101
123
|
const invocation = this.ctx.invocation;
|
|
@@ -110,6 +132,8 @@ let DsmmProfilesHost = (() => {
|
|
|
110
132
|
const checkAuthority = () => {
|
|
111
133
|
if (signal.aborted)
|
|
112
134
|
throw new DsmmProfileError("cancelled", "The session profile operation was cancelled; no late selection is allowed.");
|
|
135
|
+
if (!readOnly)
|
|
136
|
+
assertLocalSettingsOperator(this.ctx);
|
|
113
137
|
const currentConnection = this.ctx.get("connection");
|
|
114
138
|
const currentOwner = currentConnection === undefined ? undefined : Reflect.get(currentConnection, symbols.original) ?? currentConnection;
|
|
115
139
|
if (currentOwner !== connectionOwner || currentConnection?.browserPeer !== invocation.peer) {
|
|
@@ -122,36 +146,9 @@ let DsmmProfilesHost = (() => {
|
|
|
122
146
|
return agents;
|
|
123
147
|
};
|
|
124
148
|
let agents = checkAuthority();
|
|
125
|
-
|
|
126
|
-
if (captured === undefined)
|
|
127
|
-
|
|
128
|
-
// after full strict JSON decoding and operator admission, so invalid or
|
|
129
|
-
// unauthorized calls cannot cold-resume a native session as a side effect.
|
|
130
|
-
const controller = this.ctx.get("sessionController");
|
|
131
|
-
if (controller === undefined || typeof controller.resolveAgent !== "function") {
|
|
132
|
-
throw new DsmmProfileError("unavailable", "The native ordinary-session resume service is unavailable.");
|
|
133
|
-
}
|
|
134
|
-
let found;
|
|
135
|
-
try {
|
|
136
|
-
found = await controller.resolveAgent(SessionId(sessionId));
|
|
137
|
-
}
|
|
138
|
-
catch {
|
|
139
|
-
checkAuthority();
|
|
140
|
-
throw new DsmmProfileError("unavailable", "The native session could not be safely resumed.", "sessionId");
|
|
141
|
-
}
|
|
142
|
-
agents = checkAuthority();
|
|
143
|
-
if ("error" in found) {
|
|
144
|
-
const code = remoteErrorOf(found.error)?.code;
|
|
145
|
-
if (code === "session/not-found")
|
|
146
|
-
throw new DsmmProfileError("not-found", "The native session was not found.", "sessionId");
|
|
147
|
-
if (code === "session/agent-busy")
|
|
148
|
-
throw new DsmmProfileError("not-owned", "Subagent-owned sessions cannot select a root profile.", "sessionId");
|
|
149
|
-
if (code === "session/writer-held")
|
|
150
|
-
throw new DsmmProfileError("busy", "The native session is owned by another active writer.", "sessionId");
|
|
151
|
-
throw new DsmmProfileError("unavailable", "The native session could not be safely resumed.", "sessionId");
|
|
152
|
-
}
|
|
153
|
-
captured = found.agent;
|
|
154
|
-
}
|
|
149
|
+
const captured = agents.get(sessionId);
|
|
150
|
+
if (captured === undefined)
|
|
151
|
+
throw new DsmmProfileError("unavailable", "Session admission is unknown; read-only configuration queries never resume history.", "sessionId");
|
|
155
152
|
const agent = captured;
|
|
156
153
|
const checkCaptured = () => {
|
|
157
154
|
const current = checkAuthority();
|
|
@@ -267,12 +264,13 @@ let DsmmConfigHost = (() => {
|
|
|
267
264
|
const runtime = this.runtime?.() ?? this.ctx.get("dsmmProfileRuntime");
|
|
268
265
|
return { entryId: desired.entryId, namespace: desired.nativeNamespace ?? null, hostProfileKey: desired.hostProfileKey,
|
|
269
266
|
global: desired.global, globalRevision: desired.globalRevision,
|
|
270
|
-
profile: desired.profile, nativeRevision: desired.nativeRevision,
|
|
267
|
+
profile: { ...desired.profile }, nativeRevision: desired.nativeRevision,
|
|
271
268
|
nativeFormRevision: desired.nativeFormRevision ?? null, nativeForm: desired.nativeForm === undefined ? null : { base: desired.nativeForm.base ?? null, user: desired.nativeForm.user ?? null },
|
|
272
269
|
desired: { ...readOnlySettings(desired.settings) }, sources: readOnlySettingSources(desired.sources),
|
|
273
270
|
startup: { ...readOnlySettings(this.startup) }, defaults: DEFAULT_DSMM_SETTINGS,
|
|
274
271
|
...(this.startupSources === undefined ? {} : { startupSources: readOnlySettingSources(this.startupSources) }),
|
|
275
|
-
schema: deploymentEditorSchema(),
|
|
272
|
+
schema: deploymentEditorSchema(), nativeSchema: deploymentEditorSchema(true),
|
|
273
|
+
subagentRuntime: runtimeAdmissionView(this.ctx), nextRoot: runtime?.previewDeployment(desired) ?? null,
|
|
276
274
|
modules: projectDsmmModules(this.startup, desired, undefined, true, this.getMountedPermission) };
|
|
277
275
|
}
|
|
278
276
|
catch (error) {
|