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
@@ -17,6 +17,7 @@ type completeOptions struct {
body string
bodyFile string
payloadJSON string
artifacts artifactOptions
}
func newDoneCmd(root *rootOptions) *cobra.Command {
@@ -41,13 +42,17 @@ func newCompleteCmd(root *rootOptions, mode string) *cobra.Command {
agent = root.agent
}
if agent == "" {
return fmt.Errorf("agent is required")
return protocol.InvalidInput("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 {
@@ -63,6 +68,7 @@ func newCompleteCmd(root *rootOptions, mode string) *cobra.Command {
Body: body,
PayloadJSON: opts.payloadJSON,
Failed: mode == "fail",
Artifacts: artifacts,
})
if err != nil {
return err
@@ -92,6 +98,7 @@ func newCompleteCmd(root *rootOptions, mode string) *cobra.Command {
cmd.Flags().StringVar(&opts.body, "body", "", "Completion body")
cmd.Flags().StringVar(&opts.bodyFile, "body-file", "", "Read completion body from file")
cmd.Flags().StringVar(&opts.payloadJSON, "payload-json", "", "Structured payload JSON string")
addArtifactFlags(cmd, &opts.artifacts)
_ = cmd.MarkFlagRequired("thread")
_ = cmd.MarkFlagRequired("summary")