playcanvas-agent-bridge-cli 0.2.2 → 0.4.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.
Files changed (34) hide show
  1. package/README.md +218 -52
  2. package/README.zh-CN.md +210 -51
  3. package/dist/cli.js +723 -92
  4. package/dist/config.js +6 -2
  5. package/dist/daemon/server.js +181 -19
  6. package/dist/daemon/target-registry.js +61 -3
  7. package/dist/frontend/server.js +191 -0
  8. package/dist/frontend/store.js +369 -0
  9. package/dist/shared/protocol.js +3 -1
  10. package/dist/snippets.js +764 -30
  11. package/dist/workspace/manager.js +536 -0
  12. package/extension/icons/concepts/pcbridge-bridge.png +0 -0
  13. package/extension/icons/concepts/pcbridge-cube.png +0 -0
  14. package/extension/icons/concepts/pcbridge-p-active.png +0 -0
  15. package/extension/icons/concepts/pcbridge-p-arch.png +0 -0
  16. package/extension/icons/concepts/pcbridge-p-bridge.png +0 -0
  17. package/extension/icons/concepts/pcbridge-p-emblem.png +0 -0
  18. package/extension/icons/concepts/pcbridge-signal.png +0 -0
  19. package/extension/icons/icon-128.png +0 -0
  20. package/extension/icons/icon-16.png +0 -0
  21. package/extension/icons/icon-32.png +0 -0
  22. package/extension/icons/icon-48.png +0 -0
  23. package/extension/isolated.js +214 -43
  24. package/extension/main.js +619 -32
  25. package/extension/manifest.json +29 -7
  26. package/extension/popup.html +188 -24
  27. package/extension/popup.js +199 -10
  28. package/extension/service-worker.js +268 -17
  29. package/package.json +4 -1
  30. package/skills/claude/playcanvas-agent-bridge-cli/SKILL.md +97 -24
  31. package/skills/codex/playcanvas-agent-bridge-cli/SKILL.md +167 -52
  32. package/skills/codex/playcanvas-agent-bridge-cli/agents/openai.yaml +2 -2
  33. package/skills/cursor/playcanvas-agent-bridge-cli.mdc +63 -23
  34. package/skills/windsurf/playcanvas-agent-bridge-cli.md +61 -23
@@ -0,0 +1,536 @@
1
+ import { createHash, randomUUID } from "node:crypto";
2
+ import { existsSync } from "node:fs";
3
+ import { lstat, mkdir, readFile, readdir, rename, rmdir, writeFile, } from "node:fs/promises";
4
+ import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
5
+ const PROJECT_FILE = "pcbridge.project.json";
6
+ const INDEX_FILE = join(".pcbridge", "asset-index.json");
7
+ const DEFAULT_REFRESH_INTERVAL_MS = 5000;
8
+ function hashContent(value) {
9
+ return createHash("sha256").update(value).digest("hex");
10
+ }
11
+ export function safeWorkspaceName(value, fallback) {
12
+ const safe = value
13
+ .normalize("NFKC")
14
+ .replace(/[<>:"/\\|?*\u0000-\u001f]/g, "-")
15
+ .replace(/\s+/g, "-")
16
+ .replace(/-+/g, "-")
17
+ .replace(/^[. -]+|[. -]+$/g, "")
18
+ .slice(0, 80);
19
+ return safe || fallback;
20
+ }
21
+ export function safeAssetName(value, fallback) {
22
+ const safe = value
23
+ .normalize("NFKC")
24
+ .replace(/[<>:"/\\|?*\u0000-\u001f]/g, "-")
25
+ .replace(/[. ]+$/g, "")
26
+ .replace(/^[.]+$/g, "")
27
+ .slice(0, 120);
28
+ return safe || fallback;
29
+ }
30
+ function collisionName(filename, id) {
31
+ const extension = extname(filename);
32
+ const stem = extension ? filename.slice(0, -extension.length) : filename;
33
+ return `${stem}~${id}${extension}`;
34
+ }
35
+ function asObject(value) {
36
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
37
+ throw new Error("Invalid workspace response from PlayCanvas target.");
38
+ }
39
+ return value;
40
+ }
41
+ async function atomicWrite(path, value) {
42
+ await mkdir(dirname(path), { recursive: true });
43
+ const temporary = join(dirname(path), `.${basename(path)}.${process.pid}.${randomUUID()}.tmp`);
44
+ await writeFile(temporary, value);
45
+ await rename(temporary, path);
46
+ }
47
+ async function readJson(path) {
48
+ try {
49
+ return JSON.parse(await readFile(path, "utf8"));
50
+ }
51
+ catch {
52
+ return null;
53
+ }
54
+ }
55
+ async function isSymbolicLink(path) {
56
+ try {
57
+ return (await lstat(path)).isSymbolicLink();
58
+ }
59
+ catch {
60
+ return false;
61
+ }
62
+ }
63
+ export class WorkspaceManager {
64
+ rootDir;
65
+ #requestTarget;
66
+ #records = new Map();
67
+ #refreshTimer = null;
68
+ constructor(options) {
69
+ this.rootDir = resolve(options.rootDir);
70
+ this.#requestTarget = options.requestTarget;
71
+ const interval = options.refreshIntervalMs ?? DEFAULT_REFRESH_INTERVAL_MS;
72
+ if (interval > 0) {
73
+ this.#refreshTimer = setInterval(() => {
74
+ for (const record of this.#records.values()) {
75
+ if (record.connected)
76
+ void this.#sync(record, false);
77
+ }
78
+ }, interval);
79
+ this.#refreshTimer.unref();
80
+ }
81
+ }
82
+ async close() {
83
+ if (this.#refreshTimer) {
84
+ clearInterval(this.#refreshTimer);
85
+ this.#refreshTimer = null;
86
+ }
87
+ await Promise.all(Array.from(this.#records.values(), (record) => record.syncPromise).filter(Boolean));
88
+ }
89
+ async handleTarget(info) {
90
+ if (info.kind !== "editor" ||
91
+ !info.ready ||
92
+ !info.projectId ||
93
+ !info.projectName) {
94
+ return;
95
+ }
96
+ const existing = this.#records.get(info.projectId);
97
+ if (existing && existing.branchId && info.branchId && existing.branchId !== info.branchId) {
98
+ existing.state = "conflict";
99
+ existing.lastError = `Branch ${info.branchId} cannot sync into workspace branch ${existing.branchId}.`;
100
+ return;
101
+ }
102
+ const record = existing || await this.#createRecord(info);
103
+ record.targetId = info.id;
104
+ record.connected = true;
105
+ record.projectName = info.projectName;
106
+ record.branchName = info.branchName || record.branchName;
107
+ await this.#writeManifest(record, info);
108
+ await this.#sync(record, false);
109
+ }
110
+ markDisconnected(info) {
111
+ if (!info.projectId)
112
+ return;
113
+ const record = this.#records.get(info.projectId);
114
+ if (record?.targetId === info.id)
115
+ record.connected = false;
116
+ }
117
+ statusForTarget(info) {
118
+ if (!info?.projectId) {
119
+ return {
120
+ available: false,
121
+ state: "unavailable",
122
+ rootDirectory: this.rootDir,
123
+ };
124
+ }
125
+ const record = this.#records.get(info.projectId);
126
+ if (!record) {
127
+ return {
128
+ available: false,
129
+ state: info.kind === "editor" ? "initializing" : "unavailable",
130
+ rootDirectory: this.rootDir,
131
+ projectId: info.projectId,
132
+ };
133
+ }
134
+ if (record.branchId && info.branchId && record.branchId !== info.branchId) {
135
+ return {
136
+ ...this.#status(record),
137
+ state: "conflict",
138
+ branchConflict: {
139
+ workspaceBranchId: record.branchId,
140
+ targetBranchId: info.branchId,
141
+ },
142
+ };
143
+ }
144
+ return this.#status(record);
145
+ }
146
+ async syncTarget(info) {
147
+ if (!info.projectId)
148
+ throw new Error("The selected target has no project metadata.");
149
+ const record = this.#records.get(info.projectId);
150
+ if (!record)
151
+ throw new Error("The selected project workspace has not been initialized.");
152
+ if (record.branchId && info.branchId && record.branchId !== info.branchId) {
153
+ throw new Error(`Workspace is bound to branch ${record.branchId}, not ${info.branchId}.`);
154
+ }
155
+ record.targetId = info.id;
156
+ record.connected = true;
157
+ await this.#sync(record, true);
158
+ return this.#status(record);
159
+ }
160
+ async pullAsset(info, assetId) {
161
+ if (!info.projectId)
162
+ throw new Error("The selected target has no project metadata.");
163
+ const record = this.#records.get(info.projectId);
164
+ if (!record)
165
+ throw new Error("The selected project workspace has not been initialized.");
166
+ const entry = record.index.entries[String(assetId)];
167
+ if (!entry)
168
+ throw new Error(`Asset ${assetId} is not present in the workspace index.`);
169
+ if (!entry.localPath)
170
+ throw new Error(`Asset ${assetId} has no downloadable file.`);
171
+ if (entry.type === "script") {
172
+ throw new Error("Scripts are synchronized automatically; use workspace sync instead.");
173
+ }
174
+ const response = await this.#requestTarget(info.id, "bridge:readAssetFile", { assetId }, 120000);
175
+ if (!response.ok)
176
+ throw new Error(response.error.message);
177
+ const data = asObject(response.data);
178
+ const base64 = typeof data.base64 === "string" ? data.base64 : "";
179
+ if (!base64)
180
+ throw new Error(`Asset ${assetId} returned no file data.`);
181
+ const path = this.#assetPath(record, entry.localPath);
182
+ await atomicWrite(path, Buffer.from(base64, "base64"));
183
+ entry.downloaded = true;
184
+ entry.localHash = hashContent(await readFile(path));
185
+ entry.status = "synced";
186
+ await this.#writeIndex(record);
187
+ return {
188
+ assetId,
189
+ path,
190
+ size: Buffer.byteLength(base64, "base64"),
191
+ };
192
+ }
193
+ async #createRecord(info) {
194
+ await mkdir(this.rootDir, { recursive: true });
195
+ const existingDirectory = await this.#findProjectDirectory(info.projectId || "");
196
+ const directoryName = `${info.projectId}-${safeWorkspaceName(info.projectName || "project", "project")}`;
197
+ const directory = existingDirectory || this.#withinRoot(join(this.rootDir, directoryName));
198
+ if (await isSymbolicLink(directory)) {
199
+ throw new Error(`Workspace project directory cannot be a symbolic link: ${directory}`);
200
+ }
201
+ const assetsDirectory = join(directory, "assets");
202
+ const tmpDirectory = join(directory, "tmp");
203
+ await mkdir(assetsDirectory, { recursive: true });
204
+ await mkdir(join(tmpDirectory, "scripts"), { recursive: true });
205
+ await mkdir(join(tmpDirectory, "captures"), { recursive: true });
206
+ await mkdir(join(tmpDirectory, "conflicts"), { recursive: true });
207
+ await mkdir(join(directory, ".pcbridge"), { recursive: true });
208
+ const stored = await readJson(join(directory, INDEX_FILE));
209
+ const index = stored?.schemaVersion === 1
210
+ ? stored
211
+ : {
212
+ schemaVersion: 1,
213
+ projectId: info.projectId || "",
214
+ branchId: info.branchId || null,
215
+ updatedAt: new Date().toISOString(),
216
+ entries: {},
217
+ };
218
+ const record = {
219
+ projectId: info.projectId || "",
220
+ projectName: info.projectName || "Project",
221
+ branchId: info.branchId || index.branchId || null,
222
+ branchName: info.branchName || null,
223
+ directory,
224
+ assetsDirectory,
225
+ tmpDirectory,
226
+ targetId: info.id,
227
+ connected: true,
228
+ state: "initializing",
229
+ lastSyncedAt: null,
230
+ lastError: null,
231
+ index,
232
+ syncPromise: null,
233
+ };
234
+ this.#records.set(record.projectId, record);
235
+ return record;
236
+ }
237
+ async #findProjectDirectory(projectId) {
238
+ let entries;
239
+ try {
240
+ entries = await readdir(this.rootDir, { withFileTypes: true });
241
+ }
242
+ catch {
243
+ return null;
244
+ }
245
+ for (const entry of entries) {
246
+ if (!entry.isDirectory() || entry.isSymbolicLink())
247
+ continue;
248
+ const directory = this.#withinRoot(join(this.rootDir, entry.name));
249
+ const manifest = await readJson(join(directory, PROJECT_FILE));
250
+ if (manifest?.project?.id === projectId)
251
+ return directory;
252
+ }
253
+ return null;
254
+ }
255
+ #withinRoot(path) {
256
+ const resolved = resolve(path);
257
+ if (resolved !== this.rootDir && !resolved.startsWith(`${this.rootDir}${sep}`)) {
258
+ throw new Error(`Workspace path escapes daemon root: ${path}`);
259
+ }
260
+ return resolved;
261
+ }
262
+ #assetPath(record, localPath) {
263
+ const path = this.#withinRoot(join(record.assetsDirectory, localPath));
264
+ if (path !== record.assetsDirectory && !path.startsWith(`${record.assetsDirectory}${sep}`)) {
265
+ throw new Error(`Asset path escapes project assets directory: ${localPath}`);
266
+ }
267
+ return path;
268
+ }
269
+ async #writeManifest(record, info) {
270
+ const path = join(record.directory, PROJECT_FILE);
271
+ const existing = await readJson(path);
272
+ const scenes = existing?.scenes || [];
273
+ if (info.sceneId) {
274
+ const scene = scenes.find((item) => item.id === info.sceneId);
275
+ if (scene)
276
+ scene.name = info.sceneName || scene.name;
277
+ else
278
+ scenes.push({ id: info.sceneId, name: info.sceneName || null });
279
+ }
280
+ const now = new Date().toISOString();
281
+ const manifest = {
282
+ schemaVersion: 1,
283
+ project: { id: record.projectId, name: record.projectName },
284
+ activeBranch: { id: record.branchId, name: record.branchName },
285
+ scenes,
286
+ workspace: {
287
+ createdAt: existing?.workspace?.createdAt || now,
288
+ updatedAt: now,
289
+ },
290
+ };
291
+ await atomicWrite(path, `${JSON.stringify(manifest, null, 2)}\n`);
292
+ }
293
+ async #writeIndex(record) {
294
+ record.index.updatedAt = new Date().toISOString();
295
+ await atomicWrite(join(record.directory, INDEX_FILE), `${JSON.stringify(record.index, null, 2)}\n`);
296
+ }
297
+ async #sync(record, force) {
298
+ if (record.syncPromise)
299
+ return record.syncPromise;
300
+ record.syncPromise = this.#performSync(record, force).finally(() => {
301
+ record.syncPromise = null;
302
+ });
303
+ return record.syncPromise;
304
+ }
305
+ async #performSync(record, force) {
306
+ record.state = "syncing";
307
+ record.lastError = null;
308
+ try {
309
+ const response = await this.#requestTarget(record.targetId, "bridge:workspaceSnapshot", {}, 60000);
310
+ if (!response.ok)
311
+ throw new Error(response.error.message);
312
+ const data = asObject(response.data);
313
+ const assets = Array.isArray(data.assets) ? data.assets : [];
314
+ await this.#applySnapshot(record, assets, force);
315
+ record.lastSyncedAt = new Date().toISOString();
316
+ const entries = Object.values(record.index.entries);
317
+ record.state = entries.some((entry) => entry.status === "conflict")
318
+ ? "conflict"
319
+ : entries.some((entry) => entry.status === "local-change")
320
+ ? "local-change"
321
+ : entries.some((entry) => entry.status === "error")
322
+ ? "error"
323
+ : "synced";
324
+ await this.#writeIndex(record);
325
+ }
326
+ catch (error) {
327
+ record.state = "error";
328
+ record.lastError = error instanceof Error ? error.message : String(error);
329
+ }
330
+ }
331
+ async #applySnapshot(record, assets, force) {
332
+ const folderAssets = assets
333
+ .filter((asset) => asset.type === "folder")
334
+ .sort((left, right) => (left.path?.length || 0) - (right.path?.length || 0));
335
+ const folderPaths = new Map();
336
+ const usedNames = new Map();
337
+ const allocateName = (parent, rawName, id) => {
338
+ const parentKey = parent.join("/").toLocaleLowerCase();
339
+ const used = usedNames.get(parentKey) || new Set();
340
+ const safe = safeAssetName(rawName, `asset-${id}`);
341
+ const key = safe.toLocaleLowerCase();
342
+ const selected = used.has(key) ? collisionName(safe, id) : safe;
343
+ used.add(selected.toLocaleLowerCase());
344
+ usedNames.set(parentKey, used);
345
+ return selected;
346
+ };
347
+ for (const folder of folderAssets) {
348
+ const parentIds = (folder.path || []).map(String);
349
+ const parent = parentIds.length ? folderPaths.get(parentIds[parentIds.length - 1]) || [] : [];
350
+ const name = allocateName(parent, folder.name, String(folder.id));
351
+ const path = [...parent, name];
352
+ folderPaths.set(String(folder.id), path);
353
+ await mkdir(this.#assetPath(record, join(...path)), { recursive: true });
354
+ }
355
+ const previous = record.index.entries;
356
+ const next = {};
357
+ for (const asset of assets) {
358
+ const id = String(asset.id);
359
+ const parentIds = (asset.path || []).map(String);
360
+ const parent = parentIds.length ? folderPaths.get(parentIds[parentIds.length - 1]) || [] : [];
361
+ if (asset.type === "folder") {
362
+ next[id] = {
363
+ id,
364
+ name: asset.name,
365
+ type: asset.type,
366
+ remotePath: folderPaths.get(id) || parent,
367
+ localPath: null,
368
+ filename: null,
369
+ remoteFileHash: null,
370
+ localHash: null,
371
+ lastSyncedHash: null,
372
+ downloaded: false,
373
+ status: "indexed",
374
+ };
375
+ continue;
376
+ }
377
+ const remoteFilename = asset.file?.filename || (asset.type === "script" ? asset.name : null);
378
+ const localName = remoteFilename ? allocateName(parent, remoteFilename, id) : null;
379
+ const localPath = localName ? join(...parent, localName) : null;
380
+ const old = previous[id];
381
+ const entry = {
382
+ id,
383
+ name: asset.name,
384
+ type: asset.type,
385
+ remotePath: parent,
386
+ localPath,
387
+ filename: remoteFilename,
388
+ remoteFileHash: asset.file?.hash || null,
389
+ localHash: old?.localHash || null,
390
+ lastSyncedHash: old?.lastSyncedHash || null,
391
+ downloaded: old?.downloaded || false,
392
+ status: old?.status || "indexed",
393
+ error: old?.error,
394
+ };
395
+ next[id] = entry;
396
+ if (old?.localPath && localPath && old.localPath !== localPath && existsSync(this.#assetPath(record, old.localPath))) {
397
+ const oldPath = this.#assetPath(record, old.localPath);
398
+ const newPath = this.#assetPath(record, localPath);
399
+ await mkdir(dirname(newPath), { recursive: true });
400
+ if (!existsSync(newPath))
401
+ await rename(oldPath, newPath);
402
+ }
403
+ if (asset.type === "script" && localPath) {
404
+ await this.#reconcileScript(record, entry, old, force);
405
+ }
406
+ }
407
+ for (const [id, old] of Object.entries(previous)) {
408
+ if (next[id] || !old.localPath || !existsSync(this.#assetPath(record, old.localPath)))
409
+ continue;
410
+ const source = this.#assetPath(record, old.localPath);
411
+ const destination = join(record.tmpDirectory, "conflicts", `remote-deleted-${id}-${safeWorkspaceName(basename(old.localPath), `asset-${id}`)}`);
412
+ await mkdir(dirname(destination), { recursive: true });
413
+ await rename(source, destination);
414
+ }
415
+ const obsoleteFolders = Object.entries(previous)
416
+ .filter(([id, old]) => old.type === "folder" &&
417
+ (!next[id] || next[id].remotePath.join("/") !== old.remotePath.join("/")))
418
+ .map(([, old]) => old.remotePath)
419
+ .sort((left, right) => right.length - left.length);
420
+ for (const folder of obsoleteFolders) {
421
+ if (!folder.length)
422
+ continue;
423
+ await rmdir(this.#assetPath(record, join(...folder))).catch(() => undefined);
424
+ }
425
+ record.index = {
426
+ schemaVersion: 1,
427
+ projectId: record.projectId,
428
+ branchId: record.branchId,
429
+ updatedAt: new Date().toISOString(),
430
+ entries: next,
431
+ };
432
+ }
433
+ async #reconcileScript(record, entry, old, force) {
434
+ if (!entry.localPath)
435
+ return;
436
+ const path = this.#assetPath(record, entry.localPath);
437
+ const localContent = existsSync(path) ? await readFile(path, "utf8") : null;
438
+ const localHash = localContent === null ? null : hashContent(localContent);
439
+ const baseline = old?.lastSyncedHash || null;
440
+ const localChanged = localHash !== null && localHash !== baseline;
441
+ const remoteMetadataChanged = !old || old.remoteFileHash !== entry.remoteFileHash;
442
+ if (!force && localContent !== null && !localChanged && !remoteMetadataChanged) {
443
+ entry.localHash = localHash;
444
+ entry.lastSyncedHash = baseline;
445
+ entry.downloaded = true;
446
+ entry.status = "synced";
447
+ return;
448
+ }
449
+ const response = await this.#requestTarget(record.targetId, "bridge:readAssetText", { assetId: entry.id }, 30000);
450
+ if (!response.ok) {
451
+ entry.status = "error";
452
+ entry.error = response.error.message;
453
+ return;
454
+ }
455
+ const data = asObject(response.data);
456
+ const remoteContent = typeof data.text === "string" ? data.text : "";
457
+ const remoteHash = hashContent(remoteContent);
458
+ if (localContent === null || localHash === baseline) {
459
+ await atomicWrite(path, remoteContent);
460
+ entry.localHash = remoteHash;
461
+ entry.lastSyncedHash = remoteHash;
462
+ entry.downloaded = true;
463
+ entry.status = "synced";
464
+ delete entry.error;
465
+ return;
466
+ }
467
+ if (!baseline) {
468
+ if (localHash === remoteHash) {
469
+ entry.localHash = localHash;
470
+ entry.lastSyncedHash = localHash;
471
+ entry.downloaded = true;
472
+ entry.status = "synced";
473
+ }
474
+ else {
475
+ await this.#writeConflict(record, entry, localContent, remoteContent);
476
+ }
477
+ return;
478
+ }
479
+ if (remoteHash === baseline || remoteHash === localHash) {
480
+ if (remoteHash !== localHash) {
481
+ const writeResponse = await this.#requestTarget(record.targetId, "bridge:writeScriptText", { assetId: entry.id, text: localContent }, 60000);
482
+ if (!writeResponse.ok) {
483
+ entry.localHash = localHash;
484
+ entry.status = "local-change";
485
+ entry.error = writeResponse.error.message;
486
+ return;
487
+ }
488
+ }
489
+ entry.localHash = localHash;
490
+ entry.lastSyncedHash = localHash;
491
+ entry.downloaded = true;
492
+ entry.status = "synced";
493
+ delete entry.error;
494
+ return;
495
+ }
496
+ await this.#writeConflict(record, entry, localContent, remoteContent);
497
+ }
498
+ async #writeConflict(record, entry, localContent, remoteContent) {
499
+ const conflictBase = join(record.tmpDirectory, "conflicts", `${entry.id}-${safeWorkspaceName(entry.filename || entry.name, `script-${entry.id}`)}`);
500
+ await atomicWrite(`${conflictBase}.local`, localContent);
501
+ await atomicWrite(`${conflictBase}.remote`, remoteContent);
502
+ entry.localHash = hashContent(localContent);
503
+ entry.status = "conflict";
504
+ entry.error = `Local and remote script changed since the last sync. See ${relative(record.directory, conflictBase)}.*`;
505
+ }
506
+ #status(record) {
507
+ const entries = Object.values(record.index.entries);
508
+ const scripts = entries.filter((entry) => entry.type === "script");
509
+ const downloadable = entries.filter((entry) => entry.localPath && entry.type !== "script");
510
+ return {
511
+ available: true,
512
+ state: record.state,
513
+ rootDirectory: this.rootDir,
514
+ projectDirectory: record.directory,
515
+ assetsDirectory: record.assetsDirectory,
516
+ tmpDirectory: record.tmpDirectory,
517
+ projectId: record.projectId,
518
+ projectName: record.projectName,
519
+ branchId: record.branchId,
520
+ branchName: record.branchName,
521
+ connected: record.connected,
522
+ lastSyncedAt: record.lastSyncedAt,
523
+ lastError: record.lastError,
524
+ counts: {
525
+ assets: entries.filter((entry) => entry.type !== "folder").length,
526
+ folders: entries.filter((entry) => entry.type === "folder").length,
527
+ scripts: scripts.length,
528
+ scriptsSynced: scripts.filter((entry) => entry.status === "synced").length,
529
+ localChanges: scripts.filter((entry) => entry.status === "local-change").length,
530
+ conflicts: entries.filter((entry) => entry.status === "conflict").length,
531
+ lazyAssets: downloadable.filter((entry) => !entry.downloaded).length,
532
+ downloadedAssets: downloadable.filter((entry) => entry.downloaded).length,
533
+ },
534
+ };
535
+ }
536
+ }
Binary file
Binary file
Binary file
Binary file