From 2aeacde0e0432e1971ae6bf9b9c0b3240268f9ce Mon Sep 17 00:00:00 2001 From: Azat Valiev Date: Mon, 28 Sep 2026 12:52:54 +0000 Subject: [PATCH 1/2] send cli source to the Paywalls AI editor --- internal/paywallai/paywallai.go | 6 ++++++ internal/paywallai/paywallai_test.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/internal/paywallai/paywallai.go b/internal/paywallai/paywallai.go index 214ffdf3..89b25c8a 100644 --- a/internal/paywallai/paywallai.go +++ b/internal/paywallai/paywallai.go @@ -46,6 +46,9 @@ type InputAttachment struct { DataBase64 string `json:"data_base64"` } +// editorSource tags CLI traffic so the editor doesn't report it as "unknown". +const editorSource = "cli" + // EditorRequest is the POST /editor/v1/stream body. UIConfig, SessionItems, // and AppContext are opaque server round-trips. type EditorRequest struct { @@ -61,6 +64,7 @@ type EditorRequest struct { SessionItems json.RawMessage `json:"__unstable_session_items"` AppContext json.RawMessage `json:"app_context,omitempty"` IncludeResultScreenshots bool `json:"include_result_screenshots,omitempty"` + Source string `json:"source"` } type ToolActivity struct { @@ -207,6 +211,7 @@ func errorMessage(body []byte) string { // Stream starts an editor run and returns the live event stream. func (c *Client) Stream(ctx context.Context, request EditorRequest) (*Stream, error) { + request.Source = editorSource req, err := c.newRequest(ctx, "/editor/v1/stream", request) if err != nil { return nil, err @@ -242,6 +247,7 @@ func (c *Client) Feedback(ctx context.Context, sessionID, traceID, rating string "session_id": sessionID, "trace_id": traceID, "rating": rating, + "source": editorSource, }) } diff --git a/internal/paywallai/paywallai_test.go b/internal/paywallai/paywallai_test.go index 4256b301..c6d6d3c0 100644 --- a/internal/paywallai/paywallai_test.go +++ b/internal/paywallai/paywallai_test.go @@ -84,6 +84,9 @@ func TestStreamDecodesEvents(t *testing.T) { if gotBody["message"] != "make it blue" { t.Errorf("message = %v", gotBody["message"]) } + if gotBody["source"] != "cli" { + t.Errorf("source = %v", gotBody["source"]) + } if _, present := gotBody["__unstable_session_items"]; !present { t.Error("__unstable_session_items missing") } @@ -129,6 +132,9 @@ func TestFeedbackAndRewind(t *testing.T) { if body["session_id"] != "sess1" { t.Errorf("session_id = %v", body["session_id"]) } + if r.URL.Path == "/editor/v1/feedback" && body["source"] != "cli" { + t.Errorf("feedback source = %v", body["source"]) + } })) defer server.Close() client := NewClient(Options{BaseURL: server.URL, Token: "tok"}) From ab2e915344078ca7fb82ccf17705eae6ec8918a7 Mon Sep 17 00:00:00 2001 From: Azat Valiev Date: Mon, 28 Sep 2026 14:29:09 +0000 Subject: [PATCH 2/2] shorten editorSource comment --- internal/paywallai/paywallai.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/paywallai/paywallai.go b/internal/paywallai/paywallai.go index 89b25c8a..c11db544 100644 --- a/internal/paywallai/paywallai.go +++ b/internal/paywallai/paywallai.go @@ -46,7 +46,7 @@ type InputAttachment struct { DataBase64 string `json:"data_base64"` } -// editorSource tags CLI traffic so the editor doesn't report it as "unknown". +// editorSource tags CLI traffic so the editor can report it. const editorSource = "cli" // EditorRequest is the POST /editor/v1/stream body. UIConfig, SessionItems,