@empiricalrun/test-gen 0.79.4 → 0.79.6
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 +20 -0
- package/dist/agent/base/index.d.ts +2 -2
- package/dist/agent/base/index.d.ts.map +1 -1
- package/dist/agent/base/index.js +38 -7
- package/dist/agent/browsing/run.d.ts +1 -1
- package/dist/agent/browsing/run.d.ts.map +1 -1
- package/dist/agent/browsing/utils.d.ts +0 -7
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +9 -59
- 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 -2
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +5 -5
- package/dist/agent/chat/prompt/repo.d.ts.map +1 -1
- package/dist/agent/chat/prompt/repo.js +24 -0
- package/dist/agent/chat/state.d.ts +0 -1
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +0 -28
- package/dist/agent/master/browser-tests/cua.spec.js +3 -3
- package/dist/agent/master/browser-tests/index.spec.js +2 -111
- package/dist/agent/master/run.d.ts +0 -1
- package/dist/agent/master/run.d.ts.map +1 -1
- package/dist/agent/master/run.js +1 -3
- package/dist/bin/index.js +0 -12
- package/dist/dashboard/client.d.ts +2 -45
- package/dist/dashboard/client.d.ts.map +1 -1
- package/dist/dashboard/client.js +4 -217
- package/dist/dashboard/index.d.ts +2 -4
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +10 -13
- package/dist/dashboard/tool-response-from-sandbox.d.ts +1 -4
- package/dist/dashboard/tool-response-from-sandbox.d.ts.map +1 -1
- package/dist/dashboard/tool-response-from-sandbox.js +4 -38
- package/dist/dashboard/tool-response.d.ts +1 -5
- package/dist/dashboard/tool-response.d.ts.map +1 -1
- package/dist/dashboard/tool-response.js +5 -87
- package/dist/dashboard/types.d.ts +1 -8
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/dashboard/types.js +4 -14
- package/dist/file/server.d.ts +1 -1
- package/dist/file/server.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.js +10 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -32
- package/dist/recorder/index.d.ts.map +1 -1
- package/dist/recorder/index.js +3 -3
- package/dist/tools/api-client/index.d.ts +3 -0
- package/dist/tools/api-client/index.d.ts.map +1 -0
- package/dist/tools/api-client/index.js +73 -0
- package/dist/tools/create-pull-request/utils.d.ts +1 -1
- package/dist/tools/definitions/run-test.d.ts +2 -2
- package/dist/tools/definitions/run-test.d.ts.map +1 -1
- package/dist/tools/definitions/run-test.js +6 -5
- package/dist/tools/definitions/safe-bash.d.ts +1 -0
- package/dist/tools/definitions/safe-bash.d.ts.map +1 -1
- package/dist/tools/definitions/safe-bash.js +15 -6
- package/dist/tools/definitions/test-gen-browser.d.ts +2 -2
- package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/definitions/test-gen-browser.js +4 -5
- package/dist/tools/delete-file/index.d.ts.map +1 -1
- package/dist/tools/delete-file/index.js +4 -5
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +0 -4
- package/dist/tools/fetch-file/index.d.ts.map +1 -1
- package/dist/tools/fetch-file/index.js +3 -7
- package/dist/tools/file-operations/create.js +4 -4
- package/dist/tools/file-operations/insert.js +5 -5
- package/dist/tools/file-operations/replace.js +5 -5
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +0 -4
- package/dist/tools/issues-v1/utils.d.ts +1 -3
- package/dist/tools/issues-v1/utils.d.ts.map +1 -1
- package/dist/tools/issues-v1/utils.js +0 -16
- package/dist/tools/list-tests-and-projects/index.d.ts.map +1 -1
- package/dist/tools/list-tests-and-projects/index.js +1 -1
- package/dist/tools/rename-file/index.d.ts.map +1 -1
- package/dist/tools/rename-file/index.js +7 -4
- package/dist/tools/run-test.d.ts.map +1 -1
- package/dist/tools/run-test.js +33 -7
- package/dist/tools/safe-bash/index.d.ts.map +1 -1
- package/dist/tools/safe-bash/index.js +25 -10
- package/dist/tools/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/test-gen-browser.js +27 -8
- package/dist/tools/utils/validators.d.ts +7 -0
- package/dist/tools/utils/validators.d.ts.map +1 -0
- package/dist/tools/utils/validators.js +93 -0
- package/dist/video-core/index.d.ts.map +1 -1
- package/dist/video-core/index.js +5 -0
- package/package.json +10 -10
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/agent/cua/computer.d.ts +0 -14
- package/dist/agent/cua/computer.d.ts.map +0 -1
- package/dist/agent/cua/computer.js +0 -191
- package/dist/agent/cua/index.d.ts +0 -22
- package/dist/agent/cua/index.d.ts.map +0 -1
- package/dist/agent/cua/index.js +0 -254
- package/dist/agent/cua/model.d.ts +0 -25
- package/dist/agent/cua/model.d.ts.map +0 -1
- package/dist/agent/cua/model.js +0 -66
- package/dist/agent/cua/pw-codegen/element-from-point.d.ts +0 -10
- package/dist/agent/cua/pw-codegen/element-from-point.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/element-from-point.js +0 -135
- package/dist/agent/cua/pw-codegen/factory.d.ts +0 -15
- package/dist/agent/cua/pw-codegen/factory.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/factory.js +0 -59
- package/dist/agent/cua/pw-codegen/index.d.ts +0 -7
- package/dist/agent/cua/pw-codegen/index.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/index.js +0 -14
- package/dist/agent/cua/pw-codegen/pw-event-sink/index.d.ts +0 -43
- package/dist/agent/cua/pw-codegen/pw-event-sink/index.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-event-sink/index.js +0 -250
- package/dist/agent/cua/pw-codegen/pw-pause/for-recorder.d.ts +0 -14
- package/dist/agent/cua/pw-codegen/pw-pause/for-recorder.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/for-recorder.js +0 -88
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts +0 -17
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.js +0 -117
- package/dist/agent/cua/pw-codegen/pw-pause/ipc.d.ts +0 -3
- package/dist/agent/cua/pw-codegen/pw-pause/ipc.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/ipc.js +0 -13
- package/dist/agent/cua/pw-codegen/pw-pause/patch.d.ts +0 -24
- package/dist/agent/cua/pw-codegen/pw-pause/patch.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/patch.js +0 -197
- package/dist/agent/cua/pw-codegen/pw-pause/types.d.ts +0 -14
- package/dist/agent/cua/pw-codegen/pw-pause/types.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/types.js +0 -2
- package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts +0 -2
- package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/utils.js +0 -6
- package/dist/agent/cua/pw-codegen/types.d.ts +0 -47
- package/dist/agent/cua/pw-codegen/types.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/types.js +0 -2
- package/dist/agent/cua/pw-codegen/version.d.ts +0 -25
- package/dist/agent/cua/pw-codegen/version.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/version.js +0 -86
- package/dist/bin/environments.d.ts +0 -6
- package/dist/bin/environments.d.ts.map +0 -1
- package/dist/bin/environments.js +0 -99
- package/dist/tools/definitions/upgrade-packages.d.ts +0 -14
- package/dist/tools/definitions/upgrade-packages.d.ts.map +0 -1
- package/dist/tools/definitions/upgrade-packages.js +0 -21
- package/dist/tools/upgrade-packages/index.d.ts +0 -3
- package/dist/tools/upgrade-packages/index.d.ts.map +0 -1
- package/dist/tools/upgrade-packages/index.js +0 -134
- package/dist/tools/upgrade-packages/utils.d.ts +0 -28
- package/dist/tools/upgrade-packages/utils.d.ts.map +0 -1
- package/dist/tools/upgrade-packages/utils.js +0 -152
package/dist/agent/master/run.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IS_ALLOWED_TO_USE_SKILLS =
|
|
3
|
+
exports.IS_ALLOWED_TO_USE_SKILLS = void 0;
|
|
4
4
|
exports.createTestUsingMasterAgent = createTestUsingMasterAgent;
|
|
5
5
|
const llm_1 = require("@empiricalrun/llm");
|
|
6
6
|
const actions_1 = require("../../actions");
|
|
@@ -15,8 +15,6 @@ const run_time_planner_1 = require("../planner/run-time-planner");
|
|
|
15
15
|
const action_tool_calls_1 = require("./action-tool-calls");
|
|
16
16
|
const execute_browser_action_1 = require("./execute-browser-action");
|
|
17
17
|
const next_action_1 = require("./next-action");
|
|
18
|
-
var cua_1 = require("../cua");
|
|
19
|
-
Object.defineProperty(exports, "createTestUsingComputerUseAgent", { enumerable: true, get: function () { return cua_1.createTestUsingComputerUseAgent; } });
|
|
20
18
|
const MAX_ERROR_COUNT = 2;
|
|
21
19
|
// Disabling skills as we're seeing false usage with chat agent
|
|
22
20
|
exports.IS_ALLOWED_TO_USE_SKILLS = false;
|
package/dist/bin/index.js
CHANGED
|
@@ -14,7 +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 environments_1 = require("./environments");
|
|
18
17
|
const setup_1 = require("./setup");
|
|
19
18
|
const utils_1 = require("./utils");
|
|
20
19
|
dotenv_1.default.config({
|
|
@@ -132,17 +131,6 @@ async function main() {
|
|
|
132
131
|
await (0, setup_1.runSetup)({ apiClient, repoName: opts.repoName });
|
|
133
132
|
process.exit(0);
|
|
134
133
|
});
|
|
135
|
-
program
|
|
136
|
-
.command("environments")
|
|
137
|
-
.description("List environments and their latest builds")
|
|
138
|
-
.option("--auth-type <type>", 'Use "user-access-token" or "project-api-key"', "user-access-token")
|
|
139
|
-
.action(async (opts) => {
|
|
140
|
-
const apiClient = new client_1.DashboardAPIClient({
|
|
141
|
-
authType: opts.authType,
|
|
142
|
-
});
|
|
143
|
-
await (0, environments_1.listEnvironments)({ apiClient, repoPath: process.cwd() });
|
|
144
|
-
process.exit(0);
|
|
145
|
-
});
|
|
146
134
|
program
|
|
147
135
|
.command("download-build")
|
|
148
136
|
.description("Download a build from a URL")
|
|
@@ -1,46 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export type TokenProvider = () => Promise<{
|
|
4
|
-
access_token: string;
|
|
5
|
-
refresh_token: string;
|
|
6
|
-
expires_at: number;
|
|
7
|
-
user_id?: string;
|
|
8
|
-
user_email?: string;
|
|
9
|
-
} | null>;
|
|
10
|
-
export declare class DashboardAPIClient implements IDashboardAPIClient {
|
|
11
|
-
private baseUrl;
|
|
12
|
-
private authType;
|
|
13
|
-
private projectApiKey?;
|
|
14
|
-
private secretKey?;
|
|
15
|
-
private tokenProvider?;
|
|
16
|
-
constructor({ authType, projectApiKey, secretKey, baseUrl, tokenProvider, }: {
|
|
17
|
-
authType: AuthenticationType;
|
|
18
|
-
projectApiKey?: string;
|
|
19
|
-
secretKey?: string;
|
|
20
|
-
baseUrl?: string;
|
|
21
|
-
tokenProvider?: TokenProvider;
|
|
22
|
-
});
|
|
23
|
-
private getTokens;
|
|
24
|
-
request<T>(endpoint: string, options: RequestOptions): Promise<T>;
|
|
25
|
-
callGitHubProxy<T>({ method, url, body, }: {
|
|
26
|
-
method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
|
27
|
-
url: string;
|
|
28
|
-
body?: any;
|
|
29
|
-
}): Promise<T>;
|
|
30
|
-
callMailosaurProxy<T>({ method, path, body, }: {
|
|
31
|
-
method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
|
32
|
-
path: string;
|
|
33
|
-
body?: any;
|
|
34
|
-
}): Promise<T>;
|
|
35
|
-
callWebhookSiteProxy<T>({ method, path, body, }: {
|
|
36
|
-
method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
|
37
|
-
path: string;
|
|
38
|
-
body?: any;
|
|
39
|
-
}): Promise<T>;
|
|
40
|
-
getBaseUrl(): string;
|
|
41
|
-
ensureUserIsAuthenticated(): Promise<void>;
|
|
42
|
-
private _makeRequest;
|
|
43
|
-
private refreshUserToken;
|
|
44
|
-
}
|
|
45
|
-
export declare const apiClient: DashboardAPIClient;
|
|
1
|
+
export type { AuthenticationType, TokenProvider, } from "@empiricalrun/dashboard-client";
|
|
2
|
+
export { apiClient, DashboardAPIClient } from "@empiricalrun/dashboard-client";
|
|
46
3
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/dashboard/client.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/dashboard/client.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,aAAa,GACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC"}
|
package/dist/dashboard/client.js
CHANGED
|
@@ -1,219 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const totp_1 = require("./totp");
|
|
11
|
-
const types_1 = require("./types");
|
|
12
|
-
class DashboardAPIClient {
|
|
13
|
-
baseUrl;
|
|
14
|
-
authType;
|
|
15
|
-
projectApiKey;
|
|
16
|
-
secretKey;
|
|
17
|
-
tokenProvider;
|
|
18
|
-
constructor({ authType, projectApiKey, secretKey, baseUrl, tokenProvider, }) {
|
|
19
|
-
this.baseUrl =
|
|
20
|
-
baseUrl || process.env.DASHBOARD_DOMAIN || "https://dash.empirical.run";
|
|
21
|
-
this.authType = authType;
|
|
22
|
-
if (this.authType === "project-api-key") {
|
|
23
|
-
if (!projectApiKey && !process.env.EMPIRICALRUN_API_KEY) {
|
|
24
|
-
throw new Error("Project API key is required when authentication type is 'project-api-key'");
|
|
25
|
-
}
|
|
26
|
-
this.projectApiKey = projectApiKey || process.env.EMPIRICALRUN_API_KEY;
|
|
27
|
-
}
|
|
28
|
-
else if (this.authType === "admin-totp") {
|
|
29
|
-
if (!secretKey && !process.env.EMPIRICAL_TOTP_SK) {
|
|
30
|
-
throw new Error("Secret key is required when authentication type is 'admin-totp'");
|
|
31
|
-
}
|
|
32
|
-
this.secretKey = secretKey || process.env.EMPIRICAL_TOTP_SK;
|
|
33
|
-
}
|
|
34
|
-
this.tokenProvider = tokenProvider;
|
|
35
|
-
}
|
|
36
|
-
async getTokens() {
|
|
37
|
-
if (this.tokenProvider) {
|
|
38
|
-
return this.tokenProvider();
|
|
39
|
-
}
|
|
40
|
-
return (0, token_store_1.getStoredUserTokens)();
|
|
41
|
-
}
|
|
42
|
-
async request(endpoint, options) {
|
|
43
|
-
let response;
|
|
44
|
-
if (this.secretKey) {
|
|
45
|
-
const secretKey = this.secretKey;
|
|
46
|
-
response = await this._makeRequest(endpoint, options, async () => ({
|
|
47
|
-
"X-Empirical-Auth-TOTP": await (0, totp_1.getTOTP)(secretKey),
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
else if (this.projectApiKey) {
|
|
51
|
-
response = await this._makeRequest(endpoint, options, async () => ({
|
|
52
|
-
Authorization: `Bearer ${this.projectApiKey}`,
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
await this.ensureUserIsAuthenticated();
|
|
57
|
-
const tokens = await this.getTokens();
|
|
58
|
-
if (!tokens) {
|
|
59
|
-
throw new Error("Not authenticated. Please run the login command first.");
|
|
60
|
-
}
|
|
61
|
-
response = await this._makeRequest(endpoint, options, async () => ({
|
|
62
|
-
Authorization: `Bearer ${tokens.access_token}`,
|
|
63
|
-
}));
|
|
64
|
-
if (response && response.status === 401) {
|
|
65
|
-
logger_1.logger.debug("Access token expired, attempting to refresh...");
|
|
66
|
-
const refreshed = await this.refreshUserToken();
|
|
67
|
-
if (refreshed) {
|
|
68
|
-
const newTokens = await this.getTokens();
|
|
69
|
-
if (newTokens) {
|
|
70
|
-
response = this._makeRequest(endpoint, options, async () => ({
|
|
71
|
-
Authorization: `Bearer ${newTokens.access_token}`,
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
throw new Error("Authentication failed. Please run the login command again.");
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
if (!response) {
|
|
79
|
-
throw new Error("No response received from the API");
|
|
80
|
-
}
|
|
81
|
-
return response.json();
|
|
82
|
-
}
|
|
83
|
-
async callGitHubProxy({ method, url, body, }) {
|
|
84
|
-
const requestBody = {
|
|
85
|
-
method,
|
|
86
|
-
url,
|
|
87
|
-
body,
|
|
88
|
-
};
|
|
89
|
-
return await this.request(`/api/github/proxy`, {
|
|
90
|
-
method: "POST",
|
|
91
|
-
body: requestBody,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
async callMailosaurProxy({ method, path, body, }) {
|
|
95
|
-
const requestBody = {
|
|
96
|
-
method,
|
|
97
|
-
path,
|
|
98
|
-
body,
|
|
99
|
-
};
|
|
100
|
-
return await this.request(`/api/mailosaur/proxy`, {
|
|
101
|
-
method: "POST",
|
|
102
|
-
body: requestBody,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
async callWebhookSiteProxy({ method, path, body, }) {
|
|
106
|
-
const requestBody = {
|
|
107
|
-
method,
|
|
108
|
-
path,
|
|
109
|
-
body,
|
|
110
|
-
};
|
|
111
|
-
return await this.request(`/api/webhook-site/proxy`, {
|
|
112
|
-
method: "POST",
|
|
113
|
-
body: requestBody,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
getBaseUrl() {
|
|
117
|
-
return this.baseUrl;
|
|
118
|
-
}
|
|
119
|
-
async ensureUserIsAuthenticated() {
|
|
120
|
-
const tokens = await this.getTokens();
|
|
121
|
-
if (!tokens) {
|
|
122
|
-
throw new Error("Not authenticated. Please run the login command first.");
|
|
123
|
-
}
|
|
124
|
-
// Check if token is expired (with 5 minute buffer)
|
|
125
|
-
const expirationBuffer = 5 * 60;
|
|
126
|
-
const now = Math.floor(Date.now() / 1000);
|
|
127
|
-
const isExpired = tokens.expires_at <= now + expirationBuffer;
|
|
128
|
-
if (isExpired && !this.tokenProvider) {
|
|
129
|
-
// Only attempt refresh if using file-based token store
|
|
130
|
-
const refreshed = await this.refreshUserToken();
|
|
131
|
-
if (!refreshed) {
|
|
132
|
-
throw new Error("Session expired. Please run the login command again.");
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
async _makeRequest(endpoint, options, getAuthHeader) {
|
|
137
|
-
const method = options.method || "GET";
|
|
138
|
-
const url = new URL(endpoint, this.baseUrl);
|
|
139
|
-
if (options.params) {
|
|
140
|
-
Object.entries(options.params).forEach(([key, value]) => {
|
|
141
|
-
url.searchParams.append(key, value);
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
return await (0, async_retry_1.default)(async (bail) => {
|
|
145
|
-
const authHeader = await getAuthHeader();
|
|
146
|
-
const headers = {
|
|
147
|
-
...authHeader,
|
|
148
|
-
"Content-Type": "application/json",
|
|
149
|
-
"User-Agent": "@empiricalrun/test-gen",
|
|
150
|
-
};
|
|
151
|
-
const response = await fetch(url, {
|
|
152
|
-
headers,
|
|
153
|
-
method: method,
|
|
154
|
-
body: options.body ? JSON.stringify(options.body) : undefined,
|
|
155
|
-
});
|
|
156
|
-
if (!response.ok) {
|
|
157
|
-
let error;
|
|
158
|
-
const msg = `HTTP error in ${method} request to ${url}! Status code: ${response.status}. Response: ${await response.text()}`;
|
|
159
|
-
if (response.status < 500) {
|
|
160
|
-
error = new types_1.NonRetryableHTTPError(msg, response.status);
|
|
161
|
-
bail(error);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
error = new types_1.RetryableHTTPError(msg, response.status);
|
|
166
|
-
}
|
|
167
|
-
throw error;
|
|
168
|
-
}
|
|
169
|
-
return response;
|
|
170
|
-
}, {
|
|
171
|
-
retries: 3,
|
|
172
|
-
factor: 2,
|
|
173
|
-
minTimeout: 1_000,
|
|
174
|
-
maxTimeout: 5_000,
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
async refreshUserToken() {
|
|
178
|
-
const tokens = await this.getTokens();
|
|
179
|
-
if (!tokens || !tokens.refresh_token) {
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
try {
|
|
183
|
-
const response = await fetch(`${this.baseUrl}/api/cli/refresh`, {
|
|
184
|
-
method: "POST",
|
|
185
|
-
headers: {
|
|
186
|
-
"Content-Type": "application/json",
|
|
187
|
-
},
|
|
188
|
-
body: JSON.stringify({
|
|
189
|
-
refresh_token: tokens.refresh_token,
|
|
190
|
-
}),
|
|
191
|
-
});
|
|
192
|
-
if (!response.ok) {
|
|
193
|
-
const errorText = await response.text();
|
|
194
|
-
console.error("Token refresh failed:", errorText);
|
|
195
|
-
await (0, token_store_1.clearTokens)();
|
|
196
|
-
return false;
|
|
197
|
-
}
|
|
198
|
-
const data = await response.json();
|
|
199
|
-
await (0, token_store_1.storeTokens)({
|
|
200
|
-
access_token: data.access_token,
|
|
201
|
-
refresh_token: data.refresh_token,
|
|
202
|
-
expires_at: data.expires_at,
|
|
203
|
-
user_id: data.user?.id || tokens.user_id,
|
|
204
|
-
user_email: data.user?.email || tokens.user_email,
|
|
205
|
-
});
|
|
206
|
-
logger_1.logger.debug("Access token refreshed successfully via dashboard");
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
catch (error) {
|
|
210
|
-
console.error("Token refresh error:", error);
|
|
211
|
-
await (0, token_store_1.clearTokens)();
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
exports.DashboardAPIClient = DashboardAPIClient;
|
|
217
|
-
exports.apiClient = new DashboardAPIClient({
|
|
218
|
-
authType: "user-access-token",
|
|
219
|
-
});
|
|
3
|
+
exports.DashboardAPIClient = exports.apiClient = void 0;
|
|
4
|
+
var dashboard_client_1 = require("@empiricalrun/dashboard-client");
|
|
5
|
+
Object.defineProperty(exports, "apiClient", { enumerable: true, get: function () { return dashboard_client_1.apiClient; } });
|
|
6
|
+
Object.defineProperty(exports, "DashboardAPIClient", { enumerable: true, get: function () { return dashboard_client_1.DashboardAPIClient; } });
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { sendErrorToolResponse, sendToolResponse } from "
|
|
3
|
-
export { sendErrorToolResponseFromSandbox, sendToolResponseFromSandbox, } from "./tool-response-from-sandbox";
|
|
4
|
-
export { HTTPError, NonRetryableHTTPError, RetryableHTTPError } from "./types";
|
|
1
|
+
export type { AuthenticationType, TokenProvider, } from "@empiricalrun/dashboard-client";
|
|
2
|
+
export { DashboardAPIClient, HTTPError, NonRetryableHTTPError, RetryableHTTPError, sendErrorToolResponse, sendErrorToolResponseFromSandbox, sendToolResponse, sendToolResponseFromSandbox, } from "@empiricalrun/dashboard-client";
|
|
5
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,aAAa,GACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,gCAAgC,EAChC,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,gCAAgC,CAAC"}
|
package/dist/dashboard/index.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "DashboardAPIClient", { enumerable: true, get: function () { return
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "
|
|
8
|
-
Object.defineProperty(exports, "
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, "sendErrorToolResponseFromSandbox", { enumerable: true, get: function () { return
|
|
11
|
-
Object.defineProperty(exports, "
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, "HTTPError", { enumerable: true, get: function () { return types_1.HTTPError; } });
|
|
14
|
-
Object.defineProperty(exports, "NonRetryableHTTPError", { enumerable: true, get: function () { return types_1.NonRetryableHTTPError; } });
|
|
15
|
-
Object.defineProperty(exports, "RetryableHTTPError", { enumerable: true, get: function () { return types_1.RetryableHTTPError; } });
|
|
3
|
+
exports.sendToolResponseFromSandbox = exports.sendToolResponse = exports.sendErrorToolResponseFromSandbox = exports.sendErrorToolResponse = exports.RetryableHTTPError = exports.NonRetryableHTTPError = exports.HTTPError = exports.DashboardAPIClient = void 0;
|
|
4
|
+
var dashboard_client_1 = require("@empiricalrun/dashboard-client");
|
|
5
|
+
Object.defineProperty(exports, "DashboardAPIClient", { enumerable: true, get: function () { return dashboard_client_1.DashboardAPIClient; } });
|
|
6
|
+
Object.defineProperty(exports, "HTTPError", { enumerable: true, get: function () { return dashboard_client_1.HTTPError; } });
|
|
7
|
+
Object.defineProperty(exports, "NonRetryableHTTPError", { enumerable: true, get: function () { return dashboard_client_1.NonRetryableHTTPError; } });
|
|
8
|
+
Object.defineProperty(exports, "RetryableHTTPError", { enumerable: true, get: function () { return dashboard_client_1.RetryableHTTPError; } });
|
|
9
|
+
Object.defineProperty(exports, "sendErrorToolResponse", { enumerable: true, get: function () { return dashboard_client_1.sendErrorToolResponse; } });
|
|
10
|
+
Object.defineProperty(exports, "sendErrorToolResponseFromSandbox", { enumerable: true, get: function () { return dashboard_client_1.sendErrorToolResponseFromSandbox; } });
|
|
11
|
+
Object.defineProperty(exports, "sendToolResponse", { enumerable: true, get: function () { return dashboard_client_1.sendToolResponse; } });
|
|
12
|
+
Object.defineProperty(exports, "sendToolResponseFromSandbox", { enumerable: true, get: function () { return dashboard_client_1.sendToolResponseFromSandbox; } });
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Logger, MessageCheckpoint, PendingToolCall, ToolResult } from "@empiricalrun/shared-types/chat-agent";
|
|
3
|
-
export declare function sendErrorToolResponseFromSandbox(apiClient: IDashboardAPIClient, apiPath: string, toolCalls: PendingToolCall[], errorMessage: string, logger: Logger): Promise<boolean>;
|
|
4
|
-
export declare function sendToolResponseFromSandbox(apiClient: IDashboardAPIClient, apiPath: string, toolCalls: PendingToolCall[], toolResults: ToolResult[], checkpoint: MessageCheckpoint | null, logger: Logger): Promise<boolean>;
|
|
1
|
+
export { sendErrorToolResponseFromSandbox, sendToolResponseFromSandbox, } from "@empiricalrun/dashboard-client";
|
|
5
2
|
//# sourceMappingURL=tool-response-from-sandbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-response-from-sandbox.d.ts","sourceRoot":"","sources":["../../src/dashboard/tool-response-from-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tool-response-from-sandbox.d.ts","sourceRoot":"","sources":["../../src/dashboard/tool-response-from-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendErrorToolResponseFromSandbox =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
async function sendErrorToolResponseFromSandbox(apiClient, apiPath, toolCalls, errorMessage, logger) {
|
|
8
|
-
const toolResults = toolCalls.map(() => ({
|
|
9
|
-
isError: true,
|
|
10
|
-
result: errorMessage,
|
|
11
|
-
}));
|
|
12
|
-
return sendToolResponseFromSandbox(apiClient, apiPath, toolCalls, toolResults, null, logger);
|
|
13
|
-
}
|
|
14
|
-
async function sendToolResponseFromSandbox(apiClient, apiPath, toolCalls, toolResults, checkpoint, logger) {
|
|
15
|
-
const machineId = (0, tool_response_1.getDefaultMachineId)();
|
|
16
|
-
try {
|
|
17
|
-
await apiClient.request(apiPath, {
|
|
18
|
-
method: "POST",
|
|
19
|
-
body: {
|
|
20
|
-
toolResults,
|
|
21
|
-
toolCalls,
|
|
22
|
-
checkpoint,
|
|
23
|
-
machineId,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
// Check if it's a 409 Conflict (tool calls were rejected by user)
|
|
30
|
-
if (error instanceof types_1.NonRetryableHTTPError && error.status === 409) {
|
|
31
|
-
logger.info("Tool calls were rejected by user (409 Conflict), skipping git push");
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
logger.error("Failed to send tool response to", {
|
|
35
|
-
apiPath,
|
|
36
|
-
error,
|
|
37
|
-
});
|
|
38
|
-
throw error;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
3
|
+
exports.sendToolResponseFromSandbox = exports.sendErrorToolResponseFromSandbox = void 0;
|
|
4
|
+
var dashboard_client_1 = require("@empiricalrun/dashboard-client");
|
|
5
|
+
Object.defineProperty(exports, "sendErrorToolResponseFromSandbox", { enumerable: true, get: function () { return dashboard_client_1.sendErrorToolResponseFromSandbox; } });
|
|
6
|
+
Object.defineProperty(exports, "sendToolResponseFromSandbox", { enumerable: true, get: function () { return dashboard_client_1.sendToolResponseFromSandbox; } });
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Logger, MessageCheckpoint, PendingToolCall, ToolResult } from "@empiricalrun/shared-types/chat-agent";
|
|
3
|
-
export declare function getDefaultMachineId(): string;
|
|
4
|
-
export declare function sendToolResponse(apiClient: IDashboardAPIClient, chatSessionId: number | undefined, requestId: string, toolCalls: PendingToolCall[], toolResults: ToolResult[], checkpoint: MessageCheckpoint | null, logger: Logger, machineId?: string): Promise<boolean>;
|
|
5
|
-
export declare function sendErrorToolResponse(apiClient: IDashboardAPIClient, chatSessionId: number | undefined, requestId: string, toolCalls: PendingToolCall[], errorMessage: string, logger: Logger, machineId?: string): Promise<void>;
|
|
1
|
+
export { getDefaultMachineId, sendErrorToolResponse, sendToolResponse, } from "@empiricalrun/dashboard-client";
|
|
6
2
|
//# sourceMappingURL=tool-response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-response.d.ts","sourceRoot":"","sources":["../../src/dashboard/tool-response.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tool-response.d.ts","sourceRoot":"","sources":["../../src/dashboard/tool-response.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,89 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDefaultMachineId =
|
|
7
|
-
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function getDefaultMachineId() {
|
|
12
|
-
return os_1.default.hostname();
|
|
13
|
-
}
|
|
14
|
-
async function sendToolResponse(apiClient, chatSessionId, requestId, toolCalls, toolResults, checkpoint, logger, machineId) {
|
|
15
|
-
const resolvedMachineId = machineId ?? getDefaultMachineId();
|
|
16
|
-
try {
|
|
17
|
-
if (chatSessionId) {
|
|
18
|
-
await sendToolResponseForChatSession(apiClient, chatSessionId, toolCalls, toolResults, checkpoint, resolvedMachineId, logger);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
await sendToolResponseForAdhocToolCall(apiClient, requestId, toolCalls, toolResults, resolvedMachineId, logger);
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
// Check if it's a 409 Conflict (tool calls were rejected by user)
|
|
27
|
-
if (error instanceof types_1.NonRetryableHTTPError && error.status === 409) {
|
|
28
|
-
logger.info("Tool calls were rejected by user (409 Conflict), skipping git push");
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
// For other errors, re-throw
|
|
32
|
-
logger.error("Failed to send tool response", error);
|
|
33
|
-
throw error;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
async function sendErrorToolResponse(apiClient, chatSessionId, requestId, toolCalls, errorMessage, logger, machineId) {
|
|
37
|
-
const resolvedMachineId = machineId ?? getDefaultMachineId();
|
|
38
|
-
const toolResults = toolCalls.map(() => ({
|
|
39
|
-
isError: true,
|
|
40
|
-
result: errorMessage,
|
|
41
|
-
}));
|
|
42
|
-
if (chatSessionId) {
|
|
43
|
-
return sendToolResponseForChatSession(apiClient, chatSessionId, toolCalls, toolResults, null, resolvedMachineId, logger);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return sendToolResponseForAdhocToolCall(apiClient, requestId, toolCalls, toolResults, resolvedMachineId, logger);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
async function sendToolResponseForChatSession(apiClient, chatSessionId, toolCalls, toolResults, checkpoint, machineId, logger) {
|
|
50
|
-
const url = `/api/chat-sessions/${chatSessionId}/tool-response`;
|
|
51
|
-
try {
|
|
52
|
-
await apiClient.request(url, {
|
|
53
|
-
method: "POST",
|
|
54
|
-
body: {
|
|
55
|
-
toolResults,
|
|
56
|
-
toolCalls,
|
|
57
|
-
checkpoint,
|
|
58
|
-
machineId,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
logger.error("Failed to send tool response for chat session", {
|
|
64
|
-
chatSessionId,
|
|
65
|
-
error,
|
|
66
|
-
});
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async function sendToolResponseForAdhocToolCall(apiClient, requestId, toolCalls, toolResults, machineId, logger) {
|
|
71
|
-
const url = `/api/tool-calls/${requestId}/response`;
|
|
72
|
-
try {
|
|
73
|
-
await apiClient.request(url, {
|
|
74
|
-
method: "POST",
|
|
75
|
-
body: {
|
|
76
|
-
tool_results: toolResults,
|
|
77
|
-
tool_calls: toolCalls,
|
|
78
|
-
machine_id: machineId,
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
logger.error("Failed to send tool response for adhoc tool call", {
|
|
84
|
-
requestId,
|
|
85
|
-
error,
|
|
86
|
-
});
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
3
|
+
exports.sendToolResponse = exports.sendErrorToolResponse = exports.getDefaultMachineId = void 0;
|
|
4
|
+
var dashboard_client_1 = require("@empiricalrun/dashboard-client");
|
|
5
|
+
Object.defineProperty(exports, "getDefaultMachineId", { enumerable: true, get: function () { return dashboard_client_1.getDefaultMachineId; } });
|
|
6
|
+
Object.defineProperty(exports, "sendErrorToolResponse", { enumerable: true, get: function () { return dashboard_client_1.sendErrorToolResponse; } });
|
|
7
|
+
Object.defineProperty(exports, "sendToolResponse", { enumerable: true, get: function () { return dashboard_client_1.sendToolResponse; } });
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
status: number;
|
|
3
|
-
constructor(message: string, status: number);
|
|
4
|
-
}
|
|
5
|
-
export declare class NonRetryableHTTPError extends HTTPError {
|
|
6
|
-
}
|
|
7
|
-
export declare class RetryableHTTPError extends HTTPError {
|
|
8
|
-
}
|
|
1
|
+
export { HTTPError, NonRetryableHTTPError, RetryableHTTPError, } from "@empiricalrun/dashboard-client";
|
|
9
2
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/dashboard/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/dashboard/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC"}
|
package/dist/dashboard/types.js
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RetryableHTTPError = exports.NonRetryableHTTPError = exports.HTTPError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.status = status;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.HTTPError = HTTPError;
|
|
12
|
-
class NonRetryableHTTPError extends HTTPError {
|
|
13
|
-
}
|
|
14
|
-
exports.NonRetryableHTTPError = NonRetryableHTTPError;
|
|
15
|
-
class RetryableHTTPError extends HTTPError {
|
|
16
|
-
}
|
|
17
|
-
exports.RetryableHTTPError = RetryableHTTPError;
|
|
4
|
+
var dashboard_client_1 = require("@empiricalrun/dashboard-client");
|
|
5
|
+
Object.defineProperty(exports, "HTTPError", { enumerable: true, get: function () { return dashboard_client_1.HTTPError; } });
|
|
6
|
+
Object.defineProperty(exports, "NonRetryableHTTPError", { enumerable: true, get: function () { return dashboard_client_1.NonRetryableHTTPError; } });
|
|
7
|
+
Object.defineProperty(exports, "RetryableHTTPError", { enumerable: true, get: function () { return dashboard_client_1.RetryableHTTPError; } });
|
package/dist/file/server.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/file/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/file/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AAW9D,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,KAAK,CAAoB;IAEjC,OAAO,CAAC,cAAc,CAAqB;gBAE/B,EACV,IAAI,EACJ,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;KACzB;IAOD,iBAAiB;;;;IAIjB,iBAAiB;IAIjB,WAAW,CAAC,QAAQ,EAAE,MAAM;IAItB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAsHnC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../../../src/file-info/adapters/github/reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAwB/E,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;gBADT,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,mBAAmB;IAGlC,iBAAiB,CACrB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;IAoBZ,QAAQ,CACZ,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../../../src/file-info/adapters/github/reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAwB/E,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;gBADT,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,mBAAmB;IAGlC,iBAAiB,CACrB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;IAoBZ,QAAQ,CACZ,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;YAoDnB,aAAa;CAoD5B;AAyED,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,QAAQ,CAAC,CAwFnB"}
|
|
@@ -44,6 +44,16 @@ class GitHubFileReader {
|
|
|
44
44
|
console.log(`[GitHubFileReader] Reading as directory: ${filePath}`);
|
|
45
45
|
return this.readDirectory(filePath, resolvedBranch);
|
|
46
46
|
}
|
|
47
|
+
// For dotfiles without extensions (e.g. .empiricalrun, .github), we can't
|
|
48
|
+
// tell if they're files or directories by name alone. Try directory first
|
|
49
|
+
// since that API is faster and won't hang for misclassified paths.
|
|
50
|
+
if (isDotfile(filePath) && !path_1.default.extname(filePath)) {
|
|
51
|
+
console.log(`[GitHubFileReader] Dotfile without extension, trying directory first: ${filePath}`);
|
|
52
|
+
const dirResult = await this.readDirectory(filePath, resolvedBranch);
|
|
53
|
+
if (dirResult) {
|
|
54
|
+
return dirResult;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
47
57
|
try {
|
|
48
58
|
console.log(`[GitHubFileReader] Reading as file: ${filePath}, resolved branch: ${resolvedBranch}`);
|
|
49
59
|
const params = {
|
|
@@ -62,12 +72,10 @@ class GitHubFileReader {
|
|
|
62
72
|
};
|
|
63
73
|
}
|
|
64
74
|
console.log(`[GitHubFileReader] File not available: ${filePath}`);
|
|
65
|
-
// For file paths (with extensions), don't fall back to directory reading
|
|
66
75
|
return null;
|
|
67
76
|
}
|
|
68
77
|
catch (error) {
|
|
69
78
|
console.log(`[GitHubFileReader] Error reading file ${filePath}:`, error);
|
|
70
|
-
// For file paths, return null (file not found)
|
|
71
79
|
return null;
|
|
72
80
|
}
|
|
73
81
|
}
|