@kitman-sh/cli 0.10.85 → 0.10.87

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.
@@ -4866,9 +4866,7 @@ var claudeProviderRefusal = (line) => {
4866
4866
  if (!isJsonObject(line) || line.type !== "assistant" || line.isApiErrorMessage !== true)
4867
4867
  return;
4868
4868
  const said = bounded(isJsonObject(line.message) ? textOf(line.message.content) : "");
4869
- if (line.error === "rate_limit")
4870
- return { summary: said || "Rate limit reached", kind: "rate_limited" };
4871
- return line.error === "billing_error" ? { summary: said || "Billing error", kind: "out_of_quota" } : undefined;
4869
+ return line.error === "rate_limit" || line.error === "billing_error" ? { summary: said || "Usage limit reached", kind: "out_of_quota" } : undefined;
4872
4870
  };
4873
4871
  var codexQuotaErrors = new Set([
4874
4872
  "usage_limit_exceeded",
@@ -4891,6 +4889,15 @@ var codexProviderRefusal = (line) => {
4891
4889
  return { summary, kind: "login_refused" };
4892
4890
  return tag === "rate_limit_exceeded" || status === 429 ? { summary, kind: "rate_limited" } : undefined;
4893
4891
  };
4892
+ var codexRateLimits = (line) => {
4893
+ const event = isJsonObject(line) && line.type === "event_msg" ? line.payload : undefined;
4894
+ const limits = isJsonObject(event) && event.type === "token_count" ? event.rate_limits : undefined;
4895
+ return isJsonObject(limits) && (isJsonObject(limits.primary) || isJsonObject(limits.secondary)) ? limits : undefined;
4896
+ };
4897
+ var codexReset = (limits) => {
4898
+ const resets = [limits?.primary, limits?.secondary].flatMap((window) => isJsonObject(window) && isNumber(window.used_percent) && window.used_percent >= 100 && isNumber(window.resets_at) ? [window.resets_at] : []);
4899
+ return resetTime(resets.length === 0 ? undefined : Math.max(...resets));
4900
+ };
4894
4901
  var opencodeQuotaErrors = /^provider\.(quota|free-limit|go-limit|budget-limit|model-budget-limit|chatgpt-limit)$/;
4895
4902
  var opencodeProviderRefusal = (error) => {
4896
4903
  if (!isJsonObject(error))
@@ -5120,6 +5127,7 @@ var transcriptRelay = (input) => {
5120
5127
  const asking = new Set;
5121
5128
  let loginLost;
5122
5129
  let refusal;
5130
+ let codexLimits;
5123
5131
  let errorReadAt;
5124
5132
  const heard = (said) => {
5125
5133
  if (refusal === undefined || refusal.retried === true)
@@ -5209,10 +5217,16 @@ var transcriptRelay = (input) => {
5209
5217
  const value = decoded2(line);
5210
5218
  if (input.harness === "claude")
5211
5219
  loginLost = claudeLoginLost(value) ?? loginLost;
5212
- const refused = sessionRefusals.get(input.harness)?.(value);
5213
- if (refused !== undefined || input.harness === "pi" && piReplied(value))
5220
+ if (input.harness === "codex")
5221
+ codexLimits = codexRateLimits(value) ?? codexLimits;
5222
+ const said = sessionRefusals.get(input.harness)?.(value);
5223
+ const refused = said?.kind === "out_of_quota" && said.until === undefined && input.harness === "codex" ? { ...said, ...codexReset(codexLimits) } : said;
5224
+ const events = normalize(value);
5225
+ if (refused !== undefined)
5214
5226
  heard(refused);
5215
- return normalize(value).slice(0, maxEventsPerLine);
5227
+ else if (events.length > 0 || input.harness === "pi" && piReplied(value))
5228
+ refusal = undefined;
5229
+ return events.slice(0, maxEventsPerLine);
5216
5230
  }))).pipe(uninterruptible);
5217
5231
  yield* yieldNow;
5218
5232
  }
@@ -1651,7 +1651,7 @@ var package_default = {
1651
1651
  };
1652
1652
 
1653
1653
  // apps/cli/src/scaffold.ts
1654
- var cliVersion = "0.10.85";
1654
+ var cliVersion = "0.10.87";
1655
1655
  var packageJson = (name, scaffold) => `${JSON.stringify({
1656
1656
  name,
1657
1657
  private: true,
@@ -1901,7 +1901,7 @@ var Usage = [
1901
1901
  "Every run, loop, agent, verify, constraint, secret, claim, deploy, dev and kit command takes --json."
1902
1902
  ].join(`
1903
1903
  `);
1904
- var agentRuntime = promise(() => import("./chunk-mxkx0vj5.js"));
1904
+ var agentRuntime = promise(() => import("./chunk-h6v1w0vw.js"));
1905
1905
  var TuiLauncher = Reference("kitman/cli/TuiLauncher", {
1906
1906
  defaultValue: () => gen(function* () {
1907
1907
  const tui = yield* tryPromise({
@@ -4372,9 +4372,9 @@ function claimCommand(args) {
4372
4372
  }
4373
4373
  });
4374
4374
  }
4375
- var KitWriter = map8(promise(() => import("./chunk-dcxtztbx.js")), (build) => build.writeKit);
4375
+ var KitWriter = map8(promise(() => import("./chunk-n3prr22y.js")), (build) => build.writeKit);
4376
4376
  var KitBuilder = Reference("kitman/cli/KitBuilder", {
4377
- defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-dcxtztbx.js")), (build) => build.buildKit(directory))
4377
+ defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-n3prr22y.js")), (build) => build.buildKit(directory))
4378
4378
  });
4379
4379
  var uploadKit = (client, workspaceId, built) => gen(function* () {
4380
4380
  yield* client.uploadKitBundle(workspaceId, built.digest, { bundle: encode2(built.bundle) });
package/dist/index.js CHANGED
@@ -14,6 +14,6 @@ if (args[0] === "srt") {
14
14
  const { runOpencodeReader } = await import("./chunk-9zd52pda.js");
15
15
  runOpencodeReader();
16
16
  } else {
17
- const { runCli } = await import("./chunk-ycmnmmep.js");
17
+ const { runCli } = await import("./chunk-z7mvdzqm.js");
18
18
  runCli(args);
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitman-sh/cli",
3
- "version": "0.10.85",
3
+ "version": "0.10.87",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {
@@ -35,6 +35,14 @@ import {
35
35
  } from "./chunk-jbwk6k6m.js";
36
36
  import"./chunk-kgdppbdr.js";
37
37
  import"./chunk-tzz4fv17.js";
38
+ import {
39
+ decodeText,
40
+ mkString,
41
+ FileSystem,
42
+ Path,
43
+ withDefault,
44
+ String2
45
+ } from "./chunk-xb70ys3n.js";
38
46
  import {
39
47
  SecureRandom,
40
48
  layerWebCrypto,
@@ -47,14 +55,6 @@ import {
47
55
  kitmanMcpServer,
48
56
  RunnerRpcProtocolVersion
49
57
  } from "./chunk-w5smxtzc.js";
50
- import {
51
- decodeText,
52
- mkString,
53
- FileSystem,
54
- Path,
55
- withDefault,
56
- String2
57
- } from "./chunk-xb70ys3n.js";
58
58
  import {
59
59
  Packument,
60
60
  tarballMatches