gdharness 1.3.54 → 1.3.56
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/build/keeper.js
CHANGED
|
@@ -6946,7 +6946,7 @@ var require_public_api = __commonJS(function(exports) {
|
|
|
6946
6946
|
});
|
|
6947
6947
|
|
|
6948
6948
|
// src/keeper.ts
|
|
6949
|
-
import { closeSync as closeSync3, existsSync as
|
|
6949
|
+
import { closeSync as closeSync3, existsSync as existsSync3, mkdtempSync as mkdtempSync4, openSync as openSync4, readFileSync as readFileSync9, rmSync as rmSync7, writeFileSync as writeFileSync4 } from "node:fs";
|
|
6950
6950
|
import { tmpdir as tmpdir8 } from "node:os";
|
|
6951
6951
|
import { join as join10 } from "node:path";
|
|
6952
6952
|
import { setTimeout as delay3 } from "node:timers/promises";
|
|
@@ -7435,7 +7435,6 @@ function throughHelper(how, command, args, files, assembly = helperAssembly()) {
|
|
|
7435
7435
|
// src/engine-slots.ts
|
|
7436
7436
|
import {
|
|
7437
7437
|
closeSync as closeSync2,
|
|
7438
|
-
existsSync as existsSync2,
|
|
7439
7438
|
mkdirSync,
|
|
7440
7439
|
openSync as openSync2,
|
|
7441
7440
|
readdirSync,
|
|
@@ -7451,721 +7450,200 @@ import process4 from "node:process";
|
|
|
7451
7450
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7452
7451
|
var current = new AsyncLocalStorage;
|
|
7453
7452
|
|
|
7454
|
-
// src/
|
|
7455
|
-
import {
|
|
7453
|
+
// src/process-table.ts
|
|
7454
|
+
import { tmpdir as tmpdir4 } from "node:os";
|
|
7456
7455
|
|
|
7457
|
-
//
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
var
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
var $YAMLParseError = errors.YAMLParseError;
|
|
7479
|
-
var $YAMLWarning = errors.YAMLWarning;
|
|
7480
|
-
var $Alias = Alias.Alias;
|
|
7481
|
-
var $isAlias = identity.isAlias;
|
|
7482
|
-
var $isCollection = identity.isCollection;
|
|
7483
|
-
var $isDocument = identity.isDocument;
|
|
7484
|
-
var $isMap = identity.isMap;
|
|
7485
|
-
var $isNode = identity.isNode;
|
|
7486
|
-
var $isPair = identity.isPair;
|
|
7487
|
-
var $isScalar = identity.isScalar;
|
|
7488
|
-
var $isSeq = identity.isSeq;
|
|
7489
|
-
var $Pair = Pair.Pair;
|
|
7490
|
-
var $Scalar = Scalar.Scalar;
|
|
7491
|
-
var $YAMLMap = YAMLMap.YAMLMap;
|
|
7492
|
-
var $YAMLSeq = YAMLSeq.YAMLSeq;
|
|
7493
|
-
var $Lexer = lexer.Lexer;
|
|
7494
|
-
var $LineCounter = lineCounter.LineCounter;
|
|
7495
|
-
var $Parser = parser.Parser;
|
|
7496
|
-
var $parse = publicApi.parse;
|
|
7497
|
-
var $parseAllDocuments = publicApi.parseAllDocuments;
|
|
7498
|
-
var $parseDocument = publicApi.parseDocument;
|
|
7499
|
-
var $stringify = publicApi.stringify;
|
|
7500
|
-
var $visit = visit.visit;
|
|
7501
|
-
var $visitAsync = visit.visitAsync;
|
|
7456
|
+
// src/windows-ask.ts
|
|
7457
|
+
import { tmpdir as tmpdir3 } from "node:os";
|
|
7458
|
+
import process3 from "node:process";
|
|
7459
|
+
var SCRIPT = [
|
|
7460
|
+
"[Console]::OutputEncoding = [Text.Encoding]::UTF8",
|
|
7461
|
+
"$in = [Console]::In",
|
|
7462
|
+
"while ($null -ne ($line = $in.ReadLine())) {",
|
|
7463
|
+
' $parts = $line.Split(" ", 2)',
|
|
7464
|
+
" try {",
|
|
7465
|
+
" $asked = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($parts[1]))",
|
|
7466
|
+
" $said = (& ([ScriptBlock]::Create($asked)) | Out-String -Width 1000000)",
|
|
7467
|
+
' $tag = "OK"',
|
|
7468
|
+
" } catch {",
|
|
7469
|
+
" $said = $_.Exception.Message",
|
|
7470
|
+
' $tag = "ERR"',
|
|
7471
|
+
" }",
|
|
7472
|
+
' [Console]::Out.Write($parts[0] + " " + $tag + " " + [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($said)) + "`n")',
|
|
7473
|
+
" [Console]::Out.Flush()",
|
|
7474
|
+
"}"
|
|
7475
|
+
].join(`
|
|
7476
|
+
`);
|
|
7502
7477
|
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
function realAsFarAsItExists(path) {
|
|
7507
|
-
const missing = [];
|
|
7508
|
-
let at = path;
|
|
7509
|
-
for (;; ) {
|
|
7510
|
-
try {
|
|
7511
|
-
return join2(realpathSync.native(at), ...missing);
|
|
7512
|
-
} catch {
|
|
7513
|
-
const parent = dirname(at);
|
|
7514
|
-
if (parent === at) {
|
|
7515
|
-
return path;
|
|
7516
|
-
}
|
|
7517
|
-
missing.unshift(basename(at));
|
|
7518
|
-
at = parent;
|
|
7519
|
-
}
|
|
7478
|
+
class WindowsAskFailure extends Error {
|
|
7479
|
+
constructor(how) {
|
|
7480
|
+
super(`PowerShell ${how}`);
|
|
7520
7481
|
}
|
|
7521
7482
|
}
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
var
|
|
7525
|
-
|
|
7526
|
-
|
|
7483
|
+
var helper = null;
|
|
7484
|
+
var buffered = "";
|
|
7485
|
+
var next = 1;
|
|
7486
|
+
var out = null;
|
|
7487
|
+
var queued = [];
|
|
7488
|
+
var held = false;
|
|
7489
|
+
function holding(child, wanted) {
|
|
7490
|
+
if (held === wanted) {
|
|
7491
|
+
return;
|
|
7492
|
+
}
|
|
7493
|
+
held = wanted;
|
|
7494
|
+
const stdout = child.stdout;
|
|
7495
|
+
if (wanted) {
|
|
7496
|
+
stdout.ref?.();
|
|
7497
|
+
} else {
|
|
7498
|
+
stdout.unref?.();
|
|
7499
|
+
}
|
|
7527
7500
|
}
|
|
7528
|
-
function
|
|
7529
|
-
|
|
7530
|
-
|
|
7501
|
+
function running() {
|
|
7502
|
+
if (helper?.exitCode === null && helper.signalCode === null) {
|
|
7503
|
+
return helper;
|
|
7504
|
+
}
|
|
7505
|
+
const child = spawnHidden("powershell.exe", [
|
|
7506
|
+
"-NoProfile",
|
|
7507
|
+
"-NonInteractive",
|
|
7508
|
+
"-ExecutionPolicy",
|
|
7509
|
+
"Bypass",
|
|
7510
|
+
"-EncodedCommand",
|
|
7511
|
+
Buffer.from(SCRIPT, "utf16le").toString("base64")
|
|
7512
|
+
], { cwd: tmpdir3() });
|
|
7513
|
+
buffered = "";
|
|
7514
|
+
child.stdout.setEncoding("utf8");
|
|
7515
|
+
child.stdout.on("data", (chunk) => {
|
|
7516
|
+
buffered += chunk;
|
|
7517
|
+
for (let end = buffered.indexOf(`
|
|
7518
|
+
`);end !== -1; end = buffered.indexOf(`
|
|
7519
|
+
`)) {
|
|
7520
|
+
answered(buffered.slice(0, end).trim());
|
|
7521
|
+
buffered = buffered.slice(end + 1);
|
|
7522
|
+
}
|
|
7523
|
+
});
|
|
7524
|
+
child.stderr.resume();
|
|
7525
|
+
child.stdin.on("error", () => {});
|
|
7526
|
+
const gone = () => {
|
|
7527
|
+
if (helper !== child) {
|
|
7528
|
+
return;
|
|
7529
|
+
}
|
|
7530
|
+
helper = null;
|
|
7531
|
+
if (out !== null) {
|
|
7532
|
+
clearTimeout(out.timer);
|
|
7533
|
+
out.question.reject(new WindowsAskFailure("exited before it answered"));
|
|
7534
|
+
out = null;
|
|
7535
|
+
}
|
|
7536
|
+
sendNext();
|
|
7537
|
+
};
|
|
7538
|
+
child.once("exit", gone);
|
|
7539
|
+
child.once("error", gone);
|
|
7540
|
+
child.unref();
|
|
7541
|
+
child.stdin.unref?.();
|
|
7542
|
+
child.stderr.unref?.();
|
|
7543
|
+
held = true;
|
|
7544
|
+
holding(child, false);
|
|
7545
|
+
helper = child;
|
|
7546
|
+
return child;
|
|
7531
7547
|
}
|
|
7532
|
-
function
|
|
7533
|
-
|
|
7548
|
+
function answered(line) {
|
|
7549
|
+
const [id, tag, body] = line.split(" ");
|
|
7550
|
+
if (out === null || out.id !== Number(id)) {
|
|
7551
|
+
return;
|
|
7552
|
+
}
|
|
7553
|
+
const { question, timer } = out;
|
|
7554
|
+
clearTimeout(timer);
|
|
7555
|
+
out = null;
|
|
7556
|
+
const said = Buffer.from(body ?? "", "base64").toString("utf8");
|
|
7557
|
+
if (tag === "OK") {
|
|
7558
|
+
question.resolve(said);
|
|
7559
|
+
} else {
|
|
7560
|
+
question.reject(new WindowsAskFailure(`refused the question: ${said.trim() || "no reason given"}`));
|
|
7561
|
+
}
|
|
7562
|
+
sendNext();
|
|
7534
7563
|
}
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
file: ".mcp.json",
|
|
7541
|
-
container: "mcpServers",
|
|
7542
|
-
shape: "plain",
|
|
7543
|
-
home: ".claude",
|
|
7544
|
-
marker: ".claude",
|
|
7545
|
-
skills: { dir: join3(".claude", "skills"), shared: false }
|
|
7546
|
-
},
|
|
7547
|
-
{
|
|
7548
|
-
id: "copilot-cli",
|
|
7549
|
-
name: "Copilot CLI",
|
|
7550
|
-
scope: "project",
|
|
7551
|
-
file: ".mcp.json",
|
|
7552
|
-
container: "mcpServers",
|
|
7553
|
-
shape: "plain",
|
|
7554
|
-
home: ".copilot",
|
|
7555
|
-
skills: { dir: join3(".github", "skills"), shared: true },
|
|
7556
|
-
manual: "Trust the folder when Copilot CLI first asks, or it reads no config here."
|
|
7557
|
-
},
|
|
7558
|
-
{
|
|
7559
|
-
id: "qoder",
|
|
7560
|
-
name: "Qoder",
|
|
7561
|
-
scope: "project",
|
|
7562
|
-
file: ".mcp.json",
|
|
7563
|
-
container: "mcpServers",
|
|
7564
|
-
shape: "plain",
|
|
7565
|
-
home: ".qoder",
|
|
7566
|
-
marker: ".qoder"
|
|
7567
|
-
},
|
|
7568
|
-
{
|
|
7569
|
-
id: "command-code",
|
|
7570
|
-
name: "Command Code",
|
|
7571
|
-
scope: "project",
|
|
7572
|
-
file: ".mcp.json",
|
|
7573
|
-
container: "mcpServers",
|
|
7574
|
-
shape: "plain",
|
|
7575
|
-
home: ".commandcode"
|
|
7576
|
-
},
|
|
7577
|
-
{
|
|
7578
|
-
id: "cursor",
|
|
7579
|
-
name: "Cursor",
|
|
7580
|
-
scope: "project",
|
|
7581
|
-
file: join3(".cursor", "mcp.json"),
|
|
7582
|
-
container: "mcpServers",
|
|
7583
|
-
shape: "plain",
|
|
7584
|
-
home: ".cursor",
|
|
7585
|
-
skills: { dir: join3(".cursor", "skills"), shared: true },
|
|
7586
|
-
manual: "Cursor asks before each tool call by default, and the server can be toggled off."
|
|
7587
|
-
},
|
|
7588
|
-
{
|
|
7589
|
-
id: "vscode",
|
|
7590
|
-
name: "VS Code",
|
|
7591
|
-
scope: "project",
|
|
7592
|
-
file: join3(".vscode", "mcp.json"),
|
|
7593
|
-
container: "servers",
|
|
7594
|
-
shape: "typed",
|
|
7595
|
-
home: ".vscode",
|
|
7596
|
-
skills: { dir: join3(".github", "skills"), shared: true },
|
|
7597
|
-
manual: "VS Code asks you to trust a server the first time it starts one."
|
|
7598
|
-
},
|
|
7599
|
-
{
|
|
7600
|
-
id: "opencode",
|
|
7601
|
-
name: "opencode",
|
|
7602
|
-
scope: "project",
|
|
7603
|
-
file: "opencode.json",
|
|
7604
|
-
container: "mcp",
|
|
7605
|
-
shape: "opencode",
|
|
7606
|
-
home: join3(".config", "opencode"),
|
|
7607
|
-
marker: ".opencode",
|
|
7608
|
-
skills: { dir: join3(".opencode", "skills"), shared: true }
|
|
7609
|
-
},
|
|
7610
|
-
{
|
|
7611
|
-
id: "junie",
|
|
7612
|
-
name: "Junie",
|
|
7613
|
-
scope: "project",
|
|
7614
|
-
file: join3(".junie", "mcp", "mcp.json"),
|
|
7615
|
-
container: "mcpServers",
|
|
7616
|
-
shape: "plain",
|
|
7617
|
-
home: ".junie",
|
|
7618
|
-
skills: { dir: join3(".junie", "skills"), shared: true }
|
|
7619
|
-
},
|
|
7620
|
-
{
|
|
7621
|
-
id: "kiro",
|
|
7622
|
-
name: "Kiro",
|
|
7623
|
-
scope: "project",
|
|
7624
|
-
file: join3(".kiro", "settings", "mcp.json"),
|
|
7625
|
-
container: "mcpServers",
|
|
7626
|
-
shape: "plain",
|
|
7627
|
-
home: ".kiro",
|
|
7628
|
-
skills: { dir: join3(".kiro", "skills"), shared: false }
|
|
7629
|
-
},
|
|
7630
|
-
{
|
|
7631
|
-
id: "gemini",
|
|
7632
|
-
name: "Gemini CLI",
|
|
7633
|
-
scope: "project",
|
|
7634
|
-
file: join3(".gemini", "settings.json"),
|
|
7635
|
-
container: "mcpServers",
|
|
7636
|
-
shape: "plain",
|
|
7637
|
-
home: ".gemini",
|
|
7638
|
-
skills: { dir: join3(".gemini", "skills"), shared: true }
|
|
7639
|
-
},
|
|
7640
|
-
{
|
|
7641
|
-
id: "roo",
|
|
7642
|
-
name: "Roo Code",
|
|
7643
|
-
scope: "project",
|
|
7644
|
-
file: join3(".roo", "mcp.json"),
|
|
7645
|
-
container: "mcpServers",
|
|
7646
|
-
shape: "plain"
|
|
7647
|
-
},
|
|
7648
|
-
{
|
|
7649
|
-
id: "kilo",
|
|
7650
|
-
name: "Kilo Code",
|
|
7651
|
-
scope: "project",
|
|
7652
|
-
file: join3(".kilocode", "mcp.json"),
|
|
7653
|
-
container: "mcpServers",
|
|
7654
|
-
shape: "plain"
|
|
7655
|
-
},
|
|
7656
|
-
{
|
|
7657
|
-
id: "amazon-q",
|
|
7658
|
-
name: "Amazon Q Developer CLI",
|
|
7659
|
-
scope: "project",
|
|
7660
|
-
file: join3(".amazonq", "mcp.json"),
|
|
7661
|
-
container: "mcpServers",
|
|
7662
|
-
shape: "plain",
|
|
7663
|
-
home: join3(".aws", "amazonq")
|
|
7664
|
-
},
|
|
7665
|
-
{
|
|
7666
|
-
id: "zed",
|
|
7667
|
-
name: "Zed",
|
|
7668
|
-
scope: "project",
|
|
7669
|
-
file: join3(".zed", "settings.json"),
|
|
7670
|
-
container: "context_servers",
|
|
7671
|
-
shape: "plain"
|
|
7672
|
-
},
|
|
7673
|
-
{
|
|
7674
|
-
id: "amp",
|
|
7675
|
-
name: "Amp",
|
|
7676
|
-
scope: "project",
|
|
7677
|
-
file: join3(".amp", "settings.json"),
|
|
7678
|
-
container: "amp.mcpServers",
|
|
7679
|
-
shape: "plain",
|
|
7680
|
-
home: join3(".config", "amp")
|
|
7681
|
-
},
|
|
7682
|
-
{
|
|
7683
|
-
id: "warp",
|
|
7684
|
-
name: "Warp",
|
|
7685
|
-
scope: "project",
|
|
7686
|
-
file: join3(".warp", ".mcp.json"),
|
|
7687
|
-
container: "mcpServers",
|
|
7688
|
-
shape: "plain",
|
|
7689
|
-
home: ".warp",
|
|
7690
|
-
manual: "Warp starts a project server only once you toggle it on, on its MCP servers page."
|
|
7691
|
-
},
|
|
7692
|
-
{
|
|
7693
|
-
id: "trae",
|
|
7694
|
-
name: "Trae",
|
|
7695
|
-
scope: "project",
|
|
7696
|
-
file: join3(".trae", "mcp.json"),
|
|
7697
|
-
container: "mcpServers",
|
|
7698
|
-
shape: "plain",
|
|
7699
|
-
home: ".trae"
|
|
7700
|
-
},
|
|
7701
|
-
{
|
|
7702
|
-
id: "factory",
|
|
7703
|
-
name: "Factory Droid",
|
|
7704
|
-
scope: "project",
|
|
7705
|
-
file: join3(".factory", "mcp.json"),
|
|
7706
|
-
container: "mcpServers",
|
|
7707
|
-
shape: "typed",
|
|
7708
|
-
home: ".factory"
|
|
7709
|
-
},
|
|
7710
|
-
{
|
|
7711
|
-
id: "tabnine",
|
|
7712
|
-
name: "Tabnine",
|
|
7713
|
-
scope: "project",
|
|
7714
|
-
file: join3(".tabnine", "mcp_servers.json"),
|
|
7715
|
-
container: "mcpServers",
|
|
7716
|
-
shape: "plain",
|
|
7717
|
-
home: ".tabnine"
|
|
7718
|
-
},
|
|
7719
|
-
{
|
|
7720
|
-
id: "firebender",
|
|
7721
|
-
name: "Firebender",
|
|
7722
|
-
scope: "project",
|
|
7723
|
-
file: "firebender.json",
|
|
7724
|
-
container: "mcpServers",
|
|
7725
|
-
shape: "plain"
|
|
7726
|
-
},
|
|
7727
|
-
{
|
|
7728
|
-
id: "pi",
|
|
7729
|
-
name: "pi",
|
|
7730
|
-
scope: "project",
|
|
7731
|
-
file: join3(".pi", "mcp.json"),
|
|
7732
|
-
container: "mcpServers",
|
|
7733
|
-
shape: "plain",
|
|
7734
|
-
home: ".pi"
|
|
7735
|
-
},
|
|
7736
|
-
{
|
|
7737
|
-
id: "mistral-vibe",
|
|
7738
|
-
name: "Mistral Vibe",
|
|
7739
|
-
scope: "project",
|
|
7740
|
-
file: join3(".vibe", "config.toml"),
|
|
7741
|
-
container: "mcp_servers",
|
|
7742
|
-
shape: "plain",
|
|
7743
|
-
toml: {
|
|
7744
|
-
header: "[[mcp_servers]]",
|
|
7745
|
-
identity: `name = "${SERVER_KEY}"`,
|
|
7746
|
-
block: (launch) => [
|
|
7747
|
-
"[[mcp_servers]]",
|
|
7748
|
-
`name = "${SERVER_KEY}"`,
|
|
7749
|
-
'transport = "stdio"',
|
|
7750
|
-
`command = "${launch.command}"`,
|
|
7751
|
-
`args = ${tomlArray(launch.args)}`,
|
|
7752
|
-
tomlEnv(launch)
|
|
7753
|
-
].join(`
|
|
7754
|
-
`)
|
|
7564
|
+
function sendNext() {
|
|
7565
|
+
const question = queued.shift();
|
|
7566
|
+
if (question === undefined) {
|
|
7567
|
+
if (helper !== null) {
|
|
7568
|
+
holding(helper, false);
|
|
7755
7569
|
}
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
toml: {
|
|
7766
|
-
header: "[[mcp.providers]]",
|
|
7767
|
-
identity: `name = "${SERVER_KEY}"`,
|
|
7768
|
-
enable: { header: "[mcp]", line: "enabled = true" },
|
|
7769
|
-
block: (launch) => [
|
|
7770
|
-
"[[mcp.providers]]",
|
|
7771
|
-
`name = "${SERVER_KEY}"`,
|
|
7772
|
-
"enabled = true",
|
|
7773
|
-
`command = "${launch.command}"`,
|
|
7774
|
-
`args = ${tomlArray(launch.args)}`,
|
|
7775
|
-
tomlEnv(launch)
|
|
7776
|
-
].join(`
|
|
7777
|
-
`)
|
|
7570
|
+
return;
|
|
7571
|
+
}
|
|
7572
|
+
const child = running();
|
|
7573
|
+
holding(child, true);
|
|
7574
|
+
const id = next;
|
|
7575
|
+
next += 1;
|
|
7576
|
+
const timer = setTimeout(() => {
|
|
7577
|
+
if (out?.id !== id) {
|
|
7578
|
+
return;
|
|
7778
7579
|
}
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
scope: "project",
|
|
7784
|
-
file: "fastagent.config.yaml",
|
|
7785
|
-
container: "mcp",
|
|
7786
|
-
shape: "plain",
|
|
7787
|
-
yaml: {
|
|
7788
|
-
path: ["mcp", "servers", SERVER_KEY],
|
|
7789
|
-
entry: (launch) => ({ command: launch.command, args: [...launch.args], env: { ...launch.env } })
|
|
7580
|
+
out = null;
|
|
7581
|
+
question.reject(new WindowsAskFailure(`did not answer within ${question.withinMs}ms`));
|
|
7582
|
+
if (helper === child) {
|
|
7583
|
+
helper = null;
|
|
7790
7584
|
}
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
tomlEnv(launch)
|
|
7807
|
-
].join(`
|
|
7808
|
-
`)
|
|
7585
|
+
child.kill();
|
|
7586
|
+
sendNext();
|
|
7587
|
+
}, question.withinMs);
|
|
7588
|
+
out = { id, question, timer };
|
|
7589
|
+
child.stdin.write(`${id} ${Buffer.from(question.script, "utf8").toString("base64")}
|
|
7590
|
+
`);
|
|
7591
|
+
}
|
|
7592
|
+
function askWindows(script, withinMs) {
|
|
7593
|
+
if (process3.platform !== "win32") {
|
|
7594
|
+
return Promise.reject(new WindowsAskFailure("is asked only on Windows"));
|
|
7595
|
+
}
|
|
7596
|
+
return new Promise((resolve, reject) => {
|
|
7597
|
+
queued.push({ script, withinMs, resolve, reject });
|
|
7598
|
+
if (out === null) {
|
|
7599
|
+
sendNext();
|
|
7809
7600
|
}
|
|
7810
|
-
}
|
|
7811
|
-
{
|
|
7812
|
-
id: "cline",
|
|
7813
|
-
name: "Cline",
|
|
7814
|
-
scope: "home",
|
|
7815
|
-
file: join3(".cline", "data", "settings", "cline_mcp_settings.json"),
|
|
7816
|
-
container: "mcpServers",
|
|
7817
|
-
shape: "plain",
|
|
7818
|
-
marker: ".cline",
|
|
7819
|
-
skills: { dir: join3(".cline", "skills"), shared: false }
|
|
7820
|
-
},
|
|
7821
|
-
{
|
|
7822
|
-
id: "goose",
|
|
7823
|
-
name: "Goose",
|
|
7824
|
-
scope: "home",
|
|
7825
|
-
file: {
|
|
7826
|
-
win32: { appData: join3("Block", "goose", "config", "config.yaml") },
|
|
7827
|
-
darwin: join3(".config", "goose", "config.yaml"),
|
|
7828
|
-
linux: join3(".config", "goose", "config.yaml")
|
|
7829
|
-
},
|
|
7830
|
-
container: "extensions",
|
|
7831
|
-
shape: "plain",
|
|
7832
|
-
yaml: {
|
|
7833
|
-
path: ["extensions", SERVER_KEY],
|
|
7834
|
-
entry: (launch) => ({
|
|
7835
|
-
name: SERVER_KEY,
|
|
7836
|
-
type: "stdio",
|
|
7837
|
-
enabled: true,
|
|
7838
|
-
cmd: launch.command,
|
|
7839
|
-
args: [...launch.args],
|
|
7840
|
-
envs: { ...launch.env },
|
|
7841
|
-
timeout: 300
|
|
7842
|
-
})
|
|
7843
|
-
}
|
|
7844
|
-
},
|
|
7845
|
-
{
|
|
7846
|
-
id: "windsurf",
|
|
7847
|
-
name: "Windsurf",
|
|
7848
|
-
scope: "home",
|
|
7849
|
-
file: join3(".codeium", "windsurf", "mcp_config.json"),
|
|
7850
|
-
container: "mcpServers",
|
|
7851
|
-
shape: "plain",
|
|
7852
|
-
skills: { dir: join3(".windsurf", "skills"), shared: true }
|
|
7853
|
-
},
|
|
7854
|
-
{
|
|
7855
|
-
id: "hermes",
|
|
7856
|
-
name: "Hermes",
|
|
7857
|
-
scope: "home",
|
|
7858
|
-
file: join3(".hermes", "config.yaml"),
|
|
7859
|
-
container: "mcp_servers",
|
|
7860
|
-
shape: "plain",
|
|
7861
|
-
skills: { dir: join3(".hermes", "skills"), shared: true },
|
|
7862
|
-
yaml: {
|
|
7863
|
-
path: ["mcp_servers", SERVER_KEY],
|
|
7864
|
-
entry: (launch) => ({
|
|
7865
|
-
command: launch.command,
|
|
7866
|
-
args: [...launch.args],
|
|
7867
|
-
env: { ...launch.env },
|
|
7868
|
-
enabled: true
|
|
7869
|
-
})
|
|
7870
|
-
}
|
|
7871
|
-
},
|
|
7872
|
-
{
|
|
7873
|
-
id: "openclaw",
|
|
7874
|
-
name: "OpenClaw",
|
|
7875
|
-
scope: "home",
|
|
7876
|
-
file: join3(".openclaw", "openclaw.json"),
|
|
7877
|
-
container: "mcpServers",
|
|
7878
|
-
shape: "plain"
|
|
7879
|
-
},
|
|
7880
|
-
{
|
|
7881
|
-
id: "claude-desktop",
|
|
7882
|
-
name: "Claude Desktop",
|
|
7883
|
-
scope: "home",
|
|
7884
|
-
file: {
|
|
7885
|
-
win32: { appData: join3("Claude", "claude_desktop_config.json") },
|
|
7886
|
-
darwin: join3("Library", "Application Support", "Claude", "claude_desktop_config.json"),
|
|
7887
|
-
linux: join3(".config", "Claude", "claude_desktop_config.json")
|
|
7888
|
-
},
|
|
7889
|
-
container: "mcpServers",
|
|
7890
|
-
shape: "plain"
|
|
7891
|
-
},
|
|
7892
|
-
{
|
|
7893
|
-
id: "zeroclaw",
|
|
7894
|
-
name: "ZeroClaw",
|
|
7895
|
-
scope: "home",
|
|
7896
|
-
file: join3(".zeroclaw", "config.toml"),
|
|
7897
|
-
container: "mcp.servers",
|
|
7898
|
-
shape: "plain",
|
|
7899
|
-
toml: {
|
|
7900
|
-
header: "[[mcp.servers]]",
|
|
7901
|
-
identity: `name = "${SERVER_KEY}"`,
|
|
7902
|
-
enable: { header: "[mcp]", line: "enabled = true" },
|
|
7903
|
-
block: (launch) => [
|
|
7904
|
-
"[[mcp.servers]]",
|
|
7905
|
-
`name = "${SERVER_KEY}"`,
|
|
7906
|
-
`command = "${launch.command}"`,
|
|
7907
|
-
`args = ${tomlArray(launch.args)}`,
|
|
7908
|
-
tomlEnv(launch)
|
|
7909
|
-
].join(`
|
|
7910
|
-
`)
|
|
7911
|
-
}
|
|
7912
|
-
},
|
|
7913
|
-
{
|
|
7914
|
-
id: "deepcode",
|
|
7915
|
-
name: "Deep Code",
|
|
7916
|
-
scope: "home",
|
|
7917
|
-
file: join3(".deepcode", "settings.json"),
|
|
7918
|
-
container: "mcpServers",
|
|
7919
|
-
shape: "plain"
|
|
7920
|
-
},
|
|
7921
|
-
{
|
|
7922
|
-
id: "nanobot",
|
|
7923
|
-
name: "nanobot",
|
|
7924
|
-
scope: "home",
|
|
7925
|
-
file: join3(".nanobot", "config.json"),
|
|
7926
|
-
container: "mcpServers",
|
|
7927
|
-
shape: "plain",
|
|
7928
|
-
snippet: (launch) => jsonSnippet(launch, "mcpServers", "plain")
|
|
7929
|
-
},
|
|
7930
|
-
{
|
|
7931
|
-
id: "autohand",
|
|
7932
|
-
name: "Autohand",
|
|
7933
|
-
scope: "home",
|
|
7934
|
-
file: join3(".autohand", "config.json"),
|
|
7935
|
-
container: "mcpServers",
|
|
7936
|
-
shape: "plain",
|
|
7937
|
-
snippet: (launch) => jsonSnippet(launch, "mcpServers", "plain")
|
|
7938
|
-
}
|
|
7939
|
-
];
|
|
7940
|
-
var OURS = ["GODOT_PATH", "GDHARNESS_PROJECT"];
|
|
7941
|
-
function environmentFor(launch, held) {
|
|
7942
|
-
const kept = {};
|
|
7943
|
-
if (typeof held === "object" && held !== null && !Array.isArray(held)) {
|
|
7944
|
-
for (const [name, value] of Object.entries(held)) {
|
|
7945
|
-
if (typeof value === "string" && !OURS.includes(name)) {
|
|
7946
|
-
kept[name] = value;
|
|
7947
|
-
}
|
|
7948
|
-
}
|
|
7949
|
-
}
|
|
7950
|
-
return { ...kept, ...launch.env };
|
|
7951
|
-
}
|
|
7952
|
-
function entryFor(shape, launch, held) {
|
|
7953
|
-
const before = typeof held === "object" && held !== null && !Array.isArray(held) ? { ...held } : {};
|
|
7954
|
-
if (shape === "opencode") {
|
|
7955
|
-
return {
|
|
7956
|
-
...before,
|
|
7957
|
-
type: "local",
|
|
7958
|
-
command: [launch.command, ...launch.args],
|
|
7959
|
-
environment: environmentFor(launch, before["environment"]),
|
|
7960
|
-
enabled: true
|
|
7961
|
-
};
|
|
7962
|
-
}
|
|
7963
|
-
return {
|
|
7964
|
-
...before,
|
|
7965
|
-
...shape === "typed" ? { type: "stdio" } : {},
|
|
7966
|
-
command: launch.command,
|
|
7967
|
-
args: [...launch.args],
|
|
7968
|
-
env: environmentFor(launch, before["env"])
|
|
7969
|
-
};
|
|
7601
|
+
});
|
|
7970
7602
|
}
|
|
7971
7603
|
|
|
7972
|
-
// src/log-read.ts
|
|
7973
|
-
var LOG_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
7974
|
-
|
|
7975
7604
|
// src/process-table.ts
|
|
7976
|
-
|
|
7605
|
+
var SOURCE2 = String.raw`
|
|
7606
|
+
using System;
|
|
7607
|
+
using System.Collections.Generic;
|
|
7608
|
+
using System.Globalization;
|
|
7609
|
+
using System.Runtime.InteropServices;
|
|
7610
|
+
using System.Text;
|
|
7977
7611
|
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
"[Console]::OutputEncoding = [Text.Encoding]::UTF8",
|
|
7983
|
-
"$in = [Console]::In",
|
|
7984
|
-
"while ($null -ne ($line = $in.ReadLine())) {",
|
|
7985
|
-
' $parts = $line.Split(" ", 2)',
|
|
7986
|
-
" try {",
|
|
7987
|
-
" $asked = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($parts[1]))",
|
|
7988
|
-
" $said = (& ([ScriptBlock]::Create($asked)) | Out-String -Width 1000000)",
|
|
7989
|
-
' $tag = "OK"',
|
|
7990
|
-
" } catch {",
|
|
7991
|
-
" $said = $_.Exception.Message",
|
|
7992
|
-
' $tag = "ERR"',
|
|
7993
|
-
" }",
|
|
7994
|
-
' [Console]::Out.Write($parts[0] + " " + $tag + " " + [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($said)) + "`n")',
|
|
7995
|
-
" [Console]::Out.Flush()",
|
|
7996
|
-
"}"
|
|
7997
|
-
].join(`
|
|
7998
|
-
`);
|
|
7612
|
+
public static class GdhProcessTable
|
|
7613
|
+
{
|
|
7614
|
+
[DllImport("ntdll.dll")]
|
|
7615
|
+
private static extern int NtQuerySystemInformation(int infoClass, IntPtr info, int length, out int needed);
|
|
7999
7616
|
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
"-ExecutionPolicy",
|
|
8031
|
-
"Bypass",
|
|
8032
|
-
"-EncodedCommand",
|
|
8033
|
-
Buffer.from(SCRIPT, "utf16le").toString("base64")
|
|
8034
|
-
], { cwd: tmpdir3() });
|
|
8035
|
-
buffered = "";
|
|
8036
|
-
child.stdout.setEncoding("utf8");
|
|
8037
|
-
child.stdout.on("data", (chunk) => {
|
|
8038
|
-
buffered += chunk;
|
|
8039
|
-
for (let end = buffered.indexOf(`
|
|
8040
|
-
`);end !== -1; end = buffered.indexOf(`
|
|
8041
|
-
`)) {
|
|
8042
|
-
answered(buffered.slice(0, end).trim());
|
|
8043
|
-
buffered = buffered.slice(end + 1);
|
|
8044
|
-
}
|
|
8045
|
-
});
|
|
8046
|
-
child.stderr.resume();
|
|
8047
|
-
child.stdin.on("error", () => {});
|
|
8048
|
-
const gone = () => {
|
|
8049
|
-
if (helper !== child) {
|
|
8050
|
-
return;
|
|
8051
|
-
}
|
|
8052
|
-
helper = null;
|
|
8053
|
-
if (out !== null) {
|
|
8054
|
-
clearTimeout(out.timer);
|
|
8055
|
-
out.question.reject(new WindowsAskFailure("exited before it answered"));
|
|
8056
|
-
out = null;
|
|
8057
|
-
}
|
|
8058
|
-
sendNext();
|
|
8059
|
-
};
|
|
8060
|
-
child.once("exit", gone);
|
|
8061
|
-
child.once("error", gone);
|
|
8062
|
-
child.unref();
|
|
8063
|
-
child.stdin.unref?.();
|
|
8064
|
-
child.stderr.unref?.();
|
|
8065
|
-
held = true;
|
|
8066
|
-
holding(child, false);
|
|
8067
|
-
helper = child;
|
|
8068
|
-
return child;
|
|
8069
|
-
}
|
|
8070
|
-
function answered(line) {
|
|
8071
|
-
const [id, tag, body] = line.split(" ");
|
|
8072
|
-
if (out === null || out.id !== Number(id)) {
|
|
8073
|
-
return;
|
|
8074
|
-
}
|
|
8075
|
-
const { question, timer } = out;
|
|
8076
|
-
clearTimeout(timer);
|
|
8077
|
-
out = null;
|
|
8078
|
-
const said = Buffer.from(body ?? "", "base64").toString("utf8");
|
|
8079
|
-
if (tag === "OK") {
|
|
8080
|
-
question.resolve(said);
|
|
8081
|
-
} else {
|
|
8082
|
-
question.reject(new WindowsAskFailure(`refused the question: ${said.trim() || "no reason given"}`));
|
|
8083
|
-
}
|
|
8084
|
-
sendNext();
|
|
8085
|
-
}
|
|
8086
|
-
function sendNext() {
|
|
8087
|
-
const question = queued.shift();
|
|
8088
|
-
if (question === undefined) {
|
|
8089
|
-
if (helper !== null) {
|
|
8090
|
-
holding(helper, false);
|
|
8091
|
-
}
|
|
8092
|
-
return;
|
|
8093
|
-
}
|
|
8094
|
-
const child = running();
|
|
8095
|
-
holding(child, true);
|
|
8096
|
-
const id = next;
|
|
8097
|
-
next += 1;
|
|
8098
|
-
const timer = setTimeout(() => {
|
|
8099
|
-
if (out?.id !== id) {
|
|
8100
|
-
return;
|
|
8101
|
-
}
|
|
8102
|
-
out = null;
|
|
8103
|
-
question.reject(new WindowsAskFailure(`did not answer within ${question.withinMs}ms`));
|
|
8104
|
-
if (helper === child) {
|
|
8105
|
-
helper = null;
|
|
8106
|
-
}
|
|
8107
|
-
child.kill();
|
|
8108
|
-
sendNext();
|
|
8109
|
-
}, question.withinMs);
|
|
8110
|
-
out = { id, question, timer };
|
|
8111
|
-
child.stdin.write(`${id} ${Buffer.from(question.script, "utf8").toString("base64")}
|
|
8112
|
-
`);
|
|
8113
|
-
}
|
|
8114
|
-
function askWindows(script, withinMs) {
|
|
8115
|
-
if (process3.platform !== "win32") {
|
|
8116
|
-
return Promise.reject(new WindowsAskFailure("is asked only on Windows"));
|
|
8117
|
-
}
|
|
8118
|
-
return new Promise((resolve, reject) => {
|
|
8119
|
-
queued.push({ script, withinMs, resolve, reject });
|
|
8120
|
-
if (out === null) {
|
|
8121
|
-
sendNext();
|
|
8122
|
-
}
|
|
8123
|
-
});
|
|
8124
|
-
}
|
|
8125
|
-
|
|
8126
|
-
// src/process-table.ts
|
|
8127
|
-
var SOURCE2 = String.raw`
|
|
8128
|
-
using System;
|
|
8129
|
-
using System.Collections.Generic;
|
|
8130
|
-
using System.Globalization;
|
|
8131
|
-
using System.Runtime.InteropServices;
|
|
8132
|
-
using System.Text;
|
|
8133
|
-
|
|
8134
|
-
public static class GdhProcessTable
|
|
8135
|
-
{
|
|
8136
|
-
[DllImport("ntdll.dll")]
|
|
8137
|
-
private static extern int NtQuerySystemInformation(int infoClass, IntPtr info, int length, out int needed);
|
|
8138
|
-
|
|
8139
|
-
[DllImport("ntdll.dll")]
|
|
8140
|
-
private static extern int NtQueryInformationProcess(IntPtr process, int infoClass, IntPtr info, int length, out int needed);
|
|
8141
|
-
|
|
8142
|
-
[DllImport("kernel32.dll")]
|
|
8143
|
-
private static extern IntPtr OpenProcess(int access, bool inherit, int pid);
|
|
8144
|
-
|
|
8145
|
-
[DllImport("kernel32.dll")]
|
|
8146
|
-
private static extern bool CloseHandle(IntPtr handle);
|
|
8147
|
-
|
|
8148
|
-
[DllImport("kernel32.dll")]
|
|
8149
|
-
private static extern bool GetProcessTimes(IntPtr process, out long created, out long exited, out long kernel, out long user);
|
|
8150
|
-
|
|
8151
|
-
[DllImport("kernel32.dll")]
|
|
8152
|
-
private static extern uint WaitForSingleObject(IntPtr handle, uint milliseconds);
|
|
8153
|
-
|
|
8154
|
-
[DllImport("kernel32.dll")]
|
|
8155
|
-
private static extern bool GetExitCodeProcess(IntPtr process, out int code);
|
|
8156
|
-
|
|
8157
|
-
[StructLayout(LayoutKind.Sequential)]
|
|
8158
|
-
private struct MemoryStatus
|
|
8159
|
-
{
|
|
8160
|
-
public uint Length;
|
|
8161
|
-
public uint MemoryLoad;
|
|
8162
|
-
public ulong TotalPhys;
|
|
8163
|
-
public ulong AvailPhys;
|
|
8164
|
-
public ulong TotalPageFile;
|
|
8165
|
-
public ulong AvailPageFile;
|
|
8166
|
-
public ulong TotalVirtual;
|
|
8167
|
-
public ulong AvailVirtual;
|
|
8168
|
-
public ulong AvailExtendedVirtual;
|
|
7617
|
+
[DllImport("ntdll.dll")]
|
|
7618
|
+
private static extern int NtQueryInformationProcess(IntPtr process, int infoClass, IntPtr info, int length, out int needed);
|
|
7619
|
+
|
|
7620
|
+
[DllImport("kernel32.dll")]
|
|
7621
|
+
private static extern IntPtr OpenProcess(int access, bool inherit, int pid);
|
|
7622
|
+
|
|
7623
|
+
[DllImport("kernel32.dll")]
|
|
7624
|
+
private static extern bool CloseHandle(IntPtr handle);
|
|
7625
|
+
|
|
7626
|
+
[DllImport("kernel32.dll")]
|
|
7627
|
+
private static extern bool GetProcessTimes(IntPtr process, out long created, out long exited, out long kernel, out long user);
|
|
7628
|
+
|
|
7629
|
+
[DllImport("kernel32.dll")]
|
|
7630
|
+
private static extern uint WaitForSingleObject(IntPtr handle, uint milliseconds);
|
|
7631
|
+
|
|
7632
|
+
[DllImport("kernel32.dll")]
|
|
7633
|
+
private static extern bool GetExitCodeProcess(IntPtr process, out int code);
|
|
7634
|
+
|
|
7635
|
+
[StructLayout(LayoutKind.Sequential)]
|
|
7636
|
+
private struct MemoryStatus
|
|
7637
|
+
{
|
|
7638
|
+
public uint Length;
|
|
7639
|
+
public uint MemoryLoad;
|
|
7640
|
+
public ulong TotalPhys;
|
|
7641
|
+
public ulong AvailPhys;
|
|
7642
|
+
public ulong TotalPageFile;
|
|
7643
|
+
public ulong AvailPageFile;
|
|
7644
|
+
public ulong TotalVirtual;
|
|
7645
|
+
public ulong AvailVirtual;
|
|
7646
|
+
public ulong AvailExtendedVirtual;
|
|
8169
7647
|
}
|
|
8170
7648
|
|
|
8171
7649
|
[DllImport("kernel32.dll")]
|
|
@@ -8385,90 +7863,638 @@ public static class GdhProcessTable
|
|
|
8385
7863
|
}
|
|
8386
7864
|
return "";
|
|
8387
7865
|
}
|
|
8388
|
-
|
|
8389
|
-
/// <summary>The processor seconds the pid has used; empty when it is not running.</summary>
|
|
8390
|
-
public static string ProcessorSeconds(int pid)
|
|
8391
|
-
{
|
|
8392
|
-
foreach (Entry entry in Snapshot())
|
|
8393
|
-
{
|
|
8394
|
-
if (entry.Pid == pid)
|
|
8395
|
-
{
|
|
8396
|
-
return (entry.Processor / 1e7).ToString("R", CultureInfo.InvariantCulture);
|
|
8397
|
-
}
|
|
8398
|
-
}
|
|
8399
|
-
return "";
|
|
7866
|
+
|
|
7867
|
+
/// <summary>The processor seconds the pid has used; empty when it is not running.</summary>
|
|
7868
|
+
public static string ProcessorSeconds(int pid)
|
|
7869
|
+
{
|
|
7870
|
+
foreach (Entry entry in Snapshot())
|
|
7871
|
+
{
|
|
7872
|
+
if (entry.Pid == pid)
|
|
7873
|
+
{
|
|
7874
|
+
return (entry.Processor / 1e7).ToString("R", CultureInfo.InvariantCulture);
|
|
7875
|
+
}
|
|
7876
|
+
}
|
|
7877
|
+
return "";
|
|
7878
|
+
}
|
|
7879
|
+
|
|
7880
|
+
/// <summary>"pid seconds" on a line for each running one of the comma-separated pids, from one snapshot.</summary>
|
|
7881
|
+
public static string ProcessorSecondsOf(string pids)
|
|
7882
|
+
{
|
|
7883
|
+
HashSet<int> wanted = new HashSet<int>();
|
|
7884
|
+
foreach (string one in pids.Split(','))
|
|
7885
|
+
{
|
|
7886
|
+
int pid;
|
|
7887
|
+
if (int.TryParse(one, NumberStyles.Integer, CultureInfo.InvariantCulture, out pid))
|
|
7888
|
+
{
|
|
7889
|
+
wanted.Add(pid);
|
|
7890
|
+
}
|
|
7891
|
+
}
|
|
7892
|
+
StringBuilder said = new StringBuilder();
|
|
7893
|
+
foreach (Entry entry in Snapshot())
|
|
7894
|
+
{
|
|
7895
|
+
if (wanted.Contains(entry.Pid))
|
|
7896
|
+
{
|
|
7897
|
+
said.Append(Number(entry.Pid)).Append(' ')
|
|
7898
|
+
.Append((entry.Processor / 1e7).ToString("R", CultureInfo.InvariantCulture)).Append('\n');
|
|
7899
|
+
}
|
|
7900
|
+
}
|
|
7901
|
+
return said.ToString();
|
|
7902
|
+
}
|
|
7903
|
+
|
|
7904
|
+
/// <summary>How many more bytes Windows will commit.</summary>
|
|
7905
|
+
public static string CommitLeft()
|
|
7906
|
+
{
|
|
7907
|
+
MemoryStatus status = new MemoryStatus();
|
|
7908
|
+
status.Length = (uint)Marshal.SizeOf(typeof(MemoryStatus));
|
|
7909
|
+
if (!GlobalMemoryStatusEx(ref status))
|
|
7910
|
+
{
|
|
7911
|
+
throw new InvalidOperationException("GlobalMemoryStatusEx failed with " + Number(Marshal.GetLastWin32Error()));
|
|
7912
|
+
}
|
|
7913
|
+
return status.AvailPageFile.ToString(CultureInfo.InvariantCulture);
|
|
7914
|
+
}
|
|
7915
|
+
|
|
7916
|
+
/// <summary>
|
|
7917
|
+
/// "pid started command" for each dated child of the pid, holding a handle to each: Windows tells
|
|
7918
|
+
/// a process's exit code only to whoever holds a handle to it, and the handle keeps its number
|
|
7919
|
+
/// from going to anything else.
|
|
7920
|
+
/// </summary>
|
|
7921
|
+
public static string HoldChildren(int parent)
|
|
7922
|
+
{
|
|
7923
|
+
StringBuilder said = new StringBuilder();
|
|
7924
|
+
foreach (Entry entry in Snapshot())
|
|
7925
|
+
{
|
|
7926
|
+
if (entry.Parent != parent || entry.Pid <= 0 || entry.Created <= UnixEpoch || held.ContainsKey(entry.Pid))
|
|
7927
|
+
{
|
|
7928
|
+
continue;
|
|
7929
|
+
}
|
|
7930
|
+
IntPtr handle = Open(entry, QueryLimitedInformation | Synchronize);
|
|
7931
|
+
if (handle == IntPtr.Zero)
|
|
7932
|
+
{
|
|
7933
|
+
continue;
|
|
7934
|
+
}
|
|
7935
|
+
held[entry.Pid] = handle;
|
|
7936
|
+
said.Append(Number(entry.Pid)).Append(' ').Append(Milliseconds(entry.Created)).Append(' ')
|
|
7937
|
+
.Append(CommandLineOf(handle)).Append('\n');
|
|
7938
|
+
}
|
|
7939
|
+
return said.ToString();
|
|
7940
|
+
}
|
|
7941
|
+
|
|
7942
|
+
/// <summary>"exit code" once a child held by HoldChildren has ended; empty for one not held.</summary>
|
|
7943
|
+
public static string WaitFor(int pid)
|
|
7944
|
+
{
|
|
7945
|
+
IntPtr handle;
|
|
7946
|
+
if (!held.TryGetValue(pid, out handle))
|
|
7947
|
+
{
|
|
7948
|
+
return "";
|
|
7949
|
+
}
|
|
7950
|
+
WaitForSingleObject(handle, 0xFFFFFFFF);
|
|
7951
|
+
int code;
|
|
7952
|
+
return GetExitCodeProcess(handle, out code) ? "exit " + Number(code) : "";
|
|
7953
|
+
}
|
|
7954
|
+
}
|
|
7955
|
+
`;
|
|
7956
|
+
var TABLE = new CompiledHelper("process table", "gdharness-processes", SOURCE2);
|
|
7957
|
+
|
|
7958
|
+
class ProcessTableUnbuilt extends Error {
|
|
7959
|
+
}
|
|
7960
|
+
function ensureProcessTable(directory = tmpdir4(), wait = true) {
|
|
7961
|
+
return TABLE.ensure(directory, HELPER_COMPILE_MS, wait);
|
|
7962
|
+
}
|
|
7963
|
+
async function loadingTheTable() {
|
|
7964
|
+
const failed = await ensureProcessTable();
|
|
7965
|
+
if (failed !== null) {
|
|
7966
|
+
throw new ProcessTableUnbuilt(failed);
|
|
7967
|
+
}
|
|
7968
|
+
return `$null = [Reflection.Assembly]::LoadFrom('${TABLE.assembly().replaceAll("'", "''")}')`;
|
|
7969
|
+
}
|
|
7970
|
+
async function askProcessTable(call, withinMs) {
|
|
7971
|
+
return askWindows(`${await loadingTheTable()}; [GdhProcessTable]::${call}`, withinMs);
|
|
7972
|
+
}
|
|
7973
|
+
|
|
7974
|
+
// src/engine-spent.ts
|
|
7975
|
+
var watched = new Set;
|
|
7976
|
+
|
|
7977
|
+
// src/harnesses.ts
|
|
7978
|
+
import { basename as basename2, dirname as dirname2, isAbsolute as isAbsolute2, join as join3, relative as relative2, resolve as resolve2 } from "node:path";
|
|
7979
|
+
|
|
7980
|
+
// node_modules/yaml/dist/index.js
|
|
7981
|
+
var composer = require_composer();
|
|
7982
|
+
var Document = require_Document();
|
|
7983
|
+
var Schema = require_Schema();
|
|
7984
|
+
var errors = require_errors();
|
|
7985
|
+
var Alias = require_Alias();
|
|
7986
|
+
var identity = require_identity();
|
|
7987
|
+
var Pair = require_Pair();
|
|
7988
|
+
var Scalar = require_Scalar();
|
|
7989
|
+
var YAMLMap = require_YAMLMap();
|
|
7990
|
+
var YAMLSeq = require_YAMLSeq();
|
|
7991
|
+
var cst = require_cst();
|
|
7992
|
+
var lexer = require_lexer();
|
|
7993
|
+
var lineCounter = require_line_counter();
|
|
7994
|
+
var parser = require_parser();
|
|
7995
|
+
var publicApi = require_public_api();
|
|
7996
|
+
var visit = require_visit();
|
|
7997
|
+
var $Composer = composer.Composer;
|
|
7998
|
+
var $Document = Document.Document;
|
|
7999
|
+
var $Schema = Schema.Schema;
|
|
8000
|
+
var $YAMLError = errors.YAMLError;
|
|
8001
|
+
var $YAMLParseError = errors.YAMLParseError;
|
|
8002
|
+
var $YAMLWarning = errors.YAMLWarning;
|
|
8003
|
+
var $Alias = Alias.Alias;
|
|
8004
|
+
var $isAlias = identity.isAlias;
|
|
8005
|
+
var $isCollection = identity.isCollection;
|
|
8006
|
+
var $isDocument = identity.isDocument;
|
|
8007
|
+
var $isMap = identity.isMap;
|
|
8008
|
+
var $isNode = identity.isNode;
|
|
8009
|
+
var $isPair = identity.isPair;
|
|
8010
|
+
var $isScalar = identity.isScalar;
|
|
8011
|
+
var $isSeq = identity.isSeq;
|
|
8012
|
+
var $Pair = Pair.Pair;
|
|
8013
|
+
var $Scalar = Scalar.Scalar;
|
|
8014
|
+
var $YAMLMap = YAMLMap.YAMLMap;
|
|
8015
|
+
var $YAMLSeq = YAMLSeq.YAMLSeq;
|
|
8016
|
+
var $Lexer = lexer.Lexer;
|
|
8017
|
+
var $LineCounter = lineCounter.LineCounter;
|
|
8018
|
+
var $Parser = parser.Parser;
|
|
8019
|
+
var $parse = publicApi.parse;
|
|
8020
|
+
var $parseAllDocuments = publicApi.parseAllDocuments;
|
|
8021
|
+
var $parseDocument = publicApi.parseDocument;
|
|
8022
|
+
var $stringify = publicApi.stringify;
|
|
8023
|
+
var $visit = visit.visit;
|
|
8024
|
+
var $visitAsync = visit.visitAsync;
|
|
8025
|
+
|
|
8026
|
+
// src/paths.ts
|
|
8027
|
+
import { realpathSync, statSync as statSync2 } from "node:fs";
|
|
8028
|
+
import { basename, dirname, isAbsolute, join as join2, relative, resolve, sep } from "node:path";
|
|
8029
|
+
function realAsFarAsItExists(path) {
|
|
8030
|
+
const missing = [];
|
|
8031
|
+
let at = path;
|
|
8032
|
+
for (;; ) {
|
|
8033
|
+
try {
|
|
8034
|
+
return join2(realpathSync.native(at), ...missing);
|
|
8035
|
+
} catch {
|
|
8036
|
+
const parent = dirname(at);
|
|
8037
|
+
if (parent === at) {
|
|
8038
|
+
return path;
|
|
8039
|
+
}
|
|
8040
|
+
missing.unshift(basename(at));
|
|
8041
|
+
at = parent;
|
|
8042
|
+
}
|
|
8043
|
+
}
|
|
8044
|
+
}
|
|
8045
|
+
|
|
8046
|
+
// src/harnesses.ts
|
|
8047
|
+
var SERVER_KEY = "gdharness";
|
|
8048
|
+
function tomlArray(values) {
|
|
8049
|
+
return `[${values.map((value) => `"${value}"`).join(", ")}]`;
|
|
8050
|
+
}
|
|
8051
|
+
function tomlEnv(launch) {
|
|
8052
|
+
const pairs = Object.entries(launch.env).map(([name, value]) => `${name} = "${value}"`);
|
|
8053
|
+
return `env = { ${pairs.join(", ")} }`;
|
|
8054
|
+
}
|
|
8055
|
+
function jsonSnippet(launch, container, shape) {
|
|
8056
|
+
return JSON.stringify({ [container]: { [SERVER_KEY]: entryFor(shape, launch) } }, null, 2);
|
|
8057
|
+
}
|
|
8058
|
+
var HARNESSES = [
|
|
8059
|
+
{
|
|
8060
|
+
id: "claude-code",
|
|
8061
|
+
name: "Claude Code",
|
|
8062
|
+
scope: "project",
|
|
8063
|
+
file: ".mcp.json",
|
|
8064
|
+
container: "mcpServers",
|
|
8065
|
+
shape: "plain",
|
|
8066
|
+
home: ".claude",
|
|
8067
|
+
marker: ".claude",
|
|
8068
|
+
skills: { dir: join3(".claude", "skills"), shared: false }
|
|
8069
|
+
},
|
|
8070
|
+
{
|
|
8071
|
+
id: "copilot-cli",
|
|
8072
|
+
name: "Copilot CLI",
|
|
8073
|
+
scope: "project",
|
|
8074
|
+
file: ".mcp.json",
|
|
8075
|
+
container: "mcpServers",
|
|
8076
|
+
shape: "plain",
|
|
8077
|
+
home: ".copilot",
|
|
8078
|
+
skills: { dir: join3(".github", "skills"), shared: true },
|
|
8079
|
+
manual: "Trust the folder when Copilot CLI first asks, or it reads no config here."
|
|
8080
|
+
},
|
|
8081
|
+
{
|
|
8082
|
+
id: "qoder",
|
|
8083
|
+
name: "Qoder",
|
|
8084
|
+
scope: "project",
|
|
8085
|
+
file: ".mcp.json",
|
|
8086
|
+
container: "mcpServers",
|
|
8087
|
+
shape: "plain",
|
|
8088
|
+
home: ".qoder",
|
|
8089
|
+
marker: ".qoder"
|
|
8090
|
+
},
|
|
8091
|
+
{
|
|
8092
|
+
id: "command-code",
|
|
8093
|
+
name: "Command Code",
|
|
8094
|
+
scope: "project",
|
|
8095
|
+
file: ".mcp.json",
|
|
8096
|
+
container: "mcpServers",
|
|
8097
|
+
shape: "plain",
|
|
8098
|
+
home: ".commandcode"
|
|
8099
|
+
},
|
|
8100
|
+
{
|
|
8101
|
+
id: "cursor",
|
|
8102
|
+
name: "Cursor",
|
|
8103
|
+
scope: "project",
|
|
8104
|
+
file: join3(".cursor", "mcp.json"),
|
|
8105
|
+
container: "mcpServers",
|
|
8106
|
+
shape: "plain",
|
|
8107
|
+
home: ".cursor",
|
|
8108
|
+
skills: { dir: join3(".cursor", "skills"), shared: true },
|
|
8109
|
+
manual: "Cursor asks before each tool call by default, and the server can be toggled off."
|
|
8110
|
+
},
|
|
8111
|
+
{
|
|
8112
|
+
id: "vscode",
|
|
8113
|
+
name: "VS Code",
|
|
8114
|
+
scope: "project",
|
|
8115
|
+
file: join3(".vscode", "mcp.json"),
|
|
8116
|
+
container: "servers",
|
|
8117
|
+
shape: "typed",
|
|
8118
|
+
home: ".vscode",
|
|
8119
|
+
skills: { dir: join3(".github", "skills"), shared: true },
|
|
8120
|
+
manual: "VS Code asks you to trust a server the first time it starts one."
|
|
8121
|
+
},
|
|
8122
|
+
{
|
|
8123
|
+
id: "opencode",
|
|
8124
|
+
name: "opencode",
|
|
8125
|
+
scope: "project",
|
|
8126
|
+
file: "opencode.json",
|
|
8127
|
+
container: "mcp",
|
|
8128
|
+
shape: "opencode",
|
|
8129
|
+
home: join3(".config", "opencode"),
|
|
8130
|
+
marker: ".opencode",
|
|
8131
|
+
skills: { dir: join3(".opencode", "skills"), shared: true }
|
|
8132
|
+
},
|
|
8133
|
+
{
|
|
8134
|
+
id: "junie",
|
|
8135
|
+
name: "Junie",
|
|
8136
|
+
scope: "project",
|
|
8137
|
+
file: join3(".junie", "mcp", "mcp.json"),
|
|
8138
|
+
container: "mcpServers",
|
|
8139
|
+
shape: "plain",
|
|
8140
|
+
home: ".junie",
|
|
8141
|
+
skills: { dir: join3(".junie", "skills"), shared: true }
|
|
8142
|
+
},
|
|
8143
|
+
{
|
|
8144
|
+
id: "kiro",
|
|
8145
|
+
name: "Kiro",
|
|
8146
|
+
scope: "project",
|
|
8147
|
+
file: join3(".kiro", "settings", "mcp.json"),
|
|
8148
|
+
container: "mcpServers",
|
|
8149
|
+
shape: "plain",
|
|
8150
|
+
home: ".kiro",
|
|
8151
|
+
skills: { dir: join3(".kiro", "skills"), shared: false }
|
|
8152
|
+
},
|
|
8153
|
+
{
|
|
8154
|
+
id: "gemini",
|
|
8155
|
+
name: "Gemini CLI",
|
|
8156
|
+
scope: "project",
|
|
8157
|
+
file: join3(".gemini", "settings.json"),
|
|
8158
|
+
container: "mcpServers",
|
|
8159
|
+
shape: "plain",
|
|
8160
|
+
home: ".gemini",
|
|
8161
|
+
skills: { dir: join3(".gemini", "skills"), shared: true }
|
|
8162
|
+
},
|
|
8163
|
+
{
|
|
8164
|
+
id: "roo",
|
|
8165
|
+
name: "Roo Code",
|
|
8166
|
+
scope: "project",
|
|
8167
|
+
file: join3(".roo", "mcp.json"),
|
|
8168
|
+
container: "mcpServers",
|
|
8169
|
+
shape: "plain"
|
|
8170
|
+
},
|
|
8171
|
+
{
|
|
8172
|
+
id: "kilo",
|
|
8173
|
+
name: "Kilo Code",
|
|
8174
|
+
scope: "project",
|
|
8175
|
+
file: join3(".kilocode", "mcp.json"),
|
|
8176
|
+
container: "mcpServers",
|
|
8177
|
+
shape: "plain"
|
|
8178
|
+
},
|
|
8179
|
+
{
|
|
8180
|
+
id: "amazon-q",
|
|
8181
|
+
name: "Amazon Q Developer CLI",
|
|
8182
|
+
scope: "project",
|
|
8183
|
+
file: join3(".amazonq", "mcp.json"),
|
|
8184
|
+
container: "mcpServers",
|
|
8185
|
+
shape: "plain",
|
|
8186
|
+
home: join3(".aws", "amazonq")
|
|
8187
|
+
},
|
|
8188
|
+
{
|
|
8189
|
+
id: "zed",
|
|
8190
|
+
name: "Zed",
|
|
8191
|
+
scope: "project",
|
|
8192
|
+
file: join3(".zed", "settings.json"),
|
|
8193
|
+
container: "context_servers",
|
|
8194
|
+
shape: "plain"
|
|
8195
|
+
},
|
|
8196
|
+
{
|
|
8197
|
+
id: "amp",
|
|
8198
|
+
name: "Amp",
|
|
8199
|
+
scope: "project",
|
|
8200
|
+
file: join3(".amp", "settings.json"),
|
|
8201
|
+
container: "amp.mcpServers",
|
|
8202
|
+
shape: "plain",
|
|
8203
|
+
home: join3(".config", "amp")
|
|
8204
|
+
},
|
|
8205
|
+
{
|
|
8206
|
+
id: "warp",
|
|
8207
|
+
name: "Warp",
|
|
8208
|
+
scope: "project",
|
|
8209
|
+
file: join3(".warp", ".mcp.json"),
|
|
8210
|
+
container: "mcpServers",
|
|
8211
|
+
shape: "plain",
|
|
8212
|
+
home: ".warp",
|
|
8213
|
+
manual: "Warp starts a project server only once you toggle it on, on its MCP servers page."
|
|
8214
|
+
},
|
|
8215
|
+
{
|
|
8216
|
+
id: "trae",
|
|
8217
|
+
name: "Trae",
|
|
8218
|
+
scope: "project",
|
|
8219
|
+
file: join3(".trae", "mcp.json"),
|
|
8220
|
+
container: "mcpServers",
|
|
8221
|
+
shape: "plain",
|
|
8222
|
+
home: ".trae"
|
|
8223
|
+
},
|
|
8224
|
+
{
|
|
8225
|
+
id: "factory",
|
|
8226
|
+
name: "Factory Droid",
|
|
8227
|
+
scope: "project",
|
|
8228
|
+
file: join3(".factory", "mcp.json"),
|
|
8229
|
+
container: "mcpServers",
|
|
8230
|
+
shape: "typed",
|
|
8231
|
+
home: ".factory"
|
|
8232
|
+
},
|
|
8233
|
+
{
|
|
8234
|
+
id: "tabnine",
|
|
8235
|
+
name: "Tabnine",
|
|
8236
|
+
scope: "project",
|
|
8237
|
+
file: join3(".tabnine", "mcp_servers.json"),
|
|
8238
|
+
container: "mcpServers",
|
|
8239
|
+
shape: "plain",
|
|
8240
|
+
home: ".tabnine"
|
|
8241
|
+
},
|
|
8242
|
+
{
|
|
8243
|
+
id: "firebender",
|
|
8244
|
+
name: "Firebender",
|
|
8245
|
+
scope: "project",
|
|
8246
|
+
file: "firebender.json",
|
|
8247
|
+
container: "mcpServers",
|
|
8248
|
+
shape: "plain"
|
|
8249
|
+
},
|
|
8250
|
+
{
|
|
8251
|
+
id: "pi",
|
|
8252
|
+
name: "pi",
|
|
8253
|
+
scope: "project",
|
|
8254
|
+
file: join3(".pi", "mcp.json"),
|
|
8255
|
+
container: "mcpServers",
|
|
8256
|
+
shape: "plain",
|
|
8257
|
+
home: ".pi"
|
|
8258
|
+
},
|
|
8259
|
+
{
|
|
8260
|
+
id: "mistral-vibe",
|
|
8261
|
+
name: "Mistral Vibe",
|
|
8262
|
+
scope: "project",
|
|
8263
|
+
file: join3(".vibe", "config.toml"),
|
|
8264
|
+
container: "mcp_servers",
|
|
8265
|
+
shape: "plain",
|
|
8266
|
+
toml: {
|
|
8267
|
+
header: "[[mcp_servers]]",
|
|
8268
|
+
identity: `name = "${SERVER_KEY}"`,
|
|
8269
|
+
block: (launch) => [
|
|
8270
|
+
"[[mcp_servers]]",
|
|
8271
|
+
`name = "${SERVER_KEY}"`,
|
|
8272
|
+
'transport = "stdio"',
|
|
8273
|
+
`command = "${launch.command}"`,
|
|
8274
|
+
`args = ${tomlArray(launch.args)}`,
|
|
8275
|
+
tomlEnv(launch)
|
|
8276
|
+
].join(`
|
|
8277
|
+
`)
|
|
8278
|
+
}
|
|
8279
|
+
},
|
|
8280
|
+
{
|
|
8281
|
+
id: "vtcode",
|
|
8282
|
+
name: "VT Code",
|
|
8283
|
+
scope: "project",
|
|
8284
|
+
file: "vtcode.toml",
|
|
8285
|
+
container: "mcp.providers",
|
|
8286
|
+
shape: "plain",
|
|
8287
|
+
marker: ".vtcode",
|
|
8288
|
+
toml: {
|
|
8289
|
+
header: "[[mcp.providers]]",
|
|
8290
|
+
identity: `name = "${SERVER_KEY}"`,
|
|
8291
|
+
enable: { header: "[mcp]", line: "enabled = true" },
|
|
8292
|
+
block: (launch) => [
|
|
8293
|
+
"[[mcp.providers]]",
|
|
8294
|
+
`name = "${SERVER_KEY}"`,
|
|
8295
|
+
"enabled = true",
|
|
8296
|
+
`command = "${launch.command}"`,
|
|
8297
|
+
`args = ${tomlArray(launch.args)}`,
|
|
8298
|
+
tomlEnv(launch)
|
|
8299
|
+
].join(`
|
|
8300
|
+
`)
|
|
8301
|
+
}
|
|
8302
|
+
},
|
|
8303
|
+
{
|
|
8304
|
+
id: "fast-agent",
|
|
8305
|
+
name: "fast-agent",
|
|
8306
|
+
scope: "project",
|
|
8307
|
+
file: "fastagent.config.yaml",
|
|
8308
|
+
container: "mcp",
|
|
8309
|
+
shape: "plain",
|
|
8310
|
+
yaml: {
|
|
8311
|
+
path: ["mcp", "servers", SERVER_KEY],
|
|
8312
|
+
entry: (launch) => ({ command: launch.command, args: [...launch.args], env: { ...launch.env } })
|
|
8313
|
+
}
|
|
8314
|
+
},
|
|
8315
|
+
{
|
|
8316
|
+
id: "codex",
|
|
8317
|
+
name: "Codex CLI",
|
|
8318
|
+
scope: "home",
|
|
8319
|
+
file: join3(".codex", "config.toml"),
|
|
8320
|
+
container: "mcp_servers",
|
|
8321
|
+
shape: "plain",
|
|
8322
|
+
manual: "Codex reads its config at startup, so restart it.",
|
|
8323
|
+
toml: {
|
|
8324
|
+
header: `[mcp_servers.${SERVER_KEY}]`,
|
|
8325
|
+
block: (launch) => [
|
|
8326
|
+
`[mcp_servers.${SERVER_KEY}]`,
|
|
8327
|
+
`command = "${launch.command}"`,
|
|
8328
|
+
`args = ${tomlArray(launch.args)}`,
|
|
8329
|
+
tomlEnv(launch)
|
|
8330
|
+
].join(`
|
|
8331
|
+
`)
|
|
8400
8332
|
}
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8333
|
+
},
|
|
8334
|
+
{
|
|
8335
|
+
id: "cline",
|
|
8336
|
+
name: "Cline",
|
|
8337
|
+
scope: "home",
|
|
8338
|
+
file: join3(".cline", "data", "settings", "cline_mcp_settings.json"),
|
|
8339
|
+
container: "mcpServers",
|
|
8340
|
+
shape: "plain",
|
|
8341
|
+
marker: ".cline",
|
|
8342
|
+
skills: { dir: join3(".cline", "skills"), shared: false }
|
|
8343
|
+
},
|
|
8344
|
+
{
|
|
8345
|
+
id: "goose",
|
|
8346
|
+
name: "Goose",
|
|
8347
|
+
scope: "home",
|
|
8348
|
+
file: {
|
|
8349
|
+
win32: { appData: join3("Block", "goose", "config", "config.yaml") },
|
|
8350
|
+
darwin: join3(".config", "goose", "config.yaml"),
|
|
8351
|
+
linux: join3(".config", "goose", "config.yaml")
|
|
8352
|
+
},
|
|
8353
|
+
container: "extensions",
|
|
8354
|
+
shape: "plain",
|
|
8355
|
+
yaml: {
|
|
8356
|
+
path: ["extensions", SERVER_KEY],
|
|
8357
|
+
entry: (launch) => ({
|
|
8358
|
+
name: SERVER_KEY,
|
|
8359
|
+
type: "stdio",
|
|
8360
|
+
enabled: true,
|
|
8361
|
+
cmd: launch.command,
|
|
8362
|
+
args: [...launch.args],
|
|
8363
|
+
envs: { ...launch.env },
|
|
8364
|
+
timeout: 300
|
|
8365
|
+
})
|
|
8412
8366
|
}
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
}
|
|
8437
|
-
|
|
8367
|
+
},
|
|
8368
|
+
{
|
|
8369
|
+
id: "windsurf",
|
|
8370
|
+
name: "Windsurf",
|
|
8371
|
+
scope: "home",
|
|
8372
|
+
file: join3(".codeium", "windsurf", "mcp_config.json"),
|
|
8373
|
+
container: "mcpServers",
|
|
8374
|
+
shape: "plain",
|
|
8375
|
+
skills: { dir: join3(".windsurf", "skills"), shared: true }
|
|
8376
|
+
},
|
|
8377
|
+
{
|
|
8378
|
+
id: "hermes",
|
|
8379
|
+
name: "Hermes",
|
|
8380
|
+
scope: "home",
|
|
8381
|
+
file: join3(".hermes", "config.yaml"),
|
|
8382
|
+
container: "mcp_servers",
|
|
8383
|
+
shape: "plain",
|
|
8384
|
+
skills: { dir: join3(".hermes", "skills"), shared: true },
|
|
8385
|
+
yaml: {
|
|
8386
|
+
path: ["mcp_servers", SERVER_KEY],
|
|
8387
|
+
entry: (launch) => ({
|
|
8388
|
+
command: launch.command,
|
|
8389
|
+
args: [...launch.args],
|
|
8390
|
+
env: { ...launch.env },
|
|
8391
|
+
enabled: true
|
|
8392
|
+
})
|
|
8438
8393
|
}
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8394
|
+
},
|
|
8395
|
+
{
|
|
8396
|
+
id: "openclaw",
|
|
8397
|
+
name: "OpenClaw",
|
|
8398
|
+
scope: "home",
|
|
8399
|
+
file: join3(".openclaw", "openclaw.json"),
|
|
8400
|
+
container: "mcpServers",
|
|
8401
|
+
shape: "plain"
|
|
8402
|
+
},
|
|
8403
|
+
{
|
|
8404
|
+
id: "claude-desktop",
|
|
8405
|
+
name: "Claude Desktop",
|
|
8406
|
+
scope: "home",
|
|
8407
|
+
file: {
|
|
8408
|
+
win32: { appData: join3("Claude", "claude_desktop_config.json") },
|
|
8409
|
+
darwin: join3("Library", "Application Support", "Claude", "claude_desktop_config.json"),
|
|
8410
|
+
linux: join3(".config", "Claude", "claude_desktop_config.json")
|
|
8411
|
+
},
|
|
8412
|
+
container: "mcpServers",
|
|
8413
|
+
shape: "plain"
|
|
8414
|
+
},
|
|
8415
|
+
{
|
|
8416
|
+
id: "zeroclaw",
|
|
8417
|
+
name: "ZeroClaw",
|
|
8418
|
+
scope: "home",
|
|
8419
|
+
file: join3(".zeroclaw", "config.toml"),
|
|
8420
|
+
container: "mcp.servers",
|
|
8421
|
+
shape: "plain",
|
|
8422
|
+
toml: {
|
|
8423
|
+
header: "[[mcp.servers]]",
|
|
8424
|
+
identity: `name = "${SERVER_KEY}"`,
|
|
8425
|
+
enable: { header: "[mcp]", line: "enabled = true" },
|
|
8426
|
+
block: (launch) => [
|
|
8427
|
+
"[[mcp.servers]]",
|
|
8428
|
+
`name = "${SERVER_KEY}"`,
|
|
8429
|
+
`command = "${launch.command}"`,
|
|
8430
|
+
`args = ${tomlArray(launch.args)}`,
|
|
8431
|
+
tomlEnv(launch)
|
|
8432
|
+
].join(`
|
|
8433
|
+
`)
|
|
8451
8434
|
}
|
|
8452
|
-
}
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
}
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8435
|
+
},
|
|
8436
|
+
{
|
|
8437
|
+
id: "deepcode",
|
|
8438
|
+
name: "Deep Code",
|
|
8439
|
+
scope: "home",
|
|
8440
|
+
file: join3(".deepcode", "settings.json"),
|
|
8441
|
+
container: "mcpServers",
|
|
8442
|
+
shape: "plain"
|
|
8443
|
+
},
|
|
8444
|
+
{
|
|
8445
|
+
id: "nanobot",
|
|
8446
|
+
name: "nanobot",
|
|
8447
|
+
scope: "home",
|
|
8448
|
+
file: join3(".nanobot", "config.json"),
|
|
8449
|
+
container: "mcpServers",
|
|
8450
|
+
shape: "plain",
|
|
8451
|
+
snippet: (launch) => jsonSnippet(launch, "mcpServers", "plain")
|
|
8452
|
+
},
|
|
8453
|
+
{
|
|
8454
|
+
id: "autohand",
|
|
8455
|
+
name: "Autohand",
|
|
8456
|
+
scope: "home",
|
|
8457
|
+
file: join3(".autohand", "config.json"),
|
|
8458
|
+
container: "mcpServers",
|
|
8459
|
+
shape: "plain",
|
|
8460
|
+
snippet: (launch) => jsonSnippet(launch, "mcpServers", "plain")
|
|
8465
8461
|
}
|
|
8466
|
-
|
|
8462
|
+
];
|
|
8463
|
+
var OURS = ["GODOT_PATH", "GDHARNESS_PROJECT"];
|
|
8464
|
+
function environmentFor(launch, held) {
|
|
8465
|
+
const kept = {};
|
|
8466
|
+
if (typeof held === "object" && held !== null && !Array.isArray(held)) {
|
|
8467
|
+
for (const [name, value] of Object.entries(held)) {
|
|
8468
|
+
if (typeof value === "string" && !OURS.includes(name)) {
|
|
8469
|
+
kept[name] = value;
|
|
8470
|
+
}
|
|
8471
|
+
}
|
|
8472
|
+
}
|
|
8473
|
+
return { ...kept, ...launch.env };
|
|
8467
8474
|
}
|
|
8468
|
-
|
|
8469
|
-
|
|
8475
|
+
function entryFor(shape, launch, held) {
|
|
8476
|
+
const before = typeof held === "object" && held !== null && !Array.isArray(held) ? { ...held } : {};
|
|
8477
|
+
if (shape === "opencode") {
|
|
8478
|
+
return {
|
|
8479
|
+
...before,
|
|
8480
|
+
type: "local",
|
|
8481
|
+
command: [launch.command, ...launch.args],
|
|
8482
|
+
environment: environmentFor(launch, before["environment"]),
|
|
8483
|
+
enabled: true
|
|
8484
|
+
};
|
|
8485
|
+
}
|
|
8486
|
+
return {
|
|
8487
|
+
...before,
|
|
8488
|
+
...shape === "typed" ? { type: "stdio" } : {},
|
|
8489
|
+
command: launch.command,
|
|
8490
|
+
args: [...launch.args],
|
|
8491
|
+
env: environmentFor(launch, before["env"])
|
|
8492
|
+
};
|
|
8470
8493
|
}
|
|
8471
8494
|
|
|
8495
|
+
// src/log-read.ts
|
|
8496
|
+
var LOG_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
8497
|
+
|
|
8472
8498
|
// src/gdscript-source.ts
|
|
8473
8499
|
var DECLARING = new Set(["var", "const", "func", "signal", "enum", "class", "for", "class_name"]);
|
|
8474
8500
|
var NAME = "[\\p{L}_][\\p{L}\\p{N}_]*";
|
|
@@ -8807,11 +8833,16 @@ function holderOf(content) {
|
|
|
8807
8833
|
if (typeof parsed !== "object" || parsed === null) {
|
|
8808
8834
|
return null;
|
|
8809
8835
|
}
|
|
8810
|
-
const { pid, started, by } = parsed;
|
|
8836
|
+
const { pid, started, by, game } = parsed;
|
|
8811
8837
|
if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0 || typeof started !== "number") {
|
|
8812
8838
|
return null;
|
|
8813
8839
|
}
|
|
8814
|
-
return
|
|
8840
|
+
return {
|
|
8841
|
+
pid,
|
|
8842
|
+
started,
|
|
8843
|
+
...typeof by === "string" && by !== "" ? { by } : {},
|
|
8844
|
+
...game === true ? { game } : {}
|
|
8845
|
+
};
|
|
8815
8846
|
} catch {
|
|
8816
8847
|
return null;
|
|
8817
8848
|
}
|
|
@@ -8827,7 +8858,8 @@ function handSlot(lock, from, to) {
|
|
|
8827
8858
|
} catch {
|
|
8828
8859
|
return false;
|
|
8829
8860
|
}
|
|
8830
|
-
|
|
8861
|
+
const holder = content === null ? null : holderOf(content);
|
|
8862
|
+
return holder?.pid === from && writeWhole(lock, JSON.stringify(holder.game === true ? { ...to, game: true } : to));
|
|
8831
8863
|
}
|
|
8832
8864
|
function giveBackSlot(lock, pid) {
|
|
8833
8865
|
try {
|
|
@@ -9287,7 +9319,7 @@ var IMPORTABLE = new Set(IMPORTABLE_EXTENSIONS);
|
|
|
9287
9319
|
var hashes = new Map;
|
|
9288
9320
|
|
|
9289
9321
|
// src/scratch.ts
|
|
9290
|
-
import { existsSync as
|
|
9322
|
+
import { existsSync as existsSync2, mkdtempSync as mkdtempSync2, readdirSync as readdirSync2, rmSync as rmSync4 } from "node:fs";
|
|
9291
9323
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
9292
9324
|
import { join as join4 } from "node:path";
|
|
9293
9325
|
import process6 from "node:process";
|
|
@@ -9332,7 +9364,7 @@ function tryAgain(path, attempt) {
|
|
|
9332
9364
|
lastTryOnExit();
|
|
9333
9365
|
}
|
|
9334
9366
|
const after = AGAIN_AFTER_MS[attempt];
|
|
9335
|
-
if (after === undefined || !
|
|
9367
|
+
if (after === undefined || !existsSync2(path)) {
|
|
9336
9368
|
waiting.delete(path);
|
|
9337
9369
|
if (after === undefined) {
|
|
9338
9370
|
atExit.add(path);
|
|
@@ -10837,7 +10869,7 @@ async function startThroughHelper(spec, output, stopFile) {
|
|
|
10837
10869
|
exited.now = true;
|
|
10838
10870
|
});
|
|
10839
10871
|
for (let waited = 0;waited < DESKTOP_START_MS; waited += 50) {
|
|
10840
|
-
const pid =
|
|
10872
|
+
const pid = existsSync3(pidFile) ? Number(readFileSync9(pidFile, "utf8").trim()) : Number.NaN;
|
|
10841
10873
|
if (Number.isInteger(pid) && pid > 0) {
|
|
10842
10874
|
return { child: started.child, pid };
|
|
10843
10875
|
}
|