@versot/vaguspi 0.1.7 → 0.1.8
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/bin.js +60 -6
- package/dist/bin.js.map +3 -3
- package/gui/assets/index-DFsmuH9W.js +19 -0
- package/gui/index.html +1 -1
- package/package.json +1 -1
- package/gui/assets/index-DRbNBgQ5.js +0 -19
package/dist/bin.js
CHANGED
|
@@ -300,6 +300,7 @@ var VagModelsStore = class {
|
|
|
300
300
|
};
|
|
301
301
|
|
|
302
302
|
// packages/host/engine/dist/vagus-engine.js
|
|
303
|
+
import { spawn } from "node:child_process";
|
|
303
304
|
import { createAgentSession, DefaultResourceLoader, ModelRuntime, SessionManager as SessionManager2, SettingsManager } from "@earendil-works/pi-coding-agent";
|
|
304
305
|
import { homedir } from "node:os";
|
|
305
306
|
import { basename, dirname as dirname3, isAbsolute as isAbsolute2, join as join5, resolve, sep } from "node:path";
|
|
@@ -870,6 +871,17 @@ var ExtensionUiBridge = class {
|
|
|
870
871
|
};
|
|
871
872
|
|
|
872
873
|
// packages/host/engine/dist/vagus-engine.js
|
|
874
|
+
function runCapture(cmd, args) {
|
|
875
|
+
return new Promise((res) => {
|
|
876
|
+
const child = spawn(cmd, args, { windowsHide: true });
|
|
877
|
+
let stdout = "";
|
|
878
|
+
child.stdout?.on("data", (d) => {
|
|
879
|
+
stdout += String(d);
|
|
880
|
+
});
|
|
881
|
+
child.on("error", () => res({ stdout, code: 1 }));
|
|
882
|
+
child.on("close", (code) => res({ stdout, code: code ?? 1 }));
|
|
883
|
+
});
|
|
884
|
+
}
|
|
873
885
|
var VagusEngine = class _VagusEngine {
|
|
874
886
|
options;
|
|
875
887
|
sessions = /* @__PURE__ */ new Map();
|
|
@@ -2001,6 +2013,47 @@ var VagusEngine = class _VagusEngine {
|
|
|
2001
2013
|
}
|
|
2002
2014
|
return { cancelled };
|
|
2003
2015
|
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Opens the OS-native folder picker on the daemon host and returns the
|
|
2018
|
+
* chosen path (null = user cancelled / unsupported platform). Windows uses
|
|
2019
|
+
* the FolderBrowserDialog via PowerShell (zero deps, -STA so the dialog
|
|
2020
|
+
* works, TopMost host so it isn't buried behind other windows); macOS uses
|
|
2021
|
+
* osascript; Linux tries zenity then kdialog.
|
|
2022
|
+
*/
|
|
2023
|
+
async pickNativeDirectory() {
|
|
2024
|
+
const platform = process.platform;
|
|
2025
|
+
if (platform === "win32") {
|
|
2026
|
+
const ps = "Add-Type -AssemblyName System.Windows.Forms;$host2 = New-Object System.Windows.Forms.Form -Property @{TopMost=$true; ShowInTaskbar=$false};$f = New-Object System.Windows.Forms.FolderBrowserDialog;$f.ShowNewFolderButton = $true;if ($f.ShowDialog($host2) -eq [System.Windows.Forms.DialogResult]::OK) { $f.SelectedPath }";
|
|
2027
|
+
const { stdout } = await runCapture("powershell", ["-NoProfile", "-STA", "-Command", ps]);
|
|
2028
|
+
const p = stdout.trim();
|
|
2029
|
+
return { path: p === "" ? null : p };
|
|
2030
|
+
}
|
|
2031
|
+
if (platform === "darwin") {
|
|
2032
|
+
const script = [
|
|
2033
|
+
"try",
|
|
2034
|
+
"with timeout of 3600 seconds",
|
|
2035
|
+
'set selectedFolder to choose folder with prompt "\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55"',
|
|
2036
|
+
"POSIX path of selectedFolder",
|
|
2037
|
+
"on error number -128",
|
|
2038
|
+
'return ""',
|
|
2039
|
+
"end try"
|
|
2040
|
+
].join("\n");
|
|
2041
|
+
const { stdout, code } = await runCapture("osascript", ["-e", script]);
|
|
2042
|
+
const p = stdout.trim().replace(/\/$/, "");
|
|
2043
|
+
return { path: code === 0 && p !== "" ? p : null };
|
|
2044
|
+
}
|
|
2045
|
+
if (platform === "linux") {
|
|
2046
|
+
let { stdout, code } = await runCapture("zenity", ["--file-selection", "--directory", "--title=\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55"]);
|
|
2047
|
+
if (code === 127) {
|
|
2048
|
+
({ stdout, code } = await runCapture("kdialog", ["--getexistingdirectory", ".", "--title", "\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55"]));
|
|
2049
|
+
if (code === 127)
|
|
2050
|
+
throw new Error("\u672A\u627E\u5230 zenity \u6216 kdialog\uFF0C\u65E0\u6CD5\u6253\u5F00\u7CFB\u7EDF\u76EE\u5F55\u9009\u62E9\u5668\uFF08\u8BF7\u5728\u670D\u52A1\u5668\u4E0A\u5B89\u88C5 zenity\uFF09");
|
|
2051
|
+
}
|
|
2052
|
+
const p = stdout.trim();
|
|
2053
|
+
return { path: code === 0 && p !== "" ? p : null };
|
|
2054
|
+
}
|
|
2055
|
+
throw new Error(`\u7CFB\u7EDF\u76EE\u5F55\u9009\u62E9\u5668\u4E0D\u652F\u6301\u5728 ${platform} \u4E0A\u8FD0\u884C`);
|
|
2056
|
+
}
|
|
2004
2057
|
/**
|
|
2005
2058
|
* Queues a follow-up message.
|
|
2006
2059
|
*/
|
|
@@ -7583,6 +7636,7 @@ async function runDaemon() {
|
|
|
7583
7636
|
const { sessionId, text } = params ?? {};
|
|
7584
7637
|
return host.followUpSession(requireString(sessionId, "sessionId"), requireString(text, "text"));
|
|
7585
7638
|
});
|
|
7639
|
+
srv.registerMethod("project.pickNative", () => host.pickNativeDirectory());
|
|
7586
7640
|
srv.registerMethod("session.cancelQueued", (params) => {
|
|
7587
7641
|
const { sessionId, text } = params ?? {};
|
|
7588
7642
|
return host.cancelQueuedMessage(requireString(sessionId, "sessionId"), requireString(text, "text"));
|
|
@@ -7750,13 +7804,13 @@ async function runDaemon() {
|
|
|
7750
7804
|
}
|
|
7751
7805
|
|
|
7752
7806
|
// apps/cli/src/commands/web.ts
|
|
7753
|
-
import { spawn as
|
|
7807
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
7754
7808
|
import { existsSync as existsSync8 } from "node:fs";
|
|
7755
7809
|
import { join as join9 } from "node:path";
|
|
7756
7810
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
7757
7811
|
|
|
7758
7812
|
// apps/cli/src/daemon.ts
|
|
7759
|
-
import { execSync, spawn } from "node:child_process";
|
|
7813
|
+
import { execSync, spawn as spawn2 } from "node:child_process";
|
|
7760
7814
|
import { existsSync as existsSync7 } from "node:fs";
|
|
7761
7815
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
7762
7816
|
function detectSystemProxy() {
|
|
@@ -7818,7 +7872,7 @@ function spawnDaemon(options = {}) {
|
|
|
7818
7872
|
process.stderr.write(`vagus: proxy env already set (HTTPS_PROXY=${process.env.HTTPS_PROXY ?? process.env.HTTP_PROXY})
|
|
7819
7873
|
`);
|
|
7820
7874
|
}
|
|
7821
|
-
return
|
|
7875
|
+
return spawn2(process.execPath, args, {
|
|
7822
7876
|
stdio: options.stdio ?? ["pipe", "pipe", "pipe"],
|
|
7823
7877
|
env: { ...process.env, ...injected, ...options.env }
|
|
7824
7878
|
});
|
|
@@ -7836,11 +7890,11 @@ function guiDistPath() {
|
|
|
7836
7890
|
function openBrowser(url) {
|
|
7837
7891
|
const platform = process.platform;
|
|
7838
7892
|
if (platform === "win32") {
|
|
7839
|
-
|
|
7893
|
+
spawn3("cmd", ["/c", "start", "", url], { stdio: "ignore", detached: true }).unref();
|
|
7840
7894
|
} else if (platform === "darwin") {
|
|
7841
|
-
|
|
7895
|
+
spawn3("open", [url], { stdio: "ignore", detached: true }).unref();
|
|
7842
7896
|
} else {
|
|
7843
|
-
|
|
7897
|
+
spawn3("xdg-open", [url], { stdio: "ignore", detached: true }).unref();
|
|
7844
7898
|
}
|
|
7845
7899
|
}
|
|
7846
7900
|
async function runWeb() {
|