dsh-keys-manager 0.2.1 → 0.2.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/CHANGELOG.md +97 -0
- package/README.md +108 -15
- package/README.zh-CN.md +80 -2
- package/bundle/cordis.patch.yml +5 -2
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/types.d.ts +27 -2
- package/lib/client/ui.d.ts +14 -0
- package/lib/client.js +445 -18
- package/lib/domain.d.ts +63 -0
- package/lib/host-types.d.ts +29 -0
- package/lib/index.d.ts +973 -45
- package/lib/index.js +4257 -332
- package/lib/index.js.map +1 -1
- package/lib/providers.js +426 -0
- package/lib/providers.js.map +1 -1
- package/lib/store.js +4 -0
- package/lib/store.js.map +1 -1
- package/locale/en.json +27 -1
- package/locale/zh.json +27 -1
- package/package.json +14 -12
- package/scripts/prepare-release.mjs +431 -154
- package/scripts/verify-install.mjs +156 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install/load integration evidence.
|
|
3
|
+
*
|
|
4
|
+
* Proves: packing this repository and installing the root tarball into a fresh
|
|
5
|
+
* DSH profile yields BOTH bundle components — the profile's node_modules
|
|
6
|
+
* resolves `dsh-keys-manager` and `dsh-llm-omp-transports`, and the composed
|
|
7
|
+
* profile tree (`dsh --profile <name> --dump-config`) contains both rows, so
|
|
8
|
+
* DSH's loader can mount two components from one installed plugin.
|
|
9
|
+
*
|
|
10
|
+
* Does NOT prove: the plugin-manager detail page and its enable/disable
|
|
11
|
+
* toggles (that rendering is DSH's own Web UI), or any Cursor network behavior.
|
|
12
|
+
*
|
|
13
|
+
* The run is fully local and needs no registry access: both tarballs come from
|
|
14
|
+
* `pnpm pack`, the root's `dsh-llm-omp-transports@^0.1.0` dependency is mapped
|
|
15
|
+
* to the local transports tarball through a profile override, and the profile
|
|
16
|
+
* keeps `autoInstallPeers: false` (DSH peers are provided by the installation).
|
|
17
|
+
* On this pnpm 12 the override lives in pnpm-workspace.yaml; the package.json
|
|
18
|
+
* `pnpm.overrides` copy keeps pnpm 9/10 working.
|
|
19
|
+
*
|
|
20
|
+
* Requires `pnpm` and `dsh` on PATH. Usage: node scripts/verify-install.mjs [--keep]
|
|
21
|
+
*/
|
|
22
|
+
import { execFile } from 'node:child_process'
|
|
23
|
+
import { access, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
|
|
24
|
+
import { tmpdir } from 'node:os'
|
|
25
|
+
import { dirname, join } from 'node:path'
|
|
26
|
+
import { fileURLToPath } from 'node:url'
|
|
27
|
+
import { promisify } from 'node:util'
|
|
28
|
+
|
|
29
|
+
const execFileAsync = promisify(execFile)
|
|
30
|
+
const repoRoot = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
31
|
+
const transportsDir = join(repoRoot, 'packages/llm-omp')
|
|
32
|
+
const TRANSPORTS = 'dsh-llm-omp-transports'
|
|
33
|
+
const PROFILE = 'install-proof'
|
|
34
|
+
/** The two loader rows the composed profile must carry. */
|
|
35
|
+
const ROWS = [
|
|
36
|
+
{ id: 'dsh-keys-manager', name: 'dsh-keys-manager' },
|
|
37
|
+
{ id: 'llm-omp-transports', name: TRANSPORTS },
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
async function run(command, args, options = {}) {
|
|
41
|
+
try {
|
|
42
|
+
return await execFileAsync(command, args, {
|
|
43
|
+
encoding: 'utf8',
|
|
44
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
45
|
+
...options,
|
|
46
|
+
})
|
|
47
|
+
} catch (error) {
|
|
48
|
+
const output = [error.stdout, error.stderr].filter(Boolean).join('\n')
|
|
49
|
+
throw new Error(`${command} ${args.join(' ')} failed (${error.code ?? 'error'}):\n${output}`)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function manifestOf(dir) {
|
|
54
|
+
return JSON.parse(await readFile(join(dir, 'package.json'), 'utf8'))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** One loader row, quoted or plain, exactly once in the dumped tree. */
|
|
58
|
+
function assertRow(dump, { id, name }) {
|
|
59
|
+
const row = new RegExp(`^- id: ${id}\\n name: '?${name}'?$`, 'mu')
|
|
60
|
+
if (!row.test(dump)) throw new Error(`dump-config is missing the ${id} row:\n${dump}`)
|
|
61
|
+
const count = dump.split(`- id: ${id}\n`).length - 1
|
|
62
|
+
if (count !== 1) throw new Error(`dump-config carries the ${id} row ${count} times:\n${dump}`)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let work
|
|
66
|
+
try {
|
|
67
|
+
for (const command of ['pnpm', 'dsh']) await run(command, ['--version'])
|
|
68
|
+
|
|
69
|
+
work = await mkdtemp(join(tmpdir(), 'dsh-install-proof-'))
|
|
70
|
+
const artifacts = join(work, 'artifacts')
|
|
71
|
+
await mkdir(artifacts, { recursive: true })
|
|
72
|
+
|
|
73
|
+
const root = await manifestOf(repoRoot)
|
|
74
|
+
const transports = await manifestOf(transportsDir)
|
|
75
|
+
await run('pnpm', ['pack', '--pack-destination', artifacts], { cwd: repoRoot })
|
|
76
|
+
await run('pnpm', ['pack', '--pack-destination', artifacts], { cwd: transportsDir })
|
|
77
|
+
const rootTarball = join(artifacts, `${root.name}-${root.version}.tgz`)
|
|
78
|
+
const transportsTarball = join(artifacts, `${TRANSPORTS}-${transports.version}.tgz`)
|
|
79
|
+
await access(rootTarball)
|
|
80
|
+
await access(transportsTarball)
|
|
81
|
+
|
|
82
|
+
// A packed workspace dependency must be a registry range, not `workspace:^`.
|
|
83
|
+
// The transports package ships from the same release version, so the
|
|
84
|
+
// expected range follows its manifest rather than a pinned literal.
|
|
85
|
+
const expectedRange = `^${transports.version}`
|
|
86
|
+
const packed = JSON.parse((await run('tar', ['-xzOf', rootTarball, 'package/package.json'])).stdout)
|
|
87
|
+
const pinned = packed.dependencies?.[TRANSPORTS]
|
|
88
|
+
if (pinned !== expectedRange) {
|
|
89
|
+
throw new Error(`packed root dependency ${TRANSPORTS} is ${JSON.stringify(pinned)}, expected ${JSON.stringify(expectedRange)}`)
|
|
90
|
+
}
|
|
91
|
+
console.log(`install-proof: packed dependency ${TRANSPORTS} -> ${pinned}`)
|
|
92
|
+
|
|
93
|
+
// A fresh profile: `dsh plugin install` initializes it (and runs pnpm).
|
|
94
|
+
const home = join(work, 'home')
|
|
95
|
+
const profileDir = join(home, 'profiles', PROFILE)
|
|
96
|
+
const env = { ...process.env, DSH_HOME: home }
|
|
97
|
+
await run('dsh', ['plugin', '--profile', PROFILE, 'install'], { env })
|
|
98
|
+
|
|
99
|
+
// Map the root's registry dependency to the local tarball before installing.
|
|
100
|
+
const profileManifest = await manifestOf(profileDir)
|
|
101
|
+
profileManifest.pnpm = {
|
|
102
|
+
...profileManifest.pnpm,
|
|
103
|
+
overrides: { ...profileManifest.pnpm?.overrides, [TRANSPORTS]: `file:${transportsTarball}` },
|
|
104
|
+
}
|
|
105
|
+
await writeFile(join(profileDir, 'package.json'), `${JSON.stringify(profileManifest, undefined, 2)}\n`)
|
|
106
|
+
await writeFile(
|
|
107
|
+
join(profileDir, 'pnpm-workspace.yaml'),
|
|
108
|
+
[
|
|
109
|
+
'# Local tarball mapping for the install proof; the packed root asks for',
|
|
110
|
+
`# ${TRANSPORTS}@${expectedRange}, which no registry here serves.`,
|
|
111
|
+
'overrides:',
|
|
112
|
+
` ${TRANSPORTS}: ${JSON.stringify(`file:${transportsTarball}`)}`,
|
|
113
|
+
'packages:',
|
|
114
|
+
' - .',
|
|
115
|
+
'',
|
|
116
|
+
'nodeLinker: hoisted',
|
|
117
|
+
'autoInstallPeers: false',
|
|
118
|
+
'',
|
|
119
|
+
].join('\n'),
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
// The alias form (`name@file:...`) is what pnpm 12 accepts for tarballs.
|
|
123
|
+
await run('dsh', ['plugin', '--profile', PROFILE, 'add', `${root.name}@file:${rootTarball}`], {
|
|
124
|
+
cwd: work,
|
|
125
|
+
env,
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
const installed = await manifestOf(profileDir)
|
|
129
|
+
if (installed.dependencies?.[root.name] !== `file:${rootTarball}`) {
|
|
130
|
+
throw new Error(`profile does not depend on the packed root: ${JSON.stringify(installed.dependencies)}`)
|
|
131
|
+
}
|
|
132
|
+
if (!installed.dsh?.profile?.bundles?.includes(root.name)) {
|
|
133
|
+
throw new Error(`profile did not select ${root.name} as a bundle: ${JSON.stringify(installed.dsh)}`)
|
|
134
|
+
}
|
|
135
|
+
const versions = []
|
|
136
|
+
for (const name of [root.name, TRANSPORTS]) {
|
|
137
|
+
const manifest = JSON.parse(await readFile(join(profileDir, 'node_modules', name, 'package.json'), 'utf8'))
|
|
138
|
+
if (manifest.name !== name) throw new Error(`${name} resolves to ${JSON.stringify(manifest.name)}`)
|
|
139
|
+
versions.push(`${name}@${manifest.version}`)
|
|
140
|
+
}
|
|
141
|
+
console.log(`install-proof: both components installed: ${versions.join(' + ')}`)
|
|
142
|
+
|
|
143
|
+
const dump = (await run('dsh', ['--profile', PROFILE, '--dump-config'], { env })).stdout
|
|
144
|
+
for (const row of ROWS) assertRow(dump, row)
|
|
145
|
+
console.log('install-proof: dump-config rows:')
|
|
146
|
+
for (const { id, name } of ROWS) console.log(` - id: ${id}\n name: ${name}`)
|
|
147
|
+
console.log('install-proof: OK')
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error(`install-proof: FAILED: ${error instanceof Error ? error.message : String(error)}`)
|
|
150
|
+
process.exitCode = 1
|
|
151
|
+
} finally {
|
|
152
|
+
if (work !== undefined) {
|
|
153
|
+
if (process.argv.includes('--keep')) console.log(`install-proof: kept ${work}`)
|
|
154
|
+
else await rm(work, { recursive: true, force: true })
|
|
155
|
+
}
|
|
156
|
+
}
|