@axiom-lattice/core 2.1.54 → 2.1.56

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.mjs CHANGED
@@ -3472,10 +3472,10 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
3472
3472
  }
3473
3473
  _resolveVolumeForPath(config, tenantId, filePath) {
3474
3474
  const normalized = normalizeExternalSandboxPath(filePath);
3475
- if (normalized === "/.agent" || normalized.startsWith("/.agent/")) {
3475
+ if (normalized === "/root/.agents" || normalized.startsWith("/root/.agents/")) {
3476
3476
  return {
3477
3477
  volumeName: buildNamedVolumeName("s", "skills", tenantId),
3478
- pathPrefix: "/.agent"
3478
+ pathPrefix: "/root/.agents"
3479
3479
  };
3480
3480
  }
3481
3481
  if (normalized === "/agent" || normalized.startsWith("/agent/")) {
@@ -4878,13 +4878,13 @@ var createLoadSkillContentTool = () => {
4878
4878
  async (input, _exe_config) => {
4879
4879
  try {
4880
4880
  const sandbox = await getSandboxFromExeConfig(_exe_config);
4881
- const filePath = `/.agent/skills/${input.skill_name}/SKILL.md`;
4881
+ const filePath = `/root/.agents/skills/${input.skill_name}/SKILL.md`;
4882
4882
  let content;
4883
4883
  try {
4884
4884
  const result2 = await sandbox.file.readFile(filePath);
4885
4885
  content = result2.content;
4886
4886
  } catch {
4887
- const listResult = await sandbox.file.listPath("/.agent/skills", { recursive: false });
4887
+ const listResult = await sandbox.file.listPath("/root/.agents/skills", { recursive: false });
4888
4888
  const available = listResult.files.filter((f) => f.is_dir).map((f) => f.path.split("/").pop()).filter(Boolean).join(", ");
4889
4889
  return `Skill "${input.skill_name}" not found. Available skills: ${available}`;
4890
4890
  }
@@ -4892,7 +4892,7 @@ var createLoadSkillContentTool = () => {
4892
4892
  let result = buildSkillFile(meta, body);
4893
4893
  try {
4894
4894
  const resourcesResult = await sandbox.file.listPath(
4895
- `/.agent/skills/${input.skill_name}/resources`,
4895
+ `/root/.agents/skills/${input.skill_name}/resources`,
4896
4896
  { recursive: false }
4897
4897
  );
4898
4898
  const resources = resourcesResult.files.map((f) => f.path.split("/").pop()).filter(Boolean);
@@ -4945,14 +4945,14 @@ function createSkillMiddleware(params = {}) {
4945
4945
  projectId: runConfig.projectId,
4946
4946
  vmIsolation: "project"
4947
4947
  });
4948
- const result = await sandbox.file.listPath("/.agent/skills", { recursive: false });
4948
+ const result = await sandbox.file.listPath("/root/.agents/skills", { recursive: false });
4949
4949
  const allSkills = [];
4950
4950
  for (const entry of result.files) {
4951
4951
  if (!entry.is_dir) continue;
4952
4952
  const skillName = entry.path.split("/").pop();
4953
4953
  if (!skillName) continue;
4954
4954
  try {
4955
- const fileResult = await sandbox.file.readFile(`/.agent/skills/${skillName}/SKILL.md`);
4955
+ const fileResult = await sandbox.file.readFile(`/root/.agents/skills/${skillName}/SKILL.md`);
4956
4956
  const { meta } = parseSkillFrontmatter(fileResult.content);
4957
4957
  allSkills.push({
4958
4958
  id: skillName,
@@ -5488,7 +5488,7 @@ Path conventions:
5488
5488
  - All paths are absolute starting with /. Key directories:
5489
5489
  - /agent/ \u2014 Your private agent directory (identity, memory, preferences). Isolated per agent.
5490
5490
  - /project/ \u2014 Project workspace. Shared across all agents in the same project. Persisted across sessions.
5491
- - /.agent/skills/ \u2014 Skill definitions. Read-only for most operations.
5491
+ - /root/.agents/skills/ \u2014 Skill definitions. Read-only for most operations.
5492
5492
 
5493
5493
  - ls: list files in a directory
5494
5494
  - read_file: read a file from the filesystem
@@ -16504,7 +16504,7 @@ var SandboxSkillStore = class {
16504
16504
  if (name.includes("..") || name.includes("/") || name.includes("\\")) {
16505
16505
  throw new Error(`Invalid skill name: ${name} (contains invalid characters)`);
16506
16506
  }
16507
- return `/.agent/skills/${name}`;
16507
+ return `/root/.agents/skills/${name}`;
16508
16508
  }
16509
16509
  /**
16510
16510
  * Get skill file path in sandbox (absolute path with ~/ prefix)
@@ -16571,14 +16571,14 @@ ${body}` : `${frontmatter}
16571
16571
  async getAllSkills(tenantId, context) {
16572
16572
  try {
16573
16573
  const sandbox = await this.getSandbox(tenantId, context);
16574
- const skillsDir = "/.agent/skills";
16574
+ const skillsDir = "/root/.agents/skills";
16575
16575
  try {
16576
16576
  await sandbox.file.listPath(skillsDir, { recursive: false });
16577
16577
  } catch (listError) {
16578
16578
  console.log(`[SandboxSkillStore] Skills directory not found, creating: ${skillsDir}`);
16579
16579
  try {
16580
16580
  await sandbox.shell.execCommand({
16581
- command: `mkdir -p /.agent/skills`
16581
+ command: `mkdir -p /root/.agents/skills`
16582
16582
  });
16583
16583
  } catch (mkdirError) {
16584
16584
  console.error(`[SandboxSkillStore] Failed to create skills directory: ${mkdirError.message}`);
@@ -18173,227 +18173,6 @@ var McpLatticeManager = class _McpLatticeManager extends BaseLatticeManager {
18173
18173
  };
18174
18174
  var mcpManager = McpLatticeManager.getInstance();
18175
18175
 
18176
- // src/sandbox_lattice/providers/MicrosandboxProvider.ts
18177
- import { Sandbox } from "microsandbox";
18178
-
18179
- // src/sandbox_lattice/MicrosandboxInstance.ts
18180
- function exec(native, cmd, opts) {
18181
- return native.execWithConfig({ cmd, args: opts?.args, cwd: opts?.cwd, timeoutMs: opts?.timeoutMs });
18182
- }
18183
- var MicrosandboxInstance = class {
18184
- constructor(name, native) {
18185
- this.native = native;
18186
- this.file = {
18187
- readFile: async (file) => {
18188
- const fs3 = this.native.fs();
18189
- const content = await fs3.readString(file);
18190
- return { content };
18191
- },
18192
- writeFile: async (file, content) => {
18193
- const fs3 = this.native.fs();
18194
- await fs3.write(file, Buffer.from(content));
18195
- },
18196
- listPath: async (path3, options) => {
18197
- const fs3 = this.native.fs();
18198
- const entries = await fs3.list(path3);
18199
- const files = (entries || []).map((e) => ({
18200
- path: e.path,
18201
- is_dir: e.kind === "directory",
18202
- size: e.size,
18203
- modified_at: e.modified ? String(e.modified) : void 0
18204
- }));
18205
- return { files };
18206
- },
18207
- findFiles: async (path3, glob) => {
18208
- const output = await exec(this.native, "sh", {
18209
- args: ["-c", `find "${path3}" -name "${glob}" -type f`]
18210
- });
18211
- const lines = output.stdout().split("\n").filter(Boolean);
18212
- return { files: lines };
18213
- },
18214
- searchInFile: async (file, regex) => {
18215
- const output = await exec(this.native, "grep", {
18216
- args: ["-n", "-E", regex, file]
18217
- });
18218
- const lines = output.stdout().split("\n").filter(Boolean);
18219
- const matches = [];
18220
- const line_numbers = [];
18221
- for (const line of lines) {
18222
- const colonIdx = line.indexOf(":");
18223
- if (colonIdx === -1) continue;
18224
- const num = parseInt(line.slice(0, colonIdx), 10);
18225
- const text = line.slice(colonIdx + 1);
18226
- line_numbers.push(num);
18227
- matches.push(text);
18228
- }
18229
- return { matches, line_numbers };
18230
- },
18231
- strReplaceEditor: async (params) => {
18232
- const { path: path3, old_str, new_str, replace_mode } = params;
18233
- const delim = "#";
18234
- const escapedOld = old_str.replace(new RegExp(`[\\\\${delim}]`, "g"), "\\$&").replace(/\n/g, "\\n");
18235
- const escapedNew = new_str.replace(new RegExp(`[\\\\${delim}]`, "g"), "\\$&").replace(/\n/g, "\\n");
18236
- const flag = replace_mode === "ALL" ? "g" : "";
18237
- await exec(this.native, "sh", {
18238
- args: ["-c", `sed -i 's${delim}${escapedOld}${delim}${escapedNew}${delim}${flag}' "${path3}"`]
18239
- });
18240
- },
18241
- uploadFile: async (params) => {
18242
- const fs3 = this.native.fs();
18243
- await fs3.write(params.file, params.data);
18244
- },
18245
- downloadFile: async (params) => {
18246
- const fs3 = this.native.fs();
18247
- const data = await fs3.read(params.file);
18248
- return Buffer.isBuffer(data) ? data : Buffer.from(data);
18249
- }
18250
- };
18251
- this.shell = {
18252
- execCommand: async (params) => {
18253
- const output = await exec(this.native, "sh", {
18254
- args: ["-c", params.command],
18255
- cwd: params.exec_dir,
18256
- timeoutMs: params.timeout ? params.timeout * 1e3 : void 0
18257
- });
18258
- return {
18259
- output: output.stdout(),
18260
- exit_code: output.code ?? 0
18261
- };
18262
- }
18263
- };
18264
- this.name = name;
18265
- }
18266
- async start() {
18267
- }
18268
- async stop() {
18269
- await this.native.stop();
18270
- }
18271
- async kill() {
18272
- await this.native.kill();
18273
- }
18274
- async getStatus() {
18275
- try {
18276
- await this.native.exec("echo", ["ok"]);
18277
- return "running";
18278
- } catch {
18279
- return "unknown";
18280
- }
18281
- }
18282
- };
18283
-
18284
- // src/sandbox_lattice/providers/MicrosandboxProvider.ts
18285
- var defaultMicrosandboxConfig = {
18286
- image: process.env.MICROSANDBOX_IMAGE ?? "python:3.11-slim",
18287
- cpus: Number(process.env.MICROSANDBOX_CPUS ?? "1"),
18288
- memoryMib: Number(process.env.MICROSANDBOX_MEMORY ?? "512"),
18289
- env: {
18290
- PYTHONDONTWRITEBYTECODE: "1",
18291
- PIP_NO_CACHE_DIR: "1",
18292
- ...process.env.MICROSANDBOX_EXTRA_ENV ? Object.fromEntries(
18293
- process.env.MICROSANDBOX_EXTRA_ENV.split(",").map((pair) => pair.split("="))
18294
- ) : {}
18295
- }
18296
- };
18297
- var MicrosandboxProvider = class {
18298
- constructor(config = {}) {
18299
- this.config = config;
18300
- this.instances = /* @__PURE__ */ new Map();
18301
- this.creating = /* @__PURE__ */ new Map();
18302
- }
18303
- async createSandbox(name, config) {
18304
- const existing = this.instances.get(name);
18305
- if (existing) {
18306
- return existing;
18307
- }
18308
- const inFlight = this.creating.get(name);
18309
- if (inFlight) {
18310
- return inFlight;
18311
- }
18312
- const creation = (async () => {
18313
- let native;
18314
- try {
18315
- const handle = await Sandbox.get(name);
18316
- if (handle.status === "stopped") {
18317
- native = await Sandbox.start(name);
18318
- } else if (handle.status === "running") {
18319
- native = await handle.connect();
18320
- } else if (handle.status === "crashed" || handle.status === "draining") {
18321
- await Sandbox.remove(name);
18322
- native = void 0;
18323
- } else {
18324
- throw new Error(`Unexpected sandbox status: ${handle.status}`);
18325
- }
18326
- } catch {
18327
- native = void 0;
18328
- }
18329
- if (!native) {
18330
- try {
18331
- native = await Sandbox.createDetached({
18332
- name,
18333
- image: this.config.image ?? "python:3.11-slim",
18334
- cpus: this.config.cpus ?? 1,
18335
- memoryMib: this.config.memoryMib ?? 512,
18336
- env: {
18337
- ...this.config.env,
18338
- ...buildSandboxMetadataEnv(config)
18339
- }
18340
- });
18341
- } catch (err) {
18342
- if (err instanceof Error && err.message.includes("already exists")) {
18343
- await Sandbox.remove(name);
18344
- native = await Sandbox.createDetached({
18345
- name,
18346
- image: this.config.image ?? "python:3.11-slim",
18347
- cpus: this.config.cpus ?? 1,
18348
- memoryMib: this.config.memoryMib ?? 512,
18349
- env: {
18350
- ...this.config.env,
18351
- ...buildSandboxMetadataEnv(config)
18352
- }
18353
- });
18354
- } else {
18355
- throw err;
18356
- }
18357
- }
18358
- }
18359
- const instance = new MicrosandboxInstance(name, native);
18360
- this.instances.set(name, instance);
18361
- return instance;
18362
- })();
18363
- this.creating.set(name, creation);
18364
- creation.catch(() => this.creating.delete(name)).then(() => this.creating.delete(name));
18365
- return creation;
18366
- }
18367
- async getSandbox(name) {
18368
- const instance = this.instances.get(name);
18369
- if (!instance) {
18370
- throw new Error(`Sandbox ${name} not found`);
18371
- }
18372
- return instance;
18373
- }
18374
- async stopSandbox(name) {
18375
- const instance = this.instances.get(name);
18376
- if (instance) {
18377
- await instance.stop();
18378
- }
18379
- }
18380
- async deleteSandbox(name) {
18381
- const instance = this.instances.get(name);
18382
- if (instance) {
18383
- try {
18384
- await instance.kill();
18385
- await new Promise((r) => setTimeout(r, 200));
18386
- } catch {
18387
- }
18388
- }
18389
- await Sandbox.remove(name);
18390
- this.instances.delete(name);
18391
- }
18392
- async listSandboxes() {
18393
- return Array.from(this.instances.values());
18394
- }
18395
- };
18396
-
18397
18176
  // src/sandbox_lattice/MicrosandboxRemoteInstance.ts
18398
18177
  var MicrosandboxRemoteInstance = class {
18399
18178
  constructor(name, client) {
@@ -18735,12 +18514,15 @@ var MicrosandboxRemoteProvider = class {
18735
18514
  return instance;
18736
18515
  }
18737
18516
  async stopSandbox(name) {
18738
- await this.client.stopSandbox(name);
18517
+ try {
18518
+ await this.client.stopSandbox(name);
18519
+ } catch {
18520
+ }
18739
18521
  this.instances.delete(name);
18740
18522
  }
18741
18523
  async deleteSandbox(name) {
18742
- await this.client.deleteSandbox(name);
18743
18524
  this.instances.delete(name);
18525
+ await this.client.deleteSandbox(name);
18744
18526
  }
18745
18527
  createVolumeFsClient(volumeName) {
18746
18528
  return {
@@ -18770,7 +18552,7 @@ var MicrosandboxRemoteProvider = class {
18770
18552
  buildDefaultVolumes(config) {
18771
18553
  const tenantId = config?.tenantId ?? "default";
18772
18554
  const volumes = {
18773
- "/.agent": {
18555
+ "/root/.agents": {
18774
18556
  type: "named",
18775
18557
  name: buildNamedVolumeName("s", "skills", tenantId)
18776
18558
  }
@@ -18952,7 +18734,7 @@ var RemoteSandboxProvider = class {
18952
18734
  };
18953
18735
 
18954
18736
  // src/sandbox_lattice/providers/E2BProvider.ts
18955
- import { Sandbox as Sandbox2 } from "e2b";
18737
+ import { Sandbox } from "e2b";
18956
18738
 
18957
18739
  // src/sandbox_lattice/E2BInstance.ts
18958
18740
  var E2BInstance = class {
@@ -19073,7 +18855,7 @@ var E2BProvider = class {
19073
18855
  return inFlight;
19074
18856
  }
19075
18857
  const creation = (async () => {
19076
- const native = await Sandbox2.create(
18858
+ const native = await Sandbox.create(
19077
18859
  this.config.template ?? "base",
19078
18860
  {
19079
18861
  apiKey: this.config.apiKey,
@@ -19099,15 +18881,18 @@ var E2BProvider = class {
19099
18881
  async stopSandbox(name) {
19100
18882
  const instance = this.instances.get(name);
19101
18883
  if (instance) {
19102
- await instance.stop();
18884
+ try {
18885
+ await instance.stop();
18886
+ } catch {
18887
+ }
19103
18888
  }
19104
18889
  }
19105
18890
  async deleteSandbox(name) {
19106
18891
  const instance = this.instances.get(name);
18892
+ this.instances.delete(name);
19107
18893
  if (instance) {
19108
18894
  await instance.kill();
19109
18895
  }
19110
- this.instances.delete(name);
19111
18896
  }
19112
18897
  async listSandboxes() {
19113
18898
  return Array.from(this.instances.values());
@@ -19320,7 +19105,7 @@ var DaytonaProvider = class {
19320
19105
  /**
19321
19106
  * Build volume mounts for a sandbox based on RunSandboxConfig.
19322
19107
  * Mounts:
19323
- * /.agent → tenants/{tenantId}/skills
19108
+ * /root/.agents → tenants/{tenantId}/skills
19324
19109
  * /agent → tenants/{tenantId}/agents/{assistantId}
19325
19110
  * /project → tenants/{tenantId}/projects/{projectId}
19326
19111
  */
@@ -19336,7 +19121,7 @@ var DaytonaProvider = class {
19336
19121
  const mounts = [];
19337
19122
  mounts.push({
19338
19123
  volumeId: volume.id,
19339
- mountPath: "/.agent",
19124
+ mountPath: "/root/.agents",
19340
19125
  subpath: `tenants/${tenantId}/skills`
19341
19126
  });
19342
19127
  if (config.assistant_id) {
@@ -19398,18 +19183,21 @@ var DaytonaProvider = class {
19398
19183
  async stopSandbox(name) {
19399
19184
  const instance = this.instances.get(name);
19400
19185
  if (instance) {
19401
- await instance.stop();
19186
+ try {
19187
+ await instance.stop();
19188
+ } catch {
19189
+ }
19402
19190
  }
19403
19191
  }
19404
19192
  async deleteSandbox(name) {
19405
19193
  const instance = this.instances.get(name);
19194
+ this.instances.delete(name);
19406
19195
  if (instance) {
19407
19196
  try {
19408
19197
  await instance.kill();
19409
19198
  } catch {
19410
19199
  }
19411
19200
  }
19412
- this.instances.delete(name);
19413
19201
  }
19414
19202
  async listSandboxes() {
19415
19203
  return Array.from(this.instances.values());
@@ -19419,14 +19207,6 @@ var DaytonaProvider = class {
19419
19207
  // src/sandbox_lattice/SandboxProviderFactory.ts
19420
19208
  function createSandboxProvider(config) {
19421
19209
  switch (config.type) {
19422
- case "microsandbox": {
19423
- return new MicrosandboxProvider({
19424
- image: config.microsandboxImage ?? defaultMicrosandboxConfig.image,
19425
- cpus: config.microsandboxCpus ?? defaultMicrosandboxConfig.cpus,
19426
- memoryMib: config.microsandboxMemoryMib ?? defaultMicrosandboxConfig.memoryMib,
19427
- env: defaultMicrosandboxConfig.env
19428
- });
19429
- }
19430
19210
  case "remote": {
19431
19211
  if (!config.remoteBaseURL) {
19432
19212
  throw new Error("remoteBaseURL is required when sandbox provider type is 'remote'");
@@ -19443,8 +19223,7 @@ function createSandboxProvider(config) {
19443
19223
  baseURL: config.microsandboxServiceBaseURL,
19444
19224
  image: config.microsandboxImage,
19445
19225
  cpus: config.microsandboxCpus,
19446
- memoryMib: config.microsandboxMemoryMib,
19447
- env: defaultMicrosandboxConfig.env
19226
+ memoryMib: config.microsandboxMemoryMib
19448
19227
  });
19449
19228
  }
19450
19229
  case "e2b": {
@@ -19585,8 +19364,6 @@ export {
19585
19364
  MemoryType,
19586
19365
  MessageType,
19587
19366
  MetricsServerManager,
19588
- MicrosandboxInstance,
19589
- MicrosandboxProvider,
19590
19367
  MicrosandboxRemoteInstance,
19591
19368
  MicrosandboxRemoteProvider,
19592
19369
  MicrosandboxServiceClient,
@@ -19648,7 +19425,6 @@ export {
19648
19425
  createUnknownToolHandlerMiddleware,
19649
19426
  createWidgetMiddleware,
19650
19427
  decrypt,
19651
- defaultMicrosandboxConfig,
19652
19428
  describeCronExpression,
19653
19429
  embeddingsLatticeManager,
19654
19430
  encrypt,