@dsmm/dsmm 0.3.26 → 0.3.28

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.
Files changed (50) hide show
  1. package/README.md +21 -8
  2. package/docs/agent-presets.md +7 -7
  3. package/docs/agent-teams.md +27 -0
  4. package/docs/compatibility.md +7 -7
  5. package/docs/lsp.md +10 -12
  6. package/docs/maintenance.md +29 -0
  7. package/docs/roadmap.md +25 -9
  8. package/docs/runtime-recovery.md +3 -3
  9. package/docs/testing.md +3 -1
  10. package/dsh-plugin.json +1 -1
  11. package/lib/client/NativeToolView-data.d.ts +8 -0
  12. package/lib/client/NativeToolView-data.js +19 -0
  13. package/lib/client/NativeToolView.d.ts +19 -0
  14. package/lib/client/NativeToolView.js +46 -0
  15. package/lib/client/RoleToolView-data.js +1 -1
  16. package/lib/client/RoleToolView-locales.d.ts +7 -0
  17. package/lib/client/RoleToolView-locales.js +6 -0
  18. package/lib/client/RoleToolView.js +2 -0
  19. package/lib/client/SessionProfiles.js +1 -1
  20. package/lib/client/children-locales.d.ts +4 -4
  21. package/lib/client/controller.js +20 -0
  22. package/lib/client/locales.d.ts +1 -0
  23. package/lib/client/locales.js +2 -0
  24. package/lib/client.js +350 -187
  25. package/lib/core-permission-authority.js +14 -4
  26. package/lib/mode.js +2 -2
  27. package/lib/native-admission.d.ts +5 -3
  28. package/lib/native-admission.js +218 -77
  29. package/lib/native-ownership.d.ts +3 -0
  30. package/lib/native-ownership.js +19 -0
  31. package/lib/native-subagents.d.ts +2 -1
  32. package/lib/native-subagents.js +4 -3
  33. package/lib/profile-runtime.d.ts +1 -1
  34. package/lib/prompts.d.ts +2 -0
  35. package/lib/prompts.js +14 -8
  36. package/lib/role-control-remote.js +19 -8
  37. package/lib/role-control-rpc.js +1 -1
  38. package/lib/role-control-types.d.ts +18 -5
  39. package/lib/role-identity.js +3 -19
  40. package/lib/role-invocation.d.ts +1 -1
  41. package/lib/role-policy.d.ts +11 -3
  42. package/lib/role-policy.js +61 -21
  43. package/lib/role-subagents.js +12 -5
  44. package/lib/session-metadata.d.ts +27 -1
  45. package/lib/session-metadata.js +46 -0
  46. package/lib/session-scope.d.ts +1 -1
  47. package/lib/session-scope.js +2 -2
  48. package/package.json +3 -1
  49. package/prompts/source/deepwork/general.md +19 -0
  50. package/prompts/source/shared/native-teams.md +11 -0
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { DisclosureRow, IconAgentPresetOutlineRegular, StateDot } from "@deepseek-ai/dsh-client-ui-primitives";
3
+ import { nativeActivationIdentity, observedNativeTool } from "./NativeToolView-data.js";
4
+ import { ROLE_TOOL_NS } from "./RoleToolView-locales.js";
5
+ export function NativeToolView(props) {
6
+ const { nativeView: NativeView, nativeT, t } = props;
7
+ const observation = props.useRoleCalls(state => state.calls.get(props.callId));
8
+ const status = props.useRoleCalls(state => state.status);
9
+ const { expanded, toggle } = props.useDisclosure();
10
+ const result = props.phase === "result" ? props.block : undefined;
11
+ const identity = result === undefined || result.isError || result.error != null ? undefined : nativeActivationIdentity(result.meta);
12
+ const actual = observedNativeTool(props.toolName, props.callId, identity, observation);
13
+ const settled = actual?.phase === "settled";
14
+ const live = status === "live";
15
+ const state = settled ? actual.stopReason === undefined ? "accepted" : actual.stopReason === "aborted" ? "stopped" : actual.stopReason === "completed" ? "completed" : "error"
16
+ : actual !== undefined && live ? "running" : "accepted";
17
+ const route = settled || live ? actual?.actualRoute : undefined;
18
+ return _jsxs(_Fragment, { children: [_jsx(NativeView, { ...props, t: nativeT }), identity !== undefined && _jsxs("div", { className: "dsmm-role-tool", "data-dsmm-native-tool": props.toolName, "data-state": state, "data-identity": "native", children: [_jsx(DisclosureRow, { title: `${t("nativeAgent")} · ${identity.value}`, titleClassName: "dsmm-role-summary", rowClassName: "dsmm-role-heading", icon: _jsx(IconAgentPresetOutlineRegular, { size: 14, className: "dsmm-role-icon" }), open: expanded, expandable: true, onToggle: toggle, expandOnRowClick: true, running: state === "running", children: _jsxs("div", { className: "dsmm-role-body", children: [_jsxs("p", { className: "dsmm-role-identity", children: [t(identity.kind === "name" ? "nativeName" : "nativeId"), ": ", identity.value] }), actual !== undefined && _jsxs("p", { className: "dsmm-role-identity", children: [t("nativeId"), ": ", actual.childId, actual.provider === undefined ? "" : ` · ${t("nativeProvider")}: ${actual.provider}`] }), _jsxs("p", { className: "dsmm-role-identity", children: [t("actualRoute"), ": ", route?.status === "known"
19
+ ? `${route.route.provider}/${route.route.model} · ${route.route.reasoningEffort ?? t("effortUnreported")}` : t("routeUnknown")] }), _jsx("p", { className: "dsmm-role-identity", "data-observation-status": actual === undefined ? "unavailable" : status, children: actual === undefined ? t("nativeCorrelationUnavailable") : t({ unavailable: "observationUnavailable", connecting: "observationConnecting", live: "observationLive", stale: "observationStale" }[status]) })] }) }), _jsxs("div", { className: "dsmm-role-actions", children: [_jsx(StateDot, { state: state === "error" ? "error" : state === "stopped" ? "warning" : state === "completed" ? "done" : state === "running" ? "ongoing" : "idle" }), _jsx("p", { className: "dsmm-role-status", role: "status", children: t(state) })] })] })] });
20
+ }
21
+ export function registerNativeToolViews(ctx, observations) {
22
+ const mounted = new Map();
23
+ const reconcile = () => {
24
+ const entries = ctx.slots.entries("tool.call.toolview");
25
+ for (const key of ["subagent", "subagent_fork"]) {
26
+ const candidates = entries.filter(entry => entry.component !== NativeToolView && entry.options.key === key);
27
+ const source = candidates.sort((a, b) => (a.options.priority ?? 0) - (b.options.priority ?? 0))[0];
28
+ const previous = mounted.get(key);
29
+ if (previous?.source === source)
30
+ continue;
31
+ previous?.dispose();
32
+ mounted.delete(key);
33
+ if (source === undefined || typeof source.component !== "function" || source.locale !== "conversation" || source.inject !== undefined || source.store !== undefined || source.children !== undefined)
34
+ continue;
35
+ const nativeView = source.component;
36
+ const dispose = ctx.slots.register({ name: "tool.call.toolview", key, priority: (source.options.priority ?? 0) - 1, locale: ROLE_TOOL_NS,
37
+ inject: sessionId => ({ hooks: { roleCalls: observations.source(sessionId) }, nativeView, nativeT: ctx.locale.bind("conversation") }) }, NativeToolView);
38
+ mounted.set(key, { source, dispose });
39
+ }
40
+ };
41
+ const unsubscribe = ctx.slots.subscribe("tool.call.toolview", reconcile);
42
+ reconcile();
43
+ return () => { unsubscribe(); for (const entry of mounted.values())
44
+ entry.dispose(); mounted.clear(); };
45
+ }
46
+ //# sourceMappingURL=NativeToolView.js.map
@@ -49,7 +49,7 @@ export function actualRoleTool(toolName, meta, failed) {
49
49
  }
50
50
  }
51
51
  export function observedRoleTool(toolName, observation) {
52
- if (!(toolName === "dsmm_category" ? categories : roles).has(observation.role))
52
+ if (observation.kind === "native" || !(toolName === "dsmm_category" ? categories : roles).has(observation.role))
53
53
  return undefined;
54
54
  return { role: observation.role, label: roleToolDisplay(observation.role), level: observation.level,
55
55
  routeSource: observation.routeSource, mode: "continuable", childId: observation.childId,
@@ -16,6 +16,13 @@ export declare const roleToolEn: {
16
16
  readonly error: "Failed";
17
17
  readonly stopped: "Interrupted";
18
18
  readonly technicalDetails: "Technical details";
19
+ readonly nativeAgent: "Native agent";
20
+ readonly nativeName: "Name";
21
+ readonly nativeId: "Child ID";
22
+ readonly nativeProvider: "Execution provider";
23
+ readonly accepted: "Accepted · completion not observed";
24
+ readonly completed: "Completed";
25
+ readonly nativeCorrelationUnavailable: "Live child correlation unavailable; native receipt only";
19
26
  readonly observation: "Route observation";
20
27
  readonly observationUnavailable: "Unavailable";
21
28
  readonly observationConnecting: "Connecting";
@@ -6,6 +6,9 @@ export const roleToolEn = {
6
6
  preparing: "Preparing", running: "Calling", result: "Returned",
7
7
  background: "Background", error: "Failed", stopped: "Interrupted",
8
8
  technicalDetails: "Technical details",
9
+ nativeAgent: "Native agent", nativeName: "Name", nativeId: "Child ID", nativeProvider: "Execution provider",
10
+ accepted: "Accepted · completion not observed", completed: "Completed",
11
+ nativeCorrelationUnavailable: "Live child correlation unavailable; native receipt only",
9
12
  observation: "Route observation", observationUnavailable: "Unavailable", observationConnecting: "Connecting", observationLive: "Live", observationStale: "Connection lost",
10
13
  args: "Original arguments", preparingArgs: "Arguments received so far", output: "Complete result content", failure: "Error details", metadata: "Invocation metadata",
11
14
  inspect: "View call details", copy: "Copy", copied: "Copied", emptyArgs: "Arguments not available yet",
@@ -20,6 +23,9 @@ export const roleToolZh = {
20
23
  preparing: "准备中", running: "调用中", result: "已返回",
21
24
  background: "后台调用", error: "失败", stopped: "已中断",
22
25
  technicalDetails: "技术详情",
26
+ nativeAgent: "原生代理", nativeName: "名称", nativeId: "子代理 ID", nativeProvider: "执行提供方",
27
+ accepted: "已接受 · 完成情况未观测", completed: "已完成",
28
+ nativeCorrelationUnavailable: "实时子代理关联不可用;仅显示原生回执",
23
29
  observation: "路由观测", observationUnavailable: "不可用", observationConnecting: "连接中", observationLive: "实时", observationStale: "连接已断开",
24
30
  args: "原始参数", preparingArgs: "目前已收到的参数", output: "完整结果内容", failure: "错误详情", metadata: "调用元数据",
25
31
  inspect: "查看调用详情", copy: "复制", copied: "已复制", emptyArgs: "参数尚不可用",
@@ -3,6 +3,7 @@ import { useState } from "react";
3
3
  import { Button, CodeBlock, DisclosureRow, IconAgentPresetOutlineRegular, SegmentedControl, StateDot, TextShimmer } from "@deepseek-ai/dsh-client-ui-primitives";
4
4
  import { actualRoleTool, observedRoleTool, preparingRoleTool, requestedRoleTool, roleToolDisplay, roleToolKeys, technicalJsonData, technicalTableRows } from "./RoleToolView-data.js";
5
5
  import { ROLE_TOOL_NS, roleToolEn, roleToolZh } from "./RoleToolView-locales.js";
6
+ import { registerNativeToolViews } from "./NativeToolView.js";
6
7
  const styles = `
7
8
  .dsmm-role-tool{min-width:0;color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);font-size:14px;line-height:22px}
8
9
  .dsmm-role-tool .dsmm-role-heading{color:var(--dsw-alias-label-primary);height:auto;min-height:32px}
@@ -101,6 +102,7 @@ export function registerRoleToolViews(ctx, observations) {
101
102
  ctx.slots.inject("tool.call.toolview", () => {
102
103
  const disposers = [...Object.keys(roleToolKeys), "dsmm_role", "dsmm_category"].map(key => ctx.slots.register({ name: "tool.call.toolview", key, locale: ROLE_TOOL_NS,
103
104
  inject: sessionId => ({ hooks: { roleCalls: observations.source(sessionId) } }) }, RoleToolView));
105
+ disposers.push(registerNativeToolViews(ctx, observations));
104
106
  return () => { for (const dispose of disposers.reverse())
105
107
  dispose(); };
106
108
  });
@@ -14,7 +14,7 @@ function capabilityReason(reason, t) {
14
14
  case "busy": return t("headerBusy");
15
15
  case "maintenance": return t("headerMaintenanceRefused");
16
16
  case "module-off": return t("sessionModuleOff");
17
- case "runtime-unavailable": return t("headerUnavailableRefused");
17
+ case "runtime-unavailable": return t("headerRuntimeUnavailable");
18
18
  case "model-unconfigured": return t("headerNoProfileModel");
19
19
  case "model-service-unavailable": return t("headerModelUnconfirmed");
20
20
  case "new-session-required": return t("sessionNewRequired");
@@ -252,25 +252,26 @@ export declare const childrenLocaleZh: {
252
252
  initialRoute: string;
253
253
  routeSource: string;
254
254
  description: string;
255
+ childId: string;
255
256
  pending: string;
256
257
  runId: string;
257
- childId: string;
258
258
  jobId: string;
259
259
  delivery: string;
260
260
  epoch: string;
261
261
  yes: string;
262
262
  no: string;
263
+ interrupt: string;
263
264
  queue: string;
264
265
  steer: string;
265
266
  liveRoute: string;
266
- runtime: string;
267
+ parentId: string;
267
268
  activity: string;
269
+ runtime: string;
268
270
  refresh: string;
269
271
  images: string;
270
272
  restart: string;
271
273
  title: string;
272
274
  descendants: string;
273
- interrupt: string;
274
275
  readonly: string;
275
276
  children: string;
276
277
  foreign: string;
@@ -300,7 +301,6 @@ export declare const childrenLocaleZh: {
300
301
  routeNotObserved: string;
301
302
  invocationUnavailable: string;
302
303
  toolCallId: string;
303
- parentId: string;
304
304
  subtree: string;
305
305
  oneShot: string;
306
306
  send: string;
@@ -941,6 +941,26 @@ export class ProfilesController {
941
941
  const document = structuredDocument(content);
942
942
  let invalidFields = this.current.invalidFields;
943
943
  if (document !== null) {
944
+ invalidFields = invalidFields.filter(field => !/^settings\.roleRouting\..+\.(?:primary|fallbackRoutes\.\d+|levels\.(?:low|high|max))\.(?:provider|model)$/.test(field));
945
+ for (const [role, policy] of Object.entries(document.roleRouting)) {
946
+ const prefix = `settings.roleRouting.${role}`;
947
+ const routes = [];
948
+ if (policy.primary !== undefined)
949
+ routes.push([`${prefix}.primary`, policy.primary]);
950
+ for (const [index, route] of (policy.fallbackRoutes ?? []).entries()) {
951
+ routes.push([`${prefix}.fallbackRoutes.${index}`, route]);
952
+ }
953
+ for (const [level, route] of Object.entries(policy.levels ?? {})) {
954
+ if (route.provider !== undefined)
955
+ routes.push([`${prefix}.levels.${level}`, route]);
956
+ }
957
+ for (const [path, route] of routes) {
958
+ for (const field of ["provider", "model"]) {
959
+ if (route[field].trim() === "")
960
+ invalidFields.push(`${path}.${field}`);
961
+ }
962
+ }
963
+ }
944
964
  for (const [key, draft] of this.numberDrafts) {
945
965
  let value = document;
946
966
  for (const segment of key.split(".")) {
@@ -194,6 +194,7 @@ export declare const en: {
194
194
  headerAppliedWithModel: string;
195
195
  headerModelChoiceChanged: string;
196
196
  headerActionUnavailable: string;
197
+ headerRuntimeUnavailable: string;
197
198
  headerActivationRefused: string;
198
199
  headerSelectionRefused: string;
199
200
  headerIssueCode: string;
@@ -69,6 +69,7 @@ export const en = {
69
69
  headerNoProfileModel: "This profile sets no model.", headerModelUnconfirmed: "The model change is unconfirmed. Check model settings.", headerAppliedWithModel: "Configuration and model applied.",
70
70
  headerModelChoiceChanged: "Your newer model choice was kept.",
71
71
  headerActionUnavailable: "Unavailable right now. Refresh to check again.",
72
+ headerRuntimeUnavailable: "This action is currently unavailable for this session.",
72
73
  headerActivationRefused: "The profile could not be applied. Check its configuration and the model catalog.", headerSelectionRefused: "The profile change could not be confirmed.", headerIssueCode: "Reason: {code}.", headerIssueField: "Field: {field}.", headerRetryHint: "Refresh, fix the issue in Settings or Models, then retry while the session is idle.",
73
74
  headerMaintenanceRefused: "Another session operation is in progress. Try again shortly.", headerBusyRefused: "The session is running. Try again when it finishes.", headerCancelledRefused: "Cancelled. Refresh to confirm the current configuration.", headerUnavailableRefused: "Cannot read the session configuration. Reconnect and refresh.", headerWaitRetryHint: "Refresh and retry when the session is ready.",
74
75
  noSession: "Select a session to change its configuration.",
@@ -188,6 +189,7 @@ export const zh = {
188
189
  headerNoProfileModel: "此配置未设置模型。", headerModelUnconfirmed: "模型更改未确认,请检查模型设置。", headerAppliedWithModel: "配置和模型已应用。",
189
190
  headerModelChoiceChanged: "已保留你最新选择的模型。",
190
191
  headerActionUnavailable: "此操作暂不可用,请刷新确认。",
192
+ headerRuntimeUnavailable: "当前会话暂时无法执行此操作。",
191
193
  headerActivationRefused: "配置无法应用,请检查其配置和模型目录。", headerSelectionRefused: "无法确认配置更改。", headerIssueCode: "原因:{code}。", headerIssueField: "字段:{field}。", headerRetryHint: "请刷新,在设置或模型页解决问题,然后在会话空闲时重试。",
192
194
  headerMaintenanceRefused: "会话正在处理其他操作,请稍后重试。", headerBusyRefused: "会话正在运行,请结束后重试。", headerCancelledRefused: "已取消,请刷新确认当前配置。", headerUnavailableRefused: "无法读取会话配置,请重新连接后刷新。", headerWaitRetryHint: "请稍后刷新并重试。",
193
195
  noSession: "选择会话后可更改配置。",