MCPcopy Create free account
hub / github.com/compozy/agh / streamPromptEventsJSONL

Function streamPromptEventsJSONL

internal/cli/session.go:641–653  ·  view source on GitHub ↗
(cmd *cobra.Command, client DaemonClient, id string, message string)

Source from the content-addressed store, hash-verified

639}
640
641func streamPromptEventsJSONL(cmd *cobra.Command, client DaemonClient, id string, message string) error {
642 return client.StreamPromptSession(cmd.Context(), id, message, func(event SSEEvent) error {
643 if len(event.Data) == 0 || strings.TrimSpace(string(event.Data)) == "[DONE]" {
644 return nil
645 }
646
647 var payload any
648 if err := json.Unmarshal(event.Data, &payload); err != nil {
649 return fmt.Errorf("cli: decode prompt event: %w", err)
650 }
651 return writeJSONLine(cmd, payload)
652 })
653}
654
655func writeSessionEventsOutput(cmd *cobra.Command, events []SessionEventRecord) error {
656 mode, err := resolveOutputFormat(cmd)

Callers 1

newSessionPromptCommandFunction · 0.85

Calls 2

writeJSONLineFunction · 0.85
StreamPromptSessionMethod · 0.65

Tested by

no test coverage detected