@lmzhen/dsh-evolution-core 0.59.1 → 0.59.3
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/authority-plugin.js +7 -4
- package/lib/{extract-plan-BxDhKSki.js → extract-plan-D3ALlAmN.js} +2 -2
- package/lib/extract.js +4 -4
- package/lib/index.js +9 -9
- package/lib/io-node.js +1 -1
- package/lib/{mutation-authority-Du-ON0NY.js → mutation-authority-CZpc9F20.js} +222 -4
- package/lib/{mutation-storage-adapter-7R3ra0wj.js → mutation-storage-adapter-z1_hyrQn.js} +10 -6
- package/lib/{mutations-mvTnWkua.js → mutations-Y-wKod7W.js} +2 -2
- package/lib/{quality-CREp6s1G.js → quality-NPGr3VzA.js} +3 -3
- package/lib/{review-context-CW_kJAzn.js → review-context-yNiZadPw.js} +1 -1
- package/lib/{skill-history-YX84wO20.js → skill-history-BvLWFoOo.js} +2 -2
- package/lib/skills.js +1023 -189
- package/lib/types/authority-plugin.d.ts +7 -1
- package/lib/types/authority-plugin.js +10 -2
- package/lib/types/authority.d.ts +49 -0
- package/lib/types/authority.js +194 -0
- package/lib/types/events.d.ts +2 -0
- package/lib/types/mutation-authority.d.ts +31 -2
- package/lib/types/mutation-authority.js +45 -1
- package/lib/types/mutation-unit.d.ts +23 -1
- package/lib/types/mutation-unit.js +7 -3
- package/lib/types/skill-observation-source.d.ts +26 -0
- package/lib/types/skill-observation-source.js +56 -0
- package/lib/types/skill-observation.d.ts +87 -0
- package/lib/types/skill-observation.js +110 -0
- package/lib/types/skill-root-gate.d.ts +40 -0
- package/lib/types/skill-root-gate.js +98 -0
- package/lib/types/skill-store.d.ts +22 -3
- package/lib/types/skill-store.js +437 -217
- package/lib/types/skill-target-locks.d.ts +39 -0
- package/lib/types/skill-target-locks.js +64 -0
- package/lib/types/skill-write-intent.d.ts +63 -0
- package/lib/types/skill-write-intent.js +104 -0
- package/lib/types/skill-write-service.d.ts +85 -0
- package/lib/types/skill-write-service.js +180 -0
- package/lib/types/skills.d.ts +6 -0
- package/lib/types/skills.js +6 -0
- package/lib/{usage-DrczLTP4.js → usage-D7yHG2Cb.js} +2 -2
- package/lib/write.js +3 -3
- package/package.json +3 -3
- package/lib/{io-GxghO3Ip.js → io-Cpa8wuvj.js} +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** The skill content version used by all observations and write intents. */
|
|
2
|
+
/**
|
|
3
|
+
* The freshness token an observation carries.
|
|
4
|
+
*
|
|
5
|
+
* The source decides its basis: the platform `fs` edge uses its opaque
|
|
6
|
+
* `FsVersion`, while a path that has the full canonical bytes may use a
|
|
7
|
+
* content version. The store never reinterprets the token, so the same
|
|
8
|
+
* observation cannot silently change meaning between read and write.
|
|
9
|
+
*/
|
|
10
|
+
export type SkillObservedVersion = string;
|
|
11
|
+
/** The content identity used by semantic anchors (staged snapshots, history). */
|
|
12
|
+
export type SkillContentVersion = string;
|
|
13
|
+
/**
|
|
14
|
+
* One skill file a write can target.
|
|
15
|
+
*
|
|
16
|
+
* `relPath` is empty for `SKILL.md` and a normalized support-file path
|
|
17
|
+
* otherwise. `targetKey` is the canonical identity used by the observation
|
|
18
|
+
* store and later by per-target locks, so two spellings of the same path
|
|
19
|
+
* cannot observe one file and write another.
|
|
20
|
+
*/
|
|
21
|
+
export interface SkillTarget {
|
|
22
|
+
readonly skill: string;
|
|
23
|
+
readonly relPath: string;
|
|
24
|
+
readonly targetKey: string;
|
|
25
|
+
}
|
|
26
|
+
/** One authoritative read observation. */
|
|
27
|
+
export type SkillObservation = {
|
|
28
|
+
readonly kind: 'present';
|
|
29
|
+
readonly version: SkillObservedVersion;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: 'absent';
|
|
32
|
+
};
|
|
33
|
+
/** Any object with stable identity: a session, a review task, a run handle. */
|
|
34
|
+
export type SkillObservationOwner = object;
|
|
35
|
+
/** Why a target observation is unavailable. */
|
|
36
|
+
export type SkillObservationRefusal = {
|
|
37
|
+
readonly kind: 'unobserved';
|
|
38
|
+
} | {
|
|
39
|
+
readonly kind: 'absent';
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Canonical target key. Skill names are trimmed; support paths are slash
|
|
43
|
+
* normalized and collapsed. The key is never a filesystem path, so it cannot
|
|
44
|
+
* leak a host-specific separator into persistence or diagnostics.
|
|
45
|
+
* @param skill - raw skill name supplied by a caller.
|
|
46
|
+
* @param relPath - empty for SKILL.md, otherwise the support-file path.
|
|
47
|
+
* @returns the normalized target.
|
|
48
|
+
*/
|
|
49
|
+
export declare function skillTarget(skill: string, relPath?: string): SkillTarget;
|
|
50
|
+
/** The namespace lock key covering every file of one skill. */
|
|
51
|
+
export declare function skillNamespaceKey(skill: string): string;
|
|
52
|
+
/** The SKILL.md target of one skill. */
|
|
53
|
+
export declare function skillBodyTarget(skill: string): SkillTarget;
|
|
54
|
+
/** One support-file target of one skill. */
|
|
55
|
+
export declare function skillSupportTarget(skill: string, relPath: string): SkillTarget;
|
|
56
|
+
/** Derive the version a write must observe for these current bytes. */
|
|
57
|
+
export declare function skillVersionOf(content: string): SkillContentVersion;
|
|
58
|
+
/**
|
|
59
|
+
* Per-owner observation state. A WeakMap owner key keeps a collected session or
|
|
60
|
+
* review task from retaining its reads; disposal blocks HMR from carrying stale
|
|
61
|
+
* observations into a new implementation generation.
|
|
62
|
+
*/
|
|
63
|
+
export declare class SkillObservationStore {
|
|
64
|
+
private byOwner;
|
|
65
|
+
/**
|
|
66
|
+
* Record one successful read observation.
|
|
67
|
+
* @param owner - exact reading identity; never a shared global.
|
|
68
|
+
* @param target - the read target.
|
|
69
|
+
* @param observation - `present` with the read version, or `absent`.
|
|
70
|
+
*/
|
|
71
|
+
record(owner: SkillObservationOwner, target: SkillTarget, observation: SkillObservation): void;
|
|
72
|
+
/**
|
|
73
|
+
* Read the newest observation for one owner/target.
|
|
74
|
+
* @returns the observation, or `undefined` when this owner never read it.
|
|
75
|
+
*/
|
|
76
|
+
get(owner: SkillObservationOwner, target: SkillTarget): SkillObservation | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Resolve the observation a writer may rely on.
|
|
79
|
+
* @returns the present version, or the refusal that names why it is unusable.
|
|
80
|
+
*/
|
|
81
|
+
requirePresent(owner: SkillObservationOwner, target: SkillTarget): {
|
|
82
|
+
readonly version: SkillObservedVersion;
|
|
83
|
+
} | SkillObservationRefusal;
|
|
84
|
+
/** Drop every observation, e.g. on plugin disposal or HMR. */
|
|
85
|
+
clear(): void;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=skill-observation.d.ts.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill write observation: the domain-level counterpart of platform
|
|
3
|
+
* `fs-observation-policy`.
|
|
4
|
+
*
|
|
5
|
+
* A successful read records `present(version)` or `absent` for one owner
|
|
6
|
+
* (session / review task / run identity) and one target. Writes later derive
|
|
7
|
+
* their expected version from this store; observations never cross owners.
|
|
8
|
+
*
|
|
9
|
+
* This module is intentionally dependency-free and has no enforcement: Phase A
|
|
10
|
+
* only collects observations. The SkillWriteService switches writes onto them
|
|
11
|
+
* in a later phase, so existing behavior cannot change from this file alone.
|
|
12
|
+
*
|
|
13
|
+
* @module @lmzhen/dsh-evolution-core/skill-observation
|
|
14
|
+
*/
|
|
15
|
+
import { contentHash } from "./mutations.js";
|
|
16
|
+
/**
|
|
17
|
+
* Canonical target key. Skill names are trimmed; support paths are slash
|
|
18
|
+
* normalized and collapsed. The key is never a filesystem path, so it cannot
|
|
19
|
+
* leak a host-specific separator into persistence or diagnostics.
|
|
20
|
+
* @param skill - raw skill name supplied by a caller.
|
|
21
|
+
* @param relPath - empty for SKILL.md, otherwise the support-file path.
|
|
22
|
+
* @returns the normalized target.
|
|
23
|
+
*/
|
|
24
|
+
export function skillTarget(skill, relPath = '') {
|
|
25
|
+
const name = skill.trim();
|
|
26
|
+
if (name === '')
|
|
27
|
+
throw new Error('skillTarget requires a skill name');
|
|
28
|
+
const rel = normalizeRelPath(relPath);
|
|
29
|
+
const targetKey = name + '::' + rel;
|
|
30
|
+
return { skill: name, relPath: rel, targetKey };
|
|
31
|
+
}
|
|
32
|
+
/** The namespace lock key covering every file of one skill. */
|
|
33
|
+
export function skillNamespaceKey(skill) {
|
|
34
|
+
const name = skill.trim();
|
|
35
|
+
if (name === '')
|
|
36
|
+
throw new Error('skillNamespaceKey requires a skill name');
|
|
37
|
+
return 'skill::' + name + '::*';
|
|
38
|
+
}
|
|
39
|
+
/** The SKILL.md target of one skill. */
|
|
40
|
+
export function skillBodyTarget(skill) {
|
|
41
|
+
return skillTarget(skill, '');
|
|
42
|
+
}
|
|
43
|
+
/** One support-file target of one skill. */
|
|
44
|
+
export function skillSupportTarget(skill, relPath) {
|
|
45
|
+
if (normalizeRelPath(relPath) === '') {
|
|
46
|
+
throw new Error('skillSupportTarget requires a non-empty support path');
|
|
47
|
+
}
|
|
48
|
+
return skillTarget(skill, relPath);
|
|
49
|
+
}
|
|
50
|
+
/** Derive the version a write must observe for these current bytes. */
|
|
51
|
+
export function skillVersionOf(content) {
|
|
52
|
+
return contentHash(content);
|
|
53
|
+
}
|
|
54
|
+
/** Normalize a support path to forward slashes, without leading/trailing ones. */
|
|
55
|
+
function normalizeRelPath(relPath) {
|
|
56
|
+
const slashed = relPath.replaceAll('\\', '/');
|
|
57
|
+
if (slashed.startsWith('/') || /^[A-Za-z]:/.test(slashed)) {
|
|
58
|
+
throw new Error('skill support paths must be relative');
|
|
59
|
+
}
|
|
60
|
+
const parts = slashed.split('/');
|
|
61
|
+
if (parts.includes('..'))
|
|
62
|
+
throw new Error('skill support paths must not contain ".."');
|
|
63
|
+
return parts.filter(part => part !== '' && part !== '.').join('/');
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Per-owner observation state. A WeakMap owner key keeps a collected session or
|
|
67
|
+
* review task from retaining its reads; disposal blocks HMR from carrying stale
|
|
68
|
+
* observations into a new implementation generation.
|
|
69
|
+
*/
|
|
70
|
+
export class SkillObservationStore {
|
|
71
|
+
byOwner = new WeakMap();
|
|
72
|
+
/**
|
|
73
|
+
* Record one successful read observation.
|
|
74
|
+
* @param owner - exact reading identity; never a shared global.
|
|
75
|
+
* @param target - the read target.
|
|
76
|
+
* @param observation - `present` with the read version, or `absent`.
|
|
77
|
+
*/
|
|
78
|
+
record(owner, target, observation) {
|
|
79
|
+
let reads = this.byOwner.get(owner);
|
|
80
|
+
if (reads === undefined) {
|
|
81
|
+
reads = new Map();
|
|
82
|
+
this.byOwner.set(owner, reads);
|
|
83
|
+
}
|
|
84
|
+
reads.set(target.targetKey, observation);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Read the newest observation for one owner/target.
|
|
88
|
+
* @returns the observation, or `undefined` when this owner never read it.
|
|
89
|
+
*/
|
|
90
|
+
get(owner, target) {
|
|
91
|
+
return this.byOwner.get(owner)?.get(target.targetKey);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Resolve the observation a writer may rely on.
|
|
95
|
+
* @returns the present version, or the refusal that names why it is unusable.
|
|
96
|
+
*/
|
|
97
|
+
requirePresent(owner, target) {
|
|
98
|
+
const observation = this.get(owner, target);
|
|
99
|
+
if (observation === undefined)
|
|
100
|
+
return { kind: 'unobserved' };
|
|
101
|
+
if (observation.kind === 'absent')
|
|
102
|
+
return { kind: 'absent' };
|
|
103
|
+
return { version: observation.version };
|
|
104
|
+
}
|
|
105
|
+
/** Drop every observation, e.g. on plugin disposal or HMR. */
|
|
106
|
+
clear() {
|
|
107
|
+
this.byOwner = new WeakMap();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=skill-observation.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Root-level shared/exclusive gate for skill-tree operations.
|
|
3
|
+
*
|
|
4
|
+
* Single-file writes only need the tree to stay structurally stable: they can
|
|
5
|
+
* run under a shared lease plus their per-target lock. Structural operations
|
|
6
|
+
* (archive/restore/consolidate) move or replace whole trees and need an
|
|
7
|
+
* exclusive lease. This gate replaces the implicit "every write is exclusive"
|
|
8
|
+
* per-root serial queue without changing the mutation primitives.
|
|
9
|
+
*
|
|
10
|
+
* The gate is deliberately non-reentrant: a holder must not call read/write
|
|
11
|
+
* again from inside its own section (the queue has no ownership token).
|
|
12
|
+
*
|
|
13
|
+
* @module @lmzhen/dsh-evolution-core/skill-root-gate
|
|
14
|
+
*/
|
|
15
|
+
/** A fair-ish shared/exclusive gate. */
|
|
16
|
+
export declare class SkillRootGate {
|
|
17
|
+
private readers;
|
|
18
|
+
private writer;
|
|
19
|
+
private queue;
|
|
20
|
+
/**
|
|
21
|
+
* Run a task under a shared lease.
|
|
22
|
+
* @param task - a single-file mutation that only needs tree stability.
|
|
23
|
+
* @returns the task's value.
|
|
24
|
+
*/
|
|
25
|
+
read<T>(task: () => Promise<T>): Promise<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Run a task under an exclusive lease.
|
|
28
|
+
* @param task - a structural mutation that moves/replaces whole trees.
|
|
29
|
+
* @returns the task's value.
|
|
30
|
+
*/
|
|
31
|
+
write<T>(task: () => Promise<T>): Promise<T>;
|
|
32
|
+
/** Active shared holders, for leak assertions. */
|
|
33
|
+
get readerCount(): number;
|
|
34
|
+
/** Whether an exclusive holder is active. */
|
|
35
|
+
get writerActive(): boolean;
|
|
36
|
+
private acquire;
|
|
37
|
+
private release;
|
|
38
|
+
private drain;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=skill-root-gate.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Root-level shared/exclusive gate for skill-tree operations.
|
|
3
|
+
*
|
|
4
|
+
* Single-file writes only need the tree to stay structurally stable: they can
|
|
5
|
+
* run under a shared lease plus their per-target lock. Structural operations
|
|
6
|
+
* (archive/restore/consolidate) move or replace whole trees and need an
|
|
7
|
+
* exclusive lease. This gate replaces the implicit "every write is exclusive"
|
|
8
|
+
* per-root serial queue without changing the mutation primitives.
|
|
9
|
+
*
|
|
10
|
+
* The gate is deliberately non-reentrant: a holder must not call read/write
|
|
11
|
+
* again from inside its own section (the queue has no ownership token).
|
|
12
|
+
*
|
|
13
|
+
* @module @lmzhen/dsh-evolution-core/skill-root-gate
|
|
14
|
+
*/
|
|
15
|
+
/** A fair-ish shared/exclusive gate. */
|
|
16
|
+
export class SkillRootGate {
|
|
17
|
+
readers = 0;
|
|
18
|
+
writer = false;
|
|
19
|
+
queue = [];
|
|
20
|
+
/**
|
|
21
|
+
* Run a task under a shared lease.
|
|
22
|
+
* @param task - a single-file mutation that only needs tree stability.
|
|
23
|
+
* @returns the task's value.
|
|
24
|
+
*/
|
|
25
|
+
async read(task) {
|
|
26
|
+
await this.acquire(false);
|
|
27
|
+
try {
|
|
28
|
+
return await task();
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
this.release(false);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Run a task under an exclusive lease.
|
|
36
|
+
* @param task - a structural mutation that moves/replaces whole trees.
|
|
37
|
+
* @returns the task's value.
|
|
38
|
+
*/
|
|
39
|
+
async write(task) {
|
|
40
|
+
await this.acquire(true);
|
|
41
|
+
try {
|
|
42
|
+
return await task();
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
this.release(true);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Active shared holders, for leak assertions. */
|
|
49
|
+
get readerCount() {
|
|
50
|
+
return this.readers;
|
|
51
|
+
}
|
|
52
|
+
/** Whether an exclusive holder is active. */
|
|
53
|
+
get writerActive() {
|
|
54
|
+
return this.writer;
|
|
55
|
+
}
|
|
56
|
+
acquire(exclusive) {
|
|
57
|
+
if (!this.writer && (!exclusive || this.readers === 0) && this.queue.length === 0) {
|
|
58
|
+
if (exclusive)
|
|
59
|
+
this.writer = true;
|
|
60
|
+
else
|
|
61
|
+
this.readers += 1;
|
|
62
|
+
return Promise.resolve();
|
|
63
|
+
}
|
|
64
|
+
return new Promise((resolve) => {
|
|
65
|
+
this.queue.push({ exclusive, run: resolve });
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
release(exclusive) {
|
|
69
|
+
if (exclusive)
|
|
70
|
+
this.writer = false;
|
|
71
|
+
else
|
|
72
|
+
this.readers -= 1;
|
|
73
|
+
this.drain();
|
|
74
|
+
}
|
|
75
|
+
drain() {
|
|
76
|
+
while (this.queue.length > 0 && !this.writer && this.readers === 0) {
|
|
77
|
+
const next = this.queue[0];
|
|
78
|
+
if (next === undefined)
|
|
79
|
+
return;
|
|
80
|
+
if (next.exclusive) {
|
|
81
|
+
this.queue.shift();
|
|
82
|
+
this.writer = true;
|
|
83
|
+
next.run();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// Admit the leading reader run together, up to the first writer.
|
|
87
|
+
while (this.queue.length > 0 && this.queue[0]?.exclusive === false) {
|
|
88
|
+
const reader = this.queue.shift();
|
|
89
|
+
if (reader === undefined)
|
|
90
|
+
break;
|
|
91
|
+
this.readers += 1;
|
|
92
|
+
reader.run();
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=skill-root-gate.js.map
|
|
@@ -40,6 +40,7 @@ import { type MutationLockPort, type MutationResult } from './mutation-unit.ts';
|
|
|
40
40
|
import { SkillModel } from './skill-model.ts';
|
|
41
41
|
import { type ExtractPlanDraft } from './extract-plan.ts';
|
|
42
42
|
import { type MutationRecord } from './mutations.ts';
|
|
43
|
+
import { type SkillWriteIntent, type SkillWriteRefusalReason } from './skill-write-intent.ts';
|
|
43
44
|
import { type RevisionAnchor, type RevisionFile } from './skill-revision.ts';
|
|
44
45
|
import { type ChangeSummary, type UnitHead, type HistoryFence, type SkillVersion } from './skill-history.ts';
|
|
45
46
|
import { type SkillHealthAssessment, type SkillHealthThresholds } from './skill-health.ts';
|
|
@@ -341,6 +342,13 @@ export declare function markerEntryName(marker: 'bundled' | 'hub-installed' | 'p
|
|
|
341
342
|
* Single source shared with the plan validator. */
|
|
342
343
|
export declare function validateRestructureTarget(filePath: string): string | null;
|
|
343
344
|
export declare function validateSupportPath(filePath: string): string | null;
|
|
345
|
+
/** One low-level CAS result; no audit/event is emitted by this primitive. */
|
|
346
|
+
export interface SkillFileCasResult {
|
|
347
|
+
readonly ok: boolean;
|
|
348
|
+
readonly message: string;
|
|
349
|
+
readonly reason?: SkillWriteRefusalReason | undefined;
|
|
350
|
+
readonly path?: string | undefined;
|
|
351
|
+
}
|
|
344
352
|
export declare class SkillLibrary {
|
|
345
353
|
readonly root: string;
|
|
346
354
|
/** The ONE read face owner/health/panel consume; a thin adapter, not a store. */
|
|
@@ -358,6 +366,10 @@ export declare class SkillLibrary {
|
|
|
358
366
|
* one skill never interleave their read-modify-write (the cross-process layer
|
|
359
367
|
* is the IO backend's transact lock; this chain is the second layer). */
|
|
360
368
|
private readonly serial;
|
|
369
|
+
/** Transitional target locks (same key as SkillWriteService). */
|
|
370
|
+
private readonly targetLocks;
|
|
371
|
+
/** Root structural gate; simple writes still use the serial until D.5d. */
|
|
372
|
+
private readonly rootGate;
|
|
361
373
|
/** V10-03 (P2-18): see the constructor's threatExemptLabels. Empty by
|
|
362
374
|
* default — the strict ANY-hit-blocks policy is unchanged. */
|
|
363
375
|
private readonly threatExemptLabels;
|
|
@@ -377,11 +389,15 @@ export declare class SkillLibrary {
|
|
|
377
389
|
* two paths cannot interleave with create/update/patch across processes.
|
|
378
390
|
*/
|
|
379
391
|
private unitHeadForOps;
|
|
392
|
+
/** Transitional: serialize one target even while the root serial remains. */
|
|
393
|
+
private withTarget;
|
|
380
394
|
private withMutationLock;
|
|
381
395
|
/** The one MutationUnit constructor: storage ports are fixed here, callers pass the rest. */
|
|
382
396
|
private commitUnit;
|
|
383
397
|
/** The one frontmatter pipeline for create/update/patch; patch keeps its cap checks outside. */
|
|
384
398
|
private prepareBody;
|
|
399
|
+
/** True when the injected lock port is per-target rather than the home fence. */
|
|
400
|
+
private keyedTargetLocks;
|
|
385
401
|
private lockPort;
|
|
386
402
|
private recovery;
|
|
387
403
|
/** Run the boot recovery once per library instance, before the first write. */
|
|
@@ -617,7 +633,7 @@ export declare class SkillLibrary {
|
|
|
617
633
|
private createCore;
|
|
618
634
|
update(rawName: string, content: string, origin?: WriteOrigin, anchor?: WriteAnchor): Promise<SkillActionResult>;
|
|
619
635
|
private updateCore;
|
|
620
|
-
patch(rawName: string, oldString: string, newString: string, filePath?: string, replaceAll?: boolean, origin?: WriteOrigin): Promise<SkillActionResult>;
|
|
636
|
+
patch(rawName: string, oldString: string, newString: string, filePath?: string, replaceAll?: boolean, origin?: WriteOrigin, anchor?: WriteAnchor): Promise<SkillActionResult>;
|
|
621
637
|
/**
|
|
622
638
|
* Replace ONE section's content (or one exact sub-block) in place. Keeps the
|
|
623
639
|
* H2 heading line for whole-section edits, so a model can compress one
|
|
@@ -659,7 +675,7 @@ export declare class SkillLibrary {
|
|
|
659
675
|
private safeSnapshotEntryName;
|
|
660
676
|
/** Mark merge-absorbed sources archived in the usage sidecar (FR-DATA-07). */
|
|
661
677
|
private foldArchivedUsage;
|
|
662
|
-
archive(rawName: string, options?: ArchiveOptions, origin?: WriteOrigin, change?: ChangeSummary): Promise<SkillActionResult>;
|
|
678
|
+
archive(rawName: string, options?: ArchiveOptions, origin?: WriteOrigin, change?: ChangeSummary, rootHeld?: boolean, namespaceHeld?: boolean): Promise<SkillActionResult>;
|
|
663
679
|
private archiveCore;
|
|
664
680
|
/**
|
|
665
681
|
* Commit one merge plan as a single multi-skill transaction.
|
|
@@ -745,14 +761,17 @@ export declare class SkillLibrary {
|
|
|
745
761
|
* @returns the kernel result; a refusal writes nothing.
|
|
746
762
|
*/
|
|
747
763
|
extract(plan: ExtractPlanDraft, origin?: WriteOrigin, change?: ChangeSummary): Promise<SkillActionResult>;
|
|
764
|
+
private extractCore;
|
|
748
765
|
private applyTreeChange;
|
|
749
766
|
/**
|
|
750
767
|
* Restore one skill from `.archive/` back to the active root. Hermes-style
|
|
751
768
|
* recoverability: archival never deletes, and this is the control-plane
|
|
752
769
|
* path back. The `.archive-reason` marker is dropped on restore.
|
|
753
770
|
*/
|
|
754
|
-
restoreFromArchive(rawName: string, origin?: WriteOrigin): Promise<SkillActionResult>;
|
|
771
|
+
restoreFromArchive(rawName: string, origin?: WriteOrigin, rootHeld?: boolean, namespaceHeld?: boolean): Promise<SkillActionResult>;
|
|
755
772
|
private restoreFromArchiveCore;
|
|
773
|
+
/** Result of the low-level CAS primitive. It intentionally has no audit/event. */
|
|
774
|
+
writeFileCas(rawName: string, filePath: string, intent: SkillWriteIntent): Promise<SkillFileCasResult>;
|
|
756
775
|
writeSupportFile(rawName: string, filePath: string, content: string, origin?: WriteOrigin, anchor?: WriteAnchor): Promise<SkillActionResult>;
|
|
757
776
|
private writeSupportFileCore;
|
|
758
777
|
removeSupportFile(rawName: string, filePath: string, origin?: WriteOrigin, anchor?: WriteAnchor, unitId?: string): Promise<SkillActionResult>;
|