Skip to content

Commit 3b97084

Browse files
authored
fix tsunami scaffold in build (#2564)
1 parent 1a190da commit 3b97084

20 files changed

Lines changed: 145 additions & 129 deletions

File tree

Taskfile.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ tasks:
536536
- mkdir -p scaffold
537537
- cp ../templates/package.json.tmpl scaffold/package.json
538538
- cd scaffold && npm install
539+
- mv scaffold/node_modules scaffold/nm
539540
- cp -r dist scaffold/
540541
- mkdir -p scaffold/dist/tw
541542
- cp ../templates/app-main.go.tmpl scaffold/app-main.go
@@ -556,6 +557,7 @@ tasks:
556557
- powershell New-Item -ItemType Directory -Force -Path scaffold
557558
- powershell Copy-Item -Path ../templates/package.json.tmpl -Destination scaffold/package.json
558559
- powershell -Command "Set-Location scaffold; npm install"
560+
- powershell Move-Item -Path scaffold/node_modules -Destination scaffold/nm
559561
- powershell Copy-Item -Recurse -Force -Path dist -Destination scaffold/
560562
- powershell New-Item -ItemType Directory -Force -Path scaffold/dist/tw
561563
- powershell Copy-Item -Path ../templates/app-main.go.tmpl -Destination scaffold/app-main.go

docs/docs/releasenotes.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Patch release with Wave AI model upgrade, new secret management features, and im
1212

1313
**Wave AI Updates:**
1414
- **GPT-5.1 Model** - Upgraded to use OpenAI's GPT-5.1 model for improved responses
15+
- **Thinking Mode Toggle** - New dropdown to select between Quick, Balanced, and Deep thinking modes for optimal response quality vs speed
1516
- [bugfix] Fixed path mismatch issue when restoring AI write file backups
1617

1718
**New Features:**

electron-builder.config.cjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const config = {
2222
{
2323
from: "./dist",
2424
to: "./dist",
25-
filter: ["**/*", "!bin/*", "bin/wavesrv.${arch}*", "bin/wsh*"],
25+
filter: ["**/*", "!bin/*", "bin/wavesrv.${arch}*", "bin/wsh*", "!tsunamiscaffold/**/*"],
2626
},
2727
{
2828
from: ".",
@@ -31,13 +31,18 @@ const config = {
3131
},
3232
"!node_modules", // We don't need electron-builder to package in Node modules as Vite has already bundled any code that our program is using.
3333
],
34+
extraResources: [
35+
{
36+
from: "dist/tsunamiscaffold",
37+
to: "tsunamiscaffold",
38+
},
39+
],
3440
directories: {
3541
output: "make",
3642
},
3743
asarUnpack: [
3844
"dist/bin/**/*", // wavesrv and wsh binaries
3945
"dist/schema/**/*", // schema files for Monaco editor
40-
"dist/tsunamiscaffold/**/*", // tsunami scaffold files
4146
],
4247
mac: {
4348
target: [

emain/emain-menu.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function makeEditMenu(): Electron.MenuItemConstructorOptions[] {
110110
];
111111
}
112112

113-
function makeFileMenu(numWaveWindows: number, callbacks: AppMenuCallbacks): Electron.MenuItemConstructorOptions[] {
113+
function makeFileMenu(numWaveWindows: number, callbacks: AppMenuCallbacks, fullConfig: FullConfigType): Electron.MenuItemConstructorOptions[] {
114114
const fileMenu: Electron.MenuItemConstructorOptions[] = [
115115
{
116116
label: "New Window",
@@ -125,7 +125,8 @@ function makeFileMenu(numWaveWindows: number, callbacks: AppMenuCallbacks): Elec
125125
},
126126
},
127127
];
128-
if (isDev) {
128+
const featureWaveAppBuilder = fullConfig?.settings?.["feature:waveappbuilder"];
129+
if (isDev || featureWaveAppBuilder) {
129130
fileMenu.splice(1, 0, {
130131
label: "New WaveApp Builder Window",
131132
accelerator: unamePlatform === "darwin" ? "Command+Shift+B" : "Alt+Shift+B",
@@ -310,18 +311,19 @@ function makeViewMenu(
310311
async function makeFullAppMenu(callbacks: AppMenuCallbacks, workspaceOrBuilderId?: string): Promise<Electron.Menu> {
311312
const numWaveWindows = getAllWaveWindows().length;
312313
const webContents = workspaceOrBuilderId && getWebContentsByWorkspaceOrBuilderId(workspaceOrBuilderId);
313-
const fileMenu = makeFileMenu(numWaveWindows, callbacks);
314314
const appMenuItems = makeAppMenuItems(webContents);
315315
const editMenu = makeEditMenu();
316316

317317
const isBuilderWindowFocused = focusedBuilderWindow != null;
318318
let fullscreenOnLaunch = false;
319+
let fullConfig: FullConfigType = null;
319320
try {
320-
const fullConfig = await RpcApi.GetFullConfigCommand(ElectronWshClient);
321+
fullConfig = await RpcApi.GetFullConfigCommand(ElectronWshClient);
321322
fullscreenOnLaunch = fullConfig?.settings["window:fullscreenonlaunch"];
322323
} catch (e) {
323-
console.error("Error fetching fullscreen launch config:", e);
324+
console.error("Error fetching config:", e);
324325
}
326+
const fileMenu = makeFileMenu(numWaveWindows, callbacks, fullConfig);
325327
const viewMenu = makeViewMenu(webContents, callbacks, isBuilderWindowFocused, fullscreenOnLaunch);
326328
let workspaceMenu: Electron.MenuItemConstructorOptions[] = null;
327329
try {

emain/emain-platform.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,22 @@ function getWaveDataDir(): string {
149149
}
150150

151151
function getElectronAppBasePath(): string {
152+
// import.meta.dirname in dev points to waveterm/dist/main
152153
return path.dirname(import.meta.dirname);
153154
}
154155

155156
function getElectronAppUnpackedBasePath(): string {
156157
return getElectronAppBasePath().replace("app.asar", "app.asar.unpacked");
157158
}
158159

160+
function getElectronAppResourcesPath(): string {
161+
if (isDev) {
162+
// import.meta.dirname in dev points to waveterm/dist/main
163+
return path.dirname(import.meta.dirname);
164+
}
165+
return process.resourcesPath;
166+
}
167+
159168
const wavesrvBinName = `wavesrv.${unameArch}`;
160169

161170
function getWaveSrvPath(): string {
@@ -261,6 +270,7 @@ export {
261270
callWithOriginalXdgCurrentDesktop,
262271
callWithOriginalXdgCurrentDesktopAsync,
263272
getElectronAppBasePath,
273+
getElectronAppResourcesPath,
264274
getElectronAppUnpackedBasePath,
265275
getWaveConfigDir,
266276
getWaveDataDir,

emain/emain-util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as electron from "electron";
55
import { getWebServerEndpoint } from "../frontend/util/endpoints";
66

77
export const WaveAppPathVarName = "WAVETERM_APP_PATH";
8+
export const WaveAppResourcesPathVarName = "WAVETERM_RESOURCES_PATH";
89
export const WaveAppElectronExecPath = "WAVETERM_ELECTRONEXECPATH";
910

1011
export function getElectronExecPath(): string {

emain/emain-wavesrv.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { WebServerEndpointVarName, WSServerEndpointVarName } from "../frontend/u
88
import { AuthKey, WaveAuthKeyEnv } from "./authkey";
99
import { setForceQuit } from "./emain-activity";
1010
import {
11+
getElectronAppResourcesPath,
1112
getElectronAppUnpackedBasePath,
1213
getWaveConfigDir,
1314
getWaveDataDir,
@@ -17,7 +18,12 @@ import {
1718
WaveConfigHomeVarName,
1819
WaveDataHomeVarName,
1920
} from "./emain-platform";
20-
import { getElectronExecPath, WaveAppElectronExecPath, WaveAppPathVarName } from "./emain-util";
21+
import {
22+
getElectronExecPath,
23+
WaveAppElectronExecPath,
24+
WaveAppPathVarName,
25+
WaveAppResourcesPathVarName,
26+
} from "./emain-util";
2127
import { updater } from "./updater";
2228

2329
let isWaveSrvDead = false;
@@ -59,6 +65,7 @@ export function runWaveSrv(handleWSEvent: (evtMsg: WSEventType) => void): Promis
5965
envCopy["XDG_CURRENT_DESKTOP"] = xdgCurrentDesktop;
6066
}
6167
envCopy[WaveAppPathVarName] = getElectronAppUnpackedBasePath();
68+
envCopy[WaveAppResourcesPathVarName] = getElectronAppResourcesPath();
6269
envCopy[WaveAppElectronExecPath] = getElectronExecPath();
6370
envCopy[WaveAuthKeyEnv] = AuthKey;
6471
envCopy[WaveDataHomeVarName] = getWaveDataDir();

frontend/app/view/tsunami/tsunami.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,8 @@ class TsunamiViewModel extends WebViewModel {
6262
oref: WOS.makeORef("block", blockId),
6363
});
6464
initialRTInfo.then((rtInfo) => {
65-
if (rtInfo) {
66-
const meta: AppMeta = {
67-
title: rtInfo["tsunami:title"],
68-
shortdesc: rtInfo["tsunami:shortdesc"],
69-
icon: rtInfo["tsunami:icon"],
70-
iconcolor: rtInfo["tsunami:iconcolor"],
71-
};
72-
globalStore.set(this.appMeta, meta);
65+
if (rtInfo && rtInfo["tsunami:appmeta"]) {
66+
globalStore.set(this.appMeta, rtInfo["tsunami:appmeta"]);
7367
}
7468
});
7569
this.appMetaUnsubFn = waveEventSubscribe({

frontend/app/workspace/widgets.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ const Widgets = memo(() => {
229229
magnified: true,
230230
};
231231
const showHelp = fullConfig?.settings?.["widget:showhelp"] ?? true;
232+
const featureWaveAppBuilder = fullConfig?.settings?.["feature:waveappbuilder"] ?? false;
232233
const widgetsMap = fullConfig?.widgets ?? {};
233234
const filteredWidgets = hasCustomAIPresets
234235
? widgetsMap
@@ -342,9 +343,9 @@ const Widgets = memo(() => {
342343
))}
343344
</div>
344345
<div className="flex-grow" />
345-
{isDev() || showHelp ? (
346+
{isDev() || featureWaveAppBuilder || showHelp ? (
346347
<div className="grid grid-cols-2 gap-0 w-full">
347-
{isDev() ? (
348+
{isDev() || featureWaveAppBuilder ? (
348349
<div
349350
ref={appsButtonRef}
350351
className="flex flex-col justify-center items-center w-full py-1.5 pr-0.5 text-secondary text-sm overflow-hidden rounded-sm hover:bg-hoverbg hover:text-white cursor-pointer"
@@ -372,7 +373,7 @@ const Widgets = memo(() => {
372373
<Widget key={`widget-${idx}`} widget={data} mode={mode} />
373374
))}
374375
<div className="flex-grow" />
375-
{isDev() ? (
376+
{isDev() || featureWaveAppBuilder ? (
376377
<div
377378
ref={appsButtonRef}
378379
className="flex flex-col justify-center items-center w-full py-1.5 pr-0.5 text-secondary text-lg overflow-hidden rounded-sm hover:bg-hoverbg hover:text-white cursor-pointer"
@@ -407,7 +408,7 @@ const Widgets = memo(() => {
407408
</div>
408409
) : null}
409410
</div>
410-
{isDev() && appsButtonRef.current && (
411+
{(isDev() || featureWaveAppBuilder) && appsButtonRef.current && (
411412
<AppsFloatingWindow
412413
isOpen={isAppsOpen}
413414
onClose={() => setIsAppsOpen(false)}

frontend/types/gotypes.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -914,10 +914,7 @@ declare global {
914914

915915
// waveobj.ObjRTInfo
916916
type ObjRTInfo = {
917-
"tsunami:title"?: string;
918-
"tsunami:shortdesc"?: string;
919-
"tsunami:icon"?: string;
920-
"tsunami:iconcolor"?: string;
917+
"tsunami:appmeta"?: AppMeta;
921918
"tsunami:schemas"?: any;
922919
"shell:hascurcwd"?: boolean;
923920
"shell:state"?: string;
@@ -1030,6 +1027,7 @@ declare global {
10301027
"app:dismissarchitecturewarning"?: boolean;
10311028
"app:defaultnewblock"?: string;
10321029
"app:showoverlayblocknums"?: boolean;
1030+
"feature:waveappbuilder"?: boolean;
10331031
"ai:*"?: boolean;
10341032
"ai:preset"?: string;
10351033
"ai:apitype"?: string;

0 commit comments

Comments
 (0)