Finalize inbox artifacts and error protocol

This commit is contained in:
2026-03-19 03:25:06 +08:00
parent c3314cd9cf
commit f315d2330d
22 changed files with 659 additions and 86 deletions
+8 -1
View File
@@ -19,6 +19,7 @@ type replyOptions struct {
body string
bodyFile string
payloadJSON string
artifacts artifactOptions
}
func newReplyCmd(root *rootOptions) *cobra.Command {
@@ -35,13 +36,17 @@ func newReplyCmd(root *rootOptions) *cobra.Command {
from = root.agent
}
if from == "" {
return fmt.Errorf("from agent is required")
return protocol.InvalidInput("from agent is required", nil)
}
body, err := resolveBodyValue(opts.body, opts.bodyFile)
if err != nil {
return err
}
artifacts, err := resolveArtifacts(opts.artifacts)
if err != nil {
return err
}
sqlDB, err := db.Open(ctx, root.dbPath)
if err != nil {
@@ -58,6 +63,7 @@ func newReplyCmd(root *rootOptions) *cobra.Command {
Summary: opts.summary,
Body: body,
PayloadJSON: opts.payloadJSON,
Artifacts: artifacts,
})
if err != nil {
return err
@@ -89,6 +95,7 @@ func newReplyCmd(root *rootOptions) *cobra.Command {
cmd.Flags().StringVar(&opts.body, "body", "", "Reply body")
cmd.Flags().StringVar(&opts.bodyFile, "body-file", "", "Read reply body from file")
cmd.Flags().StringVar(&opts.payloadJSON, "payload-json", "", "Structured payload JSON string")
addArtifactFlags(cmd, &opts.artifacts)
_ = cmd.MarkFlagRequired("thread")
_ = cmd.MarkFlagRequired("to")