Files
dsh-web/scripts/inject-contract.test.mjs
zhu1090093659 da32f628a5 feat(task-board): render the board through the native layout panel
Move the task board off its DOM takeover: the board now registers a
sidebar.panellist row and a keyed main page through the official slots
system, and the package-local panel-mount-core, sidebar-entry-core and
body-mutations copies are retired. The shared panel-mount-core returns to
the single ssh consumer with sibling activation names.

Also folds in the plugin-manager update-patch rework (the settings tab is
replaced by a patch row on the official Plugins page, plus the desktop
launch-profile repair) and the matching Agent Notes.

Committed as a checkpoint before merging origin/dev.
2026-09-26 16:14:14 +08:00

74 lines
3.0 KiB
JavaScript

import test from 'node:test'
import assert from 'node:assert/strict'
import { readdirSync, readFileSync, existsSync } from 'node:fs'
import { join, dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
const ROOT = dirname(dirname(fileURLToPath(import.meta.url)))
/**
* Pinned union of dsh.client.inject module ids across every workspace
* package. Approved for the 0.1.7-alpha.1 cohort: each name is a browser
* roster row of the shell composition (dsh-web-app cordis.patch.yml
* dsh.client rows) or a frozen static module (dsh-client-ui-slots;
* dsh-client-store needs no injection because its value imports ride the
* platform table). The 0.1.1-rc.2 set's dsh-client-runtime row is gone
* with its package; the api controller and api-remotes rows are the
* Typert Remote replacement faces. dsh-client-ui-workspace joined at
* 0.1.7-alpha.1: it is the ui-workspace row of dsh-web-app and the provider
* of the ctx.uiWorkspace service that replaced ISessions.open(), so the
* plugins that navigate the main view depend on its client half being
* loaded. dsh-client-ui-layout joined with the task board's native panel
* adoption: it is the ui-layout row of dsh-web-app and the owner of the keyed
* `main` seat plus the ctx.layout panel-navigation service the board selects
* its page through, so the row must be live before the board can contribute
* (the board's own registrations wait on the seat declaration either way).
* A rename, removal, or new inject name must update this list together with
* its runtime-module-table evidence.
*/
const APPROVED_INJECT_MODULES = [
'@deepseek-ai/dsh-api-remotes',
'@deepseek-ai/dsh-api-session-controller',
'@deepseek-ai/dsh-api-workspace-controller',
'@deepseek-ai/dsh-client-connection',
'@deepseek-ai/dsh-client-locale',
'@deepseek-ai/dsh-client-store',
'@deepseek-ai/dsh-client-ui-conversation',
'@deepseek-ai/dsh-client-ui-layout',
'@deepseek-ai/dsh-client-ui-renderer',
'@deepseek-ai/dsh-client-ui-settings',
'@deepseek-ai/dsh-client-ui-sidebar',
'@deepseek-ai/dsh-client-ui-slots',
'@deepseek-ai/dsh-client-ui-workspace',
]
function collectInjects() {
const files = []
for (const base of [join(ROOT, 'packages')]) {
if (!existsSync(base)) continue
for (const entry of readdirSync(base)) {
const pkg = join(base, entry, 'package.json')
if (existsSync(pkg)) files.push(pkg)
}
}
const names = new Set()
for (const file of files) {
const json = JSON.parse(readFileSync(file, 'utf8'))
for (const name of json?.dsh?.client?.inject ?? []) names.add(name)
}
return [...names].sort()
}
test('every dsh.client.inject name is an approved 0.1.7-alpha.1 client module', () => {
for (const name of collectInjects()) {
assert.ok(
APPROVED_INJECT_MODULES.includes(name),
`inject name outside the approved 0.1.7-alpha.1 module set: ${name}`,
)
}
})
test('the approved inject module set matches actual usage exactly', () => {
assert.deepEqual(collectInjects(), [...APPROVED_INJECT_MODULES].sort())
})