dsh-capability-panel 1.2.0 → 1.3.0

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/index.d.ts CHANGED
@@ -35,6 +35,13 @@ interface LoaderEntryLike {
35
35
  }
36
36
  interface LoaderLike {
37
37
  entries(): Iterable<LoaderEntryLike>;
38
+ /**
39
+ * Resolves once the initial load of every entry has settled. Optional: it is
40
+ * how dsh-settings defers its own legacy import, and the temporary recovery
41
+ * in `legacy-import.ts` probes it the same way; hosts whose loader predates
42
+ * it simply run the recovery immediately.
43
+ */
44
+ await?(): Promise<unknown>;
38
45
  }
39
46
  interface AgentsService {
40
47
  get(sessionId: string): AgentLike | undefined;
@@ -43,15 +50,41 @@ interface AgentsService {
43
50
  }
44
51
  interface AgentPresetLike {
45
52
  readonly id: string;
46
- readonly trust: 'system' | 'user';
53
+ /**
54
+ * Present on dsh ≤ 0.1.6 (`dsh-agent-preset`); the 0.1.7 registry split
55
+ * dropped it from `list()` rows, so consumers must treat its absence as
56
+ * "unknown" rather than a shape violation.
57
+ */
58
+ readonly trust?: 'system' | 'user';
59
+ /** Same story as {@link trust}: the 0.1.7 roster no longer carries paths. */
47
60
  readonly path?: string;
48
61
  readonly name?: string;
49
62
  readonly description?: string;
50
63
  readonly broken?: string;
51
64
  }
65
+ /**
66
+ * The revision lease `acquireScope` hands back: the scope key to read with,
67
+ * plus async disposal that releases the mount's user count. Disposal is part
68
+ * of the contract — skipping it pins a generation against collection forever.
69
+ */
70
+ interface ScopeLeaseLike {
71
+ readonly key: unknown;
72
+ [Symbol.asyncDispose](): Promise<void>;
73
+ }
52
74
  interface AgentPresetsService {
53
75
  list(): Promise<AgentPresetLike[]>;
54
- standingKeyFor(id?: string): Promise<unknown>;
76
+ /**
77
+ * Read one preset's standing scope without starting an agent (dsh ≤ 0.1.6).
78
+ * Removed in 0.1.7 in favour of {@link acquireScope}; declared optional so
79
+ * the call site probes whichever the live service offers.
80
+ */
81
+ standingKeyFor?(id?: string): Promise<unknown>;
82
+ /**
83
+ * 0.1.7 replacement: retain the preset's current generation and hand back
84
+ * its scope key behind a lease. The caller MUST dispose the lease when the
85
+ * scoped read completes.
86
+ */
87
+ acquireScope?(id?: string): Promise<ScopeLeaseLike>;
55
88
  composedPreset(agentCtx: unknown): string | undefined;
56
89
  }
57
90
  interface SettingsScopeLike<T> {
@@ -63,11 +96,44 @@ interface SettingsScopeLike<T> {
63
96
  */
64
97
  replace(section: object): Promise<void>;
65
98
  }
99
+ /** One row of the 0.1.7 settings form inventory, as far as this plugin reads it. */
100
+ interface SettingsDescriptor {
101
+ readonly ns?: unknown;
102
+ readonly value?: unknown;
103
+ }
104
+ /**
105
+ * The settings service across BOTH host generations.
106
+ *
107
+ * `register` is the ≤0.1.6 contract and is still optional here so the type spans
108
+ * both: 0.1.7 deleted it, and a plugin that hard-required it would fail to
109
+ * compile against the new host while shipping one bundle that must serve both.
110
+ * The 0.1.7 trio is likewise optional, since a ≤0.1.6 host has none of it.
111
+ * Every member is therefore probed at runtime in `bindSection` rather than
112
+ * assumed, which is also why this stays a structural type with no static import
113
+ * from `@deepseek-ai/dsh-settings`.
114
+ */
66
115
  interface SettingsService {
67
- readonly writable: boolean;
68
- register<T>(namespace: string, schema: unknown, options?: {
116
+ /**
117
+ * Whether the surface accepts writes. A getter on 0.1.7 (unconditionally
118
+ * true); read only through the lazy non-strict path, never cached.
119
+ */
120
+ readonly writable?: boolean;
121
+ register?<T>(namespace: string, schema: unknown, options?: {
69
122
  applies?: 'live' | 'restart';
70
123
  }): SettingsScopeLike<T>;
124
+ /**
125
+ * The live form inventory. Only entries whose Config declares a volatile
126
+ * field appear here, which is precisely why this plugin declares one.
127
+ */
128
+ describe?(options?: {
129
+ redactSecrets?: boolean;
130
+ }): readonly SettingsDescriptor[];
131
+ /** Reset every live field of the namespace, then apply `section`. */
132
+ replace?(namespace: string, section: object, expectedRevision?: number): Promise<void>;
133
+ /** Recursive merge into the current section; cannot remove a key. */
134
+ update?(namespace: string, section: object, expectedRevision?: number): Promise<void>;
135
+ /** Ordered write operations against one namespace. */
136
+ mutate?(namespace: string, operations: readonly object[], expectedRevision?: number): Promise<void>;
71
137
  }
72
138
  interface SkillsService {
73
139
  list(lookup: {
@@ -101,6 +167,20 @@ interface AgentCreatedPayload {
101
167
  };
102
168
  }
103
169
  interface HostServices {
170
+ /**
171
+ * This plugin's own cordis fiber, read for the profile entry id that 0.1.7
172
+ * keys settings by. Optional because a plugin mounted without the Loader (a
173
+ * bare `ctx.plugin`) has no entry, and because the field is a Loader
174
+ * decoration rather than part of cordis's own Context type — so it is probed,
175
+ * never assumed.
176
+ */
177
+ readonly fiber?: {
178
+ readonly entry?: {
179
+ readonly options?: {
180
+ readonly id?: unknown;
181
+ };
182
+ };
183
+ };
104
184
  readonly webServer?: {
105
185
  register(spec: {
106
186
  kind: 'prefix';
@@ -108,13 +188,21 @@ interface HostServices {
108
188
  handler: (req: IncomingLike$1, res: ServerResponseLike) => Promise<void> | void;
109
189
  }): () => void;
110
190
  };
111
- /** The cordis loader mixin every host context carries (entry inventory + hot-swap). */
112
- readonly loader?: LoaderLike;
113
- get(name: 'agents'): AgentsService | undefined;
114
- get(name: 'agentPresets'): AgentPresetsService | undefined;
115
- get(name: 'settings'): SettingsService | undefined;
116
- get(name: 'skills'): SkillsService | undefined;
117
- get(name: 'tools'): ToolsService | undefined;
191
+ /** The cordis loader service (entry inventory + hot-swap), read via get(). */
192
+ /**
193
+ * The cordis reflect channel. `strict` defaults to true, which only returns
194
+ * an implementation whose providing fiber is CURRENTLY active: during
195
+ * startup and HMR windows that reads as absent even though the service
196
+ * exists. Every lazy root-level read in this plugin passes strict=false so
197
+ * a provider mid-transition still resolves; a genuinely unmounted service
198
+ * stays undefined either way.
199
+ */
200
+ get(name: 'loader', strict?: boolean): LoaderLike | undefined;
201
+ get(name: 'agents', strict?: boolean): AgentsService | undefined;
202
+ get(name: 'agentPresets', strict?: boolean): AgentPresetsService | undefined;
203
+ get(name: 'settings', strict?: boolean): SettingsService | undefined;
204
+ get(name: 'skills', strict?: boolean): SkillsService | undefined;
205
+ get(name: 'tools', strict?: boolean): ToolsService | undefined;
118
206
  on(event: 'agent/created',
119
207
  /**
120
208
  * A returned promise is allowed on purpose. Cordis vetoes agent publication
@@ -217,9 +305,25 @@ interface ServerResponseLike {
217
305
  }
218
306
  //#endregion
219
307
  //#region src/index.d.ts
308
+ /**
309
+ * This plugin's persisted state, declared where dsh 0.1.7 looks for it.
310
+ *
311
+ * The settings rewrite re-keyed every configurable namespace to a profile entry
312
+ * id and moved the values onto the entry's OWN Config, so a plugin that declares
313
+ * no Config is simply absent from the settings surface — `describe()` emits no
314
+ * descriptor and any write fails with `No configurable plugin entry`. Exporting
315
+ * this is what makes the entry configurable at all; the volatile markers inside
316
+ * (see `settings-schema.ts`) are what make writes apply live.
317
+ *
318
+ * It MUST be a named export of the module, not a property of `apply`: the loader
319
+ * resolves a module-shaped plugin down to its `apply` function and then reads
320
+ * `Config` off the enclosing module namespace. Attaching it to the function would
321
+ * be silently ignored.
322
+ */
323
+ declare const Config: Schemastery<any, any, "plain">;
220
324
  /** Host composition root: construct stores/controllers and register the route. */
221
325
  declare function apply(ctx: HostServices): void;
222
326
  declare const inject: string[];
223
327
  //#endregion
224
- export { apply, inject };
328
+ export { Config, apply, inject };
225
329
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/loopback.ts","../src/host/types.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;AACiB,UAAA,YAAA,CAAY;;;oBAGT;ECkBH;AAQjB;AAmBA;AAMA;EASiB,SAAA,MAAA,CAAA,EAAA;IACC,SAAA,aAAA,CAAA,EAAA,MAAA;EAAR,CAAA;;;;;;;AA+BV;AAUA;AAaA;;;AAEwE,UAnGvD,eAAA,CAmGuD;EAAR,SAAA,QAAA,CAAA,EAAA,OAAA;EAAO;EAGtD,SAAA,OAAY,CAAA,EAAA;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