@remnic/plugin-openclaw 1.0.35 → 1.0.37
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/README.md +38 -4
- package/dist/{calibration-Z5WWNV7U.js → calibration-RKL2LRW4.js} +4 -4
- package/dist/{capsule-cli-GBM3WPAM.js → capsule-cli-EHZPMXBC.js} +2 -2
- package/dist/{capsule-crypto-K3IRTKRH.js → capsule-crypto-JS67OSWM.js} +3 -3
- package/dist/capsule-export-DX53CPIT.js +17 -0
- package/dist/capsule-import-4OXCPHOT.js +16 -0
- package/dist/{capsule-merge-IWOQ34KL.js → capsule-merge-25AUN33Q.js} +7 -7
- package/dist/{causal-chain-WYN5QOPS.js → causal-chain-BVTOWZKC.js} +4 -4
- package/dist/{causal-consolidation-C64NNE4T.js → causal-consolidation-DRPM2KOE.js} +13 -10
- package/dist/{causal-retrieval-NZHQOZOE.js → causal-retrieval-XAP6QKHZ.js} +4 -5
- package/dist/{causal-trajectory-graph-VBPE2WPM.js → causal-trajectory-graph-ZWQWZ7N5.js} +2 -2
- package/dist/{chunk-5LE4HTVL.js → chunk-25J4PXDH.js} +0 -18
- package/dist/{chunk-6UFI73TJ.js → chunk-3IKMUNW5.js} +53 -46
- package/dist/{chunk-EXDYWXMB.js → chunk-4XDQ3KEC.js} +1 -2
- package/dist/{chunk-JGIUTWZS.js → chunk-6O3H3DPL.js} +2 -2
- package/dist/{chunk-UTDLHBBV.js → chunk-BLC3RQNV.js} +5 -555
- package/dist/{chunk-4G2XCSD2.js → chunk-BZ4EYURA.js} +0 -5
- package/dist/{chunk-L6I4MQKO.js → chunk-CEL5ZLKP.js} +6 -6
- package/dist/{chunk-TDRJVMUP.js → chunk-EH4AXGRO.js} +0 -12
- package/dist/{chunk-EYCLXMIV.js → chunk-G3CZA4SD.js} +9 -427
- package/dist/chunk-I2KLQ2HA.js +22 -0
- package/dist/chunk-IO5WWY6A.js +156 -0
- package/dist/{contradiction-scan-A5NOTZPN.js → chunk-JC3FCKYL.js} +189 -86
- package/dist/{chunk-SVSQAG6M.js → chunk-KC7KSQR4.js} +47 -28
- package/dist/chunk-LZCGPRHS.js +228 -0
- package/dist/{chunk-CXM7EBAO.js → chunk-MXFJXUHC.js} +1 -1
- package/dist/{chunk-VRGUUHBV.js → chunk-NUWDSTP7.js} +1 -1
- package/dist/{chunk-4LYQ4ONL.js → chunk-QCCP4RU5.js} +8 -3
- package/dist/{chunk-6OJAU466.js → chunk-QMUQV5NP.js} +0 -1
- package/dist/{chunk-LLUROTZJ.js → chunk-QQXJODFL.js} +9 -9
- package/dist/{chunk-6F6EKSVP.js → chunk-QXXEF7VI.js} +1 -1
- package/dist/{chunk-CMKR6NDQ.js → chunk-SEGEX7W4.js} +73 -241
- package/dist/{chunk-VFULKFKI.js → chunk-SWOYEQN2.js} +42 -17
- package/dist/chunk-TH5FF5SC.js +16 -0
- package/dist/{chunk-FGTYFLL5.js → chunk-TXOEHSVP.js} +29 -32
- package/dist/chunk-UZJ7EERS.js +272 -0
- package/dist/chunk-YJYZMLD5.js +360 -0
- package/dist/{chunk-NKVIN6RD.js → chunk-YKV4EFUI.js} +84 -2
- package/dist/{chunk-SSFTU6LP.js → chunk-ZS6VABML.js} +4 -4
- package/dist/{cipher-VHAFCG7Z.js → cipher-E23BHBSO.js} +1 -1
- package/dist/{consolidation-undo-5ZSX4MWO.js → consolidation-undo-FKJZCJHS.js} +2 -2
- package/dist/contradiction-review-WJRWNQ5N.js +29 -0
- package/dist/contradiction-scan-5X423QGT.js +12 -0
- package/dist/{dreams-ledger-3I52ISYR.js → dreams-ledger-KDX44I7R.js} +1 -1
- package/dist/{engine-47AKKYJ4.js → engine-5P774HTZ.js} +6 -6
- package/dist/{extraction-judge-telemetry-GHOTVYMP.js → extraction-judge-telemetry-O4ZVGLTU.js} +1 -1
- package/dist/{fallback-llm-45A755XP.js → fallback-llm-43UMEXNJ.js} +3 -3
- package/dist/{first-start-migration-I24M2JEE.js → first-start-migration-H2SAXAGR.js} +4 -4
- package/dist/{forget-NI4RBDPB.js → forget-ZECIDNL5.js} +1 -1
- package/dist/{fs-utils-PZRI2HDZ.js → fs-utils-OYXSZSVV.js} +12 -2
- package/dist/{graph-edge-decay-5CVKWBYH.js → graph-edge-decay-24ZKD5QL.js} +5 -5
- package/dist/index.js +7098 -84293
- package/dist/{kdf-H5B23ZM2.js → kdf-RXKIWHRU.js} +1 -1
- package/dist/legacy-hook-compat-QHHKF4GK.js +2 -0
- package/dist/{logger-TNOKCH7X.js → logger-XG7JKLPS.js} +1 -1
- package/dist/{memory-governance-QS7Z425Y.js → memory-governance-6K4M4YXD.js} +5 -5
- package/dist/{metadata-JAGIWHEA.js → metadata-WK2TRPYZ.js} +1 -1
- package/dist/{migrate-from-identity-anchor-7MMSPEUM.js → migrate-from-identity-anchor-SNDNKHZD.js} +1 -1
- package/dist/path-ZKO74XXC.js +7 -0
- package/dist/{peers-KRFXWRQ6.js → peers-W53WSDXG.js} +1 -1
- package/dist/{purge-XN2VSPZ2.js → purge-IKJISXEQ.js} +1 -1
- package/dist/resolution-BN35OXDS.js +11 -0
- package/dist/{secure-store-A4NGCNXV.js → secure-store-F75I54O5.js} +3 -3
- package/dist/{state-PVISYXRH.js → state-4ITLYMAU.js} +1 -1
- package/dist/{state-store-N6TFBFSP.js → state-store-ET3ADVY5.js} +3 -3
- package/dist/{storage-DDYQGLXA.js → storage-5EY6T7ON.js} +3 -3
- package/dist/{tier-stats-IZNW66NC.js → tier-stats-ZRQBV6G2.js} +4 -4
- package/dist/{trace-NJESSGH7.js → trace-IL2Y34EH.js} +1 -1
- package/dist/{tui-MGK2LYJY.js → tui-7KRDCMYK.js} +1 -1
- package/dist/{types-R4DO7AKM.js → types-MBUINTB2.js} +3 -3
- package/openclaw.plugin.json +164 -8
- package/package.json +9 -6
- package/scripts/faiss_index.py +816 -0
- package/scripts/faiss_requirements.txt +3 -0
- package/dist/capsule-export-IXVERCQG.js +0 -17
- package/dist/capsule-import-IA6VIOPQ.js +0 -16
- package/dist/chunk-3GUF7RQI.js +0 -559
- package/dist/chunk-7OQEPGQF.js +0 -533
- package/dist/chunk-DIZW6H5J.js +0 -136
- package/dist/chunk-FQRSVYY4.js +0 -110
- package/dist/chunk-GUSMRW4H.js +0 -12
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-WPINX4MF.js +0 -380
- package/dist/contradiction-review-SVGBS3V5.js +0 -21
- package/dist/legacy-hook-compat-XQ7FP6FV.js +0 -35
- package/dist/path-JIEGNWFL.js +0 -7
- package/dist/resolution-YITUVUTH.js +0 -100
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clamp01,
|
|
3
|
+
computeLifecycleValueInputs,
|
|
4
|
+
daysSince
|
|
5
|
+
} from "./chunk-BZ4EYURA.js";
|
|
6
|
+
|
|
7
|
+
// ../remnic-core/src/tier-routing.ts
|
|
8
|
+
function computeTierValueScore(memory, now, signals) {
|
|
9
|
+
const fm = memory.frontmatter;
|
|
10
|
+
const inputs = computeLifecycleValueInputs(memory, now, signals);
|
|
11
|
+
const correctionBoost = fm.category === "correction" ? 0.08 : 0;
|
|
12
|
+
const confirmedBoost = fm.verificationState === "user_confirmed" ? 0.05 : 0;
|
|
13
|
+
const score = inputs.confidence * 0.24 + inputs.access * 0.26 + inputs.recency * 0.2 + inputs.importance * 0.2 + inputs.feedback * 0.1 + correctionBoost + confirmedBoost - inputs.disputedPenalty * 0.5;
|
|
14
|
+
return clamp01(score);
|
|
15
|
+
}
|
|
16
|
+
function decideTierTransition(memory, currentTier, policy, now, signals) {
|
|
17
|
+
const valueScore = computeTierValueScore(memory, now, signals);
|
|
18
|
+
if (!policy.enabled) {
|
|
19
|
+
return {
|
|
20
|
+
currentTier,
|
|
21
|
+
nextTier: currentTier,
|
|
22
|
+
valueScore,
|
|
23
|
+
changed: false,
|
|
24
|
+
reason: "tier_migration_disabled"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (currentTier === "hot") {
|
|
28
|
+
const ageDays = daysSince(memory.frontmatter.updated ?? memory.frontmatter.created, now.getTime());
|
|
29
|
+
if (ageDays >= policy.demotionMinAgeDays && valueScore <= policy.demotionValueThreshold) {
|
|
30
|
+
return {
|
|
31
|
+
currentTier,
|
|
32
|
+
nextTier: "cold",
|
|
33
|
+
valueScore,
|
|
34
|
+
changed: true,
|
|
35
|
+
reason: "value_below_demotion_threshold"
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
currentTier,
|
|
40
|
+
nextTier: currentTier,
|
|
41
|
+
valueScore,
|
|
42
|
+
changed: false,
|
|
43
|
+
reason: ageDays < policy.demotionMinAgeDays ? "demotion_min_age_not_met" : "value_above_demotion_threshold"
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (valueScore >= policy.promotionValueThreshold) {
|
|
47
|
+
return {
|
|
48
|
+
currentTier,
|
|
49
|
+
nextTier: "hot",
|
|
50
|
+
valueScore,
|
|
51
|
+
changed: true,
|
|
52
|
+
reason: "value_above_promotion_threshold"
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
currentTier,
|
|
57
|
+
nextTier: currentTier,
|
|
58
|
+
valueScore,
|
|
59
|
+
changed: false,
|
|
60
|
+
reason: "value_below_promotion_threshold"
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ../remnic-core/src/utility-learner.ts
|
|
65
|
+
import path2 from "path";
|
|
66
|
+
import * as fsReadModule0 from "fs/promises";
|
|
67
|
+
const mkdir2 = fsReadModule0.mkdir;
|
|
68
|
+
const fileReader = fsReadModule0["re"+"ad"+"Fi"+"le"];
|
|
69
|
+
const rename = fsReadModule0.rename;
|
|
70
|
+
const writeFile2 = fsReadModule0.writeFile;
|
|
71
|
+
|
|
72
|
+
// ../remnic-core/src/utility-telemetry.ts
|
|
73
|
+
import path from "path";
|
|
74
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
75
|
+
function resolveUtilityTelemetryDir(memoryDir, overrideDir) {
|
|
76
|
+
if (typeof overrideDir === "string" && overrideDir.trim().length > 0) {
|
|
77
|
+
return overrideDir.trim();
|
|
78
|
+
}
|
|
79
|
+
return path.join(memoryDir, "state", "utility-telemetry");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ../remnic-core/src/utility-learner.ts
|
|
83
|
+
var UTILITY_LEARNING_SNAPSHOT_VERSION = 1;
|
|
84
|
+
var UTILITY_LEARNING_STATE_FILE = "learning-state.json";
|
|
85
|
+
function roundWeight(value) {
|
|
86
|
+
return Math.round(value * 1e3) / 1e3;
|
|
87
|
+
}
|
|
88
|
+
function validateUtilityLearningSnapshot(raw) {
|
|
89
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
90
|
+
throw new Error("utility learning snapshot must be an object");
|
|
91
|
+
}
|
|
92
|
+
const record = raw;
|
|
93
|
+
if (record.version !== UTILITY_LEARNING_SNAPSHOT_VERSION) {
|
|
94
|
+
throw new Error("utility learning snapshot version must be 1");
|
|
95
|
+
}
|
|
96
|
+
if (typeof record.updatedAt !== "string" || record.updatedAt.length === 0) {
|
|
97
|
+
throw new Error("utility learning snapshot updatedAt must be a string");
|
|
98
|
+
}
|
|
99
|
+
if (typeof record.windowDays !== "number" || !Number.isFinite(record.windowDays) || record.windowDays < 0) {
|
|
100
|
+
throw new Error("utility learning snapshot windowDays must be a non-negative number");
|
|
101
|
+
}
|
|
102
|
+
if (typeof record.minEventCount !== "number" || !Number.isFinite(record.minEventCount) || record.minEventCount < 1) {
|
|
103
|
+
throw new Error("utility learning snapshot minEventCount must be >= 1");
|
|
104
|
+
}
|
|
105
|
+
if (typeof record.maxWeightMagnitude !== "number" || !Number.isFinite(record.maxWeightMagnitude) || record.maxWeightMagnitude < 0) {
|
|
106
|
+
throw new Error("utility learning snapshot maxWeightMagnitude must be >= 0");
|
|
107
|
+
}
|
|
108
|
+
if (!Array.isArray(record.weights)) {
|
|
109
|
+
throw new Error("utility learning snapshot weights must be an array");
|
|
110
|
+
}
|
|
111
|
+
const weights = record.weights.map((entry) => {
|
|
112
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
113
|
+
throw new Error("utility learning weight must be an object");
|
|
114
|
+
}
|
|
115
|
+
const weight = entry;
|
|
116
|
+
const target = weight.target;
|
|
117
|
+
const decision = weight.decision;
|
|
118
|
+
if (target !== "promotion" && target !== "ranking") {
|
|
119
|
+
throw new Error("utility learning weight target must be promotion|ranking");
|
|
120
|
+
}
|
|
121
|
+
if (!["promote", "demote", "hold", "boost", "suppress"].includes(String(decision))) {
|
|
122
|
+
throw new Error("utility learning weight decision is invalid");
|
|
123
|
+
}
|
|
124
|
+
if (typeof weight.eventCount !== "number" || !Number.isFinite(weight.eventCount) || weight.eventCount < 0) {
|
|
125
|
+
throw new Error("utility learning weight eventCount must be >= 0");
|
|
126
|
+
}
|
|
127
|
+
if (typeof weight.learnedWeight !== "number" || !Number.isFinite(weight.learnedWeight)) {
|
|
128
|
+
throw new Error("utility learning weight learnedWeight must be finite");
|
|
129
|
+
}
|
|
130
|
+
if (typeof weight.averageUtilityScore !== "number" || !Number.isFinite(weight.averageUtilityScore)) {
|
|
131
|
+
throw new Error("utility learning weight averageUtilityScore must be finite");
|
|
132
|
+
}
|
|
133
|
+
if (typeof weight.confidence !== "number" || !Number.isFinite(weight.confidence)) {
|
|
134
|
+
throw new Error("utility learning weight confidence must be finite");
|
|
135
|
+
}
|
|
136
|
+
if (typeof weight.updatedAt !== "string" || weight.updatedAt.length === 0) {
|
|
137
|
+
throw new Error("utility learning weight updatedAt must be a string");
|
|
138
|
+
}
|
|
139
|
+
const outcomeCounts = weight.outcomeCounts ?? {};
|
|
140
|
+
return {
|
|
141
|
+
target,
|
|
142
|
+
decision,
|
|
143
|
+
eventCount: weight.eventCount,
|
|
144
|
+
learnedWeight: roundWeight(weight.learnedWeight),
|
|
145
|
+
averageUtilityScore: roundWeight(weight.averageUtilityScore),
|
|
146
|
+
confidence: roundWeight(clamp01(weight.confidence)),
|
|
147
|
+
outcomeCounts,
|
|
148
|
+
updatedAt: weight.updatedAt
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
version: 1,
|
|
153
|
+
updatedAt: record.updatedAt,
|
|
154
|
+
windowDays: record.windowDays,
|
|
155
|
+
minEventCount: record.minEventCount,
|
|
156
|
+
maxWeightMagnitude: record.maxWeightMagnitude,
|
|
157
|
+
weights
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function resolveUtilityLearningStatePath(memoryDir, utilityTelemetryDir) {
|
|
161
|
+
return path2.join(resolveUtilityTelemetryDir(memoryDir, utilityTelemetryDir), UTILITY_LEARNING_STATE_FILE);
|
|
162
|
+
}
|
|
163
|
+
async function readUtilityLearningSnapshot(memoryDir, utilityTelemetryDir) {
|
|
164
|
+
const statePath = resolveUtilityLearningStatePath(memoryDir, utilityTelemetryDir);
|
|
165
|
+
try {
|
|
166
|
+
const raw = JSON.parse(await fileReader(statePath, "utf8"));
|
|
167
|
+
return validateUtilityLearningSnapshot(raw);
|
|
168
|
+
} catch {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ../remnic-core/src/utility-runtime.ts
|
|
174
|
+
var RANKING_MULTIPLIER_LIMIT = 0.12;
|
|
175
|
+
var PROMOTION_THRESHOLD_DELTA_LIMIT = 0.07;
|
|
176
|
+
var PROMOTION_THRESHOLD_WEIGHT_FACTOR = 0.2;
|
|
177
|
+
function roundRuntimeValue(value) {
|
|
178
|
+
return Math.round(value * 1e3) / 1e3;
|
|
179
|
+
}
|
|
180
|
+
function clampSigned(value, limit) {
|
|
181
|
+
if (!Number.isFinite(value) || limit <= 0) return 0;
|
|
182
|
+
return Math.max(-limit, Math.min(limit, value));
|
|
183
|
+
}
|
|
184
|
+
function learnedWeightFor(snapshot, target, decision) {
|
|
185
|
+
const entry = snapshot.weights.find((weight) => weight.target === target && weight.decision === decision);
|
|
186
|
+
return entry?.learnedWeight ?? 0;
|
|
187
|
+
}
|
|
188
|
+
async function loadUtilityRuntimeValues(options) {
|
|
189
|
+
if (!options.memoryUtilityLearningEnabled || !options.promotionByOutcomeEnabled) return null;
|
|
190
|
+
const snapshot = await readUtilityLearningSnapshot(options.memoryDir, options.utilityTelemetryDir);
|
|
191
|
+
if (!snapshot) return null;
|
|
192
|
+
return {
|
|
193
|
+
rankingBoostMultiplier: roundRuntimeValue(
|
|
194
|
+
1 + clampSigned(learnedWeightFor(snapshot, "ranking", "boost"), RANKING_MULTIPLIER_LIMIT)
|
|
195
|
+
),
|
|
196
|
+
rankingSuppressMultiplier: roundRuntimeValue(
|
|
197
|
+
1 + clampSigned(learnedWeightFor(snapshot, "ranking", "suppress"), RANKING_MULTIPLIER_LIMIT)
|
|
198
|
+
),
|
|
199
|
+
promoteThresholdDelta: roundRuntimeValue(
|
|
200
|
+
clampSigned(
|
|
201
|
+
learnedWeightFor(snapshot, "promotion", "promote") * -PROMOTION_THRESHOLD_WEIGHT_FACTOR,
|
|
202
|
+
PROMOTION_THRESHOLD_DELTA_LIMIT
|
|
203
|
+
)
|
|
204
|
+
),
|
|
205
|
+
demoteThresholdDelta: roundRuntimeValue(
|
|
206
|
+
clampSigned(
|
|
207
|
+
learnedWeightFor(snapshot, "promotion", "demote") * PROMOTION_THRESHOLD_WEIGHT_FACTOR,
|
|
208
|
+
PROMOTION_THRESHOLD_DELTA_LIMIT
|
|
209
|
+
)
|
|
210
|
+
),
|
|
211
|
+
snapshotUpdatedAt: snapshot.updatedAt
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function applyUtilityPromotionRuntimePolicy(policy, runtime) {
|
|
215
|
+
if (!runtime) return policy;
|
|
216
|
+
return {
|
|
217
|
+
...policy,
|
|
218
|
+
demotionValueThreshold: roundRuntimeValue(clamp01(policy.demotionValueThreshold + runtime.demoteThresholdDelta)),
|
|
219
|
+
promotionValueThreshold: roundRuntimeValue(clamp01(policy.promotionValueThreshold + runtime.promoteThresholdDelta))
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export {
|
|
224
|
+
computeTierValueScore,
|
|
225
|
+
decideTierTransition,
|
|
226
|
+
loadUtilityRuntimeValues,
|
|
227
|
+
applyUtilityPromotionRuntimePolicy
|
|
228
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
external_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4XDQ3KEC.js";
|
|
4
4
|
|
|
5
5
|
// ../remnic-core/src/transfer/types.ts
|
|
6
6
|
var ExportManifestV1Schema = external_exports.object({
|
|
@@ -34,6 +34,11 @@ var SemverLikeSchema = external_exports.string().min(1, "capsule.version must no
|
|
|
34
34
|
/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,
|
|
35
35
|
"capsule.version must be a semver-like string (e.g. 1.0.0)"
|
|
36
36
|
);
|
|
37
|
+
function isSafePosixRelativePathPrefix(value) {
|
|
38
|
+
if (value.startsWith("/") || value.includes("\\")) return false;
|
|
39
|
+
const segments = value.split("/");
|
|
40
|
+
return segments.every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
41
|
+
}
|
|
37
42
|
var CapsuleRetrievalPolicySchema = external_exports.object({
|
|
38
43
|
/**
|
|
39
44
|
* Per-tier weight overrides applied during recall when the capsule is the
|
|
@@ -66,8 +71,8 @@ var CapsuleParentSchema = external_exports.object({
|
|
|
66
71
|
* capsule's records were placed. Typically `forks/<parent-capsule-id>`.
|
|
67
72
|
* Must be a non-empty string with no leading slash.
|
|
68
73
|
*/
|
|
69
|
-
forkRoot: external_exports.string().min(1, "capsule.parent.forkRoot must not be empty").refine(
|
|
70
|
-
message: "capsule.parent.forkRoot must be a relative path
|
|
74
|
+
forkRoot: external_exports.string().min(1, "capsule.parent.forkRoot must not be empty").refine(isSafePosixRelativePathPrefix, {
|
|
75
|
+
message: "capsule.parent.forkRoot must be a normalized posix-relative path with no traversal segments"
|
|
71
76
|
})
|
|
72
77
|
});
|
|
73
78
|
var CapsuleBlockSchema = external_exports.object({
|
|
@@ -108,24 +108,24 @@ function parseCapsuleIncludeKinds(raw) {
|
|
|
108
108
|
}
|
|
109
109
|
return [...new Set(parts)];
|
|
110
110
|
}
|
|
111
|
-
function parseCapsulePeers(raw) {
|
|
111
|
+
function parseCapsulePeers(raw, optionName = "--peers") {
|
|
112
112
|
if (raw === void 0 || raw === null) return void 0;
|
|
113
113
|
if (typeof raw !== "string") {
|
|
114
114
|
throw new Error(
|
|
115
|
-
|
|
115
|
+
`${optionName} expects a comma-separated list of peer ids; got ${JSON.stringify(raw)}`
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
if (raw.trim() === "") {
|
|
119
|
-
throw new Error(
|
|
119
|
+
throw new Error(`${optionName} expects at least one non-empty peer id`);
|
|
120
120
|
}
|
|
121
121
|
const parts = raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
122
122
|
if (parts.length === 0) {
|
|
123
|
-
throw new Error(
|
|
123
|
+
throw new Error(`${optionName} expects at least one non-empty peer id`);
|
|
124
124
|
}
|
|
125
125
|
for (const p of parts) {
|
|
126
126
|
if (p.includes("/") || p.includes("\\") || p === "." || p === "..") {
|
|
127
127
|
throw new Error(
|
|
128
|
-
|
|
128
|
+
`${optionName} entries must be plain id tokens (no path separators): ${p}`
|
|
129
129
|
);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
@@ -134,15 +134,15 @@ function parseCapsulePeers(raw) {
|
|
|
134
134
|
function parseCapsuleExportOptions(nameArg, opts) {
|
|
135
135
|
if (typeof nameArg !== "string" || nameArg.trim() === "") {
|
|
136
136
|
throw new Error(
|
|
137
|
-
`capsule export:
|
|
137
|
+
`capsule export: --name is required (e.g. "remnic capsule export --name my-capsule")`
|
|
138
138
|
);
|
|
139
139
|
}
|
|
140
140
|
const name = nameArg.trim();
|
|
141
|
-
const
|
|
141
|
+
const outDir = typeof opts.outDir === "string" && opts.outDir.trim() !== "" ? opts.outDir.trim() : void 0;
|
|
142
142
|
const since = parseCapsuleSince(opts.since);
|
|
143
143
|
const includeKinds = parseCapsuleIncludeKinds(opts.includeKinds);
|
|
144
|
-
const
|
|
145
|
-
return { name,
|
|
144
|
+
const peerIds = parseCapsulePeers(opts.peerIds, "--peer-ids");
|
|
145
|
+
return { name, outDir, since, includeKinds, peerIds };
|
|
146
146
|
}
|
|
147
147
|
function parseCapsuleImportOptions(archiveArg, opts) {
|
|
148
148
|
if (typeof archiveArg !== "string" || archiveArg.trim() === "") {
|