audit-tools 0.30.3 → 0.30.4
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/audit/cli/auditStep.d.ts.map +1 -1
- package/dist/audit/cli/auditStep.js +24 -13
- package/dist/audit/cli/auditStep.js.map +1 -1
- package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
- package/dist/audit/cli/nextStepHelpers.js +11 -6
- package/dist/audit/cli/nextStepHelpers.js.map +1 -1
- package/dist/audit/cli/reviewRun.d.ts.map +1 -1
- package/dist/audit/cli/reviewRun.js +9 -4
- package/dist/audit/cli/reviewRun.js.map +1 -1
- package/dist/audit/contracts/workerSchemas.d.ts +22 -4
- package/dist/audit/contracts/workerSchemas.d.ts.map +1 -1
- package/dist/audit/contracts/wrapperResponse.d.ts +12 -12
- package/dist/audit/orchestrator/artifactFreshness.d.ts +2 -1
- package/dist/audit/orchestrator/artifactFreshness.d.ts.map +1 -1
- package/dist/audit/orchestrator/artifactFreshness.js +5 -15
- package/dist/audit/orchestrator/artifactFreshness.js.map +1 -1
- package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
- package/dist/audit/orchestrator/executorRunners.js +10 -9
- package/dist/audit/orchestrator/executorRunners.js.map +1 -1
- package/dist/audit/orchestrator/ingestionExecutors.d.ts.map +1 -1
- package/dist/audit/orchestrator/ingestionExecutors.js +5 -1
- package/dist/audit/orchestrator/ingestionExecutors.js.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointGate.d.ts +129 -0
- package/dist/audit/orchestrator/intentCheckpointGate.d.ts.map +1 -0
- package/dist/audit/orchestrator/intentCheckpointGate.js +193 -0
- package/dist/audit/orchestrator/intentCheckpointGate.js.map +1 -0
- package/dist/audit/orchestrator/ledger.d.ts +30 -0
- package/dist/audit/orchestrator/ledger.d.ts.map +1 -0
- package/dist/audit/orchestrator/ledger.js +126 -0
- package/dist/audit/orchestrator/ledger.js.map +1 -0
- package/dist/audit/orchestrator/nextStep.d.ts +11 -29
- package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
- package/dist/audit/orchestrator/nextStep.js +11 -29
- package/dist/audit/orchestrator/nextStep.js.map +1 -1
- package/dist/audit/orchestrator/resultBaseline.d.ts +82 -0
- package/dist/audit/orchestrator/resultBaseline.d.ts.map +1 -0
- package/dist/audit/orchestrator/resultBaseline.js +79 -0
- package/dist/audit/orchestrator/resultBaseline.js.map +1 -0
- package/dist/audit/quota/index.d.ts +12 -12
- package/dist/audit/types/artifactMetadata.d.ts +9 -0
- package/dist/audit/types/artifactMetadata.d.ts.map +1 -1
- package/dist/audit/types.d.ts +13 -4
- package/dist/audit/types.d.ts.map +1 -1
- package/dist/audit/types.js +8 -0
- package/dist/audit/types.js.map +1 -1
- package/dist/remediate/steps/nextStep.d.ts +11 -23
- package/dist/remediate/steps/nextStep.d.ts.map +1 -1
- package/dist/remediate/steps/nextStep.js +45 -43
- package/dist/remediate/steps/nextStep.js.map +1 -1
- package/dist/shared/contentKey.d.ts +83 -0
- package/dist/shared/contentKey.d.ts.map +1 -0
- package/dist/shared/contentKey.js +163 -0
- package/dist/shared/contentKey.js.map +1 -0
- package/dist/shared/friction/captureFrictionEvent.d.ts +50 -0
- package/dist/shared/friction/captureFrictionEvent.d.ts.map +1 -0
- package/dist/shared/friction/captureFrictionEvent.js +34 -0
- package/dist/shared/friction/captureFrictionEvent.js.map +1 -0
- package/dist/shared/friction/triage.d.ts +126 -0
- package/dist/shared/friction/triage.d.ts.map +1 -0
- package/dist/shared/friction/triage.js +149 -0
- package/dist/shared/friction/triage.js.map +1 -0
- package/dist/shared/index.d.ts +11 -2
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +8 -2
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/io/auditToolsPaths.d.ts +9 -0
- package/dist/shared/io/auditToolsPaths.d.ts.map +1 -1
- package/dist/shared/io/auditToolsPaths.js +11 -0
- package/dist/shared/io/auditToolsPaths.js.map +1 -1
- package/dist/shared/io/frictionCapture.d.ts +2 -0
- package/dist/shared/io/frictionCapture.d.ts.map +1 -1
- package/dist/shared/io/frictionCapture.js +1 -1
- package/dist/shared/io/frictionCapture.js.map +1 -1
- package/dist/shared/quota/capacity.d.ts +4 -4
- package/dist/shared/quota/quotaSource.d.ts +2 -2
- package/dist/shared/repair/emitValidateRepair.d.ts +124 -0
- package/dist/shared/repair/emitValidateRepair.d.ts.map +1 -0
- package/dist/shared/repair/emitValidateRepair.js +179 -0
- package/dist/shared/repair/emitValidateRepair.js.map +1 -0
- package/dist/shared/repair/index.d.ts +8 -0
- package/dist/shared/repair/index.d.ts.map +1 -0
- package/dist/shared/repair/index.js +2 -0
- package/dist/shared/repair/index.js.map +1 -0
- package/dist/shared/stableStringify.d.ts +14 -0
- package/dist/shared/stableStringify.d.ts.map +1 -0
- package/dist/shared/stableStringify.js +28 -0
- package/dist/shared/stableStringify.js.map +1 -0
- package/package.json +1 -1
- package/schemas/audit_result.schema.json +9 -0
- package/schemas/audit_results.schema.json +9 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* O2 — the append-only, instance-keyed, idempotent audit-results ledger.
|
|
3
|
+
*
|
|
4
|
+
* `audit_results.jsonl` is the cumulative store of every accepted AuditResult.
|
|
5
|
+
* This module is the SOLE place the ledger grows, so its three invariants hold
|
|
6
|
+
* by construction (never by a caller remembering them):
|
|
7
|
+
*
|
|
8
|
+
* - APPEND-ONLY, INSTANCE-KEYED (INV-1 / CE-001 / fail-2): every appended record
|
|
9
|
+
* carries a fresh per-record `instance_id` minted from the shared seam
|
|
10
|
+
* (`newInstanceId`). The ledger keys on this, so identity_key / idempotency_key
|
|
11
|
+
* are grouping/idempotency keys, NEVER primary keys — distinct records are never
|
|
12
|
+
* merged or last-writer-wins'd.
|
|
13
|
+
*
|
|
14
|
+
* - IDEMPOTENT ON idempotency_key (INV-2 / CE-001b / fail-4): a record is appended
|
|
15
|
+
* only when no existing record shares its `idempotency_key`. A replay of the same
|
|
16
|
+
* logical result is therefore a no-op. Two genuinely-different same-coordinate
|
|
17
|
+
* results (base vs. deepening / steward / re-dispatch) carry distinct
|
|
18
|
+
* discriminators → distinct idempotency_keys → both persist (CE-001).
|
|
19
|
+
*
|
|
20
|
+
* - RETAIN-UNASSIGNED (INV-3): re-association groups records to tasks by
|
|
21
|
+
* `identity_key` one-to-many and resolves logical identity by `idempotency_key`.
|
|
22
|
+
* A result whose owning task is absent from the active manifest is NEVER pruned —
|
|
23
|
+
* it stays in the ledger, just un-associated.
|
|
24
|
+
*
|
|
25
|
+
* All three keys are imported from the single content-key seam
|
|
26
|
+
* (`src/shared/contentKey.ts`); this module never re-derives a key.
|
|
27
|
+
*/
|
|
28
|
+
import { buildResultContentDiscriminator, identityKey, idempotencyKey, newInstanceId, } from "audit-tools/shared";
|
|
29
|
+
/**
|
|
30
|
+
* Deterministic, TOOL-OWNED mapping from a result's coordinate to its emit
|
|
31
|
+
* source. The discriminator recipe lives in the seam; the SOURCE selection lives
|
|
32
|
+
* here because it is audit-domain knowledge: selective-deepening / steward tasks
|
|
33
|
+
* are minted with `deepening:` / `steward:` task-id prefixes (see
|
|
34
|
+
* `selectiveDeepening/shared.ts#taskIdFor`), so a deepening or steward result
|
|
35
|
+
* that shares a base result's {unit_id, lens, pass_id} coordinate legitimately
|
|
36
|
+
* gets a DISTINCT idempotency_key and both persist (CE-001). Anything else is a
|
|
37
|
+
* base result. (Re-dispatch attempts are not yet stamped on results; when O3
|
|
38
|
+
* adds an attempt counter it maps to `source: 'redispatch'` here.)
|
|
39
|
+
*/
|
|
40
|
+
function emitSourceFor(result) {
|
|
41
|
+
const taskId = result.task_id ?? "";
|
|
42
|
+
if (taskId.startsWith("steward:"))
|
|
43
|
+
return "steward";
|
|
44
|
+
if (taskId.startsWith("deepening:"))
|
|
45
|
+
return "deepening";
|
|
46
|
+
return "base";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Stamp a result with its seam-derived ledger keys (instance_id, identity_key,
|
|
50
|
+
* idempotency_key) when they are not already present. Idempotent: a record that
|
|
51
|
+
* already carries an idempotency_key keeps its identity/idempotency keys (so a
|
|
52
|
+
* replay hashes identically), and only re-mints an absent instance_id.
|
|
53
|
+
*/
|
|
54
|
+
export function stampLedgerKeys(result) {
|
|
55
|
+
const identity_key = result.identity_key ??
|
|
56
|
+
identityKey({
|
|
57
|
+
unit_id: result.unit_id,
|
|
58
|
+
lens: result.lens,
|
|
59
|
+
pass_id: result.pass_id,
|
|
60
|
+
});
|
|
61
|
+
const idempotency_key = result.idempotency_key ??
|
|
62
|
+
idempotencyKey({
|
|
63
|
+
unit_id: result.unit_id,
|
|
64
|
+
lens: result.lens,
|
|
65
|
+
pass_id: result.pass_id,
|
|
66
|
+
result_content_discriminator: buildResultContentDiscriminator({
|
|
67
|
+
source: emitSourceFor(result),
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
...result,
|
|
72
|
+
instance_id: result.instance_id ?? newInstanceId(),
|
|
73
|
+
identity_key,
|
|
74
|
+
idempotency_key,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Append incoming results to the existing ledger, append-only and IDEMPOTENT on
|
|
79
|
+
* idempotency_key. Each appended record gets a fresh instance_id; a replay (an
|
|
80
|
+
* incoming result whose idempotency_key already exists in the ledger OR collides
|
|
81
|
+
* with an earlier record in the same batch) is a no-op. Distinct idempotency_keys
|
|
82
|
+
* always both persist — never merged, never last-writer-wins (fail-2).
|
|
83
|
+
*
|
|
84
|
+
* The existing ledger is returned by reference-extended copy; existing records
|
|
85
|
+
* are left untouched (append-only).
|
|
86
|
+
*/
|
|
87
|
+
export function appendResultsToLedger(existing, incoming) {
|
|
88
|
+
const ledger = [...(existing ?? [])];
|
|
89
|
+
const seen = new Set();
|
|
90
|
+
for (const record of ledger) {
|
|
91
|
+
const key = record.idempotency_key;
|
|
92
|
+
if (typeof key === "string")
|
|
93
|
+
seen.add(key);
|
|
94
|
+
}
|
|
95
|
+
for (const raw of incoming) {
|
|
96
|
+
const stamped = stampLedgerKeys(raw);
|
|
97
|
+
const key = stamped.idempotency_key;
|
|
98
|
+
if (seen.has(key)) {
|
|
99
|
+
// Replay of an already-ingested logical result — no-op (INV-2).
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
seen.add(key);
|
|
103
|
+
ledger.push(stamped);
|
|
104
|
+
}
|
|
105
|
+
return ledger;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Re-associate ledger records to tasks. Groups one-to-many by `identity_key`
|
|
109
|
+
* (multiple distinct results legitimately share a coordinate — base vs. deepening
|
|
110
|
+
* / steward) and resolves logical identity by `idempotency_key`. Records are
|
|
111
|
+
* stamped on read if a legacy entry predates the keys, so a ledger written before
|
|
112
|
+
* O2 still groups correctly. RETAIN-UNASSIGNED: every record appears in exactly
|
|
113
|
+
* one group keyed by its identity_key — none is dropped because its task is
|
|
114
|
+
* absent (INV-3); the caller decides what to do with a group whose task is gone.
|
|
115
|
+
*/
|
|
116
|
+
export function groupLedgerByIdentity(ledger) {
|
|
117
|
+
const byIdentity = new Map();
|
|
118
|
+
for (const raw of ledger) {
|
|
119
|
+
const record = stampLedgerKeys(raw);
|
|
120
|
+
const group = byIdentity.get(record.identity_key) ?? [];
|
|
121
|
+
group.push(record);
|
|
122
|
+
byIdentity.set(record.identity_key, group);
|
|
123
|
+
}
|
|
124
|
+
return byIdentity;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../src/audit/orchestrator/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAEL,+BAA+B,EAC/B,WAAW,EACX,cAAc,EACd,aAAa,GACd,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;;GAUG;AACH,SAAS,aAAa,CAAC,MAAmB;IACxC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IACpC,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,SAAS,CAAC;IACpD,IAAI,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,WAAW,CAAC;IACxD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAmB;IACjD,MAAM,YAAY,GAChB,MAAM,CAAC,YAAY;QACnB,WAAW,CAAC;YACV,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC;IACL,MAAM,eAAe,GACnB,MAAM,CAAC,eAAe;QACtB,cAAc,CAAC;YACb,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,4BAA4B,EAAE,+BAA+B,CAAC;gBAC5D,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC;aAC9B,CAAC;SACH,CAAC,CAAC;IACL,OAAO;QACL,GAAG,MAAM;QACT,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,aAAa,EAAE;QAClD,YAAY;QACZ,eAAe;KAChB,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAmC,EACnC,QAAuB;IAEvB,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC;QACnC,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,GAAG,GAAG,OAAO,CAAC,eAAgB,CAAC;QACrC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAClB,gEAAgE;YAChE,SAAS;QACX,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAqB;IAErB,MAAM,UAAU,GAAG,IAAI,GAAG,EAAyB,CAAC;IACpD,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,YAAa,CAAC,IAAI,EAAE,CAAC;QACzD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,YAAa,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FrictionTriageDecision } from "audit-tools/shared";
|
|
1
2
|
import type { ArtifactBundle } from "../io/artifacts.js";
|
|
2
3
|
import type { AuditObligation, AuditState } from "../types/auditState.js";
|
|
3
4
|
export interface NextStepDecision {
|
|
@@ -15,35 +16,16 @@ export declare const FRICTION_CAPTURE_OBLIGATION_ID = "friction_capture_current"
|
|
|
15
16
|
export declare const PRIORITY: string[];
|
|
16
17
|
export declare function findObligation(obligations: AuditObligation[]): AuditObligation | undefined;
|
|
17
18
|
export declare function decideNextStep(bundle: ArtifactBundle): NextStepDecision;
|
|
18
|
-
/** The terminal friction-capture close-out decision for the audit half. */
|
|
19
|
-
export interface AuditFrictionCloseoutDecision {
|
|
20
|
-
/**
|
|
21
|
-
* "capture" → the close-out must fire this pass (a friction step is emitted and a
|
|
22
|
-
* degrade-clean record persisted). "captured" → already recorded for this run_id;
|
|
23
|
-
* the close-out is satisfied and the run proceeds to its complete/present terminal.
|
|
24
|
-
*/
|
|
25
|
-
action: "capture" | "captured";
|
|
26
|
-
/** The run_id-keyed friction record path (always set, for the handoff pointer). */
|
|
27
|
-
recordPath: string;
|
|
28
|
-
}
|
|
29
19
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* the close-out fires at most once per run.
|
|
40
|
-
* - PARITY: identical shape + persist helper to the remediate side (single-sourced
|
|
41
|
-
* in `audit-tools/shared`), so the two halves cannot drift.
|
|
42
|
-
* - NEVER couples to any repo's backlog doc — the record lives under the run's own
|
|
43
|
-
* artifacts dir.
|
|
44
|
-
*
|
|
45
|
-
* Returns "capture" the first time (the host should be prompted to optionally enrich
|
|
46
|
-
* the persisted record), "captured" thereafter.
|
|
20
|
+
* The terminal friction-TRIAGE close-out for the audit half. Thin delegation to the
|
|
21
|
+
* single-sourced `decideFrictionTriage` (`audit-tools/shared`) so the triage shape,
|
|
22
|
+
* disposition vocabulary, blocking semantics, and close-out logic cannot drift from
|
|
23
|
+
* the remediate half. Drops the former false-green (an empty up-front record no
|
|
24
|
+
* longer satisfies): the close-out blocks ("dispose") until every captured
|
|
25
|
+
* mechanical event AND every surfaced agent-feedback reflection carries a
|
|
26
|
+
* disposition; an empty set (zero events AND zero reflections) is trivially
|
|
27
|
+
* "disposed". Keyed only off `(artifactsDir, runId)`; never coupled to any repo's
|
|
28
|
+
* backlog doc.
|
|
47
29
|
*/
|
|
48
|
-
export declare function decideAuditFrictionCloseout(artifactsDir: string, runId: string): Promise<
|
|
30
|
+
export declare function decideAuditFrictionCloseout(artifactsDir: string, runId: string): Promise<FrictionTriageDecision>;
|
|
49
31
|
//# sourceMappingURL=nextStep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextStep.d.ts","sourceRoot":"","sources":["../../../src/audit/orchestrator/nextStep.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nextStep.d.ts","sourceRoot":"","sources":["../../../src/audit/orchestrator/nextStep.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAI1E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,6BAA6B,CAAC;AAEzE,eAAO,MAAM,QAAQ,EAAE,MAAM,EAwB5B,CAAC;AAMF,wBAAgB,cAAc,CAC5B,WAAW,EAAE,eAAe,EAAE,GAC7B,eAAe,GAAG,SAAS,CAE7B;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAqCvE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,2BAA2B,CAC/C,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAEjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFirstActionableObligation } from "audit-tools/shared";
|
|
2
|
-
import {
|
|
2
|
+
import { decideFrictionTriage, } from "audit-tools/shared";
|
|
3
3
|
import { EXECUTOR_REGISTRY } from "./executors.js";
|
|
4
4
|
import { deriveAuditState } from "./state.js";
|
|
5
5
|
/**
|
|
@@ -74,35 +74,17 @@ export function decideNextStep(bundle) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* the close-out fires at most once per run.
|
|
87
|
-
* - PARITY: identical shape + persist helper to the remediate side (single-sourced
|
|
88
|
-
* in `audit-tools/shared`), so the two halves cannot drift.
|
|
89
|
-
* - NEVER couples to any repo's backlog doc — the record lives under the run's own
|
|
90
|
-
* artifacts dir.
|
|
91
|
-
*
|
|
92
|
-
* Returns "capture" the first time (the host should be prompted to optionally enrich
|
|
93
|
-
* the persisted record), "captured" thereafter.
|
|
77
|
+
* The terminal friction-TRIAGE close-out for the audit half. Thin delegation to the
|
|
78
|
+
* single-sourced `decideFrictionTriage` (`audit-tools/shared`) so the triage shape,
|
|
79
|
+
* disposition vocabulary, blocking semantics, and close-out logic cannot drift from
|
|
80
|
+
* the remediate half. Drops the former false-green (an empty up-front record no
|
|
81
|
+
* longer satisfies): the close-out blocks ("dispose") until every captured
|
|
82
|
+
* mechanical event AND every surfaced agent-feedback reflection carries a
|
|
83
|
+
* disposition; an empty set (zero events AND zero reflections) is trivially
|
|
84
|
+
* "disposed". Keyed only off `(artifactsDir, runId)`; never coupled to any repo's
|
|
85
|
+
* backlog doc.
|
|
94
86
|
*/
|
|
95
87
|
export async function decideAuditFrictionCloseout(artifactsDir, runId) {
|
|
96
|
-
|
|
97
|
-
if (await frictionCaptured(artifactsDir, runId)) {
|
|
98
|
-
return { action: "captured", recordPath };
|
|
99
|
-
}
|
|
100
|
-
await persistFrictionCapture({
|
|
101
|
-
artifactsDir,
|
|
102
|
-
runId,
|
|
103
|
-
tool: "audit-code",
|
|
104
|
-
frictions: [],
|
|
105
|
-
});
|
|
106
|
-
return { action: "capture", recordPath };
|
|
88
|
+
return decideFrictionTriage(artifactsDir, runId, "audit-code");
|
|
107
89
|
}
|
|
108
90
|
//# sourceMappingURL=nextStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextStep.js","sourceRoot":"","sources":["../../../src/audit/orchestrator/nextStep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"nextStep.js","sourceRoot":"","sources":["../../../src/audit/orchestrator/nextStep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EACL,oBAAoB,GAErB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAS9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,0BAA0B,CAAC;AAEzE,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,uBAAuB;IACvB,eAAe;IACf,kBAAkB;IAClB,oBAAoB;IACpB,iBAAiB;IACjB,qBAAqB;IACrB,0BAA0B;IAC1B,2BAA2B;IAC3B,2BAA2B;IAC3B,kCAAkC;IAClC,oCAAoC;IACpC,oBAAoB;IACpB,uBAAuB;IACvB,wBAAwB;IACxB,4BAA4B;IAC5B,mBAAmB;IACnB,6BAA6B;IAC7B,gFAAgF;IAChF,kFAAkF;IAClF,+EAA+E;IAC/E,yEAAyE;IACzE,mFAAmF;IACnF,8BAA8B;CAC/B,CAAC;AAEF,2EAA2E;AAC3E,8EAA8E;AAC9E,+EAA+E;AAC/E,sDAAsD;AACtD,MAAM,UAAU,cAAc,CAC5B,WAA8B;IAE9B,OAAO,6BAA6B,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,4EAA4E;IAC5E,kEAAkE;IAClE,IAAI,MAAM,CAAC,WAAW,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;QAC9C,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,WAAW;YACzB,mBAAmB,EAAE,IAAI;YACzB,iBAAiB,EAAE,IAAI;YACvB,MAAM,EAAE,gDAAgD;SACzD,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAE/C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO;YACL,KAAK;YACL,mBAAmB,EAAE,IAAI;YACzB,iBAAiB,EAAE,IAAI;YACvB,MAAM,EACJ,KAAK,CAAC,MAAM,KAAK,UAAU;gBACzB,CAAC,CAAC,gDAAgD;gBAClD,CAAC,CAAC,6CAA6C;SACpD,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAC/C,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CACtC,CAAC;IACF,OAAO;QACL,KAAK;QACL,mBAAmB,EAAE,IAAI,CAAC,EAAE;QAC5B,iBAAiB,EAAE,QAAQ,EAAE,EAAE,IAAI,IAAI;QACvC,MAAM,EAAE,QAAQ;YACd,CAAC,CAAC,mDAAmD,IAAI,CAAC,EAAE,GAAG;YAC/D,CAAC,CAAC,oCAAoC,IAAI,CAAC,EAAE,8IAA8I;KAC9L,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,YAAoB,EACpB,KAAa;IAEb,OAAO,oBAAoB,CAAC,YAAY,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* O2 ↔ F1 residual-risk fix for judge-accepted CE-011: element-staleness for an
|
|
3
|
+
* already-ingested logical result must compare a FRESHLY-COMPUTED current
|
|
4
|
+
* `contentKey` (derived from the LIVE `task_content_signature` at advance time)
|
|
5
|
+
* against a prior BASELINE `contentKey` — and that baseline must live OUTSIDE the
|
|
6
|
+
* immutable per-record ledger instance.
|
|
7
|
+
*
|
|
8
|
+
* Why not read the contentKey off the ledger record? The append-only ledger
|
|
9
|
+
* (INV-O2-1) keys records on `idempotency_key`, which is signature-STABLE: a
|
|
10
|
+
* benign content edit (C1 → C2) does NOT move it, so idempotent re-ingest of the
|
|
11
|
+
* already-ingested result stays a no-op (no duplicate record is appended). If
|
|
12
|
+
* staleness ALSO read its prior contentKey from that same immutable record, the
|
|
13
|
+
* record would still carry C1 and a benign edit could never fire staleness — the
|
|
14
|
+
* exact CE-011 residual hole. So the baseline contentKey is persisted in a
|
|
15
|
+
* SEPARATE store (`artifact_metadata.result_baselines`, keyed by
|
|
16
|
+
* `idempotency_key`) that the staleness gate updates as the live signature moves,
|
|
17
|
+
* while the ledger record itself is never mutated. Append-only ledger invariants
|
|
18
|
+
* are therefore untouched.
|
|
19
|
+
*
|
|
20
|
+
* The comparison driver is the seam's `contentKey` (signature-SENSITIVE), so:
|
|
21
|
+
* live C2 != baseline C1 ⟹ staleness FIRES,
|
|
22
|
+
* while the seam's signature-STABLE `idempotencyKey` keeps idempotent re-ingest a
|
|
23
|
+
* no-op. The two are reconciled by construction (see src/shared/contentKey.ts).
|
|
24
|
+
*/
|
|
25
|
+
import { type ResultEmitSource } from "audit-tools/shared";
|
|
26
|
+
/**
|
|
27
|
+
* The baseline store — the per-logical-result contentKey snapshot, keyed by the
|
|
28
|
+
* signature-STABLE `idempotency_key`. Persisted in `artifact_metadata` OUTSIDE
|
|
29
|
+
* the per-record ledger, so updating a baseline never mutates an immutable ledger
|
|
30
|
+
* record (INV-O2-1 untouched).
|
|
31
|
+
*/
|
|
32
|
+
export type ResultBaselineStore = Record<string, string>;
|
|
33
|
+
/** The live coordinate + signature needed to freshly compute the current keys. */
|
|
34
|
+
export interface LiveResultKeyInput {
|
|
35
|
+
unit_id: string;
|
|
36
|
+
lens: string;
|
|
37
|
+
pass_id: string;
|
|
38
|
+
/** Tool-owned emit source (base | deepening | steward | redispatch). */
|
|
39
|
+
source: ResultEmitSource;
|
|
40
|
+
/** Required when `source === 'redispatch'`. */
|
|
41
|
+
attempt?: number;
|
|
42
|
+
/**
|
|
43
|
+
* The LIVE task-content signature derived from the current task content at
|
|
44
|
+
* advance time — NEVER a value read off a stored ledger record.
|
|
45
|
+
*/
|
|
46
|
+
task_content_signature: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Freshly derive the {idempotency_key, content_key} pair for a live result from
|
|
50
|
+
* the seam — both computed from the live `task_content_signature` at advance
|
|
51
|
+
* time. `idempotency_key` is the baseline-store key (signature-STABLE);
|
|
52
|
+
* `content_key` is the staleness driver (signature-SENSITIVE).
|
|
53
|
+
*/
|
|
54
|
+
export declare function deriveLiveResultKeys(input: LiveResultKeyInput): {
|
|
55
|
+
idempotency_key: string;
|
|
56
|
+
content_key: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Is the already-ingested logical result stale, given its LIVE keys? Stale iff a
|
|
60
|
+
* baseline exists for the idempotency_key AND the freshly-computed live
|
|
61
|
+
* content_key differs from it. A result with no recorded baseline is NOT stale —
|
|
62
|
+
* it has simply never been compared (the first ingest establishes the baseline).
|
|
63
|
+
*
|
|
64
|
+
* The caller supplies live keys via `deriveLiveResultKeys` (freshly computed from
|
|
65
|
+
* the live signature) — this function NEVER reads a contentKey off a ledger
|
|
66
|
+
* record.
|
|
67
|
+
*/
|
|
68
|
+
export declare function isResultStaleAgainstBaseline(baselines: ResultBaselineStore | undefined, liveKeys: {
|
|
69
|
+
idempotency_key: string;
|
|
70
|
+
content_key: string;
|
|
71
|
+
}): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Return an updated baseline store with this logical result's baseline set to its
|
|
74
|
+
* live content_key. Pure: returns a new object, never mutates the input — so a
|
|
75
|
+
* caller persists the result through the normal artifact_metadata write path.
|
|
76
|
+
* Idempotent: recording the same content_key again yields an equal store.
|
|
77
|
+
*/
|
|
78
|
+
export declare function recordResultBaseline(baselines: ResultBaselineStore | undefined, liveKeys: {
|
|
79
|
+
idempotency_key: string;
|
|
80
|
+
content_key: string;
|
|
81
|
+
}): ResultBaselineStore;
|
|
82
|
+
//# sourceMappingURL=resultBaseline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultBaseline.d.ts","sourceRoot":"","sources":["../../../src/audit/orchestrator/resultBaseline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEzD,kFAAkF;AAClF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,MAAM,EAAE,gBAAgB,CAAC;IACzB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,kBAAkB,GAAG;IAC/D,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAkBA;AAED;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,mBAAmB,GAAG,SAAS,EAC1C,QAAQ,EAAE;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACzD,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,mBAAmB,GAAG,SAAS,EAC1C,QAAQ,EAAE;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACzD,mBAAmB,CAKrB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* O2 ↔ F1 residual-risk fix for judge-accepted CE-011: element-staleness for an
|
|
3
|
+
* already-ingested logical result must compare a FRESHLY-COMPUTED current
|
|
4
|
+
* `contentKey` (derived from the LIVE `task_content_signature` at advance time)
|
|
5
|
+
* against a prior BASELINE `contentKey` — and that baseline must live OUTSIDE the
|
|
6
|
+
* immutable per-record ledger instance.
|
|
7
|
+
*
|
|
8
|
+
* Why not read the contentKey off the ledger record? The append-only ledger
|
|
9
|
+
* (INV-O2-1) keys records on `idempotency_key`, which is signature-STABLE: a
|
|
10
|
+
* benign content edit (C1 → C2) does NOT move it, so idempotent re-ingest of the
|
|
11
|
+
* already-ingested result stays a no-op (no duplicate record is appended). If
|
|
12
|
+
* staleness ALSO read its prior contentKey from that same immutable record, the
|
|
13
|
+
* record would still carry C1 and a benign edit could never fire staleness — the
|
|
14
|
+
* exact CE-011 residual hole. So the baseline contentKey is persisted in a
|
|
15
|
+
* SEPARATE store (`artifact_metadata.result_baselines`, keyed by
|
|
16
|
+
* `idempotency_key`) that the staleness gate updates as the live signature moves,
|
|
17
|
+
* while the ledger record itself is never mutated. Append-only ledger invariants
|
|
18
|
+
* are therefore untouched.
|
|
19
|
+
*
|
|
20
|
+
* The comparison driver is the seam's `contentKey` (signature-SENSITIVE), so:
|
|
21
|
+
* live C2 != baseline C1 ⟹ staleness FIRES,
|
|
22
|
+
* while the seam's signature-STABLE `idempotencyKey` keeps idempotent re-ingest a
|
|
23
|
+
* no-op. The two are reconciled by construction (see src/shared/contentKey.ts).
|
|
24
|
+
*/
|
|
25
|
+
import { buildResultContentDiscriminator, contentKey, idempotencyKey, } from "audit-tools/shared";
|
|
26
|
+
/**
|
|
27
|
+
* Freshly derive the {idempotency_key, content_key} pair for a live result from
|
|
28
|
+
* the seam — both computed from the live `task_content_signature` at advance
|
|
29
|
+
* time. `idempotency_key` is the baseline-store key (signature-STABLE);
|
|
30
|
+
* `content_key` is the staleness driver (signature-SENSITIVE).
|
|
31
|
+
*/
|
|
32
|
+
export function deriveLiveResultKeys(input) {
|
|
33
|
+
const discriminator = buildResultContentDiscriminator({
|
|
34
|
+
source: input.source,
|
|
35
|
+
attempt: input.attempt,
|
|
36
|
+
});
|
|
37
|
+
const coordinate = {
|
|
38
|
+
unit_id: input.unit_id,
|
|
39
|
+
lens: input.lens,
|
|
40
|
+
pass_id: input.pass_id,
|
|
41
|
+
result_content_discriminator: discriminator,
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
idempotency_key: idempotencyKey(coordinate),
|
|
45
|
+
content_key: contentKey({
|
|
46
|
+
...coordinate,
|
|
47
|
+
task_content_signature: input.task_content_signature,
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Is the already-ingested logical result stale, given its LIVE keys? Stale iff a
|
|
53
|
+
* baseline exists for the idempotency_key AND the freshly-computed live
|
|
54
|
+
* content_key differs from it. A result with no recorded baseline is NOT stale —
|
|
55
|
+
* it has simply never been compared (the first ingest establishes the baseline).
|
|
56
|
+
*
|
|
57
|
+
* The caller supplies live keys via `deriveLiveResultKeys` (freshly computed from
|
|
58
|
+
* the live signature) — this function NEVER reads a contentKey off a ledger
|
|
59
|
+
* record.
|
|
60
|
+
*/
|
|
61
|
+
export function isResultStaleAgainstBaseline(baselines, liveKeys) {
|
|
62
|
+
const baseline = baselines?.[liveKeys.idempotency_key];
|
|
63
|
+
if (baseline === undefined)
|
|
64
|
+
return false;
|
|
65
|
+
return baseline !== liveKeys.content_key;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Return an updated baseline store with this logical result's baseline set to its
|
|
69
|
+
* live content_key. Pure: returns a new object, never mutates the input — so a
|
|
70
|
+
* caller persists the result through the normal artifact_metadata write path.
|
|
71
|
+
* Idempotent: recording the same content_key again yields an equal store.
|
|
72
|
+
*/
|
|
73
|
+
export function recordResultBaseline(baselines, liveKeys) {
|
|
74
|
+
return {
|
|
75
|
+
...(baselines ?? {}),
|
|
76
|
+
[liveKeys.idempotency_key]: liveKeys.content_key,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=resultBaseline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultBaseline.js","sourceRoot":"","sources":["../../../src/audit/orchestrator/resultBaseline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EACL,+BAA+B,EAC/B,UAAU,EACV,cAAc,GAEf,MAAM,oBAAoB,CAAC;AA0B5B;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAyB;IAI5D,MAAM,aAAa,GAAG,+BAA+B,CAAC;QACpD,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC,CAAC;IACH,MAAM,UAAU,GAAG;QACjB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,4BAA4B,EAAE,aAAa;KAC5C,CAAC;IACF,OAAO;QACL,eAAe,EAAE,cAAc,CAAC,UAAU,CAAC;QAC3C,WAAW,EAAE,UAAU,CAAC;YACtB,GAAG,UAAU;YACb,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;SACrD,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,4BAA4B,CAC1C,SAA0C,EAC1C,QAA0D;IAE1D,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IACvD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACzC,OAAO,QAAQ,KAAK,QAAQ,CAAC,WAAW,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,SAA0C,EAC1C,QAA0D;IAE1D,OAAO;QACL,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC;QACpB,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,QAAQ,CAAC,WAAW;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -105,18 +105,18 @@ export declare const DispatchQuotaSchema: z.ZodObject<{
|
|
|
105
105
|
captured_at: z.ZodString;
|
|
106
106
|
source: z.ZodString;
|
|
107
107
|
}, "strict", z.ZodTypeAny, {
|
|
108
|
+
captured_at: string;
|
|
108
109
|
remaining_pct: number | null;
|
|
109
110
|
reset_at: string | null;
|
|
110
111
|
requests_remaining: number | null;
|
|
111
112
|
tokens_remaining: number | null;
|
|
112
|
-
captured_at: string;
|
|
113
113
|
source: string;
|
|
114
114
|
}, {
|
|
115
|
+
captured_at: string;
|
|
115
116
|
remaining_pct: number | null;
|
|
116
117
|
reset_at: string | null;
|
|
117
118
|
requests_remaining: number | null;
|
|
118
119
|
tokens_remaining: number | null;
|
|
119
|
-
captured_at: string;
|
|
120
120
|
source: string;
|
|
121
121
|
}>>>;
|
|
122
122
|
quota_signal_degraded: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -144,11 +144,11 @@ export declare const DispatchQuotaSchema: z.ZodObject<{
|
|
|
144
144
|
binding_cap: "none" | "learned" | "rpm" | "tpm" | "fallback" | "first_contact" | "cooldown" | "host_concurrency";
|
|
145
145
|
rank?: "deep" | "small" | "standard" | undefined;
|
|
146
146
|
quota_source_snapshot?: {
|
|
147
|
+
captured_at: string;
|
|
147
148
|
remaining_pct: number | null;
|
|
148
149
|
reset_at: string | null;
|
|
149
150
|
requests_remaining: number | null;
|
|
150
151
|
tokens_remaining: number | null;
|
|
151
|
-
captured_at: string;
|
|
152
152
|
source: string;
|
|
153
153
|
} | null | undefined;
|
|
154
154
|
quota_signal_degraded?: boolean | undefined;
|
|
@@ -176,11 +176,11 @@ export declare const DispatchQuotaSchema: z.ZodObject<{
|
|
|
176
176
|
binding_cap: "none" | "learned" | "rpm" | "tpm" | "fallback" | "first_contact" | "cooldown" | "host_concurrency";
|
|
177
177
|
rank?: "deep" | "small" | "standard" | undefined;
|
|
178
178
|
quota_source_snapshot?: {
|
|
179
|
+
captured_at: string;
|
|
179
180
|
remaining_pct: number | null;
|
|
180
181
|
reset_at: string | null;
|
|
181
182
|
requests_remaining: number | null;
|
|
182
183
|
tokens_remaining: number | null;
|
|
183
|
-
captured_at: string;
|
|
184
184
|
source: string;
|
|
185
185
|
} | null | undefined;
|
|
186
186
|
quota_signal_degraded?: boolean | undefined;
|
|
@@ -213,18 +213,18 @@ export declare const DispatchQuotaSchema: z.ZodObject<{
|
|
|
213
213
|
captured_at: z.ZodString;
|
|
214
214
|
source: z.ZodString;
|
|
215
215
|
}, "strict", z.ZodTypeAny, {
|
|
216
|
+
captured_at: string;
|
|
216
217
|
remaining_pct: number | null;
|
|
217
218
|
reset_at: string | null;
|
|
218
219
|
requests_remaining: number | null;
|
|
219
220
|
tokens_remaining: number | null;
|
|
220
|
-
captured_at: string;
|
|
221
221
|
source: string;
|
|
222
222
|
}, {
|
|
223
|
+
captured_at: string;
|
|
223
224
|
remaining_pct: number | null;
|
|
224
225
|
reset_at: string | null;
|
|
225
226
|
requests_remaining: number | null;
|
|
226
227
|
tokens_remaining: number | null;
|
|
227
|
-
captured_at: string;
|
|
228
228
|
source: string;
|
|
229
229
|
}>>>;
|
|
230
230
|
backoff_state: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -243,6 +243,7 @@ export declare const DispatchQuotaSchema: z.ZodObject<{
|
|
|
243
243
|
}, "strict", z.ZodTypeAny, {
|
|
244
244
|
confidence: "high" | "low" | "medium";
|
|
245
245
|
contract_version: "audit-code-dispatch-quota/v1alpha1" | "audit-code-dispatch-quota/v1alpha2";
|
|
246
|
+
run_id: string;
|
|
246
247
|
source: "default" | "explicit_config" | "discovered_capability" | "cli_flags" | "provider_default" | "learned";
|
|
247
248
|
cooldown_until: string | null;
|
|
248
249
|
model: string | null;
|
|
@@ -258,15 +259,14 @@ export declare const DispatchQuotaSchema: z.ZodObject<{
|
|
|
258
259
|
active_subagents: number;
|
|
259
260
|
description: string;
|
|
260
261
|
} | null;
|
|
261
|
-
run_id: string;
|
|
262
262
|
max_concurrent_agents: number;
|
|
263
263
|
binding_cap?: "none" | "learned" | "rpm" | "tpm" | "fallback" | "first_contact" | "cooldown" | "host_concurrency" | undefined;
|
|
264
264
|
quota_source_snapshot?: {
|
|
265
|
+
captured_at: string;
|
|
265
266
|
remaining_pct: number | null;
|
|
266
267
|
reset_at: string | null;
|
|
267
268
|
requests_remaining: number | null;
|
|
268
269
|
tokens_remaining: number | null;
|
|
269
|
-
captured_at: string;
|
|
270
270
|
source: string;
|
|
271
271
|
} | null | undefined;
|
|
272
272
|
capacity_pools?: {
|
|
@@ -292,11 +292,11 @@ export declare const DispatchQuotaSchema: z.ZodObject<{
|
|
|
292
292
|
binding_cap: "none" | "learned" | "rpm" | "tpm" | "fallback" | "first_contact" | "cooldown" | "host_concurrency";
|
|
293
293
|
rank?: "deep" | "small" | "standard" | undefined;
|
|
294
294
|
quota_source_snapshot?: {
|
|
295
|
+
captured_at: string;
|
|
295
296
|
remaining_pct: number | null;
|
|
296
297
|
reset_at: string | null;
|
|
297
298
|
requests_remaining: number | null;
|
|
298
299
|
tokens_remaining: number | null;
|
|
299
|
-
captured_at: string;
|
|
300
300
|
source: string;
|
|
301
301
|
} | null | undefined;
|
|
302
302
|
quota_signal_degraded?: boolean | undefined;
|
|
@@ -317,6 +317,7 @@ export declare const DispatchQuotaSchema: z.ZodObject<{
|
|
|
317
317
|
}, {
|
|
318
318
|
confidence: "high" | "low" | "medium";
|
|
319
319
|
contract_version: "audit-code-dispatch-quota/v1alpha1" | "audit-code-dispatch-quota/v1alpha2";
|
|
320
|
+
run_id: string;
|
|
320
321
|
source: "default" | "explicit_config" | "discovered_capability" | "cli_flags" | "provider_default" | "learned";
|
|
321
322
|
cooldown_until: string | null;
|
|
322
323
|
model: string | null;
|
|
@@ -332,15 +333,14 @@ export declare const DispatchQuotaSchema: z.ZodObject<{
|
|
|
332
333
|
active_subagents: number;
|
|
333
334
|
description: string;
|
|
334
335
|
} | null;
|
|
335
|
-
run_id: string;
|
|
336
336
|
max_concurrent_agents: number;
|
|
337
337
|
binding_cap?: "none" | "learned" | "rpm" | "tpm" | "fallback" | "first_contact" | "cooldown" | "host_concurrency" | undefined;
|
|
338
338
|
quota_source_snapshot?: {
|
|
339
|
+
captured_at: string;
|
|
339
340
|
remaining_pct: number | null;
|
|
340
341
|
reset_at: string | null;
|
|
341
342
|
requests_remaining: number | null;
|
|
342
343
|
tokens_remaining: number | null;
|
|
343
|
-
captured_at: string;
|
|
344
344
|
source: string;
|
|
345
345
|
} | null | undefined;
|
|
346
346
|
capacity_pools?: {
|
|
@@ -366,11 +366,11 @@ export declare const DispatchQuotaSchema: z.ZodObject<{
|
|
|
366
366
|
binding_cap: "none" | "learned" | "rpm" | "tpm" | "fallback" | "first_contact" | "cooldown" | "host_concurrency";
|
|
367
367
|
rank?: "deep" | "small" | "standard" | undefined;
|
|
368
368
|
quota_source_snapshot?: {
|
|
369
|
+
captured_at: string;
|
|
369
370
|
remaining_pct: number | null;
|
|
370
371
|
reset_at: string | null;
|
|
371
372
|
requests_remaining: number | null;
|
|
372
373
|
tokens_remaining: number | null;
|
|
373
|
-
captured_at: string;
|
|
374
374
|
source: string;
|
|
375
375
|
} | null | undefined;
|
|
376
376
|
quota_signal_degraded?: boolean | undefined;
|
|
@@ -5,5 +5,14 @@ export interface ArtifactMetadataEntry {
|
|
|
5
5
|
}
|
|
6
6
|
export interface ArtifactMetadataManifest {
|
|
7
7
|
artifacts: Record<string, ArtifactMetadataEntry>;
|
|
8
|
+
/**
|
|
9
|
+
* O2 ↔ F1 result-baseline store (CE-011 residual fix): per-logical-result
|
|
10
|
+
* baseline `contentKey`, keyed by the signature-STABLE `idempotency_key`. Lives
|
|
11
|
+
* HERE — in artifact_metadata, OUTSIDE the append-only ledger — so element
|
|
12
|
+
* staleness compares a freshly-computed live contentKey against this baseline
|
|
13
|
+
* without ever mutating an immutable ledger record (INV-O2-1 untouched). See
|
|
14
|
+
* `src/audit/orchestrator/resultBaseline.ts`.
|
|
15
|
+
*/
|
|
16
|
+
result_baselines?: Record<string, string>;
|
|
8
17
|
}
|
|
9
18
|
//# sourceMappingURL=artifactMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifactMetadata.d.ts","sourceRoot":"","sources":["../../../src/audit/types/artifactMetadata.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"artifactMetadata.d.ts","sourceRoot":"","sources":["../../../src/audit/types/artifactMetadata.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACjD;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C"}
|