@volter/supercode-teams 0.2.134 → 0.2.136

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/bin/workspace.mjs CHANGED
@@ -569,7 +569,7 @@ async function machinesCommand(sub, { flags, rest, output, client, context, team
569
569
  if (['subscribe','unsubscribe','events'].includes(sub)) {
570
570
  requireArgs(rest,sub==='events'?0:1,sub==='events'?0:1,`teams machines ${sub} ${sub==='events'?'':'ADDRESS'}`);
571
571
  const channel=await openLocalMachine(paths(teamsHome()).socket);
572
- try { const rpc=await nodeRpc(channel); return output(await rpc.request(`machine.events.${sub}`,{team_id:context.team_id,address:rest[0]})); }
572
+ try { const rpc=await nodeRpc(channel); return output(await rpc.call(`machine.events.${sub}`,{team_id:context.team_id,address:rest[0]})); }
573
573
  finally { channel.close(); }
574
574
  }
575
575
  if (sub === 'list') return output(await team.machines.list());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-teams",
3
- "version": "0.2.134",
3
+ "version": "0.2.136",
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
@@ -72,10 +72,33 @@ function durableSql(storage) {
72
72
  return { all, get, run, tx, exec: (query) => sql.exec(query) };
73
73
  }
74
74
 
75
+ /** Aggregate storage diagnostics only: no record contents or credentials. */
76
+ function logStorageBreakdown(sql) {
77
+ console.log(`storage: database_bytes=${sql.databaseSize}`);
78
+ try {
79
+ for (const row of sql.exec('SELECT name,SUM(pgsize) bytes,COUNT(*) pages FROM dbstat GROUP BY name ORDER BY SUM(pgsize) DESC')) console.log(`storage table: ${JSON.stringify(row)}`);
80
+ return;
81
+ } catch (error) { console.log(`storage: physical table allocation unavailable: ${error.message}`); }
82
+ // Some hosts omit dbstat. Logical payload lengths exclude indexes/page
83
+ // overhead; TEXT lengths count characters and BLOB lengths count bytes.
84
+ const quote = name => `"${name.replaceAll('"', '""')}"`;
85
+ for (const { name } of sql.exec("SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'")) {
86
+ try {
87
+ const columns = [...sql.exec(`PRAGMA table_info(${quote(name)})`)];
88
+ const payload = columns.filter(column => /TEXT|BLOB/i.test(column.type)).map(column => `COALESCE(length(${quote(column.name)}),0)`);
89
+ const [row] = sql.exec(`SELECT COUNT(*) rows,COALESCE(SUM(${payload.join('+') || '0'}),0) payload_units FROM ${quote(name)}`);
90
+ console.log(`storage table logical: ${JSON.stringify({ name, ...row })}`);
91
+ } catch (error) { console.log(`storage table ${name}: ${error.message}`); }
92
+ }
93
+ }
94
+
75
95
  export class TeamsServer extends DurableObject {
76
96
  constructor(ctx, env) {
77
97
  super(ctx, env);
78
98
  this.ready = ctx.blockConcurrencyWhile(async () => {
99
+ // Read before migrations/maintenance: allocation failures must not hide
100
+ // the table responsible. Run only near capacity, once per activation.
101
+ if (ctx.storage.sql.databaseSize >= 900 * 1024 * 1024) logStorageBreakdown(ctx.storage.sql);
79
102
  const db = durableSql(ctx.storage);
80
103
  migrate({ exec: db.exec, tx: db.tx, version: () => ctx.storage.kv.get('schema_version') ?? 0, setVersion: (n) => ctx.storage.kv.put('schema_version', n) });
81
104
  this.api = createTeamsApi({ publicOrigin: normalizePublicOrigin(env.PUBLIC_ORIGIN), identityIssuer: env.VOLTER_ISSUER || null, identityOrganizations: identityOrganizationsFromEnv(env), delegatedIssuer: env.DELEGATED_ISSUER || null });