WIP: preserve remaining background task output work
This commit is contained in:
@@ -8,8 +8,6 @@ import (
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
)
|
||||
|
||||
const chatShellOutputLimit = 64 << 10
|
||||
|
||||
func operatorChatSession(ctx context.Context, registry operatorRegistry, id string) error {
|
||||
if registry == nil {
|
||||
return fmt.Errorf("operator session registry is not configured on this server")
|
||||
@@ -52,7 +50,7 @@ func handleChatShellOutput(ctx context.Context, request protocol.Message, broker
|
||||
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "chat is not configured on this server"})
|
||||
return
|
||||
}
|
||||
if query == nil || !opencode.ValidSessionID(query.SessionID) || !validShellID(query.ShellID) || query.Cursor < 0 || query.Limit < 0 || query.Limit > chatShellOutputLimit {
|
||||
if query == nil || !opencode.ValidSessionID(query.SessionID) || !validShellID(query.ShellID) || query.Cursor < 0 || query.Cursor > protocol.ChatShellOutputMaxCursor || query.Limit <= 0 || query.Limit > protocol.ChatShellOutputLimit {
|
||||
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "a valid bounded shell output query is required"})
|
||||
return
|
||||
}
|
||||
@@ -73,4 +71,6 @@ func handleChatShellOutput(ctx context.Context, request protocol.Message, broker
|
||||
_ = write(protocol.Message{Type: protocol.ChatShellOutput, ID: request.ID, ChatShellOutput: &output})
|
||||
}
|
||||
|
||||
func validShellID(id string) bool { return len(id) > 3 && len(id) <= 128 && id[:3] == "sh_" }
|
||||
func validShellID(id string) bool {
|
||||
return opencode.ValidShellID(id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user