@kitman-sh/cli 0.13.14 → 0.13.16

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 (27) hide show
  1. package/dist/{chunk-hmt2egsx.js → chunk-49gbakce.js} +6 -6
  2. package/dist/{chunk-d4kmyv5h.js → chunk-4zh7qxck.js} +4 -4
  3. package/dist/{chunk-dwxqp8ez.js → chunk-5cevjkrb.js} +16 -16
  4. package/dist/{chunk-vmww6hnk.js → chunk-5w6r4mw6.js} +30 -30
  5. package/dist/{chunk-5ba08a9e.js → chunk-at5dh2te.js} +18 -18
  6. package/dist/{chunk-5mxvqg32.js → chunk-bt22cd13.js} +15 -10
  7. package/dist/{chunk-fk5238tn.js → chunk-c9rvst3x.js} +4 -4
  8. package/dist/{chunk-hw9fcfs0.js → chunk-cbzqfz1k.js} +9 -9
  9. package/dist/{chunk-vjsqg4a5.js → chunk-d9z9cyzt.js} +32 -32
  10. package/dist/{chunk-aa30tt6t.js → chunk-fc2bhh5v.js} +2 -2
  11. package/dist/{chunk-24h0y27w.js → chunk-gq7y5v3e.js} +1 -1
  12. package/dist/{chunk-4142qeg3.js → chunk-mbqb40ev.js} +16 -16
  13. package/dist/{chunk-hgfphycc.js → chunk-nf9gdnsf.js} +17 -26
  14. package/dist/{chunk-pxvd8w2v.js → chunk-q5w3v4k1.js} +1 -1
  15. package/dist/{chunk-mmd7mjv0.js → chunk-s88vcvtd.js} +3 -3
  16. package/dist/{chunk-6agcvxbj.js → chunk-sjdze64n.js} +10 -10
  17. package/dist/{chunk-06dwvzv0.js → chunk-t4xwk14b.js} +152 -107
  18. package/dist/{chunk-89rpg6j9.js → chunk-tntbdpmy.js} +86 -86
  19. package/dist/{chunk-st8ggqv1.js → chunk-ttk3d0z2.js} +154 -142
  20. package/dist/{chunk-zencwg2t.js → chunk-v1e4g2re.js} +1 -1
  21. package/dist/{chunk-8xpdkxr7.js → chunk-vsrjg9nm.js} +68 -22
  22. package/dist/{chunk-ggmwpwhf.js → chunk-x7acexnm.js} +5 -5
  23. package/dist/{chunk-ef3nzqng.js → chunk-y7p4d14b.js} +3 -3
  24. package/dist/{chunk-3vbs995s.js → chunk-zd6y6ka8.js} +167 -123
  25. package/dist/{chunk-zgraq2y3.js → chunk-zw3gf6r5.js} +28 -70
  26. package/dist/index.js +4 -4
  27. package/package.json +1 -1
@@ -4,9 +4,9 @@ import {
4
4
  opaqueTunnelRefusal2,
5
5
  isOpaqueConnectReason2,
6
6
  runSrtStep2
7
- } from "./chunk-ggmwpwhf.js";
8
- import"./chunk-pxvd8w2v.js";
9
- import"./chunk-zgraq2y3.js";
7
+ } from "./chunk-x7acexnm.js";
8
+ import"./chunk-q5w3v4k1.js";
9
+ import"./chunk-zw3gf6r5.js";
10
10
  export {
11
11
  isOpaqueConnectReason2 as isOpaqueConnectReason,
12
12
  opaqueTunnelRefusal2 as opaqueTunnelRefusal,
@@ -1,8 +1,5 @@
1
1
  // @bun
2
- import {
3
- FileSystem,
4
- Path
5
- } from "./chunk-hgfphycc.js";
2
+ import"./chunk-q5w3v4k1.js";
6
3
  import {
7
4
  isObject,
8
5
  isUint8Array,
@@ -17,23 +14,26 @@ import {
17
14
  isJsonObject,
18
15
  decodeJsonString,
19
16
  encodePrettyJsonString
20
- } from "./chunk-zgraq2y3.js";
21
- import"./chunk-pxvd8w2v.js";
17
+ } from "./chunk-zw3gf6r5.js";
18
+ import {
19
+ FileSystem,
20
+ Path
21
+ } from "./chunk-nf9gdnsf.js";
22
22
  import {
23
23
  tomlTableHeader2,
24
24
  tomlKeyPath2,
25
25
  kitmanSkillEntry,
26
26
  isPathWithin2
27
- } from "./chunk-hw9fcfs0.js";
27
+ } from "./chunk-cbzqfz1k.js";
28
28
  import {
29
29
  instructionsStart,
30
30
  instructionsEnd,
31
31
  renderMcpServer,
32
32
  materializeKitSetup,
33
33
  tomlInline
34
- } from "./chunk-3vbs995s.js";
35
- import"./chunk-4142qeg3.js";
36
- import"./chunk-8xpdkxr7.js";
34
+ } from "./chunk-zd6y6ka8.js";
35
+ import"./chunk-mbqb40ev.js";
36
+ import"./chunk-vsrjg9nm.js";
37
37
 
38
38
  // packages/agent-runtime/src/kit-setup-sync.ts
39
39
  class KitSyncError extends TaggedError("KitSyncError") {
@@ -1,4 +1,85 @@
1
1
  // @bun
2
+ import {
3
+ Id,
4
+ secretReference,
5
+ secretPlaceholder
6
+ } from "./chunk-q5w3v4k1.js";
7
+ import {
8
+ currentTimeMillis,
9
+ SecureRandom,
10
+ layerWebCrypto,
11
+ layer,
12
+ layer2,
13
+ toDate,
14
+ toIso,
15
+ wallClockMillis,
16
+ redactCredentials,
17
+ redactedOutputTail,
18
+ AgentSkillRequirement,
19
+ AgentMcpServerRequirement,
20
+ AgentEnvironmentFragment,
21
+ findForbiddenAgentEnvironmentSecretPath,
22
+ findForbiddenRepoBindingSecretPath,
23
+ runnerAgentSandboxPolicy,
24
+ agentNetworkAllowlist,
25
+ verificationNetworkAllowlist,
26
+ programNetworkHosts,
27
+ canonicalSha256,
28
+ tokensSpent,
29
+ reportedModelName,
30
+ isTestReportName,
31
+ failedTestOfLine,
32
+ checkTests,
33
+ MeasureSample,
34
+ catchUpPathLimit,
35
+ createId,
36
+ digestSha256,
37
+ AgentEvent,
38
+ get,
39
+ post,
40
+ setHeaders,
41
+ acceptJson,
42
+ bodyJsonUnsafe,
43
+ bodyUrlParams,
44
+ schemaBodyJson,
45
+ filterStatusOk,
46
+ HttpClient,
47
+ layer4,
48
+ SetupArchive,
49
+ kitMcpSecretNames,
50
+ RunSettled,
51
+ UpdateAvailable,
52
+ HERDR_CORE_GENERATION2,
53
+ HERDR_CORE_INSTALL_COMMAND2,
54
+ HerdrCoreMissing2,
55
+ HerdrCoreIncompatible2,
56
+ HerdrCoreConnectionLost2,
57
+ HerdrCoreRpcError2,
58
+ HerdrCoreUpdateFailed2,
59
+ HerdrCore2,
60
+ herdrCoreLayer2,
61
+ herdrCoreTransportLayer2,
62
+ updateHerdrCore2,
63
+ CommandFailed2,
64
+ runCommand2,
65
+ withoutPreloads2,
66
+ shellOutputTailChars2,
67
+ runProcess2,
68
+ CommandRunner2,
69
+ runShell2,
70
+ detectHarnesses2,
71
+ isKitHarness,
72
+ materializeKitSetup,
73
+ tomlInline,
74
+ herdrExecutionExtension2,
75
+ herdrNativeExtensionIds2,
76
+ herdrRunnerCapabilitiesForRepoBinding2,
77
+ herdrRunnerCapabilities2,
78
+ assertHerdrRunnerCapability2,
79
+ installCommand,
80
+ checkServicesFile,
81
+ checkServices
82
+ } from "./chunk-zd6y6ka8.js";
2
83
  import {
3
84
  pipeArguments,
4
85
  dual,
@@ -41,7 +122,7 @@ import {
41
122
  isFailure2,
42
123
  hasInterrupts,
43
124
  makeUnsafe5,
44
- make15,
125
+ make16,
45
126
  _await,
46
127
  fail5,
47
128
  isDoneUnsafe,
@@ -168,7 +249,7 @@ import {
168
249
  decodeJsonStringSync,
169
250
  encodeUnknownJsonStringSync,
170
251
  storable
171
- } from "./chunk-zgraq2y3.js";
252
+ } from "./chunk-zw3gf6r5.js";
172
253
  import {
173
254
  join,
174
255
  interrupt,
@@ -177,7 +258,7 @@ import {
177
258
  unbounded2,
178
259
  offer,
179
260
  makeUnsafe3,
180
- make10,
261
+ make11,
181
262
  fromQueue,
182
263
  fromPubSub,
183
264
  map2,
@@ -211,87 +292,7 @@ import {
211
292
  writeSrtSettings2,
212
293
  srtStepArgv2,
213
294
  srtArgv2
214
- } from "./chunk-hgfphycc.js";
215
- import {
216
- Id,
217
- secretReference,
218
- secretPlaceholder
219
- } from "./chunk-pxvd8w2v.js";
220
- import {
221
- currentTimeMillis,
222
- SecureRandom,
223
- layerWebCrypto,
224
- layer,
225
- layer2,
226
- toDate,
227
- toIso,
228
- wallClockMillis,
229
- redactCredentials,
230
- redactedOutputTail,
231
- AgentSkillRequirement,
232
- AgentMcpServerRequirement,
233
- AgentEnvironmentFragment,
234
- findForbiddenAgentEnvironmentSecretPath,
235
- findForbiddenRepoBindingSecretPath,
236
- runnerAgentSandboxPolicy,
237
- agentNetworkAllowlist,
238
- verificationNetworkAllowlist,
239
- programNetworkHosts,
240
- canonicalSha256,
241
- tokensSpent,
242
- isTestReportName,
243
- failedTestOfLine,
244
- checkTests,
245
- MeasureSample,
246
- catchUpPathLimit,
247
- createId,
248
- digestSha256,
249
- AgentEvent,
250
- get,
251
- post,
252
- setHeaders,
253
- acceptJson,
254
- bodyJsonUnsafe,
255
- bodyUrlParams,
256
- schemaBodyJson,
257
- filterStatusOk,
258
- HttpClient,
259
- layer4,
260
- SetupArchive,
261
- kitMcpSecretNames,
262
- RunSettled,
263
- UpdateAvailable,
264
- HERDR_CORE_GENERATION2,
265
- HERDR_CORE_INSTALL_COMMAND2,
266
- HerdrCoreMissing2,
267
- HerdrCoreIncompatible2,
268
- HerdrCoreConnectionLost2,
269
- HerdrCoreRpcError2,
270
- HerdrCoreUpdateFailed2,
271
- HerdrCore2,
272
- herdrCoreLayer2,
273
- herdrCoreTransportLayer2,
274
- updateHerdrCore2,
275
- CommandFailed2,
276
- runCommand2,
277
- withoutPreloads2,
278
- shellOutputTailChars2,
279
- runProcess2,
280
- CommandRunner2,
281
- runShell2,
282
- detectHarnesses2,
283
- isKitHarness,
284
- materializeKitSetup,
285
- tomlInline,
286
- herdrExecutionExtension2,
287
- herdrNativeExtensionIds2,
288
- herdrRunnerCapabilitiesForRepoBinding2,
289
- herdrRunnerCapabilities2,
290
- assertHerdrRunnerCapability2,
291
- installCommand,
292
- checkServicesFile,
293
- checkServices
294
- } from "./chunk-3vbs995s.js";
295
+ } from "./chunk-nf9gdnsf.js";
295
296
  import {
296
297
  writeAgentEnvironmentConfigFile2,
297
298
  readManifestSkillPaths2,
@@ -307,8 +308,8 @@ import {
307
308
  applyAgentEnvironmentMaterialization2,
308
309
  isPathWithin2,
309
310
  skillIdentity2
310
- } from "./chunk-hw9fcfs0.js";
311
- import"./chunk-4142qeg3.js";
311
+ } from "./chunk-cbzqfz1k.js";
312
+ import"./chunk-mbqb40ev.js";
312
313
  import {
313
314
  egressAllowed,
314
315
  writeSecretRegistry,
@@ -318,7 +319,7 @@ import {
318
319
  secretFilter2,
319
320
  opaqueTunnelRefusal2,
320
321
  isOpaqueConnectReason2
321
- } from "./chunk-ggmwpwhf.js";
322
+ } from "./chunk-x7acexnm.js";
322
323
  import {
323
324
  sliceBytes2,
324
325
  maxLineBytes2,
@@ -326,23 +327,23 @@ import {
326
327
  decodedOption2,
327
328
  decoded2,
328
329
  readOpencode2
329
- } from "./chunk-5mxvqg32.js";
330
+ } from "./chunk-bt22cd13.js";
330
331
  import {
331
332
  uploadRunFile,
332
333
  programLease,
333
334
  rpcRunFiles,
334
335
  programHostsEnv,
335
336
  undeclaredHostsEnv
336
- } from "./chunk-vjsqg4a5.js";
337
- import"./chunk-dwxqp8ez.js";
337
+ } from "./chunk-d9z9cyzt.js";
338
+ import"./chunk-5cevjkrb.js";
338
339
  import {
339
340
  nextInt
340
- } from "./chunk-24h0y27w.js";
341
+ } from "./chunk-gq7y5v3e.js";
341
342
  import {
342
343
  ChildProcessSpawner,
343
- make2
344
- } from "./chunk-8xpdkxr7.js";
345
- import"./chunk-vmww6hnk.js";
344
+ make3
345
+ } from "./chunk-vsrjg9nm.js";
346
+ import"./chunk-5w6r4mw6.js";
346
347
 
347
348
  // packages/core/src/sync-kit.ts
348
349
  import { createHash } from "crypto";
@@ -4384,6 +4385,8 @@ var runAttempt = (request, options) => gen(function* () {
4384
4385
  }
4385
4386
  if (ready.value.end !== undefined)
4386
4387
  return ended("terminal_ended")(yield* judge(ready.value));
4388
+ if (request.launched !== undefined)
4389
+ yield* request.launched;
4387
4390
  const brief = firstMessage(request.launch, workspace, launch.systemBrief === true);
4388
4391
  const readyTurn = ready.value.turn;
4389
4392
  const deliver = (tries) => gen(function* () {
@@ -4988,22 +4991,29 @@ function runReplica(control, executor, signals) {
4988
4991
  let leaseLost = false;
4989
4992
  let crashed;
4990
4993
  let tokens;
4994
+ let ranModel;
4991
4995
  const takeSpent = executor.spent?.(work.id) ?? undefined_;
4992
4996
  return yield* gen(function* () {
4993
4997
  const execution = executor.execute(work).pipe(mapError2((cause) => new RunnerReplicaError({ operation: "execute", kind: "rejected", cause })));
4994
4998
  const raced = yield* raceFirst(execution, raceFirst(workHeartbeat, pushedStop)).pipe(catchIf((error) => error instanceof RunnerReplicaCancellation, () => succeed6({ status: "canceled", failureSummary: "Cancellation requested" })));
4995
4999
  const cutOff = yield* takeSpent;
4996
- const outcome = "tokens" in raced || cutOff === undefined ? raced : { ...raced, tokens: cutOff };
5000
+ const outcome = "tokens" in raced || cutOff === undefined ? raced : { ...raced, ...cutOff };
4997
5001
  if (outcome.status === "deferred") {
4998
5002
  crashed = outcome.crashed;
4999
5003
  tokens = outcome.tokens;
5004
+ ranModel = outcome.ranModel;
5000
5005
  return { status: "deferred" };
5001
5006
  }
5002
5007
  if (outcome.status === "settled") {
5003
5008
  tokens = "tokens" in outcome ? outcome.tokens : undefined;
5004
- completed = tokens === undefined;
5009
+ ranModel = "ranModel" in outcome ? outcome.ranModel : undefined;
5010
+ completed = tokens === undefined && ranModel === undefined;
5005
5011
  return { status: "completed", workUnitId: work.id };
5006
5012
  }
5013
+ if (outcome.status !== "failed" || outcome.harnessHold?.reason !== "failed_to_start") {
5014
+ tokens = "tokens" in outcome ? outcome.tokens : undefined;
5015
+ ranModel = "ranModel" in outcome ? outcome.ranModel : undefined;
5016
+ }
5007
5017
  yield* call("complete", () => control.complete({
5008
5018
  workUnitId: work.id,
5009
5019
  lease,
@@ -5014,7 +5024,10 @@ function runReplica(control, executor, signals) {
5014
5024
  return { status: "completed", workUnitId: work.id };
5015
5025
  }).pipe(tapError2((error) => sync2(() => {
5016
5026
  leaseLost = error instanceof RunnerReplicaError && error.operation !== "execute" && error.kind !== "transient";
5017
- })), ensuring2(suspend3(() => completed || leaseLost ? void_3 : call("release", () => control.release(work.id, lease, crashed, tokens)).pipe(timeout(releaseTimeout), catch_((error) => logWarning("runner_release_failed", error.message))))), ensuring2(asVoid(takeSpent)), ensuring2(control.finished?.() ?? void_3));
5027
+ })), ensuring2(suspend3(() => completed || leaseLost ? void_3 : gen(function* () {
5028
+ const cutOff = tokens === undefined && ranModel === undefined ? yield* takeSpent : undefined;
5029
+ yield* call("release", () => control.release(work.id, lease, crashed, cutOff?.tokens ?? tokens, cutOff?.ranModel ?? ranModel));
5030
+ }).pipe(timeout(releaseTimeout), catch_((error) => logWarning("runner_release_failed", error.message))))), ensuring2(asVoid(takeSpent)), ensuring2(control.finished?.() ?? void_3));
5018
5031
  }));
5019
5032
  }
5020
5033
  var ConcurrencyRecheck = seconds(1);
@@ -5290,6 +5303,12 @@ var tokenCounter = (harness) => {
5290
5303
  let reported = false;
5291
5304
  let message;
5292
5305
  let codexTotal;
5306
+ let model;
5307
+ const ran = (named) => {
5308
+ const identified = isString2(named) ? reportedModelName(named) : undefined;
5309
+ if (identified !== undefined)
5310
+ model = identified;
5311
+ };
5293
5312
  const add = (usage) => {
5294
5313
  reported = true;
5295
5314
  counted.input += usage.input;
@@ -5302,6 +5321,7 @@ var tokenCounter = (harness) => {
5302
5321
  return;
5303
5322
  const { usage } = said;
5304
5323
  const id = isString2(said.id) ? said.id : undefined;
5324
+ ran(said.model);
5305
5325
  const spent = {
5306
5326
  input: count(usage.input_tokens) + count(usage.cache_creation_input_tokens),
5307
5327
  output: count(usage.output_tokens),
@@ -5319,6 +5339,8 @@ var tokenCounter = (harness) => {
5319
5339
  add(spent);
5320
5340
  };
5321
5341
  const codex = (line) => {
5342
+ if (line.type === "turn_context" && isJsonObject(line.payload))
5343
+ ran(line.payload.model);
5322
5344
  const event = line.type === "event_msg" ? line.payload : undefined;
5323
5345
  const info = isJsonObject(event) && event.type === "token_count" ? event.info : undefined;
5324
5346
  if (!isJsonObject(info) || !isJsonObject(info.last_token_usage))
@@ -5336,6 +5358,7 @@ var tokenCounter = (harness) => {
5336
5358
  if (!isJsonObject(said) || said.role !== "assistant" || !isJsonObject(said.usage))
5337
5359
  return;
5338
5360
  const { usage } = said;
5361
+ ran(said.model);
5339
5362
  add({
5340
5363
  input: count(usage.input) + count(usage.cacheWrite),
5341
5364
  output: count(usage.output),
@@ -5353,6 +5376,7 @@ var tokenCounter = (harness) => {
5353
5376
  if (read !== undefined && isJsonObject(line))
5354
5377
  read(line);
5355
5378
  },
5379
+ model: () => model,
5356
5380
  tokens: () => {
5357
5381
  if (!reported)
5358
5382
  return "none";
@@ -5580,6 +5604,12 @@ var transcriptRelay = (input) => {
5580
5604
  let refusal;
5581
5605
  let codexLimits;
5582
5606
  let errorReadAt;
5607
+ let opencodeModel;
5608
+ const namedModel = (named) => {
5609
+ const identified = named === null ? undefined : reportedModelName(named);
5610
+ if (identified !== undefined)
5611
+ opencodeModel = identified;
5612
+ };
5583
5613
  const heard = (said) => {
5584
5614
  if (refusal === undefined || refusal.retried === true)
5585
5615
  refusal = said;
@@ -5795,6 +5825,7 @@ var transcriptRelay = (input) => {
5795
5825
  asking: sync2(() => asking.size > 0),
5796
5826
  loginLost: sync2(() => loginLost),
5797
5827
  refusal: sync2(() => refusal),
5828
+ ranModel: sync2(() => opencodeModel ?? tokens.model()),
5798
5829
  tokens: (source) => gen(function* () {
5799
5830
  const own = tokens.tokens();
5800
5831
  if (source?.kind !== "file" || source.subagents === undefined)
@@ -5812,8 +5843,10 @@ var transcriptRelay = (input) => {
5812
5843
  yield* flush;
5813
5844
  yield* yieldNow;
5814
5845
  }
5815
- if (extent !== errorReadAt)
5846
+ if (extent !== errorReadAt) {
5816
5847
  heard(opencodeProviderRefusal(yield* readOpencode2(source, "lastError", { v2: true })));
5848
+ namedModel(yield* readOpencode2(source, "lastModel", { v2: true }));
5849
+ }
5817
5850
  errorReadAt = extent;
5818
5851
  return;
5819
5852
  }
@@ -5826,6 +5859,7 @@ var transcriptRelay = (input) => {
5826
5859
  yield* yieldNow;
5827
5860
  }
5828
5861
  heard(opencodeProviderRefusal(yield* readOpencode2(source, "lastError", { v2: false })));
5862
+ namedModel(yield* readOpencode2(source, "lastModel", { v2: false }));
5829
5863
  return;
5830
5864
  }
5831
5865
  yield* drain;
@@ -6316,6 +6350,9 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6316
6350
  });
6317
6351
  let source;
6318
6352
  let tokens;
6353
+ let ranModel;
6354
+ let launched = false;
6355
+ const attemptScope = yield* scope2;
6319
6356
  const relayed = relay === undefined || adapter === undefined ? void_3 : gen(function* () {
6320
6357
  source ??= yield* transcriptSource(adapter, {
6321
6358
  ...sessions,
@@ -6411,7 +6448,9 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6411
6448
  host: refusal.host.slice(0, 300),
6412
6449
  reason: refusal.reason.slice(0, 500)
6413
6450
  }
6414
- ])).pipe(raceFirst(stalled), raceFirst(parked), raceFirst(providerRefused), raceFirst(loginLost), onExit((exit) => gen(function* () {
6451
+ ]), andThen2(sync2(() => {
6452
+ launched = true;
6453
+ }), input.harnessStarted === undefined ? void_3 : asVoid(forkIn(input.harnessStarted(work).pipe(retry({ times: 3, schedule: exponential("1 second") }), catch_((error) => logWarning("runner_harness_started_report_failed", error.message))), attemptScope)))).pipe(raceFirst(stalled), raceFirst(parked), raceFirst(providerRefused), raceFirst(loginLost), onExit((exit) => gen(function* () {
6415
6454
  if (relay === undefined || relaying === undefined)
6416
6455
  return;
6417
6456
  yield* interrupt(relaying);
@@ -6419,7 +6458,12 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6419
6458
  yield* relayed.pipe(timeout("5 seconds"), ignore);
6420
6459
  const spentNow = yield* relay.tokens(source).pipe(timeoutOrElse({ duration: "5 seconds", orElse: () => relay.tokens(undefined) }));
6421
6460
  tokens = spentNow;
6422
- input.spending?.set(work.id, spentNow);
6461
+ ranModel = yield* relay.ranModel;
6462
+ if (launched && !(isSuccess2(exit) && failedToStart(exit.value)))
6463
+ input.spending?.set(work.id, {
6464
+ tokens: spentNow,
6465
+ ...ranModel === undefined ? undefined : { ranModel }
6466
+ });
6423
6467
  yield* andThen2(relay.record([{ kind: "lifecycle", state }]), relay.lastFlush).pipe(timeout("5 seconds"), ignore);
6424
6468
  const sending = yield* forkIn(relay.sendRest, input.runnerScope ?? makeUnsafe6());
6425
6469
  resending.set(work.id, sending);
@@ -6428,7 +6472,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6428
6472
  })));
6429
6473
  if (checkpointing !== undefined)
6430
6474
  yield* interrupt(checkpointing);
6431
- const spent = tokens === undefined ? undefined : { tokens };
6475
+ const spent = tokens === undefined || !launched ? undefined : { tokens, ...ranModel === undefined ? undefined : { ranModel } };
6432
6476
  if (ran.status === "parked")
6433
6477
  return { status: "deferred", ...spent };
6434
6478
  const refused = ran.status === "failed" && !("harnessHold" in ran) && relay !== undefined ? yield* relay.refusal : undefined;
@@ -6474,6 +6518,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6474
6518
  return yield* deliver(work.branch, spent);
6475
6519
  }).pipe(scoped);
6476
6520
  var agentStepExecutor = (input) => stepAttempt(input, new Map);
6521
+ var failedToStart = (ran) => ran.status === "failed" && ran.harnessHold?.reason === "failed_to_start";
6477
6522
  var checkpointRef = (work) => `refs/kitman/checkpoints/${work.runId}/${work.id}`;
6478
6523
 
6479
6524
  // packages/agent-runtime/src/herdr-executor.ts
@@ -7040,7 +7085,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
7040
7085
  const input = yield* unbounded2();
7041
7086
  const pending = new Map;
7042
7087
  let lastId = 0;
7043
- const handle = yield* spawner.spawn(make2(binary, ["app-server"], {
7088
+ const handle = yield* spawner.spawn(make3(binary, ["app-server"], {
7044
7089
  cwd: env.home,
7045
7090
  extendEnv: true,
7046
7091
  env: { HOME: env.home, CODEX_HOME: env.codexHome },
@@ -7063,7 +7108,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
7063
7108
  return {
7064
7109
  request: (method, params) => gen(function* () {
7065
7110
  const id = ++lastId;
7066
- const deferred = yield* make15();
7111
+ const deferred = yield* make16();
7067
7112
  pending.set(id, deferred);
7068
7113
  yield* send({ id, method, params });
7069
7114
  return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
@@ -7203,10 +7248,10 @@ var handshake = [
7203
7248
  `).join("");
7204
7249
  var kitmanMcpPreflight = (mcp) => gen(function* () {
7205
7250
  const spawner = yield* ChildProcessSpawner;
7206
- const server = yield* spawner.spawn(make2(mcp.command, [...mcp.args], {
7251
+ const server = yield* spawner.spawn(make3(mcp.command, [...mcp.args], {
7207
7252
  extendEnv: true,
7208
7253
  env: mcp.env,
7209
- stdin: { stream: make10(new TextEncoder().encode(handshake)), endOnDone: false },
7254
+ stdin: { stream: make11(new TextEncoder().encode(handshake)), endOnDone: false },
7210
7255
  stderr: "ignore"
7211
7256
  }));
7212
7257
  const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
@@ -7279,8 +7324,8 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
7279
7324
  };
7280
7325
  const exitCode = sandbox === undefined ? yield* gen(function* () {
7281
7326
  const spawner = yield* ChildProcessSpawner;
7282
- const handle = yield* spawner.spawn(make2(input.bun ?? process.execPath, [file], {
7283
- stdin: make10(new TextEncoder().encode(stdin)),
7327
+ const handle = yield* spawner.spawn(make3(input.bun ?? process.execPath, [file], {
7328
+ stdin: make11(new TextEncoder().encode(stdin)),
7284
7329
  stdout: "inherit",
7285
7330
  stderr: "inherit",
7286
7331
  extendEnv: false,