-
Notifications
You must be signed in to change notification settings - Fork 0
Phase 0: ElectroBun scaffold with tray app and Swift FFI bridge #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+937
−0
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
20a5025
Phase 0: ElectroBun scaffold with tray app, Swift FFI bridge, and CI
GeiserX 35524af
Fix electrobun version to ^1.16.0 (was incorrect ^0.0.29)
GeiserX 3829375
Address CodeRabbit review feedback
GeiserX 9839fee
Fix FFI bridge: use CString for pointer reads, add project root disco…
GeiserX b9c3d4e
Address CodeRabbit round 2: security, capability checks, type safety
GeiserX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Build | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| build-native: | ||
| name: Build Swift FFI Bridge | ||
| runs-on: macos-14 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Build universal dylib | ||
| run: cd native && make universal | ||
|
|
||
| - name: Verify dylib architectures | ||
| run: | | ||
| lipo -info native/build/libAgentTapBridge.dylib | ||
| file native/build/libAgentTapBridge.dylib | ||
|
|
||
| - name: Upload dylib artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: native-bridge | ||
| path: native/build/libAgentTapBridge.dylib | ||
|
|
||
| build-app: | ||
| name: Build ElectroBun App | ||
| runs-on: macos-14 | ||
| needs: build-native | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: "1.3.12" | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install | ||
|
|
||
| - name: Download native bridge | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: native-bridge | ||
| path: native/build/ | ||
|
|
||
| - name: Build app | ||
| run: bun run build | ||
|
|
||
| - name: Upload app artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: agenttap-macos | ||
| path: .build/ | ||
| if-no-files-found: error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import type { ElectrobunConfig } from "electrobun"; | ||
|
|
||
| export default { | ||
| app: { | ||
| name: "AgentTap", | ||
| identifier: "com.geiserx.agenttap", | ||
| version: "0.1.0", | ||
| urlSchemes: ["agenttap"], | ||
| }, | ||
|
|
||
| runtime: { | ||
| exitOnLastWindowClosed: false, // Menu bar app — stays alive without windows | ||
| }, | ||
|
|
||
| build: { | ||
| bun: { | ||
| entrypoint: "src/bun/index.ts", | ||
| external: [], | ||
| sourcemap: "linked", | ||
| minify: false, | ||
| }, | ||
|
|
||
| views: { | ||
| mainview: { | ||
| entrypoint: "src/views/mainview/index.ts", | ||
| }, | ||
| }, | ||
|
|
||
| copy: { | ||
| "src/views/mainview/index.html": "views/mainview/index.html", | ||
| "src/views/mainview/index.css": "views/mainview/index.css", | ||
| "src/views/mainview/assets/tray-icon-template.png": | ||
| "views/assets/tray-icon-template.png", | ||
| }, | ||
|
|
||
| useAsar: false, | ||
|
|
||
| mac: { | ||
| codesign: false, | ||
| notarize: false, | ||
| bundleCEF: false, | ||
| defaultRenderer: "native", | ||
| icons: "icon.iconset", | ||
| }, | ||
| linux: { | ||
| bundleCEF: false, | ||
| defaultRenderer: "native", | ||
| }, | ||
| }, | ||
|
|
||
| release: { | ||
| baseUrl: "https://github.com/GeiserX/AgentTap/releases", | ||
| }, | ||
| } satisfies ElectrobunConfig; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import Foundation | ||
|
|
||
| // ── Version ──────────────────────────────────────────────────────────────── | ||
|
|
||
| @_cdecl("agenttap_version") | ||
| public func agenttap_version() -> UnsafeMutablePointer<CChar> { | ||
| let version = "0.1.0" | ||
| return strdup(version) | ||
| } | ||
|
|
||
| // ── System Info ──────────────────────────────────────────────────────────── | ||
|
|
||
| @_cdecl("agenttap_system_info") | ||
| public func agenttap_system_info() -> UnsafeMutablePointer<CChar> { | ||
| let info = ProcessInfo.processInfo | ||
| let json: [String: Any] = [ | ||
| "os_version": info.operatingSystemVersionString, | ||
| "processor_count": info.processorCount, | ||
| "physical_memory_gb": Double(info.physicalMemory) / (1024 * 1024 * 1024), | ||
| "uptime_seconds": Int(info.systemUptime), | ||
| ] | ||
|
|
||
| if let data = try? JSONSerialization.data(withJSONObject: json), | ||
| let str = String(data: data, encoding: .utf8) { | ||
| return strdup(str) | ||
| } | ||
| return strdup("{}") | ||
| } | ||
|
|
||
| // ── Capability Checks (stubs for Phase 2) ────────────────────────────────── | ||
|
|
||
| @_cdecl("agenttap_can_manage_firewall") | ||
| public func agenttap_can_manage_firewall() -> Bool { | ||
| // TODO: Phase 2 — verify privileged helper is installed and responsive via XPC | ||
| return false | ||
| } | ||
|
|
||
| @_cdecl("agenttap_can_manage_keychain") | ||
| public func agenttap_can_manage_keychain() -> Bool { | ||
| // TODO: Phase 1 — perform actual SecItemCopyMatching test | ||
| return false | ||
| } | ||
|
|
||
| // ── Memory Management ────────────────────────────────────────────────────── | ||
|
|
||
| @_cdecl("agenttap_free_string") | ||
| public func agenttap_free_string(_ ptr: UnsafeMutablePointer<CChar>?) { | ||
| free(ptr) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| SWIFT_FLAGS = -O -whole-module-optimization | ||
| BUILD_DIR = build | ||
| LIB_NAME = libAgentTapBridge | ||
| SOURCES = AgentTapBridge.swift | ||
|
|
||
| .PHONY: all clean universal arm64 x86_64 | ||
|
|
||
| all: universal | ||
|
|
||
| $(BUILD_DIR): | ||
| mkdir -p $(BUILD_DIR) | ||
|
|
||
| arm64: $(BUILD_DIR) | ||
| swiftc $(SWIFT_FLAGS) \ | ||
| -target arm64-apple-macosx13.0 \ | ||
| -emit-library \ | ||
| -module-name AgentTapBridge \ | ||
| -o $(BUILD_DIR)/$(LIB_NAME)-arm64.dylib \ | ||
| $(SOURCES) | ||
|
|
||
| x86_64: $(BUILD_DIR) | ||
| swiftc $(SWIFT_FLAGS) \ | ||
| -target x86_64-apple-macosx13.0 \ | ||
| -emit-library \ | ||
| -module-name AgentTapBridge \ | ||
| -o $(BUILD_DIR)/$(LIB_NAME)-x86_64.dylib \ | ||
| $(SOURCES) | ||
|
|
||
| universal: arm64 x86_64 | ||
| lipo -create \ | ||
| $(BUILD_DIR)/$(LIB_NAME)-arm64.dylib \ | ||
| $(BUILD_DIR)/$(LIB_NAME)-x86_64.dylib \ | ||
| -output $(BUILD_DIR)/$(LIB_NAME).dylib | ||
|
|
||
| clean: | ||
| rm -rf $(BUILD_DIR) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "name": "agenttap", | ||
| "version": "0.1.0", | ||
| "description": "Capture AI agent traces at the network level via split VPN", | ||
| "license": "GPL-3.0", | ||
| "author": "GeiserX", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/GeiserX/AgentTap.git" | ||
| }, | ||
| "scripts": { | ||
| "dev": "bunx electrobun dev", | ||
| "build": "bun run build:native && bunx electrobun build", | ||
| "build:stable": "bunx electrobun build --env stable", | ||
| "build:native": "cd native && make", | ||
| "clean": "rm -rf .build dist native/build" | ||
| }, | ||
| "devDependencies": { | ||
| "electrobun": "^1.16.0", | ||
| "typescript": "^5.8.3" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.