indent 0.0.8__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.
- exponent/__init__.py +1 -0
- exponent/cli.py +112 -0
- exponent/commands/cloud_commands.py +85 -0
- exponent/commands/common.py +434 -0
- exponent/commands/config_commands.py +581 -0
- exponent/commands/github_app_commands.py +211 -0
- exponent/commands/listen_commands.py +96 -0
- exponent/commands/run_commands.py +208 -0
- exponent/commands/settings.py +56 -0
- exponent/commands/shell_commands.py +2840 -0
- exponent/commands/theme.py +246 -0
- exponent/commands/types.py +111 -0
- exponent/commands/upgrade.py +29 -0
- exponent/commands/utils.py +236 -0
- exponent/core/config.py +180 -0
- exponent/core/graphql/__init__.py +0 -0
- exponent/core/graphql/client.py +59 -0
- exponent/core/graphql/cloud_config_queries.py +77 -0
- exponent/core/graphql/get_chats_query.py +47 -0
- exponent/core/graphql/github_config_queries.py +56 -0
- exponent/core/graphql/mutations.py +75 -0
- exponent/core/graphql/queries.py +110 -0
- exponent/core/graphql/subscriptions.py +452 -0
- exponent/core/remote_execution/checkpoints.py +212 -0
- exponent/core/remote_execution/cli_rpc_types.py +214 -0
- exponent/core/remote_execution/client.py +545 -0
- exponent/core/remote_execution/code_execution.py +58 -0
- exponent/core/remote_execution/command_execution.py +105 -0
- exponent/core/remote_execution/error_info.py +45 -0
- exponent/core/remote_execution/exceptions.py +10 -0
- exponent/core/remote_execution/file_write.py +410 -0
- exponent/core/remote_execution/files.py +415 -0
- exponent/core/remote_execution/git.py +268 -0
- exponent/core/remote_execution/languages/python_execution.py +239 -0
- exponent/core/remote_execution/languages/shell_streaming.py +221 -0
- exponent/core/remote_execution/languages/types.py +20 -0
- exponent/core/remote_execution/session.py +128 -0
- exponent/core/remote_execution/system_context.py +54 -0
- exponent/core/remote_execution/tool_execution.py +289 -0
- exponent/core/remote_execution/truncation.py +284 -0
- exponent/core/remote_execution/types.py +670 -0
- exponent/core/remote_execution/utils.py +600 -0
- exponent/core/types/__init__.py +0 -0
- exponent/core/types/command_data.py +206 -0
- exponent/core/types/event_types.py +89 -0
- exponent/core/types/generated/__init__.py +0 -0
- exponent/core/types/generated/strategy_info.py +225 -0
- exponent/migration-docs/login.md +112 -0
- exponent/py.typed +4 -0
- exponent/utils/__init__.py +0 -0
- exponent/utils/colors.py +92 -0
- exponent/utils/version.py +289 -0
- indent-0.0.8.dist-info/METADATA +36 -0
- indent-0.0.8.dist-info/RECORD +56 -0
- indent-0.0.8.dist-info/WHEEL +4 -0
- indent-0.0.8.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import msgspec
|
|
2
|
+
import yaml
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class PartialToolResult(msgspec.Struct, tag_field="tool_name", omit_defaults=True):
|
|
6
|
+
pass
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ToolInput(msgspec.Struct, tag_field="tool_name", omit_defaults=True):
|
|
10
|
+
"""Concrete subclasses describe the full input schema for a tool."""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ToolResult(msgspec.Struct, tag_field="tool_name", omit_defaults=True):
|
|
14
|
+
"""Concrete subclasses return data from a tool execution."""
|
|
15
|
+
|
|
16
|
+
def to_text(self) -> str:
|
|
17
|
+
"""
|
|
18
|
+
This provides a default textual representation of the tool result. Override it as needed for your tool."""
|
|
19
|
+
d = msgspec.to_builtins(self)
|
|
20
|
+
del d["tool_name"]
|
|
21
|
+
return yaml.dump(d)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ErrorToolResult(ToolResult, tag="error"):
|
|
25
|
+
error_message: str
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
READ_TOOL_NAME = "read"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ReadToolInput(ToolInput, tag=READ_TOOL_NAME):
|
|
32
|
+
file_path: str
|
|
33
|
+
offset: int | None = None
|
|
34
|
+
limit: int | None = None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ReadToolResult(ToolResult, tag=READ_TOOL_NAME):
|
|
38
|
+
content: str
|
|
39
|
+
num_lines: int
|
|
40
|
+
start_line: int
|
|
41
|
+
total_lines: int
|
|
42
|
+
|
|
43
|
+
def to_text(self) -> str:
|
|
44
|
+
lines = self.content.splitlines()
|
|
45
|
+
lines = [
|
|
46
|
+
f"{str(i).rjust(6)}→{line}"
|
|
47
|
+
for i, line in enumerate(lines, start=self.start_line + 1)
|
|
48
|
+
]
|
|
49
|
+
return "\n".join(lines)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
LIST_TOOL_NAME = "ls"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class ListToolInput(ToolInput, tag=LIST_TOOL_NAME):
|
|
56
|
+
path: str
|
|
57
|
+
ignore: list[str] | None = None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ListToolResult(ToolResult, tag=LIST_TOOL_NAME):
|
|
61
|
+
files: list[str]
|
|
62
|
+
truncated: bool = False
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
GLOB_TOOL_NAME = "glob"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class GlobToolInput(ToolInput, tag=GLOB_TOOL_NAME):
|
|
69
|
+
pattern: str
|
|
70
|
+
path: str | None = None
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class GlobToolResult(ToolResult, tag=GLOB_TOOL_NAME):
|
|
74
|
+
filenames: list[str]
|
|
75
|
+
duration_ms: int
|
|
76
|
+
num_files: int
|
|
77
|
+
truncated: bool
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
WRITE_TOOL_NAME = "write"
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class WriteToolInput(ToolInput, tag=WRITE_TOOL_NAME):
|
|
84
|
+
file_path: str
|
|
85
|
+
content: str
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class WriteToolResult(ToolResult, tag=WRITE_TOOL_NAME):
|
|
89
|
+
message: str
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
GREP_TOOL_NAME = "grep"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class GrepToolInput(ToolInput, tag=GREP_TOOL_NAME):
|
|
96
|
+
pattern: str
|
|
97
|
+
path: str | None = None
|
|
98
|
+
include: str | None = None
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class GrepToolResult(ToolResult, tag=GREP_TOOL_NAME):
|
|
102
|
+
matches: list[str]
|
|
103
|
+
truncated: bool = False
|
|
104
|
+
|
|
105
|
+
WEB_FETCH_TOOL_NAME = "web_fetch"
|
|
106
|
+
|
|
107
|
+
class WebFetchToolInput(ToolInput, tag=WEB_FETCH_TOOL_NAME):
|
|
108
|
+
query: str
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class WebFetchToolResult(ToolResult, tag=WEB_FETCH_TOOL_NAME):
|
|
112
|
+
url: str
|
|
113
|
+
title: bool = False
|
|
114
|
+
encrypted_content: str | None = None
|
|
115
|
+
page_age: str | None = None
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
BASH_TOOL_NAME = "bash"
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class BashToolInput(ToolInput, tag=BASH_TOOL_NAME):
|
|
122
|
+
command: str
|
|
123
|
+
timeout: int | None = None
|
|
124
|
+
description: str | None = None
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class PartialBashToolResult(PartialToolResult, tag=BASH_TOOL_NAME):
|
|
128
|
+
shell_output: str | None = None
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class BashToolResult(ToolResult, tag=BASH_TOOL_NAME):
|
|
132
|
+
shell_output: str
|
|
133
|
+
duration_ms: int
|
|
134
|
+
exit_code: int | None
|
|
135
|
+
timed_out: bool
|
|
136
|
+
stopped_by_user: bool
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
ToolInputType = (
|
|
140
|
+
ReadToolInput
|
|
141
|
+
| WriteToolInput
|
|
142
|
+
| ListToolInput
|
|
143
|
+
| GlobToolInput
|
|
144
|
+
| GrepToolInput
|
|
145
|
+
| BashToolInput
|
|
146
|
+
)
|
|
147
|
+
PartialToolResultType = PartialBashToolResult
|
|
148
|
+
|
|
149
|
+
ToolResultType = (
|
|
150
|
+
ReadToolResult
|
|
151
|
+
| WriteToolResult
|
|
152
|
+
| ListToolResult
|
|
153
|
+
| GlobToolResult
|
|
154
|
+
| GrepToolResult
|
|
155
|
+
| BashToolResult
|
|
156
|
+
| ErrorToolResult
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class ToolExecutionRequest(msgspec.Struct, tag="tool_execution"):
|
|
161
|
+
tool_input: ToolInputType
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class GetAllFilesRequest(msgspec.Struct, tag="get_all_files"):
|
|
165
|
+
pass
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
class TerminateRequest(msgspec.Struct, tag="terminate"):
|
|
169
|
+
pass
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class BatchToolExecutionRequest(msgspec.Struct, tag="batch_tool_execution"):
|
|
173
|
+
tool_inputs: list[ToolInputType]
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class GetAllFilesResponse(msgspec.Struct, tag="get_all_files"):
|
|
177
|
+
files: list[str]
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class TerminateResponse(msgspec.Struct, tag="terminate"):
|
|
181
|
+
pass
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class BatchToolExecutionResponse(msgspec.Struct, tag="batch_tool_execution"):
|
|
185
|
+
tool_results: list[ToolResultType]
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class CliRpcRequest(msgspec.Struct):
|
|
189
|
+
request_id: str
|
|
190
|
+
request: (
|
|
191
|
+
ToolExecutionRequest
|
|
192
|
+
| GetAllFilesRequest
|
|
193
|
+
| TerminateRequest
|
|
194
|
+
| BatchToolExecutionRequest
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class ToolExecutionResponse(msgspec.Struct, tag="tool_execution"):
|
|
199
|
+
tool_result: ToolResultType
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
class ErrorResponse(msgspec.Struct, tag="error"):
|
|
203
|
+
error_message: str
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class CliRpcResponse(msgspec.Struct):
|
|
207
|
+
request_id: str
|
|
208
|
+
response: (
|
|
209
|
+
ToolExecutionResponse
|
|
210
|
+
| GetAllFilesResponse
|
|
211
|
+
| ErrorResponse
|
|
212
|
+
| TerminateResponse
|
|
213
|
+
| BatchToolExecutionResponse
|
|
214
|
+
)
|