@caspee/brain-audit 0.3.0 → 0.3.1
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 +4 -1
- package/dist/brain-audit.mjs +46 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,7 +155,10 @@ It uploads both, then prints the report link and saves it to
|
|
|
155
155
|
`~/.caspee/brain-audit/<audit_id>.url`. The key is the part of the link after `#k=`. The link
|
|
156
156
|
is built on this machine, on the `--api` origin: the CLI takes no link, path or other host from
|
|
157
157
|
the server's answer. Once the server has taken the report, running `finish` again sends nothing
|
|
158
|
-
and makes no new key: it prints and saves the same link.
|
|
158
|
+
and makes no new key: it prints and saves the same link. The same holds when the server's
|
|
159
|
+
answer was lost: once a request has gone out, `finish` sends that first report again, unchanged
|
|
160
|
+
and under the same key, even if the grades were edited since (it says so and returns
|
|
161
|
+
`grades_not_sent: true`); a report with other grades needs a new audit.
|
|
159
162
|
|
|
160
163
|
## Privacy
|
|
161
164
|
|
package/dist/brain-audit.mjs
CHANGED
|
@@ -2175,7 +2175,7 @@ function reportLink(base, auditId, key) {
|
|
|
2175
2175
|
// cli/brain-audit/package.json
|
|
2176
2176
|
var package_default = {
|
|
2177
2177
|
name: "@caspee/brain-audit",
|
|
2178
|
-
version: "0.3.
|
|
2178
|
+
version: "0.3.1",
|
|
2179
2179
|
description: "Audit a folder of Markdown or text (a company brain) on your own machine; only numbers and an encrypted report reach Caspee.",
|
|
2180
2180
|
author: "OneType P.S.A.",
|
|
2181
2181
|
license: "SEE LICENSE IN LICENSE",
|
|
@@ -15818,37 +15818,45 @@ async function finish(args) {
|
|
|
15818
15818
|
serverText(error instanceof Error ? error.message : String(error))
|
|
15819
15819
|
]);
|
|
15820
15820
|
}
|
|
15821
|
-
const parsed = parseAgentGrades(method2, gradesJson, pack, {
|
|
15822
|
-
files: new Set(state.tree_paths)
|
|
15823
|
-
});
|
|
15824
|
-
if (!parsed.ok)
|
|
15825
|
-
throw new FinishError(
|
|
15826
|
-
"grades_invalid",
|
|
15827
|
-
"The grades do not fit the pack; fix them and run finish again.",
|
|
15828
|
-
// They quote the grades file and the method's element ids: cleaned like server text.
|
|
15829
|
-
parsed.errors.map(serverText)
|
|
15830
|
-
);
|
|
15831
|
-
const { summary, sealedPack } = assembled({
|
|
15832
|
-
workDir: args.workDir,
|
|
15833
|
-
auditId: args.auditId,
|
|
15834
|
-
cliVersion: args.cliVersion,
|
|
15835
|
-
method: method2,
|
|
15836
|
-
state,
|
|
15837
|
-
pack,
|
|
15838
|
-
grades: parsed.grades
|
|
15839
|
-
});
|
|
15840
15821
|
const gradesHash = await sha256Hex(JSON.stringify({ grades: gradesJson, pack: hash }));
|
|
15841
|
-
let saved = pending?.
|
|
15822
|
+
let saved = pending?.sent ? pending : null;
|
|
15823
|
+
const gradesNotSent = saved !== null && saved.grades_hash !== gradesHash;
|
|
15824
|
+
if (gradesNotSent)
|
|
15825
|
+
args.note?.(
|
|
15826
|
+
"The grades changed after an earlier send that may have reached the server. That first send goes again unchanged, under the same key, and the report keeps its grades; the edited grades are not sent. For a report with other grades, start a new audit."
|
|
15827
|
+
);
|
|
15842
15828
|
if (!saved) {
|
|
15843
|
-
const
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15829
|
+
const parsed = parseAgentGrades(method2, gradesJson, pack, {
|
|
15830
|
+
files: new Set(state.tree_paths)
|
|
15831
|
+
});
|
|
15832
|
+
if (!parsed.ok)
|
|
15833
|
+
throw new FinishError(
|
|
15834
|
+
"grades_invalid",
|
|
15835
|
+
"The grades do not fit the pack; fix them and run finish again.",
|
|
15836
|
+
// They quote the grades file and the method's element ids: cleaned like server text.
|
|
15837
|
+
parsed.errors.map(serverText)
|
|
15838
|
+
);
|
|
15839
|
+
const { summary, sealedPack } = assembled({
|
|
15840
|
+
workDir: args.workDir,
|
|
15841
|
+
auditId: args.auditId,
|
|
15842
|
+
cliVersion: args.cliVersion,
|
|
15843
|
+
method: method2,
|
|
15844
|
+
state,
|
|
15845
|
+
pack,
|
|
15846
|
+
grades: parsed.grades
|
|
15847
|
+
});
|
|
15848
|
+
saved = pending?.grades_hash === gradesHash ? pending : null;
|
|
15849
|
+
if (!saved) {
|
|
15850
|
+
const { key, envelope } = await sealPack(sealedPack, args.auditId);
|
|
15851
|
+
saved = {
|
|
15852
|
+
audit_id: args.auditId,
|
|
15853
|
+
grades_hash: gradesHash,
|
|
15854
|
+
key,
|
|
15855
|
+
body: { summary, envelope: base64urlEncode(envelope) },
|
|
15856
|
+
sent: false
|
|
15857
|
+
};
|
|
15858
|
+
writePrivate(uploadFile, JSON.stringify(saved), base);
|
|
15859
|
+
}
|
|
15852
15860
|
}
|
|
15853
15861
|
saved.audit_id = args.auditId;
|
|
15854
15862
|
reportLink(args.api.origin, args.auditId, saved.key);
|
|
@@ -15887,7 +15895,13 @@ async function finish(args) {
|
|
|
15887
15895
|
writePrivate(linkFile, `${link}
|
|
15888
15896
|
`, base);
|
|
15889
15897
|
settle(args.workDir, args.auditId, saved, saved.body.summary, base);
|
|
15890
|
-
return {
|
|
15898
|
+
return {
|
|
15899
|
+
reportLink: link,
|
|
15900
|
+
linkFile,
|
|
15901
|
+
summary: saved.body.summary,
|
|
15902
|
+
alreadyUploaded,
|
|
15903
|
+
...gradesNotSent ? { gradesNotSent: true } : {}
|
|
15904
|
+
};
|
|
15891
15905
|
}
|
|
15892
15906
|
var METHOD_CHANGE = [
|
|
15893
15907
|
"the method served for this audit is no longer current",
|
|
@@ -16236,6 +16250,7 @@ async function runFinish(argv, io, context, fetchImpl) {
|
|
|
16236
16250
|
audit_id: auditId,
|
|
16237
16251
|
api_trusted: api.trusted,
|
|
16238
16252
|
already_uploaded: result.alreadyUploaded,
|
|
16253
|
+
...result.gradesNotSent ? { grades_not_sent: true } : {},
|
|
16239
16254
|
structural_score: result.summary.structural_score,
|
|
16240
16255
|
merit_score: result.summary.merit_score,
|
|
16241
16256
|
total_score: result.summary.total_score,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caspee/brain-audit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Audit a folder of Markdown or text (a company brain) on your own machine; only numbers and an encrypted report reach Caspee.",
|
|
5
5
|
"author": "OneType P.S.A.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|