crabcode 0.1.4__py3-none-any.whl → 0.1.5__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.4.dist-info → crabcode-0.1.5.dist-info}/METADATA +12 -1
- crabcode-0.1.5.dist-info/RECORD +178 -0
- crabcode_cli/app.py +221 -9
- crabcode_cli/banner.py +11 -14
- crabcode_cli/model_picker.py +168 -0
- crabcode_cli/repl.py +971 -186
- crabcode_cli/session_picker.py +239 -0
- crabcode_core/_version.py +1 -1
- crabcode_core/_windows_process.py +68 -0
- crabcode_core/agent_manager.py +7 -0
- crabcode_core/api/anthropic_adapter.py +32 -7
- crabcode_core/api/base.py +44 -2
- crabcode_core/api/codex_adapter.py +285 -28
- crabcode_core/api/model_info.py +89 -0
- crabcode_core/api/openai_adapter.py +27 -27
- crabcode_core/command_line.py +18 -0
- crabcode_core/compact/compact.py +19 -7
- crabcode_core/compact/context_tokens.py +139 -0
- crabcode_core/config/claudemd.py +2 -2
- crabcode_core/config/manager.py +77 -8
- crabcode_core/events.py +225 -9
- crabcode_core/file_lock.py +81 -0
- crabcode_core/filesystem.py +22 -0
- crabcode_core/hooks/manager.py +17 -6
- crabcode_core/io_worker.py +209 -0
- crabcode_core/logging_utils.py +60 -2
- crabcode_core/lsp/client.py +49 -20
- crabcode_core/lsp/diagnostics.py +3 -3
- crabcode_core/lsp/manager.py +2 -1
- crabcode_core/mcp/config.py +1 -1
- crabcode_core/path_validation.py +34 -0
- crabcode_core/peer/runtime.py +58 -37
- crabcode_core/prompts/context.py +16 -8
- crabcode_core/prompts/system.py +35 -3
- crabcode_core/prompts/templates.py +5 -3
- crabcode_core/query/loop.py +445 -114
- crabcode_core/schedule/__init__.py +10 -2
- crabcode_core/schedule/manager.py +617 -0
- crabcode_core/schedule/store.py +215 -7
- crabcode_core/schedule/timing.py +287 -0
- crabcode_core/session/meta_db.py +71 -5
- crabcode_core/session/storage.py +273 -72
- crabcode_core/snapshot/snapshot.py +17 -3
- crabcode_core/snapshot/tracker.py +112 -5
- crabcode_core/subprocess_utils.py +260 -0
- crabcode_core/team/inbox.py +48 -101
- crabcode_core/team/message_bus.py +47 -104
- crabcode_core/text_io.py +52 -0
- crabcode_core/tools/__init__.py +20 -0
- crabcode_core/tools/_input_schema.py +130 -0
- crabcode_core/tools/bash.py +45 -32
- crabcode_core/tools/browser.py +15 -1
- crabcode_core/tools/checkpoint.py +14 -2
- crabcode_core/tools/file_edit.py +44 -5
- crabcode_core/tools/file_read.py +13 -3
- crabcode_core/tools/file_write.py +25 -4
- crabcode_core/tools/glob.py +8 -3
- crabcode_core/tools/grep.py +107 -20
- crabcode_core/tools/image.py +166 -0
- crabcode_core/tools/image_generate.py +115 -0
- crabcode_core/tools/lint.py +17 -8
- crabcode_core/tools/monitor.py +12 -26
- crabcode_core/tools/schedule.py +142 -71
- crabcode_core/types/__init__.py +4 -0
- crabcode_core/types/config.py +94 -2
- crabcode_core/types/event.py +30 -0
- crabcode_core/types/message.py +14 -0
- crabcode_core/types/tool.py +47 -0
- crabcode_debugger/adapters.py +7 -1
- crabcode_debugger/dap.py +88 -15
- crabcode_debugger/memory.py +157 -42
- crabcode_debugger/process.py +52 -17
- crabcode_debugger/runtime.py +40 -5
- crabcode_debugger/sessions.py +112 -68
- crabcode_debugger/tool.py +79 -8
- crabcode_gateway/__init__.py +12 -1
- crabcode_gateway/acp/agent.py +59 -17
- crabcode_gateway/auth.py +139 -0
- crabcode_gateway/document_engine.py +636 -0
- crabcode_gateway/document_worker.py +301 -0
- crabcode_gateway/event_bus.py +23 -12
- crabcode_gateway/grpc/server.py +36 -7
- crabcode_gateway/middleware.py +78 -17
- crabcode_gateway/protocol.py +17 -0
- crabcode_gateway/routes/agent.py +161 -10
- crabcode_gateway/routes/auth.py +150 -0
- crabcode_gateway/routes/config.py +876 -38
- crabcode_gateway/routes/document.py +1810 -0
- crabcode_gateway/routes/event.py +2179 -163
- crabcode_gateway/routes/peer.py +78 -0
- crabcode_gateway/routes/schedule.py +300 -0
- crabcode_gateway/routes/session.py +763 -164
- crabcode_gateway/routes/snapshot.py +74 -32
- crabcode_gateway/routes/tasks.py +318 -0
- crabcode_gateway/routes/team.py +392 -0
- crabcode_gateway/routes/workspace.py +283 -0
- crabcode_gateway/safe_file.py +63 -0
- crabcode_gateway/schemas.py +870 -6
- crabcode_gateway/server.py +136 -4
- crabcode_gateway/task_registry.py +75 -0
- crabcode_search/background.py +6 -9
- crabcode_search/indexer.py +10 -7
- crabcode_search/store.py +4 -4
- crabcode_search/tool.py +5 -1
- crabcode-0.1.4.dist-info/RECORD +0 -150
- {crabcode-0.1.4.dist-info → crabcode-0.1.5.dist-info}/WHEEL +0 -0
- {crabcode-0.1.4.dist-info → crabcode-0.1.5.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: crabcode
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: CrabCode - AI coding assistant in the terminal
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: anthropic>=0.40.0
|
|
@@ -17,12 +17,17 @@ Provides-Extra: all
|
|
|
17
17
|
Requires-Dist: agent-client-protocol>=0.9.0; extra == 'all'
|
|
18
18
|
Requires-Dist: anthropic[bedrock]>=0.40.0; extra == 'all'
|
|
19
19
|
Requires-Dist: anthropic[vertex]>=0.40.0; extra == 'all'
|
|
20
|
+
Requires-Dist: babeldoc==0.6.4; extra == 'all'
|
|
21
|
+
Requires-Dist: cryptography>=42.0.0; extra == 'all'
|
|
20
22
|
Requires-Dist: fastapi>=0.115.0; extra == 'all'
|
|
21
23
|
Requires-Dist: grpcio-health-checking>=1.65.0; extra == 'all'
|
|
22
24
|
Requires-Dist: grpcio>=1.65.0; extra == 'all'
|
|
23
25
|
Requires-Dist: httpx>=0.27.0; extra == 'all'
|
|
24
26
|
Requires-Dist: modelscope>=1.10.0; extra == 'all'
|
|
25
27
|
Requires-Dist: playwright>=1.48.0; extra == 'all'
|
|
28
|
+
Requires-Dist: pyjwt>=2.9.0; extra == 'all'
|
|
29
|
+
Requires-Dist: pypdf>=4.0.0; extra == 'all'
|
|
30
|
+
Requires-Dist: python-multipart>=0.0.9; extra == 'all'
|
|
26
31
|
Requires-Dist: sentence-transformers>=2.0.0; extra == 'all'
|
|
27
32
|
Requires-Dist: sse-starlette>=2.0.0; extra == 'all'
|
|
28
33
|
Requires-Dist: tree-sitter-language-pack>=1.0.0; extra == 'all'
|
|
@@ -33,12 +38,18 @@ Requires-Dist: anthropic[bedrock]>=0.40.0; extra == 'bedrock'
|
|
|
33
38
|
Provides-Extra: browser
|
|
34
39
|
Requires-Dist: playwright>=1.48.0; extra == 'browser'
|
|
35
40
|
Provides-Extra: debugger
|
|
41
|
+
Provides-Extra: document-translate
|
|
42
|
+
Requires-Dist: babeldoc==0.6.4; extra == 'document-translate'
|
|
36
43
|
Provides-Extra: gateway
|
|
37
44
|
Requires-Dist: agent-client-protocol>=0.9.0; extra == 'gateway'
|
|
45
|
+
Requires-Dist: cryptography>=42.0.0; extra == 'gateway'
|
|
38
46
|
Requires-Dist: fastapi>=0.115.0; extra == 'gateway'
|
|
39
47
|
Requires-Dist: grpcio-health-checking>=1.65.0; extra == 'gateway'
|
|
40
48
|
Requires-Dist: grpcio>=1.65.0; extra == 'gateway'
|
|
41
49
|
Requires-Dist: httpx>=0.27.0; extra == 'gateway'
|
|
50
|
+
Requires-Dist: pyjwt>=2.9.0; extra == 'gateway'
|
|
51
|
+
Requires-Dist: pypdf>=4.0.0; extra == 'gateway'
|
|
52
|
+
Requires-Dist: python-multipart>=0.0.9; extra == 'gateway'
|
|
42
53
|
Requires-Dist: sse-starlette>=2.0.0; extra == 'gateway'
|
|
43
54
|
Requires-Dist: uvicorn[standard]>=0.30.0; extra == 'gateway'
|
|
44
55
|
Provides-Extra: search
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
crabcode_cli/__init__.py,sha256=vBL_d7W0Vt2kIaYI3iZ2yS7kZleJEQXTTlIBICm5GRY,136
|
|
2
|
+
crabcode_cli/__main__.py,sha256=ekwH_ayJ5YpefhbXSDj-IM9mS9YrCwWpoDIH92V6tjg,75
|
|
3
|
+
crabcode_cli/app.py,sha256=fbmIge0-Tz3R3rxfC1T-3ZnBYMSuHhDUE498v9SId0Q,28455
|
|
4
|
+
crabcode_cli/banner.py,sha256=WlQPxVLLnzIE6xlP6gFbpCDYmDewzIwLtHKFLf9GC-I,1339
|
|
5
|
+
crabcode_cli/model_picker.py,sha256=ghxsVySXy9WZVJLVb3ElTf9D2sWeT6lidcPWB0gX-_Y,8352
|
|
6
|
+
crabcode_cli/pipe.py,sha256=gJHtr4_TZC2HDrninqi4NEd0oQ3q8buDobCsXwEE8yk,4987
|
|
7
|
+
crabcode_cli/repl.py,sha256=EpJBo_JWh_fQPqDdVc9-rLkW_v3dykVZPGHkDxFToGE,177040
|
|
8
|
+
crabcode_cli/session_picker.py,sha256=Pett41MV4xcg6vDR4Rbq8C0bh40u-GVF_cjQldNQIoQ,10307
|
|
9
|
+
crabcode_cli/render/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
crabcode_cli/render/messages.py,sha256=n9OsbLIAU3FyO9gwGMMJld7zq-71N0caz9ecmE2kIjo,568
|
|
11
|
+
crabcode_core/__init__.py,sha256=ArpgEg5xC3iR4DRT0HBg7DwU3K-r1MnmDOHpIb1b0E4,142
|
|
12
|
+
crabcode_core/_version.py,sha256=fnaKfg6PWsCRG0lRV4Ed52CFb7EJr6h9y6ggzFn---o,82
|
|
13
|
+
crabcode_core/_windows_process.py,sha256=PjRQqZfLSHdvexANQYHZDQNxyu2s1Yaxt1YNlawwNIU,2949
|
|
14
|
+
crabcode_core/agent_manager.py,sha256=Hab0tD4wI-FE9IdZ8bAFdHjQC-yK1CVPLNTIHvaLj9c,68659
|
|
15
|
+
crabcode_core/command_line.py,sha256=MWbAF4QUDVdwGM8cKoHYnIgr8yOgqk3Y_0ndt9f-t6Y,544
|
|
16
|
+
crabcode_core/events.py,sha256=AYAZpQ-osFXZVmywjwcTlaw-pNbTZudgWH9Zj9-qhxw,188656
|
|
17
|
+
crabcode_core/file_lock.py,sha256=MubMAy749yVzxBCsF1n3SaqQU3jtWqeb6yasZKFLOPU,3075
|
|
18
|
+
crabcode_core/filesystem.py,sha256=savLKfRLqSKyjiA-IftP9ZAL4t7fIarYPJ0QbyECmiA,695
|
|
19
|
+
crabcode_core/goal.py,sha256=PCpU9dyKpLcsKXvt4zigPvRSloKf64FUY4z5mUmqLWs,5231
|
|
20
|
+
crabcode_core/io_worker.py,sha256=Nh5eyBXn8iR5FoHWyrNavJ4xBecBMz8wG1ViGowDNJg,8125
|
|
21
|
+
crabcode_core/logging_utils.py,sha256=brbKTK7yxk6bhneSodu-sk-drD0a1fPdz35OYAWCIWM,5672
|
|
22
|
+
crabcode_core/path_validation.py,sha256=pssxal6fTjK3lgUD8a5KzeEhebroDW-QT3Ko3IbxVP4,1419
|
|
23
|
+
crabcode_core/subprocess_utils.py,sha256=BIgrTc4wcvx7eJopyU0lKgvixuN7mny7IuqrtNAu1c4,9893
|
|
24
|
+
crabcode_core/text_io.py,sha256=RwZUE-XCO9FcfoH0zDsF26BMuL4PpviEpZ5GJKB4hXI,1386
|
|
25
|
+
crabcode_core/utf8_sanitize.py,sha256=RRTGgwA9jqK-HLR1WUSFwgG4xJn7ZukTDu7M6Oi3fHI,936
|
|
26
|
+
crabcode_core/api/__init__.py,sha256=IXs4hLgC4cT85TLdmS4KgtPKYDytadkwvrDyBshr5ag,674
|
|
27
|
+
crabcode_core/api/anthropic_adapter.py,sha256=c3dCQRyOnpKmUnxR5JSdjpc85OFxAp8reYUxtA1vqCs,21668
|
|
28
|
+
crabcode_core/api/azure_adapter.py,sha256=zJ7q3Ni3sVwK3Bbju_nO8t8kPEA_bL6scVFC-XRPRh4,2360
|
|
29
|
+
crabcode_core/api/base.py,sha256=jf_PaLOlfbXqBZUd7ViovlbvHOvPsH_CqUz-WgcVLsE,6090
|
|
30
|
+
crabcode_core/api/codex_adapter.py,sha256=iNXvoEZmNxxizhBOv6RXs92-fAumSHtlb3dNimcbmbA,41996
|
|
31
|
+
crabcode_core/api/gemini_adapter.py,sha256=RVk3zlLPqDtzG8w5psu4aSoFyFLua5qQx3subqz-5DQ,1130
|
|
32
|
+
crabcode_core/api/model_info.py,sha256=cwO541Y4Jb6a_evxJdKsNW-BJAx29uxmfdvJOoz1PFA,7778
|
|
33
|
+
crabcode_core/api/ollama_adapter.py,sha256=ZpTg11zOUGFE0J88qBXL7AvxDQU5PjWg2wWvm4uxUvY,1158
|
|
34
|
+
crabcode_core/api/openai_adapter.py,sha256=p8vWKODCKSYJyCBCR7mZAvlMd9eLRA4-jHMsH-q7DHM,10692
|
|
35
|
+
crabcode_core/api/registry.py,sha256=tCVRE74bMUn9ukCbGp3bDtSOYZ6_EmsNfdVnnkGN6k4,2413
|
|
36
|
+
crabcode_core/compact/__init__.py,sha256=9445RwiG5BI8b6mrXMcNkcPLs5NH3RSKFxDrXsgmmK8,395
|
|
37
|
+
crabcode_core/compact/compact.py,sha256=BfU6rmT0F77HN6AdS7hjXoSMPmjYGUD2OIk32KeZaE0,19346
|
|
38
|
+
crabcode_core/compact/context_tokens.py,sha256=P1XoGRnP4YNTp1YdIII7I718P4aiA1sRYkUI8iTt7w0,5953
|
|
39
|
+
crabcode_core/config/__init__.py,sha256=wbSnNVCqj673phu2pvIFz-f5HM5bLvH-FdD9b01HNRA,84
|
|
40
|
+
crabcode_core/config/claudemd.py,sha256=etHqktoj5ekaV5gTdvSDwSZk-jtgUHkkVtMi-JHmnt0,2009
|
|
41
|
+
crabcode_core/config/manager.py,sha256=PKqCnwYcxr2SS2EX-Y28TtnDAplrJosUau5ZZjz3qPI,8041
|
|
42
|
+
crabcode_core/hooks/__init__.py,sha256=wfOnbLuJqtLezKYWYmBTAE9qG-eaG7wSfgx1-kS7N64,165
|
|
43
|
+
crabcode_core/hooks/manager.py,sha256=bVbe08EAGbY-pNxgkTFzonOEP4kE49Z8Ly9gIq-mv2U,10072
|
|
44
|
+
crabcode_core/lsp/__init__.py,sha256=np9EYVvOi94ZFxLWW_kD13AfwaIhN0Vcp8-pHaLDn6c,189
|
|
45
|
+
crabcode_core/lsp/client.py,sha256=QQM3EuWxEz5ipnpalCzTC4P2kfnknVM3iOizm6Tdkv0,28043
|
|
46
|
+
crabcode_core/lsp/diagnostics.py,sha256=NkhEhlbKiafiwoIQxLOBizRsa6UNe18q7T99vgyA7t4,4220
|
|
47
|
+
crabcode_core/lsp/manager.py,sha256=LXK16-PwxnPZnjNoYLAew471QvG-gs5uKfgLCKieogY,19049
|
|
48
|
+
crabcode_core/mcp/__init__.py,sha256=axvOgOWHjpKs7WFEkf8Za_4mm_oNe0tYyD94dAMnWTE,182
|
|
49
|
+
crabcode_core/mcp/client.py,sha256=3e7LQKq8kNyE2E6-wmSa_MpysgsznuPUS6sxWgp2RiA,5233
|
|
50
|
+
crabcode_core/mcp/config.py,sha256=Og_g6MnvsmgWbs2DlDb1GBpI_7kSs07AbyYuplaZReg,1973
|
|
51
|
+
crabcode_core/peer/__init__.py,sha256=eXhG-X0ZT5KgV3BKVXYEB7tQDG2SM3Igdb0-7OPtY2k,234
|
|
52
|
+
crabcode_core/peer/runtime.py,sha256=hRpe7gCocjXbrM7u1sk-jQZFc49m1Jr5yQ3F8j1CwQ8,20879
|
|
53
|
+
crabcode_core/permissions/__init__.py,sha256=grH8A95Lr5L-gsXOIkb-J6RldRdaktMEvKUcZize9r0,198
|
|
54
|
+
crabcode_core/permissions/ai_reviewer.py,sha256=geE6lGKf6PUDnkNuVWc3TfXRsVqhM8YmAVxvhh7vp8M,7296
|
|
55
|
+
crabcode_core/permissions/manager.py,sha256=qetYavaXZWnQOUtFEkVkb4aehiKaIgKHScf7hsGwq2c,5907
|
|
56
|
+
crabcode_core/plan/__init__.py,sha256=co_SEC__Z3OtijC9hxdVWIcdUBsUVsJnQ-LkxJfpAL8,169
|
|
57
|
+
crabcode_core/plan/executor.py,sha256=k9PmjAfmgZklYys5oUQW5xUD7Tc2JoB-gIcQEkIli7c,10442
|
|
58
|
+
crabcode_core/plan/types.py,sha256=pPfcdu40sTbxr8uBNAEguZR1GzvSFYDIL40HL_bU_io,5733
|
|
59
|
+
crabcode_core/prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
60
|
+
crabcode_core/prompts/context.py,sha256=-HURrmE6apK2teTsEbtKYqJg2uS0eeeoVEF7ZsuKI_I,7987
|
|
61
|
+
crabcode_core/prompts/profile.py,sha256=MWxdrC0vVc6QfaRa5sgKEC8Gi_s61F9ZaxjoCTiiEPc,2088
|
|
62
|
+
crabcode_core/prompts/system.py,sha256=WKpO4nqnZFgUOUf_XW4zPHkDVsYsOfRHpJ0rq5FdL_M,37197
|
|
63
|
+
crabcode_core/prompts/templates.py,sha256=aSW0VcqXaIxfWvAW89Oq-5S3yneFCm4X4y39rgadHaw,2687
|
|
64
|
+
crabcode_core/query/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
65
|
+
crabcode_core/query/loop.py,sha256=vx2ESZYMWGsz5m3Tv-U6cvdegMVV3ut9fqgbR-_AicY,76557
|
|
66
|
+
crabcode_core/schedule/__init__.py,sha256=HMMnVlsG6sMiqufW3g-TSpH614evs1LQ2j2sbBjZpyk,387
|
|
67
|
+
crabcode_core/schedule/manager.py,sha256=Cpbkf1tyr34qo5EEqLvpqBvzQLFlWdcMstj7xEJkVF8,23945
|
|
68
|
+
crabcode_core/schedule/models.py,sha256=T3Z7wapFCkuE_ZeIDK2Clq8WGThKs88ENjXklT1_LE8,7847
|
|
69
|
+
crabcode_core/schedule/store.py,sha256=fj_R3LawFfQo2YTnq1LMUXuQQz4mbxhC7r4q5I_JP6U,20462
|
|
70
|
+
crabcode_core/schedule/timing.py,sha256=Belm63_XYo9nVrFUc8Njgp5rQ7ROPrQxAa_BXczdXe8,8881
|
|
71
|
+
crabcode_core/session/__init__.py,sha256=0E_Flt_OkcFVkxbRTDVxot3TrUZ23T5qspIJqlYnwtE,441
|
|
72
|
+
crabcode_core/session/export.py,sha256=pF_nT60XaqmeTxGgiLnGPnW-SeOFscI1V8qCCqOhlOE,4521
|
|
73
|
+
crabcode_core/session/meta_db.py,sha256=in1Bol8q4sIT87fSqqtmsRqLaogfdWja69mM9V84qCw,23208
|
|
74
|
+
crabcode_core/session/storage.py,sha256=BVOK0_OoKS-WPuaNWvPT9vY44U5FMEuSp7IkiCmbNYs,75495
|
|
75
|
+
crabcode_core/session/title_gen.py,sha256=TrIqrWRSScZjVGOaG3h4zl7PhxPMD-86zLIYcVdElP4,1507
|
|
76
|
+
crabcode_core/skills/__init__.py,sha256=2A99hK6_T53EPy-hcYYu4FobhUAZjLL-O7ObIyG3yuQ,296
|
|
77
|
+
crabcode_core/skills/loader.py,sha256=VbT3C84xQ3AOf96MTZmyk3J71Z06M2sGajaQKciBXME,7142
|
|
78
|
+
crabcode_core/skills/matcher.py,sha256=gPt-nYz9YmUK_Pb3KjivrYl6izDSBiYo3HlrDhxcggs,7066
|
|
79
|
+
crabcode_core/snapshot/__init__.py,sha256=ACgq5C5_ChCXTW8UJWzhWz8vAJLw5MKtNyt9F1fYKQk,418
|
|
80
|
+
crabcode_core/snapshot/snapshot.py,sha256=djOUndI3kM3yFCYVUhXo6gwGbGX2P2tXT9WOk7xZw_U,17573
|
|
81
|
+
crabcode_core/snapshot/tracker.py,sha256=DRMRutkHt6-N9uWVDJjtD24Ecr0hB_zl1xiWz2J2ZuM,11981
|
|
82
|
+
crabcode_core/team/__init__.py,sha256=llNqc6kSc5ng3WI1_-ABFe9RXc189A3MMXb1awKB4Ko,502
|
|
83
|
+
crabcode_core/team/bridge.py,sha256=JMBjN33rWwrqLdzsTb4liP6Sc9I86u2JNqneWaaei60,2065
|
|
84
|
+
crabcode_core/team/inbox.py,sha256=GSlWJ_kxtKrpQjmUTGZ1whwV9VTJpgq4eLEre32fEqU,9377
|
|
85
|
+
crabcode_core/team/manager.py,sha256=dxkzpMYXtkUTB2UpgubtWNM8VQKfop6ftKiHcJRYkKo,74202
|
|
86
|
+
crabcode_core/team/message_bus.py,sha256=Ti_trfYvMhUkXh6_qYI-G0r54lQtclWu0dxOZR95wSg,35258
|
|
87
|
+
crabcode_core/team/models.py,sha256=QHICKRNpGK6Gc3pMb_3TY6CvFLEtLm-jF9R4HKGIhQo,5653
|
|
88
|
+
crabcode_core/team/recovery.py,sha256=77vA3dE9IuY16n-Qh0gtuKCbmc7C1l-Mb-hiMBXpD0c,6790
|
|
89
|
+
crabcode_core/tools/__init__.py,sha256=VaQuOjiO5lXWReQgTg-4haJQ0ZUWdAhMJDmqspf2Oz4,3446
|
|
90
|
+
crabcode_core/tools/_input_helpers.py,sha256=d7sketqhc2kWodNeuUVfiD40-GnKArsrmxGxfjtXEAE,1298
|
|
91
|
+
crabcode_core/tools/_input_schema.py,sha256=uV7zEBlw1W1V3qp-dyJb-Zz7G12oDrkEeV2vL3vV-hk,3874
|
|
92
|
+
crabcode_core/tools/agent.py,sha256=KLIPgm1JsYcGY3fMR0Gj4L3m5YepBXJ66ape1f9ykPo,16520
|
|
93
|
+
crabcode_core/tools/ask_user.py,sha256=6CjWaX6f-3RWPyBSSWq4r5m63vRT_wu5_dflAbvE2fY,4466
|
|
94
|
+
crabcode_core/tools/bash.py,sha256=0TQgev4S4RIdFXl5UMuFxw6WI7QVJHTm-XRO_da-Xh0,6107
|
|
95
|
+
crabcode_core/tools/browser.py,sha256=3zJ1qXKAYKPBRc6zBqByRrwIDFFqM6wW-y-k4nAiVuo,28864
|
|
96
|
+
crabcode_core/tools/checklist.py,sha256=fZCHi1ft_Yo1bXMBcG-wMdZOFdPQZGOdeHdwYboBDkE,9265
|
|
97
|
+
crabcode_core/tools/checkpoint.py,sha256=4icrUzfAjaUeAMiXEcd6GptXdvx3xbavJiW3moXBNCk,2989
|
|
98
|
+
crabcode_core/tools/diff_utils.py,sha256=IYuEe53zyvb1FAEIU0vcsEPQGCz1TZCyekMhJC5r0AE,3480
|
|
99
|
+
crabcode_core/tools/file_edit.py,sha256=ZUqNcLTLzeNjM_YmoZ3X5Ec6lxBYw3B12vmlz--H9NA,8977
|
|
100
|
+
crabcode_core/tools/file_read.py,sha256=JpZR-m9uYhk35FsNkC1arZvBr7VaGvbJIr8OD3Fjf0c,5578
|
|
101
|
+
crabcode_core/tools/file_write.py,sha256=iz9H8jLbVJbeFITm7DHxvX6UjLuv_esJdDXNdmHz-kk,5727
|
|
102
|
+
crabcode_core/tools/glob.py,sha256=nWlH2GE_ouL8oo4tH2xBIEBcqJ3Bci9OTIcjh1OGgoM,4101
|
|
103
|
+
crabcode_core/tools/goal.py,sha256=N_63Yhs-TtfhYW26gV2-MCeA8B2D3M44Cz9v7Iys5zc,4640
|
|
104
|
+
crabcode_core/tools/grep.py,sha256=i0ff6163JgjxjJ_wmImbLOFrmyWrE8JMPckVe46wPC0,8488
|
|
105
|
+
crabcode_core/tools/image.py,sha256=nrEWBImJr3OryAZp4zjsFw3WZERHnXby7g3W7PjN_LI,7180
|
|
106
|
+
crabcode_core/tools/image_generate.py,sha256=clY_1hr2nuRDntHPTDho1aZf3BAr1vgcuWO6fqE8PzM,5776
|
|
107
|
+
crabcode_core/tools/lint.py,sha256=ztrI5rnIn0x8o4gdcEHG5uk6pa5x22mpv8R3p1-lOTA,13346
|
|
108
|
+
crabcode_core/tools/memory.py,sha256=PUktTd6E1khTKNfTjT0XeW8kPI7OtDOJoA2E0IWx1hA,17418
|
|
109
|
+
crabcode_core/tools/monitor.py,sha256=rhGVmjQF7ixjpN9fAsoUZBK3lSg3tsAFr9UmKEYza8o,24536
|
|
110
|
+
crabcode_core/tools/peer.py,sha256=6epsy3AiQBzdt71VQst_tSIU2T3YRs7IO7Y3Ahq4ryc,3848
|
|
111
|
+
crabcode_core/tools/revert.py,sha256=xFIplwG7KV_YjMhhCEKr_cu2LYXt-jkvvewrnlk-rmw,3393
|
|
112
|
+
crabcode_core/tools/schedule.py,sha256=5had7iFGpphblAzLzhl3lB7C-UUePNKccrlyMq_6bIw,25335
|
|
113
|
+
crabcode_core/tools/skill.py,sha256=QdxSh4lRjBOR1J9ggU3_1sZtyETeYxXui9eBj-VFNk4,4763
|
|
114
|
+
crabcode_core/tools/switch_mode.py,sha256=emWTDFFzkyZwPr6ZZtG-cGVqOpmYrWCZCmjtW-wg698,9258
|
|
115
|
+
crabcode_core/tools/team.py,sha256=njjxjbLnnaO4RZNSqieQyFzhdMij9nZiku0zYEugOiU,12671
|
|
116
|
+
crabcode_core/tools/web_search.py,sha256=SmQLjPmvLCNeAM0i1nT4NtsNGrlJXqxoipvcQoJujX4,12009
|
|
117
|
+
crabcode_core/types/__init__.py,sha256=4ZEs24AWhvp5wOLGJmSK0u7WQ9cc6BVJmSOM1aYGsnM,1890
|
|
118
|
+
crabcode_core/types/config.py,sha256=kBPc4hQr7HioqEUgWnCA8zBfYdTchF6Nstni2d37-PI,12205
|
|
119
|
+
crabcode_core/types/event.py,sha256=2PLKTwQsaZmjfimeRlh85gY6H1WYBB6G9nfo1Uce7kE,6971
|
|
120
|
+
crabcode_core/types/message.py,sha256=RAVuEZB-Mis53yocGBHINBpfVYTFKJF3hC2J7w1Y8uw,7446
|
|
121
|
+
crabcode_core/types/tool.py,sha256=VTxCn4Sq5kWZrOsmVE-3zeB9EXjfHYAGhZGWKtzqHIY,7530
|
|
122
|
+
crabcode_debugger/__init__.py,sha256=5CHIc3Q7gUDiKLiWhglAiya65OE2qe0z-SfaBUkXG1Q,152
|
|
123
|
+
crabcode_debugger/adapters.py,sha256=OIOdup-HxkfsKtKddu18KOIttWaJLZ-xorEz8mmOxY4,11976
|
|
124
|
+
crabcode_debugger/dap.py,sha256=sxMOTSknE1Bj8PqqqQEn9rdp7T5wqHiTEkL0cssxsUo,10686
|
|
125
|
+
crabcode_debugger/memory.py,sha256=4bsI8C7rhgFOzV7FwYoLCreuiEIEKcVTwN4Qqr5YPuw,68889
|
|
126
|
+
crabcode_debugger/process.py,sha256=Q7Ij8fpxOgkTgJGFjPol18jidRe0XF5wGRq6niuwfdQ,25605
|
|
127
|
+
crabcode_debugger/runtime.py,sha256=weuFQ6T6uOWRyX7ngZvYcfgd3cVyvNKL0Sr4YfcRjXw,1471
|
|
128
|
+
crabcode_debugger/sessions.py,sha256=06MGeLXhH6air2QDtcrLRWLOQx8EHc_a0c4eGeiYKWE,15396
|
|
129
|
+
crabcode_debugger/tool.py,sha256=NM-jGFjgsvQD-DLfk8pmtW44h79pIIpSt0hqCVxRk14,33813
|
|
130
|
+
crabcode_gateway/__init__.py,sha256=QQRtmZFDCcpqB0G1VnPT9rR6f55HZuvwZKc4zYfPbj4,412
|
|
131
|
+
crabcode_gateway/adapter.py,sha256=jlFzke-V4LfgA20QDQuOMSVWmrrt9QYM1n8Mee_d3lQ,842
|
|
132
|
+
crabcode_gateway/auth.py,sha256=OAIjy3uSgIOO0jqLK69kOU5PR_bgSId-xoCbLwj-c38,4605
|
|
133
|
+
crabcode_gateway/document_engine.py,sha256=hA9aN7bYH-UGoZu6O1XN5b-WcqTcV05DdgNMLB1jqdQ,25314
|
|
134
|
+
crabcode_gateway/document_worker.py,sha256=HtV92f02QpBPxlrhT4_ZNFgC8mR94OAKiBhxOmkjey8,11445
|
|
135
|
+
crabcode_gateway/event_bus.py,sha256=lWLCeoKkJ9fhDT_Kwc_esokDsbeRkPi5hsK87kPxRRY,26181
|
|
136
|
+
crabcode_gateway/middleware.py,sha256=vhyRM8C9kv0j-31rmnkSuAeaUl5vQIeuYYunQ67lBP8,11257
|
|
137
|
+
crabcode_gateway/protocol.py,sha256=psXRNQjkfwliXZdETlo1qsGM0IcE_OIUarCLnSNuq6o,466
|
|
138
|
+
crabcode_gateway/safe_file.py,sha256=uOdkxWdZNQ5RJ2jJ9urnIRiF_2uAP8Dkj8wR08vbDaU,2108
|
|
139
|
+
crabcode_gateway/schemas.py,sha256=sAhbaKAof1upx0WACAkjfZfOP6hAnfgZMt6Q0qbgq50,44677
|
|
140
|
+
crabcode_gateway/server.py,sha256=21SvK1M08-AM4L28AwNnXkNQI9A_C0uRpwpTqgWo65U,19944
|
|
141
|
+
crabcode_gateway/session_registry.py,sha256=HhvLvlGDx0EgmGwjk2zHCCtWURmNDZHHmpBjroX35fk,1214
|
|
142
|
+
crabcode_gateway/task_registry.py,sha256=Ij8USxQ13ockqhoZ286hn8jXckFeLglNSgwgcnQ5tX4,26461
|
|
143
|
+
crabcode_gateway/acp/__init__.py,sha256=PJUCdGBi_ud--LoWxbYbzO7gAgdFCzY_UKeB3JhUvUA,352
|
|
144
|
+
crabcode_gateway/acp/agent.py,sha256=E1osH5zuCS95fDMDbzYGWFNEo0r1hkAoj63h8EzJVeE,61178
|
|
145
|
+
crabcode_gateway/acp/session.py,sha256=rbN1EcCQw2-LEr-bbW3x0TVmeL5ZGeEaSfBX6LEmjws,4049
|
|
146
|
+
crabcode_gateway/acp/transport.py,sha256=IWU3ih_9heY-EH-AhbprAtpcaj8ZvtWMMS76CAX82QA,1119
|
|
147
|
+
crabcode_gateway/acp/types.py,sha256=_hGt2o7CnhfgC_lvOTtdc_Z1hk6y3WE3RCdJ0Qz0hws,2424
|
|
148
|
+
crabcode_gateway/grpc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
149
|
+
crabcode_gateway/grpc/crabcode_pb2.py,sha256=olmqo0HbLHO22PdKWpCMKmCtG9eUBM4iiHwDc1DwXLc,8102
|
|
150
|
+
crabcode_gateway/grpc/crabcode_pb2_grpc.py,sha256=NDrpxgGsd5tqe5mT9_Fr15V72RbegfOb6eXzNf5t16s,20996
|
|
151
|
+
crabcode_gateway/grpc/server.py,sha256=8S3-QoayWuT149gZX8zLsj6blZ_mZpAEmkOTQJdT4Cw,30524
|
|
152
|
+
crabcode_gateway/grpc/proto/crabcode.proto,sha256=VqN5CKiRBQ3OPBL25g2bT1Bt10olVXcmGJqq3tKkUW8,4099
|
|
153
|
+
crabcode_gateway/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
154
|
+
crabcode_gateway/routes/agent.py,sha256=ZI97BVRMPgwpv45IqWFoESO_Khr0uFfy6J-tDojNWOU,13955
|
|
155
|
+
crabcode_gateway/routes/auth.py,sha256=kIynPq7LUBlKwS--1Qp1hJHpLqebB5Unt1qAI8V_dUI,4945
|
|
156
|
+
crabcode_gateway/routes/config.py,sha256=YUtBckVSm8rMFGsiw-wXZ50PLCj3acJOW3A7EJvzCE4,46719
|
|
157
|
+
crabcode_gateway/routes/document.py,sha256=j01jt88A29GF6fHYcX2AparZAOPsUrwllec9YGtFswg,78665
|
|
158
|
+
crabcode_gateway/routes/event.py,sha256=yQCv5AcbJ6A502R-yTAq_ETNdP4qxffbAN2a5yg6f1g,143692
|
|
159
|
+
crabcode_gateway/routes/health.py,sha256=GzR1RAGNmOPXEyUQNRE0ANJsbDMOQHQGNRhA3dRz87Y,293
|
|
160
|
+
crabcode_gateway/routes/peer.py,sha256=xwKtv2Dgfq1bSk3uLYZfTthFPPDnsBa6UY4HvnEt-wU,3166
|
|
161
|
+
crabcode_gateway/routes/permission.py,sha256=QL14Le9wgknpbBVp3YM54v2kTl75X9zvfWCVVB43e3s,3798
|
|
162
|
+
crabcode_gateway/routes/schedule.py,sha256=Z5q-lg_HqiZoQD52IrLjz4WT_7See7ggFXOQgOt4r6o,10248
|
|
163
|
+
crabcode_gateway/routes/session.py,sha256=OfSEYzjIjxcXSaSD_gP3rH2eiAU3o5r33pX2mpCOaDE,54933
|
|
164
|
+
crabcode_gateway/routes/snapshot.py,sha256=K72ypSN9NfXhvrqgqg11RbwwMIZFFK6PeINFgkyBwQw,7883
|
|
165
|
+
crabcode_gateway/routes/tasks.py,sha256=0wjs-ovI-Ww2rikhxNLH6685QoDqXE3R58UJm4j-Zck,12171
|
|
166
|
+
crabcode_gateway/routes/team.py,sha256=kOGvzoFJJDXb8H-f_FNX8ZQxmp7jGA9f6cmMuowAtWw,13741
|
|
167
|
+
crabcode_gateway/routes/workspace.py,sha256=eAZZWcg2x-MZGmwmOE7psYZ0HyQ6hXUahJ97Zib05WM,11197
|
|
168
|
+
crabcode_search/__init__.py,sha256=Fw3-cySOi83Y6WSduXUTC62ANXA5lf7PX3kSnQoXEUs,272
|
|
169
|
+
crabcode_search/background.py,sha256=j_AAT_FvnGjordcQ8bv1cFmQTSBLZfNsYBhdb4v4Quc,11140
|
|
170
|
+
crabcode_search/chunker.py,sha256=gtpMWAjNBEAmr9cfhU5uOcuXZFDhEpNRubVbttaxT14,16148
|
|
171
|
+
crabcode_search/embedder.py,sha256=NlNuOHS7t4JvaWXkNU-T_xxnkjRxFrr3l57dlB5IRkc,16728
|
|
172
|
+
crabcode_search/indexer.py,sha256=bBL3OE6HMqdIRBCnI--XjaHl7_G3H4VO2d-RMKtjlkI,7745
|
|
173
|
+
crabcode_search/store.py,sha256=s1hsyRRGcAO_hdJli6M0C8rhkMW4tXj5ZVMPuCP3uhQ,8074
|
|
174
|
+
crabcode_search/tool.py,sha256=xJjAN3esvJIH3z7ILNQ1gQs5Ty5fu6u7CYX6P2WB_BY,10238
|
|
175
|
+
crabcode-0.1.5.dist-info/METADATA,sha256=sDhuiny-kuo9V0besPVeUlirlZKCY3NsXokxjBYbedk,2714
|
|
176
|
+
crabcode-0.1.5.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
177
|
+
crabcode-0.1.5.dist-info/entry_points.txt,sha256=tpYKME-yDLFb2eqwryWJG-d-HW4dkvDbzwogRl2jays,52
|
|
178
|
+
crabcode-0.1.5.dist-info/RECORD,,
|
crabcode_cli/app.py
CHANGED
|
@@ -16,9 +16,92 @@ app = typer.Typer(
|
|
|
16
16
|
add_completion=False,
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
+
document_engine_app = typer.Typer(
|
|
20
|
+
name="document-engine",
|
|
21
|
+
help="Manage the optional local high-fidelity PDF translation engine.",
|
|
22
|
+
add_completion=False,
|
|
23
|
+
)
|
|
24
|
+
app.add_typer(document_engine_app, name="document-engine")
|
|
25
|
+
|
|
19
26
|
logger = get_logger(__name__)
|
|
20
27
|
|
|
21
28
|
|
|
29
|
+
def _configure_utf8_stdio() -> None:
|
|
30
|
+
"""Use UTF-8 for terminal and protocol streams on every platform."""
|
|
31
|
+
for stream in (sys.stdin, sys.stdout, sys.stderr):
|
|
32
|
+
reconfigure = getattr(stream, "reconfigure", None)
|
|
33
|
+
if callable(reconfigure):
|
|
34
|
+
reconfigure(encoding="utf-8", errors="replace")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@document_engine_app.command("status")
|
|
38
|
+
def document_engine_status_cmd(
|
|
39
|
+
json_output: bool = typer.Option(False, "--json", help="Print machine-readable JSON"),
|
|
40
|
+
) -> None:
|
|
41
|
+
"""Show the optional BabelDOC engine status."""
|
|
42
|
+
import json
|
|
43
|
+
|
|
44
|
+
from crabcode_gateway.document_engine import document_engine_status
|
|
45
|
+
|
|
46
|
+
status = document_engine_status()
|
|
47
|
+
if json_output:
|
|
48
|
+
typer.echo(json.dumps(status, ensure_ascii=False))
|
|
49
|
+
else:
|
|
50
|
+
typer.echo(f"{status['status']}: {status['detail']}")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@document_engine_app.command("install")
|
|
54
|
+
def document_engine_install_cmd(
|
|
55
|
+
bundle: Optional[str] = typer.Option(
|
|
56
|
+
None,
|
|
57
|
+
"--bundle",
|
|
58
|
+
help="Use an offline bundle path or URL instead of the official BabelDOC source",
|
|
59
|
+
),
|
|
60
|
+
json_output: bool = typer.Option(False, "--json", help="Print machine-readable JSON"),
|
|
61
|
+
) -> None:
|
|
62
|
+
"""Install BabelDOC from its official source, or use an offline bundle."""
|
|
63
|
+
import json
|
|
64
|
+
|
|
65
|
+
from crabcode_gateway.document_engine import install_document_engine
|
|
66
|
+
|
|
67
|
+
def progress(message: str) -> None:
|
|
68
|
+
# Keep stdout as a single machine-readable result in JSON mode while
|
|
69
|
+
# still allowing desktop callers to stream installation progress.
|
|
70
|
+
typer.echo(message, err=json_output)
|
|
71
|
+
|
|
72
|
+
try:
|
|
73
|
+
status = install_document_engine(bundle, progress=progress)
|
|
74
|
+
except Exception as exc:
|
|
75
|
+
if json_output:
|
|
76
|
+
typer.echo(json.dumps({"status": "error", "detail": str(exc)}, ensure_ascii=False))
|
|
77
|
+
else:
|
|
78
|
+
typer.echo(f"安装失败:{exc}", err=True)
|
|
79
|
+
raise typer.Exit(1) from exc
|
|
80
|
+
if json_output:
|
|
81
|
+
typer.echo(json.dumps(status, ensure_ascii=False))
|
|
82
|
+
else:
|
|
83
|
+
typer.echo(status["detail"])
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@document_engine_app.command("remove")
|
|
87
|
+
def document_engine_remove_cmd(
|
|
88
|
+
yes: bool = typer.Option(False, "--yes", help="Remove without confirmation"),
|
|
89
|
+
json_output: bool = typer.Option(False, "--json", help="Print machine-readable JSON"),
|
|
90
|
+
) -> None:
|
|
91
|
+
"""Remove the managed engine without touching translated project PDFs."""
|
|
92
|
+
import json
|
|
93
|
+
|
|
94
|
+
from crabcode_gateway.document_engine import remove_document_engine
|
|
95
|
+
|
|
96
|
+
if not yes and not typer.confirm("删除本地高精度 PDF 引擎?已生成的译后 PDF 会保留。"):
|
|
97
|
+
raise typer.Abort()
|
|
98
|
+
status = remove_document_engine()
|
|
99
|
+
if json_output:
|
|
100
|
+
typer.echo(json.dumps(status, ensure_ascii=False))
|
|
101
|
+
else:
|
|
102
|
+
typer.echo(status["detail"])
|
|
103
|
+
|
|
104
|
+
|
|
22
105
|
@app.command()
|
|
23
106
|
def main(
|
|
24
107
|
prompt: Optional[str] = typer.Argument(None, help="Prompt to send (pipe mode)"),
|
|
@@ -34,7 +117,7 @@ def main(
|
|
|
34
117
|
image: Optional[list[str]] = typer.Option(None, "-i", "--image", help="Image file(s) to attach (repeatable)"),
|
|
35
118
|
) -> None:
|
|
36
119
|
"""CrabCode — AI coding assistant in the terminal."""
|
|
37
|
-
from crabcode_core.types.config import
|
|
120
|
+
from crabcode_core.types.config import CrabCodeSettings
|
|
38
121
|
|
|
39
122
|
work_dir = cwd or os.getcwd()
|
|
40
123
|
|
|
@@ -289,18 +372,115 @@ def sessions_export(
|
|
|
289
372
|
"""Export a session transcript to Markdown or JSON."""
|
|
290
373
|
work_dir = cwd or os.getcwd()
|
|
291
374
|
from crabcode_core.session.export import export_json, export_markdown
|
|
375
|
+
|
|
376
|
+
try:
|
|
377
|
+
resolved_id, resolved_cwd = _resolve_export_session(session_id, work_dir)
|
|
378
|
+
except ValueError as exc:
|
|
379
|
+
typer.echo(f"Error: {exc}", err=True)
|
|
380
|
+
raise typer.Exit(1) from exc
|
|
381
|
+
if fmt not in {"md", "json"}:
|
|
382
|
+
typer.echo("Error: --format must be 'md' or 'json'", err=True)
|
|
383
|
+
raise typer.Exit(1)
|
|
292
384
|
if fmt == "json":
|
|
293
|
-
content = export_json(
|
|
385
|
+
content = export_json(resolved_id, resolved_cwd)
|
|
294
386
|
ext = ".json"
|
|
295
387
|
else:
|
|
296
|
-
content = export_markdown(
|
|
388
|
+
content = export_markdown(resolved_id, resolved_cwd)
|
|
297
389
|
ext = ".md"
|
|
298
|
-
out_path = output or os.path.join(work_dir, f"{
|
|
390
|
+
out_path = output or os.path.join(work_dir, f"{resolved_id[:8]}{ext}")
|
|
299
391
|
with open(out_path, "w", encoding="utf-8") as f:
|
|
300
392
|
f.write(content)
|
|
301
393
|
typer.echo(f"Exported to {out_path}")
|
|
302
394
|
|
|
303
395
|
|
|
396
|
+
@sessions_app.command("fork")
|
|
397
|
+
def sessions_fork(
|
|
398
|
+
session_id: str = typer.Argument(..., help="Source session ID (full or prefix)"),
|
|
399
|
+
message_uuid: str = typer.Argument(..., help="Assistant message UUID (full or unique prefix)"),
|
|
400
|
+
cwd: Optional[str] = typer.Option(None, "--cwd", help="Working directory used for local session lookup"),
|
|
401
|
+
title: Optional[str] = typer.Option(None, "--title", help="Title for the forked session"),
|
|
402
|
+
) -> None:
|
|
403
|
+
"""Fork a session at an assistant reply."""
|
|
404
|
+
work_dir = cwd or os.getcwd()
|
|
405
|
+
from crabcode_core.session.storage import SessionStorage
|
|
406
|
+
|
|
407
|
+
try:
|
|
408
|
+
resolved_id, resolved_cwd = _resolve_export_session(session_id, work_dir)
|
|
409
|
+
source = SessionStorage(resolved_cwd, resolved_id)
|
|
410
|
+
messages = source.load_messages()
|
|
411
|
+
selector = str(message_uuid or "").strip()
|
|
412
|
+
if not selector:
|
|
413
|
+
raise ValueError("assistant message UUID is required")
|
|
414
|
+
assistant_ids = [
|
|
415
|
+
str(message.get("uuid") or "")
|
|
416
|
+
for message in messages
|
|
417
|
+
if message.get("type") == "assistant" and message.get("uuid")
|
|
418
|
+
]
|
|
419
|
+
matches = [value for value in assistant_ids if value == selector or value.startswith(selector)]
|
|
420
|
+
if len(matches) != 1:
|
|
421
|
+
if not matches:
|
|
422
|
+
raise ValueError(f"assistant message not found: {selector}")
|
|
423
|
+
raise ValueError(f"assistant message selector is ambiguous: {selector}")
|
|
424
|
+
forked = SessionStorage.fork_from(
|
|
425
|
+
resolved_cwd,
|
|
426
|
+
resolved_id,
|
|
427
|
+
matches[0],
|
|
428
|
+
title=title,
|
|
429
|
+
)
|
|
430
|
+
except (OSError, ValueError) as exc:
|
|
431
|
+
typer.echo(f"Error: {exc}", err=True)
|
|
432
|
+
raise typer.Exit(1) from exc
|
|
433
|
+
|
|
434
|
+
typer.echo(
|
|
435
|
+
f"Forked session {resolved_id[:8]}… at {matches[0][:8]}… "
|
|
436
|
+
f"into {forked.session_id}"
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
def _resolve_export_session(selector: str, cwd: str) -> tuple[str, str]:
|
|
441
|
+
"""Resolve an export selector without silently producing an empty file."""
|
|
442
|
+
from crabcode_core.session.meta_db import SessionMetaStore
|
|
443
|
+
from crabcode_core.session.storage import SessionStorage, get_transcript_path
|
|
444
|
+
|
|
445
|
+
value = str(selector or "").strip()
|
|
446
|
+
if not value:
|
|
447
|
+
raise ValueError("session ID is required")
|
|
448
|
+
|
|
449
|
+
work_dir = os.path.abspath(cwd)
|
|
450
|
+
local_ids = [
|
|
451
|
+
str(row.get("session_id") or "")
|
|
452
|
+
for row in SessionStorage.list_sessions(work_dir)
|
|
453
|
+
if row.get("session_id")
|
|
454
|
+
]
|
|
455
|
+
if value in local_ids:
|
|
456
|
+
return value, work_dir
|
|
457
|
+
local_matches = [session_id for session_id in local_ids if session_id.startswith(value)]
|
|
458
|
+
if len(local_matches) == 1:
|
|
459
|
+
return local_matches[0], work_dir
|
|
460
|
+
if len(local_matches) > 1:
|
|
461
|
+
raise ValueError(f"session selector is ambiguous: {value}")
|
|
462
|
+
|
|
463
|
+
store = SessionMetaStore()
|
|
464
|
+
try:
|
|
465
|
+
exact = store.get(value)
|
|
466
|
+
if exact is not None:
|
|
467
|
+
return value, str(exact.get("cwd") or work_dir)
|
|
468
|
+
matches = store.find_active_by_prefix(value, limit=2)
|
|
469
|
+
finally:
|
|
470
|
+
store.close()
|
|
471
|
+
if len(matches) == 1:
|
|
472
|
+
return str(matches[0]["id"]), str(matches[0].get("cwd") or work_dir)
|
|
473
|
+
if len(matches) > 1:
|
|
474
|
+
raise ValueError(f"session selector is ambiguous: {value}")
|
|
475
|
+
|
|
476
|
+
try:
|
|
477
|
+
if get_transcript_path(work_dir, value).exists():
|
|
478
|
+
return value, work_dir
|
|
479
|
+
except (TypeError, ValueError):
|
|
480
|
+
pass
|
|
481
|
+
raise ValueError(f"session not found: {value}")
|
|
482
|
+
|
|
483
|
+
|
|
304
484
|
@sessions_app.command("prune")
|
|
305
485
|
def sessions_prune(
|
|
306
486
|
days: int = typer.Option(30, "--days", "-d", help="Archive sessions older than N days"),
|
|
@@ -346,13 +526,23 @@ def gateway(
|
|
|
346
526
|
port: int = typer.Option(4096, "--port", "-p", help="HTTP port"),
|
|
347
527
|
grpc_port: Optional[int] = typer.Option(None, "--grpc-port", help="gRPC port (optional)"),
|
|
348
528
|
host: str = typer.Option("127.0.0.1", "--host", help="Bind address"),
|
|
349
|
-
password: Optional[str] = typer.Option(None, "--password", help="
|
|
529
|
+
password: Optional[str] = typer.Option(None, "--password", help="Gateway password"),
|
|
530
|
+
security_mode: Optional[str] = typer.Option(None, "--security-mode", help="none, password, publickey, or mixed"),
|
|
531
|
+
password_hash: Optional[str] = typer.Option(None, "--password-hash", help="PBKDF2 password hash"),
|
|
532
|
+
authorized_keys: Optional[str] = typer.Option(None, "--authorized-keys", help="OpenSSH authorized_keys path"),
|
|
533
|
+
jwt_secret: Optional[str] = typer.Option(None, "--jwt-secret", help="JWT signing secret"),
|
|
350
534
|
cors: Optional[str] = typer.Option(None, "--cors", help="Allowed CORS origin"),
|
|
351
535
|
log_level: str = typer.Option("info", "--log-level", help="Log level"),
|
|
352
536
|
) -> None:
|
|
353
537
|
"""Start the CrabCode HTTP/gRPC gateway server."""
|
|
538
|
+
if os.name == "nt":
|
|
539
|
+
from crabcode_core._windows_process import attach_process_tree_job
|
|
540
|
+
|
|
541
|
+
# The handle stays open until Gateway exits, including a forced kill
|
|
542
|
+
# by Desktop/VS Code. All subsequently spawned descendants are owned.
|
|
543
|
+
attach_process_tree_job()
|
|
354
544
|
from crabcode_core.logging_utils import configure_logging
|
|
355
|
-
from crabcode_core.types.config import
|
|
545
|
+
from crabcode_core.types.config import LoggingSettings
|
|
356
546
|
|
|
357
547
|
log_settings = LoggingSettings(level=log_level.upper())
|
|
358
548
|
configure_logging(os.getcwd(), log_settings)
|
|
@@ -361,11 +551,32 @@ def gateway(
|
|
|
361
551
|
|
|
362
552
|
from crabcode_gateway.server import run_server
|
|
363
553
|
|
|
554
|
+
from crabcode_core.config.manager import ConfigManager
|
|
555
|
+
overrides = {
|
|
556
|
+
key: value
|
|
557
|
+
for key, value in {
|
|
558
|
+
"mode": security_mode,
|
|
559
|
+
"password": password,
|
|
560
|
+
"password_hash": password_hash,
|
|
561
|
+
"authorized_keys": authorized_keys,
|
|
562
|
+
"jwt_secret": jwt_secret,
|
|
563
|
+
}.items()
|
|
564
|
+
if value is not None
|
|
565
|
+
}
|
|
566
|
+
if password is not None and security_mode is None:
|
|
567
|
+
overrides["mode"] = "password"
|
|
568
|
+
configured = ConfigManager(cwd=os.getcwd()).load_gateway_security(overrides)
|
|
569
|
+
|
|
364
570
|
run_server(
|
|
365
571
|
host=host,
|
|
366
572
|
port=port,
|
|
367
573
|
grpc_port=grpc_port,
|
|
368
|
-
password=password,
|
|
574
|
+
password=configured.password,
|
|
575
|
+
security_mode=configured.mode,
|
|
576
|
+
password_hash=configured.password_hash,
|
|
577
|
+
authorized_keys_path=configured.authorized_keys,
|
|
578
|
+
jwt_secret=configured.jwt_secret,
|
|
579
|
+
token_ttl_seconds=configured.token_ttl_seconds,
|
|
369
580
|
cors_origins=cors_origins,
|
|
370
581
|
log_level=log_level,
|
|
371
582
|
)
|
|
@@ -403,7 +614,7 @@ def acp_cmd(
|
|
|
403
614
|
import asyncio
|
|
404
615
|
|
|
405
616
|
from crabcode_core.logging_utils import configure_logging
|
|
406
|
-
from crabcode_core.types.config import
|
|
617
|
+
from crabcode_core.types.config import LoggingSettings
|
|
407
618
|
|
|
408
619
|
work_dir = cwd or os.getcwd()
|
|
409
620
|
log_settings = LoggingSettings(level=log_level.upper())
|
|
@@ -479,7 +690,8 @@ def stats(
|
|
|
479
690
|
|
|
480
691
|
|
|
481
692
|
def entry() -> None:
|
|
482
|
-
|
|
693
|
+
_configure_utf8_stdio()
|
|
694
|
+
known_subcommands = {"main", "sessions", "stats", "gateway", "acp", "document-engine"}
|
|
483
695
|
args = sys.argv[1:]
|
|
484
696
|
# Preserve root --help so users can still discover all subcommands.
|
|
485
697
|
if args and args[0] in ("--help", "-h"):
|
crabcode_cli/banner.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""CrabCode
|
|
1
|
+
"""CrabCode terminal banner."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -6,18 +6,15 @@ from rich.console import Console
|
|
|
6
6
|
from rich.table import Table
|
|
7
7
|
from rich.text import Text
|
|
8
8
|
|
|
9
|
-
#
|
|
9
|
+
# Pixel crab with open claws, eye stalks, and three pairs of splayed legs.
|
|
10
10
|
_CRAB = (
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
" ▐▛▘ ▝▜▌ \n"
|
|
19
|
-
"▝▘ ▝▘ \n"
|
|
20
|
-
" "
|
|
11
|
+
" ▄ ▄ ▄ ▄\n"
|
|
12
|
+
" ▀█▄█▀ ▄ ▄ ▀█▄█▀\n"
|
|
13
|
+
" ▀█▄▄ █ █ ▄▄█▀\n"
|
|
14
|
+
" ▄▄█████████████▄▄\n"
|
|
15
|
+
" ▄█▀ █████████████ ▀█▄\n"
|
|
16
|
+
" ▀ ▄█▀▀█████████▀▀█▄ ▀\n"
|
|
17
|
+
" ▀▀ ▄█▀ ▀█▄ ▀▀"
|
|
21
18
|
)
|
|
22
19
|
|
|
23
20
|
# "CrabCode" in figlet slant font
|
|
@@ -29,10 +26,10 @@ _CRABCODE = r""" ______ __ ______ __
|
|
|
29
26
|
|
|
30
27
|
|
|
31
28
|
def print_banner(console: Console) -> None:
|
|
32
|
-
"""Print the CrabCode banner with
|
|
29
|
+
"""Print the CrabCode banner with pixel crab art on the left."""
|
|
33
30
|
grid = Table.grid(padding=(0, 3))
|
|
34
31
|
grid.add_column(no_wrap=True)
|
|
35
|
-
grid.add_column(no_wrap=True)
|
|
32
|
+
grid.add_column(no_wrap=True, vertical="middle")
|
|
36
33
|
grid.add_row(
|
|
37
34
|
Text(_CRAB, style="bold red"),
|
|
38
35
|
Text(_CRABCODE, style="bold cyan"),
|