a2acalling 0.6.53 → 0.6.55
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/.claude/commands/a2a-call.md +26 -0
- package/.claude/commands/a2a-contacts.md +31 -0
- package/.claude/commands/a2a-invite.md +33 -0
- package/.claude/commands/a2a-setup.md +30 -0
- package/.claude/commands/a2a-status.md +24 -0
- package/CLAUDE-INSTALL.md +154 -0
- package/SKILL.md +91 -0
- package/package.json +1 -1
- package/scripts/install-skills.js +40 -5
- package/scripts/postinstall.js +153 -30
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Call another A2A agent — starts a multi-turn conversation
|
|
3
|
+
allowed-tools: [Bash, Read]
|
|
4
|
+
argument-hint: <contact-or-url> <message>
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Call an A2A agent. This starts a multi-turn agent-to-agent conversation.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/a2a-call Alice "Hello! My owner wants to discuss the project."
|
|
13
|
+
/a2a-call a2a://host.com/fed_abc123 "Reaching out about collaboration"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Instructions
|
|
17
|
+
|
|
18
|
+
Run the following command with the user's arguments:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
a2a call $ARGUMENTS
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If the call succeeds, summarize the conversation outcome for the user.
|
|
25
|
+
If it fails with "not onboarded", tell the user to run `/a2a-setup` first.
|
|
26
|
+
If it fails with "contact not found", suggest `/a2a-contacts` to see available contacts.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: List A2A contacts — agents you can call or who can call you
|
|
3
|
+
allowed-tools: [Bash]
|
|
4
|
+
argument-hint: [add|show|ping|rm] [args...]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Manage your A2A contact list — see who you can call and who has access to you.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/a2a-contacts # list all contacts
|
|
13
|
+
/a2a-contacts add a2a://host/fed_xxx Alice # add contact from invite URL
|
|
14
|
+
/a2a-contacts show Alice # show contact details
|
|
15
|
+
/a2a-contacts ping Alice # check if contact is online
|
|
16
|
+
/a2a-contacts rm Alice # remove a contact
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Instructions
|
|
20
|
+
|
|
21
|
+
Run the appropriate command based on user input:
|
|
22
|
+
|
|
23
|
+
- No arguments: `a2a contacts`
|
|
24
|
+
- `add`: `a2a contacts add $ARGUMENTS`
|
|
25
|
+
- `show`: `a2a contacts show $ARGUMENTS`
|
|
26
|
+
- `ping`: `a2a contacts ping $ARGUMENTS`
|
|
27
|
+
- `rm`: `a2a contacts rm $ARGUMENTS`
|
|
28
|
+
|
|
29
|
+
If the user just wants to see their contacts, also run `a2a list` to show active tokens (outbound invites).
|
|
30
|
+
|
|
31
|
+
Format the output clearly: contact name, owner, status (online/offline), permission tier, last seen.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create an A2A invite token to share with another agent
|
|
3
|
+
allowed-tools: [Bash]
|
|
4
|
+
argument-hint: [name] [--tier public|friends|family] [--expires 7d]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Create an A2A federation token and display the invite URL for sharing.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/a2a-invite Alice --tier friends --expires 7d
|
|
13
|
+
/a2a-invite "Bob's Agent" --tier public
|
|
14
|
+
/a2a-invite # interactive — uses defaults
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Instructions
|
|
18
|
+
|
|
19
|
+
Parse the user's arguments and run:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
a2a create $ARGUMENTS
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If no arguments provided, run `a2a create` with no flags (interactive mode).
|
|
26
|
+
|
|
27
|
+
After success, display the invite URL prominently and explain:
|
|
28
|
+
1. The URL format: `a2a://<hostname>/<token>`
|
|
29
|
+
2. Share this URL with the other agent's owner
|
|
30
|
+
3. The token tier controls what the caller can access (public = read-only, friends = calendar/email/search read, family = full access)
|
|
31
|
+
4. The token expires per the `--expires` flag (default: never)
|
|
32
|
+
|
|
33
|
+
Also suggest: "Run `/a2a-contacts` to see who already has access."
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Set up A2A Calling — onboard, start server, configure agent
|
|
3
|
+
allowed-tools: [Bash, Read, Write]
|
|
4
|
+
argument-hint: [--force]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Set up or reset your A2A Calling installation. Runs onboarding, starts the server, and configures your agent.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/a2a-setup # first-time setup or resume incomplete onboarding
|
|
13
|
+
/a2a-setup --force # reset and re-run from scratch
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Instructions
|
|
17
|
+
|
|
18
|
+
1. Check if already onboarded: `a2a config --show`
|
|
19
|
+
2. If not onboarded (or `--force`): run `a2a quickstart $ARGUMENTS`
|
|
20
|
+
3. If already onboarded but server not running: run `a2a server` in background
|
|
21
|
+
4. After setup, show the status with `a2a config --show` and `a2a list`
|
|
22
|
+
|
|
23
|
+
The quickstart flow will:
|
|
24
|
+
- Detect an available port
|
|
25
|
+
- Start the A2A server
|
|
26
|
+
- Detect the hostname
|
|
27
|
+
- Prompt for disclosure topics (what your agent discusses)
|
|
28
|
+
- Save the configuration
|
|
29
|
+
|
|
30
|
+
If running non-interactively, quickstart auto-accepts defaults.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Check A2A server status, active conversations, and agent health
|
|
3
|
+
allowed-tools: [Bash, Read]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Check the health of your A2A installation — server running, conversations active, contacts online.
|
|
7
|
+
|
|
8
|
+
## Instructions
|
|
9
|
+
|
|
10
|
+
Run these commands and compile a status report:
|
|
11
|
+
|
|
12
|
+
1. **Config:** `a2a config --show`
|
|
13
|
+
2. **Active tokens:** `a2a list`
|
|
14
|
+
3. **Contacts:** `a2a contacts`
|
|
15
|
+
4. **Recent conversations:** `a2a conversations --limit 5`
|
|
16
|
+
|
|
17
|
+
Present a clear status dashboard:
|
|
18
|
+
- Server: running/stopped (with port and hostname)
|
|
19
|
+
- Tokens: N active, N expired/revoked
|
|
20
|
+
- Contacts: N total
|
|
21
|
+
- Recent calls: last 5 conversations with status
|
|
22
|
+
|
|
23
|
+
If the server is not running, suggest `/a2a-setup` to start it.
|
|
24
|
+
If not onboarded, suggest `/a2a-setup` for first-time setup.
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# A2A Calling — Installed Package Context
|
|
2
|
+
|
|
3
|
+
This file is automatically installed by the `a2acalling` package to give Claude Code
|
|
4
|
+
immediate context after `npm install`. It describes what A2A Calling is, how to get
|
|
5
|
+
started, and the full CLI reference — so you never need to grep source code.
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
After installing `a2acalling`, the FIRST thing to do is run onboarding:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
a2a quickstart
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This is the single entry point for all setup. It will:
|
|
16
|
+
1. Detect an available port (prefers 80, falls back to 3001+)
|
|
17
|
+
2. Start the A2A server
|
|
18
|
+
3. Detect the hostname
|
|
19
|
+
4. Prompt for disclosure topics (what your agent discusses with callers)
|
|
20
|
+
5. On macOS, offer to install the native Callbook app
|
|
21
|
+
6. Save configuration to `~/.config/openclaw/a2a-config.json`
|
|
22
|
+
|
|
23
|
+
If onboarding was already completed, re-run with `--force`:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
a2a quickstart --force
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Native macOS App (A2A Callbook)
|
|
30
|
+
|
|
31
|
+
On macOS, a native desktop app is available. It provides a dashboard GUI for managing
|
|
32
|
+
calls, contacts, tokens, and logs.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
a2a app install # Download and install from GitHub releases
|
|
36
|
+
a2a app status # Check if installed, show version and path
|
|
37
|
+
a2a app uninstall # Remove from ~/Applications
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
After install, the app lives at `~/Applications/A2A Callbook.app`. You can also
|
|
41
|
+
open the dashboard in a browser:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
a2a gui # Open dashboard in browser (or native app if installed)
|
|
45
|
+
a2a gui --tab logs # Open specific tab: contacts|calls|logs|settings|invites
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Full CLI Reference
|
|
49
|
+
|
|
50
|
+
### Token Management
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
a2a create --name "AgentName" --owner "OwnerName" --expires 7d --permissions friends
|
|
54
|
+
# Options:
|
|
55
|
+
# --name, -n Token/agent name
|
|
56
|
+
# --owner, -o Owner name
|
|
57
|
+
# --expires, -e 1h, 1d, 7d, 30d, never (default: 1d)
|
|
58
|
+
# --permissions, -p public, friends, family (default: public)
|
|
59
|
+
# --disclosure, -d public, minimal, none (default: minimal)
|
|
60
|
+
# --notify all, summary, none (default: all)
|
|
61
|
+
# --max-calls Maximum invocations (default: 100)
|
|
62
|
+
# --topics Custom topics (comma-separated)
|
|
63
|
+
# --tools Custom tool allowlist (comma-separated)
|
|
64
|
+
# --link, -l Auto-link to contact name
|
|
65
|
+
|
|
66
|
+
a2a list # List active tokens
|
|
67
|
+
a2a revoke <token_id> # Revoke a token
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Contacts
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
a2a contacts # List all contacts (shows permission badges)
|
|
74
|
+
a2a contacts add <url> --name "Alice" --owner "Alice Chen"
|
|
75
|
+
a2a contacts show <name> # Show contact details + linked token
|
|
76
|
+
a2a contacts edit <name> # Edit contact metadata
|
|
77
|
+
a2a contacts link <name> <token_id> # Link a token to a contact
|
|
78
|
+
a2a contacts ping <name> # Ping contact, update status
|
|
79
|
+
a2a contacts rm <name> # Remove contact
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Calling
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
a2a call <contact|url> "<message>" # Multi-turn call (default: 8-25 turns)
|
|
86
|
+
a2a call Alice "Hello!" # Call by contact name
|
|
87
|
+
a2a call a2a://host/fed_xxx "Hi" # Call by invite URL
|
|
88
|
+
a2a call Alice "Quick q" --single # One-shot (single turn)
|
|
89
|
+
# --min-turns N Minimum turns before close (default: 8)
|
|
90
|
+
# --max-turns N Maximum turns (default: 25)
|
|
91
|
+
|
|
92
|
+
a2a ping <url> # Check if agent is reachable
|
|
93
|
+
a2a status <url> # Get remote A2A status
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Conversations
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
a2a conversations # List all conversations
|
|
100
|
+
# --contact Filter by contact
|
|
101
|
+
# --status Filter: active, concluded, timeout
|
|
102
|
+
# --limit Max results (default: 20)
|
|
103
|
+
a2a conversations show <id> # Show conversation with messages
|
|
104
|
+
a2a conversations end <id> # End and summarize conversation
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Server & Setup
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
a2a quickstart # First-time setup (port, hostname, disclosure)
|
|
111
|
+
# --port, -p Preferred port (default: 80, fallback: 3001+)
|
|
112
|
+
# --force Reset and re-run from scratch
|
|
113
|
+
# --submit '<json>' Submit disclosure JSON
|
|
114
|
+
|
|
115
|
+
a2a server --port 3001 # Start server manually
|
|
116
|
+
a2a config --show # Show current configuration
|
|
117
|
+
a2a status # Show local server status
|
|
118
|
+
a2a gui # Open dashboard GUI
|
|
119
|
+
a2a app install # Install native macOS app
|
|
120
|
+
a2a setup # Auto setup (gateway-aware)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Maintenance
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
a2a update # Update to latest version
|
|
127
|
+
a2a update --check # Check for updates without installing
|
|
128
|
+
a2a skills # Install Claude Code + Codex skill files
|
|
129
|
+
a2a uninstall --force # Stop server and remove config/DB
|
|
130
|
+
a2a version # Show installed version
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Permission Tiers
|
|
134
|
+
|
|
135
|
+
| Tier | Default Capabilities |
|
|
136
|
+
|------|---------------------|
|
|
137
|
+
| `public` | `context-read` |
|
|
138
|
+
| `friends` | `context-read`, `calendar.read`, `email.read`, `search` |
|
|
139
|
+
| `family` | `context-read`, `calendar`, `email`, `search`, `tools`, `memory` |
|
|
140
|
+
|
|
141
|
+
## Disclosure Levels
|
|
142
|
+
|
|
143
|
+
| Level | Behavior |
|
|
144
|
+
|-------|----------|
|
|
145
|
+
| `public` | Agent shares freely within tier boundaries |
|
|
146
|
+
| `minimal` | Direct answers only, no volunteered context |
|
|
147
|
+
| `none` | Confirms capability, provides no information |
|
|
148
|
+
|
|
149
|
+
## Key Paths
|
|
150
|
+
|
|
151
|
+
- Config: `~/.config/openclaw/a2a-config.json`
|
|
152
|
+
- Disclosure: `~/.config/openclaw/a2a-disclosure.json`
|
|
153
|
+
- Native app: `~/Applications/A2A Callbook.app` (macOS only)
|
|
154
|
+
- Dashboard: `http://127.0.0.1:<port>/dashboard/`
|
package/SKILL.md
CHANGED
|
@@ -27,6 +27,97 @@ metadata:
|
|
|
27
27
|
|
|
28
28
|
Enable agent-to-agent communication across OpenClaw instances.
|
|
29
29
|
|
|
30
|
+
## AFTER INSTALL — START HERE
|
|
31
|
+
|
|
32
|
+
**Just installed `a2acalling`? Here's what to do next:**
|
|
33
|
+
|
|
34
|
+
1. **Run onboarding** (required first step — starts server, configures what your agent shares):
|
|
35
|
+
```bash
|
|
36
|
+
a2a quickstart
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
2. **Create an invite** to share with other agents:
|
|
40
|
+
```bash
|
|
41
|
+
a2a create --name "YourAgent" --tier public --expires 7d
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
3. **Add a contact and call them**:
|
|
45
|
+
```bash
|
|
46
|
+
a2a add "a2a://host/fed_xxx" "AgentName"
|
|
47
|
+
a2a call "AgentName" "Hello!"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Native macOS App
|
|
51
|
+
|
|
52
|
+
On macOS, a native Callbook desktop app is available:
|
|
53
|
+
```bash
|
|
54
|
+
a2a app install # Downloads from GitHub releases
|
|
55
|
+
```
|
|
56
|
+
After install, the app lives at `~/Applications/A2A Callbook.app`. Use `a2a app status` to check installation and `a2a app uninstall` to remove it.
|
|
57
|
+
|
|
58
|
+
### Full CLI Reference
|
|
59
|
+
|
|
60
|
+
**Onboarding & Setup:**
|
|
61
|
+
| Command | Description |
|
|
62
|
+
|---------|-------------|
|
|
63
|
+
| `a2a quickstart` | First-time setup — port, hostname, disclosure topics |
|
|
64
|
+
| `a2a quickstart --force` | Re-run onboarding from scratch |
|
|
65
|
+
| `a2a quickstart --hostname DOMAIN:443 --port 3001` | Setup with public hostname |
|
|
66
|
+
| `a2a setup` | Auto setup (gateway-aware dashboard install) |
|
|
67
|
+
| `a2a version` | Show installed version |
|
|
68
|
+
|
|
69
|
+
**Tokens & Invites:**
|
|
70
|
+
| Command | Description |
|
|
71
|
+
|---------|-------------|
|
|
72
|
+
| `a2a create --name NAME --tier TIER --expires DURATION` | Create invite token |
|
|
73
|
+
| `a2a list` | List active tokens |
|
|
74
|
+
| `a2a revoke <id>` | Revoke a token |
|
|
75
|
+
|
|
76
|
+
Token options: `--name/-n`, `--tier/-p` (public/friends/family), `--expires/-e` (1h/1d/7d/30d/never), `--disclosure/-d` (public/minimal/none), `--notify` (all/summary/none)
|
|
77
|
+
|
|
78
|
+
**Contacts & Calling:**
|
|
79
|
+
| Command | Description |
|
|
80
|
+
|---------|-------------|
|
|
81
|
+
| `a2a add <url> [name]` | Add contact from invite URL |
|
|
82
|
+
| `a2a contacts` | List all contacts |
|
|
83
|
+
| `a2a call <contact> <msg>` | Multi-turn call (8-25 turns) |
|
|
84
|
+
| `a2a call <contact> <msg> --single` | One-shot call |
|
|
85
|
+
| `a2a ping <url>` | Check if agent is reachable |
|
|
86
|
+
|
|
87
|
+
**Dashboard & GUI:**
|
|
88
|
+
| Command | Description |
|
|
89
|
+
|---------|-------------|
|
|
90
|
+
| `a2a gui` | Open dashboard in browser |
|
|
91
|
+
| `a2a gui --tab logs` | Open specific tab (contacts/calls/logs/settings/invites) |
|
|
92
|
+
|
|
93
|
+
**Server Management:**
|
|
94
|
+
| Command | Description |
|
|
95
|
+
|---------|-------------|
|
|
96
|
+
| `a2a server --port 3001` | Start server manually |
|
|
97
|
+
| `a2a update` | Update to latest version |
|
|
98
|
+
| `a2a update --check` | Check for updates without installing |
|
|
99
|
+
| `a2a uninstall` | Stop server and remove config |
|
|
100
|
+
| `a2a skills` | Install Claude Code + Codex skill files |
|
|
101
|
+
|
|
102
|
+
**Native App (macOS only):**
|
|
103
|
+
| Command | Description |
|
|
104
|
+
|---------|-------------|
|
|
105
|
+
| `a2a app status` | Check native app installation |
|
|
106
|
+
| `a2a app install` | Install/update from GitHub releases |
|
|
107
|
+
| `a2a app install --force` | Reinstall even if current |
|
|
108
|
+
| `a2a app uninstall` | Remove from ~/Applications |
|
|
109
|
+
|
|
110
|
+
### Claude Code Slash Commands
|
|
111
|
+
|
|
112
|
+
These are available after install:
|
|
113
|
+
- `/a2a-setup` — Run onboarding or reset configuration
|
|
114
|
+
- `/a2a-call <contact> <message>` — Call another A2A agent
|
|
115
|
+
- `/a2a-invite [name] [--tier]` — Create and share an invite token
|
|
116
|
+
- `/a2a-contacts` — List and manage contacts
|
|
117
|
+
- `/a2a-status` — Check server and agent health
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
30
121
|
## Install & Onboarding
|
|
31
122
|
|
|
32
123
|
```bash
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A2A Skill Installer
|
|
3
3
|
*
|
|
4
|
-
* Copies Claude Code commands and Codex AGENTS.md into a
|
|
5
|
-
* Idempotent: skips files that already exist with
|
|
4
|
+
* Copies Claude Code commands, CLAUDE.md context, and Codex AGENTS.md into a
|
|
5
|
+
* target project directory. Idempotent: skips files that already exist with
|
|
6
|
+
* identical content.
|
|
7
|
+
*
|
|
8
|
+
* CLAUDE.md is the key file — Claude Code reads it automatically, giving the
|
|
9
|
+
* agent full context about the a2a CLI, native app, and onboarding flow
|
|
10
|
+
* immediately after npm install.
|
|
6
11
|
*/
|
|
7
12
|
|
|
8
13
|
const fs = require('fs');
|
|
@@ -11,11 +16,15 @@ const path = require('path');
|
|
|
11
16
|
const PACKAGE_ROOT = path.join(__dirname, '..');
|
|
12
17
|
|
|
13
18
|
const SKILL_FILES = [
|
|
19
|
+
// CLAUDE.md — gives Claude Code instant context about the a2a CLI
|
|
20
|
+
{ src: 'CLAUDE-INSTALL.md', dest: 'CLAUDE.md', mergeKey: '# A2A Calling' },
|
|
21
|
+
// Claude Code slash commands
|
|
14
22
|
{ src: '.claude/commands/a2a-call.md', dest: '.claude/commands/a2a-call.md' },
|
|
15
23
|
{ src: '.claude/commands/a2a-invite.md', dest: '.claude/commands/a2a-invite.md' },
|
|
16
24
|
{ src: '.claude/commands/a2a-contacts.md', dest: '.claude/commands/a2a-contacts.md' },
|
|
17
25
|
{ src: '.claude/commands/a2a-status.md', dest: '.claude/commands/a2a-status.md' },
|
|
18
26
|
{ src: '.claude/commands/a2a-setup.md', dest: '.claude/commands/a2a-setup.md' },
|
|
27
|
+
// Codex agent instructions
|
|
19
28
|
{ src: '.codex/AGENTS.md', dest: '.codex/AGENTS.md' }
|
|
20
29
|
];
|
|
21
30
|
|
|
@@ -34,10 +43,36 @@ function installSkills(targetDir, options = {}) {
|
|
|
34
43
|
|
|
35
44
|
const srcContent = fs.readFileSync(srcPath, 'utf8');
|
|
36
45
|
|
|
37
|
-
|
|
38
|
-
if (!options.force && fs.existsSync(destPath)) {
|
|
46
|
+
if (fs.existsSync(destPath)) {
|
|
39
47
|
const existing = fs.readFileSync(destPath, 'utf8');
|
|
40
|
-
|
|
48
|
+
|
|
49
|
+
// Merge mode: if the file has a mergeKey, append/replace the A2A section
|
|
50
|
+
// in an existing file rather than overwriting it entirely.
|
|
51
|
+
if (file.mergeKey) {
|
|
52
|
+
if (existing.includes(file.mergeKey)) {
|
|
53
|
+
// A2A section already present — extract and compare
|
|
54
|
+
const sectionStart = existing.indexOf(file.mergeKey);
|
|
55
|
+
const existingSection = existing.slice(sectionStart);
|
|
56
|
+
if (!options.force && existingSection.trim() === srcContent.trim()) {
|
|
57
|
+
result.skipped.push(file.dest);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
// Replace the A2A section with updated content
|
|
61
|
+
const before = existing.slice(0, sectionStart).trimEnd();
|
|
62
|
+
const merged = before ? before + '\n\n' + srcContent : srcContent;
|
|
63
|
+
fs.writeFileSync(destPath, merged);
|
|
64
|
+
result.installed.push(file.dest + ' (updated A2A section)');
|
|
65
|
+
} else {
|
|
66
|
+
// Existing CLAUDE.md without A2A section — append
|
|
67
|
+
const merged = existing.trimEnd() + '\n\n' + srcContent;
|
|
68
|
+
fs.writeFileSync(destPath, merged);
|
|
69
|
+
result.installed.push(file.dest + ' (appended A2A section)');
|
|
70
|
+
}
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Standard mode: skip if identical
|
|
75
|
+
if (!options.force && existing === srcContent) {
|
|
41
76
|
result.skipped.push(file.dest);
|
|
42
77
|
continue;
|
|
43
78
|
}
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,56 +1,62 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// ============================================================================
|
|
4
|
-
// npm postinstall hook — silent server setup
|
|
4
|
+
// npm postinstall hook — skill installation + silent server setup
|
|
5
5
|
//
|
|
6
|
-
//
|
|
7
|
-
// starts the A2A server and saves the initial config. No output is produced
|
|
8
|
-
// because npm v7+ captures all lifecycle script stdio.
|
|
6
|
+
// TWO MODES:
|
|
9
7
|
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
8
|
+
// 1. Global install (npm install -g a2acalling):
|
|
9
|
+
// - Silently runs quickstart to start the server and save config
|
|
10
|
+
// - Installs Claude Code skills into INIT_CWD (if available)
|
|
11
|
+
// - Prints getting-started summary
|
|
13
12
|
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
13
|
+
// 2. Local install (npm install a2acalling):
|
|
14
|
+
// - Installs Claude Code skills (.claude/commands/) into the project
|
|
15
|
+
// - Prints getting-started summary so the assisting agent has context
|
|
16
|
+
// - Does NOT start the server (local installs are usually for development)
|
|
17
17
|
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
18
|
+
// The verbose onboarding (disclosure prompt, workspace scan) happens when the
|
|
19
|
+
// agent runs `a2a quickstart` — enforceOnboarding detects incomplete setup
|
|
20
|
+
// and runs the full flow inline with direct stdio.
|
|
20
21
|
// ============================================================================
|
|
21
22
|
|
|
22
23
|
if (process.env.CI || process.env.CONTINUOUS_INTEGRATION) process.exit(0);
|
|
23
24
|
if (process.env.DOCKER) process.exit(0);
|
|
24
|
-
if (process.env.npm_config_global !== 'true') process.exit(0);
|
|
25
25
|
|
|
26
26
|
const path = require('path');
|
|
27
|
+
const os = require('os');
|
|
27
28
|
const { spawnSync } = require('child_process');
|
|
28
29
|
|
|
30
|
+
const isGlobal = process.env.npm_config_global === 'true';
|
|
29
31
|
const initCwd = process.env.INIT_CWD || process.env.HOME || process.cwd();
|
|
30
32
|
const cliPath = path.join(__dirname, '..', 'bin', 'cli.js');
|
|
31
33
|
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
});
|
|
34
|
+
// ── Global install: silently run quickstart ──────────────────────────────
|
|
35
|
+
if (isGlobal) {
|
|
36
|
+
const result = spawnSync(process.execPath, [cliPath, 'quickstart'], {
|
|
37
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
38
|
+
cwd: initCwd,
|
|
39
|
+
env: {
|
|
40
|
+
...process.env,
|
|
41
|
+
A2A_WORKSPACE: process.env.A2A_WORKSPACE || initCwd
|
|
42
|
+
}
|
|
43
|
+
});
|
|
43
44
|
|
|
44
|
-
if (result.error) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
process.exit(0);
|
|
45
|
+
if (result.error) {
|
|
46
|
+
// Don't fail the install — the agent will get onboarding when it runs `a2a`.
|
|
47
|
+
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// ── Install skill files (both global and local) ─────────────────────────
|
|
50
51
|
installSkillFiles();
|
|
51
|
-
process.exit(result.status || 0);
|
|
52
52
|
|
|
53
|
-
//
|
|
53
|
+
// ── Print getting-started summary ───────────────────────────────────────
|
|
54
|
+
printGettingStarted();
|
|
55
|
+
|
|
56
|
+
process.exit(0);
|
|
57
|
+
|
|
58
|
+
// ── Helpers ─────────────────────────────────────────────────────────────
|
|
59
|
+
|
|
54
60
|
function installSkillFiles() {
|
|
55
61
|
try {
|
|
56
62
|
const { installSkills } = require('./install-skills');
|
|
@@ -59,3 +65,120 @@ function installSkillFiles() {
|
|
|
59
65
|
// Silent — skills can be installed later with `a2a skills`
|
|
60
66
|
}
|
|
61
67
|
}
|
|
68
|
+
|
|
69
|
+
function printGettingStarted() {
|
|
70
|
+
const isMac = os.platform() === 'darwin';
|
|
71
|
+
const pkg = require('../package.json');
|
|
72
|
+
|
|
73
|
+
const lines = [
|
|
74
|
+
'',
|
|
75
|
+
'╔══════════════════════════════════════════════════════════════╗',
|
|
76
|
+
'║ A2A Calling — Installed ║',
|
|
77
|
+
'╚══════════════════════════════════════════════════════════════╝',
|
|
78
|
+
'',
|
|
79
|
+
` Version: ${pkg.version}`,
|
|
80
|
+
'',
|
|
81
|
+
' ── Getting Started ──────────────────────────────────────────',
|
|
82
|
+
'',
|
|
83
|
+
' 1. Run onboarding (REQUIRED first step):',
|
|
84
|
+
'',
|
|
85
|
+
' a2a quickstart',
|
|
86
|
+
'',
|
|
87
|
+
' This starts the A2A server, detects your hostname,',
|
|
88
|
+
' and prompts you to configure what your agent shares.',
|
|
89
|
+
'',
|
|
90
|
+
' 2. Create an invite to share with other agents:',
|
|
91
|
+
'',
|
|
92
|
+
' a2a create --name "YourAgent" --tier public --expires 7d',
|
|
93
|
+
'',
|
|
94
|
+
' 3. Add a contact and call them:',
|
|
95
|
+
'',
|
|
96
|
+
' a2a add "a2a://host/fed_xxx" "AgentName"',
|
|
97
|
+
' a2a call "AgentName" "Hello!"',
|
|
98
|
+
'',
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
if (isMac) {
|
|
102
|
+
lines.push(
|
|
103
|
+
' ── Native macOS App ─────────────────────────────────────────',
|
|
104
|
+
'',
|
|
105
|
+
' A native Callbook app is available for macOS:',
|
|
106
|
+
'',
|
|
107
|
+
' a2a app install',
|
|
108
|
+
'',
|
|
109
|
+
' Installs to ~/Applications/A2A Callbook.app',
|
|
110
|
+
' (Downloads pre-built binary from GitHub releases)',
|
|
111
|
+
'',
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
lines.push(
|
|
116
|
+
' ── Full CLI Reference ───────────────────────────────────────',
|
|
117
|
+
'',
|
|
118
|
+
' Onboarding & Setup:',
|
|
119
|
+
' a2a quickstart First-time setup (port, hostname, disclosure)',
|
|
120
|
+
' a2a quickstart --force Re-run onboarding from scratch',
|
|
121
|
+
' a2a setup Auto setup (gateway-aware dashboard install)',
|
|
122
|
+
' a2a status <url> Check A2A agent status',
|
|
123
|
+
' a2a version Show installed version',
|
|
124
|
+
'',
|
|
125
|
+
' Tokens & Invites:',
|
|
126
|
+
' a2a create [options] Create an invite token',
|
|
127
|
+
' --name, -n NAME Token label',
|
|
128
|
+
' --tier, -p TIER public | friends | family',
|
|
129
|
+
' --expires DURATION 1h | 1d | 7d | 30d | never',
|
|
130
|
+
' a2a list List active tokens',
|
|
131
|
+
' a2a revoke <id> Revoke a token',
|
|
132
|
+
'',
|
|
133
|
+
' Contacts & Calling:',
|
|
134
|
+
' a2a add <url> [name] Add a contact from invite URL',
|
|
135
|
+
' a2a contacts List all contacts',
|
|
136
|
+
' a2a call <contact> <msg> Call a contact (multi-turn)',
|
|
137
|
+
' --single One-shot call (no back-and-forth)',
|
|
138
|
+
' a2a ping <url> Check if agent is reachable',
|
|
139
|
+
'',
|
|
140
|
+
' Dashboard & GUI:',
|
|
141
|
+
' a2a gui Open dashboard in browser',
|
|
142
|
+
' a2a gui --tab logs Open specific tab',
|
|
143
|
+
'',
|
|
144
|
+
' Server:',
|
|
145
|
+
' a2a server --port 3001 Start server manually',
|
|
146
|
+
' a2a update Update to latest version',
|
|
147
|
+
' a2a uninstall Stop server and remove config',
|
|
148
|
+
'',
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
if (isMac) {
|
|
152
|
+
lines.push(
|
|
153
|
+
' Native App (macOS):',
|
|
154
|
+
' a2a app status Check native app installation',
|
|
155
|
+
' a2a app install Install/update from GitHub releases',
|
|
156
|
+
' a2a app uninstall Remove from ~/Applications',
|
|
157
|
+
'',
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
lines.push(
|
|
162
|
+
' Skills:',
|
|
163
|
+
' a2a skills Install Claude Code + Codex skills',
|
|
164
|
+
' a2a skills --force Overwrite existing skill files',
|
|
165
|
+
'',
|
|
166
|
+
' ── Claude Code Skills Installed ────────────────────────────',
|
|
167
|
+
'',
|
|
168
|
+
' The following slash commands are now available:',
|
|
169
|
+
' /a2a-setup — Run onboarding or reset configuration',
|
|
170
|
+
' /a2a-call — Call another A2A agent',
|
|
171
|
+
' /a2a-invite — Create and share an invite token',
|
|
172
|
+
' /a2a-contacts — List and manage contacts',
|
|
173
|
+
' /a2a-status — Check server and agent health',
|
|
174
|
+
'',
|
|
175
|
+
'══════════════════════════════════════════════════════════════',
|
|
176
|
+
'',
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
// Print to stderr — npm v7+ captures stdout from lifecycle scripts,
|
|
180
|
+
// but stderr is still visible in many agent contexts
|
|
181
|
+
console.error(lines.join('\n'));
|
|
182
|
+
// Also print to stdout for contexts where stderr is filtered
|
|
183
|
+
console.log(lines.join('\n'));
|
|
184
|
+
}
|