Files
archie/proto/guard/v1/guard.proto
T

196 lines
6.2 KiB
Protocol Buffer

syntax = "proto3";
package guard.v1;
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
// GuardService is the surface a guard extension serves. A guard judges one
// concrete action and answers with a ceiling on the five-level scale. The host
// asks every running guard about every action and runs the action at the lowest
// ceiling.
service GuardService {
// Configure hands the guard its settings and resolved secrets, once, right
// after launch and before any Judge.
rpc Configure(ConfigureRequest) returns (ConfigureResponse);
// Describe names the guard and says whether its verdicts count.
rpc Describe(DescribeRequest) returns (DescribeResponse);
// Judge returns the guard's verdict on one action. The host enforces the
// request's deadline: a guard that errors, answers late or answers without
// a ceiling holds the action at propose and wait, unless it is advisory.
rpc Judge(JudgeRequest) returns (JudgeResponse);
}
message ConfigureRequest {
map<string, string> settings = 1;
map<string, string> secrets = 2;
}
message ConfigureResponse {}
message DescribeRequest {}
message DescribeResponse {
// contract is the contract version the guard speaks, "v1".
string contract = 1;
string name = 2;
// version is the guard's own release, recorded with each verdict.
string version = 3;
// advisory says the guard's verdicts are recorded and set no ceiling.
bool advisory = 4;
// settings are the values an operator enters for the guard to run,
// including the judge it asks. The dashboard renders them as a form.
repeated Setting settings = 5;
}
// Setting is one value an operator enters for an extension to run.
message Setting {
string key = 1;
string label = 2;
string description = 3;
// secret says the value is a secret reference, never the secret.
bool secret = 4;
bool required = 5;
// type decides how the value is entered and checked; unspecified is a
// string.
SettingType type = 6;
// options are the allowed values of a select setting.
repeated string options = 7;
}
enum SettingType {
SETTING_TYPE_UNSPECIFIED = 0;
SETTING_TYPE_STRING = 1;
SETTING_TYPE_NUMBER = 2;
SETTING_TYPE_BOOLEAN = 3;
SETTING_TYPE_DURATION = 4;
SETTING_TYPE_LIST = 5;
SETTING_TYPE_SELECT = 6;
SETTING_TYPE_TEXT = 7;
}
enum Reversibility {
REVERSIBILITY_UNSPECIFIED = 0;
REVERSIBILITY_UNDONE_AUTOMATICALLY = 1;
REVERSIBILITY_RECOVERABLE = 2;
REVERSIBILITY_IRREVERSIBLE = 3;
}
message Effect {
bool read_only = 1;
Reversibility reversibility = 2;
string summary = 3;
}
message Target {
string kind = 1;
string id = 2;
string environment = 3;
bool disposable = 4;
}
// Ceiling is the five-level scale, from the most autonomy to the least.
enum Ceiling {
CEILING_UNSPECIFIED = 0;
CEILING_ACT_QUIETLY = 1;
CEILING_ACT_AND_TELL = 2;
CEILING_PROPOSE_AND_WAIT = 3;
CEILING_ESCALATE = 4;
CEILING_NEVER = 5;
}
// Strength is how much a finding's evidence supports it.
enum Strength {
STRENGTH_UNSPECIFIED = 0;
STRENGTH_WEAK = 1;
STRENGTH_MODERATE = 2;
STRENGTH_STRONG = 3;
}
message RunContext {
string run_id = 1;
// decision_key identifies the attempt to run the action.
string decision_key = 2;
}
message JudgeRequest {
string connector = 1;
string name = 2;
bytes input = 3;
// digest identifies the exact action: its name and input.
string digest = 4;
Target target = 5;
Effect effect = 6;
RunContext run = 7;
// deadline is how long the host waits for the verdict.
google.protobuf.Duration deadline = 8;
// at is the host's clock when the action was put to the guard.
google.protobuf.Timestamp at = 9;
// diagnosis is what the agent concluded so far, in its own words. Empty
// when no agent proposed the action.
string diagnosis = 10;
// evidence is what the agent read during the run, oldest first.
repeated Evidence evidence = 11;
}
// Evidence is one result the agent read, as the tool returned it.
message Evidence {
// source names the tool that returned it.
string source = 1;
string text = 2;
}
message Finding {
string text = 1;
// evidence is what the finding rests on, in plain words.
string evidence = 2;
Strength strength = 3;
}
message JudgeResponse {
// ceiling must be set. A guard with no concern answers CEILING_ACT_QUIETLY.
Ceiling ceiling = 1;
repeated Finding findings = 2;
// blind_spots are what the guard could not see.
repeated string blind_spots = 3;
// judges is every model judgement the verdict rests on, clean answers
// included. A guard that asked a model records the answer here, so the
// verdict can be audited without asking the model again.
repeated JudgeRecord judges = 4;
}
// JudgeRecord is what one model judge answered and what it was judged on.
message JudgeRecord {
// model is the model that judged.
string model = 1;
// result_id identifies the judge's result with the service that ran it.
string result_id = 2;
// answer is the choice the judge settled on, such as "complies".
string answer = 3;
double confidence = 4;
// reason is the judge's own reasoning, or why the call failed.
string reason = 5;
// basis is the text the judge was given beyond the action itself, such as
// the policy rules. basis_digest is its SHA-256 in hex.
string basis = 6;
string basis_digest = 7;
// answers is every question's answer as JSON: choice, probabilities and
// confidence.
bytes answers = 8;
// trusted says the judge has passed its recorded eval, so its verdict sets
// a ceiling. When false, advisory_reason says why.
bool trusted = 9;
string advisory_reason = 10;
// eval_date is the date of the eval the judge's standing comes from.
string eval_date = 11;
// request is the exact body sent to the judge endpoint, and response the
// exact body it returned, both kept for audit. A failed call records what
// was sent and whatever came back.
bytes request = 12;
bytes response = 13;
// endpoint_path is the path the request was sent to, without the host.
string endpoint_path = 14;
// http_status is the response status, or 0 when no response arrived.
int32 http_status = 15;
// latency_ms is how long the call took, measured by the caller.
int64 latency_ms = 16;
}