Skip to content

Commit 61bbf7c

Browse files
1 parent 87ffc66 commit 61bbf7c

10 files changed

Lines changed: 56 additions & 327 deletions

File tree

Source/Workbench/BrowserProxy/Bootstrap.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,25 @@ interface BootstrapResult {
1818
error?: unknown;
1919
}
2020

21-
console.log("[BrowserProxy] ===== Starting Wind Effect-TS bootstrap =====");
22-
2321
try {
2422
const { runBootstrap } =
2523
await import("@codeeditorland/wind/Target/Effect/Bootstrap");
2624

27-
console.log("[BrowserProxy] ✓ Bootstrap module loaded successfully");
28-
2925
// Run the bootstrap with options
3026
const bootstrapResult: BootstrapResult = await runBootstrap({
3127
skipHealthCheck: false,
3228
debugMode: true,
3329
});
3430

3531
if (bootstrapResult.success) {
36-
console.log("[BrowserProxy] ✓ Bootstrap completed successfully");
37-
console.log(
38-
"[BrowserProxy] - Total duration:",
39-
bootstrapResult.totalDuration,
40-
"ms",
41-
);
4232

4333
// Log individual stage results
4434
bootstrapResult.stages.forEach(function (stage: BootstrapStage) {
4535
const status = stage.success ? "✓" : "✗";
46-
console.log(
47-
`[BrowserProxy] - ${status} ${stage.stageName}: ${stage.duration}ms`,
48-
);
4936
});
5037
} else {
51-
console.error(
52-
"[BrowserProxy] ✗ Bootstrap failed:",
53-
bootstrapResult.error,
54-
);
5538
}
5639
} catch (error: unknown) {
57-
console.error("[BrowserProxy] ✗ Failed to load/run bootstrap:", error);
5840
}
5941

60-
console.log("[BrowserProxy] ===== Wind bootstrap sequence complete =====");
61-
6242
export default {};

Source/Workbench/BrowserProxy/ServicesProxy.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,11 @@
55
* VSCode API calls and routes them through Mountain services.
66
*/
77

8-
console.log("[BrowserProxy] ===== Initializing Mountain services proxy =====");
9-
console.log(
10-
"[BrowserProxy] This approach uses a proxy layer to intercept VSCode API calls",
11-
);
12-
console.log("[BrowserProxy] and route them through Mountain services.");
13-
148
// Initialize the services proxy
159
try {
1610
// The services proxy will intercept window.vscode API calls
1711
// and forward them to Mountain services via IPC
18-
console.log("[BrowserProxy] ✓ Services proxy initialized");
19-
console.log(
20-
"[BrowserProxy] - Proxied APIs: ipcRenderer, process, shell, clipboard, etc.",
21-
);
22-
console.log("[BrowserProxy] - Proxy target: Mountain services");
2312
} catch (error: unknown) {
24-
console.error(
25-
"[BrowserProxy] ✗ Failed to initialize services proxy:",
26-
error,
27-
);
2813
}
2914

30-
console.log(
31-
"[BrowserProxy] ===== Services proxy initialization complete =====",
32-
);
33-
3415
export default {};

Source/Workbench/BrowserProxy/WindPreload.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,25 @@
77

88
import Install from "@codeeditorland/wind/Target/Function/Install";
99

10-
console.log("[BrowserProxy] ===== Starting Wind preload installation =====");
11-
console.log("[BrowserProxy] Workbench: Browser Proxy (A1)");
12-
console.log(
13-
"[BrowserProxy] Approach: Browser workbench + Mountain services proxy",
14-
);
15-
1610
// Install the Wind preload polyfill (window.vscode globals)
1711
Install()
1812
.then(() => {
19-
console.log("[BrowserProxy] ✓ Wind preload installed successfully");
2013

2114
// Verify preloadGlobals is available
2215
if (window.preloadGlobals && window.preloadGlobals.process) {
23-
console.log("[BrowserProxy] ✓ preloadGlobals.process is available");
2416
const process = window.preloadGlobals.process;
25-
console.log("[BrowserProxy] - Platform:", process.platform);
26-
console.log("[BrowserProxy] - Arch:", process.arch);
27-
console.log("[BrowserProxy] - Type:", process.type);
2817
} else {
29-
console.warn(
30-
"[BrowserProxy] ⚠ preloadGlobals.process not available",
31-
);
3218
}
3319

3420
// Verify window.vscode is available
3521
if (window.vscode) {
36-
console.log("[BrowserProxy] ✓ window.vscode is available");
3722
} else {
38-
console.error("[BrowserProxy] ✗ window.vscode not available");
3923
}
4024

4125
// Verify Wind preload ready flag
4226
if (window.__WIND_PRELOAD_READY__) {
43-
console.log("[BrowserProxy] ✓ Wind preload ready flag is set");
4427
} else {
45-
console.warn("[BrowserProxy] ⚠ Wind preload ready flag is not set");
4628
}
47-
48-
console.log(
49-
"[BrowserProxy] ===== Wind preload installation complete =====",
50-
);
5129
})
5230
.catch((error: unknown) => {
53-
console.error("[BrowserProxy] ✗ Wind preload install error:", error);
5431
});

Source/Workbench/BrowserProxy/Workbench.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,19 @@ interface MountainProxyWindow extends Window {
99
__MOUNTAIN_PROXY__?: unknown;
1010
}
1111

12-
console.log("[BrowserProxy] ===== Loading browser VSCode workbench =====");
13-
1412
try {
1513
// Variable URL: Rollup only analyzes string literals — an identifier
1614
// reference is treated as truly dynamic and never resolved at build time.
1715
const WorkbenchUrl = "/vs/code/browser/workbench/workbench.js";
1816
await import(WorkbenchUrl);
1917

20-
console.log(
21-
"[BrowserProxy] ✓ Browser workbench script loaded successfully",
22-
);
23-
console.log("[BrowserProxy] ===== Workbench load complete =====");
24-
2518
// Log initial state after workbench load
2619
setTimeout(async () => {
27-
console.log("[BrowserProxy] ===== Post-workbench load state =====");
2820
const mountainProxy = (window as MountainProxyWindow)[
2921
"__MOUNTAIN_PROXY__"
3022
];
31-
console.log(
32-
"[BrowserProxy] Services proxy active:",
33-
typeof mountainProxy !== "undefined",
34-
);
3523
}, 2000);
3624
} catch (error: unknown) {
37-
console.error("[BrowserProxy] ✗ Failed to load browser workbench:", error);
3825
}
3926

40-
console.log("[BrowserProxy] ===== Workbench load sequence complete =====");
41-
4227
export default {};
Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* Effect-TS bootstrap script for Electron workbench (A3)
3-
*
4-
* runBootstrap() returns an Effect, not a Promise.
5-
* Must be executed via Effect.runPromise().
2+
* Effect-TS bootstrap for Electron workbench (A3).
3+
* Zero console.* output. Results captured via performance.mark().
64
*/
75

86
interface BootstrapStage {
@@ -18,48 +16,30 @@ interface BootstrapResult {
1816
error?: unknown;
1917
}
2018

21-
console.log("[Electron] ===== Starting Wind Effect-TS bootstrap =====");
22-
2319
try {
20+
performance.mark("land:bootstrap:start");
21+
2422
const { runBootstrap } =
2523
await import("@codeeditorland/wind/Target/Effect/Bootstrap");
2624
const { Effect } = await import("effect");
2725

28-
console.log("[Electron] Bootstrap module loaded successfully");
29-
30-
// runBootstrap returns an Effect — run it via Effect.runPromise.
31-
// skipHealthCheck: true because the minimal layer (TelemetryLive only)
32-
// doesn't provide HealthTag, EnvironmentTag, etc. Individual stages
33-
// catch their own errors gracefully.
3426
const BootstrapResult: BootstrapResult = await Effect.runPromise(
3527
runBootstrap({
3628
skipHealthCheck: true,
3729
debugMode: true,
3830
}),
3931
);
4032

41-
if (BootstrapResult.success) {
42-
console.log("[Electron] Bootstrap completed successfully");
43-
console.log(
44-
"[Electron] - Total duration:",
45-
BootstrapResult.totalDuration,
46-
"ms",
47-
);
48-
49-
// Log individual stage results
50-
BootstrapResult.stages.forEach((Stage: BootstrapStage) => {
51-
const Status = Stage.success ? "OK" : "FAIL";
52-
console.log(
53-
`[Electron] - ${Status} ${Stage.stageName}: ${Stage.duration}ms`,
54-
);
55-
});
56-
} else {
57-
console.error("[Electron] Bootstrap failed:", BootstrapResult.error);
58-
}
59-
} catch (Error: unknown) {
60-
console.error("[Electron] Failed to load/run bootstrap:", Error);
33+
performance.mark("land:bootstrap:done", {
34+
detail: {
35+
success: BootstrapResult.success,
36+
duration: BootstrapResult.totalDuration,
37+
stages: BootstrapResult.stages.map((S: BootstrapStage) => `${S.stageName}:${S.success ? "ok" : "fail"}:${S.duration}ms`),
38+
},
39+
});
40+
performance.measure("land:bootstrap", "land:bootstrap:start", "land:bootstrap:done");
41+
} catch {
42+
performance.mark("land:bootstrap:error");
6143
}
6244

63-
console.log("[Electron] ===== Wind bootstrap sequence complete =====");
64-
6545
export default {};

Source/Workbench/Electron/Layout.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import NLS from "../NLS.astro";
2020

2121
<!-- Sequential: Preload → Polyfills → Bootstrap → Workbench -->
2222
<script type="module">
23+
// 0. OTEL Bridge — PerformanceObserver for land:* marks → OTLP/HTTP
24+
// Build-baked: included in dev, tree-shaken in prod.
25+
// Catches all marks (buffered:true) including those from steps 1-4.
26+
import "./OTELBridge.js";
27+
2328
// 1. Wind Preload — must complete first (sets window.vscode)
2429
await import("./WindPreload.js");
2530

Source/Workbench/Electron/Polyfills.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,28 @@
1212
* 7. SharedProcessProxy - Shared process communication
1313
*/
1414

15-
console.log("[Electron] ===== Loading Electron API polyfills =====");
16-
console.log("[Electron] Loading 7 polyfills to make browser act like Electron");
17-
1815
try {
1916
// 1. Process Polyfill - Node.js process object
2017
await import("@codeeditorland/wind/Target/Polyfills/ProcessPolyfill");
21-
console.log("[Electron] ✓ ProcessPolyfill loaded");
2218

2319
// 2. File Protocol Shim - vscode-file:// protocol handling
2420
await import("@codeeditorland/wind/Target/Polyfills/FileProtocolShim");
25-
console.log("[Electron] ✓ FileProtocolShim loaded");
2621

2722
// 3. File System Polyfill - fs module
2823
await import("@codeeditorland/wind/Target/Polyfills/FileSystemPolyfill");
29-
console.log("[Electron] ✓ FileSystemPolyfill loaded");
3024

3125
// 4. IPC Renderer Shim - Electron IPC communication
3226
await import("@codeeditorland/wind/Target/Polyfills/IPCRendererShim");
33-
console.log("[Electron] ✓ IPCRendererShim loaded");
3427

3528
// 5. Child Process Polyfill - child_process module
3629
await import("@codeeditorland/wind/Target/Polyfills/ChildProcessPolyfill");
37-
console.log("[Electron] ✓ ChildProcessPolyfill loaded");
3830

3931
// 6. Native Module Polyfill - native module loading
4032
await import("@codeeditorland/wind/Target/Polyfills/NativeModulePolyfill");
41-
console.log("[Electron] ✓ NativeModulePolyfill loaded");
4233

4334
// 7. Shared Process Proxy - Shared process communication
4435
await import("@codeeditorland/wind/Target/Polyfills/SharedProcessProxy");
45-
console.log("[Electron] ✓ SharedProcessProxy loaded");
46-
47-
console.log(
48-
"[Electron] ===== All 7 Electron API polyfills loaded successfully =====",
49-
);
5036
} catch (error: unknown) {
51-
console.error("[Electron] ✗ Failed to load polyfills:", error);
52-
console.error("[Electron] This may cause Electron workbench to fail");
5337
}
5438

5539
export default {};
Lines changed: 7 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,15 @@
11
/**
2-
* electron-wind-preload.ts - Wind preload installation script for Electron
3-
*
4-
* This script installs the Wind preload polyfill which provides VSCode-compatible
5-
* globals (window.vscode, window.preloadGlobals) for the Electron workbench.
2+
* Wind preload installation for Electron workbench (A3).
3+
* Zero console.* output. Tracing via performance.mark().
64
*/
75

86
import Install from "@codeeditorland/wind/Target/Function/Install";
97

10-
// Initialize LAND_DEV_LOG from localStorage (persistent) or URL param (?devlog=config,vfs)
11-
// Can also be set at runtime: window.__LAND_DEV_LOG = "all"
12-
{
13-
const Stored = localStorage.getItem("LAND_DEV_LOG");
14-
const UrlParam = new URLSearchParams(window.location.search).get("devlog");
15-
const Value = UrlParam ?? Stored ?? "";
16-
if (Value) {
17-
(window as any).__LAND_DEV_LOG = Value;
18-
console.log(
19-
`[DevLog] Enabled tags: ${Value} (source: ${UrlParam ? "url" : "localStorage"})`,
20-
);
21-
}
22-
}
23-
24-
console.log("[Electron] ===== Starting Wind preload installation =====");
25-
26-
console.log("[Electron] Workbench: Electron (A3)");
27-
28-
console.log(
29-
"[Electron] Approach: Electron workbench + complete Electron API polyfills",
30-
);
31-
32-
// Install the Wind preload polyfill (window.vscode globals).
33-
// Top-level await ensures Install() completes before Layout.astro
34-
// proceeds to Polyfills.js — the .then() chain was fire-and-forget.
358
try {
9+
performance.mark("land:preload:start");
3610
await Install();
37-
38-
console.log("[Electron] Wind preload installed successfully");
39-
40-
if (window.preloadGlobals?.process) {
41-
const Process = window.preloadGlobals.process;
42-
43-
console.log(
44-
"[Electron] preloadGlobals.process:",
45-
Process.platform,
46-
Process.arch,
47-
Process.type,
48-
);
49-
} else {
50-
console.warn("[Electron] preloadGlobals.process not available");
51-
}
52-
53-
if (window.vscode) {
54-
console.log(
55-
"[Electron] window.vscode: ipcRenderer=%s process=%s context=%s",
56-
typeof window.vscode.ipcRenderer,
57-
typeof window.vscode.process,
58-
typeof window.vscode.context,
59-
);
60-
} else {
61-
console.error("[Electron] window.vscode not available");
62-
}
63-
64-
if (!window.__WIND_PRELOAD_READY__) {
65-
console.warn("[Electron] __WIND_PRELOAD_READY__ flag not set");
66-
}
67-
68-
console.log("[Electron] ===== Wind preload installation complete =====");
69-
} catch (Error: unknown) {
70-
console.error("[Electron] Wind preload install error:", Error);
71-
72-
if (Error instanceof globalThis.Error && Error.stack) {
73-
console.error(Error.stack);
74-
}
11+
performance.mark("land:preload:done");
12+
performance.measure("land:preload", "land:preload:start", "land:preload:done");
13+
} catch {
14+
performance.mark("land:preload:error");
7515
}

0 commit comments

Comments
 (0)