@waitcher/cli 0.2.2 → 0.2.4
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/cli.mjs +284 -47
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -54888,6 +54888,36 @@ test("page loads", async ({ app, browser }) => {
|
|
|
54888
54888
|
await app.screenshot("page");
|
|
54889
54889
|
});
|
|
54890
54890
|
`;
|
|
54891
|
+
var certificateExample = {
|
|
54892
|
+
schemaVersion: 1,
|
|
54893
|
+
name: "TLS certificate",
|
|
54894
|
+
type: "certificate",
|
|
54895
|
+
target: "https://example.com",
|
|
54896
|
+
enabled: false,
|
|
54897
|
+
interval: 1800,
|
|
54898
|
+
timeout: 15,
|
|
54899
|
+
failureThreshold: 2,
|
|
54900
|
+
settings: { certificateMinDays: 14 }
|
|
54901
|
+
};
|
|
54902
|
+
var apiExample = {
|
|
54903
|
+
schemaVersion: 1,
|
|
54904
|
+
name: "API workflow",
|
|
54905
|
+
type: "api",
|
|
54906
|
+
target: "https://example.com/",
|
|
54907
|
+
enabled: false,
|
|
54908
|
+
interval: 1800,
|
|
54909
|
+
timeout: 30,
|
|
54910
|
+
failureThreshold: 2
|
|
54911
|
+
};
|
|
54912
|
+
var apiScriptExample = `import { test, expect } from "e2e";
|
|
54913
|
+
|
|
54914
|
+
test("API responds", async () => {
|
|
54915
|
+
const target = new URL(process.env.TARGET_URL!);
|
|
54916
|
+
const response = await fetch(new URL("/", target));
|
|
54917
|
+
expect(response.status).toBe(200);
|
|
54918
|
+
// Replace with the requests and invariants of the user's API journey.
|
|
54919
|
+
});
|
|
54920
|
+
`;
|
|
54891
54921
|
var aiEndpointExample = {
|
|
54892
54922
|
schemaVersion: 1,
|
|
54893
54923
|
name: "AI product / deterministic fixture",
|
|
@@ -54956,6 +54986,10 @@ async function readManifest(path2, { enable = false } = {}) {
|
|
|
54956
54986
|
}
|
|
54957
54987
|
if (!value2 || Array.isArray(value2) || typeof value2 !== "object")
|
|
54958
54988
|
throw new Error("Monitor configuration must be a JSON object.");
|
|
54989
|
+
if (Array.isArray(value2.monitors) && value2.environments)
|
|
54990
|
+
throw new Error(
|
|
54991
|
+
`${path2} is a project file (waitcher.json format), not one monitor. Run its api/browser entries locally with waitcher config validate --file ${path2} --env NAME --verify [--key KEY].`
|
|
54992
|
+
);
|
|
54959
54993
|
const { scriptFile, ...definition } = value2;
|
|
54960
54994
|
if (scriptFile !== void 0) {
|
|
54961
54995
|
if (definition.type === "ai")
|
|
@@ -58503,6 +58537,96 @@ var entries = {
|
|
|
58503
58537
|
meaning: "The server is restoring, restarting or unreachable behind its proxy.",
|
|
58504
58538
|
fix: "Retry reads later; inspect state before repeating any write."
|
|
58505
58539
|
},
|
|
58540
|
+
INVOCATION_BUDGET_EXHAUSTED: {
|
|
58541
|
+
title: "Daily endpoint invocations used",
|
|
58542
|
+
meaning: "An account, project or monitor daily invocation cap for AI endpoint or httpAuth checks is reached, or restored usage is held until the next UTC reset. No request was sent; runs record a coverage error, not an incident.",
|
|
58543
|
+
fix: "Read waitcher account invocations and wait for the UTC reset. Raise a cap with account budget or project budget only when the user asks; never loop.",
|
|
58544
|
+
exitCode: 6
|
|
58545
|
+
},
|
|
58546
|
+
HTTP_AUTH_UNAVAILABLE: {
|
|
58547
|
+
title: "Verified credential binding unavailable",
|
|
58548
|
+
meaning: "The httpAuth target is not verified (verification lasts 24 hours), or the credential is disabled or at another revision. No request was sent.",
|
|
58549
|
+
fix: "Inspect waitcher target get and target credential list. Renew with target challenge and target verify, then bind the current credentialRevision in the monitor.",
|
|
58550
|
+
exitCode: 1
|
|
58551
|
+
},
|
|
58552
|
+
BROWSER_IDENTITY_UNAVAILABLE: {
|
|
58553
|
+
title: "Browser identity unavailable",
|
|
58554
|
+
meaning: "The bound browser identity is disabled, expired or at another revision, or its target is not verified.",
|
|
58555
|
+
fix: "Inspect waitcher identity get; rotate or enable it, then bind the current {identityId, revision} in the monitor.",
|
|
58556
|
+
exitCode: 1
|
|
58557
|
+
},
|
|
58558
|
+
TARGET_VERIFICATION_FAILED: {
|
|
58559
|
+
title: "Target verification failed",
|
|
58560
|
+
meaning: "The proof at /.well-known/waitcher-verification.txt was missing, different or expired (proofs last 15 minutes).",
|
|
58561
|
+
fix: "Publish the exact proof file content, run target challenge for a new proof if it expired, then target verify.",
|
|
58562
|
+
exitCode: 1
|
|
58563
|
+
},
|
|
58564
|
+
REDIRECT_REFUSED: {
|
|
58565
|
+
title: "Endpoint redirected",
|
|
58566
|
+
meaning: "The endpoint answered with a redirect; endpoint and authenticated checks never follow redirects.",
|
|
58567
|
+
fix: "Point the target at the final URL.",
|
|
58568
|
+
exitCode: 4
|
|
58569
|
+
},
|
|
58570
|
+
RESPONSE_TOO_LARGE: {
|
|
58571
|
+
title: "Response too large",
|
|
58572
|
+
meaning: "The endpoint response exceeded the bounded size the check reads.",
|
|
58573
|
+
fix: "Point the check at an endpoint with a smaller response, or use an api script for large payloads.",
|
|
58574
|
+
exitCode: 4
|
|
58575
|
+
},
|
|
58576
|
+
ASSERTION_FAILED: {
|
|
58577
|
+
title: "Scenario verification failed",
|
|
58578
|
+
meaning: "A verify phase called scenario.assert(false): the product outcome was wrong, even if the script caught it.",
|
|
58579
|
+
fix: "Read waitcher run scenarios and run trace. Fix the product, or the expectation only when the user agrees it was wrong.",
|
|
58580
|
+
exitCode: 4
|
|
58581
|
+
},
|
|
58582
|
+
CLEANUP_UNVERIFIED: {
|
|
58583
|
+
title: "Cleanup not verified",
|
|
58584
|
+
meaning: "The scenario could not prove that created state belongs to this run, so it left it untouched. The run is a coverage error.",
|
|
58585
|
+
fix: "Inspect the resource yourself and reconcile it before repeating a test that changes state.",
|
|
58586
|
+
exitCode: 4
|
|
58587
|
+
},
|
|
58588
|
+
EXECUTION_ERROR: {
|
|
58589
|
+
title: "Check could not complete",
|
|
58590
|
+
meaning: "The runner failed before it established the product outcome; coverage is missing, not a product failure.",
|
|
58591
|
+
fix: "Run waitcher run diagnose --id RUN_ID and reproduce locally before changing the test.",
|
|
58592
|
+
exitCode: 4
|
|
58593
|
+
},
|
|
58594
|
+
AI_BUDGET_EXHAUSTED: {
|
|
58595
|
+
title: "Model allowance used",
|
|
58596
|
+
meaning: "A model connection's per-run or daily call or token allowance is used.",
|
|
58597
|
+
fix: "Read waitcher connection usage. Do not raise allowances unless the user asks.",
|
|
58598
|
+
exitCode: 1
|
|
58599
|
+
},
|
|
58600
|
+
AI_CREDENTIAL_UNAVAILABLE: {
|
|
58601
|
+
title: "Model credential unavailable",
|
|
58602
|
+
meaning: "The model connection is disabled, deleted or its key cannot be used.",
|
|
58603
|
+
fix: "Inspect waitcher connection get; the user rotates or enables it.",
|
|
58604
|
+
exitCode: 1
|
|
58605
|
+
},
|
|
58606
|
+
ACCOUNT_DELETED: {
|
|
58607
|
+
title: "Account deleted",
|
|
58608
|
+
meaning: "Deletion of this account is confirmed; it refuses further requests.",
|
|
58609
|
+
fix: "Read progress with waitcher account deletion-status --receipt-file PRIVATE_RECEIPT.",
|
|
58610
|
+
exitCode: 1
|
|
58611
|
+
},
|
|
58612
|
+
INTEGRITY_ERROR: {
|
|
58613
|
+
title: "Evidence checksum mismatch",
|
|
58614
|
+
meaning: "Downloaded evidence or a local report does not match its recorded size or SHA-256.",
|
|
58615
|
+
fix: "Do not use the file. Download it once more; if it still fails, report the run ID.",
|
|
58616
|
+
exitCode: 1
|
|
58617
|
+
},
|
|
58618
|
+
DOWNLOAD_FAILED: {
|
|
58619
|
+
title: "Evidence download failed",
|
|
58620
|
+
meaning: "The evidence expired or was never retained, or the output file exists or its directory is missing.",
|
|
58621
|
+
fix: "Check artifactManifest in waitcher run status; save to an unused file in an existing directory.",
|
|
58622
|
+
exitCode: 1
|
|
58623
|
+
},
|
|
58624
|
+
SERVICE_ERROR: {
|
|
58625
|
+
title: "Unexpected server error",
|
|
58626
|
+
meaning: "The server returned an error without a more specific code.",
|
|
58627
|
+
fix: "Read the current state before repeating a write; report the requestId if it persists.",
|
|
58628
|
+
exitCode: 1
|
|
58629
|
+
},
|
|
58506
58630
|
USAGE_ERROR: {
|
|
58507
58631
|
title: "Wrong command or options",
|
|
58508
58632
|
meaning: "The CLI rejected the command line before contacting anything.",
|
|
@@ -60791,6 +60915,7 @@ async function verifyLocally(options) {
|
|
|
60791
60915
|
try {
|
|
60792
60916
|
for (const { key, definition } of resolved.monitors) {
|
|
60793
60917
|
if (!["api", "browser"].includes(definition.type)) continue;
|
|
60918
|
+
if (options.keys && !options.keys.includes(key)) continue;
|
|
60794
60919
|
const { script, ...manifest } = definition;
|
|
60795
60920
|
const file2 = join12(scratch, `${key}.json`);
|
|
60796
60921
|
await writeFile8(join12(scratch, `${key}.mjs`), script, { mode: 384 });
|
|
@@ -60928,19 +61053,22 @@ function deployNextSteps(result2, {
|
|
|
60928
61053
|
}
|
|
60929
61054
|
|
|
60930
61055
|
// ../../skills/waitcher/SKILL.md
|
|
60931
|
-
var SKILL_default = "---\nname: waitcher\ndescription: Set up and maintain Waitcher monitoring from a repository with the waitcher CLI. Use to turn a product's critical journeys into HTTP, certificate, heartbeat, API or browser monitors in waitcher.json, verify them locally, deploy them through a reviewed plan, and diagnose failures from real evidence.\n---\n\n# Waitcher\n\nYou operate the waitcher CLI for the user. The repository is the source of truth: `waitcher.json` declares the monitors of one project per environment, test files hold the scripts, and `waitcher deploy` reconciles one environment at a time.
|
|
61056
|
+
var SKILL_default = "---\nname: waitcher\ndescription: Set up and maintain Waitcher monitoring from a repository with the waitcher CLI. Use to turn a product's critical journeys into HTTP, certificate, heartbeat, API or browser monitors in waitcher.json, verify them locally, deploy them through a reviewed plan, and diagnose failures from real evidence.\n---\n\n# Waitcher\n\nYou operate the waitcher CLI for the user. The repository is the source of truth: `waitcher.json` declares the monitors of one project per environment, test files hold the scripts, and `waitcher deploy` reconciles one environment at a time. Commands print JSON on stdout (`run diagnose` and `run scenarios` need `--json` for it); failures print `{error:{code,message}}` on stderr. Read the exit code, every `issues` entry and every `next` step.\n\nThis skill says what to do and in which order. For exact syntax use the installed CLI, never memory: `waitcher help TOPIC` (for example `help deploy`, `help secret`, `help run`) prints only that part of the help for this CLI version, and `waitcher explain CODE` explains an issue or error code. The user guide at https://waitcher.dev/docs/ explains the same product for people; link the user to a page (alerts, access tokens, account) instead of retelling it.\n\n## Rules\n\n- Never put secrets in files, arguments or output. Pipe values to `--value-stdin`.\n- Keep new monitors paused. Pass `--activate-new`, `--prune`, `--adopt` or `--smoke` only when the user agreed to that effect.\n- Show the user the plan's `changes` before `deploy apply`, and apply with `--based-on` from that plan.\n- A local pass is not hosted permission. If capabilities or limits refuse something, report it; never switch accounts, raise limits or remove assertions to get a green result.\n- An agent's own success claim is not evidence. Verify outcomes through the product's state or real run evidence.\n- Do not turn a whole regression suite into monitors. Pick two to five journeys whose failure the user would act on.\n\n## Workflow\n\n1. **Check the setup.** Run `waitcher doctor` in the repository. Fix `error` checks first; its `next` lists exact commands. Without a session, ask the user to run `waitcher auth login` (CI uses a token).\n2. **Understand the product.** Read the repository: base URLs per environment, existing E2E tests, critical journeys, test accounts and jobs. Ask the user which failures should alert them.\n3. **Start the file.** `waitcher config init --project-name NAME --target https://BASE` when there is no `waitcher.json`. Give each monitor a stable lowercase `key`; changing a key later replaces the monitor and its history.\n4. **Choose types.** `http` for status and content, `certificate` for TLS expiry, `heartbeat` for jobs that report in, `api` for a multi-request invariant, `browser` for a user journey. `waitcher monitor init --type TYPE --file x.json` prints a complete example of any type. Script monitors name their test with `entry`; read [authoring](references/authoring.md) before writing one. They need the pinned runtime next to `waitcher.json`: run `waitcher runtime install`, show the user the steps it lists (npm install runs package install scripts; browser projects download Chromium), and after they agree rerun it with `--yes`. It writes exact pins into `package.json`, updates `.gitignore` and is safe to repeat. The same command upgrades the project after a CLI update (`RUNTIME_VERSION_OUTDATED`).\n5. **Validate offline.** `waitcher config validate` resolves every environment and builds every entry. Fix each issue at its `path`. Add `--env NAME --verify` (optionally `--key KEY`) to run the api/browser entries locally without an account; read the run directory it names when one fails.\n6. **Plan.** `waitcher deploy plan --env NAME --verify` runs script monitors locally against that environment, then asks the server. Resolve errors (`SECRET_MISSING`: ask the user for the value and run `waitcher secret set`; `ADOPTION_CANDIDATE`: ask whether the existing monitor is the same check).\n7. **Apply.** After the user accepts the plan: `waitcher deploy apply --env NAME --based-on BASED_ON`, where BASED_ON is the plan's `basedOn` or `none` when it is null (first deploy); the plan's `next` prints the exact command. Add `--smoke` for one hosted run per changed monitor. New monitors stay paused.\n8. **Report.** Give the user the monitor IDs, what each checks, local and hosted results, evidence paths and anything still pending (paused schedules, heartbeat credentials, secrets for other environments). If `waitcher alert policy list` shows no routing, failures will alert nobody: point the user to https://waitcher.dev/docs/alerts.\n\nFor CI, `waitcher ci init` writes a workflow that plans on pull requests and applies on the main branch. Details of secrets, adoption, rollback and CI are in [deploy](references/deploy.md).\n\n## When something fails\n\n- `waitcher --help` prints a short overview of topics; `waitcher help TOPIC` (or `waitcher GROUP --help`) prints one part with the exit codes; `waitcher help all` is long, avoid it.\n- Exit 2: fix the file or input; exit 3: sign in; exit 4: a check failed (inspect evidence); exit 6: quota, rate or queue limit; exit 7: not permitted; exit 8: conflict or managed by `waitcher.json`; exit 9: not found; exit 10: service unavailable.\n- For a failed run, read [diagnosis](references/diagnosis.md): `waitcher run diagnose --id RUN_ID`, then reproduce locally before changing the test.\n- Never retry a write automatically after an uncertain result; read the current state first.\n\n## References\n\n- [authoring](references/authoring.md): choosing a type, writing API and browser tests, local runs and evidence, single-monitor apply.\n- [deploy](references/deploy.md): waitcher.json details, secrets, adoption, rollback, CI.\n- [diagnosis](references/diagnosis.md): run diagnosis and reproduction.\n- [optional capabilities](references/optional-capabilities.md): visual baselines, browser identities, verified HTTP credentials, invocation budgets.\n- [AI and agents](references/ai-and-agents.md): agent outcome checks, scenario evidence, AI endpoints and suites, calibration, AI steps in scripts, protected requests.\n- Read the last two only when `waitcher system capabilities` reports the feature and the user needs it.\n";
|
|
60932
61057
|
|
|
60933
61058
|
// ../../skills/waitcher/references/authoring.md
|
|
60934
|
-
var authoring_default = '# Authoring and running monitors\n\nRead when writing or changing a test, choosing a monitor type, or running it locally. Commands assume the waitcher CLI; run `waitcher --help` for exact syntax.\n\n## Author a monitor\n\nFor hosted scripts using `#waitcher/scenario`, first confirm `features.scenarioEvidence` through `system capabilities`, alongside script admission. Older servers may not provide this helper. Do not silently remove required scenario checks to make an unsupported run pass. Capability discovery is separate from native security, capacity and production release acceptance.\n\nUse a deterministic HTTP check for simple status/content/JSON assertions. Use an API script for a multi-request invariant and a browser script for a user journey. Keep scripts focused on the requested behavior and use controlled test identities for actions that change state.\n\nFor an agent that changes application state, start with `monitor init --template agent-outcome --file outcome.json --target https://product.example/api/`. It creates a paused ordinary API script, with no model binding or paid-provider requirement. Adapt its fixed `agent/tasks` submission and `notes/{runId}` resource paths, disposable test namespace and exact expected fields. It submits one action, ignores claims of success and response-provided URLs, then independently reads the known resource at most three times. A fresh per-run random `id` and `correlationId` must both match, alongside the expected result. Action transport errors are never automatically retried. Cleanup runs in `finally` only after an independent read proves the resource belongs to this run; cleanup failures fail the test. If ownership or the action result is uncertain, it records cleanup as unverified and leaves state untouched. Reconcile possible late actions before repeating a mutating test. This pattern verifies the chosen outcome, not the agent\'s overall quality or the correctness of its explanation.\n\nThe starter uses the optional `#waitcher/scenario` helper with required submit/action, observe, verify and cleanup phases. `createScenario({id, phases})` returns `phase(id, callback)`, `assert(boolean)` and `incomplete(reason)`. Call signals only inside an active phase. Every scenario needs a required verify phase, and an executed verify phase must call `scenario.assert` at least once; an empty verification cannot establish pass. `assert(false)` records a business failure even if caught; ordinary callback exceptions and `incomplete("CLEANUP_UNVERIFIED")` record coverage errors. Inspect `.e2e/waitcher-scenarios.json` in the private evidence: required phases that never ran or remain in flight also prevent a pass. Coverage error takes precedence while retaining failed verification facts. A false agent claim can therefore produce a failed verify phase and an overall error when cleanup remains uncertain. The helper does not automatically classify arbitrary E2E assertions or infer agent/tool traces. Use stable non-secret scenario/phase IDs, avoid raw response values in assertions, and do not use report labels as secret storage.\n\nUse the unchanged file with `monitor validate`, account-free `run local --file outcome.json --runtime YOUR_PINNED_RUNTIME`, and the existing API-script editor or `monitor apply --file outcome.json --dry-run`. Keep it paused after applying. Project authors can extract the script into `scriptFile`, keep helper imports and use `monitor build` to create one portable script; `#waitcher/scenario` stays external and is supplied by the manifest runner. The complete CLI includes `scenario-runtime.mjs`; keep package companions together. Standalone `--project` needs its own helper integration. The starter\'s default is credential-free. Optional local/trusted-administrator bearer tokens use `CHECK_AGENT_ACTION_TOKEN`, `CHECK_RESOURCE_READ_TOKEN` and `CHECK_RESOURCE_CLEANUP_TOKEN`, explicitly listed in `settings.envNames` and supplied outside the manifest. Hosted personal scripts receive `CHECK_*` values only from their project environment\'s secrets (`waitcher secret set`), never from the server\'s environment; do not work around that boundary. Do not log credentials or response bodies, and do not promise complete trace masking for arbitrary custom environment values. Local success does not establish hosted admission or isolation.\n\nFor a single AI product endpoint, prefer a declarative `type: "ai"` fixture over an E2E script. Run `monitor init --type ai --target https://product.example/ai --file ai.json`, replace the sample request and response checks with the product contract, then `monitor validate --file ai.json`. JSON-pointer assertions support exact equality, type, existence and literal case-sensitive contains/not-contains/contains-any/contains-all checks; an optional bounded response schema checks structure. `run local --file ai.json` uses the same one-POST adapter without an account, model connection, provider key or E2E runtime. It only reaches public HTTPS endpoints and supports optional verified `httpAuth` references as described below; arbitrary custom headers and account-session inheritance are forbidden. Inspect the structured per-assertion report and distinguish transport coverage errors from product assertion failures. Applying the same file to hosted monitoring requires `features.aiEndpoints`; personal admission also requires a currently verified `httpAuth` binding; keep it paused unless scheduling is authorized. This verifies a chosen fixture, not general agent quality or a calibrated semantic judge.\n\nFor a small set of representative prompts against the same endpoint, use `aiEndpoint.adapter: "json-http-suite-v1"` and `cases` with 1\u20135 objects containing a stable unique `id`, readable `name`, positive `revision` (default 1), literal JSON-object `fixture`, and assertions and/or response schema. The suite `invocationBudget` equals its case count and is filled in when omitted. Validate offline and run the unchanged manifest locally before applying it; hosted capability `features.aiEndpointSuites` must be available. Cases run serially under one total monitor timeout. Assertion failures permit later cases; a transport/deadline error stops them as `not-run`. Inspect every case and coverage summary, not only the overall status. The controller reserves the full case count before any hosted request, and partial/uncertain runs retain that conservative allowance. Reported attempted requests can therefore be fewer than charged units. Deterministic suites do not provide semantic grading; do not describe text matching as semantic correctness. Single fixtures and each suite case can opt into literal variables with variables:{name:"string"} and exact {{name}} placeholders inside fixture string values. Without variables, braces remain literal. Use at most 16 names, ASCII letter followed by letters/digits/underscores (64 characters); prototype-related names are refused. Each value fits 4 KiB UTF-8, maps and rendered fixtures 16 KiB and complete configurations 64 KiB. No expressions, environment lookup, key/URL/assertion/rubric interpolation, matrix expansion or recursive replacement is supported. Missing/malformed placeholders reject before requests. Use non-secret data. Validate locally and preview before applying: exports keep authored maps while enqueue freezes rendered literal requests. Release comparisons use effective rendered bodies, so a changed variable value can be a changed policy even with the same case revision.\n\nFor optional semantic endpoint grading, use `json-http-graded-suite-v1`, portable schemaVersion 2 and explicit context (even the default project/environment). Set the top-level `judge` connectionId/configurationRevision/model/budget and add a rubric to each selected case: stable id/revision, criteria, outputPath, threshold and optional reference examples. Keep target credentials separate from judge keys. Hosted use requires `features.endpointJudges`; local use accepts the same private `--connections-file` map without an account, UI or E2E runtime. Only the selected output and rubric criteria/examples reach the judge. Known echoed managed product keys are refused before grading. Inspect score, verdict, rubric hash and private model-usage.json: malformed/unavailable/unknown/over-budget grading is inconclusive coverage and cannot pass or recover a product incident. There are no retries or fallback models. Every report currently marks calibration unverified; labelled reference examples do not prove accuracy. Keep calibration, pricing and release acceptance distinct from a controlled protocol pass.\n\nTo measure a rubric against labelled examples, use `monitor calibrate --id ID --file REQUEST_JSON` for a saved hosted monitor, then `monitor calibrations --id ID` or `monitor calibration --id ID --calibration-id ID` to inspect retained measurements. The request contains `caseId`, `dataset` and optional `repeats`. For account-free local measurement, use `run calibrate --file MONITOR --case-id CASE --dataset DATASET --connections-file PRIVATE_MAP`; `--dataset` is the dataset object alone. Use 2\u20134 fictional labelled outputs and 1\u20133 repeats, within the saved judge call/token budget and a total 30-second ceiling. Calibration calls only the judge, not the product endpoint, and creates no health runs, incidents or recovery. Keep known keys out of dataset/rubric identifiers, object keys and content as well as prompts. Inspect agreement over valid evaluated decisions, disagreement, repeat instability and technical coverage errors separately. A valid expected inconclusive can agree; a provider error cannot. Inspect private model usage for actual reservations. Exit 4 means disagreement, instability or coverage failure; never erase those results to obtain a green check. A small successful sample applies only to its exact dataset/rubric/model identity and does not establish general accuracy or automatically change the monitor\u2019s unverified calibration label.\n\nFor release regressions, use `project compare --id PROJECT_ID --deployment-id DEPLOYMENT_ID` and follow the opaque `next` cursor with `--before`. AI rows include case-level comparisons from frozen queued definitions and retained structured reports. Inspect each case classification and compatibility reasons. A different fixture, assertion, rubric, judge model or policy identity cannot establish a product regression; do not compare numeric scores across changed policies. Missing/invalid reports and unexecuted cases are coverage gaps. Follow the owned run references for evidence. Last passing and first failure are useful only for the matching case policy; a pass from another case or rubric is not a reproduction baseline. Display-name changes and JSON object key order do not change the evaluation policy. Comparison is read-only and never schedules another paid request.\n\nFor personal AI-assisted browser journeys, require both `features.ai` and `features.isolatedAi` alongside script admission. Keep the `ai` model connection binding optional; deterministic scripts need no model or provider key. Hosted personal runs always use server-owned isolated policy and an explicitly model-capable isolated worker. An older worker, withdrawn capability or missing connection is a coverage failure, never a reason to switch accounts or execute through a trusted lane. Use the same version-2 manifest locally with a private connection map before applying it paused. Only attempt-scoped broker authority enters the disposable runtime; upstream keys stay controller-side. Screenshots, page content and prompts used by AI steps reach the selected provider. Inspect native assertions plus authoritative model usage/error evidence; catching an SDK error does not make a run healthy. No browser login-state import or stored application credentials are supported by this capability. API scripts have no built-in screen observation engine: do not call screen-based agent.assert/waitFor/extract on API data. In manifest mode, import {assertGrade, grade} from "#waitcher/ai" and pass {data: selectedJsonOrText, rubric: criteria, threshold: 0.8}. The optional judgeModel grades the selected data, otherwise model is used. Keep expected facts in versioned fixtures; send no credentials or unnecessary response fields. Selected JSON is limited to 8 KiB and rubric to 2 KiB. grade returns {verdict,score}; assertGrade throws on non-pass. Any failure, valid inconclusive or technical grading error remains authoritative even when caught or ignored. Inspect private waitcher-data-grades.json alongside model usage and the native report. No retries/fallbacks occur. The alias survives monitor build and is supplied by run local --file and hosted script execution; standalone --project needs its own integration. Deterministic scripts need no binding; fixed endpoint fixtures can use the declarative graded adapter instead.\n\nFor a browser journey, create `journey.e2e.ts`:\n\n```ts\nimport { test } from "@e2e-dev/web";\nimport { expect } from "e2e";\n\ntest("visitor can find the product", async ({ app, browser }) => {\n await app.open("/");\n await expect(browser.locator("body")).toBeVisible();\n // Replace this smoke assertion with the user\'s meaningful journey.\n await app.screenshot("product");\n});\n```\n\nCreate `monitor.json` beside it, replacing the target and name:\n\n```json\n{\n "schemaVersion": 1,\n "name": "Product / key journey",\n "type": "browser",\n "target": "https://example.com/",\n "enabled": false,\n "interval": 1800,\n "timeout": 30,\n "scriptFile": "journey.e2e.ts"\n}\n```\n\n`scriptFile` resolves relative to the manifest. Use `monitor validate --file monitor.json` to check the actual contract. Browser base URLs have no query/fragment; navigate to those URLs inside the script. API scripts import `test, expect` from `e2e` and can read `process.env.TARGET_URL`. The test runs as trusted local code, not in a sandbox.\n\nKeep a local project with its package lock, tests, helpers and monitor manifests. The platform currently receives one script per monitor, not the project directory. A simple test can be the source file itself. When shared helpers are needed, run `monitor build --file monitors/checkout.json --project . --output build/checkout` from the project. It requires installed `esbuild@0.28.2` and produces `monitor.js`, `monitor.json` and `build.json` with input/output digests. Output directories must be new. It bundles code/JSON helpers while retaining only supported framework and Node imports; unsupported dependencies and module-relative file access fail the build. Verify `build/checkout/monitor.json` with local manifest mode, then apply that same file. Do not send unresolved relative imports or pretend the project accompanies the upload. The current script limit is 50,000 characters and hosted dependencies are fixed. Build metadata describes inputs, not test success.\n\n### Browser locators\n\nFind elements the way a visitor does with the `screen` fixture: `screen.getByRole("button", "New game")`, `screen.getByLabel("Email")`, `screen.getByText("Welcome")`, `screen.getByPlaceholder(...)`, `screen.getByTestId(...)`. The `browser` fixture navigates and offers CSS `browser.locator("main h1")` plus `expect(browser).toHaveURL(...)`; it has no `getBy*` methods. Assertions come from `e2e`: `toBeVisible()`, `toContainText(...)`, `toHaveText(...)`.\n\n```ts\ntest("visitor can start a game", async ({ app, browser, screen }) => {\n await app.open("/games/klondike/");\n await expect(browser.locator("main h1")).toContainText("Solitaire");\n await expect(screen.getByRole("button", "New game")).toBeVisible();\n});\n```\n\nWhen a local run fails, read `.e2e/summary.md` and `.e2e/results/*/trace.md` in the run directory first; the `waitcher-*.mjs` files there are runtime support, not your test.\n\n## Run locally and inspect evidence\n\nThe runtime project needs installed `e2e@0.21.1` and, for browser manifests, `@e2e-dev/web@0.15.1`, plus its browser. Use the existing project runtime, or prepare one within the authorized development task with `waitcher runtime install --file DIR/waitcher.json [--browser]`; it lists npm install and the Chromium download, and runs them with `--yes` once the user agrees.\n\n```sh\nwaitcher run local --file monitor.json --runtime /path/to/runtime\nwaitcher run local --file monitor.json --runtime /path/to/runtime --video\n```\n\nFor an existing E2E project, including its own model/config/imports:\n\n```sh\nwaitcher run local --project /path/to/e2e-project --timeout 60\nwaitcher run local --project /path/to/e2e-project --video\n```\n\nLocal runs are serial, have no automatic retries or action replay, and get a fresh directory under `.waitcher/runs/`. `--output DIR` chooses the parent; project mode requires it inside the E2E project. Traces are requested on every run; video is opt-in. Tests can override recording modes, so inspect returned files rather than assuming a video exists.\n\nRead the returned `local-run.json`, `execution.log`, framework `report.json`, `summary.md` and relevant `results/**/trace.md`. The JSON result includes absolute report/summary paths and a relative file inventory with SHA-256. Traces are Markdown evidence, not Playwright ZIP traces. Watch a returned WebM when video helps explain a failure. The installed framework exposes no public HAR recording option; do not invent `--har` or promise a full network capture. App logs contain selected console/request failures, not complete request/response bodies.\n\nLocal exit codes: 0 passed, 4 failed/error, 130 interrupted; usage/setup errors use the normal CLI error envelope. On interruption, inspect partial evidence before repeating a possibly completed action. Fix test mistakes while preserving the user\'s assertions; do not weaken an assertion merely to obtain green. Run only the authorized journeys. Evidence and local configs can contain private content: keep `.waitcher/`, `.e2e/`, keys and reports out of Git. Local results are not uploaded or treated as hosted health evidence.\n\n## Apply through the shared API\n\nWhen hosted scripts are allowed and applying configuration is in scope:\n\n```sh\nwaitcher monitor apply --file monitor.json --dry-run\nwaitcher monitor apply --file monitor.json\nwaitcher monitor get --id MONITOR_ID\n```\n\nKeep the monitor paused unless the user requested scheduled execution. Applying a paused configuration does not run it. Use `run start --id MONITOR_ID --wait` for an authorized single hosted run, then inspect `run status`, read `run trace --id RUN_ID` for the steps, failed assertion, screenshots and fetch calls, and download evidence with `artifact get`. Hosted scripts retain their server execution policy and can differ from a local environment.\n\nEdits require `--id` and `--expected-revision` from the latest get/export. Use a stable `--request-key` for one create/run request when recovering an uncertain response; never change the payload under that key or automatically repeat a possibly executed action. Report the exact monitor/run IDs, local evidence path, observed outcome and any difference between local and hosted verification.\n';
|
|
61059
|
+
var authoring_default = '# Authoring and running monitors\n\nRead when writing or changing a test, choosing a monitor type, or running it locally. For exact syntax run `waitcher help monitor` or `waitcher help run`. AI endpoints, agent outcome checks and model steps are in [ai-and-agents](ai-and-agents.md).\n\n## Choose the type\n\n- `http`: status, body text, a JSON value or latency of one request. No script.\n- `certificate`: TLS expiry and chain. No script.\n- `heartbeat`: a job reports start and success; Waitcher alerts when it does not.\n- `api`: a script with several requests and an invariant between them.\n- `browser`: a script that walks a user journey in Chromium.\n\n`waitcher monitor init --type TYPE --file x.json` writes a paused example of every type; `api` and `browser` also write `x.e2e.ts`. Keep scripts focused on the requested behavior and use controlled test identities for actions that change state.\n\n## Scripts in waitcher.json\n\nIn a repository, a script monitor is an entry with `entry` pointing at its test file; one test serves every environment because it reads the base URL at run time.\n\n```json\n{ "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 }\n```\n\nRun the entries of one environment locally, without an account:\n\n```sh\nwaitcher config validate --env production --verify\nwaitcher config validate --env production --verify --key checkout\n```\n\nExit 4 with `VERIFY_FAILED` names the failing assertion and the run directory to read. `run local --file` takes a single monitor manifest, not `waitcher.json`.\n\n## Browser journey\n\n```ts\nimport { test } from "@e2e-dev/web";\nimport { expect } from "e2e";\n\ntest("visitor can start a game", async ({ app, browser, screen }) => {\n await app.open("/games/klondike/");\n await expect(browser.locator("main h1")).toContainText("Solitaire");\n await expect(screen.getByRole("button", "New game")).toBeVisible();\n await app.screenshot("game");\n});\n```\n\n- `app.open(path)` resolves against the environment\'s base URL. Browser base URLs have no query or fragment; navigate to those URLs inside the script.\n- Find elements the way a visitor does with the `screen` fixture: `screen.getByRole("button", "New game")`, `screen.getByLabel("Email")`, `screen.getByText("Welcome")`, `screen.getByPlaceholder(...)`, `screen.getByTestId(...)`. Prefer these over CSS selectors.\n- The `browser` fixture navigates and offers CSS `browser.locator("main h1")` plus `expect(browser).toHaveURL(...)`; it has no `getBy*` methods.\n- Assertions come from `e2e`: `toBeVisible()`, `toContainText(...)`, `toHaveText(...)`.\n\n## API script\n\n```ts\nimport { test, expect } from "e2e";\n\ntest("orders API keeps totals consistent", async () => {\n const target = new URL(process.env.TARGET_URL!);\n const response = await fetch(new URL("/api/orders?limit=1", target));\n expect(response.status).toBe(200);\n});\n```\n\nAPI scripts import `test, expect` from `e2e` and read `process.env.TARGET_URL`. Secrets reach them only as `CHECK_*` names listed in `settings.envNames` (see [deploy](deploy.md)). The test runs as trusted local code, not in a sandbox.\n\n## Standalone manifest\n\nWithout `waitcher.json`, a monitor is one JSON file. `monitor init --type browser --file monitor.json` writes it with `scriptFile` next to the test:\n\n```json\n{\n "schemaVersion": 1,\n "name": "Product / key journey",\n "type": "browser",\n "target": "https://example.com/",\n "enabled": false,\n "interval": 1800,\n "timeout": 30,\n "scriptFile": "journey.e2e.ts"\n}\n```\n\n`scriptFile` resolves relative to the manifest; `monitor validate --file monitor.json` checks the actual contract. The platform receives one script per monitor, not the project directory. When the test imports shared helpers, run `monitor build --file monitors/checkout.json --project . --output build/checkout`: it needs installed `esbuild@0.28.2`, bundles code and JSON helpers, keeps only supported framework and Node imports, and writes `monitor.js`, `monitor.json` and `build.json` into a new directory. Unsupported dependencies and module-relative file access fail the build. Verify and apply the built `monitor.json`. The script limit is 50,000 characters and hosted dependencies are fixed.\n\n## Run locally and inspect evidence\n\nThe runtime project needs `e2e@0.21.1` and, for browser tests, `@e2e-dev/web@0.15.1` and Chromium. `waitcher runtime install --file DIR/waitcher.json [--browser]` lists the npm install and Chromium download; run it with `--yes` once the user agrees. Chromium goes to the Playwright browser cache (`PLAYWRIGHT_BROWSERS_PATH` when set), not the runtime directory.\n\n```sh\nwaitcher run local --file monitor.json --runtime /path/to/runtime\nwaitcher run local --file monitor.json --runtime /path/to/runtime --video\nwaitcher run local --project /path/to/e2e-project --timeout 60\n```\n\n- `--project` runs an existing E2E project with its own config and imports; its `--output` must stay inside that project.\n- Runs are serial, never retried or replayed, and get a fresh directory under `.waitcher/runs/` (`--output DIR` chooses the parent). Traces are always requested; video is opt-in, and tests can override recording, so inspect the returned files.\n- On failure read `.e2e/summary.md` and `.e2e/results/*/trace.md` in the run directory first, then `execution.log` and `report.json`. The `waitcher-*.mjs` files there are runtime support, not your test. Traces are Markdown, not Playwright ZIPs; there is no HAR option, and app logs hold selected console and request failures only.\n- Exit codes: 0 passed, 4 failed or error, 130 interrupted. After an interruption, inspect partial evidence before repeating a possibly completed action.\n- Fix test mistakes while preserving the user\'s assertions; never weaken an assertion just to get green.\n- Evidence can contain private content: keep `.waitcher/`, `.e2e/`, keys and reports out of Git. Local results are not uploaded and are not hosted health evidence.\n\n## Apply one monitor through the API\n\nWhen hosted scripts are allowed and applying configuration is in scope:\n\n```sh\nwaitcher monitor apply --file monitor.json --dry-run\nwaitcher monitor apply --file monitor.json\nwaitcher monitor get --id MONITOR_ID\n```\n\nKeep the monitor paused unless the user requested scheduled execution; applying does not run it. For an authorized single hosted run use `run start --id MONITOR_ID --wait`, then `run status`, `run trace --id RUN_ID` (steps, failed assertion, screenshots, fetch calls) and `artifact get` for evidence. Hosted scripts run under the server\'s execution policy and can differ from a local run.\n\nEdits are complete replacements: `monitor export`, change the file, then `monitor apply --file FILE --id ID --expected-revision N` with the revision from get or export. Use a stable `--request-key` to recover one uncertain create or run; never change the payload under that key or repeat a possibly executed action. Report the exact monitor and run IDs, local evidence path, observed outcome and any difference between local and hosted results.\n';
|
|
61060
|
+
|
|
61061
|
+
// ../../skills/waitcher/references/ai-and-agents.md
|
|
61062
|
+
var ai_and_agents_default = "# AI endpoints, agent outcomes and model steps\n\nRead only when `waitcher system capabilities` reports the feature and the user needs it. Deterministic HTTP, API and browser monitors need none of this; see [authoring](authoring.md).\n\n## Agent outcome checks\n\nFor hosted scripts using `#waitcher/scenario`, first confirm `features.scenarioEvidence` through `system capabilities`, alongside script admission. Older servers may not provide this helper. Do not silently remove required scenario checks to make an unsupported run pass. Capability discovery is separate from native security, capacity and production release acceptance.\n\nFor an agent that changes application state, start with `monitor init --template agent-outcome --file outcome.json --target https://product.example/api/`. It creates a paused ordinary API script, with no model binding or paid-provider requirement. Adapt its fixed `agent/tasks` submission and `notes/{runId}` resource paths, disposable test namespace and exact expected fields. It submits one action, ignores claims of success and response-provided URLs, then independently reads the known resource at most three times. A fresh per-run random `id` and `correlationId` must both match, alongside the expected result. Action transport errors are never automatically retried. Cleanup runs in `finally` only after an independent read proves the resource belongs to this run; cleanup failures fail the test. If ownership or the action result is uncertain, it records cleanup as unverified and leaves state untouched. Reconcile possible late actions before repeating a mutating test. This pattern verifies the chosen outcome, not the agent's overall quality or the correctness of its explanation.\n\nThe starter uses the optional `#waitcher/scenario` helper with required submit/action, observe, verify and cleanup phases. `createScenario({id, phases})` returns `phase(id, callback)`, `assert(boolean)` and `incomplete(reason)`. Call signals only inside an active phase. Every scenario needs a required verify phase, and an executed verify phase must call `scenario.assert` at least once; an empty verification cannot establish pass. `assert(false)` records a business failure even if caught; ordinary callback exceptions and `incomplete(\"CLEANUP_UNVERIFIED\")` record coverage errors. Inspect `.e2e/waitcher-scenarios.json` in the private evidence: required phases that never ran or remain in flight also prevent a pass. Coverage error takes precedence while retaining failed verification facts. A false agent claim can therefore produce a failed verify phase and an overall error when cleanup remains uncertain. The helper does not automatically classify arbitrary E2E assertions or infer agent/tool traces. Use stable non-secret scenario/phase IDs, avoid raw response values in assertions, and do not use report labels as secret storage.\n\nUse the unchanged file with `monitor validate`, account-free `run local --file outcome.json --runtime YOUR_PINNED_RUNTIME`, and the existing API-script editor or `monitor apply --file outcome.json --dry-run`. Keep it paused after applying. Project authors can extract the script into `scriptFile`, keep helper imports and use `monitor build` to create one portable script; `#waitcher/scenario` stays external and is supplied by the manifest runner. The complete CLI includes `scenario-runtime.mjs`; keep package companions together. Standalone `--project` needs its own helper integration. The starter's default is credential-free. Optional local/trusted-administrator bearer tokens use `CHECK_AGENT_ACTION_TOKEN`, `CHECK_RESOURCE_READ_TOKEN` and `CHECK_RESOURCE_CLEANUP_TOKEN`, explicitly listed in `settings.envNames` and supplied outside the manifest. Hosted personal scripts receive `CHECK_*` values only from their project environment's secrets (`waitcher secret set`), never from the server's environment; do not work around that boundary. Do not log credentials or response bodies, and do not promise complete trace masking for arbitrary custom environment values. Local success does not establish hosted admission or isolation.\n\n## Scenario evidence\n\nInspect readable scenario evidence with `waitcher run scenarios --id RUN_ID`, or use `waitcher run scenarios --directory PRIVATE_RUN_DIR` for account-free local inspection without a server/runtime. Add `--json` for the exact shared report DTO. Do not combine selectors or pass `--server` for local inspection. Inspection of failed/error runs succeeds; execution exit codes remain unchanged. Keep authoritative run status separate from evidence availability: empty valid reports verify no business outcome, and pending/not-recorded/expired/invalid reports cannot establish a pass. Local evidence is checked against its recorded inventory and checksum; never edit it to manufacture a successful outcome.\n\n## AI product endpoints\n\nFor a single AI product endpoint, prefer a declarative `type: \"ai\"` fixture over an E2E script. Run `monitor init --type ai --target https://product.example/ai --file ai.json`, replace the sample request and response checks with the product contract, then `monitor validate --file ai.json`. JSON-pointer assertions support exact equality, type, existence and literal case-sensitive contains/not-contains/contains-any/contains-all checks; an optional bounded response schema checks structure. `run local --file ai.json` uses the same one-POST adapter without an account, model connection, provider key or E2E runtime. It only reaches public HTTPS endpoints and supports optional verified `httpAuth` references as described below; arbitrary custom headers and account-session inheritance are forbidden. Inspect the structured per-assertion report and distinguish transport coverage errors from product assertion failures. Applying the same file to hosted monitoring requires `features.aiEndpoints`; personal admission also requires a currently verified `httpAuth` binding; keep it paused unless scheduling is authorized. This verifies a chosen fixture, not general agent quality or a calibrated semantic judge.\n\nFor a small set of representative prompts against the same endpoint, use `aiEndpoint.adapter: \"json-http-suite-v1\"` and `cases` with 1\u20135 objects containing a stable unique `id`, readable `name`, positive `revision` (default 1), literal JSON-object `fixture`, and assertions and/or response schema. The suite `invocationBudget` equals its case count and is filled in when omitted. Validate offline and run the unchanged manifest locally before applying it; hosted capability `features.aiEndpointSuites` must be available. Cases run serially under one total monitor timeout. Assertion failures permit later cases; a transport/deadline error stops them as `not-run`. Inspect every case and coverage summary, not only the overall status. The controller reserves the full case count before any hosted request, and partial/uncertain runs retain that conservative allowance. Reported attempted requests can therefore be fewer than charged units. Deterministic suites do not provide semantic grading; do not describe text matching as semantic correctness. Single fixtures and each suite case can opt into literal variables with variables:{name:\"string\"} and exact {{name}} placeholders inside fixture string values. Without variables, braces remain literal. Use at most 16 names, ASCII letter followed by letters/digits/underscores (64 characters); prototype-related names are refused. Each value fits 4 KiB UTF-8, maps and rendered fixtures 16 KiB and complete configurations 64 KiB. No expressions, environment lookup, key/URL/assertion/rubric interpolation, matrix expansion or recursive replacement is supported. Missing/malformed placeholders reject before requests. Use non-secret data. Validate locally and preview before applying: exports keep authored maps while enqueue freezes rendered literal requests. Release comparisons use effective rendered bodies, so a changed variable value can be a changed policy even with the same case revision.\n\nFor optional semantic endpoint grading, use `json-http-graded-suite-v1`, portable schemaVersion 2 and explicit context (even the default project/environment). Set the top-level `judge` connectionId/configurationRevision/model/budget and add a rubric to each selected case: stable id/revision, criteria, outputPath, threshold and optional reference examples. Keep target credentials separate from judge keys. Hosted use requires `features.endpointJudges`; local use accepts the same private `--connections-file` map without an account, UI or E2E runtime. Only the selected output and rubric criteria/examples reach the judge. Known echoed managed product keys are refused before grading. Inspect score, verdict, rubric hash and private model-usage.json: malformed/unavailable/unknown/over-budget grading is inconclusive coverage and cannot pass or recover a product incident. There are no retries or fallback models. Every report currently marks calibration unverified; labelled reference examples do not prove accuracy. Keep calibration, pricing and release acceptance distinct from a controlled protocol pass.\n\nTo measure a rubric against labelled examples, use `monitor calibrate --id ID --file REQUEST_JSON` for a saved hosted monitor, then `monitor calibrations --id ID` or `monitor calibration --id ID --calibration-id ID` to inspect retained measurements. The request contains `caseId`, `dataset` and optional `repeats`. For account-free local measurement, use `run calibrate --file MONITOR --case-id CASE --dataset DATASET --connections-file PRIVATE_MAP`; `--dataset` is the dataset object alone. Use 2\u20134 fictional labelled outputs and 1\u20133 repeats, within the saved judge call/token budget and a total 30-second ceiling. Calibration calls only the judge, not the product endpoint, and creates no health runs, incidents or recovery. Keep known keys out of dataset/rubric identifiers, object keys and content as well as prompts. Inspect agreement over valid evaluated decisions, disagreement, repeat instability and technical coverage errors separately. A valid expected inconclusive can agree; a provider error cannot. Inspect private model usage for actual reservations. Exit 4 means disagreement, instability or coverage failure; never erase those results to obtain a green check. A small successful sample applies only to its exact dataset/rubric/model identity and does not establish general accuracy or automatically change the monitor\u2019s unverified calibration label.\n\nFor release regressions, use `project compare --id PROJECT_ID --deployment-id DEPLOYMENT_ID` and follow the opaque `next` cursor with `--before`. AI rows include case-level comparisons from frozen queued definitions and retained structured reports. Inspect each case classification and compatibility reasons. A different fixture, assertion, rubric, judge model or policy identity cannot establish a product regression; do not compare numeric scores across changed policies. Missing/invalid reports and unexecuted cases are coverage gaps. Follow the owned run references for evidence. Last passing and first failure are useful only for the matching case policy; a pass from another case or rubric is not a reproduction baseline. Display-name changes and JSON object key order do not change the evaluation policy. Comparison is read-only and never schedules another paid request.\n\n## AI steps in browser and API scripts\n\nFor personal AI-assisted browser journeys, require both `features.ai` and `features.isolatedAi` alongside script admission. Keep the `ai` model connection binding optional; deterministic scripts need no model or provider key. Hosted personal runs always use server-owned isolated policy and an explicitly model-capable isolated worker. An older worker, withdrawn capability or missing connection is a coverage failure, never a reason to switch accounts or execute through a trusted lane. Use the same version-2 manifest locally with a private connection map before applying it paused. Only attempt-scoped broker authority enters the disposable runtime; upstream keys stay controller-side. Screenshots, page content and prompts used by AI steps reach the selected provider. Inspect native assertions plus authoritative model usage/error evidence; catching an SDK error does not make a run healthy. No browser login-state import or stored application credentials are supported by this capability. API scripts have no built-in screen observation engine: do not call screen-based agent.assert/waitFor/extract on API data. In manifest mode, import {assertGrade, grade} from \"#waitcher/ai\" and pass {data: selectedJsonOrText, rubric: criteria, threshold: 0.8}. The optional judgeModel grades the selected data, otherwise model is used. Keep expected facts in versioned fixtures; send no credentials or unnecessary response fields. Selected JSON is limited to 8 KiB and rubric to 2 KiB. grade returns {verdict,score}; assertGrade throws on non-pass. Any failure, valid inconclusive or technical grading error remains authoritative even when caught or ignored. Inspect private waitcher-data-grades.json alongside model usage and the native report. No retries/fallbacks occur. The alias survives monitor build and is supplied by run local --file and hosted script execution; standalone --project needs its own integration. Deterministic scripts need no binding; fixed endpoint fixtures can use the declarative graded adapter instead.\n\nFor an existing project's custom model setup, use `--project`. A schemaVersion 2 manifest with an `ai` binding can also run unchanged locally using `--connections-file /private/connections.json`, without login. The private map has schemaVersion 1 and a connections array; each record contains id, configurationRevision, provider openrouter, projectId, environmentId, allowed models and credentialFile. Credential paths resolve relative to the map. IDs/revisions/models and explicit manifest scope must match. Keep both map and key files private (chmod 600); inline keys, provider URLs and symlinks are refused. The selected runtime also needs ai@7.0.107. The complete CLI package ships model-client.mjs and notices; copying only cli.mjs is insufficient for bound AI execution.\n\nThe local manifest runner keeps the provider key in its parent and passes a temporary loopback grant to the test. It uses the hosted transport and per-run budget/outcome rules, but no hosted account/day ledger. Read model-usage.json as well as the native report: caught provider/budget failures may leave a native passed test while Waitcher correctly records error. Unknown usage stays reserved, SDK retries count separately, and local success does not verify hosted enablement or key freshness. Provider keys are not forwarded to the child, and literal temporary broker tokens are redacted from normal text evidence; trusted local code can read its filesystem and is not a sandbox. Traces default on, video stays opt-in.\n\nIn the project's `e2e.config.ts`, construct the chosen provider's AI SDK model under `agents.default.model`, following the installed framework's types. The provider reads its local key; a key alone does not configure a model. Never copy a user's provider key into a monitor manifest or use an operator's account key.\n\nMix exact assertions with selected `agent.act`, `agent.assert`, `agent.waitFor` and schema-bound `agent.extract` calls. AI operations may transmit screen content to the provider and incur cost; preserve the user's provider/call authorization. Step-level `maxModelCalls` is not a whole-run spending limit. Hosted connection/broker/budget support is separate and must be discovered from actual capabilities rather than assumed from a local run.\n\n## Protected product requests\n\nFor protected product operations, use monitor init --template protected-agent-outcome --request-policy-file POLICY.json --project-id UUID --environment-id UUID --file monitor.json. The public policy contains connections with id, canonical HTTPS origin and httpAuth references (targetId, credentialId, credentialRevision); operations with id, connection, method, path, optional static body, responsePointers and maxCalls; and budget.calls. Paths are fixed absolute paths with at most one whole {resourceId} UUID segment. Static JSON bodies may use only exact string leaves {{resourceId}}. Callers cannot choose URLs, methods, headers, bodies, query parameters or UUIDs. GET permits at most three calls, POST and DELETE one; DELETE requires the UUID path and POST must use the run identity. Limits are four connections, eight operations and eight total calls.\n\nThe protected starter requires submit POST, observe GET (three reads), cleanup DELETE, a five-call budget and response pointers /id, /correlationId, /title, /completed. Configure the static submission body to create a note with the parent-generated UUID in both id and correlationId, title Waitcher outcome check, and completed true. The optional #waitcher/requests SDK exposes requestOperation and requestResourceId. Responses contain status and a data map keyed by configured JSON pointers. The script never trusts the agent reply as proof of resulting state, never retries the action, and only cleans up independently proven run-owned state.\n\nLocal execution uses the existing --http-credentials-file private map: schemaVersion 1 and credentials entries with targetId, credentialId, credentialRevision, origin, header and credentialFile. Header is Authorization or X-Api-Key; its raw value stays in a separate private regular file. Map and key files require mode600 and exact reference/revision/origin matches. Keys stay in the CLI parent, never script, manifest, CLI arguments or custom environment. No account, app or AI provider is required locally. Keep request-runtime.mjs with the complete CLI package. For source projects use scriptFile, monitor build, then run local --file; standalone project mode does not inject the protected helper. Hosted use requires explicit capability and isolated execution even for administrators. Combined AI or browser-state bindings need their independent authority. Inspect request-usage.json, scenario and native reports. Caught budget errors, uncertain dispatch and unfinished calls cannot establish a healthy result; never replay mutations automatically.\n\nScenario request associations are optional recorded evidence. The request helper automatically records each issued request UUID on its originating phase. In a verify phase, call `scenario.referenceRequest(response.requestId)` for a request from an earlier completed observe phase in the same scenario; use the validated response envelope UUID, never an ID from response data. The protected starter references its last independent observation before asserting the business state. Read associations with `run scenarios`; `run diagnose` joins them to this run's request records and labels each ID `matched`, `not-found` or `unavailable`. These are script-reported phase associations. A matching controller row proves accounting correspondence, not the correctness of a phase or business outcome. Local matches remain local helper reports. Older evidence without association fields is not recorded, rather than an empty verified list. UNKNOWN requests remain charged and incomplete; no association authorizes mutation replay.\n";
|
|
60935
61063
|
|
|
60936
61064
|
// ../../skills/waitcher/references/deploy.md
|
|
60937
|
-
var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors in a repository with `waitcher.json`. The core workflow is in SKILL.md; this file holds the details. `waitcher doctor` confirms that the server supports deploys.\n\n## The file\n\n```json\n{\n "schemaVersion": 1,\n "project": "Shop",\n "environments": {\n "production": { "baseUrl": "https://shop.example" },\n "staging": { "baseUrl": "https://staging.shop.example" }\n },\n "defaults": { "interval": 1800, "timeout": 15 },\n "monitors": [\n { "key": "home", "type": "http", "path": "/", "settings": { "contains": "Shop" } },\n { "key": "tls", "type": "certificate" },\n { "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 },\n { "key": "orders-api", "type": "api", "entry": "monitoring/orders.e2e.ts",\n "settings": { "envNames": ["CHECK_ORDERS_TOKEN"] } },\n { "key": "nightly-export", "type": "heartbeat", "environments": ["production"],\n "heartbeat": { "graceSeconds": 300, "completionSeconds": 900 } }\n ]\n}\n```\n\n- `config init` starts with two example monitors (`home`: HTTP 200 on `/`; `tls`: certificate expiry). Keep, change or remove them.\n- Environment names match case-insensitively: `production` in the file is the project\'s default `Production` environment.\n- HTTP `settings`: `method`, `expectedStatus`, `contains`, `jsonPath` with `jsonValue`, `maxLatency` (ms), `headers`, `body`; certificates: `certificateMinDays` (default 14). `waitcher monitor init --type TYPE --file x.json` writes a complete example of any type.\n- A 30-minute interval suits HTTP, certificate and browser checks alike; certificates rarely need more often. Personal accounts cannot go below 30 minutes, and script monitors follow the account plan (starter: one, every 2 hours or slower); read `limits.isolatedScripts` in `system capabilities` before planning.\n- Entries are ordinary monitor definitions plus `key`, optional `environments` and optional `path` (resolved against `baseUrl`). Script and certificate targets default to `baseUrl`; heartbeats use the key as their label.\n- Never set `enabled`, `script`, `scriptFile`, `schemaVersion`, `context` or `demo` in entries.\n- Script tests read `process.env.TARGET_URL` (API) or call `app.open("/")` (browser), so one test serves every environment.\n- The directory holding `waitcher.json` must have `e2e@0.21.1`, `@e2e-dev/web@0.15.1` (browser) and `esbuild@0.28.2` installed exactly; `waitcher runtime install` sets them up and later upgrades them (ask before `--yes`). Do not let dependency bots move these three packages. Tests may import project files and JSON; other packages fail with `BUILD_FAILED` naming the import. Replace them with project code, `fetch` or JSON data; do not vendor a dependency to get past the limit. A built script must fit 50,000 characters.\n\n## Plan and apply\n\n- `deploy plan --env NAME [--verify]` changes nothing. `changes` lists `create`, `adopt`, `update` (with `fields`), `unchanged`, `delete`, `orphaned` and `invalid` per key.\n- `deploy apply --env NAME --based-on BASED_ON` applies the whole environment or nothing. `ok:false` exits 2 and writes nothing. A stale `--based-on` is `CONFLICT`: plan again and show the new plan.\n- The repository owns definitions; the server owns pause and resume. Managed monitors refuse edits through `monitor apply` or the web (`MANAGED_BY_CONFIG`); change the file instead.\n- Undeclared monitors stay as `orphaned` warnings. `--prune` deletes them and their history; use it only with the user\'s consent.\n- Deploy versions come from the Git commit (`-dirty` when `waitcher.json` has uncommitted changes). A configuration deploy is not a product release: runs show `context.deployment` only for markers recorded with `waitcher deployment record`.\n- `--smoke` runs each created, adopted or updated monitor once on the server after apply. A failed smoke leaves the deploy applied and exits 4; follow `next` to `run diagnose`.\n\n## Secrets\n\nScripts list `CHECK_*` names in `settings.envNames`. Values live per project environment on the server:\n\n```sh\nprintf %s "$VALUE" | waitcher secret set --env staging --name CHECK_ORDERS_TOKEN --value-stdin\nwaitcher secret list --env staging\n```\n\nAsk the user for each value, or tell them the command to run themselves. Never echo, log or commit it. A plan reports `SECRET_MISSING` with the missing names. `--verify` runs with your local environment, so export the same `CHECK_*` variables locally (never in files) or skip `--verify` for that monitor and rely on `--smoke`.\n\n## Adopting existing monitors\n\nWhen a plan warns `ADOPTION_CANDIDATE`, an existing unmanaged monitor looks like the entry. Show it to the user (`waitcher monitor get --id ID`). If it is the same check, plan and apply with `--adopt KEY=MONITOR_ID`: it keeps its ID, history and pause state and takes the file\'s definition. Otherwise ignore the warning; apply creates a separate monitor.\n\n## Rollback\n\n`waitcher deploy list --project-id ID` shows deploys; `restorable:true` marks the latest 10 per environment. `waitcher deploy rollback --id DEPLOY_ID --dry-run` shows the plan, then run it with `--based-on`. Secrets are not rolled back. Tell the user to revert the repository too, or the next apply reintroduces the change.\n\n## CI\n\n`waitcher ci init [--env production] [--file waitcher.json]` writes `.github/workflows/waitcher.yml`: plan on pull requests, apply on pushes to the main branch. It installs the CLI from the server with a checksum and signs in with the `WAITCHER_TOKEN` repository secret. Create that token with read and write permissions (add run for `--smoke`) and `"projectId"` set to the project\'s ID (from `deploy plan`\'s `project.id`) using `waitcher token create`, so CI cannot touch other projects, and let the user store it with `gh secret set WAITCHER_TOKEN`. Set the `WAITCHER_SERVER` repository variable for a non-default server.\n';
|
|
61065
|
+
var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors in a repository with `waitcher.json`. The core workflow is in SKILL.md; this file holds the details. `waitcher doctor` confirms that the server supports deploys.\n\n## The file\n\n```json\n{\n "schemaVersion": 1,\n "project": "Shop",\n "environments": {\n "production": { "baseUrl": "https://shop.example" },\n "staging": { "baseUrl": "https://staging.shop.example" }\n },\n "defaults": { "interval": 1800, "timeout": 15 },\n "monitors": [\n { "key": "home", "type": "http", "path": "/", "settings": { "contains": "Shop" } },\n { "key": "tls", "type": "certificate" },\n { "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 },\n { "key": "orders-api", "type": "api", "entry": "monitoring/orders.e2e.ts",\n "settings": { "envNames": ["CHECK_ORDERS_TOKEN"] } },\n { "key": "nightly-export", "type": "heartbeat", "environments": ["production"],\n "heartbeat": { "graceSeconds": 300, "completionSeconds": 900 } }\n ]\n}\n```\n\n- `config init` starts with two example monitors (`home`: HTTP 200 on `/`; `tls`: certificate expiry). Keep, change or remove them.\n- Environment names match case-insensitively: `production` in the file is the project\'s default `Production` environment.\n- HTTP `settings`: `method`, `expectedStatus`, `contains`, `jsonPath` with `jsonValue`, `maxLatency` (ms), `headers`, `body`; certificates: `certificateMinDays` (default 14). `waitcher monitor init --type TYPE --file x.json` writes a complete example of any type.\n- A 30-minute interval suits HTTP, certificate and browser checks alike; certificates rarely need more often. Personal accounts cannot go below 30 minutes, and script monitors follow the account plan (starter: one, every 2 hours or slower); read `limits.isolatedScripts` in `system capabilities` before planning.\n- Entries are ordinary monitor definitions plus `key`, optional `environments` and optional `path` (resolved against `baseUrl`). Script and certificate targets default to `baseUrl`; heartbeats use the key as their label.\n- Never set `enabled`, `script`, `scriptFile`, `schemaVersion`, `context` or `demo` in entries.\n- Script tests read `process.env.TARGET_URL` (API) or call `app.open("/")` (browser), so one test serves every environment.\n- The directory holding `waitcher.json` must have `e2e@0.21.1`, `@e2e-dev/web@0.15.1` (browser) and `esbuild@0.28.2` installed exactly; `waitcher runtime install` sets them up and later upgrades them (ask before `--yes`). Do not let dependency bots move these three packages. Tests may import project files and JSON; other packages fail with `BUILD_FAILED` naming the import. Replace them with project code, `fetch` or JSON data; do not vendor a dependency to get past the limit. A built script must fit 50,000 characters.\n\n## Plan and apply\n\n- `config validate --env NAME --verify [--key KEY]` runs that environment\'s script entries locally without an account. `deploy plan --env NAME [--verify]` changes nothing. `changes` lists `create`, `adopt`, `update` (with `fields`), `unchanged`, `delete`, `orphaned` and `invalid` per key.\n- `deploy apply --env NAME --based-on BASED_ON` applies the whole environment or nothing. `ok:false` exits 2 and writes nothing. A stale `--based-on` is `CONFLICT`: plan again and show the new plan.\n- The repository owns definitions; the server owns pause and resume. Managed monitors refuse edits through `monitor apply` or the web (`MANAGED_BY_CONFIG`); change the file instead.\n- Undeclared monitors stay as `orphaned` warnings. `--prune` deletes them and their history; use it only with the user\'s consent.\n- Deploy versions come from the Git commit (`-dirty` when `waitcher.json` has uncommitted changes). A configuration deploy is not a product release: runs show `context.deployment` only for markers recorded with `waitcher deployment record`.\n- `--smoke` runs each created, adopted or updated monitor once on the server after apply. A failed smoke leaves the deploy applied and exits 4; follow `next` to `run diagnose`.\n\n## Secrets\n\nScripts list `CHECK_*` names in `settings.envNames`. Values live per project environment on the server:\n\n```sh\nprintf %s "$VALUE" | waitcher secret set --env staging --name CHECK_ORDERS_TOKEN --value-stdin\nwaitcher secret list --env staging\n```\n\nAsk the user for each value, or tell them the command to run themselves. Never echo, log or commit it. A plan reports `SECRET_MISSING` with the missing names. `--verify` runs with your local environment, so export the same `CHECK_*` variables locally (never in files) or skip `--verify` for that monitor and rely on `--smoke`.\n\n## Adopting existing monitors\n\nWhen a plan warns `ADOPTION_CANDIDATE`, an existing unmanaged monitor looks like the entry. Show it to the user (`waitcher monitor get --id ID`). If it is the same check, plan and apply with `--adopt KEY=MONITOR_ID`: it keeps its ID, history and pause state and takes the file\'s definition. Otherwise ignore the warning; apply creates a separate monitor.\n\n## Rollback\n\n`waitcher deploy list --project-id ID` shows deploys; `restorable:true` marks the latest 10 per environment. `waitcher deploy rollback --id DEPLOY_ID --dry-run` shows the plan, then run it with `--based-on`. Secrets are not rolled back. Tell the user to revert the repository too, or the next apply reintroduces the change.\n\n## CI\n\n`waitcher ci init [--env production] [--file waitcher.json]` writes `.github/workflows/waitcher.yml`: plan on pull requests, apply on pushes to the main branch. It installs the CLI from the server with a checksum and signs in with the `WAITCHER_TOKEN` repository secret. Create that token with read and write permissions (add run for `--smoke`) and `"projectId"` set to the project\'s ID (from `deploy plan`\'s `project.id`) using `waitcher token create`, so CI cannot touch other projects, and let the user store it with `gh secret set WAITCHER_TOKEN`. Set the `WAITCHER_SERVER` repository variable for a non-default server.\n';
|
|
60938
61066
|
|
|
60939
61067
|
// ../../skills/waitcher/references/diagnosis.md
|
|
60940
61068
|
var diagnosis_default = "# Diagnosing failures\n\nRead when a local, smoke or scheduled run failed or errored.\n\n## Diagnose and reproduce a retained run\n\nConfirm `features.runDiagnosis` for hosted support. Use `run diagnose --id RUN_ID` for a readable hosted packet, or add `--json` for the shared structured report. Use `run diagnose --directory PRIVATE_RUN_DIRECTORY` without an account to inspect indexed local evidence. Hosted request states come from the controller ledger; local helper observations are explicitly local and do not attest hosted accounting. A known response does not prove task success, and an unknown action may have taken effect. Do not automatically repeat a mutation because its result is unknown.\n\nA historical pass is useful only when the frozen verification policy matches. Changed scripts, targets, deadlines or protected-operation policies cannot supply a matching reference. History searches are bounded; unavailable or truncated history is not proof that the product never passed. Stored artifact checksums are metadata; inspect the actual artifact when needed. Scenario evidence is checked against its recorded checksum before display.\n\nFor a completed supported hosted script, `run reproduce --id RUN_ID --output NEW_DIRECTORY` prepares its frozen configuration in a new private folder. It never executes the test or retrieves the current edited monitor. Inspect `monitor.json` and `provenance.json`, then deliberately run `run local --file NEW_DIRECTORY/monitor.json --output FRESH_RUN_DIRECTORY` with the matching installed runtime, optionally `--runtime PROJECT`. Reproduction is a fresh run with separate provenance and does not replace the original evidence.\n\nManaged product credentials, AI keys and browser sessions are not exported. Supply existing private local mappings with `--http-credentials-file`, `--connections-file` and `--browser-identities-file` where required. Authored scripts and literal configuration can themselves be sensitive, so keep the reproduction private. Operator-injected headers, bodies or environment state make this initial portable preparation unavailable rather than silently changing the test. Older local runs without an indexed frozen manifest remain inspectable but cannot establish a captured reproduction policy.\n";
|
|
60941
61069
|
|
|
60942
61070
|
// ../../skills/waitcher/references/optional-capabilities.md
|
|
60943
|
-
var optional_capabilities_default = "# Optional capabilities\n\nRead only when capabilities report the feature and the user needs it: visual baselines, signed-in browser identities, AI steps, verified HTTP credentials and invocation budgets.\n\n## Optional visual checks\n\nDiscover `features.visual` for authoring and `features.visualReview` for baseline inspection; `features.isolatedVisual` identifies the default-off personal capture lane, independent of script/AI admission. Start with `monitor init --type visual --target https://product.example --file visual.json`, edit the fixed page/element checkpoint, viewport, readiness, masks and thresholds, then `monitor validate --file visual.json` and `monitor apply --file visual.json --dry-run`. Apply paused; an authorized `run start --id ID --wait` is a separate action. Visual monitors accept no script, model binding, session identity or custom request credential. Fixed visual baseline execution is not supported by `run local`; local API/browser script evidence does not establish a visual baseline.\n\nThe first capture needs baseline review; its `missing_baseline` result is missing coverage, not a product failure. Inspect `visual list`, `visual get --id COMPARISON_ID`, `visual heads --id MONITOR_ID`, `visual artifacts --id COMPARISON_ID` and `visual image --id COMPARISON_ID --role candidate|original|diff --file NEW_PRIVATE_PATH`. Review actual images and metrics before an authorized `visual approve --id COMPARISON_ID --expected-revision SELECTED_REVISION`; an initial selection uses 0. Restore only a reviewed retained baseline with `visual restore --id HEAD_ID --baseline-id BASELINE_ID --expected-revision CURRENT_HEAD_REVISION`. Stale decisions conflict: reload instead of retrying or changing revisions blindly. Approval preserves the historical result. Changed capture fingerprints need their own baseline. Foreign-owner/read-only refusals are boundaries, not reasons to switch credentials. Screenshots are private evidence; masks cover selected pixels only. Use actual `visual` and `run` help for current flags and capabilities.\n\n## Optional browser test-account identity\n\nFor a signed-in browser journey, discover hosted `features.browserIdentities` before configuring `identity create/rotate/enable/disable/delete`. Supply bounded cookies/localStorage through a private `--state-file`; metadata is scoped to one verified exact origin, project/environment and explicit expiry. State is write-only and cannot be exported. New identities default disabled; enable explicitly and bind the resulting current `{identityId, revision}` under `browserIdentity` in a version-2 browser manifest with explicit context. Rename, state replacement and enable/disable advance revisions; inspect current metadata and deliberately rebind rather than silently upgrading. After an uncertain write inspect metadata before retrying. No running Chrome profile is imported.\n\nRun the same manifest account-free with `run local --file MONITOR --runtime RUNTIME --browser-identities-file PRIVATE_MAP`. The map is `{schemaVersion:1,identities:[{identityId,revision,projectId,environmentId,origin,expiresAt,stateFile}]}`; state paths resolve relative to the map. Both map/state are private regular JSON files (chmod 600), no symlinks/hard links or inline state. Exact IDs/revision/scope/origin and bounded future expiry must match. Local mappings do not attest hosted target verification or revocation. The optional model map remains separate. Hosted identity-backed runs use the isolated lane for all owners; local code remains trusted. The selected script receives its own session and signed-in page content can reach private evidence or optional AI providers. Never promise pixel/encoded-secret masking. Use dedicated test accounts and inspect coverage errors after expiry/revocation before repeating a possibly completed action.\n\n## Optional AI in an existing local project\n\nFor an existing project's custom model setup, use `--project`. A schemaVersion 2 manifest with an `ai` binding can also run unchanged locally using `--connections-file /private/connections.json`, without login. The private map has schemaVersion 1 and a connections array; each record contains id, configurationRevision, provider openrouter, projectId, environmentId, allowed models and credentialFile. Credential paths resolve relative to the map. IDs/revisions/models and explicit manifest scope must match. Keep both map and key files private (chmod 600); inline keys, provider URLs and symlinks are refused. The selected runtime also needs ai@7.0.107. The complete CLI package ships model-client.mjs and notices; copying only cli.mjs is insufficient for bound AI execution.\n\nThe local manifest runner keeps the provider key in its parent and passes a temporary loopback grant to the test. It uses the hosted transport and per-run budget/outcome rules, but no hosted account/day ledger. Read model-usage.json as well as the native report: caught provider/budget failures may leave a native passed test while Waitcher correctly records error. Unknown usage stays reserved, SDK retries count separately, and local success does not verify hosted enablement or key freshness. Provider keys are not forwarded to the child, and literal temporary broker tokens are redacted from normal text evidence; trusted local code can read its filesystem and is not a sandbox. Traces default on, video stays opt-in.\n\nIn the project's `e2e.config.ts`, construct the chosen provider's AI SDK model under `agents.default.model`, following the installed framework's types. The provider reads its local key; a key alone does not configure a model. Never copy a user's provider key into a monitor manifest or use an operator's account key.\n\nMix exact assertions with selected `agent.act`, `agent.assert`, `agent.waitFor` and schema-bound `agent.extract` calls. AI operations may transmit screen content to the provider and incur cost; preserve the user's provider/call authorization. Step-level `maxModelCalls` is not a whole-run spending limit. Hosted connection/broker/budget support is separate and must be discovered from actual capabilities rather than assumed from a local run.\n\n## Verified HTTP credentials\n\nFor an authenticated HTTP or AI endpoint, use the user's owned verified HTTPS origin and an `httpAuth` reference (`targetId`, `credentialId`, `credentialRevision`). Check `features.httpTargets` before hosted configuration. Create/renew a target challenge with `target create` or `target challenge`, writing it to a new private `--output`; never print the token. The user publishes the supplied proof at `/.well-known/waitcher-verification.txt`, then `target verify` checks it without credentials. Verification expires after 24 hours and must be renewed. An origin excludes paths, query and fragments and is immutable.\n\nUse `target credential create/rotate` with non-secret metadata JSON plus `--credential-file` (mode 600) or `--credential-stdin`. Headers are limited to `Authorization` or `X-Api-Key`; values are complete single-line ASCII header values up to 4096 bytes. For Bearer auth, include the `Bearer ` prefix in the private value. Keys are write-only and encrypted on the server. The monitor and export retain references only. Rotation advances the credential revision; update the monitor binding explicitly. Disabled, expired, foreign or stale bindings fail without forwarding a request. Authenticated redirects are never followed.\n\nFor local execution without the app or account, pass `run local --file monitor.json --http-credentials-file private/http-map.json`. The private map is `{schemaVersion:1,credentials:[{targetId,credentialId,credentialRevision,origin,header,credentialFile}]}` and the referenced private file contains the raw header value. Paths resolve relative to the map. Never inline a key or reuse the CLI's own account cookie/token as a target credential. The local resolver requires exactly matching IDs, revision and canonical origin, and the shared runner enforces the single supported header and redirect policy. Local mapping does not prove that the hosted target is still verified or its key current. Keep the same manifest as the hosted monitor; only local key resolution differs. HTTP local checks need no E2E runtime. Use explicit user authorization for POST fixtures that change state.\n\n## Hosted endpoint invocation budgets\n\nBefore running dedicated AI endpoints or HTTP checks with `httpAuth`, read `account invocations` for the account/monitor UTC-day counters and limits. The manifest accepts `requestBudget: {dailyInvocations: N}` (default 50, maximum 1,000). Configure the owner cap with `account budget --daily-invocations N --expected-revision CURRENT_REVISION` only when authorized; personal accounts cap at 200, administrators at 5,000, and the controller also has a global 5,000 cap. Validate/apply/export do not charge calls.\n\n`INVOCATION_BUDGET_EXHAUSTED` is a coverage error: no request was dispatched and no product incident is created. Do not automatically retry or raise a limit to bypass it. Completed and uncertain dispatched calls consume budget, independent of product success or worker-reported usage. Local execution needs no account, preserves the setting and makes at most one endpoint call per fixture case, but does not enforce or consume the hosted daily ledger. After backup restore, `window.restoreHeld` blocks these checks until the next UTC reset because snapshot counters may be stale; do not bypass the hold by raising caps. These are request counts, separate from model-broker token/call caps and downstream provider spending. Inspect `account invocations` and the current `account` help for the hosted accounting contract.\n\nInspect readable scenario evidence with `waitcher run scenarios --id RUN_ID`, or use `waitcher run scenarios --directory PRIVATE_RUN_DIR` for account-free local inspection without a server/runtime. Add `--json` for the exact shared report DTO. Do not combine selectors or pass `--server` for local inspection. Inspection of failed/error runs succeeds; execution exit codes remain unchanged. Keep authoritative run status separate from evidence availability: empty valid reports verify no business outcome, and pending/not-recorded/expired/invalid reports cannot establish a pass. Local evidence is checked against its recorded inventory and checksum; never edit it to manufacture a successful outcome.\n\nFor protected product operations, use monitor init --template protected-agent-outcome --request-policy-file POLICY.json --project-id UUID --environment-id UUID --file monitor.json. The public policy contains connections with id, canonical HTTPS origin and httpAuth references (targetId, credentialId, credentialRevision); operations with id, connection, method, path, optional static body, responsePointers and maxCalls; and budget.calls. Paths are fixed absolute paths with at most one whole {resourceId} UUID segment. Static JSON bodies may use only exact string leaves {{resourceId}}. Callers cannot choose URLs, methods, headers, bodies, query parameters or UUIDs. GET permits at most three calls, POST and DELETE one; DELETE requires the UUID path and POST must use the run identity. Limits are four connections, eight operations and eight total calls.\n\nThe protected starter requires submit POST, observe GET (three reads), cleanup DELETE, a five-call budget and response pointers /id, /correlationId, /title, /completed. Configure the static submission body to create a note with the parent-generated UUID in both id and correlationId, title Waitcher outcome check, and completed true. The optional #waitcher/requests SDK exposes requestOperation and requestResourceId. Responses contain status and a data map keyed by configured JSON pointers. The script never trusts the agent reply as proof of resulting state, never retries the action, and only cleans up independently proven run-owned state.\n\nLocal execution uses the existing --http-credentials-file private map: schemaVersion 1 and credentials entries with targetId, credentialId, credentialRevision, origin, header and credentialFile. Header is Authorization or X-Api-Key; its raw value stays in a separate private regular file. Map and key files require mode600 and exact reference/revision/origin matches. Keys stay in the CLI parent, never script, manifest, CLI arguments or custom environment. No account, app or AI provider is required locally. Keep request-runtime.mjs with the complete CLI package. For source projects use scriptFile, monitor build, then run local --file; standalone project mode does not inject the protected helper. Hosted use requires explicit capability and isolated execution even for administrators. Combined AI or browser-state bindings need their independent authority. Inspect request-usage.json, scenario and native reports. Caught budget errors, uncertain dispatch and unfinished calls cannot establish a healthy result; never replay mutations automatically.\n\nScenario request associations are optional recorded evidence. The request helper automatically records each issued request UUID on its originating phase. In a verify phase, call `scenario.referenceRequest(response.requestId)` for a request from an earlier completed observe phase in the same scenario; use the validated response envelope UUID, never an ID from response data. The protected starter references its last independent observation before asserting the business state. Read associations with `run scenarios`; `run diagnose` joins them to this run's request records and labels each ID `matched`, `not-found` or `unavailable`. These are script-reported phase associations. A matching controller row proves accounting correspondence, not the correctness of a phase or business outcome. Local matches remain local helper reports. Older evidence without association fields is not recorded, rather than an empty verified list. UNKNOWN requests remain charged and incomplete; no association authorizes mutation replay.\n";
|
|
61071
|
+
var optional_capabilities_default = "# Optional capabilities\n\nRead only when capabilities report the feature and the user needs it: visual baselines, signed-in browser identities, verified HTTP credentials and invocation budgets. AI endpoints, agent outcome checks, model steps and protected requests are in [ai-and-agents](ai-and-agents.md).\n\n## Optional visual checks\n\nDiscover `features.visual` for authoring and `features.visualReview` for baseline inspection; `features.isolatedVisual` identifies the default-off personal capture lane, independent of script/AI admission. Start with `monitor init --type visual --target https://product.example --file visual.json`, edit the fixed page/element checkpoint, viewport, readiness, masks and thresholds, then `monitor validate --file visual.json` and `monitor apply --file visual.json --dry-run`. Apply paused; an authorized `run start --id ID --wait` is a separate action. Visual monitors accept no script, model binding, session identity or custom request credential. Fixed visual baseline execution is not supported by `run local`; local API/browser script evidence does not establish a visual baseline.\n\nThe first capture needs baseline review; its `missing_baseline` result is missing coverage, not a product failure. Inspect `visual list`, `visual get --id COMPARISON_ID`, `visual heads --id MONITOR_ID`, `visual artifacts --id COMPARISON_ID` and `visual image --id COMPARISON_ID --role candidate|original|diff --file NEW_PRIVATE_PATH`. Review actual images and metrics before an authorized `visual approve --id COMPARISON_ID --expected-revision SELECTED_REVISION`; an initial selection uses 0. Restore only a reviewed retained baseline with `visual restore --id HEAD_ID --baseline-id BASELINE_ID --expected-revision CURRENT_HEAD_REVISION`. Stale decisions conflict: reload instead of retrying or changing revisions blindly. Approval preserves the historical result. Changed capture fingerprints need their own baseline. Foreign-owner/read-only refusals are boundaries, not reasons to switch credentials. Screenshots are private evidence; masks cover selected pixels only. Use actual `visual` and `run` help for current flags and capabilities.\n\n## Optional browser test-account identity\n\nFor a signed-in browser journey, discover hosted `features.browserIdentities` before configuring `identity create/rotate/enable/disable/delete`. Supply bounded cookies/localStorage through a private `--state-file`; metadata is scoped to one verified exact origin, project/environment and explicit expiry. State is write-only and cannot be exported. New identities default disabled; enable explicitly and bind the resulting current `{identityId, revision}` under `browserIdentity` in a version-2 browser manifest with explicit context. Rename, state replacement and enable/disable advance revisions; inspect current metadata and deliberately rebind rather than silently upgrading. After an uncertain write inspect metadata before retrying. No running Chrome profile is imported.\n\nRun the same manifest account-free with `run local --file MONITOR --runtime RUNTIME --browser-identities-file PRIVATE_MAP`. The map is `{schemaVersion:1,identities:[{identityId,revision,projectId,environmentId,origin,expiresAt,stateFile}]}`; state paths resolve relative to the map. Both map/state are private regular JSON files (chmod 600), no symlinks/hard links or inline state. Exact IDs/revision/scope/origin and bounded future expiry must match. Local mappings do not attest hosted target verification or revocation. The optional model map remains separate. Hosted identity-backed runs use the isolated lane for all owners; local code remains trusted. The selected script receives its own session and signed-in page content can reach private evidence or optional AI providers. Never promise pixel/encoded-secret masking. Use dedicated test accounts and inspect coverage errors after expiry/revocation before repeating a possibly completed action.\n\n## Verified HTTP credentials\n\nFor an authenticated HTTP or AI endpoint, use the user's owned verified HTTPS origin and an `httpAuth` reference (`targetId`, `credentialId`, `credentialRevision`). Check `features.httpTargets` before hosted configuration. Create/renew a target challenge with `target create` or `target challenge`, writing it to a new private `--output`; never print the token. The user publishes the supplied proof at `/.well-known/waitcher-verification.txt`, then `target verify` checks it without credentials. Verification expires after 24 hours and must be renewed. An origin excludes paths, query and fragments and is immutable.\n\nUse `target credential create/rotate` with non-secret metadata JSON plus `--credential-file` (mode 600) or `--credential-stdin`. Headers are limited to `Authorization` or `X-Api-Key`; values are complete single-line ASCII header values up to 4096 bytes. For Bearer auth, include the `Bearer ` prefix in the private value. Keys are write-only and encrypted on the server. The monitor and export retain references only. Rotation advances the credential revision; update the monitor binding explicitly. Disabled, expired, foreign or stale bindings fail without forwarding a request. Authenticated redirects are never followed.\n\nFor local execution without the app or account, pass `run local --file monitor.json --http-credentials-file private/http-map.json`. The private map is `{schemaVersion:1,credentials:[{targetId,credentialId,credentialRevision,origin,header,credentialFile}]}` and the referenced private file contains the raw header value. Paths resolve relative to the map. Never inline a key or reuse the CLI's own account cookie/token as a target credential. The local resolver requires exactly matching IDs, revision and canonical origin, and the shared runner enforces the single supported header and redirect policy. Local mapping does not prove that the hosted target is still verified or its key current. Keep the same manifest as the hosted monitor; only local key resolution differs. HTTP local checks need no E2E runtime. Use explicit user authorization for POST fixtures that change state.\n\n## Hosted endpoint invocation budgets\n\nBefore running dedicated AI endpoints or HTTP checks with `httpAuth`, read `account invocations` for the account/monitor UTC-day counters and limits. The manifest accepts `requestBudget: {dailyInvocations: N}` (default 50, maximum 1,000). Configure the owner cap with `account budget --daily-invocations N --expected-revision CURRENT_REVISION` only when authorized; personal accounts cap at 200, administrators at 5,000, and the controller also has a global 5,000 cap. Validate/apply/export do not charge calls.\n\n`INVOCATION_BUDGET_EXHAUSTED` is a coverage error: no request was dispatched and no product incident is created. Do not automatically retry or raise a limit to bypass it. Completed and uncertain dispatched calls consume budget, independent of product success or worker-reported usage. Local execution needs no account, preserves the setting and makes at most one endpoint call per fixture case, but does not enforce or consume the hosted daily ledger. After backup restore, `window.restoreHeld` blocks these checks until the next UTC reset because snapshot counters may be stale; do not bypass the hold by raising caps. These are request counts, separate from model-broker token/call caps and downstream provider spending. Inspect `account invocations` and the current `account` help for the hosted accounting contract.\n";
|
|
60944
61072
|
|
|
60945
61073
|
// ../../skills/waitcher/agents/openai.yaml
|
|
60946
61074
|
var openai_default = 'interface:\n display_name: "Waitcher"\n short_description: "Deploy monitoring from a repository and inspect evidence"\n default_prompt: "Use $waitcher to set up monitoring for this repository: pick the critical journeys, verify them locally and deploy them paused through a reviewed plan."\n';
|
|
@@ -60951,6 +61079,7 @@ import { homedir } from "node:os";
|
|
|
60951
61079
|
import { join as join13, resolve as resolve14 } from "node:path";
|
|
60952
61080
|
var references = {
|
|
60953
61081
|
"authoring.md": authoring_default,
|
|
61082
|
+
"ai-and-agents.md": ai_and_agents_default,
|
|
60954
61083
|
"deploy.md": deploy_default,
|
|
60955
61084
|
"diagnosis.md": diagnosis_default,
|
|
60956
61085
|
"optional-capabilities.md": optional_capabilities_default
|
|
@@ -61846,7 +61975,8 @@ async function revokeOAuth(session, signal) {
|
|
|
61846
61975
|
var help = `Waitcher CLI
|
|
61847
61976
|
|
|
61848
61977
|
Usage: waitcher <group> <command> [options]
|
|
61849
|
-
|
|
61978
|
+
Commands print JSON on stdout and errors as {error:{code,message}} on stderr;
|
|
61979
|
+
run diagnose and run scenarios print a readable report unless --json. Help and version work offline.
|
|
61850
61980
|
waitcher help TOPIC (or waitcher GROUP --help) prints only matching sections, e.g. help deploy.
|
|
61851
61981
|
waitcher help all prints everything; waitcher --help prints an overview.
|
|
61852
61982
|
|
|
@@ -61854,8 +61984,9 @@ Agent skill
|
|
|
61854
61984
|
skill show Read the bundled skill and its references as JSON
|
|
61855
61985
|
skill install [--global | --path SKILLS_DIR]
|
|
61856
61986
|
Install or update the skill in .claude/skills/waitcher
|
|
61857
|
-
(this project; --global: ~/.claude/skills).
|
|
61858
|
-
|
|
61987
|
+
(this project; --global: ~/.claude/skills). Codex and other
|
|
61988
|
+
agents reading .agents/skills: --path .agents/skills. Rerun
|
|
61989
|
+
after upgrading the CLI; never replaces a skill it did not write
|
|
61859
61990
|
|
|
61860
61991
|
Heartbeats
|
|
61861
61992
|
heartbeat status --id ID Inspect timing, credential status and recent events
|
|
@@ -61890,6 +62021,13 @@ Authentication
|
|
|
61890
62021
|
Immediately refuse new requests using that token
|
|
61891
62022
|
token history [--before CURSOR] Read recent owner-scoped credential activity
|
|
61892
62023
|
|
|
62024
|
+
Plans and billing
|
|
62025
|
+
account billing Plan, limits and subscription status
|
|
62026
|
+
account upgrade Stripe Checkout URL for the pro plan (human session)
|
|
62027
|
+
account billing-portal Stripe portal URL to change payment or cancel
|
|
62028
|
+
The plan changes only when Stripe confirms the payment, never on the return page.
|
|
62029
|
+
Billing appears when the server reports features.billing.
|
|
62030
|
+
|
|
61893
62031
|
Account data
|
|
61894
62032
|
account deletion Review current deletion revision and impact
|
|
61895
62033
|
account deletion-prepare --expected-revision N --output NEW_PRIVATE_RECEIPT
|
|
@@ -61949,7 +62087,11 @@ Projects and environments
|
|
|
61949
62087
|
project compare --id ID --deployment-id ID [--before CURSOR]
|
|
61950
62088
|
Compare captured runs around a deployment
|
|
61951
62089
|
project timeline --id ID [--environment-id ID] [--before CURSOR]
|
|
61952
|
-
|
|
62090
|
+
Project and environment JSON: {"name":"Shop"}; edits add "expectedRevision":N from get/list.
|
|
62091
|
+
Environments carry only a name; base URLs live in waitcher.json or each monitor's target.
|
|
62092
|
+
Deployment JSON: {"environmentId":"UUID","version":"1.4.2","note":"optional",
|
|
62093
|
+
"deployedAt":EPOCH_MS (optional, default now)}. IDs come from project get.
|
|
62094
|
+
project export writes CSV. Creates accept --request-key.
|
|
61953
62095
|
|
|
61954
62096
|
Agent workflow
|
|
61955
62097
|
doctor [--file PATH] [--env NAME] Read-only check of Node, waitcher.json, builds, skill,
|
|
@@ -61969,6 +62111,9 @@ Repository deploys (waitcher.json)
|
|
|
61969
62111
|
only lists the steps. Rerun after a CLI update to upgrade
|
|
61970
62112
|
config validate [--file PATH] [--env NAME]
|
|
61971
62113
|
Resolve every environment offline; exit 2 on errors
|
|
62114
|
+
config validate --env NAME --verify [--key KEY]...
|
|
62115
|
+
Also run that environment's api/browser entries locally,
|
|
62116
|
+
no login; failures exit 4 (VERIFY_FAILED)
|
|
61972
62117
|
deploy plan --env NAME [--file PATH] [--prune] [--activate-new] [--verify]
|
|
61973
62118
|
Server-side plan with account checks; changes nothing
|
|
61974
62119
|
deploy apply --env NAME [--file PATH] [--prune] [--activate-new] [--verify]
|
|
@@ -61994,8 +62139,9 @@ Repository deploys (waitcher.json)
|
|
|
61994
62139
|
code, path, monitor key and hint; ok:false exits 2. --based-on refuses a stale plan.
|
|
61995
62140
|
|
|
61996
62141
|
Monitor configuration
|
|
61997
|
-
monitor init --file PATH [--type http|browser|visual|heartbeat|ai] [--target URL]
|
|
61998
|
-
|
|
62142
|
+
monitor init --file PATH [--type http|certificate|api|browser|visual|heartbeat|ai] [--target URL]
|
|
62143
|
+
Write a paused example; never overwrite
|
|
62144
|
+
api and browser also write PATH.e2e.ts next to it
|
|
61999
62145
|
monitor init --template agent-outcome --file PATH [--target API_BASE]
|
|
62000
62146
|
API script: one agent action, independent correlated resource read, owned cleanup
|
|
62001
62147
|
Structured submit/observe/verify/cleanup results; incomplete coverage is error
|
|
@@ -62009,16 +62155,13 @@ Monitor configuration
|
|
|
62009
62155
|
Monitor edits require --expected-revision N from get/export; manifests remain portable.
|
|
62010
62156
|
monitor get --id ID Read a definition and recent results
|
|
62011
62157
|
monitor export --id ID --file PATH Export configuration, not history
|
|
62012
|
-
monitor apply --file PATH [--id ID
|
|
62013
|
-
[--dry-run] [--enable]
|
|
62158
|
+
monitor apply --file PATH [--id ID --expected-revision N]
|
|
62159
|
+
[--dry-run] [--enable] Create, or replace with --id (complete definition)
|
|
62014
62160
|
monitor pause --id ID Disable scheduled executions
|
|
62015
62161
|
monitor resume --id ID Enable scheduled executions
|
|
62016
62162
|
monitor delete --id ID --yes Permanently remove monitor and history
|
|
62017
62163
|
|
|
62018
62164
|
Executions and reports
|
|
62019
|
-
monitor init --template protected-agent-outcome --request-policy-file POLICY.json
|
|
62020
|
-
--project-id UUID --environment-id UUID --file MONITOR.json
|
|
62021
|
-
Explicit protected operation refs, no inline keys
|
|
62022
62165
|
run scenarios --id RUN_ID [--json]
|
|
62023
62166
|
run scenarios --directory PRIVATE_RUN_DIR [--json]
|
|
62024
62167
|
run diagnose --id RUN_ID [--json]
|
|
@@ -62061,7 +62204,7 @@ Visual review (requires server capability visualReview; decisions require write
|
|
|
62061
62204
|
Release clears current and retained rollback references for this head; ordinary
|
|
62062
62205
|
cleanup removes eligible images. Monitor creation remains separately gated.
|
|
62063
62206
|
|
|
62064
|
-
|
|
62207
|
+
Browser identities (signed-in test accounts; features.browserIdentities)
|
|
62065
62208
|
identity list List protected browser identity metadata
|
|
62066
62209
|
identity get --id ID Read metadata without browser state
|
|
62067
62210
|
identity create --file META --state-file PRIVATE_JSON
|
|
@@ -62069,6 +62212,11 @@ Verified HTTP targets and write-only request credentials (features.httpTargets)
|
|
|
62069
62212
|
identity rotate --id ID --file META --state-file PRIVATE_JSON --expected-revision N
|
|
62070
62213
|
identity enable|disable --id ID --expected-revision N
|
|
62071
62214
|
identity delete --id ID --expected-revision N --yes
|
|
62215
|
+
Create META: {"name":"Test user","targetId":"UUID","projectId":"UUID",
|
|
62216
|
+
"environmentId":"UUID","expiresAt":EPOCH_MS}; rotate META: {"expiresAt":EPOCH_MS}. State (cookies/localStorage) stays in --state-file.
|
|
62217
|
+
The target must be a verified HTTP target. New identities start disabled.
|
|
62218
|
+
|
|
62219
|
+
Verified HTTP targets and write-only request credentials (features.httpTargets)
|
|
62072
62220
|
target list
|
|
62073
62221
|
target get --id ID
|
|
62074
62222
|
target create --file JSON --output NEW_PRIVATE_PROOF
|
|
@@ -62157,15 +62305,24 @@ Alerts
|
|
|
62157
62305
|
alert policy delete (--id ID | --project-id ID) --yes Use '*' for default routing
|
|
62158
62306
|
alert deliveries
|
|
62159
62307
|
alert attempts --id DELIVERY_ID
|
|
62160
|
-
Channel
|
|
62161
|
-
|
|
62308
|
+
Channel JSON: {"name":"Ops","kind":"slack","enabled":true}; email adds "from" and "to".
|
|
62309
|
+
enabled defaults to false and test refuses a disabled channel. The Slack/webhook URL or
|
|
62310
|
+
Resend key is the credential: private file or stdin, never JSON. Updates add
|
|
62311
|
+
"expectedRevision":N (from channel list); omit the credential to keep it.
|
|
62312
|
+
Policy JSON: {"monitorId":"*","channelIds":["CHANNEL_ID"],"events":["incident","recovered"],
|
|
62313
|
+
"cooldownSeconds":0,"enabled":true,"expectedRevision":0}. Scope: "*" (account default),
|
|
62314
|
+
a monitor ID, or "projectId":"UUID" instead of monitorId. One rule per scope:
|
|
62315
|
+
expectedRevision 0 creates it; to edit, use its revision from policy list.
|
|
62316
|
+
Maintenance JSON: {"name":"Release","monitorId":"*","startsAt":EPOCH_MS,"endsAt":EPOCH_MS,
|
|
62317
|
+
"enabled":true}. UTC epoch milliseconds, at most 7 days; scope "*" or one monitor ID.
|
|
62318
|
+
Windows silence notifications, not checks. Updates add "expectedRevision":N.
|
|
62162
62319
|
|
|
62163
62320
|
Shared options
|
|
62164
62321
|
--server URL HTTPS origin, or loopback HTTP for development
|
|
62165
62322
|
Default: WAITCHER_SERVER or https://waitcher.dev
|
|
62166
62323
|
--request-key KEY Recover a create, run start or channel test (16 to 100 characters)
|
|
62167
62324
|
Same account, operation and payload; retained for 24 hours
|
|
62168
|
-
--json JSON
|
|
62325
|
+
--json Structured JSON for run diagnose and run scenarios (others default to JSON)
|
|
62169
62326
|
-h, --help Show this offline help
|
|
62170
62327
|
-v, --version Show version
|
|
62171
62328
|
|
|
@@ -62178,8 +62335,10 @@ Run once does not enable the schedule. No command retries a write automatically.
|
|
|
62178
62335
|
A wait timeout or interruption does not cancel a server execution.
|
|
62179
62336
|
Local interruption stops local child processes and preserves partial evidence.
|
|
62180
62337
|
Local runs are not uploaded, do not enable schedules, and do not prove hosted health.
|
|
62181
|
-
Local API/browser tests require
|
|
62182
|
-
and Chromium in the
|
|
62338
|
+
Local API/browser tests require e2e@${RUNTIME_PINS.e2e} installed in the --runtime directory (browser manifests
|
|
62339
|
+
also @e2e-dev/web@${RUNTIME_PINS["@e2e-dev/web"]} and Chromium in the Playwright browser cache, PLAYWRIGHT_BROWSERS_PATH
|
|
62340
|
+
when set); waitcher runtime install --file DIR/waitcher.json sets them up.
|
|
62341
|
+
waitcher.json entries run locally with config validate --env NAME --verify, not run local.
|
|
62183
62342
|
Configuration exports may contain secrets: keep them private and out of Git.
|
|
62184
62343
|
|
|
62185
62344
|
Local AI endpoint and browser identity notes
|
|
@@ -62200,8 +62359,6 @@ Bound browser identities use --browser-identities-file PRIVATE_MAP in --file mod
|
|
|
62200
62359
|
Map: {schemaVersion:1,identities:[{identityId,revision,projectId,environmentId,
|
|
62201
62360
|
origin,expiresAt,stateFile:"state.json"}]}. State is a private JSON file with
|
|
62202
62361
|
cookies/origins/localStorage for one exact HTTPS origin, never a Chrome profile.
|
|
62203
|
-
Metadata create JSON contains name,targetId,projectId,environmentId,expiresAt;
|
|
62204
|
-
rotation metadata contains expiresAt. State stays in --state-file, chmod 600.
|
|
62205
62362
|
Saved monitor browserIdentity:{identityId,revision} requires schemaVersion 2 and
|
|
62206
62363
|
explicit context. Hosted runs require enabled verified targets and an isolated
|
|
62207
62364
|
identity-capable worker. Local execution requires no account or application.
|
|
@@ -62247,6 +62404,9 @@ Exit codes
|
|
|
62247
62404
|
10 unavailable service; 130 interrupted. No background polling after the command exits.
|
|
62248
62405
|
|
|
62249
62406
|
Protected script requests (explicit hosted capability required)
|
|
62407
|
+
monitor init --template protected-agent-outcome --request-policy-file POLICY.json
|
|
62408
|
+
--project-id UUID --environment-id UUID --file MONITOR.json
|
|
62409
|
+
Explicit protected operation refs, no inline keys
|
|
62250
62410
|
#waitcher/requests: requestOperation("submit"), requestResourceId()
|
|
62251
62411
|
Protected starter policy must define submit POST, observe GET (maxCalls 3)
|
|
62252
62412
|
and cleanup DELETE; UUID resource substitution is owned by the parent broker.
|
|
@@ -62271,7 +62431,7 @@ var GROUPS = new Set(
|
|
|
62271
62431
|
var commands = (section) => {
|
|
62272
62432
|
const byGroup = /* @__PURE__ */ new Map();
|
|
62273
62433
|
for (const line of section.split("\n")) {
|
|
62274
|
-
const m = /^ {2}([a-z]+)(?: ([a-z][a-z
|
|
62434
|
+
const m = /^ {2}([a-z]+)(?: ([a-z][a-z|-]*))?/.exec(line);
|
|
62275
62435
|
if (!m || !GROUPS.has(m[1])) continue;
|
|
62276
62436
|
const list = byGroup.get(m[1]) ?? /* @__PURE__ */ new Set();
|
|
62277
62437
|
if (m[2]) list.add(m[2]);
|
|
@@ -62308,7 +62468,7 @@ Start (repository workflow; waitcher help deploy has the details)
|
|
|
62308
62468
|
waitcher doctor Check setup, session and capabilities
|
|
62309
62469
|
waitcher config init --project-name NAME --target https://BASE_URL
|
|
62310
62470
|
waitcher runtime install [--yes] Pin the test runtime for api/browser entries
|
|
62311
|
-
waitcher config validate
|
|
62471
|
+
waitcher config validate [--env NAME --verify] Offline; --verify runs api/browser tests locally
|
|
62312
62472
|
waitcher deploy plan --env NAME --verify Changes nothing
|
|
62313
62473
|
waitcher deploy apply --env NAME --based-on BASED_ON
|
|
62314
62474
|
One monitor without waitcher.json: monitor init, monitor validate, monitor apply --file PATH
|
|
@@ -62326,7 +62486,7 @@ ${exitCodes}
|
|
|
62326
62486
|
// package.json
|
|
62327
62487
|
var package_default = {
|
|
62328
62488
|
name: "@waitcher/cli",
|
|
62329
|
-
version: "0.2.
|
|
62489
|
+
version: "0.2.4",
|
|
62330
62490
|
description: "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API and browser monitors from waitcher.json.",
|
|
62331
62491
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
62332
62492
|
author: "S\u0142awomir Radzymi\u0144ski",
|
|
@@ -62487,6 +62647,7 @@ async function main() {
|
|
|
62487
62647
|
"source-version": { type: "string" },
|
|
62488
62648
|
verify: { type: "boolean" },
|
|
62489
62649
|
adopt: { type: "string", multiple: true },
|
|
62650
|
+
key: { type: "string", multiple: true },
|
|
62490
62651
|
name: { type: "string" },
|
|
62491
62652
|
"value-file": { type: "string" },
|
|
62492
62653
|
"value-stdin": { type: "boolean" },
|
|
@@ -62610,6 +62771,9 @@ async function main() {
|
|
|
62610
62771
|
"account invocations": [],
|
|
62611
62772
|
"account budget": ["daily-invocations", "expected-revision"],
|
|
62612
62773
|
"account settings": [],
|
|
62774
|
+
"account billing": [],
|
|
62775
|
+
"account upgrade": [],
|
|
62776
|
+
"account billing-portal": [],
|
|
62613
62777
|
"account configure": ["file", "expected-revision"],
|
|
62614
62778
|
"account activity": ["before"],
|
|
62615
62779
|
"heartbeat status": ["id"],
|
|
@@ -62664,7 +62828,7 @@ async function main() {
|
|
|
62664
62828
|
"environment update": ["project-id", "id", "file"],
|
|
62665
62829
|
"deployment record": ["project-id", "file", "request-key"],
|
|
62666
62830
|
"config init": ["file", "project-name", "target"],
|
|
62667
|
-
"config validate": ["file", "env"],
|
|
62831
|
+
"config validate": ["file", "env", "verify", "key"],
|
|
62668
62832
|
"config schema": [],
|
|
62669
62833
|
"runtime install": ["file", "browser", "yes"],
|
|
62670
62834
|
"deploy plan": ["file", "env", "prune", "activate-new", "verify", "adopt"],
|
|
@@ -62890,6 +63054,25 @@ async function main() {
|
|
|
62890
63054
|
(e) => e.issues.map((i) => ({ ...i, environment: e.name }))
|
|
62891
63055
|
) : first.issues
|
|
62892
63056
|
];
|
|
63057
|
+
if ((v.verify || v.key) && !v.env)
|
|
63058
|
+
usage2("--verify runs one environment; add --env NAME.");
|
|
63059
|
+
if (v.key && !v.verify) usage2("--key selects monitors for --verify.");
|
|
63060
|
+
const known = new Set(environments[0]?.monitors.map((m) => m.key));
|
|
63061
|
+
const unknown2 = (v.key ?? []).filter((k) => !known.has(k));
|
|
63062
|
+
if (unknown2.length)
|
|
63063
|
+
usage2(
|
|
63064
|
+
`No monitor with key ${unknown2.join(", ")} in environment ${v.env}.`
|
|
63065
|
+
);
|
|
63066
|
+
const buildFailed = built.issues.some((i) => i.severity === "error");
|
|
63067
|
+
const local = v.verify && !buildFailed ? await verifyLocally({
|
|
63068
|
+
path: path2,
|
|
63069
|
+
config: config2,
|
|
63070
|
+
env: v.env,
|
|
63071
|
+
scripts: built.scripts,
|
|
63072
|
+
keys: v.key,
|
|
63073
|
+
signal: controller.signal
|
|
63074
|
+
}) : null;
|
|
63075
|
+
if (local) issues.push(...local.issues);
|
|
62893
63076
|
const ok = !issues.some((i) => i.severity === "error");
|
|
62894
63077
|
process.stdout.write(
|
|
62895
63078
|
JSON.stringify({
|
|
@@ -62900,13 +63083,14 @@ async function main() {
|
|
|
62900
63083
|
project: first.project ?? null,
|
|
62901
63084
|
environments: environments.map(({ issues: _, ...e }) => e),
|
|
62902
63085
|
builds: built.builds,
|
|
63086
|
+
...local ? { verify: local.runs } : {},
|
|
62903
63087
|
issues,
|
|
62904
63088
|
next: ok ? [
|
|
62905
63089
|
`waitcher deploy plan --file ${path2} --env ${names[0]} checks account permissions, quotas and changes`
|
|
62906
63090
|
] : [`Fix the error issues in ${path2} and validate again`]
|
|
62907
63091
|
}) + "\n"
|
|
62908
63092
|
);
|
|
62909
|
-
process.exitCode = ok ? 0 : 2;
|
|
63093
|
+
process.exitCode = ok ? 0 : issues.some((i) => i.severity === "error" && i.code !== "VERIFY_FAILED") ? 2 : 4;
|
|
62910
63094
|
return;
|
|
62911
63095
|
}
|
|
62912
63096
|
if (command === "ci init") {
|
|
@@ -63082,9 +63266,17 @@ async function main() {
|
|
|
63082
63266
|
);
|
|
63083
63267
|
if (v.template && v.type && v.type !== "api")
|
|
63084
63268
|
usage2("The agent-outcome template uses --type api.");
|
|
63085
|
-
if (!v.template && v.type && ![
|
|
63269
|
+
if (!v.template && v.type && ![
|
|
63270
|
+
"http",
|
|
63271
|
+
"certificate",
|
|
63272
|
+
"api",
|
|
63273
|
+
"browser",
|
|
63274
|
+
"visual",
|
|
63275
|
+
"heartbeat",
|
|
63276
|
+
"ai"
|
|
63277
|
+
].includes(v.type))
|
|
63086
63278
|
usage2(
|
|
63087
|
-
"monitor init supports --type http, browser, visual, heartbeat or ai."
|
|
63279
|
+
"monitor init supports --type http, certificate, api, browser, visual, heartbeat or ai."
|
|
63088
63280
|
);
|
|
63089
63281
|
let protectedInitial;
|
|
63090
63282
|
if (v.template === "protected-agent-outcome") {
|
|
@@ -63117,7 +63309,7 @@ async function main() {
|
|
|
63117
63309
|
interval: 1800,
|
|
63118
63310
|
failureThreshold: 2,
|
|
63119
63311
|
heartbeat: { graceSeconds: 60, completionSeconds: 300 }
|
|
63120
|
-
} : v.type === "visual" ? visualExample : example);
|
|
63312
|
+
} : v.type === "visual" ? visualExample : v.type === "certificate" ? certificateExample : example);
|
|
63121
63313
|
if (v.target && v.type !== "heartbeat") {
|
|
63122
63314
|
try {
|
|
63123
63315
|
const target = new URL(v.target);
|
|
@@ -63127,11 +63319,14 @@ async function main() {
|
|
|
63127
63319
|
usage2("--target must be an HTTP(S) URL without embedded credentials.");
|
|
63128
63320
|
}
|
|
63129
63321
|
}
|
|
63130
|
-
if (v.type === "browser") {
|
|
63322
|
+
if (!v.template && (v.type === "browser" || v.type === "api")) {
|
|
63131
63323
|
const scriptFile = basename3(v.file).replace(/(\.monitor)?\.json$/, "") + ".e2e.ts";
|
|
63132
|
-
await writeText(
|
|
63324
|
+
await writeText(
|
|
63325
|
+
join16(dirname17(v.file), scriptFile),
|
|
63326
|
+
v.type === "api" ? apiScriptExample : browserScriptExample
|
|
63327
|
+
);
|
|
63133
63328
|
await writeJson(v.file, {
|
|
63134
|
-
...browserExample,
|
|
63329
|
+
...v.type === "api" ? apiExample : browserExample,
|
|
63135
63330
|
scriptFile,
|
|
63136
63331
|
...v.target ? { target: v.target } : {}
|
|
63137
63332
|
});
|
|
@@ -63140,7 +63335,20 @@ async function main() {
|
|
|
63140
63335
|
...initial,
|
|
63141
63336
|
...v.target ? { target: v.target } : {}
|
|
63142
63337
|
});
|
|
63143
|
-
|
|
63338
|
+
const type = v.template ? "api" : v.type ?? "http";
|
|
63339
|
+
result2 = {
|
|
63340
|
+
event: "initialized",
|
|
63341
|
+
file: v.file,
|
|
63342
|
+
enabled: false,
|
|
63343
|
+
next: [
|
|
63344
|
+
"Replace the example target, name and checks with the user's",
|
|
63345
|
+
`waitcher monitor validate --file ${v.file}`,
|
|
63346
|
+
...["visual", "heartbeat", "certificate"].includes(type) ? [] : [
|
|
63347
|
+
`waitcher run local --file ${v.file}${type === "api" || type === "browser" ? " --runtime PROJECT" : ""}`
|
|
63348
|
+
],
|
|
63349
|
+
`waitcher monitor apply --file ${v.file} --dry-run`
|
|
63350
|
+
]
|
|
63351
|
+
};
|
|
63144
63352
|
} else if (command === "monitor validate" || command === "monitor apply") {
|
|
63145
63353
|
const expectedRevision = v["expected-revision"] === void 0 ? void 0 : integer2(
|
|
63146
63354
|
v["expected-revision"],
|
|
@@ -64108,9 +64316,12 @@ async function main() {
|
|
|
64108
64316
|
body: parsed2.data
|
|
64109
64317
|
});
|
|
64110
64318
|
} else if (command === "deploy plan" || command === "deploy apply") {
|
|
64111
|
-
if (!v.env)
|
|
64319
|
+
if (!v.env)
|
|
64320
|
+
usage2("Provide --env with an environment name from waitcher.json.");
|
|
64112
64321
|
if (v["based-on"] !== void 0 && v["based-on"] !== "none" && !/^[0-9a-f-]{36}$/.test(v["based-on"]))
|
|
64113
|
-
usage2(
|
|
64322
|
+
usage2(
|
|
64323
|
+
"--based-on takes the basedOn deploy ID from deploy plan, or none."
|
|
64324
|
+
);
|
|
64114
64325
|
const { path: path2, config: config2 } = await readProjectConfig(v.file);
|
|
64115
64326
|
const apply = command === "deploy apply";
|
|
64116
64327
|
const smokeTimeout = integer2(v.timeout ?? "180", "timeout", 10, 900);
|
|
@@ -64205,15 +64416,14 @@ async function main() {
|
|
|
64205
64416
|
file: path2,
|
|
64206
64417
|
...deployed,
|
|
64207
64418
|
// Local warnings (RUNTIME_VERSION_OUTDATED) travel with the server's issues.
|
|
64208
|
-
issues: [
|
|
64209
|
-
...built.issues,
|
|
64210
|
-
...deployed.issues
|
|
64211
|
-
],
|
|
64419
|
+
issues: [...built.issues, ...deployed.issues],
|
|
64212
64420
|
builds: built.builds,
|
|
64213
64421
|
...v.verify ? { verify: local.runs } : {},
|
|
64214
64422
|
...v.smoke ? { smoke } : {},
|
|
64215
64423
|
next: [
|
|
64216
|
-
...built.issues.length ? [
|
|
64424
|
+
...built.issues.length ? [
|
|
64425
|
+
`waitcher runtime install --file ${path2} upgrades the project runtime before the previous pins stop working`
|
|
64426
|
+
] : [],
|
|
64217
64427
|
...deployNextSteps(deployed, {
|
|
64218
64428
|
file: path2,
|
|
64219
64429
|
env: v.env,
|
|
@@ -64229,7 +64439,9 @@ async function main() {
|
|
|
64229
64439
|
else if (smoke.some((r) => r.status !== "passed")) exitCode = 4;
|
|
64230
64440
|
} else if (command === "deploy rollback") {
|
|
64231
64441
|
if (v["based-on"] !== void 0 && v["based-on"] !== "none" && !/^[0-9a-f-]{36}$/.test(v["based-on"]))
|
|
64232
|
-
usage2(
|
|
64442
|
+
usage2(
|
|
64443
|
+
"--based-on takes the basedOn deploy ID from a rollback plan, or none."
|
|
64444
|
+
);
|
|
64233
64445
|
const deployed = await api(`deploys/${id3(v.id)}/rollback`, {
|
|
64234
64446
|
method: "POST",
|
|
64235
64447
|
body: {
|
|
@@ -64241,7 +64453,13 @@ async function main() {
|
|
|
64241
64453
|
result2 = {
|
|
64242
64454
|
event: deployed.dryRun ? "planned" : deployed.applied ? "rolled_back" : "rejected",
|
|
64243
64455
|
...deployed,
|
|
64244
|
-
next: deployed.ok ? deployed.dryRun ? [
|
|
64456
|
+
next: deployed.ok ? deployed.dryRun ? [
|
|
64457
|
+
`waitcher deploy rollback --id ${v.id} --based-on ${deployed.basedOn ?? "none"}`
|
|
64458
|
+
] : [
|
|
64459
|
+
"The repository still holds the newer configuration; revert it there before the next deploy apply."
|
|
64460
|
+
] : [
|
|
64461
|
+
"Fix the issues (often a missing secret or a changed account limit) and plan the rollback again."
|
|
64462
|
+
]
|
|
64245
64463
|
};
|
|
64246
64464
|
if (!deployed.ok) exitCode = 2;
|
|
64247
64465
|
} else if (command.startsWith("secret ")) {
|
|
@@ -64250,13 +64468,18 @@ async function main() {
|
|
|
64250
64468
|
const { config: config2 } = await readProjectConfig(v.file);
|
|
64251
64469
|
const project = config2?.project;
|
|
64252
64470
|
if (typeof project !== "string")
|
|
64253
|
-
usage2(
|
|
64471
|
+
usage2(
|
|
64472
|
+
"waitcher.json needs a project name; run waitcher config validate."
|
|
64473
|
+
);
|
|
64254
64474
|
if (command === "secret list")
|
|
64255
64475
|
result2 = await api(
|
|
64256
64476
|
`secrets?project=${encodeURIComponent(project)}&environment=${encodeURIComponent(v.env)}`
|
|
64257
64477
|
);
|
|
64258
64478
|
else if (command === "secret delete") {
|
|
64259
|
-
if (!v.yes)
|
|
64479
|
+
if (!v.yes)
|
|
64480
|
+
usage2(
|
|
64481
|
+
"Pass --yes to delete this secret; scripts using it will fail."
|
|
64482
|
+
);
|
|
64260
64483
|
result2 = await api("secrets", {
|
|
64261
64484
|
method: "DELETE",
|
|
64262
64485
|
body: { project, environment: v.env, name: v.name }
|
|
@@ -64425,7 +64648,21 @@ async function main() {
|
|
|
64425
64648
|
} else if (command === "system diagnostics")
|
|
64426
64649
|
result2 = await api("system/diagnostics");
|
|
64427
64650
|
else if (command === "system plans") result2 = await api("system/plans");
|
|
64428
|
-
else if (command === "
|
|
64651
|
+
else if (command === "account billing") result2 = await api("billing");
|
|
64652
|
+
else if (command === "account upgrade" || command === "account billing-portal") {
|
|
64653
|
+
const { url: url3 } = await api(
|
|
64654
|
+
command === "account upgrade" ? "billing/checkout" : "billing/portal",
|
|
64655
|
+
{ method: "POST", body: {} }
|
|
64656
|
+
);
|
|
64657
|
+
result2 = {
|
|
64658
|
+
event: command === "account upgrade" ? "checkout_created" : "portal_created",
|
|
64659
|
+
url: url3,
|
|
64660
|
+
next: [
|
|
64661
|
+
command === "account upgrade" ? "Open the URL in a browser and pay there; the plan changes when Stripe confirms the payment" : "Open the URL in a browser to change or cancel the subscription",
|
|
64662
|
+
"waitcher account billing"
|
|
64663
|
+
]
|
|
64664
|
+
};
|
|
64665
|
+
} else if (command === "system plan") {
|
|
64429
64666
|
const owner = String(v.owner ?? ""), plan = String(v.plan ?? "");
|
|
64430
64667
|
if (!/^clerk:user_[A-Za-z0-9]{8,64}$/.test(owner))
|
|
64431
64668
|
usage2("--owner must be an account owner like clerk:user_ID");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waitcher/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API and browser monitors from waitcher.json.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Sławomir Radzymiński",
|