@jevitate/cli 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/dist/ai-cli.d.ts +31 -11
- package/dist/ai-cli.js +131 -88
- package/dist/ai-cli.js.map +1 -1
- package/dist/author-journey-cli.d.ts +4 -0
- package/dist/author-journey-cli.js +111 -0
- package/dist/author-journey-cli.js.map +1 -0
- package/dist/bin.js +60349 -16477
- package/dist/bin.js.map +1 -1
- package/dist/browser-run-options.d.ts +89 -0
- package/dist/browser-run-options.js +175 -0
- package/dist/browser-run-options.js.map +1 -0
- package/dist/build-info.generated.d.ts +2 -0
- package/dist/build-info.generated.js +10 -0
- package/dist/build-info.generated.js.map +1 -0
- package/dist/campaign-api.d.ts +151 -0
- package/dist/campaign-api.js +446 -0
- package/dist/campaign-api.js.map +1 -0
- package/dist/campaign-cli.d.ts +6 -0
- package/dist/campaign-cli.js +66 -0
- package/dist/campaign-cli.js.map +1 -0
- package/dist/check-api.d.ts +5 -0
- package/dist/check-api.js +234 -0
- package/dist/check-api.js.map +1 -0
- package/dist/check-budget.d.ts +26 -0
- package/dist/check-budget.js +90 -0
- package/dist/check-budget.js.map +1 -0
- package/dist/check-cli.d.ts +31 -0
- package/dist/check-cli.js +109 -0
- package/dist/check-cli.js.map +1 -0
- package/dist/check-execute.d.ts +29 -0
- package/dist/check-execute.js +420 -0
- package/dist/check-execute.js.map +1 -0
- package/dist/check-plan.d.ts +118 -0
- package/dist/check-plan.js +516 -0
- package/dist/check-plan.js.map +1 -0
- package/dist/check-suite.d.ts +184 -0
- package/dist/check-suite.js +540 -0
- package/dist/check-suite.js.map +1 -0
- package/dist/check-types.d.ts +181 -0
- package/dist/check-types.js +35 -0
- package/dist/check-types.js.map +1 -0
- package/dist/cli-args.d.ts +26 -0
- package/dist/cli-args.js +50 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli-output.d.ts +106 -0
- package/dist/cli-output.js +563 -0
- package/dist/cli-output.js.map +1 -0
- package/dist/cli-reference.d.ts +3 -0
- package/dist/cli-reference.js +81 -0
- package/dist/cli-reference.js.map +1 -0
- package/dist/cli-refusal.d.ts +12 -0
- package/dist/cli-refusal.js +52 -0
- package/dist/cli-refusal.js.map +1 -0
- package/dist/cli-shared.d.ts +340 -0
- package/dist/cli-shared.js +537 -0
- package/dist/cli-shared.js.map +1 -0
- package/dist/cli-surface.d.ts +33 -0
- package/dist/cli-surface.js +48 -0
- package/dist/cli-surface.js.map +1 -0
- package/dist/conversation-options.d.ts +15 -0
- package/dist/conversation-options.js +10 -0
- package/dist/conversation-options.js.map +1 -0
- package/dist/credentials-file.d.ts +15 -0
- package/dist/credentials-file.js +56 -0
- package/dist/credentials-file.js.map +1 -0
- package/dist/data-dir.d.ts +1 -1
- package/dist/data-dir.js +1 -1
- package/dist/defect-evidence.d.ts +141 -0
- package/dist/defect-evidence.js +505 -0
- package/dist/defect-evidence.js.map +1 -0
- package/dist/demo-aspect-api.d.ts +209 -0
- package/dist/demo-aspect-api.js +398 -0
- package/dist/demo-aspect-api.js.map +1 -0
- package/dist/demo-aspect-cli.d.ts +3 -0
- package/dist/demo-aspect-cli.js +243 -0
- package/dist/demo-aspect-cli.js.map +1 -0
- package/dist/demo-capture.d.ts +142 -0
- package/dist/demo-capture.js +537 -0
- package/dist/demo-capture.js.map +1 -0
- package/dist/engine.d.ts +35 -0
- package/dist/engine.js +25 -0
- package/dist/engine.js.map +1 -0
- package/dist/environments.d.ts +155 -0
- package/dist/environments.js +364 -0
- package/dist/environments.js.map +1 -0
- package/dist/exit-codes.d.ts +46 -0
- package/dist/exit-codes.js +91 -0
- package/dist/exit-codes.js.map +1 -0
- package/dist/explore-adversarial.d.ts +144 -0
- package/dist/explore-adversarial.js +227 -0
- package/dist/explore-adversarial.js.map +1 -0
- package/dist/explore-api.d.ts +7 -187
- package/dist/explore-api.js +7 -301
- package/dist/explore-api.js.map +1 -1
- package/dist/explore-author.d.ts +79 -0
- package/dist/explore-author.js +86 -0
- package/dist/explore-author.js.map +1 -0
- package/dist/explore-cli.d.ts +7 -0
- package/dist/explore-cli.js +1199 -0
- package/dist/explore-cli.js.map +1 -0
- package/dist/explore-coverage.d.ts +173 -0
- package/dist/explore-coverage.js +246 -0
- package/dist/explore-coverage.js.map +1 -0
- package/dist/explore-feature.d.ts +125 -0
- package/dist/explore-feature.js +218 -0
- package/dist/explore-feature.js.map +1 -0
- package/dist/explore-goal.d.ts +271 -0
- package/dist/explore-goal.js +417 -0
- package/dist/explore-goal.js.map +1 -0
- package/dist/explore-shared.d.ts +177 -0
- package/dist/explore-shared.js +149 -0
- package/dist/explore-shared.js.map +1 -0
- package/dist/explore-specs.d.ts +53 -0
- package/dist/explore-specs.js +333 -0
- package/dist/explore-specs.js.map +1 -0
- package/dist/findings-filing.d.ts +64 -0
- package/dist/findings-filing.js +108 -0
- package/dist/findings-filing.js.map +1 -0
- package/dist/fixture-auth.d.ts +63 -0
- package/dist/fixture-auth.js +95 -0
- package/dist/fixture-auth.js.map +1 -0
- package/dist/fixture-cli.d.ts +99 -0
- package/dist/fixture-cli.js +292 -0
- package/dist/fixture-cli.js.map +1 -0
- package/dist/github-issue-filer.d.ts +62 -0
- package/dist/github-issue-filer.js +189 -0
- package/dist/github-issue-filer.js.map +1 -0
- package/dist/host-health-run.d.ts +25 -0
- package/dist/host-health-run.js +33 -0
- package/dist/host-health-run.js.map +1 -0
- package/dist/http-5xx-outcome.d.ts +6 -0
- package/dist/http-5xx-outcome.js +39 -0
- package/dist/http-5xx-outcome.js.map +1 -0
- package/dist/inbox-cli.d.ts +7 -0
- package/dist/inbox-cli.js +197 -0
- package/dist/inbox-cli.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/init-cli.d.ts +4 -0
- package/dist/init-cli.js +156 -0
- package/dist/init-cli.js.map +1 -0
- package/dist/init-keys.d.ts +30 -2
- package/dist/init-keys.js +19 -5
- package/dist/init-keys.js.map +1 -1
- package/dist/init-next-steps.d.ts +35 -0
- package/dist/init-next-steps.js +79 -0
- package/dist/init-next-steps.js.map +1 -0
- package/dist/invariants-file.d.ts +34 -0
- package/dist/invariants-file.js +68 -0
- package/dist/invariants-file.js.map +1 -0
- package/dist/invariants-validate.d.ts +30 -0
- package/dist/invariants-validate.js +105 -0
- package/dist/invariants-validate.js.map +1 -0
- package/dist/journey-annotate-api.d.ts +76 -0
- package/dist/journey-annotate-api.js +269 -0
- package/dist/journey-annotate-api.js.map +1 -0
- package/dist/journey-annotate-cli.d.ts +9 -0
- package/dist/journey-annotate-cli.js +181 -0
- package/dist/journey-annotate-cli.js.map +1 -0
- package/dist/journey-api.d.ts +104 -2
- package/dist/journey-api.js +163 -20
- package/dist/journey-api.js.map +1 -1
- package/dist/journey-cli.d.ts +4 -0
- package/dist/journey-cli.js +411 -0
- package/dist/journey-cli.js.map +1 -0
- package/dist/journey-demo-api.d.ts +114 -0
- package/dist/journey-demo-api.js +405 -0
- package/dist/journey-demo-api.js.map +1 -0
- package/dist/journey-demo-cli.d.ts +10 -0
- package/dist/journey-demo-cli.js +158 -0
- package/dist/journey-demo-cli.js.map +1 -0
- package/dist/journey-prefix.d.ts +194 -0
- package/dist/journey-prefix.js +279 -0
- package/dist/journey-prefix.js.map +1 -0
- package/dist/key-report.d.ts +49 -0
- package/dist/key-report.js +101 -0
- package/dist/key-report.js.map +1 -0
- package/dist/kill-signal.d.ts +193 -0
- package/dist/kill-signal.js +283 -0
- package/dist/kill-signal.js.map +1 -0
- package/dist/launch-armed.d.ts +37 -0
- package/dist/launch-armed.js +31 -0
- package/dist/launch-armed.js.map +1 -0
- package/dist/ledger-api.d.ts +106 -0
- package/dist/ledger-api.js +239 -0
- package/dist/ledger-api.js.map +1 -0
- package/dist/ledger-cli.d.ts +18 -0
- package/dist/ledger-cli.js +107 -0
- package/dist/ledger-cli.js.map +1 -0
- package/dist/load-api.d.ts +29 -11
- package/dist/load-api.js +23 -15
- package/dist/load-api.js.map +1 -1
- package/dist/load-cli.d.ts +4 -0
- package/dist/load-cli.js +97 -0
- package/dist/load-cli.js.map +1 -0
- package/dist/log-correlation.d.ts +200 -0
- package/dist/log-correlation.js +394 -0
- package/dist/log-correlation.js.map +1 -0
- package/dist/log-lines.d.ts +131 -0
- package/dist/log-lines.js +389 -0
- package/dist/log-lines.js.map +1 -0
- package/dist/log-sources.d.ts +71 -0
- package/dist/log-sources.js +236 -0
- package/dist/log-sources.js.map +1 -0
- package/dist/log-trace.d.ts +80 -0
- package/dist/log-trace.js +210 -0
- package/dist/log-trace.js.map +1 -0
- package/dist/logs-cli.d.ts +3 -0
- package/dist/logs-cli.js +51 -0
- package/dist/logs-cli.js.map +1 -0
- package/dist/logs-retention.d.ts +28 -0
- package/dist/logs-retention.js +85 -0
- package/dist/logs-retention.js.map +1 -0
- package/dist/masked-input.d.ts +22 -0
- package/dist/masked-input.js +99 -0
- package/dist/masked-input.js.map +1 -0
- package/dist/mcp-api.d.ts +91 -1
- package/dist/mcp-api.js +514 -18
- package/dist/mcp-api.js.map +1 -1
- package/dist/mcp-args.d.ts +50 -0
- package/dist/mcp-args.js +164 -0
- package/dist/mcp-args.js.map +1 -0
- package/dist/mcp-cli-bridge.d.ts +34 -0
- package/dist/mcp-cli-bridge.js +62 -0
- package/dist/mcp-cli-bridge.js.map +1 -0
- package/dist/mcp-cli-runner.d.ts +29 -0
- package/dist/mcp-cli-runner.js +44 -0
- package/dist/mcp-cli-runner.js.map +1 -0
- package/dist/mcp-cli-tools.d.ts +129 -0
- package/dist/mcp-cli-tools.js +737 -0
- package/dist/mcp-cli-tools.js.map +1 -0
- package/dist/mcp-paths.d.ts +28 -0
- package/dist/mcp-paths.js +76 -0
- package/dist/mcp-paths.js.map +1 -0
- package/dist/mission-actors.d.ts +40 -0
- package/dist/mission-actors.js +72 -0
- package/dist/mission-actors.js.map +1 -0
- package/dist/mission-api.d.ts +35 -0
- package/dist/mission-api.js +60 -3
- package/dist/mission-api.js.map +1 -1
- package/dist/mission-cli.d.ts +4 -0
- package/dist/mission-cli.js +248 -0
- package/dist/mission-cli.js.map +1 -0
- package/dist/mission-exit.d.ts +22 -0
- package/dist/mission-exit.js +26 -0
- package/dist/mission-exit.js.map +1 -0
- package/dist/mission-fixtures.d.ts +234 -0
- package/dist/mission-fixtures.js +862 -0
- package/dist/mission-fixtures.js.map +1 -0
- package/dist/mission-journal.d.ts +60 -0
- package/dist/mission-journal.js +115 -0
- package/dist/mission-journal.js.map +1 -0
- package/dist/mission-queue-cli.d.ts +10 -0
- package/dist/mission-queue-cli.js +198 -0
- package/dist/mission-queue-cli.js.map +1 -0
- package/dist/mission-queue-runner.d.ts +126 -0
- package/dist/mission-queue-runner.js +406 -0
- package/dist/mission-queue-runner.js.map +1 -0
- package/dist/multi-run-cli.d.ts +37 -0
- package/dist/multi-run-cli.js +116 -0
- package/dist/multi-run-cli.js.map +1 -0
- package/dist/multi-run.d.ts +339 -0
- package/dist/multi-run.js +619 -0
- package/dist/multi-run.js.map +1 -0
- package/dist/openrouter-call.d.ts +22 -0
- package/dist/openrouter-call.js +64 -0
- package/dist/openrouter-call.js.map +1 -0
- package/dist/profile-cli.d.ts +4 -0
- package/dist/profile-cli.js +57 -0
- package/dist/profile-cli.js.map +1 -0
- package/dist/program.d.ts +3 -75
- package/dist/program.js +123 -1921
- package/dist/program.js.map +1 -1
- package/dist/project-dir.d.ts +96 -0
- package/dist/project-dir.js +221 -0
- package/dist/project-dir.js.map +1 -0
- package/dist/record-api.d.ts +13 -7
- package/dist/record-api.js +44 -30
- package/dist/record-api.js.map +1 -1
- package/dist/record-cli.d.ts +4 -0
- package/dist/record-cli.js +76 -0
- package/dist/record-cli.js.map +1 -0
- package/dist/recording-cli.d.ts +4 -0
- package/dist/recording-cli.js +248 -0
- package/dist/recording-cli.js.map +1 -0
- package/dist/regression-api.d.ts +107 -0
- package/dist/regression-api.js +387 -6
- package/dist/regression-api.js.map +1 -1
- package/dist/regression-cli.d.ts +4 -0
- package/dist/regression-cli.js +284 -0
- package/dist/regression-cli.js.map +1 -0
- package/dist/report-api.d.ts +146 -0
- package/dist/report-api.js +431 -0
- package/dist/report-api.js.map +1 -0
- package/dist/report-cli.d.ts +12 -0
- package/dist/report-cli.js +147 -0
- package/dist/report-cli.js.map +1 -0
- package/dist/resource-preflight.d.ts +87 -0
- package/dist/resource-preflight.js +160 -0
- package/dist/resource-preflight.js.map +1 -0
- package/dist/result-schema.d.ts +22 -0
- package/dist/result-schema.js +28 -0
- package/dist/result-schema.js.map +1 -0
- package/dist/run-index.d.ts +29 -0
- package/dist/run-index.js +70 -0
- package/dist/run-index.js.map +1 -0
- package/dist/run-key-preflight.d.ts +42 -0
- package/dist/run-key-preflight.js +82 -0
- package/dist/run-key-preflight.js.map +1 -0
- package/dist/run-screenshots.d.ts +123 -0
- package/dist/run-screenshots.js +235 -0
- package/dist/run-screenshots.js.map +1 -0
- package/dist/runtime-env.d.ts +8 -0
- package/dist/runtime-env.js +23 -0
- package/dist/runtime-env.js.map +1 -0
- package/dist/secret-args.d.ts +23 -0
- package/dist/secret-args.js +45 -0
- package/dist/secret-args.js.map +1 -0
- package/dist/serve-cli.d.ts +4 -0
- package/dist/serve-cli.js +95 -0
- package/dist/serve-cli.js.map +1 -0
- package/dist/server-log-verify.d.ts +36 -0
- package/dist/server-log-verify.js +120 -0
- package/dist/server-log-verify.js.map +1 -0
- package/dist/session-check.d.ts +14 -0
- package/dist/session-check.js +44 -0
- package/dist/session-check.js.map +1 -0
- package/dist/site-cli.d.ts +4 -0
- package/dist/site-cli.js +127 -0
- package/dist/site-cli.js.map +1 -0
- package/dist/site-gate-cli.d.ts +28 -0
- package/dist/site-gate-cli.js +59 -0
- package/dist/site-gate-cli.js.map +1 -0
- package/dist/source-api.js +20 -4
- package/dist/source-api.js.map +1 -1
- package/dist/source-cli.d.ts +4 -0
- package/dist/source-cli.js +284 -0
- package/dist/source-cli.js.map +1 -0
- package/dist/source-run-api.d.ts +27 -1
- package/dist/source-run-api.js +22 -11
- package/dist/source-run-api.js.map +1 -1
- package/dist/storage-state-snapshot.d.ts +50 -0
- package/dist/storage-state-snapshot.js +87 -0
- package/dist/storage-state-snapshot.js.map +1 -0
- package/dist/suite-explore-options.d.ts +321 -0
- package/dist/suite-explore-options.js +162 -0
- package/dist/suite-explore-options.js.map +1 -0
- package/dist/target-config.d.ts +115 -0
- package/dist/target-config.js +225 -0
- package/dist/target-config.js.map +1 -0
- package/dist/transcript-file.d.ts +12 -0
- package/dist/transcript-file.js +23 -0
- package/dist/transcript-file.js.map +1 -0
- package/dist/type-fixture-file.d.ts +9 -0
- package/dist/type-fixture-file.js +48 -0
- package/dist/type-fixture-file.js.map +1 -0
- package/dist/ui-api.d.ts +3 -0
- package/dist/ui-api.js +11 -4
- package/dist/ui-api.js.map +1 -1
- package/dist/usability-capture.d.ts +43 -0
- package/dist/usability-capture.js +327 -0
- package/dist/usability-capture.js.map +1 -0
- package/dist/usage-config.d.ts +36 -0
- package/dist/usage-config.js +114 -0
- package/dist/usage-config.js.map +1 -0
- package/dist/ux-api.d.ts +3 -75
- package/dist/ux-api.js +3 -220
- package/dist/ux-api.js.map +1 -1
- package/dist/ux-claim-probe.d.ts +45 -0
- package/dist/ux-claim-probe.js +386 -0
- package/dist/ux-claim-probe.js.map +1 -0
- package/dist/ux-cli.d.ts +4 -0
- package/dist/ux-cli.js +109 -0
- package/dist/ux-cli.js.map +1 -0
- package/dist/ux-config.d.ts +29 -0
- package/dist/ux-config.js +103 -0
- package/dist/ux-config.js.map +1 -0
- package/dist/ux-evidence.d.ts +54 -0
- package/dist/ux-evidence.js +197 -0
- package/dist/ux-evidence.js.map +1 -0
- package/dist/ux-product.d.ts +14 -0
- package/dist/ux-product.js +39 -0
- package/dist/ux-product.js.map +1 -0
- package/dist/ux-review.d.ts +116 -0
- package/dist/ux-review.js +171 -0
- package/dist/ux-review.js.map +1 -0
- package/dist/ux-usability.d.ts +263 -0
- package/dist/ux-usability.js +580 -0
- package/dist/ux-usability.js.map +1 -0
- package/dist/verify-fix-api.d.ts +194 -0
- package/dist/verify-fix-api.js +506 -0
- package/dist/verify-fix-api.js.map +1 -0
- package/dist/verify-fix-cli.d.ts +4 -0
- package/dist/verify-fix-cli.js +115 -0
- package/dist/verify-fix-cli.js.map +1 -0
- package/package.json +23 -18
- package/skills/jevitate-ci-check/SKILL.md +77 -0
- package/skills/jevitate-demo/SKILL.md +61 -0
- package/skills/jevitate-explore/SKILL.md +96 -87
- package/skills/jevitate-getting-started/SKILL.md +89 -0
- package/skills/jevitate-load-test/SKILL.md +11 -2
- package/skills/jevitate-mission-scope/SKILL.md +19 -11
- package/skills/jevitate-record/SKILL.md +23 -5
- package/skills/jevitate-run-journey/SKILL.md +61 -17
- package/skills/jevitate-sources/SKILL.md +57 -14
- package/skills/jevitate-test-campaign/SKILL.md +203 -0
- package/skills/jevitate-ux-review/SKILL.md +106 -16
- package/skills/jevitate-verify-fix/SKILL.md +76 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers shared by the per-command-group CLI modules (`*-cli.ts`) that `program.ts` wires together
|
|
3
|
+
* (#231): deps and path resolution, JSON/human output, browser/emulation flags, AI gateway selection.
|
|
4
|
+
*/
|
|
5
|
+
import { mkdir } from "node:fs/promises";
|
|
6
|
+
import { dirname, resolve as resolvePath } from "node:path";
|
|
7
|
+
import { userInfo } from "node:os";
|
|
8
|
+
import { InvalidArgumentError } from "commander";
|
|
9
|
+
import { clock } from "@jevitate/domain";
|
|
10
|
+
import { openDatabase, migrateToLatest, SqliteSitePolicyRepository } from "@jevitate/storage-sqlite";
|
|
11
|
+
import { envCredentialStore, requireKeys, FakeGenerationGateway, OpenRouterGenerationGateway, RetryingGenerationPort, RetryingJudgmentPort, JevJudgmentGateway, realJevClientCall, UsageTracker, FAKE_CALL_USAGE, formatUsageLine, usageCountsFrom, } from "@jevitate/ai-core";
|
|
12
|
+
import { loadLocalCredentials } from "./credentials-file.js";
|
|
13
|
+
import { PlaywrightBrowserPort, readUnpackedExtension } from "@jevitate/playwright";
|
|
14
|
+
import { realVerifyFetch } from "./key-report.js";
|
|
15
|
+
import { preflightRunKeys } from "./run-key-preflight.js";
|
|
16
|
+
import { CastActor, BrowseTheWeb } from "@jevitate/screenplay";
|
|
17
|
+
import { UnsafeNameError, assertSafeName } from "@jevitate/domain";
|
|
18
|
+
import { fail } from "./envelope.js";
|
|
19
|
+
import { projectDataDir } from "./project-dir.js";
|
|
20
|
+
import { resolveUsagePricing } from "./usage-config.js";
|
|
21
|
+
import { realOpenRouterCall } from "./openrouter-call.js";
|
|
22
|
+
import { emitJsonOrRefusal } from "./cli-refusal.js";
|
|
23
|
+
import { emitEnvelope } from "./cli-output.js";
|
|
24
|
+
import { resolveDataDir } from "./data-dir.js";
|
|
25
|
+
import { FsTrustStore, FsAckStore, DEFAULT_LOCK_PATH } from "@jevitate/sources";
|
|
26
|
+
import { parseViewport, resolveEmulation } from "@jevitate/playwright";
|
|
27
|
+
import { nonNegativeIntArg, positiveIntArg } from "./cli-args.js";
|
|
28
|
+
import { resourceLimitsFromFlags, withResourcePreflight } from "./resource-preflight.js";
|
|
29
|
+
import { HEADED_DEFAULT_SLOW_MO_MS, assertHeadedDisplay, headedFromEnv, sessionLaunchOptions } from "./browser-run-options.js";
|
|
30
|
+
// `~/.jevitate/*` is the product's runtime-data convention (product = Jevitate).
|
|
31
|
+
// See data-dir.ts.
|
|
32
|
+
export const DEFAULT_DB_PATH = resolveDataDir(["db.sqlite"]);
|
|
33
|
+
export const DEFAULT_MISSION_TARGETS_DIR = resolveDataDir(["missions", "targets"]);
|
|
34
|
+
export const DEFAULT_INBOX_DIR = resolveDataDir(["inbox"]);
|
|
35
|
+
export function resolveDbPath(deps, flag) {
|
|
36
|
+
return flag ?? deps.dbPath ?? DEFAULT_DB_PATH;
|
|
37
|
+
}
|
|
38
|
+
/** #247: where `--env` reads environments and per-origin sessions from (test seams; real defaults). */
|
|
39
|
+
export function environmentSeams(deps) {
|
|
40
|
+
return {
|
|
41
|
+
...(deps.environmentsFile === undefined ? {} : { environmentsFile: deps.environmentsFile }),
|
|
42
|
+
...(deps.explore?.targetsConfigPath === undefined ? {} : { targetsFile: deps.explore.targetsConfigPath }),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Mirrors `resolveDbPath`'s flag > deps > home-dir-default convention: a
|
|
47
|
+
* per-invocation `--dir` flag wins, then a `CliDeps.journeysDir` wired in by
|
|
48
|
+
* the host, then `~/.jevitate/journeys`.
|
|
49
|
+
*/
|
|
50
|
+
export function resolveJourneysDir(deps, flag) {
|
|
51
|
+
return flag ?? deps.journeysDir ?? projectDataDir(["journeys"]);
|
|
52
|
+
}
|
|
53
|
+
/** Same flag > home-dir-default convention as `resolveJourneysDir`, for the
|
|
54
|
+
* committed-regressions directory `regression capture` writes into. */
|
|
55
|
+
export function resolveRegressionsDir(flag) {
|
|
56
|
+
return flag ?? projectDataDir(["regressions"]);
|
|
57
|
+
}
|
|
58
|
+
/** Same flag > deps > home-dir-default convention as `resolveJourneysDir`, for
|
|
59
|
+
* the mission-targets store `mission target ...` reads/writes. */
|
|
60
|
+
export function resolveMissionTargetsDir(deps, flag) {
|
|
61
|
+
return flag ?? deps.missionTargetsDir ?? DEFAULT_MISSION_TARGETS_DIR;
|
|
62
|
+
}
|
|
63
|
+
/** Same flag > deps > home-dir-default convention as `resolveJourneysDir`, for
|
|
64
|
+
* the inbox store `jevitate mcp`'s inbox tools AND `jevitate ui` both read
|
|
65
|
+
* from — the SAME resolved directory, so the two commands agree on where
|
|
66
|
+
* approvals/handbacks/reviews live. */
|
|
67
|
+
export function resolveInboxDir(deps, flag) {
|
|
68
|
+
return flag ?? deps.inboxDir ?? DEFAULT_INBOX_DIR;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Assembles the injected `SourceApiDeps` for the distributed-sources commands
|
|
72
|
+
* from `CliDeps.sources` (test-injected ports) or the real production
|
|
73
|
+
* defaults: `~/.jevitate/sources` clones, `<cwd>/jevitate.lock`, and the
|
|
74
|
+
* local, per-user `FsTrustStore`/`FsAckStore` under `~/.jevitate/trust`.
|
|
75
|
+
* Trust/ack stores are LOCAL by design (§14.1) — never the team-shared lock.
|
|
76
|
+
*/
|
|
77
|
+
export function resolveSourceApiDeps(deps) {
|
|
78
|
+
const s = deps.sources ?? {};
|
|
79
|
+
return {
|
|
80
|
+
sourcesDir: s.sourcesDir ?? resolveDataDir(["sources"]),
|
|
81
|
+
lockPath: s.lockPath ?? DEFAULT_LOCK_PATH(),
|
|
82
|
+
trust: new FsTrustStore(s.trustDir ?? resolveDataDir(["trust"])),
|
|
83
|
+
ack: new FsAckStore(s.ackDir ?? resolveDataDir(["trust", "acks"])),
|
|
84
|
+
git: s.git,
|
|
85
|
+
now: s.now,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** The identity recorded in a `TrustRecord`/`TouAck` — an injected value, else
|
|
89
|
+
* the OS username, else `"local"`. Never a secret/credential. */
|
|
90
|
+
export function resolveApprovedBy(deps) {
|
|
91
|
+
if (deps.sources?.approvedBy)
|
|
92
|
+
return deps.sources.approvedBy;
|
|
93
|
+
try {
|
|
94
|
+
return userInfo().username || "local";
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return "local";
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Builds a fresh, real Playwright-backed `Actor` (its own temp profile dir +
|
|
102
|
+
* browser context, per `journey-api.ts`'s `runJourneyProgrammatically`
|
|
103
|
+
* pattern) and returns it alongside a `close()` to tear the session down.
|
|
104
|
+
* `@jevitate/regression`'s `makeActor: () => Promise<Actor>` contract calls
|
|
105
|
+
* this once per reproduce/minimize attempt — a Playwright session cannot be
|
|
106
|
+
* reused after a run — so callers must close each one it hands back.
|
|
107
|
+
*/
|
|
108
|
+
export async function makeRealBrowserActor(site, storageState, emulation, browser, portFactory = () => new PlaywrightBrowserPort(),
|
|
109
|
+
/** #247: an environment's allowed origins (default: just `site`). */
|
|
110
|
+
allowedOrigins = [site]) {
|
|
111
|
+
const port = portFactory();
|
|
112
|
+
const session = await port.open({
|
|
113
|
+
...sessionLaunchOptions(browser),
|
|
114
|
+
allowedOrigins: [...allowedOrigins],
|
|
115
|
+
baseUrl: site,
|
|
116
|
+
...emulation,
|
|
117
|
+
...(storageState !== undefined ? { storageState } : {}),
|
|
118
|
+
});
|
|
119
|
+
const actor = CastActor.named("regression-capture").whoCan(new BrowseTheWeb(session, [...allowedOrigins]));
|
|
120
|
+
return {
|
|
121
|
+
actor,
|
|
122
|
+
close: () => session.close(),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* #256: the `--extension <dir>` argParser — reads and checks the unpacked extension NOW (a directory
|
|
127
|
+
* with a valid manifest.json), so a bad directory is a usage error (exit 64) on every command before
|
|
128
|
+
* anything runs. The same directory twice is kept once; two directories with one id are refused.
|
|
129
|
+
*/
|
|
130
|
+
export function extensionArg(value, prev) {
|
|
131
|
+
const before = prev ?? [];
|
|
132
|
+
let ext;
|
|
133
|
+
try {
|
|
134
|
+
ext = readUnpackedExtension(value);
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
throw new InvalidArgumentError(err instanceof Error ? err.message : String(err));
|
|
138
|
+
}
|
|
139
|
+
const dup = before.find((e) => e.id === ext.id);
|
|
140
|
+
if (dup === undefined)
|
|
141
|
+
return [...before, ext];
|
|
142
|
+
if (dup.dir === ext.dir)
|
|
143
|
+
return [...before];
|
|
144
|
+
throw new InvalidArgumentError(`two extension directories have the same extension id ${ext.id}: ${dup.dir} and ${ext.dir}`);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Adds the shared Chromium launch flags to a browser-driving command. They map
|
|
148
|
+
* 1:1 onto `@jevitate/playwright`'s `BrowserLaunchOptions`; `--browser-arg`
|
|
149
|
+
* EXTENDS the Linux defaults (`--no-sandbox`, `--disable-dev-shm-usage`).
|
|
150
|
+
*/
|
|
151
|
+
export function withBrowserLaunchFlags(cmd) {
|
|
152
|
+
// #205: resource governance — the run's limits, and the pre-run checks (orphan sweep, starved-host refusal).
|
|
153
|
+
return withResourcePreflight(cmd)
|
|
154
|
+
.option("--max-browsers <n>", "machine-wide cap on jevitate runs with a browser open at once, shared by every jevitate on this machine (default: JEVITATE_MAX_BROWSERS, else cores/4 within 2..6; halved while the host is loaded)", positiveIntArg)
|
|
155
|
+
.option("--max-browser-memory <MiB>", "memory ceiling of this run's browsers (browser + renderers); over it the run ends inconclusive with failure kind resource-limit (default: JEVITATE_MAX_BROWSER_MEMORY_MB, else 4096 or half the RAM)", positiveIntArg)
|
|
156
|
+
.option("--ignore-host-load", "start even when the host is starved (load >= 4/core or < 512 MiB free) instead of refusing with E_HOST_STARVED; the run is throttled and its result records it")
|
|
157
|
+
.option("--browser-executable <path>", "launch this Chromium binary instead of Playwright's pinned one")
|
|
158
|
+
.option("--browser-channel <name>", "Playwright browser channel to launch, e.g. chrome | msedge")
|
|
159
|
+
.option("--browser-arg <arg>", "extra Chromium switch (repeatable); extends the Linux defaults --no-sandbox --disable-dev-shm-usage", (v, prev) => [...prev, v], [])
|
|
160
|
+
.option("--extension <dir>", "load this unpacked browser extension (repeatable; a directory with manifest.json). Its chrome-extension://<id> pages are allowed and navigable, e.g. --url chrome-extension://<id>/sidepanel.html; headless uses Chromium's new headless", extensionArg, []);
|
|
161
|
+
}
|
|
162
|
+
/** The `BrowserLaunchOptions` for the parsed flags, or `undefined` when none were given. */
|
|
163
|
+
export function browserLaunchFromFlags(o) {
|
|
164
|
+
const launch = {
|
|
165
|
+
...(o.browserExecutable !== undefined ? { executablePath: o.browserExecutable } : {}),
|
|
166
|
+
...(o.browserChannel !== undefined ? { channel: o.browserChannel } : {}),
|
|
167
|
+
...(o.browserArg.length > 0 ? { args: [...o.browserArg] } : {}),
|
|
168
|
+
...(o.extension !== undefined && o.extension.length > 0 ? { extensions: [...o.extension] } : {}),
|
|
169
|
+
};
|
|
170
|
+
const resources = resourceLimitsFromFlags(o);
|
|
171
|
+
if (resources !== undefined)
|
|
172
|
+
launch.resources = resources;
|
|
173
|
+
return Object.keys(launch).length > 0 ? launch : undefined;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Adds the demo-mode flags (#245) to a browser-driving command. Headless stays the default; these
|
|
177
|
+
* are all opt-in and resolved by `browserRunFromFlags` (which also reads `JEVITATE_HEADED`).
|
|
178
|
+
*/
|
|
179
|
+
export function withDemoFlags(cmd, set = {}) {
|
|
180
|
+
cmd
|
|
181
|
+
.option("--headed", `show the browser window (demo mode); also JEVITATE_HEADED=1. Default: headless. Needs a display${set.recordVideo === true ? " — else use --record-video" : ""}`)
|
|
182
|
+
.option("--slow-mo <ms>", `slow every browser operation by this many ms (default ${HEADED_DEFAULT_SLOW_MO_MS} with --headed, else 0)`, nonNegativeIntArg);
|
|
183
|
+
if (set.recordVideo === true) {
|
|
184
|
+
cmd.option("--record-video [dir]", "record a video of each browser context (works headless too); default: next to the run's result; listed as videoPaths");
|
|
185
|
+
}
|
|
186
|
+
if (set.overlay === true)
|
|
187
|
+
cmd.option("--no-overlay", "with --headed: hide the on-page overlay (step, intent, target highlight, outcome banner)");
|
|
188
|
+
return cmd;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* #251: `--screenshots [mode|dir]` — masked screenshots of the run (one per distinct screen, or
|
|
192
|
+
* `steps`: one per step) plus an `index.md` contact sheet; parsed by `parseScreenshotsArg`.
|
|
193
|
+
*/
|
|
194
|
+
export function withScreenshotsFlag(cmd) {
|
|
195
|
+
return cmd.option("--screenshots [mode|dir]", "masked screenshots + index.md: one per distinct screen (default), `steps` one per step; `screens:<dir>`/`steps:<dir>`/`<dir>` set the folder (default: next to the run's result); listed as screenshotPaths");
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The runner's `browser` option for the parsed `--browser-*` and demo flags, or `undefined` when none
|
|
199
|
+
* were given. `--headed` (or `JEVITATE_HEADED=1`) without a display throws `HeadedWithoutDisplayError`
|
|
200
|
+
* HERE — before any browser launches — which every command reports as its usage error (exit 64).
|
|
201
|
+
*/
|
|
202
|
+
export function browserRunFromFlags(o, env = process.env, platform = process.platform) {
|
|
203
|
+
const headed = o.headed === true || headedFromEnv(env);
|
|
204
|
+
assertHeadedDisplay(headed, env, platform);
|
|
205
|
+
const run = {
|
|
206
|
+
...browserLaunchFromFlags(o),
|
|
207
|
+
...(headed ? { headed: true } : {}),
|
|
208
|
+
...(o.slowMo === undefined ? {} : { slowMo: o.slowMo }),
|
|
209
|
+
...(o.recordVideo === undefined || o.recordVideo === false
|
|
210
|
+
? {}
|
|
211
|
+
: { recordVideo: typeof o.recordVideo === "string" ? { dir: resolvePath(o.recordVideo) } : {} }),
|
|
212
|
+
...(o.overlay === false ? { overlay: false } : {}),
|
|
213
|
+
};
|
|
214
|
+
return Object.keys(run).length > 0 ? run : undefined;
|
|
215
|
+
}
|
|
216
|
+
/** `{ browser }` for the parsed `--browser-*` flags, or `{}` when none were given — spread into a runner's options. */
|
|
217
|
+
export function browserOption(o) {
|
|
218
|
+
const launch = browserLaunchFromFlags(o);
|
|
219
|
+
return launch === undefined ? {} : { browser: launch };
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Adds the shared `--viewport <W>x<H>` / `--device "<name>"` flags (#149) to a browser-driving
|
|
223
|
+
* command — mutually exclusive, on `explore`, `journey run`, `load run`, `source run`, `verify-fix`
|
|
224
|
+
* and `regression capture`/`run`. Absent both: Playwright's default (desktop) viewport, documented
|
|
225
|
+
* in each command's `--help`.
|
|
226
|
+
*/
|
|
227
|
+
export function withEmulationFlags(cmd) {
|
|
228
|
+
return cmd
|
|
229
|
+
.option("--viewport <WxH>", "emulate a viewport of this size, e.g. --viewport 375x812 (mutually exclusive with --device)")
|
|
230
|
+
.option("--device <name>", 'emulate a Playwright registered device by name, e.g. --device "iPhone 13" (viewport + scale + mobile/touch + UA; mutually exclusive with --viewport)');
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The `EmulationSpec` for the parsed flags, or `undefined` when neither was given (Playwright's own
|
|
234
|
+
* default viewport applies). Refused HERE, before any browser opens, when both are given —
|
|
235
|
+
* `resolveEmulation` (an unknown `--device`, or both together) is also re-checked wherever the spec
|
|
236
|
+
* is finally used, so every call path fails closed the same way.
|
|
237
|
+
*/
|
|
238
|
+
export function emulationFromFlags(o) {
|
|
239
|
+
const spec = {
|
|
240
|
+
...(o.viewport !== undefined ? { viewport: parseViewport(o.viewport) } : {}),
|
|
241
|
+
...(o.device !== undefined ? { device: o.device } : {}),
|
|
242
|
+
};
|
|
243
|
+
if (Object.keys(spec).length === 0)
|
|
244
|
+
return undefined;
|
|
245
|
+
resolveEmulation(spec); // throws UnknownDeviceError / ConflictingEmulationError before any browser opens
|
|
246
|
+
return spec;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Parses repeated `--param key=value` flags into a `Record<string,string>`.
|
|
250
|
+
* `previous` starts as the option's default (`{}`) and this is called once
|
|
251
|
+
* per occurrence, commander's standard "collect" pattern.
|
|
252
|
+
*/
|
|
253
|
+
export function collectParam(value, previous) {
|
|
254
|
+
const idx = value.indexOf("=");
|
|
255
|
+
const key = idx === -1 ? value : value.slice(0, idx);
|
|
256
|
+
const val = idx === -1 ? "" : value.slice(idx + 1);
|
|
257
|
+
return { ...previous, [key]: val };
|
|
258
|
+
}
|
|
259
|
+
export function makeClock() {
|
|
260
|
+
return {
|
|
261
|
+
nowIso: () => clock.nowIso(),
|
|
262
|
+
monotonicMs: () => clock.now(),
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
export async function withSitePolicyRepository(dbPath, fn) {
|
|
266
|
+
await mkdir(dirname(dbPath), { recursive: true });
|
|
267
|
+
const db = openDatabase(dbPath);
|
|
268
|
+
try {
|
|
269
|
+
await migrateToLatest(db);
|
|
270
|
+
const repository = new SqliteSitePolicyRepository(db, makeClock());
|
|
271
|
+
return await fn(repository);
|
|
272
|
+
}
|
|
273
|
+
finally {
|
|
274
|
+
await db.destroy();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
export function isPlannedStep(value) {
|
|
278
|
+
if (typeof value !== "object" || value === null)
|
|
279
|
+
return false;
|
|
280
|
+
const record = value;
|
|
281
|
+
if (typeof record.label !== "string")
|
|
282
|
+
return false;
|
|
283
|
+
switch (record.kind) {
|
|
284
|
+
case "type":
|
|
285
|
+
return typeof record.text === "string";
|
|
286
|
+
case "click":
|
|
287
|
+
case "navigate":
|
|
288
|
+
return true;
|
|
289
|
+
case "read":
|
|
290
|
+
return typeof record.chars === "number";
|
|
291
|
+
default:
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
export function parsePlannedScript(raw) {
|
|
296
|
+
const parsed = JSON.parse(raw);
|
|
297
|
+
if (!Array.isArray(parsed) || !parsed.every(isPlannedStep)) {
|
|
298
|
+
throw new Error("script must be a JSON array of planned steps ({kind, label, ...})");
|
|
299
|
+
}
|
|
300
|
+
return parsed;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Writes a JSON envelope using the program's CURRENTLY-CONFIGURED output
|
|
304
|
+
* writer (read at call time via `configureOutput()`), so tests that call
|
|
305
|
+
* `program.configureOutput({ writeOut })` after `buildProgram()` still see
|
|
306
|
+
* output routed to their writer. Also sets `process.exitCode` (0 for `ok`; for
|
|
307
|
+
* `fail`, the error's class from exit-codes.ts — 64 usage, else 2) instead of
|
|
308
|
+
* hard-exiting, so `exitOverride()` in tests works.
|
|
309
|
+
*/
|
|
310
|
+
export function emitJson(program, envelope) {
|
|
311
|
+
// #218: a refusal without --json is a human `error <CODE>: …` line on stderr (cli-refusal.ts).
|
|
312
|
+
emitJsonOrRefusal(program, envelope);
|
|
313
|
+
if (envelope.ok)
|
|
314
|
+
emitUsageLine(program, envelope.data);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* #210: the envelope with `--json`, else a human summary (a refusal: `error <CODE>: …` on stderr);
|
|
318
|
+
* the cost line on stderr either way. Exit code: the verdict's, else the envelope's class (exit-codes.ts).
|
|
319
|
+
*/
|
|
320
|
+
export function emitCommandResult(program, envelope, opts) {
|
|
321
|
+
emitEnvelope(program, envelope, opts);
|
|
322
|
+
if (envelope.ok)
|
|
323
|
+
emitUsageLine(program, envelope.data);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* #221: a user-supplied name that becomes a path (a profile name, a regression id) must be one safe
|
|
327
|
+
* segment (`assertSafeName`, @jevitate/domain). Refuses it (E_INVALID_NAME, exit 64) and returns true.
|
|
328
|
+
*/
|
|
329
|
+
export function refuseUnsafeName(program, name, what) {
|
|
330
|
+
try {
|
|
331
|
+
assertSafeName(name, what);
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
catch (err) {
|
|
335
|
+
if (!(err instanceof UnsafeNameError))
|
|
336
|
+
throw err;
|
|
337
|
+
emitJson(program, fail(err.code, err.message));
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/** A non-`--json` result: printed as bare JSON on stdout, with the cost summary line on stderr. */
|
|
342
|
+
export function writeRawResult(program, result) {
|
|
343
|
+
program.configureOutput().writeOut?.(`${JSON.stringify(result)}\n`);
|
|
344
|
+
emitUsageLine(program, result);
|
|
345
|
+
}
|
|
346
|
+
/** A non-`--json` result (#227): the human summary a `cli-output.ts` formatter renders, with the cost summary line on stderr. */
|
|
347
|
+
export function writeHumanResult(program, result, human) {
|
|
348
|
+
const text = human(result);
|
|
349
|
+
if (text !== "")
|
|
350
|
+
program.configureOutput().writeOut?.(text);
|
|
351
|
+
emitUsageLine(program, result);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* The human cost summary (#163) — on STDERR, so stdout stays exactly the JSON a caller parses:
|
|
355
|
+
* `usage: cost $0.0312 (jev $0.0203 + generation $0.0109) · 398 judgments, …`, flagged
|
|
356
|
+
* `(partial: …)` when some call could not be priced. Nothing when the result carries no usage.
|
|
357
|
+
*/
|
|
358
|
+
export function emitUsageLine(program, data) {
|
|
359
|
+
if (data === null || typeof data !== "object")
|
|
360
|
+
return;
|
|
361
|
+
const usage = usageCountsFrom(data.usage);
|
|
362
|
+
if (usage === undefined || usage.judgments + usage.generations === 0)
|
|
363
|
+
return;
|
|
364
|
+
program.configureOutput().writeErr?.(`usage: ${formatUsageLine(usage)}\n`);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* `explore --help` trailer documenting every `outcome`/`stop`/`missionOutcome` value and its
|
|
368
|
+
* exit code (issue #83 item 2) — mirrors the README "Mission outcomes and exit codes" /
|
|
369
|
+
* "Every outcome, stop and missionOutcome value" sections, derived from the same sources:
|
|
370
|
+
* `MISSION_EXIT_CODES` (@jevitate/domain) and `goalExitCode`/`missionExitCode` (./mission-exit.ts).
|
|
371
|
+
*/
|
|
372
|
+
/** `--stall-timeout <seconds>` (#114) → milliseconds; `undefined` when omitted, `null` when not a positive number. */
|
|
373
|
+
export function stallTimeoutMs(raw) {
|
|
374
|
+
if (raw === undefined)
|
|
375
|
+
return undefined;
|
|
376
|
+
const seconds = Number(raw);
|
|
377
|
+
return Number.isFinite(seconds) && seconds > 0 ? Math.round(seconds * 1000) : null;
|
|
378
|
+
}
|
|
379
|
+
/** #230: the only `--strategy` values `explore` accepts; anything else is refused, never silently run as goal. */
|
|
380
|
+
export const EXPLORE_STRATEGIES = ["goal", "coverage", "exploratory", "adversarial", "usability"];
|
|
381
|
+
export const EXPLORE_OUTCOME_HELP = `
|
|
382
|
+
Outcomes, stop reasons and exit codes:
|
|
383
|
+
Every result carries a canonical missionOutcome (and exitCode), whatever the strategy:
|
|
384
|
+
clean 0 · defects-found 1 · inconclusive 2 · crashed 2 · hang 3 · intermittent 4
|
|
385
|
+
--strategy goal also carries its own ending as "goalOutcome" (= its "outcome"), folded onto missionOutcome:
|
|
386
|
+
succeeded → clean 0 · failed / exhausted / blocked → defects-found 1
|
|
387
|
+
(defects-found, inconclusive, crashed, hang, intermittent are themselves)
|
|
388
|
+
--strategy goal's "stop" (why the loop itself stopped; not separately exit-coded):
|
|
389
|
+
done | blocked | exhausted | no-progress | hang | inconclusive | crashed | budget
|
|
390
|
+
(a "done" code rejected ends stop done, goalOutcome failed — never blocked)
|
|
391
|
+
--strategy adversarial's "stop" (why the hunt ended; its "outcome" is the canonical one above):
|
|
392
|
+
step-budget | action-budget | time-budget | strategies-exhausted | not-rendered
|
|
393
|
+
| scope-unreachable | targets-refused | target-unresponsive | identity-changed | stalled | hang
|
|
394
|
+
| crashed
|
|
395
|
+
(identity-changed: an action switched the signed-in identity and the original one could not be
|
|
396
|
+
restored — inconclusive; every switch is listed in "identityChanges")
|
|
397
|
+
--strategy coverage/exploratory's own "outcome" (folds into missionOutcome above):
|
|
398
|
+
exhausted | insufficient-coverage | cap | scope-unreachable | stalled | crashed | hang
|
|
399
|
+
A run that proved nothing is inconclusive with failure.kind insufficient-coverage (the same word as
|
|
400
|
+
the frontier outcome), and failure.message says how to reach clean.
|
|
401
|
+
A starved host (#203): every result carries "hostHealth" (peak load/core, min free memory, peak
|
|
402
|
+
event-loop lag, slowest render). A hang, click timeout or no-progress met while the host was
|
|
403
|
+
starved is listed in "environmentDegraded" (advisory, never a finding); a run most of whose steps
|
|
404
|
+
ran starved is inconclusive (failure.kind degraded-environment), never clean.
|
|
405
|
+
--feature's own "outcome" (folds into missionOutcome above):
|
|
406
|
+
exhausted | insufficient-coverage | cap | path-cap | scope-unreachable | stalled | crashed | hang
|
|
407
|
+
Argument/input errors (E_EXPLORE_ARGS, E_EXPLORE_ASSERTION, …) exit 64, never 1.
|
|
408
|
+
Without --json: a human summary (verdict, defects by fingerprint, result file, next step);
|
|
409
|
+
with --json: the {v, ok, data} envelope.
|
|
410
|
+
Every command's exit codes: docs/outcomes.md "Exit codes".
|
|
411
|
+
`;
|
|
412
|
+
/** #291: the startup key check's env (opt-out) and verifier (injectable: tests never touch the network). */
|
|
413
|
+
function keyPreflightOpts(deps) {
|
|
414
|
+
return { env: deps.explore?.env ?? process.env, fetchFn: deps.explore?.verifyFetch ?? deps.ai?.verifyFetch ?? realVerifyFetch };
|
|
415
|
+
}
|
|
416
|
+
/** Distinct from MissingCredentialError: "no --real/--fake-ai selected" vs "keys missing." */
|
|
417
|
+
export class GatewaySelectionError extends Error {
|
|
418
|
+
}
|
|
419
|
+
export const DEFAULT_EXPLORE_CATALOG = [
|
|
420
|
+
{ id: "openai/gpt-4o-mini", promptUsdPer1k: 0.15, completionUsdPer1k: 0.6, regions: [], latencyClass: "fast", capabilities: [] },
|
|
421
|
+
];
|
|
422
|
+
export const DEFAULT_EXPLORE_CONSTRAINTS = { requiredCapabilities: [] };
|
|
423
|
+
/**
|
|
424
|
+
* Selects the exploration gateways. Injected gateways (tests) win; otherwise
|
|
425
|
+
* `--real` builds the live Jev + OpenRouter adapters behind a fail-closed
|
|
426
|
+
* credential preflight, and `--fake-ai` uses deterministic fakes (a pipeline
|
|
427
|
+
* smoke — the fake judge always proposes `done`, so it will not drive to a
|
|
428
|
+
* goal). No selection is a fail-closed refusal, never a silent fake.
|
|
429
|
+
*/
|
|
430
|
+
export async function buildExploreGateways(deps, opts) {
|
|
431
|
+
// #100: ONE tracker per invocation, handed to whichever gateways are built below — real (counted
|
|
432
|
+
// at the innermost seam, so a retry counts too) or fake (0 tokens, so a test can assert the shape
|
|
433
|
+
// without a key). Injected gateways (tests) get an empty tracker: they have no real seam to count.
|
|
434
|
+
// #136/#163: configured prices (env/config) override the built-in, versioned price tables.
|
|
435
|
+
// #213: --real and --fake-ai are mutually exclusive — silently preferring one (real used to win)
|
|
436
|
+
// hides that the caller's own flags contradict each other.
|
|
437
|
+
if (opts.real && opts.fakeAi) {
|
|
438
|
+
throw new GatewaySelectionError("--real and --fake-ai are mutually exclusive — pass one, not both");
|
|
439
|
+
}
|
|
440
|
+
const usage = deps.explore?.usage ?? new UsageTracker(resolveUsagePricing(deps.explore?.env ?? process.env));
|
|
441
|
+
if (deps.explore?.judge && deps.explore?.gen) {
|
|
442
|
+
return { judge: deps.explore.judge, gen: deps.explore.gen, usage };
|
|
443
|
+
}
|
|
444
|
+
const store = envCredentialStore(deps.explore?.env ?? process.env, deps.explore?.localConfig ?? loadLocalCredentials());
|
|
445
|
+
if (opts.real) {
|
|
446
|
+
requireKeys("generation", store); // fail-closed
|
|
447
|
+
requireKeys("judgment", store); // fail-closed
|
|
448
|
+
// #291: a key the provider rejects fails the run at startup (typed setup refusal), once per process.
|
|
449
|
+
await preflightRunKeys(["generation", "judgment"], store, keyPreflightOpts(deps));
|
|
450
|
+
const gen = new OpenRouterGenerationGateway({
|
|
451
|
+
store,
|
|
452
|
+
catalog: DEFAULT_EXPLORE_CATALOG,
|
|
453
|
+
constraints: DEFAULT_EXPLORE_CONSTRAINTS,
|
|
454
|
+
call: await realOpenRouterCall(usage),
|
|
455
|
+
});
|
|
456
|
+
const judge = new JevJudgmentGateway(store, await realJevClientCall(undefined, usage));
|
|
457
|
+
// Transient model/network failures are retried with exponential backoff + jitter (≈16s), then
|
|
458
|
+
// fail typed; validation/auth errors fail at once (owner ruling 4).
|
|
459
|
+
return { judge: new RetryingJudgmentPort(judge), gen: new RetryingGenerationPort(gen), usage };
|
|
460
|
+
}
|
|
461
|
+
if (opts.fakeAi) {
|
|
462
|
+
return { judge: fakeDoneJudge(usage), gen: new FakeGenerationGateway(undefined, usage), usage };
|
|
463
|
+
}
|
|
464
|
+
throw new GatewaySelectionError("no gateway selected — pass --real for live Jev+OpenRouter (after `jevitate ai setup`), or --fake-ai for a deterministic pipeline smoke");
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* #246: the generation gateway ALONE (`journey annotate` drafts text and asks no judgment
|
|
468
|
+
* question, so it needs no Jev key). Same selection rules as `buildExploreGateways`: injected (tests)
|
|
469
|
+
* wins, `--real` is fail-closed on the OpenRouter key, `--fake-ai` is the deterministic fake, the two
|
|
470
|
+
* are exclusive, and no selection is a refusal — never a silent fake.
|
|
471
|
+
*/
|
|
472
|
+
export async function buildGenerationGateway(deps, opts) {
|
|
473
|
+
if (opts.real && opts.fakeAi) {
|
|
474
|
+
throw new GatewaySelectionError("--real and --fake-ai are mutually exclusive — pass one, not both");
|
|
475
|
+
}
|
|
476
|
+
const usage = deps.explore?.usage ?? new UsageTracker(resolveUsagePricing(deps.explore?.env ?? process.env));
|
|
477
|
+
if (deps.explore?.gen)
|
|
478
|
+
return { gen: deps.explore.gen, usage };
|
|
479
|
+
if (opts.real) {
|
|
480
|
+
const store = envCredentialStore(deps.explore?.env ?? process.env, deps.explore?.localConfig ?? loadLocalCredentials());
|
|
481
|
+
requireKeys("generation", store); // fail-closed
|
|
482
|
+
await preflightRunKeys(["generation"], store, keyPreflightOpts(deps)); // #291
|
|
483
|
+
const gen = new OpenRouterGenerationGateway({
|
|
484
|
+
store,
|
|
485
|
+
catalog: DEFAULT_EXPLORE_CATALOG,
|
|
486
|
+
constraints: DEFAULT_EXPLORE_CONSTRAINTS,
|
|
487
|
+
call: await realOpenRouterCall(usage),
|
|
488
|
+
});
|
|
489
|
+
return { gen: new RetryingGenerationPort(gen), usage };
|
|
490
|
+
}
|
|
491
|
+
if (opts.fakeAi)
|
|
492
|
+
return { gen: new FakeGenerationGateway(undefined, usage), usage };
|
|
493
|
+
throw new GatewaySelectionError("no gateway selected — pass --real for live OpenRouter generation (after `jevitate ai setup generation`), or --fake-ai for a deterministic pipeline smoke");
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* A judge that always proposes `done` — used only by `--fake-ai` (smoke). It is TOTAL and
|
|
497
|
+
* deterministic: it answers EVERY question it is asked, whatever the mission or rubric names it
|
|
498
|
+
* (#213) — a choice offering `done` picks `done` (so the goal/coverage loop stops at once, and
|
|
499
|
+
* will not drive to a goal); a choice that does NOT offer `done` (e.g. the UX quality grader's
|
|
500
|
+
* label set, `grade::0`) deterministically picks its first listed option instead of throwing; a
|
|
501
|
+
* noul answers "no"; a score answers 0. It never throws on a question SHAPE it does not
|
|
502
|
+
* specifically know about — only on a malformed one (a choice with no options at all), which is a
|
|
503
|
+
* bug upstream, not an unknown question. `usage` (#100) is optional: when supplied, every call
|
|
504
|
+
* reports 1 judgment at 0 tokens.
|
|
505
|
+
*/
|
|
506
|
+
export function fakeDoneJudge(usage) {
|
|
507
|
+
return {
|
|
508
|
+
async systemOne(args) {
|
|
509
|
+
const out = {};
|
|
510
|
+
for (const [name, q] of Object.entries(args.questions)) {
|
|
511
|
+
switch (q.kind) {
|
|
512
|
+
case "choice": {
|
|
513
|
+
// #213: total over every choice family, not just the goal/coverage loop's `done`.
|
|
514
|
+
const value = q.options.includes("done") ? "done" : q.options[0];
|
|
515
|
+
if (value === undefined)
|
|
516
|
+
throw new Error(`fake judge: question '${name}' offers no options`);
|
|
517
|
+
out[name] = { kind: "choice", value, confidence: 1 };
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
case "noul":
|
|
521
|
+
out[name] = { kind: "noul", value: false, probability: 0 };
|
|
522
|
+
break;
|
|
523
|
+
case "score":
|
|
524
|
+
out[name] = { kind: "score", value: 0 };
|
|
525
|
+
break;
|
|
526
|
+
default: {
|
|
527
|
+
const exhaustive = q;
|
|
528
|
+
throw new Error(`fake judge: unsupported question ${JSON.stringify(exhaustive)}`);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
usage?.recordJudgment(FAKE_CALL_USAGE);
|
|
533
|
+
return out;
|
|
534
|
+
},
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
//# sourceMappingURL=cli-shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-shared.js","sourceRoot":"","sources":["../src/cli-shared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO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C,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;gBACvD,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;oBACf,KAAK,QAAQ,CAAC,CAAC,CAAC;wBACd,kFAAkF;wBAClF,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;wBACjE,IAAI,KAAK,KAAK,SAAS;4BAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,qBAAqB,CAAC,CAAC;wBAC7F,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;wBACrD,MAAM;oBACR,CAAC;oBACD,KAAK,MAAM;wBACT,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;wBAC3D,MAAM;oBACR,KAAK,OAAO;wBACV,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;wBACxC,MAAM;oBACR,OAAO,CAAC,CAAC,CAAC;wBACR,MAAM,UAAU,GAAU,CAAC,CAAC;wBAC5B,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oBACpF,CAAC;gBACH,CAAC;YACH,CAAC;YACD,KAAK,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;YACvC,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Command, Option, Argument } from "commander";
|
|
2
|
+
/** Best-effort placeholder for absolute, environment-dependent paths (home dir, cwd, tmp). */
|
|
3
|
+
export declare function normalizeVolatile(text: string): string;
|
|
4
|
+
export interface OptionSurface {
|
|
5
|
+
readonly flags: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly defaultValue: string;
|
|
8
|
+
readonly choices: readonly string[] | null;
|
|
9
|
+
readonly required: boolean;
|
|
10
|
+
readonly mandatory: boolean;
|
|
11
|
+
readonly negate: boolean;
|
|
12
|
+
readonly variadic: boolean;
|
|
13
|
+
readonly envVar: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface ArgumentSurface {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly description: string;
|
|
18
|
+
readonly required: boolean;
|
|
19
|
+
readonly variadic: boolean;
|
|
20
|
+
readonly defaultValue: string;
|
|
21
|
+
readonly choices: readonly string[] | null;
|
|
22
|
+
}
|
|
23
|
+
export interface CommandSurface {
|
|
24
|
+
readonly path: string;
|
|
25
|
+
readonly aliases: readonly string[];
|
|
26
|
+
readonly description: string;
|
|
27
|
+
readonly arguments: readonly ArgumentSurface[];
|
|
28
|
+
readonly options: readonly OptionSurface[];
|
|
29
|
+
}
|
|
30
|
+
export declare function describeOption(o: Option): OptionSurface;
|
|
31
|
+
export declare function describeArgument(a: Argument): ArgumentSurface;
|
|
32
|
+
/** Walks the ENTIRE command tree recursively (subcommands of subcommands included, e.g. `mission target add`). */
|
|
33
|
+
export declare function walk(cmd: Command, path: string): CommandSurface[];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Best-effort placeholder for absolute, environment-dependent paths (home dir, cwd, tmp). */
|
|
2
|
+
export function normalizeVolatile(text) {
|
|
3
|
+
return text
|
|
4
|
+
.split(process.cwd()).join("<cwd>")
|
|
5
|
+
.replace(/\/home\/[^/\s"']+/g, "<home>")
|
|
6
|
+
.replace(/\/root(?=[/\s"'])/g, "<home>");
|
|
7
|
+
}
|
|
8
|
+
export function describeOption(o) {
|
|
9
|
+
return {
|
|
10
|
+
flags: o.flags,
|
|
11
|
+
description: normalizeVolatile(o.description),
|
|
12
|
+
defaultValue: normalizeVolatile(JSON.stringify(o.defaultValue ?? null)),
|
|
13
|
+
choices: o.argChoices ?? null,
|
|
14
|
+
required: o.required,
|
|
15
|
+
mandatory: o.mandatory,
|
|
16
|
+
negate: o.negate,
|
|
17
|
+
variadic: o.variadic,
|
|
18
|
+
envVar: o.envVar ?? null,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function describeArgument(a) {
|
|
22
|
+
return {
|
|
23
|
+
name: a.name(),
|
|
24
|
+
description: normalizeVolatile(a.description),
|
|
25
|
+
required: a.required,
|
|
26
|
+
variadic: a.variadic,
|
|
27
|
+
defaultValue: normalizeVolatile(JSON.stringify(a.defaultValue ?? null)),
|
|
28
|
+
choices: a.argChoices ?? null,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Walks the ENTIRE command tree recursively (subcommands of subcommands included, e.g. `mission target add`). */
|
|
32
|
+
export function walk(cmd, path) {
|
|
33
|
+
const here = {
|
|
34
|
+
path,
|
|
35
|
+
aliases: [...cmd.aliases()].sort(),
|
|
36
|
+
description: normalizeVolatile(cmd.description()),
|
|
37
|
+
// Positional arguments: order is semantically meaningful (they're positional), never sorted.
|
|
38
|
+
arguments: cmd.registeredArguments.map(describeArgument),
|
|
39
|
+
// Options: sorted so option-registration order (an implementation detail) never causes a diff.
|
|
40
|
+
options: [...cmd.options].map(describeOption).sort((a, b) => a.flags.localeCompare(b.flags)),
|
|
41
|
+
};
|
|
42
|
+
const children = [...cmd.commands]
|
|
43
|
+
.filter((c) => c.name() !== "help") // Commander's auto-added implicit help subcommand: not user surface.
|
|
44
|
+
.sort((a, b) => a.name().localeCompare(b.name()))
|
|
45
|
+
.flatMap((c) => walk(c, path === "" ? c.name() : `${path} ${c.name()}`));
|
|
46
|
+
return [here, ...children];
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=cli-surface.js.map
|