@todoforai/cli 0.1.6 → 0.1.7
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/todoai.js +36 -5
- package/package.json +1 -1
package/dist/todoai.js
CHANGED
|
@@ -42776,6 +42776,12 @@ class ApiClient {
|
|
|
42776
42776
|
updateAgentSettings(agentId, agentSettingsId, updates) {
|
|
42777
42777
|
return this.request("PUT", `/api/v1/agents/${agentId}/settings`, { agentSettingsId, updates });
|
|
42778
42778
|
}
|
|
42779
|
+
getGlobalAgentSettings() {
|
|
42780
|
+
return this.request("GET", "/api/v1/agents/global");
|
|
42781
|
+
}
|
|
42782
|
+
updateGlobalAgentSettings(updates) {
|
|
42783
|
+
return this.request("PUT", "/api/v1/agents/global", updates);
|
|
42784
|
+
}
|
|
42779
42785
|
setAgentEdgeMcpConfig(agentId, agentSettingsId, edgeId, mcpName, config) {
|
|
42780
42786
|
return this.request("PUT", `/api/v1/agents/${agentId}/edge-mcp-config`, { agentSettingsId, edgeId, mcpName, config });
|
|
42781
42787
|
}
|
|
@@ -44935,11 +44941,19 @@ async function listAgentsCommand(api, opts) {
|
|
|
44935
44941
|
}
|
|
44936
44942
|
|
|
44937
44943
|
// src/ensure-edge.ts
|
|
44938
|
-
import { spawn } from "child_process";
|
|
44944
|
+
import { spawn, spawnSync } from "child_process";
|
|
44939
44945
|
import fs from "fs";
|
|
44940
44946
|
import path2 from "path";
|
|
44941
44947
|
import os2 from "os";
|
|
44948
|
+
function hasBunx() {
|
|
44949
|
+
const probe = spawnSync(process.platform === "win32" ? "where" : "which", ["bunx"], { stdio: "ignore" });
|
|
44950
|
+
return probe.status === 0;
|
|
44951
|
+
}
|
|
44942
44952
|
function ensureEdgeRunning(apiUrl, apiKey) {
|
|
44953
|
+
if (!hasBunx()) {
|
|
44954
|
+
console.error("\x1B[2mEdge daemon not started: `bunx` is missing. Install Bun from https://bun.sh to enable it, or pass --no-edge to silence this.\x1B[0m");
|
|
44955
|
+
return;
|
|
44956
|
+
}
|
|
44943
44957
|
const logDir = path2.join(os2.homedir(), ".todoforai");
|
|
44944
44958
|
fs.mkdirSync(logDir, { recursive: true });
|
|
44945
44959
|
const logFile = path2.join(logDir, "edge.log");
|
|
@@ -44948,13 +44962,30 @@ function ensureEdgeRunning(apiUrl, apiKey) {
|
|
|
44948
44962
|
detached: true,
|
|
44949
44963
|
stdio: ["ignore", out, out]
|
|
44950
44964
|
});
|
|
44965
|
+
child.on("error", (err) => {
|
|
44966
|
+
console.error(`\x1B[33mFailed to start edge daemon: ${err.message}\x1B[0m`);
|
|
44967
|
+
});
|
|
44968
|
+
let exited = false;
|
|
44969
|
+
let exitCode = null;
|
|
44970
|
+
child.on("exit", (code) => {
|
|
44971
|
+
exited = true;
|
|
44972
|
+
exitCode = code;
|
|
44973
|
+
});
|
|
44951
44974
|
child.unref();
|
|
44952
44975
|
const pid = child.pid;
|
|
44976
|
+
if (!pid)
|
|
44977
|
+
return;
|
|
44978
|
+
const shortLog = logFile.replace(os2.homedir(), "~");
|
|
44953
44979
|
setTimeout(() => {
|
|
44954
|
-
|
|
44955
|
-
|
|
44956
|
-
|
|
44957
|
-
}
|
|
44980
|
+
if (!exited) {
|
|
44981
|
+
console.error(`\x1B[2mStarted edge daemon (pid ${pid}), logs: ${shortLog}\x1B[0m`);
|
|
44982
|
+
return;
|
|
44983
|
+
}
|
|
44984
|
+
if (exitCode === 0) {
|
|
44985
|
+
console.error(`\x1B[2mEdge daemon exited cleanly (another instance likely already running). Logs: ${shortLog}\x1B[0m`);
|
|
44986
|
+
} else {
|
|
44987
|
+
console.error(`\x1B[31mEdge daemon died (exit ${exitCode}). Check logs: ${shortLog}\x1B[0m`);
|
|
44988
|
+
}
|
|
44958
44989
|
}, 500);
|
|
44959
44990
|
}
|
|
44960
44991
|
|