vigthoria-cli 1.6.56 → 1.6.58
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/dist/commands/fork.d.ts
CHANGED
package/dist/commands/fork.js
CHANGED
|
@@ -31,18 +31,35 @@ class ForkCommand {
|
|
|
31
31
|
return headers;
|
|
32
32
|
}
|
|
33
33
|
getBaseUrl() {
|
|
34
|
+
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
35
|
+
const allowLocal = process.env.VIGTHORIA_ALLOW_LOCAL_V3_AGENT === '1';
|
|
34
36
|
return (process.env.VIGTHORIA_V3_AGENT_URL ||
|
|
35
37
|
process.env.V3_AGENT_URL ||
|
|
36
|
-
'http://127.0.0.1:8030')
|
|
38
|
+
(allowLocal ? 'http://127.0.0.1:8030' : null) ||
|
|
39
|
+
configuredApiUrl);
|
|
40
|
+
}
|
|
41
|
+
resolveWorkspaceRoot(project) {
|
|
42
|
+
if (/^[a-zA-Z]:[\\/]/.test(project) || /^\\\\/.test(project))
|
|
43
|
+
return '';
|
|
44
|
+
if (typeof require !== 'undefined') {
|
|
45
|
+
try {
|
|
46
|
+
const path = require('path');
|
|
47
|
+
if (!path.isAbsolute(project))
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
catch { }
|
|
51
|
+
}
|
|
52
|
+
return project;
|
|
37
53
|
}
|
|
38
54
|
async run(runId, message, options) {
|
|
39
55
|
const project = options.project || process.cwd();
|
|
56
|
+
const workspace = this.resolveWorkspaceRoot(project);
|
|
40
57
|
const eventIndex = options.eventIndex || 0;
|
|
41
58
|
const spinner = (0, logger_js_1.createSpinner)(`Forking run ${runId}...`).start();
|
|
42
59
|
try {
|
|
43
60
|
const baseUrl = this.getBaseUrl();
|
|
44
61
|
const body = {
|
|
45
|
-
workspace_root:
|
|
62
|
+
workspace_root: workspace,
|
|
46
63
|
from_event_index: eventIndex,
|
|
47
64
|
new_request: message || '',
|
|
48
65
|
stream: true,
|
|
@@ -58,6 +75,9 @@ class ForkCommand {
|
|
|
58
75
|
if (resp.status === 404) {
|
|
59
76
|
this.logger.error(`Run ${runId} not found or has no event log.`);
|
|
60
77
|
}
|
|
78
|
+
else if (resp.status === 502 || resp.status === 503) {
|
|
79
|
+
this.logger.error(`V3 run-history route is not available on ${baseUrl}. Backend may not expose /api/runs.`);
|
|
80
|
+
}
|
|
61
81
|
else {
|
|
62
82
|
this.logger.error(`Fork failed: ${resp.status} ${resp.statusText}`);
|
|
63
83
|
}
|
package/dist/commands/history.js
CHANGED
|
@@ -31,26 +31,49 @@ class HistoryCommand {
|
|
|
31
31
|
return headers;
|
|
32
32
|
}
|
|
33
33
|
getBaseUrl() {
|
|
34
|
+
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
35
|
+
const allowLocal = process.env.VIGTHORIA_ALLOW_LOCAL_V3_AGENT === '1';
|
|
34
36
|
return (process.env.VIGTHORIA_V3_AGENT_URL ||
|
|
35
37
|
process.env.V3_AGENT_URL ||
|
|
36
|
-
'http://127.0.0.1:8030')
|
|
38
|
+
(allowLocal ? 'http://127.0.0.1:8030' : null) ||
|
|
39
|
+
configuredApiUrl);
|
|
40
|
+
}
|
|
41
|
+
resolveWorkspaceRoot(project) {
|
|
42
|
+
// On Windows or non-absolute paths, send empty so the server uses its fallback root
|
|
43
|
+
if (/^[a-zA-Z]:[\\/]/.test(project) || /^\\\\/.test(project))
|
|
44
|
+
return '';
|
|
45
|
+
if (typeof require !== 'undefined') {
|
|
46
|
+
try {
|
|
47
|
+
const path = require('path');
|
|
48
|
+
if (!path.isAbsolute(project))
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
catch { }
|
|
52
|
+
}
|
|
53
|
+
return project;
|
|
37
54
|
}
|
|
38
55
|
async run(options) {
|
|
39
56
|
const limit = options.limit || 20;
|
|
40
57
|
const project = options.project || process.cwd();
|
|
58
|
+
const workspace = this.resolveWorkspaceRoot(project);
|
|
41
59
|
const spinner = (0, logger_js_1.createSpinner)('Loading run history...').start();
|
|
42
60
|
try {
|
|
43
61
|
const baseUrl = this.getBaseUrl();
|
|
44
62
|
const params = new URLSearchParams({
|
|
45
63
|
limit: String(limit),
|
|
46
|
-
workspace_root:
|
|
64
|
+
workspace_root: workspace,
|
|
47
65
|
});
|
|
48
66
|
const resp = await fetch(`${baseUrl}/api/runs?${params}`, {
|
|
49
67
|
headers: this.getHeaders(),
|
|
50
68
|
});
|
|
51
69
|
if (!resp.ok) {
|
|
52
70
|
spinner.stop();
|
|
53
|
-
|
|
71
|
+
if (resp.status === 404 || resp.status === 502 || resp.status === 503) {
|
|
72
|
+
this.logger.error(`V3 run-history route is not available on ${baseUrl}. Backend may not expose /api/runs.`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.logger.error(`Failed to fetch runs: ${resp.status} ${resp.statusText}`);
|
|
76
|
+
}
|
|
54
77
|
return;
|
|
55
78
|
}
|
|
56
79
|
const data = (await resp.json());
|
package/dist/commands/replay.js
CHANGED
|
@@ -31,9 +31,25 @@ class ReplayCommand {
|
|
|
31
31
|
return headers;
|
|
32
32
|
}
|
|
33
33
|
getBaseUrl() {
|
|
34
|
+
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
35
|
+
const allowLocal = process.env.VIGTHORIA_ALLOW_LOCAL_V3_AGENT === '1';
|
|
34
36
|
return (process.env.VIGTHORIA_V3_AGENT_URL ||
|
|
35
37
|
process.env.V3_AGENT_URL ||
|
|
36
|
-
'http://127.0.0.1:8030')
|
|
38
|
+
(allowLocal ? 'http://127.0.0.1:8030' : null) ||
|
|
39
|
+
configuredApiUrl);
|
|
40
|
+
}
|
|
41
|
+
resolveWorkspaceRoot(project) {
|
|
42
|
+
if (/^[a-zA-Z]:[\\/]/.test(project) || /^\\\\/.test(project))
|
|
43
|
+
return '';
|
|
44
|
+
if (typeof require !== 'undefined') {
|
|
45
|
+
try {
|
|
46
|
+
const path = require('path');
|
|
47
|
+
if (!path.isAbsolute(project))
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
catch { }
|
|
51
|
+
}
|
|
52
|
+
return project;
|
|
37
53
|
}
|
|
38
54
|
sleep(ms) {
|
|
39
55
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -41,10 +57,11 @@ class ReplayCommand {
|
|
|
41
57
|
async run(runId, options) {
|
|
42
58
|
const speed = options.speed || 200;
|
|
43
59
|
const project = options.project || process.cwd();
|
|
60
|
+
const workspace = this.resolveWorkspaceRoot(project);
|
|
44
61
|
const spinner = (0, logger_js_1.createSpinner)(`Loading events for run ${runId}...`).start();
|
|
45
62
|
try {
|
|
46
63
|
const baseUrl = this.getBaseUrl();
|
|
47
|
-
const params = new URLSearchParams({ workspace_root:
|
|
64
|
+
const params = new URLSearchParams({ workspace_root: workspace });
|
|
48
65
|
const resp = await fetch(`${baseUrl}/api/runs/${encodeURIComponent(runId)}/events?${params}`, {
|
|
49
66
|
headers: this.getHeaders(),
|
|
50
67
|
});
|
|
@@ -53,6 +70,9 @@ class ReplayCommand {
|
|
|
53
70
|
if (resp.status === 404) {
|
|
54
71
|
this.logger.error(`No event log found for run ${runId}. Events are only recorded for runs made after the replay system was deployed.`);
|
|
55
72
|
}
|
|
73
|
+
else if (resp.status === 502 || resp.status === 503) {
|
|
74
|
+
this.logger.error(`V3 run-history route is not available on ${baseUrl}. Backend may not expose /api/runs.`);
|
|
75
|
+
}
|
|
56
76
|
else {
|
|
57
77
|
this.logger.error(`Failed to fetch events: ${resp.status} ${resp.statusText}`);
|
|
58
78
|
}
|