Documentation
¶
Overview ¶
Package identityai is an optional module that asks a configured text AI connection for identity suggestions (palette, fonts, taglines, a logo brief) and writes them to the Appearance → Identity draft, never live. It produces text only: no image, vector or GIF is ever generated or claimed.
Index ¶
Constants ¶
const ( // SettingEnabled switches the module (kernel.AddonEnabled): false turns it off. SettingEnabled = "addons.identityai.enabled" // PermGenerate is the permission the page requires (the same as the identity page). PermGenerate = "settings.manage" )
const PricesAsOf = "2026-10-22"
PricesAsOf is the date the table below was copied from the public lists.
const PromptVersion = "identityai-prompt-v1"
PromptVersion identifies the system prompt wording; it is part of the request fingerprint and of every audit row, so a changed prompt is a different request.
Variables ¶
var ErrDestinationChanged = errors.New("identityai: destination changed since it was reviewed")
ErrDestinationChanged is what Hooks.Complete returns when the destination differs from the reviewed fingerprint; the module then sends nothing and records nothing.
Functions ¶
func ClientCannotDrive ¶
ClientCannotDrive reports a model the shared AI client cannot call: OpenAI reasoning models require max_completion_tokens on chat/completions, which the client does not send.
Types ¶
type Brief ¶
type Brief struct {
Connection string // connection id; "" = the site's writing settings
Sector string
Audience string
Tone string
Keep string // what must stay (existing logo, a colour)
Languages string // "ar", "en" or "both"
}
Brief is what the operator tells the model.
type Connection ¶
type Connection struct {
ID, Name, Provider, Model, Host, TestStatus string
}
Connection describes an AI connection profile for display: never a secret.
func (Connection) Unsupported ¶
func (c Connection) Unsupported() bool
Unsupported reports a connection whose model the client cannot drive.
type Estimate ¶
type Estimate struct {
Known bool
USD float64
InputTokens int
OutputTokens int
AsOf string
Source string
PerMillionInput float64
PerMillionOutput float64
}
Estimate is the cost of one generation.
func EstimateCost ¶
EstimateCost looks up provider/model and prices inputTokens + outputTokens.
type Hooks ¶
type Hooks struct {
// Complete sends one system + user turn through connectionID (""
// means the site's writing settings) with at most maxTokens of reply
// and returns the reply text. It must refuse with ErrDestinationChanged
// when the destination no longer matches expectFingerprint.
Complete func(ctx context.Context, d *kernel.Deps, connectionID, model, system, input string, maxTokens int, expectFingerprint string) (string, error)
// Connections lists the saved AI connection profiles (for the select).
Connections func(ctx context.Context, d *kernel.Deps) ([]Connection, error)
// Destination returns, from one read, what the operator is shown for
// connectionID ("" is the site's writing settings) and the fingerprint
// of exactly those stored values (provider, endpoint, model, connection
// version and the stored credential, hashed). ok is false when the
// destination cannot be resolved or its credential is unreadable.
Destination func(ctx context.Context, d *kernel.Deps, connectionID string) (Connection, string, bool)
}
Hooks are the admin-owned AI functions the module depends on, injected at boot (like workagents), so this package never reads credentials.
type IdentityStore ¶
type IdentityStore interface {
Active(ctx context.Context) theme.Info
LiveIdentity(ctx context.Context, slug string) theme.IdentitySnapshot
IdentityDraft(ctx context.Context, slug string) (theme.IdentityDraft, bool)
SaveIdentityDraft(ctx context.Context, snap theme.IdentitySnapshot) error
}
IdentityStore is what the module needs from the theme service.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module is the identityai kernel.Module.
func (*Module) Enabled ¶
Enabled implements kernel.OptionalModule through the shared addon gate: on unless addons.identityai.enabled is false (System → Modules), like the other optional modules. Being on only adds the page; nothing is sent to a provider without a reviewed, approved request.
func (*Module) Migrations ¶
type Suggestion ¶
type Suggestion struct {
Accent, Background, Text string
HeadingFont, BodyFont, LatinFont string
Radius, Spacing string
TaglineAR, TaglineEN, LogoBrief string
HeadingFontLabel, BodyFontLabel string
LatinFontLabel string
ContrastRatio string
SavedAR, SavedEN bool // which tagline went into the draft
Values map[string]string
}
Suggestion is the model's answer after validation.