@agent-device/proxy 0.21.40-nightly.20261119.188 → 0.21.40

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.
Files changed (2) hide show
  1. package/dist/process.mjs +20 -2
  2. package/package.json +3 -3
package/dist/process.mjs CHANGED
@@ -1365,10 +1365,28 @@ function gracefulSignalFor(record) {
1365
1365
  //#region ../host-kit/src/internal/atomic-file.ts
1366
1366
  /**
1367
1367
  * The canonical temp path for a destination: a sibling of the name, inside the directory the publish will
1368
- * create the entry in — the walk's answer for a script destination, `path.dirname` for every other one.
1368
+ * create the entry in — the walk's answer for a script destination, `path.dirname` for every other one. Its
1369
+ * name stays bounded whatever the destination's length, so any name that fits the filesystem has a temp
1370
+ * sibling that fits too.
1369
1371
  */
1370
1372
  function createAtomicPublishTempPath(directory, destination) {
1371
- return path.join(directory, `.${path.basename(destination)}.${process.pid}-${crypto.randomUUID()}.tmp`);
1373
+ return path.join(directory, `${temporaryNamePrefix(destination)}${process.pid}-${crypto.randomBytes(8).toString("hex")}.tmp`);
1374
+ }
1375
+ /** How many bytes of the destination's name a temp sibling repeats, so a reader can still tell whose it is. */
1376
+ const TEMP_NAME_STEM_BYTES = 32;
1377
+ /**
1378
+ * The start every temp sibling of `destination` shares, and no other destination's: at most 32 bytes of its
1379
+ * name for a reader, then a hash of the WHOLE name, so two names that share their first bytes never share it.
1380
+ */
1381
+ function temporaryNamePrefix(destination) {
1382
+ const name = path.basename(destination);
1383
+ let stem = "";
1384
+ for (const character of name) {
1385
+ if (Buffer.byteLength(stem + character) > TEMP_NAME_STEM_BYTES) break;
1386
+ stem += character;
1387
+ }
1388
+ const digest = crypto.createHash("sha256").update(name).digest("hex").slice(0, 16);
1389
+ return `.${stem}.${digest}.`;
1372
1390
  }
1373
1391
  function removeTempBestEffort(destination, temporaryPath) {
1374
1392
  if (temporaryPath === void 0) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-device/proxy",
3
- "version": "0.21.40-nightly.20261119.188",
3
+ "version": "0.21.40",
4
4
  "type": "module",
5
5
  "description": "Transport-neutral authenticating proxy in front of an agent-device daemon.",
6
6
  "license": "MIT",
@@ -25,9 +25,9 @@
25
25
  "dist"
26
26
  ],
27
27
  "devDependencies": {
28
- "@agent-device/contracts": "0.0.0",
29
28
  "@agent-device/host-kit": "0.0.0",
30
- "@agent-device/kernel": "0.0.0"
29
+ "@agent-device/kernel": "0.0.0",
30
+ "@agent-device/contracts": "0.0.0"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "tsdown --config tsdown.config.ts"