4d97280d74
The correction is the only supervised signal in the box, so the cost of giving one has to be near zero. That means the surface needs the trace id of the turn it is showing, which it had no way to learn: handleText returns one string and the trace was written after the reply left. The id rides back on ChatReply through the same context sink querySource uses, so the mic, telegram and the web keep the one signature they share. CorrectTurn takes a trace id and an optional target, which is deliberately reach-agnostic: nothing about it assumes a browser. store.ErrNoSuchTrace gets a wire twin. A turn past the retention bound is gone, and that is the expected outcome of correcting an old turn, not a broken database.
169 lines
7.2 KiB
Go
169 lines
7.2 KiB
Go
package ipc
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
// ErrNotImplemented is returned by every UnimplementedCoreAPI method. It is
|
|
// deliberately distinct from ErrUnknownMethod (a wire-level "no such
|
|
// method exists" verdict) and from any daemon-level "locked" error: this one
|
|
// means "this method exists on CoreAPI, but the fake/adapter embedding
|
|
// UnimplementedCoreAPI never got a real implementation for it." A test that
|
|
// exercises an undeclared method fails loudly on this text instead of
|
|
// silently nil-panicking or being mistaken for a legitimate failure.
|
|
var ErrNotImplemented = errors.New("ipc: not implemented (unimplemented CoreAPI stub)")
|
|
|
|
// UnimplementedCoreAPI is the gRPC Unimplemented*Server pattern applied to
|
|
// CoreAPI: embed it in a test double or adapter and override only the
|
|
// methods you actually exercise. Every method returns ErrNotImplemented, so
|
|
// a call that reaches an undeclared method fails loudly and specifically,
|
|
// rather than compiling to a silent no-op or nil-pointer panic. This
|
|
// replaces the old pattern of hand-writing all 30 no-op stubs per double —
|
|
// those were compiler-satisfying padding, not tests of anything.
|
|
type UnimplementedCoreAPI struct{}
|
|
|
|
var _ CoreAPI = UnimplementedCoreAPI{}
|
|
|
|
func (UnimplementedCoreAPI) WriteFact(ctx context.Context, req WriteFactReq) (int64, error) {
|
|
return 0, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) LatestFact(ctx context.Context, key string) (Fact, error) {
|
|
return Fact{}, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) LatestFactBySource(ctx context.Context, key, source string) (Fact, error) {
|
|
return Fact{}, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) Since(ctx context.Context, key string, now time.Time) (time.Duration, error) {
|
|
return 0, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) Presence(ctx context.Context) (Presence, error) {
|
|
return Presence{}, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) CreateReminder(ctx context.Context, fire time.Time, payload, cron string) (int64, error) {
|
|
return 0, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) MarkReminder(ctx context.Context, id int64, status string) error {
|
|
return ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) ListReminders(ctx context.Context, n int) ([]Reminder, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) RecordNudge(ctx context.Context, rule, channel, message string, ts time.Time) (int64, error) {
|
|
return 0, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) ResolveNudge(ctx context.Context, id int64, outcome string, ts time.Time) error {
|
|
return ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) RecentOutcomes(ctx context.Context, rule string, n int) ([]string, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) RecentFacts(ctx context.Context, n int) ([]Fact, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) RecentActiveFactsByKind(ctx context.Context, kind string, n int) ([]Fact, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) CalendarEvents(ctx context.Context, from, to time.Time) ([]Fact, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) DeliveryAttempts(ctx context.Context, status string, n int) ([]DeliveryAttempt, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) RecentNudges(ctx context.Context, n int) ([]Nudge, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) RecentEcosystemTraces(ctx context.Context, n int) ([]EcosystemTrace, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) WriteNote(ctx context.Context, ts time.Time, text string, embedding []float32, source string) (int64, error) {
|
|
return 0, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) QueryNotes(ctx context.Context, embedding []float32, k int) ([]Note, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) RecentNotesFromSource(ctx context.Context, prefix string, n int) ([]Note, error) {
|
|
return nil, ErrUnknownMethod
|
|
}
|
|
|
|
func (UnimplementedCoreAPI) RecentNotes(ctx context.Context, n int) ([]Note, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) ProposeTool(ctx context.Context, name, utterance, scope string, ts time.Time) (bool, error) {
|
|
return false, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) EnableTool(ctx context.Context, name string, cmd []string, destructive bool, scope string, ts time.Time) error {
|
|
return ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) DisableTool(ctx context.Context, name string) error {
|
|
return ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) DeleteTool(ctx context.Context, name string) error {
|
|
return ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) CaptureTask(ctx context.Context, req CaptureTaskReq) (CaptureTaskResp, error) {
|
|
return CaptureTaskResp{}, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) SeedEvent(ctx context.Context, req SeedEventReq) (SeedEventResp, error) {
|
|
return SeedEventResp{}, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) ListTasks(ctx context.Context, status string) ([]Task, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) SetTaskStatus(ctx context.Context, id int64, status string, ts time.Time, by string) error {
|
|
return ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) ResolveEntity(ctx context.Context, query string, types []string) (EntityRef, error) {
|
|
return EntityRef{}, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) EditTask(ctx context.Context, id int64, text string, due *time.Time, weight int) error {
|
|
return ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) SetTaskFields(ctx context.Context, id int64, doneWhen, blockedOn string) error {
|
|
return ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) ListProposedRoutines(ctx context.Context) ([]ProposedRoutine, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) DismissProposedRoutine(ctx context.Context, id int64) error {
|
|
return ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) AcceptProposedRoutine(ctx context.Context, id int64) error {
|
|
return ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) LookupTool(ctx context.Context, name string) (Tool, error) {
|
|
return Tool{}, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) ListTools(ctx context.Context, status string) ([]Tool, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) RevertFact(ctx context.Context, key string) (int64, error) {
|
|
return 0, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) TickTrace(ctx context.Context) (TickTrace, error) {
|
|
return TickTrace{}, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) CorrectTurn(ctx context.Context, traceID int64, shouldBe string) error {
|
|
return ErrNotImplemented
|
|
}
|
|
|
|
func (UnimplementedCoreAPI) TurnDecisions(ctx context.Context, n int) ([]TurnDecision, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) MorningStatus(ctx context.Context) ([]MorningRoutineStatus, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) RecentEvents(ctx context.Context, n int) ([]IntakeEvent, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) MCPServers(ctx context.Context) ([]MCPServerStatus, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) DayPlan(ctx context.Context) (DayPlan, error) {
|
|
return DayPlan{}, ErrNotImplemented
|
|
}
|
|
func (UnimplementedCoreAPI) Chat(ctx context.Context, conversation, text string) (ChatReply, error) {
|
|
return ChatReply{}, ErrNotImplemented
|
|
}
|