@kitman-sh/cli 0.14.9 → 0.15.1

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-cwdrhsvk.js → chunk-0ws25xvg.js} +2 -2
  2. package/dist/{chunk-czmbgsqr.js → chunk-2vxb3q01.js} +656 -39
  3. package/dist/{chunk-mgjer6c7.js → chunk-39ykbhq8.js} +3 -3
  4. package/dist/{chunk-vt8aqeby.js → chunk-3ns4sbfb.js} +1 -1
  5. package/dist/{chunk-c80dvhxf.js → chunk-5hkdgzh4.js} +1 -6
  6. package/dist/{chunk-0x5r7h2g.js → chunk-60fhzjx3.js} +1127 -109
  7. package/dist/{chunk-enmtmq63.js → chunk-69xka6ew.js} +1 -1
  8. package/dist/{chunk-vjt0d9zj.js → chunk-6h70kent.js} +7 -7
  9. package/dist/{chunk-qb9jft1r.js → chunk-8wpg3rph.js} +2 -2
  10. package/dist/{chunk-ftre6ndb.js → chunk-91tmbf95.js} +6 -6
  11. package/dist/chunk-csxxwscf.js +39 -0
  12. package/dist/chunk-d40233pm.js +3080 -0
  13. package/dist/{chunk-jsb61dsk.js → chunk-dv4v0tbn.js} +1815 -117
  14. package/dist/{chunk-wttgq85b.js → chunk-dx792s4w.js} +1396 -41
  15. package/dist/{chunk-dd7wknyk.js → chunk-f36s9s1g.js} +1512 -125
  16. package/dist/{chunk-y9x0yv20.js → chunk-fggwdr03.js} +461 -224
  17. package/dist/{chunk-93xj74qp.js → chunk-fzaecdgv.js} +3 -3
  18. package/dist/{chunk-2r4jy82z.js → chunk-k2wd9r6t.js} +4 -4
  19. package/dist/{chunk-h7qv6nzc.js → chunk-kskb0hkb.js} +7 -7
  20. package/dist/{chunk-6qygqj10.js → chunk-tgt9a3yz.js} +6 -6
  21. package/dist/{chunk-bmwf2ea5.js → chunk-vg78dz3w.js} +85 -26
  22. package/dist/{chunk-axr8avvs.js → chunk-wh4bpc4w.js} +4 -4
  23. package/dist/chunk-xrjt25ns.js +4345 -0
  24. package/dist/{chunk-e3c15bgw.js → chunk-xx711t5r.js} +4 -4
  25. package/dist/{chunk-b2yy07ag.js → chunk-ygx2pda7.js} +7 -7
  26. package/dist/{chunk-cpss81fx.js → chunk-zy4sv70r.js} +13 -5
  27. package/dist/index.js +4 -4
  28. package/package.json +2 -1
  29. package/dist/chunk-3hdjd2c3.js +0 -1192
  30. package/dist/chunk-qvyqfm54.js +0 -526
@@ -140,7 +140,7 @@ import {
140
140
  flatMap3,
141
141
  andThen2,
142
142
  tap2,
143
- map8,
143
+ map9,
144
144
  as,
145
145
  asVoid,
146
146
  catch_,
@@ -196,7 +196,7 @@ import {
196
196
  decode,
197
197
  defaultParseOptions,
198
198
  omit,
199
- map9,
199
+ map10,
200
200
  declare,
201
201
  is,
202
202
  decodeUnknownEffect2,
@@ -244,6 +244,7 @@ import {
244
244
  Class2,
245
245
  Error3,
246
246
  TaggedError2,
247
+ toEquivalence,
247
248
  toCodecJson,
248
249
  Json,
249
250
  JsonObject,
@@ -263,7 +264,7 @@ import {
263
264
  decodeJsonStringOption,
264
265
  encodeJsonStringSync,
265
266
  encodePrettyJsonString
266
- } from "./chunk-wttgq85b.js";
267
+ } from "./chunk-dx792s4w.js";
267
268
  import {
268
269
  map,
269
270
  makeEquivalence,
@@ -331,20 +332,7 @@ import {
331
332
  optionalEnv,
332
333
  harnessesUnsupportedInSrt2,
333
334
  harnessesUnsupportedInDocker2
334
- } from "./chunk-bmwf2ea5.js";
335
- import {
336
- isDateTime,
337
- Numeric,
338
- isWholeNumber,
339
- guard,
340
- Id,
341
- Timestamp,
342
- ActorType,
343
- SecretName,
344
- SecretScope,
345
- SecretHosts,
346
- isSecretReference
347
- } from "./chunk-c80dvhxf.js";
335
+ } from "./chunk-vg78dz3w.js";
348
336
  import {
349
337
  isRedacted,
350
338
  make,
@@ -358,7 +346,20 @@ import {
358
346
  make3,
359
347
  parseFdName,
360
348
  fdName
361
- } from "./chunk-2r4jy82z.js";
349
+ } from "./chunk-k2wd9r6t.js";
350
+ import {
351
+ isDateTime,
352
+ Numeric,
353
+ isWholeNumber,
354
+ guard,
355
+ Id,
356
+ Timestamp,
357
+ ActorType,
358
+ SecretName,
359
+ SecretScope,
360
+ SecretHosts,
361
+ isSecretReference
362
+ } from "./chunk-5hkdgzh4.js";
362
363
 
363
364
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Tuple.js
364
365
  var makeEquivalence3 = Tuple;
@@ -1357,7 +1358,7 @@ var make19 = /* @__PURE__ */ gen(function* () {
1357
1358
  });
1358
1359
  }
1359
1360
  if (stream) {
1360
- return map8(runInputStream(stream, sink, inputFailure), () => {
1361
+ return map9(runInputStream(stream, sink, inputFailure), () => {
1361
1362
  inputSinks.set(fd, sink);
1362
1363
  });
1363
1364
  }
@@ -1650,7 +1651,7 @@ var make19 = /* @__PURE__ */ gen(function* () {
1650
1651
  getInputFd,
1651
1652
  getOutputFd
1652
1653
  } = yield* setupAdditionalFds(cmd, childProcess, resolvedAdditionalFds, inputFailure);
1653
- const isRunning = map8(isDone(exitSignal), (done) => !done);
1654
+ const isRunning = map9(isDone(exitSignal), (done) => !done);
1654
1655
  const exitCode = flatMap3(raceFirst(_await(exitSignal), _await(inputFailure)), ([code, signal]) => {
1655
1656
  if (isDoneUnsafe(inputFailure)) {
1656
1657
  return _await(inputFailure);
@@ -1931,7 +1932,7 @@ var noFollowFlags = (method, flag) => suspend3(() => {
1931
1932
  var openFactory = (method) => {
1932
1933
  const nodeOpen = effectify(NFS.open, handleErrnoException("FileSystem", method), handleBadArgument(method));
1933
1934
  const nodeClose = effectify(NFS.close, handleErrnoException("FileSystem", method), handleBadArgument(method));
1934
- 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)));
1935
1936
  };
1936
1937
  var open2 = /* @__PURE__ */ openFactory("open");
1937
1938
  var negativePosition = (method) => badArgument({
@@ -1992,7 +1993,7 @@ var makeFile = /* @__PURE__ */ (() => {
1992
1993
  });
1993
1994
  }
1994
1995
  const position = this.position;
1995
- return map8(nodeRead(this.fd, {
1996
+ return map9(nodeRead(this.fd, {
1996
1997
  buffer,
1997
1998
  position
1998
1999
  }), (bytesRead) => {
@@ -2013,7 +2014,7 @@ var makeFile = /* @__PURE__ */ (() => {
2013
2014
  }
2014
2015
  const buffer = Buffer.allocUnsafeSlow(size);
2015
2016
  const position = explicit ?? this.position;
2016
- return map8(nodeReadAlloc(this.fd, {
2017
+ return map9(nodeReadAlloc(this.fd, {
2017
2018
  buffer,
2018
2019
  position
2019
2020
  }), (bytesRead) => {
@@ -2036,7 +2037,7 @@ var makeFile = /* @__PURE__ */ (() => {
2036
2037
  });
2037
2038
  }
2038
2039
  truncate(length) {
2039
- return map8(nodeTruncate(this.fd, length || undefined), () => {
2040
+ return map9(nodeTruncate(this.fd, length || undefined), () => {
2040
2041
  if (!this.append) {
2041
2042
  const len = BigInt(length ?? 0);
2042
2043
  if (this.position > len) {
@@ -2048,7 +2049,7 @@ var makeFile = /* @__PURE__ */ (() => {
2048
2049
  write(buffer) {
2049
2050
  return suspend3(() => {
2050
2051
  const position = this.position;
2051
- 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) => {
2052
2053
  if (!this.append) {
2053
2054
  this.position = position + BigInt(bytesWritten);
2054
2055
  }
@@ -2110,7 +2111,7 @@ var readDirectoryEntries = (path) => tryPromise({
2110
2111
  withFileTypes: true
2111
2112
  }),
2112
2113
  catch: (err) => handleErrnoException("FileSystem", "readDirectoryEntries")(err, [path])
2113
- }).pipe(map8((entries) => entries.map((entry) => ({
2114
+ }).pipe(map9((entries) => entries.map((entry) => ({
2114
2115
  name: entry.name,
2115
2116
  type: fileType(entry)
2116
2117
  }))));
@@ -2225,7 +2226,7 @@ var watchNode = (path, info, options) => callback((queue) => acquireRelease(sync
2225
2226
  });
2226
2227
  return watcher;
2227
2228
  }), (watcher) => sync2(() => watcher.close())).pipe(tap2(() => sync2(() => options?.onReady?.()))));
2228
- 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);
2229
2230
  var writeFile2 = (path, data, options) => callback3((resume, signal) => {
2230
2231
  try {
2231
2232
  NFS.writeFile(path, data, {
@@ -2243,7 +2244,7 @@ var writeFile2 = (path, data, options) => callback3((resume, signal) => {
2243
2244
  resume(fail7(handleBadArgument("writeFile")(err)));
2244
2245
  }
2245
2246
  });
2246
- var makeFileSystem = /* @__PURE__ */ map8(/* @__PURE__ */ serviceOption(WatchBackend), (backend) => make12({
2247
+ var makeFileSystem = /* @__PURE__ */ map9(/* @__PURE__ */ serviceOption(WatchBackend), (backend) => make12({
2247
2248
  access: access2,
2248
2249
  chmod: chmod2,
2249
2250
  chown: chown2,
@@ -3205,7 +3206,7 @@ function parseDate(input) {
3205
3206
  function toIso(input) {
3206
3207
  return formatIso(makeUnsafe(input));
3207
3208
  }
3208
- var currentDate = map8(now2, toDateUtc2);
3209
+ var currentDate = map9(now2, toDateUtc2);
3209
3210
  function wallClockMillis() {
3210
3211
  return toEpochMillis2(nowUnsafe2());
3211
3212
  }
@@ -4249,7 +4250,7 @@ var RunCommandCenterSnapshot = Struct({
4249
4250
  var ReleaseChannels = ["stable", "next"];
4250
4251
  var ReleaseChannel = Literals(ReleaseChannels);
4251
4252
  var DefaultReleaseChannel = "stable";
4252
- var releaseVersion = (version) => {
4253
+ var releaseVersion2 = (version) => {
4253
4254
  const parts = /^v?(\d+)\.(\d+)\.(\d+)(?:-([^+]+))?(?:\+.*)?$/u.exec(version);
4254
4255
  if (parts === null)
4255
4256
  return;
@@ -4280,7 +4281,7 @@ var comparePrerelease = (a, b) => {
4280
4281
  return a.length - b.length;
4281
4282
  };
4282
4283
  var newerKitmanVersion = (candidate, running) => {
4283
- const [a, b] = [releaseVersion(candidate), releaseVersion(running)];
4284
+ const [a, b] = [releaseVersion2(candidate), releaseVersion2(running)];
4284
4285
  if (a === undefined || b === undefined)
4285
4286
  return true;
4286
4287
  const differing = a.numbers.findIndex((part, index) => part !== b.numbers[index]);
@@ -4289,7 +4290,7 @@ var newerKitmanVersion = (candidate, running) => {
4289
4290
  return (a.numbers[differing] ?? 0) > (b.numbers[differing] ?? 0);
4290
4291
  };
4291
4292
  var releaseChannelOffers = (channel, version) => {
4292
- const release = releaseVersion(version);
4293
+ const release = releaseVersion2(version);
4293
4294
  if (release === undefined)
4294
4295
  return false;
4295
4296
  return release.stable || channel === "next" && !release.devBuild;
@@ -4877,9 +4878,14 @@ function isSecretValueKey2(key) {
4877
4878
  }
4878
4879
 
4879
4880
  // packages/core/src/release-trigger.ts
4880
- var ReleaseTrigger = Literals(["merge", "milestone", "project"]);
4881
+ var ReleaseTrigger = Literals(["merge", "milestone", "project", "manual"]);
4881
4882
  var ReleaseTriggerLayer = Literals(["run", "project", "team", "workspace"]);
4882
- 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
+ });
4883
4889
  var ReleaseTriggerSetting = Struct({
4884
4890
  trigger: NullOr(ReleaseTrigger),
4885
4891
  resolved: optionalKey(ResolvedReleaseTrigger)
@@ -4887,13 +4893,21 @@ var ReleaseTriggerSetting = Struct({
4887
4893
  var ReleaseTriggerUpdate = Struct({
4888
4894
  trigger: NullOr(ReleaseTrigger)
4889
4895
  });
4896
+ var leadingFullSemver = /^(v?\d+\.\d+\.\d+)(?![\w.+]|-\w)/;
4897
+ var releaseVersion = (projectName) => leadingFullSemver.exec(projectName.trim())?.[1];
4890
4898
  var ReleaseScope = Struct({
4891
4899
  kind: Literals(["milestone", "project"]),
4892
4900
  projectId: String4,
4893
4901
  projectName: optionalKey(String4),
4894
4902
  milestoneId: optionalKey(String4),
4895
4903
  milestoneName: optionalKey(String4),
4896
- 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
+ }))
4897
4911
  });
4898
4912
  var ShippedScope = Struct({
4899
4913
  kind: Literals(["milestone", "project"]),
@@ -4923,6 +4937,158 @@ var EpicDelivery = Struct({
4923
4937
  own: optional(Boolean2)
4924
4938
  });
4925
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
+
4926
5092
  // packages/core/src/agent-sandbox-policy.ts
4927
5093
  var Path3 = String4.check(isMinLength(1));
4928
5094
  var AgentSandboxNetwork = Union([
@@ -5645,6 +5811,393 @@ var TokenTotalCount = String4.check(isPattern(/^(?:0|[1-9][0-9]*)$/));
5645
5811
  var TokenTotal = Struct({ input: TokenTotalCount, output: TokenTotalCount, cached: TokenTotalCount });
5646
5812
  var tokenCountWords = (count) => BigInt(count).toLocaleString("en-US");
5647
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
+
5648
6201
  // packages/core/src/test-report.ts
5649
6202
  var isTestReportName = (name) => /junit.*\.xml$/iu.test(name);
5650
6203
  var maxSkippedTests = 1e4;
@@ -6052,6 +6605,7 @@ var LoopSafeReferenceString = String4.check(isMinLength(1), isMaxLength(240), is
6052
6605
  var LoopSafeInternalReferenceString = String4.check(isMinLength(1), isMaxLength(240), isPattern(new RegExp(LoopSafeInternalReferencePattern, "u")));
6053
6606
  var loopSafeTextMaxLength = 4000;
6054
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;
6055
6609
  var reportedModelName = (named) => /^[A-Za-z0-9][\w.:/@+[\]-]{0,199}$/u.test(named) && is(LoopSafeText)(named) && redactCredentialText(named) === named ? named : undefined;
6056
6610
  var QuestionText = String4;
6057
6611
  var LoopSafeOutputDataString = String4.check(isMaxLength(4000), isPattern(new RegExp(LoopSafeInternalReferencePattern, "u")));
@@ -6368,7 +6922,13 @@ var RunWaiting = Union([
6368
6922
  kind: Literal("claim"),
6369
6923
  name: String4.check(isMinLength(1)),
6370
6924
  resource: String4.check(isMinLength(1)),
6371
- 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
+ }))
6372
6932
  }),
6373
6933
  Struct({
6374
6934
  kind: Literal("queue"),
@@ -6408,6 +6968,7 @@ var ApprovedVerification = Struct({
6408
6968
  workingDirectory: optionalKey(String4),
6409
6969
  pipeline: optionalKey(Boolean2),
6410
6970
  readsTarget: optionalKey(Boolean2),
6971
+ kind: optionalKey(Literal("command")),
6411
6972
  approvedByUserId: String4,
6412
6973
  createdAt: Timestamp
6413
6974
  });
@@ -6788,6 +7349,7 @@ var RunGraphNode = Struct({
6788
7349
  status: Literals(RunDisplayStates),
6789
7350
  startedAt: Timestamp,
6790
7351
  endedAt: optionalKey(Timestamp),
7352
+ outcome: optionalKey(String4),
6791
7353
  attempts: ArraySchema(Struct({
6792
7354
  id: Id,
6793
7355
  attempt: Int.check(isGreaterThanOrEqualTo(1)),
@@ -6808,9 +7370,20 @@ var RunGraphNode = Struct({
6808
7370
  task: optionalKey(Struct({ id: Id, key: String4, title: String4 }))
6809
7371
  }))
6810
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
+ });
6811
7382
  var RunGraph = Struct({
6812
7383
  columns: ArraySchema(ArraySchema(RunGraphNode)),
6813
- 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)
6814
7387
  });
6815
7388
  var RunHeader = Struct({
6816
7389
  loopTitle: String4,
@@ -6823,7 +7396,9 @@ var RunHeader = Struct({
6823
7396
  releaseWhen: optionalKey(ResolvedReleaseTrigger),
6824
7397
  releaseScope: optionalKey(ReleaseScope),
6825
7398
  deliversTo: optionalKey(ResolvedDeliveryTarget),
6826
- epic: optionalKey(EpicDelivery)
7399
+ epic: optionalKey(EpicDelivery),
7400
+ baseBranch: optionalKey(Struct({ branch: String4, layer: BaseBranchLayer })),
7401
+ inputSources: optionalKey(ArraySchema(InputSource))
6827
7402
  });
6828
7403
  var RunShow = Struct({
6829
7404
  run: Run,
@@ -6970,6 +7545,129 @@ var RunActionSummary = Struct({
6970
7545
  var RunActionList = Struct({ items: ArraySchema(RunActionSummary) });
6971
7546
  var RunActionTaken = Struct({ action: String4, run: Run });
6972
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
+
6973
7671
  // packages/core/src/work-unit.ts
6974
7672
  var WorkUnitLease = Struct({
6975
7673
  leaseOwnerId: Id,
@@ -6981,7 +7679,7 @@ var WorkUnitLease = Struct({
6981
7679
  leaseExpiresAt: Timestamp,
6982
7680
  lastHeartbeatAt: Timestamp
6983
7681
  });
6984
- var WorkUnitLeaseProjection = Struct(map9(WorkUnitLease.fields, optionalKey));
7682
+ var WorkUnitLeaseProjection = Struct(map10(WorkUnitLease.fields, optionalKey));
6985
7683
  var WorkUnitRepoBinding = Struct({
6986
7684
  id: Id,
6987
7685
  provider: RepoBindingProvider,
@@ -7020,6 +7718,31 @@ var SecretDestination = Struct({
7020
7718
  hosts: SecretHosts,
7021
7719
  version: String4.check(isMinLength(1), isMaxLength(128))
7022
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
+ });
7023
7746
  var AgentStepWorkUnit = Struct({
7024
7747
  kind: Literal("agent_step"),
7025
7748
  id: Id,
@@ -7042,6 +7765,8 @@ var AgentStepWorkUnit = Struct({
7042
7765
  secretDestinations: optionalKey(Record(String4, SecretDestination)),
7043
7766
  runBaseRevision: optionalKey(String4.check(isMinLength(1))),
7044
7767
  mergeTarget: optionalKey(String4.check(isMinLength(1))),
7768
+ applyChange: optionalKey(ResolvedChange),
7769
+ afterMerge: optionalKey(AfterMergeCommand),
7045
7770
  resumeNotes: optionalKey(ArraySchema(String4)),
7046
7771
  transcriptSequence: optionalKey(Int.check(isGreaterThanOrEqualTo(1))),
7047
7772
  storageOrigin: StorageOrigin
@@ -7057,6 +7782,7 @@ var OrchestrationWorkUnit = Struct({
7057
7782
  runId: Id,
7058
7783
  loopDigest: String4.check(isMinLength(64), isMaxLength(64), isPattern(new RegExp("^[a-f0-9]{64}$", "u"))),
7059
7784
  input: Unknown,
7785
+ context: optionalKey(RunContext),
7060
7786
  granted: ArraySchema(String4),
7061
7787
  lease: WorkUnitLease,
7062
7788
  journal: RunJournal,
@@ -7068,13 +7794,6 @@ var OrchestrationWorkUnit = Struct({
7068
7794
  })
7069
7795
  });
7070
7796
  var ProgramWorkUnit = OrchestrationWorkUnit.mapFields(omit(["program"]));
7071
- var CheckName = String4.check(isMinLength(1), isMaxLength(120), isPattern(new RegExp("^[A-Za-z0-9][A-Za-z0-9._:-]*$", "u")));
7072
- var ApprovedCheck = Struct({
7073
- name: CheckName,
7074
- command: String4.check(isMinLength(1), isMaxLength(2000)),
7075
- workingDirectory: optionalKey(String4.check(isMinLength(1), isMaxLength(500))),
7076
- suggested: optionalKey(Boolean2)
7077
- });
7078
7797
  var RepositoryCheck = Struct({
7079
7798
  ...ApprovedCheck.fields,
7080
7799
  pipeline: optionalKey(Boolean2),
@@ -7126,6 +7845,120 @@ var DeployOutcome = Struct({
7126
7845
  exitCode: optionalKey(Int),
7127
7846
  detail: String4.check(isMaxLength(1200))
7128
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
+ ]);
7129
7962
  var VerificationWorkUnit = Struct({
7130
7963
  kind: Literal("verification"),
7131
7964
  id: Id,
@@ -7140,6 +7973,9 @@ var VerificationWorkUnit = Struct({
7140
7973
  measure: optionalKey(MeasureSpec),
7141
7974
  resolve: optionalKey(ResolveSpec),
7142
7975
  deploy: optionalKey(DeployWork),
7976
+ versions: optionalKey(VersionsSpec),
7977
+ compare: optionalKey(CompareSpec),
7978
+ command: optionalKey(CommandWork),
7143
7979
  hosts: optionalKey(ArraySchema(NetworkHost)),
7144
7980
  storageOrigin: StorageOrigin
7145
7981
  });
@@ -7188,14 +8024,6 @@ var TreeEvidence = Struct({
7188
8024
  tree: String4.check(isMinLength(1), isMaxLength(120)),
7189
8025
  checks: ArraySchema(CheckEvidence).check(isMaxLength(50))
7190
8026
  });
7191
- var VerificationEvidence = Struct({
7192
- head: TreeEvidence,
7193
- baseline: optionalKey(TreeEvidence),
7194
- measurement: optionalKey(MeasureEvidence),
7195
- resolved: optionalKey(ResolvedRevisions),
7196
- deployed: optionalKey(DeployOutcome),
7197
- deployScriptFound: optionalKey(Literal(true))
7198
- });
7199
8027
  var BoundaryChange = Struct({
7200
8028
  kind: Literal("change"),
7201
8029
  changedPaths: ArraySchema(String4.check(isMinLength(1), isMaxLength(4096))).check(isMaxLength(1000)),
@@ -7208,6 +8036,19 @@ var BoundaryChange = Struct({
7208
8036
  })).check(isMaxLength(20)),
7209
8037
  truncated: Boolean2
7210
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
+ });
7211
8052
  var catchUpPathLimit = 200;
7212
8053
  var CatchUpPaths = ArraySchema(String4.check(isMinLength(1), isMaxLength(1000))).check(isMaxLength(catchUpPathLimit));
7213
8054
  var Revision = String4.check(isPattern(/^[0-9a-f]{40,64}$/));
@@ -7239,6 +8080,7 @@ var WorkUnitOutcome = Struct({
7239
8080
  catchUp: optionalKey(CatchUp),
7240
8081
  syncedTarget: optionalKey(Revision),
7241
8082
  cleanSync: optionalKey(Literals(["up_to_date", "merged"])),
8083
+ appliedChange: optionalKey(RunnerAppliedChange),
7242
8084
  harnessHold: optionalKey(HarnessHold),
7243
8085
  restart: optionalKey(StepRestart),
7244
8086
  tokens: optionalKey(AttemptTokens),
@@ -7518,7 +8360,11 @@ var RunnerCapabilities = Struct({
7518
8360
  resourceLimits: optionalKey(RunnerResourceLimits),
7519
8361
  measure: optionalKey(Boolean2),
7520
8362
  resolve: optionalKey(Boolean2),
7521
- deploy: optionalKey(Boolean2)
8363
+ deploy: optionalKey(Boolean2),
8364
+ versions: optionalKey(Boolean2),
8365
+ compare: optionalKey(Boolean2),
8366
+ command: optionalKey(Boolean2),
8367
+ applyChange: optionalKey(Boolean2)
7522
8368
  });
7523
8369
  var MaxRunnerConcurrency = 32;
7524
8370
  var PinnedImage = String4.check(isMaxLength(500), isPattern(new RegExp("^[^\\s@]+@sha256:[a-f0-9]{64}$", "u")));
@@ -8337,32 +9183,6 @@ function deliveryProviderActions(providerActions, delivery) {
8337
9183
  release: posture("release")
8338
9184
  };
8339
9185
  }
8340
- // packages/core/src/team-context.ts
8341
- var BranchTemplate = String4.check(isMinLength(1), isMaxLength(160));
8342
- var DeliveryMode = Literals(["gated", "auto"]);
8343
- var HoursPerPriorityLevel = Int.check(isGreaterThanOrEqualTo(1), isLessThanOrEqualTo(168));
8344
- var TeamDeliverySettings = Struct({
8345
- defaultRepoBindingId: optionalKey(Id),
8346
- standardBranchTemplate: BranchTemplate,
8347
- epicBranchTemplate: BranchTemplate,
8348
- isolatedChildBranchTemplate: BranchTemplate,
8349
- delivery: DeliveryMode,
8350
- hoursPerPriorityLevel: HoursPerPriorityLevel,
8351
- agentsStateScope: Boolean2,
8352
- revision: Int.check(isGreaterThanOrEqualTo(1))
8353
- });
8354
- var TeamDeliverySettingsUpdate = Struct({
8355
- defaultRepoBindingId: optionalKey(Union([Id, Null])),
8356
- standardBranchTemplate: optionalKey(BranchTemplate),
8357
- epicBranchTemplate: optionalKey(BranchTemplate),
8358
- isolatedChildBranchTemplate: optionalKey(BranchTemplate),
8359
- delivery: optionalKey(DeliveryMode),
8360
- hoursPerPriorityLevel: optionalKey(HoursPerPriorityLevel),
8361
- agentsStateScope: optionalKey(Boolean2),
8362
- expectedRevision: Int.check(isGreaterThanOrEqualTo(1))
8363
- });
8364
- var TeamReference = Struct({ id: Id, workspaceId: Id, key: String4, name: String4 });
8365
- var TeamReferenceList = Struct({ items: ArraySchema(TeamReference) });
8366
9186
  // packages/core/src/memory.ts
8367
9187
  var MemoryStatuses = ["proposed", "accepted", "rejected", "deprecated"];
8368
9188
  var MemoryStatus = Union([
@@ -9534,6 +10354,62 @@ class RunnerArtifactTrustError extends TaggedError("RunnerArtifactTrustError") {
9534
10354
  function sha2562(value) {
9535
10355
  return createHash("sha256").update(value, "utf8").digest("hex");
9536
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
+ });
9537
10413
  // packages/core/src/storage.ts
9538
10414
  var units = ["B", "KiB", "MiB", "GiB", "TiB"];
9539
10415
  var formatBytes = (bytes) => {
@@ -9691,8 +10567,6 @@ var StepRunFileRequest = Struct({
9691
10567
  sha256: String4.check(isPattern(/^[0-9a-f]{64}$/))
9692
10568
  });
9693
10569
  var RunFileSlotted = Struct({ file: RunFileRecord, upload: optionalKey(RunFileUpload) });
9694
- // packages/core/src/run-launch.ts
9695
- var repositoryKey = (url) => url.trim().toLowerCase().replace(/^[a-z+]+:\/\//, "").replace(/^[^@/]+@/, "").replace(/^([^/:]+):(?!\d+\/)/, "$1/").replace(/^([^/:]+):\d+\//, "$1/").replace(/\.git$/, "").replace(/\/+$/, "");
9696
10570
  // packages/core/src/resource-claim.ts
9697
10571
  var ResourceName = String4.check(isPattern(/^[a-z0-9][a-z0-9._:-]*$/u), isMinLength(1), isMaxLength(128));
9698
10572
  var ClaimHolder = Struct({
@@ -9711,20 +10585,35 @@ var ClaimResult = Union([
9711
10585
  }),
9712
10586
  Struct({ status: Literal("kept"), resource: ResourceName, holder: ClaimHolder })
9713
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
+ });
9714
10596
  var ResourceClaim = Struct({
9715
10597
  resource: ResourceName,
9716
- runId: Id,
9717
- loopId: String4,
9718
- runStatus: RunStatus,
9719
- claimedAt: Timestamp,
10598
+ runId: optionalKey(Id),
10599
+ loopId: optionalKey(String4),
10600
+ runStatus: optionalKey(RunStatus),
10601
+ claimedAt: optionalKey(Timestamp),
9720
10602
  keptAt: optionalKey(Timestamp),
9721
10603
  keptReason: optionalKey(String4),
10604
+ heldBy: optionalKey(ResourceHold),
9722
10605
  waiting: ArraySchema(Id)
9723
10606
  });
9724
10607
  var ResourceClaimList = Struct({ items: ArraySchema(ResourceClaim) });
9725
10608
  var ClaimRelease = Struct({
9726
10609
  reason: String4.check(isMinLength(1), isMaxLength(500))
9727
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);
9728
10617
  // packages/core/src/id.ts
9729
10618
  import { v7 as uuidv7 } from "uuid";
9730
10619
  function createId() {
@@ -9756,6 +10645,85 @@ function sha256Hasher() {
9756
10645
  digest: (encoding) => hash.digest(encoding)
9757
10646
  };
9758
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;
9759
10727
  // packages/core/src/transcript.ts
9760
10728
  var Text = String4.check(isMaxLength(200000));
9761
10729
  var AgentEvent = Union([
@@ -10321,7 +11289,7 @@ class WebHttpClientResponse extends Class {
10321
11289
  }
10322
11290
  textBody;
10323
11291
  get text() {
10324
- return this.textBody ??= map8(this.arrayBuffer, (_) => new TextDecoder().decode(_));
11292
+ return this.textBody ??= map9(this.arrayBuffer, (_) => new TextDecoder().decode(_));
10325
11293
  }
10326
11294
  get urlParamsBody() {
10327
11295
  return flatMap3(this.arrayBuffer, (bytes) => try_2({
@@ -10472,7 +11440,7 @@ var make27 = (f) => makeWith2((effect) => flatMap3(effect, (request) => withFibe
10472
11440
  if (tracerDisabled) {
10473
11441
  const effect = f(request, url, controller.signal, fiber);
10474
11442
  if (scopedController)
10475
- return map8(effect, (response) => trackResponse(response, controller, true));
11443
+ return map9(effect, (response) => trackResponse(response, controller, true));
10476
11444
  return uninterruptibleMask2((restore) => matchCauseEffect(restore(effect), {
10477
11445
  onSuccess(response) {
10478
11446
  return succeed6(trackResponse(response, controller, false));
@@ -10543,7 +11511,7 @@ var TracerPropagationEnabled = /* @__PURE__ */ Reference("effect/http/HttpClient
10543
11511
  var SpanNameGenerator = /* @__PURE__ */ Reference("effect/http/HttpClient/SpanNameGenerator", {
10544
11512
  defaultValue: () => (request) => request.method
10545
11513
  });
10546
- 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))))));
10547
11515
  var responseRegistry = /* @__PURE__ */ (() => {
10548
11516
  if ("FinalizationRegistry" in globalThis && globalThis.FinalizationRegistry) {
10549
11517
  const registry = /* @__PURE__ */ new FinalizationRegistry((controller) => {
@@ -10708,7 +11676,7 @@ var fetch2 = /* @__PURE__ */ make27((request, url, signal, fiber) => {
10708
11676
  }
10709
11677
  let uploadController;
10710
11678
  const stopUpload = sync2(() => uploadController?.abort());
10711
- const send = (body) => map8(tryPromise({
11679
+ const send = (body) => map9(tryPromise({
10712
11680
  try: () => fetch2(url, {
10713
11681
  ...options,
10714
11682
  method: request.method,
@@ -10879,7 +11847,7 @@ var layerWebSocketConstructorGlobal = /* @__PURE__ */ succeed5(WebSocketConstruc
10879
11847
  }
10880
11848
  return new globalThis.WebSocket(url, options);
10881
11849
  });
10882
- 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 : {
10883
11851
  protocols: options.protocols,
10884
11852
  headers: options.headers
10885
11853
  }))), (ws) => sync2(() => ws.close(1000))), options));
@@ -11514,7 +12482,7 @@ var effectMetrics = new Map(MetricDefinitions.map((definition) => {
11514
12482
  var processTelemetryRegistry = new Map;
11515
12483
  var processMetricRegistry = new Map;
11516
12484
  var collectorTimeout = "10 seconds";
11517
- 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, {
11518
12486
  duration: collectorTimeout,
11519
12487
  orElse: () => fail7(new HttpClientError({
11520
12488
  reason: new TransportError({
@@ -11555,6 +12523,60 @@ var choiceWords = (choice, unnamedModel) => [
11555
12523
  ...choice.effort === undefined ? [] : [`${choice.effort} effort`]
11556
12524
  ].join(" \xB7 ");
11557
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
+ };
11558
12580
  // packages/core/src/kit.ts
11559
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")));
11560
12582
  var KitDigest = String4.check(isPattern(new RegExp("^[a-f0-9]{64}$", "u")));
@@ -11694,6 +12716,164 @@ var DeployBindingCreate = Struct({
11694
12716
  });
11695
12717
  var DeployBindingList = Struct({ items: ArraySchema(DeployBinding) });
11696
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);
11697
12877
  // packages/core/src/kit-setup.ts
11698
12878
  var KitSetup = Struct({
11699
12879
  ...AgentEnvironmentFragment.fields,
@@ -12216,6 +13396,9 @@ class KitmanEffectClient {
12216
13396
  headers: this.headers()
12217
13397
  });
12218
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
+ }
12219
13402
  listProjectTasks(workspaceId, projectId) {
12220
13403
  return this.request("listProjectTasks", `/workspaces/${segment(workspaceId)}/projects/${segment(projectId)}/tasks`, {
12221
13404
  headers: this.headers()
@@ -12413,6 +13596,19 @@ class KitmanEffectClient {
12413
13596
  body: JSON.stringify(input)
12414
13597
  });
12415
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
+ }
12416
13612
  uploadKitBundle(workspaceId, digest, input) {
12417
13613
  return this.request("uploadKitBundle", `/workspaces/${segment(workspaceId)}/kit-bundles/${segment(digest)}`, {
12418
13614
  method: "PUT",
@@ -12582,6 +13778,36 @@ class KitmanEffectClient {
12582
13778
  body: JSON.stringify(input)
12583
13779
  });
12584
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
+ }
12585
13811
  getChangeRequest(changeRequestId) {
12586
13812
  return this.request("getChangeRequest", `/change-requests/${segment(changeRequestId)}`, { headers: this.headers() });
12587
13813
  }
@@ -12795,6 +14021,15 @@ class KitmanEffectClient {
12795
14021
  body: JSON.stringify(input)
12796
14022
  });
12797
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
+ }
12798
14033
  listAutomaticStarts(teamId, options = {}) {
12799
14034
  return this.request("listAutomaticStarts", `/teams/${segment(teamId)}/automatic-starts${limitQuery(options.limit)}`, { headers: this.headers() });
12800
14035
  }
@@ -12947,6 +14182,28 @@ class KitmanEffectClient {
12947
14182
  setProjectReleaseTrigger(workspaceId, projectId, input) {
12948
14183
  return this.request("setProjectReleaseTrigger", `/workspaces/${segment(workspaceId)}/projects/${segment(projectId)}/release-trigger`, { method: "PUT", headers: this.headers(true), body: JSON.stringify(input) });
12949
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
+ }
12950
14207
  getWorkspaceDeliveryTarget(workspaceId) {
12951
14208
  return this.request("getWorkspaceDeliveryTarget", `/workspaces/${segment(workspaceId)}/delivery-target`, {
12952
14209
  headers: this.headers()
@@ -13434,7 +14691,7 @@ class KitmanEffectClient {
13434
14691
  return tryPromise({
13435
14692
  try: () => this.fetchImpl(this.url(path), { ...init, headers, signal: abort.signal }),
13436
14693
  catch: failed
13437
- }).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())));
13438
14695
  });
13439
14696
  const response = yield* method !== "GET" ? send.pipe(retry({ schedule: unansweredGetRetry, times: 5, while: refusedConnection })) : sendAndRead.pipe(timeoutOrElse({
13440
14697
  duration: getAnswerTimeout,
@@ -13496,8 +14753,8 @@ class KitmanEffectClient {
13496
14753
  function errorResponseDetails(response) {
13497
14754
  const contentType = response.headers.get("content-type") ?? "";
13498
14755
  if (contentType.includes("application/json"))
13499
- return tryPromise(() => response.json()).pipe(map8(parseErrorResponse), orElseSucceed(() => ({})));
13500
- return tryPromise(() => response.text()).pipe(map8((text) => {
14756
+ return tryPromise(() => response.json()).pipe(map9(parseErrorResponse), orElseSucceed(() => ({})));
14757
+ return tryPromise(() => response.text()).pipe(map9((text) => {
13501
14758
  const message = sanitizeErrorDetail(text);
13502
14759
  return message === undefined ? {} : { message };
13503
14760
  }), orElseSucceed(() => ({})));
@@ -13588,6 +14845,33 @@ function taskExecutionRecordQuery(options) {
13588
14845
  search.set("cursor", options.cursor);
13589
14846
  return search.size === 0 ? "" : `?${search.toString()}`;
13590
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
+ };
13591
14875
  function scopeQuery(options) {
13592
14876
  return options.teamId === undefined ? "" : `?${new URLSearchParams({ teamId: options.teamId }).toString()}`;
13593
14877
  }
@@ -13794,13 +15078,13 @@ function resolveConfig(input) {
13794
15078
  ...userAgentPreferences === undefined ? undefined : { userAgentPreferences }
13795
15079
  };
13796
15080
  }
13797
- var apiUrlFromEnv = String2("KITMAN_API_URL").pipe(option, map8(getOrUndefined));
13798
- var stepCredentialFromEnv = String2("KITMAN_STEP_CREDENTIAL").pipe(option, map8(getOrUndefined));
13799
- var stepWorkspaceFromEnv = String2("KITMAN_STEP_WORKSPACE").pipe(option, map8(getOrUndefined));
13800
- var stepSkillsDirFromEnv = String2("KITMAN_STEP_SKILLS_DIR").pipe(option, map8(getOrUndefined));
13801
- var stepFittingSkillsFromEnv = String2("KITMAN_STEP_FITTING_SKILLS").pipe(option, map8((names) => getOrElse(names, () => "").split(",").filter((name) => name !== "")));
13802
- var stepOutputOnlyFromEnv = String2("KITMAN_STEP_TOOLS").pipe(option, map8((tools) => getOrUndefined(tools) === "output"));
13803
- 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));
13804
15088
  var kitmanConfigDir = gen(function* () {
13805
15089
  const path = yield* Path;
13806
15090
  const xdgConfigHome = yield* String2("XDG_CONFIG_HOME").pipe(option);
@@ -13818,7 +15102,7 @@ var userHarnessSyncPath = configFile("harness-sync.json");
13818
15102
  var kitSetupCacheDir = configFile("kit-setups");
13819
15103
  var bundleCacheDir = configFile("bundles");
13820
15104
  var runnerReleaseChannelPath = (runnerId) => configFile(`runner-release-channels/${runnerId}`);
13821
- var localConfigPath = Path.pipe(map8((path) => path.resolve(".kitman/config.json")));
15105
+ var localConfigPath = Path.pipe(map9((path) => path.resolve(".kitman/config.json")));
13822
15106
  function readUserConfig(path) {
13823
15107
  return gen(function* () {
13824
15108
  const filePath = path ?? (yield* userConfigPath);
@@ -13978,7 +15262,7 @@ function sessionForApi(auth, apiUrl) {
13978
15262
  return auth.sessions[normalizeApiUrl(apiUrl)];
13979
15263
  }
13980
15264
  function readAuthStore(path) {
13981
- 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: {} })));
13982
15266
  }
13983
15267
  function writeAuthStore(auth, path) {
13984
15268
  return writeUserAuth(auth, path);
@@ -14492,7 +15776,7 @@ class RunnerAuthentication extends Service()("RunnerAuthentication", {
14492
15776
  error: RunnerRpcError
14493
15777
  }) {
14494
15778
  }
14495
- var EventFilterValue = Union([String4, Finite, Boolean2, Null]);
15779
+ var EventFilterValue2 = Union([String4, Finite, Boolean2, Null]);
14496
15780
  var WorkAvailable = TaggedStruct("WorkAvailable", {});
14497
15781
  var LeaseRevoked = TaggedStruct("LeaseRevoked", { workUnitId: String4 });
14498
15782
  var Settled = TaggedStruct("Settled", { workUnitId: String4 });
@@ -14649,6 +15933,11 @@ class RunnerJournalRpcs extends make7(make6("RecordActivity", {
14649
15933
  error: RunnerRpcError
14650
15934
  }), make6("Suspend", { payload: { lease: ProgramLease }, error: RunnerRpcError }), make6("FinishProgram", { payload: { lease: ProgramLease, outcome: ProgramOutcome }, error: RunnerRpcError })).middleware(RunnerAuthentication) {
14651
15935
  }
15936
+ var RunHostStep = make6("RunHostStep", {
15937
+ payload: { lease: ProgramLease, step: String4, hostStep: String4, request: Json },
15938
+ success: Json,
15939
+ error: RunnerRpcError
15940
+ });
14652
15941
 
14653
15942
  class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14654
15943
  payload: {
@@ -14682,7 +15971,8 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14682
15971
  outputSchema: Json,
14683
15972
  secrets: optionalKey(ArraySchema(String4)),
14684
15973
  timeoutMillis: optionalKey(Int),
14685
- mergeTarget: optionalKey(String4.check(isMinLength(1)))
15974
+ mergeTarget: optionalKey(String4.check(isMinLength(1))),
15975
+ applyChange: optionalKey(Struct({ changeRequestId: String4, revert: optionalKey(Boolean2) }))
14686
15976
  },
14687
15977
  success: Struct({ stepAttemptId: String4 }),
14688
15978
  error: RunnerRpcError
@@ -14703,7 +15993,10 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14703
15993
  calibrate: Boolean2
14704
15994
  })),
14705
15995
  resolve: optionalKey(ResolveSpec),
14706
- deploy: optionalKey(DeploySpec)
15996
+ deploy: optionalKey(DeploySpec),
15997
+ versions: optionalKey(VersionsSpec),
15998
+ compare: optionalKey(CompareSpec),
15999
+ command: optionalKey(CommandSpec)
14707
16000
  },
14708
16001
  success: Struct({ verificationId: String4 }),
14709
16002
  error: RunnerRpcError
@@ -14713,12 +16006,12 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14713
16006
  step: String4,
14714
16007
  deferredName: String4,
14715
16008
  event: String4,
14716
- filter: optional(Record(String4, Union([EventFilterValue, ArraySchema(EventFilterValue)]))),
16009
+ filter: optional(Record(String4, Union([EventFilterValue2, ArraySchema(EventFilterValue2)]))),
14717
16010
  timeoutMillis: Int,
14718
16011
  since: optionalKey(String4),
14719
16012
  or: optionalKey(ArraySchema(Struct({
14720
16013
  event: String4,
14721
- filter: optionalKey(Record(String4, Union([EventFilterValue, ArraySchema(EventFilterValue)]))),
16014
+ filter: optionalKey(Record(String4, Union([EventFilterValue2, ArraySchema(EventFilterValue2)]))),
14722
16015
  since: optionalKey(String4)
14723
16016
  })))
14724
16017
  },
@@ -14729,7 +16022,9 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14729
16022
  step: String4,
14730
16023
  deferredName: String4,
14731
16024
  resource: ResourceName,
14732
- action: Literals(["claim", "take_over", "let_go"])
16025
+ action: Literals(["claim", "take_over", "let_go"]),
16026
+ changeRequestId: optionalKey(String4),
16027
+ claims: optionalKey(ArraySchema(String4))
14733
16028
  },
14734
16029
  error: RunnerRpcError
14735
16030
  }), make6("AdmitChild", {
@@ -14743,6 +16038,28 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14743
16038
  },
14744
16039
  success: Struct({ runId: String4 }),
14745
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
14746
16063
  }), make6("StoreArtifact", {
14747
16064
  payload: {
14748
16065
  lease: ProgramLease,
@@ -14846,7 +16163,12 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14846
16163
  }),
14847
16164
  error: RunnerRpcError
14848
16165
  }), make6("PipelineStatus", {
14849
- payload: { lease: ProgramLease, step: String4, changeRequestId: String4 },
16166
+ payload: {
16167
+ lease: ProgramLease,
16168
+ step: String4,
16169
+ changeRequestId: String4,
16170
+ behind: optionalKey(Literal(true))
16171
+ },
14850
16172
  success: Struct({
14851
16173
  head: String4,
14852
16174
  status: Literals(["none", "running", "success", "failed", "canceled"]),
@@ -14867,6 +16189,7 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14867
16189
  targetBranch: optionalKey(String4),
14868
16190
  conflicts: optionalKey(Boolean2),
14869
16191
  needsRebase: optionalKey(Boolean2),
16192
+ behind: optionalKey(Boolean2),
14870
16193
  target: optionalKey(Struct({
14871
16194
  branch: String4,
14872
16195
  head: String4,
@@ -15018,6 +16341,44 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
15018
16341
  payload: { lease: ProgramLease },
15019
16342
  success: Struct({ repoBindingId: String4, branch: String4, revision: String4 }),
15020
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
15021
16382
  }), make6("MergeChangeRequest", {
15022
16383
  payload: {
15023
16384
  lease: ProgramLease,
@@ -15080,11 +16441,33 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
15080
16441
  tag: String4,
15081
16442
  revision: optionalKey(String4),
15082
16443
  title: String4,
15083
- notes: String4
16444
+ notes: String4,
16445
+ prerelease: optionalKey(Boolean2),
16446
+ previousTag: optionalKey(NullOr(String4))
15084
16447
  },
15085
16448
  success: Struct({ tag: String4, revision: String4, url: String4 }),
15086
16449
  error: RunnerRpcError
15087
- }), 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", {
15088
16471
  payload: { lease: ProgramLease },
15089
16472
  success: Record(String4, String4),
15090
16473
  error: RunnerRpcError
@@ -15333,7 +16716,7 @@ var refreshFailure = (error) => new KitmanClientError({
15333
16716
  status: (error instanceof CliError ? error.status : undefined) ?? 503
15334
16717
  });
15335
16718
  function refreshSession(input) {
15336
- 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)));
15337
16720
  return withAuthLock(input.authPath, gen(function* () {
15338
16721
  const stored = yield* storedSession;
15339
16722
  if (!stored)
@@ -15348,7 +16731,7 @@ function refreshSession(input) {
15348
16731
  clientId: input.clientId ?? ClientId,
15349
16732
  refreshToken: spentToken,
15350
16733
  ...input.fetch ? { fetch: input.fetch } : undefined
15351
- }).pipe(map8((token) => toStoredSession(token, spentToken)));
16734
+ }).pipe(map9((token) => toStoredSession(token, spentToken)));
15352
16735
  const session = yield* refreshing.pipe(catch_((error) => storedSession.pipe(filterOrFail((current) => current !== undefined && current.refreshToken !== spentToken, () => error))), mapError2(expiredIfRefused));
15353
16736
  const current = yield* storedSession;
15354
16737
  if (current?.refreshToken !== spentToken)
@@ -15803,9 +17186,9 @@ var herdrCoreOver = (transport) => ({
15803
17186
  ...input.name === undefined ? undefined : { name: input.name },
15804
17187
  no_parent: input.noParent === true
15805
17188
  }),
15806
- 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)),
15807
17190
  get: (terminal) => request("terminal.get", Terminal2, { terminal }),
15808
- 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)),
15809
17192
  interrupt: (terminal, options = {}) => request("terminal.interrupt", Interrupted, {
15810
17193
  terminal,
15811
17194
  ...options.timeoutSeconds === undefined ? undefined : { timeout: options.timeoutSeconds }
@@ -15868,7 +17251,7 @@ var coreEnv = (options) => {
15868
17251
  const env = Object.fromEntries(Object.entries(options.env ?? process.env).filter((entry) => entry[0] !== "HC_SESSION" && entry[1] !== undefined));
15869
17252
  return options.session === undefined ? env : { ...env, HC_SESSION: options.session };
15870
17253
  };
15871
- 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)))));
15872
17255
  var herdrCoreTransportLayer2 = (transport) => succeed5(HerdrCore2, herdrCoreOver(transport));
15873
17256
  var UpdateRefused = Struct({
15874
17257
  error: Struct({ message: String4, hint: optionalKey(String4) })
@@ -15891,13 +17274,13 @@ var updateHerdrCore2 = (options) => gen(function* () {
15891
17274
  ], { concurrency: 3 });
15892
17275
  return { stdout, stderr, exitCode };
15893
17276
  }).pipe(scoped, catchReason("PlatformError", "NotFound", () => fail7(new HerdrCoreMissing2)));
15894
- 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({
15895
17278
  duration: options.timeout,
15896
17279
  orElse: () => succeed6(`it did not finish within ${options.timeout}`)
15897
17280
  }));
15898
17281
  if (reason === undefined)
15899
17282
  return;
15900
- 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"));
15901
17284
  return yield* new HerdrCoreUpdateFailed2({ version, reason: reason.slice(0, 400) });
15902
17285
  });
15903
17286
 
@@ -15990,7 +17373,7 @@ var detectHarnesses2 = gen(function* () {
15990
17373
  const home = (yield* optionalEnv("HOME")) ?? "/";
15991
17374
  const searchPath = ((yield* optionalEnv("PATH")) ?? "").split(":").filter(Boolean);
15992
17375
  const exists = (file) => fs.exists(file).pipe(orElseSucceed(() => false));
15993
- const any = (items, test) => map8(findFirst(items, test), isSome);
17376
+ const any = (items, test) => map9(findFirst(items, test), isSome);
15994
17377
  const loginFound = (login) => gen(function* () {
15995
17378
  const file = path.join(home, login.path);
15996
17379
  if (!(yield* exists(file)))
@@ -16007,7 +17390,7 @@ var detectHarnesses2 = gen(function* () {
16007
17390
  unavailable.push({ harness: harness.id, missing: [`\`${binary}\` is not installed`] });
16008
17391
  continue;
16009
17392
  }
16010
- 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));
16011
17394
  if (loggedIn)
16012
17395
  harnesses.push(harness.id);
16013
17396
  else
@@ -16406,7 +17789,11 @@ function herdrRunnerCapabilities2(input) {
16406
17789
  resourceLimits: { maxConcurrentRuns: 1, maxRunSeconds: 86400 },
16407
17790
  measure: true,
16408
17791
  resolve: true,
16409
- deploy: true
17792
+ deploy: true,
17793
+ versions: true,
17794
+ compare: true,
17795
+ command: true,
17796
+ applyChange: true
16410
17797
  };
16411
17798
  }
16412
17799
  function assertHerdrRunnerCapability2(capabilities) {
@@ -16452,4 +17839,4 @@ function serviceChecks(declaration) {
16452
17839
  return decoded === undefined || decoded.services.length === 0 ? [] : [...new Set(decoded.checks ?? [])];
16453
17840
  }
16454
17841
 
16455
- 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, 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, LoopDescription, 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 };