Skip to main content

pi usage data provider for `mngr usage` (reader + writer gate; the per-message writer lives in mngr_pi_coding's lifecycle extension)

Project description

imbue-mngr-pi-coding-usage

pi data provider for mngr usage. pi loads a single explicit extension (mngr_pi_coding's lifecycle extension, via pi -e), so the per-message usage writer lives there -- it already holds each assistant message's cost and tokens. This package owns the two usage-specific pieces:

  • The reader: an aggregate_usage_source hookimpl claiming the pi-coding source, aggregated session-incrementally (pi reports cost per message, summed per session).
  • The writer gate: on_after_provisioning drops a pi_emit_usage marker in each pi agent's state dir. The lifecycle extension only emits usage events when that marker is present -- so the events are written exactly when their reader (this package) is installed.

What gets captured

pi computes per-message cost client-side (usage.cost.total), so cost is REPORTED (no estimation). Each assistant message_end appends one cost_snapshot to events/pi-coding/usage/events.jsonl with the reported cost, tokens (input/output/cacheRead/cacheWrite), the provider-qualified model (<provider>/<model>), and the session id (the pi session file's basename). cost_mode is API_KEY (pi bills a real provider key).

Why the writer is in the harness extension

Unlike Claude (statusline shim) or OpenCode (auto-loaded plugin/*.ts), pi loads exactly one explicit extension owned by mngr_pi_coding. A standalone writer would require a harness change either way, so the writer is folded into the lifecycle extension (which already extracts the message usage), and this package stays the reader + gate.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imbue_mngr_pi_coding_usage-0.1.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imbue_mngr_pi_coding_usage-0.1.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file imbue_mngr_pi_coding_usage-0.1.1.tar.gz.

File metadata

File hashes

Hashes for imbue_mngr_pi_coding_usage-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3649d4b444241acc887079c81262baef453d27472125f77fa40c26bad07cd1b8
MD5 2b0166202ed00d17dcef6bc62bff9e5b
BLAKE2b-256 b109ba472c3f3afd9e5129e8a6b825d07881348672b7174f42acb6dd1ffe1226

See more details on using hashes here.

Provenance

The following attestation bundles were made for imbue_mngr_pi_coding_usage-0.1.1.tar.gz:

Publisher: publish.yml on imbue-ai/mngr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imbue_mngr_pi_coding_usage-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for imbue_mngr_pi_coding_usage-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 634516c5df23620929e8cc9615cccb27d3e820061d9133b6fc48db0c992f142a
MD5 1a3069e90a759aa1ef4c50a51436984f
BLAKE2b-256 5ae731cf4f63893ab7dabbc981d64dad567f4df638dc1750a7d9c26250d767b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for imbue_mngr_pi_coding_usage-0.1.1-py3-none-any.whl:

Publisher: publish.yml on imbue-ai/mngr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page