@skyramp/testbot-core 0.13.0-v3.114 → 0.13.0-v3.116

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.
package/dist/main.js CHANGED
@@ -175,8 +175,8 @@ The generated tests for this run were delivered to the configured test repo;
175
175
  this change only records the workspace/service configuration (including any
176
176
  additional repositories analyzed in a multi-repo run).`,devPrMergedBreadcrumb:(t,e,r)=>`Dev PR merged \u2014 Testbot PR [#${t}](${e}) is still open, now targeting \`${r}\`.`,devPrClosedBreadcrumb:(t,e)=>`Dev PR closed \u2014 Testbot PR [#${t}](${e}) has been closed automatically.`,testbotPrMergeHint:"Merging this PR adds the generated/maintained tests to the feature branch. Close it if you want to discard them.",testbotPrBacklink:t=>`Generated by Skyramp Testbot for ${t}.`,testbotPrDispatchBacklink:t=>`Generated by Skyramp Testbot from a manual run against \`${t}\`.`,testbotPrMergedBacklink:t=>`Generated by Skyramp Testbot for ${t}, which has since merged; these tests target the base branch.`,staleBannerNoChanges:t=>`> \u26A0\uFE0F The latest push on ${t} did not require any new test changes.`,staleBannerStillOpen:"> This PR still reflects testbot's analysis from an earlier push; consider regenerating via `@skyramp-testbot` or merging as-is if still relevant.",testbotPrNoBaseBranchError:"Skyramp Testbot could not open a Testbot PR because no base branch could be determined (no pull_request context and no checked-out branch). This usually means the workflow ran outside a `pull_request` event and `actions/checkout` left a detached HEAD. Set `generatedTestsMode: same-branch` to commit directly to the feature branch instead.",commitFailureGeneric:(t,e)=>e?`Failed to commit generated tests to the Testbot PR branch: \`${t}\`.`:`Failed to commit generated tests: \`${t}\`.`,commitFailureHookWhereTestbotPr:"so no Testbot PR was created",commitFailureHookWhereSameBranch:"so no changes were committed to the branch",commitFailureHook:(t,e)=>`Your repository's pre-commit hook rejected the generated-test commit, ${e}. Hook error: \`${t}\`.`,gitVerificationBypassed:(t,e,r)=>`Git verification issues: your repository's hooks rejected the \`git ${t}\` of the generated tests, and Testbot tried repairing them first, but ${e}, so they were delivered with \`--no-verify\`. Hook error: \`${r}\`.`,repairTimedOut:t=>`the ${t}-minute repair time ran out`,repairSessionFailed:t=>`the repair session failed (${t})`,gitVerificationBypassedNextStep:"Testbot delivered the generated tests without passing your repository's git hooks. Fix the issues the hooks reported in those tests before merging.",commitFailureHookNextStep:"A pre-commit hook rejected Testbot's generated tests. Fix the issue it reported in the generated tests, or configure the hook/linter to skip Testbot's generated test files. (Both delivery modes run `git commit`, so switching `generatedTestsMode` will not skip the hook.)",testbotPrCreationFailure:(t,e)=>`Could not open the Testbot PR for the generated tests. Error: \`${t}\`. The tests were committed and pushed to \`${e}\` \u2014 open a pull request from that branch to review them.`,sameBranchTestRepoConflictError:"`generatedTestsMode: same-branch` is incompatible with a configured `testRepoPath`: tests were generated into the test repo checkout, but same-branch mode only commits to the primary repo checkout. Use `generatedTestsMode: separate-branch` (the default) with `testRepoPath`, or remove `testRepoPath` to commit generated tests to the same branch.",noNewTestChangesBreadcrumb:t=>`This push produced no new test changes. The prior [testbot PR](${t}) from an earlier push is still open for review.`,testbotPrLabel:(t,e)=>`Testbot PR : [${t}](${e})`,sutAppCrashDetected:t=>`**Application crash detected:** Services (${t}) failed to start due to a code error.`,sutErrorLine:t=>`
177
177
  **Error:** \`${t}\``,sutFixPrefix:"**Fix:** ",sutServiceNotReachable:t=>`**Service not reachable:** Service at ${t} did not respond before the health-check timeout. The service may still be starting, or the startup command may not have brought it up at all.`,sutServiceNotReachableFix:"**Fix:** Check that `targetSetupCommand` actually starts this service and listens on the expected port. If the command is correct but the service is slow to start, increase `targetReadyCheckTimeout`. For a more reliable readiness signal, configure `targetReadyCheckCommand` to probe a specific health endpoint.",staged:{requestedByPerson:t=>`Requested by ${t}`,requestedByPolicy:t=>`Started by the Validation Policy ${t}`,noLiveApp:t=>`> \u26A0\uFE0F **No live app (SUT) was available this run** \u2014 the ${t} test(s) below were **not executed** (there was no app to run them against). Run them against a running app to confirm they pass (and that any repro test fails as intended).`,unitTestsInFile:(t,e,r)=>`**${t}**: ${e} unit test${e===1?"":"s"}${r?` for ${r}`:""}`,addedToExistingFile:"added to an existing test file",testPackagesHeader:"### \u{1F4E6} Running these tests",testPackageLine:(t,e)=>`\`${t}/\` is a self-contained test package Skyramp Testbot owns and maintains, with its own manifest, lockfile and runner config. Run it with \`${e}\`; to run it on every pull request, add that one command to CI.`,appManifestsUntouched:"The application's own manifests and lockfiles were not changed.",dependencyChangesHeader:"### \u{1F4E6} Changes to the application's dependencies",dependencyChangeLine:(t,e,r)=>`Added \`${t}\` to \`${e}\` (and its lockfile)${r?`: ${r}`:""}`,testMaintenanceHeader:"\u2705 Test Maintenance",keptNot:"kept, not ",declinedPlanned:"(declined the planned ",declinedMaintenanceHeader:"\u21A9\uFE0F Declined Maintenance",existingEvidenceHeader:"\u2705 Existing Evidence",trustedCheckPassed:(t,e)=>`Trusted CI check ${t} passed${e?` on ${e}`:""}, establishing:`,testResultsHeader:"\u{1F9EA} Test Results",resultsTableHeader:"| Test ID | Test Type | Endpoint | Status | Details |",unitResultsTableHeader:"| Test ID | Test Type | Code under test | Test | Cases | Status | Details |",casesPassed:(t,e,r)=>`${t}/${e} passed${r?`, ${r} skipped`:""}`,behaviourCoverageHeader:"\u{1F517} Behaviour Coverage",coverageCaption:(t,e,r,n)=>` (${t} generated \xB7 ${e} modified \xB7 ${r} verified \xB7 ${n} executed)`,coverageTableHeader:"| Behaviour | Source | Tested By | Maintained By |",writtenNotRun:"written, not run",issuesFoundHeader:"\u26A0\uFE0F Issues Found",caveatsHeader:"### \u26A0\uFE0F What This Run Could Not Prove",commentHeader:"### Skyramp Testbot",timedOut:"> \u26A0\uFE0F Run timed out \u2014 the results below are partial.",stopReasons:{},publishFailures:{},maintenanceActions:{},stoppedEarly:(t,e)=>`> \u26A0\uFE0F Run stopped early \u2014 ${t}. The results below are partial.${e}`,viewInSkyramp:t=>` [View in Skyramp](${t})`,setupRunEnds:{finished:"Setup run finished. Skyramp is checking the result.",failed:"Setup run failed.",timedOut:"Setup run ran out of time.",cancelledInSkyramp:"Setup run was cancelled in Skyramp.",stoppedToResume:"Setup run stopped. Resume it in Skyramp."},appUnreachable:t=>`Unable to contact the mothership ${t}. Please try again later.`,couldNotStart:t=>`Skyramp Testbot could not start: ${t}`,assembledAfterFailedChecks:t=>`> \u26A0\uFE0F This report was assembled automatically after the write-up step failed its checks; ${t} check(s) remain unmet \u2014 see the run log for details.`,testbotPrLine:(t,e,r)=>`Testbot PR${t?` (${t})`:""} : [${e}](${r})`,viewRun:t=>`_[View run](${t})_`,testsPrNotOpened:(t,e)=>`The tests PR could not be opened (${t}); the tests were pushed to branch \`${e}\`.`,testsNotPushed:(t,e)=>`The tests could not be pushed (${t}); they remain on the local branch \`${e}\`.`,testsPrRetargeted:t=>`The dev PR merged while tests were being generated \u2014 the tests PR targets its base branch${t?` (\`${t}\`)`:""} instead.`,testsPrUnchanged:"This push required no new test changes; the tests PR below is from an earlier run and was left as is.",committedNoPr:t=>`The tests were committed but no PR was opened: ${t}.`}};var zVe={defaultProgressHeadline:"\u30D7\u30EB\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u78BA\u8A8D\u3057\u3066\u30C6\u30B9\u30C8\u3092\u63A8\u5968\u3057\u3066\u3044\u307E\u3059\u3002",stepSettingUpEnvironment:"\u74B0\u5883\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7",stepAnalyzingUserRequest:"\u30E6\u30FC\u30B6\u30FC\u30EA\u30AF\u30A8\u30B9\u30C8\u306E\u5206\u6790",stepAnalyzingCodeChanges:"\u30B3\u30FC\u30C9\u5909\u66F4\u306E\u5206\u6790",stepRecommendingTests:"\u30C6\u30B9\u30C8\u306E\u63A8\u5968",stepGeneratingTests:"\u30C6\u30B9\u30C8\u306E\u751F\u6210",stepExecutingTests:"\u30C6\u30B9\u30C8\u306E\u5B9F\u884C",stepGeneratingReport:"\u30D7\u30EB\u30EA\u30AF\u30A8\u30B9\u30C8\u3068\u30EC\u30DD\u30FC\u30C8\u306E\u751F\u6210",workflowRunLinkLabel:"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u5B9F\u884C",noReportAvailable:"\u30EC\u30DD\u30FC\u30C8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",cancelledHeader:"### Skyramp Testbot \u2014 \u30AD\u30E3\u30F3\u30BB\u30EB",cancelledBody:"\u3053\u306E\u5B9F\u884C\u306F\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F\u3002",cancelledStepSuffix:"\u30AD\u30E3\u30F3\u30BB\u30EB",abandonedHeader:"### Skyramp Testbot \u2014 \u505C\u6B62",abandonedBody:"\u3053\u306E\u30D7\u30EB\u30EA\u30AF\u30A8\u30B9\u30C8\u306F\u30DE\u30FC\u30B8\u3055\u308C\u305A\u306B\u30AF\u30ED\u30FC\u30BA\u3055\u308C\u305F\u305F\u3081\u3001\u30C6\u30B9\u30C8\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9\u306F\u5B8C\u4E86\u524D\u306B\u505C\u6B62\u3055\u308C\u307E\u3057\u305F\u3002",abandonedStepSuffix:"\u505C\u6B62",followingUserInstruction:t=>`> \u30E6\u30FC\u30B6\u30FC\u6307\u793A\u306B\u5F93\u3063\u3066\u3044\u307E\u3059: *${t}*`,minimalReportHeader:"### \u26A0\uFE0F Skyramp Testbot",testRecommendationsImplementedHeader:t=>`\u{1F4A1} \u5B9F\u88C5\u3057\u305F\u30C6\u30B9\u30C8\u63A8\u5968\uFF08${t}\u4EF6\uFF09`,additionalRecommendationsHeader:t=>`\u{1F4CC} \u8FFD\u52A0\u306E\u30C6\u30B9\u30C8\u63A8\u5968\uFF08${t}\u4EF6\uFF09`,additionalRecommendationsCta:"\u3053\u308C\u3089\u306E\u30C6\u30B9\u30C8\u3092\u751F\u6210\u3059\u308B\u306B\u306F\u3001\u30B3\u30E1\u30F3\u30C8\u3067 `@skyramp-testbot` \u3092\u30E1\u30F3\u30B7\u30E7\u30F3\u3057\u3066\u8FFD\u52A0\u3092\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: `@skyramp-testbot /products \u306E\u30B3\u30F3\u30C8\u30E9\u30AF\u30C8\u30C6\u30B9\u30C8\u3092\u8FFD\u52A0\u3057\u3066`\uFF09\u3002",testTypeLabels:{contract:"\u{1F4CB} \u30B3\u30F3\u30C8\u30E9\u30AF\u30C8",integration:"\u{1F517} \u7D71\u5408",e2e:"\u{1F310} E2E",ui:"\u{1F5A5}\uFE0F UI"},testTypeCellLabels:{smoke:"\u30B9\u30E2\u30FC\u30AF",fuzz:"\u30D5\u30A1\u30BA",contract:"\u30B3\u30F3\u30C8\u30E9\u30AF\u30C8",load:"\u8CA0\u8377",integration:"\u7D71\u5408",e2e:"E2E",ui:"UI",unit:"\u30E6\u30CB\u30C3\u30C8"},statusLabels:{Pass:"\u5408\u683C",Fail:"\u4E0D\u5408\u683C",Error:"\u30A8\u30E9\u30FC",Skipped:"\u30B9\u30AD\u30C3\u30D7"},severityLabels:{critical:"\u91CD\u5927",high:"\u9AD8",medium:"\u4E2D",low:"\u4F4E"},reuse:{label:"POM \u518D\u5229\u7528",noPomLayer:"\u30B9\u30AD\u30C3\u30D7 \u2014 \u3053\u306E\u30C6\u30B9\u30C8\u306B\u518D\u5229\u7528\u3067\u304D\u308B\u30DA\u30FC\u30B8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u5C64\u306F\u691C\u51FA\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F",reusedAndVerified:t=>`POM \u547C\u3073\u51FA\u3057 ${t} \u4EF6\u3092\u518D\u5229\u7528\u30FB\u691C\u8A3C\u6E08\u307F`,reusedThenVerified:(t,e)=>`POM \u547C\u3073\u51FA\u3057 ${t} \u4EF6\u3092\u518D\u5229\u7528\uFF08\u3046\u3061 ${e} \u4EF6\u3092\u691C\u8A3C\u6E08\u307F\uFF09`,reused:t=>`POM \u547C\u3073\u51FA\u3057 ${t} \u4EF6\u3092\u518D\u5229\u7528`,verified:t=>`POM \u547C\u3073\u51FA\u3057 ${t} \u4EF6\u3092\u691C\u8A3C\u6E08\u307F`,unresolved:t=>`${t} \u4EF6\u306F POM \u30BD\u30FC\u30B9\u307E\u3067\u89E3\u6C7A\u3067\u304D\u305A\uFF08\u53C2\u8003\u60C5\u5831\u3067\u3042\u308A\u3001\u9664\u5916\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF09`,candidates:t=>`\u5019\u88DC\u3068\u306A\u308B POM \u30D5\u30A1\u30A4\u30EB ${t} \u4EF6\u3092\u691C\u51FA`,verificationPassed:"\u691C\u8A3C\u306B\u5408\u683C",verificationFailed:"\u26A0\uFE0F \u691C\u8A3C\u306B\u5408\u683C\u3057\u307E\u305B\u3093\u3067\u3057\u305F",keptInline:t=>`\u30A4\u30F3\u30E9\u30A4\u30F3\u306E\u307E\u307E: ${t}`,gate:{"not-mapped":"\u30DE\u30C3\u30D4\u30F3\u30B0\u5BFE\u8C61\u5916","demoted-by-verify":"\u691C\u8A3C\u3067\u5DEE\u3057\u623B\u3057"}},testMaintenanceHeader:t=>`\u2705 \u30C6\u30B9\u30C8\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9\uFF08${t}\u4EF6\uFF09`,maintenanceTableHeader:"| \u30C6\u30B9\u30C8\u7A2E\u5225 | \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8 | \u30D5\u30A1\u30A4\u30EB | \u5909\u66F4\u5185\u5BB9 | \u5909\u66F4\u524D | \u5909\u66F4\u5F8C |",testResultsHeader:t=>`\u{1F9EA} \u30C6\u30B9\u30C8\u7D50\u679C\uFF08${t}\u4EF6\uFF09`,columnTestType:"\u30C6\u30B9\u30C8\u7A2E\u5225",columnEndpoint:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8",columnStatus:"\u30B9\u30C6\u30FC\u30BF\u30B9",columnDetails:"\u8A73\u7D30",columnRepo:"\u30EA\u30DD\u30B8\u30C8\u30EA",repoColumnPrimary:"\u30D7\u30E9\u30A4\u30DE\u30EA",columnVideo:"\u30D3\u30C7\u30AA",videoDownloadLink:t=>`[\u{1F4F9} \u30C0\u30A6\u30F3\u30ED\u30FC\u30C9](${t})`,videosArtifactFallback:t=>`\u{1F4F9} \u9332\u753B\u3055\u308C\u305F UI \u30C6\u30B9\u30C8\u30D3\u30C7\u30AA: [\u5B9F\u884C\u30A2\u30FC\u30C6\u30A3\u30D5\u30A1\u30AF\u30C8\u304B\u3089\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9](${t})`,issuesFoundHeader:t=>`\u26A0\uFE0F \u691C\u51FA\u3055\u308C\u305F\u554F\u984C\uFF08${t}\u4EF6\uFF09`,configErrorsHeader:"\u2699\uFE0F \u8A2D\u5B9A\u30A8\u30E9\u30FC",nextStepsHeader:"### \u{1F4A1} \u6B21\u306E\u30B9\u30C6\u30C3\u30D7",caveatsHeader:"### \u26A0\uFE0F \u3053\u306E\u5B9F\u884C\u3067\u78BA\u8A8D\u3067\u304D\u306A\u304B\u3063\u305F\u3053\u3068",caveats:{deployFailed:"\u30A2\u30D7\u30EA\u3092\u8D77\u52D5\u3067\u304D\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u3053\u3053\u306B\u793A\u3059\u5185\u5BB9\u306F\u7A3C\u50CD\u4E2D\u306E\u30B7\u30B9\u30C6\u30E0\u306B\u5BFE\u3057\u3066\u691C\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",changeBrokeBringup:"\u3053\u306E\u5909\u66F4\u306B\u3088\u308A\u30A2\u30D7\u30EA\u306E\u8D77\u52D5\u304C\u58CA\u308C\u305F\u3068\u601D\u308F\u308C\u307E\u3059\u3002PR \u3092\u9069\u7528\u3057\u305F\u72B6\u614B\u3067\u8D77\u52D5\u3067\u304D\u305A\u3001\u30C6\u30B9\u30C8\u306F\u5B9F\u884C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",bringupFailed:"\u3053\u306E PR \u3068\u306F\u7121\u95A2\u4FC2\u306E\u7406\u7531\u3067\u30A2\u30D7\u30EA\u3092\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u7A3C\u50CD\u4E2D\u306E\u30A2\u30D7\u30EA\u306B\u5BFE\u3059\u308B\u30C6\u30B9\u30C8\u306F\u5B9F\u884C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",testsNotExecuted:"\u3053\u306E\u5B9F\u884C\u3067\u306F\u7A3C\u50CD\u4E2D\u306E\u30A2\u30D7\u30EA\u306B\u5BFE\u3057\u3066\u30C6\u30B9\u30C8\u304C\u5B9F\u884C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u672A\u5B9F\u884C\u306E\u30C6\u30B9\u30C8\u306F\u5909\u66F4\u304C\u6B63\u3057\u304F\u52D5\u4F5C\u3059\u308B\u8A3C\u62E0\u306B\u306A\u308A\u307E\u305B\u3093\u3002",recipeDrift:"\u8A18\u9332\u3055\u308C\u3066\u3044\u305F\u30A2\u30D7\u30EA\u306E\u8D77\u52D5\u624B\u9806\u304C\u53E4\u304F\u306A\u3063\u3066\u304A\u308A\u3001\u8D77\u52D5\u524D\u306B\u4FEE\u6B63\u304C\u5FC5\u8981\u3067\u3057\u305F\u3002",mockedDependency:t=>`${t} \u306F\u5B9F\u969B\u306B\u30C7\u30D7\u30ED\u30A4\u3055\u308C\u305A\u30E2\u30C3\u30AF\u5316\u3055\u308C\u307E\u3057\u305F\u3002\u3053\u308C\u306B\u5BFE\u3059\u308B\u6210\u529F\u7D50\u679C\u306F\u8A3C\u660E\u306B\u306F\u306A\u308A\u307E\u305B\u3093\u3002`,finalizeNotReady:t=>`\u30C6\u30B9\u30C8\u306F\u73FE\u72B6\u3067\u306F\u30DE\u30FC\u30B8\u53EF\u80FD\u306A\u72B6\u614B\u3067\u306F\u3042\u308A\u307E\u305B\u3093${t?`: ${t}`:"\u3002"}`,ciNotCovered:"\u3053\u308C\u3089\u306E\u30C6\u30B9\u30C8\u3092\u5B9F\u884C\u3059\u308B CI \u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u304C\u306A\u3044\u305F\u3081\u3001\u4ECA\u5F8C\u306E\u30D7\u30EB\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u306F\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3002",sutNotRequired:"\u30A2\u30D7\u30EA\u306F\u8D77\u52D5\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u691C\u8A3C\u30C8\u30EA\u30A2\u30FC\u30B8\u306B\u3088\u308A\u3001\u3053\u306E\u5909\u66F4\u3067\u691C\u8A3C\u304C\u5FC5\u8981\u306A\u30C7\u30D7\u30ED\u30A4\u5F8C\u306E\u632F\u308B\u821E\u3044\u306F\u306A\u3044\u3068\u5224\u65AD\u3055\u308C\u307E\u3057\u305F\u3002",lintNotCovered:t=>`\u30EA\u30DD\u30B8\u30C8\u30EA\u306E\u30EA\u30F3\u30BF\u30FC\u306F ${t} \u3092\u30C1\u30A7\u30C3\u30AF\u3057\u307E\u305B\u3093\u3002\u30B9\u30BF\u30A4\u30EB\u3084\u578B\u306E\u554F\u984C\u304C\u81EA\u52D5\u7684\u306B\u306F\u691C\u51FA\u3055\u308C\u307E\u305B\u3093\u3002`,analysisUnverified:t=>`\u5909\u66F4\u306E\u5206\u6790\u306E\u4E00\u90E8\u3092\u691C\u8A3C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u672A\u89E3\u6C7A\u306E\u30C1\u30A7\u30C3\u30AF ${t} \u4EF6\uFF09\u3002\u8A72\u5F53\u3059\u308B\u4E3B\u5F35\u306F\u672A\u78BA\u8A8D\u3068\u3057\u3066\u6271\u3044\u3001\u30C6\u30B9\u30C8\u3092\u8A08\u753B\u3057\u307E\u3057\u305F\u3002`,unitTestsNotRun:t=>`Testbot \u306F\u9078\u629E\u3057\u305F\u30E6\u30CB\u30C3\u30C8\u30C6\u30B9\u30C8\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3053\u3053\u306B\u3042\u308B\u30E6\u30CB\u30C3\u30C8\u30C6\u30B9\u30C8\u306E\u7D50\u679C\u306F Testbot \u81EA\u8EAB\u306E\u518D\u5B9F\u884C\u306B\u3088\u308B\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093: ${t}`},autoCommitHint:"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u3067 `autoCommit: true` \u3092\u6709\u52B9\u306B\u3059\u308B\u3068\u3001Skyramp Testbot \u304C\u751F\u6210\u3057\u305F\u30C6\u30B9\u30C8\u3092\u81EA\u52D5\u7684\u306B\u30B3\u30DF\u30C3\u30C8\u3057\u307E\u3059\u3002",implementRecommendationsCta:"\u8FFD\u52A0\u306E\u30C6\u30B9\u30C8\u63A8\u5968\u3092\u5B9F\u88C5\u3059\u308B\u306B\u306F `@skyramp-testbot` \u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u5DEE\u5206\u306E\u5206\u6790\u306B\u57FA\u3065\u304D\u3001\u4EE5\u4E0B\u3092\u63A8\u5968\u3057\u307E\u3059:",sutServiceErrorsHeadline:":warning: **\u30B5\u30FC\u30D3\u30B9\u304C\u30A8\u30E9\u30FC\u3092\u8FD4\u3057\u3066\u3044\u307E\u3059**",sutCheckedEndpoints:"Testbot \u306F\u30C6\u30B9\u30C8\u5B9F\u884C\u524D\u306B\u30B5\u30FC\u30D3\u30B9\u306E\u8D77\u52D5\u3092\u5F85\u6A5F\u3057\u307E\u3057\u305F\u304C\u3001\u30D8\u30EB\u30B9\u30C1\u30A7\u30C3\u30AF\u304C\u901A\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002",sutCheckCodeChanges:"**\u3053\u306E PR \u306E\u30B3\u30FC\u30C9\u5909\u66F4\u304C\u30B5\u30FC\u30D3\u30B9\u969C\u5BB3\u306E\u539F\u56E0\u306B\u306A\u3063\u3066\u3044\u306A\u3044\u304B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044** \u2014 \u65B0\u305F\u306B\u6DF7\u5165\u3057\u305F\u30D0\u30B0\u3001\u4F9D\u5B58\u95A2\u4FC2\u306E\u4E0D\u8DB3\u3001\u8A2D\u5B9A\u30DF\u30B9\u306B\u3088\u308A\u3001\u30B5\u30FC\u30D3\u30B9\u304C\u8D77\u52D5\u3067\u304D\u306A\u3044\u30FB\u6B63\u3057\u304F\u5FDC\u7B54\u3067\u304D\u306A\u3044\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002",viewWorkflowLogs:t=>`[\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u30ED\u30B0\u5168\u6587\u3092\u898B\u308B \u2197](${t})`,sutFixAndRetry:"_\u554F\u984C\u3092\u4FEE\u6B63\u3057\u3066\u518D\u5EA6\u30D7\u30C3\u30B7\u30E5\u3059\u308B\u304B\u3001\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u3092\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002_",internalErrorHeader:"### \u5185\u90E8\u30A8\u30E9\u30FC",internalErrorRenderFailed:"Testbot \u306F\u5B9F\u884C\u3092\u5B8C\u4E86\u3057\u307E\u3057\u305F\u304C\u3001\u30EC\u30DD\u30FC\u30C8\u306E\u751F\u6210\u4E2D\u306B\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002",internalErrorNoReport:"Testbot \u3067\u4E88\u671F\u3057\u306A\u3044\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: \u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306F\u6B63\u5E38\u306B\u5B8C\u4E86\u3057\u307E\u3057\u305F\u304C\u3001\u30EC\u30DD\u30FC\u30C8\u304C\u751F\u6210\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002",internalErrorAgentStopped:"Testbot \u306F\u30EC\u30DD\u30FC\u30C8\u3092\u751F\u6210\u3059\u308B\u524D\u306B\u505C\u6B62\u3057\u307E\u3057\u305F\u3002\u539F\u56E0\u306F\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u30ED\u30B0\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002",internalErrorRawReportAvailable:"\u751F\u6210\u3055\u308C\u305F `report.json` \u306F\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u30A2\u30FC\u30C6\u30A3\u30D5\u30A1\u30AF\u30C8\u304B\u3089\u53D6\u5F97\u3067\u304D\u307E\u3059\u3002\u751F\u6210\u3055\u308C\u305F\u30C6\u30B9\u30C8\uFF08\u3042\u308C\u3070\uFF09\u306F\u901A\u5E38\u3069\u304A\u308A\u30B3\u30DF\u30C3\u30C8\u3055\u308C\u3066\u3044\u307E\u3059\u3002",internalErrorRetriedTimes:t=>`${t} \u56DE\u30EA\u30C8\u30E9\u30A4\u3057\u307E\u3057\u305F\u304C\u6210\u529F\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002`,internalErrorFileIssue:"\u554F\u984C\u304C\u89E3\u6C7A\u3057\u306A\u3044\u5834\u5408\u306F https://github.com/skyramp/testbot/issues \u306B\u3053\u306E\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u5B9F\u884C\u3078\u306E\u30EA\u30F3\u30AF\u3092\u6DFB\u3048\u3066 issue \u3092\u4F5C\u6210\u3057\u3066\u304F\u3060\u3055\u3044\u3002",providerNotYourCode:"\u3053\u306E\u30D7\u30EB\u30EA\u30AF\u30A8\u30B9\u30C8\u306E\u5909\u66F4\u304C\u539F\u56E0\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30C6\u30B9\u30C8\u306F\u751F\u6210\u3082\u5B9F\u884C\u3082\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",providerOutageHeadline:(t,e)=>`${t} \u306B\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002Testbot \u306F ${e} \u56DE\u8A66\u884C\u3057\u307E\u3057\u305F\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002`,providerOutageActionStatusPage:t=>`${t} \u3067\u72B6\u6CC1\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30B5\u30FC\u30D3\u30B9\u304C\u5FA9\u65E7\u3057\u305F\u3089\u3001Actions \u30BF\u30D6\u306E\u5B9F\u884C\u30DA\u30FC\u30B8\u304B\u3089\u3053\u306E\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u3092\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,providerRateLimitHeadline:t=>`${t} \u306E\u30EC\u30FC\u30C8\u5236\u9650\u306B\u3088\u308A\u5B9F\u884C\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F (HTTP 429)\u3002`,providerRateLimitAction:"\u5236\u9650\u304C\u89E3\u9664\u3055\u308C\u308B\u307E\u3067\u5F85\u3063\u3066\u304B\u3089\u3001Actions \u30BF\u30D6\u306E\u5B9F\u884C\u30DA\u30FC\u30B8\u304B\u3089\u3053\u306E\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u3092\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u7E70\u308A\u8FD4\u3059\u5834\u5408\u306F\u3001\u3053\u306E\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u304C\u4F7F\u7528\u3059\u308B\u8A8D\u8A3C\u60C5\u5831\u306E\u30EC\u30FC\u30C8\u5236\u9650\u3092\u5F15\u304D\u4E0A\u3052\u308B\u304B\u3001\u540C\u6642\u306B\u5B9F\u884C\u3059\u308B PR \u306E\u6570\u3092\u6E1B\u3089\u3057\u3066\u304F\u3060\u3055\u3044\u3002",providerUsageLimitHeadline:t=>`${t} \u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u5229\u7528\u4E0A\u9650\u306B\u9054\u3057\u307E\u3057\u305F\u3002`,providerUsageLimitAction:"\u3053\u306E\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u306E\u8A8D\u8A3C\u60C5\u5831\u306B\u7D10\u3065\u304F\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u5229\u7528\u4E0A\u9650\u3092\u5F15\u304D\u4E0A\u3052\u3066\u304B\u3089\u3001Actions \u30BF\u30D6\u306E\u5B9F\u884C\u30DA\u30FC\u30B8\u304B\u3089\u3053\u306E\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u3092\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",providerAuthExpiredHeadline:t=>`\u5B9F\u884C\u4E2D\u306B\u3001Testbot \u304C ${t} \u3078\u63A5\u7D9A\u3059\u308B\u305F\u3081\u306E\u8A8D\u8A3C\u60C5\u5831\u306E\u6709\u52B9\u671F\u9650\u304C\u5207\u308C\u307E\u3057\u305F\u3002`,providerAuthExpiredAction:"\u8A8D\u8A3C\u60C5\u5831\u306E\u6709\u52B9\u671F\u9593\u306F\u56FA\u5B9A\u306E\u305F\u3081\u3001\u5B9F\u884C\u6642\u9593\u304C\u9577\u3044\u3068\u305D\u306E\u671F\u9593\u3092\u8D85\u3048\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002Actions \u30BF\u30D6\u306E\u5B9F\u884C\u30DA\u30FC\u30B8\u304B\u3089\u3053\u306E\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u3092\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u3053\u306E\u30EA\u30DD\u30B8\u30C8\u30EA\u306E\u5B9F\u884C\u304C\u6709\u52B9\u671F\u9593\u3092\u5E38\u306B\u8D85\u3048\u308B\u5834\u5408\u306F\u3001\u30B8\u30E7\u30D6\u3054\u3068\u306B\u8A8D\u8A3C\u60C5\u5831\u3092\u767A\u884C\u3059\u308B\u304B\u3001\u5404\u30B8\u30E7\u30D6\u304C\u6709\u52B9\u671F\u9593\u5185\u306B\u53CE\u307E\u308B\u3088\u3046\u5B9F\u884C\u3092\u5206\u5272\u3057\u3066\u304F\u3060\u3055\u3044\u3002",providerTimeoutHeadline:t=>`Testbot \u306F\u5236\u9650\u6642\u9593 ${t} \u5206\u3092\u8D85\u3048\u305F\u305F\u3081\u505C\u6B62\u3055\u308C\u307E\u3057\u305F\u3002`,providerTimeoutAction:"\u3053\u306E\u30EA\u30DD\u30B8\u30C8\u30EA\u306E\u5B9F\u884C\u306B\u672C\u5F53\u306B\u6642\u9593\u304C\u5FC5\u8981\u306A\u5834\u5408\u306F\u3001\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u306E `testbotTimeout` \u5165\u529B\u5024\u3092\u5927\u304D\u304F\u3057\u3066\u304F\u3060\u3055\u3044\u3002",workspaceTestbotPrTitle:"Skyramp Testbot: \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u8A2D\u5B9A\u306E\u66F4\u65B0",workspaceTestbotPrHeader:"### Skyramp Testbot \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u8A2D\u5B9A\u306E\u66F4\u65B0",workspaceTestbotPrBody:"\u3053\u306E PR \u306F\u3053\u306E\u30EA\u30DD\u30B8\u30C8\u30EA\u306E\u7D71\u5408 `.skyramp/workspace.yml` \u3092\u66F4\u65B0\u3057\u307E\u3059\u3002\n\u4ECA\u56DE\u306E\u5B9F\u884C\u3067\u751F\u6210\u3055\u308C\u305F\u30C6\u30B9\u30C8\u306F\u3001\u8A2D\u5B9A\u3055\u308C\u305F\u30C6\u30B9\u30C8\u30EA\u30DD\u30B8\u30C8\u30EA\u306B\u914D\u7F6E\u3055\u308C\u307E\u3057\u305F\u3002\u3053\u306E\u5909\u66F4\u306F\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\uFF0F\u30B5\u30FC\u30D3\u30B9\u8A2D\u5B9A\uFF08\u30DE\u30EB\u30C1\u30EA\u30DD\u30B8\u30C8\u30EA\u5B9F\u884C\u3067\u5206\u6790\u3055\u308C\u305F\u8FFD\u52A0\u30EA\u30DD\u30B8\u30C8\u30EA\u3092\u542B\u3080\uFF09\u306E\u307F\u3092\u8A18\u9332\u3057\u307E\u3059\u3002",devPrMergedBreadcrumb:(t,e,r)=>`\u958B\u767A PR \u304C\u30DE\u30FC\u30B8\u3055\u308C\u307E\u3057\u305F \u2014 Testbot PR [#${t}](${e}) \u306F\u5F15\u304D\u7D9A\u304D\u30AA\u30FC\u30D7\u30F3\u3067\u3001\u73FE\u5728\u306E\u30BF\u30FC\u30B2\u30C3\u30C8\u306F \`${r}\` \u3067\u3059\u3002`,devPrClosedBreadcrumb:(t,e)=>`\u958B\u767A PR \u304C\u30AF\u30ED\u30FC\u30BA\u3055\u308C\u307E\u3057\u305F \u2014 Testbot PR [#${t}](${e}) \u306F\u81EA\u52D5\u7684\u306B\u30AF\u30ED\u30FC\u30BA\u3055\u308C\u307E\u3057\u305F\u3002`,testbotPrMergeHint:"\u3053\u306E PR \u3092\u30DE\u30FC\u30B8\u3059\u308B\u3068\u3001\u751F\u6210/\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9\u3055\u308C\u305F\u30C6\u30B9\u30C8\u304C\u30D5\u30A3\u30FC\u30C1\u30E3\u30FC\u30D6\u30E9\u30F3\u30C1\u306B\u8FFD\u52A0\u3055\u308C\u307E\u3059\u3002\u7834\u68C4\u3057\u305F\u3044\u5834\u5408\u306F\u30AF\u30ED\u30FC\u30BA\u3057\u3066\u304F\u3060\u3055\u3044\u3002",testbotPrBacklink:t=>`${t} \u7528\u306B Skyramp Testbot \u304C\u751F\u6210\u3057\u307E\u3057\u305F\u3002`,testbotPrDispatchBacklink:t=>`\`${t}\` \u306B\u5BFE\u3059\u308B\u624B\u52D5\u5B9F\u884C\u306B\u3088\u308A Skyramp Testbot \u304C\u751F\u6210\u3057\u307E\u3057\u305F\u3002`,testbotPrMergedBacklink:t=>`${t} \u7528\u306B Skyramp Testbot \u304C\u751F\u6210\u3057\u307E\u3057\u305F\u3002\u5143\u306E PR \u306F\u3059\u3067\u306B\u30DE\u30FC\u30B8\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u3053\u308C\u3089\u306E\u30C6\u30B9\u30C8\u306F\u30D9\u30FC\u30B9\u30D6\u30E9\u30F3\u30C1\u3092\u5BFE\u8C61\u3068\u3057\u3066\u3044\u307E\u3059\u3002`,staleBannerNoChanges:t=>`> \u26A0\uFE0F ${t} \u3078\u306E\u6700\u65B0\u306E\u30D7\u30C3\u30B7\u30E5\u3067\u306F\u3001\u65B0\u3057\u3044\u30C6\u30B9\u30C8\u5909\u66F4\u306F\u5FC5\u8981\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002`,staleBannerStillOpen:"> \u3053\u306E PR \u306F\u4EE5\u524D\u306E\u30D7\u30C3\u30B7\u30E5\u6642\u70B9\u306E testbot \u306E\u5206\u6790\u7D50\u679C\u306E\u307E\u307E\u3067\u3059\u3002`@skyramp-testbot` \u3067\u518D\u751F\u6210\u3059\u308B\u304B\u3001\u5185\u5BB9\u304C\u4ECA\u3082\u6709\u52B9\u3067\u3042\u308C\u3070\u305D\u306E\u307E\u307E\u30DE\u30FC\u30B8\u3059\u308B\u3053\u3068\u3092\u691C\u8A0E\u3057\u3066\u304F\u3060\u3055\u3044\u3002",testbotPrNoBaseBranchError:"\u30D9\u30FC\u30B9\u30D6\u30E9\u30F3\u30C1\u3092\u7279\u5B9A\u3067\u304D\u306A\u304B\u3063\u305F\u305F\u3081\u3001Skyramp Testbot \u306F Testbot PR \u3092\u958B\u3051\u307E\u305B\u3093\u3067\u3057\u305F\uFF08pull_request \u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3082\u30C1\u30A7\u30C3\u30AF\u30A2\u30A6\u30C8\u6E08\u307F\u30D6\u30E9\u30F3\u30C1\u3082\u3042\u308A\u307E\u305B\u3093\uFF09\u3002\u901A\u5E38\u306F\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u304C `pull_request` \u30A4\u30D9\u30F3\u30C8\u4EE5\u5916\u3067\u5B9F\u884C\u3055\u308C\u3001`actions/checkout` \u304C detached HEAD \u306E\u72B6\u614B\u3092\u6B8B\u3057\u305F\u3053\u3068\u304C\u539F\u56E0\u3067\u3059\u3002\u4EE3\u308F\u308A\u306B\u30D5\u30A3\u30FC\u30C1\u30E3\u30FC\u30D6\u30E9\u30F3\u30C1\u3078\u76F4\u63A5\u30B3\u30DF\u30C3\u30C8\u3059\u308B\u306B\u306F `generatedTestsMode: same-branch` \u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",commitFailureGeneric:(t,e)=>e?`\u751F\u6210\u3055\u308C\u305F\u30C6\u30B9\u30C8\u306E Testbot PR \u30D6\u30E9\u30F3\u30C1\u3078\u306E\u30B3\u30DF\u30C3\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F: \`${t}\`\u3002`:`\u751F\u6210\u3055\u308C\u305F\u30C6\u30B9\u30C8\u306E\u30B3\u30DF\u30C3\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F: \`${t}\`\u3002`,commitFailureHookWhereTestbotPr:"\u305D\u306E\u305F\u3081 Testbot PR \u306F\u4F5C\u6210\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F",commitFailureHookWhereSameBranch:"\u305D\u306E\u305F\u3081\u5909\u66F4\u306F\u30D6\u30E9\u30F3\u30C1\u306B\u30B3\u30DF\u30C3\u30C8\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F",commitFailureHook:(t,e)=>`\u30EA\u30DD\u30B8\u30C8\u30EA\u306E pre-commit \u30D5\u30C3\u30AF\u304C\u751F\u6210\u3055\u308C\u305F\u30C6\u30B9\u30C8\u306E\u30B3\u30DF\u30C3\u30C8\u3092\u62D2\u5426\u3057\u305F\u305F\u3081\u3001${e}\u3002\u30D5\u30C3\u30AF\u306E\u30A8\u30E9\u30FC: \`${t}\`\u3002`,gitVerificationBypassed:(t,e,r)=>`Git \u306E\u691C\u8A3C\u306E\u554F\u984C: \u30EA\u30DD\u30B8\u30C8\u30EA\u306E\u30D5\u30C3\u30AF\u304C\u751F\u6210\u3055\u308C\u305F\u30C6\u30B9\u30C8\u306E \`git ${t}\` \u3092\u62D2\u5426\u3057\u305F\u305F\u3081 Testbot \u306F\u307E\u305A\u4FEE\u6B63\u3092\u8A66\u307F\u307E\u3057\u305F\u304C\u3001${e}\u305F\u3081\u3001\`--no-verify\` \u3067\u914D\u4FE1\u3057\u307E\u3057\u305F\u3002\u30D5\u30C3\u30AF\u306E\u30A8\u30E9\u30FC: \`${r}\`\u3002`,repairTimedOut:t=>`${t} \u5206\u306E\u4FEE\u6B63\u6642\u9593\u3092\u4F7F\u3044\u5207\u3063\u305F`,repairSessionFailed:t=>`\u4FEE\u6B63\u30BB\u30C3\u30B7\u30E7\u30F3\u304C\u5931\u6557\u3057\u305F\uFF08${t}\uFF09`,gitVerificationBypassedNextStep:"Testbot \u306F\u30EA\u30DD\u30B8\u30C8\u30EA\u306E git \u30D5\u30C3\u30AF\u3092\u901A\u904E\u3057\u306A\u3044\u307E\u307E\u751F\u6210\u3055\u308C\u305F\u30C6\u30B9\u30C8\u3092\u914D\u4FE1\u3057\u307E\u3057\u305F\u3002\u30DE\u30FC\u30B8\u3059\u308B\u524D\u306B\u3001\u30D5\u30C3\u30AF\u304C\u5831\u544A\u3057\u305F\u554F\u984C\u3092\u305D\u308C\u3089\u306E\u30C6\u30B9\u30C8\u3067\u4FEE\u6B63\u3057\u3066\u304F\u3060\u3055\u3044\u3002",commitFailureHookNextStep:"pre-commit \u30D5\u30C3\u30AF\u304C Testbot \u306E\u751F\u6210\u3057\u305F\u30C6\u30B9\u30C8\u3092\u62D2\u5426\u3057\u307E\u3057\u305F\u3002\u30D5\u30C3\u30AF\u304C\u5831\u544A\u3057\u305F\u554F\u984C\u3092\u751F\u6210\u3055\u308C\u305F\u30C6\u30B9\u30C8\u5185\u3067\u4FEE\u6B63\u3059\u308B\u304B\u3001Testbot \u306E\u751F\u6210\u3057\u305F\u30C6\u30B9\u30C8\u30D5\u30A1\u30A4\u30EB\u3092\u30B9\u30AD\u30C3\u30D7\u3059\u308B\u3088\u3046\u30D5\u30C3\u30AF\uFF0F\u30EA\u30F3\u30BF\u30FC\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002\uFF08\u3069\u3061\u3089\u306E\u914D\u4FE1\u30E2\u30FC\u30C9\u3067\u3082 `git commit` \u3092\u5B9F\u884C\u3059\u308B\u305F\u3081\u3001`generatedTestsMode` \u3092\u5207\u308A\u66FF\u3048\u3066\u3082\u30D5\u30C3\u30AF\u306F\u30B9\u30AD\u30C3\u30D7\u3055\u308C\u307E\u305B\u3093\u3002\uFF09",testbotPrCreationFailure:(t,e)=>`\u751F\u6210\u3055\u308C\u305F\u30C6\u30B9\u30C8\u306E Testbot PR \u3092\u958B\u3051\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30A8\u30E9\u30FC: \`${t}\`\u3002\u30C6\u30B9\u30C8\u306F \`${e}\` \u306B\u30B3\u30DF\u30C3\u30C8\u30FB\u30D7\u30C3\u30B7\u30E5\u6E08\u307F\u3067\u3059\u3002\u3053\u306E\u30D6\u30E9\u30F3\u30C1\u304B\u3089\u30D7\u30EB\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u4F5C\u6210\u3057\u3066\u30EC\u30D3\u30E5\u30FC\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,sameBranchTestRepoConflictError:"`generatedTestsMode: same-branch` \u306F `testRepoPath` \u306E\u8A2D\u5B9A\u3068\u4F75\u7528\u3067\u304D\u307E\u305B\u3093\u3002\u30C6\u30B9\u30C8\u306F\u30C6\u30B9\u30C8\u30EA\u30DD\u30B8\u30C8\u30EA\u306E\u30C1\u30A7\u30C3\u30AF\u30A2\u30A6\u30C8\u5074\u306B\u751F\u6210\u3055\u308C\u307E\u3057\u305F\u304C\u3001same-branch \u30E2\u30FC\u30C9\u306F\u30D7\u30E9\u30A4\u30DE\u30EA\u30EA\u30DD\u30B8\u30C8\u30EA\u306E\u30C1\u30A7\u30C3\u30AF\u30A2\u30A6\u30C8\u306B\u306E\u307F\u30B3\u30DF\u30C3\u30C8\u3057\u307E\u3059\u3002`testRepoPath` \u3092\u4F7F\u3046\u5834\u5408\u306F `generatedTestsMode: separate-branch`\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8\uFF09\u3092\u4F7F\u7528\u3059\u308B\u304B\u3001`testRepoPath` \u3092\u524A\u9664\u3057\u3066\u540C\u3058\u30D6\u30E9\u30F3\u30C1\u306B\u30C6\u30B9\u30C8\u3092\u30B3\u30DF\u30C3\u30C8\u3057\u3066\u304F\u3060\u3055\u3044\u3002",noNewTestChangesBreadcrumb:t=>`\u3053\u306E\u30D7\u30C3\u30B7\u30E5\u3067\u306F\u65B0\u3057\u3044\u30C6\u30B9\u30C8\u5909\u66F4\u306F\u767A\u751F\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u4EE5\u524D\u306E\u30D7\u30C3\u30B7\u30E5\u3067\u4F5C\u6210\u3055\u308C\u305F [testbot PR](${t}) \u306F\u5F15\u304D\u7D9A\u304D\u30EC\u30D3\u30E5\u30FC\u5F85\u3061\u3067\u30AA\u30FC\u30D7\u30F3\u3067\u3059\u3002`,testbotPrLabel:(t,e)=>`Testbot PR: [${t}](${e})`,sutAppCrashDetected:t=>`**\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u30AF\u30E9\u30C3\u30B7\u30E5\u3092\u691C\u51FA:** \u30B5\u30FC\u30D3\u30B9\uFF08${t}\uFF09\u304C\u30B3\u30FC\u30C9\u30A8\u30E9\u30FC\u306B\u3088\u308A\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002`,sutErrorLine:t=>`
178
- **\u30A8\u30E9\u30FC:** \`${t}\``,sutFixPrefix:"**\u4FEE\u6B63\u65B9\u6CD5:** ",sutServiceNotReachable:t=>`**\u30B5\u30FC\u30D3\u30B9\u306B\u5230\u9054\u3067\u304D\u307E\u305B\u3093:** ${t} \u306E\u30B5\u30FC\u30D3\u30B9\u304C\u30D8\u30EB\u30B9\u30C1\u30A7\u30C3\u30AF\u306E\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u307E\u3067\u306B\u5FDC\u7B54\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B5\u30FC\u30D3\u30B9\u304C\u307E\u3060\u8D77\u52D5\u4E2D\u3067\u3042\u308B\u304B\u3001\u8D77\u52D5\u30B3\u30DE\u30F3\u30C9\u304C\u30B5\u30FC\u30D3\u30B9\u3092\u7ACB\u3061\u4E0A\u3052\u3089\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002`,sutServiceNotReachableFix:"**\u4FEE\u6B63\u65B9\u6CD5:** `targetSetupCommand` \u304C\u3053\u306E\u30B5\u30FC\u30D3\u30B9\u3092\u5B9F\u969B\u306B\u8D77\u52D5\u3057\u3001\u60F3\u5B9A\u3057\u305F\u30DD\u30FC\u30C8\u3067\u5F85\u3061\u53D7\u3051\u3066\u3044\u308B\u304B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30B3\u30DE\u30F3\u30C9\u81EA\u4F53\u306F\u6B63\u3057\u3044\u304C\u30B5\u30FC\u30D3\u30B9\u306E\u8D77\u52D5\u304C\u9045\u3044\u5834\u5408\u306F\u3001`targetReadyCheckTimeout` \u3092\u5897\u3084\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u3088\u308A\u78BA\u5B9F\u306A\u8D77\u52D5\u5224\u5B9A\u3092\u884C\u3046\u306B\u306F\u3001`targetReadyCheckCommand` \u3067\u7279\u5B9A\u306E\u30D8\u30EB\u30B9\u30C1\u30A7\u30C3\u30AF\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3092\u30D7\u30ED\u30FC\u30D6\u3059\u308B\u3088\u3046\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",staged:{requestedByPerson:t=>`${t} \u3055\u3093\u306E\u4F9D\u983C\u3067\u5B9F\u884C`,requestedByPolicy:t=>`\u691C\u8A3C\u30DD\u30EA\u30B7\u30FC ${t} \u306B\u3088\u308A\u5B9F\u884C`,noLiveApp:t=>`> \u26A0\uFE0F **\u3053\u306E\u5B9F\u884C\u3067\u306F\u7A3C\u50CD\u4E2D\u306E\u30A2\u30D7\u30EA\uFF08SUT\uFF09\u304C\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F** \u2014 \u4EE5\u4E0B\u306E ${t} \u4EF6\u306E\u30C6\u30B9\u30C8\u306F**\u5B9F\u884C\u3055\u308C\u3066\u3044\u307E\u305B\u3093**\uFF08\u5B9F\u884C\u5BFE\u8C61\u306E\u30A2\u30D7\u30EA\u304C\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F\uFF09\u3002\u7A3C\u50CD\u4E2D\u306E\u30A2\u30D7\u30EA\u306B\u5BFE\u3057\u3066\u5B9F\u884C\u3057\u3001\u5408\u683C\u3059\u308B\u3053\u3068\uFF08\u304A\u3088\u3073\u518D\u73FE\u30C6\u30B9\u30C8\u304C\u610F\u56F3\u3069\u304A\u308A\u5931\u6557\u3059\u308B\u3053\u3068\uFF09\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,unitTestsInFile:(t,e,r)=>`**${t}**: ${r?`${r} \u306E`:""}\u30E6\u30CB\u30C3\u30C8\u30C6\u30B9\u30C8 ${e} \u4EF6`,addedToExistingFile:"\u65E2\u5B58\u306E\u30C6\u30B9\u30C8\u30D5\u30A1\u30A4\u30EB\u306B\u8FFD\u52A0",testPackagesHeader:"### \u{1F4E6} \u3053\u308C\u3089\u306E\u30C6\u30B9\u30C8\u306E\u5B9F\u884C\u65B9\u6CD5",testPackageLine:(t,e)=>`\`${t}/\` \u306F Skyramp Testbot \u304C\u6240\u6709\u30FB\u4FDD\u5B88\u3059\u308B\u72EC\u7ACB\u3057\u305F\u30C6\u30B9\u30C8\u30D1\u30C3\u30B1\u30FC\u30B8\u3067\u3001\u72EC\u81EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u3001\u30ED\u30C3\u30AF\u30D5\u30A1\u30A4\u30EB\u3001\u30E9\u30F3\u30CA\u30FC\u8A2D\u5B9A\u3092\u6301\u3061\u307E\u3059\u3002\`${e}\` \u3067\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002\u3059\u3079\u3066\u306E\u30D7\u30EB\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u5B9F\u884C\u3059\u308B\u306B\u306F\u3001\u3053\u306E\u30B3\u30DE\u30F3\u30C9\u3092 CI \u306B\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,appManifestsUntouched:"\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u81EA\u8EAB\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u3068\u30ED\u30C3\u30AF\u30D5\u30A1\u30A4\u30EB\u306F\u5909\u66F4\u3057\u3066\u3044\u307E\u305B\u3093\u3002",dependencyChangesHeader:"### \u{1F4E6} \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u4F9D\u5B58\u95A2\u4FC2\u306E\u5909\u66F4",dependencyChangeLine:(t,e,r)=>`\`${e}\`\uFF08\u304A\u3088\u3073\u305D\u306E\u30ED\u30C3\u30AF\u30D5\u30A1\u30A4\u30EB\uFF09\u306B \`${t}\` \u3092\u8FFD\u52A0${r?`: ${r}`:""}`,testMaintenanceHeader:"\u2705 \u30C6\u30B9\u30C8\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9",keptNot:"\u5909\u66F4\u305B\u305A\u7DAD\u6301 \u2014 \u898B\u9001\u3063\u305F\u64CD\u4F5C: ",declinedPlanned:"(\u4E88\u5B9A\u3057\u3066\u3044\u305F\u64CD\u4F5C\u3092\u898B\u9001\u308A: ",declinedMaintenanceHeader:"\u21A9\uFE0F \u898B\u9001\u3063\u305F\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9",existingEvidenceHeader:"\u2705 \u65E2\u5B58\u306E\u30A8\u30D3\u30C7\u30F3\u30B9",trustedCheckPassed:(t,e)=>`\u4FE1\u983C\u6E08\u307F\u306E CI \u30C1\u30A7\u30C3\u30AF ${t} \u304C${e?` ${e} \u3067`:""}\u5408\u683C\u3057\u3001\u6B21\u3092\u78BA\u8A8D\u3057\u307E\u3057\u305F:`,testResultsHeader:"\u{1F9EA} \u30C6\u30B9\u30C8\u7D50\u679C",resultsTableHeader:"| \u30C6\u30B9\u30C8 ID | \u30C6\u30B9\u30C8\u7A2E\u5225 | \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8 | \u30B9\u30C6\u30FC\u30BF\u30B9 | \u8A73\u7D30 |",unitResultsTableHeader:"| \u30C6\u30B9\u30C8 ID | \u30C6\u30B9\u30C8\u7A2E\u5225 | \u30C6\u30B9\u30C8\u5BFE\u8C61\u306E\u30B3\u30FC\u30C9 | \u30C6\u30B9\u30C8 | \u30B1\u30FC\u30B9\u6570 | \u30B9\u30C6\u30FC\u30BF\u30B9 | \u8A73\u7D30 |",casesPassed:(t,e,r)=>`${e} \u4EF6\u4E2D ${t} \u4EF6\u5408\u683C${r?`\u3001${r} \u4EF6\u30B9\u30AD\u30C3\u30D7`:""}`,behaviourCoverageHeader:"\u{1F517} \u632F\u308B\u821E\u3044\u306E\u30AB\u30D0\u30EC\u30C3\u30B8",coverageCaption:(t,e,r,n)=>`\uFF08\u751F\u6210 ${t} \xB7 \u5909\u66F4 ${e} \xB7 \u691C\u8A3C ${r} \xB7 \u5B9F\u884C ${n}\uFF09`,coverageTableHeader:"| \u632F\u308B\u821E\u3044 | \u30BD\u30FC\u30B9 | \u30C6\u30B9\u30C8 | \u30E1\u30F3\u30C6\u30CA\u30F3\u30B9 |",writtenNotRun:"\u4F5C\u6210\u6E08\u307F\u30FB\u672A\u5B9F\u884C",issuesFoundHeader:"\u26A0\uFE0F \u691C\u51FA\u3055\u308C\u305F\u554F\u984C",caveatsHeader:"### \u26A0\uFE0F \u3053\u306E\u5B9F\u884C\u3067\u78BA\u8A8D\u3067\u304D\u306A\u304B\u3063\u305F\u3053\u3068",commentHeader:"### Skyramp Testbot",timedOut:"> \u26A0\uFE0F \u5B9F\u884C\u304C\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F \u2014 \u4EE5\u4E0B\u306E\u7D50\u679C\u306F\u4E00\u90E8\u306E\u307F\u3067\u3059\u3002",stopReasons:{"pr-closed":"\u30D7\u30EB\u30EA\u30AF\u30A8\u30B9\u30C8\u304C\u30DE\u30FC\u30B8\u3055\u308C\u305A\u306B\u30AF\u30ED\u30FC\u30BA\u3055\u308C\u307E\u3057\u305F",cancelled:"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u304C\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u305F\u304B\u3001\u30E9\u30F3\u30CA\u30FC\u304C\u505C\u6B62\u3057\u307E\u3057\u305F","attempt-cancelled":"Skyramp \u3067\u3053\u306E\u5B9F\u884C\u304C\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F","attempt-closed":"Skyramp \u304C\u3053\u306E\u5B9F\u884C\u3092\u7D42\u4E86\u3057\u307E\u3057\u305F"},maintenanceActions:{update:"\u66F4\u65B0",regenerate:"\u518D\u751F\u6210",delete:"\u524A\u9664",verify:"\u691C\u8A3C",updated:"\u66F4\u65B0",regenerated:"\u518D\u751F\u6210",deleted:"\u524A\u9664",verified:"\u691C\u8A3C"},publishFailures:{push:"\u30D7\u30C3\u30B7\u30E5\u306B\u5931\u6557",auth:"\u8A8D\u8A3C\u30A8\u30E9\u30FC",conflict:"\u7AF6\u5408",unknown:"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"},stoppedEarly:(t,e)=>`> \u26A0\uFE0F \u5B9F\u884C\u304C\u9014\u4E2D\u3067\u505C\u6B62\u3057\u307E\u3057\u305F \u2014 ${t}\u3002\u4EE5\u4E0B\u306E\u7D50\u679C\u306F\u4E00\u90E8\u306E\u307F\u3067\u3059\u3002${e}`,viewInSkyramp:t=>` [Skyramp \u3067\u8868\u793A](${t})`,setupRunEnds:{finished:"\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B9F\u884C\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002Skyramp \u304C\u7D50\u679C\u3092\u78BA\u8A8D\u3057\u3066\u3044\u307E\u3059\u3002",failed:"\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B9F\u884C\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002",timedOut:"\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B9F\u884C\u304C\u6642\u9593\u5207\u308C\u306B\u306A\u308A\u307E\u3057\u305F\u3002",cancelledInSkyramp:"\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B9F\u884C\u306F Skyramp \u3067\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F\u3002",stoppedToResume:"\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B9F\u884C\u3092\u505C\u6B62\u3057\u307E\u3057\u305F\u3002Skyramp \u3067\u518D\u958B\u3067\u304D\u307E\u3059\u3002"},appUnreachable:t=>`Skyramp\uFF08${t}\uFF09\u306B\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u518D\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002`,couldNotStart:t=>`Skyramp Testbot \u3092\u958B\u59CB\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${t}`,assembledAfterFailedChecks:t=>`> \u26A0\uFE0F \u4F5C\u6210\u30B9\u30C6\u30C3\u30D7\u304C\u30C1\u30A7\u30C3\u30AF\u306B\u5408\u683C\u3057\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u3053\u306E\u30EC\u30DD\u30FC\u30C8\u306F\u81EA\u52D5\u3067\u7D44\u307F\u7ACB\u3066\u3089\u308C\u307E\u3057\u305F\u3002${t} \u4EF6\u306E\u30C1\u30A7\u30C3\u30AF\u304C\u672A\u9054\u6210\u3067\u3059 \u2014 \u8A73\u7D30\u306F\u5B9F\u884C\u30ED\u30B0\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,testbotPrLine:(t,e,r)=>`Testbot PR${t?`\uFF08${t}\uFF09`:""}: [${e}](${r})`,viewRun:t=>`_[\u5B9F\u884C\u3092\u8868\u793A](${t})_`,testsPrNotOpened:(t,e)=>`\u30C6\u30B9\u30C8 PR \u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${t}\uFF09\u3002\u30C6\u30B9\u30C8\u306F\u30D6\u30E9\u30F3\u30C1 \`${e}\` \u306B\u30D7\u30C3\u30B7\u30E5\u3055\u308C\u3066\u3044\u307E\u3059\u3002`,testsNotPushed:(t,e)=>`\u30C6\u30B9\u30C8\u3092\u30D7\u30C3\u30B7\u30E5\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${t}\uFF09\u3002\u30C6\u30B9\u30C8\u306F\u30ED\u30FC\u30AB\u30EB\u30D6\u30E9\u30F3\u30C1 \`${e}\` \u306B\u6B8B\u3063\u3066\u3044\u307E\u3059\u3002`,testsPrRetargeted:t=>`\u30C6\u30B9\u30C8\u306E\u751F\u6210\u4E2D\u306B\u958B\u767A PR \u304C\u30DE\u30FC\u30B8\u3055\u308C\u307E\u3057\u305F \u2014 \u30C6\u30B9\u30C8 PR \u306F\u4EE3\u308F\u308A\u306B\u30D9\u30FC\u30B9\u30D6\u30E9\u30F3\u30C1${t?`\uFF08\`${t}\`\uFF09`:""}\u3092\u5BFE\u8C61\u306B\u3057\u3066\u3044\u307E\u3059\u3002`,testsPrUnchanged:"\u3053\u306E\u30D7\u30C3\u30B7\u30E5\u3067\u306F\u65B0\u3057\u3044\u30C6\u30B9\u30C8\u306E\u5909\u66F4\u306F\u4E0D\u8981\u3067\u3057\u305F\u3002\u4EE5\u4E0B\u306E\u30C6\u30B9\u30C8 PR \u306F\u4EE5\u524D\u306E\u5B9F\u884C\u306E\u3082\u306E\u3067\u3001\u305D\u306E\u307E\u307E\u306B\u3057\u3066\u3044\u307E\u3059\u3002",committedNoPr:t=>`\u30C6\u30B9\u30C8\u306F\u30B3\u30DF\u30C3\u30C8\u3055\u308C\u307E\u3057\u305F\u304C\u3001PR \u306F\u4F5C\u6210\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: ${t}\u3002`}};var SI=(r=>(r.En="en",r.Ja="ja",r))(SI||{}),GVe={en:Ko,ja:zVe},Zne="en";function gq(t){let e=t.trim().toLowerCase();if(e==="")return"en";let r=Object.values(SI);return r.includes(e)?e:(X(`Invalid language '${t}'. Supported: ${r.join(", ")}. Falling back to 'en'.`),"en")}function uB(t){Zne=t}function jVe(){return Zne}function mA(t,e){return(Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0)??e}function ne(){return GVe[Zne]}function VVe(){let e=[];for(let r of Object.values(GVe))for(let n of[r.testbotPrBacklink,r.testbotPrDispatchBacklink,r.testbotPrMergedBacklink]){let s=n("\0");if(s.indexOf("\0")<0){X("A Testbot PR backlink template does not interpolate its argument; skipping it for stale-backlink stripping.");continue}e.push({prefix:s.slice(0,s.indexOf("\0")),suffix:s.slice(s.lastIndexOf("\0")+1)})}return e}var OE=(a=>(a.ProviderOutage="provider_outage",a.ProviderRateLimit="provider_rate_limit",a.ProviderUsageLimit="provider_usage_limit",a.ProviderAuthExpired="provider_auth_expired",a.Timeout="timeout",a.NoReport="no_report",a.RenderFailure="render_failure",a))(OE||{});(e=>{function t(r,n){switch(r){case"provider_outage":return{headline:ne().providerOutageHeadline(n.provider.name,n.maxRetries),action:ne().providerOutageActionStatusPage(n.provider.statusUrl)};case"provider_rate_limit":return{headline:ne().providerRateLimitHeadline(n.provider.name),action:ne().providerRateLimitAction};case"provider_usage_limit":return{headline:ne().providerUsageLimitHeadline(n.provider.name),action:ne().providerUsageLimitAction};case"provider_auth_expired":return{headline:ne().providerAuthExpiredHeadline(n.provider.name),action:ne().providerAuthExpiredAction};case"timeout":return{headline:ne().providerTimeoutHeadline(n.timeoutMinutes),action:ne().providerTimeoutAction};case"no_report":case"render_failure":return}}e.buildNotice=t})(OE||={});var Aq=(r=>(r.SameBranch="same-branch",r.SeparateBranch="separate-branch",r))(Aq||{}),Vs="skyramp",qf=class{supportsNdjsonLog=!1;reusesPreinstalledCli=!0;skillsPluginDir(){}setupAgentEnv(e,r){let n=e[this.apiKeyField];n&&ei(this.envVar,n)}};dB();dB();dB();Sc();function mB(t,e){if(process.env.GITHUB_ACTIONS)return new ME(t,vp,e);throw new Error("Unrecognized CI environment. Set GITHUB_ACTIONS=true for GitHub Actions, or use EvalPlatform directly for eval/testing.")}Ke();zKe();var GKe=t=>gae({...t});var Aae=(r=>(r.Sonnet="sonnet",r.Opus="opus",r))(Aae||{}),jKe="opus",VKe={sonnet:"claude-sonnet-5[1m]",opus:"claude-opus-5-5[1m]"},WKe=VKe[jKe],M7t={sonnet:"anthropic.claude-sonnet-5[1m]",opus:"anthropic.claude-opus-5-5[1m]"};function JI(t){return Object.values(Aae).includes(t)}function yae(t){let e=(t??"").trim();if(e==="")return jKe;let r=e.toLowerCase();return JI(r)?r:e}function Q7t(t){let e=(t??"").trim().toLowerCase();return e.startsWith("us-gov-")?"us-gov":e.startsWith("eu-")?"eu":e.startsWith("ap-")?"apac":"us"}function KH(t,e){return`${Q7t(e)}.${M7t[t]}`}function bae(t){return t||process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||""}function YKe(t,e){if(e)return e;let r=yae(t.model);return JI(r)?t.useBedrock?KH(r,bae(t.awsRegion)):VKe[r]:r}async function L7t(t){return GKe({roleArn:t.roleArn,webIdentityToken:t.webIdentityToken,roleSessionName:t.roleSessionName,durationSeconds:t.durationSeconds,clientConfig:{region:t.region}})()}var nP=3600,F7t=43200,U7t=15;function $7t(t){let e=Math.ceil((t+U7t)*60);return Math.min(F7t,Math.max(nP,e))}function q7t(t){return t instanceof Error?t.name==="ValidationError"&&/MaxSessionDuration|DurationSeconds/i.test(t.message):!1}async function XH(t){let e=t.env??process.env,r=e.AWS_ROLE_ARN?.trim(),n=e.AWS_REGION?.trim()||e.AWS_DEFAULT_REGION?.trim();if(e.SKYRAMP_REFRESH_BEDROCK_SESSION!=="1"||e.CLAUDE_CODE_USE_BEDROCK!=="1")return!1;let s=t.identity;if(!r||!s||!n)return t.debug("Bedrock session refresh skipped: needs AWS_ROLE_ARN, AWS_REGION (or AWS_DEFAULT_REGION) and a web identity from the job"),!1;try{let i=await s.token("sts.amazonaws.com");if(!i)throw new Error("OIDC response carried no token value");let o=`testbot-agent-${s.runId??"local"}`.replace(/[^A-Za-z0-9=,.@_-]/g,"").slice(0,64),a=t.assumeRole??L7t,c={roleArn:r,webIdentityToken:i,roleSessionName:o,region:n},l=$7t(t.timeoutMinutes),u,d=nP;try{u=await a({...c,durationSeconds:l}),d=l}catch(p){if(l<=nP||!q7t(p))throw p;t.warning(`The Bedrock role rejected a ${l}s session (its MaxSessionDuration is lower). Minting a ${nP}s session instead, which is shorter than the ${t.timeoutMinutes}m testbotTimeout; raise MaxSessionDuration on ${r} to at least ${l}s or the agent can lose its credentials mid-run.`),u=await a({...c,durationSeconds:nP})}if(!u.accessKeyId||!u.secretAccessKey||!u.sessionToken)throw new Error("assume-role returned an incomplete credential triple");return t.setSecret(u.accessKeyId),t.setSecret(u.secretAccessKey),t.setSecret(u.sessionToken),e.AWS_ACCESS_KEY_ID=u.accessKeyId,e.AWS_SECRET_ACCESS_KEY=u.secretAccessKey,e.AWS_SESSION_TOKEN=u.sessionToken,t.debug(`Minted a fresh Bedrock session for this agent attempt (${d}s)`),t.onMinted?.(u.expiration?.getTime()??Date.now()+d*1e3),!0}catch(i){return t.warning(`Could not refresh the Bedrock session; continuing with existing credentials: ${i instanceof Error?i.message:String(i)}`),!1}}var ZH=(i=>(i.Low="low",i.Medium="medium",i.High="high",i.XHigh="xhigh",i.Max="max",i))(ZH||{}),KI="high",JKe="medium";function KKe(t){return Object.values(ZH).includes(t)}var XKe=5;function H7t(t){let e=t.split(/\r?\n/).map(r=>r.trim()).filter(Boolean);if(e.length>XKe)throw new Error(`relatedRepoPaths supports at most ${XKe} entries (got ${e.length}); the cap limits how much cross-repo context is loaded to avoid overflowing Testbot's context window.`);return e}function z7t(t){let e=t.trim().toLowerCase();return e===""?"separate-branch":Object.values(Aq).includes(e)?e:(X(`Invalid generatedTestsMode '${t}'. Falling back to 'separate-branch'.`),"separate-branch")}function G7t(t){let e=(t??"").trim();if(e!==""){if(/^(?:[1-9]|10)$/.test(e))return Number(e);X(`Ignoring perTestMaxFixAttempts="${t}": expected a whole number from 1 to 10; the Skyramp MCP default applies`)}}function j7t(t){let e=(t??"").trim().toLowerCase();return e===""?KI:KKe(e)?e:(X(`Ignoring effort="${t}": expected one of ${Object.values(ZH).join(", ")}; using "${KI}"`),KI)}function e2(){let t=yae(qe("model"));return JI(t)||X(`model '${t}' is not a tested alias (sonnet, opus); passing it to the agent verbatim as a raw model id.`),{skyrampLicenseFile:qe("skyrampLicenseFile"),cursorApiKey:qe("cursorApiKey"),copilotApiKey:qe("copilotApiKey"),anthropicApiKey:qe("anthropicApiKey"),useBedrock:Cd("useBedrock"),awsRegion:qe("awsRegion"),useLocalAuth:qe("useLocalAuth").toLowerCase()==="true",model:t,effort:j7t(qe("effort")),targetSetupCommand:qe("targetSetupCommand"),authTokenCommand:qe("authTokenCommand"),uiCredentials:qe("uiCredentials"),targetTeardownCommand:qe("targetTeardownCommand"),skipTargetTeardown:Cd("skipTargetTeardown"),skyrampExecutorVersion:qe("skyrampExecutorVersion"),skyrampMcpVersion:qe("skyrampMcpVersion"),skyrampMcpSource:qe("skyrampMcpSource"),skyrampMcpGithubToken:qe("skyrampMcpGithubToken"),skyrampMcpGithubRef:qe("skyrampMcpGithubRef"),nodeVersion:qe("nodeVersion"),skipTargetSetup:Cd("skipTargetSetup"),targetReadyCheckCommand:qe("targetReadyCheckCommand"),targetReadyCheckTimeout:(()=>{let r=parseInt(qe("targetReadyCheckTimeout"),10)||1800;return r<1?(X(`targetReadyCheckTimeout must be at least 1 second, got ${r}. Using 1s.`),1):r})(),targetReadyCheckInterval:(()=>{let r=parseInt(qe("targetReadyCheckInterval"),10),n=isNaN(r)?30:r;return n<1?(X(`targetReadyCheckInterval must be at least 1 second, got ${n}. Using 1s.`),1):n})(),targetReadyCheckDiagnosticsCommand:(()=>{let r=qe("targetReadyCheckDiagnosticsCommand");return r.trim().toLowerCase()==="none"?"":r})(),workingDirectory:qe("workingDirectory"),autoCommit:Cd("autoCommit"),commitMessage:qe("commitMessage"),generatedTestsMode:z7t(qe("generatedTestsMode")),postPrComment:Cd("postPrComment"),testExecutionTimeout:parseInt(qe("testExecutionTimeout"),10)||300,maxRecommendations:(()=>{let r=parseInt(qe("maxRecommendations"),10);return isNaN(r)?void 0:Math.max(0,r)})(),maxGenerate:(()=>{let r=parseInt(qe("maxGenerate"),10);return isNaN(r)?void 0:Math.max(0,r)})(),perTestMaxFixAttempts:G7t(qe("perTestMaxFixAttempts")),testbotMaxRetries:parseInt(qe("testbotMaxRetries"),10)||3,testbotRetryDelay:parseInt(qe("testbotRetryDelay"),10)||10,testbotTimeout:parseInt(qe("testbotTimeout"),10)||60,targetSetupRetries:parseInt(qe("targetSetupRetries"),10)||3,targetSetupRetryDelay:parseInt(qe("targetSetupRetryDelay"),10)||10,authTokenRetries:(()=>{let r=parseInt(qe("authTokenRetries"),10);return Number.isFinite(r)&&r>=1?r:6})(),authTokenRetryDelay:(()=>{let r=parseInt(qe("authTokenRetryDelay"),10);return Number.isFinite(r)&&r>=0?r:10})(),reportCollapsed:Cd("reportCollapsed"),language:gq(qe("language")),enableDebug:Cd("enableDebug"),testRepoPath:qe("testRepoPath")||void 0,relatedRepoPaths:H7t(qe("relatedRepoPaths")),allowedAuthors:qe("allowedAuthors").split(/\r?\n/).map(r=>r.trim()).filter(Boolean)}}function ZKe(t){let e=!!t.cursorApiKey,r=!!t.copilotApiKey,n=!!t.anthropicApiKey;if(t.useBedrock){if(e||r)throw new Error("useBedrock cannot be combined with cursorApiKey or copilotApiKey. Bedrock is a provider for the Claude Code agent.");return n&&X("anthropicApiKey is ignored when useBedrock is true \u2014 Bedrock provides model credentials via AWS."),t.useLocalAuth&&X("useLocalAuth is ignored when useBedrock is true \u2014 Bedrock provides model credentials via AWS."),Ne("Using Claude Code CLI agent (AWS Bedrock)"),"claude"}if(t.useLocalAuth){if(e||r)throw new Error("useLocalAuth cannot be combined with cursorApiKey or copilotApiKey. Local auth is a provider for the Claude Code agent.");return n&&X("anthropicApiKey is ignored when useLocalAuth is true \u2014 the already-logged-in claude CLI session is used instead."),Ne("Using Claude Code CLI agent (local auth)"),"claude"}if([e,r,n].filter(Boolean).length>1)throw new Error("Multiple agent API keys provided. Please provide only one of: cursorApiKey, copilotApiKey, anthropicApiKey.");if(e)return Ne("Using Cursor CLI agent"),"cursor";if(r)return Ne("Using GitHub Copilot CLI agent"),"copilot";if(n)return Ne("Using Claude Code CLI agent"),"claude";throw new Error("No agent API key provided. Please provide one of: cursorApiKey, copilotApiKey, or anthropicApiKey.")}Ke();var r2=q(require("fs")),Eae=q(require("path"));Ke();uN();var t9e=q(require("child_process")),dw=class extends Error{constructor(e){super(e),this.name="ExecTimeoutError"}},XI=class extends Error{constructor(e){super(e),this.name="ExecAbortedError"}};function e9e(t,e){if(!(!t||t.destroyed||t.writableEnded))try{t.write(e)}catch(r){X(`stream write failed: ${r instanceof Error?r.message:String(r)}`)}}async function Be(t,e=[],r={}){let n="",s="",i={cwd:r.cwd,silent:r.silent??!1,ignoreReturnCode:r.ignoreReturnCode??!1,env:r.env?{...process.env,...r.env}:void 0,input:r.input,listeners:{stdout:a=>{n+=a.toString(),e9e(r.stdoutStream,a)},stderr:a=>{s+=a.toString()}}};if(r.timeout||r.signal){let a=r.signal;return a?.aborted?Promise.reject(new XI(`Command aborted before start: ${t}`)):new Promise((c,l)=>{let u=t9e.spawn(t,e,{cwd:r.cwd,env:r.env?{...process.env,...r.env}:process.env,stdio:["pipe","pipe","pipe"],shell:!1});u.stdout?.on("data",h=>{n+=h.toString(),r.silent||process.stdout.write(h),e9e(r.stdoutStream,h)}),u.stderr?.on("data",h=>{s+=h.toString(),r.silent||process.stderr.write(h)}),r.input&&u.stdin?.end(r.input);let d=()=>{f&&clearTimeout(f),a?.removeEventListener("abort",m)},p=h=>{d();try{u.kill("SIGTERM")}catch{}l(h)},m=()=>p(new XI(`Command aborted: ${t}`)),f=r.timeout?setTimeout(()=>p(new dw(`Command timed out after ${Math.round(r.timeout/6e4)}m: ${t}`)),r.timeout):void 0;a?.addEventListener("abort",m,{once:!0}),u.on("close",h=>{d();let A=h??1;A!==0&&!r.ignoreReturnCode?l(new Error(`The process '${t}' failed with exit code ${A}`)):c({exitCode:A,stdout:n,stderr:s})}),u.on("error",h=>{d(),l(h)})})}return{exitCode:await SS(t,e,i),stdout:n,stderr:s}}function iP(t){return(e,r)=>{let n=t?{...r,cwd:t}:r;return n?Be("git",e,n):Be("git",e)}}function NA(t){return new Promise(e=>setTimeout(e,t*1e3))}async function li(t,e){for(let r=1;r<=e.retries;r++)try{return await t()}catch(n){if(r<e.retries)X(`${e.label} failed, retrying (${r}/${e.retries})...`),await NA(e.delay);else throw n}throw new Error("unreachable")}async function Xn(t,e){wi(t);try{return await e()}finally{ss()}}async function r9e(t){let e=process.getuid?.(),r=process.getgid?.();if(!(e===void 0||r===void 0))try{let{exitCode:n,stderr:s}=await Be("sudo",["-n","chown","-R","-h",`${e}:${r}`,"."],{cwd:t,silent:!0,ignoreReturnCode:!0});n!==0&&Rt(`worktree chown skipped (exit ${n}): ${s.trim()}`)}catch(n){Rt(`worktree chown skipped: ${n instanceof Error?n.message:String(n)}`)}}var n9e=!1;function s9e(t){n9e=t}function Rt(t){n9e&&ee(`[debug] ${t}`)}var V7t=1e3;function Qa(t){return t*V7t}function Dl(t){let e=t.split("/");return e.length===2&&e[0]&&e[1]?{owner:e[0],repo:e[1]}:null}var sP=/^[A-Za-z_][A-Za-z0-9_.-]*$/;function i9e(t){if(t.startsWith("{"))try{let o=JSON.parse(t);return{username:typeof o.username=="string"?o.username:void 0,password:typeof o.password=="string"?o.password:void 0,role:typeof o.role=="string"?o.role:void 0}}catch{return{}}let e=t.indexOf(":"),n=!(e>=0&&!/[=;]/.test(t.slice(0,e)))&&/(^|;)\s*role\s*=/.test(t);if(/(^|;)\s*(username|password)\s*=/.test(t)||n){let o=new Map;for(let a of t.split(";")){let c=a.indexOf("=");c>0&&sP.test(a.slice(0,c).trim())&&o.set(a.slice(0,c).trim(),a.slice(c+1).trim())}return{username:o.get("username"),password:o.get("password"),role:o.get("role")}}if(t==="")return{};if(!t.includes(":"))for(let o of t.split(";")){let a=o.indexOf("=");if(a>0&&sP.test(o.slice(0,a).trim()))return{}}let[s,...i]=t.split(":");return{username:s,password:i.join(":")}}function o9e(t){let e=t.split(/\r?\n/).map(s=>s.trim()).find(s=>s!=="")??"",{username:r,password:n}=i9e(e);return{username:r,password:n}}function W7t(t){return t.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Y7t(t){let e=t.split(/\r?\n/).map(n=>n.trim()).filter(n=>n!==""),r=new Set;return e.map((n,s)=>{let{username:i,password:o,role:a}=i9e(n),c=s+1,l=a?W7t(a):"";for(l||(l=String(c));r.has(l);)l=`${l}_${c}`;return r.add(l),{key:l,username:i,password:o}})}function a9e(t){let e=Y7t(t);if(e.length<2)return[];let r=[];for(let{key:n,username:s,password:i}of e)s!==void 0&&r.push({envName:`SKYRAMP_UI_USERNAME_${n}`,value:s}),i!==void 0&&r.push({envName:`SKYRAMP_UI_PASSWORD_${n}`,value:i});return r}var t2=class extends qf{label="Cursor";provider={name:"Cursor",statusUrl:"https://status.cursor.com/"};binary="agent";envVar="CURSOR_API_KEY";apiKeyField="cursorApiKey";supportsNdjsonLog=!0;async install(){await Be("bash",["-c","set -o pipefail; curl https://cursor.com/install -fsS | bash"]),ARe(`${process.env.HOME}/.local/bin`),await Be("agent",["--version"],{silent:!0})}async initialize(){let{exitCode:e}=await Be("agent",["mcp","enable",Vs],{ignoreReturnCode:!0});if(e!==0)throw new Error(`Failed to enable MCP server '${Vs}' (exit code ${e})`);try{let{stdout:r}=await Be("agent",["mcp","list"]);r.includes(Vs)?Ne(`Cursor MCP server verified: ${Vs} is listed`):X(`${Vs} not found in MCP server list`)}catch{X("Could not list MCP servers")}}async configureMcp(e,r,n,s){let i=Eae.join(process.env.HOME??"~",".cursor");r2.mkdirSync(i,{recursive:!0});let o={mcpServers:{[Vs]:{command:e,args:r,env:n,timeout:Qa(s)}}};r2.writeFileSync(Eae.join(i,"mcp.json"),JSON.stringify(o,null,2))}buildCommand(e){return{command:"agent",args:["-f","-p","--model","claude-4.6-sonnet-medium","--output-format","stream-json"]}}};Ke();var ZI=q(require("fs")),oP=q(require("path"));var n2=class extends qf{label="GitHub Copilot";provider={name:"GitHub Copilot",statusUrl:"https://www.githubstatus.com/"};binary="copilot";envVar="GH_TOKEN";apiKeyField="copilotApiKey";async install(){await Be("npm",["install","-g","@github/copilot"])}async initialize(){try{await Be("copilot",["--version"]),Ne("GitHub Copilot CLI initialized successfully")}catch{X("Could not verify Copilot CLI version")}}async configureMcp(e,r,n,s){let i=oP.join(process.env.HOME??"~",".copilot");ZI.mkdirSync(i,{recursive:!0});let o={mcpServers:{[Vs]:{type:"local",command:e,args:r,tools:["*"],env:n,timeout:Qa(s)}}},a=JSON.stringify(o,null,2);ZI.writeFileSync(oP.join(i,"mcp-config.json"),a);let c=oP.join(process.cwd(),".copilot");ZI.mkdirSync(c,{recursive:!0}),ZI.writeFileSync(oP.join(c,"mcp-config.json"),a)}buildCommand(e){return{command:"copilot",args:["--additional-mcp-config",`@${process.env.HOME}/.copilot/mcp-config.json`,"--allow-all-tools","--allow-all-paths","-p"]}}};Ke();var aP=q(require("fs")),p9e=q(require("os")),c2=q(require("path"));var c9e=require("node:module"),l9e=q(require("node:path")),J7t="SKYRAMP_MCP_INSTALL_PATH";function s2(t){let e=process.env[J7t];if(e)try{return(0,c9e.createRequire)(l9e.join(e,"package.json"))(`@skyramp/mcp/${t}`)}catch{return}}var u9e=q(require("fs")),i2=q(require("path")),K7t="SKYRAMP_FEATURE_SKILLS",o2="SKYRAMP_SKILLS_LOADED";function a2(t={}){if(!t.ignoreFeatureFlag&&process.env[K7t]!=="1")return;let e=process.env.SKYRAMP_MCP_INSTALL_PATH;return e?[i2.join(e,"node_modules","@skyramp","mcp","plugin"),i2.join(e,"plugin")].find(n=>u9e.existsSync(i2.join(n,".claude-plugin","plugin.json"))):void 0}var wae="CLAUDE_CODE_EFFORT_LEVEL";function d9e(){return c2.join(process.env.RUNNER_TEMP??p9e.tmpdir(),"claude-code")}var X7t=["TodoWrite","TodoRead","Write","CronCreate","CronDelete","CronList","AskUserQuestion","NotebookEdit"];function Z7t(){return s2("personas")}var eer=Z7t;function ter(){try{let e=eer().SKYRAMP_QA_PERSONA;if(typeof e=="string"&&e.length>0)return Rt("Loaded SKYRAMP_QA_PERSONA from @skyramp/mcp"),e}catch{Rt("Could not load SKYRAMP_QA_PERSONA from @skyramp/mcp, running without persona")}return""}var TA=class extends qf{label="Claude Code";provider={name:"Claude API",statusUrl:"https://status.claude.com/"};reusesPreinstalledCli=!1;get binary(){return c2.join(d9e(),"node_modules",".bin","claude")}envVar="ANTHROPIC_API_KEY";apiKeyField="anthropicApiKey";supportsNdjsonLog=!0;model;effort;cleanupRegistered=!1;constructor(e=WKe,r=KI){super(),this.model=e,this.effort=r}async install(){let e=d9e();aP.rmSync(e,{recursive:!0,force:!0}),this.cleanupRegistered||(this.cleanupRegistered=!0,process.on("exit",()=>aP.rmSync(e,{recursive:!0,force:!0}))),await Be("npm",["install","--prefix",e,"@anthropic-ai/claude-code@latest"]);let r=c2.join(e,"node_modules","@anthropic-ai","claude-code","install.cjs");aP.existsSync(r)&&await Be("node",[r]);let{stdout:n}=await Be(this.binary,["--version"],{silent:!0});Ne(`Claude Code CLI ${n.trim()} installed at ${this.binary}`)}async initialize(){try{await Be(this.binary,["--version"]),Ne("Claude Code CLI initialized successfully")}catch{X("Could not verify Claude Code CLI version")}await this.verifyMcpConnectivity()}async verifyMcpConnectivity(){try{let{stdout:e}=await Be(this.binary,["mcp","list"]);e.split(`
179
- `).some(n=>n.includes(Vs)&&n.toLowerCase().includes("connected"))?Ne(`Claude MCP server verified: ${Vs} is connected`):/no mcp servers configured/i.test(e)?ee(`${Vs} is not registered with the Claude Code CLI; a staged run attaches it to each session and warns if it does not connect`):X(`${Vs} does not appear connected in MCP server list`)}catch{X("Could not verify MCP server connectivity")}}async configureMcp(e,r,n,s){await Be(this.binary,["mcp","remove","--scope","user",Vs],{ignoreReturnCode:!0});let i=["mcp","add","--scope","user",Vs];for(let[o,a]of Object.entries(n))i.push("-e",`${o}=${a}`);i.push("--",e,...r),await Be(this.binary,i)}skillsPluginDir(){return a2()}buildCommand(e,r=[]){let n=ter(),s=["--dangerously-skip-permissions","--model",this.model],i=this.skillsPluginDir();i&&s.push("--plugin-dir",i),n&&s.push("--append-system-prompt",n),s.push("--settings",JSON.stringify({outputStyle:"Concise"})),s.push(...r),s.push("-p","--output-format","stream-json","--verbose");let o=process.env.SKYRAMP_THINKING_DISPLAY;return o&&s.push("--thinking-display",o),s.push("--disallowedTools",...X7t,"--"),{command:this.binary,args:s}}pinEffortEnv(){let e=process.env[wae];e&&e!==this.effort&&X(`${wae}=${e} from the environment is overridden by the effort input ("${this.effort}").`),process.env[wae]=this.effort,ee(`Agent effort level: ${this.effort}`)}setupAgentEnv(e,r){!e.useBedrock&&!e.anthropicApiKey||(process.env.MCP_TIMEOUT=String(Qa(r.testExecutionTimeout)),process.env.ENABLE_TOOL_SEARCH="false",this.pinEffortEnv(),e.useBedrock?(process.env.CLAUDE_CODE_USE_BEDROCK="1",e.awsRegion&&(process.env.AWS_REGION=e.awsRegion),delete process.env.ANTHROPIC_API_KEY,process.env.AWS_ACCESS_KEY_ID||process.env.AWS_BEARER_TOKEN_BEDROCK||process.env.AWS_PROFILE||process.env.AWS_WEB_IDENTITY_TOKEN_FILE||X("useBedrock is set but no AWS credentials were detected in the environment. Add an aws-actions/configure-aws-credentials step (OIDC) before Testbot.")):e.anthropicApiKey&&(process.env.ANTHROPIC_API_KEY=e.anthropicApiKey,delete process.env.CLAUDE_CODE_USE_BEDROCK))}};var l2=class extends TA{provider={name:"Amazon Bedrock",statusUrl:"https://health.aws.amazon.com/health/status"}};Ke();var Jf=q(require("fs")),xae=q(require("path"));Sc();var u2=class extends TA{mcpConfigPath;setupAgentEnv(e,r){process.env.MCP_TIMEOUT=String(Qa(r.testExecutionTimeout)),process.env.ENABLE_TOOL_SEARCH="false",this.pinEffortEnv(),delete process.env.ANTHROPIC_API_KEY,delete process.env.CLAUDE_CODE_USE_BEDROCK,process.env.CLAUDE_CODE_DISABLE_CLAUDE_MDS="1"}async configureMcp(e,r,n,s){let i=xae.join(Bl(),"local-auth");Jf.mkdirSync(i,{recursive:!0,mode:448}),Jf.chmodSync(i,448);let o=xae.join(i,`mcp-config-${process.pid}.json`);Jf.writeFileSync(o,JSON.stringify({mcpServers:{[Vs]:{command:e,args:r,env:n}}}),{mode:384}),Jf.chmodSync(o,384),this.mcpConfigPath=o,process.on("exit",()=>{try{Jf.unlinkSync(o)}catch{}})}async verifyMcpConnectivity(){Ne("Skipping MCP connectivity check for local auth \u2014 nothing is registered via `claude mcp add` to list.")}buildCommand(e){let r=["--setting-sources","project","--no-session-persistence"];return this.mcpConfigPath&&r.push("--mcp-config",this.mcpConfigPath,"--strict-mcp-config"),super.buildCommand(e,r)}};function d2(t,e){switch(t){case"cursor":return new t2;case"copilot":return new n2;case"claude":return e?.useBedrock?new l2(e.model,e.effort):e?.useLocalAuth?new u2(e.model,e.effort):new TA(e?.model,e?.effort);default:{let r=t;throw new Error(`Unsupported agent type: ${r}`)}}}Ke();var tZe=q(require("path"));var ev=require("fs"),Kf=q(require("path"),1),iXe=require("child_process"),oXe=require("util");function rer(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xo={},p2={},kA={},m9e;function cP(){if(m9e)return kA;m9e=1;function t(o){return typeof o>"u"||o===null}function e(o){return typeof o=="object"&&o!==null}function r(o){return Array.isArray(o)?o:t(o)?[]:[o]}function n(o,a){if(a){let c=Object.keys(a);for(let l=0,u=c.length;l<u;l+=1){let d=c[l];o[d]=a[d]}}return o}function s(o,a){let c="";for(let l=0;l<a;l+=1)c+=o;return c}function i(o){return o===0&&Number.NEGATIVE_INFINITY===1/o}return kA.isNothing=t,kA.isObject=e,kA.toArray=r,kA.repeat=s,kA.isNegativeZero=i,kA.extend=n,kA}var Sae,f9e;function lP(){if(f9e)return Sae;f9e=1;function t(r,n){let s="",i=r.reason||"(unknown reason)";return r.mark?(r.mark.name&&(s+='in "'+r.mark.name+'" '),s+="("+(r.mark.line+1)+":"+(r.mark.column+1)+")",!n&&r.mark.snippet&&(s+=`
178
+ **\u30A8\u30E9\u30FC:** \`${t}\``,sutFixPrefix:"**\u4FEE\u6B63\u65B9\u6CD5:** ",sutServiceNotReachable:t=>`**\u30B5\u30FC\u30D3\u30B9\u306B\u5230\u9054\u3067\u304D\u307E\u305B\u3093:** ${t} \u306E\u30B5\u30FC\u30D3\u30B9\u304C\u30D8\u30EB\u30B9\u30C1\u30A7\u30C3\u30AF\u306E\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u307E\u3067\u306B\u5FDC\u7B54\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B5\u30FC\u30D3\u30B9\u304C\u307E\u3060\u8D77\u52D5\u4E2D\u3067\u3042\u308B\u304B\u3001\u8D77\u52D5\u30B3\u30DE\u30F3\u30C9\u304C\u30B5\u30FC\u30D3\u30B9\u3092\u7ACB\u3061\u4E0A\u3052\u3089\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002`,sutServiceNotReachableFix:"**\u4FEE\u6B63\u65B9\u6CD5:** `targetSetupCommand` \u304C\u3053\u306E\u30B5\u30FC\u30D3\u30B9\u3092\u5B9F\u969B\u306B\u8D77\u52D5\u3057\u3001\u60F3\u5B9A\u3057\u305F\u30DD\u30FC\u30C8\u3067\u5F85\u3061\u53D7\u3051\u3066\u3044\u308B\u304B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30B3\u30DE\u30F3\u30C9\u81EA\u4F53\u306F\u6B63\u3057\u3044\u304C\u30B5\u30FC\u30D3\u30B9\u306E\u8D77\u52D5\u304C\u9045\u3044\u5834\u5408\u306F\u3001`targetReadyCheckTimeout` \u3092\u5897\u3084\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u3088\u308A\u78BA\u5B9F\u306A\u8D77\u52D5\u5224\u5B9A\u3092\u884C\u3046\u306B\u306F\u3001`targetReadyCheckCommand` \u3067\u7279\u5B9A\u306E\u30D8\u30EB\u30B9\u30C1\u30A7\u30C3\u30AF\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3092\u30D7\u30ED\u30FC\u30D6\u3059\u308B\u3088\u3046\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",staged:{requestedByPerson:t=>`${t} \u3055\u3093\u306E\u4F9D\u983C\u3067\u5B9F\u884C`,requestedByPolicy:t=>`\u691C\u8A3C\u30DD\u30EA\u30B7\u30FC ${t} \u306B\u3088\u308A\u5B9F\u884C`,noLiveApp:t=>`> \u26A0\uFE0F **\u3053\u306E\u5B9F\u884C\u3067\u306F\u7A3C\u50CD\u4E2D\u306E\u30A2\u30D7\u30EA\uFF08SUT\uFF09\u304C\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F** \u2014 \u4EE5\u4E0B\u306E ${t} \u4EF6\u306E\u30C6\u30B9\u30C8\u306F**\u5B9F\u884C\u3055\u308C\u3066\u3044\u307E\u305B\u3093**\uFF08\u5B9F\u884C\u5BFE\u8C61\u306E\u30A2\u30D7\u30EA\u304C\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F\uFF09\u3002\u7A3C\u50CD\u4E2D\u306E\u30A2\u30D7\u30EA\u306B\u5BFE\u3057\u3066\u5B9F\u884C\u3057\u3001\u5408\u683C\u3059\u308B\u3053\u3068\uFF08\u304A\u3088\u3073\u518D\u73FE\u30C6\u30B9\u30C8\u304C\u610F\u56F3\u3069\u304A\u308A\u5931\u6557\u3059\u308B\u3053\u3068\uFF09\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,unitTestsInFile:(t,e,r)=>`**${t}**: ${r?`${r} \u306E`:""}\u30E6\u30CB\u30C3\u30C8\u30C6\u30B9\u30C8 ${e} \u4EF6`,addedToExistingFile:"\u65E2\u5B58\u306E\u30C6\u30B9\u30C8\u30D5\u30A1\u30A4\u30EB\u306B\u8FFD\u52A0",testPackagesHeader:"### \u{1F4E6} \u3053\u308C\u3089\u306E\u30C6\u30B9\u30C8\u306E\u5B9F\u884C\u65B9\u6CD5",testPackageLine:(t,e)=>`\`${t}/\` \u306F Skyramp Testbot \u304C\u6240\u6709\u30FB\u4FDD\u5B88\u3059\u308B\u72EC\u7ACB\u3057\u305F\u30C6\u30B9\u30C8\u30D1\u30C3\u30B1\u30FC\u30B8\u3067\u3001\u72EC\u81EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u3001\u30ED\u30C3\u30AF\u30D5\u30A1\u30A4\u30EB\u3001\u30E9\u30F3\u30CA\u30FC\u8A2D\u5B9A\u3092\u6301\u3061\u307E\u3059\u3002\`${e}\` \u3067\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002\u3059\u3079\u3066\u306E\u30D7\u30EB\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u5B9F\u884C\u3059\u308B\u306B\u306F\u3001\u3053\u306E\u30B3\u30DE\u30F3\u30C9\u3092 CI \u306B\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,appManifestsUntouched:"\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u81EA\u8EAB\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u3068\u30ED\u30C3\u30AF\u30D5\u30A1\u30A4\u30EB\u306F\u5909\u66F4\u3057\u3066\u3044\u307E\u305B\u3093\u3002",dependencyChangesHeader:"### \u{1F4E6} \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u4F9D\u5B58\u95A2\u4FC2\u306E\u5909\u66F4",dependencyChangeLine:(t,e,r)=>`\`${e}\`\uFF08\u304A\u3088\u3073\u305D\u306E\u30ED\u30C3\u30AF\u30D5\u30A1\u30A4\u30EB\uFF09\u306B \`${t}\` \u3092\u8FFD\u52A0${r?`: ${r}`:""}`,testMaintenanceHeader:"\u2705 \u30C6\u30B9\u30C8\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9",keptNot:"\u5909\u66F4\u305B\u305A\u7DAD\u6301 \u2014 \u898B\u9001\u3063\u305F\u64CD\u4F5C: ",declinedPlanned:"(\u4E88\u5B9A\u3057\u3066\u3044\u305F\u64CD\u4F5C\u3092\u898B\u9001\u308A: ",declinedMaintenanceHeader:"\u21A9\uFE0F \u898B\u9001\u3063\u305F\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9",existingEvidenceHeader:"\u2705 \u65E2\u5B58\u306E\u30A8\u30D3\u30C7\u30F3\u30B9",trustedCheckPassed:(t,e)=>`\u4FE1\u983C\u6E08\u307F\u306E CI \u30C1\u30A7\u30C3\u30AF ${t} \u304C${e?` ${e} \u3067`:""}\u5408\u683C\u3057\u3001\u6B21\u3092\u78BA\u8A8D\u3057\u307E\u3057\u305F:`,testResultsHeader:"\u{1F9EA} \u30C6\u30B9\u30C8\u7D50\u679C",resultsTableHeader:"| \u30C6\u30B9\u30C8 ID | \u30C6\u30B9\u30C8\u7A2E\u5225 | \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8 | \u30B9\u30C6\u30FC\u30BF\u30B9 | \u8A73\u7D30 |",unitResultsTableHeader:"| \u30C6\u30B9\u30C8 ID | \u30C6\u30B9\u30C8\u7A2E\u5225 | \u30C6\u30B9\u30C8\u5BFE\u8C61\u306E\u30B3\u30FC\u30C9 | \u30C6\u30B9\u30C8 | \u30B1\u30FC\u30B9\u6570 | \u30B9\u30C6\u30FC\u30BF\u30B9 | \u8A73\u7D30 |",casesPassed:(t,e,r)=>`${e} \u4EF6\u4E2D ${t} \u4EF6\u5408\u683C${r?`\u3001${r} \u4EF6\u30B9\u30AD\u30C3\u30D7`:""}`,behaviourCoverageHeader:"\u{1F517} \u632F\u308B\u821E\u3044\u306E\u30AB\u30D0\u30EC\u30C3\u30B8",coverageCaption:(t,e,r,n)=>`\uFF08\u751F\u6210 ${t} \xB7 \u5909\u66F4 ${e} \xB7 \u691C\u8A3C ${r} \xB7 \u5B9F\u884C ${n}\uFF09`,coverageTableHeader:"| \u632F\u308B\u821E\u3044 | \u30BD\u30FC\u30B9 | \u30C6\u30B9\u30C8 | \u30E1\u30F3\u30C6\u30CA\u30F3\u30B9 |",writtenNotRun:"\u4F5C\u6210\u6E08\u307F\u30FB\u672A\u5B9F\u884C",issuesFoundHeader:"\u26A0\uFE0F \u691C\u51FA\u3055\u308C\u305F\u554F\u984C",caveatsHeader:"### \u26A0\uFE0F \u3053\u306E\u5B9F\u884C\u3067\u78BA\u8A8D\u3067\u304D\u306A\u304B\u3063\u305F\u3053\u3068",commentHeader:"### Skyramp Testbot",timedOut:"> \u26A0\uFE0F \u5B9F\u884C\u304C\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F \u2014 \u4EE5\u4E0B\u306E\u7D50\u679C\u306F\u4E00\u90E8\u306E\u307F\u3067\u3059\u3002",stopReasons:{"pr-closed":"\u30D7\u30EB\u30EA\u30AF\u30A8\u30B9\u30C8\u304C\u30DE\u30FC\u30B8\u3055\u308C\u305A\u306B\u30AF\u30ED\u30FC\u30BA\u3055\u308C\u307E\u3057\u305F",cancelled:"\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u304C\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u305F\u304B\u3001\u30E9\u30F3\u30CA\u30FC\u304C\u505C\u6B62\u3057\u307E\u3057\u305F","attempt-cancelled":"Skyramp \u3067\u3053\u306E\u5B9F\u884C\u304C\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F","attempt-closed":"Skyramp \u304C\u3053\u306E\u5B9F\u884C\u3092\u7D42\u4E86\u3057\u307E\u3057\u305F"},maintenanceActions:{update:"\u66F4\u65B0",regenerate:"\u518D\u751F\u6210",delete:"\u524A\u9664",verify:"\u691C\u8A3C",updated:"\u66F4\u65B0",regenerated:"\u518D\u751F\u6210",deleted:"\u524A\u9664",verified:"\u691C\u8A3C"},publishFailures:{push:"\u30D7\u30C3\u30B7\u30E5\u306B\u5931\u6557",auth:"\u8A8D\u8A3C\u30A8\u30E9\u30FC",conflict:"\u7AF6\u5408",unknown:"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"},stoppedEarly:(t,e)=>`> \u26A0\uFE0F \u5B9F\u884C\u304C\u9014\u4E2D\u3067\u505C\u6B62\u3057\u307E\u3057\u305F \u2014 ${t}\u3002\u4EE5\u4E0B\u306E\u7D50\u679C\u306F\u4E00\u90E8\u306E\u307F\u3067\u3059\u3002${e}`,viewInSkyramp:t=>` [Skyramp \u3067\u8868\u793A](${t})`,setupRunEnds:{finished:"\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B9F\u884C\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002Skyramp \u304C\u7D50\u679C\u3092\u78BA\u8A8D\u3057\u3066\u3044\u307E\u3059\u3002",failed:"\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B9F\u884C\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002",timedOut:"\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B9F\u884C\u304C\u6642\u9593\u5207\u308C\u306B\u306A\u308A\u307E\u3057\u305F\u3002",cancelledInSkyramp:"\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B9F\u884C\u306F Skyramp \u3067\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F\u3002",stoppedToResume:"\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B9F\u884C\u3092\u505C\u6B62\u3057\u307E\u3057\u305F\u3002Skyramp \u3067\u518D\u958B\u3067\u304D\u307E\u3059\u3002"},appUnreachable:t=>`Skyramp\uFF08${t}\uFF09\u306B\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u518D\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002`,couldNotStart:t=>`Skyramp Testbot \u3092\u958B\u59CB\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${t}`,assembledAfterFailedChecks:t=>`> \u26A0\uFE0F \u4F5C\u6210\u30B9\u30C6\u30C3\u30D7\u304C\u30C1\u30A7\u30C3\u30AF\u306B\u5408\u683C\u3057\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u3053\u306E\u30EC\u30DD\u30FC\u30C8\u306F\u81EA\u52D5\u3067\u7D44\u307F\u7ACB\u3066\u3089\u308C\u307E\u3057\u305F\u3002${t} \u4EF6\u306E\u30C1\u30A7\u30C3\u30AF\u304C\u672A\u9054\u6210\u3067\u3059 \u2014 \u8A73\u7D30\u306F\u5B9F\u884C\u30ED\u30B0\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,testbotPrLine:(t,e,r)=>`Testbot PR${t?`\uFF08${t}\uFF09`:""}: [${e}](${r})`,viewRun:t=>`_[\u5B9F\u884C\u3092\u8868\u793A](${t})_`,testsPrNotOpened:(t,e)=>`\u30C6\u30B9\u30C8 PR \u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${t}\uFF09\u3002\u30C6\u30B9\u30C8\u306F\u30D6\u30E9\u30F3\u30C1 \`${e}\` \u306B\u30D7\u30C3\u30B7\u30E5\u3055\u308C\u3066\u3044\u307E\u3059\u3002`,testsNotPushed:(t,e)=>`\u30C6\u30B9\u30C8\u3092\u30D7\u30C3\u30B7\u30E5\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${t}\uFF09\u3002\u30C6\u30B9\u30C8\u306F\u30ED\u30FC\u30AB\u30EB\u30D6\u30E9\u30F3\u30C1 \`${e}\` \u306B\u6B8B\u3063\u3066\u3044\u307E\u3059\u3002`,testsPrRetargeted:t=>`\u30C6\u30B9\u30C8\u306E\u751F\u6210\u4E2D\u306B\u958B\u767A PR \u304C\u30DE\u30FC\u30B8\u3055\u308C\u307E\u3057\u305F \u2014 \u30C6\u30B9\u30C8 PR \u306F\u4EE3\u308F\u308A\u306B\u30D9\u30FC\u30B9\u30D6\u30E9\u30F3\u30C1${t?`\uFF08\`${t}\`\uFF09`:""}\u3092\u5BFE\u8C61\u306B\u3057\u3066\u3044\u307E\u3059\u3002`,testsPrUnchanged:"\u3053\u306E\u30D7\u30C3\u30B7\u30E5\u3067\u306F\u65B0\u3057\u3044\u30C6\u30B9\u30C8\u306E\u5909\u66F4\u306F\u4E0D\u8981\u3067\u3057\u305F\u3002\u4EE5\u4E0B\u306E\u30C6\u30B9\u30C8 PR \u306F\u4EE5\u524D\u306E\u5B9F\u884C\u306E\u3082\u306E\u3067\u3001\u305D\u306E\u307E\u307E\u306B\u3057\u3066\u3044\u307E\u3059\u3002",committedNoPr:t=>`\u30C6\u30B9\u30C8\u306F\u30B3\u30DF\u30C3\u30C8\u3055\u308C\u307E\u3057\u305F\u304C\u3001PR \u306F\u4F5C\u6210\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: ${t}\u3002`}};var SI=(r=>(r.En="en",r.Ja="ja",r))(SI||{}),GVe={en:Ko,ja:zVe},Zne="en";function gq(t){let e=t.trim().toLowerCase();if(e==="")return"en";let r=Object.values(SI);return r.includes(e)?e:(X(`Invalid language '${t}'. Supported: ${r.join(", ")}. Falling back to 'en'.`),"en")}function uB(t){Zne=t}function jVe(){return Zne}function mA(t,e){return(Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0)??e}function ne(){return GVe[Zne]}function VVe(){let e=[];for(let r of Object.values(GVe))for(let n of[r.testbotPrBacklink,r.testbotPrDispatchBacklink,r.testbotPrMergedBacklink]){let s=n("\0");if(s.indexOf("\0")<0){X("A Testbot PR backlink template does not interpolate its argument; skipping it for stale-backlink stripping.");continue}e.push({prefix:s.slice(0,s.indexOf("\0")),suffix:s.slice(s.lastIndexOf("\0")+1)})}return e}var OE=(a=>(a.ProviderOutage="provider_outage",a.ProviderRateLimit="provider_rate_limit",a.ProviderUsageLimit="provider_usage_limit",a.ProviderAuthExpired="provider_auth_expired",a.Timeout="timeout",a.NoReport="no_report",a.RenderFailure="render_failure",a))(OE||{});(e=>{function t(r,n){switch(r){case"provider_outage":return{headline:ne().providerOutageHeadline(n.provider.name,n.maxRetries),action:ne().providerOutageActionStatusPage(n.provider.statusUrl)};case"provider_rate_limit":return{headline:ne().providerRateLimitHeadline(n.provider.name),action:ne().providerRateLimitAction};case"provider_usage_limit":return{headline:ne().providerUsageLimitHeadline(n.provider.name),action:ne().providerUsageLimitAction};case"provider_auth_expired":return{headline:ne().providerAuthExpiredHeadline(n.provider.name),action:ne().providerAuthExpiredAction};case"timeout":return{headline:ne().providerTimeoutHeadline(n.timeoutMinutes),action:ne().providerTimeoutAction};case"no_report":case"render_failure":return}}e.buildNotice=t})(OE||={});var Aq=(r=>(r.SameBranch="same-branch",r.SeparateBranch="separate-branch",r))(Aq||{}),Vs="skyramp",qf=class{supportsNdjsonLog=!1;reusesPreinstalledCli=!0;skillsPluginDir(){}setupAgentEnv(e,r){let n=e[this.apiKeyField];n&&ei(this.envVar,n)}};dB();dB();dB();Sc();function mB(t,e){if(process.env.GITHUB_ACTIONS)return new ME(t,vp,e);throw new Error("Unrecognized CI environment. Set GITHUB_ACTIONS=true for GitHub Actions, or use EvalPlatform directly for eval/testing.")}Ke();zKe();var GKe=t=>gae({...t});var Aae=(r=>(r.Sonnet="sonnet",r.Opus="opus",r))(Aae||{}),jKe="opus",VKe={sonnet:"claude-sonnet-5[1m]",opus:"claude-opus-5-5[1m]"},WKe=VKe[jKe],M7t={sonnet:"anthropic.claude-sonnet-5[1m]",opus:"anthropic.claude-opus-5-5[1m]"};function JI(t){return Object.values(Aae).includes(t)}function yae(t){let e=(t??"").trim();if(e==="")return jKe;let r=e.toLowerCase();return JI(r)?r:e}function Q7t(t){let e=(t??"").trim().toLowerCase();return e.startsWith("us-gov-")?"us-gov":e.startsWith("eu-")?"eu":e.startsWith("ap-")?"apac":"us"}function KH(t,e){return`${Q7t(e)}.${M7t[t]}`}function bae(t){return t||process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||""}function YKe(t,e){if(e)return e;let r=yae(t.model);return JI(r)?t.useBedrock?KH(r,bae(t.awsRegion)):VKe[r]:r}async function L7t(t){return GKe({roleArn:t.roleArn,webIdentityToken:t.webIdentityToken,roleSessionName:t.roleSessionName,durationSeconds:t.durationSeconds,clientConfig:{region:t.region}})()}var nP=3600,F7t=43200,U7t=15;function $7t(t){let e=Math.ceil((t+U7t)*60);return Math.min(F7t,Math.max(nP,e))}function q7t(t){return t instanceof Error?t.name==="ValidationError"&&/MaxSessionDuration|DurationSeconds/i.test(t.message):!1}async function XH(t){let e=t.env??process.env,r=e.AWS_ROLE_ARN?.trim(),n=e.AWS_REGION?.trim()||e.AWS_DEFAULT_REGION?.trim();if(e.SKYRAMP_REFRESH_BEDROCK_SESSION!=="1"||e.CLAUDE_CODE_USE_BEDROCK!=="1")return!1;let s=t.identity;if(!r||!s||!n)return t.debug("Bedrock session refresh skipped: needs AWS_ROLE_ARN, AWS_REGION (or AWS_DEFAULT_REGION) and a web identity from the job"),!1;try{let i=await s.token("sts.amazonaws.com");if(!i)throw new Error("OIDC response carried no token value");let o=`testbot-agent-${s.runId??"local"}`.replace(/[^A-Za-z0-9=,.@_-]/g,"").slice(0,64),a=t.assumeRole??L7t,c={roleArn:r,webIdentityToken:i,roleSessionName:o,region:n},l=$7t(t.timeoutMinutes),u,d=nP;try{u=await a({...c,durationSeconds:l}),d=l}catch(p){if(l<=nP||!q7t(p))throw p;t.warning(`The Bedrock role rejected a ${l}s session (its MaxSessionDuration is lower). Minting a ${nP}s session instead, which is shorter than the ${t.timeoutMinutes}m testbotTimeout; raise MaxSessionDuration on ${r} to at least ${l}s or the agent can lose its credentials mid-run.`),u=await a({...c,durationSeconds:nP})}if(!u.accessKeyId||!u.secretAccessKey||!u.sessionToken)throw new Error("assume-role returned an incomplete credential triple");return t.setSecret(u.accessKeyId),t.setSecret(u.secretAccessKey),t.setSecret(u.sessionToken),e.AWS_ACCESS_KEY_ID=u.accessKeyId,e.AWS_SECRET_ACCESS_KEY=u.secretAccessKey,e.AWS_SESSION_TOKEN=u.sessionToken,t.debug(`Minted a fresh Bedrock session for this agent attempt (${d}s)`),t.onMinted?.(u.expiration?.getTime()??Date.now()+d*1e3),!0}catch(i){return t.warning(`Could not refresh the Bedrock session; continuing with existing credentials: ${i instanceof Error?i.message:String(i)}`),!1}}var ZH=(i=>(i.Low="low",i.Medium="medium",i.High="high",i.XHigh="xhigh",i.Max="max",i))(ZH||{}),KI="high",JKe="medium";function KKe(t){return Object.values(ZH).includes(t)}var XKe=5;function H7t(t){let e=t.split(/\r?\n/).map(r=>r.trim()).filter(Boolean);if(e.length>XKe)throw new Error(`relatedRepoPaths supports at most ${XKe} entries (got ${e.length}); the cap limits how much cross-repo context is loaded to avoid overflowing Testbot's context window.`);return e}function z7t(t){let e=t.trim().toLowerCase();return e===""?"separate-branch":Object.values(Aq).includes(e)?e:(X(`Invalid generatedTestsMode '${t}'. Falling back to 'separate-branch'.`),"separate-branch")}function G7t(t){let e=(t??"").trim();if(e!==""){if(/^(?:[1-9]|10)$/.test(e))return Number(e);X(`Ignoring perTestMaxFixAttempts="${t}": expected a whole number from 1 to 10; the Skyramp MCP default applies`)}}function j7t(t){let e=(t??"").trim().toLowerCase();return e===""?KI:KKe(e)?e:(X(`Ignoring effort="${t}": expected one of ${Object.values(ZH).join(", ")}; using "${KI}"`),KI)}function e2(){let t=yae(qe("model"));return JI(t)||X(`model '${t}' is not a tested alias (sonnet, opus); passing it to the agent verbatim as a raw model id.`),{skyrampLicenseFile:qe("skyrampLicenseFile"),cursorApiKey:qe("cursorApiKey"),copilotApiKey:qe("copilotApiKey"),anthropicApiKey:qe("anthropicApiKey"),useBedrock:Cd("useBedrock"),awsRegion:qe("awsRegion"),useLocalAuth:qe("useLocalAuth").toLowerCase()==="true",model:t,effort:j7t(qe("effort")),targetSetupCommand:qe("targetSetupCommand"),authTokenCommand:qe("authTokenCommand"),uiCredentials:qe("uiCredentials"),targetTeardownCommand:qe("targetTeardownCommand"),skipTargetTeardown:Cd("skipTargetTeardown"),skyrampExecutorVersion:qe("skyrampExecutorVersion"),skyrampMcpVersion:qe("skyrampMcpVersion"),skyrampMcpSource:qe("skyrampMcpSource"),skyrampMcpGithubToken:qe("skyrampMcpGithubToken"),skyrampMcpGithubRef:qe("skyrampMcpGithubRef"),nodeVersion:qe("nodeVersion"),skipTargetSetup:Cd("skipTargetSetup"),targetReadyCheckCommand:qe("targetReadyCheckCommand"),targetReadyCheckTimeout:(()=>{let r=parseInt(qe("targetReadyCheckTimeout"),10)||1800;return r<1?(X(`targetReadyCheckTimeout must be at least 1 second, got ${r}. Using 1s.`),1):r})(),targetReadyCheckInterval:(()=>{let r=parseInt(qe("targetReadyCheckInterval"),10),n=isNaN(r)?30:r;return n<1?(X(`targetReadyCheckInterval must be at least 1 second, got ${n}. Using 1s.`),1):n})(),targetReadyCheckDiagnosticsCommand:(()=>{let r=qe("targetReadyCheckDiagnosticsCommand");return r.trim().toLowerCase()==="none"?"":r})(),workingDirectory:qe("workingDirectory"),autoCommit:Cd("autoCommit"),commitMessage:qe("commitMessage"),generatedTestsMode:z7t(qe("generatedTestsMode")),postPrComment:Cd("postPrComment"),testExecutionTimeout:parseInt(qe("testExecutionTimeout"),10)||300,maxRecommendations:(()=>{let r=parseInt(qe("maxRecommendations"),10);return isNaN(r)?void 0:Math.max(0,r)})(),maxGenerate:(()=>{let r=parseInt(qe("maxGenerate"),10);return isNaN(r)?void 0:Math.max(0,r)})(),perTestMaxFixAttempts:G7t(qe("perTestMaxFixAttempts")),testbotMaxRetries:parseInt(qe("testbotMaxRetries"),10)||3,testbotRetryDelay:parseInt(qe("testbotRetryDelay"),10)||10,testbotTimeout:parseInt(qe("testbotTimeout"),10)||60,targetSetupRetries:parseInt(qe("targetSetupRetries"),10)||3,targetSetupRetryDelay:parseInt(qe("targetSetupRetryDelay"),10)||10,authTokenRetries:(()=>{let r=parseInt(qe("authTokenRetries"),10);return Number.isFinite(r)&&r>=1?r:6})(),authTokenRetryDelay:(()=>{let r=parseInt(qe("authTokenRetryDelay"),10);return Number.isFinite(r)&&r>=0?r:10})(),reportCollapsed:Cd("reportCollapsed"),language:gq(qe("language")),enableDebug:Cd("enableDebug"),testRepoPath:qe("testRepoPath")||void 0,relatedRepoPaths:H7t(qe("relatedRepoPaths")),allowedAuthors:qe("allowedAuthors").split(/\r?\n/).map(r=>r.trim()).filter(Boolean)}}function ZKe(t){let e=!!t.cursorApiKey,r=!!t.copilotApiKey,n=!!t.anthropicApiKey;if(t.useBedrock){if(e||r)throw new Error("useBedrock cannot be combined with cursorApiKey or copilotApiKey. Bedrock is a provider for the Claude Code agent.");return n&&X("anthropicApiKey is ignored when useBedrock is true \u2014 Bedrock provides model credentials via AWS."),t.useLocalAuth&&X("useLocalAuth is ignored when useBedrock is true \u2014 Bedrock provides model credentials via AWS."),Ne("Using Claude Code CLI agent (AWS Bedrock)"),"claude"}if(t.useLocalAuth){if(e||r)throw new Error("useLocalAuth cannot be combined with cursorApiKey or copilotApiKey. Local auth is a provider for the Claude Code agent.");return n&&X("anthropicApiKey is ignored when useLocalAuth is true \u2014 the already-logged-in claude CLI session is used instead."),Ne("Using Claude Code CLI agent (local auth)"),"claude"}if([e,r,n].filter(Boolean).length>1)throw new Error("Multiple agent API keys provided. Please provide only one of: cursorApiKey, copilotApiKey, anthropicApiKey.");if(e)return Ne("Using Cursor CLI agent"),"cursor";if(r)return Ne("Using GitHub Copilot CLI agent"),"copilot";if(n)return Ne("Using Claude Code CLI agent"),"claude";throw new Error("No agent API key provided. Please provide one of: cursorApiKey, copilotApiKey, or anthropicApiKey.")}Ke();var r2=q(require("fs")),Eae=q(require("path"));Ke();uN();var t9e=q(require("child_process")),dw=class extends Error{constructor(e){super(e),this.name="ExecTimeoutError"}},XI=class extends Error{constructor(e){super(e),this.name="ExecAbortedError"}};function e9e(t,e){if(!(!t||t.destroyed||t.writableEnded))try{t.write(e)}catch(r){X(`stream write failed: ${r instanceof Error?r.message:String(r)}`)}}async function Be(t,e=[],r={}){let n="",s="",i={cwd:r.cwd,silent:r.silent??!1,ignoreReturnCode:r.ignoreReturnCode??!1,env:r.env?{...process.env,...r.env}:void 0,input:r.input,listeners:{stdout:a=>{n+=a.toString(),e9e(r.stdoutStream,a)},stderr:a=>{s+=a.toString()}}};if(r.timeout||r.signal){let a=r.signal;return a?.aborted?Promise.reject(new XI(`Command aborted before start: ${t}`)):new Promise((c,l)=>{let u=t9e.spawn(t,e,{cwd:r.cwd,env:r.env?{...process.env,...r.env}:process.env,stdio:["pipe","pipe","pipe"],shell:!1});u.stdout?.on("data",h=>{n+=h.toString(),r.silent||process.stdout.write(h),e9e(r.stdoutStream,h)}),u.stderr?.on("data",h=>{s+=h.toString(),r.silent||process.stderr.write(h)}),r.input&&u.stdin?.end(r.input);let d=()=>{f&&clearTimeout(f),a?.removeEventListener("abort",m)},p=h=>{d();try{u.kill("SIGTERM")}catch{}l(h)},m=()=>p(new XI(`Command aborted: ${t}`)),f=r.timeout?setTimeout(()=>p(new dw(`Command timed out after ${Math.round(r.timeout/6e4)}m: ${t}`)),r.timeout):void 0;a?.addEventListener("abort",m,{once:!0}),u.on("close",h=>{d();let A=h??1;A!==0&&!r.ignoreReturnCode?l(new Error(`The process '${t}' failed with exit code ${A}`)):c({exitCode:A,stdout:n,stderr:s})}),u.on("error",h=>{d(),l(h)})})}return{exitCode:await SS(t,e,i),stdout:n,stderr:s}}function iP(t){return(e,r)=>{let n=t?{...r,cwd:t}:r;return n?Be("git",e,n):Be("git",e)}}function NA(t){return new Promise(e=>setTimeout(e,t*1e3))}async function li(t,e){for(let r=1;r<=e.retries;r++)try{return await t()}catch(n){if(r<e.retries)X(`${e.label} failed, retrying (${r}/${e.retries})...`),await NA(e.delay);else throw n}throw new Error("unreachable")}async function Xn(t,e){wi(t);try{return await e()}finally{ss()}}async function r9e(t){let e=process.getuid?.(),r=process.getgid?.();if(!(e===void 0||r===void 0))try{let{exitCode:n,stderr:s}=await Be("sudo",["-n","chown","-R","-h",`${e}:${r}`,"."],{cwd:t,silent:!0,ignoreReturnCode:!0});n!==0&&Rt(`worktree chown skipped (exit ${n}): ${s.trim()}`)}catch(n){Rt(`worktree chown skipped: ${n instanceof Error?n.message:String(n)}`)}}var n9e=!1;function s9e(t){n9e=t}function Rt(t){n9e&&ee(`[debug] ${t}`)}var V7t=1e3;function Qa(t){return t*V7t}function Dl(t){let e=t.split("/");return e.length===2&&e[0]&&e[1]?{owner:e[0],repo:e[1]}:null}var sP=/^[A-Za-z_][A-Za-z0-9_.-]*$/;function i9e(t){if(t.startsWith("{"))try{let o=JSON.parse(t);return{username:typeof o.username=="string"?o.username:void 0,password:typeof o.password=="string"?o.password:void 0,role:typeof o.role=="string"?o.role:void 0}}catch{return{}}let e=t.indexOf(":"),n=!(e>=0&&!/[=;]/.test(t.slice(0,e)))&&/(^|;)\s*role\s*=/.test(t);if(/(^|;)\s*(username|password)\s*=/.test(t)||n){let o=new Map;for(let a of t.split(";")){let c=a.indexOf("=");c>0&&sP.test(a.slice(0,c).trim())&&o.set(a.slice(0,c).trim(),a.slice(c+1).trim())}return{username:o.get("username"),password:o.get("password"),role:o.get("role")}}if(t==="")return{};if(!t.includes(":"))for(let o of t.split(";")){let a=o.indexOf("=");if(a>0&&sP.test(o.slice(0,a).trim()))return{}}let[s,...i]=t.split(":");return{username:s,password:i.join(":")}}function o9e(t){let e=t.split(/\r?\n/).map(s=>s.trim()).find(s=>s!=="")??"",{username:r,password:n}=i9e(e);return{username:r,password:n}}function W7t(t){return t.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Y7t(t){let e=t.split(/\r?\n/).map(n=>n.trim()).filter(n=>n!==""),r=new Set;return e.map((n,s)=>{let{username:i,password:o,role:a}=i9e(n),c=s+1,l=a?W7t(a):"";for(l||(l=String(c));r.has(l);)l=`${l}_${c}`;return r.add(l),{key:l,username:i,password:o}})}function a9e(t){let e=Y7t(t);if(e.length<2)return[];let r=[];for(let{key:n,username:s,password:i}of e)s!==void 0&&r.push({envName:`SKYRAMP_UI_USERNAME_${n}`,value:s}),i!==void 0&&r.push({envName:`SKYRAMP_UI_PASSWORD_${n}`,value:i});return r}var t2=class extends qf{label="Cursor";provider={name:"Cursor",statusUrl:"https://status.cursor.com/"};binary="agent";envVar="CURSOR_API_KEY";apiKeyField="cursorApiKey";supportsNdjsonLog=!0;async install(){await Be("bash",["-c","set -o pipefail; curl https://cursor.com/install -fsS | bash"]),ARe(`${process.env.HOME}/.local/bin`),await Be("agent",["--version"],{silent:!0})}async initialize(){let{exitCode:e}=await Be("agent",["mcp","enable",Vs],{ignoreReturnCode:!0});if(e!==0)throw new Error(`Failed to enable MCP server '${Vs}' (exit code ${e})`);try{let{stdout:r}=await Be("agent",["mcp","list"]);r.includes(Vs)?Ne(`Cursor MCP server verified: ${Vs} is listed`):X(`${Vs} not found in MCP server list`)}catch{X("Could not list MCP servers")}}async configureMcp(e,r,n,s){let i=Eae.join(process.env.HOME??"~",".cursor");r2.mkdirSync(i,{recursive:!0});let o={mcpServers:{[Vs]:{command:e,args:r,env:n,timeout:Qa(s)}}};r2.writeFileSync(Eae.join(i,"mcp.json"),JSON.stringify(o,null,2))}buildCommand(e){return{command:"agent",args:["-f","-p","--model","claude-4.6-sonnet-medium","--output-format","stream-json"]}}};Ke();var ZI=q(require("fs")),oP=q(require("path"));var n2=class extends qf{label="GitHub Copilot";provider={name:"GitHub Copilot",statusUrl:"https://www.githubstatus.com/"};binary="copilot";envVar="GH_TOKEN";apiKeyField="copilotApiKey";async install(){await Be("npm",["install","-g","@github/copilot"])}async initialize(){try{await Be("copilot",["--version"]),Ne("GitHub Copilot CLI initialized successfully")}catch{X("Could not verify Copilot CLI version")}}async configureMcp(e,r,n,s){let i=oP.join(process.env.HOME??"~",".copilot");ZI.mkdirSync(i,{recursive:!0});let o={mcpServers:{[Vs]:{type:"local",command:e,args:r,tools:["*"],env:n,timeout:Qa(s)}}},a=JSON.stringify(o,null,2);ZI.writeFileSync(oP.join(i,"mcp-config.json"),a);let c=oP.join(process.cwd(),".copilot");ZI.mkdirSync(c,{recursive:!0}),ZI.writeFileSync(oP.join(c,"mcp-config.json"),a)}buildCommand(e){return{command:"copilot",args:["--additional-mcp-config",`@${process.env.HOME}/.copilot/mcp-config.json`,"--allow-all-tools","--allow-all-paths","-p"]}}};Ke();var aP=q(require("fs")),p9e=q(require("os")),c2=q(require("path"));var c9e=require("node:module"),l9e=q(require("node:path")),J7t="SKYRAMP_MCP_INSTALL_PATH";function s2(t){let e=process.env[J7t];if(e)try{return(0,c9e.createRequire)(l9e.join(e,"package.json"))(`@skyramp/mcp/${t}`)}catch{return}}var u9e=q(require("fs")),i2=q(require("path")),K7t="SKYRAMP_FEATURE_SKILLS",o2="SKYRAMP_SKILLS_LOADED";function a2(t={}){if(!t.ignoreFeatureFlag&&process.env[K7t]!=="1")return;let e=process.env.SKYRAMP_MCP_INSTALL_PATH;return e?[i2.join(e,"node_modules","@skyramp","mcp","plugin"),i2.join(e,"plugin")].find(n=>u9e.existsSync(i2.join(n,".claude-plugin","plugin.json"))):void 0}var wae="CLAUDE_CODE_EFFORT_LEVEL";function d9e(){return c2.join(process.env.RUNNER_TEMP??p9e.tmpdir(),"claude-code")}var X7t=["TodoWrite","TodoRead","Write","CronCreate","CronDelete","CronList","AskUserQuestion","NotebookEdit"];function Z7t(){return s2("personas")}var eer=Z7t;function ter(){try{let e=eer().SKYRAMP_QA_PERSONA;if(typeof e=="string"&&e.length>0)return Rt("Loaded SKYRAMP_QA_PERSONA from @skyramp/mcp"),e}catch{Rt("Could not load SKYRAMP_QA_PERSONA from @skyramp/mcp, running without persona")}return""}var TA=class extends qf{label="Claude Code";provider={name:"Claude API",statusUrl:"https://status.claude.com/"};reusesPreinstalledCli=!1;get binary(){return c2.join(d9e(),"node_modules",".bin","claude")}envVar="ANTHROPIC_API_KEY";apiKeyField="anthropicApiKey";supportsNdjsonLog=!0;model;effort;cliVersion;cleanupRegistered=!1;constructor(e=WKe,r=KI,n="latest"){super(),this.model=e,this.effort=r,this.cliVersion=n}async install(){let e=d9e();aP.rmSync(e,{recursive:!0,force:!0}),this.cleanupRegistered||(this.cleanupRegistered=!0,process.on("exit",()=>aP.rmSync(e,{recursive:!0,force:!0}))),await Be("npm",["install","--prefix",e,`@anthropic-ai/claude-code@${this.cliVersion}`]);let r=c2.join(e,"node_modules","@anthropic-ai","claude-code","install.cjs");aP.existsSync(r)&&await Be("node",[r]);let{stdout:n}=await Be(this.binary,["--version"],{silent:!0});Ne(`Claude Code CLI ${n.trim()} installed at ${this.binary}`)}async initialize(){try{await Be(this.binary,["--version"]),Ne("Claude Code CLI initialized successfully")}catch{X("Could not verify Claude Code CLI version")}await this.verifyMcpConnectivity()}async verifyMcpConnectivity(){try{let{stdout:e}=await Be(this.binary,["mcp","list"]);e.split(`
179
+ `).some(n=>n.includes(Vs)&&n.toLowerCase().includes("connected"))?Ne(`Claude MCP server verified: ${Vs} is connected`):/no mcp servers configured/i.test(e)?ee(`${Vs} is not registered with the Claude Code CLI; a staged run attaches it to each session and warns if it does not connect`):X(`${Vs} does not appear connected in MCP server list`)}catch{X("Could not verify MCP server connectivity")}}async configureMcp(e,r,n,s){await Be(this.binary,["mcp","remove","--scope","user",Vs],{ignoreReturnCode:!0});let i=["mcp","add","--scope","user",Vs];for(let[o,a]of Object.entries(n))i.push("-e",`${o}=${a}`);i.push("--",e,...r),await Be(this.binary,i)}skillsPluginDir(){return a2()}buildCommand(e,r=[]){let n=ter(),s=["--dangerously-skip-permissions","--model",this.model],i=this.skillsPluginDir();i&&s.push("--plugin-dir",i),n&&s.push("--append-system-prompt",n),s.push("--settings",JSON.stringify({outputStyle:"Concise"})),s.push(...r),s.push("-p","--output-format","stream-json","--verbose");let o=process.env.SKYRAMP_THINKING_DISPLAY;return o&&s.push("--thinking-display",o),s.push("--disallowedTools",...X7t,"--"),{command:this.binary,args:s}}pinEffortEnv(){let e=process.env[wae];e&&e!==this.effort&&X(`${wae}=${e} from the environment is overridden by the effort input ("${this.effort}").`),process.env[wae]=this.effort,ee(`Agent effort level: ${this.effort}`)}setupAgentEnv(e,r){!e.useBedrock&&!e.anthropicApiKey||(process.env.MCP_TIMEOUT=String(Qa(r.testExecutionTimeout)),process.env.ENABLE_TOOL_SEARCH="false",this.pinEffortEnv(),e.useBedrock?(process.env.CLAUDE_CODE_USE_BEDROCK="1",e.awsRegion&&(process.env.AWS_REGION=e.awsRegion),delete process.env.ANTHROPIC_API_KEY,process.env.AWS_ACCESS_KEY_ID||process.env.AWS_BEARER_TOKEN_BEDROCK||process.env.AWS_PROFILE||process.env.AWS_WEB_IDENTITY_TOKEN_FILE||X("useBedrock is set but no AWS credentials were detected in the environment. Add an aws-actions/configure-aws-credentials step (OIDC) before Testbot.")):e.anthropicApiKey&&(process.env.ANTHROPIC_API_KEY=e.anthropicApiKey,delete process.env.CLAUDE_CODE_USE_BEDROCK))}};var l2=class extends TA{provider={name:"Amazon Bedrock",statusUrl:"https://health.aws.amazon.com/health/status"}};Ke();var Jf=q(require("fs")),xae=q(require("path"));Sc();var u2=class extends TA{mcpConfigPath;setupAgentEnv(e,r){process.env.MCP_TIMEOUT=String(Qa(r.testExecutionTimeout)),process.env.ENABLE_TOOL_SEARCH="false",this.pinEffortEnv(),delete process.env.ANTHROPIC_API_KEY,delete process.env.CLAUDE_CODE_USE_BEDROCK,process.env.CLAUDE_CODE_DISABLE_CLAUDE_MDS="1"}async configureMcp(e,r,n,s){let i=xae.join(Bl(),"local-auth");Jf.mkdirSync(i,{recursive:!0,mode:448}),Jf.chmodSync(i,448);let o=xae.join(i,`mcp-config-${process.pid}.json`);Jf.writeFileSync(o,JSON.stringify({mcpServers:{[Vs]:{command:e,args:r,env:n}}}),{mode:384}),Jf.chmodSync(o,384),this.mcpConfigPath=o,process.on("exit",()=>{try{Jf.unlinkSync(o)}catch{}})}async verifyMcpConnectivity(){Ne("Skipping MCP connectivity check for local auth \u2014 nothing is registered via `claude mcp add` to list.")}buildCommand(e){let r=["--setting-sources","project","--no-session-persistence"];return this.mcpConfigPath&&r.push("--mcp-config",this.mcpConfigPath,"--strict-mcp-config"),super.buildCommand(e,r)}};function d2(t,e){switch(t){case"cursor":return new t2;case"copilot":return new n2;case"claude":return e?.useBedrock?new l2(e.model,e.effort,e.claudeCodeVersion):e?.useLocalAuth?new u2(e.model,e.effort,e.claudeCodeVersion):new TA(e?.model,e?.effort,e?.claudeCodeVersion);default:{let r=t;throw new Error(`Unsupported agent type: ${r}`)}}}Ke();var tZe=q(require("path"));var ev=require("fs"),Kf=q(require("path"),1),iXe=require("child_process"),oXe=require("util");function rer(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xo={},p2={},kA={},m9e;function cP(){if(m9e)return kA;m9e=1;function t(o){return typeof o>"u"||o===null}function e(o){return typeof o=="object"&&o!==null}function r(o){return Array.isArray(o)?o:t(o)?[]:[o]}function n(o,a){if(a){let c=Object.keys(a);for(let l=0,u=c.length;l<u;l+=1){let d=c[l];o[d]=a[d]}}return o}function s(o,a){let c="";for(let l=0;l<a;l+=1)c+=o;return c}function i(o){return o===0&&Number.NEGATIVE_INFINITY===1/o}return kA.isNothing=t,kA.isObject=e,kA.toArray=r,kA.repeat=s,kA.isNegativeZero=i,kA.extend=n,kA}var Sae,f9e;function lP(){if(f9e)return Sae;f9e=1;function t(r,n){let s="",i=r.reason||"(unknown reason)";return r.mark?(r.mark.name&&(s+='in "'+r.mark.name+'" '),s+="("+(r.mark.line+1)+":"+(r.mark.column+1)+")",!n&&r.mark.snippet&&(s+=`
180
180
 
181
181
  `+r.mark.snippet),i+" "+s):i}function e(r,n){Error.call(this),this.name="YAMLException",this.reason=r,this.mark=n,this.message=t(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(n){return this.name+": "+t(this,n)},Sae=e,Sae}var Cae,h9e;function ner(){if(h9e)return Cae;h9e=1;let t=cP();function e(s,i,o,a,c){let l="",u="",d=Math.floor(c/2)-1;return a-i>d&&(l=" ... ",i=a-d+l.length),o-a>d&&(u=" ...",o=a+d-u.length),{str:l+s.slice(i,o).replace(/\t/g,"\u2192")+u,pos:a-i+l.length}}function r(s,i){return t.repeat(" ",i-s.length)+s}function n(s,i){if(i=Object.create(i||null),!s.buffer)return null;i.maxLength||(i.maxLength=79),typeof i.indent!="number"&&(i.indent=1),typeof i.linesBefore!="number"&&(i.linesBefore=3),typeof i.linesAfter!="number"&&(i.linesAfter=2);let o=/\r?\n|\r|\0/g,a=[0],c=[],l,u=-1;for(;l=o.exec(s.buffer);)c.push(l.index),a.push(l.index+l[0].length),s.position<=l.index&&u<0&&(u=a.length-2);u<0&&(u=a.length-1);let d="",p=Math.min(s.line+i.linesAfter,c.length).toString().length,m=i.maxLength-(i.indent+p+3);for(let h=1;h<=i.linesBefore&&!(u-h<0);h++){let A=e(s.buffer,a[u-h],c[u-h],s.position-(a[u]-a[u-h]),m);d=t.repeat(" ",i.indent)+r((s.line-h+1).toString(),p)+" | "+A.str+`
182
182
  `+d}let f=e(s.buffer,a[u],c[u],s.position,m);d+=t.repeat(" ",i.indent)+r((s.line+1).toString(),p)+" | "+f.str+`
@@ -314,7 +314,7 @@ Other caches with similar key:`);for(let a of i?.artifactCaches||[])oe(`Cache Ke
314
314
  .catch(e => { console.error(e.message); process.exit(1); });
315
315
  `],{silent:!0,env:{NODE_PATH:process.env.NODE_PATH||"",LICENSE_FILE:r,CI:"true"}})}function m_(t=__dirname){try{let e=Rv.readFileSync(qrt.join(t,"VERSION.json"),"utf-8"),r=JSON.parse(e);if(typeof r.version=="string"&&typeof r.commit=="string")return{version:r.version,commit:r.commit}}catch{}return{version:"unknown",commit:"unknown"}}async function zrt(t){if(!Rv.existsSync(t))return{usage:null,model:null,skills:[]};let e=Hrt.createInterface({input:Rv.createReadStream(t),crlfDelay:1/0}),r=null,n=null,s=[];for await(let i of e)if(i.trim())try{let o=JSON.parse(i);if(o.type==="assistant"){let a=o.message?.model;!n&&typeof a=="string"&&(n=a);let c=o.message?.content;if(Array.isArray(c))for(let l of c){if(l?.type!=="tool_use"||l.name!=="Skill")continue;let u=l.input?.skill;typeof u=="string"&&u.length>0&&s.push(u)}}if(o.type==="result"){let a=o.usage??{};r={inputTokens:a.input_tokens??0,outputTokens:a.output_tokens??0,cacheCreationInputTokens:a.cache_creation_input_tokens??0,cacheReadInputTokens:a.cache_read_input_tokens??0,totalCostUsd:o.total_cost_usd??0,numTurns:o.num_turns??0,durationMs:o.duration_ms??0,durationApiMs:o.duration_api_ms??0}}}catch{continue}return{usage:r,model:n,skills:s}}async function Grt(t,e,r){for(let n of t){let s={skill:n,agentType:e,...sme()};Rt(`Pushing skill invocation telemetry: ${JSON.stringify(s)}`),await ime("testbot_skill_invoked",s,r)}}async function jrt(t,e,r){let n={inputTokens:String(t.inputTokens),outputTokens:String(t.outputTokens),cacheCreationInputTokens:String(t.cacheCreationInputTokens),cacheReadInputTokens:String(t.cacheReadInputTokens),totalCostUsd:String(t.totalCostUsd),numTurns:String(t.numTurns),durationMs:String(t.durationMs),durationApiMs:String(t.durationApiMs),model:e,...sme()},s=process.env.GITHUB_REF?.match(/^refs\/pull\/(\d+)\//);s&&(n.prNumber=s[1]);let{totalCostUsd:i,...o}=n;Rt(`Pushing agent usage telemetry: ${JSON.stringify(o)}`),await ime("testbot_agent_usage",n,r)}async function Vrt(t,e){let{version:r,commit:n}=m_(),s={testbotVersion:r,testbotCommit:n,actionVersion:process.env.TESTBOT_ACTION_VERSION||"unknown",actionCommit:process.env.TESTBOT_ACTION_COMMIT||"unknown",agentType:t,...sme()};Rt(`Pushing testbot run info telemetry: ${JSON.stringify(s)}`),await ime("testbot_run_info",s,e)}Ke();var es=q(require("fs")),T_=q(require("path"));Ke();var C_=require("node:crypto");var Bw=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(Bw||{}),jA=t=>t.source==="other"?{source:t.source,key:t.key}:{source:t.source,site:t.site,key:t.key},_c=t=>`${t.source}:${t.site??""}:${t.key}`;var f_=/^pasted-[0-9a-f]{16}$/,Pw=/^file-[0-9a-f]{16}$/,Tv=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(Tv||{}),Ua=t=>t.trim().toUpperCase(),Nv=(t,e)=>{let r=t.trim();return f_.test(r.toLowerCase())?"Pasted text":Pw.test(r.toLowerCase())?e?.get(Ua(r))??"Uploaded document":/^\d+$/.test(r)?`Confluence page ${r}`:r.toUpperCase()},nm=(t,e,r)=>e?`${Nv(t,r)} AC${e}`:Nv(t,r),h_=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r))(h_||{}),g_=(p=>(p.RelatedChangeConflict="related_change_conflict",p.ReferenceOutsideTarget="reference_outside_target",p.SourceAccessLost="source_access_lost",p.ConfigurationIncomplete="configuration_incomplete",p.CredentialUnavailable="credential_unavailable",p.WorkflowBindingUnverified="workflow_binding_unverified",p.WorkflowRefUnprotected="workflow_ref_unprotected",p.BedrockWorkflowRequired="bedrock_workflow_required",p.DeploymentReview="deployment_review",p.SutRevisionMismatch="sut_revision_mismatch",p.IsolationUnavailable="isolation_unavailable",p.EvidenceInsufficient="evidence_insufficient",p))(g_||{}),VA=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(VA||{}),A_=(n=>(n.Application="application",n.Environment="environment",n.TestDefect="test_defect",n))(A_||{}),cG=(a=>(a.AuthToken="auth_token",a.Secret="secret",a.DataConnection="data_connection",a.AppNotStarted="app_not_started",a.Login="login",a.ExternalDependency="external_dependency",a.RecordingReplay="recording_replay",a))(cG||{});var lG=(n=>(n.Seed="seed",n.RuntimeMock="runtime_mock",n.EnvOverride="env_override",n))(lG||{}),uG=(n=>(n.TestCode="test_code",n.SkyrampMocker="skyramp_mocker",n.RecipeOverride="recipe_override",n))(uG||{});var kv=(r=>(r.Ready="ready",r.Blocked="blocked",r))(kv||{}),gs=b.string().trim().min(1),Iar=b.object({action:b.enum(["start","run","wait"]),text:gs,source:b.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:gs.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(t=>t.source==="file"==(t.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),Rar=/^[A-Za-z_][A-Za-z0-9_]*$/,WA=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,dG=(i=>(i.VersionEndpoint="version_endpoint",i.DeployWorkflow="deploy_workflow",i.KubernetesLabels="kubernetes_labels",i.Command="command",i.Api="api",i))(dG||{}),An="shared",Nar=gs.refine(t=>{try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},"an http(s) URL with no login in it"),Bv=b.object({address:Nar,readyWhen:gs.nullable(),credentials:b.array(b.string().regex(WA)).max(50),revisionSources:b.array(b.object({method:b.nativeEnum(dG),detail:gs.describe("what Testbot reads, such as GET /version or the deploy workflow's name"),components:b.array(gs).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),ome={steps:b.array(Iar).max(20).optional().describe("how it starts, in order"),kind:b.enum(["web_app","service","database","external_service"]).optional(),from:b.object({file:gs,service:gs.nullable()}).strict().optional(),credentials:b.array(b.string().max(100).regex(Rar)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},Tar=b.object({name:gs,repository:gs.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:b.boolean(),...ome,deployed:gs.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),kar=b.object({component:gs,problem:gs,evidence:gs.describe("the exact command and output that shows it"),fix:gs.describe("what the user must provide, and where")}),Bar=b.object({framework:gs,file:gs.describe("the test file run, relative to its repository root"),result:b.enum(["pass","fail","error"])}),Par=b.object({input:gs.describe("the part of the user's SUT input, as given"),reason:gs}),y_=b.object({schemaVersion:b.literal(1),status:b.nativeEnum(kv).describe("ready only if every component came up healthy and the recipe is written"),components:b.array(Tar),suites:b.array(Bar).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:b.array(gs).default([]).describe("the parts of the user's SUT input the recipe used"),inputsUsedHow:b.array(b.object({input:gs.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:gs.describe("what the recipe did with it")})).optional(),inputsNotUsed:b.array(Par).default([]).describe("the parts it did not use, and why"),blockers:b.array(kar).describe("required (non-empty) when status is blocked"),environment:Bv.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});function ame(t){let e=_ar(t);if(e.length>0)return e;if(t.status==="blocked"&&!(Array.isArray(t.blockers)&&t.blockers.length>0))return['status "blocked" requires at least one blocker { component, problem, evidence, fix } \u2014 say what stopped the bring-up'];if(t.status==="ready"){let r=Array.isArray(t.components)?t.components:[];if(r.length===0)return['status "ready" requires at least one component \u2014 name each component the recipe brought up healthy'];let n=r.filter(s=>s?.healthy!==!0).map(s=>String(s?.name??"?"));if(n.length>0)return[`status "ready" requires every component healthy; not healthy: ${n.join(", ")} \u2014 answer "blocked" with a blocker for each, or bring them up and answer "ready" again`]}return[]}function _ar(t){let e=Array.isArray(t.components)?t.components:[],r=t.environment;if(!r){let a=e.filter(c=>c?.deployed!==void 0||c?.repository===An).map(c=>String(c?.name??"?"));return a.length>0?[`"deployed" and a "${An}" repository belong only to an answer with "environment"; remove them from: ${a.join(", ")}`]:[]}let n=[],s=e.filter(a=>a?.deployed===void 0).map(a=>String(a?.name??"?"));s.length>0&&n.push(`with "environment", every component says what it runs in "deployed" (null when you could not tell); missing for: ${s.join(", ")}`);let i=new Set(e.map(a=>a?.name)),o=(r.revisionSources??[]).flatMap(a=>a?.components??[]).filter(a=>!i.has(a));return o.length>0&&n.push(`each revision source names components of this answer; not one of them: ${o.map(String).join(", ")}`),n}var _w=64*1024,Dw=512*1024,pG=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var Wrt=q(require("path"));var sm=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(sm||{}),YA=b.string().trim().min(1),Dar=b.object({url:b.string().optional().describe("the URL probed, if the check is an HTTP request"),command:b.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:b.record(b.string()).optional(),status:b.union([b.number(),b.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:YA.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),b_=b.object({schemaVersion:b.literal(1),baseUrls:b.record(b.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:Dar.optional(),teardown:YA.describe("command that tears the SUT down"),dependencies:b.record(b.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:b.nativeEnum(sm).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:b.array(b.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:b.object({command:YA,output:YA}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:b.array(b.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:b.boolean(),startedAt:YA.describe("ISO timestamp"),revisions:b.array(b.object({component:YA.describe("a shared component listed above"),url:YA.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:YA.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).optional().describe("only when shared components are listed above: one check per component whose deployed commit you found")});function cme(t){let e=[],r=s=>!!s&&typeof s=="object"&&!Array.isArray(s);return t.outcome!=="change-broke-bringup"&&t.outcome!=="bringup-failed"?(!r(t.baseUrls)||Object.keys(t.baseUrls).length===0?e.push("baseUrls must be a non-empty object of service \u2192 url"):Object.values(t.baseUrls).every(s=>typeof s=="string"&&s.trim())||e.push("every baseUrls value must be a non-empty url string"),r(t.health)?!(typeof t.health.url=="string"&&t.health.url.trim())&&!(typeof t.health.command=="string"&&t.health.command.trim())&&e.push("health must record a url or a command (what you actually ran)"):e.push("health must be an object"),(!r(t.dependencies)||Object.keys(t.dependencies).length===0)&&e.push("dependencies must be a non-empty object of name \u2192 boolean (real vs mocked) when the SUT came up \u2014 account for every backing service so a mocked one can't be hidden behind a green run")):(r(t.bringupError)||e.push(`outcome "${String(t.outcome)}" requires bringupError { command, output } \u2014 the exact failing bring-up command and what it printed`),t.outcome==="change-broke-bringup"&&!(Array.isArray(t.suspectFiles)&&t.suspectFiles.length>0&&t.suspectFiles.every(s=>typeof s=="string"&&s.trim()))&&e.push("change-broke-bringup requires non-empty suspectFiles[] \u2014 the changed file(s) the failure points at; if you cannot point at a file this PR changed, the outcome is bringup-failed (environment/harness), not the PR's fault")),t.outcome==="recipe-drift"&&!(Array.isArray(t.recipeFixes)&&t.recipeFixes.length>0)&&e.push("recipe-drift outcome requires a non-empty recipeFixes[] describing what was corrected"),e}var Io=b.string().trim().min(1),lme=(r=>(r.TestbotManaged="testbot_managed",r.CustomerDeployed="customer_deployed",r))(lme||{}),Pv=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],mG=b.object({schemaVersion:b.literal(1),type:b.nativeEnum(lme).optional(),status:b.enum(["ready","blocked"]),environment:Bv.optional(),components:b.array(b.object({name:Io,repository:Io.describe(`owner/repo, or "${An}" for a customer-deployed component no repository builds`),healthy:b.boolean(),url:b.string().min(1).nullable(),...ome,credentials:b.array(b.string().regex(WA)).max(50).optional(),deployed:Io.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:b.array(b.object({framework:Io,file:Io,result:b.enum(["pass","fail","error"])}).strict()),inputsUsed:b.array(Io),inputsUsedHow:b.array(b.object({input:Io,how:Io}).strict()).optional(),inputsNotUsed:b.array(b.object({input:Io,reason:Io}).strict()),blockers:b.array(b.object({component:Io,problem:Io,evidence:Io,fix:Io}).strict()),replay:b.object({outcome:Io,durationSeconds:b.number().nonnegative().nullable()}).strict().nullable(),files:b.array(b.object({path:Io,content:b.string()}).strict())}).strict().superRefine((t,e)=>{t.inputsUsedHow?.forEach((s,i)=>{t.inputsUsed.includes(s.input)||e.addIssue({code:b.ZodIssueCode.custom,path:["inputsUsedHow",i,"input"],message:"not one of inputsUsed"})}),t.components.forEach((s,i)=>{s.credentials&&new Set(s.credentials).size!==s.credentials.length&&e.addIssue({code:b.ZodIssueCode.custom,path:["components",i,"credentials"],message:"names a credential twice"})});let r=t.type==="customer_deployed";r!==(t.environment!==void 0)&&e.addIssue({code:b.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),t.environment&&new Set(t.environment.credentials).size!==t.environment.credentials.length&&e.addIssue({code:b.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let n=new Set(t.components.map(s=>s.name));if(t.environment?.revisionSources.forEach((s,i)=>{s.components.forEach((o,a)=>{n.has(o)||e.addIssue({code:b.ZodIssueCode.custom,path:["environment","revisionSources",i,"components",a],message:"not one of components"})})}),t.components.forEach((s,i)=>{s.deployed!==void 0!==r&&e.addIssue({code:b.ZodIssueCode.custom,path:["components",i,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),s.repository===An&&!r&&e.addIssue({code:b.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${An}`})}),r&&(t.components.forEach((s,i)=>{t.components.findIndex(o=>o.name===s.name)!==i&&e.addIssue({code:b.ZodIssueCode.custom,path:["components",i,"name"],message:"names a component twice"})}),t.replay!==null&&e.addIssue({code:b.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),t.files.forEach((s,i)=>{Pv.includes(s.path)&&e.addIssue({code:b.ZodIssueCode.custom,path:["files",i,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),r&&t.status==="ready"){let s=new Set(t.environment?.revisionSources.flatMap(i=>i.components));t.components.forEach((i,o)=>{i.repository!==An&&!s.has(i.name)&&e.addIssue({code:b.ZodIssueCode.custom,path:["components",o,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var Oar=["clean","recipe-drift"];function JA(t){let e=Wrt.posix.normalize(t);return e===t&&(e===".skyramp/workspace.yml"||e.startsWith(".skyramp/sut/")&&e.length>13)}function Mar(t,e){let r=e.bringupError;if(t.environment)return{component:t.components.map(s=>s.name).join(", ")||"SUT",problem:`onboard reached the deployment, but deploy's fresh check of it ended ${e.outcome}`,evidence:r?`$ ${r.command}
316
316
  ${r.output}`:`deploy reported ${e.outcome} without the failing command`,fix:"make .skyramp/sut/health.json's check pass from a fresh session (its address, sign-in and ready route), then set it up again"};let n=e.suspectFiles?.length?` \u2014 it points at ${e.suspectFiles.join(", ")}`:"";return{component:t.components.map(s=>s.name).join(", ")||"SUT",problem:`the recipe worked once but not from nothing: deploy's fresh replay of .skyramp/sut/setup.sh ended ${e.outcome}`,evidence:r?`$ ${r.command}
317
- ${r.output}`:`deploy reported ${e.outcome} without the failing command`,fix:e.outcome==="change-broke-bringup"?`fix the change that broke bring-up${n}, then onboard again`:"make .skyramp/sut/setup.sh bring the SUT up from a clean checkout (what onboard's session had that a fresh run lacks), then onboard again"}}function Qar(t){return t.environment?{component:t.components.map(e=>e.name).join(", ")||"SUT",problem:"the deployment was never checked from a fresh session: deploy did not run or wrote no deploy.json",evidence:"outputs/deploy.json is missing from this run",fix:"run deploy after onboard in the same run so it checks the deployment is ready; if deploy ran, its stage log says why it wrote no deploy.json"}:{component:t.components.map(e=>e.name).join(", ")||"SUT",problem:"the recipe was never replayed: deploy did not run or wrote no deploy.json",evidence:"outputs/deploy.json is missing from this run",fix:"run deploy after onboard in the same run so it replays .skyramp/sut/setup.sh from a clean start; if deploy ran, its stage log says why it wrote no deploy.json"}}function Lar(t){return{component:"SUT recipe",problem:"deploy fixed recipe drift, but the recipe it fixed was not collected \u2014 onboard's copy is the recipe from before the fix",evidence:`deploy reported recipe-drift: ${(t.recipeFixes??[]).join("; ")||"no fixes listed"}`,fix:"collect .skyramp/sut/ and .skyramp/workspace.yml after deploy (collectRecipeFiles) and build the plan from that collection"}}var ume=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh",".skyramp/sut/health.json",".skyramp/workspace.yml"],dme=[".skyramp/sut/health.json",".skyramp/workspace.yml"];function Far(t){return`Onboard again so it leaves the whole recipe in the checkout: ${t.map(r=>r===".skyramp/workspace.yml"?"create .skyramp/workspace.yml with skyramp_init_scan and skyramp_init_workspace":`write ${r} as a regular file (a symlink is not uploaded)`).join("; ")}.`}function pme(t,e,r){return e&&r||t}function mme(t,e,r={}){let n=e!==void 0&&!Oar.includes(e.outcome),s=pme(t,e,r.recipeFiles),i=e?.outcome==="recipe-drift"&&!r.recipeFiles,o=(s.recipeFilesOmitted??[]).filter(w=>JA(w.path)),a=o.length?[{component:"SUT recipe",problem:`The recipe could not be uploaded whole: ${o.map(w=>w.path).join(", ")} left out.`,evidence:o.map(w=>`${w.path}: ${w.reason}`).join("; "),fix:"Keep each recipe file text-only and under 64 KiB, and the recipe under 512 KiB in total \u2014 move large generated content out of .skyramp/sut/ and have setup.sh produce it."}]:[],c=t.status==="ready",l=t.environment,u=new Set(s.recipeFiles.map(w=>w.path)),d=c?(l?dme:ume).filter(w=>!u.has(w)):[],p=d.length?[{component:"SUT recipe",problem:`The recipe is missing ${d.join(", ")}, so it cannot be replayed.`,evidence:`collected: ${[...u].sort().join(", ")||"nothing"}`,fix:Far(d)}]:[],m=e?n?[Mar(t,e)]:[]:c?[Qar(t)]:[],f=new Set(l?.revisionSources.flatMap(w=>w.components)),h=l&&c?t.components.filter(w=>w.repository!==An&&!f.has(w.name)).map(w=>w.name):[],A=h.length?[{component:h.join(", "),problem:`Testbot cannot tell which revision ${h.join(" and ")} ${h.length>1?"run":"runs"}, so a run could not say which changes it tested.`,evidence:`revision sources: ${l.revisionSources.map(w=>`${w.detail} (${w.components.join(", ")})`).join("; ")||"none"}`,fix:"Say in the Test Environment's notes how to tell what is deployed, such as a version route (GET /version), then set it up again."}]:[],E=[...t.blockers,...m,...i&&e?[Lar(e)]:[],...a,...p,...A,...r.revisionCheck?.blockers??[],...r.credentialBlockers??[]],y=e?.baseUrls??{};return{schemaVersion:1,...l?{type:"customer_deployed",environment:Yrt(l)}:{},status:c&&e!==void 0&&!n&&!i&&o.length===0&&d.length===0&&h.length===0&&!r.revisionCheck?.blockers.length&&!r.credentialBlockers?.length?"ready":"blocked",components:t.components.map(w=>({name:w.name,repository:w.repository,healthy:w.healthy&&!n,url:Object.hasOwn(y,w.name)&&y[w.name]||null,...w.steps?{steps:w.steps.map(C=>({action:C.action,text:C.text,source:C.source,file:C.file}))}:{},...w.kind?{kind:w.kind}:{},...w.from?{from:{file:w.from.file,service:w.from.service}}:{},...w.credentials?{credentials:[...new Set(w.credentials)].filter(C=>WA.test(C))}:{},...l?{deployed:Uar(w,r)}:{}})),suites:t.suites.map(w=>({framework:w.framework,file:w.file,result:w.result})),inputsUsed:[...t.inputsUsed],...t.inputsUsedHow?{inputsUsedHow:t.inputsUsedHow.filter(w=>t.inputsUsed.includes(w.input)).map(w=>({input:w.input,how:w.how}))}:{},inputsNotUsed:t.inputsNotUsed.map(w=>({input:w.input,reason:w.reason})),blockers:E.map(w=>({component:w.component,problem:w.problem,evidence:w.evidence,fix:w.fix})),replay:e&&!l?{outcome:e.outcome,durationSeconds:r.deployDurationSeconds??null}:null,files:s.recipeFiles.filter(w=>JA(w.path)&&!(l&&Pv.includes(w.path))).map(w=>({path:w.path,content:w.content}))}}function Uar(t,e){return t.repository===An?null:e.revisionCheck?e.revisionCheck.deployed[t.name]??null:e.deployed?.[t.name]??t.deployed??null}function Yrt(t){return{address:t.address,readyWhen:t.readyWhen,credentials:[...new Set(t.credentials)],revisionSources:t.revisionSources.map(e=>({method:e.method,detail:e.detail,components:[...e.components]}))}}function Jrt(t){return{schemaVersion:1,status:"ready",components:t.components.map(({url:e,deployed:r,...n})=>({...n,healthy:!0})),suites:t.suites,inputsUsed:t.inputsUsed,...t.inputsUsedHow?{inputsUsedHow:t.inputsUsedHow}:{},inputsNotUsed:t.inputsNotUsed,blockers:[],recipeFiles:t.files,recipeFilesOmitted:[],...t.environment?{environment:Yrt(t.environment)}:{}}}var int={handshake:"/api/v1/runner/runs/:runId/attempts",report:"/api/v1/runner/attempts/:attemptId/report",end:"/api/v1/runner/attempts/:attemptId/end",configuration:"/api/v1/runner/attempts/:attemptId/configuration",progress:"/api/v1/runner/attempts/:attemptId/progress",sutRecipe:"/api/v1/runner/attempts/:attemptId/sut-recipe",runtimePlan:"/api/v1/runner/attempts/:attemptId/runtime-plan",heartbeat:"/api/v1/runner/attempts/:attemptId/heartbeat",setupEvents:"/api/v1/runner/attempts/:attemptId/setup-events",requirements:"/api/v1/runner/attempts/:attemptId/requirements",requirementFile:"/api/v1/runner/attempts/:attemptId/requirements/:key/file"},I_=(r=>(r.GitHub="github",r.AzureDevOps="azure-devops",r))(I_||{}),hme=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(hme||{}),gG=(i=>(i.PullRequest="pull_request",i.ReadyForReview="ready_for_review",i.Schedule="schedule",i.Manual="manual",i.SutSetup="sut_setup",i))(gG||{}),$ar=["sut_setup"],qar=["sut_setup","schedule"],Har=["sut_setup"],AG=(e=>(e.PullRequest="pull_request",e))(AG||{}),yG=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(yG||{});var bG=(s=>(s.ReportUploaded="report_uploaded",s.NoReport="no_report",s.Cancelled="cancelled",s.RecipeUploaded="recipe_uploaded",s))(bG||{}),ont=(r=>(r.Running="running",r.Ended="ended",r))(ont||{}),EG=(o=>(o.TimedOut="timed_out",o.AgentFailed="agent_failed",o.SetupFailed="setup_failed",o.CredentialMissing="credential_missing",o.RunnerLost="runner_lost",o.CheckoutFailed="checkout_failed",o))(EG||{}),gme=(n=>(n.Onboard="onboard",n.Deploy="deploy",n.Recheck="recheck",n))(gme||{}),Ame=(r=>(r.Started="started",r.Finished="finished",r))(Ame||{}),yme=(n=>(n.Passed="passed",n.Failed="failed",n.Skipped="skipped",n))(yme||{}),bme=(o=>(o.Log="log",o.Component="component",o.Reply="reply",o.Question="question",o.Delivered="delivered",o.Credentials="credentials",o))(bme||{}),wG=(n=>(n.ChooseCredential="choose_credential",n.FreeText="free_text",n.ChooseSource="choose_source",n))(wG||{});var Ov=(n=>(n.Discover="discover",n.Start="start",n.Check="check",n))(Ov||{}),v_=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(v_||{}),Gu=b.string().regex(/^[1-9][0-9]{0,18}$/),Mv=b.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),Hl=b.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),la=b.string().regex(/^[0-9a-f]{64}$/),hG=b.object({id:Hl,revision:Gu}).strict(),Dc=b.object({provider:b.nativeEnum(I_),providerAccountId:Gu,providerRepositoryId:Gu}).strict(),E_=t=>`${t.provider}:${t.providerRepositoryId}`,ant=Dc.extend({namespace:b.string().min(1),name:b.string().min(1)}).strict(),Krt=b.object({ref:b.string().min(1),revision:Mv}).strict(),zar=b.object({repository:ant,revision:Mv,ref:b.string().nullable(),reason:b.nativeEnum(hme),change:b.object({kind:b.nativeEnum(AG),number:Gu,base:Krt.optional()}).strict().nullable(),compareWith:Krt.optional()}).strict();function Gar(t){let e=t.baseline.sources,r=t.trigger.kind==="schedule"&&t.baseline.confirmedRunId!==null;if(!e)return r?"names every source of the snapshot, once":null;if(t.baseline.confirmedRunId===null)return"a run with no Confirmed Baseline names no baseline sources";let n=new Set(t.sources.map(o=>E_(o.repository))),s=new Set(e.map(o=>E_(o.repository)));return s.size===e.length&&s.size===n.size&&[...s].every(o=>n.has(o))?null:"names every source of the snapshot, once"}var cnt=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,lnt=/^[1-9][0-9]{0,18}$/,Xrt=new RegExp(`${cnt.source}|${lnt.source}`),Zrt=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,jar=b.union([b.object({source:b.literal("jira"),site:b.string().regex(Zrt),key:b.string().regex(cnt),updated:b.string().datetime(),contentHash:la}).strict(),b.object({source:b.literal("confluence"),site:b.string().regex(Zrt),key:b.string().regex(lnt),version:b.number().int().positive(),contentHash:la}).strict(),b.object({source:b.literal("other"),key:b.string().regex(f_),contentHash:la}).strict(),b.object({source:b.literal("other"),key:b.string().regex(Pw),contentHash:la,fileName:b.string().min(1).max(255),mediaType:b.nativeEnum(Tv)}).strict()]),ent=b.union([b.literal("jira"),b.literal("confluence")]),unt=b.object({schemaVersion:b.literal(1),items:b.array(b.union([b.object({source:ent,site:b.string(),key:b.string().regex(Xrt),state:b.literal("read"),text:b.string(),version:b.string().min(1),contentMatches:b.boolean()}).strict(),b.object({source:ent,site:b.string(),key:b.string().regex(Xrt),state:b.literal("not_read"),reason:b.nativeEnum(Bw)}).strict(),b.object({source:b.literal("other"),key:b.string().regex(f_),state:b.literal("read"),text:b.string(),version:b.string().min(1),contentMatches:b.boolean()}).strict(),b.object({source:b.literal("other"),key:b.string().regex(f_),state:b.literal("not_read"),reason:b.nativeEnum(Bw)}).strict(),b.object({source:b.literal("other"),key:b.string().regex(Pw),state:b.literal("read"),version:la,fileName:b.string().min(1).max(255),mediaType:b.nativeEnum(Tv)}).strict(),b.object({source:b.literal("other"),key:b.string().regex(Pw),state:b.literal("not_read"),reason:b.nativeEnum(Bw)}).strict()])),instructions:b.array(b.string()).optional()}).strict(),Var=b.object({schemaVersion:b.literal(1),runId:Hl,skyrampOrgId:Hl,target:hG,policy:hG.nullable(),trigger:b.object({kind:b.nativeEnum(gG),requestedAt:b.string().datetime()}).strict(),configuration:b.object({captureId:Hl,revision:Gu.nullable(),hash:la}).strict(),baseline:b.object({confirmedRunId:Hl.nullable(),sources:b.array(b.object({repository:Dc,revision:Mv}).strict()).optional()}).strict(),sources:b.array(zar).min(1),execution:b.object({provider:b.nativeEnum(I_),repository:ant,workflowPath:b.string(),ref:b.string()}).strict(),credentials:b.array(b.object({name:b.string(),purpose:b.nativeEnum(yG),required:b.boolean()}).strict()),requirements:b.array(jar).min(1).optional(),instructions:b.object({contentHash:la}).strict().optional()}).strict().superRefine((t,e)=>{let r=new Set;(t.requirements??[]).forEach((o,a)=>{let c="fileName"in o?"file":"pasted";o.source==="other"&&o.key!==`${c}-${o.contentHash.slice(0,16)}`&&e.addIssue({code:b.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",a,"key"]});let l=_c({source:o.source,key:o.key});r.has(l)&&e.addIssue({code:b.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",a,"key"]}),r.add(l)});let n=t.trigger.kind,s=$ar.includes(n);s!==(t.policy===null)&&e.addIssue({code:b.ZodIssueCode.custom,path:["policy"],message:s?`a ${n} run has no policy`:"names the policy revision"});let i=Gar(t);i&&e.addIssue({code:b.ZodIssueCode.custom,path:["baseline","sources"],message:i}),qar.includes(n)&&t.sources.forEach((o,a)=>{o.reason!=="BASELINE"&&e.addIssue({code:b.ZodIssueCode.custom,path:["sources",a,"reason"],message:`a ${n} run selects only BASELINE sources`})}),t.sources.forEach((o,a)=>{o.compareWith&&(o.reason!=="MANUAL_OVERRIDE"||o.change)&&e.addIssue({code:b.ZodIssueCode.custom,path:["sources",a,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"})})});var Eme=(r=>(r.Person="person",r.Policy="policy",r))(Eme||{}),War=b.object({kind:b.nativeEnum(Eme),name:b.string().min(1).max(256)}).strict(),Yar=b.object({schemaVersion:b.literal(1),attempt:b.object({id:Hl,number:b.number().int().positive(),deadlineAt:b.string().datetime()}).strict(),manifest:Var,manifestHash:la,entitlements:b.array(b.string()).optional(),runToken:b.string().min(1).optional(),requestedBy:War.nullable().optional(),writeAllowed:b.boolean().optional()}).strict(),Jar=b.object({schemaVersion:b.literal(1),runId:Hl,execution:b.object({provider:b.nativeEnum(I_),repository:Dc,providerRunId:Gu,providerRunAttempt:b.number().int().positive(),workflowRef:b.string().min(1)}).strict(),requester:b.literal(!0).optional(),writeCheck:b.literal(!0).optional()}).strict(),tnt=b.object({repository:Dc,number:Gu}).strict(),Kar=b.discriminatedUnion("status",[b.object({status:b.literal("none")}).strict(),b.object({status:b.literal("delivered"),pullRequests:b.array(tnt).min(1)}).strict(),b.object({status:b.literal("partial"),pullRequests:b.array(tnt).min(1),failures:b.array(b.object({repository:Dc,message:b.string()}).strict()).min(1)}).strict(),b.object({status:b.literal("failed"),message:b.string()}).strict()]),Xar=b.object({sufficiency:b.nativeEnum(h_),rationale:b.string().min(1),gaps:b.array(b.string().min(1)),acceptedEvidence:b.array(b.object({kind:b.nativeEnum(VA),repository:b.string().min(1),revision:Mv,reference:b.string().min(1),summary:b.string().min(1)}).strict()),actionRequired:b.array(b.nativeEnum(g_))}).strict().superRefine((t,e)=>{t.sufficiency==="sufficient"!=(t.gaps.length===0)&&e.addIssue({code:b.ZodIssueCode.custom,path:["gaps"],message:"sufficient evidence has no gaps, and insufficient evidence names at least one"}),new Set(t.actionRequired).size!==t.actionRequired.length&&e.addIssue({code:b.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Dv=500,wme=2048,xme=1e3,Zar=b.object({testResults:b.array(b.object({resultId:b.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:b.string().regex(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/),testType:b.string(),endpoint:b.string(),status:b.enum(["Pass","Fail","Skipped"]),details:b.string(),fileName:b.string().optional(),testId:b.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:b.object({kind:b.nativeEnum(A_),family:b.nativeEnum(cG).optional()}).strict().optional()}).strict()),validation:Xar,changes:b.array(b.object({id:b.string().min(1).max(512),text:b.string().max(16384),source:b.string().max(wme),testedBy:b.array(b.string().min(1).max(1024)).max(Dv),writtenBy:b.array(b.string().min(1).max(1024)).max(Dv),maintainedBy:b.array(b.string().min(1).max(1024)).max(Dv)}).strict()).max(xme).optional(),traceVersion:b.literal(1)}).passthrough().superRefine((t,e)=>{let r=new Set;t.testResults.forEach((n,s)=>{let i=n.failureCause;i&&n.status==="Pass"&&e.addIssue({code:b.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"a passing result has no failure cause"}),i&&i.kind==="environment"!=(i.family!==void 0)&&e.addIssue({code:b.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"an environment cause names its family, and no other cause does"});let o=["testResults",s,"resultId"],a=n.resultId.slice(`${n.repository}:${n.testType}:`.length);(!n.resultId.startsWith(`${n.repository}:${n.testType}:`)||a===""||a.startsWith("/")||a.startsWith("#"))&&e.addIssue({code:b.ZodIssueCode.custom,path:o,message:"is not repository:testType:path for this result"}),r.has(n.resultId)&&e.addIssue({code:b.ZodIssueCode.custom,path:o,message:"stable identity repeated"}),r.add(n.resultId)})}),rnt=t=>t.replace(/[%:#]/g,e=>encodeURIComponent(e));function xG(t,e,r,n){let s=r.replace(/\\/g,"/"),i=s.split("/").filter(c=>c!==""&&c!==".");if(s.startsWith("/")||/^[A-Za-z]:/.test(s)||i.length===0||i.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${r}"`);let o=i.join("/"),a=`${t}:${e}:${rnt(o)}`;return n?`${a}#${rnt(n)}`:a}var Sme=50,nnt=b.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),Cme=b.discriminatedUnion("kind",[b.object({kind:b.literal("branch_pushed"),repository:Dc,branch:nnt,commit:Mv}).strict(),b.object({kind:b.enum(["pull_request_opened","pull_request_edited"]),repository:Dc,number:Gu,branch:nnt}).strict()]),dnt=b.object({schemaVersion:b.literal(1),run:b.object({runId:Hl,attemptNumber:b.number().int().positive(),manifestHash:la}).strict(),target:hG,policy:hG,provenance:b.object({sources:b.array(b.object({repository:Dc,revision:Mv}).strict())}).strict(),delivery:b.object({generatedTests:Kar}).strict(),producer:b.object({testbot:b.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:b.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:Zar,githubWrites:b.array(Cme).max(Sme).optional()}).strict(),ecr=dnt.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:mG}).strict().superRefine(({recipe:t},e)=>{let r=(i,o)=>e.addIssue({code:b.ZodIssueCode.custom,path:["recipe",...i],message:o});t.status==="blocked"&&t.blockers.length===0&&r(["blockers"],"a blocked recipe names at least one blocker");let n=new Set,s=0;t.files.forEach((i,o)=>{JA(i.path)||r(["files",o,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),n.has(i.path)&&r(["files",o,"path"],"file repeated"),n.add(i.path),pG.test(i.content)&&r(["files",o,"content"],"is not text");let a=Buffer.byteLength(i.content,"utf8");s+=a,a>_w&&r(["files",o,"content"],`larger than ${_w} bytes`)}),s>Dw&&r(["files"],`recipe text over ${Dw} bytes in total`)}),pnt=b.object({schemaVersion:b.literal(1),stage:b.nativeEnum(gme),event:b.nativeEnum(Ame),status:b.nativeEnum(yme).optional()}).strict().refine(t=>t.status===void 0||t.event==="finished",{path:["status"],message:"only a finished stage has a status"}),Qv=100,SG=5e3,fme=2e3,w_=100,CG=/^[A-Za-z0-9_-]{1,64}$/,Ime=20,vme=200,Rme=100,Nme=100,tcr=200,rcr=/^[^/\s]+\/[^/\s]+$/,Tme=500,kme=50,Bme=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,im=t=>b.string().max(t).refine(e=>e.trim().length>0&&!Bme.test(e),"blank, or not text"),_v={sequence:b.number().int().min(1).max(SG),at:b.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},Pme=b.discriminatedUnion("kind",[b.object({..._v,kind:b.literal("log"),phase:b.nativeEnum(Ov),text:im(fme)}).strict(),b.object({..._v,kind:b.literal("component"),name:im(w_),repository:im(tcr).refine(t=>rcr.test(t)||t===An,"not owner/name"),file:im(Tme).nullable(),status:b.nativeEnum(v_),version:im(Nme).optional()}).strict(),b.object({..._v,kind:b.literal("reply"),to:b.string().uuid(),accepted:b.boolean(),text:im(fme)}).strict(),b.object({..._v,kind:b.literal("question"),id:b.string().regex(CG),type:b.nativeEnum(wG),text:im(fme),component:im(w_).nullable(),choices:b.array(im(vme)).max(Ime),placeholder:im(Rme).optional()}).strict(),b.object({..._v,kind:b.literal("delivered"),ids:b.array(b.string().uuid()).max(Qv)}).strict(),b.object({..._v,kind:b.literal("credentials"),names:b.array(b.string().regex(WA)).min(1).max(kme)}).strict()]).superRefine((t,e)=>{t.kind==="credentials"&&new Set(t.names).size!==t.names.length&&e.addIssue({code:b.ZodIssueCode.custom,path:["names"],message:"a name twice"}),t.kind==="question"&&(t.type==="free_text"!=(t.choices.length===0)&&e.addIssue({code:b.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(t.choices).size!==t.choices.length&&e.addIssue({code:b.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),mnt=b.object({schemaVersion:b.literal(1),events:b.array(Pme).max(Qv)}).strict(),snt={id:b.string().uuid(),text:b.string(),by:b.string().nullable(),at:b.string()},ncr=b.discriminatedUnion("kind",[b.object({...snt,kind:b.literal("instruction"),question:b.null()}),b.object({...snt,kind:b.literal("answer"),question:b.string().regex(CG)})]),fnt=b.string().regex(/^[A-Za-z0-9+/]{43}=$/),hnt=b.object({schemaVersion:b.literal(1),leftOut:b.array(b.string()),messages:b.array(ncr).optional(),stop:b.object({key:fnt}).optional()}),R_=7,IG=500*1024*1024,gnt=b.object({id:Gu,name:b.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Gu,expiresAt:b.string().datetime()}).strict(),Ant=b.object({schemaVersion:b.literal(1),artifact:gnt,sessionId:Hl,contentHash:la,bytes:b.number().int().min(1).max(IG)}).strict(),ynt=b.object({schemaVersion:b.literal(1),checkpoint:b.object({artifact:gnt,repository:b.object({namespace:b.string().min(1),name:b.string().min(1)}).strict(),sessionId:Hl,contentHash:la,key:fnt}).strict().nullable()}).strict(),scr=200,fG=100,vG=(n=>(n.Resume="resume",n.Retry="retry",n.Update="update",n))(vG||{}),icr=b.object({kind:b.nativeEnum(vG),setup:b.object({runId:Hl,endedAt:b.string().nullable(),outcome:b.string().nullable()}).strict(),components:b.array(b.object({name:b.string().min(1),repository:b.string().min(1),status:b.nativeEnum(v_)}).strict()).max(fG),credentials:b.array(b.string().min(1)).max(fG),answers:b.array(b.object({question:b.string(),answer:b.string().nullable()}).strict()).max(fG),instructions:b.array(b.object({text:b.string(),reply:b.string().nullable()}).strict()).max(fG),log:b.array(b.object({phase:b.nativeEnum(Ov),text:b.string()}).strict()).max(scr)}).strict(),bnt=b.object({schemaVersion:b.literal(1),context:icr.nullable()}).strict(),Ent=b.object({schemaVersion:b.literal(1),configuration:b.object({captureId:Hl,revision:Gu.nullable(),hash:la}).strict(),capture:b.object({schemaVersion:b.literal(1),settings:b.object({target:b.object({environment:b.unknown()}).passthrough(),timeoutMinutes:b.number().int().positive(),answerWaitMinutes:b.number().int().positive().optional(),testEnvironment:b.object({name:b.string().min(1),address:b.string().min(1).optional(),readyWhen:b.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:b.object({}).passthrough(),hash:la}).strict()}).strict(),ocr=Bv.extend({version:b.number().int().positive(),components:b.array(b.object({name:b.string().min(1),repository:b.string().min(1)}).strict()),contentHash:la.optional(),files:b.array(b.object({path:b.string().refine(t=>JA(t)&&!Pv.includes(t),"not a file of a customer_deployed plan"),content:b.string()}).strict()).optional()}).strict(),wnt=b.object({schemaVersion:b.literal(1),testEnvironment:ocr.nullable().optional(),runtimePlan:b.object({version:b.number().int().positive(),contentHash:la,files:b.array(b.object({path:b.string().refine(JA,"not a recipe file path"),content:b.string()}).strict()).min(1),recipe:b.record(b.unknown()).optional()}).strict().nullable()}).strict().refine(t=>!(t.runtimePlan&&t.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),xnt=b.object({schemaVersion:b.literal(1),state:b.nativeEnum(ont),ending:b.nativeEnum(bG).nullable(),cause:b.nativeEnum(EG).nullable(),deadlineAt:b.string().datetime()}).strict();function _me(t,e){return t.state==="ended"?t.ending==="cancelled"?"cancelled":t.cause==="runner_lost"?"expired":"ended":e.getTime()>=Date.parse(t.deadlineAt)?"expired":null}function KA(t){if(typeof t=="number"&&!Number.isFinite(t))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(t))return`[${t.map(KA).join(",")}]`;if(t!==null&&typeof t=="object"){let r=t;return`{${Object.keys(r).sort().map(n=>`${JSON.stringify(n)}:${KA(r[n])}`).join(",")}}`}let e=JSON.stringify(t);if(e===void 0)throw new TypeError("Canonical JSON requires JSON values");return e}function Dme(t){return(0,C_.createHash)("sha256").update(KA(t),"utf8").digest("hex")}function Snt(t){let e=[...t].sort((r,n)=>r.path<n.path?-1:r.path>n.path?1:0).map(r=>({path:r.path,content:r.content}));return(0,C_.createHash)("sha256").update(KA(e),"utf8").digest("hex")}function Cnt(t){let e=(i,o)=>i<o?-1:i>o?1:0,r=[...t.files].sort((i,o)=>e(i.path,o.path)).map(i=>({path:i.path,content:i.content})),n={address:t.address,readyWhen:t.readyWhen,credentials:[...t.credentials].sort(e),revisionSources:t.revisionSources.map(i=>KA({method:i.method,detail:i.detail,components:[...i.components].sort(e)})).sort(e)},s=t.components.map(i=>KA({name:i.name,repository:i.repository})).sort(e);return(0,C_.createHash)("sha256").update(KA({type:"customer_deployed",environment:n,components:s,files:r}),"utf8").digest("hex")}function Int(t){return(0,C_.createHash)("sha256").update(KA({schemaVersion:t.schemaVersion,settings:t.settings,provenance:t.provenance}),"utf8").digest("hex")}var x_=t=>({provider:t.provider,providerAccountId:t.providerAccountId,providerRepositoryId:t.providerRepositoryId});function vnt(t,e){return Jar.parse({schemaVersion:1,runId:t,execution:e.execution(),requester:!0,writeCheck:!0})}function Rnt(t){let e=Yar.parse(t);if(Dme(e.manifest)!==e.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return e}function acr(t){let e=r=>r.map(n=>({repository:x_(n.repository),number:n.number}));return t.status==="delivered"?{status:t.status,pullRequests:e(t.pullRequests)}:t.status==="partial"?{status:t.status,pullRequests:e(t.pullRequests),failures:t.failures.map(r=>({repository:x_(r.repository),message:r.message}))}:t}function Nnt(t){return t.issues.map(e=>`${e.path.map((n,s)=>typeof n=="number"?`[${n}]`:s===0?n:`.${n}`).join("")}: ${e.message}`).join("; ")}function Tnt(t){let{manifest:e}=t;if(Har.includes(e.trigger.kind))throw new Error(`The report upload is invalid: a ${e.trigger.kind} run uploads its SUT recipe, never a report`);let r=dnt.safeParse({schemaVersion:1,run:{runId:e.runId,attemptNumber:t.attemptNumber,manifestHash:Dme(e)},target:{id:e.target.id,revision:e.target.revision},policy:e.policy&&{id:e.policy.id,revision:e.policy.revision},provenance:{sources:t.checkedOut.map(n=>({repository:x_(n.repository),revision:n.revision}))},delivery:{generatedTests:acr(t.generatedTests)},producer:t.producer,report:t.report,...t.githubWrites?.length?{githubWrites:t.githubWrites.map(n=>({...n,repository:x_(n.repository)}))}:{}});if(!r.success)throw new Error(`The report upload is invalid: ${Nnt(r.error)}`);return ccr(r.data,e),r.data}function knt(t,e,r,n,s){let i=ecr.safeParse({schemaVersion:1,run:{runId:t.runId,attemptNumber:e,manifestHash:Dme(t)},target:{id:t.target.id,revision:t.target.revision},provenance:{sources:r.map(o=>({repository:x_(o.repository),revision:o.revision}))},producer:s,recipe:n});if(!i.success)throw new Error(`The SUT recipe upload is invalid: ${Nnt(i.error)}`);return i.data}function ccr(t,e){let r=new Map(e.sources.map(n=>[`${n.repository.namespace}/${n.repository.name}`.toLowerCase(),n.revision]));t.report.validation.acceptedEvidence.forEach((n,s)=>{let i=`report.validation.acceptedEvidence[${s}]`,o=r.get(n.repository.toLowerCase());if(!o)throw new Error(`${i}.repository: ${n.repository} is outside the run's snapshot`);if(n.revision!==o)throw new Error(`${i}.revision: evidence is not from the frozen revision ${o}`)})}var lcr=3e4;function Bnt(t,e={}){let r=i=>{let o=t[i];if(!o)throw new Error(`${i} is not set; the V3 runner handshake needs it`);return o},n=t.GITHUB_REPOSITORY_ID,s=t.GITHUB_REPOSITORY;return{runnerPlatform:t.GITHUB_ACTIONS==="true"?"github":void 0,workspace:t.GITHUB_WORKSPACE||void 0,serverUrl:(t.GITHUB_SERVER_URL||"https://github.com").replace(/\/+$/,""),apiUrl:(t.GITHUB_API_URL||"https://api.github.com").replace(/\/+$/,""),repository:n&&s?{id:n,slug:s}:void 0,runId:t.GITHUB_RUN_ID||void 0,runAttempt:t.GITHUB_RUN_ATTEMPT||void 0,job:t.GITHUB_JOB||void 0,execution(){let i=r("GITHUB_RUN_ATTEMPT");if(!/^[1-9][0-9]*$/.test(i))throw new Error(`GITHUB_RUN_ATTEMPT is "${i}", not a positive whole number`);return{provider:"github",repository:{provider:"github",providerAccountId:r("GITHUB_REPOSITORY_OWNER_ID"),providerRepositoryId:r("GITHUB_REPOSITORY_ID")},providerRunId:r("GITHUB_RUN_ID"),providerRunAttempt:Number(i),workflowRef:r("GITHUB_WORKFLOW_REF")}},takeIdToken(){let i=t.ACTIONS_ID_TOKEN_REQUEST_URL,o=t.ACTIONS_ID_TOKEN_REQUEST_TOKEN;return delete t.ACTIONS_ID_TOKEN_REQUEST_URL,delete t.ACTIONS_ID_TOKEN_REQUEST_TOKEN,async a=>{if(!i||!o)throw new Error("The job cannot request an OIDC token. Give it the `id-token: write` permission.");let c=new URL(i);c.searchParams.set("audience",a);let l=await fetch(c,{headers:{Authorization:`Bearer ${o}`,Accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(lcr)});if(!l.ok)throw new Error(`GitHub refused the OIDC token request: ${l.status}`);let u=(await l.json().catch(()=>({}))).value;if(typeof u!="string"||!u)throw new Error("GitHub's OIDC token response carried no token");return Ot(u),u}},webIdentity(){return!t.ACTIONS_ID_TOKEN_REQUEST_TOKEN?.trim()||!t.ACTIONS_ID_TOKEN_REQUEST_URL?.trim()?void 0:{token:e.getIDToken??(o=>yRe(o)),runId:t.GITHUB_RUN_ID}}}}function Os(t=process.env){return Bnt(t)}Ke();var Ow=q(require("fs"));Ke();var RG=q(require("fs")),XA=q(require("path"));function N_(t){return t.match(/\.skyramp\/videos\/([^/]+)\//)?.[1]}function Ome(t){if(!RG.existsSync(t))return[];let e=[],r=n=>{let s;try{s=RG.readdirSync(n,{withFileTypes:!0})}catch(i){X(`Skipping unreadable video dir ${n}: ${i instanceof Error?i.message:String(i)}`);return}for(let i of s){let o=XA.join(n,i.name);i.isDirectory()?r(o):i.isFile()&&i.name.endsWith(".webm")&&e.push(o)}};return r(t),e}async function Pnt(t,e,r){let n={};if(r.size===0)return n;let s=XA.resolve(t),i=()=>[...r].flatMap(c=>{let l=XA.resolve(t,c);return l!==s&&!l.startsWith(s+XA.sep)?(X(`Skipping video subdir outside the videos tree: ${c}`),[]):Ome(XA.join(t,c))}),o=i();if(o.length===0&&(X(`Expected ${r.size} test video(s) but found none under ${t}; retrying collection once`),await NA(3),o=i()),o.length===0)return n;let a=new Map;for(let c of o){let l=N_(c);if(!l)continue;let u=a.get(l);u?u.push(c):a.set(l,[c])}for(let[c,l]of a)try{let u=await Mme(`skyramp-video-${c}`,l,t);u&&(n[c]=e.getArtifactUrl(u))}catch(u){X(`Failed to upload video artifact for ${c} after retry: ${u instanceof Error?u.message:String(u)}`)}return Ne(`Uploaded ${Object.keys(n).length} of ${a.size} test execution video artifact(s)`),n}async function Mme(t,e,r,n){let{DefaultArtifactClient:s}=await Promise.resolve().then(()=>(pI(),iB)),i=new s,{id:o}=await li(()=>i.uploadArtifact(t,e,r,n),{retries:2,delay:3,label:`Video artifact upload for ${t}`});return o}function ucr(t){return Ow.existsSync(t.summaryPath)?t.summaryPath:Ow.existsSync(t.agentStdoutPath)?(ee("Using agent stdout as fallback (agent did not write to summary file)"),t.agentStdoutPath):null}var Qme=t=>t.replace(/\s*[\r\n]+\s*/g," ").trim(),Lme=t=>typeof t=="number"&&Number.isInteger(t)&&t>=0?t:void 0;function dcr(t){if(typeof t!="object"||t===null)return;let e=t,r=Object.values(Ip).includes(e.verification)?e.verification:void 0,n=(Array.isArray(e.skipped)?e.skipped:[]).map(o=>typeof o=="object"&&o!==null?o:{}).filter(o=>typeof o.pageObject=="string"&&o.pageObject.trim()!=="").map(o=>({pageObject:Qme(o.pageObject),member:typeof o.member=="string"?Qme(o.member):void 0,declinedBy:Object.values(pA).includes(o.declinedBy)?o.declinedBy:void 0,reason:typeof o.reason=="string"?Qme(o.reason):""})),s={candidatesDetected:Lme(e.candidatesDetected),callsReused:Lme(e.callsReused),callsVerified:Lme(e.callsVerified),verification:r,skipped:n.length>0?n:void 0};return Object.values(s).some(o=>o!==void 0)?s:void 0}function pcr(t){let e=typeof t=="object"&&t!==null?t:{},{reuse:r,...n}=e,s=dcr(r);return s?{...n,reuse:s}:n}function mcr(t){try{let e=t.replace(/^```(?:json)?\s*\n?/m,"").replace(/\n?```\s*$/m,"").trim(),r=JSON.parse(e);if(typeof r.businessCaseAnalysis=="string"&&Array.isArray(r.testResults)){for(let n of["newTestsCreated","testMaintenance","issuesFound"])Array.isArray(r[n])||(r[n]=[]);return Array.isArray(r.nextSteps)||(r.nextSteps=[]),r.commitMessage!==void 0&&typeof r.commitMessage!="string"&&delete r.commitMessage,r.newTestsCreated=r.newTestsCreated.map(pcr),r.testResults=r.testResults.map(n=>{let s=typeof n=="object"&&n!==null?n:{},i={...s,testType:typeof s.testType=="string"?s.testType:"",endpoint:typeof s.endpoint=="string"?s.endpoint:"",status:typeof s.status=="string"?s.status:"",details:typeof s.details=="string"?s.details:""};for(let o of["repository","videoPath"])i[o]!==void 0&&typeof i[o]!="string"&&delete i[o];return i}),r}return null}catch{return null}}var _nt={high:0,medium:1,low:2},Dnt={security_boundary:0,breaking_change:1,data_integrity:2,business_rule:3,workflow:4};function Ont(t,e,r,n){let s=r[n(t.testType)]??99,i=r[n(e.testType)]??99;if(s!==i)return s-i;let o=_nt[(t.priority??"").toLowerCase()]??99,a=_nt[(e.priority??"").toLowerCase()]??99;if(o!==a)return o-a;let c=Dnt[t.category??""]??99,l=Dnt[e.category??""]??99;if(c!==l)return c-l;let u=(t.steps??[]).some(p=>(p.expectedStatusCode??0)>=400)?0:1,d=(e.steps??[]).some(p=>(p.expectedStatusCode??0)>=400)?0:1;return u!==d?u-d:(t.scenarioName??"").localeCompare(e.scenarioName??"")}function fcr(t){if(!t)return;let e=ne().reuse,{callsReused:r,callsVerified:n,candidatesDetected:s,verification:i}=t,o=[];r!==void 0&&n!==void 0?(o.push(r===n?e.reusedAndVerified(r):e.reusedThenVerified(r,n)),i===Ip.Passed&&r>n&&o.push(e.unresolved(r-n))):r!==void 0?o.push(e.reused(r)):n!==void 0&&o.push(e.verified(n)),s!==void 0&&o.push(e.candidates(s));let a=r!==void 0&&r===n;i===Ip.SkippedNoPom?o.push(e.noPomLayer):i===Ip.Passed&&!a?o.push(e.verificationPassed):i===Ip.Failed&&o.push(e.verificationFailed);let c=t.skipped??[];if(c.length>0){let l=d=>{let p=d.member||d.pageObject,f=[d.declinedBy?e.gate[d.declinedBy]:"",d.reason].filter(Boolean).join(" \u2014 ");return f?`${p} (${f})`:p},u=[...c].sort((d,p)=>+(p.declinedBy===pA.DemotedByVerify)-+(d.declinedBy===pA.DemotedByVerify));o.push(e.keptInline(u.map(l).join("; ")))}if(o.length!==0)return`${e.label}: ${o.join(" \xB7 ")}`}function Mnt(t){return(t.testMaintenance??[]).filter(e=>e.action!==mI.Ignore&&e.action!==mI.Verify)}function Mw(t,e={}){let r=ne(),{collapsed:n=!1,userPrompt:s,autoCommit:i=!1,audience:o,primaryRepo:a}=e,c=[],l=Y=>Y&&Y.toLowerCase()!==a?.toLowerCase()?Y:void 0,u=Y=>{let te=l(Y);return te?` \`[${te}]\``:""},d=t.newTestsCreated.some(Y=>l(Y.repository))||t.testResults.some(Y=>l(Y.repository))||t.issuesFound.some(Y=>l(Y.repository))||!!t.additionalRecommendations?.some(Y=>l(Y.repository)),p=o!=="testbot-pr",m=o!=="comment",f=o!=="testbot-pr",h=o!=="testbot-pr",A=o==="testbot-pr";c.push("<!-- skyramp-testbot -->");let E=Mnt(t),y=new Set([Oa.Lint,Oa.Type,Oa.Config]),w=Y=>Y.category!==void 0&&y.has(Y.category),C=t.issuesFound.filter(Y=>!w(Y)),v=t.issuesFound.filter(w),k={critical:0,high:1,medium:2,low:3},N=(Y,te)=>(k[Y.severity??""]??4)-(k[te.severity??""]??4),M=(Y,te)=>(Object.prototype.hasOwnProperty.call(Y,te)?Y[te]:void 0)??te,T=Y=>`- ${Y.severity?`**[${M(r.severityLabels,Y.severity).toUpperCase()}]** `:""}${Y.description}${u(Y.repository)}`;if(t.newTestsCreated.length===0&&t.testResults.length===0&&E.length===0&&t.issuesFound.length>0&&(!t.additionalRecommendations||t.additionalRecommendations.length===0)){c.push(r.minimalReportHeader),c.push("");for(let te of C)c.push(te.description);if(v.length>0){C.length>0&&c.push(""),c.push(`### ${r.configErrorsHeader}`);for(let te of[...v].sort(N))c.push(T(te))}let Y=t.caveats??[];if(Y.length>0){c.push(""),c.push(r.caveatsHeader),c.push("");for(let te of Y)c.push(`- ${te.text}`)}if(t.nextSteps?.length>0){c.push(""),c.push(r.nextStepsHeader),c.push("");for(let te of t.nextSteps)c.push(`- ${te}`)}return Fme(c.join(`
317
+ ${r.output}`:`deploy reported ${e.outcome} without the failing command`,fix:e.outcome==="change-broke-bringup"?`fix the change that broke bring-up${n}, then onboard again`:"make .skyramp/sut/setup.sh bring the SUT up from a clean checkout (what onboard's session had that a fresh run lacks), then onboard again"}}function Qar(t){return t.environment?{component:t.components.map(e=>e.name).join(", ")||"SUT",problem:"the deployment was never checked from a fresh session: deploy did not run or wrote no deploy.json",evidence:"outputs/deploy.json is missing from this run",fix:"run deploy after onboard in the same run so it checks the deployment is ready; if deploy ran, its stage log says why it wrote no deploy.json"}:{component:t.components.map(e=>e.name).join(", ")||"SUT",problem:"the recipe was never replayed: deploy did not run or wrote no deploy.json",evidence:"outputs/deploy.json is missing from this run",fix:"run deploy after onboard in the same run so it replays .skyramp/sut/setup.sh from a clean start; if deploy ran, its stage log says why it wrote no deploy.json"}}function Lar(t){return{component:"SUT recipe",problem:"deploy fixed recipe drift, but the recipe it fixed was not collected \u2014 onboard's copy is the recipe from before the fix",evidence:`deploy reported recipe-drift: ${(t.recipeFixes??[]).join("; ")||"no fixes listed"}`,fix:"collect .skyramp/sut/ and .skyramp/workspace.yml after deploy (collectRecipeFiles) and build the plan from that collection"}}var ume=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh",".skyramp/sut/health.json",".skyramp/workspace.yml"],dme=[".skyramp/sut/health.json",".skyramp/workspace.yml"];function Far(t){return`Onboard again so it leaves the whole recipe in the checkout: ${t.map(r=>r===".skyramp/workspace.yml"?"create .skyramp/workspace.yml with skyramp_init_scan and skyramp_init_workspace":`write ${r} as a regular file (a symlink is not uploaded)`).join("; ")}.`}function pme(t,e,r){return e&&r||t}function mme(t,e,r={}){let n=e!==void 0&&!Oar.includes(e.outcome),s=pme(t,e,r.recipeFiles),i=e?.outcome==="recipe-drift"&&!r.recipeFiles,o=(s.recipeFilesOmitted??[]).filter(w=>JA(w.path)),a=o.length?[{component:"SUT recipe",problem:`The recipe could not be uploaded whole: ${o.map(w=>w.path).join(", ")} left out.`,evidence:o.map(w=>`${w.path}: ${w.reason}`).join("; "),fix:"Keep each recipe file text-only and under 64 KiB, and the recipe under 512 KiB in total \u2014 move large generated content out of .skyramp/sut/ and have setup.sh produce it."}]:[],c=t.status==="ready",l=t.environment,u=new Set(s.recipeFiles.map(w=>w.path)),d=c?(l?dme:ume).filter(w=>!u.has(w)):[],p=d.length?[{component:"SUT recipe",problem:`The recipe is missing ${d.join(", ")}, so it cannot be replayed.`,evidence:`collected: ${[...u].sort().join(", ")||"nothing"}`,fix:Far(d)}]:[],m=e?n?[Mar(t,e)]:[]:c?[Qar(t)]:[],f=new Set(l?.revisionSources.flatMap(w=>w.components)),h=l&&c?t.components.filter(w=>w.repository!==An&&!f.has(w.name)).map(w=>w.name):[],A=h.length?[{component:h.join(", "),problem:`Testbot cannot tell which revision ${h.join(" and ")} ${h.length>1?"run":"runs"}, so a run could not say which changes it tested.`,evidence:`revision sources: ${l.revisionSources.map(w=>`${w.detail} (${w.components.join(", ")})`).join("; ")||"none"}`,fix:"Say in the Test Environment's notes how to tell what is deployed, such as a version route (GET /version), then set it up again."}]:[],E=[...t.blockers,...m,...i&&e?[Lar(e)]:[],...a,...p,...A,...r.revisionCheck?.blockers??[],...r.credentialBlockers??[]],y=e?.baseUrls??{};return{schemaVersion:1,...l?{type:"customer_deployed",environment:Yrt(l)}:{},status:c&&e!==void 0&&!n&&!i&&o.length===0&&d.length===0&&h.length===0&&!r.revisionCheck?.blockers.length&&!r.credentialBlockers?.length?"ready":"blocked",components:t.components.map(w=>({name:w.name,repository:w.repository,healthy:w.healthy&&!n,url:Object.hasOwn(y,w.name)&&y[w.name]||null,...w.steps?{steps:w.steps.map(C=>({action:C.action,text:C.text,source:C.source,file:C.file}))}:{},...w.kind?{kind:w.kind}:{},...w.from?{from:{file:w.from.file,service:w.from.service}}:{},...w.credentials?{credentials:[...new Set(w.credentials)].filter(C=>WA.test(C))}:{},...l?{deployed:Uar(w,r)}:{}})),suites:t.suites.map(w=>({framework:w.framework,file:w.file,result:w.result})),inputsUsed:[...t.inputsUsed],...t.inputsUsedHow?{inputsUsedHow:t.inputsUsedHow.filter(w=>t.inputsUsed.includes(w.input)).map(w=>({input:w.input,how:w.how}))}:{},inputsNotUsed:t.inputsNotUsed.map(w=>({input:w.input,reason:w.reason})),blockers:E.map(w=>({component:w.component,problem:w.problem,evidence:w.evidence,fix:w.fix})),replay:e&&!l?{outcome:e.outcome,durationSeconds:r.deployDurationSeconds??null}:null,files:s.recipeFiles.filter(w=>JA(w.path)&&!(l&&Pv.includes(w.path))).map(w=>({path:w.path,content:w.content}))}}function Uar(t,e){return t.repository===An?null:e.revisionCheck?e.revisionCheck.deployed[t.name]??null:e.deployed?.[t.name]??t.deployed??null}function Yrt(t){return{address:t.address,readyWhen:t.readyWhen,credentials:[...new Set(t.credentials)],revisionSources:t.revisionSources.map(e=>({method:e.method,detail:e.detail,components:[...e.components]}))}}function Jrt(t){return{schemaVersion:1,status:"ready",components:t.components.map(({url:e,deployed:r,...n})=>({...n,healthy:!0})),suites:t.suites,inputsUsed:t.inputsUsed,...t.inputsUsedHow?{inputsUsedHow:t.inputsUsedHow}:{},inputsNotUsed:t.inputsNotUsed,blockers:[],recipeFiles:t.files,recipeFilesOmitted:[],...t.environment?{environment:Yrt(t.environment)}:{}}}var int={handshake:"/api/v1/runner/runs/:runId/attempts",report:"/api/v1/runner/attempts/:attemptId/report",end:"/api/v1/runner/attempts/:attemptId/end",configuration:"/api/v1/runner/attempts/:attemptId/configuration",progress:"/api/v1/runner/attempts/:attemptId/progress",sutRecipe:"/api/v1/runner/attempts/:attemptId/sut-recipe",runtimePlan:"/api/v1/runner/attempts/:attemptId/runtime-plan",heartbeat:"/api/v1/runner/attempts/:attemptId/heartbeat",setupEvents:"/api/v1/runner/attempts/:attemptId/setup-events",requirements:"/api/v1/runner/attempts/:attemptId/requirements",requirementFile:"/api/v1/runner/attempts/:attemptId/requirements/:key/file"},I_=(r=>(r.GitHub="github",r.AzureDevOps="azure-devops",r))(I_||{}),hme=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(hme||{}),gG=(i=>(i.PullRequest="pull_request",i.ReadyForReview="ready_for_review",i.Schedule="schedule",i.Manual="manual",i.SutSetup="sut_setup",i))(gG||{}),$ar=["sut_setup"],qar=["sut_setup","schedule"],Har=["sut_setup"],AG=(e=>(e.PullRequest="pull_request",e))(AG||{}),yG=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(yG||{});var bG=(s=>(s.ReportUploaded="report_uploaded",s.NoReport="no_report",s.Cancelled="cancelled",s.RecipeUploaded="recipe_uploaded",s))(bG||{}),ont=(r=>(r.Running="running",r.Ended="ended",r))(ont||{}),EG=(o=>(o.TimedOut="timed_out",o.AgentFailed="agent_failed",o.SetupFailed="setup_failed",o.CredentialMissing="credential_missing",o.RunnerLost="runner_lost",o.CheckoutFailed="checkout_failed",o))(EG||{}),gme=(n=>(n.Onboard="onboard",n.Deploy="deploy",n.Recheck="recheck",n))(gme||{}),Ame=(r=>(r.Started="started",r.Finished="finished",r))(Ame||{}),yme=(n=>(n.Passed="passed",n.Failed="failed",n.Skipped="skipped",n))(yme||{}),bme=(o=>(o.Log="log",o.Component="component",o.Reply="reply",o.Question="question",o.Delivered="delivered",o.Credentials="credentials",o))(bme||{}),wG=(n=>(n.ChooseCredential="choose_credential",n.FreeText="free_text",n.ChooseSource="choose_source",n))(wG||{});var Ov=(n=>(n.Discover="discover",n.Start="start",n.Check="check",n))(Ov||{}),v_=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(v_||{}),Gu=b.string().regex(/^[1-9][0-9]{0,18}$/),Mv=b.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),Hl=b.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),la=b.string().regex(/^[0-9a-f]{64}$/),hG=b.object({id:Hl,revision:Gu}).strict(),Dc=b.object({provider:b.nativeEnum(I_),providerAccountId:Gu,providerRepositoryId:Gu}).strict(),E_=t=>`${t.provider}:${t.providerRepositoryId}`,ant=Dc.extend({namespace:b.string().min(1),name:b.string().min(1)}).strict(),Krt=b.object({ref:b.string().min(1),revision:Mv}).strict(),zar=b.object({repository:ant,revision:Mv,ref:b.string().nullable(),reason:b.nativeEnum(hme),change:b.object({kind:b.nativeEnum(AG),number:Gu,base:Krt.optional()}).strict().nullable(),compareWith:Krt.optional()}).strict();function Gar(t){let e=t.baseline.sources,r=t.trigger.kind==="schedule"&&t.baseline.confirmedRunId!==null;if(!e)return r?"names every source of the snapshot, once":null;if(t.baseline.confirmedRunId===null)return"a run with no Confirmed Baseline names no baseline sources";let n=new Set(t.sources.map(o=>E_(o.repository))),s=new Set(e.map(o=>E_(o.repository)));return s.size===e.length&&s.size===n.size&&[...s].every(o=>n.has(o))?null:"names every source of the snapshot, once"}var cnt=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,lnt=/^[1-9][0-9]{0,18}$/,Xrt=new RegExp(`${cnt.source}|${lnt.source}`),Zrt=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,jar=b.union([b.object({source:b.literal("jira"),site:b.string().regex(Zrt),key:b.string().regex(cnt),updated:b.string().datetime(),contentHash:la}).strict(),b.object({source:b.literal("confluence"),site:b.string().regex(Zrt),key:b.string().regex(lnt),version:b.number().int().positive(),contentHash:la}).strict(),b.object({source:b.literal("other"),key:b.string().regex(f_),contentHash:la}).strict(),b.object({source:b.literal("other"),key:b.string().regex(Pw),contentHash:la,fileName:b.string().min(1).max(255),mediaType:b.nativeEnum(Tv)}).strict()]),ent=b.union([b.literal("jira"),b.literal("confluence")]),unt=b.object({schemaVersion:b.literal(1),items:b.array(b.union([b.object({source:ent,site:b.string(),key:b.string().regex(Xrt),state:b.literal("read"),text:b.string(),version:b.string().min(1),contentMatches:b.boolean()}).strict(),b.object({source:ent,site:b.string(),key:b.string().regex(Xrt),state:b.literal("not_read"),reason:b.nativeEnum(Bw)}).strict(),b.object({source:b.literal("other"),key:b.string().regex(f_),state:b.literal("read"),text:b.string(),version:b.string().min(1),contentMatches:b.boolean()}).strict(),b.object({source:b.literal("other"),key:b.string().regex(f_),state:b.literal("not_read"),reason:b.nativeEnum(Bw)}).strict(),b.object({source:b.literal("other"),key:b.string().regex(Pw),state:b.literal("read"),version:la,fileName:b.string().min(1).max(255),mediaType:b.nativeEnum(Tv)}).strict(),b.object({source:b.literal("other"),key:b.string().regex(Pw),state:b.literal("not_read"),reason:b.nativeEnum(Bw)}).strict()])),instructions:b.array(b.string()).optional()}).strict(),Var=b.object({schemaVersion:b.literal(1),runId:Hl,skyrampOrgId:Hl,target:hG,policy:hG.nullable(),trigger:b.object({kind:b.nativeEnum(gG),requestedAt:b.string().datetime()}).strict(),configuration:b.object({captureId:Hl,revision:Gu.nullable(),hash:la}).strict(),baseline:b.object({confirmedRunId:Hl.nullable(),sources:b.array(b.object({repository:Dc,revision:Mv}).strict()).optional()}).strict(),sources:b.array(zar).min(1),execution:b.object({provider:b.nativeEnum(I_),repository:ant,workflowPath:b.string(),ref:b.string()}).strict(),credentials:b.array(b.object({name:b.string(),purpose:b.nativeEnum(yG),required:b.boolean()}).strict()),requirements:b.array(jar).min(1).optional(),instructions:b.object({contentHash:la}).strict().optional()}).strict().superRefine((t,e)=>{let r=new Set;(t.requirements??[]).forEach((o,a)=>{let c="fileName"in o?"file":"pasted";o.source==="other"&&o.key!==`${c}-${o.contentHash.slice(0,16)}`&&e.addIssue({code:b.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",a,"key"]});let l=_c({source:o.source,key:o.key});r.has(l)&&e.addIssue({code:b.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",a,"key"]}),r.add(l)});let n=t.trigger.kind,s=$ar.includes(n);s!==(t.policy===null)&&e.addIssue({code:b.ZodIssueCode.custom,path:["policy"],message:s?`a ${n} run has no policy`:"names the policy revision"});let i=Gar(t);i&&e.addIssue({code:b.ZodIssueCode.custom,path:["baseline","sources"],message:i}),qar.includes(n)&&t.sources.forEach((o,a)=>{o.reason!=="BASELINE"&&e.addIssue({code:b.ZodIssueCode.custom,path:["sources",a,"reason"],message:`a ${n} run selects only BASELINE sources`})}),t.sources.forEach((o,a)=>{o.compareWith&&(o.reason!=="MANUAL_OVERRIDE"||o.change)&&e.addIssue({code:b.ZodIssueCode.custom,path:["sources",a,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"})})});var Eme=(r=>(r.Person="person",r.Policy="policy",r))(Eme||{}),War=b.object({kind:b.nativeEnum(Eme),name:b.string().min(1).max(256)}).strict(),Yar=b.object({schemaVersion:b.literal(1),attempt:b.object({id:Hl,number:b.number().int().positive(),deadlineAt:b.string().datetime()}).strict(),manifest:Var,manifestHash:la,entitlements:b.array(b.string()).optional(),runToken:b.string().min(1).optional(),requestedBy:War.nullable().optional(),writeAllowed:b.boolean().optional(),claudeCodeVersion:b.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional()}).strict(),Jar=b.object({schemaVersion:b.literal(1),runId:Hl,execution:b.object({provider:b.nativeEnum(I_),repository:Dc,providerRunId:Gu,providerRunAttempt:b.number().int().positive(),workflowRef:b.string().min(1)}).strict(),requester:b.literal(!0).optional(),writeCheck:b.literal(!0).optional(),claudeCodePin:b.literal(!0).optional()}).strict(),tnt=b.object({repository:Dc,number:Gu}).strict(),Kar=b.discriminatedUnion("status",[b.object({status:b.literal("none")}).strict(),b.object({status:b.literal("delivered"),pullRequests:b.array(tnt).min(1)}).strict(),b.object({status:b.literal("partial"),pullRequests:b.array(tnt).min(1),failures:b.array(b.object({repository:Dc,message:b.string()}).strict()).min(1)}).strict(),b.object({status:b.literal("failed"),message:b.string()}).strict()]),Xar=b.object({sufficiency:b.nativeEnum(h_),rationale:b.string().min(1),gaps:b.array(b.string().min(1)),acceptedEvidence:b.array(b.object({kind:b.nativeEnum(VA),repository:b.string().min(1),revision:Mv,reference:b.string().min(1),summary:b.string().min(1)}).strict()),actionRequired:b.array(b.nativeEnum(g_))}).strict().superRefine((t,e)=>{t.sufficiency==="sufficient"!=(t.gaps.length===0)&&e.addIssue({code:b.ZodIssueCode.custom,path:["gaps"],message:"sufficient evidence has no gaps, and insufficient evidence names at least one"}),new Set(t.actionRequired).size!==t.actionRequired.length&&e.addIssue({code:b.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Dv=500,wme=2048,xme=1e3,Zar=b.object({testResults:b.array(b.object({resultId:b.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:b.string().regex(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/),testType:b.string(),endpoint:b.string(),status:b.enum(["Pass","Fail","Skipped"]),details:b.string(),fileName:b.string().optional(),testId:b.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:b.object({kind:b.nativeEnum(A_),family:b.nativeEnum(cG).optional()}).strict().optional()}).strict()),validation:Xar,changes:b.array(b.object({id:b.string().min(1).max(512),text:b.string().max(16384),source:b.string().max(wme),testedBy:b.array(b.string().min(1).max(1024)).max(Dv),writtenBy:b.array(b.string().min(1).max(1024)).max(Dv),maintainedBy:b.array(b.string().min(1).max(1024)).max(Dv)}).strict()).max(xme).optional(),traceVersion:b.literal(1)}).passthrough().superRefine((t,e)=>{let r=new Set;t.testResults.forEach((n,s)=>{let i=n.failureCause;i&&n.status==="Pass"&&e.addIssue({code:b.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"a passing result has no failure cause"}),i&&i.kind==="environment"!=(i.family!==void 0)&&e.addIssue({code:b.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"an environment cause names its family, and no other cause does"});let o=["testResults",s,"resultId"],a=n.resultId.slice(`${n.repository}:${n.testType}:`.length);(!n.resultId.startsWith(`${n.repository}:${n.testType}:`)||a===""||a.startsWith("/")||a.startsWith("#"))&&e.addIssue({code:b.ZodIssueCode.custom,path:o,message:"is not repository:testType:path for this result"}),r.has(n.resultId)&&e.addIssue({code:b.ZodIssueCode.custom,path:o,message:"stable identity repeated"}),r.add(n.resultId)})}),rnt=t=>t.replace(/[%:#]/g,e=>encodeURIComponent(e));function xG(t,e,r,n){let s=r.replace(/\\/g,"/"),i=s.split("/").filter(c=>c!==""&&c!==".");if(s.startsWith("/")||/^[A-Za-z]:/.test(s)||i.length===0||i.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${r}"`);let o=i.join("/"),a=`${t}:${e}:${rnt(o)}`;return n?`${a}#${rnt(n)}`:a}var Sme=50,nnt=b.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),Cme=b.discriminatedUnion("kind",[b.object({kind:b.literal("branch_pushed"),repository:Dc,branch:nnt,commit:Mv}).strict(),b.object({kind:b.enum(["pull_request_opened","pull_request_edited"]),repository:Dc,number:Gu,branch:nnt}).strict()]),dnt=b.object({schemaVersion:b.literal(1),run:b.object({runId:Hl,attemptNumber:b.number().int().positive(),manifestHash:la}).strict(),target:hG,policy:hG,provenance:b.object({sources:b.array(b.object({repository:Dc,revision:Mv}).strict())}).strict(),delivery:b.object({generatedTests:Kar}).strict(),producer:b.object({testbot:b.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:b.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:Zar,githubWrites:b.array(Cme).max(Sme).optional()}).strict(),ecr=dnt.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:mG}).strict().superRefine(({recipe:t},e)=>{let r=(i,o)=>e.addIssue({code:b.ZodIssueCode.custom,path:["recipe",...i],message:o});t.status==="blocked"&&t.blockers.length===0&&r(["blockers"],"a blocked recipe names at least one blocker");let n=new Set,s=0;t.files.forEach((i,o)=>{JA(i.path)||r(["files",o,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),n.has(i.path)&&r(["files",o,"path"],"file repeated"),n.add(i.path),pG.test(i.content)&&r(["files",o,"content"],"is not text");let a=Buffer.byteLength(i.content,"utf8");s+=a,a>_w&&r(["files",o,"content"],`larger than ${_w} bytes`)}),s>Dw&&r(["files"],`recipe text over ${Dw} bytes in total`)}),pnt=b.object({schemaVersion:b.literal(1),stage:b.nativeEnum(gme),event:b.nativeEnum(Ame),status:b.nativeEnum(yme).optional()}).strict().refine(t=>t.status===void 0||t.event==="finished",{path:["status"],message:"only a finished stage has a status"}),Qv=100,SG=5e3,fme=2e3,w_=100,CG=/^[A-Za-z0-9_-]{1,64}$/,Ime=20,vme=200,Rme=100,Nme=100,tcr=200,rcr=/^[^/\s]+\/[^/\s]+$/,Tme=500,kme=50,Bme=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,im=t=>b.string().max(t).refine(e=>e.trim().length>0&&!Bme.test(e),"blank, or not text"),_v={sequence:b.number().int().min(1).max(SG),at:b.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},Pme=b.discriminatedUnion("kind",[b.object({..._v,kind:b.literal("log"),phase:b.nativeEnum(Ov),text:im(fme)}).strict(),b.object({..._v,kind:b.literal("component"),name:im(w_),repository:im(tcr).refine(t=>rcr.test(t)||t===An,"not owner/name"),file:im(Tme).nullable(),status:b.nativeEnum(v_),version:im(Nme).optional()}).strict(),b.object({..._v,kind:b.literal("reply"),to:b.string().uuid(),accepted:b.boolean(),text:im(fme)}).strict(),b.object({..._v,kind:b.literal("question"),id:b.string().regex(CG),type:b.nativeEnum(wG),text:im(fme),component:im(w_).nullable(),choices:b.array(im(vme)).max(Ime),placeholder:im(Rme).optional()}).strict(),b.object({..._v,kind:b.literal("delivered"),ids:b.array(b.string().uuid()).max(Qv)}).strict(),b.object({..._v,kind:b.literal("credentials"),names:b.array(b.string().regex(WA)).min(1).max(kme)}).strict()]).superRefine((t,e)=>{t.kind==="credentials"&&new Set(t.names).size!==t.names.length&&e.addIssue({code:b.ZodIssueCode.custom,path:["names"],message:"a name twice"}),t.kind==="question"&&(t.type==="free_text"!=(t.choices.length===0)&&e.addIssue({code:b.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(t.choices).size!==t.choices.length&&e.addIssue({code:b.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),mnt=b.object({schemaVersion:b.literal(1),events:b.array(Pme).max(Qv)}).strict(),snt={id:b.string().uuid(),text:b.string(),by:b.string().nullable(),at:b.string()},ncr=b.discriminatedUnion("kind",[b.object({...snt,kind:b.literal("instruction"),question:b.null()}),b.object({...snt,kind:b.literal("answer"),question:b.string().regex(CG)})]),fnt=b.string().regex(/^[A-Za-z0-9+/]{43}=$/),hnt=b.object({schemaVersion:b.literal(1),leftOut:b.array(b.string()),messages:b.array(ncr).optional(),stop:b.object({key:fnt}).optional()}),R_=7,IG=500*1024*1024,gnt=b.object({id:Gu,name:b.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Gu,expiresAt:b.string().datetime()}).strict(),Ant=b.object({schemaVersion:b.literal(1),artifact:gnt,sessionId:Hl,contentHash:la,bytes:b.number().int().min(1).max(IG)}).strict(),ynt=b.object({schemaVersion:b.literal(1),checkpoint:b.object({artifact:gnt,repository:b.object({namespace:b.string().min(1),name:b.string().min(1)}).strict(),sessionId:Hl,contentHash:la,key:fnt}).strict().nullable()}).strict(),scr=200,fG=100,vG=(n=>(n.Resume="resume",n.Retry="retry",n.Update="update",n))(vG||{}),icr=b.object({kind:b.nativeEnum(vG),setup:b.object({runId:Hl,endedAt:b.string().nullable(),outcome:b.string().nullable()}).strict(),components:b.array(b.object({name:b.string().min(1),repository:b.string().min(1),status:b.nativeEnum(v_)}).strict()).max(fG),credentials:b.array(b.string().min(1)).max(fG),answers:b.array(b.object({question:b.string(),answer:b.string().nullable()}).strict()).max(fG),instructions:b.array(b.object({text:b.string(),reply:b.string().nullable()}).strict()).max(fG),log:b.array(b.object({phase:b.nativeEnum(Ov),text:b.string()}).strict()).max(scr)}).strict(),bnt=b.object({schemaVersion:b.literal(1),context:icr.nullable()}).strict(),Ent=b.object({schemaVersion:b.literal(1),configuration:b.object({captureId:Hl,revision:Gu.nullable(),hash:la}).strict(),capture:b.object({schemaVersion:b.literal(1),settings:b.object({target:b.object({environment:b.unknown()}).passthrough(),timeoutMinutes:b.number().int().positive(),answerWaitMinutes:b.number().int().positive().optional(),testEnvironment:b.object({name:b.string().min(1),address:b.string().min(1).optional(),readyWhen:b.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:b.object({}).passthrough(),hash:la}).strict()}).strict(),ocr=Bv.extend({version:b.number().int().positive(),components:b.array(b.object({name:b.string().min(1),repository:b.string().min(1)}).strict()),contentHash:la.optional(),files:b.array(b.object({path:b.string().refine(t=>JA(t)&&!Pv.includes(t),"not a file of a customer_deployed plan"),content:b.string()}).strict()).optional()}).strict(),wnt=b.object({schemaVersion:b.literal(1),testEnvironment:ocr.nullable().optional(),runtimePlan:b.object({version:b.number().int().positive(),contentHash:la,files:b.array(b.object({path:b.string().refine(JA,"not a recipe file path"),content:b.string()}).strict()).min(1),recipe:b.record(b.unknown()).optional()}).strict().nullable()}).strict().refine(t=>!(t.runtimePlan&&t.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),xnt=b.object({schemaVersion:b.literal(1),state:b.nativeEnum(ont),ending:b.nativeEnum(bG).nullable(),cause:b.nativeEnum(EG).nullable(),deadlineAt:b.string().datetime()}).strict();function _me(t,e){return t.state==="ended"?t.ending==="cancelled"?"cancelled":t.cause==="runner_lost"?"expired":"ended":e.getTime()>=Date.parse(t.deadlineAt)?"expired":null}function KA(t){if(typeof t=="number"&&!Number.isFinite(t))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(t))return`[${t.map(KA).join(",")}]`;if(t!==null&&typeof t=="object"){let r=t;return`{${Object.keys(r).sort().map(n=>`${JSON.stringify(n)}:${KA(r[n])}`).join(",")}}`}let e=JSON.stringify(t);if(e===void 0)throw new TypeError("Canonical JSON requires JSON values");return e}function Dme(t){return(0,C_.createHash)("sha256").update(KA(t),"utf8").digest("hex")}function Snt(t){let e=[...t].sort((r,n)=>r.path<n.path?-1:r.path>n.path?1:0).map(r=>({path:r.path,content:r.content}));return(0,C_.createHash)("sha256").update(KA(e),"utf8").digest("hex")}function Cnt(t){let e=(i,o)=>i<o?-1:i>o?1:0,r=[...t.files].sort((i,o)=>e(i.path,o.path)).map(i=>({path:i.path,content:i.content})),n={address:t.address,readyWhen:t.readyWhen,credentials:[...t.credentials].sort(e),revisionSources:t.revisionSources.map(i=>KA({method:i.method,detail:i.detail,components:[...i.components].sort(e)})).sort(e)},s=t.components.map(i=>KA({name:i.name,repository:i.repository})).sort(e);return(0,C_.createHash)("sha256").update(KA({type:"customer_deployed",environment:n,components:s,files:r}),"utf8").digest("hex")}function Int(t){return(0,C_.createHash)("sha256").update(KA({schemaVersion:t.schemaVersion,settings:t.settings,provenance:t.provenance}),"utf8").digest("hex")}var x_=t=>({provider:t.provider,providerAccountId:t.providerAccountId,providerRepositoryId:t.providerRepositoryId});function vnt(t,e){return Jar.parse({schemaVersion:1,runId:t,execution:e.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0})}function Rnt(t){let e=Yar.parse(t);if(Dme(e.manifest)!==e.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return e}function acr(t){let e=r=>r.map(n=>({repository:x_(n.repository),number:n.number}));return t.status==="delivered"?{status:t.status,pullRequests:e(t.pullRequests)}:t.status==="partial"?{status:t.status,pullRequests:e(t.pullRequests),failures:t.failures.map(r=>({repository:x_(r.repository),message:r.message}))}:t}function Nnt(t){return t.issues.map(e=>`${e.path.map((n,s)=>typeof n=="number"?`[${n}]`:s===0?n:`.${n}`).join("")}: ${e.message}`).join("; ")}function Tnt(t){let{manifest:e}=t;if(Har.includes(e.trigger.kind))throw new Error(`The report upload is invalid: a ${e.trigger.kind} run uploads its SUT recipe, never a report`);let r=dnt.safeParse({schemaVersion:1,run:{runId:e.runId,attemptNumber:t.attemptNumber,manifestHash:Dme(e)},target:{id:e.target.id,revision:e.target.revision},policy:e.policy&&{id:e.policy.id,revision:e.policy.revision},provenance:{sources:t.checkedOut.map(n=>({repository:x_(n.repository),revision:n.revision}))},delivery:{generatedTests:acr(t.generatedTests)},producer:t.producer,report:t.report,...t.githubWrites?.length?{githubWrites:t.githubWrites.map(n=>({...n,repository:x_(n.repository)}))}:{}});if(!r.success)throw new Error(`The report upload is invalid: ${Nnt(r.error)}`);return ccr(r.data,e),r.data}function knt(t,e,r,n,s){let i=ecr.safeParse({schemaVersion:1,run:{runId:t.runId,attemptNumber:e,manifestHash:Dme(t)},target:{id:t.target.id,revision:t.target.revision},provenance:{sources:r.map(o=>({repository:x_(o.repository),revision:o.revision}))},producer:s,recipe:n});if(!i.success)throw new Error(`The SUT recipe upload is invalid: ${Nnt(i.error)}`);return i.data}function ccr(t,e){let r=new Map(e.sources.map(n=>[`${n.repository.namespace}/${n.repository.name}`.toLowerCase(),n.revision]));t.report.validation.acceptedEvidence.forEach((n,s)=>{let i=`report.validation.acceptedEvidence[${s}]`,o=r.get(n.repository.toLowerCase());if(!o)throw new Error(`${i}.repository: ${n.repository} is outside the run's snapshot`);if(n.revision!==o)throw new Error(`${i}.revision: evidence is not from the frozen revision ${o}`)})}var lcr=3e4;function Bnt(t,e={}){let r=i=>{let o=t[i];if(!o)throw new Error(`${i} is not set; the V3 runner handshake needs it`);return o},n=t.GITHUB_REPOSITORY_ID,s=t.GITHUB_REPOSITORY;return{runnerPlatform:t.GITHUB_ACTIONS==="true"?"github":void 0,workspace:t.GITHUB_WORKSPACE||void 0,serverUrl:(t.GITHUB_SERVER_URL||"https://github.com").replace(/\/+$/,""),apiUrl:(t.GITHUB_API_URL||"https://api.github.com").replace(/\/+$/,""),repository:n&&s?{id:n,slug:s}:void 0,runId:t.GITHUB_RUN_ID||void 0,runAttempt:t.GITHUB_RUN_ATTEMPT||void 0,job:t.GITHUB_JOB||void 0,execution(){let i=r("GITHUB_RUN_ATTEMPT");if(!/^[1-9][0-9]*$/.test(i))throw new Error(`GITHUB_RUN_ATTEMPT is "${i}", not a positive whole number`);return{provider:"github",repository:{provider:"github",providerAccountId:r("GITHUB_REPOSITORY_OWNER_ID"),providerRepositoryId:r("GITHUB_REPOSITORY_ID")},providerRunId:r("GITHUB_RUN_ID"),providerRunAttempt:Number(i),workflowRef:r("GITHUB_WORKFLOW_REF")}},takeIdToken(){let i=t.ACTIONS_ID_TOKEN_REQUEST_URL,o=t.ACTIONS_ID_TOKEN_REQUEST_TOKEN;return delete t.ACTIONS_ID_TOKEN_REQUEST_URL,delete t.ACTIONS_ID_TOKEN_REQUEST_TOKEN,async a=>{if(!i||!o)throw new Error("The job cannot request an OIDC token. Give it the `id-token: write` permission.");let c=new URL(i);c.searchParams.set("audience",a);let l=await fetch(c,{headers:{Authorization:`Bearer ${o}`,Accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(lcr)});if(!l.ok)throw new Error(`GitHub refused the OIDC token request: ${l.status}`);let u=(await l.json().catch(()=>({}))).value;if(typeof u!="string"||!u)throw new Error("GitHub's OIDC token response carried no token");return Ot(u),u}},webIdentity(){return!t.ACTIONS_ID_TOKEN_REQUEST_TOKEN?.trim()||!t.ACTIONS_ID_TOKEN_REQUEST_URL?.trim()?void 0:{token:e.getIDToken??(o=>yRe(o)),runId:t.GITHUB_RUN_ID}}}}function Os(t=process.env){return Bnt(t)}Ke();var Ow=q(require("fs"));Ke();var RG=q(require("fs")),XA=q(require("path"));function N_(t){return t.match(/\.skyramp\/videos\/([^/]+)\//)?.[1]}function Ome(t){if(!RG.existsSync(t))return[];let e=[],r=n=>{let s;try{s=RG.readdirSync(n,{withFileTypes:!0})}catch(i){X(`Skipping unreadable video dir ${n}: ${i instanceof Error?i.message:String(i)}`);return}for(let i of s){let o=XA.join(n,i.name);i.isDirectory()?r(o):i.isFile()&&i.name.endsWith(".webm")&&e.push(o)}};return r(t),e}async function Pnt(t,e,r){let n={};if(r.size===0)return n;let s=XA.resolve(t),i=()=>[...r].flatMap(c=>{let l=XA.resolve(t,c);return l!==s&&!l.startsWith(s+XA.sep)?(X(`Skipping video subdir outside the videos tree: ${c}`),[]):Ome(XA.join(t,c))}),o=i();if(o.length===0&&(X(`Expected ${r.size} test video(s) but found none under ${t}; retrying collection once`),await NA(3),o=i()),o.length===0)return n;let a=new Map;for(let c of o){let l=N_(c);if(!l)continue;let u=a.get(l);u?u.push(c):a.set(l,[c])}for(let[c,l]of a)try{let u=await Mme(`skyramp-video-${c}`,l,t);u&&(n[c]=e.getArtifactUrl(u))}catch(u){X(`Failed to upload video artifact for ${c} after retry: ${u instanceof Error?u.message:String(u)}`)}return Ne(`Uploaded ${Object.keys(n).length} of ${a.size} test execution video artifact(s)`),n}async function Mme(t,e,r,n){let{DefaultArtifactClient:s}=await Promise.resolve().then(()=>(pI(),iB)),i=new s,{id:o}=await li(()=>i.uploadArtifact(t,e,r,n),{retries:2,delay:3,label:`Video artifact upload for ${t}`});return o}function ucr(t){return Ow.existsSync(t.summaryPath)?t.summaryPath:Ow.existsSync(t.agentStdoutPath)?(ee("Using agent stdout as fallback (agent did not write to summary file)"),t.agentStdoutPath):null}var Qme=t=>t.replace(/\s*[\r\n]+\s*/g," ").trim(),Lme=t=>typeof t=="number"&&Number.isInteger(t)&&t>=0?t:void 0;function dcr(t){if(typeof t!="object"||t===null)return;let e=t,r=Object.values(Ip).includes(e.verification)?e.verification:void 0,n=(Array.isArray(e.skipped)?e.skipped:[]).map(o=>typeof o=="object"&&o!==null?o:{}).filter(o=>typeof o.pageObject=="string"&&o.pageObject.trim()!=="").map(o=>({pageObject:Qme(o.pageObject),member:typeof o.member=="string"?Qme(o.member):void 0,declinedBy:Object.values(pA).includes(o.declinedBy)?o.declinedBy:void 0,reason:typeof o.reason=="string"?Qme(o.reason):""})),s={candidatesDetected:Lme(e.candidatesDetected),callsReused:Lme(e.callsReused),callsVerified:Lme(e.callsVerified),verification:r,skipped:n.length>0?n:void 0};return Object.values(s).some(o=>o!==void 0)?s:void 0}function pcr(t){let e=typeof t=="object"&&t!==null?t:{},{reuse:r,...n}=e,s=dcr(r);return s?{...n,reuse:s}:n}function mcr(t){try{let e=t.replace(/^```(?:json)?\s*\n?/m,"").replace(/\n?```\s*$/m,"").trim(),r=JSON.parse(e);if(typeof r.businessCaseAnalysis=="string"&&Array.isArray(r.testResults)){for(let n of["newTestsCreated","testMaintenance","issuesFound"])Array.isArray(r[n])||(r[n]=[]);return Array.isArray(r.nextSteps)||(r.nextSteps=[]),r.commitMessage!==void 0&&typeof r.commitMessage!="string"&&delete r.commitMessage,r.newTestsCreated=r.newTestsCreated.map(pcr),r.testResults=r.testResults.map(n=>{let s=typeof n=="object"&&n!==null?n:{},i={...s,testType:typeof s.testType=="string"?s.testType:"",endpoint:typeof s.endpoint=="string"?s.endpoint:"",status:typeof s.status=="string"?s.status:"",details:typeof s.details=="string"?s.details:""};for(let o of["repository","videoPath"])i[o]!==void 0&&typeof i[o]!="string"&&delete i[o];return i}),r}return null}catch{return null}}var _nt={high:0,medium:1,low:2},Dnt={security_boundary:0,breaking_change:1,data_integrity:2,business_rule:3,workflow:4};function Ont(t,e,r,n){let s=r[n(t.testType)]??99,i=r[n(e.testType)]??99;if(s!==i)return s-i;let o=_nt[(t.priority??"").toLowerCase()]??99,a=_nt[(e.priority??"").toLowerCase()]??99;if(o!==a)return o-a;let c=Dnt[t.category??""]??99,l=Dnt[e.category??""]??99;if(c!==l)return c-l;let u=(t.steps??[]).some(p=>(p.expectedStatusCode??0)>=400)?0:1,d=(e.steps??[]).some(p=>(p.expectedStatusCode??0)>=400)?0:1;return u!==d?u-d:(t.scenarioName??"").localeCompare(e.scenarioName??"")}function fcr(t){if(!t)return;let e=ne().reuse,{callsReused:r,callsVerified:n,candidatesDetected:s,verification:i}=t,o=[];r!==void 0&&n!==void 0?(o.push(r===n?e.reusedAndVerified(r):e.reusedThenVerified(r,n)),i===Ip.Passed&&r>n&&o.push(e.unresolved(r-n))):r!==void 0?o.push(e.reused(r)):n!==void 0&&o.push(e.verified(n)),s!==void 0&&o.push(e.candidates(s));let a=r!==void 0&&r===n;i===Ip.SkippedNoPom?o.push(e.noPomLayer):i===Ip.Passed&&!a?o.push(e.verificationPassed):i===Ip.Failed&&o.push(e.verificationFailed);let c=t.skipped??[];if(c.length>0){let l=d=>{let p=d.member||d.pageObject,f=[d.declinedBy?e.gate[d.declinedBy]:"",d.reason].filter(Boolean).join(" \u2014 ");return f?`${p} (${f})`:p},u=[...c].sort((d,p)=>+(p.declinedBy===pA.DemotedByVerify)-+(d.declinedBy===pA.DemotedByVerify));o.push(e.keptInline(u.map(l).join("; ")))}if(o.length!==0)return`${e.label}: ${o.join(" \xB7 ")}`}function Mnt(t){return(t.testMaintenance??[]).filter(e=>e.action!==mI.Ignore&&e.action!==mI.Verify)}function Mw(t,e={}){let r=ne(),{collapsed:n=!1,userPrompt:s,autoCommit:i=!1,audience:o,primaryRepo:a}=e,c=[],l=Y=>Y&&Y.toLowerCase()!==a?.toLowerCase()?Y:void 0,u=Y=>{let te=l(Y);return te?` \`[${te}]\``:""},d=t.newTestsCreated.some(Y=>l(Y.repository))||t.testResults.some(Y=>l(Y.repository))||t.issuesFound.some(Y=>l(Y.repository))||!!t.additionalRecommendations?.some(Y=>l(Y.repository)),p=o!=="testbot-pr",m=o!=="comment",f=o!=="testbot-pr",h=o!=="testbot-pr",A=o==="testbot-pr";c.push("<!-- skyramp-testbot -->");let E=Mnt(t),y=new Set([Oa.Lint,Oa.Type,Oa.Config]),w=Y=>Y.category!==void 0&&y.has(Y.category),C=t.issuesFound.filter(Y=>!w(Y)),v=t.issuesFound.filter(w),k={critical:0,high:1,medium:2,low:3},N=(Y,te)=>(k[Y.severity??""]??4)-(k[te.severity??""]??4),M=(Y,te)=>(Object.prototype.hasOwnProperty.call(Y,te)?Y[te]:void 0)??te,T=Y=>`- ${Y.severity?`**[${M(r.severityLabels,Y.severity).toUpperCase()}]** `:""}${Y.description}${u(Y.repository)}`;if(t.newTestsCreated.length===0&&t.testResults.length===0&&E.length===0&&t.issuesFound.length>0&&(!t.additionalRecommendations||t.additionalRecommendations.length===0)){c.push(r.minimalReportHeader),c.push("");for(let te of C)c.push(te.description);if(v.length>0){C.length>0&&c.push(""),c.push(`### ${r.configErrorsHeader}`);for(let te of[...v].sort(N))c.push(T(te))}let Y=t.caveats??[];if(Y.length>0){c.push(""),c.push(r.caveatsHeader),c.push("");for(let te of Y)c.push(`- ${te.text}`)}if(t.nextSteps?.length>0){c.push(""),c.push(r.nextStepsHeader),c.push("");for(let te of t.nextSteps)c.push(`- ${te}`)}return Fme(c.join(`
318
318
  `))}let U=Y=>Y.replace(/\|/g,"\\|").replace(/\n/g,"<br>");s&&(c.push(r.followingUserInstruction(s)),c.push(""));let J=Y=>{n?(c.push("<details>"),c.push(`<summary>${Y}</summary>`),c.push("")):c.push(`### ${Y}`)},z=()=>{n&&(c.push(""),c.push("</details>")),c.push("")};if(p){let Y=h?"> ":"";for(let te of t.businessCaseAnalysis.split(/\r?\n/))c.push(`${Y}${te}`);c.push("")}if(m&&t.newTestsCreated.length>0){let Y=r.testRecommendationsImplementedHeader(t.newTestsCreated.length);A?c.push(`### ${Y}`):J(Y);for(let te of t.newTestsCreated){let Ae=te.testId?`\`${te.testId}\``:te.testType,pe=te.endpoint?`
319
319
  \`${te.endpoint}\``:"",ye=te.description?`
320
320
  ${te.description}`:"",Je=te.fileName?` (\`${te.fileName}\`)`:"";c.push(`- ${Ae}${Je}${u(te.repository)}${pe}${ye}`)}A?c.push(""):z()}if(m&&t.additionalRecommendations&&t.additionalRecommendations.length>0){let Y=t.additionalRecommendations,te=Y.length,Ae={contract:0,integration:1,e2e:2,ui:3},pe=at=>at.toLowerCase(),ye=[...Y].sort((at,$e)=>Ont(at,$e,Ae,pe)),Je=new Map;for(let at of ye){let $e=pe(at.testType);Je.has($e)||Je.set($e,[]),Je.get($e).push(at)}J(r.additionalRecommendationsHeader(te)),c.push(r.additionalRecommendationsCta),c.push("");for(let[at,$e]of Je){let we=r.testTypeLabels[at]??at;c.push(`**${we}**`),c.push("");for(let Dt of $e){let Or=Dt.steps&&Dt.steps.length>0&&Dt.steps[0].method&&Dt.steps[0].path?`\`${Dt.steps[0].method} ${Dt.steps[0].path}\``:"",jt=`- ${Dt.testId?`\`${Dt.testId}\``:Dt.scenarioName?`\`${Dt.scenarioName}\``:`\`${Dt.testType} test\``}`,he=Or?`
@@ -554,7 +554,7 @@ ${s}`}var MD=require("child_process");var dx=q(require("fs")),rd=q(require("path
554
554
  `)}function bhr(t,e,r){let n=r.map(i=>i.details??"").join(`
555
555
  `),s=[];return/over the 400 cap/.test(n)&&s.push("The length caps are the ONLY thing wrong with those findings \u2014 keep each one, keep its id, and trim the named field. Do not drop a finding to get under a cap."),/changed file|changedFiles/.test(n)&&s.push('diff.changedFiles must be paths git reports. A glob is accepted for a run of near-identical files (`dir/<star>/x.json`), but it must match them and any "(N files)" count must be right \u2014 so list them plainly if you are unsure.'),/is not in requirements\[\]/.test(n)&&s.push("Every satisfies/conflictsWith id must be one you declared in requirements[] \u2014 check the spelling, don't invent one."),/nothing satisfies or conflictsWith it/.test(n)&&s.push("Every requirements[] entry needs a link: add its id to a behavior's satisfies when the diff implements it correctly, or to a finding's conflictsWith when the diff doesn't (or implements something else)."),s.length?s.join(`
556
556
  `):void 0}var $lt=bn({name:"analyze",requires:["preflight"],model:"opus",timeoutMinutes:20,validateInput:phr,prepare:Ult,buildPrompt:yhr,allowedTools:["Read","Grep","Glob","Bash(git diff:*)","Bash(git log:*)","Bash(git show:*)","Bash(git blame:*)","Bash(git status:*)"],selfVerification:['Every finding is behavior a test could catch, and one this change causes \u2014 a pre-existing defect is "latent".',"No two behaviors state the same obligation: if ONE test would pin both, they are one entry. Spend the room on a surface nothing describes yet.","You swept every changed file, not only the biggest one \u2014 a file with a single behavior beside one with a dozen is a sweep that stopped early.","Your final message is one JSON object matching the schema."],buildReadDirs:t=>(t.inputs.relatedRepos??[]).map(e=>e.path),exitGates:[vlt,Rlt],retryHint:bhr,adversarialReview:Tlt,onPassed:(t,e)=>({...Nlt(t,e),diff:Yhe}),salvage:(t,e)=>Llt(t,e,{diff:Yhe})});var Gut=q(require("fs")),fx=q(require("path")),jut=require("child_process");var QD=["browser_assert","browser_assert_api_request","browser_assert_hidden","browser_assert_table_cell","browser_blueprint","browser_click","browser_drag","browser_evaluate","browser_file_upload","browser_gojs_add_node","browser_gojs_link","browser_hover","browser_mouse_action","browser_navigate","browser_navigate_back","browser_press_key","browser_select_option","browser_snapshot","browser_tabs","browser_take_screenshot","browser_type","browser_visual_snapshot","browser_wait_for"],Ehr=[...QD,"skyramp_export_zip","skyramp_actions","skyramp_analyze_changes","skyramp_analyze_test_health","skyramp_batch_mock_generation","skyramp_batch_scenario_test_generation","skyramp_contract_test_generation","skyramp_e2e_test_generation","skyramp_enhance_assertions","skyramp_enrich_test_with_mocks","skyramp_execute_test","skyramp_fix_errors","skyramp_fuzz_test_generation","skyramp_generate_enriched_integration_test","skyramp_init_scan","skyramp_init_workspace","skyramp_integration_test_generation","skyramp_load_test_generation","skyramp_login","skyramp_logout","skyramp_mock_generation","skyramp_modularization","skyramp_one_click_tool","skyramp_preflight_mock_check","skyramp_query_proxy_mocks","skyramp_recommend_tests","skyramp_register_test_plan","skyramp_reuse_code","skyramp_run_existing_tests","skyramp_setup_local_dev_worker","skyramp_smoke_test_generation","skyramp_start_trace_collection","skyramp_stop_trace_collection","skyramp_submit_report","skyramp_ui_test_generation"],Jhe=["skyramp_init_workspace","skyramp_contract_test_generation","skyramp_integration_test_generation","skyramp_mock_generation","skyramp_fix_errors"],Khe=["skyramp_init_workspace","skyramp_ui_test_generation","skyramp_mock_generation","skyramp_fix_errors","skyramp_start_trace_collection","skyramp_stop_trace_collection","skyramp_export_zip",...QD],Xhe=["skyramp_reuse_code","skyramp_modularization","skyramp_enhance_assertions","skyramp_fix_errors","skyramp_execute_test","skyramp_run_existing_tests"],Zhe=["skyramp_init_scan","skyramp_init_workspace"],dV=["Bash(ls:*)","Bash(cat:*)","Bash(head:*)","Bash(tail:*)","Bash(wc:*)","Bash(find:*)","Bash(grep:*)","Bash(rg:*)","Bash(diff:*)","Bash(sort:*)","Bash(env:*)","Bash(echo:*)","Bash(pwd:*)","Bash(which:*)","Bash(cp:*)","Bash(curl:*)","Bash(jq:*)","Bash(true:*)"],whr=t=>`mcp__${yR}__${t}`;function Nm(t){let e=new Set(t);return Ehr.filter(r=>!e.has(r)).map(whr).sort()}var LD=q(require("fs")),nd=q(require("path")),QR=nd.join(".skyramp","sut"),qlt=nd.join(".skyramp","workspace.yml");function xhr(t){return t.startsWith(`${QR}${nd.sep}`)||t.startsWith(".skyramp/sut/")||t===qlt||t===".skyramp/workspace.yml"||/(^|\/)(docker-compose|compose)[^/]*\.ya?ml$/.test(t)||/(^|\/)Dockerfile[^/]*$/.test(t)||/^\.github\/workflows\//.test(t)}function Wa(t,e,r={}){let n=e.split(/[\\/]+/).filter(Boolean),s=t;for(let[i,o]of n.entries()){s=nd.join(s,o);let a=LD.lstatSync(s,{throwIfNoEntry:!1}),c=i===n.length-1;if(!a||a.isSymbolicLink()||(c?r.directory?!a.isDirectory():!a.isFile():!a.isDirectory()))return}return n.length?s:void 0}function Vc(t,e=[]){let r=p=>Wa(t,p),n=r(nd.join(QR,"setup.sh")),s=r(nd.join(QR,"teardown.sh")),i=r(nd.join(QR,"get-auth-token.sh")),o=r(qlt),a,c=r(nd.join(QR,"health.json"));if(c)try{let p=JSON.parse(LD.readFileSync(c,"utf-8"));p&&(p.url||p.command)&&(a=p)}catch{}let l,u=r(nd.join(QR,"deploy-budget.json"));if(u)try{let p=JSON.parse(LD.readFileSync(u,"utf-8"));typeof p?.minutes=="number"&&Number.isFinite(p.minutes)&&p.minutes>0&&(l=p.minutes)}catch{}let d=e.filter(xhr);return{setupScript:n,teardownScript:s,authTokenScript:i,workspaceFile:o,healthHint:a,budgetMinutes:l,present:!!(n||o),staleFiles:d,stale:d.length>0}}var Shr=50,Chr=50,Ihr=4096,vhr=8e3,Rhr=2048,ege=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/,Nhr=/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))[A-Za-z0-9._/ -]{1,255}$/,Thr=/^\.github\/workflows\/[A-Za-z0-9._-]+\.ya?ml$/,khr=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,zlt=(i=>(i.Command="command",i.ComposeFile="compose_file",i.DeploymentWorkflow="deployment_workflow",i.Url="url",i.Guidance="guidance",i))(zlt||{}),Bhr={command:"optional",compose_file:"required",deployment_workflow:"required",url:"none",guidance:"none"},Hlt=t=>b.string().max(t).refine(e=>e.trim().length>0&&!ege.test(e),"must be non-blank text with no control characters other than tab, LF and CR");function Phr(t){let e;try{e=new URL(t)}catch{return"invalid URL"}if(e.protocol!=="https:"&&e.protocol!=="http:")return"only http and https URLs";if(e.username||e.password)return"a URL cannot carry a login"}var _hr={command:Hlt(Ihr),compose_file:b.string().regex(Nhr,"must be a relative path inside the repository"),deployment_workflow:b.string().regex(Thr,"must be a .github/workflows/*.yml path"),url:b.string().max(Rhr).superRefine((t,e)=>{let r=Phr(t);r&&e.addIssue({code:b.ZodIssueCode.custom,message:r})}),guidance:Hlt(vhr)},Dhr=b.object({kind:b.nativeEnum(zlt),value:b.string(),repository:Dc.nullable()}).strict().superRefine((t,e)=>{let r=Bhr[t.kind];r==="required"&&!t.repository&&e.addIssue({code:b.ZodIssueCode.custom,path:["repository"],message:"a file belongs to a repository"}),r==="none"&&t.repository&&e.addIssue({code:b.ZodIssueCode.custom,path:["repository"],message:`a ${t.kind} names no repository`});let n=_hr[t.kind].safeParse(t.value);if(!n.success)for(let s of n.error.issues)e.addIssue({code:b.ZodIssueCode.custom,path:["value"],message:s.message})}),Ohr=b.object({name:b.string().regex(khr,"must be a GitHub Actions secret name (A-Z, 0-9, _; not GITHUB_ or SKYRAMP_RUNNER_)"),purpose:b.nativeEnum(yG),required:b.boolean()}).strict(),Mhr=b.object({knowledge:b.array(Dhr).max(Shr),credentials:b.array(Ohr).max(Chr)}).strict().superRefine((t,e)=>{let r=new Set;t.credentials.forEach((n,s)=>{r.has(n.name)&&e.addIssue({code:b.ZodIssueCode.custom,path:["credentials",s,"name"],message:"named twice"}),r.add(n.name)})});function Qhr(t){return t.map(e=>`$${e.path.map(r=>typeof r=="number"?`[${r}]`:`.${r}`).join("")}: ${e.message}`).join("; ")}function tge(t,e="SUT environment"){let r=Mhr.safeParse(t);if(!r.success)throw new Error(`${e} is not valid SUT / Environment settings \u2014 ${Qhr(r.error.issues)}`);return r.data}function Glt(t,e="SUT environment"){if(!t.trim())return;let r;try{r=JSON.parse(t)}catch(n){throw new Error(`${e} is not JSON: ${n instanceof Error?n.message:String(n)}`)}return tge(r,e)}function pV(t,e=process.env){return(t?.credentials??[]).map(r=>e[r.name]).filter(r=>!!r?.trim())}var Lhr={command:"command",compose_file:"compose file",deployment_workflow:"deployment workflow",url:"URL",guidance:"guidance"},Fhr={model_provider:"model provider",sut_access:"SUT access",skyramp:"Skyramp",other:"other"};function jlt(t,e){let r=t.knowledge.map(n=>{let s=n.repository,i=s?` in ${e(s)??`the Target repository with ${s.provider} id ${s.providerRepositoryId}`}`:"";return`- ${Lhr[n.kind]}${i}: ${n.value.trim().split(/\r?\n/).join(`
557
- `)}`});if(t.credentials.length>0){let n=t.credentials.map(s=>`${s.name} (${Fhr[s.purpose]}${s.required?"":", optional"})`);r.push(`- Secrets the workflow provides as environment variables: ${n.join(", ")} \u2014 the recipe reads each by exactly that variable name.`)}return r}var LR=q(require("fs")),fV=q(require("path"));function rge(t,e){let{value:r,error:n}=Yr(t);if(n)return{errors:[n]};let s=e&&!e.testEnvironment?Uhr(r,e):r,i=jv(s)&&s.schemaVersion===void 0?{schemaVersion:1,...s}:s,{value:o,errors:a}=Vv(y_,ame,i);return o?{onboard:o,errors:[]}:{errors:a}}function Uhr(t,e){if(!jv(t))return t;let{environment:r,...n}=t,s=[...e.repositorySlug?[{slug:e.repositorySlug,path:e.repositoryPath}]:[],...(e.relatedRepos??[]).map(a=>({slug:a.slug,path:a.path}))],i=a=>typeof a=="string"?s.find(c=>Wa(c.path,a))?.slug:void 0,o=Array.isArray(n.components)?n.components.map(a=>{if(!jv(a))return a;let{deployed:c,...l}=a;if(l.repository!==An)return l;let u=jv(l.from)?l.from.file:void 0,d=i(u)??s[0]?.slug;return d?{...l,repository:d}:l}):n.components;return{...n,components:o}}var mV=".skyramp/sut/health.json",$hr={[mV]:`${mV} (with a url or command)`,".skyramp/workspace.yml":".skyramp/workspace.yml (create it with skyramp_init_scan and skyramp_init_workspace)"};function Vlt(){return{name:"onboard-recipe",verify(t,e){let{onboard:r,errors:n}=rge(e.stdout,t.inputs);if(!r)return ve(this.name,n,{fatal:!0});let s=r.environment!==void 0;if(r.status==="blocked")return{name:this.name,passed:!0};let i=t.inputs.repositoryPath,o=Vc(i),a=s?Pv.filter(u=>Wa(i,u)):[];if(a.length>0)return ve(this.name,[`an answer with "environment" tests a deployment where it runs and never starts or stops it: delete ${a.join(" and ")}, keep the health check, and answer "ready" again`]);let l=(s?dme:ume).filter(u=>!Wa(i,u)).map(u=>$hr[u]??u);return Wa(i,mV)&&!o.healthHint&&l.push(`${mV} (with a url or command)`),o.present&&l.length===0?{name:this.name,passed:!0}:ve(this.name,[`status is "ready" but the recipe deploy replays is incomplete in ${t.inputs.repositoryPath} \u2014 missing (each must be a regular file, not a symlink): ${l.join(", ")}. Write the missing files as the skill specifies and answer "ready" again, or answer "blocked" with the blocker that stopped you.`])}}}function Wlt(t,e,r=process.env){let n=[...t.components.flatMap(s=>s.credentials??[]),...t.environment?.credentials??[]];return[...new Set(n)].filter(s=>e.includes(s)&&!r[s])}function Ylt(t,e){let r=t.components.filter(s=>s.credentials?.some(i=>e.includes(i))).map(s=>s.name),n=e.join(", ");return{component:(r.length>0?r:t.components.map(s=>s.name)).join(", ")||"SUT",problem:`${n} ${e.length===1?"has":"have"} no value in this setup`,evidence:`The workflow supplies ${e.length===1?"it":"each"} from a GitHub Actions secret, which is missing or empty.`,fix:`Set that secret in the workflow host's repository, or choose the secret that supplies ${e.length===1?"it":"each"} under Credentials, then run setup again.`}}function Jlt(){return{name:"deployed-revisions",async verify(t,e,r,n){let s={name:this.name,passed:!0},i=t.checkDeployedRevisions;if(!i)return s;let{onboard:o}=rge(e.stdout,t.inputs);if(!o?.environment||o.status==="blocked")return s;let a=Yw(FD(t.inputs.repositoryPath).recipeFiles);if(!a)return s;let c=o.components.map(({name:d,repository:p})=>({name:d,repository:p})),{blockers:l}=await i(a.content,c,o.environment.credentials);if(l.length===0)return s;let u=l.map(d=>`${d.component}: ${d.problem} (${d.evidence})`).join("; ");return n?.retryLeft?ve(this.name,[`Testbot ran ${Ha} twice, with GH_TOKEN, and it failed the check the setup's plan must pass: ${u}. Your session has no GH_TOKEN, so the part that reads GitHub ran in full only there. Fix the script so each component a repository builds gets the full commit it runs, the same on each run, from its own repository, then answer "ready" again, or answer "blocked" with the blocker that stops you.`]):{...s,details:`${Ha} still fails Testbot's check, so the plan is saved blocked: ${u}`}}}}function qhr(t){try{return new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(t)}catch{return}}function FD(t){let e=[],r=o=>{let a;try{a=LR.readdirSync(fV.join(t,o),{withFileTypes:!0})}catch{return}for(let c of a.sort((l,u)=>l.name.localeCompare(u.name))){let l=fV.posix.join(o,c.name);c.isDirectory()&&!c.name.startsWith(".")?r(l):c.isFile()&&e.push(l)}};Wa(t,".skyramp/sut",{directory:!0})&&r(".skyramp/sut"),Wa(t,".skyramp/workspace.yml")&&e.push(".skyramp/workspace.yml");let n=[],s=[],i=0;for(let o of e){let a=Wa(t,o);if(!a)continue;let l=LR.statSync(a).size;if(l>_w){s.push({path:o,reason:`larger than ${_w} bytes`});continue}if(i+l>Dw){s.push({path:o,reason:`recipe text over ${Dw} bytes in total`});continue}let u=qhr(LR.readFileSync(a));if(u===void 0||pG.test(u)){s.push({path:o,reason:"not text"});continue}n.push({path:o,content:u}),i+=l}return{recipeFiles:n,recipeFilesOmitted:s}}function Klt(t,e){let{onboard:r,errors:n}=rge(e.stdout,t.inputs),s=r&&{...r,...FD(t.inputs.repositoryPath)};return tr(t,"onboard",Xr(s,t.secretValues??[]),n)}function hV(t){if(t.state.stages.onboard?.status==="passed")return ae(t,"onboard.json")}var As=q(require("fs")),Tm=q(require("path"));var iut=require("child_process"),out=require("crypto"),co=q(require("fs")),sd=q(require("path"));var Xlt=q(require("fs")),Ay=q(require("path"));var nge={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"},Zlt=t=>nge[t].toLowerCase(),ha=t=>new Map((t??[]).flatMap(e=>e.file?[[Ua(e.key),e.file.name]]:[])),eut=10*1024*1024,px=t=>t?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||t?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",tut=(t,e)=>Ay.join(Ay.dirname(t),`${Ay.basename(t,Ay.extname(t))}${e}`),mx=t=>tut(t,".extracted.txt");function sge(t){try{return/\S/.test(Xlt.readFileSync(mx(t),"utf-8"))}catch{return!1}}var ige=t=>tut(t,".quotes.txt");function rut(t){return px(t.file)?mx(t.path):t.file?.mediaType==="application/pdf"?ige(t.path):t.path}function gV(t){return t.map(e=>e.state!=="read"||!px(e.file)||sge(e.path)?e:{...jA(e),file:e.file,state:"not_read",reason:"cannot_open"})}var Hhr=10*6e4;function aut(t,e){return t.getTime()-e.getTime()-Hhr}var nut="This attempt revoked its scoped GitHub credentials; it mints no more.",zhr=5e3,Ghr=10*6e4,cge=3e4,jhr=3,Vhr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function lge(t=Os()){return t.apiUrl}var ao=class extends Error{constructor(r,n,s){super(r);this.status=n;this.code=s}status;code},FR=class extends Error{};function uge(t){let e;try{e=new URL(t)}catch{throw new Error(`skyrampAppOrigin "${t}" is not a URL`)}if(e.protocol!=="https:"||e.origin!==t.replace(/\/+$/,""))throw new Error(`skyrampAppOrigin must be an https origin, got "${t}"`);return e.origin}function Whr(t,e){if(!Vhr.test(t))throw new Error(`The ${e} "${t}" is not a uuid`);return t}function dge(t,e){return`${t.replace(/\/+$/,"")}/runs/${e}`}function cut(t,e,r){throw e<500&&e!==429?new ao(t,e,r):new FR(t)}async function lut(t,e,r,n){let s=uge(t.origin),i;for(let o=1;o<=jhr;o+=1){o>1&&await new Promise(a=>setTimeout(a,(t.retryDelayMs??2e3)*(o-1)));try{let a=await t.idToken(s),c=await(t.fetch??fetch)(new URL(e,s).toString(),{...r(a),redirect:"error",signal:AbortSignal.timeout(cge)}).catch(l=>{throw new FR(l instanceof Error?l.message:String(l),{cause:l})});return await n(c)}catch(a){if(a instanceof ao)throw a;i=a}}throw i}function uut(t,e,r,n){return lut(t,r,i=>({method:e,headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json",Accept:"application/json"},body:e==="GET"?void 0:JSON.stringify(n)}),async i=>{let o=await i.json().catch(()=>({}));if(i.ok)return o.data;let a=o.error?.fields,c=typeof a?.path=="string"&&typeof a.reason=="string"?` at ${a.path}: ${a.reason}`:"",l=`The Skyramp app refused ${e} ${r}: ${i.status} ${o.error?.code??"no error code"}${c}`;return cut(l,i.status,o.error?.code)})}function Yhr(t,e,r){return lut(t,e,s=>({method:"GET",headers:{Authorization:`Bearer ${s}`,Accept:"application/octet-stream"}}),async s=>{if(!s.ok)return cut(`The Skyramp app refused GET ${e}: ${s.status}`,s.status);let i=Buffer.from(await s.arrayBuffer());if(i.length>r)throw new ao(`The Skyramp app answered GET ${e} with more than ${r} bytes`,s.status);return i})}var oge=class{constructor(e,r,n,s,i,o,a,c){this.attemptId=e;this.attemptNumber=r;this.deadlineAt=n;this.manifest=s;this.deps=i;this.license=o;this.requestedBy=a;this.writeAllowed=c}attemptId;attemptNumber;deadlineAt;manifest;deps;license;requestedBy;writeAllowed;budgetMs(e){return aut(this.deadlineAt,e)}get skyrampRunUrl(){return dge(uge(this.deps.origin),this.manifest.runId)}send(e,r,n){return uut(this.deps,e,r,n)}readBytes(e,r){return Yhr(this.deps,e,r)}issuedTokens=[];closure;modelKey;credentials;revocation;async token(){if(this.revocation)throw new Error(nut);let e=(this.deps.now??(()=>new Date))().getTime(),r=this.credentials,n=r&&await r.catch(()=>{});if(this.credentials!==r)return(await this.credentials).token;if(n&&n.expiresAt-e>=Ghr)return n.token;if(this.revocation)throw new Error(nut);let s=this.send("POST",`/api/v1/runner/attempts/${this.attemptId}/credentials`,{schemaVersion:1}).then(i=>{this.issuedTokens.push(i.token),this.deps.mask?.(i.token),!n&&i.anthropicApiKey&&(this.modelKey=i.anthropicApiKey,this.deps.mask?.(i.anthropicApiKey));let o=n?"Renewed":"Received";return this.deps.log?.(`${o} scoped GitHub credentials; they expire at ${i.expiresAt}.`),{token:i.token,expiresAt:new Date(i.expiresAt).getTime()}},i=>{if(!(i instanceof ao)||i.code!=="CREDENTIALS_UNAVAILABLE")throw i;let o=l=>[...new Set(l.map(u=>u.namespace))].join(", "),a=this.manifest.sources.map(l=>l.repository);if(new Set(a.map(l=>l.providerAccountId)).size>1)throw new ao(`${i.message}. The run's repositories are on more than one GitHub account (${o(a)}), which Skyramp does not support yet.`,i.status,i.code);let c=o([...a,this.manifest.execution.repository]);throw new ao(`${i.message}. Check the Skyramp GitHub App installation on ${c}: it must be installed and not suspended, have access to these repositories, and have accepted the App's current permissions. Each account must also be connected to your Skyramp organization.`,i.status,i.code)});return this.credentials=s,(await s).token}githubFetch(e){return e.fetch??this.deps.fetch??fetch}revokeTokens(e={}){return this.revocation??=this.revokeIssued(e),this.revocation}async revokeIssued(e){let r=[...this.issuedTokens],n=Promise.all(r.map(o=>this.revokeOne(o,e)));await this.credentials?.catch(()=>{});let s=this.issuedTokens.filter(o=>!r.includes(o));return[...await n,...await Promise.all(s.map(o=>this.revokeOne(o,e)))].filter(o=>o!==void 0)}async revokeOne(e,r){try{let n=await this.githubFetch(r)(`${lge(r.host)}/installation/token`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/vnd.github+json"},redirect:"error",signal:AbortSignal.timeout(zhr)});if(!n.ok&&n.status!==401)throw new Error(`GitHub answered ${n.status}`);return}catch(n){return`token ${this.issuedTokens.indexOf(e)+1} of ${this.issuedTokens.length}: ${n instanceof Error?n.message:String(n)}`}}};async function dut(t,e,r){Whr(t,"run id"),uge(r.origin);let n=vnt(t,e),s=Rnt(await uut(r,"POST",`/api/v1/runner/runs/${t}/attempts`,n));if(s.manifest.runId!==t)throw new Error(`The app answered the handshake of run ${t} with the manifest of another run (${s.manifest.runId})`);let i=s.manifest.sources.find(a=>a.repository.provider!==n.execution.provider);if(i)throw new Error(`The manifest of run ${t} names ${i.repository.namespace}/${i.repository.name} on ${i.repository.provider}, but this job runs on ${n.execution.provider}`);s.runToken&&r.mask?.(s.runToken);let o=s.runToken?{entitlements:s.entitlements??[],runToken:s.runToken}:void 0;return new oge(s.attempt.id,s.attempt.number,new Date(s.attempt.deadlineAt),s.manifest,r,o,s.requestedBy??void 0,s.writeAllowed)}var Jhr=6e4;async function put(t){return xnt.parse(await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/heartbeat`,{schemaVersion:1}))}async function mut(t,e=()=>new Date){if(t.closure)return t.closure;let r=await put(t).then(n=>_me(n,e())).catch(()=>null);return r&&(t.closure=r),r}function fut(t,e,r={}){let n=!1,s,i=async()=>{try{let a=_me(await put(t),(r.now??(()=>new Date))());a&&!n&&(n=!0,t.closure=a,e(a))}catch(a){a instanceof ao&&(n=!0)}n||o(r.intervalMs??Jhr)},o=a=>{s=setTimeout(()=>{i()},a),s.unref?.()};return o(0),{stop(){n=!0,clearTimeout(s)}}}var Khr=10*6e4,Xhr=(t,e,r)=>(0,iut.execFileSync)("git",e,{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","pipe"],env:r??process.env,timeout:Khr}).trim(),pge=/^(?!\.\.?$)[A-Za-z0-9._-]{1,100}$/,Zhr=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE"];function egr(t,e=Os()){return`${e.serverUrl}/${t.namespace}/${t.name}.git`}async function hut(t,e){let r=e.git??Xhr,n=e.cloneUrl??(a=>egr(a,e.host)),{sources:s}=t.manifest;for(let a of s){if(Zhr.includes(a.reason)&&!a.change?.base)throw new Error(`${a.repository.namespace}/${a.repository.name} was selected as ${a.reason}, but its change names no base revision to compare it with`);if(a.change?.kind==="pull_request"&&!a.change.base)throw new Error(`${a.repository.namespace}/${a.repository.name} pull request ${a.change.number} names no base revision to compare it with`);for(let c of[a.repository.namespace,a.repository.name])if(!pge.test(c))throw new Error(`"${c}" is not a repository name`)}if(co.existsSync(e.workspace)&&co.lstatSync(e.workspace).isSymbolicLink())throw new Error(`The sources workspace ${e.workspace} is a symlink; refusing to clear it`);co.rmSync(e.workspace,{recursive:!0,force:!0});let i=new Map((t.manifest.baseline.sources??[]).map(a=>[E_(a.repository),a.revision])),o=[];for(let a of s){let{namespace:c,name:l}=a.repository,u=sd.join(e.workspace,c,l);co.mkdirSync(u,{recursive:!0});let d={...process.env,GIT_TERMINAL_PROMPT:"0",...Zme(await t.token())};r(u,["init","-q"]),r(u,["remote","add","origin",n(a.repository)]);let p=a.change?.base??a.compareWith,m=i.get(E_(a.repository)),f=p?.revision??(m!==a.revision?m:void 0);r(u,["fetch","-q","--no-tags","origin",a.revision,...f?[f]:[]],d);let h=p??(a.ref?{ref:a.ref,revision:m??a.revision}:null);h&&(r(u,["update-ref",`refs/remotes/origin/${h.ref}`,h.revision]),r(u,["symbolic-ref","refs/remotes/origin/HEAD",`refs/remotes/origin/${h.ref}`])),a.ref?r(u,["checkout","-q","-B",a.ref,a.revision]):r(u,["checkout","-q","--detach",a.revision]),o.push({repository:a.repository,revision:r(u,["rev-parse","HEAD"]),path:u,slug:`${c}/${l}`})}return o}async function gut(t,e={}){let r=lge(e.host),n=[];for(let s of t.manifest.sources){if(s.change?.kind!=="pull_request")continue;let{namespace:i,name:o}=s.repository,a=`${i}/${o}`,c=s.change.number;try{if(![i,o].every(d=>pge.test(d)))throw new Error("the repository name is not valid");let l=await t.githubFetch(e)(`${r}/repos/${i}/${o}/pulls/${c}`,{headers:{Authorization:`Bearer ${await t.token()}`,Accept:"application/vnd.github+json"},redirect:"error",signal:AbortSignal.timeout(cge)});if(!l.ok)throw new Error(`GitHub answered ${l.status}`);let u=await l.json();n.push({repository:a,number:c,...typeof u.title=="string"?{title:u.title}:{},...typeof u.body=="string"?{body:u.body}:{},...typeof u.merged=="boolean"?{merged:u.merged}:{},...u.merged===!0&&typeof u.merge_commit_sha=="string"?{mergeCommit:u.merge_commit_sha}:{},...u.merged===!0&&typeof u.head?.sha=="string"?{mergedHead:u.head.sha}:{}})}catch(l){let u=l instanceof Error?l.message:String(l);n.push({repository:a,number:c,note:`could not be read: ${u}`})}}return n}async function Aut(t,e,r,n={}){let[s,i,...o]=e.split("/");if(o.length||![s,i].every(a=>a!==void 0&&pge.test(a)))return"unknown";try{let a=await t.githubFetch(n)(`${lge(n.host)}/repos/${s}/${i}/commits/${encodeURIComponent(r)}`,{headers:{Authorization:`Bearer ${await t.token()}`,Accept:"application/vnd.github+json"},redirect:"error",signal:AbortSignal.timeout(cge)});if(a.status===404||a.status===422)return"missing";if(!a.ok)return"unknown";let c=await a.json();return typeof c.sha=="string"&&c.sha.toLowerCase()===r.toLowerCase()?"found":"missing"}catch{return"unknown"}}function yut(t,e){let r=t.sources.find(s=>s.reason==="TRIGGER"&&s.change?.kind==="pull_request"),n=r&&e.find(s=>s.repository.providerRepositoryId===r.repository.providerRepositoryId);return n&&r.change?{repository:n.slug,path:n.path,number:Number(r.change.number)}:void 0}var tgr=[".skyramp/sut/setup.sh",".skyramp/workspace.yml"];function but(t){let e=t.find(r=>tgr.some(n=>co.existsSync(sd.join(r.path,n))))??t[0];return{repositoryPath:e.path,repositorySlug:e.slug,relatedRepos:t.filter(r=>r!==e).map(r=>({slug:r.slug,path:r.path,writable:!0}))}}var rgr=b.object({tests:b.object({placements:b.array(b.unknown()).optional()}).passthrough().optional()}).passthrough(),ngr=b.object({repository:Dc.passthrough(),testType:b.nativeEnum(qw),directory:b.string()}).passthrough();function Eut(t,e){let r=rgr.safeParse(t.settings.target??{}),n=[];for(let s of(r.success?r.data.tests?.placements:void 0)??[]){let i=ngr.safeParse(s);if(!i.success)continue;let{repository:o,testType:a}=i.data,c=e.find(d=>d.repository.provider===o.provider&&d.repository.providerRepositoryId===o.providerRepositoryId),l=i.data.directory.trim(),u=!l||sd.isAbsolute(l)||l.split(/[\\/]/).includes("..");!c||u||n.push({repository:c.slug,testType:a,directory:l})}return n}var sgr=b.object({report:b.object({language:b.string()}).passthrough()}).passthrough();function mge(t){let e=sgr.safeParse(t?.settings.target);return e.success?gq(e.data.report.language):"en"}var igr=b.object({environment:b.object({components:b.array(b.unknown()).optional(),dependencies:b.array(b.unknown()).optional()}).passthrough()}).passthrough(),ogr=b.object({name:b.string().min(1),provision:b.literal("existing"),url:b.string().min(1),repository:Dc.passthrough().optional(),revisionUrl:b.string().min(1).optional()}).passthrough(),agr=b.object({name:b.string().min(1),url:b.string().nullable(),versionUrl:b.string().nullable(),notes:b.string().nullable()}).passthrough();function wut(t,e){let r=igr.safeParse(t.settings.target),n=r.success?r.data.environment:{},s=(n.components??[]).flatMap(a=>{let c=ogr.safeParse(a);if(!c.success)return[];let{name:l,url:u,repository:d,revisionUrl:p}=c.data;if(!d)return[{name:l,url:u}];let m=e.sources.find(f=>f.repository.provider===d.provider&&f.repository.providerRepositoryId===d.providerRepositoryId);return m?[{name:l,url:u,repository:`${m.repository.namespace}/${m.repository.name}`,expectedRevision:m.revision,...p?{revisionUrl:p}:{}}]:[{name:l,url:u,repository:`${d.provider} repository ${d.providerRepositoryId}`}]}),i=(n.dependencies??[]).flatMap(a=>{let c=agr.safeParse(a);return c.success?[{name:c.data.name,url:c.data.url,versionUrl:c.data.versionUrl,notes:c.data.notes}]:[]});if(s.length===0&&i.length===0)return;let o=b.object({allowSharedEnvironmentMutation:b.boolean()}).passthrough().safeParse(t.settings.policy);return{components:s,dependencies:i,allowMutation:o.success&&o.data.allowSharedEnvironmentMutation}}var cgr=new Set(["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"]);function sut(t,e){if(!cgr.has(t.reason))return{};let r=`${t.repository.namespace}/${t.repository.name}`,n=t.change?.kind==="pull_request"?t.change.number:void 0,s=n===void 0?void 0:e.find(a=>rj(a.repository,r)&&a.number===n),i=s?.merged===!0?s.mergeCommit:void 0,o=i&&s?.mergedHead?{mergedHead:s.mergedHead}:{};return{touched:!0,acceptedRevisions:{frozen:t.revision,...i&&i!==t.revision?{mergeCommit:i,...o}:{}}}}function xut(t,e,r,n,s){let i=u=>r.sources.find(d=>rj(`${d.repository.namespace}/${d.repository.name}`,u)),o=(t?.components??[]).map(u=>{let d=u.expectedRevision?i(u.repository):void 0;return d?{...u,...sut(d,s)}:u}),a=Yw(e.files)!==void 0,c=e.components.map(u=>{if(u.repository===An)return{name:u.name,url:e.address};let d=i(u.repository),p=a?void 0:Sfe(e,u.name);return{name:u.name,url:e.address,repository:u.repository,...d?{expectedRevision:d.revision}:{},...p?{revisionUrl:p}:{},...a?{revisionScript:!0}:{},...d?sut(d,s):{}}}),l=b.object({allowSharedEnvironmentMutation:b.boolean()}).passthrough().safeParse(n?.settings.policy);return{components:[...o,...c],dependencies:t?.dependencies??[],allowMutation:t?.allowMutation??(l.success&&l.data.allowSharedEnvironmentMutation)}}function Sut(t){let e=r=>t.testResults.filter(n=>n.status===r).length;return{passed:e("Pass"),failed:e("Fail"),skipped:e("Skipped")}}function lgr(t){let{passed:e,failed:r,skipped:n}=Sut(t);return e+r===0?{sufficiency:"insufficient",rationale:n>0?`Every test was skipped (${n}), so nothing was validated.`:"No test ran, so nothing was validated.",gaps:["No test ran against the frozen sources."],acceptedEvidence:[],actionRequired:[]}:{sufficiency:"sufficient",rationale:`${e+r} tests ran against the frozen sources: ${e} passed, ${r} failed${n?`, ${n} skipped`:""}.`,gaps:[],acceptedEvidence:[],actionRequired:[]}}function ugr(t,e){let r=t.testResults.map(c=>({result:c,repository:c.repository??e,path:c.fileName||c.testType})),n=new Map;for(let c of r){let l=`${c.repository}:${c.result.testType}:${c.path}`;n.set(l,(n.get(l)??0)+1)}let s=r.map(({result:c,repository:l,path:u})=>{let d=(n.get(`${l}:${c.testType}:${u}`)??0)>1;return c.resultId??xG(l,c.testType,u,d&&c.endpoint||void 0)}),i=new Map;for(let c of s)i.set(c,(i.get(c)??0)+1);let o=new Set(s.filter(c=>i.get(c)===1)),a=r.map(({result:c,repository:l},u)=>{let d=s[u],p=d;if(i.get(d)>1&&o.has(d))for(let m=2;o.has(p)||p===d;m+=1)p=d.includes("#")?`${d}.${m}`:`${d}#${m}`;return o.add(p),{...c,repository:l,resultId:p}});return{...t,testResults:a,...dgr(t,a,e),validation:pgr(t,t.validation??lgr(t)),traceVersion:1}}function dgr(t,e,r){if(!t.testExecutionContexts)return{};let n=new Set,s=a=>{let c=a;for(let l=2;n.has(c);l+=1)c=`${a}#${l}`;return n.add(c),c},i=[],o=new Map;for(let{repository:a,...c}of t.testExecutionContexts){let l=c.status==="not_run"?[]:e.filter(u=>u.fileName===c.test&&u.repository===(a?.trim()||r));l.length||i.push(c);for(let{resultId:u}of l){let d=o.get(u),p=d!==void 0&&i[d].cleanup.status==="failed"?i[d].cleanup:c.cleanup,m={...c,cleanup:p,test:u,resultId:u};d===void 0?o.set(u,i.push(m)-1):i[d]=m}}for(let a of i)a.resultId&&n.add(a.resultId);return{testExecutionContexts:i.map(a=>a.resultId?a:{...a,test:s(a.test.slice(0,512))}).slice(0,5e3)}}function pgr(t,e){let{passed:r,failed:n}=Sut(t);return e.sufficiency!=="sufficient"||r+n>0||e.acceptedEvidence.length>0?e:{...e,sufficiency:"insufficient",gaps:["No test ran and no existing evidence was accepted, so nothing was validated."]}}async function Cut(t,e){let r=ju([...t.issuedTokens,...e.secrets??[]]),n=Tnt({manifest:t.manifest,attemptNumber:t.attemptNumber,checkedOut:e.sources.map(s=>({repository:s.repository,revision:s.revision})),generatedTests:Xr(e.delivery,r),producer:e.producer,report:Xr(ugr(e.report,e.workingSlug),r),githubWrites:e.githubWrites});await t.send("PUT",`/api/v1/runner/attempts/${t.attemptId}/report`,n)}async function fge(t){let e=Ent.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/configuration`,void 0)),r=t.manifest.configuration,{configuration:n,capture:s}=e;if(n.captureId!==r.captureId||n.revision!==r.revision||n.hash!==r.hash||s.hash!==r.hash||Int(s)!==r.hash)throw new Error("The app answered the configuration of another capture than the manifest names");return e}var age=class extends Error{};async function AV(t){let{runtimePlan:e,testEnvironment:r}=wnt.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/runtime-plan`,void 0));if(e&&Snt(e.files)!==e.contentHash)throw new age(`Stored SUT recipe version ${e.version} does not match its hash`);return{runtimePlan:e,testEnvironment:r??null}}async function Iut(t,e,r=()=>{}){try{co.rmSync(e,{recursive:!0,force:!0})}catch{}let n=t.manifest.requirements??[];if(n.length===0&&!t.manifest.instructions)return{items:[],instructions:[]};let s,i=[];try{let a=unt.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/requirements`,void 0));s=new Map(a.items.map(c=>[_c(c),c])),i=t.manifest.instructions?a.instructions??[]:[]}catch(a){let c=a instanceof Error?a.message:String(a);r(`Testbot V3: could not read the run's requirement items: ${c}`),s=new Map}try{co.mkdirSync(e,{recursive:!0,mode:448})}catch{}let o=[];for(let a of n){let c={...jA(a),..."fileName"in a?{file:{name:a.fileName,mediaType:a.mediaType}}:{}},l=s.get(_c(c));if(!l)o.push({...c,state:"not_read",reason:Pw.test(c.key)?"cannot_open":"unavailable"});else if(l.state==="not_read")o.push({...c,state:"not_read",reason:l.reason});else if(!("text"in l))o.push(await mgr(t,e,c,a.contentHash,r));else{let u=sd.join(e,vut(c));try{co.writeFileSync(u,l.text,{mode:384}),o.push({...c,state:"read",path:u,contentMatches:l.contentMatches,version:l.version})}catch(d){r(`Testbot V3: could not write the requirement item ${c.key}: ${d instanceof Error?d.message:String(d)}`),o.push({...c,state:"not_read",reason:"unavailable"})}}}return{items:o,instructions:i}}async function mgr(t,e,r,n,s){let i=c=>(s(`Testbot V3: could not open the uploaded document ${r.key}: ${c}`),{...r,state:"not_read",reason:"cannot_open"});if(!r.file)return i("the manifest names no file");let o;try{let c=int.requirementFile.replace(":attemptId",t.attemptId).replace(":key",r.key);o=await t.readBytes(c,eut)}catch(c){return i(c instanceof Error?c.message:String(c))}if((0,out.createHash)("sha256").update(o).digest("hex")!==n)return i("its bytes do not match its hash");let a=sd.join(e,vut(r));try{co.writeFileSync(a,o,{mode:384})}catch(c){return i(c instanceof Error?c.message:String(c))}return{...r,state:"read",path:a,contentMatches:!0,version:n}}function vut(t){let e=t.source==="other"?[]:[new URL(t.site).hostname],r=t.file?Zlt(t.file.mediaType):"txt";return`${[t.source,...e,t.key].join("-")}.${r}`}async function hge(t,e){await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/progress`,pnt.parse(e))}async function Rut(t,e){return hnt.parse(await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/setup-events`,mnt.parse(e)))}async function Nut(t,e){await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/setup-checkpoint`,Ant.parse(e))}async function Tut(t){return(await But(t,"setup-checkpoint",ynt))?.checkpoint??null}async function kut(t){return(await But(t,"setup-context",bnt))?.context??null}async function But(t,e,r){try{return r.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/${e}`,void 0))}catch(n){if(n instanceof ao&&n.status===404)return null;throw n}}async function gge(t,e){let r=ju([...t.issuedTokens,...e.secrets??[]]),n=knt(t.manifest,t.attemptNumber,e.sources.map(s=>({repository:s.repository,revision:s.revision})),Xr(e.recipe,r),e.producer);await t.send("PUT",`/api/v1/runner/attempts/${t.attemptId}/sut-recipe`,n)}function Put(t,e,r,n=e[0].slug,s,i={}){let{record:o,entries:a}=Dut(t,e,n),c=td({outputsDir:t,state:sV(sd.join(sd.dirname(t),"state.json"))});if(!o&&ij(i,r.system,c?.sutRequired).length>0)return{status:"none"};let l=f=>_ut(e,f),u=[],d=[];for(let{record:f,repository:h,number:A}of a)if(h&&A)u.push({repository:h,number:A});else if(h&&f.prFailure){let E=f.prDetail?`${f.prFailure}: ${f.prDetail}`:f.prFailure;d.push({repository:h,message:E,slug:f.repository??n})}else h&&f.committed&&d.push({repository:h,message:f.reason??"The tests were committed but no pull request was opened.",slug:f.repository??n});let p=new Set([...u,...d].map(({repository:f})=>f.providerRepositoryId)),m=[...new Set(r.newTestsCreated.map(f=>(f.repository??n).toLowerCase()))];for(let f of m){let h=l(f);h&&!p.has(h.providerRepositoryId)&&d.push({repository:h,message:s??"Generated tests were not proposed in a pull request.",slug:f})}return u.length&&d.length?{status:"partial",pullRequests:u,failures:d.map(({repository:f,message:h})=>({repository:f,message:h}))}:u.length?{status:"delivered",pullRequests:u}:d.length?{status:"failed",message:o?.deliveries?d.map(f=>`${f.slug}: ${f.message}`).join("; "):d[0].message}:r.newTestsCreated.length>0?{status:"failed",message:s??"Generated tests were not proposed in a pull request."}:{status:"none"}}function _ut(t,e){let r=t.find(n=>n.slug.toLowerCase()===e.toLowerCase());return r&&{provider:r.repository.provider,providerAccountId:r.repository.providerAccountId,providerRepositoryId:r.repository.providerRepositoryId}}function Dut(t,e,r){let n=sd.join(t,"deliver.json"),s=co.existsSync(n)?JSON.parse(co.readFileSync(n,"utf-8")):void 0,i=s?.deliveries??(s?[s]:[]);return{record:s,entries:i.map(o=>({record:o,repository:_ut(e,o.repository??r),number:/\/pull\/([1-9][0-9]*)$/.exec(o.prUrl??"")?.[1]}))}}function Out(t,e,r=e[0].slug){let n=new Map,s=(i,o)=>{Cme.safeParse(i).success&&n.set(`${i.kind}:${i.repository.providerRepositoryId}:${o}`,i)};for(let{record:i,repository:o,number:a}of Dut(t,e,r).entries){if(!o||!i.branch)continue;let c=i.pushedCommits??(i.pushed&&i.commitSha?[i.commitSha]:[]);for(let u of c)s({kind:"branch_pushed",repository:o,branch:i.branch,commit:u},`${i.branch}:${u}`);if(!a)continue;let l=i.prAction==="retargeted"?i.retargetedAs??"created":i.prAction;l==="created"?s({kind:"pull_request_opened",repository:o,number:a,branch:i.branch},a):(l==="updated"||l==="unchanged")&&s({kind:"pull_request_edited",repository:o,number:a,branch:i.branch},a)}return[...n.values()].slice(0,Sme)}function Mut(t,e){return t.credentials.filter(r=>r.required&&!e[r.name]).map(r=>r.name)}var Age=[/\bgh[pousr]_[A-Za-z0-9]{36,}/g,/\bgithub_pat_[A-Za-z0-9_]{22,}/g,/\bsk-ant-[A-Za-z0-9_-]{20,}/g,/\bsk-[A-Za-z0-9]{32,}/g,/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g],Qut=t=>Age.some(e=>new RegExp(e.source).test(t));var Ph=".skyramp/setup-events.ndjson",UD=".skyramp/setup-left-out.json",$D=".skyramp/setup-inbox.json",yge=".skyramp/setup-inbox-read.json",wV=".skyramp/setup-hook-ran",fgr=6e4,hgr=5e3,ggr=300,Zs=t=>{let e=typeof t=="string"?t:typeof t=="number"?String(t):"";return e.trim()==="null"?"":e},yV=t=>Array.isArray(t)?t:[],EV=(t,e)=>Object.values(t).find(r=>r===Zs(e).trim().toLowerCase()),Agr={running:"up",healthy:"up",ready:"up",started:"up",building:"starting",pending:"starting",installing:"starting",skipped:"out_of_scope",excluded:"out_of_scope","out-of-scope":"out_of_scope"},ygr=t=>EV(v_,t)??Agr[Zs(t).trim().toLowerCase()]??"found",Lut=t=>b.string().uuid().safeParse(t).success,bgr=t=>CG.test(t)?t:t.replace(/[^A-Za-z0-9_-]+/g,"-").slice(0,64).replace(/^-+|-+$/g,"")||"question",Egr=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,wgr=/github\.com[/:]([^/\s]+)\/([^/\s?#]+?)(?:\.git)?(?:[/?#]|$)/i;function xgr(t){if(t.kind!=="question"||t.placeholder===void 0)return t;let{placeholder:e,...r}=t;return r}var Fut=new RegExp(Bme.source,"g"),xV=class{constructor(e,r,n){this.checkout=e;this.send=r;this.opts=n}checkout;send;opts;offset=0;sequence=1;pending=[];started=!1;closed=!1;capped=!1;flushing=0;emptyRefused=!1;placeholderRefused=!1;unreadSince;saidHookSilent=!1;timer;queue=Promise.resolve();phase="discover";messageIds=new Set;stopHeard=!1;start(){if(!this.timer){if(!this.started){this.started=!0;let e=Tm.join(this.checkout,Ph);As.mkdirSync(Tm.dirname(e),{recursive:!0}),As.writeFileSync(e,"");for(let r of[UD,$D,yge,wV])As.rmSync(Tm.join(this.checkout,r),{force:!0})}this.timer=setInterval(()=>{this.flushing===0&&this.flush()},this.opts.intervalMs??hgr),this.timer.unref?.()}}async stop(){this.timer&&clearInterval(this.timer),this.timer=void 0,await this.flush()}flush(){return this.flushing+=1,this.queue=this.queue.then(()=>this.drain()).catch(e=>this.opts.warn(`Testbot V3: could not send setup events: ${bV(e)}`)).finally(()=>{this.flushing-=1}),this.queue}async drain(){if(!this.closed){if(this.collect(),this.pending.length===0&&!this.emptyRefused){await this.sendBatch([]);return}for(;this.pending.length>0&&!this.closed;){let e=this.pending.slice(0,Qv);if(await this.sendBatch(e)==="unanswered")return;this.pending.splice(0,e.length)}}}async sendBatch(e){this.placeholderRefused&&(e=e.map(xgr));let r;try{r=await this.send({schemaVersion:1,events:e})}catch(n){if(n instanceof ao&&n.code==="RUN_CLOSED")return this.closed=!0,this.pending=[],"done";if(n instanceof ao&&e.length===0)return this.emptyRefused=!0,"done";if(n instanceof ao){if(e.length>1){for(let i of e){if(this.closed)return"done";if(await this.sendBatch([i])==="unanswered")return"unanswered"}return"done"}if(e[0].kind==="question"&&e[0].placeholder!==void 0)return this.placeholderRefused=!0,this.sendBatch(e);let s=e[0].kind==="log"?void 0:Sgr(e[0]);return s?(this.opts.warn(`Testbot V3: the app refused setup event ${e[0].sequence}, so it is sent as a log line: ${n.message}`),this.sendBatch([{sequence:e[0].sequence,at:e[0].at,kind:"log",phase:this.phase,text:s}])):(this.opts.warn(`Testbot V3: the app refused setup event ${e[0].sequence}, so it is dropped: ${n.message}`),"done")}return n instanceof b.ZodError?(this.opts.warn(`Testbot V3: the app's answer to setup events was not understood: ${n.issues[0]?.message}`),"done"):(this.opts.warn(`Testbot V3: could not send setup events, trying again: ${bV(n)}`),"unanswered")}try{this.writeLeftOut(r.leftOut)}catch(n){this.opts.warn(`Testbot V3: could not write ${UD}: ${bV(n)}`)}try{this.writeInbox(r.messages??[])}catch(n){this.opts.warn(`Testbot V3: could not write ${$D}: ${bV(n)}`)}return r.stop&&!this.stopHeard&&(this.stopHeard=!0,this.opts.onStop?.(r.stop.key)),"done"}collect(){if(this.capped)return;let e=Tm.join(this.checkout,Ph),r;try{r=As.statSync(e).size}catch{return}if(r<this.offset&&(this.offset=0),r===this.offset)return;let n=Buffer.alloc(r-this.offset),s=As.openSync(e,"r");try{As.readSync(s,n,0,n.length,this.offset)}finally{As.closeSync(s)}let i=n.lastIndexOf(10);if(i<0)return;let o=n.subarray(0,i).toString("utf-8").split(`
557
+ `)}`});if(t.credentials.length>0){let n=t.credentials.map(s=>`${s.name} (${Fhr[s.purpose]}${s.required?"":", optional"})`);r.push(`- Secrets the workflow provides as environment variables: ${n.join(", ")} \u2014 the recipe reads each by exactly that variable name.`)}return r}var LR=q(require("fs")),fV=q(require("path"));function rge(t,e){let{value:r,error:n}=Yr(t);if(n)return{errors:[n]};let s=e&&!e.testEnvironment?Uhr(r,e):r,i=jv(s)&&s.schemaVersion===void 0?{schemaVersion:1,...s}:s,{value:o,errors:a}=Vv(y_,ame,i);return o?{onboard:o,errors:[]}:{errors:a}}function Uhr(t,e){if(!jv(t))return t;let{environment:r,...n}=t,s=[...e.repositorySlug?[{slug:e.repositorySlug,path:e.repositoryPath}]:[],...(e.relatedRepos??[]).map(a=>({slug:a.slug,path:a.path}))],i=a=>typeof a=="string"?s.find(c=>Wa(c.path,a))?.slug:void 0,o=Array.isArray(n.components)?n.components.map(a=>{if(!jv(a))return a;let{deployed:c,...l}=a;if(l.repository!==An)return l;let u=jv(l.from)?l.from.file:void 0,d=i(u)??s[0]?.slug;return d?{...l,repository:d}:l}):n.components;return{...n,components:o}}var mV=".skyramp/sut/health.json",$hr={[mV]:`${mV} (with a url or command)`,".skyramp/workspace.yml":".skyramp/workspace.yml (create it with skyramp_init_scan and skyramp_init_workspace)"};function Vlt(){return{name:"onboard-recipe",verify(t,e){let{onboard:r,errors:n}=rge(e.stdout,t.inputs);if(!r)return ve(this.name,n,{fatal:!0});let s=r.environment!==void 0;if(r.status==="blocked")return{name:this.name,passed:!0};let i=t.inputs.repositoryPath,o=Vc(i),a=s?Pv.filter(u=>Wa(i,u)):[];if(a.length>0)return ve(this.name,[`an answer with "environment" tests a deployment where it runs and never starts or stops it: delete ${a.join(" and ")}, keep the health check, and answer "ready" again`]);let l=(s?dme:ume).filter(u=>!Wa(i,u)).map(u=>$hr[u]??u);return Wa(i,mV)&&!o.healthHint&&l.push(`${mV} (with a url or command)`),o.present&&l.length===0?{name:this.name,passed:!0}:ve(this.name,[`status is "ready" but the recipe deploy replays is incomplete in ${t.inputs.repositoryPath} \u2014 missing (each must be a regular file, not a symlink): ${l.join(", ")}. Write the missing files as the skill specifies and answer "ready" again, or answer "blocked" with the blocker that stopped you.`])}}}function Wlt(t,e,r=process.env){let n=[...t.components.flatMap(s=>s.credentials??[]),...t.environment?.credentials??[]];return[...new Set(n)].filter(s=>e.includes(s)&&!r[s])}function Ylt(t,e){let r=t.components.filter(s=>s.credentials?.some(i=>e.includes(i))).map(s=>s.name),n=e.join(", ");return{component:(r.length>0?r:t.components.map(s=>s.name)).join(", ")||"SUT",problem:`${n} ${e.length===1?"has":"have"} no value in this setup`,evidence:`The workflow supplies ${e.length===1?"it":"each"} from a GitHub Actions secret, which is missing or empty.`,fix:`Set that secret in the workflow host's repository, or choose the secret that supplies ${e.length===1?"it":"each"} under Credentials, then run setup again.`}}function Jlt(){return{name:"deployed-revisions",async verify(t,e,r,n){let s={name:this.name,passed:!0},i=t.checkDeployedRevisions;if(!i)return s;let{onboard:o}=rge(e.stdout,t.inputs);if(!o?.environment||o.status==="blocked")return s;let a=Yw(FD(t.inputs.repositoryPath).recipeFiles);if(!a)return s;let c=o.components.map(({name:d,repository:p})=>({name:d,repository:p})),{blockers:l}=await i(a.content,c,o.environment.credentials);if(l.length===0)return s;let u=l.map(d=>`${d.component}: ${d.problem} (${d.evidence})`).join("; ");return n?.retryLeft?ve(this.name,[`Testbot ran ${Ha} twice, with GH_TOKEN, and it failed the check the setup's plan must pass: ${u}. Your session has no GH_TOKEN, so the part that reads GitHub ran in full only there. Fix the script so each component a repository builds gets the full commit it runs, the same on each run, from its own repository, then answer "ready" again, or answer "blocked" with the blocker that stops you.`]):{...s,details:`${Ha} still fails Testbot's check, so the plan is saved blocked: ${u}`}}}}function qhr(t){try{return new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(t)}catch{return}}function FD(t){let e=[],r=o=>{let a;try{a=LR.readdirSync(fV.join(t,o),{withFileTypes:!0})}catch{return}for(let c of a.sort((l,u)=>l.name.localeCompare(u.name))){let l=fV.posix.join(o,c.name);c.isDirectory()&&!c.name.startsWith(".")?r(l):c.isFile()&&e.push(l)}};Wa(t,".skyramp/sut",{directory:!0})&&r(".skyramp/sut"),Wa(t,".skyramp/workspace.yml")&&e.push(".skyramp/workspace.yml");let n=[],s=[],i=0;for(let o of e){let a=Wa(t,o);if(!a)continue;let l=LR.statSync(a).size;if(l>_w){s.push({path:o,reason:`larger than ${_w} bytes`});continue}if(i+l>Dw){s.push({path:o,reason:`recipe text over ${Dw} bytes in total`});continue}let u=qhr(LR.readFileSync(a));if(u===void 0||pG.test(u)){s.push({path:o,reason:"not text"});continue}n.push({path:o,content:u}),i+=l}return{recipeFiles:n,recipeFilesOmitted:s}}function Klt(t,e){let{onboard:r,errors:n}=rge(e.stdout,t.inputs),s=r&&{...r,...FD(t.inputs.repositoryPath)};return tr(t,"onboard",Xr(s,t.secretValues??[]),n)}function hV(t){if(t.state.stages.onboard?.status==="passed")return ae(t,"onboard.json")}var As=q(require("fs")),Tm=q(require("path"));var iut=require("child_process"),out=require("crypto"),co=q(require("fs")),sd=q(require("path"));var Xlt=q(require("fs")),Ay=q(require("path"));var nge={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"},Zlt=t=>nge[t].toLowerCase(),ha=t=>new Map((t??[]).flatMap(e=>e.file?[[Ua(e.key),e.file.name]]:[])),eut=10*1024*1024,px=t=>t?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||t?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",tut=(t,e)=>Ay.join(Ay.dirname(t),`${Ay.basename(t,Ay.extname(t))}${e}`),mx=t=>tut(t,".extracted.txt");function sge(t){try{return/\S/.test(Xlt.readFileSync(mx(t),"utf-8"))}catch{return!1}}var ige=t=>tut(t,".quotes.txt");function rut(t){return px(t.file)?mx(t.path):t.file?.mediaType==="application/pdf"?ige(t.path):t.path}function gV(t){return t.map(e=>e.state!=="read"||!px(e.file)||sge(e.path)?e:{...jA(e),file:e.file,state:"not_read",reason:"cannot_open"})}var Hhr=10*6e4;function aut(t,e){return t.getTime()-e.getTime()-Hhr}var nut="This attempt revoked its scoped GitHub credentials; it mints no more.",zhr=5e3,Ghr=10*6e4,cge=3e4,jhr=3,Vhr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function lge(t=Os()){return t.apiUrl}var ao=class extends Error{constructor(r,n,s){super(r);this.status=n;this.code=s}status;code},FR=class extends Error{};function uge(t){let e;try{e=new URL(t)}catch{throw new Error(`skyrampAppOrigin "${t}" is not a URL`)}if(e.protocol!=="https:"||e.origin!==t.replace(/\/+$/,""))throw new Error(`skyrampAppOrigin must be an https origin, got "${t}"`);return e.origin}function Whr(t,e){if(!Vhr.test(t))throw new Error(`The ${e} "${t}" is not a uuid`);return t}function dge(t,e){return`${t.replace(/\/+$/,"")}/runs/${e}`}function cut(t,e,r){throw e<500&&e!==429?new ao(t,e,r):new FR(t)}async function lut(t,e,r,n){let s=uge(t.origin),i;for(let o=1;o<=jhr;o+=1){o>1&&await new Promise(a=>setTimeout(a,(t.retryDelayMs??2e3)*(o-1)));try{let a=await t.idToken(s),c=await(t.fetch??fetch)(new URL(e,s).toString(),{...r(a),redirect:"error",signal:AbortSignal.timeout(cge)}).catch(l=>{throw new FR(l instanceof Error?l.message:String(l),{cause:l})});return await n(c)}catch(a){if(a instanceof ao)throw a;i=a}}throw i}function uut(t,e,r,n){return lut(t,r,i=>({method:e,headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json",Accept:"application/json"},body:e==="GET"?void 0:JSON.stringify(n)}),async i=>{let o=await i.json().catch(()=>({}));if(i.ok)return o.data;let a=o.error?.fields,c=typeof a?.path=="string"&&typeof a.reason=="string"?` at ${a.path}: ${a.reason}`:"",l=`The Skyramp app refused ${e} ${r}: ${i.status} ${o.error?.code??"no error code"}${c}`;return cut(l,i.status,o.error?.code)})}function Yhr(t,e,r){return lut(t,e,s=>({method:"GET",headers:{Authorization:`Bearer ${s}`,Accept:"application/octet-stream"}}),async s=>{if(!s.ok)return cut(`The Skyramp app refused GET ${e}: ${s.status}`,s.status);let i=Buffer.from(await s.arrayBuffer());if(i.length>r)throw new ao(`The Skyramp app answered GET ${e} with more than ${r} bytes`,s.status);return i})}var oge=class{constructor(e,r,n,s,i,o,a,c,l){this.attemptId=e;this.attemptNumber=r;this.deadlineAt=n;this.manifest=s;this.deps=i;this.license=o;this.requestedBy=a;this.writeAllowed=c;this.claudeCodeVersion=l}attemptId;attemptNumber;deadlineAt;manifest;deps;license;requestedBy;writeAllowed;claudeCodeVersion;budgetMs(e){return aut(this.deadlineAt,e)}get skyrampRunUrl(){return dge(uge(this.deps.origin),this.manifest.runId)}send(e,r,n){return uut(this.deps,e,r,n)}readBytes(e,r){return Yhr(this.deps,e,r)}issuedTokens=[];closure;modelKey;credentials;revocation;async token(){if(this.revocation)throw new Error(nut);let e=(this.deps.now??(()=>new Date))().getTime(),r=this.credentials,n=r&&await r.catch(()=>{});if(this.credentials!==r)return(await this.credentials).token;if(n&&n.expiresAt-e>=Ghr)return n.token;if(this.revocation)throw new Error(nut);let s=this.send("POST",`/api/v1/runner/attempts/${this.attemptId}/credentials`,{schemaVersion:1}).then(i=>{this.issuedTokens.push(i.token),this.deps.mask?.(i.token),!n&&i.anthropicApiKey&&(this.modelKey=i.anthropicApiKey,this.deps.mask?.(i.anthropicApiKey));let o=n?"Renewed":"Received";return this.deps.log?.(`${o} scoped GitHub credentials; they expire at ${i.expiresAt}.`),{token:i.token,expiresAt:new Date(i.expiresAt).getTime()}},i=>{if(!(i instanceof ao)||i.code!=="CREDENTIALS_UNAVAILABLE")throw i;let o=l=>[...new Set(l.map(u=>u.namespace))].join(", "),a=this.manifest.sources.map(l=>l.repository);if(new Set(a.map(l=>l.providerAccountId)).size>1)throw new ao(`${i.message}. The run's repositories are on more than one GitHub account (${o(a)}), which Skyramp does not support yet.`,i.status,i.code);let c=o([...a,this.manifest.execution.repository]);throw new ao(`${i.message}. Check the Skyramp GitHub App installation on ${c}: it must be installed and not suspended, have access to these repositories, and have accepted the App's current permissions. Each account must also be connected to your Skyramp organization.`,i.status,i.code)});return this.credentials=s,(await s).token}githubFetch(e){return e.fetch??this.deps.fetch??fetch}revokeTokens(e={}){return this.revocation??=this.revokeIssued(e),this.revocation}async revokeIssued(e){let r=[...this.issuedTokens],n=Promise.all(r.map(o=>this.revokeOne(o,e)));await this.credentials?.catch(()=>{});let s=this.issuedTokens.filter(o=>!r.includes(o));return[...await n,...await Promise.all(s.map(o=>this.revokeOne(o,e)))].filter(o=>o!==void 0)}async revokeOne(e,r){try{let n=await this.githubFetch(r)(`${lge(r.host)}/installation/token`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/vnd.github+json"},redirect:"error",signal:AbortSignal.timeout(zhr)});if(!n.ok&&n.status!==401)throw new Error(`GitHub answered ${n.status}`);return}catch(n){return`token ${this.issuedTokens.indexOf(e)+1} of ${this.issuedTokens.length}: ${n instanceof Error?n.message:String(n)}`}}};async function dut(t,e,r){Whr(t,"run id"),uge(r.origin);let n=vnt(t,e),s=Rnt(await uut(r,"POST",`/api/v1/runner/runs/${t}/attempts`,n));if(s.manifest.runId!==t)throw new Error(`The app answered the handshake of run ${t} with the manifest of another run (${s.manifest.runId})`);let i=s.manifest.sources.find(a=>a.repository.provider!==n.execution.provider);if(i)throw new Error(`The manifest of run ${t} names ${i.repository.namespace}/${i.repository.name} on ${i.repository.provider}, but this job runs on ${n.execution.provider}`);s.runToken&&r.mask?.(s.runToken);let o=s.runToken?{entitlements:s.entitlements??[],runToken:s.runToken}:void 0;return new oge(s.attempt.id,s.attempt.number,new Date(s.attempt.deadlineAt),s.manifest,r,o,s.requestedBy??void 0,s.writeAllowed,s.claudeCodeVersion??void 0)}var Jhr=6e4;async function put(t){return xnt.parse(await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/heartbeat`,{schemaVersion:1}))}async function mut(t,e=()=>new Date){if(t.closure)return t.closure;let r=await put(t).then(n=>_me(n,e())).catch(()=>null);return r&&(t.closure=r),r}function fut(t,e,r={}){let n=!1,s,i=async()=>{try{let a=_me(await put(t),(r.now??(()=>new Date))());a&&!n&&(n=!0,t.closure=a,e(a))}catch(a){a instanceof ao&&(n=!0)}n||o(r.intervalMs??Jhr)},o=a=>{s=setTimeout(()=>{i()},a),s.unref?.()};return o(0),{stop(){n=!0,clearTimeout(s)}}}var Khr=10*6e4,Xhr=(t,e,r)=>(0,iut.execFileSync)("git",e,{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","pipe"],env:r??process.env,timeout:Khr}).trim(),pge=/^(?!\.\.?$)[A-Za-z0-9._-]{1,100}$/,Zhr=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE"];function egr(t,e=Os()){return`${e.serverUrl}/${t.namespace}/${t.name}.git`}async function hut(t,e){let r=e.git??Xhr,n=e.cloneUrl??(a=>egr(a,e.host)),{sources:s}=t.manifest;for(let a of s){if(Zhr.includes(a.reason)&&!a.change?.base)throw new Error(`${a.repository.namespace}/${a.repository.name} was selected as ${a.reason}, but its change names no base revision to compare it with`);if(a.change?.kind==="pull_request"&&!a.change.base)throw new Error(`${a.repository.namespace}/${a.repository.name} pull request ${a.change.number} names no base revision to compare it with`);for(let c of[a.repository.namespace,a.repository.name])if(!pge.test(c))throw new Error(`"${c}" is not a repository name`)}if(co.existsSync(e.workspace)&&co.lstatSync(e.workspace).isSymbolicLink())throw new Error(`The sources workspace ${e.workspace} is a symlink; refusing to clear it`);co.rmSync(e.workspace,{recursive:!0,force:!0});let i=new Map((t.manifest.baseline.sources??[]).map(a=>[E_(a.repository),a.revision])),o=[];for(let a of s){let{namespace:c,name:l}=a.repository,u=sd.join(e.workspace,c,l);co.mkdirSync(u,{recursive:!0});let d={...process.env,GIT_TERMINAL_PROMPT:"0",...Zme(await t.token())};r(u,["init","-q"]),r(u,["remote","add","origin",n(a.repository)]);let p=a.change?.base??a.compareWith,m=i.get(E_(a.repository)),f=p?.revision??(m!==a.revision?m:void 0);r(u,["fetch","-q","--no-tags","origin",a.revision,...f?[f]:[]],d);let h=p??(a.ref?{ref:a.ref,revision:m??a.revision}:null);h&&(r(u,["update-ref",`refs/remotes/origin/${h.ref}`,h.revision]),r(u,["symbolic-ref","refs/remotes/origin/HEAD",`refs/remotes/origin/${h.ref}`])),a.ref?r(u,["checkout","-q","-B",a.ref,a.revision]):r(u,["checkout","-q","--detach",a.revision]),o.push({repository:a.repository,revision:r(u,["rev-parse","HEAD"]),path:u,slug:`${c}/${l}`})}return o}async function gut(t,e={}){let r=lge(e.host),n=[];for(let s of t.manifest.sources){if(s.change?.kind!=="pull_request")continue;let{namespace:i,name:o}=s.repository,a=`${i}/${o}`,c=s.change.number;try{if(![i,o].every(d=>pge.test(d)))throw new Error("the repository name is not valid");let l=await t.githubFetch(e)(`${r}/repos/${i}/${o}/pulls/${c}`,{headers:{Authorization:`Bearer ${await t.token()}`,Accept:"application/vnd.github+json"},redirect:"error",signal:AbortSignal.timeout(cge)});if(!l.ok)throw new Error(`GitHub answered ${l.status}`);let u=await l.json();n.push({repository:a,number:c,...typeof u.title=="string"?{title:u.title}:{},...typeof u.body=="string"?{body:u.body}:{},...typeof u.merged=="boolean"?{merged:u.merged}:{},...u.merged===!0&&typeof u.merge_commit_sha=="string"?{mergeCommit:u.merge_commit_sha}:{},...u.merged===!0&&typeof u.head?.sha=="string"?{mergedHead:u.head.sha}:{}})}catch(l){let u=l instanceof Error?l.message:String(l);n.push({repository:a,number:c,note:`could not be read: ${u}`})}}return n}async function Aut(t,e,r,n={}){let[s,i,...o]=e.split("/");if(o.length||![s,i].every(a=>a!==void 0&&pge.test(a)))return"unknown";try{let a=await t.githubFetch(n)(`${lge(n.host)}/repos/${s}/${i}/commits/${encodeURIComponent(r)}`,{headers:{Authorization:`Bearer ${await t.token()}`,Accept:"application/vnd.github+json"},redirect:"error",signal:AbortSignal.timeout(cge)});if(a.status===404||a.status===422)return"missing";if(!a.ok)return"unknown";let c=await a.json();return typeof c.sha=="string"&&c.sha.toLowerCase()===r.toLowerCase()?"found":"missing"}catch{return"unknown"}}function yut(t,e){let r=t.sources.find(s=>s.reason==="TRIGGER"&&s.change?.kind==="pull_request"),n=r&&e.find(s=>s.repository.providerRepositoryId===r.repository.providerRepositoryId);return n&&r.change?{repository:n.slug,path:n.path,number:Number(r.change.number)}:void 0}var tgr=[".skyramp/sut/setup.sh",".skyramp/workspace.yml"];function but(t){let e=t.find(r=>tgr.some(n=>co.existsSync(sd.join(r.path,n))))??t[0];return{repositoryPath:e.path,repositorySlug:e.slug,relatedRepos:t.filter(r=>r!==e).map(r=>({slug:r.slug,path:r.path,writable:!0}))}}var rgr=b.object({tests:b.object({placements:b.array(b.unknown()).optional()}).passthrough().optional()}).passthrough(),ngr=b.object({repository:Dc.passthrough(),testType:b.nativeEnum(qw),directory:b.string()}).passthrough();function Eut(t,e){let r=rgr.safeParse(t.settings.target??{}),n=[];for(let s of(r.success?r.data.tests?.placements:void 0)??[]){let i=ngr.safeParse(s);if(!i.success)continue;let{repository:o,testType:a}=i.data,c=e.find(d=>d.repository.provider===o.provider&&d.repository.providerRepositoryId===o.providerRepositoryId),l=i.data.directory.trim(),u=!l||sd.isAbsolute(l)||l.split(/[\\/]/).includes("..");!c||u||n.push({repository:c.slug,testType:a,directory:l})}return n}var sgr=b.object({report:b.object({language:b.string()}).passthrough()}).passthrough();function mge(t){let e=sgr.safeParse(t?.settings.target);return e.success?gq(e.data.report.language):"en"}var igr=b.object({environment:b.object({components:b.array(b.unknown()).optional(),dependencies:b.array(b.unknown()).optional()}).passthrough()}).passthrough(),ogr=b.object({name:b.string().min(1),provision:b.literal("existing"),url:b.string().min(1),repository:Dc.passthrough().optional(),revisionUrl:b.string().min(1).optional()}).passthrough(),agr=b.object({name:b.string().min(1),url:b.string().nullable(),versionUrl:b.string().nullable(),notes:b.string().nullable()}).passthrough();function wut(t,e){let r=igr.safeParse(t.settings.target),n=r.success?r.data.environment:{},s=(n.components??[]).flatMap(a=>{let c=ogr.safeParse(a);if(!c.success)return[];let{name:l,url:u,repository:d,revisionUrl:p}=c.data;if(!d)return[{name:l,url:u}];let m=e.sources.find(f=>f.repository.provider===d.provider&&f.repository.providerRepositoryId===d.providerRepositoryId);return m?[{name:l,url:u,repository:`${m.repository.namespace}/${m.repository.name}`,expectedRevision:m.revision,...p?{revisionUrl:p}:{}}]:[{name:l,url:u,repository:`${d.provider} repository ${d.providerRepositoryId}`}]}),i=(n.dependencies??[]).flatMap(a=>{let c=agr.safeParse(a);return c.success?[{name:c.data.name,url:c.data.url,versionUrl:c.data.versionUrl,notes:c.data.notes}]:[]});if(s.length===0&&i.length===0)return;let o=b.object({allowSharedEnvironmentMutation:b.boolean()}).passthrough().safeParse(t.settings.policy);return{components:s,dependencies:i,allowMutation:o.success&&o.data.allowSharedEnvironmentMutation}}var cgr=new Set(["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"]);function sut(t,e){if(!cgr.has(t.reason))return{};let r=`${t.repository.namespace}/${t.repository.name}`,n=t.change?.kind==="pull_request"?t.change.number:void 0,s=n===void 0?void 0:e.find(a=>rj(a.repository,r)&&a.number===n),i=s?.merged===!0?s.mergeCommit:void 0,o=i&&s?.mergedHead?{mergedHead:s.mergedHead}:{};return{touched:!0,acceptedRevisions:{frozen:t.revision,...i&&i!==t.revision?{mergeCommit:i,...o}:{}}}}function xut(t,e,r,n,s){let i=u=>r.sources.find(d=>rj(`${d.repository.namespace}/${d.repository.name}`,u)),o=(t?.components??[]).map(u=>{let d=u.expectedRevision?i(u.repository):void 0;return d?{...u,...sut(d,s)}:u}),a=Yw(e.files)!==void 0,c=e.components.map(u=>{if(u.repository===An)return{name:u.name,url:e.address};let d=i(u.repository),p=a?void 0:Sfe(e,u.name);return{name:u.name,url:e.address,repository:u.repository,...d?{expectedRevision:d.revision}:{},...p?{revisionUrl:p}:{},...a?{revisionScript:!0}:{},...d?sut(d,s):{}}}),l=b.object({allowSharedEnvironmentMutation:b.boolean()}).passthrough().safeParse(n?.settings.policy);return{components:[...o,...c],dependencies:t?.dependencies??[],allowMutation:t?.allowMutation??(l.success&&l.data.allowSharedEnvironmentMutation)}}function Sut(t){let e=r=>t.testResults.filter(n=>n.status===r).length;return{passed:e("Pass"),failed:e("Fail"),skipped:e("Skipped")}}function lgr(t){let{passed:e,failed:r,skipped:n}=Sut(t);return e+r===0?{sufficiency:"insufficient",rationale:n>0?`Every test was skipped (${n}), so nothing was validated.`:"No test ran, so nothing was validated.",gaps:["No test ran against the frozen sources."],acceptedEvidence:[],actionRequired:[]}:{sufficiency:"sufficient",rationale:`${e+r} tests ran against the frozen sources: ${e} passed, ${r} failed${n?`, ${n} skipped`:""}.`,gaps:[],acceptedEvidence:[],actionRequired:[]}}function ugr(t,e){let r=t.testResults.map(c=>({result:c,repository:c.repository??e,path:c.fileName||c.testType})),n=new Map;for(let c of r){let l=`${c.repository}:${c.result.testType}:${c.path}`;n.set(l,(n.get(l)??0)+1)}let s=r.map(({result:c,repository:l,path:u})=>{let d=(n.get(`${l}:${c.testType}:${u}`)??0)>1;return c.resultId??xG(l,c.testType,u,d&&c.endpoint||void 0)}),i=new Map;for(let c of s)i.set(c,(i.get(c)??0)+1);let o=new Set(s.filter(c=>i.get(c)===1)),a=r.map(({result:c,repository:l},u)=>{let d=s[u],p=d;if(i.get(d)>1&&o.has(d))for(let m=2;o.has(p)||p===d;m+=1)p=d.includes("#")?`${d}.${m}`:`${d}#${m}`;return o.add(p),{...c,repository:l,resultId:p}});return{...t,testResults:a,...dgr(t,a,e),validation:pgr(t,t.validation??lgr(t)),traceVersion:1}}function dgr(t,e,r){if(!t.testExecutionContexts)return{};let n=new Set,s=a=>{let c=a;for(let l=2;n.has(c);l+=1)c=`${a}#${l}`;return n.add(c),c},i=[],o=new Map;for(let{repository:a,...c}of t.testExecutionContexts){let l=c.status==="not_run"?[]:e.filter(u=>u.fileName===c.test&&u.repository===(a?.trim()||r));l.length||i.push(c);for(let{resultId:u}of l){let d=o.get(u),p=d!==void 0&&i[d].cleanup.status==="failed"?i[d].cleanup:c.cleanup,m={...c,cleanup:p,test:u,resultId:u};d===void 0?o.set(u,i.push(m)-1):i[d]=m}}for(let a of i)a.resultId&&n.add(a.resultId);return{testExecutionContexts:i.map(a=>a.resultId?a:{...a,test:s(a.test.slice(0,512))}).slice(0,5e3)}}function pgr(t,e){let{passed:r,failed:n}=Sut(t);return e.sufficiency!=="sufficient"||r+n>0||e.acceptedEvidence.length>0?e:{...e,sufficiency:"insufficient",gaps:["No test ran and no existing evidence was accepted, so nothing was validated."]}}async function Cut(t,e){let r=ju([...t.issuedTokens,...e.secrets??[]]),n=Tnt({manifest:t.manifest,attemptNumber:t.attemptNumber,checkedOut:e.sources.map(s=>({repository:s.repository,revision:s.revision})),generatedTests:Xr(e.delivery,r),producer:e.producer,report:Xr(ugr(e.report,e.workingSlug),r),githubWrites:e.githubWrites});await t.send("PUT",`/api/v1/runner/attempts/${t.attemptId}/report`,n)}async function fge(t){let e=Ent.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/configuration`,void 0)),r=t.manifest.configuration,{configuration:n,capture:s}=e;if(n.captureId!==r.captureId||n.revision!==r.revision||n.hash!==r.hash||s.hash!==r.hash||Int(s)!==r.hash)throw new Error("The app answered the configuration of another capture than the manifest names");return e}var age=class extends Error{};async function AV(t){let{runtimePlan:e,testEnvironment:r}=wnt.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/runtime-plan`,void 0));if(e&&Snt(e.files)!==e.contentHash)throw new age(`Stored SUT recipe version ${e.version} does not match its hash`);return{runtimePlan:e,testEnvironment:r??null}}async function Iut(t,e,r=()=>{}){try{co.rmSync(e,{recursive:!0,force:!0})}catch{}let n=t.manifest.requirements??[];if(n.length===0&&!t.manifest.instructions)return{items:[],instructions:[]};let s,i=[];try{let a=unt.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/requirements`,void 0));s=new Map(a.items.map(c=>[_c(c),c])),i=t.manifest.instructions?a.instructions??[]:[]}catch(a){let c=a instanceof Error?a.message:String(a);r(`Testbot V3: could not read the run's requirement items: ${c}`),s=new Map}try{co.mkdirSync(e,{recursive:!0,mode:448})}catch{}let o=[];for(let a of n){let c={...jA(a),..."fileName"in a?{file:{name:a.fileName,mediaType:a.mediaType}}:{}},l=s.get(_c(c));if(!l)o.push({...c,state:"not_read",reason:Pw.test(c.key)?"cannot_open":"unavailable"});else if(l.state==="not_read")o.push({...c,state:"not_read",reason:l.reason});else if(!("text"in l))o.push(await mgr(t,e,c,a.contentHash,r));else{let u=sd.join(e,vut(c));try{co.writeFileSync(u,l.text,{mode:384}),o.push({...c,state:"read",path:u,contentMatches:l.contentMatches,version:l.version})}catch(d){r(`Testbot V3: could not write the requirement item ${c.key}: ${d instanceof Error?d.message:String(d)}`),o.push({...c,state:"not_read",reason:"unavailable"})}}}return{items:o,instructions:i}}async function mgr(t,e,r,n,s){let i=c=>(s(`Testbot V3: could not open the uploaded document ${r.key}: ${c}`),{...r,state:"not_read",reason:"cannot_open"});if(!r.file)return i("the manifest names no file");let o;try{let c=int.requirementFile.replace(":attemptId",t.attemptId).replace(":key",r.key);o=await t.readBytes(c,eut)}catch(c){return i(c instanceof Error?c.message:String(c))}if((0,out.createHash)("sha256").update(o).digest("hex")!==n)return i("its bytes do not match its hash");let a=sd.join(e,vut(r));try{co.writeFileSync(a,o,{mode:384})}catch(c){return i(c instanceof Error?c.message:String(c))}return{...r,state:"read",path:a,contentMatches:!0,version:n}}function vut(t){let e=t.source==="other"?[]:[new URL(t.site).hostname],r=t.file?Zlt(t.file.mediaType):"txt";return`${[t.source,...e,t.key].join("-")}.${r}`}async function hge(t,e){await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/progress`,pnt.parse(e))}async function Rut(t,e){return hnt.parse(await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/setup-events`,mnt.parse(e)))}async function Nut(t,e){await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/setup-checkpoint`,Ant.parse(e))}async function Tut(t){return(await But(t,"setup-checkpoint",ynt))?.checkpoint??null}async function kut(t){return(await But(t,"setup-context",bnt))?.context??null}async function But(t,e,r){try{return r.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/${e}`,void 0))}catch(n){if(n instanceof ao&&n.status===404)return null;throw n}}async function gge(t,e){let r=ju([...t.issuedTokens,...e.secrets??[]]),n=knt(t.manifest,t.attemptNumber,e.sources.map(s=>({repository:s.repository,revision:s.revision})),Xr(e.recipe,r),e.producer);await t.send("PUT",`/api/v1/runner/attempts/${t.attemptId}/sut-recipe`,n)}function Put(t,e,r,n=e[0].slug,s,i={}){let{record:o,entries:a}=Dut(t,e,n),c=td({outputsDir:t,state:sV(sd.join(sd.dirname(t),"state.json"))});if(!o&&ij(i,r.system,c?.sutRequired).length>0)return{status:"none"};let l=f=>_ut(e,f),u=[],d=[];for(let{record:f,repository:h,number:A}of a)if(h&&A)u.push({repository:h,number:A});else if(h&&f.prFailure){let E=f.prDetail?`${f.prFailure}: ${f.prDetail}`:f.prFailure;d.push({repository:h,message:E,slug:f.repository??n})}else h&&f.committed&&d.push({repository:h,message:f.reason??"The tests were committed but no pull request was opened.",slug:f.repository??n});let p=new Set([...u,...d].map(({repository:f})=>f.providerRepositoryId)),m=[...new Set(r.newTestsCreated.map(f=>(f.repository??n).toLowerCase()))];for(let f of m){let h=l(f);h&&!p.has(h.providerRepositoryId)&&d.push({repository:h,message:s??"Generated tests were not proposed in a pull request.",slug:f})}return u.length&&d.length?{status:"partial",pullRequests:u,failures:d.map(({repository:f,message:h})=>({repository:f,message:h}))}:u.length?{status:"delivered",pullRequests:u}:d.length?{status:"failed",message:o?.deliveries?d.map(f=>`${f.slug}: ${f.message}`).join("; "):d[0].message}:r.newTestsCreated.length>0?{status:"failed",message:s??"Generated tests were not proposed in a pull request."}:{status:"none"}}function _ut(t,e){let r=t.find(n=>n.slug.toLowerCase()===e.toLowerCase());return r&&{provider:r.repository.provider,providerAccountId:r.repository.providerAccountId,providerRepositoryId:r.repository.providerRepositoryId}}function Dut(t,e,r){let n=sd.join(t,"deliver.json"),s=co.existsSync(n)?JSON.parse(co.readFileSync(n,"utf-8")):void 0,i=s?.deliveries??(s?[s]:[]);return{record:s,entries:i.map(o=>({record:o,repository:_ut(e,o.repository??r),number:/\/pull\/([1-9][0-9]*)$/.exec(o.prUrl??"")?.[1]}))}}function Out(t,e,r=e[0].slug){let n=new Map,s=(i,o)=>{Cme.safeParse(i).success&&n.set(`${i.kind}:${i.repository.providerRepositoryId}:${o}`,i)};for(let{record:i,repository:o,number:a}of Dut(t,e,r).entries){if(!o||!i.branch)continue;let c=i.pushedCommits??(i.pushed&&i.commitSha?[i.commitSha]:[]);for(let u of c)s({kind:"branch_pushed",repository:o,branch:i.branch,commit:u},`${i.branch}:${u}`);if(!a)continue;let l=i.prAction==="retargeted"?i.retargetedAs??"created":i.prAction;l==="created"?s({kind:"pull_request_opened",repository:o,number:a,branch:i.branch},a):(l==="updated"||l==="unchanged")&&s({kind:"pull_request_edited",repository:o,number:a,branch:i.branch},a)}return[...n.values()].slice(0,Sme)}function Mut(t,e){return t.credentials.filter(r=>r.required&&!e[r.name]).map(r=>r.name)}var Age=[/\bgh[pousr]_[A-Za-z0-9]{36,}/g,/\bgithub_pat_[A-Za-z0-9_]{22,}/g,/\bsk-ant-[A-Za-z0-9_-]{20,}/g,/\bsk-[A-Za-z0-9]{32,}/g,/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g],Qut=t=>Age.some(e=>new RegExp(e.source).test(t));var Ph=".skyramp/setup-events.ndjson",UD=".skyramp/setup-left-out.json",$D=".skyramp/setup-inbox.json",yge=".skyramp/setup-inbox-read.json",wV=".skyramp/setup-hook-ran",fgr=6e4,hgr=5e3,ggr=300,Zs=t=>{let e=typeof t=="string"?t:typeof t=="number"?String(t):"";return e.trim()==="null"?"":e},yV=t=>Array.isArray(t)?t:[],EV=(t,e)=>Object.values(t).find(r=>r===Zs(e).trim().toLowerCase()),Agr={running:"up",healthy:"up",ready:"up",started:"up",building:"starting",pending:"starting",installing:"starting",skipped:"out_of_scope",excluded:"out_of_scope","out-of-scope":"out_of_scope"},ygr=t=>EV(v_,t)??Agr[Zs(t).trim().toLowerCase()]??"found",Lut=t=>b.string().uuid().safeParse(t).success,bgr=t=>CG.test(t)?t:t.replace(/[^A-Za-z0-9_-]+/g,"-").slice(0,64).replace(/^-+|-+$/g,"")||"question",Egr=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,wgr=/github\.com[/:]([^/\s]+)\/([^/\s?#]+?)(?:\.git)?(?:[/?#]|$)/i;function xgr(t){if(t.kind!=="question"||t.placeholder===void 0)return t;let{placeholder:e,...r}=t;return r}var Fut=new RegExp(Bme.source,"g"),xV=class{constructor(e,r,n){this.checkout=e;this.send=r;this.opts=n}checkout;send;opts;offset=0;sequence=1;pending=[];started=!1;closed=!1;capped=!1;flushing=0;emptyRefused=!1;placeholderRefused=!1;unreadSince;saidHookSilent=!1;timer;queue=Promise.resolve();phase="discover";messageIds=new Set;stopHeard=!1;start(){if(!this.timer){if(!this.started){this.started=!0;let e=Tm.join(this.checkout,Ph);As.mkdirSync(Tm.dirname(e),{recursive:!0}),As.writeFileSync(e,"");for(let r of[UD,$D,yge,wV])As.rmSync(Tm.join(this.checkout,r),{force:!0})}this.timer=setInterval(()=>{this.flushing===0&&this.flush()},this.opts.intervalMs??hgr),this.timer.unref?.()}}async stop(){this.timer&&clearInterval(this.timer),this.timer=void 0,await this.flush()}flush(){return this.flushing+=1,this.queue=this.queue.then(()=>this.drain()).catch(e=>this.opts.warn(`Testbot V3: could not send setup events: ${bV(e)}`)).finally(()=>{this.flushing-=1}),this.queue}async drain(){if(!this.closed){if(this.collect(),this.pending.length===0&&!this.emptyRefused){await this.sendBatch([]);return}for(;this.pending.length>0&&!this.closed;){let e=this.pending.slice(0,Qv);if(await this.sendBatch(e)==="unanswered")return;this.pending.splice(0,e.length)}}}async sendBatch(e){this.placeholderRefused&&(e=e.map(xgr));let r;try{r=await this.send({schemaVersion:1,events:e})}catch(n){if(n instanceof ao&&n.code==="RUN_CLOSED")return this.closed=!0,this.pending=[],"done";if(n instanceof ao&&e.length===0)return this.emptyRefused=!0,"done";if(n instanceof ao){if(e.length>1){for(let i of e){if(this.closed)return"done";if(await this.sendBatch([i])==="unanswered")return"unanswered"}return"done"}if(e[0].kind==="question"&&e[0].placeholder!==void 0)return this.placeholderRefused=!0,this.sendBatch(e);let s=e[0].kind==="log"?void 0:Sgr(e[0]);return s?(this.opts.warn(`Testbot V3: the app refused setup event ${e[0].sequence}, so it is sent as a log line: ${n.message}`),this.sendBatch([{sequence:e[0].sequence,at:e[0].at,kind:"log",phase:this.phase,text:s}])):(this.opts.warn(`Testbot V3: the app refused setup event ${e[0].sequence}, so it is dropped: ${n.message}`),"done")}return n instanceof b.ZodError?(this.opts.warn(`Testbot V3: the app's answer to setup events was not understood: ${n.issues[0]?.message}`),"done"):(this.opts.warn(`Testbot V3: could not send setup events, trying again: ${bV(n)}`),"unanswered")}try{this.writeLeftOut(r.leftOut)}catch(n){this.opts.warn(`Testbot V3: could not write ${UD}: ${bV(n)}`)}try{this.writeInbox(r.messages??[])}catch(n){this.opts.warn(`Testbot V3: could not write ${$D}: ${bV(n)}`)}return r.stop&&!this.stopHeard&&(this.stopHeard=!0,this.opts.onStop?.(r.stop.key)),"done"}collect(){if(this.capped)return;let e=Tm.join(this.checkout,Ph),r;try{r=As.statSync(e).size}catch{return}if(r<this.offset&&(this.offset=0),r===this.offset)return;let n=Buffer.alloc(r-this.offset),s=As.openSync(e,"r");try{As.readSync(s,n,0,n.length,this.offset)}finally{As.closeSync(s)}let i=n.lastIndexOf(10);if(i<0)return;let o=n.subarray(0,i).toString("utf-8").split(`
558
558
  `);this.offset+=i+1;for(let a of o){if(a.trim()==="")continue;if(this.sequence>SG){this.opts.warn(`Testbot V3: the setup sent ${SG} events, the most a run may; the rest are not sent.`),this.capped=!0;return}let c=this.toEvent(a);c&&(this.pending.push(c),this.sequence+=1)}}toEvent(e){let r;try{r=JSON.parse(e)}catch{r=void 0}let n=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:void 0,s=this.opts.secrets(),i=(m,f=1/0)=>Age.reduce((A,E)=>A.replace(E,F_),Dr(m,s)).replace(Fut," ").trim().slice(0,f).replace(Fut," ").trim(),o=m=>i(i(m).replace(/\s+/g," "),ggr),a={sequence:this.sequence,at:(this.opts.now?.()??new Date).toISOString()};if(!n)return this.asLog(a,o(e),"a setup event line that is not one JSON event");let c=this.putRight(n,a,i,o),l=c?Pme.safeParse(c):void 0;if(l?.success)return l.data.kind==="log"&&(this.phase=l.data.phase),l.data;let u=l&&!l.success?` (${l.error.issues[0]?.path.join(".")}: ${l.error.issues[0]?.message})`:"",d=yV(n.names).map(Zs).filter(Boolean),p=o(Zs(n.text)||[Zs(n.name),Zs(n.status)].filter(Boolean).join(": ")||(d.length?`Needs credentials: ${d.join(", ")}`:""))||o(e);return this.asLog(a,p,`a setup event the app would refuse${u}`)}putRight(e,r,n,s){let i=EV(bme,e.kind);if(i==="log")return{...r,kind:i,phase:EV(Ov,e.phase)??this.phase,text:s(Zs(e.text))};if(i==="component"){let o=n(Zs(e.file),Tme)||null,a=n(Zs(e.version),Nme);return{...r,kind:i,name:n(Zs(e.name),w_),repository:this.repositoryOf(n(Zs(e.repository)),o),file:o,status:ygr(e.status),...a&&{version:a}}}if(i==="reply")return{...r,kind:i,to:this.messageIdOf(Zs(e.to).trim()),accepted:e.accepted!==!1,text:s(Zs(e.text))};if(i==="question"){let o=[...new Set(yV(e.choices).map(d=>n(n(Zs(d)).replace(/\s+/g," "),vme)).filter(Boolean))].slice(0,Ime),a=EV(wG,e.type)??"free_text";o.length===0&&(a="free_text");let c=Zs(e.text);a==="free_text"&&o.length>0&&([c,o]=[`${c} (${o.join(", ")})`,[]]);let l=Zs(e.id).trim(),u=n(Zs(e.placeholder)).replace(/\s+/g," ");return{...r,kind:i,id:bgr(l),type:a,text:s(c),component:n(Zs(e.component),w_)||null,choices:o,...u&&u.length<=Rme&&{placeholder:u}}}if(i==="credentials"){let o=[...new Set(yV(e.names).map(a=>Zs(a).trim().toUpperCase()).filter(a=>WA.test(a)))].slice(0,kme);return{...r,kind:i,names:o}}if(i==="delivered")return{...r,kind:i,ids:[...new Set(yV(e.ids).map(o=>this.messageIdOf(Zs(o).trim())).filter(Lut))]}}repositoryOf(e,r){let n=this.opts.repositories??[],s=c=>n.find(l=>l.slug.toLowerCase()===c.toLowerCase())?.slug;if(Egr.test(e)){let c=s(e);if(c||n.length===0)return c??e}if(e===An&&this.opts.shared)return An;let i=wgr.exec(e);if(i){let c=`${i[1]}/${i[2]}`,l=s(c);if(l||n.length===0)return l??c}let o=n.find(c=>c.slug.split("/").pop()?.toLowerCase()===e.toLowerCase());if(o)return o.slug;let a=r?n.find(c=>As.existsSync(Tm.join(c.path,r))):void 0;return a?a.slug:this.opts.shared?An:n[0]?.slug??e}messageIdOf(e){if(Lut(e))return e;let r=[...this.messageIds],n=e?r.filter(s=>s.startsWith(e.toLowerCase())||e.toLowerCase().includes(s)):[];return n.length===1?n[0]:r.length===1?r[0]:e}asLog(e,r,n){if(!r){this.opts.warn(`Testbot V3: left out ${n}: it says nothing.`);return}return this.opts.warn(`Testbot V3: sent ${n} as a log line.`),{...e,kind:"log",phase:this.phase,text:r}}writeInbox(e){for(let s of e)this.messageIds.add(s.id);let r=Tm.join(this.checkout,$D);if(As.writeFileSync(`${r}.tmp`,`${JSON.stringify(e)}
559
559
  `),As.renameSync(`${r}.tmp`,r),e.length===0||As.existsSync(Tm.join(this.checkout,wV))){this.unreadSince=void 0;return}let n=(this.opts.now?.()??new Date).getTime();this.unreadSince??=n,!this.saidHookSilent&&n-this.unreadSince>=fgr&&(this.saidHookSilent=!0,this.opts.warn("Testbot V3: people sent this setup messages, but the session's setup hook has not run, so they do not reach it."))}writeLeftOut(e){let r=Tm.join(this.checkout,UD);As.writeFileSync(`${r}.tmp`,`${JSON.stringify(e)}
560
560
  `),As.renameSync(`${r}.tmp`,r)}},bV=t=>t instanceof Error?t.message:String(t);function Sgr(t){return t.kind==="component"?`${t.name}: ${t.status}`:t.kind==="reply"||t.kind==="question"||t.kind==="log"?t.text:t.kind==="credentials"?`Needs credentials: ${t.names.join(", ")}`:""}var SV=q(require("fs")),Uut=q(require("path"));var Cgr=600,Igr=5*6e4,vgr=30,Rgr="From the Setup page: a person sent this setup the messages below, each one's text in quotes. Use what they say to set up the SUT, as the setup rules say, and never put repository content, environment values or credentials in a setup event for it. A message is newer than the SUT notes: where they differ, follow the message. Before anything else, write a reply line for each instruction (setup events): what you will do differently, or accepted false only when it is not about setting up the SUT or breaks a setup rule. Then act on it, redoing only the steps it changes. An answer is to the question it names; go on with what it unblocks.",Ngr=`// Skyramp Testbot: hands a running setup the Setup page's messages (SKYR-4843). Written by the runner.
@@ -784,8 +784,8 @@ ${a.body.slice(0,6e3)}
784
784
  ${nwr(t,e)}`}function nwr(t,e){if(t.inputs.appRunning)return[`${t.inputs.appRunning.trim()} Don't start it again: check it answers a real request with real data, and fill "app" with outcome clean (or bringup-failed, with why, if it doesn't answer) and its base URLs.`,e.revisionRead].filter(Boolean).join(`
785
785
  `);let r=t.inputs.repositoryPath,n=e.recipe;return n.present?[`Bring the app up so the tests can run against it, and leave it running. The repo records how: ${[n.setupScript,n.teardownScript,n.authTokenScript,n.workspaceFile].filter(i=>!!i).map(i=>qi.relative(r,i)).join(", ")}.`,"Run it. If it has drifted, fix it and update those files to what actually worked. If this PR broke start-up, that's","a defect \u2014 say which changed file. Check that the app answers a real request with real data, not just an open port.",...n.budgetMinutes?[`Start-up can legitimately take up to ${n.budgetMinutes} minutes.`]:[],...n.healthHint?[`A known-good health check: ${JSON.stringify(n.healthHint)}`]:[],...n.stale?[`This PR changes start-up files (${n.staleFiles.join(", ")}), so the recipe may be out of date.`]:[]].join(`
786
786
  `):["Bring the app up so the tests can run against it, and leave it running. The repo has no recorded way to start it","(.skyramp/sut/setup.sh). If you can start it from the repo's own docs or compose files without much effort, do, and","save what worked as .skyramp/sut/setup.sh and .skyramp/sut/teardown.sh. Otherwise set app.outcome to bringup-failed and say why."].join(`
787
- `)}var tW=t=>!!t.appRunning&&Lc(t),swr=new Set(["mutates"]);function iwr(t){return tW(t.inputs)?[" The app runs in a shared environment this policy protects. A case or clause whose test changes state there (an"," API POST, PUT, PATCH or DELETE, in the test or its setup, or a UI flow that submits, creates, edits or deletes) is"," withheld by the runner and reported as a gap: prefer cases that only read, and mark each that still changes state,",' and each such maintenance item, "mutates": true.']:[]}function owr(t,e){if(t.inputs.planOnly)return[];if(!t.inputs.appRunning&&e.preflight&&!e.preflight.sutRequired)return[];let r=qi.join(qi.dirname(e.checkpoint),"probe");return tW(t.inputs)?["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). It is a shared environment this policy protects: send only requests that change nothing (GET and"," HEAD: reads, lists, searches, filters, sorts) and never create, edit, delete, reset or seed anything there. Put",` every probe in one script under ${r}* and run it once, printing one line per probe: what it read, the status`," codes, and which check failed. Probe what the change touches through reads: every state its records can be in,"," every field it adds through list, sort, filter and search, and odd query values (zero, negative, huge, empty, case"," variants). Flag any 5xx, and reads that disagree with each other or with derived values (totals, counts).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case for it. Then write the updated plan to',` ${e.checkpoint} again.`]:["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). Put every probe in one",` script under ${r}* and run it once, printing one line per probe: what it did, the status codes, and which`," check failed. Probe what the change touches:"," - every state its records can be in (from the code's status fields and enums) \xD7 every operation the change adds or alters;"," - sequences: write then read back; set, reset, read; edit twice; delete then edit; write then list;"," - payloads: zero, negative, huge, empty, null, missing and extra fields, wrong types, case variants, more items"," than a page holds, one valid and one invalid item together;"," - every field the change adds, through the existing list, sort, filter and search."," Read the record before and after each action. Flag any 5xx; a rejected request that changed anything; a read that"," differs from what was written; a repeated request that changed something more; derived values (totals, counts)"," that disagree with their inputs; an operation that succeeds on a record in a final state (cancelled, shipped, deleted).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case whose steps are that request sequence and',` whose expected outcome is the correct behaviour. Then write the updated plan to ${e.checkpoint} again.`]}function Cmt(t){let e=Hn(t);return e?Qfe(Vu(e,"").map(r=>r.path)):[]}function EAe(t){let e=Cmt(t);if(!e.length&&!Lfe(t.inputs.repositoryPath))return[];let r=e.slice(0,8).join(", ")+(e.length>8?", \u2026":"");return[' User journeys: under "journeys", the flows a user walks through the UI, each from where a user normally starts it'," to the outcome they came for, that together pass through everything the change alters that a user sees or does:"," every ui clause is in some journey's steps (or under notInJourney, with why no journey reaches it). Use as many"," journeys as that takes. For each: the entry route; every step in order, with the clauses it exercises and what the user then sees;"," the outcome that shows the journey worked; its source \u2014 the spec or PR description that describes the flow (quote it),"," else inferred; and the test file it belongs in. Each becomes one test of the whole flow as the PR intends it (its kind):"," in-process only where the repo's own in-process UI tests (component tests under jsdom or the like, for that code) can"," walk and check all of it \u2014 a request-level test client (Django's, Flask's, Rails integration tests) runs no page script"," and does not count \u2014 else a browser test, which needs the running app, so the decision is runtime_required (step 4)."," The changed step is inside the flow, not the whole of it: the steps that get the user there come first, and after a"," change that saves something, a step reloads or reopens it and checks it held. Code that decides what a page shows"," counts though no page changed (a composable, store, hook, style or theme it renders from): what the user then sees"," is in a journey, whatever unit test also checks it."," A repo with no browser tests is no reason to leave a clause out: its browser journeys go in a test package of their own."," Empty when the change alters nothing a user sees; then say so under notInJourney, per clause, with why. A change"," to UI code that alters what the page holds along a user flow (a DOM attribute, the theme, other client state the"," flow sets) owes a journey that asserts it, even when nothing in the repo reads it yet: that nothing reads it, or"," that the user cannot see it, is no reason to leave it out.",...e.length?[` The change touches UI files: ${r}.`]:[]]}function awr(t,e){let{budgetMinutes:r}=t.inputs;return["4. Validation triage, before anything is started: decide what evidence each clause still needs and the cheapest",' reliable way to get it, and save it as "triage" (its behaviorIds are your clause ids). The app is brought up only'," when the decision is runtime_required; existing evidence or native unit tests can often validate a change"," without it. You are not a code reviewer here: no style, naming or architecture commentary.","",...(s=>s.flatMap(i=>i.split(`
788
- `)).map(i=>i?` ${i}`:""))([...vge(t,e.triage.change),"",...Rge(t,e.triage),...r?["",`Run budget: ${r} minutes for the whole run, including everything you plan. Name in gaps what it cannot cover.`]:[],"","Scope: validate what this change alters or newly reaches, and what the PR description or a spec states.","- Out of scope is only a clause the change cannot reach: its deciding code is unchanged and no changed path leads to it, or it lives in a checkout the change does not touch. List it under outOfScope with the unchanged line that decides it (path:line), and plan nothing for it. Code the change newly calls or feeds new values to is in scope, and so is a defect it exposes there.","","The evidence ladder \u2014 use the cheapest mechanism that establishes each clause in scope:"," existing_evidence an accepted ci-<n> result. A check you ran (typecheck, compile, test collection) establishes only a prerequisite clause \u2014 that the change builds or its config parses \u2014 never a behaviour"," unaffected the change cannot reach this clause: no changed code path leads to it \u2014 cite the code that shows it (path:line); never for a clause decided in a changed file"," existing_unit existing native unit tests that exercise the clause"," new_unit a new in-process test, for evidence nothing provides yet"," runtime only the running application can establish it","A clause only the running app can check is runtime, not a gap, even when every other clause is in-process. It is a gap only when the app cannot be run here; then name what is missing.","Give each clause the kind of test the repo already uses for the code it checks \u2014 in-process where the repo tests that code in-process, runtime where it tests it against the running app \u2014 unless that kind cannot check it; then the kind that can.",`Browser-only: for every clause, ask whether its behaviour happens only in a browser \u2014 real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript \u2014 and if so mark it browserOnly. A test that only checks markup (a class or attribute present, the HTML a request returns) proves the precondition, not the behaviour: the header having the sort class does not show that "clicking a column header sorts the list". A browser-only clause is tested in a browser: in the repo's in-process browser harness where it has one \u2014 a Django LiveServerTestCase or StaticLiveServerTestCase, or pytest-django live_server, suite that drives Selenium or Playwright; component tests under jsdom only when the repo's own jsdom tests already drive that kind of interaction \u2014 named as its browserHarness (the suite's path), and the clause stays new_unit, with its triage item's covers saying it is driven in that browser suite; else decide runtime_required with a browser test of it. A markup check may be added, not substituted.`,"","Decisions:","- existing_evidence_sufficient means every clause in scope is established by existing evidence, with no gaps.","- targeted_unit plans unit tests and nothing that needs a running app.","- runtime_required marks at least one clause runtime, and plans no new unit tests: once the app is needed, this plan's cases are every new test, each still written the way the repo tests that code \u2014 in-process where that can check its clause, in the browser only where it cannot. The existing unit tests you identify still run, as existing_unit.","- The journeys and maintenance of step 5 can need the app too, so plan them before you decide. Decide runtime_required when any journey needs a browser \u2014 real JavaScript or htmx behaviour, navigation across pages, what persists after a reload, or a server-rendered page the repo tests only at the request level \u2014 and mark runtime the clauses its steps exercise.",'- Decide runtime_required as well when any test under "maintenance" calls the deployed app \u2014 API, contract, integration, end-to-end or UI tests that reach it at its address (BASE_URL or the like), and Skyramp tests \u2014 and checks what the change itself alters, and mark runtime the clauses it checks, so it is verified against the app. So does a browser part the plan itself says goes untested, and a browser-only clause the repo has no in-process browser harness for.',"- A test that starts its own live server in the test process and drives it in a browser (Django's LiveServerTestCase or StaticLiveServerTestCase, pytest-django's live_server, with Selenium or Playwright) needs no deployed app: under targeted_unit it is maintained and run in-process, with the repo's CI settings and a headless browser.","- When the app cannot be run here, list each such journey's clauses under notInJourney, and each such test under gaps, with what is missing: it is reported not covered, never dropped. So is a browser-only clause with no in-process browser harness: name it under gaps with what is missing.","- Only what the change itself alters decides it. A journey or browser-only clause only for what the change could break elsewhere (a could-break requirement), or for UI code the change does not touch when it touches no UI code, does not make the decision runtime_required: off the runtime path list its clauses under notInJourney and the browser-only ones under gaps, with what is missing (a browser, downstream of this change), so it is reported not covered. Nor does a maintained test that calls the deployed app only for such clauses: give each maintained test the clauses it checks, and name such a test under gaps with what is missing (the running app, downstream of this change).","- blocked_preflight: the change cannot meet a basic prerequisite. It names the changed file the failure is in and quotes the error, and plans nothing. A check that fails for an environment reason (a dependency not installed, a missing tool) is not the change failing \u2014 never block on it.","","Rules:","- Every clause is planned, listed in gaps, or listed under outOfScope, by its id (R1a). A gap is evidence this run cannot obtain; a test this run will execute (existing_unit, new_unit, runtime) is not one, even when you could not run it while planning.","- Only accepted ci-<n> items, and passing checks you ran for prerequisite clauses, can establish a clause. A stale, untrusted, pending, failing or inconclusive result establishes nothing; a trusted result that failed is a reason to plan evidence, never a pass. AI review is advisory, never evidence.","- Find the existing tests yourself: where the repo keeps tests of the changed code, and their framework.",'- Existing tests that call a running app (API, contract, integration, end-to-end or UI tests) are never evidence: list them in "maintenance" (verify, or update).',"- Repository evidence is only native unit tests, which run without the app. Every repository evidence item lists its tests as repo-relative paths (path::test-name when the file holds more than the relevant ones) \u2014 only the tests that exercise the changed behavior, never the whole suite.",`- ${bj}`,`- ${uR}`,"- Every repository evidence item is run: cite it from an existing_unit item for the clauses it exercises. Only under existing_evidence_sufficient is nothing run: cite it from the existing_evidence item it supports instead.","- Plan new_unit only for what no existing test asserts, or asserts differently from the requirement (the boundary the change moved); never for what existing tests already prove.","- When the PR description or a spec states the expected behavior, plan evidence for what it states, not for what the code does.","- Evidence items are existing repository tests (source repository) and checks you ran with Bash (source testbot), each with a unique id; the ci-<n> results above are not restated. Run each check as one plain command \u2014 no `&&`, pipes or `echo` \u2014 and copy it into its evidence exactly. Don't start the application, install dependencies or run test suites for triage."])]}function cwr(t){let e=t.prepared,r=t.inputs.repositoryPath,n=e.preflight?.repository.currentBranch??"HEAD",s=e.preflight?.repository.baseBranch??t.inputs.baseBranch??"origin/main";return["Plan functional tests for this PR. You won't write the tests: another session will, working from your plan alone,","so whatever it needs has to be in the plan.","",`The repo is at ${r}, checked out on branch \`${n}\`. You can see the change with \`git diff ${s}...HEAD\`.`,"Ignore .skyramp/ \u2014 it is Skyramp's own setup, not part of the change.",...xAe(t),...Gl(t.inputs),...gmt(t.inputs),...ymt(t.inputs),"","1. Read the change: the diff, the description, and any spec, issue or design doc either of them points to.","2. List the requirements: everything the description or a spec states or clearly implies and, where they say"," nothing, what the change is evidently meant to do. Split each into independently testable clauses: each input"," class, boundary, error path, and anything that must stay unchanged. For each clause, write the expected outcome.",` Each requirement's id is the label the description or spec gives it ("AC-3", "REQ-12"; item 4 of a numbered list`," is R4), else R1, R2\u2026 in order, numbering on after the highest R-label the source uses (R6 after its R5). Where two"," items give the same label, put the item's key in front (PAY-184-AC1, PAY-185-AC1). A clause id is its"," requirement's id plus a letter (AC-3a), and each id is used once. Every case, clause and journey step keeps these"," ids and names a clause or finding the plan has; a finding names the requirement or clause it breaks."," Where the description or spec sets it, it wins over the code: if they disagree, the code is what's wrong. Where"," nothing is stated, take it from the change's evident intent; code that contradicts that intent, or itself"," elsewhere, is still a defect. Where the outcome is left open, expect only what any correct implementation must"," do, and say so."," Then list what the change could break that no requirement mentions \u2014 other callers of the functions it changed,"," other paths that read or write the same data, behaviour right next to the change \u2014 and add each as a requirement"," of its own (source could-break, evidence the code it could break), with its clauses.",' For each clause, give under "code" the path:line of the code that decides it, when there is one.',"3. Note every defect you find in the change, with the line that shows it.",...awr(t,e),"5. Only under runtime_required, and only for the clauses your triage marks runtime and the defects: write the test",' plan. Under any other decision leave "cases" empty and give no clause a test: the evidence'," comes from triage's plan."," Write the test plan on the clauses themselves: each clause gets the test that checks it (type, target, steps;",` its expected outcome is the clause's, and its kind the one the repo already uses for that code, unless that kind cannot check it), or, on the clause, why it can't be tested here. Add to "cases" a second`," test for a clause where one is needed, and one case for every defect you found \u2014 even where a clause's test"," covers the same ground. A defect's case reaches the defect itself (the state, input or sequence that shows it)"," and expects the correct behaviour, so it fails on this branch; where the requirement allows more than one correct"," outcome (reject, or cap), it accepts each of them, so it passes on any fix.",' Under every decision, list under "maintenance" the existing tests you can see the change makes wrong or stale,'," and whether to update, delete, regenerate or just re-run (verify) each \u2014 a starting point: the step that writes"," the tests runs the affected tests and finds the rest. One that calls the deployed app to check what the change itself alters makes the decision runtime_required (step 4); a live-server test, which runs in-process, does not.",...EAe(t),`6. Write the plan as JSON (below), "triage" included, to ${e.checkpoint} now, before anything is started.`,`7. ${rwr(t,e)}`,...owr(t,e),...iwr(t),"",`Stay inside the checkout and don't commit or push. When you're done, update ${e.checkpoint} with "app" filled in;`,"that file is what's read. End with a one-line final message \u2014 don't repeat the plan in it. The plan's JSON:","",yn(Hc,0,tW(t.inputs)?new Set:swr)].join(`
787
+ `)}var tW=t=>!!t.appRunning&&Lc(t),swr=new Set(["mutates"]);function iwr(t){return tW(t.inputs)?[" The app runs in a shared environment this policy protects. A case or clause whose test changes state there (an"," API POST, PUT, PATCH or DELETE, in the test or its setup, or a UI flow that submits, creates, edits or deletes) is"," withheld by the runner and reported as a gap: prefer cases that only read, and mark each that still changes state,",' and each such maintenance item, "mutates": true.']:[]}function owr(t,e){if(t.inputs.planOnly)return[];if(!t.inputs.appRunning&&e.preflight&&!e.preflight.sutRequired)return[];let r=qi.join(qi.dirname(e.checkpoint),"probe");return tW(t.inputs)?["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). It is a shared environment this policy protects: send only requests that change nothing (GET and"," HEAD: reads, lists, searches, filters, sorts) and never create, edit, delete, reset or seed anything there. Put",` every probe in one script under ${r}* and run it once, printing one line per probe: what it read, the status`," codes, and which check failed. Probe what the change touches through reads: every state its records can be in,"," every field it adds through list, sort, filter and search, and odd query values (zero, negative, huge, empty, case"," variants). Flag any 5xx, and reads that disagree with each other or with derived values (totals, counts).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case for it. Then write the updated plan to',` ${e.checkpoint} again.`]:["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). Put every probe in one",` script under ${r}* and run it once, printing one line per probe: what it did, the status codes, and which`," check failed. Probe what the change touches:"," - every state its records can be in (from the code's status fields and enums) \xD7 every operation the change adds or alters;"," - sequences: write then read back; set, reset, read; edit twice; delete then edit; write then list;"," - payloads: zero, negative, huge, empty, null, missing and extra fields, wrong types, case variants, more items"," than a page holds, one valid and one invalid item together;"," - every field the change adds, through the existing list, sort, filter and search."," Read the record before and after each action. Flag any 5xx; a rejected request that changed anything; a read that"," differs from what was written; a repeated request that changed something more; derived values (totals, counts)"," that disagree with their inputs; an operation that succeeds on a record in a final state (cancelled, shipped, deleted).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case whose steps are that request sequence and',` whose expected outcome is the correct behaviour. Then write the updated plan to ${e.checkpoint} again.`]}function Cmt(t){let e=Hn(t);return e?Qfe(Vu(e,"").map(r=>r.path)):[]}function EAe(t){let e=Cmt(t);if(!e.length&&!Lfe(t.inputs.repositoryPath))return[];let r=e.slice(0,8).join(", ")+(e.length>8?", \u2026":"");return[' User journeys: under "journeys", the flows a user walks through the UI, each from where a user normally starts it'," to the outcome they came for, that together pass through everything the change alters that a user sees or does:"," every ui clause is in some journey's steps (or under notInJourney, with why no journey reaches it). Use as many"," journeys as that takes. For each: the entry route; every step in order, with the clauses it exercises and what the user then sees;"," the outcome that shows the journey worked; its source \u2014 the spec or PR description that describes the flow (quote it),"," else inferred; and the test file it belongs in. Each becomes one test of the whole flow as the PR intends it (its kind):"," in-process only where the repo's own in-process UI tests (component tests under jsdom or the like, for that code) can"," walk and check all of it \u2014 a request-level test client (Django's, Flask's, Rails integration tests) runs no page script"," and does not count \u2014 else a browser test, which needs the running app, so the decision is runtime_required (step 4)."," The changed step is inside the flow, not the whole of it. The journey starts where the user starts the flow and"," gets to the changed step through the page: what an earlier step of the same flow creates (the record a change then"," edits) the journey creates through the app's own form, not through the API. That is for the journey only: the other"," cases keep using the records the app already has wherever the change reads or edits existing data, since a record"," made fresh for the test can hide a defect that shows only on older data. The journey ends where the user sees the result,"," which may be past the changed page: the next page built from what was saved, or a record it links to. After a"," change that saves something, a step reloads or reopens it and checks it held. Code that decides what a page shows"," counts though no page changed (a composable, store, hook, style or theme it renders from): what the user then sees"," is in a journey, whatever unit test also checks it."," A repo with no browser tests is no reason to leave a clause out: its browser journeys go in a test package of their own."," Empty when the change alters nothing a user sees; then say so under notInJourney, per clause, with why. A change"," to UI code that alters what the page holds along a user flow (a DOM attribute, the theme, other client state the"," flow sets) owes a journey that asserts it, even when nothing in the repo reads it yet: that nothing reads it, or"," that the user cannot see it, is no reason to leave it out.",...e.length?[` The change touches UI files: ${r}.`]:[]]}function awr(t,e){let{budgetMinutes:r}=t.inputs;return["4. Validation triage, before anything is started: decide what evidence each clause still needs and the cheapest",' reliable way to get it, and save it as "triage" (its behaviorIds are your clause ids). The app is brought up only'," when the decision is runtime_required; existing evidence or native unit tests can often validate a change"," without it. You are not a code reviewer here: no style, naming or architecture commentary.","",...(s=>s.flatMap(i=>i.split(`
788
+ `)).map(i=>i?` ${i}`:""))([...vge(t,e.triage.change),"",...Rge(t,e.triage),...r?["",`Run budget: ${r} minutes for the whole run, including everything you plan. Name in gaps what it cannot cover.`]:[],"","Scope: validate what this change alters or newly reaches, and what the PR description or a spec states.","- Out of scope is only a clause the change cannot reach: its deciding code is unchanged and no changed path leads to it, or it lives in a checkout the change does not touch. List it under outOfScope with the unchanged line that decides it (path:line), and plan nothing for it. Code the change newly calls or feeds new values to is in scope, and so is a defect it exposes there.","","The evidence ladder \u2014 use the cheapest mechanism that establishes each clause in scope:"," existing_evidence an accepted ci-<n> result. A check you ran (typecheck, compile, test collection) establishes only a prerequisite clause \u2014 that the change builds or its config parses \u2014 never a behaviour"," unaffected the change cannot reach this clause: no changed code path leads to it \u2014 cite the code that shows it (path:line); never for a clause decided in a changed file"," existing_unit existing native unit tests that exercise the clause"," new_unit a new in-process test, for evidence nothing provides yet"," runtime only the running application can establish it","A clause only the running app can check is runtime, not a gap, even when every other clause is in-process. It is a gap only when the app cannot be run here; then name what is missing.","Give each clause the kind of test the repo already uses for the code it checks \u2014 in-process where the repo tests that code in-process, runtime where it tests it against the running app \u2014 unless that kind cannot check it; then the kind that can.",`Browser-only: for every clause, ask whether its behaviour happens only in a browser \u2014 real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript \u2014 and if so mark it browserOnly. A test that only checks markup (a class or attribute present, the HTML a request returns) proves the precondition, not the behaviour: the header having the sort class does not show that "clicking a column header sorts the list". A browser-only clause is tested in a browser: in the repo's in-process browser harness where it has one \u2014 a Django LiveServerTestCase or StaticLiveServerTestCase, or pytest-django live_server, suite that drives Selenium or Playwright; component tests under jsdom only when the repo's own jsdom tests already drive that kind of interaction \u2014 named as its browserHarness (the suite's path), and the clause stays new_unit, with its triage item's covers saying it is driven in that browser suite; else decide runtime_required with a browser test of it. A markup check may be added, not substituted.`,"","Decisions:","- existing_evidence_sufficient means every clause in scope is established by existing evidence, with no gaps.","- targeted_unit plans unit tests and nothing that needs a running app.","- runtime_required marks at least one clause runtime, and plans no new unit tests: once the app is needed, this plan's cases are every new test, each still written the way the repo tests that code \u2014 in-process where that can check its clause, in the browser only where it cannot. The existing unit tests you identify still run, as existing_unit.","- The journeys and maintenance of step 5 can need the app too, so plan them before you decide. Decide runtime_required when any journey needs a browser \u2014 real JavaScript or htmx behaviour, navigation across pages, what persists after a reload, or a server-rendered page the repo tests only at the request level \u2014 and mark runtime the clauses its steps exercise.",'- Decide runtime_required as well when any test under "maintenance" calls the deployed app \u2014 API, contract, integration, end-to-end or UI tests that reach it at its address (BASE_URL or the like), and Skyramp tests \u2014 and checks what the change itself alters, and mark runtime the clauses it checks, so it is verified against the app. So does a browser part the plan itself says goes untested, and a browser-only clause the repo has no in-process browser harness for.',"- A test that starts its own live server in the test process and drives it in a browser (Django's LiveServerTestCase or StaticLiveServerTestCase, pytest-django's live_server, with Selenium or Playwright) needs no deployed app: under targeted_unit it is maintained and run in-process, with the repo's CI settings and a headless browser.","- When the app cannot be run here, list each such journey's clauses under notInJourney, and each such test under gaps, with what is missing: it is reported not covered, never dropped. So is a browser-only clause with no in-process browser harness: name it under gaps with what is missing.","- Only what the change itself alters decides it. A journey or browser-only clause only for what the change could break elsewhere (a could-break requirement), or for UI code the change does not touch when it touches no UI code, does not make the decision runtime_required: off the runtime path list its clauses under notInJourney and the browser-only ones under gaps, with what is missing (a browser, downstream of this change), so it is reported not covered. Nor does a maintained test that calls the deployed app only for such clauses: give each maintained test the clauses it checks, and name such a test under gaps with what is missing (the running app, downstream of this change).","- blocked_preflight: the change cannot meet a basic prerequisite. It names the changed file the failure is in and quotes the error, and plans nothing. A check that fails for an environment reason (a dependency not installed, a missing tool) is not the change failing \u2014 never block on it.","","Rules:","- Every clause is planned, listed in gaps, or listed under outOfScope, by its id (R1a). A gap is evidence this run cannot obtain; a test this run will execute (existing_unit, new_unit, runtime) is not one, even when you could not run it while planning.","- Only accepted ci-<n> items, and passing checks you ran for prerequisite clauses, can establish a clause. A stale, untrusted, pending, failing or inconclusive result establishes nothing; a trusted result that failed is a reason to plan evidence, never a pass. AI review is advisory, never evidence.","- Find the existing tests yourself: where the repo keeps tests of the changed code, and their framework.",'- Existing tests that call a running app (API, contract, integration, end-to-end or UI tests) are never evidence: list them in "maintenance" (verify, or update).',"- Repository evidence is only native unit tests, which run without the app. Every repository evidence item lists its tests as repo-relative paths (path::test-name when the file holds more than the relevant ones) \u2014 only the tests that exercise the changed behavior, never the whole suite.",`- ${bj}`,`- ${uR}`,"- Every repository evidence item is run: cite it from an existing_unit item for the clauses it exercises. Only under existing_evidence_sufficient is nothing run: cite it from the existing_evidence item it supports instead.","- Plan new_unit only for what no existing test asserts, or asserts differently from the requirement (the boundary the change moved); never for what existing tests already prove.","- When the PR description or a spec states the expected behavior, plan evidence for what it states, not for what the code does.","- Evidence items are existing repository tests (source repository) and checks you ran with Bash (source testbot), each with a unique id; the ci-<n> results above are not restated. Run each check as one plain command \u2014 no `&&`, pipes or `echo` \u2014 and copy it into its evidence exactly. Don't start the application, install dependencies or run test suites for triage."])]}function cwr(t){let e=t.prepared,r=t.inputs.repositoryPath,n=e.preflight?.repository.currentBranch??"HEAD",s=e.preflight?.repository.baseBranch??t.inputs.baseBranch??"origin/main";return["Plan functional tests for this PR. You won't write the tests: another session will, working from your plan alone,","so whatever it needs has to be in the plan.","",`The repo is at ${r}, checked out on branch \`${n}\`. You can see the change with \`git diff ${s}...HEAD\`.`,"Ignore .skyramp/ \u2014 it is Skyramp's own setup, not part of the change.",...xAe(t),...Gl(t.inputs),...gmt(t.inputs),...ymt(t.inputs),"","1. Read the change: the diff, the description, and any spec, issue or design doc either of them points to.","2. List the requirements: everything the description or a spec states or clearly implies and, where they say"," nothing, what the change is evidently meant to do. Split each into independently testable clauses: each input"," class, boundary, error path, and anything that must stay unchanged. For each clause, write the expected outcome.",` Each requirement's id is the label the description or spec gives it ("AC-3", "REQ-12"; item 4 of a numbered list`," is R4), else R1, R2\u2026 in order, numbering on after the highest R-label the source uses (R6 after its R5). Where two"," items give the same label, put the item's key in front (PAY-184-AC1, PAY-185-AC1). A clause id is its"," requirement's id plus a letter (AC-3a), and each id is used once. Every case, clause and journey step keeps these"," ids and names a clause or finding the plan has; a finding names the requirement or clause it breaks."," Where the description or spec sets it, it wins over the code: if they disagree, the code is what's wrong. Where"," nothing is stated, take it from the change's evident intent; code that contradicts that intent, or itself"," elsewhere, is still a defect. Where the outcome is left open, expect only what any correct implementation must"," do, and say so."," Then list what the change could break that no requirement mentions \u2014 other callers of the functions it changed,"," other paths that read or write the same data, behaviour right next to the change \u2014 and add each as a requirement"," of its own (source could-break, evidence the code it could break), with its clauses.",' For each clause, give under "code" the path:line of the code that decides it, when there is one.',"3. Note every defect you find in the change, with the line that shows it. Compare the change with the code beside it"," that does the same job \u2014 other routes answering the same kind of request, other reads of the same data, the other"," layer handling the same value, other code that copies the same record: where they handle a case the change handles"," differently (how a malformed id is answered, who may act, what a read leaves out, whether a value's case matters,"," which fields a copy carries), the change is wrong unless the description asks for the difference. On each page the"," change touches, follow what the user sees when its request fails, when they enter a value it refuses, and right"," after a save, without a reload.",...awr(t,e),"5. Only under runtime_required, and only for the clauses your triage marks runtime and the defects: write the test",' plan. Under any other decision leave "cases" empty and give no clause a test: the evidence'," comes from triage's plan."," Write the test plan on the clauses themselves: each clause gets the test that checks it (type, target, steps;",` its expected outcome is the clause's, and its kind the one the repo already uses for that code, unless that kind cannot check it), or, on the clause, why it can't be tested here. Add to "cases" a second`," test for a clause where one is needed, and one case for every defect you found \u2014 even where a clause's test"," covers the same ground. A defect's case reaches the defect itself (the state, input or sequence that shows it)"," and expects the correct behaviour, so it fails on this branch; where the requirement allows more than one correct"," outcome (reject, or cap), it accepts each of them, so it passes on any fix.",' Under every decision, list under "maintenance" the existing tests you can see the change makes wrong or stale,'," and whether to update, delete, regenerate or just re-run (verify) each \u2014 a starting point: the step that writes"," the tests runs the affected tests and finds the rest. One that calls the deployed app to check what the change itself alters makes the decision runtime_required (step 4); a live-server test, which runs in-process, does not.",...EAe(t),`6. Write the plan as JSON (below), "triage" included, to ${e.checkpoint} now, before anything is started.`,`7. ${rwr(t,e)}`,...owr(t,e),...iwr(t),"",`Stay inside the checkout and don't commit or push. When you're done, update ${e.checkpoint} with "app" filled in;`,"that file is what's read. End with a one-line final message \u2014 don't repeat the plan in it. The plan's JSON:","",yn(Hc,0,tW(t.inputs)?new Set:swr)].join(`
789
789
  `)}function XV(t,e,r){let n=qi.join(t.outputsDir,e);return ZV.writeFileSync(n,JSON.stringify(Xr(r,t.secretValues??[]),null,2)+`
790
790
  `),qi.relative(t.runDir,n)}function Imt(t){let e=t.prepared?.recipe??Vc(t.inputs.repositoryPath);return e.teardownScript?`bash ${qi.relative(t.inputs.repositoryPath,e.teardownScript)}`:void 0}function vmt(t,e){let r=Emt(e);r!==e&&cd(t).warn("[plan] the plan used an id more than once: renamed the later ones so each is kept");let n=kat(pAe(r,t.inputs.requirementItems),u=>cd(t).warn(`[plan] case id ${u} is used twice: kept one case and left out the other`)),s=$he(t,n.triage,!!n.app,uhe(n,ha(t.inputs.requirementItems))).length===0,i=!s||n.triage?.decision==="runtime_required",o=Bat(s?Pat(n):n,i),a=Hn(t),c=Oat(o,{repository:a?.repository??{path:t.inputs.repositoryPath,currentBranch:"HEAD",baseBranch:t.inputs.baseBranch??""},changedFiles:a?.changedFiles.map(u=>u.path)??[],nonApplicationOnly:a?.nonApplicationOnly??!1,defaultTeardown:Imt(t),itemNames:ha(t.inputs.requirementItems)}),l={plan:XV(t,"plan.json",o),analyze:XV(t,"analyze.json",c.analyze),recommend:XV(t,"recommend.json",tW(t.inputs)?nR(t.inputs,c.recommend):c.recommend)};return c.deploy&&(l.deploy=XV(t,"deploy.json",c.deploy)),s&&Object.assign(l,jct(t,o.triage)),l}var lwr={runtime_required:"validation triage: the change needs the running app \u2014 tests against it follow",targeted_unit:"validation triage: unit tests are enough \u2014 no app deployed",existing_evidence_sufficient:"validation triage: existing evidence is enough \u2014 no app deployed, no new tests",blocked_preflight:"validation triage: the change does not meet a prerequisite \u2014 nothing further runs"};function uwr(t){let e=ae(t,"triage.json");if(e)return lwr[e.decision];let r=ae(t,"plan.json");return r?$he(t,r.triage,!!r.app)[0]:void 0}async function dwr(t,e){let r=t.inputs.sharedEnvironment;if(!t.inputs.appRunning||!K_(r))return{};let n=await nj(r,[],e,t.secretValues??[],t.platform,await Cfe(t,r));return tr(t,da,Xr(n,t.secretValues??[]),[])}function pwr(t,e){let r=gD(qi.join(eW(t),wAe)),n=vj(Hc,[...e.map(s=>s.session?.stdout).reverse(),r,_at(r)]);return n?vmt(t,n):void 0}function mwr(t){if(t.inputs.appRunning||t.inputs.planOnly)return!1;let e=Hn(t);if(e&&!e.sutRequired)return!1;let r=ae(t,"plan.json");return!(r?.triage&&!kR(r.triage.plan)&&!r.app)}function xmt(t){if(!mwr(t))return;let e=ae(t,"deploy.json")?.teardown??Imt(t);!e||e==="true"||(0,Smt.spawnSync)(e,{shell:!0,cwd:t.inputs.repositoryPath,env:wt(),timeout:12e4,stdio:"ignore"})}var Rmt="plan-triage-grounded",fwr={name:Rmt,verify(t,e){let{value:r}=$i(Hc,e.stdout,Om(t),t.secretValues);if(!r)return{name:this.name,passed:!0};let n=pAe(r,t.inputs.requirementItems),s=Uhe(t,n.triage,!!n.app,uhe(n,ha(t.inputs.requirementItems)));return s.length?{name:this.name,passed:!1,details:s.join("; "),repairable:!0}:{name:this.name,passed:!0}}},Nmt="plan-journeys",hwr=[/\b(?:no|without|lacks?|missing)\b[^.;:]{0,30}\b(?:browser|e2e|end-to-end|playwright|cypress|selenium|ui|frontend|front-end)\b[^.;:]{0,30}\b(?:tests?|harness|runner|setup|framework|installed|suite)\b/i,/\bno\s+(?:tests?|harness)\s+(?:for|of)\s+the\s+(?:ui|frontend|front-end|browser|pages?)\b/i],gwr=/\b(?:credentials?|log[- ]?ins?|sso|auth\w*|accounts?|seed(?:ed)?|external|third[- ]party|api[- ]keys?|secrets?|tokens?|observ\w*|visible|shows?|logs?|reach\w*|unreachable|behind|admin\w*|licen[cs]e\w*|hardware|devices?|e-?mail|sms|payment|stripe|host[- ]app|embedd\w*)\b/i,Awr=t=>hwr.some(e=>e.test(t))&&!gwr.test(t),ywr=/\b(?:not|never|isn'?t|aren'?t)\s+(?:visible|seen|shown|user[- ]visible)\b|\binvisible\b|\bno\s+(?:user[- ])?visible\b|\b(?:user|nobody|no one)\s+sees\s+no(?:thing)?\b|\bnothing\s+(?:a|the)\s+user\s+sees\b|\bnothing\b[^.;]{0,40}\b(?:styles?|reads?|renders?|consumes?|uses?)\b|\bno\s+(?:css|style|component|rendering)\b[^.;]{0,40}\b(?:reads?|consumes?|depends?|uses?)\b/i,bwr=/\b(?:not reachable|unreachable|no (?:route|page|screen|flow|path|link) (?:reaches|renders|opens|leads to)|(?:rendered|used|mounted) only (?:by|in|from)\b[^;]{0,100}\bnothing (?:in the app )?(?:renders|uses|mounts))/i;function Ewr(t){let e=!1,r=[];for(let n of t){let s=n.why??"",i=!bwr.test(s)&&(ywr.test(s)||/^\s*same\b/i.test(s)&&e);i&&r.push(n.clause),e=i}return r}function wwr(t,e){let r=e.trim().replace(/^\.\//,""),n=(t.inputs.relatedRepos??[]).find(s=>r.startsWith(`${bAe(s)}/`));return n?{root:n.path,rel:r.slice(bAe(n).length+1)}:{root:t.inputs.repositoryPath,rel:r}}var xwr={name:Nmt,verify(t,e){let{value:r}=$i(Hc,e.stdout,Om(t),t.secretValues);if(!r)return{name:this.name,passed:!0};let n=!r.triage||r.triage.decision==="runtime_required",s=r.requirements.flatMap(E=>E.clauses),i=new Set([...r.cases.map(E=>E.id),...s.map(E=>E.id)]),o=[...Gw(t.inputs),...(t.inputs.relatedRepos??[]).map(E=>({body:E.prDescription??""}))],a={takenIds:i,clauses:new Set(s.map(E=>E.id)),uiClauses:EAe(t).length?s.filter(E=>E.type==="ui"&&!E.skip?.trim()).map(E=>E.id):[],notInJourney:new Set((r.notInJourney??[]).map(E=>E.clause)),quoted:E=>oD(o,E)},c=Hn(t),l=c?Vu(c,"").map(E=>E.path):[],u=n?[]:cmt(r,{locate:E=>wwr(t,E),runtimePossible:!!t.inputs.appRunning||c?.sutRequired!==!1,...c?{own:amt(r,l,Qfe(l).length>0)}:{}}),d=n?r.journeys:(r.journeys??[]).filter(E=>E.kind==="in-process"),p=(r.notInJourney??[]).filter(E=>Awr(E.why??"")).map(E=>`clause ${E.clause} is under notInJourney because the repo has no browser tests, which is no reason to leave it out: put it in a journey \u2014 in-process where the repo's in-process tests can walk and check it, else a browser test in a test package of its own (decide runtime_required)`),m=EAe(t).length?Cmt(t):[],f=m.length&&!(r.journeys??[]).length&&!(r.notInJourney??[]).length?[`the change touches UI code (${m.slice(0,5).join(", ")}) and the plan has no journey: plan the journey through what a user then sees change, or, if the change alters nothing a user sees, list its clauses under notInJourney with why`]:[],h=m.length&&Lfe(t.inputs.repositoryPath)?Ewr(r.notInJourney??[]).map(E=>`clause ${E} is under notInJourney because nothing reads it or the user cannot see it, and the change touches UI code: a change to UI code that alters what the page holds along a user flow owes a journey that asserts it, even when nothing reads it yet \u2014 put the clause in that flow's journey, at the step that sets it, and assert it there`):[],A=[...u,...p,...f,...h,...Not(d,a)];return A.length?{name:this.name,passed:!1,details:A.join("; "),repairable:!0}:{name:this.name,passed:!0}}},Tmt="plan-requirements-grounded",Swr={name:Tmt,async verify(t,e){let{value:r}=$i(Hc,e.stdout,Om(t),t.secretValues);if(!r)return{name:this.name,passed:!0};t.reviewItemFile&&await umt(r,t.inputs.requirementItems,t.reviewItemFile);let n=Upt(r,t.inputs.requirementItems);return n.length?{name:this.name,passed:!1,repairable:!0,droppable:n.map(({id:s})=>s),details:n.map(({id:s,why:i})=>`${s}: ${i}`).join("; ")}:{name:this.name,passed:!0}}};function Cwr(t,e,r){let n=r.some(a=>a.name===Tmt)?`Repair "requirements" in ${Om(t)}: give each requirement-reference requirement its item's key as "reference" and, as evidence, words copied exactly from that item's file. A requirement no item states is not requirement-reference. One that still does not hold is dropped.`:void 0,s=r.some(a=>a.name===Nmt)?`Repair "journeys" in ${Om(t)} as named above: each needs an entry route, at least two steps each saying what the user then sees, the outcome and a test file, and every ui clause is in some journey's steps or under notInJourney. Where a journey, maintained test or browser-only clause above needs the running app, decide runtime_required in "triage" and mark runtime the clauses it checks (keep existing_unit for the existing unit tests, and make new_unit clauses runtime).`:void 0,i=r.some(a=>a.name===yAe)?`Repair the ids in ${Om(t)} as named above and keep the rest of the plan: each id is used once (where two items give the same label, put the item's key in front: PAY-185-AC1; unlabelled requirements number on after the highest R-label), a clause id is its requirement's id plus a letter, every case, clause and journey step names a clause or finding the plan has, and a finding names the requirement or clause it breaks.`:void 0,o=Iwr(t,e,r);return[n,i,o,s].filter(Boolean).join(`
791
791
  `)||void 0}function Iwr(t,e,r){let n=r.filter(o=>o.name===Rmt);if(!n.length)return;let s=Nge(t,e,n),i=n.some(o=>/brought the app up/.test(o.details??""))?['Only runtime_required starts the app: when a clause needs it, decide runtime_required and mark that clause runtime; when none does, stop what you started and remove "app" from the plan.']:[];return[`Repair "triage" in ${Om(t)} and keep the rest of the plan: its behaviorIds are your clause ids.`,...i,...s?[s]:[]].join(`
@@ -795,7 +795,7 @@ ${nwr(t,e)}`}function nwr(t,e){if(t.inputs.appRunning)return[`${t.inputs.appRunn
795
795
  `;)i++;continue}if(!s&&u==="/"&&t[i+1]==="*"){let d=t.indexOf("*/",i+2),p=d<0?n:d+2;for(let m=i;m<p;m++)t[m]===`
796
796
  `&&c(m);i=p;continue}if(u==='"'||u==="'"||u==="`"){let d={line:o,col:i-a},p=s&&t.startsWith(u.repeat(3),i)?3:1,m=l(i,u),f=t.slice(i+p,Math.max(i+p,m-p));r.push({kind:"s",text:f,...d,template:u==="`"&&e==="js"&&f.includes("${")}),i=m;continue}if(/[A-Za-z_$]/.test(u)){let d=i+1;for(;d<n&&/[\w$]/.test(t[d]);)d++;let p=t.slice(i,d);if(s&&Twr.test(p)&&(t[d]==='"'||t[d]==="'")){i=d;continue}r.push({kind:"i",text:p,line:o,col:i-a}),i=d;continue}if(/\d/.test(u)){let d=i+1;for(;d<n&&/[\w.]/.test(t[d]);)d++;r.push({kind:"n",text:t.slice(i,d),line:o,col:i-a}),i=d;continue}r.push({kind:"p",text:u,line:o,col:i-a}),i++}return r}var Bwr={"(":")","[":"]","{":"}"};function Uh(t,e){let r=t[e].text,n=Bwr[r],s=0;for(let i=e;i<t.length;i++){let o=t[i];if(o.kind==="p"){if(o.text===r)s++;else if(o.text===n&&--s===0)return i}}return-1}var $h=(t,e)=>e===0||t[e-1].line<t[e].line;function CAe(t,e,r){let n=[],s=0,i=!0;for(let o=e+1;o<r;o++){let a=t[o];a.kind==="p"&&"([{<".includes(a.text)?s++:a.kind==="p"&&")]}>".includes(a.text)?s=Math.max(0,s-1):s===0&&a.text===","?i=!0:s===0&&i&&a.kind==="i"&&!["public","private","protected","readonly"].includes(a.text)&&(n.push(a.text),i=!1)}return n}function Pwr(t,e){let r=new Map;for(let n=0;n+2<t.length;n++){let[s,i,o]=[t[n],t[n+1],t[n+2]];if(s.kind!=="i"||i.text!=="="||o.kind!=="s"||o.template)continue;let a=e==="py"?$h(t,n)&&s.col===0:t[n-1]?.text==="const",c=t[n+3];a&&(!c||c.line>o.line||c.text===";")&&r.set(s.text,o.text)}return r}function IAe(t,e,r,n,s,i){let o=new Map(n.map((u,d)=>[u,`$${d}`])),a=[],c=e;for(i==="py"&&t[c]?.kind==="s"&&(c+1>=r||t[c+1].line>t[c].line)&&c++;c<r;c++){let u=t[c];if(u.kind==="s"){let d=u.template?u.text.replace(/\$\{\s*([A-Za-z_$][\w$]*)\s*\}/g,(p,m)=>s.get(m)??(o.has(m)?`\${${o.get(m)}}`:p)):u.text;a.push(JSON.stringify(d))}else u.kind==="i"&&t[c-1]?.text!=="."?a.push(o.get(u.text)??(s.has(u.text)?JSON.stringify(s.get(u.text)):u.text)):a.push(u.text)}return{key:a.filter(u=>u!==";").join(" ").replace(/ , (?=[)\]}])/g," "),size:a.length}}function Dmt(t,e){let r=0,n=0;for(let s=e;s<t.length;s++){let i=t[s].text;if(i==="<")r++;else if(i===">"&&t[s-1]?.text!=="=")r=Math.max(0,r-1);else if(i==="(")n++;else if(i===")")n--;else{if(i==="{"&&r===0&&n===0)return s;if(i===";"||i==="="&&t[s+1]?.text!==">")return-1}}return-1}function _wr(t,e){return t.kind==="p"&&!")]}".includes(t.text)||e.kind==="p"&&".?:&|+-*/<>=".includes(e.text)}function Dwr(t,e){let r=0;for(let n=e;n<t.length;n++){let s=t[n];if(s.kind==="p"&&"([{".includes(s.text))r++;else if(s.kind==="p"&&")]}".includes(s.text)){if(r===0)return n;r--}else if(r===0&&(s.text===";"||s.text===","||n>e&&s.line>t[n-1].line&&!_wr(t[n-1],s)))return n}return t.length}function Omt(t){let e=new Set,r=n=>{let s=Uh(t,n);for(let i=n+1;i>0&&i<s;i++){let o=t[i];o.kind!=="i"||t[i-1]?.text==="as"||t[i-1]?.text===":"||[",","}",":","as"].includes(t[i+1]?.text)&&e.add(o.text)}};for(let n=0;n<t.length;n++){let s=t[n].text;s==="export"&&t[n+1]?.text==="{"&&r(n+1),s==="exports"&&t[n+1]?.text==="="&&t[n+2]?.text==="{"&&r(n+2),s==="exports"&&t[n+1]?.text==="."&&t[n+2]?.kind==="i"&&e.add(t[n+2].text)}return e}function Owr(t,e){let r=[],n=Omt(t),s=o=>{for(let a=o-1;a>=Math.max(0,o-4);a--){if(t[a].text==="export")return!0;if(!["default","async","function","*","const","let","var"].includes(t[a].text))return!1}return!1},i=(o,a,c,l,u)=>{let d=t[o].text,{key:p,size:m}=IAe(t,l,u,CAe(t,a,c),e,"js");r.push({name:d,line:t[o].line,exported:s(o)||n.has(d),key:p,size:m})};for(let o=0;o<t.length;o++){let a=t[o];if(a.kind==="i"){if(a.text==="function"){let c=o+1;if(t[c]?.text==="*"&&c++,t[c]?.kind!=="i")continue;let l=c++;if(t[c]?.text==="<")for(;c<t.length&&t[c].text!=="(";)c++;if(t[c]?.text!=="(")continue;let u=Uh(t,c),d=u<0?-1:Dmt(t,u+1),p=d<0?-1:Uh(t,d);p>0&&i(l,c,u,d+1,p);continue}if((a.text==="const"||a.text==="let"||a.text==="var")&&t[o+1]?.kind==="i"){let c=o+1,l=o+2;if(t[l]?.text===":")for(;l<t.length&&t[l].text!=="="&&t[l].line===t[c].line;)l++;if(t[l]?.text!=="=")continue;l++,t[l]?.text==="async"&&l++;let u,d;if(t[l]?.text==="("){if(u=l,d=Uh(t,l),d<0)continue}else if(t[l]?.kind==="i"&&t[l+1]?.text==="="&&t[l+2]?.text===">")u=l-1,d=l+1;else continue;let p=d+1;if(t[p]?.text===":")for(;p<t.length&&!(t[p].text==="="&&t[p+1]?.text===">")&&t[p].text!==";";)p++;if(t[p]?.text!=="="||t[p+1]?.text!==">")continue;if(p+=2,t[p]?.text==="{"){let m=Uh(t,p);m>0&&i(c,u,d,p+1,m)}else i(c,u,d,p,Dwr(t,p))}}}return r}function Mwr(t,e){let r=[];for(let n=0;n<t.length;n++){if(t[n].text!=="def"||t[n+1]?.kind!=="i"||t[n+2]?.text!=="(")continue;let s=t[n-1]?.text==="async"&&$h(t,n-1);if(!s&&!$h(t,n))continue;let i=t[s?n-1:n].col,o=Uh(t,n+2);if(o<0)continue;let a=o+1;for(;a<t.length&&t[a].text!==":";)a++;let c=a+1;for(;c<t.length&&!($h(t,c)&&t[c].line>t[a].line&&t[c].col<=i);)c++;let l=CAe(t,n+2,o).filter(m=>m!=="self"&&m!=="cls"),{key:u,size:d}=IAe(t,a+1,c,l,e,"py"),p=t[n+1].text;r.push({name:p,line:t[n+1].line,exported:i===0&&!p.startsWith("_"),key:u,size:d})}return r}function Qwr(t,e){let r=[];for(let n=0;n<t.length;n++){if(t[n].text!=="func"||!$h(t,n))continue;let s=n+1;if(t[s]?.text==="("&&(s=Uh(t,s)+1),s<=0||t[s]?.kind!=="i"||t[s+1]?.text!=="(")continue;let i=Uh(t,s+1),o=i<0?-1:Dmt(t,i+1),a=o<0?-1:Uh(t,o);if(a<0)continue;let{key:c,size:l}=IAe(t,o+1,a,CAe(t,s+1,i),e,"go");r.push({name:t[s].text,line:t[s].line,exported:/^[A-Z]/.test(t[s].text),key:c,size:l})}return r}function Lwr(t,e){let r=[],n=[];if(e==="js"){for(let s=0;s<t.length;s++){if(t[s].text!=="import"||!$h(t,s)||t[s+1]?.text==="(")continue;let i=s+1;for(;i<t.length&&t[i].kind!=="s"&&t[i].text!==";";)i++;if(t[i]?.kind==="s"&&(n.push([s,i]),t[s+1]?.text!=="type"))for(let o=s+1;o<i;o++){let a=t[o];a.kind!=="i"||["from","as","type"].includes(a.text)||t[o-1]?.text==="type"||t[o+1]?.text!=="as"&&r.push({local:a.text,from:t[i].text,line:a.line})}}for(let s=0;s<t.length;s++){if(t[s].text!=="require"||t[s+1]?.text!=="("||t[s+2]?.kind!=="s"||t[s+3]?.text!==")"||t[s-1]?.text!=="=")continue;let i=t[s+2].text,o=s-2;if(t[o]?.kind==="i"&&["const","let","var"].includes(t[o-1]?.text)){n.push([o-1,s+3]),r.push({local:t[o].text,from:i,line:t[o].line});continue}if(t[o]?.text!=="}")continue;let a=o;for(let c=0;a>=0;a--)if(t[a].text==="}")c++;else if(t[a].text==="{"&&--c===0)break;if(!(a<1||!["const","let","var"].includes(t[a-1].text))){n.push([a-1,s+3]);for(let c=a+1;c<o;c++)t[c].kind==="i"&&t[c+1]?.text!==":"&&r.push({local:t[c].text,from:i,line:t[c].line})}}}else if(e==="py"){for(let s=0;s<t.length;s++){if(t[s].text!=="from"||!$h(t,s))continue;let i=s+1,o="";for(;i<t.length&&t[i].text!=="import"&&t[i].line===t[s].line;)o+=t[i++].text;if(t[i]?.text!=="import")continue;let a=t[i+1]?.text==="(",c=i+1;for(;c<t.length&&!(a?t[c].text===")":t[c].line>t[i].line&&t[c-1].text!=="\\");)c++;n.push([s,a?c:c-1]);for(let l=i+1;l<c;l++){let u=t[l];u.kind!=="i"||u.text==="as"||t[l+1]?.text==="as"||r.push({local:u.text,from:o,line:u.line})}}for(let s=0;s<t.length;s++){if(t[s].text!=="import"||!$h(t,s))continue;let i=s+1;for(;i<t.length&&t[i].line===t[s].line;){let o="",a=t[i];for(;i<t.length&&t[i].line===t[s].line&&t[i].text!==","&&t[i].text!=="as";)o+=t[i++].text;let c=a?.kind==="i"?a.text:"";t[i]?.text==="as"&&t[i+1]?.kind==="i"&&(c=t[i+1].text,i+=2),c&&o&&r.push({local:c,from:o,line:a.line}),t[i]?.text===","&&i++}n.push([s,i-1])}}return{imports:r,spans:n}}function Fwr(t,e,r){let n=new Set(r.map(s=>s.from));if(e==="js")for(let s=0;s<t.length;s++){let i=t[s];if(i.kind!=="s")continue;let o=t[s-1]?.text;(o==="from"||o==="import"&&t[s-1]?.kind==="i"||o==="("&&["require","import"].includes(t[s-2]?.text??"")&&t[s+1]?.text===")")&&n.add(i.text)}return[...n]}function Uwr(t,e){let r=0;for(let n=0;n<t.length;n++){if(t[n].kind!=="i"||t[n].text!=="class")continue;let s=t[n+1];(e==="py"?$h(t,n)&&s?.kind==="i":s&&(s.kind==="i"||s.text==="{"))&&r++}return r}function YR(t,e){let r=qh(e);if(!r)return;let n=kwr(t,r),s=Pwr(n,r),i=r==="js"?Owr(n,s):r==="py"?Mwr(n,s):Qwr(n,s),{imports:o,spans:a}=Lwr(n,r),c=new Map,l=d=>c.set(d,(c.get(d)??0)+1),u=0;for(let d=0;d<n.length;d++){for(;u<a.length&&d>a[u][1];)u++;if(u<a.length&&d>=a[u][0])continue;let p=n[d];if(p.kind==="i")l(p.text);else if(p.kind==="s"&&(p.template||r==="py"&&p.text.includes("{")))for(let m of p.text.matchAll(/\{[^{}]*\}/g))for(let f of m[0].matchAll(/[A-Za-z_$][\w$]*/g))l(f[0])}return{lang:r,functions:i,imports:o,uses:c,listedExports:r==="js"?Omt(n):new Set,deps:Fwr(n,r,o),classes:r==="go"?0:Uwr(n,r)}}var qwr=15,Hwr=6,xx=t=>ua.test(t),zwr=/utils?|skyramp/i,Gwr=/utils?/i,JR=t=>fr.posix.basename(t).replace(/\.[^.]+$/,""),jwr=/^(conftest\.py|__init__\.py|[^/]*\.config\.[cm]?[jt]s|[^/]+\.(setup|teardown)\.[cm]?[jt]sx?|setupTests\.[cm]?[jt]sx?)$/i,Vwr=/^([\w.-]+\.config\.([cm]?[jt]s|json)|package\.json|pytest\.ini|pyproject\.toml|setup\.cfg|tox\.ini)$/i,Mmt=t=>t.replace(/\.([cm]?[jt]sx?|py)$/,"");function Wwr(t,e){let r=Mmt(e),n=fr.posix.dirname(t.rel);return(t.text.match(/[\w@$.\-/]+/g)??[]).some(i=>{let o=i.replace(/^<rootDir>\//,"").replace(/[.,]+$/,"");if(!o)return!1;let a=Mmt(fr.posix.normalize(fr.posix.join(o.startsWith("/")?".":n,o.replace(/^\//,"")))),c=/^[A-Za-z_][\w.]*$/.test(o)&&o.includes(".")?o.replace(/\./g,"/"):void 0;return a===r||c!==void 0&&(c===r||fr.posix.join(n,c)===r)})}function Qmt(t,e){return jwr.test(fr.posix.basename(t))?!0:e.some(r=>Wwr(r,t))}var vAe=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"];function KR(t,e,r,n){let s=fr.posix.dirname(t),i=o=>o.map(a=>fr.posix.normalize(a)).find(a=>!a.startsWith("..")&&n(a));if(r==="js"){if(!e.startsWith("."))return;let o=fr.posix.join(s,e),a=o.replace(/\.[cm]?js$/,"");return i([o,...vAe.map(c=>o+c),...vAe.map(c=>a+c),...vAe.map(c=>`${o}/index${c}`)])}if(r==="py"){let o=e.match(/^\.*/)[0].length,a=e.slice(o).replace(/\./g,"/"),c=[];if(o){let l=s;for(let u=1;u<o;u++)l=fr.posix.dirname(l);c.push(l)}else for(let l=s;c.push(l),!(l==="."||l==="/"||l==="");l=fr.posix.dirname(l));return i(c.flatMap(l=>a?[`${l}/${a}.py`,`${l}/${a}/__init__.py`]:[`${l}/__init__.py`]))}}var Lmt=t=>`${t.rel}:${t.fn.line}`;function Ywr(t,e){return[...new Set(t.code.imports.map(r=>KR(t.rel,r.from,t.code.lang,e)).filter(r=>!!r&&!xx(r)))]}function Jwr(t){let e=T=>{let O=YR(T.text,T.rel);return O?{rel:T.rel,code:O,test:xx(T.rel)}:void 0},r=t.written.flatMap(T=>{let O=e(T),U=T.before===void 0?void 0:YR(T.before,T.rel);return O?[{...O,before:U,isNew:T.before===void 0,definesHelpers:O.code.functions.length>0||O.code.classes>0}]:[]}),n=t.existing.flatMap(T=>e(T)??[]),s=new Map([...n,...r].map(T=>[T.rel,T])),i=T=>s.has(T),o=[],a=new Map,c=T=>a.set(T.fn.key,[...a.get(T.fn.key)??[],T]);for(let T of n)for(let O of T.code.functions)c({rel:T.rel,fn:O,lang:T.code.lang,test:T.test});for(let T of r){let O=new Set(T.code.functions.map(U=>U.name));for(let U of T.before?.functions??[])O.has(U.name)&&c({rel:T.rel,fn:U,lang:T.code.lang,test:T.test})}let l=(T,O)=>T.key===O.key&&(T.size>=qwr||T.name===O.name&&T.size>=Hwr),u=(T,O)=>new Set((a.get(T.key)??[]).filter(U=>U.lang===O&&l(T,U.fn)).map(U=>U.rel)).size>=2,d=r.flatMap(T=>{let O=new Set((T.before?.functions??[]).map(U=>U.name));return T.code.functions.filter(U=>!O.has(U.name)).map(U=>({w:T,fn:U}))}),p=T=>{let O=T.flatMap(U=>Ywr(U,i)).find(U=>!r.some(J=>J.rel===U&&J.isNew));return O?`the repo's ${O}`:"the repo's shared test-support module (else a module beside the tests that use it, laid out the way the repo keeps its tests, named for what it holds)"},m=new Set;for(let{w:T,fn:O}of d){if(u(O,T.code.lang))continue;let U=(a.get(O.key)??[]).find(z=>z.lang===T.code.lang&&!(z.rel===T.rel&&z.fn.name===O.name)&&l(O,z.fn));if(!U)continue;m.add(O);let J=s.get(U.rel);U.fn.exported||!U.test?o.push(`${T.rel}:${O.line} ${O.name} copies ${U.fn.name} (${Lmt(U)}) \u2014 import ${U.fn.name} from there instead of defining it again`):o.push(`${T.rel}:${O.line} ${O.name} copies ${U.fn.name}, local to ${Lmt(U)} \u2014 move ${U.fn.name} into ${p([T,...J?[J]:[]])} and import it in both files; no second copy`)}let f=r.filter(T=>T.isNew&&!T.test),h=new Map;for(let{w:T,fn:O}of d){if(!T.test||m.has(O))continue;let U=f.find(Q=>Q.code.lang===T.code.lang&&Q.code.functions.some(L=>l(O,L))),J=U?.code.functions.find(Q=>l(O,Q));if(!U||!J)continue;m.add(O);let z=`${T.rel}:${O.line} ${O.name} copies ${J.name} (${U.rel}:${J.line}) \u2014 import ${J.name} from there instead of defining it again`,H=h.get(U.rel)??{tests:new Set,sent:[]};H.tests.add(T.rel),H.sent.push(z),h.set(U.rel,H),o.push(z)}let A=[],E=T=>XD(T).dir;for(let T of d){if(!T.w.test||m.has(T.fn)||u(T.fn,T.w.code.lang))continue;let O=A.find(U=>U[0].w.code.lang===T.w.code.lang&&E(U[0].w.rel)===E(T.w.rel)&&l(U[0].fn,T.fn));O?O.push(T):A.push([T])}for(let T of A){let O=[...new Map(T.map(U=>[U.w.rel,U.w])).values()];O.length<2||o.push(`${T[0].fn.name} is defined in ${O.length} test files (${O.map(U=>U.rel).join(", ")}) \u2014 define it once, in ${p(O)}, and import it from each`)}for(let T of r){let O=new Set((T.before?.imports??[]).map(U=>`${U.local}\0${U.from}`));for(let U of T.code.imports){if(O.has(`${U.local}\0${U.from}`)||(T.code.uses.get(U.local)??0)>0)continue;(U.from.startsWith(".")||KR(T.rel,U.from,T.code.lang,i)!==void 0)&&o.push(`${T.rel}:${U.line} imports ${U.local} from ${U.from} and never uses it \u2014 use it, or drop the import`)}}let y=new Map([...(t.otherTests??[]).flatMap(T=>e(T)??[]).map(T=>[T.rel,T]),...s]),w=T=>[...y.values()].filter(O=>O.rel!==T&&O.code.deps.some(U=>KR(O.rel,U,O.code.lang,i)===T)),C=n.filter(T=>!T.test&&(T.code.functions.length>0||T.code.classes>0)&&!Qmt(T.rel,t.configs??[])).map(T=>({rel:T.rel,users:w(T.rel).filter(O=>O.test&&!r.some(U=>U.rel===O.rel)).length})).filter(T=>T.users>0),v=C.filter(T=>T.users===1),k=T=>v.some(O=>fr.posix.dirname(O.rel)===fr.posix.dirname(T))||C.length>0&&v.length*2>=C.length,N=new Set;for(let T of r){if(!T.isNew||T.test||!T.definesHelpers||Qmt(T.rel,t.configs??[])||k(T.rel))continue;let O=w(T.rel);if(O.some(H=>!H.test))continue;let U=h.get(T.rel),J=new Set([...O.map(H=>H.rel),...U?.tests??[]]);if(J.size!==1)continue;N.add(T.rel);let z=[...J][0];if(U)for(let H of U.sent)o.splice(o.indexOf(H),1);o.push(`${T.rel} is imported only by ${z}${U?", which also copies its helpers":""} \u2014 move its contents into ${z} and delete ${T.rel}; keep it only if a second test file uses it`)}for(let T of r){if(!T.isNew||T.test||N.has(T.rel))continue;let O=new Map;for(let U of T.code.functions){if(!U.exported||(T.code.uses.get(U.name)??0)-1-(T.code.listedExports.has(U.name)?1:0)>0)continue;let z=[...s.values()].filter(H=>H.test&&H.rel!==T.rel&&(H.code.uses.get(U.name)??0)>0&&H.code.imports.some(Q=>KR(H.rel,Q.from,H.code.lang,i)===T.rel));z.length===1&&O.set(z[0].rel,[...O.get(z[0].rel)??[],U.name])}for(let[U,J]of O)o.push(`${T.rel}: ${J.join(", ")} ${J.length>1?"are":"is"} used only by ${U} \u2014 a helper only one test file uses stays in that file`)}let M=n.some(T=>!T.test&&Gwr.test(JR(T.rel)));for(let T of r){if(!T.isNew||T.test||!T.code.functions.length)continue;let O=JR(T.rel);(/skyramp/i.test(O)||!M&&zwr.test(O))&&o.push(`${T.rel}: name the module for what it holds (e.g. orders, session, pages) \u2014 not "utils" or "Skyramp"`)}return o}var rW=new Set(["node_modules",".git","dist","build","coverage","test-results","playwright-report","__pycache__",".venv","venv","vendor",".next","target"]),Fmt=new RegExp(`(^|/)(${[...rW].map(t=>t.replace(/\./g,"\\.")).join("|")})/`),Hmt=/^(tests?|e2e|e2e-tests|__tests__|specs?|playwright|cypress|integration|testing)$/i,Kwr=/test|spec|helper|support|fixture|page/i,Umt=3e3,Xwr=256*1024,Zwr=4e3;function wx(t){try{let e=nW.statSync(t);return e.isFile()&&e.size<=Xwr?nW.readFileSync(t,"utf-8"):void 0}catch{return}}function exr(t,e){try{return(0,qmt.execFileSync)("git",[...Ui,"show",`HEAD:${e}`],{cwd:t,env:wt(),encoding:"utf-8",maxBuffer:16*1024*1024,stdio:["ignore","pipe","ignore"]})}catch{return}}function XD(t){let e=fr.posix.dirname(t).split("/").filter(n=>n&&n!=="."),r=e.findIndex(n=>Hmt.test(n));return r>=0?{dir:e.slice(0,r+1).join("/"),deep:!0}:{dir:e.join("/"),deep:!1}}function RAe(t,e){let r=[];for(let u of ay(t)){if(!qh(u.path)||Fmt.test(u.path)||u.code.includes("D")||e?.has(fr.resolve(t,u.path)))continue;let d=wx(fr.join(t,u.path));if(d===void 0)continue;let p=u.code==="??"||u.code[0]==="A";r.push({rel:u.path,text:d,before:p?void 0:exr(t,u.path)??void 0})}let n=new Set(r.map(u=>u.rel)),s=[],i=new Set;for(let{dir:u,deep:d}of new Map(r.map(p=>[JSON.stringify(XD(p.rel)),XD(p.rel)])).values())cm(fr.join(t,u),p=>{let m=fr.relative(t,p).split(fr.sep).join("/");if(i.has(m)||n.has(m)||!qh(m)||!d&&!xx(m)&&!Kwr.test(fr.posix.basename(m)))return;i.add(m);let f=wx(p);if(f!==void 0&&s.push({rel:m,text:f}),s.length>=Umt)return!1},{skip:rW,maxDepth:d?8:0});let o=u=>wx(fr.join(t,u))!==void 0;for(let u of r){let d=YR(u.text,u.rel);if(d)for(let p of d.imports){if(s.length>=Umt)break;let m=KR(u.rel,p.from,d.lang,o);if(!m||i.has(m)||n.has(m)||Fmt.test(m))continue;i.add(m);let f=wx(fr.join(t,m));f!==void 0&&s.push({rel:m,text:f})}}let a=r.filter(u=>u.before===void 0&&!xx(u.rel)),c=[],l=[];if(a.length){let u=a.map(m=>JR(m.rel)),d=[...new Set(a.flatMap(m=>/^(index|__init__)$/.test(JR(m.rel))?[JR(m.rel),fr.posix.basename(fr.posix.dirname(m.rel))]:[JR(m.rel)]))],p=0;cm(t,(m,f)=>{let h=f.split(fr.sep).join("/"),A=Vwr.test(fr.posix.basename(h)),E=!A&&xx(h)&&qh(h)!==void 0&&!i.has(h)&&!n.has(h);if(!A&&!E)return;if(E&&++p>Zwr)return!1;let y=wx(m);y!==void 0&&(A?u:d).some(w=>y.includes(w))&&(A?l:c).push({rel:h,text:y})},{skip:rW,maxDepth:10})}return{written:r,existing:s,otherTests:c,configs:l}}var NAe="write-reuse",txr=/\bcopies\b| is defined in \d+ test files | is imported only by /;function $mt(t){return txr.test(t)}var zmt={name:NAe,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let i of kt(t.inputs)){let o=i.path===t.inputs.repositoryPath?"":qt(t.inputs,i.slug);r.push(...Jwr(RAe(i.path,e)).map(a=>o+a))}let n=r.filter(i=>!$mt(i));n.length&&console.log(`[${this.name}] noted, not sent back: ${n.join("; ")}`);let s=r.filter($mt);return s.length?{...ve(this.name,s),repairable:!0}:{name:this.name,passed:!0}}},rxr=10,nxr=/test|spec|helper|support|fixture/i,sxr=t=>t.split("/").some(e=>Hmt.test(e)||nxr.test(e)),ixr=10,oxr=4e3;function axr(t,e){let r=e==="js"?/^export\s+(?:default\s+)?(?:async\s+)?(?:function\*?|class|const|let)\s+([A-Za-z_$][\w$]*)/gm:/^(?:async\s+)?(?:def|class)\s+([A-Za-z]\w*)/gm,n=[...t.matchAll(r)].map(i=>i[1]),s=e==="js"?[...YR(t,"x.ts")?.listedExports??[]]:[];return[...new Set([...n,...s])]}function Gmt(t){let e=new Set,r=[];cm(t,(o,a)=>{let c=a.split(fr.sep).join("/"),l=qh(c);l!=="js"&&l!=="py"||(e.add(c),xx(c)&&r.length<oxr&&r.push(c))},{skip:rW,maxDepth:10});let n=o=>e.has(o),s=new Map;for(let o of r){let a=wx(fr.join(t,o)),c=a===void 0?void 0:YR(a,o);if(!c)continue;let l=new Set(c.imports.map(u=>KR(o,u.from,c.lang,n)).filter(u=>!!u&&!xx(u)));for(let u of l)s.set(u,(s.get(u)??0)+1)}for(let o of e){if(fr.posix.basename(o)!=="conftest.py")continue;let a=fr.posix.dirname(o),c=r.filter(l=>l.endsWith(".py")&&(a==="."||l.startsWith(`${a}/`))).length;c&&s.set(o,Math.max(s.get(o)??0,c))}let i=o=>fr.posix.basename(o)==="conftest.py";return[...s].filter(([o,a])=>a>=2&&(sxr(o)||i(o))).sort((o,a)=>a[1]-o[1]||o[0].localeCompare(a[0])).slice(0,rxr).map(([o,a])=>{let c=wx(fr.join(t,o))??"";return{rel:o,importers:a,names:axr(c,qh(o)).slice(0,ixr)}})}function jmt(t){return t.length?["The repo's shared test helpers, by how many of its test files use them:",...t.map(({label:e,module:r})=>` - ${e}${r.rel} (${r.importers} test files)${r.names.length?`: ${r.names.join(", ")}`:""}`)]:[]}var Wmt=q(require("path"));var cxr=10,lxr=3,uxr=5,dxr=/\.(?:locator|getBy[A-Z]\w*|get_by_\w+)\(/g,pxr=/^\s*(?:export\s+(?:default\s+)?)?class\s+\w+/m,mxr=/@testing-library\/|from ["']enzyme["']/,sW=t=>(t.match(dxr)??[]).length,fxr=/@playwright\/test|from\s+['"]playwright|\bpage\.(?:goto|locator|getBy\w+)\s*\(|\bcy\.(?:visit|get)\s*\(|webdriver|selenium|newSkyrampPlaywrightPage/i,Vmt=(t,e)=>Ymt(t,e)&&fxr.test(e);function hxr(t,e){if(e===void 0)return sW(t);let r=new Map;for(let s of e.split(`
797
797
  `))r.set(s,(r.get(s)??0)+1);let n=0;for(let s of t.split(`
798
- `)){let i=r.get(s)??0;i>0?r.set(s,i-1):n+=sW(s)}return n}var gxr=t=>t[Math.max(0,Math.ceil(.9*t.length)-1)],TAe=t=>ua.test(t),Ymt=(t,e)=>{let r=qh(t);return(r==="js"||r==="py")&&!mxr.test(e)};function Axr(t){let e=new Map;for(let r of t){let n=Wmt.posix.dirname(r).split("/"),s=n.findIndex(o=>/^pages?$/i.test(o)),i=s>=0?n.slice(0,s+1).join("/"):n.join("/");e.set(i,(e.get(i)??0)+(s>=0?1e3:1))}return[...e].sort((r,n)=>n[1]-r[1]||r[0].localeCompare(n[0]))[0][0]}function yxr(t){let e=[],r=new Map;for(let n of t.written){if(!TAe(n.rel)||!Vmt(n.rel,n.text))continue;let s=XD(n.rel).dir;r.set(s,[...r.get(s)??[],n])}for(let[n,s]of r){let i=t.written.filter(d=>d.before!==void 0).map(d=>({rel:d.rel,text:d.before})),o=[...t.existing,...i].filter(d=>n===""||d.rel.startsWith(`${n}/`)),a=o.filter(d=>!TAe(d.rel)&&Ymt(d.rel,d.text)&&pxr.test(d.text)&&sW(d.text)>0).map(d=>d.rel);if(a.length<lxr)continue;let c=o.filter(d=>TAe(d.rel)&&Vmt(d.rel,d.text)).map(d=>sW(d.text)).sort((d,p)=>d-p);if(c.length<uxr)continue;let l=gxr(c),u=Axr(a);for(let d of s){let p=hxr(d.text,d.before);p>=cxr&&p>l&&e.push(`${d.rel} locates ${p} elements inline, where nine in ten of the repo's specs locate ${l} or fewer and reach their pages through the page objects in ${u} \u2014 locate them in the page's page object there (a new one for a page that has none) and use it from the spec`)}}return e}var kAe="write-page-objects",Jmt={name:kAe,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let n of kt(t.inputs)){let s=n.path===t.inputs.repositoryPath?"":qt(t.inputs,n.slug);r.push(...yxr(RAe(n.path,e)).map(i=>s+i))}return r.length?{...ve(this.name,r),repairable:!0}:{name:this.name,passed:!0}}};var Kmt=q(require("fs")),ld=q(require("path"));var BAe="write-no-app",bxr="needs the running app (a browser journey), and this run brings no app up: Validation Triage decided targeted_unit";function XR(t){if(!ma(t))return{behaviors:[],defects:[],journeys:[],browserJourneys:[],maintenance:[]};let e=ae(t,"triage.json"),r=new Map((ae(t,"analyze.json")?.behaviors??[]).map(i=>[i.id,i])),n=new Set(_D(t));return{behaviors:(e?.plan??[]).filter(i=>i.mechanism==="new_unit"&&n.delete(i.behaviorId)).map(i=>{let o=r.get(i.behaviorId);return{id:i.behaviorId,statement:o?.statement??i.behaviorId,covers:i.covers??"",where:`${qt(t.inputs,o?.repository)}${o?.evidence??""}`}}),defects:hy(t),journeys:Sm(t),browserJourneys:sy(ae(t,"plan.json")?.journeys).filter(i=>i.kind!=="in-process"),maintenance:Jr(t)?.maintenance??[]}}function PAe(t){return t.behaviors.length+t.defects.length+t.journeys.length+t.maintenance.length>0}function Xmt(t,e){let r=new Set([...t.notWritten.map(s=>s.case.trim()),...t.tests.flatMap(s=>s.covers)]),n=e.filter(s=>!r.has(s.id)).map(s=>({case:s.id,reason:bxr}));return n.length?{...t,notWritten:[...t.notWritten,...n]}:t}function _Ae(t){return kt(t.inputs).filter(e=>e.writable).flatMap(e=>{let r=ey(t.inputs,e.slug,"unit");return r?[{root:ld.resolve(e.path),slug:e.slug,dir:r}]:[]})}function Exr(t,e){let r=[],{work:n}=e,s=new Set(t.tests.flatMap(c=>c.covers)),i=new Set(t.notWritten.map(c=>c.case.trim())),o=c=>s.has(c)||i.has(c);for(let c of n.behaviors)!o(c.id)&&!e.couldBreak.has(c.id)&&r.push(`behavior "${c.id}" was planned a new in-process test and no test covers it \u2014 give it one, or say in notWritten why no in-process test can check it`);for(let c of n.defects)o(c.id)||r.push(`defect "${c.id}" has no test and is not in notWritten \u2014 give it a test that reaches it and expects the correct behaviour, or say in notWritten why no in-process test can`);for(let c of n.journeys)o(c.id)||r.push(`journey "${c.id}" has no test and is not in notWritten \u2014 walk it in one in-process test, or say in notWritten what it needs that is missing`);let a=c=>{let l=lx(c).file,u=d=>d===l||d.endsWith(`/${l}`)||l.endsWith(`/${d}`);return t.tests.some(d=>u(d.file))||[...i].some(d=>d===c||u(lx(d).file))};for(let c of n.maintenance)a(c.test)||r.push(`existing test ${c.test} (the plan says ${c.action}) is neither in tests nor in notWritten \u2014 run or maintain it in-process and list it, or put it under notWritten with what it needs that this run does not have`);for(let c of t.tests){if(c.change!=="added")continue;let l=e.read(c.file);if(!l)continue;for(let m of jj(l.body))r.push(`${c.file} uses ${m} \u2014 every test runs in one process: no network, no running app; mock outbound calls with the repo's own tools inside the test`);let u=e.placedDir?.(l.root),d=ld.dirname(l.rel).split(ld.sep).join("/");u&&u!=="."&&d!==u&&!d.startsWith(`${u}/`)&&r.push(`${c.file} is not in ${u}, where the Target puts unit tests for this repository`);let p=Em(l.root,l.rel);p&&wm(p)&&!IR(p,l.rel)&&r.push(`${c.file} is not named the way ${p} collects tests \u2014 name it the way its runner collects tests, as the repo's own tests are`)}return r}function wxr(t,e){let r=e.replace(/^\.\//,""),n=r.split("/")[0],s=[{root:t[0],rel:r},...t.slice(1).filter(i=>ld.basename(i)===n).map(i=>({root:i,rel:r.slice(n.length+1)}))];for(let i of s){let o=ld.resolve(i.root,i.rel);if(o.startsWith(i.root+ld.sep))try{return{body:Kmt.readFileSync(o,"utf-8"),root:i.root,rel:i.rel}}catch{continue}}}function Zmt(t){return{name:BAe,verify(e,r){if(!ma(e))return{name:this.name,passed:!0};let n=t(e,r);if(!n)return{name:this.name,passed:!0};let s=ae(e,"plan.json"),i=[e.inputs.repositoryPath,...(e.inputs.relatedRepos??[]).map(a=>a.path)].map(a=>ld.resolve(a)),o=Exr(n,{work:XR(e),couldBreak:s?new Set(AD(s).keys()):new Set,read:a=>wxr(i,a),placedDir:a=>_Ae(e).find(c=>c.root===a)?.dir});return o.length?{name:this.name,passed:!1,details:o.join("; "),repairable:!0}:{name:this.name,passed:!0}}}}var iW=q(require("fs"));function eft(t,e){return{name:t,verify(r,n){let s=Ey(r.inputs.requirementItems);if(s.length===0)return{name:this.name,passed:!0};let i=[];for(let o of new Set(e(r,n))){let a;try{let l=she(r,o);if(iW.statSync(l).size>GV)continue;a=iW.readFileSync(l,"utf-8")}catch{continue}let c=Dpt(a,s);c.length&&i.push(`${o} copies the words of ${c.join(" and ")} in a comment, test title or test name`)}return i.length?{name:this.name,passed:!1,repairable:!0,details:`${i.join("; ")}. Tests are public to the repository's readers: name an item only by its key and criterion number (e.g. "PAY-184 AC2", "Confluence page 3021 AC1") and keep its words out of comments, titles and test names. When you rename a test, run it again under its new name.`}:{name:this.name,passed:!0}}}}var DAe="write.json",OAe=["adapt.json","generate.json","generate-ui.json","finalize.json",Fh],rft="write-no-secret-leak",nft="write-checkout-intact",sft="write-dependencies",aW=t=>bs.join(t.outputsDir,"write-scratch"),Ai=t=>bs.join(aW(t),DAe);function ift(t){if(ma(t))return Sm(t);let e=ae(t,"plan.json")?.journeys;if(!Array.isArray(e)||!e.length)return[];let r=new Set((Jr(t)?.generate??[]).map(n=>n.id));return e.filter(n=>n&&typeof n.id=="string"&&Array.isArray(n.steps)&&r.has(n.id))}function xxr(t,e={}){if(!t.length)return[];let r=e.noApp?["Each is one in-process test of the whole flow: it drives the UI the way the repo's in-process tests do, checks after","each step what the user then sees, and asserts every part of the outcome at the end. Mark each step so a failure","names it (a labelled assertion, or the runner's own step or subtest), and let a failed check go on to the next step","where the test still allows it.","A journey no in-process test can walk here goes under notWritten, with what it needs that is missing: it is","reported as not covered, never left out."]:["Each is one test of the whole flow, of its kind. A browser journey runs against the real app: it opens the entry route","and does every step through the UI in order (no URL jump to a later step, no stub of the app's own network). An","in-process journey drives the UI the way the repo's in-process tests do. Either checks after each step what the user then sees, and","asserts every part of the outcome at the end, after a reload where it must persist. Mark each step so a failure names it (in Playwright, test.step),","and let a failed check go on to the next step where the page still allows it, so one defect does not hide the rest.","A journey whose test cannot run here (a browser, package or service it needs cannot be set up) goes under notWritten,","with what is missing: it is reported as not covered, never left out."];return["User journeys:",...t.map(n=>[` - ${n.id} ${n.name} \u2192 ${n.testFile}`,` entry: ${n.entry}`,` steps: ${sR(n)}`,` outcome: ${n.outcome}`].join(`
798
+ `)){let i=r.get(s)??0;i>0?r.set(s,i-1):n+=sW(s)}return n}var gxr=t=>t[Math.max(0,Math.ceil(.9*t.length)-1)],TAe=t=>ua.test(t),Ymt=(t,e)=>{let r=qh(t);return(r==="js"||r==="py")&&!mxr.test(e)};function Axr(t){let e=new Map;for(let r of t){let n=Wmt.posix.dirname(r).split("/"),s=n.findIndex(o=>/^pages?$/i.test(o)),i=s>=0?n.slice(0,s+1).join("/"):n.join("/");e.set(i,(e.get(i)??0)+(s>=0?1e3:1))}return[...e].sort((r,n)=>n[1]-r[1]||r[0].localeCompare(n[0]))[0][0]}function yxr(t){let e=[],r=new Map;for(let n of t.written){if(!TAe(n.rel)||!Vmt(n.rel,n.text))continue;let s=XD(n.rel).dir;r.set(s,[...r.get(s)??[],n])}for(let[n,s]of r){let i=t.written.filter(d=>d.before!==void 0).map(d=>({rel:d.rel,text:d.before})),o=[...t.existing,...i].filter(d=>n===""||d.rel.startsWith(`${n}/`)),a=o.filter(d=>!TAe(d.rel)&&Ymt(d.rel,d.text)&&pxr.test(d.text)&&sW(d.text)>0).map(d=>d.rel);if(a.length<lxr)continue;let c=o.filter(d=>TAe(d.rel)&&Vmt(d.rel,d.text)).map(d=>sW(d.text)).sort((d,p)=>d-p);if(c.length<uxr)continue;let l=gxr(c),u=Axr(a);for(let d of s){let p=hxr(d.text,d.before);p>=cxr&&p>l&&e.push(`${d.rel} locates ${p} elements inline, where nine in ten of the repo's specs locate ${l} or fewer and reach their pages through the page objects in ${u} \u2014 locate them in the page's page object there (a new one for a page that has none) and use it from the spec`)}}return e}var kAe="write-page-objects",Jmt={name:kAe,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let n of kt(t.inputs)){let s=n.path===t.inputs.repositoryPath?"":qt(t.inputs,n.slug);r.push(...yxr(RAe(n.path,e)).map(i=>s+i))}return r.length?{...ve(this.name,r),repairable:!0}:{name:this.name,passed:!0}}};var Kmt=q(require("fs")),ld=q(require("path"));var BAe="write-no-app",bxr="needs the running app (a browser journey), and this run brings no app up: Validation Triage decided targeted_unit";function XR(t){if(!ma(t))return{behaviors:[],defects:[],journeys:[],browserJourneys:[],maintenance:[]};let e=ae(t,"triage.json"),r=new Map((ae(t,"analyze.json")?.behaviors??[]).map(i=>[i.id,i])),n=new Set(_D(t));return{behaviors:(e?.plan??[]).filter(i=>i.mechanism==="new_unit"&&n.delete(i.behaviorId)).map(i=>{let o=r.get(i.behaviorId);return{id:i.behaviorId,statement:o?.statement??i.behaviorId,covers:i.covers??"",where:`${qt(t.inputs,o?.repository)}${o?.evidence??""}`}}),defects:hy(t),journeys:Sm(t),browserJourneys:sy(ae(t,"plan.json")?.journeys).filter(i=>i.kind!=="in-process"),maintenance:Jr(t)?.maintenance??[]}}function PAe(t){return t.behaviors.length+t.defects.length+t.journeys.length+t.maintenance.length>0}function Xmt(t,e){let r=new Set([...t.notWritten.map(s=>s.case.trim()),...t.tests.flatMap(s=>s.covers)]),n=e.filter(s=>!r.has(s.id)).map(s=>({case:s.id,reason:bxr}));return n.length?{...t,notWritten:[...t.notWritten,...n]}:t}function _Ae(t){return kt(t.inputs).filter(e=>e.writable).flatMap(e=>{let r=ey(t.inputs,e.slug,"unit");return r?[{root:ld.resolve(e.path),slug:e.slug,dir:r}]:[]})}function Exr(t,e){let r=[],{work:n}=e,s=new Set(t.tests.flatMap(c=>c.covers)),i=new Set(t.notWritten.map(c=>c.case.trim())),o=c=>s.has(c)||i.has(c);for(let c of n.behaviors)!o(c.id)&&!e.couldBreak.has(c.id)&&r.push(`behavior "${c.id}" was planned a new in-process test and no test covers it \u2014 give it one, or say in notWritten why no in-process test can check it`);for(let c of n.defects)o(c.id)||r.push(`defect "${c.id}" has no test and is not in notWritten \u2014 give it a test that reaches it and expects the correct behaviour, or say in notWritten why no in-process test can`);for(let c of n.journeys)o(c.id)||r.push(`journey "${c.id}" has no test and is not in notWritten \u2014 walk it in one in-process test, or say in notWritten what it needs that is missing`);let a=c=>{let l=lx(c).file,u=d=>d===l||d.endsWith(`/${l}`)||l.endsWith(`/${d}`);return t.tests.some(d=>u(d.file))||[...i].some(d=>d===c||u(lx(d).file))};for(let c of n.maintenance)a(c.test)||r.push(`existing test ${c.test} (the plan says ${c.action}) is neither in tests nor in notWritten \u2014 run or maintain it in-process and list it, or put it under notWritten with what it needs that this run does not have`);for(let c of t.tests){if(c.change!=="added")continue;let l=e.read(c.file);if(!l)continue;for(let m of jj(l.body))r.push(`${c.file} uses ${m} \u2014 every test runs in one process: no network, no running app; mock outbound calls with the repo's own tools inside the test`);let u=e.placedDir?.(l.root),d=ld.dirname(l.rel).split(ld.sep).join("/");u&&u!=="."&&d!==u&&!d.startsWith(`${u}/`)&&r.push(`${c.file} is not in ${u}, where the Target puts unit tests for this repository`);let p=Em(l.root,l.rel);p&&wm(p)&&!IR(p,l.rel)&&r.push(`${c.file} is not named the way ${p} collects tests \u2014 name it the way its runner collects tests, as the repo's own tests are`)}return r}function wxr(t,e){let r=e.replace(/^\.\//,""),n=r.split("/")[0],s=[{root:t[0],rel:r},...t.slice(1).filter(i=>ld.basename(i)===n).map(i=>({root:i,rel:r.slice(n.length+1)}))];for(let i of s){let o=ld.resolve(i.root,i.rel);if(o.startsWith(i.root+ld.sep))try{return{body:Kmt.readFileSync(o,"utf-8"),root:i.root,rel:i.rel}}catch{continue}}}function Zmt(t){return{name:BAe,verify(e,r){if(!ma(e))return{name:this.name,passed:!0};let n=t(e,r);if(!n)return{name:this.name,passed:!0};let s=ae(e,"plan.json"),i=[e.inputs.repositoryPath,...(e.inputs.relatedRepos??[]).map(a=>a.path)].map(a=>ld.resolve(a)),o=Exr(n,{work:XR(e),couldBreak:s?new Set(AD(s).keys()):new Set,read:a=>wxr(i,a),placedDir:a=>_Ae(e).find(c=>c.root===a)?.dir});return o.length?{name:this.name,passed:!1,details:o.join("; "),repairable:!0}:{name:this.name,passed:!0}}}}var iW=q(require("fs"));function eft(t,e){return{name:t,verify(r,n){let s=Ey(r.inputs.requirementItems);if(s.length===0)return{name:this.name,passed:!0};let i=[];for(let o of new Set(e(r,n))){let a;try{let l=she(r,o);if(iW.statSync(l).size>GV)continue;a=iW.readFileSync(l,"utf-8")}catch{continue}let c=Dpt(a,s);c.length&&i.push(`${o} copies the words of ${c.join(" and ")} in a comment, test title or test name`)}return i.length?{name:this.name,passed:!1,repairable:!0,details:`${i.join("; ")}. Tests are public to the repository's readers: name an item only by its key and criterion number (e.g. "PAY-184 AC2", "Confluence page 3021 AC1") and keep its words out of comments, titles and test names. When you rename a test, run it again under its new name.`}:{name:this.name,passed:!0}}}}var DAe="write.json",OAe=["adapt.json","generate.json","generate-ui.json","finalize.json",Fh],rft="write-no-secret-leak",nft="write-checkout-intact",sft="write-dependencies",aW=t=>bs.join(t.outputsDir,"write-scratch"),Ai=t=>bs.join(aW(t),DAe);function ift(t){if(ma(t))return Sm(t);let e=ae(t,"plan.json")?.journeys;if(!Array.isArray(e)||!e.length)return[];let r=new Set((Jr(t)?.generate??[]).map(n=>n.id));return e.filter(n=>n&&typeof n.id=="string"&&Array.isArray(n.steps)&&r.has(n.id))}function xxr(t,e={}){if(!t.length)return[];let r=e.noApp?["Each is one in-process test of the whole flow: it drives the UI the way the repo's in-process tests do, checks after","each step what the user then sees, and asserts every part of the outcome at the end. Mark each step so a failure","names it (a labelled assertion, or the runner's own step or subtest), and let a failed check go on to the next step","where the test still allows it.","A journey no in-process test can walk here goes under notWritten, with what it needs that is missing: it is","reported as not covered, never left out."]:["Each is one test of the whole flow, of its kind. A browser journey runs against the real app: it opens the entry route","and does every step through the UI in order (no URL jump to a later step, no stub of the app's own network). An","in-process journey drives the UI the way the repo's in-process tests do. Either checks after each step what the user then sees, and","asserts every part of the outcome at the end, after a reload where it must persist. Where a step lands on another page (a","redirect after a save, a detail or confirmation page), check on that page what it shows of what the user entered or saved","(the values, totals and counts), not only its address. Mark each step so a failure names it (in Playwright, test.step),","and let a failed check go on to the next step where the page still allows it, so one defect does not hide the rest.","A journey whose test cannot run here (a browser, package or service it needs cannot be set up) goes under notWritten,","with what is missing: it is reported as not covered, never left out."];return["User journeys:",...t.map(n=>[` - ${n.id} ${n.name} \u2192 ${n.testFile}`,` entry: ${n.entry}`,` steps: ${sR(n)}`,` outcome: ${n.outcome}`].join(`
799
799
  `)),...r,'List each under "journeys" in your result (its file and test title, and where it broke when it did) and put its id in',`that file's "covers".`,""]}function oW(t){return ma(t)?!1:(Jr(t)?.generate??[]).some(e=>e.type==="ui")}function Sxr(t){let e=BR(t);if(e){for(let n of[...OAe,zc])Yc.rmSync(bs.join(t.outputsDir,n),{force:!0});return{ok:!1,reasons:[e]}}let r=Jr(t);return r?r.generate.length===0&&r.maintenance.length===0&&!PAe(XR(t))?{ok:!1,reasons:["the plan has no test cases and no maintenance"]}:{ok:!0,reasons:[]}:{ok:!1,reasons:["no test plan (recommend.json) to write tests from"]}}function Cxr(t){let e=ihe(t),r=MV(t);for(let c of[...OAe,"write.json",vR,zc])Yc.rmSync(bs.join(t.outputsDir,c),{force:!0});let n=oW(t),s=(Jr(t)?.generate??[]).some(c=>c.type!=="ui")||PAe(XR(t)),{packages:i,notes:o}=Cdt(t,{ui:n,backend:s});oft(t,i);let a=[...o,...hx(t,"backend",[],{declaredOnly:!0,packages:i}),...n?hx(t,"ui",[],{declaredOnly:!0,packages:i}):[]];return{checkpoint:bs.join(aW(t),DAe),secretGateBaseline:e,checkoutHeads:r,provisionNotes:a,sharedHelpers:Ixr(t),testPackages:i,dependencyBaseline:ihe(t)}}function oft(t,e){let r=bs.join(t.outputsDir,zc);e.length===0?Yc.rmSync(r,{force:!0}):Yc.writeFileSync(r,JSON.stringify({schemaVersion:1,packages:[...e]},null,2)+`
800
800
  `)}function Ixr(t){try{return jmt(kt(t.inputs).flatMap(e=>{let r=e.path===t.inputs.repositoryPath?"":qt(t.inputs,e.slug);return Gmt(e.path).map(n=>({label:r,module:n}))}))}catch{return[]}}function vxr(t){let e=Lc(t.inputs)?["It is a shared environment this policy protects: write and run no test that changes state there (a create, edit or delete, a form that submits, a setup that seeds); list any such test in notWritten instead."]:[];if(t.inputs.appRunning){let o=sj(ae(t,`${da}.json`));return[t.inputs.appRunning.trim(),...e,...o?[o]:[]]}let r=ae(t,"deploy.json"),n=Vc(t.inputs.repositoryPath),s=n.setupScript?`start it with ${bs.relative(t.inputs.repositoryPath,n.setupScript)} and check it answers`:"start it the way the repo documents";if(lhe(r)){let o=Object.entries(r.baseUrls??{}).map(([c,l])=>`${c} ${l}`).join(", "),a=r.health?.url??r.health?.command;return[`The app is running${o?`: ${o}`:""}.${a?` Health check: ${a}`:""}`,`If it stops answering, ${s}.`]}return[`The app may not be running.${r?.bringupError?.output?` Planning could not start it: ${r.bringupError.output.slice(0,300)}`:""} Check, and if it isn't up, ${s}; leave it running.`,"If you can't get it running, still write the tests and record them as not run (exit null)."]}function Rxr(t){let e=_Ae(t);return["No app is running, and none is started for this run: Validation Triage decided the change is proven in-process","(targeted_unit). Every test runs in one process, the way the repo's own in-process tests run: no network or running","app, so nothing that calls a live service, the Skyramp client and its runtime mocks included. Mock outbound calls","(HTTP, queues, other services) inside the test with the repo's own fixtures and mocking tools. Run the tests the way","the repo's CI runs them (its runner, config and environment), selected as step 4 says. Each new test file is named the way its runner","collects tests, as the repo's own tests are. Maintain every stale existing test that can run in-process. An existing","test that needs the running app goes under notWritten, by its path, with what it needs that this run does not have:","it is reported as not covered.",...e.length?["The Target puts new unit tests in these directories, over the repo's own layout: put each new test under its repository's directory, not beside the existing tests:",...e.map(r=>` - ${qt(t.inputs,r.slug)}${r.dir}/`)]:[]]}function Nxr(t){return[...t.behaviors.length?['Behaviors that need a new in-process test (give each id in "covers"):',...t.behaviors.map(e=>` - ${e.id}: ${e.statement}
801
801
  missing evidence to obtain: ${e.covers||"(unstated)"}
@@ -892,7 +892,7 @@ ${hht(o,{order:t.stages.map(c=>c.name),wallMinutes:yW(o)})}
892
892
  `)}
893
893
  `)}var Hh=require("crypto"),En=q(require("fs")),sO=q(require("os")),Tr=q(require("path")),EW=q(require("zlib"));var sye="checkpoint.bin",bW=12,nye=16,JSr=20*1024*1024;function Cht(){return Tr.join(process.env.CLAUDE_CONFIG_DIR??Tr.join(sO.homedir(),".claude"),"projects")}function KSr(t){return Tr.join(Cht(),Tr.resolve(t).replace(/[^A-Za-z0-9]/g,"-"))}function Iht(t){if(!En.existsSync(t)||En.lstatSync(t).isSymbolicLink())return[];let e=[],r=n=>{for(let s of En.readdirSync(Tr.join(t,n),{withFileTypes:!0})){let i=Tr.join(n,s.name);s.isDirectory()?r(i):s.isFile()&&En.statSync(Tr.join(t,i)).size<=JSr&&e.push(i)}};return r(""),e.sort()}function XSr(t,e){let r=En.readFileSync(t);if(r.includes(0))return null;let n=[...new Set(e.flatMap(s=>[s,JSON.stringify(s).slice(1,-1)]))];return Buffer.from(Dr(r.toString("utf-8"),n),"utf-8")}function ZSr(t){let e=Cht();if(!En.existsSync(e))return[];for(let r of En.readdirSync(e)){let n=Tr.join(e,r);if(En.existsSync(Tr.join(n,`${t}.jsonl`)))return[{dir:n,rel:`${t}.jsonl`},...Iht(Tr.join(n,t)).map(s=>({dir:n,rel:Tr.join(t,s)}))]}return[]}function eCr(t,e){let r=(0,Hh.randomBytes)(bW),n=(0,Hh.createCipheriv)("aes-256-gcm",Buffer.from(e,"base64"),r);return Buffer.concat([r,n.update(t),n.final(),n.getAuthTag()])}function tCr(t,e){if(t.length<=bW+nye)throw new Error("the checkpoint is too short to be one");let r=(0,Hh.createDecipheriv)("aes-256-gcm",Buffer.from(e,"base64"),t.subarray(0,bW));return r.setAuthTag(t.subarray(t.length-nye)),Buffer.concat([r.update(t.subarray(bW,t.length-nye)),r.final()])}async function vht(t){let e=ZSr(t.sessionId);if(e.length===0)throw new Error(`onboard's session ${t.sessionId} left no transcript to save`);let r=(a,c)=>{let l=XSr(a,t.secrets);return l?[{...c,content:l.toString("base64")}]:[]},n=[...e.flatMap(({dir:a,rel:c})=>r(Tr.join(a,c),{root:"session",path:c})),...t.checkouts.flatMap(a=>Iht(Tr.join(a.path,".skyramp")).flatMap(c=>r(Tr.join(a.path,".skyramp",c),{root:"checkout",repository:a.slug,path:Tr.join(".skyramp",c)})))],s={schemaVersion:1,sessionId:t.sessionId,files:n},i=eCr(EW.gzipSync(Buffer.from(JSON.stringify(s),"utf-8")),t.key);if(i.length>IG)throw new Error(`the checkpoint is ${i.length} bytes, over the ${IG} a setup may save`);let o=En.mkdtempSync(Tr.join(sO.tmpdir(),"skyramp-checkpoint-"));try{En.writeFileSync(Tr.join(o,sye),i);let a=await t.artifacts.uploadArtifact(t.name,[Tr.join(o,sye)],o,{retentionDays:R_});if(!a.id)throw new Error("GitHub created no artifact for the checkpoint");let c=new Date(t.now.getTime()+R_*864e5-36e5).toISOString();return{schemaVersion:1,sessionId:t.sessionId,bytes:i.length,contentHash:(0,Hh.createHash)("sha256").update(i).digest("hex"),artifact:{id:String(a.id),name:t.name,providerRunId:t.providerRunId,expiresAt:c}}}finally{En.rmSync(o,{recursive:!0,force:!0})}}function rCr(t,e){let r=Tr.resolve(t),n=Tr.resolve(r,e);if(Tr.isAbsolute(e)||!n.startsWith(r+Tr.sep))throw new Error(`the checkpoint names a path outside its place: ${e}`);let s=r;for(let i of Tr.relative(r,n).split(Tr.sep))if(s=Tr.join(s,i),En.lstatSync(s,{throwIfNoEntry:!1})?.isSymbolicLink())throw new Error(`the checkpoint would write through a symlink: ${e}`);return n}async function Rht(t){let{checkpoint:e}=t,r=En.mkdtempSync(Tr.join(sO.tmpdir(),"skyramp-checkpoint-"));try{let n=await t.artifacts.downloadArtifact(Number(e.artifact.id),{path:r,findBy:{token:t.token,workflowRunId:Number(e.artifact.providerRunId),repositoryOwner:e.repository.namespace,repositoryName:e.repository.name}}),s=En.readFileSync(Tr.join(n.downloadPath??r,sye));if((0,Hh.createHash)("sha256").update(s).digest("hex")!==e.contentHash)throw new Error("the checkpoint does not match the hash Skyramp recorded");let i=JSON.parse(EW.gunzipSync(tCr(s,e.key)).toString("utf-8"));if(i.schemaVersion!==1||i.sessionId!==e.sessionId)throw new Error("the checkpoint is not of the session Skyramp recorded");let o=KSr(t.cwd),a=new Map(t.checkouts.map(c=>[c.slug,c.path]));for(let c of i.files){let l=c.root==="session"?o:a.get(c.repository??"");if(!l)continue;let u=rCr(l,c.path);En.mkdirSync(Tr.dirname(u),{recursive:!0}),En.writeFileSync(u,Buffer.from(c.content,"base64"))}return{sessionId:i.sessionId}}finally{En.rmSync(r,{recursive:!0,force:!0})}}var nCr="https://testbot.skyramp.dev",zh={attemptId:"v3AttemptId",origin:"v3Origin",deadlineAt:"v3DeadlineAt",reportUploaded:"v3ReportUploaded",recipeUploaded:"v3RecipeUploaded",cause:"v3Cause"},sCr="skyramp-sources",xW=()=>su.join(Bl(),"requirements");function iCr(t,e){return{origin:t,idToken:e,mask:r=>Ot(r),log:r=>ee(r)}}function iu(t){dN(zh.attemptId)&&!dN(zh.cause)&&jn(zh.cause,t)}function Cx(){iu("setup_failed")}function Pht(){iu("timed_out")}var iye={cancelled:"Skyramp cancelled this run",expired:"this attempt passed its deadline in Skyramp",ended:"Skyramp already ended this attempt"},_ht={cancelled:"attempt-cancelled",expired:"attempt-closed",ended:"attempt-closed"},Dht={cancelled:"cancelled",expired:"timed_out",ended:"agent_failed"};function Oht(t,e){return _ht[e]==="attempt-cancelled"?` View in Skyramp: ${t.attempt.skyrampRunUrl}`:""}function Mht(t){return e=>(t.requestStop=r=>{t.stopKey||(t.stopKey=r,ee("Testbot V3: a person stopped this setup to resume it later; stopping onboard to save where it is."),e("setup-stopped","a person stopped this setup to resume it later"))},fut(t.attempt,r=>{iu(Dht[r]),X(`Testbot V3: ${iye[r]}; stopping the run, and uploading nothing.${Oht(t,r)}`),e(_ht[r],iye[r])}))}async function oye(t){let e=await mut(t.attempt);return e?(iu(Dht[e]),X(`Testbot V3: ${iye[e]}, so nothing is uploaded.${Oht(t,e)}`),!0):!1}function Ix(t){return[...t.attempt.manifest.credentials.map(e=>process.env[e.name]??""),t.attempt.license?.runToken??"",t.attempt.modelKey??"",...t.heldInputs??[]].filter(Boolean)}var Qht={analyze:"analyze",triage:"analyze",recommend:"recommend",generate:"generate","generate-ui":"generate","generate-unit":"generate",adapt:"generate",write:"generate",onboard:"execute",deploy:"execute","native-run":"execute",deliver:"deliver"},oCr={analyze:"change analysis",recommend:"test recommendations",generate:"test generation",execute:"test execution",deliver:"opening a pull request with the tests"};function aCr(t){return t.change?.kind==="pull_request"&&t.ref===`pull/${t.change.number}/head`}function Lht(t,e){let r={};for(let[n,s]of Object.entries(Qht))t&&!t.includes(s)&&(r[n]=`your Skyramp plan does not include ${oCr[s]}`);return!r.deliver&&e.some(aCr)&&(r.deliver="the pull request comes from a fork, so Testbot opens no pull request with the tests"),!t||t.includes("generate")?{withheld:r}:{stages:["analyze","recommend"],planOnly:!0,withheld:r}}function Fht(t,e){for(let r of Object.keys(Qht))r!=="analyze"&&r!=="triage"&&r!=="recommend"&&(t[r]??=e);return{stages:["analyze","recommend"],planOnly:!0,withheld:t}}function Uht(t){if(t!==!0)return t===!1?"The person this run acts for cannot push to every repository of this run, so Testbot only recommends tests":"Testbot could not confirm that the person this run acts for can push to every repository of this run, so it only recommends tests"}async function SW(t){t.cancelWatch?.stop();let e=await t.attempt.revokeTokens();for(let r of e)X(`Testbot V3: could not revoke a scoped GitHub token (${r}); it stays valid until it expires.`)}function cCr(t){let e=["SIGINT","SIGTERM"],r=()=>{n(),SW({attempt:t})},n=()=>{for(let s of e)process.removeListener(s,r)};for(let s of e)process.on(s,r);return{stop:n}}function aye(){return qe("skyrampAppOrigin").trim()||nCr}async function $ht(t,e){let r=Os(),n=r.takeIdToken(),s=aye(),i=await dut(t,r,iCr(s,n)),o=cCr(i);jn(zh.attemptId,i.attemptId),jn(zh.origin,s),jn(zh.deadlineAt,i.deadlineAt.toISOString());let a=Sy({attempt:i})?"Setup Run":"Validation Run";ee(`Testbot V3: attempt ${i.attemptNumber} of ${a} ${t}, deadline ${i.deadlineAt.toISOString()}`);try{return{...await lCr(i,e),cancelWatch:o}}catch(c){throw await SW({attempt:i,cancelWatch:o}),Xa.rmSync(xW(),{recursive:!0,force:!0}),c}}async function lCr(t,e){await uCr(t,e);let r=Mut(t.manifest,process.env);if(r.length>0)throw iu("credential_missing"),new Error(`The workflow does not supply the required credential${r.length>1?"s":""} ${r.join(", ")}. Add ${r.length>1?"them":"it"} to the Testbot step's env.`);let n;try{n=await hut(t,{workspace:su.join(Os().workspace||process.cwd(),sCr)})}catch(A){throw iu("checkout_failed"),A}for(let A of n)ee(`Testbot V3: ${A.slug} at ${A.revision}`);let s=await pCr({attempt:t,sources:n}),i=Sy({attempt:t})?await mCr({attempt:t,sources:n}):void 0,o=but(n);ee(`Testbot V3: working checkout ${o.repositorySlug}`);let a=yut(t.manifest,n);a&&ee(`Testbot V3: the pull request is ${a.repository}#${a.number}`);let c=await gut(t);for(let A of c)ee([`Testbot V3: Change Set ${A.repository}#${A.number}`,A.note].filter(Boolean).join(": "));let{items:l,instructions:u}=await Iut(t,xW(),A=>X(A));for(let A of l){let E=A.state==="read"?"read":`not read (${A.reason})`;ee(`Testbot V3: requirement ${A.key} ${E}`)}u.length&&ee(`Testbot V3: Instructions: ${u.length}`);let d=Sy({attempt:t})?void 0:await dCr({attempt:t});uB(mge(d));let p=d?Eut(d,n):[];for(let A of p)ee(`Testbot V3: ${A.testType} tests in ${A.repository} go in ${A.directory}`);let m=d&&wut(d,t.manifest),f=s?xut(m,s,t.manifest,d,c):m;for(let A of f?.components??[])ee(`Testbot V3: shared component ${A.name} at ${A.url}${A.repository?`, running ${A.repository}`:""}`);let h=_lt(t.manifest,d?.settings??null);return h&&ee(h.confirmedRunId?`Testbot V3: scheduled validation of the delta since Confirmed Baseline run ${h.confirmedRunId}`:"Testbot V3: scheduled validation, first qualification: no Confirmed Baseline yet"),{attempt:t,sources:n,layout:o,pullRequests:c,pullRequest:a,testPlacements:p,...f?{sharedEnvironment:f}:{},scheduledValidation:h,...s?{testEnvironment:s}:{},...l.length?{requirementItems:l}:{},...u.length?{instructions:u}:{},...i?{recheck:i}:{}}}async function uCr(t,e){if(e.useBedrock)return;if(!e.anthropicApiKey&&!process.env.ANTHROPIC_API_KEY)try{await t.token()}catch(n){throw Cx(),n}let r=e.anthropicApiKey||process.env.ANTHROPIC_API_KEY||t.modelKey;r&&(e.anthropicApiKey=r,process.env.ANTHROPIC_API_KEY=r)}async function dCr(t){try{return(await fge(t.attempt)).capture}catch(e){if(!(e instanceof ao&&e.status===404))throw Cx(),e;X(`Testbot V3: this Skyramp app does not serve the run's configuration (${e.message}); each test goes where its repository's convention puts it, and no shared environment is verified.`);return}}async function pCr(t){for(let e of t.sources)rye(e.path);return Sy(t)?void 0:hCr(t)}async function mCr(t){try{let{runtimePlan:e}=await AV(t.attempt);if(!e?.recipe)return;let r=mG.parse(e.recipe);return r.status!=="ready"?void 0:(nO(t.sources[0].path,e.files),ee(`Testbot V3: rechecking SUT recipe version ${e.version} with the credentials as they are now; deploying it again.`),{version:e.version,recipe:r})}catch(e){X(`Testbot V3: could not read the recipe to recheck, so this setup sets up from nothing: ${e instanceof Error?e.message:String(e)}`);return}}async function qht(t){try{let{runtimePlan:e}=await AV(t.attempt);return!e||e.recipe?void 0:(nO(t.sources[0].path,e.files),ee(`Testbot V3: starting from SUT recipe version ${e.version}, a ready recipe of this Target.`),{version:e.version})}catch(e){X(`Testbot V3: could not read the recipe to start from, so this setup starts from nothing: ${e instanceof Error?e.message:String(e)}`);return}}function Hht(t){return({stage:e,event:r,status:n})=>{if(e!=="deploy")return;let s=r==="finished",i=n==="aborted"?"skipped":n;hge(t.attempt,{schemaVersion:1,stage:"recheck",event:s?"finished":"started",...s&&i?{status:i}:{}}).catch(o=>X(`Testbot V3: could not report the recheck ${r}: ${o instanceof Error?o.message:String(o)}`))}}async function zht(t,e,r){let n=t.recheck,s=e.outputsDir?t0(su.join(e.outputsDir,"deploy.json")):void 0,i=s&&(s.outcome==="clean"||s.outcome==="recipe-drift");if(e.aborted||e.timedOut){iu(e.aborted?"cancelled":"timed_out");return}if(await oye(t))return;let o=Jrt(n.recipe),a=FD(t.layout.repositoryPath),c=i?Wlt(o,t.attempt.manifest.credentials.map(m=>m.name)):[],l=i&&o.environment&&c.length===0?await Yht(t,o,a):void 0,d=(e.stateFilePath?t0(e.stateFilePath):void 0)?.stages.deploy?.attempts?.reduce((m,f)=>m+(f.totalMs??f.durationMs??0),0),p=mme(o,s,{deployDurationSeconds:d?Math.round(d/1e3):void 0,recipeFiles:a,revisionCheck:l,credentialBlockers:c.length>0?[Ylt(o,c)]:[]});i||await fCr(t,t.attempt.budgetMs(new Date));try{await gge(t.attempt,{recipe:p,sources:t.sources,producer:{testbot:m_().version,mcp:lye(r)},secrets:[...Ix(t),...Mm()]}),jn(zh.recipeUploaded,"true"),p.status==="ready"?ee(`Testbot V3: recipe version ${n.version} came up with the credentials as they are now; uploaded it again (ready).`):X(`Testbot V3: recipe version ${n.version} did not come up with the credentials as they are now (${p.blockers.map(m=>m.problem).join("; ")}); uploaded it blocked.`)}catch(m){X(`Testbot V3: the rechecked recipe's upload failed: ${m instanceof Error?m.message:String(m)}`)}}var Nht=10*6e4,Tht=[".skyramp/sut",".skyramp/workspace.yml"];async function fCr(t,e=Nht){let r=t.layout.repositoryPath,n=Wa(r,".skyramp/sut/teardown.sh"),s=Math.max(0,Math.min(Nht,e));s>0&&n&&await new Promise(c=>{let l=(0,wW.spawn)("bash",[n],{cwd:r,env:wt(),stdio:"inherit",detached:!0}),u=setTimeout(()=>{try{l.pid!==void 0&&process.kill(-l.pid,"SIGKILL")}catch{l.kill("SIGKILL")}},s),d=()=>{clearTimeout(u),c()};l.on("close",d),l.on("error",d)});let i=c=>(0,wW.spawnSync)("git",["-c","core.fsmonitor=false","-c","core.hooksPath=/dev/null",...c],{cwd:r,env:wt(),encoding:"utf-8"}),o=su.join(r,".skyramp");Xa.lstatSync(o,{throwIfNoEntry:!1})?.isSymbolicLink()&&Xa.rmSync(o,{force:!0});for(let c of Tht)Xa.rmSync(su.join(r,c),{recursive:!0,force:!0});let a=i(["ls-tree","-r","--name-only","HEAD","--",...Tht]).stdout.split(`
894
894
  `).filter(Boolean);a.length>0&&i(["checkout","HEAD","--",...a])}var kht=".skyramp/sut/health-check.sh",Bht=".skyramp/sut/get-auth-token.sh";function cye(t){let e=s=>t.files?.some(i=>i.path===s)??!1,r=t.components.map(s=>`${s.name} (${s.repository===An?"shared, built by none of the Target's repositories":s.repository})`),n=t.revisionSources.map(s=>`${s.method.replace(/_/g," ")} ${s.detail} for ${s.components.join(" and ")}`);return[`The app is the customer's Test Environment at ${t.address}, already deployed and running.`,"Never start, stop, redeploy or change it: only read from it and test against it.",t.readyWhen&&`It is ready when ${t.readyWhen}.`,t.credentials.length>0&&`Sign in with ${t.credentials.join(", ")}, which the workflow supplies as environment variables of those names.`,r.length>0&&`Its components: ${r.join(", ")}.`,n.length>0&&`What each runs is read from: ${n.join("; ")}.`,e(kht)&&`Check it is ready with \`bash ${kht}\`.`,e(Bht)&&`Sign in with the token \`bash ${Bht}\` prints, never echoed.`,"Never edit the recipe files."].filter(Boolean).join(" ")}async function hCr(t){let e=t.sources[0],r;try{r=await AV(t.attempt)}catch(i){if(!(i instanceof ao&&i.status===404))throw Cx(),i;X(`Testbot V3: this Skyramp app does not serve the stored SUT recipe (${i.message}); deploy uses a source's own recipe, if one has it.`);return}let{runtimePlan:n,testEnvironment:s}=r;if(s){if(s.files){if(!s.contentHash||Cnt({...s,files:s.files})!==s.contentHash)throw Cx(),new Error(`The Test Environment's plan (version ${s.version}) does not match the hash Skyramp stored`);nO(e.path,s.files)}return ee(`Testbot V3: testing the customer's Test Environment at ${s.address} (version ${s.version}, ${s.files?.length??0} files); Testbot does not start or change it`),s}if(!n){ee("Testbot V3: no stored SUT recipe for this Target yet; deploy uses a source's own recipe, if one has it.");return}nO(e.path,n.files),ee(`Testbot V3: SUT recipe version ${n.version}, ${n.files.length} files, for ${e.slug} (uncommitted)`)}function lye(t){try{let e=JSON.parse(Xa.readFileSync(su.join(t,"@skyramp","mcp","package.json"),"utf-8")).version;return typeof e=="string"&&/^[0-9A-Za-z.+-]{1,64}$/.test(e)?e:"unknown"}catch{return"unknown"}}async function Ght(t,e,r){e.aborted?iu("cancelled"):e.timedOut&&iu("timed_out");let n=e.outputsDir?su.join(e.outputsDir,"report.json"):void 0;if(!n||!Xa.existsSync(n)){e.abortReason==="attempt-cancelled"?ee("Testbot V3: Skyramp cancelled this run, so Testbot uploads no report."):X("Testbot V3: the run wrote no report, so Skyramp records it as an infrastructure error.");return}if(!await oye(t))try{let s=JSON.parse(Xa.readFileSync(n,"utf-8"));await Cut(t.attempt,{report:s,sources:t.sources,workingSlug:t.layout.repositorySlug,delivery:Put(e.outputsDir,t.sources,s,t.layout.repositorySlug,e.deliverWithheld,{...t.testEnvironment?{appRunning:cye(t.testEnvironment)}:{},sharedEnvironment:t.sharedEnvironment}),githubWrites:Out(e.outputsDir,t.sources,t.layout.repositorySlug),producer:{testbot:m_().version,mcp:lye(r)},secrets:[...Ix(t),...Mm()]}),jn(zh.reportUploaded,"true"),ee("Testbot V3: report uploaded; Skyramp derives the outcome.")}catch(s){X(`Testbot V3: the report upload failed: ${s instanceof Error?s.message:String(s)}`)}}function Sy(t){return t.attempt.manifest.trigger.kind==="sut_setup"}async function jht(t){let{capture:e}=await fge(t.attempt);uB(mge(e));let{components:r,dependencies:n,runner:s,...i}=e.settings.target.environment??{},{answerWaitMinutes:o,testEnvironment:a}=e.settings;return{sutEnvironment:tge(i,"the run's SUT / Environment settings"),...o!==void 0&&{answerWaitMinutes:o},...a&&{testEnvironment:{name:a.name,...a.address&&{address:a.address},...a.readyWhen&&{readyWhen:a.readyWhen}}}}}var gCr={onboard:"onboard",deploy:"deploy"};function Vht(t,e,r=!1){return({stage:n,event:s,status:i})=>{if(n==="onboard"&&s==="started"){t.setupEvents??=new xV(e,l=>Rut(t.attempt,l),{secrets:()=>ju([...t.attempt.issuedTokens,...Ix(t),...Mm()]),warn:l=>X(l),repositories:[{slug:t.layout.repositorySlug,path:t.layout.repositoryPath},...t.layout.relatedRepos],shared:r,onStop:l=>t.requestStop?.(l)});try{t.setupEvents.start();let l=t.setupLines?.splice(0)??[];l.length>0&&Xa.appendFileSync(su.join(e,Ph),l.map(u=>`${JSON.stringify({kind:"log",phase:"discover",text:u})}
895
- `).join(""))}catch(l){X(`Testbot V3: could not start setup events: ${l instanceof Error?l.message:String(l)}`)}}n==="deploy"&&s==="finished"&&t.setupEvents?.stop();let o=gCr[n];if(!o)return;let a=s==="finished",c=i==="aborted"?"skipped":i;hge(t.attempt,{schemaVersion:1,stage:o,event:a?"finished":"started",...a&&c?{status:c}:{}}).catch(l=>X(`Testbot V3: could not report ${n} ${s}: ${l instanceof Error?l.message:String(l)}`))}}var t0=t=>{try{return JSON.parse(Xa.readFileSync(t,"utf-8"))}catch{return}};async function Wht(t,e,r){try{await t.setupEvents?.stop(),t.stopKey?await yCr(t,t.stopKey,e.outputsDir):await ACr(t,e,r)}finally{await t.setupEvents?.stop()}}async function ACr(t,e,r){e.aborted?iu("cancelled"):e.timedOut&&iu("timed_out");let n=e.outputsDir?t0(su.join(e.outputsDir,"onboard.json")):void 0;if(!n){X("Testbot V3: onboard wrote no answer, so there is no SUT recipe to send; Skyramp records the run as an infrastructure error.");return}if(await oye(t))return;let s=t0(su.join(e.outputsDir,"deploy.json")),o=(e.stateFilePath?t0(e.stateFilePath):void 0)?.stages.deploy?.attempts?.reduce((a,c)=>a+(c.totalMs??c.durationMs??0),0);try{let a=s?FD(t.layout.repositoryPath):void 0,c=n.environment?await Yht(t,n,pme(n,s,a)):void 0,l=n.environment&&!c?await Eit(n.environment,n.components.map(d=>d.name),void 0,[...Ix(t),...Mm()]):void 0,u=mme(n,s,{deployed:l,revisionCheck:c,recipeFiles:a,deployDurationSeconds:o?Math.round(o/1e3):void 0});await gge(t.attempt,{recipe:u,sources:t.sources,producer:{testbot:m_().version,mcp:lye(r)},secrets:[...Ix(t),...Mm()]}),jn(zh.recipeUploaded,"true"),ee(`Testbot V3: SUT recipe uploaded (${u.status}); Skyramp derives the outcome.`)}catch(a){X(`Testbot V3: the SUT recipe upload failed: ${a instanceof Error?a.message:String(a)}`)}}async function Yht(t,e,r){let n=Yw(r.recipeFiles);return n?uye(t)(n.content,e.components,e.environment?.credentials??[]):void 0}function uye(t){return(e,r,n)=>Ait({content:e,components:r,read:s=>Jht(t,s,n),resolveCommit:(s,i)=>Aut(t.attempt,s,i)})}async function Jht(t,e,r){let n;try{n=await t.attempt.token()}catch(i){return{ok:!1,error:`deployed-revisions.sh was not run: no scoped GitHub token (${i instanceof Error?i.message:String(i)})`}}let s=ju([...t.attempt.issuedTokens,...Ix(t),...Mm()]);return git({content:e,env:hit(n,r),secrets:s})}function Kht(t){let e=Yw(t.testEnvironment?.files),r=t.testEnvironment?.credentials??[];return e?{deployedRevisions:()=>Jht(t,e.content,r)}:{}}var Xht=t=>[{slug:t.layout.repositorySlug,path:t.layout.repositoryPath},...t.layout.relatedRepos];async function yCr(t,e,r){iu("cancelled");try{let n=r?t0(su.join(r,"onboard-session.json"))?.sessionId:void 0;if(!n)throw new Error("onboard had not started a session");let{DefaultArtifactClient:s}=await Promise.resolve().then(()=>(pI(),iB)),i=Os(),o=await vht({sessionId:n,key:e,checkouts:Xht(t),secrets:ju([...t.attempt.issuedTokens,...Ix(t),...Mm()]),artifacts:new s,name:["skyramp-setup-checkpoint",t.attempt.manifest.runId,i.runAttempt].filter(Boolean).join("-"),providerRunId:i.runId??"",now:new Date});await Nut(t.attempt,o),ee(`Testbot V3: saved where onboard was (${o.bytes} bytes, kept ${R_} days); resume the setup from Skyramp to continue it.`)}catch(n){X(`Testbot V3: could not save where onboard was, so a resume of this setup starts over: ${n instanceof Error?n.message:String(n)}`)}}var dye="Could not restore where the setup stopped, so it starts over with the notes as they are now.",bCr="Could not restore where the setup stopped, so it starts from the Target's ready recipe, with the notes as they are now.",Zht="Could not restore where the setup stopped, so it continues from what it found, with the notes as they are now.",ECr="Could not restore where the setup stopped, so it continues from what it found and the Target's ready recipe, with the notes as they are now.";function egt(t){t.setupLines=t.setupLines?.map(e=>e===dye?bCr:e===Zht?ECr:e)}async function tgt(t){if(!(!Sy(t)||t.recheck))try{return await kut(t.attempt)??void 0}catch(e){X(`Testbot V3: could not read what the setup before this one found: ${e instanceof Error?e.message:String(e)}`);return}}function rgt(t,e){if(e.kind!=="resume")return;let r=(t.setupLines??[]).filter(n=>n!==dye);t.setupLines=[...r,Zht]}async function ngt(t,e){if(!(!Sy(t)||t.recheck))try{let r=await Tut(t.attempt);if(!r)return;if(!e)throw new Error("the workflow gives Testbot no githubToken to download it with");let{DefaultArtifactClient:n}=await Promise.resolve().then(()=>(pI(),iB)),s=await Rht({checkpoint:r,token:e,cwd:t.layout.repositoryPath,checkouts:Xht(t),artifacts:new n});return ee(`Testbot V3: resuming the stopped setup's onboard session ${s.sessionId.slice(0,8)} where it was.`),s}catch(r){X(`Testbot V3: could not restore where the stopped setup was, so this setup starts over: ${r instanceof Error?r.message:String(r)}`),(t.setupLines??=[]).push(dye);return}}function wCr(t){let e=t.split(/[\n,]/).map(r=>r.trim()).filter(Boolean);return e.length?e:void 0}function xCr(t,e={}){if(!e.sutSetup&&(t("onboard")??"").trim().toLowerCase()==="true")return"onboard is not supported on a run that tests a change \u2014 in the two-step pipeline a SUT setup runs on its own (preflight, onboard, deploy) and ends with a recipe, not a report. Set up the SUT from the Skyramp app's Setup page, or locally with the CLI's --onboard, and remove the input.";if((t("testRepoPath")??"").trim())return"testRepoPath is not supported by the staged pipeline (pipeline: staged) \u2014 it writes tests into the application checkout only, and the Action's token has no write access to another repository. Use pipeline: classic for cross-repository delivery, or remove the input."}async function SCr(t,e,r,n=Os().workspace||process.cwd()){let s=(t("relatedRepoPaths")??"").trim();if(!s)return[];let i=[];for(let o of s.split(/[\n,]/).map(a=>a.trim()).filter(Boolean)){let a=Cy.resolve(n,o);if(!Ks(n,o)){r(`relatedRepoPaths: ${o} is outside the workspace \u2014 skipping`);continue}if(!Iy.existsSync(a)){r(`relatedRepoPaths: no checkout at ${o} \u2014 skipping`);continue}let c=await e(a);if(!c){r(`relatedRepoPaths: could not resolve owner/repo for ${o} (no origin remote?) \u2014 skipping`);continue}i.push({slug:c,path:a})}return i}async function CCr(t,e,r=Os()){if(!r.repository)return;let{id:n,slug:s}=r.repository;return(await e(t).catch(()=>{}))?.toLowerCase()===s.toLowerCase()?{[n]:s}:void 0}var pye=class{constructor(e){this.link=e}link;settled=!1;async couldNotStart(e){this.settled||(this.settled=!0,await eye(e,this.link))}runBegins(){this.settled=!0}};async function sgt(){let t=qe("skyrampRunId").trim(),e=t?new pye({origin:aye(),runId:t}):void 0,r;try{let n=e2();delete process.env.INPUT_SKYRAMPLICENSEFILE;let s=bht(process.env);r=t?await $ht(t,n):void 0,await ICr(n,s,r,e)}catch(n){throw await e?.couldNotStart(n),n}finally{r&&await SW(r),r&&Iy.rmSync(xW(),{recursive:!0,force:!0})}}async function ICr(t,e,r,n){let s=r!==void 0&&Sy(r);r&&(r.heldInputs=[t.skyrampLicenseFile].filter(Boolean));let i=r?r.layout.repositoryPath:Cy.resolve(t.workingDirectory||"."),o=r?()=>r.attempt.token():Eht(),a=r?void 0:e;a&&Ot(a);let c=Aht(),l=new eV({repositoryPath:r?.pullRequest?.path??i,prNumber:c.prNumber,tokenProvider:o,githubToken:a,repoSlug:r?r.pullRequest?.repository??r.layout.repositorySlug:void 0,allowedAuthors:!s&&t.allowedAuthors?.length?t.allowedAuthors:void 0,log:Y=>ee(Y)});c=yht(c,await l.resolveContext().catch(()=>({}))),ee(`Staged pipeline \u2014 event: ${c.eventName??"?"}${c.action?`/${c.action}`:""}${c.prNumber?`, PR #${c.prNumber}`:""}${c.headRef?` (${c.headRef} \u2192 ${c.baseRef??"?"})`:""}`);let u=Bl(),d=Cy.join(u,"staged");if(c.eventName==="pull_request"&&c.action==="closed"){let Y=c.merged===!1,te=Y?`PR #${c.prNumber} was closed without merging`:`PR #${c.prNumber} was merged`;if(Y&&c.headRef){let Ae=await l.closeTestsPr({branch:qAe(c.headRef,qe("deliverBranch")||void 0),reason:`Closing: the pull request this tests PR targeted (#${c.prNumber}) was closed without being merged.`});Ae.closed&&(te+=`; closed the tests PR ${Ae.url??""}`.trimEnd())}ee(`Staged pipeline \u2014 ${te}; nothing to run.`);for(let[Ae,pe]of Object.entries(rO({admission:{admit:!1,reason:te}},{skippedPrClosed:Y})))Et(Ae,pe);jn("completed","true");return}let p=await l.admitRun();if(!p.admit){ee(`Staged pipeline \u2014 run skipped: ${p.reason}`);for(let[Y,te]of Object.entries(rO({admission:p},{skippedSelfTrigger:!0})))Et(Y,te);jn("completed","true");return}let m=r?r.layout.relatedRepos:await SCr(Y=>qe(Y),Y=>gh(Y),Y=>X(Y)),f=xCr(Y=>qe(Y),{sutSetup:s});if(f)throw new Error(f);let h=s,A=uht(qe("sutGuidance"),"sutGuidance input"),E=uW(qe("unitPath")),y,w,C;try{s?{sutEnvironment:y,answerWaitMinutes:w,testEnvironment:C}=await jht(r):y=Glt(qe("sutEnvironment"),"sutEnvironment input")}catch(Y){throw r&&Cx(),Y}for(let Y of pV(y))Ot(Y);let v=r?Object.fromEntries(r.sources.map(Y=>[Y.repository.providerRepositoryId,Y.slug])):await CCr(i,Y=>gh(Y)),k,N,M=r?.attempt.license?.runToken,T;try{if(e||o){let te=Os().workspace,Ae=[...new Set([i,...m.map(Je=>Je.path),...te?ylt(te):[]].map(Je=>Cy.resolve(Je)))],pe;for(let Je of Ae){let at=Je===Cy.resolve(i)?we=>{/^\s*authorization\s*:/i.test(we)&&(pe??=we)}:void 0,$e=glt(Je,void 0,at);$e.length&&ee(`Removed the persisted checkout credential from ${Je} (${$e.length} entr${$e.length===1?"y":"ies"}).`)}let ye=Alt();ye.length&&ee(`Removed ${ye.length} persisted checkout credential(s) from RUNNER_TEMP.`),pe&&(Ot(pe.replace(/^AUTHORIZATION:\s*\S+\s+/i,"")),l.adoptCheckoutAuthHeader(pe),ee("Deliver pushes with the credential the checkout was made with."))}else X("No githubToken or GitHub App credentials: the checkout's persisted git credential (if any) is left in place, and the stage sessions can reach it. Set persist-credentials: false on actions/checkout, or pass githubToken.");if(Iy.mkdirSync(u,{recursive:!0}),!M){if(T=Cy.join(u,"skyramp_license.lic"),!t.skyrampLicenseFile)throw new Error("skyrampLicenseFile input is required");Iy.writeFileSync(T,t.skyrampLicenseFile,{mode:384})}let Y=await fP(t);k=await oG(Y,t,u),N=d2("claude",{model:t.model||void 0,effort:vCr(qe("effort"),t.effort),useLocalAuth:t.useLocalAuth&&!t.useBedrock}),await NG(N),await TG(N),N.setupAgentEnv(t,Y)}catch(Y){r&&Cx(),await n?.couldNotStart(Y);let te=Y instanceof Error?Y.message:String(Y);await l.createProgressSink().render(Xj(te,{runUrl:l.runUrl})).catch(()=>{}),await l.endRun({status:"failure",summary:`could not start: ${te}`});for(let[Ae,pe]of Object.entries(rO({admission:{admit:!0},startupError:Y instanceof Error?Y:new Error(te)})))Et(Ae,pe);jn("completed","true"),il(`Skyramp Testbot could not start: ${te}`);return}t.generatedTestsMode!=="separate-branch"&&X(`pipeline: staged delivers only as a separate tests PR; generatedTestsMode=${t.generatedTestsMode} means nothing is committed or pushed this run`);let O=r?r.attempt.budgetMs(new Date):(t.testbotTimeout||60)*6e4;if(O<=0)throw Pht(),new Error("Testbot V3: setup used the run's whole budget; no time is left before the attempt deadline");let{stages:U,planOnly:J,withheld:z}=r&&!s?Lht(r.attempt.license?.entitlements,r.attempt.manifest.sources):{};J&&ee("Testbot V3: this organization's plan does not include test generation, so this run only analyzes the change and recommends tests.");let H=!s&&t.generatedTestsMode==="separate-branch"&&!J,Q=r&&H&&!z?.deliver?Uht(r.attempt.writeAllowed):void 0;Q&&(ee(`Testbot V3: ${Q}.`),{stages:U,planOnly:J,withheld:z}=Fht(z??{},Q));let L=s?await ngt(r,e):void 0,Z=s&&!L?await tgt(r):void 0;Z&&rgt(r,Z);let de=s&&!r.recheck&&!L?await qht(r):void 0;de&&egt(r);let ge={admission:p,platform:l,watch:r?Mht(r):void 0,log:JD,skipReport:s,run:{runDir:d,fresh:!0,budgetMs:O,...s?{stages:["onboard","deploy"],skipReport:!0,onStageEvent:Vht(r,i,!!C)}:{},...U?{stages:U}:{},withheld:z,skyrampRunUrl:r?.attempt.skyrampRunUrl,...r&&!s?Kht(r):{},...r&&s?{checkDeployedRevisions:uye(r)}:{},model:qe("model").trim()||void 0,resolveModel:wht(t),inputs:{repositoryPath:i,repositorySlug:r?.layout.repositorySlug,pullRequestRepository:r?.pullRequest?.repository,baseBranch:!r&&c.baseRef?`origin/${c.baseRef}`:void 0,relatedRepos:m,headBranch:r?void 0:c.headRef,prTitle:c.title,prDescription:c.body,...r?.pullRequests?.length?{pullRequests:r.pullRequests}:{},...r?.requirementItems?.length?{requirementItems:r.requirementItems}:{},...r?.instructions?.length?{instructions:r.instructions}:{},...r?.attempt.requestedBy?{requestedBy:r.attempt.requestedBy}:{},...r?.testPlacements?.length?{testPlacements:r.testPlacements}:{},...r?.sharedEnvironment?{sharedEnvironment:r.sharedEnvironment}:{},...r?.scheduledValidation?{scheduledValidation:r.scheduledValidation}:{},...r?.testEnvironment?{appRunning:cye(r.testEnvironment)}:{},planOnly:J,unitPath:E,skyrampMcp:{command:k.command,args:k.args.split(" ").filter(Boolean),licensePath:T,runToken:M},deliver:H&&!Q,deliverBranch:qe("deliverBranch")||void 0,trustedChecks:wCr(qe("trustedChecks")),deliverMode:c.eventName==="issue_comment"?"append":"replace",provisionRuntime:!0,testPackageDir:qe("testPackageDir").trim()||void 0,runnerPlatform:"github",onboard:h&&!J,sutGuidance:A,sutEnvironment:y,setupEvents:s,answerWaitMinutes:w,...L?{resumeSetup:L}:{},...Z?{previousSetup:Z}:{},...de?{setupBase:de}:{},...C?{testEnvironment:C}:{},repositoryIds:v},sessionRunner:cht(N.binary),sutAuth:{tokenCommand:t.authTokenCommand||void 0,uiCredentials:t.uiCredentials||void 0,sessionEnv:jft(qe("sessionEnv")),maskSecret:Y=>Ot(Y),attempts:t.authTokenRetries,retryDelaySec:t.authTokenRetryDelay}}};n?.runBegins();let be;s&&r.recheck?(be=await XAe({...ge,run:{...ge.run,stages:["deploy"],skipReport:!0,onStageEvent:Hht(r),inputs:{...ge.run.inputs,onboard:!1,recheck:!0,...r.recheck.recipe.environment?{recheckEnvironment:{address:r.recheck.recipe.environment.address}}:{}}}}),be.summary&&await zht(r,be.summary,k.nodeModulesDir)):be=await XAe(ge),r&&s?be.summary?r.recheck||await Wht(r,be.summary,k.nodeModulesDir):X("Testbot V3: the run ran no stages, so there is no SUT recipe to send; Skyramp records the run as an infrastructure error."):r&&await Ght(r,{...be.summary,deliverWithheld:z?.deliver},k.nodeModulesDir),be.admission.admit&&await xht(d);let ce=rO(be,{skippedSelfTrigger:!be.admission.admit});for(let[Y,te]of Object.entries(ce))Et(Y,te);if(jn("completed","true"),be.summary){await Sht(be.summary,be.outcome,r?.attempt.skyrampRunUrl,{sutSetup:s,closure:r?.attempt.closure}),ee(`Staged run ${be.summary.runId}: ${be.outcome?.summary} (state: ${be.summary.stateFilePath})`);let Y=AW(be.summary.stateFilePath);Y&&(wi("Stage breakdown (time / cost / context)"),ee(fht(Y,{order:be.summary.stages.map(te=>te.name),wallMinutes:yW(Y)})),ss())}n&&be.startupError&&await eye(be.startupError,n.link),be.startupError?il(`Skyramp Testbot could not start: ${be.startupError.message}`):be.outcome&&be.outcome.status==="failure"&&il(`Skyramp Testbot: ${be.outcome.summary}`)}function vCr(t,e){return(t??"").trim()?e:JKe}var RCr={useBedrock:"false",skipTargetTeardown:"false",skyrampMcpSource:"npm",skyrampMcpGithubRef:"main",nodeVersion:"lts/*",skipTargetSetup:"false",targetReadyCheckTimeout:"1800",targetReadyCheckInterval:"30",targetReadyCheckDiagnosticsCommand:`docker ps -a --format 'table {{.Names}} {{.Status}} {{.Ports}}' && docker ps -a --format '{{.Names}}' | while read name; do [ -n "$name" ] && echo "--- logs $name (last 30) ---" && docker logs --tail 30 "$name"; done`,workingDirectory:".",autoCommit:"true",commitMessage:"Skyramp Testbot: test maintenance suggestions",generatedTestsMode:"separate-branch",pipeline:"classic",postPrComment:"true",testbotMaxRetries:"3",testbotRetryDelay:"10",testExecutionTimeout:"300",testbotTimeout:"60",targetSetupRetries:"3",targetSetupRetryDelay:"10",authTokenRetries:"6",authTokenRetryDelay:"10",reportCollapsed:"true",language:"en",enableDebug:"true",sutSetupMode:"none"};function igt(t=process.env){for(let[e,r]of Object.entries(RCr)){let n=`INPUT_${e.replace(/ /g,"_").toUpperCase()}`;(t[n]??"").trim()===""&&(t[n]=r)}}var NCr="1.0.0";function agt(t,e=NCr){let r=ogt(t??""),n=ogt(e);if(!r||!n)return;let s=()=>`This Testbot engine needs the Skyramp Testbot action ${e} or later, and this workflow uses ${t}. Change the workflow to skyramp/testbot@v${n.core[0]}, or set engineVersion to an older engine.`;for(let i=0;i<3;i++){if(r.core[i]>n.core[i])return;if(r.core[i]<n.core[i])return s()}return r.preRelease&&!n.preRelease?s():void 0}function ogt(t){let e=/^v?(\d+)\.(\d+)\.(\d+)(-)?/.exec(t.trim());return e?{core:[Number(e[1]),Number(e[2]),Number(e[3])],preRelease:e[4]==="-"}:void 0}igt();var TCr=qe("pipeline").trim().toLowerCase(),kCr=TCr==="staged"?sgt:Mst,cgt=agt(process.env.TESTBOT_ACTION_VERSION);cgt?il(cgt):kCr().catch(async t=>{il(t instanceof Error?t.message:String(t))});
895
+ `).join(""))}catch(l){X(`Testbot V3: could not start setup events: ${l instanceof Error?l.message:String(l)}`)}}n==="deploy"&&s==="finished"&&t.setupEvents?.stop();let o=gCr[n];if(!o)return;let a=s==="finished",c=i==="aborted"?"skipped":i;hge(t.attempt,{schemaVersion:1,stage:o,event:a?"finished":"started",...a&&c?{status:c}:{}}).catch(l=>X(`Testbot V3: could not report ${n} ${s}: ${l instanceof Error?l.message:String(l)}`))}}var t0=t=>{try{return JSON.parse(Xa.readFileSync(t,"utf-8"))}catch{return}};async function Wht(t,e,r){try{await t.setupEvents?.stop(),t.stopKey?await yCr(t,t.stopKey,e.outputsDir):await ACr(t,e,r)}finally{await t.setupEvents?.stop()}}async function ACr(t,e,r){e.aborted?iu("cancelled"):e.timedOut&&iu("timed_out");let n=e.outputsDir?t0(su.join(e.outputsDir,"onboard.json")):void 0;if(!n){X("Testbot V3: onboard wrote no answer, so there is no SUT recipe to send; Skyramp records the run as an infrastructure error.");return}if(await oye(t))return;let s=t0(su.join(e.outputsDir,"deploy.json")),o=(e.stateFilePath?t0(e.stateFilePath):void 0)?.stages.deploy?.attempts?.reduce((a,c)=>a+(c.totalMs??c.durationMs??0),0);try{let a=s?FD(t.layout.repositoryPath):void 0,c=n.environment?await Yht(t,n,pme(n,s,a)):void 0,l=n.environment&&!c?await Eit(n.environment,n.components.map(d=>d.name),void 0,[...Ix(t),...Mm()]):void 0,u=mme(n,s,{deployed:l,revisionCheck:c,recipeFiles:a,deployDurationSeconds:o?Math.round(o/1e3):void 0});await gge(t.attempt,{recipe:u,sources:t.sources,producer:{testbot:m_().version,mcp:lye(r)},secrets:[...Ix(t),...Mm()]}),jn(zh.recipeUploaded,"true"),ee(`Testbot V3: SUT recipe uploaded (${u.status}); Skyramp derives the outcome.`)}catch(a){X(`Testbot V3: the SUT recipe upload failed: ${a instanceof Error?a.message:String(a)}`)}}async function Yht(t,e,r){let n=Yw(r.recipeFiles);return n?uye(t)(n.content,e.components,e.environment?.credentials??[]):void 0}function uye(t){return(e,r,n)=>Ait({content:e,components:r,read:s=>Jht(t,s,n),resolveCommit:(s,i)=>Aut(t.attempt,s,i)})}async function Jht(t,e,r){let n;try{n=await t.attempt.token()}catch(i){return{ok:!1,error:`deployed-revisions.sh was not run: no scoped GitHub token (${i instanceof Error?i.message:String(i)})`}}let s=ju([...t.attempt.issuedTokens,...Ix(t),...Mm()]);return git({content:e,env:hit(n,r),secrets:s})}function Kht(t){let e=Yw(t.testEnvironment?.files),r=t.testEnvironment?.credentials??[];return e?{deployedRevisions:()=>Jht(t,e.content,r)}:{}}var Xht=t=>[{slug:t.layout.repositorySlug,path:t.layout.repositoryPath},...t.layout.relatedRepos];async function yCr(t,e,r){iu("cancelled");try{let n=r?t0(su.join(r,"onboard-session.json"))?.sessionId:void 0;if(!n)throw new Error("onboard had not started a session");let{DefaultArtifactClient:s}=await Promise.resolve().then(()=>(pI(),iB)),i=Os(),o=await vht({sessionId:n,key:e,checkouts:Xht(t),secrets:ju([...t.attempt.issuedTokens,...Ix(t),...Mm()]),artifacts:new s,name:["skyramp-setup-checkpoint",t.attempt.manifest.runId,i.runAttempt].filter(Boolean).join("-"),providerRunId:i.runId??"",now:new Date});await Nut(t.attempt,o),ee(`Testbot V3: saved where onboard was (${o.bytes} bytes, kept ${R_} days); resume the setup from Skyramp to continue it.`)}catch(n){X(`Testbot V3: could not save where onboard was, so a resume of this setup starts over: ${n instanceof Error?n.message:String(n)}`)}}var dye="Could not restore where the setup stopped, so it starts over with the notes as they are now.",bCr="Could not restore where the setup stopped, so it starts from the Target's ready recipe, with the notes as they are now.",Zht="Could not restore where the setup stopped, so it continues from what it found, with the notes as they are now.",ECr="Could not restore where the setup stopped, so it continues from what it found and the Target's ready recipe, with the notes as they are now.";function egt(t){t.setupLines=t.setupLines?.map(e=>e===dye?bCr:e===Zht?ECr:e)}async function tgt(t){if(!(!Sy(t)||t.recheck))try{return await kut(t.attempt)??void 0}catch(e){X(`Testbot V3: could not read what the setup before this one found: ${e instanceof Error?e.message:String(e)}`);return}}function rgt(t,e){if(e.kind!=="resume")return;let r=(t.setupLines??[]).filter(n=>n!==dye);t.setupLines=[...r,Zht]}async function ngt(t,e){if(!(!Sy(t)||t.recheck))try{let r=await Tut(t.attempt);if(!r)return;if(!e)throw new Error("the workflow gives Testbot no githubToken to download it with");let{DefaultArtifactClient:n}=await Promise.resolve().then(()=>(pI(),iB)),s=await Rht({checkpoint:r,token:e,cwd:t.layout.repositoryPath,checkouts:Xht(t),artifacts:new n});return ee(`Testbot V3: resuming the stopped setup's onboard session ${s.sessionId.slice(0,8)} where it was.`),s}catch(r){X(`Testbot V3: could not restore where the stopped setup was, so this setup starts over: ${r instanceof Error?r.message:String(r)}`),(t.setupLines??=[]).push(dye);return}}function wCr(t){let e=t.split(/[\n,]/).map(r=>r.trim()).filter(Boolean);return e.length?e:void 0}function xCr(t,e={}){if(!e.sutSetup&&(t("onboard")??"").trim().toLowerCase()==="true")return"onboard is not supported on a run that tests a change \u2014 in the two-step pipeline a SUT setup runs on its own (preflight, onboard, deploy) and ends with a recipe, not a report. Set up the SUT from the Skyramp app's Setup page, or locally with the CLI's --onboard, and remove the input.";if((t("testRepoPath")??"").trim())return"testRepoPath is not supported by the staged pipeline (pipeline: staged) \u2014 it writes tests into the application checkout only, and the Action's token has no write access to another repository. Use pipeline: classic for cross-repository delivery, or remove the input."}async function SCr(t,e,r,n=Os().workspace||process.cwd()){let s=(t("relatedRepoPaths")??"").trim();if(!s)return[];let i=[];for(let o of s.split(/[\n,]/).map(a=>a.trim()).filter(Boolean)){let a=Cy.resolve(n,o);if(!Ks(n,o)){r(`relatedRepoPaths: ${o} is outside the workspace \u2014 skipping`);continue}if(!Iy.existsSync(a)){r(`relatedRepoPaths: no checkout at ${o} \u2014 skipping`);continue}let c=await e(a);if(!c){r(`relatedRepoPaths: could not resolve owner/repo for ${o} (no origin remote?) \u2014 skipping`);continue}i.push({slug:c,path:a})}return i}async function CCr(t,e,r=Os()){if(!r.repository)return;let{id:n,slug:s}=r.repository;return(await e(t).catch(()=>{}))?.toLowerCase()===s.toLowerCase()?{[n]:s}:void 0}var pye=class{constructor(e){this.link=e}link;settled=!1;async couldNotStart(e){this.settled||(this.settled=!0,await eye(e,this.link))}runBegins(){this.settled=!0}};async function sgt(){let t=qe("skyrampRunId").trim(),e=t?new pye({origin:aye(),runId:t}):void 0,r;try{let n=e2();delete process.env.INPUT_SKYRAMPLICENSEFILE;let s=bht(process.env);r=t?await $ht(t,n):void 0,await ICr(n,s,r,e)}catch(n){throw await e?.couldNotStart(n),n}finally{r&&await SW(r),r&&Iy.rmSync(xW(),{recursive:!0,force:!0})}}async function ICr(t,e,r,n){let s=r!==void 0&&Sy(r);r&&(r.heldInputs=[t.skyrampLicenseFile].filter(Boolean));let i=r?r.layout.repositoryPath:Cy.resolve(t.workingDirectory||"."),o=r?()=>r.attempt.token():Eht(),a=r?void 0:e;a&&Ot(a);let c=Aht(),l=new eV({repositoryPath:r?.pullRequest?.path??i,prNumber:c.prNumber,tokenProvider:o,githubToken:a,repoSlug:r?r.pullRequest?.repository??r.layout.repositorySlug:void 0,allowedAuthors:!s&&t.allowedAuthors?.length?t.allowedAuthors:void 0,log:Y=>ee(Y)});c=yht(c,await l.resolveContext().catch(()=>({}))),ee(`Staged pipeline \u2014 event: ${c.eventName??"?"}${c.action?`/${c.action}`:""}${c.prNumber?`, PR #${c.prNumber}`:""}${c.headRef?` (${c.headRef} \u2192 ${c.baseRef??"?"})`:""}`);let u=Bl(),d=Cy.join(u,"staged");if(c.eventName==="pull_request"&&c.action==="closed"){let Y=c.merged===!1,te=Y?`PR #${c.prNumber} was closed without merging`:`PR #${c.prNumber} was merged`;if(Y&&c.headRef){let Ae=await l.closeTestsPr({branch:qAe(c.headRef,qe("deliverBranch")||void 0),reason:`Closing: the pull request this tests PR targeted (#${c.prNumber}) was closed without being merged.`});Ae.closed&&(te+=`; closed the tests PR ${Ae.url??""}`.trimEnd())}ee(`Staged pipeline \u2014 ${te}; nothing to run.`);for(let[Ae,pe]of Object.entries(rO({admission:{admit:!1,reason:te}},{skippedPrClosed:Y})))Et(Ae,pe);jn("completed","true");return}let p=await l.admitRun();if(!p.admit){ee(`Staged pipeline \u2014 run skipped: ${p.reason}`);for(let[Y,te]of Object.entries(rO({admission:p},{skippedSelfTrigger:!0})))Et(Y,te);jn("completed","true");return}let m=r?r.layout.relatedRepos:await SCr(Y=>qe(Y),Y=>gh(Y),Y=>X(Y)),f=xCr(Y=>qe(Y),{sutSetup:s});if(f)throw new Error(f);let h=s,A=uht(qe("sutGuidance"),"sutGuidance input"),E=uW(qe("unitPath")),y,w,C;try{s?{sutEnvironment:y,answerWaitMinutes:w,testEnvironment:C}=await jht(r):y=Glt(qe("sutEnvironment"),"sutEnvironment input")}catch(Y){throw r&&Cx(),Y}for(let Y of pV(y))Ot(Y);let v=r?Object.fromEntries(r.sources.map(Y=>[Y.repository.providerRepositoryId,Y.slug])):await CCr(i,Y=>gh(Y)),k,N,M=r?.attempt.license?.runToken,T;try{if(e||o){let te=Os().workspace,Ae=[...new Set([i,...m.map(Je=>Je.path),...te?ylt(te):[]].map(Je=>Cy.resolve(Je)))],pe;for(let Je of Ae){let at=Je===Cy.resolve(i)?we=>{/^\s*authorization\s*:/i.test(we)&&(pe??=we)}:void 0,$e=glt(Je,void 0,at);$e.length&&ee(`Removed the persisted checkout credential from ${Je} (${$e.length} entr${$e.length===1?"y":"ies"}).`)}let ye=Alt();ye.length&&ee(`Removed ${ye.length} persisted checkout credential(s) from RUNNER_TEMP.`),pe&&(Ot(pe.replace(/^AUTHORIZATION:\s*\S+\s+/i,"")),l.adoptCheckoutAuthHeader(pe),ee("Deliver pushes with the credential the checkout was made with."))}else X("No githubToken or GitHub App credentials: the checkout's persisted git credential (if any) is left in place, and the stage sessions can reach it. Set persist-credentials: false on actions/checkout, or pass githubToken.");if(Iy.mkdirSync(u,{recursive:!0}),!M){if(T=Cy.join(u,"skyramp_license.lic"),!t.skyrampLicenseFile)throw new Error("skyrampLicenseFile input is required");Iy.writeFileSync(T,t.skyrampLicenseFile,{mode:384})}let Y=await fP(t);k=await oG(Y,t,u),N=d2("claude",{model:t.model||void 0,effort:vCr(qe("effort"),t.effort),useLocalAuth:t.useLocalAuth&&!t.useBedrock,claudeCodeVersion:r?.attempt.claudeCodeVersion}),await NG(N),await TG(N),N.setupAgentEnv(t,Y)}catch(Y){r&&Cx(),await n?.couldNotStart(Y);let te=Y instanceof Error?Y.message:String(Y);await l.createProgressSink().render(Xj(te,{runUrl:l.runUrl})).catch(()=>{}),await l.endRun({status:"failure",summary:`could not start: ${te}`});for(let[Ae,pe]of Object.entries(rO({admission:{admit:!0},startupError:Y instanceof Error?Y:new Error(te)})))Et(Ae,pe);jn("completed","true"),il(`Skyramp Testbot could not start: ${te}`);return}t.generatedTestsMode!=="separate-branch"&&X(`pipeline: staged delivers only as a separate tests PR; generatedTestsMode=${t.generatedTestsMode} means nothing is committed or pushed this run`);let O=r?r.attempt.budgetMs(new Date):(t.testbotTimeout||60)*6e4;if(O<=0)throw Pht(),new Error("Testbot V3: setup used the run's whole budget; no time is left before the attempt deadline");let{stages:U,planOnly:J,withheld:z}=r&&!s?Lht(r.attempt.license?.entitlements,r.attempt.manifest.sources):{};J&&ee("Testbot V3: this organization's plan does not include test generation, so this run only analyzes the change and recommends tests.");let H=!s&&t.generatedTestsMode==="separate-branch"&&!J,Q=r&&H&&!z?.deliver?Uht(r.attempt.writeAllowed):void 0;Q&&(ee(`Testbot V3: ${Q}.`),{stages:U,planOnly:J,withheld:z}=Fht(z??{},Q));let L=s?await ngt(r,e):void 0,Z=s&&!L?await tgt(r):void 0;Z&&rgt(r,Z);let de=s&&!r.recheck&&!L?await qht(r):void 0;de&&egt(r);let ge={admission:p,platform:l,watch:r?Mht(r):void 0,log:JD,skipReport:s,run:{runDir:d,fresh:!0,budgetMs:O,...s?{stages:["onboard","deploy"],skipReport:!0,onStageEvent:Vht(r,i,!!C)}:{},...U?{stages:U}:{},withheld:z,skyrampRunUrl:r?.attempt.skyrampRunUrl,...r&&!s?Kht(r):{},...r&&s?{checkDeployedRevisions:uye(r)}:{},model:qe("model").trim()||void 0,resolveModel:wht(t),inputs:{repositoryPath:i,repositorySlug:r?.layout.repositorySlug,pullRequestRepository:r?.pullRequest?.repository,baseBranch:!r&&c.baseRef?`origin/${c.baseRef}`:void 0,relatedRepos:m,headBranch:r?void 0:c.headRef,prTitle:c.title,prDescription:c.body,...r?.pullRequests?.length?{pullRequests:r.pullRequests}:{},...r?.requirementItems?.length?{requirementItems:r.requirementItems}:{},...r?.instructions?.length?{instructions:r.instructions}:{},...r?.attempt.requestedBy?{requestedBy:r.attempt.requestedBy}:{},...r?.testPlacements?.length?{testPlacements:r.testPlacements}:{},...r?.sharedEnvironment?{sharedEnvironment:r.sharedEnvironment}:{},...r?.scheduledValidation?{scheduledValidation:r.scheduledValidation}:{},...r?.testEnvironment?{appRunning:cye(r.testEnvironment)}:{},planOnly:J,unitPath:E,skyrampMcp:{command:k.command,args:k.args.split(" ").filter(Boolean),licensePath:T,runToken:M},deliver:H&&!Q,deliverBranch:qe("deliverBranch")||void 0,trustedChecks:wCr(qe("trustedChecks")),deliverMode:c.eventName==="issue_comment"?"append":"replace",provisionRuntime:!0,testPackageDir:qe("testPackageDir").trim()||void 0,runnerPlatform:"github",onboard:h&&!J,sutGuidance:A,sutEnvironment:y,setupEvents:s,answerWaitMinutes:w,...L?{resumeSetup:L}:{},...Z?{previousSetup:Z}:{},...de?{setupBase:de}:{},...C?{testEnvironment:C}:{},repositoryIds:v},sessionRunner:cht(N.binary),sutAuth:{tokenCommand:t.authTokenCommand||void 0,uiCredentials:t.uiCredentials||void 0,sessionEnv:jft(qe("sessionEnv")),maskSecret:Y=>Ot(Y),attempts:t.authTokenRetries,retryDelaySec:t.authTokenRetryDelay}}};n?.runBegins();let be;s&&r.recheck?(be=await XAe({...ge,run:{...ge.run,stages:["deploy"],skipReport:!0,onStageEvent:Hht(r),inputs:{...ge.run.inputs,onboard:!1,recheck:!0,...r.recheck.recipe.environment?{recheckEnvironment:{address:r.recheck.recipe.environment.address}}:{}}}}),be.summary&&await zht(r,be.summary,k.nodeModulesDir)):be=await XAe(ge),r&&s?be.summary?r.recheck||await Wht(r,be.summary,k.nodeModulesDir):X("Testbot V3: the run ran no stages, so there is no SUT recipe to send; Skyramp records the run as an infrastructure error."):r&&await Ght(r,{...be.summary,deliverWithheld:z?.deliver},k.nodeModulesDir),be.admission.admit&&await xht(d);let ce=rO(be,{skippedSelfTrigger:!be.admission.admit});for(let[Y,te]of Object.entries(ce))Et(Y,te);if(jn("completed","true"),be.summary){await Sht(be.summary,be.outcome,r?.attempt.skyrampRunUrl,{sutSetup:s,closure:r?.attempt.closure}),ee(`Staged run ${be.summary.runId}: ${be.outcome?.summary} (state: ${be.summary.stateFilePath})`);let Y=AW(be.summary.stateFilePath);Y&&(wi("Stage breakdown (time / cost / context)"),ee(fht(Y,{order:be.summary.stages.map(te=>te.name),wallMinutes:yW(Y)})),ss())}n&&be.startupError&&await eye(be.startupError,n.link),be.startupError?il(`Skyramp Testbot could not start: ${be.startupError.message}`):be.outcome&&be.outcome.status==="failure"&&il(`Skyramp Testbot: ${be.outcome.summary}`)}function vCr(t,e){return(t??"").trim()?e:JKe}var RCr={useBedrock:"false",skipTargetTeardown:"false",skyrampMcpSource:"npm",skyrampMcpGithubRef:"main",nodeVersion:"lts/*",skipTargetSetup:"false",targetReadyCheckTimeout:"1800",targetReadyCheckInterval:"30",targetReadyCheckDiagnosticsCommand:`docker ps -a --format 'table {{.Names}} {{.Status}} {{.Ports}}' && docker ps -a --format '{{.Names}}' | while read name; do [ -n "$name" ] && echo "--- logs $name (last 30) ---" && docker logs --tail 30 "$name"; done`,workingDirectory:".",autoCommit:"true",commitMessage:"Skyramp Testbot: test maintenance suggestions",generatedTestsMode:"separate-branch",pipeline:"classic",postPrComment:"true",testbotMaxRetries:"3",testbotRetryDelay:"10",testExecutionTimeout:"300",testbotTimeout:"60",targetSetupRetries:"3",targetSetupRetryDelay:"10",authTokenRetries:"6",authTokenRetryDelay:"10",reportCollapsed:"true",language:"en",enableDebug:"true",sutSetupMode:"none"};function igt(t=process.env){for(let[e,r]of Object.entries(RCr)){let n=`INPUT_${e.replace(/ /g,"_").toUpperCase()}`;(t[n]??"").trim()===""&&(t[n]=r)}}var NCr="1.0.0";function agt(t,e=NCr){let r=ogt(t??""),n=ogt(e);if(!r||!n)return;let s=()=>`This Testbot engine needs the Skyramp Testbot action ${e} or later, and this workflow uses ${t}. Change the workflow to skyramp/testbot@v${n.core[0]}, or set engineVersion to an older engine.`;for(let i=0;i<3;i++){if(r.core[i]>n.core[i])return;if(r.core[i]<n.core[i])return s()}return r.preRelease&&!n.preRelease?s():void 0}function ogt(t){let e=/^v?(\d+)\.(\d+)\.(\d+)(-)?/.exec(t.trim());return e?{core:[Number(e[1]),Number(e[2]),Number(e[3])],preRelease:e[4]==="-"}:void 0}igt();var TCr=qe("pipeline").trim().toLowerCase(),kCr=TCr==="staged"?sgt:Mst,cgt=agt(process.env.TESTBOT_ACTION_VERSION);cgt?il(cgt):kCr().catch(async t=>{il(t instanceof Error?t.message:String(t))});
896
896
  /*! Bundled license information:
897
897
 
898
898
  undici/lib/web/fetch/body.js: