@deepseek-ai/dsh-host-plugin-inventory 0.2.2-rc.1 → 0.2.2-rc.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.
@@ -20,7 +20,7 @@ const _deepseek_ai_dsh_host_plugin_inventory_pluginInventory_list_result$schema
20
20
  'error': z.string().readonly().optional().describe('Unmodified local metadata diagnostic; the plugin remains manageable.'),
21
21
  }).readonly().optional().describe('Local package display metadata, independent of whether the entry is enabled.'),
22
22
  'enabled': z.boolean().readonly().describe('Effective Loader enablement, including disabled ancestor groups.'),
23
- 'fiberPhase': z.union([z.literal(null), z.literal("failed"), z.literal("active"), z.literal("pending"), z.literal("loading"), z.literal("unloading")]).readonly(),
23
+ 'fiberPhase': z.union([z.literal(null), z.literal("failed"), z.literal("pending"), z.literal("active"), z.literal("loading"), z.literal("unloading")]).readonly(),
24
24
  'diagnostic': z.string().readonly().optional().describe('Current startup failure message; absent when this entry has no failed fiber.'),
25
25
  })).readonly(),
26
26
  'agentPresets': z.array(z.object({
@@ -43,7 +43,7 @@ const _deepseek_ai_dsh_host_plugin_inventory_pluginInventory_list_result$schema
43
43
  }).readonly().optional().describe('Local package display metadata, independent of whether the preset is mounted.'),
44
44
  'enabled': z.union([z.literal(false), z.literal(true), z.literal("conditional")]).readonly().describe('Effective enablement, including disabled ancestor groups. `\'conditional\'` marks a `!!js` disabled expression on a composition no session has mounted, which only a Loader context can decide.'),
45
45
  'condition': z.string().readonly().optional().describe('The row\'s own `!!js` disabled expression, when it carries one.'),
46
- 'fiberPhase': z.union([z.literal(null), z.literal("failed"), z.literal("active"), z.literal("pending"), z.literal("loading"), z.literal("unloading")]).readonly().describe('Root-fiber phase when the composition is live; null otherwise.'),
46
+ 'fiberPhase': z.union([z.literal(null), z.literal("failed"), z.literal("pending"), z.literal("active"), z.literal("loading"), z.literal("unloading")]).readonly().describe('Root-fiber phase when the composition is live; null otherwise.'),
47
47
  })).readonly().describe('Plugin rows in composition order; empty when the preset is broken.'),
48
48
  })).readonly().optional().describe('Per-preset compositions, present only when an agent-preset roster is composed in this deployment.'),
49
49
  }))
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typert.remote-client.d.ts","names":["list"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;IAsEQA,I;;;IAAAA,sB","ignoreList":[]}
@@ -20,7 +20,7 @@ const _deepseek_ai_dsh_host_plugin_inventory_pluginInventory_list_result$schema
20
20
  'error': z.string().readonly().optional().describe('Unmodified local metadata diagnostic; the plugin remains manageable.'),
21
21
  }).readonly().optional().describe('Local package display metadata, independent of whether the entry is enabled.'),
22
22
  'enabled': z.boolean().readonly().describe('Effective Loader enablement, including disabled ancestor groups.'),
23
- 'fiberPhase': z.union([z.literal(null), z.literal("failed"), z.literal("active"), z.literal("pending"), z.literal("loading"), z.literal("unloading")]).readonly(),
23
+ 'fiberPhase': z.union([z.literal(null), z.literal("failed"), z.literal("pending"), z.literal("active"), z.literal("loading"), z.literal("unloading")]).readonly(),
24
24
  'diagnostic': z.string().readonly().optional().describe('Current startup failure message; absent when this entry has no failed fiber.'),
25
25
  })).readonly(),
26
26
  'agentPresets': z.array(z.object({
@@ -43,7 +43,7 @@ const _deepseek_ai_dsh_host_plugin_inventory_pluginInventory_list_result$schema
43
43
  }).readonly().optional().describe('Local package display metadata, independent of whether the preset is mounted.'),
44
44
  'enabled': z.union([z.literal(false), z.literal(true), z.literal("conditional")]).readonly().describe('Effective enablement, including disabled ancestor groups. `\'conditional\'` marks a `!!js` disabled expression on a composition no session has mounted, which only a Loader context can decide.'),
45
45
  'condition': z.string().readonly().optional().describe('The row\'s own `!!js` disabled expression, when it carries one.'),
46
- 'fiberPhase': z.union([z.literal(null), z.literal("failed"), z.literal("active"), z.literal("pending"), z.literal("loading"), z.literal("unloading")]).readonly().describe('Root-fiber phase when the composition is live; null otherwise.'),
46
+ 'fiberPhase': z.union([z.literal(null), z.literal("failed"), z.literal("pending"), z.literal("active"), z.literal("loading"), z.literal("unloading")]).readonly().describe('Root-fiber phase when the composition is live; null otherwise.'),
47
47
  })).readonly().describe('Plugin rows in composition order; empty when the preset is broken.'),
48
48
  })).readonly().optional().describe('Per-preset compositions, present only when an agent-preset roster is composed in this deployment.'),
49
49
  }))
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAA;AAK9D,OAAO,EAAE,mBAAmB,EAAU,MAAM,kCAAkC,CAAA;AAG9E,OAAO,KAAK,EAEV,aAAa,EAGb,uBAAuB,EACxB,MAAM,YAAY,CAAA;AAEnB,mBAAmB,YAAY,CAAA;AAE/B;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAE1D;AAsBD,+EAA+E;AAC/E,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,MAAM,CAAC,MAAM,WAAa;gBAEd,GAAG,EAAE,OAAO;IAIxB;;;;;;;;;;;OAWG;IAEG,IAAI,IAAI,OAAO,CAAC,uBAAuB,CAAC;CAG/C;AAED,eAAe,sBAAsB,CAAA;AAErC;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAuCxF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAa9E;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,KAAsB,CAAA;AAC/B,CAAC;AAED,gEAAgE;AAChE,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,CAAuB;IAChC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4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,SAAS,oBAAoB,EAAE,CAAA;CAC/C;AAED,uEAAuE;AACvE,MAAM,WAAW,uBAAuB;IACtC,uEAAuE;IACvE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,CAAA;IACjD;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAA;CAC1D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-host-plugin-inventory",
3
3
  "description": "Read-only Remote projection of current Cordis Loader plugin state",
4
- "version": "0.2.2-rc.1",
4
+ "version": "0.2.2-rc.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -39,20 +39,24 @@
39
39
  "lib/index.js",
40
40
  "lib/types/**/*.js",
41
41
  "lib/types/**/*.d.ts",
42
+ "lib/types/**/*.d.ts.map",
43
+ "lib/**/*.js.map",
42
44
  "lib/typert.host.js",
43
45
  "lib/typert.host.d.ts",
44
46
  "lib/typert.remote-client.js",
45
- "lib/typert.remote-client.d.ts"
47
+ "lib/typert.remote-client.d.ts",
48
+ "lib/typert.remote-client.d.ts.map",
49
+ "src"
46
50
  ],
47
51
  "license": "MIT",
48
52
  "dependencies": {
49
- "zod": "4.4.3"
53
+ "zod": "4.6.6"
50
54
  },
51
55
  "peerDependencies": {
52
56
  "@deepseek-ai/cordis-plugin-loader": "~1.1.0",
53
- "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.1",
54
- "@deepseek-ai/dsh-brand": "0.2.2-rc.1",
55
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.1",
57
+ "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.3",
58
+ "@deepseek-ai/dsh-brand": "0.2.2-rc.3",
59
+ "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.3",
56
60
  "@deepseek-ai/cordis": "~4.1.0"
57
61
  },
58
62
  "peerDependenciesMeta": {
@@ -61,12 +65,12 @@
61
65
  }
62
66
  },
63
67
  "devDependencies": {
64
- "@deepseek-ai/dsh-app-boot": "0.2.2-rc.1",
65
- "@deepseek-ai/dsh-package-manifest": "0.2.2-rc.1",
68
+ "@deepseek-ai/dsh-app-boot": "0.2.2-rc.3",
69
+ "@deepseek-ai/dsh-package-manifest": "0.2.2-rc.3",
66
70
  "@deepseek-ai/cordis-plugin-loader": "~1.1.0",
67
- "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.1",
68
- "@deepseek-ai/dsh-brand": "0.2.2-rc.1",
69
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.1",
71
+ "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.3",
72
+ "@deepseek-ai/dsh-brand": "0.2.2-rc.3",
73
+ "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.3",
70
74
  "@deepseek-ai/cordis": "~4.1.0"
71
75
  }
72
76
  }
package/src/index.ts ADDED
@@ -0,0 +1,121 @@
1
+ /** Read-only projection of the current Cordis Loader plugin entries. */
2
+
3
+ import type { Context, FiberState } from '@deepseek-ai/cordis'
4
+ import type {} from '@deepseek-ai/cordis-plugin-loader'
5
+ // Type-only: the optional agent-preset roster resolved through `ctx.get`.
6
+ import type {} from '@deepseek-ai/dsh-agent-preset-registry'
7
+ import type {} from '@deepseek-ai/dsh-app-boot'
8
+ import { TypertRemoteService, Remote } from '@deepseek-ai/dsh-typert-protocol'
9
+ // Typert-generated ./typert and ./remote artifacts import Zod at runtime.
10
+ import type {} from 'zod'
11
+ import type {
12
+ AgentPresetPluginGroup,
13
+ PluginEntryId,
14
+ PluginFiberPhase,
15
+ PluginInventoryEntry,
16
+ PluginInventorySnapshot,
17
+ } from './types.ts'
18
+
19
+ export type * from './types.ts'
20
+
21
+ /**
22
+ * Brand an existing Loader-tree entry id at the owning boundary.
23
+ * @param value - the entry id as the Loader tree spells it.
24
+ * @returns the same id as the inventory's branded entry id.
25
+ */
26
+ export function pluginEntryId(value: string): PluginEntryId {
27
+ return value as PluginEntryId
28
+ }
29
+
30
+ /** Runtime mirror: FiberState is a cross-package const enum. */
31
+ const FIBER_STATE = {
32
+ PENDING: 0 as FiberState.PENDING,
33
+ LOADING: 1 as FiberState.LOADING,
34
+ ACTIVE: 2 as FiberState.ACTIVE,
35
+ FAILED: 3 as FiberState.FAILED,
36
+ DISPOSED: 4 as FiberState.DISPOSED,
37
+ UNLOADING: 5 as FiberState.UNLOADING,
38
+ } as const
39
+
40
+ /** Complete public projection of Cordis Fiber states. */
41
+ const FIBER_PHASE = {
42
+ [FIBER_STATE.PENDING]: 'pending',
43
+ [FIBER_STATE.LOADING]: 'loading',
44
+ [FIBER_STATE.ACTIVE]: 'active',
45
+ [FIBER_STATE.FAILED]: 'failed',
46
+ [FIBER_STATE.DISPOSED]: null,
47
+ [FIBER_STATE.UNLOADING]: 'unloading',
48
+ } as const satisfies Record<FiberState, PluginFiberPhase>
49
+
50
+ /** Remote-only service exposing the Loader's current non-group entry state. */
51
+ export class PluginInventoryGateway extends TypertRemoteService {
52
+ static inject = ['loader']
53
+
54
+ constructor(ctx: Context) {
55
+ super(ctx, 'pluginInventory')
56
+ }
57
+
58
+ /**
59
+ * Read the Loader directly on every call. Cordis's internal plugin/status
60
+ * events already maintain Entry.fiber and Fiber.state, so a second cache
61
+ * would only add another lifecycle truth to keep synchronized.
62
+ *
63
+ * When an agent-preset roster is composed, the snapshot also carries each
64
+ * preset's composition rows, because those rows — not the Loader's own
65
+ * entries — are where a deployment that mounts the roster runs its
66
+ * model-facing plugins.
67
+ * @returns Current non-group Loader entries in Loader order, with optional display metadata
68
+ * and per-preset compositions when a roster is composed.
69
+ */
70
+ @Remote('list')
71
+ async list(): Promise<PluginInventorySnapshot> {
72
+ return readPluginInventory(this.ctx)
73
+ }
74
+ }
75
+
76
+ export default PluginInventoryGateway
77
+
78
+ /** Read current Loader entries and optional preset compositions.
79
+ * @param ctx Context with the Loader service.
80
+ * @returns Current inventory with optional display metadata and no separate runtime cache.
81
+ */
82
+ export async function readPluginInventory(ctx: Context): Promise<PluginInventorySnapshot> {
83
+ const entries: PluginInventoryEntry[] = []
84
+ const packages = ctx.get('pluginPackages')
85
+ for (const entry of ctx.loader.entries()) {
86
+ if (entry.options.group) continue
87
+ const base = entry.parent.tree.ctx.baseUrl
88
+ const meta = base === undefined ? undefined : packages?.metaOf(entry.options.name, base)
89
+ const fiber = entry.fiber
90
+ const fiberPhase = fiber === undefined ? null : FIBER_PHASE[fiber.state]
91
+ let diagnostic: string | undefined
92
+ if (fiber !== undefined && fiberPhase === 'failed') {
93
+ try { await fiber.await() } catch (error) { diagnostic = error instanceof Error ? error.message : String(error) }
94
+ }
95
+ entries.push({
96
+ entryId: pluginEntryId(entry.id),
97
+ moduleName: entry.options.name,
98
+ enabled: !entry.disabled,
99
+ fiberPhase,
100
+ ...diagnostic === undefined ? {} : { diagnostic },
101
+ ...meta === undefined ? {} : { meta },
102
+ })
103
+ }
104
+ const presets = ctx.get('agentPresets')
105
+ const management = ctx.get('pluginManager') === undefined ? {} : { managementAvailable: true }
106
+ if (presets === undefined) return { entries, ...management }
107
+ const agentPresets: AgentPresetPluginGroup[] = (await presets.compositionInventory()).map(
108
+ composition => ({
109
+ ...composition,
110
+ rows: composition.rows.map(({ fiberState, ...row }) => {
111
+ const meta = ctx.baseUrl === undefined ? undefined : packages?.metaOf(row.moduleName, ctx.baseUrl)
112
+ return {
113
+ ...row,
114
+ fiberPhase: fiberState === undefined ? null : FIBER_PHASE[fiberState],
115
+ ...meta === undefined ? {} : { meta },
116
+ }
117
+ }),
118
+ }),
119
+ )
120
+ return { entries, agentPresets, ...management }
121
+ }
package/src/types.ts ADDED
@@ -0,0 +1,77 @@
1
+ import type { Branded } from '@deepseek-ai/dsh-brand'
2
+ import type { PluginLocalizedMeta } from '@deepseek-ai/dsh-package-manifest'
3
+
4
+ /** Stable Loader-tree identity of one configured plugin entry. */
5
+ export type PluginEntryId = Branded<'PluginEntryId'>
6
+
7
+ /** Lifecycle state of an entry's root Fiber, or null when it has no live root Fiber. */
8
+ export type PluginFiberPhase =
9
+ | 'pending'
10
+ | 'loading'
11
+ | 'active'
12
+ | 'failed'
13
+ | 'unloading'
14
+ | null
15
+
16
+ /** One non-group Loader entry exposed to trusted clients. */
17
+ export interface PluginInventoryEntry {
18
+ readonly entryId: PluginEntryId
19
+ /** Exact module specifier imported by the Loader entry. */
20
+ readonly moduleName: string
21
+ /** Local package display metadata, independent of whether the entry is enabled. */
22
+ readonly meta?: PluginLocalizedMeta
23
+ /** Effective Loader enablement, including disabled ancestor groups. */
24
+ readonly enabled: boolean
25
+ readonly fiberPhase: PluginFiberPhase
26
+ /** Current startup failure message; absent when this entry has no failed fiber. */
27
+ readonly diagnostic?: string
28
+ }
29
+
30
+ /** Effective enablement of one preset composition row. */
31
+ export type PresetPluginEnablement = boolean | 'conditional'
32
+
33
+ /** One plugin row an agent preset's composition names. */
34
+ export interface AgentPresetPluginRow {
35
+ /** Composition row id, or null when the row declares none. */
36
+ readonly entryId: string | null
37
+ /** Module specifier the row names. */
38
+ readonly moduleName: string
39
+ /** Local package display metadata, independent of whether the preset is mounted. */
40
+ readonly meta?: PluginLocalizedMeta
41
+ /**
42
+ * Effective enablement, including disabled ancestor groups. `'conditional'`
43
+ * marks a `!!js` disabled expression on a composition no session has
44
+ * mounted, which only a Loader context can decide.
45
+ */
46
+ readonly enabled: PresetPluginEnablement
47
+ /** The row's own `!!js` disabled expression, when it carries one. */
48
+ readonly condition?: string
49
+ /** Root-fiber phase when the composition is live; null otherwise. */
50
+ readonly fiberPhase: PluginFiberPhase
51
+ }
52
+
53
+ /** One agent preset's identity and flattened composition in the inventory. */
54
+ export interface AgentPresetPluginGroup {
55
+ /** Stable preset id. */
56
+ readonly id: string
57
+ /** Display name the preset published; a reader falls back to the id. */
58
+ readonly name?: string
59
+ /** Whether a session naming no preset composes this one. */
60
+ readonly isDefault: boolean
61
+ /** Why this preset's composition cannot be read; absent when rows answer. */
62
+ readonly broken?: string
63
+ /** Plugin rows in composition order; empty when the preset is broken. */
64
+ readonly rows: readonly AgentPresetPluginRow[]
65
+ }
66
+
67
+ /** Point-in-time inventory returned by the plugin inventory Remote. */
68
+ export interface PluginInventorySnapshot {
69
+ /** Whether this Host exposes persistent current-profile management. */
70
+ readonly managementAvailable?: boolean
71
+ readonly entries: readonly PluginInventoryEntry[]
72
+ /**
73
+ * Per-preset compositions, present only when an agent-preset roster is
74
+ * composed in this deployment.
75
+ */
76
+ readonly agentPresets?: readonly AgentPresetPluginGroup[]
77
+ }