dsh-agent-team-presets 0.3.5 → 0.3.6
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 +2 -2
- package/README.zh.md +2 -2
- package/docs/builtin-team-skills.md +3 -3
- package/docs/builtin-team-skills.zh.md +3 -3
- package/docs/developer/client-bundle-size.md +100 -0
- package/docs/developer/client-bundle-size.zh.md +100 -0
- package/docs/guide/install.md +1 -1
- package/docs/guide/install.zh.md +1 -1
- package/docs/index.md +1 -0
- package/docs/index.zh.md +1 -0
- package/lib/client.js +410 -7244
- package/lib/index.js +33 -5
- package/lib/typert.host.js +229 -7160
- package/lib/typert.remote-client.js +229 -7160
- package/lib/types/client/TeamImportDialog.js +1 -1
- package/lib/types/client/TeamPresetsSection.js +6 -1
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/client/locales.js +4 -0
- package/lib/types/client/team-presets-controller.d.ts +10 -0
- package/lib/types/client/team-presets-controller.js +6 -2
- package/lib/types/presets.d.ts +31 -1
- package/lib/types/presets.js +37 -3
- package/lib/types/team-catalog.d.ts +12 -0
- package/lib/types/team-catalog.js +20 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ DeepSeek Harness already ships Agent Teams with multi-agent collaboration. In th
|
|
|
69
69
|
- **Durable storage and a continuable subagent backend** for member execution; the default backend names are `spawn` and `fork`.
|
|
70
70
|
- Custom tool allow-lists have their own execution model; see [Tools and permissions](docs/reference/tools-and-permissions.md).
|
|
71
71
|
|
|
72
|
-
The plugin version (`0.3.
|
|
72
|
+
The plugin version (`0.3.6`) and the Harness version (`0.2.2-rc.5`, for example) are separate version lines.
|
|
73
73
|
|
|
74
74
|
### Install
|
|
75
75
|
|
|
@@ -126,7 +126,7 @@ Thanks to **张灏焱** for contributing the `grilling` and `research` method Te
|
|
|
126
126
|
<a id="release-notes"></a>
|
|
127
127
|
## Release notes
|
|
128
128
|
|
|
129
|
-
Latest tagged release **v0.3.
|
|
129
|
+
Latest tagged release **v0.3.6** drops the 60 zod locale tables the client bundle was carrying but never used — 791 kB across the four shipped artifacts, `lib/client.js` alone down 20.2% — and reports the role names whose summon target had to be rewritten, so a Team imported with spaces, capitals or non-Latin role names says which target each member actually answers to. It also gives the engineering-governance Team its infrastructure skills. Notes, assets, and the full history are on the [Releases](https://github.com/bloodarea/dsh-agent-team-presets/releases) page.
|
|
130
130
|
|
|
131
131
|
<a id="further-exploration"></a>
|
|
132
132
|
## Related resources
|
package/README.zh.md
CHANGED
|
@@ -69,7 +69,7 @@ DeepSeek Harness 本身已提供多智能体协作的 Agent Teams;在本插件
|
|
|
69
69
|
- **成员执行所需的持久存储与支持恢复执行的子智能体后端**;默认后端名为 `spawn` 和 `fork`。
|
|
70
70
|
- 自定义工具白名单有自己的执行模型,见[工具权限与安全](docs/reference/tools-and-permissions.zh.md)。
|
|
71
71
|
|
|
72
|
-
插件版本(`0.3.
|
|
72
|
+
插件版本(`0.3.6`)和 Harness 版本(如 `0.2.2-rc.5`)是不同的版本线。
|
|
73
73
|
|
|
74
74
|
### 安装
|
|
75
75
|
|
|
@@ -126,7 +126,7 @@ README 是入口。下面每份文档都随包发布,只有图文走查是仓
|
|
|
126
126
|
<a id="release-notes"></a>
|
|
127
127
|
## 发布说明
|
|
128
128
|
|
|
129
|
-
最新标签版本 **v0.3.
|
|
129
|
+
最新标签版本 **v0.3.6** 去掉了客户端包里从未使用的 61 张 zod 语种表——四个产物合计减少 791 kB,其中 `lib/client.js` 单文件降 20.2%;导入时若角色名无法直接作为召唤 target,会明确列出每个成员实际使用的 target,不再静默降级;同时为工程治理团队补上基础设施技能绑定。完整记录与产物见 [Releases](https://github.com/bloodarea/dsh-agent-team-presets/releases) 页面。
|
|
130
130
|
|
|
131
131
|
<a id="further-exploration"></a>
|
|
132
132
|
## 相关资源
|
|
@@ -40,7 +40,7 @@ A **local override** stays in the category of the skill it was copied from — i
|
|
|
40
40
|
|
|
41
41
|
## Default bindings
|
|
42
42
|
|
|
43
|
-
The twelve engineering skills (workflow and delivery) are bound to the development Teams; the two method skills belong to the Discovery and Research Teams.
|
|
43
|
+
The twelve engineering skills (workflow and delivery) are bound mainly to the development Teams; the two method skills belong to the Discovery and Research Teams. The engineering-governance Team takes only the infrastructure pair out of that set: the captain dispatch protocol and the subagent orchestration rules.
|
|
44
44
|
|
|
45
45
|
| Team | `team-lead` | advisor role | `executor` | other |
|
|
46
46
|
|---|---|---|---|---|
|
|
@@ -54,9 +54,9 @@ The twelve engineering skills (workflow and delivery) are bound to the developme
|
|
|
54
54
|
| 工程研发协作 `builtin-engineering` | — | — | — | both delivery skills to `repository-specialist` |
|
|
55
55
|
| 独立代码与安全审计 `builtin-audit` | — | — | — | no default skills |
|
|
56
56
|
| 科研协作 `builtin-research` | — | — | — | `research` to `evidence-scout` |
|
|
57
|
-
| 工程治理团队 `builtin-engineering-governance` | — | — | — |
|
|
57
|
+
| 工程治理团队 `builtin-engineering-governance` | — (captain is `governance-lead`) | — | — (role is `remediation-engineer`) | 5 bindings: `governance-lead` gets dispatch + orchestration; `governance-auditor`, `remediation-engineer`, and `acceptance-reviewer` get orchestration |
|
|
58
58
|
|
|
59
|
-
Two numbers are worth reading carefully. First, a Team's **binding count is not its distinct skill count**: the lightweight Team holds nine bindings but only eight distinct skills, because `agent-subagent-orchestration` is deliberately bound to both the captain and the executor. Second, the standard Team keeps one advisor role (`fullstack-advisor`) while the full-stack Team splits it into `ui-designer` and `backend-architect`; neither declares a role it does not carry
|
|
59
|
+
Two numbers are worth reading carefully. First, a Team's **binding count is not its distinct skill count**: the lightweight Team holds nine bindings but only eight distinct skills, because `agent-subagent-orchestration` is deliberately bound to both the captain and the executor. Second, the standard Team keeps one advisor role (`fullstack-advisor`) while the full-stack Team splits it into `ui-designer` and `backend-architect`; neither declares a role it does not carry. `agent-subagent-orchestration` reaches the captains, the executors, the `reviewer`, and all four engineering-governance roles — governance work is parallel by nature, since one audit covers architecture, dependencies, tests, and CI at once — but never an advisor.
|
|
60
60
|
|
|
61
61
|
You can add or remove assignments per role from the member page; those local changes are yours and are not part of the shipped preset.
|
|
62
62
|
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
## 默认绑定
|
|
42
42
|
|
|
43
|
-
12 个工程技能(工作流型 +
|
|
43
|
+
12 个工程技能(工作流型 + 交付型)主要绑定在研发团队上,2 个方法技能属于需求探索与科研协作团队;工程治理团队只取用其中的基础设施技能——队长通信与孙代理编排。
|
|
44
44
|
|
|
45
45
|
| 团队 | `team-lead` | 顾问角色 | `executor` | 其它 |
|
|
46
46
|
|---|---|---|---|---|
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
| 工程研发协作 `builtin-engineering` | — | — | — | 两个交付技能给 `repository-specialist` |
|
|
55
55
|
| 独立代码与安全审计 `builtin-audit` | — | — | — | 无默认技能 |
|
|
56
56
|
| 科研协作 `builtin-research` | — | — | — | `research` 给 `evidence-scout` |
|
|
57
|
-
| 工程治理团队 `builtin-engineering-governance` |
|
|
57
|
+
| 工程治理团队 `builtin-engineering-governance` | —(队长叫 `governance-lead`) | 不设该角色 | —(角色叫 `remediation-engineer`) | 5 条:`governance-lead` 得 `agent-leader-communication` + 编排;`governance-auditor`、`remediation-engineer`、`acceptance-reviewer` 各得编排 |
|
|
58
58
|
|
|
59
|
-
有三个数字要读仔细。第一,**绑定条数不等于技能个数**:轻量研发团队有 9 条绑定,但只对应 8 个不同技能——`agent-subagent-orchestration` 被刻意同时绑给队长和执行者。第二,标准研发团队保留单一顾问角色(`fullstack-advisor`),全栈软件研发团队把顾问拆成 `ui-designer` 与 `backend-architect`,两个团队都不再声明对方没有的专业角色。第三,`agent-subagent-orchestration`
|
|
59
|
+
有三个数字要读仔细。第一,**绑定条数不等于技能个数**:轻量研发团队有 9 条绑定,但只对应 8 个不同技能——`agent-subagent-orchestration` 被刻意同时绑给队长和执行者。第二,标准研发团队保留单一顾问角色(`fullstack-advisor`),全栈软件研发团队把顾问拆成 `ui-designer` 与 `backend-architect`,两个团队都不再声明对方没有的专业角色。第三,`agent-subagent-orchestration` 绑给队长、执行者、`reviewer`,以及工程治理团队的四个角色:治理工作天然是并行的(一次审计同时覆盖架构、依赖、测试与 CI),所以编排下到每个可能展开只读调查或整改切片的角色;顾问仍然保持单线程,从不到达。
|
|
60
60
|
|
|
61
61
|
你可以在成员页按角色增删绑定;这些本地改动属于你,不属于随包预设。
|
|
62
62
|
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Client bundle size
|
|
2
|
+
|
|
3
|
+
What the browser half ships, why it is the size it is, and the two reductions that were measured on the real build. Both address [issue #11](https://github.com/bloodarea/dsh-agent-team-presets/issues/11): `lib/client.js` was 1.29 MB for a plugin whose most common UI is one select control in the composer.
|
|
4
|
+
|
|
5
|
+
[中文](<client-bundle-size.zh.md>) · [Documentation index](../index.md) · [Architecture](architecture.md) · [README](../../README.md)
|
|
6
|
+
|
|
7
|
+
## What is actually in the bundle
|
|
8
|
+
|
|
9
|
+
Measured on the 0.3.5 artifact, not estimated:
|
|
10
|
+
|
|
11
|
+
| Part | Bytes | Share |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Zod locale message tables (60 unused languages) | 273,985 | 20.3% |
|
|
14
|
+
| Everything else (Zod core + the management UI) | 1,076,763 | 79.7% |
|
|
15
|
+
| **`lib/client.js` total** | **1,350,748** | |
|
|
16
|
+
|
|
17
|
+
The locale tables are dead code by construction. Zod re-exports all 61 languages from its public API (`zod/v4/classic/external.js` has `export * as locales`, and `v4/core` and `v4/mini` do the same), so importing any part of Zod pulls every table in. Nothing in this plugin ever calls `z.config(z.locales.<lang>())`; the only reader is Zod's own `_ensureDefaultLocale()`, which is hard-wired to `en`.
|
|
18
|
+
|
|
19
|
+
The same tables reached the wire faces one layer earlier: `lib/typert.remote-client.js` carried 260,215 bytes of them (32.7% of that file) and `lib/typert.host.js` the same again.
|
|
20
|
+
|
|
21
|
+
## Reduction 1 — drop the 60 unused tables (shipped)
|
|
22
|
+
|
|
23
|
+
`tools/build.mjs` reroutes every non-English `zod/v4/locales/<lang>.js` to the English table while the build runs. The barrel (`locales/index.js`) and `en.js` stay as Zod ships them.
|
|
24
|
+
|
|
25
|
+
Measured on the real build:
|
|
26
|
+
|
|
27
|
+
| Artifact | Before | After | Saved |
|
|
28
|
+
|---|---|---|---|
|
|
29
|
+
| `lib/client.js` | 1,350,748 | 1,076,654 | 272,971 (20.2%) |
|
|
30
|
+
| `lib/typert.remote-client.js` | 795,642 | 536,533 | 259,109 (32.6%) |
|
|
31
|
+
| `lib/typert.host.js` | 795,806 | 536,697 | 259,109 (32.6%) |
|
|
32
|
+
| **Total** | **3,799,878** | **3,008,689** | **791,189 (20.8%)** |
|
|
33
|
+
|
|
34
|
+
Both columns come from the same source tree, built twice with `tools/build.mjs` swapped for its pre-shrink version, so the only variable is the locale shim. The committed `lib/` is byte-reproducible from `src/`: rebuilding the release commit with the unmodified build reproduces the published artifact exactly.
|
|
35
|
+
|
|
36
|
+
Three properties keep this from being a behaviour change:
|
|
37
|
+
|
|
38
|
+
- **Every language key survives.** `z.locales` still exports all 63 keys with 63 distinct factories, so `z.locales.de()` returns a callable table, not `undefined`. `tests/artifacts.spec.ts` guards this against the list Zod's own barrel declares.
|
|
39
|
+
- **The messages stay English.** Every stub returns the English `{ localeError }`, which is exactly what an unconfigured Zod already reports. No translation is lost that was ever reachable.
|
|
40
|
+
- **Validation is untouched.** The schemas, `.parse()` and `.safeParse()` paths are the same objects; only the message tables for languages nobody selected are gone.
|
|
41
|
+
|
|
42
|
+
The Presets UI translation is a separate thing and is not affected: `src/client/locales.ts` holds the `en`/`zh` copy for the settings page and the composer control, and is compiled from this package's own source.
|
|
43
|
+
|
|
44
|
+
One trap worth recording. The first version rerouted all 61 language modules to re-export the *same* English module. The bundler then collapsed Zod's entire `locales` namespace into one `default` re-export and all 63 keys disappeared. Each stub therefore owns a distinct default export and shares the English table through a local binding.
|
|
45
|
+
|
|
46
|
+
## Reduction 2 — defer the management screens (rejected, with the reason)
|
|
47
|
+
|
|
48
|
+
The plan was the same shape as every other bundle split: `React.lazy` plus `import()` for `TeamEditorView`, `TeamAgentView`, `TeamSkillsView`, `TeamImportDialog`, and `TeamCategoryManager`, so the composer's select does not pay for the settings back end.
|
|
49
|
+
|
|
50
|
+
The build does produce the chunks. The split still cannot ship, because of how the Harness client module loader resolves a sibling chunk:
|
|
51
|
+
|
|
52
|
+
1. `import('./TeamAgentView.tsx')` compiles to `require.async("./client.TeamAgentView.js")`, which the loader serves through `ClientModuleSystem.importChunk` — that path is fine, and it is why the chunks were emitted at all.
|
|
53
|
+
2. A module reachable from **both** the entry and a lazy chunk (here `team-presets-controller.ts`, `locales.ts`, and the section stylesheet) becomes a third, shared chunk, and rolldown links it from the entry with a **synchronous** `require("./client.team-presets-controller.js")`.
|
|
54
|
+
3. The loader's synchronous `require` only resolves the platform seed, already-materialized modules, and registered package factories. A chunk file has not arrived yet, so it throws:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
client-modules: require("./client.team-presets-controller.js") missed the module table
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
That throw happens inside the bundle factory, before `apply()` — the plugin does not load at all, and the composer select disappears with it. Reproduced against the loader's own resolution rules with the real 717 KB entry the split produced.
|
|
61
|
+
|
|
62
|
+
The fix is not to abandon splitting — it is to keep every shared module in the ENTRY bundle and split only the leaf screens. Three worker-free ways to do that were measured:
|
|
63
|
+
|
|
64
|
+
| Approach | Result |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `codeSplitting: false` | Rejected: also inlines the dynamic chunks, so nothing is deferred |
|
|
67
|
+
| Let the bundler split automatically | Rejected: the shared chunk appears and the entry requires it synchronously (the failure above) |
|
|
68
|
+
| Build the lazy screens as a SEPARATE entry, importing shared state through the package name | **Works** — verified below |
|
|
69
|
+
|
|
70
|
+
The third approach is the one that fits: the entry build keeps `import()` for the lazy screen, the screen is built as its own entry (so it never emits a shared chunk), and where it needs something the entry already owns it imports `dsh-agent-team-presets/client` instead of a relative path. `stripClientSuffix` maps that specifier to the package's own module-table row, which is already materialized when the chunk arrives — so shared state is one instance, not a copy.
|
|
71
|
+
|
|
72
|
+
Why this is not yet applied to this plugin: every lazy screen shares a module with the entry (`team-presets-controller.ts`, `locales.ts`, `TeamPresetsSection.module.css`, and for the roster pages `presets.ts`, `team-search.ts`, `team-catalog.ts`, `keyword-search.ts`, `FieldPicker.tsx`, `CategorySelect.tsx`). Only the six stylesheet and dictionary modules could move behind that boundary without touching component props, and the measured ceiling is:
|
|
73
|
+
|
|
74
|
+
| Plan | First-screen bytes | Saved |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| Single file today | 1,076,654 | — |
|
|
77
|
+
| Defer the five screens' own code only | 957,151 | 119,503 (11.1%) |
|
|
78
|
+
| Let the bundler split automatically | 980,830 | 96,947 (9.0%), plus 22,556 bytes duplicated |
|
|
79
|
+
|
|
80
|
+
So a working split is worth about 11% of the entry, not the 40% the file size suggests, because the screens are thin relative to the controller and the dictionaries they share with the composer. It is a real but separate change: it needs every lazy screen's prop types moved to a type-only module, and the six shared modules re-exported through the package's `./client` face.
|
|
81
|
+
|
|
82
|
+
## What the guards pin
|
|
83
|
+
|
|
84
|
+
The shrink is guarded at two levels, because a test that reads `lib/` only catches the mistake after someone rebuilds and commits the regression.
|
|
85
|
+
|
|
86
|
+
**At build time** (`tools/build.mjs`), two assertions fail the build itself:
|
|
87
|
+
|
|
88
|
+
- the installed zod must still have `v4/locales/index.js` and `v4/locales/en.js`, so a zod release that moves the barrel is a loud error instead of a shim that silently stops matching;
|
|
89
|
+
- after emitting, each of the three artifacts must contain at most one per-language message table, so a layout change that keeps the build green but restores the size is caught before publishing.
|
|
90
|
+
|
|
91
|
+
Both were verified to fail on purpose: disabling the hook produces `zod locale shrink did not apply to lib/client.js: 61 per-language message tables are still inlined`, and pointing the path at `v5/locales` produces the missing-barrel error.
|
|
92
|
+
|
|
93
|
+
**At test time**, `tests/artifacts.spec.ts` fails if:
|
|
94
|
+
|
|
95
|
+
- the `locales` namespace stops exporting the full key list, or two keys collapse onto one factory;
|
|
96
|
+
- the per-language table form comes back (the marker that the shim stopped applying, which would silently add ~270 KB);
|
|
97
|
+
- English is no longer present, which would mean the shrink took the default table with it;
|
|
98
|
+
- and a negative control proves the marker test can fail, so a green run means the shrink happened rather than that the regex never matched.
|
|
99
|
+
|
|
100
|
+
The size itself is not asserted: a byte count would break on any legitimate rebuild, and the property that matters is *which* tables are inlined, not the total.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# 客户端打包体积
|
|
2
|
+
|
|
3
|
+
浏览器半边到底发了什么、为什么是这个体积,以及两处在实际构建上量过的缩减。两者都对应 [issue #11](https://github.com/bloodarea/dsh-agent-team-presets/issues/11):`lib/client.js` 曾经是 1.29 MB,而这个插件最常用的界面只是输入框旁边的一个选择器。
|
|
4
|
+
|
|
5
|
+
[English](<client-bundle-size.md>) · [文档索引](../index.zh.md) · [架构说明](architecture.zh.md) · [README](../../README.zh.md)
|
|
6
|
+
|
|
7
|
+
## 包里到底装了什么
|
|
8
|
+
|
|
9
|
+
以下数字在 0.3.5 产物上实测,不是估算:
|
|
10
|
+
|
|
11
|
+
| 部分 | 字节 | 占比 |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Zod 语种错误消息表(60 个用不到的语种) | 273,985 | 20.3% |
|
|
14
|
+
| 其余(Zod 内核 + 管理界面) | 1,076,763 | 79.7% |
|
|
15
|
+
| **`lib/client.js` 合计** | **1,350,748** | |
|
|
16
|
+
|
|
17
|
+
这些语种表在结构上就是死代码。Zod 从公开 API 里把 61 个语种整体再导出(`zod/v4/classic/external.js` 里是 `export * as locales`,`v4/core` 与 `v4/mini` 同样如此),所以只要引入 Zod 的任意部分,所有表都会被拉进来。本插件从未调用 `z.config(z.locales.<lang>())`;唯一的读取方是 Zod 自己的 `_ensureDefaultLocale()`,而它固定用 `en`。
|
|
18
|
+
|
|
19
|
+
同一批表还提前一层进了线格式产物:`lib/typert.remote-client.js` 里有 260,215 字节(占该文件 32.7%),`lib/typert.host.js` 同样。
|
|
20
|
+
|
|
21
|
+
## 缩减一:去掉 60 张用不到的表(已落地)
|
|
22
|
+
|
|
23
|
+
`tools/build.mjs` 在构建期把每个非英文的 `zod/v4/locales/<lang>.js` 改写为英文表;桶文件 `locales/index.js` 与 `en.js` 保持 Zod 原样。
|
|
24
|
+
|
|
25
|
+
真实构建实测:
|
|
26
|
+
|
|
27
|
+
| 产物 | 之前 | 之后 | 省下 |
|
|
28
|
+
|---|---|---|---|
|
|
29
|
+
| `lib/client.js` | 1,350,748 | 1,076,654 | 272,971(20.2%) |
|
|
30
|
+
| `lib/typert.remote-client.js` | 795,642 | 536,533 | 259,109(32.6%) |
|
|
31
|
+
| `lib/typert.host.js` | 795,806 | 536,697 | 259,109(32.6%) |
|
|
32
|
+
| **合计** | **3,799,878** | **3,008,689** | **791,189(20.8%)** |
|
|
33
|
+
|
|
34
|
+
两列来自同一份源码:用改动前的 `tools/build.mjs` 与改动后的各构建一次,唯一变量是语种表改写插件。另外,`lib/` 是可由 `src/` 逐字节复现的——用未改动的构建脚本重建发版提交,得到的产物与已发布产物完全一致。
|
|
35
|
+
|
|
36
|
+
有三条性质保证这不是行为变更:
|
|
37
|
+
|
|
38
|
+
- **所有语言键都还在。** `z.locales` 仍然导出 63 个键、对应 63 个互不相同的工厂函数,所以 `z.locales.de()` 拿到的是可调用的表,不是 `undefined`。`tests/artifacts.spec.ts` 用 Zod 自己桶文件里声明的键表来守住这一点。
|
|
39
|
+
- **消息仍是英文。** 每个桩返回英文的 `{ localeError }`,这正好等于未配置语种时 Zod 本来的表现。没有丢掉任何曾经可达的翻译。
|
|
40
|
+
- **校验逻辑未动。** schema、`.parse()`、`.safeParse()` 都是同一批对象;消失的只是没人选过的语种的message 表。
|
|
41
|
+
|
|
42
|
+
Presets 界面的翻译是另一件事,未受影响:`src/client/locales.ts` 里是设置页与输入框控件的中英文案,由本包自己的源码编译而来。
|
|
43
|
+
|
|
44
|
+
有一个坑值得记下来。最初版本把 61 个语种模块全部改为再导出**同一个**英文模块,结果打包器把 Zod 整个 `locales` 命名空间折叠成单个 `default` 再导出,63 个键全部消失。所以现在每个桩都拥有独立的 default 导出身份,只通过一个本地绑定共享英文表。
|
|
45
|
+
|
|
46
|
+
## 缩减二:推迟加载管理界面(已验证但未采用)
|
|
47
|
+
|
|
48
|
+
原本的方案和其他拆包一样:对 `TeamEditorView`、`TeamAgentView`、`TeamSkillsView`、`TeamImportDialog`、`TeamCategoryManager` 用 `React.lazy` + `import()`,让输入框的选择器不必为设置后台付费。
|
|
49
|
+
|
|
50
|
+
构建确实产出了这些分块。但这个拆分无法采用,原因在于 Harness 客户端模块加载器如何解析兄弟分块:
|
|
51
|
+
|
|
52
|
+
1. `import('./TeamAgentView.tsx')` 会编译成 `require.async("./client.TeamAgentView.js")`,加载器经 `ClientModuleSystem.importChunk` 提供它——这条路径没问题,分块也正是因此才被产出。
|
|
53
|
+
2. 一个同时被**入口**与某个懒加载分块引用的模块(这里是 `team-presets-controller.ts`、`locales.ts` 以及设置页样式)会被拆成第三个共享分块,而 rolldown 从入口用**同步**的 `require("./client.team-presets-controller.js")` 链接它。
|
|
54
|
+
3. 加载器的同步 `require` 只解析平台种子、已物化模块和已注册的包工厂。分块文件此时尚未到达,于是直接抛错:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
client-modules: require("./client.team-presets-controller.js") missed the module table
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
这个异常发生在 bundle 工厂内部、`apply()` 之前——插件根本不会加载,输入框的选择器会跟着一起消失。我用拆分实际产出的那个 717 KB 入口,按加载器自身的解析规则复现了这一点。
|
|
61
|
+
|
|
62
|
+
要避开的不是"拆分"本身,而是**共享模块被拆成独立文件**。可行的做法是:共享模块全部留在入口包,只拆纯界面。三条路都实测过:
|
|
63
|
+
|
|
64
|
+
| 做法 | 结果 |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `codeSplitting: false` | 否决:动态分块也被内联,没有任何东西被推迟 |
|
|
67
|
+
| 交给打包器自动拆 | 否决:共享块单独出现,入口用同步 `require` 拉它(即上面的崩溃) |
|
|
68
|
+
| 把懒加载界面作为**独立入口**构建,共享状态经包名引用 | **可行**——已验证 |
|
|
69
|
+
|
|
70
|
+
第三条是合适的形态:入口构建保留 `import()`,界面单独构建成一个入口(因此永远不会产出共享块),它需要入口已有的东西时,用 `dsh-agent-team-presets/client` 而不是相对路径去取。`stripClientSuffix` 会把该 specifier 映射到本包自己的模块表行,而分块到达时那一行早已物化——所以共享状态是同一份实例,不是副本。实测:入口把计数器加到 2,分块读到 2。
|
|
71
|
+
|
|
72
|
+
为什么本插件暂时没这么做:每个懒加载界面都与入口共享模块(`team-presets-controller.ts`、`locales.ts`、`TeamPresetsSection.module.css`,花名册两页还共享 `presets.ts`、`team-search.ts`、`team-catalog.ts`、`keyword-search.ts`、`FieldPicker.tsx`、`CategorySelect.tsx`)。在不改组件 props 的前提下,能挪到这条边界后面的只有样式表与字典六项,所以收益上限是:
|
|
73
|
+
|
|
74
|
+
| 方案 | 首屏字节 | 省下 |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| 当前单文件 | 1,076,654 | — |
|
|
77
|
+
| 只推迟五个界面自身的代码 | 957,151 | 119,503(11.1%) |
|
|
78
|
+
| 交给打包器自动拆 | 980,830 | 96,947(9.0%),另外重复 22,556 字节 |
|
|
79
|
+
|
|
80
|
+
所以一次能用的拆分值入口的约 11%,不是体积数字暗示的 40%——因为界面本身很薄,大头是它与输入框控件共享的 controller 和字典。这是一件独立的事:需要把每个懒加载界面的 props 类型移到 type-only 模块,并把六个共享模块经本包 `./client` 面重新导出。
|
|
81
|
+
|
|
82
|
+
## 守护测试钉住了什么
|
|
83
|
+
|
|
84
|
+
这道缩减有两层守护——只靠读 `lib/` 的测试,要等到有人重建并提交之后才会发现回归。
|
|
85
|
+
|
|
86
|
+
**构建期**(`tools/build.mjs`)有两条断言会让构建直接失败:
|
|
87
|
+
|
|
88
|
+
- 已安装的 zod 必须仍有 `v4/locales/index.js` 与 `v4/locales/en.js`,这样 zod 搬家时是明确报错,而不是插桩悄悄失效;
|
|
89
|
+
- 产物写出后,三个产物各至多只能含一张每语种消息表,这样"构建成功但体积回弹"的布局变化会在发布前被拦下。
|
|
90
|
+
|
|
91
|
+
两条都验证过会失败:禁用钩子会得到 `zod locale shrink did not apply to lib/client.js: 61 per-language message tables are still inlined`,把路径指向 `v5/locales` 会得到缺桶文件错误。
|
|
92
|
+
|
|
93
|
+
**测试期**,以下任一情况会让 `tests/artifacts.spec.ts` 失败:
|
|
94
|
+
|
|
95
|
+
- `locales` 命名空间不再导出完整键表,或两个键塌缩到同一个工厂;
|
|
96
|
+
- 每语种独立表那种形态回来了(这是桩失效的标记,会静默增加约 270 KB);
|
|
97
|
+
- 英文表不见了,那意味着缩减把默认表也带走了;
|
|
98
|
+
- 并且有一条负向对照证明该标记测试**能**失败,所以绿灯意味着缩减真的发生了,而不是正则从未匹配。
|
|
99
|
+
|
|
100
|
+
体积本身没有被断言:字节数会在任何一次合法重建时误报,真正要紧的是**哪些**表被内联,而不是总数。
|
package/docs/guide/install.md
CHANGED
|
@@ -12,7 +12,7 @@ What the plugin needs before it runs, the three supported install forms, and how
|
|
|
12
12
|
- **A Web or Desktop profile with Settings and the required client services.** Install into the profile you actually use — typically `web` for the Web GUI or `desktop` for Desktop.
|
|
13
13
|
- **Durable storage and a continuable subagent backend for member execution.** Member creation is refused if the storage domain or the selected execution backend is unavailable. The default backend names are `spawn` and `fork`.
|
|
14
14
|
|
|
15
|
-
The plugin version (`0.3.
|
|
15
|
+
The plugin version (`0.3.6`) and the Harness version (`0.2.2-rc.5`, for example) are separate version lines.
|
|
16
16
|
|
|
17
17
|
## Install
|
|
18
18
|
|
package/docs/guide/install.zh.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
- **具备 Settings 与所需客户端服务的 Web 或 Desktop profile。** 安装到实际使用的 profile:Web GUI 通常为 `web`,Desktop 通常为 `desktop`。
|
|
13
13
|
- **成员执行所需的持久存储与支持恢复执行的子智能体后端。** 缺少 storage domain 或所选执行后端时,插件会拒绝创建成员。默认后端名为 `spawn` 和 `fork`。
|
|
14
14
|
|
|
15
|
-
插件版本(`0.3.
|
|
15
|
+
插件版本(`0.3.6`)和 Harness 版本(如 `0.2.2-rc.5`)是不同的版本线。
|
|
16
16
|
|
|
17
17
|
## 安装
|
|
18
18
|
|
package/docs/index.md
CHANGED
|
@@ -32,6 +32,7 @@ Entry point for the `dsh-agent-team-presets` documentation. The [README](../READ
|
|
|
32
32
|
| [docs/reference/tools-and-permissions.md](reference/tools-and-permissions.md) · [中文](reference/tools-and-permissions.zh.md) | Agent-facing tools, policy modes, first-turn registration, security boundaries | yes |
|
|
33
33
|
| [docs/reference/troubleshooting.md](reference/troubleshooting.md) · [中文](reference/troubleshooting.zh.md) | Configuration overrides, the built-in troubleshooting skill, common issues, known limitations | yes |
|
|
34
34
|
| [docs/developer/architecture.md](developer/architecture.md) · [中文](developer/architecture.zh.md) | How the plugin integrates, source map, development commands | yes |
|
|
35
|
+
| [docs/developer/client-bundle-size.md](developer/client-bundle-size.md) · [中文](<developer/client-bundle-size.zh.md>) | What the browser bundle contains, the Zod locale shrink, why code splitting was rejected | yes |
|
|
35
36
|
| [docs/builtin-teams.md](builtin-teams.md) · [中文](builtin-teams.zh.md) | The eleven built-in presets: series, roles, intended use, restore semantics, where the record lives | yes |
|
|
36
37
|
| [docs/builtin-team-skills.md](builtin-team-skills.md) · [中文](builtin-team-skills.zh.md) | The fourteen shipped Team Skills: categories, default bindings per role, local overrides, scope | yes |
|
|
37
38
|
| `docs/internal/` | Development notes, audits, acceptance and release evidence | no — local working material, excluded from the repository |
|
package/docs/index.zh.md
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
| [docs/reference/tools-and-permissions.md](reference/tools-and-permissions.md) · [中文](<reference/tools-and-permissions.zh.md>) | 面向智能体的工具、策略模式、首轮注册、安全边界 | 是 |
|
|
33
33
|
| [docs/reference/troubleshooting.md](reference/troubleshooting.md) · [中文](<reference/troubleshooting.zh.md>) | 配置被覆盖、内置排障技能、常见问题、已知限制 | 是 |
|
|
34
34
|
| [docs/developer/architecture.md](developer/architecture.md) · [中文](<developer/architecture.zh.md>) | 集成方式、源码导航、开发命令 | 是 |
|
|
35
|
+
| [docs/developer/client-bundle-size.md](developer/client-bundle-size.md) · [中文](<developer/client-bundle-size.zh.md>) | 浏览器包内容、Zod 语种表缩减、为何回退代码分块 | 是 |
|
|
35
36
|
| [docs/builtin-teams.md](builtin-teams.md) · [中文](<builtin-teams.zh.md>) | 十一个内置预设:系列、角色、适用场景、恢复语义、记录存放位置 | 是 |
|
|
36
37
|
| [docs/builtin-team-skills.md](builtin-team-skills.md) · [中文](<builtin-team-skills.zh.md>) | 14 个随包团队技能:分类、各角色默认绑定、本地副本、作用域 | 是 |
|
|
37
38
|
| `docs/internal/` | 开发笔记、审计、验收与发布证据 | 否——本地材料,不入库 |
|