@kitman-sh/cli 0.10.57 → 0.10.59

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 (26) hide show
  1. package/dist/{chunk-jc920h47.js → chunk-09jf8588.js} +9 -4
  2. package/dist/{chunk-cy5fbrfm.js → chunk-0fdgam8v.js} +2 -8
  3. package/dist/{chunk-g53wn1q8.js → chunk-1w81w56v.js} +2 -2
  4. package/dist/{chunk-x3mgznk2.js → chunk-1z9p4q8b.js} +2 -2
  5. package/dist/{chunk-h8s4vh47.js → chunk-5y050gx7.js} +10 -10
  6. package/dist/{chunk-v43h8s08.js → chunk-88257wax.js} +10 -10
  7. package/dist/{chunk-a1yf46xt.js → chunk-a4798jzf.js} +3 -3
  8. package/dist/{chunk-61k67vxh.js → chunk-d3ksv8y1.js} +4 -3
  9. package/dist/{chunk-q5s64k8g.js → chunk-d8awdfdj.js} +159 -43
  10. package/dist/{chunk-de4cfe40.js → chunk-e3tv8mv2.js} +4 -4
  11. package/dist/{chunk-5tfxtw9z.js → chunk-eawcprsb.js} +2 -2
  12. package/dist/{chunk-mjzvfh9d.js → chunk-hvev0dve.js} +8 -8
  13. package/dist/{chunk-23vene3j.js → chunk-hxkk42cg.js} +4 -4
  14. package/dist/{chunk-wd0rvdt4.js → chunk-phmma642.js} +5 -5
  15. package/dist/{chunk-gwcqz1bj.js → chunk-q3c7vmby.js} +1 -1
  16. package/dist/{chunk-kyqsbr2n.js → chunk-r76gsqds.js} +26 -16
  17. package/dist/{chunk-4kssrezn.js → chunk-rrnee9mk.js} +1 -1
  18. package/dist/{chunk-253add07.js → chunk-rrz0v4fg.js} +5 -5
  19. package/dist/{chunk-qhpyzn7c.js → chunk-sdpjvc1r.js} +17 -9
  20. package/dist/{chunk-nrkwrajj.js → chunk-smgvtzd2.js} +7 -7
  21. package/dist/{chunk-7evwar6b.js → chunk-v01c0k6j.js} +1 -1
  22. package/dist/{chunk-fmhy6tss.js → chunk-wkccjgwb.js} +4 -4
  23. package/dist/{chunk-99ver3za.js → chunk-wtpwkjws.js} +4 -4
  24. package/dist/{chunk-hwd2gg2f.js → chunk-z0z56a72.js} +5 -5
  25. package/dist/index.js +4 -4
  26. package/package.json +1 -1
@@ -32,9 +32,9 @@ import {
32
32
  toCodecJson,
33
33
  Json,
34
34
  encodePrettyJsonString
35
- } from "./chunk-61k67vxh.js";
36
- import"./chunk-4kssrezn.js";
37
- import"./chunk-7evwar6b.js";
35
+ } from "./chunk-d3ksv8y1.js";
36
+ import"./chunk-rrnee9mk.js";
37
+ import"./chunk-v01c0k6j.js";
38
38
  import {
39
39
  SecureRandom,
40
40
  layerWebCrypto,
@@ -46,7 +46,7 @@ import {
46
46
  layer4,
47
47
  kitmanMcpServer,
48
48
  RunnerRpcProtocolVersion
49
- } from "./chunk-qhpyzn7c.js";
49
+ } from "./chunk-sdpjvc1r.js";
50
50
  import {
51
51
  decodeText,
52
52
  mkString,
@@ -54,23 +54,23 @@ import {
54
54
  Path,
55
55
  withDefault,
56
56
  String2
57
- } from "./chunk-cy5fbrfm.js";
57
+ } from "./chunk-0fdgam8v.js";
58
58
  import {
59
59
  Packument,
60
60
  tarballMatches
61
- } from "./chunk-a1yf46xt.js";
62
- import"./chunk-23vene3j.js";
61
+ } from "./chunk-a4798jzf.js";
62
+ import"./chunk-hxkk42cg.js";
63
63
  import {
64
64
  AgentDeclaration,
65
65
  KitDeclarations,
66
66
  describeFlag,
67
67
  Described
68
- } from "./chunk-wd0rvdt4.js";
68
+ } from "./chunk-phmma642.js";
69
69
  import {
70
70
  ChildProcessSpawner,
71
71
  make3
72
- } from "./chunk-5tfxtw9z.js";
73
- import"./chunk-de4cfe40.js";
72
+ } from "./chunk-eawcprsb.js";
73
+ import"./chunk-e3tv8mv2.js";
74
74
 
75
75
  // packages/sdk/src/build/index.ts
76
76
  class DependencyInstallFailed extends TaggedError2()("DependencyInstallFailed", {
@@ -24,11 +24,11 @@ import {
24
24
  Record,
25
25
  Int,
26
26
  fromJsonString
27
- } from "./chunk-61k67vxh.js";
27
+ } from "./chunk-d3ksv8y1.js";
28
28
  import {
29
29
  withDefault,
30
30
  String2
31
- } from "./chunk-cy5fbrfm.js";
31
+ } from "./chunk-0fdgam8v.js";
32
32
  import {
33
33
  digestSha256,
34
34
  digestSha512,
@@ -38,7 +38,7 @@ import {
38
38
  get2,
39
39
  layer4,
40
40
  KitDigest
41
- } from "./chunk-qhpyzn7c.js";
41
+ } from "./chunk-sdpjvc1r.js";
42
42
 
43
43
  // packages/core/src/npm-registry.ts
44
44
  var KitManifest = Struct({
@@ -3631,7 +3631,7 @@ var asSome = (self) => map7(self, some);
3631
3631
  var andThen = /* @__PURE__ */ dual(2, (self, f) => new ContImpl(self, isEffect2(f) ? returnPayload : andThenCont, f));
3632
3632
  var tap = /* @__PURE__ */ dual(2, (self, f) => new ContImpl(self, isEffect2(f) ? tapEffectCont : tapCont, f));
3633
3633
  var asVoid2 = (self) => new ContImpl(self, returnPayload, exitVoid);
3634
- var raceAllFirst = (all, options) => withFiber((parent) => {
3634
+ var raceAllFirst2 = (all, options) => withFiber((parent) => {
3635
3635
  const fibers = new Set;
3636
3636
  onExitUnsafe(parent, () => fibers.size === 0 ? undefined : fiberInterruptAll(fibers));
3637
3637
  return callback2((resume) => {
@@ -3659,7 +3659,7 @@ var raceAllFirst = (all, options) => withFiber((parent) => {
3659
3659
  }
3660
3660
  });
3661
3661
  });
3662
- var raceFirst2 = /* @__PURE__ */ dual((args) => isEffect2(args[1]), (self, that, options) => raceAllFirst([self, that], options));
3662
+ var raceFirst2 = /* @__PURE__ */ dual((args) => isEffect2(args[1]), (self, that, options) => raceAllFirst2([self, that], options));
3663
3663
  var flatMap2 = /* @__PURE__ */ dual(2, (self, f) => new ContImpl(self, andThenCont, f));
3664
3664
  var effectIsExit = (effect) => effect[ExitTypeId] !== undefined;
3665
3665
  var flatMapEager2 = /* @__PURE__ */ dual(2, (self, f) => {
@@ -5648,6 +5648,7 @@ var timeoutOption = timeoutOption2;
5648
5648
  var timeoutOrElse = timeoutOrElse2;
5649
5649
  var delay = delay2;
5650
5650
  var sleep = sleep2;
5651
+ var raceAllFirst = raceAllFirst2;
5651
5652
  var raceFirst = raceFirst2;
5652
5653
  var filter2 = filter3;
5653
5654
  var filterOrFail = filterOrFail2;
@@ -10120,4 +10121,4 @@ var encodePrettyJsonString = encodeEffect(fromJsonString(Json, { space: 2 }));
10120
10121
  var decodeJsonStringSync = decodeUnknownSync(JsonFromString);
10121
10122
  var encodeUnknownJsonStringSync = encodeSync(fromJsonString(Unknown));
10122
10123
 
10123
- export { pipeArguments, dual, identity, constant, constTrue, constFalse, constVoid, pipe, flow, memoize, isString2, isNumber2, isBoolean2, isBigInt2, isSymbol2, isFunction2, isUndefined2, isNotUndefined, isNotNull, isNullish, isObjectOrArray, isObject2, hasProperty, isTagged, isUint8Array, symbol, hash, combine, number, string, structure, array, symbol2, equals, asEquivalence, symbolRedactable, redact, currentFiberTypeId, format, NodeInspectSymbol, toJson, BaseProto, Class, getStackTraceLimit, setStackTraceLimit, assignProperty, args, evaluate, PipeInspectableProto, isExit, causeFail, makePrimitive, exitSucceed, exitFailCause, exitFail, withFiber, Done, Prototype, make14, strictEqual, Tuple, String3, Number2, mapInput, none, some, isNone, isSome, match, getOrElse, orElse, fromNullishOr, fromUndefinedOr, getOrUndefined, liftThrowable, map4, flatMap, toArray, Service2, makeUnsafe4, empty3, make15, add, getOrUndefined2, getOrUndefinedUnsafe, getUnsafe, get4, merge3, Reference, fromInputUnsafe, isFinite, zero, infinity, millis, seconds, minutes, toMillis, min, max, subtract, format2, normalize, succeed, fail3, try_, isResult, isFailure, isSuccess, map5, getOrElse2, getOrThrow, all2, allocate, fromIterable, isArrayNonEmpty, isReadonlyArrayNonEmpty, isCanonicalArrayIndex, getUnsafe2, sort, of, map6, makeEquivalence2, TaggedClass, Error2, TaggedError, encode, DisablePropagation, getCurrentFiber, fiberJoin, fiberInterrupt, succeed2, sync, suspend2, succeedNone, void_, callback2, asSome, andThen, flatMap2, map7, exitInterrupt, exitVoid, exitZipRight, scopeAddFinalizer, scope, onExitPrimitive, onExitUnsafe, uninterruptibleMask, fiberRunIn, makeLatchUnsafe, makeLatch, ClockRef, currentTimeMillis2, ConsoleRef, succeed3, failCause2, fail4, die, interrupt2, void_2, isSuccess2, isFailure2, hasInterrupts, asVoidAll, makeUnsafe5, make16, _await, fail5, interruptWith, isDone, isDoneUnsafe, succeed4, doneUnsafe, TracerTimingEnabled, Scope, makeUnsafe6, provide, addFinalizerExit, addFinalizer, forkUnsafe, close, build, buildWithScope, succeed5, effect, effectContext, effectDiscard, mergeAll, provide2, provideMerge, isCause, isFailReason, isDieReason, fromReasons, fail6, die2, makeFailReason, makeDieReason, hasInterruptsOnly, squash, findError, findErrorOption, hasInterrupts2, interruptors, pretty, isDone2, Done2, done, IllegalArgumentError, UnknownError, reasonAnnotations, Random, catchDone, isDoneCause, filterDone, doneExitFromCause, matchEffect, max2, during, min2, exponential, jittered, spaced, isEffect, all3, findFirst, forEach, whileLoop, promise, tryPromise, succeed6, suspend3, sync2, void_3, undefined_, callback3, never, gen, fail7, failSync, failCause3, die3, try_2, yieldNow, withFiber2, fromResult, fromNullishOr2, flatMap3, flatten, andThen2, tap2, result, option2, exit, map8, as, asSome2, asVoid, zipWith, catch_, catchTag, catchTags, catchReason, catchCause2, catchDefect, catchIf, catchCauseIf, mapError2, orDie, tapError2, tapCause, retry, retryOrElse, ignore, ignoreCause, orElseSucceed, timeout, timeoutOption, timeoutOrElse, delay, sleep, raceFirst, filter2, filterOrFail, when, matchCauseEffect, matchEffect2, context, contextWith, provide3, provideContext2, service, serviceOption, updateContext, updateService, provideService, scope2, scoped, scopedWith, acquireRelease, acquireUseRelease, addFinalizer2, ensuring2, onError, onExitPrimitive2, onExit, cached, interrupt3, interruptible, onInterrupt, uninterruptible, uninterruptibleMask2, forever, repeat, annotateCurrentSpan, makeSpanScoped, useSpan, withSpan, withParentSpan, forkChild, forkIn, forkScoped, forkDetach, runFork, runForkWith, runPromise, runPromiseWith, runSync, runSyncExitWith, fnUntraced, fn, clockWith, logWarning, logError, annotateLogs, effectify, mapEager, flatMapEager, catchEager, encode2, decode, Pointer, makeFormatterStandardSchemaV1, passthrough, transformEffect, Transformation, transform, defaultParseOptions, unknown, getIndexSignatureKeys, applyToSelfOrLastLinkEncoding, decodeTo, toEncoded, decodeUnknownEffect, omit, map9, declare, SchemaError, is, decodeUnknownEffect2, decodeEffect, decodeUnknownExit, decodeUnknownOption, decodeOption, decodeSync, encodeEffect, make17, isSchema, optionalKey, optional, toType, Literal, Never, Unknown, Null, String4, Boolean2, Void, Struct, Record, StructWithRest, ArraySchema, NonEmptyArray, Union, Literals, NullOr, UndefinedOr, suspend4, decodeTo2, withDecodingDefaultKey, tag, TaggedStruct, makeFilter, isPattern, Finite, isGreaterThanOrEqualTo, isLessThanOrEqualTo, Int, isMinLength, isMaxLength, isMinProperties, isMaxProperties, isUnique, Defect, Date2, fromJsonString, FiniteFromString, Cause, Exit, Class2, Error3, TaggedError2, toEquivalence, toCodecJson, toCodecStringTree, Json, JsonObject, decodeJsonString, decodeJsonStringOption, encodeJsonStringSync, encodePrettyJsonString, decodeJsonStringSync, encodeUnknownJsonStringSync };
10124
+ export { pipeArguments, dual, identity, constant, constTrue, constFalse, constVoid, pipe, flow, memoize, isString2, isNumber2, isBoolean2, isBigInt2, isSymbol2, isFunction2, isUndefined2, isNotUndefined, isNotNull, isNullish, isObjectOrArray, isObject2, hasProperty, isTagged, isUint8Array, symbol, hash, combine, number, string, structure, array, symbol2, equals, asEquivalence, symbolRedactable, redact, currentFiberTypeId, format, NodeInspectSymbol, toJson, BaseProto, Class, getStackTraceLimit, setStackTraceLimit, assignProperty, args, evaluate, PipeInspectableProto, isExit, causeFail, makePrimitive, exitSucceed, exitFailCause, exitFail, withFiber, Done, Prototype, make14, strictEqual, Tuple, String3, Number2, mapInput, none, some, isNone, isSome, match, getOrElse, orElse, fromNullishOr, fromUndefinedOr, getOrUndefined, liftThrowable, map4, flatMap, toArray, Service2, makeUnsafe4, empty3, make15, add, getOrUndefined2, getOrUndefinedUnsafe, getUnsafe, get4, merge3, Reference, fromInputUnsafe, isFinite, zero, infinity, millis, seconds, minutes, toMillis, min, max, subtract, format2, normalize, succeed, fail3, try_, isResult, isFailure, isSuccess, map5, getOrElse2, getOrThrow, all2, allocate, fromIterable, isArrayNonEmpty, isReadonlyArrayNonEmpty, isCanonicalArrayIndex, getUnsafe2, sort, of, map6, makeEquivalence2, TaggedClass, Error2, TaggedError, encode, DisablePropagation, getCurrentFiber, fiberJoin, fiberInterrupt, succeed2, sync, suspend2, succeedNone, void_, callback2, asSome, andThen, flatMap2, map7, exitInterrupt, exitVoid, exitZipRight, scopeAddFinalizer, scope, onExitPrimitive, onExitUnsafe, uninterruptibleMask, fiberRunIn, makeLatchUnsafe, makeLatch, ClockRef, currentTimeMillis2, ConsoleRef, succeed3, failCause2, fail4, die, interrupt2, void_2, isSuccess2, isFailure2, hasInterrupts, asVoidAll, makeUnsafe5, make16, _await, fail5, interruptWith, isDone, isDoneUnsafe, succeed4, doneUnsafe, TracerTimingEnabled, Scope, makeUnsafe6, provide, addFinalizerExit, addFinalizer, forkUnsafe, close, build, buildWithScope, succeed5, effect, effectContext, effectDiscard, mergeAll, provide2, provideMerge, isCause, isFailReason, isDieReason, fromReasons, fail6, die2, makeFailReason, makeDieReason, hasInterruptsOnly, squash, findError, findErrorOption, hasInterrupts2, interruptors, pretty, isDone2, Done2, done, IllegalArgumentError, UnknownError, reasonAnnotations, Random, catchDone, isDoneCause, filterDone, doneExitFromCause, matchEffect, max2, during, min2, exponential, jittered, spaced, isEffect, all3, findFirst, forEach, whileLoop, promise, tryPromise, succeed6, suspend3, sync2, void_3, undefined_, callback3, never, gen, fail7, failSync, failCause3, die3, try_2, yieldNow, withFiber2, fromResult, fromNullishOr2, flatMap3, flatten, andThen2, tap2, result, option2, exit, map8, as, asSome2, asVoid, zipWith, catch_, catchTag, catchTags, catchReason, catchCause2, catchDefect, catchIf, catchCauseIf, mapError2, orDie, tapError2, tapCause, retry, retryOrElse, ignore, ignoreCause, orElseSucceed, timeout, timeoutOption, timeoutOrElse, delay, sleep, raceAllFirst, raceFirst, filter2, filterOrFail, when, matchCauseEffect, matchEffect2, context, contextWith, provide3, provideContext2, service, serviceOption, updateContext, updateService, provideService, scope2, scoped, scopedWith, acquireRelease, acquireUseRelease, addFinalizer2, ensuring2, onError, onExitPrimitive2, onExit, cached, interrupt3, interruptible, onInterrupt, uninterruptible, uninterruptibleMask2, forever, repeat, annotateCurrentSpan, makeSpanScoped, useSpan, withSpan, withParentSpan, forkChild, forkIn, forkScoped, forkDetach, runFork, runForkWith, runPromise, runPromiseWith, runSync, runSyncExitWith, fnUntraced, fn, clockWith, logWarning, logError, annotateLogs, effectify, mapEager, flatMapEager, catchEager, encode2, decode, Pointer, makeFormatterStandardSchemaV1, passthrough, transformEffect, Transformation, transform, defaultParseOptions, unknown, getIndexSignatureKeys, applyToSelfOrLastLinkEncoding, decodeTo, toEncoded, decodeUnknownEffect, omit, map9, declare, SchemaError, is, decodeUnknownEffect2, decodeEffect, decodeUnknownExit, decodeUnknownOption, decodeOption, decodeSync, encodeEffect, make17, isSchema, optionalKey, optional, toType, Literal, Never, Unknown, Null, String4, Boolean2, Void, Struct, Record, StructWithRest, ArraySchema, NonEmptyArray, Union, Literals, NullOr, UndefinedOr, suspend4, decodeTo2, withDecodingDefaultKey, tag, TaggedStruct, makeFilter, isPattern, Finite, isGreaterThanOrEqualTo, isLessThanOrEqualTo, Int, isMinLength, isMaxLength, isMinProperties, isMaxProperties, isUnique, Defect, Date2, fromJsonString, FiniteFromString, Cause, Exit, Class2, Error3, TaggedError2, toEquivalence, toCodecJson, toCodecStringTree, Json, JsonObject, decodeJsonString, decodeJsonStringOption, encodeJsonStringSync, encodePrettyJsonString, decodeJsonStringSync, encodeUnknownJsonStringSync };
@@ -5,7 +5,7 @@ import {
5
5
  isObject,
6
6
  isJsonObject,
7
7
  isString
8
- } from "./chunk-7evwar6b.js";
8
+ } from "./chunk-v01c0k6j.js";
9
9
  import {
10
10
  pipeArguments,
11
11
  dual,
@@ -102,6 +102,7 @@ import {
102
102
  timeoutOption,
103
103
  timeoutOrElse,
104
104
  sleep,
105
+ raceAllFirst,
105
106
  raceFirst,
106
107
  filter2,
107
108
  matchEffect2,
@@ -155,12 +156,13 @@ import {
155
156
  encodePrettyJsonString,
156
157
  decodeJsonStringSync,
157
158
  encodeUnknownJsonStringSync
158
- } from "./chunk-61k67vxh.js";
159
+ } from "./chunk-d3ksv8y1.js";
159
160
  import {
160
161
  Id,
161
162
  secretReference
162
- } from "./chunk-4kssrezn.js";
163
+ } from "./chunk-rrnee9mk.js";
163
164
  import {
165
+ currentTimeMillis,
164
166
  SecureRandom,
165
167
  layerWebCrypto,
166
168
  layer,
@@ -223,9 +225,8 @@ import {
223
225
  installCommand,
224
226
  checkServicesFile,
225
227
  checkServices
226
- } from "./chunk-qhpyzn7c.js";
228
+ } from "./chunk-sdpjvc1r.js";
227
229
  import {
228
- currentTimeMillis,
229
230
  join,
230
231
  interrupt,
231
232
  unbounded,
@@ -263,7 +264,7 @@ import {
263
264
  writeSrtSettings2,
264
265
  srtStepArgv2,
265
266
  srtArgv2
266
- } from "./chunk-cy5fbrfm.js";
267
+ } from "./chunk-0fdgam8v.js";
267
268
  import {
268
269
  writeAgentEnvironmentConfigFile2,
269
270
  readManifestSkillPaths2,
@@ -279,8 +280,8 @@ import {
279
280
  applyAgentEnvironmentMaterialization2,
280
281
  isPathWithin2,
281
282
  skillIdentity2
282
- } from "./chunk-hwd2gg2f.js";
283
- import"./chunk-a1yf46xt.js";
283
+ } from "./chunk-z0z56a72.js";
284
+ import"./chunk-a4798jzf.js";
284
285
  import {
285
286
  sliceBytes2,
286
287
  maxLineBytes2,
@@ -288,28 +289,28 @@ import {
288
289
  decodedOption2,
289
290
  decoded2,
290
291
  readOpencode2
291
- } from "./chunk-jc920h47.js";
292
+ } from "./chunk-09jf8588.js";
292
293
  import {
293
294
  writeSecretRegistry,
294
295
  secretRefusalLog,
295
296
  parseSecretRefusals
296
- } from "./chunk-g53wn1q8.js";
297
+ } from "./chunk-1w81w56v.js";
297
298
  import {
298
299
  uploadRunFile,
299
300
  programLease,
300
301
  rpcRunFiles,
301
302
  programHostsEnv,
302
303
  undeclaredHostsEnv
303
- } from "./chunk-wd0rvdt4.js";
304
- import"./chunk-23vene3j.js";
304
+ } from "./chunk-phmma642.js";
305
+ import"./chunk-hxkk42cg.js";
305
306
  import {
306
307
  nextInt
307
- } from "./chunk-gwcqz1bj.js";
308
+ } from "./chunk-q3c7vmby.js";
308
309
  import {
309
310
  ChildProcessSpawner,
310
311
  make3
311
- } from "./chunk-5tfxtw9z.js";
312
- import"./chunk-de4cfe40.js";
312
+ } from "./chunk-eawcprsb.js";
313
+ import"./chunk-e3tv8mv2.js";
313
314
 
314
315
  // packages/core/src/sync-kit.ts
315
316
  import { createHash } from "crypto";
@@ -3080,20 +3081,24 @@ var removeRunnerTerminals = (connection, runnerId, teardownDelayMs = 250) => fla
3080
3081
  }));
3081
3082
  var until = (seen, done) => changes(seen).pipe(filter(done), runHead, flatMap3((head) => match(head, { onNone: () => never, onSome: succeed6 })));
3082
3083
  var stirredSince = (turn) => (last) => last.end !== undefined || last.status === "working" || last.status === "blocked" || last.turn > turn;
3083
- var lastingBlock = (seen, graceMs) => gen(function* () {
3084
+ var lastingStatus = (seen, status, graceMs) => gen(function* () {
3084
3085
  while (true) {
3085
- const blocked = yield* until(seen, (last) => last.status === "blocked");
3086
- const left = yield* until(seen, (last) => last.status !== "blocked").pipe(timeoutOption(graceMs));
3086
+ const entered = yield* until(seen, (last) => last.status === status);
3087
+ const left = yield* until(seen, (last) => last.status !== status).pipe(timeoutOption(graceMs));
3087
3088
  if (isNone(left))
3088
- return blocked;
3089
+ return entered;
3089
3090
  }
3090
3091
  });
3091
3092
  var lastingStop = (input) => gen(function* () {
3092
3093
  let reminders = idleReminders;
3093
3094
  let remindedTurn = -1;
3094
3095
  while (true) {
3095
- const stopped = yield* raceFirst(until(input.seen, (last) => last.end !== undefined || last.turn > input.promptTurn && last.status !== "blocked" && last.status !== "working"), lastingBlock(input.seen, input.blockedGraceMs));
3096
- if (stopped.end !== undefined || stopped.status === "blocked" || (yield* input.outputSubmitted))
3096
+ const stopped = yield* raceAllFirst([
3097
+ until(input.seen, (last) => last.end !== undefined || last.turn > input.promptTurn && !["blocked", "working", "error"].includes(last.status ?? "")),
3098
+ lastingStatus(input.seen, "blocked", input.blockedGraceMs),
3099
+ lastingStatus(input.seen, "error", input.idleGraceMs)
3100
+ ]);
3101
+ if (stopped.end !== undefined || stopped.status === "blocked" || stopped.status === "error" || (yield* input.outputSubmitted))
3097
3102
  return stopped;
3098
3103
  const stirred = stirredSince(stopped.turn);
3099
3104
  const waited = yield* until(input.seen, stirred).pipe(timeoutOption(input.idleGraceMs));
@@ -3328,10 +3333,14 @@ var runAttempt = (request, options) => gen(function* () {
3328
3333
  case "finished":
3329
3334
  return failed("output_missing", "The agent finished without submitting its Output.");
3330
3335
  case undefined: {
3331
- if (last.status !== "blocked")
3336
+ if (last.status !== "blocked" && last.status !== "error")
3332
3337
  return failed("output_missing", "The agent finished without submitting its Output.");
3333
3338
  const screen = yield* option2(call((connection) => connection.read(address)));
3334
3339
  const shown = isSome(screen) ? redactCredentials(screen.value).trim() : "";
3340
+ if (last.status === "error") {
3341
+ yield* logWarning("agent_errored", { attempt: attempt.id, address, screen: shown });
3342
+ return failed("harness_error", `The Harness stopped in its error state before it submitted its Output.${shown === "" ? "" : ` Its screen ended: ${shown.slice(-blockedScreenChars)}`}`);
3343
+ }
3335
3344
  yield* logWarning("agent_blocked", { attempt: attempt.id, address, screen: shown });
3336
3345
  if (loginRefused(shown))
3337
3346
  return failed("harness_login_lost", `The Harness's login was refused before it submitted its Output. Its screen ended: ${shown.slice(-blockedScreenChars)}`);
@@ -4141,6 +4150,87 @@ var claudeOutOfQuota = (line) => {
4141
4150
  return { summary: bounded(text || "Usage limit reached"), ...resetTime(resetsAt) };
4142
4151
  };
4143
4152
  var claudeLoginLost = (line) => isJsonObject(line) && line.type === "assistant" && line.isApiErrorMessage === true && line.error === "authentication_failed" ? bounded((isJsonObject(line.message) ? textOf(line.message.content) : "") || "Authentication failed") : undefined;
4153
+ var quotaError = /usage limit|quota|insufficient_quota|resource_exhausted|credit balance|billing|(daily|weekly|monthly) limit/i;
4154
+ var loginError = /\b401\b|unauthori[sz]ed|authentication|invalid.{0,20}(api[ _-]?key|token|credentials)|no api key|(token|credentials?) (has |have )?(expired|been revoked)|(api[ _-]?key|token|credentials?) (is |are )?not valid|log ?in again|re-?authenticate/i;
4155
+ var rateLimitError = /rate.?limit|too many requests|\b429\b/i;
4156
+ var passingLimit = /per minute|retry in \d+(\.\d+)?\s*s/i;
4157
+ var claudeProviderRefusal = (line) => {
4158
+ const spent = claudeOutOfQuota(line);
4159
+ if (spent !== undefined)
4160
+ return { ...spent, kind: "out_of_quota" };
4161
+ if (!isJsonObject(line) || line.type !== "assistant" || line.isApiErrorMessage !== true)
4162
+ return;
4163
+ const said = bounded(isJsonObject(line.message) ? textOf(line.message.content) : "");
4164
+ if (line.error === "rate_limit")
4165
+ return { summary: said || "Rate limit reached", kind: "rate_limited" };
4166
+ return line.error === "billing_error" ? { summary: said || "Billing error", kind: "out_of_quota" } : undefined;
4167
+ };
4168
+ var codexQuotaErrors = new Set([
4169
+ "usage_limit_exceeded",
4170
+ "organization_usage_limit_exceeded",
4171
+ "organization_spend_limit_exceeded"
4172
+ ]);
4173
+ var codexProviderRefusal = (line) => {
4174
+ const event = isJsonObject(line) && line.type === "event_msg" ? line.payload : undefined;
4175
+ const error = !isJsonObject(event) ? undefined : event.type === "task_complete" ? event.error : event.type === "error" ? event : undefined;
4176
+ if (!isJsonObject(error))
4177
+ return;
4178
+ const info = error.codex_error_info;
4179
+ const tag = isString(info) ? info : isJsonObject(info) ? Object.keys(info)[0] : undefined;
4180
+ const detail = isJsonObject(info) && tag !== undefined ? info[tag] : undefined;
4181
+ const status = isJsonObject(detail) ? detail.http_status_code : undefined;
4182
+ const summary = bounded(isString(error.message) ? error.message : tag ?? "");
4183
+ if (codexQuotaErrors.has(tag))
4184
+ return { summary, kind: "out_of_quota" };
4185
+ if (tag === "unauthorized" || status === 401)
4186
+ return { summary, kind: "login_refused" };
4187
+ return tag === "rate_limit_exceeded" || status === 429 ? { summary, kind: "rate_limited" } : undefined;
4188
+ };
4189
+ var opencodeQuotaErrors = /^provider\.(quota|free-limit|go-limit|budget-limit|model-budget-limit|chatgpt-limit)$/;
4190
+ var opencodeProviderRefusal = (error) => {
4191
+ if (!isJsonObject(error))
4192
+ return;
4193
+ if (isString(error.type)) {
4194
+ const summary = bounded(isString(error.message) ? error.message : error.type);
4195
+ if (opencodeQuotaErrors.test(error.type))
4196
+ return { summary, kind: "out_of_quota" };
4197
+ if (error.type === "provider.auth")
4198
+ return { summary, kind: "login_refused" };
4199
+ return error.type === "provider.rate-limit" ? { summary, kind: "rate_limited" } : undefined;
4200
+ }
4201
+ const data = isJsonObject(error.data) ? error.data : {};
4202
+ const said = isString(data.message) ? data.message : isString(error.name) ? error.name : "";
4203
+ const summary = bounded(said);
4204
+ if (error.name === "ProviderAuthError")
4205
+ return { summary, kind: "login_refused" };
4206
+ if (error.name !== "APIError")
4207
+ return;
4208
+ if (quotaError.test(said) || isString(data.responseBody) && quotaError.test(data.responseBody))
4209
+ return { summary, kind: "out_of_quota" };
4210
+ if (data.statusCode === 401)
4211
+ return { summary, kind: "login_refused" };
4212
+ return data.statusCode === 429 ? { summary, kind: "rate_limited" } : undefined;
4213
+ };
4214
+ var piProviderRefusal = (line) => {
4215
+ const message = isJsonObject(line) && line.type === "message" ? line.message : undefined;
4216
+ if (!isJsonObject(message) || message.role !== "assistant" || message.stopReason !== "error")
4217
+ return;
4218
+ const said = isString(message.errorMessage) ? message.errorMessage : "";
4219
+ const summary = bounded(said);
4220
+ if (passingLimit.test(said))
4221
+ return { summary, kind: "rate_limited", retried: true };
4222
+ if (quotaError.test(said))
4223
+ return { summary, kind: "out_of_quota" };
4224
+ if (loginError.test(said))
4225
+ return { summary, kind: "login_refused" };
4226
+ return rateLimitError.test(said) ? { summary, kind: "rate_limited", retried: true } : undefined;
4227
+ };
4228
+ var piReplied = (line) => isJsonObject(line) && line.type === "message" && isJsonObject(line.message) && line.message.role === "assistant";
4229
+ var sessionRefusals = new Map([
4230
+ ["claude", claudeProviderRefusal],
4231
+ ["codex", codexProviderRefusal],
4232
+ ["pi", piProviderRefusal]
4233
+ ]);
4144
4234
  var sessionNormalizer = (harness) => {
4145
4235
  const asks = new Set;
4146
4236
  const called = (fullCallId, name, args) => {
@@ -4323,8 +4413,13 @@ var transcriptRelay = (input) => {
4323
4413
  let progressAt;
4324
4414
  let lastSeen;
4325
4415
  const asking = new Set;
4326
- let outOfQuota;
4327
4416
  let loginLost;
4417
+ let refusal;
4418
+ let errorReadAt;
4419
+ const heard = (said) => {
4420
+ if (refusal === undefined || refusal.retried === true)
4421
+ refusal = said;
4422
+ };
4328
4423
  const backedUp = () => unsentChars >= maxUnsentChars;
4329
4424
  const sawSession = (extent) => gen(function* () {
4330
4425
  if (extent !== lastSeen)
@@ -4407,10 +4502,11 @@ var transcriptRelay = (input) => {
4407
4502
  while (queued.length > 0) {
4408
4503
  yield* suspend3(() => record(queued.splice(0, linesPerTurn2).flatMap((line) => {
4409
4504
  const value = decoded2(line);
4410
- if (input.harness === "claude") {
4411
- outOfQuota = claudeOutOfQuota(value) ?? outOfQuota;
4505
+ if (input.harness === "claude")
4412
4506
  loginLost = claudeLoginLost(value) ?? loginLost;
4413
- }
4507
+ const refused = sessionRefusals.get(input.harness)?.(value);
4508
+ if (refused !== undefined || input.harness === "pi" && piReplied(value))
4509
+ heard(refused);
4414
4510
  return normalize(value).slice(0, maxEventsPerLine);
4415
4511
  }))).pipe(uninterruptible);
4416
4512
  yield* yieldNow;
@@ -4526,15 +4622,19 @@ var transcriptRelay = (input) => {
4526
4622
  record,
4527
4623
  stalledFor: (millis) => map8(currentTimeMillis, (now) => asking.size === 0 && progressAt !== undefined && now - progressAt >= millis),
4528
4624
  asking: sync2(() => asking.size > 0),
4529
- outOfQuota: sync2(() => outOfQuota),
4530
4625
  loginLost: sync2(() => loginLost),
4626
+ refusal: sync2(() => refusal),
4531
4627
  read: (source) => gen(function* () {
4532
4628
  if (source.kind === "opencode_v2") {
4533
- yield* sawSession(yield* readOpencode2(source, "extent", {}));
4629
+ const extent = yield* readOpencode2(source, "extent", {});
4630
+ yield* sawSession(extent);
4534
4631
  while (!backedUp() && (yield* takeMessages(source))) {
4535
4632
  yield* flush;
4536
4633
  yield* yieldNow;
4537
4634
  }
4635
+ if (extent !== errorReadAt)
4636
+ heard(opencodeProviderRefusal(yield* readOpencode2(source, "lastError", { v2: true })));
4637
+ errorReadAt = extent;
4538
4638
  return;
4539
4639
  }
4540
4640
  if (source.kind === "opencode") {
@@ -4545,6 +4645,7 @@ var transcriptRelay = (input) => {
4545
4645
  yield* flush;
4546
4646
  yield* yieldNow;
4547
4647
  }
4648
+ heard(opencodeProviderRefusal(yield* readOpencode2(source, "lastError", { v2: false })));
4548
4649
  return;
4549
4650
  }
4550
4651
  yield* drain;
@@ -5044,19 +5145,21 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
5044
5145
  };
5045
5146
  }
5046
5147
  });
5047
- const outOfQuota = relay === undefined ? never : gen(function* () {
5148
+ const refusalHold = (refusal) => ({
5149
+ reason: refusal.kind,
5150
+ ...refusal.until === undefined ? undefined : { until: refusal.until },
5151
+ ...backend === "docker" ? { scope: "step" } : undefined
5152
+ });
5153
+ const outputSubmitted = input.heartbeat(work).pipe(option2, map8((state) => isSome(state) && state.value.outputSubmitted === true));
5154
+ const providerRefused = relay === undefined ? never : gen(function* () {
5048
5155
  for (;; ) {
5049
5156
  yield* sleep("1 second");
5050
- const spent = yield* relay.outOfQuota;
5051
- if (spent !== undefined)
5052
- return {
5053
- status: "failed",
5054
- summary: spent.summary,
5055
- harnessHold: {
5056
- reason: "out_of_quota",
5057
- ...spent.until === undefined ? undefined : { until: spent.until }
5058
- }
5059
- };
5157
+ const refusal = yield* relay.refusal;
5158
+ if (refusal === undefined || refusal.retried === true)
5159
+ continue;
5160
+ if (yield* outputSubmitted)
5161
+ return { status: "finished" };
5162
+ return { status: "failed", summary: refusal.summary, harnessHold: refusalHold(refusal) };
5060
5163
  }
5061
5164
  });
5062
5165
  const loginLost = relay === undefined ? never : gen(function* () {
@@ -5065,8 +5168,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
5065
5168
  const said = yield* relay.loginLost;
5066
5169
  if (said === undefined)
5067
5170
  continue;
5068
- const state = yield* input.heartbeat(work).pipe(option2);
5069
- if (isSome(state) && state.value.outputSubmitted === true)
5171
+ if (yield* outputSubmitted)
5070
5172
  return { status: "finished" };
5071
5173
  return { status: "failed", summary: said, restart: { reason: "login_revoked" } };
5072
5174
  }
@@ -5090,7 +5192,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
5090
5192
  host: refusal.host.slice(0, 300),
5091
5193
  reason: refusal.reason.slice(0, 500)
5092
5194
  }
5093
- ])).pipe(raceFirst(stalled), raceFirst(parked), raceFirst(outOfQuota), raceFirst(loginLost), onExit((exit) => gen(function* () {
5195
+ ])).pipe(raceFirst(stalled), raceFirst(parked), raceFirst(providerRefused), raceFirst(loginLost), onExit((exit) => gen(function* () {
5094
5196
  if (relay === undefined || relaying === undefined)
5095
5197
  return;
5096
5198
  yield* interrupt(relaying);
@@ -5106,8 +5208,22 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
5106
5208
  yield* interrupt(checkpointing);
5107
5209
  if (ran.status === "parked")
5108
5210
  return { status: "deferred" };
5109
- if (ran.status !== "finished") {
5211
+ const refused = ran.status === "failed" && !("harnessHold" in ran) && relay !== undefined ? yield* relay.refusal : undefined;
5212
+ const deliversOutput = refused !== undefined && (yield* outputSubmitted);
5213
+ if (ran.status !== "finished" && !deliversOutput) {
5110
5214
  yield* uninterruptible(checkpoint).pipe(catch_((error) => logWarning("runner_last_checkpoint_failed", error.message)));
5215
+ if (refused !== undefined)
5216
+ return {
5217
+ status: "failed",
5218
+ failureSummary: refused.summary,
5219
+ harnessHold: refusalHold(refused)
5220
+ };
5221
+ if (backend === "docker" && "restart" in ran && ran.restart !== undefined)
5222
+ return {
5223
+ status: "failed",
5224
+ failureSummary: ran.summary,
5225
+ harnessHold: refusalHold({ summary: ran.summary, kind: "login_refused" })
5226
+ };
5111
5227
  return {
5112
5228
  status: ran.status,
5113
5229
  failureSummary: ran.summary,
@@ -96,9 +96,8 @@ import {
96
96
  Defect,
97
97
  Exit,
98
98
  toCodecJson
99
- } from "./chunk-61k67vxh.js";
99
+ } from "./chunk-d3ksv8y1.js";
100
100
  import {
101
- Clock,
102
101
  interrupt,
103
102
  getCurrent,
104
103
  makeUnsafe2,
@@ -109,8 +108,9 @@ import {
109
108
  shutdownUnsafe,
110
109
  fromQueue,
111
110
  unwrap
112
- } from "./chunk-cy5fbrfm.js";
111
+ } from "./chunk-0fdgam8v.js";
113
112
  import {
113
+ Clock,
114
114
  empty,
115
115
  fromInput,
116
116
  merge,
@@ -123,7 +123,7 @@ import {
123
123
  ParseOptions,
124
124
  RpcClientDefect,
125
125
  RpcClientError
126
- } from "./chunk-qhpyzn7c.js";
126
+ } from "./chunk-sdpjvc1r.js";
127
127
 
128
128
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/workers/Transferable.js
129
129
  class Collector extends (/* @__PURE__ */ Service2()("effect/workers/Transferable/Collector")) {
@@ -22,7 +22,7 @@ import {
22
22
  map8,
23
23
  raceFirst,
24
24
  scoped
25
- } from "./chunk-61k67vxh.js";
25
+ } from "./chunk-d3ksv8y1.js";
26
26
  import {
27
27
  unwrap,
28
28
  drainFork,
@@ -31,7 +31,7 @@ import {
31
31
  runCollect,
32
32
  runDrain,
33
33
  mkString
34
- } from "./chunk-cy5fbrfm.js";
34
+ } from "./chunk-0fdgam8v.js";
35
35
 
36
36
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/redacted.js
37
37
  var redactedRegistry = /* @__PURE__ */ new WeakMap;
@@ -12,30 +12,30 @@ import {
12
12
  orElseSucceed,
13
13
  decodeJsonString,
14
14
  encodePrettyJsonString
15
- } from "./chunk-61k67vxh.js";
16
- import"./chunk-4kssrezn.js";
15
+ } from "./chunk-d3ksv8y1.js";
16
+ import"./chunk-rrnee9mk.js";
17
17
  import {
18
18
  isJsonObject
19
- } from "./chunk-7evwar6b.js";
19
+ } from "./chunk-v01c0k6j.js";
20
20
  import {
21
21
  FileSystem,
22
22
  Path
23
- } from "./chunk-cy5fbrfm.js";
23
+ } from "./chunk-0fdgam8v.js";
24
24
  import {
25
25
  tomlTableHeader2,
26
26
  tomlKeyPath2,
27
27
  kitmanSkillEntry,
28
28
  isPathWithin2
29
- } from "./chunk-hwd2gg2f.js";
29
+ } from "./chunk-z0z56a72.js";
30
30
  import {
31
31
  instructionsStart,
32
32
  instructionsEnd,
33
33
  renderMcpServer,
34
34
  materializeKitSetup,
35
35
  tomlInline
36
- } from "./chunk-qhpyzn7c.js";
37
- import"./chunk-a1yf46xt.js";
38
- import"./chunk-5tfxtw9z.js";
36
+ } from "./chunk-sdpjvc1r.js";
37
+ import"./chunk-a4798jzf.js";
38
+ import"./chunk-eawcprsb.js";
39
39
 
40
40
  // packages/agent-runtime/src/kit-setup-sync.ts
41
41
  class KitSyncError extends TaggedError("KitSyncError") {
@@ -6,10 +6,10 @@ import {
6
6
  gen,
7
7
  flatMap3,
8
8
  provideContext2
9
- } from "./chunk-61k67vxh.js";
9
+ } from "./chunk-d3ksv8y1.js";
10
10
  import {
11
11
  runForEach
12
- } from "./chunk-cy5fbrfm.js";
12
+ } from "./chunk-0fdgam8v.js";
13
13
  import {
14
14
  WebSocketConstructor,
15
15
  layerWebSocketConstructorGlobal,
@@ -19,13 +19,13 @@ import {
19
19
  RunnerReplicaRpcs,
20
20
  RunnerRunFileRpcs,
21
21
  ProgramRpcs
22
- } from "./chunk-qhpyzn7c.js";
22
+ } from "./chunk-sdpjvc1r.js";
23
23
  import {
24
24
  layerJson,
25
25
  make4,
26
26
  withHeaders,
27
27
  layerProtocolSocket
28
- } from "./chunk-de4cfe40.js";
28
+ } from "./chunk-e3tv8mv2.js";
29
29
 
30
30
  // packages/live/src/rpc/runner-client.ts
31
31
  var proxiedWebSocket = (proxy) => succeed5(WebSocketConstructor)((target) => {
@@ -75,11 +75,12 @@ import {
75
75
  toEquivalence,
76
76
  toCodecJson,
77
77
  Json
78
- } from "./chunk-61k67vxh.js";
78
+ } from "./chunk-d3ksv8y1.js";
79
79
  import {
80
80
  guard
81
- } from "./chunk-4kssrezn.js";
81
+ } from "./chunk-rrnee9mk.js";
82
82
  import {
83
+ currentTimeMillis,
83
84
  WebCrypto,
84
85
  SafeJson,
85
86
  AgentSandboxNetwork,
@@ -104,12 +105,11 @@ import {
104
105
  KitDigest,
105
106
  KitSetup,
106
107
  RunnerRpcError
107
- } from "./chunk-qhpyzn7c.js";
108
+ } from "./chunk-sdpjvc1r.js";
108
109
  import {
109
- currentTimeMillis,
110
110
  runForEach,
111
111
  FileSystem
112
- } from "./chunk-cy5fbrfm.js";
112
+ } from "./chunk-0fdgam8v.js";
113
113
 
114
114
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/crypto/internal/webCrypto.js
115
115
  var subtleUnavailable = () => new Error("crypto.subtle is unavailable; browsers expose it only in secure contexts");
@@ -3,7 +3,7 @@ import {
3
3
  Random,
4
4
  succeed6,
5
5
  withFiber2
6
- } from "./chunk-61k67vxh.js";
6
+ } from "./chunk-d3ksv8y1.js";
7
7
 
8
8
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Random.js
9
9
  var Random2 = Random;