@onklave/agent-cli 0.1.46 → 0.1.48
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/main.js +50 -27
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -774,8 +774,8 @@ var PlatformClient = class {
|
|
|
774
774
|
/*
|
|
775
775
|
* Make an authenticated HTTP request to the platform.
|
|
776
776
|
*/
|
|
777
|
-
async request(method,
|
|
778
|
-
const url = `${this.baseUrl}${GATEWAY_SERVICE_PREFIX}${
|
|
777
|
+
async request(method, path12, body, extraHeaders) {
|
|
778
|
+
const url = `${this.baseUrl}${GATEWAY_SERVICE_PREFIX}${path12}`;
|
|
779
779
|
const headers = {
|
|
780
780
|
Authorization: `Bearer ${this.token}`,
|
|
781
781
|
"Content-Type": "application/json",
|
|
@@ -2826,7 +2826,33 @@ async function denyCommand(args) {
|
|
|
2826
2826
|
// _apps/@onklave/agent-cli/src/commands/doctor.command.ts
|
|
2827
2827
|
import * as fs6 from "fs";
|
|
2828
2828
|
import * as path6 from "path";
|
|
2829
|
+
|
|
2830
|
+
// _apps/@onklave/agent-cli/src/services/command-exists.ts
|
|
2829
2831
|
import { execSync } from "child_process";
|
|
2832
|
+
function lookupCommand(command) {
|
|
2833
|
+
return process.platform === "win32" ? `where ${command}` : `which ${command}`;
|
|
2834
|
+
}
|
|
2835
|
+
function commandExists(command) {
|
|
2836
|
+
try {
|
|
2837
|
+
execSync(lookupCommand(command), { stdio: "ignore", timeout: 3e3 });
|
|
2838
|
+
return true;
|
|
2839
|
+
} catch {
|
|
2840
|
+
return false;
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
function commandPath(command) {
|
|
2844
|
+
try {
|
|
2845
|
+
const out = execSync(lookupCommand(command), {
|
|
2846
|
+
encoding: "utf-8",
|
|
2847
|
+
timeout: 5e3
|
|
2848
|
+
}).trim();
|
|
2849
|
+
return out.split(/\r?\n/)[0] || null;
|
|
2850
|
+
} catch {
|
|
2851
|
+
return null;
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
// _apps/@onklave/agent-cli/src/commands/doctor.command.ts
|
|
2830
2856
|
async function doctorCommand() {
|
|
2831
2857
|
console.log("Onklave Agent CLI \u2014 Doctor\n");
|
|
2832
2858
|
console.log("Running diagnostics...\n");
|
|
@@ -2895,23 +2921,19 @@ async function checkPlatform() {
|
|
|
2895
2921
|
};
|
|
2896
2922
|
}
|
|
2897
2923
|
function checkClaudeCli() {
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
encoding: "utf-8",
|
|
2901
|
-
timeout: 5e3
|
|
2902
|
-
}).trim();
|
|
2924
|
+
const claudePath = commandPath("claude");
|
|
2925
|
+
if (claudePath) {
|
|
2903
2926
|
return {
|
|
2904
2927
|
name: "Claude Code CLI",
|
|
2905
2928
|
status: "ok",
|
|
2906
2929
|
detail: `Found at ${claudePath}`
|
|
2907
2930
|
};
|
|
2908
|
-
} catch {
|
|
2909
|
-
return {
|
|
2910
|
-
name: "Claude Code CLI",
|
|
2911
|
-
status: "fail",
|
|
2912
|
-
detail: "Not found. Install Claude Code CLI: https://docs.anthropic.com/claude-code"
|
|
2913
|
-
};
|
|
2914
2931
|
}
|
|
2932
|
+
return {
|
|
2933
|
+
name: "Claude Code CLI",
|
|
2934
|
+
status: "fail",
|
|
2935
|
+
detail: "Not found. Install Claude Code CLI: https://docs.anthropic.com/claude-code"
|
|
2936
|
+
};
|
|
2915
2937
|
}
|
|
2916
2938
|
function checkNodeVersion() {
|
|
2917
2939
|
const version = process.version;
|
|
@@ -3210,17 +3232,11 @@ This machine can now receive remote agent session requests.`
|
|
|
3210
3232
|
}
|
|
3211
3233
|
function detectCapabilities() {
|
|
3212
3234
|
const capabilities = ["agent-runner"];
|
|
3213
|
-
|
|
3214
|
-
const { execSync: execSync2 } = __require("child_process");
|
|
3215
|
-
execSync2("which claude", { timeout: 3e3, stdio: "pipe" });
|
|
3235
|
+
if (commandExists("claude")) {
|
|
3216
3236
|
capabilities.push("claude-code");
|
|
3217
|
-
} catch {
|
|
3218
3237
|
}
|
|
3219
|
-
|
|
3220
|
-
const { execSync: execSync2 } = __require("child_process");
|
|
3221
|
-
execSync2("which docker", { timeout: 3e3, stdio: "pipe" });
|
|
3238
|
+
if (commandExists("docker")) {
|
|
3222
3239
|
capabilities.push("docker");
|
|
3223
|
-
} catch {
|
|
3224
3240
|
}
|
|
3225
3241
|
return capabilities;
|
|
3226
3242
|
}
|
|
@@ -3264,6 +3280,7 @@ async function logsCommand(args) {
|
|
|
3264
3280
|
|
|
3265
3281
|
// _apps/@onklave/agent-cli/src/commands/daemon.command.ts
|
|
3266
3282
|
import * as fs10 from "fs";
|
|
3283
|
+
import * as path10 from "path";
|
|
3267
3284
|
|
|
3268
3285
|
// _apps/@onklave/agent-cli/src/services/daemon-comms.service.ts
|
|
3269
3286
|
var DaemonCommsService = class {
|
|
@@ -3690,8 +3707,8 @@ var PlatformBrokerClient = class {
|
|
|
3690
3707
|
params
|
|
3691
3708
|
);
|
|
3692
3709
|
}
|
|
3693
|
-
async request(method,
|
|
3694
|
-
const url = `${this.baseUrl}/agent-orchestration${
|
|
3710
|
+
async request(method, path12, body) {
|
|
3711
|
+
const url = `${this.baseUrl}/agent-orchestration${path12}`;
|
|
3695
3712
|
const response = await fetch(url, {
|
|
3696
3713
|
method,
|
|
3697
3714
|
headers: {
|
|
@@ -4793,8 +4810,14 @@ function readPid(pidFile) {
|
|
|
4793
4810
|
}
|
|
4794
4811
|
}
|
|
4795
4812
|
function writePid(pidFile) {
|
|
4796
|
-
const dir =
|
|
4813
|
+
const dir = path10.dirname(pidFile);
|
|
4797
4814
|
fs10.mkdirSync(dir, { recursive: true });
|
|
4815
|
+
try {
|
|
4816
|
+
if (fs10.statSync(pidFile).isDirectory()) {
|
|
4817
|
+
fs10.rmSync(pidFile, { recursive: true, force: true });
|
|
4818
|
+
}
|
|
4819
|
+
} catch {
|
|
4820
|
+
}
|
|
4798
4821
|
fs10.writeFileSync(pidFile, String(process.pid), { mode: 384 });
|
|
4799
4822
|
}
|
|
4800
4823
|
function removePid(pidFile) {
|
|
@@ -4844,13 +4867,13 @@ var COMMANDS = {
|
|
|
4844
4867
|
|
|
4845
4868
|
// _apps/@onklave/agent-cli/src/services/update-notifier.service.ts
|
|
4846
4869
|
import * as fs11 from "node:fs";
|
|
4847
|
-
import * as
|
|
4870
|
+
import * as path11 from "node:path";
|
|
4848
4871
|
import * as os8 from "node:os";
|
|
4849
4872
|
import { createInterface } from "node:readline/promises";
|
|
4850
4873
|
import { spawnSync } from "node:child_process";
|
|
4851
4874
|
var CHECK_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
4852
4875
|
var FETCH_DEADLINE_MS = 1500;
|
|
4853
|
-
var CACHE_PATH =
|
|
4876
|
+
var CACHE_PATH = path11.join(
|
|
4854
4877
|
os8.homedir(),
|
|
4855
4878
|
".config",
|
|
4856
4879
|
"onklave",
|
|
@@ -4969,7 +4992,7 @@ function readCache() {
|
|
|
4969
4992
|
}
|
|
4970
4993
|
function writeCache(cache) {
|
|
4971
4994
|
try {
|
|
4972
|
-
fs11.mkdirSync(
|
|
4995
|
+
fs11.mkdirSync(path11.dirname(CACHE_PATH), { recursive: true, mode: 448 });
|
|
4973
4996
|
fs11.writeFileSync(CACHE_PATH, JSON.stringify(cache, null, 2), "utf8");
|
|
4974
4997
|
} catch {
|
|
4975
4998
|
}
|