@deepseek-ai/dsh-plugin-package-inventory-deepseek 0.2.2-alpha.3 → 0.2.2-rc.2
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/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/types.d.ts.map +1 -0
- package/lib/types/types.js.map +1 -0
- package/package.json +23 -20
- package/src/index.ts +214 -0
- package/src/types.ts +19 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAWxC,mBAAmB,YAAY,CAAA;AAE/B,0BAA0B;AAC1B,eAAO,MAAM,IAAI,sCAAsC,CAAA;AACvD,0FAA0F;AAC1F,eAAO,MAAM,MAAM,UAAmD,CAAA;AAEtE,yDAAyD;AACzD,MAAM,WAAW,MAAM;IACrB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,mEAAmE;AACnE,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAE3B,CAAA;AA0JF;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAexD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAC5D,OAA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AQ,CAAC,qBAAqB,EAAE;QAC3D,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE;YACnB,MAAM,KAAK,GAA4C;gBACrD,OAAO,EAAE,CAAC;gBACV,QAAQ,EAAE,2BAA2B,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC;aACjG,CAAA;YACD,OAAO,EAAE,KAAK,EAAE,CAAA;QAClB,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,kEAAkE;AAClE,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,kFAAkF;AAClF,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAE,SAAS,6BAA6B,EAAE,CAAA;CAC5D;AAED,OAAO,QAAQ,oDAAoD,CAAC;IAClE,UAAU,0BAA0B;QAClC,mBAAmB,EAAE,uCAAuC,CAAA;KAC7D;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,mEAAmE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-plugin-package-inventory-deepseek",
|
|
3
3
|
"description": "Active Loader-backed plugin package inventory for official DeepSeek LLM API requests",
|
|
4
|
-
"version": "0.2.2-
|
|
4
|
+
"version": "0.2.2-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -30,20 +30,23 @@
|
|
|
30
30
|
"locale/*.json",
|
|
31
31
|
"lib/index.js",
|
|
32
32
|
"lib/types/**/*.js",
|
|
33
|
-
"lib/types/**/*.d.ts"
|
|
33
|
+
"lib/types/**/*.d.ts",
|
|
34
|
+
"lib/types/**/*.d.ts.map",
|
|
35
|
+
"lib/**/*.js.map",
|
|
36
|
+
"src"
|
|
34
37
|
],
|
|
35
38
|
"license": "MIT",
|
|
36
39
|
"dependencies": {
|
|
37
|
-
"@deepseek-ai/dsh-brand": "0.2.2-
|
|
38
|
-
"@deepseek-ai/schemastery": "~3.
|
|
40
|
+
"@deepseek-ai/dsh-brand": "0.2.2-rc.2",
|
|
41
|
+
"@deepseek-ai/schemastery": "~3.19.0"
|
|
39
42
|
},
|
|
40
43
|
"peerDependencies": {
|
|
41
|
-
"@deepseek-ai/cordis": "~4.0
|
|
42
|
-
"@deepseek-ai/cordis-plugin-loader": "~1.0
|
|
43
|
-
"@deepseek-ai/dsh-agent": "0.2.2-
|
|
44
|
-
"@deepseek-ai/dsh-agent-preset-registry": "0.2.2-
|
|
45
|
-
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.2-
|
|
46
|
-
"@deepseek-ai/dsh-session": "0.2.2-
|
|
44
|
+
"@deepseek-ai/cordis": "~4.1.0",
|
|
45
|
+
"@deepseek-ai/cordis-plugin-loader": "~1.1.0",
|
|
46
|
+
"@deepseek-ai/dsh-agent": "0.2.2-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.2-rc.2",
|
|
49
|
+
"@deepseek-ai/dsh-session": "0.2.2-rc.2"
|
|
47
50
|
},
|
|
48
51
|
"peerDependenciesMeta": {
|
|
49
52
|
"@deepseek-ai/dsh-agent-preset-registry": {
|
|
@@ -51,15 +54,15 @@
|
|
|
51
54
|
}
|
|
52
55
|
},
|
|
53
56
|
"devDependencies": {
|
|
54
|
-
"@deepseek-ai/dsh-app-boot": "0.2.2-
|
|
55
|
-
"@deepseek-ai/cordis": "~4.0
|
|
56
|
-
"@deepseek-ai/cordis-plugin-include": "~1.0
|
|
57
|
-
"@deepseek-ai/cordis-plugin-loader": "~1.0
|
|
58
|
-
"@deepseek-ai/dsh-agent": "0.2.2-
|
|
59
|
-
"@deepseek-ai/dsh-agent-preset-registry": "0.2.2-
|
|
60
|
-
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.2-
|
|
61
|
-
"@deepseek-ai/dsh-scope": "0.2.2-
|
|
62
|
-
"@deepseek-ai/dsh-session": "0.2.2-
|
|
63
|
-
"@deepseek-ai/dsh-session-projection": "0.2.2-
|
|
57
|
+
"@deepseek-ai/dsh-app-boot": "0.2.2-rc.2",
|
|
58
|
+
"@deepseek-ai/cordis": "~4.1.0",
|
|
59
|
+
"@deepseek-ai/cordis-plugin-include": "~1.1.0",
|
|
60
|
+
"@deepseek-ai/cordis-plugin-loader": "~1.1.0",
|
|
61
|
+
"@deepseek-ai/dsh-agent": "0.2.2-rc.2",
|
|
62
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.2",
|
|
63
|
+
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.2-rc.2",
|
|
64
|
+
"@deepseek-ai/dsh-scope": "0.2.2-rc.2",
|
|
65
|
+
"@deepseek-ai/dsh-session": "0.2.2-rc.2",
|
|
66
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.2"
|
|
64
67
|
}
|
|
65
68
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Active Loader-backed plugin package inventory for official DeepSeek requests.
|
|
3
|
+
* Host entries and the requesting agent's standing preset are resolved at request time;
|
|
4
|
+
* installed dependencies and plugin fibers without Loader-backed package identity are excluded.
|
|
5
|
+
* @module @deepseek-ai/dsh-plugin-package-inventory-deepseek
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
9
|
+
import { createRequire } from 'node:module'
|
|
10
|
+
import { dirname, isAbsolute, join, parse } from 'node:path'
|
|
11
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
12
|
+
import { FiberState, type Context } from '@deepseek-ai/cordis'
|
|
13
|
+
import z from '@deepseek-ai/schemastery'
|
|
14
|
+
import { brandString } from '@deepseek-ai/dsh-brand'
|
|
15
|
+
import type { EntryTree } from '@deepseek-ai/cordis-plugin-loader'
|
|
16
|
+
import type {} from '@deepseek-ai/dsh-agent'
|
|
17
|
+
import type {} from '@deepseek-ai/dsh-deepseek-llm-api-extensions'
|
|
18
|
+
import type { SessionId } from '@deepseek-ai/dsh-session'
|
|
19
|
+
import type {} from '@deepseek-ai/dsh-agent-preset-registry'
|
|
20
|
+
import type {} from '@deepseek-ai/dsh-app-boot'
|
|
21
|
+
import type { DeepSeekPluginPackageIdentity, DeepSeekPluginPackageInventoryExtension } from './types.ts'
|
|
22
|
+
import type {} from './types.ts'
|
|
23
|
+
|
|
24
|
+
export type * from './types.ts'
|
|
25
|
+
|
|
26
|
+
/** Cordis plugin name. */
|
|
27
|
+
export const name = 'plugin-package-inventory-deepseek'
|
|
28
|
+
/** Services required to locate host/requesting-agent entries and contribute the field. */
|
|
29
|
+
export const inject = ['agents', 'deepseekLlmApiExtensions', 'loader']
|
|
30
|
+
|
|
31
|
+
/** Plugin-package request contribution configuration. */
|
|
32
|
+
export interface Config {
|
|
33
|
+
/** Contribute `dsh_plugin_packages` to official DeepSeek requests. Defaults to `true`. */
|
|
34
|
+
enabled?: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Validated plugin-package request contribution configuration. */
|
|
38
|
+
export const Config: z<Config> = z.object({
|
|
39
|
+
enabled: z.boolean().default(true),
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
interface PackageManifest {
|
|
43
|
+
readonly name?: unknown
|
|
44
|
+
readonly version?: unknown
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface ActiveEntry {
|
|
48
|
+
readonly moduleName: string
|
|
49
|
+
readonly baseUrl?: string
|
|
50
|
+
/** Bare-package base used by the Loader path that activated this entry. */
|
|
51
|
+
readonly bareBaseUrl?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Parse a bare package or package-subpath specifier into its package name. */
|
|
55
|
+
function barePackageName(specifier: string): string | undefined {
|
|
56
|
+
if (specifier.startsWith('.') || specifier.includes(':') || isAbsolute(specifier)) return undefined
|
|
57
|
+
const [first = '', second = ''] = specifier.split('/')
|
|
58
|
+
// An active Loader entry already passed module resolution, so a scoped bare name has its package segment.
|
|
59
|
+
return first.startsWith('@') ? `${first}/${second}` : first
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Read a named identity, including its version only when it is a non-blank string. */
|
|
63
|
+
function identityFromManifest(path: string): DeepSeekPluginPackageIdentity | undefined {
|
|
64
|
+
const manifest = JSON.parse(readFileSync(path, 'utf8')) as PackageManifest
|
|
65
|
+
if (typeof manifest.name !== 'string' || manifest.name.trim().length === 0) return undefined
|
|
66
|
+
return typeof manifest.version === 'string' && manifest.version.trim().length > 0
|
|
67
|
+
? { name: manifest.name, version: manifest.version }
|
|
68
|
+
: { name: manifest.name }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Resolve a bare package without requiring it to export `./package.json`. */
|
|
72
|
+
function barePackageManifest(
|
|
73
|
+
packageName: string, anchors: readonly string[], packages: Context['pluginPackages'] | undefined,
|
|
74
|
+
): string | undefined {
|
|
75
|
+
for (const anchor of anchors) {
|
|
76
|
+
const pkg = packages?.packageOf(packageName, anchor)
|
|
77
|
+
if (pkg !== undefined) return pkg.manifestPath
|
|
78
|
+
if (packages !== undefined) continue
|
|
79
|
+
for (const searchPath of createRequire(anchor).resolve.paths(packageName) as string[]) {
|
|
80
|
+
const manifest = join(searchPath, packageName, 'package.json')
|
|
81
|
+
if (existsSync(manifest)) return manifest
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return undefined
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Find the nearest owning manifest for a relative or absolute plugin module. */
|
|
88
|
+
function nearestManifest(modulePath: string): string | undefined {
|
|
89
|
+
let current = dirname(modulePath)
|
|
90
|
+
const root = parse(current).root
|
|
91
|
+
while (true) {
|
|
92
|
+
const manifest = join(current, 'package.json')
|
|
93
|
+
if (existsSync(manifest)) return manifest
|
|
94
|
+
if (current === root) return undefined
|
|
95
|
+
current = dirname(current)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Exact package identity resolver with immutable per-process manifest caching. */
|
|
100
|
+
class PackageIdentityResolver {
|
|
101
|
+
// TODO: Invalidate manifest identities if in-process package-version replacement becomes a supported upgrade path.
|
|
102
|
+
private readonly cache = new Map<string, DeepSeekPluginPackageIdentity | undefined>()
|
|
103
|
+
|
|
104
|
+
constructor(
|
|
105
|
+
private readonly hostBaseUrl: string,
|
|
106
|
+
private readonly packages: Context['pluginPackages'] | undefined,
|
|
107
|
+
) {}
|
|
108
|
+
|
|
109
|
+
/** Resolve one Loader entry's owning package, or absence for a non-package loose module. */
|
|
110
|
+
resolve({ moduleName, baseUrl, bareBaseUrl }: ActiveEntry): DeepSeekPluginPackageIdentity | undefined {
|
|
111
|
+
/* v8 ignore next -- Loader entry trees inherit a base URL; the fallback supports direct embedders. */
|
|
112
|
+
const treeBase = baseUrl ?? this.hostBaseUrl
|
|
113
|
+
const anchors = [...new Set([bareBaseUrl ?? treeBase, treeBase, this.hostBaseUrl, import.meta.url])]
|
|
114
|
+
const key = `${anchors.join('\u0000')}\u0000${moduleName}`
|
|
115
|
+
if (this.cache.has(key)) return this.cache.get(key)
|
|
116
|
+
|
|
117
|
+
const packageName = barePackageName(moduleName)
|
|
118
|
+
let manifest: string | undefined
|
|
119
|
+
if (packageName !== undefined) {
|
|
120
|
+
manifest = barePackageManifest(packageName, anchors, this.packages)
|
|
121
|
+
if (manifest === undefined) {
|
|
122
|
+
throw new Error(`plugin-package-inventory-deepseek: cannot resolve active package ${JSON.stringify(packageName)}`)
|
|
123
|
+
}
|
|
124
|
+
} else if (!moduleName.startsWith('cordis:')) {
|
|
125
|
+
const moduleUrl = isAbsolute(moduleName)
|
|
126
|
+
? pathToFileURL(moduleName)
|
|
127
|
+
: new URL(moduleName, treeBase)
|
|
128
|
+
if (moduleUrl.protocol === 'file:') manifest = nearestManifest(fileURLToPath(moduleUrl))
|
|
129
|
+
}
|
|
130
|
+
const identity = manifest === undefined ? undefined : identityFromManifest(manifest)
|
|
131
|
+
this.cache.set(key, identity)
|
|
132
|
+
return identity
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Yield active, non-structural entries from one Loader tree. */
|
|
137
|
+
function activeEntries(tree: EntryTree): ActiveEntry[] {
|
|
138
|
+
return [...tree.entries()]
|
|
139
|
+
.filter(entry => !entry.options.group
|
|
140
|
+
&& !entry.disabled
|
|
141
|
+
&& entry.fiber?.state === FiberState.ACTIVE)
|
|
142
|
+
.map(entry => ({
|
|
143
|
+
moduleName: entry.options.name,
|
|
144
|
+
...entry.parent.tree.ctx.baseUrl === undefined ? {} : { baseUrl: entry.parent.tree.ctx.baseUrl },
|
|
145
|
+
}))
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Deterministic text order independent of the host's ICU data and locale. */
|
|
149
|
+
function compareWireText(left: string, right: string): number {
|
|
150
|
+
return left < right ? -1 : left > right ? 1 : 0
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Collect available identities from active packages for one request. */
|
|
154
|
+
function collectActivePluginPackages(
|
|
155
|
+
ctx: Context,
|
|
156
|
+
resolver: PackageIdentityResolver,
|
|
157
|
+
hostBaseUrl: string,
|
|
158
|
+
unreadable: Set<string>,
|
|
159
|
+
sessionId?: string,
|
|
160
|
+
): DeepSeekPluginPackageIdentity[] {
|
|
161
|
+
const entries = activeEntries(ctx.loader)
|
|
162
|
+
const presets = ctx.get('agentPresets')
|
|
163
|
+
if (sessionId !== undefined && presets !== undefined) {
|
|
164
|
+
const agent = ctx.agents.get(brandString<SessionId>(sessionId))
|
|
165
|
+
if (agent !== undefined) {
|
|
166
|
+
for (const composition of presets.inspectCompositions(agent.ctx)) {
|
|
167
|
+
entries.push(...composition.modules.map(({ useHostBase, ...entry }) => ({
|
|
168
|
+
...entry,
|
|
169
|
+
...useHostBase ? { bareBaseUrl: hostBaseUrl } : {},
|
|
170
|
+
})))
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const unique = new Map<string, DeepSeekPluginPackageIdentity>()
|
|
175
|
+
for (const activeEntry of entries) {
|
|
176
|
+
let identity: DeepSeekPluginPackageIdentity | undefined
|
|
177
|
+
try {
|
|
178
|
+
identity = resolver.resolve(activeEntry)
|
|
179
|
+
} catch (error) {
|
|
180
|
+
if (!unreadable.has(activeEntry.moduleName)) {
|
|
181
|
+
unreadable.add(activeEntry.moduleName)
|
|
182
|
+
ctx.logger.warn('plugin-package-inventory-deepseek: omitting unreadable package identity for %s: %o', activeEntry.moduleName, error)
|
|
183
|
+
}
|
|
184
|
+
continue
|
|
185
|
+
}
|
|
186
|
+
if (identity === undefined) continue
|
|
187
|
+
unique.set(`${identity.name}\u0000${identity.version ?? ''}`, identity)
|
|
188
|
+
}
|
|
189
|
+
return [...unique.values()].sort((left, right) => (
|
|
190
|
+
compareWireText(left.name, right.name) || compareWireText(left.version ?? '', right.version ?? '')
|
|
191
|
+
))
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Register the complete `dsh_plugin_packages` request contribution when enabled.
|
|
196
|
+
* @param ctx - plugin context carrying Loader entry metadata and the DeepSeek request-extension registry.
|
|
197
|
+
* @param config - validated default-on configuration.
|
|
198
|
+
*/
|
|
199
|
+
export function apply(ctx: Context, config: Config): void {
|
|
200
|
+
if (config.enabled === false) return
|
|
201
|
+
const hostBaseUrl = ctx.baseUrl ?? import.meta.url
|
|
202
|
+
const resolver = new PackageIdentityResolver(hostBaseUrl, ctx.get('pluginPackages'))
|
|
203
|
+
// Unreadable identities are re-resolved on every request; log each module once.
|
|
204
|
+
const unreadable = new Set<string>()
|
|
205
|
+
ctx.deepseekLlmApiExtensions.register('dsh_plugin_packages', {
|
|
206
|
+
prepare: (request) => {
|
|
207
|
+
const value: DeepSeekPluginPackageInventoryExtension = {
|
|
208
|
+
version: 1,
|
|
209
|
+
packages: collectActivePluginPackages(ctx, resolver, hostBaseUrl, unreadable, request.sessionId),
|
|
210
|
+
}
|
|
211
|
+
return { value }
|
|
212
|
+
},
|
|
213
|
+
})
|
|
214
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Wire types for the active DeepSeek plugin package inventory. */
|
|
2
|
+
|
|
3
|
+
/** One active plugin package, with its version when available. */
|
|
4
|
+
export interface DeepSeekPluginPackageIdentity {
|
|
5
|
+
readonly name: string
|
|
6
|
+
readonly version?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Versioned full package inventory carried by each official DeepSeek request. */
|
|
10
|
+
export interface DeepSeekPluginPackageInventoryExtension {
|
|
11
|
+
readonly version: 1
|
|
12
|
+
readonly packages: readonly DeepSeekPluginPackageIdentity[]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare module '@deepseek-ai/dsh-deepseek-llm-api-extensions/types' {
|
|
16
|
+
interface DeepSeekLlmApiExtensionMap {
|
|
17
|
+
dsh_plugin_packages: DeepSeekPluginPackageInventoryExtension
|
|
18
|
+
}
|
|
19
|
+
}
|