@evident-ai/runner-synchroniser 3.1.1-dev.297b927 → 3.1.1-dev.fbc0f17
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/cli.js +38 -20
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -39993,14 +39993,16 @@ async function restore(params) {
|
|
|
39993
39993
|
const dir = dirname3(path);
|
|
39994
39994
|
try {
|
|
39995
39995
|
await fileOps.mkdirp(dir);
|
|
39996
|
-
} catch {
|
|
39997
|
-
log(`WARNING: could not create ${label} credential directory ${dir}
|
|
39998
|
-
return { kind: "failed", reason: `could not create ${dir}` };
|
|
39996
|
+
} catch (error) {
|
|
39997
|
+
log(`WARNING: could not create ${label} credential directory ${dir}: ${describeError(error)}`);
|
|
39998
|
+
return { kind: "failed", reason: `could not create ${dir}: ${describeError(error)}` };
|
|
39999
39999
|
}
|
|
40000
40000
|
try {
|
|
40001
40001
|
await fileOps.chmod(dir, 448);
|
|
40002
|
-
} catch {
|
|
40003
|
-
log(
|
|
40002
|
+
} catch (error) {
|
|
40003
|
+
log(
|
|
40004
|
+
`WARNING: could not restrict ${label} credential directory ${dir}: ${describeError(error)}`
|
|
40005
|
+
);
|
|
40004
40006
|
}
|
|
40005
40007
|
const local = await fileOps.stat(path);
|
|
40006
40008
|
if (local !== null && local.size > 0 && !await isValidJson(fileOps, path)) {
|
|
@@ -40037,16 +40039,26 @@ async function restore(params) {
|
|
|
40037
40039
|
const temp = `${dir}/.credentials.${Math.random().toString(36).slice(2, 8)}`;
|
|
40038
40040
|
try {
|
|
40039
40041
|
await fileOps.createExclusive(temp);
|
|
40040
|
-
} catch {
|
|
40041
|
-
log(
|
|
40042
|
-
|
|
40042
|
+
} catch (error) {
|
|
40043
|
+
log(
|
|
40044
|
+
`WARNING: could not create temporary ${label} credentials in ${dir}: ${describeError(error)}`
|
|
40045
|
+
);
|
|
40046
|
+
return {
|
|
40047
|
+
kind: "failed",
|
|
40048
|
+
reason: `could not create a temporary file in ${dir}: ${describeError(error)}`
|
|
40049
|
+
};
|
|
40043
40050
|
}
|
|
40044
40051
|
try {
|
|
40045
40052
|
await fileOps.chmod(temp, 384);
|
|
40046
|
-
} catch {
|
|
40053
|
+
} catch (error) {
|
|
40047
40054
|
await fileOps.remove(temp);
|
|
40048
|
-
log(
|
|
40049
|
-
|
|
40055
|
+
log(
|
|
40056
|
+
`WARNING: could not restrict temporary ${label} credentials in ${dir}: ${describeError(error)}`
|
|
40057
|
+
);
|
|
40058
|
+
return {
|
|
40059
|
+
kind: "failed",
|
|
40060
|
+
reason: `could not restrict a temporary file in ${dir}: ${describeError(error)}`
|
|
40061
|
+
};
|
|
40050
40062
|
}
|
|
40051
40063
|
try {
|
|
40052
40064
|
await fileOps.writeFile(temp, body);
|
|
@@ -40062,10 +40074,12 @@ async function restore(params) {
|
|
|
40062
40074
|
}
|
|
40063
40075
|
try {
|
|
40064
40076
|
await fileOps.rename(temp, path);
|
|
40065
|
-
} catch {
|
|
40077
|
+
} catch (error) {
|
|
40066
40078
|
await fileOps.remove(temp);
|
|
40067
|
-
log(
|
|
40068
|
-
|
|
40079
|
+
log(
|
|
40080
|
+
`WARNING: could not install restored ${label} credentials at ${path}: ${describeError(error)}`
|
|
40081
|
+
);
|
|
40082
|
+
return { kind: "failed", reason: `could not install ${path}: ${describeError(error)}` };
|
|
40069
40083
|
}
|
|
40070
40084
|
await chmodOrWarn(fileOps, log, path, `restored ${label} credentials at ${path}`);
|
|
40071
40085
|
log(`Restored ${label} credentials from ${location} to ${path}.`);
|
|
@@ -40074,8 +40088,8 @@ async function restore(params) {
|
|
|
40074
40088
|
async function chmodOrWarn(fileOps, log, path, subject) {
|
|
40075
40089
|
try {
|
|
40076
40090
|
await fileOps.chmod(path, 384);
|
|
40077
|
-
} catch {
|
|
40078
|
-
log(`WARNING: could not restrict ${subject}
|
|
40091
|
+
} catch (error) {
|
|
40092
|
+
log(`WARNING: could not restrict ${subject}: ${describeError(error)}`);
|
|
40079
40093
|
}
|
|
40080
40094
|
}
|
|
40081
40095
|
|
|
@@ -50453,14 +50467,18 @@ async function sync(params) {
|
|
|
50453
50467
|
}
|
|
50454
50468
|
try {
|
|
50455
50469
|
await fileOps.chmod(path, 384);
|
|
50456
|
-
} catch {
|
|
50457
|
-
log(
|
|
50470
|
+
} catch (error) {
|
|
50471
|
+
log(
|
|
50472
|
+
`WARNING: could not restrict local ${label} credentials at ${path}: ${describeError(error)}`
|
|
50473
|
+
);
|
|
50458
50474
|
}
|
|
50459
50475
|
let hash;
|
|
50460
50476
|
try {
|
|
50461
50477
|
hash = await fileOps.hashFile(path);
|
|
50462
|
-
} catch {
|
|
50463
|
-
log(
|
|
50478
|
+
} catch (error) {
|
|
50479
|
+
log(
|
|
50480
|
+
`WARNING: could not hash local ${label} credentials at ${path} (${describeError(error)}); skipping this sync tick.`
|
|
50481
|
+
);
|
|
50464
50482
|
return { outcome: { kind: "hashFailed" }, hash: lastHash };
|
|
50465
50483
|
}
|
|
50466
50484
|
if (hash === lastHash) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evident-ai/runner-synchroniser",
|
|
3
|
-
"version": "3.1.1-dev.
|
|
3
|
+
"version": "3.1.1-dev.fbc0f17",
|
|
4
4
|
"description": "Restores and syncs the Evident runner's OpenCode credential stores (and litestream config) to an object store, so a runner survives task replacement with almost no state loss.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli.js",
|