feat: Add AI assistant scheduled events - #447
Oliver-Zimmerman wants to merge 1 commit into
Conversation
48119d3 to
1532941
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1532941a29
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const response = await telnyxCli(args, { format: "raw" }); | ||
| const envelope = asRecord(response); | ||
| const allEvents = dataRecords(response); | ||
| const scheduledEvents = maxItems === undefined || maxItems === -1 | ||
| ? allEvents |
There was a problem hiding this comment.
Traverse pages before applying max-items
When an assistant has more scheduled events than one API page, this performs only a single raw request and slices that response. The raw-mode contract in cli/src/telnyx-cli.ts states that raw output is the actual REST response envelope rather than the generated CLI iterator, so requests such as --page-size 20 --max-items 50 return at most 20 events, while the advertised --max-items -1 still returns only the first page. Follow the response pagination metadata and fetch additional pages before applying the limit, or explicitly scope this option to the selected page.
Useful? React with 👍 / 👎.
Audit finding
The agent CLI did not expose the Stainless-generated
ai:assistants:scheduled-eventslifecycle, leaving agents unable to create, retrieve, list, or safely cancel scheduled assistant phone-call/SMS events.Changes
create,retrieve,list, anddeleteactions--confirmfor cancel/delete and never forward itJSON.stringify(args) + "\n"with an actual newlineValidation
npm install— passed (17 packages audited, 0 vulnerabilities)npm run typecheck— passedTELNYX_API_KEY='' npx tsx --test tests/ai-assistant-scheduled-events.test.ts— 6 passed, 0 failedTELNYX_API_KEY='' npx tsx --test tests/ai-assistant-scheduled-events.test.ts tests/ai-assistants.test.ts— 23 passed, 0 failedTELNYX_API_KEY='' npx tsx --test tests/bugfixes.test.ts— 39 passed, 0 failedTELNYX_API_KEY='' npm test— 555 passed, 0 failed, 0 skipped