@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/.output/cli.js
CHANGED
|
@@ -20,7 +20,7 @@ var init_package = __esm({
|
|
|
20
20
|
"package.json"() {
|
|
21
21
|
package_default = {
|
|
22
22
|
name: "@tonyclaw/agent-inspector",
|
|
23
|
-
version: "
|
|
23
|
+
version: "4.0.2",
|
|
24
24
|
type: "module",
|
|
25
25
|
description: "Agent observability and knowledge capture layer for AI coding tools.",
|
|
26
26
|
license: "MIT",
|
|
@@ -30,14 +30,14 @@ var init_package = __esm({
|
|
|
30
30
|
author: "TonyClaw",
|
|
31
31
|
repository: {
|
|
32
32
|
type: "git",
|
|
33
|
-
url: "git+https://gitcode.com/TonyClaw/
|
|
33
|
+
url: "git+https://gitcode.com/TonyClaw/OpenInspector.git"
|
|
34
34
|
},
|
|
35
|
-
homepage: "https://gitcode.com/TonyClaw/
|
|
35
|
+
homepage: "https://gitcode.com/TonyClaw/OpenInspector#readme",
|
|
36
36
|
workspaces: [
|
|
37
37
|
"packages/*"
|
|
38
38
|
],
|
|
39
39
|
bugs: {
|
|
40
|
-
url: "https://gitcode.com/TonyClaw/
|
|
40
|
+
url: "https://gitcode.com/TonyClaw/OpenInspector/issues"
|
|
41
41
|
},
|
|
42
42
|
publishConfig: {
|
|
43
43
|
access: "public",
|
|
@@ -60,12 +60,7 @@ var init_package = __esm({
|
|
|
60
60
|
},
|
|
61
61
|
files: [
|
|
62
62
|
"bin",
|
|
63
|
-
"src",
|
|
64
|
-
"!src/**/*.test.ts",
|
|
65
|
-
"!src/**/*.stories.tsx",
|
|
66
|
-
"!src/**/__fixtures__",
|
|
67
|
-
"!src/ui/routeTree.gen.ts",
|
|
68
|
-
"!src/backend/routeTree.gen.ts",
|
|
63
|
+
"src/assets/agent-inspector.ico",
|
|
69
64
|
"scripts/setup-windows-runtime.mjs",
|
|
70
65
|
"scripts/setup-agent-skills.mjs",
|
|
71
66
|
"scripts/generate-theme-scales.mjs",
|
|
@@ -174,9 +169,9 @@ var init_package = __esm({
|
|
|
174
169
|
zod: "^4.4.3"
|
|
175
170
|
},
|
|
176
171
|
optionalDependencies: {
|
|
177
|
-
"@tonyclaw/agent-inspector-backend-darwin-arm64": "
|
|
178
|
-
"@tonyclaw/agent-inspector-backend-linux-x64-gnu": "
|
|
179
|
-
"@tonyclaw/agent-inspector-backend-win32-x64-msvc": "
|
|
172
|
+
"@tonyclaw/agent-inspector-backend-darwin-arm64": "4.0.2",
|
|
173
|
+
"@tonyclaw/agent-inspector-backend-linux-x64-gnu": "4.0.2",
|
|
174
|
+
"@tonyclaw/agent-inspector-backend-win32-x64-msvc": "4.0.2",
|
|
180
175
|
"better-sqlite3": "^12.11.1",
|
|
181
176
|
rcedit: "4.0.1"
|
|
182
177
|
},
|
|
@@ -15590,9 +15585,9 @@ var init_networkHints = __esm({
|
|
|
15590
15585
|
// src/cli/rustBackendPackage.ts
|
|
15591
15586
|
import { spawnSync } from "node:child_process";
|
|
15592
15587
|
import { createHash } from "node:crypto";
|
|
15593
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
15588
|
+
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
|
|
15594
15589
|
import { createRequire } from "node:module";
|
|
15595
|
-
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
15590
|
+
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
15596
15591
|
import { fileURLToPath } from "node:url";
|
|
15597
15592
|
function packageFailure(code, message) {
|
|
15598
15593
|
return { kind: "error", error: { code, message } };
|
|
@@ -15704,6 +15699,80 @@ function probeBinaryIdentity(binaryPath, identityFlag) {
|
|
|
15704
15699
|
const parsed = RustBackendIdentitySchema.safeParse(raw);
|
|
15705
15700
|
return parsed.success ? { kind: "success", value: parsed.data } : { kind: "error", message: "identity command returned an unsupported contract" };
|
|
15706
15701
|
}
|
|
15702
|
+
function defaultRuntimeCacheRoot() {
|
|
15703
|
+
const localAppData = process.env["LOCALAPPDATA"];
|
|
15704
|
+
if (localAppData !== void 0 && localAppData.trim().length > 0) {
|
|
15705
|
+
return join(localAppData, "agent-inspector", "runtime", "backend");
|
|
15706
|
+
}
|
|
15707
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), "../.agent-inspector-runtime/backend");
|
|
15708
|
+
}
|
|
15709
|
+
function fileSha256(path2) {
|
|
15710
|
+
return createHash("sha256").update(readFileSync(path2)).digest("hex");
|
|
15711
|
+
}
|
|
15712
|
+
function materializeRuntimeBinary(options) {
|
|
15713
|
+
if (options.os !== "win32") return { kind: "success", command: options.sourceBinaryPath };
|
|
15714
|
+
const runtimeRoot = options.runtimeCacheRoot ?? defaultRuntimeCacheRoot();
|
|
15715
|
+
const targetDirectory = resolve(
|
|
15716
|
+
runtimeRoot,
|
|
15717
|
+
options.packageVersion,
|
|
15718
|
+
options.target,
|
|
15719
|
+
options.sha256
|
|
15720
|
+
);
|
|
15721
|
+
const runtimeBinaryPath = resolve(targetDirectory, basename(options.sourceBinaryPath));
|
|
15722
|
+
if (!isConfinedPath(resolve(runtimeRoot), runtimeBinaryPath)) {
|
|
15723
|
+
return {
|
|
15724
|
+
kind: "error",
|
|
15725
|
+
error: {
|
|
15726
|
+
code: "package_invalid",
|
|
15727
|
+
message: "Rust backend runtime cache path escaped the user runtime directory."
|
|
15728
|
+
}
|
|
15729
|
+
};
|
|
15730
|
+
}
|
|
15731
|
+
try {
|
|
15732
|
+
mkdirSync(targetDirectory, { recursive: true });
|
|
15733
|
+
const needsCopy = !existsSync(runtimeBinaryPath) || fileSha256(runtimeBinaryPath) !== options.sha256;
|
|
15734
|
+
if (needsCopy) copyFileSync(options.sourceBinaryPath, runtimeBinaryPath);
|
|
15735
|
+
chmodSync(runtimeBinaryPath, 493);
|
|
15736
|
+
} catch (error51) {
|
|
15737
|
+
const message = error51 instanceof Error ? error51.message : String(error51);
|
|
15738
|
+
return {
|
|
15739
|
+
kind: "error",
|
|
15740
|
+
error: {
|
|
15741
|
+
code: "binary_invalid",
|
|
15742
|
+
message: `Cannot stage Rust backend into the user runtime cache: ${message}`
|
|
15743
|
+
}
|
|
15744
|
+
};
|
|
15745
|
+
}
|
|
15746
|
+
if (fileSha256(runtimeBinaryPath) !== options.sha256) {
|
|
15747
|
+
return {
|
|
15748
|
+
kind: "error",
|
|
15749
|
+
error: {
|
|
15750
|
+
code: "hash_mismatch",
|
|
15751
|
+
message: "Rust backend runtime cache integrity check failed; no binary was started."
|
|
15752
|
+
}
|
|
15753
|
+
};
|
|
15754
|
+
}
|
|
15755
|
+
const probed = options.identityProbe(runtimeBinaryPath, options.identityFlag);
|
|
15756
|
+
if (probed.kind === "error") {
|
|
15757
|
+
return {
|
|
15758
|
+
kind: "error",
|
|
15759
|
+
error: {
|
|
15760
|
+
code: "identity_failed",
|
|
15761
|
+
message: `Cached Rust backend binary did not pass the production identity gate: ${probed.message}.`
|
|
15762
|
+
}
|
|
15763
|
+
};
|
|
15764
|
+
}
|
|
15765
|
+
if (!identitiesMatch(probed.value, options.manifestIdentity)) {
|
|
15766
|
+
return {
|
|
15767
|
+
kind: "error",
|
|
15768
|
+
error: {
|
|
15769
|
+
code: "identity_mismatch",
|
|
15770
|
+
message: "Cached Rust backend binary identity differs from its package manifest."
|
|
15771
|
+
}
|
|
15772
|
+
};
|
|
15773
|
+
}
|
|
15774
|
+
return { kind: "success", command: runtimeBinaryPath };
|
|
15775
|
+
}
|
|
15707
15776
|
function defaultResolvePackageJson(specifier) {
|
|
15708
15777
|
try {
|
|
15709
15778
|
return packageRequire.resolve(specifier);
|
|
@@ -15834,10 +15903,24 @@ function resolveRustBackendPackage(options) {
|
|
|
15834
15903
|
`Rust backend binary identity differs from its signed package manifest; no binary was started.`
|
|
15835
15904
|
);
|
|
15836
15905
|
}
|
|
15906
|
+
const runtimeBinary = materializeRuntimeBinary({
|
|
15907
|
+
sourceBinaryPath: binaryPath,
|
|
15908
|
+
packageVersion: options.rootVersion,
|
|
15909
|
+
target: target.value.target,
|
|
15910
|
+
sha256,
|
|
15911
|
+
os: target.value.os,
|
|
15912
|
+
runtimeCacheRoot: options.runtimeCacheRoot,
|
|
15913
|
+
identityFlag: metadata.identityFlag,
|
|
15914
|
+
identityProbe: options.identityProbe ?? probeBinaryIdentity,
|
|
15915
|
+
manifestIdentity: manifest.data.identity
|
|
15916
|
+
});
|
|
15917
|
+
if (runtimeBinary.kind === "error") {
|
|
15918
|
+
return { kind: "error", error: runtimeBinary.error };
|
|
15919
|
+
}
|
|
15837
15920
|
return {
|
|
15838
15921
|
kind: "success",
|
|
15839
15922
|
value: {
|
|
15840
|
-
command:
|
|
15923
|
+
command: runtimeBinary.command,
|
|
15841
15924
|
args: [],
|
|
15842
15925
|
packageName: target.value.packageName,
|
|
15843
15926
|
packageVersion: options.rootVersion,
|
|
@@ -16086,12 +16169,12 @@ import {
|
|
|
16086
16169
|
fchmodSync,
|
|
16087
16170
|
fstatSync,
|
|
16088
16171
|
lstatSync,
|
|
16089
|
-
mkdirSync,
|
|
16172
|
+
mkdirSync as mkdirSync2,
|
|
16090
16173
|
openSync,
|
|
16091
16174
|
readdirSync,
|
|
16092
16175
|
realpathSync
|
|
16093
16176
|
} from "node:fs";
|
|
16094
|
-
import { join, parse as parse3, resolve as resolve2, sep } from "node:path";
|
|
16177
|
+
import { join as join2, parse as parse3, resolve as resolve2, sep } from "node:path";
|
|
16095
16178
|
function windowsSystemPath(executable) {
|
|
16096
16179
|
const systemRoot = process.env["SystemRoot"] ?? "C:\\Windows";
|
|
16097
16180
|
return `${systemRoot}\\System32\\${executable}`;
|
|
@@ -16193,7 +16276,7 @@ function snapshotPathChain(path2) {
|
|
|
16193
16276
|
for (let index = 0; index < parts.length; index += 1) {
|
|
16194
16277
|
const part = parts[index];
|
|
16195
16278
|
if (part === void 0) return null;
|
|
16196
|
-
current =
|
|
16279
|
+
current = join2(current, part);
|
|
16197
16280
|
const read = readPathEntry(current);
|
|
16198
16281
|
if (read.status === "unsafe") return null;
|
|
16199
16282
|
if (read.status === "missing") {
|
|
@@ -16277,9 +16360,9 @@ function ensurePrivateDirectorySync(path2) {
|
|
|
16277
16360
|
let current = before.entries.at(-1)?.path;
|
|
16278
16361
|
if (current === void 0) return false;
|
|
16279
16362
|
for (const part of before.missingParts) {
|
|
16280
|
-
const next =
|
|
16363
|
+
const next = join2(current, part);
|
|
16281
16364
|
try {
|
|
16282
|
-
|
|
16365
|
+
mkdirSync2(next, { mode: PRIVATE_DIRECTORY_MODE });
|
|
16283
16366
|
} catch {
|
|
16284
16367
|
const raced = readPathEntry(next);
|
|
16285
16368
|
if (raced.status !== "ok" || raced.entry.kind !== "directory") return false;
|
|
@@ -16313,7 +16396,7 @@ function collectSafeTree(root) {
|
|
|
16313
16396
|
const afterRead = completeSnapshotForKind(path2, "directory");
|
|
16314
16397
|
if (afterRead === null || chainFingerprint(afterRead) !== fingerprint) return false;
|
|
16315
16398
|
for (const entry of entries) {
|
|
16316
|
-
if (!visit(
|
|
16399
|
+
if (!visit(join2(path2, entry))) return false;
|
|
16317
16400
|
}
|
|
16318
16401
|
return true;
|
|
16319
16402
|
};
|
|
@@ -16366,13 +16449,13 @@ var init_privateDataPath = __esm({
|
|
|
16366
16449
|
|
|
16367
16450
|
// src/proxy/dataDir.ts
|
|
16368
16451
|
import { cpSync, existsSync as existsSync2, readdirSync as readdirSync2, renameSync, rmSync } from "node:fs";
|
|
16369
|
-
import { isAbsolute as isAbsolute2, join as
|
|
16452
|
+
import { isAbsolute as isAbsolute2, join as join3 } from "node:path";
|
|
16370
16453
|
function getDataDir() {
|
|
16371
16454
|
migrateLegacyDataDirs();
|
|
16372
16455
|
return resolveDataDir(existsSync2);
|
|
16373
16456
|
}
|
|
16374
16457
|
function hasDataDirState(pathExists, dir) {
|
|
16375
|
-
return pathExists(
|
|
16458
|
+
return pathExists(join3(dir, "providers.json")) || pathExists(join3(dir, "config.json")) || pathExists(join3(dir, "logs")) || pathExists(join3(dir, "chunks"));
|
|
16376
16459
|
}
|
|
16377
16460
|
function defaultBaseDir(env = process.env, platform = process.platform) {
|
|
16378
16461
|
return platform === "win32" ? env["USERPROFILE"] ?? env["APPDATA"] ?? "C:\\" : env["HOME"] ?? "/tmp";
|
|
@@ -16381,13 +16464,13 @@ function resolveDataDir(_pathExists, env = process.env, platform = process.platf
|
|
|
16381
16464
|
const base = defaultBaseDir(env, platform);
|
|
16382
16465
|
const dirEnv = env["AGENT_INSPECTOR_DATA_DIR"];
|
|
16383
16466
|
if (dirEnv !== void 0 && dirEnv !== "") {
|
|
16384
|
-
return isAbsolute2(dirEnv) ? dirEnv :
|
|
16467
|
+
return isAbsolute2(dirEnv) ? dirEnv : join3(base, dirEnv);
|
|
16385
16468
|
}
|
|
16386
16469
|
const legacyDirEnv = env["AGENT_INSPECTOR_CONFIG_DIR"];
|
|
16387
16470
|
if (legacyDirEnv !== void 0 && legacyDirEnv !== "") {
|
|
16388
|
-
return isAbsolute2(legacyDirEnv) ? legacyDirEnv :
|
|
16471
|
+
return isAbsolute2(legacyDirEnv) ? legacyDirEnv : join3(base, legacyDirEnv);
|
|
16389
16472
|
}
|
|
16390
|
-
return
|
|
16473
|
+
return join3(base, CURRENT_DATA_DIR_NAME);
|
|
16391
16474
|
}
|
|
16392
16475
|
function hasExplicitDataDir() {
|
|
16393
16476
|
return process.env["AGENT_INSPECTOR_DATA_DIR"] !== void 0 && process.env["AGENT_INSPECTOR_DATA_DIR"] !== "" || process.env["AGENT_INSPECTOR_CONFIG_DIR"] !== void 0 && process.env["AGENT_INSPECTOR_CONFIG_DIR"] !== "";
|
|
@@ -16395,12 +16478,12 @@ function hasExplicitDataDir() {
|
|
|
16395
16478
|
function migrateLegacyDataDirs() {
|
|
16396
16479
|
if (hasExplicitDataDir()) return;
|
|
16397
16480
|
const base = defaultBaseDir();
|
|
16398
|
-
const currentDir =
|
|
16481
|
+
const currentDir = join3(base, CURRENT_DATA_DIR_NAME);
|
|
16399
16482
|
if (hasDataDirState(existsSync2, currentDir)) return;
|
|
16400
16483
|
for (const legacyName of LEGACY_DATA_DIR_NAMES) {
|
|
16401
|
-
const legacyDir =
|
|
16484
|
+
const legacyDir = join3(base, legacyName);
|
|
16402
16485
|
if (!existsSync2(legacyDir)) continue;
|
|
16403
|
-
const stagingDir =
|
|
16486
|
+
const stagingDir = join3(
|
|
16404
16487
|
base,
|
|
16405
16488
|
`${CURRENT_DATA_DIR_NAME}.migration-${String(process.pid)}-${String(Date.now())}`
|
|
16406
16489
|
);
|
|
@@ -16412,7 +16495,7 @@ function migrateLegacyDataDirs() {
|
|
|
16412
16495
|
}
|
|
16413
16496
|
if (!ensurePrivateDirectorySync(stagingDir)) return;
|
|
16414
16497
|
for (const entry of readdirSync2(legacyDir)) {
|
|
16415
|
-
cpSync(
|
|
16498
|
+
cpSync(join3(legacyDir, entry), join3(stagingDir, entry), {
|
|
16416
16499
|
recursive: true,
|
|
16417
16500
|
force: false,
|
|
16418
16501
|
errorOnExist: true
|
|
@@ -16448,7 +16531,7 @@ var init_dataDir = __esm({
|
|
|
16448
16531
|
// src/proxy/platformCommands.ts
|
|
16449
16532
|
import { statSync as statSync2 } from "node:fs";
|
|
16450
16533
|
import { execFileSync } from "node:child_process";
|
|
16451
|
-
import { delimiter, isAbsolute as isAbsolute3, join as
|
|
16534
|
+
import { delimiter, isAbsolute as isAbsolute3, join as join4 } from "node:path";
|
|
16452
16535
|
function pathEntries(envPath) {
|
|
16453
16536
|
if (envPath === void 0 || envPath.length === 0) return [];
|
|
16454
16537
|
return envPath.split(delimiter).filter((entry) => entry.length > 0);
|
|
@@ -16472,14 +16555,14 @@ function isExecutableCandidate(path2, platform) {
|
|
|
16472
16555
|
function executableCandidates(bin, platform, env) {
|
|
16473
16556
|
if (isAbsolute3(bin)) return [bin];
|
|
16474
16557
|
const entries = pathEntries(env["PATH"] ?? env["Path"] ?? env["path"]);
|
|
16475
|
-
if (platform !== "win32") return entries.map((entry) =>
|
|
16558
|
+
if (platform !== "win32") return entries.map((entry) => join4(entry, bin));
|
|
16476
16559
|
const hasExtension = /\.[^\\/]+$/.test(bin);
|
|
16477
16560
|
const extensions = hasExtension ? [""] : windowsExecutableExtensions(env["PATHEXT"]);
|
|
16478
16561
|
const candidates = [];
|
|
16479
16562
|
for (const entry of entries) {
|
|
16480
16563
|
for (const extension of extensions) {
|
|
16481
|
-
candidates.push(
|
|
16482
|
-
candidates.push(
|
|
16564
|
+
candidates.push(join4(entry, `${bin}${extension.toLowerCase()}`));
|
|
16565
|
+
candidates.push(join4(entry, `${bin}${extension.toUpperCase()}`));
|
|
16483
16566
|
}
|
|
16484
16567
|
}
|
|
16485
16568
|
return candidates;
|
|
@@ -16578,13 +16661,18 @@ function killPid(pid, platform = process.platform) {
|
|
|
16578
16661
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
16579
16662
|
try {
|
|
16580
16663
|
if (platform === "win32") {
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16664
|
+
try {
|
|
16665
|
+
execFileSync("taskkill.exe", ["/PID", String(pid), "/T", "/F"], {
|
|
16666
|
+
encoding: "utf8",
|
|
16667
|
+
timeout: 5e3,
|
|
16668
|
+
windowsHide: true,
|
|
16669
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
16670
|
+
});
|
|
16671
|
+
return true;
|
|
16672
|
+
} catch {
|
|
16673
|
+
process.kill(pid, "SIGKILL");
|
|
16674
|
+
return true;
|
|
16675
|
+
}
|
|
16588
16676
|
}
|
|
16589
16677
|
process.kill(pid, "SIGKILL");
|
|
16590
16678
|
return true;
|
|
@@ -17112,7 +17200,7 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
17112
17200
|
import {
|
|
17113
17201
|
closeSync as closeSync2,
|
|
17114
17202
|
existsSync as existsSync3,
|
|
17115
|
-
mkdirSync as
|
|
17203
|
+
mkdirSync as mkdirSync3,
|
|
17116
17204
|
openSync as openSync2,
|
|
17117
17205
|
readFileSync as readFileSync2,
|
|
17118
17206
|
readdirSync as readdirSync3,
|
|
@@ -17124,7 +17212,7 @@ import {
|
|
|
17124
17212
|
} from "node:fs";
|
|
17125
17213
|
import { createServer } from "node:net";
|
|
17126
17214
|
import { homedir } from "node:os";
|
|
17127
|
-
import { join as
|
|
17215
|
+
import { join as join5, posix, win32 } from "node:path";
|
|
17128
17216
|
function getInstancesRoot(env = process.env, platform = process.platform) {
|
|
17129
17217
|
const pathApi = platform === "win32" ? win32 : posix;
|
|
17130
17218
|
const explicitRoot = env[AGENT_INSPECTOR_INSTANCES_DIR_ENV];
|
|
@@ -17147,13 +17235,13 @@ function getInstancesRoot(env = process.env, platform = process.platform) {
|
|
|
17147
17235
|
function getInstancePaths(root, rawName) {
|
|
17148
17236
|
const name = validateInstanceName(rawName);
|
|
17149
17237
|
if (name.kind === "error") return name;
|
|
17150
|
-
const instanceDir =
|
|
17238
|
+
const instanceDir = join5(root, name.value);
|
|
17151
17239
|
return instanceRegistrySuccess({
|
|
17152
17240
|
root,
|
|
17153
17241
|
instanceDir,
|
|
17154
|
-
dataDir:
|
|
17155
|
-
recordPath:
|
|
17156
|
-
lockPath:
|
|
17242
|
+
dataDir: join5(instanceDir, "data"),
|
|
17243
|
+
recordPath: join5(instanceDir, INSTANCE_RECORD_FILE_NAME),
|
|
17244
|
+
lockPath: join5(instanceDir, INSTANCE_LOCK_DIRECTORY_NAME)
|
|
17157
17245
|
});
|
|
17158
17246
|
}
|
|
17159
17247
|
function ensureInstancesRoot(root = getInstancesRoot()) {
|
|
@@ -17201,7 +17289,7 @@ function listInstanceRecords(root) {
|
|
|
17201
17289
|
const names = /* @__PURE__ */ new Set();
|
|
17202
17290
|
for (const entry of entries) {
|
|
17203
17291
|
if (!entry.isDirectory()) continue;
|
|
17204
|
-
const recordPath =
|
|
17292
|
+
const recordPath = join5(root, entry.name, INSTANCE_RECORD_FILE_NAME);
|
|
17205
17293
|
if (!existsSync3(recordPath)) continue;
|
|
17206
17294
|
const record2 = readRecordFile(recordPath);
|
|
17207
17295
|
if (record2.kind === "error") return record2;
|
|
@@ -17248,7 +17336,7 @@ function writeInstanceRecord(root, record2) {
|
|
|
17248
17336
|
`Cannot create or secure the data directory for instance ${validated.data.name}.`
|
|
17249
17337
|
);
|
|
17250
17338
|
}
|
|
17251
|
-
const temporaryPath =
|
|
17339
|
+
const temporaryPath = join5(
|
|
17252
17340
|
paths.value.instanceDir,
|
|
17253
17341
|
`.${INSTANCE_RECORD_FILE_NAME}.${String(process.pid)}.${randomUUID2()}.tmp`
|
|
17254
17342
|
);
|
|
@@ -17298,7 +17386,7 @@ function defaultIsProcessAlive(pid) {
|
|
|
17298
17386
|
}
|
|
17299
17387
|
function readLockOwner(lockPath) {
|
|
17300
17388
|
try {
|
|
17301
|
-
const raw = JSON.parse(readFileSync2(
|
|
17389
|
+
const raw = JSON.parse(readFileSync2(join5(lockPath, LOCK_OWNER_FILE_NAME), "utf8"));
|
|
17302
17390
|
const parsed = InstanceLockOwnerSchema.safeParse(raw);
|
|
17303
17391
|
return parsed.success ? parsed.data : null;
|
|
17304
17392
|
} catch {
|
|
@@ -17356,7 +17444,7 @@ async function acquireDirectoryLock(lockPath, options) {
|
|
|
17356
17444
|
while (now() - startedAt <= timeoutMs) {
|
|
17357
17445
|
const token = createToken();
|
|
17358
17446
|
try {
|
|
17359
|
-
|
|
17447
|
+
mkdirSync3(lockPath, { mode: 448 });
|
|
17360
17448
|
} catch (error51) {
|
|
17361
17449
|
if (nodeErrorCode(error51) !== "EEXIST") {
|
|
17362
17450
|
return instanceRegistryError("registry_io", `Cannot acquire lifecycle lock ${lockPath}.`);
|
|
@@ -17377,7 +17465,7 @@ async function acquireDirectoryLock(lockPath, options) {
|
|
|
17377
17465
|
token,
|
|
17378
17466
|
createdAt: new Date(now()).toISOString()
|
|
17379
17467
|
};
|
|
17380
|
-
const ownerPath =
|
|
17468
|
+
const ownerPath = join5(lockPath, LOCK_OWNER_FILE_NAME);
|
|
17381
17469
|
writeFileSync(ownerPath, `${JSON.stringify(owner)}
|
|
17382
17470
|
`, {
|
|
17383
17471
|
encoding: "utf8",
|
|
@@ -17407,7 +17495,7 @@ async function acquireDirectoryLock(lockPath, options) {
|
|
|
17407
17495
|
}
|
|
17408
17496
|
async function acquireRegistryLock(root, options = {}) {
|
|
17409
17497
|
const ensured = ensureInstancesRoot(root);
|
|
17410
|
-
return ensured.kind === "error" ? ensured : acquireDirectoryLock(
|
|
17498
|
+
return ensured.kind === "error" ? ensured : acquireDirectoryLock(join5(root, ROOT_LOCK_DIRECTORY_NAME), options);
|
|
17411
17499
|
}
|
|
17412
17500
|
async function acquireInstanceLock(root, rawName, options = {}) {
|
|
17413
17501
|
const paths = getInstancePaths(root, rawName);
|
|
@@ -18464,7 +18552,7 @@ var init_browserRuntimeContract = __esm({
|
|
|
18464
18552
|
|
|
18465
18553
|
// src/cli/detect-tools.ts
|
|
18466
18554
|
import { existsSync as existsSync5 } from "node:fs";
|
|
18467
|
-
import { join as
|
|
18555
|
+
import { join as join7 } from "node:path";
|
|
18468
18556
|
import { homedir as homedir2 } from "node:os";
|
|
18469
18557
|
function which(bin) {
|
|
18470
18558
|
return resolveExecutableOnPath(bin);
|
|
@@ -18473,31 +18561,31 @@ function tryDir(path2) {
|
|
|
18473
18561
|
return existsSync5(path2) ? path2 : null;
|
|
18474
18562
|
}
|
|
18475
18563
|
function detectClaudeCode() {
|
|
18476
|
-
const configDir = tryDir(
|
|
18564
|
+
const configDir = tryDir(join7(homedir2(), ".claude"));
|
|
18477
18565
|
const bin = which("claude");
|
|
18478
18566
|
if (configDir === null && bin === null) return { found: false };
|
|
18479
18567
|
return { found: true, path: configDir ?? bin ?? "" };
|
|
18480
18568
|
}
|
|
18481
18569
|
function detectOpenCode() {
|
|
18482
|
-
const configDir = tryDir(
|
|
18570
|
+
const configDir = tryDir(join7(homedir2(), ".config", "opencode"));
|
|
18483
18571
|
const bin = which("opencode");
|
|
18484
18572
|
if (configDir === null && bin === null) return { found: false };
|
|
18485
18573
|
return { found: true, path: configDir ?? bin ?? "" };
|
|
18486
18574
|
}
|
|
18487
18575
|
function detectMiMo() {
|
|
18488
|
-
const configDir = tryDir(
|
|
18576
|
+
const configDir = tryDir(join7(homedir2(), ".config", "mimocode")) ?? tryDir(join7(homedir2(), ".mimocode"));
|
|
18489
18577
|
const bin = which("mimo");
|
|
18490
18578
|
if (configDir === null && bin === null) return { found: false };
|
|
18491
18579
|
return { found: true, path: configDir ?? bin ?? "" };
|
|
18492
18580
|
}
|
|
18493
18581
|
function detectCursor() {
|
|
18494
|
-
const configDir = tryDir(
|
|
18582
|
+
const configDir = tryDir(join7(homedir2(), ".cursor"));
|
|
18495
18583
|
const bin = which("cursor");
|
|
18496
18584
|
if (configDir === null && bin === null) return { found: false };
|
|
18497
18585
|
return { found: true, path: configDir ?? bin ?? "" };
|
|
18498
18586
|
}
|
|
18499
18587
|
function detectCody() {
|
|
18500
|
-
const configDir = tryDir(
|
|
18588
|
+
const configDir = tryDir(join7(homedir2(), ".config", "cody"));
|
|
18501
18589
|
const bin = which("cody");
|
|
18502
18590
|
if (configDir === null && bin === null) return { found: false };
|
|
18503
18591
|
return { found: true, path: configDir ?? bin ?? "" };
|
|
@@ -19553,7 +19641,7 @@ __export(onboard_exports, {
|
|
|
19553
19641
|
runOnboard: () => runOnboard
|
|
19554
19642
|
});
|
|
19555
19643
|
import {
|
|
19556
|
-
mkdirSync as
|
|
19644
|
+
mkdirSync as mkdirSync4,
|
|
19557
19645
|
writeFileSync as writeFileSync2,
|
|
19558
19646
|
existsSync as existsSync6,
|
|
19559
19647
|
readFileSync as readFileSync3,
|
|
@@ -19562,7 +19650,7 @@ import {
|
|
|
19562
19650
|
rmdirSync
|
|
19563
19651
|
} from "node:fs";
|
|
19564
19652
|
import { homedir as homedir3 } from "node:os";
|
|
19565
|
-
import { dirname as dirname2, join as
|
|
19653
|
+
import { dirname as dirname2, join as join8 } from "node:path";
|
|
19566
19654
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
19567
19655
|
function actionForStatus(label, state) {
|
|
19568
19656
|
switch (state) {
|
|
@@ -19894,15 +19982,15 @@ Exit codes:
|
|
|
19894
19982
|
`);
|
|
19895
19983
|
}
|
|
19896
19984
|
function resolveTargets(flags) {
|
|
19897
|
-
const claudeRoot = flags.skillDir ??
|
|
19898
|
-
const claudeSkillDir =
|
|
19899
|
-
const claudeCommandsDir =
|
|
19900
|
-
const codexRoot = process.env["CODEX_HOME"] ??
|
|
19901
|
-
const codexSkillsDir = flags.codexSkillDir ??
|
|
19985
|
+
const claudeRoot = flags.skillDir ?? join8(homedir3(), ".claude");
|
|
19986
|
+
const claudeSkillDir = join8(claudeRoot, "skills", SKILL_DIR_NAME);
|
|
19987
|
+
const claudeCommandsDir = join8(claudeRoot, "commands");
|
|
19988
|
+
const codexRoot = process.env["CODEX_HOME"] ?? join8(homedir3(), ".codex");
|
|
19989
|
+
const codexSkillsDir = flags.codexSkillDir ?? join8(codexRoot, "skills");
|
|
19902
19990
|
return {
|
|
19903
|
-
claudeSkillFile:
|
|
19904
|
-
claudeCommandFile:
|
|
19905
|
-
codexSkillFile:
|
|
19991
|
+
claudeSkillFile: join8(claudeSkillDir, SKILL_FILE_NAME),
|
|
19992
|
+
claudeCommandFile: join8(claudeCommandsDir, COMMAND_FILE_NAME),
|
|
19993
|
+
codexSkillFile: join8(codexSkillsDir, SKILL_DIR_NAME, SKILL_FILE_NAME)
|
|
19906
19994
|
};
|
|
19907
19995
|
}
|
|
19908
19996
|
function isObject2(value) {
|
|
@@ -19921,32 +20009,32 @@ function resolveOpenCodeConfigPath(flags) {
|
|
|
19921
20009
|
if (flags.opencodeConfig !== null) {
|
|
19922
20010
|
return flags.opencodeConfig;
|
|
19923
20011
|
}
|
|
19924
|
-
const configDir =
|
|
19925
|
-
const jsoncPath =
|
|
20012
|
+
const configDir = join8(homedir3(), ".config", "opencode");
|
|
20013
|
+
const jsoncPath = join8(configDir, "opencode.jsonc");
|
|
19926
20014
|
if (existsSync6(jsoncPath)) {
|
|
19927
20015
|
return jsoncPath;
|
|
19928
20016
|
}
|
|
19929
|
-
return
|
|
20017
|
+
return join8(configDir, "opencode.json");
|
|
19930
20018
|
}
|
|
19931
20019
|
function resolveMiMoConfigPath(flags) {
|
|
19932
20020
|
if (flags.mimoConfig !== null) {
|
|
19933
20021
|
return flags.mimoConfig;
|
|
19934
20022
|
}
|
|
19935
|
-
const configDir =
|
|
19936
|
-
const jsoncPath =
|
|
20023
|
+
const configDir = join8(homedir3(), ".config", "mimocode");
|
|
20024
|
+
const jsoncPath = join8(configDir, "mimocode.jsonc");
|
|
19937
20025
|
if (existsSync6(jsoncPath)) {
|
|
19938
20026
|
return jsoncPath;
|
|
19939
20027
|
}
|
|
19940
|
-
const jsonPath =
|
|
20028
|
+
const jsonPath = join8(configDir, "mimocode.json");
|
|
19941
20029
|
if (existsSync6(jsonPath)) {
|
|
19942
20030
|
return jsonPath;
|
|
19943
20031
|
}
|
|
19944
|
-
const legacyDir =
|
|
19945
|
-
const legacyJsoncPath =
|
|
20032
|
+
const legacyDir = join8(homedir3(), ".mimocode");
|
|
20033
|
+
const legacyJsoncPath = join8(legacyDir, "config.jsonc");
|
|
19946
20034
|
if (existsSync6(legacyJsoncPath)) {
|
|
19947
20035
|
return legacyJsoncPath;
|
|
19948
20036
|
}
|
|
19949
|
-
const legacyJsonPath =
|
|
20037
|
+
const legacyJsonPath = join8(legacyDir, "config.json");
|
|
19950
20038
|
if (existsSync6(legacyJsonPath)) {
|
|
19951
20039
|
return legacyJsonPath;
|
|
19952
20040
|
}
|
|
@@ -20351,8 +20439,8 @@ function buildDetectedSummary() {
|
|
|
20351
20439
|
}
|
|
20352
20440
|
function readPackageVersion() {
|
|
20353
20441
|
const packageJsonPaths = [
|
|
20354
|
-
|
|
20355
|
-
|
|
20442
|
+
join8(__dirname, "..", "package.json"),
|
|
20443
|
+
join8(__dirname, "..", "..", "package.json")
|
|
20356
20444
|
];
|
|
20357
20445
|
try {
|
|
20358
20446
|
for (const packageJsonPath of packageJsonPaths) {
|
|
@@ -20642,7 +20730,7 @@ No files were removed.
|
|
|
20642
20730
|
}
|
|
20643
20731
|
for (const plan of agentPlans) {
|
|
20644
20732
|
if (plan.shouldRemove && plan.body !== null) {
|
|
20645
|
-
|
|
20733
|
+
mkdirSync4(dirname2(plan.status.path), { recursive: true });
|
|
20646
20734
|
writeFileSync2(plan.status.path, plan.body, "utf8");
|
|
20647
20735
|
process.stdout.write(`Removed ${plan.status.label} entry from: ${plan.status.path}
|
|
20648
20736
|
`);
|
|
@@ -20882,12 +20970,12 @@ No files were written.
|
|
|
20882
20970
|
}
|
|
20883
20971
|
try {
|
|
20884
20972
|
for (const file2 of filesToWrite) {
|
|
20885
|
-
|
|
20973
|
+
mkdirSync4(dirname2(file2.path), { recursive: true });
|
|
20886
20974
|
writeFileSync2(file2.path, file2.body, "utf8");
|
|
20887
20975
|
}
|
|
20888
20976
|
for (const plan of agentPlansToWrite) {
|
|
20889
20977
|
if (plan.body !== null) {
|
|
20890
|
-
|
|
20978
|
+
mkdirSync4(dirname2(plan.status.path), { recursive: true });
|
|
20891
20979
|
writeFileSync2(plan.status.path, plan.body, "utf8");
|
|
20892
20980
|
}
|
|
20893
20981
|
}
|
|
@@ -20979,7 +21067,7 @@ __export(doctor_exports, {
|
|
|
20979
21067
|
runDoctor: () => runDoctor
|
|
20980
21068
|
});
|
|
20981
21069
|
import { existsSync as existsSync7, readFileSync as readFileSync4, readdirSync as readdirSync5, statSync as statSync4 } from "node:fs";
|
|
20982
|
-
import { isAbsolute as isAbsolute5, join as
|
|
21070
|
+
import { isAbsolute as isAbsolute5, join as join9, resolve as resolve5 } from "node:path";
|
|
20983
21071
|
import { createConnection } from "node:net";
|
|
20984
21072
|
function check2(name, severity, message, hint = "") {
|
|
20985
21073
|
return {
|
|
@@ -21099,10 +21187,10 @@ function providerConfigCandidates(options, deps) {
|
|
|
21099
21187
|
}
|
|
21100
21188
|
if (options.configDir !== null) {
|
|
21101
21189
|
const dir = resolveMaybeRelative(deps.cwd, options.configDir);
|
|
21102
|
-
return [
|
|
21190
|
+
return [join9(dir, "providers.json"), join9(dir, "config.json")];
|
|
21103
21191
|
}
|
|
21104
21192
|
const dataDir = resolveDefaultDataDir(deps.env, deps.platform, deps.exists);
|
|
21105
|
-
return [
|
|
21193
|
+
return [join9(dataDir, "providers.json"), join9(dataDir, "config.json")];
|
|
21106
21194
|
}
|
|
21107
21195
|
function checkProviderConfig(options, deps) {
|
|
21108
21196
|
const providersJson = options.providersJson ?? deps.env["AGENT_INSPECTOR_PROVIDERS_JSON"] ?? null;
|
|
@@ -21237,7 +21325,7 @@ function readinessChecks(readiness) {
|
|
|
21237
21325
|
function findProjectRoot(startDir, deps) {
|
|
21238
21326
|
let current = resolve5(startDir);
|
|
21239
21327
|
for (let i = 0; i < 6; i++) {
|
|
21240
|
-
if (deps.exists(
|
|
21328
|
+
if (deps.exists(join9(current, "package.json"))) return current;
|
|
21241
21329
|
const next = resolve5(current, "..");
|
|
21242
21330
|
if (next === current) return startDir;
|
|
21243
21331
|
current = next;
|
|
@@ -21245,7 +21333,7 @@ function findProjectRoot(startDir, deps) {
|
|
|
21245
21333
|
return startDir;
|
|
21246
21334
|
}
|
|
21247
21335
|
function checkPackage(rootDir, deps) {
|
|
21248
|
-
const packagePath =
|
|
21336
|
+
const packagePath = join9(rootDir, "package.json");
|
|
21249
21337
|
const text = deps.readText(packagePath);
|
|
21250
21338
|
if (text === null) {
|
|
21251
21339
|
return check2("Package metadata", "warn", "package.json was not found near the CLI bundle.");
|
|
@@ -21270,7 +21358,7 @@ function countFilesInDir(dir, deps) {
|
|
|
21270
21358
|
if (files === null) return null;
|
|
21271
21359
|
let count = 0;
|
|
21272
21360
|
for (const file2 of files) {
|
|
21273
|
-
const fileStat = deps.stat(
|
|
21361
|
+
const fileStat = deps.stat(join9(dir, file2));
|
|
21274
21362
|
if (fileStat !== null && !fileStat.isDirectory) count += 1;
|
|
21275
21363
|
}
|
|
21276
21364
|
return count;
|
|
@@ -21290,24 +21378,24 @@ function dirSize(dir, deps, depth = 0) {
|
|
|
21290
21378
|
if (files === null) return null;
|
|
21291
21379
|
let total = 0;
|
|
21292
21380
|
for (const file2 of files) {
|
|
21293
|
-
const childSize = dirSize(
|
|
21381
|
+
const childSize = dirSize(join9(dir, file2), deps, depth + 1);
|
|
21294
21382
|
if (childSize !== null) total += childSize;
|
|
21295
21383
|
}
|
|
21296
21384
|
return total;
|
|
21297
21385
|
}
|
|
21298
21386
|
function verboseChecks(options, deps) {
|
|
21299
21387
|
const dataDir = resolveDefaultDataDir(deps.env, deps.platform, deps.exists);
|
|
21300
|
-
const logsDir =
|
|
21301
|
-
const chunksDir =
|
|
21388
|
+
const logsDir = join9(dataDir, "logs");
|
|
21389
|
+
const chunksDir = join9(dataDir, "chunks");
|
|
21302
21390
|
const providerCandidates = providerConfigCandidates(options, deps);
|
|
21303
21391
|
const captureMode = deps.env["AGENT_INSPECTOR_MODE"] ?? deps.env["AGENT_INSPECTOR_CAPTURE_MODE"] ?? "simple";
|
|
21304
21392
|
const logCount = countFilesInDir(logsDir, deps);
|
|
21305
21393
|
const logSize = dirSize(logsDir, deps);
|
|
21306
21394
|
const chunkSize = dirSize(chunksDir, deps);
|
|
21307
21395
|
const homeDir = deps.platform === "win32" ? deps.env["USERPROFILE"] ?? deps.env["APPDATA"] ?? null : deps.env["HOME"] ?? null;
|
|
21308
|
-
const claudeSkill = homeDir === null ? null :
|
|
21309
|
-
const claudeCommand = homeDir === null ? null :
|
|
21310
|
-
const codexSkill = homeDir === null ? null :
|
|
21396
|
+
const claudeSkill = homeDir === null ? null : join9(homeDir, ".claude", "skills", "agent-inspector-onboard", "SKILL.md");
|
|
21397
|
+
const claudeCommand = homeDir === null ? null : join9(homeDir, ".claude", "commands", "agent-inspector-onboard.md");
|
|
21398
|
+
const codexSkill = homeDir === null ? null : join9(homeDir, ".codex", "skills", "agent-inspector-onboard", "SKILL.md");
|
|
21311
21399
|
const hasClaudeOnboarding = claudeSkill !== null && claudeCommand !== null && deps.exists(claudeSkill) && deps.exists(claudeCommand);
|
|
21312
21400
|
const hasCodexOnboarding = codexSkill !== null && deps.exists(codexSkill);
|
|
21313
21401
|
return [
|
|
@@ -21339,8 +21427,8 @@ function verboseChecks(options, deps) {
|
|
|
21339
21427
|
];
|
|
21340
21428
|
}
|
|
21341
21429
|
function checkExtensionSource(rootDir, deps) {
|
|
21342
|
-
const extensionDir =
|
|
21343
|
-
const missing = EXTENSION_REQUIRED_FILES.filter((file2) => !deps.exists(
|
|
21430
|
+
const extensionDir = join9(rootDir, "extensions", "chrome");
|
|
21431
|
+
const missing = EXTENSION_REQUIRED_FILES.filter((file2) => !deps.exists(join9(extensionDir, file2)));
|
|
21344
21432
|
if (missing.length === 0) {
|
|
21345
21433
|
return check2(
|
|
21346
21434
|
"Chrome extension source",
|
|
@@ -21356,7 +21444,7 @@ function checkExtensionSource(rootDir, deps) {
|
|
|
21356
21444
|
);
|
|
21357
21445
|
}
|
|
21358
21446
|
function extensionManifestVersion(rootDir, deps) {
|
|
21359
|
-
const manifestText = deps.readText(
|
|
21447
|
+
const manifestText = deps.readText(join9(rootDir, "extensions", "chrome", "manifest.json"));
|
|
21360
21448
|
if (manifestText === null) return null;
|
|
21361
21449
|
try {
|
|
21362
21450
|
const manifest = JSON.parse(manifestText);
|
|
@@ -21368,7 +21456,7 @@ function extensionManifestVersion(rootDir, deps) {
|
|
|
21368
21456
|
}
|
|
21369
21457
|
}
|
|
21370
21458
|
function checkExtensionPackage(rootDir, deps) {
|
|
21371
|
-
const distDir =
|
|
21459
|
+
const distDir = join9(rootDir, "dist", "chrome-extension");
|
|
21372
21460
|
const files = deps.listDir(distDir);
|
|
21373
21461
|
if (files === null) {
|
|
21374
21462
|
return check2(
|
|
@@ -21990,8 +22078,8 @@ import { Buffer as Buffer5 } from "node:buffer";
|
|
|
21990
22078
|
import { spawn as spawn2 } from "node:child_process";
|
|
21991
22079
|
import { createConnection as createConnection2 } from "node:net";
|
|
21992
22080
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
21993
|
-
import { dirname as dirname3, join as
|
|
21994
|
-
import { appendFileSync, existsSync as existsSync8, mkdirSync as
|
|
22081
|
+
import { dirname as dirname3, join as join10, resolve as resolvePath2 } from "node:path";
|
|
22082
|
+
import { appendFileSync, existsSync as existsSync8, mkdirSync as mkdirSync5 } from "node:fs";
|
|
21995
22083
|
|
|
21996
22084
|
// src/cli/startupOutput.ts
|
|
21997
22085
|
function shouldSuppressServerOutputLine(line, context) {
|
|
@@ -22192,7 +22280,7 @@ import { createHash as createHash2, randomUUID as randomUUID3 } from "node:crypt
|
|
|
22192
22280
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
22193
22281
|
import { constants as constants2, existsSync as existsSync4, lstatSync as lstatSync2 } from "node:fs";
|
|
22194
22282
|
import { link, lstat, open, readFile, readdir, stat, unlink } from "node:fs/promises";
|
|
22195
|
-
import { basename, join as
|
|
22283
|
+
import { basename as basename2, join as join6, resolve as resolve3 } from "node:path";
|
|
22196
22284
|
|
|
22197
22285
|
// src/proxy/schemas.ts
|
|
22198
22286
|
init_zod();
|
|
@@ -22809,12 +22897,12 @@ async function inspectExistingQuarantine(filePath, expected) {
|
|
|
22809
22897
|
}
|
|
22810
22898
|
}
|
|
22811
22899
|
async function quarantineTail(context, sourceFile, tail, tailOffset) {
|
|
22812
|
-
const quarantineDirectory =
|
|
22900
|
+
const quarantineDirectory = join6(context.root, QUARANTINE_DIRECTORY);
|
|
22813
22901
|
if (!ensurePrivateDirectorySync(quarantineDirectory)) return null;
|
|
22814
22902
|
const tailSha256 = hashBytes(tail);
|
|
22815
|
-
const sourceFileName =
|
|
22816
|
-
const destination =
|
|
22817
|
-
const temporary =
|
|
22903
|
+
const sourceFileName = basename2(sourceFile);
|
|
22904
|
+
const destination = join6(quarantineDirectory, `${sourceFileName}.tail-${tailSha256}.json`);
|
|
22905
|
+
const temporary = join6(
|
|
22818
22906
|
quarantineDirectory,
|
|
22819
22907
|
`.${sourceFileName}.${String(process.pid)}.${randomUUID3()}.tmp`
|
|
22820
22908
|
);
|
|
@@ -22955,7 +23043,7 @@ async function recoverFile(context, filePath) {
|
|
|
22955
23043
|
}
|
|
22956
23044
|
}
|
|
22957
23045
|
function applyFileResult(context, filePath, result) {
|
|
22958
|
-
const file2 =
|
|
23046
|
+
const file2 = basename2(filePath);
|
|
22959
23047
|
switch (result.status) {
|
|
22960
23048
|
case "clean":
|
|
22961
23049
|
context.safeFiles.set(filePath, result.signature);
|
|
@@ -23001,7 +23089,7 @@ async function runStartupRecovery(context) {
|
|
|
23001
23089
|
}
|
|
23002
23090
|
const files = entries.filter((entry) => entry.endsWith(".jsonl")).sort();
|
|
23003
23091
|
for (const file2 of files) {
|
|
23004
|
-
const filePath =
|
|
23092
|
+
const filePath = join6(context.root, file2);
|
|
23005
23093
|
const result = await recoverFile(context, filePath);
|
|
23006
23094
|
applyFileResult(context, filePath, result);
|
|
23007
23095
|
if (context.health.level === "unavailable") break;
|
|
@@ -24941,6 +25029,8 @@ var BRANDED_WINDOWS_RUNTIME_EXE = "agent-inspector.exe";
|
|
|
24941
25029
|
var DEFAULT_CAPTURE_MODE2 = "simple";
|
|
24942
25030
|
var DEFAULT_SHUTDOWN_DEADLINE_MS = 15e3;
|
|
24943
25031
|
var SUPERVISOR_SHUTDOWN_GRACE_MS = 2e3;
|
|
25032
|
+
var FORCE_RESTART_PORT_RELEASE_TIMEOUT_MS = 1e4;
|
|
25033
|
+
var FORCE_RESTART_PORT_RELEASE_POLL_MS = 100;
|
|
24944
25034
|
var TYPESCRIPT_STARTUP_READY_TIMEOUT_MS = 1e4;
|
|
24945
25035
|
var RUST_STARTUP_READY_TIMEOUT_MS = 6e4;
|
|
24946
25036
|
var AGENT_INSPECTOR_BACKGROUND_SUPERVISOR_ENV = "AGENT_INSPECTOR_BACKGROUND_SUPERVISOR";
|
|
@@ -25098,6 +25188,30 @@ function sleep2(ms) {
|
|
|
25098
25188
|
setTimeout(resolve6, ms);
|
|
25099
25189
|
});
|
|
25100
25190
|
}
|
|
25191
|
+
async function waitForPortToRelease(port, host) {
|
|
25192
|
+
const deadline = Date.now() + FORCE_RESTART_PORT_RELEASE_TIMEOUT_MS;
|
|
25193
|
+
while (Date.now() < deadline) {
|
|
25194
|
+
if (!await isPortAcceptingConnections(port, host)) return true;
|
|
25195
|
+
await sleep2(FORCE_RESTART_PORT_RELEASE_POLL_MS);
|
|
25196
|
+
}
|
|
25197
|
+
return !await isPortAcceptingConnections(port, host);
|
|
25198
|
+
}
|
|
25199
|
+
async function waitForPortsToRelease(ports, host) {
|
|
25200
|
+
let released = true;
|
|
25201
|
+
for (const port of ports) {
|
|
25202
|
+
if (!await waitForPortToRelease(port, host)) {
|
|
25203
|
+
const remaining = findPidsByPort(port);
|
|
25204
|
+
const suffix = remaining.length === 0 ? "" : ` Remaining listener PID(s): ${remaining.join(", ")}.`;
|
|
25205
|
+
console.error(
|
|
25206
|
+
`Port ${String(port)} did not release after ${String(
|
|
25207
|
+
FORCE_RESTART_PORT_RELEASE_TIMEOUT_MS
|
|
25208
|
+
)}ms.${suffix}`
|
|
25209
|
+
);
|
|
25210
|
+
released = false;
|
|
25211
|
+
}
|
|
25212
|
+
}
|
|
25213
|
+
return released;
|
|
25214
|
+
}
|
|
25101
25215
|
function startupReadyTimeoutMs(backend) {
|
|
25102
25216
|
const configured = Number(process.env["AGENT_INSPECTOR_STARTUP_READY_TIMEOUT_MS"] ?? "");
|
|
25103
25217
|
if (Number.isInteger(configured) && configured > 0) return configured;
|
|
@@ -25139,10 +25253,10 @@ function pipeServerOutput(child, context) {
|
|
|
25139
25253
|
}
|
|
25140
25254
|
function createBackgroundSupervisorLogs(env) {
|
|
25141
25255
|
try {
|
|
25142
|
-
const logsDir =
|
|
25143
|
-
|
|
25144
|
-
const stdoutPath =
|
|
25145
|
-
const stderrPath =
|
|
25256
|
+
const logsDir = join10(resolveDataDir(existsSync8, env), "logs");
|
|
25257
|
+
mkdirSync5(logsDir, { recursive: true });
|
|
25258
|
+
const stdoutPath = join10(logsDir, "backend.stdout.log");
|
|
25259
|
+
const stderrPath = join10(logsDir, "backend.stderr.log");
|
|
25146
25260
|
const header = `
|
|
25147
25261
|
[${(/* @__PURE__ */ new Date()).toISOString()}] Agent Inspector backend process started
|
|
25148
25262
|
`;
|
|
@@ -25217,7 +25331,7 @@ function resolveServerCommand(outputDir, serverPath, backend) {
|
|
|
25217
25331
|
command: { command: resolved.value.command, args: [...resolved.value.args] }
|
|
25218
25332
|
};
|
|
25219
25333
|
}
|
|
25220
|
-
const brandedRuntime =
|
|
25334
|
+
const brandedRuntime = join10(outputDir, BRANDED_WINDOWS_RUNTIME_EXE);
|
|
25221
25335
|
return {
|
|
25222
25336
|
kind: "success",
|
|
25223
25337
|
command: process.platform === "win32" && existsSync8(brandedRuntime) ? { command: brandedRuntime, args: [serverPath] } : { command: process.execPath, args: [serverPath] }
|
|
@@ -25615,8 +25729,8 @@ async function runStart(args) {
|
|
|
25615
25729
|
process.exitCode = 1;
|
|
25616
25730
|
return;
|
|
25617
25731
|
}
|
|
25618
|
-
const uiDirectoryCandidate =
|
|
25619
|
-
const uiIndexPath =
|
|
25732
|
+
const uiDirectoryCandidate = join10(__dirname2, "../.output/ui");
|
|
25733
|
+
const uiIndexPath = join10(uiDirectoryCandidate, "index.html");
|
|
25620
25734
|
const uiDirectory = serveUi && existsSync8(uiIndexPath) ? uiDirectoryCandidate : void 0;
|
|
25621
25735
|
if (serveUi && uiDirectory === void 0) {
|
|
25622
25736
|
console.error(
|
|
@@ -25626,7 +25740,7 @@ async function runStart(args) {
|
|
|
25626
25740
|
return;
|
|
25627
25741
|
}
|
|
25628
25742
|
const outputDir = __dirname2;
|
|
25629
|
-
const serverPath =
|
|
25743
|
+
const serverPath = join10(outputDir, "../.output/server/index.mjs");
|
|
25630
25744
|
const serverCommandResolution = resolveServerCommand(outputDir, serverPath, backend);
|
|
25631
25745
|
if (serverCommandResolution.kind === "error") {
|
|
25632
25746
|
console.error(serverCommandResolution.message);
|
|
@@ -25638,7 +25752,9 @@ async function runStart(args) {
|
|
|
25638
25752
|
const pids = findPidsByPort(targetPort);
|
|
25639
25753
|
for (const pid of pids) {
|
|
25640
25754
|
console.log(`Killing process ${pid} on port ${targetPort}...`);
|
|
25641
|
-
killPid(pid)
|
|
25755
|
+
if (!killPid(pid)) {
|
|
25756
|
+
console.error(`Failed to kill process ${pid} on port ${targetPort}.`);
|
|
25757
|
+
}
|
|
25642
25758
|
}
|
|
25643
25759
|
}
|
|
25644
25760
|
const legacyAliasPort = enableIdentityProxy && legacyAliasEnabled && port === DEFAULT_PORT4 ? LEGACY_ALIAS_PORT : null;
|
|
@@ -25711,6 +25827,11 @@ async function runStart(args) {
|
|
|
25711
25827
|
for (const targetPort of restartPorts) {
|
|
25712
25828
|
killProcessOnPort(targetPort);
|
|
25713
25829
|
}
|
|
25830
|
+
if (!await waitForPortsToRelease(restartPorts, host)) {
|
|
25831
|
+
console.error("Agent Inspector could not restart because one or more ports are still busy.");
|
|
25832
|
+
process.exitCode = 1;
|
|
25833
|
+
return;
|
|
25834
|
+
}
|
|
25714
25835
|
}
|
|
25715
25836
|
if (background && enableIdentityProxy) {
|
|
25716
25837
|
const cliEntry = process.argv[1];
|
|
@@ -25773,7 +25894,7 @@ async function runStart(args) {
|
|
|
25773
25894
|
serverEnv[AGENT_INSPECTOR_CLI_ENTRY_ENV] = currentCliEntry;
|
|
25774
25895
|
}
|
|
25775
25896
|
if (configDir !== void 0) {
|
|
25776
|
-
let resolvedPath =
|
|
25897
|
+
let resolvedPath = join10(configDir);
|
|
25777
25898
|
const msysMatch = /^\\([a-z])\\(.*)$/i.exec(resolvedPath);
|
|
25778
25899
|
if (msysMatch !== null) {
|
|
25779
25900
|
const drive = (msysMatch[1] ?? "").toUpperCase();
|
|
@@ -25799,7 +25920,7 @@ async function runStart(args) {
|
|
|
25799
25920
|
serverEnv["AGENT_INSPECTOR_CAPTURE_MODE"] = captureMode;
|
|
25800
25921
|
serverEnv[AGENT_INSPECTOR_BACKEND_ENV] = backend;
|
|
25801
25922
|
serverEnv["AGENT_INSPECTOR_BACKEND_ONLY"] = serveUi ? "0" : "1";
|
|
25802
|
-
const workerDir =
|
|
25923
|
+
const workerDir = join10(__dirname2, "workers");
|
|
25803
25924
|
if (existsSync8(workerDir)) {
|
|
25804
25925
|
serverEnv["AGENT_INSPECTOR_WORKER_DIR"] = workerDir;
|
|
25805
25926
|
}
|