chat: deliver attachments and cancel runs immediately
Carry browser files as base64 prompt attachments, write them to private temporary files and pass file:// references to OpenCode, and map the user turn's top-level files back into history. Replay a running step on subscribe, forward only a caller-supplied msg_ id, and persist cancel on the run and live step before interrupting the runner.
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"git.a-wan.net/alan/pipelines/internal/opencode"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"sync/atomic"
|
||||
@@ -47,6 +48,13 @@ type chatPromptWithMessageID interface {
|
||||
PromptWithMessageID(context.Context, string, string, string) error
|
||||
}
|
||||
|
||||
// chatPromptWithFiles is implemented by a broker that can hand local files to
|
||||
// the agent with a prompt. The server writes browser attachment bytes to private
|
||||
// temporary files first; a browser URI is not readable by the agent service.
|
||||
type chatPromptWithFiles interface {
|
||||
PromptWithMessageIDFiles(context.Context, string, string, string, []opencode.PromptFile) error
|
||||
}
|
||||
|
||||
// chatAnswerer is the optional form-answer surface. Test brokers and older
|
||||
// backends need not implement it; a broker that does not answers chat_answer
|
||||
// with a clear error rather than pretending the question was delivered.
|
||||
|
||||
Reference in New Issue
Block a user