@lmzhen/dsh-evolution-state-json 0.3.17 → 0.3.19
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/lib/index.js +25 -4
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -2649,6 +2649,15 @@ var import_js_yaml = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((ex
|
|
|
2649
2649
|
var { Type, Schema, FAILSAFE_SCHEMA, JSON_SCHEMA, CORE_SCHEMA, DEFAULT_SCHEMA, load, loadAll, dump, YAMLException, types, safeLoad, safeLoadAll, safeDump } = import_js_yaml.default;
|
|
2650
2650
|
import_js_yaml.default;
|
|
2651
2651
|
//#endregion
|
|
2652
|
+
//#region ../evolution-core/src/state-store.ts
|
|
2653
|
+
/**
|
|
2654
|
+
* Evolution home path helper: `$DSH_HOME/evolution` for plugin-owned sidecar
|
|
2655
|
+
* state (reports, activity store, feedback file, state-domain data).
|
|
2656
|
+
*/
|
|
2657
|
+
function evolutionHome(env = process.env) {
|
|
2658
|
+
return join(env.DSH_HOME || join(homedir(), ".dsh"), "evolution");
|
|
2659
|
+
}
|
|
2660
|
+
//#endregion
|
|
2652
2661
|
//#region lib/types/index.js
|
|
2653
2662
|
/**
|
|
2654
2663
|
* JSON-file evolution state provider over the IO seam.
|
|
@@ -2660,11 +2669,8 @@ import_js_yaml.default;
|
|
|
2660
2669
|
const name = "evolution-state-json";
|
|
2661
2670
|
const inject = ["evolutionStateStorage", "evolutionIo"];
|
|
2662
2671
|
const Config = z.object({ root: z.string().default("") });
|
|
2663
|
-
function defaultRoot(env = process.env) {
|
|
2664
|
-
return join(env.DSH_HOME ?? join(homedir(), ".dsh"), "evolution");
|
|
2665
|
-
}
|
|
2666
2672
|
function apply(ctx, rawConfig) {
|
|
2667
|
-
const root = rawConfig.root ||
|
|
2673
|
+
const root = rawConfig.root || evolutionHome();
|
|
2668
2674
|
const io = () => ctx.evolutionIo.provider();
|
|
2669
2675
|
const pathOf = (file) => join(root, file);
|
|
2670
2676
|
/** 0.3.17 (E-9): a malformed state file used to parse to `null` and was then
|
|
@@ -2742,6 +2748,21 @@ function apply(ctx, rawConfig) {
|
|
|
2742
2748
|
}));
|
|
2743
2749
|
});
|
|
2744
2750
|
},
|
|
2751
|
+
async transactCuratorState(task) {
|
|
2752
|
+
await mutate(async () => {
|
|
2753
|
+
await jsonTransact("curator-state.json", (current) => {
|
|
2754
|
+
const next = task(current?.primary ?? null);
|
|
2755
|
+
if (next === null) {
|
|
2756
|
+
if (current !== null) delete current.primary;
|
|
2757
|
+
return current ?? {};
|
|
2758
|
+
}
|
|
2759
|
+
return {
|
|
2760
|
+
...current ?? {},
|
|
2761
|
+
primary: next
|
|
2762
|
+
};
|
|
2763
|
+
});
|
|
2764
|
+
});
|
|
2765
|
+
},
|
|
2745
2766
|
async listPending(status = "pending") {
|
|
2746
2767
|
return await mutate(async () => {
|
|
2747
2768
|
const map = await loadPendingMap();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-state-json",
|
|
3
3
|
"description": "JSON-file evolution state provider over the IO seam (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.19",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
39
39
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
40
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
41
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.3.
|
|
40
|
+
"@lmzhen/dsh-evolution-io": "^0.3.19",
|
|
41
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.3.19"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
45
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
46
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.3.
|
|
45
|
+
"@lmzhen/dsh-evolution-io": "^0.3.19",
|
|
46
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.3.19"
|
|
47
47
|
}
|
|
48
48
|
}
|