@narumitw/pi-sync 0.49.10 → 0.49.12
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 +10 -1
- package/dist/chunks/chunk-3GRWMWUZ.ts +213 -0
- package/dist/chunks/chunk-3GRWMWUZ.ts.map +7 -0
- package/dist/chunks/chunk-3NDD5QPM.ts +203 -0
- package/dist/chunks/chunk-3NDD5QPM.ts.map +7 -0
- package/dist/chunks/chunk-4F3W4CSC.ts +195 -0
- package/dist/chunks/chunk-4F3W4CSC.ts.map +7 -0
- package/dist/chunks/chunk-4U6AFLJB.ts +221 -0
- package/dist/chunks/chunk-4U6AFLJB.ts.map +7 -0
- package/dist/chunks/chunk-5MQ76BK5.ts +34 -0
- package/dist/chunks/chunk-5MQ76BK5.ts.map +7 -0
- package/dist/chunks/chunk-APZVBSM6.ts +1238 -0
- package/dist/chunks/chunk-APZVBSM6.ts.map +7 -0
- package/dist/chunks/chunk-BHJUISB4.ts +134 -0
- package/dist/chunks/chunk-BHJUISB4.ts.map +7 -0
- package/dist/chunks/chunk-D3S54OXI.ts +653 -0
- package/dist/chunks/chunk-D3S54OXI.ts.map +7 -0
- package/dist/chunks/chunk-EWX3TPLQ.ts +356 -0
- package/dist/chunks/chunk-EWX3TPLQ.ts.map +7 -0
- package/dist/chunks/chunk-F5QL2GPY.ts +341 -0
- package/dist/chunks/chunk-F5QL2GPY.ts.map +7 -0
- package/dist/chunks/chunk-FR6CVXAL.ts +81 -0
- package/dist/chunks/chunk-FR6CVXAL.ts.map +7 -0
- package/dist/chunks/chunk-HGV24P4T.ts +53 -0
- package/dist/chunks/chunk-HGV24P4T.ts.map +7 -0
- package/dist/chunks/chunk-JNOOSPEW.ts +82 -0
- package/dist/chunks/chunk-JNOOSPEW.ts.map +7 -0
- package/dist/chunks/chunk-LJDSHNS3.ts +259 -0
- package/dist/chunks/chunk-LJDSHNS3.ts.map +7 -0
- package/dist/chunks/chunk-RGJ6SOYR.ts +128 -0
- package/dist/chunks/chunk-RGJ6SOYR.ts.map +7 -0
- package/dist/chunks/chunk-W64NEHXT.ts +167 -0
- package/dist/chunks/chunk-W64NEHXT.ts.map +7 -0
- package/dist/chunks/chunk-YQ6UW7IF.ts +394 -0
- package/dist/chunks/chunk-YQ6UW7IF.ts.map +7 -0
- package/dist/chunks/file-selection-4UABOP44.ts +290 -0
- package/dist/chunks/file-selection-4UABOP44.ts.map +7 -0
- package/dist/chunks/git-backend-E3UOUUOM.ts +1104 -0
- package/dist/chunks/git-backend-E3UOUUOM.ts.map +7 -0
- package/dist/chunks/manager-result-dispatcher-YKBLZ7KL.ts +18 -0
- package/dist/chunks/manager-result-dispatcher-YKBLZ7KL.ts.map +7 -0
- package/dist/chunks/manager-ui-7E25VWUP.ts +2754 -0
- package/dist/chunks/manager-ui-7E25VWUP.ts.map +7 -0
- package/dist/chunks/remote-selection-ui-J6OW5DKZ.ts +17 -0
- package/dist/chunks/remote-selection-ui-J6OW5DKZ.ts.map +7 -0
- package/dist/chunks/s3-backend-3QZGO2EF.ts +680 -0
- package/dist/chunks/s3-backend-3QZGO2EF.ts.map +7 -0
- package/dist/chunks/setup-switch-X3W3FALZ.ts +27 -0
- package/dist/chunks/setup-switch-X3W3FALZ.ts.map +7 -0
- package/dist/chunks/snapshot-WBSV4MQG.ts +45 -0
- package/dist/chunks/snapshot-WBSV4MQG.ts.map +7 -0
- package/dist/chunks/sync-operations-MPAFVVHA.ts +1112 -0
- package/dist/chunks/sync-operations-MPAFVVHA.ts.map +7 -0
- package/dist/chunks/sync-state-36H7ULG2.ts +41 -0
- package/dist/chunks/sync-state-36H7ULG2.ts.map +7 -0
- package/dist/chunks/webdav-backend-ZD5RHRIU.ts +869 -0
- package/dist/chunks/webdav-backend-ZD5RHRIU.ts.map +7 -0
- package/dist/index.ts +668 -0
- package/dist/index.ts.map +7 -0
- package/package.json +11 -7
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
// @generated by scripts/build-runtime.mjs; do not edit.
|
|
2
|
+
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
|
+
|
|
4
|
+
// src/paths.ts
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
function isDeniedPath(relativePath) {
|
|
7
|
+
const normalized = toPosix(relativePath);
|
|
8
|
+
const lower = normalized.toLowerCase();
|
|
9
|
+
const segments = lower.split("/");
|
|
10
|
+
const base = path.posix.basename(lower);
|
|
11
|
+
return segments.includes("node_modules") || segments.includes(".git") || segments.includes(".pisync") || segments.includes("pi-sync") || segments.includes(".pi-sync-state-migration.lock") || base === ".env" || base.startsWith(".env.") || base.endsWith(".env") || base.includes("secret") || base.includes("token") || base === "pi-sync.json" || base.startsWith("pi-sync.json.") || base.startsWith(".pi-sync.json.") || base === "pi-sync.local.json" || base.startsWith("pi-sync.local.json.") || base.startsWith(".pi-sync.local.json.");
|
|
12
|
+
}
|
|
13
|
+
function isPathInside(parent, child) {
|
|
14
|
+
const relative = path.relative(path.resolve(parent), path.resolve(child));
|
|
15
|
+
return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
16
|
+
}
|
|
17
|
+
function safeJoin(root, relativePath) {
|
|
18
|
+
const target = path.resolve(root, relativePath);
|
|
19
|
+
assertWithinRoot(root, target, relativePath);
|
|
20
|
+
return target;
|
|
21
|
+
}
|
|
22
|
+
function assertWithinRoot(root, target, label = target) {
|
|
23
|
+
const resolvedRoot = path.resolve(root);
|
|
24
|
+
const resolvedTarget = path.resolve(target);
|
|
25
|
+
if (resolvedTarget !== resolvedRoot && !resolvedTarget.startsWith(`${resolvedRoot}${path.sep}`)) {
|
|
26
|
+
throw new Error(`Unsafe path in snapshot: ${label}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function encodeKey(key) {
|
|
30
|
+
return key.split("/").map(encodeURIComponent).join("/");
|
|
31
|
+
}
|
|
32
|
+
function posixJoin(...parts) {
|
|
33
|
+
return parts.map((part) => trimSlashes(part)).filter(Boolean).join("/");
|
|
34
|
+
}
|
|
35
|
+
function parentPaths(relativePath) {
|
|
36
|
+
const results = [];
|
|
37
|
+
let index = relativePath.lastIndexOf("/");
|
|
38
|
+
while (index > 0) {
|
|
39
|
+
results.push(relativePath.slice(0, index));
|
|
40
|
+
index = relativePath.lastIndexOf("/", index - 1);
|
|
41
|
+
}
|
|
42
|
+
return results;
|
|
43
|
+
}
|
|
44
|
+
function toPosix(value) {
|
|
45
|
+
return value.split(path.sep).join("/");
|
|
46
|
+
}
|
|
47
|
+
function trimSlashes(value) {
|
|
48
|
+
return value.replace(/^\/+|\/+$/g, "");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/sync-policy.ts
|
|
52
|
+
import path2 from "node:path";
|
|
53
|
+
var BUILT_IN_SYNC_ROOTS = [
|
|
54
|
+
"settings.json",
|
|
55
|
+
"keybindings.json",
|
|
56
|
+
"models.json",
|
|
57
|
+
"AGENTS.md",
|
|
58
|
+
"APPEND_SYSTEM.md",
|
|
59
|
+
"skills",
|
|
60
|
+
"prompts",
|
|
61
|
+
"themes",
|
|
62
|
+
"extensions"
|
|
63
|
+
];
|
|
64
|
+
var DEFAULT_SYNC_INCLUDE = [...BUILT_IN_SYNC_ROOTS];
|
|
65
|
+
var SNAPSHOT_SELECTION_VERSION = 1;
|
|
66
|
+
var MAX_SYNC_INCLUDE_ITEMS = 1024;
|
|
67
|
+
var MAX_SYNC_INCLUDE_PATH_BYTES = 4096;
|
|
68
|
+
var MAX_SYNC_INCLUDE_TOTAL_BYTES = 256 * 1024;
|
|
69
|
+
var BUILT_IN_BY_LOWER = new Map(
|
|
70
|
+
BUILT_IN_SYNC_ROOTS.map((fileName) => [fileName.toLowerCase(), fileName])
|
|
71
|
+
);
|
|
72
|
+
var TOP_LEVEL_FILE_PATHS = new Map(
|
|
73
|
+
BUILT_IN_SYNC_ROOTS.filter((fileName) => fileName.includes(".")).map((fileName) => [
|
|
74
|
+
fileName.toLowerCase(),
|
|
75
|
+
fileName
|
|
76
|
+
])
|
|
77
|
+
);
|
|
78
|
+
var TOP_LEVEL_DIRS = new Set(
|
|
79
|
+
BUILT_IN_SYNC_ROOTS.filter((fileName) => !fileName.includes("."))
|
|
80
|
+
);
|
|
81
|
+
var RESERVED_TOP_LEVEL_NAMES = /* @__PURE__ */ new Set([...BUILT_IN_BY_LOWER.keys(), "sessions"]);
|
|
82
|
+
function normalizeSyncInclude(value) {
|
|
83
|
+
if (!Array.isArray(value)) {
|
|
84
|
+
throw new Error("Invalid pi-sync settings: sync.include must be an array.");
|
|
85
|
+
}
|
|
86
|
+
if (value.length > MAX_SYNC_INCLUDE_ITEMS) {
|
|
87
|
+
throw new Error(
|
|
88
|
+
`Invalid pi-sync settings: sync.include has too many items; limit: ${MAX_SYNC_INCLUDE_ITEMS}.`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
const result = [];
|
|
92
|
+
const seen = /* @__PURE__ */ new Set();
|
|
93
|
+
const pathRoot = { children: /* @__PURE__ */ new Map() };
|
|
94
|
+
let totalBytes = 0;
|
|
95
|
+
for (const item of value) {
|
|
96
|
+
if (typeof item !== "string") {
|
|
97
|
+
throw new Error("Invalid pi-sync settings: sync.include items must be strings.");
|
|
98
|
+
}
|
|
99
|
+
const itemBytes = Buffer.byteLength(item, "utf8");
|
|
100
|
+
if (itemBytes > MAX_SYNC_INCLUDE_PATH_BYTES) {
|
|
101
|
+
throw new Error(
|
|
102
|
+
`Invalid pi-sync settings: sync.include item is too long; limit: ${MAX_SYNC_INCLUDE_PATH_BYTES} bytes.`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
totalBytes += itemBytes;
|
|
106
|
+
if (totalBytes > MAX_SYNC_INCLUDE_TOTAL_BYTES) {
|
|
107
|
+
throw new Error(
|
|
108
|
+
`Invalid pi-sync settings: sync.include is too large; limit: ${MAX_SYNC_INCLUDE_TOTAL_BYTES} bytes.`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
const trimmed = item.trim();
|
|
112
|
+
const builtIn = BUILT_IN_BY_LOWER.get(trimmed.toLowerCase());
|
|
113
|
+
const normalized = builtIn ?? (trimmed.toLowerCase() === "sessions" ? "sessions" : trimmed);
|
|
114
|
+
if (!builtIn && normalized !== "sessions") validateAgentRelativeInclude(normalized);
|
|
115
|
+
const identity = normalized.toLowerCase();
|
|
116
|
+
if (seen.has(identity)) {
|
|
117
|
+
throw new Error(`Invalid pi-sync settings: duplicate sync.include item: ${item}`);
|
|
118
|
+
}
|
|
119
|
+
addIncludePath(pathRoot, identity, item);
|
|
120
|
+
seen.add(identity);
|
|
121
|
+
result.push(normalized);
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
function addIncludePath(root, identity, source) {
|
|
126
|
+
let node = root;
|
|
127
|
+
for (const segment of identity.split("/")) {
|
|
128
|
+
if (node.selected !== void 0) throwOverlappingInclude(source);
|
|
129
|
+
let child = node.children.get(segment);
|
|
130
|
+
if (!child) {
|
|
131
|
+
child = { children: /* @__PURE__ */ new Map() };
|
|
132
|
+
node.children.set(segment, child);
|
|
133
|
+
}
|
|
134
|
+
node = child;
|
|
135
|
+
}
|
|
136
|
+
if (node.children.size > 0) throwOverlappingInclude(source);
|
|
137
|
+
node.selected = identity;
|
|
138
|
+
}
|
|
139
|
+
function throwOverlappingInclude(item) {
|
|
140
|
+
throw new Error(
|
|
141
|
+
`Invalid pi-sync settings: overlapping sync.include items are ambiguous: ${item}`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
function validateAgentRelativeInclude(value) {
|
|
145
|
+
const normalized = toPosix(value);
|
|
146
|
+
const topLevel = normalized.split("/")[0]?.toLowerCase();
|
|
147
|
+
if (!normalized || normalized === "." || normalized === ".." || normalized.startsWith("../") || path2.posix.isAbsolute(normalized) || normalized.includes("\\") || path2.posix.normalize(normalized) !== normalized || // biome-ignore lint/suspicious/noControlCharactersInRegex: Include paths cannot contain controls.
|
|
148
|
+
/[\u0000-\u001f\u007f-\u009f]/u.test(normalized)) {
|
|
149
|
+
throw new Error(
|
|
150
|
+
`Invalid pi-sync settings: sync.include item must be a safe agent-relative path: ${value}`
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
if (isDeniedPath(normalized)) {
|
|
154
|
+
throw new Error(`Invalid pi-sync settings: ${value} cannot be synced.`);
|
|
155
|
+
}
|
|
156
|
+
if (topLevel && RESERVED_TOP_LEVEL_NAMES.has(topLevel)) {
|
|
157
|
+
throw new Error(
|
|
158
|
+
`Invalid pi-sync settings: use the canonical ${topLevel} root instead of a nested sync.include path.`
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function portableSnapshotSelection(value) {
|
|
163
|
+
const selection = value;
|
|
164
|
+
if (!selection || typeof selection !== "object" || Array.isArray(selection) || selection.version !== SNAPSHOT_SELECTION_VERSION || !Object.hasOwn(selection, "include") || Object.keys(selection).some((key) => key !== "version" && key !== "include")) {
|
|
165
|
+
throw new Error("Invalid snapshot selection policy.");
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
version: SNAPSHOT_SELECTION_VERSION,
|
|
169
|
+
include: normalizeSyncInclude(selection.include)
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function snapshotSelectionInclude(snapshot) {
|
|
173
|
+
return snapshot.selection === void 0 ? void 0 : portableSnapshotSelection(snapshot.selection).include;
|
|
174
|
+
}
|
|
175
|
+
function selectionForSnapshot(include) {
|
|
176
|
+
return { version: SNAPSHOT_SELECTION_VERSION, include: normalizeSyncInclude(include) };
|
|
177
|
+
}
|
|
178
|
+
function sameSyncInclude(left, right) {
|
|
179
|
+
const normalizedLeft = normalizeSyncInclude(left);
|
|
180
|
+
const normalizedRight = normalizeSyncInclude(right);
|
|
181
|
+
return normalizedLeft.length === normalizedRight.length && normalizedLeft.every((item, index) => item === normalizedRight[index]);
|
|
182
|
+
}
|
|
183
|
+
function compareSyncInclude(local, remote) {
|
|
184
|
+
const localInclude = normalizeSyncInclude(local);
|
|
185
|
+
const remoteInclude = normalizeSyncInclude(remote);
|
|
186
|
+
const localSet = new Set(localInclude);
|
|
187
|
+
const remoteSet = new Set(remoteInclude);
|
|
188
|
+
return {
|
|
189
|
+
same: sameSyncInclude(localInclude, remoteInclude),
|
|
190
|
+
remoteOnly: remoteInclude.filter((item) => !localSet.has(item)),
|
|
191
|
+
localOnly: localInclude.filter((item) => !remoteSet.has(item))
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function inspectRemoteSelection(localInclude, snapshot) {
|
|
195
|
+
const remoteInclude = snapshotSelectionInclude(snapshot);
|
|
196
|
+
if (!remoteInclude) {
|
|
197
|
+
return { kind: "legacy", discovered: discoverLegacySnapshotInclude(snapshot) };
|
|
198
|
+
}
|
|
199
|
+
const comparison = compareSyncInclude(localInclude, remoteInclude);
|
|
200
|
+
return comparison.same ? { kind: "same", include: remoteInclude } : { kind: "different", include: remoteInclude, ...comparison };
|
|
201
|
+
}
|
|
202
|
+
var RemoteSelectionMismatchError = class extends Error {
|
|
203
|
+
decision;
|
|
204
|
+
setupName;
|
|
205
|
+
localInclude;
|
|
206
|
+
remoteInclude;
|
|
207
|
+
constructor(setupName, localInclude, remoteInclude, configIdentity = JSON.stringify([setupName, normalizeSyncInclude(localInclude)])) {
|
|
208
|
+
const local = normalizeSyncInclude(localInclude);
|
|
209
|
+
const remote = normalizeSyncInclude(remoteInclude);
|
|
210
|
+
super(formatRemoteSelectionMismatch(setupName, local, remote));
|
|
211
|
+
this.name = "RemoteSelectionMismatchError";
|
|
212
|
+
this.setupName = setupName;
|
|
213
|
+
this.localInclude = local;
|
|
214
|
+
this.remoteInclude = remote;
|
|
215
|
+
this.decision = {
|
|
216
|
+
setupName,
|
|
217
|
+
configIdentity,
|
|
218
|
+
localInclude: [...local],
|
|
219
|
+
remoteInclude: [...remote]
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
function remoteSelectionMismatch(config, remoteInclude, configIdentity) {
|
|
224
|
+
return new RemoteSelectionMismatchError(
|
|
225
|
+
config.setupName,
|
|
226
|
+
config.include,
|
|
227
|
+
remoteInclude,
|
|
228
|
+
configIdentity
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
function formatRemoteSelectionMismatch(setupName, localInclude, remoteInclude) {
|
|
232
|
+
const comparison = compareSyncInclude(localInclude, remoteInclude);
|
|
233
|
+
const lines = [
|
|
234
|
+
`Synced content differs for sync setup \u201C${stripTerminalControls(setupName)}\u201D.`,
|
|
235
|
+
`Remote-only: ${comparison.remoteOnly.join(", ") || "none"}`,
|
|
236
|
+
`This-device-only: ${comparison.localOnly.join(", ") || "none"}`
|
|
237
|
+
];
|
|
238
|
+
if (comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0) {
|
|
239
|
+
lines.push(
|
|
240
|
+
"Only ordering differs.",
|
|
241
|
+
`Remote order: ${remoteInclude.join(", ") || "none"}`,
|
|
242
|
+
`This device order: ${localInclude.join(", ") || "none"}`
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
lines.push("Run /sync in TUI to review both content lists and choose what happens next.");
|
|
246
|
+
return lines.join("\n");
|
|
247
|
+
}
|
|
248
|
+
function stripTerminalControls(value) {
|
|
249
|
+
return value.replace(/[\u0000-\u001f\u007f-\u009f]/gu, "?");
|
|
250
|
+
}
|
|
251
|
+
function discoverLegacySnapshotInclude(snapshot) {
|
|
252
|
+
const builtIns = /* @__PURE__ */ new Set();
|
|
253
|
+
const custom = /* @__PURE__ */ new Set();
|
|
254
|
+
let sessions = false;
|
|
255
|
+
for (const file of snapshot.files) {
|
|
256
|
+
const normalized = toPosix(file.path);
|
|
257
|
+
if (!normalized || file.path.includes("\\") || normalized.length > 4096 || normalized.startsWith("../") || path2.posix.isAbsolute(normalized) || path2.posix.normalize(normalized) !== normalized || // biome-ignore lint/suspicious/noControlCharactersInRegex: Ignore unsafe legacy paths.
|
|
258
|
+
/[\u0000-\u001f\u007f-\u009f]/u.test(normalized) || isDeniedPath(normalized)) {
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
const [topLevel, ...rest] = normalized.split("/");
|
|
262
|
+
if (!topLevel) continue;
|
|
263
|
+
if (topLevel === "sessions" && rest.length > 0) {
|
|
264
|
+
sessions = true;
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
const builtIn = BUILT_IN_BY_LOWER.get(topLevel.toLowerCase());
|
|
268
|
+
if (builtIn && (TOP_LEVEL_DIRS.has(builtIn) && rest.length > 0 || !TOP_LEVEL_DIRS.has(builtIn) && rest.length === 0)) {
|
|
269
|
+
builtIns.add(builtIn);
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
if (isSafeCustomIncludePath(topLevel)) custom.add(topLevel);
|
|
273
|
+
}
|
|
274
|
+
return [
|
|
275
|
+
...BUILT_IN_SYNC_ROOTS.filter((item) => builtIns.has(item)),
|
|
276
|
+
...[...custom].sort((left, right) => left.localeCompare(right)),
|
|
277
|
+
...sessions ? ["sessions"] : []
|
|
278
|
+
];
|
|
279
|
+
}
|
|
280
|
+
function syncIncludeSelection(value) {
|
|
281
|
+
const include = normalizeSyncInclude(value);
|
|
282
|
+
const builtIns = include.filter(
|
|
283
|
+
(item) => BUILT_IN_BY_LOWER.has(item.toLowerCase())
|
|
284
|
+
);
|
|
285
|
+
const custom = include.filter(
|
|
286
|
+
(item) => item !== "sessions" && !BUILT_IN_BY_LOWER.has(item.toLowerCase())
|
|
287
|
+
);
|
|
288
|
+
return { include, builtIns, custom, sessions: include.includes("sessions") };
|
|
289
|
+
}
|
|
290
|
+
function customIncludePathsByLower(value) {
|
|
291
|
+
return new Map(
|
|
292
|
+
syncIncludeSelection(value).custom.map((relativePath) => [
|
|
293
|
+
relativePath.toLowerCase(),
|
|
294
|
+
relativePath
|
|
295
|
+
])
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
function includeFromSelectionConfig(config) {
|
|
299
|
+
if (config.include !== void 0) return normalizeSyncInclude(config.include);
|
|
300
|
+
return [
|
|
301
|
+
...normalizeSyncFiles(config.syncFiles),
|
|
302
|
+
...normalizeExtraFiles(config.extraFiles),
|
|
303
|
+
...config.syncSessions ? ["sessions"] : []
|
|
304
|
+
];
|
|
305
|
+
}
|
|
306
|
+
function isConfiguredSnapshotPath(relativePath, config, _legacyExtraFiles) {
|
|
307
|
+
const normalized = toPosix(relativePath);
|
|
308
|
+
const selection = syncIncludeSelection(includeFromSelectionConfig(config));
|
|
309
|
+
if (normalized.startsWith("sessions/")) return selection.sessions;
|
|
310
|
+
const lower = normalized.toLowerCase();
|
|
311
|
+
if (!normalized.includes("/")) {
|
|
312
|
+
const builtIn = BUILT_IN_BY_LOWER.get(lower);
|
|
313
|
+
if (builtIn) return selection.builtIns.includes(builtIn) && !TOP_LEVEL_DIRS.has(builtIn);
|
|
314
|
+
}
|
|
315
|
+
const topLevel = normalized.slice(0, normalized.indexOf("/"));
|
|
316
|
+
if (selection.builtIns.includes(topLevel) && TOP_LEVEL_DIRS.has(topLevel)) {
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
319
|
+
return selection.custom.some((candidate) => {
|
|
320
|
+
const candidateLower = candidate.toLowerCase();
|
|
321
|
+
return lower === candidateLower || lower.startsWith(`${candidateLower}/`);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function canonicalSnapshotPathForConfig(relativePath, includePaths) {
|
|
325
|
+
const normalized = toPosix(relativePath);
|
|
326
|
+
const lower = normalized.toLowerCase();
|
|
327
|
+
return TOP_LEVEL_FILE_PATHS.get(lower) ?? includePaths.get(lower) ?? normalized;
|
|
328
|
+
}
|
|
329
|
+
function isPreservableUnmanagedSnapshotPath(relativePath) {
|
|
330
|
+
const normalized = toPosix(relativePath);
|
|
331
|
+
if (!normalized || isDeniedPath(normalized)) return false;
|
|
332
|
+
if (normalized.startsWith("sessions/")) return normalized.endsWith(".jsonl");
|
|
333
|
+
if (!normalized.includes("/")) {
|
|
334
|
+
const lower = normalized.toLowerCase();
|
|
335
|
+
return TOP_LEVEL_FILE_PATHS.has(lower) || !RESERVED_TOP_LEVEL_NAMES.has(lower);
|
|
336
|
+
}
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
function isSafeCustomIncludePath(relativePath) {
|
|
340
|
+
try {
|
|
341
|
+
validateAgentRelativeInclude(relativePath);
|
|
342
|
+
return true;
|
|
343
|
+
} catch {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function normalizeSyncFiles(value) {
|
|
348
|
+
if (value === void 0) return [...DEFAULT_SYNC_INCLUDE];
|
|
349
|
+
if (Array.isArray(value)) {
|
|
350
|
+
return normalizeSyncInclude(value).filter(
|
|
351
|
+
(item) => BUILT_IN_BY_LOWER.has(item.toLowerCase())
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
throw new Error("Invalid pi-sync settings: expected an include array.");
|
|
355
|
+
}
|
|
356
|
+
function normalizeExtraFiles(value) {
|
|
357
|
+
if (!Array.isArray(value)) return [];
|
|
358
|
+
return value.filter(
|
|
359
|
+
(item) => typeof item === "string" && isSafeCustomIncludePath(item)
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export {
|
|
364
|
+
isDeniedPath,
|
|
365
|
+
isPathInside,
|
|
366
|
+
safeJoin,
|
|
367
|
+
assertWithinRoot,
|
|
368
|
+
encodeKey,
|
|
369
|
+
posixJoin,
|
|
370
|
+
parentPaths,
|
|
371
|
+
toPosix,
|
|
372
|
+
BUILT_IN_SYNC_ROOTS,
|
|
373
|
+
DEFAULT_SYNC_INCLUDE,
|
|
374
|
+
normalizeSyncInclude,
|
|
375
|
+
portableSnapshotSelection,
|
|
376
|
+
snapshotSelectionInclude,
|
|
377
|
+
selectionForSnapshot,
|
|
378
|
+
sameSyncInclude,
|
|
379
|
+
compareSyncInclude,
|
|
380
|
+
inspectRemoteSelection,
|
|
381
|
+
RemoteSelectionMismatchError,
|
|
382
|
+
remoteSelectionMismatch,
|
|
383
|
+
formatRemoteSelectionMismatch,
|
|
384
|
+
syncIncludeSelection,
|
|
385
|
+
customIncludePathsByLower,
|
|
386
|
+
includeFromSelectionConfig,
|
|
387
|
+
isConfiguredSnapshotPath,
|
|
388
|
+
canonicalSnapshotPathForConfig,
|
|
389
|
+
isPreservableUnmanagedSnapshotPath,
|
|
390
|
+
isSafeCustomIncludePath,
|
|
391
|
+
normalizeSyncFiles,
|
|
392
|
+
normalizeExtraFiles
|
|
393
|
+
};
|
|
394
|
+
//# sourceMappingURL=chunk-YQ6UW7IF.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/paths.ts", "../../src/sync-policy.ts"],
|
|
4
|
+
"sourcesContent": ["import path from \"node:path\";\n\nexport function isDeniedPath(relativePath: string) {\n\tconst normalized = toPosix(relativePath);\n\tconst lower = normalized.toLowerCase();\n\tconst segments = lower.split(\"/\");\n\tconst base = path.posix.basename(lower);\n\treturn (\n\t\tsegments.includes(\"node_modules\") ||\n\t\tsegments.includes(\".git\") ||\n\t\tsegments.includes(\".pisync\") ||\n\t\tsegments.includes(\"pi-sync\") ||\n\t\tsegments.includes(\".pi-sync-state-migration.lock\") ||\n\t\tbase === \".env\" ||\n\t\tbase.startsWith(\".env.\") ||\n\t\tbase.endsWith(\".env\") ||\n\t\tbase.includes(\"secret\") ||\n\t\tbase.includes(\"token\") ||\n\t\tbase === \"pi-sync.json\" ||\n\t\tbase.startsWith(\"pi-sync.json.\") ||\n\t\tbase.startsWith(\".pi-sync.json.\") ||\n\t\tbase === \"pi-sync.local.json\" ||\n\t\tbase.startsWith(\"pi-sync.local.json.\") ||\n\t\tbase.startsWith(\".pi-sync.local.json.\")\n\t);\n}\n\nexport function isPathInside(parent: string, child: string) {\n\tconst relative = path.relative(path.resolve(parent), path.resolve(child));\n\treturn relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n\nexport function safeJoin(root: string, relativePath: string) {\n\tconst target = path.resolve(root, relativePath);\n\tassertWithinRoot(root, target, relativePath);\n\treturn target;\n}\n\nexport function assertWithinRoot(root: string, target: string, label = target) {\n\tconst resolvedRoot = path.resolve(root);\n\tconst resolvedTarget = path.resolve(target);\n\tif (resolvedTarget !== resolvedRoot && !resolvedTarget.startsWith(`${resolvedRoot}${path.sep}`)) {\n\t\tthrow new Error(`Unsafe path in snapshot: ${label}`);\n\t}\n}\n\nexport function encodeKey(key: string) {\n\treturn key.split(\"/\").map(encodeURIComponent).join(\"/\");\n}\n\nexport function posixJoin(...parts: string[]) {\n\treturn parts\n\t\t.map((part) => trimSlashes(part))\n\t\t.filter(Boolean)\n\t\t.join(\"/\");\n}\n\nexport function parentPaths(relativePath: string) {\n\tconst results: string[] = [];\n\tlet index = relativePath.lastIndexOf(\"/\");\n\twhile (index > 0) {\n\t\tresults.push(relativePath.slice(0, index));\n\t\tindex = relativePath.lastIndexOf(\"/\", index - 1);\n\t}\n\treturn results;\n}\n\nexport function toPosix(value: string) {\n\treturn value.split(path.sep).join(\"/\");\n}\n\nfunction trimSlashes(value: string) {\n\treturn value.replace(/^\\/+|\\/+$/g, \"\");\n}\n\nexport function safeName(value: string) {\n\treturn value.replace(/[^A-Za-z0-9._-]/g, \"_\");\n}\n", "import path from \"node:path\";\nimport { isDeniedPath, toPosix } from \"./paths.js\";\nimport type { Snapshot, SnapshotSelection } from \"./types.js\";\n\nexport const BUILT_IN_SYNC_ROOTS = [\n\t\"settings.json\",\n\t\"keybindings.json\",\n\t\"models.json\",\n\t\"AGENTS.md\",\n\t\"APPEND_SYSTEM.md\",\n\t\"skills\",\n\t\"prompts\",\n\t\"themes\",\n\t\"extensions\",\n] as const;\n\nexport const DEFAULT_SYNC_INCLUDE = [...BUILT_IN_SYNC_ROOTS] as const;\nexport type BuiltInSyncFile = (typeof BUILT_IN_SYNC_ROOTS)[number];\nconst SNAPSHOT_SELECTION_VERSION = 1;\nconst MAX_SYNC_INCLUDE_ITEMS = 1_024;\nconst MAX_SYNC_INCLUDE_PATH_BYTES = 4_096;\nconst MAX_SYNC_INCLUDE_TOTAL_BYTES = 256 * 1_024;\n\ninterface IncludePathNode {\n\tselected?: string;\n\tchildren: Map<string, IncludePathNode>;\n}\n\nconst BUILT_IN_BY_LOWER = new Map<string, BuiltInSyncFile>(\n\tBUILT_IN_SYNC_ROOTS.map((fileName) => [fileName.toLowerCase(), fileName]),\n);\nconst TOP_LEVEL_FILE_PATHS = new Map<string, string>(\n\tBUILT_IN_SYNC_ROOTS.filter((fileName) => fileName.includes(\".\")).map((fileName) => [\n\t\tfileName.toLowerCase(),\n\t\tfileName,\n\t]),\n);\nconst TOP_LEVEL_DIRS = new Set<string>(\n\tBUILT_IN_SYNC_ROOTS.filter((fileName) => !fileName.includes(\".\")),\n);\nconst RESERVED_TOP_LEVEL_NAMES = new Set<string>([...BUILT_IN_BY_LOWER.keys(), \"sessions\"]);\n\nexport function normalizeSyncInclude(value: unknown): string[] {\n\tif (!Array.isArray(value)) {\n\t\tthrow new Error(\"Invalid pi-sync settings: sync.include must be an array.\");\n\t}\n\tif (value.length > MAX_SYNC_INCLUDE_ITEMS) {\n\t\tthrow new Error(\n\t\t\t`Invalid pi-sync settings: sync.include has too many items; limit: ${MAX_SYNC_INCLUDE_ITEMS}.`,\n\t\t);\n\t}\n\tconst result: string[] = [];\n\tconst seen = new Set<string>();\n\tconst pathRoot: IncludePathNode = { children: new Map() };\n\tlet totalBytes = 0;\n\tfor (const item of value) {\n\t\tif (typeof item !== \"string\") {\n\t\t\tthrow new Error(\"Invalid pi-sync settings: sync.include items must be strings.\");\n\t\t}\n\t\tconst itemBytes = Buffer.byteLength(item, \"utf8\");\n\t\tif (itemBytes > MAX_SYNC_INCLUDE_PATH_BYTES) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid pi-sync settings: sync.include item is too long; limit: ${MAX_SYNC_INCLUDE_PATH_BYTES} bytes.`,\n\t\t\t);\n\t\t}\n\t\ttotalBytes += itemBytes;\n\t\tif (totalBytes > MAX_SYNC_INCLUDE_TOTAL_BYTES) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid pi-sync settings: sync.include is too large; limit: ${MAX_SYNC_INCLUDE_TOTAL_BYTES} bytes.`,\n\t\t\t);\n\t\t}\n\t\tconst trimmed = item.trim();\n\t\tconst builtIn = BUILT_IN_BY_LOWER.get(trimmed.toLowerCase());\n\t\tconst normalized = builtIn ?? (trimmed.toLowerCase() === \"sessions\" ? \"sessions\" : trimmed);\n\t\tif (!builtIn && normalized !== \"sessions\") validateAgentRelativeInclude(normalized);\n\t\tconst identity = normalized.toLowerCase();\n\t\tif (seen.has(identity)) {\n\t\t\tthrow new Error(`Invalid pi-sync settings: duplicate sync.include item: ${item}`);\n\t\t}\n\t\taddIncludePath(pathRoot, identity, item);\n\t\tseen.add(identity);\n\t\tresult.push(normalized);\n\t}\n\treturn result;\n}\n\nfunction addIncludePath(root: IncludePathNode, identity: string, source: string) {\n\tlet node = root;\n\tfor (const segment of identity.split(\"/\")) {\n\t\tif (node.selected !== undefined) throwOverlappingInclude(source);\n\t\tlet child = node.children.get(segment);\n\t\tif (!child) {\n\t\t\tchild = { children: new Map() };\n\t\t\tnode.children.set(segment, child);\n\t\t}\n\t\tnode = child;\n\t}\n\tif (node.children.size > 0) throwOverlappingInclude(source);\n\tnode.selected = identity;\n}\n\nfunction throwOverlappingInclude(item: string): never {\n\tthrow new Error(\n\t\t`Invalid pi-sync settings: overlapping sync.include items are ambiguous: ${item}`,\n\t);\n}\n\nfunction validateAgentRelativeInclude(value: string) {\n\tconst normalized = toPosix(value);\n\tconst topLevel = normalized.split(\"/\")[0]?.toLowerCase();\n\tif (\n\t\t!normalized ||\n\t\tnormalized === \".\" ||\n\t\tnormalized === \"..\" ||\n\t\tnormalized.startsWith(\"../\") ||\n\t\tpath.posix.isAbsolute(normalized) ||\n\t\tnormalized.includes(\"\\\\\") ||\n\t\tpath.posix.normalize(normalized) !== normalized ||\n\t\t// biome-ignore lint/suspicious/noControlCharactersInRegex: Include paths cannot contain controls.\n\t\t/[\\u0000-\\u001f\\u007f-\\u009f]/u.test(normalized)\n\t) {\n\t\tthrow new Error(\n\t\t\t`Invalid pi-sync settings: sync.include item must be a safe agent-relative path: ${value}`,\n\t\t);\n\t}\n\tif (isDeniedPath(normalized)) {\n\t\tthrow new Error(`Invalid pi-sync settings: ${value} cannot be synced.`);\n\t}\n\tif (topLevel && RESERVED_TOP_LEVEL_NAMES.has(topLevel)) {\n\t\tthrow new Error(\n\t\t\t`Invalid pi-sync settings: use the canonical ${topLevel} root instead of a nested sync.include path.`,\n\t\t);\n\t}\n}\n\nexport function portableSnapshotSelection(value: unknown): SnapshotSelection {\n\tconst selection = value as Partial<SnapshotSelection> | null;\n\tif (\n\t\t!selection ||\n\t\ttypeof selection !== \"object\" ||\n\t\tArray.isArray(selection) ||\n\t\tselection.version !== SNAPSHOT_SELECTION_VERSION ||\n\t\t!Object.hasOwn(selection, \"include\") ||\n\t\tObject.keys(selection).some((key) => key !== \"version\" && key !== \"include\")\n\t) {\n\t\tthrow new Error(\"Invalid snapshot selection policy.\");\n\t}\n\treturn {\n\t\tversion: SNAPSHOT_SELECTION_VERSION,\n\t\tinclude: normalizeSyncInclude(selection.include),\n\t};\n}\n\nexport function snapshotSelectionInclude(snapshot: Pick<Snapshot, \"selection\">) {\n\treturn snapshot.selection === undefined\n\t\t? undefined\n\t\t: portableSnapshotSelection(snapshot.selection).include;\n}\n\nexport function selectionForSnapshot(include: unknown): SnapshotSelection {\n\treturn { version: SNAPSHOT_SELECTION_VERSION, include: normalizeSyncInclude(include) };\n}\n\nexport function sameSyncInclude(left: unknown, right: unknown) {\n\tconst normalizedLeft = normalizeSyncInclude(left);\n\tconst normalizedRight = normalizeSyncInclude(right);\n\treturn (\n\t\tnormalizedLeft.length === normalizedRight.length &&\n\t\tnormalizedLeft.every((item, index) => item === normalizedRight[index])\n\t);\n}\n\nexport function compareSyncInclude(local: unknown, remote: unknown) {\n\tconst localInclude = normalizeSyncInclude(local);\n\tconst remoteInclude = normalizeSyncInclude(remote);\n\tconst localSet = new Set(localInclude);\n\tconst remoteSet = new Set(remoteInclude);\n\treturn {\n\t\tsame: sameSyncInclude(localInclude, remoteInclude),\n\t\tremoteOnly: remoteInclude.filter((item) => !localSet.has(item)),\n\t\tlocalOnly: localInclude.filter((item) => !remoteSet.has(item)),\n\t};\n}\n\nexport type RemoteSelectionState =\n\t| { kind: \"legacy\"; discovered: string[] }\n\t| { kind: \"same\"; include: string[] }\n\t| {\n\t\t\tkind: \"different\";\n\t\t\tinclude: string[];\n\t\t\tremoteOnly: string[];\n\t\t\tlocalOnly: string[];\n\t };\n\nexport function inspectRemoteSelection(\n\tlocalInclude: unknown,\n\tsnapshot: Pick<Snapshot, \"selection\" | \"files\">,\n): RemoteSelectionState {\n\tconst remoteInclude = snapshotSelectionInclude(snapshot);\n\tif (!remoteInclude) {\n\t\treturn { kind: \"legacy\", discovered: discoverLegacySnapshotInclude(snapshot) };\n\t}\n\tconst comparison = compareSyncInclude(localInclude, remoteInclude);\n\treturn comparison.same\n\t\t? { kind: \"same\", include: remoteInclude }\n\t\t: { kind: \"different\", include: remoteInclude, ...comparison };\n}\n\nexport interface RemoteSelectionDecision {\n\tsetupName: string;\n\tconfigIdentity: string;\n\tlocalInclude: readonly string[];\n\tremoteInclude: readonly string[];\n}\n\nexport class RemoteSelectionMismatchError extends Error {\n\treadonly decision: RemoteSelectionDecision;\n\treadonly setupName: string;\n\treadonly localInclude: string[];\n\treadonly remoteInclude: string[];\n\n\tconstructor(\n\t\tsetupName: string,\n\t\tlocalInclude: unknown,\n\t\tremoteInclude: unknown,\n\t\tconfigIdentity = JSON.stringify([setupName, normalizeSyncInclude(localInclude)]),\n\t) {\n\t\tconst local = normalizeSyncInclude(localInclude);\n\t\tconst remote = normalizeSyncInclude(remoteInclude);\n\t\tsuper(formatRemoteSelectionMismatch(setupName, local, remote));\n\t\tthis.name = \"RemoteSelectionMismatchError\";\n\t\tthis.setupName = setupName;\n\t\tthis.localInclude = local;\n\t\tthis.remoteInclude = remote;\n\t\tthis.decision = {\n\t\t\tsetupName,\n\t\t\tconfigIdentity,\n\t\t\tlocalInclude: [...local],\n\t\t\tremoteInclude: [...remote],\n\t\t};\n\t}\n}\n\nexport function remoteSelectionMismatch(\n\tconfig: { setupName: string; include: unknown },\n\tremoteInclude: unknown,\n\tconfigIdentity?: string,\n) {\n\treturn new RemoteSelectionMismatchError(\n\t\tconfig.setupName,\n\t\tconfig.include,\n\t\tremoteInclude,\n\t\tconfigIdentity,\n\t);\n}\n\nexport function formatRemoteSelectionMismatch(\n\tsetupName: string,\n\tlocalInclude: readonly string[],\n\tremoteInclude: readonly string[],\n) {\n\tconst comparison = compareSyncInclude(localInclude, remoteInclude);\n\tconst lines = [\n\t\t`Synced content differs for sync setup \u201C${stripTerminalControls(setupName)}\u201D.`,\n\t\t`Remote-only: ${comparison.remoteOnly.join(\", \") || \"none\"}`,\n\t\t`This-device-only: ${comparison.localOnly.join(\", \") || \"none\"}`,\n\t];\n\tif (comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0) {\n\t\tlines.push(\n\t\t\t\"Only ordering differs.\",\n\t\t\t`Remote order: ${remoteInclude.join(\", \") || \"none\"}`,\n\t\t\t`This device order: ${localInclude.join(\", \") || \"none\"}`,\n\t\t);\n\t}\n\tlines.push(\"Run /sync in TUI to review both content lists and choose what happens next.\");\n\treturn lines.join(\"\\n\");\n}\n\nfunction stripTerminalControls(value: string) {\n\t// biome-ignore lint/suspicious/noControlCharactersInRegex: Escape untrusted terminal controls.\n\treturn value.replace(/[\\u0000-\\u001f\\u007f-\\u009f]/gu, \"?\");\n}\n\nexport function discoverLegacySnapshotInclude(snapshot: Pick<Snapshot, \"files\">) {\n\tconst builtIns = new Set<BuiltInSyncFile>();\n\tconst custom = new Set<string>();\n\tlet sessions = false;\n\tfor (const file of snapshot.files) {\n\t\tconst normalized = toPosix(file.path);\n\t\tif (\n\t\t\t!normalized ||\n\t\t\tfile.path.includes(\"\\\\\") ||\n\t\t\tnormalized.length > 4096 ||\n\t\t\tnormalized.startsWith(\"../\") ||\n\t\t\tpath.posix.isAbsolute(normalized) ||\n\t\t\tpath.posix.normalize(normalized) !== normalized ||\n\t\t\t// biome-ignore lint/suspicious/noControlCharactersInRegex: Ignore unsafe legacy paths.\n\t\t\t/[\\u0000-\\u001f\\u007f-\\u009f]/u.test(normalized) ||\n\t\t\tisDeniedPath(normalized)\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst [topLevel, ...rest] = normalized.split(\"/\");\n\t\tif (!topLevel) continue;\n\t\tif (topLevel === \"sessions\" && rest.length > 0) {\n\t\t\tsessions = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst builtIn = BUILT_IN_BY_LOWER.get(topLevel.toLowerCase());\n\t\tif (\n\t\t\tbuiltIn &&\n\t\t\t((TOP_LEVEL_DIRS.has(builtIn) && rest.length > 0) ||\n\t\t\t\t(!TOP_LEVEL_DIRS.has(builtIn) && rest.length === 0))\n\t\t) {\n\t\t\tbuiltIns.add(builtIn);\n\t\t\tcontinue;\n\t\t}\n\t\tif (isSafeCustomIncludePath(topLevel)) custom.add(topLevel);\n\t}\n\treturn [\n\t\t...BUILT_IN_SYNC_ROOTS.filter((item) => builtIns.has(item)),\n\t\t...[...custom].sort((left, right) => left.localeCompare(right)),\n\t\t...(sessions ? [\"sessions\"] : []),\n\t];\n}\n\nexport function syncIncludeSelection(value: unknown) {\n\tconst include = normalizeSyncInclude(value);\n\tconst builtIns = include.filter((item): item is BuiltInSyncFile =>\n\t\tBUILT_IN_BY_LOWER.has(item.toLowerCase()),\n\t);\n\tconst custom = include.filter(\n\t\t(item) => item !== \"sessions\" && !BUILT_IN_BY_LOWER.has(item.toLowerCase()),\n\t);\n\treturn { include, builtIns, custom, sessions: include.includes(\"sessions\") };\n}\n\nexport function customIncludePathsByLower(value: unknown) {\n\treturn new Map(\n\t\tsyncIncludeSelection(value).custom.map((relativePath) => [\n\t\t\trelativePath.toLowerCase(),\n\t\t\trelativePath,\n\t\t]),\n\t);\n}\n\nexport interface SyncSelectionConfig {\n\tinclude?: unknown;\n\tsyncFiles?: unknown;\n\tsyncSessions?: boolean;\n\textraFiles?: unknown;\n}\n\nexport function includeFromSelectionConfig(config: SyncSelectionConfig) {\n\tif (config.include !== undefined) return normalizeSyncInclude(config.include);\n\treturn [\n\t\t...normalizeSyncFiles(config.syncFiles),\n\t\t...normalizeExtraFiles(config.extraFiles),\n\t\t...(config.syncSessions ? [\"sessions\"] : []),\n\t];\n}\n\nexport function isConfiguredSnapshotPath(\n\trelativePath: string,\n\tconfig: SyncSelectionConfig,\n\t_legacyExtraFiles?: Set<string>,\n) {\n\tconst normalized = toPosix(relativePath);\n\tconst selection = syncIncludeSelection(includeFromSelectionConfig(config));\n\tif (normalized.startsWith(\"sessions/\")) return selection.sessions;\n\tconst lower = normalized.toLowerCase();\n\tif (!normalized.includes(\"/\")) {\n\t\tconst builtIn = BUILT_IN_BY_LOWER.get(lower);\n\t\tif (builtIn) return selection.builtIns.includes(builtIn) && !TOP_LEVEL_DIRS.has(builtIn);\n\t}\n\tconst topLevel = normalized.slice(0, normalized.indexOf(\"/\"));\n\tif (selection.builtIns.includes(topLevel as BuiltInSyncFile) && TOP_LEVEL_DIRS.has(topLevel)) {\n\t\treturn true;\n\t}\n\treturn selection.custom.some((candidate) => {\n\t\tconst candidateLower = candidate.toLowerCase();\n\t\treturn lower === candidateLower || lower.startsWith(`${candidateLower}/`);\n\t});\n}\n\nexport function canonicalSnapshotPathForConfig(\n\trelativePath: string,\n\tincludePaths: Map<string, string>,\n) {\n\tconst normalized = toPosix(relativePath);\n\tconst lower = normalized.toLowerCase();\n\treturn TOP_LEVEL_FILE_PATHS.get(lower) ?? includePaths.get(lower) ?? normalized;\n}\n\nexport function isPreservableUnmanagedSnapshotPath(relativePath: string) {\n\tconst normalized = toPosix(relativePath);\n\tif (!normalized || isDeniedPath(normalized)) return false;\n\tif (normalized.startsWith(\"sessions/\")) return normalized.endsWith(\".jsonl\");\n\tif (!normalized.includes(\"/\")) {\n\t\tconst lower = normalized.toLowerCase();\n\t\treturn TOP_LEVEL_FILE_PATHS.has(lower) || !RESERVED_TOP_LEVEL_NAMES.has(lower);\n\t}\n\treturn true;\n}\n\nexport function isSafeCustomIncludePath(relativePath: string) {\n\ttry {\n\t\tvalidateAgentRelativeInclude(relativePath);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function isBuiltInTopLevelFile(fileName: string) {\n\treturn TOP_LEVEL_FILE_PATHS.has(path.posix.basename(fileName).toLowerCase());\n}\n\n/** Compatibility projection for backend-neutral output while callers move to sync.include. */\nexport function normalizeSyncFiles(value: unknown): BuiltInSyncFile[] {\n\tif (value === undefined) return [...DEFAULT_SYNC_INCLUDE];\n\tif (Array.isArray(value)) {\n\t\treturn normalizeSyncInclude(value).filter((item): item is BuiltInSyncFile =>\n\t\t\tBUILT_IN_BY_LOWER.has(item.toLowerCase()),\n\t\t);\n\t}\n\tthrow new Error(\"Invalid pi-sync settings: expected an include array.\");\n}\n\n/** Compatibility projection for old rendering helpers; v3 persistence never writes this split field. */\nexport function normalizeExtraFiles(value: unknown) {\n\tif (!Array.isArray(value)) return [];\n\treturn value.filter(\n\t\t(item): item is string => typeof item === \"string\" && isSafeCustomIncludePath(item),\n\t);\n}\n\nexport const extraFilePathsByLower = customIncludePathsByLower;\nexport const isSafeExtraFileName = isSafeCustomIncludePath;\nexport const selectedSyncFileSet = (value: unknown) => new Set(normalizeSyncFiles(value));\n"],
|
|
5
|
+
"mappings": ";;;;AAAA,OAAO,UAAU;AAEV,SAAS,aAAa,cAAsB;AAClD,QAAM,aAAa,QAAQ,YAAY;AACvC,QAAM,QAAQ,WAAW,YAAY;AACrC,QAAM,WAAW,MAAM,MAAM,GAAG;AAChC,QAAM,OAAO,KAAK,MAAM,SAAS,KAAK;AACtC,SACC,SAAS,SAAS,cAA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