@tonyclaw/agent-inspector 3.0.44 → 3.0.46
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/{nitro.json → backend/nitro.json} +3 -3
- package/.output/backend-public/assets/index-D4LX-sw-.js +11 -0
- package/.output/cli.js +22707 -17099
- package/.output/server/_libs/extend.mjs +4 -8
- package/.output/server/_libs/jszip.mjs +9 -35
- package/.output/server/_libs/modelcontextprotocol__core.mjs +25 -25
- package/.output/server/_libs/modelcontextprotocol__server.mjs +2 -2
- package/.output/server/_libs/react-dom.mjs +2 -3
- package/.output/server/_libs/react.mjs +1 -27
- package/.output/server/_libs/tanstack__react-router.mjs +1 -329
- package/.output/server/_libs/tanstack__router-core.mjs +42 -100
- package/.output/server/_libs/use-sync-external-store.mjs +1 -64
- package/.output/server/_libs/ws.mjs +1 -1
- package/.output/server/_libs/zod.mjs +6 -6
- package/.output/server/_ssr/index.mjs +5 -4
- package/.output/server/_ssr/publicBasePathContext-IH2ilOfu.mjs +176 -0
- package/.output/server/_ssr/{router-DWcUFPR3.mjs → router-D18yUq36.mjs} +7877 -5597
- package/.output/server/_ssr/start-COQu_AgD.mjs +57 -0
- package/.output/server/_tanstack-start-manifest_v-DnbdNeun.mjs +4 -0
- package/.output/server/index.mjs +5 -145
- package/.output/{public/assets/CompareDrawer-DQHjxFO6.js → ui/assets/CompareDrawer-DAUuIJ6G.js} +1 -1
- package/.output/{public/assets/InspectorPet-D1A4505B.js → ui/assets/InspectorPet-BRBVjOWI.js} +1 -1
- package/.output/ui/assets/ProxyViewerContainer-D7Sq0ctc.js +59 -0
- package/.output/{public/assets/ReplayDialog-C5vmbecv.js → ui/assets/ReplayDialog-nDLsjOhs.js} +1 -1
- package/.output/{public/assets/RequestAnatomy-CPGNB8lk.js → ui/assets/RequestAnatomy-zd4BDgL0.js} +1 -1
- package/.output/ui/assets/ResponseView-AdIXGcSn.js +2 -0
- package/.output/ui/assets/StreamingChunkSequence-CesTz8He.js +1 -0
- package/.output/{public/assets/_sessionId-CDhRgzf6.js → ui/assets/_sessionId-BAfzrhSU.js} +1 -1
- package/.output/{public/assets/_sessionId-mw3aA8Bp.js → ui/assets/_sessionId-QnBomgPD.js} +1 -1
- package/.output/ui/assets/favicon-DYEkHSNl.svg +21 -0
- package/.output/{public/assets/index-B2eoeT-Z.js → ui/assets/index-BcsdxBAd.js} +1 -1
- package/.output/ui/assets/index-BvXp42al.css +1 -0
- package/.output/{public/assets/index-CX7_rf7o.js → ui/assets/index-D0rtCN9V.js} +1 -1
- package/.output/ui/assets/index-DHpwr08Z.js +73 -0
- package/.output/{public/assets/index-BfRhTvOd.js → ui/assets/index-dNuk2dsU.js} +1 -1
- package/.output/ui/assets/json-viewer-BvFHglMb.js +1 -0
- package/.output/{public/assets/jszip.min-C9rCFoU3.js → ui/assets/jszip.min-B5Z7gNZB.js} +1 -1
- package/.output/ui/index.html +229 -0
- package/.output/ui/runtime-config.js +2 -0
- package/.output/workers/logFinalizer.worker.js +983 -414
- package/.output/workers/sessionWorkerEntry.js +983 -414
- package/README.md +363 -35
- package/docs/instance-control.openapi.yaml +361 -0
- package/package.json +28 -5
- package/scripts/generate-theme-scales.mjs +3 -3
- package/src/{router.tsx → backend/router.tsx} +3 -15
- package/src/backend/routes/$.ts +26 -0
- package/src/backend/routes/__root.ts +4 -0
- package/src/backend/routes/api/-instances.ts +109 -0
- package/src/{routes → backend/routes}/api/alerts.summary.ts +3 -3
- package/src/{routes → backend/routes}/api/alerts.ts +4 -4
- package/src/{routes → backend/routes}/api/config.paths.ts +1 -1
- package/src/{routes → backend/routes}/api/config.ts +11 -2
- package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.help.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.install.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.runner-presets.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.upgrade.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.packages.ts +5 -1
- package/src/{routes → backend/routes}/api/ecosystem.recipes.$recipeId.run.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.tasks.$taskId.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.tasks.ts +1 -1
- package/src/{routes → backend/routes}/api/groups.$groupId.evidence.ts +2 -2
- package/src/{routes → backend/routes}/api/groups.$groupId.sessions.ts +2 -2
- package/src/{routes → backend/routes}/api/groups.$groupId.ts +2 -2
- package/src/{routes → backend/routes}/api/groups.ts +2 -2
- package/src/{routes → backend/routes}/api/health.ts +3 -3
- package/src/backend/routes/api/instances.$name.connection.ts +12 -0
- package/src/backend/routes/api/instances.$name.restart.ts +23 -0
- package/src/backend/routes/api/instances.$name.start.ts +18 -0
- package/src/backend/routes/api/instances.$name.stop.ts +23 -0
- package/src/backend/routes/api/instances.$name.ts +12 -0
- package/src/backend/routes/api/instances.ts +16 -0
- package/src/{routes → backend/routes}/api/knowledge.candidates.$candidateId.promote.ts +2 -2
- package/src/{routes → backend/routes}/api/knowledge.candidates.$candidateId.ts +2 -2
- package/src/{routes → backend/routes}/api/knowledge.candidates.ts +1 -1
- package/src/{routes → backend/routes}/api/knowledge.project-context.ts +2 -2
- package/src/{routes → backend/routes}/api/knowledge.search.ts +2 -2
- package/src/{routes → backend/routes}/api/knowledge.sessions.$sessionId.candidates.ts +3 -3
- package/src/{routes → backend/routes}/api/logs.$id.body.ts +6 -6
- package/src/{routes → backend/routes}/api/logs.$id.chunks.ts +5 -4
- package/src/{routes → backend/routes}/api/logs.$id.replay.ts +12 -11
- package/src/{routes → backend/routes}/api/logs.$id.ts +4 -3
- package/src/{routes → backend/routes}/api/logs.import.ts +3 -3
- package/src/{routes → backend/routes}/api/logs.stream.ts +11 -7
- package/src/{routes → backend/routes}/api/logs.ts +17 -9
- package/src/{routes → backend/routes}/api/mcp.ts +1 -1
- package/src/{routes → backend/routes}/api/models.ts +1 -1
- package/src/{routes → backend/routes}/api/pi-agent.ts +2 -2
- package/src/{routes → backend/routes}/api/providers.$providerId.model-metadata.ts +5 -5
- package/src/{routes → backend/routes}/api/providers.$providerId.test.log.ts +7 -7
- package/src/{routes → backend/routes}/api/providers.$providerId.ts +4 -4
- package/src/{routes → backend/routes}/api/providers.export.ts +1 -1
- package/src/{routes → backend/routes}/api/providers.import.ts +3 -3
- package/src/{routes → backend/routes}/api/providers.scan.ts +2 -2
- package/src/{routes → backend/routes}/api/providers.ts +9 -4
- package/src/{routes → backend/routes}/api/runs.$runId.evidence.ts +2 -2
- package/src/{routes → backend/routes}/api/runs.$runId.ts +2 -2
- package/src/{routes → backend/routes}/api/runs.ts +4 -4
- package/src/backend/routes/api/runtime.ts +46 -0
- package/src/{routes → backend/routes}/api/sessions.ts +3 -3
- package/src/{routes → backend/routes}/proxy/$.ts +1 -1
- package/src/{routes → backend/routes}/readyz.ts +1 -1
- package/src/backend/start.ts +10 -0
- package/src/cli/alias.ts +431 -0
- package/src/cli/doctor.ts +32 -9
- package/src/cli/instance.ts +1050 -0
- package/src/cli/instanceArgs.ts +285 -0
- package/src/cli/instanceControl.ts +181 -0
- package/src/cli/instanceModel.ts +267 -0
- package/src/cli/instanceRegistry.ts +731 -0
- package/src/cli/networkHints.ts +27 -14
- package/src/cli/onboard.ts +190 -35
- package/src/cli/onboardTarget.ts +228 -0
- package/src/cli/templates/codex-skill-onboard.ts +109 -31
- package/src/cli/templates/skill-onboard.ts +140 -70
- package/src/cli.ts +338 -77
- package/src/components/ProxyViewer.tsx +20 -10
- package/src/components/ProxyViewerContainer.tsx +12 -11
- package/src/components/pi-agent/PiAgentPanel.tsx +2 -2
- package/src/components/providers/ProviderCard.tsx +1 -1
- package/src/components/providers/ProviderTestResultsView.tsx +1 -1
- package/src/components/providers/SettingsDialog.tsx +160 -140
- package/src/components/proxy-viewer/ApplicationBar.tsx +2 -1
- package/src/components/proxy-viewer/LogEntry.tsx +1 -1
- package/src/components/proxy-viewer/log-formats/index.ts +1 -1
- package/src/contracts/index.ts +5 -0
- package/src/contracts/log.ts +33 -3
- package/src/knowledge/types.ts +3 -2
- package/src/lib/alertContract.ts +2 -2
- package/src/lib/apiClient.ts +30 -7
- package/src/lib/apiFormat.ts +29 -0
- package/src/lib/basePath.ts +31 -7
- package/src/lib/browserRuntimeContract.ts +124 -0
- package/src/lib/browserRuntimeResolver.ts +244 -0
- package/src/{proxy → lib}/claudeCodeStrip.ts +6 -7
- package/src/lib/codingAgentEndpoints.ts +54 -0
- package/src/lib/instanceContract.ts +236 -0
- package/src/lib/managedInstance.ts +104 -0
- package/src/lib/piAgentContract.ts +3 -2
- package/src/lib/publicBasePathContext.ts +137 -0
- package/src/lib/resourceLimits.ts +2 -0
- package/src/lib/runContract.ts +3 -3
- package/src/lib/sessionInfoContract.ts +3 -2
- package/src/mcp/instanceHandlers.ts +150 -0
- package/src/mcp/loopback.ts +16 -5
- package/src/mcp/mode.ts +25 -0
- package/src/mcp/server.ts +274 -39
- package/src/mcp/toolHandlers.ts +2 -2
- package/src/proxy/config.ts +25 -30
- package/src/proxy/dataDir.ts +43 -7
- package/src/proxy/ecosystemTasks.ts +161 -70
- package/src/proxy/formats/registry.ts +6 -21
- package/src/proxy/handler.ts +129 -29
- package/src/proxy/identityProxy.ts +1049 -50
- package/src/proxy/jsonlRecovery.ts +554 -0
- package/src/proxy/logFinalizer.ts +25 -10
- package/src/proxy/logImporter.ts +2 -1
- package/src/proxy/logIndex.ts +191 -95
- package/src/proxy/logger.ts +77 -14
- package/src/proxy/platformCommands.ts +41 -0
- package/src/proxy/privateDataPath.ts +310 -88
- package/src/proxy/rawStreamCapture.ts +194 -13
- package/src/proxy/runtimeAdmission.ts +5 -2
- package/src/proxy/runtimeHealth.ts +14 -1
- package/src/proxy/runtimeShutdown.ts +84 -2
- package/src/proxy/schemas.ts +7 -1
- package/src/proxy/sessionArchive.ts +78 -14
- package/src/proxy/sessionInfo.ts +5 -4
- package/src/proxy/sqliteLogIndex.ts +65 -2
- package/src/proxy/store.ts +141 -34
- package/src/proxy/uiAssetServer.ts +106 -0
- package/src/proxy/upstream.ts +29 -2
- package/src/ui/bootstrap.ts +167 -0
- package/src/ui/index.html +38 -0
- package/src/ui/logsStreamClient.ts +20 -0
- package/src/ui/main.tsx +13 -0
- package/src/ui/public/runtime-config.js +2 -0
- package/src/ui/router.tsx +13 -0
- package/src/ui/routes/__root.tsx +69 -0
- package/src/{routes → ui/routes}/index.tsx +2 -3
- package/src/{routes → ui/routes}/session/$sessionId.tsx +5 -11
- package/src/ui/runtimeDiscovery.ts +50 -0
- package/styles/globals.css +1 -0
- package/.output/public/assets/ProxyViewerContainer-BhpIgfBi.js +0 -126
- package/.output/public/assets/ResponseView-DUfrajCm.js +0 -2
- package/.output/public/assets/StreamingChunkSequence-nbeCQqOz.js +0 -1
- package/.output/public/assets/index-BWjeqxbk.css +0 -1
- package/.output/public/assets/index-C6qZwYlR.js +0 -70
- package/.output/public/assets/json-viewer-BLmF1sOZ.js +0 -1
- package/.output/server/_libs/@radix-ui/react-accessible-icon+[...].mjs +0 -1
- package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +0 -344
- package/.output/server/_libs/@radix-ui/react-navigation-menu+[...].mjs +0 -2
- package/.output/server/_libs/@radix-ui/react-one-time-password-field+[...].mjs +0 -2
- package/.output/server/_libs/@radix-ui/react-password-toggle-field+[...].mjs +0 -2
- package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +0 -11
- package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +0 -69
- package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +0 -1
- package/.output/server/_libs/@radix-ui/react-use-is-hydrated+[...].mjs +0 -28
- package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +0 -6
- package/.output/server/_libs/@radix-ui/react-visually-hidden+[...].mjs +0 -34
- package/.output/server/_libs/aria-hidden.mjs +0 -122
- package/.output/server/_libs/bail.mjs +0 -8
- package/.output/server/_libs/character-entities.mjs +0 -2130
- package/.output/server/_libs/class-variance-authority.mjs +0 -44
- package/.output/server/_libs/clsx.mjs +0 -16
- package/.output/server/_libs/comma-separated-tokens.mjs +0 -10
- package/.output/server/_libs/decode-named-character-reference+[...].mjs +0 -8
- package/.output/server/_libs/dequal.mjs +0 -27
- package/.output/server/_libs/detect-node-es.mjs +0 -1
- package/.output/server/_libs/devlop.mjs +0 -8
- package/.output/server/_libs/diff.mjs +0 -320
- package/.output/server/_libs/estree-util-is-identifier-name.mjs +0 -11
- package/.output/server/_libs/floating-ui__core.mjs +0 -725
- package/.output/server/_libs/floating-ui__dom.mjs +0 -622
- package/.output/server/_libs/floating-ui__react-dom.mjs +0 -292
- package/.output/server/_libs/floating-ui__utils.mjs +0 -320
- package/.output/server/_libs/get-nonce.mjs +0 -9
- package/.output/server/_libs/hast-util-to-jsx-runtime.mjs +0 -388
- package/.output/server/_libs/hast-util-whitespace.mjs +0 -10
- package/.output/server/_libs/html-url-attributes.mjs +0 -26
- package/.output/server/_libs/inline-style-parser.mjs +0 -142
- package/.output/server/_libs/is-plain-obj.mjs +0 -10
- package/.output/server/_libs/lucide-react.mjs +0 -1027
- package/.output/server/_libs/mdast-util-from-markdown.mjs +0 -717
- package/.output/server/_libs/mdast-util-to-hast.mjs +0 -710
- package/.output/server/_libs/mdast-util-to-string.mjs +0 -38
- package/.output/server/_libs/micromark-core-commonmark.mjs +0 -2259
- package/.output/server/_libs/micromark-factory-destination.mjs +0 -94
- package/.output/server/_libs/micromark-factory-label.mjs +0 -63
- package/.output/server/_libs/micromark-factory-space.mjs +0 -24
- package/.output/server/_libs/micromark-factory-title.mjs +0 -65
- package/.output/server/_libs/micromark-factory-whitespace.mjs +0 -22
- package/.output/server/_libs/micromark-util-character.mjs +0 -44
- package/.output/server/_libs/micromark-util-chunked.mjs +0 -36
- package/.output/server/_libs/micromark-util-classify-character+[...].mjs +0 -12
- package/.output/server/_libs/micromark-util-combine-extensions+[...].mjs +0 -41
- package/.output/server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +0 -19
- package/.output/server/_libs/micromark-util-decode-string.mjs +0 -21
- package/.output/server/_libs/micromark-util-encode.mjs +0 -1
- package/.output/server/_libs/micromark-util-html-tag-name.mjs +0 -69
- package/.output/server/_libs/micromark-util-normalize-identifier+[...].mjs +0 -6
- package/.output/server/_libs/micromark-util-resolve-all.mjs +0 -15
- package/.output/server/_libs/micromark-util-sanitize-uri.mjs +0 -41
- package/.output/server/_libs/micromark-util-subtokenize.mjs +0 -346
- package/.output/server/_libs/micromark.mjs +0 -906
- package/.output/server/_libs/property-information.mjs +0 -1209
- package/.output/server/_libs/radix-ui.mjs +0 -1
- package/.output/server/_libs/radix-ui__number.mjs +0 -6
- package/.output/server/_libs/radix-ui__primitive.mjs +0 -11
- package/.output/server/_libs/radix-ui__react-accordion.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-alert-dialog.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-arrow.mjs +0 -23
- package/.output/server/_libs/radix-ui__react-aspect-ratio.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-avatar.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-checkbox.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-collapsible.mjs +0 -144
- package/.output/server/_libs/radix-ui__react-collection.mjs +0 -69
- package/.output/server/_libs/radix-ui__react-compose-refs.mjs +0 -38
- package/.output/server/_libs/radix-ui__react-context-menu.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-context.mjs +0 -64
- package/.output/server/_libs/radix-ui__react-dialog.mjs +0 -280
- package/.output/server/_libs/radix-ui__react-direction.mjs +0 -9
- package/.output/server/_libs/radix-ui__react-dropdown-menu.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-focus-guards.mjs +0 -39
- package/.output/server/_libs/radix-ui__react-focus-scope.mjs +0 -210
- package/.output/server/_libs/radix-ui__react-form.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-hover-card.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-id.mjs +0 -14
- package/.output/server/_libs/radix-ui__react-label.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-menu.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-menubar.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-popover.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-popper.mjs +0 -340
- package/.output/server/_libs/radix-ui__react-portal.mjs +0 -16
- package/.output/server/_libs/radix-ui__react-presence.mjs +0 -173
- package/.output/server/_libs/radix-ui__react-primitive.mjs +0 -42
- package/.output/server/_libs/radix-ui__react-progress.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-radio-group.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-roving-focus.mjs +0 -235
- package/.output/server/_libs/radix-ui__react-scroll-area.mjs +0 -731
- package/.output/server/_libs/radix-ui__react-select.mjs +0 -1207
- package/.output/server/_libs/radix-ui__react-separator.mjs +0 -28
- package/.output/server/_libs/radix-ui__react-slider.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-slot.mjs +0 -132
- package/.output/server/_libs/radix-ui__react-switch.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-tabs.mjs +0 -194
- package/.output/server/_libs/radix-ui__react-toast.mjs +0 -2
- package/.output/server/_libs/radix-ui__react-toggle-group.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-toggle.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-toolbar.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-tooltip.mjs +0 -498
- package/.output/server/_libs/radix-ui__react-use-previous.mjs +0 -14
- package/.output/server/_libs/radix-ui__react-use-size.mjs +0 -39
- package/.output/server/_libs/react-markdown.mjs +0 -235
- package/.output/server/_libs/react-remove-scroll-bar.mjs +0 -82
- package/.output/server/_libs/react-remove-scroll.mjs +0 -328
- package/.output/server/_libs/react-style-singleton.mjs +0 -69
- package/.output/server/_libs/remark-parse.mjs +0 -19
- package/.output/server/_libs/remark-rehype.mjs +0 -21
- package/.output/server/_libs/space-separated-tokens.mjs +0 -6
- package/.output/server/_libs/style-to-js.mjs +0 -72
- package/.output/server/_libs/style-to-object.mjs +0 -38
- package/.output/server/_libs/swr.mjs +0 -947
- package/.output/server/_libs/tailwind-merge.mjs +0 -3255
- package/.output/server/_libs/tanstack__react-virtual.mjs +0 -130
- package/.output/server/_libs/tanstack__virtual-core.mjs +0 -1319
- package/.output/server/_libs/three.mjs +0 -26016
- package/.output/server/_libs/trim-lines.mjs +0 -41
- package/.output/server/_libs/trough.mjs +0 -85
- package/.output/server/_libs/tslib.mjs +0 -1
- package/.output/server/_libs/ungap__structured-clone.mjs +0 -212
- package/.output/server/_libs/unified.mjs +0 -661
- package/.output/server/_libs/unist-util-is.mjs +0 -100
- package/.output/server/_libs/unist-util-position.mjs +0 -27
- package/.output/server/_libs/unist-util-stringify-position.mjs +0 -27
- package/.output/server/_libs/unist-util-visit-parents.mjs +0 -82
- package/.output/server/_libs/unist-util-visit.mjs +0 -24
- package/.output/server/_libs/use-callback-ref.mjs +0 -66
- package/.output/server/_libs/use-sidecar.mjs +0 -106
- package/.output/server/_libs/vfile-message.mjs +0 -138
- package/.output/server/_libs/vfile.mjs +0 -467
- package/.output/server/_sessionId-E_Dmopc-.mjs +0 -144
- package/.output/server/_sessionId-U54BAqdp.mjs +0 -82
- package/.output/server/_ssr/CompareDrawer-CksatPed.mjs +0 -1058
- package/.output/server/_ssr/InspectorPet-DNc4GQ7z.mjs +0 -936
- package/.output/server/_ssr/ProxyViewerContainer-B02Ey0p_.mjs +0 -17607
- package/.output/server/_ssr/ReplayDialog-DdMvHJF1.mjs +0 -723
- package/.output/server/_ssr/RequestAnatomy--vh2Z8__.mjs +0 -835
- package/.output/server/_ssr/ResponseView-Dhxc-cKC.mjs +0 -755
- package/.output/server/_ssr/StreamingChunkSequence-BG0EQmaD.mjs +0 -272
- package/.output/server/_ssr/index-D0At9nfd.mjs +0 -82
- package/.output/server/_ssr/index-lcfulIXa.mjs +0 -133
- package/.output/server/_ssr/json-viewer-My1J1_5R.mjs +0 -481
- package/.output/server/_ssr/start-HYkvq4Ni.mjs +0 -4
- package/.output/server/_tanstack-start-manifest_v-B2chR8ef.mjs +0 -4
- package/.output/server/node_modules/tslib/modules/index.js +0 -70
- package/.output/server/node_modules/tslib/modules/package.json +0 -3
- package/.output/server/node_modules/tslib/package.json +0 -47
- package/.output/server/node_modules/tslib/tslib.js +0 -484
- package/.output/server/package.json +0 -9
- package/src/routes/__root.tsx +0 -170
- /package/.output/{public → ui}/assets/agent-inspector-58K1_MsC.ico +0 -0
- /package/.output/{public → ui}/assets/alibaba-TTwafVwX.svg +0 -0
- /package/.output/{public → ui}/assets/minimax-BPMzvuL-.jpeg +0 -0
- /package/.output/{public → ui}/assets/qwen-mMn3f5ul.webp +0 -0
- /package/.output/{public → ui}/assets/zhipuai-BPNAnxo-.svg +0 -0
- /package/src/{routes → backend/routes}/livez.ts +0 -0
|
@@ -1,936 +0,0 @@
|
|
|
1
|
-
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import { r as reactDomExports } from "../_libs/react-dom.mjs";
|
|
3
|
-
import { m as cn, ad as CrabLogo } from "./router-DWcUFPR3.mjs";
|
|
4
|
-
import { W as WebGLRenderer, S as SRGBColorSpace, A as ACESFilmicToneMapping, a as Scene, O as OrthographicCamera, M as MeshPhysicalMaterial, C as Color, G as Group, b as Mesh, c as CircleGeometry, d as MeshBasicMaterial, e as SphereGeometry, f as AmbientLight, H as HemisphereLight, D as DirectionalLight, P as PointLight, V as Vector3, g as CylinderGeometry } from "../_libs/three.mjs";
|
|
5
|
-
import "node:crypto";
|
|
6
|
-
import "node:path";
|
|
7
|
-
import "node:fs";
|
|
8
|
-
import "node:child_process";
|
|
9
|
-
import "node:buffer";
|
|
10
|
-
import "node:url";
|
|
11
|
-
import "crypto";
|
|
12
|
-
import "node:util";
|
|
13
|
-
import "node:net";
|
|
14
|
-
import "../_libs/modelcontextprotocol__server.mjs";
|
|
15
|
-
import "../_libs/jszip.mjs";
|
|
16
|
-
import "node:os";
|
|
17
|
-
import { aI as Heart, aJ as Pause, aK as Play } from "../_libs/lucide-react.mjs";
|
|
18
|
-
import "util";
|
|
19
|
-
import "async_hooks";
|
|
20
|
-
import "stream";
|
|
21
|
-
import "../_libs/tanstack__react-router.mjs";
|
|
22
|
-
import "../_libs/tanstack__router-core.mjs";
|
|
23
|
-
import "../_libs/cookie-es.mjs";
|
|
24
|
-
import "../_libs/seroval.mjs";
|
|
25
|
-
import "../_libs/seroval-plugins.mjs";
|
|
26
|
-
import "node:stream";
|
|
27
|
-
import "../_libs/tanstack__history.mjs";
|
|
28
|
-
import "node:stream/web";
|
|
29
|
-
import "../_libs/isbot.mjs";
|
|
30
|
-
import "../_libs/swr.mjs";
|
|
31
|
-
import "../_libs/use-sync-external-store.mjs";
|
|
32
|
-
import "../_libs/dequal.mjs";
|
|
33
|
-
import "../_libs/class-variance-authority.mjs";
|
|
34
|
-
import "../_libs/clsx.mjs";
|
|
35
|
-
import "../_libs/tailwind-merge.mjs";
|
|
36
|
-
import "node:fs/promises";
|
|
37
|
-
import "node:worker_threads";
|
|
38
|
-
import "node:readline";
|
|
39
|
-
import "../_libs/conf.mjs";
|
|
40
|
-
import "node:process";
|
|
41
|
-
import "node:assert";
|
|
42
|
-
import "../_libs/dot-prop.mjs";
|
|
43
|
-
import "../_libs/env-paths.mjs";
|
|
44
|
-
import "../_libs/atomically.mjs";
|
|
45
|
-
import "node:events";
|
|
46
|
-
import "../_libs/stubborn-fs.mjs";
|
|
47
|
-
import "../_libs/stubborn-utils.mjs";
|
|
48
|
-
import "../_libs/when-exit.mjs";
|
|
49
|
-
import "../_libs/ajv.mjs";
|
|
50
|
-
import "../_libs/fast-deep-equal.mjs";
|
|
51
|
-
import "../_libs/json-schema-traverse.mjs";
|
|
52
|
-
import "../_libs/fast-uri.mjs";
|
|
53
|
-
import "../_libs/ajv-formats.mjs";
|
|
54
|
-
import "../_libs/debounce-fn.mjs";
|
|
55
|
-
import "../_libs/mimic-function.mjs";
|
|
56
|
-
import "../_libs/semver.mjs";
|
|
57
|
-
import "../_libs/uint8array-extras.mjs";
|
|
58
|
-
import "node:dns/promises";
|
|
59
|
-
import "node:assert/strict";
|
|
60
|
-
import "../_libs/zod.mjs";
|
|
61
|
-
import "../_libs/modelcontextprotocol__core.mjs";
|
|
62
|
-
import "../_libs/readable-stream.mjs";
|
|
63
|
-
import "events";
|
|
64
|
-
import "node:string_decoder";
|
|
65
|
-
import "../_libs/process-nextick-args.mjs";
|
|
66
|
-
import "../_libs/isarray.mjs";
|
|
67
|
-
import "../_libs/safe-buffer.mjs";
|
|
68
|
-
import "buffer";
|
|
69
|
-
import "../_libs/core-util-is.mjs";
|
|
70
|
-
import "../_libs/inherits.mjs";
|
|
71
|
-
import "../_libs/util-deprecate.mjs";
|
|
72
|
-
import "../_libs/lie.mjs";
|
|
73
|
-
import "../_libs/immediate.mjs";
|
|
74
|
-
import "../_libs/setimmediate.mjs";
|
|
75
|
-
import "../_libs/pako.mjs";
|
|
76
|
-
const INSPECTOR_PET_SIZE = 112;
|
|
77
|
-
const INSPECTOR_PET_MARGIN = 14;
|
|
78
|
-
const INSPECTOR_PET_EDGE_GAP = 20;
|
|
79
|
-
const INSPECTOR_PET_MIN_STEP = 36;
|
|
80
|
-
const INSPECTOR_PET_MAX_STEP = 92;
|
|
81
|
-
const INSPECTOR_PET_SLEEP_AFTER_MS = 45e3;
|
|
82
|
-
const INSPECTOR_PET_PANEL_WIDTH = 192;
|
|
83
|
-
const INSPECTOR_PET_PANEL_HEIGHT = 68;
|
|
84
|
-
const INSPECTOR_PET_PANEL_GAP = 10;
|
|
85
|
-
const INSPECTOR_PET_VERTICAL_SAFE_MARGIN = 78;
|
|
86
|
-
function viewportScale(viewport) {
|
|
87
|
-
const scale = viewport.scale ?? 1;
|
|
88
|
-
return Number.isFinite(scale) && scale > 0 ? scale : 1;
|
|
89
|
-
}
|
|
90
|
-
function scaledMetric(value, viewport) {
|
|
91
|
-
return value * viewportScale(viewport);
|
|
92
|
-
}
|
|
93
|
-
function clampUnit(value) {
|
|
94
|
-
return Math.min(Math.max(value, 0), 1);
|
|
95
|
-
}
|
|
96
|
-
function maximumPetX(viewport) {
|
|
97
|
-
const edgeGap = scaledMetric(INSPECTOR_PET_EDGE_GAP, viewport);
|
|
98
|
-
return Math.max(edgeGap, viewport.width - scaledMetric(INSPECTOR_PET_SIZE, viewport) - edgeGap);
|
|
99
|
-
}
|
|
100
|
-
function maximumPetY(viewport) {
|
|
101
|
-
const edgeGap = scaledMetric(INSPECTOR_PET_EDGE_GAP, viewport);
|
|
102
|
-
return Math.max(edgeGap, viewport.height - scaledMetric(INSPECTOR_PET_SIZE, viewport) - edgeGap);
|
|
103
|
-
}
|
|
104
|
-
function clampInspectorPetPosition(position, viewport) {
|
|
105
|
-
const edgeGap = scaledMetric(INSPECTOR_PET_EDGE_GAP, viewport);
|
|
106
|
-
return {
|
|
107
|
-
x: Math.min(Math.max(position.x, edgeGap), maximumPetX(viewport)),
|
|
108
|
-
y: Math.min(Math.max(position.y, edgeGap), maximumPetY(viewport))
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function nearestInspectorPetEdge(position, viewport) {
|
|
112
|
-
const clamped = clampInspectorPetPosition(position, viewport);
|
|
113
|
-
const edgeGap = scaledMetric(INSPECTOR_PET_EDGE_GAP, viewport);
|
|
114
|
-
const distances = [
|
|
115
|
-
{ edge: "left", distance: clamped.x - edgeGap },
|
|
116
|
-
{ edge: "right", distance: maximumPetX(viewport) - clamped.x },
|
|
117
|
-
{ edge: "top", distance: clamped.y - edgeGap },
|
|
118
|
-
{ edge: "bottom", distance: maximumPetY(viewport) - clamped.y }
|
|
119
|
-
];
|
|
120
|
-
return distances.reduce((best, current) => current.distance < best.distance ? current : best).edge;
|
|
121
|
-
}
|
|
122
|
-
function snapInspectorPetToEdge(position, viewport) {
|
|
123
|
-
const clamped = clampInspectorPetPosition(position, viewport);
|
|
124
|
-
const edge = nearestInspectorPetEdge(clamped, viewport);
|
|
125
|
-
const edgeGap = scaledMetric(INSPECTOR_PET_EDGE_GAP, viewport);
|
|
126
|
-
switch (edge) {
|
|
127
|
-
case "left":
|
|
128
|
-
return { x: edgeGap, y: clamped.y };
|
|
129
|
-
case "right":
|
|
130
|
-
return { x: maximumPetX(viewport), y: clamped.y };
|
|
131
|
-
case "top":
|
|
132
|
-
return { x: clamped.x, y: edgeGap };
|
|
133
|
-
case "bottom":
|
|
134
|
-
return { x: clamped.x, y: maximumPetY(viewport) };
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
function snapInspectorPetToCorner(position, viewport) {
|
|
138
|
-
const clamped = clampInspectorPetPosition(position, viewport);
|
|
139
|
-
const edgeGap = scaledMetric(INSPECTOR_PET_EDGE_GAP, viewport);
|
|
140
|
-
const maxX = maximumPetX(viewport);
|
|
141
|
-
const maxY = maximumPetY(viewport);
|
|
142
|
-
return {
|
|
143
|
-
x: clamped.x - edgeGap <= maxX - clamped.x ? edgeGap : maxX,
|
|
144
|
-
y: clamped.y - edgeGap <= maxY - clamped.y ? edgeGap : maxY
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function randomInspectorPetEdgePosition(viewport, positionSample) {
|
|
148
|
-
const maxX = maximumPetX(viewport);
|
|
149
|
-
const maxY = maximumPetY(viewport);
|
|
150
|
-
const edgeGap = scaledMetric(INSPECTOR_PET_EDGE_GAP, viewport);
|
|
151
|
-
return {
|
|
152
|
-
x: clampUnit(positionSample) < 0.5 ? edgeGap : maxX,
|
|
153
|
-
y: maxY
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function nextInspectorPetWalkingPosition(position, viewport, stepSample, directionSample) {
|
|
157
|
-
const clamped = snapInspectorPetToEdge(position, viewport);
|
|
158
|
-
const step = scaledMetric(INSPECTOR_PET_MIN_STEP, viewport) + clampUnit(stepSample) * scaledMetric(INSPECTOR_PET_MAX_STEP - INSPECTOR_PET_MIN_STEP, viewport);
|
|
159
|
-
const direction = directionSample >= 0.5 ? 1 : -1;
|
|
160
|
-
const edge = nearestInspectorPetEdge(clamped, viewport);
|
|
161
|
-
const maxX = maximumPetX(viewport);
|
|
162
|
-
const maxY = maximumPetY(viewport);
|
|
163
|
-
const edgeGap = scaledMetric(INSPECTOR_PET_EDGE_GAP, viewport);
|
|
164
|
-
const minimumSafeY = Math.min(scaledMetric(INSPECTOR_PET_VERTICAL_SAFE_MARGIN, viewport), maxY);
|
|
165
|
-
switch (edge) {
|
|
166
|
-
case "left":
|
|
167
|
-
return {
|
|
168
|
-
x: edgeGap,
|
|
169
|
-
y: Math.min(Math.max(clamped.y + step * direction, minimumSafeY), maxY)
|
|
170
|
-
};
|
|
171
|
-
case "right":
|
|
172
|
-
return {
|
|
173
|
-
x: maxX,
|
|
174
|
-
y: Math.min(Math.max(clamped.y + step * direction, minimumSafeY), maxY)
|
|
175
|
-
};
|
|
176
|
-
case "top":
|
|
177
|
-
return {
|
|
178
|
-
x: Math.min(Math.max(clamped.x + step * direction, edgeGap), maxX),
|
|
179
|
-
y: edgeGap
|
|
180
|
-
};
|
|
181
|
-
case "bottom":
|
|
182
|
-
return {
|
|
183
|
-
x: Math.min(Math.max(clamped.x + step * direction, edgeGap), maxX),
|
|
184
|
-
y: maxY
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function inspectorPetPanelPosition(position, viewport) {
|
|
189
|
-
const edge = nearestInspectorPetEdge(position, viewport);
|
|
190
|
-
const petSize = scaledMetric(INSPECTOR_PET_SIZE, viewport);
|
|
191
|
-
const panelWidth = scaledMetric(INSPECTOR_PET_PANEL_WIDTH, viewport);
|
|
192
|
-
const panelHeight = scaledMetric(INSPECTOR_PET_PANEL_HEIGHT, viewport);
|
|
193
|
-
const panelGap = scaledMetric(INSPECTOR_PET_PANEL_GAP, viewport);
|
|
194
|
-
const margin = scaledMetric(INSPECTOR_PET_MARGIN, viewport);
|
|
195
|
-
let x = position.x + petSize / 2 - panelWidth / 2;
|
|
196
|
-
let y = position.y + petSize / 2 - panelHeight / 2;
|
|
197
|
-
switch (edge) {
|
|
198
|
-
case "left":
|
|
199
|
-
x = position.x + petSize + panelGap;
|
|
200
|
-
break;
|
|
201
|
-
case "right":
|
|
202
|
-
x = position.x - panelWidth - panelGap;
|
|
203
|
-
break;
|
|
204
|
-
case "top":
|
|
205
|
-
y = position.y + petSize + panelGap;
|
|
206
|
-
break;
|
|
207
|
-
case "bottom":
|
|
208
|
-
y = position.y - panelHeight - panelGap;
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
return {
|
|
212
|
-
x: Math.min(Math.max(x, margin), Math.max(margin, viewport.width - panelWidth - margin)),
|
|
213
|
-
y: Math.min(Math.max(y, margin), Math.max(margin, viewport.height - panelHeight - margin))
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
function latestCapturedLog(logs) {
|
|
217
|
-
let latest = null;
|
|
218
|
-
for (const log of logs) {
|
|
219
|
-
if (latest === null || log.id > latest.id) latest = log;
|
|
220
|
-
}
|
|
221
|
-
return latest;
|
|
222
|
-
}
|
|
223
|
-
function logNeedsAttention(log) {
|
|
224
|
-
const hasHttpError = log.responseStatus !== null && log.responseStatus >= 400;
|
|
225
|
-
const hasStreamError = log.error !== null && log.error !== void 0 && log.error !== "";
|
|
226
|
-
return hasHttpError || hasStreamError;
|
|
227
|
-
}
|
|
228
|
-
function resolveInspectorPetStatus(logs, nowMs) {
|
|
229
|
-
const pendingCount = logs.filter((log) => log.responseStatus === null).length;
|
|
230
|
-
const capturedCount = logs.length;
|
|
231
|
-
if (pendingCount > 0) {
|
|
232
|
-
return {
|
|
233
|
-
mood: "active",
|
|
234
|
-
label: `${String(pendingCount)} request${pendingCount === 1 ? "" : "s"} in flight`,
|
|
235
|
-
pendingCount,
|
|
236
|
-
capturedCount
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
const latest = latestCapturedLog(logs);
|
|
240
|
-
if (latest !== null && logNeedsAttention(latest)) {
|
|
241
|
-
return {
|
|
242
|
-
mood: "attention",
|
|
243
|
-
label: "Latest request needs attention",
|
|
244
|
-
pendingCount,
|
|
245
|
-
capturedCount
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
if (latest === null) {
|
|
249
|
-
return {
|
|
250
|
-
mood: "idle",
|
|
251
|
-
label: "Waiting for traffic",
|
|
252
|
-
pendingCount,
|
|
253
|
-
capturedCount
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
const latestTimestamp = Date.parse(latest.timestamp);
|
|
257
|
-
if (Number.isFinite(latestTimestamp) && nowMs - latestTimestamp >= INSPECTOR_PET_SLEEP_AFTER_MS) {
|
|
258
|
-
return {
|
|
259
|
-
mood: "sleeping",
|
|
260
|
-
label: "All quiet",
|
|
261
|
-
pendingCount,
|
|
262
|
-
capturedCount
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
return {
|
|
266
|
-
mood: "idle",
|
|
267
|
-
label: "Watching the session",
|
|
268
|
-
pendingCount,
|
|
269
|
-
capturedCount
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
function createRod(start, end, radius, material) {
|
|
273
|
-
const direction = end.clone().sub(start);
|
|
274
|
-
const length = direction.length();
|
|
275
|
-
const rod = new Mesh(new CylinderGeometry(radius, radius * 0.9, length, 12), material);
|
|
276
|
-
rod.position.copy(start.clone().add(end).multiplyScalar(0.5));
|
|
277
|
-
rod.quaternion.setFromUnitVectors(new Vector3(0, 1, 0), direction.normalize());
|
|
278
|
-
return rod;
|
|
279
|
-
}
|
|
280
|
-
function addClaw(root, side, shellMaterial, accentMaterial) {
|
|
281
|
-
const clawScale = side < 0 ? 1.5 : 0.68;
|
|
282
|
-
const clawGroup = new Group();
|
|
283
|
-
const pincers = [];
|
|
284
|
-
root.add(clawGroup);
|
|
285
|
-
const shoulder = new Vector3(side * 1.2, 0.25, -0.05);
|
|
286
|
-
const wrist = new Vector3(side * (1.65 + clawScale * 0.18), 0.5, 0);
|
|
287
|
-
const arm = createRod(shoulder, wrist, 0.16 * clawScale, accentMaterial);
|
|
288
|
-
clawGroup.add(arm);
|
|
289
|
-
const palm = new Mesh(new SphereGeometry(0.55, 24, 16), shellMaterial);
|
|
290
|
-
palm.position.set(side * (1.95 + clawScale * 0.16), 0.62, 0.05);
|
|
291
|
-
palm.scale.set(1.05 * clawScale, 0.72 * clawScale, 0.55 * clawScale);
|
|
292
|
-
clawGroup.add(palm);
|
|
293
|
-
for (const pincerDirection of [-1, 1]) {
|
|
294
|
-
const pincer = new Mesh(new SphereGeometry(0.36, 20, 14), accentMaterial);
|
|
295
|
-
pincer.position.set(
|
|
296
|
-
side * (2.22 + clawScale * 0.26),
|
|
297
|
-
0.62 + pincerDirection * 0.24 * clawScale,
|
|
298
|
-
0.08
|
|
299
|
-
);
|
|
300
|
-
pincer.scale.set(1.05 * clawScale, 0.34 * clawScale, 0.42 * clawScale);
|
|
301
|
-
pincer.rotation.z = pincerDirection * side * 0.42;
|
|
302
|
-
clawGroup.add(pincer);
|
|
303
|
-
pincers.push({
|
|
304
|
-
direction: pincerDirection,
|
|
305
|
-
mesh: pincer,
|
|
306
|
-
restRotationZ: pincer.rotation.z,
|
|
307
|
-
restY: pincer.position.y
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
return { group: clawGroup, pincers, scale: clawScale };
|
|
311
|
-
}
|
|
312
|
-
function pinchPulse(cycleTime, start, duration) {
|
|
313
|
-
const progress = (cycleTime - start) / duration;
|
|
314
|
-
if (progress <= 0 || progress >= 1) return 0;
|
|
315
|
-
return Math.sin(progress * Math.PI);
|
|
316
|
-
}
|
|
317
|
-
function dominantClawGrip(elapsed) {
|
|
318
|
-
const cycleTime = elapsed % 6.8;
|
|
319
|
-
return Math.max(pinchPulse(cycleTime, 0.72, 0.82), pinchPulse(cycleTime, 1.72, 0.68));
|
|
320
|
-
}
|
|
321
|
-
function addEyes(root, shellMaterial, eyeMaterial) {
|
|
322
|
-
const eyes = [];
|
|
323
|
-
for (const side of [-1, 1]) {
|
|
324
|
-
const stalkStart = new Vector3(side * 0.48, 0.68, 0.05);
|
|
325
|
-
const stalkEnd = new Vector3(side * 0.1, 0.82, 0.07);
|
|
326
|
-
const eyeGroup = new Group();
|
|
327
|
-
eyeGroup.position.copy(stalkStart);
|
|
328
|
-
eyeGroup.add(createRod(new Vector3(0, 0, 0), stalkEnd, 0.1, shellMaterial));
|
|
329
|
-
const eye = new Mesh(new SphereGeometry(0.24, 20, 16), eyeMaterial);
|
|
330
|
-
eye.position.copy(stalkEnd);
|
|
331
|
-
eye.scale.set(1, 1, 0.85);
|
|
332
|
-
eyeGroup.add(eye);
|
|
333
|
-
const pupil = new Mesh(
|
|
334
|
-
new SphereGeometry(0.105, 16, 12),
|
|
335
|
-
new MeshPhysicalMaterial({ color: 1120295, roughness: 0.25 })
|
|
336
|
-
);
|
|
337
|
-
const pupilRest = new Vector3(stalkEnd.x, stalkEnd.y, stalkEnd.z + 0.2);
|
|
338
|
-
pupil.position.copy(pupilRest);
|
|
339
|
-
eyeGroup.add(pupil);
|
|
340
|
-
root.add(eyeGroup);
|
|
341
|
-
eyes.push({
|
|
342
|
-
group: eyeGroup,
|
|
343
|
-
phase: side < 0 ? 0 : Math.PI / 3,
|
|
344
|
-
pupil,
|
|
345
|
-
pupilRest
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
return eyes;
|
|
349
|
-
}
|
|
350
|
-
function addLegs(root, legMaterial) {
|
|
351
|
-
const legs = [];
|
|
352
|
-
for (const side of [-1, 1]) {
|
|
353
|
-
for (let index = 0; index < 4; index += 1) {
|
|
354
|
-
const leg = new Group();
|
|
355
|
-
const baseY = -0.3 - index * 0.22;
|
|
356
|
-
leg.position.set(side * (0.8 + index * 0.12), baseY, -0.18);
|
|
357
|
-
leg.add(
|
|
358
|
-
createRod(
|
|
359
|
-
new Vector3(0, 0, 0),
|
|
360
|
-
new Vector3(side * (0.62 + index * 0.06), -0.34, 0),
|
|
361
|
-
0.095,
|
|
362
|
-
legMaterial
|
|
363
|
-
)
|
|
364
|
-
);
|
|
365
|
-
leg.add(
|
|
366
|
-
createRod(
|
|
367
|
-
new Vector3(side * (0.58 + index * 0.06), -0.31, 0),
|
|
368
|
-
new Vector3(side * (1.02 + index * 0.08), -0.88 + index * 0.07, 0.04),
|
|
369
|
-
0.075,
|
|
370
|
-
legMaterial
|
|
371
|
-
)
|
|
372
|
-
);
|
|
373
|
-
root.add(leg);
|
|
374
|
-
legs.push({ group: leg, phase: index * Math.PI + (side > 0 ? Math.PI / 2 : 0), side });
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
return legs;
|
|
378
|
-
}
|
|
379
|
-
function createCrabScene(scene) {
|
|
380
|
-
const shellMaterial = new MeshPhysicalMaterial({
|
|
381
|
-
color: 16096779,
|
|
382
|
-
roughness: 0.34,
|
|
383
|
-
metalness: 0.04,
|
|
384
|
-
clearcoat: 0.78,
|
|
385
|
-
clearcoatRoughness: 0.18,
|
|
386
|
-
emissive: new Color(0),
|
|
387
|
-
emissiveIntensity: 0
|
|
388
|
-
});
|
|
389
|
-
const accentMaterial = new MeshPhysicalMaterial({
|
|
390
|
-
color: 16486972,
|
|
391
|
-
roughness: 0.42,
|
|
392
|
-
metalness: 0.02,
|
|
393
|
-
clearcoat: 0.52,
|
|
394
|
-
clearcoatRoughness: 0.28
|
|
395
|
-
});
|
|
396
|
-
const legMaterial = new MeshPhysicalMaterial({
|
|
397
|
-
color: 14251782,
|
|
398
|
-
roughness: 0.48,
|
|
399
|
-
clearcoat: 0.35,
|
|
400
|
-
clearcoatRoughness: 0.35
|
|
401
|
-
});
|
|
402
|
-
const eyeMaterial = new MeshPhysicalMaterial({
|
|
403
|
-
color: 16776171,
|
|
404
|
-
roughness: 0.22,
|
|
405
|
-
clearcoat: 0.8,
|
|
406
|
-
clearcoatRoughness: 0.12
|
|
407
|
-
});
|
|
408
|
-
const root = new Group();
|
|
409
|
-
root.rotation.x = -0.12;
|
|
410
|
-
root.rotation.y = -0.08;
|
|
411
|
-
root.scale.setScalar(1.08);
|
|
412
|
-
scene.add(root);
|
|
413
|
-
const shadow = new Mesh(
|
|
414
|
-
new CircleGeometry(1.65, 40),
|
|
415
|
-
new MeshBasicMaterial({ color: 1120295, transparent: true, opacity: 0.16, depthWrite: false })
|
|
416
|
-
);
|
|
417
|
-
shadow.position.set(0, -1.33, -0.65);
|
|
418
|
-
shadow.scale.set(1.4, 0.34, 1);
|
|
419
|
-
root.add(shadow);
|
|
420
|
-
const body = new Mesh(new SphereGeometry(1, 36, 24), shellMaterial);
|
|
421
|
-
body.position.set(0, 0.02, 0);
|
|
422
|
-
body.scale.set(1.58, 0.92, 0.68);
|
|
423
|
-
root.add(body);
|
|
424
|
-
const lowerShell = new Mesh(new SphereGeometry(0.92, 28, 20), accentMaterial);
|
|
425
|
-
lowerShell.position.set(0, -0.48, 0.22);
|
|
426
|
-
lowerShell.scale.set(1.28, 0.42, 0.56);
|
|
427
|
-
root.add(lowerShell);
|
|
428
|
-
const dominantClaw = addClaw(root, -1, shellMaterial, accentMaterial);
|
|
429
|
-
addClaw(root, 1, shellMaterial, accentMaterial);
|
|
430
|
-
const eyes = addEyes(root, shellMaterial, eyeMaterial);
|
|
431
|
-
const legs = addLegs(root, legMaterial);
|
|
432
|
-
scene.add(new AmbientLight(16775149, 1.65));
|
|
433
|
-
scene.add(new HemisphereLight(16775149, 1515571, 2.15));
|
|
434
|
-
const keyLight = new DirectionalLight(16777215, 3.6);
|
|
435
|
-
keyLight.position.set(3.5, 4.5, 6);
|
|
436
|
-
scene.add(keyLight);
|
|
437
|
-
const fillLight = new DirectionalLight(16498468, 1.35);
|
|
438
|
-
fillLight.position.set(-4, 1.5, 4);
|
|
439
|
-
scene.add(fillLight);
|
|
440
|
-
const rimLight = new PointLight(16096779, 1.8, 12, 2);
|
|
441
|
-
rimLight.position.set(0, 1.8, 4.5);
|
|
442
|
-
scene.add(rimLight);
|
|
443
|
-
return { bodyMaterial: shellMaterial, dominantClaw, eyes, legs, rimLight, root };
|
|
444
|
-
}
|
|
445
|
-
function moodColor(mood) {
|
|
446
|
-
switch (mood) {
|
|
447
|
-
case "active":
|
|
448
|
-
return 2282478;
|
|
449
|
-
case "attention":
|
|
450
|
-
return 15680580;
|
|
451
|
-
case "idle":
|
|
452
|
-
return 16096779;
|
|
453
|
-
case "sleeping":
|
|
454
|
-
return 9741240;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
function isDisposableMesh(object) {
|
|
458
|
-
return object instanceof Mesh;
|
|
459
|
-
}
|
|
460
|
-
function disposeScene(scene) {
|
|
461
|
-
const materials = /* @__PURE__ */ new Set();
|
|
462
|
-
scene.traverse((object) => {
|
|
463
|
-
if (!isDisposableMesh(object)) return;
|
|
464
|
-
object.geometry.dispose();
|
|
465
|
-
const material = object.material;
|
|
466
|
-
if (Array.isArray(material)) {
|
|
467
|
-
for (const item of material) materials.add(item);
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
materials.add(material);
|
|
471
|
-
});
|
|
472
|
-
for (const material of materials) material.dispose();
|
|
473
|
-
}
|
|
474
|
-
function InspectorPetCrab3D({
|
|
475
|
-
mood,
|
|
476
|
-
moving,
|
|
477
|
-
reduceMotion
|
|
478
|
-
}) {
|
|
479
|
-
const canvasRef = reactExports.useRef(null);
|
|
480
|
-
const moodRef = reactExports.useRef(mood);
|
|
481
|
-
const movingRef = reactExports.useRef(moving);
|
|
482
|
-
const reduceMotionRef = reactExports.useRef(reduceMotion);
|
|
483
|
-
const [renderFailed, setRenderFailed] = reactExports.useState(false);
|
|
484
|
-
reactExports.useEffect(() => {
|
|
485
|
-
moodRef.current = mood;
|
|
486
|
-
}, [mood]);
|
|
487
|
-
reactExports.useEffect(() => {
|
|
488
|
-
movingRef.current = moving;
|
|
489
|
-
}, [moving]);
|
|
490
|
-
reactExports.useEffect(() => {
|
|
491
|
-
reduceMotionRef.current = reduceMotion;
|
|
492
|
-
}, [reduceMotion]);
|
|
493
|
-
reactExports.useEffect(() => {
|
|
494
|
-
const canvas = canvasRef.current;
|
|
495
|
-
if (canvas === null) return void 0;
|
|
496
|
-
let renderer;
|
|
497
|
-
try {
|
|
498
|
-
renderer = new WebGLRenderer({
|
|
499
|
-
alpha: true,
|
|
500
|
-
antialias: true,
|
|
501
|
-
canvas,
|
|
502
|
-
powerPreference: "low-power",
|
|
503
|
-
preserveDrawingBuffer: true
|
|
504
|
-
});
|
|
505
|
-
} catch {
|
|
506
|
-
setRenderFailed(true);
|
|
507
|
-
return void 0;
|
|
508
|
-
}
|
|
509
|
-
renderer.setClearColor(0, 0);
|
|
510
|
-
renderer.outputColorSpace = SRGBColorSpace;
|
|
511
|
-
renderer.toneMapping = ACESFilmicToneMapping;
|
|
512
|
-
renderer.toneMappingExposure = 1.18;
|
|
513
|
-
const scene = new Scene();
|
|
514
|
-
const camera = new OrthographicCamera(-3.65, 3.65, 3.65, -3.65, 0.1, 20);
|
|
515
|
-
camera.position.set(0, 0.05, 8);
|
|
516
|
-
camera.lookAt(0, 0, 0);
|
|
517
|
-
const parts = createCrabScene(scene);
|
|
518
|
-
const startedAt = window.performance.now();
|
|
519
|
-
let lastFrameAt = 0;
|
|
520
|
-
const renderFrame = (timestamp) => {
|
|
521
|
-
if (timestamp - lastFrameAt < 32) return;
|
|
522
|
-
lastFrameAt = timestamp;
|
|
523
|
-
const elapsed = (timestamp - startedAt) / 1e3;
|
|
524
|
-
const motionAllowed = !reduceMotionRef.current;
|
|
525
|
-
const gait = movingRef.current ? 1 : moodRef.current === "active" ? 0.42 : 0;
|
|
526
|
-
const idleMotion = motionAllowed ? Math.sin(elapsed * 0.85) : 0;
|
|
527
|
-
const stepMotion = motionAllowed ? Math.sin(elapsed * 3.4) : 0;
|
|
528
|
-
const clawGrip = motionAllowed ? dominantClawGrip(elapsed) : 0;
|
|
529
|
-
parts.root.position.y = idleMotion * 0.035 + Math.abs(stepMotion) * 0.055 * gait;
|
|
530
|
-
parts.root.rotation.y = -0.08 + idleMotion * 0.055;
|
|
531
|
-
parts.root.rotation.z = stepMotion * 0.028 * gait;
|
|
532
|
-
parts.dominantClaw.group.rotation.z = -clawGrip * 0.035;
|
|
533
|
-
for (const pincer of parts.dominantClaw.pincers) {
|
|
534
|
-
pincer.mesh.position.y = pincer.restY - pincer.direction * parts.dominantClaw.scale * 0.16 * clawGrip;
|
|
535
|
-
pincer.mesh.rotation.z = pincer.restRotationZ * (1 - clawGrip * 0.72);
|
|
536
|
-
}
|
|
537
|
-
for (const leg of parts.legs) {
|
|
538
|
-
leg.group.rotation.z = motionAllowed && gait > 0 ? Math.sin(elapsed * 4.25 + leg.phase) * 0.2 * leg.side * gait : 0;
|
|
539
|
-
leg.group.rotation.x = motionAllowed && gait > 0 ? stepMotion * 0.045 * gait : 0;
|
|
540
|
-
}
|
|
541
|
-
for (const eye of parts.eyes) {
|
|
542
|
-
const gaze = motionAllowed ? Math.sin(elapsed * 0.72 + eye.phase) : 0;
|
|
543
|
-
const lift = motionAllowed ? Math.cos(elapsed * 0.9 + eye.phase) : 0;
|
|
544
|
-
eye.group.rotation.z = gaze * 0.075;
|
|
545
|
-
eye.group.rotation.x = lift * 0.025;
|
|
546
|
-
eye.pupil.position.set(
|
|
547
|
-
eye.pupilRest.x + gaze * 0.055,
|
|
548
|
-
eye.pupilRest.y + lift * 0.025,
|
|
549
|
-
eye.pupilRest.z
|
|
550
|
-
);
|
|
551
|
-
}
|
|
552
|
-
const color = moodColor(moodRef.current);
|
|
553
|
-
parts.rimLight.color.setHex(color);
|
|
554
|
-
parts.rimLight.intensity = moodRef.current === "attention" ? 3.2 : 1.8;
|
|
555
|
-
parts.bodyMaterial.emissive.setHex(color);
|
|
556
|
-
parts.bodyMaterial.emissiveIntensity = moodRef.current === "active" ? 0.12 : 0.035;
|
|
557
|
-
renderer.render(scene, camera);
|
|
558
|
-
};
|
|
559
|
-
const resize = () => {
|
|
560
|
-
const width = Math.max(canvas.clientWidth, 1);
|
|
561
|
-
const height = Math.max(canvas.clientHeight, 1);
|
|
562
|
-
renderer.setDrawingBufferSize(width, height, Math.min(window.devicePixelRatio, 2));
|
|
563
|
-
renderer.render(scene, camera);
|
|
564
|
-
};
|
|
565
|
-
const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(resize);
|
|
566
|
-
if (resizeObserver === null) {
|
|
567
|
-
window.addEventListener("resize", resize);
|
|
568
|
-
} else {
|
|
569
|
-
resizeObserver.observe(canvas);
|
|
570
|
-
}
|
|
571
|
-
resize();
|
|
572
|
-
const handleContextLost = (event) => {
|
|
573
|
-
event.preventDefault();
|
|
574
|
-
setRenderFailed(true);
|
|
575
|
-
};
|
|
576
|
-
canvas.addEventListener("webglcontextlost", handleContextLost);
|
|
577
|
-
renderer.setAnimationLoop(renderFrame);
|
|
578
|
-
return () => {
|
|
579
|
-
renderer.setAnimationLoop(null);
|
|
580
|
-
if (resizeObserver === null) {
|
|
581
|
-
window.removeEventListener("resize", resize);
|
|
582
|
-
} else {
|
|
583
|
-
resizeObserver.disconnect();
|
|
584
|
-
}
|
|
585
|
-
canvas.removeEventListener("webglcontextlost", handleContextLost);
|
|
586
|
-
disposeScene(scene);
|
|
587
|
-
renderer.dispose();
|
|
588
|
-
};
|
|
589
|
-
}, []);
|
|
590
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "relative flex size-24 items-center justify-center", "aria-hidden": "true", children: [
|
|
591
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
592
|
-
"canvas",
|
|
593
|
-
{
|
|
594
|
-
ref: canvasRef,
|
|
595
|
-
className: renderFailed ? "hidden" : "block size-full bg-transparent",
|
|
596
|
-
"data-inspector-pet-canvas": "true"
|
|
597
|
-
}
|
|
598
|
-
),
|
|
599
|
-
renderFailed && /* @__PURE__ */ jsxRuntimeExports.jsx(CrabLogo, { className: "size-22 text-amber-500 drop-shadow-[0_0_18px_rgba(245,158,11,0.28)]" })
|
|
600
|
-
] });
|
|
601
|
-
}
|
|
602
|
-
const INSPECTOR_PET_ROAMING_STORAGE_KEY = "agent-inspector.pet.roaming";
|
|
603
|
-
const INSPECTOR_PET_MIN_PAUSE_MS = 11e3;
|
|
604
|
-
const INSPECTOR_PET_PAUSE_WINDOW_MS = 9e3;
|
|
605
|
-
const INSPECTOR_PET_SCUTTLE_MS = 7200;
|
|
606
|
-
const INSPECTOR_PET_PANEL_DISMISS_MS = 6e3;
|
|
607
|
-
const INSPECTOR_PET_REACTION_MS = 760;
|
|
608
|
-
const INSPECTOR_PET_DRAG_THRESHOLD = 4;
|
|
609
|
-
const INSPECTOR_PET_TOP_LAYER_Z_INDEX = 2147483647;
|
|
610
|
-
function readViewport() {
|
|
611
|
-
if (typeof window === "undefined") return { width: 1280, height: 720, scale: 1 };
|
|
612
|
-
const rawScale = window.getComputedStyle(document.documentElement).getPropertyValue("--inspector-ui-scale");
|
|
613
|
-
const parsedScale = Number.parseFloat(rawScale);
|
|
614
|
-
const scale = Number.isFinite(parsedScale) && parsedScale > 0 ? parsedScale : 1;
|
|
615
|
-
return {
|
|
616
|
-
width: Math.max(window.innerWidth, INSPECTOR_PET_MARGIN * 2),
|
|
617
|
-
height: Math.max(window.innerHeight, INSPECTOR_PET_MARGIN * 2),
|
|
618
|
-
scale
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
function readStoredRoaming() {
|
|
622
|
-
if (typeof window === "undefined") return false;
|
|
623
|
-
try {
|
|
624
|
-
return window.localStorage.getItem(INSPECTOR_PET_ROAMING_STORAGE_KEY) === "1";
|
|
625
|
-
} catch {
|
|
626
|
-
return false;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
function moodDotClass(mood) {
|
|
630
|
-
switch (mood) {
|
|
631
|
-
case "active":
|
|
632
|
-
return "bg-cyan-400 shadow-[0_0_9px_rgba(34,211,238,0.65)]";
|
|
633
|
-
case "attention":
|
|
634
|
-
return "bg-red-500 shadow-[0_0_9px_rgba(239,68,68,0.55)]";
|
|
635
|
-
case "idle":
|
|
636
|
-
return "bg-amber-400 shadow-[0_0_8px_rgba(251,191,36,0.45)]";
|
|
637
|
-
case "sleeping":
|
|
638
|
-
return "bg-muted-foreground/45";
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
function moodMotionClass(mood) {
|
|
642
|
-
switch (mood) {
|
|
643
|
-
case "active":
|
|
644
|
-
return "inspector-pet-active";
|
|
645
|
-
case "attention":
|
|
646
|
-
return "inspector-pet-attention";
|
|
647
|
-
case "idle":
|
|
648
|
-
return "";
|
|
649
|
-
case "sleeping":
|
|
650
|
-
return "inspector-pet-sleeping";
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
function InspectorPet({ logs }) {
|
|
654
|
-
const [portalHost, setPortalHost] = reactExports.useState(null);
|
|
655
|
-
const [viewport, setViewport] = reactExports.useState(readViewport);
|
|
656
|
-
const [position, setPosition] = reactExports.useState({
|
|
657
|
-
x: INSPECTOR_PET_MARGIN,
|
|
658
|
-
y: INSPECTOR_PET_MARGIN
|
|
659
|
-
});
|
|
660
|
-
const [clockMs, setClockMs] = reactExports.useState(() => Date.now());
|
|
661
|
-
const [scuttling, setScuttling] = reactExports.useState(false);
|
|
662
|
-
const [panelTick, setPanelTick] = reactExports.useState(0);
|
|
663
|
-
const [panelVisible, setPanelVisible] = reactExports.useState(false);
|
|
664
|
-
const [reactionTick, setReactionTick] = reactExports.useState(0);
|
|
665
|
-
const [reactionVisible, setReactionVisible] = reactExports.useState(false);
|
|
666
|
-
const [dragging, setDragging] = reactExports.useState(false);
|
|
667
|
-
const [roaming, setRoaming] = reactExports.useState(readStoredRoaming);
|
|
668
|
-
const [reduceMotion, setReduceMotion] = reactExports.useState(false);
|
|
669
|
-
const dragStateRef = reactExports.useRef(null);
|
|
670
|
-
const dragOccurredRef = reactExports.useRef(false);
|
|
671
|
-
const status = reactExports.useMemo(() => resolveInspectorPetStatus(logs, clockMs), [clockMs, logs]);
|
|
672
|
-
const panelPosition = reactExports.useMemo(
|
|
673
|
-
() => inspectorPetPanelPosition(position, viewport),
|
|
674
|
-
[position, viewport]
|
|
675
|
-
);
|
|
676
|
-
reactExports.useEffect(() => setPortalHost(document.body), []);
|
|
677
|
-
reactExports.useEffect(() => {
|
|
678
|
-
const nextViewport = readViewport();
|
|
679
|
-
setViewport(nextViewport);
|
|
680
|
-
setPosition(randomInspectorPetEdgePosition(nextViewport, 1));
|
|
681
|
-
}, []);
|
|
682
|
-
reactExports.useEffect(() => {
|
|
683
|
-
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
684
|
-
const handleChange = (event) => setReduceMotion(event.matches);
|
|
685
|
-
setReduceMotion(mediaQuery.matches);
|
|
686
|
-
mediaQuery.addEventListener("change", handleChange);
|
|
687
|
-
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
688
|
-
}, []);
|
|
689
|
-
reactExports.useEffect(() => {
|
|
690
|
-
const intervalId = window.setInterval(() => setClockMs(Date.now()), 15e3);
|
|
691
|
-
return () => window.clearInterval(intervalId);
|
|
692
|
-
}, []);
|
|
693
|
-
reactExports.useEffect(() => {
|
|
694
|
-
try {
|
|
695
|
-
window.localStorage.setItem(INSPECTOR_PET_ROAMING_STORAGE_KEY, roaming ? "1" : "0");
|
|
696
|
-
} catch {
|
|
697
|
-
}
|
|
698
|
-
}, [roaming]);
|
|
699
|
-
reactExports.useEffect(() => {
|
|
700
|
-
if (!roaming || dragging || reduceMotion) return void 0;
|
|
701
|
-
let pauseTimeoutId = null;
|
|
702
|
-
let scuttleTimeoutId = null;
|
|
703
|
-
const scheduleScuttle = () => {
|
|
704
|
-
const delay = INSPECTOR_PET_MIN_PAUSE_MS + Math.random() * INSPECTOR_PET_PAUSE_WINDOW_MS;
|
|
705
|
-
pauseTimeoutId = window.setTimeout(() => {
|
|
706
|
-
setScuttling(true);
|
|
707
|
-
setPosition(
|
|
708
|
-
(current) => nextInspectorPetWalkingPosition(current, viewport, Math.random(), Math.random())
|
|
709
|
-
);
|
|
710
|
-
scuttleTimeoutId = window.setTimeout(() => {
|
|
711
|
-
setScuttling(false);
|
|
712
|
-
scheduleScuttle();
|
|
713
|
-
}, INSPECTOR_PET_SCUTTLE_MS);
|
|
714
|
-
}, delay);
|
|
715
|
-
};
|
|
716
|
-
scheduleScuttle();
|
|
717
|
-
return () => {
|
|
718
|
-
if (pauseTimeoutId !== null) window.clearTimeout(pauseTimeoutId);
|
|
719
|
-
if (scuttleTimeoutId !== null) window.clearTimeout(scuttleTimeoutId);
|
|
720
|
-
};
|
|
721
|
-
}, [dragging, reduceMotion, roaming, viewport]);
|
|
722
|
-
reactExports.useEffect(() => {
|
|
723
|
-
const handleResize = () => {
|
|
724
|
-
const nextViewport = readViewport();
|
|
725
|
-
setScuttling(false);
|
|
726
|
-
setViewport(nextViewport);
|
|
727
|
-
setPosition((current) => snapInspectorPetToCorner(current, nextViewport));
|
|
728
|
-
};
|
|
729
|
-
window.addEventListener("resize", handleResize);
|
|
730
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
731
|
-
}, []);
|
|
732
|
-
reactExports.useEffect(() => {
|
|
733
|
-
if (!panelVisible) return void 0;
|
|
734
|
-
const timeoutId = window.setTimeout(
|
|
735
|
-
() => setPanelVisible(false),
|
|
736
|
-
INSPECTOR_PET_PANEL_DISMISS_MS
|
|
737
|
-
);
|
|
738
|
-
return () => window.clearTimeout(timeoutId);
|
|
739
|
-
}, [panelTick, panelVisible]);
|
|
740
|
-
reactExports.useEffect(() => {
|
|
741
|
-
if (!reactionVisible) return void 0;
|
|
742
|
-
const timeoutId = window.setTimeout(() => setReactionVisible(false), INSPECTOR_PET_REACTION_MS);
|
|
743
|
-
return () => window.clearTimeout(timeoutId);
|
|
744
|
-
}, [reactionTick, reactionVisible]);
|
|
745
|
-
const handlePet = reactExports.useCallback(() => {
|
|
746
|
-
if (dragOccurredRef.current) {
|
|
747
|
-
dragOccurredRef.current = false;
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
setClockMs(Date.now());
|
|
751
|
-
setPanelTick((current) => current + 1);
|
|
752
|
-
setPanelVisible(true);
|
|
753
|
-
setReactionTick((current) => current + 1);
|
|
754
|
-
setReactionVisible(true);
|
|
755
|
-
}, []);
|
|
756
|
-
const handlePointerDown = reactExports.useCallback((event) => {
|
|
757
|
-
const rect = event.currentTarget.getBoundingClientRect();
|
|
758
|
-
dragOccurredRef.current = false;
|
|
759
|
-
dragStateRef.current = {
|
|
760
|
-
pointerId: event.pointerId,
|
|
761
|
-
offsetX: event.clientX - rect.left,
|
|
762
|
-
offsetY: event.clientY - rect.top,
|
|
763
|
-
startX: event.clientX,
|
|
764
|
-
startY: event.clientY,
|
|
765
|
-
moved: false
|
|
766
|
-
};
|
|
767
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
768
|
-
setScuttling(false);
|
|
769
|
-
setPanelVisible(false);
|
|
770
|
-
setDragging(true);
|
|
771
|
-
}, []);
|
|
772
|
-
const handlePointerMove = reactExports.useCallback(
|
|
773
|
-
(event) => {
|
|
774
|
-
const dragState = dragStateRef.current;
|
|
775
|
-
if (dragState === null || dragState.pointerId !== event.pointerId) return;
|
|
776
|
-
const moved = dragState.moved || Math.abs(event.clientX - dragState.startX) >= INSPECTOR_PET_DRAG_THRESHOLD || Math.abs(event.clientY - dragState.startY) >= INSPECTOR_PET_DRAG_THRESHOLD;
|
|
777
|
-
dragState.moved = moved;
|
|
778
|
-
dragOccurredRef.current = moved;
|
|
779
|
-
setPosition(
|
|
780
|
-
clampInspectorPetPosition(
|
|
781
|
-
{
|
|
782
|
-
x: event.clientX - dragState.offsetX,
|
|
783
|
-
y: event.clientY - dragState.offsetY
|
|
784
|
-
},
|
|
785
|
-
viewport
|
|
786
|
-
)
|
|
787
|
-
);
|
|
788
|
-
},
|
|
789
|
-
[viewport]
|
|
790
|
-
);
|
|
791
|
-
const handlePointerUp = reactExports.useCallback(
|
|
792
|
-
(event) => {
|
|
793
|
-
const dragState = dragStateRef.current;
|
|
794
|
-
if (dragState === null || dragState.pointerId !== event.pointerId) return;
|
|
795
|
-
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
796
|
-
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
797
|
-
}
|
|
798
|
-
dragOccurredRef.current = dragState.moved;
|
|
799
|
-
dragStateRef.current = null;
|
|
800
|
-
setDragging(false);
|
|
801
|
-
setPosition((current) => snapInspectorPetToCorner(current, viewport));
|
|
802
|
-
},
|
|
803
|
-
[viewport]
|
|
804
|
-
);
|
|
805
|
-
const handlePointerCancel = reactExports.useCallback((event) => {
|
|
806
|
-
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
807
|
-
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
808
|
-
}
|
|
809
|
-
dragStateRef.current = null;
|
|
810
|
-
dragOccurredRef.current = false;
|
|
811
|
-
setDragging(false);
|
|
812
|
-
}, []);
|
|
813
|
-
const handleToggleRoaming = reactExports.useCallback(() => {
|
|
814
|
-
setScuttling(false);
|
|
815
|
-
setRoaming((current) => !current);
|
|
816
|
-
}, []);
|
|
817
|
-
const petStyle = reactExports.useMemo(
|
|
818
|
-
() => ({
|
|
819
|
-
transform: `translate3d(${String(position.x)}px, ${String(position.y)}px, 0) scale(${dragging ? "1.04" : "1"})`,
|
|
820
|
-
transition: dragging ? "none" : scuttling ? `transform ${String(INSPECTOR_PET_SCUTTLE_MS)}ms cubic-bezier(0.22, 0.72, 0.32, 1)` : "transform 900ms cubic-bezier(0.22, 0.72, 0.32, 1)",
|
|
821
|
-
touchAction: "none"
|
|
822
|
-
}),
|
|
823
|
-
[dragging, position.x, position.y, scuttling]
|
|
824
|
-
);
|
|
825
|
-
const panelStyle = reactExports.useMemo(
|
|
826
|
-
() => ({ left: panelPosition.x, top: panelPosition.y }),
|
|
827
|
-
[panelPosition.x, panelPosition.y]
|
|
828
|
-
);
|
|
829
|
-
const roamingLabel = roaming ? "Pause pet roaming" : "Resume pet roaming";
|
|
830
|
-
if (portalHost === null) return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
831
|
-
return reactDomExports.createPortal(
|
|
832
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
833
|
-
"div",
|
|
834
|
-
{
|
|
835
|
-
className: "pointer-events-none fixed inset-0 isolate",
|
|
836
|
-
style: { zIndex: INSPECTOR_PET_TOP_LAYER_Z_INDEX },
|
|
837
|
-
"data-inspector-pet-layer": "true",
|
|
838
|
-
children: [
|
|
839
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
840
|
-
"button",
|
|
841
|
-
{
|
|
842
|
-
type: "button",
|
|
843
|
-
className: cn(
|
|
844
|
-
"pointer-events-auto fixed left-0 top-0 z-10 flex size-28 items-center justify-center bg-transparent text-foreground opacity-65 outline-none transition-[filter,opacity] duration-200 hover:opacity-100 hover:drop-shadow-[0_0_28px_rgba(245,158,11,0.32)] focus-visible:opacity-100 focus-visible:drop-shadow-[0_0_14px_rgba(251,191,36,0.72)]",
|
|
845
|
-
dragging ? "cursor-grabbing" : "cursor-grab"
|
|
846
|
-
),
|
|
847
|
-
style: petStyle,
|
|
848
|
-
"data-pet-mood": status.mood,
|
|
849
|
-
"data-pet-moving": scuttling ? "true" : "false",
|
|
850
|
-
onClick: handlePet,
|
|
851
|
-
onPointerDown: handlePointerDown,
|
|
852
|
-
onPointerMove: handlePointerMove,
|
|
853
|
-
onPointerUp: handlePointerUp,
|
|
854
|
-
onPointerCancel: handlePointerCancel,
|
|
855
|
-
"aria-label": `Inspector pet: ${status.label}`,
|
|
856
|
-
title: status.label,
|
|
857
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
858
|
-
"span",
|
|
859
|
-
{
|
|
860
|
-
className: cn(
|
|
861
|
-
"relative z-10 flex size-24 items-center justify-center",
|
|
862
|
-
reactionVisible && "inspector-pet-patted"
|
|
863
|
-
),
|
|
864
|
-
"aria-hidden": "true",
|
|
865
|
-
children: [
|
|
866
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
867
|
-
"span",
|
|
868
|
-
{
|
|
869
|
-
className: cn(
|
|
870
|
-
"relative flex size-24 items-center justify-center",
|
|
871
|
-
moodMotionClass(status.mood)
|
|
872
|
-
),
|
|
873
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative flex size-24 items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
874
|
-
InspectorPetCrab3D,
|
|
875
|
-
{
|
|
876
|
-
mood: status.mood,
|
|
877
|
-
moving: scuttling && !dragging,
|
|
878
|
-
reduceMotion
|
|
879
|
-
}
|
|
880
|
-
) })
|
|
881
|
-
}
|
|
882
|
-
),
|
|
883
|
-
reactionVisible && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
884
|
-
Heart,
|
|
885
|
-
{
|
|
886
|
-
className: "inspector-pet-heart absolute -right-2 -top-3 size-5 fill-amber-400 text-amber-400"
|
|
887
|
-
},
|
|
888
|
-
reactionTick
|
|
889
|
-
)
|
|
890
|
-
]
|
|
891
|
-
}
|
|
892
|
-
)
|
|
893
|
-
}
|
|
894
|
-
),
|
|
895
|
-
panelVisible && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
896
|
-
"div",
|
|
897
|
-
{
|
|
898
|
-
className: "pointer-events-auto fixed z-20 w-48 rounded-md border border-border/80 bg-popover/95 px-3 py-2 text-popover-foreground shadow-[0_14px_34px_rgba(0,0,0,0.28)] backdrop-blur",
|
|
899
|
-
style: panelStyle,
|
|
900
|
-
role: "status",
|
|
901
|
-
"aria-live": "polite",
|
|
902
|
-
children: [
|
|
903
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
904
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: cn("size-2 shrink-0 rounded-full", moodDotClass(status.mood)) }),
|
|
905
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "min-w-0 flex-1 truncate text-xs font-medium", children: status.label }),
|
|
906
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
907
|
-
"button",
|
|
908
|
-
{
|
|
909
|
-
type: "button",
|
|
910
|
-
className: "inline-flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none max-lg:size-10",
|
|
911
|
-
onClick: handleToggleRoaming,
|
|
912
|
-
"aria-label": roamingLabel,
|
|
913
|
-
title: roamingLabel,
|
|
914
|
-
children: roaming ? /* @__PURE__ */ jsxRuntimeExports.jsx(Pause, { className: "size-3.5" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Play, { className: "size-3.5" })
|
|
915
|
-
}
|
|
916
|
-
)
|
|
917
|
-
] }),
|
|
918
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 flex items-center justify-between gap-3 font-mono text-[10px] text-muted-foreground", children: [
|
|
919
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
920
|
-
String(status.capturedCount),
|
|
921
|
-
" captured"
|
|
922
|
-
] }),
|
|
923
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: status.pendingCount > 0 ? `${String(status.pendingCount)} active` : scuttling ? "Scuttling" : roaming ? "Resting" : "Paused" })
|
|
924
|
-
] })
|
|
925
|
-
]
|
|
926
|
-
}
|
|
927
|
-
)
|
|
928
|
-
]
|
|
929
|
-
}
|
|
930
|
-
),
|
|
931
|
-
portalHost
|
|
932
|
-
);
|
|
933
|
-
}
|
|
934
|
-
export {
|
|
935
|
-
InspectorPet
|
|
936
|
-
};
|