@klarkxy/dsh-plugin-kit 0.3.1 → 0.3.3
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 +4 -65
- package/docs/README.zh-CN.md +4 -46
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,73 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- release-state-note -->
|
|
4
4
|
|
|
5
|
-
The shared support package for the feature plugins in this repository: shared record types, the plugin-page model menu, host RPC registration, the official-UI style contract, and one native `llm` text call. It is a library, not a DSH bundle — adding it as a dependency gives a feature plugin the pieces it needs, not a new user-visible feature of its own.
|
|
6
|
-
|
|
7
5
|
[简体中文](docs/README.zh-CN.md)
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- It is a dependency of feature plugins, not a DSH bundle: it declares no `dsh.bundle` and registers no plugin page, so installing it on its own changes nothing the user can see.
|
|
12
|
-
- It never starts inference by itself, and makes no model call unless a feature asks for one.
|
|
13
|
-
- It does not route models by tier, retry, time out, queue, or record usage. Each feature chooses its model on its own plugin-page row and calls the host `llm` service directly; an empty selection uses the current session model, then the host default chat model.
|
|
14
|
-
|
|
15
|
-
## Entry points
|
|
16
|
-
|
|
17
|
-
- `.` — the shared contract types, plus `registerHostRpc`, `callLlmText` and `resolveFeatureModel`.
|
|
18
|
-
- `./contracts` — browser-safe types and constants: shared memory/knowledge records, `TaskContract` / `TaskCheckpoint`, `ModelRoute`, `RpcResult`, `CHAT_EVENTS_SLOT`, `projectIdFromCwd`.
|
|
19
|
-
- `./host-rpc` — host RPC registration helper and its context type.
|
|
20
|
-
- `./model-settings` — host-only model settings contributions. Register the owning plugin's read snapshot and CAS writer with `registerModelSettings` inside `ctx.effect`; the hub discovers active owners using `collectModelSettings`. Each registration has an incarnation ID, so a stale page cannot write into a replacement instance. Reads expose only model fields and revision, with an optional independent model catalog; storage and validation stay with the owner.
|
|
21
|
-
- `./client-utils` — browser-safe helpers for native plugin-page seats: `selectedSessionId`, `useNativeSeat`, `useFeatureRefresh`. `react` is an optional peer.
|
|
22
|
-
- `./model-settings-client` — browser-safe optional invalidation subscription using `createModelSettingsSubscriber`. Model Hub mounts the native stream descriptor once; pages own their rereads and draft conflicts. Owners call host-side `notifyModelSettingsChanged` after persistence and memory state commit.
|
|
23
|
-
- `./model-menu` — plugin-page model select: catalog parsing, empty-route handling, reasoning-effort options.
|
|
24
|
-
- `./llm-call` — `callLlmText` and `resolveFeatureModel` as separate exports.
|
|
25
|
-
- `./official-ui` — the shared browser-side style contract: `officialUiCss(roots)`, the `--dsw-*` token allowlist, and the focus/elevation helpers.
|
|
26
|
-
- `./cli-process` — run a resolved executable without a command shell, with bounded output, serialized line callbacks, deadlines and owned-process-tree cancellation. Streaming mode delivers stdout through `onLine`; it does not also retain stdout.
|
|
27
|
-
- `./cli-media` — validate and stage explicit workspace/current-session media, enforce file limits, and publish native image/file attachments. Remote job authority and vendor protocols remain in each plugin; these helpers do not sandbox a vendor CLI's own file access.
|
|
28
|
-
|
|
29
|
-
Plugins passing their Cordis context to `resolveFeatureModel` must declare `agents`, `sessionProjections` and `agentDefaultModel` in `inject`. These services supply the live session selection and the host default when the plugin has no saved model.
|
|
30
|
-
|
|
31
|
-
## Plugin UI convention
|
|
32
|
-
|
|
33
|
-
A feature plugin's browser half composes the host's own UI rather than
|
|
34
|
-
restyling controls of its own. Concretely:
|
|
35
|
-
|
|
36
|
-
- **Controls come from `@deepseek-ai/dsh-client-ui-primitives`** — `Button`,
|
|
37
|
-
`Input`, `Checkbox`, `Switch`, `Tag`, `Pill`, `SegmentedControl`, `Menu`,
|
|
38
|
-
`Modal`, `Tooltip`, `Toast`, `DisclosureRow`, `StateDot`, `PathLabel` and the
|
|
39
|
-
settings-form suite. The host owns their geometry, focus ring, states and
|
|
40
|
-
localisation seams, so a copy of one drifts out of style on the next theme
|
|
41
|
-
change. A native `<select>` is the single exception: the primitives ship none,
|
|
42
|
-
so keep the platform control and give it the contract's `dsh-ui-select` class.
|
|
43
|
-
- **Layout, type tiers, cards, fields, banners, empty states and floating
|
|
44
|
-
surfaces come from `./official-ui`**, scoped to the plugin's own root classes
|
|
45
|
-
so two plugins can mount the same class name without styling each other.
|
|
46
|
-
- **Colour, radius, elevation and focus are written as the host's own
|
|
47
|
-
`--dsw-*` tokens**, never aliased behind a private palette and never carrying
|
|
48
|
-
a literal fallback: the host publishes light and dark, so a literal pins one of
|
|
49
|
-
them. A stylesheet that reaches for an unknown token fails silently — a border
|
|
50
|
-
disappears, a label inherits the wrong colour — which is why
|
|
51
|
-
`src/official-ui.spec.ts` fails the build when a plugin's styling names a token
|
|
52
|
-
that is not on the allowlist.
|
|
53
|
-
|
|
54
|
-
`OFFICIAL_THEME_TOKEN_NAMES` is that allowlist. Adding a token to it is a
|
|
55
|
-
deliberate act: confirm the name against the host theme first.
|
|
56
|
-
|
|
57
|
-
## Session ancestry
|
|
58
|
-
|
|
59
|
-
`isSubagentSession` uses durable session headers, never the author of a user message.
|
|
60
|
-
Explicit subagent origin or positive delegation depth wins. A seeded human fork with
|
|
61
|
-
zero or omitted depth and ordinary/free classification keeps its parent as history
|
|
62
|
-
lineage; incomplete legacy parent metadata still identifies a child session.
|
|
63
|
-
|
|
64
|
-
## Shared string contracts
|
|
65
|
-
|
|
66
|
-
`./contracts` is the single source for cross-plugin literals:
|
|
7
|
+
A shared library used by the plugins in this repository. It adds no feature of its own and does not need to be installed separately; plugins that need it install it automatically.
|
|
67
8
|
|
|
68
|
-
|
|
69
|
-
- `WEB_PROVIDER_AVAILABILITY_EVENT` and `DshWebManagementDescriptor` — native web providers announce a local availability change and optional display metadata.
|
|
70
|
-
- `CREATOR_PRESET_ID` — the host Creator agent-preset id.
|
|
9
|
+
For plugin developers, the source code and type declarations are the reference.
|
|
71
10
|
|
|
72
|
-
##
|
|
11
|
+
## License
|
|
73
12
|
|
|
74
|
-
|
|
13
|
+
[SATA License 2.1](LICENSE)
|
package/docs/README.zh-CN.md
CHANGED
|
@@ -2,54 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- release-state-note -->
|
|
4
4
|
|
|
5
|
-
本仓库功能插件共用的支撑包:共享记录类型、插件页模型菜单、宿主 RPC 注册、官方 UI 样式契约,以及一次原生 `llm` 文本调用。它是一个库,不是 DSH bundle——把它作为依赖装上,得到的是功能插件需要的零件,而不是一个新的用户可见功能。
|
|
6
|
-
|
|
7
5
|
[English](../README.md)
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- 它是功能插件的依赖,不是 DSH bundle:不声明 `dsh.bundle`,也不注册插件页,单独安装它不会让用户看到任何变化。
|
|
12
|
-
- 它自身从不发起推理:没有功能要求时,它不会发起任何模型调用。
|
|
13
|
-
- 它不做模型档位路由、重试、超时、排队或用量记录。每个功能在自己的插件页选择模型,并直接调用宿主 `llm`;未选择时使用当前会话模型,再回落到宿主默认对话模型。
|
|
14
|
-
|
|
15
|
-
## 入口
|
|
16
|
-
|
|
17
|
-
- `.` — 共享契约类型,以及 `registerHostRpc`、`callLlmText`、`resolveFeatureModel`。
|
|
18
|
-
- `./contracts` — 浏览器安全的类型与常量:共享记忆/知识记录、`TaskContract` / `TaskCheckpoint`、`ModelRoute`、`RpcResult`、`CHAT_EVENTS_SLOT`、`projectIdFromCwd`。
|
|
19
|
-
- `./host-rpc` — 宿主 RPC 注册辅助及其上下文类型。
|
|
20
|
-
- `./model-settings` — 仅供宿主使用的模型设置贡献入口。在 `ctx.effect` 中用 `registerModelSettings` 登记所属插件的模型快照和 CAS 保存接口,枢纽通过 `collectModelSettings` 发现活动入口。每次注册有独立实例标识,旧页面不能写入重新加载的实例。只公开模型字段、版本以及可选的独立模型目录;存储与校验仍归所属插件维护。
|
|
21
|
-
- `./client-utils` — 浏览器安全的原生插件页座位辅助:`selectedSessionId`、`useNativeSeat`、`useFeatureRefresh`。`react` 是可选对等依赖。
|
|
22
|
-
- `./model-settings-client` — 浏览器安全的可选模型设置订阅。`createModelSettingsSubscriber` 复用原生远程流,模型枢纽统一注册描述符;消费页处理刷新和草稿冲突。所属插件在持久化和内存更新完成后用宿主入口的 `notifyModelSettingsChanged` 发出失效提示。
|
|
23
|
-
- `./model-menu` — 插件页模型菜单:目录解析、空路由处理、思考强度选项。
|
|
24
|
-
- `./llm-call` — 单独导出 `callLlmText` 与 `resolveFeatureModel`。
|
|
25
|
-
- `./official-ui` — 浏览器端共享样式契约:`officialUiCss(roots)`、`--dsw-*` token 白名单,以及焦点环与层级辅助。
|
|
26
|
-
- `./cli-process` — 不经命令 shell 运行已解析的可执行文件,提供输出上限、串行逐行回调、超时及本次进程树的取消。流式模式通过 `onLine` 交付 stdout,不再重复保留 stdout 字符串。
|
|
27
|
-
- `./cli-media` — 校验并暂存明确指定的工作区/当前会话媒体,限制文件大小,返回原生图片和文件附件。远端任务授权与厂商协议由各插件负责;这些辅助不为厂商 CLI 自身的文件访问提供沙箱。
|
|
28
|
-
|
|
29
|
-
将 Cordis 上下文传给 `resolveFeatureModel` 的插件须在 `inject` 中声明 `agents`、`sessionProjections` 和 `agentDefaultModel`。插件未保存模型时,这三个服务提供当前会话选择和宿主默认模型。
|
|
30
|
-
|
|
31
|
-
## 插件 UI 约定
|
|
32
|
-
|
|
33
|
-
功能插件的浏览器端用宿主自己的组件拼装界面,而不是自己重画控件。具体是:
|
|
34
|
-
|
|
35
|
-
- **控件来自 `@deepseek-ai/dsh-client-ui-primitives`**——`Button`、`Input`、`Checkbox`、`Switch`、`Tag`、`Pill`、`SegmentedControl`、`Menu`、`Modal`、`Tooltip`、`Toast`、`DisclosureRow`、`StateDot`、`PathLabel` 与设置表单套件。几何、焦点环、状态和本地化接口都由宿主掌握,抄一份就会在下次换肤时掉队。原生 `<select>` 是唯一例外:官方组件里没有它,保留平台控件并套用契约的 `dsh-ui-select` 即可。
|
|
36
|
-
- **排版、字阶、卡片、表单、横幅、空态和浮层来自 `./official-ui`**,并限定在该插件自己的根类名下,因此两个插件可以挂同名类而互不影响。
|
|
37
|
-
- **颜色、圆角、层级和焦点环直接写宿主的 `--dsw-*` token**,不另起一套私有别名,也不带字面量回落:宿主同时发布浅色与深色,字面量会把其中一套钉死。样式表里写错 token 不会报错——边框直接消失、文字继承错颜色——所以 `src/official-ui.spec.ts` 会在插件样式表点到白名单之外的 token 时让构建失败。
|
|
38
|
-
|
|
39
|
-
`OFFICIAL_THEME_TOKEN_NAMES` 就是这份白名单。往里加 token 是一个需要确认的动作:先对照宿主主题核实名字。
|
|
40
|
-
|
|
41
|
-
## 会话关系
|
|
42
|
-
|
|
43
|
-
`isSubagentSession` 只读取持久会话头,不根据 user 消息判断真人。明确的子代理来源或正派发深度优先;派发深度为零或由原生宿主省略、明确带 seed 的普通/自由真人分叉保留 parent 作为历史继承关系,仅有 parent 的旧会话及未知元数据仍按子线程处理。
|
|
44
|
-
|
|
45
|
-
## 跨插件字符串契约
|
|
46
|
-
|
|
47
|
-
`./contracts` 是插件间字面量的单一来源:
|
|
7
|
+
本仓库插件共用的支撑库。它自身不提供功能,也不需要单独安装;需要它的插件会自动带上。
|
|
48
8
|
|
|
49
|
-
|
|
50
|
-
- `WEB_PROVIDER_AVAILABILITY_EVENT` 与 `DshWebManagementDescriptor`:原生网页供应商宣布本地可用性变化,以及可选的展示元数据。
|
|
51
|
-
- `CREATOR_PRESET_ID`:宿主 Creator 预设 id。
|
|
9
|
+
插件开发者请直接参考源码和类型声明。
|
|
52
10
|
|
|
53
|
-
##
|
|
11
|
+
## 许可证
|
|
54
12
|
|
|
55
|
-
|
|
13
|
+
[SATA License 2.1](../LICENSE)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@klarkxy/dsh-plugin-kit",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Shared
|
|
3
|
+
"version": "0.3.3",
|
|
4
|
+
"description": "Shared support library for klarkxy DSH plugins.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"test": "vitest run --root ../.. --config vitest.editor-plugins.config.ts --maxWorkers=2 plugins/dsh-plugin-kit/src"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@klarkxy/dsh-model-route": "0.2.
|
|
87
|
+
"@klarkxy/dsh-model-route": "0.2.3"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"@deepseek-ai/dsh-llm": ">=0.2.0-rc.2",
|
|
@@ -139,6 +139,6 @@
|
|
|
139
139
|
"registry": "https://registry.npmjs.org/"
|
|
140
140
|
},
|
|
141
141
|
"dshRelease": {
|
|
142
|
-
"contentHash": "
|
|
142
|
+
"contentHash": "5049672e4364c593787689cdfc6274890f95fdf684d5068d7df25bcf630faaed"
|
|
143
143
|
}
|
|
144
144
|
}
|