@brandon_9527/tcode 1.0.8 → 1.0.9
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.
- package/dist/python-src/.env +3 -3
- package/dist/python-src/README.md +40 -1
- package/dist/python-src/_workspace/.autodev/config.json +12 -0
- package/dist/python-src/_workspace/.autodev/cron/jobs.json +4 -0
- package/dist/python-src/entry.py +21 -1
- package/dist/python-src/main.py +753 -40
- package/dist/python-src/pyproject.toml +1 -0
- package/dist/python-src/run.sh +9 -0
- package/dist/python-src/src/agents/token_tracker.py +4 -4
- package/dist/python-src/src/claw/bus/queue.py +1 -1
- package/dist/python-src/src/claw/channels/__init__.py +2 -2
- package/dist/python-src/src/claw/channels/base.py +2 -2
- package/dist/python-src/src/claw/channels/feishu.py +57 -16
- package/dist/python-src/src/claw/channels/manager.py +2 -2
- package/dist/python-src/src/claw/config/__init__.py +3 -0
- package/dist/python-src/src/claw/config/loader.py +38 -0
- package/dist/python-src/src/claw/config/schema.py +14 -29
- package/dist/python-src/src/claw/cron/__init__.py +3 -0
- package/dist/python-src/src/claw/cron/service.py +171 -0
- package/dist/python-src/src/claw/cron/types_.py +14 -0
- package/dist/python-src/src/claw/heartbeat/__init__.py +2 -0
- package/dist/python-src/src/claw/heartbeat/service.py +55 -0
- package/dist/python-src/src/claw/run.py +82 -0
- package/dist/python-src/src/claw/tools/base.py +23 -0
- package/dist/python-src/src/claw/tools/channel.py +0 -0
- package/dist/python-src/src/claw/tools/cron.py +138 -0
- package/dist/python-src/src/claw/utils/__init__.py +2 -0
- package/dist/python-src/src/claw/utils/helpers.py +27 -0
- package/dist/python-src/src/core/context.py +158 -0
- package/dist/python-src/src/managers/manager_agent.py +9 -9
- package/dist/python-src/src/managers/manager_command.py +62 -0
- package/dist/python-src/src/managers/manager_context.py +1 -1
- package/dist/python-src/src/managers/manager_instruction.py +7 -7
- package/dist/python-src/src/managers/manager_skill.py +3 -3
- package/dist/python-src/src/managers/sandbox.py +3 -3
- package/dist/python-src/src/middlewares/dynamic_content.py +2 -2
- package/dist/python-src/src/middlewares/hitl.py +3 -3
- package/dist/python-src/src/middlewares/memory.py +2 -2
- package/dist/python-src/src/middlewares/subagents.py +4 -4
- package/dist/python-src/src/middlewares/summary.py +37 -37
- package/dist/python-src/src/stream/file_write_parser.py +3 -3
- package/dist/python-src/src/stream/formatter.py +19 -19
- package/dist/python-src/src/stream/handler.py +4 -4
- package/dist/python-src/src/stream/handler_with_tracker.py +10 -10
- package/dist/python-src/src/trackers/token/pricing.py +2 -2
- package/dist/python-src/src/trackers/token/report.py +4 -4
- package/dist/python-src/src/trackers/token/tracker.py +8 -8
- package/dist/python-src/src/tui/chatui.py +10 -10
- package/dist/python-src/src/tui/clawtui.py +224 -0
- package/dist/python-src/src/tui/commands/__init__.py +3 -0
- package/dist/python-src/src/tui/commands/base.py +6 -0
- package/dist/python-src/src/tui/commands/instruction.py +5 -0
- package/dist/python-src/src/tui/components/tlist.py +7 -7
- package/dist/python-src/src/tui/components/tscroll_panel.py +73 -44
- package/dist/python-src/src/tui/components/tscroll_panel_old.py +58 -0
- package/dist/python-src/src/tui/utils/trender.py +21 -21
- package/dist/python-src/uv.lock +1969 -1958
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@ from src.tui.components.tdiff import render_diff_as_markdown
|
|
|
28
28
|
from src.tui.components.tdisplay import render_content_with_line_limit
|
|
29
29
|
from src.tui.utils.render import markdown_to_wrapped_text
|
|
30
30
|
def display_tool_call(tool_name,args,events=[]):
|
|
31
|
-
C=tool_name;A=events;E=format_tool_compact(C,args);D=
|
|
31
|
+
C=tool_name;A=events;E=format_tool_compact(C,args);D=w(C,args);B=Tree(Text(_I,style=_J)+Text(f"{E}",style=_C),guide_style=_D)
|
|
32
32
|
if A and len(A)>0:F=display_sub_panel(D,sub_events=A);B.add(F)
|
|
33
33
|
else:B.add(D)
|
|
34
34
|
return B
|
|
@@ -37,14 +37,14 @@ def display_tool_result(tool_name,args=_E,result=_E,events=[]):
|
|
|
37
37
|
if A is _E:A={}
|
|
38
38
|
H=format_tool_compact(G,A);C=G.lower()
|
|
39
39
|
try:
|
|
40
|
-
if C==_K and isinstance(A,dict):B=
|
|
41
|
-
elif C==_L and isinstance(A,dict):B=
|
|
42
|
-
elif C in[_M]and isinstance(A,dict):B=
|
|
43
|
-
elif C==_H and isinstance(A,dict):B=
|
|
44
|
-
elif C==_N and isinstance(A,dict):B=
|
|
45
|
-
elif C==_O and isinstance(A,dict):B=
|
|
46
|
-
elif C==_P and isinstance(A,dict):B=
|
|
47
|
-
else:B=
|
|
40
|
+
if C==_K and isinstance(A,dict):B=y(A)
|
|
41
|
+
elif C==_L and isinstance(A,dict):B=y(A)
|
|
42
|
+
elif C in[_M]and isinstance(A,dict):B=y(A)
|
|
43
|
+
elif C==_H and isinstance(A,dict):B=x(A,D)
|
|
44
|
+
elif C==_N and isinstance(A,dict):B=bd(A,D)
|
|
45
|
+
elif C==_O and isinstance(A,dict):B=v(A,D)
|
|
46
|
+
elif C==_P and isinstance(A,dict):B=bb(A,D)
|
|
47
|
+
else:B=z(A,D)
|
|
48
48
|
except Exception as I:import traceback as J;B=Text(f"Error: {str(I)}\n{J.format_exc()}",style='red')
|
|
49
49
|
F=Tree(Text(_I,style=_J)+Text(f"{H}",style=_C),guide_style=_D)
|
|
50
50
|
if E and len(E)>0:K=display_sub_panel(B,sub_events=E);F.add(K)
|
|
@@ -102,12 +102,12 @@ def format_tool_compact(name,args):
|
|
|
102
102
|
I=', '.join(M)
|
|
103
103
|
if len(I)>50:I=I[:47]+_B
|
|
104
104
|
return f"{J}({I})"
|
|
105
|
-
def
|
|
105
|
+
def w(tool_name,arguments):
|
|
106
106
|
D=' Will search for pattern';C=arguments;B='bold grey';A=tool_name.lower()
|
|
107
107
|
if A==_H:return Text(f"running ...",style=B)
|
|
108
108
|
if A==_M:return Text(f" Executing ...",style=B)
|
|
109
|
-
elif A==_L:return
|
|
110
|
-
elif A==_K:return
|
|
109
|
+
elif A==_L:return bc(C)
|
|
110
|
+
elif A==_K:return be(C)
|
|
111
111
|
elif A in[_N,_O]:return Text(D,style=B)
|
|
112
112
|
elif A==_P:return Text(D,stype=B)
|
|
113
113
|
else:return Text(' Executing ...',style=B)
|
|
@@ -123,12 +123,12 @@ def display_sub_panel(result=_E,sub_events=[]):
|
|
|
123
123
|
else:A.append(C)
|
|
124
124
|
else:A.append(markdown_to_wrapped_text(f"calling ...",prefix=_E))
|
|
125
125
|
J=Group(*[A for A in A]);K=Box(' \n \n \n \n \n \n \n ');L=Panel(J,title_align='left',box=K);return L
|
|
126
|
-
def
|
|
126
|
+
def be(arguments):
|
|
127
127
|
A=arguments;B=A.get(_F,'');C=A.get('old_string','');D=A.get('new_string','');E=''
|
|
128
128
|
if os.path.exists(B):
|
|
129
129
|
with open(B,'r',encoding='utf-8')as F:G=F.read()
|
|
130
130
|
H=D if C==''else G.replace(C,D,1);I=render_diff_as_markdown(E,H);return I
|
|
131
|
-
def
|
|
131
|
+
def bc(arguments):
|
|
132
132
|
D=arguments;A=D.get(_F,'');B=D.get(_R,'')
|
|
133
133
|
if os.path.exists(A):C=open(A,'r').read()
|
|
134
134
|
else:C=''
|
|
@@ -137,7 +137,7 @@ def j(arguments):
|
|
|
137
137
|
E=recognize_language(A)
|
|
138
138
|
if E:G=f"```\n{E}\n{B}\n```";return render_content_with_line_limit(G,'',100)
|
|
139
139
|
else:return render_content_with_line_limit(B,'',100)
|
|
140
|
-
def
|
|
140
|
+
def y(arguments):
|
|
141
141
|
B=arguments.get(_F,'');C=''
|
|
142
142
|
if os.path.exists(B):C=open(B,'r').read()
|
|
143
143
|
E=C.split(_A);F=len(E);A=50
|
|
@@ -146,7 +146,7 @@ def m(arguments):
|
|
|
146
146
|
H=recognize_language(B)
|
|
147
147
|
if H:J=f"```{H}\n{D}\n```";return render_content_with_line_limit(J,'',-1)
|
|
148
148
|
else:return render_content_with_line_limit(D,'',-1)
|
|
149
|
-
def
|
|
149
|
+
def ba(arguments,result):
|
|
150
150
|
C=result.strip().split(_A);F=len(C);B=[];D=10;G=C[:D]
|
|
151
151
|
for(H,A)in enumerate(G):
|
|
152
152
|
I=''if H==0 else''
|
|
@@ -155,7 +155,7 @@ def i(arguments,result):
|
|
|
155
155
|
E=F-D
|
|
156
156
|
if E>0:B.append(f" ... and {E} more lines")
|
|
157
157
|
return Text(_A.join(B),style=_G)
|
|
158
|
-
def
|
|
158
|
+
def x(arguments,result):
|
|
159
159
|
C=result.strip().split(_A);F=len(C);B=[];D=10;G=C[:D]
|
|
160
160
|
for(H,A)in enumerate(G):
|
|
161
161
|
I=''if H==0 else''
|
|
@@ -164,7 +164,7 @@ def k(arguments,result):
|
|
|
164
164
|
E=F-D
|
|
165
165
|
if E>0:B.append(f" ... and {E} more lines")
|
|
166
166
|
return Text(_A.join(B),style=_G)
|
|
167
|
-
def
|
|
167
|
+
def bd(arguments,result):
|
|
168
168
|
C=result.strip().split(_A);F=len(C);B=[];D=10;G=C[:D]
|
|
169
169
|
for(H,A)in enumerate(G):
|
|
170
170
|
I=''if H==0 else''
|
|
@@ -173,7 +173,7 @@ def l(arguments,result):
|
|
|
173
173
|
E=F-D
|
|
174
174
|
if E>0:B.append(f" ... and {E} more lines")
|
|
175
175
|
return Text(_A.join(B),style=_G)
|
|
176
|
-
def
|
|
176
|
+
def v(arguments,result):
|
|
177
177
|
C=result.strip().split(_A);F=len(C);B=[];D=10;G=C[:D]
|
|
178
178
|
for(H,A)in enumerate(G):
|
|
179
179
|
I=''if H==0 else''
|
|
@@ -182,7 +182,7 @@ def f(arguments,result):
|
|
|
182
182
|
E=F-D
|
|
183
183
|
if E>0:B.append(f" ... and {E} more lines")
|
|
184
184
|
return Text(_A.join(B),style=_G)
|
|
185
|
-
def
|
|
185
|
+
def bb(arguments,result):
|
|
186
186
|
C=result.strip().split(_A);F=len(C);B=[];D=10;G=C[:D]
|
|
187
187
|
for(H,A)in enumerate(G):
|
|
188
188
|
I=''if H==0 else''
|
|
@@ -191,7 +191,7 @@ def h(arguments,result):
|
|
|
191
191
|
E=F-D
|
|
192
192
|
if E>0:B.append(f" ... and {E} more lines")
|
|
193
193
|
return Text(_A.join(B),style=_G)
|
|
194
|
-
def
|
|
194
|
+
def z(arguments,result):
|
|
195
195
|
B=result;A=str(B)if B else'tool completed successfully'
|
|
196
196
|
if len(A)>500:C=A[:500]+'\n ... (truncated)'
|
|
197
197
|
else:C=A
|