@bike4mind/cli 0.2.64-worktree-refactor-extract-search-query-builders.21815 → 0.2.64
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/bin/bike4mind-cli.mjs +6 -6
- package/dist/BubblewrapRuntime-BHbtqvLx.mjs +72 -0
- package/dist/ConfigStore-CllM6jOf.mjs +8614 -0
- package/dist/ImageStore-DaKT_Ew8.mjs +202 -0
- package/dist/ProxyManager-Dl2nFk-A.mjs +259 -0
- package/dist/ProxyManager-kiOD1X8-.mjs +3 -0
- package/dist/SandboxOrchestrator-BEW3rqYi.mjs +159 -0
- package/dist/SandboxOrchestrator-CHZgSR3P.mjs +3 -0
- package/dist/SandboxRuntimeAdapter-C1B4t20N.mjs +57 -0
- package/dist/SandboxRuntimeAdapter-D7UAG13n.mjs +3 -0
- package/dist/SeatbeltRuntime-D4m0VOcD.mjs +116 -0
- package/dist/StderrViolationParser-D0afQ3-1.mjs +70 -0
- package/dist/ViolationLogStore-CZl35HcA.mjs +96 -0
- package/dist/bashExecute-BTkdqlSs-5foM20Lb.mjs +466 -0
- package/dist/commands/doctorCommand.mjs +101 -0
- package/dist/commands/headlessCommand.mjs +319 -0
- package/dist/commands/mcpCommand.mjs +218 -0
- package/dist/commands/updateCommand.mjs +40 -0
- package/dist/createFile-yQfh8uvk-I-yM5DxC.mjs +63 -0
- package/dist/deleteFile-DKHfnyny-G3b1Kj2T.mjs +66 -0
- package/dist/globFiles-D1en6joM-8jekiXdX.mjs +100 -0
- package/dist/grepSearch-aMamoBn_-DCJcY8JS.mjs +173 -0
- package/dist/index.mjs +6722 -0
- package/dist/pathValidation-Cgjh5WQO-DiCZTcq6.mjs +63 -0
- package/dist/store-Dw1nZX2Y.mjs +128 -0
- package/dist/store-nZExNOWX.mjs +3 -0
- package/dist/terminalSetup-rmr1P8KF.mjs +254 -0
- package/dist/tools-C6M5aW8W.mjs +20907 -0
- package/dist/treeSitterEngine-DCSXcm_3.mjs +309 -0
- package/dist/types-DBEjF9YS.mjs +59 -0
- package/dist/types-DK3P88Px.mjs +3 -0
- package/dist/updateChecker-Cu9dkHxV.mjs +120 -0
- package/package.json +10 -10
- package/dist/BubblewrapRuntime-PMIOLWKR.js +0 -71
- package/dist/HydrationEngine-YL2HWJ3V.js +0 -9
- package/dist/ImageStore-MMUOUPI2.js +0 -224
- package/dist/ProxyManager-HEB4TLVX.js +0 -7
- package/dist/SandboxOrchestrator-UIJ5GYBB.js +0 -8
- package/dist/SandboxRuntimeAdapter-FQ56MAB2.js +0 -13
- package/dist/SeatbeltRuntime-EE3TTLEP.js +0 -98
- package/dist/StderrViolationParser-7OYPM2DJ.js +0 -59
- package/dist/ViolationLogStore-RIIUVURH.js +0 -104
- package/dist/artifactExtractor-R7DIP2XO.js +0 -180
- package/dist/bashExecute-GLGLD3JD.js +0 -379
- package/dist/chunk-4BIBE3J7.js +0 -48
- package/dist/chunk-5LZS5CVJ.js +0 -161
- package/dist/chunk-BDQBOLYG.js +0 -120
- package/dist/chunk-BPFEGDC7.js +0 -192
- package/dist/chunk-EPIYC3LA.js +0 -13770
- package/dist/chunk-G4ZGEQFT.js +0 -250
- package/dist/chunk-GQGOWACU.js +0 -770
- package/dist/chunk-J6ZBI6TI.js +0 -1079
- package/dist/chunk-JW3JRHH7.js +0 -12433
- package/dist/chunk-KQAMBXAW.js +0 -163
- package/dist/chunk-KUVV2NAB.js +0 -19125
- package/dist/chunk-LTLJRF6I.js +0 -44
- package/dist/chunk-PFBYGCOW.js +0 -449
- package/dist/chunk-QWB6ZYY4.js +0 -48
- package/dist/chunk-SGPRXN4C.js +0 -245
- package/dist/chunk-UZUHPHZC.js +0 -95
- package/dist/chunk-WBE7SQUB.js +0 -241
- package/dist/chunk-Y4WOJJM3.js +0 -147
- package/dist/commands/doctorCommand.js +0 -87
- package/dist/commands/headlessCommand.js +0 -380
- package/dist/commands/mcpCommand.js +0 -203
- package/dist/commands/updateCommand.js +0 -42
- package/dist/create-C4VEEEYR.js +0 -12
- package/dist/createFile-6PSPLW6R.js +0 -71
- package/dist/deleteFile-AUSRLWIK.js +0 -73
- package/dist/formatConverter-5QEJDW24.js +0 -7
- package/dist/globFiles-TSRN64N2.js +0 -120
- package/dist/grepSearch-634XWZOJ.js +0 -216
- package/dist/index.js +0 -6779
- package/dist/llmMarkdownGenerator-Z6NB26TT.js +0 -371
- package/dist/markdownGenerator-SK2ZQQL4.js +0 -269
- package/dist/mementoService-N4IM6QAC.js +0 -12
- package/dist/notificationDeduplicator-HUC53NEW.js +0 -9
- package/dist/src-F4KZCAA2.js +0 -319
- package/dist/src-ISX322I7.js +0 -1101
- package/dist/store-CAB6BV3P.js +0 -11
- package/dist/subtractCredits-D4KEM6VU.js +0 -12
- package/dist/terminalSetup-C5FHMLC3.js +0 -214
- package/dist/treeSitterEngine-4SGFQDY3.js +0 -330
- package/dist/types-KB5NP6T4.js +0 -7
- package/dist/utils-JCHWDM4Z.js +0 -31
package/dist/chunk-G4ZGEQFT.js
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/sandbox/proxy/HttpConnectProxy.ts
|
|
4
|
-
import http from "http";
|
|
5
|
-
import net from "net";
|
|
6
|
-
import { EventEmitter } from "events";
|
|
7
|
-
|
|
8
|
-
// src/sandbox/proxy/domainMatcher.ts
|
|
9
|
-
function normalizeDomain(domain) {
|
|
10
|
-
let d = domain.toLowerCase().trim();
|
|
11
|
-
const colonIdx = d.lastIndexOf(":");
|
|
12
|
-
if (colonIdx > 0) {
|
|
13
|
-
const afterColon = d.slice(colonIdx + 1);
|
|
14
|
-
if (/^\d+$/.test(afterColon)) {
|
|
15
|
-
d = d.slice(0, colonIdx);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (d.endsWith(".")) {
|
|
19
|
-
d = d.slice(0, -1);
|
|
20
|
-
}
|
|
21
|
-
return d;
|
|
22
|
-
}
|
|
23
|
-
function matchesDomain(domain, pattern) {
|
|
24
|
-
const d = normalizeDomain(domain);
|
|
25
|
-
const p = normalizeDomain(pattern);
|
|
26
|
-
if (d === p) return true;
|
|
27
|
-
if (p.startsWith("*.")) {
|
|
28
|
-
const suffix = p.slice(1);
|
|
29
|
-
return d.endsWith(suffix) && d.length > suffix.length;
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
function isDomainAllowed(domain, allowedDomains) {
|
|
34
|
-
if (!domain || allowedDomains.length === 0) return false;
|
|
35
|
-
return allowedDomains.some((pattern) => matchesDomain(domain, pattern));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// src/sandbox/proxy/HttpConnectProxy.ts
|
|
39
|
-
var HttpConnectProxy = class extends EventEmitter {
|
|
40
|
-
constructor(options) {
|
|
41
|
-
super();
|
|
42
|
-
this.server = null;
|
|
43
|
-
this.activeSockets = /* @__PURE__ */ new Set();
|
|
44
|
-
this.allowedDomains = [...options.allowedDomains];
|
|
45
|
-
this.requestedPort = options.port ?? 0;
|
|
46
|
-
}
|
|
47
|
-
async start() {
|
|
48
|
-
if (this.server) {
|
|
49
|
-
throw new Error("Proxy is already running");
|
|
50
|
-
}
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
const server = http.createServer((req, res) => {
|
|
53
|
-
this.handleHttpRequest(req, res);
|
|
54
|
-
});
|
|
55
|
-
server.on("connect", (req, clientSocket, head) => {
|
|
56
|
-
this.handleConnect(req, clientSocket, head);
|
|
57
|
-
});
|
|
58
|
-
server.on("connection", (socket) => {
|
|
59
|
-
this.activeSockets.add(socket);
|
|
60
|
-
socket.on("close", () => this.activeSockets.delete(socket));
|
|
61
|
-
});
|
|
62
|
-
server.on("error", reject);
|
|
63
|
-
server.listen(this.requestedPort, "127.0.0.1", () => {
|
|
64
|
-
const addr = server.address();
|
|
65
|
-
if (!addr || typeof addr === "string") {
|
|
66
|
-
reject(new Error("Failed to get server address"));
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
this.server = server;
|
|
70
|
-
resolve(addr.port);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
async stop() {
|
|
75
|
-
if (!this.server) return;
|
|
76
|
-
for (const socket of this.activeSockets) {
|
|
77
|
-
socket.destroy();
|
|
78
|
-
}
|
|
79
|
-
this.activeSockets.clear();
|
|
80
|
-
return new Promise((resolve, reject) => {
|
|
81
|
-
this.server.close((err) => {
|
|
82
|
-
this.server = null;
|
|
83
|
-
if (err) reject(err);
|
|
84
|
-
else resolve();
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
updateAllowedDomains(domains) {
|
|
89
|
-
this.allowedDomains = [...domains];
|
|
90
|
-
}
|
|
91
|
-
getPort() {
|
|
92
|
-
if (!this.server) return null;
|
|
93
|
-
const addr = this.server.address();
|
|
94
|
-
if (!addr || typeof addr === "string") return null;
|
|
95
|
-
return addr.port;
|
|
96
|
-
}
|
|
97
|
-
isRunning() {
|
|
98
|
-
return this.server !== null;
|
|
99
|
-
}
|
|
100
|
-
emitEvent(type, domain, method) {
|
|
101
|
-
const event = { type, domain, method, timestamp: /* @__PURE__ */ new Date() };
|
|
102
|
-
this.emit("proxy-event", event);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Handle CONNECT requests (HTTPS tunneling).
|
|
106
|
-
*/
|
|
107
|
-
handleConnect(req, clientSocket, head) {
|
|
108
|
-
const target = req.url || "";
|
|
109
|
-
const [host] = target.split(":");
|
|
110
|
-
const port = parseInt(target.split(":")[1] || "443", 10);
|
|
111
|
-
if (!isDomainAllowed(host, this.allowedDomains)) {
|
|
112
|
-
this.emitEvent("blocked", host, "CONNECT");
|
|
113
|
-
clientSocket.write("HTTP/1.1 403 Forbidden\r\n\r\n");
|
|
114
|
-
clientSocket.end();
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
this.emitEvent("allowed", host, "CONNECT");
|
|
118
|
-
const serverSocket = net.connect(port, host, () => {
|
|
119
|
-
clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
|
|
120
|
-
if (head.length > 0) {
|
|
121
|
-
serverSocket.write(head);
|
|
122
|
-
}
|
|
123
|
-
serverSocket.pipe(clientSocket);
|
|
124
|
-
clientSocket.pipe(serverSocket);
|
|
125
|
-
});
|
|
126
|
-
serverSocket.setTimeout(5e3, () => {
|
|
127
|
-
serverSocket.destroy();
|
|
128
|
-
clientSocket.write("HTTP/1.1 504 Gateway Timeout\r\n\r\n");
|
|
129
|
-
clientSocket.end();
|
|
130
|
-
});
|
|
131
|
-
serverSocket.on("error", () => {
|
|
132
|
-
clientSocket.write("HTTP/1.1 502 Bad Gateway\r\n\r\n");
|
|
133
|
-
clientSocket.end();
|
|
134
|
-
});
|
|
135
|
-
clientSocket.on("error", () => {
|
|
136
|
-
serverSocket.destroy();
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Handle plain HTTP forward proxy requests.
|
|
141
|
-
*/
|
|
142
|
-
handleHttpRequest(req, res) {
|
|
143
|
-
const url = req.url || "";
|
|
144
|
-
let host;
|
|
145
|
-
try {
|
|
146
|
-
const parsed2 = new URL(url);
|
|
147
|
-
host = parsed2.hostname;
|
|
148
|
-
} catch {
|
|
149
|
-
host = (req.headers.host || "").split(":")[0];
|
|
150
|
-
}
|
|
151
|
-
if (!host || !isDomainAllowed(host, this.allowedDomains)) {
|
|
152
|
-
this.emitEvent("blocked", host || "unknown", req.method || "GET");
|
|
153
|
-
res.writeHead(403, { "Content-Type": "text/plain" });
|
|
154
|
-
res.end("Blocked by sandbox network proxy");
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
this.emitEvent("allowed", host, req.method || "GET");
|
|
158
|
-
const parsed = new URL(url);
|
|
159
|
-
const proxyReq = http.request(
|
|
160
|
-
{
|
|
161
|
-
hostname: parsed.hostname,
|
|
162
|
-
port: parsed.port || 80,
|
|
163
|
-
path: parsed.pathname + parsed.search,
|
|
164
|
-
method: req.method,
|
|
165
|
-
headers: req.headers
|
|
166
|
-
},
|
|
167
|
-
(proxyRes) => {
|
|
168
|
-
res.writeHead(proxyRes.statusCode || 502, proxyRes.headers);
|
|
169
|
-
proxyRes.pipe(res);
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
proxyReq.on("error", () => {
|
|
173
|
-
res.writeHead(502, { "Content-Type": "text/plain" });
|
|
174
|
-
res.end("Bad Gateway");
|
|
175
|
-
});
|
|
176
|
-
req.pipe(proxyReq);
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
// src/sandbox/proxy/ProxyManager.ts
|
|
181
|
-
var ProxyManager = class {
|
|
182
|
-
constructor(networkConfig) {
|
|
183
|
-
this.proxy = null;
|
|
184
|
-
this.eventHandlers = /* @__PURE__ */ new Set();
|
|
185
|
-
this.networkConfig = { ...networkConfig, allowedDomains: [...networkConfig.allowedDomains] };
|
|
186
|
-
}
|
|
187
|
-
async start() {
|
|
188
|
-
if (!this.networkConfig.enabled) return;
|
|
189
|
-
if (this.proxy?.isRunning()) return;
|
|
190
|
-
this.proxy = new HttpConnectProxy({
|
|
191
|
-
allowedDomains: this.networkConfig.allowedDomains
|
|
192
|
-
});
|
|
193
|
-
this.proxy.on("proxy-event", (event) => {
|
|
194
|
-
for (const handler of this.eventHandlers) {
|
|
195
|
-
handler(event);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
await this.proxy.start();
|
|
199
|
-
}
|
|
200
|
-
async stop() {
|
|
201
|
-
if (!this.proxy) return;
|
|
202
|
-
await this.proxy.stop();
|
|
203
|
-
this.proxy = null;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Get proxy env vars for injecting into sandboxed processes.
|
|
207
|
-
* Returns both upper and lowercase variants for maximum compatibility.
|
|
208
|
-
*/
|
|
209
|
-
getProxyEnv() {
|
|
210
|
-
if (!this.proxy?.isRunning()) return {};
|
|
211
|
-
const port = this.proxy.getPort();
|
|
212
|
-
if (!port) return {};
|
|
213
|
-
const proxyUrl = `http://127.0.0.1:${port}`;
|
|
214
|
-
const noProxy = "localhost,127.0.0.1,::1";
|
|
215
|
-
return {
|
|
216
|
-
HTTP_PROXY: proxyUrl,
|
|
217
|
-
http_proxy: proxyUrl,
|
|
218
|
-
HTTPS_PROXY: proxyUrl,
|
|
219
|
-
https_proxy: proxyUrl,
|
|
220
|
-
NO_PROXY: noProxy,
|
|
221
|
-
no_proxy: noProxy
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
addAllowedDomain(domain) {
|
|
225
|
-
if (!this.networkConfig.allowedDomains.includes(domain)) {
|
|
226
|
-
this.networkConfig.allowedDomains.push(domain);
|
|
227
|
-
this.proxy?.updateAllowedDomains(this.networkConfig.allowedDomains);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
getAllowedDomains() {
|
|
231
|
-
return [...this.networkConfig.allowedDomains];
|
|
232
|
-
}
|
|
233
|
-
isRunning() {
|
|
234
|
-
return this.proxy?.isRunning() ?? false;
|
|
235
|
-
}
|
|
236
|
-
getPort() {
|
|
237
|
-
return this.proxy?.getPort() ?? null;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Subscribe to proxy events. Returns an unsubscribe function.
|
|
241
|
-
*/
|
|
242
|
-
onEvent(handler) {
|
|
243
|
-
this.eventHandlers.add(handler);
|
|
244
|
-
return () => this.eventHandlers.delete(handler);
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
export {
|
|
249
|
-
ProxyManager
|
|
250
|
-
};
|