[PR #359] [MERGED] feat: add ctx.prompt.form() plugin API for multi-field form dialogs #1266

Closed
opened 2026-04-26 00:16:16 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/359
Author: @gschier
Created: 1/10/2026
Status: Merged
Merged: 1/10/2026
Merged by: @gschier

Base: mainHead: plugin-api-prompt-form


📝 Commits (3)

  • fa3e6e6 feat: add ctx.prompt.form() API for multi-field form dialogs
  • 132ec94 fix: add Rust handler for prompt_form_request and test action
  • fda200a Merge branch 'main' into plugin-api-prompt-form

📊 Changes

7 files changed (+72 additions, -2 deletions)

View changed files

📝 crates-tauri/yaak-app/src/plugin_events.rs (+4 -0)
📝 crates/yaak-plugins/bindings/gen_events.ts (+5 -1)
📝 crates/yaak-plugins/src/events.rs (+25 -0)
📝 packages/plugin-runtime-types/src/bindings/gen_events.ts (+5 -1)
📝 packages/plugin-runtime-types/src/plugins/Context.ts (+3 -0)
📝 packages/plugin-runtime/src/PluginInstance.ts (+8 -0)
📝 src-web/lib/initGlobalListeners.tsx (+22 -0)

📄 Description

Summary

  • Adds new ctx.prompt.form() API that allows plugins to show arbitrary dialogs using the full FormInput[] type
  • Same form system already used by auth and template tag plugins, now available for any plugin action

Changes

  • Added PromptFormRequest and PromptFormResponse types in Rust
  • Added form() method to ctx.prompt interface in plugin runtime
  • Added frontend handler for prompt_form_request events

Example Usage

const result = await ctx.prompt.form({
  id: 'my-dialog',
  title: 'Enter Details',
  inputs: [
    { type: 'text', name: 'username', label: 'Username' },
    { type: 'text', name: 'password', label: 'Password', password: true },
    { type: 'select', name: 'role', label: 'Role', options: [...] },
    { type: 'checkbox', name: 'rememberMe', label: 'Remember me' },
  ],
});
// result is Record<string, JsonPrimitive> | null

Test plan

  • Tested manually with a test plugin action
  • Verify dialog shows with all input types
  • Verify form values are returned correctly on submit
  • Verify null is returned on cancel

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mountain-loop/yaak/pull/359 **Author:** [@gschier](https://github.com/gschier) **Created:** 1/10/2026 **Status:** ✅ Merged **Merged:** 1/10/2026 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `main` ← **Head:** `plugin-api-prompt-form` --- ### 📝 Commits (3) - [`fa3e6e6`](https://github.com/mountain-loop/yaak/commit/fa3e6e6508e409a5faddab0f7ff6591f011ae025) feat: add ctx.prompt.form() API for multi-field form dialogs - [`132ec94`](https://github.com/mountain-loop/yaak/commit/132ec9480a94be0383f7f7bfb377657caf408fda) fix: add Rust handler for prompt_form_request and test action - [`fda200a`](https://github.com/mountain-loop/yaak/commit/fda200a43ffc3c22ed849dd0f9d41442d107f23d) Merge branch 'main' into plugin-api-prompt-form ### 📊 Changes **7 files changed** (+72 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates-tauri/yaak-app/src/plugin_events.rs` (+4 -0) 📝 `crates/yaak-plugins/bindings/gen_events.ts` (+5 -1) 📝 `crates/yaak-plugins/src/events.rs` (+25 -0) 📝 `packages/plugin-runtime-types/src/bindings/gen_events.ts` (+5 -1) 📝 `packages/plugin-runtime-types/src/plugins/Context.ts` (+3 -0) 📝 `packages/plugin-runtime/src/PluginInstance.ts` (+8 -0) 📝 `src-web/lib/initGlobalListeners.tsx` (+22 -0) </details> ### 📄 Description ## Summary - Adds new `ctx.prompt.form()` API that allows plugins to show arbitrary dialogs using the full `FormInput[]` type - Same form system already used by auth and template tag plugins, now available for any plugin action ## Changes - Added `PromptFormRequest` and `PromptFormResponse` types in Rust - Added `form()` method to `ctx.prompt` interface in plugin runtime - Added frontend handler for `prompt_form_request` events ## Example Usage ```typescript const result = await ctx.prompt.form({ id: 'my-dialog', title: 'Enter Details', inputs: [ { type: 'text', name: 'username', label: 'Username' }, { type: 'text', name: 'password', label: 'Password', password: true }, { type: 'select', name: 'role', label: 'Role', options: [...] }, { type: 'checkbox', name: 'rememberMe', label: 'Remember me' }, ], }); // result is Record<string, JsonPrimitive> | null ``` ## Test plan - [x] Tested manually with a test plugin action - [x] Verify dialog shows with all input types - [x] Verify form values are returned correctly on submit - [x] Verify null is returned on cancel 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-26 00:16:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/yaak#1266