intentdna 1.9.1 → 1.9.3

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.
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "name": "intentdna",
11
11
  "description": "Declarative policy layer for AI agent behavior with plugin-managed hook runtime for Claude Code.",
12
- "version": "1.9.1",
12
+ "version": "1.9.3",
13
13
  "author": {
14
14
  "name": "Samuel"
15
15
  },
@@ -25,5 +25,5 @@
25
25
  ]
26
26
  }
27
27
  ],
28
- "version": "1.9.1"
28
+ "version": "1.9.3"
29
29
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "description": "Declarative policy layer for AI agent behavior",
5
5
  "author": {
6
6
  "name": "Samuel"
@@ -255,6 +255,26 @@ function syncDirectory(path) {
255
255
  closeSync(descriptor);
256
256
  }
257
257
  }
258
+ function replaceFileSync(temporary, path) {
259
+ for (let attempt = 0;; attempt += 1) {
260
+ try {
261
+ renameSync(temporary, path);
262
+ return;
263
+ }
264
+ catch (error) {
265
+ const retryable = process.platform === "win32"
266
+ && ["EACCES", "EBUSY", "EPERM"].some((code) => isErrno(error, code));
267
+ if (!retryable || attempt >= 9) {
268
+ try {
269
+ unlinkSync(temporary);
270
+ }
271
+ catch { }
272
+ throw error;
273
+ }
274
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 25 * (attempt + 1));
275
+ }
276
+ }
277
+ }
258
278
  function atomicWriteJson(path, value) {
259
279
  const directory = dirname(path);
260
280
  const temporary = join(directory, `.${basename(path)}.tmp.${process.pid}.${randomUUID()}`);
@@ -266,7 +286,7 @@ function atomicWriteJson(path, value) {
266
286
  finally {
267
287
  closeSync(descriptor);
268
288
  }
269
- renameSync(temporary, path);
289
+ replaceFileSync(temporary, path);
270
290
  syncDirectory(directory);
271
291
  }
272
292
  function readJson(path) {
@@ -1683,7 +1703,7 @@ export class LocalAttemptExecutionAuthority {
1683
1703
  finally {
1684
1704
  closeSync(descriptor);
1685
1705
  }
1686
- renameSync(temporary, path);
1706
+ replaceFileSync(temporary, path);
1687
1707
  syncDirectory(this.rootDirectory);
1688
1708
  return next;
1689
1709
  });
@@ -19,12 +19,29 @@ if (!recordPath) process.exit(64);
19
19
 
20
20
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
21
21
  const isErrno = (error, code) => error && error.code === code;
22
+ const renameWait = new Int32Array(new SharedArrayBuffer(4));
22
23
  const canonical = (value) => {
23
24
  if (value === null || typeof value !== "object") return JSON.stringify(value);
24
25
  if (Array.isArray(value)) return "[" + value.map(canonical).join(",") + "]";
25
26
  return "{" + Object.keys(value).sort().map((key) => JSON.stringify(key) + ":" + canonical(value[key])).join(",") + "}";
26
27
  };
27
28
 
29
+ function replaceFile(temporary, target) {
30
+ for (let attempt = 0; ; attempt += 1) {
31
+ try {
32
+ fs.renameSync(temporary, target);
33
+ return;
34
+ } catch (error) {
35
+ const retryable = ["EACCES", "EBUSY", "EPERM"].some((code) => isErrno(error, code));
36
+ if (!retryable || attempt >= 9) {
37
+ try { fs.unlinkSync(temporary); } catch {}
38
+ throw error;
39
+ }
40
+ Atomics.wait(renameWait, 0, 0, 25 * (attempt + 1));
41
+ }
42
+ }
43
+ }
44
+
28
45
  function atomicWrite(target, value) {
29
46
  const directory = path.dirname(target);
30
47
  const temporary = path.join(directory, "." + path.basename(target) + ".tmp." + process.pid + "." + randomUUID());
@@ -35,7 +52,7 @@ function atomicWrite(target, value) {
35
52
  } finally {
36
53
  fs.closeSync(fd);
37
54
  }
38
- fs.renameSync(temporary, target);
55
+ replaceFile(temporary, target);
39
56
  try {
40
57
  const directoryFd = fs.openSync(directory, "r");
41
58
  try { fs.fsyncSync(directoryFd); } finally { fs.closeSync(directoryFd); }
@@ -18,9 +18,9 @@ export function createCodexExecutionProvider(options = {}) {
18
18
  "--sandbox",
19
19
  options.sandbox ?? "workspace-write",
20
20
  ...(options.extraArgs ?? []),
21
- packet.standalone_prompt,
21
+ "-",
22
22
  ],
23
- stdin: null,
23
+ stdin: packet.standalone_prompt,
24
24
  cwd: packet.workspace.working_directory,
25
25
  ...(options.env ? { env: options.env } : {}),
26
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "description": "Intent DNA — Declarative policy layer for AI agent behavior",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,7 +11,7 @@
11
11
  "dna-mcp": "dist/mcp/index.js"
12
12
  },
13
13
  "scripts": {
14
- "build": "tsc && mkdir -p dist/species dist/templates && cp src/species/*.json dist/species/ && cp src/templates/*.yaml dist/templates/ && node scripts/sync-plugin-version.cjs",
14
+ "build": "tsc && node scripts/copy-runtime-assets.mjs && node scripts/sync-plugin-version.cjs",
15
15
  "dev": "tsc --watch",
16
16
  "release:sync-plugin": "node scripts/sync-release-plugin.cjs",
17
17
  "verify:windows-job-keeper": "node scripts/verify-windows-job-keeper.mjs",