Documentation
¶
Index ¶
Constants ¶
const ( // DecisionCacheFile is where the decision cache is kept, in Setup.Dir (D27). DecisionCacheFile = "decision.cache" // BenchBudgetMs is how long the Worker measures its kernel: one nn.MatVecQ8Block32 over a // 3584×1024 int8 matrix. A manifest's min_rate is in runs per second of that kernel (≈ 770 // plain, ≈ 1640 SIMD under TinyGo 0.41 on the machine of nn/docs/PERFORMANCE.md). BenchBudgetMs = 200 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeciderSpec ¶ added in v0.1.0
type DeciderSpec struct {
Weights string // artifact id of the weights, e.g. "decider-0.8b"
Merges string // artifact id of the companion .merges file
Decoder decoder.Config // qwen.Qwen35_08B for decider-0.8b
Temperature float64 // decision temperature (decider-0.8b: 1.03)
}
DeciderSpec names the decision model's files in the artifacts manifest and its shape.
type Event ¶ added in v0.1.0
type Event struct {
Kind EventKind
Artifact string // EventProgress, EventAsleep: artifact id
Done int64 // EventProgress
Total int64 // EventProgress
WriterOff bool // EventReady: the writer was dropped (answers come from templates/data)
Persisted bool // EventReady: storage is persistent; false → the UI warns (D-PWA-9)
Shortfalls []string // EventAsleep: device.Shortfall.String() of every blocking shortfall
SessionID string // EventReply
Text string // EventReply, EventFailed
Pending []Pending
}
Event is one message from the Worker to the page.
func DecodeEvent ¶ added in v0.1.0
DecodeEvent reads an Event written by Encode.
type Models ¶ added in v0.1.0
type Models struct {
Decider llm.Decider
Writer llm.Client // nil when the device could not take the writer (D-PWA-2)
Tokens llm.TokenCounter // the decider's tokenizer
}
Models are what agentworker built; the application's AgentConfig receives them.
type Pending ¶ added in v0.1.0
type Pending struct{ ID, Name, Input string }
Pending is a tool call waiting for the person (from llm.ToolCall).
type Request ¶ added in v0.1.0
type Request struct {
Kind RequestKind
SessionID string
Text string // RequestRun only
Persisted bool // RequestStart only: what the page's device.Persist() answered (D-PWA-9)
}
Request is one message from the page to the Worker.
func DecodeRequest ¶ added in v0.1.0
DecodeRequest reads a Request written by Encode.
type RequestKind ¶ added in v0.1.0
type RequestKind uint8
RequestKind is what the page asks the Worker.
const ( RequestStart RequestKind = iota + 1 // check the device, download, load; then Ready or Asleep RequestRun // a message from the person RequestConfirm // confirm the pending calls RequestDecline // decline them )
type Scripts ¶ added in v0.1.5
type Scripts struct {
Plain string // e.g. "/cote.worker.js"
SIMD string // e.g. "/cote.simd.worker.js"; "" = only the plain build exists
}
Scripts are the Worker scripts of one assistant: the same Worker main built twice (D16), by sitec from web/workers/<name> as "/<name>.worker.js" and "/<name>.simd.worker.js".
type Setup ¶ added in v0.1.0
type Setup struct {
Dir string // OPFS directory of this module (D-PWA-10), e.g. "cote"
Decider DeciderSpec // required
Writer *WriterSpec // optional; dropped when the device cannot hold or run it
// AgentConfig returns the application's agent configuration (Texts, Templates, Guard, Memory,
// IDGen, Clock, ToolIndex, LocalTools, MCPServers...). agentworker then sets Decider, Writer
// and Tokens from m, overriding whatever the function put there.
AgentConfig func(m Models) (agent.Config, error)
}
Setup is everything the Worker binary declares.