Skip to content

feat: cueapi message-to <name> + agents list --online-only + agents describe alias#40

Merged
govindkavaturi-art merged 1 commit into
mainfrom
feat/message-to-online-only-describe
May 6, 2026
Merged

feat: cueapi message-to <name> + agents list --online-only + agents describe alias#40
govindkavaturi-art merged 1 commit into
mainfrom
feat/message-to-online-only-describe

Conversation

@mikemolinet
Copy link
Copy Markdown
Collaborator

Summary

Three server-independent CLI additions ahead of the agents-roster endpoint, per CTO greenlight (token CTO-AGENT-DIR-CLI-V2-GREENLIGHT, 2026-05-05).

  • cueapi message-to <recipient> — universal wrapper. Resolves <recipient> against the calling key's roster:

    • agent_id (agt_*) and slug-form (slug@user) pass through unchanged — no extra round-trip.
    • Bare names match case-insensitive against display_name and slug via GET /agents. Zero matches errors with the roster as a hint. Multiple matches errors with candidate IDs and tells users to disambiguate via messages send --to.

    Reuses the existing POST /messages request shape and response handling (idempotency 200/201, 409 conflict messaging, X-CueAPI-Priority-Downgraded surfacing). Same flag set as messages send, sans --to.

  • agents list --online-only — shortcut for --status online. Mutually exclusive with --status. Server already supports the filter; the flag is just a friendlier surface.

  • agents describe <ref> — alias for agents get <ref>. Same --include-deleted flag; defers to agents_get.

Why now (sequencing)

Q8 (universal cueapi message-to over per-agent scripts) is canonical — per-agent scripts repeat the agents-directory.json anti-pattern, force per-onboarding migrations, and don't compose with Surface 5's append-system-prompt content.

The 4th Q7 delta — last_seen_at / online surfacing + agents roster debug — backfills after the server-side Surface 1 endpoint ships (in-flight on feat/agents-last-seen-at in the hosted repo). No dependencies between this PR and that work.

Test plan

  • pytest tests/ — 169/169 pass (19 new: 3 --online-only, 2 describe, 14 message-to covering pass-through, display-name match, slug match, no-match with roster hint, ambiguous match, optionals end-to-end, default-omit discipline, click validation)
  • Manual --help walk-through — top-level lists message-to, agents lists describe, agents list lists --online-only with mutual-exclusion note
  • Once merged to cueapi-cli main, advertise the wrapper in Surface 5 system-prompt content

🤖 Generated with Claude Code

Copy link
Copy Markdown
Member

@govindkavaturi-art govindkavaturi-art left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New cueapi message-to ergonomic command + agents list --online-only + agents describe alias. Approve.

…escribe alias

Three server-independent CLI additions ahead of the agents-roster
endpoint (CTO greenlight 2026-05-05, token
CTO-AGENT-DIR-CLI-V2-GREENLIGHT).

- `cueapi message-to <recipient>` top-level wrapper. Resolves
  <recipient> against the calling key's agent roster:
  - agent_id (`agt_*`) and slug-form (`slug@user`) pass through
    unchanged — no lookup, no extra round-trip.
  - bare names match case-insensitive against `display_name` and
    `slug` via `GET /agents`. Zero matches errors with the roster.
    Multiple matches errors with the candidate IDs and points users
    at `messages send` for unambiguous addressing.
  Reuses the existing `POST /messages` request shape and response
  handling (idempotency 200/201, 409 conflict messaging,
  X-CueAPI-Priority-Downgraded surfacing).

- `agents list --online-only` shortcut for `--status online`.
  Mutually exclusive with `--status`. Server already supports the
  filter; the flag is just a friendlier surface.

- `agents describe <ref>` alias for `agents get <ref>`. Same
  argument and `--include-deleted` flag; defers to `agents_get`.

Universal `message-to` (Q8 wrapper) is canonical over per-agent
scripts (anti-pattern repeat / migration cost / onboarding /
Surface 5 composition all rule against per-agent scripts).
last_seen_at surfacing and `agents roster` debug command land
after the server-side Surface 1 endpoint ships.

Tests: 19 new (3 --online-only, 2 describe, 14 message-to —
pass-through, display-name match, slug match, no-match,
ambiguous, optionals, defaults, validation). 169/169 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@govindkavaturi-art govindkavaturi-art force-pushed the feat/message-to-online-only-describe branch from 2be3fa3 to 00e197b Compare May 6, 2026 23:56
@govindkavaturi-art govindkavaturi-art merged commit ccdc2f2 into main May 6, 2026
3 of 4 checks passed
mikemolinet added a commit that referenced this pull request May 12, 2026
…y, Mike body-verify directive 2026-05-11) (#55)

Parity port of cueapi-python #41 — body-verify Phase 2 on cues.fire,
but **OPT-IN** (not default-on) because the substrate's
/v1/cues/{id}/fire endpoint echoes a pydantic-after-parse body that
may include server-side default-population, causing spurious diff
vs the CLI's canonical-JSON serialization.

Mirrors primary's #41 design rationale: default OFF; caller opts in
with --verify when they know substrate echo semantics match their
serialization (typical for the sha256 constant-cost path).

Diverges from messages-send body-verify which is default-on
(--no-verify opt-out) because that endpoint echoes the raw STRING
body field per the spec-lock — no parsed-defaulted shape concern.

Implementation:
- New --verify click flag (is_flag, default False). Help text
  documents the OPT-IN rationale + the substrate-echo-shape concern.
- When --verify: send X-CueAPI-Verify-Echo: true header; pre-compute
  sha256(canonical-JSON(body)) hexdigest client-side.
- On 2xx response: compare sha256 first (constant-cost). If sha
  mismatch, fall back to string compare of body_received vs canonical
  body JSON. Spurious sha mismatch (e.g. canonical-JSON serialization
  diff) is rescued by the string compare.
- Defensive isinstance: body_received as string (post-#798 spec-lock)
  OR dict (pre-#798 wire shape). Matches the same pattern in
  cueapi-cli messages-send (#53) and cueapi-python messages.send
  (#40).
- On confirmed mismatch: exit 7 with byte-divergence diagnostic.
  Uses click.echo + raise SystemExit(7) directly (NOT echo_error
  which would raise SystemExit(1) and shadow the verify-specific
  exit code).

Tests (4 new):
- test_fire_verify_off_by_default_omits_header — no --verify ⇒ no
  X-CueAPI-Verify-Echo header (preserves pre-#791 wire format)
- test_fire_verify_on_sends_header — --verify ⇒ header set + sha
  match path passes silently
- test_fire_verify_help_lists_flag — --help mentions --verify + the
  opt-in rationale so users discover the design context
- test_fire_verify_mismatch_exits_7 — substrate echoes corrupted
  body ⇒ exit 7 with "body-verify mismatch" diagnostic

Full file: 219/219 passing (was 215 + 4 new = 219).

Backlog row: cmp1wj0q3.

Out of scope:
- cueapi-mcp parity (Backlog cmp1wj2a6) — separate PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants