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.
- package/dist/content/flow-map.js +5 -0
- package/dist/content/hook-events.d.ts +7 -2
- package/dist/content/hook-events.js +30 -46
- package/dist/content/hook-manifest.d.ts +82 -0
- package/dist/content/hook-manifest.js +208 -0
- package/dist/content/node-hooks.js +148 -13
- package/dist/content/observe.d.ts +16 -0
- package/dist/content/observe.js +65 -120
- package/dist/internal/advance-stage.js +6 -2
- package/dist/internal/hook-manifest.d.ts +16 -0
- package/dist/internal/hook-manifest.js +77 -0
- package/dist/run-archive.js +145 -138
- package/dist/run-persistence.d.ts +13 -0
- package/dist/run-persistence.js +16 -2
- package/package.json +1 -1
|
@@ -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
|
}
|
package/dist/run-persistence.js
CHANGED
|
@@ -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
|
-
|
|
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));
|