fileimport

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ID               int64          `json:"id"`
	SessionKey       string         `json:"session_key"`
	PeerID           string         `json:"peer_id"`
	Role             string         `json:"role"`
	Content          string         `json:"content"`
	CreatedAt        time.Time      `json:"created_at"`
	MemorySyncStatus string         `json:"memory_sync_status"`
	MemorySyncReason string         `json:"memory_sync_reason,omitempty"`
	Metadata         map[string]any `json:"metadata,omitempty"`
	Configuration    map[string]any `json:"configuration,omitempty"`
	File             Metadata       `json:"file"`
}

Message is the stable return shape for each imported chunk.

type Metadata

type Metadata struct {
	FileID              string `json:"file_id"`
	Filename            string `json:"filename"`
	ChunkIndex          int    `json:"chunk_index"`
	TotalChunks         int    `json:"total_chunks"`
	OriginalFileSize    int64  `json:"original_file_size"`
	ContentType         string `json:"content_type"`
	ChunkCharacterRange [2]int `json:"chunk_character_range"`
}

Metadata mirrors Honcho's file-related internal metadata attached to every message generated from an uploaded document.

type Options

type Options struct {
	DB                    *sql.DB
	WorkspaceID           string
	MaxFileSize           int
	MaxMessageSize        int
	DefaultMaxMessageSize int
}

Options supplies host-owned dependencies and service defaults to Import.

type Params

type Params struct {
	SessionKey    string         `json:"session_key"`
	PeerID        string         `json:"peer_id"`
	Filename      string         `json:"filename"`
	ContentType   string         `json:"content_type"`
	Content       []byte         `json:"-"`
	Metadata      map[string]any `json:"metadata,omitempty"`
	Configuration map[string]any `json:"configuration,omitempty"`
	CreatedAt     *time.Time     `json:"created_at,omitempty"`
}

Params is the local Goncho equivalent of Honcho's multipart file upload request body. Content is consumed in memory and is not persisted as original file bytes.

type Result

type Result struct {
	WorkspaceID string                `json:"workspace_id"`
	SessionKey  string                `json:"session_key"`
	PeerID      string                `json:"peer_id"`
	FileID      string                `json:"file_id"`
	Messages    []Message             `json:"messages"`
	Unavailable []UnavailableEvidence `json:"unavailable,omitempty"`
}

Result describes the ordinary session messages written from an import plus degraded-mode evidence for reasoning work that cannot be queued.

func Import

func Import(ctx context.Context, opts Options, params Params) (Result, error)

Import converts a text-like file into ordinary ready user turns for the requested session. The original uploaded bytes are only used for extraction.

type UnavailableEvidence

type UnavailableEvidence struct {
	Field      string `json:"field"`
	Capability string `json:"capability"`
	Reason     string `json:"reason"`
}

UnavailableEvidence names import capabilities accepted in the request that cannot yet be fulfilled by the current local storage model.

Jump to

Keyboard shortcuts

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