Documentation
¶
Overview ¶
Package export is the notes export SPI of Meeting Mode: one Document that describes a finished meeting, a structural Outline built from it, Markdown and XHTML renderers of that outline, and the Target interface every sync destination implements (a Markdown file, OneNote, Notion or a host's own).
The package knows nothing about any destination. A target receives the Document and the binary Parts it references, and answers with a Receipt that names what it wrote and the content fingerprint it wrote, so a host can skip a re-push of unchanged content without asking the destination.
Everything in a Document is untrusted text: a model wrote the review after listening to the meeting, and a title can come from a window or a calendar subject. The renderers escape it; neither output can load anything.
Stability: Beta — API-checked; may change with a changelog callout.
Example ¶
package main
import (
"context"
"fmt"
"time"
"github.com/kombifyio/SpeechKit/pkg/speechkit/meeting/export"
)
// stdoutTarget is a host's own target: it prints the Markdown rendering.
type stdoutTarget struct{}
func (stdoutTarget) ID() string { return "stdout" }
func (stdoutTarget) Push(_ context.Context, doc export.Document, opts export.Options) (export.Receipt, error) {
fingerprint := doc.Fingerprint()
if opts.Previous.Fingerprint == fingerprint {
return export.Receipt{TargetID: "stdout", ExternalID: opts.Previous.ExternalID, Fingerprint: fingerprint, Unchanged: true}, nil
}
fmt.Print(doc.Outline().Markdown())
return export.Receipt{TargetID: "stdout", ExternalID: "1", Fingerprint: fingerprint}, nil
}
func main() {
registry := export.NewRegistry()
if err := registry.Register(stdoutTarget{}); err != nil {
panic(err)
}
doc := export.Document{
Title: "Weekly sync",
StartedAt: time.Date(2026, 10, 12, 9, 30, 0, 0, time.UTC),
Locale: "en",
Sections: []export.Section{{
Title: "Decisions",
Items: []export.Item{{Text: "Release on Friday", CitationIDs: []int64{7}}},
}},
Notes: []export.Note{{Text: "check the installer", Offset: 90 * time.Second, Stamped: true}},
Citations: []export.Citation{{SegmentID: 7, Offset: 3 * time.Minute, Speaker: "Ana", Text: "Friday works."}},
}
receipt, _ := registry.Push(context.Background(), "stdout", doc, export.Options{})
again, _ := registry.Push(context.Background(), "stdout", doc, export.Options{Previous: receipt})
fmt.Println("second push unchanged:", again.Unchanged)
}
Output: # Weekly sync _2026-10-12 09:30 · en_ ## Decisions - Release on Friday [1] ## My notes - [01:30] check the installer ## Transcript citations 1. 03:00 Ana: Friday works. second push unchanged: true
Index ¶
- Variables
- func FormatOffset(offset time.Duration) string
- func ImagePartName(id string) string
- type Block
- type BlockKind
- type Citation
- type Destination
- type Document
- type Item
- type Labels
- type Note
- type Options
- type Outline
- type Part
- type Parts
- type PartsMap
- type Receipt
- type Registry
- type Screenshot
- type Section
- type Target
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // not allowed in this deployment. ErrTargetUnavailable = errors.New("export: target unavailable") // ErrDestinationGone: the destination (a section, a page, a folder) no // longer exists. The host decides whether to pick a new one. ErrDestinationGone = errors.New("export: destination gone") // ErrDestinationFull: the destination refuses more content. ErrDestinationFull = errors.New("export: destination full") // ErrTooLarge: the document or one of its parts exceeds what the // destination accepts, even after fitting. ErrTooLarge = errors.New("export: too large") // ErrDestinationNotAllowed: the destination lies outside what this // deployment lets the target write to (a policy-pinned notebook scope). // A target answers it before it sends anything. ErrDestinationNotAllowed = errors.New("export: destination not allowed") )
Sentinel errors a Target wraps so a host can react without knowing the destination. Test with errors.Is.
Functions ¶
func FormatOffset ¶
FormatOffset renders an offset from the meeting start as m:ss, or h:mm:ss from the first hour on.
func ImagePartName ¶
ImagePartName is the multipart part name the XHTML renderer references an image by ("name:<part>"). It is derived from the id, so a target that attaches the bytes finds the name without a lookup table, and it contains only letters and digits whatever the id holds.
Types ¶
type Block ¶
type Block struct {
Kind BlockKind `json:"kind"`
Level int `json:"level,omitempty"`
Text string `json:"text,omitempty"`
Emphasis bool `json:"emphasis,omitempty"`
Ordered bool `json:"ordered,omitempty"`
Items []string `json:"items,omitempty"`
ImageID string `json:"imageId,omitempty"`
Alt string `json:"alt,omitempty"`
}
Block is one element of an Outline. Which fields matter depends on Kind: a heading has Level (1 to 6) and Text, a paragraph Text and Emphasis, a list Ordered and Items, an image ImageID and Alt.
type Citation ¶
type Citation struct {
SegmentID int64 `json:"segmentId"`
Offset time.Duration `json:"offset"`
Speaker string `json:"speaker,omitempty"`
Text string `json:"text"`
}
Citation is one transcript line, with its offset from the meeting start.
type Destination ¶
type Destination struct {
ID string `json:"id"`
ParentID string `json:"parentId,omitempty"`
Name string `json:"name,omitempty"`
Container string `json:"container,omitempty"`
}
Destination is where a target writes: a section, a database, a folder. ParentID is its container (a notebook) where the target needs one to create a sibling. Container names the space both ids live in where a target serves several (a OneNote site); empty is the target's default space.
type Document ¶
type Document struct {
Title string `json:"title"`
StartedAt time.Time `json:"startedAt"`
// Locale is the BCP-47 tag of the review's language.
Locale string `json:"locale,omitempty"`
// Brief is the executive brief: a handful of sentences.
Brief []string `json:"brief,omitempty"`
// Sections are the review's headings in order.
Sections []Section `json:"sections,omitempty"`
// Notes are what the user typed, reproduced verbatim.
Notes []Note `json:"notes,omitempty"`
// Citations are the transcript lines the review cites.
Citations []Citation `json:"citations,omitempty"`
// Screenshots reference binary parts by id; the bytes travel in
// Options.Parts.
Screenshots []Screenshot `json:"screenshots,omitempty"`
// Labels are the headings the renderers add. Zero fields fall back to
// English, so a host passes the catalog strings for Locale.
Labels Labels `json:"labels,omitzero"`
}
Document is one finished meeting as an export sees it.
func (Document) Fingerprint ¶
Fingerprint identifies the content of a Document. Two documents with the same fingerprint render identically; a target compares it with the fingerprint of its last Receipt to skip an unchanged re-push. Part bytes are not hashed: a screenshot id names immutable content.
type Item ¶
type Item struct {
Text string `json:"text"`
// Owner and Due are set for action items where the meeting named them.
Owner string `json:"owner,omitempty"`
Due string `json:"due,omitempty"`
// CitationIDs are the SegmentIDs of the Document's Citations this bullet
// came from.
CitationIDs []int64 `json:"citationIds,omitempty"`
}
Item is one bullet of a review section.
type Labels ¶
type Labels struct {
Brief string `json:"brief,omitempty"`
Notes string `json:"notes,omitempty"`
Citations string `json:"citations,omitempty"`
Screenshots string `json:"screenshots,omitempty"`
Screenshot string `json:"screenshot,omitempty"`
}
Labels are the renderer's own headings.
type Note ¶
type Note struct {
Text string `json:"text"`
Offset time.Duration `json:"offset,omitempty"`
Stamped bool `json:"stamped,omitempty"`
}
Note is one note the user wrote. Stamped is false for a note taken before stamps existed; it keeps no invented time.
type Options ¶
type Options struct {
Destination Destination
// Parts holds the screenshot bytes; nil exports text only.
Parts Parts
// Previous is the receipt of the last successful push of this document
// to this target, or zero. Its fingerprint and external id make a
// re-push idempotent.
Previous Receipt
// AllowRollover lets a target create a sibling destination when the
// configured one is full, instead of answering ErrDestinationFull.
AllowRollover bool
}
Options steer one push.
type Outline ¶
type Outline struct {
Title string `json:"title"`
Created time.Time `json:"created,omitzero"`
Locale string `json:"locale,omitempty"`
Blocks []Block `json:"blocks"`
}
Outline is the structure a Document renders to. It is built, never parsed from Markdown, so every renderer sees the same blocks; a target may also split it (a slice of Blocks is an Outline of its own).
func (Outline) BodyXHTML ¶
BodyXHTML renders only the blocks, as the content of a body element. A target appends it to an existing page.
func (Outline) Markdown ¶
Markdown renders the outline as a Markdown file. Text is neutralised so a viewer that renders HTML or images loads nothing: "<" is escaped and image syntax "![" loses its "!".
type Parts ¶
Parts gives a target the bytes behind a Screenshot id. Load answers an error wrapping fs.ErrNotExist (or any error) for a part that is gone; the target then skips it and reports it in Receipt.Skipped.
type Receipt ¶
type Receipt struct {
TargetID string `json:"targetId"`
ExternalID string `json:"externalId"`
URL string `json:"url,omitempty"`
// Fingerprint is the Document fingerprint the destination now holds.
// It is empty when a push failed half-way: the external object exists
// but does not hold the whole document.
Fingerprint string `json:"fingerprint,omitempty"`
// Destination is where the push landed; it differs from the requested
// one after a rollover.
Destination Destination `json:"destination,omitzero"`
// Skipped lists screenshot ids that were not written (missing parts or
// a destination limit).
Skipped []string `json:"skipped,omitempty"`
// Unchanged is true when the push sent nothing because the destination
// already held this fingerprint.
Unchanged bool `json:"unchanged,omitempty"`
PushedAt time.Time `json:"pushedAt,omitzero"`
}
Receipt records what a push wrote.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the targets a host offers. It is safe for concurrent use.
func (*Registry) Push ¶
func (r *Registry) Push(ctx context.Context, targetID string, doc Document, opts Options) (Receipt, error)
Push looks the target up and pushes the document to it.
type Screenshot ¶
type Screenshot struct {
ID string `json:"id"`
Offset time.Duration `json:"offset"`
Caption string `json:"caption,omitempty"`
}
Screenshot references one image part by id.
type Target ¶
type Target interface {
// ID is the stable identifier the registry and the store use.
ID() string
// Push writes the document. When opts.Previous carries the current
// fingerprint, Push returns it with Unchanged set and sends nothing.
Push(ctx context.Context, doc Document, opts Options) (Receipt, error)
}
Target is one export destination.