@aiaiai-pt/martha-cli 0.51.7 → 0.53.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 (3) hide show
  1. package/CHANGELOG.md +72 -1
  2. package/dist/index.js +1257 -34
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,7 +2,78 @@
2
2
 
3
3
  All notable changes to `@aiaiai-pt/martha-cli`. Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This project adheres to semver — `0.x` releases may include breaking changes between minor versions.
4
4
 
5
- ## [Unreleased]
5
+ ## [0.53.0] — 2026-08-02
6
+
7
+ ### Added — `martha channels`: connect an agent to a channel from either side (#1140)
8
+
9
+ - `martha channels install-harness buzz` registers Martha as a **runtime** in
10
+ Buzz Desktop — a tier-3 custom harness definition written into Desktop's
11
+ app-data dir (auto-detected per platform, release or dev build; `--print`,
12
+ `--app-data`, `--force`). The user then picks **Martha** in New agent and sets
13
+ `MARTHA_CLIENT_ID`/`MARTHA_CLIENT_SECRET` per agent in Edit Agent. Desktop
14
+ keeps ownership of the keypair, the NIP-OA attestation, spawning and channel
15
+ attachment; we contribute a definition and the adapter, nothing else. The
16
+ definition pins `BUZZ_ACP_MULTIPLE_EVENT_HANDLING=queue` — Desktop's `steer`
17
+ cancels the in-flight turn, which is right for a local LLM and wrong for a
18
+ remote Martha turn.
19
+ - `martha channels connect buzz` and `martha channels preflight buzz` — the
20
+ same setup starting from Martha. Preflight checks every precondition (both
21
+ binaries, that the `martha` on PATH actually has `acp-serve`, API + credential,
22
+ agent existence/hosting/takeover, its principal, relay reachability, the
23
+ channel identity, and membership) and names the one command that fixes each
24
+ gap. It **exits non-zero rather than half-starting**, and reports a check it
25
+ could not evaluate as WARN rather than claiming the thing is missing.
26
+ `--emit docker|compose|k8s` prints a deployable unit with secrets referenced
27
+ instead of inlined; `--dry-run` shows the launch without starting it.
28
+
29
+ ### Fixed — a service-account invocation could run as a logged-in human
30
+
31
+ - With `MARTHA_CLIENT_ID`/`MARTHA_CLIENT_SECRET` set, the CLI reused whatever
32
+ token was stored for the profile if it was still valid — including a human
33
+ token left by an earlier `martha auth login`. A long-running adapter then
34
+ answered as the developer instead of as its agent, and chat takeover never
35
+ fired. A stored token is now only reused when it belongs to the same client
36
+ (`auth_type` + the JWT's `azp`), which is what the documented auth precedence
37
+ always said. Found by running `martha channels connect` on a real relay.
38
+ - `agents doctor` reported a correctly-bound agent as unbound on any tenant with
39
+ more than 25 clients: the client scan was capped at 25 and swallowed per-client
40
+ errors. The scan now walks the whole list (bounded, with concurrency) and says
41
+ "inconclusive" when it cannot read all of it — an incomplete scan can never
42
+ justify "no client grants this agent", which was advice to mint a second
43
+ principal for an agent that already had one.
44
+ - A failed `client_credentials` login now raises an auth-typed error (exit 2)
45
+ instead of a generic one, so callers can tell "this credential is wrong" apart
46
+ from "the server is unreachable".
47
+
48
+ ### Added — `martha acp-serve`: ACP stdio bridge (#1117)
49
+
50
+ - New `acp-serve` command speaks the Agent Client Protocol (newline-delimited
51
+ JSON-RPC 2.0) over stdio so an ACP harness — Buzz's `buzz-acp`, Zed, or any
52
+ ACP client — can drive a Martha agent as its runtime. `session/new` opens a
53
+ Martha chat session, `session/prompt` sends the user message and re-emits
54
+ Martha's SSE tokens as `session/update` agent_message_chunk notifications,
55
+ `session/cancel` aborts the in-flight turn (`stopReason: "cancelled"`).
56
+ Mid-session Martha errors surface as ACP error results without killing the
57
+ process; unrecoverable startup errors (bad token, unreachable API) exit
58
+ non-zero with a clear stderr line for the harness's circuit breaker. All
59
+ logging is JSON lines on stderr — stdout carries only protocol frames.
60
+ - `--post-reply` (opt-in) posts the turn's final answer back to the triggering
61
+ Buzz channel via the `buzz` CLI — the same reply mechanism Buzz's own
62
+ agents use — parsing the channel and thread anchor from the prompt's
63
+ `[Context]` section. The shim itself never holds or signs with Nostr keys.
64
+ - `martha principals bootstrap` — the CLI now exposes the API's own principal
65
+ noun (`/principals/bootstrap`, #535) with three modes: `human` (what
66
+ `martha init` wraps), `integration` (headless service account), and `agent`
67
+ — a service account bound to ONE Martha-hosted agent via chat takeover, so
68
+ the credential acts as the agent. Agent mode is the one-shot an external
69
+ ACP driver needs: resolve-or-create the agent, provision the principal
70
+ (idempotent — same label returns the same secret), bind, and print the
71
+ `MARTHA_CLIENT_ID/SECRET` + harness env block. The same orchestration ships
72
+ as a "Provision principal" action in the admin UI agents page. (Agent mode
73
+ is composed client-side in v1; a follow-up promotes it server-side.)
74
+ - Fixed in review: `--api-url` now flows through `createContext` — mutating
75
+ `ctx.profile.api_url` after construction (the pattern elsewhere in the CLI)
76
+ never reaches the already-constructed API client.
6
77
 
7
78
  ## [0.51.5] — 2026-07-20
8
79