@tangle-network/agent-app 0.63.37 → 0.63.38
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/{chunk-XBUZ43VQ.js → chunk-F25HBFAM.js} +89 -55
- package/dist/chunk-F25HBFAM.js.map +1 -0
- package/dist/signoff/cli.js +1 -1
- package/dist/signoff/index.js +1 -1
- package/dist/signoff/proof.js +1 -0
- package/dist/signoff/proof.js.map +1 -1
- package/dist/signoff/run.d.ts +0 -17
- package/dist/signoff/types.d.ts +3 -12
- package/package.json +1 -1
- package/dist/chunk-XBUZ43VQ.js.map +0 -1
package/dist/signoff/cli.js
CHANGED
package/dist/signoff/index.js
CHANGED
package/dist/signoff/proof.js
CHANGED
|
@@ -39,6 +39,7 @@ function seedsFromReport(report) {
|
|
|
39
39
|
}
|
|
40
40
|
function proofFromSignoffReport(input) {
|
|
41
41
|
const { report } = input;
|
|
42
|
+
if (report.cleanupErrors?.length) throw new Error("signoff: cleanup failures cannot issue a sign-off proof");
|
|
42
43
|
if (report.phase !== void 0 && report.phase !== "all") {
|
|
43
44
|
throw new Error(`signoff: partial phase ${report.phase} cannot issue a full sign-off proof`);
|
|
44
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/signoff/proof-from-report.ts"],"sourcesContent":["/**\n * The join between the runner and the proof: one sign-off run produces one\n * report, and this turns that report into the signed, attachable record.\n *\n * Nothing here re-runs or re-judges anything. The runner owns what happened; the\n * proof owns what is provable about it later. Keeping the two in one direction\n * is what stops a second, drifting idea of \"which steps ran\" from appearing.\n */\nimport { hashStepOutput, buildSignoffProof, type SignoffProof, type SignoffProofStep } from './proof-record'\nimport { readCommitFacts } from './proof-git'\nimport type { SignoffReport, SignoffStepResult } from './types'\n\n/**\n * A step that never executed has no exit code, so it is recorded as one no\n * process can produce. `status` is what a reader and the verifier judge on;\n * this exists so the field is never a plausible-looking `0`.\n */\nconst NO_EXIT_CODE = -1\n\n/** The `command` of a step that never executed. A skipped step had no command line. */\nconst NOT_EXECUTED_COMMAND = '(never executed)'\n\nexport interface ProofFromReportInput {\n readonly report: SignoffReport\n /** Repo identity the verifier's required-step table is keyed on. */\n readonly repo: string\n /** Source repository. Defaults to the root the run recorded. */\n readonly repoDir?: string\n /** Step ids the run treated as required. Defaults to every step the report carries. */\n readonly declaredRequired?: readonly string[]\n readonly key?: Uint8Array\n readonly now?: Date\n}\n\nfunction stepFromResult(result: SignoffStepResult, startedAtEpochMs: number): SignoffProofStep {\n const attempts = result.attempts\n const worst = attempts.reduce<number>((worstSoFar, attempt) => (attempt.exitCode !== 0 ? attempt.exitCode : worstSoFar), 0)\n return {\n id: result.name,\n command: attempts[0]?.command ?? NOT_EXECUTED_COMMAND,\n cwd: '.',\n status: result.status,\n exitCode: attempts.length === 0 ? NO_EXIT_CODE : worst,\n durationMs: Math.max(0, Math.round(result.durationMs)),\n startedAt: new Date(startedAtEpochMs + (result.startedAtMs ?? 0)).toISOString(),\n // Every attempt's output, in order — a shuffled step that failed on the\n // second seed must not digest to the same value as one that passed twice.\n outputSha256: hashStepOutput(attempts.map((attempt) => attempt.output).join('\\n')),\n }\n}\n\n/** Every seed the run used, keyed so a reader can replay one step rather than the whole run. */\nfunction seedsFromReport(report: SignoffReport): Record<string, string | number> {\n const seeds: Record<string, string | number> = { base: report.seedBase }\n for (const step of report.steps) {\n step.attempts.forEach((attempt, index) => {\n if (attempt.seed !== null) seeds[`${step.name}#${index}`] = attempt.seed\n })\n }\n return seeds\n}\n\nexport function proofFromSignoffReport(input: ProofFromReportInput): SignoffProof {\n const { report } = input\n if (report.phase !== undefined && report.phase !== 'all') {\n throw new Error(`signoff: partial phase ${report.phase} cannot issue a full sign-off proof`)\n }\n const repoDir = input.repoDir ?? report.repo.root\n\n //
|
|
1
|
+
{"version":3,"sources":["../../src/signoff/proof-from-report.ts"],"sourcesContent":["/**\n * The join between the runner and the proof: one sign-off run produces one\n * report, and this turns that report into the signed, attachable record.\n *\n * Nothing here re-runs or re-judges anything. The runner owns what happened; the\n * proof owns what is provable about it later. Keeping the two in one direction\n * is what stops a second, drifting idea of \"which steps ran\" from appearing.\n */\nimport { hashStepOutput, buildSignoffProof, type SignoffProof, type SignoffProofStep } from './proof-record'\nimport { readCommitFacts } from './proof-git'\nimport type { SignoffReport, SignoffStepResult } from './types'\n\n/**\n * A step that never executed has no exit code, so it is recorded as one no\n * process can produce. `status` is what a reader and the verifier judge on;\n * this exists so the field is never a plausible-looking `0`.\n */\nconst NO_EXIT_CODE = -1\n\n/** The `command` of a step that never executed. A skipped step had no command line. */\nconst NOT_EXECUTED_COMMAND = '(never executed)'\n\nexport interface ProofFromReportInput {\n readonly report: SignoffReport\n /** Repo identity the verifier's required-step table is keyed on. */\n readonly repo: string\n /** Source repository. Defaults to the root the run recorded. */\n readonly repoDir?: string\n /** Step ids the run treated as required. Defaults to every step the report carries. */\n readonly declaredRequired?: readonly string[]\n readonly key?: Uint8Array\n readonly now?: Date\n}\n\nfunction stepFromResult(result: SignoffStepResult, startedAtEpochMs: number): SignoffProofStep {\n const attempts = result.attempts\n const worst = attempts.reduce<number>((worstSoFar, attempt) => (attempt.exitCode !== 0 ? attempt.exitCode : worstSoFar), 0)\n return {\n id: result.name,\n command: attempts[0]?.command ?? NOT_EXECUTED_COMMAND,\n cwd: '.',\n status: result.status,\n exitCode: attempts.length === 0 ? NO_EXIT_CODE : worst,\n durationMs: Math.max(0, Math.round(result.durationMs)),\n startedAt: new Date(startedAtEpochMs + (result.startedAtMs ?? 0)).toISOString(),\n // Every attempt's output, in order — a shuffled step that failed on the\n // second seed must not digest to the same value as one that passed twice.\n outputSha256: hashStepOutput(attempts.map((attempt) => attempt.output).join('\\n')),\n }\n}\n\n/** Every seed the run used, keyed so a reader can replay one step rather than the whole run. */\nfunction seedsFromReport(report: SignoffReport): Record<string, string | number> {\n const seeds: Record<string, string | number> = { base: report.seedBase }\n for (const step of report.steps) {\n step.attempts.forEach((attempt, index) => {\n if (attempt.seed !== null) seeds[`${step.name}#${index}`] = attempt.seed\n })\n }\n return seeds\n}\n\nexport function proofFromSignoffReport(input: ProofFromReportInput): SignoffProof {\n const { report } = input\n if (report.cleanupErrors?.length) throw new Error('signoff: cleanup failures cannot issue a sign-off proof')\n if (report.phase !== undefined && report.phase !== 'all') {\n throw new Error(`signoff: partial phase ${report.phase} cannot issue a full sign-off proof`)\n }\n const repoDir = input.repoDir ?? report.repo.root\n\n // A proof must name the commit that was checked.\n const facts = readCommitFacts(repoDir, 'HEAD')\n if (facts.commit !== report.repo.head) {\n throw new Error(`HEAD moved during the sign-off: the run verified ${report.repo.head}, ${repoDir} is now at ${facts.commit}`)\n }\n\n const startedAtEpochMs = Date.parse(report.startedAt)\n const install: SignoffProofStep = {\n id: 'install',\n command: report.install.command,\n cwd: report.workspace,\n status: report.install.exitCode === 0 ? 'passed' : 'failed',\n exitCode: report.install.exitCode,\n durationMs: Math.max(0, Math.round(report.install.durationMs)),\n startedAt: new Date(startedAtEpochMs).toISOString(),\n outputSha256: hashStepOutput(report.install.output),\n }\n const steps = [install, ...report.steps.map((step) => stepFromResult(step, startedAtEpochMs))]\n\n return buildSignoffProof({\n repoDir,\n repo: input.repo,\n steps,\n wallClockMs: report.wallClockMs,\n declaredRequired: input.declaredRequired ?? steps.map((step) => step.id),\n seeds: seedsFromReport(report),\n key: input.key,\n now: input.now,\n })\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAM,eAAe;AAGrB,IAAM,uBAAuB;AAc7B,SAAS,eAAe,QAA2B,kBAA4C;AAC7F,QAAM,WAAW,OAAO;AACxB,QAAM,QAAQ,SAAS,OAAe,CAAC,YAAY,YAAa,QAAQ,aAAa,IAAI,QAAQ,WAAW,YAAa,CAAC;AAC1H,SAAO;AAAA,IACL,IAAI,OAAO;AAAA,IACX,SAAS,SAAS,CAAC,GAAG,WAAW;AAAA,IACjC,KAAK;AAAA,IACL,QAAQ,OAAO;AAAA,IACf,UAAU,SAAS,WAAW,IA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KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,QAAQ,UAAU,CAAC;AAAA,IAC7D,WAAW,IAAI,KAAK,gBAAgB,EAAE,YAAY;AAAA,IAClD,cAAc,eAAe,OAAO,QAAQ,MAAM;AAAA,EACpD;AACA,QAAM,QAAQ,CAAC,SAAS,GAAG,OAAO,MAAM,IAAI,CAAC,SAAS,eAAe,MAAM,gBAAgB,CAAC,CAAC;AAE7F,SAAO,kBAAkB;AAAA,IACvB;AAAA,IACA,MAAM,MAAM;AAAA,IACZ;AAAA,IACA,aAAa,OAAO;AAAA,IACpB,kBAAkB,MAAM,oBAAoB,MAAM,IAAI,CAAC,SAAS,KAAK,EAAE;AAAA,IACvE,OAAO,gBAAgB,MAAM;AAAA,IAC7B,KAAK,MAAM;AAAA,IACX,KAAK,MAAM;AAAA,EACb,CAAC;AACH;","names":[]}
|
package/dist/signoff/run.d.ts
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
import type { SignoffEvent, SignoffReport, SignoffPhase, SignoffSource } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* The sign-off run: reproduce a clean CI environment, then go further.
|
|
4
|
-
*
|
|
5
|
-
* Order matters and each stage exists for a failure this fleet actually paid
|
|
6
|
-
* for:
|
|
7
|
-
* 1. a pristine checkout (`workspace.ts`) — no warm `node_modules`, no Vite
|
|
8
|
-
* cache, because that is the entire mechanical difference between "green
|
|
9
|
-
* locally" and "red in CI";
|
|
10
|
-
* 2. `--frozen-lockfile` into a store keyed on the lockfile (`store.ts`) — the
|
|
11
|
-
* clean install CI does, without paying the download twice;
|
|
12
|
-
* 3. the repo's declared steps (`config.ts`), run as a graph rather than a line
|
|
13
|
-
* (`schedule.ts`), with the suite re-run under randomized file order and
|
|
14
|
-
* recorded seeds (`seeds.ts`) — the part CI does not do at all.
|
|
15
|
-
*
|
|
16
|
-
* Nothing about a failure is inferred. Every step reports its command, exit
|
|
17
|
-
* code, duration, seed and captured output.
|
|
18
|
-
*/
|
|
19
2
|
export interface RunSignoffOptions {
|
|
20
3
|
/** Any directory inside the repo. Defaults to the process cwd. */
|
|
21
4
|
readonly repoDir?: string;
|
package/dist/signoff/types.d.ts
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The vocabulary of a local sign-off run: what a repo declares, and what the
|
|
3
|
-
* run produces as proof.
|
|
4
|
-
*
|
|
5
|
-
* A sign-off gate replaces CI as the merge gate, so it has to reproduce what CI
|
|
6
|
-
* does structurally (a pristine dependency tree) and then do more than CI does
|
|
7
|
-
* (randomized suite order, recorded seeds, a dependency graph run in parallel).
|
|
8
|
-
* Both halves are declared here rather than hardcoded, because the three
|
|
9
|
-
* workflows this must express — agent-app, legal-agent, tax-agent — differ in
|
|
10
|
-
* install filter, step list, language (one has a Python step) and repo-specific
|
|
11
|
-
* gates.
|
|
12
|
-
*/
|
|
13
1
|
import type { AppDefaultsExemptions } from './app-defaults';
|
|
14
2
|
import type { CachePruneResult } from './cache';
|
|
15
3
|
export type SignoffPhase = 'all' | 'release' | 'suites';
|
|
@@ -207,10 +195,13 @@ export interface SignoffReport {
|
|
|
207
195
|
readonly phase?: SignoffPhase;
|
|
208
196
|
readonly selection?: SignoffSelection;
|
|
209
197
|
readonly ok: boolean;
|
|
198
|
+
/** Cleanup refusals retain primary results and make the overall verdict fail. */
|
|
199
|
+
readonly cleanupErrors?: readonly string[];
|
|
210
200
|
readonly startedAt: string;
|
|
211
201
|
readonly repo: SignoffRepoFacts;
|
|
212
202
|
readonly configOrigin: SignoffConfigOrigin;
|
|
213
203
|
readonly workspace: string;
|
|
204
|
+
/** Kept intentionally, or retirement failed and removal is unconfirmed. */
|
|
214
205
|
readonly workspaceRetained: boolean;
|
|
215
206
|
readonly host: SignoffHostFacts;
|
|
216
207
|
readonly install: SignoffInstallResult;
|
package/package.json
CHANGED