@volter/supercode-teams 0.2.63 → 0.2.64

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/package.json +1 -1
  2. package/worker/index.mjs +6 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-teams",
3
- "version": "0.2.63",
3
+ "version": "0.2.64",
4
4
  "type": "module",
5
5
  "description": "A machine daemon serving this machine's doors, and a local or remote Teams server for shared session discovery, OpenTelemetry ingestion and access to enrolled machines.",
6
6
  "license": "MIT",
package/worker/index.mjs CHANGED
@@ -120,7 +120,12 @@ export class TeamsServer extends DurableObject {
120
120
  await this.ready;
121
121
  const done = this.api.serverId ? await maintain(this.api).catch(() => null) : null;
122
122
  // The database's size on every full pass, where `wrangler tail` reads it.
123
- if (!done?.backlog) console.log(`maintain: database ${(this.ctx.storage.sql.databaseSize / 1048576).toFixed(1)} MB`);
123
+ if (!done?.backlog) {
124
+ // What grows: free pages (space deletes left for reuse), and each busy table's newest rowid (its insert rate).
125
+ const sql = this.ctx.storage.sql, one = (query) => { try { return [...sql.exec(query)][0] ?? {}; } catch { return {}; } };
126
+ const tables = ['messages', 'capture_parts', 'captures', 'session_versions', 'idempotency', 'journal'].map((name) => `${name}=${one(`SELECT MAX(rowid) m FROM ${name}`).m ?? '-'}`).join(' ');
127
+ console.log(`maintain: database ${(sql.databaseSize / 1048576).toFixed(1)} MB free_pages=${one('PRAGMA freelist_count').freelist_count ?? '-'} ${tables}`);
128
+ }
124
129
  // A backlog (versions or parts left over) is worked again in seconds, not a minute.
125
130
  await this.ctx.storage.setAlarm(Date.now() + (done?.backlog ? 3_000 : MAINTAIN_MS));
126
131
  }