crabcode 0.1.1__py3-none-any.whl → 0.1.3__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.
- {crabcode-0.1.1.dist-info → crabcode-0.1.3.dist-info}/METADATA +16 -1
- {crabcode-0.1.1.dist-info → crabcode-0.1.3.dist-info}/RECORD +51 -44
- crabcode_cli/__init__.py +1 -1
- crabcode_cli/__main__.py +4 -0
- crabcode_cli/app.py +29 -2
- crabcode_cli/pipe.py +50 -3
- crabcode_cli/repl.py +170 -12
- crabcode_core/__init__.py +1 -1
- crabcode_core/agent_manager.py +1 -0
- crabcode_core/api/anthropic_adapter.py +8 -0
- crabcode_core/api/azure_adapter.py +2 -0
- crabcode_core/api/base.py +2 -1
- crabcode_core/api/codex_adapter.py +271 -9
- crabcode_core/api/openai_adapter.py +30 -2
- crabcode_core/events.py +82 -2
- crabcode_core/logging_utils.py +11 -2
- crabcode_core/prompts/system.py +17 -13
- crabcode_core/prompts/templates.py +2 -0
- crabcode_core/query/loop.py +134 -38
- crabcode_core/schedule/__init__.py +5 -0
- crabcode_core/schedule/models.py +204 -0
- crabcode_core/schedule/store.py +349 -0
- crabcode_core/session/__init__.py +10 -2
- crabcode_core/session/storage.py +19 -0
- crabcode_core/tools/__init__.py +4 -0
- crabcode_core/tools/checkpoint.py +66 -0
- crabcode_core/tools/file_edit.py +28 -2
- crabcode_core/tools/grep.py +6 -2
- crabcode_core/tools/revert.py +90 -0
- crabcode_core/tools/schedule.py +612 -0
- crabcode_core/types/config.py +17 -0
- crabcode_core/types/event.py +19 -0
- crabcode_core/types/message.py +12 -1
- crabcode_core/types/tool.py +2 -0
- crabcode_gateway/__init__.py +1 -1
- crabcode_gateway/acp/agent.py +1 -1
- crabcode_gateway/event_bus.py +15 -6
- crabcode_gateway/{grpc_ → grpc}/server.py +18 -18
- crabcode_gateway/middleware.py +99 -25
- crabcode_gateway/routes/config.py +92 -9
- crabcode_gateway/routes/event.py +214 -26
- crabcode_gateway/routes/permission.py +1 -0
- crabcode_gateway/routes/session.py +219 -7
- crabcode_gateway/routes/snapshot.py +23 -0
- crabcode_gateway/schemas.py +40 -1
- crabcode_gateway/server.py +2 -2
- crabcode_search/embedder.py +57 -7
- {crabcode-0.1.1.dist-info → crabcode-0.1.3.dist-info}/WHEEL +0 -0
- {crabcode-0.1.1.dist-info → crabcode-0.1.3.dist-info}/entry_points.txt +0 -0
- /crabcode_gateway/{grpc_ → grpc}/__init__.py +0 -0
- /crabcode_gateway/{grpc_ → grpc}/proto/crabcode.proto +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crabcode
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: CrabCode - AI coding assistant in the terminal
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: anthropic>=0.40.0
|
|
@@ -12,6 +12,21 @@ Requires-Dist: pydantic>=2.0.0
|
|
|
12
12
|
Requires-Dist: rich>=13.0.0
|
|
13
13
|
Requires-Dist: tiktoken>=0.7.0
|
|
14
14
|
Requires-Dist: typer>=0.12.0
|
|
15
|
+
Provides-Extra: all
|
|
16
|
+
Requires-Dist: agent-client-protocol>=0.9.0; extra == 'all'
|
|
17
|
+
Requires-Dist: anthropic[bedrock]>=0.40.0; extra == 'all'
|
|
18
|
+
Requires-Dist: anthropic[vertex]>=0.40.0; extra == 'all'
|
|
19
|
+
Requires-Dist: fastapi>=0.115.0; extra == 'all'
|
|
20
|
+
Requires-Dist: grpcio-health-checking>=1.65.0; extra == 'all'
|
|
21
|
+
Requires-Dist: grpcio>=1.65.0; extra == 'all'
|
|
22
|
+
Requires-Dist: httpx>=0.27.0; extra == 'all'
|
|
23
|
+
Requires-Dist: modelscope>=1.10.0; extra == 'all'
|
|
24
|
+
Requires-Dist: playwright>=1.48.0; extra == 'all'
|
|
25
|
+
Requires-Dist: sentence-transformers>=2.0.0; extra == 'all'
|
|
26
|
+
Requires-Dist: sse-starlette>=2.0.0; extra == 'all'
|
|
27
|
+
Requires-Dist: tree-sitter-language-pack>=1.0.0; extra == 'all'
|
|
28
|
+
Requires-Dist: usearch>=2.12.0; extra == 'all'
|
|
29
|
+
Requires-Dist: uvicorn[standard]>=0.30.0; extra == 'all'
|
|
15
30
|
Provides-Extra: bedrock
|
|
16
31
|
Requires-Dist: anthropic[bedrock]>=0.40.0; extra == 'bedrock'
|
|
17
32
|
Provides-Extra: browser
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
crabcode_cli/__init__.py,sha256=
|
|
2
|
-
crabcode_cli/
|
|
1
|
+
crabcode_cli/__init__.py,sha256=3OCzOxlK28hMxxTQHAdbnvbEZXEb07WWKnCjyDwhW-0,63
|
|
2
|
+
crabcode_cli/__main__.py,sha256=ekwH_ayJ5YpefhbXSDj-IM9mS9YrCwWpoDIH92V6tjg,75
|
|
3
|
+
crabcode_cli/app.py,sha256=RJXlRgXygGIg2N_uJqFOMMPFDL1HuZVP0vmF3wVI-ps,17612
|
|
3
4
|
crabcode_cli/banner.py,sha256=K0ak6Ng4l85C3TWnh64ulvdF4ReJSRsaWe8DOjse3Zg,1403
|
|
4
|
-
crabcode_cli/pipe.py,sha256=
|
|
5
|
-
crabcode_cli/repl.py,sha256=
|
|
5
|
+
crabcode_cli/pipe.py,sha256=M79twqrmeCy1QxiQ-jDThYy_CzPHE5llbQsDXQRAoW8,4162
|
|
6
|
+
crabcode_cli/repl.py,sha256=6ApZtL7K-P14HRws6vP-1RSNGLsSP6YbJ_7xY3Y_bZo,103474
|
|
6
7
|
crabcode_cli/render/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
8
|
crabcode_cli/render/messages.py,sha256=n9OsbLIAU3FyO9gwGMMJld7zq-71N0caz9ecmE2kIjo,568
|
|
8
|
-
crabcode_core/__init__.py,sha256
|
|
9
|
-
crabcode_core/agent_manager.py,sha256=
|
|
10
|
-
crabcode_core/events.py,sha256=
|
|
11
|
-
crabcode_core/logging_utils.py,sha256=
|
|
9
|
+
crabcode_core/__init__.py,sha256=bW4jmccyG4G7EZO1yb_4yZP4zxwS_wmyuZXhIIhlv0Y,73
|
|
10
|
+
crabcode_core/agent_manager.py,sha256=fu-t3xmiNRQUjJhUCdicLA6lflyD7TbGLpANckBRqnk,22869
|
|
11
|
+
crabcode_core/events.py,sha256=7IrCHMB8oYGzr6zcvAPnLmV4john8HGszZEbH3zU9-Y,48382
|
|
12
|
+
crabcode_core/logging_utils.py,sha256=H6E7lldUAeIeQzQooMl0MrQ07YlSO-tra_QlzxcOdks,3657
|
|
12
13
|
crabcode_core/utf8_sanitize.py,sha256=RRTGgwA9jqK-HLR1WUSFwgG4xJn7ZukTDu7M6Oi3fHI,936
|
|
13
14
|
crabcode_core/api/__init__.py,sha256=IXs4hLgC4cT85TLdmS4KgtPKYDytadkwvrDyBshr5ag,674
|
|
14
|
-
crabcode_core/api/anthropic_adapter.py,sha256=
|
|
15
|
-
crabcode_core/api/azure_adapter.py,sha256=
|
|
16
|
-
crabcode_core/api/base.py,sha256=
|
|
17
|
-
crabcode_core/api/codex_adapter.py,sha256=
|
|
15
|
+
crabcode_core/api/anthropic_adapter.py,sha256=xZPxI4Z1ega0ZOSgwZBn6ttBCXybyGT8Z8XT20OhZ_o,10999
|
|
16
|
+
crabcode_core/api/azure_adapter.py,sha256=zJ7q3Ni3sVwK3Bbju_nO8t8kPEA_bL6scVFC-XRPRh4,2360
|
|
17
|
+
crabcode_core/api/base.py,sha256=AvOD8lwEc60GeuMZgvjN7xrHqkPkWhyhHDIXnJQ4XoU,2871
|
|
18
|
+
crabcode_core/api/codex_adapter.py,sha256=zrwVS-Nvv0ABDhrRqNTCHbFLMNdT3gqYO0_5GjMtyXU,26511
|
|
18
19
|
crabcode_core/api/gemini_adapter.py,sha256=RVk3zlLPqDtzG8w5psu4aSoFyFLua5qQx3subqz-5DQ,1130
|
|
19
20
|
crabcode_core/api/model_info.py,sha256=kzbEbZ9BqJffu8VQwPAZC5WXKs1qHNFq-MnM6h5XWDI,2002
|
|
20
21
|
crabcode_core/api/ollama_adapter.py,sha256=ZpTg11zOUGFE0J88qBXL7AvxDQU5PjWg2wWvm4uxUvY,1158
|
|
21
|
-
crabcode_core/api/openai_adapter.py,sha256=
|
|
22
|
+
crabcode_core/api/openai_adapter.py,sha256=wqEdUn-hq3ht2XHOgGweRR1MxEKPgOxYglKWQtTDeLU,9855
|
|
22
23
|
crabcode_core/api/registry.py,sha256=tCVRE74bMUn9ukCbGp3bDtSOYZ6_EmsNfdVnnkGN6k4,2413
|
|
23
24
|
crabcode_core/compact/__init__.py,sha256=P5C6D0MilT3FAnmaAxc8NeMi2CZLEMB-CwEzKUGqSlY,206
|
|
24
25
|
crabcode_core/compact/compact.py,sha256=dsdqaA7NTHMxHdwNoBorlymJtchgiYKN_V2KS5jlSp0,7008
|
|
@@ -42,14 +43,17 @@ crabcode_core/plan/types.py,sha256=BuYxXh8jLLyQZtcNG3F_UJOLMfbGlAE-mffKl69lGgE,5
|
|
|
42
43
|
crabcode_core/prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
44
|
crabcode_core/prompts/context.py,sha256=EHFdO-3_386pnFPIDTruy2xDmrIZDgHwvU5v52_vWDQ,7250
|
|
44
45
|
crabcode_core/prompts/profile.py,sha256=MWxdrC0vVc6QfaRa5sgKEC8Gi_s61F9ZaxjoCTiiEPc,2088
|
|
45
|
-
crabcode_core/prompts/system.py,sha256=
|
|
46
|
-
crabcode_core/prompts/templates.py,sha256=
|
|
46
|
+
crabcode_core/prompts/system.py,sha256=XHIAOPR5m3RSiPm141wv3AJpOZLMEz5tpt7eALNuM8s,33389
|
|
47
|
+
crabcode_core/prompts/templates.py,sha256=XZRdGXWc1-OGksOp1r6nML7Cr0T1SmT_ktulSs1VqPw,2570
|
|
47
48
|
crabcode_core/query/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
crabcode_core/query/loop.py,sha256=
|
|
49
|
-
crabcode_core/
|
|
49
|
+
crabcode_core/query/loop.py,sha256=Hf6PL_mdQClM0jFPQw-1eO-dhoSWFTHXpBAOdK5PK60,42004
|
|
50
|
+
crabcode_core/schedule/__init__.py,sha256=Pf1VyLKpZuvtxkUyYmJv0m79vYfN9p542A26UTBS-0E,149
|
|
51
|
+
crabcode_core/schedule/models.py,sha256=T3Z7wapFCkuE_ZeIDK2Clq8WGThKs88ENjXklT1_LE8,7847
|
|
52
|
+
crabcode_core/schedule/store.py,sha256=3NL8xKgyDvndiuw3Zc32_rt6Bze3VmTbVd9_DM67MII,12455
|
|
53
|
+
crabcode_core/session/__init__.py,sha256=0E_Flt_OkcFVkxbRTDVxot3TrUZ23T5qspIJqlYnwtE,441
|
|
50
54
|
crabcode_core/session/export.py,sha256=ElD3yd5KbuOWGK2TSUpULqUgloDpab3X2hdUbFiZ_iY,4453
|
|
51
55
|
crabcode_core/session/meta_db.py,sha256=xIlafhJ39Khcvoor-qzxKdnZt91G3IIPw6fZ-Zn5KxU,13294
|
|
52
|
-
crabcode_core/session/storage.py,sha256=
|
|
56
|
+
crabcode_core/session/storage.py,sha256=zimJH4Z4aFrQaZ9PPer1TVAOtNIASs1crBxWPcLhJ3Y,24816
|
|
53
57
|
crabcode_core/session/title_gen.py,sha256=TrIqrWRSScZjVGOaG3h4zl7PhxPMD-86zLIYcVdElP4,1507
|
|
54
58
|
crabcode_core/skills/__init__.py,sha256=2A99hK6_T53EPy-hcYYu4FobhUAZjLL-O7ObIyG3yuQ,296
|
|
55
59
|
crabcode_core/skills/loader.py,sha256=VbT3C84xQ3AOf96MTZmyk3J71Z06M2sGajaQKciBXME,7142
|
|
@@ -64,60 +68,63 @@ crabcode_core/team/manager.py,sha256=tjOcTQDP-LcHjEyRiTquis92dXdPwSrImp0Oqcuh4Mk
|
|
|
64
68
|
crabcode_core/team/message_bus.py,sha256=0Ztj9ikGIzItUuPekSOMS_5YJ7l79CG4T4HK2IPeslQ,13377
|
|
65
69
|
crabcode_core/team/models.py,sha256=P98f7q4oDMH6QU7Ev8DhpYkYmCknG50u_c5VPq3eBXE,5568
|
|
66
70
|
crabcode_core/team/recovery.py,sha256=Lwdcas-zUxqVv9y1EuM4X-4Ixbr7wkugm1dyjMe3nuk,4913
|
|
67
|
-
crabcode_core/tools/__init__.py,sha256=
|
|
71
|
+
crabcode_core/tools/__init__.py,sha256=G_KC87cvsj5y1ncHgN5dCM-3glXbAC2fxM-cvMpCDiM,2336
|
|
68
72
|
crabcode_core/tools/_input_helpers.py,sha256=d7sketqhc2kWodNeuUVfiD40-GnKArsrmxGxfjtXEAE,1298
|
|
69
73
|
crabcode_core/tools/agent.py,sha256=35aLPdgDIqv-jNba2_SV6RIGrOPhxS4fNMi8kRmqt-g,14000
|
|
70
74
|
crabcode_core/tools/ask_user.py,sha256=6CjWaX6f-3RWPyBSSWq4r5m63vRT_wu5_dflAbvE2fY,4466
|
|
71
75
|
crabcode_core/tools/bash.py,sha256=nUztFdJ5a9Zt1megDo0Geda8Oa54mPjMtd4ReDzqbvc,5061
|
|
72
76
|
crabcode_core/tools/browser.py,sha256=3x8sRdZZetlO5uRpbWchmryLQ0EiUtTvScFPoR2GZnU,28267
|
|
73
77
|
crabcode_core/tools/checklist.py,sha256=fZCHi1ft_Yo1bXMBcG-wMdZOFdPQZGOdeHdwYboBDkE,9265
|
|
78
|
+
crabcode_core/tools/checkpoint.py,sha256=l0BJeNOJ9Q9P6AUnqqiQmYb9wG0CzFK2XD3RKeuEpuw,2554
|
|
74
79
|
crabcode_core/tools/diff_utils.py,sha256=IYuEe53zyvb1FAEIU0vcsEPQGCz1TZCyekMhJC5r0AE,3480
|
|
75
|
-
crabcode_core/tools/file_edit.py,sha256=
|
|
80
|
+
crabcode_core/tools/file_edit.py,sha256=SX9r0e7tBbAH-7xWMERaEqFQI9Fjb7L9AwfJiD8rtPU,7471
|
|
76
81
|
crabcode_core/tools/file_read.py,sha256=62sjx1wHNaaOF3XOAKubJ6jhT5V5XWUEnnLwhYqOsDw,5085
|
|
77
82
|
crabcode_core/tools/file_write.py,sha256=6iKg6kyrIcLGeyC2iwN8Z9WE1CDi7L90yFYU1O_GwzU,4829
|
|
78
83
|
crabcode_core/tools/glob.py,sha256=cB9DKE1r0dZqeojzxkfix4am4eI2bCqyDmgK5xc_wdY,3876
|
|
79
|
-
crabcode_core/tools/grep.py,sha256=
|
|
84
|
+
crabcode_core/tools/grep.py,sha256=ZR_9c-LehzHSV8CnVljG3u4-LoLglFhMDeTg4ey4Wk4,5299
|
|
80
85
|
crabcode_core/tools/lint.py,sha256=Kxu5jPq6rbf1Wfw7yXy6lQc_GpT0M4ADK87NEaW1buc,12692
|
|
81
86
|
crabcode_core/tools/memory.py,sha256=YuclnzEGUMgLrizmaJwg-sjMlY6Y6EYlKFhFe_kqgKo,8838
|
|
87
|
+
crabcode_core/tools/revert.py,sha256=uodlTPg9qyJbvwkW9zLuV35zeNc6Z4l5TJwnO03C0fY,3366
|
|
88
|
+
crabcode_core/tools/schedule.py,sha256=tfqCBRXM8kPzR7Mxyogly6Ui8kueqzGxaLalgyVRn3s,21954
|
|
82
89
|
crabcode_core/tools/skill.py,sha256=QdxSh4lRjBOR1J9ggU3_1sZtyETeYxXui9eBj-VFNk4,4763
|
|
83
90
|
crabcode_core/tools/switch_mode.py,sha256=qS9oo8CZhw99gO2g7wchOhezavGersprbOPHkCIO1e0,7328
|
|
84
91
|
crabcode_core/tools/team.py,sha256=Y4kyT5zFvd1qH1Y8tr-VW393ZyLKUfwryncBwvyLc_8,12503
|
|
85
92
|
crabcode_core/tools/web_search.py,sha256=SmQLjPmvLCNeAM0i1nT4NtsNGrlJXqxoipvcQoJujX4,12009
|
|
86
93
|
crabcode_core/types/__init__.py,sha256=gghuU5D2Zgy9AKWge55hqOTphxj2K-Q4oeQPUuaFvCU,1664
|
|
87
|
-
crabcode_core/types/config.py,sha256=
|
|
88
|
-
crabcode_core/types/event.py,sha256=
|
|
89
|
-
crabcode_core/types/message.py,sha256=
|
|
90
|
-
crabcode_core/types/tool.py,sha256=
|
|
91
|
-
crabcode_gateway/__init__.py,sha256=
|
|
94
|
+
crabcode_core/types/config.py,sha256=C7NJmBpjjShYGX9Fa15xQspaBi6zW8COi4bG596xe7A,6449
|
|
95
|
+
crabcode_core/types/event.py,sha256=XHzl9CGj-Tn0ApkDK1C2IxWY2l9-I0YGX7Sezkcx2UU,5223
|
|
96
|
+
crabcode_core/types/message.py,sha256=w_pO6lZa8xVDVkWyjSF9wZ8y3avQu2V7L772VqqRdrU,5144
|
|
97
|
+
crabcode_core/types/tool.py,sha256=DIzWBH_aTOuEc3KLgniyEMbKluhR86OrTet2-ixcJFw,5197
|
|
98
|
+
crabcode_gateway/__init__.py,sha256=eURgiXIn5nv-c9MRBcgFaQgpXowvL7_Mq1AJ8a1Trf8,84
|
|
92
99
|
crabcode_gateway/adapter.py,sha256=jlFzke-V4LfgA20QDQuOMSVWmrrt9QYM1n8Mee_d3lQ,842
|
|
93
|
-
crabcode_gateway/event_bus.py,sha256=
|
|
94
|
-
crabcode_gateway/middleware.py,sha256=
|
|
95
|
-
crabcode_gateway/schemas.py,sha256=
|
|
96
|
-
crabcode_gateway/server.py,sha256=
|
|
100
|
+
crabcode_gateway/event_bus.py,sha256=g9EpAk3HkK0MGUCq0YhYT7mJUVqmGJKveCUgBbSTvfY,6300
|
|
101
|
+
crabcode_gateway/middleware.py,sha256=yTjdZPJTTBbncLYU0CLbAx1NAAWqls5maZqsrlb9DfU,7782
|
|
102
|
+
crabcode_gateway/schemas.py,sha256=PK5PXofcCGjzzwiPVSqHnuholdpIJHskfOh3sjyf7iE,15215
|
|
103
|
+
crabcode_gateway/server.py,sha256=X6KZQ1OgILbBhZBxms0KIe_NPdt0wBAK1ZrTIdcwH2Y,5696
|
|
97
104
|
crabcode_gateway/acp/__init__.py,sha256=PJUCdGBi_ud--LoWxbYbzO7gAgdFCzY_UKeB3JhUvUA,352
|
|
98
|
-
crabcode_gateway/acp/agent.py,sha256=
|
|
105
|
+
crabcode_gateway/acp/agent.py,sha256=D2v7fhHHZzmRek_Gze2YZ3MUALBAZ0SSxtNsL4loM2I,24750
|
|
99
106
|
crabcode_gateway/acp/session.py,sha256=rbN1EcCQw2-LEr-bbW3x0TVmeL5ZGeEaSfBX6LEmjws,4049
|
|
100
107
|
crabcode_gateway/acp/transport.py,sha256=IWU3ih_9heY-EH-AhbprAtpcaj8ZvtWMMS76CAX82QA,1119
|
|
101
108
|
crabcode_gateway/acp/types.py,sha256=_hGt2o7CnhfgC_lvOTtdc_Z1hk6y3WE3RCdJ0Qz0hws,2424
|
|
102
|
-
crabcode_gateway/
|
|
103
|
-
crabcode_gateway/
|
|
104
|
-
crabcode_gateway/
|
|
109
|
+
crabcode_gateway/grpc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
110
|
+
crabcode_gateway/grpc/server.py,sha256=JWTK0d4EjSWVPEYALHxFfO69e6B9oueDHnLUMUWwq0U,16576
|
|
111
|
+
crabcode_gateway/grpc/proto/crabcode.proto,sha256=J4eLfFowt5yqiDDajQF1r3_YAiAmxU-hZ-cDO2UEciQ,3435
|
|
105
112
|
crabcode_gateway/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
106
113
|
crabcode_gateway/routes/agent.py,sha256=G2AbNZUKlaupfZ_rSBmFNAdB476oQUoNrnGgGrNRlhk,4970
|
|
107
|
-
crabcode_gateway/routes/config.py,sha256=
|
|
108
|
-
crabcode_gateway/routes/event.py,sha256=
|
|
114
|
+
crabcode_gateway/routes/config.py,sha256=rVJtK0ZZD-4LMh3zWtyqqePmOBxLZZIiD5d5ItRxzLM,5985
|
|
115
|
+
crabcode_gateway/routes/event.py,sha256=Kc3GbCiHdRn9WdZJ6DQHlEhVpf2ro0hNI7F-pJCNwYo,13341
|
|
109
116
|
crabcode_gateway/routes/health.py,sha256=GzR1RAGNmOPXEyUQNRE0ANJsbDMOQHQGNRhA3dRz87Y,293
|
|
110
|
-
crabcode_gateway/routes/permission.py,sha256=
|
|
111
|
-
crabcode_gateway/routes/session.py,sha256=
|
|
112
|
-
crabcode_gateway/routes/snapshot.py,sha256=
|
|
117
|
+
crabcode_gateway/routes/permission.py,sha256=kC114yHMC-C6FzhQ6wE6TM8R5rOTg-1ZQgviIXPaHSg,1790
|
|
118
|
+
crabcode_gateway/routes/session.py,sha256=mqBpdcxfPOLNINsFNSx9zHwIJxxeaZH3MILw8vjIzuU,12473
|
|
119
|
+
crabcode_gateway/routes/snapshot.py,sha256=Ax1782J76ES1Vh9Y4yGiHNIqcu8Be-LPKggfGd7bjU8,3403
|
|
113
120
|
crabcode_search/__init__.py,sha256=Fw3-cySOi83Y6WSduXUTC62ANXA5lf7PX3kSnQoXEUs,272
|
|
114
121
|
crabcode_search/background.py,sha256=urkJ6RV-aQvCRlaQr2n08S7NiY2sCDEjC-vOZw4vRl0,11098
|
|
115
122
|
crabcode_search/chunker.py,sha256=gtpMWAjNBEAmr9cfhU5uOcuXZFDhEpNRubVbttaxT14,16148
|
|
116
|
-
crabcode_search/embedder.py,sha256=
|
|
123
|
+
crabcode_search/embedder.py,sha256=NlNuOHS7t4JvaWXkNU-T_xxnkjRxFrr3l57dlB5IRkc,16728
|
|
117
124
|
crabcode_search/indexer.py,sha256=wNHrzB9oW8eRcKek6ZtXJdRB_HgFLj_1LhqqtG_tiDw,7522
|
|
118
125
|
crabcode_search/store.py,sha256=7E7fkQ25CgX0LlIp6wrgQNkVS9epUaqLpfoDA_V-BWg,8002
|
|
119
126
|
crabcode_search/tool.py,sha256=-hOW6n3gWDVq-kVKVs3ATOIOaeQtihCFi2VXNb9t00Q,9422
|
|
120
|
-
crabcode-0.1.
|
|
121
|
-
crabcode-0.1.
|
|
122
|
-
crabcode-0.1.
|
|
123
|
-
crabcode-0.1.
|
|
127
|
+
crabcode-0.1.3.dist-info/METADATA,sha256=v0EnVaE4fvh2C1NIGZ2N2azPba-MXkX3sju_lJw5PsE,2107
|
|
128
|
+
crabcode-0.1.3.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
129
|
+
crabcode-0.1.3.dist-info/entry_points.txt,sha256=tpYKME-yDLFb2eqwryWJG-d-HW4dkvDbzwogRl2jays,52
|
|
130
|
+
crabcode-0.1.3.dist-info/RECORD,,
|
crabcode_cli/__init__.py
CHANGED
crabcode_cli/__main__.py
ADDED
crabcode_cli/app.py
CHANGED
|
@@ -31,6 +31,7 @@ def main(
|
|
|
31
31
|
cwd: Optional[str] = typer.Option(None, "--cwd", help="Working directory"),
|
|
32
32
|
resume: Optional[str] = typer.Option(None, "-r", "--resume", help="Resume a session by ID"),
|
|
33
33
|
continue_last: bool = typer.Option(False, "-c", "--continue", help="Continue most recent session"),
|
|
34
|
+
image: Optional[list[str]] = typer.Option(None, "-i", "--image", help="Image file(s) to attach (repeatable)"),
|
|
34
35
|
) -> None:
|
|
35
36
|
"""CrabCode — AI coding assistant in the terminal."""
|
|
36
37
|
from crabcode_core.types.config import ApiConfig, CrabCodeSettings
|
|
@@ -51,6 +52,8 @@ def main(
|
|
|
51
52
|
settings.api.base_url = file_settings.api.base_url
|
|
52
53
|
if file_settings.api.api_key_env:
|
|
53
54
|
settings.api.api_key_env = file_settings.api.api_key_env
|
|
55
|
+
if file_settings.api.http_headers:
|
|
56
|
+
settings.api.http_headers = dict(file_settings.api.http_headers)
|
|
54
57
|
if file_settings.api.format:
|
|
55
58
|
settings.api.format = file_settings.api.format
|
|
56
59
|
if not file_settings.api.thinking_enabled:
|
|
@@ -94,6 +97,30 @@ def main(
|
|
|
94
97
|
err=True,
|
|
95
98
|
)
|
|
96
99
|
|
|
100
|
+
# Read image files into base64 attachments
|
|
101
|
+
image_attachments: list[dict[str, str]] | None = None
|
|
102
|
+
if image:
|
|
103
|
+
import base64
|
|
104
|
+
import mimetypes
|
|
105
|
+
from pathlib import Path
|
|
106
|
+
|
|
107
|
+
image_attachments = []
|
|
108
|
+
for img_path_str in image:
|
|
109
|
+
img_path = Path(img_path_str)
|
|
110
|
+
if not img_path.exists():
|
|
111
|
+
typer.echo(f"Error: image file not found: {img_path_str}", err=True)
|
|
112
|
+
raise typer.Exit(1)
|
|
113
|
+
if img_path.stat().st_size > 20 * 1024 * 1024:
|
|
114
|
+
typer.echo(f"Error: image file too large (>20MB): {img_path_str}", err=True)
|
|
115
|
+
raise typer.Exit(1)
|
|
116
|
+
media_type = mimetypes.guess_type(img_path_str)[0] or "image/png"
|
|
117
|
+
if not media_type.startswith("image/"):
|
|
118
|
+
typer.echo(f"Error: not an image file: {img_path_str}", err=True)
|
|
119
|
+
raise typer.Exit(1)
|
|
120
|
+
with open(img_path, "rb") as f:
|
|
121
|
+
data = base64.b64encode(f.read()).decode("ascii")
|
|
122
|
+
image_attachments.append({"media_type": media_type, "data": data})
|
|
123
|
+
|
|
97
124
|
stdin_text = ""
|
|
98
125
|
if not sys.stdin.isatty():
|
|
99
126
|
stdin_text = sys.stdin.read().strip()
|
|
@@ -105,12 +132,12 @@ def main(
|
|
|
105
132
|
raise typer.Exit(1)
|
|
106
133
|
|
|
107
134
|
from crabcode_cli.pipe import run_pipe
|
|
108
|
-
asyncio.run(run_pipe(text, settings=settings, cwd=work_dir))
|
|
135
|
+
asyncio.run(run_pipe(text, settings=settings, cwd=work_dir, images=image_attachments))
|
|
109
136
|
return
|
|
110
137
|
|
|
111
138
|
if prompt:
|
|
112
139
|
from crabcode_cli.pipe import run_pipe
|
|
113
|
-
asyncio.run(run_pipe(prompt, settings=settings, cwd=work_dir))
|
|
140
|
+
asyncio.run(run_pipe(prompt, settings=settings, cwd=work_dir, images=image_attachments))
|
|
114
141
|
return
|
|
115
142
|
|
|
116
143
|
resume_id: str | None = None
|
crabcode_cli/pipe.py
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
6
7
|
import sys
|
|
7
8
|
|
|
8
9
|
from crabcode_core.events import CoreSession
|
|
@@ -21,16 +22,56 @@ from crabcode_core.types.event import (
|
|
|
21
22
|
TurnCompleteEvent,
|
|
22
23
|
)
|
|
23
24
|
|
|
25
|
+
_DEBUG_TOOL_PAYLOAD = os.getenv("CRABCODE_DEBUG_TOOL_PAYLOAD", "").strip().lower() in {
|
|
26
|
+
"1",
|
|
27
|
+
"true",
|
|
28
|
+
"yes",
|
|
29
|
+
"on",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _format_token_count(tokens: int) -> str:
|
|
34
|
+
if tokens >= 1_000_000:
|
|
35
|
+
return f"{tokens / 1_000_000:.1f}M"
|
|
36
|
+
if tokens >= 1_000:
|
|
37
|
+
return f"{tokens // 1_000}k"
|
|
38
|
+
return str(tokens)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _format_percent(percent: float) -> str:
|
|
42
|
+
rounded = round(percent)
|
|
43
|
+
if abs(percent - rounded) < 0.05:
|
|
44
|
+
return f"{rounded}%"
|
|
45
|
+
return f"{percent:.1f}%"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _format_context_usage(event: TurnCompleteEvent) -> str | None:
|
|
49
|
+
used = max(0, int(getattr(event, "context_used_tokens", 0) or 0))
|
|
50
|
+
window = max(0, int(getattr(event, "context_window_tokens", 0) or 0))
|
|
51
|
+
if not used and not window:
|
|
52
|
+
return None
|
|
53
|
+
if not window:
|
|
54
|
+
return f"Context: {_format_token_count(used)} tokens used (window unknown)"
|
|
55
|
+
|
|
56
|
+
used_percent = max(0.0, float(getattr(event, "context_used_percent", 0.0) or 0.0))
|
|
57
|
+
remaining_percent = max(0.0, 100.0 - used_percent)
|
|
58
|
+
return (
|
|
59
|
+
f"Context: {_format_percent(used_percent)} used "
|
|
60
|
+
f"({_format_percent(remaining_percent)} remaining) · "
|
|
61
|
+
f"{_format_token_count(used)} tokens used of {_format_token_count(window)}"
|
|
62
|
+
)
|
|
63
|
+
|
|
24
64
|
|
|
25
65
|
async def run_pipe(
|
|
26
66
|
prompt: str,
|
|
27
67
|
settings: CrabCodeSettings | None = None,
|
|
28
68
|
cwd: str = ".",
|
|
69
|
+
images: list[dict[str, str]] | None = None,
|
|
29
70
|
) -> None:
|
|
30
71
|
"""Run a single prompt through the core and print the response."""
|
|
31
72
|
session = CoreSession(cwd=cwd, settings=settings)
|
|
32
73
|
try:
|
|
33
|
-
async for event in session.send_message(prompt):
|
|
74
|
+
async for event in session.send_message(prompt, images=images):
|
|
34
75
|
if isinstance(event, StreamTextEvent):
|
|
35
76
|
sys.stdout.write(safe_utf8_str(event.text))
|
|
36
77
|
sys.stdout.flush()
|
|
@@ -38,6 +79,9 @@ async def run_pipe(
|
|
|
38
79
|
pass
|
|
39
80
|
elif isinstance(event, ToolUseEvent):
|
|
40
81
|
sys.stderr.write(f"\n[Tool: {event.tool_name}]\n")
|
|
82
|
+
if _DEBUG_TOOL_PAYLOAD:
|
|
83
|
+
pretty = json.dumps(event.tool_input, ensure_ascii=False, indent=2)
|
|
84
|
+
sys.stderr.write(f"{pretty}\n")
|
|
41
85
|
sys.stderr.flush()
|
|
42
86
|
elif isinstance(event, PermissionRequestEvent):
|
|
43
87
|
await session.respond_permission(
|
|
@@ -64,7 +108,10 @@ async def run_pipe(
|
|
|
64
108
|
if not event.recoverable:
|
|
65
109
|
sys.exit(1)
|
|
66
110
|
elif isinstance(event, TurnCompleteEvent):
|
|
67
|
-
|
|
111
|
+
usage_text = _format_context_usage(event)
|
|
112
|
+
if usage_text:
|
|
113
|
+
sys.stderr.write(f"\n{usage_text}\n")
|
|
114
|
+
sys.stderr.flush()
|
|
68
115
|
finally:
|
|
69
116
|
await session.close()
|
|
70
117
|
|