delivery

package
v0.16.521 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0 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 delivery is a file the agent hands to the person on purpose (`harnessly deliver <path>`, the MCP tool deliver_file): what the platform records of it, how the record travels in the tool's result, and how it reads.

The record is a line of the tool's result, so the transcript keeps it: the feed finds it there (a card in the chat) and the pane's watcher finds it there (the file opens once), after a reload and after a restart alike. Files the agent only edits never make one: only the call that names the file does.

Index

Constants

View Source
const Host = "delivered.harnessly.invalid"

Host is the address a record is written under: it never resolves, it only says what the line is.

View Source
const ToolName = "deliver_file"

ToolName is the MCP tool that hands a file over, the same act as `harnessly deliver`.

Variables

View Source
var PackDir = filepath.Join(os.TempDir(), "harnessly-delivered")

PackDir is where a folder handed over is packed; it lies under the machine's temporary folder, which the workspace's access lets out.

Functions

func Describe

func Describe(a *files.Access, requested, title string) (Info, *Refusal)

Describe resolves a file under the access rules (the workspace's folders, no secrets, no links out of them), and reads its size and sha256. title is what the card is called ("" for the file's name).

A folder is handed over as one zip of it (named after the folder), written into PackDir by the same rules as a download of the folder: its secrets are left out.

func Link(i Info) string

Link writes the record as one address.

func Message

func Message(i Info) string

Message is what the tool answers the agent: one line for the person's card (the record) and what to do next.

func MimeOf

func MimeOf(name string) string

MimeOf is the type of a file by its extension; application/octet-stream for any other.

Types

type Info

type Info struct {
	// Path is the real, absolute path.
	Path   string
	Name   string
	Title  string
	Mime   string
	Size   int64
	SHA256 string
}

Info is a delivered file.

func LinkIn

func LinkIn(links []string) (Info, bool)

LinkIn is the first record among links.

func ParseLink(link string) (Info, bool)

ParseLink reads a record back; ok is false for any other address or a record that lacks its path.

func (Info) Opens

func (i Info) Opens() bool

Opens says whether the pane opens the file at the moment it is handed over.

type Refusal

type Refusal struct {
	Status int
	Text   string
}

Refusal is why a file is not delivered, in the words the agent reads.

func (*Refusal) Error

func (r *Refusal) Error() string

type Tools

type Tools struct {
	Access *files.Access
	Cwd    string
	// Handed is told of a file that was handed over (the runtime opens it in the chat's pane); nil for nothing.
	Handed func(Info)
}

Tools is the delivery's MCP tool for one calling agent. Cwd is the folder of the agent's chat ("" when the runtime could not tell), which a relative path is taken from.

func (Tools) Call

func (t Tools) Call(_ context.Context, name string, args *jsvalue.Object) *jsvalue.Object

func (Tools) Has

func (Tools) Has(name string) bool

func (Tools) Instructions

func (Tools) Instructions() string

func (Tools) Tools

func (Tools) Tools() []any

Jump to

Keyboard shortcuts

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