@solongate/proxy 0.81.42 → 0.81.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +78 -58
- package/dist/tui/index.js +25 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7537,6 +7537,7 @@ function LivePanel({ active: active2 }) {
|
|
|
7537
7537
|
const inspectFromRef = useRef2("stream");
|
|
7538
7538
|
const seenRef = useRef2(/* @__PURE__ */ new Set());
|
|
7539
7539
|
const lastLocalTs = useRef2(0);
|
|
7540
|
+
const localSeq = useRef2(0);
|
|
7540
7541
|
const pausedUntil = useRef2(0);
|
|
7541
7542
|
const sessRef = useRef2([]);
|
|
7542
7543
|
const mergedRef = useRef2([]);
|
|
@@ -7582,7 +7583,7 @@ function LivePanel({ active: active2 }) {
|
|
|
7582
7583
|
const at = Date.parse(j.ts ?? "");
|
|
7583
7584
|
if (!Number.isFinite(at) || at <= lastLocalTs.current) continue;
|
|
7584
7585
|
fresh.push({
|
|
7585
|
-
id: "l:" + at + ":" + (j.tool ?? "")
|
|
7586
|
+
id: "l:" + at + ":" + (j.tool ?? "") + ":" + localSeq.current++,
|
|
7586
7587
|
at,
|
|
7587
7588
|
tool: j.tool ?? "?",
|
|
7588
7589
|
decision: j.decision ?? "ALLOW",
|
|
@@ -7706,10 +7707,10 @@ function LivePanel({ active: active2 }) {
|
|
|
7706
7707
|
const startRef = useRef2(Date.now());
|
|
7707
7708
|
const lastNotifyAt = useRef2(0);
|
|
7708
7709
|
const fireAlert = useCallback2(
|
|
7709
|
-
(id, title, msg, level = "warn") => {
|
|
7710
|
+
(id, title, msg, level = "warn", desktop = true) => {
|
|
7710
7711
|
pushLog(`${level === "bad" ? "\u26D4" : "\u23F8"} ${msg}`, level);
|
|
7711
7712
|
setAlerts((a) => [...a.filter((x) => x.id !== id), { id, msg, level, until: Date.now() + 15e3 }].slice(-4));
|
|
7712
|
-
if (!CONFIG.notifications) return;
|
|
7713
|
+
if (!desktop || !CONFIG.notifications) return;
|
|
7713
7714
|
if (Date.now() - lastNotifyAt.current < 3e3) return;
|
|
7714
7715
|
lastNotifyAt.current = Date.now();
|
|
7715
7716
|
try {
|
|
@@ -7726,7 +7727,7 @@ function LivePanel({ active: active2 }) {
|
|
|
7726
7727
|
const prev = prevStatus.current.get(r.id);
|
|
7727
7728
|
if (prev && prev === "active" && r.status === "idle") {
|
|
7728
7729
|
const name = r.isMe ? `${r.agent} (this machine)` : r.agent;
|
|
7729
|
-
fireAlert("idle:" + r.id, "Agent idle", `${name} went IDLE, no tool call for 60s`, "warn");
|
|
7730
|
+
fireAlert("idle:" + r.id, "Agent idle", `${name} went IDLE, no tool call for 60s`, "warn", false);
|
|
7730
7731
|
}
|
|
7731
7732
|
prevStatus.current.set(r.id, r.status);
|
|
7732
7733
|
}
|
|
@@ -10150,6 +10151,9 @@ var tui_exports = {};
|
|
|
10150
10151
|
__export(tui_exports, {
|
|
10151
10152
|
launchTui: () => launchTui
|
|
10152
10153
|
});
|
|
10154
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync6 } from "fs";
|
|
10155
|
+
import { homedir as homedir7 } from "os";
|
|
10156
|
+
import { join as join9 } from "path";
|
|
10153
10157
|
import { render } from "ink";
|
|
10154
10158
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
10155
10159
|
async function launchTui() {
|
|
@@ -10160,10 +10164,26 @@ async function launchTui() {
|
|
|
10160
10164
|
return;
|
|
10161
10165
|
}
|
|
10162
10166
|
process.stdout.write("\x1B[?1049h\x1B[H");
|
|
10167
|
+
const debugLog = join9(homedir7(), ".solongate", "dataroom-debug.log");
|
|
10168
|
+
const saved = { log: console.log, warn: console.warn, error: console.error, info: console.info, debug: console.debug };
|
|
10169
|
+
const toFile = (level) => (...args) => {
|
|
10170
|
+
try {
|
|
10171
|
+
mkdirSync6(join9(homedir7(), ".solongate"), { recursive: true });
|
|
10172
|
+
appendFileSync2(debugLog, `${(/* @__PURE__ */ new Date()).toISOString()} [${level}] ${args.map((a) => typeof a === "string" ? a : JSON.stringify(a)).join(" ")}
|
|
10173
|
+
`);
|
|
10174
|
+
} catch {
|
|
10175
|
+
}
|
|
10176
|
+
};
|
|
10177
|
+
console.log = toFile("log");
|
|
10178
|
+
console.warn = toFile("warn");
|
|
10179
|
+
console.error = toFile("error");
|
|
10180
|
+
console.info = toFile("info");
|
|
10181
|
+
console.debug = toFile("debug");
|
|
10163
10182
|
try {
|
|
10164
|
-
const { waitUntilExit } = render(/* @__PURE__ */ jsx10(App, {}));
|
|
10183
|
+
const { waitUntilExit } = render(/* @__PURE__ */ jsx10(App, {}), { patchConsole: false });
|
|
10165
10184
|
await waitUntilExit();
|
|
10166
10185
|
} finally {
|
|
10186
|
+
Object.assign(console, saved);
|
|
10167
10187
|
process.stdout.write("\x1B[?1049l");
|
|
10168
10188
|
}
|
|
10169
10189
|
}
|
|
@@ -10863,8 +10883,8 @@ var init_agents2 = __esm({
|
|
|
10863
10883
|
|
|
10864
10884
|
// src/commands/doctor.ts
|
|
10865
10885
|
import { existsSync as existsSync4, statSync as statSync2 } from "fs";
|
|
10866
|
-
import { homedir as
|
|
10867
|
-
import { join as
|
|
10886
|
+
import { homedir as homedir8 } from "os";
|
|
10887
|
+
import { join as join10 } from "path";
|
|
10868
10888
|
async function run6(argv) {
|
|
10869
10889
|
const { flags } = parse(argv);
|
|
10870
10890
|
const json = flagBool(flags, "json");
|
|
@@ -10924,14 +10944,14 @@ var init_doctor = __esm({
|
|
|
10924
10944
|
init_api_client();
|
|
10925
10945
|
init_format();
|
|
10926
10946
|
init_args();
|
|
10927
|
-
LOCAL_LOG2 =
|
|
10947
|
+
LOCAL_LOG2 = join10(homedir8(), ".solongate", "local-logs", "solongate-audit.jsonl");
|
|
10928
10948
|
}
|
|
10929
10949
|
});
|
|
10930
10950
|
|
|
10931
10951
|
// src/commands/watch.ts
|
|
10932
10952
|
import { closeSync as closeSync2, existsSync as existsSync5, openSync as openSync2, readSync as readSync2, statSync as statSync3 } from "fs";
|
|
10933
|
-
import { homedir as
|
|
10934
|
-
import { join as
|
|
10953
|
+
import { homedir as homedir9 } from "os";
|
|
10954
|
+
import { join as join11 } from "path";
|
|
10935
10955
|
function tailLocal(file, maxBytes = 131072) {
|
|
10936
10956
|
try {
|
|
10937
10957
|
const size = statSync3(file).size;
|
|
@@ -11038,7 +11058,7 @@ var init_watch = __esm({
|
|
|
11038
11058
|
init_cli_utils();
|
|
11039
11059
|
init_args();
|
|
11040
11060
|
init_format();
|
|
11041
|
-
LOCAL_LOG3 =
|
|
11061
|
+
LOCAL_LOG3 = join11(homedir9(), ".solongate", "local-logs", "solongate-audit.jsonl");
|
|
11042
11062
|
trunc = (s, n) => s.length <= n ? s : s.slice(0, n - 1) + "\u2026";
|
|
11043
11063
|
time = (ms) => new Date(ms).toTimeString().slice(0, 8);
|
|
11044
11064
|
}
|
|
@@ -11329,9 +11349,9 @@ var init_commands = __esm({
|
|
|
11329
11349
|
});
|
|
11330
11350
|
|
|
11331
11351
|
// src/global-install.ts
|
|
11332
|
-
import { readFileSync as readFileSync8, writeFileSync as writeFileSync7, existsSync as existsSync6, mkdirSync as
|
|
11333
|
-
import { resolve as resolve4, join as
|
|
11334
|
-
import { homedir as
|
|
11352
|
+
import { readFileSync as readFileSync8, writeFileSync as writeFileSync7, existsSync as existsSync6, mkdirSync as mkdirSync7 } from "fs";
|
|
11353
|
+
import { resolve as resolve4, join as join12, dirname } from "path";
|
|
11354
|
+
import { homedir as homedir10 } from "os";
|
|
11335
11355
|
import { fileURLToPath } from "url";
|
|
11336
11356
|
import { createInterface } from "readline";
|
|
11337
11357
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -11394,10 +11414,10 @@ function unlockFile(file) {
|
|
|
11394
11414
|
function protectedTargets() {
|
|
11395
11415
|
const p = globalPaths();
|
|
11396
11416
|
return [
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11417
|
+
join12(p.hooksDir, "guard.mjs"),
|
|
11418
|
+
join12(p.hooksDir, "audit.mjs"),
|
|
11419
|
+
join12(p.hooksDir, "stop.mjs"),
|
|
11420
|
+
join12(p.hooksDir, "shield.mjs"),
|
|
11401
11421
|
p.configPath,
|
|
11402
11422
|
p.settingsPath
|
|
11403
11423
|
];
|
|
@@ -11409,25 +11429,25 @@ function unlockProtected() {
|
|
|
11409
11429
|
for (const f of protectedTargets()) unlockFile(f);
|
|
11410
11430
|
}
|
|
11411
11431
|
function globalPaths() {
|
|
11412
|
-
const home =
|
|
11413
|
-
const sgDir =
|
|
11414
|
-
const hooksDir =
|
|
11415
|
-
const claudeDir =
|
|
11432
|
+
const home = homedir10();
|
|
11433
|
+
const sgDir = join12(home, ".solongate");
|
|
11434
|
+
const hooksDir = join12(sgDir, "hooks");
|
|
11435
|
+
const claudeDir = join12(home, ".claude");
|
|
11416
11436
|
return {
|
|
11417
11437
|
home,
|
|
11418
11438
|
sgDir,
|
|
11419
11439
|
hooksDir,
|
|
11420
11440
|
claudeDir,
|
|
11421
|
-
settingsPath:
|
|
11422
|
-
backupPath:
|
|
11423
|
-
configPath:
|
|
11441
|
+
settingsPath: join12(claudeDir, "settings.json"),
|
|
11442
|
+
backupPath: join12(claudeDir, "settings.solongate.bak"),
|
|
11443
|
+
configPath: join12(sgDir, "cloud-guard.json")
|
|
11424
11444
|
};
|
|
11425
11445
|
}
|
|
11426
11446
|
function readHook(filename) {
|
|
11427
|
-
return readFileSync8(
|
|
11447
|
+
return readFileSync8(join12(HOOKS_DIR, filename), "utf-8");
|
|
11428
11448
|
}
|
|
11429
11449
|
function readGuard() {
|
|
11430
|
-
const bundled =
|
|
11450
|
+
const bundled = join12(HOOKS_DIR, "guard.bundled.mjs");
|
|
11431
11451
|
return existsSync6(bundled) ? readFileSync8(bundled, "utf-8") : readHook("guard.mjs");
|
|
11432
11452
|
}
|
|
11433
11453
|
function ask(question) {
|
|
@@ -11462,7 +11482,7 @@ function shimTargets() {
|
|
|
11462
11482
|
return [];
|
|
11463
11483
|
}
|
|
11464
11484
|
}
|
|
11465
|
-
return [".bashrc", ".zshrc", ".profile"].map((f) =>
|
|
11485
|
+
return [".bashrc", ".zshrc", ".profile"].map((f) => join12(homedir10(), f)).filter((f) => existsSync6(f));
|
|
11466
11486
|
}
|
|
11467
11487
|
function writeShimBlock(file, block2) {
|
|
11468
11488
|
const re = new RegExp(escapeRe(SHIM_BEGIN) + "[\\s\\S]*?" + escapeRe(SHIM_END) + "\\r?\\n?", "g");
|
|
@@ -11472,7 +11492,7 @@ function writeShimBlock(file, block2) {
|
|
|
11472
11492
|
if (content.length && !content.endsWith("\n")) content += "\n";
|
|
11473
11493
|
content += block2 + "\n";
|
|
11474
11494
|
}
|
|
11475
|
-
|
|
11495
|
+
mkdirSync7(dirname(file), { recursive: true });
|
|
11476
11496
|
writeFileSync7(file, content);
|
|
11477
11497
|
}
|
|
11478
11498
|
function installClaudeShim(shieldPath) {
|
|
@@ -11516,15 +11536,15 @@ async function runGlobalInstall(opts = {}) {
|
|
|
11516
11536
|
process.exit(1);
|
|
11517
11537
|
}
|
|
11518
11538
|
const apiUrl = opts.apiUrl || process.env["SOLONGATE_API_URL"] || "https://api.solongate.com";
|
|
11519
|
-
|
|
11520
|
-
|
|
11539
|
+
mkdirSync7(p.hooksDir, { recursive: true });
|
|
11540
|
+
mkdirSync7(p.claudeDir, { recursive: true });
|
|
11521
11541
|
unlockProtected();
|
|
11522
|
-
writeFileSync7(
|
|
11523
|
-
writeFileSync7(
|
|
11524
|
-
writeFileSync7(
|
|
11525
|
-
writeFileSync7(
|
|
11542
|
+
writeFileSync7(join12(p.hooksDir, "guard.mjs"), readGuard());
|
|
11543
|
+
writeFileSync7(join12(p.hooksDir, "audit.mjs"), readHook("audit.mjs"));
|
|
11544
|
+
writeFileSync7(join12(p.hooksDir, "stop.mjs"), readHook("stop.mjs"));
|
|
11545
|
+
writeFileSync7(join12(p.hooksDir, "shield.mjs"), readHook("shield.mjs"));
|
|
11526
11546
|
console.log(` Installed hooks \u2192 ${p.hooksDir}`);
|
|
11527
|
-
installClaudeShim(
|
|
11547
|
+
installClaudeShim(join12(p.hooksDir, "shield.mjs"));
|
|
11528
11548
|
writeFileSync7(p.configPath, JSON.stringify({ apiKey, apiUrl }, null, 2) + "\n");
|
|
11529
11549
|
console.log(` Wrote ${p.configPath}`);
|
|
11530
11550
|
let existing = {};
|
|
@@ -11540,9 +11560,9 @@ async function runGlobalInstall(opts = {}) {
|
|
|
11540
11560
|
existing = {};
|
|
11541
11561
|
}
|
|
11542
11562
|
}
|
|
11543
|
-
const guardAbs =
|
|
11544
|
-
const auditAbs =
|
|
11545
|
-
const stopAbs =
|
|
11563
|
+
const guardAbs = join12(p.hooksDir, "guard.mjs").replace(/\\/g, "/");
|
|
11564
|
+
const auditAbs = join12(p.hooksDir, "audit.mjs").replace(/\\/g, "/");
|
|
11565
|
+
const stopAbs = join12(p.hooksDir, "stop.mjs").replace(/\\/g, "/");
|
|
11546
11566
|
const nodeBin = process.execPath.replace(/\\/g, "/");
|
|
11547
11567
|
const call = process.platform === "win32" ? "& " : "";
|
|
11548
11568
|
const hookCmd = (script) => `${call}"${nodeBin}" "${script}" claude-code "Claude Code"`;
|
|
@@ -11734,9 +11754,9 @@ import { spawn as spawn4 } from "child_process";
|
|
|
11734
11754
|
import { URL as URL2 } from "url";
|
|
11735
11755
|
import { readFileSync as readFileSync9, existsSync as existsSync7, readdirSync, statSync as statSync4 } from "fs";
|
|
11736
11756
|
import { resolve as resolve5 } from "path";
|
|
11737
|
-
import { homedir as
|
|
11757
|
+
import { homedir as homedir11 } from "os";
|
|
11738
11758
|
function findCacheFile() {
|
|
11739
|
-
const dir = resolve5(
|
|
11759
|
+
const dir = resolve5(homedir11(), ".solongate");
|
|
11740
11760
|
const envSel = process.env.SOLONGATE_AGENT_ID;
|
|
11741
11761
|
if (envSel) {
|
|
11742
11762
|
const f = resolve5(dir, ".policy-cache-" + envSel.replace(/[^a-zA-Z0-9_-]/g, "_") + ".json");
|
|
@@ -12051,8 +12071,8 @@ __export(logs_server_exports, {
|
|
|
12051
12071
|
});
|
|
12052
12072
|
import { createServer as createServer2 } from "http";
|
|
12053
12073
|
import { readFileSync as readFileSync10, statSync as statSync5 } from "fs";
|
|
12054
|
-
import { resolve as resolve6, join as
|
|
12055
|
-
import { homedir as
|
|
12074
|
+
import { resolve as resolve6, join as join13, isAbsolute } from "path";
|
|
12075
|
+
import { homedir as homedir12 } from "os";
|
|
12056
12076
|
import { readdirSync as readdirSync2 } from "fs";
|
|
12057
12077
|
function allowedOrigins() {
|
|
12058
12078
|
const base = [
|
|
@@ -12069,15 +12089,15 @@ function resolveLocalLogDir(rawPath) {
|
|
|
12069
12089
|
const dir = String(rawPath || "").trim().replace(/[\\/]+$/, "");
|
|
12070
12090
|
if (!dir) return null;
|
|
12071
12091
|
if (isAbsolute(dir)) return dir;
|
|
12072
|
-
return resolve6(
|
|
12092
|
+
return resolve6(homedir12(), ".solongate", "local-logs");
|
|
12073
12093
|
}
|
|
12074
12094
|
async function findLogDir() {
|
|
12075
|
-
const base = resolve6(
|
|
12095
|
+
const base = resolve6(homedir12(), ".solongate");
|
|
12076
12096
|
try {
|
|
12077
12097
|
const files = readdirSync2(base).filter((f) => f.startsWith(".policy-cache-") && f.endsWith(".json"));
|
|
12078
12098
|
for (const f of files) {
|
|
12079
12099
|
try {
|
|
12080
|
-
const c2 = JSON.parse(readFileSync10(
|
|
12100
|
+
const c2 = JSON.parse(readFileSync10(join13(base, f), "utf-8"));
|
|
12081
12101
|
const p = c2?.security?.localLogs?.path;
|
|
12082
12102
|
if (typeof p === "string" && p.trim()) return { dir: resolveLocalLogDir(p), configured: p };
|
|
12083
12103
|
} catch {
|
|
@@ -12086,7 +12106,7 @@ async function findLogDir() {
|
|
|
12086
12106
|
} catch {
|
|
12087
12107
|
}
|
|
12088
12108
|
try {
|
|
12089
|
-
const cfgRaw = readFileSync10(
|
|
12109
|
+
const cfgRaw = readFileSync10(join13(base, "cloud-guard.json"), "utf-8");
|
|
12090
12110
|
const { apiKey, apiUrl } = JSON.parse(cfgRaw);
|
|
12091
12111
|
if (apiKey) {
|
|
12092
12112
|
const url = `${apiUrl || "https://api.solongate.com"}/api/v1/policies/active`;
|
|
@@ -12115,7 +12135,7 @@ function setCors(req, res) {
|
|
|
12115
12135
|
}
|
|
12116
12136
|
function fileInfo(dir) {
|
|
12117
12137
|
if (!dir) return { file: null, exists: false, size: 0, mtimeMs: 0 };
|
|
12118
|
-
const file =
|
|
12138
|
+
const file = join13(dir, LOG_FILENAME);
|
|
12119
12139
|
try {
|
|
12120
12140
|
const st = statSync5(file);
|
|
12121
12141
|
return { file, exists: true, size: st.size, mtimeMs: st.mtimeMs };
|
|
@@ -12565,8 +12585,8 @@ var init_inject = __esm({
|
|
|
12565
12585
|
|
|
12566
12586
|
// src/create.ts
|
|
12567
12587
|
var create_exports = {};
|
|
12568
|
-
import { mkdirSync as
|
|
12569
|
-
import { resolve as resolve8, join as
|
|
12588
|
+
import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, existsSync as existsSync9 } from "fs";
|
|
12589
|
+
import { resolve as resolve8, join as join14 } from "path";
|
|
12570
12590
|
import { execSync as execSync2 } from "child_process";
|
|
12571
12591
|
function withSpinner(message, fn) {
|
|
12572
12592
|
const frames = ["\u28FE", "\u28FD", "\u28FB", "\u28BF", "\u287F", "\u28DF", "\u28EF", "\u28F7"];
|
|
@@ -12646,7 +12666,7 @@ EXAMPLES
|
|
|
12646
12666
|
}
|
|
12647
12667
|
function createProject(dir, name, _policy) {
|
|
12648
12668
|
writeFileSync9(
|
|
12649
|
-
|
|
12669
|
+
join14(dir, "package.json"),
|
|
12650
12670
|
JSON.stringify(
|
|
12651
12671
|
{
|
|
12652
12672
|
name,
|
|
@@ -12676,7 +12696,7 @@ function createProject(dir, name, _policy) {
|
|
|
12676
12696
|
) + "\n"
|
|
12677
12697
|
);
|
|
12678
12698
|
writeFileSync9(
|
|
12679
|
-
|
|
12699
|
+
join14(dir, "tsconfig.json"),
|
|
12680
12700
|
JSON.stringify(
|
|
12681
12701
|
{
|
|
12682
12702
|
compilerOptions: {
|
|
@@ -12696,9 +12716,9 @@ function createProject(dir, name, _policy) {
|
|
|
12696
12716
|
2
|
|
12697
12717
|
) + "\n"
|
|
12698
12718
|
);
|
|
12699
|
-
|
|
12719
|
+
mkdirSync8(join14(dir, "src"), { recursive: true });
|
|
12700
12720
|
writeFileSync9(
|
|
12701
|
-
|
|
12721
|
+
join14(dir, "src", "index.ts"),
|
|
12702
12722
|
`#!/usr/bin/env node
|
|
12703
12723
|
|
|
12704
12724
|
console.log = (...args: unknown[]) => {
|
|
@@ -12740,7 +12760,7 @@ console.log('Press Ctrl+C to stop.');
|
|
|
12740
12760
|
`
|
|
12741
12761
|
);
|
|
12742
12762
|
writeFileSync9(
|
|
12743
|
-
|
|
12763
|
+
join14(dir, ".mcp.json"),
|
|
12744
12764
|
JSON.stringify(
|
|
12745
12765
|
{
|
|
12746
12766
|
mcpServers: {
|
|
@@ -12758,12 +12778,12 @@ console.log('Press Ctrl+C to stop.');
|
|
|
12758
12778
|
) + "\n"
|
|
12759
12779
|
);
|
|
12760
12780
|
writeFileSync9(
|
|
12761
|
-
|
|
12781
|
+
join14(dir, ".env"),
|
|
12762
12782
|
`SOLONGATE_API_KEY=sg_live_YOUR_KEY_HERE
|
|
12763
12783
|
`
|
|
12764
12784
|
);
|
|
12765
12785
|
writeFileSync9(
|
|
12766
|
-
|
|
12786
|
+
join14(dir, ".gitignore"),
|
|
12767
12787
|
`node_modules/
|
|
12768
12788
|
dist/
|
|
12769
12789
|
*.solongate-backup
|
|
@@ -12782,7 +12802,7 @@ async function main3() {
|
|
|
12782
12802
|
process.exit(1);
|
|
12783
12803
|
}
|
|
12784
12804
|
withSpinner(`Setting up ${opts.name}...`, () => {
|
|
12785
|
-
|
|
12805
|
+
mkdirSync8(dir, { recursive: true });
|
|
12786
12806
|
createProject(dir, opts.name, opts.policy);
|
|
12787
12807
|
});
|
|
12788
12808
|
if (!opts.noInstall) {
|
package/dist/tui/index.js
CHANGED
|
@@ -5,6 +5,9 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// src/tui/index.tsx
|
|
8
|
+
import { appendFileSync, mkdirSync as mkdirSync4 } from "fs";
|
|
9
|
+
import { homedir as homedir6 } from "os";
|
|
10
|
+
import { join as join6 } from "path";
|
|
8
11
|
import { render } from "ink";
|
|
9
12
|
|
|
10
13
|
// src/tui/App.tsx
|
|
@@ -970,6 +973,7 @@ function LivePanel({ active: active2 }) {
|
|
|
970
973
|
const inspectFromRef = useRef2("stream");
|
|
971
974
|
const seenRef = useRef2(/* @__PURE__ */ new Set());
|
|
972
975
|
const lastLocalTs = useRef2(0);
|
|
976
|
+
const localSeq = useRef2(0);
|
|
973
977
|
const pausedUntil = useRef2(0);
|
|
974
978
|
const sessRef = useRef2([]);
|
|
975
979
|
const mergedRef = useRef2([]);
|
|
@@ -1015,7 +1019,7 @@ function LivePanel({ active: active2 }) {
|
|
|
1015
1019
|
const at = Date.parse(j.ts ?? "");
|
|
1016
1020
|
if (!Number.isFinite(at) || at <= lastLocalTs.current) continue;
|
|
1017
1021
|
fresh.push({
|
|
1018
|
-
id: "l:" + at + ":" + (j.tool ?? "")
|
|
1022
|
+
id: "l:" + at + ":" + (j.tool ?? "") + ":" + localSeq.current++,
|
|
1019
1023
|
at,
|
|
1020
1024
|
tool: j.tool ?? "?",
|
|
1021
1025
|
decision: j.decision ?? "ALLOW",
|
|
@@ -1139,10 +1143,10 @@ function LivePanel({ active: active2 }) {
|
|
|
1139
1143
|
const startRef = useRef2(Date.now());
|
|
1140
1144
|
const lastNotifyAt = useRef2(0);
|
|
1141
1145
|
const fireAlert = useCallback2(
|
|
1142
|
-
(id, title, msg, level = "warn") => {
|
|
1146
|
+
(id, title, msg, level = "warn", desktop = true) => {
|
|
1143
1147
|
pushLog(`${level === "bad" ? "\u26D4" : "\u23F8"} ${msg}`, level);
|
|
1144
1148
|
setAlerts((a) => [...a.filter((x) => x.id !== id), { id, msg, level, until: Date.now() + 15e3 }].slice(-4));
|
|
1145
|
-
if (!CONFIG.notifications) return;
|
|
1149
|
+
if (!desktop || !CONFIG.notifications) return;
|
|
1146
1150
|
if (Date.now() - lastNotifyAt.current < 3e3) return;
|
|
1147
1151
|
lastNotifyAt.current = Date.now();
|
|
1148
1152
|
try {
|
|
@@ -1159,7 +1163,7 @@ function LivePanel({ active: active2 }) {
|
|
|
1159
1163
|
const prev = prevStatus.current.get(r.id);
|
|
1160
1164
|
if (prev && prev === "active" && r.status === "idle") {
|
|
1161
1165
|
const name = r.isMe ? `${r.agent} (this machine)` : r.agent;
|
|
1162
|
-
fireAlert("idle:" + r.id, "Agent idle", `${name} went IDLE, no tool call for 60s`, "warn");
|
|
1166
|
+
fireAlert("idle:" + r.id, "Agent idle", `${name} went IDLE, no tool call for 60s`, "warn", false);
|
|
1163
1167
|
}
|
|
1164
1168
|
prevStatus.current.set(r.id, r.status);
|
|
1165
1169
|
}
|
|
@@ -3436,10 +3440,26 @@ async function launchTui() {
|
|
|
3436
3440
|
return;
|
|
3437
3441
|
}
|
|
3438
3442
|
process.stdout.write("\x1B[?1049h\x1B[H");
|
|
3443
|
+
const debugLog = join6(homedir6(), ".solongate", "dataroom-debug.log");
|
|
3444
|
+
const saved = { log: console.log, warn: console.warn, error: console.error, info: console.info, debug: console.debug };
|
|
3445
|
+
const toFile = (level) => (...args) => {
|
|
3446
|
+
try {
|
|
3447
|
+
mkdirSync4(join6(homedir6(), ".solongate"), { recursive: true });
|
|
3448
|
+
appendFileSync(debugLog, `${(/* @__PURE__ */ new Date()).toISOString()} [${level}] ${args.map((a) => typeof a === "string" ? a : JSON.stringify(a)).join(" ")}
|
|
3449
|
+
`);
|
|
3450
|
+
} catch {
|
|
3451
|
+
}
|
|
3452
|
+
};
|
|
3453
|
+
console.log = toFile("log");
|
|
3454
|
+
console.warn = toFile("warn");
|
|
3455
|
+
console.error = toFile("error");
|
|
3456
|
+
console.info = toFile("info");
|
|
3457
|
+
console.debug = toFile("debug");
|
|
3439
3458
|
try {
|
|
3440
|
-
const { waitUntilExit } = render(/* @__PURE__ */ jsx10(App, {}));
|
|
3459
|
+
const { waitUntilExit } = render(/* @__PURE__ */ jsx10(App, {}), { patchConsole: false });
|
|
3441
3460
|
await waitUntilExit();
|
|
3442
3461
|
} finally {
|
|
3462
|
+
Object.assign(console, saved);
|
|
3443
3463
|
process.stdout.write("\x1B[?1049l");
|
|
3444
3464
|
}
|
|
3445
3465
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.43",
|
|
4
4
|
"description": "AI tool security proxy: protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. No code changes required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|