Skip to content

[Feature]: export StatusSummary and ModelCatalogEntry types from plugin-sdk public surface #76759

@100yenadmin

Description

@100yenadmin

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions