mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-16 15:43:57 -06:00
618fba92bf
* feat(audit): add opt-in execution identity inspection * fix(audit): gate recovery identity retention * fix(audit): keep recovery identity type private * test(audit): type internal recovery fixture * test(audit): split recovery identity coverage * docs(audit): define operator read trust boundary * test(qa): register identity scenario child * fix(audit): enforce shared identity retention bounds * fix(audit): seal public ingress identity boundary * fix(audit): keep ingress guard lint-clean * fix(gateway): preserve advertised method order * chore(protocol): sync advertised method order * fix(protocol): encode audit selector invariants * test(audit): prove exact execution guard * fix(audit): keep identity storage lazy
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import "./audit.js";
|
|
import type { AuditRunInspectResult } from "../../packages/gateway-protocol/src/index.js";
|
|
|
|
type AuditTestEvent = {
|
|
occurredAt: number;
|
|
kind: string;
|
|
status: string;
|
|
action: string;
|
|
direction?: string;
|
|
channel?: string;
|
|
agentId?: string;
|
|
runId?: string;
|
|
toolName?: string;
|
|
};
|
|
|
|
type AuditCommandTestApi = {
|
|
formatAuditRunInspection(result: AuditRunInspectResult): string[];
|
|
formatAuditRows(events: readonly AuditTestEvent[]): string[];
|
|
hasExplainIncompatibleFilters(options: Record<string, unknown>): boolean;
|
|
parseAuditDecisionLimit(value: string | undefined): number;
|
|
parseAuditExecutionLimit(value: string | undefined): number;
|
|
parseAuditLimit(value: string | undefined): number;
|
|
parseAuditTimestamp(value: string | undefined, flag: string): number | undefined;
|
|
};
|
|
|
|
function getTestApi(): AuditCommandTestApi {
|
|
return (globalThis as Record<PropertyKey, unknown>)[
|
|
Symbol.for("openclaw.auditCommandTestApi")
|
|
] as AuditCommandTestApi;
|
|
}
|
|
|
|
export const testApi: AuditCommandTestApi = {
|
|
formatAuditRunInspection(result) {
|
|
return getTestApi().formatAuditRunInspection(result);
|
|
},
|
|
formatAuditRows(events) {
|
|
return getTestApi().formatAuditRows(events);
|
|
},
|
|
hasExplainIncompatibleFilters(options) {
|
|
return getTestApi().hasExplainIncompatibleFilters(options);
|
|
},
|
|
parseAuditDecisionLimit(value) {
|
|
return getTestApi().parseAuditDecisionLimit(value);
|
|
},
|
|
parseAuditExecutionLimit(value) {
|
|
return getTestApi().parseAuditExecutionLimit(value);
|
|
},
|
|
parseAuditLimit(value) {
|
|
return getTestApi().parseAuditLimit(value);
|
|
},
|
|
parseAuditTimestamp(value, flag) {
|
|
return getTestApi().parseAuditTimestamp(value, flag);
|
|
},
|
|
};
|