@axiom-lattice/core 2.1.51 → 2.1.53
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 +266 -228
- package/dist/index.d.ts +266 -228
- package/dist/index.js +229 -98
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +226 -103
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -32,7 +32,6 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AGENT_TASK_EVENT: () => AGENT_TASK_EVENT,
|
|
34
34
|
Agent: () => Agent,
|
|
35
|
-
AgentConfig: () => import_protocols.AgentConfig,
|
|
36
35
|
AgentInstanceManager: () => AgentInstanceManager,
|
|
37
36
|
AgentLatticeManager: () => AgentLatticeManager,
|
|
38
37
|
AgentManager: () => AgentManager,
|
|
@@ -51,7 +50,6 @@ __export(index_exports, {
|
|
|
51
50
|
EmbeddingsLatticeManager: () => EmbeddingsLatticeManager,
|
|
52
51
|
FileSystemSkillStore: () => FileSystemSkillStore,
|
|
53
52
|
FilesystemBackend: () => FilesystemBackend,
|
|
54
|
-
GraphBuildOptions: () => import_protocols.GraphBuildOptions,
|
|
55
53
|
HumanMessage: () => import_messages4.HumanMessage,
|
|
56
54
|
InMemoryAssistantStore: () => InMemoryAssistantStore,
|
|
57
55
|
InMemoryChunkBuffer: () => InMemoryChunkBuffer,
|
|
@@ -105,9 +103,12 @@ __export(index_exports, {
|
|
|
105
103
|
ThreadStatus: () => ThreadStatus2,
|
|
106
104
|
ToolLatticeManager: () => ToolLatticeManager,
|
|
107
105
|
VectorStoreLatticeManager: () => VectorStoreLatticeManager,
|
|
106
|
+
VolumeFilesystem: () => VolumeFilesystem,
|
|
108
107
|
agentInstanceManager: () => agentInstanceManager,
|
|
109
108
|
agentLatticeManager: () => agentLatticeManager,
|
|
110
109
|
buildGrepResultsDict: () => buildGrepResultsDict,
|
|
110
|
+
buildNamedVolumeName: () => buildNamedVolumeName,
|
|
111
|
+
buildSandboxMetadataEnv: () => buildSandboxMetadataEnv,
|
|
111
112
|
buildSkillFile: () => buildSkillFile,
|
|
112
113
|
checkEmptyContent: () => checkEmptyContent,
|
|
113
114
|
clearEncryptionKeyCache: () => clearEncryptionKeyCache,
|
|
@@ -3481,39 +3482,68 @@ ${serverKeys.map(
|
|
|
3481
3482
|
// src/tool_lattice/code_eval/index.ts
|
|
3482
3483
|
var import_zod15 = __toESM(require("zod"));
|
|
3483
3484
|
|
|
3484
|
-
// src/
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3485
|
+
// src/deep_agent_new/backends/volumeFilesystem.ts
|
|
3486
|
+
var VolumeFilesystem = class {
|
|
3487
|
+
constructor(client) {
|
|
3488
|
+
this.client = client;
|
|
3488
3489
|
}
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
`Sandbox name "${name}" cannot be normalized to a valid RFC 1123 subdomain name`
|
|
3498
|
-
);
|
|
3490
|
+
async lsInfo(path4) {
|
|
3491
|
+
const entries = await this.client.list(path4);
|
|
3492
|
+
return entries.map((entry) => ({
|
|
3493
|
+
path: entry.path,
|
|
3494
|
+
is_dir: entry.kind === "directory",
|
|
3495
|
+
size: entry.size,
|
|
3496
|
+
modified_at: entry.modified ? new Date(entry.modified).toISOString() : void 0
|
|
3497
|
+
}));
|
|
3499
3498
|
}
|
|
3500
|
-
|
|
3501
|
-
|
|
3499
|
+
async read(filePath, offset = 0, limit = 2e3) {
|
|
3500
|
+
const raw = await this.client.read(filePath);
|
|
3501
|
+
const lines = raw.split("\n");
|
|
3502
|
+
const start = Math.max(0, offset);
|
|
3503
|
+
const end = Math.min(lines.length, start + limit);
|
|
3504
|
+
const sliced = lines.slice(start, end);
|
|
3505
|
+
return sliced.map((line, i) => {
|
|
3506
|
+
const lineNum = (start + i + 1).toString().padStart(6, " ");
|
|
3507
|
+
return `${lineNum}|${line}`;
|
|
3508
|
+
}).join("\n");
|
|
3502
3509
|
}
|
|
3503
|
-
|
|
3504
|
-
|
|
3510
|
+
async readRaw(filePath) {
|
|
3511
|
+
const content = await this.client.read(filePath);
|
|
3512
|
+
const lines = content.split("\n");
|
|
3513
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3514
|
+
return {
|
|
3515
|
+
content: lines,
|
|
3516
|
+
created_at: now,
|
|
3517
|
+
modified_at: now
|
|
3518
|
+
};
|
|
3505
3519
|
}
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3520
|
+
grepRaw(_pattern, _path, _glob) {
|
|
3521
|
+
throw new Error("Not supported on volume backend");
|
|
3522
|
+
}
|
|
3523
|
+
globInfo(_pattern, _path) {
|
|
3524
|
+
throw new Error("Not supported on volume backend");
|
|
3525
|
+
}
|
|
3526
|
+
async write(filePath, content) {
|
|
3527
|
+
try {
|
|
3528
|
+
await this.client.write(filePath, content);
|
|
3529
|
+
return { path: filePath, filesUpdate: null };
|
|
3530
|
+
} catch (err) {
|
|
3531
|
+
return { error: String(err) };
|
|
3514
3532
|
}
|
|
3515
3533
|
}
|
|
3516
|
-
|
|
3534
|
+
edit(_filePath, _oldString, _newString, _replaceAll) {
|
|
3535
|
+
throw new Error("Not supported on volume backend");
|
|
3536
|
+
}
|
|
3537
|
+
};
|
|
3538
|
+
|
|
3539
|
+
// src/sandbox_lattice/utils.ts
|
|
3540
|
+
var import_node_crypto = require("crypto");
|
|
3541
|
+
function normalizeSandboxName(name) {
|
|
3542
|
+
if (!name || typeof name !== "string") {
|
|
3543
|
+
throw new Error("Sandbox name must be a non-empty string");
|
|
3544
|
+
}
|
|
3545
|
+
const hash = (0, import_node_crypto.createHash)("sha256").update(name).digest("hex").slice(0, 16);
|
|
3546
|
+
return `n${hash}`;
|
|
3517
3547
|
}
|
|
3518
3548
|
function isValidSandboxName(name) {
|
|
3519
3549
|
if (!name || typeof name !== "string") {
|
|
@@ -3522,6 +3552,24 @@ function isValidSandboxName(name) {
|
|
|
3522
3552
|
const rfc1123Pattern = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/;
|
|
3523
3553
|
return rfc1123Pattern.test(name.toLowerCase());
|
|
3524
3554
|
}
|
|
3555
|
+
function buildSandboxMetadataEnv(config) {
|
|
3556
|
+
if (!config) {
|
|
3557
|
+
return {};
|
|
3558
|
+
}
|
|
3559
|
+
const vars = {};
|
|
3560
|
+
if (config.tenantId) vars.LATTICE_TENANT_ID = config.tenantId;
|
|
3561
|
+
if (config.assistant_id) vars.LATTICE_ASSISTANT_ID = config.assistant_id;
|
|
3562
|
+
if (config.projectId) vars.LATTICE_PROJECT_ID = config.projectId;
|
|
3563
|
+
if (config.workspaceId) vars.LATTICE_WORKSPACE_ID = config.workspaceId;
|
|
3564
|
+
return vars;
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3567
|
+
// src/sandbox_lattice/volumeFsUtils.ts
|
|
3568
|
+
var import_node_crypto2 = require("crypto");
|
|
3569
|
+
function buildNamedVolumeName(prefix, ...parts) {
|
|
3570
|
+
const hash = (0, import_node_crypto2.createHash)("sha256").update(parts.filter((part) => part !== void 0).join("\0")).digest("hex").slice(0, 16);
|
|
3571
|
+
return `${prefix}${hash}`;
|
|
3572
|
+
}
|
|
3525
3573
|
|
|
3526
3574
|
// src/sandbox_lattice/SandboxLatticeManager.ts
|
|
3527
3575
|
function computeSandboxName(config) {
|
|
@@ -3532,7 +3580,7 @@ function computeSandboxName(config) {
|
|
|
3532
3580
|
return normalizeSandboxName(`${config.tenantId ?? "default"}-${config.assistant_id}`);
|
|
3533
3581
|
case "project":
|
|
3534
3582
|
return normalizeSandboxName(
|
|
3535
|
-
`${config.tenantId ?? "default"}-${config.
|
|
3583
|
+
`${config.tenantId ?? "default"}-${config.assistant_id ?? "default"}-${config.projectId ?? "default"}`
|
|
3536
3584
|
);
|
|
3537
3585
|
}
|
|
3538
3586
|
}
|
|
@@ -3594,6 +3642,19 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
|
|
|
3594
3642
|
});
|
|
3595
3643
|
return this.createSandbox(name, config);
|
|
3596
3644
|
}
|
|
3645
|
+
async getVolumeBackend(config) {
|
|
3646
|
+
const provider = this._requireProvider();
|
|
3647
|
+
if (!provider.createVolumeFsClient) {
|
|
3648
|
+
return null;
|
|
3649
|
+
}
|
|
3650
|
+
const tenantId = config.tenantId ?? "default";
|
|
3651
|
+
if (!config.projectId) {
|
|
3652
|
+
return null;
|
|
3653
|
+
}
|
|
3654
|
+
const volumeName = buildNamedVolumeName("p", "project", tenantId, config.workspaceId, config.projectId);
|
|
3655
|
+
const client = provider.createVolumeFsClient(volumeName);
|
|
3656
|
+
return new VolumeFilesystem(client);
|
|
3657
|
+
}
|
|
3597
3658
|
async createSandbox(name, config) {
|
|
3598
3659
|
const provider = this._requireProvider();
|
|
3599
3660
|
return provider.createSandbox(name, config);
|
|
@@ -18181,6 +18242,9 @@ var mcpManager = McpLatticeManager.getInstance();
|
|
|
18181
18242
|
var import_microsandbox = require("microsandbox");
|
|
18182
18243
|
|
|
18183
18244
|
// src/sandbox_lattice/MicrosandboxInstance.ts
|
|
18245
|
+
function exec(native, cmd, opts) {
|
|
18246
|
+
return native.execWithConfig({ cmd, args: opts?.args, cwd: opts?.cwd, timeoutMs: opts?.timeoutMs });
|
|
18247
|
+
}
|
|
18184
18248
|
var MicrosandboxInstance = class {
|
|
18185
18249
|
constructor(name, native) {
|
|
18186
18250
|
this.native = native;
|
|
@@ -18206,16 +18270,14 @@ var MicrosandboxInstance = class {
|
|
|
18206
18270
|
return { files };
|
|
18207
18271
|
},
|
|
18208
18272
|
findFiles: async (path4, glob) => {
|
|
18209
|
-
const output = await this.native
|
|
18210
|
-
cmd: "sh",
|
|
18273
|
+
const output = await exec(this.native, "sh", {
|
|
18211
18274
|
args: ["-c", `find "${path4}" -name "${glob}" -type f`]
|
|
18212
18275
|
});
|
|
18213
18276
|
const lines = output.stdout().split("\n").filter(Boolean);
|
|
18214
18277
|
return { files: lines };
|
|
18215
18278
|
},
|
|
18216
18279
|
searchInFile: async (file, regex) => {
|
|
18217
|
-
const output = await this.native
|
|
18218
|
-
cmd: "grep",
|
|
18280
|
+
const output = await exec(this.native, "grep", {
|
|
18219
18281
|
args: ["-n", "-E", regex, file]
|
|
18220
18282
|
});
|
|
18221
18283
|
const lines = output.stdout().split("\n").filter(Boolean);
|
|
@@ -18237,8 +18299,7 @@ var MicrosandboxInstance = class {
|
|
|
18237
18299
|
const escapedOld = old_str.replace(new RegExp(`[\\\\${delim}]`, "g"), "\\$&").replace(/\n/g, "\\n");
|
|
18238
18300
|
const escapedNew = new_str.replace(new RegExp(`[\\\\${delim}]`, "g"), "\\$&").replace(/\n/g, "\\n");
|
|
18239
18301
|
const flag = replace_mode === "ALL" ? "g" : "";
|
|
18240
|
-
await this.native
|
|
18241
|
-
cmd: "sh",
|
|
18302
|
+
await exec(this.native, "sh", {
|
|
18242
18303
|
args: ["-c", `sed -i 's${delim}${escapedOld}${delim}${escapedNew}${delim}${flag}' "${path4}"`]
|
|
18243
18304
|
});
|
|
18244
18305
|
},
|
|
@@ -18254,8 +18315,7 @@ var MicrosandboxInstance = class {
|
|
|
18254
18315
|
};
|
|
18255
18316
|
this.shell = {
|
|
18256
18317
|
execCommand: async (params) => {
|
|
18257
|
-
const output = await this.native
|
|
18258
|
-
cmd: "sh",
|
|
18318
|
+
const output = await exec(this.native, "sh", {
|
|
18259
18319
|
args: ["-c", params.command],
|
|
18260
18320
|
cwd: params.exec_dir,
|
|
18261
18321
|
timeoutMs: params.timeout ? params.timeout * 1e3 : void 0
|
|
@@ -18278,7 +18338,7 @@ var MicrosandboxInstance = class {
|
|
|
18278
18338
|
}
|
|
18279
18339
|
async getStatus() {
|
|
18280
18340
|
try {
|
|
18281
|
-
await this.native.
|
|
18341
|
+
await this.native.exec("echo", ["ok"]);
|
|
18282
18342
|
return "running";
|
|
18283
18343
|
} catch {
|
|
18284
18344
|
return "unknown";
|
|
@@ -18305,7 +18365,7 @@ var MicrosandboxProvider = class {
|
|
|
18305
18365
|
this.instances = /* @__PURE__ */ new Map();
|
|
18306
18366
|
this.creating = /* @__PURE__ */ new Map();
|
|
18307
18367
|
}
|
|
18308
|
-
async createSandbox(name) {
|
|
18368
|
+
async createSandbox(name, config) {
|
|
18309
18369
|
const existing = this.instances.get(name);
|
|
18310
18370
|
if (existing) {
|
|
18311
18371
|
return existing;
|
|
@@ -18337,7 +18397,10 @@ var MicrosandboxProvider = class {
|
|
|
18337
18397
|
image: this.config.image ?? "python:3.11-slim",
|
|
18338
18398
|
cpus: this.config.cpus ?? 1,
|
|
18339
18399
|
memoryMib: this.config.memoryMib ?? 512,
|
|
18340
|
-
env:
|
|
18400
|
+
env: {
|
|
18401
|
+
...this.config.env,
|
|
18402
|
+
...buildSandboxMetadataEnv(config)
|
|
18403
|
+
}
|
|
18341
18404
|
});
|
|
18342
18405
|
}
|
|
18343
18406
|
const instance = new MicrosandboxInstance(name, native);
|
|
@@ -18380,30 +18443,42 @@ var MicrosandboxProvider = class {
|
|
|
18380
18443
|
|
|
18381
18444
|
// src/sandbox_lattice/pathUtils.ts
|
|
18382
18445
|
var import_path2 = __toESM(require("path"));
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
const { homeDir = "/home/daytona", absolute = false } = options;
|
|
18388
|
-
if (!isVirtualSandboxPath(inputPath)) {
|
|
18389
|
-
return inputPath;
|
|
18446
|
+
var SANDBOX_HOME_DIR = "/home/daytona";
|
|
18447
|
+
function normalizeExternalSandboxPath(inputPath) {
|
|
18448
|
+
if (inputPath === "~") {
|
|
18449
|
+
return "~/";
|
|
18390
18450
|
}
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
if (relativePath.startsWith("~/")) {
|
|
18394
|
-
relativePath = relativePath.slice(2);
|
|
18395
|
-
} else {
|
|
18396
|
-
relativePath = relativePath.slice(1);
|
|
18397
|
-
}
|
|
18451
|
+
if (inputPath === SANDBOX_HOME_DIR) {
|
|
18452
|
+
return "~/";
|
|
18398
18453
|
}
|
|
18399
|
-
if (
|
|
18400
|
-
|
|
18454
|
+
if (inputPath.startsWith(`${SANDBOX_HOME_DIR}/`)) {
|
|
18455
|
+
return `~/${inputPath.slice(SANDBOX_HOME_DIR.length + 1)}`;
|
|
18401
18456
|
}
|
|
18402
|
-
if (
|
|
18403
|
-
return
|
|
18457
|
+
if (inputPath.startsWith("~/")) {
|
|
18458
|
+
return inputPath;
|
|
18459
|
+
}
|
|
18460
|
+
if (inputPath.startsWith("/")) {
|
|
18461
|
+
return `~${inputPath}`;
|
|
18404
18462
|
}
|
|
18463
|
+
return inputPath;
|
|
18464
|
+
}
|
|
18465
|
+
function toSandboxRelativePath(inputPath) {
|
|
18466
|
+
const canonicalPath = normalizeExternalSandboxPath(inputPath);
|
|
18467
|
+
return canonicalPath === "~/" ? "" : canonicalPath.slice(2);
|
|
18468
|
+
}
|
|
18469
|
+
function toSandboxAbsolutePath(inputPath, homeDir = SANDBOX_HOME_DIR) {
|
|
18470
|
+
const relativePath = toSandboxRelativePath(inputPath);
|
|
18405
18471
|
return relativePath ? import_path2.default.posix.join(homeDir, relativePath) : homeDir;
|
|
18406
18472
|
}
|
|
18473
|
+
function fromSandboxExecutionPath(inputPath, homeDir = SANDBOX_HOME_DIR) {
|
|
18474
|
+
if (inputPath === homeDir) {
|
|
18475
|
+
return "~/";
|
|
18476
|
+
}
|
|
18477
|
+
if (inputPath.startsWith(`${homeDir}/`)) {
|
|
18478
|
+
return `~/${inputPath.slice(homeDir.length + 1)}`;
|
|
18479
|
+
}
|
|
18480
|
+
return normalizeExternalSandboxPath(inputPath);
|
|
18481
|
+
}
|
|
18407
18482
|
|
|
18408
18483
|
// src/sandbox_lattice/MicrosandboxRemoteInstance.ts
|
|
18409
18484
|
var MicrosandboxRemoteInstance = class {
|
|
@@ -18413,40 +18488,43 @@ var MicrosandboxRemoteInstance = class {
|
|
|
18413
18488
|
readFile: async (file) => {
|
|
18414
18489
|
const result = await this.client.readFile(
|
|
18415
18490
|
this.name,
|
|
18416
|
-
|
|
18491
|
+
toSandboxAbsolutePath(file, SANDBOX_HOME_DIR)
|
|
18417
18492
|
);
|
|
18418
18493
|
return { content: result.content };
|
|
18419
18494
|
},
|
|
18420
18495
|
writeFile: async (file, content) => {
|
|
18421
18496
|
await this.client.writeFile(
|
|
18422
18497
|
this.name,
|
|
18423
|
-
|
|
18498
|
+
toSandboxAbsolutePath(file, SANDBOX_HOME_DIR),
|
|
18424
18499
|
content
|
|
18425
18500
|
);
|
|
18426
18501
|
},
|
|
18427
18502
|
listPath: async (path4, options) => {
|
|
18428
18503
|
const result = await this.client.listPath(
|
|
18429
18504
|
this.name,
|
|
18430
|
-
|
|
18505
|
+
toSandboxAbsolutePath(path4, SANDBOX_HOME_DIR),
|
|
18431
18506
|
options?.recursive
|
|
18432
18507
|
);
|
|
18433
18508
|
const files = result.entries.map((entry) => ({
|
|
18434
|
-
path: entry.path,
|
|
18435
|
-
is_dir: entry.type === "
|
|
18509
|
+
path: fromSandboxExecutionPath(entry.path, SANDBOX_HOME_DIR),
|
|
18510
|
+
is_dir: entry.type === "directory"
|
|
18436
18511
|
}));
|
|
18437
18512
|
return { files };
|
|
18438
18513
|
},
|
|
18439
18514
|
findFiles: async (path4, glob) => {
|
|
18440
|
-
|
|
18515
|
+
const result = await this.client.findFiles(
|
|
18441
18516
|
this.name,
|
|
18442
|
-
|
|
18517
|
+
toSandboxAbsolutePath(path4, SANDBOX_HOME_DIR),
|
|
18443
18518
|
glob
|
|
18444
18519
|
);
|
|
18520
|
+
return {
|
|
18521
|
+
files: result.files.map((filePath) => fromSandboxExecutionPath(filePath, SANDBOX_HOME_DIR))
|
|
18522
|
+
};
|
|
18445
18523
|
},
|
|
18446
18524
|
searchInFile: async (file, regex) => {
|
|
18447
18525
|
const result = await this.client.searchInFile(
|
|
18448
18526
|
this.name,
|
|
18449
|
-
|
|
18527
|
+
toSandboxAbsolutePath(file, SANDBOX_HOME_DIR),
|
|
18450
18528
|
regex
|
|
18451
18529
|
);
|
|
18452
18530
|
return {
|
|
@@ -18456,7 +18534,7 @@ var MicrosandboxRemoteInstance = class {
|
|
|
18456
18534
|
},
|
|
18457
18535
|
strReplaceEditor: async (params) => {
|
|
18458
18536
|
await this.client.replaceInFile(this.name, {
|
|
18459
|
-
path:
|
|
18537
|
+
path: toSandboxAbsolutePath(params.path, SANDBOX_HOME_DIR),
|
|
18460
18538
|
search: params.old_str,
|
|
18461
18539
|
replace: params.new_str
|
|
18462
18540
|
});
|
|
@@ -18464,14 +18542,14 @@ var MicrosandboxRemoteInstance = class {
|
|
|
18464
18542
|
uploadFile: async (params) => {
|
|
18465
18543
|
await this.client.uploadFile(
|
|
18466
18544
|
this.name,
|
|
18467
|
-
|
|
18545
|
+
toSandboxAbsolutePath(params.file, SANDBOX_HOME_DIR),
|
|
18468
18546
|
params.data
|
|
18469
18547
|
);
|
|
18470
18548
|
},
|
|
18471
18549
|
downloadFile: async (params) => {
|
|
18472
18550
|
const result = await this.client.downloadFile(
|
|
18473
18551
|
this.name,
|
|
18474
|
-
|
|
18552
|
+
toSandboxAbsolutePath(params.file, SANDBOX_HOME_DIR)
|
|
18475
18553
|
);
|
|
18476
18554
|
if (result.contentBase64) {
|
|
18477
18555
|
return Buffer.from(result.contentBase64, "base64");
|
|
@@ -18604,6 +18682,53 @@ var MicrosandboxServiceClient = class {
|
|
|
18604
18682
|
body: input
|
|
18605
18683
|
});
|
|
18606
18684
|
}
|
|
18685
|
+
async volumeFsRead(volumeName, path4) {
|
|
18686
|
+
const result = await this.request(
|
|
18687
|
+
`/api/volumes/${encodeURIComponent(volumeName)}/fs/read`,
|
|
18688
|
+
{
|
|
18689
|
+
method: "POST",
|
|
18690
|
+
body: { path: path4 }
|
|
18691
|
+
}
|
|
18692
|
+
);
|
|
18693
|
+
return result.content;
|
|
18694
|
+
}
|
|
18695
|
+
async volumeFsWrite(volumeName, path4, content) {
|
|
18696
|
+
await this.request(
|
|
18697
|
+
`/api/volumes/${encodeURIComponent(volumeName)}/fs/write`,
|
|
18698
|
+
{
|
|
18699
|
+
method: "POST",
|
|
18700
|
+
body: { path: path4, content }
|
|
18701
|
+
}
|
|
18702
|
+
);
|
|
18703
|
+
}
|
|
18704
|
+
async volumeFsList(volumeName, path4) {
|
|
18705
|
+
const result = await this.request(
|
|
18706
|
+
`/api/volumes/${encodeURIComponent(volumeName)}/fs/list`,
|
|
18707
|
+
{
|
|
18708
|
+
method: "POST",
|
|
18709
|
+
body: { path: path4 }
|
|
18710
|
+
}
|
|
18711
|
+
);
|
|
18712
|
+
return result.entries;
|
|
18713
|
+
}
|
|
18714
|
+
async volumeFsDownload(volumeName, path4) {
|
|
18715
|
+
const result = await this.request(
|
|
18716
|
+
`/api/volumes/${encodeURIComponent(volumeName)}/fs/download?path=${encodeURIComponent(path4)}`,
|
|
18717
|
+
{
|
|
18718
|
+
method: "GET"
|
|
18719
|
+
}
|
|
18720
|
+
);
|
|
18721
|
+
return Buffer.from(result.contentBase64, "base64");
|
|
18722
|
+
}
|
|
18723
|
+
async volumeFsUpload(volumeName, path4, data) {
|
|
18724
|
+
await this.request(
|
|
18725
|
+
`/api/volumes/${encodeURIComponent(volumeName)}/fs/upload`,
|
|
18726
|
+
{
|
|
18727
|
+
method: "POST",
|
|
18728
|
+
body: { path: path4, contentBase64: data.toString("base64") }
|
|
18729
|
+
}
|
|
18730
|
+
);
|
|
18731
|
+
}
|
|
18607
18732
|
async request(path4, init) {
|
|
18608
18733
|
const headers = {};
|
|
18609
18734
|
if (init.body) {
|
|
@@ -18645,9 +18770,11 @@ function parseOptionalNumberEnv(name, fallback) {
|
|
|
18645
18770
|
}
|
|
18646
18771
|
function getDefaultMicrosandboxRemoteConfig() {
|
|
18647
18772
|
return {
|
|
18648
|
-
image: process.env.MICROSANDBOX_IMAGE ?? "
|
|
18773
|
+
image: process.env.MICROSANDBOX_IMAGE ?? "daytona-cn-shanghai.cr.volces.com/daytona/sandbox:0.0.2",
|
|
18774
|
+
//"daytonaio/sandbox:0.6.0",
|
|
18649
18775
|
cpus: parseOptionalNumberEnv("MICROSANDBOX_CPUS", 1),
|
|
18650
|
-
memoryMib: parseOptionalNumberEnv("MICROSANDBOX_MEMORY", 512)
|
|
18776
|
+
memoryMib: parseOptionalNumberEnv("MICROSANDBOX_MEMORY", 512),
|
|
18777
|
+
user: "root"
|
|
18651
18778
|
};
|
|
18652
18779
|
}
|
|
18653
18780
|
var MicrosandboxRemoteProvider = class {
|
|
@@ -18701,6 +18828,15 @@ var MicrosandboxRemoteProvider = class {
|
|
|
18701
18828
|
await this.client.deleteSandbox(name);
|
|
18702
18829
|
this.instances.delete(name);
|
|
18703
18830
|
}
|
|
18831
|
+
createVolumeFsClient(volumeName) {
|
|
18832
|
+
return {
|
|
18833
|
+
read: (path4) => this.client.volumeFsRead(volumeName, path4),
|
|
18834
|
+
write: (path4, content) => this.client.volumeFsWrite(volumeName, path4, content),
|
|
18835
|
+
list: (path4) => this.client.volumeFsList(volumeName, path4),
|
|
18836
|
+
readRaw: (path4) => this.client.volumeFsDownload(volumeName, path4),
|
|
18837
|
+
writeRaw: (path4, data) => this.client.volumeFsUpload(volumeName, path4, data)
|
|
18838
|
+
};
|
|
18839
|
+
}
|
|
18704
18840
|
async listSandboxes() {
|
|
18705
18841
|
return Array.from(this.instances.values());
|
|
18706
18842
|
}
|
|
@@ -18710,7 +18846,10 @@ var MicrosandboxRemoteProvider = class {
|
|
|
18710
18846
|
image: this.config.image ?? defaultMicrosandboxRemoteConfig.image,
|
|
18711
18847
|
cpus: this.config.cpus ?? defaultMicrosandboxRemoteConfig.cpus,
|
|
18712
18848
|
memoryMib: this.config.memoryMib ?? defaultMicrosandboxRemoteConfig.memoryMib,
|
|
18713
|
-
env:
|
|
18849
|
+
env: {
|
|
18850
|
+
...this.config.env,
|
|
18851
|
+
...buildSandboxMetadataEnv(config)
|
|
18852
|
+
},
|
|
18714
18853
|
volumes: config?.volumes ?? this.buildDefaultVolumes(config)
|
|
18715
18854
|
};
|
|
18716
18855
|
}
|
|
@@ -18719,20 +18858,19 @@ var MicrosandboxRemoteProvider = class {
|
|
|
18719
18858
|
const volumes = {
|
|
18720
18859
|
"/home/daytona/.agents/skills": {
|
|
18721
18860
|
type: "named",
|
|
18722
|
-
name:
|
|
18861
|
+
name: buildNamedVolumeName("s", "skills", tenantId)
|
|
18723
18862
|
}
|
|
18724
18863
|
};
|
|
18725
18864
|
if (config?.assistant_id) {
|
|
18726
18865
|
volumes["/home/daytona/agent"] = {
|
|
18727
18866
|
type: "named",
|
|
18728
|
-
name:
|
|
18867
|
+
name: buildNamedVolumeName("a", "agent", tenantId, config.assistant_id)
|
|
18729
18868
|
};
|
|
18730
18869
|
}
|
|
18731
18870
|
if (config?.projectId) {
|
|
18732
|
-
const projectVolumeName = config.workspaceId ? `${tenantId}-workspace-${config.workspaceId}-project-${config.projectId}` : `${tenantId}-project-${config.projectId}`;
|
|
18733
18871
|
volumes["/home/daytona/project"] = {
|
|
18734
18872
|
type: "named",
|
|
18735
|
-
name:
|
|
18873
|
+
name: buildNamedVolumeName("p", "project", tenantId, config.workspaceId, config.projectId)
|
|
18736
18874
|
};
|
|
18737
18875
|
}
|
|
18738
18876
|
return volumes;
|
|
@@ -19071,26 +19209,18 @@ var DaytonaInstance = class {
|
|
|
19071
19209
|
this.native = native;
|
|
19072
19210
|
this.file = {
|
|
19073
19211
|
readFile: async (file) => {
|
|
19074
|
-
const buffer2 = await this.native.fs.downloadFile(
|
|
19212
|
+
const buffer2 = await this.native.fs.downloadFile(toSandboxRelativePath(file));
|
|
19075
19213
|
return { content: buffer2.toString("utf-8") };
|
|
19076
19214
|
},
|
|
19077
19215
|
writeFile: async (file, content) => {
|
|
19078
|
-
await this.native.fs.uploadFile(Buffer.from(content, "utf-8"),
|
|
19216
|
+
await this.native.fs.uploadFile(Buffer.from(content, "utf-8"), toSandboxRelativePath(file));
|
|
19079
19217
|
},
|
|
19080
19218
|
listPath: async (path4, options) => {
|
|
19081
|
-
const entries = await this.native.fs.listFiles(
|
|
19219
|
+
const entries = await this.native.fs.listFiles(toSandboxRelativePath(path4));
|
|
19082
19220
|
const files = entries.map((e) => {
|
|
19083
|
-
|
|
19084
|
-
while (name.startsWith("~/") || name.startsWith("/")) {
|
|
19085
|
-
if (name.startsWith("~/")) {
|
|
19086
|
-
name = name.slice(2);
|
|
19087
|
-
} else if (name.startsWith("/")) {
|
|
19088
|
-
name = name.slice(1);
|
|
19089
|
-
}
|
|
19090
|
-
}
|
|
19091
|
-
const fullPath = name ? `${path4}/${name}`.replace(/\/+/g, "/") : path4;
|
|
19221
|
+
const rawPath = e.name || "";
|
|
19092
19222
|
return {
|
|
19093
|
-
path:
|
|
19223
|
+
path: fromSandboxExecutionPath(rawPath),
|
|
19094
19224
|
is_dir: e.isDir ?? false,
|
|
19095
19225
|
size: e.size,
|
|
19096
19226
|
modified_at: e.modTime ? e.modTime : void 0
|
|
@@ -19099,11 +19229,11 @@ var DaytonaInstance = class {
|
|
|
19099
19229
|
return { files };
|
|
19100
19230
|
},
|
|
19101
19231
|
findFiles: async (path4, glob) => {
|
|
19102
|
-
const result = await this.native.fs.searchFiles(
|
|
19103
|
-
return { files: result.files || [] };
|
|
19232
|
+
const result = await this.native.fs.searchFiles(toSandboxRelativePath(path4), glob);
|
|
19233
|
+
return { files: (result.files || []).map((filePath) => fromSandboxExecutionPath(filePath)) };
|
|
19104
19234
|
},
|
|
19105
19235
|
searchInFile: async (file, regex) => {
|
|
19106
|
-
const matches = await this.native.fs.findFiles(
|
|
19236
|
+
const matches = await this.native.fs.findFiles(toSandboxRelativePath(file), regex);
|
|
19107
19237
|
const line_numbers = [];
|
|
19108
19238
|
const matchTexts = [];
|
|
19109
19239
|
for (const match of matches) {
|
|
@@ -19114,7 +19244,7 @@ var DaytonaInstance = class {
|
|
|
19114
19244
|
},
|
|
19115
19245
|
strReplaceEditor: async (params) => {
|
|
19116
19246
|
const { path: path4, old_str, new_str, replace_mode } = params;
|
|
19117
|
-
const relPath =
|
|
19247
|
+
const relPath = toSandboxRelativePath(path4);
|
|
19118
19248
|
if (replace_mode === "ALL") {
|
|
19119
19249
|
await this.native.fs.replaceInFiles([relPath], old_str, new_str);
|
|
19120
19250
|
} else {
|
|
@@ -19128,10 +19258,10 @@ var DaytonaInstance = class {
|
|
|
19128
19258
|
}
|
|
19129
19259
|
},
|
|
19130
19260
|
uploadFile: async (params) => {
|
|
19131
|
-
await this.native.fs.uploadFile(params.data,
|
|
19261
|
+
await this.native.fs.uploadFile(params.data, toSandboxRelativePath(params.file));
|
|
19132
19262
|
},
|
|
19133
19263
|
downloadFile: async (params) => {
|
|
19134
|
-
const buffer2 = await this.native.fs.downloadFile(
|
|
19264
|
+
const buffer2 = await this.native.fs.downloadFile(toSandboxRelativePath(params.file));
|
|
19135
19265
|
return Buffer.isBuffer(buffer2) ? buffer2 : Buffer.from(buffer2);
|
|
19136
19266
|
}
|
|
19137
19267
|
};
|
|
@@ -19493,7 +19623,6 @@ function clearEncryptionKeyCache() {
|
|
|
19493
19623
|
0 && (module.exports = {
|
|
19494
19624
|
AGENT_TASK_EVENT,
|
|
19495
19625
|
Agent,
|
|
19496
|
-
AgentConfig,
|
|
19497
19626
|
AgentInstanceManager,
|
|
19498
19627
|
AgentLatticeManager,
|
|
19499
19628
|
AgentManager,
|
|
@@ -19512,7 +19641,6 @@ function clearEncryptionKeyCache() {
|
|
|
19512
19641
|
EmbeddingsLatticeManager,
|
|
19513
19642
|
FileSystemSkillStore,
|
|
19514
19643
|
FilesystemBackend,
|
|
19515
|
-
GraphBuildOptions,
|
|
19516
19644
|
HumanMessage,
|
|
19517
19645
|
InMemoryAssistantStore,
|
|
19518
19646
|
InMemoryChunkBuffer,
|
|
@@ -19566,9 +19694,12 @@ function clearEncryptionKeyCache() {
|
|
|
19566
19694
|
ThreadStatus,
|
|
19567
19695
|
ToolLatticeManager,
|
|
19568
19696
|
VectorStoreLatticeManager,
|
|
19697
|
+
VolumeFilesystem,
|
|
19569
19698
|
agentInstanceManager,
|
|
19570
19699
|
agentLatticeManager,
|
|
19571
19700
|
buildGrepResultsDict,
|
|
19701
|
+
buildNamedVolumeName,
|
|
19702
|
+
buildSandboxMetadataEnv,
|
|
19572
19703
|
buildSkillFile,
|
|
19573
19704
|
checkEmptyContent,
|
|
19574
19705
|
clearEncryptionKeyCache,
|