Skip to content

Commit c1ddbd7

Browse files
1 parent 30a15c6 commit c1ddbd7

27 files changed

Lines changed: 73 additions & 1076 deletions

Source/Effect/Sandbox/Layer/SandboxLive.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ const SandboxLive = Layer.effect(
6565
// Now check for window.vscode
6666
const vscode = (window as any).vscode;
6767
if (vscode) {
68-
console.log(
69-
"[Sandbox] Preload globals and window.vscode ready",
70-
);
7168
return vscode;
7269
}
7370
}

Source/Effect/Telemetry/Layer/TelemetryLive.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ const TelemetryLive = Layer.effect(
8787
},
8888
].slice(-10000),
8989
);
90-
91-
console.log(`[Telemetry] Metric: ${name} = ${value}`);
9290
});
9391

9492
// Atom: Start a span
@@ -141,10 +139,6 @@ const TelemetryLive = Layer.effect(
141139
},
142140
].slice(-10000),
143141
);
144-
145-
console.log(
146-
`[Telemetry] Span: ${name} completed in ${span.duration}ms (success: ${success})`,
147-
);
148142
});
149143

150144
return { end };
@@ -176,19 +170,10 @@ const TelemetryLive = Layer.effect(
176170
].slice(-10000),
177171
);
178172

179-
// Also log to console
180-
const consoleMethod =
181-
level === "error"
182-
? console.error
183-
: level === "warn"
184-
? console.warn
185-
: level === "debug"
186-
? console.debug
187-
: console.log;
188-
consoleMethod(
189-
`[Telemetry] [${level.toUpperCase()}] ${message}`,
190-
context ?? {},
191-
);
173+
// Trace via performance.mark — OTELBridge collects automatically
174+
if (typeof performance !== "undefined") {
175+
try { performance.mark(`land:telemetry:${level}:${message.slice(0, 80)}`); } catch {}
176+
}
192177
});
193178

194179
// Stream of all events - use SubscriptionRef.changes
Lines changed: 13 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
/**
22
* @module Function/Install/Function/Install
3-
* @description
4-
* Main entry point for Wind polyfill installation.
5-
* Creates and attaches Electron API shims to window.vscode that Electron workbench expects.
63
*
7-
* @responsibilities
8-
* - Validates window context and prevents double initialization
9-
* - Creates VSCode-compatible globals with proper typing
10-
* - Handles Mountain backend communication with graceful degradation
11-
* - Implements Electron-like IPC subsystem with Tauri
12-
* - Provides comprehensive error handling and cleanup
4+
* Main entry point for Wind polyfill installation.
5+
* Creates and attaches Electron API shims to window.vscode.
136
*
14-
* @see {@link Function/Install/Function/ResolveConfiguration} Configuration resolver
15-
* @see {@link Function/Install/Function/CreateIPCRenderer} IPC renderer factory
16-
* @see {@link Function/Install/Function/CreateProcess} Process factory
17-
* @category Function
7+
* Zero console.* output. Dev tracing via performance.mark().
188
*/
199

2010
import type { IMainWindowSandboxGlobals } from "@codeeditorland/output/vs/base/parts/sandbox/electron-browser/globals";
@@ -24,21 +14,14 @@ import { CreateProcess } from "./CreateProcess.js";
2414
import { Fallback } from "./Fallback.js";
2515
import { ResolveConfiguration } from "./ResolveConfiguration.js";
2616

27-
/**
28-
* Main Wind preload installation function
29-
*/
17+
const _Trace = (Message: string): void => {
18+
try { performance.mark(`land:install:${Message}`); } catch {}
19+
};
20+
3021
export default async function Install(): Promise<void> {
3122
try {
32-
// Validate window context
33-
if (typeof window === "undefined") {
34-
const error = new Error(
35-
"Cannot install Wind polyfill: window is not defined",
36-
);
37-
console.error(error);
38-
return;
39-
}
23+
if (typeof window === "undefined") return;
4024

41-
// Prevent double initialization
4225
if (
4326
(window as unknown as { polyfillInstalled?: boolean })
4427
.polyfillInstalled
@@ -49,25 +32,20 @@ export default async function Install(): Promise<void> {
4932
window as unknown as { polyfillInstalled: boolean }
5033
).polyfillInstalled = true;
5134

52-
console.log("[Wind] Starting Wind preload installation...");
35+
_Trace("start");
5336

54-
// Initialize core components
5537
const Configuration = await ResolveConfiguration();
5638
const IPCRenderer = CreateIPCRenderer();
5739
const Process = CreateProcess(Configuration);
5840

59-
// Create preload globals object that will be enhanced by Effect-TS
6041
const preloadGlobals = {
6142
ipcRenderer: IPCRenderer,
6243
process: Process,
6344
configuration: Configuration,
6445
};
6546

66-
// Attach preloadGlobals to window for Effect-TS services to access
6747
(window as any).preloadGlobals = preloadGlobals;
68-
console.log("[Wind] preloadGlobals attached to window");
6948

70-
// Construct compliant VSCode API object
7149
const Globals: IMainWindowSandboxGlobals = {
7250
ipcRenderer: IPCRenderer,
7351
process: Process,
@@ -79,13 +57,8 @@ export default async function Install(): Promise<void> {
7957
webUtils: { getPathForFile: (file: File) => file.name },
8058
ipcMessagePort: {
8159
acquire: (ResponseChannel: string, Nonce: string) => {
82-
console.log(
83-
`[Wind] MessagePort acquire: ${ResponseChannel}, nonce=${Nonce}`,
84-
);
60+
_Trace(`acquire:${ResponseChannel}`);
8561

86-
// Only do the extension host handshake for the ext host channel.
87-
// Other acquires (utility process workers, file watchers) get a
88-
// port but no protocol — their stubs never resolve, so no crash.
8962
const IsExtensionHost = ResponseChannel.includes(
9063
"startExtensionHostMessagePortResult",
9164
);
@@ -107,34 +80,23 @@ export default async function Install(): Promise<void> {
10780
: 0;
10881
if (Length > 1) {
10982
Done = true;
110-
console.log(
111-
"[Wind] Extension host: received init data, sending Initialized",
112-
);
11383
port1.postMessage(new Uint8Array([1]));
11484
}
11585
};
11686
setTimeout(() => {
117-
console.log(
118-
"[Wind] Extension host: sending Ready",
119-
);
12087
port1.postMessage(new Uint8Array([2]));
12188
}, 50);
12289
}
12390
},
12491
},
12592
};
12693

127-
// Attach to window
12894
(window as any).vscode = Globals;
129-
console.info(
130-
"[Wind] Successfully installed Electron API polyfill for workbench.",
131-
);
132-
133-
// Signal that preload is ready for Effect-TS bootstrap
13495
(window as any).__WIND_PRELOAD_READY__ = true;
135-
console.log("[Wind] Preload ready, Effect-TS bootstrap can proceed");
96+
97+
_Trace("done");
13698
} catch (error: unknown) {
137-
console.error(`[Wind] Install error:`, error);
99+
try { performance.mark(`land:install:error`); } catch {}
138100
Fallback();
139101
}
140102
}

Source/Function/Install/Function/ResolveConfiguration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
import type { ISandboxConfiguration } from "@codeeditorland/output/vs/base/parts/sandbox/common/sandboxTypes";
1212

13-
import DevLog from "../../DevLog.js";
13+
const DevLog = (Tag: string, ..._Args: unknown[]): void => {
14+
try { performance.mark(`land:config:${Tag}`); } catch {}
15+
};
1416

1517
/**
1618
* Resolves the VSCode sandbox configuration.
@@ -46,10 +48,8 @@ export async function ResolveConfiguration(): Promise<ISandboxConfiguration> {
4648
DevLog("config", "paths:", JSON.stringify(Paths));
4749

4850
// Pass LAND_DEV_LOG from Mountain environment to browser.
49-
// The Tauri IPC returns the env var; set it on window so DevLog picks it up.
5051
if ((Paths as any).devLog) {
5152
(window as any).__LAND_DEV_LOG = (Paths as any).devLog;
52-
DevLog.reset();
5353
}
5454

5555
// Read ?folder= from URL (set by pickFolderAndOpen navigation)

0 commit comments

Comments
 (0)