@oh-my-pi/omp-stats 15.10.10 → 15.10.11

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/omp-stats",
4
- "version": "15.10.10",
4
+ "version": "15.10.11",
5
5
  "description": "Local observability dashboard for pi AI usage statistics",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
@@ -37,8 +37,9 @@
37
37
  "fmt": "biome format --write ."
38
38
  },
39
39
  "dependencies": {
40
- "@oh-my-pi/pi-ai": "15.10.10",
41
- "@oh-my-pi/pi-utils": "15.10.10",
40
+ "@oh-my-pi/pi-ai": "15.10.11",
41
+ "@oh-my-pi/pi-catalog": "15.10.11",
42
+ "@oh-my-pi/pi-utils": "15.10.11",
42
43
  "@tailwindcss/node": "^4.3.0",
43
44
  "chart.js": "^4.5.1",
44
45
  "date-fns": "^4.3.0",
package/src/aggregator.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as fs from "node:fs";
2
- import { isCompiledBinary } from "@oh-my-pi/pi-utils";
2
+ import { workerHostEntry } from "@oh-my-pi/pi-utils";
3
3
  import {
4
4
  getRecentErrors as dbGetRecentErrors,
5
5
  getRecentRequests as dbGetRecentRequests,
@@ -24,15 +24,10 @@ import {
24
24
  } from "./db";
25
25
  import { getSessionEntry, listAllSessionFiles, type ParseSessionResult } from "./parser";
26
26
  import type { SyncWorkerRequest, SyncWorkerResponse } from "./sync-worker";
27
- // Worker entry. Bun's `--compile` bundler statically discovers the string
28
- // literal in `new Worker("./packages/stats/src/sync-worker.ts", …)` below and
29
- // emits the worker as an additional entrypoint (registered in
30
- // `packages/coding-agent/scripts/build-binary.ts`). In dev runs we resolve
31
- // the same source file through `import.meta.url`, so the literal only has to
32
- // be valid relative to the `--root` directory (repo root). Importing the
33
- // source as `with { type: "file" }` is NOT sufficient — that copies the file
34
- // as a raw asset and does not bundle the worker's relative imports, so the
35
- // worker would crash on first `import` (issue #1011, PR #1027).
27
+ // Coding-agent binary/bundle workers route through the CLI entrypoint with a
28
+ // hidden argv mode, so the compiled binary and npm bundle only need one
29
+ // JavaScript entry. Standalone source `omp-stats` keeps using this package's
30
+ // own sync-worker source file.
36
31
  import type { BehaviorDashboardStats, DashboardStats, MessageStats, RequestDetails } from "./types";
37
32
 
38
33
  /**
@@ -89,17 +84,18 @@ interface WorkerHandle {
89
84
  }
90
85
 
91
86
  /**
92
- * Create a fresh sync worker. In a `--compile` binary the literal-string
93
- * specifier is what Bun's static analyzer needs (the file is also listed as
94
- * an additional `--compile` entrypoint in
95
- * `packages/coding-agent/scripts/build-binary.ts`). In dev runs we resolve
96
- * the source URL via `import.meta.url` so the worker survives `cwd` changes
97
- * by callers.
87
+ * Create a fresh sync worker. When the process was started from a
88
+ * self-dispatching CLI entry (omp in source, npm-bundle, or compiled form),
89
+ * re-enter that entry with a worker argv selector; otherwise (standalone
90
+ * omp-stats, bun test, SDK embedding) load the worker module directly, so this
91
+ * package keeps zero runtime dependency on `@oh-my-pi/pi-coding-agent`.
98
92
  */
99
93
  function createSyncWorker(): Worker {
100
- return isCompiledBinary()
101
- ? new Worker("./packages/stats/src/sync-worker.ts", { type: "module" })
102
- : new Worker(new URL("./sync-worker.ts", import.meta.url).href, { type: "module" });
94
+ const hostEntry = workerHostEntry();
95
+ if (hostEntry) {
96
+ return new Worker(hostEntry, { type: "module", argv: ["__omp_stats_sync_worker"] });
97
+ }
98
+ return new Worker(new URL("./sync-worker.ts", import.meta.url).href, { type: "module" });
103
99
  }
104
100
 
105
101
  function spawnWorker(): WorkerHandle {
package/src/db.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Database } from "bun:sqlite";
2
2
  import * as fs from "node:fs/promises";
3
- import { type GeneratedProvider, getBundledModel, type Usage } from "@oh-my-pi/pi-ai";
3
+ import type { Usage } from "@oh-my-pi/pi-ai";
4
+ import type { GeneratedProvider } from "@oh-my-pi/pi-catalog/models";
5
+ import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
4
6
  import { getConfigRootDir, getStatsDbPath } from "@oh-my-pi/pi-utils";
5
7
  import type {
6
8
  AggregatedStats,