fathom¶
Package fathom provides a Go client for the Fathom policy engine REST API.
Index¶
- Variables
- type AssertFactRequest
- type AssertFactResponse
- type ChangeType
- type Client
- func NewClient(baseURL string, opts ...ClientOption) *Client
- func (c *Client) AssertFact(ctx context.Context, req *AssertFactRequest) (*AssertFactResponse, error)
- func (c *Client) Evaluate(ctx context.Context, req *EvaluateRequest) (*EvaluateResponse, error)
- func (c *Client) Query(ctx context.Context, req *QueryRequest) (*QueryResponse, error)
- func (c *Client) Retract(ctx context.Context, req *RetractRequest) (*RetractResponse, error)
- type ClientOption
- func WithBearerToken(tok string) ClientOption
- func WithHTTPClient(hc *http.Client) ClientOption
- type EvaluateRequest
- type EvaluateResponse
- type FactChangeEvent
- type FactInput
- type GRPCClient
- func NewGRPCClient(target string, opts ...GRPCOption) (*GRPCClient, error)
- func (c *GRPCClient) AssertFact(ctx context.Context, req *AssertFactRequest) (*AssertFactResponse, error)
- func (c *GRPCClient) Close() error
- func (c *GRPCClient) Evaluate(ctx context.Context, req *EvaluateRequest) (*EvaluateResponse, error)
- func (c *GRPCClient) Query(ctx context.Context, req *QueryRequest) (*QueryResponse, error)
- func (c *GRPCClient) Reload(ctx context.Context, req *ReloadRequest) (*ReloadResponse, error)
- func (c *GRPCClient) Retract(ctx context.Context, req *RetractRequest) (*RetractResponse, error)
- func (c *GRPCClient) SubscribeChanges(ctx context.Context, sessionID string, fn func(FactChangeEvent) error) error
- type GRPCOption
- func WithDialOptions(opts ...grpc.DialOption) GRPCOption
- func WithGRPCBearerToken(tok string) GRPCOption
- func WithGRPCInsecure() GRPCOption
- type QueryRequest
- type QueryResponse
- type ReloadRequest
- type ReloadResponse
- type RetractRequest
- type RetractResponse
Variables¶
ErrRulesetReloaded is returned by the SubscribeChanges stream when the server aborts it because the engine's ruleset was hot-reloaded (ADR-0002, option a — cancel on swap). It is errors.Is-able: callers should treat it as a normal lifecycle event, re-subscribe to bind to the new ruleset, then re-Query to re-synchronize.
var ErrRulesetReloaded = errors.New("fathom: ruleset reloaded; re-subscribe to bind to the new ruleset")
type AssertFactRequest¶
AssertFactRequest is the payload for POST /v1/facts.
type AssertFactRequest struct {
SessionID string `json:"session_id"`
Template string `json:"template"`
Data map[string]any `json:"data"`
}
type AssertFactResponse¶
AssertFactResponse is the response from POST /v1/facts.
type ChangeType¶
ChangeType mirrors the proto's fact-change kinds.
type Client¶
Client communicates with the Fathom REST API.
func NewClient¶
NewClient creates a new Fathom client pointing at the given base URL. Example:
func (*Client) AssertFact¶
func (c *Client) AssertFact(ctx context.Context, req *AssertFactRequest) (*AssertFactResponse, error)
AssertFact asserts a single fact into the session's working memory.
func (*Client) Evaluate¶
Evaluate sends facts to the engine and returns the policy decision.
func (*Client) Query¶
Query retrieves facts from the session's working memory.
func (*Client) Retract¶
Retract removes facts matching the request's template + optional filter from the session's working memory and returns the number of retractions.
type ClientOption¶
ClientOption mutates a Client during construction.
func WithBearerToken¶
WithBearerToken configures the client to send "Authorization: Bearer \<tok>" on every request.
func WithHTTPClient¶
WithHTTPClient overrides the underlying *http.Client (useful for tests or custom transports).
type EvaluateRequest¶
EvaluateRequest is the payload for POST /v1/evaluate.
type EvaluateRequest struct {
Facts []FactInput `json:"facts"`
Ruleset string `json:"ruleset"`
SessionID string `json:"session_id,omitempty"`
}
type EvaluateResponse¶
EvaluateResponse is the response from POST /v1/evaluate.
type EvaluateResponse struct {
Decision string `json:"decision"`
Reason string `json:"reason"`
RuleTrace []string `json:"rule_trace"`
ModuleTrace []string `json:"module_trace"`
DurationUS int64 `json:"duration_us"`
AttestationToken string `json:"attestation_token,omitempty"`
}
type FactChangeEvent¶
FactChangeEvent is a single working-memory change yielded by SubscribeChanges. DataJSON's slot data is decoded into Data for convenience.
type FactInput¶
FactInput is a single fact assertion used inside EvaluateRequest.
type GRPCClient¶
GRPCClient is an idiomatic wrapper around the generated FathomService gRPC stub. It mirrors the REST Client's request/response shapes (map[string]any fact data) while transparently handling the proto's JSON-encoded string fields, bearer-token metadata, and the SubscribeChanges reload contract.
func NewGRPCClient¶
NewGRPCClient dials target and returns a ready-to-use GRPCClient. The caller owns the connection and must Close it when done.
Example:
c, err := NewGRPCClient("localhost:50051",
WithGRPCBearerToken("secret"), WithGRPCInsecure())
if err != nil { ... }
defer c.Close()
func (*GRPCClient) AssertFact¶
func (c *GRPCClient) AssertFact(ctx context.Context, req *AssertFactRequest) (*AssertFactResponse, error)
AssertFact asserts a single fact into the session's working memory.
func (*GRPCClient) Close¶
Close releases the underlying gRPC connection.
func (*GRPCClient) Evaluate¶
Evaluate sends facts to the engine and returns the policy decision. The EvaluateRequest/EvaluateResponse types are the REST client's shapes; fact Data maps are JSON-encoded into the proto's data_json fields internally.
Note: unlike the REST EvaluateResponse, the gRPC EvaluateResponse carries no attestation_token (the proto omits it), so that field is always empty here.
func (*GRPCClient) Query¶
Query retrieves facts from the session's working memory.
func (*GRPCClient) Reload¶
Reload hot-reloads the engine's ruleset from an inline YAML body or a server-side path. A successful reload aborts every in-flight SubscribeChanges stream with ErrRulesetReloaded (ADR-0002).
func (*GRPCClient) Retract¶
Retract removes facts matching the request's template + optional filter and returns the number of retractions.
func (*GRPCClient) SubscribeChanges¶
func (c *GRPCClient) SubscribeChanges(ctx context.Context, sessionID string, fn func(FactChangeEvent) error) error
SubscribeChanges opens a server stream of working-memory changes for the given session and invokes fn for each event. It blocks until one of:
- fn returns a non-nil error (returned as-is),
- the server aborts the stream because the ruleset was reloaded (returns ErrRulesetReloaded; re-subscribe + re-Query),
- the stream ends cleanly (server EOF or ctx cancellation; returns nil),
- any other gRPC error (returned wrapped).
Plain client-side cancellation (ctx cancel / deadline) and a clean server close both return nil — they are not surfaced as ErrRulesetReloaded.
type GRPCOption¶
GRPCOption configures a GRPCClient during construction.
func WithDialOptions¶
WithDialOptions appends raw grpc.DialOption values, an escape hatch for transport credentials, interceptors, keepalive, etc. These are applied after the wrapper's own defaults, so they win on conflict.
func WithGRPCBearerToken¶
WithGRPCBearerToken attaches "authorization: Bearer \<tok>" metadata to every RPC via per-RPC credentials (mirroring the server's bearer-auth contract).
gRPC refuses to send per-RPC credentials over an insecure transport unless the caller has explicitly opted in via WithGRPCInsecure (mirroring the server's FATHOM_GRPC_ALLOW_INSECURE posture). With a secure transport this restriction does not apply.
func WithGRPCInsecure¶
WithGRPCInsecure permits an insecure (plaintext) transport and allows bearer credentials to be sent over it. This mirrors the server's FATHOM_GRPC_ALLOW_INSECURE=1 escape hatch and should only be used for local development or trusted networks.
When not set, NewGRPCClient defaults to TLS transport credentials.
type QueryRequest¶
QueryRequest is the payload for POST /v1/query.
type QueryRequest struct {
SessionID string `json:"session_id"`
Template string `json:"template"`
Filter map[string]any `json:"filter,omitempty"`
}
type QueryResponse¶
QueryResponse is the response from POST /v1/query.
type ReloadRequest¶
ReloadRequest is the payload for the Reload RPC. Exactly one of RulesetPath or RulesetYAML should be set (mirroring the proto's oneof source). Signature is the optional detached signature bytes for the ruleset.
type ReloadResponse¶
ReloadResponse is the response from the Reload RPC.
type ReloadResponse struct {
RulesetHashBefore string
RulesetHashAfter string
AttestationToken string
}
type RetractRequest¶
RetractRequest is the payload for DELETE /v1/facts.
type RetractRequest struct {
SessionID string `json:"session_id"`
Template string `json:"template"`
Filter map[string]any `json:"filter,omitempty"`
}
type RetractResponse¶
RetractResponse is the response from DELETE /v1/facts.
fathomv1¶
Index¶
- Constants
- Variables
- func RegisterFathomServiceServer(s grpc.ServiceRegistrar, srv FathomServiceServer)
- type AssertFactRequest
- func (*AssertFactRequest) Descriptor() ([]byte, []int)
- func (x *AssertFactRequest) GetDataJson() string
- func (x *AssertFactRequest) GetSessionId() string
- func (x *AssertFactRequest) GetTemplate() string
- func (*AssertFactRequest) ProtoMessage()
- func (x *AssertFactRequest) ProtoReflect() protoreflect.Message
- func (x *AssertFactRequest) Reset()
- func (x *AssertFactRequest) String() string
- type AssertFactResponse
- func (*AssertFactResponse) Descriptor() ([]byte, []int)
- func (x *AssertFactResponse) GetSuccess() bool
- func (*AssertFactResponse) ProtoMessage()
- func (x *AssertFactResponse) ProtoReflect() protoreflect.Message
- func (x *AssertFactResponse) Reset()
- func (x *AssertFactResponse) String() string
- type ChangeType
- func (ChangeType) Descriptor() protoreflect.EnumDescriptor
- func (x ChangeType) Enum() *ChangeType
- func (ChangeType) EnumDescriptor() ([]byte, []int)
- func (x ChangeType) Number() protoreflect.EnumNumber
- func (x ChangeType) String() string
- func (ChangeType) Type() protoreflect.EnumType
- type EvaluateRequest
- func (*EvaluateRequest) Descriptor() ([]byte, []int)
- func (x *EvaluateRequest) GetFacts() []*FactInput
- func (x *EvaluateRequest) GetRuleset() string
- func (x *EvaluateRequest) GetSessionId() string
- func (*EvaluateRequest) ProtoMessage()
- func (x *EvaluateRequest) ProtoReflect() protoreflect.Message
- func (x *EvaluateRequest) Reset()
- func (x *EvaluateRequest) String() string
- type EvaluateResponse
- func (*EvaluateResponse) Descriptor() ([]byte, []int)
- func (x *EvaluateResponse) GetDecision() string
- func (x *EvaluateResponse) GetDurationUs() int64
- func (x *EvaluateResponse) GetModuleTrace() []string
- func (x *EvaluateResponse) GetReason() string
- func (x *EvaluateResponse) GetRuleTrace() []string
- func (*EvaluateResponse) ProtoMessage()
- func (x *EvaluateResponse) ProtoReflect() protoreflect.Message
- func (x *EvaluateResponse) Reset()
- func (x *EvaluateResponse) String() string
- type FactChange
- func (*FactChange) Descriptor() ([]byte, []int)
- func (x *FactChange) GetChangeType() ChangeType
- func (x *FactChange) GetDataJson() string
- func (x *FactChange) GetTemplate() string
- func (*FactChange) ProtoMessage()
- func (x *FactChange) ProtoReflect() protoreflect.Message
- func (x *FactChange) Reset()
- func (x *FactChange) String() string
- type FactInput
- func (*FactInput) Descriptor() ([]byte, []int)
- func (x *FactInput) GetDataJson() string
- func (x *FactInput) GetTemplate() string
- func (*FactInput) ProtoMessage()
- func (x *FactInput) ProtoReflect() protoreflect.Message
- func (x *FactInput) Reset()
- func (x *FactInput) String() string
- type FathomServiceClient
- func NewFathomServiceClient(cc grpc.ClientConnInterface) FathomServiceClient
- type FathomServiceServer
- type FathomService_SubscribeChangesClient
- type FathomService_SubscribeChangesServer
- type QueryRequest
- func (*QueryRequest) Descriptor() ([]byte, []int)
- func (x *QueryRequest) GetFilterJson() string
- func (x *QueryRequest) GetSessionId() string
- func (x *QueryRequest) GetTemplate() string
- func (*QueryRequest) ProtoMessage()
- func (x *QueryRequest) ProtoReflect() protoreflect.Message
- func (x *QueryRequest) Reset()
- func (x *QueryRequest) String() string
- type QueryResponse
- func (*QueryResponse) Descriptor() ([]byte, []int)
- func (x *QueryResponse) GetFactsJson() []string
- func (*QueryResponse) ProtoMessage()
- func (x *QueryResponse) ProtoReflect() protoreflect.Message
- func (x *QueryResponse) Reset()
- func (x *QueryResponse) String() string
- type ReloadRequest
- func (*ReloadRequest) Descriptor() ([]byte, []int)
- func (x *ReloadRequest) GetRulesetPath() string
- func (x *ReloadRequest) GetRulesetYaml() string
- func (x *ReloadRequest) GetSignature() []byte
- func (x *ReloadRequest) GetSource() isReloadRequest_Source
- func (*ReloadRequest) ProtoMessage()
- func (x *ReloadRequest) ProtoReflect() protoreflect.Message
- func (x *ReloadRequest) Reset()
- func (x *ReloadRequest) String() string
- type ReloadRequest_RulesetPath
- type ReloadRequest_RulesetYaml
- type ReloadResponse
- func (*ReloadResponse) Descriptor() ([]byte, []int)
- func (x *ReloadResponse) GetAttestationToken() string
- func (x *ReloadResponse) GetRulesetHashAfter() string
- func (x *ReloadResponse) GetRulesetHashBefore() string
- func (*ReloadResponse) ProtoMessage()
- func (x *ReloadResponse) ProtoReflect() protoreflect.Message
- func (x *ReloadResponse) Reset()
- func (x *ReloadResponse) String() string
- type RetractRequest
- func (*RetractRequest) Descriptor() ([]byte, []int)
- func (x *RetractRequest) GetFilterJson() string
- func (x *RetractRequest) GetSessionId() string
- func (x *RetractRequest) GetTemplate() string
- func (*RetractRequest) ProtoMessage()
- func (x *RetractRequest) ProtoReflect() protoreflect.Message
- func (x *RetractRequest) Reset()
- func (x *RetractRequest) String() string
- type RetractResponse
- func (*RetractResponse) Descriptor() ([]byte, []int)
- func (x *RetractResponse) GetRetractedCount() int32
- func (*RetractResponse) ProtoMessage()
- func (x *RetractResponse) ProtoReflect() protoreflect.Message
- func (x *RetractResponse) Reset()
- func (x *RetractResponse) String() string
- type SubscribeRequest
- func (*SubscribeRequest) Descriptor() ([]byte, []int)
- func (x *SubscribeRequest) GetSessionId() string
- func (*SubscribeRequest) ProtoMessage()
- func (x *SubscribeRequest) ProtoReflect() protoreflect.Message
- func (x *SubscribeRequest) Reset()
- func (x *SubscribeRequest) String() string
- type UnimplementedFathomServiceServer
- func (UnimplementedFathomServiceServer) AssertFact(context.Context, *AssertFactRequest) (*AssertFactResponse, error)
- func (UnimplementedFathomServiceServer) Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error)
- func (UnimplementedFathomServiceServer) Query(context.Context, *QueryRequest) (*QueryResponse, error)
- func (UnimplementedFathomServiceServer) Reload(context.Context, *ReloadRequest) (*ReloadResponse, error)
- func (UnimplementedFathomServiceServer) Retract(context.Context, *RetractRequest) (*RetractResponse, error)
- func (UnimplementedFathomServiceServer) SubscribeChanges(*SubscribeRequest, grpc.ServerStreamingServer[FactChange]) error
- type UnsafeFathomServiceServer
Constants¶
const (
FathomService_Evaluate_FullMethodName = "/fathom.v1.FathomService/Evaluate"
FathomService_AssertFact_FullMethodName = "/fathom.v1.FathomService/AssertFact"
FathomService_Query_FullMethodName = "/fathom.v1.FathomService/Query"
FathomService_Retract_FullMethodName = "/fathom.v1.FathomService/Retract"
FathomService_SubscribeChanges_FullMethodName = "/fathom.v1.FathomService/SubscribeChanges"
FathomService_Reload_FullMethodName = "/fathom.v1.FathomService/Reload"
)
Variables¶
Enum value maps for ChangeType.
var (
ChangeType_name = map[int32]string{
0: "CHANGE_TYPE_UNSPECIFIED",
1: "ASSERT",
2: "RETRACT",
}
ChangeType_value = map[string]int32{
"CHANGE_TYPE_UNSPECIFIED": 0,
"ASSERT": 1,
"RETRACT": 2,
}
)
FathomService_ServiceDesc is the grpc.ServiceDesc for FathomService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var FathomService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "fathom.v1.FathomService",
HandlerType: (*FathomServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Evaluate",
Handler: _FathomService_Evaluate_Handler,
},
{
MethodName: "AssertFact",
Handler: _FathomService_AssertFact_Handler,
},
{
MethodName: "Query",
Handler: _FathomService_Query_Handler,
},
{
MethodName: "Retract",
Handler: _FathomService_Retract_Handler,
},
{
MethodName: "Reload",
Handler: _FathomService_Reload_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "SubscribeChanges",
Handler: _FathomService_SubscribeChanges_Handler,
ServerStreams: true,
},
},
Metadata: "fathom.proto",
}
func RegisterFathomServiceServer¶
type AssertFactRequest¶
type AssertFactRequest struct {
SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
Template string `protobuf:"bytes,2,opt,name=template,proto3" json:"template,omitempty"`
// JSON-encoded slot data.
DataJson string `protobuf:"bytes,3,opt,name=data_json,json=dataJson,proto3" json:"data_json,omitempty"`
// contains filtered or unexported fields
}
func (*AssertFactRequest) Descriptor¶
Deprecated: Use AssertFactRequest.ProtoReflect.Descriptor instead.
func (*AssertFactRequest) GetDataJson¶
func (*AssertFactRequest) GetSessionId¶
func (*AssertFactRequest) GetTemplate¶
func (*AssertFactRequest) ProtoMessage¶
func (*AssertFactRequest) ProtoReflect¶
func (*AssertFactRequest) Reset¶
func (*AssertFactRequest) String¶
type AssertFactResponse¶
type AssertFactResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
// contains filtered or unexported fields
}
func (*AssertFactResponse) Descriptor¶
Deprecated: Use AssertFactResponse.ProtoReflect.Descriptor instead.
func (*AssertFactResponse) GetSuccess¶
func (*AssertFactResponse) ProtoMessage¶
func (*AssertFactResponse) ProtoReflect¶
func (*AssertFactResponse) Reset¶
func (*AssertFactResponse) String¶
type ChangeType¶
const (
ChangeType_CHANGE_TYPE_UNSPECIFIED ChangeType = 0
ChangeType_ASSERT ChangeType = 1
ChangeType_RETRACT ChangeType = 2
)
func (ChangeType) Descriptor¶
func (ChangeType) Enum¶
func (ChangeType) EnumDescriptor¶
Deprecated: Use ChangeType.Descriptor instead.
func (ChangeType) Number¶
func (ChangeType) String¶
func (ChangeType) Type¶
type EvaluateRequest¶
type EvaluateRequest struct {
SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
Ruleset string `protobuf:"bytes,2,opt,name=ruleset,proto3" json:"ruleset,omitempty"`
Facts []*FactInput `protobuf:"bytes,3,rep,name=facts,proto3" json:"facts,omitempty"`
// contains filtered or unexported fields
}
func (*EvaluateRequest) Descriptor¶
Deprecated: Use EvaluateRequest.ProtoReflect.Descriptor instead.
func (*EvaluateRequest) GetFacts¶
func (*EvaluateRequest) GetRuleset¶
func (*EvaluateRequest) GetSessionId¶
func (*EvaluateRequest) ProtoMessage¶
func (*EvaluateRequest) ProtoReflect¶
func (*EvaluateRequest) Reset¶
func (*EvaluateRequest) String¶
type EvaluateResponse¶
type EvaluateResponse struct {
Decision string `protobuf:"bytes,1,opt,name=decision,proto3" json:"decision,omitempty"`
Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
RuleTrace []string `protobuf:"bytes,3,rep,name=rule_trace,json=ruleTrace,proto3" json:"rule_trace,omitempty"`
ModuleTrace []string `protobuf:"bytes,4,rep,name=module_trace,json=moduleTrace,proto3" json:"module_trace,omitempty"`
DurationUs int64 `protobuf:"varint,5,opt,name=duration_us,json=durationUs,proto3" json:"duration_us,omitempty"`
// contains filtered or unexported fields
}
func (*EvaluateResponse) Descriptor¶
Deprecated: Use EvaluateResponse.ProtoReflect.Descriptor instead.
func (*EvaluateResponse) GetDecision¶
func (*EvaluateResponse) GetDurationUs¶
func (*EvaluateResponse) GetModuleTrace¶
func (*EvaluateResponse) GetReason¶
func (*EvaluateResponse) GetRuleTrace¶
func (*EvaluateResponse) ProtoMessage¶
func (*EvaluateResponse) ProtoReflect¶
func (*EvaluateResponse) Reset¶
func (*EvaluateResponse) String¶
type FactChange¶
type FactChange struct {
ChangeType ChangeType `protobuf:"varint,1,opt,name=change_type,json=changeType,proto3,enum=fathom.v1.ChangeType" json:"change_type,omitempty"`
Template string `protobuf:"bytes,2,opt,name=template,proto3" json:"template,omitempty"`
// JSON-encoded slot data of the changed fact.
DataJson string `protobuf:"bytes,3,opt,name=data_json,json=dataJson,proto3" json:"data_json,omitempty"`
// contains filtered or unexported fields
}
func (*FactChange) Descriptor¶
Deprecated: Use FactChange.ProtoReflect.Descriptor instead.
func (*FactChange) GetChangeType¶
func (*FactChange) GetDataJson¶
func (*FactChange) GetTemplate¶
func (*FactChange) ProtoMessage¶
func (*FactChange) ProtoReflect¶
func (*FactChange) Reset¶
func (*FactChange) String¶
type FactInput¶
type FactInput struct {
Template string `protobuf:"bytes,1,opt,name=template,proto3" json:"template,omitempty"`
// JSON-encoded slot data (e.g. {"tool_name": "bash", "agent_id": "a1"}).
DataJson string `protobuf:"bytes,2,opt,name=data_json,json=dataJson,proto3" json:"data_json,omitempty"`
// contains filtered or unexported fields
}
func (*FactInput) Descriptor¶
Deprecated: Use FactInput.ProtoReflect.Descriptor instead.
func (*FactInput) GetDataJson¶
func (*FactInput) GetTemplate¶
func (*FactInput) ProtoMessage¶
func (*FactInput) ProtoReflect¶
func (*FactInput) Reset¶
func (*FactInput) String¶
type FathomServiceClient¶
FathomServiceClient is the client API for FathomService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type FathomServiceClient interface {
// Evaluate asserted facts against loaded rules and return a decision.
Evaluate(ctx context.Context, in *EvaluateRequest, opts ...grpc.CallOption) (*EvaluateResponse, error)
// Assert one or more facts into working memory.
AssertFact(ctx context.Context, in *AssertFactRequest, opts ...grpc.CallOption) (*AssertFactResponse, error)
// Query working memory for facts matching a template and optional filter.
Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
// Retract facts matching a template and optional filter.
Retract(ctx context.Context, in *RetractRequest, opts ...grpc.CallOption) (*RetractResponse, error)
// Stream working-memory changes as they occur during evaluation.
SubscribeChanges(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FactChange], error)
// Hot-reload the ruleset from a path or inline YAML.
Reload(ctx context.Context, in *ReloadRequest, opts ...grpc.CallOption) (*ReloadResponse, error)
}
func NewFathomServiceClient¶
type FathomServiceServer¶
FathomServiceServer is the server API for FathomService service. All implementations must embed UnimplementedFathomServiceServer for forward compatibility.
type FathomServiceServer interface {
// Evaluate asserted facts against loaded rules and return a decision.
Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error)
// Assert one or more facts into working memory.
AssertFact(context.Context, *AssertFactRequest) (*AssertFactResponse, error)
// Query working memory for facts matching a template and optional filter.
Query(context.Context, *QueryRequest) (*QueryResponse, error)
// Retract facts matching a template and optional filter.
Retract(context.Context, *RetractRequest) (*RetractResponse, error)
// Stream working-memory changes as they occur during evaluation.
SubscribeChanges(*SubscribeRequest, grpc.ServerStreamingServer[FactChange]) error
// Hot-reload the ruleset from a path or inline YAML.
Reload(context.Context, *ReloadRequest) (*ReloadResponse, error)
// contains filtered or unexported methods
}
type FathomService\_SubscribeChangesClient¶
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type FathomService\_SubscribeChangesServer¶
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type QueryRequest¶
type QueryRequest struct {
SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
Template string `protobuf:"bytes,2,opt,name=template,proto3" json:"template,omitempty"`
// Optional JSON-encoded filter (e.g. {"agent_id": "a1"}).
FilterJson string `protobuf:"bytes,3,opt,name=filter_json,json=filterJson,proto3" json:"filter_json,omitempty"`
// contains filtered or unexported fields
}
func (*QueryRequest) Descriptor¶
Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.
func (*QueryRequest) GetFilterJson¶
func (*QueryRequest) GetSessionId¶
func (*QueryRequest) GetTemplate¶
func (*QueryRequest) ProtoMessage¶
func (*QueryRequest) ProtoReflect¶
func (*QueryRequest) Reset¶
func (*QueryRequest) String¶
type QueryResponse¶
type QueryResponse struct {
// Each entry is a JSON-encoded dict representing one fact.
FactsJson []string `protobuf:"bytes,1,rep,name=facts_json,json=factsJson,proto3" json:"facts_json,omitempty"`
// contains filtered or unexported fields
}
func (*QueryResponse) Descriptor¶
Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead.
func (*QueryResponse) GetFactsJson¶
func (*QueryResponse) ProtoMessage¶
func (*QueryResponse) ProtoReflect¶
func (*QueryResponse) Reset¶
func (*QueryResponse) String¶
type ReloadRequest¶
type ReloadRequest struct {
// Types that are valid to be assigned to Source:
//
// *ReloadRequest_RulesetPath
// *ReloadRequest_RulesetYaml
Source isReloadRequest_Source `protobuf_oneof:"source"`
Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
// contains filtered or unexported fields
}
func (*ReloadRequest) Descriptor¶
Deprecated: Use ReloadRequest.ProtoReflect.Descriptor instead.
func (*ReloadRequest) GetRulesetPath¶
func (*ReloadRequest) GetRulesetYaml¶
func (*ReloadRequest) GetSignature¶
func (*ReloadRequest) GetSource¶
func (*ReloadRequest) ProtoMessage¶
func (*ReloadRequest) ProtoReflect¶
func (*ReloadRequest) Reset¶
func (*ReloadRequest) String¶
type ReloadRequest\_RulesetPath¶
type ReloadRequest_RulesetPath struct {
RulesetPath string `protobuf:"bytes,1,opt,name=ruleset_path,json=rulesetPath,proto3,oneof"`
}
type ReloadRequest\_RulesetYaml¶
type ReloadRequest_RulesetYaml struct {
RulesetYaml string `protobuf:"bytes,2,opt,name=ruleset_yaml,json=rulesetYaml,proto3,oneof"`
}
type ReloadResponse¶
type ReloadResponse struct {
RulesetHashBefore string `protobuf:"bytes,1,opt,name=ruleset_hash_before,json=rulesetHashBefore,proto3" json:"ruleset_hash_before,omitempty"`
RulesetHashAfter string `protobuf:"bytes,2,opt,name=ruleset_hash_after,json=rulesetHashAfter,proto3" json:"ruleset_hash_after,omitempty"`
AttestationToken string `protobuf:"bytes,3,opt,name=attestation_token,json=attestationToken,proto3" json:"attestation_token,omitempty"`
// contains filtered or unexported fields
}
func (*ReloadResponse) Descriptor¶
Deprecated: Use ReloadResponse.ProtoReflect.Descriptor instead.
func (*ReloadResponse) GetAttestationToken¶
func (*ReloadResponse) GetRulesetHashAfter¶
func (*ReloadResponse) GetRulesetHashBefore¶
func (*ReloadResponse) ProtoMessage¶
func (*ReloadResponse) ProtoReflect¶
func (*ReloadResponse) Reset¶
func (*ReloadResponse) String¶
type RetractRequest¶
type RetractRequest struct {
SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
Template string `protobuf:"bytes,2,opt,name=template,proto3" json:"template,omitempty"`
// Optional JSON-encoded filter.
FilterJson string `protobuf:"bytes,3,opt,name=filter_json,json=filterJson,proto3" json:"filter_json,omitempty"`
// contains filtered or unexported fields
}
func (*RetractRequest) Descriptor¶
Deprecated: Use RetractRequest.ProtoReflect.Descriptor instead.
func (*RetractRequest) GetFilterJson¶
func (*RetractRequest) GetSessionId¶
func (*RetractRequest) GetTemplate¶
func (*RetractRequest) ProtoMessage¶
func (*RetractRequest) ProtoReflect¶
func (*RetractRequest) Reset¶
func (*RetractRequest) String¶
type RetractResponse¶
type RetractResponse struct {
RetractedCount int32 `protobuf:"varint,1,opt,name=retracted_count,json=retractedCount,proto3" json:"retracted_count,omitempty"`
// contains filtered or unexported fields
}
func (*RetractResponse) Descriptor¶
Deprecated: Use RetractResponse.ProtoReflect.Descriptor instead.
func (*RetractResponse) GetRetractedCount¶
func (*RetractResponse) ProtoMessage¶
func (*RetractResponse) ProtoReflect¶
func (*RetractResponse) Reset¶
func (*RetractResponse) String¶
type SubscribeRequest¶
type SubscribeRequest struct {
SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
// contains filtered or unexported fields
}
func (*SubscribeRequest) Descriptor¶
Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead.
func (*SubscribeRequest) GetSessionId¶
func (*SubscribeRequest) ProtoMessage¶
func (*SubscribeRequest) ProtoReflect¶
func (*SubscribeRequest) Reset¶
func (*SubscribeRequest) String¶
type UnimplementedFathomServiceServer¶
UnimplementedFathomServiceServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedFathomServiceServer) AssertFact¶
func (UnimplementedFathomServiceServer) AssertFact(context.Context, *AssertFactRequest) (*AssertFactResponse, error)
func (UnimplementedFathomServiceServer) Evaluate¶
func (UnimplementedFathomServiceServer) Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error)
func (UnimplementedFathomServiceServer) Query¶
func (UnimplementedFathomServiceServer) Query(context.Context, *QueryRequest) (*QueryResponse, error)
func (UnimplementedFathomServiceServer) Reload¶
func (UnimplementedFathomServiceServer) Reload(context.Context, *ReloadRequest) (*ReloadResponse, error)
func (UnimplementedFathomServiceServer) Retract¶
func (UnimplementedFathomServiceServer) Retract(context.Context, *RetractRequest) (*RetractResponse, error)
func (UnimplementedFathomServiceServer) SubscribeChanges¶
func (UnimplementedFathomServiceServer) SubscribeChanges(*SubscribeRequest, grpc.ServerStreamingServer[FactChange]) error
type UnsafeFathomServiceServer¶
UnsafeFathomServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to FathomServiceServer will result in compilation errors.
Generated by gomarkdoc