@deepseek-ai/dsh-client-test-runtime 0.1.6-alpha.2 → 0.1.7-alpha.1
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.i18n.yaml +2 -2
- package/README.md +7 -3
- package/README.zh.md +7 -3
- package/lib/index.js +67 -23
- package/lib/types/assembly/bundle-roster.d.ts +4 -3
- package/lib/types/assembly/roster.d.ts +4 -4
- package/lib/types/{settings-scope.d.ts → config-form.d.ts} +8 -8
- package/lib/types/index.d.ts +2 -2
- package/lib/types/sessions.d.ts +3 -5
- package/lib/types/workspaces.d.ts +20 -1
- package/package.json +51 -51
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/test-support/client-runtime/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 06455888a87fa03b1960574d25cbc9ce69e2c9aa
|
|
6
|
+
README.zh.md: edad3ae12b76fef8ed230953866341d345e0cdc6
|
package/README.md
CHANGED
|
@@ -11,6 +11,8 @@ English | [中文](README.zh.md)
|
|
|
11
11
|
|
|
12
12
|
`SlotTestRuntime.create()` lets Vitest suites drive production slots, stores, typed Session and Workspace fixtures, and local DOM assertions in jsdom. For plugin activation, reload, reconnect, and cleanup tests, `createClientTest` starts the web profile's bundle roster with endpoint-named Remote mocks, without a business Host. Missing services and unstubbed calls fail explicitly. The whole-client fixture owns startup and disposal; the local runtime provides idempotent disposal. Use this package through `devDependencies` for client tests; it is not a product plugin.
|
|
13
13
|
|
|
14
|
+
Linked bundles resolve dependencies from their real package directories; dependencies next to any bundle take precedence over packages inherited from ancestor directories.
|
|
15
|
+
|
|
14
16
|
## Table of Contents
|
|
15
17
|
|
|
16
18
|
- [Use this package](#use-this-package)
|
|
@@ -44,6 +46,8 @@ await runtime.dispose()
|
|
|
44
46
|
|
|
45
47
|
The optional render options select a keyed entry with `entryKey` or a list item with `only`; `view.update(owner)` retains that selection. `runtime.panelInfo` supplies the default `usePanelInfo` source with no global panel selected. Release it with `releasePanelInfoSource()` before mounting the production Layout owner. `dispose()` releases both default Workspace and panel-info root sources; early release is idempotent and does not remove replacement owners.
|
|
46
48
|
|
|
49
|
+
The Session fixture resolves subagent addresses from explicitly supplied addresses or loaded parent projections without retaining a Session generation.
|
|
50
|
+
|
|
47
51
|
### Local DOM snapshots
|
|
48
52
|
|
|
49
53
|
A registered snapshot serializer folds CSS-module class hashes (`_frame_a1b2c3` → `frame`) so `.snap` files stay structural, and collapses `<svg>` internals to a `data-content` fingerprint. Suites needing a custom page frame use `root.declare(children, Frame)` instead of the auto frame; `dispose()` tears down views, feature fibers, minted scopes, and persisted store state on one axis and is idempotent.
|
|
@@ -87,7 +91,7 @@ The [generic Remote proxy](../remote-mock/README.md#remote-proxy) supports every
|
|
|
87
91
|
|
|
88
92
|
### Roster and startup behavior
|
|
89
93
|
|
|
90
|
-
`webApp` is the `web` profile's browser roster, read when the assembly entry is first imported from its bundles (`dsh-base`, then `dsh-web-app`) as the launcher composes them, except that a patch matching nothing throws here where the launcher warns: each bundle's `dsh.bundle.patch` list is parsed with the include plugin's YAML dialect and composed by its `applyEntryPatches`, and every enabled row whose package declares `dsh.client.platform === 'web'` becomes a row carrying that declaration's `inject` and `immediately`; `bundleRoster(bundles)`
|
|
94
|
+
`webApp` is the `web` profile's browser roster, read when the assembly entry is first imported from its bundles (`dsh-base`, then `dsh-web-app`) as the launcher composes them, except that a patch matching nothing throws here where the launcher warns: each bundle's `dsh.bundle.patch` list is parsed with the include plugin's YAML dialect and composed by its `applyEntryPatches`, and every enabled row whose package declares `dsh.client.platform === 'web'` becomes a row carrying that declaration's `inject` and `immediately`; `bundleRoster(bundles, anchor, disabledContext)` accepts an explicit Loader evaluation scope for conditional `disabled` flags; without one, browser expressions are rejected. `webApp` supplies the Web profile name, not business Host services. Nothing is copied from the bundles, so a bundle change is visible at the next test run. `webApp.closure(names)` keeps the named rows plus everything they inject, transitively (the rows a spec needs to boot those plugins as the bundle composes them), `webApp.pick(names)` and `webApp.without(names)` cut it down by hand, all three throw on unknown names, and `ClientRoster.of(rows)` builds one inline. `remoteDefaultResponses` holds default responses for exactly the Remote endpoints the roster calls while booting with no sessions, no workspaces, and default settings; a spec layers its own `RemoteTable` on top with `mock.load(table)`, and any call without a rule fails the test at `dispose()` through `mock.assertNoUnmatched()`. `mount` requires a roster that provides `uiRenderer`; `start` fails loud otherwise instead of returning an empty container. `client.connection` is the roster's Connection service (no `Context` augmentation declares it), and `connectTimeoutMs` bounds the readiness wait, whose failure message lists the mock log. `reload(name)` rebuilds one Loader entry through the shared Client Modules helper (registry-first teardown, then `entry.refresh()`); each client retains its own module system and instance-bound Connection replacement, so starts and reloads can overlap without changing a page global. `unload(name)` removes an entry and waits for plugin cleanup; `flush()` settles React inside `act`. jsdom implements neither `EventSource` (client-hmr opens one at apply) nor `ResizeObserver` nor the `document.fonts` event target (layout components observe size and font loading at mount), so `start` reference-counts inert stubs for whichever global is absent and `dispose` removes exactly those — a jsdom gap, not a client identity channel. The `@deepseek-ai/dsh-api-remotes` row is dropped from every roster: its generated Remote clients exist only in built `lib/`, and `remote.<ns>` is what the tier replaces anyway. `start` instead provides one contract-free proxy per `remote.<ns>` service the roster injects (plus the namespaces the mock has rules for at that point; a namespace first registered later has no proxy); `ctx.remote.<ns>.<method>(...args)` becomes a call on the endpoint `<ns>/<method>` carrying the positional args, a stream when the mock registered a `stream()` script and a unary call otherwise, with the generated client's outcome folding (`gateway/internal` for carrier throws, `gateway/cancelled` on abort). An endpoint without a rule is still dispatched, so the mock logs it and `dispose()` fails the test.
|
|
91
95
|
|
|
92
96
|
### When to use it
|
|
93
97
|
|
|
@@ -111,7 +115,7 @@ This section explains the design of the bench; the observable behavior is fully
|
|
|
111
115
|
|
|
112
116
|
### Design
|
|
113
117
|
|
|
114
|
-
The bench copies no production logic: it mounts the production `SlotRegistry`, production renderer, and `UiSession` adapter. `TestSessions` and `TestWorkspaces` implement the owner interfaces that features consume through Cordis, each fixture Session implements `SessionFace`, and `
|
|
118
|
+
The bench copies no production logic: it mounts the production `SlotRegistry`, production renderer, and `UiSession` adapter. `TestSessions` and `TestWorkspaces` implement the owner interfaces that features consume through Cordis, each fixture Session implements `SessionFace`, and `stubConfigForm` implements `ConfigForm`. `UiSession` derives standard renderer sources from those Controller bindings. Unstubbed `ISession` behavior fails with the missing method name.
|
|
115
119
|
|
|
116
120
|
### Source map
|
|
117
121
|
|
|
@@ -123,7 +127,7 @@ The bench copies no production logic: it mounts the production `SlotRegistry`, p
|
|
|
123
127
|
| [`src/snapshot.ts`](src/snapshot.ts) | DOM snapshot serializer (class-hash folding, `<svg>` fingerprint) |
|
|
124
128
|
| [`src/remote.ts`](src/remote.ts) | `TestRemote` double for host RPC, `RemoteError` value re-export |
|
|
125
129
|
| [`src/translate.ts`](src/translate.ts) + [`src/locale-env.ts`](src/locale-env.ts) | Translation and pinned-browser-language test helpers |
|
|
126
|
-
| [`src/
|
|
130
|
+
| [`src/config-form.ts`](src/config-form.ts) | `stubConfigForm` with test-driven publications and write spies |
|
|
127
131
|
| [`src/assembly/roster.ts`](src/assembly/roster.ts) | `ClientRosterRow`, `ClientRoster` (`of`/`closure`/`pick`/`without`), the `AssemblyPlan` it annotates, and `graphFromRoster` |
|
|
128
132
|
| [`src/assembly/modules.ts`](src/assembly/modules.ts) | Source `/client` imports and replacements, registered through the production module facade's pending factory queue |
|
|
129
133
|
| [`src/assembly/test-client.ts`](src/assembly/test-client.ts) | `TestClient`: instance-bound Connection, shared jsdom shims, `bootClient`, mount, readiness wait, `reload`/`unload`/`dispose` |
|
package/README.zh.md
CHANGED
|
@@ -11,6 +11,8 @@ kind: "package-library"
|
|
|
11
11
|
|
|
12
12
|
`SlotTestRuntime.create()` 让 Vitest 套件在 jsdom 中驱动生产 slot、store、带类型的 Session 与 Workspace fixture,并对局部 DOM 断言。面向插件激活、重载、重连与清理的测试,`createClientTest` 使用具名端点 Remote mock 启动 web profile 的 bundle roster,无需业务 Host。缺失服务与未打桩调用会明确失败。整机 fixture 拥有启动和销毁,局部 runtime 提供幂等销毁。通过 `devDependencies` 将本包用于客户端测试;它不是产品插件。
|
|
13
13
|
|
|
14
|
+
链接到工作区的 bundle 从实际包目录解析依赖;各 bundle 自身目录中的依赖优先于祖先目录中继承的包。
|
|
15
|
+
|
|
14
16
|
## 目录
|
|
15
17
|
|
|
16
18
|
- [使用本包](#use-this-package)
|
|
@@ -44,6 +46,8 @@ await runtime.dispose()
|
|
|
44
46
|
|
|
45
47
|
可选渲染参数通过 `entryKey` 选择 keyed 条目,或通过 `only` 选择 list 条目;`view.update(owner)` 保留该选择。`runtime.panelInfo` 提供默认的 `usePanelInfo` 数据源,初始不选中全局面板。挂载生产 Layout 所有者之前,先调用 `releasePanelInfoSource()` 释放该数据源。`dispose()` 同时释放默认的工作区与面板信息根数据源;提前释放是幂等的,不会移除替代它们的所有者。
|
|
46
48
|
|
|
49
|
+
Session fixture 从显式提供的地址或已加载的父级投影解析子代理地址,不会保留 Session generation。
|
|
50
|
+
|
|
47
51
|
### 局部 DOM 快照
|
|
48
52
|
|
|
49
53
|
注册的快照序列化器把 CSS-module 哈希类名折回语义名(`_frame_a1b2c3` → `frame`),使 `.snap` 文件只含结构,并把 `<svg>` 内部折叠为 `data-content` 指纹。需要自定义页面 frame 的套件改用 `root.declare(children, Frame)` 而非自动 frame;`dispose()` 沿单一轴拆除视图、功能 fiber、已铸 scope 与持久化存储状态,且幂等。
|
|
@@ -87,7 +91,7 @@ test('registers into the sidebar', async ({ remote, start }) => {
|
|
|
87
91
|
|
|
88
92
|
### Roster 与启动行为
|
|
89
93
|
|
|
90
|
-
`webApp` 是 `web` profile 的浏览器 roster,首次 import 装配入口时从它的 bundle(先 `dsh-base`、再 `dsh-web-app`)按启动器的方式现读,只是匹配不到任何行的补丁在这里抛错、启动器只警告:每个 bundle 的 `dsh.bundle.patch` 列表用 include 插件的 YAML 方言解析、用它的 `applyEntryPatches` 合成,每个未禁用且其包声明 `dsh.client.platform === 'web'` 的行成为一行,带上该声明的 `inject` 与 `immediately`;`bundleRoster(bundles)`
|
|
94
|
+
`webApp` 是 `web` profile 的浏览器 roster,首次 import 装配入口时从它的 bundle(先 `dsh-base`、再 `dsh-web-app`)按启动器的方式现读,只是匹配不到任何行的补丁在这里抛错、启动器只警告:每个 bundle 的 `dsh.bundle.patch` 列表用 include 插件的 YAML 方言解析、用它的 `applyEntryPatches` 合成,每个未禁用且其包声明 `dsh.client.platform === 'web'` 的行成为一行,带上该声明的 `inject` 与 `immediately`;`bundleRoster(bundles, anchor, disabledContext)` 接受显式 Loader 求值作用域来处理条件 `disabled` 标记;未提供作用域时拒绝浏览器表达式。`webApp` 仅提供 Web profile 名称,不提供业务 Host 服务。没有任何东西从 bundle 拷贝出来,bundle 一改下次跑测试就能看见。`webApp.closure(names)` 保留点名的行及其传递注入的全部行(即按 bundle 组合方式起这些插件所需的行),`webApp.pick(names)` 与 `webApp.without(names)` 手工裁剪,三者都对未知名字抛错,`ClientRoster.of(rows)` 内联构造一份。`remoteDefaultResponses` 是 roster 在没有 session、没有 workspace、默认设置下启动时恰好会打的那些 Remote 端点的默认响应;测试用 `mock.load(table)` 在其上叠加自己的 `RemoteTable`,任何没有规则的调用都会在 `dispose()` 时经 `mock.assertNoUnmatched()` 让测试失败。`mount` 要求 roster 提供 `uiRenderer`;否则 `start` 响亮失败而不是返回一个空容器。`client.connection` 是 roster 的 Connection 服务(没有任何 `Context` 增强声明它),`connectTimeoutMs` 限定等就绪的时长,超时消息列出 mock log。`reload(name)` 通过共享的 Client Modules 辅助函数重建一个 Loader entry(先拆 registry,再 `entry.refresh()`);每个客户端都保留自己的模块系统和绑定实例的 Connection 替换,因此启动与重载可以重叠而无需改写页面全局变量。`unload(name)` 移除 entry 并等待插件清理完成,`flush()` 在 `act` 内让 React 落定。jsdom 既没有 `EventSource`(client-hmr 在 apply 时打开一个)也没有 `ResizeObserver` 和 `document.fonts` 事件目标(布局组件挂载时观察尺寸与字体加载),所以 `start` 对缺失的全局惰性桩做引用计数,`dispose` 只移除它装的那些——这是 jsdom 的缺口,不是客户端身份通道。每个 roster 里的 `@deepseek-ai/dsh-api-remotes` 行都会被去掉:它生成的 Remote 客户端只存在于构建后的 `lib/`,而 `remote.<ns>` 正是本档要替掉的东西。`start` 改为给 roster 注入的每个 `remote.<ns>` 服务(加上此刻 mock 登记过规则的命名空间;之后才首次登记的命名空间没有代理)提供一个无契约代理;`ctx.remote.<ns>.<method>(...args)` 变成对端点 `<ns>/<method>` 的调用,携带位置参数,mock 登记了 `stream()` 脚本的走流、否则走一元,并沿用生成客户端的结果折叠(载体抛错折成 `gateway/internal`,中止折成 `gateway/cancelled`)。没有规则的端点照样发出,所以 mock 会记下它、`dispose()` 让测试失败。
|
|
91
95
|
|
|
92
96
|
### 何时使用
|
|
93
97
|
|
|
@@ -111,7 +115,7 @@ test('registers into the sidebar', async ({ remote, start }) => {
|
|
|
111
115
|
|
|
112
116
|
### 设计
|
|
113
117
|
|
|
114
|
-
测试台不复制生产逻辑:它挂载生产 `SlotRegistry`、生产渲染器与 `UiSession` 适配器。`TestSessions` 与 `TestWorkspaces` 实现功能通过 Cordis 消费的 owner 接口,每个 fixture Session 实现 `SessionFace`,`
|
|
118
|
+
测试台不复制生产逻辑:它挂载生产 `SlotRegistry`、生产渲染器与 `UiSession` 适配器。`TestSessions` 与 `TestWorkspaces` 实现功能通过 Cordis 消费的 owner 接口,每个 fixture Session 实现 `SessionFace`,`stubConfigForm` 实现 `ConfigForm`。`UiSession` 从这些控制器绑定派生标准渲染器数据源。未 stub 的 `ISession` 行为会携缺失方法名失败。
|
|
115
119
|
|
|
116
120
|
### 源码地图
|
|
117
121
|
|
|
@@ -123,7 +127,7 @@ test('registers into the sidebar', async ({ remote, start }) => {
|
|
|
123
127
|
| [`src/snapshot.ts`](src/snapshot.ts) | DOM 快照序列化器(类名哈希折叠、`<svg>` 指纹) |
|
|
124
128
|
| [`src/remote.ts`](src/remote.ts) | 用于 host RPC 的 `TestRemote` 替身、`RemoteError` 值转出 |
|
|
125
129
|
| [`src/translate.ts`](src/translate.ts) + [`src/locale-env.ts`](src/locale-env.ts) | 翻译与固定浏览器语言测试辅助 |
|
|
126
|
-
| [`src/
|
|
130
|
+
| [`src/config-form.ts`](src/config-form.ts) | 带测试驱动发布与写入 spy 的 `stubConfigForm` |
|
|
127
131
|
| [`src/assembly/roster.ts`](src/assembly/roster.ts) | `ClientRosterRow`、`ClientRoster`(`of`/`closure`/`pick`/`without`)、它所标注的 `AssemblyPlan`,以及 `graphFromRoster` |
|
|
128
132
|
| [`src/assembly/modules.ts`](src/assembly/modules.ts) | 源码 `/client` 导入及替换,通过生产模块 facade 的待注册工厂队列登记 |
|
|
129
133
|
| [`src/assembly/test-client.ts`](src/assembly/test-client.ts) | `TestClient`:绑定实例的 Connection、共享 jsdom 桩、`bootClient`、挂载、等就绪、`reload`/`unload`/`dispose` |
|
package/lib/index.js
CHANGED
|
@@ -232,6 +232,7 @@ function workspaceSnapshot() {
|
|
|
232
232
|
return {
|
|
233
233
|
items: [],
|
|
234
234
|
archivedSessionIds: [],
|
|
235
|
+
pinnedSessionIds: [],
|
|
235
236
|
state: "idle",
|
|
236
237
|
phase: "ready",
|
|
237
238
|
error: null
|
|
@@ -482,8 +483,7 @@ var TestSessions = class {
|
|
|
482
483
|
ids: [],
|
|
483
484
|
byId: {},
|
|
484
485
|
phase: "ready",
|
|
485
|
-
|
|
486
|
-
jobsBySession: {}
|
|
486
|
+
projectionsBySession: {}
|
|
487
487
|
});
|
|
488
488
|
rootCtx.effect(() => async () => {
|
|
489
489
|
this.closed = true;
|
|
@@ -743,27 +743,20 @@ var TestSessions = class {
|
|
|
743
743
|
subagentAddress(id) {
|
|
744
744
|
const retained = this.addresses.get(id);
|
|
745
745
|
if (retained !== void 0) return retained;
|
|
746
|
-
for (const [parentSessionId,
|
|
747
|
-
const child =
|
|
748
|
-
if (child
|
|
746
|
+
for (const [parentSessionId, projections] of Object.entries(this.list.getSnapshot().projectionsBySession)) {
|
|
747
|
+
const child = projections.values.subagentCatalog?.find((entry) => entry.id === id);
|
|
748
|
+
if (child !== void 0) return {
|
|
749
749
|
parentSessionId,
|
|
750
750
|
childSessionId: id,
|
|
751
751
|
mode: child.mode
|
|
752
752
|
};
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
|
-
/** Record
|
|
756
|
-
|
|
755
|
+
/** Record a projection refresh; fixture callers drive snapshots explicitly. */
|
|
756
|
+
refreshProjections(sessionId) {
|
|
757
757
|
this.calls.push({
|
|
758
|
-
method: "
|
|
759
|
-
args: [
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
/** Record a catalog refresh; fixture callers drive snapshots explicitly. */
|
|
763
|
-
refreshSubagents(parentSessionId) {
|
|
764
|
-
this.calls.push({
|
|
765
|
-
method: "refreshSubagents",
|
|
766
|
-
args: [parentSessionId]
|
|
758
|
+
method: "refreshProjections",
|
|
759
|
+
args: [sessionId]
|
|
767
760
|
});
|
|
768
761
|
return Promise.resolve();
|
|
769
762
|
}
|
|
@@ -1025,6 +1018,19 @@ var TestWorkspaces = class {
|
|
|
1025
1018
|
};
|
|
1026
1019
|
}
|
|
1027
1020
|
/**
|
|
1021
|
+
* Initialize the default Workspace through a test stub; defaults to an ineligible first use.
|
|
1022
|
+
* @param request - initial directory name and title.
|
|
1023
|
+
* @param signal - caller lifetime.
|
|
1024
|
+
* @returns the stubbed Workspace, or undefined when initialization is ineligible.
|
|
1025
|
+
*/
|
|
1026
|
+
async initializeDefault(request, signal) {
|
|
1027
|
+
this.calls.push({
|
|
1028
|
+
method: "initializeDefault",
|
|
1029
|
+
args: [request, signal]
|
|
1030
|
+
});
|
|
1031
|
+
return await this.stubs.get("initializeDefault")?.(request, signal);
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1028
1034
|
* Rename a Workspace (recorded). The default echoes a minimal view.
|
|
1029
1035
|
* @param workspaceId - target workspace.
|
|
1030
1036
|
* @param title - new title.
|
|
@@ -1130,16 +1136,54 @@ var TestWorkspaces = class {
|
|
|
1130
1136
|
draft.archivedSessionIds = draft.archivedSessionIds.filter((id) => id !== sessionId);
|
|
1131
1137
|
});
|
|
1132
1138
|
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Pin a session (recorded). The default mirrors the production face's
|
|
1141
|
+
* observable effect: the id leads the list state's pin set.
|
|
1142
|
+
* @param sessionId - session to pin.
|
|
1143
|
+
*/
|
|
1144
|
+
async pinSession(sessionId) {
|
|
1145
|
+
this.calls.push({
|
|
1146
|
+
method: "pinSession",
|
|
1147
|
+
args: [sessionId]
|
|
1148
|
+
});
|
|
1149
|
+
const stub = this.stubs.get("pinSession");
|
|
1150
|
+
if (stub !== void 0) {
|
|
1151
|
+
await stub(sessionId);
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
await this.update((draft) => {
|
|
1155
|
+
draft.pinnedSessionIds = [sessionId, ...draft.pinnedSessionIds.filter((id) => id !== sessionId)];
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Unpin a session (recorded). The default mirrors the production face's
|
|
1160
|
+
* observable effect: the id leaves the list state's pin set.
|
|
1161
|
+
* @param sessionId - session to unpin.
|
|
1162
|
+
*/
|
|
1163
|
+
async unpinSession(sessionId) {
|
|
1164
|
+
this.calls.push({
|
|
1165
|
+
method: "unpinSession",
|
|
1166
|
+
args: [sessionId]
|
|
1167
|
+
});
|
|
1168
|
+
const stub = this.stubs.get("unpinSession");
|
|
1169
|
+
if (stub !== void 0) {
|
|
1170
|
+
await stub(sessionId);
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
await this.update((draft) => {
|
|
1174
|
+
draft.pinnedSessionIds = draft.pinnedSessionIds.filter((id) => id !== sessionId);
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1133
1177
|
};
|
|
1134
1178
|
//#endregion
|
|
1135
|
-
//#region lib/types/
|
|
1136
|
-
/** Test
|
|
1179
|
+
//#region lib/types/config-form.js
|
|
1180
|
+
/** Test doubles for settings transport. */
|
|
1137
1181
|
/**
|
|
1138
1182
|
* Build an in-memory settings scope for service specs: starts in the host
|
|
1139
1183
|
* loading state, records writes, and lets the test publish Host acceptances.
|
|
1140
1184
|
* @returns the stub handle.
|
|
1141
1185
|
*/
|
|
1142
|
-
function
|
|
1186
|
+
function stubConfigForm() {
|
|
1143
1187
|
let snapshot = {
|
|
1144
1188
|
status: "loading",
|
|
1145
1189
|
value: void 0,
|
|
@@ -1150,9 +1194,9 @@ function stubSettingsScope() {
|
|
|
1150
1194
|
mode: "host"
|
|
1151
1195
|
};
|
|
1152
1196
|
const listeners = /* @__PURE__ */ new Set();
|
|
1153
|
-
const set = vi.fn(() => Promise.resolve());
|
|
1154
|
-
const mutate = vi.fn(() => Promise.resolve());
|
|
1155
|
-
const unset = vi.fn(() => Promise.resolve());
|
|
1197
|
+
const set = vi.fn(() => Promise.resolve(true));
|
|
1198
|
+
const mutate = vi.fn(() => Promise.resolve(true));
|
|
1199
|
+
const unset = vi.fn(() => Promise.resolve(true));
|
|
1156
1200
|
return {
|
|
1157
1201
|
scope: {
|
|
1158
1202
|
getSnapshot: () => snapshot,
|
|
@@ -1589,4 +1633,4 @@ var SlotTestRuntime = class SlotTestRuntime {
|
|
|
1589
1633
|
}
|
|
1590
1634
|
};
|
|
1591
1635
|
//#endregion
|
|
1592
|
-
export { FixtureSession, RemoteError, SlotTestRuntime, TestRemote, TestRoot, TestSessions, TestWorkspaces, bindSnapshotSelector, chatSnapshot, conversationSnapshot, createSlotRenderer, domSnapshotSerializer, makeTranslate, registerDomSnapshotSerializer, sessionSnapshot,
|
|
1636
|
+
export { FixtureSession, RemoteError, SlotTestRuntime, TestRemote, TestRoot, TestSessions, TestWorkspaces, bindSnapshotSelector, chatSnapshot, conversationSnapshot, createSlotRenderer, domSnapshotSerializer, makeTranslate, registerDomSnapshotSerializer, sessionSnapshot, stubConfigForm, usePinnedBrowserLanguages, workspaceSnapshot };
|
|
@@ -5,11 +5,12 @@ export declare const WEB_PROFILE_BUNDLES: readonly string[];
|
|
|
5
5
|
* Compose the browser roster of `bundles`, applied in order.
|
|
6
6
|
* @param bundles - bundle package names in application order.
|
|
7
7
|
* @param anchor - file whose package resolution locates the bundles; default this package.
|
|
8
|
+
* @param disabledContext - optional Loader evaluation scope for trusted `disabled` expressions.
|
|
8
9
|
* @returns the roster in composition order, one row per package.
|
|
9
10
|
* @throws {Error} when a bundle, its patch file, or an enabled row's package does not resolve, when the patch list
|
|
10
|
-
* is not a list or does not apply as written, or when a browser row
|
|
11
|
+
* is not a list or does not apply as written, or when a browser row has an unevaluated `disabled` expression.
|
|
11
12
|
*/
|
|
12
|
-
export declare function bundleRoster(bundles: readonly string[], anchor?: string): ClientRoster;
|
|
13
|
-
/** The `web` profile's browser roster, composed
|
|
13
|
+
export declare function bundleRoster(bundles: readonly string[], anchor?: string, disabledContext?: object): ClientRoster;
|
|
14
|
+
/** The `web` profile's browser roster, composed with its profile name and no business Host services. */
|
|
14
15
|
export declare const webApp: ClientRoster;
|
|
15
16
|
//# sourceMappingURL=bundle-roster.d.ts.map
|
|
@@ -18,10 +18,10 @@ export interface ClientRosterRow {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Synthesize the raw `WebBootGraph` for `rows`: one `application` batch
|
|
21
|
-
* holding every row, `rev: 'local'`, placeholder
|
|
22
|
-
*
|
|
23
|
-
* stays with the production `parseBootManifest` inside the module
|
|
24
|
-
* duplicate names and an empty roster are rejected there, not here.
|
|
21
|
+
* holding every row, `rev: 'local'`, placeholder `plugins/<name>/client.js`
|
|
22
|
+
* references, since every module is seeded in process and never fetched.
|
|
23
|
+
* Validation stays with the production `parseBootManifest` inside the module
|
|
24
|
+
* system: duplicate names and an empty roster are rejected there, not here.
|
|
25
25
|
* @param rows - roster rows in composition order.
|
|
26
26
|
* @returns the unparsed graph, as `createClientModuleSystem` consumes it.
|
|
27
27
|
*/
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/** Test
|
|
1
|
+
/** Test doubles for settings transport. */
|
|
2
2
|
import { vi } from 'vitest';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ConfigForm, ConfigFormSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
4
4
|
/** Handle over one stubbed scope: the scope, its write spy, and publication controls. */
|
|
5
|
-
export interface
|
|
5
|
+
export interface StubConfigForm<T> {
|
|
6
6
|
/** The scope face handed to the service under test. */
|
|
7
|
-
scope:
|
|
7
|
+
scope: ConfigForm<T>;
|
|
8
8
|
/** Spy behind `scope.set`; resolves immediately. */
|
|
9
9
|
set: ReturnType<typeof vi.fn>;
|
|
10
10
|
/** Spy behind `scope.mutate`; resolves immediately. */
|
|
11
|
-
mutate: ReturnType<typeof vi.fn
|
|
11
|
+
mutate: ReturnType<typeof vi.fn<ConfigForm<T>['mutate']>>;
|
|
12
12
|
/** Spy behind `scope.unset`; resolves immediately. */
|
|
13
13
|
unset: ReturnType<typeof vi.fn>;
|
|
14
14
|
/** @returns how many listeners are currently subscribed (disposal assertions). */
|
|
@@ -18,12 +18,12 @@ export interface StubSettingsScope<T> {
|
|
|
18
18
|
* acceptance would.
|
|
19
19
|
* @param next - snapshot fields to replace.
|
|
20
20
|
*/
|
|
21
|
-
publish(next: Partial<
|
|
21
|
+
publish(next: Partial<ConfigFormSnapshot<T>>): void;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Build an in-memory settings scope for service specs: starts in the host
|
|
25
25
|
* loading state, records writes, and lets the test publish Host acceptances.
|
|
26
26
|
* @returns the stub handle.
|
|
27
27
|
*/
|
|
28
|
-
export declare function
|
|
29
|
-
//# sourceMappingURL=
|
|
28
|
+
export declare function stubConfigForm<T>(): StubConfigForm<T>;
|
|
29
|
+
//# sourceMappingURL=config-form.d.ts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ import type { Stabilizer } from './fixtures.ts';
|
|
|
27
27
|
export type { UseSession } from '@deepseek-ai/dsh-client-ui-session/client';
|
|
28
28
|
export { domSnapshotSerializer, registerDomSnapshotSerializer } from './snapshot.ts';
|
|
29
29
|
export { FixtureSession, TestSessions } from './sessions.ts';
|
|
30
|
-
export {
|
|
31
|
-
export type {
|
|
30
|
+
export { stubConfigForm } from './config-form.ts';
|
|
31
|
+
export type { StubConfigForm } from './config-form.ts';
|
|
32
32
|
export { TestWorkspaces } from './workspaces.ts';
|
|
33
33
|
export { RemoteError, TestRemote } from './remote.ts';
|
|
34
34
|
export { chatSnapshot, conversationSnapshot, sessionSnapshot, workspaceSnapshot, } from './fixtures.ts';
|
package/lib/types/sessions.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export declare class TestSessions implements ISessions {
|
|
|
120
120
|
private closed;
|
|
121
121
|
/** Calls observed on the service-level face, newest last. */
|
|
122
122
|
readonly calls: {
|
|
123
|
-
method: 'create' | '
|
|
123
|
+
method: 'create' | 'refreshProjections' | 'refresh' | 'search' | 'fork';
|
|
124
124
|
args: unknown[];
|
|
125
125
|
}[];
|
|
126
126
|
/** The wire schema's `session.search` result bound (production parity). */
|
|
@@ -229,10 +229,8 @@ export declare class TestSessions implements ISessions {
|
|
|
229
229
|
create(opts?: Parameters<ISessions['create']>[0]): Promise<SessionId>;
|
|
230
230
|
/** Resolve a retained or catalog-derived address independently of a view. */
|
|
231
231
|
subagentAddress(id: SessionId): SubagentAddress | undefined;
|
|
232
|
-
/** Record
|
|
233
|
-
|
|
234
|
-
/** Record a catalog refresh; fixture callers drive snapshots explicitly. */
|
|
235
|
-
refreshSubagents(parentSessionId: SessionId): Promise<void>;
|
|
232
|
+
/** Record a projection refresh; fixture callers drive snapshots explicitly. */
|
|
233
|
+
refreshProjections(sessionId: SessionId): Promise<void>;
|
|
236
234
|
/** Record a list refresh; fixture callers publish list state explicitly. */
|
|
237
235
|
refresh(): Promise<void>;
|
|
238
236
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IWorkspaces, WorkspaceId, WorkspaceSnapshot, WorkspaceView } from '@deepseek-ai/dsh-api-workspace-controller/client';
|
|
1
|
+
import type { IWorkspaces, WorkspaceId, WorkspaceInitializeDefaultRequest, WorkspaceSnapshot, WorkspaceView } from '@deepseek-ai/dsh-api-workspace-controller/client';
|
|
2
2
|
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
3
3
|
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
4
4
|
import type { FixtureSnapshot, Stabilizer } from './fixtures.ts';
|
|
@@ -52,6 +52,13 @@ export declare class TestWorkspaces implements IWorkspaces {
|
|
|
52
52
|
create(input: {
|
|
53
53
|
path: string;
|
|
54
54
|
}): Promise<WorkspaceView>;
|
|
55
|
+
/**
|
|
56
|
+
* Initialize the default Workspace through a test stub; defaults to an ineligible first use.
|
|
57
|
+
* @param request - initial directory name and title.
|
|
58
|
+
* @param signal - caller lifetime.
|
|
59
|
+
* @returns the stubbed Workspace, or undefined when initialization is ineligible.
|
|
60
|
+
*/
|
|
61
|
+
initializeDefault(request: WorkspaceInitializeDefaultRequest, signal?: AbortSignal): Promise<WorkspaceView | undefined>;
|
|
55
62
|
/**
|
|
56
63
|
* Rename a Workspace (recorded). The default echoes a minimal view.
|
|
57
64
|
* @param workspaceId - target workspace.
|
|
@@ -90,6 +97,18 @@ export declare class TestWorkspaces implements IWorkspaces {
|
|
|
90
97
|
* @param sessionId - session to unarchive.
|
|
91
98
|
*/
|
|
92
99
|
unarchiveSession(sessionId: SessionId): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Pin a session (recorded). The default mirrors the production face's
|
|
102
|
+
* observable effect: the id leads the list state's pin set.
|
|
103
|
+
* @param sessionId - session to pin.
|
|
104
|
+
*/
|
|
105
|
+
pinSession(sessionId: SessionId): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Unpin a session (recorded). The default mirrors the production face's
|
|
108
|
+
* observable effect: the id leaves the list state's pin set.
|
|
109
|
+
* @param sessionId - session to unpin.
|
|
110
|
+
*/
|
|
111
|
+
unpinSession(sessionId: SessionId): Promise<void>;
|
|
93
112
|
}
|
|
94
113
|
export {};
|
|
95
114
|
//# sourceMappingURL=workspaces.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-client-test-runtime",
|
|
3
3
|
"description": "Browser test runtimes: a jsdom slot bench with test-owned Session and Workspace doubles, and a whole-client tier that boots the web roster through the production bootClient over an endpoint-named Remote mock",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,28 +31,28 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "^18.2.0",
|
|
33
33
|
"react-dom": "^18.2.0",
|
|
34
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
35
|
-
"@deepseek-ai/cordis-plugin-
|
|
36
|
-
"@deepseek-ai/
|
|
37
|
-
"@deepseek-ai/dsh-api-
|
|
38
|
-
"@deepseek-ai/dsh-
|
|
39
|
-
"@deepseek-ai/dsh-api-
|
|
40
|
-
"@deepseek-ai/dsh-
|
|
41
|
-
"@deepseek-ai/dsh-client-hmr": "^0.1.
|
|
42
|
-
"@deepseek-ai/dsh-client-
|
|
43
|
-
"@deepseek-ai/dsh-client-ui-chat": "^0.1.
|
|
44
|
-
"@deepseek-ai/dsh-client-ui-
|
|
45
|
-
"@deepseek-ai/dsh-client-ui-
|
|
46
|
-
"@deepseek-ai/dsh-client-ui-
|
|
47
|
-
"@deepseek-ai/
|
|
48
|
-
"@deepseek-ai/dsh-client-ui-
|
|
49
|
-
"@deepseek-ai/dsh-client-
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
54
|
-
"@deepseek-ai/dsh-
|
|
55
|
-
"@deepseek-ai/dsh-
|
|
34
|
+
"@deepseek-ai/cordis": "^4.0.3",
|
|
35
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.4",
|
|
36
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.1.7-alpha.1",
|
|
37
|
+
"@deepseek-ai/dsh-api-workspace-controller": "^0.1.7-alpha.1",
|
|
38
|
+
"@deepseek-ai/dsh-attachment": "^0.1.7-alpha.1",
|
|
39
|
+
"@deepseek-ai/dsh-api-gateway": "^0.1.7-alpha.1",
|
|
40
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.7-alpha.1",
|
|
41
|
+
"@deepseek-ai/dsh-client-hmr": "^0.1.7-alpha.1",
|
|
42
|
+
"@deepseek-ai/dsh-client-modules": "^0.1.7-alpha.1",
|
|
43
|
+
"@deepseek-ai/dsh-client-ui-chat": "^0.1.7-alpha.1",
|
|
44
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.7-alpha.1",
|
|
45
|
+
"@deepseek-ai/dsh-client-ui-session": "^0.1.7-alpha.1",
|
|
46
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-alpha.1",
|
|
47
|
+
"@deepseek-ai/cordis-plugin-include": "^1.0.8",
|
|
48
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.7-alpha.1",
|
|
49
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.7-alpha.1",
|
|
50
|
+
"@deepseek-ai/dsh-session": "^0.1.7-alpha.1",
|
|
51
|
+
"@deepseek-ai/dsh-client-web": "^0.1.7-alpha.1",
|
|
52
|
+
"@deepseek-ai/dsh-remote-mock": "^0.1.7-alpha.1",
|
|
53
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.7-alpha.1",
|
|
54
|
+
"@deepseek-ai/dsh-subagent": "^0.1.7-alpha.1",
|
|
55
|
+
"@deepseek-ai/dsh-client-store": "^0.1.7-alpha.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -60,34 +60,34 @@
|
|
|
60
60
|
"@types/react-dom": "~18.3.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
64
|
-
"@deepseek-ai/cordis-plugin-include": "^1.0.
|
|
65
|
-
"@deepseek-ai/cordis-plugin-loader": "^1.0.
|
|
66
|
-
"@deepseek-ai/dsh-api-
|
|
67
|
-
"@deepseek-ai/dsh-api-
|
|
68
|
-
"@deepseek-ai/dsh-api-
|
|
69
|
-
"@deepseek-ai/dsh-
|
|
70
|
-
"@deepseek-ai/dsh-
|
|
71
|
-
"@deepseek-ai/dsh-base": "^0.1.
|
|
72
|
-
"@deepseek-ai/dsh-client-
|
|
73
|
-
"@deepseek-ai/dsh-client-
|
|
74
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
75
|
-
"@deepseek-ai/dsh-client-modules": "^0.1.
|
|
76
|
-
"@deepseek-ai/dsh-client-
|
|
77
|
-
"@deepseek-ai/dsh-client-
|
|
78
|
-
"@deepseek-ai/dsh-client-ui-
|
|
79
|
-
"@deepseek-ai/dsh-client-ui-
|
|
80
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.
|
|
81
|
-
"@deepseek-ai/dsh-client-ui-session": "^0.1.
|
|
82
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.1.
|
|
83
|
-
"@deepseek-ai/dsh-client-
|
|
84
|
-
"@deepseek-ai/dsh-
|
|
85
|
-
"@deepseek-ai/dsh-
|
|
86
|
-
"@deepseek-ai/dsh-
|
|
87
|
-
"@deepseek-ai/dsh-
|
|
88
|
-
"@deepseek-ai/dsh-
|
|
89
|
-
"@deepseek-ai/dsh-
|
|
90
|
-
"@deepseek-ai/dsh-
|
|
63
|
+
"@deepseek-ai/cordis": "^4.0.3",
|
|
64
|
+
"@deepseek-ai/cordis-plugin-include": "^1.0.8",
|
|
65
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.4",
|
|
66
|
+
"@deepseek-ai/dsh-api-gateway": "^0.1.7-alpha.1",
|
|
67
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.7-alpha.1",
|
|
68
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.1.7-alpha.1",
|
|
69
|
+
"@deepseek-ai/dsh-attachment": "^0.1.7-alpha.1",
|
|
70
|
+
"@deepseek-ai/dsh-api-workspace-controller": "^0.1.7-alpha.1",
|
|
71
|
+
"@deepseek-ai/dsh-base": "^0.1.7-alpha.1",
|
|
72
|
+
"@deepseek-ai/dsh-client-hmr": "^0.1.7-alpha.1",
|
|
73
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.7-alpha.1",
|
|
74
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.7-alpha.1",
|
|
75
|
+
"@deepseek-ai/dsh-client-modules": "^0.1.7-alpha.1",
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.7-alpha.1",
|
|
77
|
+
"@deepseek-ai/dsh-client-store": "^0.1.7-alpha.1",
|
|
78
|
+
"@deepseek-ai/dsh-client-ui-layout": "^0.1.7-alpha.1",
|
|
79
|
+
"@deepseek-ai/dsh-client-ui-chat": "^0.1.7-alpha.1",
|
|
80
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-alpha.1",
|
|
81
|
+
"@deepseek-ai/dsh-client-ui-session": "^0.1.7-alpha.1",
|
|
82
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.7-alpha.1",
|
|
83
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.7-alpha.1",
|
|
84
|
+
"@deepseek-ai/dsh-client-web": "^0.1.7-alpha.1",
|
|
85
|
+
"@deepseek-ai/dsh-remote-mock": "^0.1.7-alpha.1",
|
|
86
|
+
"@deepseek-ai/dsh-session": "^0.1.7-alpha.1",
|
|
87
|
+
"@deepseek-ai/dsh-settings": "^0.1.7-alpha.1",
|
|
88
|
+
"@deepseek-ai/dsh-subagent": "^0.1.7-alpha.1",
|
|
89
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.7-alpha.1",
|
|
90
|
+
"@deepseek-ai/dsh-web-app": "^0.1.7-alpha.1"
|
|
91
91
|
},
|
|
92
92
|
"files": [
|
|
93
93
|
"lib/index.js",
|