indent 0.1.10__py3-none-any.whl → 0.1.12__py3-none-any.whl

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.

Potentially problematic release.


This version of indent might be problematic. Click here for more details.

Files changed (34) hide show
  1. exponent/__init__.py +16 -3
  2. exponent/commands/cloud_commands.py +582 -0
  3. exponent/commands/common.py +4 -9
  4. exponent/commands/config_commands.py +1 -161
  5. exponent/commands/run_commands.py +20 -9
  6. exponent/commands/utils.py +3 -3
  7. exponent/commands/workflow_commands.py +2 -2
  8. exponent/core/config.py +0 -1
  9. exponent/core/graphql/mutations.py +114 -0
  10. exponent/core/graphql/queries.py +23 -0
  11. exponent/core/graphql/subscriptions.py +0 -449
  12. exponent/core/remote_execution/cli_rpc_types.py +48 -1
  13. exponent/core/remote_execution/client.py +114 -26
  14. exponent/core/remote_execution/file_write.py +1 -376
  15. exponent/core/remote_execution/files.py +1 -102
  16. exponent/core/remote_execution/git.py +1 -1
  17. exponent/core/remote_execution/http_fetch.py +3 -4
  18. exponent/core/remote_execution/languages/python_execution.py +1 -1
  19. exponent/core/remote_execution/languages/shell_streaming.py +1 -1
  20. exponent/core/remote_execution/session.py +1 -1
  21. exponent/core/remote_execution/system_context.py +0 -3
  22. exponent/core/remote_execution/tool_execution.py +24 -4
  23. exponent/core/remote_execution/truncation.py +51 -47
  24. exponent/core/remote_execution/types.py +25 -79
  25. exponent/core/remote_execution/utils.py +23 -51
  26. exponent/core/types/event_types.py +2 -2
  27. exponent/core/types/generated/strategy_info.py +0 -12
  28. exponent/utils/version.py +1 -1
  29. {indent-0.1.10.dist-info → indent-0.1.12.dist-info}/METADATA +3 -3
  30. indent-0.1.12.dist-info/RECORD +52 -0
  31. exponent/core/graphql/cloud_config_queries.py +0 -77
  32. indent-0.1.10.dist-info/RECORD +0 -53
  33. {indent-0.1.10.dist-info → indent-0.1.12.dist-info}/WHEEL +0 -0
  34. {indent-0.1.10.dist-info → indent-0.1.12.dist-info}/entry_points.txt +0 -0
@@ -14,452 +14,3 @@ AUTHENTICATED_USER_SUBSCRIPTION = """
14
14
  }
15
15
  }
16
16
  """
17
-
18
- INDENT_EVENTS_SUBSCRIPTION = """
19
- subscription ChatEvents(
20
- $prompt: Prompt
21
- $chatUuid: String!
22
- $parentUuid: String
23
- $model: ModelName!
24
- $strategyNameOverride: StrategyName
25
- $depthLimit: Int!
26
- $requireConfirmation: Boolean
27
- $readOnly: Boolean
28
- $enableThinking: Boolean
29
- ) {
30
- indentChat(
31
- chatInput: {
32
- prompt: $prompt
33
- }
34
- parentUuid: $parentUuid
35
- chatConfig: {
36
- chatUuid: $chatUuid
37
- model: $model
38
- requireConfirmation: $requireConfirmation
39
- readOnly: $readOnly
40
- strategyNameOverride: $strategyNameOverride
41
- depthLimit: $depthLimit
42
- enableThinking: $enableThinking
43
- }
44
- ) {
45
- __typename
46
- ...on Error {
47
- message
48
- }
49
- ...on UnauthenticatedError {
50
- message
51
- }
52
- ...on UserEvent {
53
- uuid
54
- parentUuid
55
- chatId
56
- isSidechain
57
- version
58
- createdAt
59
- sidechainRootUuid
60
- synthetic
61
- messageData: message {
62
- __typename
63
- ... on TextMessage {
64
- text
65
- }
66
- ... on ToolResultMessage {
67
- messageId
68
- toolUseId
69
- text
70
- resultData {
71
- ... on BashToolResult {
72
- shellOutput
73
- exitCode
74
- }
75
- ... on ReadToolResult {
76
- content
77
- }
78
- }
79
- }
80
- ... on ToolCallMessage {
81
- messageId
82
- toolUseId
83
- toolName
84
- toolInput {
85
- ... on BashToolInput {
86
- command
87
- }
88
- ... on ReadToolInput {
89
- filePath
90
- }
91
- }
92
- }
93
- ... on PartialToolResultMessage {
94
- messageId
95
- toolUseId
96
- text
97
- resultData {
98
- ... on PartialToolResult {
99
- __typename
100
- }
101
- }
102
- }
103
- }
104
- }
105
- ...on AssistantEvent {
106
- uuid
107
- parentUuid
108
- chatId
109
- isSidechain
110
- version
111
- createdAt
112
- sidechainRootUuid
113
- synthetic
114
- messageData: message {
115
- __typename
116
- ... on TextMessage {
117
- text
118
- }
119
- ... on ToolCallMessage {
120
- messageId
121
- toolUseId
122
- toolName
123
- toolInput {
124
- ... on BashToolInput {
125
- command
126
- }
127
- ... on ReadToolInput {
128
- filePath
129
- }
130
- }
131
- }
132
- }
133
- }
134
- ...on SystemEvent {
135
- uuid
136
- parentUuid
137
- chatId
138
- isSidechain
139
- version
140
- createdAt
141
- sidechainRootUuid
142
- messageData: message {
143
- __typename
144
- ... on ToolCallMessage {
145
- messageId
146
- toolUseId
147
- toolName
148
- toolInput {
149
- ... on BashToolInput {
150
- command
151
- }
152
- ... on ReadToolInput {
153
- filePath
154
- }
155
- }
156
- }
157
- ... on ToolResultMessage {
158
- messageId
159
- toolUseId
160
- text
161
- resultData {
162
- ... on BashToolResult {
163
- shellOutput
164
- exitCode
165
- }
166
- ... on ReadToolResult {
167
- content
168
- }
169
- }
170
- }
171
- ... on ToolExecutionStatusMessage {
172
- executionStatus: status
173
- }
174
- ... on ToolPermissionStatusMessage {
175
- permissionStatus: status
176
- }
177
- }
178
- }
179
- }
180
- }
181
- """
182
-
183
-
184
- CONFIRM_AND_CONTINUE_SUBSCRIPTION = """
185
- subscription ChatEvents(
186
- $requestUuid: String!
187
- $chatUuid: String!
188
- $model: ModelName!
189
- $strategyNameOverride: StrategyName
190
- $depthLimit: Int!
191
- $requireConfirmation: Boolean
192
- $readOnly: Boolean
193
- $enableThinking: Boolean
194
- ) {
195
- confirmAndContinue(
196
- requestEventUuid: $requestUuid
197
- chatConfig: {
198
- chatUuid: $chatUuid
199
- model: $model
200
- requireConfirmation: $requireConfirmation
201
- readOnly: $readOnly
202
- strategyNameOverride: $strategyNameOverride
203
- depthLimit: $depthLimit
204
- enableThinking: $enableThinking
205
- }
206
- ) {
207
- __typename
208
- ...on Error {
209
- message
210
- }
211
- ...on UnauthenticatedError {
212
- message
213
- }
214
- ...on UserEvent {
215
- uuid
216
- parentUuid
217
- chatId
218
- isSidechain
219
- version
220
- createdAt
221
- sidechainRootUuid
222
- synthetic
223
- messageData: message {
224
- __typename
225
- ... on TextMessage {
226
- text
227
- }
228
- ... on ToolResultMessage {
229
- messageId
230
- toolUseId
231
- text
232
- resultData {
233
- ... on BashToolResult {
234
- shellOutput
235
- exitCode
236
- }
237
- ... on ReadToolResult {
238
- content
239
- }
240
- }
241
- }
242
- ... on PartialToolResultMessage {
243
- messageId
244
- toolUseId
245
- text
246
- resultData {
247
- ... on PartialToolResult {
248
- __typename
249
- }
250
- }
251
- }
252
- }
253
- }
254
- ...on AssistantEvent {
255
- uuid
256
- parentUuid
257
- chatId
258
- isSidechain
259
- version
260
- createdAt
261
- sidechainRootUuid
262
- synthetic
263
- messageData: message {
264
- __typename
265
- ... on TextMessage {
266
- text
267
- }
268
- ... on ToolCallMessage {
269
- messageId
270
- toolUseId
271
- toolName
272
- toolInput {
273
- ... on BashToolInput {
274
- command
275
- }
276
- ... on ReadToolInput {
277
- filePath
278
- }
279
- }
280
- }
281
- }
282
- }
283
- ...on SystemEvent {
284
- uuid
285
- parentUuid
286
- chatId
287
- isSidechain
288
- version
289
- createdAt
290
- sidechainRootUuid
291
- messageData: message {
292
- __typename
293
- ... on ToolCallMessage {
294
- messageId
295
- toolUseId
296
- toolName
297
- toolInput {
298
- ... on BashToolInput {
299
- command
300
- }
301
- ... on ReadToolInput {
302
- filePath
303
- }
304
- }
305
- }
306
- ... on ToolResultMessage {
307
- messageId
308
- toolUseId
309
- text
310
- resultData {
311
- ... on BashToolResult {
312
- shellOutput
313
- exitCode
314
- }
315
- ... on ReadToolResult {
316
- content
317
- }
318
- }
319
- }
320
- ... on ToolExecutionStatusMessage {
321
- executionStatus: status
322
- }
323
- ... on ToolPermissionStatusMessage {
324
- permissionStatus: status
325
- }
326
- }
327
- }
328
- }
329
- }
330
- """
331
-
332
-
333
- INDENT_CHAT_EVENT_STREAM_SUBSCRIPTION = """
334
- subscription IndentChatEventStream(
335
- $chatUuid: String!
336
- $lastKnownFullEventUuid: String
337
- ) {
338
- indentChatEventStream(
339
- chatUuid: $chatUuid
340
- lastKnownFullEventUuid: $lastKnownFullEventUuid
341
- ) {
342
- __typename
343
- ...on Error {
344
- message
345
- }
346
- ...on UnauthenticatedError {
347
- message
348
- }
349
- ...on UserEvent {
350
- uuid
351
- parentUuid
352
- chatId
353
- isSidechain
354
- version
355
- createdAt
356
- sidechainRootUuid
357
- synthetic
358
- messageData: message {
359
- __typename
360
- ... on TextMessage {
361
- text
362
- }
363
- ... on ToolResultMessage {
364
- messageId
365
- toolUseId
366
- text
367
- resultData {
368
- ... on BashToolResult {
369
- shellOutput
370
- exitCode
371
- }
372
- ... on ReadToolResult {
373
- content
374
- }
375
- }
376
- }
377
- ... on PartialToolResultMessage {
378
- messageId
379
- toolUseId
380
- text
381
- resultData {
382
- ... on PartialToolResult {
383
- __typename
384
- }
385
- }
386
- }
387
- }
388
- }
389
- ...on AssistantEvent {
390
- uuid
391
- parentUuid
392
- chatId
393
- isSidechain
394
- version
395
- createdAt
396
- sidechainRootUuid
397
- synthetic
398
- messageData: message {
399
- __typename
400
- ... on TextMessage {
401
- text
402
- }
403
- ... on ToolCallMessage {
404
- messageId
405
- toolUseId
406
- toolName
407
- toolInput {
408
- ... on BashToolInput {
409
- command
410
- }
411
- ... on ReadToolInput {
412
- filePath
413
- }
414
- }
415
- }
416
- }
417
- }
418
- ...on SystemEvent {
419
- uuid
420
- parentUuid
421
- chatId
422
- isSidechain
423
- version
424
- createdAt
425
- sidechainRootUuid
426
- messageData: message {
427
- __typename
428
- ... on ToolCallMessage {
429
- messageId
430
- toolUseId
431
- toolName
432
- toolInput {
433
- ... on BashToolInput {
434
- command
435
- }
436
- ... on ReadToolInput {
437
- filePath
438
- }
439
- }
440
- }
441
- ... on ToolResultMessage {
442
- messageId
443
- toolUseId
444
- text
445
- resultData {
446
- ... on BashToolResult {
447
- shellOutput
448
- exitCode
449
- }
450
- ... on ReadToolResult {
451
- content
452
- }
453
- }
454
- }
455
- ... on ToolExecutionStatusMessage {
456
- executionStatus: status
457
- }
458
- ... on ToolPermissionStatusMessage {
459
- permissionStatus: status
460
- }
461
- }
462
- }
463
- }
464
- }
465
- """
@@ -1,6 +1,12 @@
1
+ from typing import TYPE_CHECKING, Any
2
+
1
3
  import msgspec
2
4
  import yaml
3
- from typing import Any
5
+
6
+ if TYPE_CHECKING:
7
+ from exponent_server.core.tools.edit_tool import (
8
+ EditToolInput as ServerSideEditToolInput,
9
+ )
4
10
 
5
11
 
6
12
  class PartialToolResult(msgspec.Struct, tag_field="tool_name", omit_defaults=True):
@@ -21,6 +27,11 @@ class ToolInput(msgspec.Struct, tag_field="tool_name", omit_defaults=True):
21
27
  """
22
28
  return msgspec.to_builtins(self) # type: ignore[no-any-return]
23
29
 
30
+ def to_text(self) -> str:
31
+ d = msgspec.to_builtins(self)
32
+ del d["tool_name"]
33
+ return yaml.dump(d)
34
+
24
35
 
25
36
  class ToolResult(msgspec.Struct, tag_field="tool_name", omit_defaults=True):
26
37
  """Concrete subclasses return data from a tool execution."""
@@ -46,11 +57,17 @@ class ReadToolInput(ToolInput, tag=READ_TOOL_NAME):
46
57
  limit: int | None = None
47
58
 
48
59
 
60
+ class FileMetadata(msgspec.Struct):
61
+ modified_timestamp: float
62
+ file_mode: str
63
+
64
+
49
65
  class ReadToolResult(ToolResult, tag=READ_TOOL_NAME):
50
66
  content: str
51
67
  num_lines: int
52
68
  start_line: int
53
69
  total_lines: int
70
+ metadata: FileMetadata | None = None
54
71
 
55
72
  def to_text(self) -> str:
56
73
  lines = self.content.splitlines()
@@ -99,6 +116,7 @@ class WriteToolInput(ToolInput, tag=WRITE_TOOL_NAME):
99
116
 
100
117
  class WriteToolResult(ToolResult, tag=WRITE_TOOL_NAME):
101
118
  message: str
119
+ metadata: FileMetadata | None = None
102
120
 
103
121
 
104
122
  GREP_TOOL_NAME = "grep"
@@ -125,10 +143,27 @@ class EditToolInput(ToolInput, tag=EDIT_TOOL_NAME):
125
143
  old_string: str
126
144
  new_string: str
127
145
  replace_all: bool = False
146
+ # The last retrieved modified timestamp. This is used to check if the file has been modified since the last read/write that we are aware of (in which case we should re-read the file before editing).
147
+ last_known_modified_timestamp: float | None = None
148
+
149
+ @classmethod
150
+ def from_server_side_input(
151
+ cls,
152
+ server_side_input: "ServerSideEditToolInput",
153
+ last_known_modified_timestamp: float | None,
154
+ ) -> "EditToolInput":
155
+ return cls(
156
+ file_path=server_side_input.file_path,
157
+ old_string=server_side_input.old_string,
158
+ new_string=server_side_input.new_string,
159
+ replace_all=server_side_input.replace_all,
160
+ last_known_modified_timestamp=last_known_modified_timestamp,
161
+ )
128
162
 
129
163
 
130
164
  class EditToolResult(ToolResult, tag=EDIT_TOOL_NAME):
131
165
  message: str
166
+ metadata: FileMetadata | None = None
132
167
 
133
168
 
134
169
  BASH_TOOL_NAME = "bash"
@@ -206,6 +241,12 @@ class SwitchCLIChatRequest(msgspec.Struct, tag="switch_cli_chat"):
206
241
  new_chat_uuid: str
207
242
 
208
243
 
244
+ # This message is sent periodically from the client to keep the connection alive while the chat is turning.
245
+ # This synergizes with CLI-side timeouts to avoid disconnecting during long operations.
246
+ class KeepAliveCliChatRequest(msgspec.Struct, tag="keep_alive_cli_chat"):
247
+ pass
248
+
249
+
209
250
  class BatchToolExecutionRequest(msgspec.Struct, tag="batch_tool_execution"):
210
251
  tool_inputs: list[ToolInputType]
211
252
 
@@ -226,6 +267,10 @@ class SwitchCLIChatResponse(msgspec.Struct, tag="switch_cli_chat"):
226
267
  pass
227
268
 
228
269
 
270
+ class KeepAliveCliChatResponse(msgspec.Struct, tag="keep_alive_cli_chat"):
271
+ pass
272
+
273
+
229
274
  class CliRpcRequest(msgspec.Struct):
230
275
  request_id: str
231
276
  request: (
@@ -235,6 +280,7 @@ class CliRpcRequest(msgspec.Struct):
235
280
  | HttpRequest
236
281
  | BatchToolExecutionRequest
237
282
  | SwitchCLIChatRequest
283
+ | KeepAliveCliChatRequest
238
284
  )
239
285
 
240
286
 
@@ -256,4 +302,5 @@ class CliRpcResponse(msgspec.Struct):
256
302
  | BatchToolExecutionResponse
257
303
  | HttpResponse
258
304
  | SwitchCLIChatResponse
305
+ | KeepAliveCliChatResponse
259
306
  )