@voratiq/sandbox-runtime 0.7.0-voratiq1
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/CHANGELOG.md +10 -0
- package/LICENSE +201 -0
- package/NOTICE +11 -0
- package/README.md +17 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +243 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/sandbox/generate-seccomp-filter.d.ts +56 -0
- package/dist/sandbox/generate-seccomp-filter.d.ts.map +1 -0
- package/dist/sandbox/generate-seccomp-filter.js +158 -0
- package/dist/sandbox/generate-seccomp-filter.js.map +1 -0
- package/dist/sandbox/http-proxy.d.ts +12 -0
- package/dist/sandbox/http-proxy.d.ts.map +1 -0
- package/dist/sandbox/http-proxy.js +489 -0
- package/dist/sandbox/http-proxy.js.map +1 -0
- package/dist/sandbox/linux-sandbox-utils.d.ts +111 -0
- package/dist/sandbox/linux-sandbox-utils.d.ts.map +1 -0
- package/dist/sandbox/linux-sandbox-utils.js +518 -0
- package/dist/sandbox/linux-sandbox-utils.js.map +1 -0
- package/dist/sandbox/macos-sandbox-utils.d.ts +54 -0
- package/dist/sandbox/macos-sandbox-utils.d.ts.map +1 -0
- package/dist/sandbox/macos-sandbox-utils.js +559 -0
- package/dist/sandbox/macos-sandbox-utils.js.map +1 -0
- package/dist/sandbox/sandbox-config.d.ts +170 -0
- package/dist/sandbox/sandbox-config.d.ts.map +1 -0
- package/dist/sandbox/sandbox-config.js +126 -0
- package/dist/sandbox/sandbox-config.js.map +1 -0
- package/dist/sandbox/sandbox-manager.d.ts +35 -0
- package/dist/sandbox/sandbox-manager.d.ts.map +1 -0
- package/dist/sandbox/sandbox-manager.js +666 -0
- package/dist/sandbox/sandbox-manager.js.map +1 -0
- package/dist/sandbox/sandbox-schemas.d.ts +17 -0
- package/dist/sandbox/sandbox-schemas.d.ts.map +1 -0
- package/dist/sandbox/sandbox-schemas.js +2 -0
- package/dist/sandbox/sandbox-schemas.js.map +1 -0
- package/dist/sandbox/sandbox-utils.d.ts +53 -0
- package/dist/sandbox/sandbox-utils.d.ts.map +1 -0
- package/dist/sandbox/sandbox-utils.js +368 -0
- package/dist/sandbox/sandbox-utils.js.map +1 -0
- package/dist/sandbox/sandbox-violation-store.d.ts +19 -0
- package/dist/sandbox/sandbox-violation-store.d.ts.map +1 -0
- package/dist/sandbox/sandbox-violation-store.js +54 -0
- package/dist/sandbox/sandbox-violation-store.js.map +1 -0
- package/dist/sandbox/socks-proxy.d.ts +18 -0
- package/dist/sandbox/socks-proxy.d.ts.map +1 -0
- package/dist/sandbox/socks-proxy.js +242 -0
- package/dist/sandbox/socks-proxy.js.map +1 -0
- package/dist/utils/debug.d.ts +7 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/debug.js +22 -0
- package/dist/utils/debug.js.map +1 -0
- package/dist/utils/platform.d.ts +6 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +16 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/ripgrep.d.ts +20 -0
- package/dist/utils/ripgrep.d.ts.map +1 -0
- package/dist/utils/ripgrep.js +51 -0
- package/dist/utils/ripgrep.js.map +1 -0
- package/dist/utils/telemetry.d.ts +67 -0
- package/dist/utils/telemetry.d.ts.map +1 -0
- package/dist/utils/telemetry.js +249 -0
- package/dist/utils/telemetry.js.map +1 -0
- package/dist/vendor/seccomp/arm64/apply-seccomp +0 -0
- package/dist/vendor/seccomp/arm64/unix-block.bpf +0 -0
- package/dist/vendor/seccomp/x64/apply-seccomp +0 -0
- package/dist/vendor/seccomp/x64/unix-block.bpf +0 -0
- package/dist/vendor/seccomp-src/apply-seccomp.c +98 -0
- package/dist/vendor/seccomp-src/seccomp-unix-block.c +97 -0
- package/package.json +80 -0
- package/vendor/seccomp/arm64/apply-seccomp +0 -0
- package/vendor/seccomp/arm64/unix-block.bpf +0 -0
- package/vendor/seccomp/x64/apply-seccomp +0 -0
- package/vendor/seccomp/x64/unix-block.bpf +0 -0
- package/vendor/seccomp-src/apply-seccomp.c +98 -0
- package/vendor/seccomp-src/seccomp-unix-block.c +97 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { createServer, defaultConnectionHandler, } from '@pondwader/socks5-server';
|
|
2
|
+
import { performance } from 'node:perf_hooks';
|
|
3
|
+
import { logForDebugging } from '../utils/debug.js';
|
|
4
|
+
import { emitTelemetryEvent, isTelemetryEnabled, } from '../utils/telemetry.js';
|
|
5
|
+
const SOCKS_STATUS_CODES = {
|
|
6
|
+
REQUEST_GRANTED: 0,
|
|
7
|
+
GENERAL_FAILURE: 1,
|
|
8
|
+
CONNECTION_NOT_ALLOWED: 2,
|
|
9
|
+
NETWORK_UNREACHABLE: 3,
|
|
10
|
+
HOST_UNREACHABLE: 4,
|
|
11
|
+
CONNECTION_REFUSED: 5,
|
|
12
|
+
TTL_EXPIRED: 6,
|
|
13
|
+
COMMAND_NOT_SUPPORTED: 7,
|
|
14
|
+
ADDRESS_TYPE_NOT_SUPPORTED: 8,
|
|
15
|
+
};
|
|
16
|
+
function inferEgressType(port) {
|
|
17
|
+
if (port === 443) {
|
|
18
|
+
return 'https';
|
|
19
|
+
}
|
|
20
|
+
if (port === 80) {
|
|
21
|
+
return 'http';
|
|
22
|
+
}
|
|
23
|
+
return 'tcp';
|
|
24
|
+
}
|
|
25
|
+
function getOrInitMetadata(connection) {
|
|
26
|
+
if (!connection.metadata || typeof connection.metadata !== 'object') {
|
|
27
|
+
connection.metadata = {};
|
|
28
|
+
}
|
|
29
|
+
return connection.metadata;
|
|
30
|
+
}
|
|
31
|
+
function attachTelemetryContext(connection, context) {
|
|
32
|
+
const metadata = getOrInitMetadata(connection);
|
|
33
|
+
metadata.__telemetry = context;
|
|
34
|
+
}
|
|
35
|
+
function getTelemetryContext(connection) {
|
|
36
|
+
const metadata = connection.metadata;
|
|
37
|
+
if (!metadata || typeof metadata !== 'object') {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return metadata.__telemetry;
|
|
41
|
+
}
|
|
42
|
+
export function createSocksProxyServer(options) {
|
|
43
|
+
const socksServer = createServer();
|
|
44
|
+
socksServer.setRulesetValidator(async (conn) => {
|
|
45
|
+
try {
|
|
46
|
+
const telemetryActive = isTelemetryEnabled();
|
|
47
|
+
const host = conn.destAddress;
|
|
48
|
+
const port = conn.destPort;
|
|
49
|
+
const egressType = inferEgressType(port);
|
|
50
|
+
const startTime = telemetryActive ? performance.now() : 0;
|
|
51
|
+
if (telemetryActive) {
|
|
52
|
+
emitTelemetryEvent({
|
|
53
|
+
stage: 'start',
|
|
54
|
+
status: 'success',
|
|
55
|
+
attempt: 0,
|
|
56
|
+
sandbox_verdict: {
|
|
57
|
+
decision: 'pending',
|
|
58
|
+
reason: 'socks_request_received',
|
|
59
|
+
policy_tag: 'network.allowlist',
|
|
60
|
+
},
|
|
61
|
+
network: {
|
|
62
|
+
resolved_host: host,
|
|
63
|
+
resolved_ip: null,
|
|
64
|
+
tls_outcome: null,
|
|
65
|
+
tls_error: null,
|
|
66
|
+
dns_source: null,
|
|
67
|
+
},
|
|
68
|
+
egress_type: egressType,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
let decision;
|
|
72
|
+
try {
|
|
73
|
+
decision = await options.filter(port, host);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
logForDebugging(`Error validating connection: ${error}`, {
|
|
77
|
+
level: 'error',
|
|
78
|
+
});
|
|
79
|
+
decision = {
|
|
80
|
+
allowed: false,
|
|
81
|
+
verdict: {
|
|
82
|
+
decision: 'deny',
|
|
83
|
+
reason: 'filter_failure',
|
|
84
|
+
policy_tag: 'network.allowlist',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (!decision.allowed) {
|
|
89
|
+
if (telemetryActive) {
|
|
90
|
+
emitTelemetryEvent({
|
|
91
|
+
stage: 'failure',
|
|
92
|
+
status: 'failed',
|
|
93
|
+
attempt: 0,
|
|
94
|
+
status_code: SOCKS_STATUS_CODES.CONNECTION_NOT_ALLOWED,
|
|
95
|
+
sandbox_verdict: decision.verdict,
|
|
96
|
+
network: {
|
|
97
|
+
resolved_host: host,
|
|
98
|
+
resolved_ip: null,
|
|
99
|
+
tls_outcome: null,
|
|
100
|
+
tls_error: null,
|
|
101
|
+
dns_source: null,
|
|
102
|
+
},
|
|
103
|
+
latency_ms: performance.now() - startTime,
|
|
104
|
+
egress_type: egressType,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
const attemptTime = telemetryActive ? performance.now() : 0;
|
|
110
|
+
if (telemetryActive) {
|
|
111
|
+
emitTelemetryEvent({
|
|
112
|
+
stage: 'attempt',
|
|
113
|
+
status: 'success',
|
|
114
|
+
attempt: 0,
|
|
115
|
+
sandbox_verdict: decision.verdict,
|
|
116
|
+
network: {
|
|
117
|
+
resolved_host: host,
|
|
118
|
+
resolved_ip: null,
|
|
119
|
+
tls_outcome: null,
|
|
120
|
+
tls_error: null,
|
|
121
|
+
dns_source: null,
|
|
122
|
+
},
|
|
123
|
+
latency_ms: null,
|
|
124
|
+
queue_latency_ms: attemptTime - startTime,
|
|
125
|
+
egress_type: egressType,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
attachTelemetryContext(conn, {
|
|
129
|
+
host,
|
|
130
|
+
port,
|
|
131
|
+
attempt: 0,
|
|
132
|
+
verdict: decision.verdict,
|
|
133
|
+
startTime,
|
|
134
|
+
attemptTime,
|
|
135
|
+
egressType,
|
|
136
|
+
});
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
logForDebugging(`Error validating connection: ${error}`, {
|
|
141
|
+
level: 'error',
|
|
142
|
+
});
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
socksServer.setConnectionHandler((connection, sendStatus) => {
|
|
147
|
+
const telemetryActive = isTelemetryEnabled();
|
|
148
|
+
const telemetryContext = telemetryActive
|
|
149
|
+
? getTelemetryContext(connection)
|
|
150
|
+
: undefined;
|
|
151
|
+
let statusEmitted = false;
|
|
152
|
+
const wrappedSendStatus = (status) => {
|
|
153
|
+
if (telemetryActive && telemetryContext && !statusEmitted) {
|
|
154
|
+
statusEmitted = true;
|
|
155
|
+
const latency = performance.now() - telemetryContext.attemptTime;
|
|
156
|
+
const statusCode = SOCKS_STATUS_CODES[status] ?? SOCKS_STATUS_CODES.GENERAL_FAILURE;
|
|
157
|
+
const success = status === 'REQUEST_GRANTED';
|
|
158
|
+
emitTelemetryEvent({
|
|
159
|
+
stage: success ? 'completion' : 'failure',
|
|
160
|
+
status: success ? 'success' : 'failed',
|
|
161
|
+
attempt: telemetryContext.attempt,
|
|
162
|
+
status_code: statusCode,
|
|
163
|
+
sandbox_verdict: telemetryContext.verdict,
|
|
164
|
+
network: {
|
|
165
|
+
resolved_host: telemetryContext.host,
|
|
166
|
+
resolved_ip: null,
|
|
167
|
+
tls_outcome: null,
|
|
168
|
+
tls_error: success ? null : status,
|
|
169
|
+
dns_source: null,
|
|
170
|
+
},
|
|
171
|
+
latency_ms: latency,
|
|
172
|
+
egress_type: telemetryContext.egressType,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
sendStatus(status);
|
|
176
|
+
};
|
|
177
|
+
const stream = defaultConnectionHandler(connection, wrappedSendStatus);
|
|
178
|
+
return stream;
|
|
179
|
+
});
|
|
180
|
+
return {
|
|
181
|
+
server: socksServer,
|
|
182
|
+
getPort() {
|
|
183
|
+
try {
|
|
184
|
+
const serverInternal = socksServer?.server;
|
|
185
|
+
if (serverInternal && typeof serverInternal?.address === 'function') {
|
|
186
|
+
const address = serverInternal.address();
|
|
187
|
+
if (address && typeof address === 'object' && 'port' in address) {
|
|
188
|
+
return address.port;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
logForDebugging(`Error getting port: ${error}`, { level: 'error' });
|
|
194
|
+
}
|
|
195
|
+
return undefined;
|
|
196
|
+
},
|
|
197
|
+
listen(port, hostname) {
|
|
198
|
+
return new Promise((resolve, reject) => {
|
|
199
|
+
const listeningCallback = () => {
|
|
200
|
+
const actualPort = this.getPort();
|
|
201
|
+
if (actualPort) {
|
|
202
|
+
logForDebugging(`SOCKS proxy listening on ${hostname}:${actualPort}`);
|
|
203
|
+
resolve(actualPort);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
reject(new Error('Failed to get SOCKS proxy server port'));
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
socksServer.listen(port, hostname, listeningCallback);
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
async close() {
|
|
213
|
+
return new Promise((resolve, reject) => {
|
|
214
|
+
socksServer.close(error => {
|
|
215
|
+
if (error) {
|
|
216
|
+
const errorMessage = error.message?.toLowerCase() || '';
|
|
217
|
+
const isAlreadyClosed = errorMessage.includes('not running') ||
|
|
218
|
+
errorMessage.includes('already closed') ||
|
|
219
|
+
errorMessage.includes('not listening');
|
|
220
|
+
if (!isAlreadyClosed) {
|
|
221
|
+
reject(error);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
resolve();
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
unref() {
|
|
230
|
+
try {
|
|
231
|
+
const serverInternal = socksServer?.server;
|
|
232
|
+
if (serverInternal && typeof serverInternal?.unref === 'function') {
|
|
233
|
+
serverInternal.unref();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
logForDebugging(`Error calling unref: ${error}`, { level: 'error' });
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=socks-proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socks-proxy.js","sourceRoot":"","sources":["../../src/sandbox/socks-proxy.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,wBAAwB,GAEzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,GAEnB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,kBAAkB,GAAG;IACzB,eAAe,EAAE,CAAC;IAClB,eAAe,EAAE,CAAC;IAClB,sBAAsB,EAAE,CAAC;IACzB,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,CAAC;IACnB,kBAAkB,EAAE,CAAC;IACrB,WAAW,EAAE,CAAC;IACd,qBAAqB,EAAE,CAAC;IACxB,0BAA0B,EAAE,CAAC;CACrB,CAAA;AA2CV,SAAS,eAAe,CAAC,IAAY;IACnC,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;QACjB,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QAChB,OAAO,MAAM,CAAA;IACf,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,iBAAiB,CACxB,UAAmC;IAEnC,IAAI,CAAC,UAAU,CAAC,QAAQ,IAAI,OAAO,UAAU,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACpE,UAAU,CAAC,QAAQ,GAAG,EAAE,CAAA;IAC1B,CAAC;IACD,OAAO,UAAU,CAAC,QAA6B,CAAA;AACjD,CAAC;AAED,SAAS,sBAAsB,CAC7B,UAAmC,EACnC,OAA8B;IAE9B,MAAM,QAAQ,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAA;IAC9C,QAA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CAAC,CAAC,CAAA;QACJ,CAAC;QACD,KAAK;YACH,IAAI,CAAC;gBACH,MAAM,cAAc,GAClB,WACD,EAAE,MAAM,CAAA;gBACT,IAAI,cAAc,IAAI,OAAO,cAAc,EAAE,KAAK,KAAK,UAAU,EAAE,CAAC;oBAClE,cAAc,CAAC,KAAK,EAAE,CAAA;gBACxB,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,eAAe,CAAC,wBAAwB,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;YACtE,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/utils/debug.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;CAAE,GAC9C,IAAI,CAmBN"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple debug logging for standalone sandbox
|
|
3
|
+
*/
|
|
4
|
+
export function logForDebugging(message, options) {
|
|
5
|
+
// Only log if DEBUG environment variable is set
|
|
6
|
+
if (!process.env.DEBUG) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const level = options?.level || 'info';
|
|
10
|
+
const prefix = '[SandboxDebug]';
|
|
11
|
+
switch (level) {
|
|
12
|
+
case 'error':
|
|
13
|
+
console.error(`${prefix} ${message}`);
|
|
14
|
+
break;
|
|
15
|
+
case 'warn':
|
|
16
|
+
console.warn(`${prefix} ${message}`);
|
|
17
|
+
break;
|
|
18
|
+
default:
|
|
19
|
+
console.log(`${prefix} ${message}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/utils/debug.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,OAA+C;IAE/C,gDAAgD;IAChD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACvB,OAAM;IACR,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,MAAM,CAAA;IACtC,MAAM,MAAM,GAAG,gBAAgB,CAAA;IAE/B,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,OAAO;YACV,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC,CAAA;YACrC,MAAK;QACP,KAAK,MAAM;YACT,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC,CAAA;YACpC,MAAK;QACP;YACE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC,CAAA;IACvC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/utils/platform.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAEhE,wBAAgB,WAAW,IAAI,QAAQ,CAWtC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform detection utilities
|
|
3
|
+
*/
|
|
4
|
+
export function getPlatform() {
|
|
5
|
+
switch (process.platform) {
|
|
6
|
+
case 'darwin':
|
|
7
|
+
return 'macos';
|
|
8
|
+
case 'linux':
|
|
9
|
+
return 'linux';
|
|
10
|
+
case 'win32':
|
|
11
|
+
return 'windows';
|
|
12
|
+
default:
|
|
13
|
+
return 'unknown';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/utils/platform.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,UAAU,WAAW;IACzB,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzB,KAAK,QAAQ;YACX,OAAO,OAAO,CAAA;QAChB,KAAK,OAAO;YACV,OAAO,OAAO,CAAA;QAChB,KAAK,OAAO;YACV,OAAO,SAAS,CAAA;QAClB;YACE,OAAO,SAAS,CAAA;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface RipgrepConfig {
|
|
2
|
+
command: string;
|
|
3
|
+
args?: string[];
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Check if ripgrep (rg) is available synchronously
|
|
7
|
+
* Returns true if rg is installed, false otherwise
|
|
8
|
+
*/
|
|
9
|
+
export declare function hasRipgrepSync(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Execute ripgrep with the given arguments
|
|
12
|
+
* @param args Command-line arguments to pass to rg
|
|
13
|
+
* @param target Target directory or file to search
|
|
14
|
+
* @param abortSignal AbortSignal to cancel the operation
|
|
15
|
+
* @param config Ripgrep configuration (command and optional args)
|
|
16
|
+
* @returns Array of matching lines (one per line of output)
|
|
17
|
+
* @throws Error if ripgrep exits with non-zero status (except exit code 1 which means no matches)
|
|
18
|
+
*/
|
|
19
|
+
export declare function ripGrep(args: string[], target: string, abortSignal: AbortSignal, config?: RipgrepConfig): Promise<string[]>;
|
|
20
|
+
//# sourceMappingURL=ripgrep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ripgrep.d.ts","sourceRoot":"","sources":["../../src/utils/ripgrep.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAWxC;AAED;;;;;;;;GAQG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,MAAM,GAAE,aAAiC,GACxC,OAAO,CAAC,MAAM,EAAE,CAAC,CAkCnB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { spawnSync } from 'child_process';
|
|
2
|
+
import { execFile } from 'child_process';
|
|
3
|
+
/**
|
|
4
|
+
* Check if ripgrep (rg) is available synchronously
|
|
5
|
+
* Returns true if rg is installed, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export function hasRipgrepSync() {
|
|
8
|
+
try {
|
|
9
|
+
const result = spawnSync('which', ['rg'], {
|
|
10
|
+
stdio: 'ignore',
|
|
11
|
+
timeout: 1000,
|
|
12
|
+
});
|
|
13
|
+
return result.status === 0;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Execute ripgrep with the given arguments
|
|
21
|
+
* @param args Command-line arguments to pass to rg
|
|
22
|
+
* @param target Target directory or file to search
|
|
23
|
+
* @param abortSignal AbortSignal to cancel the operation
|
|
24
|
+
* @param config Ripgrep configuration (command and optional args)
|
|
25
|
+
* @returns Array of matching lines (one per line of output)
|
|
26
|
+
* @throws Error if ripgrep exits with non-zero status (except exit code 1 which means no matches)
|
|
27
|
+
*/
|
|
28
|
+
export async function ripGrep(args, target, abortSignal, config = { command: 'rg' }) {
|
|
29
|
+
const { command, args: commandArgs = [] } = config;
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
execFile(command, [...commandArgs, ...args, target], {
|
|
32
|
+
maxBuffer: 20000000, // 20MB
|
|
33
|
+
signal: abortSignal,
|
|
34
|
+
timeout: 10000, // 10 second timeout
|
|
35
|
+
}, (error, stdout, stderr) => {
|
|
36
|
+
// Success case - exit code 0
|
|
37
|
+
if (!error) {
|
|
38
|
+
resolve(stdout.trim().split('\n').filter(Boolean));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// Exit code 1 means "no matches found" - this is normal, return empty array
|
|
42
|
+
if (error.code === 1) {
|
|
43
|
+
resolve([]);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// All other errors should fail
|
|
47
|
+
reject(new Error(`ripgrep failed with exit code ${error.code}: ${stderr || error.message}`));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=ripgrep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ripgrep.js","sourceRoot":"","sources":["../../src/utils/ripgrep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAQxC;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE;YACxC,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAA;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,IAAc,EACd,MAAc,EACd,WAAwB,EACxB,SAAwB,EAAE,OAAO,EAAE,IAAI,EAAE;IAEzC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,MAAM,CAAA;IAElD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,QAAQ,CACN,OAAO,EACP,CAAC,GAAG,WAAW,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,EACjC;YACE,SAAS,EAAE,QAAU,EAAE,OAAO;YAC9B,MAAM,EAAE,WAAW;YACnB,OAAO,EAAE,KAAM,EAAE,oBAAoB;SACtC,EACD,CAAC,KAA+B,EAAE,MAAc,EAAE,MAAc,EAAE,EAAE;YAClE,6BAA6B;YAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;gBAClD,OAAM;YACR,CAAC;YAED,4EAA4E;YAC5E,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBACrB,OAAO,CAAC,EAAE,CAAC,CAAA;gBACX,OAAM;YACR,CAAC;YAED,+BAA+B;YAC/B,MAAM,CACJ,IAAI,KAAK,CACP,iCAAiC,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAC1E,CACF,CAAA;QACH,CAAC,CACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export type TelemetryStage = 'start' | 'attempt' | 'completion' | 'failure';
|
|
2
|
+
export type TelemetryStatus = 'success' | 'failed' | 'cancelled';
|
|
3
|
+
export interface TelemetrySandboxVerdict {
|
|
4
|
+
decision: string | null;
|
|
5
|
+
reason: string | null;
|
|
6
|
+
policy_tag: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface TelemetryNetworkDetails {
|
|
9
|
+
resolved_host: string | null;
|
|
10
|
+
resolved_ip: string | null;
|
|
11
|
+
tls_outcome: string | null;
|
|
12
|
+
tls_error: string | null;
|
|
13
|
+
dns_source: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface TelemetryHttpMetadata {
|
|
16
|
+
req_headers: Record<string, string | null> | null;
|
|
17
|
+
resp_headers: Record<string, string | null> | null;
|
|
18
|
+
payload_bytes: number | null;
|
|
19
|
+
payload_hash: string | null;
|
|
20
|
+
compression: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface TelemetryEvent {
|
|
23
|
+
event: 'sandbox_request';
|
|
24
|
+
trace_id: string;
|
|
25
|
+
stage: TelemetryStage;
|
|
26
|
+
attempt: number;
|
|
27
|
+
command: string | null;
|
|
28
|
+
status: TelemetryStatus;
|
|
29
|
+
status_code: number | null;
|
|
30
|
+
sandbox_verdict: TelemetrySandboxVerdict | null;
|
|
31
|
+
network: TelemetryNetworkDetails | null;
|
|
32
|
+
http_metadata: TelemetryHttpMetadata | null;
|
|
33
|
+
latency_ms: number | null;
|
|
34
|
+
queue_latency_ms: number | null;
|
|
35
|
+
user_context: string | null;
|
|
36
|
+
egress_type: string | null;
|
|
37
|
+
timestamp: string;
|
|
38
|
+
}
|
|
39
|
+
export type TelemetrySink = (event: TelemetryEvent) => void;
|
|
40
|
+
export interface InitializeTelemetryOptions {
|
|
41
|
+
debugEnabled: boolean;
|
|
42
|
+
commandArgs?: string[];
|
|
43
|
+
userContext?: string | null;
|
|
44
|
+
}
|
|
45
|
+
export declare function initializeTelemetry(options: InitializeTelemetryOptions): string | null;
|
|
46
|
+
export declare function isTelemetryEnabled(): boolean;
|
|
47
|
+
export declare function getTelemetryTraceId(): string | null;
|
|
48
|
+
export declare function setTelemetrySink(sink: TelemetrySink | null): void;
|
|
49
|
+
export interface EmitTelemetryEventOptions {
|
|
50
|
+
stage: TelemetryStage;
|
|
51
|
+
status: TelemetryStatus;
|
|
52
|
+
attempt?: number;
|
|
53
|
+
status_code?: number | null;
|
|
54
|
+
sandbox_verdict?: Partial<TelemetrySandboxVerdict> | null;
|
|
55
|
+
network?: Partial<TelemetryNetworkDetails> | null;
|
|
56
|
+
http_metadata?: Partial<TelemetryHttpMetadata> | null;
|
|
57
|
+
latency_ms?: number | null;
|
|
58
|
+
queue_latency_ms?: number | null;
|
|
59
|
+
user_context?: string | null;
|
|
60
|
+
egress_type?: string | null;
|
|
61
|
+
command?: string | null;
|
|
62
|
+
}
|
|
63
|
+
export declare function emitTelemetryEvent(options: EmitTelemetryEventOptions): TelemetryEvent | null;
|
|
64
|
+
export declare function sanitizeCommandArgs(args: string[]): string;
|
|
65
|
+
export declare function sanitizeHeaders(headers: Record<string, number | string | string[] | undefined>, whitelist?: Set<string>): Record<string, string | null>;
|
|
66
|
+
export declare function redactValue(value: string): string;
|
|
67
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/utils/telemetry.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAA;AAC3E,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAA;AAEhE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;IACjD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;IAClD,aA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