@dsmm/dsmm 0.3.0 → 0.3.1
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 +0 -13
- package/docs/agent-presets.md +26 -14
- package/docs/compatibility.md +19 -73
- 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 +34 -280
- package/docs/roadmap.md +23 -254
- 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/ChildrenPanel.d.ts +1 -4
- package/lib/client/ChildrenPanel.js +4 -16
- package/lib/client/DeploymentFields.d.ts +28 -0
- package/lib/client/DeploymentFields.js +68 -0
- package/lib/client/DeploymentPage.d.ts +17 -5
- package/lib/client/DeploymentPage.js +79 -112
- package/lib/client/NativeCommandEntries.d.ts +17 -0
- package/lib/client/NativeCommandEntries.js +68 -0
- package/lib/client/PermissionsPanel.d.ts +1 -1
- package/lib/client/PermissionsPanel.js +8 -8
- package/lib/client/ProfilesSection.js +7 -5
- 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 +39 -15
- 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 +1 -0
- package/lib/client/controller.js +20 -13
- 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 +35 -9
- 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/index.js +11 -74
- package/lib/client/locales.d.ts +7 -0
- package/lib/client/locales.js +12 -6
- package/lib/client/permission-controller.d.ts +1 -0
- package/lib/client/permission-controller.js +3 -2
- package/lib/client/permission-locales.d.ts +25 -0
- package/lib/client/permission-locales.js +24 -4
- 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.js +2713 -2361
- 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/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 +16 -20
- package/lib/index.js +130 -416
- 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 +56 -0
- package/lib/native-admission.js +313 -0
- package/lib/native-pi-ai-wire.d.ts +3 -1
- package/lib/native-pi-ai-wire.js +47 -13
- package/lib/permission-control.d.ts +0 -3
- 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 +33 -37
- package/lib/profile-runtime.d.ts +31 -74
- package/lib/profile-runtime.js +224 -639
- package/lib/profile-store.d.ts +18 -6
- package/lib/profile-store.js +104 -62
- package/lib/profile-types.d.ts +18 -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 +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 +148 -106
- 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/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 +113 -103
- 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
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import type { DshSession } from "./dsh-types.js";
|
|
2
|
+
import type { DsmmRolePolicyEventData } from "./dsh-events.js";
|
|
3
|
+
declare module "@deepseek-ai/dsh-session/types" {
|
|
4
|
+
interface PluginRecordMap {
|
|
5
|
+
"plugin:dsmm/mode": {
|
|
6
|
+
active: boolean;
|
|
7
|
+
};
|
|
8
|
+
"plugin:dsmm/role-policy": DsmmRolePolicyEventData;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** Model-hidden observations use the official ignorable record boundary, never authorization. */
|
|
12
|
+
export declare function appendModeRecord(session: DshSession, active: boolean): void;
|
|
13
|
+
export declare function appendRolePolicyRecord(session: DshSession, data: DsmmRolePolicyEventData): void;
|
|
13
14
|
//# sourceMappingURL=session-metadata.d.ts.map
|
package/lib/session-metadata.js
CHANGED
|
@@ -1,34 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const persistence = ctx?.get?.("sessionPersistence");
|
|
6
|
-
if (persistence !== undefined && (typeof persistence !== "object" || persistence === null
|
|
7
|
-
|| persistence[DSMM_PERSISTENCE_COMPATIBILITY] !== true)) {
|
|
8
|
-
throw new Error("Deepwork requires @dsmm/dsmm/session-persistence for durable session metadata; no unsafe event was appended");
|
|
9
|
-
}
|
|
1
|
+
import { appendPluginRecord } from "@deepseek-ai/dsh-session";
|
|
2
|
+
/** Model-hidden observations use the official ignorable record boundary, never authorization. */
|
|
3
|
+
export function appendModeRecord(session, active) {
|
|
4
|
+
appendPluginRecord(session, "plugin:dsmm/mode", { active });
|
|
10
5
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (event.type !== "deepwork/mode" && event.type !== "dsmm/role-policy")
|
|
14
|
-
return event;
|
|
15
|
-
const envelope = event;
|
|
16
|
-
const allowedKeys = ["type", "seq", "time", "data", "ignorable"];
|
|
17
|
-
const validEnvelope = Reflect.ownKeys(event).every((key) => typeof key === "string" && allowedKeys.includes(key))
|
|
18
|
-
&& ["type", "seq", "time", "data"].every((key) => Object.hasOwn(event, key))
|
|
19
|
-
&& Number.isSafeInteger(envelope.seq) && envelope.seq >= 0 && !Object.is(envelope.seq, -0)
|
|
20
|
-
&& Number.isSafeInteger(envelope.time);
|
|
21
|
-
const data = event.data;
|
|
22
|
-
const record = typeof data === "object" && data !== null && !Array.isArray(data)
|
|
23
|
-
&& (Object.getPrototypeOf(data) === Object.prototype || Object.getPrototypeOf(data) === null)
|
|
24
|
-
? data : undefined;
|
|
25
|
-
const valid = record !== undefined && (event.type === "deepwork/mode"
|
|
26
|
-
? Reflect.ownKeys(record).length === 1 && typeof record.active === "boolean"
|
|
27
|
-
: Reflect.ownKeys(record).length === 3 && record.version === 1 && isDsmmRoleId(record.role)
|
|
28
|
-
&& (record.policy === null || typeof record.policy === "string" && /^[a-f0-9]{64}$/u.test(record.policy)));
|
|
29
|
-
if (!validEnvelope || !valid || event.ignorable !== undefined && event.ignorable !== true) {
|
|
30
|
-
throw new TypeError("invalid Deepwork session metadata; refusing to mark it ignorable");
|
|
31
|
-
}
|
|
32
|
-
return event.ignorable === true ? event : { ...event, ignorable: true };
|
|
6
|
+
export function appendRolePolicyRecord(session, data) {
|
|
7
|
+
appendPluginRecord(session, "plugin:dsmm/role-policy", data);
|
|
33
8
|
}
|
|
34
9
|
//# sourceMappingURL=session-metadata.js.map
|
package/lib/session-scope.js
CHANGED
|
@@ -3,7 +3,8 @@ import { isDsmmRoleId } from "./roles.js";
|
|
|
3
3
|
import { roleFromProviderName } from "./role-providers.js";
|
|
4
4
|
import { capturedRoleInvocation } from "./role-invocation.js";
|
|
5
5
|
export function sessionEvents(session) {
|
|
6
|
-
return session?.snapshotEvents?.() ?? session?.events ?? []
|
|
6
|
+
return (session?.snapshotEvents?.() ?? session?.events ?? []).map(event => event.type === "plugin:dsmm/mode"
|
|
7
|
+
? { ...event, type: "deepwork/mode" } : event.type === "plugin:dsmm/role-policy" ? { ...event, type: "dsmm/role-policy" } : event);
|
|
7
8
|
}
|
|
8
9
|
export function resolveSelectedAgentPreset(session) {
|
|
9
10
|
const events = sessionEvents(session);
|
package/lib/settings.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ export type { DsmmRateLimitPolicy, DsmmRoutingStrategy, DsmmRuntimePolicyConfig,
|
|
|
14
14
|
export { resolveRoleRuntimePolicy } from "./routing-policy.js";
|
|
15
15
|
export { DSMM_SKILL_NAMES, MVP_SKILL_NAMES } from "./skills.js";
|
|
16
16
|
export type { DsmmSkillName, MvpSkillName } from "./skills.js";
|
|
17
|
-
export type DeepseekCalibration = "off" | "auto" | "strict";
|
|
18
|
-
export type DeepseekDefaultReasoningEffort = "off" | "low" | "high";
|
|
19
17
|
export type DsmmFinalReviewPolicy = "simple-oracle-complex-reviewer" | "reviewer-only" | "off";
|
|
20
18
|
export type DsmmGuardScope = "deepwork-or-dsmm-agent" | "always" | "off";
|
|
21
19
|
export type DsmmGitWritePolicy = "ask" | "deny" | "off";
|
|
@@ -108,17 +106,8 @@ export interface DsmmPluginConfig {
|
|
|
108
106
|
enabled?: boolean;
|
|
109
107
|
};
|
|
110
108
|
};
|
|
111
|
-
/** Startup-only native storage binding; never a runtime-profile field. */
|
|
112
|
-
sessionPersistence?: {
|
|
113
|
-
root: string;
|
|
114
|
-
compression?: "zstd" | "none";
|
|
115
|
-
};
|
|
116
109
|
modeName?: string;
|
|
117
110
|
section?: string;
|
|
118
|
-
deepseekV4ProCalibration?: DeepseekCalibration;
|
|
119
|
-
deepseekV4ProDefaultReasoningEffort?: DeepseekDefaultReasoningEffort;
|
|
120
|
-
deepseekFlashCalibration?: DeepseekCalibration;
|
|
121
|
-
deepseekFlashDefaultReasoningEffort?: DeepseekDefaultReasoningEffort;
|
|
122
111
|
defaultActive?: boolean;
|
|
123
112
|
promptOrder?: number;
|
|
124
113
|
skills?: Partial<Record<DsmmSkillName, boolean>>;
|
|
@@ -132,6 +121,7 @@ export interface DsmmPluginConfig {
|
|
|
132
121
|
runtimeRecovery?: DsmmRuntimeRecoveryConfig;
|
|
133
122
|
lsp?: Partial<DsmmLspSettings>;
|
|
134
123
|
}
|
|
124
|
+
export type DsmmNativeConfig = DsmmPluginConfig;
|
|
135
125
|
export interface DsmmSettings {
|
|
136
126
|
permissionControl: PermissionControlSettings;
|
|
137
127
|
modelParameters: {
|
|
@@ -146,10 +136,6 @@ export interface DsmmSettings {
|
|
|
146
136
|
modeName: string;
|
|
147
137
|
defaultActive: boolean;
|
|
148
138
|
promptOrder: number;
|
|
149
|
-
deepseekV4ProCalibration: DeepseekCalibration;
|
|
150
|
-
deepseekV4ProDefaultReasoningEffort: DeepseekDefaultReasoningEffort;
|
|
151
|
-
deepseekFlashCalibration: DeepseekCalibration;
|
|
152
|
-
deepseekFlashDefaultReasoningEffort: DeepseekDefaultReasoningEffort;
|
|
153
139
|
skills: Record<DsmmSkillName, boolean>;
|
|
154
140
|
roles: Record<DsmmRoleId, boolean>;
|
|
155
141
|
roleRouting: DsmmRoleRouting;
|
|
@@ -232,9 +218,10 @@ export interface RegisterSettingsOptions {
|
|
|
232
218
|
}
|
|
233
219
|
export declare const DEFAULT_DSMM_SETTINGS: DsmmSettings;
|
|
234
220
|
/** Only data is transported. Defaults remain resolved by the existing authority. */
|
|
235
|
-
export declare function deploymentEditorSchema(): DeploymentSchemaNode;
|
|
236
|
-
export declare const DSMM_CONFIG_SCHEMA: Schema<
|
|
237
|
-
export declare const DSMM_NATIVE_CONFIG_SCHEMA: Schema<
|
|
221
|
+
export declare function deploymentEditorSchema(native?: boolean): DeploymentSchemaNode;
|
|
222
|
+
export declare const DSMM_CONFIG_SCHEMA: Schema<DsmmNativeConfig>;
|
|
223
|
+
export declare const DSMM_NATIVE_CONFIG_SCHEMA: Schema<DsmmNativeConfig>;
|
|
224
|
+
export declare function validateNativeConfig(input: unknown): DsmmNativeConfig;
|
|
238
225
|
export declare const DSMM_SETTINGS_SCHEMA: Schema<DsmmSettings>;
|
|
239
226
|
export declare function resolveConfig(config?: DsmmPluginConfig): DsmmSettings;
|
|
240
227
|
/** Reject references, accessors, prototypes and non-JSON data before any merge. */
|
package/lib/settings.js
CHANGED
|
@@ -18,10 +18,6 @@ export const DEFAULT_DSMM_SETTINGS = {
|
|
|
18
18
|
modeName: "deepwork",
|
|
19
19
|
defaultActive: false,
|
|
20
20
|
promptOrder: 50,
|
|
21
|
-
deepseekV4ProCalibration: "auto",
|
|
22
|
-
deepseekV4ProDefaultReasoningEffort: "high",
|
|
23
|
-
deepseekFlashCalibration: "auto",
|
|
24
|
-
deepseekFlashDefaultReasoningEffort: "high",
|
|
25
21
|
skills: createDefaultSkillSettings(),
|
|
26
22
|
roles: createDefaultRoleSettings(),
|
|
27
23
|
roleRouting: {},
|
|
@@ -190,16 +186,6 @@ const RUNTIME_RECOVERY_SCHEMA = Schema.object({
|
|
|
190
186
|
maxFallbackAttempts: Schema.number().default(DEFAULT_DSMM_SETTINGS.runtimeRecovery.maxFallbackAttempts),
|
|
191
187
|
idleContinuation: RUNTIME_RECOVERY_IDLE_CONTINUATION_SCHEMA
|
|
192
188
|
});
|
|
193
|
-
const DEEPSEEK_CALIBRATION_SCHEMA = Schema.union([
|
|
194
|
-
Schema.const("off"),
|
|
195
|
-
Schema.const("auto"),
|
|
196
|
-
Schema.const("strict")
|
|
197
|
-
]).default(DEFAULT_DSMM_SETTINGS.deepseekV4ProCalibration);
|
|
198
|
-
const DEEPSEEK_DEFAULT_REASONING_EFFORT_SCHEMA = Schema.union([
|
|
199
|
-
Schema.const("off"),
|
|
200
|
-
Schema.const("low"),
|
|
201
|
-
Schema.const("high")
|
|
202
|
-
]).default(DEFAULT_DSMM_SETTINGS.deepseekV4ProDefaultReasoningEffort);
|
|
203
189
|
const LSP_SCHEMA = Schema.object({
|
|
204
190
|
enabled: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.lsp.enabled),
|
|
205
191
|
serverName: Schema.string().default(DEFAULT_DSMM_SETTINGS.lsp.serverName),
|
|
@@ -214,18 +200,10 @@ const CONFIG_FIELDS_SCHEMA = Schema.object({
|
|
|
214
200
|
permissionControl: permissionControlSchema,
|
|
215
201
|
modelParameters: Schema.object({ passthrough: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.modelParameters.passthrough) }),
|
|
216
202
|
locale: LOCALE_SCHEMA,
|
|
217
|
-
sessionPersistence: Schema.union([Schema.const(undefined), Schema.object({
|
|
218
|
-
root: Schema.string().required(),
|
|
219
|
-
compression: Schema.union([Schema.const("zstd"), Schema.const("none")])
|
|
220
|
-
})]),
|
|
221
203
|
modeName: Schema.string().default(DEFAULT_DSMM_SETTINGS.modeName),
|
|
222
204
|
section: Schema.string(),
|
|
223
205
|
defaultActive: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.defaultActive),
|
|
224
206
|
promptOrder: Schema.number().default(DEFAULT_DSMM_SETTINGS.promptOrder),
|
|
225
|
-
deepseekV4ProCalibration: DEEPSEEK_CALIBRATION_SCHEMA,
|
|
226
|
-
deepseekV4ProDefaultReasoningEffort: DEEPSEEK_DEFAULT_REASONING_EFFORT_SCHEMA,
|
|
227
|
-
deepseekFlashCalibration: DEEPSEEK_CALIBRATION_SCHEMA,
|
|
228
|
-
deepseekFlashDefaultReasoningEffort: DEEPSEEK_DEFAULT_REASONING_EFFORT_SCHEMA,
|
|
229
207
|
skills: SKILLS_SCHEMA,
|
|
230
208
|
roles: ROLES_SCHEMA,
|
|
231
209
|
roleRouting: ROLE_ROUTING_SCHEMA,
|
|
@@ -239,14 +217,15 @@ const CONFIG_FIELDS_SCHEMA = Schema.object({
|
|
|
239
217
|
});
|
|
240
218
|
const MODULES_SCHEMA = Schema.object({ deepwork: Schema.object({ enabled: Schema.boolean() }) });
|
|
241
219
|
const GLOBAL_FIELDS_SCHEMA = Schema.object({ ...CONFIG_FIELDS_SCHEMA.dict, modules: MODULES_SCHEMA });
|
|
220
|
+
const NATIVE_FIELDS_SCHEMA = CONFIG_FIELDS_SCHEMA;
|
|
242
221
|
/** Only data is transported. Defaults remain resolved by the existing authority. */
|
|
243
|
-
export function deploymentEditorSchema() {
|
|
222
|
+
export function deploymentEditorSchema(native = false) {
|
|
244
223
|
const project = (schema) => schema === permissionControlSchema && schema.type === "transform"
|
|
245
224
|
? project(schema.inner) : schema === permissionControlSchema.inner.dict.rules
|
|
246
225
|
? { type: "array", inner: { type: "object", fields: {}, additionalProperties: "json" } } : schema === MODEL_ROUTE_SCHEMA
|
|
247
226
|
? { ...project(MODEL_ROUTE_FIELDS_SCHEMA), additionalProperties: "json" } : ({
|
|
248
227
|
type: schema.type,
|
|
249
|
-
...(schema.dict === undefined ? {} : { fields: Object.fromEntries(Object.entries(schema.dict).
|
|
228
|
+
...(schema.dict === undefined ? {} : { fields: Object.fromEntries(Object.entries(schema.dict).map(([key, child]) => {
|
|
250
229
|
const node = project(child);
|
|
251
230
|
if (schema === MODEL_ROUTE_FIELDS_SCHEMA && ["provider", "model", "reasoningEffort"].includes(key))
|
|
252
231
|
node.nonempty = true;
|
|
@@ -266,7 +245,7 @@ export function deploymentEditorSchema() {
|
|
|
266
245
|
...(schema === ROLE_ROUTING_SCHEMA ? { keys: [...DSMM_ROLE_IDS] } : {}),
|
|
267
246
|
...(schema === ROLE_FALLBACK_ROUTES_SCHEMA ? { max: ROLE_FALLBACK_ROUTE_LIMIT } : {})
|
|
268
247
|
});
|
|
269
|
-
return project(GLOBAL_FIELDS_SCHEMA);
|
|
248
|
+
return project(native ? NATIVE_FIELDS_SCHEMA : GLOBAL_FIELDS_SCHEMA);
|
|
270
249
|
}
|
|
271
250
|
/** Transport nodes carry no business defaults. Only deployment input is volatile. */
|
|
272
251
|
function sparseSchema(schema) {
|
|
@@ -278,31 +257,38 @@ function sparseSchema(schema) {
|
|
|
278
257
|
...(schema.inner === undefined ? {} : { inner: sparseSchema(schema.inner) }),
|
|
279
258
|
...(schema.list === undefined ? {} : { list: schema.list.map(sparseSchema) }) });
|
|
280
259
|
}
|
|
281
|
-
const TRANSPORT_FIELDS_SCHEMA = sparseSchema(
|
|
260
|
+
const TRANSPORT_FIELDS_SCHEMA = sparseSchema(NATIVE_FIELDS_SCHEMA);
|
|
282
261
|
export const DSMM_CONFIG_SCHEMA = Schema.intersect([
|
|
283
|
-
Schema.transform(Schema.any(), (input) => { resolveConfig(
|
|
284
|
-
sparseSchema(
|
|
262
|
+
Schema.transform(Schema.any(), (input) => { resolveConfig(validateNativeConfig(input ?? {})); return {}; }),
|
|
263
|
+
sparseSchema(NATIVE_FIELDS_SCHEMA)
|
|
285
264
|
]).default({});
|
|
286
265
|
for (const [key, schema] of Object.entries(TRANSPORT_FIELDS_SCHEMA.dict)) {
|
|
287
|
-
|
|
288
|
-
TRANSPORT_FIELDS_SCHEMA.set(key, schema.volatile());
|
|
266
|
+
TRANSPORT_FIELDS_SCHEMA.set(key, schema.volatile());
|
|
289
267
|
}
|
|
290
268
|
// Native forms require a fixed object root: volatile nodes cannot sit under an
|
|
291
269
|
// intersection. Keep that schema intact and validate through the public protocol.
|
|
292
270
|
export const DSMM_NATIVE_CONFIG_SCHEMA = new Proxy(TRANSPORT_FIELDS_SCHEMA.default({}), {
|
|
293
271
|
apply(target, receiver, args) {
|
|
294
|
-
|
|
272
|
+
validateNativeConfig(args[0] ?? {});
|
|
295
273
|
return Reflect.apply(target, receiver, args);
|
|
296
274
|
},
|
|
297
275
|
get(target, key, receiver) {
|
|
298
276
|
if (key !== "~standard")
|
|
299
277
|
return Reflect.get(target, key, receiver);
|
|
300
278
|
return { version: 1, vendor: "schemastery", validate(input) {
|
|
301
|
-
|
|
279
|
+
validateNativeConfig(input ?? {});
|
|
302
280
|
return target["~standard"].validate(input);
|
|
303
281
|
} };
|
|
304
282
|
}
|
|
305
283
|
});
|
|
284
|
+
export function validateNativeConfig(input) {
|
|
285
|
+
const config = copyJson(input);
|
|
286
|
+
if (typeof config === "object" && config !== null)
|
|
287
|
+
rejectDeprecatedFields(config);
|
|
288
|
+
validateShape(config, NATIVE_FIELDS_SCHEMA);
|
|
289
|
+
validateSparseConfig(config);
|
|
290
|
+
return config;
|
|
291
|
+
}
|
|
306
292
|
export const DSMM_SETTINGS_SCHEMA = Schema.intersect([ROLE_ROUTING_VALIDATION_SCHEMA, Schema.object({
|
|
307
293
|
permissionControl: permissionControlSchema,
|
|
308
294
|
modelParameters: Schema.object({ passthrough: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.modelParameters.passthrough) }),
|
|
@@ -311,10 +297,6 @@ export const DSMM_SETTINGS_SCHEMA = Schema.intersect([ROLE_ROUTING_VALIDATION_SC
|
|
|
311
297
|
modeName: Schema.string().default(DEFAULT_DSMM_SETTINGS.modeName),
|
|
312
298
|
defaultActive: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.defaultActive),
|
|
313
299
|
promptOrder: Schema.number().default(DEFAULT_DSMM_SETTINGS.promptOrder),
|
|
314
|
-
deepseekV4ProCalibration: DEEPSEEK_CALIBRATION_SCHEMA,
|
|
315
|
-
deepseekV4ProDefaultReasoningEffort: DEEPSEEK_DEFAULT_REASONING_EFFORT_SCHEMA,
|
|
316
|
-
deepseekFlashCalibration: DEEPSEEK_CALIBRATION_SCHEMA,
|
|
317
|
-
deepseekFlashDefaultReasoningEffort: DEEPSEEK_DEFAULT_REASONING_EFFORT_SCHEMA,
|
|
318
300
|
skills: SKILLS_SCHEMA,
|
|
319
301
|
roles: ROLES_SCHEMA,
|
|
320
302
|
roleRouting: ROLE_ROUTING_SCHEMA,
|
|
@@ -344,10 +326,6 @@ export function resolveConfig(config = {}) {
|
|
|
344
326
|
modeName: normalizeModeName(config.modeName),
|
|
345
327
|
defaultActive: config.defaultActive ?? DEFAULT_DSMM_SETTINGS.defaultActive,
|
|
346
328
|
promptOrder: config.promptOrder ?? DEFAULT_DSMM_SETTINGS.promptOrder,
|
|
347
|
-
deepseekV4ProCalibration: config.deepseekV4ProCalibration ?? DEFAULT_DSMM_SETTINGS.deepseekV4ProCalibration,
|
|
348
|
-
deepseekV4ProDefaultReasoningEffort: config.deepseekV4ProDefaultReasoningEffort ?? DEFAULT_DSMM_SETTINGS.deepseekV4ProDefaultReasoningEffort,
|
|
349
|
-
deepseekFlashCalibration: config.deepseekFlashCalibration ?? DEFAULT_DSMM_SETTINGS.deepseekFlashCalibration,
|
|
350
|
-
deepseekFlashDefaultReasoningEffort: config.deepseekFlashDefaultReasoningEffort ?? DEFAULT_DSMM_SETTINGS.deepseekFlashDefaultReasoningEffort,
|
|
351
329
|
skills: { ...DEFAULT_DSMM_SETTINGS.skills, ...config.skills },
|
|
352
330
|
roles: { ...DEFAULT_DSMM_SETTINGS.roles, ...config.roles },
|
|
353
331
|
roleRouting: resolveRoleRouting(config.roleRouting),
|
|
@@ -489,8 +467,6 @@ export function validateSparseConfig(input, global = false) {
|
|
|
489
467
|
}
|
|
490
468
|
}
|
|
491
469
|
validateShape(config, global ? GLOBAL_FIELDS_SCHEMA : CONFIG_FIELDS_SCHEMA);
|
|
492
|
-
if (global && Object.hasOwn(config, "sessionPersistence"))
|
|
493
|
-
throw new TypeError("Native session storage is not a global deployment field");
|
|
494
470
|
// A deployment layer may override one primary-route member and inherit the
|
|
495
471
|
// others. Validate its present members here; resolveDeployment validates the
|
|
496
472
|
// complete route only after both sparse layers have merged.
|
|
@@ -508,7 +484,7 @@ export function validateDeploymentPath(path) {
|
|
|
508
484
|
if (deprecated !== undefined)
|
|
509
485
|
throw new DsmmConfigValidationError("deprecated-field", path);
|
|
510
486
|
let schema = GLOBAL_FIELDS_SCHEMA;
|
|
511
|
-
if (path.length === 0
|
|
487
|
+
if (path.length === 0)
|
|
512
488
|
throw new TypeError("Not an editable deployment field");
|
|
513
489
|
for (const key of path) {
|
|
514
490
|
if (schema.type === "union")
|
package/lib/state.d.ts
CHANGED
|
@@ -5,10 +5,11 @@ export type DeepworkSelectionOutcome = "committed" | "unchanged";
|
|
|
5
5
|
export declare function isDeepworkActive(events?: readonly DshSessionEvent[], defaultActive?: boolean, selectedPreset?: string): boolean;
|
|
6
6
|
export declare function hasOpenTurn(events?: readonly DshSessionEvent[]): boolean;
|
|
7
7
|
export declare class DeepworkModeController {
|
|
8
|
-
private readonly ctx;
|
|
9
8
|
private readonly moduleEnabled;
|
|
9
|
+
private readonly runtimeReady;
|
|
10
10
|
private readonly listeners;
|
|
11
|
-
|
|
11
|
+
private readonly versions;
|
|
12
|
+
constructor(_ctx: DshContext, moduleEnabled?: (agent: DshAgent) => boolean, runtimeReady?: () => boolean);
|
|
12
13
|
watch(listener: (agent: DshAgent) => void): () => void;
|
|
13
14
|
/** Profile commits have no native session event; notify their Agent mount. */
|
|
14
15
|
changed(agent: DshAgent): void;
|
package/lib/state.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolveSelectedAgentPreset, sessionEvents } from "./session-scope.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { appendModeRecord } from "./session-metadata.js";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { isDeepStrictEqual } from "node:util";
|
|
4
5
|
import { isDsmmRoleId } from "./roles.js";
|
|
5
6
|
export const DEEPWORK_MODE_EVENT = "deepwork/mode";
|
|
6
7
|
function activeFromEvent(event) {
|
|
@@ -24,12 +25,13 @@ export function hasOpenTurn(events = []) {
|
|
|
24
25
|
return open;
|
|
25
26
|
}
|
|
26
27
|
export class DeepworkModeController {
|
|
27
|
-
ctx;
|
|
28
28
|
moduleEnabled;
|
|
29
|
+
runtimeReady;
|
|
29
30
|
listeners = new Set();
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
versions = new WeakMap();
|
|
32
|
+
constructor(_ctx, moduleEnabled = () => true, runtimeReady = () => true) {
|
|
32
33
|
this.moduleEnabled = moduleEnabled;
|
|
34
|
+
this.runtimeReady = runtimeReady;
|
|
33
35
|
}
|
|
34
36
|
watch(listener) {
|
|
35
37
|
this.listeners.add(listener);
|
|
@@ -44,9 +46,20 @@ export class DeepworkModeController {
|
|
|
44
46
|
describe(agent, defaultActive) {
|
|
45
47
|
const events = sessionEvents(agent.session), preset = resolveSelectedAgentPreset(agent.session);
|
|
46
48
|
const intents = events.map(activeFromEvent).filter((value) => value !== undefined);
|
|
49
|
+
const fields = { preset, defaultActive, intents, enabled: this.moduleEnabled(agent),
|
|
50
|
+
presetChanges: events.filter((event) => event.type === "agent-preset/selected").length };
|
|
51
|
+
let defaults = this.versions.get(agent);
|
|
52
|
+
if (defaults === undefined) {
|
|
53
|
+
defaults = new Map();
|
|
54
|
+
this.versions.set(agent, defaults);
|
|
55
|
+
}
|
|
56
|
+
let version = defaults.get(defaultActive);
|
|
57
|
+
if (version === undefined || !isDeepStrictEqual(version.fields, fields)) {
|
|
58
|
+
version = { fields, revision: `mode-v1-${randomUUID()}` };
|
|
59
|
+
defaults.set(defaultActive, version);
|
|
60
|
+
}
|
|
47
61
|
return { active: this.active(agent, defaultActive), explicit: intents.length > 0, locked: false,
|
|
48
|
-
revision:
|
|
49
|
-
presetChanges: events.filter((event) => event.type === "agent-preset/selected").length })).digest("hex") };
|
|
62
|
+
revision: version.revision };
|
|
50
63
|
}
|
|
51
64
|
intent(agent) {
|
|
52
65
|
const events = sessionEvents(agent.session);
|
|
@@ -58,6 +71,8 @@ export class DeepworkModeController {
|
|
|
58
71
|
return undefined;
|
|
59
72
|
}
|
|
60
73
|
async select(agent, active, defaultActive = false) {
|
|
74
|
+
if (active && !this.runtimeReady())
|
|
75
|
+
throw new Error("Deepwork runtime is not ready; enable it in native settings and restart the Host");
|
|
61
76
|
if (active && !this.moduleEnabled(agent))
|
|
62
77
|
throw new Error("Deepwork module is not admitted in this session; a mode intent cannot enable it");
|
|
63
78
|
if (agent.status === "running" || hasOpenTurn(sessionEvents(agent.session)))
|
|
@@ -78,15 +93,16 @@ export class DeepworkModeController {
|
|
|
78
93
|
}
|
|
79
94
|
/** Called inside the existing native maintenance / admission CAS boundary. */
|
|
80
95
|
async selectIdle(agent, active, _defaultActive) {
|
|
96
|
+
if (active && !this.runtimeReady())
|
|
97
|
+
throw new Error("Deepwork runtime is not ready; enable it in native settings and restart the Host");
|
|
81
98
|
if (active && !this.moduleEnabled(agent))
|
|
82
99
|
throw new Error("Deepwork module is not admitted in this session; a mode intent cannot enable it");
|
|
83
100
|
if (hasOpenTurn(sessionEvents(agent.session)))
|
|
84
101
|
throw new Error("Deepwork mode requires an idle session");
|
|
85
102
|
if (this.intent(agent) === active)
|
|
86
103
|
return;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// Native session/event owns mode invalidation, including external appends.
|
|
104
|
+
appendModeRecord(agent.session, active);
|
|
105
|
+
this.changed(agent);
|
|
90
106
|
}
|
|
91
107
|
}
|
|
92
108
|
//# sourceMappingURL=state.js.map
|
package/lib/status.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DshAgent } from "./dsh-types.js";
|
|
2
2
|
import type { DsmmModelFamily } from "./model-family.js";
|
|
3
3
|
import type { DsmmRoleId } from "./roles.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { DsmmModelRoute, DsmmProfileAdmission, DsmmSettings } from "./settings.js";
|
|
5
5
|
import type { DsmmRateLimitPolicy, DsmmRoutingStrategy } from "./routing-policy.js";
|
|
6
6
|
import type { DsmmRoleAvailabilityState, DsmmRoleRuntimeState, SubagentRuntimeAdmissionView, ProfileDiagnostic } from "./profile-types.js";
|
|
7
7
|
import type { DsmmLspRuntimeState } from "./lsp.js";
|
|
@@ -46,16 +46,8 @@ export interface DsmmStatusSnapshot {
|
|
|
46
46
|
provider?: string;
|
|
47
47
|
model?: string;
|
|
48
48
|
family: DsmmModelFamily;
|
|
49
|
-
deepseekV4Pro: boolean;
|
|
50
|
-
deepseekFlash: boolean;
|
|
51
49
|
currentReasoningEffort?: string;
|
|
52
50
|
};
|
|
53
|
-
calibration: {
|
|
54
|
-
mode: DeepseekCalibration;
|
|
55
|
-
applies: boolean;
|
|
56
|
-
policyEffort?: "off" | "low" | "high" | "max";
|
|
57
|
-
action: "disabled" | "out-of-scope" | "non-target-route" | "preserve-explicit" | "fill-missing" | "enforce" | "native-owned" | "fixed-role-policy";
|
|
58
|
-
};
|
|
59
51
|
rolePolicy: {
|
|
60
52
|
role?: DsmmRoleId;
|
|
61
53
|
applies: boolean;
|
package/lib/status.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { classifyModelFamily } from "./model-family.js";
|
|
2
|
-
import { isDeepseekFlashRoute, isDeepseekV4ProRoute } from "./model-routing.js";
|
|
3
2
|
import { DSMM_ROLES, isDsmmRoleId } from "./roles.js";
|
|
4
|
-
import {
|
|
3
|
+
import { roleRouteRuntimeState } from "./role-routing.js";
|
|
5
4
|
import { resolveSelectedAgentPreset } from "./session-scope.js";
|
|
6
5
|
import { resolveAdmittedDsmmRole as resolveEffectiveDsmmRole } from "./role-policy.js";
|
|
7
6
|
import { resolveRoleRuntimePolicy } from "./routing-policy.js";
|
|
@@ -31,18 +30,6 @@ export function createDsmmStatusSnapshot(input) {
|
|
|
31
30
|
providerID: selectedRoute.provider,
|
|
32
31
|
modelID: selectedRoute.model
|
|
33
32
|
});
|
|
34
|
-
const deepseekV4Pro = selectedRoute.provider !== undefined
|
|
35
|
-
&& selectedRoute.model !== undefined
|
|
36
|
-
&& isDeepseekV4ProRoute({ provider: selectedRoute.provider, model: selectedRoute.model });
|
|
37
|
-
const deepseekFlash = selectedRoute.provider !== undefined && selectedRoute.model !== undefined
|
|
38
|
-
&& isDeepseekFlashRoute({ provider: selectedRoute.provider, model: selectedRoute.model });
|
|
39
|
-
let acceptedRoleRoute;
|
|
40
|
-
if (!ordinaryRoot && !invalidDescriptor && role !== undefined) {
|
|
41
|
-
acceptedRoleRoute = persistedRoleRoute({ agent }, policy?.primary, fallbacks, liveRolePolicyIdentity(agent, settings, role, input.admission?.epoch));
|
|
42
|
-
}
|
|
43
|
-
const exactRouting = policy?.primary !== undefined || acceptedRoleRoute !== undefined
|
|
44
|
-
|| fallbacks.some((route) => route.reasoningEffort !== undefined && route.provider === selectedRoute.provider
|
|
45
|
-
&& route.model === selectedRoute.model && route.reasoningEffort === selectedRoute.reasoningEffort);
|
|
46
33
|
return {
|
|
47
34
|
version: DSMM_STATUS_VERSION,
|
|
48
35
|
...(input.admission?.roleAvailability === undefined ? {} : { roles: structuredClone(input.admission.roleAvailability) }),
|
|
@@ -75,23 +62,8 @@ export function createDsmmStatusSnapshot(input) {
|
|
|
75
62
|
...(selectedRoute.provider === undefined ? {} : { provider: selectedRoute.provider }),
|
|
76
63
|
...(selectedRoute.model === undefined ? {} : { model: selectedRoute.model }),
|
|
77
64
|
family,
|
|
78
|
-
deepseekV4Pro,
|
|
79
|
-
deepseekFlash,
|
|
80
65
|
...(selectedRoute.reasoningEffort === undefined ? {} : { currentReasoningEffort: selectedRoute.reasoningEffort })
|
|
81
66
|
},
|
|
82
|
-
calibration: ordinaryRoot ? {
|
|
83
|
-
mode: deepseekFlash ? settings.deepseekFlashCalibration : settings.deepseekV4ProCalibration,
|
|
84
|
-
applies: false, action: "native-owned"
|
|
85
|
-
} : exactRouting ? {
|
|
86
|
-
mode: deepseekFlash ? settings.deepseekFlashCalibration : settings.deepseekV4ProCalibration,
|
|
87
|
-
applies: false, action: "fixed-role-policy"
|
|
88
|
-
} : resolveCalibration({
|
|
89
|
-
calibration: deepseekFlash ? settings.deepseekFlashCalibration : settings.deepseekV4ProCalibration,
|
|
90
|
-
inScope,
|
|
91
|
-
targetRoute: deepseekV4Pro || deepseekFlash,
|
|
92
|
-
policyEffort: resolvePolicyEffort(settings, selectedPreset, deepseekFlash),
|
|
93
|
-
currentReasoningEffort: selectedRoute.reasoningEffort
|
|
94
|
-
}),
|
|
95
67
|
rolePolicy: {
|
|
96
68
|
...(role === undefined ? {} : { role }),
|
|
97
69
|
applies: inScope && !invalidDescriptor,
|
|
@@ -134,12 +106,12 @@ export function formatDsmmStatus(snapshot) {
|
|
|
134
106
|
: "out of scope";
|
|
135
107
|
const provider = snapshot.route.provider ?? "unavailable";
|
|
136
108
|
const model = snapshot.route.model ?? "unavailable";
|
|
137
|
-
const policyEffort = snapshot.calibration.policyEffort ?? "not applicable";
|
|
138
109
|
const currentReasoningEffort = snapshot.route.currentReasoningEffort ?? "provider default";
|
|
139
110
|
return [
|
|
140
111
|
"Deepwork status",
|
|
141
112
|
`Mode: ${snapshot.mode.active ? "active" : "inactive"} (${snapshot.mode.name})`,
|
|
142
113
|
...snapshot.modules?.map((module) => `Module ${module.descriptor.id}: desired=${module.desired.enabled} (${module.desired.source}, ${module.desired.capture}); startup-mounted=${module.startupMounted}; admitted=${module.admitted}; next-root=${module.nextRoot.admitted}; pending=${module.pending}; reason=${module.reason ?? "none"}; host-bundle-enabled=${module.hostBundleEnabled}`) ?? [],
|
|
114
|
+
...(snapshot.subagentRuntime === undefined ? [] : [`Native subagents: binding=${snapshot.subagentRuntime.binding}; admission-ready=${snapshot.subagentRuntime.deliveryFenceReady}; restart-required=${snapshot.subagentRuntime.restartRequired}; reason=${snapshot.subagentRuntime.reason ?? "none"}`]),
|
|
143
115
|
`Scope: ${scope}`,
|
|
144
116
|
...(snapshot.admission === undefined ? [] : [`Profile admission: ${snapshot.admission.scope}; profile=${snapshot.admission.profile?.id ?? "deployment baseline"}; epoch=${snapshot.admission.epoch}`]),
|
|
145
117
|
...(snapshot.deployment === undefined ? [] : [`Deployment capture: global=${snapshot.deployment.globalRevision}; native=${snapshot.deployment.nativeRevision}; restart-required=${snapshot.deployment.restartRequired.join(",") || "none"}`]),
|
|
@@ -149,7 +121,7 @@ export function formatDsmmStatus(snapshot) {
|
|
|
149
121
|
`Route: ${provider}/${model} [${snapshot.route.family}]`,
|
|
150
122
|
`Role policy: ${displayRole(snapshot.rolePolicy.role)}; strategy=${snapshot.rolePolicy.strategy}; primary=${snapshot.rolePolicy.primary === undefined ? "inherit" : `${snapshot.rolePolicy.primary.provider}/${snapshot.rolePolicy.primary.model}`}; fallbacks=${snapshot.rolePolicy.fallbackSource}; retries=${snapshot.rolePolicy.rateLimit.maxRetries}; threshold=${snapshot.rolePolicy.rateLimit.switchAfterRateLimits}; switches=${snapshot.rolePolicy.rateLimit.maxSwitches}`,
|
|
151
123
|
...(snapshot.rolePolicy.runtimeState === undefined ? [] : [`Retry state: retries=${snapshot.rolePolicy.runtimeState.retries}; rate limits=${snapshot.rolePolicy.runtimeState.rateLimitFailures}; switches=${snapshot.rolePolicy.runtimeState.switches}; delay ms=${snapshot.rolePolicy.runtimeState.totalDelayMs}`]),
|
|
152
|
-
`Reasoning:
|
|
124
|
+
`Reasoning: current=${currentReasoningEffort}`,
|
|
153
125
|
`Runtime recovery: ${snapshot.runtimeRecovery.enabled ? "enabled" : "disabled"}; applies=${snapshot.runtimeRecovery.applies ? "yes" : "no"}; fallbacks=${snapshot.runtimeRecovery.fallbackRouteCount}; max attempts=${snapshot.runtimeRecovery.maxFallbackAttempts}`,
|
|
154
126
|
`Idle continuation: ${snapshot.runtimeRecovery.idleContinuation.enabled ? "enabled" : "disabled"}; max=${snapshot.runtimeRecovery.idleContinuation.maxContinuations}`,
|
|
155
127
|
"Effective settings: use /dsmm-status json for the normalized snapshot"
|
|
@@ -174,26 +146,6 @@ function resolveRoute(agent) {
|
|
|
174
146
|
function readString(value) {
|
|
175
147
|
return typeof value === "string" ? value : undefined;
|
|
176
148
|
}
|
|
177
|
-
function resolvePolicyEffort(settings, _selectedPreset, flash) {
|
|
178
|
-
return flash ? settings.deepseekFlashDefaultReasoningEffort : settings.deepseekV4ProDefaultReasoningEffort;
|
|
179
|
-
}
|
|
180
|
-
function resolveCalibration(input) {
|
|
181
|
-
if (input.calibration === "off") {
|
|
182
|
-
return { mode: input.calibration, applies: false, action: "disabled" };
|
|
183
|
-
}
|
|
184
|
-
if (!input.inScope) {
|
|
185
|
-
return { mode: input.calibration, applies: false, action: "out-of-scope" };
|
|
186
|
-
}
|
|
187
|
-
if (!input.targetRoute) {
|
|
188
|
-
return { mode: input.calibration, applies: false, action: "non-target-route" };
|
|
189
|
-
}
|
|
190
|
-
if (input.calibration === "auto") {
|
|
191
|
-
return input.currentReasoningEffort === undefined
|
|
192
|
-
? { mode: input.calibration, applies: true, policyEffort: input.policyEffort, action: "fill-missing" }
|
|
193
|
-
: { mode: input.calibration, applies: true, policyEffort: input.policyEffort, action: "preserve-explicit" };
|
|
194
|
-
}
|
|
195
|
-
return { mode: input.calibration, applies: true, policyEffort: input.policyEffort, action: "enforce" };
|
|
196
|
-
}
|
|
197
149
|
/** Read-only diagnostics only; never use this copy as configuration input. */
|
|
198
150
|
export function readOnlySettings(settings) {
|
|
199
151
|
return {
|
|
@@ -204,10 +156,6 @@ export function readOnlySettings(settings) {
|
|
|
204
156
|
modeName: settings.modeName,
|
|
205
157
|
defaultActive: settings.defaultActive,
|
|
206
158
|
promptOrder: settings.promptOrder,
|
|
207
|
-
deepseekV4ProCalibration: settings.deepseekV4ProCalibration,
|
|
208
|
-
deepseekV4ProDefaultReasoningEffort: settings.deepseekV4ProDefaultReasoningEffort,
|
|
209
|
-
deepseekFlashCalibration: settings.deepseekFlashCalibration,
|
|
210
|
-
deepseekFlashDefaultReasoningEffort: settings.deepseekFlashDefaultReasoningEffort,
|
|
211
159
|
skills: { ...settings.skills },
|
|
212
160
|
roles: { ...settings.roles },
|
|
213
161
|
roleRouting: Object.fromEntries(Object.entries(settings.roleRouting).map(([role, policy]) => [role, {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LookupAddress } from "node:dns";
|
|
2
|
+
import type { HttpFetchResolver } from "@deepseek-ai/dsh-web-fetch-http";
|
|
3
|
+
export type AddressLookup = (hostname: string, options: {
|
|
4
|
+
all: true;
|
|
5
|
+
order: "verbatim";
|
|
6
|
+
}) => Promise<LookupAddress[]>;
|
|
7
|
+
export interface AddressPolicyOptions {
|
|
8
|
+
/** Additional local denies; never additional allows. */
|
|
9
|
+
readonly denyCidrs?: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function stripIpv6Brackets(hostname: string): string;
|
|
12
|
+
export declare function isFakeIpAddress(input: string): boolean;
|
|
13
|
+
/** Local policy for literals and the complete DNS answer set. */
|
|
14
|
+
export declare class FakeIpAddressPolicy {
|
|
15
|
+
private readonly denied;
|
|
16
|
+
constructor(options?: AddressPolicyOptions);
|
|
17
|
+
get requiresLocalDeny(): boolean;
|
|
18
|
+
allows(input: string): boolean;
|
|
19
|
+
/** Native transition/NAT64 destinations do not inherit the Fake-IP exception. */
|
|
20
|
+
allowsTranslatedIpv4(input: string): boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Resolve once; the native provider pins exactly this validated, nonempty set. */
|
|
23
|
+
export declare function createFakeIpResolver(policy?: FakeIpAddressPolicy, lookup?: AddressLookup): HttpFetchResolver;
|
|
24
|
+
//# sourceMappingURL=web-fetch-address-policy.d.ts.map
|