cmd

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 15 Imported by: 1 module, 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 cmd has the resources' commands and flags

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientCommands

type ClientCommands struct {
	ResourceCommands
}

ClientCommands are the commands which call the resources' API

type Flags

type Flags struct {
	MaxSize   int64         `name:"max-size" help:"Largest content of a resource, in bytes." default:"268435456" env:"LLM_RESOURCE_MAX_SIZE"`
	Retention time.Duration `` /* 150-byte string literal not displayed */
}

Flags are the resources' flags for the server: the largest content of a resource, and how long one on its own is kept, after it's last used

func (Flags) WithResources

func (flags Flags) WithResources(ctx server.Cmd, srv *servercmd.RunServer, store resource.Store, fn func(*resource.Manager) error, opts ...resource.Opt) error

WithResources creates the resources' manager, of the store, with the flags, and the options, such as the broadcaster it publishes their changes to, and which it watches for the sessions which are deleted, registers its HTTP handlers with the server, when there is one, and then calls the function with it, returning any error. The function runs it, so the resources are cleaned.

type ResourceCmd

type ResourceCmd struct {
	Hash    string `arg:"" name:"hash" help:"Hash of the resource."`
	Session string `name:"session" help:"Identifier of the session the resource is in, or none, for one on its own."`
}

func (*ResourceCmd) Run

func (cmd *ResourceCmd) Run(ctx server.Cmd) error

Run prints the resource

type ResourceCommands

type ResourceCommands struct {
	Resources      ResourcesCmd      `` /* 148-byte string literal not displayed */
	Resource       ResourceCmd       `cmd:"" name:"resource" help:"Print a resource." group:"RESOURCE"`
	ResourceCreate ResourceCreateCmd `` /* 131-byte string literal not displayed */
	ResourceGet    ResourceGetCmd    `cmd:"" name:"resource-get" help:"Download a resource's content, to a file, or standard output." group:"RESOURCE"`
	ResourceDelete ResourceDeleteCmd `cmd:"" name:"resource-delete" help:"Delete a resource." group:"RESOURCE"`
}

ResourceCommands are the commands which list, upload, get, download and delete the resources

type ResourceCreateCmd

type ResourceCreateCmd struct {
	File        string `arg:"" name:"file" optional:"" help:"File to upload, or standard input, when it's omitted, or -." type:"path"`
	Session     string `` /* 158-byte string literal not displayed */
	Name        string `name:"name" help:"Name of the resource, which is the file's, when it's omitted."`
	Description string `name:"description" help:"Description of the resource."`
	Type        string `name:"type" help:"MIME type of the resource, which is detected, when it's omitted."`
}

func (*ResourceCreateCmd) Run

func (cmd *ResourceCreateCmd) Run(ctx server.Cmd) error

Run uploads the file, or standard input, and prints the resource

type ResourceDeleteCmd

type ResourceDeleteCmd struct {
	Hash    string `arg:"" name:"hash" help:"Hash of the resource."`
	Session string `name:"session" help:"Identifier of the session the resource is in, or none, for one on its own."`
}

func (*ResourceDeleteCmd) Run

func (cmd *ResourceDeleteCmd) Run(ctx server.Cmd) error

Run deletes the resource, and prints it, as it was

type ResourceGetCmd

type ResourceGetCmd struct {
	Hash    string `arg:"" name:"hash" help:"Hash of the resource."`
	Session string `name:"session" help:"Identifier of the session the resource is in, or none, for one on its own."`
	Output  string `name:"output" short:"o" help:"File to write the content to, or standard output, when it's omitted, or -." type:"path"`
}

func (*ResourceGetCmd) Run

func (cmd *ResourceGetCmd) Run(ctx server.Cmd) (err error)

Run writes the resource's content to the file, or standard output. A file which can't be written whole is removed.

type ResourcesCmd

type ResourcesCmd struct {
	Session string `name:"session" help:"Identifier of the session whose resources are listed, or none, for those on their own."`
	Offset  uint   `name:"offset" help:"How many resources to skip."`
	Limit   *uint  `name:"limit" help:"Most resources to list."`
}

func (*ResourcesCmd) Run

func (cmd *ResourcesCmd) Run(ctx server.Cmd) error

Run prints the resources, as a table, and how many there are

Jump to

Keyboard shortcuts

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