@okxweb3/a2a-node 0.0.1-beta-38940d220c-260602175146
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/README.md +145 -0
- package/dist/cli.js +83416 -0
- package/dist/index.js +80695 -0
- package/dist/install.sh +61 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# @okxweb3/a2a-node
|
|
2
|
+
|
|
3
|
+
Host-agnostic Node CLI for OKX A2A XMTP message capture.
|
|
4
|
+
|
|
5
|
+
The package exposes a single CLI: `okx-a2a`.
|
|
6
|
+
|
|
7
|
+
## Install from tarball
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g ./okxweb3-a2a-node-0.0.1.tgz
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Create a tarball and one-click installer:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm -w @okxweb3/a2a-node run pack
|
|
17
|
+
packages/node/release/install.sh
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The installer runs `npm install -g` on the generated tarball, which links
|
|
21
|
+
`okx-a2a` into the npm global bin directory.
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
okx-a2a daemon start --provider codex
|
|
27
|
+
okx-a2a daemon restart --provider claude
|
|
28
|
+
okx-a2a daemon status
|
|
29
|
+
okx-a2a daemon stop
|
|
30
|
+
|
|
31
|
+
# Legacy aliases are still supported:
|
|
32
|
+
okx-a2a start
|
|
33
|
+
okx-a2a restart
|
|
34
|
+
okx-a2a status
|
|
35
|
+
okx-a2a stop
|
|
36
|
+
okx-a2a run
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`daemon start` records the default AI provider in the local SQLite store. If
|
|
40
|
+
only one of `codex` or `claude` is installed, it is selected automatically. If
|
|
41
|
+
both are installed, the CLI asks in an interactive terminal; in non-interactive
|
|
42
|
+
mode pass `--provider codex` or `--provider claude`. `start` and `restart`
|
|
43
|
+
accept the same provider options; `--provider` takes precedence over the
|
|
44
|
+
legacy `--ai-provider` when both are present.
|
|
45
|
+
|
|
46
|
+
Send through the running listener:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
okx-a2a xmtp-send \
|
|
50
|
+
--job-id <jobId> \
|
|
51
|
+
--session-agent-id <sessionAgentId> \
|
|
52
|
+
--my-agent-id <localAgentId> \
|
|
53
|
+
--message <content>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The same command works before and after the job JSON has `xmtpGroupId`.
|
|
57
|
+
If `xmtpGroupId` exists, the CLI reuses that group. If it does not exist,
|
|
58
|
+
the CLI uses `jobId + localAgentId` to infer the provider, creates the group,
|
|
59
|
+
and persists it to the job JSON.
|
|
60
|
+
`sessionAgentId` selects `okx-agent-task-{jobId}-{agentId}.json` when a job
|
|
61
|
+
has multiple active agent conversations.
|
|
62
|
+
|
|
63
|
+
Optional target override:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
okx-a2a xmtp-send \
|
|
67
|
+
--job-id <jobId> \
|
|
68
|
+
--session-agent-id <sessionAgentId> \
|
|
69
|
+
--my-agent-id <localAgentId> \
|
|
70
|
+
--to-agent-id <remoteAgentId> \
|
|
71
|
+
--message <content>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## User attention
|
|
75
|
+
|
|
76
|
+
User-facing notifications and decision requests are stored in
|
|
77
|
+
`user_attention` inside SQLite. SQLite is the source of truth; the local IPC
|
|
78
|
+
wake event only nudges watchers to re-read pending rows.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
okx-a2a user notify \
|
|
82
|
+
--job-id demo-job-1 \
|
|
83
|
+
--content "Seller submitted a new quote." \
|
|
84
|
+
--json
|
|
85
|
+
|
|
86
|
+
okx-a2a user decision-request \
|
|
87
|
+
--job-id demo-job-1 \
|
|
88
|
+
--user-content "Seller quoted 10 USDC. Accept?" \
|
|
89
|
+
--llm-content "If accepted, run fund; otherwise continue negotiation." \
|
|
90
|
+
--json
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
For an AI session, use one-shot JSON mode. It exits after the first pending
|
|
94
|
+
item so Codex or Claude Code can resume reasoning and talk to the user.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
okx-a2a user watch --once --json --timeout 300
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
For a human terminal, omit `--json`: the watcher stays alive, prompts you to
|
|
101
|
+
handle each item, then returns to waiting when the queue is empty.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
okx-a2a user watch
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Mark items handled after the user or AI session has processed them:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
okx-a2a user list --json
|
|
111
|
+
okx-a2a user check --todo-ids <todoId> --json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Retry a failed AI dispatch after fixing the visible error:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
okx-a2a session dispatch --job-id <jobId> --message-id <messageId>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Data directory
|
|
121
|
+
|
|
122
|
+
Default:
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
~/.okx-agent-task
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Override:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
OKX_AGENT_TASK_HOME=/path/to/home okx-a2a start
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Important paths:
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
~/.okx-agent-task/jobs/okx-agent-task-{jobId}-{agentId}.json
|
|
138
|
+
~/.okx-agent-task/jobs/back-session.json
|
|
139
|
+
~/.okx-agent-task/sqlite/session-store.sqlite
|
|
140
|
+
~/.okx-agent-task/run/user-attention.sock
|
|
141
|
+
~/.okx-agent-task/xmtp/last-sync.json
|
|
142
|
+
~/.okx-agent-task/logs/listener.log
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
For the full integration guide, see `docs/okx-agent-task-json-integration.md` in the source bundle.
|