@abide/abide 0.28.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/CHANGELOG.md +607 -0
- package/LICENSE +21 -0
- package/README.md +154 -0
- package/bin/abide.ts +212 -0
- package/package.json +155 -0
- package/src/abideLsp.ts +211 -0
- package/src/abideModules.d.ts +8 -0
- package/src/abideResolverPlugin.ts +923 -0
- package/src/appEntry.ts +151 -0
- package/src/assets/app.html +12 -0
- package/src/build.ts +143 -0
- package/src/buildCli.ts +127 -0
- package/src/buildDisconnected.ts +118 -0
- package/src/bundleApp.ts +147 -0
- package/src/bundleDisconnectedEntry.ts +14 -0
- package/src/checkAbide.ts +77 -0
- package/src/cliEntry.ts +25 -0
- package/src/clientBuildPlugins.ts +33 -0
- package/src/clientEntry.ts +17 -0
- package/src/compile.ts +63 -0
- package/src/controlServerWorker.ts +426 -0
- package/src/devEntry.ts +250 -0
- package/src/discoveryEntry.ts +81 -0
- package/src/lib/bundle/BundleMenu.ts +12 -0
- package/src/lib/bundle/BundleMenuItem.ts +25 -0
- package/src/lib/bundle/BundleWindow.ts +37 -0
- package/src/lib/bundle/WEBVIEW_BUILD_REVISION.ts +9 -0
- package/src/lib/bundle/WEBVIEW_VERSION.ts +7 -0
- package/src/lib/bundle/bindConnectedFlag.ts +29 -0
- package/src/lib/bundle/bindRequestNavigate.ts +34 -0
- package/src/lib/bundle/buildWebviewLib.ts +111 -0
- package/src/lib/bundle/bundled.ts +35 -0
- package/src/lib/bundle/disconnected.abide +236 -0
- package/src/lib/bundle/disconnected.css +9 -0
- package/src/lib/bundle/ensureWebviewLib.ts +20 -0
- package/src/lib/bundle/exitWithParent.ts +28 -0
- package/src/lib/bundle/infoPlist.ts +46 -0
- package/src/lib/bundle/installDownloads.ts +24 -0
- package/src/lib/bundle/installMacMenu.ts +39 -0
- package/src/lib/bundle/listenLocalControlServer.ts +19 -0
- package/src/lib/bundle/native/abideMenu.mm +422 -0
- package/src/lib/bundle/native/webview.h +4557 -0
- package/src/lib/bundle/onMenu.ts +42 -0
- package/src/lib/bundle/openWebview.ts +104 -0
- package/src/lib/bundle/pngToIcns.ts +47 -0
- package/src/lib/bundle/probeAbideServer.ts +57 -0
- package/src/lib/bundle/resolveServerBinary.ts +12 -0
- package/src/lib/bundle/resolveWebviewLib.ts +53 -0
- package/src/lib/bundle/serverBinaryFilename.ts +8 -0
- package/src/lib/bundle/signMacApp.ts +37 -0
- package/src/lib/bundle/spawnEmbeddedServer.ts +64 -0
- package/src/lib/bundle/stableLocalPort.ts +19 -0
- package/src/lib/bundle/waitForServer.ts +23 -0
- package/src/lib/bundle/webviewCachePath.ts +23 -0
- package/src/lib/bundle/webviewLibName.ts +11 -0
- package/src/lib/cli/connectToServer.ts +23 -0
- package/src/lib/cli/createClient.ts +108 -0
- package/src/lib/cli/dispatchCommand.ts +71 -0
- package/src/lib/cli/loadEnvFromBinaryDir.ts +15 -0
- package/src/lib/cli/parseArgvForRpc.ts +100 -0
- package/src/lib/cli/printHelp.ts +119 -0
- package/src/lib/cli/printSessionHelp.ts +27 -0
- package/src/lib/cli/printSessionStatus.ts +21 -0
- package/src/lib/cli/printTrimmed.ts +8 -0
- package/src/lib/cli/printValue.ts +10 -0
- package/src/lib/cli/resolveCliTarget.ts +48 -0
- package/src/lib/cli/runCli.ts +176 -0
- package/src/lib/cli/runSession.ts +108 -0
- package/src/lib/cli/startLocalInstance.ts +14 -0
- package/src/lib/cli/tokenizeLine.ts +51 -0
- package/src/lib/cli/types/CliManifest.ts +9 -0
- package/src/lib/cli/types/CliManifestEntry.ts +17 -0
- package/src/lib/cli/types/CliTarget.ts +13 -0
- package/src/lib/mcp/annotationsForMethod.ts +29 -0
- package/src/lib/mcp/createMcpResourceServer.ts +102 -0
- package/src/lib/mcp/createMcpServer.ts +48 -0
- package/src/lib/mcp/dispatchMcpRequest.ts +138 -0
- package/src/lib/mcp/mcpResourceServerSlot.ts +18 -0
- package/src/lib/mcp/mcpSurface.ts +295 -0
- package/src/lib/mcp/toolResultFromResponse.ts +66 -0
- package/src/lib/mcp/types/JsonRpcRequest.ts +12 -0
- package/src/lib/mcp/types/JsonRpcResponse.ts +20 -0
- package/src/lib/mcp/types/McpResourceContents.ts +10 -0
- package/src/lib/mcp/types/McpResourceDescriptor.ts +6 -0
- package/src/lib/mcp/types/McpResourceServer.ts +12 -0
- package/src/lib/mcp/types/McpServer.ts +9 -0
- package/src/lib/mcp/types/McpServerOptions.ts +16 -0
- package/src/lib/server/AppModule.ts +47 -0
- package/src/lib/server/DELETE.ts +10 -0
- package/src/lib/server/GET.ts +10 -0
- package/src/lib/server/HEAD.ts +10 -0
- package/src/lib/server/PATCH.ts +10 -0
- package/src/lib/server/POST.ts +10 -0
- package/src/lib/server/PUT.ts +10 -0
- package/src/lib/server/agent.ts +86 -0
- package/src/lib/server/appDataDir.ts +16 -0
- package/src/lib/server/cli/buildEnvContent.ts +19 -0
- package/src/lib/server/cli/createTarGz.ts +77 -0
- package/src/lib/server/cli/handleCliDownload.ts +150 -0
- package/src/lib/server/cli/handleCliInstall.ts +37 -0
- package/src/lib/server/cli/installScript.ts +31 -0
- package/src/lib/server/cli/maxSourceMtime.ts +26 -0
- package/src/lib/server/cookies.ts +30 -0
- package/src/lib/server/env.ts +51 -0
- package/src/lib/server/error.ts +73 -0
- package/src/lib/server/json.ts +42 -0
- package/src/lib/server/jsonl.ts +47 -0
- package/src/lib/server/prompts/definePrompt.ts +21 -0
- package/src/lib/server/prompts/promptRegistry.ts +9 -0
- package/src/lib/server/prompts/registerPrompt.ts +6 -0
- package/src/lib/server/prompts/renderPromptTemplate.ts +17 -0
- package/src/lib/server/prompts/types/Prompt.ts +13 -0
- package/src/lib/server/prompts/types/PromptOptions.ts +12 -0
- package/src/lib/server/prompts/types/PromptRegistryEntry.ts +13 -0
- package/src/lib/server/prompts/types/PromptRoutes.ts +10 -0
- package/src/lib/server/reachable.ts +45 -0
- package/src/lib/server/redirect.ts +43 -0
- package/src/lib/server/request.ts +19 -0
- package/src/lib/server/rpc/defineVerb.ts +210 -0
- package/src/lib/server/rpc/dispatchVerbInProcess.ts +46 -0
- package/src/lib/server/rpc/findVerbByCommandName.ts +18 -0
- package/src/lib/server/rpc/parseArgs.ts +127 -0
- package/src/lib/server/rpc/readBodyWithinLimit.ts +44 -0
- package/src/lib/server/rpc/registerVerb.ts +6 -0
- package/src/lib/server/rpc/runWithVerbTimeout.ts +49 -0
- package/src/lib/server/rpc/types/RemoteHandler.ts +27 -0
- package/src/lib/server/rpc/types/RemoteRoutes.ts +13 -0
- package/src/lib/server/rpc/types/TypedResponse.ts +18 -0
- package/src/lib/server/rpc/types/VerbHelper.ts +87 -0
- package/src/lib/server/rpc/types/VerbRegistryEntry.ts +35 -0
- package/src/lib/server/rpc/unprocessed.ts +14 -0
- package/src/lib/server/rpc/verbRegistry.ts +11 -0
- package/src/lib/server/runtime/DEFAULT_PORT.ts +6 -0
- package/src/lib/server/runtime/DEV_READY_MESSAGE.ts +6 -0
- package/src/lib/server/runtime/DEV_REBUILD_MESSAGE.ts +4 -0
- package/src/lib/server/runtime/DEV_RELOAD_CLIENT_SCRIPT.ts +107 -0
- package/src/lib/server/runtime/SSR_SWAP_SCRIPT.ts +16 -0
- package/src/lib/server/runtime/acceptsGzip.ts +24 -0
- package/src/lib/server/runtime/buildCacheSnapshot.ts +61 -0
- package/src/lib/server/runtime/buildHealthPayload.ts +34 -0
- package/src/lib/server/runtime/buildInspectorSurface.ts +37 -0
- package/src/lib/server/runtime/buildOpenApiSpec.ts +106 -0
- package/src/lib/server/runtime/cacheControlForAsset.ts +22 -0
- package/src/lib/server/runtime/containsTraversal.ts +37 -0
- package/src/lib/server/runtime/createAppAssetServer.ts +76 -0
- package/src/lib/server/runtime/createAssetHeaderCache.ts +31 -0
- package/src/lib/server/runtime/createPublicAssetServer.ts +67 -0
- package/src/lib/server/runtime/createReachable.ts +109 -0
- package/src/lib/server/runtime/createRouteDispatcher.ts +127 -0
- package/src/lib/server/runtime/createServer.ts +674 -0
- package/src/lib/server/runtime/createUiPageRenderer.ts +181 -0
- package/src/lib/server/runtime/crossOriginForbidden.ts +17 -0
- package/src/lib/server/runtime/crossOriginGate.ts +29 -0
- package/src/lib/server/runtime/devClientFingerprint.ts +117 -0
- package/src/lib/server/runtime/devHotModuleResponse.ts +40 -0
- package/src/lib/server/runtime/devReloadResponse.ts +41 -0
- package/src/lib/server/runtime/disableIdleTimeoutForStream.ts +27 -0
- package/src/lib/server/runtime/envSchemaStore.ts +15 -0
- package/src/lib/server/runtime/findOpenPort.ts +21 -0
- package/src/lib/server/runtime/getActiveServer.ts +6 -0
- package/src/lib/server/runtime/globToPathSet.ts +29 -0
- package/src/lib/server/runtime/gzipResponse.ts +46 -0
- package/src/lib/server/runtime/inProcessServer.ts +20 -0
- package/src/lib/server/runtime/internalErrorResponse.ts +25 -0
- package/src/lib/server/runtime/isCrossOriginRequest.ts +23 -0
- package/src/lib/server/runtime/listenOnOpenPort.ts +36 -0
- package/src/lib/server/runtime/logExposedSurfaces.ts +156 -0
- package/src/lib/server/runtime/maybeMountInspector.ts +97 -0
- package/src/lib/server/runtime/mimeForExtension.ts +14 -0
- package/src/lib/server/runtime/pageUrlFromStore.ts +15 -0
- package/src/lib/server/runtime/parseIdleTimeout.ts +10 -0
- package/src/lib/server/runtime/parsePort.ts +11 -0
- package/src/lib/server/runtime/registryManifests.ts +66 -0
- package/src/lib/server/runtime/requestContext.ts +5 -0
- package/src/lib/server/runtime/resolvePageSnapshot.ts +25 -0
- package/src/lib/server/runtime/respondWithEmbeddedAsset.ts +18 -0
- package/src/lib/server/runtime/runWithRequestScope.ts +150 -0
- package/src/lib/server/runtime/safeJsonForScript.ts +17 -0
- package/src/lib/server/runtime/serializeCacheSnapshot.ts +45 -0
- package/src/lib/server/runtime/serverSlot.ts +13 -0
- package/src/lib/server/runtime/setActiveServer.ts +6 -0
- package/src/lib/server/runtime/snapshotEntryFromCache.ts +83 -0
- package/src/lib/server/runtime/streamCacheResolutions.ts +37 -0
- package/src/lib/server/runtime/streamFromIterator.ts +86 -0
- package/src/lib/server/runtime/types/Assets.ts +6 -0
- package/src/lib/server/runtime/types/DevReloadStamp.ts +18 -0
- package/src/lib/server/runtime/types/InspectorCacheEntry.ts +24 -0
- package/src/lib/server/runtime/types/InspectorCacheSnapshot.ts +11 -0
- package/src/lib/server/runtime/types/InspectorContext.ts +30 -0
- package/src/lib/server/runtime/types/InspectorSocket.ts +17 -0
- package/src/lib/server/runtime/types/InspectorSurface.ts +13 -0
- package/src/lib/server/runtime/types/InspectorVerb.ts +27 -0
- package/src/lib/server/runtime/types/RequestStore.ts +55 -0
- package/src/lib/server/runtime/warnUnguardedMcp.ts +32 -0
- package/src/lib/server/runtime/withResponseDefaults.ts +24 -0
- package/src/lib/server/server.ts +33 -0
- package/src/lib/server/socket.ts +32 -0
- package/src/lib/server/sockets/createSocketDispatcher.ts +337 -0
- package/src/lib/server/sockets/defineSocket.ts +179 -0
- package/src/lib/server/sockets/lookupSocket.ts +6 -0
- package/src/lib/server/sockets/registerSocket.ts +6 -0
- package/src/lib/server/sockets/socketOperations.ts +36 -0
- package/src/lib/server/sockets/socketRegistry.ts +9 -0
- package/src/lib/server/sockets/types/Socket.ts +23 -0
- package/src/lib/server/sockets/types/SocketClientFrame.ts +19 -0
- package/src/lib/server/sockets/types/SocketOperation.ts +22 -0
- package/src/lib/server/sockets/types/SocketOptions.ts +26 -0
- package/src/lib/server/sockets/types/SocketRegistryEntry.ts +19 -0
- package/src/lib/server/sockets/types/SocketRoutes.ts +10 -0
- package/src/lib/server/sockets/types/SocketServerFrame.ts +24 -0
- package/src/lib/server/sse.ts +54 -0
- package/src/lib/shared/ABIDE_PACKAGE_NAME.ts +7 -0
- package/src/lib/shared/ABIDE_VERSION.ts +9 -0
- package/src/lib/shared/CACHE_CONTROL_VALUES.ts +16 -0
- package/src/lib/shared/CACHE_WRAPPED.ts +8 -0
- package/src/lib/shared/CLI_PATH.ts +7 -0
- package/src/lib/shared/DEV_HOT_PREFIX.ts +7 -0
- package/src/lib/shared/DEV_RELOAD_PATH.ts +6 -0
- package/src/lib/shared/HEALTH_PATH.ts +7 -0
- package/src/lib/shared/HttpError.ts +20 -0
- package/src/lib/shared/IDENTITY_PATH.ts +6 -0
- package/src/lib/shared/INSPECTOR_PATH.ts +7 -0
- package/src/lib/shared/NAV_HEADER.ts +8 -0
- package/src/lib/shared/OFFLINE_HEADER.ts +8 -0
- package/src/lib/shared/REMOTE_FUNCTION.ts +8 -0
- package/src/lib/shared/REPLAYABLE_METHODS.ts +12 -0
- package/src/lib/shared/SOCKETS_PATH.ts +7 -0
- package/src/lib/shared/STREAMING_CONTENT_TYPES.ts +11 -0
- package/src/lib/shared/SocketDisconnectedError.ts +13 -0
- package/src/lib/shared/TEXT_PLAIN.ts +7 -0
- package/src/lib/shared/abideImportName.ts +44 -0
- package/src/lib/shared/abideLog.ts +38 -0
- package/src/lib/shared/activeCacheStore.ts +20 -0
- package/src/lib/shared/activePage.ts +25 -0
- package/src/lib/shared/appDataDir.ts +34 -0
- package/src/lib/shared/appNameSlot.ts +10 -0
- package/src/lib/shared/basePath.ts +10 -0
- package/src/lib/shared/basePathFromAppUrl.ts +20 -0
- package/src/lib/shared/baseSlot.ts +14 -0
- package/src/lib/shared/binaryDirEnvPath.ts +12 -0
- package/src/lib/shared/browserClientFlags.ts +10 -0
- package/src/lib/shared/buildRpcProxy.ts +39 -0
- package/src/lib/shared/buildRpcRequest.ts +70 -0
- package/src/lib/shared/buildSocketOverChannel.ts +58 -0
- package/src/lib/shared/bundleLayout.ts +36 -0
- package/src/lib/shared/cache.ts +951 -0
- package/src/lib/shared/cacheEntryFromSnapshot.ts +59 -0
- package/src/lib/shared/cacheStoreSlot.ts +16 -0
- package/src/lib/shared/cacheStores.ts +10 -0
- package/src/lib/shared/canonicalJson.ts +63 -0
- package/src/lib/shared/carriesBodyArgs.ts +13 -0
- package/src/lib/shared/clearLastConnection.ts +7 -0
- package/src/lib/shared/commandNameForUrl.ts +17 -0
- package/src/lib/shared/createCacheStore.ts +104 -0
- package/src/lib/shared/createChannelLog.ts +122 -0
- package/src/lib/shared/createLifecycleChannel.ts +56 -0
- package/src/lib/shared/createLivenessWatch.ts +118 -0
- package/src/lib/shared/createPushIterator.ts +127 -0
- package/src/lib/shared/createRemoteFunction.ts +122 -0
- package/src/lib/shared/createSubscriber.ts +55 -0
- package/src/lib/shared/createTraceContext.ts +21 -0
- package/src/lib/shared/dataDirEnvPath.ts +12 -0
- package/src/lib/shared/decodeResponse.ts +47 -0
- package/src/lib/shared/detectTarget.ts +27 -0
- package/src/lib/shared/detectVerbMethod.ts +17 -0
- package/src/lib/shared/emitLogRecord.ts +190 -0
- package/src/lib/shared/exeSuffix.ts +9 -0
- package/src/lib/shared/exitOnBuildFailure.ts +17 -0
- package/src/lib/shared/extraForwardHeaders.ts +16 -0
- package/src/lib/shared/fileStem.ts +9 -0
- package/src/lib/shared/findExportCallSite.ts +476 -0
- package/src/lib/shared/formatTraceparent.ts +6 -0
- package/src/lib/shared/forwardHeaders.ts +44 -0
- package/src/lib/shared/getRemoteMeta.ts +5 -0
- package/src/lib/shared/globalCacheStore.ts +15 -0
- package/src/lib/shared/globalCacheStoreSlot.ts +14 -0
- package/src/lib/shared/health.ts +179 -0
- package/src/lib/shared/healthReadSlot.ts +11 -0
- package/src/lib/shared/healthSeedSlot.ts +12 -0
- package/src/lib/shared/html.ts +38 -0
- package/src/lib/shared/importNamesToStrip.ts +13 -0
- package/src/lib/shared/invalidateEvent.ts +11 -0
- package/src/lib/shared/invalidateTripwire.ts +40 -0
- package/src/lib/shared/isAbideHealthPayload.ts +11 -0
- package/src/lib/shared/isCompileTarget.ts +15 -0
- package/src/lib/shared/isDebugEnabled.ts +26 -0
- package/src/lib/shared/isDebugNegated.ts +19 -0
- package/src/lib/shared/isModuleNotFound.ts +16 -0
- package/src/lib/shared/isReadOnlyMethod.ts +14 -0
- package/src/lib/shared/isReplayableMethod.ts +7 -0
- package/src/lib/shared/isStreamingResponse.ts +11 -0
- package/src/lib/shared/isSubscribable.ts +15 -0
- package/src/lib/shared/jsonSchemaForPromptArguments.ts +29 -0
- package/src/lib/shared/jsonSchemaForSchema.ts +39 -0
- package/src/lib/shared/jsonlErrorFrame.ts +24 -0
- package/src/lib/shared/keyForRemoteCall.ts +29 -0
- package/src/lib/shared/keyMatchesPrefix.ts +9 -0
- package/src/lib/shared/lastConnectionPath.ts +7 -0
- package/src/lib/shared/layoutChainForRoute.ts +22 -0
- package/src/lib/shared/loadEnvFile.ts +17 -0
- package/src/lib/shared/loadEnvFromDataDir.ts +14 -0
- package/src/lib/shared/log.ts +24 -0
- package/src/lib/shared/logClosingRecord.ts +28 -0
- package/src/lib/shared/logTapSlot.ts +13 -0
- package/src/lib/shared/manifestModule.ts +39 -0
- package/src/lib/shared/matchesDebugPattern.ts +16 -0
- package/src/lib/shared/memoizeByKey.ts +32 -0
- package/src/lib/shared/normalizeTarget.ts +10 -0
- package/src/lib/shared/online.ts +51 -0
- package/src/lib/shared/page.ts +30 -0
- package/src/lib/shared/pageSlot.ts +17 -0
- package/src/lib/shared/pageUrlForFile.ts +14 -0
- package/src/lib/shared/parseBoundedEnvInt.ts +20 -0
- package/src/lib/shared/parseDebugPatterns.ts +21 -0
- package/src/lib/shared/parseEnv.ts +30 -0
- package/src/lib/shared/parsePromptMarkdown.ts +35 -0
- package/src/lib/shared/parseRouteSegments.ts +22 -0
- package/src/lib/shared/parseTraceparent.ts +26 -0
- package/src/lib/shared/pending.ts +30 -0
- package/src/lib/shared/prepareRpcModule.ts +59 -0
- package/src/lib/shared/prepareSocketModule.ts +49 -0
- package/src/lib/shared/probeRegistries.ts +68 -0
- package/src/lib/shared/producerKey.ts +32 -0
- package/src/lib/shared/programNameForPackage.ts +14 -0
- package/src/lib/shared/promptNameForFile.ts +10 -0
- package/src/lib/shared/queryStringFromArgs.ts +27 -0
- package/src/lib/shared/randomHexId.ts +14 -0
- package/src/lib/shared/readEnvFile.ts +15 -0
- package/src/lib/shared/readLastConnection.ts +18 -0
- package/src/lib/shared/readPackageJson.ts +9 -0
- package/src/lib/shared/recordRemoteMeta.ts +5 -0
- package/src/lib/shared/refreshing.ts +31 -0
- package/src/lib/shared/remoteMetaStore.ts +16 -0
- package/src/lib/shared/requestScopeSlot.ts +15 -0
- package/src/lib/shared/resolveClientFlags.ts +20 -0
- package/src/lib/shared/responseErrorText.ts +9 -0
- package/src/lib/shared/rpcTimeoutSlot.ts +9 -0
- package/src/lib/shared/rpcUrlForFile.ts +19 -0
- package/src/lib/shared/runningAsStandaloneBinary.ts +13 -0
- package/src/lib/shared/selectorMatcher.ts +68 -0
- package/src/lib/shared/selectorPrefix.ts +39 -0
- package/src/lib/shared/serializeEnv.ts +18 -0
- package/src/lib/shared/setAppName.ts +5 -0
- package/src/lib/shared/setBaseResolver.ts +6 -0
- package/src/lib/shared/setCacheStoreResolver.ts +6 -0
- package/src/lib/shared/setGlobalCacheStoreResolver.ts +6 -0
- package/src/lib/shared/setPageResolver.ts +7 -0
- package/src/lib/shared/setRequestScopeResolver.ts +6 -0
- package/src/lib/shared/snippet.ts +25 -0
- package/src/lib/shared/socketNameForFile.ts +11 -0
- package/src/lib/shared/socketTapSlot.ts +12 -0
- package/src/lib/shared/sseErrorFrame.ts +29 -0
- package/src/lib/shared/streamResponse.ts +169 -0
- package/src/lib/shared/stripImport.ts +27 -0
- package/src/lib/shared/subscribableFromResponse.ts +51 -0
- package/src/lib/shared/tailProbeSlot.ts +16 -0
- package/src/lib/shared/toBunRoutePattern.ts +28 -0
- package/src/lib/shared/toScopeSet.ts +4 -0
- package/src/lib/shared/trace.ts +16 -0
- package/src/lib/shared/types/CacheEntry.ts +84 -0
- package/src/lib/shared/types/CacheInvalidation.ts +9 -0
- package/src/lib/shared/types/CacheOnContext.ts +25 -0
- package/src/lib/shared/types/CacheOptions.ts +39 -0
- package/src/lib/shared/types/CacheSelector.ts +17 -0
- package/src/lib/shared/types/CacheSnapshot.ts +16 -0
- package/src/lib/shared/types/CacheSnapshotEntry.ts +17 -0
- package/src/lib/shared/types/CacheStats.ts +13 -0
- package/src/lib/shared/types/CacheStore.ts +39 -0
- package/src/lib/shared/types/ChannelLog.ts +13 -0
- package/src/lib/shared/types/ClientFlags.ts +11 -0
- package/src/lib/shared/types/CompileTarget.ts +6 -0
- package/src/lib/shared/types/FrameworkLog.ts +13 -0
- package/src/lib/shared/types/HttpVerb.ts +1 -0
- package/src/lib/shared/types/LastConnection.ts +9 -0
- package/src/lib/shared/types/Log.ts +13 -0
- package/src/lib/shared/types/LogRecord.ts +42 -0
- package/src/lib/shared/types/LogVoice.ts +7 -0
- package/src/lib/shared/types/PageSnapshot.ts +14 -0
- package/src/lib/shared/types/PromptArgument.ts +12 -0
- package/src/lib/shared/types/RawRemoteFunction.ts +14 -0
- package/src/lib/shared/types/RemoteCallable.ts +12 -0
- package/src/lib/shared/types/RemoteFunction.ts +47 -0
- package/src/lib/shared/types/ReplayableMethod.ts +7 -0
- package/src/lib/shared/types/RequestScopeInfo.ts +16 -0
- package/src/lib/shared/types/RpcInvoker.ts +6 -0
- package/src/lib/shared/types/SocketChannel.ts +17 -0
- package/src/lib/shared/types/SocketSubCallbacks.ts +13 -0
- package/src/lib/shared/types/StandardSchemaV1.ts +56 -0
- package/src/lib/shared/types/StreamedResolution.ts +10 -0
- package/src/lib/shared/types/Subscribable.ts +26 -0
- package/src/lib/shared/types/TailHooks.ts +12 -0
- package/src/lib/shared/types/TailOptions.ts +10 -0
- package/src/lib/shared/types/TraceContext.ts +17 -0
- package/src/lib/shared/url.ts +118 -0
- package/src/lib/shared/withBase.ts +11 -0
- package/src/lib/shared/withBaseUrl.ts +17 -0
- package/src/lib/shared/withJsonSchema.ts +21 -0
- package/src/lib/shared/writeDts.ts +12 -0
- package/src/lib/shared/writeHealthDts.ts +36 -0
- package/src/lib/shared/writeLastConnection.ts +13 -0
- package/src/lib/shared/writePublicAssetsDts.ts +31 -0
- package/src/lib/shared/writeRoutesDts.ts +73 -0
- package/src/lib/shared/writeRpcDts.ts +49 -0
- package/src/lib/shared/writeTestRpcDts.ts +45 -0
- package/src/lib/shared/writeTestSocketsDts.ts +34 -0
- package/src/lib/test/assertAgentFrameConformance.ts +73 -0
- package/src/lib/test/createScriptedSurface.ts +45 -0
- package/src/lib/test/createTestApp.ts +203 -0
- package/src/lib/test/createTestSocketChannel.ts +142 -0
- package/src/lib/ui/README.md +86 -0
- package/src/lib/ui/compile/SSR_ESCAPE.ts +25 -0
- package/src/lib/ui/compile/UI_RUNTIME_IMPORTS.ts +36 -0
- package/src/lib/ui/compile/VOID_TAGS.ts +21 -0
- package/src/lib/ui/compile/abideUiPlugin.ts +65 -0
- package/src/lib/ui/compile/analyzeComponent.ts +117 -0
- package/src/lib/ui/compile/assetModulesFile.ts +32 -0
- package/src/lib/ui/compile/branchElements.ts +50 -0
- package/src/lib/ui/compile/collectAbideDiagnostics.ts +59 -0
- package/src/lib/ui/compile/compileComponent.ts +20 -0
- package/src/lib/ui/compile/compileModule.ts +116 -0
- package/src/lib/ui/compile/compileSSR.ts +36 -0
- package/src/lib/ui/compile/compileShadow.ts +352 -0
- package/src/lib/ui/compile/createShadowLanguageService.ts +197 -0
- package/src/lib/ui/compile/createShadowProgram.ts +96 -0
- package/src/lib/ui/compile/decodeHtmlEntities.ts +49 -0
- package/src/lib/ui/compile/desugarSignals.ts +133 -0
- package/src/lib/ui/compile/escapeHtml.ts +15 -0
- package/src/lib/ui/compile/generateBuild.ts +638 -0
- package/src/lib/ui/compile/generateSSR.ts +380 -0
- package/src/lib/ui/compile/groupBindParts.ts +28 -0
- package/src/lib/ui/compile/hoistCells.ts +120 -0
- package/src/lib/ui/compile/loadShadowTsConfig.ts +31 -0
- package/src/lib/ui/compile/lowerDocAccess.ts +202 -0
- package/src/lib/ui/compile/nearestProjectRoot.ts +16 -0
- package/src/lib/ui/compile/parseTemplate.ts +396 -0
- package/src/lib/ui/compile/partitionSlots.ts +36 -0
- package/src/lib/ui/compile/prepareNestedScript.ts +42 -0
- package/src/lib/ui/compile/remapShadowDiagnostic.ts +30 -0
- package/src/lib/ui/compile/renameSignalRefs.ts +85 -0
- package/src/lib/ui/compile/resolveAbideImports.ts +29 -0
- package/src/lib/ui/compile/scopeCss.ts +115 -0
- package/src/lib/ui/compile/shadowNaming.ts +11 -0
- package/src/lib/ui/compile/sourceToShadowOffset.ts +24 -0
- package/src/lib/ui/compile/staticAttrValue.ts +13 -0
- package/src/lib/ui/compile/stripEffects.ts +32 -0
- package/src/lib/ui/compile/types/AbideDiagnostic.ts +14 -0
- package/src/lib/ui/compile/types/AnalyzedComponent.ts +25 -0
- package/src/lib/ui/compile/types/CompiledShadow.ts +15 -0
- package/src/lib/ui/compile/types/TemplateAttr.ts +16 -0
- package/src/lib/ui/compile/types/TemplateNode.ts +78 -0
- package/src/lib/ui/compile/types/TextPart.ts +8 -0
- package/src/lib/ui/derived.ts +28 -0
- package/src/lib/ui/doc.ts +15 -0
- package/src/lib/ui/dom/appendSnippet.ts +34 -0
- package/src/lib/ui/dom/appendStatic.ts +27 -0
- package/src/lib/ui/dom/appendText.ts +114 -0
- package/src/lib/ui/dom/applyResolved.ts +72 -0
- package/src/lib/ui/dom/attach.ts +20 -0
- package/src/lib/ui/dom/attr.ts +19 -0
- package/src/lib/ui/dom/awaitBlock.ts +224 -0
- package/src/lib/ui/dom/cloneStatic.ts +52 -0
- package/src/lib/ui/dom/each.ts +115 -0
- package/src/lib/ui/dom/eachAsync.ts +153 -0
- package/src/lib/ui/dom/hydrate.ts +35 -0
- package/src/lib/ui/dom/mount.ts +29 -0
- package/src/lib/ui/dom/mountChild.ts +33 -0
- package/src/lib/ui/dom/on.ts +15 -0
- package/src/lib/ui/dom/openChild.ts +22 -0
- package/src/lib/ui/dom/openRoot.ts +20 -0
- package/src/lib/ui/dom/switchBlock.ts +75 -0
- package/src/lib/ui/dom/text.ts +20 -0
- package/src/lib/ui/dom/tryBlock.ts +112 -0
- package/src/lib/ui/dom/types/EachRow.ts +3 -0
- package/src/lib/ui/dom/types/SwitchCase.ts +6 -0
- package/src/lib/ui/dom/when.ts +73 -0
- package/src/lib/ui/effect.ts +16 -0
- package/src/lib/ui/installHotBridge.ts +73 -0
- package/src/lib/ui/matchRoute.ts +89 -0
- package/src/lib/ui/navigate.ts +17 -0
- package/src/lib/ui/probeNavigation.ts +33 -0
- package/src/lib/ui/remoteProxy.ts +97 -0
- package/src/lib/ui/renderChain.ts +50 -0
- package/src/lib/ui/renderToStream.ts +104 -0
- package/src/lib/ui/router.ts +286 -0
- package/src/lib/ui/runtime/OUTLET_TAG.ts +8 -0
- package/src/lib/ui/runtime/OWNER.ts +8 -0
- package/src/lib/ui/runtime/REACTIVE_CONTEXT.ts +14 -0
- package/src/lib/ui/runtime/RENDER.ts +23 -0
- package/src/lib/ui/runtime/RESUME.ts +16 -0
- package/src/lib/ui/runtime/applyPatchToTree.ts +41 -0
- package/src/lib/ui/runtime/claimChild.ts +10 -0
- package/src/lib/ui/runtime/clientPage.ts +16 -0
- package/src/lib/ui/runtime/createComputedNode.ts +16 -0
- package/src/lib/ui/runtime/createDoc.ts +177 -0
- package/src/lib/ui/runtime/createEffectNode.ts +58 -0
- package/src/lib/ui/runtime/createSignalNode.ts +16 -0
- package/src/lib/ui/runtime/detachLink.ts +21 -0
- package/src/lib/ui/runtime/endTracking.ts +24 -0
- package/src/lib/ui/runtime/enterRenderPass.ts +12 -0
- package/src/lib/ui/runtime/exitRenderPass.ts +7 -0
- package/src/lib/ui/runtime/firstOutlet.ts +22 -0
- package/src/lib/ui/runtime/flushEffects.ts +17 -0
- package/src/lib/ui/runtime/hotInstances.ts +10 -0
- package/src/lib/ui/runtime/hotReloadEnabled.ts +8 -0
- package/src/lib/ui/runtime/hotReplace.ts +25 -0
- package/src/lib/ui/runtime/nextBlockId.ts +11 -0
- package/src/lib/ui/runtime/pathExists.ts +23 -0
- package/src/lib/ui/runtime/readNode.ts +17 -0
- package/src/lib/ui/runtime/registerHotInstance.ts +23 -0
- package/src/lib/ui/runtime/runNode.ts +28 -0
- package/src/lib/ui/runtime/runtimePath.ts +9 -0
- package/src/lib/ui/runtime/scope.ts +24 -0
- package/src/lib/ui/runtime/toTeardown.ts +26 -0
- package/src/lib/ui/runtime/track.ts +58 -0
- package/src/lib/ui/runtime/trigger.ts +44 -0
- package/src/lib/ui/runtime/types/Cell.ts +5 -0
- package/src/lib/ui/runtime/types/Derived.ts +3 -0
- package/src/lib/ui/runtime/types/Doc.ts +19 -0
- package/src/lib/ui/runtime/types/EffectResult.ts +10 -0
- package/src/lib/ui/runtime/types/HotInstance.ts +14 -0
- package/src/lib/ui/runtime/types/NavVerdict.ts +9 -0
- package/src/lib/ui/runtime/types/Patch.ts +11 -0
- package/src/lib/ui/runtime/types/ReactiveLink.ts +21 -0
- package/src/lib/ui/runtime/types/ReactiveNode.ts +25 -0
- package/src/lib/ui/runtime/types/Route.ts +8 -0
- package/src/lib/ui/runtime/types/RouteLoader.ts +7 -0
- package/src/lib/ui/runtime/types/SsrRender.ts +22 -0
- package/src/lib/ui/runtime/types/State.ts +3 -0
- package/src/lib/ui/runtime/types/Teardown.ts +5 -0
- package/src/lib/ui/runtime/types/UiComponent.ts +16 -0
- package/src/lib/ui/runtime/types/UiProps.ts +15 -0
- package/src/lib/ui/runtime/unlinkDeps.ts +20 -0
- package/src/lib/ui/runtime/untrack.ts +20 -0
- package/src/lib/ui/runtime/valueAtPath.ts +18 -0
- package/src/lib/ui/runtime/writeNode.ts +16 -0
- package/src/lib/ui/socketChannel.ts +227 -0
- package/src/lib/ui/socketProxy.ts +25 -0
- package/src/lib/ui/startClient.ts +58 -0
- package/src/lib/ui/state.ts +25 -0
- package/src/lib/ui/tail.ts +324 -0
- package/src/lib/ui/types/Layouts.ts +9 -0
- package/src/lib/ui/types/Pages.ts +8 -0
- package/src/preload.ts +19 -0
- package/src/scaffold.ts +153 -0
- package/src/serverBuildPlugins.ts +19 -0
- package/src/serverEntry.ts +95 -0
- package/template/bunfig.toml +4 -0
- package/template/package.json +18 -0
- package/template/src/app.ts +28 -0
- package/template/src/bundle/icon.png +0 -0
- package/template/src/cli/banner.txt +3 -0
- package/template/src/cli/footer.txt +1 -0
- package/template/src/server/config.ts +17 -0
- package/template/src/server/rpc/getHello.ts +36 -0
- package/template/src/ui/Layout.abide +19 -0
- package/template/src/ui/app.css +21 -0
- package/template/src/ui/app.html +24 -0
- package/template/src/ui/pages/about/page.abide +9 -0
- package/template/src/ui/pages/page.abide +22 -0
- package/template/test/app.test.ts +30 -0
- package/template/tsconfig.json +18 -0
- package/tsconfig.app.json +17 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// @ts-expect-error virtual module resolved by abideResolverPlugin
|
|
2
|
+
import { rpc } from './_virtual/rpc.ts'
|
|
3
|
+
// @ts-expect-error virtual module resolved by abideResolverPlugin
|
|
4
|
+
import { sockets } from './_virtual/sockets.ts'
|
|
5
|
+
import type { CliManifestEntry } from './lib/cli/types/CliManifestEntry.ts'
|
|
6
|
+
import { verbRegistry } from './lib/server/rpc/verbRegistry.ts'
|
|
7
|
+
import { socketOperations } from './lib/server/sockets/socketOperations.ts'
|
|
8
|
+
import { socketRegistry } from './lib/server/sockets/socketRegistry.ts'
|
|
9
|
+
import { commandNameForUrl } from './lib/shared/commandNameForUrl.ts'
|
|
10
|
+
import { jsonSchemaForSchema } from './lib/shared/jsonSchemaForSchema.ts'
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
One-shot script that imports every rpc + socket module so defineVerb /
|
|
14
|
+
defineSocket populate the process-wide registries, then prints the CLI
|
|
15
|
+
manifest to stdout as JSON. Used by buildCli to bake the manifest into
|
|
16
|
+
the standalone binary at build time without resorting to static source
|
|
17
|
+
parsing (which can't see toJsonSchema()/toJSONSchema() at compile time).
|
|
18
|
+
*/
|
|
19
|
+
await Promise.all([
|
|
20
|
+
...Object.values(rpc).map((loader) => (loader as () => Promise<unknown>)()),
|
|
21
|
+
...Object.values(sockets).map((loader) => (loader as () => Promise<unknown>)()),
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
const manifest: Record<string, CliManifestEntry> = {}
|
|
25
|
+
|
|
26
|
+
for (const entry of verbRegistry.values()) {
|
|
27
|
+
if (!entry.clients.cli) {
|
|
28
|
+
continue
|
|
29
|
+
}
|
|
30
|
+
manifest[commandNameForUrl(entry.remote.url)] = {
|
|
31
|
+
method: entry.remote.method,
|
|
32
|
+
url: entry.remote.url,
|
|
33
|
+
jsonSchema: jsonSchemaForSchema(entry.inputSchema),
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
Sockets advertised to the CLI become commands against the socket's HTTP
|
|
39
|
+
face (see socketOperations): `<base>-tail` streams live (GET +
|
|
40
|
+
text/event-stream, with an optional --tail N to seed from the retained
|
|
41
|
+
tail first) and, when clientPublish is set, `<base>-publish` sends the args bag
|
|
42
|
+
as a message (POST).
|
|
43
|
+
*/
|
|
44
|
+
for (const entry of socketRegistry.values()) {
|
|
45
|
+
if (!entry.clients.cli) {
|
|
46
|
+
continue
|
|
47
|
+
}
|
|
48
|
+
for (const operation of socketOperations(entry)) {
|
|
49
|
+
if (operation.kind === 'tail') {
|
|
50
|
+
manifest[operation.name] = {
|
|
51
|
+
method: operation.method,
|
|
52
|
+
url: operation.restUrl,
|
|
53
|
+
accept: 'text/event-stream',
|
|
54
|
+
jsonSchema: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
description: `tail the "${operation.socketName}" socket`,
|
|
57
|
+
properties: {
|
|
58
|
+
tail: {
|
|
59
|
+
type: 'number',
|
|
60
|
+
description: 'replay last N messages before tailing live',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
continue
|
|
66
|
+
}
|
|
67
|
+
const payloadSchema = jsonSchemaForSchema(entry.schema)
|
|
68
|
+
manifest[operation.name] = {
|
|
69
|
+
method: operation.method,
|
|
70
|
+
url: operation.restUrl,
|
|
71
|
+
jsonSchema: {
|
|
72
|
+
...payloadSchema,
|
|
73
|
+
description:
|
|
74
|
+
(payloadSchema.description as string | undefined) ??
|
|
75
|
+
`publish a message to the "${operation.socketName}" socket`,
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
process.stdout.write(JSON.stringify(manifest))
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BundleMenuItem } from './BundleMenuItem.ts'
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
A top-level bundle menu, inserted into the macOS menu bar between the standard
|
|
5
|
+
Edit and Window menus. `label` titles the menu; `items` are its entries top to
|
|
6
|
+
bottom.
|
|
7
|
+
*/
|
|
8
|
+
// @readme bundle
|
|
9
|
+
export type BundleMenu = {
|
|
10
|
+
label: string
|
|
11
|
+
items: BundleMenuItem[]
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
A single entry in a bundle menu. Serializable data — the native shim builds the
|
|
3
|
+
matching NSMenuItem. Either a divider or a clickable item that dispatches a
|
|
4
|
+
`abide:menu` CustomEvent into the page (detail `{ name }`); the app's own code
|
|
5
|
+
handles it:
|
|
6
|
+
|
|
7
|
+
window.addEventListener('abide:menu', (event) => {
|
|
8
|
+
if (event.detail.name === 'sync') syncNow()
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
Emitting an event (rather than calling a verb directly) is what lets a menu
|
|
12
|
+
drive parameterised work: a click carries no arguments, so the app computes
|
|
13
|
+
them and makes the call itself. `shortcut` is the key for the Cmd-based
|
|
14
|
+
equivalent (e.g. `'r'` → Cmd-R).
|
|
15
|
+
|
|
16
|
+
A `navigate` item moves the window instead of talking to the page: clicking it
|
|
17
|
+
calls `webview_navigate` with the given URL (the native side, on the UI thread).
|
|
18
|
+
That's how the built-in Server menu drives the connect screen — `emit` reaches
|
|
19
|
+
the loaded page, `navigate` repoints the window itself.
|
|
20
|
+
*/
|
|
21
|
+
// @readme bundle
|
|
22
|
+
export type BundleMenuItem =
|
|
23
|
+
| { separator: true }
|
|
24
|
+
| { label: string; shortcut?: string; emit: string }
|
|
25
|
+
| { label: string; shortcut?: string; navigate: string }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '../shared/types/StandardSchemaV1.ts'
|
|
2
|
+
import type { BundleMenu } from './BundleMenu.ts'
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
User-authored bundle window configuration, default-exported from an
|
|
6
|
+
optional `src/bundle/window.ts`. Baked into the launcher at build time
|
|
7
|
+
(via the `abide:bundle-window` virtual) and read directly in dev. Every
|
|
8
|
+
field is optional — the launcher falls back to the program name for the
|
|
9
|
+
title and to openWebview's defaults for size.
|
|
10
|
+
|
|
11
|
+
The standard App/Edit/Window menus (Quit, copy/paste, minimize/close) plus the
|
|
12
|
+
built-in File menu (Start server / Connect / Disconnect) are always installed.
|
|
13
|
+
`menu` adds custom top-level menus between the Edit and Window menus; their items
|
|
14
|
+
emit `abide:menu` events the app handles. See BundleMenuItem.
|
|
15
|
+
*/
|
|
16
|
+
// @readme bundle
|
|
17
|
+
export type BundleWindow = {
|
|
18
|
+
title?: string
|
|
19
|
+
width?: number
|
|
20
|
+
height?: number
|
|
21
|
+
menu?: BundleMenu[]
|
|
22
|
+
/*
|
|
23
|
+
Overrides the bundle setup form's schema. By default the form is derived from
|
|
24
|
+
src/server/config.ts's env schema, so one declaration drives both boot
|
|
25
|
+
validation and the form — set this only when the bundle form should differ
|
|
26
|
+
from the env schema (it replaces, not merges; compose with the env schema
|
|
27
|
+
yourself via its `.extend(...)` if you want both).
|
|
28
|
+
|
|
29
|
+
A Standard Schema (the same kind abide accepts for RPC/MCP). Its JSON Schema
|
|
30
|
+
drives the connect screen's first-run form, shown as a modal when Start is
|
|
31
|
+
clicked with a required key still unset; the user's answers persist to the
|
|
32
|
+
data-dir `.env` the server loads at boot. Each property maps to one env var of
|
|
33
|
+
the same name; `title` is the field label, `description` the hint,
|
|
34
|
+
`format: 'password'` masks the input, and `default` pre-fills it.
|
|
35
|
+
*/
|
|
36
|
+
config?: StandardSchemaV1
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Revision of abide's own contribution to the compiled webview library — the
|
|
3
|
+
native shim sources linked in beside the vendored header (e.g. abideMenu.mm)
|
|
4
|
+
and the flags buildWebviewLib compiles them with. It participates in the build
|
|
5
|
+
cache key alongside the upstream version, so changing abide's native build
|
|
6
|
+
selects a fresh cache path and bypasses any library built before the change.
|
|
7
|
+
Bump this whenever the shim sources or their compile invocation change.
|
|
8
|
+
*/
|
|
9
|
+
export const WEBVIEW_BUILD_REVISION = 9
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Upstream `webview/webview` release the vendored `native/webview.h` is taken
|
|
3
|
+
from (https://github.com/webview/webview, MIT). Used to namespace the build
|
|
4
|
+
cache so bumping the header naturally bypasses any previously built library.
|
|
5
|
+
Bump this whenever `native/webview.h` is re-vendored.
|
|
6
|
+
*/
|
|
7
|
+
export const WEBVIEW_VERSION = '0.12.0'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { dlopen, FFIType } from 'bun:ffi'
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Binds abide_set_connected — the native flag the macOS Server menu's
|
|
5
|
+
validateMenuItem: reads to enable/disable Start/Disconnect. The symbol is
|
|
6
|
+
compiled only into the macOS lib (the Cocoa menu shim), so a failed lookup
|
|
7
|
+
degrades to a no-op setter rather than throwing on Linux/Windows.
|
|
8
|
+
|
|
9
|
+
The flag is a process-global, which is what lets the bundle's control server set
|
|
10
|
+
it from off the main thread: that server runs in a Worker because `webview_run`
|
|
11
|
+
blocks the main thread's JS event loop, yet the main-thread menu still reads the
|
|
12
|
+
same value through the shared dylib image. The returned close releases the handle.
|
|
13
|
+
*/
|
|
14
|
+
export function bindConnectedFlag(libPath: string): {
|
|
15
|
+
setConnected: (connected: boolean) => void
|
|
16
|
+
close: () => void
|
|
17
|
+
} {
|
|
18
|
+
try {
|
|
19
|
+
const lib = dlopen(libPath, {
|
|
20
|
+
abide_set_connected: { args: [FFIType.i32], returns: FFIType.void },
|
|
21
|
+
})
|
|
22
|
+
return {
|
|
23
|
+
setConnected: (connected) => lib.symbols.abide_set_connected(connected ? 1 : 0),
|
|
24
|
+
close: () => lib.close(),
|
|
25
|
+
}
|
|
26
|
+
} catch {
|
|
27
|
+
return { setConnected: () => {}, close: () => {} }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { dlopen, FFIType, type Pointer } from 'bun:ffi'
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Binds abide_request_navigate — points the live webview window at a URL from any
|
|
5
|
+
thread by hopping onto the UI thread via webview_dispatch. The launcher's control
|
|
6
|
+
server runs in a Worker (off the main thread that webview_run blocks), so when it
|
|
7
|
+
detects the connected server has died it uses this to bounce the window back to the
|
|
8
|
+
connect screen. macOS-only symbol (the Cocoa shim), so a failed lookup degrades to
|
|
9
|
+
a no-op — elsewhere the worker can still correct the menu flag, just not the window.
|
|
10
|
+
|
|
11
|
+
`handle` is the webview pointer created on the main thread, forwarded to the worker
|
|
12
|
+
as a number; bun:ffi accepts it for a ptr argument from either thread because the
|
|
13
|
+
pointer addresses the same process heap.
|
|
14
|
+
*/
|
|
15
|
+
export function bindRequestNavigate(libPath: string): {
|
|
16
|
+
requestNavigate: (handle: number, url: string) => void
|
|
17
|
+
close: () => void
|
|
18
|
+
} {
|
|
19
|
+
try {
|
|
20
|
+
const lib = dlopen(libPath, {
|
|
21
|
+
abide_request_navigate: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
22
|
+
})
|
|
23
|
+
return {
|
|
24
|
+
requestNavigate: (handle, url) =>
|
|
25
|
+
lib.symbols.abide_request_navigate(
|
|
26
|
+
handle as Pointer,
|
|
27
|
+
new TextEncoder().encode(`${url}\0`),
|
|
28
|
+
),
|
|
29
|
+
close: () => lib.close(),
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
return { requestNavigate: () => {}, close: () => {} }
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { dirname } from 'node:path'
|
|
2
|
+
import { abideLog } from '../shared/abideLog.ts'
|
|
3
|
+
import { WEBVIEW_VERSION } from './WEBVIEW_VERSION.ts'
|
|
4
|
+
import { webviewCachePath } from './webviewCachePath.ts'
|
|
5
|
+
|
|
6
|
+
// Vendored upstream amalgamation; the host compiler turns it into a lib.
|
|
7
|
+
const HEADER = new URL('./native/webview.h', import.meta.url).pathname
|
|
8
|
+
|
|
9
|
+
// abide's own native shim, linked into the same dylib on macOS to add the
|
|
10
|
+
// standard application menu bar the upstream webview omits.
|
|
11
|
+
const MAC_MENU_SOURCE = new URL('./native/abideMenu.mm', import.meta.url).pathname
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
Linux GTK/WebKit pkg-config module sets, newest first. The vendored header
|
|
15
|
+
auto-selects the GTK4 or GTK3 backend from GTK_MAJOR_VERSION in the include
|
|
16
|
+
path, so supplying the right cflags/libs is all that's needed — no backend
|
|
17
|
+
macro. The first set whose packages are installed wins.
|
|
18
|
+
*/
|
|
19
|
+
const LINUX_PKG_SETS = [
|
|
20
|
+
['gtk4', 'webkitgtk-6.0'],
|
|
21
|
+
['gtk+-3.0', 'webkit2gtk-4.1'],
|
|
22
|
+
['gtk+-3.0', 'webkit2gtk-4.0'],
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
Compiles the vendored webview header into a native shared library for the
|
|
27
|
+
host platform and caches it (webviewCachePath), so `abide bundle` needs
|
|
28
|
+
no prebuilt binary and no third-party webview package — just
|
|
29
|
+
the platform's C++ toolchain. Returns the cached path. Throws actionable
|
|
30
|
+
guidance when the toolchain or native webview dev packages are missing,
|
|
31
|
+
rather than letting the compiler fail opaquely.
|
|
32
|
+
*/
|
|
33
|
+
export async function buildWebviewLib(): Promise<string> {
|
|
34
|
+
const outfile = webviewCachePath()
|
|
35
|
+
await Bun.$`mkdir -p ${dirname(outfile)}`.quiet()
|
|
36
|
+
abideLog.info(`building webview ${WEBVIEW_VERSION} for ${process.platform}-${process.arch}…`)
|
|
37
|
+
|
|
38
|
+
if (process.platform === 'darwin') {
|
|
39
|
+
await compileDarwin(outfile)
|
|
40
|
+
} else if (process.platform === 'linux') {
|
|
41
|
+
await compileLinux(outfile)
|
|
42
|
+
} else {
|
|
43
|
+
/*
|
|
44
|
+
Windows needs MSVC + the WebView2 SDK header (WebView2.h), which
|
|
45
|
+
isn't a turnkey shell invocation. Until that build path lands,
|
|
46
|
+
point Windows users at the explicit-path escape hatch.
|
|
47
|
+
*/
|
|
48
|
+
throw new Error(
|
|
49
|
+
`[abide] building the webview library on ${process.platform} isn't supported yet. ` +
|
|
50
|
+
'Set ABIDE_WEBVIEW_LIB to a prebuilt webview library to continue.',
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
abideLog.success(`built webview library: ${outfile}`)
|
|
55
|
+
return outfile
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// macOS: clang against the WebKit + Cocoa frameworks (always present with the
|
|
59
|
+
// Command Line Tools), linking abide's Objective-C++ menu shim into the same
|
|
60
|
+
// dylib. The `-x` flags switch the input language per file: the vendored
|
|
61
|
+
// header compiles as C++ (it uses the C objc runtime, not objc syntax), the
|
|
62
|
+
// shim as Objective-C++. Maps a missing compiler to the install hint.
|
|
63
|
+
async function compileDarwin(outfile: string): Promise<void> {
|
|
64
|
+
try {
|
|
65
|
+
await Bun.$`clang++ -std=c++17 -DWEBVIEW_BUILD_SHARED -fvisibility=hidden -shared -framework WebKit -framework Cocoa -x c++ ${HEADER} -x objective-c++ ${MAC_MENU_SOURCE} -o ${outfile}`.quiet()
|
|
66
|
+
} catch (error) {
|
|
67
|
+
throw new Error(
|
|
68
|
+
'[abide] failed to compile the webview library. Install the Xcode Command ' +
|
|
69
|
+
'Line Tools with `xcode-select --install` and try again.\n' +
|
|
70
|
+
describeShellError(error),
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Linux: detect an installed GTK/WebKit set via pkg-config, then compile a
|
|
76
|
+
// position-independent shared object. Maps missing packages to install hints.
|
|
77
|
+
async function compileLinux(outfile: string): Promise<void> {
|
|
78
|
+
const flags = await linuxPkgFlags()
|
|
79
|
+
try {
|
|
80
|
+
await Bun.$`c++ -std=c++17 -DWEBVIEW_BUILD_SHARED -fvisibility=hidden -fPIC -shared -x c++ ${HEADER} ${flags} -o ${outfile}`.quiet()
|
|
81
|
+
} catch (error) {
|
|
82
|
+
throw new Error(
|
|
83
|
+
'[abide] failed to compile the webview library. Ensure a C++ compiler ' +
|
|
84
|
+
'(e.g. `build-essential`) is installed.\n' +
|
|
85
|
+
describeShellError(error),
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Returns combined cflags + libs for the first available GTK/WebKit set, or
|
|
91
|
+
// throws with the package names to install when none resolve.
|
|
92
|
+
async function linuxPkgFlags(): Promise<string[]> {
|
|
93
|
+
for (const modules of LINUX_PKG_SETS) {
|
|
94
|
+
const probe = await Bun.$`pkg-config --exists ${modules}`.nothrow().quiet()
|
|
95
|
+
if (probe.exitCode === 0) {
|
|
96
|
+
const flags = await Bun.$`pkg-config --cflags --libs ${modules}`.quiet().text()
|
|
97
|
+
return flags.trim().split(/\s+/)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
throw new Error(
|
|
101
|
+
'[abide] no GTK/WebKit development packages found. Install one set, e.g. ' +
|
|
102
|
+
'`libgtk-4-dev libwebkitgtk-6.0-dev` or `libgtk-3-dev libwebkit2gtk-4.1-dev`, ' +
|
|
103
|
+
'or set ABIDE_WEBVIEW_LIB to a prebuilt webview library.',
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Surfaces the compiler's own stderr when a Bun shell command throws.
|
|
108
|
+
function describeShellError(error: unknown): string {
|
|
109
|
+
const stderr = (error as { stderr?: Uint8Array }).stderr
|
|
110
|
+
return stderr ? new TextDecoder().decode(stderr) : String(error)
|
|
111
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
// Set by the native webview's init script (openWebview) on every document
|
|
4
|
+
// it loads — local or remote. Absent in a plain browser tab.
|
|
5
|
+
__ABIDE_BUNDLE__?: boolean
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
True when this code runs inside the abide desktop bundle rather than a plain web
|
|
11
|
+
app in a browser. Isomorphic: one name, same meaning on both sides — "am I part of
|
|
12
|
+
the bundle" — though each side detects it differently.
|
|
13
|
+
|
|
14
|
+
Client: the native webview runs an init script on every document it loads
|
|
15
|
+
(openWebview's webview_init), so the flag is present whether the page came from the
|
|
16
|
+
bundle's own embedded server or a *remote* one. A plain browser tab never runs that
|
|
17
|
+
script — even when it hits the embedded localhost server — so it reads false there.
|
|
18
|
+
This is the "in a webview" signal, robust to local-or-remote.
|
|
19
|
+
|
|
20
|
+
Server: the launcher sets ABIDE_PARENT_PID when it spawns the embedded server (see
|
|
21
|
+
spawnEmbeddedServer), so its presence marks "I am the bundle's embedded server
|
|
22
|
+
process." A remote server is never part of a bundle, so it reads false — matching
|
|
23
|
+
the client view that a remote page's *data source* is outside the bundle even while
|
|
24
|
+
its *rendering context* (the webview) is inside it.
|
|
25
|
+
|
|
26
|
+
Distinct from runningAsStandaloneBinary(), which is also true for a plain compiled
|
|
27
|
+
(install-tarball) server binary — still a web app, not a bundle.
|
|
28
|
+
*/
|
|
29
|
+
// @readme bundle
|
|
30
|
+
export function bundled(): boolean {
|
|
31
|
+
if (typeof window === 'undefined') {
|
|
32
|
+
return Boolean(Bun.env.ABIDE_PARENT_PID)
|
|
33
|
+
}
|
|
34
|
+
return window.__ABIDE_BUNDLE__ === true
|
|
35
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/*
|
|
3
|
+
Default bundle connect screen (abide-ui). The launcher serves this (logo baked in
|
|
4
|
+
at build time, app title injected at runtime) instead of a blank window; override
|
|
5
|
+
it by dropping a `src/bundle/disconnected.abide`. It connects to a remote server
|
|
6
|
+
by URL and boots the embedded server, talking to the launcher's in-process control
|
|
7
|
+
server: POST /connect and POST /start each reply with a `{ redirect }` to follow.
|
|
8
|
+
*/
|
|
9
|
+
const LAST_URL_KEY = 'abide:last-server-url'
|
|
10
|
+
|
|
11
|
+
const heading = globalThis.__ABIDE_TITLE__ ?? 'abide app'
|
|
12
|
+
const logo = globalThis.__ABIDE_LOGO__
|
|
13
|
+
const placeholder = 'https://example.com'
|
|
14
|
+
|
|
15
|
+
let url = state(localStorage.getItem(LAST_URL_KEY) ?? '')
|
|
16
|
+
let error = state('')
|
|
17
|
+
|
|
18
|
+
const launchAction = new URLSearchParams(location.search).get('action')
|
|
19
|
+
|
|
20
|
+
/* Two phases so the screen never flashes before a redirect. */
|
|
21
|
+
let phase = state(launchAction === 'start' ? 'splash' : 'connect')
|
|
22
|
+
|
|
23
|
+
let configFields = state([])
|
|
24
|
+
let configValues = state({})
|
|
25
|
+
let showConfig = state(false)
|
|
26
|
+
let savingConfig = state(false)
|
|
27
|
+
|
|
28
|
+
/* Interpret the boot intent once on load. */
|
|
29
|
+
effect(() => {
|
|
30
|
+
if (launchAction === 'start') {
|
|
31
|
+
void start()
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
if (launchAction === 'lost') {
|
|
35
|
+
error = 'The server stopped responding.'
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
if (launchAction === 'disconnect') {
|
|
39
|
+
void fetch('/__abide/disconnect').catch(() => {})
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
async function connect() {
|
|
44
|
+
const cleaned = url.trim()
|
|
45
|
+
if (!cleaned) {
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
await postAndFollow('/connect', { url: cleaned }, 'Could not connect', () => {
|
|
49
|
+
localStorage.setItem(LAST_URL_KEY, cleaned)
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function postAndFollow(path, body, failure, onSuccess) {
|
|
54
|
+
error = ''
|
|
55
|
+
phase = 'splash'
|
|
56
|
+
try {
|
|
57
|
+
const response = await fetch(path, {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
...(body === undefined
|
|
60
|
+
? {}
|
|
61
|
+
: { headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }),
|
|
62
|
+
})
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
const reply = await response.json()
|
|
65
|
+
throw new Error(reply.error ?? `${path.slice(1)} failed (${response.status})`)
|
|
66
|
+
}
|
|
67
|
+
const { redirect } = await response.json()
|
|
68
|
+
onSuccess?.()
|
|
69
|
+
location.href = redirect
|
|
70
|
+
} catch (cause) {
|
|
71
|
+
error = `${failure}: ${String(cause)}`
|
|
72
|
+
phase = 'connect'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function start() {
|
|
77
|
+
error = ''
|
|
78
|
+
const config = await loadConfig().catch(() => undefined)
|
|
79
|
+
if (config) {
|
|
80
|
+
configFields = config.fields
|
|
81
|
+
configValues = { ...config.values }
|
|
82
|
+
phase = 'connect'
|
|
83
|
+
showConfig = true
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
await boot()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function boot() {
|
|
90
|
+
await postAndFollow('/start', undefined, 'Could not start the server')
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async function loadConfig() {
|
|
94
|
+
const response = await fetch('/__abide/config')
|
|
95
|
+
const { schema, values } = await response.json()
|
|
96
|
+
if (!schema) {
|
|
97
|
+
return undefined
|
|
98
|
+
}
|
|
99
|
+
return { fields: fieldsFromSchema(schema), values: values ?? {} }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function fieldsFromSchema(schema) {
|
|
103
|
+
const properties = schema.properties ?? {}
|
|
104
|
+
const required = new Set(schema.required ?? [])
|
|
105
|
+
return Object.entries(properties).map(([key, property]) => ({
|
|
106
|
+
key,
|
|
107
|
+
label: property.title ?? key,
|
|
108
|
+
description: property.description,
|
|
109
|
+
inputType: inputType(property),
|
|
110
|
+
required: required.has(key),
|
|
111
|
+
}))
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function inputType(property) {
|
|
115
|
+
if (property.type === 'boolean') {
|
|
116
|
+
return 'checkbox'
|
|
117
|
+
}
|
|
118
|
+
if (property.type === 'number' || property.type === 'integer') {
|
|
119
|
+
return 'number'
|
|
120
|
+
}
|
|
121
|
+
if (property.format === 'password') {
|
|
122
|
+
return 'password'
|
|
123
|
+
}
|
|
124
|
+
return 'text'
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async function saveConfig() {
|
|
128
|
+
error = ''
|
|
129
|
+
savingConfig = true
|
|
130
|
+
try {
|
|
131
|
+
const response = await fetch('/__abide/config', {
|
|
132
|
+
method: 'POST',
|
|
133
|
+
headers: { 'content-type': 'application/json' },
|
|
134
|
+
body: JSON.stringify({ values: configValues }),
|
|
135
|
+
})
|
|
136
|
+
if (!response.ok) {
|
|
137
|
+
throw new Error(`save failed (${response.status})`)
|
|
138
|
+
}
|
|
139
|
+
showConfig = false
|
|
140
|
+
savingConfig = false
|
|
141
|
+
await boot()
|
|
142
|
+
} catch (cause) {
|
|
143
|
+
error = `Could not save settings: ${String(cause)}`
|
|
144
|
+
savingConfig = false
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
</script>
|
|
148
|
+
|
|
149
|
+
<template if={phase === 'splash'}>
|
|
150
|
+
<div class="flex min-h-screen items-center justify-center bg-gray-50 dark:bg-gray-950">
|
|
151
|
+
<template if={logo}>
|
|
152
|
+
<img src={logo} alt="" class="h-16 w-16 rounded-xl object-contain opacity-90">
|
|
153
|
+
</template>
|
|
154
|
+
</div>
|
|
155
|
+
<template else>
|
|
156
|
+
<main class="flex min-h-screen items-center justify-center bg-gray-50 p-6 text-gray-900 dark:bg-gray-950 dark:text-gray-100">
|
|
157
|
+
<div class="w-full max-w-sm rounded-2xl bg-white p-8 shadow-sm ring-1 ring-gray-200 dark:bg-gray-900 dark:ring-gray-800">
|
|
158
|
+
<template if={logo}>
|
|
159
|
+
<img src={logo} alt="" class="mx-auto mb-5 h-16 w-16 rounded-xl object-contain">
|
|
160
|
+
</template>
|
|
161
|
+
<h1 class="mb-6 text-center text-xl font-semibold tracking-tight">{heading}</h1>
|
|
162
|
+
|
|
163
|
+
<form class="flex flex-col gap-3" onsubmit={(event) => { event.preventDefault(); void connect() }}>
|
|
164
|
+
<input type="url" bind:value={url} placeholder={placeholder} autocomplete="url"
|
|
165
|
+
class="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm outline-none focus:border-gray-900 focus:ring-1 focus:ring-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:focus:border-gray-100 dark:focus:ring-gray-100">
|
|
166
|
+
<button type="submit"
|
|
167
|
+
class="w-full rounded-lg bg-gray-900 px-3 py-2 text-sm font-medium text-white hover:bg-gray-700 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-300">
|
|
168
|
+
Connect
|
|
169
|
+
</button>
|
|
170
|
+
</form>
|
|
171
|
+
|
|
172
|
+
<div class="my-5 flex items-center gap-3 text-xs text-gray-400 dark:text-gray-500">
|
|
173
|
+
<span class="h-px flex-1 bg-gray-200 dark:bg-gray-800"></span>
|
|
174
|
+
or
|
|
175
|
+
<span class="h-px flex-1 bg-gray-200 dark:bg-gray-800"></span>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<button type="button" onclick={() => void start()}
|
|
179
|
+
class="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm font-medium hover:bg-gray-50 dark:border-gray-700 dark:hover:bg-gray-800">
|
|
180
|
+
Start server
|
|
181
|
+
</button>
|
|
182
|
+
|
|
183
|
+
<template if={error}>
|
|
184
|
+
<p class="mt-4 text-center text-sm text-red-600 dark:text-red-400">{error}</p>
|
|
185
|
+
</template>
|
|
186
|
+
|
|
187
|
+
<p class="mt-8 text-center text-xs text-gray-400 dark:text-gray-500">
|
|
188
|
+
made with
|
|
189
|
+
<a href="https://github.com/briancray/abide" class="underline hover:text-gray-600 dark:hover:text-gray-300">abide</a>
|
|
190
|
+
</p>
|
|
191
|
+
</div>
|
|
192
|
+
</main>
|
|
193
|
+
</template>
|
|
194
|
+
</template>
|
|
195
|
+
|
|
196
|
+
<template if={showConfig}>
|
|
197
|
+
<div class="fixed inset-0 z-10 flex items-center justify-center bg-black/40 p-6 text-gray-900 dark:text-gray-100">
|
|
198
|
+
<div class="w-full max-w-sm rounded-2xl bg-white p-8 shadow-lg ring-1 ring-gray-200 dark:bg-gray-900 dark:ring-gray-800">
|
|
199
|
+
<h2 class="mb-5 text-lg font-semibold tracking-tight">Set up {heading}</h2>
|
|
200
|
+
|
|
201
|
+
<form class="flex flex-col gap-4" onsubmit={(event) => { event.preventDefault(); void saveConfig() }}>
|
|
202
|
+
<template each={configFields} as="field" key="field.key">
|
|
203
|
+
<label class="flex flex-col gap-1 text-sm">
|
|
204
|
+
<span class="font-medium">{field.label}</span>
|
|
205
|
+
<template if={field.inputType === 'checkbox'}>
|
|
206
|
+
<input type="checkbox" onchange={(event) => { configValues[field.key] = event.currentTarget.checked ? 'true' : 'false' }}
|
|
207
|
+
class="mt-1 size-4 self-start rounded border-gray-300 dark:border-gray-700">
|
|
208
|
+
<template else>
|
|
209
|
+
<input type={field.inputType} value={configValues[field.key]} oninput={(event) => { configValues[field.key] = event.currentTarget.value }}
|
|
210
|
+
class="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm outline-none focus:border-gray-900 focus:ring-1 focus:ring-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:focus:border-gray-100 dark:focus:ring-gray-100">
|
|
211
|
+
</template>
|
|
212
|
+
</template>
|
|
213
|
+
<template if={field.description}>
|
|
214
|
+
<span class="text-xs text-gray-400 dark:text-gray-500">{field.description}</span>
|
|
215
|
+
</template>
|
|
216
|
+
</label>
|
|
217
|
+
</template>
|
|
218
|
+
|
|
219
|
+
<div class="mt-1 flex gap-3">
|
|
220
|
+
<button type="button" onclick={() => { showConfig = false }}
|
|
221
|
+
class="flex-1 rounded-lg border border-gray-300 px-3 py-2 text-sm font-medium hover:bg-gray-50 dark:border-gray-700 dark:hover:bg-gray-800">
|
|
222
|
+
Cancel
|
|
223
|
+
</button>
|
|
224
|
+
<button type="submit"
|
|
225
|
+
class="flex-1 rounded-lg bg-gray-900 px-3 py-2 text-sm font-medium text-white hover:bg-gray-700 disabled:opacity-60 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-300">
|
|
226
|
+
Save & start
|
|
227
|
+
</button>
|
|
228
|
+
</div>
|
|
229
|
+
</form>
|
|
230
|
+
|
|
231
|
+
<template if={error}>
|
|
232
|
+
<p class="mt-4 text-center text-sm text-red-600 dark:text-red-400">{error}</p>
|
|
233
|
+
</template>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Tailwind entry for the bundle connect screen. `@import "tailwindcss"` pulls the
|
|
3
|
+
engine in; the explicit `@source` guarantees the default component is scanned for
|
|
4
|
+
utility classes even if automatic source detection misses it. bun-plugin-tailwind
|
|
5
|
+
compiles this at build time; buildDisconnected inlines the result into the served
|
|
6
|
+
HTML so the screen needs zero external requests.
|
|
7
|
+
*/
|
|
8
|
+
@import 'tailwindcss';
|
|
9
|
+
@source './disconnected.abide';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { buildWebviewLib } from './buildWebviewLib.ts'
|
|
2
|
+
import { resolveWebviewLib } from './resolveWebviewLib.ts'
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
Build-time guarantee that a webview library exists, returning its path.
|
|
6
|
+
Tries plain resolution first (an explicit ABIDE_WEBVIEW_LIB, a bundle-local
|
|
7
|
+
copy, or a previously built cache); on a miss it compiles the vendored
|
|
8
|
+
header for the host (buildWebviewLib) and caches the result.
|
|
9
|
+
|
|
10
|
+
Used by `abide bundle` (bundleApp), which runs under bun on a developer's
|
|
11
|
+
machine — never by the compiled launcher, which only ever resolves the copy
|
|
12
|
+
shipped beside it and must not invoke a compiler on an end user's machine.
|
|
13
|
+
*/
|
|
14
|
+
export async function ensureWebviewLib(cwd: string = process.cwd()): Promise<string> {
|
|
15
|
+
try {
|
|
16
|
+
return await resolveWebviewLib(cwd)
|
|
17
|
+
} catch {
|
|
18
|
+
return await buildWebviewLib()
|
|
19
|
+
}
|
|
20
|
+
}
|