Skip to content

Commit a8fbda8

Browse files
authored
Windows platform support: (#16)
- Justfile: [windows] recipes for build-hyperlight, resolve-hyperlight-dir, start-debug - Justfile: runtime-cflags forward-slash fix for clang cross-compilation - build-binary.js: .cmd launcher, platform-aware post-build output - plugins: O_NOFOLLOW fallback (Windows lacks O_NOFOLLOW, relies on lstat pre-check) - agent/index.ts: pathToFileURL for ESM plugin imports on Windows - build.rs: forward-slash CFLAGS for clang on Windows - code-validator/guest: win32-x64-msvc NAPI target - .gitattributes: enforce LF line endings across platforms VM resource management: - sandbox/tool.js: invalidateSandbox() now calls dispose() on LoadedJSSandbox and JSSandbox for deterministic VM cleanup instead of relying on V8 GC - Updated hyperlight-js dep to include dispose() API Error handling: - agent/event-handler.ts: suppress duplicate 'Tool execution failed' messages - sandbox/tool.js: MMIO error detection in compilation and runtime paths - agent/index.ts: surrogate pool env vars (HYPERLIGHT_INITIAL/MAX_SURROGATES) Test fixes (Windows compatibility): - tests: symlink EPERM skip for Windows (path-jail, fs-read, fs-write) - tests/dts-sync: rmSync instead of shell rm -rf - tests/pattern-loader: unique tmpdir per test to avoid Windows EBUSY locks CI: - pr-validate.yml: Windows WHP matrix - publish.yml: Windows build support Security: - npm audit fix across all workspaces (picomatch, brace-expansion) - plugin-system/manager.ts: simplified ternary Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent e98de58 commit a8fbda8

File tree

8 files changed

+102
-117
lines changed

8 files changed

+102
-117
lines changed

builtin-modules/ooxml-core.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "Shared OOXML infrastructure - units, colors, themes, Content_Types, relationships",
44
"author": "system",
55
"mutable": false,
6-
"sourceHash": "sha256:1e939013c13555bc",
7-
"dtsHash": "sha256:9f88e7c59a56854c",
6+
"sourceHash": "sha256:b5f017fe2d4e2ed3",
7+
"dtsHash": "sha256:6aac85502082bf89",
88
"importStyle": "named",
99
"hints": {
1010
"overview": "Low-level OOXML infrastructure. Most users should use ha:pptx instead.",

builtin-modules/pptx-charts.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "OOXML DrawingML chart generation - bar, pie, line charts for PPTX presentations",
44
"author": "system",
55
"mutable": false,
6-
"sourceHash": "sha256:5c521ce93ff39626",
7-
"dtsHash": "sha256:5f653830226c3554",
6+
"sourceHash": "sha256:4174b6f03be2e0fb",
7+
"dtsHash": "sha256:4353b8263dc99405",
88
"importStyle": "named",
99
"hints": {
1010
"overview": "Chart generation for PPTX. Always used with ha:pptx.",

builtin-modules/pptx-tables.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "Styled tables for PPTX presentations - headers, borders, alternating rows",
44
"author": "system",
55
"mutable": false,
6-
"sourceHash": "sha256:0739a7db5a8ab428",
7-
"dtsHash": "sha256:82d903ffbf4dfb1e",
6+
"sourceHash": "sha256:2d58934ed7df9fe1",
7+
"dtsHash": "sha256:3ba75bbc44353467",
88
"importStyle": "named",
99
"hints": {
1010
"overview": "Table generation for PPTX. Always used with ha:pptx.",

builtin-modules/pptx.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "PowerPoint PPTX presentation builder - slides, text, shapes, themes, layouts",
44
"author": "system",
55
"mutable": false,
6-
"sourceHash": "sha256:093b19522e994756",
7-
"dtsHash": "sha256:2107e369816b4bd5",
6+
"sourceHash": "sha256:23569540a0f8622f",
7+
"dtsHash": "sha256:27520514e4401465",
88
"importStyle": "named",
99
"hints": {
1010
"overview": "Core PPTX slide building. Charts in ha:pptx-charts, tables in ha:pptx-tables.",

builtin-modules/src/types/ha-modules.d.ts

Lines changed: 80 additions & 103 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"fmt:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\" \"plugins/**/*.ts\" \"builtin-modules/**/*.js\"",
2828
"check": "npm run fmt:check && npm run typecheck && npm run test",
2929
"prepare": "node -e \"if(require('fs').existsSync('scripts/build-modules.js'))require('child_process').execSync('npm run build:modules',{stdio:'inherit'})\"",
30-
"postinstall": "node -e \"var fs=require('fs'),cp=require('child_process');if(fs.existsSync('scripts/patch-vscode-jsonrpc.js')){cp.execSync('node scripts/patch-vscode-jsonrpc.js',{stdio:'inherit'});cp.execSync('node scripts/check-native-runtime.js',{stdio:'inherit'})}\""
30+
"postinstall": "node -e \"var fs=require('fs'),cp=require('child_process');if(fs.existsSync('scripts/patch-vscode-jsonrpc.js')){cp.execSync('node scripts/patch-vscode-jsonrpc.js',{stdio:'inherit'});cp.execSync('node scripts/check-native-runtime.js',{stdio:'inherit'});}\""
3131
},
3232
"dependencies": {
3333
"@github/copilot-sdk": "^0.1.32",

scripts/build-binary.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,10 @@ writeFileSync(launcherCjsPath, launcherCjs);
426426
// Node.js launcher (works everywhere, used as npm bin entry)
427427
const nodeLauncher = `#!/usr/bin/env node
428428
import { join, dirname } from 'node:path';
429-
import { fileURLToPath } from 'node:url';
429+
import { fileURLToPath, pathToFileURL } from 'node:url';
430430
const __dirname = dirname(fileURLToPath(import.meta.url));
431431
const cjs = join(__dirname, '..', 'lib', 'hyperagent-launcher.cjs');
432-
await import('file://' + cjs.replace(/\\\\/g, '/'));
432+
await import(pathToFileURL(cjs).href);
433433
`;
434434
const nodeLauncherPath = join(BIN_DIR, "hyperagent");
435435
writeFileSync(nodeLauncherPath, nodeLauncher);
@@ -494,7 +494,7 @@ To run (option 3 - add to PATH permanently via System Properties):
494494
${launcherPath}
495495
496496
To run (option 2 - add to PATH):
497-
export PATH="${BIN_DIR}:\\$PATH"
497+
export PATH="${BIN_DIR}:$PATH"
498498
hyperagent
499499
500500
To run (option 3 - symlink):

tests/pattern-loader.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@ describe("pattern-loader", () => {
2323
afterEach(() => {
2424
try {
2525
rmSync(TMP_DIR, { recursive: true, force: true });
26-
} catch {
27-
// Windows: Defender/indexer may hold a lock — not worth failing the test
26+
} catch (err: unknown) {
27+
// Windows Defender/indexer can hold file locks — only swallow those
28+
const code = (err as NodeJS.ErrnoException).code;
29+
if (
30+
process.platform === "win32" &&
31+
(code === "EBUSY" || code === "EPERM")
32+
) {
33+
return;
34+
}
35+
throw err;
2836
}
2937
});
3038

0 commit comments

Comments
 (0)