ccsini 0.1.30 → 0.1.32
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/index.js +42 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27913,7 +27913,11 @@ var init_constants = __esm(() => {
|
|
|
27913
27913
|
"projects/**/*.jsonl",
|
|
27914
27914
|
"plugins/**",
|
|
27915
27915
|
"plans/**",
|
|
27916
|
-
"todos/**"
|
|
27916
|
+
"todos/**",
|
|
27917
|
+
"tasks/**",
|
|
27918
|
+
"transcripts/**",
|
|
27919
|
+
"**/*.lock",
|
|
27920
|
+
"**/dist/**"
|
|
27917
27921
|
];
|
|
27918
27922
|
});
|
|
27919
27923
|
|
|
@@ -27996,7 +28000,7 @@ var {
|
|
|
27996
28000
|
} = import__.default;
|
|
27997
28001
|
|
|
27998
28002
|
// src/version.ts
|
|
27999
|
-
var VERSION = "0.1.
|
|
28003
|
+
var VERSION = "0.1.32";
|
|
28000
28004
|
|
|
28001
28005
|
// src/commands/init.ts
|
|
28002
28006
|
init_source();
|
|
@@ -29001,6 +29005,15 @@ class CcsiniClient {
|
|
|
29001
29005
|
throw new Error("Failed to delete blobs");
|
|
29002
29006
|
return res.json();
|
|
29003
29007
|
}
|
|
29008
|
+
async wipeAccount(deviceId, publicKey) {
|
|
29009
|
+
const res = await fetch(`${this.apiUrl}/api/devices/wipe-account`, {
|
|
29010
|
+
method: "POST",
|
|
29011
|
+
headers: { "Content-Type": "application/json" },
|
|
29012
|
+
body: JSON.stringify({ deviceId, publicKey })
|
|
29013
|
+
});
|
|
29014
|
+
if (!res.ok)
|
|
29015
|
+
throw new Error("Failed to wipe account data");
|
|
29016
|
+
}
|
|
29004
29017
|
async resetAll() {
|
|
29005
29018
|
const res = await fetch(`${this.apiUrl}/api/sync/reset`, {
|
|
29006
29019
|
method: "DELETE",
|
|
@@ -29227,23 +29240,38 @@ async function pushSync(client, masterKey, deviceName, configDir, onProgress) {
|
|
|
29227
29240
|
const toPush = diffs.filter((d) => d.action === "push" || d.action === "merge");
|
|
29228
29241
|
progress(`${toPush.length} files to push`);
|
|
29229
29242
|
let uploaded = 0;
|
|
29243
|
+
const failedPaths = new Set;
|
|
29230
29244
|
const chunks = chunkArray(toPush, MAX_CONCURRENT_TRANSFERS);
|
|
29231
29245
|
for (const chunk of chunks) {
|
|
29232
29246
|
await Promise.all(chunk.map(async (diff) => {
|
|
29233
|
-
|
|
29234
|
-
|
|
29235
|
-
|
|
29236
|
-
|
|
29237
|
-
|
|
29238
|
-
|
|
29239
|
-
|
|
29240
|
-
|
|
29241
|
-
|
|
29242
|
-
|
|
29247
|
+
const MAX_RETRIES = 3;
|
|
29248
|
+
for (let attempt = 1;attempt <= MAX_RETRIES; attempt++) {
|
|
29249
|
+
try {
|
|
29250
|
+
const filePath = join6(claudeDir, diff.path);
|
|
29251
|
+
const content = await readFile6(filePath);
|
|
29252
|
+
const encrypted = encryptFile(masterKey, diff.path, content);
|
|
29253
|
+
await client.uploadBlob(diff.localHash, encrypted);
|
|
29254
|
+
bytesTransferred += encrypted.length;
|
|
29255
|
+
uploaded++;
|
|
29256
|
+
progress(`Uploading ${uploaded}/${toPush.length}: ${diff.path}`);
|
|
29257
|
+
return;
|
|
29258
|
+
} catch (e) {
|
|
29259
|
+
if (attempt < MAX_RETRIES) {
|
|
29260
|
+
await new Promise((r) => setTimeout(r, 500 * attempt));
|
|
29261
|
+
} else {
|
|
29262
|
+
failedPaths.add(diff.path);
|
|
29263
|
+
errors2.push(`Push ${diff.path}: ${e.message}`);
|
|
29264
|
+
}
|
|
29265
|
+
}
|
|
29243
29266
|
}
|
|
29244
29267
|
}));
|
|
29245
29268
|
}
|
|
29246
29269
|
progress("Saving manifest...");
|
|
29270
|
+
if (failedPaths.size > 0) {
|
|
29271
|
+
for (const path2 of failedPaths) {
|
|
29272
|
+
delete localManifest.files[path2];
|
|
29273
|
+
}
|
|
29274
|
+
}
|
|
29247
29275
|
const manifestJson = JSON.stringify(localManifest);
|
|
29248
29276
|
const manifestEnc = encryptFile(masterKey, "__manifest__", new TextEncoder().encode(manifestJson));
|
|
29249
29277
|
await client.putManifest(manifestEnc);
|
|
@@ -29443,11 +29471,8 @@ function registerInitCommand(program2) {
|
|
|
29443
29471
|
if (freshStart) {
|
|
29444
29472
|
const wipeSpinner = ora("Wiping previous account data...").start();
|
|
29445
29473
|
try {
|
|
29446
|
-
const
|
|
29447
|
-
|
|
29448
|
-
const jwt = await createDeviceJWT2(privateKey, deviceId);
|
|
29449
|
-
const authedClient = new CcsiniClient("https://ccsini-api.anis-maisara190.workers.dev", jwt);
|
|
29450
|
-
await authedClient.resetAll();
|
|
29474
|
+
const client = new CcsiniClient("https://ccsini-api.anis-maisara190.workers.dev", "");
|
|
29475
|
+
await client.wipeAccount(deviceId, publicKeyB64);
|
|
29451
29476
|
wipeSpinner.succeed("Previous account data wiped");
|
|
29452
29477
|
} catch (e) {
|
|
29453
29478
|
wipeSpinner.fail(`Could not wipe server data: ${e.message}`);
|