@empiricalrun/test-gen 0.77.0 → 0.78.1
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 +25 -0
- package/dist/actions/index.d.ts +0 -1
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +0 -10
- package/dist/agent/base/index.d.ts +28 -19
- package/dist/agent/base/index.d.ts.map +1 -1
- package/dist/agent/base/index.js +30 -17
- package/dist/agent/browsing/run.d.ts +1 -1
- package/dist/agent/browsing/run.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.d.ts +5 -5
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/exports.d.ts +3 -3
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +5 -11
- package/dist/agent/chat/index.d.ts +4 -3
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +10 -5
- package/dist/agent/chat/models.d.ts +1 -1
- package/dist/agent/chat/models.d.ts.map +1 -1
- package/dist/agent/chat/models.js +3 -3
- package/dist/agent/chat/prompt/pw-utils-docs.d.ts +1 -1
- package/dist/agent/chat/prompt/pw-utils-docs.d.ts.map +1 -1
- package/dist/agent/chat/prompt/pw-utils-docs.js +42 -0
- package/dist/agent/chat/prompt/repo.d.ts +2 -2
- package/dist/agent/chat/prompt/repo.d.ts.map +1 -1
- package/dist/agent/chat/prompt/repo.js +2 -2
- package/dist/agent/chat/state.d.ts +13 -25
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +10 -60
- package/dist/agent/chat/utils.d.ts +5 -5
- package/dist/agent/chat/utils.d.ts.map +1 -1
- package/dist/agent/cli.d.ts +2 -2
- package/dist/agent/cli.d.ts.map +1 -1
- package/dist/agent/cli.js +17 -31
- package/dist/agent/code-review/index.d.ts +5 -4
- package/dist/agent/code-review/index.d.ts.map +1 -1
- package/dist/agent/code-review/index.js +13 -4
- package/dist/agent/code-review/types.d.ts +2 -35
- package/dist/agent/code-review/types.d.ts.map +1 -1
- package/dist/agent/code-review/types.js +4 -11
- package/dist/agent/cua/index.d.ts +1 -1
- package/dist/agent/cua/index.d.ts.map +1 -1
- package/dist/agent/cua/index.js +13 -5
- package/dist/agent/cua/pw-codegen/pw-pause/for-recorder.d.ts.map +1 -1
- package/dist/agent/cua/pw-codegen/pw-pause/for-recorder.js +0 -3
- package/dist/agent/cua/pw-codegen/pw-pause/index.js +1 -1
- package/dist/agent/index.d.ts +1 -5
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -11
- package/dist/agent/master/element-annotation.d.ts +1 -1
- package/dist/agent/master/element-annotation.d.ts.map +1 -1
- package/dist/agent/master/next-action.d.ts +1 -1
- package/dist/agent/master/next-action.d.ts.map +1 -1
- package/dist/agent/master/next-action.js +1 -6
- package/dist/agent/master/run.d.ts +3 -2
- package/dist/agent/master/run.d.ts.map +1 -1
- package/dist/agent/master/run.js +0 -26
- package/dist/agent/triage/index.d.ts +4 -3
- package/dist/agent/triage/index.d.ts.map +1 -1
- package/dist/agent/triage/index.js +35 -29
- package/dist/artifacts/index.d.ts +1 -1
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/utils.d.ts +1 -1
- package/dist/artifacts/utils.d.ts.map +1 -1
- package/dist/bin/environments.d.ts +1 -1
- package/dist/bin/environments.d.ts.map +1 -1
- package/dist/bin/index.js +2 -57
- package/dist/bin/setup.d.ts +1 -1
- package/dist/bin/setup.d.ts.map +1 -1
- package/dist/bin/utils/fs/index.d.ts +1 -1
- package/dist/bin/utils/fs/index.d.ts.map +1 -1
- 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 +1 -1
- package/dist/bin/utils/scenarios/index.d.ts +1 -1
- package/dist/bin/utils/scenarios/index.d.ts.map +1 -1
- package/dist/constants/index.d.ts +0 -4
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +0 -6
- package/dist/dashboard/client.d.ts +1 -1
- package/dist/dashboard/client.d.ts.map +1 -1
- package/dist/dashboard/index.d.ts +1 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -1
- package/dist/dashboard/tool-response.d.ts +5 -0
- package/dist/dashboard/tool-response.d.ts.map +1 -0
- package/dist/dashboard/tool-response.js +88 -0
- package/dist/dashboard/totp.js +1 -1
- package/dist/file/server.d.ts +1 -1
- package/dist/file/server.d.ts.map +1 -1
- package/dist/file/server.js +2 -1
- package/dist/file-info/adapters/file-system/index.d.ts +1 -1
- package/dist/file-info/adapters/file-system/index.d.ts.map +1 -1
- package/dist/file-info/adapters/file-system/reader.d.ts +1 -1
- package/dist/file-info/adapters/file-system/reader.d.ts.map +1 -1
- package/dist/file-info/adapters/github/index.d.ts +2 -1
- package/dist/file-info/adapters/github/index.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.d.ts +2 -1
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
- package/dist/recorder/index.d.ts.map +1 -1
- package/dist/recorder/index.js +2 -1
- package/dist/recorder/upload.d.ts +1 -1
- package/dist/recorder/upload.d.ts.map +1 -1
- package/dist/tools/analyse-video/index.d.ts +1 -1
- package/dist/tools/analyse-video/index.d.ts.map +1 -1
- package/dist/tools/analyse-video/index.js +28 -15
- package/dist/tools/create-pull-request/index.d.ts +1 -1
- package/dist/tools/create-pull-request/index.d.ts.map +1 -1
- package/dist/tools/create-pull-request/utils.d.ts +2 -1
- package/dist/tools/create-pull-request/utils.d.ts.map +1 -1
- package/dist/tools/definitions/analyse-video.d.ts +9 -19
- package/dist/tools/definitions/analyse-video.d.ts.map +1 -1
- package/dist/tools/definitions/analyse-video.js +13 -26
- package/dist/tools/definitions/delete-file.d.ts +9 -1
- package/dist/tools/definitions/delete-file.d.ts.map +1 -1
- package/dist/tools/definitions/delete-file.js +3 -3
- package/dist/tools/definitions/download-build.d.ts +1 -1
- package/dist/tools/definitions/download-build.d.ts.map +1 -1
- package/dist/tools/definitions/grep.d.ts +1 -1
- package/dist/tools/definitions/grep.d.ts.map +1 -1
- package/dist/tools/definitions/list-tests-and-projects.d.ts +1 -1
- package/dist/tools/definitions/list-tests-and-projects.d.ts.map +1 -1
- package/dist/tools/definitions/list-tests-and-projects.js +1 -1
- package/dist/tools/definitions/merge-conflicts.d.ts +1 -1
- package/dist/tools/definitions/merge-conflicts.d.ts.map +1 -1
- package/dist/tools/definitions/merge-conflicts.js +2 -2
- package/dist/tools/definitions/rename-file.d.ts +1 -1
- package/dist/tools/definitions/rename-file.d.ts.map +1 -1
- package/dist/tools/definitions/review-pull-request.d.ts +1 -1
- package/dist/tools/definitions/review-pull-request.d.ts.map +1 -1
- package/dist/tools/definitions/review-pull-request.js +1 -1
- package/dist/tools/definitions/run-test.d.ts +1 -1
- package/dist/tools/definitions/run-test.d.ts.map +1 -1
- package/dist/tools/definitions/str_replace_editor.d.ts +1 -1
- package/dist/tools/definitions/str_replace_editor.d.ts.map +1 -1
- package/dist/tools/definitions/test-gen-browser.d.ts +1 -1
- package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/definitions/upgrade-packages.d.ts +1 -1
- package/dist/tools/definitions/upgrade-packages.d.ts.map +1 -1
- package/dist/tools/definitions/utils.js +1 -1
- package/dist/tools/delete-file/index.d.ts +1 -1
- package/dist/tools/delete-file/index.d.ts.map +1 -1
- package/dist/tools/delete-file/index.js +6 -2
- package/dist/tools/diagnosis-fetcher.d.ts +1 -1
- package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
- package/dist/tools/diagnosis-fetcher.js +92 -47
- package/dist/tools/download-build/index.d.ts +1 -1
- package/dist/tools/download-build/index.d.ts.map +1 -1
- package/dist/tools/executor/base.d.ts +4 -3
- package/dist/tools/executor/base.d.ts.map +1 -1
- package/dist/tools/executor/base.js +16 -2
- package/dist/tools/executor/index.d.ts +3 -0
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +10 -10
- package/dist/tools/executor/utils/checkpoint.d.ts.map +1 -1
- package/dist/tools/executor/utils/checkpoint.js +0 -4
- package/dist/tools/executor/utils/git.d.ts +7 -1
- package/dist/tools/executor/utils/git.d.ts.map +1 -1
- package/dist/tools/executor/utils/git.js +10 -3
- package/dist/tools/executor/utils/index.d.ts +4 -3
- package/dist/tools/executor/utils/index.d.ts.map +1 -1
- package/dist/tools/executor/utils/index.js +2 -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-file/index.d.ts +1 -1
- package/dist/tools/fetch-file/index.d.ts.map +1 -1
- package/dist/tools/fetch-file/index.js +53 -13
- package/dist/tools/fetch-file/utils.d.ts +3 -0
- package/dist/tools/fetch-file/utils.d.ts.map +1 -0
- package/dist/tools/fetch-file/utils.js +136 -0
- package/dist/tools/fetch-session-diff/index.d.ts +1 -1
- package/dist/tools/fetch-session-diff/index.d.ts.map +1 -1
- package/dist/tools/fetch-session-diff/index.js +26 -2
- package/dist/tools/file-operations/create.d.ts +1 -1
- package/dist/tools/file-operations/create.d.ts.map +1 -1
- package/dist/tools/file-operations/index.d.ts +2 -1
- package/dist/tools/file-operations/index.d.ts.map +1 -1
- package/dist/tools/file-operations/insert.d.ts +1 -1
- package/dist/tools/file-operations/insert.d.ts.map +1 -1
- package/dist/tools/file-operations/replace.d.ts +1 -1
- package/dist/tools/file-operations/replace.d.ts.map +1 -1
- package/dist/tools/file-operations/replace.js +20 -22
- package/dist/tools/file-operations/shared/helpers.d.ts +3 -5
- package/dist/tools/file-operations/shared/helpers.d.ts.map +1 -1
- package/dist/tools/file-operations/shared/helpers.js +1 -5
- package/dist/tools/file-operations/view/index.d.ts +2 -1
- package/dist/tools/file-operations/view/index.d.ts.map +1 -1
- package/dist/tools/grep/index.d.ts +1 -1
- package/dist/tools/grep/index.d.ts.map +1 -1
- package/dist/tools/grep/index.js +15 -12
- package/dist/tools/index.d.ts +3 -24
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +13 -42
- package/dist/tools/issues-v1/create-issue.d.ts +3 -0
- package/dist/tools/issues-v1/create-issue.d.ts.map +1 -0
- package/dist/tools/{issues → issues-v1}/create-issue.js +5 -9
- package/dist/tools/issues-v1/index.d.ts.map +1 -0
- package/dist/tools/issues-v1/list-issues.d.ts +3 -0
- package/dist/tools/issues-v1/list-issues.d.ts.map +1 -0
- package/dist/tools/issues-v1/update-issue.d.ts +3 -0
- package/dist/tools/issues-v1/update-issue.d.ts.map +1 -0
- package/dist/tools/{issues → issues-v1}/update-issue.js +1 -9
- package/dist/tools/{issues → issues-v1}/utils.d.ts +2 -1
- package/dist/tools/issues-v1/utils.d.ts.map +1 -0
- package/dist/tools/issues-v2/create-issue.d.ts +3 -0
- package/dist/tools/issues-v2/create-issue.d.ts.map +1 -0
- package/dist/tools/issues-v2/create-issue.js +86 -0
- package/dist/tools/issues-v2/update-issue.d.ts +3 -0
- package/dist/tools/issues-v2/update-issue.d.ts.map +1 -0
- package/dist/tools/issues-v2/update-issue.js +87 -0
- package/dist/tools/list-environments.d.ts +1 -1
- package/dist/tools/list-environments.d.ts.map +1 -1
- package/dist/tools/list-tests-and-projects/index.d.ts +1 -1
- package/dist/tools/list-tests-and-projects/index.d.ts.map +1 -1
- package/dist/tools/list-tests-and-projects/index.js +14 -4
- package/dist/tools/merge-conflicts/index.d.ts +1 -1
- package/dist/tools/merge-conflicts/index.d.ts.map +1 -1
- package/dist/tools/merge-conflicts/index.js +23 -10
- package/dist/tools/rename-file/index.d.ts +1 -1
- package/dist/tools/rename-file/index.d.ts.map +1 -1
- package/dist/tools/rename-file/index.js +0 -1
- package/dist/tools/review-pull-request/index.d.ts +1 -1
- package/dist/tools/review-pull-request/index.d.ts.map +1 -1
- package/dist/tools/review-pull-request/index.js +9 -15
- package/dist/tools/run-test.d.ts +1 -1
- package/dist/tools/run-test.d.ts.map +1 -1
- package/dist/tools/test-gen-browser.d.ts +1 -1
- package/dist/tools/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/test-gen-browser.js +55 -19
- package/dist/tools/test-run-fetcher/index.d.ts +2 -2
- package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
- package/dist/tools/test-run-fetcher/index.js +67 -66
- package/dist/tools/trace-dot-zip/index.d.ts +1 -1
- package/dist/tools/trace-dot-zip/index.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/utils/network-trace.js +5 -10
- package/dist/tools/triage-summary/index.d.ts +1 -1
- package/dist/tools/triage-summary/index.d.ts.map +1 -1
- package/dist/tools/triage-summary/index.js +5 -2
- package/dist/tools/triage-summary/utils.d.ts +1 -1
- package/dist/tools/triage-summary/utils.d.ts.map +1 -1
- package/dist/tools/upgrade-packages/index.d.ts +1 -1
- package/dist/tools/upgrade-packages/index.d.ts.map +1 -1
- package/dist/tools/upgrade-packages/index.js +18 -8
- package/dist/tools/upgrade-packages/utils.d.ts +10 -5
- package/dist/tools/upgrade-packages/utils.d.ts.map +1 -1
- package/dist/tools/upgrade-packages/utils.js +57 -16
- package/dist/tools/utils/queue.d.ts +1 -1
- package/dist/tools/utils/queue.d.ts.map +1 -1
- package/dist/tools/utils/validate-schema.d.ts +3 -0
- package/dist/tools/utils/validate-schema.d.ts.map +1 -0
- package/dist/tools/utils/validate-schema.js +22 -0
- package/dist/trace-utils/index.d.ts +1 -1
- package/dist/trace-utils/index.d.ts.map +1 -1
- package/dist/trace-utils/index.js +1 -1
- package/dist/utils/SQSClient.d.ts +1 -1
- package/dist/utils/SQSClient.d.ts.map +1 -1
- package/dist/utils/dedup/dedup-image.d.ts +22 -0
- package/dist/utils/dedup/dedup-image.d.ts.map +1 -0
- package/dist/utils/dedup/dedup-image.js +26 -0
- package/dist/utils/dedup/find-threshold.d.ts +2 -0
- package/dist/utils/dedup/find-threshold.d.ts.map +1 -0
- package/dist/utils/{find-threshold.js → dedup/find-threshold.js} +2 -15
- package/dist/utils/model.d.ts +1 -1
- package/dist/utils/model.d.ts.map +1 -1
- package/dist/utils/model.js +4 -3
- package/dist/utils/playwright-report-parser.d.ts +1 -1
- package/dist/utils/playwright-report-parser.d.ts.map +1 -1
- package/dist/utils/playwright-test-id.d.ts +8 -0
- package/dist/utils/playwright-test-id.d.ts.map +1 -0
- package/dist/utils/playwright-test-id.js +21 -0
- package/dist/utils/repo-tree.d.ts +1 -1
- package/dist/utils/repo-tree.d.ts.map +1 -1
- package/dist/utils/slug.d.ts.map +1 -1
- package/dist/utils/slug.js +15 -4
- package/dist/utils/url-validation.d.ts +2 -0
- package/dist/utils/url-validation.d.ts.map +1 -0
- package/dist/utils/url-validation.js +16 -0
- package/dist/video-core/index.d.ts +14 -36
- package/dist/video-core/index.d.ts.map +1 -1
- package/dist/video-core/index.js +118 -181
- package/dist/video-core/model-limits.d.ts +2 -2
- package/dist/video-core/model-limits.d.ts.map +1 -1
- package/dist/video-core/model-limits.js +16 -20
- package/dist/video-core/storage-manager.d.ts +2 -1
- package/dist/video-core/storage-manager.d.ts.map +1 -1
- package/dist/video-core/storage-manager.js +13 -6
- package/dist/video-core/types.d.ts +1 -1
- package/dist/video-core/types.d.ts.map +1 -1
- package/dist/video-core/utils.d.ts +5 -17
- package/dist/video-core/utils.d.ts.map +1 -1
- package/dist/video-core/utils.js +39 -149
- package/package.json +10 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/actions/skill.d.ts +0 -21
- package/dist/actions/skill.d.ts.map +0 -1
- package/dist/actions/skill.js +0 -127
- package/dist/agent/chat/filesystem-cache.d.ts +0 -12
- package/dist/agent/chat/filesystem-cache.d.ts.map +0 -1
- package/dist/agent/chat/filesystem-cache.js +0 -101
- package/dist/agent/codegen/create-test-block.d.ts +0 -8
- package/dist/agent/codegen/create-test-block.d.ts.map +0 -1
- package/dist/agent/codegen/create-test-block.js +0 -47
- package/dist/agent/codegen/fix-ts-errors.d.ts +0 -12
- package/dist/agent/codegen/fix-ts-errors.d.ts.map +0 -1
- package/dist/agent/codegen/fix-ts-errors.js +0 -78
- package/dist/agent/codegen/lexical-scoped-vars.d.ts +0 -9
- package/dist/agent/codegen/lexical-scoped-vars.d.ts.map +0 -1
- package/dist/agent/codegen/lexical-scoped-vars.js +0 -55
- package/dist/agent/codegen/skills-retriever.d.ts +0 -26
- package/dist/agent/codegen/skills-retriever.d.ts.map +0 -1
- package/dist/agent/codegen/skills-retriever.js +0 -93
- package/dist/agent/codegen/test-update-feedback.d.ts +0 -12
- package/dist/agent/codegen/test-update-feedback.d.ts.map +0 -1
- package/dist/agent/codegen/test-update-feedback.js +0 -49
- package/dist/agent/codegen/types.d.ts +0 -25
- package/dist/agent/codegen/types.d.ts.map +0 -1
- package/dist/agent/codegen/types.js +0 -8
- package/dist/agent/codegen/update-flow.d.ts +0 -36
- package/dist/agent/codegen/update-flow.d.ts.map +0 -1
- package/dist/agent/codegen/update-flow.js +0 -259
- package/dist/agent/codegen/use-skill.d.ts +0 -11
- package/dist/agent/codegen/use-skill.d.ts.map +0 -1
- package/dist/agent/codegen/use-skill.js +0 -53
- package/dist/agent/codegen/utils.d.ts +0 -110
- package/dist/agent/codegen/utils.d.ts.map +0 -1
- package/dist/agent/codegen/utils.js +0 -376
- package/dist/agent/master/browser-tests/skills.spec.d.ts +0 -2
- package/dist/agent/master/browser-tests/skills.spec.d.ts.map +0 -1
- package/dist/agent/master/browser-tests/skills.spec.js +0 -112
- package/dist/agent/master/execute-skill-action.d.ts +0 -11
- package/dist/agent/master/execute-skill-action.d.ts.map +0 -1
- package/dist/agent/master/execute-skill-action.js +0 -23
- package/dist/agent/video-analysis/executor/index.d.ts +0 -5
- package/dist/agent/video-analysis/executor/index.d.ts.map +0 -1
- package/dist/agent/video-analysis/executor/index.js +0 -10
- package/dist/agent/video-analysis/index.d.ts +0 -7
- package/dist/agent/video-analysis/index.d.ts.map +0 -1
- package/dist/agent/video-analysis/index.js +0 -60
- package/dist/evals/append-create-test-agent.evals.d.ts +0 -4
- package/dist/evals/append-create-test-agent.evals.d.ts.map +0 -1
- package/dist/evals/append-create-test-agent.evals.js +0 -117
- package/dist/evals/fetch-pom-skills-agent.evals.d.ts +0 -4
- package/dist/evals/fetch-pom-skills-agent.evals.d.ts.map +0 -1
- package/dist/evals/fetch-pom-skills-agent.evals.js +0 -36
- package/dist/evals/master-agent.evals.d.ts +0 -4
- package/dist/evals/master-agent.evals.d.ts.map +0 -1
- package/dist/evals/master-agent.evals.js +0 -35
- package/dist/evals/type.d.ts +0 -12
- package/dist/evals/type.d.ts.map +0 -1
- package/dist/evals/type.js +0 -2
- package/dist/evals/update-scenario-agent.evals.d.ts +0 -4
- package/dist/evals/update-scenario-agent.evals.d.ts.map +0 -1
- package/dist/evals/update-scenario-agent.evals.js +0 -47
- package/dist/tools/fetch-last-successful-test-run/index.d.ts +0 -3
- package/dist/tools/fetch-last-successful-test-run/index.d.ts.map +0 -1
- package/dist/tools/fetch-last-successful-test-run/index.js +0 -60
- package/dist/tools/issues/create-issue.d.ts +0 -3
- package/dist/tools/issues/create-issue.d.ts.map +0 -1
- package/dist/tools/issues/index.d.ts.map +0 -1
- package/dist/tools/issues/list-issues.d.ts +0 -3
- package/dist/tools/issues/list-issues.d.ts.map +0 -1
- package/dist/tools/issues/metadata-schema.d.ts +0 -24
- package/dist/tools/issues/metadata-schema.d.ts.map +0 -1
- package/dist/tools/issues/metadata-schema.js +0 -22
- package/dist/tools/issues/update-issue.d.ts +0 -3
- package/dist/tools/issues/update-issue.d.ts.map +0 -1
- package/dist/tools/issues/utils.d.ts.map +0 -1
- package/dist/tools/utils/urls.d.ts +0 -5
- package/dist/tools/utils/urls.d.ts.map +0 -1
- package/dist/tools/utils/urls.js +0 -19
- package/dist/tools/view-failed-test-run-report/index.d.ts +0 -12
- package/dist/tools/view-failed-test-run-report/index.d.ts.map +0 -1
- package/dist/tools/view-failed-test-run-report/index.js +0 -151
- package/dist/utils/artifact-paths.d.ts +0 -20
- package/dist/utils/artifact-paths.d.ts.map +0 -1
- package/dist/utils/artifact-paths.js +0 -16
- package/dist/utils/dedup-image-fs.d.ts +0 -13
- package/dist/utils/dedup-image-fs.d.ts.map +0 -1
- package/dist/utils/dedup-image-fs.js +0 -84
- package/dist/utils/dedup-image.d.ts +0 -12
- package/dist/utils/dedup-image.d.ts.map +0 -1
- package/dist/utils/dedup-image.js +0 -25
- package/dist/utils/ffmpeg/index.d.ts +0 -26
- package/dist/utils/ffmpeg/index.d.ts.map +0 -1
- package/dist/utils/ffmpeg/index.js +0 -415
- package/dist/utils/find-threshold.d.ts +0 -8
- package/dist/utils/find-threshold.d.ts.map +0 -1
- package/dist/video-core/agent-orchestrator.d.ts +0 -14
- package/dist/video-core/agent-orchestrator.d.ts.map +0 -1
- package/dist/video-core/agent-orchestrator.js +0 -78
- package/dist/video-core/analysis-server.d.ts +0 -24
- package/dist/video-core/analysis-server.d.ts.map +0 -1
- package/dist/video-core/analysis-server.js +0 -398
- package/dist/video-core/analysis-viewer.html +0 -1374
- package/dist/video-core/xml-parser.d.ts +0 -3
- package/dist/video-core/xml-parser.d.ts.map +0 -1
- package/dist/video-core/xml-parser.js +0 -27
- /package/dist/tools/{issues → issues-v1}/index.d.ts +0 -0
- /package/dist/tools/{issues → issues-v1}/index.js +0 -0
- /package/dist/tools/{issues → issues-v1}/list-issues.js +0 -0
- /package/dist/tools/{issues → issues-v1}/utils.js +0 -0
|
@@ -1,45 +1,59 @@
|
|
|
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
3
|
exports.fetchDiagnosisReportTool = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
4
|
const zod_1 = require("zod");
|
|
9
|
-
const
|
|
5
|
+
const playwright_report_parser_1 = require("../utils/playwright-report-parser");
|
|
10
6
|
const DiagnosisSchema = zod_1.z.object({
|
|
11
|
-
|
|
7
|
+
diagnosisId: zod_1.z
|
|
12
8
|
.string()
|
|
13
|
-
.describe("
|
|
9
|
+
.describe("12 character random string that identifies a failing test case in a test run"),
|
|
14
10
|
});
|
|
15
11
|
exports.fetchDiagnosisReportTool = {
|
|
16
12
|
schema: {
|
|
17
13
|
name: "fetchDiagnosisDetails",
|
|
18
|
-
description:
|
|
14
|
+
description: `Fetch details about a failed test case using its URL or slug.
|
|
15
|
+
This tool returns error stack, failing line, across multiple retries (generally, 3) for the
|
|
16
|
+
test case in a particular test run (identified by an id, like #3450).
|
|
17
|
+
|
|
18
|
+
## How to use this tool?
|
|
19
|
+
- The input to this tool is a diagnosis identifier, which is random 12 character string (e.g byynrPjCml57).
|
|
20
|
+
Internally, this string is generated by nanoid.
|
|
21
|
+
|
|
22
|
+
- To get this diagnosis id, you can interpret incoming URLs that contain this id.
|
|
23
|
+
|
|
24
|
+
### URL format 1
|
|
25
|
+
|
|
26
|
+
https://dash.empirical.run/<project-name>/test-runs/34548?detail=ULRHHNwiGZ2W
|
|
27
|
+
|
|
28
|
+
In the above, the test run id is #34548 and the diagnosis id is "ULRHHNwiGZ2W"
|
|
29
|
+
|
|
30
|
+
### URL format 2
|
|
31
|
+
|
|
32
|
+
https://dash.empirical.run/<project-name>/diagnosis/slug-of-test-case-name--ULRHHNwiGZ2W
|
|
33
|
+
|
|
34
|
+
In the above, the diagnosis id is after the double hyphen, which is "ULRHHNwiGZ2W"
|
|
35
|
+
|
|
36
|
+
## Related tools
|
|
37
|
+
- You can use the file view tool to read the actual test source code, or helper methods that
|
|
38
|
+
are imported in the test to get a complete sense of what the test case was testing.
|
|
39
|
+
- You can also fetch the entire test run report, which contains a list of failed test cases.`,
|
|
19
40
|
parameters: DiagnosisSchema,
|
|
20
41
|
},
|
|
21
42
|
needsBrowser: false,
|
|
22
43
|
isInlineTool: true,
|
|
23
|
-
execute: async ({ input,
|
|
24
|
-
const {
|
|
25
|
-
let slug;
|
|
26
|
-
try {
|
|
27
|
-
slug = (0, slug_1.extractSlugFromDiagnosisUrl)(diagnosisUrl);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
return {
|
|
31
|
-
isError: true,
|
|
32
|
-
result: `Invalid diagnosis URL - could not extract slug: ${error instanceof Error ? error.message : String(error)}`,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
44
|
+
execute: async ({ input, apiClient }) => {
|
|
45
|
+
const { diagnosisId } = input;
|
|
35
46
|
let data = null;
|
|
36
47
|
if (!apiClient) {
|
|
37
48
|
throw new Error("Dashboard API client is not available.");
|
|
38
49
|
}
|
|
39
50
|
try {
|
|
40
|
-
data = await apiClient.request(`/api/diagnosis/${
|
|
51
|
+
data = await apiClient.request(`/api/diagnosis/${diagnosisId}/detailed`, {
|
|
41
52
|
method: "GET",
|
|
42
53
|
});
|
|
54
|
+
if (!data || !data.data) {
|
|
55
|
+
throw new Error("No API response from /api/diagnosis/<slug>/detailed");
|
|
56
|
+
}
|
|
43
57
|
}
|
|
44
58
|
catch (error) {
|
|
45
59
|
return {
|
|
@@ -48,37 +62,33 @@ exports.fetchDiagnosisReportTool = {
|
|
|
48
62
|
};
|
|
49
63
|
}
|
|
50
64
|
const { test_case, diagnosis } = data.data;
|
|
51
|
-
const project = diagnosis
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
65
|
+
const project = diagnosis.test_project || "unknown";
|
|
66
|
+
const retries = diagnosis.retry_details?.retries;
|
|
67
|
+
const retryInfo = retries?.reduce((acc, current) => {
|
|
68
|
+
return `${acc}\n\n## Retry ${current.retryIndex}\n\n${JSON.stringify(current, null, 2)}`;
|
|
69
|
+
}, "");
|
|
70
|
+
const lastSuccessRunForProject = await getDataForLastSuccessfulRuns(test_case);
|
|
71
|
+
let lastSuccessRunInfo = "No successful runs found.";
|
|
72
|
+
if (Object.keys(lastSuccessRunForProject).length > 0) {
|
|
73
|
+
lastSuccessRunInfo = Object.entries(lastSuccessRunForProject).reduce((acc, current) => {
|
|
74
|
+
const [project, value] = current;
|
|
75
|
+
return `${acc}\n\n## Playwright project: ${project}\n\n${JSON.stringify(value, null, 2)}`;
|
|
76
|
+
}, "");
|
|
77
|
+
}
|
|
55
78
|
const markdownResponse = `
|
|
56
|
-
# Test Case
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- **
|
|
60
|
-
- **
|
|
61
|
-
- **File Path**: tests/${test_case.file_path}
|
|
62
|
-
- **Project**: ${project}
|
|
63
|
-
|
|
64
|
-
## What Happened in the Test Run
|
|
65
|
-
|
|
66
|
-
### Failure Details
|
|
67
|
-
- **Failing Line**: ${diagnosis?.failing_line || "No failing line available"}
|
|
79
|
+
# Test Case Information
|
|
80
|
+
- **Name**: ${test_case.name}
|
|
81
|
+
- **Test suite** (Describe blocks): ${test_case.suites}
|
|
82
|
+
- **File path**: tests/${test_case.file_path}
|
|
83
|
+
- **Playwright project**: ${project}
|
|
68
84
|
|
|
69
|
-
|
|
70
|
-
\`\`\`
|
|
71
|
-
${cleanErrorStack || "No error stack available"}
|
|
72
|
-
\`\`\`
|
|
85
|
+
# What happened in this test run
|
|
73
86
|
|
|
74
|
-
|
|
75
|
-
${diagnosis?.error_stack_summary?.content || "No error summary available"}
|
|
87
|
+
${retryInfo}
|
|
76
88
|
|
|
77
|
-
|
|
78
|
-
${diagnosis?.visual_diff_summary?.summary || "No visual analysis available"}
|
|
89
|
+
# Last successful runs
|
|
79
90
|
|
|
80
|
-
|
|
81
|
-
${diagnosis?.merged_summary?.content || "No merged summary available"}
|
|
91
|
+
${lastSuccessRunInfo}
|
|
82
92
|
`;
|
|
83
93
|
return {
|
|
84
94
|
result: markdownResponse,
|
|
@@ -86,3 +96,38 @@ ${diagnosis?.merged_summary?.content || "No merged summary available"}
|
|
|
86
96
|
};
|
|
87
97
|
},
|
|
88
98
|
};
|
|
99
|
+
async function getDataForLastSuccessfulRuns(testCase) {
|
|
100
|
+
const lastSuccessfulRun = testCase.metadata?.last_successful_run;
|
|
101
|
+
const runData = {};
|
|
102
|
+
const projectPromises = Object.entries(lastSuccessfulRun ?? {}).map(async ([project, testCaseMetaData]) => {
|
|
103
|
+
if (!testCaseMetaData.summary_url)
|
|
104
|
+
return { project, success: false, data: null };
|
|
105
|
+
try {
|
|
106
|
+
const testCaseData = await (0, playwright_report_parser_1.fetchAndFindTestCase)(testCaseMetaData.summary_url, {
|
|
107
|
+
name: testCase.name,
|
|
108
|
+
suites: testCase.suites,
|
|
109
|
+
file_path: testCase.file_path,
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
project,
|
|
113
|
+
success: true,
|
|
114
|
+
data: {
|
|
115
|
+
...testCaseMetaData,
|
|
116
|
+
test_case: testCaseData,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return { project, success: false, data: null };
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
const results = await Promise.allSettled(projectPromises);
|
|
125
|
+
for (const result of results) {
|
|
126
|
+
if (result.status === "fulfilled" &&
|
|
127
|
+
result.value.success &&
|
|
128
|
+
result.value.data) {
|
|
129
|
+
runData[result.value.project] = result.value.data;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return runData;
|
|
133
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/download-build/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/download-build/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,uCAAuC,CAAC;AAQ/E,eAAO,MAAM,iBAAiB,EAAE,IA4B/B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { TraceClient } from "@empiricalrun/llm";
|
|
1
|
+
import type { TraceClient } from "@empiricalrun/llm";
|
|
2
2
|
import { PendingToolCall, ToolResult } from "@empiricalrun/llm/chat";
|
|
3
|
-
import type {
|
|
3
|
+
import type { IDashboardAPIClient } from "@empiricalrun/shared-types/api/base";
|
|
4
|
+
import type { ChatSessionInfo, Logger, MessageCheckpoint, Tool, ToolExecute } from "@empiricalrun/shared-types/chat-agent";
|
|
4
5
|
export type BaseToolExecutorProps = {
|
|
5
6
|
tools: Array<Tool>;
|
|
6
7
|
chatSession: ChatSessionInfo | {
|
|
@@ -14,7 +15,7 @@ export type BaseToolExecutorProps = {
|
|
|
14
15
|
logger?: Logger;
|
|
15
16
|
};
|
|
16
17
|
export declare class BaseToolExecutor {
|
|
17
|
-
toolExecutors: Record<string, ToolExecute>;
|
|
18
|
+
toolExecutors: Record<string, Tool | ToolExecute>;
|
|
18
19
|
featureFlags: string[];
|
|
19
20
|
chatSession: ChatSessionInfo | null;
|
|
20
21
|
branchName: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,KAAK,EACV,eAAe,EAEf,MAAM,EACN,iBAAiB,EACjB,IAAI,EACJ,WAAW,EACZ,MAAM,uCAAuC,CAAC;AAc/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACnB,WAAW,EAAE,eAAe,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,gBAAgB;IAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,WAAW,CAAC,CAAM;IACvD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,eAAe,GAAG,IAAI,CAAC;IACpC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC3C,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;gBAEH,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,SAAS,EACT,KAAK,EACL,YAAY,EACZ,oBAAoB,EACpB,MAAM,GACP,EAAE,qBAAqB;IAuBlB,OAAO,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;QACnD,WAAW,EAAE,UAAU,EAAE,CAAC;QAC1B,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAC;KACtC,CAAC;CAsGH"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BaseToolExecutor = void 0;
|
|
4
4
|
const artifacts_1 = require("../../artifacts");
|
|
5
5
|
const file_operations_1 = require("../file-operations");
|
|
6
|
+
const validate_schema_1 = require("../utils/validate-schema");
|
|
6
7
|
const checkpoint_1 = require("./utils/checkpoint");
|
|
7
8
|
const LOGGER = {
|
|
8
9
|
info: (msg, meta) => console.log(`[info] ${msg}`, meta || ""),
|
|
@@ -31,7 +32,7 @@ class BaseToolExecutor {
|
|
|
31
32
|
// Build toolExecutors
|
|
32
33
|
let toolExecutors = {};
|
|
33
34
|
tools.forEach((tool) => {
|
|
34
|
-
toolExecutors[tool.schema.name] = tool
|
|
35
|
+
toolExecutors[tool.schema.name] = tool;
|
|
35
36
|
});
|
|
36
37
|
this.toolExecutors = {
|
|
37
38
|
...toolExecutors,
|
|
@@ -71,8 +72,21 @@ class BaseToolExecutor {
|
|
|
71
72
|
span?.end({ output: errorResult });
|
|
72
73
|
continue;
|
|
73
74
|
}
|
|
75
|
+
const toolSchema = typeof toolExecutor === "function" ? null : toolExecutor.schema;
|
|
76
|
+
const toolInputSchema = toolSchema?.parameters;
|
|
77
|
+
const executeFn = typeof toolExecutor === "function"
|
|
78
|
+
? toolExecutor
|
|
79
|
+
: toolExecutor.execute;
|
|
80
|
+
if (toolInputSchema) {
|
|
81
|
+
const validationErrorToolresult = (0, validate_schema_1.validateToolInput)(toolCall, toolInputSchema);
|
|
82
|
+
if (validationErrorToolresult) {
|
|
83
|
+
toolResults.push(validationErrorToolresult);
|
|
84
|
+
span?.end({ output: validationErrorToolresult });
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
74
88
|
try {
|
|
75
|
-
const result = await
|
|
89
|
+
const result = await executeFn({
|
|
76
90
|
input: toolCall.input,
|
|
77
91
|
repoPath: this.repoPath,
|
|
78
92
|
apiClient: this.apiClient,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { BaseToolExecutor, BaseToolExecutorProps } from "./base";
|
|
2
|
+
export type { BaseToolExecutorProps } from "./base";
|
|
3
|
+
export { BaseToolExecutor } from "./base";
|
|
4
|
+
export { gitPushChanges } from "./utils/git";
|
|
2
5
|
export declare class ToolExecutor extends BaseToolExecutor {
|
|
3
6
|
constructor(params: Omit<BaseToolExecutorProps, "tools">);
|
|
4
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAEjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,qBAAa,YAAa,SAAQ,gBAAgB;gBACpC,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC;CA8BzD"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToolExecutor = void 0;
|
|
3
|
+
exports.ToolExecutor = exports.gitPushChanges = exports.BaseToolExecutor = void 0;
|
|
4
4
|
const analyse_video_1 = require("../analyse-video");
|
|
5
5
|
const create_pull_request_1 = require("../create-pull-request");
|
|
6
6
|
const delete_file_1 = require("../delete-file");
|
|
7
7
|
const diagnosis_fetcher_1 = require("../diagnosis-fetcher");
|
|
8
8
|
const download_build_1 = require("../download-build");
|
|
9
9
|
const fetch_file_1 = require("../fetch-file");
|
|
10
|
-
const fetch_last_successful_test_run_1 = require("../fetch-last-successful-test-run");
|
|
11
10
|
const fetch_session_diff_1 = require("../fetch-session-diff");
|
|
12
11
|
const file_operations_1 = require("../file-operations");
|
|
13
12
|
const grep_1 = require("../grep");
|
|
14
|
-
const
|
|
13
|
+
const issues_v1_1 = require("../issues-v1");
|
|
15
14
|
const list_environments_1 = require("../list-environments");
|
|
16
15
|
const list_tests_and_projects_1 = require("../list-tests-and-projects");
|
|
17
16
|
const merge_conflicts_1 = require("../merge-conflicts");
|
|
@@ -23,22 +22,25 @@ const test_run_fetcher_1 = require("../test-run-fetcher");
|
|
|
23
22
|
const trace_dot_zip_1 = require("../trace-dot-zip");
|
|
24
23
|
const triage_summary_1 = require("../triage-summary");
|
|
25
24
|
const upgrade_packages_1 = require("../upgrade-packages");
|
|
26
|
-
const view_failed_test_run_report_1 = require("../view-failed-test-run-report");
|
|
27
25
|
const base_1 = require("./base");
|
|
26
|
+
var base_2 = require("./base");
|
|
27
|
+
Object.defineProperty(exports, "BaseToolExecutor", { enumerable: true, get: function () { return base_2.BaseToolExecutor; } });
|
|
28
|
+
var git_1 = require("./utils/git");
|
|
29
|
+
Object.defineProperty(exports, "gitPushChanges", { enumerable: true, get: function () { return git_1.gitPushChanges; } });
|
|
28
30
|
class ToolExecutor extends base_1.BaseToolExecutor {
|
|
29
31
|
constructor(params) {
|
|
30
32
|
// Found for "Tool Executor Tools List" and add any new tools to the list
|
|
31
33
|
const tools = [
|
|
32
34
|
grep_1.grepTool,
|
|
33
35
|
run_test_1.runTestTool,
|
|
34
|
-
test_run_fetcher_1.
|
|
36
|
+
test_run_fetcher_1.fetchTestRunDetailsTool,
|
|
35
37
|
diagnosis_fetcher_1.fetchDiagnosisReportTool,
|
|
36
38
|
test_gen_browser_1.generateTestWithBrowserAgent,
|
|
37
39
|
create_pull_request_1.createPullRequestTool,
|
|
38
40
|
merge_conflicts_1.mergeConflictsTool,
|
|
39
41
|
list_environments_1.listEnvironmentsTool,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
issues_v1_1.listIssuesTool,
|
|
43
|
+
issues_v1_1.createIssueTool,
|
|
42
44
|
download_build_1.downloadBuildTool,
|
|
43
45
|
upgrade_packages_1.upgradePackagesTool,
|
|
44
46
|
fetch_file_1.fetchFileTool,
|
|
@@ -46,9 +48,7 @@ class ToolExecutor extends base_1.BaseToolExecutor {
|
|
|
46
48
|
delete_file_1.deleteFileTool,
|
|
47
49
|
rename_file_1.renameFileTool,
|
|
48
50
|
trace_dot_zip_1.traceDotZipTool,
|
|
49
|
-
|
|
50
|
-
issues_1.updateIssueTool,
|
|
51
|
-
fetch_last_successful_test_run_1.fetchLastSuccessfulTestRunTool,
|
|
51
|
+
issues_v1_1.updateIssueTool,
|
|
52
52
|
triage_summary_1.sendTriageSummaryTool,
|
|
53
53
|
list_tests_and_projects_1.listProjectsTool,
|
|
54
54
|
fetch_session_diff_1.fetchSessionDiffTool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/checkpoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/checkpoint.ts"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,GAAG,IAAI,CAwBhB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createCommitCheckpoint = createCommitCheckpoint;
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
4
|
const git_1 = require("./git");
|
|
6
5
|
function createCommitCheckpoint({ branchName, repoPath, }) {
|
|
7
6
|
const filesChanged = (0, git_1.getStagedFiles)(repoPath);
|
|
@@ -21,9 +20,6 @@ function createCommitCheckpoint({ branchName, repoPath, }) {
|
|
|
21
20
|
const commitMessage = commitMessages.join(", ");
|
|
22
21
|
// Files are already staged by individual tools, just commit
|
|
23
22
|
const commitSha = (0, git_1.commitAsBotUser)(commitMessage, repoPath);
|
|
24
|
-
if (commitSha) {
|
|
25
|
-
(0, child_process_1.execSync)(`git push origin ${branchName}`, { cwd: repoPath });
|
|
26
|
-
}
|
|
27
23
|
return commitSha;
|
|
28
24
|
}
|
|
29
25
|
return null;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { IDashboardAPIClient } from "@empiricalrun/shared-types";
|
|
1
|
+
import { IDashboardAPIClient } from "@empiricalrun/shared-types/api/base";
|
|
2
|
+
export declare const GIT_USER_NAME = "empiricalrun[bot]";
|
|
3
|
+
export declare const GIT_USER_EMAIL = "180257021+empiricalrun[bot]@users.noreply.github.com";
|
|
2
4
|
export declare function getGitDiff(filepath: string, cwd: string): string;
|
|
3
5
|
export declare function getGitDiffStaged(filepath: string, cwd: string): string;
|
|
4
6
|
export declare function getGitDiffForStagedOrUnstaged(filepath: string, cwd: string): string;
|
|
@@ -24,4 +26,8 @@ export declare function mergePullRequest({ repoName, prNumber, apiClient, }: {
|
|
|
24
26
|
prNumber: number;
|
|
25
27
|
apiClient: IDashboardAPIClient;
|
|
26
28
|
}): Promise<boolean>;
|
|
29
|
+
export declare function gitPushChanges({ branch, workingDirectory, }: {
|
|
30
|
+
branch: string;
|
|
31
|
+
workingDirectory: string;
|
|
32
|
+
}): void;
|
|
27
33
|
//# sourceMappingURL=git.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAG1E,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD,eAAO,MAAM,cAAc,yDAC6B,CAAC;AAEzD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMhE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMtE;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,CAaR;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAe1E;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAMnE;AAED,wBAAgB,eAAe,CAC7B,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,IAAI,CAkBf;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,mBAO1D;AAED,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAE/D;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,aAAa,EACb,KAAK,EACL,QAAQ,GACT,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,GAAG,IAAI,CAGhB;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,EAAE,CA6CxD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAUrD;AAED,wBAAsB,gBAAgB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,mBAAmB,CAAC;CAChC,oBA8BA;AAED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,gBAAgB,GACjB,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;CAC1B,QAIA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GIT_USER_EMAIL = exports.GIT_USER_NAME = void 0;
|
|
3
4
|
exports.getGitDiff = getGitDiff;
|
|
4
5
|
exports.getGitDiffStaged = getGitDiffStaged;
|
|
5
6
|
exports.getGitDiffForStagedOrUnstaged = getGitDiffForStagedOrUnstaged;
|
|
@@ -12,9 +13,10 @@ exports.stageAndCommitFilesAsBotUser = stageAndCommitFilesAsBotUser;
|
|
|
12
13
|
exports.getStagedFiles = getStagedFiles;
|
|
13
14
|
exports.getFilesChanged = getFilesChanged;
|
|
14
15
|
exports.mergePullRequest = mergePullRequest;
|
|
16
|
+
exports.gitPushChanges = gitPushChanges;
|
|
15
17
|
const child_process_1 = require("child_process");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
exports.GIT_USER_NAME = "empiricalrun[bot]";
|
|
19
|
+
exports.GIT_USER_EMAIL = "180257021+empiricalrun[bot]@users.noreply.github.com";
|
|
18
20
|
function getGitDiff(filepath, cwd) {
|
|
19
21
|
const diff = (0, child_process_1.execSync)(`git diff ${filepath}`, {
|
|
20
22
|
encoding: "utf-8",
|
|
@@ -77,7 +79,7 @@ function commitAsBotUser(commitMessage, cwd) {
|
|
|
77
79
|
return null;
|
|
78
80
|
}
|
|
79
81
|
const commitMessageWithSkipCi = `${commitMessage} [skip ci]`;
|
|
80
|
-
(0, child_process_1.execSync)(`git -c user.name="${GIT_USER_NAME}" -c user.email="${GIT_USER_EMAIL}" commit -m "${commitMessageWithSkipCi}"`, { cwd });
|
|
82
|
+
(0, child_process_1.execSync)(`git -c user.name="${exports.GIT_USER_NAME}" -c user.email="${exports.GIT_USER_EMAIL}" commit -m "${commitMessageWithSkipCi}"`, { cwd });
|
|
81
83
|
const commitSha = (0, child_process_1.execSync)("git rev-parse HEAD", {
|
|
82
84
|
encoding: "utf-8",
|
|
83
85
|
cwd,
|
|
@@ -179,3 +181,8 @@ async function mergePullRequest({ repoName, prNumber, apiClient, }) {
|
|
|
179
181
|
return false;
|
|
180
182
|
}
|
|
181
183
|
}
|
|
184
|
+
function gitPushChanges({ branch, workingDirectory, }) {
|
|
185
|
+
(0, child_process_1.execSync)(`git push origin ${branch}`, {
|
|
186
|
+
cwd: workingDirectory,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDashboardAPIClient } from "@empiricalrun/shared-types";
|
|
1
|
+
import { IDashboardAPIClient } from "@empiricalrun/shared-types/api/base";
|
|
2
2
|
export interface GitHubRepoInfo {
|
|
3
3
|
owner: string;
|
|
4
4
|
repo: string;
|
|
@@ -50,7 +50,7 @@ export declare function createPullRequest({ owner, repo, title, head, base, body
|
|
|
50
50
|
repo: string;
|
|
51
51
|
title: string;
|
|
52
52
|
head: string;
|
|
53
|
-
base
|
|
53
|
+
base: string;
|
|
54
54
|
body: string;
|
|
55
55
|
labels?: string[];
|
|
56
56
|
apiClient: IDashboardAPIClient;
|
|
@@ -62,12 +62,13 @@ export declare function updatePullRequest({ owner, repo, prNumber, body, apiClie
|
|
|
62
62
|
body?: string;
|
|
63
63
|
apiClient: IDashboardAPIClient;
|
|
64
64
|
}): Promise<PullRequestInfo>;
|
|
65
|
-
export declare function findOrCreatePullRequest({ owner, repo, branchName, title, body, labels, apiClient, }: {
|
|
65
|
+
export declare function findOrCreatePullRequest({ owner, repo, branchName, title, body, base, labels, apiClient, }: {
|
|
66
66
|
owner: string;
|
|
67
67
|
repo: string;
|
|
68
68
|
branchName: string;
|
|
69
69
|
title: string;
|
|
70
70
|
body: string;
|
|
71
|
+
base: string;
|
|
71
72
|
labels?: string[];
|
|
72
73
|
apiClient: IDashboardAPIClient;
|
|
73
74
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -98,7 +98,7 @@ async function updatePullRequest({ owner, repo, prNumber, body, apiClient, }) {
|
|
|
98
98
|
body: updateBody,
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
async function findOrCreatePullRequest({ owner, repo, branchName, title, body, labels, apiClient, }) {
|
|
101
|
+
async function findOrCreatePullRequest({ owner, repo, branchName, title, body, base, labels, apiClient, }) {
|
|
102
102
|
const existingPR = await getExistingPR({
|
|
103
103
|
owner,
|
|
104
104
|
repo,
|
|
@@ -113,6 +113,7 @@ async function findOrCreatePullRequest({ owner, repo, branchName, title, body, l
|
|
|
113
113
|
repo,
|
|
114
114
|
title,
|
|
115
115
|
head: branchName,
|
|
116
|
+
base,
|
|
116
117
|
body,
|
|
117
118
|
labels,
|
|
118
119
|
apiClient,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatSessionInfo } from "@empiricalrun/shared-types";
|
|
1
|
+
import type { ChatSessionInfo } from "@empiricalrun/shared-types/chat-agent";
|
|
2
2
|
export declare function generateSessionMetadata(chatSession: ChatSessionInfo | null): string;
|
|
3
3
|
export declare function addMetadataToPRDescription(description: string, chatSession: ChatSessionInfo | null | undefined): string;
|
|
4
4
|
//# sourceMappingURL=pr-description.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-description.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/pr-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pr-description.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/pr-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAE7E,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,eAAe,GAAG,IAAI,GAClC,MAAM,CASR;AAED,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,GAC9C,MAAM,CAWR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-file/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-file/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,IAAI,EAGL,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,QAAA,MAAM,eAAe;;;;;;EAEnB,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAoI/D,CAAC"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchFileTool = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const url_validation_1 = require("../../utils/url-validation");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
5
7
|
const SUPPORTED_IMAGE_TYPES = [
|
|
6
8
|
"image/png",
|
|
7
9
|
"image/jpeg",
|
|
@@ -16,7 +18,7 @@ exports.fetchFileTool = {
|
|
|
16
18
|
schema: {
|
|
17
19
|
name: "fetchFile",
|
|
18
20
|
description: `Use this tool to fetch file data from any valid URL that responds with an image (PNG, JPEG, GIF, WebP) or markdown file.
|
|
19
|
-
For images, it returns the image in base64 format for you to view or
|
|
21
|
+
For images, it returns the image in base64 format for you to view or analyse. For markdown files, it returns the text content for you to read and process.
|
|
20
22
|
|
|
21
23
|
## Caveats
|
|
22
24
|
1. This will not work to fetch markdown files from a repo due to access control issues. Use file view tools for that.
|
|
@@ -30,20 +32,32 @@ time of test failures. Both of these are available in the attachments section of
|
|
|
30
32
|
},
|
|
31
33
|
needsBrowser: false,
|
|
32
34
|
isInlineTool: true,
|
|
33
|
-
execute: async ({ input }) => {
|
|
35
|
+
execute: async ({ input, logger, }) => {
|
|
34
36
|
const { url } = input;
|
|
37
|
+
logger.info("Starting file fetch", {
|
|
38
|
+
tool: "fetchFileTool",
|
|
39
|
+
url,
|
|
40
|
+
});
|
|
35
41
|
try {
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
38
|
-
|
|
42
|
+
const headResponse = await (0, url_validation_1.validateUrlAccess)(url);
|
|
43
|
+
if (!headResponse.ok) {
|
|
44
|
+
logger.error("Failed to fetch file", {
|
|
45
|
+
tool: "fetchFileTool",
|
|
46
|
+
url,
|
|
47
|
+
statusText: headResponse.statusText,
|
|
48
|
+
});
|
|
39
49
|
return {
|
|
40
|
-
result: `Failed to fetch file from ${url}: ${
|
|
50
|
+
result: `Failed to fetch file from ${url}: ${headResponse.statusText}`,
|
|
41
51
|
isError: true,
|
|
42
52
|
};
|
|
43
53
|
}
|
|
44
|
-
const contentType =
|
|
54
|
+
const contentType = headResponse.headers.get("content-type");
|
|
45
55
|
if (!contentType) {
|
|
46
56
|
const errorMessage = `No content type header found. URL must return an image or markdown file.`;
|
|
57
|
+
logger.warn("No content type header found", {
|
|
58
|
+
tool: "fetchFileTool",
|
|
59
|
+
url,
|
|
60
|
+
});
|
|
47
61
|
return {
|
|
48
62
|
result: errorMessage,
|
|
49
63
|
isError: true,
|
|
@@ -51,17 +65,33 @@ time of test failures. Both of these are available in the attachments section of
|
|
|
51
65
|
}
|
|
52
66
|
const isImage = SUPPORTED_IMAGE_TYPES.some((type) => contentType.startsWith(type));
|
|
53
67
|
const isText = SUPPORTED_TEXT_TYPES.some((type) => contentType.startsWith(type));
|
|
68
|
+
const isVideo = contentType.startsWith("video");
|
|
54
69
|
if (!isImage && !isText) {
|
|
55
|
-
const errorMessage =
|
|
56
|
-
|
|
70
|
+
const errorMessage = isVideo
|
|
71
|
+
? `This tool does not support content type: ${contentType}. Try analyseVideo tool instead for video files.`
|
|
72
|
+
: `Invalid content type: ${contentType}. URL must return an image (PNG, JPEG, GIF, WebP) or markdown file.`;
|
|
73
|
+
logger.warn("Unsupported content type", {
|
|
74
|
+
tool: "fetchFileTool",
|
|
75
|
+
url,
|
|
76
|
+
contentType,
|
|
77
|
+
isVideo,
|
|
78
|
+
});
|
|
57
79
|
return {
|
|
58
80
|
result: errorMessage,
|
|
59
81
|
isError: true,
|
|
60
82
|
};
|
|
61
83
|
}
|
|
84
|
+
const contentResponse = await fetch(url);
|
|
62
85
|
if (isImage) {
|
|
63
|
-
const buffer = await
|
|
64
|
-
const
|
|
86
|
+
const buffer = await contentResponse.arrayBuffer();
|
|
87
|
+
const processedBuffer = await (0, utils_1.downscaleImageIfNeeded)(buffer, logger);
|
|
88
|
+
const base64 = Buffer.from(processedBuffer).toString("base64");
|
|
89
|
+
logger.info("Successfully fetched image file", {
|
|
90
|
+
tool: "fetchFileTool",
|
|
91
|
+
url,
|
|
92
|
+
contentType,
|
|
93
|
+
size: processedBuffer.byteLength,
|
|
94
|
+
});
|
|
65
95
|
return {
|
|
66
96
|
result: [
|
|
67
97
|
{
|
|
@@ -74,7 +104,13 @@ time of test failures. Both of these are available in the attachments section of
|
|
|
74
104
|
}
|
|
75
105
|
else {
|
|
76
106
|
// Handle text/markdown files
|
|
77
|
-
const text = await
|
|
107
|
+
const text = await contentResponse.text();
|
|
108
|
+
logger.info("Successfully fetched text file", {
|
|
109
|
+
tool: "fetchFileTool",
|
|
110
|
+
url,
|
|
111
|
+
contentType,
|
|
112
|
+
size: text.length,
|
|
113
|
+
});
|
|
78
114
|
return {
|
|
79
115
|
result: [
|
|
80
116
|
{
|
|
@@ -87,7 +123,11 @@ time of test failures. Both of these are available in the attachments section of
|
|
|
87
123
|
}
|
|
88
124
|
}
|
|
89
125
|
catch (error) {
|
|
90
|
-
|
|
126
|
+
logger.error("Error fetching file", {
|
|
127
|
+
tool: "fetchFileTool",
|
|
128
|
+
url,
|
|
129
|
+
error,
|
|
130
|
+
});
|
|
91
131
|
return {
|
|
92
132
|
result: `Error fetching file: ${error}`,
|
|
93
133
|
isError: true,
|