@axiom-lattice/core 2.1.17 → 2.1.18
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2074,6 +2074,9 @@ var DefaultSandboxManager = class {
|
|
|
2074
2074
|
this.creatingSandboxes = /* @__PURE__ */ new Map();
|
|
2075
2075
|
this.baseURL = baseURL;
|
|
2076
2076
|
}
|
|
2077
|
+
getBaseURL() {
|
|
2078
|
+
return this.baseURL;
|
|
2079
|
+
}
|
|
2077
2080
|
async createSandbox(sandboxName) {
|
|
2078
2081
|
if (sandboxName === "global") {
|
|
2079
2082
|
const client = new SandboxClient({ baseUrl: `${this.baseURL}/sandbox/global`, environment: "" });
|
|
@@ -2959,7 +2962,33 @@ registerToolLattice(
|
|
|
2959
2962
|
if (!result.ok) {
|
|
2960
2963
|
return `Error taking screenshot: ${JSON.stringify(result.error.content)}`;
|
|
2961
2964
|
}
|
|
2962
|
-
|
|
2965
|
+
const lines = [];
|
|
2966
|
+
for (const item of result.body?.data?.content ?? []) {
|
|
2967
|
+
if (item.type === "image") {
|
|
2968
|
+
const base64Data = item.data;
|
|
2969
|
+
const buffer = Buffer.from(base64Data, "base64");
|
|
2970
|
+
const screenshotPath = `/home/gem/screenshots/screenshot_${input.name}.png`;
|
|
2971
|
+
const uploadResult = await sandbox.file.uploadFile({
|
|
2972
|
+
file: buffer,
|
|
2973
|
+
path: screenshotPath
|
|
2974
|
+
});
|
|
2975
|
+
if (uploadResult.ok) {
|
|
2976
|
+
const screenshot_md = [
|
|
2977
|
+
"",
|
|
2978
|
+
"Screenshot saved!",
|
|
2979
|
+
"```attachments",
|
|
2980
|
+
JSON.stringify([{ id: screenshotPath, name: `screenshot_${input.name}.png` }]),
|
|
2981
|
+
"```"
|
|
2982
|
+
].join("\n");
|
|
2983
|
+
lines.push(screenshot_md);
|
|
2984
|
+
} else {
|
|
2985
|
+
lines.push(`Failed to save screenshot: ${JSON.stringify(uploadResult.error)}`);
|
|
2986
|
+
}
|
|
2987
|
+
} else {
|
|
2988
|
+
lines.push(`${item.text}`);
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
return lines.length > 0 ? lines.join("\n") : "No Content";
|
|
2963
2992
|
} catch (e) {
|
|
2964
2993
|
return `Error taking screenshot: ${e instanceof Error ? e.message : String(e)}`;
|
|
2965
2994
|
}
|
|
@@ -5651,18 +5680,17 @@ var DeepAgentGraphBuilder = class {
|
|
|
5651
5680
|
if (!sandboxManager) {
|
|
5652
5681
|
throw new Error("Sandbox manager not found");
|
|
5653
5682
|
}
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5683
|
+
filesystemBackend = async (agentAndState) => {
|
|
5684
|
+
let sandboxName = "global";
|
|
5685
|
+
if (params.connectedSandbox?.isolatedLevel === "agent") {
|
|
5686
|
+
sandboxName = agentLattice.config.key;
|
|
5687
|
+
} else if (params.connectedSandbox?.isolatedLevel === "thread") {
|
|
5688
|
+
sandboxName = agentAndState.threadId ?? "global";
|
|
5689
|
+
}
|
|
5690
|
+
return new SandboxFilesystem({
|
|
5662
5691
|
sandboxInstance: await sandboxManager.createSandbox(sandboxName)
|
|
5663
|
-
//TODO: add threadId to sandbox
|
|
5664
5692
|
});
|
|
5665
|
-
}
|
|
5693
|
+
};
|
|
5666
5694
|
}
|
|
5667
5695
|
if (availabledModules.includes("code_eval")) {
|
|
5668
5696
|
middlewares.push(createCodeEvalMiddleware());
|