@xi4z/dsh-utils 0.3.0 → 0.5.0

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 (59) hide show
  1. package/README.md +238 -73
  2. package/client.js +2330 -0
  3. package/cordis.patch.yml +59 -21
  4. package/lib/index.d.ts +64 -4
  5. package/lib/index.js +860 -5
  6. package/lib/index.js.map +1 -1
  7. package/lib/ui-host.d.ts +96 -0
  8. package/lib/ui-host.js +970 -0
  9. package/lib/ui-host.js.map +1 -0
  10. package/locale/en.json +1 -1
  11. package/locale/zh.json +1 -1
  12. package/package.json +53 -11
  13. package/packages/approval-policy/lib/index.d.ts +297 -0
  14. package/packages/approval-policy/lib/index.js +425 -0
  15. package/packages/approval-policy/lib/index.js.map +1 -0
  16. package/packages/approval-policy/locale/en.json +6 -0
  17. package/packages/approval-policy/locale/zh.json +6 -0
  18. package/packages/notify/lib/index.d.ts +290 -0
  19. package/packages/notify/lib/index.js +915 -0
  20. package/packages/notify/lib/index.js.map +1 -0
  21. package/packages/notify/locale/en.json +6 -0
  22. package/packages/notify/locale/zh.json +6 -0
  23. package/packages/skill-panel/lib/index.d.ts +49 -0
  24. package/packages/skill-panel/lib/index.js +420 -0
  25. package/packages/skill-panel/lib/index.js.map +1 -0
  26. package/packages/skill-panel/locale/en.json +6 -0
  27. package/packages/skill-panel/locale/zh.json +6 -0
  28. package/packages/utils-agents/lib/git.d.ts +87 -0
  29. package/packages/utils-agents/lib/git.js +403 -0
  30. package/packages/utils-agents/lib/git.js.map +1 -0
  31. package/packages/utils-agents/lib/global-repo.d.ts +57 -0
  32. package/packages/utils-agents/lib/global-repo.js +301 -0
  33. package/packages/utils-agents/lib/global-repo.js.map +1 -0
  34. package/packages/utils-agents/lib/index.d.ts +80 -0
  35. package/packages/utils-agents/lib/index.js +435 -0
  36. package/packages/utils-agents/lib/index.js.map +1 -0
  37. package/packages/utils-agents/lib/legacy.d.ts +30 -0
  38. package/packages/utils-agents/lib/legacy.js +141 -0
  39. package/packages/utils-agents/lib/legacy.js.map +1 -0
  40. package/packages/utils-agents/lib/native.d.ts +74 -0
  41. package/packages/utils-agents/lib/native.js +232 -0
  42. package/packages/utils-agents/lib/native.js.map +1 -0
  43. package/packages/utils-agents/lib/presets.d.ts +34 -0
  44. package/packages/utils-agents/lib/presets.js +312 -0
  45. package/packages/utils-agents/lib/presets.js.map +1 -0
  46. package/packages/utils-agents/lib/shared.d.ts +105 -0
  47. package/packages/utils-agents/lib/shared.js +507 -0
  48. package/packages/utils-agents/lib/shared.js.map +1 -0
  49. package/packages/utils-agents/lib/update.d.ts +129 -0
  50. package/packages/utils-agents/lib/update.js +507 -0
  51. package/packages/utils-agents/lib/update.js.map +1 -0
  52. package/packages/utils-agents/lib/util.d.ts +215 -0
  53. package/packages/utils-agents/lib/util.js +475 -0
  54. package/packages/utils-agents/lib/util.js.map +1 -0
  55. package/packages/utils-agents/locale/en.json +6 -0
  56. package/packages/utils-agents/locale/zh.json +6 -0
  57. package/skills/dsh-approval-policy-config/SKILL.md +2 -2
  58. package/src/index.ts +933 -0
  59. package/src/ui-host.ts +1073 -0
package/cordis.patch.yml CHANGED
@@ -1,14 +1,23 @@
1
- # dsh-utils — the bundle layer for four independently packaged components.
1
+ # dsh-utils — bundle layer for the utility components.
2
2
  #
3
- # This package carries no component code of its own. Every row mounts another
4
- # package of this workspace, the same shape as the official experimental
5
- # bundles: the bundle package owns the patch + locale + icon, the components
6
- # live in packages/ (published or linked separately), and their package names
7
- # resolve from the profile's node_modules.
3
+ # Everything ships in ONE package. The root package owns the patch + locale +
4
+ # icon + browser bundle (client.js) and the `utils-main` component, and the
5
+ # other four components are mounted as **subpath rows** of that same package
6
+ # (`@xi4z/dsh-utils/utils-agents`), resolved through this package's `exports`.
7
+ # A subpath row is not a package: DSH never reads its `package.json`; its display
8
+ # title comes from the exported `./<subpath>/locale/*.json`. The upside is that
9
+ # the manifest has no `@xi4z/*` dependencies at all, so the bundle installs from
10
+ # a registry, a Git URL, a packed tarball or a local directory alike.
11
+ # Because `utils-main` is a package-root row, DSH's client-module scanner also
12
+ # serves this package's client.js from it.
8
13
  #
9
- # skill-recursive — recursive SKILL.md discovery in nested skill folders,
10
- # plus the skill-repository sync host (panel routes,
11
- # deploy key, pull-only Git sync).
14
+ # The `packages/` directories stay as build units for tsc and for the per-package
15
+ # tests; they are not published.
16
+ #
17
+ # utils-main — the root package itself: recursive SKILL.md discovery
18
+ # in nested skill folders, plus the legacy global
19
+ # skill-repository JSON routes (their UI moved into
20
+ # utils-agents) and the browser half (client.js).
12
21
  # dsh-approval-policy — unattended approval gate: subagent/scheduled/cron
13
22
  # approval requests wait a bounded window, then settle
14
23
  # with a fail-closed default instead of hanging forever.
@@ -19,20 +28,24 @@
19
28
  # current session can read and hides disabled ones from
20
29
  # the model catalog while keeping them manually
21
30
  # invocable.
31
+ # utils-agents — the agents/presets panel: registers each
32
+ # ~/.dsh/.agent-presets/<id>/ directory as a real
33
+ # agent preset through cordis:include, then serves
34
+ # routes that list/toggle its skills, edit its
35
+ # Markdown, and clone/fast-forward a Git repository
36
+ # (public or private, via a Deploy Key) into it.
22
37
  #
23
- # The fifth row, dsh-utils-ui, is not a utility component: it is the browser
24
- # half's package, whose no-op entry makes DSH's client-module scanner serve its
25
- # client.js. Row ids double as settings namespaces and stay stable.
38
+ # Row ids double as settings namespaces and stay stable.
26
39
 
27
40
  - insert:
28
- - id: skill-recursive
29
- name: '@xi4z/dsh-utils-skill-recursive'
41
+ - id: utils-main
42
+ name: '@xi4z/dsh-utils'
30
43
  config: {}
31
44
  - id: dsh-approval-policy
32
- name: '@xi4z/dsh-utils-approval-policy'
45
+ name: '@xi4z/dsh-utils/approval-policy'
33
46
  config: {}
34
47
  - id: dsh-notify
35
- name: '@xi4z/dsh-utils-notify'
48
+ name: '@xi4z/dsh-utils/notify'
36
49
  config:
37
50
  # 留空 = 内置默认。下面只列出最常改的几项,完整字段见 README。
38
51
  #
@@ -53,11 +66,36 @@
53
66
  notifyOnApproval: true
54
67
  notifyOnQuestion: true
55
68
  - id: dsh-skill-panel
56
- name: '@xi4z/dsh-utils-skill-panel'
69
+ name: '@xi4z/dsh-utils/skill-panel'
57
70
  config:
58
71
  # 模型技能目录里隐藏的技能名;面板开关写入这里,热生效。
59
72
  disabledSkills: []
60
- # 浏览器半侧:独立包 dsh-utils-ui 的 no-op 入口,只让宿主提供 client.js。
61
- - id: dsh-utils-ui
62
- name: '@xi4z/dsh-utils-ui'
63
- config: {}
73
+ - id: utils-agents
74
+ name: '@xi4z/dsh-utils/utils-agents'
75
+ config:
76
+ # 单文件读写上限(字节)。AGENTS.md 本质上也是提示词,别放太大。
77
+ maxBytes: 524288
78
+ # 额外的预设根目录;每个子目录是一个预设。
79
+ presetDirs: []
80
+ # 额外的共享预设来源(技能仓库);读取其 .dsh 下的预设,供面板同步。
81
+ presetSourceDirs: []
82
+ # 保留为原生的预设 id;其余原生声明可导入成目录预设并发布到共享仓库。
83
+ builtinPresets:
84
+ - standard
85
+ - ptc
86
+ - minimal
87
+ - creator
88
+ # 全局 / 项目 AGENTS.md 视图的额外文件与递归扫描。
89
+ extraAgentsFiles: []
90
+ scanNestedAgents: false
91
+ nestedDepth: 3
92
+ # 新预设技能仓库的默认值。
93
+ defaultRepoUrl: 'https://github.com/xi4z/skills'
94
+ defaultBranch: 'Agent'
95
+ # 面板顶部的版本检查:定时查询 npm 上 @xi4z/dsh-utils 的 latest。
96
+ # 手动「检查更新」按钮不受间隔限制;改镜像时把 updateRegistry 换掉。
97
+ updateCheck: true
98
+ updateCheckIntervalHours: 6
99
+ updateRegistry: 'https://registry.npmjs.org'
100
+ # 查到新版本就后台 pnpm add;装完要重启 dsh web。link:/file: 安装自动跳过。
101
+ updateAutoInstall: true
package/lib/index.d.ts CHANGED
@@ -1,9 +1,69 @@
1
1
  /**
2
- * `dsh-utils` bundle entry: the bundle package carries only the patch layer,
3
- * bundle metadata and assets. Every utility component is its own package under
4
- * `packages/`, mounted by name from `cordis.patch.yml` — the same shape as the
5
- * official experimental bundles, whose own entry is an empty module.
2
+ * `dsh-utils` main component (`utils-main`): the package root half of the
3
+ * bundle, mounted as a normal row by `cordis.patch.yml`.
4
+ *
5
+ * It adds nested `SKILL.md` bundles (depth >= `minDepth`) to the skill catalog,
6
+ * leaving depth-1 discovery to the built-in filesystem provider, and owns the
7
+ * skill-repository sync routes imported from `./ui-host.js`. The browser half
8
+ * (`client.js`) is published by this same package: `utils-main` is a
9
+ * package-root row, so the client-module scanner serves it from this row.
6
10
  *
7
11
  * @module dsh-utils
8
12
  */
13
+ import type { Context } from '@deepseek-ai/cordis';
14
+ import z from '@deepseek-ai/schemastery';
15
+ export declare const name = "utils-main";
16
+ export declare const inject: string[];
17
+ /**
18
+ * Settings schema. Volatile fields are the only ones DSH exposes in the
19
+ * Settings form and the ones the Loader can refresh in place.
20
+ */
21
+ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
22
+ minDepth: z<number, number, "volatile-defined">;
23
+ maxDepth: z<number, number, "volatile-defined">;
24
+ watch: z<boolean, boolean, "volatile-defined">;
25
+ debounceMs: z<number, number, "volatile-defined">;
26
+ pollIntervalMs: z<number, number, "volatile-defined">;
27
+ includeProjectRoots: z<boolean, boolean, "volatile-defined">;
28
+ includeUserRoots: z<boolean, boolean, "volatile-defined">;
29
+ followSymlinks: z<boolean, boolean, "volatile-defined">;
30
+ extraRoots: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
31
+ ignoreDirs: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
32
+ }>>, Schemastery.ObjectT<NoInfer<{
33
+ minDepth: z<number, number, "volatile-defined">;
34
+ maxDepth: z<number, number, "volatile-defined">;
35
+ watch: z<boolean, boolean, "volatile-defined">;
36
+ debounceMs: z<number, number, "volatile-defined">;
37
+ pollIntervalMs: z<number, number, "volatile-defined">;
38
+ includeProjectRoots: z<boolean, boolean, "volatile-defined">;
39
+ includeUserRoots: z<boolean, boolean, "volatile-defined">;
40
+ followSymlinks: z<boolean, boolean, "volatile-defined">;
41
+ extraRoots: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
42
+ ignoreDirs: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
43
+ }>>, "plain">;
44
+ /** Volatile Config fields arrive as live references; `.get()` snapshots. */
45
+ interface VolatileRef<T> {
46
+ get(): T;
47
+ }
48
+ /** One setting as the Loader supplies it: a live reference, or a plain value in tests. */
49
+ type MaybeRef<T> = T | VolatileRef<T>;
50
+ /** The runtime shape `apply` receives (every field volatile, every field optional). */
51
+ export interface UtilsMainConfig {
52
+ readonly minDepth?: MaybeRef<number>;
53
+ readonly maxDepth?: MaybeRef<number>;
54
+ readonly watch?: MaybeRef<boolean>;
55
+ readonly debounceMs?: MaybeRef<number>;
56
+ readonly pollIntervalMs?: MaybeRef<number>;
57
+ readonly includeProjectRoots?: MaybeRef<boolean>;
58
+ readonly includeUserRoots?: MaybeRef<boolean>;
59
+ readonly followSymlinks?: MaybeRef<boolean>;
60
+ readonly extraRoots?: MaybeRef<readonly string[]>;
61
+ readonly ignoreDirs?: MaybeRef<readonly string[]>;
62
+ }
63
+ /**
64
+ * Register the recursive skill provider on the host `skills` registry.
65
+ * @param ctx - plugin context carrying the `skills` service.
66
+ * @param config - optional row config; see {@link normalizeConfig}.
67
+ */
68
+ export declare function apply(ctx: Context, config?: UtilsMainConfig): void;
9
69
  export {};