@cygnuxlabs/tracekit 1.5.0 → 1.5.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/v2/adapters/openai-agents.js +7 -1
- package/dist/v2/rpc_schema.js +16 -16
- package/dist/verify/cli.js +13 -9
- package/dist/verify/explain.d.ts +6 -5
- package/dist/verify/explain.js +177 -61
- package/dist/verify/index.d.ts +5 -1
- package/dist/verify/index.js +62 -31
- package/dist/verify/primitives.d.ts +3 -0
- package/dist/verify/primitives.js +20 -0
- package/dist/verify/web.js +4 -4
- package/dist/verify/zip.d.ts +4 -0
- package/dist/verify/zip.js +5 -4
- package/dist/verify.html +351 -115
- package/package.json +5 -5
package/dist/verify/web.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* large bundle doesn't freeze the page; in the page itself where the browser refuses the worker.
|
|
10
10
|
*/
|
|
11
11
|
import { MEANING, asJson, asText, cliExit, nextSteps, sh, summarize, verdict } from "./explain.js";
|
|
12
|
-
import { VERSION, clean, readZip, verify } from "./index.js";
|
|
12
|
+
import { VERSION, assuranceLine, clean, readZip, verify } from "./index.js";
|
|
13
13
|
/** The report, and a summary of the runs when nothing failed (what a failed bundle says can't be relied on). */
|
|
14
14
|
async function work(job) {
|
|
15
15
|
const { report, code } = await verify(job.bundle, job.trust, job.names);
|
|
@@ -123,7 +123,7 @@ function page() {
|
|
|
123
123
|
return; // a later choice of files: its report wins
|
|
124
124
|
const { report, code, summary } = result;
|
|
125
125
|
const v = verdict(report, code);
|
|
126
|
-
$("banner").className = `banner ${{ VERIFIED: "ok", FAILED: "bad", UNVERIFIABLE: "warn" }[v.word]}`;
|
|
126
|
+
$("banner").className = `banner ${{ VERIFIED: "ok", FAILED: "bad", UNVERIFIABLE: "warn", "UNUSABLE BUNDLE": "warn" }[v.word]}`;
|
|
127
127
|
$("verdict-word").textContent = v.word;
|
|
128
128
|
$("verdict-means").textContent = v.means;
|
|
129
129
|
$("verdict-not").textContent = v.notMeans;
|
|
@@ -147,12 +147,12 @@ function page() {
|
|
|
147
147
|
d.append(s);
|
|
148
148
|
for (const p of c.problems)
|
|
149
149
|
d.append(el("div", clean(p), "problem")); // one by one: a spread overflows the stack
|
|
150
|
-
d.append(el("p", `What this means: ${MEANING[c.check] ?? "see docs/verdicts.md."}`, "means"));
|
|
150
|
+
d.append(el("p", `What this means: ${MEANING[c.check]?.[c.status] ?? "see docs/verdicts.md."}`, "means"));
|
|
151
151
|
d.open = c.status !== "pass" && c.problems.length > 0;
|
|
152
152
|
return d;
|
|
153
153
|
}));
|
|
154
154
|
$("integrity").textContent = `Integrity: ${clean(report.integrity)}.`;
|
|
155
|
-
$("assurance").textContent =
|
|
155
|
+
$("assurance").textContent = assuranceLine(report);
|
|
156
156
|
last = { text: asText(report, code), json: JSON.stringify(asJson(report, code), null, 2) + "\n", name: bundle.name };
|
|
157
157
|
$("exit").textContent = last.text.trim().split("\n").at(-1) + cliExit(report);
|
|
158
158
|
$("report").textContent = last.text;
|
package/dist/verify/zip.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export declare const MAX_ENTRY: number;
|
|
|
3
3
|
export declare const MAX_TOTAL: number;
|
|
4
4
|
export declare class Unusable extends Error {
|
|
5
5
|
}
|
|
6
|
+
/** A file that isn't a zip, has no manifest, or an entry whose bytes don't inflate or don't match its CRC-32: the
|
|
7
|
+
* reports say the bundle file is damaged. */
|
|
8
|
+
export declare class BadZipFile extends Unusable {
|
|
9
|
+
}
|
|
6
10
|
/**
|
|
7
11
|
* {name: bytes} of a zip in the one layout of docs/format-v2.md §9, entry by entry under the count and size caps: the
|
|
8
12
|
* end record ends the file, with no comment; the central directory sits between the last entry and it; the entries are
|
package/dist/verify/zip.js
CHANGED
|
@@ -10,8 +10,9 @@ export const MAX_TOTAL = 512 << 20;
|
|
|
10
10
|
const NAME = /^[A-Za-z0-9_-][A-Za-z0-9._-]*(\/[A-Za-z0-9._-]+)*$/;
|
|
11
11
|
export class Unusable extends Error {
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/** A file that isn't a zip, has no manifest, or an entry whose bytes don't inflate or don't match its CRC-32: the
|
|
14
|
+
* reports say the bundle file is damaged. */
|
|
15
|
+
export class BadZipFile extends Unusable {
|
|
15
16
|
}
|
|
16
17
|
let CRC;
|
|
17
18
|
function crc32(data) {
|
|
@@ -63,7 +64,7 @@ export async function readZip(data) {
|
|
|
63
64
|
};
|
|
64
65
|
const eocd = data.length - 22;
|
|
65
66
|
if (eocd < 0 || v.getUint32(eocd, true) !== 0x06054b50)
|
|
66
|
-
throw new
|
|
67
|
+
throw new BadZipFile("not a zip file, or bytes after its end record");
|
|
67
68
|
const count = v.getUint16(eocd + 10, true), cdSize = v.getUint32(eocd + 12, true), cdOffset = v.getUint32(eocd + 16, true);
|
|
68
69
|
if (v.getUint16(eocd + 4, true) || v.getUint16(eocd + 6, true) || v.getUint16(eocd + 8, true) !== count
|
|
69
70
|
|| v.getUint16(eocd + 20, true) || cdOffset + cdSize !== eocd)
|
|
@@ -134,7 +135,7 @@ export async function readZip(data) {
|
|
|
134
135
|
}
|
|
135
136
|
catch (x) {
|
|
136
137
|
// lean: the decompressor's own message, which differs from zlib's in the reference verifier's report
|
|
137
|
-
throw new
|
|
138
|
+
throw new BadZipFile(`${n} does not inflate` + (x.message ? `: ${x.message}` : ""));
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
if (out.length > cap)
|