@tickernelz/wardmote-plugin-daytona 2026.1108.2 → 2026.1111.0
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/README.md +5 -5
- package/dist/duplex-command-stream.js +2 -2
- package/dist/duplex-command-stream.js.map +1 -1
- package/dist/duplex-command-stream.test.js +8 -8
- package/dist/duplex-command-stream.test.js.map +1 -1
- package/dist/file-sync.d.ts.map +1 -1
- package/dist/file-sync.js +5 -27
- package/dist/file-sync.js.map +1 -1
- package/dist/file-sync.test.js +66 -68
- package/dist/file-sync.test.js.map +1 -1
- package/dist/login-pty.d.ts +0 -11
- package/dist/login-pty.d.ts.map +1 -1
- package/dist/login-pty.js +2 -54
- package/dist/login-pty.js.map +1 -1
- package/dist/login-pty.test.js +2 -2
- package/dist/login-pty.test.js.map +1 -1
- package/dist/manifest.d.ts +2 -2
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +7 -14
- package/dist/manifest.js.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +3 -17
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.test.js +57 -59
- package/dist/plugin.test.js.map +1 -1
- package/package.json +4 -4
package/dist/plugin.test.js
CHANGED
|
@@ -310,7 +310,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
310
310
|
// It quotes each command argument and the diagnostics path as a shell word.
|
|
311
311
|
expect(inputs[0]).toContain("stty raw -echo");
|
|
312
312
|
expect(inputs[0]).toContain("exec 'node' '/paperclip/gateway.mjs'");
|
|
313
|
-
expect(inputs[0]).toMatch(/2>'\/tmp\/
|
|
313
|
+
expect(inputs[0]).toMatch(/2>'\/tmp\/wardmote-duplex-.+\.log'/);
|
|
314
314
|
// A host write on the exact pair reaches the process on the same channel.
|
|
315
315
|
// `data` arrives in the wire-safe base64 form (see `ChannelBytesWireValue`
|
|
316
316
|
// in the plugin SDK's protocol.ts).
|
|
@@ -889,13 +889,13 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
889
889
|
remoteCwd: "/home/daytona/paperclip-workspace",
|
|
890
890
|
reuseLease: true,
|
|
891
891
|
workspaceSentinel: {
|
|
892
|
-
path: "/home/daytona/paperclip-workspace/.
|
|
892
|
+
path: "/home/daytona/paperclip-workspace/.wardmote-runtime/reusable-sandbox-lease.json",
|
|
893
893
|
result: "written",
|
|
894
894
|
},
|
|
895
895
|
},
|
|
896
896
|
});
|
|
897
|
-
expect(sandbox.fs.createFolder).toHaveBeenCalledWith("/home/daytona/paperclip-workspace/.
|
|
898
|
-
expect(sandbox.fs.uploadFile).toHaveBeenCalledWith(expect.any(Buffer), "/home/daytona/paperclip-workspace/.
|
|
897
|
+
expect(sandbox.fs.createFolder).toHaveBeenCalledWith("/home/daytona/paperclip-workspace/.wardmote-runtime", "755");
|
|
898
|
+
expect(sandbox.fs.uploadFile).toHaveBeenCalledWith(expect.any(Buffer), "/home/daytona/paperclip-workspace/.wardmote-runtime/reusable-sandbox-lease.json", 300);
|
|
899
899
|
});
|
|
900
900
|
it("does not configure a provider ttl when the acquire carries no requested expiry", async () => {
|
|
901
901
|
process.env.DAYTONA_API_KEY = "host-key";
|
|
@@ -1320,7 +1320,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
1320
1320
|
const sandbox = createMockSandbox({ id: "ephemeral-owned" });
|
|
1321
1321
|
mockCreate.mockResolvedValue(sandbox);
|
|
1322
1322
|
const base = { driverKey: "daytona", companyId: "company-1", environmentId: "env-1", agentId: "agent-1",
|
|
1323
|
-
issueId: "issue-1", adapterType: "
|
|
1323
|
+
issueId: "issue-1", adapterType: "wardmote_runner", config: { reuseLease: false } };
|
|
1324
1324
|
const lease = await plugin.definition.onEnvironmentAcquireLease({ ...base, runId: "run-1" });
|
|
1325
1325
|
const sentinel = lease.metadata.workspaceSentinel;
|
|
1326
1326
|
expect(sentinel).toMatchObject({ token: expect.stringMatching(/^[a-f0-9]{64}$/), result: "written" });
|
|
@@ -1478,7 +1478,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
1478
1478
|
},
|
|
1479
1479
|
leaseMetadata: {
|
|
1480
1480
|
workspaceSentinel: {
|
|
1481
|
-
path: "/home/daytona/paperclip-workspace/.
|
|
1481
|
+
path: "/home/daytona/paperclip-workspace/.wardmote-runtime/reusable-sandbox-lease.json",
|
|
1482
1482
|
token: "sentinel-token",
|
|
1483
1483
|
result: "written",
|
|
1484
1484
|
},
|
|
@@ -1504,7 +1504,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
1504
1504
|
const params = {
|
|
1505
1505
|
driverKey: "daytona", companyId: "company-1", environmentId: "env-1", providerLeaseId: sandboxId,
|
|
1506
1506
|
config: { apiKey: "host-key", timeoutMs: 300000, livenessTimeoutMs: 100, reuseLease: true },
|
|
1507
|
-
leaseMetadata: { workspaceSentinel: { path: "/home/daytona/paperclip-workspace/.
|
|
1507
|
+
leaseMetadata: { workspaceSentinel: { path: "/home/daytona/paperclip-workspace/.wardmote-runtime/reusable-sandbox-lease.json", token: "sentinel-token" } },
|
|
1508
1508
|
};
|
|
1509
1509
|
const resume = () => plugin.definition.onEnvironmentResumeLease(params);
|
|
1510
1510
|
function missingSandbox() {
|
|
@@ -1636,7 +1636,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
1636
1636
|
},
|
|
1637
1637
|
leaseMetadata: {
|
|
1638
1638
|
workspaceSentinel: {
|
|
1639
|
-
path: "/home/daytona/paperclip-workspace/.
|
|
1639
|
+
path: "/home/daytona/paperclip-workspace/.wardmote-runtime/reusable-sandbox-lease.json",
|
|
1640
1640
|
token: "sentinel-token",
|
|
1641
1641
|
result: "written",
|
|
1642
1642
|
},
|
|
@@ -1646,7 +1646,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
1646
1646
|
metadata: {
|
|
1647
1647
|
expired: true,
|
|
1648
1648
|
workspaceSentinel: {
|
|
1649
|
-
path: "/home/daytona/paperclip-workspace/.
|
|
1649
|
+
path: "/home/daytona/paperclip-workspace/.wardmote-runtime/reusable-sandbox-lease.json",
|
|
1650
1650
|
token: "sentinel-token",
|
|
1651
1651
|
result: "mismatch",
|
|
1652
1652
|
},
|
|
@@ -2083,7 +2083,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
2083
2083
|
leaseMetadata: {
|
|
2084
2084
|
remoteCwd: "/home/daytona/paperclip-workspace",
|
|
2085
2085
|
workspaceSentinel: {
|
|
2086
|
-
path: "/home/daytona/paperclip-workspace/.
|
|
2086
|
+
path: "/home/daytona/paperclip-workspace/.wardmote-runtime/reusable-sandbox-lease.json",
|
|
2087
2087
|
token: "token-1",
|
|
2088
2088
|
},
|
|
2089
2089
|
},
|
|
@@ -2110,7 +2110,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
2110
2110
|
leaseMetadata: {
|
|
2111
2111
|
remoteCwd: "/home/daytona/paperclip-workspace",
|
|
2112
2112
|
workspaceSentinel: {
|
|
2113
|
-
path: "/home/daytona/paperclip-workspace/.
|
|
2113
|
+
path: "/home/daytona/paperclip-workspace/.wardmote-runtime/reusable-sandbox-lease.json",
|
|
2114
2114
|
token: "token-1",
|
|
2115
2115
|
},
|
|
2116
2116
|
},
|
|
@@ -2140,7 +2140,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
2140
2140
|
const setup = spans.find((span) => span.name === "session.open");
|
|
2141
2141
|
expect(setup).toBeDefined();
|
|
2142
2142
|
expect(setup.ended).toBe(true);
|
|
2143
|
-
expect(setup.attributes["
|
|
2143
|
+
expect(setup.attributes["wardmote.sandbox.startup.provider"]).toBe("daytona");
|
|
2144
2144
|
await plugin.definition.onEnvironmentReleaseLease?.({
|
|
2145
2145
|
driverKey: "daytona",
|
|
2146
2146
|
companyId: "company-1",
|
|
@@ -2151,7 +2151,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
2151
2151
|
const teardown = spans.find((span) => span.name === "session.close");
|
|
2152
2152
|
expect(teardown).toBeDefined();
|
|
2153
2153
|
expect(teardown.ended).toBe(true);
|
|
2154
|
-
expect(teardown.attributes["
|
|
2154
|
+
expect(teardown.attributes["wardmote.sandbox.startup.provider"]).toBe("daytona");
|
|
2155
2155
|
}
|
|
2156
2156
|
finally {
|
|
2157
2157
|
restore();
|
|
@@ -2976,14 +2976,14 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
2976
2976
|
stdin: "input payload",
|
|
2977
2977
|
timeoutMs: 1000,
|
|
2978
2978
|
});
|
|
2979
|
-
expect(sandbox.fs.uploadFile).toHaveBeenCalledWith(Buffer.from("input payload", "utf8"), expect.stringMatching(/^\/tmp\/
|
|
2979
|
+
expect(sandbox.fs.uploadFile).toHaveBeenCalledWith(Buffer.from("input payload", "utf8"), expect.stringMatching(/^\/tmp\/wardmote-stdin-/), 1);
|
|
2980
2980
|
const [command] = sandbox.process.executeCommand.mock.calls[0];
|
|
2981
2981
|
expect(command).toMatch(/\/etc\/profile/);
|
|
2982
2982
|
expect(command).not.toMatch(/nvm\.sh/);
|
|
2983
2983
|
expect(command).toMatch(/&& cd '\/workspace'/);
|
|
2984
|
-
expect(command).toMatch(/env .* 'cat' < '\/tmp\/
|
|
2984
|
+
expect(command).toMatch(/env .* 'cat' < '\/tmp\/wardmote-stdin-/);
|
|
2985
2985
|
expect(command).not.toMatch(/(?:^|&& )exec /);
|
|
2986
|
-
expect(sandbox.fs.deleteFile).toHaveBeenCalledWith(expect.stringMatching(/^\/tmp\/
|
|
2986
|
+
expect(sandbox.fs.deleteFile).toHaveBeenCalledWith(expect.stringMatching(/^\/tmp\/wardmote-stdin-/));
|
|
2987
2987
|
expect(result).toMatchObject({
|
|
2988
2988
|
exitCode: 0,
|
|
2989
2989
|
timedOut: false,
|
|
@@ -3763,7 +3763,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|
|
3763
3763
|
config: { timeoutMs: 300000, reuseLease: true },
|
|
3764
3764
|
leaseMetadata: {
|
|
3765
3765
|
workspaceSentinel: {
|
|
3766
|
-
path: "/home/daytona/paperclip-workspace/.
|
|
3766
|
+
path: "/home/daytona/paperclip-workspace/.wardmote-runtime/reusable-sandbox-lease.json",
|
|
3767
3767
|
token: "expected-token",
|
|
3768
3768
|
result: "written",
|
|
3769
3769
|
},
|
|
@@ -4154,7 +4154,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4154
4154
|
// post-upload command extracts it into the workspace directory. So
|
|
4155
4155
|
// `writablePath` names the real read-write destination.
|
|
4156
4156
|
sourcePath: source,
|
|
4157
|
-
targetPath: `${REMOTE_DIR}/.
|
|
4157
|
+
targetPath: `${REMOTE_DIR}/.wardmote-runtime/workspace-upload.tar`,
|
|
4158
4158
|
kind: "file",
|
|
4159
4159
|
access: "rw",
|
|
4160
4160
|
writablePath: REMOTE_DIR,
|
|
@@ -4167,7 +4167,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4167
4167
|
// The set holds the extract destination, not the staging archive parent.
|
|
4168
4168
|
const recorded = __getDaytonaWritableDirsForTest(params);
|
|
4169
4169
|
expect(recorded).toContain(REMOTE_DIR);
|
|
4170
|
-
expect(recorded).not.toContain(`${REMOTE_DIR}/.
|
|
4170
|
+
expect(recorded).not.toContain(`${REMOTE_DIR}/.wardmote-runtime`);
|
|
4171
4171
|
});
|
|
4172
4172
|
it("falls back to the parent directory of an rw mapping with no writablePath", async () => {
|
|
4173
4173
|
const hostDir = await makeHostDir();
|
|
@@ -4221,14 +4221,14 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4221
4221
|
files: [
|
|
4222
4222
|
{
|
|
4223
4223
|
sourcePath: roSource,
|
|
4224
|
-
targetPath: `${REMOTE_DIR}/.
|
|
4224
|
+
targetPath: `${REMOTE_DIR}/.wardmote-runtime/project-proj-first`,
|
|
4225
4225
|
kind: "directory",
|
|
4226
4226
|
access: "ro",
|
|
4227
4227
|
},
|
|
4228
4228
|
{
|
|
4229
4229
|
// An absent `access` defaults to read-only, so it is not recorded.
|
|
4230
4230
|
sourcePath: defaultSource,
|
|
4231
|
-
targetPath: `${REMOTE_DIR}/.
|
|
4231
|
+
targetPath: `${REMOTE_DIR}/.wardmote-runtime/default-upload.tar`,
|
|
4232
4232
|
kind: "file",
|
|
4233
4233
|
},
|
|
4234
4234
|
],
|
|
@@ -4270,7 +4270,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4270
4270
|
// String sources stream from the local path; destinations are reserved temps.
|
|
4271
4271
|
expect(uploads[0].source).toBe(secretSource);
|
|
4272
4272
|
for (const upload of uploads) {
|
|
4273
|
-
expect(path.posix.basename(upload.destination)).toMatch(/^\.
|
|
4273
|
+
expect(path.posix.basename(upload.destination)).toMatch(/^\.wardmote-upload-/);
|
|
4274
4274
|
expect(upload.destination).not.toBe(`${REMOTE_DIR}/.secret/auth.json`);
|
|
4275
4275
|
// TOCTOU-hardened: the privileged upload destination is a DIRECT child of the
|
|
4276
4276
|
// workspace root, never a sibling under the target's (sandbox-swappable)
|
|
@@ -4281,7 +4281,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4281
4281
|
// never appears at a widened window; applied via setFilePermissions as "600".
|
|
4282
4282
|
expect(sandbox.fs.setFilePermissions).toHaveBeenCalledTimes(1);
|
|
4283
4283
|
const [permPath, perms] = sandbox.fs.setFilePermissions.mock.calls[0];
|
|
4284
|
-
expect(path.posix.basename(permPath)).toMatch(/^\.
|
|
4284
|
+
expect(path.posix.basename(permPath)).toMatch(/^\.wardmote-upload-/);
|
|
4285
4285
|
expect(perms).toEqual({ mode: "600" });
|
|
4286
4286
|
// The setFilePermissions on the temp precedes the mv that promotes it.
|
|
4287
4287
|
const secretTemp = permPath;
|
|
@@ -4355,9 +4355,9 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4355
4355
|
expect(transfer).toBeDefined();
|
|
4356
4356
|
expect(transfer.ended).toBe(true);
|
|
4357
4357
|
// One serial guard round trip before the transfer: mkdir (with the zstd probe).
|
|
4358
|
-
expect(transfer.attributes["
|
|
4359
|
-
expect(transfer.attributes["
|
|
4360
|
-
expect(typeof transfer.attributes["
|
|
4358
|
+
expect(transfer.attributes["wardmote.sandbox.startup.transfer.guard.count"]).toBe(1);
|
|
4359
|
+
expect(transfer.attributes["wardmote.sandbox.startup.provider"]).toBe("daytona");
|
|
4360
|
+
expect(typeof transfer.attributes["wardmote.sandbox.startup.transfer.wall_ms"]).toBe("number");
|
|
4361
4361
|
// A bulk file upload builds no host tarball, so it opens no pack span.
|
|
4362
4362
|
expect(spans.find((span) => span.name === "pack")).toBeUndefined();
|
|
4363
4363
|
});
|
|
@@ -4382,7 +4382,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4382
4382
|
// An upload to the sandbox is an inbound transfer.
|
|
4383
4383
|
const transfer = spans.find((span) => span.name === "transfer");
|
|
4384
4384
|
expect(transfer).toBeDefined();
|
|
4385
|
-
expect(transfer.attributes["
|
|
4385
|
+
expect(transfer.attributes["wardmote.sandbox.startup.transfer.direction"]).toBe("inbound");
|
|
4386
4386
|
});
|
|
4387
4387
|
it("marks the outbound transfer span with the outbound direction attribute", async () => {
|
|
4388
4388
|
const hostDir = await makeHostDir();
|
|
@@ -4409,7 +4409,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4409
4409
|
// A download from the sandbox is an outbound transfer.
|
|
4410
4410
|
const transfer = spans.find((span) => span.name === "transfer");
|
|
4411
4411
|
expect(transfer).toBeDefined();
|
|
4412
|
-
expect(transfer.attributes["
|
|
4412
|
+
expect(transfer.attributes["wardmote.sandbox.startup.transfer.direction"]).toBe("outbound");
|
|
4413
4413
|
});
|
|
4414
4414
|
it("opens a pack span and a transfer span around a directory mapping sync", async () => {
|
|
4415
4415
|
const hostDir = await makeHostDir();
|
|
@@ -4431,7 +4431,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4431
4431
|
{
|
|
4432
4432
|
operationId: "sync-op-dir",
|
|
4433
4433
|
files: [
|
|
4434
|
-
{ sourcePath: sourceDir, targetPath: `${REMOTE_DIR}/.
|
|
4434
|
+
{ sourcePath: sourceDir, targetPath: `${REMOTE_DIR}/.wardmote-runtime/assets`, kind: "directory" },
|
|
4435
4435
|
],
|
|
4436
4436
|
},
|
|
4437
4437
|
],
|
|
@@ -4443,11 +4443,11 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4443
4443
|
const pack = spans.find((span) => span.name === "pack");
|
|
4444
4444
|
expect(pack).toBeDefined();
|
|
4445
4445
|
expect(pack.ended).toBe(true);
|
|
4446
|
-
expect(typeof pack.attributes["
|
|
4446
|
+
expect(typeof pack.attributes["wardmote.sandbox.startup.pack.wall_ms"]).toBe("number");
|
|
4447
4447
|
const transfer = spans.find((span) => span.name === "transfer");
|
|
4448
4448
|
expect(transfer).toBeDefined();
|
|
4449
4449
|
// One serial guard round trip before the transfer: mkdir.
|
|
4450
|
-
expect(transfer.attributes["
|
|
4450
|
+
expect(transfer.attributes["wardmote.sandbox.startup.transfer.guard.count"]).toBe(1);
|
|
4451
4451
|
});
|
|
4452
4452
|
it("opens ensureDirectory, transfer, promote spans in call order for a file-mapping sync", async () => {
|
|
4453
4453
|
const hostDir = await makeHostDir();
|
|
@@ -4482,12 +4482,12 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4482
4482
|
]);
|
|
4483
4483
|
for (const span of spans) {
|
|
4484
4484
|
expect(span.ended).toBe(true);
|
|
4485
|
-
expect(span.attributes["
|
|
4485
|
+
expect(span.attributes["wardmote.sandbox.startup.provider"]).toBe("daytona");
|
|
4486
4486
|
// A per-round-trip span carries no `*.wall_ms` attribute; the native span
|
|
4487
4487
|
// width carries its time. Only `pack` and `transfer` keep a wall_ms value.
|
|
4488
4488
|
if (span.name !== "transfer") {
|
|
4489
|
-
expect(span.attributes["
|
|
4490
|
-
expect(span.attributes["
|
|
4489
|
+
expect(span.attributes["wardmote.sandbox.startup.ensureDirectory.wall_ms"]).toBeUndefined();
|
|
4490
|
+
expect(span.attributes["wardmote.sandbox.startup.promote.wall_ms"]).toBeUndefined();
|
|
4491
4491
|
}
|
|
4492
4492
|
}
|
|
4493
4493
|
});
|
|
@@ -4511,7 +4511,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4511
4511
|
{
|
|
4512
4512
|
operationId: "sync-op-dir-order",
|
|
4513
4513
|
files: [
|
|
4514
|
-
{ sourcePath: sourceDir, targetPath: `${REMOTE_DIR}/.
|
|
4514
|
+
{ sourcePath: sourceDir, targetPath: `${REMOTE_DIR}/.wardmote-runtime/assets`, kind: "directory" },
|
|
4515
4515
|
],
|
|
4516
4516
|
},
|
|
4517
4517
|
],
|
|
@@ -4527,7 +4527,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4527
4527
|
"extractTarball",
|
|
4528
4528
|
]);
|
|
4529
4529
|
for (const span of spans) {
|
|
4530
|
-
expect(span.attributes["
|
|
4530
|
+
expect(span.attributes["wardmote.sandbox.startup.provider"]).toBe("daytona");
|
|
4531
4531
|
}
|
|
4532
4532
|
});
|
|
4533
4533
|
it("records a pack span for a traced directory mapping", async () => {
|
|
@@ -4550,7 +4550,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4550
4550
|
{
|
|
4551
4551
|
operationId: "sync-op-pack",
|
|
4552
4552
|
files: [
|
|
4553
|
-
{ sourcePath: sourceDir, targetPath: `${REMOTE_DIR}/.
|
|
4553
|
+
{ sourcePath: sourceDir, targetPath: `${REMOTE_DIR}/.wardmote-runtime/assets`, kind: "directory" },
|
|
4554
4554
|
],
|
|
4555
4555
|
},
|
|
4556
4556
|
],
|
|
@@ -4562,7 +4562,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4562
4562
|
const pack = spans.find((span) => span.name === "pack");
|
|
4563
4563
|
expect(pack).toBeDefined();
|
|
4564
4564
|
expect(pack.ended).toBe(true);
|
|
4565
|
-
expect(pack.attributes["
|
|
4565
|
+
expect(pack.attributes["wardmote.sandbox.startup.provider"]).toBe("daytona");
|
|
4566
4566
|
});
|
|
4567
4567
|
it("opens a postUploadCommand span for a post-upload command with a working directory", async () => {
|
|
4568
4568
|
const hostDir = await makeHostDir();
|
|
@@ -4601,7 +4601,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4601
4601
|
]);
|
|
4602
4602
|
const provision = spans.find((span) => span.name === "postUploadCommand");
|
|
4603
4603
|
expect(provision.ended).toBe(true);
|
|
4604
|
-
expect(provision.attributes["
|
|
4604
|
+
expect(provision.attributes["wardmote.sandbox.startup.provider"]).toBe("daytona");
|
|
4605
4605
|
});
|
|
4606
4606
|
it("gzip-tars a directory mapping host-side honoring excludes and the followSymlinks flag, then extracts it in-sandbox via a single quoted tar command", async () => {
|
|
4607
4607
|
const hostDir = await makeHostDir();
|
|
@@ -4631,7 +4631,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4631
4631
|
files: [
|
|
4632
4632
|
{
|
|
4633
4633
|
sourcePath: sourceDir,
|
|
4634
|
-
targetPath: `${REMOTE_DIR}/.
|
|
4634
|
+
targetPath: `${REMOTE_DIR}/.wardmote-runtime/assets`,
|
|
4635
4635
|
kind: "directory",
|
|
4636
4636
|
exclude: ["*.log"],
|
|
4637
4637
|
},
|
|
@@ -4643,7 +4643,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4643
4643
|
const [uploads] = sandbox.fs.uploadFiles.mock.calls[0];
|
|
4644
4644
|
expect(uploads).toHaveLength(1);
|
|
4645
4645
|
expect(uploads[0].source).toMatch(/\.tar\.gz$/);
|
|
4646
|
-
expect(path.posix.basename(uploads[0].destination)).toMatch(/^\.
|
|
4646
|
+
expect(path.posix.basename(uploads[0].destination)).toMatch(/^\.wardmote-upload-.*\.tar\.gz$/);
|
|
4647
4647
|
expect(uploads[0].destination.startsWith(`${REMOTE_DIR}/`)).toBe(true);
|
|
4648
4648
|
// Inspect the real host tar: excluded file gone; symlink preserved AS a link.
|
|
4649
4649
|
expect(capturedTarListing).toContain("keep/a.txt");
|
|
@@ -4651,7 +4651,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4651
4651
|
expect(capturedTarListing).toMatch(/link\.txt ->|link\.txt link to/);
|
|
4652
4652
|
// The target dir is created by its own mkdir command, before the upload.
|
|
4653
4653
|
const mkdirCall = sandbox.process.executeCommand.mock.calls.find(([cmd]) => String(cmd).includes("mkdir -p") &&
|
|
4654
|
-
String(cmd).includes(`'${REMOTE_DIR}/.
|
|
4654
|
+
String(cmd).includes(`'${REMOTE_DIR}/.wardmote-runtime/assets'`) &&
|
|
4655
4655
|
!String(cmd).includes("tar -xf"));
|
|
4656
4656
|
expect(mkdirCall).toBeDefined();
|
|
4657
4657
|
const extractCall = sandbox.process.executeCommand.mock.calls.find(([cmd]) => String(cmd).includes("tar -xf"));
|
|
@@ -4659,9 +4659,9 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4659
4659
|
const extractCommand = String(extractCall?.[0]);
|
|
4660
4660
|
// The extract is one plain `tar -xf <scratch-tar> -C <target>` command,
|
|
4661
4661
|
// followed by removing the scratch tar.
|
|
4662
|
-
expect(extractCommand).toContain(".
|
|
4662
|
+
expect(extractCommand).toContain(".wardmote-runtime/assets");
|
|
4663
4663
|
expect(extractCommand).toContain("tar -xf");
|
|
4664
|
-
expect(extractCommand).toMatch(/rm -f .*\.
|
|
4664
|
+
expect(extractCommand).toMatch(/rm -f .*\.wardmote-upload-.*\.tar\.gz/);
|
|
4665
4665
|
});
|
|
4666
4666
|
it("syncIn dereferences symlinks to bytes when followSymlinks is true (tar -h)", async () => {
|
|
4667
4667
|
const hostDir = await makeHostDir();
|
|
@@ -4727,11 +4727,11 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4727
4727
|
const [requests] = sandbox.fs.downloadFiles.mock.calls[0];
|
|
4728
4728
|
expect(requests).toHaveLength(2);
|
|
4729
4729
|
for (const req of requests) {
|
|
4730
|
-
expect(path.basename(req.destination)).toMatch(/^\.
|
|
4730
|
+
expect(path.basename(req.destination)).toMatch(/^\.wardmote-upload-/);
|
|
4731
4731
|
// TOCTOU-closed: the download reads a reserved snapshot inside the remote
|
|
4732
4732
|
// dir, never the mutable original source path.
|
|
4733
4733
|
expect(req.source.startsWith(`${REMOTE_DIR}/`)).toBe(true);
|
|
4734
|
-
expect(path.posix.basename(req.source)).toMatch(/^\.
|
|
4734
|
+
expect(path.posix.basename(req.source)).toMatch(/^\.wardmote-upload-/);
|
|
4735
4735
|
}
|
|
4736
4736
|
expect(requests.map((req) => req.source)).not.toContain(`${REMOTE_DIR}/out/result.txt`);
|
|
4737
4737
|
expect(requests.map((req) => req.source)).not.toContain(`${REMOTE_DIR}/out/secret.key`);
|
|
@@ -4907,8 +4907,6 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4907
4907
|
const source = path.join(hostDir, "config.txt");
|
|
4908
4908
|
await fs.writeFile(source, "plain");
|
|
4909
4909
|
const sandbox = createMockSandbox();
|
|
4910
|
-
// mkdir + realpath guard succeed; the promoting `mv -f` fails, leaving staged
|
|
4911
|
-
// `.paperclip-upload-*` temps that the error path must sweep with `rm -f`.
|
|
4912
4910
|
sandbox.process.executeCommand.mockImplementation(async (command) => {
|
|
4913
4911
|
if (command.includes("mv -f")) {
|
|
4914
4912
|
return { exitCode: 1, result: "mv: permission denied", artifacts: { stdout: "mv: permission denied" } };
|
|
@@ -4931,7 +4929,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4931
4929
|
})).rejects.toThrow(/syncIn rename command failed \(exit 1\)/);
|
|
4932
4930
|
// The upload happened, so a temp was staged; the error path cleans it up.
|
|
4933
4931
|
expect(sandbox.fs.uploadFiles).toHaveBeenCalledTimes(1);
|
|
4934
|
-
const cleanupCall = sandbox.process.executeCommand.mock.calls.find(([cmd]) => String(cmd).includes("rm -f") && String(cmd).includes(".
|
|
4932
|
+
const cleanupCall = sandbox.process.executeCommand.mock.calls.find(([cmd]) => String(cmd).includes("rm -f") && String(cmd).includes(".wardmote-upload-"));
|
|
4935
4933
|
expect(cleanupCall).toBeDefined();
|
|
4936
4934
|
});
|
|
4937
4935
|
it("syncOut refuses a sandbox-authored tarball whose members escape the extraction dir (path traversal)", async () => {
|
|
@@ -4976,7 +4974,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
4976
4974
|
// written above the extraction dir.
|
|
4977
4975
|
await expect(fs.stat(path.join(hostRoot, "escape.txt"))).rejects.toThrow();
|
|
4978
4976
|
});
|
|
4979
|
-
it.each(["../../outside.txt", "/tmp/
|
|
4977
|
+
it.each(["../../outside.txt", "/tmp/wardmote-git-workspace-example/skills/demo"])("syncOut refuses a sandbox-authored tarball with escaping symlink target %s", async (linkTarget) => {
|
|
4980
4978
|
const hostRoot = await makeHostDir();
|
|
4981
4979
|
const restored = path.join(hostRoot, "restored");
|
|
4982
4980
|
const sandbox = createMockSandbox();
|
|
@@ -5194,7 +5192,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
5194
5192
|
const overlayTar = path.join(hostDir, "workspace.tar");
|
|
5195
5193
|
await fs.writeFile(gitTar, "git-bytes");
|
|
5196
5194
|
await fs.writeFile(overlayTar, "overlay-bytes");
|
|
5197
|
-
const runtimeDir = `${REMOTE_DIR}/.
|
|
5195
|
+
const runtimeDir = `${REMOTE_DIR}/.wardmote-runtime/adapter`;
|
|
5198
5196
|
const sandbox = createMockSandbox();
|
|
5199
5197
|
mockGet.mockResolvedValue(sandbox);
|
|
5200
5198
|
const gitExtract = "git-history-extract";
|
|
@@ -5244,7 +5242,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
5244
5242
|
const overlayTar = path.join(hostDir, "workspace.tar");
|
|
5245
5243
|
await fs.writeFile(gitTar, "git-bytes");
|
|
5246
5244
|
await fs.writeFile(overlayTar, "overlay-bytes");
|
|
5247
|
-
const runtimeDir = `${REMOTE_DIR}/.
|
|
5245
|
+
const runtimeDir = `${REMOTE_DIR}/.wardmote-runtime/adapter`;
|
|
5248
5246
|
const sandbox = createMockSandbox();
|
|
5249
5247
|
// The first (git-history) extract exits non-zero; every transfer/guard script
|
|
5250
5248
|
// stays green so the fail-fast loop is the only thing that can trip this test.
|
|
@@ -5348,7 +5346,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
5348
5346
|
const destinations = sandbox.fs.uploadFiles.mock.calls.flatMap(([uploads]) => uploads.map((upload) => upload.destination));
|
|
5349
5347
|
expect(destinations).toHaveLength(2);
|
|
5350
5348
|
for (const destination of destinations) {
|
|
5351
|
-
expect(path.posix.basename(destination)).toMatch(/^\.
|
|
5349
|
+
expect(path.posix.basename(destination)).toMatch(/^\.wardmote-upload-/);
|
|
5352
5350
|
expect(path.posix.dirname(destination)).toBe(REMOTE_DIR);
|
|
5353
5351
|
}
|
|
5354
5352
|
expect(new Set(destinations).size).toBe(destinations.length);
|
|
@@ -5377,7 +5375,7 @@ describe("daytona native file-sync hooks", () => {
|
|
|
5377
5375
|
expect(sources).toHaveLength(2);
|
|
5378
5376
|
for (const source of sources) {
|
|
5379
5377
|
expect(source.startsWith(`${REMOTE_DIR}/`)).toBe(true);
|
|
5380
|
-
expect(path.posix.basename(source)).toMatch(/^\.
|
|
5378
|
+
expect(path.posix.basename(source)).toMatch(/^\.wardmote-upload-/);
|
|
5381
5379
|
}
|
|
5382
5380
|
expect(new Set(sources).size).toBe(sources.length);
|
|
5383
5381
|
expect(await fs.readFile(targetA, "utf8")).toBe("bytes");
|
|
@@ -5477,9 +5475,9 @@ describe("daytona native file-sync hooks", () => {
|
|
|
5477
5475
|
expect(transfer).toBeDefined();
|
|
5478
5476
|
expect(transfer.ended).toBe(true);
|
|
5479
5477
|
// One serial guard round trip before the transfer: the validate-and-snapshot.
|
|
5480
|
-
expect(transfer.attributes["
|
|
5481
|
-
expect(transfer.attributes["
|
|
5482
|
-
expect(typeof transfer.attributes["
|
|
5478
|
+
expect(transfer.attributes["wardmote.sandbox.startup.transfer.guard.count"]).toBe(1);
|
|
5479
|
+
expect(transfer.attributes["wardmote.sandbox.startup.provider"]).toBe("daytona");
|
|
5480
|
+
expect(typeof transfer.attributes["wardmote.sandbox.startup.transfer.wall_ms"]).toBe("number");
|
|
5483
5481
|
});
|
|
5484
5482
|
it("opens a transfer span around a directory-mapping download with the guard round-trip count", async () => {
|
|
5485
5483
|
const hostDir = await makeHostDir();
|
|
@@ -5517,8 +5515,8 @@ describe("daytona native file-sync hooks", () => {
|
|
|
5517
5515
|
expect(transfer.ended).toBe(true);
|
|
5518
5516
|
// Two serial guard round trips before the transfer: confinement + in-sandbox
|
|
5519
5517
|
// tar.
|
|
5520
|
-
expect(transfer.attributes["
|
|
5521
|
-
expect(typeof transfer.attributes["
|
|
5518
|
+
expect(transfer.attributes["wardmote.sandbox.startup.transfer.guard.count"]).toBe(2);
|
|
5519
|
+
expect(typeof transfer.attributes["wardmote.sandbox.startup.transfer.wall_ms"]).toBe("number");
|
|
5522
5520
|
});
|
|
5523
5521
|
});
|
|
5524
5522
|
describe("daytona manifest memory config", () => {
|