Skip to content

feat: add observe and waitFor poll-based methods#22

Merged
George-iam merged 1 commit intomainfrom
feat/observe-waitfor-20260318
Mar 18, 2026
Merged

feat: add observe and waitFor poll-based methods#22
George-iam merged 1 commit intomainfrom
feat/observe-waitfor-20260318

Conversation

@George-iam
Copy link
Contributor

Summary

  • Add observe(intentId, ObserveOptions) method that polls listIntentEvents in a loop, collecting events until a terminal event is seen (status in COMPLETED/FAILED/CANCELED/TIMED_OUT or matching event_type)
  • Add waitFor(intentId, ObserveOptions) convenience method that returns only the terminal event
  • Add ObserveOptions class with configurable since, pollIntervalSeconds, and timeoutSeconds
  • Add AxmeTimeoutException thrown when observe/waitFor exceeds configured timeout
  • Add 7 test cases covering: multi-poll with terminal stop, event_type-only terminal, status-only terminal, timeout, waitFor convenience, since parameter forwarding, null options defaults

Test plan

  • CI test job passes (MockWebServer-based tests verify polling loop, seq tracking, terminal detection, and timeout)
  • Manual review of observe/waitFor method signatures and behavior

Generated with Claude Code

Add poll-based observe() and waitFor() methods to AxmeClient that use
listIntentEvents internally. observe() polls in a loop and collects
events until a terminal event is seen (COMPLETED, FAILED, CANCELED,
TIMED_OUT). waitFor() is a convenience wrapper that returns only the
terminal event. Supports configurable poll interval, since parameter
for cursor tracking, and optional timeout via ObserveOptions.

New files:
- ObserveOptions.java: configuration for polling behavior
- AxmeTimeoutException.java: thrown when observe/waitFor exceeds timeout

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@George-iam George-iam merged commit 72e272e into main Mar 18, 2026
1 check passed
@George-iam George-iam deleted the feat/observe-waitfor-20260318 branch March 18, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant