@openspecui/server 3.0.0 → 3.1.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/dist/index.mjs +10 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createServer as createServer$1 } from "node:net";
|
|
2
2
|
import { serve } from "@hono/node-server";
|
|
3
|
-
import { CliExecutor, CodeEditorThemeSchema, ConfigManager, DASHBOARD_METRIC_KEYS, DashboardConfigSchema, GitConfigSchema, OpenSpecAdapter, OpenSpecWatcher, OpsxKernel, PtyClientMessageSchema, ReactiveContext, TerminalConfigSchema, TerminalRendererEngineSchema, getAllTools, getAvailableTools, getConfiguredTools, getDefaultCliCommandString, getDetectedProjectTools, getToolInitStates, getWatcherRuntimeStatus, initWatcherPool, isWatcherPoolInitialized, sniffGlobalCli, subscribeWatcherRuntimeStatus } from "@openspecui/core";
|
|
3
|
+
import { CliExecutor, CodeEditorThemeSchema, ConfigManager, DASHBOARD_METRIC_KEYS, DashboardConfigSchema, GitConfigSchema, HOSTED_SHELL_PROTOCOL_VERSION, OpenSpecAdapter, OpenSpecWatcher, OpsxConfigSchema, OpsxKernel, PtyClientMessageSchema, ReactiveContext, TerminalConfigSchema, TerminalRendererEngineSchema, getAllTools, getAvailableTools, getConfiguredTools, getDefaultCliCommandString, getDetectedProjectTools, getToolInitStates, getWatcherRuntimeStatus, initWatcherPool, isWatcherPoolInitialized, sniffGlobalCli, subscribeWatcherRuntimeStatus } from "@openspecui/core";
|
|
4
4
|
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
|
5
5
|
import { applyWSSHandler } from "@trpc/server/adapters/ws";
|
|
6
6
|
import { Hono } from "hono";
|
|
@@ -2695,6 +2695,7 @@ const configRouter = router({
|
|
|
2695
2695
|
]).optional(),
|
|
2696
2696
|
codeEditor: z.object({ theme: CodeEditorThemeSchema.optional() }).optional(),
|
|
2697
2697
|
appBaseUrl: z.string().optional(),
|
|
2698
|
+
opsx: OpsxConfigSchema.partial().optional(),
|
|
2698
2699
|
terminal: TerminalConfigSchema.omit({ rendererEngine: true }).partial().extend({ rendererEngine: TerminalRendererEngineSchema.optional() }).optional(),
|
|
2699
2700
|
dashboard: DashboardConfigSchema.partial().optional(),
|
|
2700
2701
|
git: GitConfigSchema.partial().optional()
|
|
@@ -2703,10 +2704,11 @@ const configRouter = router({
|
|
|
2703
2704
|
const hasCliArgs = input.cli !== void 0 && Object.prototype.hasOwnProperty.call(input.cli, "args");
|
|
2704
2705
|
if (hasCliCommand && !hasCliArgs) {
|
|
2705
2706
|
await ctx.configManager.setCliCommand(input.cli?.command ?? "");
|
|
2706
|
-
if (input.theme !== void 0 || input.codeEditor !== void 0 || input.appBaseUrl !== void 0 || input.terminal !== void 0 || input.dashboard !== void 0 || input.git !== void 0) await ctx.configManager.writeConfig({
|
|
2707
|
+
if (input.theme !== void 0 || input.codeEditor !== void 0 || input.appBaseUrl !== void 0 || input.opsx !== void 0 || input.terminal !== void 0 || input.dashboard !== void 0 || input.git !== void 0) await ctx.configManager.writeConfig({
|
|
2707
2708
|
theme: input.theme,
|
|
2708
2709
|
codeEditor: input.codeEditor,
|
|
2709
2710
|
appBaseUrl: input.appBaseUrl,
|
|
2711
|
+
opsx: input.opsx,
|
|
2710
2712
|
terminal: input.terminal,
|
|
2711
2713
|
dashboard: input.dashboard,
|
|
2712
2714
|
git: input.git
|
|
@@ -3501,6 +3503,9 @@ function getServerPackageVersion() {
|
|
|
3501
3503
|
}
|
|
3502
3504
|
}
|
|
3503
3505
|
const SERVER_PACKAGE_VERSION = getServerPackageVersion();
|
|
3506
|
+
function buildEmbeddedUiUrlForPort(port) {
|
|
3507
|
+
return `http://localhost:${port}`;
|
|
3508
|
+
}
|
|
3504
3509
|
/**
|
|
3505
3510
|
* Create an OpenSpecUI HTTP server with optional WebSocket support
|
|
3506
3511
|
*/
|
|
@@ -3532,7 +3537,9 @@ function createServer(config) {
|
|
|
3532
3537
|
projectDir: config.projectDir,
|
|
3533
3538
|
projectName: basename(config.projectDir) || config.projectDir,
|
|
3534
3539
|
watcherEnabled: !!watcher,
|
|
3535
|
-
openspecuiVersion: SERVER_PACKAGE_VERSION
|
|
3540
|
+
openspecuiVersion: SERVER_PACKAGE_VERSION,
|
|
3541
|
+
hostedShellProtocolVersion: HOSTED_SHELL_PROTOCOL_VERSION,
|
|
3542
|
+
embeddedUiUrl: buildEmbeddedUiUrlForPort(config.port ?? 3100)
|
|
3536
3543
|
});
|
|
3537
3544
|
});
|
|
3538
3545
|
app.use("/trpc/*", async (c) => {
|