pushwork 2.0.0-a.sub.1 → 2.0.0-preview.2
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/dist/branches.d.ts +20 -0
- package/dist/branches.d.ts.map +1 -0
- package/dist/branches.js +111 -0
- package/dist/branches.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +245 -270
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +84 -0
- package/dist/config.js.map +1 -0
- package/dist/fs-tree.d.ts +6 -0
- package/dist/fs-tree.d.ts.map +1 -0
- package/dist/fs-tree.js +99 -0
- package/dist/fs-tree.js.map +1 -0
- package/dist/ignore.d.ts +6 -0
- package/dist/ignore.d.ts.map +1 -0
- package/dist/ignore.js +74 -0
- package/dist/ignore.js.map +1 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -4
- package/dist/index.js.map +1 -1
- package/dist/log.d.ts +3 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +14 -0
- package/dist/log.js.map +1 -0
- package/dist/pushwork.d.ts +129 -0
- package/dist/pushwork.d.ts.map +1 -0
- package/dist/pushwork.js +1062 -0
- package/dist/pushwork.js.map +1 -0
- package/dist/repo.d.ts +14 -0
- package/dist/repo.d.ts.map +1 -0
- package/dist/repo.js +60 -0
- package/dist/repo.js.map +1 -0
- package/dist/shapes/custom.d.ts +3 -0
- package/dist/shapes/custom.d.ts.map +1 -0
- package/dist/shapes/custom.js +57 -0
- package/dist/shapes/custom.js.map +1 -0
- package/dist/shapes/file.d.ts +20 -0
- package/dist/shapes/file.d.ts.map +1 -0
- package/dist/shapes/file.js +140 -0
- package/dist/shapes/file.js.map +1 -0
- package/dist/shapes/index.d.ts +10 -0
- package/dist/shapes/index.d.ts.map +1 -0
- package/dist/shapes/index.js +35 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/patchwork-folder.d.ts +3 -0
- package/dist/shapes/patchwork-folder.d.ts.map +1 -0
- package/dist/shapes/patchwork-folder.js +160 -0
- package/dist/shapes/patchwork-folder.js.map +1 -0
- package/dist/shapes/types.d.ts +38 -0
- package/dist/shapes/types.d.ts.map +1 -0
- package/dist/shapes/types.js +52 -0
- package/dist/shapes/types.js.map +1 -0
- package/dist/shapes/vfs.d.ts +3 -0
- package/dist/shapes/vfs.d.ts.map +1 -0
- package/dist/shapes/vfs.js +92 -0
- package/dist/shapes/vfs.js.map +1 -0
- package/dist/stash.d.ts +23 -0
- package/dist/stash.d.ts.map +1 -0
- package/dist/stash.js +118 -0
- package/dist/stash.js.map +1 -0
- package/dist/version.d.ts +11 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +93 -0
- package/dist/version.js.map +1 -0
- package/package.json +19 -48
- package/patches/@automerge__automerge-repo@2.6.0-subduction.15.patch +26 -0
- package/.prettierrc +0 -9
- package/ARCHITECTURE-ACCORDING-TO-CLAUDE.md +0 -248
- package/CLAUDE.md +0 -141
- package/README.md +0 -221
- package/babel.config.js +0 -5
- package/dist/cli/commands.d.ts +0 -71
- package/dist/cli/commands.d.ts.map +0 -1
- package/dist/cli/commands.js +0 -794
- package/dist/cli/commands.js.map +0 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -19
- package/dist/cli/index.js.map +0 -1
- package/dist/commands.d.ts +0 -61
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -861
- package/dist/commands.js.map +0 -1
- package/dist/config/index.d.ts +0 -71
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -314
- package/dist/config/index.js.map +0 -1
- package/dist/core/change-detection.d.ts +0 -80
- package/dist/core/change-detection.d.ts.map +0 -1
- package/dist/core/change-detection.js +0 -523
- package/dist/core/change-detection.js.map +0 -1
- package/dist/core/config.d.ts +0 -81
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js +0 -258
- package/dist/core/config.js.map +0 -1
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -6
- package/dist/core/index.js.map +0 -1
- package/dist/core/move-detection.d.ts +0 -34
- package/dist/core/move-detection.d.ts.map +0 -1
- package/dist/core/move-detection.js +0 -121
- package/dist/core/move-detection.js.map +0 -1
- package/dist/core/snapshot.d.ts +0 -105
- package/dist/core/snapshot.d.ts.map +0 -1
- package/dist/core/snapshot.js +0 -217
- package/dist/core/snapshot.js.map +0 -1
- package/dist/core/sync-engine.d.ts +0 -157
- package/dist/core/sync-engine.d.ts.map +0 -1
- package/dist/core/sync-engine.js +0 -1379
- package/dist/core/sync-engine.js.map +0 -1
- package/dist/types/config.d.ts +0 -99
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js +0 -5
- package/dist/types/config.js.map +0 -1
- package/dist/types/documents.d.ts +0 -88
- package/dist/types/documents.d.ts.map +0 -1
- package/dist/types/documents.js +0 -20
- package/dist/types/documents.js.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -4
- package/dist/types/index.js.map +0 -1
- package/dist/types/snapshot.d.ts +0 -64
- package/dist/types/snapshot.d.ts.map +0 -1
- package/dist/types/snapshot.js +0 -2
- package/dist/types/snapshot.js.map +0 -1
- package/dist/utils/content-similarity.d.ts +0 -53
- package/dist/utils/content-similarity.d.ts.map +0 -1
- package/dist/utils/content-similarity.js +0 -155
- package/dist/utils/content-similarity.js.map +0 -1
- package/dist/utils/content.d.ts +0 -10
- package/dist/utils/content.d.ts.map +0 -1
- package/dist/utils/content.js +0 -31
- package/dist/utils/content.js.map +0 -1
- package/dist/utils/directory.d.ts +0 -24
- package/dist/utils/directory.d.ts.map +0 -1
- package/dist/utils/directory.js +0 -52
- package/dist/utils/directory.js.map +0 -1
- package/dist/utils/fs.d.ts +0 -74
- package/dist/utils/fs.d.ts.map +0 -1
- package/dist/utils/fs.js +0 -248
- package/dist/utils/fs.js.map +0 -1
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -5
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/mime-types.d.ts +0 -13
- package/dist/utils/mime-types.d.ts.map +0 -1
- package/dist/utils/mime-types.js +0 -209
- package/dist/utils/mime-types.js.map +0 -1
- package/dist/utils/network-sync.d.ts +0 -36
- package/dist/utils/network-sync.d.ts.map +0 -1
- package/dist/utils/network-sync.js +0 -250
- package/dist/utils/network-sync.js.map +0 -1
- package/dist/utils/node-polyfills.d.ts +0 -9
- package/dist/utils/node-polyfills.d.ts.map +0 -1
- package/dist/utils/node-polyfills.js +0 -9
- package/dist/utils/node-polyfills.js.map +0 -1
- package/dist/utils/output.d.ts +0 -129
- package/dist/utils/output.d.ts.map +0 -1
- package/dist/utils/output.js +0 -368
- package/dist/utils/output.js.map +0 -1
- package/dist/utils/repo-factory.d.ts +0 -13
- package/dist/utils/repo-factory.d.ts.map +0 -1
- package/dist/utils/repo-factory.js +0 -46
- package/dist/utils/repo-factory.js.map +0 -1
- package/dist/utils/string-similarity.d.ts +0 -14
- package/dist/utils/string-similarity.d.ts.map +0 -1
- package/dist/utils/string-similarity.js +0 -39
- package/dist/utils/string-similarity.js.map +0 -1
- package/dist/utils/text-diff.d.ts +0 -37
- package/dist/utils/text-diff.d.ts.map +0 -1
- package/dist/utils/text-diff.js +0 -93
- package/dist/utils/text-diff.js.map +0 -1
- package/dist/utils/trace.d.ts +0 -19
- package/dist/utils/trace.d.ts.map +0 -1
- package/dist/utils/trace.js +0 -63
- package/dist/utils/trace.js.map +0 -1
- package/src/cli.ts +0 -442
- package/src/commands.ts +0 -1134
- package/src/core/change-detection.ts +0 -712
- package/src/core/config.ts +0 -313
- package/src/core/index.ts +0 -5
- package/src/core/move-detection.ts +0 -169
- package/src/core/snapshot.ts +0 -275
- package/src/core/sync-engine.ts +0 -1795
- package/src/index.ts +0 -4
- package/src/types/config.ts +0 -111
- package/src/types/documents.ts +0 -91
- package/src/types/index.ts +0 -3
- package/src/types/snapshot.ts +0 -67
- package/src/utils/content.ts +0 -34
- package/src/utils/directory.ts +0 -73
- package/src/utils/fs.ts +0 -297
- package/src/utils/index.ts +0 -4
- package/src/utils/mime-types.ts +0 -244
- package/src/utils/network-sync.ts +0 -319
- package/src/utils/node-polyfills.ts +0 -8
- package/src/utils/output.ts +0 -450
- package/src/utils/repo-factory.ts +0 -73
- package/src/utils/string-similarity.ts +0 -54
- package/src/utils/text-diff.ts +0 -101
- package/src/utils/trace.ts +0 -70
- package/test/integration/README.md +0 -328
- package/test/integration/clone-test.sh +0 -310
- package/test/integration/conflict-resolution-test.sh +0 -309
- package/test/integration/debug-both-nested.sh +0 -74
- package/test/integration/debug-concurrent-nested.sh +0 -87
- package/test/integration/debug-nested.sh +0 -73
- package/test/integration/deletion-behavior-test.sh +0 -487
- package/test/integration/deletion-sync-test-simple.sh +0 -193
- package/test/integration/deletion-sync-test.sh +0 -297
- package/test/integration/exclude-patterns.test.ts +0 -144
- package/test/integration/full-integration-test.sh +0 -363
- package/test/integration/fuzzer.test.ts +0 -818
- package/test/integration/in-memory-sync.test.ts +0 -830
- package/test/integration/init-sync.test.ts +0 -89
- package/test/integration/manual-sync-test.sh +0 -84
- package/test/integration/sync-deletion.test.ts +0 -280
- package/test/integration/sync-flow.test.ts +0 -291
- package/test/jest.setup.ts +0 -34
- package/test/run-tests.sh +0 -225
- package/test/unit/deletion-behavior.test.ts +0 -249
- package/test/unit/enhanced-mime-detection.test.ts +0 -244
- package/test/unit/snapshot.test.ts +0 -404
- package/test/unit/sync-convergence.test.ts +0 -298
- package/test/unit/sync-timing.test.ts +0 -134
- package/test/unit/utils.test.ts +0 -366
- package/tsconfig.json +0 -23
|
@@ -1,523 +0,0 @@
|
|
|
1
|
-
import * as A from "@automerge/automerge";
|
|
2
|
-
import { ChangeType, FileType, } from "../types/index.js";
|
|
3
|
-
import { readFileContent, listDirectory, getRelativePath, findFileInDirectoryHierarchy, joinAndNormalizePath, getPlainUrl, readDocContent, } from "../utils/index.js";
|
|
4
|
-
import { isContentEqual, contentHash } from "../utils/content.js";
|
|
5
|
-
import { out } from "../utils/output.js";
|
|
6
|
-
const isDebug = !!process.env.DEBUG;
|
|
7
|
-
function debug(...args) {
|
|
8
|
-
if (isDebug)
|
|
9
|
-
console.error("[pushwork:change-detection]", ...args);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Change detection engine
|
|
13
|
-
*/
|
|
14
|
-
export class ChangeDetector {
|
|
15
|
-
constructor(repo, rootPath, excludePatterns = [], artifactDirectories = []) {
|
|
16
|
-
this.repo = repo;
|
|
17
|
-
this.rootPath = rootPath;
|
|
18
|
-
this.excludePatterns = excludePatterns;
|
|
19
|
-
this.artifactDirectories = artifactDirectories;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Check if a file path is inside an artifact directory.
|
|
23
|
-
* Artifact files use RawString and are always replaced wholesale,
|
|
24
|
-
* so we can skip expensive remote content reads for them.
|
|
25
|
-
*/
|
|
26
|
-
isArtifactPath(filePath) {
|
|
27
|
-
return this.artifactDirectories.some(dir => filePath === dir || filePath.startsWith(dir + "/"));
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Detect all changes between local filesystem and snapshot
|
|
31
|
-
*/
|
|
32
|
-
async detectChanges(snapshot, excludePaths) {
|
|
33
|
-
const changes = [];
|
|
34
|
-
// Get current filesystem state
|
|
35
|
-
const currentFiles = await this.getCurrentFilesystemState();
|
|
36
|
-
// Check for local changes (new, modified, deleted files)
|
|
37
|
-
const localChanges = await this.detectLocalChanges(snapshot, currentFiles);
|
|
38
|
-
changes.push(...localChanges);
|
|
39
|
-
// Check for remote changes (changes in Automerge documents)
|
|
40
|
-
const remoteChanges = await this.detectRemoteChanges(snapshot);
|
|
41
|
-
changes.push(...remoteChanges);
|
|
42
|
-
// Check for new remote documents not in snapshot (critical for clone scenarios)
|
|
43
|
-
const newRemoteDocuments = await this.detectNewRemoteDocuments(snapshot, excludePaths);
|
|
44
|
-
changes.push(...newRemoteDocuments);
|
|
45
|
-
return changes;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Detect changes in local filesystem compared to snapshot
|
|
49
|
-
*/
|
|
50
|
-
async detectLocalChanges(snapshot, currentFiles) {
|
|
51
|
-
const changes = [];
|
|
52
|
-
// Check for new and modified files in parallel for better performance
|
|
53
|
-
await Promise.all(Array.from(currentFiles.entries()).map(async ([relativePath, fileInfo]) => {
|
|
54
|
-
const snapshotEntry = snapshot.files.get(relativePath);
|
|
55
|
-
if (!snapshotEntry) {
|
|
56
|
-
// New file
|
|
57
|
-
changes.push({
|
|
58
|
-
path: relativePath,
|
|
59
|
-
changeType: ChangeType.LOCAL_ONLY,
|
|
60
|
-
fileType: fileInfo.type,
|
|
61
|
-
localContent: fileInfo.content,
|
|
62
|
-
remoteContent: null,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
else if (this.isArtifactPath(relativePath)) {
|
|
66
|
-
// Artifact files are always replaced wholesale (RawString).
|
|
67
|
-
// Skip remote doc content reads — compare local hash against
|
|
68
|
-
// stored hash to detect local changes, and check heads for remote.
|
|
69
|
-
const localHash = contentHash(fileInfo.content);
|
|
70
|
-
const localChanged = snapshotEntry.contentHash
|
|
71
|
-
? localHash !== snapshotEntry.contentHash
|
|
72
|
-
: true; // No stored hash = first sync with hash support, assume changed
|
|
73
|
-
const remoteHead = await this.getCurrentRemoteHead(snapshotEntry.url);
|
|
74
|
-
const remoteChanged = !A.equals(remoteHead, snapshotEntry.head);
|
|
75
|
-
if (localChanged || remoteChanged) {
|
|
76
|
-
changes.push({
|
|
77
|
-
path: relativePath,
|
|
78
|
-
changeType: localChanged && remoteChanged
|
|
79
|
-
? ChangeType.BOTH_CHANGED
|
|
80
|
-
: localChanged
|
|
81
|
-
? ChangeType.LOCAL_ONLY
|
|
82
|
-
: ChangeType.REMOTE_ONLY,
|
|
83
|
-
fileType: fileInfo.type,
|
|
84
|
-
localContent: fileInfo.content,
|
|
85
|
-
remoteContent: null,
|
|
86
|
-
localHead: snapshotEntry.head,
|
|
87
|
-
remoteHead,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
// Check if content changed
|
|
93
|
-
const lastKnownContent = await this.getContentAtHead(snapshotEntry.url, snapshotEntry.head);
|
|
94
|
-
const contentChanged = !isContentEqual(fileInfo.content, lastKnownContent);
|
|
95
|
-
if (contentChanged) {
|
|
96
|
-
// Check remote state too
|
|
97
|
-
const currentRemoteContent = await this.getCurrentRemoteContent(snapshotEntry.url);
|
|
98
|
-
const remoteChanged = !isContentEqual(lastKnownContent, currentRemoteContent);
|
|
99
|
-
const changeType = remoteChanged
|
|
100
|
-
? ChangeType.BOTH_CHANGED
|
|
101
|
-
: ChangeType.LOCAL_ONLY;
|
|
102
|
-
const remoteHead = await this.getCurrentRemoteHead(snapshotEntry.url);
|
|
103
|
-
changes.push({
|
|
104
|
-
path: relativePath,
|
|
105
|
-
changeType,
|
|
106
|
-
fileType: fileInfo.type,
|
|
107
|
-
localContent: fileInfo.content,
|
|
108
|
-
remoteContent: currentRemoteContent,
|
|
109
|
-
localHead: snapshotEntry.head,
|
|
110
|
-
remoteHead,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}));
|
|
115
|
-
// Check for deleted files in parallel
|
|
116
|
-
await Promise.all(Array.from(snapshot.files.entries())
|
|
117
|
-
.filter(([relativePath]) => !currentFiles.has(relativePath))
|
|
118
|
-
.map(async ([relativePath, snapshotEntry]) => {
|
|
119
|
-
if (this.isArtifactPath(relativePath)) {
|
|
120
|
-
// Artifact deletion: skip remote content read
|
|
121
|
-
const remoteHead = await this.getCurrentRemoteHead(snapshotEntry.url);
|
|
122
|
-
const remoteChanged = !A.equals(remoteHead, snapshotEntry.head);
|
|
123
|
-
changes.push({
|
|
124
|
-
path: relativePath,
|
|
125
|
-
changeType: remoteChanged
|
|
126
|
-
? ChangeType.BOTH_CHANGED
|
|
127
|
-
: ChangeType.LOCAL_ONLY,
|
|
128
|
-
fileType: FileType.TEXT,
|
|
129
|
-
localContent: null,
|
|
130
|
-
remoteContent: null,
|
|
131
|
-
localHead: snapshotEntry.head,
|
|
132
|
-
remoteHead,
|
|
133
|
-
});
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
// File was deleted locally
|
|
137
|
-
const currentRemoteContent = await this.getCurrentRemoteContent(snapshotEntry.url);
|
|
138
|
-
const lastKnownContent = await this.getContentAtHead(snapshotEntry.url, snapshotEntry.head);
|
|
139
|
-
const remoteChanged = !isContentEqual(lastKnownContent, currentRemoteContent);
|
|
140
|
-
const changeType = remoteChanged
|
|
141
|
-
? ChangeType.BOTH_CHANGED
|
|
142
|
-
: ChangeType.LOCAL_ONLY;
|
|
143
|
-
changes.push({
|
|
144
|
-
path: relativePath,
|
|
145
|
-
changeType,
|
|
146
|
-
fileType: FileType.TEXT, // Will be determined from document
|
|
147
|
-
localContent: null,
|
|
148
|
-
remoteContent: currentRemoteContent,
|
|
149
|
-
localHead: snapshotEntry.head,
|
|
150
|
-
remoteHead: await this.getCurrentRemoteHead(snapshotEntry.url),
|
|
151
|
-
});
|
|
152
|
-
}));
|
|
153
|
-
return changes;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Detect changes in remote Automerge documents compared to snapshot
|
|
157
|
-
*/
|
|
158
|
-
async detectRemoteChanges(snapshot) {
|
|
159
|
-
const changes = [];
|
|
160
|
-
await Promise.all(Array.from(snapshot.files.entries()).map(async ([relativePath, snapshotEntry]) => {
|
|
161
|
-
// Find the file's current entry in the remote directory hierarchy
|
|
162
|
-
const remoteEntry = await this.findInRemoteDirectory(snapshot.rootDirectoryUrl, relativePath);
|
|
163
|
-
if (!remoteEntry) {
|
|
164
|
-
// File was removed from remote directory listing
|
|
165
|
-
const localContent = await this.getLocalContent(relativePath);
|
|
166
|
-
// Only report as deleted if local file still exists
|
|
167
|
-
// (if local file is also deleted, detectLocalChanges handles it)
|
|
168
|
-
if (localContent !== null) {
|
|
169
|
-
changes.push({
|
|
170
|
-
path: relativePath,
|
|
171
|
-
changeType: ChangeType.REMOTE_ONLY,
|
|
172
|
-
fileType: FileType.TEXT,
|
|
173
|
-
localContent,
|
|
174
|
-
remoteContent: null, // File deleted remotely
|
|
175
|
-
localHead: snapshotEntry.head,
|
|
176
|
-
remoteHead: snapshotEntry.head,
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
// Check if the document was replaced entirely (new URL).
|
|
182
|
-
// This happens when a peer replaces an artifact file, fixes a
|
|
183
|
-
// legacy immutable string, or recreates a failed document.
|
|
184
|
-
// The old snapshot URL is now orphaned — read from the new one.
|
|
185
|
-
const urlReplaced = getPlainUrl(remoteEntry.url) !== getPlainUrl(snapshotEntry.url);
|
|
186
|
-
const remoteUrl = urlReplaced ? remoteEntry.url : snapshotEntry.url;
|
|
187
|
-
const currentRemoteHead = await this.getCurrentRemoteHead(remoteUrl);
|
|
188
|
-
if (urlReplaced || !A.equals(currentRemoteHead, snapshotEntry.head)) {
|
|
189
|
-
if (this.isArtifactPath(relativePath)) {
|
|
190
|
-
// Artifact: skip content reads, just report head change
|
|
191
|
-
const localContent = await this.getLocalContent(relativePath);
|
|
192
|
-
changes.push({
|
|
193
|
-
path: relativePath,
|
|
194
|
-
changeType: localContent !== null
|
|
195
|
-
? ChangeType.BOTH_CHANGED
|
|
196
|
-
: ChangeType.REMOTE_ONLY,
|
|
197
|
-
fileType: FileType.TEXT,
|
|
198
|
-
localContent,
|
|
199
|
-
remoteContent: null,
|
|
200
|
-
localHead: snapshotEntry.head,
|
|
201
|
-
remoteHead: currentRemoteHead,
|
|
202
|
-
...(urlReplaced ? { remoteUrl: remoteEntry.url } : {}),
|
|
203
|
-
});
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
// Remote document has changed
|
|
207
|
-
const currentRemoteContent = await this.getCurrentRemoteContent(remoteUrl);
|
|
208
|
-
const localContent = await this.getLocalContent(relativePath);
|
|
209
|
-
const lastKnownContent = urlReplaced
|
|
210
|
-
? null // Can't diff against old doc when URL changed
|
|
211
|
-
: await this.getContentAtHead(snapshotEntry.url, snapshotEntry.head);
|
|
212
|
-
const localChanged = localContent && lastKnownContent
|
|
213
|
-
? !isContentEqual(localContent, lastKnownContent)
|
|
214
|
-
: localContent !== null;
|
|
215
|
-
const changeType = localChanged
|
|
216
|
-
? ChangeType.BOTH_CHANGED
|
|
217
|
-
: ChangeType.REMOTE_ONLY;
|
|
218
|
-
changes.push({
|
|
219
|
-
path: relativePath,
|
|
220
|
-
changeType,
|
|
221
|
-
fileType: await this.getFileTypeFromContent(currentRemoteContent),
|
|
222
|
-
localContent,
|
|
223
|
-
remoteContent: currentRemoteContent,
|
|
224
|
-
localHead: snapshotEntry.head,
|
|
225
|
-
remoteHead: currentRemoteHead,
|
|
226
|
-
...(urlReplaced ? { remoteUrl: remoteEntry.url } : {}),
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}));
|
|
230
|
-
return changes;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Detect new remote documents from directory hierarchy that aren't in snapshot
|
|
234
|
-
* This is critical for clone scenarios where local snapshot is empty
|
|
235
|
-
*/
|
|
236
|
-
async detectNewRemoteDocuments(snapshot, excludePaths) {
|
|
237
|
-
const changes = [];
|
|
238
|
-
// If no root directory URL, nothing to discover
|
|
239
|
-
if (!snapshot.rootDirectoryUrl) {
|
|
240
|
-
return changes;
|
|
241
|
-
}
|
|
242
|
-
try {
|
|
243
|
-
// Recursively traverse the directory hierarchy
|
|
244
|
-
await this.discoverRemoteDocumentsRecursive(snapshot.rootDirectoryUrl, "", snapshot, changes, excludePaths);
|
|
245
|
-
}
|
|
246
|
-
catch (error) {
|
|
247
|
-
out.taskLine(`Failed to discover remote documents: ${error}`, true);
|
|
248
|
-
}
|
|
249
|
-
return changes;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Recursively discover remote documents in directory hierarchy
|
|
253
|
-
*/
|
|
254
|
-
async discoverRemoteDocumentsRecursive(directoryUrl, currentPath, snapshot, changes, excludePaths) {
|
|
255
|
-
try {
|
|
256
|
-
// Find and wait for document to be available (retries on "unavailable")
|
|
257
|
-
const plainUrl = getPlainUrl(directoryUrl);
|
|
258
|
-
const result = await this.findDocument(plainUrl);
|
|
259
|
-
if (!result) {
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
const dirDoc = result.doc;
|
|
263
|
-
// Process each entry in the directory
|
|
264
|
-
for (const entry of dirDoc.docs) {
|
|
265
|
-
const entryPath = currentPath
|
|
266
|
-
? `${currentPath}/${entry.name}`
|
|
267
|
-
: entry.name;
|
|
268
|
-
if (entry.type === "file") {
|
|
269
|
-
// Skip files that were deliberately deleted during this sync cycle
|
|
270
|
-
if (excludePaths?.has(entryPath)) {
|
|
271
|
-
debug(`skipping deleted path during re-detection: ${entryPath}`);
|
|
272
|
-
continue;
|
|
273
|
-
}
|
|
274
|
-
// Check if this file is already tracked in the snapshot
|
|
275
|
-
const existingEntry = snapshot.files.get(entryPath);
|
|
276
|
-
if (!existingEntry) {
|
|
277
|
-
// This is a remote file not in our snapshot
|
|
278
|
-
const localContent = await this.getLocalContent(entryPath);
|
|
279
|
-
const remoteContent = await this.getCurrentRemoteContent(entry.url);
|
|
280
|
-
const remoteHead = await this.getCurrentRemoteHead(entry.url);
|
|
281
|
-
if (localContent && remoteContent) {
|
|
282
|
-
// File exists both locally and remotely but not in snapshot
|
|
283
|
-
changes.push({
|
|
284
|
-
path: entryPath,
|
|
285
|
-
changeType: ChangeType.BOTH_CHANGED,
|
|
286
|
-
fileType: await this.getFileTypeFromContent(remoteContent),
|
|
287
|
-
localContent,
|
|
288
|
-
remoteContent,
|
|
289
|
-
remoteHead,
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
else if (localContent !== null && remoteContent === null) {
|
|
293
|
-
// File exists locally but not remotely (shouldn't happen in this flow)
|
|
294
|
-
changes.push({
|
|
295
|
-
path: entryPath,
|
|
296
|
-
changeType: ChangeType.LOCAL_ONLY,
|
|
297
|
-
fileType: await this.getFileTypeFromContent(localContent),
|
|
298
|
-
localContent,
|
|
299
|
-
remoteContent: null,
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
else if (localContent === null && remoteContent !== null) {
|
|
303
|
-
// File exists remotely but not locally - this is what we need for clone!
|
|
304
|
-
changes.push({
|
|
305
|
-
path: entryPath,
|
|
306
|
-
changeType: ChangeType.REMOTE_ONLY,
|
|
307
|
-
fileType: await this.getFileTypeFromContent(remoteContent),
|
|
308
|
-
localContent: null,
|
|
309
|
-
remoteContent,
|
|
310
|
-
remoteHead,
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
// Only ignore if neither local nor remote content exists (ghost entry)
|
|
314
|
-
}
|
|
315
|
-
else if (getPlainUrl(entry.url) !== getPlainUrl(existingEntry.url)) {
|
|
316
|
-
// HACK: URL replacement detection bolted onto the "discover new docs" walk.
|
|
317
|
-
//
|
|
318
|
-
// A peer can replace a document entirely (creating a new URL) rather than mutating
|
|
319
|
-
// the existing one. This happens in several cases in updateRemoteFile(): artifact
|
|
320
|
-
// paths are always replaced; non-artifact docs with legacy immutable string content
|
|
321
|
-
// are also replaced; and recreateFailedDocuments() replaces docs that timed out
|
|
322
|
-
// during network sync. The two normal remote-change scans both miss this:
|
|
323
|
-
// - detectRemoteChanges() is snapshot-centric: it checks the old (now orphaned)
|
|
324
|
-
// doc's heads, which haven't changed, so it reports no change.
|
|
325
|
-
// - The "new doc" branch above is directory-centric: it skips paths already in
|
|
326
|
-
// the snapshot, assuming they're handled by detectRemoteChanges().
|
|
327
|
-
//
|
|
328
|
-
// A cleaner fix would be to have detectRemoteChanges() also verify that the
|
|
329
|
-
// directory still points to the same URL for each snapshot entry, treating a
|
|
330
|
-
// mismatch as a first-class URL-replacement change rather than a special case here.
|
|
331
|
-
const localContent = await this.getLocalContent(entryPath);
|
|
332
|
-
const remoteContent = await this.getCurrentRemoteContent(entry.url);
|
|
333
|
-
const remoteHead = await this.getCurrentRemoteHead(entry.url);
|
|
334
|
-
if (remoteContent !== null) {
|
|
335
|
-
changes.push({
|
|
336
|
-
path: entryPath,
|
|
337
|
-
changeType: localContent !== null
|
|
338
|
-
? ChangeType.BOTH_CHANGED
|
|
339
|
-
: ChangeType.REMOTE_ONLY,
|
|
340
|
-
fileType: await this.getFileTypeFromContent(remoteContent),
|
|
341
|
-
localContent: localContent ?? null,
|
|
342
|
-
remoteContent,
|
|
343
|
-
remoteHead,
|
|
344
|
-
remoteUrl: entry.url,
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
else if (entry.type === "folder") {
|
|
350
|
-
// Recursively process subdirectory
|
|
351
|
-
await this.discoverRemoteDocumentsRecursive(entry.url, entryPath, snapshot, changes, excludePaths);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
catch (error) {
|
|
356
|
-
out.taskLine(`Failed to process directory: ${error}`, true);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Get current filesystem state as a map
|
|
361
|
-
*/
|
|
362
|
-
async getCurrentFilesystemState() {
|
|
363
|
-
const fileMap = new Map();
|
|
364
|
-
try {
|
|
365
|
-
const entries = await listDirectory(this.rootPath, true, this.excludePatterns);
|
|
366
|
-
const fileEntries = entries.filter(entry => entry.type !== FileType.DIRECTORY);
|
|
367
|
-
await Promise.all(fileEntries.map(async (entry) => {
|
|
368
|
-
const relativePath = getRelativePath(this.rootPath, entry.path);
|
|
369
|
-
const content = await readFileContent(entry.path);
|
|
370
|
-
fileMap.set(relativePath, { content, type: entry.type });
|
|
371
|
-
}));
|
|
372
|
-
}
|
|
373
|
-
catch (error) {
|
|
374
|
-
out.taskLine(`Failed to scan filesystem: ${error}`, true);
|
|
375
|
-
// Log more details about the error
|
|
376
|
-
if (error instanceof Error) {
|
|
377
|
-
out.taskLine(`Error details: ${error.message}`, true);
|
|
378
|
-
if (error.stack) {
|
|
379
|
-
out.taskLine(`Stack: ${error.stack}`, true);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
return fileMap;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Get local file content if it exists
|
|
387
|
-
*/
|
|
388
|
-
async getLocalContent(relativePath) {
|
|
389
|
-
try {
|
|
390
|
-
const fullPath = joinAndNormalizePath(this.rootPath, relativePath);
|
|
391
|
-
return await readFileContent(fullPath);
|
|
392
|
-
}
|
|
393
|
-
catch {
|
|
394
|
-
return null;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Get content from Automerge document at specific head
|
|
399
|
-
*/
|
|
400
|
-
async getContentAtHead(url, heads) {
|
|
401
|
-
try {
|
|
402
|
-
// Strip heads for current document state
|
|
403
|
-
const plainUrl = getPlainUrl(url);
|
|
404
|
-
const handle = await this.repo.find(plainUrl);
|
|
405
|
-
const doc = await handle.view(heads).doc();
|
|
406
|
-
const content = doc?.content;
|
|
407
|
-
return readDocContent(content);
|
|
408
|
-
}
|
|
409
|
-
catch {
|
|
410
|
-
return null;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Get current content from Automerge document
|
|
415
|
-
*/
|
|
416
|
-
async getCurrentRemoteContent(url) {
|
|
417
|
-
try {
|
|
418
|
-
const plainUrl = getPlainUrl(url);
|
|
419
|
-
const result = await this.findDocument(plainUrl);
|
|
420
|
-
if (!result)
|
|
421
|
-
return null;
|
|
422
|
-
const content = result.doc.content;
|
|
423
|
-
return readDocContent(content);
|
|
424
|
-
}
|
|
425
|
-
catch (error) {
|
|
426
|
-
out.taskLine(`Failed to get remote content: ${error}`, true);
|
|
427
|
-
return null;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Find and wait for a document to be available, with retry logic.
|
|
432
|
-
* repo.find() rejects with "unavailable" if the server doesn't have the
|
|
433
|
-
* document yet, and doc() throws if the handle isn't ready. We retry
|
|
434
|
-
* both with backoff since the document may just not have propagated yet.
|
|
435
|
-
*/
|
|
436
|
-
async findDocument(url, options = {}) {
|
|
437
|
-
const { maxRetries = 5, retryDelayMs = 500 } = options;
|
|
438
|
-
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
439
|
-
try {
|
|
440
|
-
const handle = await this.repo.find(url);
|
|
441
|
-
const doc = handle.doc();
|
|
442
|
-
return { handle, doc };
|
|
443
|
-
}
|
|
444
|
-
catch {
|
|
445
|
-
// Document may be unavailable — retry after a delay
|
|
446
|
-
if (attempt < maxRetries - 1) {
|
|
447
|
-
await new Promise(r => setTimeout(r, retryDelayMs * (attempt + 1)));
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
return undefined;
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Get current head of Automerge document
|
|
455
|
-
*/
|
|
456
|
-
async getCurrentRemoteHead(url) {
|
|
457
|
-
try {
|
|
458
|
-
const plainUrl = getPlainUrl(url);
|
|
459
|
-
const result = await this.findDocument(plainUrl, {
|
|
460
|
-
maxRetries: 3,
|
|
461
|
-
retryDelayMs: 200,
|
|
462
|
-
});
|
|
463
|
-
if (!result)
|
|
464
|
-
return [];
|
|
465
|
-
return result.handle.heads();
|
|
466
|
-
}
|
|
467
|
-
catch {
|
|
468
|
-
return [];
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Determine file type from content
|
|
473
|
-
*/
|
|
474
|
-
async getFileTypeFromContent(content) {
|
|
475
|
-
if (!content)
|
|
476
|
-
return FileType.TEXT;
|
|
477
|
-
if (content instanceof Uint8Array) {
|
|
478
|
-
return FileType.BINARY;
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
return FileType.TEXT;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Classify change type for a path
|
|
486
|
-
*/
|
|
487
|
-
async classifyChange(relativePath, snapshot) {
|
|
488
|
-
const snapshotEntry = snapshot.files.get(relativePath);
|
|
489
|
-
const localContent = await this.getLocalContent(relativePath);
|
|
490
|
-
if (!snapshotEntry) {
|
|
491
|
-
// New file
|
|
492
|
-
return ChangeType.LOCAL_ONLY;
|
|
493
|
-
}
|
|
494
|
-
const lastKnownContent = await this.getContentAtHead(snapshotEntry.url, snapshotEntry.head);
|
|
495
|
-
const currentRemoteContent = await this.getCurrentRemoteContent(snapshotEntry.url);
|
|
496
|
-
const localChanged = localContent
|
|
497
|
-
? !isContentEqual(localContent, lastKnownContent)
|
|
498
|
-
: true;
|
|
499
|
-
const remoteChanged = !isContentEqual(lastKnownContent, currentRemoteContent);
|
|
500
|
-
if (!localChanged && !remoteChanged) {
|
|
501
|
-
return ChangeType.NO_CHANGE;
|
|
502
|
-
}
|
|
503
|
-
else if (localChanged && !remoteChanged) {
|
|
504
|
-
return ChangeType.LOCAL_ONLY;
|
|
505
|
-
}
|
|
506
|
-
else if (!localChanged && remoteChanged) {
|
|
507
|
-
return ChangeType.REMOTE_ONLY;
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
return ChangeType.BOTH_CHANGED;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
/**
|
|
514
|
-
* Find a file's entry in the remote directory hierarchy.
|
|
515
|
-
* Returns the entry (with name, type, url) or null if not found.
|
|
516
|
-
*/
|
|
517
|
-
async findInRemoteDirectory(rootDirectoryUrl, filePath) {
|
|
518
|
-
if (!rootDirectoryUrl)
|
|
519
|
-
return null;
|
|
520
|
-
return findFileInDirectoryHierarchy(this.repo, rootDirectoryUrl, filePath);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
//# sourceMappingURL=change-detection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"change-detection.js","sourceRoot":"","sources":["../../src/core/change-detection.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,sBAAsB,CAAA;AACzC,OAAO,EACN,UAAU,EACV,QAAQ,GAKR,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACN,eAAe,EACf,aAAa,EACb,eAAe,EACf,4BAA4B,EAC5B,oBAAoB,EACpB,WAAW,EACX,cAAc,GACd,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAC,GAAG,EAAC,MAAM,oBAAoB,CAAA;AAEtC,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA;AACnC,SAAS,KAAK,CAAC,GAAG,IAAW;IAC5B,IAAI,OAAO;QAAE,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,IAAI,CAAC,CAAA;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,cAAc;IAC1B,YACS,IAAU,EACV,QAAgB,EAChB,kBAA4B,EAAE,EAC9B,sBAAgC,EAAE;QAHlC,SAAI,GAAJ,IAAI,CAAM;QACV,aAAQ,GAAR,QAAQ,CAAQ;QAChB,oBAAe,GAAf,eAAe,CAAe;QAC9B,wBAAmB,GAAnB,mBAAmB,CAAe;IACxC,CAAC;IAEJ;;;;OAIG;IACK,cAAc,CAAC,QAAgB;QACtC,OAAO,IAAI,CAAC,mBAAmB,CAAC,IAAI,CACnC,GAAG,CAAC,EAAE,CAAC,QAAQ,KAAK,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC,CACzD,CAAA;IACF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,QAAsB,EAAE,YAA0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ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { GlobalConfig, DirectoryConfig } from "../types/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Configuration manager for pushwork
|
|
4
|
-
*/
|
|
5
|
-
export declare class ConfigManager {
|
|
6
|
-
private workingDir?;
|
|
7
|
-
private static readonly GLOBAL_CONFIG_DIR;
|
|
8
|
-
private static readonly CONFIG_FILENAME;
|
|
9
|
-
static readonly CONFIG_DIR = ".pushwork";
|
|
10
|
-
constructor(workingDir?: string | undefined);
|
|
11
|
-
/**
|
|
12
|
-
* Get global configuration path
|
|
13
|
-
*/
|
|
14
|
-
private getGlobalConfigPath;
|
|
15
|
-
/**
|
|
16
|
-
* Get local configuration path
|
|
17
|
-
*/
|
|
18
|
-
private getLocalConfigPath;
|
|
19
|
-
/**
|
|
20
|
-
* Load global configuration
|
|
21
|
-
*/
|
|
22
|
-
loadGlobal(): Promise<GlobalConfig | null>;
|
|
23
|
-
/**
|
|
24
|
-
* Save global configuration
|
|
25
|
-
*/
|
|
26
|
-
saveGlobal(config: GlobalConfig): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Load local/directory configuration
|
|
29
|
-
*/
|
|
30
|
-
load(): Promise<DirectoryConfig | null>;
|
|
31
|
-
/**
|
|
32
|
-
* Save local/directory configuration
|
|
33
|
-
*/
|
|
34
|
-
save(config: DirectoryConfig): Promise<void>;
|
|
35
|
-
private getDefaultGlobalConfig;
|
|
36
|
-
/**
|
|
37
|
-
* Get default configuration
|
|
38
|
-
*/
|
|
39
|
-
getDefaultDirectoryConfig(): DirectoryConfig;
|
|
40
|
-
/**
|
|
41
|
-
* Get merged configuration (global + local)
|
|
42
|
-
*/
|
|
43
|
-
getMerged(): Promise<DirectoryConfig>;
|
|
44
|
-
/**
|
|
45
|
-
* Initialize with CLI option overrides
|
|
46
|
-
* Creates a new config with defaults + CLI overrides and saves it
|
|
47
|
-
*/
|
|
48
|
-
initializeWithOverrides(overrides?: Partial<DirectoryConfig>): Promise<DirectoryConfig>;
|
|
49
|
-
/**
|
|
50
|
-
* Merge two configuration objects
|
|
51
|
-
*/
|
|
52
|
-
private mergeConfigs;
|
|
53
|
-
/**
|
|
54
|
-
* Create default global configuration
|
|
55
|
-
*/
|
|
56
|
-
createDefaultGlobal(): Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Check if global configuration exists
|
|
59
|
-
*/
|
|
60
|
-
globalConfigExists(): Promise<boolean>;
|
|
61
|
-
/**
|
|
62
|
-
* Check if local configuration exists
|
|
63
|
-
*/
|
|
64
|
-
localConfigExists(): Promise<boolean>;
|
|
65
|
-
/**
|
|
66
|
-
* Get configuration value by path (e.g., 'sync.move_detection_threshold')
|
|
67
|
-
*/
|
|
68
|
-
getValue(keyPath: string): Promise<any>;
|
|
69
|
-
/**
|
|
70
|
-
* Set configuration value by path
|
|
71
|
-
*/
|
|
72
|
-
setValue(keyPath: string, value: any): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* Validate configuration
|
|
75
|
-
*/
|
|
76
|
-
validate(config: DirectoryConfig): {
|
|
77
|
-
valid: boolean;
|
|
78
|
-
errors: string[];
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAG3B;;GAEG;AACH,qBAAa,aAAa;IAMZ,OAAO,CAAC,UAAU,CAAC;IAL/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAe;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAiB;IAExD,MAAM,CAAC,QAAQ,CAAC,UAAU,eAAe;gBAErB,UAAU,CAAC,EAAE,MAAM,YAAA;IAEvC;;OAEG;IACH,OAAO,CAAC,mB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