Documentation
¶
Overview ¶
Package nlm is the typed NotebookLM domain client. It builds positional payloads, sends them through a transport.Transport and decodes results into Go types. Payload builders are package-level functions so live captures can pin their shapes in one place.
Index ¶
- Constants
- Variables
- func ValidateStudioRequest(r StudioRequest) error
- type AddOutcome
- type Answer
- type Artifact
- type ArtifactContent
- type ArtifactStatus
- type AskOptions
- type Candidate
- type ChatConfig
- type Client
- func (c *Client) AddSources(ctx context.Context, nb string, specs []SourceSpec) ([]AddOutcome, error)
- func (c *Client) Ask(ctx context.Context, nb, question string, o AskOptions, ...) (Answer, error)
- func (c *Client) CanGenerate(ctx context.Context) (bool, Quota, error)
- func (c *Client) CancelChat(ctx context.Context, conv string) error
- func (c *Client) CancelResearch(ctx context.Context, runID string) error
- func (c *Client) ChatSessions(ctx context.Context, nb string) ([]Conversation, error)
- func (c *Client) Configure(ctx context.Context, nb string, cfg ChatConfig) error
- func (c *Client) CreateNotebook(ctx context.Context, title, emoji string) (Notebook, error)
- func (c *Client) Delete(ctx context.Context, kind string, nb string, ids []string) ([]DeleteResult, error)
- func (c *Client) Generate(ctx context.Context, nb string, r StudioRequest) (Artifact, error)
- func (c *Client) GetArtifact(ctx context.Context, id string) (ArtifactContent, error)
- func (c *Client) GetNotebook(ctx context.Context, id string) (NotebookDetail, error)
- func (c *Client) GetShare(ctx context.Context, nb string) (ShareStatus, error)
- func (c *Client) History(ctx context.Context, nb, conv string, limit int, cursor string) ([]Turn, string, error)
- func (c *Client) ImportResearch(ctx context.Context, nb, jobID string, picks []Candidate) ([]AddOutcome, error)
- func (c *Client) Labels(ctx context.Context, nb string) ([]Label, error)
- func (c *Client) ListArtifacts(ctx context.Context, nb string) ([]Artifact, error)
- func (c *Client) ListNotebooks(ctx context.Context) ([]Notebook, error)
- func (c *Client) ListNotes(ctx context.Context, nb string) ([]Note, error)
- func (c *Client) ListSources(ctx context.Context, nb string) ([]Source, error)
- func (c *Client) MutateLabels(ctx context.Context, nb string, muts []LabelMutation) error
- func (c *Client) PollResearch(ctx context.Context, nb string) ([]ResearchJob, error)
- func (c *Client) Quota(ctx context.Context) (Quota, error)
- func (c *Client) RefreshSource(ctx context.Context, nb, sid string) error
- func (c *Client) RemoveFromRecent(ctx context.Context, id string) error
- func (c *Client) RenameNotebook(ctx context.Context, id, title string) error
- func (c *Client) RenameSource(ctx context.Context, nb, sid, title string) error
- func (c *Client) SaveAnswerNote(ctx context.Context, nb string, a Answer, title string) (Note, error)
- func (c *Client) SaveNote(ctx context.Context, nb string, n NoteInput) (Note, error)
- func (c *Client) SetLanguage(ctx context.Context, lang string) error
- func (c *Client) SourceFresh(ctx context.Context, nb, sid string) (bool, error)
- func (c *Client) SourceGuide(ctx context.Context, nb, sid string) (summary string, keywords []string, err error)
- func (c *Client) SourceText(ctx context.Context, nb, sid string, markdown bool) (string, error)
- func (c *Client) StartResearch(ctx context.Context, nb, query, mode, corpus string) (ResearchJob, error)
- func (c *Client) Suggest(ctx context.Context, nb, surface string, sources []string, query string) ([]Suggestion, error)
- func (c *Client) UpdateShare(ctx context.Context, nb string, u ShareUpdate) ([]SharePart, error)
- type Conversation
- type DOMFallback
- type DeleteResult
- type DriveSpec
- type Label
- type LabelMutation
- type Note
- type NoteInput
- type Notebook
- type NotebookDetail
- type Quota
- type QuotaWindow
- type ResearchJob
- type ResearchStatus
- type ShareChange
- type SharePart
- type ShareStatus
- type ShareUpdate
- type ShareUser
- type Source
- type SourceSpec
- type SourceStatus
- type Streamer
- type StudioKind
- type StudioOption
- type StudioRequest
- type Suggestion
- type TextSpec
- type Turn
Constants ¶
const ( ModeDiscover = "discover" ModeFast = "fast" ModeDeep = "deep" )
Research modes accepted by StartResearch.
const ( CorpusWeb = "web" CorpusDrive = "drive" )
Research corpora accepted by StartResearch.
const ( CandWeb = "web" CandDrive = "drive" CandReport = "report" )
Candidate kinds accepted by ImportResearch.
const ( AddAdded = "added" AddPending = "pending" AddFailed = "failed" )
Add outcome statuses.
const AddSkipped = "skipped"
AddSkipped is the ImportResearch outcome for a pick that was not sent because the notebook already holds it.
const ChatSessionsPage = 20
ChatSessionsPage is how many conversations ChatSessions asks for, as the web app did (live 2026-10-13). hPTbtc paging is not pinned by a capture, so older conversations are not listed.
const DOMTransport = "browser-dom"
DOMTransport is the transport name OnTransport reports for the DOM fallback.
Variables ¶
var ( // ChatGoals and ChatLengths list the proven values, for tool schemas. ChatGoals = []string{"default", "learning_guide", "custom"} ChatLengths = []string{"default", "longer", "shorter"} )
Chat-settings wire values pinned by live captures #3 (s0tc2d live3_02..04: goal learning_guide 3, custom 2 with its prompt; length shorter 5, longer 4) and #3b (live3b_01, _02: goal default 1, length default sent as an empty list).
var StudioLanguages = []string{"en", "en_in"}
StudioLanguages are the output language codes a capture has sent: en (every kind) and en_in (video, capture #3). Any other code is refused with KindUnsupported naming the option.
Functions ¶
func ValidateStudioRequest ¶ added in v0.2.0
func ValidateStudioRequest(r StudioRequest) error
ValidateStudioRequest reports whether Generate would refuse r before any call (kind, options, free text); sources are not checked.
Types ¶
type AddOutcome ¶
type AddOutcome struct {
Index int
SourceID string
Status string // added|pending|failed
Error string
}
AddOutcome is the per-spec result of AddSources; Index is the position in the specs slice.
type Answer ¶
type Answer struct {
Text string `json:"text"`
Citations []wire.Citation `json:"citations,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
ResponseID string `json:"response_id,omitempty"`
// contains filtered or unexported fields
}
Answer is the final state of a streamed answer.
type Artifact ¶
type Artifact struct {
ID string `json:"id"`
Title string `json:"title"`
Kind StudioKind `json:"kind"`
Status ArtifactStatus `json:"status"`
MediaURLs map[string]string `json:"media_urls,omitempty"`
Created time.Time `json:"created,omitzero"`
}
Artifact is one Studio artifact in a notebook listing.
type ArtifactContent ¶
type ArtifactContent struct {
HTML string `json:"html,omitempty"` // [0][9][0]
Tree jsontext.Value `json:"tree,omitempty"` // mind-map tree, [0][9][3]
}
ArtifactContent is the interactive content of one artifact (v9rmvd).
type ArtifactStatus ¶
type ArtifactStatus string
ArtifactStatus is the generation state of an artifact.
const ( ArtifactPending ArtifactStatus = "pending" // status 1, 2 or unknown ArtifactReady ArtifactStatus = "ready" // status 3 ArtifactFailed ArtifactStatus = "failed" // status 4 )
type AskOptions ¶
type AskOptions struct {
SourceIDs []string
ConversationID string
NewConversation bool
// KeepAnswerBlock keeps the stream's final answer block on the Answer,
// which SaveAnswerNote needs. Off for plain asks: the copy is the size
// of the rich answer.
KeepAnswerBlock bool
}
AskOptions narrows a question. Empty SourceIDs means every source of the notebook (sent as explicit ids, never an empty list). Without ConversationID the question goes to the notebook's default thread; NewConversation starts a fresh one instead.
type Candidate ¶
type Candidate struct {
Kind string `json:"kind"` // web|drive|report
URL string `json:"url,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
DriveID string `json:"drive_id,omitempty"`
MIME string `json:"mime,omitempty"`
Report string `json:"report,omitempty"` // markdown, kind report only
}
Candidate is one research result, or one pick to import.
type ChatConfig ¶
type ChatConfig struct {
Goal string `json:"goal,omitempty"`
Prompt string `json:"prompt,omitempty"`
Length string `json:"length,omitempty"`
}
ChatConfig is a partial chat-settings change. Empty fields keep the current server value.
Goal: "default", "custom" (needs Prompt) or "learning_guide". Length: "default", "longer" or "shorter".
type Client ¶
type Client struct {
// OnTransport, when set, receives the name of the transport that served each call.
OnTransport func(name string)
// DOM, when set, answers chat and adds URL and text sources by driving
// the NotebookLM page after the RPC path failed with KindDrift (see Ask
// and AddSources). nil = off.
DOM DOMFallback
// contains filtered or unexported fields
}
Client talks to NotebookLM through one transport (usually a Router).
func (*Client) AddSources ¶
func (c *Client) AddSources(ctx context.Context, nb string, specs []SourceSpec) ([]AddOutcome, error)
AddSources adds URL, YouTube and text sources in one izAoDd call. The call is never resent. If the server answers code 3 or 9 (accepted, maybe applied) the notebook is listed and specs are matched by URL or title: matched ones report added, the rest pending. A spec absent from a successful response is looked up in the notebook (reconcileOmitted). Drive specs return KindUnsupported before any call. With c.DOM set, a KindDrift that happened before the request was sent adds the specs through the page instead (addSourcesDOM).
func (*Client) Ask ¶
func (c *Client) Ask(ctx context.Context, nb, question string, o AskOptions, progress func(text string)) (Answer, error)
Ask streams one question and returns the final answer. progress (may be nil) receives the latest answer text at most once per second; thinking chunks are never reported.
The conversation id is never taken from the stream: live captures show the stream carries a per-stream session id, and replaying it creates a ghost turn. Without an explicit id the notebook's default thread is read from hPTbtc (newest first); when there is none yet, or NewConversation is set, the question is sent with a null id and the thread is read back from hPTbtc afterwards. Null-id asks hold a per-notebook lock from send through read-back so concurrent ones cannot read each other's thread.
With c.DOM set, a KindDrift stream is asked again on the page (see domAskAllowed); the answer then has text only and OnTransport gets DOMTransport.
seq is always 1. Ruling: the live capture (first ask) sent 1; counting turns would cost a khqZz round trip per question and its turn layout is not live-verified. Revisit if a multi-turn capture shows the server rejects or mis-threads seq 1.
func (*Client) CanGenerate ¶
CanGenerate is the quota pre-flight: false when any quota window has nothing left. The quota summary is returned either way.
func (*Client) CancelChat ¶
CancelChat stops a running chat generation (XgrPMd).
func (*Client) CancelResearch ¶
CancelResearch cancels a run (Zbrupe; answers `[]`). Cancelling twice is harmless, so the call may be retried.
func (*Client) ChatSessions ¶
ChatSessions lists the notebook's newest ChatSessionsPage conversations (hPTbtc), newest first.
func (*Client) Configure ¶
Configure changes chat settings (s0tc2d slot 7). It reads the current settings from rLM1Ne row [7] first (the s0tc2d answer echoes them at the same project-row slot) and merges the partial change; both the goal and the length are always sent, as the web app does.
func (*Client) CreateNotebook ¶
CreateNotebook creates a notebook (CCqFvf, never retried). The request is sent with an empty title, exactly as the web app does; a non-empty title is then applied with RenameNotebook. If that rename fails, the returned Notebook still carries the new id so the caller can report it.
emoji is accepted but not sent: neither the live create request nor the consensus s0tc2d rename defines an emoji slot (only the TMC proto does), so it is ignored.
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, kind string, nb string, ids []string) ([]DeleteResult, error)
Delete removes items of one kind. It is a plain domain call: preview and confirmation belong to the MCP layer. Kinds:
notebook ids are notebook ids; nb is ignored (WWINqb) source source ids of notebook nb (tGMBJ) note note ids of notebook nb (AH0mwd) chat_history conversation ids of notebook nb; deletes the whole thread history (J7Gthc)
"artifact" (V5N4be) has conflicting catalog shapes and returns KindUnsupported until a live capture pins it.
Duplicate ids are dropped. Every remaining id is tried even after a failure, so the result lists one outcome per id; the returned error is only for invalid input or a blocked kind (then nothing is sent). Calls are never retried.
func (*Client) Generate ¶
Generate starts one Studio artifact (R7cb6c, never retried) and returns it as pending; poll ListArtifacts for its status. Every kind in studioSpecs is supported with the option values a live capture has proven; other values are refused before any call (see studioParams). Empty SourceIDs means every source of the notebook; notes are never sent as sources (the web app can add them; that is not captured for sourcebolt).
func (*Client) GetArtifact ¶
GetArtifact reads an artifact's interactive content (v9rmvd). The request is live-verified; HTML at [0][9][0] and the mind-map tree at [0][9][3] are catalog consensus (the captured row was still generating and had "" at [0][9][0]).
func (*Client) GetNotebook ¶
GetNotebook reads a notebook with its sources (rLM1Ne) and, in parallel, its summary and suggested questions (VfAZjd). A failing guide degrades to an empty summary with a warning; a failing main read fails the call.
func (*Client) GetShare ¶
GetShare reads who a notebook is shared with and whether the link is public (JFMDGd). Response: [[ [email,perm,[],[name,avatar]]..], [isPublic], maxShare, allowed, ...]. Live capture showed null (not [false]) at [1] for a private notebook.
func (*Client) History ¶
func (c *Client) History(ctx context.Context, nb, conv string, limit int, cursor string) ([]Turn, string, error)
History reads one page of a conversation (khqZz). The server sends turns newest first; they are returned oldest first. The returned cursor is "" on the last page; pass it back to read the next (older) page.
shape: turn layout is catalog consensus, not live-verified (the live capture was an empty notebook): t[1] [s,ns], t[2] 1 user / 2 assistant, user text t[3], assistant text t[4][0][0]; payload[1] is the next cursor.
func (*Client) ImportResearch ¶
func (c *Client) ImportResearch(ctx context.Context, nb, jobID string, picks []Candidate) ([]AddOutcome, error)
ImportResearch imports picks into the notebook (LBwxtb). Picks already in the notebook are skipped and reported as AddSkipped, so repeating a partly-applied import is safe: web picks match source URLs (trailing slash ignored), Drive and report picks match source titles. The LBwxtb call itself is sent at most once and never retried. Outcome Index is the position in picks.
func (*Client) Labels ¶
Labels lists a notebook's labels (I3xc3c). Rows: [name,[[sid]..],label_id,emoji]. A notebook without labels answers `[]`.
func (*Client) ListArtifacts ¶
ListArtifacts lists a notebook's Studio artifacts (gArtLc). Only the consensus row fields are decoded: id [0], title [1], type [2], status [4] (3 ready, 4 failed, 5 suggested) and created [15][0]. Suggested rows are dropped.
TODO(rpc-catalog §10 item 29): MediaURLs stays empty. The media positions conflict between upstreams (video [8][3] vs [8][4], slides PDF/PPTX, report, data table) and need a live capture per type before they are pinned.
func (*Client) ListNotebooks ¶
ListNotebooks returns the account's notebooks (wXbhsf).
func (*Client) ListNotes ¶
ListNotes lists a notebook's notes (cFji9). Rows are [id,[id,content,meta,null,title]]; deleted notes stay as tombstones [id,null,2] and are filtered out. The Updated time is read best-effort from meta[2] as [seconds,nanos] and may be zero (live-unverified).
func (*Client) ListSources ¶
ListSources lists a notebook's sources via GetNotebook.
func (*Client) MutateLabels ¶
MutateLabels applies label edits (le8sX; catalog consensus, not live-verified). The server honors only the first id per call, so every source id goes out in its own call: rename/emoji first, then additions, then removals. All mutations are validated before the first call. Calls are not retried.
func (*Client) PollResearch ¶
PollResearch lists the notebook's research runs (e3bVqc). An idle notebook answers `[]` (live). Row layout (catalog, not live-verified for a non-empty answer): [task_id, info, updated, created, account] with info [null,[query,type],mode,[[sources],summary],status,deep?]. Mode code 5 is deep, else fast. Source rows are [url,title,description]; rows with a null url are deep-report rows. The summary becomes Report.
func (*Client) Quota ¶
Quota reads the quota summary (EylDcb). Windows are at [1]; per window [4] type, [5] reset [s,ns], [6] percent used (null when unused), [7] percent left. Whichever of used/left is missing is derived from the other. The per-action cost table at [3] is not decoded.
func (*Client) RefreshSource ¶
RefreshSource is blocked: FLmJqe and dtT1F have conflicting request shapes and no live capture (rpc-catalog §10 item 9).
func (*Client) RemoveFromRecent ¶
RemoveFromRecent drops a notebook from the recently viewed list (fejl7e). The server may answer gRPC INTERNAL (code 13) even on success, so only that code is treated as success (rpc-catalog, TL). Other KindInternal errors, such as HTTP 4xx answers, surface.
func (*Client) RenameNotebook ¶
RenameNotebook sets a notebook's title (s0tc2d) and reads it back; a title that did not stick is a KindInternal error. The mutation is never retried.
func (*Client) RenameSource ¶
RenameSource sets a source's title.
shape: catalog consensus, not live-verified: [null,[sid],[[[title]]]].
func (*Client) SaveAnswerNote ¶ added in v0.2.0
func (c *Client) SaveAnswerNote(ctx context.Context, nb string, a Answer, title string) (Note, error)
SaveAnswerNote saves a streamed chat answer as a note (CYK0Xb, never retried), as the web app's "Save to note" does: kind 2 with the answer's passages and rich block. Only an answer from a complete stream can be saved (see answerNoteParams). The server sets its own title and returns the note row [[id, content, meta, passages, title, rich]].
func (*Client) SaveNote ¶
SaveNote creates a note (empty ID: one CYK0Xb call with title and content, answered by the new note row [[id, content, meta, null, title]]) or rewrites an existing one (cYAfTb). Neither call is retried: a resent create would leave a second note.
func (*Client) SetLanguage ¶
SetLanguage sets the output language (hT54vc). shape: the envelope is live-verified; the language slot `[lang]` at the entry's index 4 is rpc-catalog (TL) only. The live capture sent a different setting there ([null,null,null,[[2,2]]]), so the language slot is not live-verified.
func (*Client) SourceFresh ¶
SourceFresh reports whether a source is up to date.
shape: catalog consensus, not live-verified: [null,[sid],[2]]. A URL source answers [] when fresh; a Drive source answers [[null,bool,[id]]] where the bool is read as "fresh" (assumption, same catalog row).
func (*Client) SourceGuide ¶
func (c *Client) SourceGuide(ctx context.Context, nb, sid string) (summary string, keywords []string, err error)
SourceGuide reads a source's guide (tr032e): a summary and its keywords. Response (live #2): [[[[[sid]], [summary], [[keyword..]], []]]], so the summary is at [0][0][1][0] and the keywords at [0][0][2][0]. A response without a summary is KindDrift.
func (*Client) SourceText ¶
SourceText returns a source's full extracted text (markdown selects the markdown variant). Paging is the caller's concern.
Request: see sourceLoadParams (mode 2 pinned by live capture #2 (2026-10-20, hizoJc); mode 3 catalog-only). Response: [0]=[[sid],title,meta], text blocks at [3][0][0] (live #2; the catalog said [3][0]), HTML at [4][1] (catalog only). Each block's leaf strings are joined, blocks are separated by a newline; when there are no blocks the HTML string is returned instead; neither is KindDrift.
func (*Client) StartResearch ¶
func (c *Client) StartResearch(ctx context.Context, nb, query, mode, corpus string) (ResearchJob, error)
StartResearch starts a research run. mode is "fast" or "deep"; "discover" (Es3dTe) returns KindUnsupported because its request shape is conflicting in the catalog and has no live capture (item 14). corpus is "web" (default) or "drive"; deep research is web only. The call is never retried. The returned job carries the raw ids; its candidates arrive via PollResearch.
func (*Client) Suggest ¶
func (c *Client) Suggest(ctx context.Context, nb, surface string, sources []string, query string) ([]Suggestion, error)
Suggest returns suggestions for one surface: "chat" (otmP3b), "report" (ciyUvf) or "studio_options" (sqTeoe; ignores sources and query). "followups" (OcvKNc) is blocked: single-source in the catalog, no live capture.
func (*Client) UpdateShare ¶
UpdateShare changes link visibility and/or per-user permissions (QDyure). The payload shapes are catalog consensus and not live-verified. Never retried: a replayed share could notify people twice.
The link and the users go out as two calls, so one can apply while the other fails. Both are always tried and the result has one outcome per part sent (link first); the returned error is only for invalid input, and then nothing is sent.
type Conversation ¶
type Conversation struct {
ID string `json:"id"`
Created time.Time `json:"created,omitzero"`
Updated time.Time `json:"updated,omitzero"`
}
Conversation is one server-side chat thread of a notebook (hPTbtc row).
type DOMFallback ¶
type DOMFallback interface {
Ask(ctx context.Context, nb, question string, progress func(string)) (string, error)
AddURL(ctx context.Context, nb, url string) error
AddText(ctx context.Context, nb, title, content string) error
}
DOMFallback drives the NotebookLM web UI (browser.DOM). It can only ask in the notebook's default thread about all sources, and only add URL and pasted-text sources.
type DeleteResult ¶
type DeleteResult struct {
ID string
Status string // deleted | failed | unsupported
Err error // set unless Status is "deleted"
}
DeleteResult is the outcome of deleting one id.
type DriveSpec ¶
type DriveSpec struct{ DocumentID, MIME, Title string }
DriveSpec is a Google Drive document. AddSources rejects it until the request tail is live-captured (rpc-catalog: izAoDd Drive tail conflicting).
type Label ¶
type Label struct {
ID string `json:"id"`
Name string `json:"name"`
Emoji string `json:"emoji,omitempty"`
SourceIDs []string `json:"source_ids"`
}
Label is one source label of a notebook.
type LabelMutation ¶
type LabelMutation struct {
ID string
Name string
Emoji string
AddSources []string
RemoveSources []string
}
LabelMutation edits one label. Empty fields are left unchanged.
type Note ¶
type Note struct {
ID string `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Updated time.Time `json:"updated,omitzero"`
}
Note is one saved note of a notebook.
type NoteInput ¶
type NoteInput struct {
ID, Title, Content string
}
NoteInput creates a note (empty ID) or rewrites one (set ID).
type Notebook ¶
type Notebook struct {
ID string `json:"id"`
Title string `json:"title"`
Emoji string `json:"emoji,omitempty"`
SourceCount int `json:"source_count"`
Owned bool `json:"owned"`
Created time.Time `json:"created,omitzero"`
Modified time.Time `json:"modified,omitzero"`
}
Notebook is one row of the notebook list.
type NotebookDetail ¶
type NotebookDetail struct {
Notebook
Sources []Source `json:"sources"`
Summary string `json:"summary,omitempty"`
Suggested []string `json:"suggested_questions,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
NotebookDetail is the composite read behind notebook_open.
type Quota ¶
type Quota struct {
Windows []QuotaWindow `json:"windows"`
}
Quota is the account's quota summary (EylDcb).
type QuotaWindow ¶
type QuotaWindow struct {
Type string `json:"type"` // "5h", "weekly" or "type-N"
ResetAt time.Time `json:"reset_at,omitzero"`
UsedPct float64 `json:"used_pct"`
LeftPct float64 `json:"left_pct"`
}
QuotaWindow is one usage window of the account's quota summary.
type ResearchJob ¶
type ResearchJob struct {
ID string `json:"id"`
AltID string `json:"alt_id,omitempty"`
Mode string `json:"mode"`
ModeCode int `json:"mode_code,omitempty"`
Query string `json:"query,omitempty"`
Status ResearchStatus `json:"status"`
Candidates []Candidate `json:"candidates,omitempty"`
Report string `json:"report,omitempty"`
}
ResearchJob is one research run.
ID is the task id: for fast research the Ljjv0c answer; for deep research the first element of the QA9ei answer. AltID is the second QA9ei element. The catalog is conflicting on which of the two is the task id and which is the report/conversation id (item 15), so both are returned raw and the job is found in the poll list (PollResearch) by query.
func (ResearchJob) CandidatesByURL ¶
func (j ResearchJob) CandidatesByURL(urls []string) (picks []Candidate, missing []string)
CandidatesByURL picks the job's web candidates by URL, in the order of urls (trailing slash ignored, duplicates dropped). Poll rows carry no result id and their order can change between polls, so the URL is the only stable handle. missing lists the urls with no candidate.
type ResearchStatus ¶
type ResearchStatus int
ResearchStatus is the raw status int at info[4] of a poll row.
RULING: the catalog is conflicting (teng-lin: 1 running / 2 done / 3 no results / 4 cancelled; JB, ARL, MOOD: 2 or 6 = done). The raw value is kept and Done() treats both 2 and 6 as done. The remaining values need a live capture of a non-empty e3bVqc answer (catalog open item 16).
func (ResearchStatus) Done ¶
func (s ResearchStatus) Done() bool
Done reports whether the run finished (2 or 6).
type ShareChange ¶
type ShareChange struct {
}
ShareChange is one per-user change. Role is "editor", "viewer" or "remove".
type ShareStatus ¶
type ShareStatus struct {
}
ShareStatus is the sharing state of one notebook (JFMDGd).
type ShareUpdate ¶
type ShareUpdate struct {
}
ShareUpdate is a sharing change. Public is nil for "leave as is". Users and the link setting go out as two separate QDyure calls.
type ShareUser ¶
type ShareUser struct {
}
ShareUser is one collaborator row of a notebook's sharing state.
type Source ¶
type Source struct {
ID string `json:"id"`
Title string `json:"title"`
Type string `json:"type,omitempty"`
Status SourceStatus `json:"status"`
}
Source is one source inside a notebook.
type SourceSpec ¶
type SourceSpec struct {
URL string // web page or YouTube video (auto-detected)
Text *TextSpec
Drive *DriveSpec
}
SourceSpec describes one source to add. Exactly one field is set.
type SourceStatus ¶
type SourceStatus int
SourceStatus is the raw processing status at source[3][1]. Its value mapping is pinned by live capture (rpc-catalog §10).
type Streamer ¶
type Streamer interface {
Stream(ctx context.Context, nb string, params any, onSnap func(wire.Snapshot)) (wire.Snapshot, error)
}
Streamer is implemented by transports that can stream a chat answer (rpc.Transport). Ask finds it with a type assertion on the Client's transport; a transport without it gets KindUnsupported, so a Router that wraps several transports must implement Stream itself to offer chat.
type StudioKind ¶
type StudioKind string
StudioKind names a Studio artifact kind.
const ( StudioAudio StudioKind = "audio" // type code 1 StudioReport StudioKind = "report" // type code 2 StudioVideo StudioKind = "video" // type code 3 StudioQuiz StudioKind = "quiz" // type code 4 (shared) StudioFlashcards StudioKind = "flashcards" // type code 4 (shared) StudioMindMap StudioKind = "mind_map" // type code 4 (shared, interactive) StudioInfographic StudioKind = "infographic" // type code 7 StudioSlides StudioKind = "slide_deck" // type code 8 StudioDataTable StudioKind = "data_table" // type code 9 StudioInteractiveReport StudioKind = "interactive_report" // type code 11 // StudioInteractive is what a listing row of type code 4 decodes to // when its variant ([9][1][0]) is not one of the live-verified ones: // 1 flashcards, 2 quiz, 4 mind map (live captures #2 and #3). StudioInteractive StudioKind = "interactive" // StudioUnknown is an unmapped type code. StudioUnknown StudioKind = "unknown" )
func GeneratableKinds ¶ added in v0.2.0
func GeneratableKinds() []StudioKind
GeneratableKinds lists the kinds Generate supports, sorted.
func KindFromTypeCode ¶
func KindFromTypeCode(code int64) StudioKind
KindFromTypeCode maps the gArtLc row type code ([2]) to a kind.
type StudioOption ¶ added in v0.2.0
StudioOption is one option of a Studio kind: the values the web app offers (Known), the ones a live capture has sent (Proven, in UI order) and the value used when the option is empty (Default, always proven).
func StudioOptions ¶ added in v0.2.0
func StudioOptions(k StudioKind) ([]StudioOption, bool)
StudioOptions returns the options of a generatable kind (nil for a kind without options) and whether the kind can be generated at all.
type StudioRequest ¶
type StudioRequest struct {
Kind StudioKind
SourceIDs []string // empty: every source of the notebook
// Instructions is the free text of the dialog: the focus prompt (audio,
// video), the report prompt, the slide deck or data table description,
// the topic (mind map, quiz, flashcards). The infographic was captured
// without one and refuses it.
Instructions string
Language string // as the web app sends it, for example en or en_in; default en
Format string // audio, video, slide_deck
Length string // audio, slide_deck
Quantity string // quiz, flashcards
Difficulty string // quiz, flashcards
Images string // flashcards
Orientation string // infographic
Detail string // infographic
Style string // infographic visual style
Title string // report
Description string // report
// GenerateLater is the web app's "Generate later" (deferred) choice:
// video only, captured with the cinematic format.
GenerateLater bool
}
StudioRequest describes one artifact generation. Which option fields apply depends on Kind (see StudioOptions); an option of another kind is KindInvalidArgument. Empty options take the defaults in StudioOptions.
type Suggestion ¶
type Suggestion struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
Prompt string `json:"prompt,omitempty"`
Group int `json:"group,omitzero"`
Code int `json:"code,omitempty"`
}
Suggestion is one suggested prompt, report idea or studio preset. Which fields are set depends on the surface:
chat: Title, Prompt
report: Title, Description, Prompt; they fit studio_generate's
report (title, description, instructions). The row's
last number (1 or 2 live; "audience" per the catalog)
has no verified meaning and is not returned.
studio_options: Group (0-3, position in the response), Code (type/preset
code, 0 when the row has none), Title, Description