feat(events): events + subscriptions top-level command groups (PR-1b)#50
Merged
Conversation
Adds two top-level command groups for the event-emit primitive (cueapi-core PR #71, OSS counterpart of cueapi/cueapi#731): - `cueapi events list <ref>` — pull events for an agent - `cueapi subscriptions create <ref>` — create a subscription - `cueapi subscriptions list <ref>` — list active subscriptions - `cueapi subscriptions delete <ref> <subscription-id>` — soft-detach Top-level groups per primary's kickoff doc suggestion (vs nesting under `agents`) — events/subscriptions are conceptually distinct primitives, not agent metadata. Same pattern as the top-level `messages` and `executions` groups (which are also user-scoped operations on a sub-resource). ## CLI architecture note This port uses cueapi-cli's own httpx-based client (CueAPIClient), NOT the cueapi-python SDK. The kickoff doc said the cli port "uses cueapi-python SDK so blocked on #2 landing" — that's incorrect re: the actual cli architecture (cli has its own client.py + no runtime dependency on cueapi-python). cli port is INDEPENDENT of python SDK timing. Flagged to PM. ## Wire format pinned - `events list`: GET `/v1/agents/{ref}/events` with `limit` (default 100) + optional `since` cursor + optional `event_type` filter. - `subscriptions create`: POST body `{event_type, delivery_target, webhook_url?}` to `/v1/agents/{ref}/subscriptions`. Client-side guard: `--webhook-url` required when `--delivery-target=webhook` (surface at parse time vs server 400). - `subscriptions list`: GET `/v1/agents/{ref}/subscriptions`. - `subscriptions delete`: DELETE on `/subscriptions/{id}` (idempotent). ## Tests 12 new tests in `tests/test_cli.py`: - events list: basic, with since+event_type, defaults only limit, 404 agent not found - subscriptions create: pull minimal, webhook with url, webhook without url errors client-side - subscriptions list: basic, empty - subscriptions delete: basic - help: events lists `list` subcommand, subscriptions lists create/list/delete 12/12 pass. Full suite: 191 tests collected, all events/subscriptions pass; no regressions. ## One-shot webhook secret discipline When `subscriptions create --delivery-target=webhook` returns a `webhook_secret`, the cli surfaces it with the "save now — only shown once" label. Same pattern as `agents webhook-secret regenerate`. Depends on cueapi-core PR #71 (merged 03:53Z, commit 50d2b2c2). Closes Backlog row: cmp0h2nzd000204l8acl5j6w0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two top-level command groups for the event-emit primitive — third + final layer of PR-1b parity (cueapi-core #71 merged @ 03:53Z; cueapi-python #38 merged @ 03:55Z; this is the cli).
cueapi events list <ref>— pull events for an agentcueapi subscriptions create <ref>— create a subscriptioncueapi subscriptions list <ref>— list active subscriptionscueapi subscriptions delete <ref> <subscription-id>— soft-detachCloses Backlog row
cmp0h2nzd000204l8acl5j6w0.Top-level vs agents-nested
Top-level groups per primary's kickoff doc suggestion. Events + subscriptions are conceptually distinct primitives, not agent metadata. Same pattern as top-level
messagesandexecutionsgroups (also user-scoped operations on a sub-resource).CLI architecture note
This port uses cueapi-cli's own httpx-based
CueAPIClient, NOT the cueapi-python SDK. The kickoff doc said the cli port "uses cueapi-python SDK so blocked on #2 landing" — that's incorrect re: the actual cli architecture. cli has its own client.py with no runtime dependency on cueapi-python. cli port is INDEPENDENT of python SDK timing.(Flagged to PM in the earlier status cue.)
Wire format pinned
events listGET /v1/agents/{ref}/events?limit=100[&since=N&event_type=X]subscriptions createPOST /v1/agents/{ref}/subscriptionsbody{event_type, delivery_target, webhook_url?}subscriptions listGET /v1/agents/{ref}/subscriptionssubscriptions deleteDELETE /v1/agents/{ref}/subscriptions/{id}(idempotent)Client-side guards
subscriptions create:--webhook-urlrequired when--delivery-target=webhook. Raised asclick.UsageErrorat parse time vs letting server 400.subscriptions createandevents listsurface 404 agent-not-found with friendly error messages.One-shot webhook secret discipline
When
subscriptions create --delivery-target=webhookreturns awebhook_secret, the cli surfaces it with "save now — only shown once" labeling. Same pattern as the existingagents webhook-secret regeneratecommand.Tests
12 new tests in
tests/test_cli.py:events list: basic, with--since+--event-type, defaults onlylimit, 404 agent not foundsubscriptions create: pull-minimal, webhook-with-url, webhook-without-url errors client-sidesubscriptions list: basic, emptysubscriptions delete: basiclistsubcommand, subscriptions lists create/list/deleteFull suite: 191 tests pass, zero regressions.
Depends on
Test plan
🤖 Generated with Claude Code