@kirkchinese/dsh-capability-catalog 0.1.1 → 0.1.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/index.js CHANGED
@@ -225,19 +225,32 @@ export async function apply(rawCtx, config) {
225
225
  dispose();
226
226
  owned.clear();
227
227
  }, 'capability-catalog.skill-shadows');
228
- ctx.on('agent/created', ({ agent }) => {
228
+ const shadow = (agent) => {
229
229
  const agentCtx = agent.ctx;
230
- if (agentCtx === undefined)
230
+ if (agentCtx === undefined || owned.has(agent.id))
231
231
  return;
232
- const dispose = agentCtx.effect(() => {
233
- const unregister = agentCtx.tools.register(tools.skill);
234
- return () => {
235
- unregister();
236
- owned.delete(agent.id);
237
- };
238
- }, 'capability-catalog.skill');
239
- owned.set(agent.id, dispose);
240
- });
232
+ try {
233
+ const dispose = agentCtx.effect(() => {
234
+ const unregister = agentCtx.tools.register(tools.skill);
235
+ return () => {
236
+ unregister();
237
+ owned.delete(agent.id);
238
+ };
239
+ }, 'capability-catalog.skill');
240
+ owned.set(agent.id, dispose);
241
+ }
242
+ catch (error) {
243
+ logger.warn(`capability-catalog: could not shadow the skill tool for ${agent.id}`, error);
244
+ }
245
+ };
246
+ ctx.on('agent/created', ({ agent }) => shadow(agent));
247
+ // A reload (plugin update, HMR) finds agents that are already live; shadow them too, or
248
+ // the native catalog would come back for every open session.
249
+ const liveAgents = ctx.get('agents');
250
+ for (const agent of liveAgents?.list() ?? []) {
251
+ shadow(agent);
252
+ void viewFor(agent, AbortSignal.timeout(30_000)).then((view) => catalog.refresh(view, AbortSignal.timeout(30_000))).catch(() => undefined);
253
+ }
241
254
  }
242
255
  // Settings page and per-session controls.
243
256
  const agents = ctx.get('agents');
@@ -255,7 +255,7 @@ export class McpSource {
255
255
  throw new Error(`${this.key}: streamable-http transport requires "url"`);
256
256
  transport = new StreamableHTTPClientTransport(new URL(config.url), { requestInit: { headers: { ...config.headers } } });
257
257
  }
258
- const client = new Client({ name: 'dsh-capability-catalog', version: '0.1.1' });
258
+ const client = new Client({ name: 'dsh-capability-catalog', version: '0.1.2' });
259
259
  client.onclose = () => {
260
260
  if (this.client === client)
261
261
  this.client = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirkchinese/dsh-capability-catalog",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Lazy capability catalog for DeepSeek Harness: one compact index plus search/describe/call meta-tools for MCP tools and skills, instead of every schema on every request",
5
5
  "keywords": [
6
6
  "deepseek-harness",