@daweifu/capability-menu 0.1.0 → 0.1.2

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/cordis.patch.yml CHANGED
@@ -1,9 +1,11 @@
1
1
  # dsh-capability-menu aggregate bundle patch: mounts the meta plugins in one
2
2
  # layer, from a single installable package.
3
3
  #
4
- # One package, four plugin entries — each mounts a subpath of
4
+ # One package, five plugin entries — four mount a subpath of
5
5
  # `@daweifu/capability-menu` (the loader resolves package subpath exports; see
6
- # `@deepseek-ai/dsh-web-app/startup` for the same pattern in the harness):
6
+ # `@deepseek-ai/dsh-web-app/startup` for the same pattern in the harness), and
7
+ # the root entry loads the package main to mount the browser-facing gateway
8
+ # (and thereby registers the package itself as a `dsh.client` loader entry):
7
9
  #
8
10
  # - id: capability-menu-registry
9
11
  # name: '@daweifu/capability-menu/registry'
@@ -15,50 +17,49 @@
15
17
  # name: '@daweifu/capability-menu/policy'
16
18
  # config:
17
19
  # tools:
18
- # exposed:
20
+ # resident:
19
21
  # - execute_cmd
20
22
  # - get_session_context
21
23
  # - search_kb
22
24
  # - 'mcp__gongfeng__*'
23
- # progressive:
25
+ # on-demand:
24
26
  # - 'mcp__*'
25
27
  # - 'server:km:*'
26
- # blocked: []
28
+ # disabled: []
27
29
  # skills:
28
- # exposed:
30
+ # resident:
29
31
  # - debugging
30
32
  # - coding
31
33
  # metaTools:
32
34
  # - meta_search
33
35
  # - meta_invoke
34
- # progressiveSkillCatalog: ~/.dsh/progressive-skills.yaml
35
36
  #
36
37
  # - `capability-menu-registry` (P0): builds/indexes the capability catalog and
37
- # exposes the `ctx.meta` service (search/get/getDetail/refresh). It registers
38
- # no model-facing tool itself. Indexes the GLOBAL registry (no visibility
39
- # filter) and additionally indexes Progressive skills from
40
- # `progressiveSkillCatalog` (§7.2).
38
+ # exposes the `ctx.capability` service (search/get/getDetail/refresh). It registers
39
+ # no model-facing tool itself. Indexes every visible tool — MCP tools by their
40
+ # server and harness-native tools (bash/read/write/…) under the reserved
41
+ # `built-in` pseudo-server — plus skills from the global layer and every
42
+ # mountable preset's standing scope. The single on-demand catalog is emitted to
43
+ # `catalogFile` (default `~/.dsh/capability-catalog.yaml`) for grep/read.
41
44
  # - `capability-menu-search` (P1): registers the `meta_search` tool (list + detail).
42
45
  # - `capability-menu-invoke` (P2): registers the `meta_invoke` tool (unified
43
- # execution of MCP tools and skill loading). Executes on the GLOBAL view
44
- # (no agent) so Progressive tools stay runnable; dedups already-loaded skills.
45
- # Rejects Blocked capabilities.
46
- # - `capability-menu-policy` (P3): Exposed/Progressive/Blocked projection
47
- # strategy + 能力管理 surface. Reads explicit exposed/progressive/blocked
46
+ # execution of tools — MCP or native — and skill loading). Executes on the GLOBAL
47
+ # view (no agent) so On-demand tools stay runnable; dedups already-loaded skills.
48
+ # Rejects Disabled capabilities.
49
+ # - `capability-menu-policy` (P3): Resident/On-demand/Disabled projection
50
+ # strategy + 能力管理 surface. Reads explicit resident/on-demand/disabled
48
51
  # rules (exact name + glob + server:<name>:*) and filters `assembly.tools` at
49
- # `system-prompt/assemble` to Exposed + meta tools only. The execution chain
50
- # (`ctx.tools.execute`) is untouched, so Progressive tools remain executable
52
+ # `system-prompt/assemble` to Resident + meta tools only. The execution chain
53
+ # (`ctx.tools.execute`) is untouched, so On-demand capabilities remain executable
51
54
  # via `meta_invoke`. Exposes `ctx.capabilityPolicy` with
52
- # `classifyAll`/`getConfig`/`updateConfig` for the frontend 能力菜单 tab
53
- # (Exposed/Progressive/Blocked rules + click-to-cycle classification +
55
+ # `classifyAll`/`getConfig`/`updateConfig` for the frontend 能力管理 tab
56
+ # (Resident/On-demand/Disabled rules + click-to-cycle classification +
54
57
  # read-only list), plus skill file browsing (`getDetail`/`listSkillDir`/
55
58
  # `readSkillFile`) via the Typert gateway.
56
59
  #
57
- # Default (policy present but no config): every capability is Exposed — the
58
- # `classify` fallback, nothing is hidden. Add explicit `progressive`/`blocked`
59
- # rules to pull capabilities out of the model surface. This bundle ships the
60
- # harness-native coding tools under `tools.exposed` so the model keeps direct
61
- # bash/file access.
60
+ # Default (policy present but no config): every capability is Resident — the
61
+ # `classify` fallback, nothing is hidden. Add explicit `on-demand`/`disabled`
62
+ # rules to pull capabilities out of the model surface.
62
63
  - insert:
63
64
  - id: capability-menu-registry
64
65
  name: '@daweifu/capability-menu/registry'
@@ -69,15 +70,16 @@
69
70
  - id: capability-menu-policy
70
71
  name: '@daweifu/capability-menu/policy'
71
72
  config:
72
- # Harness-native coding tools stay context-resident (Exposed) so the
73
- # model can call them directly. meta_invoke only dispatches MCP `mcp__*`
74
- # tools, so native tools (bash/read/write/edit/glob/grep) MUST stay
75
- # Exposed — listing them Progressive/Blocked would make them neither
76
- # visible nor invocable. The default (unlisted) class is Exposed; add
77
- # explicit `progressive`/`blocked` rules to pull MCP servers and skills
78
- # out of the model surface.
73
+ # Native coding tools are cataloged under the reserved `built-in`
74
+ # pseudo-server and are fully manageable like MCP tools. Unlisted
75
+ # capabilities default to Resident; list them under `on-demand`/
76
+ # `disabled` to pull MCP servers, native tools, or skills out of the
77
+ # model surface. On-demand native tools stay invocable through
78
+ # `meta_search` → `meta_invoke`. The `meta_search`/`meta_invoke`
79
+ # control-plane tools and the reserved `run_code` transport never enter
80
+ # the catalog. Do not name a real MCP server `built-in`.
79
81
  tools:
80
- exposed:
82
+ resident:
81
83
  - bash
82
84
  - read
83
85
  - write
@@ -85,3 +87,9 @@
85
87
  - read_image
86
88
  - glob
87
89
  - grep
90
+ # Root entry: loads the package main, which mounts the Typert gateway that
91
+ # exposes ctx.capabilityPolicy to the browser. Makes this package a loader
92
+ # entry itself so @deepseek-ai/dsh-client-modules discovers its `dsh.client`
93
+ # declaration and serves the 能力管理 browser bundle (`./client`).
94
+ - id: capability-menu
95
+ name: '@daweifu/capability-menu'
@@ -0,0 +1,182 @@
1
+ window.__ModuleLoader__.load({ id: "@daweifu/capability-menu", factory: (require) => {
2
+ var module = { exports: {} };
3
+ var exports = module.exports;
4
+
5
+ import { ClientContext } from "@deepseek-ai/dsh-client-runtime/client";
6
+ //#region src/client/store.d.ts
7
+ /**
8
+ * ⚠️ VERIFIED AGAINST REAL rc.8 CLIENT API.
9
+ *
10
+ * Types + small helpers for the 能力管理 (Capability Management) settings
11
+ * section. The component reads/writes the Host `ctx.capabilityPolicy` through
12
+ * the generated `remote.capabilityPolicy` face (see `./remote.ts`), mirroring
13
+ * how `dsh-client-ui-settings-plugin-inventory` consumes
14
+ * `ctx.remote.pluginInventory`.
15
+ */
16
+ /** One capability's Resident/On-demand/Disabled row, as surfaced by the server. */
17
+ interface CapabilityRow {
18
+ readonly id: string;
19
+ readonly kind: 'tool' | 'skill';
20
+ readonly name: string;
21
+ /** Server namespace for tools (`built-in` groups harness-native tools); undefined for skills. */
22
+ readonly server?: string;
23
+ /** Skill source root label (`project-dsh`/`user-agents`/…), present only for skills. */
24
+ readonly source?: string;
25
+ readonly class: 'resident' | 'on-demand' | 'disabled';
26
+ /** Human-friendly display: `Resident · 常驻(直接调用)` / `On-demand · 按需(目录渐进加载)` / `Disabled · 禁用`. */
27
+ readonly classLabel?: string;
28
+ readonly mandatory: boolean;
29
+ }
30
+ /** Snapshot of the management surface. */
31
+ interface CapabilitySnapshot {
32
+ readonly rows: readonly CapabilityRow[];
33
+ }
34
+ /** One direct child in a skill directory listing. */
35
+ interface SkillFileEntry {
36
+ readonly name: string;
37
+ readonly type: 'file' | 'directory';
38
+ }
39
+ /** Full detail projection of one capability (schema, description, stats). */
40
+ interface ToolDetail {
41
+ readonly id: string;
42
+ readonly kind: 'tool' | 'skill';
43
+ readonly actions: readonly string[];
44
+ readonly name: string;
45
+ readonly description: string;
46
+ readonly whenToUse?: string;
47
+ readonly parameters: Record<string, unknown>;
48
+ readonly output?: Record<string, unknown>;
49
+ readonly origin: {
50
+ readonly provider: string;
51
+ readonly serverName?: string;
52
+ readonly path?: string;
53
+ readonly source?: string;
54
+ };
55
+ readonly tags: readonly string[];
56
+ readonly stats: {
57
+ readonly uses: number;
58
+ readonly successes: number;
59
+ readonly failures: number;
60
+ readonly totalMs: number;
61
+ readonly lastUsedAt?: number;
62
+ };
63
+ }
64
+ /** 能力目录查看负载:两份只读「文件」+ 缺失原因。 */
65
+ interface CatalogDocs {
66
+ /** 当前生效的三档策略配置 YAML。 */
67
+ readonly policyYaml: string;
68
+ /** 按需能力目录物化文件(path + content)。 */
69
+ readonly catalog?: {
70
+ readonly path: string;
71
+ readonly content: string;
72
+ };
73
+ /** catalog 不可用原因:'disabled' = 物化未启用;'read-failed' = 读盘失败。 */
74
+ readonly catalogMissing?: 'disabled' | 'read-failed';
75
+ }
76
+ /** The Host `capabilityPolicy` remote face (generated contribution). */
77
+ interface CapabilityPolicyRemote {
78
+ getConfig(): Promise<{
79
+ ok: true;
80
+ value: Record<string, unknown>;
81
+ } | {
82
+ ok: false;
83
+ error: {
84
+ code: string;
85
+ message: string;
86
+ };
87
+ }>;
88
+ updateConfig(partial: Record<string, unknown>): Promise<{
89
+ ok: true;
90
+ value: void;
91
+ } | {
92
+ ok: false;
93
+ error: {
94
+ code: string;
95
+ message: string;
96
+ };
97
+ }>;
98
+ classifyAll(): Promise<{
99
+ ok: true;
100
+ value: CapabilityRow[];
101
+ } | {
102
+ ok: false;
103
+ error: {
104
+ code: string;
105
+ message: string;
106
+ };
107
+ }>;
108
+ listSkillDir(id: string, relPath?: string): Promise<{
109
+ ok: true;
110
+ value: SkillFileEntry[] | undefined;
111
+ } | {
112
+ ok: false;
113
+ error: {
114
+ code: string;
115
+ message: string;
116
+ };
117
+ }>;
118
+ readSkillFile(id: string, relPath: string): Promise<{
119
+ ok: true;
120
+ value: string | undefined;
121
+ } | {
122
+ ok: false;
123
+ error: {
124
+ code: string;
125
+ message: string;
126
+ };
127
+ }>;
128
+ getDetail(id: string): Promise<{
129
+ ok: true;
130
+ value: ToolDetail | undefined;
131
+ } | {
132
+ ok: false;
133
+ error: {
134
+ code: string;
135
+ message: string;
136
+ };
137
+ }>;
138
+ getCatalogDocs(): Promise<{
139
+ ok: true;
140
+ value: CatalogDocs;
141
+ } | {
142
+ ok: false;
143
+ error: {
144
+ code: string;
145
+ message: string;
146
+ };
147
+ }>;
148
+ }
149
+ //#endregion
150
+ //#region src/client/CapabilitySection.d.ts
151
+ /** Props injected by the settings.section registration (see index.ts). */
152
+ interface CapabilitySectionInjected {
153
+ remote: CapabilityPolicyRemote;
154
+ t(key: CapabilityKey, params?: Record<string, unknown>): string;
155
+ /** Diagnostic: `$mount` failure surfaced instead of crashing the section. */
156
+ mountError?: string;
157
+ /** Diagnostic: namespace methods actually installed on `ctx.remote.capabilityPolicy`. */
158
+ remoteKeys?: string;
159
+ }
160
+ type CapabilitySectionProps = CapabilitySectionInjected;
161
+ type CapabilityKey = 'nav' | 'title' | 'desc' | 'resident' | 'on-demand' | 'disabled' | 'kind' | 'class' | 'tool' | 'skill' | 'mandatory' | 'rules' | 'toolsGroup' | 'skillsGroup' | 'builtInGroup' | 'globalSkills' | 'projectSkills' | 'emptyTools' | 'emptySkills' | 'emptyGlobalSkills' | 'emptyProjectSkills' | 'toolCount' | 'residentShort' | 'onDemandShort' | 'disabledShort' | 'cycleHint' | 'notPreviewable' | 'previewClose' | 'detailNotFound' | 'cycleOverridden' | 'viewCatalog' | 'catalogPolicy' | 'catalogOnDemand' | 'catalogPolicyNote' | 'catalogDisabled' | 'catalogUnreadable';
162
+ //#endregion
163
+ //#region src/client/index.d.ts
164
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
165
+ interface LocaleNamespaceMap {
166
+ /** 能力管理 tab copy. */
167
+ 'settings.capability': Record<CapabilityKey, string>;
168
+ }
169
+ }
170
+ /** Required services (cordis fiber inject). `remote.capabilityPolicy` is NOT
171
+ * injected: we mount it in `apply`, so declaring it would deadlock the boot
172
+ * ("waiting for service"). Access it via `ctx.get('remote.capabilityPolicy')`,
173
+ * which resolves the mounted namespace service without the inject gate. */
174
+ declare const inject: string[];
175
+ /** Register the 能力管理 section once `settings.section` is on the ledger. */
176
+ declare function apply(ctx: ClientContext): Promise<() => void>;
177
+ //#endregion
178
+ export { type CapabilityKey, type CapabilityPolicyRemote, type CapabilityRow, type CapabilitySectionInjected, type CapabilitySectionProps, type CapabilitySnapshot, apply, inject };
179
+
180
+ return module.exports;
181
+ }});
182
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","names":[],"sources":["../src/client/store.ts","../src/client/CapabilitySection.tsx","../src/client/index.ts"],"mappings":";;;;;;;;;;;;;;;;UAWiB;WACN;WACA;WACA;;WAEA;;WAEA;WACA;;WAEA;WACA;;;UAIM;WACN,eAAe;;;UAIT;WACN;WACA;;;UAIM;WACN;WACA;WACA;WACA;WACA;WACA;WACA,YAAY;WACZ,SAAS;WACT;aAAmB;aAA2B;aAA8B;aAAwB;;WACpG;WACA;aACE;aACA;aACA;aACA;aACA;;;;UAKI;;WAEN;;WAEA;aAAqB;aAAuB;;;WAE5C;;;UAIM;EACf,aAAa;IAAU;IAAU,OAAO;;IAA8B;IAAW;MAAS;MAAc;;;EACxG,aAAa,SAAS,0BAA0B;IAAU;IAAU;;IAAkB;IAAW;MAAS;MAAc;;;EACxH,eAAe;IAAU;IAAU,OAAO;;IAAsB;IAAW;MAAS;MAAc;;;EAClG,aAAa,YAAY,mBAAmB;IAAU;IAAU,OAAO;;IAAmC;IAAW;MAAS;MAAc;;;EAC5I,cAAc,YAAY,kBAAkB;IAAU;IAAU;;IAAgC;IAAW;MAAS;MAAc;;;EAClI,UAAU,aAAa;IAAU;IAAU,OAAO;;IAA6B;IAAW;MAAS;MAAc;;;EACjH,kBAAkB;IAAU;IAAU,OAAO;;IAAkB;IAAW;MAAS;MAAc;;;;;;;UChDlF;EACf,QAAQ;EACR,EAAE,KAAK,eAAe,SAAS;;EAE/B;;EAEA;;KAGU,yBAAyB;KAEzB;;;;YCdA;;IAER,uBAAuB,OAAO;;;;;;;cAQrB;;iBAGS,MAAM,KAAK,gBAAgB"}