dsh-agy-link 0.4.29 → 0.4.32
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/CHANGELOG.md +52 -0
- package/dist/client.js +854 -170
- package/dist/index.js +244 -37
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -37,13 +37,6 @@ window.__ModuleLoader__.load({
|
|
|
37
37
|
if (mod === void 0 || mod === null) throw new Error("dsh-agy-link toolview requires react at render time (browser host)");
|
|
38
38
|
return mod;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Wrap a raw useState setter into a toggle: every call flips the previous
|
|
42
|
-
* value. The raw setter itself must NEVER be called with no arguments —
|
|
43
|
-
* `setState(undefined)` pins the state to a falsy value, so a second click
|
|
44
|
-
* could never expand a collapsed card again (the regression this fixes).
|
|
45
|
-
* Exported separately so the toggling contract is unit-testable in Node.
|
|
46
|
-
*/
|
|
47
40
|
function makeToggle(setValue) {
|
|
48
41
|
return () => setValue((prev) => !prev);
|
|
49
42
|
}
|
|
@@ -51,10 +44,196 @@ window.__ModuleLoader__.load({
|
|
|
51
44
|
const [value, setValue] = react().useState(initial);
|
|
52
45
|
return [value, makeToggle(setValue)];
|
|
53
46
|
}
|
|
54
|
-
/** React.createElement bound helper (call inside render functions). */
|
|
55
47
|
function hx(type, props, ...children) {
|
|
56
48
|
return react().createElement(type, props, ...children);
|
|
57
49
|
}
|
|
50
|
+
function IconChevronDownOutline14(size = 14, className = "") {
|
|
51
|
+
return hx("svg", {
|
|
52
|
+
width: size,
|
|
53
|
+
height: size,
|
|
54
|
+
className: className || void 0,
|
|
55
|
+
viewBox: "0 0 14 14",
|
|
56
|
+
fill: "none",
|
|
57
|
+
style: {
|
|
58
|
+
display: "block",
|
|
59
|
+
flexShrink: 0
|
|
60
|
+
},
|
|
61
|
+
"aria-hidden": true
|
|
62
|
+
}, hx("path", {
|
|
63
|
+
d: "M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z",
|
|
64
|
+
fill: "currentColor"
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
function IconApiOutline14(size = 14, className = "") {
|
|
68
|
+
return hx("svg", {
|
|
69
|
+
width: size,
|
|
70
|
+
height: size,
|
|
71
|
+
className: className || void 0,
|
|
72
|
+
viewBox: "0 0 14 14",
|
|
73
|
+
fill: "none",
|
|
74
|
+
style: {
|
|
75
|
+
display: "block",
|
|
76
|
+
flexShrink: 0
|
|
77
|
+
},
|
|
78
|
+
"aria-hidden": true
|
|
79
|
+
}, hx("path", {
|
|
80
|
+
transform: "translate(0.6689 1.073)",
|
|
81
|
+
d: "M11.4818 5.57813C11.4818 4.45301 11.4807 3.66237 11.4075 3.05908C11.3359 2.46953 11.2024 2.13852 10.9939 1.89441C10.9247 1.81341 10.8493 1.73801 10.7683 1.66882C10.5242 1.46033 10.1932 1.32686 9.60364 1.25525C9.00034 1.18198 8.20974 1.18091 7.0846 1.18091L5.57813 1.18091C4.45301 1.18091 3.66238 1.18198 3.05908 1.25525C2.46953 1.32686 2.13852 1.46033 1.89441 1.66882C1.81341 1.73801 1.73801 1.81341 1.66882 1.89441C1.46033 2.13852 1.32686 2.46953 1.25525 3.05908C1.18198 3.66238 1.18091 4.45301 1.18091 5.57813L1.18091 6.2771C1.18091 7.40218 1.18197 8.19288 1.25525 8.79614C1.32687 9.38553 1.46036 9.71674 1.66882 9.96082C1.73797 10.0417 1.81347 10.1173 1.89441 10.1864C2.13851 10.3948 2.46965 10.5275 3.05908 10.5991C3.66238 10.6724 4.45298 10.6735 5.57813 10.6735L7.0846 10.6735C8.20977 10.6735 9.00033 10.6724 9.60364 10.5991C10.1931 10.5275 10.5242 10.3948 10.7683 10.1864C10.8493 10.1173 10.9247 10.0417 10.9939 9.96082C11.2024 9.71674 11.3358 9.38553 11.4075 8.79614C11.4808 8.19288 11.4818 7.40218 11.4818 6.2771L11.4818 5.57813ZM12.6627 6.2771C12.6627 7.37222 12.6637 8.247 12.5798 8.93799C12.4942 9.64284 12.3133 10.2359 11.8928 10.7282C11.7834 10.8562 11.6637 10.9751 11.5356 11.0845C11.0434 11.5049 10.4511 11.6867 9.74634 11.7723C9.05525 11.8563 8.17999 11.8552 7.0846 11.8552L5.57813 11.8552C4.48273 11.8552 3.60747 11.8563 2.91638 11.7723C2.21157 11.6867 1.61933 11.5049 1.12708 11.0845C0.99901 10.9751 0.879281 10.8562 0.769898 10.7282C0.349454 10.2359 0.168506 9.64284 0.0828864 8.93799C-0.00101964 8.247 4.88512e-07 7.37222 6.47206e-07 6.2771L6.47206e-07 5.57813C6.47206e-07 4.48273 -0.00106163 3.60747 0.0828864 2.91638C0.168502 2.21168 0.349594 1.61928 0.769898 1.12708C0.879302 0.998981 0.998981 0.879302 1.12708 0.769898C1.61928 0.349594 2.21168 0.168502 2.91638 0.0828864C3.60747 -0.00106163 4.48273 6.47206e-07 5.57813 6.47206e-07L7.0846 6.47206e-07C8.17999 6.47206e-07 9.05525 -0.00106163 9.74634 0.0828864C10.451 0.168505 11.0434 0.349587 11.5356 0.769898C11.6637 0.879302 11.7834 0.998981 11.8928 1.12708C12.3131 1.61928 12.4942 2.21169 12.5798 2.91638C12.6638 3.60747 12.6627 4.48273 12.6627 5.57813L12.6627 6.2771Z",
|
|
82
|
+
fill: "currentColor"
|
|
83
|
+
}), hx("path", {
|
|
84
|
+
transform: "translate(0.6689 1.073)",
|
|
85
|
+
d: "M6.02607 5.50955L6.44306 5.9274L3.84284 8.52762L3.425 8.11063L3.00715 7.69278L4.77253 5.9274L3.00715 4.16202L3.84284 3.32633L6.02607 5.50955Z",
|
|
86
|
+
fill: "currentColor"
|
|
87
|
+
}), hx("path", {
|
|
88
|
+
transform: "translate(0.6689 1.073)",
|
|
89
|
+
d: "M9.23789 7.35397L9.23789 8.53488L6.96238 8.53488L6.96238 7.35397L9.23789 7.35397Z",
|
|
90
|
+
fill: "currentColor"
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
function IconEditOutline16(size = 14, className = "") {
|
|
94
|
+
return hx("svg", {
|
|
95
|
+
width: size,
|
|
96
|
+
height: size,
|
|
97
|
+
className: className || void 0,
|
|
98
|
+
viewBox: "0 0 16 16",
|
|
99
|
+
fill: "none",
|
|
100
|
+
style: {
|
|
101
|
+
display: "block",
|
|
102
|
+
flexShrink: 0
|
|
103
|
+
},
|
|
104
|
+
"aria-hidden": true
|
|
105
|
+
}, hx("path", {
|
|
106
|
+
d: "M9.94076 1.34942C10.7047 0.90231 11.6503 0.902415 12.4143 1.34942C12.7061 1.52015 12.9688 1.79118 13.3104 2.13284C13.6521 2.47448 13.9231 2.73721 14.0939 3.02894C14.5408 3.79294 14.5409 4.73856 14.0939 5.50251C13.9231 5.79415 13.652 6.05704 13.3104 6.39861L6.65932 13.0497C6.28068 13.4284 6.00695 13.7108 5.66543 13.9097C5.32391 14.1085 4.94315 14.2074 4.42705 14.3498L3.24394 14.6761C2.77527 14.8054 2.34538 14.9262 2.00131 14.9684C1.65196 15.0112 1.17964 15.0013 0.810764 14.6325C0.441921 14.2637 0.432107 13.7913 0.47486 13.442C0.517035 13.0979 0.6379 12.668 0.767181 12.1993L1.09352 11.0162C1.23588 10.5001 1.33481 10.1193 1.5336 9.77784C1.7325 9.43632 2.0149 9.1626 2.39355 8.78395L9.04466 2.13284C9.38625 1.79126 9.64911 1.52016 9.94076 1.34942ZM15.5427 14.8398H7.55223L8.96707 13.425H15.5427V14.8398ZM3.39382 9.78422C2.965 10.213 2.84244 10.3436 2.75709 10.49C2.67183 10.6366 2.61862 10.8079 2.45733 11.3925L2.13099 12.5756C2.00183 13.0439 1.92194 13.3419 1.88863 13.5536C2.10041 13.5204 2.39872 13.4416 2.86764 13.3123L4.05075 12.9859C4.63544 12.8246 4.80669 12.7715 4.95323 12.6862C5.09968 12.6008 5.23022 12.4783 5.65905 12.0494L10.721 6.98644L8.45577 4.72121L3.39382 9.78422ZM11.7 2.57079C11.3774 2.38198 10.9777 2.38198 10.6551 2.57079C10.5602 2.62647 10.4487 2.72931 10.0449 3.13311L9.45604 3.72094L11.7213 5.98617L12.3102 5.39833C12.7139 4.99457 12.8168 4.88307 12.8725 4.78818C13.0613 4.46561 13.0612 4.06585 12.8725 3.74326C12.8169 3.64827 12.7146 3.53752 12.3102 3.13311C11.9057 2.72863 11.795 2.6264 11.7 2.57079Z",
|
|
107
|
+
fill: "currentColor"
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
function IconBrowseOutline16(size = 14, className = "") {
|
|
111
|
+
return hx("svg", {
|
|
112
|
+
width: size,
|
|
113
|
+
height: size,
|
|
114
|
+
className: className || void 0,
|
|
115
|
+
viewBox: "0 0 16 16",
|
|
116
|
+
fill: "none",
|
|
117
|
+
style: {
|
|
118
|
+
display: "block",
|
|
119
|
+
flexShrink: 0
|
|
120
|
+
},
|
|
121
|
+
"aria-hidden": true
|
|
122
|
+
}, hx("path", {
|
|
123
|
+
d: "M11.2426 4.80473V6.10551H4.75819V4.80473H11.2426Z",
|
|
124
|
+
fill: "currentColor"
|
|
125
|
+
}), hx("path", {
|
|
126
|
+
d: "M9.40858 7.84478V9.14557H4.75819V7.84478H9.40858Z",
|
|
127
|
+
fill: "currentColor"
|
|
128
|
+
}), hx("path", {
|
|
129
|
+
d: "M9.23438 0.546389C10.1941 0.546389 10.9683 0.544914 11.5859 0.611819C12.2161 0.680096 12.7634 0.825745 13.2393 1.17139C13.5172 1.3733 13.7619 1.61812 13.9639 1.896C14.3096 2.37183 14.4551 2.91922 14.5234 3.54932C14.5903 4.16686 14.5889 4.94133 14.5889 5.90088V10.0981C14.5889 11.0576 14.5903 11.8321 14.5234 12.4497C14.4552 13.0798 14.3094 13.6272 13.9639 14.103C13.7619 14.381 13.5172 14.6257 13.2393 14.8276C12.7633 15.1734 12.2163 15.3189 11.5859 15.3872C10.9683 15.4541 10.1942 15.4536 9.23438 15.4536H6.76563C5.80591 15.4536 5.03168 15.4541 4.41407 15.3872C3.78385 15.3189 3.23665 15.1734 2.76074 14.8276C2.48291 14.6257 2.23802 14.3809 2.03614 14.103C1.69066 13.6272 1.54483 13.0798 1.47657 12.4497C1.40973 11.8321 1.41114 11.0576 1.41114 10.0981V5.90088C1.41113 4.94132 1.40966 4.16686 1.47657 3.54932C1.54488 2.91921 1.69042 2.37184 2.03614 1.896C2.2381 1.61807 2.4828 1.37333 2.76074 1.17139C3.23665 0.825682 3.78386 0.680109 4.41407 0.611819C5.03168 0.544905 5.80591 0.546389 6.76563 0.546389H9.23438ZM6.76563 1.896C5.77586 1.896 5.0876 1.89738 4.55957 1.95459C4.0443 2.01043 3.76214 2.11349 3.55469 2.26416C3.39135 2.38284 3.24761 2.52662 3.12891 2.68994C2.97821 2.89736 2.8752 3.17967 2.81934 3.69483C2.76214 4.22279 2.76075 4.91131 2.76074 5.90088V10.0981C2.76074 11.0876 2.76221 11.7762 2.81934 12.3042C2.87516 12.8194 2.97829 13.1026 3.12891 13.3101C3.24754 13.4733 3.39147 13.6172 3.55469 13.7358C3.76213 13.8865 4.04438 13.9896 4.55957 14.0454C5.0876 14.1026 5.77586 14.103 6.76563 14.103H9.23438C10.2242 14.103 10.9124 14.1026 11.4404 14.0454C11.9556 13.9896 12.2379 13.8865 12.4453 13.7358C12.6086 13.6172 12.7525 13.4733 12.8711 13.3101C13.0217 13.1026 13.1248 12.8195 13.1807 12.3042C13.2378 11.7762 13.2393 11.0876 13.2393 10.0981V5.90088C13.2393 4.91131 13.2379 4.22279 13.1807 3.69483C13.1248 3.17969 13.0218 2.89736 12.8711 2.68994C12.7524 2.52667 12.6086 2.38281 12.4453 2.26416C12.2379 2.11355 11.9556 2.01041 11.4404 1.95459C10.9124 1.8974 10.2241 1.896 9.23438 1.896H6.76563Z",
|
|
130
|
+
fill: "currentColor"
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
function IconSearchOutline16(size = 14, className = "") {
|
|
134
|
+
return hx("svg", {
|
|
135
|
+
width: size,
|
|
136
|
+
height: size,
|
|
137
|
+
className: className || void 0,
|
|
138
|
+
viewBox: "0 0 16 16",
|
|
139
|
+
fill: "none",
|
|
140
|
+
style: {
|
|
141
|
+
display: "block",
|
|
142
|
+
flexShrink: 0
|
|
143
|
+
},
|
|
144
|
+
"aria-hidden": true
|
|
145
|
+
}, hx("path", {
|
|
146
|
+
d: "M11.894845 6.647401C11.894845 3.725463 9.534486 1.356779 6.623219 1.35657C3.711786 1.35657 1.351635 3.725338 1.351635 6.647401C1.351843 9.569296 3.711911 11.938273 6.623219 11.938273C9.534361 11.938064 11.894637 9.569171 11.894845 6.647401ZM13.245462 6.647401C13.245254 10.317935 10.280401 13.293613 6.623219 13.293821C2.965871 13.293821 0.000204 10.31806 0 6.647401C0 2.976574 2.965746 0 6.623219 0C10.280526 0.000205 13.245462 2.9767 13.245462 6.647401Z",
|
|
147
|
+
fill: "currentColor"
|
|
148
|
+
}), hx("path", {
|
|
149
|
+
d: "M16.000417 15.041079L15.044449 16.000433L11.530434 12.473588L12.486298 11.514234L16.000417 15.041079Z",
|
|
150
|
+
fill: "currentColor"
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
function IconCodeOutline16(size = 14, className = "") {
|
|
154
|
+
return hx("svg", {
|
|
155
|
+
width: size,
|
|
156
|
+
height: size,
|
|
157
|
+
className: className || void 0,
|
|
158
|
+
viewBox: "0 0 16 16",
|
|
159
|
+
fill: "none",
|
|
160
|
+
style: {
|
|
161
|
+
display: "block",
|
|
162
|
+
flexShrink: 0
|
|
163
|
+
},
|
|
164
|
+
"aria-hidden": true
|
|
165
|
+
}, hx("path", {
|
|
166
|
+
fillRule: "evenodd",
|
|
167
|
+
clipRule: "evenodd",
|
|
168
|
+
d: "M12.3368 1.53569L11.931 4.43172H14.8086V5.79673H11.7404L11.1962 9.67859H14.2839V11.0436H11.0056L10.4994 14.6529L9.14873 14.4643L9.62731 11.0436H5.75876L5.25252 14.6529L3.90186 14.4643L4.38043 11.0436H1.69141V9.67859H4.57104L5.11417 5.79673H2.21609V4.43172H5.30581L5.73724 1.34713L7.08995 1.53569L6.68414 4.43172H10.5527L10.9841 1.34713L12.3368 1.53569ZM5.94937 9.67859H9.81791L10.361 5.79673H6.49353L5.94937 9.67859Z",
|
|
169
|
+
fill: "currentColor"
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
function IconInspectOutline12(size = 12, className = "") {
|
|
173
|
+
return hx("svg", {
|
|
174
|
+
width: size,
|
|
175
|
+
height: size,
|
|
176
|
+
className: className || void 0,
|
|
177
|
+
viewBox: "0 0 16 16",
|
|
178
|
+
fill: "none",
|
|
179
|
+
style: {
|
|
180
|
+
display: "inline-block",
|
|
181
|
+
verticalAlign: "-1.5px",
|
|
182
|
+
flexShrink: 0
|
|
183
|
+
},
|
|
184
|
+
"aria-hidden": true
|
|
185
|
+
}, hx("path", {
|
|
186
|
+
d: "M16 8L10.8571 12V10.552L14.1383 8L10.8571 5.448V4L16 8ZM5.14286 10.552L1.86171 8L5.14286 5.448V4L0 8L5.14286 12V10.552ZM9.02514 4L5.59657 12H6.84057L10.2691 4H9.02514Z",
|
|
187
|
+
fill: "currentColor"
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
function IconCopyOutline16(size = 12, className = "") {
|
|
191
|
+
return hx("svg", {
|
|
192
|
+
width: size,
|
|
193
|
+
height: size,
|
|
194
|
+
className: className || void 0,
|
|
195
|
+
viewBox: "0 0 16 16",
|
|
196
|
+
fill: "none",
|
|
197
|
+
style: {
|
|
198
|
+
display: "inline-block",
|
|
199
|
+
verticalAlign: "-1.5px",
|
|
200
|
+
flexShrink: 0
|
|
201
|
+
},
|
|
202
|
+
"aria-hidden": true
|
|
203
|
+
}, hx("path", {
|
|
204
|
+
d: "M6.14929 4.02032C7.11197 4.02032 7.87983 4.02016 8.49597 4.07598C9.12128 4.13269 9.65792 4.25188 10.1415 4.53106C10.7202 4.8653 11.2008 5.3459 11.535 5.92462C11.8142 6.40818 11.9334 6.94481 11.9901 7.57012C12.0459 8.18625 12.0458 8.95419 12.0458 9.9168C12.0458 10.8795 12.0459 11.6473 11.9901 12.2635C11.9334 12.8888 11.8142 13.4254 11.535 13.909C11.2008 14.4877 10.7202 14.9683 10.1415 15.3025C9.65792 15.5817 9.12128 15.7009 8.49597 15.7576C7.87984 15.8134 7.11196 15.8133 6.14929 15.8133C5.18667 15.8133 4.41874 15.8134 3.80261 15.7576C3.1773 15.7009 2.64067 15.5817 2.1571 15.3025C1.5784 14.9683 1.09778 14.4877 0.76355 13.909",
|
|
205
|
+
fill: "currentColor"
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
function IconCheckOutline14(size = 12, className = "") {
|
|
209
|
+
return hx("svg", {
|
|
210
|
+
width: size,
|
|
211
|
+
height: size,
|
|
212
|
+
className: className || void 0,
|
|
213
|
+
viewBox: "0 0 14 14",
|
|
214
|
+
fill: "none",
|
|
215
|
+
style: {
|
|
216
|
+
display: "inline-block",
|
|
217
|
+
verticalAlign: "-1.5px",
|
|
218
|
+
flexShrink: 0
|
|
219
|
+
},
|
|
220
|
+
"aria-hidden": true
|
|
221
|
+
}, hx("path", {
|
|
222
|
+
d: "M11.5635 4.58984L7.61426 9.07715C7.35154 9.37561 7.11346 9.64812 6.89453 9.84668C6.66593 10.054 6.38519 10.2506 6.01465 10.3164C5.82079 10.3508 5.62207 10.3529 5.42773 10.3213C5.0561 10.2609 4.77266 10.0674 4.54102 9.86328C4.31926 9.66791 4.07752 9.39911 3.81055 9.10449L2.44531 7.59863L3.55664 6.59082L4.92188 8.09766C5.21256 8.41844 5.38878 8.61191 5.53223 8.73828C5.61022 8.80699 5.65253 8.83192 5.66895 8.83984C5.69648 8.84429 5.72449 8.84467 5.75195 8.83984C5.72657 8.84451 5.75564 8.85422 5.88672 8.73535C6.02833 8.60692 6.20225 8.41088 6.48828 8.08594L10.4385 3.59961L11.5635 4.58984Z",
|
|
223
|
+
fill: "currentColor"
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
function toolIconFor(kind, size = 14) {
|
|
227
|
+
switch (kind) {
|
|
228
|
+
case "terminal": return IconApiOutline14(size);
|
|
229
|
+
case "diff":
|
|
230
|
+
case "delete": return IconEditOutline16(size);
|
|
231
|
+
case "read": return IconBrowseOutline16(size);
|
|
232
|
+
case "search":
|
|
233
|
+
case "list": return IconSearchOutline16(size);
|
|
234
|
+
default: return IconCodeOutline16(size);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
58
237
|
function parsedArgsRaw(block) {
|
|
59
238
|
const settled = block;
|
|
60
239
|
if ("call" in settled && settled.call !== null && typeof settled.call.argsRaw === "string") return settled.call.argsRaw;
|
|
@@ -72,7 +251,6 @@ window.__ModuleLoader__.load({
|
|
|
72
251
|
return null;
|
|
73
252
|
}
|
|
74
253
|
}
|
|
75
|
-
/** agy tool name + PascalCase or camelCase input object from the mirror args. */
|
|
76
254
|
function mirrorInfo(block) {
|
|
77
255
|
const a = parseArgs(block);
|
|
78
256
|
if (a === null) return null;
|
|
@@ -154,7 +332,6 @@ window.__ModuleLoader__.load({
|
|
|
154
332
|
"remove_file",
|
|
155
333
|
"rm"
|
|
156
334
|
]);
|
|
157
|
-
/** Build the display model for one agy_tool block (pending or settled). */
|
|
158
335
|
function mirrorCardModel(block, cwd, home) {
|
|
159
336
|
const info = mirrorInfo(block);
|
|
160
337
|
const out = resultText(block);
|
|
@@ -246,106 +423,6 @@ window.__ModuleLoader__.load({
|
|
|
246
423
|
raw: parsedArgsRaw(block)
|
|
247
424
|
};
|
|
248
425
|
}
|
|
249
|
-
function cls(...names) {
|
|
250
|
-
return names.filter((n) => typeof n === "string" && n !== "").join(" ");
|
|
251
|
-
}
|
|
252
|
-
const ROW_CSS = `
|
|
253
|
-
.agy-tv-row{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l1,#e2e8f0);border-radius:10px;background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-base,#fff));margin:4px 0;overflow:hidden;font:var(--dsw-font-13,13px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'PingFang SC','Microsoft YaHei',sans-serif)}
|
|
254
|
-
.agy-tv-head{display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:pointer;user-select:none;background:transparent;border:none;width:100%;text-align:left;color:var(--dsw-alias-label-primary,#0f172a)}
|
|
255
|
-
.agy-tv-head:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(0,0,0,.04))}
|
|
256
|
-
.agy-tv-icon{flex:none;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:5px;background:var(--dsw-alias-bg-layer-3,#f1f5f9);color:var(--dsw-alias-label-secondary,#334155)}
|
|
257
|
-
.agy-tv-title{min-width:0;flex:1;font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
258
|
-
.agy-tv-kind{flex:none;font-size:10px;font-weight:700;letter-spacing:.02em;text-transform:capitalize;padding:1px 6px;border-radius:5px;color:var(--dsw-alias-state-business-primary,#2563eb);background:color-mix(in srgb,var(--dsw-alias-state-business-primary,#2563eb) 12%,transparent)}
|
|
259
|
-
.agy-tv-tool{flex:none;font-size:10px;font-weight:600;font-family:var(--dsw-font-family-code,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace);color:var(--dsw-alias-label-tertiary,#64748b);background:var(--dsw-alias-bg-layer-3,#f1f5f9);border:.5px solid var(--dsw-alias-border-l1,#e2e8f0);border-radius:5px;padding:1px 6px;max-width:28%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
260
|
-
.agy-tv-label{font-size:10.5px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;color:var(--dsw-alias-label-tertiary,#64748b);margin:0 0 3px}
|
|
261
|
-
.agy-tv-preview{flex:none;max-width:32%;font-size:11px;color:var(--dsw-alias-label-caption,#94a3b8);font-family:var(--dsw-font-family-code,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:var(--dsw-alias-bg-layer-3,#f1f5f9);border-radius:5px;padding:1px 6px}
|
|
262
|
-
.agy-tv-state{flex:none;font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:999px}
|
|
263
|
-
.agy-tv-state-ok{color:var(--dsw-alias-state-success-primary,#059669);background:color-mix(in srgb,var(--dsw-alias-state-success-primary,#059669) 12%,transparent)}
|
|
264
|
-
.agy-tv-state-err{color:var(--dsw-alias-state-error-primary,#dc2626);background:color-mix(in srgb,var(--dsw-alias-state-error-primary,#dc2626) 12%,transparent)}
|
|
265
|
-
.agy-tv-state-run{color:var(--dsw-alias-state-business-primary,#2563eb);background:color-mix(in srgb,var(--dsw-alias-state-business-primary,#2563eb) 12%,transparent)}
|
|
266
|
-
.agy-tv-body{display:none;padding:8px 10px;border-top:.5px solid var(--dsw-alias-border-l1,#e2e8f0)}
|
|
267
|
-
.agy-tv-open .agy-tv-body{display:block}
|
|
268
|
-
.agy-tv-term{font-family:var(--dsw-font-family-code,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace);font-size:12px;line-height:1.55;white-space:pre-wrap;word-break:break-word;background:var(--dsw-alias-bg-layer-1,#f8fafc);border:.5px solid var(--dsw-alias-border-l1,#e2e8f0);border-radius:7px;padding:8px 10px;color:var(--dsw-alias-label-primary,#0f172a)}
|
|
269
|
-
.agy-tv-term-cmd{color:var(--dsw-alias-label-tertiary,#64748b);font-size:11px;margin:0 0 4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
270
|
-
.agy-tv-term-cwd{color:var(--dsw-alias-label-caption,#94a3b8);font-size:11px;font-family:var(--dsw-font-family-code,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace);padding:2px 8px;border-top-left-radius:7px;border-top-right-radius:7px;background:var(--dsw-alias-bg-layer-3,#f1f5f9);border:.5px solid var(--dsw-alias-border-l1,#e2e8f0);border-bottom:none}
|
|
271
|
-
.agy-tv-diff{font-family:var(--dsw-font-family-code,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace);font-size:12px;line-height:1.5;border:.5px solid var(--dsw-alias-border-l1,#e2e8f0);border-radius:7px;overflow:hidden}
|
|
272
|
-
.agy-tv-diff-path{font-size:11px;padding:4px 10px;background:var(--dsw-alias-bg-layer-3,#f1f5f9);color:var(--dsw-alias-label-secondary,#334155);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
273
|
-
.agy-tv-line{display:flex;gap:8px;padding:0 10px;min-height:20px;white-space:pre-wrap;word-break:break-word}
|
|
274
|
-
.agy-tv-line-del{background:color-mix(in srgb,var(--dsw-alias-state-error-primary,#dc2626) 12%,transparent);color:var(--dsw-alias-label-primary,#0f172a)}
|
|
275
|
-
.agy-tv-line-del .agy-tv-line-marker{color:var(--dsw-alias-state-error-primary,#dc2626);font-weight:700}
|
|
276
|
-
.agy-tv-line-add{background:color-mix(in srgb,var(--dsw-alias-state-success-primary,#059669) 12%,transparent);color:var(--dsw-alias-label-primary,#0f172a)}
|
|
277
|
-
.agy-tv-line-add .agy-tv-line-marker{color:var(--dsw-alias-state-success-primary,#059669);font-weight:700}
|
|
278
|
-
.agy-tv-line-marker{flex:none;width:14px;color:var(--dsw-alias-label-caption,#94a3b8);user-select:none}
|
|
279
|
-
.agy-tv-path{font-family:var(--dsw-font-family-code,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace);font-size:12px;color:var(--dsw-alias-state-business-primary,#2563eb);cursor:pointer;text-decoration:underline}
|
|
280
|
-
.agy-tv-raw{font-family:var(--dsw-font-family-code,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace);font-size:11.5px;white-space:pre-wrap;word-break:break-word;color:var(--dsw-alias-label-secondary,#334155);max-height:200px;overflow:auto}
|
|
281
|
-
`;
|
|
282
|
-
const stateLabel = (kind) => kind === "err" ? "Error" : kind === "run" ? "Running" : "Done";
|
|
283
|
-
function ChevronDown() {
|
|
284
|
-
const h = hx;
|
|
285
|
-
return h("svg", {
|
|
286
|
-
viewBox: "0 0 16 16",
|
|
287
|
-
width: 12,
|
|
288
|
-
height: 12,
|
|
289
|
-
style: {
|
|
290
|
-
flex: "none",
|
|
291
|
-
color: "var(--dsw-alias-label-tertiary,#64748b)"
|
|
292
|
-
}
|
|
293
|
-
}, h("path", {
|
|
294
|
-
d: "M4 6l4 4 4-4",
|
|
295
|
-
fill: "none",
|
|
296
|
-
stroke: "currentColor",
|
|
297
|
-
"stroke-width": 1.5,
|
|
298
|
-
"stroke-linecap": "round",
|
|
299
|
-
"stroke-linejoin": "round"
|
|
300
|
-
}));
|
|
301
|
-
}
|
|
302
|
-
function StatusIcon({ kind }) {
|
|
303
|
-
const h = hx;
|
|
304
|
-
return h("svg", {
|
|
305
|
-
viewBox: "0 0 16 16",
|
|
306
|
-
width: 14,
|
|
307
|
-
height: 14,
|
|
308
|
-
style: {
|
|
309
|
-
color: kind === "diff" ? "var(--dsw-alias-state-success-primary,#059669)" : kind === "delete" ? "var(--dsw-alias-state-error-primary,#dc2626)" : "var(--dsw-alias-label-secondary,#334155)",
|
|
310
|
-
display: "block"
|
|
311
|
-
}
|
|
312
|
-
}, h("path", {
|
|
313
|
-
d: kind === "terminal" ? "M4 2l8 6-8 6z" : kind === "diff" ? "M4 8h8M8 4v8M3 3h6a2 2 0 012 2v6a2 2 0 01-2 2H3a2 2 0 01-2-2V5a2 2 0 012-2z" : kind === "read" ? "M4 3h8a1 1 0 011 1v9l-3-2-3 2-3-2V4a1 1 0 011-1z" : kind === "search" ? "M7 3a4 4 0 100 8 4 4 0 000-8zm4 4a4 4 0 01-.5 2L14 12.5 12.5 14 9 10.5" : kind === "list" ? "M3 5h10M3 8h10M3 11h6" : kind === "delete" ? "M3 5h10M6 5V3h4v2M5 5l.5 9h5L11 5" : "M8 2a6 6 0 100 12A6 6 0 008 2zm0 2v4l3 2",
|
|
314
|
-
fill: "none",
|
|
315
|
-
stroke: "currentColor",
|
|
316
|
-
"stroke-width": 1.3,
|
|
317
|
-
"stroke-linecap": "round",
|
|
318
|
-
"stroke-linejoin": "round"
|
|
319
|
-
}));
|
|
320
|
-
}
|
|
321
|
-
/** Render one line-diff hunk (oldText -> newText) with +/- markers. */
|
|
322
|
-
function DiffBody({ model, openFile, cwd, home }) {
|
|
323
|
-
const h = hx;
|
|
324
|
-
const path = model.path ?? "file";
|
|
325
|
-
const oldText = model.oldText ?? "";
|
|
326
|
-
const newText = model.newText ?? "";
|
|
327
|
-
const pathLabel = relativize(path, cwd, home);
|
|
328
|
-
const rows = [];
|
|
329
|
-
if (oldText !== "") for (const line of oldText.split("\n")) rows.push(h("div", {
|
|
330
|
-
key: "o" + rows.length,
|
|
331
|
-
className: "agy-tv-line agy-tv-line-del"
|
|
332
|
-
}, h("span", { className: "agy-tv-line-marker" }, "-"), h("span", { style: { flex: 1 } }, line === "" ? " " : line)));
|
|
333
|
-
if (newText !== "") for (const line of newText.split("\n")) rows.push(h("div", {
|
|
334
|
-
key: "n" + rows.length,
|
|
335
|
-
className: "agy-tv-line agy-tv-line-add"
|
|
336
|
-
}, h("span", { className: "agy-tv-line-marker" }, "+"), h("span", { style: { flex: 1 } }, line === "" ? " " : line)));
|
|
337
|
-
if (rows.length === 0) rows.push(h("div", {
|
|
338
|
-
key: "empty",
|
|
339
|
-
className: "agy-tv-line"
|
|
340
|
-
}, h("span", { className: "agy-tv-line-marker" }, " "), h("span", { style: {
|
|
341
|
-
flex: 1,
|
|
342
|
-
color: "var(--dsw-alias-label-tertiary,#64748b)"
|
|
343
|
-
} }, "(no textual change)")));
|
|
344
|
-
return h("div", { className: "agy-tv-diff" }, h("div", { className: "agy-tv-diff-path" }, openFile !== void 0 ? h("span", {
|
|
345
|
-
className: "agy-tv-path",
|
|
346
|
-
onClick: () => openFile(path)
|
|
347
|
-
}, pathLabel) : h("span", { style: { cursor: "default" } }, pathLabel)), ...rows);
|
|
348
|
-
}
|
|
349
426
|
function relativize(p, cwd, home) {
|
|
350
427
|
if (cwd && p.startsWith(cwd)) {
|
|
351
428
|
const rel = p.slice(cwd.length).replace(/^[/\\]+/, "");
|
|
@@ -357,12 +434,9 @@ window.__ModuleLoader__.load({
|
|
|
357
434
|
function clip(s, max) {
|
|
358
435
|
return s.length > max ? s.slice(0, max) + "\n… (+" + (s.length - max) + " chars)" : s;
|
|
359
436
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
* card a content cue (e.g. `pwd` -> `/Users/.../agy-spaces`) instead of a bare
|
|
364
|
-
* title + state.
|
|
365
|
-
*/
|
|
437
|
+
function trimTrailingBlankLines(s) {
|
|
438
|
+
return s.replace(/[\t ]*\r?\n[\t ]*(\r?\n[\t ]*)*$/, "\n");
|
|
439
|
+
}
|
|
366
440
|
function previewLine(model, cwd, home) {
|
|
367
441
|
if (model.kind === "diff") {
|
|
368
442
|
const rel = relativize(model.path ?? "file", cwd, home);
|
|
@@ -375,48 +449,145 @@ window.__ModuleLoader__.load({
|
|
|
375
449
|
if (first !== void 0 && first.trim() !== "") return first.trim().slice(0, 80);
|
|
376
450
|
}
|
|
377
451
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
return hx("div", { className: "agy-tv-label" }, "输出");
|
|
452
|
+
function cls(...names) {
|
|
453
|
+
return names.filter((n) => typeof n === "string" && n !== "").join(" ");
|
|
381
454
|
}
|
|
382
|
-
function
|
|
455
|
+
function displayTitle(model) {
|
|
456
|
+
switch (model.kind) {
|
|
457
|
+
case "terminal": return "Command";
|
|
458
|
+
case "diff": return model.tool === "write_to_file" || model.tool === "write_file" || model.tool === "create_file" ? "Write" : "Edit";
|
|
459
|
+
case "read": return "Read";
|
|
460
|
+
case "search": return "Search";
|
|
461
|
+
case "list": return "List";
|
|
462
|
+
case "delete": return "Delete";
|
|
463
|
+
default: return model.tool ? model.tool.replace(/_/g, " ") : "Tool";
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
function displaySummary(model, cwd, home) {
|
|
467
|
+
if (model.kind === "terminal") return model.command ?? model.title;
|
|
468
|
+
if (model.kind === "diff") return relativize(model.path ?? "file", cwd, home);
|
|
469
|
+
if (model.kind === "read") {
|
|
470
|
+
const rawPath = model.path ?? "";
|
|
471
|
+
return rawPath !== "" ? relativize(rawPath, cwd, home) : model.title;
|
|
472
|
+
}
|
|
473
|
+
if (model.kind === "search") return model.title.replace(/^Search\s*/i, "") || model.title;
|
|
474
|
+
if (model.kind === "list") return model.title.replace(/^List\s*(directory\s*)?/i, "") || model.title;
|
|
475
|
+
return model.title;
|
|
476
|
+
}
|
|
477
|
+
function diffStat(model) {
|
|
478
|
+
if (model.kind !== "diff") return null;
|
|
479
|
+
const oldText = model.oldText ?? "";
|
|
480
|
+
const newText = model.newText ?? "";
|
|
481
|
+
const oldLines = oldText === "" ? 0 : oldText.split("\n").length;
|
|
482
|
+
const newLines = newText === "" ? 0 : newText.split("\n").length;
|
|
483
|
+
if (oldLines === 0 && newLines === 0) return null;
|
|
484
|
+
if (oldLines === 0) return `+${newLines}`;
|
|
485
|
+
return `+${newLines} -${oldLines}`;
|
|
486
|
+
}
|
|
487
|
+
function CopyButton({ text }) {
|
|
488
|
+
const [copied, setCopied] = react().useState(false);
|
|
489
|
+
const onCopy = (e) => {
|
|
490
|
+
e.stopPropagation();
|
|
491
|
+
if (typeof navigator !== "undefined" && navigator.clipboard) navigator.clipboard.writeText(text).then(() => {
|
|
492
|
+
setCopied(true);
|
|
493
|
+
setTimeout(() => setCopied(false), 1500);
|
|
494
|
+
}).catch(() => {});
|
|
495
|
+
};
|
|
496
|
+
return hx("button", {
|
|
497
|
+
type: "button",
|
|
498
|
+
className: "agy-tv-copy-btn",
|
|
499
|
+
onClick: onCopy,
|
|
500
|
+
title: copied ? "已复制" : "复制内容"
|
|
501
|
+
}, copied ? IconCheckOutline14(11) : IconCopyOutline16(11), hx("span", null, copied ? "已复制" : "复制"));
|
|
502
|
+
}
|
|
503
|
+
function DiffBody({ model }) {
|
|
504
|
+
const h = hx;
|
|
505
|
+
const oldText = model.oldText ?? "";
|
|
506
|
+
const newText = model.newText ?? "";
|
|
507
|
+
const rows = [];
|
|
508
|
+
if (oldText !== "") {
|
|
509
|
+
const lines = oldText.split("\n");
|
|
510
|
+
for (let i = 0; i < lines.length; i++) {
|
|
511
|
+
const line = lines[i];
|
|
512
|
+
rows.push(h("div", {
|
|
513
|
+
key: "del-" + i,
|
|
514
|
+
className: "agy-tv-diff-line agy-tv-diff-del"
|
|
515
|
+
}, h("span", { className: "agy-tv-diff-marker" }, "-"), h("span", { style: { flex: 1 } }, line === "" ? " " : line)));
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (newText !== "") {
|
|
519
|
+
const lines = newText.split("\n");
|
|
520
|
+
for (let i = 0; i < lines.length; i++) {
|
|
521
|
+
const line = lines[i];
|
|
522
|
+
rows.push(h("div", {
|
|
523
|
+
key: "add-" + i,
|
|
524
|
+
className: "agy-tv-diff-line agy-tv-diff-add"
|
|
525
|
+
}, h("span", { className: "agy-tv-diff-marker" }, "+"), h("span", { style: { flex: 1 } }, line === "" ? " " : line)));
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if (rows.length === 0) rows.push(h("div", {
|
|
529
|
+
key: "empty",
|
|
530
|
+
className: "agy-tv-diff-line",
|
|
531
|
+
style: { color: "var(--dsw-alias-label-tertiary)" }
|
|
532
|
+
}, "(no textual changes)"));
|
|
533
|
+
return h("div", { className: "agy-tv-diff-list" }, ...rows);
|
|
534
|
+
}
|
|
535
|
+
function CardBody({ model, openFile, cwd, home, inspect }) {
|
|
383
536
|
const h = hx;
|
|
537
|
+
const inspectNode = inspect !== void 0 ? h("div", {
|
|
538
|
+
key: "ins",
|
|
539
|
+
style: { padding: "4px 8px 6px" }
|
|
540
|
+
}, h("button", {
|
|
541
|
+
type: "button",
|
|
542
|
+
className: "agy-tv-inspect-btn",
|
|
543
|
+
onClick: inspect
|
|
544
|
+
}, IconInspectOutline12(12), "检查")) : null;
|
|
384
545
|
switch (model.kind) {
|
|
385
546
|
case "terminal": {
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
className: "agy-tv-term-cmd"
|
|
390
|
-
}, model.command)] : [], ...model.cwd !== void 0 && model.cwd !== "" ? [h("div", {
|
|
547
|
+
const rawBody = model.output !== void 0 && model.output !== "" ? trimTrailingBlankLines(model.output) : "(no output)";
|
|
548
|
+
const copyText = model.output !== void 0 && model.output !== "" ? model.output : model.command ?? "";
|
|
549
|
+
return h("div", { className: "agy-tv-card" }, h("div", { className: "agy-tv-card-header" }, h("div", { className: "agy-tv-card-header-left" }, h("span", { className: "agy-tv-prompt-glyph" }, "❯"), ...model.cwd ? [h("span", {
|
|
391
550
|
key: "cwd",
|
|
392
|
-
className: "agy-tv-
|
|
393
|
-
},
|
|
551
|
+
className: "agy-tv-card-cwd"
|
|
552
|
+
}, model.cwd)] : [], h("span", {
|
|
553
|
+
className: "agy-tv-card-cmd",
|
|
554
|
+
title: model.command
|
|
555
|
+
}, model.command ?? "")), h(CopyButton, { text: copyText })), h("pre", { className: "agy-tv-card-content" }, clip(rawBody, 16e3)), inspectNode);
|
|
394
556
|
}
|
|
395
|
-
case "diff":
|
|
396
|
-
model,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
557
|
+
case "diff": {
|
|
558
|
+
const pathLabel = relativize(model.path ?? "file", cwd, home);
|
|
559
|
+
const stat = diffStat(model);
|
|
560
|
+
const copyText = model.newText ?? "";
|
|
561
|
+
return h("div", { className: "agy-tv-card" }, h("div", { className: "agy-tv-card-header" }, h("div", { className: "agy-tv-card-header-left" }, IconEditOutline16(13), h("span", { className: "agy-tv-card-path" }, pathLabel), ...stat ? [h("span", {
|
|
562
|
+
key: "s",
|
|
563
|
+
className: "agy-tv-diff-stat"
|
|
564
|
+
}, stat)] : []), h(CopyButton, { text: copyText })), h(DiffBody, {
|
|
565
|
+
model,
|
|
566
|
+
openFile,
|
|
567
|
+
cwd,
|
|
568
|
+
home
|
|
569
|
+
}), inspectNode);
|
|
570
|
+
}
|
|
571
|
+
case "read": {
|
|
572
|
+
const pathLabel = relativize(model.path ?? "file", cwd, home);
|
|
573
|
+
const rawBody = model.output !== void 0 && model.output !== "" ? trimTrailingBlankLines(model.output) : "(no output)";
|
|
574
|
+
return h("div", { className: "agy-tv-card" }, h("div", { className: "agy-tv-card-header" }, h("div", { className: "agy-tv-card-header-left" }, IconBrowseOutline16(13), h("span", { className: "agy-tv-card-path" }, pathLabel)), h(CopyButton, { text: model.output ?? "" })), h("pre", { className: "agy-tv-card-content" }, clip(rawBody, 16e3)), inspectNode);
|
|
575
|
+
}
|
|
576
|
+
case "search": {
|
|
577
|
+
const rawBody = model.output !== void 0 && model.output !== "" ? trimTrailingBlankLines(model.output) : "(no matches)";
|
|
578
|
+
return h("div", { className: "agy-tv-card" }, h("div", { className: "agy-tv-card-header" }, h("div", { className: "agy-tv-card-header-left" }, IconSearchOutline16(13), h("span", { className: "agy-tv-card-path" }, model.title)), h(CopyButton, { text: model.output ?? "" })), h("pre", { className: "agy-tv-card-content" }, clip(rawBody, 16e3)), inspectNode);
|
|
579
|
+
}
|
|
580
|
+
case "list": {
|
|
581
|
+
const rawBody = model.output !== void 0 && model.output !== "" ? trimTrailingBlankLines(model.output) : "(empty directory)";
|
|
582
|
+
return h("div", { className: "agy-tv-card" }, h("div", { className: "agy-tv-card-header" }, h("div", { className: "agy-tv-card-header-left" }, IconBrowseOutline16(13), h("span", { className: "agy-tv-card-path" }, model.title)), h(CopyButton, { text: model.output ?? "" })), h("pre", { className: "agy-tv-card-content" }, clip(rawBody, 16e3)), inspectNode);
|
|
583
|
+
}
|
|
584
|
+
default: {
|
|
585
|
+
const copyText = model.output !== void 0 && model.output !== "" ? model.output : model.raw ?? "";
|
|
586
|
+
const rawBody = model.output !== void 0 && model.output !== "" ? trimTrailingBlankLines(model.output) : model.raw !== void 0 && model.raw !== "" ? clip(model.raw, 4e3) : "(no detail)";
|
|
587
|
+
return h("div", { className: "agy-tv-card" }, h("div", { className: "agy-tv-card-header" }, h("div", { className: "agy-tv-card-header-left" }, IconCodeOutline16(13), h("span", { className: "agy-tv-card-path" }, model.tool || "Tool")), h(CopyButton, { text: copyText })), h("pre", { className: "agy-tv-card-content" }, clip(rawBody, 16e3)), inspectNode);
|
|
407
588
|
}
|
|
408
|
-
default: return h("div", null, h(OutputLabel, { key: "ol" }), h("pre", { className: "agy-tv-raw" }, model.raw !== void 0 && model.raw !== "" ? clip(model.raw, 4e3) : "(no detail)"));
|
|
409
589
|
}
|
|
410
590
|
}
|
|
411
|
-
function trimTrailingBlankLines(s) {
|
|
412
|
-
return s.replace(/[\t ]*\r?\n[\t ]*(\r?\n[\t ]*)*$/, "\n");
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* The keyed `tool.call.toolview` component for `agy_tool`. Renders the
|
|
416
|
-
* recorded agy tool activity as a native-looking DSH tool card.
|
|
417
|
-
* Receives the ToolCallOwnerProps: { callId, toolName, block, cwd, home,
|
|
418
|
-
* openFile, loadImage, inspect } (locale/inject optional).
|
|
419
|
-
*/
|
|
420
591
|
function AgyMirrorToolView(props) {
|
|
421
592
|
const [open, setOpen] = useToggle(false);
|
|
422
593
|
const h = hx;
|
|
@@ -425,43 +596,74 @@ window.__ModuleLoader__.load({
|
|
|
425
596
|
const err = isError(block);
|
|
426
597
|
const model = mirrorCardModel(block, cwd, home);
|
|
427
598
|
const state = !settle ? "run" : err ? "err" : "ok";
|
|
428
|
-
const title = model
|
|
429
|
-
const
|
|
430
|
-
const
|
|
599
|
+
const title = displayTitle(model);
|
|
600
|
+
const summary = displaySummary(model, cwd, home);
|
|
601
|
+
const stat = diffStat(model);
|
|
602
|
+
const preview = !open && model.kind !== "diff" ? previewLine(model, cwd, home) : void 0;
|
|
603
|
+
const hasFileLink = (model.kind === "diff" || model.kind === "read") && model.path && openFile !== void 0;
|
|
604
|
+
const onFileClick = (e) => {
|
|
605
|
+
e.stopPropagation();
|
|
606
|
+
if (model.path && openFile) {
|
|
607
|
+
if (model.location?.line !== void 0) openFile(model.path, { line: model.location.line });
|
|
608
|
+
else openFile(model.path);
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
const leading = open ? h("span", { className: "agy-tv-chevron-open" }, IconChevronDownOutline14(14)) : h("span", { className: "agy-tv-leading" }, h("span", { className: "agy-tv-icon-idle" }, toolIconFor(model.kind, 14)), h("span", { className: "agy-tv-chevron-hover" }, IconChevronDownOutline14(14)));
|
|
612
|
+
const summaryNode = hasFileLink ? h("button", {
|
|
431
613
|
type: "button",
|
|
432
|
-
className: "agy-tv-
|
|
614
|
+
className: "agy-tv-file-link",
|
|
615
|
+
onClick: onFileClick,
|
|
616
|
+
title: model.path
|
|
617
|
+
}, summary) : h("span", {
|
|
618
|
+
className: cls("agy-tv-summary", err && "agy-tv-summary-err"),
|
|
619
|
+
title: summary
|
|
620
|
+
}, summary);
|
|
621
|
+
const header = h("div", {
|
|
622
|
+
className: "agy-tv-row",
|
|
623
|
+
role: "button",
|
|
624
|
+
tabIndex: 0,
|
|
625
|
+
"aria-expanded": open,
|
|
433
626
|
onClick: (e) => {
|
|
434
627
|
e.stopPropagation();
|
|
435
628
|
setOpen();
|
|
436
629
|
},
|
|
437
|
-
|
|
630
|
+
onKeyDown: (e) => {
|
|
631
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
632
|
+
e.preventDefault();
|
|
633
|
+
setOpen();
|
|
634
|
+
}
|
|
635
|
+
},
|
|
438
636
|
title: inspect !== void 0 ? open ? "Click to collapse · right-click to inspect" : "Click to expand · right-click to inspect" : open ? "Click to collapse" : "Click to expand",
|
|
439
637
|
onContextMenu: inspect !== void 0 ? (e) => {
|
|
440
638
|
e.preventDefault();
|
|
441
639
|
inspect();
|
|
442
640
|
} : void 0
|
|
443
|
-
},
|
|
444
|
-
className: "agy-tv-
|
|
445
|
-
|
|
446
|
-
},
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
},
|
|
641
|
+
}, leading, h("span", { className: "agy-tv-title" }, title), h("span", {
|
|
642
|
+
className: "agy-tv-sep",
|
|
643
|
+
"aria-hidden": true
|
|
644
|
+
}), summaryNode, ...stat !== null ? [h("span", {
|
|
645
|
+
key: "stat",
|
|
646
|
+
className: "agy-tv-diff-stat"
|
|
647
|
+
}, stat)] : [], ...preview !== void 0 ? [h("span", {
|
|
648
|
+
key: "prev",
|
|
450
649
|
className: "agy-tv-preview",
|
|
451
650
|
title: preview
|
|
452
|
-
}, preview)] : []
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
651
|
+
}, preview)] : []);
|
|
652
|
+
return h("div", {
|
|
653
|
+
className: cls("agy-tv-root", open && "agy-tv-open"),
|
|
654
|
+
"data-state": state,
|
|
655
|
+
"data-kind": model.kind
|
|
656
|
+
}, header, ...open ? [h("div", {
|
|
657
|
+
key: "wrap",
|
|
658
|
+
className: "agy-tv-body-wrap"
|
|
659
|
+
}, h(CardBody, {
|
|
458
660
|
model,
|
|
459
661
|
openFile,
|
|
460
662
|
cwd,
|
|
461
|
-
home
|
|
462
|
-
|
|
663
|
+
home,
|
|
664
|
+
inspect
|
|
665
|
+
}))] : []);
|
|
463
666
|
}
|
|
464
|
-
/** Install the native tool-card toolview (call once from apply). */
|
|
465
667
|
function installAgyToolView(ctx) {
|
|
466
668
|
ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
|
|
467
669
|
name: "tool.call.toolview",
|
|
@@ -470,6 +672,377 @@ window.__ModuleLoader__.load({
|
|
|
470
672
|
label: "Antigravity tool"
|
|
471
673
|
}, AgyMirrorToolView));
|
|
472
674
|
}
|
|
675
|
+
const ROW_CSS = `
|
|
676
|
+
/* Container */
|
|
677
|
+
.agy-tv-root {
|
|
678
|
+
display: flex;
|
|
679
|
+
flex-direction: column;
|
|
680
|
+
width: 100%;
|
|
681
|
+
min-width: 0;
|
|
682
|
+
position: relative;
|
|
683
|
+
font-family: var(--dsw-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif);
|
|
684
|
+
margin: 2px 0;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/* Collapsed Header Row */
|
|
688
|
+
.agy-tv-row {
|
|
689
|
+
display: flex;
|
|
690
|
+
align-items: center;
|
|
691
|
+
height: calc(24px + var(--dsh-content-font-delta, 0px));
|
|
692
|
+
min-width: 0;
|
|
693
|
+
position: relative;
|
|
694
|
+
overflow: hidden;
|
|
695
|
+
cursor: pointer;
|
|
696
|
+
user-select: none;
|
|
697
|
+
background: transparent;
|
|
698
|
+
border: none;
|
|
699
|
+
padding: 0;
|
|
700
|
+
width: 100%;
|
|
701
|
+
text-align: left;
|
|
702
|
+
color: var(--dsw-alias-label-primary, #0f172a);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/* Running sweep shimmer animation */
|
|
706
|
+
.agy-tv-root[data-state="run"] .agy-tv-row:after {
|
|
707
|
+
content: "";
|
|
708
|
+
position: absolute;
|
|
709
|
+
top: 0;
|
|
710
|
+
bottom: 0;
|
|
711
|
+
left: 0;
|
|
712
|
+
width: 300px;
|
|
713
|
+
background: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base, #ffffff) 60%, transparent) 55%, transparent 100%);
|
|
714
|
+
pointer-events: none;
|
|
715
|
+
animation: 2.6s ease-out infinite agy-tv-sweep;
|
|
716
|
+
}
|
|
717
|
+
@keyframes agy-tv-sweep {
|
|
718
|
+
0% { left: -300px; }
|
|
719
|
+
90%, 100% { left: 100%; }
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/* Leading Icon with Hover-to-Arrow transition */
|
|
723
|
+
.agy-tv-leading {
|
|
724
|
+
position: relative;
|
|
725
|
+
flex: none;
|
|
726
|
+
width: calc(16px + var(--dsh-content-font-delta, 0px));
|
|
727
|
+
height: calc(16px + var(--dsh-content-font-delta, 0px));
|
|
728
|
+
display: inline-flex;
|
|
729
|
+
align-items: center;
|
|
730
|
+
justify-content: center;
|
|
731
|
+
margin-right: 6px;
|
|
732
|
+
color: var(--dsw-alias-label-tertiary, #64748b);
|
|
733
|
+
}
|
|
734
|
+
.agy-tv-leading svg {
|
|
735
|
+
width: calc(14px + var(--dsh-content-font-delta, 0px));
|
|
736
|
+
height: calc(14px + var(--dsh-content-font-delta, 0px));
|
|
737
|
+
}
|
|
738
|
+
.agy-tv-icon-idle {
|
|
739
|
+
display: inline-flex;
|
|
740
|
+
opacity: 1;
|
|
741
|
+
transition: opacity 0.1s ease;
|
|
742
|
+
}
|
|
743
|
+
.agy-tv-chevron-hover {
|
|
744
|
+
position: absolute;
|
|
745
|
+
inset: 0;
|
|
746
|
+
margin: auto;
|
|
747
|
+
opacity: 0;
|
|
748
|
+
transition: opacity 0.1s ease;
|
|
749
|
+
display: inline-flex;
|
|
750
|
+
align-items: center;
|
|
751
|
+
justify-content: center;
|
|
752
|
+
color: var(--dsw-alias-label-secondary, #334155);
|
|
753
|
+
}
|
|
754
|
+
.agy-tv-row:hover .agy-tv-icon-idle {
|
|
755
|
+
opacity: 0;
|
|
756
|
+
}
|
|
757
|
+
.agy-tv-row:hover .agy-tv-chevron-hover {
|
|
758
|
+
opacity: 1;
|
|
759
|
+
}
|
|
760
|
+
.agy-tv-chevron-open {
|
|
761
|
+
position: relative;
|
|
762
|
+
flex: none;
|
|
763
|
+
width: calc(16px + var(--dsh-content-font-delta, 0px));
|
|
764
|
+
height: calc(16px + var(--dsh-content-font-delta, 0px));
|
|
765
|
+
display: inline-flex;
|
|
766
|
+
align-items: center;
|
|
767
|
+
justify-content: center;
|
|
768
|
+
margin-right: 6px;
|
|
769
|
+
color: var(--dsw-alias-label-secondary, #334155);
|
|
770
|
+
}
|
|
771
|
+
.agy-tv-chevron-open svg {
|
|
772
|
+
width: calc(14px + var(--dsh-content-font-delta, 0px));
|
|
773
|
+
height: calc(14px + var(--dsh-content-font-delta, 0px));
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/* Title */
|
|
777
|
+
.agy-tv-title {
|
|
778
|
+
flex: none;
|
|
779
|
+
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
780
|
+
line-height: calc(24px + var(--dsh-content-font-delta, 0px));
|
|
781
|
+
color: var(--dsw-alias-label-secondary, #334155);
|
|
782
|
+
font-weight: 400;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/* Dot separator */
|
|
786
|
+
.agy-tv-sep {
|
|
787
|
+
background: var(--dsw-alias-label-caption, #94a3b8);
|
|
788
|
+
border-radius: 1px;
|
|
789
|
+
flex: none;
|
|
790
|
+
width: 2px;
|
|
791
|
+
height: 2px;
|
|
792
|
+
margin: 0 8px;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/* Summary */
|
|
796
|
+
.agy-tv-summary {
|
|
797
|
+
text-overflow: ellipsis;
|
|
798
|
+
white-space: nowrap;
|
|
799
|
+
min-width: 0;
|
|
800
|
+
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
801
|
+
line-height: calc(24px + var(--dsh-content-font-delta, 0px));
|
|
802
|
+
color: var(--dsw-alias-label-tertiary, #64748b);
|
|
803
|
+
flex: auto;
|
|
804
|
+
overflow: hidden;
|
|
805
|
+
}
|
|
806
|
+
.agy-tv-summary-err {
|
|
807
|
+
color: var(--dsw-alias-state-error-primary, #dc2626);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/* File link button */
|
|
811
|
+
.agy-tv-file-link {
|
|
812
|
+
text-overflow: ellipsis;
|
|
813
|
+
white-space: nowrap;
|
|
814
|
+
min-width: 0;
|
|
815
|
+
font: inherit;
|
|
816
|
+
text-align: left;
|
|
817
|
+
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
818
|
+
line-height: calc(24px + var(--dsh-content-font-delta, 0px));
|
|
819
|
+
color: var(--dsw-alias-label-secondary, #334155);
|
|
820
|
+
text-decoration: underline dotted;
|
|
821
|
+
text-decoration-color: var(--dsw-alias-label-tertiary, #64748b);
|
|
822
|
+
text-underline-offset: 3px;
|
|
823
|
+
cursor: pointer;
|
|
824
|
+
background: none;
|
|
825
|
+
border: none;
|
|
826
|
+
flex: 0 auto;
|
|
827
|
+
margin: 0;
|
|
828
|
+
padding: 0;
|
|
829
|
+
text-decoration-thickness: 1px;
|
|
830
|
+
overflow: hidden;
|
|
831
|
+
}
|
|
832
|
+
.agy-tv-file-link:hover {
|
|
833
|
+
color: var(--dsw-alias-label-primary, #0f172a);
|
|
834
|
+
text-decoration-color: currentColor;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/* Diff stat badge (+10 -2) */
|
|
838
|
+
.agy-tv-diff-stat {
|
|
839
|
+
font-family: var(--dsw-font-family-code, ui-monospace, monospace);
|
|
840
|
+
font-size: calc(var(--dsh-content-font-size-secondary, 13px) - 2px);
|
|
841
|
+
color: var(--dsw-alias-label-caption, #94a3b8);
|
|
842
|
+
margin-left: 10px;
|
|
843
|
+
flex: none;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/* Preview text */
|
|
847
|
+
.agy-tv-preview {
|
|
848
|
+
font-family: var(--dsw-font-family-code, ui-monospace, monospace);
|
|
849
|
+
font-size: 11px;
|
|
850
|
+
color: var(--dsw-alias-label-caption, #94a3b8);
|
|
851
|
+
margin-left: 8px;
|
|
852
|
+
overflow: hidden;
|
|
853
|
+
text-overflow: ellipsis;
|
|
854
|
+
white-space: nowrap;
|
|
855
|
+
max-width: 35%;
|
|
856
|
+
flex: none;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/* Body wrap */
|
|
860
|
+
.agy-tv-body-wrap {
|
|
861
|
+
display: flex;
|
|
862
|
+
flex-direction: column;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/* Card container */
|
|
866
|
+
.agy-tv-card {
|
|
867
|
+
border: 0.5px solid var(--dsw-alias-border-l1, #e2e8f0);
|
|
868
|
+
background: var(--dsw-alias-markdown-code-block, #f8fafc);
|
|
869
|
+
font-family: var(--dsw-font-family-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
|
|
870
|
+
font-size: 12px;
|
|
871
|
+
line-height: 1.55;
|
|
872
|
+
border-radius: 12px;
|
|
873
|
+
margin: 4px 0 4px 4px;
|
|
874
|
+
display: flex;
|
|
875
|
+
flex-direction: column;
|
|
876
|
+
overflow: hidden;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/* Card Header */
|
|
880
|
+
.agy-tv-card-header {
|
|
881
|
+
display: flex;
|
|
882
|
+
align-items: center;
|
|
883
|
+
justify-content: space-between;
|
|
884
|
+
gap: 12px;
|
|
885
|
+
padding: 8px 12px;
|
|
886
|
+
background: var(--dsw-alias-markdown-code-block-banner, rgba(0, 0, 0, 0.02));
|
|
887
|
+
border-bottom: 0.5px solid var(--dsw-alias-border-l2, #e2e8f0);
|
|
888
|
+
}
|
|
889
|
+
.agy-tv-card-header-left {
|
|
890
|
+
display: flex;
|
|
891
|
+
align-items: baseline;
|
|
892
|
+
gap: 8px;
|
|
893
|
+
min-width: 0;
|
|
894
|
+
flex: 1;
|
|
895
|
+
overflow: hidden;
|
|
896
|
+
}
|
|
897
|
+
.agy-tv-prompt-glyph {
|
|
898
|
+
color: var(--dsw-alias-label-caption, #94a3b8);
|
|
899
|
+
flex: none;
|
|
900
|
+
font-weight: 700;
|
|
901
|
+
}
|
|
902
|
+
.agy-tv-card-cwd {
|
|
903
|
+
color: var(--dsw-alias-label-tertiary, #64748b);
|
|
904
|
+
flex: none;
|
|
905
|
+
overflow: hidden;
|
|
906
|
+
text-overflow: ellipsis;
|
|
907
|
+
white-space: nowrap;
|
|
908
|
+
}
|
|
909
|
+
.agy-tv-card-cmd {
|
|
910
|
+
color: var(--dsw-alias-label-primary, #0f172a);
|
|
911
|
+
overflow: hidden;
|
|
912
|
+
text-overflow: ellipsis;
|
|
913
|
+
white-space: pre;
|
|
914
|
+
font-weight: 600;
|
|
915
|
+
}
|
|
916
|
+
.agy-tv-card-path {
|
|
917
|
+
color: var(--dsw-alias-label-primary, #0f172a);
|
|
918
|
+
font-weight: 600;
|
|
919
|
+
overflow: hidden;
|
|
920
|
+
text-overflow: ellipsis;
|
|
921
|
+
white-space: nowrap;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/* Copy button */
|
|
925
|
+
.agy-tv-copy-btn {
|
|
926
|
+
display: inline-flex;
|
|
927
|
+
align-items: center;
|
|
928
|
+
gap: 4px;
|
|
929
|
+
background: transparent;
|
|
930
|
+
border: none;
|
|
931
|
+
padding: 2px 6px;
|
|
932
|
+
margin: 0;
|
|
933
|
+
color: var(--dsw-alias-label-secondary, #334155);
|
|
934
|
+
cursor: pointer;
|
|
935
|
+
font-size: 11px;
|
|
936
|
+
line-height: 16px;
|
|
937
|
+
border-radius: 4px;
|
|
938
|
+
transition: background-color 0.1s ease, color 0.1s ease;
|
|
939
|
+
flex: none;
|
|
940
|
+
}
|
|
941
|
+
.agy-tv-copy-btn:hover {
|
|
942
|
+
background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.05));
|
|
943
|
+
color: var(--dsw-alias-label-primary, #0f172a);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/* Card scrollable content */
|
|
947
|
+
.agy-tv-card-content {
|
|
948
|
+
max-height: 260px;
|
|
949
|
+
overflow-y: auto;
|
|
950
|
+
overflow-x: auto;
|
|
951
|
+
padding: 10px 14px;
|
|
952
|
+
white-space: pre-wrap;
|
|
953
|
+
word-break: break-word;
|
|
954
|
+
color: var(--dsw-alias-label-secondary, #334155);
|
|
955
|
+
scrollbar-width: thin;
|
|
956
|
+
scrollbar-color: var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.2)) transparent;
|
|
957
|
+
}
|
|
958
|
+
.agy-tv-card-content::-webkit-scrollbar {
|
|
959
|
+
width: 6px;
|
|
960
|
+
height: 6px;
|
|
961
|
+
}
|
|
962
|
+
.agy-tv-card-content::-webkit-scrollbar-thumb {
|
|
963
|
+
background: var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.18));
|
|
964
|
+
border-radius: 6px;
|
|
965
|
+
background-clip: padding-box;
|
|
966
|
+
}
|
|
967
|
+
.agy-tv-card-content::-webkit-scrollbar-track {
|
|
968
|
+
background: transparent;
|
|
969
|
+
margin: 6px 0;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
/* Diff lines */
|
|
973
|
+
.agy-tv-diff-list {
|
|
974
|
+
display: flex;
|
|
975
|
+
flex-direction: column;
|
|
976
|
+
padding: 6px 0;
|
|
977
|
+
max-height: 280px;
|
|
978
|
+
overflow-y: auto;
|
|
979
|
+
overflow-x: auto;
|
|
980
|
+
scrollbar-width: thin;
|
|
981
|
+
scrollbar-color: var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.2)) transparent;
|
|
982
|
+
}
|
|
983
|
+
.agy-tv-diff-list::-webkit-scrollbar {
|
|
984
|
+
width: 6px;
|
|
985
|
+
height: 6px;
|
|
986
|
+
}
|
|
987
|
+
.agy-tv-diff-list::-webkit-scrollbar-thumb {
|
|
988
|
+
background: var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.18));
|
|
989
|
+
border-radius: 6px;
|
|
990
|
+
}
|
|
991
|
+
.agy-tv-diff-list::-webkit-scrollbar-track {
|
|
992
|
+
background: transparent;
|
|
993
|
+
margin: 4px 0;
|
|
994
|
+
}
|
|
995
|
+
.agy-tv-diff-line {
|
|
996
|
+
display: flex;
|
|
997
|
+
gap: 8px;
|
|
998
|
+
padding: 0 12px;
|
|
999
|
+
min-height: 20px;
|
|
1000
|
+
line-height: 20px;
|
|
1001
|
+
white-space: pre-wrap;
|
|
1002
|
+
word-break: break-word;
|
|
1003
|
+
}
|
|
1004
|
+
.agy-tv-diff-del {
|
|
1005
|
+
background: color-mix(in srgb, var(--dsw-alias-state-error-primary, #dc2626) 10%, transparent);
|
|
1006
|
+
color: var(--dsw-alias-state-error-primary, #dc2626);
|
|
1007
|
+
}
|
|
1008
|
+
.agy-tv-diff-add {
|
|
1009
|
+
background: color-mix(in srgb, var(--dsw-alias-state-success-primary, #059669) 10%, transparent);
|
|
1010
|
+
color: var(--dsw-alias-state-success-primary, #059669);
|
|
1011
|
+
}
|
|
1012
|
+
.agy-tv-diff-marker {
|
|
1013
|
+
flex: none;
|
|
1014
|
+
width: 14px;
|
|
1015
|
+
font-weight: 700;
|
|
1016
|
+
user-select: none;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/* Inspect button */
|
|
1020
|
+
.agy-tv-inspect-btn {
|
|
1021
|
+
border: 0.5px solid var(--dsw-alias-border-l3, #cbd5e1);
|
|
1022
|
+
background: var(--dsw-alias-bg-base, #ffffff);
|
|
1023
|
+
color: var(--dsw-alias-label-secondary, #334155);
|
|
1024
|
+
cursor: pointer;
|
|
1025
|
+
opacity: 0;
|
|
1026
|
+
border-radius: 999px;
|
|
1027
|
+
align-self: flex-start;
|
|
1028
|
+
align-items: center;
|
|
1029
|
+
gap: 4px;
|
|
1030
|
+
margin: 4px 0 2px 4px;
|
|
1031
|
+
padding: 2px 8px;
|
|
1032
|
+
font-size: 11px;
|
|
1033
|
+
line-height: 16px;
|
|
1034
|
+
transition: opacity 0.1s;
|
|
1035
|
+
display: inline-flex;
|
|
1036
|
+
}
|
|
1037
|
+
.agy-tv-root:hover .agy-tv-inspect-btn,
|
|
1038
|
+
.agy-tv-inspect-btn:focus-visible {
|
|
1039
|
+
opacity: 1;
|
|
1040
|
+
}
|
|
1041
|
+
.agy-tv-inspect-btn:hover {
|
|
1042
|
+
background: var(--dsw-alias-interactive-bg-hover-solid, #f1f5f9);
|
|
1043
|
+
color: var(--dsw-alias-label-primary, #0f172a);
|
|
1044
|
+
}
|
|
1045
|
+
`;
|
|
473
1046
|
const gDoc = globalThis.document;
|
|
474
1047
|
if (gDoc !== void 0 && gDoc !== null) {
|
|
475
1048
|
const styleId = "dsh-agy-link-toolview-css";
|
|
@@ -831,6 +1404,116 @@ window.__ModuleLoader__.load({
|
|
|
831
1404
|
"header.badgeTitle": "Antigravity: {count} cuentas listas · haga clic para abrir la consola"
|
|
832
1405
|
};
|
|
833
1406
|
//#endregion
|
|
1407
|
+
//#region src/client/reasoning.ts
|
|
1408
|
+
const REASONING_CSS = `
|
|
1409
|
+
/* Ensure thinking disclosure row hover effect works reliably across all builds */
|
|
1410
|
+
div[data-variant="think"] [data-disclosure-row]:hover [class*="iconIdle"],
|
|
1411
|
+
div[data-variant="think"] [class*="row"]:hover [class*="iconIdle"] {
|
|
1412
|
+
opacity: 0 !important;
|
|
1413
|
+
}
|
|
1414
|
+
div[data-variant="think"] [data-disclosure-row]:hover [class*="chevronHover"],
|
|
1415
|
+
div[data-variant="think"] [class*="row"]:hover [class*="chevronHover"] {
|
|
1416
|
+
opacity: 1 !important;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
/* Scrollable thinking body when content is long */
|
|
1420
|
+
div[data-variant="think"] [class*="thinkBody"] {
|
|
1421
|
+
max-height: 360px;
|
|
1422
|
+
overflow-y: auto;
|
|
1423
|
+
overflow-x: hidden;
|
|
1424
|
+
white-space: pre-wrap;
|
|
1425
|
+
word-break: break-word;
|
|
1426
|
+
padding-right: 8px;
|
|
1427
|
+
scrollbar-width: thin;
|
|
1428
|
+
scrollbar-color: var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.2)) transparent;
|
|
1429
|
+
}
|
|
1430
|
+
div[data-variant="think"] [class*="thinkBody"]::-webkit-scrollbar {
|
|
1431
|
+
width: 6px;
|
|
1432
|
+
height: 6px;
|
|
1433
|
+
}
|
|
1434
|
+
div[data-variant="think"] [class*="thinkBody"]::-webkit-scrollbar-thumb {
|
|
1435
|
+
background: var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.18));
|
|
1436
|
+
border-radius: 6px;
|
|
1437
|
+
background-clip: padding-box;
|
|
1438
|
+
}
|
|
1439
|
+
div[data-variant="think"] [class*="thinkBody"]::-webkit-scrollbar-track {
|
|
1440
|
+
background: transparent;
|
|
1441
|
+
margin: 4px 0;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
/* Tasteful metadata chip for [agy thinking turn · ...] banner */
|
|
1445
|
+
.agy-thought-banner {
|
|
1446
|
+
display: inline-block;
|
|
1447
|
+
font-size: 11px;
|
|
1448
|
+
line-height: 16px;
|
|
1449
|
+
padding: 1px 7px;
|
|
1450
|
+
margin-bottom: 6px;
|
|
1451
|
+
border-radius: 4px;
|
|
1452
|
+
color: var(--dsw-alias-label-tertiary, #64748b);
|
|
1453
|
+
background: var(--dsw-alias-bg-layer-3, rgba(0, 0, 0, 0.04));
|
|
1454
|
+
border: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.1));
|
|
1455
|
+
font-family: var(--dsw-font-family-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
|
|
1456
|
+
font-weight: 500;
|
|
1457
|
+
user-select: none;
|
|
1458
|
+
}
|
|
1459
|
+
`;
|
|
1460
|
+
function injectStyles() {
|
|
1461
|
+
if (typeof document === "undefined") return;
|
|
1462
|
+
const styleId = "dsh-agy-link-reasoning-css";
|
|
1463
|
+
if (document.getElementById(styleId) === null) {
|
|
1464
|
+
const st = document.createElement("style");
|
|
1465
|
+
st.id = styleId;
|
|
1466
|
+
st.textContent = REASONING_CSS;
|
|
1467
|
+
const host = document.head ?? document.documentElement;
|
|
1468
|
+
if (host) host.appendChild(st);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Cleanly format any `[agy thinking turn ...]` banner in `thinkBody`
|
|
1473
|
+
* into a styled metadata chip so the prose displays cleanly.
|
|
1474
|
+
*/
|
|
1475
|
+
function formatThinkingBody(thinkBodyEl) {
|
|
1476
|
+
if (thinkBodyEl.dataset.agyFormatted === "true") return;
|
|
1477
|
+
const text = thinkBodyEl.textContent ?? "";
|
|
1478
|
+
const match = text.match(/^\[agy thinking turn(?: · \d+ thinking tokens)?\]\s*/);
|
|
1479
|
+
if (!match) return;
|
|
1480
|
+
const bannerText = match[0].trim();
|
|
1481
|
+
const restText = text.slice(match[0].length);
|
|
1482
|
+
thinkBodyEl.dataset.agyFormatted = "true";
|
|
1483
|
+
thinkBodyEl.textContent = "";
|
|
1484
|
+
const bannerSpan = document.createElement("span");
|
|
1485
|
+
bannerSpan.className = "agy-thought-banner";
|
|
1486
|
+
bannerSpan.textContent = bannerText;
|
|
1487
|
+
thinkBodyEl.appendChild(bannerSpan);
|
|
1488
|
+
if (restText.length > 0) thinkBodyEl.appendChild(document.createTextNode("\n" + restText));
|
|
1489
|
+
}
|
|
1490
|
+
function scanThinkingBlocks() {
|
|
1491
|
+
if (typeof document === "undefined") return;
|
|
1492
|
+
const thinkBodies = document.querySelectorAll("div[data-variant=\"think\"] [class*=\"thinkBody\"]");
|
|
1493
|
+
for (let i = 0; i < thinkBodies.length; i++) {
|
|
1494
|
+
const body = thinkBodies[i];
|
|
1495
|
+
if (body) formatThinkingBody(body);
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
function installAutoExpandReasoning() {
|
|
1499
|
+
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
1500
|
+
injectStyles();
|
|
1501
|
+
const observer = new MutationObserver(() => {
|
|
1502
|
+
scanThinkingBlocks();
|
|
1503
|
+
});
|
|
1504
|
+
const setupObserver = () => {
|
|
1505
|
+
if (document.body) {
|
|
1506
|
+
observer.observe(document.body, {
|
|
1507
|
+
childList: true,
|
|
1508
|
+
subtree: true
|
|
1509
|
+
});
|
|
1510
|
+
scanThinkingBlocks();
|
|
1511
|
+
}
|
|
1512
|
+
};
|
|
1513
|
+
if (document.readyState === "loading") window.addEventListener("DOMContentLoaded", setupObserver, { once: true });
|
|
1514
|
+
else setupObserver();
|
|
1515
|
+
}
|
|
1516
|
+
//#endregion
|
|
834
1517
|
//#region src/client/index.ts
|
|
835
1518
|
const { createElement: h, useState, useEffect, useRef } = require("react");
|
|
836
1519
|
const reactDom = require("react-dom");
|
|
@@ -2466,6 +3149,7 @@ body.dark,
|
|
|
2466
3149
|
}, AgySettingsSection);
|
|
2467
3150
|
});
|
|
2468
3151
|
installAgyToolView(ctx);
|
|
3152
|
+
installAutoExpandReasoning();
|
|
2469
3153
|
}
|
|
2470
3154
|
//#endregion
|
|
2471
3155
|
exports.apply = apply;
|