la-machina-engine 0.7.7 → 0.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +33 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2132,18 +2132,32 @@ function canSpawnProcesses() {
|
|
|
2132
2132
|
spawnCache = probeSpawn();
|
|
2133
2133
|
return spawnCache;
|
|
2134
2134
|
}
|
|
2135
|
+
function probeSpawnFromProcess(proc) {
|
|
2136
|
+
if (proc == null || typeof proc !== "object") return false;
|
|
2137
|
+
const p = proc;
|
|
2138
|
+
if (typeof p.getBuiltinModule === "function") {
|
|
2139
|
+
try {
|
|
2140
|
+
const cp = p.getBuiltinModule("node:child_process");
|
|
2141
|
+
if (cp && typeof cp.spawn === "function") return true;
|
|
2142
|
+
} catch {
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
if (typeof p.dlopen === "function") return true;
|
|
2146
|
+
return false;
|
|
2147
|
+
}
|
|
2135
2148
|
function probeSpawn() {
|
|
2136
2149
|
if (typeof globalThis.process === "undefined" || globalThis.process.versions == null || typeof globalThis.process.versions.node !== "string") {
|
|
2137
2150
|
return false;
|
|
2138
2151
|
}
|
|
2139
2152
|
try {
|
|
2140
2153
|
const req = eval("require");
|
|
2141
|
-
if (typeof req
|
|
2142
|
-
|
|
2143
|
-
|
|
2154
|
+
if (typeof req === "function") {
|
|
2155
|
+
const cp = req("node:child_process");
|
|
2156
|
+
if (typeof cp.spawn === "function") return true;
|
|
2157
|
+
}
|
|
2144
2158
|
} catch {
|
|
2145
|
-
return false;
|
|
2146
2159
|
}
|
|
2160
|
+
return probeSpawnFromProcess(globalThis.process);
|
|
2147
2161
|
}
|
|
2148
2162
|
function hasProcessLifecycle() {
|
|
2149
2163
|
return typeof process !== "undefined" && typeof process.on === "function" && typeof process.removeListener === "function" && canSpawnProcesses();
|
|
@@ -2152,6 +2166,9 @@ function _resetRuntimeCachesForTests() {
|
|
|
2152
2166
|
runtimeCache = null;
|
|
2153
2167
|
spawnCache = null;
|
|
2154
2168
|
}
|
|
2169
|
+
function _probeSpawnFromProcessForTests(proc) {
|
|
2170
|
+
return probeSpawnFromProcess(proc);
|
|
2171
|
+
}
|
|
2155
2172
|
|
|
2156
2173
|
// src/tools/capabilityStub.ts
|
|
2157
2174
|
init_cjs_shims();
|
|
@@ -4787,8 +4804,8 @@ init_contract();
|
|
|
4787
4804
|
var _spawn = null;
|
|
4788
4805
|
async function getSpawn() {
|
|
4789
4806
|
if (_spawn === null) {
|
|
4790
|
-
const
|
|
4791
|
-
_spawn =
|
|
4807
|
+
const cp = await import("child_process");
|
|
4808
|
+
_spawn = cp.spawn;
|
|
4792
4809
|
}
|
|
4793
4810
|
return _spawn;
|
|
4794
4811
|
}
|
|
@@ -5455,12 +5472,12 @@ async function runRipgrep(input, ctx) {
|
|
|
5455
5472
|
args.push("--max-count", String(MAX_MATCHES_PER_FILE));
|
|
5456
5473
|
args.push("--", input.pattern);
|
|
5457
5474
|
if (input.path) args.push(input.path);
|
|
5458
|
-
const
|
|
5459
|
-
if (
|
|
5475
|
+
const cp = getChildProcessSync() ?? await getChildProcessAsync();
|
|
5476
|
+
if (cp === null) {
|
|
5460
5477
|
return { content: "ripgrep not available in this runtime", isError: true };
|
|
5461
5478
|
}
|
|
5462
5479
|
return new Promise((resolve) => {
|
|
5463
|
-
const child =
|
|
5480
|
+
const child = cp.spawn("rg", args, {
|
|
5464
5481
|
stdio: ["ignore", "pipe", "pipe"],
|
|
5465
5482
|
timeout: 3e4
|
|
5466
5483
|
});
|
|
@@ -9609,9 +9626,9 @@ var R2StorageAdapter = class {
|
|
|
9609
9626
|
results.push(name);
|
|
9610
9627
|
}
|
|
9611
9628
|
}
|
|
9612
|
-
for (const
|
|
9613
|
-
if (!
|
|
9614
|
-
const name =
|
|
9629
|
+
for (const cp of resp.CommonPrefixes ?? []) {
|
|
9630
|
+
if (!cp.Prefix) continue;
|
|
9631
|
+
const name = cp.Prefix.slice(prefix.length).replace(/\/$/, "");
|
|
9615
9632
|
if (name) results.push(name);
|
|
9616
9633
|
}
|
|
9617
9634
|
continuationToken = resp.IsTruncated ? resp.NextContinuationToken : void 0;
|
|
@@ -11306,7 +11323,10 @@ ${inputJson}
|
|
|
11306
11323
|
"Content-Type": "application/json",
|
|
11307
11324
|
Authorization: `Bearer ${runner.secret}`
|
|
11308
11325
|
},
|
|
11309
|
-
body: JSON.stringify({
|
|
11326
|
+
body: JSON.stringify({
|
|
11327
|
+
runId,
|
|
11328
|
+
workspaceId: this.config.storage.workspaceId
|
|
11329
|
+
})
|
|
11310
11330
|
});
|
|
11311
11331
|
if (!res.ok) {
|
|
11312
11332
|
return {
|