@hachej/boring-agent 0.1.46 → 0.1.48

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.
@@ -2857,6 +2857,7 @@ function fileRoutes(app, opts, done) {
2857
2857
  });
2858
2858
  }
2859
2859
  const expectedMtimeMs = typeof body.expectedMtimeMs === "number" ? body.expectedMtimeMs : null;
2860
+ const shouldReturnMtimeMs = body.returnMtimeMs !== false || expectedMtimeMs !== null;
2860
2861
  try {
2861
2862
  const workspace = await resolveWorkspace(request);
2862
2863
  if (expectedMtimeMs !== null) {
@@ -2891,6 +2892,10 @@ function fileRoutes(app, opts, done) {
2891
2892
  if (dir) await workspace.mkdir(dir, { recursive: true });
2892
2893
  }
2893
2894
  const content = body.content;
2895
+ if (!shouldReturnMtimeMs) {
2896
+ await workspace.writeFile(path4, content);
2897
+ return { ok: true };
2898
+ }
2894
2899
  const stat11 = workspace.writeFileWithStat ? await workspace.writeFileWithStat(path4, content) : await (async () => {
2895
2900
  await workspace.writeFile(path4, content);
2896
2901
  return await workspace.stat(path4);
@@ -3491,6 +3496,20 @@ function createVercelSandboxWorkspace(sandbox, workspaceOpts = {}) {
3491
3496
  `node -e ${shellQuote3(`const fs=require('fs'); const path=require('path'); const root=process.argv[1]; const relRoot=process.argv[2]; function walk(abs,rel){ const s=fs.statSync(abs); if(!s.isDirectory()) return []; const out=[]; for (const entry of fs.readdirSync(abs,{withFileTypes:true})) { const childRel=rel==='.'?entry.name:rel+'/'+entry.name; out.push(childRel); if(entry.isDirectory()) out.push(...walk(path.join(abs,entry.name),childRel)); } return out; } process.stdout.write(JSON.stringify(walk(root,relRoot)))`)} ${shellQuote3(sandboxPath)} ${shellQuote3(relPath)}`
3492
3497
  );
3493
3498
  }
3499
+ async function statSandboxPath(sandboxPath) {
3500
+ if (remote.fs?.stat) {
3501
+ const fileStat = await remote.fs.stat(sandboxPath);
3502
+ return {
3503
+ size: fileStat.size,
3504
+ mtimeMs: fileStat.mtimeMs,
3505
+ kind: fileStat.isDirectory() ? "dir" : "file"
3506
+ };
3507
+ }
3508
+ return await runJson(
3509
+ remote,
3510
+ `node -e ${shellQuote3(`const fs=require('fs'); const p=process.argv[1]; const s=fs.statSync(p); process.stdout.write(JSON.stringify({size:s.size,mtimeMs:s.mtimeMs,kind:s.isDirectory()?'dir':'file'}))`)} ${shellQuote3(sandboxPath)}`
3511
+ );
3512
+ }
3494
3513
  return {
3495
3514
  root: VERCEL_SANDBOX_RUNTIME_CONTEXT.runtimeCwd,
3496
3515
  runtimeContext: VERCEL_SANDBOX_RUNTIME_CONTEXT,
@@ -3591,7 +3610,7 @@ function createVercelSandboxWorkspace(sandbox, workspaceOpts = {}) {
3591
3610
  async writeFileWithStat(relPath, data) {
3592
3611
  const sandboxPath = toSandboxPath(relPath);
3593
3612
  const payload = Buffer.from(data, "utf-8");
3594
- if (payload.byteLength > MAX_INLINE_WRITE_BYTES) {
3613
+ if (remote.fs?.stat || payload.byteLength > MAX_INLINE_WRITE_BYTES) {
3595
3614
  await sandbox.writeFiles([
3596
3615
  {
3597
3616
  path: sandboxPath,
@@ -3600,17 +3619,7 @@ function createVercelSandboxWorkspace(sandbox, workspaceOpts = {}) {
3600
3619
  ]);
3601
3620
  invalidateMetadataCache();
3602
3621
  workspaceOpts.onMutation?.();
3603
- const writtenStat2 = remote.fs?.stat ? await (async () => {
3604
- const fileStat = await remote.fs.stat(sandboxPath);
3605
- return {
3606
- size: fileStat.size,
3607
- mtimeMs: fileStat.mtimeMs,
3608
- kind: fileStat.isDirectory() ? "dir" : "file"
3609
- };
3610
- })() : await runJson(
3611
- remote,
3612
- `node -e ${shellQuote3(`const fs=require('fs'); const p=process.argv[1]; const s=fs.statSync(p); process.stdout.write(JSON.stringify({size:s.size,mtimeMs:s.mtimeMs,kind:s.isDirectory()?'dir':'file'}))`)} ${shellQuote3(sandboxPath)}`
3613
- );
3622
+ const writtenStat2 = await statSandboxPath(sandboxPath);
3614
3623
  statCache.set(sandboxPath, writtenStat2);
3615
3624
  emitChange({ op: "write", path: relPath, mtimeMs: writtenStat2.mtimeMs });
3616
3625
  return cloneStat(writtenStat2);
@@ -3629,7 +3638,7 @@ function createVercelSandboxWorkspace(sandbox, workspaceOpts = {}) {
3629
3638
  async writeBinaryFileWithStat(relPath, data) {
3630
3639
  const sandboxPath = toSandboxPath(relPath);
3631
3640
  const payload = Buffer.from(data);
3632
- if (payload.byteLength > MAX_INLINE_WRITE_BYTES) {
3641
+ if (remote.fs?.stat || payload.byteLength > MAX_INLINE_WRITE_BYTES) {
3633
3642
  await sandbox.writeFiles([
3634
3643
  {
3635
3644
  path: sandboxPath,
@@ -3638,17 +3647,7 @@ function createVercelSandboxWorkspace(sandbox, workspaceOpts = {}) {
3638
3647
  ]);
3639
3648
  invalidateMetadataCache();
3640
3649
  workspaceOpts.onMutation?.();
3641
- const writtenStat2 = remote.fs?.stat ? await (async () => {
3642
- const fileStat = await remote.fs.stat(sandboxPath);
3643
- return {
3644
- size: fileStat.size,
3645
- mtimeMs: fileStat.mtimeMs,
3646
- kind: fileStat.isDirectory() ? "dir" : "file"
3647
- };
3648
- })() : await runJson(
3649
- remote,
3650
- `node -e ${shellQuote3(`const fs=require('fs'); const p=process.argv[1]; const s=fs.statSync(p); process.stdout.write(JSON.stringify({size:s.size,mtimeMs:s.mtimeMs,kind:s.isDirectory()?'dir':'file'}))`)} ${shellQuote3(sandboxPath)}`
3651
- );
3650
+ const writtenStat2 = await statSandboxPath(sandboxPath);
3652
3651
  statCache.set(sandboxPath, writtenStat2);
3653
3652
  emitChange({ op: "write", path: relPath, mtimeMs: writtenStat2.mtimeMs });
3654
3653
  return cloneStat(writtenStat2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hachej/boring-agent",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Pane-embeddable coding agent. Ships direct/local/vercel-sandbox execution modes behind one interface.",
@@ -74,7 +74,7 @@
74
74
  "use-stick-to-bottom": "^1.1.3",
75
75
  "yaml": "^2.8.3",
76
76
  "zod": "^3.25.76",
77
- "@hachej/boring-ui-kit": "0.1.46"
77
+ "@hachej/boring-ui-kit": "0.1.48"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@antithesishq/bombadil": "0.5.0",