nuwa-skill
alchaincyf
你想蒸馏的下一个员工,何必是同事。蒸馏任何人的思维方式——心智模型、决策启发式、表达DNA。Distill how anyone thinks.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:x01Jin/dsh-oc-go-usage
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A DSH plugin that shows what the current session cost on an OpenCode Go subscription. It adds
an Opencode Go tab to the session header, next to Chat and Trajectory, and a
/opencode-go command that prints the same numbers as text.
OpenCode keeps one row per inference request in the console request log, with startedAt,
finishedAt, model, token counts, outcome and cost in USD. The plugin queries that log:
GET https://opencode.ai/console/api/request-logs
?category=inference&since=<session start>&until=<now>&limit=100
since is the DSH session's header.createdAt and until is the current time, so the query
window is the session lifetime. The total is the sum of cost over the rows inside it.
Rows are matched by time, not by session id. Another client using the same OpenCode Go workspace during the window is counted too.
dsh plugin add github:x01Jin/dsh-oc-go-usage
Or in the GUI: Settings, Plugins, Add plugin, then paste github:x01Jin/dsh-oc-go-usage.
Restart DSH or reload the page. The tab appears on a session once it has started.
The request log needs the console session, not an API key. A personal oc_sk_... key returns
403 on this endpoint.
request-logs request.cookie request header.The workspace id (wrk_... from the console URL) is discovered automatically when the console
allows it. If the tab asks for one, paste the id or the full console URL.
A cookie: ... header and an authorization: Bearer ... value are both accepted. The
credential is stored in the DSH credential store as OPENCODE_CONSOLE_COOKIE, the workspace as
OPENCODE_CONSOLE_WORKSPACE. Only the host process sends it, and only to opencode.ai.
Save .txt opens the system folder picker and writes one snapshot into the chosen folder. Cancelling writes nothing.
The file is named 20261028-072459-eb5c23ae.txt (local time, then the session id), so a folder
of snapshots sorts by time. It holds the window, totals, derived rates, the host-side DSH
figures, the per-model split, a local-hour histogram and the caveats that apply to that
capture.
All keys are optional.
| key | default | meaning |
|---|---|---|
credentialRef |
OPENCODE_CONSOLE_COOKIE |
DSH credential holding the console session |
apiBase |
https://opencode.ai |
console origin |
cacheMs |
20000 |
how long one console answer is reused |
maxPages |
25 |
page cap for one read, 100 rows per page |
routePrefix |
/opencode-go |
path prefix of the local routes |
orgId |
unset | workspace id when discovery is refused |
credentialRef can name an environment variable, because DSH credentials fall back to the
process environment.
The browser half never talks to opencode.ai.
| method | path | purpose |
|---|---|---|
GET |
/opencode-go/session-cost |
totals for one session, session and refresh query params |
POST |
/opencode-go/session-cookie |
store the credential and optional workspace |
DELETE |
/opencode-go/session-cookie |
forget both |
POST |
/opencode-go/session-export |
write the snapshot into a chosen folder |
cost are counted but not summed, and the panel reports how many.npm test
The tests cover log summarising and paging, credential and workspace parsing, text rendering, and registration of the client bundle in a stubbed module loader.
MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: session。