@empiricalrun/test-gen 0.77.0 → 0.78.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 +14 -0
- package/dist/agent/base/index.d.ts +3 -3
- package/dist/agent/base/index.d.ts.map +1 -1
- package/dist/agent/base/index.js +5 -3
- package/dist/agent/chat/exports.d.ts +1 -1
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +1 -3
- package/dist/agent/chat/models.d.ts.map +1 -1
- package/dist/agent/chat/models.js +1 -1
- package/dist/agent/chat/state.d.ts +1 -8
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +0 -15
- package/dist/agent/cli.d.ts.map +1 -1
- package/dist/agent/cli.js +12 -25
- package/dist/agent/code-review/index.d.ts +1 -1
- package/dist/agent/code-review/index.d.ts.map +1 -1
- package/dist/agent/code-review/index.js +3 -0
- package/dist/agent/code-review/types.d.ts +9 -9
- package/dist/agent/code-review/types.d.ts.map +1 -1
- package/dist/agent/triage/index.d.ts +1 -1
- package/dist/agent/triage/index.d.ts.map +1 -1
- package/dist/agent/triage/index.js +9 -14
- package/dist/bin/index.js +0 -55
- package/dist/tools/analyse-video/index.d.ts.map +1 -1
- package/dist/tools/analyse-video/index.js +8 -2
- package/dist/tools/definitions/analyse-video.d.ts +4 -4
- package/dist/tools/definitions/analyse-video.js +2 -2
- package/dist/tools/executor/base.d.ts +1 -1
- package/dist/tools/executor/base.d.ts.map +1 -1
- package/dist/tools/executor/base.js +19 -2
- package/dist/tools/executor/utils/index.d.ts +5 -3
- package/dist/tools/executor/utils/index.d.ts.map +1 -1
- package/dist/tools/executor/utils/index.js +22 -1
- package/dist/tools/file-operations/replace.d.ts.map +1 -1
- package/dist/tools/file-operations/replace.js +20 -21
- 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/review-pull-request/index.d.ts.map +1 -1
- package/dist/tools/review-pull-request/index.js +4 -11
- package/dist/tools/upgrade-packages/index.d.ts.map +1 -1
- package/dist/tools/upgrade-packages/index.js +4 -0
- package/dist/tools/upgrade-packages/utils.d.ts +1 -0
- package/dist/tools/upgrade-packages/utils.d.ts.map +1 -1
- package/dist/tools/upgrade-packages/utils.js +1 -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/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} +0 -13
- package/dist/video-core/agent-orchestrator.d.ts +1 -2
- package/dist/video-core/agent-orchestrator.d.ts.map +1 -1
- package/dist/video-core/agent-orchestrator.js +11 -30
- package/dist/video-core/index.d.ts +11 -16
- package/dist/video-core/index.d.ts.map +1 -1
- package/dist/video-core/index.js +110 -180
- package/dist/video-core/model-limits.d.ts.map +1 -1
- package/dist/video-core/model-limits.js +8 -2
- package/dist/video-core/storage-manager.d.ts.map +1 -1
- package/dist/video-core/storage-manager.js +13 -6
- package/dist/video-core/utils.d.ts +0 -10
- package/dist/video-core/utils.d.ts.map +1 -1
- package/dist/video-core/utils.js +1 -18
- package/package.json +5 -4
- package/tsconfig.tsbuildinfo +1 -1
- 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/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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.78.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b01be05: feat: move task queue to r2-uploader package
|
|
8
|
+
- e65313e: refactor: remove unused functions and streamline video analysis process
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [b01be05]
|
|
13
|
+
- Updated dependencies [e65313e]
|
|
14
|
+
- @empiricalrun/r2-uploader@0.4.0
|
|
15
|
+
- @empiricalrun/llm@0.24.0
|
|
16
|
+
|
|
3
17
|
## 0.77.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IChatCanonicalModel } from "@empiricalrun/llm/chat";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanonicalMessage, ChatState, FileInfo, MessageCheckpoint, PendingToolCall, ReporterFunction, StreamingMessageReporterFunc, SupportedChatModels, TextMessagePart, TextMessageWithAttachmentsPart, ToolResult, ToolsForLLM, TraceClient } from "@empiricalrun/shared-types";
|
|
3
3
|
import { BaseToolExecutor } from "../../tools/executor/base";
|
|
4
4
|
type RunLoopParams<T> = {
|
|
5
5
|
reporter: ReporterFunction;
|
|
@@ -12,7 +12,7 @@ type RunLoopParams<T> = {
|
|
|
12
12
|
};
|
|
13
13
|
export type AgentParams = {
|
|
14
14
|
selectedModel: SupportedChatModels;
|
|
15
|
-
chatState
|
|
15
|
+
chatState?: ChatState;
|
|
16
16
|
featureFlags?: string[];
|
|
17
17
|
workerEnv?: Record<string, string>;
|
|
18
18
|
toolExecutor?: BaseToolExecutor;
|
|
@@ -32,7 +32,7 @@ export declare abstract class BaseAgent {
|
|
|
32
32
|
get messages(): CanonicalMessage[];
|
|
33
33
|
get askUserForInput(): boolean;
|
|
34
34
|
get chatState(): ChatState;
|
|
35
|
-
pushUserMessage(
|
|
35
|
+
pushUserMessage(parts: Array<TextMessagePart | TextMessageWithAttachmentsPart>): ChatState;
|
|
36
36
|
setChatState(chatState: ChatState): void;
|
|
37
37
|
stop(): ChatState;
|
|
38
38
|
processToolResults(toolCalls: PendingToolCall[], toolResults: ToolResult[], checkpoint: MessageCheckpoint | null): ChatState | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,4BAA4B,EAC5B,mBAAmB,EACnB,eAAe,EACf,8BAA8B,EAC9B,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAO7D,KAAK,aAAa,CAAC,CAAC,IAAI;IACtB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,wBAAwB,CAAC,EAAE,4BAA4B,CAAC;IACxD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,aAAa,CAAC,EAAE,CACd,QAAQ,EAAE,CAAC,EACX,aAAa,EAAE,mBAAmB,KAC/B,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,EAAE,mBAAmB,CAAC;IACnC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,8BAAsB,SAAS;IAC7B,YAAY,EAAE,MAAM,EAAE,CAAM;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,aAAa,EAAE,mBAAmB,CAAC;IACnC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,KAAK,CAAC,EAAE,WAAW,CAAC;gBAER,EACV,YAAY,EACZ,aAAa,EACb,SAAS,EACT,SAAS,EACT,YAAY,EACZ,KAAK,GACN,EAAE,WAAW;IAgBd,SAAS,CAAC,QAAQ,CAAC,QAAQ,IAAI,WAAW;IAC1C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAE3E,IAAI,QAAQ,IAAI,gBAAgB,EAAE,CAEjC;IAED,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED,IAAI,SAAS,IAAI,SAAS,CAQzB;IAED,eAAe,CACb,KAAK,EAAE,KAAK,CAAC,eAAe,GAAG,8BAA8B,CAAC,GAC7D,SAAS;IAKZ,YAAY,CAAC,SAAS,EAAE,SAAS;IAQjC,IAAI,IAAI,SAAS;IA6BjB,kBAAkB,CAChB,SAAS,EAAE,eAAe,EAAE,EAC5B,WAAW,EAAE,UAAU,EAAE,EACzB,UAAU,EAAE,iBAAiB,GAAG,IAAI,GACnC,SAAS,GAAG,SAAS;IA4BlB,eAAe,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5D,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC;IAmBxC,6BAA6B,IACzB;QACE,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;KACrB,GACD,SAAS;CAGd"}
|
package/dist/agent/base/index.js
CHANGED
|
@@ -20,7 +20,8 @@ class BaseAgent {
|
|
|
20
20
|
this.workerEnv = workerEnv;
|
|
21
21
|
this.tools = this.getTools();
|
|
22
22
|
this.toolExecutor = toolExecutor;
|
|
23
|
-
|
|
23
|
+
const messages = chatState?.messages || [];
|
|
24
|
+
this.chatModel = (0, chat_1.createChatModel)(messages, this.selectedModel, this.workerEnv);
|
|
24
25
|
this.chatModel.validateEnvVarsForAuth();
|
|
25
26
|
this.trace = trace;
|
|
26
27
|
}
|
|
@@ -39,8 +40,9 @@ class BaseAgent {
|
|
|
39
40
|
error: null,
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
pushUserMessage(
|
|
43
|
-
this.chatModel.
|
|
43
|
+
pushUserMessage(parts) {
|
|
44
|
+
this.chatModel.pushUserPartsMessage(parts);
|
|
45
|
+
return this.chatState;
|
|
44
46
|
}
|
|
45
47
|
setChatState(chatState) {
|
|
46
48
|
this.chatModel = (0, chat_1.createChatModel)(chatState.messages, this.selectedModel, this.workerEnv);
|
|
@@ -8,6 +8,6 @@ export { MODE_TO_AGENT_MAP } from "../index";
|
|
|
8
8
|
export { TriageAgent } from "../triage";
|
|
9
9
|
export { ChatAgent } from "./index";
|
|
10
10
|
export { resolveChatModelBasedOnInput } from "./models";
|
|
11
|
-
export { CHAT_STATE_VERSIONS_MIGRATIONS_MAP, chatStateFromModel,
|
|
11
|
+
export { CHAT_STATE_VERSIONS_MIGRATIONS_MAP, chatStateFromModel, fetchToolCallFromId, getLatestDownloadBuildUrl, LATEST_CHAT_STATE_VERSION, migrateChatState, } from "./state";
|
|
12
12
|
export { extractAttachments } from "./utils";
|
|
13
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,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,
|
|
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,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractAttachments = exports.migrateChatState = exports.LATEST_CHAT_STATE_VERSION = exports.getLatestDownloadBuildUrl = exports.fetchToolCallFromId = exports.
|
|
3
|
+
exports.extractAttachments = exports.migrateChatState = exports.LATEST_CHAT_STATE_VERSION = exports.getLatestDownloadBuildUrl = exports.fetchToolCallFromId = 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
4
|
var chat_1 = require("@empiricalrun/llm/chat");
|
|
5
5
|
Object.defineProperty(exports, "createChatModel", { enumerable: true, get: function () { return chat_1.createChatModel; } });
|
|
6
6
|
Object.defineProperty(exports, "SUPPORTED_CHAT_MODELS", { enumerable: true, get: function () { return chat_1.SUPPORTED_CHAT_MODELS; } });
|
|
@@ -20,8 +20,6 @@ Object.defineProperty(exports, "resolveChatModelBasedOnInput", { enumerable: tru
|
|
|
20
20
|
var state_1 = require("./state");
|
|
21
21
|
Object.defineProperty(exports, "CHAT_STATE_VERSIONS_MIGRATIONS_MAP", { enumerable: true, get: function () { return state_1.CHAT_STATE_VERSIONS_MIGRATIONS_MAP; } });
|
|
22
22
|
Object.defineProperty(exports, "chatStateFromModel", { enumerable: true, get: function () { return state_1.chatStateFromModel; } });
|
|
23
|
-
Object.defineProperty(exports, "createChatState", { enumerable: true, get: function () { return state_1.createChatState; } });
|
|
24
|
-
Object.defineProperty(exports, "createChatStateForMessages", { enumerable: true, get: function () { return state_1.createChatStateForMessages; } });
|
|
25
23
|
Object.defineProperty(exports, "fetchToolCallFromId", { enumerable: true, get: function () { return state_1.fetchToolCallFromId; } });
|
|
26
24
|
Object.defineProperty(exports, "getLatestDownloadBuildUrl", { enumerable: true, get: function () { return state_1.getLatestDownloadBuildUrl; } });
|
|
27
25
|
Object.defineProperty(exports, "LATEST_CHAT_STATE_VERSION", { enumerable: true, get: function () { return state_1.LATEST_CHAT_STATE_VERSION; } });
|
|
@@ -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;AAOjE,eAAO,MAAM,4BAA4B,GACvC,iBAAiB,MAAM,KACtB,mBAsBF,CAAC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resolveChatModelBasedOnInput = void 0;
|
|
4
4
|
const chat_1 = require("@empiricalrun/llm/chat");
|
|
5
5
|
const model_1 = require("../../utils/model");
|
|
6
|
-
const DEFAULT_AUTO_FALLBACK_MODEL = "
|
|
6
|
+
const DEFAULT_AUTO_FALLBACK_MODEL = "claude-sonnet-4-5-20250929";
|
|
7
7
|
const resolveChatModelBasedOnInput = (requestedModel) => {
|
|
8
8
|
const sanitizedModelInput = requestedModel?.trim().toLowerCase();
|
|
9
9
|
if (!sanitizedModelInput || sanitizedModelInput === "auto") {
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { IChatCanonicalModel, IChatModel } from "@empiricalrun/llm/chat";
|
|
2
|
-
import {
|
|
2
|
+
import { CanonicalMessage, ChatState, ChatStateError, PendingToolCall, SupportedChatModels, ToolResult } from "@empiricalrun/shared-types";
|
|
3
3
|
export declare const CHAT_STATE_VERSIONS_MIGRATIONS_MAP: Record<string, (state: any) => any>;
|
|
4
4
|
export declare const LATEST_CHAT_STATE_VERSION = "0.1";
|
|
5
5
|
export declare const CHAT_STATE_PATH: string;
|
|
6
|
-
export declare function createChatState({ userPrompt, attachments, existingState, selectedModel, error, }: {
|
|
7
|
-
userPrompt: string | undefined;
|
|
8
|
-
attachments: Attachment[];
|
|
9
|
-
existingState: ChatState | undefined;
|
|
10
|
-
selectedModel: SupportedChatModels;
|
|
11
|
-
error: ChatStateError | null;
|
|
12
|
-
}): ChatState;
|
|
13
6
|
export declare function createChatStateForMessages({ messages, selectedModel, askUserForInput, error, }: {
|
|
14
7
|
messages: CanonicalMessage[];
|
|
15
8
|
selectedModel: SupportedChatModels;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/state.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,eAAe,EACf,mBAAmB,EAEnB,UAAU,EACX,MAAM,4BAA4B,CAAC;AAMpC,eAAO,MAAM,kCAAkC,EAAE,MAAM,CACrD,MAAM,EACN,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAGpB,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAQ,CAAC;AAE/C,eAAO,MAAM,eAAe,QAI3B,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,aAAa,EACb,eAAe,EACf,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,aAAa,EAAE,mBAAmB,CAAC;IACnC,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B,GAAG,SAAS,CASZ;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,EACpC,SAAS,EACT,KAAK,GACN,EAAE;IACD,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC;IAC/C,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B,aAOA;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CA0B5D;AAED,wBAAgB,aAAa,CAAC,EAC5B,SAAS,GACV,EAAE;IACD,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,SAAS,GAAG,SAAS,CAsBxB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,SAAS,CAqBzD;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,QAQ9C;AA2BD,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,MAAM,GAAG,IAAI,CAef;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,gBAAgB,EAAE,GAC3B;IACD,gBAAgB,EAAE,IAAI,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAC;IACtC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;CACpC,CA0BA"}
|
package/dist/agent/chat/state.js
CHANGED
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CHAT_STATE_PATH = exports.LATEST_CHAT_STATE_VERSION = exports.CHAT_STATE_VERSIONS_MIGRATIONS_MAP = void 0;
|
|
7
|
-
exports.createChatState = createChatState;
|
|
8
7
|
exports.createChatStateForMessages = createChatStateForMessages;
|
|
9
8
|
exports.chatStateFromModel = chatStateFromModel;
|
|
10
9
|
exports.getUsageSummary = getUsageSummary;
|
|
@@ -13,7 +12,6 @@ exports.migrateChatState = migrateChatState;
|
|
|
13
12
|
exports.saveToDisk = saveToDisk;
|
|
14
13
|
exports.getLatestDownloadBuildUrl = getLatestDownloadBuildUrl;
|
|
15
14
|
exports.fetchToolCallFromId = fetchToolCallFromId;
|
|
16
|
-
const chat_1 = require("@empiricalrun/llm/chat");
|
|
17
15
|
const fs_1 = __importDefault(require("fs"));
|
|
18
16
|
const path_1 = __importDefault(require("path"));
|
|
19
17
|
exports.CHAT_STATE_VERSIONS_MIGRATIONS_MAP = {
|
|
@@ -21,19 +19,6 @@ exports.CHAT_STATE_VERSIONS_MIGRATIONS_MAP = {
|
|
|
21
19
|
};
|
|
22
20
|
exports.LATEST_CHAT_STATE_VERSION = "0.1";
|
|
23
21
|
exports.CHAT_STATE_PATH = path_1.default.join(process.cwd(), ".empiricalrun", "last-chat.json");
|
|
24
|
-
function createChatState({ userPrompt, attachments, existingState, selectedModel, error, }) {
|
|
25
|
-
const messages = existingState?.messages || [];
|
|
26
|
-
const chatModel = (0, chat_1.createChatModel)(messages, selectedModel);
|
|
27
|
-
if (userPrompt) {
|
|
28
|
-
chatModel.pushUserMessage(userPrompt, attachments);
|
|
29
|
-
}
|
|
30
|
-
return createChatStateForMessages({
|
|
31
|
-
messages: chatModel.messages,
|
|
32
|
-
selectedModel,
|
|
33
|
-
askUserForInput: chatModel.askUserForInput,
|
|
34
|
-
error,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
22
|
function createChatStateForMessages({ messages, selectedModel, askUserForInput, error, }) {
|
|
38
23
|
// TODO: Add better types for messages
|
|
39
24
|
return {
|
package/dist/agent/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/agent/cli.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAKb,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/agent/cli.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAKb,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AA0BpC,wBAAsB,yBAAyB,IAAI,OAAO,CACxD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CACvB,CAkCA;AAED,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,UAAU,GACX,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB,iBA+JA"}
|
package/dist/agent/cli.js
CHANGED
|
@@ -67,30 +67,6 @@ async function runChatAgentForCLI({ useDiskForChatState, selectedModel, initialP
|
|
|
67
67
|
// Reset error state as we are attempting a retry
|
|
68
68
|
chatState.error = null;
|
|
69
69
|
}
|
|
70
|
-
if (initialPromptContent) {
|
|
71
|
-
if (!chatState) {
|
|
72
|
-
const { text, attachments } = (0, utils_1.extractAttachments)(initialPromptContent);
|
|
73
|
-
chatState = (0, state_1.createChatState)({
|
|
74
|
-
userPrompt: text,
|
|
75
|
-
attachments: attachments,
|
|
76
|
-
existingState: undefined,
|
|
77
|
-
selectedModel,
|
|
78
|
-
error: null,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
console.warn(`Ignoring initial prompt because we have existing chat state.`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (!chatState) {
|
|
86
|
-
chatState = (0, state_1.createChatState)({
|
|
87
|
-
userPrompt: undefined,
|
|
88
|
-
attachments: [],
|
|
89
|
-
selectedModel,
|
|
90
|
-
existingState: undefined,
|
|
91
|
-
error: null,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
70
|
const handleSigInt = () => {
|
|
95
71
|
concludeAgent(agent, useDiskForChatState);
|
|
96
72
|
process.exit(0);
|
|
@@ -143,6 +119,17 @@ async function runChatAgentForCLI({ useDiskForChatState, selectedModel, initialP
|
|
|
143
119
|
toolExecutor,
|
|
144
120
|
};
|
|
145
121
|
const agent = index_1.MODE_TO_AGENT_MAP[agentMode]({ ...agentParams });
|
|
122
|
+
// If we have an initial prompt and no existing chat state, push it to the agent
|
|
123
|
+
if (initialPromptContent && !chatState) {
|
|
124
|
+
const { text, attachments } = (0, utils_1.extractAttachments)(initialPromptContent);
|
|
125
|
+
const updatedChatState = agent.pushUserMessage([{ text, attachments }]);
|
|
126
|
+
if (useDiskForChatState) {
|
|
127
|
+
(0, state_1.saveToDisk)(updatedChatState);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (initialPromptContent && chatState) {
|
|
131
|
+
console.warn(`Ignoring initial prompt because we have existing chat state.`);
|
|
132
|
+
}
|
|
146
133
|
if (agent.askUserForInput) {
|
|
147
134
|
// Show last message to the user for context when we loaded from disk
|
|
148
135
|
const latest = agent.getHumanReadableLatestMessage();
|
|
@@ -168,7 +155,7 @@ async function runChatAgentForCLI({ useDiskForChatState, selectedModel, initialP
|
|
|
168
155
|
}
|
|
169
156
|
if (!stopCriteria(userPrompt)) {
|
|
170
157
|
const { text, attachments } = (0, utils_1.extractAttachments)(userPrompt);
|
|
171
|
-
agent.pushUserMessage(text, attachments);
|
|
158
|
+
agent.pushUserMessage([{ text, attachments }]);
|
|
172
159
|
}
|
|
173
160
|
}
|
|
174
161
|
else {
|
|
@@ -3,7 +3,7 @@ import { BaseAgent } from "../base";
|
|
|
3
3
|
import { type CodeReviewResultV0, type CodeReviewResultV1, type CodeReviewResultV2, CodeReviewSeverity, CodeReviewVerdict } from "./types";
|
|
4
4
|
export type { CodeReviewResultV1, CodeReviewResultV0, CodeReviewResultV2 };
|
|
5
5
|
export { CodeReviewVerdict, CodeReviewSeverity };
|
|
6
|
-
export type CodeReviewVersionedResult =
|
|
6
|
+
export type CodeReviewVersionedResult = CodeReviewResultV0 | CodeReviewResultV1 | CodeReviewResultV2;
|
|
7
7
|
export declare class CodeReviewAgent extends BaseAgent {
|
|
8
8
|
protected getTools(): ToolsForLLM;
|
|
9
9
|
getResult(): CodeReviewVersionedResult | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/code-review/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG/E,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/code-review/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG/E,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;AAEjD,MAAM,MAAM,yBAAyB,GACjC,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,CAAC;AAEvB,qBAAa,eAAgB,SAAQ,SAAS;IAC5C,SAAS,CAAC,QAAQ,IAAI,WAAW;IAWjC,SAAS,IAAI,yBAAyB,GAAG,SAAS;cAmBlC,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA0HxE"}
|
|
@@ -131,6 +131,9 @@ Return these as XML tags with markdown inside them
|
|
|
131
131
|
- Helper methods (that are imported in the tests) should be in pages/ directory (e.g. pages/common.ts)
|
|
132
132
|
- Helper methods should be functional - not classes (conventional class-based page object models are NOT recommended - use functions!)
|
|
133
133
|
|
|
134
|
+
## Common mistakes
|
|
135
|
+
- Our author has a tendency to add newline characters to console logs (e.g \`console.log("\ngoing to page foo");\` ) - this should not be allowed
|
|
136
|
+
|
|
134
137
|
# Severity: Warning
|
|
135
138
|
|
|
136
139
|
## Call out test data assumptions
|
|
@@ -6,15 +6,6 @@ export declare enum CodeReviewSeverity {
|
|
|
6
6
|
MergeBlocking = "merge-blocking",
|
|
7
7
|
Warning = "warning"
|
|
8
8
|
}
|
|
9
|
-
export type CodeReviewResultV1 = {
|
|
10
|
-
version: "1.0";
|
|
11
|
-
last_commit: string | null;
|
|
12
|
-
code_review_comments: string | null;
|
|
13
|
-
describe_code_change: string | null;
|
|
14
|
-
merge_blocking_issues: string | null;
|
|
15
|
-
best_practices_and_warnings: string | null;
|
|
16
|
-
verdict: "Approved" | "Rejected" | null;
|
|
17
|
-
};
|
|
18
9
|
export type CodeReviewLineComment = {
|
|
19
10
|
file: string;
|
|
20
11
|
line_start: number;
|
|
@@ -29,6 +20,15 @@ export type CodeReviewResultV2 = {
|
|
|
29
20
|
line_comments: CodeReviewLineComment[];
|
|
30
21
|
verdict: CodeReviewVerdict;
|
|
31
22
|
};
|
|
23
|
+
export type CodeReviewResultV1 = {
|
|
24
|
+
version: "1.0";
|
|
25
|
+
last_commit: string | null;
|
|
26
|
+
code_review_comments: string | null;
|
|
27
|
+
describe_code_change: string | null;
|
|
28
|
+
merge_blocking_issues: string | null;
|
|
29
|
+
best_practices_and_warnings: string | null;
|
|
30
|
+
verdict: "Approved" | "Rejected" | null;
|
|
31
|
+
};
|
|
32
32
|
export type CodeReviewResultV0 = {
|
|
33
33
|
version: "0.1";
|
|
34
34
|
result: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/agent/code-review/types.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,QAAQ,aAAa;IACrB,QAAQ,aAAa;CACtB;AAED,oBAAY,kBAAkB;IAC5B,aAAa,mBAAmB;IAChC,OAAO,YAAY;CACpB;AAED,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/agent/code-review/types.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,QAAQ,aAAa;IACrB,QAAQ,aAAa;CACtB;AAED,oBAAY,kBAAkB;IAC5B,aAAa,mBAAmB;IAChC,OAAO,YAAY;CACpB;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,KAAK,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,qBAAqB,EAAE,CAAC;IACvC,OAAO,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,KAAK,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,2BAA2B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,OAAO,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,KAAK,CAAC;IAEf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -2,6 +2,6 @@ import type { ToolsForLLM } from "@empiricalrun/shared-types";
|
|
|
2
2
|
import { BaseAgent } from "../base";
|
|
3
3
|
export declare class TriageAgent extends BaseAgent {
|
|
4
4
|
protected getTools(): ToolsForLLM;
|
|
5
|
-
protected buildSystemPrompt(repoContext
|
|
5
|
+
protected buildSystemPrompt(repoContext: string): Promise<string>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/triage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/triage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAkB9D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,qBAAa,WAAY,SAAQ,SAAS;IACxC,SAAS,CAAC,QAAQ,IAAI,WAAW;cA0BjB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAgExE"}
|
|
@@ -7,24 +7,23 @@ const test_case_def_1 = require("../chat/prompt/test-case-def");
|
|
|
7
7
|
class TriageAgent extends base_1.BaseAgent {
|
|
8
8
|
getTools() {
|
|
9
9
|
const tools = [
|
|
10
|
-
//
|
|
11
|
-
tools_1.runTestTool,
|
|
12
|
-
tools_1.grepTool,
|
|
10
|
+
// Tools to understand test run (open report)
|
|
13
11
|
tools_1.fetchDiagnosisReportTool,
|
|
12
|
+
tools_1.fetchLastSuccessfulTestRunTool,
|
|
13
|
+
tools_1.viewFailedTestRunReportTool,
|
|
14
14
|
tools_1.listEnvironmentsTool,
|
|
15
|
-
|
|
15
|
+
// Tools to analyse report artifacts
|
|
16
16
|
tools_1.fetchFileTool,
|
|
17
|
+
tools_1.analyseVideo,
|
|
17
18
|
tools_1.traceDotZipTool,
|
|
18
|
-
//
|
|
19
|
+
// Tools to get test case context from the repo
|
|
20
|
+
tools_1.grepTool,
|
|
21
|
+
...(0, tools_1.textEditorToolsForModel)(this.selectedModel),
|
|
22
|
+
// Tools to manage issues
|
|
19
23
|
tools_1.listIssuesTool,
|
|
20
24
|
tools_1.createIssueTool,
|
|
21
25
|
tools_1.updateIssueTool,
|
|
22
|
-
tools_1.viewFailedTestRunReportTool,
|
|
23
|
-
tools_1.analyseVideo,
|
|
24
|
-
tools_1.fetchLastSuccessfulTestRunTool,
|
|
25
26
|
tools_1.sendTriageSummaryTool,
|
|
26
|
-
// Model-specific tools
|
|
27
|
-
...(0, tools_1.textEditorToolsForModel)(this.selectedModel),
|
|
28
27
|
];
|
|
29
28
|
return {
|
|
30
29
|
custom: tools,
|
|
@@ -32,9 +31,6 @@ class TriageAgent extends base_1.BaseAgent {
|
|
|
32
31
|
};
|
|
33
32
|
}
|
|
34
33
|
async buildSystemPrompt(repoContext) {
|
|
35
|
-
if (!repoContext) {
|
|
36
|
-
throw new Error(`Triage agent needs repo context`);
|
|
37
|
-
}
|
|
38
34
|
return `
|
|
39
35
|
You are a helpful assistant that help with analysis of Playwright test reports. Your goal is to help the user analyse a test report and identify the root cause of the test failures, and log the unique failuers as issues so that the user can keep a track and fix them.
|
|
40
36
|
|
|
@@ -56,7 +52,6 @@ You are provided with multiple tools to help you understand each failing test ca
|
|
|
56
52
|
- Each video represents one browser tab of the test case (so multiple videos implies the test had multiple tabs or browser windows)
|
|
57
53
|
- Read the error stack and test file to understand what the test is doing
|
|
58
54
|
- Fetch the last successful run of the test case to understand the earlier flow. This report will contain image and video URLs that can also be analyzed with your available tools.
|
|
59
|
-
- If you think the issue is explained by a timing or intermittent issue, you can also re-run the test case
|
|
60
55
|
|
|
61
56
|
## Listing, updating and creating issues
|
|
62
57
|
|
package/dist/bin/index.js
CHANGED
|
@@ -14,8 +14,6 @@ const client_1 = require("../dashboard/client");
|
|
|
14
14
|
const recorder_1 = require("../recorder");
|
|
15
15
|
const validation_1 = require("../recorder/validation");
|
|
16
16
|
const test_build_1 = require("../test-build");
|
|
17
|
-
const video_core_1 = require("../video-core");
|
|
18
|
-
const analysis_server_1 = require("../video-core/analysis-server");
|
|
19
17
|
const environments_1 = require("./environments");
|
|
20
18
|
const setup_1 = require("./setup");
|
|
21
19
|
const utils_1 = require("./utils");
|
|
@@ -227,59 +225,6 @@ async function main() {
|
|
|
227
225
|
}
|
|
228
226
|
process.exit(0);
|
|
229
227
|
});
|
|
230
|
-
program
|
|
231
|
-
.command("analyze-video")
|
|
232
|
-
.description("Analyze video and start viewer server with results")
|
|
233
|
-
.requiredOption("--url <url>", "Video URL")
|
|
234
|
-
.option("--params <params>", "Video analysis parameters. Format: key=value pairs separated by comma ','. Supported keys: model, fps, threshold, startTime, duration. Example: --params 'fps=30,threshold=0.01,startTime=00:00:10,duration=00:01:00'")
|
|
235
|
-
.option("--no-server", "Skip starting the analysis viewer server")
|
|
236
|
-
.action(async (opts) => {
|
|
237
|
-
const { url, params, server } = opts;
|
|
238
|
-
if (!url) {
|
|
239
|
-
console.error("❌ Video URL is required");
|
|
240
|
-
process.exit(1);
|
|
241
|
-
}
|
|
242
|
-
await (0, video_core_1.runVideoAnalysisForCli)({
|
|
243
|
-
url,
|
|
244
|
-
params: params || "",
|
|
245
|
-
startServer: server,
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
program
|
|
249
|
-
.command("serve-analysis")
|
|
250
|
-
.option("--root-path <path>", "Root path to discover analysis directories", "video-analysis")
|
|
251
|
-
.description("Start viewer server to browse analysis results from multiple directories")
|
|
252
|
-
.action(async (opts) => {
|
|
253
|
-
try {
|
|
254
|
-
let handle;
|
|
255
|
-
handle = await (0, analysis_server_1.startAnalysisServer)(opts.rootPath);
|
|
256
|
-
console.log(`🌐 Analysis viewer available at: ${handle.url}`);
|
|
257
|
-
console.log(`📁 Serving analysis results from: ${opts.rootPath}`);
|
|
258
|
-
console.log("📋 Press Ctrl+C to stop the server");
|
|
259
|
-
let isShuttingDown = false;
|
|
260
|
-
const gracefulShutdown = async (signal) => {
|
|
261
|
-
if (isShuttingDown)
|
|
262
|
-
return;
|
|
263
|
-
isShuttingDown = true;
|
|
264
|
-
console.log(`\n🛑 Received ${signal}, shutting down server...`);
|
|
265
|
-
try {
|
|
266
|
-
await handle.close();
|
|
267
|
-
console.log("✅ Server closed successfully");
|
|
268
|
-
process.exit(0);
|
|
269
|
-
}
|
|
270
|
-
catch (error) {
|
|
271
|
-
console.error("❌ Error closing server:", error);
|
|
272
|
-
process.exit(1);
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
process.once("SIGINT", () => gracefulShutdown("SIGINT"));
|
|
276
|
-
process.once("SIGTERM", () => gracefulShutdown("SIGTERM"));
|
|
277
|
-
}
|
|
278
|
-
catch (error) {
|
|
279
|
-
console.error("❌ Error loading or serving data:", error instanceof Error ? error.message : error);
|
|
280
|
-
process.exit(1);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
228
|
program.parse(process.argv);
|
|
284
229
|
}
|
|
285
230
|
main().catch((error) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/analyse-video/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAGL,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAK7B,OAAO,EACL,kBAAkB,EAEnB,MAAM,8BAA8B,CAAC;AAiBtC,eAAO,MAAM,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/analyse-video/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAGL,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAK7B,OAAO,EACL,kBAAkB,EAEnB,MAAM,8BAA8B,CAAC;AAiBtC,eAAO,MAAM,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CA0CjE,CAAC"}
|
|
@@ -28,13 +28,19 @@ exports.analyseVideo = {
|
|
|
28
28
|
isError: true,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
const { result,
|
|
31
|
+
const { result, error, interleaved_tool_result } = await (0, video_core_1.runVideoAnalysis)({
|
|
32
32
|
videoUrl,
|
|
33
33
|
videoUrlHash,
|
|
34
34
|
params,
|
|
35
35
|
featureFlags,
|
|
36
36
|
workingDirectory: repoPath,
|
|
37
37
|
});
|
|
38
|
+
if (error) {
|
|
39
|
+
return {
|
|
40
|
+
isError: true,
|
|
41
|
+
result: error,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
38
44
|
const finalResult = [
|
|
39
45
|
{
|
|
40
46
|
type: "text",
|
|
@@ -43,7 +49,7 @@ exports.analyseVideo = {
|
|
|
43
49
|
...interleaved_tool_result,
|
|
44
50
|
];
|
|
45
51
|
return {
|
|
46
|
-
isError:
|
|
52
|
+
isError: error !== null,
|
|
47
53
|
result: finalResult,
|
|
48
54
|
};
|
|
49
55
|
},
|
|
@@ -11,14 +11,14 @@ export declare const analyseVideoSchema: z.ZodObject<{
|
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
12
|
model?: string | undefined;
|
|
13
13
|
startTime?: number | undefined;
|
|
14
|
-
threshold?: number | undefined;
|
|
15
14
|
fps?: number | undefined;
|
|
15
|
+
threshold?: number | undefined;
|
|
16
16
|
duration?: number | undefined;
|
|
17
17
|
}, {
|
|
18
18
|
model?: string | undefined;
|
|
19
19
|
startTime?: number | undefined;
|
|
20
|
-
threshold?: number | undefined;
|
|
21
20
|
fps?: number | undefined;
|
|
21
|
+
threshold?: number | undefined;
|
|
22
22
|
duration?: number | undefined;
|
|
23
23
|
}>>;
|
|
24
24
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -26,8 +26,8 @@ export declare const analyseVideoSchema: z.ZodObject<{
|
|
|
26
26
|
params?: {
|
|
27
27
|
model?: string | undefined;
|
|
28
28
|
startTime?: number | undefined;
|
|
29
|
-
threshold?: number | undefined;
|
|
30
29
|
fps?: number | undefined;
|
|
30
|
+
threshold?: number | undefined;
|
|
31
31
|
duration?: number | undefined;
|
|
32
32
|
} | undefined;
|
|
33
33
|
}, {
|
|
@@ -35,8 +35,8 @@ export declare const analyseVideoSchema: z.ZodObject<{
|
|
|
35
35
|
params?: {
|
|
36
36
|
model?: string | undefined;
|
|
37
37
|
startTime?: number | undefined;
|
|
38
|
-
threshold?: number | undefined;
|
|
39
38
|
fps?: number | undefined;
|
|
39
|
+
threshold?: number | undefined;
|
|
40
40
|
duration?: number | undefined;
|
|
41
41
|
} | undefined;
|
|
42
42
|
}>;
|
|
@@ -50,9 +50,9 @@ exports.analyseVideo = {
|
|
|
50
50
|
description: `
|
|
51
51
|
Analyzes videos to summarise.
|
|
52
52
|
|
|
53
|
-
**Input:** The video URL is mandatory (supports webm, mp4)
|
|
53
|
+
**Input:** The video URL is mandatory (supports webm, mp4, mov), there are params you can specify to control the analysis.
|
|
54
54
|
**Output:** analysis summary of what happened during the test execution.
|
|
55
|
-
**Use when:** You have a failing test with a video recording and need to understand what went wrong
|
|
55
|
+
**Use when:** You have a failing test with a video recording and need to understand what went wrong, or when user provides link to a Video recording.`,
|
|
56
56
|
parameters: exports.analyseVideoSchema,
|
|
57
57
|
},
|
|
58
58
|
needsBrowser: false,
|
|
@@ -14,7 +14,7 @@ export type BaseToolExecutorProps = {
|
|
|
14
14
|
logger?: Logger;
|
|
15
15
|
};
|
|
16
16
|
export declare class BaseToolExecutor {
|
|
17
|
-
toolExecutors: Record<string, ToolExecute>;
|
|
17
|
+
toolExecutors: Record<string, Tool | ToolExecute>;
|
|
18
18
|
featureFlags: string[];
|
|
19
19
|
chatSession: ChatSessionInfo | null;
|
|
20
20
|
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;AAChD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EACV,eAAe,EAEf,mBAAmB,EACnB,MAAM,EACN,iBAAiB,EACjB,IAAI,EACJ,WAAW,EACZ,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EACV,eAAe,EAEf,mBAAmB,EACnB,MAAM,EACN,iBAAiB,EACjB,IAAI,EACJ,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAcpC,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;CA0GH"}
|
|
@@ -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 utils_1 = require("./utils");
|
|
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,24 @@ 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 validationErroToolresult = (0, utils_1.validateToolInput)(toolCall, toolInputSchema);
|
|
82
|
+
if (validationErroToolresult) {
|
|
83
|
+
toolResults.push(validationErroToolresult);
|
|
84
|
+
span?.end({ output: validationErroToolresult });
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
console.log(`No schema found for tool ${toolCall.name}. Skipping validation.`);
|
|
90
|
+
}
|
|
74
91
|
try {
|
|
75
|
-
const result = await
|
|
92
|
+
const result = await executeFn({
|
|
76
93
|
input: toolCall.input,
|
|
77
94
|
repoPath: this.repoPath,
|
|
78
95
|
apiClient: this.apiClient,
|