la-machina-engine 0.7.6 → 0.7.8
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 +46 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -9
- package/dist/index.d.ts +32 -9
- package/dist/index.js +46 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2114,11 +2114,12 @@ function createModelAdapter(config, options = {}) {
|
|
|
2114
2114
|
|
|
2115
2115
|
// src/runtime/detect.ts
|
|
2116
2116
|
init_cjs_shims();
|
|
2117
|
-
var
|
|
2117
|
+
var runtimeCache = null;
|
|
2118
|
+
var spawnCache = null;
|
|
2118
2119
|
function detectRuntime() {
|
|
2119
|
-
if (
|
|
2120
|
-
|
|
2121
|
-
return
|
|
2120
|
+
if (runtimeCache !== null) return runtimeCache;
|
|
2121
|
+
runtimeCache = isNodeRuntime() ? "node" : "worker";
|
|
2122
|
+
return runtimeCache;
|
|
2122
2123
|
}
|
|
2123
2124
|
function isNodeRuntime() {
|
|
2124
2125
|
if (typeof globalThis.process !== "undefined" && globalThis.process.versions != null && typeof globalThis.process.versions.node === "string") {
|
|
@@ -2127,10 +2128,29 @@ function isNodeRuntime() {
|
|
|
2127
2128
|
return false;
|
|
2128
2129
|
}
|
|
2129
2130
|
function canSpawnProcesses() {
|
|
2130
|
-
|
|
2131
|
+
if (spawnCache !== null) return spawnCache;
|
|
2132
|
+
spawnCache = probeSpawn();
|
|
2133
|
+
return spawnCache;
|
|
2134
|
+
}
|
|
2135
|
+
function probeSpawn() {
|
|
2136
|
+
if (typeof globalThis.process === "undefined" || globalThis.process.versions == null || typeof globalThis.process.versions.node !== "string") {
|
|
2137
|
+
return false;
|
|
2138
|
+
}
|
|
2139
|
+
try {
|
|
2140
|
+
const req = eval("require");
|
|
2141
|
+
if (typeof req !== "function") return false;
|
|
2142
|
+
const cp = req("node:child_process");
|
|
2143
|
+
return typeof cp.spawn === "function";
|
|
2144
|
+
} catch {
|
|
2145
|
+
return false;
|
|
2146
|
+
}
|
|
2131
2147
|
}
|
|
2132
2148
|
function hasProcessLifecycle() {
|
|
2133
|
-
return typeof process !== "undefined" && typeof process.on === "function" && typeof process.removeListener === "function" &&
|
|
2149
|
+
return typeof process !== "undefined" && typeof process.on === "function" && typeof process.removeListener === "function" && canSpawnProcesses();
|
|
2150
|
+
}
|
|
2151
|
+
function _resetRuntimeCachesForTests() {
|
|
2152
|
+
runtimeCache = null;
|
|
2153
|
+
spawnCache = null;
|
|
2134
2154
|
}
|
|
2135
2155
|
|
|
2136
2156
|
// src/tools/capabilityStub.ts
|
|
@@ -4767,8 +4787,8 @@ init_contract();
|
|
|
4767
4787
|
var _spawn = null;
|
|
4768
4788
|
async function getSpawn() {
|
|
4769
4789
|
if (_spawn === null) {
|
|
4770
|
-
const
|
|
4771
|
-
_spawn =
|
|
4790
|
+
const cp2 = await import("child_process");
|
|
4791
|
+
_spawn = cp2.spawn;
|
|
4772
4792
|
}
|
|
4773
4793
|
return _spawn;
|
|
4774
4794
|
}
|
|
@@ -5435,12 +5455,12 @@ async function runRipgrep(input, ctx) {
|
|
|
5435
5455
|
args.push("--max-count", String(MAX_MATCHES_PER_FILE));
|
|
5436
5456
|
args.push("--", input.pattern);
|
|
5437
5457
|
if (input.path) args.push(input.path);
|
|
5438
|
-
const
|
|
5439
|
-
if (
|
|
5458
|
+
const cp2 = getChildProcessSync() ?? await getChildProcessAsync();
|
|
5459
|
+
if (cp2 === null) {
|
|
5440
5460
|
return { content: "ripgrep not available in this runtime", isError: true };
|
|
5441
5461
|
}
|
|
5442
5462
|
return new Promise((resolve) => {
|
|
5443
|
-
const child =
|
|
5463
|
+
const child = cp2.spawn("rg", args, {
|
|
5444
5464
|
stdio: ["ignore", "pipe", "pipe"],
|
|
5445
5465
|
timeout: 3e4
|
|
5446
5466
|
});
|
|
@@ -8815,8 +8835,8 @@ function truncatePreview(s) {
|
|
|
8815
8835
|
return s.slice(0, 200) + "\u2026";
|
|
8816
8836
|
}
|
|
8817
8837
|
async function loadIndex(adapter, base, cache) {
|
|
8818
|
-
const
|
|
8819
|
-
if (
|
|
8838
|
+
const cached = cache.get(base);
|
|
8839
|
+
if (cached !== void 0) return cached;
|
|
8820
8840
|
let raw = null;
|
|
8821
8841
|
try {
|
|
8822
8842
|
raw = await adapter.readFile(`${base}/_index.json`);
|
|
@@ -9097,8 +9117,8 @@ ${payload}`,
|
|
|
9097
9117
|
};
|
|
9098
9118
|
}
|
|
9099
9119
|
async function loadIndex2(adapter, base, cache) {
|
|
9100
|
-
const
|
|
9101
|
-
if (
|
|
9120
|
+
const cached = cache.get(base);
|
|
9121
|
+
if (cached !== void 0) return cached;
|
|
9102
9122
|
let raw = null;
|
|
9103
9123
|
try {
|
|
9104
9124
|
raw = await adapter.readFile(`${base}/_index.json`);
|
|
@@ -9122,8 +9142,8 @@ async function loadIndex2(adapter, base, cache) {
|
|
|
9122
9142
|
}
|
|
9123
9143
|
}
|
|
9124
9144
|
async function readFile(adapter, path, cache) {
|
|
9125
|
-
const
|
|
9126
|
-
if (
|
|
9145
|
+
const cached = cache.get(path);
|
|
9146
|
+
if (cached !== void 0) return cached;
|
|
9127
9147
|
const content = await adapter.readFile(path).catch(() => null);
|
|
9128
9148
|
if (content === null) return null;
|
|
9129
9149
|
cache.set(path, content);
|
|
@@ -9279,8 +9299,8 @@ var InlineSkillSource = class {
|
|
|
9279
9299
|
async resolve(cacheKey, inline, url, headers) {
|
|
9280
9300
|
if (inline !== void 0) return inline;
|
|
9281
9301
|
if (url === void 0) return null;
|
|
9282
|
-
const
|
|
9283
|
-
if (
|
|
9302
|
+
const cached = this.cache.get(cacheKey);
|
|
9303
|
+
if (cached !== void 0) return cached;
|
|
9284
9304
|
this.assertUrlAllowed(url);
|
|
9285
9305
|
const controller = new AbortController();
|
|
9286
9306
|
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
@@ -9589,9 +9609,9 @@ var R2StorageAdapter = class {
|
|
|
9589
9609
|
results.push(name);
|
|
9590
9610
|
}
|
|
9591
9611
|
}
|
|
9592
|
-
for (const
|
|
9593
|
-
if (!
|
|
9594
|
-
const name =
|
|
9612
|
+
for (const cp2 of resp.CommonPrefixes ?? []) {
|
|
9613
|
+
if (!cp2.Prefix) continue;
|
|
9614
|
+
const name = cp2.Prefix.slice(prefix.length).replace(/\/$/, "");
|
|
9595
9615
|
if (name) results.push(name);
|
|
9596
9616
|
}
|
|
9597
9617
|
continuationToken = resp.IsTruncated ? resp.NextContinuationToken : void 0;
|
|
@@ -11286,7 +11306,10 @@ ${inputJson}
|
|
|
11286
11306
|
"Content-Type": "application/json",
|
|
11287
11307
|
Authorization: `Bearer ${runner.secret}`
|
|
11288
11308
|
},
|
|
11289
|
-
body: JSON.stringify({
|
|
11309
|
+
body: JSON.stringify({
|
|
11310
|
+
runId,
|
|
11311
|
+
workspaceId: this.config.storage.workspaceId
|
|
11312
|
+
})
|
|
11290
11313
|
});
|
|
11291
11314
|
if (!res.ok) {
|
|
11292
11315
|
return {
|