Documentation
¶
Overview ¶
Package detective adapts Core's shared Checks and Cases to local storage.
Index ¶
- Variables
- func AdmittedQueryRevision(ctx context.Context, queryID string) (string, bool)
- type AIPage
- type ActionRequest
- type ActionResponse
- type AuditEvent
- type AuditStore
- type Binding
- type Capabilities
- type Case
- type CaseEvent
- type CaseEventsPage
- type Check
- type CheckRun
- type EvidenceRef
- type ExecutionMetadata
- type Finding
- type IncidentOperation
- type Input
- type InputValue
- type LocalAIStore
- func (s LocalAIStore) AIReceipt(ctx context.Context, id string) (ai.Receipt, bool, error)
- func (s LocalAIStore) AuthorizeSources(ctx context.Context, scope ai.Scope, sources []ai.SourceEvidence) error
- func (s LocalAIStore) BeginAIGeneration(ctx context.Context, id string, binding core.OperationBinding) (ai.Response, bool, error)
- func (s LocalAIStore) CompleteAIGeneration(ctx context.Context, id string, binding core.OperationBinding, ...) error
- func (s LocalAIStore) ConfirmCase(ctx context.Context, command ai.Command) (ai.Receipt, error)
- func (s LocalAIStore) ConfirmCatalog(ctx context.Context, command ai.Command) (ai.Receipt, error)
- func (s LocalAIStore) ConfirmQuery(ctx context.Context, command ai.Command) (ai.Receipt, error)
- func (s LocalAIStore) ConfirmRun(ctx context.Context, command ai.Command, runner QueryRunner, ...) (ai.Receipt, error)
- func (s LocalAIStore) Get(ctx context.Context, id string) (ai.Proposal, error)
- func (s LocalAIStore) Page(ctx context.Context, after string) (AIPage, error)
- func (s LocalAIStore) Save(ctx context.Context, proposal ai.Proposal) error
- func (s LocalAIStore) SavePaste(ctx context.Context, text string) (ai.Source, error)
- type LocalStore
- func (s *LocalStore) ActionBinding(req ActionRequest, actor string) (core.OperationBinding, error)
- func (s *LocalStore) ActionLinkStatus(ctx context.Context, id, actor string, req ActionRequest) (string, error)
- func (s *LocalStore) Append(ctx context.Context, event AuditEvent) error
- func (s *LocalStore) AppendCaseEvent(ctx context.Context, id string, event CaseEvent, actor string) (Case, error)
- func (s *LocalStore) ApplyScenario(ctx context.Context, caseID, scenarioID, actor string) (Case, error)
- func (s *LocalStore) BeginIncidentOperation(ctx context.Context, id string, binding core.OperationBinding, caseID string, ...) (IncidentOperation, bool, error)
- func (s *LocalStore) CaseEventsPage(ctx context.Context, id string, before int) (CaseEventsPage, error)
- func (s *LocalStore) CompleteIncidentOperation(ctx context.Context, id string, binding core.OperationBinding, ...) (Case, error)
- func (s *LocalStore) ExecuteAction(ctx context.Context, operationID, actor string, req ActionRequest, ...) (ActionResponse, error)
- func (s *LocalStore) GetCase(ctx context.Context, id string) (Case, error)
- func (s *LocalStore) GetCheck(ctx context.Context, id string) (Check, error)
- func (s *LocalStore) GetPublishedValidator(_ context.Context, id string) (PublishedValidator, error)
- func (s *LocalStore) GetQueryValidators(_ context.Context, id string) (QueryValidators, bool, error)
- func (s *LocalStore) KnowledgeAction(ctx context.Context, request knowledge.Action, actor string) (knowledge.Response, error)
- func (s *LocalStore) KnowledgePage(ctx context.Context, after string) (knowledge.Page, error)
- func (s *LocalStore) QueryExists(_ context.Context, id string) (bool, error)
- func (s *LocalStore) RecordIncidentCreated(ctx context.Context, id string, binding core.OperationBinding, ref string) error
- func (s *LocalStore) RecordScenarioQueryStep(ctx context.Context, caseID, applicationID, stepID string, ...) (Case, error)
- func (s *LocalStore) RecordScenarioStep(ctx context.Context, ...) (Case, error)
- func (s *LocalStore) Run(ctx context.Context, checkID, environment, caseID, actor string, ...) (CheckRun, error)
- func (s *LocalStore) RunQueryValidators(ctx context.Context, queryID, environment, caseID, actor string, ...) (CheckRun, error)
- func (s *LocalStore) RunQueryValidatorsForResult(ctx context.Context, queryID, environment, caseID, actor string, ...) (CheckRun, error)
- func (s *LocalStore) SaveCase(ctx context.Context, item Case, actor, action string) (Case, error)
- func (s *LocalStore) SaveCheck(ctx context.Context, check Check, actor string) (Check, error)
- func (s *LocalStore) SaveQueryValidators(ctx context.Context, item QueryValidators, actor string) (QueryValidators, error)
- func (s *LocalStore) SaveRun(ctx context.Context, run CheckRun) error
- func (s *LocalStore) SaveScenario(ctx context.Context, scenario Scenario, actor string) (Scenario, error)
- func (s *LocalStore) SaveValidator(ctx context.Context, item PublishedValidator, actor string) (PublishedValidator, error)
- func (s *LocalStore) State(ctx context.Context) (State, error)
- func (s *LocalStore) StatePage(ctx context.Context, cursor string) (State, error)
- type PublishedValidator
- type QueryFailure
- type QueryRevisionLookup
- type QueryRunner
- type QueryValidators
- type Scenario
- type ScenarioApplication
- type ScenarioQueryProof
- type ScenarioStep
- type ScenarioStepReceipt
- type State
- type Step
- type StepResult
- type ValidationResult
- type Validator
- type Value
- type ValueRange
Constants ¶
This section is empty.
Variables ¶
var ErrCapacity = core.ErrCapacity
var ErrConflict = core.ErrConflict
var ErrInvalid = core.ErrInvalid
var ErrNotFound = core.ErrNotFound
var ErrOutcomeUncertain = core.ErrOutcomeUncertain
Functions ¶
Types ¶
type ActionRequest ¶
type ActionRequest = core.ActionRequest
type ActionResponse ¶
type ActionResponse = core.ActionResponse
type AuditEvent ¶
type AuditEvent = core.AuditEvent
type AuditStore ¶
type AuditStore interface {
Append(context.Context, AuditEvent) error
}
type Capabilities ¶
type Capabilities = core.Capabilities
type CaseEventsPage ¶
type CaseEventsPage = core.CaseEventsPage
type EvidenceRef ¶
type EvidenceRef = core.EvidenceRef
type ExecutionMetadata ¶
type ExecutionMetadata = core.ExecutionMetadata
type IncidentOperation ¶
type IncidentOperation struct {
Receipt core.OperationReceipt `json:"receipt"`
// CreatedRef records the external create before attempting the Case CAS. A
// stale Case version can then be recovered with a separate authorized link.
CreatedRef string `json:"createdRef,omitempty"`
Done bool `json:"done"`
Case *Case `json:"case,omitempty"`
Context map[string]InputValue `json:"context,omitempty"`
Audit *AuditEvent `json:"audit,omitempty"`
Before int64 `json:"before"`
}
IncidentOperation is a private, payload-bound local admission record. It is written before touching Incidentius so an interrupted cross-store create can resume with the same mutation ID and cannot be replayed with new content.
type InputValue ¶
type InputValue = core.InputValue
type LocalAIStore ¶
type LocalAIStore struct {
Store *LocalStore
Scope ai.Scope
// BasisVerifier rebuilds the authorized snapshot from a State captured
// under the local mutation lock, immediately before durable admission.
BasisVerifier func(context.Context, ai.Snapshot, State) error
}
LocalAIStore binds private proposals and paste evidence to the authenticated local actor. The model receives source text, while the shared proposal keeps only verified citation spans and source digests.
func (LocalAIStore) AIReceipt ¶
AIReceipt returns a previously accepted confirmation and finishes an interrupted local Case/audit write before revealing the replay receipt.
func (LocalAIStore) AuthorizeSources ¶
func (s LocalAIStore) AuthorizeSources(ctx context.Context, scope ai.Scope, sources []ai.SourceEvidence) error
func (LocalAIStore) BeginAIGeneration ¶
func (s LocalAIStore) BeginAIGeneration(ctx context.Context, id string, binding core.OperationBinding) (ai.Response, bool, error)
BeginAIGeneration durably accepts an LLM call before network dispatch. An interrupted call is reported as uncertain; it is never silently repeated under the same operation ID.
func (LocalAIStore) CompleteAIGeneration ¶
func (s LocalAIStore) CompleteAIGeneration(ctx context.Context, id string, binding core.OperationBinding, result ai.Response) error
func (LocalAIStore) ConfirmCase ¶
ConfirmCase applies only reviewed editable fields to the current Case. The prepared Core transition, metadata audit and scoped AI receipt are journaled before the Case file is replaced, making exact retries resumable.
func (LocalAIStore) ConfirmCatalog ¶
ConfirmCatalog journals the already-reviewed shared Core draft, the exact previous definition and an audit intent before replacing a project file. A crash between any two writes can be reconciled by the same operation ID.
func (LocalAIStore) ConfirmQuery ¶
func (LocalAIStore) ConfirmRun ¶
func (s LocalAIStore) ConfirmRun(ctx context.Context, command ai.Command, runner QueryRunner, metadata ExecutionMetadata, revisions ...QueryRevisionLookup) (ai.Receipt, error)
ConfirmRun accepts the confirmed intent before any query dispatch. An interrupted network call remains uncertain and is never silently repeated. Once evaluation returns, its exact result is journaled before run/evidence and Case writes, so those writes can be reconciled without re-execution.
type LocalStore ¶
type LocalStore struct {
// contains filtered or unexported fields
}
LocalStore keeps reviewable definitions in the project and sensitive case, run and audit material in a separate server-private directory.
func NewLocalStore ¶
func NewLocalStore(projectID, projectDir, privateBase string) (*LocalStore, error)
func NewLocalStoreWithAudit ¶
func NewLocalStoreWithAudit(projectID, projectDir, privateBase string, audit AuditStore) (*LocalStore, error)
NewLocalStoreWithAudit replaces the JSONL adapter for a trusted server configuration. The same mutation paths use the supplied adapter.
func (*LocalStore) ActionBinding ¶
func (s *LocalStore) ActionBinding(req ActionRequest, actor string) (core.OperationBinding, error)
ActionBinding omits the ephemeral securityContextId; the endpoint verifies the current session and actor before every call, including exact replay.
func (*LocalStore) ActionLinkStatus ¶
func (s *LocalStore) ActionLinkStatus(ctx context.Context, id, actor string, req ActionRequest) (string, error)
ActionLinkStatus reads only the caller's payload-bound completed operation.
func (*LocalStore) Append ¶
func (s *LocalStore) Append(ctx context.Context, event AuditEvent) error
func (*LocalStore) AppendCaseEvent ¶
func (*LocalStore) ApplyScenario ¶
func (*LocalStore) BeginIncidentOperation ¶
func (s *LocalStore) BeginIncidentOperation(ctx context.Context, id string, binding core.OperationBinding, caseID string, ifMatch int64, create bool) (IncidentOperation, bool, error)
func (*LocalStore) CaseEventsPage ¶
func (s *LocalStore) CaseEventsPage(ctx context.Context, id string, before int) (CaseEventsPage, error)
CaseEventsPage returns up to 100 immutable timeline events, newest page first by cursor while preserving chronological order inside the page.
func (*LocalStore) CompleteIncidentOperation ¶
func (s *LocalStore) CompleteIncidentOperation(ctx context.Context, id string, binding core.OperationBinding, caseID, incidentRef, actor string, ifMatch int64, create *Case) (Case, error)
CompleteIncidentOperation applies the Core Case transition under the local private lock, then stores a replayable response. If a prior write succeeded but the final receipt did not, its accepted operation can resume safely.
func (*LocalStore) ExecuteAction ¶
func (s *LocalStore) ExecuteAction(ctx context.Context, operationID, actor string, req ActionRequest, runner QueryRunner, metadata ExecutionMetadata, result *apicontract.Result, proof *ScenarioQueryProof, revisions ...QueryRevisionLookup) (ActionResponse, error)
ExecuteAction owns all ordinary local Detective mutations and manual runs. The caller must authorize the current session, query and execution receipt before entering this method. A missing operation ID is a contract error.
func (*LocalStore) GetPublishedValidator ¶
func (s *LocalStore) GetPublishedValidator(_ context.Context, id string) (PublishedValidator, error)
func (*LocalStore) GetQueryValidators ¶
func (s *LocalStore) GetQueryValidators(_ context.Context, id string) (QueryValidators, bool, error)
func (*LocalStore) KnowledgeAction ¶
func (s *LocalStore) KnowledgeAction(ctx context.Context, request knowledge.Action, actor string) (knowledge.Response, error)
KnowledgeAction uses Core's portable transitions and reference validation. The local lock serializes the proposal, metadata-only audit and replay receipt. The accepted operation ID is bound to project, actor and payload.
func (*LocalStore) KnowledgePage ¶
KnowledgePage reads only this project's private proposals and returns a bounded, stable ID page. No proposal or handoff enters the project Git tree.
func (*LocalStore) QueryExists ¶
func (*LocalStore) RecordIncidentCreated ¶
func (s *LocalStore) RecordIncidentCreated(ctx context.Context, id string, binding core.OperationBinding, ref string) error
func (*LocalStore) RecordScenarioQueryStep ¶
func (s *LocalStore) RecordScenarioQueryStep(ctx context.Context, caseID, applicationID, stepID string, proof core.ScenarioQueryProof, actor string) (Case, error)
RecordScenarioQueryStep attaches an authorized ordinary saved-query receipt to manual guidance without creating a synthetic Check or positive assertion.
func (*LocalStore) RecordScenarioStep ¶
func (*LocalStore) Run ¶
func (s *LocalStore) Run(ctx context.Context, checkID, environment, caseID, actor string, inputs map[string]InputValue, runner QueryRunner, metadata ...ExecutionMetadata) (CheckRun, error)
func (*LocalStore) RunQueryValidators ¶
func (s *LocalStore) RunQueryValidators(ctx context.Context, queryID, environment, caseID, actor string, inputs map[string]InputValue, runner QueryRunner, metadata ...ExecutionMetadata) (CheckRun, error)
func (*LocalStore) RunQueryValidatorsForResult ¶
func (s *LocalStore) RunQueryValidatorsForResult(ctx context.Context, queryID, environment, caseID, actor string, inputs map[string]InputValue, result apicontract.Result, runner QueryRunner, metadata ...ExecutionMetadata) (CheckRun, error)
RunQueryValidatorsForResult evaluates the authorized retained rows of an existing execution. Its caller must verify the receipt and current policy.
func (*LocalStore) SaveCase ¶
These methods own local flock/file/JSONL mechanics. Core owns the Case transition semantics used identically by the hosted repository adapter.
func (*LocalStore) SaveQueryValidators ¶
func (s *LocalStore) SaveQueryValidators(ctx context.Context, item QueryValidators, actor string) (QueryValidators, error)
func (*LocalStore) SaveScenario ¶
func (*LocalStore) SaveValidator ¶
func (s *LocalStore) SaveValidator(ctx context.Context, item PublishedValidator, actor string) (PublishedValidator, error)
type PublishedValidator ¶
type PublishedValidator = core.PublishedValidator
type QueryFailure ¶
type QueryFailure = core.QueryFailure
type QueryRevisionLookup ¶
QueryRevisionLookup resolves the saved-query revision at run admission. The endpoint checks the same revision when it loads the query for execution.
type QueryRunner ¶
type QueryRunner = core.QueryRunner
type QueryValidators ¶
type QueryValidators = core.QueryValidators
type ScenarioApplication ¶
type ScenarioApplication = core.ScenarioApplication
type ScenarioQueryProof ¶
type ScenarioQueryProof = core.ScenarioQueryProof
type ScenarioStep ¶
type ScenarioStep = core.ScenarioStep
type ScenarioStepReceipt ¶
type ScenarioStepReceipt = core.ScenarioStepReceipt
type StepResult ¶
type StepResult = core.StepResult
type ValidationResult ¶
type ValidationResult = core.ValidationResult
type ValueRange ¶
type ValueRange = core.ValueRange