@raysonmeng/agentbridge 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@raysonmeng/agentbridge",
3
+ "version": "0.1.0",
4
+ "description": "Bridge between Claude Code and Codex — bidirectional agent communication via MCP Channel + JSON-RPC",
5
+ "type": "module",
6
+ "bin": {
7
+ "agentbridge": "dist/cli.js",
8
+ "abg": "dist/cli.js"
9
+ },
10
+ "files": [
11
+ "dist/",
12
+ "plugins/",
13
+ ".claude-plugin/",
14
+ "scripts/postinstall.cjs",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "scripts": {
19
+ "start": "bun run src/bridge.ts",
20
+ "build:cli": "mkdir -p dist && bun build src/cli.ts --outfile dist/cli.js --target bun && chmod +x dist/cli.js",
21
+ "build:plugin": "mkdir -p plugins/agentbridge/server && bun build src/bridge.ts --outfile plugins/agentbridge/server/bridge-server.js --target bun && bun build src/daemon.ts --outfile plugins/agentbridge/server/daemon.js --target bun",
22
+ "postinstall": "node scripts/postinstall.cjs",
23
+ "prepublishOnly": "bun run build:cli && bun run build:plugin",
24
+ "validate:plugin": "claude plugin validate plugins/agentbridge && claude plugin validate .claude-plugin/marketplace.json",
25
+ "test": "bun test src",
26
+ "typecheck": "tsc --noEmit",
27
+ "validate:plugin-versions": "bun scripts/check-plugin-versions.js",
28
+ "check": "tsc --noEmit && bun test src && bun run build:plugin && bun scripts/check-plugin-versions.js"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/raysonmeng/agent-bridge.git"
33
+ },
34
+ "homepage": "https://github.com/raysonmeng/agent-bridge#readme",
35
+ "bugs": {
36
+ "url": "https://github.com/raysonmeng/agent-bridge/issues"
37
+ },
38
+ "keywords": [
39
+ "claude-code",
40
+ "codex",
41
+ "mcp",
42
+ "agent",
43
+ "bridge",
44
+ "multi-agent",
45
+ "channels"
46
+ ],
47
+ "author": "AgentBridge Contributors",
48
+ "license": "MIT",
49
+ "devDependencies": {
50
+ "@modelcontextprotocol/sdk": "^1.27.1",
51
+ "@types/bun": "^1.3.11",
52
+ "typescript": "^5.8.0"
53
+ }
54
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "agentbridge",
3
+ "version": "0.1.0",
4
+ "description": "Bridge Claude Code and Codex with a shared daemon, push channel delivery, and bidirectional reply tooling.",
5
+ "author": {
6
+ "name": "AgentBridge Contributors",
7
+ "email": "raysonmeng@qq.com"
8
+ },
9
+ "homepage": "https://github.com/raysonmeng/agent-bridge#readme",
10
+ "repository": "https://github.com/raysonmeng/agent-bridge",
11
+ "license": "MIT"
12
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "agentbridge": {
4
+ "command": "bun",
5
+ "args": ["run", "${CLAUDE_PLUGIN_ROOT}/server/bridge-server.js"],
6
+ "env": {
7
+ "AGENTBRIDGE_DAEMON_ENTRY": "./daemon.js"
8
+ }
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,43 @@
1
+ # AgentBridge Plugin
2
+
3
+ Claude Code plugin for AgentBridge. This plugin packages the AgentBridge MCP frontend, dual-mode Claude transport (push channel delivery plus pull-mode `get_messages`), the `/agentbridge:init` command, and a non-blocking SessionStart health check.
4
+
5
+ ## Structure
6
+
7
+ ```text
8
+ plugins/agentbridge/
9
+ ├── .claude-plugin/plugin.json
10
+ ├── .mcp.json
11
+ ├── commands/init.md
12
+ ├── hooks/hooks.json
13
+ ├── scripts/health-check.sh
14
+ └── server/
15
+ ├── bridge-server.js
16
+ └── daemon.js
17
+ ```
18
+
19
+ ## Build
20
+
21
+ Run:
22
+
23
+ ```bash
24
+ bun run build:plugin
25
+ ```
26
+
27
+ This creates self-contained bundles at:
28
+
29
+ - `plugins/agentbridge/server/bridge-server.js`
30
+ - `plugins/agentbridge/server/daemon.js`
31
+
32
+ ## Local Testing
33
+
34
+ 1. Build the plugin bundles: `bun run build:plugin`
35
+ 2. In Claude Code, load the plugin from this repo or install it from the marketplace manifest in `.claude-plugin/marketplace.json`
36
+ 3. Reload plugins in the active session with `/reload-plugins`
37
+
38
+ ## Notes
39
+
40
+ - The plugin frontend launches the sibling daemon bundle via `AGENTBRIDGE_DAEMON_ENTRY=./daemon.js`.
41
+ - Claude delivery supports both push notifications and pull-mode polling via `get_messages`, depending on the runtime mode.
42
+ - The SessionStart hook is informational only. It never starts or stops the daemon.
43
+ - The command at `/agentbridge:init` edits project-local `.agentbridge/` files only; plugin installation and marketplace registration remain terminal-side tasks (`agentbridge init` / `agentbridge dev`).
@@ -0,0 +1,70 @@
1
+ ---
2
+ description: Create or update the AgentBridge project config files in the current workspace
3
+ allowed-tools: Read,Write,Edit,MultiEdit,LS
4
+ ---
5
+
6
+ Bootstrap or update AgentBridge's project-local configuration in this workspace.
7
+
8
+ Follow these rules:
9
+
10
+ 1. Work only inside `.agentbridge/`.
11
+ 2. Do not install plugins or modify `.claude/settings.json` here. Plugin setup belongs to terminal workflows: `agentbridge init` attempts best-effort plugin installation, and `agentbridge dev` handles local marketplace registration/sync.
12
+ 3. Preserve user edits when the files already exist. Update only the fields the user asked to change.
13
+ 4. Keep `.agentbridge/config.json` valid JSON.
14
+ 5. Keep `.agentbridge/collaboration.md` human-editable and concise.
15
+
16
+ If `.agentbridge/config.json` is missing, create it with this default template:
17
+
18
+ ```json
19
+ {
20
+ "version": "1.0",
21
+ "daemon": {
22
+ "port": 4500,
23
+ "proxyPort": 4501
24
+ },
25
+ "agents": {
26
+ "claude": {
27
+ "role": "Reviewer, Planner",
28
+ "mode": "push"
29
+ },
30
+ "codex": {
31
+ "role": "Implementer, Executor"
32
+ }
33
+ },
34
+ "markers": ["IMPORTANT", "STATUS", "FYI"],
35
+ "turnCoordination": {
36
+ "attentionWindowSeconds": 15,
37
+ "busyGuard": true
38
+ },
39
+ "idleShutdownSeconds": 30
40
+ }
41
+ ```
42
+
43
+ If `.agentbridge/collaboration.md` is missing, create it with this default template:
44
+
45
+ ```markdown
46
+ # Collaboration Rules
47
+
48
+ ## Roles
49
+ - Claude: Reviewer, Planner, Hypothesis Challenger
50
+ - Codex: Implementer, Executor, Reproducer/Verifier
51
+
52
+ ## Thinking Patterns
53
+ - Analytical/review tasks: Independent Analysis & Convergence
54
+ - Implementation tasks: Architect -> Builder -> Critic
55
+ - Debugging tasks: Hypothesis -> Experiment -> Interpretation
56
+
57
+ ## Communication
58
+ - Use explicit phrases: "My independent view is:", "I agree on:", "I disagree on:", and "Current consensus:"
59
+ - Tag messages with [IMPORTANT], [STATUS], or [FYI]
60
+
61
+ ## Review Process
62
+ - Cross-review: author never reviews their own code
63
+ - All changes go through feature/fix branches + PR
64
+ - Merge via squash merge
65
+
66
+ ## Custom Rules
67
+ <!-- Add project-specific collaboration rules here -->
68
+ ```
69
+
70
+ When you finish, briefly summarize what changed and point the user to the two files you updated.
@@ -0,0 +1,16 @@
1
+ {
2
+ "description": "Hint-only health checks for AgentBridge startup. These hooks never orchestrate the daemon.",
3
+ "hooks": {
4
+ "SessionStart": [
5
+ {
6
+ "matcher": "*",
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/health-check.sh\""
11
+ }
12
+ ]
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -uo pipefail
4
+
5
+ INPUT="$(cat 2>/dev/null || true)"
6
+
7
+ workspace="${CLAUDE_PROJECT_DIR:-${PWD}}"
8
+ cooldown_seconds="${AGENTBRIDGE_HEALTH_HOOK_COOLDOWN_SECONDS:-120}"
9
+ state_root="${AGENTBRIDGE_HOOK_STATE_DIR:-${TMPDIR:-/tmp}/agentbridge-hooks}"
10
+ port="${AGENTBRIDGE_CONTROL_PORT:-4502}"
11
+
12
+ if ! command -v curl >/dev/null 2>&1; then
13
+ exit 0
14
+ fi
15
+
16
+ mkdir -p "$state_root" 2>/dev/null || true
17
+ workspace_key="$(printf '%s' "$workspace" | cksum | awk '{print $1}')"
18
+ stamp_file="${state_root}/sessionstart-${workspace_key}.stamp"
19
+ now="$(date +%s)"
20
+
21
+ if [ -f "$stamp_file" ]; then
22
+ last_notice="$(cat "$stamp_file" 2>/dev/null || echo 0)"
23
+ if [ $((now - last_notice)) -lt "$cooldown_seconds" ]; then
24
+ exit 0
25
+ fi
26
+ fi
27
+
28
+ printf '%s' "$now" >"$stamp_file" 2>/dev/null || true
29
+
30
+ health_json="$(curl -fsS --max-time 1 "http://127.0.0.1:${port}/healthz" 2>/dev/null || true)"
31
+
32
+ if [ -n "$health_json" ]; then
33
+ tui_connected="false"
34
+ if printf '%s' "$health_json" | grep -q '"tuiConnected":true'; then
35
+ tui_connected="true"
36
+ fi
37
+
38
+ if [ "$tui_connected" = "true" ]; then
39
+ cat <<EOF
40
+ {"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"AgentBridge is running. Daemon healthy, Codex TUI connected. Bridge is ready for communication."}}
41
+ EOF
42
+ else
43
+ cat <<EOF
44
+ {"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"AgentBridge daemon is running but Codex TUI is not connected yet. Start Codex in another terminal with: agentbridge codex"}}
45
+ EOF
46
+ fi
47
+ else
48
+ cat <<EOF
49
+ {"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"AgentBridge daemon is not reachable on http://127.0.0.1:${port}/healthz yet. Start the bridge with: agentbridge claude (this terminal) + agentbridge codex (another terminal). If you're already using agentbridge claude, the daemon may still be starting up."}}
50
+ EOF
51
+ fi