@volter/supercode-teams 0.2.137 → 0.2.139
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 +1 -1
- package/worker/index.mjs +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-teams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.139",
|
|
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
|
@@ -90,6 +90,22 @@ function logStorageBreakdown(sql) {
|
|
|
90
90
|
console.log(`storage table logical: ${JSON.stringify({ name, ...row })}`);
|
|
91
91
|
} catch (error) { console.log(`storage table ${name}: ${error.message}`); }
|
|
92
92
|
}
|
|
93
|
+
try {
|
|
94
|
+
const now = Date.now();
|
|
95
|
+
const rows = sql.exec(`WITH chunk_sizes AS MATERIALIZED (SELECT team_id,upload_id,COUNT(*) chunks,SUM(length(bytes)) bytes FROM artifact_chunks GROUP BY team_id,upload_id),
|
|
96
|
+
staging AS MATERIALIZED (SELECT team_id,begin_json FROM captures WHERE state='staging'),
|
|
97
|
+
classified AS MATERIALIZED (SELECT u.team_id,u.id,u.created_at,
|
|
98
|
+
CASE WHEN EXISTS (SELECT 1 FROM session_artifacts a WHERE a.team_id=u.team_id AND a.upload_id=u.id) THEN 'version-referenced'
|
|
99
|
+
WHEN EXISTS (SELECT 1 FROM continuations c WHERE c.team_id=u.team_id AND instr(c.value_json,u.id)>0) THEN 'continuation-referenced'
|
|
100
|
+
WHEN EXISTS (SELECT 1 FROM staging c WHERE c.team_id=u.team_id AND instr(c.begin_json,u.id)>0) THEN 'staging-referenced'
|
|
101
|
+
WHEN u.created_at+86400000>? THEN 'unreferenced-under-one-day'
|
|
102
|
+
WHEN u.committed=1 THEN 'eligible-committed' ELSE 'expired-staging' END category
|
|
103
|
+
FROM uploads u)
|
|
104
|
+
SELECT u.category,COUNT(*) uploads,SUM(c.chunks) chunks,SUM(c.bytes) blob_bytes,
|
|
105
|
+
MIN(u.created_at) oldest_at,MAX(u.created_at) newest_at
|
|
106
|
+
FROM chunk_sizes c LEFT JOIN classified u ON u.team_id=c.team_id AND u.id=c.upload_id GROUP BY u.category`, now);
|
|
107
|
+
for (const row of rows) console.log(`storage uploads: ${JSON.stringify(row)}`);
|
|
108
|
+
} catch (error) { console.log(`storage upload classification: ${error.message}`); }
|
|
93
109
|
}
|
|
94
110
|
|
|
95
111
|
export class TeamsServer extends DurableObject {
|