Documentation
¶
Index ¶
- Constants
- func AnsiLinesToHTML(lines []string) string
- func AnsiToHTML(text string) string
- func ExportFromFile(inputPath string, options Options) (string, error)
- func ExportMarkdownFromFile(inputPath, outputPath string) (string, error)
- func ExportSession(manager *session.SessionManager, options Options) (string, error)
- func ExportSessionMarkdown(manager *session.SessionManager, outputPath string) (string, error)
- func ReplaceSkillTokens(text string, names []string, chip func(string) string) string
- func SkillSubmission(text string, known func(string) bool) string
- type Options
- type ParsedSkillBlock
- type RenderedToolHTML
- type SkillToken
- type ThemeRef
- type ToolHTMLRenderResult
- type ToolHTMLRenderer
- type ToolHTMLRendererDeps
Constants ¶
const SkillTokenPrefix = "/skill:"
SkillTokenPrefix starts a skill invocation in message text.
Variables ¶
This section is empty.
Functions ¶
func AnsiLinesToHTML ¶
AnsiLinesToHTML converts ANSI-escaped lines to HTML, one div per line.
func AnsiToHTML ¶
AnsiToHTML converts ANSI-escaped text to HTML with inline styles.
func ExportFromFile ¶
ExportFromFile exports an existing session file without runtime state.
func ExportMarkdownFromFile ¶
func ExportSession ¶
func ExportSession(manager *session.SessionManager, options Options) (string, error)
ExportSession writes a self-contained HTML view of a persisted session.
func ExportSessionMarkdown ¶
func ExportSessionMarkdown(manager *session.SessionManager, outputPath string) (string, error)
ExportSessionMarkdown writes the active session branch as portable Markdown.
func ReplaceSkillTokens ¶ added in v0.12.0
ReplaceSkillTokens substitutes every invocation of the named skills.
func SkillSubmission ¶ added in v0.19.3
SkillSubmission rewrites an interactive message so the kernel's start-of-message expansion sees an inline invocation. A message already starting with the token passes through for upstream's exact expansion; otherwise `/skill:name ` is prepended for each skill, in order, to the untouched text, so the envelopes carry the user's full message, tokens in place, after the skill blocks.
Types ¶
type Options ¶
type Options struct {
OutputPath string
ThemeName string
SystemPrompt *string
Tools json.RawMessage
ToolRenderer ToolHTMLRenderer
Theme *ThemeRef
}
type ParsedSkillBlock ¶
type ParsedSkillBlock struct {
Name string
Location string
Content string
UserMessage string
More []ParsedSkillBlock
}
ParsedSkillBlock is an upstream skill invocation embedded in a user message; More holds the skills the same message invoked after it, envelope after envelope.
func ParseSkillBlock ¶
func ParseSkillBlock(text string) (ParsedSkillBlock, bool)
ParseSkillBlock parses the exact upstream skill-message envelope.
func (ParsedSkillBlock) InvocationText ¶ added in v0.12.0
func (skill ParsedSkillBlock) InvocationText() string
InvocationText is the user's text with the invocations at their original position. Orb's inline form keeps the tokens in the text after the blocks; upstream's `/skill:name args` form moved them out, so they lead.
func (ParsedSkillBlock) Names ¶ added in v0.16.0
func (skill ParsedSkillBlock) Names() []string
Names is the invoked skills' names, in order.
func (ParsedSkillBlock) Skills ¶ added in v0.16.0
func (skill ParsedSkillBlock) Skills() []ParsedSkillBlock
Skills is every skill the message invoked, in order.
type RenderedToolHTML ¶
type RenderedToolHTML struct {
CallHTML *string `json:"callHtml,omitempty"`
ResultHTMLCollapsed *string `json:"resultHtmlCollapsed,omitempty"`
ResultHTMLExpanded *string `json:"resultHtmlExpanded,omitempty"`
}
RenderedToolHTML is the custom-tool HTML envelope consumed by the embedded upstream renderer. Pointer fields preserve optional property semantics.
type SkillToken ¶ added in v0.12.0
SkillToken is a whitespace-delimited `/skill:name` run; offsets are bytes.
func FindSkillTokens ¶ added in v0.12.0
func FindSkillTokens(text string) []SkillToken
FindSkillTokens returns the skill invocations in text, in order.
type ThemeRef ¶ added in v0.10.0
ThemeRef identifies the theme a caller already selected for ThemeName. An empty SourcePath means the theme has no file to export from.
type ToolHTMLRenderResult ¶
ToolHTMLRenderResult is the optional collapsed/expanded HTML returned for a custom tool result.
type ToolHTMLRenderer ¶
type ToolHTMLRenderer interface {
RenderCall(toolCallID, toolName string, arguments any) *string
RenderResult(toolCallID, toolName string, content, details any, isError bool) *ToolHTMLRenderResult
}
ToolHTMLRenderer pre-renders custom tool calls and results for live exports. NewToolHTMLRenderer adapts registered TUI tool renderers to this seam, matching upstream createToolHtmlRenderer and its ANSI-to-HTML conversion.
func NewToolHTMLRenderer ¶
func NewToolHTMLRenderer(deps ToolHTMLRendererDeps) ToolHTMLRenderer
NewToolHTMLRenderer creates the live-export ToolHTMLRenderer over the registered tool definitions (upstream createToolHtmlRenderer).
type ToolHTMLRendererDeps ¶
type ToolHTMLRendererDeps struct {
// GetToolDefinition looks up a tool definition by name.
GetToolDefinition func(name string) *extensions.ToolDefinition
// Theme styles the renders.
Theme extensions.Theme
// CWD is the working directory for the render context.
CWD string
// Width is the terminal width for rendering (default 100).
Width int
}
ToolHTMLRendererDeps configures NewToolHTMLRenderer.