@cat-factory/executor-harness 1.131.0 → 1.132.3

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.
package/dist/pi.d.ts CHANGED
@@ -314,6 +314,21 @@ export interface HarnessCallMetric {
314
314
  * turn. `CliInlineLanguageModel`'s step-level row is the same idea on the inline path.
315
315
  */
316
316
  standsForJob?: boolean;
317
+ /**
318
+ * This row carries only TOKENS and stands for no model call of its own, so the backend counts it
319
+ * in every token sum and in no `calls` figure.
320
+ *
321
+ * Separate from {@link standsForJob}, which is only about the missing TURN ordinal. The
322
+ * shortfall row occupies no turn either way, but when the CLI narrated NO turns at all it is the
323
+ * job's only record and IS the call — nothing else recorded it, and a count excluding it would
324
+ * report a step that burned tokens across zero calls. The producer is the only layer that can
325
+ * tell the two apart: the backend sees one BATCH of a job's calls at a time (the live drain
326
+ * splits them across polls), so it cannot ask whether any turn was narrated.
327
+ *
328
+ * Absent on every real turn. `CliInlineLanguageModel.fileUnaccounted` makes the same split on
329
+ * the inline path, off its own `reported > 0`.
330
+ */
331
+ spendOnly?: boolean;
317
332
  }
318
333
  /**
319
334
  * Publish one captured model call: append it to the run's list (which becomes the terminal
@@ -49,6 +49,14 @@ export declare function claudeUsage(raw: unknown): {
49
49
  *
50
50
  * Clamped at 0 per side: a CLI whose terminal figure is LOWER than its own per-turn sum has
51
51
  * reported the two inconsistently, and negative spend is not a thing to record.
52
+ *
53
+ * {@link HarnessCallMetric.spendOnly} is decided HERE, and it is not the same question as
54
+ * `standsForJob`. The row never occupies a turn, but whether it is a CALL depends on whether any
55
+ * turn was narrated beside it: with costed turns present this only corrects THEIR under-reporting
56
+ * (counting it would report one phantom call per dispatch), while with none it is the job's ONLY
57
+ * record and excluding it would report a step that spent tokens across zero calls. Only this
58
+ * function can answer that — the backend records a job's calls in BATCHES as the live drain
59
+ * delivers them, so a batch holding just this row cannot tell the two cases apart.
52
60
  */
53
61
  export declare function unaccountedUsageCall(parentCalls: readonly HarnessCallMetric[], usage: {
54
62
  inputTokens: number;
@@ -62,6 +62,14 @@ export function claudeUsage(raw) {
62
62
  *
63
63
  * Clamped at 0 per side: a CLI whose terminal figure is LOWER than its own per-turn sum has
64
64
  * reported the two inconsistently, and negative spend is not a thing to record.
65
+ *
66
+ * {@link HarnessCallMetric.spendOnly} is decided HERE, and it is not the same question as
67
+ * `standsForJob`. The row never occupies a turn, but whether it is a CALL depends on whether any
68
+ * turn was narrated beside it: with costed turns present this only corrects THEIR under-reporting
69
+ * (counting it would report one phantom call per dispatch), while with none it is the job's ONLY
70
+ * record and excluding it would report a step that spent tokens across zero calls. Only this
71
+ * function can answer that — the backend records a job's calls in BATCHES as the live drain
72
+ * delivers them, so a batch holding just this row cannot tell the two cases apart.
65
73
  */
66
74
  export function unaccountedUsageCall(parentCalls, usage) {
67
75
  if (!usage)
@@ -92,5 +100,6 @@ export function unaccountedUsageCall(parentCalls, usage) {
92
100
  outputTokens,
93
101
  finishReason: null,
94
102
  standsForJob: true,
103
+ spendOnly: parentCalls.length > 0,
95
104
  };
96
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/executor-harness",
3
- "version": "1.131.0",
3
+ "version": "1.132.3",
4
4
  "description": "Container payload: a thin TypeScript wrapper that runs the Pi coding agent against a cloned repo and opens a PR. Runs in the Cloudflare Container (and, in local native mode, as a host process); carries no secrets.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,12 +25,12 @@
25
25
  "access": "public"
26
26
  },
27
27
  "devDependencies": {
28
- "@cat-factory/kernel": "0.318.0",
29
- "@cat-factory/server": "0.305.0",
30
- "@cat-factory/spend": "0.16.12",
28
+ "@cat-factory/kernel": "0.320.0",
29
+ "@cat-factory/server": "0.306.4",
30
+ "@cat-factory/spend": "0.16.16",
31
31
  "@hono/node-server": "^2.1.1",
32
32
  "@types/node": "^26.2.0",
33
- "hono": "^4.13.3",
33
+ "hono": "^4.13.4",
34
34
  "typescript": "7.0.2",
35
35
  "vitest": "^4.1.11"
36
36
  },
package/src/pi.ts CHANGED
@@ -652,6 +652,21 @@ export interface HarnessCallMetric {
652
652
  * turn. `CliInlineLanguageModel`'s step-level row is the same idea on the inline path.
653
653
  */
654
654
  standsForJob?: boolean
655
+ /**
656
+ * This row carries only TOKENS and stands for no model call of its own, so the backend counts it
657
+ * in every token sum and in no `calls` figure.
658
+ *
659
+ * Separate from {@link standsForJob}, which is only about the missing TURN ordinal. The
660
+ * shortfall row occupies no turn either way, but when the CLI narrated NO turns at all it is the
661
+ * job's only record and IS the call — nothing else recorded it, and a count excluding it would
662
+ * report a step that burned tokens across zero calls. The producer is the only layer that can
663
+ * tell the two apart: the backend sees one BATCH of a job's calls at a time (the live drain
664
+ * splits them across polls), so it cannot ask whether any turn was narrated.
665
+ *
666
+ * Absent on every real turn. `CliInlineLanguageModel.fileUnaccounted` makes the same split on
667
+ * the inline path, off its own `reported > 0`.
668
+ */
669
+ spendOnly?: boolean
655
670
  }
656
671
 
657
672
  /**
@@ -67,6 +67,14 @@ export function claudeUsage(
67
67
  *
68
68
  * Clamped at 0 per side: a CLI whose terminal figure is LOWER than its own per-turn sum has
69
69
  * reported the two inconsistently, and negative spend is not a thing to record.
70
+ *
71
+ * {@link HarnessCallMetric.spendOnly} is decided HERE, and it is not the same question as
72
+ * `standsForJob`. The row never occupies a turn, but whether it is a CALL depends on whether any
73
+ * turn was narrated beside it: with costed turns present this only corrects THEIR under-reporting
74
+ * (counting it would report one phantom call per dispatch), while with none it is the job's ONLY
75
+ * record and excluding it would report a step that spent tokens across zero calls. Only this
76
+ * function can answer that — the backend records a job's calls in BATCHES as the live drain
77
+ * delivers them, so a batch holding just this row cannot tell the two cases apart.
70
78
  */
71
79
  export function unaccountedUsageCall(
72
80
  parentCalls: readonly HarnessCallMetric[],
@@ -98,5 +106,6 @@ export function unaccountedUsageCall(
98
106
  outputTokens,
99
107
  finishReason: null,
100
108
  standsForJob: true,
109
+ spendOnly: parentCalls.length > 0,
101
110
  }
102
111
  }