plaud

package
v0.0.0-...-4db46fd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package plaud ingests Plaud Note recordings into Dibs. It reads recordings through the official Plaud MCP server over stdio and submits each one as a private draft idea through the Dibs MCP endpoint (submit_idea).

Plaud's OAuth token stays in the Plaud MCP server's own store (~/.plaud/tokens-mcp.json); this package never reads or copies it.

Index

Constants

View Source
const (
	// DefaultServer is the public Dibs origin.
	DefaultServer = ingest.DefaultServer
	// DefaultTags are attached to every ingested idea.
	DefaultTags = "plaud,voice-note"
	// EnvToken holds the hub bearer token (preferred over --token, which is
	// visible in the process list).
	EnvToken = ingest.EnvToken
	// EnvServer overrides the default --server.
	EnvServer = ingest.EnvServer
	// EnvMCPCommand overrides the default --mcp-command.
	EnvMCPCommand = "DIBS_PLAUD_MCP_COMMAND"
	// EnvHome overrides the default --home.
	EnvHome = "DIBS_PLAUD_HOME"
)
View Source
const (

	// DefaultSinceDays bounds how far back the first run looks.
	DefaultSinceDays = ingest.DefaultSinceDays
	// DefaultMaxPerHour and DefaultMaxPerDay match the intake budget per
	// identity (10/h, 30/24h).
	DefaultMaxPerHour = ingest.DefaultMaxPerHour
	DefaultMaxPerDay  = ingest.DefaultMaxPerDay
)
View Source
const DefaultCommand = "npx -y @plaud-ai/mcp@latest"

DefaultCommand launches the official (free) Plaud MCP server.

Variables

View Source
var ErrRateLimited = ingest.ErrRateLimited

ErrRateLimited reports that Dibs (or a proxy in front of it) answered 429; the batch stops and resumes on the next run.

Functions

func ChildEnv

func ChildEnv(environ []string, home string) []string

ChildEnv filters environ (os.Environ() form) down to the variables the Plaud MCP server is allowed to see. A non-empty home replaces HOME.

func Main

func Main(ctx context.Context, args []string, getenv func(string) string, stderr io.Writer) int

Main is `dibs ingest plaud`: it returns a process exit code (0 ok, 1 run failure, 2 usage error). getenv is injected for tests.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a minimal MCP client session: initialize handshake, then tools/call returning the text content.

func Connect

func Connect(ctx context.Context, t mcpsdk.Transport) (*Client, error)

Connect performs the MCP initialize handshake over t.

func Dial

func Dial(ctx context.Context, command, home string, stderr io.Writer) (*Client, error)

Dial spawns command (split on whitespace; no shell quoting) and connects to it over stdin/stdout. The server's stderr is forwarded to stderr, which is how Plaud's sign-in URL reaches the user on the first run. The child gets an allowlisted environment (see ChildEnv), not the caller's: the server is a third-party package fetched from the registry on every start and has no use for the hub bearer token or anything else the caller's shell exports. A non-empty home becomes the child's $HOME, so the Plaud MCP server keeps its OAuth token store (~/.plaud) under that directory instead of the caller's home.

func (*Client) CallTool

func (c *Client) CallTool(ctx context.Context, name string, args map[string]any) (string, error)

CallTool invokes a tool and returns its text content joined by newlines. A tool-level error (isError) is returned as an error.

func (*Client) Close

func (c *Client) Close() error

Close ends the session (and stops a spawned server).

type Cursor

type Cursor = ingest.Cursor

Cursor is the persisted ingest state (see ingest.Cursor).

func LoadCursor

func LoadCursor(path string) (*Cursor, error)

LoadCursor reads path; a missing file is an empty cursor.

type DibsSink

type DibsSink = ingest.DibsSink

DibsSink submits ideas with the Dibs MCP submit_idea tool.

type Idea

type Idea = ingest.Idea

Idea is what gets submitted to Dibs for one recording.

type Ingester

type Ingester struct {
	// Dial opens a Plaud MCP session; it is called once per run.
	Dial       func(ctx context.Context) (Tools, error)
	Sink       Sink
	CursorPath string
	Tags       []string
	SinceDays  int
	MaxPerHour int
	MaxPerDay  int
	// MaxPerRun caps recordings handled in one run (0 = no cap).
	MaxPerRun int
	// DryRun builds and logs each idea without submitting it or advancing
	// the cursor.
	DryRun bool
	Log    *slog.Logger
	Now    func() time.Time
}

Ingester moves new Plaud recordings into Dibs. It is ingest.Ingester with a Plaud MCP session as the source.

func (*Ingester) Run

func (in *Ingester) Run(ctx context.Context, interval time.Duration) error

Run calls RunOnce, then every interval until ctx is done (see ingest.Ingester.Run).

func (*Ingester) RunOnce

func (in *Ingester) RunOnce(ctx context.Context) (Result, error)

RunOnce lists recordings since the cursor and submits each unseen one, oldest first (see ingest.Ingester.RunOnce).

type Recording

type Recording struct {
	ID         string
	Name       string
	CreatedAt  time.Time
	StartAt    time.Time
	DurationMS int64
}

Recording is one Plaud recording as listed by list_files.

func (Recording) When

func (r Recording) When() time.Time

When is the best known recording time (zero if unknown).

type Result

type Result = ingest.Result

Result summarizes one run.

type Sink

type Sink = ingest.Sink

Sink submits one idea to Dibs.

type Tools

type Tools interface {
	CallTool(ctx context.Context, name string, args map[string]any) (string, error)
	Close() error
}

Tools is the subset of an MCP client session the ingester needs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL