@tonyclaw/agent-inspector 3.0.24 → 3.0.26

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.
Files changed (39) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{CompareDrawer-BC52FYwn.js → CompareDrawer-SZRUDQc9.js} +1 -1
  3. package/.output/public/assets/ProxyViewerContainer-BJvwOrSi.js +4234 -0
  4. package/.output/public/assets/{ReplayDialog-BcKsarKt.js → ReplayDialog-DgfmqiM3.js} +1 -1
  5. package/.output/public/assets/{RequestAnatomy-DR0uGpCj.js → RequestAnatomy-CS6c7Qfn.js} +1 -1
  6. package/.output/public/assets/{ResponseView-kxAAPfmn.js → ResponseView-C0Ri_5gm.js} +2 -2
  7. package/.output/public/assets/{StreamingChunkSequence-YQR0PjQj.js → StreamingChunkSequence-7dYcHWyZ.js} +1 -1
  8. package/.output/public/assets/{_sessionId-DRl-Y9om.js → _sessionId-D-V84cgw.js} +1 -1
  9. package/.output/public/assets/{index-CQbrc-hi.js → index-CSIL7-MK.js} +3 -3
  10. package/.output/public/assets/index-CmeF5XXS.css +1 -0
  11. package/.output/public/assets/{index-CcSIBI4L.js → index-DgFWCxOs.js} +1 -1
  12. package/.output/public/assets/{index-ZrMgyEZV.js → index-DrVJsks2.js} +1 -1
  13. package/.output/public/assets/{json-viewer-CS5pwnEA.js → json-viewer-C9Ji3gYN.js} +1 -1
  14. package/.output/server/_libs/lucide-react.mjs +245 -217
  15. package/.output/server/_libs/three.mjs +26016 -0
  16. package/.output/server/{_sessionId-BLk2xPkR.mjs → _sessionId-BQ6YQOO1.mjs} +7 -6
  17. package/.output/server/_ssr/{CompareDrawer-Cw7Dseo3.mjs → CompareDrawer-CqNzIeMR.mjs} +8 -7
  18. package/.output/server/_ssr/{ProxyViewerContainer-D8SB0zyQ.mjs → ProxyViewerContainer-CMC7Vsbw.mjs} +1164 -405
  19. package/.output/server/_ssr/{ReplayDialog-B-YMhZkE.mjs → ReplayDialog-D9p_LaTr.mjs} +9 -8
  20. package/.output/server/_ssr/{RequestAnatomy-a9d8UTYZ.mjs → RequestAnatomy-B4ge3qNZ.mjs} +8 -7
  21. package/.output/server/_ssr/{ResponseView-PzaZS4CN.mjs → ResponseView-BCqMKApI.mjs} +8 -7
  22. package/.output/server/_ssr/{StreamingChunkSequence-C21_TCXk.mjs → StreamingChunkSequence-BA4zTLE4.mjs} +8 -7
  23. package/.output/server/_ssr/{index-CrCeNP7H.mjs → index-CzxhDjlq.mjs} +7 -6
  24. package/.output/server/_ssr/index.mjs +2 -2
  25. package/.output/server/_ssr/{json-viewer-Di2gxs9H.mjs → json-viewer-B3qV6iEJ.mjs} +8 -7
  26. package/.output/server/_ssr/{router-BJzdUbcH.mjs → router-CZe_R31M.mjs} +4 -4
  27. package/.output/server/{_tanstack-start-manifest_v-CGBTdAYC.mjs → _tanstack-start-manifest_v-B50VTLrH.mjs} +1 -1
  28. package/.output/server/index.mjs +68 -68
  29. package/package.json +3 -1
  30. package/src/components/ProxyViewer.tsx +2 -280
  31. package/src/components/inspector-pet/InspectorPet.tsx +405 -0
  32. package/src/components/inspector-pet/InspectorPetCrab3D.tsx +455 -0
  33. package/src/components/inspector-pet/inspectorPetLogic.ts +258 -0
  34. package/src/components/providers/ProviderForm.tsx +238 -163
  35. package/src/components/providers/ProvidersPanel.tsx +16 -6
  36. package/src/components/providers/providerFormCapabilities.ts +36 -0
  37. package/styles/globals.css +64 -28
  38. package/.output/public/assets/ProxyViewerContainer-WuChOrSS.js +0 -127
  39. package/.output/public/assets/index-DQeXi4Rv.css +0 -1
@@ -1,8 +1,6 @@
1
1
  import {
2
2
  type ChangeEvent,
3
- type CSSProperties,
4
3
  type JSX,
5
- type PointerEvent as ReactPointerEvent,
6
4
  type ReactNode,
7
5
  useCallback,
8
6
  useEffect,
@@ -81,6 +79,7 @@ import { AlertsDialog } from "./alerts/AlertsDialog";
81
79
  import { GroupsDialog } from "./groups/GroupsDialog";
82
80
  import { SettingsDialog } from "./providers/SettingsDialog";
83
81
  import { AgentLabDialog } from "./ecosystem/AgentLabDialog";
82
+ import { InspectorPet } from "./inspector-pet/InspectorPet";
84
83
  import { PiAgentPanel } from "./pi-agent/PiAgentPanel";
85
84
  import { computeCacheTrends } from "./proxy-viewer/cacheTrend";
86
85
  import { LazyCompareDrawer } from "./proxy-viewer/lazy";
@@ -1056,25 +1055,6 @@ function BrandHeader({
1056
1055
  );
1057
1056
  }
1058
1057
 
1059
- type FloatingLogoPosition = {
1060
- x: number;
1061
- y: number;
1062
- };
1063
-
1064
- type FloatingLogoDragState = {
1065
- pointerId: number;
1066
- offsetX: number;
1067
- offsetY: number;
1068
- };
1069
-
1070
- type FloatingLogoEdge = "left" | "right" | "top" | "bottom";
1071
-
1072
- const FLOATING_LOGO_SIZE = 56;
1073
- const FLOATING_LOGO_MARGIN = 14;
1074
- const FLOATING_LOGO_MIN_DRIFT_MS = 5200;
1075
- const FLOATING_LOGO_DRIFT_WINDOW_MS = 2400;
1076
- const FLOATING_LOGO_MIN_STEP = 72;
1077
- const FLOATING_LOGO_MAX_STEP = 156;
1078
1058
  const DETAILS_PANEL_COLLAPSED_STORAGE_KEY = "agent-inspector.detailsPanelCollapsed";
1079
1059
 
1080
1060
  function readStoredDetailsPanelCollapsed(): boolean {
@@ -1083,264 +1063,6 @@ function readStoredDetailsPanelCollapsed(): boolean {
1083
1063
  return stored === null || stored === "1";
1084
1064
  }
1085
1065
 
1086
- function clampFloatingLogoPosition(position: FloatingLogoPosition): FloatingLogoPosition {
1087
- const maxX = Math.max(
1088
- FLOATING_LOGO_MARGIN,
1089
- window.innerWidth - FLOATING_LOGO_SIZE - FLOATING_LOGO_MARGIN,
1090
- );
1091
- const maxY = Math.max(
1092
- FLOATING_LOGO_MARGIN,
1093
- window.innerHeight - FLOATING_LOGO_SIZE - FLOATING_LOGO_MARGIN,
1094
- );
1095
- return {
1096
- x: Math.min(Math.max(position.x, FLOATING_LOGO_MARGIN), maxX),
1097
- y: Math.min(Math.max(position.y, FLOATING_LOGO_MARGIN), maxY),
1098
- };
1099
- }
1100
-
1101
- function snapFloatingLogoToEdge(position: FloatingLogoPosition): FloatingLogoPosition {
1102
- const clamped = clampFloatingLogoPosition(position);
1103
- const maxX = Math.max(
1104
- FLOATING_LOGO_MARGIN,
1105
- window.innerWidth - FLOATING_LOGO_SIZE - FLOATING_LOGO_MARGIN,
1106
- );
1107
- const maxY = Math.max(
1108
- FLOATING_LOGO_MARGIN,
1109
- window.innerHeight - FLOATING_LOGO_SIZE - FLOATING_LOGO_MARGIN,
1110
- );
1111
- const leftDistance = clamped.x - FLOATING_LOGO_MARGIN;
1112
- const rightDistance = maxX - clamped.x;
1113
- const topDistance = clamped.y - FLOATING_LOGO_MARGIN;
1114
- const bottomDistance = maxY - clamped.y;
1115
- const nearestDistance = Math.min(leftDistance, rightDistance, topDistance, bottomDistance);
1116
-
1117
- if (nearestDistance === leftDistance) return { x: FLOATING_LOGO_MARGIN, y: clamped.y };
1118
- if (nearestDistance === rightDistance) return { x: maxX, y: clamped.y };
1119
- if (nearestDistance === topDistance) return { x: clamped.x, y: FLOATING_LOGO_MARGIN };
1120
- return { x: clamped.x, y: maxY };
1121
- }
1122
-
1123
- function randomFloatingLogoEdgePosition(): FloatingLogoPosition {
1124
- const maxX = Math.max(
1125
- FLOATING_LOGO_MARGIN,
1126
- window.innerWidth - FLOATING_LOGO_SIZE - FLOATING_LOGO_MARGIN,
1127
- );
1128
- const maxY = Math.max(
1129
- FLOATING_LOGO_MARGIN,
1130
- window.innerHeight - FLOATING_LOGO_SIZE - FLOATING_LOGO_MARGIN,
1131
- );
1132
- const randomX = FLOATING_LOGO_MARGIN + Math.random() * (maxX - FLOATING_LOGO_MARGIN);
1133
- const randomY = FLOATING_LOGO_MARGIN + Math.random() * (maxY - FLOATING_LOGO_MARGIN);
1134
- const edgeIndex = Math.floor(Math.random() * 4);
1135
-
1136
- switch (edgeIndex) {
1137
- case 0:
1138
- return { x: FLOATING_LOGO_MARGIN, y: randomY };
1139
- case 1:
1140
- return { x: maxX, y: randomY };
1141
- case 2:
1142
- return { x: randomX, y: FLOATING_LOGO_MARGIN };
1143
- case 3:
1144
- return { x: randomX, y: maxY };
1145
- default:
1146
- return { x: maxX, y: FLOATING_LOGO_MARGIN };
1147
- }
1148
- }
1149
-
1150
- function nearestFloatingLogoEdge(position: FloatingLogoPosition): FloatingLogoEdge {
1151
- const clamped = clampFloatingLogoPosition(position);
1152
- const maxX = Math.max(
1153
- FLOATING_LOGO_MARGIN,
1154
- window.innerWidth - FLOATING_LOGO_SIZE - FLOATING_LOGO_MARGIN,
1155
- );
1156
- const maxY = Math.max(
1157
- FLOATING_LOGO_MARGIN,
1158
- window.innerHeight - FLOATING_LOGO_SIZE - FLOATING_LOGO_MARGIN,
1159
- );
1160
- const distances: { edge: FloatingLogoEdge; distance: number }[] = [
1161
- { edge: "left", distance: clamped.x - FLOATING_LOGO_MARGIN },
1162
- { edge: "right", distance: maxX - clamped.x },
1163
- { edge: "top", distance: clamped.y - FLOATING_LOGO_MARGIN },
1164
- { edge: "bottom", distance: maxY - clamped.y },
1165
- ];
1166
- return distances.reduce((best, current) => (current.distance < best.distance ? current : best))
1167
- .edge;
1168
- }
1169
-
1170
- function nextFloatingLogoWalkingPosition(position: FloatingLogoPosition): FloatingLogoPosition {
1171
- const clamped = snapFloatingLogoToEdge(position);
1172
- const maxX = Math.max(
1173
- FLOATING_LOGO_MARGIN,
1174
- window.innerWidth - FLOATING_LOGO_SIZE - FLOATING_LOGO_MARGIN,
1175
- );
1176
- const maxY = Math.max(
1177
- FLOATING_LOGO_MARGIN,
1178
- window.innerHeight - FLOATING_LOGO_SIZE - FLOATING_LOGO_MARGIN,
1179
- );
1180
- const step =
1181
- FLOATING_LOGO_MIN_STEP + Math.random() * (FLOATING_LOGO_MAX_STEP - FLOATING_LOGO_MIN_STEP);
1182
- const direction = Math.random() > 0.5 ? 1 : -1;
1183
- const edge = nearestFloatingLogoEdge(clamped);
1184
-
1185
- switch (edge) {
1186
- case "left": {
1187
- const nextY = clamped.y + step * direction;
1188
- if (nextY <= FLOATING_LOGO_MARGIN)
1189
- return { x: FLOATING_LOGO_MARGIN, y: FLOATING_LOGO_MARGIN };
1190
- if (nextY >= maxY) return { x: FLOATING_LOGO_MARGIN, y: maxY };
1191
- return { x: FLOATING_LOGO_MARGIN, y: nextY };
1192
- }
1193
- case "right": {
1194
- const nextY = clamped.y + step * direction;
1195
- if (nextY <= FLOATING_LOGO_MARGIN) return { x: maxX, y: FLOATING_LOGO_MARGIN };
1196
- if (nextY >= maxY) return { x: maxX, y: maxY };
1197
- return { x: maxX, y: nextY };
1198
- }
1199
- case "top": {
1200
- const nextX = clamped.x + step * direction;
1201
- if (nextX <= FLOATING_LOGO_MARGIN)
1202
- return { x: FLOATING_LOGO_MARGIN, y: FLOATING_LOGO_MARGIN };
1203
- if (nextX >= maxX) return { x: maxX, y: FLOATING_LOGO_MARGIN };
1204
- return { x: nextX, y: FLOATING_LOGO_MARGIN };
1205
- }
1206
- case "bottom": {
1207
- const nextX = clamped.x + step * direction;
1208
- if (nextX <= FLOATING_LOGO_MARGIN) return { x: FLOATING_LOGO_MARGIN, y: maxY };
1209
- if (nextX >= maxX) return { x: maxX, y: maxY };
1210
- return { x: nextX, y: maxY };
1211
- }
1212
- }
1213
- }
1214
-
1215
- function FloatingInspectorLogo(): JSX.Element {
1216
- const [position, setPosition] = useState<FloatingLogoPosition>({
1217
- x: FLOATING_LOGO_MARGIN,
1218
- y: FLOATING_LOGO_MARGIN,
1219
- });
1220
- const [motionTick, setMotionTick] = useState(0);
1221
- const [dragging, setDragging] = useState(false);
1222
- const dragStateRef = useRef<FloatingLogoDragState | null>(null);
1223
-
1224
- useEffect(() => {
1225
- setPosition(randomFloatingLogoEdgePosition());
1226
- }, []);
1227
-
1228
- useEffect(() => {
1229
- if (dragging) return undefined;
1230
- let timeoutId: number | null = null;
1231
-
1232
- const scheduleDrift = () => {
1233
- const delay = FLOATING_LOGO_MIN_DRIFT_MS + Math.random() * FLOATING_LOGO_DRIFT_WINDOW_MS;
1234
- timeoutId = window.setTimeout(() => {
1235
- setMotionTick((current) => current + 1);
1236
- setPosition((current) => nextFloatingLogoWalkingPosition(current));
1237
- scheduleDrift();
1238
- }, delay);
1239
- };
1240
-
1241
- scheduleDrift();
1242
- return () => {
1243
- if (timeoutId !== null) {
1244
- window.clearTimeout(timeoutId);
1245
- }
1246
- };
1247
- }, [dragging]);
1248
-
1249
- useEffect(() => {
1250
- const handleResize = () => {
1251
- setPosition((current) => snapFloatingLogoToEdge(current));
1252
- };
1253
- window.addEventListener("resize", handleResize);
1254
- return () => window.removeEventListener("resize", handleResize);
1255
- }, []);
1256
-
1257
- const handlePointerDown = useCallback((event: ReactPointerEvent<HTMLButtonElement>) => {
1258
- const rect = event.currentTarget.getBoundingClientRect();
1259
- dragStateRef.current = {
1260
- pointerId: event.pointerId,
1261
- offsetX: event.clientX - rect.left,
1262
- offsetY: event.clientY - rect.top,
1263
- };
1264
- event.currentTarget.setPointerCapture(event.pointerId);
1265
- setDragging(true);
1266
- }, []);
1267
-
1268
- const handlePointerMove = useCallback((event: ReactPointerEvent<HTMLButtonElement>) => {
1269
- const dragState = dragStateRef.current;
1270
- if (dragState === null || dragState.pointerId !== event.pointerId) return;
1271
- setPosition(
1272
- clampFloatingLogoPosition({
1273
- x: event.clientX - dragState.offsetX,
1274
- y: event.clientY - dragState.offsetY,
1275
- }),
1276
- );
1277
- }, []);
1278
-
1279
- const handlePointerUp = useCallback((event: ReactPointerEvent<HTMLButtonElement>) => {
1280
- const dragState = dragStateRef.current;
1281
- if (dragState === null || dragState.pointerId !== event.pointerId) return;
1282
- if (event.currentTarget.hasPointerCapture(event.pointerId)) {
1283
- event.currentTarget.releasePointerCapture(event.pointerId);
1284
- }
1285
- dragStateRef.current = null;
1286
- setDragging(false);
1287
- setPosition((current) => snapFloatingLogoToEdge(current));
1288
- }, []);
1289
-
1290
- const style = useMemo<CSSProperties>(
1291
- () => ({
1292
- transform: `translate3d(${position.x}px, ${position.y}px, 0) rotate(${
1293
- motionTick % 2 === 0 ? "-4deg" : "5deg"
1294
- }) scale(${dragging ? "1.08" : "1"})`,
1295
- transition: dragging ? "none" : "transform 4800ms cubic-bezier(0.33, 1, 0.68, 1)",
1296
- touchAction: "none",
1297
- }),
1298
- [dragging, motionTick, position.x, position.y],
1299
- );
1300
-
1301
- return (
1302
- <button
1303
- type="button"
1304
- className={cn(
1305
- "fixed left-0 top-0 z-40 flex size-14 items-center justify-center rounded-full bg-transparent text-foreground outline-none transition-[filter,opacity] duration-200 hover:opacity-95 hover:drop-shadow-[0_0_24px_rgba(245,158,11,0.36)] focus-visible:ring-1 focus-visible:ring-amber-300/55",
1306
- dragging ? "cursor-grabbing" : "cursor-grab",
1307
- )}
1308
- style={style}
1309
- onPointerDown={handlePointerDown}
1310
- onPointerMove={handlePointerMove}
1311
- onPointerUp={handlePointerUp}
1312
- onPointerCancel={handlePointerUp}
1313
- aria-label="Floating Inspector logo"
1314
- title="Drag Inspector logo"
1315
- >
1316
- <span
1317
- className={cn(
1318
- "relative flex size-12 items-center justify-center",
1319
- !dragging && "floating-crab-body",
1320
- )}
1321
- aria-hidden="true"
1322
- >
1323
- <CrabLogo className="relative z-10 size-11 text-amber-500 drop-shadow-[0_0_15px_rgba(245,158,11,0.30)]" />
1324
- <span className="pointer-events-none absolute inset-x-0 bottom-0 z-0 flex items-end justify-center gap-1 text-amber-400/80">
1325
- {[0, 1, 2, 3, 4, 5].map((leg) => (
1326
- <span
1327
- key={leg}
1328
- className={cn(
1329
- "floating-crab-leg h-2 w-0.5 rounded-full bg-current shadow-[0_0_7px_rgba(245,158,11,0.24)]",
1330
- leg < 3 ? "floating-crab-leg-left" : "floating-crab-leg-right",
1331
- dragging && "animate-none",
1332
- )}
1333
- style={{
1334
- animationDelay: `${leg % 2 === 0 ? 0 : 180}ms`,
1335
- }}
1336
- />
1337
- ))}
1338
- </span>
1339
- </span>
1340
- </button>
1341
- );
1342
- }
1343
-
1344
1066
  function SessionContextLogButton({ label, logId }: { label: string; logId: number }): JSX.Element {
1345
1067
  return (
1346
1068
  <button
@@ -2019,7 +1741,7 @@ export function ProxyViewer({
2019
1741
  <PanelRightClose className="size-3.5" />
2020
1742
  )}
2021
1743
  </button>
2022
- {detailsPanelCollapsed && <FloatingInspectorLogo />}
1744
+ {detailsPanelCollapsed && <InspectorPet logs={logs} />}
2023
1745
  <div
2024
1746
  className={cn(
2025
1747
  "grid w-full min-w-0 grid-cols-1 lg:min-h-0 lg:flex-1 lg:overflow-hidden",