dsh-plugin-usage 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/lib/host/index.js +10 -4
  2. package/package.json +1 -1
package/lib/host/index.js CHANGED
@@ -417,11 +417,17 @@ export function apply(ctx) {
417
417
  const connection = connectionCtx.connection;
418
418
  if (connection === undefined || connection.rpc === undefined)
419
419
  return;
420
- connection.rpc.handle('/usage', (endpoint, args) => {
420
+ connection.rpc.handle('/usage', async (endpoint, args) => {
421
421
  const fn = usageHandlers.get(endpoint);
422
- if (fn === undefined)
423
- return { ok: false, error: `unknown endpoint: ${endpoint}` };
424
- return fn(args);
422
+ if (fn === undefined) {
423
+ return { ok: false, error: { code: 'bad-request', message: `unknown endpoint: ${endpoint}`, details: { issues: [] } } };
424
+ }
425
+ try {
426
+ return { ok: true, value: await fn(args) };
427
+ }
428
+ catch (error) {
429
+ return { ok: false, error: { code: 'internal', message: String((error && error.message) || error), details: {} } };
430
+ }
425
431
  }, { authority: 'loopback' });
426
432
  });
427
433
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-plugin-usage",
3
3
  "description": "Token usage statistics for DeepSeek Harness — daily/custom-range views, model filters, call counts and cost, inspired by CC Switch statistics.",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",