cclaw-cli 0.48.15 → 0.48.17

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.
@@ -11,6 +11,13 @@ export interface WriteFlowStateOptions {
11
11
  * bootstrap, or explicit recovery; never set from normal stage handlers.
12
12
  */
13
13
  allowReset?: boolean;
14
+ /**
15
+ * When true, skip the internal directory-lock acquisition. The caller
16
+ * MUST already hold `flowStateLockPath(projectRoot)` for the duration
17
+ * of this call. Used by run-archive to keep the full archive +
18
+ * flow-state reset inside one atomic lock window.
19
+ */
20
+ skipLock?: boolean;
14
21
  }
15
22
  export interface ReadFlowStateOptions {
16
23
  /**
@@ -26,6 +33,12 @@ export declare class CorruptFlowStateError extends Error {
26
33
  }
27
34
  export declare function readFlowState(projectRoot: string, options?: ReadFlowStateOptions): Promise<FlowState>;
28
35
  export declare function writeFlowState(projectRoot: string, state: FlowState, options?: WriteFlowStateOptions): Promise<void>;
36
+ /**
37
+ * Exposed path helper so callers that need to serialize a multi-step
38
+ * state operation with flow-state writes (e.g. run archival) can
39
+ * acquire the SAME lock directory used internally by `writeFlowState`.
40
+ */
41
+ export declare function flowStateLockPathFor(projectRoot: string): string;
29
42
  interface EnsureRunSystemOptions {
30
43
  createIfMissing?: boolean;
31
44
  }
@@ -362,7 +362,7 @@ export async function readFlowState(projectRoot, options = {}) {
362
362
  }
363
363
  export async function writeFlowState(projectRoot, state, options = {}) {
364
364
  await ensureFeatureSystem(projectRoot);
365
- await withDirectoryLock(flowStateLockPath(projectRoot), async () => {
365
+ const doWrite = async () => {
366
366
  const statePath = flowStatePath(projectRoot);
367
367
  if (!options.allowReset && (await exists(statePath))) {
368
368
  try {
@@ -382,9 +382,23 @@ export async function writeFlowState(projectRoot, state, options = {}) {
382
382
  }
383
383
  const safe = coerceFlowState({ ...state });
384
384
  await writeFileSafe(statePath, `${JSON.stringify(safe, null, 2)}\n`, { mode: 0o600 });
385
- });
385
+ };
386
+ if (options.skipLock) {
387
+ await doWrite();
388
+ }
389
+ else {
390
+ await withDirectoryLock(flowStateLockPath(projectRoot), doWrite);
391
+ }
386
392
  await syncActiveFeatureSnapshot(projectRoot);
387
393
  }
394
+ /**
395
+ * Exposed path helper so callers that need to serialize a multi-step
396
+ * state operation with flow-state writes (e.g. run archival) can
397
+ * acquire the SAME lock directory used internally by `writeFlowState`.
398
+ */
399
+ export function flowStateLockPathFor(projectRoot) {
400
+ return flowStateLockPath(projectRoot);
401
+ }
388
402
  export async function ensureRunSystem(projectRoot, _options = {}) {
389
403
  await ensureFeatureSystem(projectRoot);
390
404
  await ensureDir(runsRoot(projectRoot));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cclaw-cli",
3
- "version": "0.48.15",
3
+ "version": "0.48.17",
4
4
  "description": "Installer-first flow toolkit for coding agents",
5
5
  "type": "module",
6
6
  "bin": {