@empiricalrun/test-gen 0.75.0 → 0.77.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 +48 -0
- package/dist/agent/base/index.d.ts +32 -21
- package/dist/agent/base/index.d.ts.map +1 -1
- package/dist/agent/base/index.js +100 -57
- package/dist/agent/browsing/run.d.ts +1 -2
- package/dist/agent/browsing/run.d.ts.map +1 -1
- package/dist/agent/browsing/run.js +3 -9
- package/dist/agent/browsing/utils.d.ts +2 -9
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +5 -109
- package/dist/agent/chat/agent-loop.d.ts +8 -7
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +7 -18
- package/dist/agent/chat/exports.d.ts +9 -6
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +11 -13
- package/dist/agent/chat/index.d.ts +6 -10
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +117 -196
- package/dist/agent/chat/models.d.ts +0 -2
- package/dist/agent/chat/models.d.ts.map +1 -1
- package/dist/agent/chat/models.js +12 -26
- 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 +52 -0
- package/dist/agent/chat/prompt/repo.d.ts.map +1 -1
- package/dist/agent/chat/prompt/repo.js +11 -22
- package/dist/agent/chat/prompt/test-case-def.d.ts +2 -0
- package/dist/agent/chat/prompt/test-case-def.d.ts.map +1 -0
- package/dist/agent/chat/prompt/test-case-def.js +44 -0
- package/dist/agent/chat/state.d.ts +8 -8
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +17 -47
- package/dist/agent/chat/utils.d.ts +4 -5
- package/dist/agent/chat/utils.d.ts.map +1 -1
- package/dist/agent/chat/utils.js +15 -9
- package/dist/agent/cli.d.ts +11 -0
- package/dist/agent/cli.d.ts.map +1 -0
- package/dist/agent/cli.js +213 -0
- package/dist/agent/code-review/executor/index.d.ts +5 -0
- package/dist/agent/code-review/executor/index.d.ts.map +1 -0
- package/dist/agent/code-review/executor/index.js +13 -0
- package/dist/agent/code-review/index.d.ts +12 -0
- package/dist/agent/code-review/index.d.ts.map +1 -0
- package/dist/agent/code-review/index.js +159 -0
- package/dist/agent/code-review/parser.d.ts +5 -0
- package/dist/agent/code-review/parser.d.ts.map +1 -0
- package/dist/agent/code-review/parser.js +70 -0
- package/dist/agent/code-review/types.d.ts +36 -0
- package/dist/agent/code-review/types.d.ts.map +1 -0
- package/dist/agent/code-review/types.js +13 -0
- package/dist/agent/cua/index.d.ts.map +1 -1
- package/dist/agent/cua/index.js +18 -2
- package/dist/agent/cua/model.d.ts.map +1 -1
- package/dist/agent/cua/model.js +4 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
- package/dist/agent/index.d.ts +10 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +19 -0
- package/dist/agent/triage/index.d.ts +7 -0
- package/dist/agent/triage/index.d.ts.map +1 -0
- package/dist/agent/triage/index.js +103 -0
- package/dist/agent/video-analysis/executor/index.d.ts +5 -0
- package/dist/agent/video-analysis/executor/index.d.ts.map +1 -0
- package/dist/agent/video-analysis/executor/index.js +10 -0
- package/dist/agent/video-analysis/index.d.ts +7 -0
- package/dist/agent/video-analysis/index.d.ts.map +1 -0
- package/dist/agent/video-analysis/index.js +60 -0
- package/dist/artifacts/index.d.ts +1 -1
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +3 -1
- package/dist/artifacts/utils.d.ts.map +1 -1
- package/dist/bin/index.js +68 -23
- package/dist/constants/index.d.ts +14 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +33 -1
- package/dist/file/server.d.ts +1 -3
- package/dist/file/server.d.ts.map +1 -1
- package/dist/file/server.js +0 -13
- package/dist/file-info/adapters/file-system/index.d.ts.map +1 -1
- package/dist/file-info/adapters/file-system/reader.d.ts.map +1 -1
- package/dist/file-info/adapters/file-system/reader.js +8 -1
- package/dist/file-info/adapters/github/index.d.ts.map +1 -1
- package/dist/file-info/adapters/github/index.js +1 -2
- package/dist/file-info/adapters/github/reader.d.ts +4 -9
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.js +166 -134
- package/dist/index.d.ts.map +1 -1
- package/dist/tools/analyse-video/index.d.ts +5 -0
- package/dist/tools/analyse-video/index.d.ts.map +1 -0
- package/dist/tools/analyse-video/index.js +50 -0
- package/dist/tools/create-pull-request/index.d.ts.map +1 -0
- package/dist/tools/{definitions/commit-and-create-pr.js → create-pull-request/index.js} +28 -1
- package/dist/tools/create-pull-request/utils.d.ts +21 -0
- package/dist/tools/create-pull-request/utils.d.ts.map +1 -0
- package/dist/tools/create-pull-request/utils.js +83 -0
- package/dist/tools/definitions/{fetch-video-analysis.d.ts → analyse-video.d.ts} +17 -12
- package/dist/tools/definitions/analyse-video.d.ts.map +1 -0
- package/dist/tools/definitions/analyse-video.js +60 -0
- package/dist/tools/definitions/review-pull-request.d.ts +3 -0
- package/dist/tools/definitions/review-pull-request.d.ts.map +1 -0
- package/dist/tools/definitions/review-pull-request.js +16 -0
- package/dist/tools/definitions/str_replace_editor.d.ts +1 -0
- package/dist/tools/definitions/str_replace_editor.d.ts.map +1 -1
- package/dist/tools/definitions/str_replace_editor.js +4 -1
- package/dist/tools/definitions/test-gen-browser.d.ts +0 -3
- package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/definitions/test-gen-browser.js +33 -8
- package/dist/tools/delete-file/index.d.ts.map +1 -1
- package/dist/tools/delete-file/index.js +1 -19
- package/dist/tools/executor/base.d.ts +32 -0
- package/dist/tools/executor/base.d.ts.map +1 -0
- package/dist/tools/executor/base.js +114 -0
- package/dist/tools/executor/index.d.ts +3 -22
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +13 -92
- package/dist/tools/executor/utils/checkpoint.d.ts +1 -1
- package/dist/tools/executor/utils/checkpoint.d.ts.map +1 -1
- package/dist/tools/executor/utils/checkpoint.js +6 -2
- package/dist/tools/executor/utils/git.d.ts +2 -2
- package/dist/tools/executor/utils/git.d.ts.map +1 -1
- package/dist/tools/executor/utils/git.js +7 -3
- package/dist/tools/executor/utils/index.d.ts.map +1 -1
- package/dist/tools/executor/utils/index.js +1 -1
- package/dist/tools/fetch-session-diff/index.d.ts +3 -0
- package/dist/tools/fetch-session-diff/index.d.ts.map +1 -0
- package/dist/tools/fetch-session-diff/index.js +46 -0
- package/dist/tools/file-operations/create.d.ts.map +1 -1
- package/dist/tools/file-operations/create.js +1 -4
- 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/index.js +4 -1
- package/dist/tools/file-operations/insert.d.ts +1 -2
- package/dist/tools/file-operations/insert.d.ts.map +1 -1
- package/dist/tools/file-operations/insert.js +1 -4
- package/dist/tools/file-operations/replace.d.ts.map +1 -1
- package/dist/tools/file-operations/replace.js +1 -4
- package/dist/tools/grep/index.d.ts.map +1 -1
- package/dist/tools/grep/index.js +18 -11
- package/dist/tools/index.d.ts +28 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +52 -33
- package/dist/tools/merge-conflicts/index.d.ts.map +1 -1
- package/dist/tools/merge-conflicts/index.js +1 -1
- package/dist/tools/rename-file/index.js +1 -1
- package/dist/tools/review-pull-request/index.d.ts +3 -0
- package/dist/tools/review-pull-request/index.d.ts.map +1 -0
- package/dist/tools/review-pull-request/index.js +89 -0
- package/dist/tools/run-test.d.ts.map +1 -1
- package/dist/tools/run-test.js +25 -3
- package/dist/tools/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/test-gen-browser.js +51 -47
- package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
- package/dist/tools/test-run-fetcher/index.js +4 -14
- package/dist/tools/utils/urls.d.ts +5 -0
- package/dist/tools/utils/urls.d.ts.map +1 -0
- package/dist/tools/utils/urls.js +19 -0
- package/dist/tools/view-failed-test-run-report/index.d.ts.map +1 -1
- package/dist/tools/view-failed-test-run-report/index.js +3 -15
- package/dist/utils/artifact-paths.d.ts +20 -0
- package/dist/utils/artifact-paths.d.ts.map +1 -0
- package/dist/utils/artifact-paths.js +16 -0
- package/dist/utils/dedup-image-fs.d.ts +2 -16
- package/dist/utils/dedup-image-fs.d.ts.map +1 -1
- package/dist/utils/dedup-image-fs.js +12 -16
- package/dist/utils/dedup-image.d.ts +1 -14
- package/dist/utils/dedup-image.d.ts.map +1 -1
- package/dist/utils/dedup-image.js +7 -62
- package/dist/{tools/fetch-video-analysis/local-ffmpeg-client.d.ts → utils/ffmpeg/index.d.ts} +9 -6
- package/dist/utils/ffmpeg/index.d.ts.map +1 -0
- package/dist/utils/ffmpeg/index.js +415 -0
- package/dist/utils/file.d.ts +1 -0
- package/dist/utils/file.d.ts.map +1 -1
- package/dist/utils/file.js +45 -1
- package/dist/utils/find-threshold.d.ts +8 -0
- package/dist/utils/find-threshold.d.ts.map +1 -0
- package/dist/utils/find-threshold.js +55 -0
- package/dist/utils/hash.d.ts +2 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +24 -0
- package/dist/utils/model.d.ts +1 -1
- package/dist/utils/model.d.ts.map +1 -1
- package/dist/utils/model.js +7 -5
- package/dist/utils/repo-tree.d.ts +0 -1
- package/dist/utils/repo-tree.d.ts.map +1 -1
- package/dist/utils/repo-tree.js +2 -14
- package/dist/utils/slug.js +1 -1
- package/dist/video-core/agent-orchestrator.d.ts +14 -0
- package/dist/video-core/agent-orchestrator.d.ts.map +1 -0
- package/dist/video-core/agent-orchestrator.js +78 -0
- package/dist/video-core/analysis-server.d.ts +24 -0
- package/dist/video-core/analysis-server.d.ts.map +1 -0
- package/dist/video-core/analysis-server.js +398 -0
- package/dist/video-core/analysis-viewer.html +1374 -0
- package/dist/video-core/index.d.ts +44 -0
- package/dist/video-core/index.d.ts.map +1 -0
- package/dist/video-core/index.js +204 -0
- package/dist/video-core/model-limits.d.ts +4 -0
- package/dist/video-core/model-limits.d.ts.map +1 -0
- package/dist/video-core/model-limits.js +67 -0
- package/dist/video-core/storage-manager.d.ts +5 -0
- package/dist/video-core/storage-manager.d.ts.map +1 -0
- package/dist/video-core/storage-manager.js +55 -0
- package/dist/video-core/types.d.ts +13 -0
- package/dist/video-core/types.d.ts.map +1 -0
- package/dist/video-core/types.js +2 -0
- package/dist/video-core/utils.d.ts +25 -0
- package/dist/video-core/utils.d.ts.map +1 -0
- package/dist/video-core/utils.js +211 -0
- package/dist/video-core/xml-parser.d.ts +3 -0
- package/dist/video-core/xml-parser.d.ts.map +1 -0
- package/dist/video-core/xml-parser.js +27 -0
- package/package.json +5 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/agent/chat/prompt/index.d.ts +0 -5
- package/dist/agent/chat/prompt/index.d.ts.map +0 -1
- package/dist/agent/chat/prompt/index.js +0 -189
- package/dist/agent/chat/utils/tool-calls.d.ts +0 -21
- package/dist/agent/chat/utils/tool-calls.d.ts.map +0 -1
- package/dist/agent/chat/utils/tool-calls.js +0 -64
- package/dist/agent/code-review/prompt.d.ts +0 -2
- package/dist/agent/code-review/prompt.d.ts.map +0 -1
- package/dist/agent/code-review/prompt.js +0 -19
- package/dist/agent/diagnosis-agent/index.d.ts +0 -11
- package/dist/agent/diagnosis-agent/index.d.ts.map +0 -1
- package/dist/agent/diagnosis-agent/index.js +0 -88
- package/dist/agent/diagnosis-agent/strict-mode-violation.d.ts +0 -10
- package/dist/agent/diagnosis-agent/strict-mode-violation.d.ts.map +0 -1
- package/dist/agent/diagnosis-agent/strict-mode-violation.js +0 -30
- package/dist/tools/commit-and-create-pr/index.d.ts.map +0 -1
- package/dist/tools/commit-and-create-pr/index.js +0 -83
- package/dist/tools/definitions/commit-and-create-pr.d.ts +0 -3
- package/dist/tools/definitions/commit-and-create-pr.d.ts.map +0 -1
- package/dist/tools/definitions/fetch-video-analysis.d.ts.map +0 -1
- package/dist/tools/definitions/fetch-video-analysis.js +0 -61
- package/dist/tools/fetch-video-analysis/index.d.ts +0 -5
- package/dist/tools/fetch-video-analysis/index.d.ts.map +0 -1
- package/dist/tools/fetch-video-analysis/index.js +0 -138
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts.map +0 -1
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.js +0 -247
- package/dist/tools/fetch-video-analysis/open-ai.d.ts +0 -6
- package/dist/tools/fetch-video-analysis/open-ai.d.ts.map +0 -1
- package/dist/tools/fetch-video-analysis/open-ai.js +0 -37
- package/dist/tools/fetch-video-analysis/utils.d.ts +0 -13
- package/dist/tools/fetch-video-analysis/utils.d.ts.map +0 -1
- package/dist/tools/fetch-video-analysis/utils.js +0 -98
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts +0 -7
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts.map +0 -1
- package/dist/tools/fetch-video-analysis/video-analysis.js +0 -54
- package/dist/tools/file-operations/shared/git-helper.d.ts +0 -4
- package/dist/tools/file-operations/shared/git-helper.d.ts.map +0 -1
- package/dist/tools/file-operations/shared/git-helper.js +0 -29
- package/eslint.config.mjs +0 -43
- /package/dist/tools/{commit-and-create-pr → create-pull-request}/index.d.ts +0 -0
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.chatAgentLoop = chatAgentLoop;
|
|
4
4
|
const state_1 = require("./state");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
|
-
async function chatAgentLoop({ chatModel,
|
|
6
|
+
async function chatAgentLoop({ chatModel, reporter, streamingMessageReporter, trace, signal, featureFlags, tools, onPendingToolCall, onLLMResponse, systemPrompt, }) {
|
|
7
7
|
trace?.update({ input: { systemPrompt } });
|
|
8
8
|
while (!chatModel.askUserForInput) {
|
|
9
9
|
if (signal?.aborted) {
|
|
@@ -16,42 +16,31 @@ async function chatAgentLoop({ chatModel, selectedModel, reporter, streamingMess
|
|
|
16
16
|
await onPendingToolCall(toolCalls);
|
|
17
17
|
break;
|
|
18
18
|
}
|
|
19
|
-
(0, utils_1.log)(`${(0, utils_1.getModelName)(selectedModel)} is working...`);
|
|
19
|
+
(0, utils_1.log)(`${(0, utils_1.getModelName)(chatModel.selectedModel)} is working...`);
|
|
20
20
|
const response = await chatModel.getLLMResponse({
|
|
21
21
|
systemPrompt,
|
|
22
|
-
tools
|
|
23
|
-
selectedModel,
|
|
22
|
+
tools,
|
|
24
23
|
trace,
|
|
25
24
|
streamingMessageReporter,
|
|
26
25
|
hasThinkingEnabled: true,
|
|
27
|
-
|
|
26
|
+
featureFlags,
|
|
28
27
|
});
|
|
29
28
|
if (!response) {
|
|
30
29
|
throw new Error("Error getting response from LLM");
|
|
31
30
|
}
|
|
32
31
|
chatModel.pushMessage(response);
|
|
33
32
|
if (onLLMResponse) {
|
|
34
|
-
await onLLMResponse(response, selectedModel);
|
|
33
|
+
await onLLMResponse(response, chatModel.selectedModel);
|
|
35
34
|
}
|
|
36
35
|
const latest = chatModel.getHumanReadableLatestMessage();
|
|
37
36
|
if (signal?.aborted) {
|
|
38
37
|
(0, utils_1.log)("[chatAgentLoop] Aborted by signal");
|
|
39
38
|
break;
|
|
40
39
|
}
|
|
41
|
-
await reporter((0, state_1.chatStateFromModel)({
|
|
42
|
-
chatModel,
|
|
43
|
-
selectedModel,
|
|
44
|
-
error: null,
|
|
45
|
-
}), latest);
|
|
40
|
+
await reporter((0, state_1.chatStateFromModel)({ chatModel, error: null }), latest);
|
|
46
41
|
}
|
|
47
42
|
catch (error) {
|
|
48
|
-
await (0, utils_1.handleAgentError)({
|
|
49
|
-
error,
|
|
50
|
-
chatModel,
|
|
51
|
-
selectedModel,
|
|
52
|
-
reporter,
|
|
53
|
-
trace,
|
|
54
|
-
});
|
|
43
|
+
await (0, utils_1.handleAgentError)({ error, chatModel, reporter, trace });
|
|
55
44
|
throw error;
|
|
56
45
|
}
|
|
57
46
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
export type { IChatModel } from "@empiricalrun/llm/chat";
|
|
2
|
+
export { createChatModel, SUPPORTED_CHAT_MODELS } from "@empiricalrun/llm/chat";
|
|
1
3
|
export { getFileInfoFromGitHub, viewFileUsingGitHub, } from "../../file-info/adapters/github";
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
4
|
+
export type { AgentParams } from "../base";
|
|
5
|
+
export { BaseAgent } from "../base";
|
|
6
|
+
export type { CodeReviewResultV0, CodeReviewResultV1, CodeReviewResultV2, CodeReviewVersionedResult, } from "../code-review";
|
|
7
|
+
export { MODE_TO_AGENT_MAP } from "../index";
|
|
8
|
+
export { TriageAgent } from "../triage";
|
|
9
|
+
export { ChatAgent } from "./index";
|
|
10
|
+
export { resolveChatModelBasedOnInput } from "./models";
|
|
5
11
|
export { CHAT_STATE_VERSIONS_MIGRATIONS_MAP, chatStateFromModel, createChatState, createChatStateForMessages, fetchToolCallFromId, getLatestDownloadBuildUrl, LATEST_CHAT_STATE_VERSION, migrateChatState, } from "./state";
|
|
6
12
|
export { extractAttachments } from "./utils";
|
|
7
|
-
export { processToolCallsAndUpdateChatState, rejectPendingToolCalls, } from "./utils/tool-calls";
|
|
8
|
-
export type { IChatModel } from "@empiricalrun/llm/chat";
|
|
9
|
-
export { createChatModel, SUPPORTED_CHAT_MODELS } from "@empiricalrun/llm/chat";
|
|
10
13
|
//# sourceMappingURL=exports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/exports.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EACL,kCAAkC,EAClC,kBAAkB,EAClB,eAAe,EACf,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.extractAttachments = exports.migrateChatState = exports.LATEST_CHAT_STATE_VERSION = exports.getLatestDownloadBuildUrl = exports.fetchToolCallFromId = exports.createChatStateForMessages = exports.createChatState = exports.chatStateFromModel = exports.CHAT_STATE_VERSIONS_MIGRATIONS_MAP = exports.resolveChatModelBasedOnInput = exports.ChatAgent = exports.TriageAgent = exports.MODE_TO_AGENT_MAP = exports.BaseAgent = exports.viewFileUsingGitHub = exports.getFileInfoFromGitHub = exports.SUPPORTED_CHAT_MODELS = exports.createChatModel = void 0;
|
|
4
|
+
var chat_1 = require("@empiricalrun/llm/chat");
|
|
5
|
+
Object.defineProperty(exports, "createChatModel", { enumerable: true, get: function () { return chat_1.createChatModel; } });
|
|
6
|
+
Object.defineProperty(exports, "SUPPORTED_CHAT_MODELS", { enumerable: true, get: function () { return chat_1.SUPPORTED_CHAT_MODELS; } });
|
|
4
7
|
var github_1 = require("../../file-info/adapters/github");
|
|
5
8
|
Object.defineProperty(exports, "getFileInfoFromGitHub", { enumerable: true, get: function () { return github_1.getFileInfoFromGitHub; } });
|
|
6
9
|
Object.defineProperty(exports, "viewFileUsingGitHub", { enumerable: true, get: function () { return github_1.viewFileUsingGitHub; } });
|
|
7
|
-
var tools_1 = require("../../tools");
|
|
8
|
-
Object.defineProperty(exports, "allToolsDefinitions", { enumerable: true, get: function () { return tools_1.allToolsDefinitions; } });
|
|
9
10
|
var base_1 = require("../base");
|
|
10
|
-
Object.defineProperty(exports, "
|
|
11
|
-
|
|
12
|
-
Object.defineProperty(exports, "
|
|
11
|
+
Object.defineProperty(exports, "BaseAgent", { enumerable: true, get: function () { return base_1.BaseAgent; } });
|
|
12
|
+
var index_1 = require("../index");
|
|
13
|
+
Object.defineProperty(exports, "MODE_TO_AGENT_MAP", { enumerable: true, get: function () { return index_1.MODE_TO_AGENT_MAP; } });
|
|
14
|
+
var triage_1 = require("../triage");
|
|
15
|
+
Object.defineProperty(exports, "TriageAgent", { enumerable: true, get: function () { return triage_1.TriageAgent; } });
|
|
16
|
+
var index_2 = require("./index");
|
|
17
|
+
Object.defineProperty(exports, "ChatAgent", { enumerable: true, get: function () { return index_2.ChatAgent; } });
|
|
13
18
|
var models_1 = require("./models");
|
|
14
|
-
Object.defineProperty(exports, "getDefaultChatModelId", { enumerable: true, get: function () { return models_1.getDefaultChatModelId; } });
|
|
15
19
|
Object.defineProperty(exports, "resolveChatModelBasedOnInput", { enumerable: true, get: function () { return models_1.resolveChatModelBasedOnInput; } });
|
|
16
20
|
var state_1 = require("./state");
|
|
17
21
|
Object.defineProperty(exports, "CHAT_STATE_VERSIONS_MIGRATIONS_MAP", { enumerable: true, get: function () { return state_1.CHAT_STATE_VERSIONS_MIGRATIONS_MAP; } });
|
|
@@ -24,9 +28,3 @@ Object.defineProperty(exports, "LATEST_CHAT_STATE_VERSION", { enumerable: true,
|
|
|
24
28
|
Object.defineProperty(exports, "migrateChatState", { enumerable: true, get: function () { return state_1.migrateChatState; } });
|
|
25
29
|
var utils_1 = require("./utils");
|
|
26
30
|
Object.defineProperty(exports, "extractAttachments", { enumerable: true, get: function () { return utils_1.extractAttachments; } });
|
|
27
|
-
var tool_calls_1 = require("./utils/tool-calls");
|
|
28
|
-
Object.defineProperty(exports, "processToolCallsAndUpdateChatState", { enumerable: true, get: function () { return tool_calls_1.processToolCallsAndUpdateChatState; } });
|
|
29
|
-
Object.defineProperty(exports, "rejectPendingToolCalls", { enumerable: true, get: function () { return tool_calls_1.rejectPendingToolCalls; } });
|
|
30
|
-
var chat_1 = require("@empiricalrun/llm/chat");
|
|
31
|
-
Object.defineProperty(exports, "createChatModel", { enumerable: true, get: function () { return chat_1.createChatModel; } });
|
|
32
|
-
Object.defineProperty(exports, "SUPPORTED_CHAT_MODELS", { enumerable: true, get: function () { return chat_1.SUPPORTED_CHAT_MODELS; } });
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
useTriage: boolean;
|
|
8
|
-
useFSCache: boolean;
|
|
9
|
-
resetChat: boolean;
|
|
10
|
-
}): Promise<void>;
|
|
1
|
+
import type { ToolsForLLM } from "@empiricalrun/shared-types";
|
|
2
|
+
import { BaseAgent } from "../base";
|
|
3
|
+
export declare class ChatAgent extends BaseAgent {
|
|
4
|
+
protected getTools(): ToolsForLLM;
|
|
5
|
+
protected buildSystemPrompt(repoContext?: string): Promise<string>;
|
|
6
|
+
}
|
|
11
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAS9D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIpC,qBAAa,SAAU,SAAQ,SAAS;IACtC,SAAS,CAAC,QAAQ,IAAI,WAAW;cAajB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAuGzE"}
|
package/dist/agent/chat/index.js
CHANGED
|
@@ -1,204 +1,125 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
const llm_1 = require("@empiricalrun/llm");
|
|
6
|
-
const chat_1 = require("@empiricalrun/llm/chat");
|
|
7
|
-
const picocolors_1 = require("picocolors");
|
|
8
|
-
const client_1 = require("../../dashboard/client");
|
|
9
|
-
const reader_1 = require("../../file-info/adapters/file-system/reader");
|
|
10
|
-
const human_in_the_loop_1 = require("../../human-in-the-loop");
|
|
11
|
-
const validation_1 = require("../../recorder/validation");
|
|
12
|
-
const executor_1 = require("../../tools/executor");
|
|
13
|
-
const git_1 = require("../../tools/executor/utils/git");
|
|
3
|
+
exports.ChatAgent = void 0;
|
|
4
|
+
const tools_1 = require("../../tools");
|
|
14
5
|
const base_1 = require("../base");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
const pw_utils_docs_1 = require("./prompt/pw-utils-docs");
|
|
7
|
+
const test_case_def_1 = require("./prompt/test-case-def");
|
|
8
|
+
class ChatAgent extends base_1.BaseAgent {
|
|
9
|
+
getTools() {
|
|
10
|
+
const custom = [
|
|
11
|
+
...tools_1.commonTools,
|
|
12
|
+
...tools_1.testGenerationTools,
|
|
13
|
+
tools_1.analyseVideo,
|
|
14
|
+
...(0, tools_1.textEditorToolsForModel)(this.selectedModel),
|
|
15
|
+
];
|
|
16
|
+
return {
|
|
17
|
+
custom,
|
|
18
|
+
builtInTextEditor: (0, tools_1.hasBuiltInTextEditor)(this.selectedModel),
|
|
19
|
+
};
|
|
25
20
|
}
|
|
21
|
+
async buildSystemPrompt(repoContext) {
|
|
22
|
+
if (!repoContext) {
|
|
23
|
+
throw new Error(`Chat agent needs repo context`);
|
|
24
|
+
}
|
|
25
|
+
const preamble = `
|
|
26
|
+
You are a helpful assistant that can answer questions and help with tasks related to writing and maintaining Playwright tests.
|
|
27
|
+
|
|
28
|
+
You are working on a test code repository that contains Playwright tests and other related files. Your working directory
|
|
29
|
+
has been checked out on a git branch, and your actions that edit files will be automatically committed. If you make any
|
|
30
|
+
file edits, you must create a pull request after your work is done, to get your work reviewed and merged by a human.
|
|
31
|
+
|
|
32
|
+
# Your capabilities
|
|
33
|
+
|
|
34
|
+
- Adding new Playwright tests or helper methods
|
|
35
|
+
- Going through test reports and identifying app issues versus test issues
|
|
36
|
+
- Modifying existing tests to adapt to changes in the application
|
|
37
|
+
- Modifying repo configuration (e.g. in playwright.config.ts) and dependencies (e.g. in package.json)
|
|
38
|
+
|
|
39
|
+
# Going through test reports
|
|
40
|
+
|
|
41
|
+
- App issues: app issues caught by test failures, like UI issues, API endpoint issues, etc. These are issues that
|
|
42
|
+
will be reported to an app developer to investigate and fix.
|
|
43
|
+
- Test issues: Playwright tests can become outdated when app code changes. These are issues that need to be
|
|
44
|
+
fixed with modifications to the test code, and it is your job to do that.
|
|
45
|
+
|
|
46
|
+
# Tools
|
|
47
|
+
|
|
48
|
+
You are given a set of tools (= functions) to help you fulfill the user's request. Read their descriptions
|
|
49
|
+
to understand what each tool does. You are HIGHLY encouraged to use tools and generate a high quality output.
|
|
50
|
+
|
|
51
|
+
For example,
|
|
52
|
+
|
|
53
|
+
1. If you are adding or modifying a test, run the test to ensure it works well.
|
|
54
|
+
2. Every test run generates report artifacts, and you have tools to read markdown files, see screenshots and videos. Use them to understand the test results
|
|
55
|
+
and fix test issues.
|
|
56
|
+
3. Use the grep and file view tools to read the codebase. While the codebase only has Playwright tests, there are often patterns that can be reused.
|
|
57
|
+
|
|
58
|
+
# Proactiveness
|
|
59
|
+
|
|
60
|
+
You are encouraged to be proactive. Use the tools, explore the repo, and accomplish the task that the user has given to you. As long as your actions
|
|
61
|
+
are aligned with the user's objective, you should lean on being more proactive than not.
|
|
62
|
+
|
|
63
|
+
If you are supposed to add or modify a test, understand the context, make changes, run the test, and go over this loop until you have achieved
|
|
64
|
+
the user's goal - OR, ask the user for clarifications if there's some confusion.
|
|
65
|
+
|
|
66
|
+
If you are unsure about next steps, or have some evidence to modify the user's objective, ask for clarification with a brief summary of
|
|
67
|
+
your findings and 1-2 questions for the user to help you understand the user's objective better.
|
|
68
|
+
|
|
69
|
+
# Rules to follow
|
|
70
|
+
|
|
71
|
+
You must follow these rules while adding new tests or modifying existing tests. There can be exceptions to these rules, but
|
|
72
|
+
ONLY when explicitly asked for by the user.
|
|
73
|
+
|
|
74
|
+
1. You can't delete some steps from the test to make it pass. The test needs to accomplish its objective (which is to validate a particular user scenario)
|
|
75
|
+
2. Do not add any conditional logic or try catch blocks in a test. A good test deterministically tests a user scenario
|
|
76
|
+
3. Trust Playwright's ability to auto-wait while taking actions on elements.
|
|
77
|
+
- Example 1: Do not add checks on locator.isVisible() before clicking on it: Playwright already waits for visibility on locator.click()
|
|
78
|
+
- Example 2: Do not add page.waitForLoadState after a page.goto: Playwright already waits for page "load" event in page.goto()
|
|
79
|
+
4. Do not add waitForTimeout or waitForLoadState in a test. Playwright will automatically wait for the page to load.
|
|
80
|
+
5. Try/catch blocks are a code smell for tests: you should not use them.
|
|
81
|
+
6. Do not use then() or catch() syntax in a test. Use async/await only
|
|
82
|
+
|
|
83
|
+
There are few exceptions to these rules. BEFORE applying any of the following exceptions, you MUST share your plan with the user and get their approval.
|
|
84
|
+
|
|
85
|
+
## Exceptions for conditional logic
|
|
86
|
+
|
|
87
|
+
There are few exceptions where you can add conditional logic to a test. If the application UI reveals some UI elements on certain conditions, we can add conditional logic.
|
|
88
|
+
|
|
89
|
+
For example, a form view shows a "Save" button only when the form is dirty. In this case, we will have to check if the "Save" button is visible before clicking on it. To do this,
|
|
90
|
+
follow this pattern:
|
|
91
|
+
|
|
92
|
+
\`\`\`
|
|
93
|
+
const saveButton = page.getByRole('button', { name: 'Save' });
|
|
94
|
+
if (await saveButton.isVisible()) {
|
|
95
|
+
await saveButton.click();
|
|
26
96
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
apiClient = new client_1.DashboardAPIClient({
|
|
39
|
-
authType: "user-access-token",
|
|
40
|
-
});
|
|
41
|
-
const repoName = await (0, validation_1.validatePackageJson)(process.cwd());
|
|
42
|
-
queryParams = { project_repo_name: repoName };
|
|
43
|
-
}
|
|
44
|
-
const data = await apiClient.request("/api/environment-variables", { method: "GET", params: queryParams });
|
|
45
|
-
if (!data.data || !data.data.environment_variables) {
|
|
46
|
-
console.error("Failed to fetch environment variables:", data);
|
|
47
|
-
throw new Error("Failed to fetch environment variables");
|
|
48
|
-
}
|
|
49
|
-
const envVars = data.data.environment_variables.reduce((acc, envVar) => {
|
|
50
|
-
acc[envVar.name] = envVar.value;
|
|
51
|
-
return acc;
|
|
52
|
-
}, {});
|
|
53
|
-
return envVars;
|
|
97
|
+
\`\`\`
|
|
98
|
+
|
|
99
|
+
Note that locator.isVisible() DOES NOT wait for the element to be visible. If the element in question shows up after a delay, we have no option but to add a waitForTimeout.
|
|
100
|
+
|
|
101
|
+
\`\`\`
|
|
102
|
+
const saveButton = page.getByRole('button', { name: 'Save' });
|
|
103
|
+
await page.waitForTimeout(100); // Wait for the element to be visible -- only if necessary.
|
|
104
|
+
if (await saveButton.isVisible()) {
|
|
105
|
+
await saveButton.click();
|
|
54
106
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
chatModel.validateEnvVarsForAuth();
|
|
72
|
-
if (initialPromptContent && chatModel.messages.length === 0) {
|
|
73
|
-
chatModel.pushUserMessage(initialPromptContent, []);
|
|
74
|
-
}
|
|
75
|
-
else if (initialPromptContent && chatModel.messages.length > 0) {
|
|
76
|
-
console.warn(`Ignoring initial prompt because we have existing messages.`);
|
|
77
|
-
}
|
|
78
|
-
if (chatModel.askUserForInput) {
|
|
79
|
-
// Show last message to the user for context when we loaded from disk
|
|
80
|
-
const latest = chatModel.getHumanReadableLatestMessage();
|
|
81
|
-
if (latest) {
|
|
82
|
-
console.log(`${(0, picocolors_1.blue)(latest.role)}: ${latest.textMessage}`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (chatState && chatState.error) {
|
|
86
|
-
// Reset error state as we are attempting a retry
|
|
87
|
-
chatState.error = null;
|
|
88
|
-
}
|
|
89
|
-
const handleSigInt = () => {
|
|
90
|
-
concludeAgent(chatModel, useDiskForChatState, selectedModel, null);
|
|
91
|
-
process.exit(0);
|
|
92
|
-
};
|
|
93
|
-
process.once("SIGINT", handleSigInt);
|
|
94
|
-
process.once("SIGTERM", handleSigInt);
|
|
95
|
-
let userPrompt;
|
|
96
|
-
let reporterFunc = async (chatState, latest) => {
|
|
97
|
-
if (useDiskForChatState) {
|
|
98
|
-
(0, state_1.saveToDisk)(chatState.messages, selectedModel, chatState.askUserForInput, chatState.error);
|
|
99
|
-
}
|
|
100
|
-
if (latest) {
|
|
101
|
-
if (!enableStreaming) {
|
|
102
|
-
console.log(`${(0, picocolors_1.blue)(latest.role)}: ${latest.textMessage}`);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
process.stdout.write(`\n`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const trace = (0, llm_1.createLangfuseTrace)({
|
|
110
|
-
name: "chat_agent",
|
|
111
|
-
input: initialPromptContent || "",
|
|
112
|
-
tags: [selectedModel, "chat_agent"],
|
|
113
|
-
});
|
|
114
|
-
if (trace) {
|
|
115
|
-
const traceUrl = trace.getTraceUrl();
|
|
116
|
-
console.log(`Starting ${selectedModel}: ${traceUrl}`);
|
|
117
|
-
}
|
|
118
|
-
let authType = "user-access-token";
|
|
119
|
-
if (process.env.EMPIRICALRUN_API_KEY) {
|
|
120
|
-
authType = "project-api-key";
|
|
121
|
-
}
|
|
122
|
-
const apiClient = new client_1.DashboardAPIClient({
|
|
123
|
-
authType,
|
|
124
|
-
});
|
|
125
|
-
const fileInfo = await (0, reader_1.getFileInfoFromFS)(process.cwd());
|
|
126
|
-
const agentParams = { featureFlags: [], repoInfo: fileInfo, selectedModel };
|
|
127
|
-
const agent = useTriage
|
|
128
|
-
? new base_1.TriageAgent(agentParams)
|
|
129
|
-
: new base_1.ChatAgent(agentParams);
|
|
130
|
-
while (!stopCriteria(userPrompt)) {
|
|
131
|
-
if (chatModel.askUserForInput) {
|
|
132
|
-
try {
|
|
133
|
-
userPrompt = await human_in_the_loop_1.humanLoop.getFeedback({
|
|
134
|
-
message: "User:",
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
catch (e) {
|
|
138
|
-
// https://github.com/SBoudrias/Inquirer.js/issues/1502#issuecomment-2275991680
|
|
139
|
-
if (e instanceof Error && e.name === "ExitPromptError") {
|
|
140
|
-
concludeAgent(chatModel, useDiskForChatState, selectedModel, null);
|
|
141
|
-
process.exit(0);
|
|
142
|
-
}
|
|
143
|
-
concludeAgent(chatModel, useDiskForChatState, selectedModel, {
|
|
144
|
-
message: e.message,
|
|
145
|
-
stack: e.stack || "Stack trace not available",
|
|
146
|
-
timestamp: new Date().toISOString(),
|
|
147
|
-
});
|
|
148
|
-
throw e;
|
|
149
|
-
}
|
|
150
|
-
if (!stopCriteria(userPrompt)) {
|
|
151
|
-
const { text, attachments } = (0, utils_1.extractAttachments)(userPrompt);
|
|
152
|
-
chatModel.pushUserMessage(text, attachments);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
const toolExecutor = new executor_1.ToolExecutor({
|
|
157
|
-
chatSession: null,
|
|
158
|
-
branchName,
|
|
159
|
-
repoPath: process.cwd(),
|
|
160
|
-
apiClient,
|
|
161
|
-
trace,
|
|
162
|
-
featureFlags: [],
|
|
163
|
-
environmentOverrides: await fetchEnvironmentVariables(),
|
|
164
|
-
});
|
|
165
|
-
await agent.runLoop({
|
|
166
|
-
chatModel,
|
|
167
|
-
reporter: reporterFunc,
|
|
168
|
-
streamingMessageReporter: (() => {
|
|
169
|
-
if (!enableStreaming) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
let hasStarted = false;
|
|
173
|
-
let startedRole = undefined;
|
|
174
|
-
return async (delta, snapshot, thinking) => {
|
|
175
|
-
if (delta) {
|
|
176
|
-
const role = thinking ? "Thinking" : "Assistant";
|
|
177
|
-
if (!hasStarted) {
|
|
178
|
-
process.stdout.write(`${(0, picocolors_1.blue)(role)}: `);
|
|
179
|
-
hasStarted = true;
|
|
180
|
-
startedRole = role;
|
|
181
|
-
}
|
|
182
|
-
else if (hasStarted && role !== startedRole) {
|
|
183
|
-
// Changing from thinking -> text block
|
|
184
|
-
process.stdout.write("\n");
|
|
185
|
-
process.stdout.write(`${(0, picocolors_1.blue)(role)}: `);
|
|
186
|
-
startedRole = role;
|
|
187
|
-
}
|
|
188
|
-
process.stdout.write(delta);
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
})(),
|
|
192
|
-
trace,
|
|
193
|
-
onPendingToolCall: async (toolCalls) => {
|
|
194
|
-
const toolResults = await toolExecutor.execute(toolCalls);
|
|
195
|
-
chatModel.pushToolResultsMessage(toolCalls, toolResults);
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
}
|
|
107
|
+
\`\`\`
|
|
108
|
+
|
|
109
|
+
`;
|
|
110
|
+
return `${preamble}
|
|
111
|
+
|
|
112
|
+
${test_case_def_1.testCasesDefinitionPrompt}
|
|
113
|
+
|
|
114
|
+
# Recipes
|
|
115
|
+
${pw_utils_docs_1.playwrightUtilsDocs}
|
|
116
|
+
|
|
117
|
+
# Repo context
|
|
118
|
+
${repoContext}
|
|
119
|
+
|
|
120
|
+
# Reference
|
|
121
|
+
Today's date is ${new Date().toDateString()}
|
|
122
|
+
`;
|
|
199
123
|
}
|
|
200
|
-
trace?.update({ output: { messages: chatModel.messages } });
|
|
201
|
-
await llm_1.langfuseInstance?.flushAsync();
|
|
202
|
-
const usageSummary = (0, state_1.getUsageSummary)(chatModel);
|
|
203
|
-
console.log(`\n${(0, picocolors_1.gray)("Usage summary -> " + usageSummary)}`);
|
|
204
124
|
}
|
|
125
|
+
exports.ChatAgent = ChatAgent;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { SupportedChatModels } from "@empiricalrun/shared-types";
|
|
2
|
-
export declare function getDefaultChatModelId(): SupportedChatModels;
|
|
3
2
|
export declare const resolveChatModelBasedOnInput: (requestedModel?: string) => SupportedChatModels;
|
|
4
|
-
export declare const modelLabels: Record<SupportedChatModels, string>;
|
|
5
3
|
//# sourceMappingURL=models.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAMjE,eAAO,MAAM,4BAA4B,GACvC,iBAAiB,MAAM,KACtB,mBAsBF,CAAC"}
|
|
@@ -1,38 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.getDefaultChatModelId = getDefaultChatModelId;
|
|
3
|
+
exports.resolveChatModelBasedOnInput = void 0;
|
|
5
4
|
const chat_1 = require("@empiricalrun/llm/chat");
|
|
6
5
|
const model_1 = require("../../utils/model");
|
|
7
|
-
|
|
8
|
-
const DEFAULT_CHAT_MODEL_ID = "claude-sonnet-4-20250514";
|
|
9
|
-
if (!chat_1.SUPPORTED_CHAT_MODELS.some((m) => m.id === DEFAULT_CHAT_MODEL_ID)) {
|
|
10
|
-
throw new Error("Default chat model is not in SUPPORTED_CHAT_MODELS");
|
|
11
|
-
}
|
|
12
|
-
return DEFAULT_CHAT_MODEL_ID;
|
|
13
|
-
}
|
|
6
|
+
const DEFAULT_AUTO_FALLBACK_MODEL = "gpt-5-codex";
|
|
14
7
|
const resolveChatModelBasedOnInput = (requestedModel) => {
|
|
15
8
|
const sanitizedModelInput = requestedModel?.trim().toLowerCase();
|
|
16
9
|
if (!sanitizedModelInput || sanitizedModelInput === "auto") {
|
|
17
|
-
|
|
18
|
-
return autoSelectedModelId;
|
|
10
|
+
return DEFAULT_AUTO_FALLBACK_MODEL;
|
|
19
11
|
}
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (matchedModel) {
|
|
25
|
-
return matchedModel.id;
|
|
26
|
-
}
|
|
12
|
+
// Check for exact match first
|
|
13
|
+
const matchedModel = chat_1.SUPPORTED_CHAT_MODELS.find((model) => model.id.toLowerCase() === sanitizedModelInput);
|
|
14
|
+
if (matchedModel) {
|
|
15
|
+
return matchedModel.id;
|
|
27
16
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
// Check for CLI args match (smaller aliases for full model names)
|
|
18
|
+
const resolvedModelId = model_1.CLI_ARGS_TO_MODEL_MAP[sanitizedModelInput];
|
|
19
|
+
if (resolvedModelId) {
|
|
20
|
+
return resolvedModelId;
|
|
31
21
|
}
|
|
32
|
-
|
|
22
|
+
throw new Error(`Invalid chat model: ${requestedModel}`);
|
|
33
23
|
};
|
|
34
24
|
exports.resolveChatModelBasedOnInput = resolveChatModelBasedOnInput;
|
|
35
|
-
exports.modelLabels = chat_1.SUPPORTED_CHAT_MODELS.reduce((acc, model) => ({
|
|
36
|
-
...acc,
|
|
37
|
-
[model.id]: model.label,
|
|
38
|
-
}), {});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const playwrightUtilsDocs = "\nYou can refer to the following recipes to learn how to write tests for different scenarios.\n\n<email-automation>\n\n# Email automation\n\n## Example usage\n\n### Dynamic email\n\nThis dynamically generates a random email address that can \nbe used for the test (e.g. invite a new user).\n\n```ts\nimport { EmailClient } from \"@empiricalrun/playwright-utils\";\nimport { expect } from \"@playwright/test\";\n\nconst client = new EmailClient();\nconst address = client.getAddress();\n\n// Input the `address` in the application\n// that sends the email.\n\n// Get email received on the `address`\nconst email = await client.waitForEmail();\nexpect(\n email.links.find((l) => l.text === \"Join your team\")\n).toBeTruthy();\n```\n\n### Static email\n\nThis uses a known (static) email that can be used to login\ninto an application.\n\nThis needs an email id (e.g. `test-login-user`). The email id\nis appended with the domain (managed internally) to get the full\nemail address.\n\n```ts\nimport { EmailClient } from \"@empiricalrun/playwright-utils\";\n\nconst emailId = `test-login-user`;\n\nconst client = new EmailClient({ emailId });\nconst address = client.getAddress(); // Returns full address with domain\n\n// Get email received on the `address`\nconst email = await client.waitForEmail();\n\n// Get login OTP\nconst loginCode = email.codes[0];\n```\n\n</email-automation>\n\n";
|
|
1
|
+
export declare const playwrightUtilsDocs = "\nYou can refer to the following recipes to learn how to write tests for different scenarios.\n\n<email-automation>\n\n# Email automation\n\n## Example usage\n\n### Dynamic email\n\nThis dynamically generates a random email address that can \nbe used for the test (e.g. invite a new user).\n\n```ts\nimport { EmailClient } from \"@empiricalrun/playwright-utils\";\nimport { expect } from \"@playwright/test\";\n\nconst client = new EmailClient();\nconst address = client.getAddress();\n\n// Input the `address` in the application\n// that sends the email.\n\n// Get email received on the `address`\nconst email = await client.waitForEmail();\nexpect(\n email.links.find((l) => l.text === \"Join your team\")\n).toBeTruthy();\n```\n\n### Static email\n\nThis uses a known (static) email that can be used to login\ninto an application.\n\nThis needs an email id (e.g. `test-login-user`). The email id\nis appended with the domain (managed internally) to get the full\nemail address.\n\n```ts\nimport { EmailClient } from \"@empiricalrun/playwright-utils\";\n\nconst emailId = `test-login-user`;\n\nconst client = new EmailClient({ emailId });\nconst address = client.getAddress(); // Returns full address with domain\n\n// Get email received on the `address`\nconst email = await client.waitForEmail();\n\n// Get login OTP\nconst loginCode = email.codes[0];\n```\n\n</email-automation>\n\n<fixtures>\n\nThe playwright-utils package provides fixtures that wrap around Playwright's built-in\n`page`, `context` fixtures to provide a mouse highlighter (which makes it easier to\nsee actions taken in a video).\n\nTo use this, you can use the `baseTestFixture` and `extendExpect` imports\nin your fixtures file.\n\n```ts\nimport { test as base, expect as baseExpect } from \"@playwright/test\";\nimport { baseTestFixture, extendExpect } from \"@empiricalrun/playwright-utils/test\";\n\nexport const test = baseTestFixture(base);\nexport const expect = extendExpect(baseExpect);\n```\n\n### Get a new browser context\n\nThis package provides a fixture `customContextPageProvider` which is a good way to create\na fresh, new browser context, and a page inside it.\n\nThere are two benefits of using this to create contexts or pages:\n1. Videos get recorded and attached to the test report\n2. Mouse highlights are available\n\n```ts\nimport { test, expect } from \"./fixtures\";\n\ntest(\"Example test\", async ({ page: builtInPage, customContextPageProvider }) => {\n // builtInPage is from default browser context\n const { page: newPage, context } = await customContextPageProvider();\n // newPage is from this other browser context\n});\n```\n\ncustomContextPageProvider can accept options to customize the browser context.\n\n```\n customContextPageProvider: (\n options?: BrowserContextOptions,\n ) => Promise<{ context: BrowserContext; page: Page }>;\n```\n\nFor example, pass { storageState: undefined } to create a new browser context without\nthe auth state of the current browser context. This is useful for multi-user scenarios.\n\n</fixtures>\n\n";
|
|
2
2
|
//# sourceMappingURL=pw-utils-docs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pw-utils-docs.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/pw-utils-docs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pw-utils-docs.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/pw-utils-docs.ts"],"names":[],"mappings":"AAqGA,eAAO,MAAM,mBAAmB,w/FAW/B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.playwrightUtilsDocs = void 0;
|
|
4
|
+
// Ref: packages/playwright-utils/docs/email.md
|
|
4
5
|
const emailRecipe = `
|
|
5
6
|
# Email automation
|
|
6
7
|
|
|
@@ -52,6 +53,53 @@ const email = await client.waitForEmail();
|
|
|
52
53
|
const loginCode = email.codes[0];
|
|
53
54
|
\`\`\`
|
|
54
55
|
`;
|
|
56
|
+
// Ref: packages/playwright-utils/docs/fixtures.md
|
|
57
|
+
const fixturesRecipe = `
|
|
58
|
+
The playwright-utils package provides fixtures that wrap around Playwright's built-in
|
|
59
|
+
\`page\`, \`context\` fixtures to provide a mouse highlighter (which makes it easier to
|
|
60
|
+
see actions taken in a video).
|
|
61
|
+
|
|
62
|
+
To use this, you can use the \`baseTestFixture\` and \`extendExpect\` imports
|
|
63
|
+
in your fixtures file.
|
|
64
|
+
|
|
65
|
+
\`\`\`ts
|
|
66
|
+
import { test as base, expect as baseExpect } from "@playwright/test";
|
|
67
|
+
import { baseTestFixture, extendExpect } from "@empiricalrun/playwright-utils/test";
|
|
68
|
+
|
|
69
|
+
export const test = baseTestFixture(base);
|
|
70
|
+
export const expect = extendExpect(baseExpect);
|
|
71
|
+
\`\`\`
|
|
72
|
+
|
|
73
|
+
### Get a new browser context
|
|
74
|
+
|
|
75
|
+
This package provides a fixture \`customContextPageProvider\` which is a good way to create
|
|
76
|
+
a fresh, new browser context, and a page inside it.
|
|
77
|
+
|
|
78
|
+
There are two benefits of using this to create contexts or pages:
|
|
79
|
+
1. Videos get recorded and attached to the test report
|
|
80
|
+
2. Mouse highlights are available
|
|
81
|
+
|
|
82
|
+
\`\`\`ts
|
|
83
|
+
import { test, expect } from "./fixtures";
|
|
84
|
+
|
|
85
|
+
test("Example test", async ({ page: builtInPage, customContextPageProvider }) => {
|
|
86
|
+
// builtInPage is from default browser context
|
|
87
|
+
const { page: newPage, context } = await customContextPageProvider();
|
|
88
|
+
// newPage is from this other browser context
|
|
89
|
+
});
|
|
90
|
+
\`\`\`
|
|
91
|
+
|
|
92
|
+
customContextPageProvider can accept options to customize the browser context.
|
|
93
|
+
|
|
94
|
+
\`\`\`
|
|
95
|
+
customContextPageProvider: (
|
|
96
|
+
options?: BrowserContextOptions,
|
|
97
|
+
) => Promise<{ context: BrowserContext; page: Page }>;
|
|
98
|
+
\`\`\`
|
|
99
|
+
|
|
100
|
+
For example, pass { storageState: undefined } to create a new browser context without
|
|
101
|
+
the auth state of the current browser context. This is useful for multi-user scenarios.
|
|
102
|
+
`;
|
|
55
103
|
exports.playwrightUtilsDocs = `
|
|
56
104
|
You can refer to the following recipes to learn how to write tests for different scenarios.
|
|
57
105
|
|
|
@@ -59,4 +107,8 @@ You can refer to the following recipes to learn how to write tests for different
|
|
|
59
107
|
${emailRecipe}
|
|
60
108
|
</email-automation>
|
|
61
109
|
|
|
110
|
+
<fixtures>
|
|
111
|
+
${fixturesRecipe}
|
|
112
|
+
</fixtures>
|
|
113
|
+
|
|
62
114
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/repo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/repo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAuDtD,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,mBA2BzD"}
|