@dsmm/dsmm 0.1.5 → 0.1.7
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 +12 -9
- package/docs/compatibility.md +8 -6
- package/docs/model-routing.md +6 -4
- package/docs/profiles.md +7 -3
- package/docs/releasing.md +38 -16
- package/docs/runtime-recovery.md +3 -1
- package/docs/settings-status.md +4 -2
- package/lib/client/SessionProfiles.d.ts +2 -1
- package/lib/client/SessionProfiles.js +94 -9
- package/lib/client/controller.d.ts +33 -4
- package/lib/client/controller.js +134 -5
- package/lib/client/index.d.ts +1 -1
- package/lib/client/index.js +37 -8
- package/lib/client/locales.d.ts +33 -0
- package/lib/client/locales.js +15 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +8 -1
- package/lib/client.js +339 -31
- package/lib/model-routing.js +16 -0
- package/lib/profile-remote.js +11 -9
- package/lib/profile-runtime.d.ts +1 -0
- package/lib/profile-runtime.js +11 -0
- package/lib/profile-types.d.ts +2 -0
- package/lib/role-routing.js +1 -1
- package/lib/runtime-recovery.js +4 -1
- package/lib/status.d.ts +1 -1
- package/lib/status.js +11 -6
- package/package.json +4 -1
package/lib/profile-runtime.js
CHANGED
|
@@ -69,8 +69,10 @@ export class DsmmProfileRuntime {
|
|
|
69
69
|
}
|
|
70
70
|
const reason = this.switching.has(agent) ? "maintenance" : agent.status === "running" ? "busy" : agent.runMaintenance === undefined ? "unavailable" : undefined;
|
|
71
71
|
const role = resolveEffectiveDsmmRole(agent, admitted.settings, isDeepworkActive(sessionEvents(agent.session), admitted.settings.defaultActive));
|
|
72
|
+
const profileModel = this.declaredProfileModel(admitted.settings, role);
|
|
72
73
|
return { sessionId: agent.id, globalDefault: selectionState(this.current), selection: selectionState(disk), admittedSelection: selectionState(admitted), scope: admitted.scope,
|
|
73
74
|
rolePolicy: roleRouteRuntimeState(agent, admitted.settings, role, admitted.epoch),
|
|
75
|
+
...(profileModel === undefined ? {} : { profileModel }),
|
|
74
76
|
admissionEpoch: admitted.epoch, switchAllowed: reason === undefined, ...(reason === undefined ? {} : { switchUnavailableReason: reason }) };
|
|
75
77
|
}
|
|
76
78
|
/** The fourth argument is trusted native caller authority, never wire data. */
|
|
@@ -99,9 +101,12 @@ export class DsmmProfileRuntime {
|
|
|
99
101
|
try {
|
|
100
102
|
assertCurrent(maintenanceSignal);
|
|
101
103
|
const epoch = newEpoch();
|
|
104
|
+
let profileModel;
|
|
102
105
|
const result = await this.store.selectSession(request, epoch, async (document) => {
|
|
103
106
|
const prepared = immutableSettings(resolveProfileSettings(this.baseline, document?.settings ?? {}));
|
|
104
107
|
await this.validate(prepared, agent, maintenanceSignal);
|
|
108
|
+
const role = resolveEffectiveDsmmRole(agent, prepared, isDeepworkActive(sessionEvents(agent.session), prepared.defaultActive));
|
|
109
|
+
profileModel = this.declaredProfileModel(prepared, role);
|
|
105
110
|
assertCurrent(maintenanceSignal);
|
|
106
111
|
return prepared;
|
|
107
112
|
}, {
|
|
@@ -113,6 +118,7 @@ export class DsmmProfileRuntime {
|
|
|
113
118
|
// A committed selection remains a successful transaction even if a
|
|
114
119
|
// queued wake or disposal wins immediately when maintenance releases.
|
|
115
120
|
return { sessionId: request.sessionId, globalDefault: selectionState(this.current), selection: selectionState(result.selection), admittedSelection: selectionState(result.selection),
|
|
121
|
+
...(profileModel === undefined ? {} : { profileModel }),
|
|
116
122
|
scope: request.id === null ? "deployment-baseline" : "session-override", admissionEpoch: epoch, switchAllowed: true };
|
|
117
123
|
}
|
|
118
124
|
finally {
|
|
@@ -178,6 +184,11 @@ export class DsmmProfileRuntime {
|
|
|
178
184
|
profileAdmission(selection, settings, epoch, scope) {
|
|
179
185
|
return Object.freeze({ ...selectionState(selection), settings, epoch, scope, profile: selection.selectedId === null || selection.appliedRevision === null ? null : Object.freeze({ id: selection.selectedId, revision: selection.appliedRevision }) });
|
|
180
186
|
}
|
|
187
|
+
declaredProfileModel(settings, role) {
|
|
188
|
+
const primary = role === undefined ? undefined : settings.roleRouting[role]?.primary;
|
|
189
|
+
return primary === undefined ? undefined : { provider: primary.provider, model: primary.model,
|
|
190
|
+
...(primary.reasoningEffort === undefined ? {} : { reasoningEffort: primary.reasoningEffort }) };
|
|
191
|
+
}
|
|
181
192
|
agents() { return this.ctx.get?.("agents"); }
|
|
182
193
|
bind(agent) {
|
|
183
194
|
const existing = this.bound.get(agent);
|
package/lib/profile-types.d.ts
CHANGED
|
@@ -71,6 +71,8 @@ export interface SessionProfileSnapshot {
|
|
|
71
71
|
switchAllowed: boolean;
|
|
72
72
|
switchUnavailableReason?: "busy" | "maintenance" | "disposed" | "not-owned" | "unavailable";
|
|
73
73
|
rolePolicy?: DsmmRoleRuntimeState;
|
|
74
|
+
/** Declared profile primary for the current ordinary root role, not an applied native selection. */
|
|
75
|
+
profileModel?: DsmmModelRoute;
|
|
74
76
|
}
|
|
75
77
|
export interface SessionProfileSelectRequest extends ProfileSelectRequest {
|
|
76
78
|
sessionId: string;
|
package/lib/role-routing.js
CHANGED
|
@@ -82,7 +82,7 @@ export function roleRouteRuntimeState(agent, settings, role, epoch) {
|
|
|
82
82
|
const resolved = resolveRoleRuntimePolicy(settings, role);
|
|
83
83
|
const identity = liveRolePolicyIdentity(agent, settings, role, epoch);
|
|
84
84
|
const lock = identity === undefined ? undefined : roleRouteLock(agent, identity);
|
|
85
|
-
return { ...(role === undefined ? {} : { role }), strategy: resolved.strategy, rateLimit: { ...resolved.rateLimit },
|
|
85
|
+
return { ...(role === undefined ? {} : { role }), strategy: agent.session.header?.origin === "subagent" ? resolved.strategy : "startup-lock", rateLimit: { ...resolved.rateLimit },
|
|
86
86
|
...(lock === undefined ? {} : { route: { ...lock.route } }), retries: lock?.retries ?? 0,
|
|
87
87
|
rateLimitFailures: lock?.rateLimits ?? 0, switches: lock?.switches ?? 0, totalDelayMs: lock?.totalDelayMs ?? 0 };
|
|
88
88
|
}
|
package/lib/runtime-recovery.js
CHANGED
|
@@ -178,6 +178,8 @@ export function registerRuntimeRecovery(ctx, controller, getSettings) {
|
|
|
178
178
|
return downstream;
|
|
179
179
|
}
|
|
180
180
|
pendingByAgent.delete(frame.agent);
|
|
181
|
+
if (frame.agent.session.header?.origin !== "subagent")
|
|
182
|
+
return downstream;
|
|
181
183
|
lock.route = { ...pending.route };
|
|
182
184
|
recordAdmittedRecoveryRoute(frame, pending.route);
|
|
183
185
|
return applyModelRoute(downstream, pending.route);
|
|
@@ -220,7 +222,8 @@ export function registerRuntimeRecovery(ctx, controller, getSettings) {
|
|
|
220
222
|
else {
|
|
221
223
|
lock.startupSettled = true;
|
|
222
224
|
lock.rateLimits += 1;
|
|
223
|
-
switching =
|
|
225
|
+
switching = frame.agent.session.header?.origin === "subagent"
|
|
226
|
+
&& resolved.strategy === "rate-limit-fallback" && lock.rateLimits >= bounds.switchAfterRateLimits;
|
|
224
227
|
if (!switching && lock.retries >= bounds.maxRetries)
|
|
225
228
|
return undefined;
|
|
226
229
|
}
|
package/lib/status.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface DsmmStatusSnapshot {
|
|
|
27
27
|
mode: DeepseekCalibration;
|
|
28
28
|
applies: boolean;
|
|
29
29
|
policyEffort?: "off" | "low" | "high" | "max";
|
|
30
|
-
action: "disabled" | "out-of-scope" | "non-target-route" | "preserve-explicit" | "fill-missing" | "enforce" | "fixed-role-policy";
|
|
30
|
+
action: "disabled" | "out-of-scope" | "non-target-route" | "preserve-explicit" | "fill-missing" | "enforce" | "native-owned" | "fixed-role-policy";
|
|
31
31
|
};
|
|
32
32
|
rolePolicy: {
|
|
33
33
|
role?: DsmmRoleId;
|
package/lib/status.js
CHANGED
|
@@ -7,6 +7,7 @@ import { resolveRoleRuntimePolicy } from "./routing-policy.js";
|
|
|
7
7
|
export const DSMM_STATUS_VERSION = 1;
|
|
8
8
|
export function createDsmmStatusSnapshot(input) {
|
|
9
9
|
const { agent, settings, modeActive } = input;
|
|
10
|
+
const ordinaryRoot = agent.session.header?.origin !== "subagent";
|
|
10
11
|
const selectedPreset = resolveSelectedAgentPreset(agent.session);
|
|
11
12
|
const dsmmPreset = isDsmmRoleId(selectedPreset);
|
|
12
13
|
let role;
|
|
@@ -18,11 +19,11 @@ export function createDsmmStatusSnapshot(input) {
|
|
|
18
19
|
invalidDescriptor = true;
|
|
19
20
|
}
|
|
20
21
|
const inScope = modeActive || role !== undefined;
|
|
21
|
-
const policy = role === undefined ? undefined : settings.roleRouting[role];
|
|
22
|
+
const policy = ordinaryRoot || role === undefined ? undefined : settings.roleRouting[role];
|
|
22
23
|
const runtimePolicy = resolveRoleRuntimePolicy(settings, role);
|
|
23
24
|
const roleRuntimeState = input.roleRuntimeState ?? (input.admission === undefined || invalidDescriptor ? undefined
|
|
24
25
|
: roleRouteRuntimeState(agent, settings, role, input.admission.epoch));
|
|
25
|
-
const fallbacks = invalidDescriptor ? [] : runtimePolicy.fallbackRoutes;
|
|
26
|
+
const fallbacks = ordinaryRoot || invalidDescriptor ? [] : runtimePolicy.fallbackRoutes;
|
|
26
27
|
const selectedRoute = resolveRoute(agent);
|
|
27
28
|
const family = classifyModelFamily({
|
|
28
29
|
providerID: selectedRoute.provider,
|
|
@@ -34,7 +35,7 @@ export function createDsmmStatusSnapshot(input) {
|
|
|
34
35
|
const deepseekFlash = selectedRoute.provider !== undefined && selectedRoute.model !== undefined
|
|
35
36
|
&& isDeepseekFlashRoute({ provider: selectedRoute.provider, model: selectedRoute.model });
|
|
36
37
|
let acceptedRoleRoute;
|
|
37
|
-
if (!invalidDescriptor && role !== undefined) {
|
|
38
|
+
if (!ordinaryRoot && !invalidDescriptor && role !== undefined) {
|
|
38
39
|
acceptedRoleRoute = persistedRoleRoute({ agent }, policy?.primary, fallbacks, liveRolePolicyIdentity(agent, settings, role, input.admission?.epoch));
|
|
39
40
|
}
|
|
40
41
|
const exactRouting = policy?.primary !== undefined || acceptedRoleRoute !== undefined
|
|
@@ -62,7 +63,10 @@ export function createDsmmStatusSnapshot(input) {
|
|
|
62
63
|
deepseekFlash,
|
|
63
64
|
...(selectedRoute.reasoningEffort === undefined ? {} : { currentReasoningEffort: selectedRoute.reasoningEffort })
|
|
64
65
|
},
|
|
65
|
-
calibration:
|
|
66
|
+
calibration: ordinaryRoot ? {
|
|
67
|
+
mode: deepseekFlash ? settings.deepseekFlashCalibration : settings.deepseekV4ProCalibration,
|
|
68
|
+
applies: false, action: "native-owned"
|
|
69
|
+
} : exactRouting ? {
|
|
66
70
|
mode: deepseekFlash ? settings.deepseekFlashCalibration : settings.deepseekV4ProCalibration,
|
|
67
71
|
applies: false, action: "fixed-role-policy"
|
|
68
72
|
} : resolveCalibration({
|
|
@@ -77,11 +81,12 @@ export function createDsmmStatusSnapshot(input) {
|
|
|
77
81
|
applies: inScope && !invalidDescriptor,
|
|
78
82
|
...(policy?.primary === undefined ? {} : { primary: { ...policy.primary } }),
|
|
79
83
|
fallbackRoutes: fallbacks.map((route) => ({ ...route })),
|
|
80
|
-
fallbackSource: invalidDescriptor ? "disabled" : runtimePolicy.fallbackSource,
|
|
81
|
-
strategy: runtimePolicy.strategy,
|
|
84
|
+
fallbackSource: ordinaryRoot || invalidDescriptor ? "disabled" : runtimePolicy.fallbackSource,
|
|
85
|
+
strategy: ordinaryRoot ? "startup-lock" : runtimePolicy.strategy,
|
|
82
86
|
rateLimit: { ...runtimePolicy.rateLimit },
|
|
83
87
|
...(roleRuntimeState === undefined ? {} : { runtimeState: {
|
|
84
88
|
...roleRuntimeState,
|
|
89
|
+
...(ordinaryRoot ? { strategy: "startup-lock" } : {}),
|
|
85
90
|
rateLimit: { ...roleRuntimeState.rateLimit },
|
|
86
91
|
...(roleRuntimeState.route === undefined ? {} : { route: { ...roleRuntimeState.route } })
|
|
87
92
|
} }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsmm/dsmm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "DeepSeek Harness deepwork mode bundle for ocmm-style agentic workflows.",
|
|
5
5
|
"author": "Hugefiver",
|
|
6
6
|
"license": "LicenseRef-AAAPL",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"@deepseek-ai/dsh-api-session-controller": "0.2.0-rc.2",
|
|
112
112
|
"@deepseek-ai/dsh-client-ui-session": "0.2.0-rc.2",
|
|
113
113
|
"@deepseek-ai/dsh-client-ui-conversation": "0.2.0-rc.2",
|
|
114
|
+
"@deepseek-ai/dsh-client-ui-model-selection": "0.2.0-rc.2",
|
|
114
115
|
"@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
|
|
115
116
|
"@deepseek-ai/dsh-typert-registry": "0.2.0-rc.2",
|
|
116
117
|
"@deepseek-ai/dsh-api-gateway": "0.2.0-rc.2",
|
|
@@ -122,6 +123,8 @@
|
|
|
122
123
|
"@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.2",
|
|
123
124
|
"@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
|
|
124
125
|
"@types/react": "^18.3.27",
|
|
126
|
+
"immer": "10.1.1",
|
|
127
|
+
"zustand": "4.4.7",
|
|
125
128
|
"esbuild": "^0.25.12",
|
|
126
129
|
"react": "^18.3.1",
|
|
127
130
|
"@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
|