aria-connect 0.0.0-stage → 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.
Files changed (42) hide show
  1. package/README.md +42 -2
  2. package/bin/aria-connect.js +60 -0
  3. package/claude-marketplace/.claude-plugin/marketplace.json +17 -0
  4. package/claude-marketplace/plugin/.claude-plugin/plugin.json +36 -0
  5. package/claude-marketplace/plugin/.mcp.json +12 -0
  6. package/claude-marketplace/plugin/README.md +262 -0
  7. package/claude-marketplace/plugin/bin/aria_cc_gate.py +446 -0
  8. package/claude-marketplace/plugin/bin/aria_connect.py +213 -0
  9. package/claude-marketplace/plugin/bin/aria_credentials.py +208 -0
  10. package/claude-marketplace/plugin/bin/aria_disconnect.py +165 -0
  11. package/claude-marketplace/plugin/bin/aria_headers.py +95 -0
  12. package/claude-marketplace/plugin/bin/aria_hook_event.py +73 -0
  13. package/claude-marketplace/plugin/bin/aria_preflight.py +122 -0
  14. package/claude-marketplace/plugin/bin/aria_session_reporter.py +167 -0
  15. package/claude-marketplace/plugin/bin/aria_session_state.py +181 -0
  16. package/claude-marketplace/plugin/bin/aria_status.py +150 -0
  17. package/claude-marketplace/plugin/bin/aria_turn_end.py +262 -0
  18. package/claude-marketplace/plugin/bin/aria_watch.py +992 -0
  19. package/claude-marketplace/plugin/hooks/hooks.json +76 -0
  20. package/claude-marketplace/plugin/skills/connect/SKILL.md +77 -0
  21. package/claude-marketplace/plugin/skills/disconnect/SKILL.md +54 -0
  22. package/claude-marketplace/plugin/skills/status/SKILL.md +118 -0
  23. package/claude-marketplace/plugin/skills/unwatch/SKILL.md +50 -0
  24. package/claude-marketplace/plugin/skills/watch/SKILL.md +94 -0
  25. package/codex/aria_credentials.py +208 -0
  26. package/codex/aria_delegate_mcp.py +2656 -0
  27. package/codex/aria_turn_end.py +262 -0
  28. package/codex/cc_scrub.py +296 -0
  29. package/codex/codex_session.py +282 -0
  30. package/lib/acp.js +77 -0
  31. package/lib/api.js +75 -0
  32. package/lib/bridge.js +373 -0
  33. package/lib/creds.js +77 -0
  34. package/lib/ide_hooks.js +197 -0
  35. package/lib/install_claude.js +73 -0
  36. package/lib/install_codex.js +125 -0
  37. package/lib/install_cursor.js +151 -0
  38. package/lib/pair.js +78 -0
  39. package/lib/phone.js +62 -0
  40. package/lib/risky.js +24 -0
  41. package/lib/sys.js +38 -0
  42. package/package.json +24 -4
package/README.md CHANGED
@@ -1,3 +1,43 @@
1
- # Temporary Holding Version
1
+ # aria-connect
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Pair a computer with the Aria app, then drive Claude Code or Cursor on it from
4
+ your phone (text or voice).
5
+
6
+ ```
7
+ npx aria-connect ABCDE-FGHJK # the code from the app: Connect a computer
8
+ ```
9
+
10
+ It stores your key in `~/.aria/credentials` (0600) and sets up what it finds:
11
+
12
+ | | What it installs |
13
+ |---|---|
14
+ | Claude Code | the Aria plugin (shipped in this package) + the `aria-delegate` MCP, via the `claude` CLI. The MCP needs [`uv`](https://docs.astral.sh/uv/). Then start sessions with `claude --dangerously-load-development-channels server:aria-delegate`. |
15
+ | Cursor | `~/.cursor/mcp.json` (Aria memory), `~/.cursor/hooks.json` (IDE mode), `.cursor/rules/aria.mdc` in the current project. Existing config is merged, never replaced; a file it cannot parse is left alone. |
16
+ | Codex CLI | `$CODEX_HOME/config.toml` (the `aria-delegate` MCP, `ARIA_VENDOR=codex`) and `$CODEX_HOME/hooks.json` (SessionStart / UserPromptSubmit / Stop). Needs [`uv`](https://docs.astral.sh/uv/) and `python3`; the scripts ship in this package and are copied to `~/.aria/codex`. On first start Codex asks to trust the hooks: pick "Trust all". Then just run `codex`; after your first message the session shows in the app as "Codex · <folder>" and your phone's words land in the open TUI via `codex queue`. Its watcher exits when the thread closes. Replies, `aria_say`, `aria_call_me`, session switching all work. |
17
+
18
+ Run it again with a new code at any time; it changes nothing it already set up.
19
+ `aria-connect setup` redoes the setup with the saved key.
20
+
21
+ ## Cursor: two modes
22
+
23
+ - **Full — `aria-connect cursor [dir]`.** Runs Cursor's agent (`agent acp`) and
24
+ relays: your messages go in, its replies come out to the app, and every
25
+ permission it asks for comes to your phone as Approve/Deny. No answer in 5
26
+ minutes, or Aria unreachable, is a no. Needs the Cursor CLI (`agent`) and
27
+ `agent login`. `ARIA_ACP_AGENT` overrides the command.
28
+ - **IDE — partial.** Cursor's editor has no way to push a message into a chat.
29
+ Your phone messages are handed in when the chat's current turn ends (the
30
+ `stop` hook), so an idle chat hears nothing until something runs in it. A
31
+ risky command (git push, rm, deploy…) waits for your phone only while you are
32
+ driving that chat from it; otherwise Cursor asks at the keyboard as usual.
33
+ The hooks only ever add a question; they never approve anything on their own.
34
+
35
+ ## Tests
36
+
37
+ ```
38
+ node --test test/*.test.js
39
+ npm run sync # from the Aria repo: refresh codex/ and claude-marketplace/
40
+ ```
41
+
42
+ The bridge is tested against `test/fake_agent_acp.js`, a stdio JSON-RPC stub
43
+ of `agent acp`, and a fake backend.
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const USAGE = `aria-connect — drive Claude Code, Cursor or Codex on this computer from the Aria app
5
+
6
+ aria-connect <CODE> pair this computer (the code is in the app: Connect a computer)
7
+ aria-connect setup re-run the Claude Code / Cursor / Codex setup with the saved key
8
+ aria-connect cursor [dir] run the Cursor agent (agent acp) so the phone can drive it
9
+ `;
10
+
11
+ async function main(argv) {
12
+ const [cmd, ...rest] = argv;
13
+ if (!cmd || cmd === '-h' || cmd === '--help') {
14
+ process.stdout.write(USAGE);
15
+ return cmd ? 0 : 1;
16
+ }
17
+ if (cmd === 'cursor-hook') {
18
+ return require('../lib/ide_hooks').main(rest[0]);
19
+ }
20
+ if (cmd === 'cursor') {
21
+ const creds = require('../lib/creds');
22
+ if (!creds.apiKey()) {
23
+ console.error('Not paired yet. Run: npx aria-connect <CODE> (the code is in the Aria app).');
24
+ return 1;
25
+ }
26
+ const { Bridge } = require('../lib/bridge');
27
+ const agent = (process.env.ARIA_ACP_AGENT || 'agent acp').split(/\s+/).filter(Boolean);
28
+ const bridge = new Bridge({ cwd: require('path').resolve(rest[0] || process.cwd()), agent, log: console.error });
29
+ return bridge.run();
30
+ }
31
+ if (cmd === 'setup') {
32
+ const creds = require('../lib/creds');
33
+ const key = creds.apiKey();
34
+ if (!key) {
35
+ console.error('Not paired yet. Run: npx aria-connect <CODE> (the code is in the Aria app).');
36
+ return 1;
37
+ }
38
+ const ctx = { key, backend: creds.backendUrl(), mcpUrl: creds.mcpUrl(), cwd: process.cwd() };
39
+ let any = false;
40
+ for (const [name, mod] of [['Claude Code', require('../lib/install_claude')], ['Cursor', require('../lib/install_cursor')], ['Codex', require('../lib/install_codex')]]) {
41
+ if (!mod.detect(ctx)) continue;
42
+ any = true;
43
+ console.log(`${name}:`);
44
+ for (const s of mod.install(ctx)) console.log(` - ${s}`);
45
+ }
46
+ if (!any) console.log('No Claude Code, Cursor or Codex found on this machine.');
47
+ return 0;
48
+ }
49
+ const res = await require('../lib/pair').pair(argv.join(' '));
50
+ if (!res.ok) {
51
+ console.error(`Not connected. ${res.message}`);
52
+ return 1;
53
+ }
54
+ return 0;
55
+ }
56
+
57
+ main(process.argv.slice(2)).then(
58
+ (code) => { process.exitCode = code; },
59
+ (e) => { console.error(`aria-connect: ${e && e.stack ? e.stack : e}`); process.exitCode = 1; },
60
+ );
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "aria",
3
+ "description": "Aria's plugin for Claude Code, installed by aria-connect.",
4
+ "owner": {
5
+ "name": "Aria",
6
+ "url": "https://aria.paralleluniverse.ai"
7
+ },
8
+ "plugins": [
9
+ {
10
+ "name": "aria",
11
+ "source": "./plugin",
12
+ "description": "Connect Claude Code to Aria. She reads your memory before planning, queues work to this session by voice or text, and texts you the result.",
13
+ "category": "productivity",
14
+ "homepage": "https://aria.paralleluniverse.ai"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "aria",
3
+ "description": "Connect Claude Code to Aria. She reads your memory before planning, queues work to this session by voice or text, and texts you the result. Adds a Stop hook so she can see what this session is doing.",
4
+ "version": "0.3.1",
5
+ "author": {
6
+ "name": "Aria"
7
+ },
8
+ "homepage": "https://aria.paralleluniverse.ai",
9
+ "license": "proprietary",
10
+ "keywords": [
11
+ "aria",
12
+ "memory",
13
+ "delegate",
14
+ "voice"
15
+ ],
16
+ "userConfig": {
17
+ "api_key": {
18
+ "type": "string",
19
+ "title": "Aria API key",
20
+ "description": "Optional. Leave this empty and run /aria:connect with the setup link Aria texts you - it stores the key in ~/.aria/credentials for you. Set it here only if you already hold an aria_sk_ key and would rather keep it in the OS keychain. A key set here wins over the file.",
21
+ "sensitive": true
22
+ },
23
+ "mcp_url": {
24
+ "type": "string",
25
+ "title": "Aria MCP endpoint",
26
+ "description": "The remote MCP server. Leave the default unless you are testing against your own deployment.",
27
+ "default": "https://mcp.aria.paralleluniverse.ai/mcp"
28
+ },
29
+ "backend_url": {
30
+ "type": "string",
31
+ "title": "Aria backend",
32
+ "description": "REST backend the Stop hook posts session summaries to. Different host from the MCP endpoint; leave the default.",
33
+ "default": "https://api.aria.paralleluniverse.ai"
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "mcpServers": {
3
+ "aria": {
4
+ "type": "http",
5
+ "url": "${user_config.mcp_url}",
6
+ "headers": {
7
+ "Authorization": "Bearer ${user_config.api_key}"
8
+ },
9
+ "headersHelper": "python3 bin/aria_headers.py"
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,262 @@
1
+ # Aria for Claude Code
2
+
3
+ Aria is an AI that calls and texts you. This plugin connects her to Claude Code:
4
+ Claude Code reads Aria's memory of you before it plans anything, and Aria can
5
+ queue work to this session and text you the result.
6
+
7
+ ## Install
8
+
9
+ **Needs Claude Code 2.1.280 or newer.** Below that this plugin does not load at
10
+ all — no `aria_*` tools, no hooks, and no error telling you why. Check with
11
+ `claude --version`.
12
+
13
+ Easiest: open **Connect a computer** in the Aria app and run the command it
14
+ shows (`npx aria-connect <CODE>`). It installs this plugin and the
15
+ `aria-delegate` MCP for you.
16
+
17
+ From a checkout of the Aria repo instead:
18
+
19
+ ```
20
+ claude plugin marketplace add ./aria # the path to that checkout
21
+ claude plugin install aria@aria
22
+ ```
23
+
24
+ Or run it for one session without installing anything:
25
+
26
+ ```
27
+ claude --plugin-dir ./aria/packages/claude-code-plugin
28
+ ```
29
+
30
+ Then text Aria **"connect my claude code"**. She replies with a link — paste it
31
+ into the session:
32
+
33
+ ```
34
+ /aria:connect https://aria.paralleluniverse.ai/connect/<code>
35
+ /reload-plugins
36
+ /aria:status
37
+ ```
38
+
39
+ `/aria:status` prints six lines and names anything that is broken. That is the
40
+ whole setup.
41
+
42
+ **Nothing is installed locally.** No `uv`, no packages. The tools run on Aria's
43
+ server; the only local requirement is `python3` on PATH.
44
+
45
+ ## The five commands
46
+
47
+ | | |
48
+ |---|---|
49
+ | `/aria:connect <link>` | redeem the setup link and store the key |
50
+ | `/aria:status` | what is connected and what is not |
51
+ | `/aria:watch` | let Aria see what THIS repo's sessions do (off by default) |
52
+ | `/aria:unwatch` | stop that |
53
+ | `/aria:disconnect` | remove the key; MCP, presence and hooks all go dark |
54
+
55
+ ## Letting Aria see what a repo's sessions do
56
+
57
+ Connecting lets Aria read your memory and target this session. It does **not**
58
+ let her see the work. That is a separate switch, it is per repo, and it is gated
59
+ on consent:
60
+
61
+ ```
62
+ /aria:watch # shows the consent screen. Turns nothing on.
63
+ /aria:watch yes # records the consent, checks it will work, then starts
64
+ /aria:unwatch # withdraws the consent and stops
65
+ ```
66
+
67
+ On the default `mcp` transport, each field is templated individually, so this is
68
+ what crosses the wire and there is nothing else in the payload:
69
+
70
+ **Sent** — your shell command *lines*, the *paths* of files you write or edit,
71
+ commit SHAs, the working directory, a session id, your assistant's last message
72
+ as a turn summary, and — for a command that **fails** — the error text Claude
73
+ Code reports for it, which is that command's own error output, read for the exit
74
+ code.
75
+
76
+ **Never sent** — file contents, not one byte. The output of any command that
77
+ succeeds. Anything from Read, Grep, Glob, Task, WebFetch, WebSearch or TodoWrite,
78
+ or any MCP tool: those are not watched at all.
79
+
80
+ `/aria:watch yes` sends one live test event before it claims anything, and prints
81
+ a refusal instead of a tick if Aria's server would discard what this repo sends.
82
+
83
+ ---
84
+
85
+ Everything below is detail. You do not need it to get running.
86
+
87
+ ## What this plugin does NOT do
88
+
89
+ It does not let Aria run work on your machine while you're away — the thing
90
+ people install this hoping for.
91
+
92
+ Both halves are passive. The MCP connection only looks for queued work when the
93
+ model calls `aria_next_task`, which happens while *you* are driving a session.
94
+ The hooks only fire when something runs. Neither polls. Text Aria from the car
95
+ and the task sits until it expires.
96
+
97
+ That needs an always-on executor (`scripts/start_code_worker.sh` in the Aria
98
+ repo, not in this plugin, because a plugin cannot run a background process). It
99
+ is a background agent with write access to your code, so it is deliberately not
100
+ something you get from one line of setup. It registers the canonical git remote
101
+ of the directory you point it at and is refused `kind='code'` work unless that
102
+ directory is a real git worktree — an executor with no repo runs your task in an
103
+ empty folder and reports "nothing was produced".
104
+
105
+ ## Where the key comes from
106
+
107
+ An `aria_sk_` account key, minted under a real login — never by another key, so a
108
+ leaked key cannot mint more. You never handle it:
109
+
110
+ ```
111
+ you → Aria: "connect my claude code"
112
+ Aria → you: https://aria.paralleluniverse.ai/connect/<code> (single use, 15 min)
113
+ you : /aria:connect <that link>
114
+ ```
115
+
116
+ The link carries no credential. The key is minted **at redemption**, returned
117
+ once, and written to `~/.aria/credentials` (0600). The server keeps a sha256 hash.
118
+ Redeeming twice returns `410`, atomically (Redis `GETDEL`), so two concurrent
119
+ opens cannot both mint.
120
+
121
+ Lost it? Ask for a new link; the old key works until revoked. The key **is** your
122
+ identity to the server: every tool derives `user_id` from the verified token and
123
+ none takes a `user_id` argument, so there is no way — even for a confused model —
124
+ to ask about someone else.
125
+
126
+ ### If you'd rather paste a key
127
+
128
+ `/plugin` → **aria** → **Aria API key** works and **takes precedence over the
129
+ file**. It is `sensitive`, so it lands in the OS keychain, not in `settings.json`.
130
+ This is also the fallback on a client too old for `headersHelper`.
131
+
132
+ If you reconnect and the old key keeps failing, that stale keychain entry is why —
133
+ `/aria:status` prints which source is in play.
134
+
135
+ ## The tools
136
+
137
+ Six read Aria's memory of you; two are the work channel. No count in prose — this
138
+ said "8" long enough to be wrong by three. `_EXPECTED_TOOLS` in
139
+ `services/backend/tests/test_mcp_remote.py` is the one place that knows.
140
+
141
+ | Tool | What it does |
142
+ |---|---|
143
+ | `aria_recall(query, k=8)` | Semantic search across your memory. The one to reach for: ground a plan in what you actually think, prefer, and have already tried. |
144
+ | `aria_entities(limit=30)` | The people, projects and places Aria knows about, ranked by how often they come up. |
145
+ | `aria_entity(name, limit=20)` | Everything Aria knows about one of them. |
146
+ | `aria_journal(limit=10)` | Recent dated digests of your conversations with Aria. |
147
+ | `aria_todos(limit=20)` | Your open commitments and their deadlines. |
148
+ | `aria_vitals()` | Aria's read on your current state, themes and patterns. Cached ~10 min. |
149
+ | `aria_next_task()` | Claim the next task Aria queued **for this session**. |
150
+ | `aria_submit_result(task_id, summary, …)` | Hand the result back. `artifact_b64` uploads one file (1 MB cap). |
151
+
152
+ `aria_session_turn`, `aria_session_event` and `aria_progress` also exist; Claude
153
+ Code calls the first two from the `/aria:watch` hooks, so `claude mcp list` shows
154
+ more tools than an agent can reach. Results cap at 24 KB. Everything except
155
+ `aria_submit_result` is read-only.
156
+
157
+ ## Why a hook, and not just a tool
158
+
159
+ An MCP tool is called **by** the session and cannot read it — no transcript, no
160
+ cwd, no sense of what you asked for. And a tool the model *chooses* to call is one
161
+ a model busy finishing does not call: a real session worked an objective to
162
+ completion and reported nothing.
163
+
164
+ A hook is the inverse. Claude Code fires it whether or not the model cooperates.
165
+
166
+ **What the receipts prove:** they defeat *forgetting*, not lying. A hook fires
167
+ whether or not the model decides to report. But `commit_sha` is an argument a
168
+ model could pass, and on the HTTP transport a session with a shell can read its
169
+ own key — so a receipt is *what the session said it did*, corroborated by
170
+ something having run. Not an independently verified fact.
171
+
172
+ `--transport http` still exists, needs `ARIA_API_KEY` exported, does not watch
173
+ file edits, and does send a command's output (read for an exit code, not stored).
174
+ `/aria:watch` says so and refuses to claim the stream is on without the key.
175
+
176
+ `/aria:unwatch` withdraws the consent and removes the hooks. It does **not delete
177
+ what was already recorded** — ask Aria for that. Hooks load at session start, so
178
+ both take effect after `/reload-plugins`.
179
+
180
+ ## Turning it off
181
+
182
+ ```
183
+ /aria:unwatch # stop streaming what THIS repo's sessions do
184
+ /aria:disconnect # remove the local key: MCP, presence and hooks go dark
185
+ /plugin disable aria # stop the plugin running at all
186
+ ```
187
+
188
+ `/aria:disconnect` also **revokes the key on Aria's side**
189
+ (`DELETE /v1/delegate/keys/self`), so a copy taken off this machine stops working.
190
+ Revocation happens *before* the file is deleted — if it fails, the key is left in
191
+ place so you can retry, because deleting it first throws away the only credential
192
+ that can revoke itself. `--local-only` skips the revocation deliberately. It also
193
+ tells you if a key in `/plugin` or `$ARIA_API_KEY` is still shadowing the file,
194
+ because that would leave you connected while believing you weren't.
195
+
196
+ A key may revoke only *itself*: the route is authenticated by the key and names no
197
+ key, so a stolen key can do nothing with it but destroy the access it stole.
198
+
199
+ ## Presence
200
+
201
+ The server registers your session off the MCP connection itself, not a poll. The
202
+ transport's `Mcp-Session-Id` (from the `initialize` **response** header, under the
203
+ authenticated principal) becomes a `delegate_instances` row. The held GET stream
204
+ ending marks it stale; a 90 s heartbeat TTL is the backstop.
205
+
206
+ Honest limit: process death is detected sub-second because the socket closes. A
207
+ **closed laptop or dropped WiFi sends nothing** — that connection goes half-open
208
+ and detection falls back to TCP keepalive, bounded by the 90 s TTL.
209
+
210
+ Full mechanics: [`docs/mcp-server.md`](../../docs/mcp-server.md).
211
+
212
+ ## Without the plugin
213
+
214
+ The MCP half is a plain remote server, so any client speaking Streamable HTTP with
215
+ custom headers can use it:
216
+
217
+ ```bash
218
+ claude mcp add --transport http aria https://mcp.aria.paralleluniverse.ai/mcp \
219
+ --header "Authorization: Bearer aria_sk_..."
220
+ ```
221
+
222
+ You get every tool and presence. You give up the hooks and the `/aria:*` commands.
223
+
224
+ ## What's in this directory
225
+
226
+ ```
227
+ .claude-plugin/plugin.json manifest + userConfig (api_key / mcp_url / backend_url)
228
+ .mcp.json the remote server: type=http, url, Bearer, headersHelper
229
+ hooks/hooks.json SessionStart only — the stream is per-repo, see /aria:watch
230
+ bin/aria_credentials.py ONE definition of where the key lives, and the client floor
231
+ bin/aria_headers.py the MCP headersHelper — emits the Authorization header
232
+ bin/aria_connect.py /aria:connect — redeems the setup link, writes the key
233
+ bin/aria_disconnect.py /aria:disconnect — removes it, and says what it cannot revoke
234
+ bin/aria_status.py the local half of /aria:status
235
+ bin/aria_preflight.py SessionStart — says "not connected" in actionable words
236
+ bin/aria_session_reporter.py UNWIRED — the old global Stop hook, kept for the non-plugin rig
237
+ bin/aria_watch.py /aria:watch and /aria:unwatch — the per-repo event stream
238
+ skills/*/SKILL.md the five commands
239
+ ```
240
+
241
+ The plugin's own global `Stop` hook was **unwired**: it streamed every session you
242
+ ever ran the moment you installed, and once the server's `aria_session_turn` hook
243
+ landed it produced two rows for one turn. Turn summaries now come from
244
+ `/aria:watch`, per repo.
245
+
246
+ `mcp_url` and `backend_url` are separate on purpose: the MCP server is its own
247
+ single-instance Cloud Run service (sessions live in a per-process dict, so it
248
+ cannot scale horizontally); the REST backend is the autoscaled `aria-backend`.
249
+
250
+ ## Development
251
+
252
+ ```bash
253
+ claude --plugin-dir . # load locally without installing
254
+ claude plugin validate . --strict # manifest check, warnings fatal
255
+ ```
256
+
257
+ Point at a local backend via `/plugin` → aria, or `ARIA_BACKEND_URL` for the hook.
258
+
259
+ Server side: `services/backend/aria_backend/mcp_server/` — `app.py`, `auth.py`,
260
+ `tools.py`, `presence.py`, `delegate_bridge.py`. Tests:
261
+ `services/backend/tests/test_mcp_remote.py`, `test_watch_consent.py`,
262
+ `test_watch_plugin_truth.py`.