dsh-tool-stats 0.1.2 → 0.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.3
4
+
5
+ - **Fix the browser half never registering.** The client bundle was emitted as plain ESM
6
+ with `react` external, which prints a top-level `import` — invalid inside the loader's
7
+ concatenated script bundle, so evaluation aborted and every module after it failed with
8
+ "...loaded without registering ... via __ModuleLoader__.load". The bundle is now emitted
9
+ in the loader's lazy-CJS factory form (`window.__ModuleLoader__.load({ id, factory })`).
10
+ - Point the `./client` export's `types` at `lib/client/index.d.ts`, the file the client
11
+ half actually compiles to.
12
+
3
13
  ## 0.1.0 (2026-09-18)
4
14
 
5
15
  Initial release.
package/lib/stats.web.js CHANGED
@@ -1,3 +1,32 @@
1
+ window.__ModuleLoader__.load({ id: "dsh-tool-stats", factory: (require) => {
2
+ var module = { exports: {} }; var exports = module.exports;
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/client/index.tsx
23
+ var index_exports = {};
24
+ __export(index_exports, {
25
+ apply: () => apply,
26
+ inject: () => inject
27
+ });
28
+ module.exports = __toCommonJS(index_exports);
29
+
1
30
  // src/client/view.tsx
2
31
  function renderPanel(payload) {
3
32
  const toolRows = payload.tools.map((t) => `<tr><td>${t.tool}</td><td>${t.invocations}</td><td>${Math.round(t.failureRate * 100)}%</td><td>${t.p50Latency}ms</td><td>${t.p95Latency}ms</td></tr>`).join("");
@@ -27,7 +56,5 @@ function apply(ctx) {
27
56
  });
28
57
  });
29
58
  }
30
- export {
31
- apply,
32
- inject
33
- };
59
+ return module.exports; } });
60
+ //# sourceMappingURL=stats.web.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/client/index.tsx", "../src/client/view.tsx"],
4
+ "sourcesContent": ["import type { PanelPayload } from '../types.js';\nimport { renderPanel } from './view.js';\n\nexport const inject = ['@deepseek-ai/dsh-client-ui-settings', '@deepseek-ai/dsh-client-connection'];\n\nexport function apply(ctx: {\n inject: (deps: string[], fn: (...services: unknown[]) => void) => void;\n}): void {\n ctx.inject(inject, (settings: unknown, connection: unknown) => {\n const s = settings as { section: (id: string, opts: { title: string; render: () => Promise<string> | string }) => void };\n const c = connection as { fetch: (path: string) => Promise<Response> };\n s.section('tool-stats', {\n title: 'Tool Stats',\n render: async () => {\n const res = await c.fetch('/api/stats.panel');\n const payload: PanelPayload = await res.json();\n return renderPanel(payload);\n },\n });\n });\n}\n", "import type { PanelPayload } from '../types.js';\n\nexport function renderPanel(payload: PanelPayload): string {\n const toolRows = payload.tools\n .map((t) => `<tr><td>${t.tool}</td><td>${t.invocations}</td><td>${Math.round(t.failureRate * 100)}%</td><td>${t.p50Latency}ms</td><td>${t.p95Latency}ms</td></tr>`)\n .join('');\n\n const deadSection = payload.deadTools.length > 0\n ? `<h3>Dead tools</h3><ul>${payload.deadTools.map((d) => `<li>${d.tool}</li>`).join('')}</ul>`\n : '';\n\n const failSection = payload.failingTools.length > 0\n ? `<h3>Failing tools</h3><ul>${payload.failingTools.map((f) => `<li>${f.tool}: ${Math.round(f.failureRate * 100)}%</li>`).join('')}</ul>`\n : '';\n\n const recSection = payload.recommendations.length > 0\n ? `<h3>Recommendations</h3><ul>${payload.recommendations.map((r) => `<li>${r.message}</li>`).join('')}</ul>`\n : '';\n\n return `<div class=\"stats-panel\">\n <h2>Tool Stats</h2>\n ${toolRows ? `<table><thead><tr><th>Tool</th><th>Calls</th><th>Fail</th><th>p50</th><th>p95</th></tr></thead><tbody>${toolRows}</tbody></table>` : '<p>No calls recorded.</p>'}\n ${deadSection}${failSection}${recSection}\n </div>`;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,SAAS,YAAY,SAA+B;AACzD,QAAM,WAAW,QAAQ,MACtB,IAAI,CAAC,MAAM,WAAW,EAAE,IAAI,YAAY,EAAE,WAAW,YAAY,KAAK,MAAM,EAAE,cAAc,GAAG,CAAC,aAAa,EAAE,UAAU,cAAc,EAAE,UAAU,cAAc,EACjK,KAAK,EAAE;AAEV,QAAM,cAAc,QAAQ,UAAU,SAAS,IAC3C,0BAA0B,QAAQ,UAAU,IAAI,CAAC,MAAM,OAAO,EAAE,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC,UACrF;AAEJ,QAAM,cAAc,QAAQ,aAAa,SAAS,IAC9C,6BAA6B,QAAQ,aAAa,IAAI,CAAC,MAAM,OAAO,EAAE,IAAI,KAAK,KAAK,MAAM,EAAE,cAAc,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,UAChI;AAEJ,QAAM,aAAa,QAAQ,gBAAgB,SAAS,IAChD,+BAA+B,QAAQ,gBAAgB,IAAI,CAAC,MAAM,OAAO,EAAE,OAAO,OAAO,EAAE,KAAK,EAAE,CAAC,UACnG;AAEJ,SAAO;AAAA;AAAA,MAEH,WAAW,yGAAyG,QAAQ,qBAAqB,2BAA2B;AAAA,MAC5K,WAAW,GAAG,WAAW,GAAG,UAAU;AAAA;AAE5C;;;ADrBO,IAAM,SAAS,CAAC,uCAAuC,oCAAoC;AAE3F,SAAS,MAAM,KAEb;AACP,MAAI,OAAO,QAAQ,CAAC,UAAmB,eAAwB;AAC7D,UAAM,IAAI;AACV,UAAM,IAAI;AACV,MAAE,QAAQ,cAAc;AAAA,MACtB,OAAO;AAAA,MACP,QAAQ,YAAY;AAClB,cAAM,MAAM,MAAM,EAAE,MAAM,kBAAkB;AAC5C,cAAM,UAAwB,MAAM,IAAI,KAAK;AAC7C,eAAO,YAAY,OAAO;AAAA,MAC5B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tool-stats",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Every tool call is counted, and the ones that never fire are named so you can remove them.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -8,7 +8,7 @@
8
8
  "bin": { "dsh-tool-stats": "lib/bin.js" },
9
9
  "exports": {
10
10
  ".": { "types": "./lib/index.d.ts", "default": "./lib/index.js" },
11
- "./client": { "types": "./lib/client.d.ts", "default": "./lib/stats.web.js" },
11
+ "./client": { "types": "./lib/client/index.d.ts", "default": "./lib/stats.web.js" },
12
12
  "./package.json": "./package.json"
13
13
  },
14
14
  "files": ["lib", "cordis.patch.yml", "README.md", "CHANGELOG.md"],