@dsmm/dsmm 0.1.1 → 0.1.5
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 -15
- 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 +66 -11
- package/docs/migration-from-ocmm.md +8 -0
- package/docs/model-routing.md +25 -7
- package/docs/profiles.md +95 -0
- package/docs/releasing.md +66 -19
- package/docs/runtime-recovery.md +39 -14
- package/docs/settings-status.md +13 -5
- package/lib/client/ProfilesSection.d.ts +11 -0
- package/lib/client/ProfilesSection.js +66 -0
- package/lib/client/SessionProfiles.d.ts +19 -0
- package/lib/client/SessionProfiles.js +24 -0
- package/lib/client/StructuredEditor.d.ts +11 -0
- package/lib/client/StructuredEditor.js +74 -0
- package/lib/client/controller.d.ts +115 -0
- package/lib/client/controller.js +340 -0
- package/lib/client/index.d.ts +13 -0
- package/lib/client/index.js +54 -0
- package/lib/client/locales.d.ts +145 -0
- package/lib/client/locales.js +91 -0
- package/lib/client/session-labels.d.ts +8 -0
- package/lib/client/session-labels.js +13 -0
- package/lib/client/structured.d.ts +18 -0
- package/lib/client/structured.js +98 -0
- package/lib/client/styles.d.ts +3 -0
- package/lib/client/styles.js +36 -0
- package/lib/client.js +2825 -0
- package/lib/commands.d.ts +3 -3
- package/lib/commands.js +5 -4
- package/lib/dsh-types.d.ts +20 -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 +98 -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 +100 -15
- package/lib/preset-registry.js +5 -3
- package/lib/profile-remote.d.ts +37 -0
- package/lib/profile-remote.js +219 -0
- package/lib/profile-rpc.d.ts +35 -0
- package/lib/profile-rpc.js +187 -0
- package/lib/profile-runtime.d.ts +63 -0
- package/lib/profile-runtime.js +310 -0
- package/lib/profile-store.d.ts +60 -0
- package/lib/profile-store.js +588 -0
- package/lib/profile-types.d.ts +80 -0
- package/lib/profile-types.js +2 -0
- package/lib/profiles.d.ts +26 -0
- package/lib/profiles.js +269 -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 +49 -6
- package/lib/role-routing.d.ts +37 -3
- package/lib/role-routing.js +110 -35
- 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/routing-policy.d.ts +32 -0
- package/lib/routing-policy.js +92 -0
- package/lib/runtime-recovery.d.ts +2 -2
- package/lib/runtime-recovery.js +215 -54
- 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 +34 -1
- package/lib/settings.js +33 -7
- package/lib/state.d.ts +1 -0
- package/lib/state.js +4 -0
- package/lib/status.d.ts +9 -1
- package/lib/status.js +34 -12
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +66 -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
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export const NS = "settings.dsmm-profiles";
|
|
2
|
+
export const en = {
|
|
3
|
+
title: "Deepwork Profiles", description: "Save independent runtime configurations and choose which one new sessions use.",
|
|
4
|
+
newSessions: "Global apply and reset affect future unscoped sessions only. Current-session actions below are separate. A cold resume retains an explicit saved session choice; otherwise it inherits the global default.",
|
|
5
|
+
editorSelect: "Profile to edit", choose: "Choose a profile", newDraft: "New unsaved profile", new: "New profile",
|
|
6
|
+
profileId: "Profile ID (name)", idHint: "Use 1–64 lowercase letters, digits, hyphens or underscores. The ID cannot be changed after saving. Add an optional display label in the JSONC document.",
|
|
7
|
+
configuration: "Runtime configuration (JSONC)", configurationHint: "Document: version 1, matching id, optional label, and settings. Supported runtime settings: defaultActive, roleRouting, workflow, guards, runtimeRecovery, and both DeepSeek families’ calibration, default-effort and max-preset policies.",
|
|
8
|
+
structuralHint: "Roles, skills, mode names, prompt order/content, preset installation, LSP, providers and accounts belong in native deployment configuration, not profiles. Routing may reference an existing provider; never paste credentials.",
|
|
9
|
+
save: "Save profile", saving: "Saving profile…", apply: "Apply saved profile", applying: "Applying profile…", reset: "Reset to baseline", resetting: "Resetting to baseline…",
|
|
10
|
+
refresh: "Refresh profiles", refreshing: "Refreshing profiles…", reload: "Reload saved profile", loading: "Loading profiles…", reading: "Reading profile…",
|
|
11
|
+
empty: "No saved profiles yet. Create a profile to start; the deployment baseline remains applied.",
|
|
12
|
+
baseline: "Applied to new sessions: deployment baseline.", appliedProfile: "Applied to new sessions: {id} (revision {revision}).",
|
|
13
|
+
appliedInvalid: "The stored selection cannot be confirmed. Existing sessions remain unchanged. Resolve the Host diagnostic before applying or resetting a profile.",
|
|
14
|
+
selectionConflict: "The stored selection changed outside this Host. This Host still uses the policy shown above for new sessions. Apply a saved profile or reset to baseline to reconcile it; restarting adopts the stored selection. Existing sessions stay unchanged.",
|
|
15
|
+
dirty: "Unsaved changes. Save before applying; saving alone does not apply this profile.", savedNotApplied: "Saved profile; this revision is not applied to new sessions.", savedApplied: "This saved revision is applied to new sessions.",
|
|
16
|
+
saved: "Saved {id}. The applied policy was not changed.", applied: "Applied {id} for new sessions. Existing sessions were not changed.", resetDone: "Reset to the deployment baseline for new sessions. Existing sessions were not changed.",
|
|
17
|
+
discardPrompt: "Discard the unsaved draft before changing the editor?", discard: "Discard changes", cancel: "Cancel",
|
|
18
|
+
conflict: "The saved file or selection changed elsewhere. Your draft and the prior selection were kept. Refresh profiles, then reload the saved profile or review your draft before retrying.",
|
|
19
|
+
validation: "This profile is not valid. Correct the field below; your draft is unchanged.",
|
|
20
|
+
io: "The Host could not commit this operation. Your draft and the prior selection were kept. Check profile storage access, refresh, then retry.",
|
|
21
|
+
unavailable: "The native profile service is unavailable. Your draft is kept. Refresh after the Host reconnects or Deepwork is enabled.",
|
|
22
|
+
transport: "The native connection could not confirm this operation. Your draft is kept. Refresh the Host state before retrying; do not assume a save or apply completed.",
|
|
23
|
+
invalidProfile: "Unavailable profile: {id}", details: "Host diagnostic", retry: "Resolve the diagnostic, refresh profiles, then retry.",
|
|
24
|
+
globalScope: "Global default for future sessions", sessionScope: "Current native session", sessionSelect: "Current-session profile",
|
|
25
|
+
globalActionHint: "Apply saved profile below changes the global default for future unscoped sessions only. It does not apply to the current session.",
|
|
26
|
+
noSession: "No native session is selected. Session Apply is disabled; global defaults and drafts remain editable.",
|
|
27
|
+
sessionUnavailable: "The current session could not be confirmed. Refresh its state before retrying; the prior policy is kept.",
|
|
28
|
+
sessionBusy: "Switching is unavailable: {reason}. The Host must reserve a truly idle ordinary session before applying.",
|
|
29
|
+
sessionState: "Session {id}: {profile}; scope {scope}; admission epoch {epoch}.", sessionBaseline: "deployment baseline",
|
|
30
|
+
sessionGlobalCaptured: "captured global default (no explicit session override)",
|
|
31
|
+
sessionAdmittedProfile: "{id} (revision {revision})", sessionFutureDefault: "Global default for future unscoped sessions: {profile}. This does not change this session's admission.",
|
|
32
|
+
sessionConflict: "The session selection or admission epoch changed elsewhere. The prior display and draft are kept. Refresh current-session state before applying again.",
|
|
33
|
+
sessionApply: "Apply profile to current session", sessionApplying: "Applying current-session profile…", sessionReset: "Pin baseline for current session", sessionResetting: "Pinning current-session baseline…", sessionRefresh: "Refresh current-session state",
|
|
34
|
+
sessionApplied: "Applied the saved revision to this session only. Global default and existing children were not changed.", sessionResetDone: "Pinned the deployment baseline for this session only. Global default was not changed.",
|
|
35
|
+
sessionDirty: "Save or explicitly discard the editor draft before applying a current-session choice.",
|
|
36
|
+
roleState: "Admitted route {route}; strategy {strategy}; retries {retries}; rate-limit failures {failures}; switches {switches}; total delay {delay} ms.",
|
|
37
|
+
catalogTitle: "Native model catalog", catalogHint: "Catalog listings are advisory, not network or account health checks. Unlisted/manual routes stay editable; refresh never changes the draft or native model default.",
|
|
38
|
+
catalogUnavailable: "The native catalog is unavailable. Manual provider/model/effort fields and advanced JSONC remain available.", catalogRefresh: "Refresh model catalog", catalogRefreshing: "Refreshing model catalog…", catalogFailure: "Provider catalog unavailable: {name} ({id}).",
|
|
39
|
+
profileLabel: "Profile display label", defaultActive: "Default Deepwork mode", activeHint: "This default does not erase an explicit saved session mode.", enabled: "Enabled", disabled: "Disabled", inherit: "Inherit deployment baseline",
|
|
40
|
+
profileDefaults: "Profile runtime defaults", roleSelect: "Agent role to edit", rolesUnavailable: "Native role inventory unavailable — use advanced JSONC", roleEnabled: "Enabled in the native deployment", roleDisabled: "Disabled in the native deployment",
|
|
41
|
+
strategy: "{name} strategy", inheritStrategy: "Inherit ({value})", startupLock: "startup-lock — keep the admitted route", rateFallback: "rate-limit-fallback — ordered rollover at threshold",
|
|
42
|
+
strategyHint: "Both strategies use finite, positively no-output-safe RATE_LIMIT retries. Generic, auth and quota failures do not authorize a model switch. Blank numeric fields inherit; zero is an explicit value.",
|
|
43
|
+
retryField: "{name} {field}", inheritNumber: "Inherit {value}", retryBounds: "Integer {min}–{max}; inherited value {value}.", unknownDefault: "unavailable",
|
|
44
|
+
retryCount: "retry count", initialDelay: "initial delay (ms)", maxDelay: "maximum delay (ms)", totalWait: "total wait budget (ms)", switchThreshold: "rate-limit failures before switch", maxSwitches: "maximum switches",
|
|
45
|
+
primaryMode: "{name} primary route", inheritRoute: "Inherit native/deployment route", configuredRoute: "Configure primary route", primaryName: "{name} primary",
|
|
46
|
+
fallbackMode: "{name} fallback chain", inheritChain: "Inherit deployment fallback chain", configuredChain: "Explicit ordered fallback chain", emptyChain: "Explicitly empty chain: no configured fallback routes.", fallbackName: "{name} fallback {index}", addFallback: "Add fallback for {name}", removeFallback: "Remove {name}", moveUp: "Move up {name}", moveDown: "Move down {name}",
|
|
47
|
+
routeProvider: "{name} provider", routeModel: "{name} model", routeEffort: "{name} exact effort", manualProvider: "{name} manual provider", manualModel: "{name} manual model", manualEffort: "{name} manual exact effort", manual: "Enter manual identifier", manualValue: "Manual / unlisted: {value}", unset: "not set", effortDefault: "Native default (omit exact effort)", effortChangeHint: "Changing a provider/model explicitly clears that route's exact effort. Catalog refresh preserves all configured values; choose an exact effort again if required.",
|
|
48
|
+
advanced: "Advanced JSONC", rawInvalid: "Structured editing is unavailable for this invalid raw draft. Correct Advanced JSONC; no fields, comments or bytes have been normalized.", invalidNumber: "Correct this bounded integer before saving or changing roles. The invalid value has not replaced the saved draft policy.",
|
|
49
|
+
};
|
|
50
|
+
export const zh = {
|
|
51
|
+
title: "Deepwork 配置档", description: "保存独立的运行时配置,并选择新会话使用的配置档。",
|
|
52
|
+
newSessions: "全局应用和重置仅影响之后没有独立选择的新会话。下方当前会话操作相互独立。冷恢复保留明确保存的会话选择,否则继承全局默认值。",
|
|
53
|
+
editorSelect: "要编辑的配置档", choose: "选择配置档", newDraft: "新的未保存配置档", new: "新建配置档",
|
|
54
|
+
profileId: "配置档 ID(名称)", idHint: "使用 1–64 个小写字母、数字、连字符或下划线。保存后不能修改 ID。可在 JSONC 文档中添加可选的显示名称 label。",
|
|
55
|
+
configuration: "运行时配置(JSONC)", configurationHint: "文档包含 version: 1、相同的 id、可选 label 和 settings。支持 defaultActive、roleRouting、workflow、guards、runtimeRecovery,以及两个 DeepSeek 系列的校准、默认推理强度和最高强度预设策略。",
|
|
56
|
+
structuralHint: "角色、技能、模式名称、提示顺序或内容、预设安装、LSP、提供商和账户由原生部署配置管理,不属于配置档。路由可引用已有提供商;请勿粘贴凭证。",
|
|
57
|
+
save: "保存配置档", saving: "正在保存配置档…", apply: "应用已保存配置档", applying: "正在应用配置档…", reset: "重置为基线", resetting: "正在重置为基线…",
|
|
58
|
+
refresh: "刷新配置档", refreshing: "正在刷新配置档…", reload: "重新加载已保存配置档", loading: "正在加载配置档…", reading: "正在读取配置档…",
|
|
59
|
+
empty: "尚无已保存的配置档。可新建配置档;当前仍应用部署基线。",
|
|
60
|
+
baseline: "新会话使用:部署基线。", appliedProfile: "新会话使用:{id}(修订 {revision})。",
|
|
61
|
+
appliedInvalid: "无法确认保存的选择。已有会话未改变。请先解决 Host 诊断,再应用或重置配置档。",
|
|
62
|
+
selectionConflict: "保存的选择已被此 Host 之外的操作修改。此 Host 的新会话仍使用上方策略。请应用已保存配置档或重置为基线以协调选择;重启将采用保存的选择。已有会话未改变。",
|
|
63
|
+
dirty: "有未保存的更改。请先保存再应用;仅保存不会应用此配置档。", savedNotApplied: "已保存;此修订尚未应用到新会话。", savedApplied: "此已保存修订已应用到新会话。",
|
|
64
|
+
saved: "已保存 {id},未改变已应用的策略。", applied: "已为新会话应用 {id},已有会话未改变。", resetDone: "已为新会话重置为部署基线,已有会话未改变。",
|
|
65
|
+
discardPrompt: "切换编辑器之前,是否丢弃未保存的草稿?", discard: "丢弃更改", cancel: "取消",
|
|
66
|
+
conflict: "已保存文件或选择已被其他操作修改。草稿和原选择已保留。请刷新配置档,然后重新加载已保存配置档或检查草稿后重试。",
|
|
67
|
+
validation: "此配置档无效。请修正下方字段;草稿未改变。",
|
|
68
|
+
io: "Host 无法提交此操作。草稿和原选择已保留。请检查配置档存储权限,刷新后重试。",
|
|
69
|
+
unavailable: "原生配置档服务不可用。草稿已保留。Host 重新连接或启用 Deepwork 后请刷新。",
|
|
70
|
+
transport: "原生连接无法确认此操作。草稿已保留。重试之前请刷新 Host 状态;不要假定保存或应用已完成。",
|
|
71
|
+
invalidProfile: "不可用配置档:{id}", details: "Host 诊断", retry: "请解决诊断问题,刷新配置档后重试。",
|
|
72
|
+
globalScope: "未来会话的全局默认值", sessionScope: "当前原生会话", sessionSelect: "当前会话配置档",
|
|
73
|
+
globalActionHint: "下方应用已保存配置档仅改变未来没有独立选择的会话的全局默认值,不会应用到当前会话。",
|
|
74
|
+
noSession: "未选择原生会话。会话应用已禁用;仍可编辑全局默认值和草稿。", sessionUnavailable: "无法确认当前会话。重试前请刷新状态;原策略已保留。", sessionBusy: "暂不可切换:{reason}。Host 必须先保留真正空闲的普通会话。", sessionState: "会话 {id}:{profile};范围 {scope};准入代次 {epoch}。", sessionBaseline: "部署基线",
|
|
75
|
+
sessionGlobalCaptured: "已捕获的全局默认值(没有明确会话覆盖)",
|
|
76
|
+
sessionAdmittedProfile: "{id}(修订 {revision})", sessionFutureDefault: "未来没有独立选择的会话的全局默认值:{profile}。这不会改变当前会话的准入。",
|
|
77
|
+
sessionConflict: "会话选择或准入代次已在其他位置改变。原显示和草稿已保留。再次应用前请刷新当前会话状态。",
|
|
78
|
+
sessionApply: "应用配置档到当前会话", sessionApplying: "正在应用当前会话配置档…", sessionReset: "为当前会话固定基线", sessionResetting: "正在固定当前会话基线…", sessionRefresh: "刷新当前会话状态", sessionApplied: "已仅对此会话应用保存的修订。全局默认值和已有子会话未改变。", sessionResetDone: "已仅对此会话固定部署基线。全局默认值未改变。", sessionDirty: "应用当前会话选择之前,请保存或明确丢弃编辑器草稿。",
|
|
79
|
+
roleState: "准入路由 {route};策略 {strategy};重试 {retries};限流失败 {failures};切换 {switches};累计延迟 {delay} 毫秒。",
|
|
80
|
+
catalogTitle: "原生模型目录", catalogHint: "目录仅供参考,不是网络或账户健康检查。未列出或手动路由仍可编辑;刷新不会改变草稿或原生模型默认值。", catalogUnavailable: "原生模型目录不可用。仍可使用手动提供商、模型、强度字段和高级 JSONC。", catalogRefresh: "刷新模型目录", catalogRefreshing: "正在刷新模型目录…", catalogFailure: "提供商目录不可用:{name}({id})。",
|
|
81
|
+
profileLabel: "配置档显示名称", defaultActive: "默认 Deepwork 模式", activeHint: "此默认值不会抹除已明确保存的会话模式。", enabled: "启用", disabled: "禁用", inherit: "继承部署基线", profileDefaults: "配置档运行时默认值", roleSelect: "要编辑的 Agent 角色", rolesUnavailable: "原生角色列表不可用,请使用高级 JSONC", roleEnabled: "原生部署中已启用", roleDisabled: "原生部署中已禁用",
|
|
82
|
+
strategy: "{name} 策略", inheritStrategy: "继承({value})", startupLock: "startup-lock — 保留准入路由", rateFallback: "rate-limit-fallback — 达到阈值后按顺序切换", strategyHint: "两种策略均使用有限且已证明无输出的 RATE_LIMIT 重试。普通、认证或配额失败不允许切换模型。数字留空表示继承,零是明确值。", retryField: "{name} {field}", inheritNumber: "继承 {value}", retryBounds: "整数 {min}–{max};继承值 {value}。", unknownDefault: "不可用",
|
|
83
|
+
retryCount: "重试次数", initialDelay: "初始延迟(毫秒)", maxDelay: "最大单次延迟(毫秒)", totalWait: "累计等待上限(毫秒)", switchThreshold: "切换前的限流失败次数", maxSwitches: "最大切换次数",
|
|
84
|
+
primaryMode: "{name} 主路由", inheritRoute: "继承原生或部署路由", configuredRoute: "配置主路由", primaryName: "{name} 主路由", fallbackMode: "{name} 备用链", inheritChain: "继承部署备用链", configuredChain: "明确的有序备用链", emptyChain: "明确为空的备用链:没有已配置备用路由。", fallbackName: "{name} 备用 {index}", addFallback: "为 {name} 添加备用路由", removeFallback: "移除 {name}", moveUp: "上移 {name}", moveDown: "下移 {name}",
|
|
85
|
+
routeProvider: "{name} 提供商", routeModel: "{name} 模型", routeEffort: "{name} 精确强度", manualProvider: "{name} 手动提供商", manualModel: "{name} 手动模型", manualEffort: "{name} 手动精确强度", manual: "输入手动标识", manualValue: "手动或未列出:{value}", unset: "未设置", effortDefault: "原生默认值(省略精确强度)", effortChangeHint: "明确更改提供商或模型会清除该路由的精确强度。刷新目录会保留所有配置值;需要时请重新选择精确强度。", advanced: "高级 JSONC", rawInvalid: "原始草稿无效,暂不可结构化编辑。请修正高级 JSONC;字段、注释和字节均未自动规范化。", invalidNumber: "保存或切换角色之前,请修正此有界整数。无效值尚未替换草稿中的策略。",
|
|
86
|
+
};
|
|
87
|
+
export const RETRY_FIELD_LABEL_KEYS = {
|
|
88
|
+
maxRetries: "retryCount", initialDelayMs: "initialDelay", maxDelayMs: "maxDelay",
|
|
89
|
+
maxTotalDelayMs: "totalWait", switchAfterRateLimits: "switchThreshold", maxSwitches: "maxSwitches",
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=locales.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
|
|
2
|
+
import type { SessionProfileSnapshot } from "../profile-types.js";
|
|
3
|
+
/** Presentation only: admitted identity never substitutes for sidecar CAS. */
|
|
4
|
+
export declare function sessionProfileLabels(session: SessionProfileSnapshot, t: PropsLocale<"settings.dsmm-profiles">["t"]): {
|
|
5
|
+
admitted: string;
|
|
6
|
+
futureDefault: string;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=session-labels.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Presentation only: admitted identity never substitutes for sidecar CAS. */
|
|
2
|
+
export function sessionProfileLabels(session, t) {
|
|
3
|
+
const admitted = session.admittedSelection;
|
|
4
|
+
const profile = admitted === undefined && session.scope === "global-default" ? t("sessionGlobalCaptured")
|
|
5
|
+
: (admitted ?? session.selection).selectedId === null ? t("sessionBaseline")
|
|
6
|
+
: t("sessionAdmittedProfile", { id: (admitted ?? session.selection).selectedId, revision: (admitted ?? session.selection).appliedRevision?.slice(0, 12) ?? "—" });
|
|
7
|
+
const future = session.globalDefault;
|
|
8
|
+
return {
|
|
9
|
+
admitted: t("sessionState", { id: session.sessionId, profile, scope: session.scope, epoch: session.admissionEpoch }),
|
|
10
|
+
futureDefault: t("sessionFutureDefault", { profile: future.selectedId === null ? t("sessionBaseline") : t("sessionAdmittedProfile", { id: future.selectedId, revision: future.appliedRevision?.slice(0, 12) ?? "—" }) }),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=session-labels.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DsmmRoleRoutingConfig } from "../settings.js";
|
|
2
|
+
import type { DsmmRateLimitPolicy, DsmmRuntimePolicySettings } from "../routing-policy.js";
|
|
3
|
+
export type JsonPath = (string | number)[];
|
|
4
|
+
export interface StructuredDocument {
|
|
5
|
+
label?: string;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
roleRouting: Record<string, DsmmRoleRoutingConfig>;
|
|
8
|
+
runtimePolicy: {
|
|
9
|
+
strategy?: DsmmRuntimePolicySettings["strategy"];
|
|
10
|
+
rateLimit?: Partial<DsmmRateLimitPolicy>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/** Read-only projection. Malformed raw drafts cannot be rewritten by the form. */
|
|
14
|
+
export declare function structuredDocument(content: string): StructuredDocument | null;
|
|
15
|
+
/** Only the named path changes; comments/unrelated raw JSONC remain untouched. */
|
|
16
|
+
export declare function editStructuredPath(content: string, path: JsonPath, value: unknown): string | null;
|
|
17
|
+
export declare function moveFallback(content: string, role: string, from: number, to: number): string | null;
|
|
18
|
+
//# sourceMappingURL=structured.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { applyEdits, findNodeAtLocation, modify, parse, parseTree } from "jsonc-parser";
|
|
2
|
+
import { normalizeRateLimitOverrides, normalizeRoutingStrategy } from "../routing-policy.js";
|
|
3
|
+
function record(value) {
|
|
4
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
function route(value) {
|
|
7
|
+
return record(value) && typeof value.provider === "string" && typeof value.model === "string"
|
|
8
|
+
&& (value.reasoningEffort === undefined || typeof value.reasoningEffort === "string")
|
|
9
|
+
&& Object.keys(value).every((key) => ["provider", "model", "reasoningEffort"].includes(key));
|
|
10
|
+
}
|
|
11
|
+
function validTree(node, depth = 0) {
|
|
12
|
+
if (depth > 32)
|
|
13
|
+
return false;
|
|
14
|
+
if (node.type === "object") {
|
|
15
|
+
const seen = new Set();
|
|
16
|
+
for (const property of node.children ?? []) {
|
|
17
|
+
const key = property.children?.[0]?.value;
|
|
18
|
+
if (typeof key !== "string" || seen.has(key) || ["__proto__", "prototype", "constructor"].includes(key))
|
|
19
|
+
return false;
|
|
20
|
+
seen.add(key);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return (node.children ?? []).every((child) => validTree(child, depth + 1));
|
|
24
|
+
}
|
|
25
|
+
/** Read-only projection. Malformed raw drafts cannot be rewritten by the form. */
|
|
26
|
+
export function structuredDocument(content) {
|
|
27
|
+
const errors = [];
|
|
28
|
+
const tree = parseTree(content, errors, { allowTrailingComma: true });
|
|
29
|
+
if (errors.length !== 0 || tree === undefined || !validTree(tree))
|
|
30
|
+
return null;
|
|
31
|
+
const document = parse(content, errors, { allowTrailingComma: true });
|
|
32
|
+
if (errors.length !== 0 || !record(document) || document.version !== 1 || typeof document.id !== "string"
|
|
33
|
+
|| !record(document.settings) || (document.label !== undefined && typeof document.label !== "string"))
|
|
34
|
+
return null;
|
|
35
|
+
const settings = document.settings;
|
|
36
|
+
if (settings.defaultActive !== undefined && typeof settings.defaultActive !== "boolean")
|
|
37
|
+
return null;
|
|
38
|
+
if (settings.roleRouting !== undefined && !record(settings.roleRouting))
|
|
39
|
+
return null;
|
|
40
|
+
if (settings.runtimePolicy !== undefined && !record(settings.runtimePolicy))
|
|
41
|
+
return null;
|
|
42
|
+
const runtimePolicy = settings.runtimePolicy ?? {};
|
|
43
|
+
const policies = settings.roleRouting ?? {};
|
|
44
|
+
try {
|
|
45
|
+
if (Object.keys(runtimePolicy).some((key) => key !== "strategy" && key !== "rateLimit"))
|
|
46
|
+
return null;
|
|
47
|
+
if (runtimePolicy.strategy !== undefined)
|
|
48
|
+
normalizeRoutingStrategy(runtimePolicy.strategy);
|
|
49
|
+
if (runtimePolicy.rateLimit !== undefined)
|
|
50
|
+
normalizeRateLimitOverrides(runtimePolicy.rateLimit);
|
|
51
|
+
for (const raw of Object.values(policies)) {
|
|
52
|
+
if (!record(raw) || Object.keys(raw).some((key) => !["primary", "fallbackRoutes", "strategy", "rateLimit"].includes(key)))
|
|
53
|
+
return null;
|
|
54
|
+
if (raw.primary !== undefined && !route(raw.primary))
|
|
55
|
+
return null;
|
|
56
|
+
if (raw.fallbackRoutes !== undefined && (!Array.isArray(raw.fallbackRoutes) || raw.fallbackRoutes.length > 32 || !raw.fallbackRoutes.every(route)))
|
|
57
|
+
return null;
|
|
58
|
+
if (raw.strategy !== undefined)
|
|
59
|
+
normalizeRoutingStrategy(raw.strategy);
|
|
60
|
+
if (raw.rateLimit !== undefined)
|
|
61
|
+
normalizeRateLimitOverrides(raw.rateLimit);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return { label: document.label, settings, roleRouting: policies, runtimePolicy };
|
|
68
|
+
}
|
|
69
|
+
/** Only the named path changes; comments/unrelated raw JSONC remain untouched. */
|
|
70
|
+
export function editStructuredPath(content, path, value) {
|
|
71
|
+
if (structuredDocument(content) === null)
|
|
72
|
+
return null;
|
|
73
|
+
try {
|
|
74
|
+
return applyEdits(content, modify(content, path, value, { formattingOptions: { insertSpaces: true, tabSize: 2 } }));
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export function moveFallback(content, role, from, to) {
|
|
81
|
+
const document = structuredDocument(content);
|
|
82
|
+
const chain = document?.roleRouting[role]?.fallbackRoutes;
|
|
83
|
+
if (chain === undefined || from < 0 || from >= chain.length || to < 0 || to >= chain.length)
|
|
84
|
+
return null;
|
|
85
|
+
// Move the original object text, not parsed/serialized values, so even the
|
|
86
|
+
// edited rows retain their internal comments and manual identifier spelling.
|
|
87
|
+
const low = Math.min(from, to), high = Math.max(from, to);
|
|
88
|
+
const tree = parseTree(content);
|
|
89
|
+
if (tree === undefined)
|
|
90
|
+
return null;
|
|
91
|
+
const nodes = chain.map((_, index) => findNodeAtLocation(tree, ["settings", "roleRouting", role, "fallbackRoutes", index]));
|
|
92
|
+
if (nodes.some((node) => node === undefined))
|
|
93
|
+
return null;
|
|
94
|
+
const order = nodes.map((node) => content.slice(node.offset, node.offset + node.length));
|
|
95
|
+
order.splice(to, 0, order.splice(from, 1)[0]);
|
|
96
|
+
return applyEdits(content, nodes.slice(low, high + 1).map((node, offset) => ({ offset: node.offset, length: node.length, content: order[low + offset] })));
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=structured.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Geometry and theme aliases extracted in dsmm/DESIGN.md; scoped to this section. */
|
|
2
|
+
export declare const PROFILE_STYLES = "\n.dsmm-profiles{width:100%;max-width:760px;min-width:0;display:flex;flex-direction:column;gap:12px;font-family:var(--dsw-font-family);font-size:14px;line-height:22px;color:var(--dsw-alias-label-primary)}\n.dsmm-profiles h2{margin:0;font-size:18px;font-weight:600}\n.dsmm-profiles h3,.dsmm-profiles legend{margin:0;font-size:14px;font-weight:500;line-height:22px}\n.dsmm-profiles :is(label,legend,summary){min-width:0;max-width:100%;overflow-wrap:anywhere}\n.dsmm-profiles :is(.dsmm-structured,.dsmm-session-scope,.dsmm-catalog,.dsmm-policy-fields){min-width:0;display:flex;flex-direction:column;gap:12px}\n.dsmm-profiles fieldset{min-width:0;margin:0;padding:12px;border:1px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);display:flex;flex-direction:column;gap:12px}\n.dsmm-profiles .dsmm-route-fields{display:flex;flex-wrap:wrap;gap:12px;min-width:0}\n.dsmm-profiles .dsmm-route-fields>.dsmm-field{flex:1 1 240px;max-width:100%}\n.dsmm-profiles .dsmm-route-fields select{width:100%}\n.dsmm-profiles summary{cursor:pointer;color:var(--dsw-alias-label-primary);min-height:32px;line-height:32px}\n.dsmm-profiles summary:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}\n.dsmm-profiles .dsmm-advanced[open]>div{margin-top:8px}\n.dsmm-header-profiles{width:auto;max-width:760px}\n.dsmm-profiles p{margin:0;overflow-wrap:anywhere}\n.dsmm-profiles .dsmm-hint{color:var(--dsw-alias-label-secondary)}\n.dsmm-profiles .dsmm-field{min-width:0;display:flex;flex-direction:column;gap:6px}\n.dsmm-profiles .dsmm-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}\n.dsmm-profiles button{max-width:100%;white-space:normal;overflow-wrap:anywhere;min-height:36px;height:auto}\n.dsmm-profiles .dsmm-input{width:100%;min-width:0;box-sizing:border-box;border-color:var(--dsw-alias-label-secondary)}\n.dsmm-profiles .dsmm-input input{width:100%;min-width:0;font:inherit;color:inherit}\n.dsmm-profiles select,.dsmm-profiles textarea{box-sizing:border-box;min-width:0;max-width:100%;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-label-secondary);border-radius:var(--dsw-radius-md)}\n.dsmm-profiles select{width:240px;height:32px;padding:0 10px;text-overflow:ellipsis}\n.dsmm-profiles textarea{width:100%;padding:12px;font-family:var(--ds-font-family-code);resize:vertical;overflow:auto;white-space:pre;}\n.dsmm-profiles select:hover:not(:disabled),.dsmm-profiles textarea:hover:not(:disabled){border-color:var(--dsw-alias-label-primary)}\n.dsmm-profiles select:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active)}\n.dsmm-profiles :is(select,textarea,button):focus-visible,.dsmm-profiles .dsmm-input:has(input:focus-visible){outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}\n.dsmm-profiles :is(select,textarea):disabled{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-module-platform);cursor:not-allowed}\n.dsmm-profiles .dsmm-editor,.dsmm-profiles .dsmm-confirm{min-width:0;display:flex;flex-direction:column;gap:12px;padding:16px;border:1px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform)}\n.dsmm-profiles .dsmm-issue{padding:12px;border-left:4px solid var(--dsw-alias-state-error-primary);color:var(--dsw-alias-label-primary);overflow-wrap:anywhere}\n.dsmm-profiles .dsmm-issue p+p{margin-top:8px}\n.dsmm-profiles .dsmm-status{min-height:22px}\n@media(prefers-reduced-motion:reduce){.dsmm-profiles *{transition:none!important;animation:none!important}}\n";
|
|
3
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Geometry and theme aliases extracted in dsmm/DESIGN.md; scoped to this section. */
|
|
2
|
+
export const PROFILE_STYLES = `
|
|
3
|
+
.dsmm-profiles{width:100%;max-width:760px;min-width:0;display:flex;flex-direction:column;gap:12px;font-family:var(--dsw-font-family);font-size:14px;line-height:22px;color:var(--dsw-alias-label-primary)}
|
|
4
|
+
.dsmm-profiles h2{margin:0;font-size:18px;font-weight:600}
|
|
5
|
+
.dsmm-profiles h3,.dsmm-profiles legend{margin:0;font-size:14px;font-weight:500;line-height:22px}
|
|
6
|
+
.dsmm-profiles :is(label,legend,summary){min-width:0;max-width:100%;overflow-wrap:anywhere}
|
|
7
|
+
.dsmm-profiles :is(.dsmm-structured,.dsmm-session-scope,.dsmm-catalog,.dsmm-policy-fields){min-width:0;display:flex;flex-direction:column;gap:12px}
|
|
8
|
+
.dsmm-profiles fieldset{min-width:0;margin:0;padding:12px;border:1px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);display:flex;flex-direction:column;gap:12px}
|
|
9
|
+
.dsmm-profiles .dsmm-route-fields{display:flex;flex-wrap:wrap;gap:12px;min-width:0}
|
|
10
|
+
.dsmm-profiles .dsmm-route-fields>.dsmm-field{flex:1 1 240px;max-width:100%}
|
|
11
|
+
.dsmm-profiles .dsmm-route-fields select{width:100%}
|
|
12
|
+
.dsmm-profiles summary{cursor:pointer;color:var(--dsw-alias-label-primary);min-height:32px;line-height:32px}
|
|
13
|
+
.dsmm-profiles summary:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
|
|
14
|
+
.dsmm-profiles .dsmm-advanced[open]>div{margin-top:8px}
|
|
15
|
+
.dsmm-header-profiles{width:auto;max-width:760px}
|
|
16
|
+
.dsmm-profiles p{margin:0;overflow-wrap:anywhere}
|
|
17
|
+
.dsmm-profiles .dsmm-hint{color:var(--dsw-alias-label-secondary)}
|
|
18
|
+
.dsmm-profiles .dsmm-field{min-width:0;display:flex;flex-direction:column;gap:6px}
|
|
19
|
+
.dsmm-profiles .dsmm-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
|
|
20
|
+
.dsmm-profiles button{max-width:100%;white-space:normal;overflow-wrap:anywhere;min-height:36px;height:auto}
|
|
21
|
+
.dsmm-profiles .dsmm-input{width:100%;min-width:0;box-sizing:border-box;border-color:var(--dsw-alias-label-secondary)}
|
|
22
|
+
.dsmm-profiles .dsmm-input input{width:100%;min-width:0;font:inherit;color:inherit}
|
|
23
|
+
.dsmm-profiles select,.dsmm-profiles textarea{box-sizing:border-box;min-width:0;max-width:100%;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-label-secondary);border-radius:var(--dsw-radius-md)}
|
|
24
|
+
.dsmm-profiles select{width:240px;height:32px;padding:0 10px;text-overflow:ellipsis}
|
|
25
|
+
.dsmm-profiles textarea{width:100%;padding:12px;font-family:var(--ds-font-family-code);resize:vertical;overflow:auto;white-space:pre;}
|
|
26
|
+
.dsmm-profiles select:hover:not(:disabled),.dsmm-profiles textarea:hover:not(:disabled){border-color:var(--dsw-alias-label-primary)}
|
|
27
|
+
.dsmm-profiles select:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active)}
|
|
28
|
+
.dsmm-profiles :is(select,textarea,button):focus-visible,.dsmm-profiles .dsmm-input:has(input:focus-visible){outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
|
|
29
|
+
.dsmm-profiles :is(select,textarea):disabled{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-module-platform);cursor:not-allowed}
|
|
30
|
+
.dsmm-profiles .dsmm-editor,.dsmm-profiles .dsmm-confirm{min-width:0;display:flex;flex-direction:column;gap:12px;padding:16px;border:1px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform)}
|
|
31
|
+
.dsmm-profiles .dsmm-issue{padding:12px;border-left:4px solid var(--dsw-alias-state-error-primary);color:var(--dsw-alias-label-primary);overflow-wrap:anywhere}
|
|
32
|
+
.dsmm-profiles .dsmm-issue p+p{margin-top:8px}
|
|
33
|
+
.dsmm-profiles .dsmm-status{min-height:22px}
|
|
34
|
+
@media(prefers-reduced-motion:reduce){.dsmm-profiles *{transition:none!important;animation:none!important}}
|
|
35
|
+
`;
|
|
36
|
+
//# sourceMappingURL=styles.js.map
|