Task.String() returns JSON, add Data field
This commit is contained in:
23
taskcp.go
23
taskcp.go
@@ -1,6 +1,7 @@
|
|||||||
package taskcp
|
package taskcp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"iter"
|
"iter"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -30,12 +31,13 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Task struct {
|
type Task struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
State TaskState `json:"-"`
|
State TaskState `json:"-"`
|
||||||
Instructions string `json:"instructions"`
|
Instructions string `json:"instructions"`
|
||||||
Result string `json:"-"`
|
Data map[string]any `json:"data,omitempty"`
|
||||||
Error string `json:"-"`
|
Result string `json:"-"`
|
||||||
Notes string `json:"-"`
|
Error string `json:"-"`
|
||||||
|
Notes string `json:"-"`
|
||||||
|
|
||||||
projectID string
|
projectID string
|
||||||
mcpService string
|
mcpService string
|
||||||
@@ -169,3 +171,12 @@ func (t *Task) FailurePrompt() string {
|
|||||||
%s.set_task_failure(project_id="%s", task_id="%s", error="<error message>", notes="<optional notes>")`,
|
%s.set_task_failure(project_id="%s", task_id="%s", error="<error message>", notes="<optional notes>")`,
|
||||||
t.mcpService, t.projectID, t.ID)
|
t.mcpService, t.projectID, t.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Task) String() string {
|
||||||
|
json, err := json.MarshalIndent(t, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(json)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user