@lowdefy/server-dev 7.1.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/Inspector.jsx +24 -75
- package/client/Page.jsx +8 -0
- package/client/Routing.jsx +0 -2
- package/client/clientBuildImports.test.mjs +5 -3
- package/client/devStreamConnections.test.mjs +1 -0
- package/client/journeyObserver/startJourneyObserver.test.mjs +11 -11
- package/client/openInEditor/OpenInEditorListener.jsx +36 -29
- package/client/openInEditor/OpenInEditorListener.test.mjs +116 -0
- package/client/{feedback → openInEditor}/elementInspect.js +9 -44
- package/client/openInEditor/findBlockLocation.js +2 -2
- package/client/openInEditor/openInEditorStyles.js +56 -0
- package/client/recorder/createPairingBuffer.test.mjs +27 -9
- package/client/recorder/createRecorder.js +11 -7
- package/client/recorder/createRecorder.test.mjs +9 -9
- package/client/recorder/isPasswordElement.js +41 -0
- package/client/recorder/keyChord.test.mjs +1 -0
- package/{client/recorder/toJsonSafe.js → lib/build/mobileConfig.js} +9 -12
- package/lib/client/auth/AuthConfigured.jsx +75 -48
- package/lib/client/auth/authNotConfiguredParity.test.mjs +1 -0
- package/lib/client/auth/authTemplateSync.test.mjs +1 -0
- package/lib/client/auth/betterAuthSessionContract.test.mjs +2 -1
- package/lib/client/auth/sessionCaller.js +56 -0
- package/lib/client/auth/sessionCaller.test.mjs +78 -0
- package/lib/client/getPagePath.test.mjs +1 -0
- package/lib/client/utils/formatErrorsForCopy.test.mjs +1 -0
- package/lib/client/utils/getErrorBarColor.test.mjs +1 -0
- package/lib/client/utils/usePageConfig.test.mjs +15 -15
- package/lib/configTree/buildConfigTree.test.mjs +6 -8
- package/lib/configTree/collectConfigText.test.mjs +1 -0
- package/lib/configTree/runConfigTreeBuild.mjs +2 -1
- package/lib/configTree/runConfigTreeBuild.skipPluginChecks.test.mjs +11 -11
- package/lib/configTree/runConfigTreeBuild.test.mjs +2 -2
- package/lib/docs/addNestedEndpoints.test.mjs +1 -0
- package/lib/docs/checkAgentFiles.test.mjs +1 -0
- package/lib/docs/checkStepReferences.test.mjs +3 -3
- package/lib/docs/clientErrorStore.test.mjs +4 -4
- package/lib/docs/createBrowserLifecycle.test.mjs +40 -24
- package/lib/docs/createDocsMcpServer.js +195 -138
- package/lib/docs/createDocsMcpServer.test.mjs +331 -25
- package/lib/docs/createDocsMcpServerRunJourney.test.mjs +5 -5
- package/lib/docs/createJourneyActors.chromium.test.mjs +3 -3
- package/lib/docs/createJourneyActors.test.mjs +4 -4
- package/lib/docs/dataSets/dataSetJourneys.chromium.mongodb.test.mjs +6 -6
- package/lib/docs/dataSets/drainSessionWork.test.mjs +21 -5
- package/lib/docs/dataSets/getDataStore.js +11 -3
- package/lib/docs/dataSets/getDataStore.mongodb.test.mjs +3 -3
- package/lib/docs/dataSets/getDataStore.test.mjs +32 -20
- package/lib/docs/dataSets/mergeCollectionIndexes.test.mjs +1 -0
- package/lib/docs/dataSets/openDataSession.js +4 -2
- package/lib/docs/dataSets/openDataSession.mongodb.test.mjs +25 -7
- package/lib/docs/dataSets/pickDataStorePort.test.mjs +2 -2
- package/lib/docs/dataSets/readDataSession.test.mjs +1 -0
- package/lib/docs/dataSets/readDataSet.test.mjs +1 -0
- package/lib/docs/dataSets/resolveJourneyDataSet.test.mjs +1 -0
- package/lib/docs/dataSets/test/buildTestApp.mjs +1 -1
- package/lib/docs/devEventBus.js +7 -2
- package/lib/docs/devEventBus.test.mjs +12 -10
- package/lib/docs/devToolDefinitions.js +101 -143
- package/lib/docs/device/buildDeviceCommand.js +103 -0
- package/lib/docs/device/buildDeviceCommand.test.mjs +142 -0
- package/lib/docs/device/captureDevice.js +85 -0
- package/lib/docs/device/checkShownPage.js +56 -0
- package/lib/docs/device/createFakePhoneTab.mjs +77 -0
- package/lib/docs/device/deviceAction.js +74 -0
- package/lib/docs/device/deviceTools.test.mjs +604 -0
- package/lib/docs/device/findDeviceTab.js +50 -0
- package/lib/docs/device/findDeviceTarget.js +73 -0
- package/lib/docs/device/injectDevice.js +160 -0
- package/lib/docs/device/listDevices.js +100 -0
- package/lib/docs/device/listDevices.test.mjs +105 -0
- package/lib/docs/device/runDeviceJourney.js +68 -0
- package/lib/docs/device/runDeviceSteps.js +164 -0
- package/lib/docs/device/screenshotDevice.js +68 -0
- package/lib/docs/device/sendDeviceStep.js +52 -0
- package/lib/docs/device/startDevice.js +150 -0
- package/lib/docs/docs.test.mjs +44 -28
- package/lib/docs/docsIndex.test.mjs +1 -0
- package/lib/docs/findConfig.js +3 -4
- package/lib/docs/findPageBlock.js +35 -0
- package/lib/docs/findPageBlock.test.mjs +45 -0
- package/lib/docs/fitResponse.js +18 -17
- package/lib/docs/fitResponse.test.mjs +18 -0
- package/lib/docs/getBrowser.js +3 -3
- package/lib/docs/getBrowser.test.mjs +32 -16
- package/lib/docs/getBuildId.test.mjs +1 -0
- package/lib/docs/getBuildStatus.test.mjs +11 -11
- package/lib/docs/getBuildStatusAfterEdits.test.mjs +8 -8
- package/{src/routes/docs/appMap.js → lib/docs/getConfigDirectory.js} +3 -5
- package/lib/docs/getHazards.js +4 -1
- package/lib/docs/getHazards.test.mjs +9 -7
- package/lib/docs/getOverview.js +20 -42
- package/lib/docs/getOverviewBasePath.test.mjs +1 -0
- package/lib/docs/getStaleStatus.test.mjs +1 -0
- package/lib/docs/inspectState.js +78 -3
- package/lib/docs/inspectState.test.mjs +61 -9
- package/lib/docs/inspectStateFromTab.js +38 -6
- package/lib/docs/inspectStateFromTab.test.mjs +79 -0
- package/lib/docs/inspectStateHeadless.js +98 -34
- package/lib/docs/inspectStateHeadless.test.mjs +17 -5
- package/lib/docs/installHeadlessShell.failure.test.mjs +9 -5
- package/lib/docs/installHeadlessShell.js +5 -2
- package/lib/docs/installHeadlessShell.test.mjs +8 -5
- package/lib/docs/installHeadlessShell.timeout.test.mjs +32 -12
- package/lib/docs/isDeepEqual.js +37 -0
- package/lib/docs/isHeadlessShellIncomplete.js +6 -5
- package/lib/docs/isHeadlessShellIncomplete.test.mjs +4 -1
- package/lib/docs/isPageReady.test.mjs +1 -0
- package/lib/docs/journeyMutantCookie.chromium.test.mjs +3 -3
- package/lib/docs/journeyRunRecording.test.mjs +1 -0
- package/lib/docs/keepEventStreamAlive.test.mjs +1 -0
- package/lib/docs/launchBrowser.test.mjs +8 -8
- package/lib/docs/listTypes.js +58 -8
- package/lib/docs/loadFrameworkHazards.test.mjs +1 -0
- package/lib/docs/matchJourneyRoute.test.mjs +1 -0
- package/lib/docs/observe/createJourneyAppErrors.test.mjs +18 -4
- package/lib/docs/observe/evaluateInvariants.js +23 -0
- package/lib/docs/observe/evaluateInvariants.test.mjs +27 -0
- package/lib/docs/observe/hasNoEffect.test.mjs +1 -0
- package/lib/docs/observe/toAppErrorFailure.js +7 -4
- package/lib/docs/observe/watchJourneyContext.js +1 -0
- package/lib/docs/observe/withAppErrors.test.mjs +22 -0
- package/lib/docs/openJourneyEmail.test.mjs +6 -6
- package/lib/docs/pageBuildStatus.test.mjs +6 -6
- package/lib/docs/pollTab.js +100 -0
- package/lib/docs/pollTab.test.mjs +64 -0
- package/lib/docs/rails/authEngineActions.test.mjs +1 -0
- package/lib/docs/rails/authEngineMethods.test.mjs +2 -1
- package/lib/docs/rails/checkAuthActionsRan.test.mjs +5 -5
- package/lib/docs/rails/createDataSetRails.test.mjs +1 -0
- package/lib/docs/rails/findExternalBlocks.test.mjs +1 -0
- package/lib/docs/readJourneyEmailMatch.test.mjs +2 -2
- package/lib/docs/readJourneySession.js +1 -1
- package/lib/docs/reportDevToolFault.js +29 -0
- package/lib/docs/reportDevToolFault.test.mjs +34 -0
- package/lib/docs/requestRestart.test.mjs +1 -0
- package/lib/docs/resolvePageInstance.test.mjs +1 -0
- package/lib/docs/resolveSource.js +2 -2
- package/lib/docs/resolveSource.test.mjs +6 -6
- package/lib/docs/reviewPageBuilds.test.mjs +2 -2
- package/lib/docs/runCheck.test.mjs +3 -3
- package/lib/docs/runCheckChild.js +2 -1
- package/lib/docs/runEndpoint.js +23 -10
- package/lib/docs/runEndpoint.test.mjs +42 -37
- package/lib/docs/runErrorBuffers.test.mjs +1 -0
- package/lib/docs/runJourney.js +21 -1
- package/lib/docs/runJourney.test.mjs +119 -99
- package/lib/docs/runJourneyDataSet.test.mjs +25 -25
- package/lib/docs/runJourneySteps.js +8 -29
- package/lib/docs/runRequest.js +6 -6
- package/lib/docs/runRequest.test.mjs +22 -22
- package/lib/docs/screenshotPage.js +6 -7
- package/lib/docs/screenshotPage.test.mjs +46 -46
- package/lib/docs/screenshotPageClip.test.mjs +10 -10
- package/lib/docs/searchDocs.test.mjs +1 -0
- package/lib/docs/searchIcons.test.mjs +5 -5
- package/lib/docs/selectFinalState.test.mjs +1 -0
- package/lib/docs/serverErrorStore.test.mjs +4 -4
- package/lib/docs/setupTestFixtures.mjs +25 -0
- package/lib/docs/splitSearchTerms.test.mjs +1 -0
- package/lib/docs/tabAvailable.js +1 -1
- package/lib/docs/tabChannel.js +90 -14
- package/lib/docs/tabChannel.test.mjs +40 -15
- package/lib/docs/validateJourneyTimeout.test.mjs +1 -0
- package/lib/docs/validateStateSelection.test.mjs +1 -0
- package/lib/docs/validateViewport.test.mjs +1 -0
- package/lib/docs/waitForBuild.test.mjs +1 -0
- package/lib/docs/withBrowserSlot.test.mjs +5 -5
- package/lib/server/applyDataSetRedirect.test.mjs +2 -2
- package/lib/server/applyDataSetRedirectTenantReach.test.mjs +1 -0
- package/lib/server/applyDataSetRedirectWalled.test.mjs +1 -0
- package/lib/server/auth/getHeadlessUser.js +6 -0
- package/lib/server/auth/getHeadlessUser.test.mjs +13 -2
- package/lib/server/auth/resolveHeadlessUser.test.mjs +1 -0
- package/lib/server/contextMapBudget.test.mjs +3 -3
- package/lib/server/continueJitKeys.test.mjs +1 -0
- package/lib/server/createLowdefyContext.js +5 -1
- package/lib/server/createLowdefyContext.test.mjs +32 -32
- package/lib/server/getClientAddress.test.mjs +2 -2
- package/lib/server/getPageJitEnrichment.test.mjs +1 -0
- package/lib/server/importAppCode.test.mjs +2 -2
- package/lib/server/jitPageBuilder.js +27 -3
- package/lib/server/jitPageBuilder.mobileTypes.test.mjs +65 -0
- package/lib/server/jitPageBuilder.skipPluginChecks.test.mjs +5 -6
- package/lib/server/jitPageBuilder.test.mjs +4 -4
- package/lib/server/journeyCookies.test.mjs +1 -0
- package/lib/server/loadDynamicJsMap.js +10 -1
- package/lib/server/log/createHandleError.js +10 -5
- package/lib/server/log/createHandleError.test.mjs +19 -8
- package/lib/server/log/createLogger.test.mjs +2 -2
- package/lib/server/mutantDataSetWrappers.test.mjs +1 -0
- package/lib/server/mutants/listMutants.test.mjs +1 -0
- package/lib/server/mutants/mutantRuns.test.mjs +1 -0
- package/lib/server/mutants/operators.test.mjs +1 -0
- package/lib/server/pageBuildRecords.test.mjs +1 -0
- package/lib/server/pageCache.test.mjs +1 -0
- package/lib/server/pageRebuilds.test.mjs +3 -3
- package/{src/routes/docs/examples.js → lib/server/pairingHeaders.js} +8 -15
- package/lib/server/pruneJitMaps.test.mjs +1 -0
- package/lib/server/readBuildApiArtifacts.test.mjs +1 -0
- package/lib/server/readInstanceRecord.test.mjs +24 -8
- package/lib/server/readMergedMaps.test.mjs +1 -0
- package/lib/server/recording/errorRecordingStamp.test.mjs +1 -0
- package/lib/server/recording/readRecordingCookie.test.mjs +2 -0
- package/lib/server/recording/servedBuilds.test.mjs +1 -0
- package/lib/server/sinkExternalConnections.test.mjs +6 -6
- package/lib/server/skipStaleMapWrites.test.mjs +12 -12
- package/lib/server/startIdleGc.test.mjs +25 -9
- package/lib/server/testFixtures/importAppCodeTwice.mjs +2 -2
- package/lib/vite/createDevServerExclude.test.mjs +1 -0
- package/lib/vite/keepIdleConnectionsOpen.js +36 -0
- package/lib/vite/keepIdleConnectionsOpen.test.mjs +104 -0
- package/manager/getContext.mjs +9 -0
- package/manager/processes/checkPendingPlugins.mjs +49 -0
- package/manager/processes/checkPendingPlugins.test.mjs +107 -0
- package/manager/processes/createIdleChild.mjs +141 -0
- package/manager/processes/createIdleChild.test.mjs +209 -0
- package/manager/processes/initialBuild.mjs +2 -15
- package/manager/processes/initialBuild.test.mjs +8 -40
- package/manager/processes/lowdefyBuild.mjs +7 -4
- package/manager/processes/lowdefyBuild.skipPluginChecks.test.mjs +13 -13
- package/manager/processes/lowdefyBuild.test.mjs +17 -15
- package/manager/processes/restartServer.test.mjs +63 -15
- package/manager/processes/shutdownServer.test.mjs +3 -3
- package/manager/processes/startFirstServer.test.mjs +23 -22
- package/manager/processes/startMailSink.mjs +11 -3
- package/manager/processes/startMailSink.test.mjs +28 -2
- package/manager/processes/startProxy.mjs +167 -29
- package/manager/processes/startProxy.pairing.test.mjs +204 -0
- package/manager/processes/startProxy.test.mjs +130 -5
- package/manager/processes/startServer.mjs +5 -7
- package/manager/processes/startServer.test.mjs +10 -9
- package/manager/processes/syncServer.mjs +31 -4
- package/manager/processes/syncServer.test.mjs +71 -6
- package/manager/processes/waitForDevServer.test.mjs +21 -6
- package/manager/run.mjs +32 -8
- package/manager/utils/BatchChanges.mjs +1 -1
- package/manager/utils/BatchChanges.test.mjs +4 -4
- package/manager/utils/acquireDevInstance.test.mjs +1 -0
- package/manager/utils/checkPairing.mjs +45 -0
- package/manager/utils/checkPairing.test.mjs +53 -0
- package/manager/utils/createBuildActivity.mjs +5 -1
- package/manager/utils/createBuildActivity.test.mjs +2 -2
- package/manager/utils/createChangeSignal.test.mjs +5 -5
- package/manager/utils/createCustomPluginMessagesMap.mjs +8 -3
- package/manager/utils/createCustomPluginTypesMap.mjs +48 -12
- package/manager/utils/createCustomPluginTypesMap.test.mjs +181 -19
- package/manager/utils/createDotPathIgnore.test.mjs +1 -0
- package/manager/utils/createGlobIgnore.mjs +45 -0
- package/manager/utils/createGlobIgnore.test.mjs +58 -0
- package/manager/utils/createGlobWatchPaths.mjs +75 -0
- package/manager/utils/createGlobWatchPaths.test.mjs +67 -0
- package/manager/utils/createIdleGc.test.mjs +31 -15
- package/{src/routes/docs/content.js → manager/utils/createLanPairing.mjs} +14 -13
- package/manager/utils/createLanPairing.test.mjs +46 -0
- package/manager/utils/createRequestActivity.mjs +30 -3
- package/manager/utils/createRequestActivity.test.mjs +76 -22
- package/manager/utils/createServerArtifactTracker.mjs +1 -0
- package/manager/utils/createServerArtifactTracker.test.mjs +1 -0
- package/manager/utils/findBuildFilesOutsideWatch.test.mjs +1 -0
- package/{client/recorder/collectEventActions.js → manager/utils/findSignInCode.mjs} +13 -10
- package/manager/utils/findSignInCode.test.mjs +33 -0
- package/manager/utils/formatLanPairing.mjs +32 -0
- package/manager/utils/formatLanPairing.test.mjs +40 -0
- package/manager/utils/getLanAddress.mjs +83 -0
- package/manager/utils/getLanAddress.test.mjs +70 -0
- package/manager/utils/importFresh.test.mjs +1 -0
- package/{src/routes/docs/icons.js → manager/utils/isLoopbackAddress.mjs} +11 -10
- package/manager/utils/pluginTypeCache.mjs +100 -0
- package/manager/utils/pluginTypeCache.test.mjs +141 -0
- package/manager/utils/pruneRecordings.test.mjs +1 -0
- package/manager/utils/publishBuildDirectory.order.test.mjs +2 -2
- package/manager/utils/publishBuildDirectory.test.mjs +6 -7
- package/manager/utils/readBasePath.test.mjs +1 -0
- package/manager/utils/readManagerVersion.test.mjs +1 -0
- package/manager/utils/readPluginDefinitions.mjs +6 -6
- package/manager/utils/renderTerminalQr.mjs +54 -0
- package/manager/utils/resolveDevAuthUrl.test.mjs +1 -0
- package/manager/utils/setupWatcher.mjs +19 -4
- package/manager/utils/startRecordingPruner.test.mjs +24 -8
- package/manager/utils/waitForChildExit.test.mjs +2 -2
- package/manager/utils/writeBuildStatus.test.mjs +1 -0
- package/manager/watchers/envWatcher.mjs +3 -0
- package/manager/watchers/envWatcher.test.mjs +19 -7
- package/manager/watchers/listServerPluginFiles.mjs +188 -0
- package/manager/watchers/listServerPluginFiles.test.mjs +257 -0
- package/manager/watchers/lowdefyBuildWatcher.mjs +5 -0
- package/manager/watchers/lowdefyBuildWatcher.test.mjs +63 -10
- package/manager/watchers/pluginSourceWatcher.mjs +45 -17
- package/manager/watchers/pluginSourceWatcher.test.mjs +97 -21
- package/manager/watchers/resolveFile.mjs +46 -0
- package/manager/watchers/resolveFile.test.mjs +67 -0
- package/manager/watchers/resolvePackageSpecifier.mjs +127 -0
- package/manager/watchers/resolvePackageSpecifier.test.mjs +151 -0
- package/manager/watchers/restartRequestWatcher.mjs +7 -4
- package/manager/watchers/restartRequestWatcher.test.mjs +43 -6
- package/manager/watchers/selectLocalPluginPackages.test.mjs +1 -0
- package/package.json +54 -53
- package/package.original.json +54 -53
- package/src/app.js +83 -85
- package/src/html/renderDevPage.test.mjs +1 -0
- package/src/lib/getPathSegments.js +16 -1
- package/src/{routes/docs/checkpointsList.js → lib/getRequestSurface.js} +6 -4
- package/src/lib/isTabAnswer.js +32 -0
- package/src/lib/isTabChannelCaller.js +35 -0
- package/src/middleware/apiContext.js +4 -2
- package/src/middleware/createSameOriginGuard.test.mjs +1 -0
- package/src/middleware/errorHandler.js +33 -45
- package/src/middleware/errorHandler.test.mjs +10 -10
- package/src/middleware/isRebindingSafeHost.test.mjs +1 -0
- package/src/middleware/localDevToolsOnly.js +13 -1
- package/src/middleware/localDevToolsOnly.test.mjs +36 -2
- package/src/middleware/noStore.test.mjs +1 -0
- package/src/middleware/requestTimeout.js +7 -1
- package/src/middleware/staleFlag.test.mjs +1 -0
- package/src/middleware/stampCaller.test.mjs +1 -0
- package/src/routes/agentBearer.test.mjs +183 -0
- package/src/routes/auth.test.mjs +10 -10
- package/src/routes/clientError.js +21 -4
- package/src/routes/clientError.test.mjs +127 -0
- package/src/routes/devInspect.js +6 -51
- package/src/routes/devInspect.test.mjs +128 -3
- package/src/routes/devRecording.js +6 -17
- package/src/routes/devRecording.test.mjs +54 -3
- package/src/routes/docs/buildStatus.test.mjs +6 -6
- package/src/routes/docs/events.test.mjs +4 -4
- package/src/routes/docs/find.js +3 -3
- package/src/routes/docs/journey.test.mjs +8 -8
- package/src/routes/docs/journeyRefusals.test.mjs +9 -9
- package/src/routes/docs/loadDocsRoutes.js +70 -0
- package/src/routes/docs/loadDocsRoutes.test.mjs +110 -0
- package/src/routes/docs/mcp.test.mjs +5 -5
- package/src/routes/docs/mutants.js +7 -0
- package/src/routes/docs/mutants.test.mjs +20 -6
- package/src/routes/docs/parsePathParamsParam.test.mjs +1 -0
- package/src/routes/docs/parseUserParam.test.mjs +1 -0
- package/src/routes/docs/restart.test.mjs +1 -0
- package/src/routes/endpoints.js +24 -0
- package/src/routes/endpointsLink.test.mjs +111 -0
- package/src/routes/endpointsTextAnswer.test.mjs +8 -8
- package/src/routes/jitPage.js +13 -1
- package/src/routes/jitPage.test.mjs +36 -11
- package/src/routes/mcp.js +6 -0
- package/src/routes/mcp.test.mjs +23 -8
- package/src/routes/mcpMemberToken.test.mjs +8 -8
- package/src/routes/mcpProtectedResourceMetadata.test.mjs +2 -2
- package/src/routes/{docs/checkpointsRevert.js → mobileRoot.js} +10 -13
- package/src/routes/mobileRoutes.test.mjs +223 -0
- package/src/routes/mobileSignIn.js +58 -0
- package/src/routes/mobileSignIn.test.mjs +59 -0
- package/src/routes/mobileSignInCallback.js +34 -0
- package/src/routes/mobileSignInCallback.test.mjs +51 -0
- package/src/routes/mountDevPageRoutes.js +10 -2
- package/src/routes/mountDevPageRoutes.test.mjs +25 -1
- package/src/routes/mountMobileWellKnown.js +35 -0
- package/src/routes/mountMobileWellKnown.test.mjs +79 -0
- package/src/routes/mountOauthDiscovery.test.mjs +5 -5
- package/src/routes/normalizeMcpProtocolVersionHeader.test.mjs +1 -0
- package/src/routes/reload.js +101 -20
- package/src/routes/reload.test.mjs +153 -0
- package/src/routes/request.js +1 -22
- package/src/routes/request.test.mjs +7 -24
- package/src/routes/requestBody.test.mjs +14 -27
- package/src/routes/websocket.test.mjs +2 -2
- package/src/routes/wellKnownFallback.test.mjs +2 -2
- package/src/websocket/devWebSocket.test.mjs +12 -12
- package/vite.config.js +15 -1
- package/client/feedback/FeedbackMount.jsx +0 -83
- package/client/feedback/FeedbackOverlay.jsx +0 -904
- package/client/feedback/captureTabScreenshot.js +0 -84
- package/client/feedback/copyToClipboard.js +0 -45
- package/client/feedback/drawAnnotationsSvg.js +0 -119
- package/client/feedback/feedbackStyles.js +0 -304
- package/client/feedback/pinResponsiveImages.js +0 -59
- package/client/feedback/sendFeedback.js +0 -39
- package/client/feedback/useFeedbackToggle.js +0 -70
- package/client/recorder/buildEngineRecord.js +0 -37
- package/client/recorder/buildInteractionRecord.js +0 -64
- package/client/recorder/buildTraceEvent.js +0 -57
- package/client/recorder/buildTraceEvent.test.mjs +0 -81
- package/client/recorder/chunkRecords.js +0 -69
- package/client/recorder/chunkRecords.test.mjs +0 -59
- package/client/recorder/collectEventEndpoints.js +0 -40
- package/client/recorder/collectEventRequests.js +0 -39
- package/client/recorder/createPairingBuffer.js +0 -187
- package/client/recorder/createPasswordRedactor.js +0 -84
- package/client/recorder/createRecordBatcher.js +0 -54
- package/client/recorder/createRecordBatcher.test.mjs +0 -76
- package/client/recorder/createRecordingSession.js +0 -61
- package/client/recorder/createRecordingSession.test.mjs +0 -72
- package/client/recorder/diffStateWrites.js +0 -77
- package/client/recorder/diffStateWrites.test.mjs +0 -66
- package/client/recorder/isEventCall.js +0 -30
- package/client/recorder/jsonType.js +0 -39
- package/client/recorder/sendRecords.js +0 -40
- package/lib/docs/captureAnnotatedScreenshot.js +0 -99
- package/lib/docs/checkpointPaths.js +0 -91
- package/lib/docs/checkpointStore.js +0 -243
- package/lib/docs/checkpointToMocks.js +0 -65
- package/lib/docs/configCheckpoints.test.mjs +0 -156
- package/lib/docs/createConfigCheckpoint.js +0 -92
- package/lib/docs/devMockRegistry.js +0 -68
- package/lib/docs/enrichFeedback.js +0 -71
- package/lib/docs/evalOperator.js +0 -49
- package/lib/docs/evalOperator.test.mjs +0 -157
- package/lib/docs/evalOperatorHeadless.js +0 -159
- package/lib/docs/evalOperatorHeadless.test.mjs +0 -78
- package/lib/docs/evalOperatorInTab.js +0 -49
- package/lib/docs/formatFeedback.js +0 -142
- package/lib/docs/formatFeedback.test.mjs +0 -252
- package/lib/docs/getPluginDoc.js +0 -53
- package/lib/docs/listConfigCheckpoints.js +0 -55
- package/lib/docs/loadState.js +0 -220
- package/lib/docs/revertConfigCheckpoint.js +0 -73
- package/lib/docs/saveAnnotatedScreenshot.js +0 -43
- package/lib/docs/scaffoldPage.js +0 -77
- package/lib/docs/scaffoldPage.test.mjs +0 -97
- package/lib/docs/snapshotState.js +0 -67
- package/lib/docs/stateCheckpoints.test.mjs +0 -443
- package/manager/watchers/listServerSidePackages.mjs +0 -47
- package/manager/watchers/listServerSidePackages.test.mjs +0 -38
- package/src/routes/docs/checkpointsCreate.js +0 -28
- package/src/routes/docs/evalOperator.js +0 -70
- package/src/routes/docs/inspectState.js +0 -59
- package/src/routes/docs/loadState.js +0 -51
- package/src/routes/docs/pluginDoc.js +0 -33
- package/src/routes/docs/plugins.js +0 -23
- package/src/routes/docs/runEndpoint.js +0 -54
- package/src/routes/docs/runEndpoint.test.mjs +0 -165
- package/src/routes/docs/runRequest.js +0 -53
- package/src/routes/docs/runRequest.test.mjs +0 -92
- package/src/routes/docs/schema.js +0 -37
- package/src/routes/docs/screenshot.js +0 -120
- package/src/routes/docs/screenshot.test.mjs +0 -117
- package/src/routes/docs/search.js +0 -40
- package/src/routes/docs/snapshotState.js +0 -50
- package/src/routes/docs/stateCheckpointsList.js +0 -26
- package/src/routes/docs/types.js +0 -33
- package/src/routes/feedback.js +0 -107
- package/src/routes/feedback.test.mjs +0 -204
|
@@ -26,61 +26,63 @@ import { MAX_VIEWPORT_SIZE } from './validateViewport.js';
|
|
|
26
26
|
// start, before any dev server exists, and forwards calls to the right one.
|
|
27
27
|
// This module must stay free of imports that touch build artifacts.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// The server instructions every session pays for. They hold only what applies
|
|
30
|
+
// across tools - the edit loop, the stale warning and how to act as someone -
|
|
31
|
+
// and leave each tool's detail to its description and get_doc.
|
|
32
|
+
const INSTRUCTIONS = `Lowdefy dev server for this project: docs for every installed type, and the feedback loop for config edits. Lowdefy apps are YAML config composing blocks (UI), operators (logic), actions (event handlers), and connections/requests (data).
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
Never guess a type name: lowdefy_list_types lists every installed type, lowdefy_get_schema gives its exact contract, and lowdefy_get_examples, lowdefy_get_doc and lowdefy_search_docs the docs, the app's own plugin and module docs included. lowdefy_app_map maps an existing app.
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
After EVERY config edit, call lowdefy_build_status with wait: true. It answers once the edit is processed and the pages it touched are built, with the build status, located errors and recent browser and server errors. Fix what it reports, then check the page with lowdefy_get_page_config and lowdefy_screenshot_page, and verify its behaviour with lowdefy_run_journey. Call lowdefy_check before saying a change is done.
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
If a tool result begins with "STALE:", the last build FAILED and the answer comes from the previous successful build, not from your latest edits: call lowdefy_build_status and fix the reported errors before trusting anything else.
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
Build results, restarts and browser and server errors also arrive as notifications/message from logger "lowdefy". lowdefy_build_status stays the full picture, and the only one that reports pages that fail to build.
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
Acting as someone: the headless renderer signs in as a roleless user, so a role-gated page or request renders empty or refused. Every tool that takes user takes it in the same forms: a user object such as {"roles":["admin"]}, merged over the default user (add the email or profile fields the page reads, since no auth engine derives them); "none" to act signed out, so the app's own auth decides; or the name of a user in the data set that data names (tests/data/<name>.yaml), which also runs the call on that data set's own in-memory database. user and data are headless only, so combining them with source "tab" is an error. A request run without user runs as a roleless anonymous caller, so a tenant-walled request returns empty rather than an error.
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Safety: lowdefy_checkpoint snapshots the config files before risky multi-file changes; lowdefy_revert_checkpoint restores them.
|
|
44
|
-
|
|
45
|
-
Visual feedback: developers can press Cmd/Ctrl+/ in the running app to point at elements, draw, and copy annotated feedback to their clipboard, then paste it to you. Pasted annotation blocks start with "Feedback:" and carry the blockId, the resolved config file:line, drawn shapes, and usually an "Annotated screenshot:" file path — READ that image to see exactly what the developer drew. Treat them as precise UI feedback and use lowdefy_inspect_state for the page's live state.
|
|
46
|
-
|
|
47
|
-
State checkpoints (testing): lowdefy_snapshot_state captures a page's live state AND its request/api responses into .lowdefy/state-checkpoints/<name>/ (one file per part; gitignored — checkpoints contain user/session data). lowdefy_load_state puts the app back into that state: headless for your own verification, or registry-only which returns a ?_checkpoint URL the developer can open to manually test the app in that exact state (recorded request data is served automatically). lowdefy_checkpoint_to_mocks converts a checkpoint into e2e mocks.yaml fixtures — use it when asked to write e2e tests.`;
|
|
44
|
+
Phones: mobile pages run in Lowdefy Dev on a phone, simulator or emulator, which joins this server as a tab. lowdefy_device lists them (action "list"), starts one ("start") and fakes a device result ("inject"); pass its tab id as device to lowdefy_screenshot_page, lowdefy_run_journey or lowdefy_inspect_state to act on the phone.`;
|
|
48
45
|
|
|
49
46
|
const HAZARDS_NOTE =
|
|
50
47
|
' Results include `hazards`: behaviours of this type that its schema does not show. Read them before writing config.';
|
|
51
48
|
|
|
52
|
-
//
|
|
53
|
-
//
|
|
49
|
+
// The forms of user and data are written once, in INSTRUCTIONS; each tool that
|
|
50
|
+
// takes them points there.
|
|
54
51
|
const CALLER_NOTE =
|
|
55
|
-
' Pass user to act as someone
|
|
52
|
+
' Pass user (and data) to act as someone, in the forms the server instructions give.';
|
|
56
53
|
|
|
57
|
-
// Shared by every tool that acts as someone
|
|
58
|
-
// one call can act as an admin and the next as a
|
|
59
|
-
// call gets its own browser context, so they never share an identity.
|
|
54
|
+
// Shared by every tool that acts as someone. Each headless call gets its own
|
|
55
|
+
// browser context, so one call can act as an admin and the next as a member.
|
|
60
56
|
const userSchema = z
|
|
61
57
|
.union([z.literal('none'), z.string().min(1), z.object({}).passthrough()])
|
|
62
58
|
.optional()
|
|
63
59
|
.describe(
|
|
64
|
-
'Who the call acts as
|
|
60
|
+
'Who the call acts as: a user object, "none", or the name of a data set user. Omitted: the default roleless user.'
|
|
65
61
|
);
|
|
66
62
|
|
|
67
63
|
// Shared by every tool that takes userSchema.
|
|
68
64
|
const dataSchema = z
|
|
69
65
|
.string()
|
|
70
66
|
.optional()
|
|
71
|
-
.describe(
|
|
72
|
-
'The name of a data set in tests/data/<name>.yaml. The call then runs against a fresh in-memory database of its own, loaded with the data set, as a journey with data does, and user can name one of its users. Headless only, like user.'
|
|
73
|
-
);
|
|
67
|
+
.describe('A data set in tests/data/<name>.yaml, run on its own in-memory database.');
|
|
74
68
|
|
|
75
69
|
// Shared by every tool that names a page instance: a page whose `path` has
|
|
76
70
|
// placeholders has one instance per set of values.
|
|
77
71
|
const pathParamsSchema = z
|
|
78
|
-
.record(z.union([z.string(), z.number()]))
|
|
72
|
+
.record(z.string(), z.union([z.string(), z.number()]))
|
|
79
73
|
.optional()
|
|
80
74
|
.describe(
|
|
81
75
|
'Values for the placeholders of a page whose path has them, read by _path_params, e.g. {"space": "support", "ticket_id": "1234"} for path "tickets/{space}/{ticket_id}" (lowdefy_app_map shows each page\'s path). Required to open such a page headless; a missing placeholder is an error naming it.'
|
|
82
76
|
);
|
|
83
77
|
|
|
78
|
+
// Shared by every tool that can act on a phone instead of the headless browser.
|
|
79
|
+
const deviceSchema = z
|
|
80
|
+
.string()
|
|
81
|
+
.optional()
|
|
82
|
+
.describe(
|
|
83
|
+
'A phone in Lowdefy Dev, by its tab id from lowdefy_device list. It is used as it is: the page it shows, its own user and the real database.'
|
|
84
|
+
);
|
|
85
|
+
|
|
84
86
|
// Shared by the request and endpoint runners.
|
|
85
87
|
const saveResponseSchema = z
|
|
86
88
|
.boolean()
|
|
@@ -92,35 +94,28 @@ const saveResponseSchema = z
|
|
|
92
94
|
const devToolDefinitions = {
|
|
93
95
|
lowdefy_inspect_state: {
|
|
94
96
|
description:
|
|
95
|
-
"Read the LIVE state of a running page: state, request results, event log (recent actions fired), global, user, input, and urlQuery. If the developer has the page open in a browser it reads their actual tab (ask them to interact first, then inspect); otherwise it runs the page headless. Use this to see what the app's data model really looks like." +
|
|
97
|
+
"Read the LIVE state of a running page: state, request results, event log (recent actions fired), global, user, input, and urlQuery. If the developer has the page open in a browser it reads their actual tab (ask them to interact first, then inspect); otherwise it runs the page headless. Use this to see what the app's data model really looks like. Pass expression to evaluate an operator expression against that live state instead, a REPL for config: the result is { value, errors, source, reads } with no snapshot, reads naming the state, request and other paths it read." +
|
|
96
98
|
CALLER_NOTE,
|
|
97
99
|
inputSchema: {
|
|
98
100
|
pageId: z.string().describe('The page id to inspect.'),
|
|
99
101
|
pathParams: pathParamsSchema.describe(
|
|
100
102
|
'The page instance to inspect, for a page whose path has placeholders, e.g. {"ticket_id": "1"}. Without it a live tab is read at the instance it shows (or that page\'s most recently shown one); headless needs it to open the page.'
|
|
101
103
|
),
|
|
104
|
+
expression: z
|
|
105
|
+
.any()
|
|
106
|
+
.optional()
|
|
107
|
+
.describe(
|
|
108
|
+
'An operator expression to evaluate in the real browser runtime instead of returning the snapshot — any JSON value, e.g. {"_state": "customer.name"} or {"_if": {...}}. null is evaluated too.'
|
|
109
|
+
),
|
|
102
110
|
source: z
|
|
103
111
|
.enum(['tab', 'headless'])
|
|
104
112
|
.optional()
|
|
105
|
-
.describe(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
lowdefy_eval_operator: {
|
|
112
|
-
description:
|
|
113
|
-
'Evaluate a Lowdefy operator expression against the live state of a running page — a REPL for config. Pass the operator object in the "expression" argument — any JSON value, e.g. {"_state": "customer.name"} or {"_if": {...}}. Evaluates in the real browser runtime (live tab if connected, else headless).' +
|
|
114
|
-
CALLER_NOTE,
|
|
115
|
-
inputSchema: {
|
|
116
|
-
pageId: z.string().describe('The page id whose context to evaluate against.'),
|
|
117
|
-
pathParams: pathParamsSchema.describe(
|
|
118
|
-
"The page instance to evaluate against, for a page whose path has placeholders. Without it a live tab is read at the instance it shows (or that page's most recently shown one); headless needs it to open the page."
|
|
113
|
+
.describe(
|
|
114
|
+
"Force a source. Default: live tab if connected, else headless. With device, the phone's tab."
|
|
115
|
+
),
|
|
116
|
+
device: deviceSchema.describe(
|
|
117
|
+
'A phone to read instead, by tab id. Never falls back to headless.'
|
|
119
118
|
),
|
|
120
|
-
expression: z
|
|
121
|
-
.any()
|
|
122
|
-
.describe('The operator expression — any JSON value, e.g. {"_state": "key"}.'),
|
|
123
|
-
source: z.enum(['tab', 'headless']).optional(),
|
|
124
119
|
user: userSchema,
|
|
125
120
|
data: dataSchema,
|
|
126
121
|
},
|
|
@@ -133,7 +128,10 @@ const devToolDefinitions = {
|
|
|
133
128
|
inputSchema: {
|
|
134
129
|
pageId: z.string().describe('The page the request is defined on.'),
|
|
135
130
|
requestId: z.string().describe('The request id.'),
|
|
136
|
-
payload: z
|
|
131
|
+
payload: z
|
|
132
|
+
.record(z.string(), z.any())
|
|
133
|
+
.optional()
|
|
134
|
+
.describe('Test payload for _payload operators.'),
|
|
137
135
|
user: userSchema,
|
|
138
136
|
data: dataSchema,
|
|
139
137
|
saveResponse: saveResponseSchema,
|
|
@@ -142,11 +140,14 @@ const devToolDefinitions = {
|
|
|
142
140
|
|
|
143
141
|
lowdefy_run_endpoint: {
|
|
144
142
|
description:
|
|
145
|
-
'Execute an Api endpoint routine in dev with a test payload and caller, to verify what it returns, rejects or throws.
|
|
143
|
+
'Execute an Api endpoint routine in dev with a test payload and caller, to verify what it returns, rejects or throws. Needs cli.agentTools.allowWriteRequests, since routines are not classified read-only. A :reject or :throw comes back as data (success: false, status "reject" or "error" with the routine\'s own error). Pass system: true to run it as a cron or detached run does: no user, auth not checked, InternalApi allowed. Nested CallApi steps with detached: true still dispatch over HTTP and need CRON_SECRET on the dev server.' +
|
|
146
144
|
CALLER_NOTE,
|
|
147
145
|
inputSchema: {
|
|
148
146
|
endpointId: z.string().describe('The Api endpoint id.'),
|
|
149
|
-
payload: z
|
|
147
|
+
payload: z
|
|
148
|
+
.record(z.string(), z.any())
|
|
149
|
+
.optional()
|
|
150
|
+
.describe('Test payload for _payload operators.'),
|
|
150
151
|
user: userSchema,
|
|
151
152
|
data: dataSchema,
|
|
152
153
|
system: z
|
|
@@ -173,65 +174,9 @@ const devToolDefinitions = {
|
|
|
173
174
|
inputSchema: {},
|
|
174
175
|
},
|
|
175
176
|
|
|
176
|
-
lowdefy_snapshot_state: {
|
|
177
|
-
description:
|
|
178
|
-
"Capture the live state AND recorded request/api responses of a running page into a checkpoint folder (.lowdefy/state-checkpoints/<name>/, one file per part; gitignored — checkpoints contain user/session data). Snapshot the developer's open tab after they reproduce a scenario, or a headless run. Use for building test fixtures and reproducible app states.",
|
|
179
|
-
inputSchema: {
|
|
180
|
-
pageId: z.string().describe('The page to snapshot.'),
|
|
181
|
-
pathParams: pathParamsSchema.describe(
|
|
182
|
-
"The page instance to snapshot, for a page whose path has placeholders. The checkpoint keeps the instance's pathParams, and lowdefy_load_state opens that instance."
|
|
183
|
-
),
|
|
184
|
-
name: z.string().describe('Checkpoint name (letters, numbers, - and _).'),
|
|
185
|
-
notes: z.string().optional().describe('What this checkpoint captures.'),
|
|
186
|
-
source: z.enum(['tab', 'headless']).optional(),
|
|
187
|
-
overwrite: z.boolean().optional(),
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
lowdefy_load_state: {
|
|
192
|
-
description:
|
|
193
|
-
"Put the app back into a saved state checkpoint. mode 'headless' (default) verifies the restored state itself; mode 'registry-only' loads the recorded request data into the dev server and returns a ?_checkpoint URL the developer can open to manually test the app in that exact state." +
|
|
194
|
-
CALLER_NOTE,
|
|
195
|
-
inputSchema: {
|
|
196
|
-
name: z.string().describe('The checkpoint name.'),
|
|
197
|
-
mode: z.enum(['headless', 'registry-only']).optional(),
|
|
198
|
-
user: userSchema,
|
|
199
|
-
data: dataSchema,
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
lowdefy_list_state_checkpoints: {
|
|
204
|
-
description: 'List saved state checkpoints (name, page, captured time, notes).',
|
|
205
|
-
inputSchema: {},
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
lowdefy_checkpoint_to_mocks: {
|
|
209
|
-
description:
|
|
210
|
-
'Convert a state checkpoint into @lowdefy/e2e-utils mocks.yaml fixtures (requests/api entries plus rendered yaml). Use when writing e2e tests from a captured scenario.',
|
|
211
|
-
inputSchema: {
|
|
212
|
-
name: z.string().describe('The checkpoint name.'),
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
lowdefy_checkpoint: {
|
|
217
|
-
description:
|
|
218
|
-
'Snapshot all config files before risky changes. Returns a checkpoint id for lowdefy_revert_checkpoint. Use before multi-file edits so you can restore instantly.',
|
|
219
|
-
inputSchema: {
|
|
220
|
-
label: z.string().describe('Short label for the checkpoint, e.g. "before-refactor".'),
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
lowdefy_revert_checkpoint: {
|
|
225
|
-
description:
|
|
226
|
-
'Restore config files from a checkpoint made with lowdefy_checkpoint (restores changed files and removes files added since). Omit id to list available checkpoints.',
|
|
227
|
-
inputSchema: {
|
|
228
|
-
id: z.string().optional().describe('Checkpoint id. Omit to list checkpoints.'),
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
|
|
232
177
|
lowdefy_build_status: {
|
|
233
178
|
description:
|
|
234
|
-
'Call after every config edit
|
|
179
|
+
'Call after every config edit, with wait: true. build.status is ok when the config builds and no page failed its latest build, pages_failed (build.failedPages names them) when a page failed and has not changed since, and error when the config build fails. Then the located errors and warnings of the config build and of each failed page, pages changed since they were built, and recent browser, phone (surface "mobile") and server errors. Errors from before your latest edit come apart under earlierErrors.',
|
|
235
180
|
inputSchema: {
|
|
236
181
|
wait: z
|
|
237
182
|
.boolean()
|
|
@@ -250,9 +195,10 @@ const devToolDefinitions = {
|
|
|
250
195
|
|
|
251
196
|
lowdefy_get_page_config: {
|
|
252
197
|
description:
|
|
253
|
-
|
|
198
|
+
"Get the fully built config for a page as { page }, or its structured build errors if the page fails to build. Use to verify a page after editing it. Pass blockId for one block's subtree as { block }. A result over 40,000 characters is written in full to a file under .lowdefy/responses/, and its path comes back instead.",
|
|
254
199
|
inputSchema: {
|
|
255
200
|
pageId: z.string().describe('The page id.'),
|
|
201
|
+
blockId: z.string().optional().describe('Return only this block and the blocks inside it.'),
|
|
256
202
|
},
|
|
257
203
|
},
|
|
258
204
|
|
|
@@ -273,22 +219,26 @@ const devToolDefinitions = {
|
|
|
273
219
|
|
|
274
220
|
lowdefy_screenshot_page: {
|
|
275
221
|
description:
|
|
276
|
-
'Screenshot a page of the running dev server (headless Chromium) to
|
|
222
|
+
'Screenshot a page of the running dev server (headless Chromium) to verify layout and rendering. Returns a PNG. Set width (e.g. 390 for a phone) and colorScheme "dark" to check those layouts. Pass steps to capture a state beyond the loaded page, such as an open dropdown or a modal; portal popups are included. Pass urlQuery for a page that reads _url_query, and pathParams for a page whose path has placeholders.' +
|
|
277
223
|
CALLER_NOTE,
|
|
278
224
|
inputSchema: {
|
|
279
|
-
pageId: z
|
|
225
|
+
pageId: z
|
|
226
|
+
.string()
|
|
227
|
+
.describe(
|
|
228
|
+
'The page id to screenshot. With device, the page the phone must show; a phone is not navigated.'
|
|
229
|
+
),
|
|
280
230
|
pathParams: pathParamsSchema,
|
|
281
231
|
urlQuery: z
|
|
282
|
-
.record(z.any())
|
|
232
|
+
.record(z.string(), z.any())
|
|
283
233
|
.optional()
|
|
284
234
|
.describe(
|
|
285
235
|
'Query params to open the page with, read by _url_query, e.g. {"framework": "popia"}.'
|
|
286
236
|
),
|
|
287
237
|
steps: z
|
|
288
|
-
.array(z.record(z.any()))
|
|
238
|
+
.array(z.record(z.string(), z.any()))
|
|
289
239
|
.optional()
|
|
290
240
|
.describe(
|
|
291
|
-
'
|
|
241
|
+
'Steps run in order after the page settles and before the capture, the same steps as lowdefy_run_journey (lowdefy_get_schema kind "journey-step" gives the grammar), e.g. [{"open": "status"}] to capture an open dropdown or [{"click": "add"}] for a modal. A {"screenshot": name} step captures an earlier state too. If a step fails the screenshot still returns, showing where it stopped.'
|
|
292
242
|
),
|
|
293
243
|
fullPage: z.boolean().optional().describe('Capture the full scrollable page.'),
|
|
294
244
|
clip: z
|
|
@@ -299,9 +249,7 @@ const devToolDefinitions = {
|
|
|
299
249
|
height: z.number(),
|
|
300
250
|
})
|
|
301
251
|
.optional()
|
|
302
|
-
.describe(
|
|
303
|
-
"Crop to a viewport-relative region — pass an annotation's geometry from feedback."
|
|
304
|
-
),
|
|
252
|
+
.describe('Crop to a viewport-relative region.'),
|
|
305
253
|
scrollX: z.number().optional().describe('Scroll offset the clip was recorded at.'),
|
|
306
254
|
scrollY: z.number().optional().describe('Scroll offset the clip was recorded at.'),
|
|
307
255
|
width: z
|
|
@@ -328,6 +276,7 @@ const devToolDefinitions = {
|
|
|
328
276
|
.describe(
|
|
329
277
|
'The colour scheme the page\'s prefers-color-scheme reports. Default "light". An app that follows the system theme renders dark with "dark"; a darkMode fixed in the app config wins.'
|
|
330
278
|
),
|
|
279
|
+
device: deviceSchema.describe('A phone to capture instead, by tab id.'),
|
|
331
280
|
user: userSchema,
|
|
332
281
|
data: dataSchema,
|
|
333
282
|
},
|
|
@@ -335,15 +284,16 @@ const devToolDefinitions = {
|
|
|
335
284
|
|
|
336
285
|
lowdefy_run_journey: {
|
|
337
286
|
description:
|
|
338
|
-
'Drive a page of the running dev server headless through declarative steps and assert what happens
|
|
287
|
+
'Drive a page of the running dev server headless through declarative steps and assert what happens - the way to verify behaviour (a form submits, a modal opens, a filter works), not just layout. A step that fails stops the journey and comes back as data (passed: false, failure with index, step, expected, actual and message, later steps skipped), never as a tool error. A journey also fails at the step that raises an app error (an action error that is not a user error, an uncaught page error, a server error or 5xx): failure.kind "app-error" with errors [{kind, message, source, configKey}]. failure.kind "dev-server" means the dev server lost its web server and the request got no answer, so the result says nothing about the app: check the dev server log and run it again. A failed Validate, a Throw action and 401/403 refusals never count; {"expect": {"error": text}} straight after an interaction claims an intended error. Returns the final page state (see state) and any screenshots, as images after the JSON.' +
|
|
339
288
|
CALLER_NOTE,
|
|
340
289
|
inputSchema: {
|
|
341
290
|
pageId: z.string().describe('The page id to open.'),
|
|
342
291
|
steps: z
|
|
343
|
-
.array(z.record(z.any()))
|
|
292
|
+
.array(z.record(z.string(), z.any()))
|
|
344
293
|
.describe(
|
|
345
|
-
'Ordered steps, one key each:
|
|
294
|
+
'Ordered steps, one key each: click, open, fill, select, press, back, goto, email, as, wait, screenshot, expect. lowdefy_get_schema with kind "journey-step" returns the grammar of every step with examples, or of one with type, e.g. "expect". A target is a blockId or {"blockId", "row", "column", "text", "containing", "nth"}; "text" alone reaches dialog, menu and email buttons. Every id a step names is checked against the build before it runs. On a phone (device) only click, fill, select, press, wait, screenshot and expect state run.'
|
|
346
295
|
),
|
|
296
|
+
device: deviceSchema.describe('A phone to run on instead, by tab id.'),
|
|
347
297
|
user: z
|
|
348
298
|
.union([
|
|
349
299
|
z.literal('none'),
|
|
@@ -353,22 +303,22 @@ const devToolDefinitions = {
|
|
|
353
303
|
])
|
|
354
304
|
.optional()
|
|
355
305
|
.describe(
|
|
356
|
-
'Who the journey acts as
|
|
306
|
+
'Who the journey acts as, in the forms the server instructions give ("none" starts signed out, so sign-up and sign-in run for real), or a list of data set user names (needs data): the journey runs once as each and returns {passed, runs}.'
|
|
357
307
|
),
|
|
358
308
|
data: z
|
|
359
309
|
.string()
|
|
360
310
|
.optional()
|
|
361
311
|
.describe(
|
|
362
|
-
'
|
|
312
|
+
'A data set in tests/data/<name>.yaml: the journey runs on a fresh in-memory MongoDB database loaded with it, so it may write freely, and user and "as" can name its users. Format: lowdefy_get_doc testing/journey-data-sets.'
|
|
363
313
|
),
|
|
364
314
|
pathParams: z
|
|
365
|
-
.record(z.string())
|
|
315
|
+
.record(z.string(), z.string())
|
|
366
316
|
.optional()
|
|
367
317
|
.describe(
|
|
368
318
|
'Values for the placeholders of the page\'s path, read by _path_params, e.g. {"space": "support", "ticket_id": "1"} for path "{space}/tickets/{ticket_id}".'
|
|
369
319
|
),
|
|
370
320
|
urlQuery: z
|
|
371
|
-
.record(z.any())
|
|
321
|
+
.record(z.string(), z.any())
|
|
372
322
|
.optional()
|
|
373
323
|
.describe('Query params to open the page with, read by _url_query, e.g. {"id": "1"}.'),
|
|
374
324
|
timeout: z
|
|
@@ -395,21 +345,6 @@ const devToolDefinitions = {
|
|
|
395
345
|
},
|
|
396
346
|
},
|
|
397
347
|
|
|
398
|
-
lowdefy_scaffold_page: {
|
|
399
|
-
description:
|
|
400
|
-
'Create a new page yaml file with a canonical minimal structure. Refuses if the page already exists. Returns the created file path and the lowdefy.yaml registration step you must do next.',
|
|
401
|
-
inputSchema: {
|
|
402
|
-
pageId: z.string().describe('The new page id (letters, numbers, - and _).'),
|
|
403
|
-
title: z.string().optional().describe('Page title. Defaults to the pageId.'),
|
|
404
|
-
},
|
|
405
|
-
},
|
|
406
|
-
|
|
407
|
-
lowdefy_overview: {
|
|
408
|
-
description:
|
|
409
|
-
'Start here. Overview of everything this Lowdefy project has available: counts of blocks/operators/actions/connections/requests, installed plugins, doc sections, and which tool to use next.',
|
|
410
|
-
inputSchema: {},
|
|
411
|
-
},
|
|
412
|
-
|
|
413
348
|
lowdefy_list_types: {
|
|
414
349
|
description:
|
|
415
350
|
'List ALL available types of a kind — every block, operator, action, connection, or request type installed in this project (core and local plugins), whether used yet or not. Call this before writing any config to get exact type names.',
|
|
@@ -426,15 +361,15 @@ const devToolDefinitions = {
|
|
|
426
361
|
'websockets',
|
|
427
362
|
])
|
|
428
363
|
.describe('The kind of types to list.'),
|
|
364
|
+
target: z
|
|
365
|
+
.enum(['web', 'mobile'])
|
|
366
|
+
.optional()
|
|
367
|
+
.describe(
|
|
368
|
+
'Default "web". "mobile": the blocks, actions and client operators a native shell carries, for mobile pages.'
|
|
369
|
+
),
|
|
429
370
|
},
|
|
430
371
|
},
|
|
431
372
|
|
|
432
|
-
lowdefy_list_plugins: {
|
|
433
|
-
description:
|
|
434
|
-
"List installed plugin packages (including this project's local custom plugins) and the type names each provides.",
|
|
435
|
-
inputSchema: {},
|
|
436
|
-
},
|
|
437
|
-
|
|
438
373
|
lowdefy_get_schema: {
|
|
439
374
|
description:
|
|
440
375
|
'Get the JSON Schema for a specific type: all properties, events, and their descriptions. Use the exact type name from lowdefy_list_types.' +
|
|
@@ -502,11 +437,34 @@ const devToolDefinitions = {
|
|
|
502
437
|
},
|
|
503
438
|
},
|
|
504
439
|
|
|
505
|
-
|
|
440
|
+
lowdefy_device: {
|
|
506
441
|
description:
|
|
507
|
-
'
|
|
442
|
+
'Phones in Lowdefy Dev. "list": connected phones (their tab ids are the device other tools take) and booted simulators. "start" with platform: open Lowdefy Dev on a simulator or emulator. "inject" with device: fake the phone\'s next device result. lowdefy_get_doc "ai-agent-docs" has the shapes.',
|
|
508
443
|
inputSchema: {
|
|
509
|
-
|
|
444
|
+
action: z.enum(['list', 'start', 'inject']).describe('What to do.'),
|
|
445
|
+
platform: z.enum(['ios', 'android']).optional().describe('For start.'),
|
|
446
|
+
device: deviceSchema.describe('For inject: the phone.'),
|
|
447
|
+
inject: z
|
|
448
|
+
.object({
|
|
449
|
+
kind: z
|
|
450
|
+
.enum([
|
|
451
|
+
'scan',
|
|
452
|
+
'photo',
|
|
453
|
+
'nfc',
|
|
454
|
+
'transcript',
|
|
455
|
+
'location',
|
|
456
|
+
'permission',
|
|
457
|
+
'network',
|
|
458
|
+
'push',
|
|
459
|
+
'share',
|
|
460
|
+
'clear',
|
|
461
|
+
])
|
|
462
|
+
.describe('What to fake.'),
|
|
463
|
+
value: z.any().optional().describe('The faked result, shaped per kind (see the docs).'),
|
|
464
|
+
name: z.string().optional().describe('For permission: e.g. "camera".'),
|
|
465
|
+
})
|
|
466
|
+
.optional()
|
|
467
|
+
.describe('For inject: the device result to fake.'),
|
|
510
468
|
},
|
|
511
469
|
},
|
|
512
470
|
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { type } from '@lowdefy/helpers';
|
|
18
|
+
|
|
19
|
+
// The privacy services `xcrun simctl privacy` grants and revokes. A permission
|
|
20
|
+
// the simulator has no service for (a camera: simulators have none) is left to
|
|
21
|
+
// Lowdefy Dev's own answer.
|
|
22
|
+
const SIMCTL_PRIVACY_SERVICES = [
|
|
23
|
+
'calendar',
|
|
24
|
+
'contacts',
|
|
25
|
+
'location',
|
|
26
|
+
'location-always',
|
|
27
|
+
'media-library',
|
|
28
|
+
'microphone',
|
|
29
|
+
'motion',
|
|
30
|
+
'photos',
|
|
31
|
+
'photos-add',
|
|
32
|
+
'reminders',
|
|
33
|
+
'siri',
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
function formatCoordinate({ latitude, longitude }) {
|
|
37
|
+
return `${latitude},${longitude}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function simulatorLocationArgs({ udid, value }) {
|
|
41
|
+
const route = type.isArray(value) ? value : [value];
|
|
42
|
+
if (route.length === 1) {
|
|
43
|
+
return ['simctl', 'location', udid, 'set', formatCoordinate(route[0])];
|
|
44
|
+
}
|
|
45
|
+
// `start` moves the simulator along the waypoints at walking pace (its default speed).
|
|
46
|
+
return ['simctl', 'location', udid, 'start', ...route.map(formatCoordinate)];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The command line of one simulator or emulator operation, as `{ command, args, encoding? }` for
|
|
51
|
+
* runDeviceTool. Built apart from running it, so each is checked without a simulator.
|
|
52
|
+
*
|
|
53
|
+
* - `list-simulators`: the booted iOS simulators, as JSON.
|
|
54
|
+
* - `list-android`: the Android devices adb sees, emulators and USB phones (`adb devices -l`).
|
|
55
|
+
* - `simulator-screenshot`: a PNG of the simulator's screen written to `file`.
|
|
56
|
+
* - `android-screenshot`: a PNG of the device's screen on stdout (a Buffer).
|
|
57
|
+
* - `simulator-location`: `value` is `{ latitude, longitude }` (set) or a list of them (a route).
|
|
58
|
+
* - `simulator-push`: the push payload in `file` delivered to `bundleId`.
|
|
59
|
+
* - `simulator-privacy`: `answer` 'granted' grants and 'denied' revokes `service` for `bundleId`.
|
|
60
|
+
*
|
|
61
|
+
* @param {Object} params
|
|
62
|
+
* @param {string} params.action
|
|
63
|
+
* @param {string} [params.adb] The adb executable (findAndroidTool).
|
|
64
|
+
* @param {string} [params.udid] The simulator.
|
|
65
|
+
* @param {string} [params.serial] The Android device.
|
|
66
|
+
*/
|
|
67
|
+
function buildDeviceCommand({ action, adb, answer, bundleId, file, serial, service, udid, value }) {
|
|
68
|
+
switch (action) {
|
|
69
|
+
case 'list-simulators':
|
|
70
|
+
return { command: 'xcrun', args: ['simctl', 'list', 'devices', 'booted', '--json'] };
|
|
71
|
+
case 'list-android':
|
|
72
|
+
return { command: adb, args: ['devices', '-l'] };
|
|
73
|
+
case 'simulator-screenshot':
|
|
74
|
+
return { command: 'xcrun', args: ['simctl', 'io', udid, 'screenshot', '--type=png', file] };
|
|
75
|
+
case 'android-screenshot':
|
|
76
|
+
return {
|
|
77
|
+
command: adb,
|
|
78
|
+
args: ['-s', serial, 'exec-out', 'screencap', '-p'],
|
|
79
|
+
encoding: 'buffer',
|
|
80
|
+
};
|
|
81
|
+
case 'simulator-location':
|
|
82
|
+
return { command: 'xcrun', args: simulatorLocationArgs({ udid, value }) };
|
|
83
|
+
case 'simulator-push':
|
|
84
|
+
return { command: 'xcrun', args: ['simctl', 'push', udid, bundleId, file] };
|
|
85
|
+
case 'simulator-privacy':
|
|
86
|
+
return {
|
|
87
|
+
command: 'xcrun',
|
|
88
|
+
args: [
|
|
89
|
+
'simctl',
|
|
90
|
+
'privacy',
|
|
91
|
+
udid,
|
|
92
|
+
answer === 'granted' ? 'grant' : 'revoke',
|
|
93
|
+
service,
|
|
94
|
+
bundleId,
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
default:
|
|
98
|
+
throw new Error(`Unknown device command. Received ${JSON.stringify(action)}.`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { SIMCTL_PRIVACY_SERVICES };
|
|
103
|
+
export default buildDeviceCommand;
|