Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ dist/
# OMC state
.omc/

# Native build artifacts
native/build/

# ElectroBun
.electrobun/

# Bun
# bun.lockb is committed for reproducible builds
110 changes: 110 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions electrobun.config.ts
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;
49 changes: 49 additions & 0 deletions native/AgentTapBridge.swift
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("{}")
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

// ── 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)
}
36 changes: 36 additions & 0 deletions native/Makefile
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)
22 changes: 22 additions & 0 deletions package.json
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"
}
}
Loading
Loading