@lmzhen/dsh-evolution-state-storage 0.3.24 → 0.3.25
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 +1 -23
- package/lib/types/index.d.ts +6 -11
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -8,15 +8,6 @@ import { Service } from "@deepseek-ai/cordis";
|
|
|
8
8
|
* (IO-seam files) are the two shipped providers.
|
|
9
9
|
* @module @lmzhen/dsh-evolution-state-storage
|
|
10
10
|
*/
|
|
11
|
-
/** 0.3.17 (S3.3, E-24): 'executing' = claimed, runner in flight — a fresh
|
|
12
|
-
* claim only takes 'pending', and resolve accepts 'pending'/'executing', so a
|
|
13
|
-
* crash mid-approve can never double-execute the runner. */
|
|
14
|
-
const PENDING_STATUSES = [
|
|
15
|
-
"pending",
|
|
16
|
-
"executing",
|
|
17
|
-
"approved",
|
|
18
|
-
"rejected"
|
|
19
|
-
];
|
|
20
11
|
/** 0.3.17 (S3.3): the claim lifecycle as ONE transition table — BOTH
|
|
21
12
|
* providers (json/domain) must use these, never a hand-written copy (a second
|
|
22
13
|
* copy is exactly the E-10 drift class). */
|
|
@@ -25,19 +16,6 @@ const canResolvePending = (status) => status === "pending" || status === "execut
|
|
|
25
16
|
/** Releasing a claim on an executing record rolls it back to pending (a
|
|
26
17
|
* runner FAILURE is retryable); other statuses pass through unchanged. */
|
|
27
18
|
const releasedStatus = (status) => status === "executing" ? "pending" : status;
|
|
28
|
-
/**
|
|
29
|
-
* Claim lifecycle (S3.3): pending →(claim)→ executing →(resolve)→ approved/rejected.
|
|
30
|
-
* release() rolls executing back to pending (failure path). A crash between
|
|
31
|
-
* the runner execution and the resolve leaves the record executing+claimed:
|
|
32
|
-
* until expiry another claim is refused (no double execution), and after
|
|
33
|
-
* expiry only the operator acts — approval NEVER auto-replays an executing
|
|
34
|
-
* record (the write may already have landed; a non-idempotent replay would
|
|
35
|
-
* duplicate it). Operator options: reject (cleanup, no runner) or release +
|
|
36
|
-
* re-stage after manual verification. Release command surface is deferred.
|
|
37
|
-
*/
|
|
38
|
-
/** 0.3.17 (E-75): claim expiry single source — both providers (json/domain)
|
|
39
|
-
* previously hardcoded `10 * 60_000` independently. */
|
|
40
|
-
const CLAIM_EXPIRY_MS = 10 * 6e4;
|
|
41
19
|
var EvolutionStateStorageRegistry = class extends Service {
|
|
42
20
|
providers = /* @__PURE__ */ new Map();
|
|
43
21
|
constructor(ctx) {
|
|
@@ -62,4 +40,4 @@ var EvolutionStateStorageRegistry = class extends Service {
|
|
|
62
40
|
}
|
|
63
41
|
};
|
|
64
42
|
//#endregion
|
|
65
|
-
export {
|
|
43
|
+
export { EvolutionStateStorageRegistry, EvolutionStateStorageRegistry as default, canClaimPending, canResolvePending, releasedStatus };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -14,8 +14,7 @@ export type PendingKind = 'memory' | 'skill' | 'capability';
|
|
|
14
14
|
/** 0.3.17 (S3.3, E-24): 'executing' = claimed, runner in flight — a fresh
|
|
15
15
|
* claim only takes 'pending', and resolve accepts 'pending'/'executing', so a
|
|
16
16
|
* crash mid-approve can never double-execute the runner. */
|
|
17
|
-
export
|
|
18
|
-
export type PendingStatus = (typeof PENDING_STATUSES)[number];
|
|
17
|
+
export type PendingStatus = 'pending' | 'executing' | 'approved' | 'rejected';
|
|
19
18
|
/** 0.3.17 (S3.3): the claim lifecycle as ONE transition table — BOTH
|
|
20
19
|
* providers (json/domain) must use these, never a hand-written copy (a second
|
|
21
20
|
* copy is exactly the E-10 drift class). */
|
|
@@ -27,16 +26,12 @@ export declare const releasedStatus: (status: PendingStatus) => PendingStatus;
|
|
|
27
26
|
/**
|
|
28
27
|
* Claim lifecycle (S3.3): pending →(claim)→ executing →(resolve)→ approved/rejected.
|
|
29
28
|
* release() rolls executing back to pending (failure path). A crash between
|
|
30
|
-
* the runner execution and the resolve leaves the record executing+claimed
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* record (
|
|
34
|
-
*
|
|
35
|
-
* re-stage after manual verification. Release command surface is deferred.
|
|
29
|
+
* the runner execution and the resolve leaves the record executing+claimed,
|
|
30
|
+
* and NO later claim is ever accepted (claim only takes pending, so a crashed
|
|
31
|
+
* approve can never double-execute a non-idempotent runner). Only the operator
|
|
32
|
+
* acts on such a record: reject (cleanup, no runner) or release + re-stage
|
|
33
|
+
* after manual verification. Release command surface is deferred.
|
|
36
34
|
*/
|
|
37
|
-
/** 0.3.17 (E-75): claim expiry single source — both providers (json/domain)
|
|
38
|
-
* previously hardcoded `10 * 60_000` independently. */
|
|
39
|
-
export declare const CLAIM_EXPIRY_MS: number;
|
|
40
35
|
export interface ReviewStateRecord {
|
|
41
36
|
turnsSinceMemory: number;
|
|
42
37
|
turnsSinceSkill: number;
|