@astrosheep/keiyaku 2.9.2 → 2.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.
@@ -25,7 +25,7 @@ export const ENV_KEYS = {
25
25
  const ENV_KEY_ENTRIES = [
26
26
  { key: ENV_KEYS.AGENT_OVERRIDE, defaultValue: "", description: "Override default agent name", category: "subagent" },
27
27
  { key: ENV_KEYS.DISABLE_SUBAGENT_SPAWN, defaultValue: "0", description: "Disable subprocess subagent spawning when set to 1", category: "subagent" },
28
- { key: ENV_KEYS.SUBAGENT_EXEC_IDLE_TIMEOUT_MS, defaultValue: "600000", description: "Subagent idle timeout in milliseconds", category: "subagent" },
28
+ { key: ENV_KEYS.SUBAGENT_EXEC_IDLE_TIMEOUT_MS, defaultValue: "120000", description: "Subagent provider-ingress idle timeout in milliseconds", category: "subagent" },
29
29
  { key: ENV_KEYS.CODEX_EXEC_MAX_CAPTURE_CHARS, defaultValue: "200000", description: "Codex runtime output/diagnostics capture cap", category: "subagent" },
30
30
  { key: ENV_KEYS.CLAUDE_EXEC_MAX_CAPTURE_CHARS, defaultValue: "200000", description: "Claude runtime output/diagnostics capture cap", category: "subagent" },
31
31
  { key: ENV_KEYS.OPENCODE_EXEC_MAX_CAPTURE_CHARS, defaultValue: "200000", description: "OpenCode runtime output/diagnostics capture cap", category: "subagent" },
@@ -1,6 +1,7 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import * as path from "node:path";
3
3
  import { FlowError } from "../flow-error.js";
4
+ import { syncDirectory } from "../fs/durability.js";
4
5
  import { createGit, errorContainsAnyPattern, MISSING_HEAD_PATTERNS, wrapGitError } from "../git/core.js";
5
6
  import { readLedger } from "./ledger.js";
6
7
  import { shortCommitHash } from "../git/commits.js";
@@ -28,13 +29,7 @@ async function appendClaimReceipt(cwd, receipt, restoreIfMissing = "") {
28
29
  finally {
29
30
  await handle.close();
30
31
  }
31
- const directory = await fs.open(path.dirname(receiptPath), "r");
32
- try {
33
- await directory.sync();
34
- }
35
- finally {
36
- await directory.close();
37
- }
32
+ await syncDirectory(path.dirname(receiptPath));
38
33
  }
39
34
  export async function resolveCommit(cwd, rev) {
40
35
  const git = createGit(cwd);
@@ -1,6 +1,7 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
3
  import { isErrnoException } from "../errno.js";
4
+ import { syncDirectorySync } from "../fs/durability.js";
4
5
  import { ProjectionStateError, randomHex8 } from "./atomic-publish.js";
5
6
  import { projectionCoordinateRoot } from "./projection-coordinate.js";
6
7
  import { isProjectionId } from "./projection-core.js";
@@ -107,13 +108,7 @@ export function moveProjectionAlias(cwd, alias, id) {
107
108
  if (!temp)
108
109
  throw new ProjectionStateError(`failed to create projection alias temp: ${target}`);
109
110
  fs.renameSync(temp, target);
110
- const directoryFd = fs.openSync(root, fs.constants.O_RDONLY);
111
- try {
112
- fs.fsyncSync(directoryFd);
113
- }
114
- finally {
115
- fs.closeSync(directoryFd);
116
- }
111
+ syncDirectorySync(root);
117
112
  }
118
113
  finally {
119
114
  if (temp)
@@ -4,6 +4,7 @@ import * as fs from "node:fs";
4
4
  import * as path from "node:path";
5
5
  import { DatabaseSync } from "node:sqlite";
6
6
  import { FlowError } from "../flow-error.js";
7
+ import { syncDirectorySync } from "../fs/durability.js";
7
8
  import { isGitExecutableUnavailable, NOT_GIT_REPOSITORY_PATTERNS } from "../git/core.js";
8
9
  import { gitCommonRootPath, normalizeGitPath } from "./path-coordinate.js";
9
10
  const TASK_ID = /^k-[0-9a-f]{12}$/;
@@ -177,7 +178,7 @@ export function atomicReplaceTaskFile(filePath, text, _deps) {
177
178
  fs.closeSync(descriptor);
178
179
  descriptor = undefined;
179
180
  fs.renameSync(temporary, filePath);
180
- fsyncDirectory(directory);
181
+ syncDirectorySync(directory);
181
182
  }
182
183
  catch (error) {
183
184
  if (descriptor !== undefined) {
@@ -193,15 +194,6 @@ export function atomicReplaceTaskFile(filePath, text, _deps) {
193
194
  throw error;
194
195
  }
195
196
  }
196
- function fsyncDirectory(directory) {
197
- const descriptor = fs.openSync(directory, fs.constants.O_RDONLY);
198
- try {
199
- fs.fsyncSync(descriptor);
200
- }
201
- finally {
202
- fs.closeSync(descriptor);
203
- }
204
- }
205
197
  function lstatIfPresent(target) {
206
198
  try {
207
199
  return fs.lstatSync(target);
@@ -276,7 +268,7 @@ function sameSources(left, right) {
276
268
  function removeTaskFile(filePath) {
277
269
  try {
278
270
  fs.unlinkSync(filePath);
279
- fsyncDirectory(path.dirname(filePath));
271
+ syncDirectorySync(path.dirname(filePath));
280
272
  }
281
273
  catch (error) {
282
274
  if (error.code !== "ENOENT")
@@ -0,0 +1,27 @@
1
+ import * as fs from "node:fs";
2
+ import * as fsPromises from "node:fs/promises";
3
+ export function supportsDirectorySync(platform = process.platform) {
4
+ return platform !== "win32";
5
+ }
6
+ export function syncDirectorySync(directory, platform = process.platform) {
7
+ if (!supportsDirectorySync(platform))
8
+ return;
9
+ const descriptor = fs.openSync(directory, fs.constants.O_RDONLY);
10
+ try {
11
+ fs.fsyncSync(descriptor);
12
+ }
13
+ finally {
14
+ fs.closeSync(descriptor);
15
+ }
16
+ }
17
+ export async function syncDirectory(directory, platform = process.platform) {
18
+ if (!supportsDirectorySync(platform))
19
+ return;
20
+ const handle = await fsPromises.open(directory, "r");
21
+ try {
22
+ await handle.sync();
23
+ }
24
+ finally {
25
+ await handle.close();
26
+ }
27
+ }
@@ -1,2 +1,2 @@
1
1
  // Auto-generated by scripts/generate-version.mjs
2
- export const VERSION = "2.9.1";
2
+ export const VERSION = "2.9.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/keiyaku",
3
- "version": "2.9.2",
3
+ "version": "2.9.3",
4
4
  "description": "CLI for running iterative keiyaku workflows with Codex subagents.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,3 +46,4 @@ keiyaku status # forgot an id? it's on the board
46
46
  - `--incognito` — no artifact written, no revive possible (call)
47
47
  - `--effort LEVEL` — provider effort override; needs a model set (call, revive, tell)
48
48
  - `-C DIR` — run relative to another directory (all akuma commands)
49
+ - `--repo DIR` — you almost never need this: the repo is inferred from where you stand (`-C` included). Only for the rare case where the contract ledger lives in a *different* repo. Never pass it the same value as `-C`.
@@ -31,7 +31,8 @@ keiyaku petition <<'EOF'
31
31
  ## Oath
32
32
  I made the pump test pass; ran the suite, all green.
33
33
  EOF
34
- # petition seals your work and runs the settlement pipeline itself
34
+ # petition seals your work (a seal = your commits + intent frozen into one
35
+ # reviewable unit; arc and renew also seal) and runs the settlement pipeline —
35
36
  # passes → claimed (merged to main); a gate fails → fix, petition again.
36
37
  # The oath is required (OATH_MISSING otherwise) and checked for presence, not content.
37
38
  ```