Finalize inbox artifacts and error protocol
This commit is contained in:
@@ -11,9 +11,10 @@ import (
|
||||
)
|
||||
|
||||
type cancelOptions struct {
|
||||
agent string
|
||||
threadID string
|
||||
reason string
|
||||
agent string
|
||||
threadID string
|
||||
reason string
|
||||
artifacts artifactOptions
|
||||
}
|
||||
|
||||
func newCancelCmd(root *rootOptions) *cobra.Command {
|
||||
@@ -30,7 +31,11 @@ func newCancelCmd(root *rootOptions) *cobra.Command {
|
||||
agent = root.agent
|
||||
}
|
||||
if agent == "" {
|
||||
return fmt.Errorf("agent is required")
|
||||
return protocol.InvalidInput("agent is required", nil)
|
||||
}
|
||||
artifacts, err := resolveArtifacts(opts.artifacts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sqlDB, err := db.Open(ctx, root.dbPath)
|
||||
@@ -41,9 +46,10 @@ func newCancelCmd(root *rootOptions) *cobra.Command {
|
||||
|
||||
s := store.NewInboxStore(sqlDB)
|
||||
thread, message, err := s.CancelThread(ctx, store.CancelInput{
|
||||
ThreadID: opts.threadID,
|
||||
Agent: agent,
|
||||
Reason: opts.reason,
|
||||
ThreadID: opts.threadID,
|
||||
Agent: agent,
|
||||
Reason: opts.reason,
|
||||
Artifacts: artifacts,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -70,6 +76,7 @@ func newCancelCmd(root *rootOptions) *cobra.Command {
|
||||
cmd.Flags().StringVar(&opts.agent, "agent", "", "Acting agent")
|
||||
cmd.Flags().StringVar(&opts.threadID, "thread", "", "Thread ID")
|
||||
cmd.Flags().StringVar(&opts.reason, "reason", "", "Cancellation reason")
|
||||
addArtifactFlags(cmd, &opts.artifacts)
|
||||
|
||||
_ = cmd.MarkFlagRequired("thread")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user