agentcap-cli 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl
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.
- agentcap/__init__.py +1 -1
- agentcap/quota.py +12 -0
- {agentcap_cli-0.2.1.dist-info → agentcap_cli-0.2.2.dist-info}/METADATA +5 -3
- {agentcap_cli-0.2.1.dist-info → agentcap_cli-0.2.2.dist-info}/RECORD +7 -7
- {agentcap_cli-0.2.1.dist-info → agentcap_cli-0.2.2.dist-info}/WHEEL +0 -0
- {agentcap_cli-0.2.1.dist-info → agentcap_cli-0.2.2.dist-info}/entry_points.txt +0 -0
- {agentcap_cli-0.2.1.dist-info → agentcap_cli-0.2.2.dist-info}/licenses/LICENSE +0 -0
agentcap/__init__.py
CHANGED
agentcap/quota.py
CHANGED
|
@@ -73,6 +73,9 @@ def approve_job(root: Path | None = None) -> str:
|
|
|
73
73
|
job = _read_json(d / "job.json") or {}
|
|
74
74
|
if not job.get("enforce"):
|
|
75
75
|
return "agentcap: this job is observe-only (Free); approve is a Pro feature."
|
|
76
|
+
if job.get("stopped"):
|
|
77
|
+
return ("agentcap: this job was already stopped (SIGINT), so approve cannot resume it. "
|
|
78
|
+
"Start it again with a higher --quota.")
|
|
76
79
|
n = int(job.get("approvals") or 0)
|
|
77
80
|
if n >= APPROVE_MAX:
|
|
78
81
|
return (f"agentcap: already approved twice (limit {float(job.get('quota', 0)):g}%); "
|
|
@@ -745,6 +748,12 @@ class QuotaRunner:
|
|
|
745
748
|
pass
|
|
746
749
|
|
|
747
750
|
def _stop(self) -> None:
|
|
751
|
+
job = _read_json(self.job_dir / "job.json") or {}
|
|
752
|
+
job["stopped"] = True # a signalled job cannot be resumed by `agentcap approve`
|
|
753
|
+
try:
|
|
754
|
+
_atomic_write(self.job_dir / "job.json", job)
|
|
755
|
+
except OSError:
|
|
756
|
+
pass
|
|
748
757
|
self._signal(signal.SIGINT)
|
|
749
758
|
deadline = time.time() + 5
|
|
750
759
|
while self.child and self.child.poll() is None and time.time() < deadline:
|
|
@@ -791,6 +800,9 @@ class QuotaRunner:
|
|
|
791
800
|
else f"observe only (Free); Pro would stop it at {self.quota:g}%")
|
|
792
801
|
+ ". Read-only; your login and traffic are untouched."
|
|
793
802
|
)
|
|
803
|
+
if self.agent == "codex" and self.quota < 1:
|
|
804
|
+
self._say(f"agentcap: WARNING: Codex reports quota in whole percent, so a {self.quota:g}% cap "
|
|
805
|
+
"cannot trigger until the job has used a full 1%. Use --quota 1% or more for Codex.")
|
|
794
806
|
self.child = subprocess.Popen(argv, env=env, start_new_session=True, cwd=self.cwd)
|
|
795
807
|
|
|
796
808
|
warned = hit = parallel = observed = no_data_warned = False
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: agentcap-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: API-key spend guard for unattended Codex CLI, Gemini CLI and Claude Code runs: hard per-run cap, kills the process at the limit.
|
|
5
5
|
Project-URL: Homepage, https://agentcap.launchbench.studio
|
|
6
6
|
Project-URL: Repository, https://github.com/Blitz00X/agentcap
|
|
@@ -78,7 +78,9 @@ your subscription quota % and Codex support.
|
|
|
78
78
|
`this job used 5.1% of the weekly quota`) and the last tool call's name, as numbers and tool
|
|
79
79
|
names only, never prompts or tool inputs.
|
|
80
80
|
- **Approve.** After a stop, `agentcap approve` (or `/agentcap:approve` in the plugin) raises the
|
|
81
|
-
limit by 50%, at most twice, and the run continues.
|
|
81
|
+
limit by 50%, at most twice, and the run continues. This works for interactive Claude Code,
|
|
82
|
+
which stays open after a stop. Codex and headless `claude -p` jobs are stopped with SIGINT, so
|
|
83
|
+
there approve only helps before the limit is hit; after a stop it says so and changes nothing.
|
|
82
84
|
- **Free** runs the same detectors in observe-only mode and prints what Pro would have done.
|
|
83
85
|
|
|
84
86
|
Honest limits: Claude tool-error streaks are only caught on API-key runs (the subscription hook sees
|
|
@@ -338,7 +340,7 @@ agentcap quota # read-only: last seen usage (Fre
|
|
|
338
340
|
use in the same window counts against the job (AgentCap warns when it sees another session).
|
|
339
341
|
Values arrive once per model response, so a job **can overshoot by up to one request**.
|
|
340
342
|
Claude Code only reports `rate_limits` for Pro/Max logins and only in interactive sessions
|
|
341
|
-
(the statusline does not run in `claude -p`). Codex's rollout format is undocumented and may change.
|
|
343
|
+
(the statusline does not run in `claude -p`). Codex's rollout format is undocumented and may change. Codex reports `used_percent` in whole percent, so a Codex cap under 1% cannot trigger until the job has used a full 1% (AgentCap warns at start). Use `--quota 1%` or more for Codex.
|
|
342
344
|
**Verified so far on fixtures and fake CLIs only** (plus real Claude Code 2.1.197: the `--settings`
|
|
343
345
|
layer, the chained statusline and the `PreToolUse` deny were checked against a local fake API);
|
|
344
346
|
a check on a real Max / ChatGPT account is still pending.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
agentcap/__init__.py,sha256=
|
|
1
|
+
agentcap/__init__.py,sha256=d2cAPCN-dbocgIA2sQhRVfCZpsQd7Hw8y8JS9aP2RlQ,152
|
|
2
2
|
agentcap/adapters.py,sha256=bgLjxW06At-uIyjLTmw4AscUVRkl0d2l6G8Qn8li3T8,17465
|
|
3
3
|
agentcap/alerts.py,sha256=4Jn033yzjn7jkVwB_2LJ4w91GNBgDYFozF8UdnIf47U,13424
|
|
4
4
|
agentcap/analytics.py,sha256=eiBmmdyzapqcoC6rnaGPbON8tN9cTabae8oyXjFr3Rc,14567
|
|
@@ -16,7 +16,7 @@ agentcap/loop.py,sha256=F7dUnbkt9GvuUm6csaqjncULtSwaGaxUpBb5IGEQ6L8,14153
|
|
|
16
16
|
agentcap/plans.py,sha256=NwoRtjcFNW0yCMK2F63wozhAAN9DKOMl-ee5ZXCljO8,2895
|
|
17
17
|
agentcap/pricing.py,sha256=MR3zYlVnN1dlJwnSk5IiWGYoF7k3LuShNnIgrYWpxj8,24001
|
|
18
18
|
agentcap/proxy.py,sha256=JPtPnN9B7AN_vy5GyRHXn4NT0Aas-TBWFvpORH-wf9o,57987
|
|
19
|
-
agentcap/quota.py,sha256=
|
|
19
|
+
agentcap/quota.py,sha256=K66vd73dS2_24cj82Gjm3ZCudaxii-jCgMNgWpC8Z1o,41637
|
|
20
20
|
agentcap/report.py,sha256=RFVZab6-b9x9bnmbX5T30wV4RiZcuzlBTU4eZOJ-OKo,8563
|
|
21
21
|
agentcap/runner.py,sha256=zthG-k4fzbwEppAlFueH44hNxp3BdM7GXnXwdwbnwSg,27419
|
|
22
22
|
agentcap/upstreams.py,sha256=SSLZQh-HyEG9g867TnHOoOH2m4TneDxqBaNdXeyGuKk,4072
|
|
@@ -25,8 +25,8 @@ agentcap/waste.py,sha256=2AIfc7a67u98AZe8-bjn_xP99-XBApNc6ladxfzB_8U,21342
|
|
|
25
25
|
agentcap/data/pricing.json,sha256=e1ZtPA7nD5lpgc3LwE3GTqfXykMXPHHLNsrv1tv4oMU,17741
|
|
26
26
|
agentcap/devtools/__init__.py,sha256=EmCJZQ3xK6hAE3jPsu6w8f2IdwlW_akY0Stp2HH66Kg,60
|
|
27
27
|
agentcap/devtools/fake_upstream.py,sha256=uDKvARc0ltxn9pnxOFqJ2XNENII4-UZovTbvX9SPVYE,21760
|
|
28
|
-
agentcap_cli-0.2.
|
|
29
|
-
agentcap_cli-0.2.
|
|
30
|
-
agentcap_cli-0.2.
|
|
31
|
-
agentcap_cli-0.2.
|
|
32
|
-
agentcap_cli-0.2.
|
|
28
|
+
agentcap_cli-0.2.2.dist-info/METADATA,sha256=dJevzKWpJCbABUiTzw62umOLbCLndDdvQz6m9WVI3ZE,39951
|
|
29
|
+
agentcap_cli-0.2.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
30
|
+
agentcap_cli-0.2.2.dist-info/entry_points.txt,sha256=eUEtK13KEPXT2pO_lD6zzZWu5yHHo7EKrVQe3Fw6q4U,47
|
|
31
|
+
agentcap_cli-0.2.2.dist-info/licenses/LICENSE,sha256=b9WVuKHVLMITmseyT63ENNC9TbX_zg_I0oSQNJVGYJo,1070
|
|
32
|
+
agentcap_cli-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|