@axiom-lattice/core 2.1.17 → 2.1.19

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 CHANGED
@@ -1924,6 +1924,7 @@ declare class McpLatticeManager extends BaseLatticeManager<McpLatticeInterface>
1924
1924
  declare const mcpManager: McpLatticeManager;
1925
1925
 
1926
1926
  interface SandboxManagerProtocol {
1927
+ getBaseURL(): string;
1927
1928
  createSandbox(sandboxName: string): Promise<SandboxClient>;
1928
1929
  deleteSandbox(sandboxName: string): Promise<void>;
1929
1930
  getSandbox(sandboxName: string): Promise<SandboxClient>;
package/dist/index.d.ts CHANGED
@@ -1924,6 +1924,7 @@ declare class McpLatticeManager extends BaseLatticeManager<McpLatticeInterface>
1924
1924
  declare const mcpManager: McpLatticeManager;
1925
1925
 
1926
1926
  interface SandboxManagerProtocol {
1927
+ getBaseURL(): string;
1927
1928
  createSandbox(sandboxName: string): Promise<SandboxClient>;
1928
1929
  deleteSandbox(sandboxName: string): Promise<void>;
1929
1930
  getSandbox(sandboxName: string): Promise<SandboxClient>;
package/dist/index.js CHANGED
@@ -2198,6 +2198,9 @@ var DefaultSandboxManager = class {
2198
2198
  this.creatingSandboxes = /* @__PURE__ */ new Map();
2199
2199
  this.baseURL = baseURL;
2200
2200
  }
2201
+ getBaseURL() {
2202
+ return this.baseURL;
2203
+ }
2201
2204
  async createSandbox(sandboxName) {
2202
2205
  if (sandboxName === "global") {
2203
2206
  const client = new import_sandbox.SandboxClient({ baseUrl: `${this.baseURL}/sandbox/global`, environment: "" });
@@ -3083,7 +3086,33 @@ registerToolLattice(
3083
3086
  if (!result.ok) {
3084
3087
  return `Error taking screenshot: ${JSON.stringify(result.error.content)}`;
3085
3088
  }
3086
- return result.body?.data?.content?.map((item) => item.text).join("\n") ?? "Screenshot taken successfully";
3089
+ const lines = [];
3090
+ for (const item of result.body?.data?.content ?? []) {
3091
+ if (item.type === "image") {
3092
+ const base64Data = item.data;
3093
+ const buffer = Buffer.from(base64Data, "base64");
3094
+ const screenshotPath = `/home/gem/screenshots/screenshot_${input.name}.png`;
3095
+ const uploadResult = await sandbox.file.uploadFile({
3096
+ file: buffer,
3097
+ path: screenshotPath
3098
+ });
3099
+ if (uploadResult.ok) {
3100
+ const screenshot_md = [
3101
+ "",
3102
+ "Screenshot saved!",
3103
+ "```attachments",
3104
+ JSON.stringify([{ id: screenshotPath, name: `screenshot_${input.name}.png` }]),
3105
+ "```"
3106
+ ].join("\n");
3107
+ lines.push(screenshot_md);
3108
+ } else {
3109
+ lines.push(`Failed to save screenshot: ${JSON.stringify(uploadResult.error)}`);
3110
+ }
3111
+ } else {
3112
+ lines.push(`${item.text}`);
3113
+ }
3114
+ }
3115
+ return lines.length > 0 ? lines.join("\n") : "No Content";
3087
3116
  } catch (e) {
3088
3117
  return `Error taking screenshot: ${e instanceof Error ? e.message : String(e)}`;
3089
3118
  }
@@ -3922,10 +3951,10 @@ function createLsTool(backend, options) {
3922
3951
  const lines = [];
3923
3952
  for (const info of infos) {
3924
3953
  if (info.is_dir) {
3925
- lines.push(`${info.path} (directory)`);
3954
+ lines.push(`<code>${info.path}</code> (directory)`);
3926
3955
  } else {
3927
3956
  const size = info.size ? ` (${info.size} bytes)` : "";
3928
- lines.push(`${info.path}${size}`);
3957
+ lines.push(`<code>${info.path}</code>${size}`);
3929
3958
  }
3930
3959
  }
3931
3960
  return lines.join("\n");
@@ -5742,18 +5771,17 @@ var DeepAgentGraphBuilder = class {
5742
5771
  if (!sandboxManager) {
5743
5772
  throw new Error("Sandbox manager not found");
5744
5773
  }
5745
- let sandboxName = "global";
5746
- if (params.connectedSandbox.isolatedLevel === "agent") {
5747
- sandboxName = agentLattice.config.key;
5748
- filesystemBackend = async (agentAndState) => new SandboxFilesystem({
5749
- sandboxInstance: await sandboxManager.createSandbox(sandboxName)
5750
- });
5751
- } else if (params.connectedSandbox.isolatedLevel === "thread") {
5752
- filesystemBackend = async (agentAndState) => new SandboxFilesystem({
5774
+ filesystemBackend = async (agentAndState) => {
5775
+ let sandboxName = "global";
5776
+ if (params.connectedSandbox?.isolatedLevel === "agent") {
5777
+ sandboxName = agentLattice.config.key;
5778
+ } else if (params.connectedSandbox?.isolatedLevel === "thread") {
5779
+ sandboxName = agentAndState.threadId ?? "global";
5780
+ }
5781
+ return new SandboxFilesystem({
5753
5782
  sandboxInstance: await sandboxManager.createSandbox(sandboxName)
5754
- //TODO: add threadId to sandbox
5755
5783
  });
5756
- }
5784
+ };
5757
5785
  }
5758
5786
  if (availabledModules.includes("code_eval")) {
5759
5787
  middlewares.push(createCodeEvalMiddleware());