Skip to content

[AI-6222] Add newChat and autoSend options to SDK trigger API#31

Merged
OrTab merged 2 commits into
masterfrom
AI-6222-angie-new-chat-auto-send
Apr 14, 2026
Merged

[AI-6222] Add newChat and autoSend options to SDK trigger API#31
OrTab merged 2 commits into
masterfrom
AI-6222-angie-new-chat-auto-send

Conversation

@OrTab
Copy link
Copy Markdown
Contributor

@OrTab OrTab commented Apr 14, 2026

Summary

  • Parse angie-newChat=true and angie-autoSend=true hash params in handlePromptHash using proper URLSearchParams parsing
  • Add newChat and autoSend to AngieTriggerRequest.options and forward through the postMessage bridge to the iframe
  • Backward-compatible: defaults to false when params are absent

Changes

  • src/types.ts: Add newChat?: boolean and autoSend?: boolean to options
  • src/angie-mcp-sdk.ts: Refactor hash parsing with parseHashParams(), pass options.newChat/options.autoSend to triggerAngie
  • src/sdk.ts: Forward options in SDK_TRIGGER_ANGIE payload to iframe
  • src/angie-mcp-sdk.test.ts: Tests for hash parsing and trigger with newChat/autoSend

Test plan

  • npx jest — all 140 tests pass
  • Manual: navigate to wp-admin#angie-prompt=Fix%20error&angie-newChat=true&angie-autoSend=true — verify new chat opens and prompt auto-sends

Notes

Supersedes #24 — this approach keeps newChat/autoSend under options (alongside timeout) rather than top-level, and adds autoSend support.

Made with Cursor

✨ PR Description

1. Problem & Context

Jira: AI-6222

Extends the SDK trigger API to support starting new chat sessions and auto-sending prompts. Previously, hash-based triggers could only populate the input field; now they can optionally clear context (newChat) and immediately submit (autoSend). This enables deep-linking workflows where external systems can fully automate Angie interactions, not just pre-fill prompts.

2. What Changed (Where)

  • angie-mcp-sdk.ts: Added newChat and autoSend hash parameter parsing; refactored handlePromptHash() to use URLSearchParams instead of string replacement
  • types.ts: Extended AngieTriggerRequest.options interface with newChat and autoSend boolean fields
  • sdk.ts: Updated message relay to forward options object to iframe
  • angie-mcp-sdk.test.ts: Added comprehensive test coverage for new hash parsing logic and parameter combinations
  • iframe.test.ts: Fixed setTimeout return type for Node compatibility (unrelated cleanup)

3. How It Works

Hash parameters (#angie-prompt=X&angie-newChat=true&angie-autoSend=true) are parsed via URLSearchParams. The handlePromptHash() method extracts prompt + flags, then passes them through the existing triggerAngie() flow. The options object propagates from SDK → parent window → iframe message payload. Defaults to false for both flags when omitted, preserving backward compatibility with existing #angie-prompt=X URLs.

4. Risks

None. Additive change with defensive defaults. Existing integrations unaffected since new parameters are optional and default to false. Test coverage validates all combinations (both flags, one flag, no flags, empty prompt).

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how

Support hash params angie-newChat=true and angie-autoSend=true for
controlling chat creation and auto-sending from URL-based triggers.
Forward options through the postMessage bridge to the iframe.

Made-with: Cursor
@wiz-9a149474ff
Copy link
Copy Markdown

wiz-9a149474ff Bot commented Apr 14, 2026

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 1 Low
Software Management Finding Software Management Findings -
Total 1 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@OrTab
Copy link
Copy Markdown
Contributor Author

OrTab commented Apr 14, 2026

✅ Addressed 0/0 open review comments

Findings: repos/elementor/angie-sdk/pulls/31/comments returned no line comments; GraphQL reviewThreads totalCount was 0 (nothing to resolve).

Fixed: N/A — no human or actionable inline review feedback on this PR.

Skipped:

  • Wiz bot issue comment (scan summary): informational only; reports 1 Low SAST finding in Wiz UI but does not include file/rule details in the GitHub comment, so no code change was derived from it.

Additional (not from a review thread): Committed ESLint fix in src/iframe.test.ts — replaced NodeJS.Timeout cast with ReturnType<typeof setTimeout> so npm run lint passes (no-undef).

Tests passing | Lint clean


Note

🤖 Generated by Angie's Review Agent

@OrTab OrTab merged commit fc64f14 into master Apr 14, 2026
14 checks passed
@OrTab OrTab deleted the AI-6222-angie-new-chat-auto-send branch April 14, 2026 12:52
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