@tonyclaw/agent-inspector 3.1.32 → 4.0.2
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/backend/nitro.json +1 -1
- package/.output/cli.js +241 -120
- package/.output/server/_ssr/index.mjs +1 -1
- package/.output/server/_ssr/{router-oXUk3MBR.mjs → router-BBY_zWRK.mjs} +91 -3
- package/.output/server/index.mjs +1 -1
- package/.output/ui/assets/{CompareDrawer-BtfPSpkV.js → CompareDrawer-rtNElN-B.js} +1 -1
- package/.output/ui/assets/{InspectorPet-D9DPPQ3n.js → InspectorPet-QaAiuF3d.js} +1 -1
- package/.output/ui/assets/{ProxyViewerContainer-Buu8vkCK.js → ProxyViewerContainer-6twNZHwl.js} +4 -4
- package/.output/ui/assets/{ReplayDialog-BER-QzpD.js → ReplayDialog-B7KlziO2.js} +1 -1
- package/.output/ui/assets/{RequestAnatomy-C8Zwxrr7.js → RequestAnatomy-2XVFBrW4.js} +1 -1
- package/.output/ui/assets/{ResponseView-DDpKdYk6.js → ResponseView-BULgzLVB.js} +1 -1
- package/.output/ui/assets/{StreamingChunkSequence-sMPGG7Sw.js → StreamingChunkSequence-DSkvkbns.js} +1 -1
- package/.output/ui/assets/{_sessionId-e4IheHnP.js → _sessionId-D2dmJi3G.js} +1 -1
- package/.output/ui/assets/{_sessionId-C5Uv72Fx.js → _sessionId-DcS0s1Mr.js} +1 -1
- package/.output/ui/assets/{index-B__qT0Yd.js → index-B0TN1KKO.js} +2 -2
- package/.output/ui/assets/{index-Be3bTCzi.js → index-Bva1zHEs.js} +1 -1
- package/.output/ui/assets/{index-C9q__p8J.js → index-BzBExOxu.js} +1 -1
- package/.output/ui/assets/{index-CtB0deSZ.js → index-k6sRQz55.js} +1 -1
- package/.output/ui/assets/{json-viewer-Db0AFp-7.js → json-viewer-CWM4tY-j.js} +1 -1
- package/.output/ui/assets/{jszip.min-DkY0Ym_q.js → jszip.min-BkWvRFlo.js} +1 -1
- package/.output/ui/index.html +1 -1
- package/package.json +8 -13
- package/src/assets/IDE/claudecode-color.svg +0 -1
- package/src/assets/IDE/codex-color.svg +0 -1
- package/src/assets/IDE/opencode.svg +0 -1
- package/src/assets/IDE/xiaomimimo.svg +0 -1
- package/src/assets/favicon.svg +0 -21
- package/src/assets/logos/alibaba.svg +0 -1
- package/src/assets/logos/anthropic.svg +0 -1
- package/src/assets/logos/claude-code.svg +0 -4
- package/src/assets/logos/deepseek.svg +0 -1
- package/src/assets/logos/minimax.jpeg +0 -0
- package/src/assets/logos/openai.svg +0 -1
- package/src/assets/logos/opencode.svg +0 -4
- package/src/assets/logos/qwen.webp +0 -0
- package/src/assets/logos/zhipuai.svg +0 -219
- package/src/backend/router.tsx +0 -36
- package/src/backend/routes/$.ts +0 -26
- package/src/backend/routes/__root.ts +0 -4
- package/src/backend/routes/api/-instances.ts +0 -7
- package/src/backend/routes/api/alerts.summary.ts +0 -28
- package/src/backend/routes/api/alerts.ts +0 -70
- package/src/backend/routes/api/config.paths.ts +0 -14
- package/src/backend/routes/api/config.ts +0 -73
- package/src/backend/routes/api/ecosystem.packages.$packageId.help.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.$packageId.install.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.$packageId.runner-presets.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.$packageId.upgrade.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.ts +0 -21
- package/src/backend/routes/api/ecosystem.recipes.$recipeId.run.ts +0 -11
- package/src/backend/routes/api/ecosystem.tasks.$taskId.ts +0 -16
- package/src/backend/routes/api/ecosystem.tasks.ts +0 -12
- package/src/backend/routes/api/groups.$groupId.evidence.ts +0 -55
- package/src/backend/routes/api/groups.$groupId.sessions.ts +0 -50
- package/src/backend/routes/api/groups.$groupId.ts +0 -93
- package/src/backend/routes/api/groups.ts +0 -79
- package/src/backend/routes/api/health.ts +0 -22
- package/src/backend/routes/api/instances.$name.connection.ts +0 -12
- package/src/backend/routes/api/instances.$name.restart.ts +0 -23
- package/src/backend/routes/api/instances.$name.start.ts +0 -18
- package/src/backend/routes/api/instances.$name.stop.ts +0 -23
- package/src/backend/routes/api/instances.$name.ts +0 -12
- package/src/backend/routes/api/instances.ts +0 -16
- package/src/backend/routes/api/knowledge.candidates.$candidateId.promote.ts +0 -32
- package/src/backend/routes/api/knowledge.candidates.$candidateId.ts +0 -50
- package/src/backend/routes/api/knowledge.candidates.ts +0 -10
- package/src/backend/routes/api/knowledge.project-context.ts +0 -29
- package/src/backend/routes/api/knowledge.search.ts +0 -62
- package/src/backend/routes/api/knowledge.sessions.$sessionId.candidates.ts +0 -26
- package/src/backend/routes/api/logs.$id.body.ts +0 -58
- package/src/backend/routes/api/logs.$id.chunks.ts +0 -37
- package/src/backend/routes/api/logs.$id.replay.ts +0 -297
- package/src/backend/routes/api/logs.$id.ts +0 -23
- package/src/backend/routes/api/logs.import.ts +0 -39
- package/src/backend/routes/api/logs.stream.ts +0 -174
- package/src/backend/routes/api/logs.ts +0 -214
- package/src/backend/routes/api/mcp.ts +0 -25
- package/src/backend/routes/api/models.ts +0 -10
- package/src/backend/routes/api/pi-agent.ts +0 -29
- package/src/backend/routes/api/providers.$providerId.model-metadata.ts +0 -173
- package/src/backend/routes/api/providers.$providerId.test.log.ts +0 -342
- package/src/backend/routes/api/providers.$providerId.ts +0 -111
- package/src/backend/routes/api/providers.export.ts +0 -44
- package/src/backend/routes/api/providers.import.ts +0 -81
- package/src/backend/routes/api/providers.scan.ts +0 -28
- package/src/backend/routes/api/providers.ts +0 -102
- package/src/backend/routes/api/runs.$runId.evidence.ts +0 -55
- package/src/backend/routes/api/runs.$runId.ts +0 -50
- package/src/backend/routes/api/runs.ts +0 -62
- package/src/backend/routes/api/runtime.ts +0 -46
- package/src/backend/routes/api/sessions.ts +0 -51
- package/src/backend/routes/api/storage.ts +0 -56
- package/src/backend/routes/livez.ts +0 -13
- package/src/backend/routes/metrics.ts +0 -14
- package/src/backend/routes/proxy/$.ts +0 -15
- package/src/backend/routes/readyz.ts +0 -18
- package/src/backend/start.ts +0 -10
- package/src/cli/alias.ts +0 -431
- package/src/cli/detect-tools.ts +0 -123
- package/src/cli/doctor.ts +0 -836
- package/src/cli/instance.ts +0 -1071
- package/src/cli/instanceApi.ts +0 -213
- package/src/cli/instanceArgs.ts +0 -301
- package/src/cli/instanceControl.ts +0 -191
- package/src/cli/instanceModel.ts +0 -276
- package/src/cli/instanceRegistry.ts +0 -731
- package/src/cli/networkHints.ts +0 -170
- package/src/cli/onboard.ts +0 -1668
- package/src/cli/onboardTarget.ts +0 -228
- package/src/cli/rustBackendPackage.ts +0 -458
- package/src/cli/startupOutput.ts +0 -16
- package/src/cli/templates/codex-skill-onboard.ts +0 -320
- package/src/cli/templates/command-onboard.ts +0 -25
- package/src/cli/templates/skill-onboard.ts +0 -625
- package/src/cli.ts +0 -1397
- package/src/components/OnboardingBanner.tsx +0 -115
- package/src/components/ProxyViewer.tsx +0 -2259
- package/src/components/ProxyViewerContainer.tsx +0 -1076
- package/src/components/alerts/AlertsDialog.tsx +0 -615
- package/src/components/clients/ClientLogo.tsx +0 -175
- package/src/components/ecosystem/AgentLabDialog.tsx +0 -947
- package/src/components/errors/SafeErrorBoundary.tsx +0 -201
- package/src/components/groups/GroupsDialog.tsx +0 -1304
- package/src/components/inspector-pet/InspectorPet.tsx +0 -398
- package/src/components/inspector-pet/InspectorPetCrab3D.tsx +0 -455
- package/src/components/inspector-pet/inspectorPetLogic.ts +0 -272
- package/src/components/pi-agent/PiAgentPanel.tsx +0 -446
- package/src/components/pi-agent/piAgentChatLogic.ts +0 -273
- package/src/components/providers/ImportWizardDialog.tsx +0 -281
- package/src/components/providers/ProviderCard.tsx +0 -347
- package/src/components/providers/ProviderForm.tsx +0 -1183
- package/src/components/providers/ProviderLogo.tsx +0 -122
- package/src/components/providers/ProviderTestResultsView.tsx +0 -734
- package/src/components/providers/ProvidersPanel.tsx +0 -714
- package/src/components/providers/SettingsDialog.tsx +0 -1042
- package/src/components/providers/providerFormCapabilities.ts +0 -36
- package/src/components/proxy-viewer/AgentTraceSummary.tsx +0 -902
- package/src/components/proxy-viewer/AnswerMarkdown.tsx +0 -51
- package/src/components/proxy-viewer/ApplicationBar.tsx +0 -123
- package/src/components/proxy-viewer/CompareDrawer.tsx +0 -984
- package/src/components/proxy-viewer/ConversationGroup.tsx +0 -208
- package/src/components/proxy-viewer/ConversationGroupList.tsx +0 -652
- package/src/components/proxy-viewer/ConversationHeader.tsx +0 -429
- package/src/components/proxy-viewer/LiveConnectionStatus.tsx +0 -186
- package/src/components/proxy-viewer/LogEntry.tsx +0 -1419
- package/src/components/proxy-viewer/LogEntryHeader.tsx +0 -596
- package/src/components/proxy-viewer/ProviderLogoStack.tsx +0 -57
- package/src/components/proxy-viewer/RawExportWarning.tsx +0 -77
- package/src/components/proxy-viewer/ReplayDialog.tsx +0 -636
- package/src/components/proxy-viewer/RequestToolsPanel.tsx +0 -299
- package/src/components/proxy-viewer/ResponseView.tsx +0 -202
- package/src/components/proxy-viewer/SessionLoadProgressBar.tsx +0 -61
- package/src/components/proxy-viewer/StreamingChunkSequence.tsx +0 -265
- package/src/components/proxy-viewer/ThreadConnector.tsx +0 -165
- package/src/components/proxy-viewer/ToolTraceEvents.tsx +0 -64
- package/src/components/proxy-viewer/TurnGroup.tsx +0 -383
- package/src/components/proxy-viewer/TurnGroupList.tsx +0 -156
- package/src/components/proxy-viewer/accessibility.ts +0 -8
- package/src/components/proxy-viewer/anatomy/RequestAnatomy.tsx +0 -887
- package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +0 -222
- package/src/components/proxy-viewer/anatomy/contextIntelligence.ts +0 -737
- package/src/components/proxy-viewer/anatomy/sessionContextSummary.ts +0 -268
- package/src/components/proxy-viewer/anatomy/tokenEstimate.ts +0 -53
- package/src/components/proxy-viewer/anatomy/types.ts +0 -41
- package/src/components/proxy-viewer/anatomy/useAnatomyJump.ts +0 -114
- package/src/components/proxy-viewer/bodyHydration.ts +0 -123
- package/src/components/proxy-viewer/cacheTrend.ts +0 -50
- package/src/components/proxy-viewer/diff/DiffView.tsx +0 -321
- package/src/components/proxy-viewer/diff/computeDiff.ts +0 -178
- package/src/components/proxy-viewer/diff/index.ts +0 -3
- package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +0 -194
- package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +0 -81
- package/src/components/proxy-viewer/formats/anthropic/thinkingExtract.ts +0 -21
- package/src/components/proxy-viewer/formats/index.tsx +0 -47
- package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +0 -442
- package/src/components/proxy-viewer/index.ts +0 -9
- package/src/components/proxy-viewer/lazy.ts +0 -41
- package/src/components/proxy-viewer/liveConnectionState.ts +0 -158
- package/src/components/proxy-viewer/log-formats/anthropic.ts +0 -191
- package/src/components/proxy-viewer/log-formats/index.ts +0 -23
- package/src/components/proxy-viewer/log-formats/openai.ts +0 -256
- package/src/components/proxy-viewer/log-formats/types.ts +0 -40
- package/src/components/proxy-viewer/log-formats/unknown.ts +0 -18
- package/src/components/proxy-viewer/logEntryVisibility.ts +0 -73
- package/src/components/proxy-viewer/logFocus.ts +0 -54
- package/src/components/proxy-viewer/proxyViewerContainerLogic.ts +0 -124
- package/src/components/proxy-viewer/proxyViewerLogic.ts +0 -488
- package/src/components/proxy-viewer/replayComparison.ts +0 -131
- package/src/components/proxy-viewer/requestDiff.ts +0 -277
- package/src/components/proxy-viewer/requestTools.ts +0 -220
- package/src/components/proxy-viewer/useCopyFeedback.ts +0 -38
- package/src/components/proxy-viewer/useKeyboardNavigation.ts +0 -232
- package/src/components/proxy-viewer/viewerState.ts +0 -176
- package/src/components/ui/badge.tsx +0 -47
- package/src/components/ui/button.tsx +0 -47
- package/src/components/ui/collapsible.tsx +0 -21
- package/src/components/ui/confirm-dialog.tsx +0 -51
- package/src/components/ui/crab-logo.tsx +0 -45
- package/src/components/ui/crab-variants.tsx +0 -467
- package/src/components/ui/dialog.tsx +0 -130
- package/src/components/ui/icon-trigger.ts +0 -2
- package/src/components/ui/json-viewer-bulk.ts +0 -132
- package/src/components/ui/json-viewer.tsx +0 -508
- package/src/components/ui/scroll-area.tsx +0 -54
- package/src/components/ui/select.tsx +0 -178
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/tabs.tsx +0 -88
- package/src/components/ui/tooltip.tsx +0 -51
- package/src/components/ui/transient-toast.tsx +0 -105
- package/src/contracts/anthropic.ts +0 -230
- package/src/contracts/index.ts +0 -59
- package/src/contracts/json.ts +0 -37
- package/src/contracts/log.ts +0 -139
- package/src/contracts/openai.ts +0 -267
- package/src/index.css +0 -11
- package/src/knowledge/candidateStore.ts +0 -94
- package/src/knowledge/distiller.ts +0 -98
- package/src/knowledge/openclawClient.ts +0 -161
- package/src/knowledge/openclawGatewayClient.ts +0 -249
- package/src/knowledge/openclawMarkdown.ts +0 -146
- package/src/knowledge/redactor.ts +0 -80
- package/src/knowledge/types.ts +0 -83
- package/src/lib/alertContract.ts +0 -76
- package/src/lib/apiClient.ts +0 -166
- package/src/lib/apiFormat.ts +0 -29
- package/src/lib/backendImplementation.ts +0 -16
- package/src/lib/basePath.ts +0 -107
- package/src/lib/browserRuntimeContract.ts +0 -124
- package/src/lib/browserRuntimeResolver.ts +0 -333
- package/src/lib/chunkLoadRecovery.ts +0 -83
- package/src/lib/claudeCodeStrip.ts +0 -98
- package/src/lib/clipboard.ts +0 -67
- package/src/lib/codingAgentEndpoints.ts +0 -54
- package/src/lib/ecosystemContract.ts +0 -130
- package/src/lib/export-logs.ts +0 -287
- package/src/lib/groupContract.ts +0 -166
- package/src/lib/instanceContract.ts +0 -239
- package/src/lib/jsonFile.ts +0 -46
- package/src/lib/logImportContract.ts +0 -12
- package/src/lib/managedInstance.ts +0 -112
- package/src/lib/mask.ts +0 -4
- package/src/lib/objectUtils.ts +0 -22
- package/src/lib/piAgentContract.ts +0 -102
- package/src/lib/providerContract.ts +0 -125
- package/src/lib/providerImportContract.ts +0 -27
- package/src/lib/providerModelMetadata.ts +0 -458
- package/src/lib/providerTestContract.ts +0 -170
- package/src/lib/providerTestPrompt.ts +0 -100
- package/src/lib/publicBasePathContext.ts +0 -137
- package/src/lib/resourceLimits.ts +0 -345
- package/src/lib/runContract.ts +0 -164
- package/src/lib/runtimeConfig.ts +0 -43
- package/src/lib/safeDiagnostic.ts +0 -38
- package/src/lib/safeFetch.ts +0 -508
- package/src/lib/serverPort.ts +0 -47
- package/src/lib/sessionInfoContract.ts +0 -78
- package/src/lib/sessionUrl.ts +0 -46
- package/src/lib/ssrfGuard.ts +0 -133
- package/src/lib/stopReason.ts +0 -130
- package/src/lib/themeMode.ts +0 -41
- package/src/lib/timeDisplay.ts +0 -22
- package/src/lib/toolTrace.ts +0 -290
- package/src/lib/uiScale.ts +0 -117
- package/src/lib/unknown.ts +0 -27
- package/src/lib/upstreamUrl.ts +0 -150
- package/src/lib/useAlerts.ts +0 -82
- package/src/lib/useGroupEvidence.ts +0 -37
- package/src/lib/useGroups.ts +0 -32
- package/src/lib/useOnboarding.ts +0 -93
- package/src/lib/useProviders.ts +0 -30
- package/src/lib/useStripConfig.ts +0 -154
- package/src/lib/useThemeMode.ts +0 -40
- package/src/lib/useUiScale.ts +0 -52
- package/src/lib/utils.ts +0 -78
- package/src/mcp/currentContext.ts +0 -65
- package/src/mcp/instanceHandlers.ts +0 -151
- package/src/mcp/loopback.ts +0 -88
- package/src/mcp/mode.ts +0 -75
- package/src/mcp/previewExtractor.ts +0 -233
- package/src/mcp/server.ts +0 -2274
- package/src/mcp/toolHandlers.ts +0 -1533
- package/src/proxy/alerts.ts +0 -664
- package/src/proxy/chunkStorage.ts +0 -123
- package/src/proxy/config.ts +0 -218
- package/src/proxy/constants.ts +0 -66
- package/src/proxy/dataDir.ts +0 -147
- package/src/proxy/ecosystemExecutionConfirmation.ts +0 -114
- package/src/proxy/ecosystemExecutionRoute.ts +0 -116
- package/src/proxy/ecosystemRegistry.ts +0 -296
- package/src/proxy/ecosystemTasks.ts +0 -415
- package/src/proxy/evidenceAnalysis.ts +0 -526
- package/src/proxy/evidenceExporter.ts +0 -235
- package/src/proxy/formats/anthropic/anthropicProvider.ts +0 -75
- package/src/proxy/formats/anthropic/handler.ts +0 -75
- package/src/proxy/formats/anthropic/index.ts +0 -13
- package/src/proxy/formats/anthropic/register.ts +0 -4
- package/src/proxy/formats/anthropic/schemas.ts +0 -6
- package/src/proxy/formats/anthropic/stream.ts +0 -205
- package/src/proxy/formats/handler.ts +0 -46
- package/src/proxy/formats/index.ts +0 -13
- package/src/proxy/formats/jsonSchema.ts +0 -2
- package/src/proxy/formats/openai/alibabaProvider.ts +0 -34
- package/src/proxy/formats/openai/codexMetadata.ts +0 -61
- package/src/proxy/formats/openai/handler.ts +0 -133
- package/src/proxy/formats/openai/index.ts +0 -33
- package/src/proxy/formats/openai/provider.ts +0 -50
- package/src/proxy/formats/openai/register.ts +0 -4
- package/src/proxy/formats/openai/schemas.ts +0 -25
- package/src/proxy/formats/openai/stream.ts +0 -600
- package/src/proxy/formats/openai/zhipuProvider.ts +0 -31
- package/src/proxy/formats/providerAdapter.ts +0 -50
- package/src/proxy/formats/providerRegistry.ts +0 -51
- package/src/proxy/formats/providers/index.ts +0 -3
- package/src/proxy/formats/registry.ts +0 -65
- package/src/proxy/groupEvidenceExporter.ts +0 -371
- package/src/proxy/groupStore.ts +0 -336
- package/src/proxy/handler.ts +0 -729
- package/src/proxy/identityProxy.ts +0 -1842
- package/src/proxy/jsonlRecovery.ts +0 -554
- package/src/proxy/logBodyChunks.ts +0 -91
- package/src/proxy/logFinalizer.ts +0 -777
- package/src/proxy/logFinalizer.worker.ts +0 -24
- package/src/proxy/logImportUpload.ts +0 -128
- package/src/proxy/logImporter.ts +0 -813
- package/src/proxy/logIndex.ts +0 -663
- package/src/proxy/logSearch.ts +0 -122
- package/src/proxy/logger.ts +0 -537
- package/src/proxy/openaiOrphanToolStrip.ts +0 -142
- package/src/proxy/platformCommands.ts +0 -253
- package/src/proxy/privateDataPath.ts +0 -419
- package/src/proxy/providerImporters.ts +0 -578
- package/src/proxy/providerScanStore.ts +0 -87
- package/src/proxy/providerSecretStore.ts +0 -216
- package/src/proxy/providers.ts +0 -998
- package/src/proxy/rawStreamCapture.ts +0 -342
- package/src/proxy/runFailures.ts +0 -94
- package/src/proxy/runStore.ts +0 -214
- package/src/proxy/runtimeAdmission.ts +0 -55
- package/src/proxy/runtimeHealth.ts +0 -221
- package/src/proxy/runtimeMetrics.ts +0 -149
- package/src/proxy/runtimeShutdown.ts +0 -157
- package/src/proxy/schemas.ts +0 -112
- package/src/proxy/sessionArchive.ts +0 -479
- package/src/proxy/sessionInfo.ts +0 -266
- package/src/proxy/sessionProcess.ts +0 -194
- package/src/proxy/sessionRuntime.ts +0 -121
- package/src/proxy/sessionSupervisor.ts +0 -305
- package/src/proxy/sessionWorkerEntry.ts +0 -26
- package/src/proxy/shutdownCoordinator.ts +0 -90
- package/src/proxy/socketTracker.ts +0 -639
- package/src/proxy/sqliteLogIndex.ts +0 -733
- package/src/proxy/storageLifecycle.ts +0 -432
- package/src/proxy/store.ts +0 -1773
- package/src/proxy/streamTiming.ts +0 -31
- package/src/proxy/toolSchemaWarnings.ts +0 -529
- package/src/proxy/uiAssetServer.ts +0 -106
- package/src/proxy/upstream.ts +0 -127
- package/src/services/alerts.ts +0 -12
- package/src/services/groups.ts +0 -119
- package/src/services/piAgent.ts +0 -421
- package/src/services/piAgentRetrieval.ts +0 -1180
- package/src/services/result.ts +0 -17
- package/src/services/runs.ts +0 -76
- package/src/ui/bootstrap.ts +0 -167
- package/src/ui/index.html +0 -38
- package/src/ui/logsStreamClient.ts +0 -20
- package/src/ui/main.tsx +0 -13
- package/src/ui/public/runtime-config.js +0 -2
- package/src/ui/router.tsx +0 -13
- package/src/ui/routes/__root.tsx +0 -69
- package/src/ui/routes/index.tsx +0 -35
- package/src/ui/routes/session/$sessionId.tsx +0 -50
- package/src/ui/runtimeDiscovery.ts +0 -50
package/src/mcp/mode.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export type McpWriteMode = "enabled" | "readonly";
|
|
2
|
-
|
|
3
|
-
export const MCP_INSTANCE_WRITES_ENV = "AGENT_INSPECTOR_MCP_INSTANCE_WRITES";
|
|
4
|
-
|
|
5
|
-
function parseFlag(value: string | undefined): boolean | null {
|
|
6
|
-
if (value === undefined) return null;
|
|
7
|
-
switch (value.trim().toLowerCase()) {
|
|
8
|
-
case "1":
|
|
9
|
-
case "true":
|
|
10
|
-
case "yes":
|
|
11
|
-
case "on":
|
|
12
|
-
return true;
|
|
13
|
-
case "0":
|
|
14
|
-
case "false":
|
|
15
|
-
case "no":
|
|
16
|
-
case "off":
|
|
17
|
-
return false;
|
|
18
|
-
default:
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function isMcpWriteEnabled(): boolean {
|
|
24
|
-
const readonlyFlag = parseFlag(process.env["AGENT_INSPECTOR_MCP_READONLY"]);
|
|
25
|
-
if (readonlyFlag === true) return false;
|
|
26
|
-
|
|
27
|
-
const writesFlag = parseFlag(process.env["AGENT_INSPECTOR_MCP_WRITES"]);
|
|
28
|
-
return writesFlag === true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function isMcpInstanceWriteEnabled(): boolean {
|
|
32
|
-
return process.env[MCP_INSTANCE_WRITES_ENV] === "1";
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function getMcpInstanceModeInfo(): {
|
|
36
|
-
writeMode: McpWriteMode;
|
|
37
|
-
writesEnabled: boolean;
|
|
38
|
-
env: { AGENT_INSPECTOR_MCP_INSTANCE_WRITES: string | null };
|
|
39
|
-
note: string;
|
|
40
|
-
} {
|
|
41
|
-
const writesEnabled = isMcpInstanceWriteEnabled();
|
|
42
|
-
return {
|
|
43
|
-
writeMode: writesEnabled ? "enabled" : "readonly",
|
|
44
|
-
writesEnabled,
|
|
45
|
-
env: {
|
|
46
|
-
AGENT_INSPECTOR_MCP_INSTANCE_WRITES: process.env[MCP_INSTANCE_WRITES_ENV] ?? null,
|
|
47
|
-
},
|
|
48
|
-
note: writesEnabled
|
|
49
|
-
? "Named-instance lifecycle tools passed the instance-specific opt-in. General MCP writes must also be enabled."
|
|
50
|
-
: "Named-instance lifecycle tools require AGENT_INSPECTOR_MCP_INSTANCE_WRITES=1 in addition to general MCP writes.",
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function getMcpModeInfo(): {
|
|
55
|
-
writeMode: McpWriteMode;
|
|
56
|
-
writesEnabled: boolean;
|
|
57
|
-
env: {
|
|
58
|
-
AGENT_INSPECTOR_MCP_READONLY: string | null;
|
|
59
|
-
AGENT_INSPECTOR_MCP_WRITES: string | null;
|
|
60
|
-
};
|
|
61
|
-
note: string;
|
|
62
|
-
} {
|
|
63
|
-
const writesEnabled = isMcpWriteEnabled();
|
|
64
|
-
return {
|
|
65
|
-
writeMode: writesEnabled ? "enabled" : "readonly",
|
|
66
|
-
writesEnabled,
|
|
67
|
-
env: {
|
|
68
|
-
AGENT_INSPECTOR_MCP_READONLY: process.env["AGENT_INSPECTOR_MCP_READONLY"] ?? null,
|
|
69
|
-
AGENT_INSPECTOR_MCP_WRITES: process.env["AGENT_INSPECTOR_MCP_WRITES"] ?? null,
|
|
70
|
-
},
|
|
71
|
-
note: writesEnabled
|
|
72
|
-
? "MCP write/action tools are enabled explicitly by AGENT_INSPECTOR_MCP_WRITES=1."
|
|
73
|
-
: "MCP is readonly by default. Read tools/resources still work; set AGENT_INSPECTOR_MCP_WRITES=1 to enable mutations.",
|
|
74
|
-
};
|
|
75
|
-
}
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format-parser-driven preview extractor for the MCP `inspector_list_logs`
|
|
3
|
-
* "thick summary" shape. See `openspec/changes/add-mcp-server/design.md`
|
|
4
|
-
* decision D5.
|
|
5
|
-
*
|
|
6
|
-
* Why we re-parse with the format schemas (not slice `rawRequestBody`):
|
|
7
|
-
* a 500-char prefix is almost always JSON envelope + system prompt boilerplate
|
|
8
|
-
* with zero signal about what the user actually asked. The format parsers
|
|
9
|
-
* give us the first text block of the last user message, which is what an
|
|
10
|
-
* agent needs to make a "is this the log I care about?" judgment from
|
|
11
|
-
* `list_logs` alone.
|
|
12
|
-
*
|
|
13
|
-
* Null returns are an expected and frequent outcome; they cover:
|
|
14
|
-
* - `apiFormat === "unknown"`
|
|
15
|
-
* - `rawRequestBody` / `responseText` is null
|
|
16
|
-
* - JSON.parse failure
|
|
17
|
-
* - schema validation failure
|
|
18
|
-
* - no qualifying user / assistant message
|
|
19
|
-
* - the relevant content is non-text (e.g., image-only multimodal block)
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
import { z } from "zod";
|
|
23
|
-
import type { CapturedLog } from "../contracts";
|
|
24
|
-
import { AnthropicRequestSchema, AnthropicResponseSchema } from "../contracts/anthropic";
|
|
25
|
-
import {
|
|
26
|
-
OpenAIRequestSchema,
|
|
27
|
-
OpenAIResponseSchema,
|
|
28
|
-
OpenAIResponsesRequestSchema,
|
|
29
|
-
OpenAIResponsesResponseSchema,
|
|
30
|
-
} from "../contracts/openai";
|
|
31
|
-
import { safeGetOwnProperty } from "../lib/objectUtils";
|
|
32
|
-
|
|
33
|
-
/** Preview length cap, per design D5. */
|
|
34
|
-
const PREVIEW_MAX_CHARS = 500;
|
|
35
|
-
const UnknownArraySchema = z.array(z.unknown());
|
|
36
|
-
|
|
37
|
-
function truncate(text: string): string {
|
|
38
|
-
return text.length <= PREVIEW_MAX_CHARS ? text : text.slice(0, PREVIEW_MAX_CHARS);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Safely extract the first text from an Anthropic `Message.content` (string
|
|
43
|
-
* or array of blocks). Returns `null` for non-text-only or empty content.
|
|
44
|
-
*/
|
|
45
|
-
function firstAnthropicText(
|
|
46
|
-
content: string | ReadonlyArray<{ type: string; text?: string }>,
|
|
47
|
-
): string | null {
|
|
48
|
-
if (typeof content === "string") {
|
|
49
|
-
return content.length > 0 ? content : null;
|
|
50
|
-
}
|
|
51
|
-
for (const block of content) {
|
|
52
|
-
if (block.type === "text" && typeof block.text === "string" && block.text.length > 0) {
|
|
53
|
-
return block.text;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Safely extract the first text from an OpenAI message content (string or
|
|
61
|
-
* array of `{type:"text"|"image_url",...}`). Returns `null` for non-text /
|
|
62
|
-
* empty content.
|
|
63
|
-
*/
|
|
64
|
-
function firstOpenAIText(
|
|
65
|
-
content: string | ReadonlyArray<{ type: string; text?: string }> | null | undefined,
|
|
66
|
-
): string | null {
|
|
67
|
-
if (content === null || content === undefined) return null;
|
|
68
|
-
if (typeof content === "string") {
|
|
69
|
-
return content.length > 0 ? content : null;
|
|
70
|
-
}
|
|
71
|
-
for (const part of content) {
|
|
72
|
-
if (part.type === "text" && typeof part.text === "string" && part.text.length > 0) {
|
|
73
|
-
return part.text;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function firstResponsesInputText(input: unknown): string | null {
|
|
80
|
-
if (typeof input === "string") return input.length > 0 ? input : null;
|
|
81
|
-
const parsedInput = UnknownArraySchema.safeParse(input);
|
|
82
|
-
if (!parsedInput.success) return null;
|
|
83
|
-
for (let i = parsedInput.data.length - 1; i >= 0; i--) {
|
|
84
|
-
const item = parsedInput.data[i];
|
|
85
|
-
const role = safeGetOwnProperty(item, "role");
|
|
86
|
-
if (role !== "user" && role !== undefined) continue;
|
|
87
|
-
const directText = safeGetOwnProperty(item, "text");
|
|
88
|
-
if (typeof directText === "string" && directText.length > 0) return directText;
|
|
89
|
-
const content = safeGetOwnProperty(item, "content");
|
|
90
|
-
if (typeof content === "string" && content.length > 0) return content;
|
|
91
|
-
if (Array.isArray(content)) {
|
|
92
|
-
for (const part of content) {
|
|
93
|
-
const type = safeGetOwnProperty(part, "type");
|
|
94
|
-
const text = safeGetOwnProperty(part, "text");
|
|
95
|
-
if (
|
|
96
|
-
(type === "input_text" || type === "text") &&
|
|
97
|
-
typeof text === "string" &&
|
|
98
|
-
text.length > 0
|
|
99
|
-
) {
|
|
100
|
-
return text;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function firstResponsesOutputText(response: unknown): string | null {
|
|
109
|
-
const outputText = safeGetOwnProperty(response, "output_text");
|
|
110
|
-
if (typeof outputText === "string" && outputText.length > 0) return outputText;
|
|
111
|
-
const output = safeGetOwnProperty(response, "output");
|
|
112
|
-
if (!Array.isArray(output)) return null;
|
|
113
|
-
for (const item of output) {
|
|
114
|
-
const content = safeGetOwnProperty(item, "content");
|
|
115
|
-
if (!Array.isArray(content)) continue;
|
|
116
|
-
for (const part of content) {
|
|
117
|
-
const type = safeGetOwnProperty(part, "type");
|
|
118
|
-
const text = safeGetOwnProperty(part, "text");
|
|
119
|
-
if (
|
|
120
|
-
(type === "output_text" || type === "text") &&
|
|
121
|
-
typeof text === "string" &&
|
|
122
|
-
text.length > 0
|
|
123
|
-
) {
|
|
124
|
-
return text;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Extract a 500-char preview of the last `role: "user"` message's first text
|
|
133
|
-
* block. Returns `null` for unknown format, parse failures, or non-text
|
|
134
|
-
* content. See module-level docstring for the full null-case list.
|
|
135
|
-
*/
|
|
136
|
-
export function extractLastUserMessagePreview(log: CapturedLog): string | null {
|
|
137
|
-
if (log.apiFormat === "unknown") return null;
|
|
138
|
-
if (log.rawRequestBody === null) return null;
|
|
139
|
-
|
|
140
|
-
let json: unknown;
|
|
141
|
-
try {
|
|
142
|
-
json = JSON.parse(log.rawRequestBody);
|
|
143
|
-
} catch {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (log.apiFormat === "anthropic") {
|
|
148
|
-
const parsed = AnthropicRequestSchema.safeParse(json);
|
|
149
|
-
if (!parsed.success) return null;
|
|
150
|
-
// Iterate from the end to find the most recent user turn.
|
|
151
|
-
for (let i = parsed.data.messages.length - 1; i >= 0; i--) {
|
|
152
|
-
const msg = parsed.data.messages[i];
|
|
153
|
-
if (msg && msg.role === "user") {
|
|
154
|
-
const text = firstAnthropicText(msg.content);
|
|
155
|
-
return text === null ? null : truncate(text);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (log.apiFormat === "openai") {
|
|
162
|
-
const parsed = OpenAIRequestSchema.safeParse(json);
|
|
163
|
-
if (!parsed.success) {
|
|
164
|
-
const responsesParsed = OpenAIResponsesRequestSchema.safeParse(json);
|
|
165
|
-
if (!responsesParsed.success) return null;
|
|
166
|
-
const text = firstResponsesInputText(responsesParsed.data.input);
|
|
167
|
-
return text === null ? null : truncate(text);
|
|
168
|
-
}
|
|
169
|
-
for (let i = parsed.data.messages.length - 1; i >= 0; i--) {
|
|
170
|
-
const msg = parsed.data.messages[i];
|
|
171
|
-
if (msg && msg.role === "user") {
|
|
172
|
-
const text = firstOpenAIText(msg.content);
|
|
173
|
-
return text === null ? null : truncate(text);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Extract a 500-char preview of the assistant's response text. Returns
|
|
184
|
-
* `null` for unknown format, parse failures, missing response, or non-text
|
|
185
|
-
* content.
|
|
186
|
-
*/
|
|
187
|
-
export function extractResponsePreview(log: CapturedLog): string | null {
|
|
188
|
-
if (log.apiFormat === "unknown") return null;
|
|
189
|
-
if (log.responseText === null) return null;
|
|
190
|
-
|
|
191
|
-
let json: unknown;
|
|
192
|
-
try {
|
|
193
|
-
json = JSON.parse(log.responseText);
|
|
194
|
-
} catch {
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (log.apiFormat === "anthropic") {
|
|
199
|
-
const parsed = AnthropicResponseSchema.safeParse(json);
|
|
200
|
-
if (!parsed.success) return null;
|
|
201
|
-
for (const block of parsed.data.content) {
|
|
202
|
-
if (block.type === "text" && typeof block.text === "string" && block.text.length > 0) {
|
|
203
|
-
return truncate(block.text);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return null;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (log.apiFormat === "openai") {
|
|
210
|
-
const parsed = OpenAIResponseSchema.safeParse(json);
|
|
211
|
-
if (!parsed.success) {
|
|
212
|
-
const responsesParsed = OpenAIResponsesResponseSchema.safeParse(json);
|
|
213
|
-
if (!responsesParsed.success) return null;
|
|
214
|
-
const text = firstResponsesOutputText(responsesParsed.data);
|
|
215
|
-
return text === null ? null : truncate(text);
|
|
216
|
-
}
|
|
217
|
-
// Pick the first choice that actually carries a text-like content.
|
|
218
|
-
for (const choice of parsed.data.choices) {
|
|
219
|
-
const msg = choice.message;
|
|
220
|
-
if (!msg) continue;
|
|
221
|
-
const direct = firstOpenAIText(msg.content);
|
|
222
|
-
if (direct !== null) return truncate(direct);
|
|
223
|
-
// Some MiniMax / Moonshot-style providers stuff the text into
|
|
224
|
-
// reasoning_content / thinking / think instead of content. We surface
|
|
225
|
-
// whichever is the first non-empty one in a stable priority order.
|
|
226
|
-
const fallback = msg.reasoning_content ?? msg.thinking ?? msg.think;
|
|
227
|
-
if (typeof fallback === "string" && fallback.length > 0) return truncate(fallback);
|
|
228
|
-
}
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return null;
|
|
233
|
-
}
|