mirror of
https://github.com/wu736139669/hapi.git
synced 2026-10-06 18:39:47 +00:00
The live pipeline records only the final model step of an OpenCode turn, so the usage dashboard showed roughly 42% of OpenCode's own totals. Add an offline reconciliation ledger instead of touching the streaming path (a previous attempt that fed cumulative counters into the live pipeline made the chat/status UI numbers jump): - shared: read and aggregate `~/.local/share/opencode/opencode.db` per (day, model), exposed as `@hapi/protocol/opencodeUsage` - hub: additive `usage_reconciliation` table (no schema bump, safe to roll back), local scan at startup and every 30 minutes, and the usage summary prefers snapshots over live events for reconciled sessions - cli: each runner scans its machine's store every 30 minutes and reports snapshots over the new `opencode-usage-report` socket event, covering remote machines and sessions whose process already exited - the hub-local scan skips sessions whose store lives on another machine, so it can never wipe remotely reported rows
42 lines
1.4 KiB
JSON
42 lines
1.4 KiB
JSON
{
|
|
"name": "@hapi/protocol",
|
|
"private": true,
|
|
"version": "0.1.0",
|
|
"type": "module",
|
|
"main": "./src/index.ts",
|
|
"types": "./src/index.ts",
|
|
"exports": {
|
|
".": "./src/index.ts",
|
|
"./apiTypes": "./src/apiTypes.ts",
|
|
"./messages": "./src/messages.ts",
|
|
"./slashCommands": "./src/slashCommands.ts",
|
|
"./buildInfo": "./src/buildInfo.ts",
|
|
"./conversationHistory": "./src/conversationHistory.ts",
|
|
"./modes": "./src/modes.ts",
|
|
"./rpcMethods": "./src/rpcMethods.ts",
|
|
"./runnerCapabilities": "./src/runnerCapabilities.ts",
|
|
"./schemas": "./src/schemas.ts",
|
|
"./sessionCitation": "./src/sessionCitation.ts",
|
|
"./sessionExport": "./src/sessionExport.ts",
|
|
"./types": "./src/types.ts",
|
|
"./voice": "./src/voice.ts",
|
|
"./voicePickerCatalog": "./src/voicePickerCatalog.ts",
|
|
"./voice-personality": "./src/voicePersonality.ts",
|
|
"./usage": "./src/usage.ts",
|
|
"./opencodeUsage": "./src/opencodeUsage.ts",
|
|
"./settingsFileLock": "./src/settingsFileLock.ts",
|
|
"./agentCliSpawnLease": "./src/agentCliSpawnLease.ts"
|
|
},
|
|
"sideEffects": false,
|
|
"scripts": {
|
|
"test": "bun test"
|
|
},
|
|
"dependencies": {
|
|
"proper-lockfile": "^4.1.2",
|
|
"zod": "^4.2.1"
|
|
},
|
|
"devDependencies": {
|
|
"@types/proper-lockfile": "^4.1.4"
|
|
}
|
|
}
|