Contract hooks JavaScript API
Every contract an app's JS may touch: a hook for each of its operations (on<Contract><Operation>, which may change the call's input or refuse it), onContracts to provide contracts from pb_hooks, and the contracts' types. See Contracts; their Go side is in the Go API.
Functions
onContracts()
onContracts(handler: (e: contracts.DeclareEvent) => void): void
Declares and provides the app's contracts, once, after pb_hooks load.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.DeclareEvent) => void |
onBulkmailCount()
onBulkmailCount(handler: (e: contracts.CallEvent<contracts.bulkmail.v1.CountInput>) => void): void
Count says how many recipients an audience reaches, how many of them are suppressed, and a few sample addresses.
Runs on every count call to bulkmail/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.bulkmail.v1.CountInput>) => void |
onBulkmailStart()
onBulkmailStart(handler: (e: contracts.CallEvent<contracts.bulkmail.v1.StartInput>) => void): void
Start queues a campaign's recipients and starts sending (Limit > 0: at most that many new recipients).
Runs on every start call to bulkmail/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.bulkmail.v1.StartInput>) => void |
onBulkmailPause()
onBulkmailPause(handler: (e: contracts.CallEvent<contracts.bulkmail.v1.Ref>) => void): void
Pause stops sending a campaign; Resume carries on.
Runs on every pause call to bulkmail/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.bulkmail.v1.Ref>) => void |
onBulkmailResume()
onBulkmailResume(handler: (e: contracts.CallEvent<contracts.bulkmail.v1.Ref>) => void): void
Resume carries on sending a paused campaign.
Runs on every resume call to bulkmail/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.bulkmail.v1.Ref>) => void |
onBulkmailCancel()
onBulkmailCancel(handler: (e: contracts.CallEvent<contracts.bulkmail.v1.Ref>) => void): void
Cancel stops a campaign for good; recipients not yet sent to are dropped.
Runs on every cancel call to bulkmail/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.bulkmail.v1.Ref>) => void |
onBulkmailPreview()
onBulkmailPreview(handler: (e: contracts.CallEvent<contracts.bulkmail.v1.PreviewInput>) => void): void
Preview renders a campaign's message for one recipient (the first in its audience when Email is empty).
Runs on every preview call to bulkmail/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.bulkmail.v1.PreviewInput>) => void |
onBulkmailTest()
onBulkmailTest(handler: (e: contracts.CallEvent<contracts.bulkmail.v1.TestInput>) => void): void
Test sends a campaign's message to one address, marked as a test.
Runs on every test call to bulkmail/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.bulkmail.v1.TestInput>) => void |
onLlmAlignAlign()
onLlmAlignAlign(handler: (e: contracts.CallEvent<contracts.llm.align.v1.AlignInput>) => void): void
Align says when each line and word of the text is said in the audio.
Runs on every align call to llm.align/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.align.v1.AlignInput>) => void |
onLlmAlignModels()
onLlmAlignModels(handler: (e: contracts.CallEvent<contracts.llm.align.v1.LlmModelsInput>) => void): void
Models lists the alignment models of every provider in Settings → LLM.
Runs on every models call to llm.align/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.align.v1.LlmModelsInput>) => void |
onLlmChatNew()
onLlmChatNew(handler: (e: contracts.CallEvent<contracts.llm.chat.v1.NewInput>) => void): void
New starts a chat and returns it; its id is how the app finds it again.
Runs on every new call to llm.chat/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.chat.v1.NewInput>) => void |
onLlmChatSend()
onLlmChatSend(handler: (e: contracts.CallEvent<contracts.llm.chat.v1.SendInput>) => void): void
Send asks the chat a question: the provider sends the system text, the chat's summary, its recent messages and the question (with Context after it) to llm.text/v1, saves both turns, and folds older messages into the summary when it's due.
Runs on every send call to llm.chat/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.chat.v1.SendInput>) => void |
onLlmChatSendStream()
onLlmChatSendStream(handler: (e: contracts.CallEvent<contracts.llm.chat.v1.SendInput>) => void): void
SendStream is Send with the answer as it's written: llm.text/v1 chunks, the last one with done and the result.
Runs on every send_stream call to llm.chat/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.chat.v1.SendInput>) => void |
onLlmChatGet()
onLlmChatGet(handler: (e: contracts.CallEvent<contracts.llm.chat.v1.Ref>) => void): void
Get returns a chat.
Runs on every get call to llm.chat/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.chat.v1.Ref>) => void |
onLlmChatHistory()
onLlmChatHistory(handler: (e: contracts.CallEvent<contracts.llm.chat.v1.HistoryInput>) => void): void
History returns a chat's messages, oldest first: the last Limit before the message Before (all when 0 and "").
Runs on every history call to llm.chat/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.chat.v1.HistoryInput>) => void |
onLlmChatUpdate()
onLlmChatUpdate(handler: (e: contracts.CallEvent<contracts.llm.chat.v1.UpdateInput>) => void): void
Update sets a chat's title or meta (fields left out stay).
Runs on every update call to llm.chat/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.chat.v1.UpdateInput>) => void |
onLlmChatList()
onLlmChatList(handler: (e: contracts.CallEvent<contracts.llm.chat.v1.ListInput>) => void): void
List returns chats, most recently updated first; Meta keeps those whose meta has each of its top-level keys with that value.
Runs on every list call to llm.chat/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.chat.v1.ListInput>) => void |
onLlmChatForget()
onLlmChatForget(handler: (e: contracts.CallEvent<contracts.llm.chat.v1.Ref>) => void): void
Forget deletes a chat, its messages and the model's state for it.
Runs on every forget call to llm.chat/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.chat.v1.Ref>) => void |
onLlmChatForgetWhere()
onLlmChatForgetWhere(handler: (e: contracts.CallEvent<contracts.llm.chat.v1.ListInput>) => void): void
ForgetWhere deletes every chat whose meta matches (as in List), e.g. all of a user the app deleted.
Runs on every forget_where call to llm.chat/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.chat.v1.ListInput>) => void |
onLlmEmbedEmbed()
onLlmEmbedEmbed(handler: (e: contracts.CallEvent<contracts.llm.embed.v1.EmbedInput>) => void): void
Embed returns one vector per input text, in order.
Runs on every embed call to llm.embed/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.embed.v1.EmbedInput>) => void |
onLlmEmbedModels()
onLlmEmbedModels(handler: (e: contracts.CallEvent<contracts.llm.embed.v1.LlmModelsInput>) => void): void
Models lists the embedding models of every provider in Settings → LLM.
Runs on every models call to llm.embed/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.embed.v1.LlmModelsInput>) => void |
onLlmImageGenerate()
onLlmImageGenerate(handler: (e: contracts.CallEvent<contracts.llm.image.v1.GenerateInput>) => void): void
Generate makes pictures from a prompt, and from the reference pictures it's given.
Runs on every generate call to llm.image/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.image.v1.GenerateInput>) => void |
onLlmImageModels()
onLlmImageModels(handler: (e: contracts.CallEvent<contracts.llm.image.v1.LlmModelsInput>) => void): void
Models lists the image models of every provider in Settings → LLM.
Runs on every models call to llm.image/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.image.v1.LlmModelsInput>) => void |
onLlmLedgerRemaining()
onLlmLedgerRemaining(handler: (e: contracts.CallEvent<contracts.llm.ledger.v1.RemainingInput>) => void): void
Remaining is, for each limit in Settings → LLM that counts the subject's calls, how much is used and left in its current window, the tightest first.
Runs on every remaining call to llm.ledger/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.ledger.v1.RemainingInput>) => void |
onLlmLedgerSpent()
onLlmLedgerSpent(handler: (e: contracts.CallEvent<contracts.llm.ledger.v1.SpentInput>) => void): void
Spent is what the subject's calls used in a window.
Runs on every spent call to llm.ledger/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.ledger.v1.SpentInput>) => void |
onLlmLedgerSummary()
onLlmLedgerSummary(handler: (e: contracts.CallEvent<contracts.llm.ledger.v1.SummaryInput>) => void): void
Summary is what calls used, grouped by model, kind, subject or day.
Runs on every summary call to llm.ledger/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.ledger.v1.SummaryInput>) => void |
onLlmLedgerCalls()
onLlmLedgerCalls(handler: (e: contracts.CallEvent<contracts.llm.ledger.v1.CallsInput>) => void): void
Calls lists the ledger's rows, newest first.
Runs on every calls call to llm.ledger/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.ledger.v1.CallsInput>) => void |
onLlmMusicCreate()
onLlmMusicCreate(handler: (e: contracts.CallEvent<contracts.llm.music.v1.CreateInput>) => void): void
Create starts making music. With Wait it returns once the job is done (or failed), its files included; otherwise at once, to follow with Get.
Runs on every create call to llm.music/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.music.v1.CreateInput>) => void |
onLlmMusicGet()
onLlmMusicGet(handler: (e: contracts.CallEvent<contracts.llm.music.v1.LlmJobRef>) => void): void
Get says how a job is going.
Runs on every get call to llm.music/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.music.v1.LlmJobRef>) => void |
onLlmMusicContent()
onLlmMusicContent(handler: (e: contracts.CallEvent<contracts.llm.music.v1.LlmContentInput>) => void): void
Content fetches one of a done job's files.
Runs on every content call to llm.music/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.music.v1.LlmContentInput>) => void |
onLlmMusicModels()
onLlmMusicModels(handler: (e: contracts.CallEvent<contracts.llm.music.v1.LlmModelsInput>) => void): void
Models lists the music models of every provider in Settings → LLM.
Runs on every models call to llm.music/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.music.v1.LlmModelsInput>) => void |
onLlmSearchStatus()
onLlmSearchStatus(handler: (e: contracts.CallEvent<{}>) => void): void
Status is the app's embedding model and how far embedding has got across every bucket.
Runs on every status call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<{}>) => void |
onLlmSearchSetModel()
onLlmSearchSetModel(handler: (e: contracts.CallEvent<contracts.llm.search.v1.ModelInput>) => void): void
SetModel changes the app's embedding model ("provider/model" from llm.embed/v1's models; "" picks one again). Every bucket is embedded again in the background; until a chunk is, keywords still find it.
Runs on every set_model call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.ModelInput>) => void |
onLlmSearchBuckets()
onLlmSearchBuckets(handler: (e: contracts.CallEvent<{}>) => void): void
Buckets lists the app's buckets with their counts.
Runs on every buckets call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<{}>) => void |
onLlmSearchBucket()
onLlmSearchBucket(handler: (e: contracts.CallEvent<contracts.llm.search.v1.Ref>) => void): void
Bucket returns one bucket with its counts.
Runs on every bucket call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.Ref>) => void |
onLlmSearchEnsure()
onLlmSearchEnsure(handler: (e: contracts.CallEvent<contracts.llm.search.v1.EnsureInput>) => void): void
Ensure makes a bucket if it's missing and returns it. An existing bucket keeps its settings, except that an empty title, description or owner is filled in. Apps call it at startup for the bucket they need.
Runs on every ensure call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.EnsureInput>) => void |
onLlmSearchUpdate()
onLlmSearchUpdate(handler: (e: contracts.CallEvent<contracts.llm.search.v1.UpdateInput>) => void): void
Update changes a bucket's title, description or limits (fields left out stay).
Runs on every update call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.UpdateInput>) => void |
onLlmSearchDelete()
onLlmSearchDelete(handler: (e: contracts.CallEvent<contracts.llm.search.v1.Ref>) => void): void
Delete removes a bucket and everything in it.
Runs on every delete call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.Ref>) => void |
onLlmSearchSources()
onLlmSearchSources(handler: (e: contracts.CallEvent<contracts.llm.search.v1.BucketRef>) => void): void
Sources lists a bucket's sources, by name.
Runs on every sources call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.BucketRef>) => void |
onLlmSearchAdd()
onLlmSearchAdd(handler: (e: contracts.CallEvent<contracts.llm.search.v1.AddInput>) => void): void
Add puts a file or pasted text in a bucket as its own source (one document), replacing the source of that name. The same text again costs nothing; changed text embeds only its new chunks. It returns at once; the document is embedded in the background (its status says how far it got).
Runs on every add call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.AddInput>) => void |
onLlmSearchUpload()
onLlmSearchUpload(handler: (e: contracts.CallEvent<contracts.llm.search.v1.ExtkitRawIn>) => void): void
Upload adds a file sent as the request body: ?bucket=
Runs on every upload call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.ExtkitRawIn>) => void |
onLlmSearchPut()
onLlmSearchPut(handler: (e: contracts.CallEvent<contracts.llm.search.v1.PutInput>) => void): void
Put adds one file to a folder source (made on the first one), the way the dashboard sends a dropped folder; Prune ends it.
Runs on every put call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.PutInput>) => void |
onLlmSearchPrune()
onLlmSearchPrune(handler: (e: contracts.CallEvent<contracts.llm.search.v1.PruneInput>) => void): void
Prune removes the documents of a folder source that aren't in Keep: the files the folder no longer has.
Runs on every prune call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.PruneInput>) => void |
onLlmSearchAddURL()
onLlmSearchAddURL(handler: (e: contracts.CallEvent<contracts.llm.search.v1.URLInput>) => void): void
AddURL adds a web page or a Git repository as a source (named by its URL, replacing one of that name) and reads it in the background; Every keeps it current.
Runs on every add_u_r_l call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.URLInput>) => void |
onLlmSearchAddFolder()
onLlmSearchAddFolder(handler: (e: contracts.CallEvent<contracts.llm.search.v1.FolderInput>) => void): void
AddFolder adds a folder of the app's own files on the server (named by its path, replacing one of that name): every text file in it, read in the background and read again every few minutes, so changed files are embedded again and removed ones leave. With URL, each result from it links to the page that file is published at.
Runs on every add_folder call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.FolderInput>) => void |
onLlmSearchDetectURL()
onLlmSearchDetectURL(handler: (e: contracts.CallEvent<contracts.llm.search.v1.URLRef>) => void): void
DetectURL says how AddURL would read a URL: as a Git repository when its server answers the Git protocol (any host, with or without .git), otherwise as a web page.
Runs on every detect_u_r_l call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.URLRef>) => void |
onLlmSearchFollow()
onLlmSearchFollow(handler: (e: contracts.CallEvent<contracts.llm.search.v1.FollowInput>) => void): void
Follow adds one of the app's collections as a source (named by the collection): each record the filter keeps is a document, kept in sync as records are saved and deleted.
Runs on every follow call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.FollowInput>) => void |
onLlmSearchRefresh()
onLlmSearchRefresh(handler: (e: contracts.CallEvent<contracts.llm.search.v1.SourceRef>) => void): void
Refresh reads a source again now: fetches a URL or repository, rereads a collection, resplits a file or zip.
Runs on every refresh call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.SourceRef>) => void |
onLlmSearchRemove()
onLlmSearchRemove(handler: (e: contracts.CallEvent<contracts.llm.search.v1.RemoveInput>) => void): void
Remove takes sources out of a bucket, with their documents.
Runs on every remove call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.RemoveInput>) => void |
onLlmSearchDocuments()
onLlmSearchDocuments(handler: (e: contracts.CallEvent<contracts.llm.search.v1.DocumentsInput>) => void): void
Documents lists a bucket's documents (or one source's), by source and name.
Runs on every documents call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.DocumentsInput>) => void |
onLlmSearchSearch()
onLlmSearchSearch(handler: (e: contracts.CallEvent<contracts.llm.search.v1.SearchInput>) => void): void
Search returns the chunks that best match a query across the buckets named, best first.
Runs on every search call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.SearchInput>) => void |
onLlmSearchSample()
onLlmSearchSample(handler: (e: contracts.CallEvent<contracts.llm.search.v1.SampleInput>) => void): void
Sample returns chunks picked at random from the buckets named: material to draw from ("surprise me", a topic nobody asked about), not matches. No query, no embedding, so it costs nothing. Like Search without a viewer, it may return any chunk, a followed record's included.
Runs on every sample call to llm.search/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.search.v1.SampleInput>) => void |
onLlmSpeechSpeak()
onLlmSpeechSpeak(handler: (e: contracts.CallEvent<contracts.llm.speech.v1.SpeakInput>) => void): void
Speak reads the text aloud and returns the audio.
Runs on every speak call to llm.speech/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.speech.v1.SpeakInput>) => void |
onLlmSpeechVoices()
onLlmSpeechVoices(handler: (e: contracts.CallEvent<contracts.llm.speech.v1.VoicesInput>) => void): void
Voices lists a model's voices, when the provider says.
Runs on every voices call to llm.speech/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.speech.v1.VoicesInput>) => void |
onLlmSpeechModels()
onLlmSpeechModels(handler: (e: contracts.CallEvent<contracts.llm.speech.v1.LlmModelsInput>) => void): void
Models lists the speech models of every provider in Settings → LLM.
Runs on every models call to llm.speech/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.speech.v1.LlmModelsInput>) => void |
onLlmTextComplete()
onLlmTextComplete(handler: (e: contracts.CallEvent<contracts.llm.text.v1.CompleteInput>) => void): void
Complete answers a prompt or a conversation.
Runs on every complete call to llm.text/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.text.v1.CompleteInput>) => void |
onLlmTextStream()
onLlmTextStream(handler: (e: contracts.CallEvent<contracts.llm.text.v1.CompleteInput>) => void): void
Stream answers like Complete, sending the answer as it's written: a chunk with text (or reasoning) for each piece, then one with done and the whole result.
Runs on every stream call to llm.text/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.text.v1.CompleteInput>) => void |
onLlmTextCount()
onLlmTextCount(handler: (e: contracts.CallEvent<contracts.llm.text.v1.CountInput>) => void): void
Count says about how many tokens a text or a conversation is, for budgeting what to send.
Runs on every count call to llm.text/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.text.v1.CountInput>) => void |
onLlmTextModels()
onLlmTextModels(handler: (e: contracts.CallEvent<contracts.llm.text.v1.LlmModelsInput>) => void): void
Models lists the text models of every provider in Settings → LLM.
Runs on every models call to llm.text/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.text.v1.LlmModelsInput>) => void |
onLlmTranscribeTranscribe()
onLlmTranscribeTranscribe(handler: (e: contracts.CallEvent<contracts.llm.transcribe.v1.TranscribeInput>) => void): void
Transcribe writes down what's said in the audio.
Runs on every transcribe call to llm.transcribe/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.transcribe.v1.TranscribeInput>) => void |
onLlmTranscribeModels()
onLlmTranscribeModels(handler: (e: contracts.CallEvent<contracts.llm.transcribe.v1.LlmModelsInput>) => void): void
Models lists the transcription models of every provider in Settings → LLM.
Runs on every models call to llm.transcribe/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.transcribe.v1.LlmModelsInput>) => void |
onLlmVideoCreate()
onLlmVideoCreate(handler: (e: contracts.CallEvent<contracts.llm.video.v1.CreateInput>) => void): void
Create starts making a video. With Wait it returns once the job is done (or failed); otherwise at once, to follow with Get. A done job lists how many files it made (Outputs); Content fetches each.
Runs on every create call to llm.video/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.video.v1.CreateInput>) => void |
onLlmVideoGet()
onLlmVideoGet(handler: (e: contracts.CallEvent<contracts.llm.video.v1.LlmJobRef>) => void): void
Get says how a job is going.
Runs on every get call to llm.video/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.video.v1.LlmJobRef>) => void |
onLlmVideoContent()
onLlmVideoContent(handler: (e: contracts.CallEvent<contracts.llm.video.v1.LlmContentInput>) => void): void
Content fetches one of a done job's files.
Runs on every content call to llm.video/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.video.v1.LlmContentInput>) => void |
onLlmVideoModels()
onLlmVideoModels(handler: (e: contracts.CallEvent<contracts.llm.video.v1.LlmModelsInput>) => void): void
Models lists the video models of every provider in Settings → LLM.
Runs on every models call to llm.video/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.llm.video.v1.LlmModelsInput>) => void |
onMailFeedbackSES()
onMailFeedbackSES(handler: (e: contracts.CallEvent<contracts.mail.feedback.v1.ExtkitRawIn>) => void): void
SES takes an Amazon SNS delivery carrying SES bounce and complaint notifications (and confirms the topic subscription). Point an SNS HTTPS subscription here.
Runs on every s_e_s call to mail.feedback/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.mail.feedback.v1.ExtkitRawIn>) => void |
onMailFeedbackWebhook()
onMailFeedbackWebhook(handler: (e: contracts.CallEvent<contracts.mail.feedback.v1.ExtkitRawIn>) => void): void
Webhook takes {"type": "bounce|complaint|unsubscribe", "email": ..., "campaign": ...} from any provider, with the shared secret in the X-Feedback-Secret header.
Runs on every webhook call to mail.feedback/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.mail.feedback.v1.ExtkitRawIn>) => void |
onMailSuppressionCheck()
onMailSuppressionCheck(handler: (e: contracts.CallEvent<contracts.mail.suppression.v1.Address>) => void): void
Check says whether an address is suppressed, and why.
Runs on every check call to mail.suppression/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.mail.suppression.v1.Address>) => void |
onMailSuppressionSuppress()
onMailSuppressionSuppress(handler: (e: contracts.CallEvent<contracts.mail.suppression.v1.SuppressInput>) => void): void
Suppress adds an address (or changes its reason).
Runs on every suppress call to mail.suppression/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.mail.suppression.v1.SuppressInput>) => void |
onMailSuppressionUnsuppress()
onMailSuppressionUnsuppress(handler: (e: contracts.CallEvent<contracts.mail.suppression.v1.Address>) => void): void
Unsuppress removes an address, so it receives bulk mail again.
Runs on every unsuppress call to mail.suppression/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.mail.suppression.v1.Address>) => void |
onMailSuppressionUnsubscribePage()
onMailSuppressionUnsubscribePage(handler: (e: contracts.CallEvent<contracts.mail.suppression.v1.Link>) => void): void
UnsubscribePage is the page an unsubscribe link opens (?t=
Runs on every unsubscribe_page call to mail.suppression/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.mail.suppression.v1.Link>) => void |
onMailSuppressionUnsubscribe()
onMailSuppressionUnsubscribe(handler: (e: contracts.CallEvent<contracts.mail.suppression.v1.ExtkitRawIn>) => void): void
Unsubscribe confirms the page's form, or a mail provider's one-click POST (List-Unsubscribe=One-Click).
Runs on every unsubscribe call to mail.suppression/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.mail.suppression.v1.ExtkitRawIn>) => void |
onRemoteWhoami()
onRemoteWhoami(handler: (e: contracts.CallEvent<{}>) => void): void
Whoami says who the credential is, the app's name and URL, and the contracts it offers.
Runs on every whoami call to remote/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<{}>) => void |
onRemoteStatus()
onRemoteStatus(handler: (e: contracts.CallEvent<{}>) => void): void
Status reports whether the app is running, its versions, uptime and mode.
Runs on every status call to remote/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<{}>) => void |
onRemoteRestart()
onRemoteRestart(handler: (e: contracts.CallEvent<{}>) => void): void
Restart restarts the app; requests in flight finish first.
Runs on every restart call to remote/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<{}>) => void |
onRemoteLogs()
onRemoteLogs(handler: (e: contracts.CallEvent<contracts.remote.v1.LogsInput>) => void): void
Logs streams the app's log: the last entries, then new ones as they're written.
Runs on every logs call to remote/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.remote.v1.LogsInput>) => void |
onRestorePoints()
onRestorePoints(handler: (e: contracts.CallEvent<{}>) => void): void
Points says what the app's data can be restored to: a window of time (continuous history) or a list of moments (backups), and whether a restore is running.
Runs on every points call to restore/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<{}>) => void |
onRestoreRestoreTo()
onRestoreRestoreTo(handler: (e: contracts.CallEvent<contracts.restore.v1.RestoreInput>) => void): void
RestoreTo puts the app's data back as it was at the given moment, from the latest point at or before it. The app restarts to apply it; its current data is kept aside until the next restore.
Runs on every restore_to call to restore/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.restore.v1.RestoreInput>) => void |
onSettingsList()
onSettingsList(handler: (e: contracts.CallEvent<{}>) => void): void
List names the extensions whose settings this app's admins can change.
Runs on every list call to settings/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<{}>) => void |
onSettingsGet()
onSettingsGet(handler: (e: contracts.CallEvent<contracts.settings.v1.Ref>) => void): void
Get returns one extension's settings. Secrets come back empty, with a flag saying they're set.
Runs on every get call to settings/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.settings.v1.Ref>) => void |
onSettingsSave()
onSettingsSave(handler: (e: contracts.CallEvent<contracts.settings.v1.Change>) => void): void
Save replaces one extension's settings and applies them. A secret left empty keeps its saved value. Settings a host sets are read-only here.
Runs on every save call to settings/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.settings.v1.Change>) => void |
onSettingsTest()
onSettingsTest(handler: (e: contracts.CallEvent<contracts.settings.v1.Change>) => void): void
Test checks one extension's settings without saving them (a test write to a bucket, a test message).
Runs on every test call to settings/v1, from any surface (HTTP, Go, MCP, the CLI): change e.input, or throw to refuse.
| Parameter | Type | |
|---|---|---|
handler |
(e: contracts.CallEvent<contracts.settings.v1.Change>) => void |
Types
contracts.Auth
| Member | Type | |
|---|---|---|
kind |
string |
"superuser", "record", "token", "host", or "" (anonymous). |
id |
string |
|
scopes |
string[] | null |
A token's scopes; null means every scope. |
via |
string |
|
collection |
string |
|
recordId |
string |
|
email |
string |
contracts.CallEvent
One call to a wire contract's operation; In is the operation's input type (its contract's namespace has it).
| Member | Type | |
|---|---|---|
contract |
string |
|
op |
string |
|
auth |
Auth |
|
input |
In |
The operation's input; a hook may change it. |
next() |
(): void |
contracts.AnyProvider
A JS implementation of a contract with no declarations here: an object with its methods.
contracts.DeclareEvent
| Member | Type | |
|---|---|---|
provide() |
(id: Id, impl: Id extends keyof Providers ? Providers[Id] : AnyProvider): void |
Provides a contract from JS: an object with its methods (typed by contracts.Providers for known ids). |
require() |
(...ids: string[]): void |
The app needs this contract: the start fails (dev mode: warns) when nothing provides it. |
worksWith() |
(...ids: string[]): void |
Works with this contract when present (shown in the startup lines). |
next() |
(): void |
contracts.bulkmail.v1.CountInput
CountInput is an audience, in the provider's audience shape (see its README).
| Member | Type | |
|---|---|---|
audience |
any |
contracts.bulkmail.v1.StartInput
StartInput starts a campaign.
| Member | Type | |
|---|---|---|
campaign |
string |
|
limit |
number |
contracts.bulkmail.v1.Ref
Ref names a campaign (its record id).
| Member | Type | |
|---|---|---|
campaign |
string |
contracts.bulkmail.v1.PreviewInput
PreviewInput picks the recipient to render for.
| Member | Type | |
|---|---|---|
campaign |
string |
|
email |
string |
contracts.bulkmail.v1.TestInput
TestInput is where a test message goes.
| Member | Type | |
|---|---|---|
campaign |
string |
|
to |
string |
contracts.llm.align.v1.AlignInput
AlignInput is the recording and its words.
| Member | Type | |
|---|---|---|
model |
string |
"provider/model", required |
audio |
LlmFile |
its Name's extension (story.mp3) or Type tells the provider the format |
text |
string |
Text is the words in the audio, one line per line. A line in square brackets ([Chorus]) labels the lines under it and isn't timed. |
mode |
string |
Mode is "speech" for a voice recording, or "lyrics" (the provider's default) to separate a sung vocal from the music first. |
language |
string |
Language is the text's language as an ISO 639-1 code ("en"); empty lets the model tell. |
options |
Record<string, any> |
contracts.llm.align.v1.LlmModelsInput
| Member | Type | |
|---|---|---|
provider |
string |
contracts.llm.align.v1.LlmFile
| Member | Type | |
|---|---|---|
name |
string |
|
type |
string |
|
data |
any |
|
url |
string |
contracts.llm.chat.v1.NewInput
NewInput is a new chat's optional title and meta (the app's own JSON object).
| Member | Type | |
|---|---|---|
title |
string |
|
meta |
any |
contracts.llm.chat.v1.SendInput
SendInput is a question for a chat and how to ask it.
| Member | Type | |
|---|---|---|
id |
string |
|
text |
string |
|
system |
string |
System is the preamble, sent first on every turn (keep it the same for the prompt cache). |
window |
number |
Window is how many recent messages to send (default 12); older ones reach the model through the summary. |
summarizeEvery |
number |
SummarizeEvery folds the messages that left the window into the summary once that many have (default 6). |
context |
string |
Context is text sent after the question (the passages that answer it, say). The chat keeps the question as sent, to send it the same way next turn; history shows the question alone. |
schema |
any |
|
maxTokens |
number |
|
temperature |
number | null |
|
model |
string |
Model is the text model to answer with ("provider/model", required). |
reasoning |
string |
Reasoning is how much a reasoning model thinks first: "", "off", "low", "medium" or "high". Enrich adds the best passages from the app's search buckets after the question, beside Context (search/v1); |
enrich |
LlmEnrich | null |
the answer's Passages lists them. |
contracts.llm.chat.v1.Ref
Ref names a chat.
| Member | Type | |
|---|---|---|
id |
string |
contracts.llm.chat.v1.HistoryInput
HistoryInput picks a page of a chat's messages.
| Member | Type | |
|---|---|---|
id |
string |
|
limit |
number |
|
before |
string |
a message id |
contracts.llm.chat.v1.UpdateInput
UpdateInput changes a chat's title or meta.
| Member | Type | |
|---|---|---|
id |
string |
|
title |
string | null |
|
meta |
any |
contracts.llm.chat.v1.ListInput
ListInput filters and pages chats.
| Member | Type | |
|---|---|---|
meta |
Record<string, any> |
|
limit |
number |
default 50 |
offset |
number |
contracts.llm.chat.v1.LlmEnrich
| Member | Type | |
|---|---|---|
buckets |
Array<string> |
|
limit |
number |
|
query |
string |
|
viewer |
LlmViewer | null |
contracts.llm.chat.v1.LlmViewer
| Member | Type | |
|---|---|---|
collection |
string |
|
id |
string |
contracts.llm.embed.v1.EmbedInput
EmbedInput is the texts.
| Member | Type | |
|---|---|---|
model |
string |
"provider/model", required |
input |
Array<string> |
|
dimensions |
number |
Dimensions shortens the vectors, for models that allow it. |
options |
Record<string, any> |
contracts.llm.embed.v1.LlmModelsInput
| Member | Type | |
|---|---|---|
provider |
string |
contracts.llm.image.v1.GenerateInput
GenerateInput is what to draw.
| Member | Type | |
|---|---|---|
model |
string |
"provider/model", required |
prompt |
string |
|
n |
number |
how many (default 1) |
size |
string |
"1024x1024" |
aspectRatio |
string |
AspectRatio is "16:9", "1:1"... for models that take one instead of a size. |
references |
Array<LlmFile> |
References are pictures the model draws from: one to change as the prompt says, or one whose style and characters a new scene keeps ("same style and characters; show them ..."). Only a model whose ModelInfo lists llm.FeatureReferenceImages takes them; any other answers not_supported or the provider's own error. |
options |
Record<string, any> |
contracts.llm.image.v1.LlmModelsInput
| Member | Type | |
|---|---|---|
provider |
string |
contracts.llm.image.v1.LlmFile
| Member | Type | |
|---|---|---|
name |
string |
|
type |
string |
|
data |
any |
|
url |
string |
contracts.llm.ledger.v1.RemainingInput
RemainingInput names the subject.
| Member | Type | |
|---|---|---|
subject |
string |
Subject is whom to answer about ("user:users/abc", "guest: |
contracts.llm.ledger.v1.SpentInput
SpentInput is a subject and a window, optionally narrowed to a kind or a model.
| Member | Type | |
|---|---|---|
subject |
string |
Subject: as for Remaining, except that empty with no caller's subject means every call (the whole app). |
window |
string |
Window is "day" or "month": the UTC calendar day or month holding now. Or give Since and Until (RFC 3339 or YYYY-MM-DD, UTC; Until is exclusive). With none of them, all of the ledger (it keeps 13 months). |
since |
string |
|
until |
string |
|
kind |
string |
|
model |
string |
contracts.llm.ledger.v1.SummaryInput
SummaryInput groups calls in a window.
| Member | Type | |
|---|---|---|
by |
string |
By is what to group by: "model" (the default), "kind", "subject" or "day". |
window |
string |
Window is "day" or "month": the UTC calendar day or month holding now. Or give Since and Until (RFC 3339 or YYYY-MM-DD, UTC; Until is exclusive). With none of them, all of the ledger (it keeps 13 months). |
since |
string |
|
until |
string |
|
subject |
string |
|
kind |
string |
|
model |
string |
|
limit |
number |
Limit is how many groups, the costliest first (by day: the latest first); default 100, at most 1000. |
contracts.llm.ledger.v1.CallsInput
CallsInput filters and pages the rows.
| Member | Type | |
|---|---|---|
window |
string |
Window is "day" or "month": the UTC calendar day or month holding now. Or give Since and Until (RFC 3339 or YYYY-MM-DD, UTC; Until is exclusive). With none of them, all of the ledger (it keeps 13 months). |
since |
string |
|
until |
string |
|
subject |
string |
|
kind |
string |
|
model |
string |
|
status |
string |
Status is "ok" for calls that reached a provider, "refused" for calls a limit refused, empty for both. |
limit |
number |
default 50, at most 500 |
offset |
number |
contracts.llm.music.v1.CreateInput
CreateInput is the music to make.
| Member | Type | |
|---|---|---|
model |
string |
"provider/model", required |
prompt |
string |
the style: "gentle lullaby, music box and soft strings" |
lyrics |
string |
|
seconds |
number |
Seconds is how long (the provider's default when 0). |
wait |
string |
Wait is how long to wait for the job, as a duration ("5m"); "" returns at once. |
options |
Record<string, any> |
contracts.llm.music.v1.LlmJobRef
| Member | Type | |
|---|---|---|
id |
string |
contracts.llm.music.v1.LlmContentInput
| Member | Type | |
|---|---|---|
id |
string |
|
index |
number |
contracts.llm.music.v1.LlmModelsInput
| Member | Type | |
|---|---|---|
provider |
string |
contracts.llm.search.v1.ModelInput
ModelInput picks the app's embedding model.
| Member | Type | |
|---|---|---|
model |
string |
contracts.llm.search.v1.Ref
Ref names a bucket.
| Member | Type | |
|---|---|---|
name |
string |
contracts.llm.search.v1.EnsureInput
EnsureInput is the bucket an app needs.
| Member | Type | |
|---|---|---|
name |
string |
|
title |
string |
|
description |
string |
|
owner |
string |
contracts.llm.search.v1.UpdateInput
UpdateInput changes a bucket.
| Member | Type | |
|---|---|---|
name |
string |
|
title |
string | null |
|
description |
string | null |
|
maxDocuments |
number | null |
|
maxBytes |
number | null |
contracts.llm.search.v1.BucketRef
BucketRef names a bucket, for operations on its sources.
| Member | Type | |
|---|---|---|
bucket |
string |
contracts.llm.search.v1.AddInput
AddInput is a file or pasted text.
| Member | Type | |
|---|---|---|
bucket |
string |
|
name |
string |
Name is the source's (and its document's) name, usually a file name ("install.md"). Its extension picks the splitter: Markdown by headings, code and the rest by blank lines. |
text |
string |
|
kind |
string |
Kind is file (the default) or text, for the dashboard. |
replace |
string |
Replace names an existing source this one replaces under the new name (a renamed new version: notes-v2.zip for notes-v1.zip). Without it, only a source of the same name is replaced. |
contracts.llm.search.v1.ExtkitRawIn
| Member | Type | |
|---|---|---|
query |
Record<string, Array<string>> |
|
body |
any |
|
contentType |
string |
|
header |
Record<string, Array<string>> |
contracts.llm.search.v1.PutInput
PutInput is one file of a dropped folder.
| Member | Type | |
|---|---|---|
bucket |
string |
|
source |
string |
the folder's name |
path |
string |
the file's path inside the folder |
text |
string |
|
replace |
string |
Replace names an existing source the folder replaces under its name (on its first file). |
contracts.llm.search.v1.PruneInput
PruneInput ends a folder upload.
| Member | Type | |
|---|---|---|
bucket |
string |
|
source |
string |
|
keep |
Array<string> |
every path the folder has now |
contracts.llm.search.v1.URLInput
URLInput is a web page or a Git repository.
| Member | Type | |
|---|---|---|
bucket |
string |
|
url |
string |
http or https |
kind |
string |
Kind is page or git; "" asks the server (DetectURL). |
every |
string |
hour, day, week; "" reads it only when added or refreshed |
commits |
number |
Commits is how many recent commits of a repository become documents (subject, body, author, date, files; no diffs): 0 is the default (300), -1 none. |
exclude |
Array<string> |
Exclude skips a repository's files whose path, or any folder in it, matches one of these patterns ("docs/old", "*.min.js"), beside what's always skipped (binaries, .git, node_modules, vendor, lockfiles). |
contracts.llm.search.v1.FolderInput
FolderInput is a folder of the app's files on the server.
| Member | Type | |
|---|---|---|
bucket |
string |
|
path |
string |
Path is the folder, relative to the app's own folder (the one holding pb_data, pb_pages and pb_public); it can't leave that folder or be pb_data. "pb_pages/docs", say. |
include |
Array<string> |
Include keeps only files matching one of these patterns (against the file name or its path in the folder: "*.md"); none keeps every text file. Exclude leaves out matches, beside what's always skipped (dot folders and dotfiles, node_modules, vendor, lockfiles, binaries). |
exclude |
Array<string> |
|
url |
string |
URL is where each file is published, with {path} for the file's path in the folder without its extension (an index file is its folder): "/docs/{path}" makes guides/install.md /docs/guides/install and guides/index.md /docs/guides. Results from Markdown files add their section's anchor (#heading-id). "" gives no links. |
contracts.llm.search.v1.URLRef
URLRef is a URL.
| Member | Type | |
|---|---|---|
url |
string |
contracts.llm.search.v1.FollowInput
FollowInput is a collection.
| Member | Type | |
|---|---|---|
bucket |
string |
|
collection |
string |
|
fields |
Array<string> |
Fields are searched; the first is each record's title. |
filter |
string |
a PocketBase filter, e.g. "published = true" |
contracts.llm.search.v1.SourceRef
SourceRef names a source.
| Member | Type | |
|---|---|---|
bucket |
string |
|
source |
string |
contracts.llm.search.v1.RemoveInput
RemoveInput names sources.
| Member | Type | |
|---|---|---|
bucket |
string |
|
sources |
Array<string> |
contracts.llm.search.v1.DocumentsInput
DocumentsInput picks a bucket's documents.
| Member | Type | |
|---|---|---|
bucket |
string |
|
source |
string |
only this source's |
prefix |
string |
only names starting with it |
contracts.llm.search.v1.SearchInput
SearchInput is a query.
| Member | Type | |
|---|---|---|
buckets |
Array<string> |
Buckets are searched together; none searches every bucket. Bucket is one more, for a single-bucket search. |
bucket |
string |
|
query |
string |
|
limit |
number |
default 5, at most 50 |
prefix |
string |
Prefix keeps matches from documents whose name starts with it. |
viewer |
Viewer | null |
contracts.llm.search.v1.SampleInput
SampleInput is where to draw random chunks from.
| Member | Type | |
|---|---|---|
buckets |
Array<string> |
Buckets are drawn from together; none draws from every bucket. Bucket is one more. |
bucket |
string |
|
count |
number |
default 5, at most 50 |
prefix |
string |
Prefix keeps chunks from documents whose name starts with it. |
contracts.llm.search.v1.Viewer
Viewer is who a search is for. Matches from records they can't view (the collection's view rule, as PocketBase checks it) are left out; documents that aren't records are for everyone. A search without one sees everything.
| Member | Type | |
|---|---|---|
collection |
string |
Collection and ID are the signed-in auth record; both empty is a guest (signed out). |
id |
string |
contracts.llm.speech.v1.SpeakInput
SpeakInput is what to say and how.
| Member | Type | |
|---|---|---|
model |
string |
"provider/model", required |
text |
string |
|
voice |
string |
|
format |
string |
Format is the audio format: mp3 (default), wav, opus, flac, pcm, as the provider allows. |
speed |
number |
|
instructions |
string |
Instructions describe the delivery ("slow and calm, a bedtime voice"), for models that take them. Not with a Reference: a cloned voice takes its delivery from the clip. |
reference |
VoiceReference | null |
Reference clones a voice: the model reads Text in the voice of this clip. Leave Voice empty (or the model's clone voice, Voices' Mode "clone"). Models that clone list a voice with that mode; a provider that doesn't clone refuses the call with llm.ErrNotSupported. Nothing is saved at the provider: send the clip with every call. |
options |
Record<string, any> |
contracts.llm.speech.v1.VoicesInput
VoicesInput names the model whose voices to list.
| Member | Type | |
|---|---|---|
model |
string |
"provider/model", required |
contracts.llm.speech.v1.LlmModelsInput
| Member | Type | |
|---|---|---|
provider |
string |
contracts.llm.speech.v1.VoiceReference
VoiceReference is a clip of the voice to imitate.
| Member | Type | |
|---|---|---|
audio |
LlmFile |
Audio is the clip, with its data: a short, clean recording (10 to 30 seconds) read the way the model should speak. Its Name's extension (me.wav) or Type tells the provider the format. |
text |
string |
Text is what the clip says, word for word. Optional, but most models match the voice more closely with it. |
contracts.llm.speech.v1.LlmFile
| Member | Type | |
|---|---|---|
name |
string |
|
type |
string |
|
data |
any |
|
url |
string |
contracts.llm.text.v1.CompleteInput
CompleteInput is a prompt: Prompt, or Messages for a conversation (Prompt is then added as the last user message).
| Member | Type | |
|---|---|---|
model |
string |
Model is "provider/model" (required). |
system |
string |
|
prompt |
string |
|
messages |
Array<Message> |
|
schema |
any |
Schema, when set, is a JSON schema the answer must match; the result's Data is then the parsed answer. |
maxTokens |
number |
MaxTokens caps the answer's length, thinking included (0: the provider's default). |
temperature |
number | null |
nil: the provider's default |
stop |
Array<string> |
|
reasoning |
string |
Reasoning is how much a reasoning model thinks first: "" (its default), "off", "low" or "high". A model that doesn't reason ignores it. |
options |
Record<string, any> |
|
enrich |
LlmEnrich | null |
Enrich adds the best passages from the app's search buckets after the prompt (search/v1). |
contracts.llm.text.v1.CountInput
CountInput is a text, or a conversation as a call would send it.
| Member | Type | |
|---|---|---|
model |
string |
optional: the count is an estimate either way |
text |
string |
|
system |
string |
|
messages |
Array<Message> |
contracts.llm.text.v1.LlmModelsInput
| Member | Type | |
|---|---|---|
provider |
string |
contracts.llm.text.v1.Message
Message is one turn of a conversation.
| Member | Type | |
|---|---|---|
role |
string |
system, user or assistant |
content |
string |
contracts.llm.text.v1.LlmEnrich
| Member | Type | |
|---|---|---|
buckets |
Array<string> |
|
limit |
number |
|
query |
string |
|
viewer |
LlmViewer | null |
contracts.llm.text.v1.LlmViewer
| Member | Type | |
|---|---|---|
collection |
string |
|
id |
string |
contracts.llm.transcribe.v1.TranscribeInput
TranscribeInput is the audio, with hints.
| Member | Type | |
|---|---|---|
model |
string |
"provider/model", required |
audio |
LlmFile |
its Name's extension (story.mp3) or Type tells the provider the format |
language |
string |
Language is the spoken language as an ISO code ("en"), when known; empty lets the model tell. |
prompt |
string |
Prompt is text that helps the model (names, words it might not know), for models that take one. |
options |
Record<string, any> |
contracts.llm.transcribe.v1.LlmModelsInput
| Member | Type | |
|---|---|---|
provider |
string |
contracts.llm.transcribe.v1.LlmFile
| Member | Type | |
|---|---|---|
name |
string |
|
type |
string |
|
data |
any |
|
url |
string |
contracts.llm.video.v1.CreateInput
CreateInput is the video to make.
| Member | Type | |
|---|---|---|
model |
string |
"provider/model", required |
prompt |
string |
|
image |
LlmFile | null |
Image is a first frame to start from, for models that take one. |
seconds |
number |
|
size |
string |
"1280x720" |
aspectRatio |
string |
AspectRatio is "16:9", "9:16"... for models that take one instead of a size. |
wait |
string |
Wait is how long to wait for the job, as a duration ("10m"); "" returns at once. |
options |
Record<string, any> |
contracts.llm.video.v1.LlmJobRef
| Member | Type | |
|---|---|---|
id |
string |
contracts.llm.video.v1.LlmContentInput
| Member | Type | |
|---|---|---|
id |
string |
|
index |
number |
contracts.llm.video.v1.LlmModelsInput
| Member | Type | |
|---|---|---|
provider |
string |
contracts.llm.video.v1.LlmFile
| Member | Type | |
|---|---|---|
name |
string |
|
type |
string |
|
data |
any |
|
url |
string |
contracts.mail.fallback.v1.Sender
Sender delivers an app's mail when its SMTP is off.
What e.provide("mail.fallback/v1", impl) takes in pb_hooks: methods may be async; throw ContractError to fail.
| Member | Type | |
|---|---|---|
send() |
(m: MailerMessage): void | Promise<void> |
Send delivers m, or returns ErrPass to leave it to the next provider. |
contracts.mail.fallback.v1.MailerMessage
| Member | Type | |
|---|---|---|
from |
MailAddress |
|
to |
Array<MailAddress> |
|
bcc |
Array<MailAddress> |
|
cc |
Array<MailAddress> |
|
subject |
string |
|
html |
string |
|
text |
string |
|
headers |
Record<string, string> |
|
attachments |
Record<string, any> |
|
inlineAttachments |
Record<string, any> |
contracts.mail.fallback.v1.MailAddress
| Member | Type | |
|---|---|---|
Name |
string |
|
Address |
string |
contracts.Providers
contracts.mail.feedback.v1.ExtkitRawIn
| Member | Type | |
|---|---|---|
query |
Record<string, Array<string>> |
|
body |
any |
|
contentType |
string |
|
header |
Record<string, Array<string>> |
contracts.mail.suppression.v1.Address
Address is one email address.
| Member | Type | |
|---|---|---|
email |
string |
contracts.mail.suppression.v1.SuppressInput
SuppressInput suppresses an address.
| Member | Type | |
|---|---|---|
email |
string |
|
reason |
string |
Unsubscribed, Bounced, Complained or Manual |
source |
string |
where it came from: link, one-click, ses, webhook, ... |
campaign |
string |
the campaign that caused it, if any |
contracts.mail.suppression.v1.Link
Link is an unsubscribe link's signed token (?t=).
| Member | Type | |
|---|---|---|
t |
string |
contracts.mail.suppression.v1.ExtkitRawIn
| Member | Type | |
|---|---|---|
query |
Record<string, Array<string>> |
|
body |
any |
|
contentType |
string |
|
header |
Record<string, Array<string>> |
contracts.remote.v1.LogsInput
LogsInput picks how much history a log stream starts with.
| Member | Type | |
|---|---|---|
n |
number |
entries to replay first (default 100, at most 1000) |
contracts.restore.v1.RestoreInput
RestoreInput is the moment to restore to.
| Member | Type | |
|---|---|---|
at |
any |
contracts.settings.v1.Ref
Ref names an extension.
| Member | Type | |
|---|---|---|
extension |
string |
contracts.settings.v1.Change
Change is settings to save or test.
| Member | Type | |
|---|---|---|
extension |
string |
|
values |
any |
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.