Implement the session cost plugin
Host half wraps globalThis.fetch to read usage.cost out of provider responses (tee, never clone) and listens on the llm/stream seam for the session; the two halves join on the generation id. Client half adds one pill to the composer dock under its own id, so the harness's native stats stay where they are. Verified against the live API: three calls in one session (agent reply, compaction, session title) attributed with per-purpose totals, an unknown session answered with null, the ledger written and reloaded across instances, and the pill rendering only when a cost exists.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "dsh-session-cost",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Shows the real cost of the current session in the composer dock, next to the harness's own stats.",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"exports": {
|
||||
".": "./lib/index.js",
|
||||
"./client": "./lib/client.js",
|
||||
"./cordis.patch.yml": "./cordis.patch.yml",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"cordis.patch.yml"
|
||||
],
|
||||
"dsh": {
|
||||
"bundle": {
|
||||
"patch": "./cordis.patch.yml"
|
||||
},
|
||||
"client": {
|
||||
"platform": "web",
|
||||
"inject": [
|
||||
"@deepseek-ai/dsh-client-ui-conversation",
|
||||
"@deepseek-ai/dsh-client-locale"
|
||||
]
|
||||
}
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@deepseek-ai/dsh": "^0.2.0-rc.2"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user