nestor-sh 2.0.2 → 2.0.4
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/README.md +13 -13
- package/dist/nestor.mjs +414 -323
- package/dist/studio/assets/{index-8s_1ryBE.js → index-BfcUmUAy.js} +31 -31
- package/dist/studio/assets/index-Bs8Zxwae.js +538 -0
- package/dist/studio/index.html +1 -1
- package/package.json +1 -1
package/dist/nestor.mjs
CHANGED
|
@@ -18392,9 +18392,9 @@ var init_checker = __esm({
|
|
|
18392
18392
|
// ── Risk Assessment ─────────────────────────────────────────────────
|
|
18393
18393
|
assessRisk(toolName, args2) {
|
|
18394
18394
|
if (toolName === "shell_exec" || toolName.includes("shell") || toolName.includes("exec")) {
|
|
18395
|
-
const
|
|
18396
|
-
if (
|
|
18397
|
-
return scanPatterns(
|
|
18395
|
+
const command3 = String(args2.command ?? args2.cmd ?? "");
|
|
18396
|
+
if (command3 && !this.isAllowlisted(command3)) {
|
|
18397
|
+
return scanPatterns(command3, SHELL_PATTERNS);
|
|
18398
18398
|
}
|
|
18399
18399
|
}
|
|
18400
18400
|
if (toolName === "file_write" || toolName.startsWith("file_") && (toolName.includes("write") || toolName.includes("create"))) {
|
|
@@ -18447,8 +18447,8 @@ var init_checker = __esm({
|
|
|
18447
18447
|
return { denied: true, reason: `Auto-denied (no approval handler): ${reason}`, riskLevel };
|
|
18448
18448
|
}
|
|
18449
18449
|
// ── Helpers ─────────────────────────────────────────────────────────
|
|
18450
|
-
isAllowlisted(
|
|
18451
|
-
return this.allowlist.some((prefix) =>
|
|
18450
|
+
isAllowlisted(command3) {
|
|
18451
|
+
return this.allowlist.some((prefix) => command3.startsWith(prefix));
|
|
18452
18452
|
}
|
|
18453
18453
|
withTimeout(promise, ms) {
|
|
18454
18454
|
return new Promise((resolve17, reject) => {
|
|
@@ -18476,9 +18476,9 @@ import { exec } from "node:child_process";
|
|
|
18476
18476
|
import { promises as fs5 } from "node:fs";
|
|
18477
18477
|
import { resolve as resolve2, dirname as dirname2, basename, join as join3, relative } from "node:path";
|
|
18478
18478
|
import crypto3 from "node:crypto";
|
|
18479
|
-
function execAsync(
|
|
18479
|
+
function execAsync(command3, cwd) {
|
|
18480
18480
|
return new Promise((res, rej) => {
|
|
18481
|
-
exec(
|
|
18481
|
+
exec(command3, { cwd, timeout: 15e3, maxBuffer: 1024 * 1024 }, (err, stdout, stderr) => {
|
|
18482
18482
|
if (err)
|
|
18483
18483
|
rej(err);
|
|
18484
18484
|
else
|
|
@@ -18506,20 +18506,20 @@ function getAffectedFiles(toolName, args2, workingDir) {
|
|
|
18506
18506
|
return [resolve2(workingDir, filePath)];
|
|
18507
18507
|
}
|
|
18508
18508
|
if (toolName === "shell_exec") {
|
|
18509
|
-
const
|
|
18509
|
+
const command3 = String(args2.command || "");
|
|
18510
18510
|
const files = [];
|
|
18511
|
-
const rmMatch =
|
|
18511
|
+
const rmMatch = command3.match(/\brm\s+(?:-[a-zA-Z]*\s+)*(.+)/);
|
|
18512
18512
|
if (rmMatch) {
|
|
18513
18513
|
const paths = rmMatch[1].split(/\s+/).filter((p8) => !p8.startsWith("-"));
|
|
18514
18514
|
for (const p8 of paths) {
|
|
18515
18515
|
files.push(resolve2(workingDir, p8));
|
|
18516
18516
|
}
|
|
18517
18517
|
}
|
|
18518
|
-
const mvMatch =
|
|
18518
|
+
const mvMatch = command3.match(/\bmv\s+(?:-[a-zA-Z]*\s+)*(\S+)\s+/);
|
|
18519
18519
|
if (mvMatch) {
|
|
18520
18520
|
files.push(resolve2(workingDir, mvMatch[1]));
|
|
18521
18521
|
}
|
|
18522
|
-
const sedMatch =
|
|
18522
|
+
const sedMatch = command3.match(/\bsed\s+-i\S*\s+.*?\s+(\S+)$/);
|
|
18523
18523
|
if (sedMatch) {
|
|
18524
18524
|
files.push(resolve2(workingDir, sedMatch[1]));
|
|
18525
18525
|
}
|
|
@@ -18838,9 +18838,9 @@ function redactSecrets2(text7) {
|
|
|
18838
18838
|
}
|
|
18839
18839
|
return result;
|
|
18840
18840
|
}
|
|
18841
|
-
function checkCommand(
|
|
18841
|
+
function checkCommand(command3, policy = "smart", allowlist = []) {
|
|
18842
18842
|
if (native) {
|
|
18843
|
-
const result = native.check_command(
|
|
18843
|
+
const result = native.check_command(command3, policy, allowlist);
|
|
18844
18844
|
return {
|
|
18845
18845
|
decision: result.decision,
|
|
18846
18846
|
reasons: result.reasons.map((r) => ({
|
|
@@ -18865,14 +18865,14 @@ function checkCommand(command2, policy = "smart", allowlist = []) {
|
|
|
18865
18865
|
return { decision: "approved", reasons: [] };
|
|
18866
18866
|
}
|
|
18867
18867
|
for (const allowed of allowlist) {
|
|
18868
|
-
if (
|
|
18868
|
+
if (command3.startsWith(allowed)) {
|
|
18869
18869
|
return { decision: "approved", reasons: [] };
|
|
18870
18870
|
}
|
|
18871
18871
|
}
|
|
18872
18872
|
const reasons = [];
|
|
18873
18873
|
for (const { pattern, desc, category } of DANGEROUS_PATTERNS3) {
|
|
18874
18874
|
pattern.lastIndex = 0;
|
|
18875
|
-
const match = pattern.exec(
|
|
18875
|
+
const match = pattern.exec(command3);
|
|
18876
18876
|
if (match) {
|
|
18877
18877
|
reasons.push({
|
|
18878
18878
|
description: desc,
|
|
@@ -18943,8 +18943,8 @@ var init_native = __esm({
|
|
|
18943
18943
|
// ../agent/dist/tools/executor.js
|
|
18944
18944
|
function createDefaultSecurityChecks() {
|
|
18945
18945
|
return {
|
|
18946
|
-
checkShellCommand(
|
|
18947
|
-
const result = checkCommand(
|
|
18946
|
+
checkShellCommand(command3) {
|
|
18947
|
+
const result = checkCommand(command3, "smart", []);
|
|
18948
18948
|
if (result.decision === "blocked") {
|
|
18949
18949
|
const reason = result.reasons.length > 0 ? result.reasons.map((r) => r.description).join("; ") : "Blocked by command policy";
|
|
18950
18950
|
return { allowed: false, reason };
|
|
@@ -19092,9 +19092,9 @@ var init_executor2 = __esm({
|
|
|
19092
19092
|
*/
|
|
19093
19093
|
preExecutionCheck(toolName, input, context3) {
|
|
19094
19094
|
if (toolName === "shell_exec" || toolName.includes("shell") || toolName.includes("exec")) {
|
|
19095
|
-
const
|
|
19096
|
-
if (
|
|
19097
|
-
const check = this.security.checkShellCommand(
|
|
19095
|
+
const command3 = input["command"] ?? input["cmd"] ?? "";
|
|
19096
|
+
if (command3) {
|
|
19097
|
+
const check = this.security.checkShellCommand(command3);
|
|
19098
19098
|
if (!check.allowed) {
|
|
19099
19099
|
return { output: `Security check failed: ${check.reason}`, isError: true };
|
|
19100
19100
|
}
|
|
@@ -19178,9 +19178,9 @@ var init_docker = __esm({
|
|
|
19178
19178
|
/**
|
|
19179
19179
|
* Execute a command inside the sandbox container.
|
|
19180
19180
|
*/
|
|
19181
|
-
async execute(
|
|
19181
|
+
async execute(command3, args2 = []) {
|
|
19182
19182
|
const containerId = await this.ensureContainer();
|
|
19183
|
-
return this.execInContainer(containerId, [
|
|
19183
|
+
return this.execInContainer(containerId, [command3, ...args2]);
|
|
19184
19184
|
}
|
|
19185
19185
|
/**
|
|
19186
19186
|
* Clean up the sandbox container.
|
|
@@ -19394,7 +19394,7 @@ var init_ssh = __esm({
|
|
|
19394
19394
|
/**
|
|
19395
19395
|
* Execute a command on the remote server.
|
|
19396
19396
|
*/
|
|
19397
|
-
async execute(
|
|
19397
|
+
async execute(command3, opts) {
|
|
19398
19398
|
await this.ensureConnected();
|
|
19399
19399
|
const client = this.client;
|
|
19400
19400
|
const timeoutMs = opts?.timeoutMs ?? 3e4;
|
|
@@ -19409,7 +19409,7 @@ var init_ssh = __esm({
|
|
|
19409
19409
|
const envParts = Object.entries(opts.env).map(([k, v]) => `${k}=${escapeShellArg(v)}`).join(" ");
|
|
19410
19410
|
fullCommand += `${envParts} `;
|
|
19411
19411
|
}
|
|
19412
|
-
fullCommand +=
|
|
19412
|
+
fullCommand += command3;
|
|
19413
19413
|
return new Promise((resolve17, reject) => {
|
|
19414
19414
|
let timer2 = null;
|
|
19415
19415
|
let settled = false;
|
|
@@ -19677,11 +19677,11 @@ var init_sandbox = __esm({
|
|
|
19677
19677
|
constructor(workingDir) {
|
|
19678
19678
|
this.workingDir = workingDir ?? process.cwd();
|
|
19679
19679
|
}
|
|
19680
|
-
async execute(
|
|
19680
|
+
async execute(command3, opts) {
|
|
19681
19681
|
const cwd = opts?.cwd ? resolve4(this.workingDir, opts.cwd) : this.workingDir;
|
|
19682
19682
|
const timeoutMs = opts?.timeoutMs ?? 3e4;
|
|
19683
19683
|
return new Promise((resolveP) => {
|
|
19684
|
-
const child = execFile2("sh", ["-c",
|
|
19684
|
+
const child = execFile2("sh", ["-c", command3], {
|
|
19685
19685
|
cwd,
|
|
19686
19686
|
timeout: timeoutMs,
|
|
19687
19687
|
maxBuffer: 1024 * 1024,
|
|
@@ -19735,8 +19735,8 @@ var init_sandbox = __esm({
|
|
|
19735
19735
|
constructor(config2) {
|
|
19736
19736
|
this.sandbox = new DockerSandbox(config2);
|
|
19737
19737
|
}
|
|
19738
|
-
async execute(
|
|
19739
|
-
const result = await this.sandbox.execute("/bin/sh", ["-c",
|
|
19738
|
+
async execute(command3, opts) {
|
|
19739
|
+
const result = await this.sandbox.execute("/bin/sh", ["-c", command3]);
|
|
19740
19740
|
return {
|
|
19741
19741
|
stdout: result.stdout,
|
|
19742
19742
|
stderr: result.stderr,
|
|
@@ -19784,8 +19784,8 @@ var init_sandbox = __esm({
|
|
|
19784
19784
|
constructor(config2) {
|
|
19785
19785
|
this.sandbox = new SSHSandbox(config2);
|
|
19786
19786
|
}
|
|
19787
|
-
async execute(
|
|
19788
|
-
return this.sandbox.execute(
|
|
19787
|
+
async execute(command3, opts) {
|
|
19788
|
+
return this.sandbox.execute(command3, {
|
|
19789
19789
|
cwd: opts?.cwd,
|
|
19790
19790
|
env: opts?.env,
|
|
19791
19791
|
timeoutMs: opts?.timeoutMs
|
|
@@ -19836,7 +19836,7 @@ var init_ssh_executor = __esm({
|
|
|
19836
19836
|
/**
|
|
19837
19837
|
* Execute a command on the remote host via SSH.
|
|
19838
19838
|
*/
|
|
19839
|
-
async execute(
|
|
19839
|
+
async execute(command3, opts) {
|
|
19840
19840
|
const timeoutMs = opts?.timeout ?? this.timeout;
|
|
19841
19841
|
const sshArgs = [
|
|
19842
19842
|
"-o",
|
|
@@ -19856,9 +19856,9 @@ var init_ssh_executor = __esm({
|
|
|
19856
19856
|
sshArgs.push("-i", this.identityFile);
|
|
19857
19857
|
}
|
|
19858
19858
|
sshArgs.push(`${this.user}@${this.host}`);
|
|
19859
|
-
let remoteCmd =
|
|
19859
|
+
let remoteCmd = command3;
|
|
19860
19860
|
if (opts?.cwd) {
|
|
19861
|
-
remoteCmd = `cd ${this.shellEscape(opts.cwd)} && ${
|
|
19861
|
+
remoteCmd = `cd ${this.shellEscape(opts.cwd)} && ${command3}`;
|
|
19862
19862
|
}
|
|
19863
19863
|
if (opts?.env) {
|
|
19864
19864
|
const envPrefix = Object.entries(opts.env).filter(([k]) => !k.match(/SECRET|TOKEN|KEY|PASSWORD/i)).map(([k, v]) => `${k}=${this.shellEscape(v)}`).join(" ");
|
|
@@ -19981,7 +19981,7 @@ var init_k8s_executor = __esm({
|
|
|
19981
19981
|
* Execute a command in an ephemeral Kubernetes pod.
|
|
19982
19982
|
* The pod is automatically removed after completion (--rm).
|
|
19983
19983
|
*/
|
|
19984
|
-
async execute(
|
|
19984
|
+
async execute(command3, opts) {
|
|
19985
19985
|
const timeoutMs = opts?.timeout ?? this.timeout;
|
|
19986
19986
|
const podName = `nestor-exec-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
19987
19987
|
const envVars = opts?.env ? Object.entries(opts.env).filter(([k]) => !k.match(/SECRET|TOKEN|KEY|PASSWORD/i)).map(([k, v]) => ({ name: k, value: v })) : [];
|
|
@@ -19991,7 +19991,7 @@ var init_k8s_executor = __esm({
|
|
|
19991
19991
|
containers: [{
|
|
19992
19992
|
name: "exec",
|
|
19993
19993
|
image: this.image,
|
|
19994
|
-
command: ["sh", "-c",
|
|
19994
|
+
command: ["sh", "-c", command3],
|
|
19995
19995
|
resources: {
|
|
19996
19996
|
limits: {
|
|
19997
19997
|
cpu: this.cpuLimit,
|
|
@@ -20020,7 +20020,7 @@ var init_k8s_executor = __esm({
|
|
|
20020
20020
|
"--",
|
|
20021
20021
|
"sh",
|
|
20022
20022
|
"-c",
|
|
20023
|
-
|
|
20023
|
+
command3
|
|
20024
20024
|
];
|
|
20025
20025
|
try {
|
|
20026
20026
|
const result = await execFileAsync2("kubectl", kubectlArgs, {
|
|
@@ -43823,23 +43823,23 @@ var require_ActionDispatcher = __commonJS({
|
|
|
43823
43823
|
const { modifiers } = source2;
|
|
43824
43824
|
const unmodifiedText = getKeyEventUnmodifiedText(key, source2, isGrapheme);
|
|
43825
43825
|
const text7 = getKeyEventText(code ?? "", source2) ?? unmodifiedText;
|
|
43826
|
-
let
|
|
43826
|
+
let command3;
|
|
43827
43827
|
if (this.#isMacOS && source2.meta) {
|
|
43828
43828
|
switch (code) {
|
|
43829
43829
|
case "KeyA":
|
|
43830
|
-
|
|
43830
|
+
command3 = "SelectAll";
|
|
43831
43831
|
break;
|
|
43832
43832
|
case "KeyC":
|
|
43833
|
-
|
|
43833
|
+
command3 = "Copy";
|
|
43834
43834
|
break;
|
|
43835
43835
|
case "KeyV":
|
|
43836
|
-
|
|
43836
|
+
command3 = source2.shift ? "PasteAndMatchStyle" : "Paste";
|
|
43837
43837
|
break;
|
|
43838
43838
|
case "KeyX":
|
|
43839
|
-
|
|
43839
|
+
command3 = "Cut";
|
|
43840
43840
|
break;
|
|
43841
43841
|
case "KeyZ":
|
|
43842
|
-
|
|
43842
|
+
command3 = source2.shift ? "Redo" : "Undo";
|
|
43843
43843
|
break;
|
|
43844
43844
|
default:
|
|
43845
43845
|
}
|
|
@@ -43857,7 +43857,7 @@ var require_ActionDispatcher = __commonJS({
|
|
|
43857
43857
|
location: location < 3 ? location : void 0,
|
|
43858
43858
|
isKeypad: location === 3,
|
|
43859
43859
|
modifiers,
|
|
43860
|
-
commands:
|
|
43860
|
+
commands: command3 ? [command3] : void 0
|
|
43861
43861
|
})
|
|
43862
43862
|
];
|
|
43863
43863
|
if (key === "Escape") {
|
|
@@ -45825,158 +45825,158 @@ var require_CommandProcessor = __commonJS({
|
|
|
45825
45825
|
this.#sessionProcessor = new SessionProcessor_js_1.SessionProcessor(eventManager, browserCdpClient, initConnection);
|
|
45826
45826
|
this.#storageProcessor = new StorageProcessor_js_1.StorageProcessor(browserCdpClient, browsingContextStorage, logger);
|
|
45827
45827
|
}
|
|
45828
|
-
async #processCommand(
|
|
45829
|
-
switch (
|
|
45828
|
+
async #processCommand(command3) {
|
|
45829
|
+
switch (command3.method) {
|
|
45830
45830
|
// Bluetooth module
|
|
45831
45831
|
// keep-sorted start block=yes
|
|
45832
45832
|
case "bluetooth.handleRequestDevicePrompt":
|
|
45833
|
-
return await this.#bluetoothProcessor.handleRequestDevicePrompt(this.#parser.parseHandleRequestDevicePromptParams(
|
|
45833
|
+
return await this.#bluetoothProcessor.handleRequestDevicePrompt(this.#parser.parseHandleRequestDevicePromptParams(command3.params));
|
|
45834
45834
|
case "bluetooth.simulateAdapter":
|
|
45835
|
-
return await this.#bluetoothProcessor.simulateAdapter(this.#parser.parseSimulateAdapterParameters(
|
|
45835
|
+
return await this.#bluetoothProcessor.simulateAdapter(this.#parser.parseSimulateAdapterParameters(command3.params));
|
|
45836
45836
|
case "bluetooth.simulateAdvertisement":
|
|
45837
|
-
return await this.#bluetoothProcessor.simulateAdvertisement(this.#parser.parseSimulateAdvertisementParameters(
|
|
45837
|
+
return await this.#bluetoothProcessor.simulateAdvertisement(this.#parser.parseSimulateAdvertisementParameters(command3.params));
|
|
45838
45838
|
case "bluetooth.simulatePreconnectedPeripheral":
|
|
45839
|
-
return await this.#bluetoothProcessor.simulatePreconnectedPeripheral(this.#parser.parseSimulatePreconnectedPeripheralParameters(
|
|
45839
|
+
return await this.#bluetoothProcessor.simulatePreconnectedPeripheral(this.#parser.parseSimulatePreconnectedPeripheralParameters(command3.params));
|
|
45840
45840
|
// keep-sorted end
|
|
45841
45841
|
// Browser module
|
|
45842
45842
|
// keep-sorted start block=yes
|
|
45843
45843
|
case "browser.close":
|
|
45844
45844
|
return this.#browserProcessor.close();
|
|
45845
45845
|
case "browser.createUserContext":
|
|
45846
|
-
return await this.#browserProcessor.createUserContext(
|
|
45846
|
+
return await this.#browserProcessor.createUserContext(command3.params);
|
|
45847
45847
|
case "browser.getClientWindows":
|
|
45848
45848
|
return await this.#browserProcessor.getClientWindows();
|
|
45849
45849
|
case "browser.getUserContexts":
|
|
45850
45850
|
return await this.#browserProcessor.getUserContexts();
|
|
45851
45851
|
case "browser.removeUserContext":
|
|
45852
|
-
return await this.#browserProcessor.removeUserContext(this.#parser.parseRemoveUserContextParams(
|
|
45852
|
+
return await this.#browserProcessor.removeUserContext(this.#parser.parseRemoveUserContextParams(command3.params));
|
|
45853
45853
|
case "browser.setClientWindowState":
|
|
45854
|
-
throw new protocol_js_1.UnknownErrorException(`Method ${
|
|
45854
|
+
throw new protocol_js_1.UnknownErrorException(`Method ${command3.method} is not implemented.`);
|
|
45855
45855
|
// keep-sorted end
|
|
45856
45856
|
// Browsing Context module
|
|
45857
45857
|
// keep-sorted start block=yes
|
|
45858
45858
|
case "browsingContext.activate":
|
|
45859
|
-
return await this.#browsingContextProcessor.activate(this.#parser.parseActivateParams(
|
|
45859
|
+
return await this.#browsingContextProcessor.activate(this.#parser.parseActivateParams(command3.params));
|
|
45860
45860
|
case "browsingContext.captureScreenshot":
|
|
45861
|
-
return await this.#browsingContextProcessor.captureScreenshot(this.#parser.parseCaptureScreenshotParams(
|
|
45861
|
+
return await this.#browsingContextProcessor.captureScreenshot(this.#parser.parseCaptureScreenshotParams(command3.params));
|
|
45862
45862
|
case "browsingContext.close":
|
|
45863
|
-
return await this.#browsingContextProcessor.close(this.#parser.parseCloseParams(
|
|
45863
|
+
return await this.#browsingContextProcessor.close(this.#parser.parseCloseParams(command3.params));
|
|
45864
45864
|
case "browsingContext.create":
|
|
45865
|
-
return await this.#browsingContextProcessor.create(this.#parser.parseCreateParams(
|
|
45865
|
+
return await this.#browsingContextProcessor.create(this.#parser.parseCreateParams(command3.params));
|
|
45866
45866
|
case "browsingContext.getTree":
|
|
45867
|
-
return this.#browsingContextProcessor.getTree(this.#parser.parseGetTreeParams(
|
|
45867
|
+
return this.#browsingContextProcessor.getTree(this.#parser.parseGetTreeParams(command3.params));
|
|
45868
45868
|
case "browsingContext.handleUserPrompt":
|
|
45869
|
-
return await this.#browsingContextProcessor.handleUserPrompt(this.#parser.parseHandleUserPromptParams(
|
|
45869
|
+
return await this.#browsingContextProcessor.handleUserPrompt(this.#parser.parseHandleUserPromptParams(command3.params));
|
|
45870
45870
|
case "browsingContext.locateNodes":
|
|
45871
|
-
return await this.#browsingContextProcessor.locateNodes(this.#parser.parseLocateNodesParams(
|
|
45871
|
+
return await this.#browsingContextProcessor.locateNodes(this.#parser.parseLocateNodesParams(command3.params));
|
|
45872
45872
|
case "browsingContext.navigate":
|
|
45873
|
-
return await this.#browsingContextProcessor.navigate(this.#parser.parseNavigateParams(
|
|
45873
|
+
return await this.#browsingContextProcessor.navigate(this.#parser.parseNavigateParams(command3.params));
|
|
45874
45874
|
case "browsingContext.print":
|
|
45875
|
-
return await this.#browsingContextProcessor.print(this.#parser.parsePrintParams(
|
|
45875
|
+
return await this.#browsingContextProcessor.print(this.#parser.parsePrintParams(command3.params));
|
|
45876
45876
|
case "browsingContext.reload":
|
|
45877
|
-
return await this.#browsingContextProcessor.reload(this.#parser.parseReloadParams(
|
|
45877
|
+
return await this.#browsingContextProcessor.reload(this.#parser.parseReloadParams(command3.params));
|
|
45878
45878
|
case "browsingContext.setViewport":
|
|
45879
|
-
return await this.#browsingContextProcessor.setViewport(this.#parser.parseSetViewportParams(
|
|
45879
|
+
return await this.#browsingContextProcessor.setViewport(this.#parser.parseSetViewportParams(command3.params));
|
|
45880
45880
|
case "browsingContext.traverseHistory":
|
|
45881
|
-
return await this.#browsingContextProcessor.traverseHistory(this.#parser.parseTraverseHistoryParams(
|
|
45881
|
+
return await this.#browsingContextProcessor.traverseHistory(this.#parser.parseTraverseHistoryParams(command3.params));
|
|
45882
45882
|
// keep-sorted end
|
|
45883
45883
|
// CDP module
|
|
45884
45884
|
// keep-sorted start block=yes
|
|
45885
45885
|
case "goog:cdp.getSession":
|
|
45886
|
-
return this.#cdpProcessor.getSession(this.#parser.parseGetSessionParams(
|
|
45886
|
+
return this.#cdpProcessor.getSession(this.#parser.parseGetSessionParams(command3.params));
|
|
45887
45887
|
case "goog:cdp.resolveRealm":
|
|
45888
|
-
return this.#cdpProcessor.resolveRealm(this.#parser.parseResolveRealmParams(
|
|
45888
|
+
return this.#cdpProcessor.resolveRealm(this.#parser.parseResolveRealmParams(command3.params));
|
|
45889
45889
|
case "goog:cdp.sendCommand":
|
|
45890
|
-
return await this.#cdpProcessor.sendCommand(this.#parser.parseSendCommandParams(
|
|
45890
|
+
return await this.#cdpProcessor.sendCommand(this.#parser.parseSendCommandParams(command3.params));
|
|
45891
45891
|
// keep-sorted end
|
|
45892
45892
|
// CDP deprecated domain.
|
|
45893
45893
|
// https://github.com/GoogleChromeLabs/chromium-bidi/issues/2844
|
|
45894
45894
|
// keep-sorted start block=yes
|
|
45895
45895
|
case "cdp.getSession":
|
|
45896
|
-
return this.#cdpProcessor.getSession(this.#parser.parseGetSessionParams(
|
|
45896
|
+
return this.#cdpProcessor.getSession(this.#parser.parseGetSessionParams(command3.params));
|
|
45897
45897
|
case "cdp.resolveRealm":
|
|
45898
|
-
return this.#cdpProcessor.resolveRealm(this.#parser.parseResolveRealmParams(
|
|
45898
|
+
return this.#cdpProcessor.resolveRealm(this.#parser.parseResolveRealmParams(command3.params));
|
|
45899
45899
|
case "cdp.sendCommand":
|
|
45900
|
-
return await this.#cdpProcessor.sendCommand(this.#parser.parseSendCommandParams(
|
|
45900
|
+
return await this.#cdpProcessor.sendCommand(this.#parser.parseSendCommandParams(command3.params));
|
|
45901
45901
|
// keep-sorted end
|
|
45902
45902
|
// Input module
|
|
45903
45903
|
// keep-sorted start block=yes
|
|
45904
45904
|
case "input.performActions":
|
|
45905
|
-
return await this.#inputProcessor.performActions(this.#parser.parsePerformActionsParams(
|
|
45905
|
+
return await this.#inputProcessor.performActions(this.#parser.parsePerformActionsParams(command3.params));
|
|
45906
45906
|
case "input.releaseActions":
|
|
45907
|
-
return await this.#inputProcessor.releaseActions(this.#parser.parseReleaseActionsParams(
|
|
45907
|
+
return await this.#inputProcessor.releaseActions(this.#parser.parseReleaseActionsParams(command3.params));
|
|
45908
45908
|
case "input.setFiles":
|
|
45909
|
-
return await this.#inputProcessor.setFiles(this.#parser.parseSetFilesParams(
|
|
45909
|
+
return await this.#inputProcessor.setFiles(this.#parser.parseSetFilesParams(command3.params));
|
|
45910
45910
|
// keep-sorted end
|
|
45911
45911
|
// Network module
|
|
45912
45912
|
// keep-sorted start block=yes
|
|
45913
45913
|
case "network.addIntercept":
|
|
45914
|
-
return await this.#networkProcessor.addIntercept(this.#parser.parseAddInterceptParams(
|
|
45914
|
+
return await this.#networkProcessor.addIntercept(this.#parser.parseAddInterceptParams(command3.params));
|
|
45915
45915
|
case "network.continueRequest":
|
|
45916
|
-
return await this.#networkProcessor.continueRequest(this.#parser.parseContinueRequestParams(
|
|
45916
|
+
return await this.#networkProcessor.continueRequest(this.#parser.parseContinueRequestParams(command3.params));
|
|
45917
45917
|
case "network.continueResponse":
|
|
45918
|
-
return await this.#networkProcessor.continueResponse(this.#parser.parseContinueResponseParams(
|
|
45918
|
+
return await this.#networkProcessor.continueResponse(this.#parser.parseContinueResponseParams(command3.params));
|
|
45919
45919
|
case "network.continueWithAuth":
|
|
45920
|
-
return await this.#networkProcessor.continueWithAuth(this.#parser.parseContinueWithAuthParams(
|
|
45920
|
+
return await this.#networkProcessor.continueWithAuth(this.#parser.parseContinueWithAuthParams(command3.params));
|
|
45921
45921
|
case "network.failRequest":
|
|
45922
|
-
return await this.#networkProcessor.failRequest(this.#parser.parseFailRequestParams(
|
|
45922
|
+
return await this.#networkProcessor.failRequest(this.#parser.parseFailRequestParams(command3.params));
|
|
45923
45923
|
case "network.provideResponse":
|
|
45924
|
-
return await this.#networkProcessor.provideResponse(this.#parser.parseProvideResponseParams(
|
|
45924
|
+
return await this.#networkProcessor.provideResponse(this.#parser.parseProvideResponseParams(command3.params));
|
|
45925
45925
|
case "network.removeIntercept":
|
|
45926
|
-
return await this.#networkProcessor.removeIntercept(this.#parser.parseRemoveInterceptParams(
|
|
45926
|
+
return await this.#networkProcessor.removeIntercept(this.#parser.parseRemoveInterceptParams(command3.params));
|
|
45927
45927
|
case "network.setCacheBehavior":
|
|
45928
|
-
return await this.#networkProcessor.setCacheBehavior(this.#parser.parseSetCacheBehavior(
|
|
45928
|
+
return await this.#networkProcessor.setCacheBehavior(this.#parser.parseSetCacheBehavior(command3.params));
|
|
45929
45929
|
// keep-sorted end
|
|
45930
45930
|
// Permissions module
|
|
45931
45931
|
// keep-sorted start block=yes
|
|
45932
45932
|
case "permissions.setPermission":
|
|
45933
|
-
return await this.#permissionsProcessor.setPermissions(this.#parser.parseSetPermissionsParams(
|
|
45933
|
+
return await this.#permissionsProcessor.setPermissions(this.#parser.parseSetPermissionsParams(command3.params));
|
|
45934
45934
|
// keep-sorted end
|
|
45935
45935
|
// Script module
|
|
45936
45936
|
// keep-sorted start block=yes
|
|
45937
45937
|
case "script.addPreloadScript":
|
|
45938
|
-
return await this.#scriptProcessor.addPreloadScript(this.#parser.parseAddPreloadScriptParams(
|
|
45938
|
+
return await this.#scriptProcessor.addPreloadScript(this.#parser.parseAddPreloadScriptParams(command3.params));
|
|
45939
45939
|
case "script.callFunction":
|
|
45940
|
-
return await this.#scriptProcessor.callFunction(this.#parser.parseCallFunctionParams(this.#processTargetParams(
|
|
45940
|
+
return await this.#scriptProcessor.callFunction(this.#parser.parseCallFunctionParams(this.#processTargetParams(command3.params)));
|
|
45941
45941
|
case "script.disown":
|
|
45942
|
-
return await this.#scriptProcessor.disown(this.#parser.parseDisownParams(this.#processTargetParams(
|
|
45942
|
+
return await this.#scriptProcessor.disown(this.#parser.parseDisownParams(this.#processTargetParams(command3.params)));
|
|
45943
45943
|
case "script.evaluate":
|
|
45944
|
-
return await this.#scriptProcessor.evaluate(this.#parser.parseEvaluateParams(this.#processTargetParams(
|
|
45944
|
+
return await this.#scriptProcessor.evaluate(this.#parser.parseEvaluateParams(this.#processTargetParams(command3.params)));
|
|
45945
45945
|
case "script.getRealms":
|
|
45946
|
-
return this.#scriptProcessor.getRealms(this.#parser.parseGetRealmsParams(
|
|
45946
|
+
return this.#scriptProcessor.getRealms(this.#parser.parseGetRealmsParams(command3.params));
|
|
45947
45947
|
case "script.removePreloadScript":
|
|
45948
|
-
return await this.#scriptProcessor.removePreloadScript(this.#parser.parseRemovePreloadScriptParams(
|
|
45948
|
+
return await this.#scriptProcessor.removePreloadScript(this.#parser.parseRemovePreloadScriptParams(command3.params));
|
|
45949
45949
|
// keep-sorted end
|
|
45950
45950
|
// Session module
|
|
45951
45951
|
// keep-sorted start block=yes
|
|
45952
45952
|
case "session.end":
|
|
45953
|
-
throw new protocol_js_1.UnknownErrorException(`Method ${
|
|
45953
|
+
throw new protocol_js_1.UnknownErrorException(`Method ${command3.method} is not implemented.`);
|
|
45954
45954
|
case "session.new":
|
|
45955
|
-
return await this.#sessionProcessor.new(
|
|
45955
|
+
return await this.#sessionProcessor.new(command3.params);
|
|
45956
45956
|
case "session.status":
|
|
45957
45957
|
return this.#sessionProcessor.status();
|
|
45958
45958
|
case "session.subscribe":
|
|
45959
|
-
return await this.#sessionProcessor.subscribe(this.#parser.parseSubscribeParams(
|
|
45959
|
+
return await this.#sessionProcessor.subscribe(this.#parser.parseSubscribeParams(command3.params), command3.channel);
|
|
45960
45960
|
case "session.unsubscribe":
|
|
45961
|
-
return await this.#sessionProcessor.unsubscribe(this.#parser.parseSubscribeParams(
|
|
45961
|
+
return await this.#sessionProcessor.unsubscribe(this.#parser.parseSubscribeParams(command3.params), command3.channel);
|
|
45962
45962
|
// keep-sorted end
|
|
45963
45963
|
// Storage module
|
|
45964
45964
|
// keep-sorted start block=yes
|
|
45965
45965
|
case "storage.deleteCookies":
|
|
45966
|
-
return await this.#storageProcessor.deleteCookies(this.#parser.parseDeleteCookiesParams(
|
|
45966
|
+
return await this.#storageProcessor.deleteCookies(this.#parser.parseDeleteCookiesParams(command3.params));
|
|
45967
45967
|
case "storage.getCookies":
|
|
45968
|
-
return await this.#storageProcessor.getCookies(this.#parser.parseGetCookiesParams(
|
|
45968
|
+
return await this.#storageProcessor.getCookies(this.#parser.parseGetCookiesParams(command3.params));
|
|
45969
45969
|
case "storage.setCookie":
|
|
45970
|
-
return await this.#storageProcessor.setCookie(this.#parser.parseSetCookieParams(
|
|
45970
|
+
return await this.#storageProcessor.setCookie(this.#parser.parseSetCookieParams(command3.params));
|
|
45971
45971
|
// keep-sorted end
|
|
45972
45972
|
// WebExtension module
|
|
45973
45973
|
// keep-sorted start block=yes
|
|
45974
45974
|
case "webExtension.install":
|
|
45975
|
-
throw new protocol_js_1.UnknownErrorException(`Method ${
|
|
45975
|
+
throw new protocol_js_1.UnknownErrorException(`Method ${command3.method} is not implemented.`);
|
|
45976
45976
|
case "webExtension.uninstall":
|
|
45977
|
-
throw new protocol_js_1.UnknownErrorException(`Method ${
|
|
45977
|
+
throw new protocol_js_1.UnknownErrorException(`Method ${command3.method} is not implemented.`);
|
|
45978
45978
|
}
|
|
45979
|
-
throw new protocol_js_1.UnknownCommandException(`Unknown command '${
|
|
45979
|
+
throw new protocol_js_1.UnknownCommandException(`Unknown command '${command3?.method}'.`);
|
|
45980
45980
|
}
|
|
45981
45981
|
// Workaround for as zod.union always take the first schema
|
|
45982
45982
|
// https://github.com/w3c/webdriver-bidi/issues/635
|
|
@@ -45986,30 +45986,30 @@ var require_CommandProcessor = __commonJS({
|
|
|
45986
45986
|
}
|
|
45987
45987
|
return params;
|
|
45988
45988
|
}
|
|
45989
|
-
async processCommand(
|
|
45989
|
+
async processCommand(command3) {
|
|
45990
45990
|
try {
|
|
45991
|
-
const result = await this.#processCommand(
|
|
45991
|
+
const result = await this.#processCommand(command3);
|
|
45992
45992
|
const response = {
|
|
45993
45993
|
type: "success",
|
|
45994
|
-
id:
|
|
45994
|
+
id: command3.id,
|
|
45995
45995
|
result
|
|
45996
45996
|
};
|
|
45997
45997
|
this.emit("response", {
|
|
45998
|
-
message: OutgoingMessage_js_1.OutgoingMessage.createResolved(response,
|
|
45999
|
-
event:
|
|
45998
|
+
message: OutgoingMessage_js_1.OutgoingMessage.createResolved(response, command3.channel),
|
|
45999
|
+
event: command3.method
|
|
46000
46000
|
});
|
|
46001
46001
|
} catch (e) {
|
|
46002
46002
|
if (e instanceof protocol_js_1.Exception) {
|
|
46003
46003
|
this.emit("response", {
|
|
46004
|
-
message: OutgoingMessage_js_1.OutgoingMessage.createResolved(e.toErrorResponse(
|
|
46005
|
-
event:
|
|
46004
|
+
message: OutgoingMessage_js_1.OutgoingMessage.createResolved(e.toErrorResponse(command3.id), command3.channel),
|
|
46005
|
+
event: command3.method
|
|
46006
46006
|
});
|
|
46007
46007
|
} else {
|
|
46008
46008
|
const error = e;
|
|
46009
46009
|
this.#logger?.(log_js_1.LogType.bidi, error);
|
|
46010
46010
|
this.emit("response", {
|
|
46011
|
-
message: OutgoingMessage_js_1.OutgoingMessage.createResolved(new protocol_js_1.UnknownErrorException(error.message, error.stack).toErrorResponse(
|
|
46012
|
-
event:
|
|
46011
|
+
message: OutgoingMessage_js_1.OutgoingMessage.createResolved(new protocol_js_1.UnknownErrorException(error.message, error.stack).toErrorResponse(command3.id), command3.channel),
|
|
46012
|
+
event: command3.method
|
|
46013
46013
|
});
|
|
46014
46014
|
}
|
|
46015
46015
|
}
|
|
@@ -65818,18 +65818,18 @@ var require_FtpContext = __commonJS({
|
|
|
65818
65818
|
/**
|
|
65819
65819
|
* Send an FTP command without waiting for or handling the result.
|
|
65820
65820
|
*/
|
|
65821
|
-
send(
|
|
65822
|
-
const containsPassword =
|
|
65823
|
-
const message = containsPassword ? "> PASS ###" : `> ${
|
|
65821
|
+
send(command3) {
|
|
65822
|
+
const containsPassword = command3.startsWith("PASS");
|
|
65823
|
+
const message = containsPassword ? "> PASS ###" : `> ${command3}`;
|
|
65824
65824
|
this.log(message);
|
|
65825
|
-
this._socket.write(
|
|
65825
|
+
this._socket.write(command3 + "\r\n", this.encoding);
|
|
65826
65826
|
}
|
|
65827
65827
|
/**
|
|
65828
65828
|
* Send an FTP command and handle the first response. Use this if you have a simple
|
|
65829
65829
|
* request-response situation.
|
|
65830
65830
|
*/
|
|
65831
|
-
request(
|
|
65832
|
-
return this.handle(
|
|
65831
|
+
request(command3) {
|
|
65832
|
+
return this.handle(command3, (res, task) => {
|
|
65833
65833
|
if (res instanceof Error) {
|
|
65834
65834
|
task.reject(res);
|
|
65835
65835
|
} else {
|
|
@@ -65841,7 +65841,7 @@ var require_FtpContext = __commonJS({
|
|
|
65841
65841
|
* Send an FTP command and handle any response until you resolve/reject. Use this if you expect multiple responses
|
|
65842
65842
|
* to a request. This returns a Promise that will hold whatever the response handler passed on when resolving/rejecting its task.
|
|
65843
65843
|
*/
|
|
65844
|
-
handle(
|
|
65844
|
+
handle(command3, responseHandler) {
|
|
65845
65845
|
if (this._task) {
|
|
65846
65846
|
const err = new Error("User launched a task while another one is still running. Forgot to use 'await' or '.then()'?");
|
|
65847
65847
|
err.stack += `
|
|
@@ -65872,8 +65872,8 @@ Closing reason: ${this._closingError.stack}`;
|
|
|
65872
65872
|
return;
|
|
65873
65873
|
}
|
|
65874
65874
|
this.socket.setTimeout(this.timeout);
|
|
65875
|
-
if (
|
|
65876
|
-
this.send(
|
|
65875
|
+
if (command3) {
|
|
65876
|
+
this.send(command3);
|
|
65877
65877
|
}
|
|
65878
65878
|
});
|
|
65879
65879
|
}
|
|
@@ -66932,20 +66932,20 @@ var require_Client = __commonJS({
|
|
|
66932
66932
|
/**
|
|
66933
66933
|
* Send an FTP command and handle the first response.
|
|
66934
66934
|
*/
|
|
66935
|
-
send(
|
|
66935
|
+
send(command3, ignoreErrorCodesDEPRECATED = false) {
|
|
66936
66936
|
if (ignoreErrorCodesDEPRECATED) {
|
|
66937
66937
|
this.ftp.log("Deprecated call using send(command, flag) with boolean flag to ignore errors. Use sendIgnoringError(command).");
|
|
66938
|
-
return this.sendIgnoringError(
|
|
66938
|
+
return this.sendIgnoringError(command3);
|
|
66939
66939
|
}
|
|
66940
|
-
return this.ftp.request(
|
|
66940
|
+
return this.ftp.request(command3);
|
|
66941
66941
|
}
|
|
66942
66942
|
/**
|
|
66943
66943
|
* Send an FTP command and ignore an FTP error response. Any other kind of error or timeout will still reject the Promise.
|
|
66944
66944
|
*
|
|
66945
66945
|
* @param command
|
|
66946
66946
|
*/
|
|
66947
|
-
sendIgnoringError(
|
|
66948
|
-
return this.ftp.handle(
|
|
66947
|
+
sendIgnoringError(command3) {
|
|
66948
|
+
return this.ftp.handle(command3, (res, task) => {
|
|
66949
66949
|
if (res instanceof FtpContext_1.FTPError) {
|
|
66950
66950
|
task.resolve({ code: res.code, message: res.message });
|
|
66951
66951
|
} else if (res instanceof Error) {
|
|
@@ -66961,8 +66961,8 @@ var require_Client = __commonJS({
|
|
|
66961
66961
|
* @param options TLS options as in `tls.connect(options)`, optional.
|
|
66962
66962
|
* @param command Set the authentication command. Optional, default is "AUTH TLS".
|
|
66963
66963
|
*/
|
|
66964
|
-
async useTLS(options = {},
|
|
66965
|
-
const ret = await this.send(
|
|
66964
|
+
async useTLS(options = {}, command3 = "AUTH TLS") {
|
|
66965
|
+
const ret = await this.send(command3);
|
|
66966
66966
|
this.ftp.socket = await (0, netUtils_1.upgradeSocket)(this.ftp.socket, options);
|
|
66967
66967
|
this.ftp.tlsOptions = options;
|
|
66968
66968
|
this.ftp.log(`Control socket is using: ${(0, netUtils_1.describeTLS)(this.ftp.socket)}`);
|
|
@@ -67096,11 +67096,11 @@ var require_Client = __commonJS({
|
|
|
67096
67096
|
*/
|
|
67097
67097
|
async size(path30) {
|
|
67098
67098
|
const validPath = await this.protectWhitespace(path30);
|
|
67099
|
-
const
|
|
67100
|
-
const res = await this.send(
|
|
67099
|
+
const command3 = `SIZE ${validPath}`;
|
|
67100
|
+
const res = await this.send(command3);
|
|
67101
67101
|
const size = parseInt(res.message.slice(4), 10);
|
|
67102
67102
|
if (Number.isNaN(size)) {
|
|
67103
|
-
throw new Error(`Can't parse response to command '${
|
|
67103
|
+
throw new Error(`Can't parse response to command '${command3}' as a numerical value: ${res.message}`);
|
|
67104
67104
|
}
|
|
67105
67105
|
return size;
|
|
67106
67106
|
}
|
|
@@ -67163,16 +67163,16 @@ var require_Client = __commonJS({
|
|
|
67163
67163
|
/**
|
|
67164
67164
|
* @protected
|
|
67165
67165
|
*/
|
|
67166
|
-
async _uploadWithCommand(source2, remotePath,
|
|
67166
|
+
async _uploadWithCommand(source2, remotePath, command3, options) {
|
|
67167
67167
|
if (typeof source2 === "string") {
|
|
67168
|
-
return this._uploadLocalFile(source2, remotePath,
|
|
67168
|
+
return this._uploadLocalFile(source2, remotePath, command3, options);
|
|
67169
67169
|
}
|
|
67170
|
-
return this._uploadFromStream(source2, remotePath,
|
|
67170
|
+
return this._uploadFromStream(source2, remotePath, command3);
|
|
67171
67171
|
}
|
|
67172
67172
|
/**
|
|
67173
67173
|
* @protected
|
|
67174
67174
|
*/
|
|
67175
|
-
async _uploadLocalFile(localPath, remotePath,
|
|
67175
|
+
async _uploadLocalFile(localPath, remotePath, command3, options) {
|
|
67176
67176
|
const fd = await fsOpen(localPath, "r");
|
|
67177
67177
|
const source2 = (0, fs_1.createReadStream)("", {
|
|
67178
67178
|
fd,
|
|
@@ -67181,7 +67181,7 @@ var require_Client = __commonJS({
|
|
|
67181
67181
|
autoClose: false
|
|
67182
67182
|
});
|
|
67183
67183
|
try {
|
|
67184
|
-
return await this._uploadFromStream(source2, remotePath,
|
|
67184
|
+
return await this._uploadFromStream(source2, remotePath, command3);
|
|
67185
67185
|
} finally {
|
|
67186
67186
|
await ignoreError(() => fsClose(fd));
|
|
67187
67187
|
}
|
|
@@ -67189,7 +67189,7 @@ var require_Client = __commonJS({
|
|
|
67189
67189
|
/**
|
|
67190
67190
|
* @protected
|
|
67191
67191
|
*/
|
|
67192
|
-
async _uploadFromStream(source2, remotePath,
|
|
67192
|
+
async _uploadFromStream(source2, remotePath, command3) {
|
|
67193
67193
|
const onError = (err) => this.ftp.closeWithError(err);
|
|
67194
67194
|
source2.once("error", onError);
|
|
67195
67195
|
try {
|
|
@@ -67198,7 +67198,7 @@ var require_Client = __commonJS({
|
|
|
67198
67198
|
return await (0, transfer_1.uploadFrom)(source2, {
|
|
67199
67199
|
ftp: this.ftp,
|
|
67200
67200
|
tracker: this._progressTracker,
|
|
67201
|
-
command:
|
|
67201
|
+
command: command3,
|
|
67202
67202
|
remotePath: validPath,
|
|
67203
67203
|
type: "upload"
|
|
67204
67204
|
});
|
|
@@ -67281,10 +67281,10 @@ var require_Client = __commonJS({
|
|
|
67281
67281
|
const validPath = await this.protectWhitespace(path30);
|
|
67282
67282
|
let lastError;
|
|
67283
67283
|
for (const candidate of this.availableListCommands) {
|
|
67284
|
-
const
|
|
67284
|
+
const command3 = validPath === "" ? candidate : `${candidate} ${validPath}`;
|
|
67285
67285
|
await this.prepareTransfer(this.ftp);
|
|
67286
67286
|
try {
|
|
67287
|
-
const parsedList = await this._requestListWithCommand(
|
|
67287
|
+
const parsedList = await this._requestListWithCommand(command3);
|
|
67288
67288
|
this.availableListCommands = [candidate];
|
|
67289
67289
|
return parsedList;
|
|
67290
67290
|
} catch (err) {
|
|
@@ -67300,12 +67300,12 @@ var require_Client = __commonJS({
|
|
|
67300
67300
|
/**
|
|
67301
67301
|
* @protected
|
|
67302
67302
|
*/
|
|
67303
|
-
async _requestListWithCommand(
|
|
67303
|
+
async _requestListWithCommand(command3) {
|
|
67304
67304
|
const buffer = new StringWriter_1.StringWriter();
|
|
67305
67305
|
await (0, transfer_1.downloadTo)(buffer, {
|
|
67306
67306
|
ftp: this.ftp,
|
|
67307
67307
|
tracker: this._progressTracker,
|
|
67308
|
-
command:
|
|
67308
|
+
command: command3,
|
|
67309
67309
|
remotePath: "",
|
|
67310
67310
|
type: "list"
|
|
67311
67311
|
});
|
|
@@ -69075,7 +69075,7 @@ var require_util2 = __commonJS({
|
|
|
69075
69075
|
return path30;
|
|
69076
69076
|
}
|
|
69077
69077
|
exports2.normalize = normalize3;
|
|
69078
|
-
function
|
|
69078
|
+
function join24(aRoot, aPath) {
|
|
69079
69079
|
if (aRoot === "") {
|
|
69080
69080
|
aRoot = ".";
|
|
69081
69081
|
}
|
|
@@ -69107,7 +69107,7 @@ var require_util2 = __commonJS({
|
|
|
69107
69107
|
}
|
|
69108
69108
|
return joined;
|
|
69109
69109
|
}
|
|
69110
|
-
exports2.join =
|
|
69110
|
+
exports2.join = join24;
|
|
69111
69111
|
exports2.isAbsolute = function(aPath) {
|
|
69112
69112
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
69113
69113
|
};
|
|
@@ -69280,7 +69280,7 @@ var require_util2 = __commonJS({
|
|
|
69280
69280
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
69281
69281
|
}
|
|
69282
69282
|
}
|
|
69283
|
-
sourceURL =
|
|
69283
|
+
sourceURL = join24(urlGenerate(parsed), sourceURL);
|
|
69284
69284
|
}
|
|
69285
69285
|
return normalize3(sourceURL);
|
|
69286
69286
|
}
|
|
@@ -71082,7 +71082,7 @@ var require_escodegen = __commonJS({
|
|
|
71082
71082
|
function noEmptySpace() {
|
|
71083
71083
|
return space ? space : " ";
|
|
71084
71084
|
}
|
|
71085
|
-
function
|
|
71085
|
+
function join24(left2, right2) {
|
|
71086
71086
|
var leftSource, rightSource, leftCharCode, rightCharCode;
|
|
71087
71087
|
leftSource = toSourceNodeWhenNeeded(left2).toString();
|
|
71088
71088
|
if (leftSource.length === 0) {
|
|
@@ -71413,8 +71413,8 @@ var require_escodegen = __commonJS({
|
|
|
71413
71413
|
} else {
|
|
71414
71414
|
result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT));
|
|
71415
71415
|
}
|
|
71416
|
-
result =
|
|
71417
|
-
result = [
|
|
71416
|
+
result = join24(result, operator);
|
|
71417
|
+
result = [join24(
|
|
71418
71418
|
result,
|
|
71419
71419
|
that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)
|
|
71420
71420
|
), ")"];
|
|
@@ -71557,11 +71557,11 @@ var require_escodegen = __commonJS({
|
|
|
71557
71557
|
var result, fragment;
|
|
71558
71558
|
result = ["class"];
|
|
71559
71559
|
if (stmt.id) {
|
|
71560
|
-
result =
|
|
71560
|
+
result = join24(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
|
|
71561
71561
|
}
|
|
71562
71562
|
if (stmt.superClass) {
|
|
71563
|
-
fragment =
|
|
71564
|
-
result =
|
|
71563
|
+
fragment = join24("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
|
|
71564
|
+
result = join24(result, fragment);
|
|
71565
71565
|
}
|
|
71566
71566
|
result.push(space);
|
|
71567
71567
|
result.push(this.generateStatement(stmt.body, S_TFFT));
|
|
@@ -71574,9 +71574,9 @@ var require_escodegen = __commonJS({
|
|
|
71574
71574
|
return escapeDirective(stmt.directive) + this.semicolon(flags);
|
|
71575
71575
|
},
|
|
71576
71576
|
DoWhileStatement: function(stmt, flags) {
|
|
71577
|
-
var result =
|
|
71577
|
+
var result = join24("do", this.maybeBlock(stmt.body, S_TFFF));
|
|
71578
71578
|
result = this.maybeBlockSuffix(stmt.body, result);
|
|
71579
|
-
return
|
|
71579
|
+
return join24(result, [
|
|
71580
71580
|
"while" + space + "(",
|
|
71581
71581
|
this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
71582
71582
|
")" + this.semicolon(flags)
|
|
@@ -71612,11 +71612,11 @@ var require_escodegen = __commonJS({
|
|
|
71612
71612
|
ExportDefaultDeclaration: function(stmt, flags) {
|
|
71613
71613
|
var result = ["export"], bodyFlags;
|
|
71614
71614
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
71615
|
-
result =
|
|
71615
|
+
result = join24(result, "default");
|
|
71616
71616
|
if (isStatement(stmt.declaration)) {
|
|
71617
|
-
result =
|
|
71617
|
+
result = join24(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
71618
71618
|
} else {
|
|
71619
|
-
result =
|
|
71619
|
+
result = join24(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
|
|
71620
71620
|
}
|
|
71621
71621
|
return result;
|
|
71622
71622
|
},
|
|
@@ -71624,15 +71624,15 @@ var require_escodegen = __commonJS({
|
|
|
71624
71624
|
var result = ["export"], bodyFlags, that = this;
|
|
71625
71625
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
71626
71626
|
if (stmt.declaration) {
|
|
71627
|
-
return
|
|
71627
|
+
return join24(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
71628
71628
|
}
|
|
71629
71629
|
if (stmt.specifiers) {
|
|
71630
71630
|
if (stmt.specifiers.length === 0) {
|
|
71631
|
-
result =
|
|
71631
|
+
result = join24(result, "{" + space + "}");
|
|
71632
71632
|
} else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) {
|
|
71633
|
-
result =
|
|
71633
|
+
result = join24(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
|
|
71634
71634
|
} else {
|
|
71635
|
-
result =
|
|
71635
|
+
result = join24(result, "{");
|
|
71636
71636
|
withIndent(function(indent2) {
|
|
71637
71637
|
var i, iz;
|
|
71638
71638
|
result.push(newline);
|
|
@@ -71650,7 +71650,7 @@ var require_escodegen = __commonJS({
|
|
|
71650
71650
|
result.push(base + "}");
|
|
71651
71651
|
}
|
|
71652
71652
|
if (stmt.source) {
|
|
71653
|
-
result =
|
|
71653
|
+
result = join24(result, [
|
|
71654
71654
|
"from" + space,
|
|
71655
71655
|
// ModuleSpecifier
|
|
71656
71656
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
@@ -71738,7 +71738,7 @@ var require_escodegen = __commonJS({
|
|
|
71738
71738
|
];
|
|
71739
71739
|
cursor = 0;
|
|
71740
71740
|
if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) {
|
|
71741
|
-
result =
|
|
71741
|
+
result = join24(result, [
|
|
71742
71742
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
71743
71743
|
]);
|
|
71744
71744
|
++cursor;
|
|
@@ -71748,7 +71748,7 @@ var require_escodegen = __commonJS({
|
|
|
71748
71748
|
result.push(",");
|
|
71749
71749
|
}
|
|
71750
71750
|
if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) {
|
|
71751
|
-
result =
|
|
71751
|
+
result = join24(result, [
|
|
71752
71752
|
space,
|
|
71753
71753
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
71754
71754
|
]);
|
|
@@ -71777,7 +71777,7 @@ var require_escodegen = __commonJS({
|
|
|
71777
71777
|
}
|
|
71778
71778
|
}
|
|
71779
71779
|
}
|
|
71780
|
-
result =
|
|
71780
|
+
result = join24(result, [
|
|
71781
71781
|
"from" + space,
|
|
71782
71782
|
// ModuleSpecifier
|
|
71783
71783
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
@@ -71831,7 +71831,7 @@ var require_escodegen = __commonJS({
|
|
|
71831
71831
|
return result;
|
|
71832
71832
|
},
|
|
71833
71833
|
ThrowStatement: function(stmt, flags) {
|
|
71834
|
-
return [
|
|
71834
|
+
return [join24(
|
|
71835
71835
|
"throw",
|
|
71836
71836
|
this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)
|
|
71837
71837
|
), this.semicolon(flags)];
|
|
@@ -71842,7 +71842,7 @@ var require_escodegen = __commonJS({
|
|
|
71842
71842
|
result = this.maybeBlockSuffix(stmt.block, result);
|
|
71843
71843
|
if (stmt.handlers) {
|
|
71844
71844
|
for (i = 0, iz = stmt.handlers.length; i < iz; ++i) {
|
|
71845
|
-
result =
|
|
71845
|
+
result = join24(result, this.generateStatement(stmt.handlers[i], S_TFFF));
|
|
71846
71846
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
71847
71847
|
result = this.maybeBlockSuffix(stmt.handlers[i].body, result);
|
|
71848
71848
|
}
|
|
@@ -71850,7 +71850,7 @@ var require_escodegen = __commonJS({
|
|
|
71850
71850
|
} else {
|
|
71851
71851
|
guardedHandlers = stmt.guardedHandlers || [];
|
|
71852
71852
|
for (i = 0, iz = guardedHandlers.length; i < iz; ++i) {
|
|
71853
|
-
result =
|
|
71853
|
+
result = join24(result, this.generateStatement(guardedHandlers[i], S_TFFF));
|
|
71854
71854
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
71855
71855
|
result = this.maybeBlockSuffix(guardedHandlers[i].body, result);
|
|
71856
71856
|
}
|
|
@@ -71858,13 +71858,13 @@ var require_escodegen = __commonJS({
|
|
|
71858
71858
|
if (stmt.handler) {
|
|
71859
71859
|
if (Array.isArray(stmt.handler)) {
|
|
71860
71860
|
for (i = 0, iz = stmt.handler.length; i < iz; ++i) {
|
|
71861
|
-
result =
|
|
71861
|
+
result = join24(result, this.generateStatement(stmt.handler[i], S_TFFF));
|
|
71862
71862
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
71863
71863
|
result = this.maybeBlockSuffix(stmt.handler[i].body, result);
|
|
71864
71864
|
}
|
|
71865
71865
|
}
|
|
71866
71866
|
} else {
|
|
71867
|
-
result =
|
|
71867
|
+
result = join24(result, this.generateStatement(stmt.handler, S_TFFF));
|
|
71868
71868
|
if (stmt.finalizer) {
|
|
71869
71869
|
result = this.maybeBlockSuffix(stmt.handler.body, result);
|
|
71870
71870
|
}
|
|
@@ -71872,7 +71872,7 @@ var require_escodegen = __commonJS({
|
|
|
71872
71872
|
}
|
|
71873
71873
|
}
|
|
71874
71874
|
if (stmt.finalizer) {
|
|
71875
|
-
result =
|
|
71875
|
+
result = join24(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
|
|
71876
71876
|
}
|
|
71877
71877
|
return result;
|
|
71878
71878
|
},
|
|
@@ -71906,7 +71906,7 @@ var require_escodegen = __commonJS({
|
|
|
71906
71906
|
withIndent(function() {
|
|
71907
71907
|
if (stmt.test) {
|
|
71908
71908
|
result = [
|
|
71909
|
-
|
|
71909
|
+
join24("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
|
|
71910
71910
|
":"
|
|
71911
71911
|
];
|
|
71912
71912
|
} else {
|
|
@@ -71954,9 +71954,9 @@ var require_escodegen = __commonJS({
|
|
|
71954
71954
|
result.push(this.maybeBlock(stmt.consequent, S_TFFF));
|
|
71955
71955
|
result = this.maybeBlockSuffix(stmt.consequent, result);
|
|
71956
71956
|
if (stmt.alternate.type === Syntax.IfStatement) {
|
|
71957
|
-
result =
|
|
71957
|
+
result = join24(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
|
|
71958
71958
|
} else {
|
|
71959
|
-
result =
|
|
71959
|
+
result = join24(result, join24("else", this.maybeBlock(stmt.alternate, bodyFlags)));
|
|
71960
71960
|
}
|
|
71961
71961
|
} else {
|
|
71962
71962
|
result.push(this.maybeBlock(stmt.consequent, bodyFlags));
|
|
@@ -72057,7 +72057,7 @@ var require_escodegen = __commonJS({
|
|
|
72057
72057
|
},
|
|
72058
72058
|
ReturnStatement: function(stmt, flags) {
|
|
72059
72059
|
if (stmt.argument) {
|
|
72060
|
-
return [
|
|
72060
|
+
return [join24(
|
|
72061
72061
|
"return",
|
|
72062
72062
|
this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)
|
|
72063
72063
|
), this.semicolon(flags)];
|
|
@@ -72146,14 +72146,14 @@ var require_escodegen = __commonJS({
|
|
|
72146
72146
|
if (leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) {
|
|
72147
72147
|
result = [fragment, noEmptySpace(), expr.operator];
|
|
72148
72148
|
} else {
|
|
72149
|
-
result =
|
|
72149
|
+
result = join24(fragment, expr.operator);
|
|
72150
72150
|
}
|
|
72151
72151
|
fragment = this.generateExpression(expr.right, rightPrecedence, flags);
|
|
72152
72152
|
if (expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--") {
|
|
72153
72153
|
result.push(noEmptySpace());
|
|
72154
72154
|
result.push(fragment);
|
|
72155
72155
|
} else {
|
|
72156
|
-
result =
|
|
72156
|
+
result = join24(result, fragment);
|
|
72157
72157
|
}
|
|
72158
72158
|
if (expr.operator === "in" && !(flags & F_ALLOW_IN)) {
|
|
72159
72159
|
return ["(", result, ")"];
|
|
@@ -72193,7 +72193,7 @@ var require_escodegen = __commonJS({
|
|
|
72193
72193
|
var result, length, i, iz, itemFlags;
|
|
72194
72194
|
length = expr["arguments"].length;
|
|
72195
72195
|
itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF;
|
|
72196
|
-
result =
|
|
72196
|
+
result = join24(
|
|
72197
72197
|
"new",
|
|
72198
72198
|
this.generateExpression(expr.callee, Precedence.New, itemFlags)
|
|
72199
72199
|
);
|
|
@@ -72243,11 +72243,11 @@ var require_escodegen = __commonJS({
|
|
|
72243
72243
|
var result, fragment, rightCharCode, leftSource, leftCharCode;
|
|
72244
72244
|
fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT);
|
|
72245
72245
|
if (space === "") {
|
|
72246
|
-
result =
|
|
72246
|
+
result = join24(expr.operator, fragment);
|
|
72247
72247
|
} else {
|
|
72248
72248
|
result = [expr.operator];
|
|
72249
72249
|
if (expr.operator.length > 2) {
|
|
72250
|
-
result =
|
|
72250
|
+
result = join24(result, fragment);
|
|
72251
72251
|
} else {
|
|
72252
72252
|
leftSource = toSourceNodeWhenNeeded(result).toString();
|
|
72253
72253
|
leftCharCode = leftSource.charCodeAt(leftSource.length - 1);
|
|
@@ -72270,7 +72270,7 @@ var require_escodegen = __commonJS({
|
|
|
72270
72270
|
result = "yield";
|
|
72271
72271
|
}
|
|
72272
72272
|
if (expr.argument) {
|
|
72273
|
-
result =
|
|
72273
|
+
result = join24(
|
|
72274
72274
|
result,
|
|
72275
72275
|
this.generateExpression(expr.argument, Precedence.Yield, E_TTT)
|
|
72276
72276
|
);
|
|
@@ -72278,7 +72278,7 @@ var require_escodegen = __commonJS({
|
|
|
72278
72278
|
return parenthesize(result, Precedence.Yield, precedence);
|
|
72279
72279
|
},
|
|
72280
72280
|
AwaitExpression: function(expr, precedence, flags) {
|
|
72281
|
-
var result =
|
|
72281
|
+
var result = join24(
|
|
72282
72282
|
expr.all ? "await*" : "await",
|
|
72283
72283
|
this.generateExpression(expr.argument, Precedence.Await, E_TTT)
|
|
72284
72284
|
);
|
|
@@ -72361,11 +72361,11 @@ var require_escodegen = __commonJS({
|
|
|
72361
72361
|
var result, fragment;
|
|
72362
72362
|
result = ["class"];
|
|
72363
72363
|
if (expr.id) {
|
|
72364
|
-
result =
|
|
72364
|
+
result = join24(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
|
|
72365
72365
|
}
|
|
72366
72366
|
if (expr.superClass) {
|
|
72367
|
-
fragment =
|
|
72368
|
-
result =
|
|
72367
|
+
fragment = join24("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
|
|
72368
|
+
result = join24(result, fragment);
|
|
72369
72369
|
}
|
|
72370
72370
|
result.push(space);
|
|
72371
72371
|
result.push(this.generateStatement(expr.body, S_TFFT));
|
|
@@ -72380,7 +72380,7 @@ var require_escodegen = __commonJS({
|
|
|
72380
72380
|
}
|
|
72381
72381
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
72382
72382
|
fragment = [
|
|
72383
|
-
|
|
72383
|
+
join24(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
|
|
72384
72384
|
this.generateFunctionBody(expr.value)
|
|
72385
72385
|
];
|
|
72386
72386
|
} else {
|
|
@@ -72390,7 +72390,7 @@ var require_escodegen = __commonJS({
|
|
|
72390
72390
|
this.generateFunctionBody(expr.value)
|
|
72391
72391
|
];
|
|
72392
72392
|
}
|
|
72393
|
-
return
|
|
72393
|
+
return join24(result, fragment);
|
|
72394
72394
|
},
|
|
72395
72395
|
Property: function(expr, precedence, flags) {
|
|
72396
72396
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
@@ -72585,7 +72585,7 @@ var require_escodegen = __commonJS({
|
|
|
72585
72585
|
for (i = 0, iz = expr.blocks.length; i < iz; ++i) {
|
|
72586
72586
|
fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT);
|
|
72587
72587
|
if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
72588
|
-
result =
|
|
72588
|
+
result = join24(result, fragment);
|
|
72589
72589
|
} else {
|
|
72590
72590
|
result.push(fragment);
|
|
72591
72591
|
}
|
|
@@ -72593,13 +72593,13 @@ var require_escodegen = __commonJS({
|
|
|
72593
72593
|
});
|
|
72594
72594
|
}
|
|
72595
72595
|
if (expr.filter) {
|
|
72596
|
-
result =
|
|
72596
|
+
result = join24(result, "if" + space);
|
|
72597
72597
|
fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT);
|
|
72598
|
-
result =
|
|
72598
|
+
result = join24(result, ["(", fragment, ")"]);
|
|
72599
72599
|
}
|
|
72600
72600
|
if (!extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
72601
72601
|
fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
|
|
72602
|
-
result =
|
|
72602
|
+
result = join24(result, fragment);
|
|
72603
72603
|
}
|
|
72604
72604
|
result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]");
|
|
72605
72605
|
return result;
|
|
@@ -72615,8 +72615,8 @@ var require_escodegen = __commonJS({
|
|
|
72615
72615
|
} else {
|
|
72616
72616
|
fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT);
|
|
72617
72617
|
}
|
|
72618
|
-
fragment =
|
|
72619
|
-
fragment =
|
|
72618
|
+
fragment = join24(fragment, expr.of ? "of" : "in");
|
|
72619
|
+
fragment = join24(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
|
|
72620
72620
|
return ["for" + space + "(", fragment, ")"];
|
|
72621
72621
|
},
|
|
72622
72622
|
SpreadElement: function(expr, precedence, flags) {
|
|
@@ -87434,9 +87434,9 @@ async function syncPreferences(options) {
|
|
|
87434
87434
|
}),
|
|
87435
87435
|
backupFile(prefsPath)
|
|
87436
87436
|
]);
|
|
87437
|
-
for (const
|
|
87438
|
-
if (
|
|
87439
|
-
throw
|
|
87437
|
+
for (const command3 of result) {
|
|
87438
|
+
if (command3.status === "rejected") {
|
|
87439
|
+
throw command3.reason;
|
|
87440
87440
|
}
|
|
87441
87441
|
}
|
|
87442
87442
|
}
|
|
@@ -95356,15 +95356,15 @@ var init_command = __esm({
|
|
|
95356
95356
|
if (isCommandAndAliases(cmd)) {
|
|
95357
95357
|
[cmd, ...aliases] = cmd;
|
|
95358
95358
|
} else {
|
|
95359
|
-
for (const
|
|
95360
|
-
this.addHandler(
|
|
95359
|
+
for (const command3 of cmd) {
|
|
95360
|
+
this.addHandler(command3);
|
|
95361
95361
|
}
|
|
95362
95362
|
}
|
|
95363
95363
|
} else if (isCommandHandlerDefinition(cmd)) {
|
|
95364
|
-
let
|
|
95364
|
+
let command3 = Array.isArray(cmd.command) || typeof cmd.command === "string" ? cmd.command : this.moduleName(cmd);
|
|
95365
95365
|
if (cmd.aliases)
|
|
95366
|
-
|
|
95367
|
-
this.addHandler(
|
|
95366
|
+
command3 = [].concat(command3).concat(cmd.aliases);
|
|
95367
|
+
this.addHandler(command3, this.extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated);
|
|
95368
95368
|
return;
|
|
95369
95369
|
} else if (isCommandBuilderDefinition(builder)) {
|
|
95370
95370
|
this.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated);
|
|
@@ -95417,13 +95417,13 @@ var init_command = __esm({
|
|
|
95417
95417
|
hasDefaultCommand() {
|
|
95418
95418
|
return !!this.defaultCommand;
|
|
95419
95419
|
}
|
|
95420
|
-
runCommand(
|
|
95421
|
-
const commandHandler = this.handlers[
|
|
95420
|
+
runCommand(command3, yargs, parsed, commandIndex, helpOnly, helpOrVersionSet) {
|
|
95421
|
+
const commandHandler = this.handlers[command3] || this.handlers[this.aliasMap[command3]] || this.defaultCommand;
|
|
95422
95422
|
const currentContext = yargs.getInternalMethods().getContext();
|
|
95423
95423
|
const parentCommands = currentContext.commands.slice();
|
|
95424
|
-
const isDefaultCommand = !
|
|
95425
|
-
if (
|
|
95426
|
-
currentContext.commands.push(
|
|
95424
|
+
const isDefaultCommand = !command3;
|
|
95425
|
+
if (command3) {
|
|
95426
|
+
currentContext.commands.push(command3);
|
|
95427
95427
|
currentContext.fullCommands.push(commandHandler.original);
|
|
95428
95428
|
}
|
|
95429
95429
|
const builderResult = this.applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, parsed.aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet);
|
|
@@ -95814,7 +95814,7 @@ function usage(yargs, shim3) {
|
|
|
95814
95814
|
examples.push([cmd, description || ""]);
|
|
95815
95815
|
};
|
|
95816
95816
|
let commands = [];
|
|
95817
|
-
self2.command = function
|
|
95817
|
+
self2.command = function command3(cmd, description, isDefault, aliases, deprecated = false) {
|
|
95818
95818
|
if (isDefault) {
|
|
95819
95819
|
commands = commands.map((cmdArray) => {
|
|
95820
95820
|
cmdArray[2] = false;
|
|
@@ -95916,22 +95916,22 @@ function usage(yargs, shim3) {
|
|
|
95916
95916
|
commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
|
|
95917
95917
|
}
|
|
95918
95918
|
const prefix = base$0 ? `${base$0} ` : "";
|
|
95919
|
-
commands.forEach((
|
|
95920
|
-
const commandString = `${prefix}${parentCommands}${
|
|
95919
|
+
commands.forEach((command3) => {
|
|
95920
|
+
const commandString = `${prefix}${parentCommands}${command3[0].replace(/^\$0 ?/, "")}`;
|
|
95921
95921
|
ui2.span({
|
|
95922
95922
|
text: commandString,
|
|
95923
95923
|
padding: [0, 2, 0, 2],
|
|
95924
95924
|
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
|
|
95925
|
-
}, { text:
|
|
95925
|
+
}, { text: command3[1] });
|
|
95926
95926
|
const hints = [];
|
|
95927
|
-
if (
|
|
95927
|
+
if (command3[2])
|
|
95928
95928
|
hints.push(`[${__("default")}]`);
|
|
95929
|
-
if (
|
|
95930
|
-
hints.push(`[${__("aliases:")} ${
|
|
95929
|
+
if (command3[3] && command3[3].length) {
|
|
95930
|
+
hints.push(`[${__("aliases:")} ${command3[3].join(", ")}]`);
|
|
95931
95931
|
}
|
|
95932
|
-
if (
|
|
95933
|
-
if (typeof
|
|
95934
|
-
hints.push(`[${__("deprecated: %s",
|
|
95932
|
+
if (command3[4]) {
|
|
95933
|
+
if (typeof command3[4] === "string") {
|
|
95934
|
+
hints.push(`[${__("deprecated: %s", command3[4])}]`);
|
|
95935
95935
|
} else {
|
|
95936
95936
|
hints.push(`[${__("deprecated")}]`);
|
|
95937
95937
|
}
|
|
@@ -96312,8 +96312,8 @@ compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
|
96312
96312
|
});
|
|
96313
96313
|
|
|
96314
96314
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/completion.js
|
|
96315
|
-
function completion(yargs, usage2,
|
|
96316
|
-
return new Completion(yargs, usage2,
|
|
96315
|
+
function completion(yargs, usage2, command3, shim3) {
|
|
96316
|
+
return new Completion(yargs, usage2, command3, shim3);
|
|
96317
96317
|
}
|
|
96318
96318
|
function isSyncCompletionFunction(completionFunction) {
|
|
96319
96319
|
return completionFunction.length < 3;
|
|
@@ -96330,11 +96330,11 @@ var init_completion = __esm({
|
|
|
96330
96330
|
init_is_promise();
|
|
96331
96331
|
init_parse_command();
|
|
96332
96332
|
Completion = class {
|
|
96333
|
-
constructor(yargs, usage2,
|
|
96333
|
+
constructor(yargs, usage2, command3, shim3) {
|
|
96334
96334
|
var _a4, _b2, _c2;
|
|
96335
96335
|
this.yargs = yargs;
|
|
96336
96336
|
this.usage = usage2;
|
|
96337
|
-
this.command =
|
|
96337
|
+
this.command = command3;
|
|
96338
96338
|
this.shim = shim3;
|
|
96339
96339
|
this.completionKey = "get-yargs-completions";
|
|
96340
96340
|
this.aliases = null;
|
|
@@ -100169,8 +100169,8 @@ function findChromePath() {
|
|
|
100169
100169
|
for (const p8 of paths) {
|
|
100170
100170
|
if (p8) {
|
|
100171
100171
|
try {
|
|
100172
|
-
const { existsSync:
|
|
100173
|
-
if (
|
|
100172
|
+
const { existsSync: existsSync21 } = __require("node:fs");
|
|
100173
|
+
if (existsSync21(p8))
|
|
100174
100174
|
return p8;
|
|
100175
100175
|
} catch {
|
|
100176
100176
|
}
|
|
@@ -100186,8 +100186,8 @@ function findChromePath() {
|
|
|
100186
100186
|
];
|
|
100187
100187
|
for (const p8 of paths) {
|
|
100188
100188
|
try {
|
|
100189
|
-
const { existsSync:
|
|
100190
|
-
if (
|
|
100189
|
+
const { existsSync: existsSync21 } = __require("node:fs");
|
|
100190
|
+
if (existsSync21(p8))
|
|
100191
100191
|
return p8;
|
|
100192
100192
|
} catch {
|
|
100193
100193
|
}
|
|
@@ -100203,8 +100203,8 @@ function findChromePath() {
|
|
|
100203
100203
|
];
|
|
100204
100204
|
for (const p8 of linuxPaths) {
|
|
100205
100205
|
try {
|
|
100206
|
-
const { existsSync:
|
|
100207
|
-
if (
|
|
100206
|
+
const { existsSync: existsSync21 } = __require("node:fs");
|
|
100207
|
+
if (existsSync21(p8))
|
|
100208
100208
|
return p8;
|
|
100209
100209
|
} catch {
|
|
100210
100210
|
}
|
|
@@ -100808,10 +100808,10 @@ function getOrCreateSandbox(context3, timeoutMs) {
|
|
|
100808
100808
|
}
|
|
100809
100809
|
return sandbox;
|
|
100810
100810
|
}
|
|
100811
|
-
async function executeInDocker(
|
|
100811
|
+
async function executeInDocker(command3, context3, timeoutMs) {
|
|
100812
100812
|
const sandbox = getOrCreateSandbox(context3, timeoutMs);
|
|
100813
100813
|
try {
|
|
100814
|
-
const result = await sandbox.execute("/bin/sh", ["-c",
|
|
100814
|
+
const result = await sandbox.execute("/bin/sh", ["-c", command3]);
|
|
100815
100815
|
const output = [
|
|
100816
100816
|
`Exit code: ${result.exitCode}`,
|
|
100817
100817
|
result.timedOut ? " (timed out)" : "",
|
|
@@ -100834,8 +100834,8 @@ ${result.stderr.slice(0, 1e4)}` : ""
|
|
|
100834
100834
|
};
|
|
100835
100835
|
}
|
|
100836
100836
|
}
|
|
100837
|
-
function executeOnHost(
|
|
100838
|
-
if (DANGEROUS_METACHARACTERS.test(
|
|
100837
|
+
function executeOnHost(command3, workDir, timeoutMs, signal) {
|
|
100838
|
+
if (DANGEROUS_METACHARACTERS.test(command3)) {
|
|
100839
100839
|
return Promise.resolve({
|
|
100840
100840
|
output: "Command rejected: contains dangerous shell metacharacters. Use the Docker sandbox for complex shell commands.",
|
|
100841
100841
|
isError: true
|
|
@@ -100843,7 +100843,7 @@ function executeOnHost(command2, workDir, timeoutMs, signal) {
|
|
|
100843
100843
|
}
|
|
100844
100844
|
const isWin = process.platform === "win32";
|
|
100845
100845
|
const shellCmd = isWin ? "cmd" : "/bin/sh";
|
|
100846
|
-
const shellArgs = isWin ? ["/c",
|
|
100846
|
+
const shellArgs = isWin ? ["/c", command3] : ["-c", command3];
|
|
100847
100847
|
return new Promise((resolvePromise) => {
|
|
100848
100848
|
const child = execFile6(shellCmd, shellArgs, {
|
|
100849
100849
|
cwd: workDir,
|
|
@@ -100888,10 +100888,10 @@ ${stderr.slice(0, 1e4)}` : ""
|
|
|
100888
100888
|
}
|
|
100889
100889
|
});
|
|
100890
100890
|
}
|
|
100891
|
-
async function executeViaSSH(
|
|
100891
|
+
async function executeViaSSH(command3, sshConfig, opts) {
|
|
100892
100892
|
const executor = new SSHExecutor(sshConfig);
|
|
100893
100893
|
try {
|
|
100894
|
-
const result = await executor.execute(
|
|
100894
|
+
const result = await executor.execute(command3, {
|
|
100895
100895
|
cwd: opts?.cwd,
|
|
100896
100896
|
timeout: opts?.timeout
|
|
100897
100897
|
});
|
|
@@ -100910,10 +100910,10 @@ ${result.stderr.slice(0, 1e4)}` : ""
|
|
|
100910
100910
|
return { output: `SSH execution error: ${message}`, isError: true };
|
|
100911
100911
|
}
|
|
100912
100912
|
}
|
|
100913
|
-
async function executeViaK8s(
|
|
100913
|
+
async function executeViaK8s(command3, k8sConfig, opts) {
|
|
100914
100914
|
const executor = new K8sExecutor(k8sConfig);
|
|
100915
100915
|
try {
|
|
100916
|
-
const result = await executor.execute(
|
|
100916
|
+
const result = await executor.execute(command3, { timeout: opts?.timeout });
|
|
100917
100917
|
const output = [
|
|
100918
100918
|
`[K8s \u2192 ${k8sConfig.namespace ?? "nestor"}] Exit code: ${result.exitCode}`,
|
|
100919
100919
|
result.stdout ? `
|
|
@@ -100930,19 +100930,19 @@ ${result.stderr.slice(0, 1e4)}` : ""
|
|
|
100930
100930
|
}
|
|
100931
100931
|
}
|
|
100932
100932
|
async function shellExecHandler(input, context3) {
|
|
100933
|
-
const { command:
|
|
100933
|
+
const { command: command3, cwd, timeout: timeout2 } = input;
|
|
100934
100934
|
const workDir = cwd ? resolve9(context3.workingDir, cwd) : context3.workingDir;
|
|
100935
100935
|
const timeoutMs = timeout2 ?? 3e4;
|
|
100936
100936
|
const execBackend = context3.executionBackend ?? "local";
|
|
100937
100937
|
if (execBackend === "ssh" && context3.sshConfig) {
|
|
100938
|
-
return executeViaSSH(
|
|
100938
|
+
return executeViaSSH(command3, context3.sshConfig, { cwd: workDir, timeout: timeoutMs });
|
|
100939
100939
|
}
|
|
100940
100940
|
if (execBackend === "k8s" && context3.k8sConfig) {
|
|
100941
|
-
return executeViaK8s(
|
|
100941
|
+
return executeViaK8s(command3, context3.k8sConfig, { timeout: timeoutMs });
|
|
100942
100942
|
}
|
|
100943
100943
|
if (context3.sandboxManager) {
|
|
100944
100944
|
try {
|
|
100945
|
-
const result = await context3.sandboxManager.execute(
|
|
100945
|
+
const result = await context3.sandboxManager.execute(command3, {
|
|
100946
100946
|
cwd: workDir,
|
|
100947
100947
|
timeoutMs,
|
|
100948
100948
|
signal: context3.signal
|
|
@@ -100964,7 +100964,7 @@ ${result.stderr.slice(0, 1e4)}` : ""
|
|
|
100964
100964
|
}
|
|
100965
100965
|
const sandboxMode = context3.sandbox?.mode ?? "none";
|
|
100966
100966
|
if (sandboxMode === "docker") {
|
|
100967
|
-
return executeInDocker(
|
|
100967
|
+
return executeInDocker(command3, context3, timeoutMs);
|
|
100968
100968
|
}
|
|
100969
100969
|
if (sandboxMode === "namespace" || sandboxMode === "wasm") {
|
|
100970
100970
|
try {
|
|
@@ -100972,12 +100972,12 @@ ${result.stderr.slice(0, 1e4)}` : ""
|
|
|
100972
100972
|
const dockerAvailable = await probe.isAvailable();
|
|
100973
100973
|
await probe.destroy();
|
|
100974
100974
|
if (dockerAvailable) {
|
|
100975
|
-
return executeInDocker(
|
|
100975
|
+
return executeInDocker(command3, context3, timeoutMs);
|
|
100976
100976
|
}
|
|
100977
100977
|
} catch {
|
|
100978
100978
|
}
|
|
100979
100979
|
}
|
|
100980
|
-
return executeOnHost(
|
|
100980
|
+
return executeOnHost(command3, workDir, timeoutMs, context3.signal);
|
|
100981
100981
|
}
|
|
100982
100982
|
async function fileReadHandler(input, context3) {
|
|
100983
100983
|
const { path: filePath, encoding, maxBytes } = input;
|
|
@@ -101360,12 +101360,12 @@ var init_builtin = __esm({
|
|
|
101360
101360
|
});
|
|
101361
101361
|
|
|
101362
101362
|
// ../agent/dist/dry-run/planner.js
|
|
101363
|
-
function assessCommandRisk(
|
|
101364
|
-
if (CRITICAL_PATTERNS.test(
|
|
101363
|
+
function assessCommandRisk(command3) {
|
|
101364
|
+
if (CRITICAL_PATTERNS.test(command3))
|
|
101365
101365
|
return "critical";
|
|
101366
|
-
if (HIGH_PATTERNS.test(
|
|
101366
|
+
if (HIGH_PATTERNS.test(command3))
|
|
101367
101367
|
return "high";
|
|
101368
|
-
if (MEDIUM_PATTERNS.test(
|
|
101368
|
+
if (MEDIUM_PATTERNS.test(command3))
|
|
101369
101369
|
return "medium";
|
|
101370
101370
|
return "low";
|
|
101371
101371
|
}
|
|
@@ -110753,16 +110753,16 @@ var init_guardrail_service = __esm({
|
|
|
110753
110753
|
matchCommandPattern(pattern, toolName, args2) {
|
|
110754
110754
|
if (toolName !== "shell_exec")
|
|
110755
110755
|
return null;
|
|
110756
|
-
const
|
|
110757
|
-
if (!
|
|
110756
|
+
const command3 = String(args2.command || args2.cmd || "");
|
|
110757
|
+
if (!command3)
|
|
110758
110758
|
return null;
|
|
110759
110759
|
try {
|
|
110760
110760
|
const regex = new RegExp(pattern, "i");
|
|
110761
|
-
if (regex.test(
|
|
110761
|
+
if (regex.test(command3)) {
|
|
110762
110762
|
return `Command matches guardrail pattern: ${pattern}`;
|
|
110763
110763
|
}
|
|
110764
110764
|
} catch {
|
|
110765
|
-
if (
|
|
110765
|
+
if (command3.toLowerCase().includes(pattern.toLowerCase())) {
|
|
110766
110766
|
return `Command matches guardrail pattern: ${pattern}`;
|
|
110767
110767
|
}
|
|
110768
110768
|
}
|
|
@@ -118699,12 +118699,12 @@ var require_getMachineId_win = __commonJS({
|
|
|
118699
118699
|
var api_1 = (init_esm2(), __toCommonJS(esm_exports));
|
|
118700
118700
|
async function getMachineId() {
|
|
118701
118701
|
const args2 = "QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid";
|
|
118702
|
-
let
|
|
118702
|
+
let command3 = "%windir%\\System32\\REG.exe";
|
|
118703
118703
|
if (process3.arch === "ia32" && "PROCESSOR_ARCHITEW6432" in process3.env) {
|
|
118704
|
-
|
|
118704
|
+
command3 = "%windir%\\sysnative\\cmd.exe /c " + command3;
|
|
118705
118705
|
}
|
|
118706
118706
|
try {
|
|
118707
|
-
const result = await (0, execAsync_1.execAsync)(`${
|
|
118707
|
+
const result = await (0, execAsync_1.execAsync)(`${command3} ${args2}`);
|
|
118708
118708
|
const parts = result.stdout.split("REG_SZ");
|
|
118709
118709
|
if (parts.length === 2) {
|
|
118710
118710
|
return parts[1].trim();
|
|
@@ -127260,12 +127260,12 @@ var require_getMachineId_win2 = __commonJS({
|
|
|
127260
127260
|
var api_1 = (init_esm2(), __toCommonJS(esm_exports));
|
|
127261
127261
|
async function getMachineId() {
|
|
127262
127262
|
const args2 = "QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid";
|
|
127263
|
-
let
|
|
127263
|
+
let command3 = "%windir%\\System32\\REG.exe";
|
|
127264
127264
|
if (process3.arch === "ia32" && "PROCESSOR_ARCHITEW6432" in process3.env) {
|
|
127265
|
-
|
|
127265
|
+
command3 = "%windir%\\sysnative\\cmd.exe /c " + command3;
|
|
127266
127266
|
}
|
|
127267
127267
|
try {
|
|
127268
|
-
const result = await (0, execAsync_1.execAsync)(`${
|
|
127268
|
+
const result = await (0, execAsync_1.execAsync)(`${command3} ${args2}`);
|
|
127269
127269
|
const parts = result.stdout.split("REG_SZ");
|
|
127270
127270
|
if (parts.length === 2) {
|
|
127271
127271
|
return parts[1].trim();
|
|
@@ -142894,6 +142894,7 @@ var init_knowledge2 = __esm({
|
|
|
142894
142894
|
// ../server/dist/app.js
|
|
142895
142895
|
import express, {} from "express";
|
|
142896
142896
|
import { resolve as resolve12, join as join16 } from "node:path";
|
|
142897
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
142897
142898
|
import compression from "compression";
|
|
142898
142899
|
import cors from "cors";
|
|
142899
142900
|
function getStudioState() {
|
|
@@ -143091,11 +143092,20 @@ function createApp(config2) {
|
|
|
143091
143092
|
});
|
|
143092
143093
|
});
|
|
143093
143094
|
let studioDistDir = null;
|
|
143095
|
+
const candidateDirs = [];
|
|
143094
143096
|
if (config2.studioDir) {
|
|
143095
|
-
|
|
143096
|
-
}
|
|
143097
|
+
candidateDirs.push(config2.studioDir);
|
|
143098
|
+
}
|
|
143099
|
+
try {
|
|
143100
|
+
candidateDirs.push(resolve12(__dirname, "../../ui/dist"));
|
|
143101
|
+
} catch {
|
|
143102
|
+
}
|
|
143103
|
+
for (const dir of candidateDirs) {
|
|
143097
143104
|
try {
|
|
143098
|
-
|
|
143105
|
+
if (existsSync11(join16(dir, "index.html"))) {
|
|
143106
|
+
studioDistDir = dir;
|
|
143107
|
+
break;
|
|
143108
|
+
}
|
|
143099
143109
|
} catch {
|
|
143100
143110
|
}
|
|
143101
143111
|
}
|
|
@@ -143125,6 +143135,23 @@ function createApp(config2) {
|
|
|
143125
143135
|
}
|
|
143126
143136
|
res.sendFile(join16(studioDistDir, "index.html"));
|
|
143127
143137
|
});
|
|
143138
|
+
} else {
|
|
143139
|
+
app.get("/studio", (_req, res) => {
|
|
143140
|
+
res.status(404).json({
|
|
143141
|
+
error: {
|
|
143142
|
+
code: "STUDIO_NOT_FOUND",
|
|
143143
|
+
message: "Studio UI files not found. Rebuild with: cd packages/ui && npm run build, then restart the server."
|
|
143144
|
+
}
|
|
143145
|
+
});
|
|
143146
|
+
});
|
|
143147
|
+
app.get("/studio/*", (_req, res) => {
|
|
143148
|
+
res.status(404).json({
|
|
143149
|
+
error: {
|
|
143150
|
+
code: "STUDIO_NOT_FOUND",
|
|
143151
|
+
message: "Studio UI files not found. Rebuild with: cd packages/ui && npm run build, then restart the server."
|
|
143152
|
+
}
|
|
143153
|
+
});
|
|
143154
|
+
});
|
|
143128
143155
|
}
|
|
143129
143156
|
app.use(errorHandler());
|
|
143130
143157
|
return app;
|
|
@@ -143193,7 +143220,7 @@ var init_app = __esm({
|
|
|
143193
143220
|
});
|
|
143194
143221
|
|
|
143195
143222
|
// ../server/dist/services/config-watcher.js
|
|
143196
|
-
import { watch, existsSync as
|
|
143223
|
+
import { watch, existsSync as existsSync12 } from "node:fs";
|
|
143197
143224
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
143198
143225
|
var ConfigWatcher;
|
|
143199
143226
|
var init_config_watcher = __esm({
|
|
@@ -143218,7 +143245,7 @@ var init_config_watcher = __esm({
|
|
|
143218
143245
|
*/
|
|
143219
143246
|
async start() {
|
|
143220
143247
|
await this.reload();
|
|
143221
|
-
if (
|
|
143248
|
+
if (existsSync12(this.configPath)) {
|
|
143222
143249
|
this.watcher = watch(this.configPath, { persistent: false }, (eventType) => {
|
|
143223
143250
|
if (eventType === "change") {
|
|
143224
143251
|
if (this.debounceTimer)
|
|
@@ -143255,7 +143282,7 @@ var init_config_watcher = __esm({
|
|
|
143255
143282
|
// ─── Internal ───────────────────────────────────────────────────────
|
|
143256
143283
|
async reload() {
|
|
143257
143284
|
try {
|
|
143258
|
-
if (!
|
|
143285
|
+
if (!existsSync12(this.configPath)) {
|
|
143259
143286
|
console.warn("[config-watcher] Config file not found, keeping current config.");
|
|
143260
143287
|
return;
|
|
143261
143288
|
}
|
|
@@ -143299,7 +143326,7 @@ __export(telemetry_exports, {
|
|
|
143299
143326
|
resetTelemetry: () => resetTelemetry
|
|
143300
143327
|
});
|
|
143301
143328
|
import { randomUUID as randomUUID33 } from "node:crypto";
|
|
143302
|
-
import { existsSync as
|
|
143329
|
+
import { existsSync as existsSync13, readFileSync as readFileSync15, writeFileSync as writeFileSync8, appendFileSync as appendFileSync2, mkdirSync as mkdirSync6 } from "node:fs";
|
|
143303
143330
|
import { join as join17, dirname as dirname8 } from "node:path";
|
|
143304
143331
|
import { homedir as homedir4 } from "node:os";
|
|
143305
143332
|
function getTelemetry(config2) {
|
|
@@ -143413,7 +143440,7 @@ var init_telemetry2 = __esm({
|
|
|
143413
143440
|
// ─── Private ─────────────────────────────────────────────────────────
|
|
143414
143441
|
getOrCreateInstallId() {
|
|
143415
143442
|
try {
|
|
143416
|
-
if (
|
|
143443
|
+
if (existsSync13(TELEMETRY_ID_FILE)) {
|
|
143417
143444
|
const id = readFileSync15(TELEMETRY_ID_FILE, "utf-8").trim();
|
|
143418
143445
|
if (id.length > 0)
|
|
143419
143446
|
return id;
|
|
@@ -143429,7 +143456,7 @@ var init_telemetry2 = __esm({
|
|
|
143429
143456
|
return newId;
|
|
143430
143457
|
}
|
|
143431
143458
|
ensureDataDir() {
|
|
143432
|
-
if (!
|
|
143459
|
+
if (!existsSync13(DATA_DIR3)) {
|
|
143433
143460
|
mkdirSync6(DATA_DIR3, { recursive: true });
|
|
143434
143461
|
}
|
|
143435
143462
|
}
|
|
@@ -155229,7 +155256,7 @@ var init_yaml_loader = __esm({
|
|
|
155229
155256
|
});
|
|
155230
155257
|
|
|
155231
155258
|
// ../skill-tester/dist/runner.js
|
|
155232
|
-
import { readFileSync as readFileSync17, readdirSync as readdirSync4, statSync as statSync5, existsSync as
|
|
155259
|
+
import { readFileSync as readFileSync17, readdirSync as readdirSync4, statSync as statSync5, existsSync as existsSync15, mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, rmSync as rmSync2 } from "node:fs";
|
|
155233
155260
|
import { join as join19, resolve as resolve13, extname as extname4 } from "node:path";
|
|
155234
155261
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
155235
155262
|
import { randomUUID as randomUUID35 } from "node:crypto";
|
|
@@ -155314,7 +155341,7 @@ var init_runner2 = __esm({
|
|
|
155314
155341
|
const tools = new agentModule.ToolRegistry();
|
|
155315
155342
|
const toolExecutor = new agentModule.ToolExecutor();
|
|
155316
155343
|
let instructions = "You are a helpful AI assistant.";
|
|
155317
|
-
if (test.skill &&
|
|
155344
|
+
if (test.skill && existsSync15(test.skill)) {
|
|
155318
155345
|
instructions = readFileSync17(test.skill, "utf-8");
|
|
155319
155346
|
} else if (test.skill) {
|
|
155320
155347
|
const skillPaths = [
|
|
@@ -155323,7 +155350,7 @@ var init_runner2 = __esm({
|
|
|
155323
155350
|
join19(process.cwd(), "skills-registry", test.skill, "SKILL.md")
|
|
155324
155351
|
];
|
|
155325
155352
|
for (const p8 of skillPaths) {
|
|
155326
|
-
if (
|
|
155353
|
+
if (existsSync15(p8)) {
|
|
155327
155354
|
instructions = readFileSync17(p8, "utf-8");
|
|
155328
155355
|
break;
|
|
155329
155356
|
}
|
|
@@ -155533,7 +155560,7 @@ var init_runner2 = __esm({
|
|
|
155533
155560
|
discoverTestFiles(dir) {
|
|
155534
155561
|
const files = [];
|
|
155535
155562
|
const resolvedDir = resolve13(dir);
|
|
155536
|
-
if (!
|
|
155563
|
+
if (!existsSync15(resolvedDir))
|
|
155537
155564
|
return files;
|
|
155538
155565
|
const stat = statSync5(resolvedDir);
|
|
155539
155566
|
if (!stat.isDirectory()) {
|
|
@@ -156830,7 +156857,7 @@ when the agent determines it needs the capabilities described above.
|
|
|
156830
156857
|
type: "text",
|
|
156831
156858
|
text: JSON.stringify({
|
|
156832
156859
|
skillMd,
|
|
156833
|
-
instructions: "Save this content as SKILL.md in a directory, then install with nestor_install_skill or `nestor skill install <path>`."
|
|
156860
|
+
instructions: "Save this content as SKILL.md in a directory, then install with nestor_install_skill or `npx nestor-sh skill install <path>`."
|
|
156834
156861
|
}, null, 2)
|
|
156835
156862
|
}
|
|
156836
156863
|
]
|
|
@@ -157576,7 +157603,7 @@ __export(shell_exports, {
|
|
|
157576
157603
|
registerShellCommand: () => registerShellCommand
|
|
157577
157604
|
});
|
|
157578
157605
|
import * as readline3 from "node:readline";
|
|
157579
|
-
import { existsSync as
|
|
157606
|
+
import { existsSync as existsSync16, readFileSync as readFileSync18, writeFileSync as writeFileSync10, mkdirSync as mkdirSync9, appendFileSync as appendFileSync3 } from "node:fs";
|
|
157580
157607
|
import { join as join20, resolve as resolve14, dirname as dirname9, basename as basename4 } from "node:path";
|
|
157581
157608
|
import { homedir as homedir5 } from "node:os";
|
|
157582
157609
|
import { readdirSync as readdirSync5 } from "node:fs";
|
|
@@ -157610,7 +157637,7 @@ async function startShell() {
|
|
|
157610
157637
|
currentRouter: null,
|
|
157611
157638
|
verbose: false
|
|
157612
157639
|
};
|
|
157613
|
-
if (!
|
|
157640
|
+
if (!existsSync16(NESTOR_DIR)) {
|
|
157614
157641
|
mkdirSync9(NESTOR_DIR, { recursive: true });
|
|
157615
157642
|
}
|
|
157616
157643
|
refreshAgentNameCache(session);
|
|
@@ -158042,7 +158069,7 @@ async function cmdListSkills() {
|
|
|
158042
158069
|
try {
|
|
158043
158070
|
const skills = store.listSkills();
|
|
158044
158071
|
if (skills.length === 0) {
|
|
158045
|
-
console.log(chalk11.yellow("No skills installed. Use `nestor skill install` to add one."));
|
|
158072
|
+
console.log(chalk11.yellow("No skills installed. Use `npx nestor-sh skill install` to add one."));
|
|
158046
158073
|
return;
|
|
158047
158074
|
}
|
|
158048
158075
|
const headers = ["Name", "Version", "Author", "Trust"];
|
|
@@ -158059,7 +158086,7 @@ async function cmdListWorkflows() {
|
|
|
158059
158086
|
try {
|
|
158060
158087
|
const workflows = store.listWorkflows();
|
|
158061
158088
|
if (workflows.length === 0) {
|
|
158062
|
-
console.log(chalk11.yellow("No workflows defined. Use `nestor workflow create` to add one."));
|
|
158089
|
+
console.log(chalk11.yellow("No workflows defined. Use `npx nestor-sh workflow create` to add one."));
|
|
158063
158090
|
return;
|
|
158064
158091
|
}
|
|
158065
158092
|
const headers = ["Name", "Version", "Created"];
|
|
@@ -158075,7 +158102,7 @@ function cmdShowConfig() {
|
|
|
158075
158102
|
const config2 = readConfigFile();
|
|
158076
158103
|
if (!config2) {
|
|
158077
158104
|
console.log(chalk11.yellow("No configuration file found."));
|
|
158078
|
-
console.log(chalk11.dim("Run `nestor install` to create one."));
|
|
158105
|
+
console.log(chalk11.dim("Run `npx nestor-sh install` to create one."));
|
|
158079
158106
|
return;
|
|
158080
158107
|
}
|
|
158081
158108
|
console.log("");
|
|
@@ -159343,7 +159370,7 @@ function refreshAgentNameCache(session) {
|
|
|
159343
159370
|
}
|
|
159344
159371
|
function loadHistory() {
|
|
159345
159372
|
try {
|
|
159346
|
-
if (
|
|
159373
|
+
if (existsSync16(HISTORY_FILE)) {
|
|
159347
159374
|
const raw = readFileSync18(HISTORY_FILE, "utf-8");
|
|
159348
159375
|
return raw.split("\n").filter((l) => l.trim().length > 0).slice(-MAX_HISTORY);
|
|
159349
159376
|
}
|
|
@@ -159355,7 +159382,7 @@ function saveHistory(rl) {
|
|
|
159355
159382
|
}
|
|
159356
159383
|
function appendToHistoryFile(line) {
|
|
159357
159384
|
try {
|
|
159358
|
-
if (!
|
|
159385
|
+
if (!existsSync16(NESTOR_DIR)) {
|
|
159359
159386
|
mkdirSync9(NESTOR_DIR, { recursive: true });
|
|
159360
159387
|
}
|
|
159361
159388
|
appendFileSync3(HISTORY_FILE, line + "\n", "utf-8");
|
|
@@ -159751,6 +159778,9 @@ var init_shell = __esm({
|
|
|
159751
159778
|
|
|
159752
159779
|
// src/index.ts
|
|
159753
159780
|
import { Command } from "commander";
|
|
159781
|
+
import { existsSync as existsSync20, readFileSync as readFileSync22 } from "node:fs";
|
|
159782
|
+
import { join as join23 } from "node:path";
|
|
159783
|
+
import { homedir as homedir8 } from "node:os";
|
|
159754
159784
|
|
|
159755
159785
|
// src/commands/start.ts
|
|
159756
159786
|
init_config2();
|
|
@@ -159811,9 +159841,27 @@ function registerStartCommand(program2) {
|
|
|
159811
159841
|
try {
|
|
159812
159842
|
const { createNestorServer: createNestorServer2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports3));
|
|
159813
159843
|
const __cli_dirname = path21.dirname(fileURLToPath4(import.meta.url));
|
|
159814
|
-
const
|
|
159815
|
-
|
|
159816
|
-
|
|
159844
|
+
const studioCandidates = [
|
|
159845
|
+
path21.resolve(__cli_dirname, "studio"),
|
|
159846
|
+
// npm: dist/studio/
|
|
159847
|
+
path21.resolve(__cli_dirname, "..", "studio"),
|
|
159848
|
+
// npm: studio/ next to dist/
|
|
159849
|
+
path21.resolve(__cli_dirname, "../../ui/dist"),
|
|
159850
|
+
// monorepo dev mode
|
|
159851
|
+
path21.resolve(__cli_dirname, "../../../packages/ui/dist")
|
|
159852
|
+
// dev alt
|
|
159853
|
+
];
|
|
159854
|
+
let studioDir;
|
|
159855
|
+
for (const candidate of studioCandidates) {
|
|
159856
|
+
if (fs20.existsSync(path21.join(candidate, "index.html"))) {
|
|
159857
|
+
studioDir = candidate;
|
|
159858
|
+
break;
|
|
159859
|
+
}
|
|
159860
|
+
}
|
|
159861
|
+
if (studioEnabled && !studioDir) {
|
|
159862
|
+
console.log(chalk.yellow(" [warn]"), "Studio UI files not found \u2014 /studio will not be available");
|
|
159863
|
+
console.log(chalk.dim(` Searched: ${studioCandidates[0]}`));
|
|
159864
|
+
}
|
|
159817
159865
|
serverHandle = createNestorServer2({
|
|
159818
159866
|
host,
|
|
159819
159867
|
port,
|
|
@@ -159876,12 +159924,24 @@ init_config();
|
|
|
159876
159924
|
init_config2();
|
|
159877
159925
|
import * as p from "@clack/prompts";
|
|
159878
159926
|
import chalk2 from "chalk";
|
|
159879
|
-
import { mkdirSync as mkdirSync7, existsSync as
|
|
159927
|
+
import { mkdirSync as mkdirSync7, existsSync as existsSync14 } from "node:fs";
|
|
159880
159928
|
import { join as join18 } from "node:path";
|
|
159881
159929
|
import { randomBytes as randomBytes6 } from "node:crypto";
|
|
159882
159930
|
function generateApiKey() {
|
|
159883
159931
|
return `nst_${randomBytes6(32).toString("hex")}`;
|
|
159884
159932
|
}
|
|
159933
|
+
function randomSegment() {
|
|
159934
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
159935
|
+
let result = "";
|
|
159936
|
+
const bytes = randomBytes6(4);
|
|
159937
|
+
for (let i = 0; i < 4; i++) {
|
|
159938
|
+
result += chars[bytes[i] % chars.length];
|
|
159939
|
+
}
|
|
159940
|
+
return result;
|
|
159941
|
+
}
|
|
159942
|
+
function generateBetaKey() {
|
|
159943
|
+
return `NESTOR-BETA-${randomSegment()}-${randomSegment()}-${randomSegment()}`;
|
|
159944
|
+
}
|
|
159885
159945
|
async function initializeDatabase(dataDir) {
|
|
159886
159946
|
const { NestorStore: NestorStore2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
|
|
159887
159947
|
const dbPath = join18(dataDir, "nestor.db");
|
|
@@ -159932,13 +159992,13 @@ async function runNonInteractiveInstall() {
|
|
|
159932
159992
|
console.log();
|
|
159933
159993
|
const config2 = buildConfigFromDefaults();
|
|
159934
159994
|
const dataDir = expandPath(config2.server.dataDir);
|
|
159935
|
-
if (!
|
|
159995
|
+
if (!existsSync14(dataDir)) {
|
|
159936
159996
|
mkdirSync7(dataDir, { recursive: true });
|
|
159937
159997
|
console.log(chalk2.green(" Created data directory:"), dataDir);
|
|
159938
159998
|
}
|
|
159939
159999
|
for (const sub of ["adapters", "skills", "plugins", "logs"]) {
|
|
159940
160000
|
const subDir = join18(dataDir, sub);
|
|
159941
|
-
if (!
|
|
160001
|
+
if (!existsSync14(subDir)) {
|
|
159942
160002
|
mkdirSync7(subDir, { recursive: true });
|
|
159943
160003
|
}
|
|
159944
160004
|
}
|
|
@@ -159955,12 +160015,15 @@ async function runNonInteractiveInstall() {
|
|
|
159955
160015
|
const { writeFileSync: writeFileSync13 } = await import("node:fs");
|
|
159956
160016
|
writeFileSync13(apiKeyPath, JSON.stringify({ admin: apiKey }, null, 2) + "\n", "utf-8");
|
|
159957
160017
|
console.log(chalk2.green(" Admin API key created"));
|
|
160018
|
+
const betaKey = generateBetaKey();
|
|
160019
|
+
writeFileSync13(join18(dataDir, "license.key"), betaKey, "utf-8");
|
|
160020
|
+
console.log(chalk2.green(" Beta key created"));
|
|
159958
160021
|
console.log();
|
|
159959
160022
|
console.log(chalk2.bold("Admin API Key:"), chalk2.yellow(apiKey));
|
|
160023
|
+
console.log(chalk2.bold("Beta key:"), chalk2.yellow(betaKey));
|
|
159960
160024
|
console.log(chalk2.dim(" Save this key \u2014 it won't be shown again."));
|
|
159961
160025
|
console.log();
|
|
159962
|
-
console.log(chalk2.green("
|
|
159963
|
-
console.log(chalk2.cyan(" npx nestor-sh start"));
|
|
160026
|
+
console.log(chalk2.green("Nestor is ready! Run: ") + chalk2.cyan("npx nestor-sh start"));
|
|
159964
160027
|
}
|
|
159965
160028
|
async function runInteractiveInstall() {
|
|
159966
160029
|
p.intro(chalk2.bgCyan(" Nestor Setup Wizard "));
|
|
@@ -160050,7 +160113,7 @@ async function runInteractiveInstall() {
|
|
|
160050
160113
|
const spinner3 = p.spinner();
|
|
160051
160114
|
spinner3.start("Creating directories...");
|
|
160052
160115
|
for (const dir of [dataDir, join18(dataDir, "adapters"), join18(dataDir, "skills"), join18(dataDir, "plugins"), join18(dataDir, "logs")]) {
|
|
160053
|
-
if (!
|
|
160116
|
+
if (!existsSync14(dir)) {
|
|
160054
160117
|
mkdirSync7(dir, { recursive: true });
|
|
160055
160118
|
}
|
|
160056
160119
|
}
|
|
@@ -160080,11 +160143,17 @@ async function runInteractiveInstall() {
|
|
|
160080
160143
|
const { writeFileSync: writeFileSync13 } = await import("node:fs");
|
|
160081
160144
|
writeFileSync13(apiKeyPath, JSON.stringify({ admin: apiKey }, null, 2) + "\n", "utf-8");
|
|
160082
160145
|
spinner4.stop("Admin API key created!");
|
|
160146
|
+
const spinner5 = p.spinner();
|
|
160147
|
+
spinner5.start("Generating beta key...");
|
|
160148
|
+
const betaKey = generateBetaKey();
|
|
160149
|
+
writeFileSync13(join18(dataDir, "license.key"), betaKey, "utf-8");
|
|
160150
|
+
spinner5.stop("Beta key created!");
|
|
160083
160151
|
p.note(
|
|
160084
160152
|
`Config file: ${getConfigPath()}
|
|
160085
160153
|
Data directory: ${dataDir}
|
|
160086
160154
|
API port: ${config2.server.port}
|
|
160087
160155
|
Admin API key: ${apiKey}
|
|
160156
|
+
Beta key: ${betaKey}
|
|
160088
160157
|
|
|
160089
160158
|
${chalk2.dim("Save this key \u2014 it won't be shown again.")}`,
|
|
160090
160159
|
"Setup complete"
|
|
@@ -160188,7 +160257,7 @@ function registerAgentCommand(program2) {
|
|
|
160188
160257
|
const agents = store.listAgents();
|
|
160189
160258
|
if (agents.length === 0) {
|
|
160190
160259
|
console.log(chalk3.yellow("No agents registered yet."));
|
|
160191
|
-
console.log(chalk3.dim("Use `nestor agent create` to add an agent."));
|
|
160260
|
+
console.log(chalk3.dim("Use `npx nestor-sh agent create` to add an agent."));
|
|
160192
160261
|
return;
|
|
160193
160262
|
}
|
|
160194
160263
|
if (options.json) {
|
|
@@ -160360,7 +160429,7 @@ function registerSkillCommand(program2) {
|
|
|
160360
160429
|
const skills = store.listSkills();
|
|
160361
160430
|
if (skills.length === 0) {
|
|
160362
160431
|
console.log(chalk4.yellow("No skills installed yet."));
|
|
160363
|
-
console.log(chalk4.dim("Use `nestor skill install <source>` to add a skill."));
|
|
160432
|
+
console.log(chalk4.dim("Use `npx nestor-sh skill install <source>` to add a skill."));
|
|
160364
160433
|
return;
|
|
160365
160434
|
}
|
|
160366
160435
|
if (options.json) {
|
|
@@ -160932,7 +161001,7 @@ function registerWorkflowCommand(program2) {
|
|
|
160932
161001
|
const workflows = store.listWorkflows();
|
|
160933
161002
|
if (workflows.length === 0) {
|
|
160934
161003
|
console.log(chalk5.yellow("No workflows created yet."));
|
|
160935
|
-
console.log(chalk5.dim("Use `nestor workflow create` to add a workflow."));
|
|
161004
|
+
console.log(chalk5.dim("Use `npx nestor-sh workflow create` to add a workflow."));
|
|
160936
161005
|
return;
|
|
160937
161006
|
}
|
|
160938
161007
|
if (options.json) {
|
|
@@ -160988,7 +161057,7 @@ function registerWorkflowCommand(program2) {
|
|
|
160988
161057
|
};
|
|
160989
161058
|
store.createRun(run);
|
|
160990
161059
|
console.log(chalk5.green(`Workflow '${name}' started (run: ${runId})`));
|
|
160991
|
-
console.log(chalk5.dim("Track progress with: nestor workflow status " + runId));
|
|
161060
|
+
console.log(chalk5.dim("Track progress with: npx nestor-sh workflow status " + runId));
|
|
160992
161061
|
} finally {
|
|
160993
161062
|
store.close();
|
|
160994
161063
|
}
|
|
@@ -161149,7 +161218,7 @@ function registerConfigCommand(program2) {
|
|
|
161149
161218
|
const cfg = readConfigFile();
|
|
161150
161219
|
if (!cfg) {
|
|
161151
161220
|
console.log(chalk6.yellow("No configuration found."));
|
|
161152
|
-
console.log(chalk6.dim("Run `nestor install` or `nestor config init` to create one."));
|
|
161221
|
+
console.log(chalk6.dim("Run `npx nestor-sh install` or `npx nestor-sh config init` to create one."));
|
|
161153
161222
|
return;
|
|
161154
161223
|
}
|
|
161155
161224
|
if (options.json) {
|
|
@@ -161198,7 +161267,7 @@ function registerConfigCommand(program2) {
|
|
|
161198
161267
|
config2.command("set <key> <value>").description("Set a configuration value (dot notation, e.g., security.sandboxMode none)").action((key, value) => {
|
|
161199
161268
|
const configPath = getConfigPath();
|
|
161200
161269
|
if (!fs24.existsSync(configPath)) {
|
|
161201
|
-
console.error(chalk6.red("No config file found. Run `nestor config init` first."));
|
|
161270
|
+
console.error(chalk6.red("No config file found. Run `npx nestor-sh config init` first."));
|
|
161202
161271
|
process.exit(1);
|
|
161203
161272
|
}
|
|
161204
161273
|
try {
|
|
@@ -161295,7 +161364,7 @@ function registerDoctorCommand(program2) {
|
|
|
161295
161364
|
});
|
|
161296
161365
|
}
|
|
161297
161366
|
} else {
|
|
161298
|
-
checks.push({ name: "SQLite database", status: "warn", message: "Database not created yet (run nestor start)" });
|
|
161367
|
+
checks.push({ name: "SQLite database", status: "warn", message: "Database not created yet (run npx nestor-sh start)" });
|
|
161299
161368
|
}
|
|
161300
161369
|
} else {
|
|
161301
161370
|
checks.push({ name: "SQLite database", status: "warn", message: "No config to check" });
|
|
@@ -161370,7 +161439,7 @@ init_db();
|
|
|
161370
161439
|
init_spinner();
|
|
161371
161440
|
init_table();
|
|
161372
161441
|
import {
|
|
161373
|
-
existsSync as
|
|
161442
|
+
existsSync as existsSync17,
|
|
161374
161443
|
readFileSync as readFileSync19,
|
|
161375
161444
|
writeFileSync as writeFileSync11,
|
|
161376
161445
|
mkdirSync as mkdirSync10,
|
|
@@ -161411,7 +161480,7 @@ async function startForeground() {
|
|
|
161411
161480
|
const existingPid = readPid();
|
|
161412
161481
|
if (existingPid && isProcessAlive(existingPid)) {
|
|
161413
161482
|
console.log(chalk12.yellow(`Daemon is already running (PID: ${existingPid}).`));
|
|
161414
|
-
console.log(chalk12.dim("Use `nestor daemon stop` to stop it first."));
|
|
161483
|
+
console.log(chalk12.dim("Use `npx nestor-sh daemon stop` to stop it first."));
|
|
161415
161484
|
return;
|
|
161416
161485
|
}
|
|
161417
161486
|
ensureDirs();
|
|
@@ -161443,7 +161512,7 @@ async function startDetached() {
|
|
|
161443
161512
|
const existingPid = readPid();
|
|
161444
161513
|
if (existingPid && isProcessAlive(existingPid)) {
|
|
161445
161514
|
console.log(chalk12.yellow(`Daemon is already running (PID: ${existingPid}).`));
|
|
161446
|
-
console.log(chalk12.dim("Use `nestor daemon stop` to stop it first."));
|
|
161515
|
+
console.log(chalk12.dim("Use `npx nestor-sh daemon stop` to stop it first."));
|
|
161447
161516
|
return;
|
|
161448
161517
|
}
|
|
161449
161518
|
ensureDirs();
|
|
@@ -161459,7 +161528,7 @@ async function startDetached() {
|
|
|
161459
161528
|
writePid(child.pid);
|
|
161460
161529
|
console.log(chalk12.green(`Daemon started in background (PID: ${child.pid}).`));
|
|
161461
161530
|
console.log(chalk12.dim(` Logs: ${LOG_FILE}`));
|
|
161462
|
-
console.log(chalk12.dim(` Stop: nestor daemon stop`));
|
|
161531
|
+
console.log(chalk12.dim(` Stop: npx nestor-sh daemon stop`));
|
|
161463
161532
|
} else {
|
|
161464
161533
|
console.error(chalk12.red("Failed to start daemon process."));
|
|
161465
161534
|
process.exit(1);
|
|
@@ -161554,7 +161623,7 @@ async function showStatus() {
|
|
|
161554
161623
|
console.log("");
|
|
161555
161624
|
}
|
|
161556
161625
|
async function showLogs(follow, lineCount) {
|
|
161557
|
-
if (!
|
|
161626
|
+
if (!existsSync17(LOG_FILE)) {
|
|
161558
161627
|
console.log(chalk12.yellow("No daemon log file found."));
|
|
161559
161628
|
console.log(chalk12.dim(`Expected at: ${LOG_FILE}`));
|
|
161560
161629
|
return;
|
|
@@ -161574,7 +161643,7 @@ async function showLogs(follow, lineCount) {
|
|
|
161574
161643
|
}
|
|
161575
161644
|
console.log(chalk12.dim(`Following ${LOG_FILE}... (Ctrl+C to stop)`));
|
|
161576
161645
|
console.log("");
|
|
161577
|
-
if (
|
|
161646
|
+
if (existsSync17(LOG_FILE)) {
|
|
161578
161647
|
const content = readFileSync19(LOG_FILE, "utf-8");
|
|
161579
161648
|
const lines = content.split("\n").filter((l) => l.length > 0);
|
|
161580
161649
|
const lastLines = lines.slice(-10);
|
|
@@ -161582,10 +161651,10 @@ async function showLogs(follow, lineCount) {
|
|
|
161582
161651
|
console.log(colorizeLogLine(line));
|
|
161583
161652
|
}
|
|
161584
161653
|
}
|
|
161585
|
-
let lastSize =
|
|
161654
|
+
let lastSize = existsSync17(LOG_FILE) ? readFileSync19(LOG_FILE).length : 0;
|
|
161586
161655
|
const watcher = setInterval(() => {
|
|
161587
161656
|
try {
|
|
161588
|
-
if (!
|
|
161657
|
+
if (!existsSync17(LOG_FILE)) return;
|
|
161589
161658
|
const content = readFileSync19(LOG_FILE, "utf-8");
|
|
161590
161659
|
if (content.length > lastSize) {
|
|
161591
161660
|
const newContent = content.substring(lastSize);
|
|
@@ -161914,7 +161983,7 @@ async function importDaemonAgentModule() {
|
|
|
161914
161983
|
}
|
|
161915
161984
|
function readHeartbeat() {
|
|
161916
161985
|
try {
|
|
161917
|
-
if (
|
|
161986
|
+
if (existsSync17(HEARTBEAT_FILE)) {
|
|
161918
161987
|
const raw = readFileSync19(HEARTBEAT_FILE, "utf-8");
|
|
161919
161988
|
return JSON.parse(raw);
|
|
161920
161989
|
}
|
|
@@ -161924,7 +161993,7 @@ function readHeartbeat() {
|
|
|
161924
161993
|
}
|
|
161925
161994
|
function readPid() {
|
|
161926
161995
|
try {
|
|
161927
|
-
if (
|
|
161996
|
+
if (existsSync17(PID_FILE)) {
|
|
161928
161997
|
const raw = readFileSync19(PID_FILE, "utf-8").trim();
|
|
161929
161998
|
const pid = parseInt(raw, 10);
|
|
161930
161999
|
return isNaN(pid) ? null : pid;
|
|
@@ -161939,7 +162008,7 @@ function writePid(pid) {
|
|
|
161939
162008
|
}
|
|
161940
162009
|
function cleanupPid() {
|
|
161941
162010
|
try {
|
|
161942
|
-
if (
|
|
162011
|
+
if (existsSync17(PID_FILE)) {
|
|
161943
162012
|
unlinkSync(PID_FILE);
|
|
161944
162013
|
}
|
|
161945
162014
|
} catch {
|
|
@@ -161979,10 +162048,10 @@ function colorizeLogLine(line) {
|
|
|
161979
162048
|
return line;
|
|
161980
162049
|
}
|
|
161981
162050
|
function ensureDirs() {
|
|
161982
|
-
if (!
|
|
162051
|
+
if (!existsSync17(NESTOR_DIR2)) {
|
|
161983
162052
|
mkdirSync10(NESTOR_DIR2, { recursive: true });
|
|
161984
162053
|
}
|
|
161985
|
-
if (!
|
|
162054
|
+
if (!existsSync17(LOG_DIR)) {
|
|
161986
162055
|
mkdirSync10(LOG_DIR, { recursive: true });
|
|
161987
162056
|
}
|
|
161988
162057
|
}
|
|
@@ -162024,7 +162093,7 @@ if (process.argv[2] === "__daemon_child__" || process.env.NESTOR_DAEMON_MODE ===
|
|
|
162024
162093
|
|
|
162025
162094
|
// src/commands/watch.ts
|
|
162026
162095
|
init_db();
|
|
162027
|
-
import { existsSync as
|
|
162096
|
+
import { existsSync as existsSync18, readFileSync as readFileSync20 } from "node:fs";
|
|
162028
162097
|
import { join as join22 } from "node:path";
|
|
162029
162098
|
import { homedir as homedir7 } from "node:os";
|
|
162030
162099
|
import chalk13 from "chalk";
|
|
@@ -162098,7 +162167,7 @@ async function refreshData(state) {
|
|
|
162098
162167
|
} catch {
|
|
162099
162168
|
}
|
|
162100
162169
|
try {
|
|
162101
|
-
if (
|
|
162170
|
+
if (existsSync18(HEARTBEAT_FILE2)) {
|
|
162102
162171
|
const raw = readFileSync20(HEARTBEAT_FILE2, "utf-8");
|
|
162103
162172
|
const heartbeat = JSON.parse(raw);
|
|
162104
162173
|
state.daemonRunning = isDaemonAlive(heartbeat.pid);
|
|
@@ -162116,7 +162185,7 @@ async function refreshData(state) {
|
|
|
162116
162185
|
}
|
|
162117
162186
|
function loadRecentEvents(state) {
|
|
162118
162187
|
try {
|
|
162119
|
-
if (!
|
|
162188
|
+
if (!existsSync18(LOG_FILE2)) return;
|
|
162120
162189
|
const content = readFileSync20(LOG_FILE2, "utf-8");
|
|
162121
162190
|
const lines = content.split("\n").filter((l) => l.length > 0);
|
|
162122
162191
|
const recent = lines.slice(-MAX_EVENTS);
|
|
@@ -162369,7 +162438,7 @@ function registerStudioCommand(program2) {
|
|
|
162369
162438
|
const data = apiResult.data?.data;
|
|
162370
162439
|
if (data && !data.enabled) {
|
|
162371
162440
|
console.log(chalk14.yellow(" Studio is currently disabled on the running server."));
|
|
162372
|
-
console.log(chalk14.dim(" Use `nestor studio enable` to enable it first."));
|
|
162441
|
+
console.log(chalk14.dim(" Use `npx nestor-sh studio enable` to enable it first."));
|
|
162373
162442
|
return;
|
|
162374
162443
|
}
|
|
162375
162444
|
}
|
|
@@ -162417,7 +162486,7 @@ function registerTelemetryCommand(program2) {
|
|
|
162417
162486
|
console.log(chalk15.dim(" What we NEVER collect:"));
|
|
162418
162487
|
console.log(chalk15.dim(" - API keys, file contents, prompts, personal data"));
|
|
162419
162488
|
console.log("");
|
|
162420
|
-
console.log(chalk15.dim(" Run `nestor telemetry off` to disable at any time."));
|
|
162489
|
+
console.log(chalk15.dim(" Run `npx nestor-sh telemetry off` to disable at any time."));
|
|
162421
162490
|
console.log("");
|
|
162422
162491
|
});
|
|
162423
162492
|
telemetry.command("off").description("Disable anonymous telemetry").action(() => {
|
|
@@ -162434,7 +162503,7 @@ function registerTelemetryCommand(program2) {
|
|
|
162434
162503
|
console.log(chalk15.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
162435
162504
|
if (!config2) {
|
|
162436
162505
|
console.log(` ${chalk15.dim("Enabled:")} ${chalk15.yellow("unknown")} (no config file)`);
|
|
162437
|
-
console.log(chalk15.dim(" Run `nestor config init` to create a configuration."));
|
|
162506
|
+
console.log(chalk15.dim(" Run `npx nestor-sh config init` to create a configuration."));
|
|
162438
162507
|
} else {
|
|
162439
162508
|
const enabled = config2.telemetry?.enabled ?? false;
|
|
162440
162509
|
console.log(` ${chalk15.dim("Enabled:")} ${enabled ? chalk15.green("true") : chalk15.dim("false (default)")}`);
|
|
@@ -162443,10 +162512,10 @@ function registerTelemetryCommand(program2) {
|
|
|
162443
162512
|
}
|
|
162444
162513
|
console.log(` ${chalk15.dim("Flush:")} every ${(config2.telemetry?.flushIntervalMs ?? 6e4) / 1e3}s`);
|
|
162445
162514
|
}
|
|
162446
|
-
const { join:
|
|
162447
|
-
const { homedir:
|
|
162448
|
-
const telemetryFile =
|
|
162449
|
-
const idFile =
|
|
162515
|
+
const { join: join24 } = __require("node:path");
|
|
162516
|
+
const { homedir: homedir9 } = __require("node:os");
|
|
162517
|
+
const telemetryFile = join24(homedir9(), ".nestor", "telemetry.jsonl");
|
|
162518
|
+
const idFile = join24(homedir9(), ".nestor", "telemetry-id");
|
|
162450
162519
|
if (fs28.existsSync(idFile)) {
|
|
162451
162520
|
const installId = fs28.readFileSync(idFile, "utf-8").trim();
|
|
162452
162521
|
console.log(` ${chalk15.dim("Install ID:")} ${installId.slice(0, 8)}...`);
|
|
@@ -162796,7 +162865,7 @@ async function cmdSandboxTest() {
|
|
|
162796
162865
|
sshSpinner.fail(`SSH connection failed: ${sshResult.error}`);
|
|
162797
162866
|
}
|
|
162798
162867
|
} else {
|
|
162799
|
-
console.log(chalk17.dim(" SSH: not configured (use `nestor sandbox ssh <host>`)"));
|
|
162868
|
+
console.log(chalk17.dim(" SSH: not configured (use `npx nestor-sh sandbox ssh <host>`)"));
|
|
162800
162869
|
}
|
|
162801
162870
|
console.log(chalk17.green("\u2714") + " Local execution: always available");
|
|
162802
162871
|
console.log("");
|
|
@@ -162805,7 +162874,7 @@ async function cmdSandboxTest() {
|
|
|
162805
162874
|
console.log(chalk17.dim('Consider switching to "none" or "auto" in your config.'));
|
|
162806
162875
|
} else if (sandboxMode === "ssh" && !sshConfig) {
|
|
162807
162876
|
console.log(chalk17.yellow('Warning: Sandbox mode is "ssh" but no SSH config found.'));
|
|
162808
|
-
console.log(chalk17.dim("Run `nestor sandbox ssh <host>` to configure."));
|
|
162877
|
+
console.log(chalk17.dim("Run `npx nestor-sh sandbox ssh <host>` to configure."));
|
|
162809
162878
|
} else {
|
|
162810
162879
|
console.log(chalk17.green("Sandbox configuration looks good."));
|
|
162811
162880
|
}
|
|
@@ -162842,7 +162911,7 @@ async function cmdSandboxSSH(host, opts) {
|
|
|
162842
162911
|
testSpinner.succeed("SSH connection successful");
|
|
162843
162912
|
} else {
|
|
162844
162913
|
testSpinner.fail(`SSH connection failed: ${result.error}`);
|
|
162845
|
-
console.log(chalk17.yellow("Configuration saved anyway. Fix the connection issue and run `nestor sandbox test`."));
|
|
162914
|
+
console.log(chalk17.yellow("Configuration saved anyway. Fix the connection issue and run `npx nestor-sh sandbox test`."));
|
|
162846
162915
|
}
|
|
162847
162916
|
try {
|
|
162848
162917
|
const config2 = readConfigFile() ?? {};
|
|
@@ -163154,7 +163223,7 @@ function registerRagCommand(program2) {
|
|
|
163154
163223
|
filePath: opts.file
|
|
163155
163224
|
});
|
|
163156
163225
|
if (results.length === 0) {
|
|
163157
|
-
console.log(chalk19.yellow("No results found. Try indexing first: nestor rag index"));
|
|
163226
|
+
console.log(chalk19.yellow("No results found. Try indexing first: npx nestor-sh rag index"));
|
|
163158
163227
|
return;
|
|
163159
163228
|
}
|
|
163160
163229
|
console.log(chalk19.bold(`
|
|
@@ -163218,7 +163287,7 @@ ${results.length} results for "${query}":
|
|
|
163218
163287
|
|
|
163219
163288
|
// src/commands/test.ts
|
|
163220
163289
|
import { resolve as resolve16, relative as relative5 } from "node:path";
|
|
163221
|
-
import { readdirSync as readdirSync6, statSync as statSync6, existsSync as
|
|
163290
|
+
import { readdirSync as readdirSync6, statSync as statSync6, existsSync as existsSync19 } from "node:fs";
|
|
163222
163291
|
import chalk20 from "chalk";
|
|
163223
163292
|
var TEST_FILE_PATTERNS = [
|
|
163224
163293
|
".nestor-test.yaml",
|
|
@@ -163231,7 +163300,7 @@ function registerTestCommand(program2) {
|
|
|
163231
163300
|
program2.command("test [path]").description("Run skill and agent test suites").option("-l, --list", "List discovered test files", false).option("-f, --file <file>", "Run a specific test file").option("-r, --record <file>", "Record LLM responses to a fixture file").option("-p, --prompt <prompt>", "Prompt for recording mode").option("-v, --verbose", "Show detailed test output", false).option("-j, --json", "Output results as JSON (for CI)", false).action(async (path30, opts) => {
|
|
163232
163301
|
if (opts.file) {
|
|
163233
163302
|
const filePath = resolve16(opts.file);
|
|
163234
|
-
if (!
|
|
163303
|
+
if (!existsSync19(filePath)) {
|
|
163235
163304
|
console.error(chalk20.red(`File not found: ${opts.file}`));
|
|
163236
163305
|
process.exit(1);
|
|
163237
163306
|
}
|
|
@@ -163262,7 +163331,7 @@ function registerTestCommand(program2) {
|
|
|
163262
163331
|
];
|
|
163263
163332
|
const allFiles = [];
|
|
163264
163333
|
for (const testDir of defaultTestDirs) {
|
|
163265
|
-
if (
|
|
163334
|
+
if (existsSync19(testDir)) {
|
|
163266
163335
|
allFiles.push(...discoverTestFiles(testDir));
|
|
163267
163336
|
}
|
|
163268
163337
|
}
|
|
@@ -163305,7 +163374,7 @@ function discoverTestFiles(dir) {
|
|
|
163305
163374
|
}
|
|
163306
163375
|
}
|
|
163307
163376
|
}
|
|
163308
|
-
if (
|
|
163377
|
+
if (existsSync19(dir) && !statSync6(dir).isDirectory()) {
|
|
163309
163378
|
return [dir];
|
|
163310
163379
|
}
|
|
163311
163380
|
walk(dir);
|
|
@@ -163314,7 +163383,7 @@ function discoverTestFiles(dir) {
|
|
|
163314
163383
|
async function listTestFiles(dir) {
|
|
163315
163384
|
const files = discoverTestFiles(dir);
|
|
163316
163385
|
const nestorTestDir = resolve16(dir, ".nestor", "tests");
|
|
163317
|
-
if (
|
|
163386
|
+
if (existsSync19(nestorTestDir)) {
|
|
163318
163387
|
files.push(...discoverTestFiles(nestorTestDir));
|
|
163319
163388
|
}
|
|
163320
163389
|
const unique = [...new Set(files)];
|
|
@@ -163370,7 +163439,7 @@ async function runSkillTestsByName(skillName, verbose, json) {
|
|
|
163370
163439
|
];
|
|
163371
163440
|
const matchingFiles = [];
|
|
163372
163441
|
for (const dir of searchDirs) {
|
|
163373
|
-
if (!
|
|
163442
|
+
if (!existsSync19(dir)) continue;
|
|
163374
163443
|
const files = discoverTestFiles(dir);
|
|
163375
163444
|
for (const file of files) {
|
|
163376
163445
|
if (file.includes(skillName)) {
|
|
@@ -163474,7 +163543,7 @@ function registerGuardrailCommand(program2) {
|
|
|
163474
163543
|
const guardrails = store.listGuardrails();
|
|
163475
163544
|
if (guardrails.length === 0) {
|
|
163476
163545
|
console.log(chalk21.dim("No guardrails configured."));
|
|
163477
|
-
console.log(chalk21.dim("Add one with: nestor guardrail add"));
|
|
163546
|
+
console.log(chalk21.dim("Add one with: npx nestor-sh guardrail add"));
|
|
163478
163547
|
return;
|
|
163479
163548
|
}
|
|
163480
163549
|
printTable(
|
|
@@ -163567,8 +163636,30 @@ function registerGuardrailCommand(program2) {
|
|
|
163567
163636
|
}
|
|
163568
163637
|
|
|
163569
163638
|
// src/index.ts
|
|
163639
|
+
function checkBetaAccess() {
|
|
163640
|
+
const licenseFile = join23(homedir8(), ".nestor", "license.key");
|
|
163641
|
+
if (!existsSync20(licenseFile)) return false;
|
|
163642
|
+
const key = readFileSync22(licenseFile, "utf-8").trim();
|
|
163643
|
+
return /^NESTOR-BETA-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/.test(key);
|
|
163644
|
+
}
|
|
163645
|
+
var command2 = process.argv[2];
|
|
163646
|
+
if (command2 && !["--help", "-h", "--version", "-V", "install"].includes(command2)) {
|
|
163647
|
+
if (!checkBetaAccess()) {
|
|
163648
|
+
console.log(`
|
|
163649
|
+
\u26A1 Nestor is currently in private beta.
|
|
163650
|
+
|
|
163651
|
+
Visit https://nestor.sh to request access.
|
|
163652
|
+
|
|
163653
|
+
If you have a beta key, save it to:
|
|
163654
|
+
~/.nestor/license.key
|
|
163655
|
+
|
|
163656
|
+
Then run: npx nestor-sh install
|
|
163657
|
+
`);
|
|
163658
|
+
process.exit(0);
|
|
163659
|
+
}
|
|
163660
|
+
}
|
|
163570
163661
|
var program = new Command();
|
|
163571
|
-
program.name("nestor").description("Nestor AI Agent Platform \u2014 orchestrate, secure and monitor AI agents").version("0.
|
|
163662
|
+
program.name("nestor-sh").description("Nestor AI Agent Platform \u2014 orchestrate, secure and monitor AI agents").version("2.0.4");
|
|
163572
163663
|
registerStartCommand(program);
|
|
163573
163664
|
registerInstallCommand(program);
|
|
163574
163665
|
registerAgentCommand(program);
|
|
@@ -163591,7 +163682,7 @@ registerGuardrailCommand(program);
|
|
|
163591
163682
|
var args = process.argv.slice(2);
|
|
163592
163683
|
if (args.length === 0) {
|
|
163593
163684
|
Promise.resolve().then(() => (init_shell(), shell_exports)).then(({ registerShellCommand: _ }) => {
|
|
163594
|
-
program.parse(["node", "nestor", "shell"]);
|
|
163685
|
+
program.parse(["node", "nestor-sh", "shell"]);
|
|
163595
163686
|
});
|
|
163596
163687
|
} else {
|
|
163597
163688
|
program.parse();
|