@oh-my-pi/pi-ai 17.1.7 → 17.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/types/auth-broker/server.d.ts +5 -0
  3. package/dist/types/auth-broker/types.d.ts +4 -0
  4. package/dist/types/auth-storage.d.ts +26 -1
  5. package/dist/types/error/classes.d.ts +5 -1
  6. package/dist/types/error/rate-limit.d.ts +5 -4
  7. package/dist/types/providers/anthropic-client.d.ts +13 -1
  8. package/dist/types/providers/anthropic.d.ts +9 -1
  9. package/dist/types/providers/cursor/exec-modern.d.ts +98 -0
  10. package/dist/types/providers/cursor-pi-args.d.ts +99 -0
  11. package/dist/types/providers/cursor.d.ts +53 -3
  12. package/dist/types/providers/error-message.d.ts +2 -4
  13. package/dist/types/providers/openai-codex-responses.d.ts +10 -0
  14. package/dist/types/providers/openai-responses-wire.d.ts +8 -0
  15. package/dist/types/providers/openai-shared.d.ts +13 -1
  16. package/dist/types/registry/exa.d.ts +8 -0
  17. package/dist/types/registry/registry.d.ts +7 -1
  18. package/dist/types/registry/xai.d.ts +4 -1
  19. package/dist/types/stream.d.ts +2 -0
  20. package/dist/types/types.d.ts +101 -1
  21. package/dist/types/usage/umans.d.ts +2 -0
  22. package/dist/types/utils/block-symbols.d.ts +11 -0
  23. package/dist/types/utils/harmony-leak.d.ts +15 -7
  24. package/dist/types/utils/schema/normalize.d.ts +1 -0
  25. package/dist/types/utils.d.ts +8 -0
  26. package/package.json +4 -4
  27. package/src/auth-broker/client.ts +5 -1
  28. package/src/auth-broker/server.ts +103 -9
  29. package/src/auth-broker/snapshot-cache.ts +12 -3
  30. package/src/auth-broker/types.ts +6 -0
  31. package/src/auth-storage.ts +447 -28
  32. package/src/error/classes.ts +98 -3
  33. package/src/error/flags.ts +6 -1
  34. package/src/error/rate-limit.ts +18 -12
  35. package/src/providers/amazon-bedrock.ts +3 -3
  36. package/src/providers/anthropic-client.ts +24 -2
  37. package/src/providers/anthropic.ts +31 -6
  38. package/src/providers/cursor/exec-modern.ts +495 -0
  39. package/src/providers/cursor/proto/agent.proto +1007 -0
  40. package/src/providers/cursor-pi-args.ts +135 -0
  41. package/src/providers/cursor.ts +1138 -66
  42. package/src/providers/devin.ts +2 -1
  43. package/src/providers/error-message.ts +3 -1
  44. package/src/providers/google-vertex.ts +3 -5
  45. package/src/providers/openai-codex-responses.ts +109 -27
  46. package/src/providers/openai-completions.ts +19 -4
  47. package/src/providers/openai-responses-wire.ts +8 -0
  48. package/src/providers/openai-responses.ts +12 -1
  49. package/src/providers/openai-shared.ts +83 -14
  50. package/src/registry/api-key-validation.ts +18 -34
  51. package/src/registry/exa.ts +19 -0
  52. package/src/registry/novita.ts +6 -3
  53. package/src/registry/registry.ts +3 -1
  54. package/src/registry/xai.ts +17 -1
  55. package/src/stream.ts +3 -4
  56. package/src/types.ts +115 -0
  57. package/src/usage/umans.ts +192 -0
  58. package/src/utils/block-symbols.ts +12 -0
  59. package/src/utils/harmony-leak.ts +32 -0
  60. package/src/utils/idle-iterator.ts +2 -2
  61. package/src/utils/schema/normalize.ts +140 -38
  62. package/src/utils.ts +173 -3
@@ -197,6 +197,7 @@ message ReadLintsToolError {
197
197
 
198
198
  message McpToolError {
199
199
  string error = 1;
200
+ string read_tool_def_reminder = 2;
200
201
  }
201
202
 
202
203
  // Result for MCP tool calls (separate from exec results)
@@ -212,6 +213,7 @@ message McpToolResult {
212
213
  message McpToolCall {
213
214
  McpArgs args = 1;
214
215
  McpToolResult result = 2;
216
+ optional string description = 3;
215
217
  }
216
218
 
217
219
  message SemSearchToolCall {
@@ -415,7 +417,21 @@ message ToolCall {
415
417
  TruncatedToolCall truncated_tool_call = 34;
416
418
  StartGrindExecutionToolCall start_grind_execution_tool_call = 35;
417
419
  StartGrindPlanningToolCall start_grind_planning_tool_call = 36;
420
+ PiReadToolCall pi_read_tool_call = 61;
421
+ PiBashToolCall pi_bash_tool_call = 62;
422
+ PiEditToolCall pi_edit_tool_call = 63;
423
+ PiWriteToolCall pi_write_tool_call = 64;
424
+ PiGrepToolCall pi_grep_tool_call = 65;
425
+ PiFindToolCall pi_find_tool_call = 66;
426
+ PiLsToolCall pi_ls_tool_call = 67;
427
+ ConnectScmToolCall connect_scm_tool_call = 68;
428
+ SearchConversationsToolCall search_conversations_tool_call = 69;
418
429
  }
430
+ // Modern builds carry the call id on the envelope instead of inside each
431
+ // variant's args. Fields 37-53, 55, 56, 58 (further tool variants) and 54
432
+ // (hook_additional_contexts), 59/60 (started_at_ms/completed_at_ms) are not
433
+ // modelled and decode into unknown fields; do not reuse those numbers.
434
+ optional string tool_call_id = 57;
419
435
  }
420
436
 
421
437
  message TruncatedToolCallArgs {
@@ -1098,6 +1114,13 @@ message BackgroundShellSpawnArgs {
1098
1114
  ShellCommandParsingResult parsing_result = 4;
1099
1115
  optional SandboxPolicy sandbox_policy = 5;
1100
1116
  bool enable_write_shell_stdin_tool = 6;
1117
+ optional string description = 7;
1118
+ optional CommandClassifierResult classifier_result = 8;
1119
+ optional ShellOutputNotificationConfig output_notification = 9;
1120
+ optional SmartModeApproval smart_mode_approval = 10;
1121
+ optional ShellHookApprovalRequirement hook_approval_requirement = 11;
1122
+ bool skip_approval = 12;
1123
+ optional string conversation_id = 13;
1101
1124
  }
1102
1125
 
1103
1126
  // Result of spawning a background shell
@@ -1646,6 +1669,7 @@ message ExecClientThrow {
1646
1669
  uint32 id = 1;
1647
1670
  string error = 2;
1648
1671
  optional string stack_trace = 3;
1672
+ optional string error_code = 4;
1649
1673
  }
1650
1674
 
1651
1675
  message ExecClientHeartbeat {
@@ -1703,7 +1727,31 @@ message ExecServerMessage {
1703
1727
  RecordScreenArgs record_screen_args = 21;
1704
1728
  ComputerUseArgs computer_use_args = 22;
1705
1729
  WriteShellStdinArgs write_shell_stdin_args = 23;
1730
+ ReadArgs redacted_read_args = 29;
1731
+ McpStateExecArgs mcp_state_exec_args = 36;
1732
+ ExecuteHookArgs execute_hook_args = 27;
1733
+ SubagentArgs subagent_args = 28;
1734
+ ForceBackgroundShellArgs force_background_shell_args = 30;
1735
+ ForceBackgroundSubagentArgs force_background_subagent_args = 31;
1736
+ SubagentAwaitArgs subagent_await_args = 37;
1737
+ SmartModeClassifierArgs smart_mode_classifier_args = 38;
1738
+ CanvasDiagnosticsArgs canvas_diagnostics_args = 40;
1739
+ ShellAllowlistPrecheckArgs shell_allowlist_precheck_args = 41;
1740
+ McpAllowlistPrecheckArgs mcp_allowlist_precheck_args = 42;
1741
+ WebFetchAllowlistPrecheckArgs web_fetch_allowlist_precheck_args = 43;
1742
+ GetDiffRequest git_diff_request = 44;
1743
+ PiReadExecArgs pi_read_args = 45;
1744
+ PiBashExecArgs pi_bash_args = 46;
1745
+ PiEditExecArgs pi_edit_args = 47;
1746
+ PiWriteExecArgs pi_write_args = 48;
1747
+ PiGrepExecArgs pi_grep_args = 49;
1748
+ PiFindExecArgs pi_find_args = 50;
1749
+ PiLsExecArgs pi_ls_args = 51;
1750
+ ShellArgs mini_swe_agent_bash_args = 52;
1751
+ ConversationSearchArgs conversation_search_args = 53;
1752
+ AgentStoreConflictArgs agent_store_conflict_args = 54;
1706
1753
  }
1754
+ optional bool accept_hook_additional_contexts = 55;
1707
1755
  }
1708
1756
 
1709
1757
  message ExecClientMessage {
@@ -1728,7 +1776,32 @@ message ExecClientMessage {
1728
1776
  RecordScreenResult record_screen_result = 21;
1729
1777
  ComputerUseResult computer_use_result = 22;
1730
1778
  WriteShellStdinResult write_shell_stdin_result = 23;
1779
+ ReadResult redacted_read_result = 29;
1780
+ McpStateExecResult mcp_state_exec_result = 36;
1781
+ ExecuteHookResult execute_hook_result = 27;
1782
+ SubagentResult subagent_result = 28;
1783
+ ForceBackgroundShellResult force_background_shell_result = 30;
1784
+ ForceBackgroundSubagentResult force_background_subagent_result = 31;
1785
+ SubagentAwaitResult subagent_await_result = 37;
1786
+ SmartModeClassifierResult smart_mode_classifier_result = 38;
1787
+ CanvasDiagnosticsResult canvas_diagnostics_result = 40;
1788
+ ShellAllowlistPrecheckResult shell_allowlist_precheck_result = 41;
1789
+ McpAllowlistPrecheckResult mcp_allowlist_precheck_result = 42;
1790
+ WebFetchAllowlistPrecheckResult web_fetch_allowlist_precheck_result = 43;
1791
+ GetDiffResponse git_diff_response = 44;
1792
+ PiReadExecResult pi_read_result = 46;
1793
+ PiBashExecResult pi_bash_result = 47;
1794
+ PiEditExecResult pi_edit_result = 48;
1795
+ PiWriteExecResult pi_write_result = 49;
1796
+ PiGrepExecResult pi_grep_result = 50;
1797
+ PiFindExecResult pi_find_result = 51;
1798
+ PiLsExecResult pi_ls_result = 52;
1799
+ ConversationSearchResult conversation_search_result = 53;
1800
+ AgentStoreConflictResult agent_store_conflict_result = 54;
1801
+ ShellResult mini_swe_agent_bash_result = 55;
1731
1802
  }
1803
+ optional int32 local_execution_time_ms = 39;
1804
+ repeated HookAdditionalContext hook_additional_contexts = 45;
1732
1805
  }
1733
1806
 
1734
1807
  message FetchArgs {
@@ -1807,6 +1880,7 @@ message GrepArgs {
1807
1880
  optional bool sort_ascending = 13;
1808
1881
  string tool_call_id = 14;
1809
1882
  optional SandboxPolicy sandbox_policy = 15;
1883
+ optional int32 offset = 16;
1810
1884
  }
1811
1885
 
1812
1886
  message GrepResult {
@@ -1848,6 +1922,8 @@ message GrepCountResult {
1848
1922
  bool client_truncated = 4;
1849
1923
  // true if we truncated the output from the ripgrep call itself
1850
1924
  bool ripgrep_truncated = 5;
1925
+ optional int32 head_limit_applied = 6;
1926
+ optional int32 offset_applied = 7;
1851
1927
  }
1852
1928
 
1853
1929
  message GrepFileCount {
@@ -1864,6 +1940,8 @@ message GrepFilesResult {
1864
1940
  bool client_truncated = 3;
1865
1941
  // true if we truncated the output from the ripgrep call itself
1866
1942
  bool ripgrep_truncated = 4;
1943
+ optional int32 head_limit_applied = 5;
1944
+ optional int32 offset_applied = 6;
1867
1945
  }
1868
1946
 
1869
1947
  message GrepContentResult {
@@ -1877,6 +1955,8 @@ message GrepContentResult {
1877
1955
  bool client_truncated = 4;
1878
1956
  // true if we truncated the output from the ripgrep call itself
1879
1957
  bool ripgrep_truncated = 5;
1958
+ optional int32 head_limit_applied = 6;
1959
+ optional int32 offset_applied = 7;
1880
1960
  }
1881
1961
 
1882
1962
  message GrepFileMatch {
@@ -2014,6 +2094,10 @@ message McpArgs {
2014
2094
  string tool_call_id = 3;
2015
2095
  string provider_identifier = 4;
2016
2096
  string tool_name = 5;
2097
+ optional SmartModeApproval smart_mode_approval = 6;
2098
+ bool smart_mode_approval_only = 7;
2099
+ bool skip_approval = 8;
2100
+ string server_identifier = 9;
2017
2101
  }
2018
2102
 
2019
2103
  message McpResult {
@@ -2023,6 +2107,8 @@ message McpResult {
2023
2107
  McpRejected rejected = 3;
2024
2108
  McpPermissionDenied permission_denied = 4;
2025
2109
  McpToolNotFound tool_not_found = 5;
2110
+ McpServerNotFound server_not_found = 6;
2111
+ McpApproved approved = 7;
2026
2112
  }
2027
2113
  }
2028
2114
 
@@ -2120,6 +2206,8 @@ message ReadMcpResourceExecArgs {
2120
2206
  string uri = 2;
2121
2207
  // Optional: when set, the resource will be downloaded to this path relative to the workspace, and the content will not be returned to the model.
2122
2208
  optional string download_path = 3;
2209
+ string tool_call_id = 4;
2210
+ optional SmartModeApproval smart_mode_approval = 5;
2123
2211
  }
2124
2212
 
2125
2213
  // Read MCP resource exec result
@@ -2145,6 +2233,7 @@ message ReadMcpResourceSuccess {
2145
2233
  string text = 5;
2146
2234
  bytes blob = 6;
2147
2235
  }
2236
+ optional OutputLocation output_location = 9;
2148
2237
  }
2149
2238
 
2150
2239
  message ReadMcpResourceError {
@@ -2167,6 +2256,7 @@ message McpToolDefinition {
2167
2256
  string tool_name = 5;
2168
2257
  string description = 2;
2169
2258
  bytes input_schema = 3;
2259
+ optional string input_schema_json = 6;
2170
2260
  }
2171
2261
 
2172
2262
  message McpTools {
@@ -2177,6 +2267,7 @@ message McpTools {
2177
2267
  message McpInstructions {
2178
2268
  string server_name = 1;
2179
2269
  string instructions = 2;
2270
+ string server_identifier = 3;
2180
2271
  }
2181
2272
 
2182
2273
  message McpDescriptor {
@@ -2187,11 +2278,17 @@ message McpDescriptor {
2187
2278
  optional string folder_path = 3;
2188
2279
  optional string server_use_instructions = 4;
2189
2280
  repeated McpToolDescriptor tools = 5;
2281
+ optional string plugin = 7;
2282
+ optional string marketplace = 8;
2283
+ optional string plugin_db_id = 9;
2284
+ optional string marketplace_id = 10;
2190
2285
  }
2191
2286
 
2192
2287
  message McpToolDescriptor {
2193
2288
  string tool_name = 1;
2194
2289
  optional string definition_path = 2;
2290
+ optional string description = 3;
2291
+ optional string input_schema_json = 5;
2195
2292
  }
2196
2293
 
2197
2294
  message McpFileSystemOptions {
@@ -2203,6 +2300,9 @@ message McpFileSystemOptions {
2203
2300
  message ReadArgs {
2204
2301
  string path = 1;
2205
2302
  string tool_call_id = 2;
2303
+ optional int32 offset = 4;
2304
+ optional uint32 limit = 5;
2305
+ optional string encoding_hint = 6;
2206
2306
  }
2207
2307
 
2208
2308
  message ReadResult {
@@ -2228,6 +2328,7 @@ message ReadSuccess {
2228
2328
  string content = 2;
2229
2329
  bytes data = 5;
2230
2330
  }
2331
+ bool range_applied = 8;
2231
2332
  }
2232
2333
 
2233
2334
  message ReadError {
@@ -2376,6 +2477,9 @@ message RepositoryIndexingInfo {
2376
2477
  message RequestContextArgs {
2377
2478
  optional string notes_session_id = 2;
2378
2479
  optional string workspace_id = 3;
2480
+ optional string read_only_pinned_tree_sha = 4;
2481
+ optional string read_only_plugin_cache_root = 5;
2482
+ optional bool use_cached = 7;
2379
2483
  }
2380
2484
 
2381
2485
  message RequestContextResult {
@@ -2388,6 +2492,7 @@ message RequestContextResult {
2388
2492
 
2389
2493
  message RequestContextSuccess {
2390
2494
  RequestContext request_context = 1;
2495
+ optional bool served_from_disk_cache = 2;
2391
2496
  }
2392
2497
 
2393
2498
  message RequestContextError {
@@ -2807,6 +2912,8 @@ message ShellCommandParsingResult {
2807
2912
  repeated ShellCommandParsingResult_ExecutableCommand executable_commands = 2;
2808
2913
  bool has_redirects = 3;
2809
2914
  bool has_command_substitution = 4;
2915
+ optional bool all_redirects_are_dev_null = 5;
2916
+ repeated ShellCommandParsingResult_Redirect redirects = 6;
2810
2917
  }
2811
2918
 
2812
2919
  message ShellCommandParsingResult_ExecutableCommandArg {
@@ -2838,6 +2945,13 @@ message ShellArgs {
2838
2945
  int32 timeout_behavior = 13;
2839
2946
  // Hard timeout: kill the command after this many ms, even if running in background
2840
2947
  optional int32 hard_timeout = 14;
2948
+ optional string description = 15;
2949
+ optional CommandClassifierResult classifier_result = 16;
2950
+ bool close_stdin = 17;
2951
+ optional ShellOutputNotificationConfig output_notification = 18;
2952
+ optional SmartModeApproval smart_mode_approval = 19;
2953
+ optional ShellHookApprovalRequirement hook_approval_requirement = 20;
2954
+ optional string conversation_id = 21;
2841
2955
  }
2842
2956
 
2843
2957
  message ShellResult {
@@ -2873,6 +2987,7 @@ message ShellStreamExit {
2873
2987
  bool aborted = 4;
2874
2988
  // If aborted is true, this field indicates the reason for the abort
2875
2989
  optional int32 abort_reason = 5;
2990
+ optional int32 local_execution_time_ms = 6;
2876
2991
  }
2877
2992
 
2878
2993
  message ShellStreamStart {
@@ -2886,6 +3001,7 @@ message ShellStreamBackgrounded {
2886
3001
  optional uint32 pid = 4;
2887
3002
  // The ms_to_wait value that was used for backgrounding, for display purposes
2888
3003
  optional int32 ms_to_wait = 5;
3004
+ optional ShellBackgroundReason reason = 6;
2889
3005
  }
2890
3006
 
2891
3007
  message ShellStream {
@@ -2897,6 +3013,7 @@ message ShellStream {
2897
3013
  ShellRejected rejected = 5;
2898
3014
  ShellPermissionDenied permission_denied = 6;
2899
3015
  ShellStreamBackgrounded backgrounded = 7;
3016
+ ShellStreamHookContext hook_context = 8;
2900
3017
  }
2901
3018
  }
2902
3019
 
@@ -2928,6 +3045,11 @@ message ShellSuccess {
2928
3045
  optional uint32 pid = 11;
2929
3046
  // The ms_to_wait value used for backgrounding (for display in result)
2930
3047
  optional int32 ms_to_wait = 12;
3048
+ optional int32 local_execution_time_ms = 13;
3049
+ optional ShellBackgroundReason background_reason = 14;
3050
+ optional string output_head = 15;
3051
+ optional string output_tail = 16;
3052
+ optional uint32 elided_chars = 17;
2931
3053
  }
2932
3054
 
2933
3055
  message ShellFailure {
@@ -2947,6 +3069,10 @@ message ShellFailure {
2947
3069
  optional int32 abort_reason = 10;
2948
3070
  // Whether the command was aborted (by user or timeout)
2949
3071
  bool aborted = 11;
3072
+ optional int32 local_execution_time_ms = 12;
3073
+ optional string output_head = 13;
3074
+ optional string output_tail = 14;
3075
+ optional uint32 elided_chars = 15;
2950
3076
  }
2951
3077
 
2952
3078
  message ShellTimeout {
@@ -3242,6 +3368,7 @@ message WriteArgs {
3242
3368
  bool return_file_content_after_write = 4;
3243
3369
  // Raw binary data to write. When set, file_text is ignored and the bytes are written directly without any text processing (e.g., line ending normalization).
3244
3370
  bytes file_bytes = 5;
3371
+ optional string encoding_hint = 6;
3245
3372
  }
3246
3373
 
3247
3374
  message WriteResult {
@@ -3524,3 +3651,883 @@ service LifecycleService {
3524
3651
  // Asks worker to exit(0) so that a new worker can take his place
3525
3652
  rpc RenewInstance(Empty) returns (Empty);
3526
3653
  }
3654
+
3655
+ // ===== Pi exec tools (modern Cursor CLI, ExecServerMessage 45-51) =====
3656
+
3657
+ message PiTruncation {
3658
+ bool truncated = 1;
3659
+ string truncated_by = 2;
3660
+ uint32 total_lines = 3;
3661
+ uint32 output_lines = 4;
3662
+ uint32 output_bytes = 5;
3663
+ optional uint32 max_lines = 6;
3664
+ optional uint32 max_bytes = 7;
3665
+ bool first_line_exceeds_limit = 8;
3666
+ bool last_line_partial = 9;
3667
+ }
3668
+
3669
+ message PiEditReplacement {
3670
+ string old_text = 1;
3671
+ string new_text = 2;
3672
+ }
3673
+
3674
+ message PiReadExecArgs {
3675
+ string path = 1;
3676
+ optional int32 offset = 2;
3677
+ optional int32 limit = 3;
3678
+ }
3679
+
3680
+ message PiReadExecSuccess {
3681
+ string output = 1;
3682
+ optional PiTruncation truncation = 2;
3683
+ }
3684
+
3685
+ message PiReadExecError {
3686
+ string error = 1;
3687
+ }
3688
+
3689
+ message PiReadExecResult {
3690
+ oneof result {
3691
+ PiReadExecSuccess success = 1;
3692
+ PiReadExecError error = 2;
3693
+ }
3694
+ }
3695
+
3696
+ message PiBashExecArgs {
3697
+ string command = 1;
3698
+ optional double timeout = 2;
3699
+ }
3700
+
3701
+ message PiBashExecSuccess {
3702
+ string output = 1;
3703
+ optional PiTruncation truncation = 2;
3704
+ optional string full_output_path = 3;
3705
+ }
3706
+
3707
+ message PiBashExecError {
3708
+ string error = 1;
3709
+ optional PiTruncation truncation = 2;
3710
+ optional string full_output_path = 3;
3711
+ }
3712
+
3713
+ message PiBashExecResult {
3714
+ oneof result {
3715
+ PiBashExecSuccess success = 1;
3716
+ PiBashExecError error = 2;
3717
+ }
3718
+ }
3719
+
3720
+ message PiEditExecArgs {
3721
+ string path = 1;
3722
+ repeated PiEditReplacement edits = 2;
3723
+ }
3724
+
3725
+ message PiEditExecSuccess {
3726
+ string output = 1;
3727
+ string diff = 2;
3728
+ string patch = 3;
3729
+ optional uint32 first_changed_line = 4;
3730
+ }
3731
+
3732
+ message PiEditExecError {
3733
+ string error = 1;
3734
+ }
3735
+
3736
+ message PiEditExecRejected {
3737
+ string reason = 1;
3738
+ }
3739
+
3740
+ message PiEditExecResult {
3741
+ oneof result {
3742
+ PiEditExecSuccess success = 1;
3743
+ PiEditExecError error = 2;
3744
+ PiEditExecRejected rejected = 3;
3745
+ }
3746
+ }
3747
+
3748
+ message PiWriteExecArgs {
3749
+ string path = 1;
3750
+ string content = 2;
3751
+ }
3752
+
3753
+ message PiWriteExecSuccess {
3754
+ string output = 1;
3755
+ }
3756
+
3757
+ message PiWriteExecError {
3758
+ string error = 1;
3759
+ }
3760
+
3761
+ message PiWriteExecRejected {
3762
+ string reason = 1;
3763
+ }
3764
+
3765
+ message PiWriteExecResult {
3766
+ oneof result {
3767
+ PiWriteExecSuccess success = 1;
3768
+ PiWriteExecError error = 2;
3769
+ PiWriteExecRejected rejected = 3;
3770
+ }
3771
+ }
3772
+
3773
+ message PiGrepExecArgs {
3774
+ string pattern = 1;
3775
+ optional string path = 2;
3776
+ optional string glob = 3;
3777
+ optional bool ignore_case = 4;
3778
+ optional bool literal = 5;
3779
+ optional int32 context = 6;
3780
+ optional int32 limit = 7;
3781
+ }
3782
+
3783
+ message PiGrepExecSuccess {
3784
+ string output = 1;
3785
+ optional PiTruncation truncation = 2;
3786
+ optional uint32 match_limit_reached = 3;
3787
+ bool lines_truncated = 4;
3788
+ }
3789
+
3790
+ message PiGrepExecError {
3791
+ string error = 1;
3792
+ }
3793
+
3794
+ message PiGrepExecResult {
3795
+ oneof result {
3796
+ PiGrepExecSuccess success = 1;
3797
+ PiGrepExecError error = 2;
3798
+ }
3799
+ }
3800
+
3801
+ message PiFindExecArgs {
3802
+ string pattern = 1;
3803
+ optional string path = 2;
3804
+ optional int32 limit = 3;
3805
+ }
3806
+
3807
+ message PiFindExecSuccess {
3808
+ string output = 1;
3809
+ optional PiTruncation truncation = 2;
3810
+ optional uint32 result_limit_reached = 3;
3811
+ }
3812
+
3813
+ message PiFindExecError {
3814
+ string error = 1;
3815
+ }
3816
+
3817
+ message PiFindExecResult {
3818
+ oneof result {
3819
+ PiFindExecSuccess success = 1;
3820
+ PiFindExecError error = 2;
3821
+ }
3822
+ }
3823
+
3824
+ message PiLsExecArgs {
3825
+ optional string path = 1;
3826
+ optional int32 limit = 2;
3827
+ }
3828
+
3829
+ message PiLsExecSuccess {
3830
+ string output = 1;
3831
+ optional PiTruncation truncation = 2;
3832
+ optional uint32 entry_limit_reached = 3;
3833
+ }
3834
+
3835
+ message PiLsExecError {
3836
+ string error = 1;
3837
+ }
3838
+
3839
+ message PiLsExecResult {
3840
+ oneof result {
3841
+ PiLsExecSuccess success = 1;
3842
+ PiLsExecError error = 2;
3843
+ }
3844
+ }
3845
+
3846
+ // ===== MCP (modern) =====
3847
+
3848
+ message McpServerNotFound {
3849
+ string name = 1;
3850
+ repeated string available_servers = 2;
3851
+ }
3852
+
3853
+ message McpApproved {
3854
+ }
3855
+
3856
+ message McpStateExecArgs {
3857
+ repeated string server_identifiers = 1;
3858
+ bool kick_only = 2;
3859
+ }
3860
+
3861
+ message McpStateServer {
3862
+ string server_name = 1;
3863
+ string server_identifier = 2;
3864
+ optional string plugin = 3;
3865
+ optional string marketplace = 4;
3866
+ repeated McpToolDefinition tools = 5;
3867
+ repeated McpInstructions instructions = 6;
3868
+ optional string status = 7;
3869
+ }
3870
+
3871
+ message McpStateSuccess {
3872
+ repeated McpStateServer servers = 1;
3873
+ }
3874
+
3875
+ message McpStateError {
3876
+ string error = 1;
3877
+ }
3878
+
3879
+ message McpStateRejected {
3880
+ string reason = 1;
3881
+ }
3882
+
3883
+ message McpStateExecResult {
3884
+ oneof result {
3885
+ McpStateSuccess success = 1;
3886
+ McpStateError error = 2;
3887
+ McpStateRejected rejected = 3;
3888
+ }
3889
+ }
3890
+
3891
+ // ===== Allowlist prechecks =====
3892
+
3893
+ enum CommandClassifierResult_SuggestedSandboxMode {
3894
+ SUGGESTED_SANDBOX_MODE_UNSPECIFIED = 0;
3895
+ SUGGESTED_SANDBOX_MODE_SANDBOX = 1;
3896
+ SUGGESTED_SANDBOX_MODE_NO_SANDBOX = 2;
3897
+ SUGGESTED_SANDBOX_MODE_UNDETERMINED = 3;
3898
+ }
3899
+
3900
+ message CommandClassifierResult_ClassifiedCommand {
3901
+ string name = 1;
3902
+ repeated string arguments = 2;
3903
+ optional string suggested_allowlist_entry = 3;
3904
+ repeated string subcommand_tokens = 4;
3905
+ }
3906
+
3907
+ message CommandClassifierResult {
3908
+ repeated CommandClassifierResult_ClassifiedCommand commands = 1;
3909
+ CommandClassifierResult_SuggestedSandboxMode suggested_sandbox_mode = 2;
3910
+ bool classification_failed = 3;
3911
+ }
3912
+
3913
+ message ShellCommandParsingResult_Redirect {
3914
+ string operator = 1;
3915
+ repeated uint32 destination_fds = 2;
3916
+ string target_node_type = 3;
3917
+ optional string target_text = 4;
3918
+ }
3919
+
3920
+ message ShellAllowlistPrecheckArgs {
3921
+ string command = 1;
3922
+ string working_directory = 2;
3923
+ ShellCommandParsingResult parsing_result = 3;
3924
+ optional CommandClassifierResult classifier_result = 4;
3925
+ optional string tool_call_id = 5;
3926
+ }
3927
+
3928
+ message ShellAllowlistPrecheckResult {
3929
+ bool allowlisted = 1;
3930
+ }
3931
+
3932
+ message McpAllowlistPrecheckArgs {
3933
+ string provider_identifier = 1;
3934
+ string tool_name = 2;
3935
+ optional string tool_call_id = 3;
3936
+ }
3937
+
3938
+ message McpAllowlistPrecheckResult {
3939
+ bool allowlisted = 1;
3940
+ }
3941
+
3942
+ message WebFetchAllowlistPrecheckArgs {
3943
+ string url = 1;
3944
+ optional string tool_call_id = 2;
3945
+ }
3946
+
3947
+ message WebFetchAllowlistPrecheckResult {
3948
+ bool allowlisted = 1;
3949
+ }
3950
+
3951
+ // ===== Shell (modern additions) =====
3952
+
3953
+ message SmartModeApproval {
3954
+ string request_id = 1;
3955
+ string reason = 2;
3956
+ }
3957
+
3958
+ message ShellOutputNotificationConfig {
3959
+ string pattern = 1;
3960
+ string reason = 2;
3961
+ optional double debounce = 3;
3962
+ optional int32 notification_limit = 4;
3963
+ }
3964
+
3965
+ enum ShellHookApprovalRequirement_Kind {
3966
+ SHELL_HOOK_APPROVAL_REQUIREMENT_KIND_UNSPECIFIED = 0;
3967
+ SHELL_HOOK_APPROVAL_REQUIREMENT_KIND_FORCE_PROMPT = 1;
3968
+ }
3969
+
3970
+ message ShellHookApprovalRequirement {
3971
+ ShellHookApprovalRequirement_Kind kind = 1;
3972
+ optional string reason = 2;
3973
+ }
3974
+
3975
+ enum ShellBackgroundReason {
3976
+ SHELL_BACKGROUND_REASON_UNSPECIFIED = 0;
3977
+ SHELL_BACKGROUND_REASON_TIMEOUT = 1;
3978
+ SHELL_BACKGROUND_REASON_USER_REQUEST = 2;
3979
+ }
3980
+
3981
+ enum ForceBackgroundShellStatus {
3982
+ FORCE_BACKGROUND_SHELL_STATUS_UNSPECIFIED = 0;
3983
+ FORCE_BACKGROUND_SHELL_STATUS_ACCEPTED = 1;
3984
+ FORCE_BACKGROUND_SHELL_STATUS_NOT_FOUND = 2;
3985
+ }
3986
+
3987
+ message ForceBackgroundShellArgs {
3988
+ string tool_call_id = 1;
3989
+ }
3990
+
3991
+ message ForceBackgroundShellResult {
3992
+ ForceBackgroundShellStatus status = 1;
3993
+ optional ShellResult shell_result = 2;
3994
+ }
3995
+
3996
+ message HookAdditionalContext {
3997
+ string hook_event_name = 1;
3998
+ string content = 2;
3999
+ }
4000
+
4001
+ message ShellStreamHookContext {
4002
+ repeated HookAdditionalContext hook_additional_contexts = 1;
4003
+ }
4004
+
4005
+ // ===== Subagents =====
4006
+
4007
+ enum SubagentBackgroundReason {
4008
+ SUBAGENT_BACKGROUND_REASON_UNSPECIFIED = 0;
4009
+ SUBAGENT_BACKGROUND_REASON_AGENT_REQUEST = 1;
4010
+ SUBAGENT_BACKGROUND_REASON_USER_REQUEST = 2;
4011
+ SUBAGENT_BACKGROUND_REASON_QUEUED_FOLLOW_UP = 3;
4012
+ }
4013
+
4014
+ enum ForceBackgroundSubagentStatus {
4015
+ FORCE_BACKGROUND_SUBAGENT_STATUS_UNSPECIFIED = 0;
4016
+ FORCE_BACKGROUND_SUBAGENT_STATUS_ACCEPTED = 1;
4017
+ FORCE_BACKGROUND_SUBAGENT_STATUS_NOT_FOUND = 2;
4018
+ }
4019
+
4020
+ // Subset: only the fields this client reads. Upstream also defines model_id=3, readonly=5,
4021
+ // resume_agent_id=6, run_in_background=7, continuation_config=8, parent_conversation_id=9,
4022
+ // credentials 10-12, interrupt=13, mode=14, fork_agent_id=15, root_parent_conversation_id=16,
4023
+ // selected_context=17, direct_meta_parent_child_subagent=18, environment=19, cloud_base_branch=20.
4024
+ // Those decode into unknown fields; do not reuse these numbers.
4025
+ message SubagentArgs {
4026
+ string tool_call_id = 1;
4027
+ string subagent_type = 2;
4028
+ string prompt = 4;
4029
+ }
4030
+
4031
+ message SubagentSuccess {
4032
+ string agent_id = 1;
4033
+ optional string final_message = 2;
4034
+ int32 tool_call_count = 3;
4035
+ SubagentBackgroundReason background_reason = 4;
4036
+ optional string transcript_path = 5;
4037
+ }
4038
+
4039
+ message SubagentError {
4040
+ optional string agent_id = 1;
4041
+ string error = 2;
4042
+ }
4043
+
4044
+ message SubagentResult {
4045
+ oneof result {
4046
+ SubagentSuccess success = 1;
4047
+ SubagentError error = 2;
4048
+ }
4049
+ }
4050
+
4051
+ message SubagentAwaitArgs {
4052
+ string agent_id = 1;
4053
+ uint32 timeout_ms = 2;
4054
+ }
4055
+
4056
+ message SubagentAwaitComplete {
4057
+ string agent_id = 1;
4058
+ optional string transcript_path = 2;
4059
+ int32 tool_call_count = 3;
4060
+ optional string final_message = 4;
4061
+ }
4062
+
4063
+ message SubagentAwaitStillRunning {
4064
+ string agent_id = 1;
4065
+ optional string transcript_path = 2;
4066
+ }
4067
+
4068
+ message SubagentAwaitNotFound {
4069
+ string agent_id = 1;
4070
+ }
4071
+
4072
+ message SubagentAwaitError {
4073
+ optional string agent_id = 1;
4074
+ string error = 2;
4075
+ }
4076
+
4077
+ message SubagentAwaitResult {
4078
+ oneof result {
4079
+ SubagentAwaitComplete complete = 1;
4080
+ SubagentAwaitStillRunning still_running = 2;
4081
+ SubagentAwaitNotFound not_found = 3;
4082
+ SubagentAwaitError error = 4;
4083
+ }
4084
+ }
4085
+
4086
+ message ForceBackgroundSubagentArgs {
4087
+ string tool_call_id = 1;
4088
+ }
4089
+
4090
+ message ForceBackgroundSubagentResult {
4091
+ ForceBackgroundSubagentStatus status = 1;
4092
+ }
4093
+
4094
+ // ===== Hooks =====
4095
+
4096
+ // Payload not modelled: this client runs no Cursor hooks and only reads the oneof case.
4097
+ message PreCompactRequestQuery {
4098
+ }
4099
+
4100
+ // Payload not modelled: this client runs no Cursor hooks and only reads the oneof case.
4101
+ message SubagentStartRequestQuery {
4102
+ }
4103
+
4104
+ // Payload not modelled: this client runs no Cursor hooks and only reads the oneof case.
4105
+ message SubagentStopRequestQuery {
4106
+ }
4107
+
4108
+ // Payload not modelled: this client runs no Cursor hooks and only reads the oneof case.
4109
+ message PreToolUseRequestQuery {
4110
+ }
4111
+
4112
+ // Payload not modelled: this client runs no Cursor hooks and only reads the oneof case.
4113
+ message PostToolUseRequestQuery {
4114
+ }
4115
+
4116
+ // Payload not modelled: this client runs no Cursor hooks and only reads the oneof case.
4117
+ message PostToolUseFailureRequestQuery {
4118
+ }
4119
+
4120
+ // Payload not modelled: this client runs no Cursor hooks and only reads the oneof case.
4121
+ message BeforeSubmitPromptRequestQuery {
4122
+ }
4123
+
4124
+ // Payload not modelled: this client runs no Cursor hooks and only reads the oneof case.
4125
+ message AfterAgentResponseRequestQuery {
4126
+ }
4127
+
4128
+ // Payload not modelled: this client runs no Cursor hooks and only reads the oneof case.
4129
+ message AfterAgentThoughtRequestQuery {
4130
+ }
4131
+
4132
+ // Payload not modelled: this client runs no Cursor hooks and only reads the oneof case.
4133
+ message StopRequestQuery {
4134
+ }
4135
+
4136
+ message PreCompactRequestResponse {
4137
+ optional string user_message = 1;
4138
+ }
4139
+
4140
+ message SubagentStartRequestResponse {
4141
+ optional string permission = 1;
4142
+ optional string user_message = 2;
4143
+ optional string additional_context = 3;
4144
+ }
4145
+
4146
+ message SubagentStopRequestResponse {
4147
+ optional string followup_message = 1;
4148
+ optional string additional_context = 2;
4149
+ }
4150
+
4151
+ message PreToolUseRequestResponse {
4152
+ optional string permission = 1;
4153
+ optional string user_message = 2;
4154
+ optional string agent_message = 3;
4155
+ optional string updated_input = 4;
4156
+ optional string additional_context = 5;
4157
+ }
4158
+
4159
+ message PostToolUseRequestResponse {
4160
+ optional string additional_context = 1;
4161
+ }
4162
+
4163
+ message PostToolUseFailureRequestResponse {
4164
+ optional string additional_context = 1;
4165
+ }
4166
+
4167
+ message BeforeSubmitPromptRequestResponse {
4168
+ optional bool continue = 1;
4169
+ optional string user_message = 2;
4170
+ optional string additional_context = 3;
4171
+ }
4172
+
4173
+ message AfterAgentResponseRequestResponse {
4174
+ }
4175
+
4176
+ message AfterAgentThoughtRequestResponse {
4177
+ }
4178
+
4179
+ message StopRequestResponse {
4180
+ optional string followup_message = 1;
4181
+ }
4182
+
4183
+ message ExecuteHookRequest {
4184
+ oneof request {
4185
+ PreCompactRequestQuery pre_compact = 1;
4186
+ SubagentStartRequestQuery subagent_start = 2;
4187
+ SubagentStopRequestQuery subagent_stop = 3;
4188
+ PreToolUseRequestQuery pre_tool_use = 4;
4189
+ PostToolUseRequestQuery post_tool_use = 5;
4190
+ PostToolUseFailureRequestQuery post_tool_use_failure = 6;
4191
+ BeforeSubmitPromptRequestQuery before_submit_prompt = 7;
4192
+ AfterAgentResponseRequestQuery after_agent_response = 8;
4193
+ AfterAgentThoughtRequestQuery after_agent_thought = 9;
4194
+ StopRequestQuery stop = 11;
4195
+ }
4196
+ }
4197
+
4198
+ message ExecuteHookResponse {
4199
+ oneof response {
4200
+ PreCompactRequestResponse pre_compact = 1;
4201
+ SubagentStartRequestResponse subagent_start = 2;
4202
+ SubagentStopRequestResponse subagent_stop = 3;
4203
+ PreToolUseRequestResponse pre_tool_use = 4;
4204
+ PostToolUseRequestResponse post_tool_use = 5;
4205
+ PostToolUseFailureRequestResponse post_tool_use_failure = 6;
4206
+ BeforeSubmitPromptRequestResponse before_submit_prompt = 7;
4207
+ AfterAgentResponseRequestResponse after_agent_response = 8;
4208
+ AfterAgentThoughtRequestResponse after_agent_thought = 9;
4209
+ StopRequestResponse stop = 11;
4210
+ }
4211
+ }
4212
+
4213
+ message ExecuteHookArgs {
4214
+ ExecuteHookRequest request = 1;
4215
+ }
4216
+
4217
+ message ExecuteHookResult {
4218
+ ExecuteHookResponse response = 1;
4219
+ }
4220
+
4221
+ // ===== Smart-mode classifier =====
4222
+
4223
+ enum SmartModeClassifierDecision {
4224
+ SMART_MODE_CLASSIFIER_DECISION_UNSPECIFIED = 0;
4225
+ SMART_MODE_CLASSIFIER_DECISION_ALLOW = 1;
4226
+ SMART_MODE_CLASSIFIER_DECISION_BLOCK = 2;
4227
+ }
4228
+
4229
+ // Subset: arguments=2 (google.protobuf.Struct) decodes into unknown fields; do not reuse.
4230
+ message SmartModeRiskTarget {
4231
+ string action = 1;
4232
+ }
4233
+
4234
+ message SmartModeClassifierConversationMessage {
4235
+ string role = 1;
4236
+ string content = 2;
4237
+ }
4238
+
4239
+ message SmartModeClassifierArgs {
4240
+ string tool_call_id = 1;
4241
+ optional string parent_conversation_id = 2;
4242
+ SmartModeRiskTarget target = 3;
4243
+ repeated SmartModeClassifierConversationMessage conversation_context = 4;
4244
+ }
4245
+
4246
+ message SmartModeClassifierSuccess {
4247
+ SmartModeClassifierDecision decision = 1;
4248
+ optional string block_reason = 2;
4249
+ }
4250
+
4251
+ message SmartModeClassifierError {
4252
+ string error = 1;
4253
+ }
4254
+
4255
+ message SmartModeClassifierResult {
4256
+ oneof result {
4257
+ SmartModeClassifierSuccess success = 1;
4258
+ SmartModeClassifierError error = 2;
4259
+ }
4260
+ }
4261
+
4262
+ // ===== Canvas diagnostics =====
4263
+
4264
+ message CanvasDiagnosticsArgs {
4265
+ string path = 1;
4266
+ string tool_call_id = 2;
4267
+ }
4268
+
4269
+ message CanvasDiagnosticsSuccess {
4270
+ string path = 1;
4271
+ repeated Diagnostic diagnostics = 2;
4272
+ }
4273
+
4274
+ message CanvasDiagnosticsError {
4275
+ string path = 1;
4276
+ string error = 2;
4277
+ }
4278
+
4279
+ message CanvasDiagnosticsResult {
4280
+ oneof result {
4281
+ CanvasDiagnosticsSuccess success = 1;
4282
+ CanvasDiagnosticsError error = 2;
4283
+ }
4284
+ }
4285
+
4286
+ // ===== Conversation search =====
4287
+
4288
+ enum ConversationSearchSource {
4289
+ CONVERSATION_SEARCH_SOURCE_UNSPECIFIED = 0;
4290
+ CONVERSATION_SEARCH_SOURCE_LOCAL = 1;
4291
+ CONVERSATION_SEARCH_SOURCE_CLOUD_CACHE = 2;
4292
+ }
4293
+
4294
+ message ConversationSearchHit {
4295
+ string conversation_id = 1;
4296
+ string title = 2;
4297
+ ConversationSearchSource source = 3;
4298
+ int64 updated_at_ms = 4;
4299
+ optional string snippet = 5;
4300
+ }
4301
+
4302
+ message ConversationSearchSuccess {
4303
+ repeated ConversationSearchHit hits = 1;
4304
+ bool truncated = 2;
4305
+ bool partial = 3;
4306
+ bool rebuilding = 4;
4307
+ }
4308
+
4309
+ message ConversationSearchError {
4310
+ string error = 1;
4311
+ }
4312
+
4313
+ message ConversationSearchArgs {
4314
+ string query = 1;
4315
+ string tool_call_id = 2;
4316
+ optional int32 limit = 3;
4317
+ }
4318
+
4319
+ message ConversationSearchResult {
4320
+ oneof result {
4321
+ ConversationSearchSuccess success = 1;
4322
+ ConversationSearchError error = 2;
4323
+ }
4324
+ }
4325
+
4326
+ // ===== Agent store conflicts =====
4327
+
4328
+ message AgentStoreConflictCursor {
4329
+ string journal_epoch = 1;
4330
+ uint64 seq = 2;
4331
+ string last_event_id = 3;
4332
+ }
4333
+
4334
+ message AgentStoreConflictEvent {
4335
+ uint32 v = 1;
4336
+ string event_id = 2;
4337
+ string journal_epoch = 3;
4338
+ uint64 seq = 4;
4339
+ uint64 ts_ms = 5;
4340
+ string kind = 6;
4341
+ optional string store_id = 7;
4342
+ optional string original_rel_path = 8;
4343
+ optional string conflict_rel_path = 9;
4344
+ optional string original_abs_path = 10;
4345
+ optional string conflict_abs_path = 11;
4346
+ optional uint64 preserved_bytes = 12;
4347
+ }
4348
+
4349
+ message AgentStoreConflictSuccess {
4350
+ repeated AgentStoreConflictEvent events = 1;
4351
+ AgentStoreConflictCursor next_cursor = 2;
4352
+ bool gap = 3;
4353
+ }
4354
+
4355
+ message AgentStoreConflictError {
4356
+ string error = 1;
4357
+ }
4358
+
4359
+ message AgentStoreConflictArgs {
4360
+ optional AgentStoreConflictCursor cursor = 1;
4361
+ optional bool advance = 2;
4362
+ }
4363
+
4364
+ message AgentStoreConflictResult {
4365
+ oneof result {
4366
+ AgentStoreConflictSuccess success = 1;
4367
+ AgentStoreConflictError error = 2;
4368
+ }
4369
+ }
4370
+
4371
+ // ===== Git diff (upstream aiserver.v1; declared here in agent.v1 — the exec channel is binary
4372
+ // protobuf, so field numbers, not type names, define wire compatibility) =====
4373
+
4374
+ enum GetDiffRequest_OutputFormat {
4375
+ OUTPUT_FORMAT_UNSPECIFIED = 0;
4376
+ OUTPUT_FORMAT_NAME_STATUS = 1;
4377
+ OUTPUT_FORMAT_NAME_STATUS_AND_NUMSTAT = 2;
4378
+ OUTPUT_FORMAT_FILE_DIFFS = 3;
4379
+ OUTPUT_FORMAT_DIFFS_WITH_BEFORE_AND_AFTER = 4;
4380
+ }
4381
+
4382
+ enum GitDiff_DiffType {
4383
+ DIFF_TYPE_UNSPECIFIED = 0;
4384
+ DIFF_TYPE_DIFF_TO_HEAD = 1;
4385
+ DIFF_TYPE_DIFF_FROM_BRANCH_TO_MAIN = 2;
4386
+ }
4387
+
4388
+ message FileDiff_Chunk {
4389
+ string content = 1;
4390
+ repeated string lines = 2;
4391
+ int32 old_start = 3;
4392
+ int32 old_lines = 4;
4393
+ int32 new_start = 5;
4394
+ int32 new_lines = 6;
4395
+ }
4396
+
4397
+ message FileDiff {
4398
+ int32 added = 4;
4399
+ int32 removed = 5;
4400
+ string from = 1;
4401
+ string to = 2;
4402
+ repeated FileDiff_Chunk chunks = 3;
4403
+ optional string before_file_contents = 6;
4404
+ optional string after_file_contents = 7;
4405
+ optional bool is_generated = 8;
4406
+ }
4407
+
4408
+ message GitDiff {
4409
+ repeated FileDiff diffs = 1;
4410
+ GitDiff_DiffType diff_type = 2;
4411
+ }
4412
+
4413
+ message GetDiffResponse_SubmoduleDiff {
4414
+ string relative_path = 1;
4415
+ GitDiff diff = 2;
4416
+ bool errored = 3;
4417
+ }
4418
+
4419
+ message GetDiffRequest {
4420
+ string cwd = 1;
4421
+ string ref = 2;
4422
+ string base_ref = 3;
4423
+ bool merge_base = 4;
4424
+ repeated string target_paths = 5;
4425
+ optional int32 unified_context_lines = 6;
4426
+ int32 max_untracked_files = 7;
4427
+ int32 submodule_recurse_depth = 9;
4428
+ bool include_space_changes = 10;
4429
+ bool committed_only = 11;
4430
+ bool compute_patch_id = 12;
4431
+ optional bool return_head_sha = 13;
4432
+ optional int32 max_response_bytes = 14;
4433
+ optional GetDiffRequest_OutputFormat output_format = 8;
4434
+ }
4435
+
4436
+ message GetDiffResponse {
4437
+ GitDiff diff = 1;
4438
+ repeated GetDiffResponse_SubmoduleDiff submodule_diffs = 2;
4439
+ optional string patch_id = 3;
4440
+ optional string head_sha = 4;
4441
+ optional bool has_uncommitted_changes = 5;
4442
+ }
4443
+
4444
+ // ===== Pi tool calls (ToolCall 61-67) =====
4445
+ //
4446
+ // The streamed `ToolCall` wrappers for the Pi exec frames. Their `args`/`result`
4447
+ // payloads are field-identical to the `Pi*Exec*` messages above (verified against
4448
+ // the modern CLI's `pi_*_tool_pb.js`), and the exec channel is binary protobuf,
4449
+ // so field numbers — not type names — define wire compatibility. Reusing the
4450
+ // exec messages keeps one shape per Pi tool instead of two that must stay in sync.
4451
+
4452
+ message PiReadToolCall {
4453
+ PiReadExecArgs args = 1;
4454
+ PiReadExecResult result = 2;
4455
+ }
4456
+
4457
+ message PiBashToolCall {
4458
+ PiBashExecArgs args = 1;
4459
+ PiBashExecResult result = 2;
4460
+ }
4461
+
4462
+ message PiEditToolCall {
4463
+ PiEditExecArgs args = 1;
4464
+ PiEditExecResult result = 2;
4465
+ }
4466
+
4467
+ message PiWriteToolCall {
4468
+ PiWriteExecArgs args = 1;
4469
+ PiWriteExecResult result = 2;
4470
+ }
4471
+
4472
+ message PiGrepToolCall {
4473
+ PiGrepExecArgs args = 1;
4474
+ PiGrepExecResult result = 2;
4475
+ }
4476
+
4477
+ message PiFindToolCall {
4478
+ PiFindExecArgs args = 1;
4479
+ PiFindExecResult result = 2;
4480
+ }
4481
+
4482
+ message PiLsToolCall {
4483
+ PiLsExecArgs args = 1;
4484
+ PiLsExecResult result = 2;
4485
+ }
4486
+
4487
+ // ===== Conversation search / SCM tool calls (ToolCall 68-69) =====
4488
+
4489
+ message SearchConversationsToolCall {
4490
+ ConversationSearchArgs args = 1;
4491
+ ConversationSearchResult result = 2;
4492
+ }
4493
+
4494
+ message ConnectScmGithubRepository {
4495
+ string owner = 1;
4496
+ string repo = 2;
4497
+ }
4498
+
4499
+ message ConnectScmGithub {
4500
+ ConnectScmGithubRepository repository = 1;
4501
+ optional string ghe_application = 2;
4502
+ }
4503
+
4504
+ message ConnectScmArgs {
4505
+ string tool_call_id = 1;
4506
+ oneof target {
4507
+ ConnectScmGithub github = 2;
4508
+ }
4509
+ }
4510
+
4511
+ message ConnectScmSuccess {
4512
+ }
4513
+
4514
+ message ConnectScmError {
4515
+ string error = 1;
4516
+ }
4517
+
4518
+ message ConnectScmRejected {
4519
+ string reason = 1;
4520
+ }
4521
+
4522
+ message ConnectScmResult {
4523
+ oneof result {
4524
+ ConnectScmSuccess success = 1;
4525
+ ConnectScmError error = 2;
4526
+ ConnectScmRejected rejected = 3;
4527
+ }
4528
+ }
4529
+
4530
+ message ConnectScmToolCall {
4531
+ ConnectScmArgs args = 1;
4532
+ ConnectScmResult result = 2;
4533
+ }