@brandon_9527/tcode 1.0.10 → 1.0.11

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.
@@ -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=bc(C,args);B=Tree(Text(_I,style=_J)+Text(f"{E}",style=_C),guide_style=_D)
31
+ C=tool_name;A=events;E=format_tool_compact(C,args);D=y(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=ba(A)
41
- elif C==_L and isinstance(A,dict):B=ba(A)
42
- elif C in[_M]and isinstance(A,dict):B=ba(A)
43
- elif C==_H and isinstance(A,dict):B=v(A,D)
44
- elif C==_N and isinstance(A,dict):B=w(A,D)
45
- elif C==_O and isinstance(A,dict):B=z(A,D)
46
- elif C==_P and isinstance(A,dict):B=x(A,D)
47
- else:B=bd(A,D)
40
+ if C==_K and isinstance(A,dict):B=v(A)
41
+ elif C==_L and isinstance(A,dict):B=v(A)
42
+ elif C in[_M]and isinstance(A,dict):B=v(A)
43
+ elif C==_H and isinstance(A,dict):B=ba(A,D)
44
+ elif C==_N and isinstance(A,dict):B=bc(A,D)
45
+ elif C==_O and isinstance(A,dict):B=be(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 bc(tool_name,arguments):
105
+ def y(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 y(C)
110
- elif A==_K:return be(C)
109
+ elif A==_L:return bd(C)
110
+ elif A==_K:return x(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 be(arguments):
126
+ def x(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 y(arguments):
131
+ def bd(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 y(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 ba(arguments):
140
+ def v(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 ba(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 bb(arguments,result):
149
+ def w(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 bb(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 v(arguments,result):
158
+ def ba(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 v(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 w(arguments,result):
167
+ def bc(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 w(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 z(arguments,result):
176
+ def be(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 z(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 x(arguments,result):
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 x(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 bd(arguments,result):
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brandon_9527/tcode",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "TypeScript版 单仓库混合方案(Python源码随npm发布,本地Build)",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {