Skip to content

Release/v0.15.0#67

Merged
lchoquel merged 2 commits into
mainfrom
release/v0.15.0
Jul 22, 2026
Merged

Release/v0.15.0#67
lchoquel merged 2 commits into
mainfrom
release/v0.15.0

Conversation

@lchoquel

@lchoquel lchoquel commented Jul 22, 2026

Copy link
Copy Markdown
Member

[v0.15.0] - 2026-07-22

Added

  • Cost reports on every run. Each result-producing command now prints a per-call cost report (pipe, model, tokens in→out, USD cost, and a total) to stderr, after the JSON result on stdout. A new shared piper/usage.py reads the run's per-call usage off the SDK result into a RunUsage (usage_from_results for the durable modes' typed RunResults.tokens_usages; usage_from_execute for blocking, which lifts the same records off its execute result) and renders it with print_cost_report. It respects the SDK's usage semantics: an unpriced call (cost is None — mock / own-GPU / dry-run) is excluded from the total rather than counted as zero, and token categories are never summed. Detached prints the report from wait / result (collection time), not from the start-only demo commands.

Changed

  • Cleaner file upload for summarize-pdf (breaking): the document is now uploaded to hosted storage up front with client.upload_file (new inputs.upload_document_input), and the run request carries only the returned pipelex-storage:// URI — replacing the previous inline base64 data: URL. inputs.build_document_input becomes the pure envelope builder build_document_input(path, uri); the upload is a separate step, so a file or capability error surfaces before any run is created. piper/errors.py gains hints for the file-upload error family (unsupported capability, rejected asset, authentication, invalid local source).
  • Lifecycle helpers return (main_stuff, RunUsage) (breaking): execute_pipe, start_and_wait, and detached's attend_run now return the resolved main output and the run's usage, instead of main_stuff alone, so the commands can print the cost report. The demo commands unpack the pair; the SDK output accessor itself is unchanged.
  • Bumped the pipelex-sdk floor from >=0.4.0 to >=0.5.0 (for upload_file and typed run usage).

🤖 Generated with Claude Code

Review in cubic

lchoquel and others added 2 commits July 22, 2026 17:34
- Cost reports: every result-producing command prints a per-call cost
  report (pipe, model, tokens in->out, USD, total) to stderr via a new
  shared piper/usage.py. Unpriced calls (cost is None) are excluded from
  the total; token categories are never summed. Detached prints from
  wait/result (collection time), not the start-only demos.
- summarize-pdf file upload (breaking): the document is uploaded to hosted
  storage up front with client.upload_file (inputs.upload_document_input)
  and the run carries only the returned pipelex-storage:// URI, replacing
  the inline base64 data: URL. build_document_input becomes the pure
  envelope builder; errors.py gains file-upload error hints.
- Lifecycle helpers return (main_stuff, RunUsage) (breaking): execute_pipe,
  start_and_wait, and detached's attend_run now return usage alongside the
  main output so commands can print the cost report.
- Docs: drop the stale-prone "shared modules" count (no-hardcoded-counts
  rule), keeping the structural "three execution modes" constant.


Claude-Session: https://claude.ai/code/session_016xWB4B8DjEYbiffrjg3dsS

Co-authored-by: Louis Choquel <8851983+lchoquel@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds cost reporting and hosted document uploads to the CLI. The main changes are:

  • Prints per-call usage and cost details to stderr.
  • Returns usage data from result-producing lifecycle helpers.
  • Uploads PDF inputs before starting a run.
  • Adds upload-specific error messages and SDK support.
  • Updates tests, documentation, and dependency versions.

Confidence Score: 5/5

This looks safe to merge.

No blocking issues found in the changed code.

T-Rex T-Rex Logs

What T-Rex did

  • Checked the pre-change summarize-pdf lifecycle and confirmed it showed only a start event with an inline data URI and no cost report.
  • Ran a focused pytest command for summarize-pdf offline tests, which completed with 19 tests passed.
  • Validated the post-change summarize-pdf lifecycle; it uploads before start, includes the exact storage URI document envelope, produces typed JSON output, and contains a usage-derived cost report.
  • Noted the API-key-related log entry indicating PIPELEX_API_KEY was unavailable, while the command still exited successfully.
  • Collected and linked six artifacts (logs and outputs) to support contract validation of the summarize-pdf flow.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
piper/usage.py Adds normalized usage extraction and stderr cost-report formatting.
piper/inputs.py Replaces inline document encoding with hosted upload and URI envelope creation.
piper/errors.py Adds user-facing guidance for upload and input-preparation failures.
piper/blocking/cli.py Adds usage reporting and hosted document upload to blocking commands.
piper/attended/cli.py Adds usage reporting and hosted document upload to attended commands.
piper/detached/cli.py Reports usage when detached results are collected and uploads documents before starting runs.

Reviews (1): Last reviewed commit: "Release v0.15.0: cost reports + hosted u..." | Re-trigger Greptile

@lchoquel
lchoquel merged commit 72bb8e0 into main Jul 22, 2026
18 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 22, 2026
@lchoquel
lchoquel deleted the release/v0.15.0 branch July 22, 2026 16:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant