cli-consumption 0.4.5__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/CHANGELOG.md +83 -1
  2. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/PKG-INFO +7 -6
  3. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/README.md +6 -5
  4. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/pyproject.toml +1 -1
  5. cli_consumption-0.5.0/src/cli_consumption/adapters/_incremental.py +128 -0
  6. cli_consumption-0.5.0/src/cli_consumption/adapters/_kimi_code.py +399 -0
  7. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/_shared.py +37 -3
  8. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/amp.py +71 -17
  9. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/base.py +7 -1
  10. cli_consumption-0.5.0/src/cli_consumption/adapters/claude.py +872 -0
  11. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/cline.py +20 -2
  12. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/codex.py +123 -112
  13. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/continue_cli.py +73 -19
  14. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/copilot.py +28 -17
  15. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/crush.py +14 -1
  16. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/cursor.py +21 -16
  17. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/gemini.py +135 -53
  18. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/grok.py +31 -9
  19. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/kimi.py +12 -4
  20. cli_consumption-0.5.0/src/cli_consumption/adapters/mistral_vibe.py +558 -0
  21. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/opencode.py +389 -98
  22. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/pi.py +87 -25
  23. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/qwen.py +78 -26
  24. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/registry.py +85 -47
  25. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/cli.py +154 -46
  26. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/exporting.py +2 -2
  27. cli_consumption-0.5.0/src/cli_consumption/migrations/versions/v0008_cache_write_duration.py +31 -0
  28. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/models.py +41 -3
  29. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/reporting.py +32 -2
  30. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/schema.py +43 -3
  31. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/snapshot_extraction.py +4 -1
  32. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/storage.py +63 -0
  33. cli_consumption-0.5.0/src/cli_consumption/web_runtime.zip +0 -0
  34. cli_consumption-0.4.5/src/cli_consumption/adapters/claude.py +0 -386
  35. cli_consumption-0.4.5/src/cli_consumption/adapters/mistral_vibe.py +0 -295
  36. cli_consumption-0.4.5/src/cli_consumption/web_runtime.zip +0 -0
  37. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/.gitignore +0 -0
  38. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/LICENSE +0 -0
  39. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/NOTICE +0 -0
  40. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/INTER_FONT_LICENSE.txt +0 -0
  41. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/__init__.py +0 -0
  42. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/__main__.py +0 -0
  43. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/__init__.py +0 -0
  44. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/aider.py +0 -0
  45. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/amazon_q.py +0 -0
  46. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/goose.py +0 -0
  47. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/kilo.py +0 -0
  48. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/openhands.py +0 -0
  49. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/adapters/plandex.py +0 -0
  50. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/api.py +0 -0
  51. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/dashboard.py +0 -0
  52. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/dashboard_layouts.py +0 -0
  53. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/dashboard_react.css +0 -0
  54. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/dashboard_react.js +0 -0
  55. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/frontend.py +0 -0
  56. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/migrations/__init__.py +0 -0
  57. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/migrations/env.py +0 -0
  58. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/migrations/versions/__init__.py +0 -0
  59. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/migrations/versions/v0001_baseline.py +0 -0
  60. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/migrations/versions/v0002_minimize_subagents.py +0 -0
  61. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/migrations/versions/v0003_canonical_timestamps.py +0 -0
  62. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/migrations/versions/v0004_subagent_scope_freshness.py +0 -0
  63. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/migrations/versions/v0005_sync_receipts.py +0 -0
  64. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/migrations/versions/v0006_dashboard_layouts.py +0 -0
  65. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/migrations/versions/v0007_dashboard_layout_revision.py +0 -0
  66. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/py.typed +0 -0
  67. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/qualifications.py +0 -0
  68. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/reporting_api.py +0 -0
  69. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/retention.py +0 -0
  70. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/snapshot_files.py +0 -0
  71. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/sync.py +0 -0
  72. {cli_consumption-0.4.5 → cli_consumption-0.5.0}/src/cli_consumption/timestamps.py +0 -0
@@ -6,6 +6,87 @@ use [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.5.0] - 2026-12-03
10
+
11
+ ### Added
12
+
13
+ - The `kimi` provider now collects Kimi Code 2.x model calls, tokens, turns, tools,
14
+ compactions, and subagents from the local Wire 1.5 store alongside legacy sessions.
15
+ Sessions imported from other CLIs are skipped.
16
+ - OpenCode 2.x stores (`session_v2`, `session_message`, `session_part`) are collected;
17
+ on upgraded databases the 2.x copy of a session replaces its frozen 1.x copy, forked
18
+ history is not counted twice, and compaction usage is counted once.
19
+ - Mistral Vibe 3.x unified sessions (`logs/session/unified/`) are collected alongside
20
+ 2.x sessions. Resumed imports contribute their post-migration usage, and the saved
21
+ projection supplies totals when the listing cache is missing or behind. Sessions
22
+ imported from other tools are skipped.
23
+ - Pi `usage` entries (cache keep-alive and extension-reported requests) count as model
24
+ calls.
25
+
26
+ ### Fixed
27
+
28
+ - Gemini CLI `$patch` history records are applied, so removed messages are no longer
29
+ counted.
30
+ - Cline sessions imported from other CLIs and display-only error banners are no
31
+ longer counted.
32
+ - Crush subagent reports and hidden continuations no longer open user turns.
33
+ - Copilot replayed `checkpoint` records are ignored; Cursor subagent stores no longer
34
+ appear as separate conversations.
35
+ - Grok turns closed as interrupted on session reopen are marked aborted without an
36
+ inflated duration.
37
+ - Claude Code collection now includes subagent transcripts under
38
+ `<session>/subagents/` and legacy `agent-*.jsonl` files as separate conversations
39
+ linked to their parent session. Their tokens were previously ignored, and a legacy
40
+ agent file could replace its parent session during duplicate selection. Sidechain
41
+ replays of parent responses are not counted twice.
42
+ - Claude Code collection now counts reasoning tokens from
43
+ `output_tokens_details.thinking_tokens` as a bounded subset of output, records each
44
+ advisor sub-inference from `usage.iterations` as its own model call under the
45
+ advisor model, and keeps the provider-reported one-hour cache-write share. Advisor
46
+ tokens were previously ignored. Already stored conversations are recounted only when
47
+ a more complete copy of their transcript is collected.
48
+ - Claude Code and Codex collection now reads each provider file once instead of twice,
49
+ so the aggregate 512 MiB read limit applies to the actual store size and the
50
+ selected copy is no longer parsed a second time. Only the normalized records of the
51
+ most complete copy of each conversation are retained between files.
52
+
53
+ ### Changed
54
+
55
+ - All 21 provider qualifications were rechecked against current upstream releases
56
+ on 2026-12-03 (see the qualification ledger).
57
+
58
+ - `collect` now switches automatically to bounded, restart-safe batches when an
59
+ incremental-capable provider exceeds the aggregate candidate, provider-read, or
60
+ normalized-record limit, instead of failing with `provider_limit_exceeded`. Pass
61
+ `--no-incremental` to keep the previous all-or-nothing failure. Only the
62
+ overflowing provider is batched; JSON output reports `"incremental": true`,
63
+ `"incremental_trigger": "automatic"`, and a per-provider `"batched"` flag.
64
+ `--incremental` still forces batches and now reports
65
+ `"incremental_trigger": "requested"`.
66
+ - Bounded incremental collection now covers Claude Code, Amp, Continue CLI, Gemini
67
+ CLI, Pi, and Qwen Code in addition to Codex. Claude Code batches keep every
68
+ transcript that shares a session identity, across sources and project
69
+ directories, in one batch, so batched results equal one collection, including
70
+ replayed parent responses, and subagent relationships converge instead of being
71
+ skipped. Per-file, per-line, symlink, and single-conversation limits are
72
+ unchanged, and one command is still capped at 10,000 batches.
73
+ - Snapshot schema 2 and database revision `0008` add an optional per-model-call
74
+ `cache_write_1h_input_tokens` counter: the one-hour share of cache-write input, null
75
+ when a provider reports no duration breakdown. Collectors accept schemas 1 and 2;
76
+ clients send schema 2, so upgrade the collector before its clients. The counter is
77
+ stored for cost estimation and is not yet included in dashboards or CSV exports.
78
+
79
+ ### Security
80
+
81
+ - Update the bundled dashboard to Next.js 16.5.0 and patch vulnerable web
82
+ development dependencies.
83
+ - Patch msgpack, certifi, filelock, and virtualenv in the Python lockfile.
84
+ - Update the persistent dashboard to Next.js 16.3.8 and refresh vulnerable web
85
+ dependencies; use Parcel watcher 2.6.0 to remove the unpatched braces dependency
86
+ from the Tailwind build toolchain. Rebuild the bundled dashboard runtime.
87
+ - Refresh vulnerable urllib3 and virtualenv development dependencies in the Python
88
+ lockfile.
89
+
9
90
  ## [0.4.5] - 2026-09-11
10
91
 
11
92
  ### Added
@@ -209,7 +290,8 @@ use [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
209
290
 
210
291
  - Refreshed the provider guide for the first minor release ([#26]).
211
292
 
212
- [Unreleased]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.4.5...HEAD
293
+ [Unreleased]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.5.0...HEAD
294
+ [0.5.0]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.4.5...v0.5.0
213
295
  [0.4.5]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.4.4...v0.4.5
214
296
  [0.4.4]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.4.3...v0.4.4
215
297
  [0.4.3]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.4.2...v0.4.3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: cli-consumption
3
- Version: 0.4.5
3
+ Version: 0.5.0
4
4
  Summary: Analyze and consolidate AI coding CLI consumption across machines.
5
5
  Project-URL: Homepage, https://github.com/Guillaume-Lombardo/cli-consumption
6
6
  Project-URL: Documentation, https://github.com/Guillaume-Lombardo/cli-consumption#readme
@@ -115,9 +115,10 @@ To collect one provider or select another database:
115
115
  uv run cli-consumption collect --provider codex --database usage.sqlite
116
116
  ```
117
117
 
118
- For a Codex store that exceeds aggregate collection limits, add `--incremental`.
119
- The command automatically writes bounded, restart-safe batches to the same database;
120
- individual file and line safety limits remain enforced.
118
+ When a Claude Code, Codex, Amp, Continue, Gemini, Pi, or Qwen store exceeds aggregate
119
+ collection limits, the command automatically writes bounded, restart-safe batches to
120
+ the same database; individual file and line safety limits remain enforced. Pass
121
+ `--no-incremental` to fail instead, or `--incremental` to force batches.
121
122
 
122
123
  Use `--source [LABEL=]PATH` for trusted offline copies and repeated
123
124
  `--project NAME=PATH_PREFIX` mappings for stable project labels. See the
@@ -147,8 +148,8 @@ uv run cli-consumption providers --json
147
148
 
148
149
  - Provider files are untrusted. Collection enforces discovery, file, line, SQLite row,
149
150
  structured-field, and total normalized-record limits; direct provider-file symlinks
150
- are refused. Opt-in Codex incremental collection resets only aggregate per-batch
151
- limits and keeps a separate hard batch-count ceiling.
151
+ are refused. Incremental collection resets only aggregate per-batch limits and
152
+ keeps a separate hard batch-count ceiling.
152
153
  - `collect --strict` and `sync --strict` refuse a batch when any provider skipped
153
154
  malformed records. Collection distinguishes `provider_limit_exceeded`,
154
155
  `provider_format_incompatible`, `invalid_snapshot`, and the unexpected-failure
@@ -76,9 +76,10 @@ To collect one provider or select another database:
76
76
  uv run cli-consumption collect --provider codex --database usage.sqlite
77
77
  ```
78
78
 
79
- For a Codex store that exceeds aggregate collection limits, add `--incremental`.
80
- The command automatically writes bounded, restart-safe batches to the same database;
81
- individual file and line safety limits remain enforced.
79
+ When a Claude Code, Codex, Amp, Continue, Gemini, Pi, or Qwen store exceeds aggregate
80
+ collection limits, the command automatically writes bounded, restart-safe batches to
81
+ the same database; individual file and line safety limits remain enforced. Pass
82
+ `--no-incremental` to fail instead, or `--incremental` to force batches.
82
83
 
83
84
  Use `--source [LABEL=]PATH` for trusted offline copies and repeated
84
85
  `--project NAME=PATH_PREFIX` mappings for stable project labels. See the
@@ -108,8 +109,8 @@ uv run cli-consumption providers --json
108
109
 
109
110
  - Provider files are untrusted. Collection enforces discovery, file, line, SQLite row,
110
111
  structured-field, and total normalized-record limits; direct provider-file symlinks
111
- are refused. Opt-in Codex incremental collection resets only aggregate per-batch
112
- limits and keeps a separate hard batch-count ceiling.
112
+ are refused. Incremental collection resets only aggregate per-batch limits and
113
+ keeps a separate hard batch-count ceiling.
113
114
  - `collect --strict` and `sync --strict` refuse a batch when any provider skipped
114
115
  malformed records. Collection distinguishes `provider_limit_exceeded`,
115
116
  `provider_format_incompatible`, `invalid_snapshot`, and the unexpected-failure
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "cli-consumption"
7
- version = "0.4.5"
7
+ version = "0.5.0"
8
8
  description = "Analyze and consolidate AI coding CLI consumption across machines."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -0,0 +1,128 @@
1
+ """Generic bounded batching for adapters that opt into incremental collection.
2
+
3
+ An adapter opts in by implementing ``collect_incrementally``. It describes its store
4
+ as an ordered sequence of indivisible candidate groups (for example one transcript,
5
+ or one session plus its subagent transcripts) and supplies a function that collects
6
+ one batch of candidates with a fresh :class:`ProviderInputBudget`. Batches therefore
7
+ reset only aggregate candidate, read, and normalized-record budgets; per-file,
8
+ per-line, symlink, file-identity, and single-conversation limits stay unchanged.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ from collections.abc import Callable, Iterable, Iterator, Sequence
14
+ from pathlib import Path
15
+ from typing import TypeVar
16
+
17
+ from cli_consumption.adapters._shared import ProviderDataLimitError, ProviderInputBudget
18
+ from cli_consumption.adapters.base import CollectionBatch
19
+ from cli_consumption.models import Snapshot, SnapshotValidationError
20
+
21
+ INCREMENTAL_CANDIDATES_PER_BATCH = 1_000
22
+ MAX_INCREMENTAL_LISTING = 1_000_000
23
+ AGGREGATE_LIMIT_CODES = frozenset(
24
+ {
25
+ "provider_candidate_limit_exceeded",
26
+ "provider_read_limit_exceeded",
27
+ "provider_record_limit_exceeded",
28
+ }
29
+ )
30
+
31
+ _Item = TypeVar("_Item")
32
+
33
+
34
+ def is_aggregate_limit(error: BaseException) -> bool:
35
+ """Return whether a smaller batch of the same store could avoid this error."""
36
+ if isinstance(error, ProviderDataLimitError):
37
+ return str(error) in AGGREGATE_LIMIT_CODES
38
+ if isinstance(error, SnapshotValidationError):
39
+ return error.code == "snapshot_too_large"
40
+ return False
41
+
42
+
43
+ def bounded_sorted_paths(paths: Iterable[Path]) -> list[Path]:
44
+ """Sort one discovery listing without charging the per-batch candidate budget."""
45
+ result: list[Path] = []
46
+ for path in paths:
47
+ if len(result) >= MAX_INCREMENTAL_LISTING:
48
+ raise ProviderDataLimitError("provider_incremental_listing_limit_exceeded")
49
+ result.append(path)
50
+ return sorted(result)
51
+
52
+
53
+ def charge_candidates(
54
+ items: Iterable[_Item], budget: ProviderInputBudget
55
+ ) -> Iterator[_Item]:
56
+ """Charge each batch candidate to the batch's own discovery budget."""
57
+ for item in items:
58
+ budget.item()
59
+ yield item
60
+
61
+
62
+ def iter_collection_batches(
63
+ groups: Iterable[Sequence[_Item]],
64
+ collect: Callable[[list[_Item]], Snapshot],
65
+ *,
66
+ candidates_per_batch: int,
67
+ subagent_merge: bool = False,
68
+ ) -> Iterator[CollectionBatch]:
69
+ """Pack ordered groups into bounded batches, splitting only on aggregate limits.
70
+
71
+ A group is never divided between batches. A batch that exceeds an aggregate
72
+ limit is split at a group boundary; a single group that still exceeds a limit
73
+ fails with the original error.
74
+ """
75
+ pending: list[list[_Item]] = []
76
+ size = 0
77
+ for group in groups:
78
+ items = list(group)
79
+ if not items:
80
+ continue
81
+ if pending and size + len(items) > candidates_per_batch:
82
+ yield from _collect_split(pending, collect, subagent_merge)
83
+ pending, size = [], 0
84
+ pending.append(items)
85
+ size += len(items)
86
+ if pending:
87
+ yield from _collect_split(pending, collect, subagent_merge)
88
+
89
+
90
+ def iter_source_batches(
91
+ provider: str,
92
+ sources: list[tuple[str, Path]],
93
+ discover: Callable[[Path], Iterable[Path]],
94
+ collect: Callable[[list[tuple[str, Path]]], Snapshot],
95
+ *,
96
+ candidates_per_batch: int,
97
+ ) -> Iterator[CollectionBatch]:
98
+ """Batch single-file conversations source by source, in discovery order."""
99
+ for machine, home in sources:
100
+ yielded = False
101
+ for batch in iter_collection_batches(
102
+ ([(machine, path)] for path in discover(home)),
103
+ collect,
104
+ candidates_per_batch=candidates_per_batch,
105
+ ):
106
+ yielded = True
107
+ yield batch
108
+ if not yielded:
109
+ yield CollectionBatch(Snapshot(provider=provider), frozenset())
110
+
111
+
112
+ def _collect_split(
113
+ groups: list[list[_Item]],
114
+ collect: Callable[[list[_Item]], Snapshot],
115
+ subagent_merge: bool,
116
+ ) -> Iterator[CollectionBatch]:
117
+ snapshot: Snapshot | None = None
118
+ try:
119
+ snapshot = collect([item for group in groups for item in group])
120
+ except (ProviderDataLimitError, SnapshotValidationError) as error:
121
+ if len(groups) == 1 or not is_aggregate_limit(error):
122
+ raise
123
+ if snapshot is not None:
124
+ yield CollectionBatch(snapshot, frozenset(), subagent_merge=subagent_merge)
125
+ return
126
+ midpoint = len(groups) // 2
127
+ yield from _collect_split(groups[:midpoint], collect, subagent_merge)
128
+ yield from _collect_split(groups[midpoint:], collect, subagent_merge)