@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.js CHANGED
@@ -72,8 +72,6 @@ __export(index_exports, {
72
72
  MemoryType: () => import_protocols2.MemoryType,
73
73
  MessageType: () => MessageType,
74
74
  MetricsServerManager: () => MetricsServerManager,
75
- MicrosandboxInstance: () => MicrosandboxInstance,
76
- MicrosandboxProvider: () => MicrosandboxProvider,
77
75
  MicrosandboxRemoteInstance: () => MicrosandboxRemoteInstance,
78
76
  MicrosandboxRemoteProvider: () => MicrosandboxRemoteProvider,
79
77
  MicrosandboxServiceClient: () => MicrosandboxServiceClient,
@@ -135,7 +133,6 @@ __export(index_exports, {
135
133
  createUnknownToolHandlerMiddleware: () => createUnknownToolHandlerMiddleware,
136
134
  createWidgetMiddleware: () => createWidgetMiddleware,
137
135
  decrypt: () => decrypt,
138
- defaultMicrosandboxConfig: () => defaultMicrosandboxConfig,
139
136
  describeCronExpression: () => describeCronExpression,
140
137
  embeddingsLatticeManager: () => embeddingsLatticeManager,
141
138
  encrypt: () => encrypt,
@@ -3688,10 +3685,10 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
3688
3685
  }
3689
3686
  _resolveVolumeForPath(config, tenantId, filePath) {
3690
3687
  const normalized = normalizeExternalSandboxPath(filePath);
3691
- if (normalized === "/.agent" || normalized.startsWith("/.agent/")) {
3688
+ if (normalized === "/root/.agents" || normalized.startsWith("/root/.agents/")) {
3692
3689
  return {
3693
3690
  volumeName: buildNamedVolumeName("s", "skills", tenantId),
3694
- pathPrefix: "/.agent"
3691
+ pathPrefix: "/root/.agents"
3695
3692
  };
3696
3693
  }
3697
3694
  if (normalized === "/agent" || normalized.startsWith("/agent/")) {
@@ -5087,13 +5084,13 @@ var createLoadSkillContentTool = () => {
5087
5084
  async (input, _exe_config) => {
5088
5085
  try {
5089
5086
  const sandbox = await getSandboxFromExeConfig(_exe_config);
5090
- const filePath = `/.agent/skills/${input.skill_name}/SKILL.md`;
5087
+ const filePath = `/root/.agents/skills/${input.skill_name}/SKILL.md`;
5091
5088
  let content;
5092
5089
  try {
5093
5090
  const result2 = await sandbox.file.readFile(filePath);
5094
5091
  content = result2.content;
5095
5092
  } catch {
5096
- const listResult = await sandbox.file.listPath("/.agent/skills", { recursive: false });
5093
+ const listResult = await sandbox.file.listPath("/root/.agents/skills", { recursive: false });
5097
5094
  const available = listResult.files.filter((f) => f.is_dir).map((f) => f.path.split("/").pop()).filter(Boolean).join(", ");
5098
5095
  return `Skill "${input.skill_name}" not found. Available skills: ${available}`;
5099
5096
  }
@@ -5101,7 +5098,7 @@ var createLoadSkillContentTool = () => {
5101
5098
  let result = buildSkillFile(meta, body);
5102
5099
  try {
5103
5100
  const resourcesResult = await sandbox.file.listPath(
5104
- `/.agent/skills/${input.skill_name}/resources`,
5101
+ `/root/.agents/skills/${input.skill_name}/resources`,
5105
5102
  { recursive: false }
5106
5103
  );
5107
5104
  const resources = resourcesResult.files.map((f) => f.path.split("/").pop()).filter(Boolean);
@@ -5154,14 +5151,14 @@ function createSkillMiddleware(params = {}) {
5154
5151
  projectId: runConfig.projectId,
5155
5152
  vmIsolation: "project"
5156
5153
  });
5157
- const result = await sandbox.file.listPath("/.agent/skills", { recursive: false });
5154
+ const result = await sandbox.file.listPath("/root/.agents/skills", { recursive: false });
5158
5155
  const allSkills = [];
5159
5156
  for (const entry of result.files) {
5160
5157
  if (!entry.is_dir) continue;
5161
5158
  const skillName = entry.path.split("/").pop();
5162
5159
  if (!skillName) continue;
5163
5160
  try {
5164
- const fileResult = await sandbox.file.readFile(`/.agent/skills/${skillName}/SKILL.md`);
5161
+ const fileResult = await sandbox.file.readFile(`/root/.agents/skills/${skillName}/SKILL.md`);
5165
5162
  const { meta } = parseSkillFrontmatter(fileResult.content);
5166
5163
  allSkills.push({
5167
5164
  id: skillName,
@@ -5697,7 +5694,7 @@ Path conventions:
5697
5694
  - All paths are absolute starting with /. Key directories:
5698
5695
  - /agent/ \u2014 Your private agent directory (identity, memory, preferences). Isolated per agent.
5699
5696
  - /project/ \u2014 Project workspace. Shared across all agents in the same project. Persisted across sessions.
5700
- - /.agent/skills/ \u2014 Skill definitions. Read-only for most operations.
5697
+ - /root/.agents/skills/ \u2014 Skill definitions. Read-only for most operations.
5701
5698
 
5702
5699
  - ls: list files in a directory
5703
5700
  - read_file: read a file from the filesystem
@@ -16676,7 +16673,7 @@ var SandboxSkillStore = class {
16676
16673
  if (name.includes("..") || name.includes("/") || name.includes("\\")) {
16677
16674
  throw new Error(`Invalid skill name: ${name} (contains invalid characters)`);
16678
16675
  }
16679
- return `/.agent/skills/${name}`;
16676
+ return `/root/.agents/skills/${name}`;
16680
16677
  }
16681
16678
  /**
16682
16679
  * Get skill file path in sandbox (absolute path with ~/ prefix)
@@ -16743,14 +16740,14 @@ ${body}` : `${frontmatter}
16743
16740
  async getAllSkills(tenantId, context) {
16744
16741
  try {
16745
16742
  const sandbox = await this.getSandbox(tenantId, context);
16746
- const skillsDir = "/.agent/skills";
16743
+ const skillsDir = "/root/.agents/skills";
16747
16744
  try {
16748
16745
  await sandbox.file.listPath(skillsDir, { recursive: false });
16749
16746
  } catch (listError) {
16750
16747
  console.log(`[SandboxSkillStore] Skills directory not found, creating: ${skillsDir}`);
16751
16748
  try {
16752
16749
  await sandbox.shell.execCommand({
16753
- command: `mkdir -p /.agent/skills`
16750
+ command: `mkdir -p /root/.agents/skills`
16754
16751
  });
16755
16752
  } catch (mkdirError) {
16756
16753
  console.error(`[SandboxSkillStore] Failed to create skills directory: ${mkdirError.message}`);
@@ -18343,227 +18340,6 @@ var McpLatticeManager = class _McpLatticeManager extends BaseLatticeManager {
18343
18340
  };
18344
18341
  var mcpManager = McpLatticeManager.getInstance();
18345
18342
 
18346
- // src/sandbox_lattice/providers/MicrosandboxProvider.ts
18347
- var import_microsandbox = require("microsandbox");
18348
-
18349
- // src/sandbox_lattice/MicrosandboxInstance.ts
18350
- function exec(native, cmd, opts) {
18351
- return native.execWithConfig({ cmd, args: opts?.args, cwd: opts?.cwd, timeoutMs: opts?.timeoutMs });
18352
- }
18353
- var MicrosandboxInstance = class {
18354
- constructor(name, native) {
18355
- this.native = native;
18356
- this.file = {
18357
- readFile: async (file) => {
18358
- const fs3 = this.native.fs();
18359
- const content = await fs3.readString(file);
18360
- return { content };
18361
- },
18362
- writeFile: async (file, content) => {
18363
- const fs3 = this.native.fs();
18364
- await fs3.write(file, Buffer.from(content));
18365
- },
18366
- listPath: async (path3, options) => {
18367
- const fs3 = this.native.fs();
18368
- const entries = await fs3.list(path3);
18369
- const files = (entries || []).map((e) => ({
18370
- path: e.path,
18371
- is_dir: e.kind === "directory",
18372
- size: e.size,
18373
- modified_at: e.modified ? String(e.modified) : void 0
18374
- }));
18375
- return { files };
18376
- },
18377
- findFiles: async (path3, glob) => {
18378
- const output = await exec(this.native, "sh", {
18379
- args: ["-c", `find "${path3}" -name "${glob}" -type f`]
18380
- });
18381
- const lines = output.stdout().split("\n").filter(Boolean);
18382
- return { files: lines };
18383
- },
18384
- searchInFile: async (file, regex) => {
18385
- const output = await exec(this.native, "grep", {
18386
- args: ["-n", "-E", regex, file]
18387
- });
18388
- const lines = output.stdout().split("\n").filter(Boolean);
18389
- const matches = [];
18390
- const line_numbers = [];
18391
- for (const line of lines) {
18392
- const colonIdx = line.indexOf(":");
18393
- if (colonIdx === -1) continue;
18394
- const num = parseInt(line.slice(0, colonIdx), 10);
18395
- const text = line.slice(colonIdx + 1);
18396
- line_numbers.push(num);
18397
- matches.push(text);
18398
- }
18399
- return { matches, line_numbers };
18400
- },
18401
- strReplaceEditor: async (params) => {
18402
- const { path: path3, old_str, new_str, replace_mode } = params;
18403
- const delim = "#";
18404
- const escapedOld = old_str.replace(new RegExp(`[\\\\${delim}]`, "g"), "\\$&").replace(/\n/g, "\\n");
18405
- const escapedNew = new_str.replace(new RegExp(`[\\\\${delim}]`, "g"), "\\$&").replace(/\n/g, "\\n");
18406
- const flag = replace_mode === "ALL" ? "g" : "";
18407
- await exec(this.native, "sh", {
18408
- args: ["-c", `sed -i 's${delim}${escapedOld}${delim}${escapedNew}${delim}${flag}' "${path3}"`]
18409
- });
18410
- },
18411
- uploadFile: async (params) => {
18412
- const fs3 = this.native.fs();
18413
- await fs3.write(params.file, params.data);
18414
- },
18415
- downloadFile: async (params) => {
18416
- const fs3 = this.native.fs();
18417
- const data = await fs3.read(params.file);
18418
- return Buffer.isBuffer(data) ? data : Buffer.from(data);
18419
- }
18420
- };
18421
- this.shell = {
18422
- execCommand: async (params) => {
18423
- const output = await exec(this.native, "sh", {
18424
- args: ["-c", params.command],
18425
- cwd: params.exec_dir,
18426
- timeoutMs: params.timeout ? params.timeout * 1e3 : void 0
18427
- });
18428
- return {
18429
- output: output.stdout(),
18430
- exit_code: output.code ?? 0
18431
- };
18432
- }
18433
- };
18434
- this.name = name;
18435
- }
18436
- async start() {
18437
- }
18438
- async stop() {
18439
- await this.native.stop();
18440
- }
18441
- async kill() {
18442
- await this.native.kill();
18443
- }
18444
- async getStatus() {
18445
- try {
18446
- await this.native.exec("echo", ["ok"]);
18447
- return "running";
18448
- } catch {
18449
- return "unknown";
18450
- }
18451
- }
18452
- };
18453
-
18454
- // src/sandbox_lattice/providers/MicrosandboxProvider.ts
18455
- var defaultMicrosandboxConfig = {
18456
- image: process.env.MICROSANDBOX_IMAGE ?? "python:3.11-slim",
18457
- cpus: Number(process.env.MICROSANDBOX_CPUS ?? "1"),
18458
- memoryMib: Number(process.env.MICROSANDBOX_MEMORY ?? "512"),
18459
- env: {
18460
- PYTHONDONTWRITEBYTECODE: "1",
18461
- PIP_NO_CACHE_DIR: "1",
18462
- ...process.env.MICROSANDBOX_EXTRA_ENV ? Object.fromEntries(
18463
- process.env.MICROSANDBOX_EXTRA_ENV.split(",").map((pair) => pair.split("="))
18464
- ) : {}
18465
- }
18466
- };
18467
- var MicrosandboxProvider = class {
18468
- constructor(config = {}) {
18469
- this.config = config;
18470
- this.instances = /* @__PURE__ */ new Map();
18471
- this.creating = /* @__PURE__ */ new Map();
18472
- }
18473
- async createSandbox(name, config) {
18474
- const existing = this.instances.get(name);
18475
- if (existing) {
18476
- return existing;
18477
- }
18478
- const inFlight = this.creating.get(name);
18479
- if (inFlight) {
18480
- return inFlight;
18481
- }
18482
- const creation = (async () => {
18483
- let native;
18484
- try {
18485
- const handle = await import_microsandbox.Sandbox.get(name);
18486
- if (handle.status === "stopped") {
18487
- native = await import_microsandbox.Sandbox.start(name);
18488
- } else if (handle.status === "running") {
18489
- native = await handle.connect();
18490
- } else if (handle.status === "crashed" || handle.status === "draining") {
18491
- await import_microsandbox.Sandbox.remove(name);
18492
- native = void 0;
18493
- } else {
18494
- throw new Error(`Unexpected sandbox status: ${handle.status}`);
18495
- }
18496
- } catch {
18497
- native = void 0;
18498
- }
18499
- if (!native) {
18500
- try {
18501
- native = await import_microsandbox.Sandbox.createDetached({
18502
- name,
18503
- image: this.config.image ?? "python:3.11-slim",
18504
- cpus: this.config.cpus ?? 1,
18505
- memoryMib: this.config.memoryMib ?? 512,
18506
- env: {
18507
- ...this.config.env,
18508
- ...buildSandboxMetadataEnv(config)
18509
- }
18510
- });
18511
- } catch (err) {
18512
- if (err instanceof Error && err.message.includes("already exists")) {
18513
- await import_microsandbox.Sandbox.remove(name);
18514
- native = await import_microsandbox.Sandbox.createDetached({
18515
- name,
18516
- image: this.config.image ?? "python:3.11-slim",
18517
- cpus: this.config.cpus ?? 1,
18518
- memoryMib: this.config.memoryMib ?? 512,
18519
- env: {
18520
- ...this.config.env,
18521
- ...buildSandboxMetadataEnv(config)
18522
- }
18523
- });
18524
- } else {
18525
- throw err;
18526
- }
18527
- }
18528
- }
18529
- const instance = new MicrosandboxInstance(name, native);
18530
- this.instances.set(name, instance);
18531
- return instance;
18532
- })();
18533
- this.creating.set(name, creation);
18534
- creation.catch(() => this.creating.delete(name)).then(() => this.creating.delete(name));
18535
- return creation;
18536
- }
18537
- async getSandbox(name) {
18538
- const instance = this.instances.get(name);
18539
- if (!instance) {
18540
- throw new Error(`Sandbox ${name} not found`);
18541
- }
18542
- return instance;
18543
- }
18544
- async stopSandbox(name) {
18545
- const instance = this.instances.get(name);
18546
- if (instance) {
18547
- await instance.stop();
18548
- }
18549
- }
18550
- async deleteSandbox(name) {
18551
- const instance = this.instances.get(name);
18552
- if (instance) {
18553
- try {
18554
- await instance.kill();
18555
- await new Promise((r) => setTimeout(r, 200));
18556
- } catch {
18557
- }
18558
- }
18559
- await import_microsandbox.Sandbox.remove(name);
18560
- this.instances.delete(name);
18561
- }
18562
- async listSandboxes() {
18563
- return Array.from(this.instances.values());
18564
- }
18565
- };
18566
-
18567
18343
  // src/sandbox_lattice/MicrosandboxRemoteInstance.ts
18568
18344
  var MicrosandboxRemoteInstance = class {
18569
18345
  constructor(name, client) {
@@ -18905,12 +18681,15 @@ var MicrosandboxRemoteProvider = class {
18905
18681
  return instance;
18906
18682
  }
18907
18683
  async stopSandbox(name) {
18908
- await this.client.stopSandbox(name);
18684
+ try {
18685
+ await this.client.stopSandbox(name);
18686
+ } catch {
18687
+ }
18909
18688
  this.instances.delete(name);
18910
18689
  }
18911
18690
  async deleteSandbox(name) {
18912
- await this.client.deleteSandbox(name);
18913
18691
  this.instances.delete(name);
18692
+ await this.client.deleteSandbox(name);
18914
18693
  }
18915
18694
  createVolumeFsClient(volumeName) {
18916
18695
  return {
@@ -18940,7 +18719,7 @@ var MicrosandboxRemoteProvider = class {
18940
18719
  buildDefaultVolumes(config) {
18941
18720
  const tenantId = config?.tenantId ?? "default";
18942
18721
  const volumes = {
18943
- "/.agent": {
18722
+ "/root/.agents": {
18944
18723
  type: "named",
18945
18724
  name: buildNamedVolumeName("s", "skills", tenantId)
18946
18725
  }
@@ -19269,15 +19048,18 @@ var E2BProvider = class {
19269
19048
  async stopSandbox(name) {
19270
19049
  const instance = this.instances.get(name);
19271
19050
  if (instance) {
19272
- await instance.stop();
19051
+ try {
19052
+ await instance.stop();
19053
+ } catch {
19054
+ }
19273
19055
  }
19274
19056
  }
19275
19057
  async deleteSandbox(name) {
19276
19058
  const instance = this.instances.get(name);
19059
+ this.instances.delete(name);
19277
19060
  if (instance) {
19278
19061
  await instance.kill();
19279
19062
  }
19280
- this.instances.delete(name);
19281
19063
  }
19282
19064
  async listSandboxes() {
19283
19065
  return Array.from(this.instances.values());
@@ -19490,7 +19272,7 @@ var DaytonaProvider = class {
19490
19272
  /**
19491
19273
  * Build volume mounts for a sandbox based on RunSandboxConfig.
19492
19274
  * Mounts:
19493
- * /.agent → tenants/{tenantId}/skills
19275
+ * /root/.agents → tenants/{tenantId}/skills
19494
19276
  * /agent → tenants/{tenantId}/agents/{assistantId}
19495
19277
  * /project → tenants/{tenantId}/projects/{projectId}
19496
19278
  */
@@ -19506,7 +19288,7 @@ var DaytonaProvider = class {
19506
19288
  const mounts = [];
19507
19289
  mounts.push({
19508
19290
  volumeId: volume.id,
19509
- mountPath: "/.agent",
19291
+ mountPath: "/root/.agents",
19510
19292
  subpath: `tenants/${tenantId}/skills`
19511
19293
  });
19512
19294
  if (config.assistant_id) {
@@ -19568,18 +19350,21 @@ var DaytonaProvider = class {
19568
19350
  async stopSandbox(name) {
19569
19351
  const instance = this.instances.get(name);
19570
19352
  if (instance) {
19571
- await instance.stop();
19353
+ try {
19354
+ await instance.stop();
19355
+ } catch {
19356
+ }
19572
19357
  }
19573
19358
  }
19574
19359
  async deleteSandbox(name) {
19575
19360
  const instance = this.instances.get(name);
19361
+ this.instances.delete(name);
19576
19362
  if (instance) {
19577
19363
  try {
19578
19364
  await instance.kill();
19579
19365
  } catch {
19580
19366
  }
19581
19367
  }
19582
- this.instances.delete(name);
19583
19368
  }
19584
19369
  async listSandboxes() {
19585
19370
  return Array.from(this.instances.values());
@@ -19589,14 +19374,6 @@ var DaytonaProvider = class {
19589
19374
  // src/sandbox_lattice/SandboxProviderFactory.ts
19590
19375
  function createSandboxProvider(config) {
19591
19376
  switch (config.type) {
19592
- case "microsandbox": {
19593
- return new MicrosandboxProvider({
19594
- image: config.microsandboxImage ?? defaultMicrosandboxConfig.image,
19595
- cpus: config.microsandboxCpus ?? defaultMicrosandboxConfig.cpus,
19596
- memoryMib: config.microsandboxMemoryMib ?? defaultMicrosandboxConfig.memoryMib,
19597
- env: defaultMicrosandboxConfig.env
19598
- });
19599
- }
19600
19377
  case "remote": {
19601
19378
  if (!config.remoteBaseURL) {
19602
19379
  throw new Error("remoteBaseURL is required when sandbox provider type is 'remote'");
@@ -19613,8 +19390,7 @@ function createSandboxProvider(config) {
19613
19390
  baseURL: config.microsandboxServiceBaseURL,
19614
19391
  image: config.microsandboxImage,
19615
19392
  cpus: config.microsandboxCpus,
19616
- memoryMib: config.microsandboxMemoryMib,
19617
- env: defaultMicrosandboxConfig.env
19393
+ memoryMib: config.microsandboxMemoryMib
19618
19394
  });
19619
19395
  }
19620
19396
  case "e2b": {
@@ -19756,8 +19532,6 @@ function clearEncryptionKeyCache() {
19756
19532
  MemoryType,
19757
19533
  MessageType,
19758
19534
  MetricsServerManager,
19759
- MicrosandboxInstance,
19760
- MicrosandboxProvider,
19761
19535
  MicrosandboxRemoteInstance,
19762
19536
  MicrosandboxRemoteProvider,
19763
19537
  MicrosandboxServiceClient,
@@ -19819,7 +19593,6 @@ function clearEncryptionKeyCache() {
19819
19593
  createUnknownToolHandlerMiddleware,
19820
19594
  createWidgetMiddleware,
19821
19595
  decrypt,
19822
- defaultMicrosandboxConfig,
19823
19596
  describeCronExpression,
19824
19597
  embeddingsLatticeManager,
19825
19598
  encrypt,