@kitman-sh/cli 0.13.16 → 0.13.18

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.
@@ -923,7 +923,7 @@ A Team view has three tabs: Active shows unstarted and started Tasks, Backlog th
923
923
 
924
924
  Press **C** or use **New task** in a Team view. A title is enough; everything else is optional. Keep the form open to capture several Tasks in a row. Filing a Task in a Team you are not a member of sends it to that Team's [Triage](/docs/triage).
925
925
 
926
- Open a Task beside its list, or on its own page. The description is markdown and saves as you type. If someone else changes it while you edit, Kitman tells you instead of overwriting their work. The Promise is one sentence that says what is true once the Task is done. Acceptance Criteria are an ordered list that reviews and Runs hold the work to. Out of scope lists the cases the Task does not handle. All three are optional.
926
+ Open a Task beside its list, or on its own page. The description is markdown and saves as you type. If someone else changes it while you edit, Kitman tells you instead of overwriting their work. The Promise is one sentence that says what is true once the Task is done. Acceptance Criteria are an ordered list that reviews and Runs hold the work to. Out of scope lists the cases the Task does not handle: outside a private Team, a review reports a problem in one without holding the change, unless it is a blocker. All three are optional.
927
927
 
928
928
  A Team can require agents to state a Task's scope. An owner or admin turns on **Agents must state a Task's scope** under **Settings**, **Forges**, **Edit delivery**, or a signed-in person with access to the Team runs \`kitman team scope <team> required\`; an agent cannot change it. A Task an agent creates without a Promise is then refused with [how to scope a Task](/docs/scope-tasks), and it creates the Task again with one. A Task from a person, an Event, an alert, launch words, a plan ticket or a Proposal a person approves needs none.
929
929
 
@@ -1555,7 +1555,7 @@ var pathOfLink = (link) => {
1555
1555
  return page === null ? link : page[1] || "index";
1556
1556
  };
1557
1557
  var UnpinnedSdkLink = "https://cdn.jsdelivr.net/npm/@kitman-sh/sdk/";
1558
- var pinnedLink2 = (link, version = "0.13.16") => version === undefined || !link.startsWith(UnpinnedSdkLink) ? link : link.replace(UnpinnedSdkLink, `https://cdn.jsdelivr.net/npm/@kitman-sh/sdk@${version}/`);
1558
+ var pinnedLink2 = (link, version = "0.13.18") => version === undefined || !link.startsWith(UnpinnedSdkLink) ? link : link.replace(UnpinnedSdkLink, `https://cdn.jsdelivr.net/npm/@kitman-sh/sdk@${version}/`);
1559
1559
  var pageOf = (path) => path.split("#")[0];
1560
1560
  var exportName = (section) => section.path.startsWith("sdk/") ? section.path.split("#")[1] ?? "" : "";
1561
1561
  function excerpt(text, queryTerms) {
@@ -1,13 +1,4 @@
1
1
  // @bun
2
- import {
3
- unwrap,
4
- drainFork,
5
- decodeText,
6
- splitLines,
7
- runCollect,
8
- runDrain,
9
- mkString
10
- } from "./chunk-nf9gdnsf.js";
11
2
  import {
12
3
  isString,
13
4
  hasProperty,
@@ -32,6 +23,15 @@ import {
32
23
  raceFirst,
33
24
  scoped
34
25
  } from "./chunk-zw3gf6r5.js";
26
+ import {
27
+ unwrap,
28
+ drainFork,
29
+ decodeText,
30
+ splitLines,
31
+ runCollect,
32
+ runDrain,
33
+ mkString
34
+ } from "./chunk-hakqpy8z.js";
35
35
 
36
36
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/redacted.js
37
37
  var redactedRegistry = /* @__PURE__ */ new WeakMap;
@@ -1,31 +1,4 @@
1
1
  // @bun
2
- import {
3
- Clock,
4
- empty,
5
- fromInput,
6
- merge,
7
- Socket,
8
- SocketReadError,
9
- SocketError,
10
- isStreamSchema,
11
- getStreamSchemas,
12
- exitSchema,
13
- ParseOptions,
14
- RpcClientDefect,
15
- RpcClientError
16
- } from "./chunk-zd6y6ka8.js";
17
- import {
18
- interrupt,
19
- getCurrent,
20
- makeUnsafe2,
21
- bounded,
22
- offerAll,
23
- failCause,
24
- end,
25
- shutdownUnsafe,
26
- fromQueue,
27
- unwrap
28
- } from "./chunk-nf9gdnsf.js";
29
2
  import {
30
3
  dual,
31
4
  identity,
@@ -124,6 +97,33 @@ import {
124
97
  Exit,
125
98
  toCodecJson
126
99
  } from "./chunk-zw3gf6r5.js";
100
+ import {
101
+ interrupt,
102
+ getCurrent,
103
+ makeUnsafe2,
104
+ bounded,
105
+ offerAll,
106
+ failCause,
107
+ end,
108
+ shutdownUnsafe,
109
+ fromQueue,
110
+ unwrap
111
+ } from "./chunk-hakqpy8z.js";
112
+ import {
113
+ Clock,
114
+ empty,
115
+ fromInput,
116
+ merge,
117
+ Socket,
118
+ SocketReadError,
119
+ SocketError,
120
+ isStreamSchema,
121
+ getStreamSchemas,
122
+ exitSchema,
123
+ ParseOptions,
124
+ RpcClientDefect,
125
+ RpcClientError
126
+ } from "./chunk-bc8ytp0y.js";
127
127
 
128
128
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/workers/Transferable.js
129
129
  class Collector extends (/* @__PURE__ */ Service2()("effect/workers/Transferable/Collector")) {
@@ -1,4 +1,9 @@
1
1
  // @bun
2
+ import {
3
+ make11,
4
+ runForEach,
5
+ compiled2
6
+ } from "./chunk-hakqpy8z.js";
2
7
  import {
3
8
  getOrUndefined,
4
9
  liftThrowable,
@@ -26,15 +31,10 @@ import {
26
31
  isString2,
27
32
  encodeUnknownJsonStringSync
28
33
  } from "./chunk-zw3gf6r5.js";
29
- import {
30
- make11,
31
- runForEach,
32
- compiled2
33
- } from "./chunk-nf9gdnsf.js";
34
34
  import {
35
35
  ChildProcessSpawner,
36
36
  make3
37
- } from "./chunk-vsrjg9nm.js";
37
+ } from "./chunk-84xks8tn.js";
38
38
 
39
39
  // packages/agent-runtime/src/opencode-store.ts
40
40
  import { lstatSync, readFileSync, realpathSync } from "fs";
@@ -1,17 +1,4 @@
1
1
  // @bun
2
- import {
3
- isDateTime,
4
- Numeric,
5
- isWholeNumber,
6
- guard,
7
- Id,
8
- Timestamp,
9
- ActorType,
10
- SecretName,
11
- SecretScope,
12
- SecretHosts,
13
- isSecretReference
14
- } from "./chunk-q5w3v4k1.js";
15
2
  import {
16
3
  pipeArguments,
17
4
  dual,
@@ -279,6 +266,7 @@ import {
279
266
  import {
280
267
  map,
281
268
  makeEquivalence,
269
+ toNumber,
282
270
  bytes,
283
271
  BadArgument,
284
272
  systemError,
@@ -342,7 +330,20 @@ import {
342
330
  String2,
343
331
  optionalEnv,
344
332
  harnessesUnsupportedInSrt2
345
- } from "./chunk-nf9gdnsf.js";
333
+ } from "./chunk-hakqpy8z.js";
334
+ import {
335
+ isDateTime,
336
+ Numeric,
337
+ isWholeNumber,
338
+ guard,
339
+ Id,
340
+ Timestamp,
341
+ ActorType,
342
+ SecretName,
343
+ SecretScope,
344
+ SecretHosts,
345
+ isSecretReference
346
+ } from "./chunk-q5w3v4k1.js";
346
347
  import {
347
348
  isRedacted,
348
349
  make,
@@ -356,7 +357,7 @@ import {
356
357
  make3,
357
358
  parseFdName,
358
359
  fdName
359
- } from "./chunk-vsrjg9nm.js";
360
+ } from "./chunk-84xks8tn.js";
360
361
 
361
362
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Tuple.js
362
363
  var makeEquivalence3 = Tuple;
@@ -898,15 +899,6 @@ var runMain2 = /* @__PURE__ */ makeRunMain(({
898
899
  // node_modules/.bun/@effect+platform-bun@4.1.2+edf248c88a527e3e/node_modules/@effect/platform-bun/dist/BunRuntime.js
899
900
  var runMain = runMain2;
900
901
 
901
- // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/BigInt.js
902
- var BigInt2 = globalThis.BigInt;
903
- var toNumber = (b) => {
904
- if (b > BigInt2(Number.MAX_SAFE_INTEGER) || b < BigInt2(Number.MIN_SAFE_INTEGER)) {
905
- return none();
906
- }
907
- return some(Number(b));
908
- };
909
-
910
902
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/DateTime.js
911
903
  var makeUnsafe = makeUnsafe6;
912
904
  var make18 = make4;
@@ -5638,6 +5630,188 @@ var TokenTotalCount = String4.check(isPattern(/^(?:0|[1-9][0-9]*)$/));
5638
5630
  var TokenTotal = Struct({ input: TokenTotalCount, output: TokenTotalCount, cached: TokenTotalCount });
5639
5631
  var tokenCountWords = (count) => BigInt(count).toLocaleString("en-US");
5640
5632
 
5633
+ // packages/core/src/test-report.ts
5634
+ var isTestReportName = (name) => /junit.*\.xml$/iu.test(name);
5635
+ var maxSkippedTests = 1e4;
5636
+ var maxRanDigests = 1e5;
5637
+ var TestId = String4.check(isMinLength(1), isMaxLength(1000));
5638
+ var maxFailedTests = 50;
5639
+ var maxFailedTestLength = 300;
5640
+ var FailedTests = ArraySchema(String4.check(isMinLength(1), isMaxLength(maxFailedTestLength))).check(isMaxLength(maxFailedTests));
5641
+ var EnvironmentFailure = Struct({
5642
+ failedTests: optionalKey(FailedTests),
5643
+ exitCode: optionalKey(Int),
5644
+ outputTail: optionalKey(String4.check(isMaxLength(8000))),
5645
+ retryFailedTests: optionalKey(FailedTests)
5646
+ });
5647
+ var CheckTests = Struct({
5648
+ reports: Int.check(isGreaterThanOrEqualTo(0)),
5649
+ passed: Int.check(isGreaterThanOrEqualTo(0)),
5650
+ failed: Int.check(isGreaterThanOrEqualTo(0)),
5651
+ skipped: Int.check(isGreaterThanOrEqualTo(0)),
5652
+ skippedTests: ArraySchema(TestId).check(isMaxLength(maxSkippedTests)),
5653
+ ranDigests: ArraySchema(String4.check(isMaxLength(16))).check(isMaxLength(maxRanDigests)),
5654
+ failedTests: optionalKey(FailedTests),
5655
+ environmentFailure: optionalKey(EnvironmentFailure),
5656
+ environmentJudged: optionalKey(Boolean2)
5657
+ });
5658
+ var entities = new Map([
5659
+ ["amp", "&"],
5660
+ ["lt", "<"],
5661
+ ["gt", ">"],
5662
+ ["quot", '"'],
5663
+ ["apos", "'"]
5664
+ ]);
5665
+ var codePoint = (whole, value) => value <= 1114111 ? String.fromCodePoint(value) : whole;
5666
+ var decoded = (text) => text.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/giu, (whole, entity) => {
5667
+ if (entity.startsWith("#x") || entity.startsWith("#X"))
5668
+ return codePoint(whole, Number.parseInt(entity.slice(2), 16));
5669
+ if (entity.startsWith("#"))
5670
+ return codePoint(whole, Number(entity.slice(1)));
5671
+ return entities.get(entity) ?? whole;
5672
+ });
5673
+ var attribute = (attributes, name) => {
5674
+ const found = new RegExp(`(?:^|\\s)${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, "u").exec(attributes);
5675
+ return found === null ? undefined : decoded(found[1] ?? found[2] ?? "");
5676
+ };
5677
+ var junitTestCases = (xml) => [...xml.matchAll(/<testcase\b([^>]*?)(?:\/>|>([\s\S]*?)<\/testcase>)/gu)].map(([, attributes = "", body = ""]) => {
5678
+ const id = [attribute(attributes, "file"), attribute(attributes, "classname"), attribute(attributes, "name")].filter((part) => part !== undefined && part !== "").join(" > ");
5679
+ return {
5680
+ id: id.slice(0, 1000) || "(unnamed test)",
5681
+ status: /<(?:failure|error)\b/u.test(body) ? "failed" : /<skipped\b/u.test(body) ? "skipped" : "passed"
5682
+ };
5683
+ });
5684
+ var fnv1a = (text, seed) => {
5685
+ let hash = seed;
5686
+ for (let index = 0;index < text.length; index++) {
5687
+ hash ^= text.charCodeAt(index);
5688
+ hash = Math.imul(hash, 16777619) >>> 0;
5689
+ }
5690
+ return hash.toString(16).padStart(8, "0");
5691
+ };
5692
+ var testDigest = (id) => `${fnv1a(id, 2166136261)}${fnv1a(id, 84696351)}`;
5693
+ var scriptPrefix = /^(?:[^|]{1,300} \| |\S+ [\w:.-]+: )/u;
5694
+ var failedTestLines = [
5695
+ /^\(fail\) (.+?)(?: \[[\d.]+ ?m?s\])?$/su,
5696
+ /^\u25CF (?=.+? \u203A .)(.+)$/su,
5697
+ /^FAILED (\S+?::(?:[^[]+?(?:\[.*?\])?|.+?))(?: - .*)?$/su,
5698
+ /^--- FAIL: (\S+)/u,
5699
+ /^test (.+) \.\.\. FAILED$/su,
5700
+ /^not ok \d+ (?:- )?(?!.*# (?:TODO|SKIP)\b)(.+)$/isu
5701
+ ];
5702
+ var failedFileStart = String.raw`FAIL +(?:\|[^|]+\| *)?(?! )(?!\S*:\/\/)`;
5703
+ var afterPath = String.raw` > | \[ `;
5704
+ var failedFilePaths = [
5705
+ String.raw`\S*\.[A-Za-z]\w*(?=[\s:]|$)`,
5706
+ String.raw`(?=\S*[A-Za-z])(?=\S*\/)\S+(?=${afterPath}|$)`,
5707
+ String.raw`(?:(?!${afterPath}).)*\.[A-Za-z]\w*(?=${afterPath})`,
5708
+ String.raw`(?=\S*\/)(?:(?!${afterPath}).)*\.[A-Za-z]\w*$`,
5709
+ String.raw`(?=.*(?:\.(?:test|spec)\.|\b__tests__\/))(?:(?!${afterPath}).)*\.[cm]?[jt]sx?$`
5710
+ ];
5711
+ var failedFileLine = new RegExp(`^${failedFileStart}((?:${failedFilePaths.join("|")}).*)$`, "su");
5712
+ var jestFileStats = /^((?:(?! > ).)*) \((?:[\d.]+ m?s(?:, \d+ MB heap size)?|\d+ MB heap size)\)$/su;
5713
+ var isPathOf = (file, path) => `/${file}`.endsWith(`/${path.replace(/^(?:\.\.\/)+/u, "")}`);
5714
+ var withoutRepeatedPath = (name) => (name.endsWith(" ]") ? [...name.matchAll(/ \[ /gu)] : []).map(({ index }) => name.slice(0, index)).find((path) => isPathOf(name.slice(path.length + 3, -2), path)) ?? name;
5715
+ var paddedLabels = /^FAIL {2}(?:\|[^|]+\| )?(?: \S+(?: \S+)* {2})+/u;
5716
+ var failedFileTest = (text) => {
5717
+ const name = failedFileLine.exec(text.replace(paddedLabels, "FAIL ").replace(jestFileStats, "$1"))?.[1];
5718
+ return name === undefined ? undefined : withoutRepeatedPath(name);
5719
+ };
5720
+ var maxLineLength = 1000;
5721
+ var ansiColours = /\u001B\[[\d;]*m/gu;
5722
+ var failedTestOfLine = (line) => {
5723
+ const printed = line.slice(0, maxLineLength).replaceAll(ansiColours, "");
5724
+ const unprefixed = printed.replace(scriptPrefix, "");
5725
+ return [printed, unprefixed, unprefixed.replace(scriptPrefix, "")].map((text) => text.trim()).flatMap((text) => [failedFileTest(text), ...failedTestLines.map((pattern) => pattern.exec(text)?.[1]?.trim())]).find((name) => name !== undefined && name !== "");
5726
+ };
5727
+ var namedTest = (name) => {
5728
+ const at = name.indexOf(" > ");
5729
+ return at === -1 ? { name, file: name, path: "" } : { name, file: name.slice(0, at), path: name.slice(at + 3) };
5730
+ };
5731
+ var reportedTest = (name) => {
5732
+ const test = namedTest(name);
5733
+ return test.path !== "" && isPathOf(test.file, test.path) ? namedTest(test.file) : test;
5734
+ };
5735
+ var byPath = (tests) => {
5736
+ const grouped = new Map;
5737
+ for (const test of tests) {
5738
+ const found = grouped.get(test.path);
5739
+ if (found === undefined)
5740
+ grouped.set(test.path, [test]);
5741
+ else
5742
+ found.push(test);
5743
+ }
5744
+ return grouped;
5745
+ };
5746
+ var holds = (tests, test) => (tests.get(test.path) ?? []).some(({ file }) => isPathOf(file, test.file) || isPathOf(test.file, file));
5747
+ var attempt = String.raw`(?:\d+ times in )?(?:initial run|\d+[a-z]{2} (?:retry(?: of \d+[a-z]{2} repeat)?|repeat))`;
5748
+ var vitestAttempts = new RegExp(String.raw` \(${attempt}(?:, ${attempt})*\)$`, "u");
5749
+ var vitestTimes = / \(\d+ times\)$/u;
5750
+ var printedTest = (reports) => (name) => {
5751
+ const whole = namedTest(name);
5752
+ const attempted = /[./]/u.test(whole.file) ? namedTest(name.replace(vitestAttempts, "")) : whole;
5753
+ return [whole, attempted, namedTest(name.replace(vitestTimes, ""))].find((test) => holds(reports, test)) ?? attempted;
5754
+ };
5755
+ var namesWithoutFile = ({ path }) => {
5756
+ const parts = path.split(" > ");
5757
+ return [path, [...parts.slice(0, -1).reverse(), ...parts.slice(-1)].join(" > ")];
5758
+ };
5759
+ var spaced = (name) => name.replaceAll(/ [>\u203A] /gu, " ");
5760
+ var reportedForms = ({ name, path }) => [name, path].map((text) => [text, namedTest(text)]).map(([text, test]) => test.file === test.path ? test.file : text).flatMap((text) => [spaced(text), text.replace(" > ", ".")]);
5761
+ var printedForm = (name) => {
5762
+ if (name.includes(" \u203A "))
5763
+ return spaced(name);
5764
+ const [, file, names, rest] = /^(\S+?)\.py::([^[]*)(.*)$/su.exec(name) ?? [];
5765
+ return file === undefined || names === undefined ? undefined : `${file.replaceAll("/", ".")}.${names.replaceAll("::", ".")}${rest ?? ""}`;
5766
+ };
5767
+ var unreportedPrints = (reported, printed) => {
5768
+ const reports = [...new Set(reported)].map(reportedTest);
5769
+ const reportsByPath = byPath(reports);
5770
+ const prints = [...new Set(printed)].map(printedTest(reportsByPath));
5771
+ const printsByPath = byPath(prints);
5772
+ const unprinted = reports.filter((test) => !holds(printsByPath, test));
5773
+ const namedWithoutFile = new Set(unprinted.flatMap(namesWithoutFile));
5774
+ const namedInForm = new Set(unprinted.flatMap(reportedForms));
5775
+ const unreported = prints.filter((test) => !holds(reportsByPath, test) && !namedWithoutFile.has(test.name) && !namedInForm.has(printedForm(test.name)));
5776
+ return { reports, unreported };
5777
+ };
5778
+ var printedNotReported = (reported, printed) => unreportedPrints(reported, printed).unreported.map((test) => test.name);
5779
+ var failedTestsOf = (reported, printed) => {
5780
+ const { reports, unreported } = unreportedPrints(reported, printed);
5781
+ const named = new Set;
5782
+ for (const { name } of [...reports, ...unreported]) {
5783
+ if (named.size === maxFailedTests)
5784
+ break;
5785
+ named.add(redactCredentials(name).slice(0, maxFailedTestLength));
5786
+ }
5787
+ return [...named];
5788
+ };
5789
+ var testOutcomes = (reports) => {
5790
+ const rank = { passed: 0, skipped: 1, failed: 2 };
5791
+ const tests = new Map;
5792
+ for (const found of reports.flatMap(junitTestCases)) {
5793
+ const before = tests.get(found.id);
5794
+ if (before === undefined || rank[found.status] > rank[before])
5795
+ tests.set(found.id, found.status);
5796
+ }
5797
+ return tests;
5798
+ };
5799
+ var checkTests = (reports, printed = []) => {
5800
+ const tests = testOutcomes(reports);
5801
+ const of = (status) => [...tests].flatMap(([id, is]) => is === status ? [id] : []);
5802
+ const skipped = of("skipped").sort();
5803
+ const failedTests = failedTestsOf(of("failed"), printed);
5804
+ return {
5805
+ reports: reports.length,
5806
+ passed: of("passed").length,
5807
+ failed: of("failed").length,
5808
+ skipped: skipped.length,
5809
+ skippedTests: skipped.slice(0, maxSkippedTests),
5810
+ ranDigests: [...of("passed"), ...of("failed")].map(testDigest).sort().slice(0, maxRanDigests),
5811
+ ...failedTests.length === 0 ? undefined : { failedTests }
5812
+ };
5813
+ };
5814
+
5641
5815
  // packages/core/src/loop.ts
5642
5816
  var LoopStatuses = ["draft", "active", "disabled", "archived"];
5643
5817
  var LoopStepImplementationKinds = [
@@ -6208,6 +6382,7 @@ var RunEvidence = Struct({
6208
6382
  failedTests: optionalKey(ArraySchema(String4)),
6209
6383
  skippedSinceBaseline: optionalKey(ArraySchema(String4)),
6210
6384
  newNotRun: optionalKey(ArraySchema(String4)),
6385
+ environmentFailure: optionalKey(EnvironmentFailure),
6211
6386
  recordedAt: Timestamp
6212
6387
  });
6213
6388
  var ApprovedVerification = Struct({
@@ -6777,170 +6952,6 @@ var RunActionSummary = Struct({
6777
6952
  var RunActionList = Struct({ items: ArraySchema(RunActionSummary) });
6778
6953
  var RunActionTaken = Struct({ action: String4, run: Run });
6779
6954
 
6780
- // packages/core/src/test-report.ts
6781
- var isTestReportName = (name) => /junit.*\.xml$/iu.test(name);
6782
- var maxSkippedTests = 1e4;
6783
- var maxRanDigests = 1e5;
6784
- var TestId = String4.check(isMinLength(1), isMaxLength(1000));
6785
- var maxFailedTests = 50;
6786
- var maxFailedTestLength = 300;
6787
- var CheckTests = Struct({
6788
- reports: Int.check(isGreaterThanOrEqualTo(0)),
6789
- passed: Int.check(isGreaterThanOrEqualTo(0)),
6790
- failed: Int.check(isGreaterThanOrEqualTo(0)),
6791
- skipped: Int.check(isGreaterThanOrEqualTo(0)),
6792
- skippedTests: ArraySchema(TestId).check(isMaxLength(maxSkippedTests)),
6793
- ranDigests: ArraySchema(String4.check(isMaxLength(16))).check(isMaxLength(maxRanDigests)),
6794
- failedTests: optionalKey(ArraySchema(String4.check(isMinLength(1), isMaxLength(maxFailedTestLength))).check(isMaxLength(maxFailedTests)))
6795
- });
6796
- var entities = new Map([
6797
- ["amp", "&"],
6798
- ["lt", "<"],
6799
- ["gt", ">"],
6800
- ["quot", '"'],
6801
- ["apos", "'"]
6802
- ]);
6803
- var codePoint = (whole, value) => value <= 1114111 ? String.fromCodePoint(value) : whole;
6804
- var decoded = (text) => text.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/giu, (whole, entity) => {
6805
- if (entity.startsWith("#x") || entity.startsWith("#X"))
6806
- return codePoint(whole, Number.parseInt(entity.slice(2), 16));
6807
- if (entity.startsWith("#"))
6808
- return codePoint(whole, Number(entity.slice(1)));
6809
- return entities.get(entity) ?? whole;
6810
- });
6811
- var attribute = (attributes, name) => {
6812
- const found = new RegExp(`(?:^|\\s)${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, "u").exec(attributes);
6813
- return found === null ? undefined : decoded(found[1] ?? found[2] ?? "");
6814
- };
6815
- var junitTestCases = (xml) => [...xml.matchAll(/<testcase\b([^>]*?)(?:\/>|>([\s\S]*?)<\/testcase>)/gu)].map(([, attributes = "", body = ""]) => {
6816
- const id = [attribute(attributes, "file"), attribute(attributes, "classname"), attribute(attributes, "name")].filter((part) => part !== undefined && part !== "").join(" > ");
6817
- return {
6818
- id: id.slice(0, 1000) || "(unnamed test)",
6819
- status: /<(?:failure|error)\b/u.test(body) ? "failed" : /<skipped\b/u.test(body) ? "skipped" : "passed"
6820
- };
6821
- });
6822
- var fnv1a = (text, seed) => {
6823
- let hash = seed;
6824
- for (let index = 0;index < text.length; index++) {
6825
- hash ^= text.charCodeAt(index);
6826
- hash = Math.imul(hash, 16777619) >>> 0;
6827
- }
6828
- return hash.toString(16).padStart(8, "0");
6829
- };
6830
- var testDigest = (id) => `${fnv1a(id, 2166136261)}${fnv1a(id, 84696351)}`;
6831
- var scriptPrefix = /^(?:[^|]{1,300} \| |\S+ [\w:.-]+: )/u;
6832
- var failedTestLines = [
6833
- /^\(fail\) (.+?)(?: \[[\d.]+ ?m?s\])?$/su,
6834
- /^\u25CF (?=.+? \u203A .)(.+)$/su,
6835
- /^FAILED (\S+?::(?:[^[]+?(?:\[.*?\])?|.+?))(?: - .*)?$/su,
6836
- /^--- FAIL: (\S+)/u,
6837
- /^test (.+) \.\.\. FAILED$/su,
6838
- /^not ok \d+ (?:- )?(?!.*# (?:TODO|SKIP)\b)(.+)$/isu
6839
- ];
6840
- var failedFileStart = String.raw`FAIL +(?:\|[^|]+\| *)?(?! )(?!\S*:\/\/)`;
6841
- var afterPath = String.raw` > | \[ `;
6842
- var failedFilePaths = [
6843
- String.raw`\S*\.[A-Za-z]\w*(?=[\s:]|$)`,
6844
- String.raw`(?=\S*[A-Za-z])(?=\S*\/)\S+(?=${afterPath}|$)`,
6845
- String.raw`(?:(?!${afterPath}).)*\.[A-Za-z]\w*(?=${afterPath})`,
6846
- String.raw`(?=\S*\/)(?:(?!${afterPath}).)*\.[A-Za-z]\w*$`,
6847
- String.raw`(?=.*(?:\.(?:test|spec)\.|\b__tests__\/))(?:(?!${afterPath}).)*\.[cm]?[jt]sx?$`
6848
- ];
6849
- var failedFileLine = new RegExp(`^${failedFileStart}((?:${failedFilePaths.join("|")}).*)$`, "su");
6850
- var jestFileStats = /^((?:(?! > ).)*) \((?:[\d.]+ m?s(?:, \d+ MB heap size)?|\d+ MB heap size)\)$/su;
6851
- var isPathOf = (file, path) => `/${file}`.endsWith(`/${path.replace(/^(?:\.\.\/)+/u, "")}`);
6852
- var withoutRepeatedPath = (name) => (name.endsWith(" ]") ? [...name.matchAll(/ \[ /gu)] : []).map(({ index }) => name.slice(0, index)).find((path) => isPathOf(name.slice(path.length + 3, -2), path)) ?? name;
6853
- var paddedLabels = /^FAIL {2}(?:\|[^|]+\| )?(?: \S+(?: \S+)* {2})+/u;
6854
- var failedFileTest = (text) => {
6855
- const name = failedFileLine.exec(text.replace(paddedLabels, "FAIL ").replace(jestFileStats, "$1"))?.[1];
6856
- return name === undefined ? undefined : withoutRepeatedPath(name);
6857
- };
6858
- var maxLineLength = 1000;
6859
- var ansiColours = /\u001B\[[\d;]*m/gu;
6860
- var failedTestOfLine = (line) => {
6861
- const printed = line.slice(0, maxLineLength).replaceAll(ansiColours, "");
6862
- const unprefixed = printed.replace(scriptPrefix, "");
6863
- return [printed, unprefixed, unprefixed.replace(scriptPrefix, "")].map((text) => text.trim()).flatMap((text) => [failedFileTest(text), ...failedTestLines.map((pattern) => pattern.exec(text)?.[1]?.trim())]).find((name) => name !== undefined && name !== "");
6864
- };
6865
- var namedTest = (name) => {
6866
- const at = name.indexOf(" > ");
6867
- return at === -1 ? { name, file: name, path: "" } : { name, file: name.slice(0, at), path: name.slice(at + 3) };
6868
- };
6869
- var reportedTest = (name) => {
6870
- const test = namedTest(name);
6871
- return test.path !== "" && isPathOf(test.file, test.path) ? namedTest(test.file) : test;
6872
- };
6873
- var byPath = (tests) => {
6874
- const grouped = new Map;
6875
- for (const test of tests) {
6876
- const found = grouped.get(test.path);
6877
- if (found === undefined)
6878
- grouped.set(test.path, [test]);
6879
- else
6880
- found.push(test);
6881
- }
6882
- return grouped;
6883
- };
6884
- var holds = (tests, test) => (tests.get(test.path) ?? []).some(({ file }) => isPathOf(file, test.file) || isPathOf(test.file, file));
6885
- var attempt = String.raw`(?:\d+ times in )?(?:initial run|\d+[a-z]{2} (?:retry(?: of \d+[a-z]{2} repeat)?|repeat))`;
6886
- var vitestAttempts = new RegExp(String.raw` \(${attempt}(?:, ${attempt})*\)$`, "u");
6887
- var vitestTimes = / \(\d+ times\)$/u;
6888
- var printedTest = (reports) => (name) => {
6889
- const whole = namedTest(name);
6890
- const attempted = /[./]/u.test(whole.file) ? namedTest(name.replace(vitestAttempts, "")) : whole;
6891
- return [whole, attempted, namedTest(name.replace(vitestTimes, ""))].find((test) => holds(reports, test)) ?? attempted;
6892
- };
6893
- var namesWithoutFile = ({ path }) => {
6894
- const parts = path.split(" > ");
6895
- return [path, [...parts.slice(0, -1).reverse(), ...parts.slice(-1)].join(" > ")];
6896
- };
6897
- var spaced = (name) => name.replaceAll(/ [>\u203A] /gu, " ");
6898
- var reportedForms = ({ name, path }) => [name, path].map((text) => [text, namedTest(text)]).map(([text, test]) => test.file === test.path ? test.file : text).flatMap((text) => [spaced(text), text.replace(" > ", ".")]);
6899
- var printedForm = (name) => {
6900
- if (name.includes(" \u203A "))
6901
- return spaced(name);
6902
- const [, file, names, rest] = /^(\S+?)\.py::([^[]*)(.*)$/su.exec(name) ?? [];
6903
- return file === undefined || names === undefined ? undefined : `${file.replaceAll("/", ".")}.${names.replaceAll("::", ".")}${rest ?? ""}`;
6904
- };
6905
- var failedTestsOf = (reported, printed) => {
6906
- const reports = [...new Set(reported)].map(reportedTest);
6907
- const reportsByPath = byPath(reports);
6908
- const prints = [...new Set(printed)].map(printedTest(reportsByPath));
6909
- const printsByPath = byPath(prints);
6910
- const unprinted = reports.filter((test) => !holds(printsByPath, test));
6911
- const namedWithoutFile = new Set(unprinted.flatMap(namesWithoutFile));
6912
- const namedInForm = new Set(unprinted.flatMap(reportedForms));
6913
- const unreported = prints.filter((test) => !holds(reportsByPath, test) && !namedWithoutFile.has(test.name) && !namedInForm.has(printedForm(test.name)));
6914
- const named = new Set;
6915
- for (const { name } of [...reports, ...unreported]) {
6916
- if (named.size === maxFailedTests)
6917
- break;
6918
- named.add(redactCredentials(name).slice(0, maxFailedTestLength));
6919
- }
6920
- return [...named];
6921
- };
6922
- var checkTests = (reports, printed = []) => {
6923
- const rank = { passed: 0, skipped: 1, failed: 2 };
6924
- const tests = new Map;
6925
- for (const found of reports.flatMap(junitTestCases)) {
6926
- const before = tests.get(found.id);
6927
- if (before === undefined || rank[found.status] > rank[before])
6928
- tests.set(found.id, found.status);
6929
- }
6930
- const of = (status) => [...tests].flatMap(([id, is]) => is === status ? [id] : []);
6931
- const skipped = of("skipped").sort();
6932
- const failedTests = failedTestsOf(of("failed"), printed);
6933
- return {
6934
- reports: reports.length,
6935
- passed: of("passed").length,
6936
- failed: of("failed").length,
6937
- skipped: skipped.length,
6938
- skippedTests: skipped.slice(0, maxSkippedTests),
6939
- ranDigests: [...of("passed"), ...of("failed")].map(testDigest).sort().slice(0, maxRanDigests),
6940
- ...failedTests.length === 0 ? undefined : { failedTests }
6941
- };
6942
- };
6943
-
6944
6955
  // packages/core/src/work-unit.ts
6945
6956
  var WorkUnitLease = Struct({
6946
6957
  leaseOwnerId: Id,
@@ -14548,7 +14559,12 @@ class RunnerReplicaRpcs extends make7(make6("Claim", {
14548
14559
  error: RunnerRpcError
14549
14560
  }), make6("KnownEvidence", {
14550
14561
  payload: { lease: ProgramLease, trees: ArraySchema(String4) },
14551
- success: ArraySchema(Struct({ tree: String4, name: String4, command: String4 })),
14562
+ success: ArraySchema(Struct({
14563
+ tree: String4,
14564
+ name: String4,
14565
+ command: String4,
14566
+ unjudgedFailure: optionalKey(Boolean2)
14567
+ })),
14552
14568
  error: RunnerRpcError
14553
14569
  })).middleware(RunnerAuthentication) {
14554
14570
  }
@@ -16275,12 +16291,20 @@ function installCommand(rootFiles) {
16275
16291
  return has("package.json") ? "npm install" : undefined;
16276
16292
  }
16277
16293
  var checkServicesFile = ".kitman/checks.json";
16278
- var CheckServices = Struct({ services: ArraySchema(Literal("postgres")) });
16294
+ var CheckServices = Struct({
16295
+ services: ArraySchema(Literal("postgres")),
16296
+ checks: optionalKey(ArraySchema(String4))
16297
+ });
16298
+ var decodeCheckServices = (declaration) => getOrUndefined(decodeOption(fromJsonString(CheckServices))(declaration));
16279
16299
  function checkServices(declaration) {
16280
16300
  if (declaration === undefined)
16281
16301
  return [];
16282
- const decoded = decodeOption(fromJsonString(CheckServices))(declaration);
16283
- return isSome(decoded) ? [...new Set(decoded.value.services)] : undefined;
16302
+ const decoded = decodeCheckServices(declaration);
16303
+ return decoded === undefined ? undefined : [...new Set(decoded.services)];
16304
+ }
16305
+ function serviceChecks(declaration) {
16306
+ const decoded = declaration === undefined ? undefined : decodeCheckServices(declaration);
16307
+ return decoded === undefined || decoded.services.length === 0 ? [] : [...new Set(decoded.checks ?? [])];
16284
16308
  }
16285
16309
 
16286
- 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, reportedModelName, LoopDataSchemaRef, RunDisplayStates, LoopVersion, ProgramLoop, AgentFallback, RunWaitUntils, isTestReportName, failedTestOfLine, checkTests, 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, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices };
16310
+ 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, 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, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices, serviceChecks };
@@ -1,5 +1,8 @@
1
1
  // @bun
2
- import"./chunk-q5w3v4k1.js";
2
+ import {
3
+ FileSystem,
4
+ Path
5
+ } from "./chunk-hakqpy8z.js";
3
6
  import {
4
7
  isObject,
5
8
  isUint8Array,
@@ -15,25 +18,22 @@ import {
15
18
  decodeJsonString,
16
19
  encodePrettyJsonString
17
20
  } from "./chunk-zw3gf6r5.js";
18
- import {
19
- FileSystem,
20
- Path
21
- } from "./chunk-nf9gdnsf.js";
21
+ import"./chunk-q5w3v4k1.js";
22
22
  import {
23
23
  tomlTableHeader2,
24
24
  tomlKeyPath2,
25
25
  kitmanSkillEntry,
26
26
  isPathWithin2
27
- } from "./chunk-cbzqfz1k.js";
27
+ } from "./chunk-vxc2cg5f.js";
28
28
  import {
29
29
  instructionsStart,
30
30
  instructionsEnd,
31
31
  renderMcpServer,
32
32
  materializeKitSetup,
33
33
  tomlInline
34
- } from "./chunk-zd6y6ka8.js";
35
- import"./chunk-mbqb40ev.js";
36
- import"./chunk-vsrjg9nm.js";
34
+ } from "./chunk-bc8ytp0y.js";
35
+ import"./chunk-r1s1dcy0.js";
36
+ import"./chunk-84xks8tn.js";
37
37
 
38
38
  // packages/agent-runtime/src/kit-setup-sync.ts
39
39
  class KitSyncError extends TaggedError("KitSyncError") {