dsh-sticky-user-bubble 0.1.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 +64 -0
- package/LICENSE +21 -0
- package/PUBLISHING.md +26 -0
- package/README.md +92 -0
- package/client.js +1396 -0
- package/cordis.patch.yml +3 -0
- package/lib/index.js +77 -0
- package/package.json +74 -0
package/cordis.patch.yml
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { readFileSync, realpathSync } from 'node:fs'
|
|
2
|
+
import { dirname, join } from 'node:path'
|
|
3
|
+
|
|
4
|
+
export const PLUGIN_NAME = 'dsh-sticky-user-bubble'
|
|
5
|
+
export const inject = []
|
|
6
|
+
export const DSH_COMPATIBILITY_RANGE = '>=0.1.6-alpha.1 <0.1.7'
|
|
7
|
+
const VERIFIED_DSH_VERSIONS = new Set(['0.1.6-alpha.1'])
|
|
8
|
+
const DSH_VERSION_PATTERN = /^0\.1\.6(?:-(alpha|beta|rc)\.(0|[1-9]\d*))?$/u
|
|
9
|
+
const DSH_PRERELEASE_ORDER = { alpha: 0, beta: 1, rc: 2 }
|
|
10
|
+
|
|
11
|
+
export function classifyDshVersion(version) {
|
|
12
|
+
if (typeof version !== 'string') return { supported: false, verified: false }
|
|
13
|
+
const normalized = version.split('+', 1)[0]
|
|
14
|
+
const match = DSH_VERSION_PATTERN.exec(normalized)
|
|
15
|
+
if (match === null) return { supported: false, verified: false, normalized }
|
|
16
|
+
const supported = match[1] === undefined
|
|
17
|
+
|| DSH_PRERELEASE_ORDER[match[1]] > DSH_PRERELEASE_ORDER.alpha
|
|
18
|
+
|| Number(match[2]) >= 1
|
|
19
|
+
return { supported, verified: supported && VERIFIED_DSH_VERSIONS.has(normalized), normalized }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function readDshPackage(entryPath = process.argv[1]) {
|
|
23
|
+
if (typeof entryPath !== 'string' || entryPath.trim() === '') {
|
|
24
|
+
throw new Error('cannot locate the DSH CLI entry path')
|
|
25
|
+
}
|
|
26
|
+
let directory = dirname(realpathSync(entryPath))
|
|
27
|
+
for (let depth = 0; depth < 4; depth += 1) {
|
|
28
|
+
const manifestPath = join(directory, 'package.json')
|
|
29
|
+
try {
|
|
30
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'))
|
|
31
|
+
if (manifest?.name === '@deepseek-ai/dsh') {
|
|
32
|
+
if (typeof manifest.version !== 'string' || manifest.version.trim() === '') {
|
|
33
|
+
throw new Error('@deepseek-ai/dsh package.json has no version')
|
|
34
|
+
}
|
|
35
|
+
return { name: manifest.name, version: manifest.version }
|
|
36
|
+
}
|
|
37
|
+
} catch (error) {
|
|
38
|
+
if (error instanceof SyntaxError) throw new Error(`cannot parse ${manifestPath}: ${error.message}`)
|
|
39
|
+
if (error?.code !== 'ENOENT' && error?.code !== 'ENOTDIR') throw error
|
|
40
|
+
}
|
|
41
|
+
const parent = dirname(directory)
|
|
42
|
+
if (parent === directory) break
|
|
43
|
+
directory = parent
|
|
44
|
+
}
|
|
45
|
+
throw new Error('cannot locate @deepseek-ai/dsh/package.json from the DSH CLI entry')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function applyForVersion(ctx, version) {
|
|
49
|
+
const compatibility = classifyDshVersion(version)
|
|
50
|
+
if (!compatibility.supported) {
|
|
51
|
+
ctx?.logger?.warn?.(`${PLUGIN_NAME}: DSH ${version} is outside ${DSH_COMPATIBILITY_RANGE}; plugin remains inert`)
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
if (!compatibility.verified) {
|
|
55
|
+
ctx?.logger?.warn?.(`${PLUGIN_NAME}: DSH ${version} is inside ${DSH_COMPATIBILITY_RANGE} but is not individually verified; client capability checks remain authoritative`)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// The feature lives entirely in the Web client. The Host half is intentionally
|
|
60
|
+
// inert, but still verifies the running DSH release before participating in the
|
|
61
|
+
// normal bundle lifecycle.
|
|
62
|
+
export function apply(ctx) {
|
|
63
|
+
let manifest
|
|
64
|
+
try {
|
|
65
|
+
manifest = readDshPackage(process.argv[1])
|
|
66
|
+
} catch (error) {
|
|
67
|
+
ctx?.logger?.error?.(`${PLUGIN_NAME}: cannot verify the running DSH package; plugin remains inert: ${error instanceof Error ? error.message : String(error)}`)
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
return applyForVersion(ctx, manifest.version)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default {
|
|
74
|
+
name: PLUGIN_NAME,
|
|
75
|
+
inject,
|
|
76
|
+
apply
|
|
77
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-sticky-user-bubble",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/zhaoliang233/dsh-plugins.git",
|
|
7
|
+
"directory": "dsh-sticky-user-bubble"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/zhaoliang233/dsh-plugins/tree/main/dsh-sticky-user-bubble#readme",
|
|
10
|
+
"bugs": "https://github.com/zhaoliang233/dsh-plugins/issues",
|
|
11
|
+
"description": "阅读长对话时把已滚出对话顶部的用户气泡固定在阅读区顶部。",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "lib/index.js",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": "./lib/index.js",
|
|
16
|
+
"./client": "./client.js",
|
|
17
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
20
|
+
"dshCompatibility": {
|
|
21
|
+
"policy": "compatible-release-line",
|
|
22
|
+
"package": "@deepseek-ai/dsh",
|
|
23
|
+
"range": ">=0.1.6-alpha.1 <0.1.7",
|
|
24
|
+
"verifiedVersions": [
|
|
25
|
+
"0.1.6-alpha.1"
|
|
26
|
+
],
|
|
27
|
+
"futureVersionsRequireCapabilityChecks": true
|
|
28
|
+
},
|
|
29
|
+
"dsh": {
|
|
30
|
+
"bundle": {
|
|
31
|
+
"patch": "./cordis.patch.yml"
|
|
32
|
+
},
|
|
33
|
+
"client": {
|
|
34
|
+
"platform": "web",
|
|
35
|
+
"inject": [
|
|
36
|
+
"@deepseek-ai/dsh-client-ui-chat"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"lib",
|
|
42
|
+
"client.js",
|
|
43
|
+
"cordis.patch.yml",
|
|
44
|
+
"README.md",
|
|
45
|
+
"CHANGELOG.md",
|
|
46
|
+
"PUBLISHING.md",
|
|
47
|
+
"LICENSE"
|
|
48
|
+
],
|
|
49
|
+
"scripts": {
|
|
50
|
+
"check": "node --check lib/index.js && node --check client.js && node --check scripts/check-pack.js && bash -n install.sh && bash -n uninstall.sh",
|
|
51
|
+
"test": "node --test test/*.test.js",
|
|
52
|
+
"pack:check": "node scripts/check-pack.js",
|
|
53
|
+
"publish:check": "npm run check && npm test && npm run pack:check",
|
|
54
|
+
"prepublishOnly": "npm run publish:check"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=20",
|
|
58
|
+
"dsh": ">=0.1.6-alpha.1 <0.1.7"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"keywords": [
|
|
65
|
+
"deepseek-harness",
|
|
66
|
+
"dsh",
|
|
67
|
+
"dsh-plugin",
|
|
68
|
+
"cordis",
|
|
69
|
+
"chat",
|
|
70
|
+
"conversation",
|
|
71
|
+
"bubble",
|
|
72
|
+
"scroll"
|
|
73
|
+
]
|
|
74
|
+
}
|