@tonyclaw/agent-inspector 2.0.0
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/.output/cli.js +1611 -0
- package/.output/nitro.json +17 -0
- package/.output/public/assets/CompareDrawer-CU5ZrWcL.js +1 -0
- package/.output/public/assets/ProxyViewerContainer-pEBqVp1d.js +101 -0
- package/.output/public/assets/ReplayDialog-F58yNg5j.js +1 -0
- package/.output/public/assets/RequestAnatomy-C9lT0qE_.js +1 -0
- package/.output/public/assets/ResponseView-DHJq6bnz.js +1 -0
- package/.output/public/assets/StreamingChunkSequence-BTgfpFUT.js +1 -0
- package/.output/public/assets/_sessionId-DsNRbnNm.js +1 -0
- package/.output/public/assets/alibaba-TTwafVwX.svg +1 -0
- package/.output/public/assets/index-CpWG2hFn.css +1 -0
- package/.output/public/assets/index-DmBV8Gve.js +1 -0
- package/.output/public/assets/json-viewer-CZVYLR8j.js +14 -0
- package/.output/public/assets/main-DHs7FBK3.js +18 -0
- package/.output/public/assets/minimax-BPMzvuL-.jpeg +0 -0
- package/.output/public/assets/qwen-CONDcHqt.png +0 -0
- package/.output/public/assets/zhipuai-BPNAnxo-.svg +219 -0
- package/.output/server/_chunks/ssr-renderer.mjs +22 -0
- package/.output/server/_libs/@radix-ui/react-accessible-icon+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +210 -0
- package/.output/server/_libs/@radix-ui/react-navigation-menu+[...].mjs +2 -0
- package/.output/server/_libs/@radix-ui/react-one-time-password-field+[...].mjs +2 -0
- package/.output/server/_libs/@radix-ui/react-password-toggle-field+[...].mjs +2 -0
- package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +11 -0
- package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +69 -0
- package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-use-escape-keydown+[...].mjs +17 -0
- package/.output/server/_libs/@radix-ui/react-use-is-hydrated+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +6 -0
- package/.output/server/_libs/@radix-ui/react-visually-hidden+[...].mjs +34 -0
- package/.output/server/_libs/ajv-formats.mjs +330 -0
- package/.output/server/_libs/ajv.mjs +11444 -0
- package/.output/server/_libs/aria-hidden.mjs +122 -0
- package/.output/server/_libs/atomically.mjs +152 -0
- package/.output/server/_libs/bail.mjs +8 -0
- package/.output/server/_libs/cfworker__json-schema.mjs +1 -0
- package/.output/server/_libs/character-entities.mjs +2130 -0
- package/.output/server/_libs/class-variance-authority.mjs +44 -0
- package/.output/server/_libs/clsx.mjs +16 -0
- package/.output/server/_libs/comma-separated-tokens.mjs +10 -0
- package/.output/server/_libs/conf.mjs +635 -0
- package/.output/server/_libs/cookie-es.mjs +58 -0
- package/.output/server/_libs/core-util-is.mjs +75 -0
- package/.output/server/_libs/croner.mjs +1 -0
- package/.output/server/_libs/crossws.mjs +1 -0
- package/.output/server/_libs/debounce-fn.mjs +69 -0
- package/.output/server/_libs/decode-named-character-reference+[...].mjs +8 -0
- package/.output/server/_libs/dequal.mjs +27 -0
- package/.output/server/_libs/detect-node-es.mjs +1 -0
- package/.output/server/_libs/devlop.mjs +8 -0
- package/.output/server/_libs/diff.mjs +320 -0
- package/.output/server/_libs/dot-prop.mjs +265 -0
- package/.output/server/_libs/env-paths.mjs +57 -0
- package/.output/server/_libs/estree-util-is-identifier-name.mjs +11 -0
- package/.output/server/_libs/extend.mjs +97 -0
- package/.output/server/_libs/fast-deep-equal.mjs +38 -0
- package/.output/server/_libs/fast-uri.mjs +812 -0
- package/.output/server/_libs/floating-ui__core.mjs +725 -0
- package/.output/server/_libs/floating-ui__dom.mjs +622 -0
- package/.output/server/_libs/floating-ui__react-dom.mjs +292 -0
- package/.output/server/_libs/floating-ui__utils.mjs +320 -0
- package/.output/server/_libs/get-nonce.mjs +9 -0
- package/.output/server/_libs/h3-v2.mjs +276 -0
- package/.output/server/_libs/h3.mjs +408 -0
- package/.output/server/_libs/hast-util-to-jsx-runtime.mjs +388 -0
- package/.output/server/_libs/hast-util-whitespace.mjs +10 -0
- package/.output/server/_libs/hookable.mjs +1 -0
- package/.output/server/_libs/html-url-attributes.mjs +26 -0
- package/.output/server/_libs/immediate.mjs +74 -0
- package/.output/server/_libs/inherits.mjs +50 -0
- package/.output/server/_libs/inline-style-parser.mjs +142 -0
- package/.output/server/_libs/is-plain-obj.mjs +10 -0
- package/.output/server/_libs/isarray.mjs +14 -0
- package/.output/server/_libs/isbot.mjs +20 -0
- package/.output/server/_libs/json-schema-traverse.mjs +180 -0
- package/.output/server/_libs/jszip.mjs +3051 -0
- package/.output/server/_libs/lie.mjs +273 -0
- package/.output/server/_libs/lucide-react.mjs +492 -0
- package/.output/server/_libs/mdast-util-from-markdown.mjs +717 -0
- package/.output/server/_libs/mdast-util-to-hast.mjs +710 -0
- package/.output/server/_libs/mdast-util-to-string.mjs +38 -0
- package/.output/server/_libs/micromark-core-commonmark.mjs +2259 -0
- package/.output/server/_libs/micromark-factory-destination.mjs +94 -0
- package/.output/server/_libs/micromark-factory-label.mjs +63 -0
- package/.output/server/_libs/micromark-factory-space.mjs +24 -0
- package/.output/server/_libs/micromark-factory-title.mjs +65 -0
- package/.output/server/_libs/micromark-factory-whitespace.mjs +22 -0
- package/.output/server/_libs/micromark-util-character.mjs +44 -0
- package/.output/server/_libs/micromark-util-chunked.mjs +36 -0
- package/.output/server/_libs/micromark-util-classify-character+[...].mjs +12 -0
- package/.output/server/_libs/micromark-util-combine-extensions+[...].mjs +41 -0
- package/.output/server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +19 -0
- package/.output/server/_libs/micromark-util-decode-string.mjs +21 -0
- package/.output/server/_libs/micromark-util-encode.mjs +1 -0
- package/.output/server/_libs/micromark-util-html-tag-name.mjs +69 -0
- package/.output/server/_libs/micromark-util-normalize-identifier+[...].mjs +6 -0
- package/.output/server/_libs/micromark-util-resolve-all.mjs +15 -0
- package/.output/server/_libs/micromark-util-sanitize-uri.mjs +41 -0
- package/.output/server/_libs/micromark-util-subtokenize.mjs +346 -0
- package/.output/server/_libs/micromark.mjs +906 -0
- package/.output/server/_libs/mimic-function.mjs +47 -0
- package/.output/server/_libs/modelcontextprotocol__server.mjs +9738 -0
- package/.output/server/_libs/ocache.mjs +1 -0
- package/.output/server/_libs/ohash.mjs +1 -0
- package/.output/server/_libs/pako.mjs +4223 -0
- package/.output/server/_libs/process-nextick-args.mjs +48 -0
- package/.output/server/_libs/property-information.mjs +1209 -0
- package/.output/server/_libs/radix-ui.mjs +1 -0
- package/.output/server/_libs/radix-ui__number.mjs +6 -0
- package/.output/server/_libs/radix-ui__primitive.mjs +11 -0
- package/.output/server/_libs/radix-ui__react-accordion.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-alert-dialog.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-arrow.mjs +23 -0
- package/.output/server/_libs/radix-ui__react-aspect-ratio.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-avatar.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-checkbox.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-collapsible.mjs +144 -0
- package/.output/server/_libs/radix-ui__react-collection.mjs +69 -0
- package/.output/server/_libs/radix-ui__react-compose-refs.mjs +39 -0
- package/.output/server/_libs/radix-ui__react-context-menu.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-context.mjs +78 -0
- package/.output/server/_libs/radix-ui__react-dialog.mjs +325 -0
- package/.output/server/_libs/radix-ui__react-direction.mjs +9 -0
- package/.output/server/_libs/radix-ui__react-dropdown-menu.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-focus-guards.mjs +29 -0
- package/.output/server/_libs/radix-ui__react-focus-scope.mjs +206 -0
- package/.output/server/_libs/radix-ui__react-form.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-hover-card.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-id.mjs +14 -0
- package/.output/server/_libs/radix-ui__react-label.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-menu.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-menubar.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-popover.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-popper.mjs +286 -0
- package/.output/server/_libs/radix-ui__react-portal.mjs +16 -0
- package/.output/server/_libs/radix-ui__react-presence.mjs +128 -0
- package/.output/server/_libs/radix-ui__react-primitive.mjs +42 -0
- package/.output/server/_libs/radix-ui__react-progress.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-radio-group.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-roving-focus.mjs +224 -0
- package/.output/server/_libs/radix-ui__react-scroll-area.mjs +721 -0
- package/.output/server/_libs/radix-ui__react-select.mjs +1163 -0
- package/.output/server/_libs/radix-ui__react-separator.mjs +28 -0
- package/.output/server/_libs/radix-ui__react-slider.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-slot.mjs +99 -0
- package/.output/server/_libs/radix-ui__react-switch.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-tabs.mjs +189 -0
- package/.output/server/_libs/radix-ui__react-toast.mjs +2 -0
- package/.output/server/_libs/radix-ui__react-toggle-group.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-toggle.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-toolbar.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-tooltip.mjs +495 -0
- package/.output/server/_libs/radix-ui__react-use-previous.mjs +14 -0
- package/.output/server/_libs/radix-ui__react-use-size.mjs +39 -0
- package/.output/server/_libs/react-dom.mjs +10781 -0
- package/.output/server/_libs/react-markdown.mjs +147 -0
- package/.output/server/_libs/react-remove-scroll-bar.mjs +82 -0
- package/.output/server/_libs/react-remove-scroll.mjs +328 -0
- package/.output/server/_libs/react-style-singleton.mjs +69 -0
- package/.output/server/_libs/react.mjs +515 -0
- package/.output/server/_libs/readable-stream.mjs +1518 -0
- package/.output/server/_libs/remark-parse.mjs +19 -0
- package/.output/server/_libs/remark-rehype.mjs +21 -0
- package/.output/server/_libs/rou3.mjs +14 -0
- package/.output/server/_libs/safe-buffer.mjs +64 -0
- package/.output/server/_libs/semver.mjs +1938 -0
- package/.output/server/_libs/seroval-plugins.mjs +58 -0
- package/.output/server/_libs/seroval.mjs +1765 -0
- package/.output/server/_libs/setimmediate.mjs +152 -0
- package/.output/server/_libs/space-separated-tokens.mjs +6 -0
- package/.output/server/_libs/srvx.mjs +1029 -0
- package/.output/server/_libs/stubborn-fs.mjs +91 -0
- package/.output/server/_libs/stubborn-utils.mjs +66 -0
- package/.output/server/_libs/style-to-js.mjs +72 -0
- package/.output/server/_libs/style-to-object.mjs +38 -0
- package/.output/server/_libs/swr.mjs +939 -0
- package/.output/server/_libs/tailwind-merge.mjs +3010 -0
- package/.output/server/_libs/tanstack__history.mjs +217 -0
- package/.output/server/_libs/tanstack__react-router.mjs +1480 -0
- package/.output/server/_libs/tanstack__react-store.mjs +1 -0
- package/.output/server/_libs/tanstack__react-virtual.mjs +44 -0
- package/.output/server/_libs/tanstack__router-core.mjs +4827 -0
- package/.output/server/_libs/tanstack__store.mjs +1 -0
- package/.output/server/_libs/tanstack__virtual-core.mjs +1225 -0
- package/.output/server/_libs/tiny-invariant.mjs +12 -0
- package/.output/server/_libs/tiny-warning.mjs +5 -0
- package/.output/server/_libs/trim-lines.mjs +41 -0
- package/.output/server/_libs/trough.mjs +85 -0
- package/.output/server/_libs/tslib.mjs +1 -0
- package/.output/server/_libs/ufo.mjs +54 -0
- package/.output/server/_libs/uint8array-extras.mjs +69 -0
- package/.output/server/_libs/ungap__structured-clone.mjs +212 -0
- package/.output/server/_libs/unified.mjs +661 -0
- package/.output/server/_libs/unist-util-is.mjs +100 -0
- package/.output/server/_libs/unist-util-position.mjs +27 -0
- package/.output/server/_libs/unist-util-stringify-position.mjs +27 -0
- package/.output/server/_libs/unist-util-visit-parents.mjs +82 -0
- package/.output/server/_libs/unist-util-visit.mjs +24 -0
- package/.output/server/_libs/unstorage.mjs +1 -0
- package/.output/server/_libs/use-callback-ref.mjs +66 -0
- package/.output/server/_libs/use-sidecar.mjs +106 -0
- package/.output/server/_libs/use-sync-external-store.mjs +64 -0
- package/.output/server/_libs/util-deprecate.mjs +12 -0
- package/.output/server/_libs/vfile-message.mjs +138 -0
- package/.output/server/_libs/vfile.mjs +467 -0
- package/.output/server/_libs/when-exit.mjs +53 -0
- package/.output/server/_libs/zod.mjs +4524 -0
- package/.output/server/_sessionId-wMLPvC5g.mjs +123 -0
- package/.output/server/_ssr/CompareDrawer-BU4V0uVf.mjs +1041 -0
- package/.output/server/_ssr/ProxyViewerContainer-BnRwFEnn.mjs +5972 -0
- package/.output/server/_ssr/ReplayDialog-C7dn9pd_.mjs +322 -0
- package/.output/server/_ssr/RequestAnatomy-C1rWpe9-.mjs +353 -0
- package/.output/server/_ssr/ResponseView-hGpPaYsf.mjs +602 -0
- package/.output/server/_ssr/StreamingChunkSequence-BRWI1r_G.mjs +302 -0
- package/.output/server/_ssr/index-BKURLVPz.mjs +118 -0
- package/.output/server/_ssr/index.mjs +1184 -0
- package/.output/server/_ssr/json-viewer-BBd2DtQP.mjs +515 -0
- package/.output/server/_ssr/router-BcZ0D6AB.mjs +6317 -0
- package/.output/server/_ssr/start-HYkvq4Ni.mjs +4 -0
- package/.output/server/_tanstack-start-manifest_v-1y8ZVxRI.mjs +4 -0
- package/.output/server/index.mjs +436 -0
- package/.output/server/node_modules/tslib/modules/index.js +70 -0
- package/.output/server/node_modules/tslib/modules/package.json +3 -0
- package/.output/server/node_modules/tslib/package.json +47 -0
- package/.output/server/node_modules/tslib/tslib.js +484 -0
- package/.output/server/package.json +9 -0
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/package.json +110 -0
- package/src/assets/favicon.svg +31 -0
- package/src/assets/logos/alibaba.svg +1 -0
- package/src/assets/logos/anthropic.svg +1 -0
- package/src/assets/logos/claude-code.svg +4 -0
- package/src/assets/logos/deepseek.svg +1 -0
- package/src/assets/logos/mcp.png +0 -0
- package/src/assets/logos/minimax.jpeg +0 -0
- package/src/assets/logos/openai.svg +1 -0
- package/src/assets/logos/opencode.svg +4 -0
- package/src/assets/logos/qwen.png +0 -0
- package/src/assets/logos/zhipuai.svg +219 -0
- package/src/cli/detect-tools.ts +147 -0
- package/src/cli/doctor.ts +521 -0
- package/src/cli/onboard.ts +224 -0
- package/src/cli/templates/command-onboard.ts +17 -0
- package/src/cli/templates/skill-onboard.ts +547 -0
- package/src/cli.ts +345 -0
- package/src/components/OnboardingBanner.tsx +67 -0
- package/src/components/ProxyViewer.tsx +545 -0
- package/src/components/ProxyViewerContainer.tsx +363 -0
- package/src/components/providers/ImportWizardDialog.tsx +349 -0
- package/src/components/providers/ProviderCard.tsx +474 -0
- package/src/components/providers/ProviderForm.tsx +494 -0
- package/src/components/providers/ProviderLogo.tsx +117 -0
- package/src/components/providers/ProvidersPanel.tsx +619 -0
- package/src/components/providers/SettingsDialog.tsx +202 -0
- package/src/components/proxy-viewer/CompareDrawer.tsx +893 -0
- package/src/components/proxy-viewer/ConversationGroup.tsx +107 -0
- package/src/components/proxy-viewer/ConversationHeader.tsx +300 -0
- package/src/components/proxy-viewer/LogEntry.tsx +543 -0
- package/src/components/proxy-viewer/LogEntryHeader.tsx +501 -0
- package/src/components/proxy-viewer/ReplayDialog.tsx +218 -0
- package/src/components/proxy-viewer/ResponseView.tsx +171 -0
- package/src/components/proxy-viewer/StreamingChunkSequence.tsx +188 -0
- package/src/components/proxy-viewer/ThreadConnector.tsx +136 -0
- package/src/components/proxy-viewer/TurnGroup.tsx +337 -0
- package/src/components/proxy-viewer/anatomy/RequestAnatomy.tsx +98 -0
- package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +196 -0
- package/src/components/proxy-viewer/anatomy/tokenEstimate.ts +53 -0
- package/src/components/proxy-viewer/anatomy/types.ts +39 -0
- package/src/components/proxy-viewer/anatomy/useAnatomyJump.ts +114 -0
- package/src/components/proxy-viewer/cacheTrend.ts +50 -0
- package/src/components/proxy-viewer/diff/DiffView.tsx +321 -0
- package/src/components/proxy-viewer/diff/computeDiff.ts +178 -0
- package/src/components/proxy-viewer/diff/index.ts +3 -0
- package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +157 -0
- package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +66 -0
- package/src/components/proxy-viewer/formats/anthropic/thinkingExtract.ts +21 -0
- package/src/components/proxy-viewer/formats/index.tsx +33 -0
- package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +170 -0
- package/src/components/proxy-viewer/index.ts +9 -0
- package/src/components/proxy-viewer/lazy.ts +37 -0
- package/src/components/proxy-viewer/log-formats/anthropic.ts +194 -0
- package/src/components/proxy-viewer/log-formats/index.ts +23 -0
- package/src/components/proxy-viewer/log-formats/openai.ts +167 -0
- package/src/components/proxy-viewer/log-formats/types.ts +40 -0
- package/src/components/proxy-viewer/log-formats/unknown.ts +18 -0
- package/src/components/proxy-viewer/logEntryVisibility.ts +39 -0
- package/src/components/proxy-viewer/requestDiff.ts +277 -0
- package/src/components/proxy-viewer/useCopyFeedback.ts +36 -0
- package/src/components/proxy-viewer/useKeyboardNavigation.ts +190 -0
- package/src/components/proxy-viewer/viewerState.ts +66 -0
- package/src/components/ui/badge.tsx +47 -0
- package/src/components/ui/button.tsx +47 -0
- package/src/components/ui/collapsible.tsx +21 -0
- package/src/components/ui/confirm-dialog.tsx +51 -0
- package/src/components/ui/crab-logo.tsx +95 -0
- package/src/components/ui/crab-variants.tsx +467 -0
- package/src/components/ui/dialog.tsx +129 -0
- package/src/components/ui/json-expansion-button.tsx +56 -0
- package/src/components/ui/json-viewer-bulk.ts +97 -0
- package/src/components/ui/json-viewer.tsx +494 -0
- package/src/components/ui/mcp-logo.tsx +20 -0
- package/src/components/ui/scroll-area.tsx +54 -0
- package/src/components/ui/select.tsx +178 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/tabs.tsx +88 -0
- package/src/components/ui/tooltip.tsx +51 -0
- package/src/index.css +11 -0
- package/src/knowledge/candidateStore.ts +63 -0
- package/src/knowledge/distiller.ts +98 -0
- package/src/knowledge/openclawClient.ts +118 -0
- package/src/knowledge/redactor.ts +80 -0
- package/src/knowledge/types.ts +84 -0
- package/src/lib/apiClient.ts +49 -0
- package/src/lib/export-logs.ts +51 -0
- package/src/lib/mask.ts +4 -0
- package/src/lib/objectUtils.ts +22 -0
- package/src/lib/providerContract.ts +26 -0
- package/src/lib/providerTestContract.ts +107 -0
- package/src/lib/runtimeConfig.ts +25 -0
- package/src/lib/serverPort.ts +41 -0
- package/src/lib/sessionUrl.ts +44 -0
- package/src/lib/stopReason.ts +58 -0
- package/src/lib/useOnboarding.ts +80 -0
- package/src/lib/useProviders.ts +30 -0
- package/src/lib/useStripConfig.ts +108 -0
- package/src/lib/utils.ts +21 -0
- package/src/mcp/loopback.ts +76 -0
- package/src/mcp/previewExtractor.ts +166 -0
- package/src/mcp/server.ts +396 -0
- package/src/mcp/toolHandlers.ts +341 -0
- package/src/proxy/chunkStorage.ts +112 -0
- package/src/proxy/claudeCodeStrip.ts +99 -0
- package/src/proxy/config.ts +172 -0
- package/src/proxy/constants.ts +47 -0
- package/src/proxy/dataDir.ts +86 -0
- package/src/proxy/formats/anthropic/anthropicProvider.ts +75 -0
- package/src/proxy/formats/anthropic/handler.ts +71 -0
- package/src/proxy/formats/anthropic/index.ts +14 -0
- package/src/proxy/formats/anthropic/register.ts +4 -0
- package/src/proxy/formats/anthropic/schemas.ts +237 -0
- package/src/proxy/formats/anthropic/stream.ts +205 -0
- package/src/proxy/formats/handler.ts +46 -0
- package/src/proxy/formats/index.ts +12 -0
- package/src/proxy/formats/jsonSchema.ts +36 -0
- package/src/proxy/formats/openai/alibabaProvider.ts +38 -0
- package/src/proxy/formats/openai/handler.ts +96 -0
- package/src/proxy/formats/openai/index.ts +25 -0
- package/src/proxy/formats/openai/provider.ts +50 -0
- package/src/proxy/formats/openai/register.ts +4 -0
- package/src/proxy/formats/openai/schemas.ts +187 -0
- package/src/proxy/formats/openai/stream.ts +206 -0
- package/src/proxy/formats/protocol.ts +50 -0
- package/src/proxy/formats/providerRegistry.ts +51 -0
- package/src/proxy/formats/providers/index.ts +3 -0
- package/src/proxy/formats/registry.ts +66 -0
- package/src/proxy/handler.ts +334 -0
- package/src/proxy/logFinalizer.ts +305 -0
- package/src/proxy/logFinalizer.worker.ts +24 -0
- package/src/proxy/logIndex.ts +268 -0
- package/src/proxy/logger.ts +179 -0
- package/src/proxy/openaiOrphanToolStrip.ts +142 -0
- package/src/proxy/providerImporters.ts +491 -0
- package/src/proxy/providers.ts +613 -0
- package/src/proxy/schemas.ts +209 -0
- package/src/proxy/sessionProcess.ts +140 -0
- package/src/proxy/sessionRuntime.ts +85 -0
- package/src/proxy/sessionSupervisor.ts +283 -0
- package/src/proxy/sessionWorkerEntry.ts +26 -0
- package/src/proxy/socketTracker.ts +255 -0
- package/src/proxy/store.ts +412 -0
- package/src/proxy/upstream.ts +90 -0
- package/src/router.tsx +16 -0
- package/src/routes/__root.tsx +45 -0
- package/src/routes/api/config.paths.ts +14 -0
- package/src/routes/api/config.ts +53 -0
- package/src/routes/api/health.ts +15 -0
- package/src/routes/api/knowledge.candidates.$candidateId.promote.ts +32 -0
- package/src/routes/api/knowledge.candidates.ts +10 -0
- package/src/routes/api/knowledge.project-context.ts +18 -0
- package/src/routes/api/knowledge.search.ts +31 -0
- package/src/routes/api/knowledge.sessions.$sessionId.candidates.ts +16 -0
- package/src/routes/api/logs.$id.chunks.ts +36 -0
- package/src/routes/api/logs.$id.replay.ts +191 -0
- package/src/routes/api/logs.$id.ts +22 -0
- package/src/routes/api/logs.stream.ts +74 -0
- package/src/routes/api/logs.ts +59 -0
- package/src/routes/api/mcp.ts +25 -0
- package/src/routes/api/models.ts +10 -0
- package/src/routes/api/providers.$providerId.test.log.ts +293 -0
- package/src/routes/api/providers.$providerId.ts +50 -0
- package/src/routes/api/providers.export.ts +26 -0
- package/src/routes/api/providers.import.ts +47 -0
- package/src/routes/api/providers.scan.ts +23 -0
- package/src/routes/api/providers.ts +45 -0
- package/src/routes/api/sessions.ts +17 -0
- package/src/routes/index.tsx +6 -0
- package/src/routes/proxy/$.ts +15 -0
- package/src/routes/session/$sessionId.tsx +23 -0
- package/styles/globals.css +188 -0
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AlertTriangle,
|
|
3
|
+
ArrowDown,
|
|
4
|
+
ArrowUp,
|
|
5
|
+
Check,
|
|
6
|
+
ChevronDown,
|
|
7
|
+
ChevronRight,
|
|
8
|
+
ChevronsDown,
|
|
9
|
+
ChevronsUp,
|
|
10
|
+
Clock,
|
|
11
|
+
Copy,
|
|
12
|
+
FileDiff,
|
|
13
|
+
FileTerminal,
|
|
14
|
+
Globe,
|
|
15
|
+
History,
|
|
16
|
+
Loader2,
|
|
17
|
+
MessageSquare,
|
|
18
|
+
OctagonAlert,
|
|
19
|
+
Radio,
|
|
20
|
+
RotateCcw,
|
|
21
|
+
Wrench,
|
|
22
|
+
Zap,
|
|
23
|
+
} from "lucide-react";
|
|
24
|
+
import type { JSX, MouseEvent } from "react";
|
|
25
|
+
import { memo, useMemo } from "react";
|
|
26
|
+
import { cn, formatTokens, getStatusCategory, type StatusCategory } from "../../lib/utils";
|
|
27
|
+
import type { CapturedLog } from "../../proxy/schemas";
|
|
28
|
+
import { Badge } from "../ui/badge";
|
|
29
|
+
import { Button } from "../ui/button";
|
|
30
|
+
import { ProviderLogo, detectProvider } from "../providers/ProviderLogo";
|
|
31
|
+
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "../ui/tooltip";
|
|
32
|
+
import type { CacheTrend } from "./cacheTrend";
|
|
33
|
+
|
|
34
|
+
const STATUS_BADGE_CLASSES: Record<StatusCategory, string> = {
|
|
35
|
+
success: "bg-emerald-500/15 text-emerald-400 border-emerald-500/25",
|
|
36
|
+
client_error: "bg-amber-500/15 text-amber-400 border-amber-500/25",
|
|
37
|
+
server_error: "bg-rose-500/15 text-rose-400 border-rose-500/25",
|
|
38
|
+
pending: "bg-muted text-muted-foreground border-border",
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
function formatElapsed(ms: number): string {
|
|
42
|
+
if (ms < 1000) return `${ms}ms`;
|
|
43
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Inline trend indicator: small arrow (green up / red down) plus the absolute
|
|
48
|
+
* delta in compact form. Returns `null` when there is no trend to display.
|
|
49
|
+
*/
|
|
50
|
+
function CacheTrendIndicator({ trend }: { trend: CacheTrend | null }): JSX.Element | null {
|
|
51
|
+
if (trend === null) return null;
|
|
52
|
+
const isUp = trend.direction === "up";
|
|
53
|
+
const Icon = isUp ? ArrowUp : ArrowDown;
|
|
54
|
+
const sign = isUp ? "+" : "-";
|
|
55
|
+
return (
|
|
56
|
+
<span className="flex items-center gap-0.5 text-muted-foreground tabular-nums">
|
|
57
|
+
<Icon className={isUp ? "size-3 text-emerald-400" : "size-3 text-rose-400"} />
|
|
58
|
+
<span className="font-mono">
|
|
59
|
+
{sign}
|
|
60
|
+
{formatTokens(trend.delta)}
|
|
61
|
+
</span>
|
|
62
|
+
</span>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Per-tab action bundle surfaced in the header when the tab is active.
|
|
68
|
+
* - `copyText === null` → Copy button hidden (e.g. tab has no body to copy)
|
|
69
|
+
* - `expansion === null` → Expand-all button hidden (e.g. flat dict, or
|
|
70
|
+
* not valid JSON). When present, the button reflects the JSON viewer's
|
|
71
|
+
* bulk-expansion state and the caller is responsible for forwarding the
|
|
72
|
+
* matching `bulkDepth` / `bulkRevision` to the underlying viewer.
|
|
73
|
+
* - `diffWithRaw` / `diffWithPrevious` → optional Diff buttons. Undefined
|
|
74
|
+
* means "not applicable" (hidden). Today only the Request tab sets them.
|
|
75
|
+
*/
|
|
76
|
+
export type HeaderTabAction = {
|
|
77
|
+
copyLabel: string;
|
|
78
|
+
copyText: string | null;
|
|
79
|
+
copyCopied: boolean;
|
|
80
|
+
onCopy: (event: MouseEvent) => void;
|
|
81
|
+
expansion: {
|
|
82
|
+
isExpanded: boolean;
|
|
83
|
+
isPending: boolean;
|
|
84
|
+
onToggle: () => void;
|
|
85
|
+
} | null;
|
|
86
|
+
/** Toggle for "Diff with Raw": display request body vs raw (pre-billing-strip). */
|
|
87
|
+
diffWithRaw?: { active: boolean; onToggle: () => void };
|
|
88
|
+
/** One-shot handler for "Diff with Previous": compare against the preceding log. */
|
|
89
|
+
diffWithPrevious?: () => void;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Tab actions keyed by Tabs value. Tabs without an entry (Anatomy, Parsed
|
|
94
|
+
* Response) leave the corresponding key unset, so the header renders no
|
|
95
|
+
* action buttons for them. Typed as a record (rather than a `Partial<...>`
|
|
96
|
+
* union) so the per-tab lookup in the header is type-safe.
|
|
97
|
+
*/
|
|
98
|
+
export type HeaderTabActions = Record<string, HeaderTabAction | undefined>;
|
|
99
|
+
|
|
100
|
+
export type LogEntryHeaderProps = {
|
|
101
|
+
log: CapturedLog;
|
|
102
|
+
/** Number of messages in the request (supports both Anthropic and OpenAI formats). */
|
|
103
|
+
messageCount?: number | null;
|
|
104
|
+
/** Number of tools defined in the request (supports both Anthropic and OpenAI formats). */
|
|
105
|
+
toolCount?: number | null;
|
|
106
|
+
expanded: boolean;
|
|
107
|
+
onToggle: () => void;
|
|
108
|
+
/** Tool call names extracted from the model response (e.g., ["read_file", "grep"]). */
|
|
109
|
+
responseToolNames?: string[] | null;
|
|
110
|
+
/** Per-log cache token trend (creation + read) relative to the previous log
|
|
111
|
+
* in the same conversation group. When `undefined` or a field is `null`,
|
|
112
|
+
* the corresponding cache span renders as it did before — no arrow.
|
|
113
|
+
*/
|
|
114
|
+
cacheTrend?: { creation: CacheTrend | null; read: CacheTrend | null } | null;
|
|
115
|
+
/** Currently-active tab value (matches the `Tabs` value prop). The header
|
|
116
|
+
* uses this to pick the right entry from `tabActions`. */
|
|
117
|
+
activeTab?: string;
|
|
118
|
+
/** Per-tab Copy + Expand-all actions. Only tabs with an entry will show
|
|
119
|
+
* buttons when active. Tabs without an entry (Anatomy, Parsed Response)
|
|
120
|
+
* render no header buttons. */
|
|
121
|
+
tabActions?: HeaderTabActions;
|
|
122
|
+
/** Re-send this request to the provider. Rendered in the header row when
|
|
123
|
+
* `expanded` is true. */
|
|
124
|
+
onReplay?: () => void;
|
|
125
|
+
/** Slow-response threshold in seconds. `0` disables the warning indicator. */
|
|
126
|
+
slowResponseThresholdSeconds?: number;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const LogEntryHeader = memo(function ({
|
|
130
|
+
log,
|
|
131
|
+
messageCount = null,
|
|
132
|
+
toolCount = null,
|
|
133
|
+
expanded,
|
|
134
|
+
onToggle,
|
|
135
|
+
responseToolNames = null,
|
|
136
|
+
cacheTrend = null,
|
|
137
|
+
activeTab,
|
|
138
|
+
tabActions,
|
|
139
|
+
onReplay,
|
|
140
|
+
slowResponseThresholdSeconds = 0,
|
|
141
|
+
}: LogEntryHeaderProps): JSX.Element {
|
|
142
|
+
const statusCategory = getStatusCategory(log.responseStatus);
|
|
143
|
+
const isSlowResponse =
|
|
144
|
+
log.elapsedMs !== null &&
|
|
145
|
+
slowResponseThresholdSeconds > 0 &&
|
|
146
|
+
log.elapsedMs > slowResponseThresholdSeconds * 1000;
|
|
147
|
+
|
|
148
|
+
const hasTokens = log.inputTokens !== null || log.outputTokens !== null;
|
|
149
|
+
const toolNamesJoined = useMemo(() => responseToolNames?.join(", ") ?? null, [responseToolNames]);
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<TooltipProvider>
|
|
153
|
+
<div
|
|
154
|
+
id={`log-${log.id}`}
|
|
155
|
+
role="button"
|
|
156
|
+
tabIndex={0}
|
|
157
|
+
data-nav-id={`log-${log.id}`}
|
|
158
|
+
data-nav-action={expanded ? "collapse" : "expand"}
|
|
159
|
+
className={cn(
|
|
160
|
+
"flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors",
|
|
161
|
+
"hover:bg-muted/50",
|
|
162
|
+
"select-none",
|
|
163
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none",
|
|
164
|
+
)}
|
|
165
|
+
onClick={onToggle}
|
|
166
|
+
onKeyDown={(e) => {
|
|
167
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
onToggle();
|
|
170
|
+
}
|
|
171
|
+
}}
|
|
172
|
+
>
|
|
173
|
+
{/* Request ID */}
|
|
174
|
+
<span className="text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0">
|
|
175
|
+
#{log.id}
|
|
176
|
+
</span>
|
|
177
|
+
|
|
178
|
+
{/* Request start time */}
|
|
179
|
+
<span className="flex items-center gap-1 text-muted-foreground text-xs shrink-0">
|
|
180
|
+
<Clock className="size-3" />
|
|
181
|
+
<span className="font-mono tabular-nums">{log.timestamp}</span>
|
|
182
|
+
</span>
|
|
183
|
+
|
|
184
|
+
{/* Model — logo icon only, model name in tooltip */}
|
|
185
|
+
{log.model !== null && (
|
|
186
|
+
<Tooltip>
|
|
187
|
+
<TooltipTrigger asChild>
|
|
188
|
+
<span className="shrink-0">
|
|
189
|
+
<ProviderLogo provider={detectProvider(log.model)} className="size-4" />
|
|
190
|
+
</span>
|
|
191
|
+
</TooltipTrigger>
|
|
192
|
+
<TooltipContent>{log.model}</TooltipContent>
|
|
193
|
+
</Tooltip>
|
|
194
|
+
)}
|
|
195
|
+
|
|
196
|
+
{/* Response Status — only shown for non-200 or pending. Each category
|
|
197
|
+
carries a distinct icon in addition to color so the meaning is
|
|
198
|
+
legible without color perception. */}
|
|
199
|
+
{statusCategory !== "success" && (
|
|
200
|
+
<Badge
|
|
201
|
+
variant="outline"
|
|
202
|
+
className={cn(
|
|
203
|
+
"text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",
|
|
204
|
+
STATUS_BADGE_CLASSES[statusCategory],
|
|
205
|
+
)}
|
|
206
|
+
>
|
|
207
|
+
{statusCategory === "server_error" ? (
|
|
208
|
+
<OctagonAlert className="size-3" aria-label="Server error" />
|
|
209
|
+
) : statusCategory === "client_error" ? (
|
|
210
|
+
<AlertTriangle className="size-3" aria-label="Client error" />
|
|
211
|
+
) : statusCategory === "pending" ? (
|
|
212
|
+
<Loader2 className="size-3 animate-spin" aria-label="Pending" />
|
|
213
|
+
) : null}
|
|
214
|
+
{log.responseStatus}
|
|
215
|
+
</Badge>
|
|
216
|
+
)}
|
|
217
|
+
|
|
218
|
+
{/* Elapsed time */}
|
|
219
|
+
{log.elapsedMs !== null && (
|
|
220
|
+
<Tooltip>
|
|
221
|
+
<TooltipTrigger asChild>
|
|
222
|
+
<span
|
|
223
|
+
className={cn(
|
|
224
|
+
"flex items-center gap-1 text-xs shrink-0",
|
|
225
|
+
isSlowResponse ? "text-amber-400" : "text-muted-foreground",
|
|
226
|
+
)}
|
|
227
|
+
>
|
|
228
|
+
<Clock className="size-3" />
|
|
229
|
+
<span className="font-mono tabular-nums">{formatElapsed(log.elapsedMs)}</span>
|
|
230
|
+
{isSlowResponse && <AlertTriangle className="size-3" aria-label="Slow response" />}
|
|
231
|
+
</span>
|
|
232
|
+
</TooltipTrigger>
|
|
233
|
+
<TooltipContent>
|
|
234
|
+
{isSlowResponse
|
|
235
|
+
? `Slow response: ${formatElapsed(log.elapsedMs)} exceeds ${formatElapsed(
|
|
236
|
+
slowResponseThresholdSeconds * 1000,
|
|
237
|
+
)}`
|
|
238
|
+
: "Elapsed response time"}
|
|
239
|
+
</TooltipContent>
|
|
240
|
+
</Tooltip>
|
|
241
|
+
)}
|
|
242
|
+
|
|
243
|
+
{/* Token counts */}
|
|
244
|
+
{hasTokens && (
|
|
245
|
+
<span className="flex items-center gap-1 text-xs shrink-0">
|
|
246
|
+
<Zap className="size-3 text-muted-foreground" />
|
|
247
|
+
<span className="font-mono tabular-nums">
|
|
248
|
+
<span
|
|
249
|
+
className={log.inputTokens !== null ? "text-blue-400" : "text-muted-foreground"}
|
|
250
|
+
>
|
|
251
|
+
IN {log.inputTokens !== null ? formatTokens(log.inputTokens) : "—"}
|
|
252
|
+
</span>
|
|
253
|
+
{" / "}
|
|
254
|
+
<span
|
|
255
|
+
className={log.outputTokens !== null ? "text-amber-400" : "text-muted-foreground"}
|
|
256
|
+
>
|
|
257
|
+
OUT {log.outputTokens !== null ? formatTokens(log.outputTokens) : "—"}
|
|
258
|
+
</span>
|
|
259
|
+
</span>
|
|
260
|
+
</span>
|
|
261
|
+
)}
|
|
262
|
+
{/* Cache tokens */}
|
|
263
|
+
{log.cacheCreationInputTokens !== null && log.cacheCreationInputTokens > 0 && (
|
|
264
|
+
<Tooltip>
|
|
265
|
+
<TooltipTrigger asChild>
|
|
266
|
+
<span className="flex items-center gap-1 text-xs shrink-0">
|
|
267
|
+
<CacheTrendIndicator trend={cacheTrend?.creation ?? null} />
|
|
268
|
+
<span className="font-mono tabular-nums text-emerald-400">
|
|
269
|
+
Cache +{formatTokens(log.cacheCreationInputTokens)}
|
|
270
|
+
</span>
|
|
271
|
+
</span>
|
|
272
|
+
</TooltipTrigger>
|
|
273
|
+
<TooltipContent>Tokens cached for reuse, reducing future API cost</TooltipContent>
|
|
274
|
+
</Tooltip>
|
|
275
|
+
)}
|
|
276
|
+
{log.cacheReadInputTokens !== null && log.cacheReadInputTokens > 0 && (
|
|
277
|
+
<Tooltip>
|
|
278
|
+
<TooltipTrigger asChild>
|
|
279
|
+
<span className="flex items-center gap-1 text-xs shrink-0">
|
|
280
|
+
<CacheTrendIndicator trend={cacheTrend?.read ?? null} />
|
|
281
|
+
<span className="font-mono tabular-nums text-purple-400">
|
|
282
|
+
Cache ~{formatTokens(log.cacheReadInputTokens)}
|
|
283
|
+
</span>
|
|
284
|
+
</span>
|
|
285
|
+
</TooltipTrigger>
|
|
286
|
+
<TooltipContent>Tokens served from cache, reducing API cost</TooltipContent>
|
|
287
|
+
</Tooltip>
|
|
288
|
+
)}
|
|
289
|
+
|
|
290
|
+
{/* Message count */}
|
|
291
|
+
{messageCount !== null && (
|
|
292
|
+
<span className="flex items-center gap-1 text-muted-foreground text-xs shrink-0">
|
|
293
|
+
<MessageSquare className="size-3" />
|
|
294
|
+
<span className="font-mono tabular-nums">{messageCount}</span>
|
|
295
|
+
</span>
|
|
296
|
+
)}
|
|
297
|
+
|
|
298
|
+
{/* Tool count */}
|
|
299
|
+
{toolCount !== null && (
|
|
300
|
+
<span className="flex items-center gap-1 text-muted-foreground text-xs shrink-0">
|
|
301
|
+
<Wrench className="size-3" />
|
|
302
|
+
<span className="font-mono tabular-nums">{toolCount}</span>
|
|
303
|
+
</span>
|
|
304
|
+
)}
|
|
305
|
+
|
|
306
|
+
{/* Response tool calls — tool names the model requested to invoke */}
|
|
307
|
+
{responseToolNames !== null && responseToolNames.length > 0 && (
|
|
308
|
+
<span className="flex items-center gap-1 text-amber-400/80 text-xs shrink-0">
|
|
309
|
+
<Wrench className="size-3" />
|
|
310
|
+
<span className="font-mono tabular-nums truncate max-w-[160px]">{toolNamesJoined}</span>
|
|
311
|
+
</span>
|
|
312
|
+
)}
|
|
313
|
+
|
|
314
|
+
{/* Origin */}
|
|
315
|
+
{log.origin !== null && (
|
|
316
|
+
<span
|
|
317
|
+
className="hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0"
|
|
318
|
+
title={`Origin: ${log.origin}`}
|
|
319
|
+
>
|
|
320
|
+
<Globe className="size-3" />
|
|
321
|
+
<span className="font-mono tabular-nums truncate max-w-[120px]" title={log.origin}>
|
|
322
|
+
{log.origin}
|
|
323
|
+
</span>
|
|
324
|
+
</span>
|
|
325
|
+
)}
|
|
326
|
+
|
|
327
|
+
{/* Client info (PID + project folder) */}
|
|
328
|
+
{(log.clientPid !== null || log.clientProjectFolder !== null) && (
|
|
329
|
+
<Tooltip>
|
|
330
|
+
<TooltipTrigger asChild>
|
|
331
|
+
<span className="hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0">
|
|
332
|
+
<FileTerminal className="size-3" />
|
|
333
|
+
{log.clientProjectFolder !== null ? (
|
|
334
|
+
<span className="font-mono tabular-nums">{log.clientProjectFolder}</span>
|
|
335
|
+
) : (
|
|
336
|
+
<span className="font-mono tabular-nums">PID {log.clientPid}</span>
|
|
337
|
+
)}
|
|
338
|
+
</span>
|
|
339
|
+
</TooltipTrigger>
|
|
340
|
+
<TooltipContent>
|
|
341
|
+
{log.clientCwd !== null
|
|
342
|
+
? `PID: ${log.clientPid ?? "?"} CWD: ${log.clientCwd}`
|
|
343
|
+
: `Process ID: ${log.clientPid ?? "?"}`}
|
|
344
|
+
</TooltipContent>
|
|
345
|
+
</Tooltip>
|
|
346
|
+
)}
|
|
347
|
+
|
|
348
|
+
{/* Streaming indicator */}
|
|
349
|
+
{log.streaming && (
|
|
350
|
+
<Tooltip>
|
|
351
|
+
<TooltipTrigger asChild>
|
|
352
|
+
<Radio className="size-3 text-muted-foreground/60 shrink-0" />
|
|
353
|
+
</TooltipTrigger>
|
|
354
|
+
<TooltipContent>Request used SSE streaming</TooltipContent>
|
|
355
|
+
</Tooltip>
|
|
356
|
+
)}
|
|
357
|
+
|
|
358
|
+
{/* Spacer */}
|
|
359
|
+
<span className="flex-1 min-w-0" />
|
|
360
|
+
|
|
361
|
+
{/* Header actions — only when expanded, so the collapsed view stays
|
|
362
|
+
compact. Buttons stop propagation so they don't toggle the log. */}
|
|
363
|
+
{expanded && (
|
|
364
|
+
<span
|
|
365
|
+
className="flex items-center gap-1.5 shrink-0"
|
|
366
|
+
onClick={(e) => e.stopPropagation()}
|
|
367
|
+
onKeyDown={(e) => e.stopPropagation()}
|
|
368
|
+
>
|
|
369
|
+
{tabActions !== undefined &&
|
|
370
|
+
activeTab !== undefined &&
|
|
371
|
+
(() => {
|
|
372
|
+
const action = tabActions[activeTab];
|
|
373
|
+
if (action === undefined) return null;
|
|
374
|
+
return (
|
|
375
|
+
<>
|
|
376
|
+
{action.expansion !== null && (
|
|
377
|
+
<Tooltip>
|
|
378
|
+
<TooltipTrigger asChild>
|
|
379
|
+
<Button
|
|
380
|
+
variant="outline"
|
|
381
|
+
size="icon"
|
|
382
|
+
className="size-8"
|
|
383
|
+
onClick={action.expansion.onToggle}
|
|
384
|
+
disabled={action.expansion.isPending}
|
|
385
|
+
aria-pressed={action.expansion.isExpanded}
|
|
386
|
+
aria-label={
|
|
387
|
+
action.expansion.isExpanded ? "Collapse all JSON" : "Expand all JSON"
|
|
388
|
+
}
|
|
389
|
+
>
|
|
390
|
+
{action.expansion.isExpanded ? (
|
|
391
|
+
<ChevronsUp className="size-3.5" />
|
|
392
|
+
) : (
|
|
393
|
+
<ChevronsDown className="size-3.5" />
|
|
394
|
+
)}
|
|
395
|
+
</Button>
|
|
396
|
+
</TooltipTrigger>
|
|
397
|
+
<TooltipContent>
|
|
398
|
+
{action.expansion.isExpanded
|
|
399
|
+
? "Collapse all JSON nodes"
|
|
400
|
+
: "Expand all JSON nodes"}
|
|
401
|
+
</TooltipContent>
|
|
402
|
+
</Tooltip>
|
|
403
|
+
)}
|
|
404
|
+
{action.diffWithRaw !== undefined && (
|
|
405
|
+
<Tooltip>
|
|
406
|
+
<TooltipTrigger asChild>
|
|
407
|
+
<Button
|
|
408
|
+
variant="outline"
|
|
409
|
+
size="icon"
|
|
410
|
+
className={cn(
|
|
411
|
+
"size-8",
|
|
412
|
+
action.diffWithRaw.active && "bg-accent text-accent-foreground",
|
|
413
|
+
)}
|
|
414
|
+
onClick={action.diffWithRaw.onToggle}
|
|
415
|
+
aria-pressed={action.diffWithRaw.active}
|
|
416
|
+
aria-label={
|
|
417
|
+
action.diffWithRaw.active ? "Hide raw diff" : "Diff with raw"
|
|
418
|
+
}
|
|
419
|
+
>
|
|
420
|
+
<FileDiff className="size-3.5" />
|
|
421
|
+
</Button>
|
|
422
|
+
</TooltipTrigger>
|
|
423
|
+
<TooltipContent>
|
|
424
|
+
{action.diffWithRaw.active
|
|
425
|
+
? "Hide diff with raw request"
|
|
426
|
+
: "Show diff between displayed and raw request body"}
|
|
427
|
+
</TooltipContent>
|
|
428
|
+
</Tooltip>
|
|
429
|
+
)}
|
|
430
|
+
{action.diffWithPrevious !== undefined && (
|
|
431
|
+
<Tooltip>
|
|
432
|
+
<TooltipTrigger asChild>
|
|
433
|
+
<Button
|
|
434
|
+
variant="outline"
|
|
435
|
+
size="icon"
|
|
436
|
+
className="size-8"
|
|
437
|
+
onClick={action.diffWithPrevious}
|
|
438
|
+
aria-label="Diff with previous"
|
|
439
|
+
>
|
|
440
|
+
<History className="size-3.5" />
|
|
441
|
+
</Button>
|
|
442
|
+
</TooltipTrigger>
|
|
443
|
+
<TooltipContent>
|
|
444
|
+
Compare this request with the immediately preceding one
|
|
445
|
+
</TooltipContent>
|
|
446
|
+
</Tooltip>
|
|
447
|
+
)}
|
|
448
|
+
{action.copyText !== null && (
|
|
449
|
+
<Tooltip>
|
|
450
|
+
<TooltipTrigger asChild>
|
|
451
|
+
<Button
|
|
452
|
+
variant="outline"
|
|
453
|
+
size="icon"
|
|
454
|
+
className="size-8"
|
|
455
|
+
onClick={action.onCopy}
|
|
456
|
+
aria-label={action.copyCopied ? "Copied" : action.copyLabel}
|
|
457
|
+
>
|
|
458
|
+
{action.copyCopied ? (
|
|
459
|
+
<Check className="size-3.5 text-emerald-500" />
|
|
460
|
+
) : (
|
|
461
|
+
<Copy className="size-3.5" />
|
|
462
|
+
)}
|
|
463
|
+
</Button>
|
|
464
|
+
</TooltipTrigger>
|
|
465
|
+
<TooltipContent>
|
|
466
|
+
{action.copyCopied ? "Copied to clipboard" : action.copyLabel}
|
|
467
|
+
</TooltipContent>
|
|
468
|
+
</Tooltip>
|
|
469
|
+
)}
|
|
470
|
+
</>
|
|
471
|
+
);
|
|
472
|
+
})()}
|
|
473
|
+
{onReplay !== undefined && (
|
|
474
|
+
<Tooltip>
|
|
475
|
+
<TooltipTrigger asChild>
|
|
476
|
+
<Button
|
|
477
|
+
variant="outline"
|
|
478
|
+
size="icon"
|
|
479
|
+
className="size-8"
|
|
480
|
+
onClick={onReplay}
|
|
481
|
+
aria-label="Replay request"
|
|
482
|
+
>
|
|
483
|
+
<RotateCcw className="size-3.5" />
|
|
484
|
+
</Button>
|
|
485
|
+
</TooltipTrigger>
|
|
486
|
+
<TooltipContent>Re-send this request to the provider</TooltipContent>
|
|
487
|
+
</Tooltip>
|
|
488
|
+
)}
|
|
489
|
+
</span>
|
|
490
|
+
)}
|
|
491
|
+
|
|
492
|
+
{/* Expand chevron */}
|
|
493
|
+
{expanded ? (
|
|
494
|
+
<ChevronDown className="size-4 text-muted-foreground shrink-0" />
|
|
495
|
+
) : (
|
|
496
|
+
<ChevronRight className="size-4 text-muted-foreground shrink-0" />
|
|
497
|
+
)}
|
|
498
|
+
</div>
|
|
499
|
+
</TooltipProvider>
|
|
500
|
+
);
|
|
501
|
+
});
|