@dsmm/dsmm 0.3.25 → 0.3.27

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 (54) 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 -5
  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 +2 -1
  10. package/docs/web-fetch-fakeip.md +1 -1
  11. package/dsh-plugin.json +1 -1
  12. package/lib/client/NativeToolView-data.d.ts +8 -0
  13. package/lib/client/NativeToolView-data.js +19 -0
  14. package/lib/client/NativeToolView.d.ts +19 -0
  15. package/lib/client/NativeToolView.js +46 -0
  16. package/lib/client/RoleToolView-data.js +1 -1
  17. package/lib/client/RoleToolView-locales.d.ts +7 -0
  18. package/lib/client/RoleToolView-locales.js +6 -0
  19. package/lib/client/RoleToolView.js +2 -0
  20. package/lib/client/children-locales.d.ts +5 -5
  21. package/lib/client/controller.js +20 -0
  22. package/lib/client.js +347 -186
  23. package/lib/core-permission-authority.js +19 -8
  24. package/lib/deployment-permission-rules.js +2 -1
  25. package/lib/dsh-types.d.ts +2 -2
  26. package/lib/mode.js +2 -2
  27. package/lib/native-admission.d.ts +8 -0
  28. package/lib/native-admission.js +285 -48
  29. package/lib/native-ownership.d.ts +20 -0
  30. package/lib/native-ownership.js +92 -0
  31. package/lib/native-subagents.d.ts +21 -0
  32. package/lib/native-subagents.js +31 -0
  33. package/lib/permission-rpc.js +3 -2
  34. package/lib/preset-registry.js +2 -1
  35. package/lib/profile-rpc.js +4 -3
  36. package/lib/profile-runtime.d.ts +1 -1
  37. package/lib/profile-runtime.js +2 -1
  38. package/lib/prompts.d.ts +2 -0
  39. package/lib/prompts.js +14 -8
  40. package/lib/role-control-remote.js +19 -8
  41. package/lib/role-control-rpc.js +11 -9
  42. package/lib/role-control-types.d.ts +18 -5
  43. package/lib/role-identity.js +3 -19
  44. package/lib/role-invocation.d.ts +1 -1
  45. package/lib/role-policy.d.ts +11 -3
  46. package/lib/role-policy.js +64 -23
  47. package/lib/role-subagents.js +26 -6
  48. package/lib/session-metadata.d.ts +27 -1
  49. package/lib/session-metadata.js +46 -0
  50. package/lib/session-scope.d.ts +1 -1
  51. package/lib/session-scope.js +2 -2
  52. package/package.json +116 -114
  53. package/prompts/source/deepwork/general.md +19 -0
  54. 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
  });
@@ -252,27 +252,28 @@ 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;
264
+ queue: string;
265
+ steer: string;
263
266
  liveRoute: string;
264
267
  runtime: string;
268
+ parentId: string;
265
269
  activity: string;
266
270
  refresh: string;
267
271
  images: string;
268
272
  restart: string;
269
273
  title: string;
270
274
  descendants: string;
271
- interrupt: string;
272
275
  readonly: string;
273
276
  children: string;
274
- queue: string;
275
- steer: string;
276
277
  foreign: string;
277
278
  reading: string;
278
279
  noSession: 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(".")) {