@kitman-sh/cli 0.14.8 → 0.15.0

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 (30) hide show
  1. package/dist/{chunk-y0y2gg8d.js → chunk-0ws25xvg.js} +2 -2
  2. package/dist/{chunk-b009hdm0.js → chunk-39ykbhq8.js} +5 -5
  3. package/dist/{chunk-eytzmdna.js → chunk-3n99j4z0.js} +471 -234
  4. package/dist/{chunk-bbf0jzsc.js → chunk-3ns4sbfb.js} +1 -1
  5. package/dist/{chunk-q0x3c0dh.js → chunk-4x7a1qkj.js} +7 -7
  6. package/dist/{chunk-ya4z1n5p.js → chunk-4zc1g45m.js} +7 -7
  7. package/dist/{chunk-6dj39qtt.js → chunk-58hehm8d.js} +1133 -115
  8. package/dist/{chunk-9avbsbvk.js → chunk-5hkdgzh4.js} +1 -1
  9. package/dist/{chunk-xfs1nf75.js → chunk-8393zths.js} +1626 -388
  10. package/dist/{chunk-bpx2zjh7.js → chunk-8wpg3rph.js} +2 -2
  11. package/dist/{chunk-6x43ntsx.js → chunk-b16qxawc.js} +1 -1
  12. package/dist/chunk-cf1hxp43.js +3080 -0
  13. package/dist/chunk-csxxwscf.js +39 -0
  14. package/dist/{chunk-dq21ab8w.js → chunk-djp6t2g6.js} +21 -21
  15. package/dist/{chunk-zpp4jg4a.js → chunk-dx792s4w.js} +1455 -100
  16. package/dist/{chunk-5wrhj4cj.js → chunk-fv2zpgh0.js} +7 -7
  17. package/dist/{chunk-ctpgfdzf.js → chunk-fzaecdgv.js} +3 -3
  18. package/dist/{chunk-79g5zh2p.js → chunk-k2wd9r6t.js} +4 -4
  19. package/dist/chunk-mrkrt2hg.js +4345 -0
  20. package/dist/{chunk-721qyd1a.js → chunk-qkt77rtj.js} +6 -6
  21. package/dist/{chunk-drp4zdwq.js → chunk-rt0qfdtg.js} +15 -7
  22. package/dist/{chunk-cf723a2y.js → chunk-snwjv2sd.js} +678 -40
  23. package/dist/{chunk-bdd62njv.js → chunk-vg78dz3w.js} +259 -57
  24. package/dist/{chunk-wszvkzg8.js → chunk-vq7caqt2.js} +1828 -130
  25. package/dist/{chunk-63m3r0k4.js → chunk-wfz64h9p.js} +4 -4
  26. package/dist/{chunk-hz4t408c.js → chunk-xx711t5r.js} +4 -4
  27. package/dist/index.js +4 -4
  28. package/package.json +2 -1
  29. package/dist/chunk-1rwaetnm.js +0 -526
  30. package/dist/chunk-hrtr5wfq.js +0 -1166
@@ -38,7 +38,7 @@ import {
38
38
  assignProperty,
39
39
  PipeInspectableProto,
40
40
  withFiber,
41
- make13,
41
+ make14,
42
42
  strictEqual,
43
43
  Tuple,
44
44
  Number2,
@@ -58,15 +58,13 @@ import {
58
58
  Service2,
59
59
  makeUnsafe4,
60
60
  empty3,
61
- make14,
61
+ make15,
62
62
  add,
63
63
  getOrUndefined2,
64
64
  getOrUndefinedUnsafe,
65
- get3,
65
+ get4,
66
66
  merge3,
67
67
  Reference,
68
- fromInputUnsafe,
69
- isFinite,
70
68
  millis,
71
69
  seconds,
72
70
  toMillis,
@@ -86,14 +84,14 @@ import {
86
84
  DisablePropagation,
87
85
  sync,
88
86
  map7,
87
+ ClockRef,
88
+ currentTimeMillis2,
89
89
  ConsoleRef,
90
90
  succeed3,
91
91
  fail4,
92
- void_2,
93
92
  isSuccess2,
94
- isFailure2,
95
93
  makeUnsafe5,
96
- make15,
94
+ make16,
97
95
  _await,
98
96
  fail5,
99
97
  isDone,
@@ -101,12 +99,8 @@ import {
101
99
  succeed4,
102
100
  doneUnsafe,
103
101
  TracerTimingEnabled,
104
- Scope,
105
- makeUnsafe6,
106
102
  provide,
107
- addFinalizerExit,
108
103
  addFinalizer,
109
- close,
110
104
  succeed5,
111
105
  effect,
112
106
  effectContext,
@@ -146,7 +140,7 @@ import {
146
140
  flatMap3,
147
141
  andThen2,
148
142
  tap2,
149
- map8,
143
+ map9,
150
144
  as,
151
145
  asVoid,
152
146
  catch_,
@@ -158,7 +152,6 @@ import {
158
152
  tapCause,
159
153
  retry,
160
154
  ignore,
161
- ignoreCause,
162
155
  orElseSucceed,
163
156
  timeout,
164
157
  timeoutOrElse,
@@ -170,7 +163,6 @@ import {
170
163
  context,
171
164
  contextWith,
172
165
  provide3,
173
- provideContext2,
174
166
  serviceOption,
175
167
  updateContext,
176
168
  provideService,
@@ -181,7 +173,6 @@ import {
181
173
  addFinalizer2,
182
174
  ensuring2,
183
175
  onError,
184
- onExit,
185
176
  cached,
186
177
  interrupt3,
187
178
  interruptible,
@@ -193,7 +184,6 @@ import {
193
184
  withParentSpan,
194
185
  forkScoped,
195
186
  runFork,
196
- runForkWith,
197
187
  runPromise,
198
188
  runPromiseWith,
199
189
  runSync,
@@ -206,14 +196,14 @@ import {
206
196
  decode,
207
197
  defaultParseOptions,
208
198
  omit,
209
- map9,
199
+ map10,
210
200
  declare,
211
201
  is,
212
202
  decodeUnknownEffect2,
213
203
  decodeEffect,
214
204
  decodeUnknownOption,
215
205
  decodeOption,
216
- make16,
206
+ make17,
217
207
  isSchema,
218
208
  optionalKey,
219
209
  optional,
@@ -254,6 +244,7 @@ import {
254
244
  Class2,
255
245
  Error3,
256
246
  TaggedError2,
247
+ toEquivalence,
257
248
  toCodecJson,
258
249
  Json,
259
250
  JsonObject,
@@ -273,17 +264,11 @@ import {
273
264
  decodeJsonStringOption,
274
265
  encodeJsonStringSync,
275
266
  encodePrettyJsonString
276
- } from "./chunk-zpp4jg4a.js";
267
+ } from "./chunk-dx792s4w.js";
277
268
  import {
278
269
  map,
279
270
  makeEquivalence,
280
- Clock,
281
- currentTimeMillis,
282
271
  bytes,
283
- join,
284
- interrupt,
285
- getCurrent,
286
- runIn,
287
272
  BadArgument,
288
273
  systemError,
289
274
  badArgument,
@@ -305,11 +290,13 @@ import {
305
290
  isSink,
306
291
  fromChannel,
307
292
  drain,
293
+ make10,
294
+ get3,
308
295
  isStream,
309
296
  fromChannel2,
310
297
  callback,
311
298
  empty2,
312
- make10,
299
+ make11,
313
300
  suspend,
314
301
  fail2,
315
302
  fromQueue,
@@ -335,17 +322,30 @@ import {
335
322
  mkArrayBuffer,
336
323
  toReadableStreamEffect,
337
324
  FileSystem,
338
- make11,
325
+ make12,
339
326
  FileTypeId,
340
327
  WatchBackend,
341
328
  Path,
342
- make12,
329
+ make13,
343
330
  option,
344
331
  String2,
345
332
  optionalEnv,
346
333
  harnessesUnsupportedInSrt2,
347
334
  harnessesUnsupportedInDocker2
348
- } from "./chunk-bdd62njv.js";
335
+ } from "./chunk-vg78dz3w.js";
336
+ import {
337
+ isDateTime,
338
+ Numeric,
339
+ isWholeNumber,
340
+ guard,
341
+ Id,
342
+ Timestamp,
343
+ ActorType,
344
+ SecretName,
345
+ SecretScope,
346
+ SecretHosts,
347
+ isSecretReference
348
+ } from "./chunk-5hkdgzh4.js";
349
349
  import {
350
350
  isRedacted,
351
351
  make,
@@ -359,24 +359,15 @@ import {
359
359
  make3,
360
360
  parseFdName,
361
361
  fdName
362
- } from "./chunk-79g5zh2p.js";
363
- import {
364
- isDateTime,
365
- Numeric,
366
- isWholeNumber,
367
- guard,
368
- Id,
369
- Timestamp,
370
- ActorType,
371
- SecretName,
372
- SecretScope,
373
- SecretHosts,
374
- isSecretReference
375
- } from "./chunk-9avbsbvk.js";
362
+ } from "./chunk-k2wd9r6t.js";
376
363
 
377
364
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Tuple.js
378
365
  var makeEquivalence3 = Tuple;
379
366
 
367
+ // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Clock.js
368
+ var Clock = ClockRef;
369
+ var currentTimeMillis = currentTimeMillis2;
370
+
380
371
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/dateTime.js
381
372
  var TypeId = "~effect/DateTime";
382
373
  var TimeZoneTypeId = "~effect/DateTime/TimeZone";
@@ -511,7 +502,7 @@ var fromDateUnsafe = (date) => {
511
502
  }
512
503
  return makeUtc(epochMillis);
513
504
  };
514
- var makeUnsafe7 = (input) => {
505
+ var makeUnsafe6 = (input) => {
515
506
  if (isDateTime2(input)) {
516
507
  return input;
517
508
  } else if (input instanceof Date) {
@@ -531,7 +522,7 @@ var makeUnsafe7 = (input) => {
531
522
  var hasZone = (input) => /Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(input) || /z$|gmt$/i.test(input);
532
523
  var minEpochMillis = -8640000000000000 + 12 * 60 * 60 * 1000;
533
524
  var maxEpochMillis = 8640000000000000 - 14 * 60 * 60 * 1000;
534
- var make4 = /* @__PURE__ */ liftThrowable(makeUnsafe7);
525
+ var make4 = /* @__PURE__ */ liftThrowable(makeUnsafe6);
535
526
  var now = /* @__PURE__ */ map7(currentTimeMillis, makeUtc);
536
527
  var nowUnsafe = () => makeUtc(Date.now());
537
528
  var toDateUtc = (self) => new Date(self.epochMilliseconds);
@@ -638,7 +629,7 @@ class Metric$ {
638
629
  }
639
630
  hook(context) {
640
631
  const key = this.key(context);
641
- const registry = get3(context, MetricRegistry);
632
+ const registry = get4(context, MetricRegistry);
642
633
  let metadata = registry.get(key);
643
634
  if (isUndefined(metadata)) {
644
635
  metadata = this.metadata(this.createHooks());
@@ -647,11 +638,11 @@ class Metric$ {
647
638
  return metadata.hooks;
648
639
  }
649
640
  removeUnsafe(context) {
650
- get3(context, MetricRegistry).delete(this.key(context));
641
+ get4(context, MetricRegistry).delete(this.key(context));
651
642
  }
652
643
  registerUnsafe(context, hooks) {
653
644
  const key = this.key(context);
654
- const registry = get3(context, MetricRegistry);
645
+ const registry = get4(context, MetricRegistry);
655
646
  const metadata = this.metadata({
656
647
  get: hooks.get,
657
648
  update: constVoid,
@@ -667,7 +658,7 @@ class Metric$ {
667
658
  };
668
659
  }
669
660
  key(context) {
670
- const extraAttributes = get3(context, CurrentMetricAttributes);
661
+ const extraAttributes = get4(context, CurrentMetricAttributes);
671
662
  if (extraAttributes !== this.#extraAttributes) {
672
663
  this.#extraAttributes = extraAttributes;
673
664
  const merged = mergeAttributes(this.attributes, extraAttributes);
@@ -919,151 +910,9 @@ var toNumber = (b) => {
919
910
  return some(Number(b));
920
911
  };
921
912
 
922
- // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/rcRef.js
923
- var TypeId3 = "~effect/RcRef";
924
- var stateEmpty = {
925
- _tag: "Empty"
926
- };
927
- var stateClosed = {
928
- _tag: "Closed"
929
- };
930
- var variance = {
931
- _A: identity,
932
- _E: identity
933
- };
934
-
935
- class RcRefImpl {
936
- [TypeId3] = variance;
937
- pipe() {
938
- return pipeArguments(this, arguments);
939
- }
940
- state = stateEmpty;
941
- acquire;
942
- context;
943
- scope;
944
- idleTimeToLive;
945
- constructor(acquire, context, scope, idleTimeToLive) {
946
- this.acquire = acquire;
947
- this.context = context;
948
- this.scope = scope;
949
- this.idleTimeToLive = idleTimeToLive;
950
- }
951
- }
952
- var make17 = (options) => withFiber2((fiber) => {
953
- const context = fiber.context;
954
- const scope = get3(context, Scope);
955
- const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive !== undefined ? fromInputUnsafe(options.idleTimeToLive) : undefined);
956
- return as(addFinalizerExit(scope, () => {
957
- const state = ref.state;
958
- ref.state = stateClosed;
959
- if (state._tag === "Acquired")
960
- return close(state.scope, void_2);
961
- if (state._tag === "Acquiring")
962
- return interrupt(state.fiber);
963
- return void_3;
964
- }), ref);
965
- });
966
- var getState = (self, restore) => {
967
- switch (self.state._tag) {
968
- case "Closed": {
969
- return interrupt3;
970
- }
971
- case "Acquired": {
972
- const state = self.state;
973
- state.refCount++;
974
- return state.fiber ? as(interrupt(state.fiber), state) : succeed6(state);
975
- }
976
- case "Acquiring": {
977
- const state = self.state;
978
- state.awaiters++;
979
- return awaitAcquiring(self, state, restore);
980
- }
981
- case "Empty": {
982
- const acquiring = {
983
- _tag: "Acquiring",
984
- fiber: undefined,
985
- awaiters: 1,
986
- acquired: undefined
987
- };
988
- self.state = acquiring;
989
- const scope = makeUnsafe6();
990
- const acquire = provideContext2(self.acquire, add(self.context, Scope, scope)).pipe(flatMap3((value) => {
991
- if (self.state !== acquiring) {
992
- return interrupt3;
993
- }
994
- const state = {
995
- _tag: "Acquired",
996
- value,
997
- scope,
998
- fiber: undefined,
999
- refCount: acquiring.awaiters,
1000
- invalidated: false
1001
- };
1002
- self.state = state;
1003
- acquiring.acquired = state;
1004
- return succeed6(state);
1005
- }), onExit((exit) => {
1006
- if (isSuccess2(exit))
1007
- return void_3;
1008
- if (self.state === acquiring)
1009
- self.state = stateEmpty;
1010
- return close(scope, exit);
1011
- }));
1012
- acquiring.fiber = runForkWith(getCurrent().context)(acquire);
1013
- return awaitAcquiring(self, acquiring, restore);
1014
- }
1015
- }
1016
- };
1017
- var awaitAcquiring = (self, acquiring, restore) => onExit(restore(join(acquiring.fiber)), (exit) => {
1018
- const acquired = acquiring.acquired;
1019
- if (acquired !== undefined) {
1020
- return isFailure2(exit) ? release(self, acquired) : void_3;
1021
- }
1022
- if (--acquiring.awaiters > 0 || self.state !== acquiring)
1023
- return void_3;
1024
- self.state = stateEmpty;
1025
- return interrupt(acquiring.fiber);
1026
- });
1027
- var get4 = (self_) => {
1028
- const self = self_;
1029
- return uninterruptibleMask2((restore) => flatMap3(scope2, (scope) => flatMap3(getState(self, restore), (state) => as(addFinalizerExit(scope, () => release(self, state)), state.value))));
1030
- };
1031
- var release = (self, state) => {
1032
- state.refCount--;
1033
- if (state.refCount > 0) {
1034
- return void_3;
1035
- }
1036
- const idleTimeToLive = self.idleTimeToLive;
1037
- if (idleTimeToLive === undefined || state.invalidated) {
1038
- if (self.state === state) {
1039
- self.state = stateEmpty;
1040
- }
1041
- return close(state.scope, void_2);
1042
- } else if (!isFinite(idleTimeToLive)) {
1043
- return void_3;
1044
- }
1045
- state.fiber = uninterruptibleMask2((restore) => flatMap3(restore(sleep(idleTimeToLive)), () => {
1046
- if (self.state === state && state.refCount === 0) {
1047
- self.state = stateEmpty;
1048
- return ignoreCause(close(state.scope, void_2), {
1049
- log: "Unhandled",
1050
- message: "Unhandled error in RcRef finalizer"
1051
- });
1052
- }
1053
- return void_3;
1054
- })).pipe(ensuring2(sync2(() => {
1055
- state.fiber = undefined;
1056
- })), runForkWith(self.context), runIn(self.scope));
1057
- return void_3;
1058
- };
1059
-
1060
- // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/RcRef.js
1061
- var make18 = make17;
1062
- var get5 = get4;
1063
-
1064
913
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/DateTime.js
1065
- var makeUnsafe = makeUnsafe7;
1066
- var make19 = make4;
914
+ var makeUnsafe = makeUnsafe6;
915
+ var make18 = make4;
1067
916
  var now2 = now;
1068
917
  var nowUnsafe2 = nowUnsafe;
1069
918
  var toDateUtc2 = toDateUtc;
@@ -1382,7 +1231,7 @@ var taskkill = (childProcess, onExit = () => {}) => {
1382
1231
  windowsHide: true
1383
1232
  }, onExit);
1384
1233
  };
1385
- var make20 = /* @__PURE__ */ gen(function* () {
1234
+ var make19 = /* @__PURE__ */ gen(function* () {
1386
1235
  const fs = yield* FileSystem;
1387
1236
  const path = yield* Path;
1388
1237
  const resolveWorkingDirectory = fnUntraced(function* (options) {
@@ -1509,7 +1358,7 @@ var make20 = /* @__PURE__ */ gen(function* () {
1509
1358
  });
1510
1359
  }
1511
1360
  if (stream) {
1512
- return map8(runInputStream(stream, sink, inputFailure), () => {
1361
+ return map9(runInputStream(stream, sink, inputFailure), () => {
1513
1362
  inputSinks.set(fd, sink);
1514
1363
  });
1515
1364
  }
@@ -1802,7 +1651,7 @@ var make20 = /* @__PURE__ */ gen(function* () {
1802
1651
  getInputFd,
1803
1652
  getOutputFd
1804
1653
  } = yield* setupAdditionalFds(cmd, childProcess, resolvedAdditionalFds, inputFailure);
1805
- const isRunning = map8(isDone(exitSignal), (done) => !done);
1654
+ const isRunning = map9(isDone(exitSignal), (done) => !done);
1806
1655
  const exitCode = flatMap3(raceFirst(_await(exitSignal), _await(inputFailure)), ([code, signal]) => {
1807
1656
  if (isDoneUnsafe(inputFailure)) {
1808
1657
  return _await(inputFailure);
@@ -1911,7 +1760,7 @@ var make20 = /* @__PURE__ */ gen(function* () {
1911
1760
  });
1912
1761
  return make2(spawnCommand);
1913
1762
  });
1914
- var layer5 = /* @__PURE__ */ effect(ChildProcessSpawner, make20);
1763
+ var layer5 = /* @__PURE__ */ effect(ChildProcessSpawner, make19);
1915
1764
  var flattenCommand = (command) => {
1916
1765
  const commands = [];
1917
1766
  const pipeOptions = [];
@@ -2083,7 +1932,7 @@ var noFollowFlags = (method, flag) => suspend3(() => {
2083
1932
  var openFactory = (method) => {
2084
1933
  const nodeOpen = effectify(NFS.open, handleErrnoException("FileSystem", method), handleBadArgument(method));
2085
1934
  const nodeClose = effectify(NFS.close, handleErrnoException("FileSystem", method), handleBadArgument(method));
2086
- return (path, options) => pipe(acquireRelease(options?.noFollow === true ? flatMap3(noFollowFlags(method, options.flag ?? "r"), (flags) => nodeOpen(path, flags, options.mode)) : nodeOpen(path, options?.flag ?? "r", options?.mode), (fd) => orDie(nodeClose(fd))), map8((fd) => makeFile(fd, options?.flag?.startsWith("a") ?? false)));
1935
+ return (path, options) => pipe(acquireRelease(options?.noFollow === true ? flatMap3(noFollowFlags(method, options.flag ?? "r"), (flags) => nodeOpen(path, flags, options.mode)) : nodeOpen(path, options?.flag ?? "r", options?.mode), (fd) => orDie(nodeClose(fd))), map9((fd) => makeFile(fd, options?.flag?.startsWith("a") ?? false)));
2087
1936
  };
2088
1937
  var open2 = /* @__PURE__ */ openFactory("open");
2089
1938
  var negativePosition = (method) => badArgument({
@@ -2144,7 +1993,7 @@ var makeFile = /* @__PURE__ */ (() => {
2144
1993
  });
2145
1994
  }
2146
1995
  const position = this.position;
2147
- return map8(nodeRead(this.fd, {
1996
+ return map9(nodeRead(this.fd, {
2148
1997
  buffer,
2149
1998
  position
2150
1999
  }), (bytesRead) => {
@@ -2165,7 +2014,7 @@ var makeFile = /* @__PURE__ */ (() => {
2165
2014
  }
2166
2015
  const buffer = Buffer.allocUnsafeSlow(size);
2167
2016
  const position = explicit ?? this.position;
2168
- return map8(nodeReadAlloc(this.fd, {
2017
+ return map9(nodeReadAlloc(this.fd, {
2169
2018
  buffer,
2170
2019
  position
2171
2020
  }), (bytesRead) => {
@@ -2188,7 +2037,7 @@ var makeFile = /* @__PURE__ */ (() => {
2188
2037
  });
2189
2038
  }
2190
2039
  truncate(length) {
2191
- return map8(nodeTruncate(this.fd, length || undefined), () => {
2040
+ return map9(nodeTruncate(this.fd, length || undefined), () => {
2192
2041
  if (!this.append) {
2193
2042
  const len = BigInt(length ?? 0);
2194
2043
  if (this.position > len) {
@@ -2200,7 +2049,7 @@ var makeFile = /* @__PURE__ */ (() => {
2200
2049
  write(buffer) {
2201
2050
  return suspend3(() => {
2202
2051
  const position = this.position;
2203
- return flatMap3(this.append ? succeed6(undefined) : positionToNumber(position, "write"), (nodePosition) => map8(nodeWrite(this.fd, buffer, undefined, undefined, nodePosition), (bytesWritten) => {
2052
+ return flatMap3(this.append ? succeed6(undefined) : positionToNumber(position, "write"), (nodePosition) => map9(nodeWrite(this.fd, buffer, undefined, undefined, nodePosition), (bytesWritten) => {
2204
2053
  if (!this.append) {
2205
2054
  this.position = position + BigInt(bytesWritten);
2206
2055
  }
@@ -2262,7 +2111,7 @@ var readDirectoryEntries = (path) => tryPromise({
2262
2111
  withFileTypes: true
2263
2112
  }),
2264
2113
  catch: (err) => handleErrnoException("FileSystem", "readDirectoryEntries")(err, [path])
2265
- }).pipe(map8((entries) => entries.map((entry) => ({
2114
+ }).pipe(map9((entries) => entries.map((entry) => ({
2266
2115
  name: entry.name,
2267
2116
  type: fileType(entry)
2268
2117
  }))));
@@ -2377,7 +2226,7 @@ var watchNode = (path, info, options) => callback((queue) => acquireRelease(sync
2377
2226
  });
2378
2227
  return watcher;
2379
2228
  }), (watcher) => sync2(() => watcher.close())).pipe(tap2(() => sync2(() => options?.onReady?.()))));
2380
- var watch2 = (backend, path, options) => all3([stat2(path), serviceOption(WatchBackend)]).pipe(map8(([stat, callerBackend]) => orElse(callerBackend, () => backend).pipe(flatMap((_) => _.register(path, stat, options)), getOrElse(() => watchNode(path, stat, options)))), unwrap);
2229
+ var watch2 = (backend, path, options) => all3([stat2(path), serviceOption(WatchBackend)]).pipe(map9(([stat, callerBackend]) => orElse(callerBackend, () => backend).pipe(flatMap((_) => _.register(path, stat, options)), getOrElse(() => watchNode(path, stat, options)))), unwrap);
2381
2230
  var writeFile2 = (path, data, options) => callback3((resume, signal) => {
2382
2231
  try {
2383
2232
  NFS.writeFile(path, data, {
@@ -2395,7 +2244,7 @@ var writeFile2 = (path, data, options) => callback3((resume, signal) => {
2395
2244
  resume(fail7(handleBadArgument("writeFile")(err)));
2396
2245
  }
2397
2246
  });
2398
- var makeFileSystem = /* @__PURE__ */ map8(/* @__PURE__ */ serviceOption(WatchBackend), (backend) => make11({
2247
+ var makeFileSystem = /* @__PURE__ */ map9(/* @__PURE__ */ serviceOption(WatchBackend), (backend) => make12({
2399
2248
  access: access2,
2400
2249
  chmod: chmod2,
2401
2250
  chown: chown2,
@@ -2455,15 +2304,15 @@ var fileUrlOps = (windows) => ({
2455
2304
  })
2456
2305
  })
2457
2306
  });
2458
- var layerPosix = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make12({
2307
+ var layerPosix = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make13({
2459
2308
  ...NodePath.posix,
2460
2309
  .../* @__PURE__ */ fileUrlOps(false)
2461
2310
  }));
2462
- var layerWin32 = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make12({
2311
+ var layerWin32 = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make13({
2463
2312
  ...NodePath.win32,
2464
2313
  .../* @__PURE__ */ fileUrlOps(true)
2465
2314
  }));
2466
- var layer7 = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make12({
2315
+ var layer7 = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make13({
2467
2316
  ...NodePath,
2468
2317
  .../* @__PURE__ */ fileUrlOps(undefined)
2469
2318
  }));
@@ -2472,10 +2321,10 @@ var layer7 = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make12({
2472
2321
  var layer2 = layer7;
2473
2322
 
2474
2323
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Stdio.js
2475
- var TypeId4 = "~effect/Stdio";
2476
- var Stdio = /* @__PURE__ */ Service2(TypeId4);
2477
- var make21 = (options) => ({
2478
- [TypeId4]: TypeId4,
2324
+ var TypeId3 = "~effect/Stdio";
2325
+ var Stdio = /* @__PURE__ */ Service2(TypeId3);
2326
+ var make20 = (options) => ({
2327
+ [TypeId3]: TypeId3,
2479
2328
  stdinIsTerminal: succeed6(false),
2480
2329
  stdoutIsTerminal: succeed6(false),
2481
2330
  stderrIsTerminal: succeed6(false),
@@ -2483,7 +2332,7 @@ var make21 = (options) => ({
2483
2332
  });
2484
2333
 
2485
2334
  // node_modules/.bun/@effect+platform-node-shared@4.1.2+edf248c88a527e3e/node_modules/@effect/platform-node-shared/dist/NodeStdio.js
2486
- var layer8 = /* @__PURE__ */ succeed5(Stdio, /* @__PURE__ */ make21({
2335
+ var layer8 = /* @__PURE__ */ succeed5(Stdio, /* @__PURE__ */ make20({
2487
2336
  args: /* @__PURE__ */ sync2(() => process.argv.slice(2)),
2488
2337
  stdinIsTerminal: /* @__PURE__ */ sync2(() => process.stdin.isTTY === true),
2489
2338
  stdoutIsTerminal: /* @__PURE__ */ sync2(() => process.stdout.isTTY === true),
@@ -2683,7 +2532,7 @@ var makeUuid = (bytes, randomBytes, format) => {
2683
2532
  const uuid = bytes(randomBytes(16));
2684
2533
  return format === "bytes" ? uuid : stringify(uuid);
2685
2534
  };
2686
- var make22 = (randomBytes) => {
2535
+ var make21 = (randomBytes) => {
2687
2536
  const randomBytesChecked = (size) => {
2688
2537
  checkSize(size);
2689
2538
  return randomBytes(size);
@@ -2717,7 +2566,7 @@ var fillRandom = (crypto2, size) => {
2717
2566
  }
2718
2567
  return bytes;
2719
2568
  };
2720
- var layerWebCrypto = /* @__PURE__ */ effect(SecureRandom, /* @__PURE__ */ WebCrypto.use((crypto2) => succeed6(make22((size) => fillRandom(crypto2, size)))));
2569
+ var layerWebCrypto = /* @__PURE__ */ effect(SecureRandom, /* @__PURE__ */ WebCrypto.use((crypto2) => succeed6(make21((size) => fillRandom(crypto2, size)))));
2721
2570
  var randomBytesUnsafe = (size) => {
2722
2571
  checkSize(size);
2723
2572
  return fillRandom(globalThis.crypto, size);
@@ -2725,10 +2574,10 @@ var randomBytesUnsafe = (size) => {
2725
2574
  var uuidV4Unsafe = (options) => makeUuid(v4Bytes, randomBytesUnsafe, options?.format);
2726
2575
 
2727
2576
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/http/Cookies.js
2728
- var TypeId5 = "~effect/http/Cookies";
2577
+ var TypeId4 = "~effect/http/Cookies";
2729
2578
  var CookieTypeId = "~effect/http/Cookies/Cookie";
2730
2579
  var Proto2 = {
2731
- [TypeId5]: TypeId5,
2580
+ [TypeId4]: TypeId4,
2732
2581
  ...BaseProto,
2733
2582
  toJSON() {
2734
2583
  return {
@@ -2907,14 +2756,14 @@ var tryDecodeURIComponent = (str) => {
2907
2756
  };
2908
2757
 
2909
2758
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/http/Headers.js
2910
- var TypeId6 = /* @__PURE__ */ Symbol.for("~effect/http/Headers");
2759
+ var TypeId5 = /* @__PURE__ */ Symbol.for("~effect/http/Headers");
2911
2760
  var Proto3 = /* @__PURE__ */ Object.defineProperties(/* @__PURE__ */ Object.create(null), {
2912
- [TypeId6]: {
2913
- value: TypeId6
2761
+ [TypeId5]: {
2762
+ value: TypeId5
2914
2763
  },
2915
2764
  [symbolRedactable]: {
2916
2765
  value(context) {
2917
- return redact2(this, get3(context, CurrentRedactedNames));
2766
+ return redact2(this, get4(context, CurrentRedactedNames));
2918
2767
  }
2919
2768
  },
2920
2769
  toJSON: {
@@ -2939,7 +2788,7 @@ var Proto3 = /* @__PURE__ */ Object.defineProperties(/* @__PURE__ */ Object.crea
2939
2788
  value: BaseProto[NodeInspectSymbol]
2940
2789
  }
2941
2790
  });
2942
- var make23 = (input) => Object.assign(Object.create(Proto3), input);
2791
+ var make22 = (input) => Object.assign(Object.create(Proto3), input);
2943
2792
  var Equivalence2 = /* @__PURE__ */ makeEquivalence(/* @__PURE__ */ strictEqual());
2944
2793
  var empty = /* @__PURE__ */ Object.create(Proto3);
2945
2794
  var fromInput = (input) => {
@@ -2964,21 +2813,21 @@ var fromInput = (input) => {
2964
2813
  };
2965
2814
  var fromRecordUnsafe = (input) => Object.setPrototypeOf(input, Proto3);
2966
2815
  var set = /* @__PURE__ */ dual(3, (self, key, value) => {
2967
- const out = make23(self);
2816
+ const out = make22(self);
2968
2817
  out[key.toLowerCase()] = value;
2969
2818
  return out;
2970
2819
  });
2971
- var setAll = /* @__PURE__ */ dual(2, (self, headers) => make23({
2820
+ var setAll = /* @__PURE__ */ dual(2, (self, headers) => make22({
2972
2821
  ...self,
2973
2822
  ...fromInput(headers)
2974
2823
  }));
2975
2824
  var merge = /* @__PURE__ */ dual(2, (self, headers) => {
2976
- const out = make23(self);
2825
+ const out = make22(self);
2977
2826
  Object.assign(out, headers);
2978
2827
  return out;
2979
2828
  });
2980
2829
  var remove2 = /* @__PURE__ */ dual(2, (self, key) => {
2981
- const out = make23(self);
2830
+ const out = make22(self);
2982
2831
  delete out[key.toLowerCase()];
2983
2832
  return out;
2984
2833
  });
@@ -3035,18 +2884,18 @@ var bodyDecoder = /* @__PURE__ */ new TextDecoder("utf-8", {
3035
2884
  var fromBody = (bytes) => new URLSearchParams(bodyDecoder.decode(bytes).replace(/^\?/, "%3F"));
3036
2885
 
3037
2886
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/http/UrlParams.js
3038
- var TypeId7 = "~effect/http/UrlParams";
3039
- var isUrlParams = (u) => hasProperty(u, TypeId7);
2887
+ var TypeId6 = "~effect/http/UrlParams";
2888
+ var isUrlParams = (u) => hasProperty(u, TypeId6);
3040
2889
  var Proto4 = {
3041
2890
  ...PipeInspectableProto,
3042
- [TypeId7]: TypeId7,
2891
+ [TypeId6]: TypeId6,
3043
2892
  [Symbol.iterator]() {
3044
2893
  return this.params[Symbol.iterator]();
3045
2894
  },
3046
2895
  [symbolRedactable](context) {
3047
2896
  return {
3048
2897
  _id: "UrlParams",
3049
- params: Object.fromEntries(redact3(this, get3(context, CurrentRedactedNames2)))
2898
+ params: Object.fromEntries(redact3(this, get4(context, CurrentRedactedNames2)))
3050
2899
  };
3051
2900
  },
3052
2901
  toJSON() {
@@ -3059,7 +2908,7 @@ var Proto4 = {
3059
2908
  return array(this.params.flat());
3060
2909
  }
3061
2910
  };
3062
- var make24 = (params) => {
2911
+ var make23 = (params) => {
3063
2912
  const self = Object.create(Proto4);
3064
2913
  self.params = params;
3065
2914
  return self;
@@ -3078,7 +2927,7 @@ var fromInput2 = (input) => {
3078
2927
  out.push(parsed[i]);
3079
2928
  }
3080
2929
  }
3081
- return make24(out);
2930
+ return make23(out);
3082
2931
  };
3083
2932
  var fromInputNested = (input) => {
3084
2933
  const entries = typeof input[Symbol.iterator] === "function" ? fromIterable(input) : Object.entries(input);
@@ -3102,9 +2951,9 @@ var fromInputNested = (input) => {
3102
2951
  return out;
3103
2952
  };
3104
2953
  var coerce = (value) => isRedacted(value) ? value : String(value);
3105
- var Equivalence3 = /* @__PURE__ */ make13((a, b) => arrayEquivalence(a.params, b.params));
2954
+ var Equivalence3 = /* @__PURE__ */ make14((a, b) => arrayEquivalence(a.params, b.params));
3106
2955
  var arrayEquivalence = /* @__PURE__ */ makeEquivalence2(/* @__PURE__ */ makeEquivalence3([/* @__PURE__ */ strictEqual(), /* @__PURE__ */ asEquivalence()]));
3107
- var empty4 = /* @__PURE__ */ make24([]);
2956
+ var empty4 = /* @__PURE__ */ make23([]);
3108
2957
  var setAll2 = /* @__PURE__ */ dual(2, (self, input) => {
3109
2958
  const params = fromInput2(input).params.slice();
3110
2959
  const keys = new Set;
@@ -3116,7 +2965,7 @@ var setAll2 = /* @__PURE__ */ dual(2, (self, input) => {
3116
2965
  continue;
3117
2966
  params.push(self.params[i]);
3118
2967
  }
3119
- return make24(params);
2968
+ return make23(params);
3120
2969
  });
3121
2970
  var toString = (input) => new URLSearchParams(fromInput2(input).params.map(([key, value]) => [key, unwrap3(value)])).toString();
3122
2971
  var redact3 = /* @__PURE__ */ dual(2, (self, key) => {
@@ -3172,13 +3021,13 @@ var decodeQueryKey = (key) => {
3172
3021
  return key;
3173
3022
  }
3174
3023
  };
3175
- var currentRedactedNames = () => get3(globalThis[currentFiberTypeId]?.context ?? empty3(), CurrentRedactedNames2);
3024
+ var currentRedactedNames = () => get4(globalThis[currentFiberTypeId]?.context ?? empty3(), CurrentRedactedNames2);
3176
3025
  var CurrentRedactedNames2 = /* @__PURE__ */ Reference("effect/http/UrlParams/CurrentRedactedNames", {
3177
3026
  defaultValue: () => ["X-Amz-Signature", "X-Amz-Credential", "X-Amz-Security-Token", "AWSAccessKeyId", "Signature", "sig", "X-Goog-Signature"]
3178
3027
  });
3179
3028
 
3180
3029
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Terminal.js
3181
- var TypeId8 = "~effect/Terminal";
3030
+ var TypeId7 = "~effect/Terminal";
3182
3031
  var QuitErrorTypeId = "~effect/Terminal/QuitError";
3183
3032
 
3184
3033
  class QuitError extends (/* @__PURE__ */ Error3("QuitError")({
@@ -3187,14 +3036,14 @@ class QuitError extends (/* @__PURE__ */ Error3("QuitError")({
3187
3036
  [QuitErrorTypeId] = QuitErrorTypeId;
3188
3037
  }
3189
3038
  var Terminal = /* @__PURE__ */ Service2("effect/Terminal");
3190
- var make25 = (impl) => Terminal.of({
3039
+ var make24 = (impl) => Terminal.of({
3191
3040
  ...impl,
3192
- [TypeId8]: TypeId8
3041
+ [TypeId7]: TypeId7
3193
3042
  });
3194
3043
 
3195
3044
  // node_modules/.bun/@effect+platform-node-shared@4.1.2+edf248c88a527e3e/node_modules/@effect/platform-node-shared/dist/NodeTerminal.js
3196
3045
  import * as readline from "readline";
3197
- var make26 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
3046
+ var make25 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
3198
3047
  const stdin = process.stdin;
3199
3048
  const stdout = process.stdout;
3200
3049
  const lines = yield* make9();
@@ -3208,7 +3057,7 @@ var make26 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQui
3208
3057
  };
3209
3058
  stdin.once("end", onStdinEnd);
3210
3059
  yield* addFinalizer2(() => sync2(() => stdin.off("end", onStdinEnd)));
3211
- const rlRef = yield* make18({
3060
+ const rlRef = yield* make10({
3212
3061
  acquire: acquireRelease(sync2(() => {
3213
3062
  const rl = readline.createInterface({
3214
3063
  input: stdin,
@@ -3247,7 +3096,7 @@ var make26 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQui
3247
3096
  if (stdin.isTTY)
3248
3097
  stdin.setRawMode(enabled);
3249
3098
  });
3250
- const rawModeRef = yield* make18({
3099
+ const rawModeRef = yield* make10({
3251
3100
  acquire: acquireRelease(setRawMode(true), () => setRawMode(false)),
3252
3101
  idleTimeToLive: "10 millis"
3253
3102
  });
@@ -3298,14 +3147,14 @@ var make26 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQui
3298
3147
  if (inputEnded) {
3299
3148
  handleEnd();
3300
3149
  } else {
3301
- yield* get5(rlRef);
3302
- yield* get5(rawModeRef);
3150
+ yield* get3(rlRef);
3151
+ yield* get3(rawModeRef);
3303
3152
  stdin.once("end", handleEnd);
3304
3153
  }
3305
3154
  return queue;
3306
3155
  });
3307
3156
  const readLine = suspend3(() => poll(lines).pipe(flatMap3(match({
3308
- onNone: () => scoped(andThen2(get5(rlRef), take(lines))),
3157
+ onNone: () => scoped(andThen2(get3(rlRef), take(lines))),
3309
3158
  onSome: succeed6
3310
3159
  })), mapError2(() => new QuitError({}))));
3311
3160
  const display = (prompt) => uninterruptible(callback3((resume) => {
@@ -3316,7 +3165,7 @@ var make26 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQui
3316
3165
  cause: err
3317
3166
  }))));
3318
3167
  }));
3319
- return make25({
3168
+ return make24({
3320
3169
  columns,
3321
3170
  rows,
3322
3171
  size,
@@ -3325,7 +3174,7 @@ var make26 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQui
3325
3174
  display
3326
3175
  });
3327
3176
  });
3328
- var layer10 = /* @__PURE__ */ effect(Terminal, /* @__PURE__ */ make26(defaultShouldQuit));
3177
+ var layer10 = /* @__PURE__ */ effect(Terminal, /* @__PURE__ */ make25(defaultShouldQuit));
3329
3178
  function defaultShouldQuit(input) {
3330
3179
  const key = input.key;
3331
3180
  return key.name === "escape" || key.ctrl && (key.name === "c" || key.name === "d");
@@ -3352,12 +3201,12 @@ function toDate(input) {
3352
3201
  return toDateUtc2(makeUnsafe(input));
3353
3202
  }
3354
3203
  function parseDate(input) {
3355
- return getOrUndefined(map4(make19(input), toDateUtc2));
3204
+ return getOrUndefined(map4(make18(input), toDateUtc2));
3356
3205
  }
3357
3206
  function toIso(input) {
3358
3207
  return formatIso(makeUnsafe(input));
3359
3208
  }
3360
- var currentDate = map8(now2, toDateUtc2);
3209
+ var currentDate = map9(now2, toDateUtc2);
3361
3210
  function wallClockMillis() {
3362
3211
  return toEpochMillis2(nowUnsafe2());
3363
3212
  }
@@ -4401,7 +4250,7 @@ var RunCommandCenterSnapshot = Struct({
4401
4250
  var ReleaseChannels = ["stable", "next"];
4402
4251
  var ReleaseChannel = Literals(ReleaseChannels);
4403
4252
  var DefaultReleaseChannel = "stable";
4404
- var releaseVersion = (version) => {
4253
+ var releaseVersion2 = (version) => {
4405
4254
  const parts = /^v?(\d+)\.(\d+)\.(\d+)(?:-([^+]+))?(?:\+.*)?$/u.exec(version);
4406
4255
  if (parts === null)
4407
4256
  return;
@@ -4432,7 +4281,7 @@ var comparePrerelease = (a, b) => {
4432
4281
  return a.length - b.length;
4433
4282
  };
4434
4283
  var newerKitmanVersion = (candidate, running) => {
4435
- const [a, b] = [releaseVersion(candidate), releaseVersion(running)];
4284
+ const [a, b] = [releaseVersion2(candidate), releaseVersion2(running)];
4436
4285
  if (a === undefined || b === undefined)
4437
4286
  return true;
4438
4287
  const differing = a.numbers.findIndex((part, index) => part !== b.numbers[index]);
@@ -4441,7 +4290,7 @@ var newerKitmanVersion = (candidate, running) => {
4441
4290
  return (a.numbers[differing] ?? 0) > (b.numbers[differing] ?? 0);
4442
4291
  };
4443
4292
  var releaseChannelOffers = (channel, version) => {
4444
- const release = releaseVersion(version);
4293
+ const release = releaseVersion2(version);
4445
4294
  if (release === undefined)
4446
4295
  return false;
4447
4296
  return release.stable || channel === "next" && !release.devBuild;
@@ -5029,9 +4878,14 @@ function isSecretValueKey2(key) {
5029
4878
  }
5030
4879
 
5031
4880
  // packages/core/src/release-trigger.ts
5032
- var ReleaseTrigger = Literals(["merge", "milestone", "project"]);
4881
+ var ReleaseTrigger = Literals(["merge", "milestone", "project", "manual"]);
5033
4882
  var ReleaseTriggerLayer = Literals(["run", "project", "team", "workspace"]);
5034
- var ResolvedReleaseTrigger = Struct({ trigger: ReleaseTrigger, layer: ReleaseTriggerLayer });
4883
+ var ReleaseFallback = Struct({ trigger: Literal("merge"), reason: Literal("no_project") });
4884
+ var ResolvedReleaseTrigger = Struct({
4885
+ trigger: ReleaseTrigger,
4886
+ layer: ReleaseTriggerLayer,
4887
+ fallback: optionalKey(ReleaseFallback)
4888
+ });
5035
4889
  var ReleaseTriggerSetting = Struct({
5036
4890
  trigger: NullOr(ReleaseTrigger),
5037
4891
  resolved: optionalKey(ResolvedReleaseTrigger)
@@ -5039,13 +4893,21 @@ var ReleaseTriggerSetting = Struct({
5039
4893
  var ReleaseTriggerUpdate = Struct({
5040
4894
  trigger: NullOr(ReleaseTrigger)
5041
4895
  });
4896
+ var leadingFullSemver = /^(v?\d+\.\d+\.\d+)(?![\w.+]|-\w)/;
4897
+ var releaseVersion = (projectName) => leadingFullSemver.exec(projectName.trim())?.[1];
5042
4898
  var ReleaseScope = Struct({
5043
4899
  kind: Literals(["milestone", "project"]),
5044
4900
  projectId: String4,
5045
4901
  projectName: optionalKey(String4),
5046
4902
  milestoneId: optionalKey(String4),
5047
4903
  milestoneName: optionalKey(String4),
5048
- tasks: ArraySchema(Struct({ id: String4, key: String4, title: String4 }))
4904
+ tasks: ArraySchema(Struct({
4905
+ id: String4,
4906
+ key: String4,
4907
+ title: String4,
4908
+ outcome: optionalKey(String4),
4909
+ labels: optionalKey(ArraySchema(String4))
4910
+ }))
5049
4911
  });
5050
4912
  var ShippedScope = Struct({
5051
4913
  kind: Literals(["milestone", "project"]),
@@ -5075,6 +4937,158 @@ var EpicDelivery = Struct({
5075
4937
  own: optional(Boolean2)
5076
4938
  });
5077
4939
 
4940
+ // packages/core/src/target-branch.ts
4941
+ var isBranchName = (name) => name.length > 0 && name.length <= 240 && !name.startsWith("-") && !name.startsWith("/") && !name.endsWith("/") && !name.endsWith(".") && !name.endsWith(".lock") && !name.includes("..") && !name.includes("//") && !name.includes("@{") && name !== "@" && !name.split("/").some((part) => part.startsWith(".") || part.endsWith(".lock")) && !name.split("").some((char) => char <= " " || char === "\x7F" || "~^:?*[\\".includes(char));
4942
+ var TargetBranch = String4.check(makeFilter((name) => isBranchName(name) || "a branch name git accepts, such as release/next"));
4943
+ var TargetBranchSetting = Struct({ targetBranch: NullOr(TargetBranch) });
4944
+ var BaseBranchLayer = Literals([
4945
+ "input",
4946
+ "change_request",
4947
+ "epic",
4948
+ "task",
4949
+ "milestone",
4950
+ "project",
4951
+ "default"
4952
+ ]);
4953
+ var baseBranchLayerWords = {
4954
+ input: "the branch the Run was given, or the base of the Run that made it",
4955
+ change_request: "the ChangeRequest's target",
4956
+ epic: "the epic's branch",
4957
+ task: "the Task's own target branch",
4958
+ milestone: "the Milestone's target branch",
4959
+ project: "the Project's target branch",
4960
+ default: "the repository's default branch"
4961
+ };
4962
+
4963
+ // packages/core/src/run-launch.ts
4964
+ var repositoryKey = (url) => url.trim().toLowerCase().replace(/^[a-z+]+:\/\//, "").replace(/^[^@/]+@/, "").replace(/^([^/:]+):(?!\d+\/)/, "$1/").replace(/^([^/:]+):\d+\//, "$1/").replace(/\.git$/, "").replace(/\/+$/, "");
4965
+ var launchInputSchema = (schema) => {
4966
+ const ref = schema.$ref;
4967
+ const defs = schema.$defs;
4968
+ const resolved = isString2(ref) && ref.startsWith("#/$defs/") && isJsonObject(defs) ? defs[ref.slice("#/$defs/".length)] : schema;
4969
+ const target = isJsonObject(resolved) ? resolved : {};
4970
+ const properties = isJsonObject(target.properties) ? target.properties : {};
4971
+ return {
4972
+ properties,
4973
+ required: Array.isArray(target.required) ? target.required.filter(isString2) : []
4974
+ };
4975
+ };
4976
+
4977
+ // packages/core/src/loop-input-fields.ts
4978
+ var LoopInputField = Struct({
4979
+ name: String4,
4980
+ description: optionalKey(String4),
4981
+ type: String4,
4982
+ required: Boolean2,
4983
+ default: optionalKey(Json)
4984
+ });
4985
+ var definitionsOf = (schema) => {
4986
+ const defs = schema.$defs ?? schema.definitions;
4987
+ return isJsonObject(defs) ? defs : {};
4988
+ };
4989
+ var resolved = (schema, defs) => {
4990
+ if (!isJsonObject(schema))
4991
+ return {};
4992
+ const ref = schema.$ref;
4993
+ if (!isString2(ref) || !ref.startsWith("#/$defs/"))
4994
+ return schema;
4995
+ const target = defs[ref.slice("#/$defs/".length)];
4996
+ return isJsonObject(target) ? { ...target, ...schema, $ref: null } : schema;
4997
+ };
4998
+ var isNull = (schema) => schema.type === "null";
4999
+ var typeOf = (property, defs) => {
5000
+ const schema = resolved(property, defs);
5001
+ const members = Array.isArray(schema.anyOf) ? schema.anyOf : undefined;
5002
+ if (members !== undefined) {
5003
+ const types = members.map((member) => resolved(member, defs)).filter((member) => !isNull(member));
5004
+ return [...new Set(types.map((member) => typeOf(member, defs)))].join(" | ") || "null";
5005
+ }
5006
+ if (Array.isArray(schema.enum))
5007
+ return schema.enum.map((value) => JSON.stringify(value)).join(" | ");
5008
+ if (schema.type === "array")
5009
+ return `${typeOf(schema.items, defs)}[]`;
5010
+ if (isString2(schema.type))
5011
+ return schema.type;
5012
+ return "any";
5013
+ };
5014
+ var descriptionOf = (property, defs) => {
5015
+ if (isString2(property.description))
5016
+ return property.description;
5017
+ const annotations = Array.isArray(property.allOf) ? property.allOf : [];
5018
+ for (const annotation of annotations) {
5019
+ const found = isJsonObject(annotation) ? descriptionOf(resolved(annotation, defs), defs) : undefined;
5020
+ if (found !== undefined)
5021
+ return found;
5022
+ }
5023
+ return;
5024
+ };
5025
+ var loopInputFields = (schema) => {
5026
+ const defs = definitionsOf(schema);
5027
+ const { properties, required } = launchInputSchema(schema);
5028
+ return Object.entries(properties).map(([name, property]) => {
5029
+ const field = resolved(property, defs);
5030
+ const description = descriptionOf(field, defs);
5031
+ return {
5032
+ name,
5033
+ ...description === undefined ? undefined : { description },
5034
+ type: typeOf(field, defs),
5035
+ required: required.includes(name),
5036
+ ...field.default === undefined ? undefined : { default: field.default }
5037
+ };
5038
+ });
5039
+ };
5040
+
5041
+ // packages/core/src/input-defaults.ts
5042
+ var InputDefaultLayers = ["project", "team", "workspace"];
5043
+ var InputSourceLayers = ["run", ...InputDefaultLayers, "kit", "schema"];
5044
+ var InputSource = Struct({
5045
+ field: String4,
5046
+ layer: Literals(InputSourceLayers),
5047
+ when: optionalKey(String4)
5048
+ });
5049
+ var inputSourceLayerWords = {
5050
+ run: "the Run",
5051
+ project: "its Project",
5052
+ team: "its Team",
5053
+ workspace: "the Workspace",
5054
+ kit: "the Kit's values",
5055
+ schema: "the schema's default"
5056
+ };
5057
+ var inputSourceWords = (source) => `${inputSourceLayerWords[source.layer]}${source.when === undefined ? "" : `, for ${source.when}`}`;
5058
+ var InheritedInputValue = Struct({
5059
+ field: String4,
5060
+ value: Json,
5061
+ layer: Literals(InputSourceLayers),
5062
+ when: optionalKey(String4)
5063
+ });
5064
+ var LoopInputDefaultEntry = Struct({
5065
+ when: optionalKey(String4),
5066
+ values: Record(String4, Json),
5067
+ off: Boolean2,
5068
+ starts: optionalKey(Struct({ on: Boolean2, why: optionalKey(String4) })),
5069
+ problems: ArraySchema(Struct({ field: String4, problem: String4 })),
5070
+ inherited: ArraySchema(InheritedInputValue)
5071
+ });
5072
+ var LoopInputDefaults = Struct({
5073
+ loop: String4,
5074
+ layer: Literals(InputDefaultLayers),
5075
+ teamId: optionalKey(String4),
5076
+ projectId: optionalKey(String4),
5077
+ resolved: Boolean2,
5078
+ inputSchema: Record(String4, Json),
5079
+ fields: ArraySchema(LoopInputField),
5080
+ when: ArraySchema(Struct({ name: String4, event: String4, description: optionalKey(String4) })),
5081
+ defaults: ArraySchema(LoopInputDefaultEntry)
5082
+ });
5083
+ var LoopInputDefaultUpdate = Struct({
5084
+ teamId: optionalKey(String4),
5085
+ projectId: optionalKey(String4),
5086
+ when: optionalKey(String4),
5087
+ values: optionalKey(Record(String4, Json)),
5088
+ unset: optionalKey(ArraySchema(String4)),
5089
+ off: optionalKey(Boolean2)
5090
+ });
5091
+
5078
5092
  // packages/core/src/agent-sandbox-policy.ts
5079
5093
  var Path3 = String4.check(isMinLength(1));
5080
5094
  var AgentSandboxNetwork = Union([
@@ -5797,6 +5811,393 @@ var TokenTotalCount = String4.check(isPattern(/^(?:0|[1-9][0-9]*)$/));
5797
5811
  var TokenTotal = Struct({ input: TokenTotalCount, output: TokenTotalCount, cached: TokenTotalCount });
5798
5812
  var tokenCountWords = (count) => BigInt(count).toLocaleString("en-US");
5799
5813
 
5814
+ // packages/core/src/loop-outline.ts
5815
+ var endsFailing = (end) => end.failure !== undefined || end.fails === true;
5816
+ var hasOtherwise = (paths) => paths.some((path) => path.label === "else" || path.label.split(" or ").includes("default"));
5817
+ var at = String4;
5818
+ var Nodes = ArraySchema(suspend4(() => OutlineNode));
5819
+ var OutlinePath = Struct({
5820
+ label: String4,
5821
+ on: optionalKey(Literal("success")),
5822
+ nodes: Nodes
5823
+ });
5824
+ var Names = ArraySchema(String4);
5825
+ var OutlineNode = Union([
5826
+ Struct({
5827
+ kind: Literal("step"),
5828
+ step: String4,
5829
+ names: Names,
5830
+ agent: optionalKey(String4),
5831
+ defined: optionalKey(Boolean2),
5832
+ outline: optionalKey(Nodes),
5833
+ runtime: optionalKey(Boolean2),
5834
+ afterReturn: optionalKey(Boolean2),
5835
+ at
5836
+ }),
5837
+ Struct({
5838
+ kind: Literal("branch"),
5839
+ on: optionalKey(Literal("failure")),
5840
+ tested: optionalKey(Record(String4, Names)),
5841
+ orElse: optionalKey(Names),
5842
+ gives: optionalKey(Names),
5843
+ nodes: optionalKey(Nodes),
5844
+ paths: ArraySchema(OutlinePath),
5845
+ at
5846
+ }),
5847
+ Struct({
5848
+ kind: Literal("repeat"),
5849
+ label: String4,
5850
+ binds: optionalKey(Names),
5851
+ nodes: Nodes,
5852
+ at
5853
+ }),
5854
+ Struct({
5855
+ kind: Literal("many"),
5856
+ label: String4,
5857
+ sequential: optionalKey(Boolean2),
5858
+ nodes: Nodes,
5859
+ at
5860
+ }),
5861
+ Struct({
5862
+ kind: Literal("all"),
5863
+ sequential: optionalKey(Boolean2),
5864
+ paths: ArraySchema(OutlinePath),
5865
+ at
5866
+ }),
5867
+ Struct({
5868
+ kind: Literal("first"),
5869
+ names: Names,
5870
+ as: optionalKey(Names),
5871
+ paths: ArraySchema(OutlinePath),
5872
+ at
5873
+ }),
5874
+ Struct({
5875
+ kind: Literal("call"),
5876
+ names: Names,
5877
+ loop: optionalKey(String4),
5878
+ runtime: optionalKey(Boolean2),
5879
+ afterReturn: optionalKey(Boolean2),
5880
+ at
5881
+ }),
5882
+ Struct({
5883
+ kind: Literal("end"),
5884
+ statuses: optionalKey(Names),
5885
+ failure: optionalKey(String4),
5886
+ fails: optionalKey(Boolean2),
5887
+ caught: optionalKey(Boolean2),
5888
+ afterReturn: optionalKey(Boolean2),
5889
+ runtime: optionalKey(Boolean2),
5890
+ at
5891
+ }),
5892
+ Struct({ kind: Literal("runtime"), label: String4, at })
5893
+ ]).annotate({ identifier: "OutlineNode" });
5894
+ var LoopOutline = ArraySchema(OutlineNode);
5895
+ var decidedAtRunTime = "decided at run time";
5896
+ var nameList = (names) => names.join(" | ");
5897
+ var outlineLabel = (node) => {
5898
+ switch (node.kind) {
5899
+ case "step": {
5900
+ const named = node.names.length === 1 && node.names[0] === node.step;
5901
+ const step = node.defined === true ? `step ${node.step}` : node.step;
5902
+ const agent = node.agent === undefined ? node.runtime === true ? ` as an agent ${decidedAtRunTime}` : "" : ` as ${node.agent}`;
5903
+ return `${named ? step : `${step} ${nameList(node.names)}`}${agent}`;
5904
+ }
5905
+ case "branch":
5906
+ return node.on === "failure" ? "on failure" : "branch";
5907
+ case "repeat":
5908
+ return `repeat ${node.label}`;
5909
+ case "many":
5910
+ return `many ${node.label}`;
5911
+ case "all":
5912
+ return "all";
5913
+ case "first":
5914
+ return `first ${nameList(node.names)}`;
5915
+ case "call":
5916
+ return `call ${nameList(node.names)} ${node.loop === undefined ? `a Loop ${decidedAtRunTime}` : `Loop ${node.loop}`}`;
5917
+ case "end": {
5918
+ if (node.caught === true)
5919
+ return `goes on failing${node.failure === undefined ? "" : ` ${node.failure}`} into the handlers that catch it`;
5920
+ if (node.failure !== undefined)
5921
+ return `end failing ${node.failure}`;
5922
+ if (node.fails === true)
5923
+ return `end failing, ${decidedAtRunTime}`;
5924
+ if (node.statuses !== undefined)
5925
+ return `end ${nameList(node.statuses)}${node.runtime === true ? ` or ${decidedAtRunTime}` : ""}`;
5926
+ return node.runtime === true ? `end ${decidedAtRunTime}` : "end";
5927
+ }
5928
+ case "runtime":
5929
+ return `${decidedAtRunTime}: ${node.label}`;
5930
+ }
5931
+ };
5932
+ var pathsOf = (node) => node.kind === "branch" || node.kind === "all" || node.kind === "first" ? node.paths : undefined;
5933
+ var childrenOf = (node) => {
5934
+ if (node.kind === "repeat" || node.kind === "many")
5935
+ return node.nodes;
5936
+ return node.kind === "step" ? node.outline : undefined;
5937
+ };
5938
+ var outlineText = (outline) => {
5939
+ const lines = [];
5940
+ const write = (nodes, depth) => {
5941
+ for (const node of nodes) {
5942
+ lines.push(`${" ".repeat(depth)}- ${outlineLabel(node)} (${node.at})`);
5943
+ if (node.kind === "branch" && node.nodes !== undefined) {
5944
+ lines.push(`${" ".repeat(depth + 1)}- tried:`);
5945
+ write(node.nodes, depth + 2);
5946
+ }
5947
+ for (const path of pathsOf(node) ?? []) {
5948
+ lines.push(`${" ".repeat(depth + 1)}- ${path.label}:`);
5949
+ write(path.nodes, depth + 2);
5950
+ }
5951
+ write(childrenOf(node) ?? [], depth + 1);
5952
+ }
5953
+ };
5954
+ write(outline, 0);
5955
+ return lines.join(`
5956
+ `);
5957
+ };
5958
+ var anyFailure = "any failure";
5959
+ var goesOn = "goes on";
5960
+ var totalHandlers = new Set([anyFailure, goesOn, "catch", "onFailure"]);
5961
+ var catchesAll = (paths) => paths.some((path) => totalHandlers.has(path.label));
5962
+ var tagsOf = (failure) => failure.split(" | ");
5963
+ var uncaught = (paths, exit) => {
5964
+ if (catchesAll(paths))
5965
+ return;
5966
+ if (exit.failure === undefined)
5967
+ return exit;
5968
+ const caught = new Set(paths.flatMap((path) => tagsOf(path.label)));
5969
+ const tags = tagsOf(exit.failure);
5970
+ const rest = tags.filter((tag) => !caught.has(tag));
5971
+ if (rest.length === tags.length)
5972
+ return exit;
5973
+ return rest.length === 0 ? undefined : { ...exit, failure: rest.join(" | ") };
5974
+ };
5975
+ var mermaidText = (text) => text.replaceAll('"', "#quot;").replaceAll("<", "#lt;").replaceAll(">", "#gt;").replaceAll(`
5976
+ `, " ");
5977
+ var leaves = (exit) => exit.returned === true || exit.caught === true;
5978
+ var plainExit = (exit) => ({
5979
+ from: exit.from,
5980
+ ...exit.label === undefined ? undefined : { label: exit.label }
5981
+ });
5982
+ var outlineMermaid = (title, outline) => {
5983
+ const lines = ["flowchart TD", ` start(["${mermaidText(title)}"])`];
5984
+ const edges = [];
5985
+ let count = 0;
5986
+ const declare = (brackets, label) => {
5987
+ count += 1;
5988
+ const id = `n${count}`;
5989
+ lines.push(` ${id}${brackets[0]}"${mermaidText(label)}"${brackets[1]}`);
5990
+ return id;
5991
+ };
5992
+ const connect = (exits, to) => {
5993
+ for (const exit of exits)
5994
+ edges.push(exit.label === undefined ? ` ${exit.from} --> ${to}` : ` ${exit.from} -->|"${mermaidText(exit.label)}"| ${to}`);
5995
+ };
5996
+ const sequence = (nodes, entry, inStep) => {
5997
+ const leaving = entry.filter(leaves);
5998
+ let exits = entry.filter((exit) => !leaves(exit));
5999
+ for (const node of nodes) {
6000
+ const out = one(node, exits, inStep);
6001
+ leaving.push(...out.filter(leaves));
6002
+ exits = out.filter((exit) => !leaves(exit));
6003
+ }
6004
+ return [...exits, ...leaving];
6005
+ };
6006
+ const forked = (brackets, node, paths, entry, inStep) => {
6007
+ const fork = declare(brackets, outlineLabel(node));
6008
+ connect(entry, fork);
6009
+ return { fork, exits: paths.flatMap((path) => sequence(path.nodes, [{ from: fork, label: path.label }], inStep)) };
6010
+ };
6011
+ const plain = (node, entry) => {
6012
+ const id = declare(node.kind === "runtime" ? ["[[", "]]"] : ["[", "]"], outlineLabel(node));
6013
+ connect(entry, id);
6014
+ return [{ from: id }];
6015
+ };
6016
+ const boxed = (label, nodes, entry, inStep) => {
6017
+ count += 1;
6018
+ const id = `n${count}`;
6019
+ lines.push(` subgraph ${id} ["${mermaidText(label)}"]`);
6020
+ const exits = sequence(nodes, entry, inStep);
6021
+ lines.push(" end");
6022
+ return { id, exits };
6023
+ };
6024
+ const one = (node, entry, inStep) => {
6025
+ switch (node.kind) {
6026
+ case "branch": {
6027
+ if (node.on === "failure") {
6028
+ const tried = node.nodes ?? [];
6029
+ const handlers = node.paths.filter((path) => path.on !== "success");
6030
+ const onSuccess = node.paths.find((path) => path.on === "success");
6031
+ const succeeded = (exits) => onSuccess === undefined ? exits : [
6032
+ ...exits.filter(leaves),
6033
+ ...sequence(onSuccess.nodes, exits.flatMap((exit) => leaves(exit) ? [] : [{ ...exit, label: onSuccess.label }]), inStep)
6034
+ ];
6035
+ if (tried.length === 0) {
6036
+ const { fork, exits } = forked(["{", "}"], node, handlers, entry, inStep);
6037
+ return [...succeeded([{ from: fork, label: "no failure" }]), ...exits];
6038
+ }
6039
+ const box = boxed("tried", tried, entry, inStep);
6040
+ const caught = box.exits.filter((exit) => exit.caught === true);
6041
+ const goesOn = caught.flatMap((exit) => uncaught(handlers, exit) ?? []);
6042
+ const { exits } = forked(["{", "}"], node, handlers, [
6043
+ { from: box.id, label: "fails" },
6044
+ ...caught.filter((exit) => uncaught(handlers, exit) !== exit).map(plainExit)
6045
+ ], inStep);
6046
+ return [...succeeded(box.exits.filter((exit) => exit.caught !== true)), ...goesOn, ...exits];
6047
+ }
6048
+ const { fork, exits } = forked(["{", "}"], node, node.paths, entry, inStep);
6049
+ return hasOtherwise(node.paths) ? exits : [...exits, { from: fork, label: "otherwise" }];
6050
+ }
6051
+ case "all":
6052
+ case "first":
6053
+ return forked(["[/", "/]"], node, node.paths, entry, inStep).exits;
6054
+ case "repeat":
6055
+ case "many": {
6056
+ const head = declare(["{{", "}}"], outlineLabel(node));
6057
+ connect(entry, head);
6058
+ const body = sequence(node.nodes, [{ from: head }], inStep);
6059
+ connect(body.filter((exit) => !leaves(exit)).map((exit) => ({ ...exit, label: "again" })), head);
6060
+ return [{ from: head, label: "done" }, ...body.filter(leaves)];
6061
+ }
6062
+ case "end": {
6063
+ if (node.caught === true)
6064
+ return entry.map((exit) => ({
6065
+ ...plainExit(exit),
6066
+ caught: true,
6067
+ ...node.failure === undefined ? undefined : { failure: node.failure }
6068
+ }));
6069
+ if (inStep && !endsFailing(node)) {
6070
+ const returned = declare(["[", "]"], outlineLabel(node).replace(/^end/u, "returns"));
6071
+ connect(entry, returned);
6072
+ return [{ from: returned, returned: true }];
6073
+ }
6074
+ const end = declare(["([", "])"], outlineLabel(node));
6075
+ connect(entry, end);
6076
+ return [];
6077
+ }
6078
+ case "step":
6079
+ return node.outline !== undefined && node.outline.length > 0 ? boxed(outlineLabel(node), node.outline, entry, true).exits.map((exit) => exit.caught === true ? exit : plainExit(exit)) : plain(node, entry);
6080
+ default:
6081
+ return plain(node, entry);
6082
+ }
6083
+ };
6084
+ const exits = sequence(outline, [{ from: "start" }], false);
6085
+ if (exits.length > 0)
6086
+ connect(exits, declare(["([", "])"], "end"));
6087
+ return [...lines, ...edges].join(`
6088
+ `);
6089
+ };
6090
+
6091
+ // packages/core/src/run-outline.ts
6092
+ var OutlineStates = ["upcoming", "running", "needs_you", "succeeded", "failed", "not_taken"];
6093
+ var Nodes2 = ArraySchema(suspend4(() => RunOutlineNode));
6094
+ var RunOutlineNode = Struct({
6095
+ kind: Literals(["step", "branch", "repeat", "many", "all", "first", "call", "end", "runtime", "journaled"]),
6096
+ label: String4,
6097
+ state: Literals(OutlineStates),
6098
+ at: optionalKey(String4),
6099
+ steps: optionalKey(ArraySchema(String4)),
6100
+ loop: optionalKey(String4),
6101
+ runtime: optionalKey(Boolean2),
6102
+ unlisted: optionalKey(Boolean2),
6103
+ tried: optionalKey(Nodes2),
6104
+ paths: optionalKey(ArraySchema(Struct({ label: String4, taken: Boolean2, nodes: Nodes2 }))),
6105
+ nodes: optionalKey(Nodes2),
6106
+ visits: optionalKey(ArraySchema(Struct({
6107
+ label: String4,
6108
+ state: Literals(OutlineStates),
6109
+ steps: optionalKey(ArraySchema(String4)),
6110
+ nodes: Nodes2
6111
+ })))
6112
+ }).annotate({ identifier: "RunOutlineNode" });
6113
+ var RunOutline = ArraySchema(RunOutlineNode);
6114
+ var launchedAgent = ["agent", "agentWork", "agentWorkOnce"];
6115
+ var launchedKinds = new Set(["agent", "question", "child"]);
6116
+ var decodeNamed = decodeUnknownOption(Struct({ status: optionalKey(Unknown), _tag: optionalKey(Unknown) }));
6117
+ var launchPrefixes = new Map(Object.entries({
6118
+ agent_work: ["agentWorkAs", ...launchedAgent],
6119
+ ask: ["ask", "suggestVerification"],
6120
+ call: ["call"],
6121
+ callable_loops: ["callableLoops"],
6122
+ wait_for: ["waitFor", "pipelineMoved"],
6123
+ verify: ["verify"],
6124
+ command: ["command"],
6125
+ change_request: ["changeRequest"],
6126
+ write_back: ["writeBack"],
6127
+ artifact: ["artifact"],
6128
+ file: ["file"],
6129
+ note: ["note"],
6130
+ comment: ["comment"],
6131
+ create_tasks: ["createTasks", "alertTask"],
6132
+ integration_branch: ["deliveryBase"],
6133
+ branch: ["branch", "integrationBranch"],
6134
+ merge_change_request: ["mergeChangeRequest"],
6135
+ approve_change_request: ["approveChangeRequest"],
6136
+ close_change_request: ["closeChangeRequest"],
6137
+ rerun_pipeline: ["rerunPipeline"],
6138
+ report_pipeline: ["reportPipeline"],
6139
+ release: ["release"],
6140
+ record_deploy: ["recordDeploy"],
6141
+ deploy_target: ["deployTarget"],
6142
+ live_branches: ["liveBranches"],
6143
+ merged_change_request: ["mergedChangeRequest"],
6144
+ record_revert: ["recordRevert"],
6145
+ transcripts: ["transcripts"],
6146
+ propose: ["propose"],
6147
+ project_activity: ["projectActivity"],
6148
+ draft_update: ["draftUpdate"],
6149
+ pipeline_status: ["pipelineStatus"],
6150
+ review_threads: ["reviewThreads"],
6151
+ open_change_requests: ["openChangeRequests"],
6152
+ own_change_requests: ["ownChangeRequests"],
6153
+ measure: ["measure"],
6154
+ claim: ["claim"],
6155
+ let_go: ["letGo"],
6156
+ claim_end: [],
6157
+ deploy: ["runDeploy"],
6158
+ resolve: ["resolveRevisions"],
6159
+ compare: ["compare"],
6160
+ versions: ["versions"],
6161
+ sync: ["syncBase"],
6162
+ apply: ["applyChange"],
6163
+ step: [],
6164
+ stop: []
6165
+ }));
6166
+ var stateWords = {
6167
+ upcoming: "upcoming",
6168
+ running: "running",
6169
+ needs_you: "needs you",
6170
+ succeeded: "succeeded",
6171
+ failed: "failed",
6172
+ not_taken: "not taken"
6173
+ };
6174
+ var runOutlineNodeText = (node) => [
6175
+ node.label,
6176
+ node.visits !== undefined && (node.kind === "repeat" || node.kind === "many" || node.visits.length > 1) ? `ran ${node.visits.length} ${node.visits.length === 1 ? "time" : "times"}` : undefined,
6177
+ node.unlisted === true ? "not in the outline" : undefined
6178
+ ].filter((part) => part !== undefined).join(", ");
6179
+ var runOutlineText = (outline) => {
6180
+ const lines = [];
6181
+ const write = (nodes, depth) => {
6182
+ const indent = " ".repeat(depth);
6183
+ for (const node of nodes) {
6184
+ lines.push(`${indent}- ${runOutlineNodeText(node)}: ${stateWords[node.state]}`);
6185
+ if (node.tried !== undefined) {
6186
+ lines.push(`${indent} - tried:`);
6187
+ write(node.tried, depth + 2);
6188
+ }
6189
+ for (const path of node.paths ?? []) {
6190
+ lines.push(`${indent} - ${path.label}${path.taken ? " (taken)" : ""}:`);
6191
+ write(path.nodes, depth + 2);
6192
+ }
6193
+ write(node.nodes ?? [], depth + 1);
6194
+ }
6195
+ };
6196
+ write(outline, 0);
6197
+ return lines.join(`
6198
+ `);
6199
+ };
6200
+
5800
6201
  // packages/core/src/test-report.ts
5801
6202
  var isTestReportName = (name) => /junit.*\.xml$/iu.test(name);
5802
6203
  var maxSkippedTests = 1e4;
@@ -6204,6 +6605,7 @@ var LoopSafeReferenceString = String4.check(isMinLength(1), isMaxLength(240), is
6204
6605
  var LoopSafeInternalReferenceString = String4.check(isMinLength(1), isMaxLength(240), isPattern(new RegExp(LoopSafeInternalReferencePattern, "u")));
6205
6606
  var loopSafeTextMaxLength = 4000;
6206
6607
  var LoopSafeText = String4.check(isMaxLength(loopSafeTextMaxLength), isPattern(new RegExp(`^(?![\\s\\S]*(?:${LoopCredentialContentPattern}|[A-Za-z][A-Za-z0-9+.-]*://(?:[^\\s/?#]*@|[^\\s?#]*\\?)))[\\s\\S]*$`, "u")));
6608
+ var recommendedDefault = (recommended) => recommended !== undefined && is(LoopSafeText)(recommended) ? recommended : undefined;
6207
6609
  var reportedModelName = (named) => /^[A-Za-z0-9][\w.:/@+[\]-]{0,199}$/u.test(named) && is(LoopSafeText)(named) && redactCredentialText(named) === named ? named : undefined;
6208
6610
  var QuestionText = String4;
6209
6611
  var LoopSafeOutputDataString = String4.check(isMaxLength(4000), isPattern(new RegExp(LoopSafeInternalReferencePattern, "u")));
@@ -6520,7 +6922,13 @@ var RunWaiting = Union([
6520
6922
  kind: Literal("claim"),
6521
6923
  name: String4.check(isMinLength(1)),
6522
6924
  resource: String4.check(isMinLength(1)),
6523
- holder: optionalKey(Struct({ runId: Id, loopId: String4 }))
6925
+ holder: optionalKey(Struct({ runId: Id, loopId: String4 })),
6926
+ heldBy: optionalKey(Struct({
6927
+ actorId: String4,
6928
+ name: optionalKey(String4),
6929
+ since: String4,
6930
+ reason: String4
6931
+ }))
6524
6932
  }),
6525
6933
  Struct({
6526
6934
  kind: Literal("queue"),
@@ -6560,6 +6968,7 @@ var ApprovedVerification = Struct({
6560
6968
  workingDirectory: optionalKey(String4),
6561
6969
  pipeline: optionalKey(Boolean2),
6562
6970
  readsTarget: optionalKey(Boolean2),
6971
+ kind: optionalKey(Literal("command")),
6563
6972
  approvedByUserId: String4,
6564
6973
  createdAt: Timestamp
6565
6974
  });
@@ -6940,6 +7349,7 @@ var RunGraphNode = Struct({
6940
7349
  status: Literals(RunDisplayStates),
6941
7350
  startedAt: Timestamp,
6942
7351
  endedAt: optionalKey(Timestamp),
7352
+ outcome: optionalKey(String4),
6943
7353
  attempts: ArraySchema(Struct({
6944
7354
  id: Id,
6945
7355
  attempt: Int.check(isGreaterThanOrEqualTo(1)),
@@ -6960,9 +7370,20 @@ var RunGraphNode = Struct({
6960
7370
  task: optionalKey(Struct({ id: Id, key: String4, title: String4 }))
6961
7371
  }))
6962
7372
  });
7373
+ var RunGraphTicket = Struct({
7374
+ key: String4,
7375
+ title: String4,
7376
+ status: Literals(RunDisplayStates),
7377
+ outcome: optionalKey(Literals(["merged", "failed", "skipped"])),
7378
+ startedAt: optionalKey(Timestamp),
7379
+ endedAt: optionalKey(Timestamp),
7380
+ steps: ArraySchema(Id)
7381
+ });
6963
7382
  var RunGraph = Struct({
6964
7383
  columns: ArraySchema(ArraySchema(RunGraphNode)),
6965
- needs: ArraySchema(Struct({ from: Id, to: Id }))
7384
+ needs: ArraySchema(Struct({ from: Id, to: Id })),
7385
+ waves: optionalKey(ArraySchema(ArraySchema(RunGraphTicket))),
7386
+ outline: optionalKey(RunOutline)
6966
7387
  });
6967
7388
  var RunHeader = Struct({
6968
7389
  loopTitle: String4,
@@ -6975,7 +7396,9 @@ var RunHeader = Struct({
6975
7396
  releaseWhen: optionalKey(ResolvedReleaseTrigger),
6976
7397
  releaseScope: optionalKey(ReleaseScope),
6977
7398
  deliversTo: optionalKey(ResolvedDeliveryTarget),
6978
- epic: optionalKey(EpicDelivery)
7399
+ epic: optionalKey(EpicDelivery),
7400
+ baseBranch: optionalKey(Struct({ branch: String4, layer: BaseBranchLayer })),
7401
+ inputSources: optionalKey(ArraySchema(InputSource))
6979
7402
  });
6980
7403
  var RunShow = Struct({
6981
7404
  run: Run,
@@ -7027,10 +7450,12 @@ var RunStartPreview = Struct({
7027
7450
  })
7028
7451
  });
7029
7452
  var LoopVersion = String4.check(isPattern(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/));
7453
+ var LoopDescription = String4.check(isPattern(/^[^\r\n]{1,160}$/));
7030
7454
  var ProgramLoop = Struct({
7031
7455
  id: String4,
7032
7456
  title: String4,
7033
7457
  version: optionalKey(LoopVersion),
7458
+ description: optionalKey(LoopDescription),
7034
7459
  layer: Literals(["team", "workspace"]),
7035
7460
  digest: String4,
7036
7461
  outcome: optionalKey(String4),
@@ -7091,7 +7516,8 @@ var RunListItem = Struct({
7091
7516
  loop: Struct({ id: String4, title: String4 }),
7092
7517
  task: optionalKey(Struct({ id: Id, key: String4, title: String4 })),
7093
7518
  display: RunDisplay,
7094
- miniGraph: ArraySchema(Literals(RunDisplayStates))
7519
+ miniGraph: ArraySchema(Literals(RunDisplayStates)),
7520
+ steps: ArraySchema(Literals(RunDisplayStates))
7095
7521
  });
7096
7522
  var RunList = Struct({
7097
7523
  items: ArraySchema(RunListItem),
@@ -7119,6 +7545,129 @@ var RunActionSummary = Struct({
7119
7545
  var RunActionList = Struct({ items: ArraySchema(RunActionSummary) });
7120
7546
  var RunActionTaken = Struct({ action: String4, run: Run });
7121
7547
 
7548
+ // packages/core/src/calver.ts
7549
+ var CalverFormat = String4.check(isMaxLength(40), isPattern(/^(?:YYYY|YY|0Y|MM|0M|DD|0D|[.-])+MICRO$/u));
7550
+ var calverTokens = /YYYY|YY|0Y|MM|0M|DD|0D|MICRO/gu;
7551
+ var tokenPatterns = {
7552
+ YYYY: "(\\d{4})",
7553
+ YY: "([1-9]?\\d)",
7554
+ "0Y": "(\\d{2})",
7555
+ MM: "([1-9]|1[0-2])",
7556
+ "0M": "(0[1-9]|1[0-2])",
7557
+ DD: "([1-9]|[12]\\d|3[01])",
7558
+ "0D": "(0[1-9]|[12]\\d|3[01])",
7559
+ MICRO: "(0|[1-9]\\d*)"
7560
+ };
7561
+ var isCalverToken = (token) => Object.hasOwn(tokenPatterns, token);
7562
+ var calverNumbers = (format, version) => {
7563
+ const pattern = format.replaceAll(".", "\\.").replaceAll(calverTokens, (token) => isCalverToken(token) ? tokenPatterns[token] : token);
7564
+ const matched = new RegExp(`^${pattern}$`, "u").exec(version);
7565
+ return matched === null ? undefined : matched.slice(1).map(Number);
7566
+ };
7567
+ var compareCalver = (a, b) => {
7568
+ for (let index = 0;index < Math.max(a.length, b.length); index++) {
7569
+ const difference = (a[index] ?? 0) - (b[index] ?? 0);
7570
+ if (difference !== 0)
7571
+ return difference;
7572
+ }
7573
+ return 0;
7574
+ };
7575
+
7576
+ // packages/core/src/team-context.ts
7577
+ var BranchTemplate = String4.check(isMinLength(1), isMaxLength(160));
7578
+ var DeliveryMode = Literals(["gated", "auto"]);
7579
+ var HoursPerPriorityLevel = Int.check(isGreaterThanOrEqualTo(1), isLessThanOrEqualTo(168));
7580
+ var TeamDeliverySettings = Struct({
7581
+ defaultRepoBindingId: optionalKey(Id),
7582
+ standardBranchTemplate: BranchTemplate,
7583
+ epicBranchTemplate: BranchTemplate,
7584
+ isolatedChildBranchTemplate: BranchTemplate,
7585
+ delivery: DeliveryMode,
7586
+ hoursPerPriorityLevel: HoursPerPriorityLevel,
7587
+ agentsStateScope: Boolean2,
7588
+ revision: Int.check(isGreaterThanOrEqualTo(1))
7589
+ });
7590
+ var TeamDeliverySettingsUpdate = Struct({
7591
+ defaultRepoBindingId: optionalKey(Union([Id, Null])),
7592
+ standardBranchTemplate: optionalKey(BranchTemplate),
7593
+ epicBranchTemplate: optionalKey(BranchTemplate),
7594
+ isolatedChildBranchTemplate: optionalKey(BranchTemplate),
7595
+ delivery: optionalKey(DeliveryMode),
7596
+ hoursPerPriorityLevel: optionalKey(HoursPerPriorityLevel),
7597
+ agentsStateScope: optionalKey(Boolean2),
7598
+ expectedRevision: Int.check(isGreaterThanOrEqualTo(1))
7599
+ });
7600
+ var TeamReference = Struct({ id: Id, workspaceId: Id, key: String4, name: String4 });
7601
+ var TeamReferenceList = Struct({ items: ArraySchema(TeamReference) });
7602
+
7603
+ // packages/core/src/task-outcome.ts
7604
+ var TaskOutcome = Literals([
7605
+ "feature",
7606
+ "bug",
7607
+ "refactor",
7608
+ "investigation",
7609
+ "docs",
7610
+ "migration",
7611
+ "performance"
7612
+ ]);
7613
+
7614
+ // packages/core/src/run-context.ts
7615
+ var Continuing = Struct({
7616
+ changeRequestId: String4,
7617
+ number: String4,
7618
+ url: String4,
7619
+ branch: String4,
7620
+ targetBranch: String4,
7621
+ defaultBranch: optional(String4),
7622
+ revision: optional(String4),
7623
+ lastRunId: optional(String4),
7624
+ lastRunStatus: optional(String4),
7625
+ lastRunSummary: optional(String4)
7626
+ });
7627
+ var Named = Struct({ id: Id, name: optionalKey(String4) });
7628
+ var attended = { attended: Boolean2 };
7629
+ var RunStarter = Union([
7630
+ Struct({ kind: Literal("person"), userId: Id, ...attended }),
7631
+ Struct({
7632
+ kind: Literal("event"),
7633
+ eventId: Id,
7634
+ type: String4,
7635
+ payload: Record(String4, Json),
7636
+ whenClause: optionalKey(String4),
7637
+ ...attended
7638
+ }),
7639
+ Struct({ kind: Literal("schedule"), scheduleId: Id, eventId: Id, ...attended }),
7640
+ Struct({ kind: Literal("run"), runId: Id, ...attended })
7641
+ ]);
7642
+ var RunContext = Struct({
7643
+ task: optionalKey(Struct({
7644
+ id: Id,
7645
+ key: optionalKey(String4),
7646
+ title: optionalKey(String4),
7647
+ type: Struct({ id: Id, name: String4 }),
7648
+ outcome: optionalKey(TaskOutcome)
7649
+ })),
7650
+ project: optionalKey(Named),
7651
+ milestone: optionalKey(Named),
7652
+ team: optionalKey(Struct({ id: Id, key: String4, delivery: DeliveryMode })),
7653
+ repository: optionalKey(Struct({
7654
+ repoBinding: Struct({
7655
+ id: Id,
7656
+ provider: String4,
7657
+ host: String4,
7658
+ owner: String4,
7659
+ name: String4,
7660
+ pathPrefix: optionalKey(String4)
7661
+ }),
7662
+ defaultBranch: String4
7663
+ })),
7664
+ branch: optionalKey(String4),
7665
+ baseBranch: optionalKey(Struct({ branch: String4, layer: BaseBranchLayer })),
7666
+ startedBy: RunStarter,
7667
+ releaseTrigger: ResolvedReleaseTrigger,
7668
+ continuing: optionalKey(Continuing)
7669
+ });
7670
+
7122
7671
  // packages/core/src/work-unit.ts
7123
7672
  var WorkUnitLease = Struct({
7124
7673
  leaseOwnerId: Id,
@@ -7130,7 +7679,7 @@ var WorkUnitLease = Struct({
7130
7679
  leaseExpiresAt: Timestamp,
7131
7680
  lastHeartbeatAt: Timestamp
7132
7681
  });
7133
- var WorkUnitLeaseProjection = Struct(map9(WorkUnitLease.fields, optionalKey));
7682
+ var WorkUnitLeaseProjection = Struct(map10(WorkUnitLease.fields, optionalKey));
7134
7683
  var WorkUnitRepoBinding = Struct({
7135
7684
  id: Id,
7136
7685
  provider: RepoBindingProvider,
@@ -7169,6 +7718,31 @@ var SecretDestination = Struct({
7169
7718
  hosts: SecretHosts,
7170
7719
  version: String4.check(isMinLength(1), isMaxLength(128))
7171
7720
  });
7721
+ var CommitSha = String4.check(isPattern(/^[0-9a-fA-F]{7,64}$/));
7722
+ var ResolvedChange = Struct({
7723
+ revision: CommitSha,
7724
+ head: optionalKey(CommitSha),
7725
+ revert: optionalKey(Boolean2)
7726
+ });
7727
+ var RunnerAppliedChange = Union([
7728
+ Struct({ status: Literal("already") }),
7729
+ Struct({
7730
+ status: Literal("applied"),
7731
+ revision: String4.check(isPattern(/^[0-9a-f]{40,64}$/)),
7732
+ clean: Boolean2
7733
+ })
7734
+ ]);
7735
+ var CheckName = String4.check(isMinLength(1), isMaxLength(120), isPattern(new RegExp("^[A-Za-z0-9][A-Za-z0-9._:-]*$", "u")));
7736
+ var ApprovedCheck = Struct({
7737
+ name: CheckName,
7738
+ command: String4.check(isMinLength(1), isMaxLength(2000)),
7739
+ workingDirectory: optionalKey(String4.check(isMinLength(1), isMaxLength(500))),
7740
+ suggested: optionalKey(Boolean2)
7741
+ });
7742
+ var AfterMergeCommand = Struct({
7743
+ command: ApprovedCheck.fields.command,
7744
+ workingDirectory: ApprovedCheck.fields.workingDirectory
7745
+ });
7172
7746
  var AgentStepWorkUnit = Struct({
7173
7747
  kind: Literal("agent_step"),
7174
7748
  id: Id,
@@ -7191,6 +7765,8 @@ var AgentStepWorkUnit = Struct({
7191
7765
  secretDestinations: optionalKey(Record(String4, SecretDestination)),
7192
7766
  runBaseRevision: optionalKey(String4.check(isMinLength(1))),
7193
7767
  mergeTarget: optionalKey(String4.check(isMinLength(1))),
7768
+ applyChange: optionalKey(ResolvedChange),
7769
+ afterMerge: optionalKey(AfterMergeCommand),
7194
7770
  resumeNotes: optionalKey(ArraySchema(String4)),
7195
7771
  transcriptSequence: optionalKey(Int.check(isGreaterThanOrEqualTo(1))),
7196
7772
  storageOrigin: StorageOrigin
@@ -7206,6 +7782,7 @@ var OrchestrationWorkUnit = Struct({
7206
7782
  runId: Id,
7207
7783
  loopDigest: String4.check(isMinLength(64), isMaxLength(64), isPattern(new RegExp("^[a-f0-9]{64}$", "u"))),
7208
7784
  input: Unknown,
7785
+ context: optionalKey(RunContext),
7209
7786
  granted: ArraySchema(String4),
7210
7787
  lease: WorkUnitLease,
7211
7788
  journal: RunJournal,
@@ -7217,13 +7794,6 @@ var OrchestrationWorkUnit = Struct({
7217
7794
  })
7218
7795
  });
7219
7796
  var ProgramWorkUnit = OrchestrationWorkUnit.mapFields(omit(["program"]));
7220
- var CheckName = String4.check(isMinLength(1), isMaxLength(120), isPattern(new RegExp("^[A-Za-z0-9][A-Za-z0-9._:-]*$", "u")));
7221
- var ApprovedCheck = Struct({
7222
- name: CheckName,
7223
- command: String4.check(isMinLength(1), isMaxLength(2000)),
7224
- workingDirectory: optionalKey(String4.check(isMinLength(1), isMaxLength(500))),
7225
- suggested: optionalKey(Boolean2)
7226
- });
7227
7797
  var RepositoryCheck = Struct({
7228
7798
  ...ApprovedCheck.fields,
7229
7799
  pipeline: optionalKey(Boolean2),
@@ -7275,6 +7845,120 @@ var DeployOutcome = Struct({
7275
7845
  exitCode: optionalKey(Int),
7276
7846
  detail: String4.check(isMaxLength(1200))
7277
7847
  });
7848
+ var TagPrefix = String4.check(isMaxLength(60), isPattern(/^[A-Za-z0-9._/-]*$/u));
7849
+ var PrereleaseId = String4.check(isPattern(/^[0-9A-Za-z-]{1,40}$/u));
7850
+ var VersionsSpec = Struct({
7851
+ revision: optionalKey(String4.check(isMinLength(1), isMaxLength(240))),
7852
+ prerelease: optionalKey(PrereleaseId),
7853
+ prefix: optionalKey(TagPrefix),
7854
+ series: optionalKey(ArraySchema(String4.check(isMinLength(1), isMaxLength(240))).check(isMaxLength(10))),
7855
+ calver: optionalKey(CalverFormat)
7856
+ });
7857
+ var VersionTag = String4.check(isMinLength(1), isMaxLength(300));
7858
+ var BumpTags = Struct({
7859
+ major: optionalKey(VersionTag),
7860
+ minor: optionalKey(VersionTag),
7861
+ patch: optionalKey(VersionTag)
7862
+ });
7863
+ var TaggedVersion = Struct({
7864
+ tag: VersionTag,
7865
+ version: VersionTag,
7866
+ revision: String4.check(isMaxLength(240))
7867
+ });
7868
+ var TagVersions = Struct({
7869
+ revision: String4.check(isMinLength(1), isMaxLength(240)),
7870
+ previous: optionalKey(TaggedVersion),
7871
+ containedIn: optionalKey(TaggedVersion),
7872
+ next: BumpTags,
7873
+ taken: optionalKey(BumpTags),
7874
+ series: optionalKey(ArraySchema(Struct({ series: String4, highest: optionalKey(Int) })).check(isMaxLength(10)))
7875
+ });
7876
+ var CompareRevision = String4.check(isMinLength(1), isMaxLength(240));
7877
+ var FullCommitSha = String4.check(isPattern(new RegExp("^[0-9a-f]{40}([0-9a-f]{24})?$", "u")));
7878
+ var CompareSpec = Struct({ base: CompareRevision, head: CompareRevision });
7879
+ var compareCommitMax = 1e5;
7880
+ var CompareCommits = ArraySchema(FullCommitSha).check(isMaxLength(compareCommitMax));
7881
+ var commitMessageMax = { count: 1000, length: 2000 };
7882
+ var CommitMessages = ArraySchema(String4.check(isMaxLength(commitMessageMax.length))).check(isMaxLength(commitMessageMax.count));
7883
+ var HistorySide = Struct({
7884
+ commits: CompareCommits,
7885
+ firstParent: CompareCommits,
7886
+ messages: optionalKey(CommitMessages)
7887
+ });
7888
+ var CommitHistory = Struct({
7889
+ base: FullCommitSha,
7890
+ head: FullCommitSha,
7891
+ mergeBase: FullCommitSha,
7892
+ ahead: HistorySide,
7893
+ behind: HistorySide
7894
+ });
7895
+ var ComparedTask = Struct({
7896
+ id: String4,
7897
+ key: String4,
7898
+ title: String4,
7899
+ outcome: optionalKey(String4),
7900
+ labels: optionalKey(ArraySchema(String4))
7901
+ });
7902
+ var ComparedChange = Struct({
7903
+ id: String4,
7904
+ number: String4,
7905
+ title: String4,
7906
+ url: String4,
7907
+ mergedAt: String4,
7908
+ tasks: ArraySchema(ComparedTask)
7909
+ });
7910
+ var ComparedSide = Struct({
7911
+ commits: Int.check(isGreaterThanOrEqualTo(0)),
7912
+ changeRequests: ArraySchema(ComparedChange),
7913
+ unlinked: Int.check(isGreaterThanOrEqualTo(0)),
7914
+ messages: optionalKey(ArraySchema(String4))
7915
+ });
7916
+ var Comparison = Struct({
7917
+ base: FullCommitSha,
7918
+ head: FullCommitSha,
7919
+ mergeBase: FullCommitSha,
7920
+ ahead: ComparedSide,
7921
+ behind: ComparedSide,
7922
+ truncated: optionalKey(Literal(true))
7923
+ });
7924
+ var commandTimeoutMillisLimit = 3 * 60 * 60 * 1000;
7925
+ var commandTimeoutMillisDefault = 30 * 60 * 1000;
7926
+ var CommandEnvName = String4.check(isPattern(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/u));
7927
+ var CommandSpec = Struct({
7928
+ run: CheckName,
7929
+ args: optionalKey(ArraySchema(String4.check(isMaxLength(4000))).check(isMaxLength(100))),
7930
+ env: optionalKey(Record(CommandEnvName, String4.check(isMaxLength(4000)))),
7931
+ secrets: optionalKey(ArraySchema(SecretName).check(isMaxLength(50))),
7932
+ timeoutMillis: optionalKey(Int.check(isGreaterThanOrEqualTo(1000), isLessThanOrEqualTo(commandTimeoutMillisLimit)))
7933
+ });
7934
+ var CommandBranch = String4.check(isMinLength(1));
7935
+ var CommandLaunched = Struct({
7936
+ ...CommandSpec.fields,
7937
+ branch: optionalKey(CommandBranch),
7938
+ runBase: optionalKey(String4.check(isMinLength(1)))
7939
+ });
7940
+ var CommandWork = Struct({
7941
+ ...CommandLaunched.fields,
7942
+ command: ApprovedCheck.fields.command,
7943
+ workingDirectory: ApprovedCheck.fields.workingDirectory,
7944
+ secretValues: optionalKey(Record(String4, String4)),
7945
+ secretDestinations: optionalKey(Record(String4, SecretDestination)),
7946
+ findsOnly: optionalKey(Literal(true))
7947
+ });
7948
+ var commandTextLimit = 8000;
7949
+ var CommandText = String4.check(isMaxLength(commandTextLimit));
7950
+ var CommandResult = Union([
7951
+ Struct({
7952
+ status: Literal("exited"),
7953
+ exitCode: Int,
7954
+ lastLine: CommandText,
7955
+ outputTail: CommandText,
7956
+ durationMs: Int.check(isGreaterThanOrEqualTo(0)),
7957
+ logFileId: optionalKey(String4)
7958
+ }),
7959
+ Struct({ status: Literal("missing") }),
7960
+ Struct({ status: Literal("interrupted") })
7961
+ ]);
7278
7962
  var VerificationWorkUnit = Struct({
7279
7963
  kind: Literal("verification"),
7280
7964
  id: Id,
@@ -7289,6 +7973,9 @@ var VerificationWorkUnit = Struct({
7289
7973
  measure: optionalKey(MeasureSpec),
7290
7974
  resolve: optionalKey(ResolveSpec),
7291
7975
  deploy: optionalKey(DeployWork),
7976
+ versions: optionalKey(VersionsSpec),
7977
+ compare: optionalKey(CompareSpec),
7978
+ command: optionalKey(CommandWork),
7292
7979
  hosts: optionalKey(ArraySchema(NetworkHost)),
7293
7980
  storageOrigin: StorageOrigin
7294
7981
  });
@@ -7337,14 +8024,6 @@ var TreeEvidence = Struct({
7337
8024
  tree: String4.check(isMinLength(1), isMaxLength(120)),
7338
8025
  checks: ArraySchema(CheckEvidence).check(isMaxLength(50))
7339
8026
  });
7340
- var VerificationEvidence = Struct({
7341
- head: TreeEvidence,
7342
- baseline: optionalKey(TreeEvidence),
7343
- measurement: optionalKey(MeasureEvidence),
7344
- resolved: optionalKey(ResolvedRevisions),
7345
- deployed: optionalKey(DeployOutcome),
7346
- deployScriptFound: optionalKey(Literal(true))
7347
- });
7348
8027
  var BoundaryChange = Struct({
7349
8028
  kind: Literal("change"),
7350
8029
  changedPaths: ArraySchema(String4.check(isMinLength(1), isMaxLength(4096))).check(isMaxLength(1000)),
@@ -7357,6 +8036,19 @@ var BoundaryChange = Struct({
7357
8036
  })).check(isMaxLength(20)),
7358
8037
  truncated: Boolean2
7359
8038
  });
8039
+ var VerificationEvidence = Struct({
8040
+ head: TreeEvidence,
8041
+ baseline: optionalKey(TreeEvidence),
8042
+ measurement: optionalKey(MeasureEvidence),
8043
+ resolved: optionalKey(ResolvedRevisions),
8044
+ deployed: optionalKey(DeployOutcome),
8045
+ deployScriptFound: optionalKey(Literal(true)),
8046
+ versions: optionalKey(TagVersions),
8047
+ commanded: optionalKey(CommandResult),
8048
+ pushed: optionalKey(String4.check(isMinLength(1), isMaxLength(120))),
8049
+ boundary: optionalKey(BoundaryChange),
8050
+ history: optionalKey(CommitHistory)
8051
+ });
7360
8052
  var catchUpPathLimit = 200;
7361
8053
  var CatchUpPaths = ArraySchema(String4.check(isMinLength(1), isMaxLength(1000))).check(isMaxLength(catchUpPathLimit));
7362
8054
  var Revision = String4.check(isPattern(/^[0-9a-f]{40,64}$/));
@@ -7388,6 +8080,7 @@ var WorkUnitOutcome = Struct({
7388
8080
  catchUp: optionalKey(CatchUp),
7389
8081
  syncedTarget: optionalKey(Revision),
7390
8082
  cleanSync: optionalKey(Literals(["up_to_date", "merged"])),
8083
+ appliedChange: optionalKey(RunnerAppliedChange),
7391
8084
  harnessHold: optionalKey(HarnessHold),
7392
8085
  restart: optionalKey(StepRestart),
7393
8086
  tokens: optionalKey(AttemptTokens),
@@ -7667,7 +8360,11 @@ var RunnerCapabilities = Struct({
7667
8360
  resourceLimits: optionalKey(RunnerResourceLimits),
7668
8361
  measure: optionalKey(Boolean2),
7669
8362
  resolve: optionalKey(Boolean2),
7670
- deploy: optionalKey(Boolean2)
8363
+ deploy: optionalKey(Boolean2),
8364
+ versions: optionalKey(Boolean2),
8365
+ compare: optionalKey(Boolean2),
8366
+ command: optionalKey(Boolean2),
8367
+ applyChange: optionalKey(Boolean2)
7671
8368
  });
7672
8369
  var MaxRunnerConcurrency = 32;
7673
8370
  var PinnedImage = String4.check(isMaxLength(500), isPattern(new RegExp("^[^\\s@]+@sha256:[a-f0-9]{64}$", "u")));
@@ -8486,32 +9183,6 @@ function deliveryProviderActions(providerActions, delivery) {
8486
9183
  release: posture("release")
8487
9184
  };
8488
9185
  }
8489
- // packages/core/src/team-context.ts
8490
- var BranchTemplate = String4.check(isMinLength(1), isMaxLength(160));
8491
- var DeliveryMode = Literals(["gated", "auto"]);
8492
- var HoursPerPriorityLevel = Int.check(isGreaterThanOrEqualTo(1), isLessThanOrEqualTo(168));
8493
- var TeamDeliverySettings = Struct({
8494
- defaultRepoBindingId: optionalKey(Id),
8495
- standardBranchTemplate: BranchTemplate,
8496
- epicBranchTemplate: BranchTemplate,
8497
- isolatedChildBranchTemplate: BranchTemplate,
8498
- delivery: DeliveryMode,
8499
- hoursPerPriorityLevel: HoursPerPriorityLevel,
8500
- agentsStateScope: Boolean2,
8501
- revision: Int.check(isGreaterThanOrEqualTo(1))
8502
- });
8503
- var TeamDeliverySettingsUpdate = Struct({
8504
- defaultRepoBindingId: optionalKey(Union([Id, Null])),
8505
- standardBranchTemplate: optionalKey(BranchTemplate),
8506
- epicBranchTemplate: optionalKey(BranchTemplate),
8507
- isolatedChildBranchTemplate: optionalKey(BranchTemplate),
8508
- delivery: optionalKey(DeliveryMode),
8509
- hoursPerPriorityLevel: optionalKey(HoursPerPriorityLevel),
8510
- agentsStateScope: optionalKey(Boolean2),
8511
- expectedRevision: Int.check(isGreaterThanOrEqualTo(1))
8512
- });
8513
- var TeamReference = Struct({ id: Id, workspaceId: Id, key: String4, name: String4 });
8514
- var TeamReferenceList = Struct({ items: ArraySchema(TeamReference) });
8515
9186
  // packages/core/src/memory.ts
8516
9187
  var MemoryStatuses = ["proposed", "accepted", "rejected", "deprecated"];
8517
9188
  var MemoryStatus = Union([
@@ -9683,6 +10354,62 @@ class RunnerArtifactTrustError extends TaggedError("RunnerArtifactTrustError") {
9683
10354
  function sha2562(value) {
9684
10355
  return createHash("sha256").update(value, "utf8").digest("hex");
9685
10356
  }
10357
+ // packages/core/src/deploy.ts
10358
+ var DeployTargetName = String4.check(isMinLength(1), isMaxLength(100), isPattern(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/u));
10359
+ var DeployRef = String4.check(isPattern(/\S/u));
10360
+ var DeployStatuses = ["deployed", "failed", "rolled_back", "rollback_failed"];
10361
+ var DeployStatus = Literals(DeployStatuses);
10362
+ var RunningDeployStatuses = ["deployed", "rolled_back"];
10363
+ var runsDeployedTag = (status) => RunningDeployStatuses.some((running) => running === status);
10364
+ var successWords = new Set(["success", "succeeded", "successful", "passed", "ok"]);
10365
+ var failureWords = new Set([
10366
+ "failure",
10367
+ "error",
10368
+ "errored",
10369
+ "cancelled",
10370
+ "canceled",
10371
+ "aborted",
10372
+ "timed_out",
10373
+ "timeout"
10374
+ ]);
10375
+ var DeploySource = Literals(["run", "event"]);
10376
+ var Deploy = Struct({
10377
+ id: String4,
10378
+ workspaceId: String4,
10379
+ teamId: optionalKey(String4),
10380
+ repoBindingId: String4,
10381
+ repository: String4,
10382
+ target: String4,
10383
+ tag: String4,
10384
+ revision: optionalKey(String4),
10385
+ status: DeployStatus,
10386
+ detail: optionalKey(String4),
10387
+ source: DeploySource,
10388
+ runId: optionalKey(String4),
10389
+ eventId: optionalKey(String4),
10390
+ deployedAt: Timestamp
10391
+ });
10392
+ var DeployList = Struct({ items: ArraySchema(Deploy) });
10393
+ var DeployTargetRunning = Struct({
10394
+ tag: String4,
10395
+ revision: optionalKey(String4),
10396
+ since: Timestamp
10397
+ });
10398
+ var DeployTargetState = Struct({
10399
+ target: String4,
10400
+ listed: Boolean2,
10401
+ running: optionalKey(DeployTargetRunning),
10402
+ latest: optionalKey(Deploy)
10403
+ });
10404
+ var DeployTargets = Struct({
10405
+ repoBindingId: String4,
10406
+ repository: String4,
10407
+ order: ArraySchema(String4),
10408
+ targets: ArraySchema(DeployTargetState)
10409
+ });
10410
+ var DeployTargetsUpdate = Struct({
10411
+ targets: ArraySchema(DeployTargetName).check(isMaxLength(50))
10412
+ });
9686
10413
  // packages/core/src/storage.ts
9687
10414
  var units = ["B", "KiB", "MiB", "GiB", "TiB"];
9688
10415
  var formatBytes = (bytes) => {
@@ -9840,8 +10567,6 @@ var StepRunFileRequest = Struct({
9840
10567
  sha256: String4.check(isPattern(/^[0-9a-f]{64}$/))
9841
10568
  });
9842
10569
  var RunFileSlotted = Struct({ file: RunFileRecord, upload: optionalKey(RunFileUpload) });
9843
- // packages/core/src/run-launch.ts
9844
- var repositoryKey = (url) => url.trim().toLowerCase().replace(/^[a-z+]+:\/\//, "").replace(/^[^@/]+@/, "").replace(/^([^/:]+):(?!\d+\/)/, "$1/").replace(/^([^/:]+):\d+\//, "$1/").replace(/\.git$/, "").replace(/\/+$/, "");
9845
10570
  // packages/core/src/resource-claim.ts
9846
10571
  var ResourceName = String4.check(isPattern(/^[a-z0-9][a-z0-9._:-]*$/u), isMinLength(1), isMaxLength(128));
9847
10572
  var ClaimHolder = Struct({
@@ -9860,20 +10585,35 @@ var ClaimResult = Union([
9860
10585
  }),
9861
10586
  Struct({ status: Literal("kept"), resource: ResourceName, holder: ClaimHolder })
9862
10587
  ]);
10588
+ var ResourceHold = Struct({
10589
+ actorType: String4,
10590
+ actorId: String4,
10591
+ name: optionalKey(String4),
10592
+ reason: String4,
10593
+ heldAt: Timestamp,
10594
+ letThrough: ArraySchema(Id)
10595
+ });
9863
10596
  var ResourceClaim = Struct({
9864
10597
  resource: ResourceName,
9865
- runId: Id,
9866
- loopId: String4,
9867
- runStatus: RunStatus,
9868
- claimedAt: Timestamp,
10598
+ runId: optionalKey(Id),
10599
+ loopId: optionalKey(String4),
10600
+ runStatus: optionalKey(RunStatus),
10601
+ claimedAt: optionalKey(Timestamp),
9869
10602
  keptAt: optionalKey(Timestamp),
9870
10603
  keptReason: optionalKey(String4),
10604
+ heldBy: optionalKey(ResourceHold),
9871
10605
  waiting: ArraySchema(Id)
9872
10606
  });
9873
10607
  var ResourceClaimList = Struct({ items: ArraySchema(ResourceClaim) });
9874
10608
  var ClaimRelease = Struct({
9875
10609
  reason: String4.check(isMinLength(1), isMaxLength(500))
9876
10610
  });
10611
+ var ClaimHoldInput = Struct({
10612
+ reason: String4.check(isMinLength(1), isMaxLength(500))
10613
+ });
10614
+ var MergeThrough = Struct({ resource: ResourceName, changeRequestId: Id });
10615
+ var mergeTurnResource = (repoBindingId, branch) => resourceNameOf(`merge:${repoBindingId === undefined ? "" : `${repoBindingId}:`}${branch}`);
10616
+ var resourceNameOf = (name) => name.toLowerCase().replace(/[^a-z0-9._:-]+/g, "-").slice(0, 128);
9877
10617
  // packages/core/src/id.ts
9878
10618
  import { v7 as uuidv7 } from "uuid";
9879
10619
  function createId() {
@@ -9905,6 +10645,85 @@ function sha256Hasher() {
9905
10645
  digest: (encoding) => hash.digest(encoding)
9906
10646
  };
9907
10647
  }
10648
+ // packages/core/src/schedule.ts
10649
+ var ScheduleFrequency = ["daily", "weekly"];
10650
+ var ScheduleMisfirePolicies = ["skip", "fire_once", "catch_up"];
10651
+ var ScheduleOverlapPolicies = ["allow", "skip", "coalesce"];
10652
+ var ScheduleVersionStatuses = ["draft", "published", "disabled", "archived"];
10653
+ var ScheduleCalendarRule = Struct({
10654
+ frequency: Literals(ScheduleFrequency),
10655
+ hour: Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(23)),
10656
+ minute: Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(59)),
10657
+ second: optionalKey(Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(59))),
10658
+ daysOfWeek: optionalKey(ArraySchema(Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(6))).check(isMinLength(1), isMaxLength(7)))
10659
+ });
10660
+ var ScheduleCronRule = Struct({
10661
+ cron: String4.check(isMinLength(9), isMaxLength(200), isPattern(new RegExp("^[0-9*,/-]+( [0-9*,/-]+){4}$", "u")))
10662
+ });
10663
+ var ScheduleRule = Union([ScheduleCalendarRule, ScheduleCronRule]);
10664
+ var cronBounds = [
10665
+ [0, 59],
10666
+ [0, 23],
10667
+ [1, 31],
10668
+ [1, 12],
10669
+ [0, 7]
10670
+ ];
10671
+ function cronField(field, [min, max]) {
10672
+ const values = new Set;
10673
+ for (const part of field.split(",")) {
10674
+ const match = /^(\*|(\d+)(?:-(\d+))?)(?:\/(\d+))?$/.exec(part);
10675
+ if (match === null)
10676
+ return;
10677
+ const from = match[1] === "*" ? min : Number(match[2]);
10678
+ const to = match[1] === "*" ? max : match[3] === undefined ? match[4] === undefined ? from : max : Number(match[3]);
10679
+ const step = match[4] === undefined ? 1 : Number(match[4]);
10680
+ if (from < min || to > max || from > to || step < 1)
10681
+ return;
10682
+ for (let value = from;value <= to; value += step)
10683
+ values.add(value);
10684
+ }
10685
+ return values;
10686
+ }
10687
+ function parseCron(cron) {
10688
+ const fields = cron.split(" ");
10689
+ const [minutes, hours, days, months, weekdays] = fields.map((field, index) => cronField(field, cronBounds[index] ?? [0, 0]));
10690
+ if (fields.length !== 5 || !minutes || !hours || !days || !months || !weekdays)
10691
+ return;
10692
+ return {
10693
+ minutes,
10694
+ hours,
10695
+ days,
10696
+ months,
10697
+ weekdays: new Set([...weekdays].map((value) => value % 7)),
10698
+ dayRestricted: !(fields[2] ?? "").startsWith("*"),
10699
+ weekdayRestricted: !(fields[4] ?? "").startsWith("*")
10700
+ };
10701
+ }
10702
+ function isScheduleRule(value) {
10703
+ return guard(ScheduleRule)(value) && (!("cron" in value) || parseCron(value.cron) !== undefined);
10704
+ }
10705
+ var ScheduleVersion = Struct({
10706
+ contractVersion: Literal("schedule.v1"),
10707
+ id: String4.check(isMinLength(1)),
10708
+ scheduleId: String4.check(isMinLength(1)),
10709
+ workspaceId: String4.check(isMinLength(1)),
10710
+ teamId: optionalKey(String4.check(isMinLength(1))),
10711
+ loopId: optionalKey(String4.check(isMinLength(1))),
10712
+ name: optionalKey(String4.check(isMinLength(1), isMaxLength(200))),
10713
+ version: Int.check(isGreaterThanOrEqualTo(1)),
10714
+ status: Literals(ScheduleVersionStatuses),
10715
+ timezone: String4.check(isMinLength(1), isMaxLength(80)),
10716
+ rule: ScheduleRule,
10717
+ misfirePolicy: Literals(ScheduleMisfirePolicies),
10718
+ overlapPolicy: Literals(ScheduleOverlapPolicies),
10719
+ maxCatchUp: Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(200)),
10720
+ misfireGraceSeconds: optionalKey(Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(604800))),
10721
+ inputSchemaRef: optionalKey(LoopDataSchemaRef),
10722
+ input: optionalKey(SafeJson),
10723
+ createdAt: String4.check(isMinLength(1))
10724
+ });
10725
+ var zones = new Map;
10726
+ var resolvedLocalDateTimes = new Map;
9908
10727
  // packages/core/src/transcript.ts
9909
10728
  var Text = String4.check(isMaxLength(200000));
9910
10729
  var AgentEvent = Union([
@@ -9987,11 +10806,11 @@ var TranscriptSearchResult = Struct({
9987
10806
  total: Int
9988
10807
  });
9989
10808
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/http/HttpBody.js
9990
- var TypeId9 = "~effect/http/HttpBody";
10809
+ var TypeId8 = "~effect/http/HttpBody";
9991
10810
  class Proto5 {
9992
- [TypeId9];
10811
+ [TypeId8];
9993
10812
  constructor() {
9994
- this[TypeId9] = TypeId9;
10813
+ this[TypeId8] = TypeId8;
9995
10814
  }
9996
10815
  [NodeInspectSymbol]() {
9997
10816
  return this.toJSON();
@@ -10082,7 +10901,7 @@ var jsonUnsafe = (body, contentType) => text(JSON.stringify(body), contentType ?
10082
10901
  var urlParams = (urlParams, contentType) => text(toString(fromInput2(urlParams)), contentType ?? "application/x-www-form-urlencoded");
10083
10902
 
10084
10903
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/http/HttpClientError.js
10085
- var TypeId10 = "~effect/http/HttpClientError";
10904
+ var TypeId9 = "~effect/http/HttpClientError";
10086
10905
  class HttpClientError extends (/* @__PURE__ */ TaggedError("HttpClientError")) {
10087
10906
  constructor(props) {
10088
10907
  if ("cause" in props.reason) {
@@ -10094,7 +10913,7 @@ class HttpClientError extends (/* @__PURE__ */ TaggedError("HttpClientError")) {
10094
10913
  super(props);
10095
10914
  }
10096
10915
  }
10097
- [TypeId10] = TypeId10;
10916
+ [TypeId9] = TypeId9;
10098
10917
  get request() {
10099
10918
  return this.reason.request;
10100
10919
  }
@@ -10198,7 +11017,7 @@ class EmptyBodyError extends (/* @__PURE__ */ TaggedError("EmptyBodyError")) {
10198
11017
  }
10199
11018
  }
10200
11019
 
10201
- class HttpClientErrorSchema extends (/* @__PURE__ */ Error3(TypeId10)({
11020
+ class HttpClientErrorSchema extends (/* @__PURE__ */ Error3(TypeId9)({
10202
11021
  _tag: /* @__PURE__ */ tag("HttpError"),
10203
11022
  kind: /* @__PURE__ */ Literals(["EncodeError", "DecodeError", "TransportError", "InvalidUrlError", "StatusCodeError", "EmptyBodyError"]),
10204
11023
  cause: /* @__PURE__ */ optional(/* @__PURE__ */ Defect())
@@ -10231,7 +11050,7 @@ var updateContentLength = (headers, body) => {
10231
11050
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/http/Url.js
10232
11051
  class UrlError extends (/* @__PURE__ */ TaggedError("UrlError")) {
10233
11052
  }
10234
- var make27 = (url, params, hash) => try_({
11053
+ var make26 = (url, params, hash) => try_({
10235
11054
  try: () => {
10236
11055
  const urlInstance = new URL(url, baseUrl());
10237
11056
  for (let i = 0;i < params.params.length; i++) {
@@ -10262,10 +11081,10 @@ var baseUrl = () => {
10262
11081
  };
10263
11082
 
10264
11083
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/http/HttpClientRequest.js
10265
- var TypeId11 = "~effect/http/HttpClientRequest";
10266
- var isHttpClientRequest = (u) => hasProperty(u, TypeId11);
11084
+ var TypeId10 = "~effect/http/HttpClientRequest";
11085
+ var isHttpClientRequest = (u) => hasProperty(u, TypeId10);
10267
11086
  var Proto6 = {
10268
- [TypeId11]: TypeId11,
11087
+ [TypeId10]: TypeId10,
10269
11088
  ...BaseProto,
10270
11089
  toJSON() {
10271
11090
  return {
@@ -10354,7 +11173,7 @@ var bodyUint8Array = /* @__PURE__ */ dual((args) => isHttpClientRequest(args[0])
10354
11173
  var bodyJsonUnsafe = /* @__PURE__ */ dual(2, (self, body) => setBody(self, jsonUnsafe(body)));
10355
11174
  var bodyUrlParams = /* @__PURE__ */ dual(2, (self, input) => setBody(self, urlParams(fromInput2(input))));
10356
11175
  function toUrl(self) {
10357
- const r = make27(self.url, self.urlParams, getOrUndefined(self.hash));
11176
+ const r = make26(self.url, self.urlParams, getOrUndefined(self.hash));
10358
11177
  if (isSuccess(r)) {
10359
11178
  return some(r.success);
10360
11179
  }
@@ -10362,7 +11181,7 @@ function toUrl(self) {
10362
11181
  }
10363
11182
 
10364
11183
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/http/HttpIncomingMessage.js
10365
- var TypeId12 = "~effect/http/HttpIncomingMessage";
11184
+ var TypeId11 = "~effect/http/HttpIncomingMessage";
10366
11185
  var schemaBodyJson = (schema, options) => {
10367
11186
  const decode = decodeEffect(toCodecJson(schema));
10368
11187
  const decodeJson = options?.reviver === undefined ? undefined : decodeEffect(fromJsonString(toCodecJson(schema), options));
@@ -10381,7 +11200,7 @@ var WebSourceSymbol = "~effect/http/HttpClientResponse/WebSource";
10381
11200
  var getWebSource = (self) => self[WebSourceSymbol]?.();
10382
11201
 
10383
11202
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/http/HttpClientResponse.js
10384
- var TypeId13 = "~effect/http/HttpClientResponse";
11203
+ var TypeId12 = "~effect/http/HttpClientResponse";
10385
11204
  var fromWeb = (request, source) => new WebHttpClientResponse(request, source);
10386
11205
  var filterStatusOk = (self) => self.status >= 200 && self.status < 300 ? succeed6(self) : fail7(new HttpClientError({
10387
11206
  reason: new StatusCodeError({
@@ -10392,16 +11211,16 @@ var filterStatusOk = (self) => self.status >= 200 && self.status < 300 ? succeed
10392
11211
  }));
10393
11212
 
10394
11213
  class WebHttpClientResponse extends Class {
11214
+ [TypeId11];
10395
11215
  [TypeId12];
10396
- [TypeId13];
10397
11216
  request;
10398
11217
  source;
10399
11218
  constructor(request, source) {
10400
11219
  super();
10401
11220
  this.request = request;
10402
11221
  this.source = source;
11222
+ this[TypeId11] = TypeId11;
10403
11223
  this[TypeId12] = TypeId12;
10404
- this[TypeId13] = TypeId13;
10405
11224
  }
10406
11225
  toJSON() {
10407
11226
  return inspect(this, {
@@ -10470,7 +11289,7 @@ class WebHttpClientResponse extends Class {
10470
11289
  }
10471
11290
  textBody;
10472
11291
  get text() {
10473
- return this.textBody ??= map8(this.arrayBuffer, (_) => new TextDecoder().decode(_));
11292
+ return this.textBody ??= map9(this.arrayBuffer, (_) => new TextDecoder().decode(_));
10474
11293
  }
10475
11294
  get urlParamsBody() {
10476
11295
  return flatMap3(this.arrayBuffer, (bytes) => try_2({
@@ -10573,7 +11392,7 @@ var addHeaderAttributes = (span, phase, headers, filter, redactedNames) => {
10573
11392
  };
10574
11393
 
10575
11394
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/http/HttpClient.js
10576
- var TypeId14 = "~effect/http/HttpClient";
11395
+ var TypeId13 = "~effect/http/HttpClient";
10577
11396
  var HttpClient = /* @__PURE__ */ Service2("effect/HttpClient");
10578
11397
  var accessor = (method) => (...args) => flatMap3(HttpClient, (client) => client[method](...args));
10579
11398
  var execute = /* @__PURE__ */ accessor("execute");
@@ -10590,7 +11409,7 @@ var makeWith2 = (postprocess, preprocess) => {
10590
11409
  return self;
10591
11410
  };
10592
11411
  var Proto7 = {
10593
- [TypeId14]: TypeId14,
11412
+ [TypeId13]: TypeId13,
10594
11413
  pipe() {
10595
11414
  return pipeArguments(this, arguments);
10596
11415
  },
@@ -10604,10 +11423,10 @@ var Proto7 = {
10604
11423
  return this.execute(make5(fullMethod)(url, options));
10605
11424
  }]))
10606
11425
  };
10607
- var make28 = (f) => makeWith2((effect) => flatMap3(effect, (request) => withFiber2((fiber) => {
11426
+ var make27 = (f) => makeWith2((effect) => flatMap3(effect, (request) => withFiber2((fiber) => {
10608
11427
  const scopedController = scopedRequests.get(request);
10609
11428
  const controller = scopedController ?? new AbortController;
10610
- const urlResult = make27(request.url, request.urlParams, getOrUndefined(request.hash));
11429
+ const urlResult = make26(request.url, request.urlParams, getOrUndefined(request.hash));
10611
11430
  if (isFailure(urlResult)) {
10612
11431
  return fail7(new HttpClientError({
10613
11432
  reason: new InvalidUrlError({
@@ -10621,7 +11440,7 @@ var make28 = (f) => makeWith2((effect) => flatMap3(effect, (request) => withFibe
10621
11440
  if (tracerDisabled) {
10622
11441
  const effect = f(request, url, controller.signal, fiber);
10623
11442
  if (scopedController)
10624
- return map8(effect, (response) => trackResponse(response, controller, true));
11443
+ return map9(effect, (response) => trackResponse(response, controller, true));
10625
11444
  return uninterruptibleMask2((restore) => matchCauseEffect(restore(effect), {
10626
11445
  onSuccess(response) {
10627
11446
  return succeed6(trackResponse(response, controller, false));
@@ -10692,7 +11511,7 @@ var TracerPropagationEnabled = /* @__PURE__ */ Reference("effect/http/HttpClient
10692
11511
  var SpanNameGenerator = /* @__PURE__ */ Reference("effect/http/HttpClient/SpanNameGenerator", {
10693
11512
  defaultValue: () => (request) => request.method
10694
11513
  });
10695
- var layerMergedContext = (effect2) => effect(HttpClient)(contextWith((context) => map8(effect2, (client) => transformResponse(client, updateContext((input) => merge3(context, input))))));
11514
+ var layerMergedContext = (effect2) => effect(HttpClient)(contextWith((context) => map9(effect2, (client) => transformResponse(client, updateContext((input) => merge3(context, input))))));
10696
11515
  var responseRegistry = /* @__PURE__ */ (() => {
10697
11516
  if ("FinalizationRegistry" in globalThis && globalThis.FinalizationRegistry) {
10698
11517
  const registry = /* @__PURE__ */ new FinalizationRegistry((controller) => {
@@ -10741,8 +11560,8 @@ class InterruptibleResponse {
10741
11560
  this.original = original;
10742
11561
  this.controller = controller;
10743
11562
  }
10744
- [TypeId13] = TypeId13;
10745
11563
  [TypeId12] = TypeId12;
11564
+ [TypeId11] = TypeId11;
10746
11565
  applyInterrupt(effect) {
10747
11566
  return suspend3(() => {
10748
11567
  responseRegistry.unregister(this.original);
@@ -10840,7 +11659,7 @@ var detectStreamBodySupport = () => {
10840
11659
  return false;
10841
11660
  }
10842
11661
  };
10843
- var fetch2 = /* @__PURE__ */ make28((request, url, signal, fiber) => {
11662
+ var fetch2 = /* @__PURE__ */ make27((request, url, signal, fiber) => {
10844
11663
  if (request.headers.upgrade !== undefined) {
10845
11664
  return fail7(new HttpClientError({
10846
11665
  reason: new TransportError({
@@ -10857,7 +11676,7 @@ var fetch2 = /* @__PURE__ */ make28((request, url, signal, fiber) => {
10857
11676
  }
10858
11677
  let uploadController;
10859
11678
  const stopUpload = sync2(() => uploadController?.abort());
10860
- const send = (body) => map8(tryPromise({
11679
+ const send = (body) => map9(tryPromise({
10861
11680
  try: () => fetch2(url, {
10862
11681
  ...options,
10863
11682
  method: request.method,
@@ -10931,10 +11750,10 @@ var fetch2 = /* @__PURE__ */ make28((request, url, signal, fiber) => {
10931
11750
  });
10932
11751
  var layer4 = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed6(fetch2));
10933
11752
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/socket/Socket.js
10934
- var TypeId15 = "~effect/socket/Socket";
11753
+ var TypeId14 = "~effect/socket/Socket";
10935
11754
  var Socket = /* @__PURE__ */ Service2("effect/socket/Socket");
10936
- var make29 = (options) => Socket.of({
10937
- [TypeId15]: TypeId15,
11755
+ var make28 = (options) => Socket.of({
11756
+ [TypeId14]: TypeId14,
10938
11757
  reader: options.reader,
10939
11758
  writer: options.writer
10940
11759
  });
@@ -11028,7 +11847,7 @@ var layerWebSocketConstructorGlobal = /* @__PURE__ */ succeed5(WebSocketConstruc
11028
11847
  }
11029
11848
  return new globalThis.WebSocket(url, options);
11030
11849
  });
11031
- var makeWebSocket = (url, options) => WebSocketConstructor.use((makeWs) => fromWebSocket(acquireRelease((typeof url === "string" ? succeed6(url) : url).pipe(map8((url) => makeWs(url, options?.headers === undefined ? options?.protocols : {
11850
+ var makeWebSocket = (url, options) => WebSocketConstructor.use((makeWs) => fromWebSocket(acquireRelease((typeof url === "string" ? succeed6(url) : url).pipe(map9((url) => makeWs(url, options?.headers === undefined ? options?.protocols : {
11032
11851
  protocols: options.protocols,
11033
11852
  headers: options.headers
11034
11853
  }))), (ws) => sync2(() => ws.close(1000))), options));
@@ -11257,7 +12076,7 @@ var fromWebSocket = (acquire, options) => withFiber2((fiber) => {
11257
12076
  write,
11258
12077
  writeAll
11259
12078
  });
11260
- return succeed6(make29({
12079
+ return succeed6(make28({
11261
12080
  reader,
11262
12081
  writer
11263
12082
  }));
@@ -11663,7 +12482,7 @@ var effectMetrics = new Map(MetricDefinitions.map((definition) => {
11663
12482
  var processTelemetryRegistry = new Map;
11664
12483
  var processMetricRegistry = new Map;
11665
12484
  var collectorTimeout = "10 seconds";
11666
- var collectorHttpClient = effect(HttpClient)(map8(HttpClient, (client) => transform(client, (response, request) => timeoutOrElse(response, {
12485
+ var collectorHttpClient = effect(HttpClient)(map9(HttpClient, (client) => transform(client, (response, request) => timeoutOrElse(response, {
11667
12486
  duration: collectorTimeout,
11668
12487
  orElse: () => fail7(new HttpClientError({
11669
12488
  reason: new TransportError({
@@ -11704,6 +12523,60 @@ var choiceWords = (choice, unnamedModel) => [
11704
12523
  ...choice.effort === undefined ? [] : [`${choice.effort} effort`]
11705
12524
  ].join(" \xB7 ");
11706
12525
  var stepFallbackWords = (fallback) => `Fallback: ${choiceWords(fallback, "model not reported")}. First choice ${choiceWords(fallback.firstChoice, "its Harness\u2019s default model")}: ${skippedReasonWords[fallback.firstChoice.reason]}`;
12526
+ // packages/core/src/run-tickets.ts
12527
+ var RunVisitRecord = Struct({
12528
+ payload: Json,
12529
+ outcome: String4,
12530
+ result: optionalKey(Json),
12531
+ error: optionalKey(Json)
12532
+ });
12533
+ var FiledTickets = Struct({
12534
+ tickets: ArraySchema(Struct({
12535
+ key: String4,
12536
+ title: String4,
12537
+ blockedBy: ArraySchema(String4),
12538
+ repoBindingId: optional(NullOr(String4))
12539
+ }))
12540
+ });
12541
+ var decodeFiled = decodeUnknownOption(FiledTickets);
12542
+ var decodeText2 = decodeOption(fromJsonString(Json));
12543
+ var decodePartCount = decodeUnknownOption(Struct({ ticketsParts: Int }));
12544
+ var choseUnfiled = is(Struct({ filed: Literal(false) }));
12545
+ var isFailedSkip = is(Struct({ failed: Literal(true) }));
12546
+ var isVisitOf = (called, name) => name === called || name.startsWith(`${called}#`);
12547
+ var partPrefix = "step//";
12548
+ var partName = (visit, index) => `${partPrefix}${visit}/${index}`;
12549
+ var codePointsPerPart = /.{1,60000}/gsu;
12550
+ var runTicketsPayload = (visit, payload) => {
12551
+ const filed = isVisitOf("filed", visit) ? getOrUndefined(decodeFiled(payload)) : undefined;
12552
+ const texts = filed === undefined ? [] : JSON.stringify(filed).match(codePointsPerPart) ?? [];
12553
+ return {
12554
+ kept: {
12555
+ ...choseUnfiled(payload) ? { filed: false } : undefined,
12556
+ ...texts.length === 0 ? undefined : { ticketsParts: texts.length }
12557
+ },
12558
+ parts: texts.map((text, index) => ({ name: partName(visit, index + 1), text }))
12559
+ };
12560
+ };
12561
+ var runTicketResult = (result) => isFailedSkip(result) ? { failed: true } : {};
12562
+ var ticketOutcomeLabels = { merged: "Merged", failed: "Failed", skipped: "Skipped" };
12563
+ var startOf2 = (entries) => Math.min(...entries.map((entry) => entry.startedAt === undefined ? Number.POSITIVE_INFINITY : Date.parse(entry.startedAt)));
12564
+ var runGraphLayout = (graph) => {
12565
+ const { columns, waves = [] } = graph;
12566
+ const folded = new Set(waves.flat().flatMap((ticket) => ticket.steps));
12567
+ const placed = columns.flatMap((column) => {
12568
+ const nodes = column.filter((node) => !folded.has(node.id));
12569
+ return nodes.length === 0 ? [] : [{ at: startOf2(nodes), column: { kind: "steps", nodes } }];
12570
+ });
12571
+ let reachedAt = Number.POSITIVE_INFINITY;
12572
+ const inWaves = waves.map((tickets, index) => {
12573
+ const start = startOf2(tickets);
12574
+ if (Number.isFinite(start))
12575
+ reachedAt = start;
12576
+ return { at: reachedAt, column: { kind: "wave", wave: index + 1, tickets } };
12577
+ });
12578
+ return [...placed, ...inWaves].toSorted((left, right) => left.at === right.at ? 0 : left.at - right.at).map((entry) => entry.column);
12579
+ };
11707
12580
  // packages/core/src/kit.ts
11708
12581
  var KitName = String4.check(isMinLength(1), isMaxLength(214), isPattern(new RegExp("^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$", "u")));
11709
12582
  var KitDigest = String4.check(isPattern(new RegExp("^[a-f0-9]{64}$", "u")));
@@ -11843,6 +12716,164 @@ var DeployBindingCreate = Struct({
11843
12716
  });
11844
12717
  var DeployBindingList = Struct({ items: ArraySchema(DeployBinding) });
11845
12718
  var defaultKitName = "@kitman-sh/software-engineering";
12719
+
12720
+ // packages/core/src/kit-declarations.ts
12721
+ var LoopCapabilities = [
12722
+ "agent_work",
12723
+ "ask",
12724
+ "call",
12725
+ "verify",
12726
+ "change_request",
12727
+ "write_back",
12728
+ "post_comment",
12729
+ "create_tasks",
12730
+ "create_branch",
12731
+ "merge_change_request",
12732
+ "approve_change_request",
12733
+ "publish_release",
12734
+ "read_transcripts",
12735
+ "read_change_request",
12736
+ "measure",
12737
+ "claim",
12738
+ "propose",
12739
+ "read_project",
12740
+ "draft_update",
12741
+ "run_command"
12742
+ ];
12743
+ var LoopRoles = ["review", "release"];
12744
+ var JsonObject2 = Record(String4, Json);
12745
+ var SecretName2 = String4.check(isPattern(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/));
12746
+ var EventFilterValue = Union([String4, Finite, Boolean2, Null]);
12747
+ var WhenClauseName = String4.check(isPattern(/^[a-z0-9]+(?:-[a-z0-9]+)*$/));
12748
+ var WhenClause = Struct({
12749
+ name: optionalKey(WhenClauseName),
12750
+ event: String4,
12751
+ filter: optionalKey(Record(String4, Union([EventFilterValue, ArraySchema(EventFilterValue)]))),
12752
+ input: Record(String4, String4),
12753
+ values: optionalKey(JsonObject2),
12754
+ optIn: optionalKey(Boolean2),
12755
+ description: optionalKey(String4)
12756
+ });
12757
+ var LoopManifest = Struct({
12758
+ id: String4,
12759
+ title: String4,
12760
+ version: optionalKey(LoopVersion),
12761
+ description: optionalKey(LoopDescription),
12762
+ input: JsonObject2,
12763
+ output: JsonObject2,
12764
+ outcome: optionalKey(TaskOutcome),
12765
+ role: optionalKey(Literals(LoopRoles)),
12766
+ agents: Record(String4, String4),
12767
+ checkout: Literals(["none", "read", "write"]),
12768
+ when: ArraySchema(WhenClause),
12769
+ offers: ArraySchema(Struct({
12770
+ id: String4,
12771
+ title: String4,
12772
+ loop: String4,
12773
+ from: optionalKey(String4)
12774
+ })),
12775
+ capabilities: ArraySchema(Literals(LoopCapabilities)),
12776
+ ownCapabilities: optionalKey(ArraySchema(Literals(LoopCapabilities))),
12777
+ secrets: optionalKey(ArraySchema(SecretName2)),
12778
+ network: optionalKey(AgentSandboxNetwork),
12779
+ schedule: optionalKey(Struct({ rule: ScheduleRule, timezone: String4 })),
12780
+ outline: optionalKey(LoopOutline)
12781
+ });
12782
+ var LoopEnd = Struct({
12783
+ statuses: optionalKey(ArraySchema(String4)),
12784
+ failure: optionalKey(String4),
12785
+ fails: optionalKey(Boolean2),
12786
+ runtime: optionalKey(Boolean2)
12787
+ });
12788
+ var CallableLoop = Struct({
12789
+ id: String4,
12790
+ title: String4,
12791
+ version: optionalKey(LoopVersion),
12792
+ input: ArraySchema(LoopInputField),
12793
+ inputSchema: Record(String4, Json),
12794
+ output: Record(String4, Json),
12795
+ ends: optionalKey(ArraySchema(LoopEnd)),
12796
+ capabilities: ArraySchema(Literals(LoopCapabilities))
12797
+ });
12798
+ var LoopDetail = Struct({
12799
+ id: String4,
12800
+ resolved: optionalKey(Struct({
12801
+ ...ProgramLoop.fields,
12802
+ agents: LoopManifest.fields.agents,
12803
+ input: ArraySchema(LoopInputField),
12804
+ outline: optionalKey(LoopOutline),
12805
+ inputSchema: CallableLoop.fields.inputSchema,
12806
+ output: CallableLoop.fields.output,
12807
+ ends: CallableLoop.fields.ends,
12808
+ capabilities: CallableLoop.fields.capabilities,
12809
+ when: ArraySchema(Struct({
12810
+ ...WhenClause.fields,
12811
+ on: optionalKey(Boolean2),
12812
+ offBy: optionalKey(Literals(["team", "workspace"]))
12813
+ })),
12814
+ schedule: optionalKey(Struct({
12815
+ rule: ScheduleRule,
12816
+ timezone: String4,
12817
+ on: Boolean2,
12818
+ nextRunAt: optionalKey(String4)
12819
+ }))
12820
+ }))
12821
+ });
12822
+ var AgentDeclaration = Struct({
12823
+ extends: optionalKey(String4),
12824
+ instructions: optionalKey(String4),
12825
+ harness: optionalKey(String4),
12826
+ model: optionalKey(String4),
12827
+ effort: optionalKey(Literals(AgentEfforts)),
12828
+ fallbacks: optionalKey(ArraySchema(AgentFallback)),
12829
+ tools: optionalKey(ArraySchema(Literals(AgentCapabilities))),
12830
+ skills: optionalKey(ArraySchema(String4.check(isMinLength(1)))),
12831
+ network: optionalKey(Union([Struct({ hosts: ArraySchema(String4) }), Literal("open")])),
12832
+ sandbox: optionalKey(Literal("docker"))
12833
+ });
12834
+ var scheduleFields = {
12835
+ name: String4.check(isMinLength(1)),
12836
+ loop: String4,
12837
+ team: optionalKey(String4),
12838
+ input: optionalKey(JsonObject2),
12839
+ timezone: String4,
12840
+ misfire: optionalKey(Literals(ScheduleMisfirePolicies)),
12841
+ overlap: optionalKey(Literals(ScheduleOverlapPolicies))
12842
+ };
12843
+ var ScheduleDeclaration = Union([
12844
+ Struct({
12845
+ ...scheduleFields,
12846
+ cron: String4.check(makeFilter((cron) => isScheduleRule({ cron }) || "five cron fields, each within its range"))
12847
+ }),
12848
+ Struct({
12849
+ ...scheduleFields,
12850
+ rule: declare((value) => isScheduleRule(value), {
12851
+ expected: "a Schedule rule: frequency daily or weekly, hour, minute, and optionally second and daysOfWeek"
12852
+ })
12853
+ })
12854
+ ]);
12855
+ var CarriedKit = Struct({
12856
+ name: KitName,
12857
+ version: String4.check(isMinLength(1)),
12858
+ setup: KitDigest,
12859
+ loops: ArraySchema(String4),
12860
+ agents: ArraySchema(String4)
12861
+ });
12862
+ var StepManifest = Struct({
12863
+ name: String4,
12864
+ payload: JsonObject2,
12865
+ success: JsonObject2,
12866
+ error: JsonObject2
12867
+ });
12868
+ var KitDeclarations = Struct({
12869
+ loops: ArraySchema(LoopManifest),
12870
+ steps: optionalKey(ArraySchema(StepManifest)),
12871
+ agents: Record(String4, AgentDeclaration),
12872
+ schedules: optionalKey(Record(String4, ScheduleDeclaration)),
12873
+ carried: optionalKey(ArraySchema(CarriedKit))
12874
+ });
12875
+ var sameLoop = toEquivalence(LoopManifest);
12876
+ var sameAgent = toEquivalence(AgentDeclaration);
11846
12877
  // packages/core/src/kit-setup.ts
11847
12878
  var KitSetup = Struct({
11848
12879
  ...AgentEnvironmentFragment.fields,
@@ -12365,6 +13396,9 @@ class KitmanEffectClient {
12365
13396
  headers: this.headers()
12366
13397
  });
12367
13398
  }
13399
+ releaseProject(workspaceId, projectId, input = {}) {
13400
+ return this.request("releaseProject", `/workspaces/${segment(workspaceId)}/projects/${segment(projectId)}/release`, { method: "POST", headers: this.headers(true), body: JSON.stringify(input) });
13401
+ }
12368
13402
  listProjectTasks(workspaceId, projectId) {
12369
13403
  return this.request("listProjectTasks", `/workspaces/${segment(workspaceId)}/projects/${segment(projectId)}/tasks`, {
12370
13404
  headers: this.headers()
@@ -12562,6 +13596,19 @@ class KitmanEffectClient {
12562
13596
  body: JSON.stringify(input)
12563
13597
  });
12564
13598
  }
13599
+ holdClaim(workspaceId, resource, input) {
13600
+ return this.request("holdClaim", `/workspaces/${segment(workspaceId)}/claims/${segment(resource)}/hold`, {
13601
+ method: "POST",
13602
+ headers: this.headers(true),
13603
+ body: JSON.stringify(input)
13604
+ });
13605
+ }
13606
+ mergeThroughChangeRequest(changeRequestId) {
13607
+ return this.request("mergeThroughChangeRequest", `/change-requests/${segment(changeRequestId)}/merge-through`, {
13608
+ method: "POST",
13609
+ headers: this.headers()
13610
+ });
13611
+ }
12565
13612
  uploadKitBundle(workspaceId, digest, input) {
12566
13613
  return this.request("uploadKitBundle", `/workspaces/${segment(workspaceId)}/kit-bundles/${segment(digest)}`, {
12567
13614
  method: "PUT",
@@ -12731,6 +13778,36 @@ class KitmanEffectClient {
12731
13778
  body: JSON.stringify(input)
12732
13779
  });
12733
13780
  }
13781
+ listReleases(workspaceId, options = {}) {
13782
+ return this.request("listReleases", `/workspaces/${segment(workspaceId)}/releases${releaseListQuery(options)}`, {
13783
+ headers: this.headers()
13784
+ });
13785
+ }
13786
+ getRelease(workspaceId, releaseId) {
13787
+ return this.request("getRelease", `/workspaces/${segment(workspaceId)}/releases/${segment(releaseId)}`, {
13788
+ headers: this.headers()
13789
+ });
13790
+ }
13791
+ compareReleases(workspaceId, releaseId, sinceId) {
13792
+ return this.request("compareReleases", `/workspaces/${segment(workspaceId)}/releases/${segment(releaseId)}/since/${segment(sinceId)}`, { headers: this.headers() });
13793
+ }
13794
+ listUnreleased(workspaceId, repoBindingId) {
13795
+ return this.request("listUnreleased", `/workspaces/${segment(workspaceId)}/repo-bindings/${segment(repoBindingId)}/unreleased`, { headers: this.headers() });
13796
+ }
13797
+ listDeploys(workspaceId, options = {}) {
13798
+ return this.request("listDeploys", `/workspaces/${segment(workspaceId)}/deploys${deployListQuery(options)}`, {
13799
+ headers: this.headers()
13800
+ });
13801
+ }
13802
+ getDeployTargets(workspaceId, repoBindingId) {
13803
+ return this.request("getDeployTargets", `/workspaces/${segment(workspaceId)}/repo-bindings/${segment(repoBindingId)}/deploy-targets`, { headers: this.headers() });
13804
+ }
13805
+ getDeployTargetsView(workspaceId, repoBindingId) {
13806
+ return this.request("getDeployTargetsView", `/workspaces/${segment(workspaceId)}/repo-bindings/${segment(repoBindingId)}/deploy-targets/view`, { headers: this.headers() });
13807
+ }
13808
+ setDeployTargets(workspaceId, repoBindingId, targets) {
13809
+ return this.request("setDeployTargets", `/workspaces/${segment(workspaceId)}/repo-bindings/${segment(repoBindingId)}/deploy-targets`, { method: "PUT", headers: this.headers(true), body: JSON.stringify({ targets }) });
13810
+ }
12734
13811
  getChangeRequest(changeRequestId) {
12735
13812
  return this.request("getChangeRequest", `/change-requests/${segment(changeRequestId)}`, { headers: this.headers() });
12736
13813
  }
@@ -12944,6 +14021,15 @@ class KitmanEffectClient {
12944
14021
  body: JSON.stringify(input)
12945
14022
  });
12946
14023
  }
14024
+ getLoopInputDefaults(workspaceId, loop, options = {}) {
14025
+ return this.request("getLoopInputDefaults", `/workspaces/${segment(workspaceId)}/program-loops/${segment(loop)}/input-defaults${inputDefaultQuery(options)}`, { headers: this.headers() });
14026
+ }
14027
+ setLoopInputDefaults(workspaceId, loop, input) {
14028
+ return this.request("setLoopInputDefaults", `/workspaces/${segment(workspaceId)}/program-loops/${segment(loop)}/input-defaults`, { method: "PUT", headers: this.headers(true), body: JSON.stringify(input) });
14029
+ }
14030
+ clearLoopInputDefaults(workspaceId, loop, options = {}) {
14031
+ return this.request("clearLoopInputDefaults", `/workspaces/${segment(workspaceId)}/program-loops/${segment(loop)}/input-defaults${inputDefaultQuery(options)}`, { method: "DELETE", headers: this.headers() });
14032
+ }
12947
14033
  listAutomaticStarts(teamId, options = {}) {
12948
14034
  return this.request("listAutomaticStarts", `/teams/${segment(teamId)}/automatic-starts${limitQuery(options.limit)}`, { headers: this.headers() });
12949
14035
  }
@@ -13096,6 +14182,28 @@ class KitmanEffectClient {
13096
14182
  setProjectReleaseTrigger(workspaceId, projectId, input) {
13097
14183
  return this.request("setProjectReleaseTrigger", `/workspaces/${segment(workspaceId)}/projects/${segment(projectId)}/release-trigger`, { method: "PUT", headers: this.headers(true), body: JSON.stringify(input) });
13098
14184
  }
14185
+ getProjectTargetBranch(workspaceId, projectId) {
14186
+ return this.request("getProjectTargetBranch", `/workspaces/${segment(workspaceId)}/projects/${segment(projectId)}/target-branch`, { headers: this.headers() });
14187
+ }
14188
+ setProjectTargetBranch(workspaceId, projectId, input) {
14189
+ return this.request("setProjectTargetBranch", `/workspaces/${segment(workspaceId)}/projects/${segment(projectId)}/target-branch`, { method: "PUT", headers: this.headers(true), body: JSON.stringify(input) });
14190
+ }
14191
+ getMilestoneTargetBranch(workspaceId, projectId, milestoneId) {
14192
+ return this.request("getMilestoneTargetBranch", `/workspaces/${segment(workspaceId)}/projects/${segment(projectId)}/milestones/${segment(milestoneId)}/target-branch`, { headers: this.headers() });
14193
+ }
14194
+ setMilestoneTargetBranch(workspaceId, projectId, milestoneId, input) {
14195
+ return this.request("setMilestoneTargetBranch", `/workspaces/${segment(workspaceId)}/projects/${segment(projectId)}/milestones/${segment(milestoneId)}/target-branch`, { method: "PUT", headers: this.headers(true), body: JSON.stringify(input) });
14196
+ }
14197
+ getTaskTargetBranch(taskId) {
14198
+ return this.request("getTaskTargetBranch", `/tasks/${segment(taskId)}/target-branch`, { headers: this.headers() });
14199
+ }
14200
+ setTaskTargetBranch(taskId, input) {
14201
+ return this.request("setTaskTargetBranch", `/tasks/${segment(taskId)}/target-branch`, {
14202
+ method: "PUT",
14203
+ headers: this.headers(true),
14204
+ body: JSON.stringify(input)
14205
+ });
14206
+ }
13099
14207
  getWorkspaceDeliveryTarget(workspaceId) {
13100
14208
  return this.request("getWorkspaceDeliveryTarget", `/workspaces/${segment(workspaceId)}/delivery-target`, {
13101
14209
  headers: this.headers()
@@ -13583,7 +14691,7 @@ class KitmanEffectClient {
13583
14691
  return tryPromise({
13584
14692
  try: () => this.fetchImpl(this.url(path), { ...init, headers, signal: abort.signal }),
13585
14693
  catch: failed
13586
- }).pipe(flatMap3((answer) => tryPromise({ try: () => answer.arrayBuffer(), catch: failed }).pipe(map8((body) => new Response(body.byteLength === 0 ? null : body, answer)))), onInterrupt(() => sync2(() => abort.abort())));
14694
+ }).pipe(flatMap3((answer) => tryPromise({ try: () => answer.arrayBuffer(), catch: failed }).pipe(map9((body) => new Response(body.byteLength === 0 ? null : body, answer)))), onInterrupt(() => sync2(() => abort.abort())));
13587
14695
  });
13588
14696
  const response = yield* method !== "GET" ? send.pipe(retry({ schedule: unansweredGetRetry, times: 5, while: refusedConnection })) : sendAndRead.pipe(timeoutOrElse({
13589
14697
  duration: getAnswerTimeout,
@@ -13645,8 +14753,8 @@ class KitmanEffectClient {
13645
14753
  function errorResponseDetails(response) {
13646
14754
  const contentType = response.headers.get("content-type") ?? "";
13647
14755
  if (contentType.includes("application/json"))
13648
- return tryPromise(() => response.json()).pipe(map8(parseErrorResponse), orElseSucceed(() => ({})));
13649
- return tryPromise(() => response.text()).pipe(map8((text) => {
14756
+ return tryPromise(() => response.json()).pipe(map9(parseErrorResponse), orElseSucceed(() => ({})));
14757
+ return tryPromise(() => response.text()).pipe(map9((text) => {
13650
14758
  const message = sanitizeErrorDetail(text);
13651
14759
  return message === undefined ? {} : { message };
13652
14760
  }), orElseSucceed(() => ({})));
@@ -13737,6 +14845,33 @@ function taskExecutionRecordQuery(options) {
13737
14845
  search.set("cursor", options.cursor);
13738
14846
  return search.size === 0 ? "" : `?${search.toString()}`;
13739
14847
  }
14848
+ var releaseListQuery = (options) => {
14849
+ const query = new URLSearchParams({
14850
+ ...options.repoBindingId === undefined ? undefined : { repoBindingId: options.repoBindingId },
14851
+ ...options.tag === undefined ? undefined : { tag: options.tag },
14852
+ ...options.prereleases === undefined ? undefined : { prereleases: String(options.prereleases) },
14853
+ ...options.cursor === undefined ? undefined : { cursor: options.cursor },
14854
+ ...options.limit === undefined ? undefined : { limit: String(options.limit) }
14855
+ }).toString();
14856
+ return query === "" ? "" : `?${query}`;
14857
+ };
14858
+ var deployListQuery = (options) => {
14859
+ const query = new URLSearchParams({
14860
+ ...options.repoBindingId === undefined ? undefined : { repoBindingId: options.repoBindingId },
14861
+ ...options.target === undefined ? undefined : { target: options.target },
14862
+ ...options.tag === undefined ? undefined : { tag: options.tag },
14863
+ ...options.limit === undefined ? undefined : { limit: String(options.limit) }
14864
+ }).toString();
14865
+ return query === "" ? "" : `?${query}`;
14866
+ };
14867
+ var inputDefaultQuery = (options) => {
14868
+ const query = new URLSearchParams({
14869
+ ...options.teamId === undefined ? undefined : { teamId: options.teamId },
14870
+ ...options.projectId === undefined ? undefined : { projectId: options.projectId },
14871
+ ...options.when === undefined ? undefined : { when: options.when }
14872
+ }).toString();
14873
+ return query === "" ? "" : `?${query}`;
14874
+ };
13740
14875
  function scopeQuery(options) {
13741
14876
  return options.teamId === undefined ? "" : `?${new URLSearchParams({ teamId: options.teamId }).toString()}`;
13742
14877
  }
@@ -13943,13 +15078,13 @@ function resolveConfig(input) {
13943
15078
  ...userAgentPreferences === undefined ? undefined : { userAgentPreferences }
13944
15079
  };
13945
15080
  }
13946
- var apiUrlFromEnv = String2("KITMAN_API_URL").pipe(option, map8(getOrUndefined));
13947
- var stepCredentialFromEnv = String2("KITMAN_STEP_CREDENTIAL").pipe(option, map8(getOrUndefined));
13948
- var stepWorkspaceFromEnv = String2("KITMAN_STEP_WORKSPACE").pipe(option, map8(getOrUndefined));
13949
- var stepSkillsDirFromEnv = String2("KITMAN_STEP_SKILLS_DIR").pipe(option, map8(getOrUndefined));
13950
- var stepFittingSkillsFromEnv = String2("KITMAN_STEP_FITTING_SKILLS").pipe(option, map8((names) => getOrElse(names, () => "").split(",").filter((name) => name !== "")));
13951
- var stepOutputOnlyFromEnv = String2("KITMAN_STEP_TOOLS").pipe(option, map8((tools) => getOrUndefined(tools) === "output"));
13952
- var mcpCredentialNameFromEnv = String2("KITMAN_MCP_CREDENTIAL_NAME").pipe(option, map8(getOrUndefined));
15081
+ var apiUrlFromEnv = String2("KITMAN_API_URL").pipe(option, map9(getOrUndefined));
15082
+ var stepCredentialFromEnv = String2("KITMAN_STEP_CREDENTIAL").pipe(option, map9(getOrUndefined));
15083
+ var stepWorkspaceFromEnv = String2("KITMAN_STEP_WORKSPACE").pipe(option, map9(getOrUndefined));
15084
+ var stepSkillsDirFromEnv = String2("KITMAN_STEP_SKILLS_DIR").pipe(option, map9(getOrUndefined));
15085
+ var stepFittingSkillsFromEnv = String2("KITMAN_STEP_FITTING_SKILLS").pipe(option, map9((names) => getOrElse(names, () => "").split(",").filter((name) => name !== "")));
15086
+ var stepOutputOnlyFromEnv = String2("KITMAN_STEP_TOOLS").pipe(option, map9((tools) => getOrUndefined(tools) === "output"));
15087
+ var mcpCredentialNameFromEnv = String2("KITMAN_MCP_CREDENTIAL_NAME").pipe(option, map9(getOrUndefined));
13953
15088
  var kitmanConfigDir = gen(function* () {
13954
15089
  const path = yield* Path;
13955
15090
  const xdgConfigHome = yield* String2("XDG_CONFIG_HOME").pipe(option);
@@ -13967,7 +15102,7 @@ var userHarnessSyncPath = configFile("harness-sync.json");
13967
15102
  var kitSetupCacheDir = configFile("kit-setups");
13968
15103
  var bundleCacheDir = configFile("bundles");
13969
15104
  var runnerReleaseChannelPath = (runnerId) => configFile(`runner-release-channels/${runnerId}`);
13970
- var localConfigPath = Path.pipe(map8((path) => path.resolve(".kitman/config.json")));
15105
+ var localConfigPath = Path.pipe(map9((path) => path.resolve(".kitman/config.json")));
13971
15106
  function readUserConfig(path) {
13972
15107
  return gen(function* () {
13973
15108
  const filePath = path ?? (yield* userConfigPath);
@@ -14127,7 +15262,7 @@ function sessionForApi(auth, apiUrl) {
14127
15262
  return auth.sessions[normalizeApiUrl(apiUrl)];
14128
15263
  }
14129
15264
  function readAuthStore(path) {
14130
- return readUserAuth(path).pipe(map8((auth) => isAuthStore(auth) ? normalizeAuthStore(auth) : { sessions: {} }), catchTag("SchemaError", () => succeed6({ sessions: {} })));
15265
+ return readUserAuth(path).pipe(map9((auth) => isAuthStore(auth) ? normalizeAuthStore(auth) : { sessions: {} }), catchTag("SchemaError", () => succeed6({ sessions: {} })));
14131
15266
  }
14132
15267
  function writeAuthStore(auth, path) {
14133
15268
  return writeUserAuth(auth, path);
@@ -14266,7 +15401,7 @@ function getStreamSchemas(schema) {
14266
15401
  }
14267
15402
  var schema = /* @__PURE__ */ declare(isStream);
14268
15403
  function Stream(success, error) {
14269
- return make16(schema.ast, {
15404
+ return make17(schema.ast, {
14270
15405
  [StreamSchemaTypeId]: StreamSchemaTypeId,
14271
15406
  success,
14272
15407
  error
@@ -14274,9 +15409,9 @@ function Stream(success, error) {
14274
15409
  }
14275
15410
 
14276
15411
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/rpc/Rpc.js
14277
- var TypeId16 = "~effect/rpc/Rpc";
15412
+ var TypeId15 = "~effect/rpc/Rpc";
14278
15413
  var Proto8 = {
14279
- [TypeId16]: TypeId16,
15414
+ [TypeId15]: TypeId15,
14280
15415
  pipe() {
14281
15416
  return pipeArguments(this, arguments);
14282
15417
  },
@@ -14443,7 +15578,7 @@ class WorkerUnknownError extends (/* @__PURE__ */ Error3("effect/workers/WorkerE
14443
15578
  var WorkerErrorReason = /* @__PURE__ */ Union([WorkerSpawnError, WorkerSendError, WorkerReceiveError, WorkerUnknownError]);
14444
15579
 
14445
15580
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/rpc/RpcClientError.js
14446
- var TypeId17 = "~effect/rpc/RpcClientError";
15581
+ var TypeId16 = "~effect/rpc/RpcClientError";
14447
15582
 
14448
15583
  class RpcClientDefect extends (/* @__PURE__ */ Error3("effect/rpc/RpcClientError/RpcClientDefect")({
14449
15584
  _tag: /* @__PURE__ */ tag("RpcClientDefect"),
@@ -14452,11 +15587,11 @@ class RpcClientDefect extends (/* @__PURE__ */ Error3("effect/rpc/RpcClientError
14452
15587
  })) {
14453
15588
  }
14454
15589
 
14455
- class RpcClientError extends (/* @__PURE__ */ Error3(TypeId17)({
15590
+ class RpcClientError extends (/* @__PURE__ */ Error3(TypeId16)({
14456
15591
  _tag: /* @__PURE__ */ tag("RpcClientError"),
14457
15592
  reason: /* @__PURE__ */ Union([WorkerErrorReason, SocketErrorReason, HttpClientErrorSchema, RpcClientDefect])
14458
15593
  })) {
14459
- [TypeId17] = TypeId17;
15594
+ [TypeId16] = TypeId16;
14460
15595
  get message() {
14461
15596
  return `${this.reason._tag}: ${this.reason.message}`;
14462
15597
  }
@@ -14576,7 +15711,7 @@ var RpcGroupProto = {
14576
15711
  });
14577
15712
  },
14578
15713
  annotateRpcs(service, value) {
14579
- return this.annotateRpcsMerge(make14(service, value));
15714
+ return this.annotateRpcsMerge(make15(service, value));
14580
15715
  },
14581
15716
  annotateMerge(context) {
14582
15717
  return makeProto2({
@@ -14604,7 +15739,7 @@ var make7 = (...rpcs) => makeProto2({
14604
15739
  annotations: empty3()
14605
15740
  });
14606
15741
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/rpc/RpcMiddleware.js
14607
- var TypeId18 = "~effect/rpc/RpcMiddleware";
15742
+ var TypeId17 = "~effect/rpc/RpcMiddleware";
14608
15743
  var Service = () => (id, options) => {
14609
15744
  const limit = getStackTraceLimit();
14610
15745
  let creationError;
@@ -14622,7 +15757,7 @@ var Service = () => (id, options) => {
14622
15757
  return creationError?.stack;
14623
15758
  }
14624
15759
  });
14625
- ServiceClass_[TypeId18] = TypeId18;
15760
+ ServiceClass_[TypeId17] = TypeId17;
14626
15761
  ServiceClass_.error = options?.error ?? Never;
14627
15762
  ServiceClass_.requiredForClient = options?.requiredForClient ?? false;
14628
15763
  return ServiceClass;
@@ -14641,7 +15776,7 @@ class RunnerAuthentication extends Service()("RunnerAuthentication", {
14641
15776
  error: RunnerRpcError
14642
15777
  }) {
14643
15778
  }
14644
- var EventFilterValue = Union([String4, Finite, Boolean2, Null]);
15779
+ var EventFilterValue2 = Union([String4, Finite, Boolean2, Null]);
14645
15780
  var WorkAvailable = TaggedStruct("WorkAvailable", {});
14646
15781
  var LeaseRevoked = TaggedStruct("LeaseRevoked", { workUnitId: String4 });
14647
15782
  var Settled = TaggedStruct("Settled", { workUnitId: String4 });
@@ -14798,6 +15933,11 @@ class RunnerJournalRpcs extends make7(make6("RecordActivity", {
14798
15933
  error: RunnerRpcError
14799
15934
  }), make6("Suspend", { payload: { lease: ProgramLease }, error: RunnerRpcError }), make6("FinishProgram", { payload: { lease: ProgramLease, outcome: ProgramOutcome }, error: RunnerRpcError })).middleware(RunnerAuthentication) {
14800
15935
  }
15936
+ var RunHostStep = make6("RunHostStep", {
15937
+ payload: { lease: ProgramLease, step: String4, hostStep: String4, request: Json },
15938
+ success: Json,
15939
+ error: RunnerRpcError
15940
+ });
14801
15941
 
14802
15942
  class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14803
15943
  payload: {
@@ -14831,7 +15971,8 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14831
15971
  outputSchema: Json,
14832
15972
  secrets: optionalKey(ArraySchema(String4)),
14833
15973
  timeoutMillis: optionalKey(Int),
14834
- mergeTarget: optionalKey(String4.check(isMinLength(1)))
15974
+ mergeTarget: optionalKey(String4.check(isMinLength(1))),
15975
+ applyChange: optionalKey(Struct({ changeRequestId: String4, revert: optionalKey(Boolean2) }))
14835
15976
  },
14836
15977
  success: Struct({ stepAttemptId: String4 }),
14837
15978
  error: RunnerRpcError
@@ -14852,7 +15993,10 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14852
15993
  calibrate: Boolean2
14853
15994
  })),
14854
15995
  resolve: optionalKey(ResolveSpec),
14855
- deploy: optionalKey(DeploySpec)
15996
+ deploy: optionalKey(DeploySpec),
15997
+ versions: optionalKey(VersionsSpec),
15998
+ compare: optionalKey(CompareSpec),
15999
+ command: optionalKey(CommandSpec)
14856
16000
  },
14857
16001
  success: Struct({ verificationId: String4 }),
14858
16002
  error: RunnerRpcError
@@ -14862,12 +16006,12 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14862
16006
  step: String4,
14863
16007
  deferredName: String4,
14864
16008
  event: String4,
14865
- filter: optional(Record(String4, Union([EventFilterValue, ArraySchema(EventFilterValue)]))),
16009
+ filter: optional(Record(String4, Union([EventFilterValue2, ArraySchema(EventFilterValue2)]))),
14866
16010
  timeoutMillis: Int,
14867
16011
  since: optionalKey(String4),
14868
16012
  or: optionalKey(ArraySchema(Struct({
14869
16013
  event: String4,
14870
- filter: optionalKey(Record(String4, Union([EventFilterValue, ArraySchema(EventFilterValue)]))),
16014
+ filter: optionalKey(Record(String4, Union([EventFilterValue2, ArraySchema(EventFilterValue2)]))),
14871
16015
  since: optionalKey(String4)
14872
16016
  })))
14873
16017
  },
@@ -14878,7 +16022,9 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14878
16022
  step: String4,
14879
16023
  deferredName: String4,
14880
16024
  resource: ResourceName,
14881
- action: Literals(["claim", "take_over", "let_go"])
16025
+ action: Literals(["claim", "take_over", "let_go"]),
16026
+ changeRequestId: optionalKey(String4),
16027
+ claims: optionalKey(ArraySchema(String4))
14882
16028
  },
14883
16029
  error: RunnerRpcError
14884
16030
  }), make6("AdmitChild", {
@@ -14892,6 +16038,28 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14892
16038
  },
14893
16039
  success: Struct({ runId: String4 }),
14894
16040
  error: RunnerRpcError
16041
+ }), make6("AdmitChildById", {
16042
+ payload: {
16043
+ lease: ProgramLease,
16044
+ step: String4,
16045
+ loop: String4,
16046
+ input: Json,
16047
+ constraints: optional(ArraySchema(String4)),
16048
+ deferredName: String4
16049
+ },
16050
+ success: Struct({ runId: String4 }),
16051
+ error: RunnerRpcError
16052
+ }), make6("CallableLoops", {
16053
+ payload: { lease: ProgramLease, step: String4, taskId: optional(String4) },
16054
+ success: Struct({ loops: ArraySchema(CallableLoop) }),
16055
+ error: RunnerRpcError
16056
+ }), make6("StopLaunches", {
16057
+ payload: {
16058
+ lease: ProgramLease,
16059
+ step: String4,
16060
+ deferredNames: ArraySchema(String4)
16061
+ },
16062
+ error: RunnerRpcError
14895
16063
  }), make6("StoreArtifact", {
14896
16064
  payload: {
14897
16065
  lease: ProgramLease,
@@ -14995,7 +16163,12 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14995
16163
  }),
14996
16164
  error: RunnerRpcError
14997
16165
  }), make6("PipelineStatus", {
14998
- payload: { lease: ProgramLease, step: String4, changeRequestId: String4 },
16166
+ payload: {
16167
+ lease: ProgramLease,
16168
+ step: String4,
16169
+ changeRequestId: String4,
16170
+ behind: optionalKey(Literal(true))
16171
+ },
14999
16172
  success: Struct({
15000
16173
  head: String4,
15001
16174
  status: Literals(["none", "running", "success", "failed", "canceled"]),
@@ -15016,6 +16189,7 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
15016
16189
  targetBranch: optionalKey(String4),
15017
16190
  conflicts: optionalKey(Boolean2),
15018
16191
  needsRebase: optionalKey(Boolean2),
16192
+ behind: optionalKey(Boolean2),
15019
16193
  target: optionalKey(Struct({
15020
16194
  branch: String4,
15021
16195
  head: String4,
@@ -15167,6 +16341,44 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
15167
16341
  payload: { lease: ProgramLease },
15168
16342
  success: Struct({ repoBindingId: String4, branch: String4, revision: String4 }),
15169
16343
  error: RunnerRpcError
16344
+ }), make6("Branch", {
16345
+ payload: {
16346
+ lease: ProgramLease,
16347
+ branch: optionalKey(String4),
16348
+ from: optionalKey(String4),
16349
+ repoBindingId: optionalKey(String4),
16350
+ base: optionalKey(Boolean2)
16351
+ },
16352
+ success: Struct({
16353
+ repoBindingId: String4,
16354
+ branch: String4,
16355
+ revision: String4,
16356
+ created: Boolean2
16357
+ }),
16358
+ error: RunnerRpcError
16359
+ }), make6("BranchChangeRequest", {
16360
+ payload: {
16361
+ lease: ProgramLease,
16362
+ step: String4,
16363
+ waitsWhenUnconfirmed: optionalKey(Boolean2),
16364
+ title: String4,
16365
+ body: String4,
16366
+ source: String4,
16367
+ target: optionalKey(String4),
16368
+ repoBindingId: optionalKey(String4)
16369
+ },
16370
+ success: Union([
16371
+ Struct({
16372
+ status: Literal("open"),
16373
+ id: String4,
16374
+ number: String4,
16375
+ url: String4,
16376
+ opened: Boolean2
16377
+ }),
16378
+ Struct({ status: Literal("nothing") }),
16379
+ Struct({ status: Literal("elsewhere"), team: String4 })
16380
+ ]),
16381
+ error: RunnerRpcError
15170
16382
  }), make6("MergeChangeRequest", {
15171
16383
  payload: {
15172
16384
  lease: ProgramLease,
@@ -15229,11 +16441,33 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
15229
16441
  tag: String4,
15230
16442
  revision: optionalKey(String4),
15231
16443
  title: String4,
15232
- notes: String4
16444
+ notes: String4,
16445
+ prerelease: optionalKey(Boolean2),
16446
+ previousTag: optionalKey(NullOr(String4))
15233
16447
  },
15234
16448
  success: Struct({ tag: String4, revision: String4, url: String4 }),
15235
16449
  error: RunnerRpcError
15236
- }), make6("ProgramSecrets", {
16450
+ }), make6("RecordDeploy", {
16451
+ payload: {
16452
+ lease: ProgramLease,
16453
+ step: String4,
16454
+ target: DeployTargetName,
16455
+ tag: DeployRef,
16456
+ revision: optionalKey(DeployRef),
16457
+ status: DeployStatus,
16458
+ detail: optionalKey(String4)
16459
+ },
16460
+ success: Deploy,
16461
+ error: RunnerRpcError
16462
+ }), make6("DeployTarget", {
16463
+ payload: { lease: ProgramLease, step: String4, target: DeployTargetName },
16464
+ success: Struct({
16465
+ target: String4,
16466
+ running: optionalKey(DeployTargetRunning),
16467
+ order: optionalKey(ArraySchema(String4))
16468
+ }),
16469
+ error: RunnerRpcError
16470
+ }), RunHostStep, make6("ProgramSecrets", {
15237
16471
  payload: { lease: ProgramLease },
15238
16472
  success: Record(String4, String4),
15239
16473
  error: RunnerRpcError
@@ -15266,7 +16500,7 @@ var ProgramRpcs = RunnerJournalRpcs.merge(RunnerCapabilityRpcs, RunnerRunFileRpc
15266
16500
  var RunnerRpcs = RunnerReplicaRpcs.merge(RunnerJournalRpcs, RunnerCapabilityRpcs, RunnerRunFileRpcs);
15267
16501
 
15268
16502
  // apps/cli/src/oauth.ts
15269
- var Scope2 = "openid profile email offline_access kitman:cli";
16503
+ var Scope = "openid profile email offline_access kitman:cli";
15270
16504
  var CallbackPath = "/auth/callback";
15271
16505
 
15272
16506
  class OAuthCallbackTimeout extends TaggedError("OAuthCallbackTimeout") {
@@ -15285,7 +16519,7 @@ function buildAuthorizeUrl(input) {
15285
16519
  url.searchParams.set("response_type", "code");
15286
16520
  url.searchParams.set("client_id", input.clientId);
15287
16521
  url.searchParams.set("redirect_uri", input.redirectUri);
15288
- url.searchParams.set("scope", Scope2);
16522
+ url.searchParams.set("scope", Scope);
15289
16523
  url.searchParams.set("code_challenge", input.codeChallenge);
15290
16524
  url.searchParams.set("code_challenge_method", "S256");
15291
16525
  url.searchParams.set("state", input.state);
@@ -15345,7 +16579,7 @@ function toStoredSession(token, existingRefreshToken) {
15345
16579
  }
15346
16580
  function startLoopbackServer(input) {
15347
16581
  return gen(function* () {
15348
- const code = yield* make15();
16582
+ const code = yield* make16();
15349
16583
  const context2 = yield* context();
15350
16584
  const runSyncExit = runSyncExitWith(context2);
15351
16585
  const server = yield* acquireRelease(sync2(() => Bun.serve({
@@ -15482,7 +16716,7 @@ var refreshFailure = (error) => new KitmanClientError({
15482
16716
  status: (error instanceof CliError ? error.status : undefined) ?? 503
15483
16717
  });
15484
16718
  function refreshSession(input) {
15485
- const storedSession = readAuthStore(input.authPath).pipe(map8((auth) => sessionForApi(auth, input.apiUrl)));
16719
+ const storedSession = readAuthStore(input.authPath).pipe(map9((auth) => sessionForApi(auth, input.apiUrl)));
15486
16720
  return withAuthLock(input.authPath, gen(function* () {
15487
16721
  const stored = yield* storedSession;
15488
16722
  if (!stored)
@@ -15497,7 +16731,7 @@ function refreshSession(input) {
15497
16731
  clientId: input.clientId ?? ClientId,
15498
16732
  refreshToken: spentToken,
15499
16733
  ...input.fetch ? { fetch: input.fetch } : undefined
15500
- }).pipe(map8((token) => toStoredSession(token, spentToken)));
16734
+ }).pipe(map9((token) => toStoredSession(token, spentToken)));
15501
16735
  const session = yield* refreshing.pipe(catch_((error) => storedSession.pipe(filterOrFail((current) => current !== undefined && current.refreshToken !== spentToken, () => error))), mapError2(expiredIfRefused));
15502
16736
  const current = yield* storedSession;
15503
16737
  if (current?.refreshToken !== spentToken)
@@ -15893,7 +17127,7 @@ var openConnection = (transport) => gen(function* () {
15893
17127
  let lastId = 0;
15894
17128
  let lost = false;
15895
17129
  const notifications = yield* unbounded2();
15896
- const ended = yield* make15();
17130
+ const ended = yield* make16();
15897
17131
  const settle = (line) => match(flatMap(decodeJsonStringOption(line), decodeUnknownOption(Response2)), {
15898
17132
  onNone: () => match(flatMap(decodeJsonStringOption(line), decodeUnknownOption(Notification)), {
15899
17133
  onNone: () => void_3,
@@ -15920,7 +17154,7 @@ var openConnection = (transport) => gen(function* () {
15920
17154
  if (lost)
15921
17155
  return yield* new HerdrCoreConnectionLost2({ method });
15922
17156
  const id = ++lastId;
15923
- const deferred = yield* make15();
17157
+ const deferred = yield* make16();
15924
17158
  pending.set(id, { method, deferred });
15925
17159
  yield* pipe.write(encodeJsonStringSync({ jsonrpc: "2.0", id, method, params }));
15926
17160
  return yield* _await(deferred);
@@ -15952,9 +17186,9 @@ var herdrCoreOver = (transport) => ({
15952
17186
  ...input.name === undefined ? undefined : { name: input.name },
15953
17187
  no_parent: input.noParent === true
15954
17188
  }),
15955
- list: (filter = {}) => request("terminal.list", Listed, { labels: filter.labels ?? {}, all: filter.all === true }).pipe(map8((listed) => listed.terminals)),
17189
+ list: (filter = {}) => request("terminal.list", Listed, { labels: filter.labels ?? {}, all: filter.all === true }).pipe(map9((listed) => listed.terminals)),
15956
17190
  get: (terminal) => request("terminal.get", Terminal2, { terminal }),
15957
- read: (terminal) => request("terminal.read", Screen, { terminal }).pipe(map8((screen) => screen.text)),
17191
+ read: (terminal) => request("terminal.read", Screen, { terminal }).pipe(map9((screen) => screen.text)),
15958
17192
  interrupt: (terminal, options = {}) => request("terminal.interrupt", Interrupted, {
15959
17193
  terminal,
15960
17194
  ...options.timeoutSeconds === undefined ? undefined : { timeout: options.timeoutSeconds }
@@ -15994,7 +17228,7 @@ var herdrCoreOver = (transport) => ({
15994
17228
  return { type: "event", terminal: event.value.terminal, kind: event.value.type, data: event.value.data };
15995
17229
  };
15996
17230
  const snapshot = { type: "snapshot", terminals: subscribed.terminals };
15997
- return concat(make10(snapshot), fromQueue(notifications).pipe(map2(toEvent), filter((event) => event !== undefined)));
17231
+ return concat(make11(snapshot), fromQueue(notifications).pipe(map2(toEvent), filter((event) => event !== undefined)));
15998
17232
  }))
15999
17233
  });
16000
17234
  var spawnedTransport = (env) => gen(function* () {
@@ -16017,7 +17251,7 @@ var coreEnv = (options) => {
16017
17251
  const env = Object.fromEntries(Object.entries(options.env ?? process.env).filter((entry) => entry[0] !== "HC_SESSION" && entry[1] !== undefined));
16018
17252
  return options.session === undefined ? env : { ...env, HC_SESSION: options.session };
16019
17253
  };
16020
- var herdrCoreLayer2 = (options) => effect(HerdrCore2, map8(ChildProcessSpawner, (spawner) => herdrCoreOver(spawnedTransport(coreEnv(options)).pipe(provideService(ChildProcessSpawner, spawner)))));
17254
+ var herdrCoreLayer2 = (options) => effect(HerdrCore2, map9(ChildProcessSpawner, (spawner) => herdrCoreOver(spawnedTransport(coreEnv(options)).pipe(provideService(ChildProcessSpawner, spawner)))));
16021
17255
  var herdrCoreTransportLayer2 = (transport) => succeed5(HerdrCore2, herdrCoreOver(transport));
16022
17256
  var UpdateRefused = Struct({
16023
17257
  error: Struct({ message: String4, hint: optionalKey(String4) })
@@ -16040,13 +17274,13 @@ var updateHerdrCore2 = (options) => gen(function* () {
16040
17274
  ], { concurrency: 3 });
16041
17275
  return { stdout, stderr, exitCode };
16042
17276
  }).pipe(scoped, catchReason("PlatformError", "NotFound", () => fail7(new HerdrCoreMissing2)));
16043
- const reason = yield* run(["update", "--json"]).pipe(map8(({ stdout, stderr, exitCode }) => exitCode === 0 ? undefined : refusalReason(stdout) ?? (stderr.trim() || `it exited with code ${exitCode}`)), catchTag("PlatformError", (error) => succeed6(error.message)), timeoutOrElse({
17277
+ const reason = yield* run(["update", "--json"]).pipe(map9(({ stdout, stderr, exitCode }) => exitCode === 0 ? undefined : refusalReason(stdout) ?? (stderr.trim() || `it exited with code ${exitCode}`)), catchTag("PlatformError", (error) => succeed6(error.message)), timeoutOrElse({
16044
17278
  duration: options.timeout,
16045
17279
  orElse: () => succeed6(`it did not finish within ${options.timeout}`)
16046
17280
  }));
16047
17281
  if (reason === undefined)
16048
17282
  return;
16049
- const version = yield* run(["--version"]).pipe(map8(({ stdout }) => stdout.trim() || "an unknown version"), timeout("10 seconds"), orElseSucceed(() => "an unknown version"));
17283
+ const version = yield* run(["--version"]).pipe(map9(({ stdout }) => stdout.trim() || "an unknown version"), timeout("10 seconds"), orElseSucceed(() => "an unknown version"));
16050
17284
  return yield* new HerdrCoreUpdateFailed2({ version, reason: reason.slice(0, 400) });
16051
17285
  });
16052
17286
 
@@ -16085,7 +17319,7 @@ var runProcess2 = (argv, options) => gen(function* () {
16085
17319
  const spawner = yield* ChildProcessSpawner;
16086
17320
  const [command, ...args] = argv;
16087
17321
  const handle = yield* spawner.spawn(make3(command, args, {
16088
- stdin: options.stdin === undefined ? "ignore" : make10(new TextEncoder().encode(options.stdin)),
17322
+ stdin: options.stdin === undefined ? "ignore" : make11(new TextEncoder().encode(options.stdin)),
16089
17323
  ...options.cwd === undefined ? undefined : { cwd: options.cwd },
16090
17324
  env: options.extendEnv === false ? { ...options.env } : { ...withoutPreloads2(), ...options.env }
16091
17325
  }));
@@ -16139,7 +17373,7 @@ var detectHarnesses2 = gen(function* () {
16139
17373
  const home = (yield* optionalEnv("HOME")) ?? "/";
16140
17374
  const searchPath = ((yield* optionalEnv("PATH")) ?? "").split(":").filter(Boolean);
16141
17375
  const exists = (file) => fs.exists(file).pipe(orElseSucceed(() => false));
16142
- const any = (items, test) => map8(findFirst(items, test), isSome);
17376
+ const any = (items, test) => map9(findFirst(items, test), isSome);
16143
17377
  const loginFound = (login) => gen(function* () {
16144
17378
  const file = path.join(home, login.path);
16145
17379
  if (!(yield* exists(file)))
@@ -16156,7 +17390,7 @@ var detectHarnesses2 = gen(function* () {
16156
17390
  unavailable.push({ harness: harness.id, missing: [`\`${binary}\` is not installed`] });
16157
17391
  continue;
16158
17392
  }
16159
- const loggedIn = (yield* any(harness.keys, (key) => map8(optionalEnv(key), Boolean))) || (yield* any(harness.logins, loginFound));
17393
+ const loggedIn = (yield* any(harness.keys, (key) => map9(optionalEnv(key), Boolean))) || (yield* any(harness.logins, loginFound));
16160
17394
  if (loggedIn)
16161
17395
  harnesses.push(harness.id);
16162
17396
  else
@@ -16555,7 +17789,11 @@ function herdrRunnerCapabilities2(input) {
16555
17789
  resourceLimits: { maxConcurrentRuns: 1, maxRunSeconds: 86400 },
16556
17790
  measure: true,
16557
17791
  resolve: true,
16558
- deploy: true
17792
+ deploy: true,
17793
+ versions: true,
17794
+ compare: true,
17795
+ command: true,
17796
+ applyChange: true
16559
17797
  };
16560
17798
  }
16561
17799
  function assertHerdrRunnerCapability2(capabilities) {
@@ -16601,4 +17839,4 @@ function serviceChecks(declaration) {
16601
17839
  return decoded === undefined || decoded.services.length === 0 ? [] : [...new Set(decoded.checks ?? [])];
16602
17840
  }
16603
17841
 
16604
- export { WebCrypto, SecureRandom, layerWebCrypto, makeUnsafe, formatIso, empty, fromInput, merge, runMain, layer, layer2, Stdio, Terminal, layer3, error, log, toDate, parseDate, toIso, currentDate, wallClockMillis, waitingOnWords, queueWords, scanDurableSurface, redactResponseSurface, redactCredentials, redactedOutputTail, SafeJson, ReleaseChannels, DefaultReleaseChannel, newerKitmanVersion, releaseChannelOffers, AgentHarnessIds, AgentSkillRequirement, AgentMcpServerRequirement, AgentEnvironmentFragment, findForbiddenAgentEnvironmentSecretPath, NetworkHost, RepoBindingProviders, RepoBindingCredentialProviderTypes, findForbiddenRepoBindingSecretPath, AgentSandboxNetwork, runnerAgentSandboxPolicy, agentNetworkAllowlist, verificationNetworkAllowlist, programNetworkHosts, ContextPackModes, DefaultContextPackMode, ProposalStatuses, ProposalTargetTypes, canonicalJson, canonicalSha256, AgentEfforts, AgentCapabilities, tokensSpent, tokenCountWords, isTestReportName, testDigest, failedTestOfLine, printedNotReported, failedTestsOf, testOutcomes, checkTests, reportedModelName, LoopDataSchemaRef, RunDisplayStates, LoopVersion, ProgramLoop, AgentFallback, RunWaitUntils, ProgramWorkUnit, MeasureSample, MeasureEvidence, catchUpPathLimit, CatchUp, RunnerOwnership, RunnerExecutionBackend, MaxRunnerConcurrency, PinnedImage, RunnerSettingNames, RunnerSettingsUpdate, defaultRunnerSettings, shownRunnerSetting, defaultRunnerCapabilities, deliveryProviderActions, MemoryStatuses, MemoryScopes, MaxMemoryListLimit, DecisionStatuses, Session, SessionEnd, SessionUpdate, SessionUpdateCreate, FixFlowRecoveryActions, KitmanAgentCapabilityNames, sha2562, isRunFileRefusalReason, runFileRefusalWords, RunFileRefused, runFileContentType, repositoryKey, createId, digestSha256, digestSha512, digestWith, sha256Hasher, AgentEvent, raw, make5, get, post, put, setHeaders, acceptJson, bodyUint8Array, bodyJsonUnsafe, bodyUrlParams, schemaBodyJson, filterStatusOk, HttpClient, execute, get2, Fetch, layer4, Socket, SocketReadError, SocketError, WebSocketConstructor, layerWebSocketConstructorGlobal, layerWebSocket, runDisplayLabels, listedSummary, stepFallbackWords, KitName, KitDigest, defaultKitName, KitSetup, SetupArchive, kitMcpSecretNames, kitmanMcpServer, KitmanClientError, KitmanEffectClient, CliError, DefaultApiUrl, resolveConfig, apiUrlFromEnv, stepCredentialFromEnv, stepWorkspaceFromEnv, stepSkillsDirFromEnv, stepFittingSkillsFromEnv, stepOutputOnlyFromEnv, mcpCredentialNameFromEnv, userConfigPath, userAuthPath, userHarnessSyncPath, kitSetupCacheDir, bundleCacheDir, runnerReleaseChannelPath, localConfigPath, readUserConfig, writeUserConfig, sessionForApi, readAuthStore, storeSession, removeSession, removeAllSessions, agentCredentialForApi, storeAgentCredential, removeAgentCredential, normalizeApiUrl, isStoredAgentCredential, isStreamSchema, getStreamSchemas, make6, exitSchema, ParseOptions, RpcClientDefect, RpcClientError, make7, Service, RunnerHeaders, RunnerRpcProtocolVersion, RunnerRpcError, RunSettled, UpdateAvailable, RunnerReplicaRpcs, RunnerRunFileRpcs, ProgramRpcs, parseCallbackUrl, revokeToken, toStoredSession, browserLogin, openBrowser, shouldRefresh, createSdkClient, refreshSession, AgentAuthClientError, executeAgentCapability, createAgentAuthBearerToken, McpPlatformLive, runMcpEffect, createAgentAuthSignedFetch, setupMcpAgentCredential, generateAgentKeyPair, HERDR_CORE_GENERATION2, HERDR_CORE_INSTALL_COMMAND2, HerdrCoreMissing2, HerdrCoreIncompatible2, HerdrCoreConnectionLost2, HerdrCoreRpcError2, HerdrCoreUpdateFailed2, HerdrCore2, herdrCoreLayer2, herdrCoreTransportLayer2, updateHerdrCore2, CommandFailed2, runCommand2, withoutPreloads2, shellOutputTailChars2, runProcess2, CommandRunner2, runShell2, detectHarnesses2, kitHarnesses, isKitHarness, instructionsStart, instructionsEnd, harnessNames, renderMcpServer, antigravityPlugins, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices, serviceChecks };
17842
+ export { Clock, currentTimeMillis, WebCrypto, SecureRandom, layerWebCrypto, makeUnsafe, formatIso, empty, fromInput, merge, runMain, layer, layer2, Stdio, Terminal, layer3, error, log, toDate, parseDate, toIso, currentDate, wallClockMillis, waitingOnWords, queueWords, scanDurableSurface, redactResponseSurface, redactCredentials, redactedOutputTail, ReleaseChannels, DefaultReleaseChannel, newerKitmanVersion, releaseChannelOffers, AgentHarnessIds, AgentSkillRequirement, AgentMcpServerRequirement, AgentEnvironmentFragment, findForbiddenAgentEnvironmentSecretPath, NetworkHost, RepoBindingProviders, RepoBindingCredentialProviderTypes, RepoBindingProvider, findForbiddenRepoBindingSecretPath, releaseVersion, ReleaseScope, isBranchName, baseBranchLayerWords, repositoryKey, loopInputFields, InputSourceLayers, InputSource, inputSourceWords, runnerAgentSandboxPolicy, agentNetworkAllowlist, verificationNetworkAllowlist, programNetworkHosts, ContextPackModes, DefaultContextPackMode, ProposalStatuses, ProposalTargetTypes, canonicalJson, canonicalSha256, tokensSpent, tokenCountWords, endsFailing, outlineText, anyFailure, goesOn, outlineMermaid, runOutlineText, isTestReportName, testDigest, failedTestOfLine, printedNotReported, failedTestsOf, testOutcomes, checkTests, recommendedDefault, reportedModelName, RunDisplayStates, RunWaitUntils, calverNumbers, compareCalver, DeliveryMode, ProgramWorkUnit, MeasureSample, MeasureEvidence, TagVersions, compareCommitMax, commitMessageMax, commandTimeoutMillisDefault, commandTextLimit, catchUpPathLimit, CatchUp, RunnerOwnership, RunnerExecutionBackend, MaxRunnerConcurrency, PinnedImage, RunnerSettingNames, RunnerSettingsUpdate, defaultRunnerSettings, shownRunnerSetting, defaultRunnerCapabilities, deliveryProviderActions, MemoryStatuses, MemoryScopes, MaxMemoryListLimit, DecisionStatuses, Session, SessionEnd, SessionUpdate, SessionUpdateCreate, FixFlowRecoveryActions, KitmanAgentCapabilityNames, sha2562, DeployTargetName, DeployRef, DeployStatus, runsDeployedTag, Deploy, DeployTargetRunning, isRunFileRefusalReason, runFileRefusalWords, RunFileRefused, runFileContentType, ClaimResult, mergeTurnResource, createId, digestSha256, digestSha512, digestWith, sha256Hasher, AgentEvent, raw, make5, get, post, put, setHeaders, acceptJson, bodyUint8Array, bodyJsonUnsafe, bodyUrlParams, schemaBodyJson, filterStatusOk, HttpClient, execute, get2, Fetch, layer4, Socket, SocketReadError, SocketError, WebSocketConstructor, layerWebSocketConstructorGlobal, layerWebSocket, runDisplayLabels, listedSummary, stepFallbackWords, runTicketsPayload, runTicketResult, ticketOutcomeLabels, runGraphLayout, KitDigest, defaultKitName, LoopCapabilities, LoopManifest, CallableLoop, AgentDeclaration, StepManifest, KitDeclarations, KitSetup, SetupArchive, kitMcpSecretNames, kitmanMcpServer, KitmanClientError, KitmanEffectClient, CliError, DefaultApiUrl, resolveConfig, apiUrlFromEnv, stepCredentialFromEnv, stepWorkspaceFromEnv, stepSkillsDirFromEnv, stepFittingSkillsFromEnv, stepOutputOnlyFromEnv, mcpCredentialNameFromEnv, userConfigPath, userAuthPath, userHarnessSyncPath, kitSetupCacheDir, bundleCacheDir, runnerReleaseChannelPath, localConfigPath, readUserConfig, writeUserConfig, sessionForApi, readAuthStore, storeSession, removeSession, removeAllSessions, agentCredentialForApi, storeAgentCredential, removeAgentCredential, normalizeApiUrl, isStoredAgentCredential, isStreamSchema, getStreamSchemas, make6, exitSchema, ParseOptions, RpcClientDefect, RpcClientError, make7, Service, RunnerHeaders, RunnerRpcProtocolVersion, RunnerRpcError, RunSettled, UpdateAvailable, RunnerReplicaRpcs, RunnerRunFileRpcs, ProgramRpcs, parseCallbackUrl, revokeToken, toStoredSession, browserLogin, openBrowser, shouldRefresh, createSdkClient, refreshSession, AgentAuthClientError, executeAgentCapability, createAgentAuthBearerToken, McpPlatformLive, runMcpEffect, createAgentAuthSignedFetch, setupMcpAgentCredential, generateAgentKeyPair, HERDR_CORE_GENERATION2, HERDR_CORE_INSTALL_COMMAND2, HerdrCoreMissing2, HerdrCoreIncompatible2, HerdrCoreConnectionLost2, HerdrCoreRpcError2, HerdrCoreUpdateFailed2, HerdrCore2, herdrCoreLayer2, herdrCoreTransportLayer2, updateHerdrCore2, CommandFailed2, runCommand2, withoutPreloads2, shellOutputTailChars2, runProcess2, CommandRunner2, runShell2, detectHarnesses2, kitHarnesses, isKitHarness, instructionsStart, instructionsEnd, harnessNames, renderMcpServer, antigravityPlugins, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices, serviceChecks };