@insmind/cli 1.5.3 → 1.5.4

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.
@@ -2,7 +2,6 @@ import { randomUUID } from "node:crypto";
2
2
  import * as nodeFileSystem from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  import { setTimeout as delay } from "node:timers/promises";
5
- import { createLocalJsonFile } from "./local-json-file.js";
6
5
  /** Local bakery lock: unique owner files avoid deleting a new owner's lock
7
6
  * when several processes simultaneously recover a dead writer. */
8
7
  export async function withFileLock(path, run, options = {}) {
@@ -56,7 +55,11 @@ export async function withFileLock(path, run, options = {}) {
56
55
  try {
57
56
  await handle.writeFile('{"ticket":null}');
58
57
  const ticket = 1 + Math.max(0, ...(await contenders()).map(owner => owner.ticket ?? 0));
59
- await createLocalJsonFile({ directory, filename: name, fileSystem }).writeTextAtomically(JSON.stringify({ ticket }));
58
+ // Empty/partial owner files already mean "choosing" to readers. Write in
59
+ // place because Windows can reject replacement while another reader is open.
60
+ await handle.truncate(0);
61
+ await handle.write(JSON.stringify({ ticket }), 0, "utf8");
62
+ await handle.close();
60
63
  for (;;) {
61
64
  if (Date.now() >= deadline)
62
65
  throw new Error("Local state lock timed out.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insmind/cli",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "insMind command-line interface for agents and people.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,8 +46,8 @@
46
46
  "@gaoding/cli": "workspace:*"
47
47
  },
48
48
  "gaodingRelease": {
49
- "sourceCommit": "916decb0fc4cc1ad4bb99fd81d14d94a0d3c6b91",
50
- "pipelineId": "192072",
51
- "pipelineUrl": "https://git.intra.gaoding.com/gtt/gaoding-cli/-/pipelines/192072"
49
+ "sourceCommit": "82935101ad55c67cdae952372fb7ae49d10a3baa",
50
+ "pipelineId": "198408",
51
+ "pipelineUrl": "https://git.intra.gaoding.com/gtt/gaoding-cli/-/pipelines/198408"
52
52
  }
53
53
  }