Summary
StatusSummary (returned by /status / the status gateway RPC) and ModelCatalogEntry (the model catalog row type) are not exported from @openclaw/plugin-sdk. Plugins consuming these via the gateway have no canonical type to bind against and silently drift from the actual host shape.
Problem to solve
Discovered during the lossless-claw#516 audit. Commit 38fc1eb navigated sessions.byAgent[].entries[].usage.{promptTokens, totalTokens, input} against StatusSummary — but the actual shape is sessions.byAgent[].recent[].totalTokens keyed by key. The entries[] array doesn't exist. The plugin's pickFirstNumber would have returned null on every field.
Root cause: the author was guessing the shape from /status slash-command formatted output, with no public type to import. Even after #76756 lands and plugins gain RPC access, this drift will recur if the type isn't on the public surface.
Same applies to ModelCatalogEntry ({ id, name, provider, alias?, contextWindow?, reasoning?, input? } per src/agents/model-catalog.types.ts:3-11).
Proposed solution
Export from @openclaw/plugin-sdk:
StatusSummary (from src/commands/status.summary.ts:218-296)
SessionStatus (the per-session shape with key, totalTokens, contextTokens, model, remainingTokens, percentUsed)
ModelCatalogEntry (from src/agents/model-catalog.types.ts:3-11)
A simple re-export in the plugin-sdk barrel. Likely 2-3 lines of code, plus a .d.ts regeneration step in the publish pipeline.
Alternatives considered
- Plugins copy the type definitions — what lossless-claw effectively did, and got wrong. Prone to silent drift on host upgrades.
- Generate types from runtime introspection — too much machinery for type stability that's already documented in the host source.
Impact
Evidence
- Investigation report:
audit/pr516/INVESTIGATION-design-calls.md lines 31-47 documenting the shape mismatch
- Host source:
src/commands/status.summary.ts:218-296, src/agents/model-catalog.types.ts:3-11
- Plugin-sdk dist (verified missing):
dist/plugin-sdk/plugins/types.d.ts and dist/plugin-sdk/gateway/client.d.ts
Notes
Smallest of the three openclaw issues from the lossless-claw#516 audit. Should land alongside #76756 to be useful. Happy to draft the PR — the change is mostly mechanical (re-export + a small test asserting the types match the host source).
Related: #76756 (plugin-sdk gateway-RPC surface), #76758 (replay determinism).
Summary
StatusSummary(returned by/status/ thestatusgateway RPC) andModelCatalogEntry(the model catalog row type) are not exported from@openclaw/plugin-sdk. Plugins consuming these via the gateway have no canonical type to bind against and silently drift from the actual host shape.Problem to solve
Discovered during the lossless-claw#516 audit. Commit
38fc1ebnavigatedsessions.byAgent[].entries[].usage.{promptTokens, totalTokens, input}againstStatusSummary— but the actual shape issessions.byAgent[].recent[].totalTokenskeyed bykey. Theentries[]array doesn't exist. The plugin'spickFirstNumberwould have returned null on every field.Root cause: the author was guessing the shape from
/statusslash-command formatted output, with no public type to import. Even after #76756 lands and plugins gain RPC access, this drift will recur if the type isn't on the public surface.Same applies to
ModelCatalogEntry({ id, name, provider, alias?, contextWindow?, reasoning?, input? }persrc/agents/model-catalog.types.ts:3-11).Proposed solution
Export from
@openclaw/plugin-sdk:StatusSummary(fromsrc/commands/status.summary.ts:218-296)SessionStatus(the per-session shape withkey,totalTokens,contextTokens,model,remainingTokens,percentUsed)ModelCatalogEntry(fromsrc/agents/model-catalog.types.ts:3-11)A simple re-export in the plugin-sdk barrel. Likely 2-3 lines of code, plus a
.d.tsregeneration step in the publish pipeline.Alternatives considered
Impact
runtime.gateway.getStatus()orruntime.gateway.listModels()once [Feature]: plugin-sdk surface for invoking host gateway RPCs (status, models.list, etc.) #76756 lands.38fc1ebdid before audit).StatusSummaryorModelCatalogEntry.Evidence
audit/pr516/INVESTIGATION-design-calls.mdlines 31-47 documenting the shape mismatchsrc/commands/status.summary.ts:218-296,src/agents/model-catalog.types.ts:3-11dist/plugin-sdk/plugins/types.d.tsanddist/plugin-sdk/gateway/client.d.tsNotes
Smallest of the three openclaw issues from the lossless-claw#516 audit. Should land alongside #76756 to be useful. Happy to draft the PR — the change is mostly mechanical (re-export + a small test asserting the types match the host source).
Related: #76756 (plugin-sdk gateway-RPC surface), #76758 (replay determinism).