@dsmm/dsmm 0.1.1 → 0.1.4
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 +24 -13
- package/agent-presets/dsmm-builder/agent.cordis.yml +14 -12
- package/agent-presets/dsmm-builder/preset.yml +1 -1
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-clarifier/preset.yml +1 -1
- package/agent-presets/dsmm-code-search/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-code-search/preset.yml +1 -1
- package/agent-presets/dsmm-creative/agent.cordis.yml +3 -1
- package/agent-presets/dsmm-creative/preset.yml +1 -1
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-doc-search/preset.yml +1 -1
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-media-reader/preset.yml +1 -1
- package/agent-presets/dsmm-oracle/agent.cordis.yml +3 -1
- package/agent-presets/dsmm-oracle/preset.yml +1 -1
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +3 -1
- package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +15 -13
- package/agent-presets/dsmm-orchestrator/preset.yml +2 -2
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
- package/agent-presets/dsmm-planner/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-planner/preset.yml +1 -1
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-reviewer/preset.yml +1 -1
- package/docs/agent-presets.md +15 -5
- package/docs/compatibility.md +64 -11
- package/docs/model-routing.md +10 -6
- package/docs/profiles.md +83 -0
- package/docs/releasing.md +58 -19
- package/docs/settings-status.md +13 -5
- package/lib/client/ProfilesSection.d.ts +11 -0
- package/lib/client/ProfilesSection.js +62 -0
- package/lib/client/controller.d.ts +77 -0
- package/lib/client/controller.js +198 -0
- package/lib/client/index.d.ts +11 -0
- package/lib/client/index.js +34 -0
- package/lib/client/locales.d.ts +56 -0
- package/lib/client/locales.js +48 -0
- package/lib/client/styles.d.ts +3 -0
- package/lib/client/styles.js +25 -0
- package/lib/client.js +1930 -0
- package/lib/commands.d.ts +3 -3
- package/lib/commands.js +4 -4
- package/lib/dsh-types.d.ts +4 -0
- package/lib/guards.d.ts +2 -2
- package/lib/guards.js +3 -2
- package/lib/index.d.ts +12 -4
- package/lib/index.js +72 -20
- package/lib/mode.d.ts +2 -2
- package/lib/mode.js +1 -1
- package/lib/model-routing.d.ts +2 -2
- package/lib/model-routing.js +17 -2
- package/lib/preset-registry.js +5 -3
- package/lib/profile-remote.d.ts +31 -0
- package/lib/profile-remote.js +106 -0
- package/lib/profile-rpc.d.ts +27 -0
- package/lib/profile-rpc.js +90 -0
- package/lib/profile-runtime.d.ts +44 -0
- package/lib/profile-runtime.js +159 -0
- package/lib/profile-store.d.ts +42 -0
- package/lib/profile-store.js +478 -0
- package/lib/profile-types.d.ts +40 -0
- package/lib/profile-types.js +2 -0
- package/lib/profiles.d.ts +26 -0
- package/lib/profiles.js +237 -0
- package/lib/prompts.d.ts +2 -2
- package/lib/prompts.js +4 -4
- package/lib/role-providers.d.ts +2 -2
- package/lib/role-providers.js +39 -6
- package/lib/role-routing.d.ts +2 -2
- package/lib/role-routing.js +4 -1
- package/lib/role-subagents.d.ts +2 -2
- package/lib/role-subagents.js +6 -4
- package/lib/roles.d.ts +4 -0
- package/lib/roles.js +43 -27
- package/lib/runtime-recovery.d.ts +2 -2
- package/lib/runtime-recovery.js +3 -3
- package/lib/session-metadata.d.ts +13 -0
- package/lib/session-metadata.js +34 -0
- package/lib/session-persistence.d.ts +35 -0
- package/lib/session-persistence.js +304 -0
- package/lib/settings.d.ts +8 -1
- package/lib/settings.js +4 -0
- package/lib/state.d.ts +1 -0
- package/lib/state.js +4 -0
- package/lib/status.js +6 -5
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +62 -15
- package/patches/agent-presets-root.example.cordis.patch.yml +6 -10
- package/prompts/deepseek-v4-pro.md +1 -1
- package/prompts/deepwork.md +3 -3
- package/scripts/repair-session-log.mjs +476 -0
- package/scripts/session-repair-native-verifier.mjs +367 -0
package/lib/commands.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DshContext } from "./dsh-types.js";
|
|
2
2
|
import { DSMM_STATUS_COMMAND } from "./settings.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { DsmmSettingsGetter } from "./settings.js";
|
|
4
4
|
import type { DeepworkModeController } from "./state.js";
|
|
5
5
|
export { DSMM_STATUS_COMMAND };
|
|
6
6
|
export interface DeepworkCommandInput {
|
|
@@ -8,6 +8,6 @@ export interface DeepworkCommandInput {
|
|
|
8
8
|
message: string;
|
|
9
9
|
}
|
|
10
10
|
export declare function parseDeepworkCommandInput(rawInput: string): DeepworkCommandInput;
|
|
11
|
-
export declare function registerDeepworkCommand(readyCtx: DshContext, controller: DeepworkModeController, getSettings:
|
|
12
|
-
export declare function registerDsmmStatusCommand(readyCtx: DshContext, controller: DeepworkModeController, getSettings:
|
|
11
|
+
export declare function registerDeepworkCommand(readyCtx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter): void;
|
|
12
|
+
export declare function registerDsmmStatusCommand(readyCtx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter): void;
|
|
13
13
|
//# sourceMappingURL=commands.d.ts.map
|
package/lib/commands.js
CHANGED
|
@@ -8,7 +8,7 @@ export function parseDeepworkCommandInput(rawInput) {
|
|
|
8
8
|
}
|
|
9
9
|
async function handleDeepworkCommand(controller, getSettings, invocation) {
|
|
10
10
|
const parsed = parseDeepworkCommandInput(invocation.rawInput);
|
|
11
|
-
await controller.select(invocation.agent, parsed.action === "on", getSettings().defaultActive);
|
|
11
|
+
await controller.select(invocation.agent, parsed.action === "on", getSettings(invocation.agent).defaultActive);
|
|
12
12
|
if (parsed.action === "on" && parsed.message !== "") {
|
|
13
13
|
await invocation.agent.steer?.(createUserMessage({
|
|
14
14
|
content: [{ type: "text", text: parsed.message }],
|
|
@@ -23,7 +23,7 @@ function handleDsmmStatusCommand(controller, getSettings, invocation) {
|
|
|
23
23
|
const input = invocation.rawInput.trim();
|
|
24
24
|
if (input !== "" && input !== "json")
|
|
25
25
|
return { kind: "error", text: "Usage: /dsmm-status [json]" };
|
|
26
|
-
const settings = getSettings();
|
|
26
|
+
const settings = getSettings(invocation.agent);
|
|
27
27
|
const snapshot = createDsmmStatusSnapshot({
|
|
28
28
|
agent: invocation.agent,
|
|
29
29
|
settings,
|
|
@@ -38,7 +38,7 @@ export function registerDeepworkCommand(readyCtx, controller, getSettings) {
|
|
|
38
38
|
const commands = readyCtx.get?.("commands") ?? readyCtx.commands;
|
|
39
39
|
commands?.register({
|
|
40
40
|
name: getSettings().modeName,
|
|
41
|
-
description: "Enter or leave
|
|
41
|
+
description: "Enter or leave Deepwork mode",
|
|
42
42
|
input: { hint: "[off|message]" },
|
|
43
43
|
handler: (invocation) => handleDeepworkCommand(controller, getSettings, invocation)
|
|
44
44
|
});
|
|
@@ -47,7 +47,7 @@ export function registerDsmmStatusCommand(readyCtx, controller, getSettings) {
|
|
|
47
47
|
const commands = readyCtx.get?.("commands") ?? readyCtx.commands;
|
|
48
48
|
commands?.register({
|
|
49
49
|
name: DSMM_STATUS_COMMAND,
|
|
50
|
-
description: "Show
|
|
50
|
+
description: "Show Deepwork status",
|
|
51
51
|
input: { hint: "[json]" },
|
|
52
52
|
handler: (invocation) => handleDsmmStatusCommand(controller, getSettings, invocation)
|
|
53
53
|
});
|
package/lib/dsh-types.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export interface DshSession {
|
|
|
29
29
|
append(type: "dsmm/role-policy", payload: import("./dsh-events.js").DsmmRolePolicyEventData): unknown | Promise<unknown>;
|
|
30
30
|
}
|
|
31
31
|
export interface DshAgent {
|
|
32
|
+
id?: string;
|
|
33
|
+
ctx?: DshContext;
|
|
32
34
|
session: DshSession;
|
|
33
35
|
options?: {
|
|
34
36
|
provider?: string;
|
|
@@ -77,6 +79,7 @@ export interface DshResolvedModelInfo {
|
|
|
77
79
|
}
|
|
78
80
|
export interface DshLlmRuntime {
|
|
79
81
|
resolveModelInfo(provider: string, model: string, signal?: AbortSignal): Promise<DshResolvedModelInfo>;
|
|
82
|
+
resolveCallConfig?(config: DshLlmCallConfig, signal?: AbortSignal): Promise<DshLlmCallConfig>;
|
|
80
83
|
}
|
|
81
84
|
export interface AgentRequestFrame {
|
|
82
85
|
agent: DshAgent;
|
|
@@ -288,6 +291,7 @@ export interface DshContext {
|
|
|
288
291
|
tools?: DshToolRuntime;
|
|
289
292
|
llm?: DshLlmRuntime;
|
|
290
293
|
get?<T = unknown>(name: string): T | undefined;
|
|
294
|
+
provide?(name: string, service: unknown): unknown;
|
|
291
295
|
plugin?(plugin: unknown, config?: unknown): PromiseLike<unknown>;
|
|
292
296
|
inject?(dependencies: string[], installer: (readyCtx: DshContext) => unknown): unknown;
|
|
293
297
|
effect?(callback: () => void | (() => void)): unknown;
|
package/lib/guards.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { DshContext, DshPostToolDecision, DshPreToolDecision, DshToolExecution, DshToolExecutionResult } from "./dsh-types.js";
|
|
2
|
-
import type { DsmmSettings } from "./settings.js";
|
|
2
|
+
import type { DsmmSettings, DsmmSettingsGetter } from "./settings.js";
|
|
3
3
|
import type { DeepworkModeController } from "./state.js";
|
|
4
4
|
export declare const DSMM_GUARD_PREFIX = "[dsmm safety]";
|
|
5
5
|
export declare function truncateTextMiddle(text: string, maxBytes: number, toolName: string): string;
|
|
6
6
|
export declare function isSafetyScopeActive(exec: DshToolExecution, settings: DsmmSettings, controller: DeepworkModeController): boolean;
|
|
7
7
|
export declare function decidePreToolExecution(exec: DshToolExecution, settings: DsmmSettings, controller: DeepworkModeController): DshPreToolDecision | undefined;
|
|
8
8
|
export declare function decidePostToolExecution(exec: DshToolExecution, result: Readonly<DshToolExecutionResult>, decision: DshPostToolDecision, settings: DsmmSettings, controller: DeepworkModeController): DshPostToolDecision;
|
|
9
|
-
export declare function registerSafetyGuards(ctx: DshContext, controller: DeepworkModeController, getSettings:
|
|
9
|
+
export declare function registerSafetyGuards(ctx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter): void;
|
|
10
10
|
//# sourceMappingURL=guards.d.ts.map
|
package/lib/guards.js
CHANGED
|
@@ -236,7 +236,7 @@ export function decidePostToolExecution(exec, result, decision, settings, contro
|
|
|
236
236
|
}
|
|
237
237
|
export function registerSafetyGuards(ctx, controller, getSettings) {
|
|
238
238
|
ctx.on?.("tools/pre-execute", async (exec, next) => {
|
|
239
|
-
const decision = decidePreToolExecution(exec, getSettings(), controller);
|
|
239
|
+
const decision = decidePreToolExecution(exec, getSettings(exec.agent), controller);
|
|
240
240
|
if (decision === undefined)
|
|
241
241
|
return next();
|
|
242
242
|
if (decision.kind === "deny")
|
|
@@ -245,8 +245,9 @@ export function registerSafetyGuards(ctx, controller, getSettings) {
|
|
|
245
245
|
return downstream.kind === "allow" ? decision : downstream;
|
|
246
246
|
}, { prepend: true });
|
|
247
247
|
ctx.on?.("tools/post-execute", async (exec, result, next) => {
|
|
248
|
+
const settings = getSettings(exec.agent);
|
|
248
249
|
const decision = await next();
|
|
249
|
-
return decidePostToolExecution(exec, result, decision,
|
|
250
|
+
return decidePostToolExecution(exec, result, decision, settings, controller);
|
|
250
251
|
}, { prepend: true });
|
|
251
252
|
}
|
|
252
253
|
//# sourceMappingURL=guards.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DshContext } from "./dsh-types.js";
|
|
2
2
|
import type { DsmmPluginConfig } from "./settings.js";
|
|
3
3
|
export declare const name = "dsmm";
|
|
4
|
-
export declare const inject: readonly [];
|
|
4
|
+
export declare const inject: readonly ["profileContext"];
|
|
5
5
|
export type Config = DsmmPluginConfig;
|
|
6
6
|
export declare const Config: import("@deepseek-ai/schemastery").default<DsmmPluginConfig>;
|
|
7
7
|
export type { DeepworkSessionEventMap } from "./dsh-events.js";
|
|
@@ -26,8 +26,16 @@ export { DSMM_STATUS_VERSION, createDsmmStatusSnapshot, formatDsmmStatus } from
|
|
|
26
26
|
export type { DsmmStatusSnapshot } from "./status.js";
|
|
27
27
|
export type { AgentRequestErrorFrame, AgentRequestFrame, AgentTurnStoppingFrame, DshEpochHeader, DshGoalChangeEventData, DshGoalSnapshot, DshLlmCallConfig, DshLlmFailure, DshModelReasoningInfo, DshReasoningEffortInfo, DshRequestErrorAction, DshRequestHeaderEventData, DshResolvedModelInfo, DshStepBoundaryEventData, DshTodoItem, DshTodoWriteEventData } from "./dsh-types.js";
|
|
28
28
|
export { DSMM_SKILL_NAMES, DEFAULT_DSMM_SETTINGS, MVP_SKILL_NAMES, isRoleEnabled, resolveConfig, resolveRoleRouting, registerSettings } from "./settings.js";
|
|
29
|
-
export type { DeepseekCalibration, DeepseekDefaultReasoningEffort, DsmmFinalReviewPolicy, DsmmGitWritePolicy, DsmmGuardScope, DsmmGuardSettings, DsmmPluginConfig, DsmmModelRoute, DsmmRoleRoutingConfig, DsmmRoleRouting, DsmmRecoveryRoute, DsmmRuntimeRecoverySettings, DsmmSettings, DsmmSkillName, DsmmWorkflowSettings, MvpSkillName } from "./settings.js";
|
|
29
|
+
export type { DeepseekCalibration, DeepseekDefaultReasoningEffort, DsmmFinalReviewPolicy, DsmmGitWritePolicy, DsmmGuardScope, DsmmGuardSettings, DsmmPluginConfig, DsmmModelRoute, DsmmRoleRoutingConfig, DsmmRoleRouting, DsmmRecoveryRoute, DsmmRuntimeRecoverySettings, DsmmSettings, DsmmSettingsGetter, DsmmSkillName, DsmmWorkflowSettings, MvpSkillName } from "./settings.js";
|
|
30
|
+
export { createProfileRuntime, DsmmProfileRuntime } from "./profile-runtime.js";
|
|
31
|
+
export type { DsmmProfileRuntimeStore, DsmmProfileRuntimeOptions } from "./profile-runtime.js";
|
|
30
32
|
export { DEEPWORK_MODE_EVENT, DeepworkModeController, hasOpenTurn, isDeepworkActive } from "./state.js";
|
|
31
|
-
export declare function apply(ctx: DshContext, config?: Config): void
|
|
32
|
-
|
|
33
|
+
export declare function apply(ctx: DshContext, config?: Config): void | Promise<void>;
|
|
34
|
+
declare const _default: {
|
|
35
|
+
name: string;
|
|
36
|
+
inject: readonly ["profileContext"];
|
|
37
|
+
Config: import("@deepseek-ai/schemastery").default<DsmmPluginConfig>;
|
|
38
|
+
apply: typeof apply;
|
|
39
|
+
};
|
|
40
|
+
export default _default;
|
|
33
41
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -7,10 +7,14 @@ import { reconcileRolePresets, resolveManagedPresetRoot } from "./preset-materia
|
|
|
7
7
|
import { registerHeadlessRoleTools } from "./role-subagents.js";
|
|
8
8
|
import { registerRolePresets } from "./preset-registry.js";
|
|
9
9
|
import { registerRoleProviders } from "./role-providers.js";
|
|
10
|
+
import { createProfileRuntime } from "./profile-runtime.js";
|
|
11
|
+
import { registerProfilesRpc } from "./profile-rpc.js";
|
|
10
12
|
import { DSMM_CONFIG_SCHEMA, registerSettings } from "./settings.js";
|
|
11
13
|
import { DeepworkModeController } from "./state.js";
|
|
14
|
+
import DsmmSessionPersistence from "./session-persistence.js";
|
|
15
|
+
import { isAbsolute } from "node:path";
|
|
12
16
|
export const name = "dsmm";
|
|
13
|
-
export const inject = [];
|
|
17
|
+
export const inject = ["profileContext"];
|
|
14
18
|
export const Config = DSMM_CONFIG_SCHEMA;
|
|
15
19
|
export { DSMM_ROLE_IDS, DSMM_ROLES, isDsmmRoleId, renderAgentCordis, renderPresetMetadata } from "./roles.js";
|
|
16
20
|
export { DSMM_MANAGED_PRESET_MARKER, materializeRolePresets, reconcileRolePresets, resolveManagedPresetRoot } from "./preset-materializer.js";
|
|
@@ -26,33 +30,81 @@ export { effectiveRoleFallbackRoutes } from "./role-routing.js";
|
|
|
26
30
|
export { DSMM_STATUS_COMMAND, registerDsmmStatusCommand } from "./commands.js";
|
|
27
31
|
export { DSMM_STATUS_VERSION, createDsmmStatusSnapshot, formatDsmmStatus } from "./status.js";
|
|
28
32
|
export { DSMM_SKILL_NAMES, DEFAULT_DSMM_SETTINGS, MVP_SKILL_NAMES, isRoleEnabled, resolveConfig, resolveRoleRouting, registerSettings } from "./settings.js";
|
|
33
|
+
export { createProfileRuntime, DsmmProfileRuntime } from "./profile-runtime.js";
|
|
29
34
|
export { DEEPWORK_MODE_EVENT, DeepworkModeController, hasOpenTurn, isDeepworkActive } from "./state.js";
|
|
30
35
|
export function apply(ctx, config = {}) {
|
|
36
|
+
const storage = config.sessionPersistence;
|
|
37
|
+
if (storage !== undefined) {
|
|
38
|
+
if (storage === null || typeof storage !== "object" || typeof storage.root !== "string" || !isAbsolute(storage.root)
|
|
39
|
+
|| Object.keys(storage).some((key) => !["root", "compression"].includes(key))
|
|
40
|
+
|| storage.compression !== undefined && !["zstd", "none"].includes(storage.compression)) {
|
|
41
|
+
throw new Error("Deepwork sessionPersistence must preserve an explicit absolute native root and compression");
|
|
42
|
+
}
|
|
43
|
+
if (ctx.get === undefined || ctx.plugin === undefined)
|
|
44
|
+
throw new Error("Deepwork sessionPersistence requires native startup composition");
|
|
45
|
+
if (ctx.get("sessionPersistence") !== undefined)
|
|
46
|
+
throw new Error("Disable the exact existing JSONL entry at startup before enabling Deepwork sessionPersistence; live replacement is refused");
|
|
47
|
+
const fiber = ctx.plugin(DsmmSessionPersistence, storage);
|
|
48
|
+
if (fiber === undefined)
|
|
49
|
+
throw new Error("Deepwork sessionPersistence startup registration failed");
|
|
50
|
+
return fiber.await().then(() => applyRuntime(ctx, config));
|
|
51
|
+
}
|
|
52
|
+
return applyRuntime(ctx, config);
|
|
53
|
+
}
|
|
54
|
+
function applyRuntime(ctx, config) {
|
|
31
55
|
const controller = new DeepworkModeController(ctx);
|
|
56
|
+
let runtime;
|
|
57
|
+
let profileInitialization;
|
|
58
|
+
const getBoundSettings = (agent) => runtime?.getSettings(agent) ?? getSettings();
|
|
32
59
|
const getSettings = registerSettings(ctx, config, {
|
|
33
60
|
install(readyCtx, getReadySettings) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
61
|
+
const install = (installCtx, settingsGetter) => {
|
|
62
|
+
registerDeepworkPrompt(installCtx, controller, settingsGetter, config);
|
|
63
|
+
const installCommands = (commandCtx) => {
|
|
64
|
+
registerDeepworkCommand(commandCtx, controller, settingsGetter);
|
|
65
|
+
registerDsmmStatusCommand(commandCtx, controller, settingsGetter);
|
|
66
|
+
};
|
|
67
|
+
if (installCtx.get !== undefined && installCtx.inject !== undefined)
|
|
68
|
+
installCtx.inject(["commands"], installCommands);
|
|
69
|
+
else
|
|
70
|
+
installCommands(installCtx);
|
|
71
|
+
registerRoleProviders(installCtx, settingsGetter, getReadySettings);
|
|
72
|
+
// Standing compositions are deployment-only and never replaced on a
|
|
73
|
+
// runtime profile selection. All routes are read from Agent bindings.
|
|
74
|
+
registerRolePresets(installCtx, getReadySettings);
|
|
75
|
+
const settings = getReadySettings();
|
|
76
|
+
const root = resolveManagedPresetRoot(settings);
|
|
77
|
+
if (root !== undefined)
|
|
78
|
+
reconcileRolePresets({ root, settings });
|
|
38
79
|
};
|
|
39
|
-
if (readyCtx.get
|
|
40
|
-
readyCtx
|
|
41
|
-
else
|
|
42
|
-
installCommands(readyCtx);
|
|
43
|
-
registerRoleProviders(readyCtx, getReadySettings);
|
|
44
|
-
registerRolePresets(readyCtx, getReadySettings);
|
|
45
|
-
const settings = getReadySettings();
|
|
46
|
-
const root = resolveManagedPresetRoot(settings);
|
|
47
|
-
if (root === undefined)
|
|
80
|
+
if (readyCtx.get === undefined) {
|
|
81
|
+
install(readyCtx, getReadySettings);
|
|
48
82
|
return;
|
|
49
|
-
|
|
83
|
+
}
|
|
84
|
+
const installProfiles = async (profileCtx) => {
|
|
85
|
+
runtime = await createProfileRuntime(profileCtx, getReadySettings());
|
|
86
|
+
profileCtx.provide?.("dsmmProfileRuntime", runtime);
|
|
87
|
+
const manager = runtime;
|
|
88
|
+
profileCtx.inject?.(["typert"], (rpcCtx) => {
|
|
89
|
+
registerProfilesRpc(rpcCtx, manager);
|
|
90
|
+
});
|
|
91
|
+
install(profileCtx, runtime.getSettings);
|
|
92
|
+
};
|
|
93
|
+
if (readyCtx.inject !== undefined) {
|
|
94
|
+
const initialization = readyCtx.inject(["profileContext"], installProfiles);
|
|
95
|
+
profileInitialization = Promise.resolve(initialization).then(() => undefined);
|
|
96
|
+
}
|
|
97
|
+
else
|
|
98
|
+
throw new Error("dsmm native profiles require asynchronous profileContext injection");
|
|
50
99
|
}
|
|
51
100
|
});
|
|
52
|
-
registerRuntimeRecovery(ctx, controller,
|
|
53
|
-
registerModelRouting(ctx, controller,
|
|
54
|
-
registerHeadlessRoleTools(ctx, controller,
|
|
55
|
-
registerSafetyGuards(ctx, controller,
|
|
101
|
+
registerRuntimeRecovery(ctx, controller, getBoundSettings);
|
|
102
|
+
registerModelRouting(ctx, controller, getBoundSettings);
|
|
103
|
+
registerHeadlessRoleTools(ctx, controller, getBoundSettings);
|
|
104
|
+
registerSafetyGuards(ctx, controller, getBoundSettings);
|
|
105
|
+
return profileInitialization;
|
|
56
106
|
}
|
|
57
|
-
|
|
107
|
+
// Cordis Loader introspects this object's Config/inject; a bare function loses
|
|
108
|
+
// the exported schema and may pass null where required DSMM defaults belong.
|
|
109
|
+
export default { name, inject, Config, apply };
|
|
58
110
|
//# sourceMappingURL=index.js.map
|
package/lib/mode.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DshContext } from "./dsh-types.js";
|
|
2
2
|
import type { Config } from "./index.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { DsmmSettingsGetter } from "./settings.js";
|
|
4
4
|
import type { DeepworkModeController } from "./state.js";
|
|
5
|
-
export declare function registerDeepworkPrompt(readyCtx: DshContext, controller: DeepworkModeController, getSettings:
|
|
5
|
+
export declare function registerDeepworkPrompt(readyCtx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter, config?: Config): void;
|
|
6
6
|
//# sourceMappingURL=mode.d.ts.map
|
package/lib/mode.js
CHANGED
|
@@ -14,7 +14,7 @@ export function registerDeepworkPrompt(readyCtx, controller, getSettings, config
|
|
|
14
14
|
order: getSettings().promptOrder,
|
|
15
15
|
interpolate: false,
|
|
16
16
|
text(context) {
|
|
17
|
-
const settings = getSettings();
|
|
17
|
+
const settings = getSettings(context.agent);
|
|
18
18
|
const preset = resolveSelectedAgentPreset(context.agent?.session);
|
|
19
19
|
const active = controller.active(context.agent, settings.defaultActive);
|
|
20
20
|
if (!active && !isDsmmRoleId(preset))
|
package/lib/model-routing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DshContext, DshLlmCallConfig, DshModelReasoningInfo } from "./dsh-types.js";
|
|
2
|
-
import type { DeepseekDefaultReasoningEffort, DsmmSettings } from "./settings.js";
|
|
2
|
+
import type { DeepseekDefaultReasoningEffort, DsmmSettings, DsmmSettingsGetter } from "./settings.js";
|
|
3
3
|
import type { DeepworkModeController } from "./state.js";
|
|
4
4
|
export type DeepseekReasoningEffort = DeepseekDefaultReasoningEffort | "max";
|
|
5
5
|
export type DeepseekModelRoute = "v4-pro" | "flash";
|
|
@@ -7,5 +7,5 @@ export declare function isDeepseekV4ProRoute(config: Pick<DshLlmCallConfig, "pro
|
|
|
7
7
|
export declare function isDeepseekFlashRoute(config: Pick<DshLlmCallConfig, "provider" | "model">): boolean;
|
|
8
8
|
export declare function desiredDeepseekEffort(settings: DsmmSettings, preset?: string, route?: DeepseekModelRoute): DeepseekReasoningEffort;
|
|
9
9
|
export declare function selectAdvertisedEffort(desired: DeepseekReasoningEffort, reasoning: DshModelReasoningInfo | undefined): string | undefined;
|
|
10
|
-
export declare function registerModelRouting(ctx: DshContext, controller: DeepworkModeController, getSettings:
|
|
10
|
+
export declare function registerModelRouting(ctx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter): void;
|
|
11
11
|
//# sourceMappingURL=model-routing.d.ts.map
|
package/lib/model-routing.js
CHANGED
|
@@ -28,6 +28,11 @@ export function selectAdvertisedEffort(desired, reasoning) {
|
|
|
28
28
|
}
|
|
29
29
|
return advertised.has(desired) ? desired : fallback;
|
|
30
30
|
}
|
|
31
|
+
function hasLiveRuntimeOwner(ctx, agent) {
|
|
32
|
+
const agents = ctx.get?.("agents");
|
|
33
|
+
return agent.id !== undefined && agents !== undefined
|
|
34
|
+
&& agents.list().some((parent) => parent !== agent && agents.isOwnedBy(agent.id, parent));
|
|
35
|
+
}
|
|
31
36
|
export function registerModelRouting(ctx, controller, getSettings) {
|
|
32
37
|
const installedContexts = new WeakSet();
|
|
33
38
|
const install = (readyCtx) => {
|
|
@@ -38,13 +43,13 @@ export function registerModelRouting(ctx, controller, getSettings) {
|
|
|
38
43
|
try {
|
|
39
44
|
dispose = readyCtx.on("agent/request", async (frame, next) => {
|
|
40
45
|
let downstream = await next();
|
|
41
|
-
const settings = getSettings();
|
|
46
|
+
const settings = getSettings(frame.agent);
|
|
42
47
|
const admitted = takeAdmittedRecoveryRoute(frame);
|
|
43
48
|
const active = controller.active(frame.agent, settings.defaultActive);
|
|
44
49
|
const role = resolveEffectiveDsmmRole(frame.agent, settings, active);
|
|
45
50
|
const policy = role === undefined ? undefined : settings.roleRouting[role];
|
|
46
51
|
const primary = policy?.primary;
|
|
47
|
-
const identity = await establishRolePolicy(frame, settings, role);
|
|
52
|
+
const identity = await establishRolePolicy(frame, settings, role, readyCtx);
|
|
48
53
|
if (admitted !== undefined) {
|
|
49
54
|
downstream = applyModelRoute(downstream, admitted);
|
|
50
55
|
if (admitted.reasoningEffort !== undefined || primary !== undefined
|
|
@@ -52,6 +57,16 @@ export function registerModelRouting(ctx, controller, getSettings) {
|
|
|
52
57
|
return downstream;
|
|
53
58
|
}
|
|
54
59
|
const fallbacks = effectiveRoleFallbackRoutes(settings, role);
|
|
60
|
+
if (primary !== undefined && role !== undefined && frame.agent.session.header?.origin === "subagent"
|
|
61
|
+
&& (frame.agent.session.inheritedEventCount ?? 0) === 0
|
|
62
|
+
&& hasLiveRuntimeOwner(readyCtx, frame.agent)) {
|
|
63
|
+
// A trusted one-shot alias already preflighted its merged native
|
|
64
|
+
// options. Its first accepted route, not the profile default, starts
|
|
65
|
+
// this live child's durable host/recovery ownership. Cold unowned or
|
|
66
|
+
// parent-seeded fork children resolve the current primary below.
|
|
67
|
+
const accepted = persistedRoleRoute(frame, undefined, fallbacks, identity);
|
|
68
|
+
return accepted === undefined ? downstream : applyModelRoute(downstream, accepted);
|
|
69
|
+
}
|
|
55
70
|
if (primary !== undefined)
|
|
56
71
|
return applyModelRoute(downstream, persistedRoleRoute(frame, primary, fallbacks, identity) ?? primary);
|
|
57
72
|
if (settings.runtimeRecovery.enabled && policy?.fallbackRoutes !== undefined) {
|
package/lib/preset-registry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getTraceable } from "@deepseek-ai/cordis";
|
|
2
|
-
import { DSMM_ROLES, DSMM_ROLE_IDS, rolePluginRows } from "./roles.js";
|
|
2
|
+
import { DSMM_ROLES, DSMM_ROLE_IDS, isRootRole, rolePluginRows } from "./roles.js";
|
|
3
3
|
import { enabledSkillNames } from "./skills.js";
|
|
4
4
|
/** Declare roles to DSH 0.2's native registry; directories are not discovery inputs. */
|
|
5
5
|
export function registerRolePresets(ctx, getSettings) {
|
|
@@ -10,7 +10,7 @@ export function registerRolePresets(ctx, getSettings) {
|
|
|
10
10
|
throw new Error("dsmm requires the native DSH agentPresets registry");
|
|
11
11
|
const settings = getSettings();
|
|
12
12
|
const enabled = DSMM_ROLE_IDS.filter((id) => settings.roles[id]);
|
|
13
|
-
const active = DSMM_ROLES.filter((role) => enabled.includes(role.id));
|
|
13
|
+
const active = DSMM_ROLES.filter((role) => isRootRole(role) && enabled.includes(role.id));
|
|
14
14
|
const disposers = [];
|
|
15
15
|
try {
|
|
16
16
|
for (const role of active) {
|
|
@@ -19,7 +19,9 @@ export function registerRolePresets(ctx, getSettings) {
|
|
|
19
19
|
name: role.name,
|
|
20
20
|
description: role.description,
|
|
21
21
|
order: role.order,
|
|
22
|
-
|
|
22
|
+
// Profiles do not replace standing native compositions. Child routes
|
|
23
|
+
// are admitted by the role provider from the parent's fixed snapshot.
|
|
24
|
+
plugins: rolePluginRows(role, enabledSkillNames(settings), enabled)
|
|
23
25
|
}));
|
|
24
26
|
}
|
|
25
27
|
// A direct selection of a read-only preset must be restricted at the Agent
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RemoteResult, TypertRemoteContribution } from "@deepseek-ai/dsh-typert-protocol";
|
|
2
|
+
import type { TypertContribution } from "@deepseek-ai/dsh-typert-registry";
|
|
3
|
+
import type { ProfileErrorInfo, ProfileReadResult, ProfileSaveRequest, ProfileSelectRequest, ProfileSnapshot } from "./profile-types.js";
|
|
4
|
+
export interface DsmmProfilesRemote {
|
|
5
|
+
describe(): Promise<RemoteResult<ProfileSnapshot>>;
|
|
6
|
+
read(id: string): Promise<RemoteResult<ProfileReadResult>>;
|
|
7
|
+
save(request: ProfileSaveRequest): Promise<RemoteResult<ProfileReadResult>>;
|
|
8
|
+
select(request: ProfileSelectRequest): Promise<RemoteResult<ProfileSnapshot>>;
|
|
9
|
+
}
|
|
10
|
+
declare module "@deepseek-ai/dsh-typert-protocol/types" {
|
|
11
|
+
interface TypertRemoteMap {
|
|
12
|
+
"dsmmProfiles/describe": DsmmProfilesRemote["describe"];
|
|
13
|
+
"dsmmProfiles/read": DsmmProfilesRemote["read"];
|
|
14
|
+
"dsmmProfiles/save": DsmmProfilesRemote["save"];
|
|
15
|
+
"dsmmProfiles/select": DsmmProfilesRemote["select"];
|
|
16
|
+
}
|
|
17
|
+
interface TypertRemoteNamespaceMap {
|
|
18
|
+
dsmmProfiles: DsmmProfilesRemote;
|
|
19
|
+
}
|
|
20
|
+
interface RemoteErrorDetailsMap {
|
|
21
|
+
"dsmm-profiles/refused": ProfileErrorInfo;
|
|
22
|
+
"dsmm-profiles/peer-required": {};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Shared wire grammar for native codec validation and local form feedback. */
|
|
26
|
+
export declare function isProfileId(value: unknown): value is string;
|
|
27
|
+
/** Explicit strict Host contract; no SRC fallback or browser-supplied authority. */
|
|
28
|
+
export declare const TYPERT_REMOTE: TypertRemoteContribution;
|
|
29
|
+
export declare const TYPERT_HOST: TypertContribution;
|
|
30
|
+
export default TYPERT_REMOTE;
|
|
31
|
+
//# sourceMappingURL=profile-remote.d.ts.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const errorCodes = new Set(["validation", "conflict", "not-found", "lock-timeout", "unsafe-path", "io", "activation", "corrupt-selection", "limit"]);
|
|
2
|
+
const idPattern = /^[a-z0-9][a-z0-9_-]{0,63}$/u;
|
|
3
|
+
const revisionPattern = /^[a-f0-9]{64}$/u;
|
|
4
|
+
/** Shared wire grammar for native codec validation and local form feedback. */
|
|
5
|
+
export function isProfileId(value) {
|
|
6
|
+
return typeof value === "string" && idPattern.test(value)
|
|
7
|
+
&& !/^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])$/iu.test(value);
|
|
8
|
+
}
|
|
9
|
+
function fail(field) { throw new TypeError(`Invalid Deepwork profile wire field: ${field}`); }
|
|
10
|
+
function text(value, field, maximum = 1024) {
|
|
11
|
+
if (typeof value !== "string" || value.length > maximum)
|
|
12
|
+
fail(field);
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
function id(value) {
|
|
16
|
+
const result = text(value, "id", 64);
|
|
17
|
+
if (!isProfileId(result))
|
|
18
|
+
fail("id");
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
function revision(value) {
|
|
22
|
+
const result = text(value, "revision", 64);
|
|
23
|
+
if (!revisionPattern.test(result))
|
|
24
|
+
fail("revision");
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
function selectionRevision(value) { return value === "absent" ? value : revision(value); }
|
|
28
|
+
function object(value, required, optional = []) {
|
|
29
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
30
|
+
fail("object");
|
|
31
|
+
const result = value;
|
|
32
|
+
if (Object.keys(result).some((key) => !required.includes(key) && !optional.includes(key))
|
|
33
|
+
|| required.some((key) => !Object.hasOwn(result, key)))
|
|
34
|
+
fail("object keys");
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function optional(value, key, parse) {
|
|
38
|
+
return Object.hasOwn(value, key) ? { [key]: parse(value[key]) } : {};
|
|
39
|
+
}
|
|
40
|
+
function errorInfo(value) {
|
|
41
|
+
const item = object(value, ["code", "message"], ["field"]);
|
|
42
|
+
const code = text(item.code, "code");
|
|
43
|
+
if (!errorCodes.has(code))
|
|
44
|
+
fail("code");
|
|
45
|
+
return { code: code, message: text(item.message, "message", 4096), ...optional(item, "field", (input) => text(input, "field", 256)) };
|
|
46
|
+
}
|
|
47
|
+
function readResult(value) {
|
|
48
|
+
const item = object(value, ["id", "revision", "content"], ["label"]);
|
|
49
|
+
return { id: id(item.id), revision: revision(item.revision), content: content(item.content), ...optional(item, "label", (input) => text(input, "label", 120)) };
|
|
50
|
+
}
|
|
51
|
+
function content(value) {
|
|
52
|
+
const result = text(value, "content", 128 * 1024);
|
|
53
|
+
if (new TextEncoder().encode(result).byteLength > 128 * 1024)
|
|
54
|
+
fail("content");
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
function snapshot(value) {
|
|
58
|
+
const item = object(value, ["profiles", "selectedId", "appliedRevision", "selectionRevision"], ["selectionError"]);
|
|
59
|
+
if (!Array.isArray(item.profiles) || item.profiles.length > 128)
|
|
60
|
+
fail("profiles");
|
|
61
|
+
return {
|
|
62
|
+
profiles: item.profiles.map((input) => {
|
|
63
|
+
const row = object(input, ["id", "revision"], ["label", "error"]);
|
|
64
|
+
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) };
|
|
65
|
+
}),
|
|
66
|
+
selectedId: item.selectedId === null ? null : id(item.selectedId),
|
|
67
|
+
appliedRevision: item.appliedRevision === null ? null : revision(item.appliedRevision),
|
|
68
|
+
selectionRevision: item.selectionRevision === "unavailable" && Object.hasOwn(item, "selectionError") ? "unavailable" : selectionRevision(item.selectionRevision),
|
|
69
|
+
...optional(item, "selectionError", errorInfo),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function saveRequest(value) {
|
|
73
|
+
const item = object(value, ["id", "content", "expectedRevision"]);
|
|
74
|
+
return { id: id(item.id), content: content(item.content), expectedRevision: item.expectedRevision === null ? null : revision(item.expectedRevision) };
|
|
75
|
+
}
|
|
76
|
+
function selectRequest(value) {
|
|
77
|
+
const item = object(value, ["id", "expectedSelectionRevision"], ["expectedRevision"]);
|
|
78
|
+
const result = { id: item.id === null ? null : id(item.id), expectedSelectionRevision: selectionRevision(item.expectedSelectionRevision), ...optional(item, "expectedRevision", revision) };
|
|
79
|
+
if (result.id !== null && result.expectedRevision === undefined)
|
|
80
|
+
fail("expectedRevision");
|
|
81
|
+
if (result.id === null && result.expectedRevision !== undefined)
|
|
82
|
+
fail("expectedRevision");
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
function codec(symbol, parse) {
|
|
86
|
+
return { mode: "strict", typeSymbol: `@dsmm/dsmm#${symbol}`, create: () => ({ parse }) };
|
|
87
|
+
}
|
|
88
|
+
function descriptor(method, result, parameter) {
|
|
89
|
+
return { id: `@dsmm/dsmm#dsmmProfiles/${method}`, service: "dsmmProfiles", namespace: "dsmmProfiles", method, invocation: { kind: "direct" }, parameters: parameter === undefined ? [] : [{ name: parameter.name, wire: parameter.name, source: "json", codec: parameter.codec }], result };
|
|
90
|
+
}
|
|
91
|
+
/** Explicit strict Host contract; no SRC fallback or browser-supplied authority. */
|
|
92
|
+
export const TYPERT_REMOTE = {
|
|
93
|
+
package: "@dsmm/dsmm",
|
|
94
|
+
descriptors: [
|
|
95
|
+
descriptor("describe", codec("ProfileSnapshot", snapshot)),
|
|
96
|
+
descriptor("read", codec("ProfileReadResult", readResult), { name: "id", codec: codec("ProfileId", id) }),
|
|
97
|
+
descriptor("save", codec("ProfileReadResult", readResult), { name: "request", codec: codec("ProfileSaveRequest", saveRequest) }),
|
|
98
|
+
descriptor("select", codec("ProfileSnapshot", snapshot), { name: "request", codec: codec("ProfileSelectRequest", selectRequest) }),
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
export const TYPERT_HOST = {
|
|
102
|
+
package: "@dsmm/dsmm", face: "host", schemas: [],
|
|
103
|
+
model: { services: [], events: [], objects: [] }, invocations: TYPERT_REMOTE.descriptors,
|
|
104
|
+
};
|
|
105
|
+
export default TYPERT_REMOTE;
|
|
106
|
+
//# sourceMappingURL=profile-remote.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
3
|
+
import type { ProfileReadResult, ProfileSaveRequest, ProfileSelectRequest, ProfileSnapshot } from "./profile-types.js";
|
|
4
|
+
export interface ProfilesBackend {
|
|
5
|
+
describe(): Promise<ProfileSnapshot>;
|
|
6
|
+
read(id: string): Promise<ProfileReadResult>;
|
|
7
|
+
save(request: ProfileSaveRequest): Promise<ProfileReadResult>;
|
|
8
|
+
select(request: ProfileSelectRequest): Promise<ProfileSnapshot>;
|
|
9
|
+
}
|
|
10
|
+
/** Business service addressed only by native Typert Gateway invocations. */
|
|
11
|
+
export declare class DsmmProfilesHost extends TypertRemoteService {
|
|
12
|
+
readonly backend: ProfilesBackend;
|
|
13
|
+
constructor(ctx: Context, backend: ProfilesBackend);
|
|
14
|
+
private invoke;
|
|
15
|
+
describe(): Promise<ProfileSnapshot>;
|
|
16
|
+
read(id: string): Promise<ProfileReadResult>;
|
|
17
|
+
save(request: ProfileSaveRequest): Promise<ProfileReadResult>;
|
|
18
|
+
select(request: ProfileSelectRequest): Promise<ProfileSnapshot>;
|
|
19
|
+
}
|
|
20
|
+
declare module "@deepseek-ai/cordis" {
|
|
21
|
+
interface Context {
|
|
22
|
+
dsmmProfiles: DsmmProfilesHost;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** The caller supplies the owned injection fiber; withdrawal stays native. */
|
|
26
|
+
export declare function registerProfilesRpc(ctx: Context, backend: ProfilesBackend): DsmmProfilesHost;
|
|
27
|
+
//# sourceMappingURL=profile-rpc.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
36
|
+
import { TYPERT_HOST } from "./profile-remote.js";
|
|
37
|
+
import { profileErrorInfo } from "./profiles.js";
|
|
38
|
+
/** Business service addressed only by native Typert Gateway invocations. */
|
|
39
|
+
let DsmmProfilesHost = (() => {
|
|
40
|
+
let _classSuper = TypertRemoteService;
|
|
41
|
+
let _instanceExtraInitializers = [];
|
|
42
|
+
let _describe_decorators;
|
|
43
|
+
let _read_decorators;
|
|
44
|
+
let _save_decorators;
|
|
45
|
+
let _select_decorators;
|
|
46
|
+
return class DsmmProfilesHost extends _classSuper {
|
|
47
|
+
static {
|
|
48
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
49
|
+
_describe_decorators = [Remote];
|
|
50
|
+
_read_decorators = [Remote];
|
|
51
|
+
_save_decorators = [Remote];
|
|
52
|
+
_select_decorators = [Remote];
|
|
53
|
+
__esDecorate(this, null, _describe_decorators, { kind: "method", name: "describe", static: false, private: false, access: { has: obj => "describe" in obj, get: obj => obj.describe }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
54
|
+
__esDecorate(this, null, _read_decorators, { kind: "method", name: "read", static: false, private: false, access: { has: obj => "read" in obj, get: obj => obj.read }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
55
|
+
__esDecorate(this, null, _save_decorators, { kind: "method", name: "save", static: false, private: false, access: { has: obj => "save" in obj, get: obj => obj.save }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
56
|
+
__esDecorate(this, null, _select_decorators, { kind: "method", name: "select", static: false, private: false, access: { has: obj => "select" in obj, get: obj => obj.select }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
57
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
58
|
+
}
|
|
59
|
+
backend = __runInitializers(this, _instanceExtraInitializers);
|
|
60
|
+
constructor(ctx, backend) {
|
|
61
|
+
super(ctx, "dsmmProfiles");
|
|
62
|
+
this.backend = backend;
|
|
63
|
+
}
|
|
64
|
+
async invoke(operation) {
|
|
65
|
+
const invocation = this.ctx.invocation;
|
|
66
|
+
if (invocation === undefined || invocation.peer === undefined) {
|
|
67
|
+
throw new RemoteError("dsmm-profiles/peer-required", "Use Deepwork Profiles through the native Host connection.", {});
|
|
68
|
+
}
|
|
69
|
+
invocation.signal.throwIfAborted();
|
|
70
|
+
try {
|
|
71
|
+
return await operation();
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
throw new RemoteError("dsmm-profiles/refused", "The Host refused the profile operation.", profileErrorInfo(error));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
describe() { return this.invoke(() => this.backend.describe()); }
|
|
78
|
+
read(id) { return this.invoke(() => this.backend.read(id)); }
|
|
79
|
+
save(request) { return this.invoke(() => this.backend.save(request)); }
|
|
80
|
+
select(request) { return this.invoke(() => this.backend.select(request)); }
|
|
81
|
+
};
|
|
82
|
+
})();
|
|
83
|
+
export { DsmmProfilesHost };
|
|
84
|
+
/** The caller supplies the owned injection fiber; withdrawal stays native. */
|
|
85
|
+
export function registerProfilesRpc(ctx, backend) {
|
|
86
|
+
const service = new DsmmProfilesHost(ctx, backend);
|
|
87
|
+
ctx.typert.register(TYPERT_HOST);
|
|
88
|
+
return service;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=profile-rpc.js.map
|