@empiricalrun/test-gen 0.73.0 → 0.74.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/CHANGELOG.md +96 -0
- package/dist/actions/utils/index.d.ts.map +1 -1
- package/dist/actions/utils/index.js +1 -2
- package/dist/agent/browsing/index.d.ts.map +1 -1
- package/dist/agent/browsing/index.js +9 -7
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +3 -4
- package/dist/agent/chat/agent-loop.d.ts +7 -8
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +14 -17
- package/dist/agent/chat/exports.d.ts +5 -4
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +9 -4
- package/dist/agent/chat/filesystem-cache.d.ts +12 -0
- package/dist/agent/chat/filesystem-cache.d.ts.map +1 -0
- package/dist/agent/chat/filesystem-cache.js +101 -0
- package/dist/agent/chat/index.d.ts +4 -1
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +44 -22
- package/dist/agent/chat/models.d.ts +2 -1
- package/dist/agent/chat/models.d.ts.map +1 -1
- package/dist/agent/chat/models.js +25 -3
- package/dist/agent/chat/prompt/index.d.ts +3 -1
- package/dist/agent/chat/prompt/index.d.ts.map +1 -1
- package/dist/agent/chat/prompt/index.js +77 -2
- package/dist/agent/chat/prompt/repo.d.ts.map +1 -1
- package/dist/agent/chat/prompt/repo.js +1 -0
- package/dist/agent/chat/state.d.ts +6 -5
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +35 -5
- package/dist/agent/chat/utils.d.ts +1 -0
- package/dist/agent/chat/utils.d.ts.map +1 -1
- package/dist/agent/chat/utils.js +16 -3
- package/dist/agent/cua/index.js +1 -1
- package/dist/agent/cua/model.js +1 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.js +0 -1
- package/dist/agent/master/browser-tests/fixtures.d.ts.map +1 -1
- package/dist/agent/master/browser-tests/fixtures.js +0 -1
- package/dist/agent/master/element-annotation.d.ts.map +1 -1
- package/dist/agent/master/element-annotation.js +1 -2
- package/dist/agent/master/execute-browser-action.d.ts.map +1 -1
- package/dist/agent/master/execute-browser-action.js +8 -6
- package/dist/agent/master/icon-descriptor/index.js +2 -2
- package/dist/agent/master/next-action.js +1 -1
- package/dist/agent/master/planner.js +1 -1
- package/dist/agent/master/scroller.js +2 -2
- package/dist/agent/master/with-hints.d.ts.map +1 -1
- package/dist/agent/master/with-hints.js +6 -5
- package/dist/agent/planner/run-time-planner.js +1 -1
- package/dist/agent/planner/run.d.ts.map +1 -1
- package/dist/agent/planner/run.js +4 -2
- package/dist/auth/cli-auth.js +1 -1
- package/dist/auth/token-store.d.ts.map +1 -1
- package/dist/auth/token-store.js +4 -6
- package/dist/bin/index.js +30 -163
- package/dist/bin/utils/context.js +1 -1
- package/dist/bin/utils/index.d.ts +0 -12
- package/dist/bin/utils/index.d.ts.map +1 -1
- package/dist/bin/utils/index.js +0 -70
- package/dist/bin/utils/platform/web/index.d.ts +2 -2
- package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +7 -5
- package/dist/bin/utils/scenarios/index.d.ts +11 -3
- package/dist/bin/utils/scenarios/index.d.ts.map +1 -1
- package/dist/browser-injected-scripts/annotate-elements.spec.js +0 -5
- package/dist/browser-injected-scripts/annotate-elements.spec.ts +0 -5
- package/dist/dashboard/client.d.ts +2 -2
- package/dist/dashboard/client.d.ts.map +1 -1
- package/dist/dashboard/client.js +4 -1
- package/dist/file-info/adapters/file-system/index.d.ts +9 -0
- package/dist/file-info/adapters/file-system/index.d.ts.map +1 -0
- package/dist/file-info/adapters/file-system/index.js +25 -0
- package/dist/file-info/adapters/file-system/reader.d.ts +6 -0
- package/dist/file-info/adapters/file-system/reader.d.ts.map +1 -0
- package/dist/file-info/{file-system.js → adapters/file-system/reader.js} +16 -0
- package/dist/file-info/adapters/github/index.d.ts +11 -0
- package/dist/file-info/adapters/github/index.d.ts.map +1 -0
- package/dist/file-info/adapters/github/index.js +29 -0
- package/dist/file-info/adapters/github/reader.d.ts +16 -0
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -0
- package/dist/file-info/adapters/github/reader.js +185 -0
- package/dist/file-info/index.d.ts +4 -0
- package/dist/file-info/index.d.ts.map +1 -0
- package/dist/file-info/index.js +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/recorder/index.d.ts +7 -3
- package/dist/recorder/index.d.ts.map +1 -1
- package/dist/recorder/index.js +181 -64
- package/dist/recorder/temp-files.d.ts +1 -1
- package/dist/recorder/temp-files.d.ts.map +1 -1
- package/dist/recorder/temp-files.js +2 -2
- package/dist/recorder/upload.d.ts +1 -1
- package/dist/recorder/upload.d.ts.map +1 -1
- package/dist/recorder/upload.js +3 -3
- package/dist/tools/{commit-and-create-pr.d.ts → commit-and-create-pr/index.d.ts} +1 -1
- package/dist/tools/commit-and-create-pr/index.d.ts.map +1 -0
- package/dist/tools/{commit-and-create-pr.js → commit-and-create-pr/index.js} +8 -28
- package/dist/tools/definitions/commit-and-create-pr.d.ts +3 -0
- package/dist/tools/definitions/commit-and-create-pr.d.ts.map +1 -0
- package/dist/tools/definitions/commit-and-create-pr.js +31 -0
- package/dist/tools/definitions/delete-file.d.ts +3 -0
- package/dist/tools/definitions/delete-file.d.ts.map +1 -0
- package/dist/tools/definitions/delete-file.js +20 -0
- package/dist/tools/{download-build.d.ts → definitions/download-build.d.ts} +2 -2
- package/dist/tools/definitions/download-build.d.ts.map +1 -0
- package/dist/tools/definitions/download-build.js +18 -0
- package/dist/tools/definitions/fetch-video-analysis.d.ts +11 -0
- package/dist/tools/definitions/fetch-video-analysis.d.ts.map +1 -0
- package/dist/tools/definitions/fetch-video-analysis.js +26 -0
- package/dist/tools/definitions/grep.d.ts +3 -0
- package/dist/tools/definitions/grep.d.ts.map +1 -0
- package/dist/tools/definitions/grep.js +29 -0
- package/dist/tools/definitions/merge-conflicts.d.ts +3 -0
- package/dist/tools/definitions/merge-conflicts.d.ts.map +1 -0
- package/dist/tools/definitions/merge-conflicts.js +24 -0
- package/dist/tools/definitions/run-test.d.ts +2 -2
- package/dist/tools/definitions/run-test.d.ts.map +1 -1
- package/dist/tools/definitions/run-test.js +4 -7
- package/dist/tools/definitions/str_replace_editor.d.ts.map +1 -1
- package/dist/tools/definitions/str_replace_editor.js +9 -5
- package/dist/tools/definitions/test-gen-browser.d.ts +5 -5
- package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/definitions/test-gen-browser.js +4 -7
- package/dist/tools/definitions/upgrade-packages.d.ts +36 -0
- package/dist/tools/definitions/upgrade-packages.d.ts.map +1 -0
- package/dist/tools/definitions/upgrade-packages.js +21 -0
- package/dist/tools/definitions/utils.d.ts +15 -0
- package/dist/tools/definitions/utils.d.ts.map +1 -0
- package/dist/tools/definitions/utils.js +16 -0
- package/dist/tools/{delete-file.d.ts → delete-file/index.d.ts} +1 -1
- package/dist/tools/delete-file/index.d.ts.map +1 -0
- package/dist/tools/{delete-file.js → delete-file/index.js} +4 -16
- package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
- package/dist/tools/diagnosis-fetcher.js +13 -11
- package/dist/tools/download-build/index.d.ts +3 -0
- package/dist/tools/download-build/index.d.ts.map +1 -0
- package/dist/tools/{download-build.js → download-build/index.js} +4 -14
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +19 -4
- package/dist/tools/executor/utils/git.js +1 -1
- package/dist/tools/executor/utils/pr-description.d.ts +1 -1
- package/dist/tools/executor/utils/pr-description.d.ts.map +1 -1
- package/dist/tools/fetch-image/index.d.ts +10 -1
- package/dist/tools/fetch-image/index.d.ts.map +1 -1
- package/dist/tools/fetch-image/index.js +8 -1
- package/dist/tools/fetch-last-successful-test-run/index.d.ts +3 -0
- package/dist/tools/fetch-last-successful-test-run/index.d.ts.map +1 -0
- package/dist/tools/fetch-last-successful-test-run/index.js +60 -0
- package/dist/tools/fetch-video-analysis/index.d.ts +5 -0
- package/dist/tools/fetch-video-analysis/index.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/index.js +89 -0
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts +24 -0
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.js +209 -0
- package/dist/tools/fetch-video-analysis/utils.d.ts +10 -0
- package/dist/tools/fetch-video-analysis/utils.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/utils.js +72 -0
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts +7 -0
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/video-analysis.js +54 -0
- package/dist/tools/file-operations/create.d.ts +11 -0
- package/dist/tools/file-operations/create.d.ts.map +1 -0
- package/dist/tools/file-operations/create.js +60 -0
- package/dist/tools/file-operations/index.d.ts +15 -0
- package/dist/tools/file-operations/index.d.ts.map +1 -0
- package/dist/tools/file-operations/index.js +143 -0
- package/dist/tools/file-operations/insert.d.ts +11 -0
- package/dist/tools/file-operations/insert.d.ts.map +1 -0
- package/dist/tools/file-operations/insert.js +61 -0
- package/dist/tools/file-operations/replace.d.ts +11 -0
- package/dist/tools/file-operations/replace.d.ts.map +1 -0
- package/dist/tools/file-operations/replace.js +80 -0
- package/dist/tools/file-operations/shared/git-helper.d.ts +4 -0
- package/dist/tools/file-operations/shared/git-helper.d.ts.map +1 -0
- package/dist/tools/file-operations/shared/git-helper.js +29 -0
- package/dist/tools/file-operations/shared/helpers.d.ts +19 -0
- package/dist/tools/file-operations/shared/helpers.d.ts.map +1 -0
- package/dist/tools/file-operations/shared/helpers.js +133 -0
- package/dist/tools/file-operations/view/index.d.ts +14 -0
- package/dist/tools/file-operations/view/index.d.ts.map +1 -0
- package/dist/tools/file-operations/view/index.js +56 -0
- package/dist/tools/grep/index.d.ts.map +1 -1
- package/dist/tools/grep/index.js +2 -9
- package/dist/tools/grep/ripgrep/index.d.ts +2 -2
- package/dist/tools/grep/ripgrep/index.d.ts.map +1 -1
- package/dist/tools/grep/ripgrep/index.js +3 -3
- package/dist/tools/grep/types.d.ts.map +1 -0
- package/dist/tools/index.d.ts +7 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +66 -22
- package/dist/tools/issues/create-issue.d.ts +3 -0
- package/dist/tools/issues/create-issue.d.ts.map +1 -0
- package/dist/tools/issues/create-issue.js +76 -0
- package/dist/tools/issues/index.d.ts +4 -0
- package/dist/tools/issues/index.d.ts.map +1 -0
- package/dist/tools/issues/index.js +9 -0
- package/dist/tools/issues/list-issues.d.ts +3 -0
- package/dist/tools/issues/list-issues.d.ts.map +1 -0
- package/dist/tools/issues/list-issues.js +32 -0
- package/dist/tools/issues/metadata-schema.d.ts +24 -0
- package/dist/tools/issues/metadata-schema.d.ts.map +1 -0
- package/dist/tools/issues/metadata-schema.js +22 -0
- package/dist/tools/issues/update-issue.d.ts +3 -0
- package/dist/tools/issues/update-issue.d.ts.map +1 -0
- package/dist/tools/issues/update-issue.js +75 -0
- package/dist/tools/issues/utils.d.ts +5 -0
- package/dist/tools/issues/utils.d.ts.map +1 -0
- package/dist/tools/issues/utils.js +26 -0
- package/dist/tools/list-environments.d.ts.map +1 -1
- package/dist/tools/list-environments.js +4 -0
- package/dist/tools/{merge-conflicts.d.ts → merge-conflicts/index.d.ts} +1 -1
- package/dist/tools/merge-conflicts/index.d.ts.map +1 -0
- package/dist/tools/{merge-conflicts.js → merge-conflicts/index.js} +3 -19
- package/dist/tools/test-gen-browser.js +4 -4
- package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
- package/dist/tools/test-run-fetcher/index.js +4 -0
- package/dist/tools/trace-dot-zip/index.d.ts +3 -0
- package/dist/tools/trace-dot-zip/index.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/index.js +48 -0
- package/dist/tools/trace-dot-zip/types.d.ts +86 -0
- package/dist/tools/trace-dot-zip/types.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/types.js +2 -0
- package/dist/tools/trace-dot-zip/utils/console-trace.d.ts +7 -0
- package/dist/tools/trace-dot-zip/utils/console-trace.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/console-trace.js +34 -0
- package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts +21 -0
- package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/extract-zip.js +174 -0
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts +21 -0
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/network-trace.js +189 -0
- package/dist/tools/triage-summary/index.d.ts +3 -0
- package/dist/tools/triage-summary/index.d.ts.map +1 -0
- package/dist/tools/triage-summary/index.js +51 -0
- package/dist/tools/triage-summary/types.d.ts +5 -0
- package/dist/tools/triage-summary/types.d.ts.map +1 -0
- package/dist/tools/triage-summary/types.js +2 -0
- package/dist/tools/triage-summary/utils.d.ts +4 -0
- package/dist/tools/triage-summary/utils.d.ts.map +1 -0
- package/dist/tools/triage-summary/utils.js +16 -0
- package/dist/tools/upgrade-packages/index.d.ts.map +1 -1
- package/dist/tools/upgrade-packages/index.js +5 -15
- package/dist/tools/view-failed-test-run-report/index.d.ts +12 -0
- package/dist/tools/view-failed-test-run-report/index.d.ts.map +1 -0
- package/dist/tools/view-failed-test-run-report/index.js +163 -0
- package/dist/trace-utils/index.d.ts +4 -0
- package/dist/trace-utils/index.d.ts.map +1 -0
- package/dist/trace-utils/index.js +10 -0
- package/dist/utils/dedup-image-fs.d.ts +27 -0
- package/dist/utils/dedup-image-fs.d.ts.map +1 -0
- package/dist/utils/dedup-image-fs.js +88 -0
- package/dist/utils/dedup-image.d.ts +25 -0
- package/dist/utils/dedup-image.d.ts.map +1 -0
- package/dist/utils/dedup-image.js +80 -0
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +0 -1
- package/dist/utils/json.js +1 -1
- package/dist/utils/model.d.ts +3 -0
- package/dist/utils/model.d.ts.map +1 -0
- package/dist/utils/model.js +18 -0
- package/dist/utils/playwright-report-parser.d.ts +13 -0
- package/dist/utils/playwright-report-parser.d.ts.map +1 -0
- package/dist/utils/playwright-report-parser.js +138 -0
- package/dist/utils/slug.d.ts +1 -0
- package/dist/utils/slug.d.ts.map +1 -1
- package/dist/utils/slug.js +9 -1
- package/dist/utils/stripAnsi.d.ts.map +1 -1
- package/dist/utils/stripAnsi.js +1 -3
- package/eslint.config.mjs +43 -0
- package/package.json +22 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/agent/codegen/generate-code-apply-changes.d.ts +0 -13
- package/dist/agent/codegen/generate-code-apply-changes.d.ts.map +0 -1
- package/dist/agent/codegen/generate-code-apply-changes.js +0 -379
- package/dist/agent/codegen/repo-edit.d.ts +0 -23
- package/dist/agent/codegen/repo-edit.d.ts.map +0 -1
- package/dist/agent/codegen/repo-edit.js +0 -81
- package/dist/agent/codegen/run.d.ts +0 -20
- package/dist/agent/codegen/run.d.ts.map +0 -1
- package/dist/agent/codegen/run.js +0 -116
- package/dist/agent/enrich-prompt/index.d.ts +0 -12
- package/dist/agent/enrich-prompt/index.d.ts.map +0 -1
- package/dist/agent/enrich-prompt/index.js +0 -80
- package/dist/agent/enrich-prompt/utils.d.ts +0 -6
- package/dist/agent/enrich-prompt/utils.d.ts.map +0 -1
- package/dist/agent/enrich-prompt/utils.js +0 -11
- package/dist/agent/infer-agent/index.d.ts +0 -10
- package/dist/agent/infer-agent/index.d.ts.map +0 -1
- package/dist/agent/infer-agent/index.js +0 -60
- package/dist/evals/add-scenario-agent.evals.d.ts +0 -4
- package/dist/evals/add-scenario-agent.evals.d.ts.map +0 -1
- package/dist/evals/add-scenario-agent.evals.js +0 -44
- package/dist/evals/infer-master-or-code-agent.evals.d.ts +0 -4
- package/dist/evals/infer-master-or-code-agent.evals.d.ts.map +0 -1
- package/dist/evals/infer-master-or-code-agent.evals.js +0 -22
- package/dist/file-info/file-system.d.ts +0 -3
- package/dist/file-info/file-system.d.ts.map +0 -1
- package/dist/file-info/github.d.ts +0 -3
- package/dist/file-info/github.d.ts.map +0 -1
- package/dist/file-info/github.js +0 -107
- package/dist/tools/commit-and-create-pr.d.ts.map +0 -1
- package/dist/tools/delete-file.d.ts.map +0 -1
- package/dist/tools/download-build.d.ts.map +0 -1
- package/dist/tools/grep/ripgrep/types.d.ts.map +0 -1
- package/dist/tools/merge-conflicts.d.ts.map +0 -1
- package/dist/tools/str_replace_editor.d.ts +0 -22
- package/dist/tools/str_replace_editor.d.ts.map +0 -1
- package/dist/tools/str_replace_editor.js +0 -429
- /package/dist/tools/grep/{ripgrep/types.d.ts → types.d.ts} +0 -0
- /package/dist/tools/grep/{ripgrep/types.js → types.js} +0 -0
package/dist/auth/token-store.js
CHANGED
|
@@ -12,9 +12,7 @@ const util_1 = require("util");
|
|
|
12
12
|
const CONFIG_DIR = (0, path_1.join)((0, os_1.homedir)(), ".empiricalrun");
|
|
13
13
|
const TOKEN_FILE = (0, path_1.join)(CONFIG_DIR, "auth.enc");
|
|
14
14
|
async function getEncryptionKey(salt) {
|
|
15
|
-
const machineId =
|
|
16
|
-
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
|
17
|
-
process.env.HOME || process.env.USERPROFILE || "default-machine";
|
|
15
|
+
const machineId = process.env.HOME || process.env.USERPROFILE || "default-machine";
|
|
18
16
|
const scryptAsync = (0, util_1.promisify)(crypto_1.scrypt);
|
|
19
17
|
return (await scryptAsync("empirical-cli-tokens-" + machineId, salt, 32));
|
|
20
18
|
}
|
|
@@ -38,7 +36,7 @@ async function getTokenStorage() {
|
|
|
38
36
|
decrypted += decipher.final("utf8");
|
|
39
37
|
return JSON.parse(decrypted);
|
|
40
38
|
}
|
|
41
|
-
catch
|
|
39
|
+
catch {
|
|
42
40
|
// Token file doesn't exist or is corrupted
|
|
43
41
|
return null;
|
|
44
42
|
}
|
|
@@ -95,7 +93,7 @@ async function getStoredUserTokens() {
|
|
|
95
93
|
}
|
|
96
94
|
return tokens;
|
|
97
95
|
}
|
|
98
|
-
catch
|
|
96
|
+
catch {
|
|
99
97
|
// Token file doesn't exist or is corrupted
|
|
100
98
|
return null;
|
|
101
99
|
}
|
|
@@ -133,7 +131,7 @@ async function clearTokens() {
|
|
|
133
131
|
]);
|
|
134
132
|
await (0, promises_1.writeFile)(TOKEN_FILE, encryptedData, { mode: 0o600 });
|
|
135
133
|
}
|
|
136
|
-
catch
|
|
134
|
+
catch {
|
|
137
135
|
// File doesn't exist, ignore
|
|
138
136
|
}
|
|
139
137
|
}
|
package/dist/bin/index.js
CHANGED
|
@@ -4,144 +4,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const llm_1 = require("@empiricalrun/llm");
|
|
8
7
|
const commander_1 = require("commander");
|
|
9
8
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
10
9
|
const fs_1 = __importDefault(require("fs"));
|
|
11
|
-
const run_1 = require("../agent/browsing/run");
|
|
12
|
-
const utils_1 = require("../agent/browsing/utils");
|
|
13
10
|
const chat_1 = require("../agent/chat");
|
|
14
|
-
const
|
|
15
|
-
const run_2 = require("../agent/codegen/run");
|
|
16
|
-
const diagnosis_agent_1 = require("../agent/diagnosis-agent");
|
|
17
|
-
const enrich_prompt_1 = require("../agent/enrich-prompt");
|
|
18
|
-
const infer_agent_1 = require("../agent/infer-agent");
|
|
19
|
-
const run_3 = require("../agent/planner/run");
|
|
11
|
+
const models_1 = require("../agent/chat/models");
|
|
20
12
|
const auth_1 = require("../auth");
|
|
21
13
|
const client_1 = require("../dashboard/client");
|
|
22
14
|
const recorder_1 = require("../recorder");
|
|
23
15
|
const validation_1 = require("../recorder/validation");
|
|
24
16
|
const test_build_1 = require("../test-build");
|
|
25
17
|
const environments_1 = require("./environments");
|
|
26
|
-
const logger_1 = require("./logger");
|
|
27
18
|
const setup_1 = require("./setup");
|
|
28
|
-
const
|
|
29
|
-
const scenarios_1 = require("./utils/scenarios");
|
|
19
|
+
const utils_1 = require("./utils");
|
|
30
20
|
dotenv_1.default.config({
|
|
31
21
|
path: [".env.local", ".env"],
|
|
32
22
|
});
|
|
33
|
-
async function runChatAgent({ modelInput, useDiskForChatState,
|
|
34
|
-
|
|
35
|
-
throw new Error(`Invalid chat model: ${modelInput}`);
|
|
36
|
-
}
|
|
37
|
-
const defaultModel = "claude-3-7-sonnet-20250219";
|
|
38
|
-
const specifiedModel = modelInput && utils_2.ARGS_TO_MODEL_MAP[modelInput];
|
|
39
|
-
let initialPromptContent = undefined;
|
|
40
|
-
if (initialPromptPath) {
|
|
41
|
-
try {
|
|
42
|
-
const fs = await import("fs");
|
|
43
|
-
initialPromptContent = fs.readFileSync(initialPromptPath, "utf-8");
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
throw new Error(`Failed to read initial prompt file at ${initialPromptPath}: ${error.message}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
23
|
+
async function runChatAgent({ modelInput, useDiskForChatState, prompt: initialPromptContent, useTriage, resetChat, useFSCache, }) {
|
|
24
|
+
const resolvedModel = (0, models_1.resolveChatModelBasedOnInput)(modelInput);
|
|
49
25
|
return await (0, chat_1.runChatAgentForCLI)({
|
|
50
|
-
selectedModel:
|
|
26
|
+
selectedModel: resolvedModel,
|
|
51
27
|
useDiskForChatState: useDiskForChatState || false,
|
|
52
28
|
initialPromptContent,
|
|
29
|
+
useTriage: useTriage || false,
|
|
30
|
+
resetChat: resetChat || false,
|
|
31
|
+
useFSCache: useFSCache || false,
|
|
53
32
|
});
|
|
54
33
|
}
|
|
55
|
-
async function runAgentsWorkflow(testGenConfig, testGenToken) {
|
|
56
|
-
const logger = new logger_1.CustomLogger();
|
|
57
|
-
const { specPath, testCase } = testGenConfig;
|
|
58
|
-
let agentFromConfig = testGenConfig.options?.agent;
|
|
59
|
-
let agent = agentFromConfig || "auto";
|
|
60
|
-
// assuming if there is no test case specific test name, we need to update the test case name
|
|
61
|
-
if (!testCase.name) {
|
|
62
|
-
logger.success(`Generating code for the provided task. ${process.env.LOG_URL ? `[view log](${process.env.LOG_URL})` : ""}`);
|
|
63
|
-
await (0, repo_edit_1.repoEditAgent)({
|
|
64
|
-
task: testGenConfig.testCase.steps.join("\n"),
|
|
65
|
-
logger,
|
|
66
|
-
});
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (testGenConfig.testErrorDiagnosis &&
|
|
70
|
-
testGenConfig.testErrorDiagnosis.failingLine) {
|
|
71
|
-
// If failure context is available, we can enrich the user prompt to contain
|
|
72
|
-
// the failure context
|
|
73
|
-
const requestedChangeResp = await (0, enrich_prompt_1.enrichPromptWithFailingLine)({
|
|
74
|
-
testBlock: testGenConfig.testErrorDiagnosis.failingLine,
|
|
75
|
-
testFilePath: testGenConfig.testErrorDiagnosis.failingFile,
|
|
76
|
-
suggestionForFix: testCase.steps.join("\n"),
|
|
77
|
-
});
|
|
78
|
-
testCase.steps = [requestedChangeResp.output];
|
|
79
|
-
// For "auto-fix" we use the user prompt (which is hard-coded in the dashboard
|
|
80
|
-
// entrypoints), and invoke more interesting enrichment
|
|
81
|
-
if (
|
|
82
|
-
// TODO: fix this hardcoding of user prompt - ideally its an auto fix intent
|
|
83
|
-
testCase.steps[0]?.toLowerCase().trim() == "can you please fix the test") {
|
|
84
|
-
const { task: updatedTask } = await (0, diagnosis_agent_1.createTaskUsingFailureDiagnosis)({
|
|
85
|
-
diagnosis: testGenConfig.testErrorDiagnosis,
|
|
86
|
-
});
|
|
87
|
-
if (updatedTask) {
|
|
88
|
-
testCase.steps = [updatedTask];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (!agent || agent === "auto") {
|
|
93
|
-
const { response } = await (0, infer_agent_1.inferAgentBasedTask)({
|
|
94
|
-
task: testCase.steps.join("\n"),
|
|
95
|
-
});
|
|
96
|
-
agent = response;
|
|
97
|
-
}
|
|
98
|
-
logger.success(`Generating test using ${agent} agent. ${process.env.LOG_URL ? `[view log](${process.env.LOG_URL})` : ""}`);
|
|
99
|
-
if (agent === "plan") {
|
|
100
|
-
const task = testCase.steps.join("\n");
|
|
101
|
-
const plan = await (0, run_3.planTask)({
|
|
102
|
-
task,
|
|
103
|
-
specPath,
|
|
104
|
-
});
|
|
105
|
-
new logger_1.CustomLogger({ useReporter: false }).log("Generated Plan:");
|
|
106
|
-
console.log(plan);
|
|
107
|
-
}
|
|
108
|
-
else if (agent === "code") {
|
|
109
|
-
await (0, run_2.generateTestWithCodegen)({
|
|
110
|
-
testCase,
|
|
111
|
-
file: specPath,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
const filePathToUpdate = await (0, utils_1.prepareFileForMasterAgent)({
|
|
116
|
-
testCase,
|
|
117
|
-
specPath,
|
|
118
|
-
});
|
|
119
|
-
const projectName = await (0, run_1.convertProjectsFilterToProject)({
|
|
120
|
-
pwProjectsFilter: testGenConfig.environment?.playwrightProjects,
|
|
121
|
-
repoDir: process.cwd(),
|
|
122
|
-
testFilePath: specPath,
|
|
123
|
-
});
|
|
124
|
-
const { isError, error } = await (0, run_1.runBrowsingAgent)({
|
|
125
|
-
testCaseName: testCase.name,
|
|
126
|
-
testCaseSuites: testCase.suites,
|
|
127
|
-
testFilePath: specPath,
|
|
128
|
-
filePathToUpdate,
|
|
129
|
-
projectName,
|
|
130
|
-
testGenToken,
|
|
131
|
-
repoDir: process.cwd(),
|
|
132
|
-
editFileWithGeneratedCode: true,
|
|
133
|
-
envOverrides: {},
|
|
134
|
-
});
|
|
135
|
-
if (isError) {
|
|
136
|
-
throw new Error(error);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return agent;
|
|
140
|
-
}
|
|
141
34
|
async function main() {
|
|
142
35
|
const rawMode = process.argv.includes("--raw");
|
|
143
36
|
if (!rawMode) {
|
|
144
|
-
await (0,
|
|
37
|
+
await (0, utils_1.printBanner)();
|
|
145
38
|
}
|
|
146
39
|
const program = new commander_1.Command();
|
|
147
40
|
program
|
|
@@ -208,9 +101,14 @@ async function main() {
|
|
|
208
101
|
.command("record")
|
|
209
102
|
.description("Record a new test case")
|
|
210
103
|
.option("--name <string>", "Name of the test case")
|
|
104
|
+
.option("--project <string>", "Playwright project to use")
|
|
105
|
+
.option("--url <string>", "Diagnosis URL to add pause statement to")
|
|
211
106
|
.action(async (opts) => {
|
|
212
|
-
|
|
213
|
-
|
|
107
|
+
await (0, recorder_1.runRecorder)({
|
|
108
|
+
testName: opts.name,
|
|
109
|
+
project: opts.project,
|
|
110
|
+
url: opts.url,
|
|
111
|
+
});
|
|
214
112
|
process.exit(0);
|
|
215
113
|
});
|
|
216
114
|
program
|
|
@@ -277,14 +175,20 @@ async function main() {
|
|
|
277
175
|
program
|
|
278
176
|
.command("chat-agent")
|
|
279
177
|
.description("Run the chat agent")
|
|
280
|
-
.option("--
|
|
281
|
-
.option("--use-disk
|
|
282
|
-
.option("--
|
|
178
|
+
.option("--model <model>", "LLM to use (gpt-5, claude-4 or gemini-2.5)")
|
|
179
|
+
.option("--use-disk", "Save and load chat state from disk")
|
|
180
|
+
.option("--prompt <string>", "String to pass as user prompt")
|
|
181
|
+
.option("--use-triage", "run the model in triage mode, different set of tools")
|
|
182
|
+
.option("--use-cache", "Use filesystem cache for LLM responses (Claude-only, and will disable streaming)")
|
|
183
|
+
.option("--reset-chat", "Clear any saved chat state (last-chat.json) before starting")
|
|
283
184
|
.action(async (options) => {
|
|
284
185
|
await runChatAgent({
|
|
285
|
-
modelInput: options.
|
|
286
|
-
useDiskForChatState: options.
|
|
287
|
-
|
|
186
|
+
modelInput: options.model,
|
|
187
|
+
useDiskForChatState: options.useDisk,
|
|
188
|
+
prompt: options.prompt,
|
|
189
|
+
useTriage: options.useTriage,
|
|
190
|
+
resetChat: options.resetChat,
|
|
191
|
+
useFSCache: options.useCache,
|
|
288
192
|
});
|
|
289
193
|
process.exit(0);
|
|
290
194
|
});
|
|
@@ -309,9 +213,8 @@ async function main() {
|
|
|
309
213
|
program
|
|
310
214
|
.command("github-token")
|
|
311
215
|
.description("Fetch GitHub token for a repository")
|
|
312
|
-
.option("--raw", "Print only the token with no additional output")
|
|
216
|
+
.option("--raw", "Print only the token with no additional output", false)
|
|
313
217
|
.action(async (opts) => {
|
|
314
|
-
const options = await (0, utils_2.validateAndCompleteCliOptions)(opts, ["raw"]);
|
|
315
218
|
let repoName = await (0, validation_1.validatePackageJson)(process.cwd());
|
|
316
219
|
if (!repoName) {
|
|
317
220
|
console.error("❌ Not a valid git repo with package.json. Run this command inside a project directory.");
|
|
@@ -322,7 +225,7 @@ async function main() {
|
|
|
322
225
|
params: { project_repo_name: repoName },
|
|
323
226
|
});
|
|
324
227
|
const { access_token } = data.data;
|
|
325
|
-
if (
|
|
228
|
+
if (opts.raw) {
|
|
326
229
|
console.log("username=x-access-token");
|
|
327
230
|
console.log(`password=${access_token}`);
|
|
328
231
|
}
|
|
@@ -332,42 +235,6 @@ async function main() {
|
|
|
332
235
|
}
|
|
333
236
|
process.exit(0);
|
|
334
237
|
});
|
|
335
|
-
program
|
|
336
|
-
.command("legacy")
|
|
337
|
-
.description("Run the legacy workflows")
|
|
338
|
-
.option("-t, --token <token>", "Test generation token")
|
|
339
|
-
.action(async (opts) => {
|
|
340
|
-
const options = await (0, utils_2.validateAndCompleteCliOptions)(opts);
|
|
341
|
-
const testGenConfig = options.token
|
|
342
|
-
? (0, scenarios_1.loadTestConfigs)(options.token)
|
|
343
|
-
: (0, scenarios_1.buildTestConfigFromOptions)(options);
|
|
344
|
-
const testGenToken = options.token
|
|
345
|
-
? options.token
|
|
346
|
-
: (0, scenarios_1.buildTokenFromOptions)(options);
|
|
347
|
-
if (testGenConfig.build?.url) {
|
|
348
|
-
// Download the build if repo has a download script
|
|
349
|
-
await (0, test_build_1.downloadBuild)({
|
|
350
|
-
buildUrl: testGenConfig.build.url,
|
|
351
|
-
repoPath: process.cwd(),
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
let testGenFailed = false;
|
|
355
|
-
try {
|
|
356
|
-
await runAgentsWorkflow(testGenConfig, testGenToken);
|
|
357
|
-
}
|
|
358
|
-
catch (e) {
|
|
359
|
-
testGenFailed = true;
|
|
360
|
-
new logger_1.CustomLogger().error(`Failed to generate test for the scenario. ${process.env.LOG_URL ? `[view log](${process.env.LOG_URL})` : ""}`, e?.message, e?.stack);
|
|
361
|
-
}
|
|
362
|
-
await (0, llm_1.flushAllTraces)();
|
|
363
|
-
await (0, logger_1.waitForLogsToFlush)();
|
|
364
|
-
if (testGenFailed) {
|
|
365
|
-
process.exit(1);
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
process.exit(0);
|
|
369
|
-
}
|
|
370
|
-
});
|
|
371
238
|
program.parse(process.argv);
|
|
372
239
|
}
|
|
373
240
|
main().catch((error) => {
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
import { SupportedChatModels } from "@empiricalrun/shared-types";
|
|
2
|
-
export declare const ARGS_TO_MODEL_MAP: Record<string, SupportedChatModels>;
|
|
3
|
-
export interface CLIOptions {
|
|
4
|
-
token?: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
file?: string;
|
|
7
|
-
prompt?: string;
|
|
8
|
-
suites?: string;
|
|
9
|
-
repoName?: string;
|
|
10
|
-
raw?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function validateAndCompleteCliOptions(options: CLIOptions, requiredFields?: string[]): Promise<CLIOptions>;
|
|
13
1
|
export declare function printBanner(): Promise<void>;
|
|
14
2
|
export declare function cleanUpGithubUrl(url: string): string;
|
|
15
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAeA,wBAAsB,WAAW,kBAgDhC;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,UAQ3C"}
|
package/dist/bin/utils/index.js
CHANGED
|
@@ -1,78 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ARGS_TO_MODEL_MAP = void 0;
|
|
7
|
-
exports.validateAndCompleteCliOptions = validateAndCompleteCliOptions;
|
|
8
3
|
exports.printBanner = printBanner;
|
|
9
4
|
exports.cleanUpGithubUrl = cleanUpGithubUrl;
|
|
10
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
11
5
|
const PACKAGE_NAME = "@empiricalrun/test-gen";
|
|
12
|
-
exports.ARGS_TO_MODEL_MAP = {
|
|
13
|
-
"claude-3-5": "claude-3-5-sonnet-20241022",
|
|
14
|
-
"claude-3-7": "claude-3-7-sonnet-20250219",
|
|
15
|
-
"claude-4": "claude-sonnet-4-20250514",
|
|
16
|
-
"claude-sonnet-4": "claude-sonnet-4-20250514",
|
|
17
|
-
"claude-opus-4": "claude-opus-4-20250514",
|
|
18
|
-
gemini: "gemini-2.5-pro",
|
|
19
|
-
"gemini-2.5": "gemini-2.5-pro",
|
|
20
|
-
"gemini-2.5-pro": "gemini-2.5-pro",
|
|
21
|
-
o3: "o3-2025-04-16",
|
|
22
|
-
"o3-2025-04-16": "o3-2025-04-16",
|
|
23
|
-
"o4-mini": "o4-mini-2025-04-16",
|
|
24
|
-
"o4-mini-2025-04-16": "o4-mini-2025-04-16",
|
|
25
|
-
};
|
|
26
|
-
async function validateAndCompleteCliOptions(options, requiredFields = ["name", "file", "prompt"]) {
|
|
27
|
-
// For existing flow between dashboard <> test-gen (via ci-worker)
|
|
28
|
-
const hasToken = !!options.token;
|
|
29
|
-
if (hasToken) {
|
|
30
|
-
return options;
|
|
31
|
-
}
|
|
32
|
-
const questions = [];
|
|
33
|
-
if (!options.name && requiredFields.includes("name")) {
|
|
34
|
-
questions.push({
|
|
35
|
-
type: "input",
|
|
36
|
-
name: "name",
|
|
37
|
-
message: "Enter the test name:",
|
|
38
|
-
validate: (input) => input.trim().length > 0 || "Test name is required",
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
if (!options.file && requiredFields.includes("file")) {
|
|
42
|
-
questions.push({
|
|
43
|
-
type: "input",
|
|
44
|
-
name: "file",
|
|
45
|
-
message: "Enter the test file path (inside tests dir):",
|
|
46
|
-
validate: (input) => input.trim().length > 0 || "Test file path is required",
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
if (!options.prompt && requiredFields.includes("prompt")) {
|
|
50
|
-
questions.push({
|
|
51
|
-
type: "editor",
|
|
52
|
-
name: "prompt",
|
|
53
|
-
message: "Enter the test prompt (opens in your editor):",
|
|
54
|
-
validate: (input) => input.trim().length > 0 || "Test prompt is required",
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
if (questions.length > 0) {
|
|
58
|
-
// Ask each question individually to avoid type issues
|
|
59
|
-
const answers = {};
|
|
60
|
-
for (const question of questions) {
|
|
61
|
-
const answer = await inquirer_1.default.prompt({
|
|
62
|
-
type: question.type,
|
|
63
|
-
name: "value",
|
|
64
|
-
message: question.message,
|
|
65
|
-
validate: question.validate,
|
|
66
|
-
});
|
|
67
|
-
answers[question.name] = answer.value;
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
...options,
|
|
71
|
-
...answers,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return options;
|
|
75
|
-
}
|
|
76
6
|
async function getLatestVersion(packageName) {
|
|
77
7
|
try {
|
|
78
8
|
const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
|
|
@@ -18,9 +18,9 @@ export declare function getTypescriptTestBlock({ scenarioName, suites, content,
|
|
|
18
18
|
testNode: Node | undefined;
|
|
19
19
|
testAlias: string;
|
|
20
20
|
};
|
|
21
|
-
export declare function hasTestBlock({ testName,
|
|
21
|
+
export declare function hasTestBlock({ testName, suites, filePath, }: {
|
|
22
22
|
testName: string;
|
|
23
|
-
|
|
23
|
+
suites: string[];
|
|
24
24
|
filePath: string;
|
|
25
25
|
}): boolean;
|
|
26
26
|
export declare function hasTopLevelDescribeConfigureWithSerialMode(filePath: string): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAM3D,OAAO,EAGL,IAAI,EAEJ,UAAU,EAEX,MAAM,UAAU,CAAC;AAMlB,eAAO,MAAM,gCAAgC,GAC3C,YAAY,UAAU,KACrB,MAgBF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,MAAM,EACN,OAAO,GACR,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG;IACF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB,CA2CA;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -93,14 +93,14 @@ function getTypescriptTestBlock({ scenarioName, suites, content, }) {
|
|
|
93
93
|
testAlias,
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function hasTestBlock({ testName,
|
|
96
|
+
function hasTestBlock({ testName, suites, filePath, }) {
|
|
97
97
|
if (!fs_1.default.existsSync(filePath)) {
|
|
98
98
|
return false;
|
|
99
99
|
}
|
|
100
100
|
const { testBlock } = getTypescriptTestBlock({
|
|
101
101
|
scenarioName: testName,
|
|
102
102
|
content: fs_1.default.readFileSync(filePath, "utf-8"),
|
|
103
|
-
suites
|
|
103
|
+
suites,
|
|
104
104
|
});
|
|
105
105
|
return Boolean(testBlock);
|
|
106
106
|
}
|
|
@@ -278,7 +278,9 @@ async function lintErrors(filePath) {
|
|
|
278
278
|
// TODO: use in new tools - return result/error?
|
|
279
279
|
const eslint = new eslint_1.ESLint({
|
|
280
280
|
fix: true,
|
|
281
|
-
|
|
281
|
+
// Had to comment this out with upgrade to eslint 9.30.0
|
|
282
|
+
// TODO: check if this is still needed with new tools/chat agent
|
|
283
|
+
// useEslintrc: true,
|
|
282
284
|
});
|
|
283
285
|
const [result] = await eslint.lintFiles(filePath);
|
|
284
286
|
if (result?.output) {
|
|
@@ -466,7 +468,7 @@ async function addUserContextFixture({ scenarioName, filePath, suites, }) {
|
|
|
466
468
|
try {
|
|
467
469
|
fixtureContent = fs_1.default.readFileSync("./tests/fixtures.ts", "utf-8");
|
|
468
470
|
}
|
|
469
|
-
catch
|
|
471
|
+
catch {
|
|
470
472
|
// do nothing
|
|
471
473
|
}
|
|
472
474
|
if (!fixtureContent || !fixtureContent.includes("userContext")) {
|
|
@@ -567,7 +569,7 @@ function isSyntaxValid(code) {
|
|
|
567
569
|
try {
|
|
568
570
|
(0, parser_1.parse)(code, { sourceType: "module", plugins: ["typescript"] }); // Attempt to parse the code
|
|
569
571
|
}
|
|
570
|
-
catch
|
|
572
|
+
catch {
|
|
571
573
|
isSyntaxValid = false;
|
|
572
574
|
}
|
|
573
575
|
return isSyntaxValid;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import type { TestGenConfig } from "@empiricalrun/shared-types";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
interface BrowserAgentOpts {
|
|
3
|
+
name?: string;
|
|
4
|
+
file?: string;
|
|
5
|
+
prompt?: string;
|
|
6
|
+
suites?: string;
|
|
7
|
+
repoName?: string;
|
|
8
|
+
raw?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function buildTokenFromOptions(options: BrowserAgentOpts, featureFlags?: {
|
|
4
11
|
useComputerUseAgent?: boolean;
|
|
5
12
|
}): string;
|
|
6
|
-
export declare function buildTestConfigFromOptions(options:
|
|
13
|
+
export declare function buildTestConfigFromOptions(options: BrowserAgentOpts): TestGenConfig;
|
|
7
14
|
export declare function loadTestConfigs(testGenToken: string): TestGenConfig;
|
|
15
|
+
export {};
|
|
8
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/utils/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,aAAa,EAEd,MAAM,4BAA4B,CAAC;AAEpC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/utils/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,aAAa,EAEd,MAAM,4BAA4B,CAAC;AAEpC,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAeD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,gBAAgB,EACzB,YAAY,CAAC,EAAE;IACb,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GACA,MAAM,CAqBR;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,gBAAgB,GACxB,aAAa,CAaf;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAmBnE"}
|
|
@@ -13,7 +13,6 @@ const action_tool_calls_1 = require("../agent/master/action-tool-calls");
|
|
|
13
13
|
path: path_1.default.resolve(__dirname, "./annotate-elements.js"),
|
|
14
14
|
});
|
|
15
15
|
const annotations = await page.evaluate(() => {
|
|
16
|
-
// eslint-disable-next-line no-undef
|
|
17
16
|
const { annotations } = annotateElementsWithPreference();
|
|
18
17
|
return Object.entries(annotations).map(([, config]) => ({
|
|
19
18
|
innerText: config.node.innerText,
|
|
@@ -55,7 +54,6 @@ const action_tool_calls_1 = require("../agent/master/action-tool-calls");
|
|
|
55
54
|
path: path_1.default.resolve(__dirname, "./annotate-elements.js"),
|
|
56
55
|
});
|
|
57
56
|
const annotations = await page.evaluate(() => {
|
|
58
|
-
// eslint-disable-next-line no-undef
|
|
59
57
|
const { annotations } = annotateElementsWithPreference();
|
|
60
58
|
return Object.entries(annotations).map(([hint, config]) => ({
|
|
61
59
|
hint,
|
|
@@ -143,7 +141,6 @@ const action_tool_calls_1 = require("../agent/master/action-tool-calls");
|
|
|
143
141
|
actionType: action_tool_calls_1.ActionType.FILL,
|
|
144
142
|
};
|
|
145
143
|
const annotations = await page.evaluate((preference) => {
|
|
146
|
-
// eslint-disable-next-line no-undef
|
|
147
144
|
const { annotations } = annotateElementsWithPreference({
|
|
148
145
|
preference: preference,
|
|
149
146
|
});
|
|
@@ -168,7 +165,6 @@ const action_tool_calls_1 = require("../agent/master/action-tool-calls");
|
|
|
168
165
|
assertionText: "What are you teaching today?",
|
|
169
166
|
};
|
|
170
167
|
const annotations = await page.evaluate((preference) => {
|
|
171
|
-
// eslint-disable-next-line no-undef
|
|
172
168
|
const { annotations } = annotateElementsWithPreference({
|
|
173
169
|
preference: preference,
|
|
174
170
|
});
|
|
@@ -191,7 +187,6 @@ const action_tool_calls_1 = require("../agent/master/action-tool-calls");
|
|
|
191
187
|
path: path_1.default.resolve(__dirname, "./annotate-elements.js"),
|
|
192
188
|
});
|
|
193
189
|
const annotations = await page.evaluate(() => {
|
|
194
|
-
// eslint-disable-next-line no-undef
|
|
195
190
|
const { annotations } = annotateElementsWithPreference();
|
|
196
191
|
return Object.entries(annotations).map(([hint, config]) => ({
|
|
197
192
|
hint,
|
|
@@ -18,7 +18,6 @@ test("should annotate all links on empirical landing page", async ({
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
const annotations = await page.evaluate(() => {
|
|
21
|
-
// eslint-disable-next-line no-undef
|
|
22
21
|
const { annotations } = annotateElementsWithPreference();
|
|
23
22
|
|
|
24
23
|
return Object.entries(annotations).map(([, config]) => ({
|
|
@@ -69,7 +68,6 @@ test("should annotate all important items on quizizz page", async ({
|
|
|
69
68
|
});
|
|
70
69
|
|
|
71
70
|
const annotations = await page.evaluate(() => {
|
|
72
|
-
// eslint-disable-next-line no-undef
|
|
73
71
|
const { annotations } = annotateElementsWithPreference();
|
|
74
72
|
|
|
75
73
|
return Object.entries(annotations).map(([hint, config]) => ({
|
|
@@ -251,7 +249,6 @@ test("should only annotate input fields on quizizz page", async ({ page }) => {
|
|
|
251
249
|
actionType: ActionType.FILL,
|
|
252
250
|
};
|
|
253
251
|
const annotations = await page.evaluate((preference) => {
|
|
254
|
-
// eslint-disable-next-line no-undef
|
|
255
252
|
const { annotations } = annotateElementsWithPreference({
|
|
256
253
|
preference: preference,
|
|
257
254
|
});
|
|
@@ -283,7 +280,6 @@ test("should only annotate given text on quizziz page", async ({ page }) => {
|
|
|
283
280
|
assertionText: "What are you teaching today?",
|
|
284
281
|
};
|
|
285
282
|
const annotations = await page.evaluate((preference) => {
|
|
286
|
-
// eslint-disable-next-line no-undef
|
|
287
283
|
const { annotations } = annotateElementsWithPreference({
|
|
288
284
|
preference: preference,
|
|
289
285
|
});
|
|
@@ -314,7 +310,6 @@ test("should not annotate children that don't have onClick handler", async ({
|
|
|
314
310
|
});
|
|
315
311
|
|
|
316
312
|
const annotations = await page.evaluate(() => {
|
|
317
|
-
// eslint-disable-next-line no-undef
|
|
318
313
|
const { annotations } = annotateElementsWithPreference();
|
|
319
314
|
|
|
320
315
|
return Object.entries(annotations).map(([hint, config]) => ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDashboardAPIClient, RequestOptions } from "@empiricalrun/shared-types";
|
|
2
|
-
type AuthenticationType = "user-access-token" | "project-api-key" | "admin-totp";
|
|
2
|
+
export type AuthenticationType = "user-access-token" | "project-api-key" | "admin-totp";
|
|
3
3
|
export declare class DashboardAPIClient implements IDashboardAPIClient {
|
|
4
4
|
private baseUrl;
|
|
5
5
|
private authType;
|
|
@@ -17,10 +17,10 @@ export declare class DashboardAPIClient implements IDashboardAPIClient {
|
|
|
17
17
|
url: string;
|
|
18
18
|
body?: any;
|
|
19
19
|
}): Promise<T>;
|
|
20
|
+
getBaseUrl(): string;
|
|
20
21
|
ensureUserIsAuthenticated(): Promise<void>;
|
|
21
22
|
private _makeRequest;
|
|
22
23
|
private refreshUserToken;
|
|
23
24
|
}
|
|
24
25
|
export declare const apiClient: DashboardAPIClient;
|
|
25
|
-
export {};
|
|
26
26
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/dashboard/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,cAAc,EACf,MAAM,4BAA4B,CAAC;AAapC,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/dashboard/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,cAAc,EACf,MAAM,4BAA4B,CAAC;AAapC,MAAM,MAAM,kBAAkB,GAC1B,mBAAmB,GACnB,iBAAiB,GACjB,YAAY,CAAC;AAEjB,qBAAa,kBAAmB,YAAW,mBAAmB;IAC5D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,SAAS,CAAC,CAAS;gBAEf,EACV,QAAQ,EACR,aAAa,EACb,SAAS,EACT,OAAO,GACR,EAAE;QACD,QAAQ,EAAE,kBAAkB,CAAC;QAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;IAsBK,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAmDjE,eAAe,CAAC,CAAC,EAAE,EACvB,MAAM,EACN,GAAG,EACH,IAAI,GACL,EAAE;QACD,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;QACpD,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE,GAAG,CAAC;KACZ,GAAG,OAAO,CAAC,CAAC,CAAC;IAYd,UAAU,IAAI,MAAM;IAId,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC;YAelC,YAAY;YAmDZ,gBAAgB;CAyC/B;AAED,eAAO,MAAM,SAAS,oBAEpB,CAAC"}
|
package/dist/dashboard/client.js
CHANGED
|
@@ -87,6 +87,9 @@ class DashboardAPIClient {
|
|
|
87
87
|
body: requestBody,
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
+
getBaseUrl() {
|
|
91
|
+
return this.baseUrl;
|
|
92
|
+
}
|
|
90
93
|
async ensureUserIsAuthenticated() {
|
|
91
94
|
if (!(await (0, token_store_1.isAuthenticated)())) {
|
|
92
95
|
const tokens = await (0, token_store_1.getStoredUserTokens)();
|
|
@@ -120,7 +123,7 @@ class DashboardAPIClient {
|
|
|
120
123
|
});
|
|
121
124
|
if (!response.ok) {
|
|
122
125
|
let error;
|
|
123
|
-
const msg = `HTTP error in ${method} request to ${url}! Status code: ${response.status}`;
|
|
126
|
+
const msg = `HTTP error in ${method} request to ${url}! Status code: ${response.status}. Response: ${await response.text()}`;
|
|
124
127
|
if (response.status < 500) {
|
|
125
128
|
// Don't retry for status codes less than 500 (client errors)
|
|
126
129
|
error = new types_1.NonRetryableHTTPError(msg, response.status);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ToolResult } from "@empiricalrun/shared-types";
|
|
2
|
+
import { type StrReplaceInputParams } from "../../../tools/file-operations/shared/helpers";
|
|
3
|
+
export { getFileInfoFromFS } from "./reader";
|
|
4
|
+
export declare function viewFileUsingFileSystem({ input, filePath, absoluteFilePath, }: {
|
|
5
|
+
input: StrReplaceInputParams;
|
|
6
|
+
filePath: string;
|
|
7
|
+
absoluteFilePath: string;
|
|
8
|
+
}): Promise<ToolResult>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/file-info/adapters/file-system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,wBAAsB,uBAAuB,CAAC,EAC5C,KAAK,EACL,QAAQ,EACR,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,UAAU,CAAC,CAmBtB"}
|