v0.1.15 — token accounting and quota classification
Adds token accounting on Kiro, which the harness previously had none of: the
session line showed turns, steps and timings but no tokens.
Why it matters beyond display
DSH's token meter anchors its context accounting on provider usage
(baseline: {kind: 'usage'}). With no usage at all it prices the whole
conversation from a local heuristic, so compaction thresholds drift from what the
provider actually charged.
What the protocol offers
The wire schema settles it. MetadataEvent declares
{tokenUsage, stopReason, stopDetails}, and TokenUsage declares seven members:
uncachedInputTokens, outputTokens, totalTokens, cacheReadInputTokens,
cacheWriteInputTokens, contextUsagePercentage, normalizedTokenUsage.
Exact usage is therefore part of the contract — but no observed route on the test
account sends the metadata event, while every one sends contextUsageEvent.
What this release does
- Exact when available.
tokenUsagemaps straight to DSH's buckets, and
totalTokensnow recovers the uncached input when a route reports only the
total. - Otherwise priced from the provider's own measurement. No buckets means the
call is priced fromcontextUsagePercentagetimes the model's advertised
context window. Both reference implementations convert it the same way, for the
same stated reason: clients rely on it to decide when to compact. - Honest about precision. The input side is the provider's measurement of how
full the window is, at the precision it reported. The output side has no
provider signal and is scaled from emitted characters. Cache buckets are never
invented.
Spent plans are now classified
Probing the usage question hit HTTP 402 {"reason":"MONTHLY_REQUEST_COUNT"},
which surfaced as an opaque HTTP_402. An exhausted allowance is now QUOTA —
including a 403 or a throttle whose reason names the monthly or daily allowance —
because retrying cannot help and it must not read as a rate limit or a permission
problem. A burst throttle stays RATE_LIMIT.
Verification
npm run check: 178 tests pass (8 live probes skipped), plus typecheck, build and
syntax checks. New coverage in tests/repro.spec.ts ("P1-4 usage telemetry",
"account allowance classification") and tests/adapter-request.spec.ts.
Install
dsh plugin --profile <name> add github:dat-lequoc/dsh-kiro#v0.1.15Artifact checksum
sha256 23dee1eda99ef5915d4f8c9498dabea29c82d03af989703a269d4fdc484ddf03 dsh-kiro-0.1.15.tgz