Documentation
¶
Overview ¶
Package identitylogo stages static PNG proposals privately. Generation never publishes media or applies a live identity. Adapters must declare capabilities; a configured text connection alone is not evidence of image support.
Index ¶
- Constants
- Variables
- type AuditEvent
- type Candidate
- type Capability
- type Destination
- type DraftStore
- type Hooks
- type Input
- type Options
- type Prepared
- type Quote
- type Review
- type Service
- func (s *Service) Candidate(ctx context.Context, owner, id string) (Candidate, []byte, error)
- func (s *Service) Generate(ctx context.Context, owner, approval string, approved bool) (result Candidate, resultErr error)
- func (s *Service) Preview(ctx context.Context, owner string, in Input) (Review, error)
- func (s *Service) Select(ctx context.Context, owner, id, slot, expectedRevision string) error
Constants ¶
const (
MaxImageBytes = 8 << 20
)
const PromptVersion = "identitylogo-static-v1"
Variables ¶
var ( ErrApproval = errors.New("identitylogo: approval missing, expired or consumed") ErrChanged = errors.New("identitylogo: reviewed configuration or identity changed") ErrUnsupported = errors.New("identitylogo: static PNG generation or known image pricing unavailable") ErrProvider = errors.New("identitylogo: generation failed; outcome may be uncertain, no automatic retry") ErrImage = errors.New("identitylogo: invalid or oversized static PNG") ErrCandidate = errors.New("identitylogo: candidate unavailable") ErrDisabled = errors.New("identitylogo: module disabled") ErrLimit = errors.New("identitylogo: private staging capacity reached") )
Functions ¶
This section is empty.
Types ¶
type AuditEvent ¶
type AuditEvent struct {
Action string `json:"action"`
Outcome string `json:"outcome"`
Owner string `json:"owner"`
Theme string `json:"theme"`
ConnectionID string `json:"connection_id"`
Model string `json:"model"`
PayloadHash string `json:"payload_hash"`
PromptVersion string `json:"prompt_version"`
EstimateMicros int64 `json:"estimate_micros"`
Currency string `json:"currency"`
CandidateHash string `json:"candidate_hash,omitempty"`
}
type Capability ¶
type Capability struct {
StaticPNG bool `json:"static_png"`
Fingerprint string `json:"fingerprint"`
Evidence string `json:"evidence"`
}
Capability is an explicit adapter declaration, never inferred from model name. Evidence states configured/unverified or verified; fake tests never verify a production capability. Fingerprint includes adapter/protocol/schema/version.
type Destination ¶
type DraftStore ¶
type DraftStore interface {
Revision(context.Context, string) (string, error)
SelectPNG(ctx context.Context, theme, revision, slot string, png []byte) error
}
DraftStore's revision must include effective live AND raw draft identity. SelectPNG imports one new media asset only on explicit selection, then uses an atomic transaction to compare revision and merge only the chosen logo slot. On conflict it must never overwrite concurrent edits or delete shared media.
type Hooks ¶
type Hooks struct {
// Record receives metadata only; never raw prompts, payloads or secrets.
Record func(context.Context, AuditEvent)
// Prepare is local/read-only and must not call a provider. It returns a
// credential-free payload, explicit capability and image-specific pricing.
Prepare func(context.Context, Input) (Prepared, error)
// GenerateBounded re-resolves one configuration snapshot, compares every
// approved destination/capability/price value and sends exactly Payload using
// credentials from THAT SAME snapshot. Changed config returns ErrChanged
// before I/O. No retries, URL downloads, hidden prompts or extra images.
GenerateBounded func(context.Context, Prepared) ([]byte, error)
}
type Input ¶
type Input struct {
ConnectionID string `json:"connection_id"`
Theme string `json:"theme"`
Prompt string `json:"prompt"`
Size int `json:"size"`
BudgetMicros int64 `json:"budget_micros"`
Currency string `json:"currency"`
}
Input contains only deliberately supplied data; reference images and animation are unsupported. BudgetMicros is in the quote's currency (one unit = 1e6).
type Prepared ¶
type Prepared struct {
PromptVersion string `json:"prompt_version"`
Input Input `json:"input"`
Destination Destination `json:"destination"`
Capability Capability `json:"capability"`
Quote Quote `json:"quote"`
// Payload is the exact reviewed provider JSON. It must describe one PNG and
// contain no credential, hidden site context or reference image.
Payload json.RawMessage `json:"payload"`
}
type Quote ¶
type Quote struct {
Known bool `json:"known"`
AmountMicros int64 `json:"amount_micros"`
Currency string `json:"currency"`
Source string `json:"source"`
Version string `json:"version"`
AsOf string `json:"as_of"`
Basis string `json:"basis"`
}
Quote is an image request estimate, not a text-token estimate or a promise of a provider-enforced spending cap. Unknown prices fail closed in this version.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service keeps bounded private staging in memory, outside the public media library. Restart discards pending consent and candidates without any replay.
func NewService ¶
func NewService(h Hooks, d DraftStore, o Options) *Service
func (*Service) Candidate ¶
Candidate returns a defensive copy only to its owner. HTTP adapters must set image/png, nosniff and private/no-store and enforce both settings.manage and media.upload on every action (including candidate reads).
func (*Service) Generate ¶
func (s *Service) Generate(ctx context.Context, owner, approval string, approved bool) (result Candidate, resultErr error)
Generate consumes consent before I/O, including failed/uncertain attempts. A retry always needs a new explicit review and approval.