[PR #386] [MERGED] Add dynamic() support to prompt.form() plugin API #936

Closed
opened 2026-04-20 19:53:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/386
Author: @gschier
Created: 2/5/2026
Status: Merged
Merged: 2/7/2026
Merged by: @gschier

Base: mainHead: dynamic-prompt-form


📝 Commits (8)

  • 09e78d9 Add dynamic() support to prompt.form() plugin API
  • 3ad57c1 Add syntax highlighting for all httpsnippet languages
  • f3bd552 Fix lint
  • 32e92a6 Merge branch 'main' into dynamic-prompt-form
  • d039ebc Rename PromptFormSize to DialogSize, add HTTP editor language, resolve dynamic() on initial prompt form, strip dynamic callbacks consistently
  • 052330c Remove broken test script and add README for httpsnippet plugin
  • 241a34b Fix dynamic form initial mount overwrite, store httpsnippet client per-target
  • 148d444 Move prompt form dynamic types from PromptFormPlugin to Context

📊 Changes

22 files changed (+925 additions, -55 deletions)

View changed files

📝 crates-tauri/yaak-app/src/plugin_events.rs (+50 -2)
📝 crates/yaak-plugins/bindings/gen_events.ts (+10 -4)
📝 crates/yaak-plugins/bindings/gen_models.ts (+1 -1)
📝 crates/yaak-plugins/src/events.rs (+35 -0)
📝 package-lock.json (+193 -0)
📝 package.json (+8 -0)
📝 packages/plugin-runtime-types/src/bindings/gen_events.ts (+10 -4)
📝 packages/plugin-runtime-types/src/bindings/gen_models.ts (+1 -1)
📝 packages/plugin-runtime-types/src/plugins/Context.ts (+36 -1)
📝 packages/plugin-runtime-types/src/plugins/index.ts (+6 -5)
📝 packages/plugin-runtime/src/PluginInstance.ts (+81 -6)
📝 packages/plugin-runtime/src/common.ts (+30 -8)
plugins-external/httpsnippet/README.md (+9 -0)
plugins-external/httpsnippet/package.json (+24 -0)
plugins-external/httpsnippet/src/index.ts (+314 -0)
📝 plugins-external/mcp-server/package.json (+2 -2)
📝 src-web/components/DynamicForm.tsx (+2 -1)
📝 src-web/components/core/Dialog.tsx (+2 -1)
📝 src-web/components/core/Editor/extensions.ts (+35 -1)
📝 src-web/components/core/Prompt.tsx (+17 -2)

...and 2 more files

📄 Description

Summary

Adds dynamic() callback support to prompt.form() inputs, enabling form fields to update reactively when values change. This mirrors the existing dynamic() pattern used by auth and template function plugins.

Changes

Plugin API

  • prompt.form() inputs can now have dynamic(ctx, { values }) callbacks
  • Added optional size enum (sm, md, lg, full, dynamic) to PromptFormRequest for dialog sizing
  • Added optional rows to FormInputEditor for fixed-height editors
  • New DynamicPromptFormArg type using the same AddDynamic<FormInput> pattern

Event System

  • Changed PromptFormRequest routing from one-shot call_frontend to bidirectional events
  • Added done field to PromptFormResponse to distinguish intermediate value updates from final submission
  • Frontend sends debounced intermediate responses on value changes; plugin resolves dynamic() callbacks and sends updated inputs back

httpsnippet Plugin (new)

  • Generates code snippets from HTTP requests using @readme/httpsnippet
  • Two dynamic selects (Language and Library) side-by-side in an h_stack
  • Library options update when language changes; code preview updates when either changes
  • Remembers last selected language/library via plugin store

🔄 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/386 **Author:** [@gschier](https://github.com/gschier) **Created:** 2/5/2026 **Status:** ✅ Merged **Merged:** 2/7/2026 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `main` ← **Head:** `dynamic-prompt-form` --- ### 📝 Commits (8) - [`09e78d9`](https://github.com/mountain-loop/yaak/commit/09e78d92105af9d3405d00ed906cc43cb0388f34) Add dynamic() support to prompt.form() plugin API - [`3ad57c1`](https://github.com/mountain-loop/yaak/commit/3ad57c125f0a84a9f88c39ba467dca7e841d83b9) Add syntax highlighting for all httpsnippet languages - [`f3bd552`](https://github.com/mountain-loop/yaak/commit/f3bd552b1551565c4076dfcbea36d9947885e7bf) Fix lint - [`32e92a6`](https://github.com/mountain-loop/yaak/commit/32e92a66101b4d42814ba3869deddce76fcc6193) Merge branch 'main' into dynamic-prompt-form - [`d039ebc`](https://github.com/mountain-loop/yaak/commit/d039ebccfbcf1f83dd9a6be93be169ea2a8d51c2) Rename PromptFormSize to DialogSize, add HTTP editor language, resolve dynamic() on initial prompt form, strip dynamic callbacks consistently - [`052330c`](https://github.com/mountain-loop/yaak/commit/052330c3a94d97303819ed8e409597a582f2abbc) Remove broken test script and add README for httpsnippet plugin - [`241a34b`](https://github.com/mountain-loop/yaak/commit/241a34b3d4141ea8b3683f13a2fed4a67aa1a7fd) Fix dynamic form initial mount overwrite, store httpsnippet client per-target - [`148d444`](https://github.com/mountain-loop/yaak/commit/148d444195045abc876e9197d1cfbfff99da6b1e) Move prompt form dynamic types from PromptFormPlugin to Context ### 📊 Changes **22 files changed** (+925 additions, -55 deletions) <details> <summary>View changed files</summary> 📝 `crates-tauri/yaak-app/src/plugin_events.rs` (+50 -2) 📝 `crates/yaak-plugins/bindings/gen_events.ts` (+10 -4) 📝 `crates/yaak-plugins/bindings/gen_models.ts` (+1 -1) 📝 `crates/yaak-plugins/src/events.rs` (+35 -0) 📝 `package-lock.json` (+193 -0) 📝 `package.json` (+8 -0) 📝 `packages/plugin-runtime-types/src/bindings/gen_events.ts` (+10 -4) 📝 `packages/plugin-runtime-types/src/bindings/gen_models.ts` (+1 -1) 📝 `packages/plugin-runtime-types/src/plugins/Context.ts` (+36 -1) 📝 `packages/plugin-runtime-types/src/plugins/index.ts` (+6 -5) 📝 `packages/plugin-runtime/src/PluginInstance.ts` (+81 -6) 📝 `packages/plugin-runtime/src/common.ts` (+30 -8) ➕ `plugins-external/httpsnippet/README.md` (+9 -0) ➕ `plugins-external/httpsnippet/package.json` (+24 -0) ➕ `plugins-external/httpsnippet/src/index.ts` (+314 -0) 📝 `plugins-external/mcp-server/package.json` (+2 -2) 📝 `src-web/components/DynamicForm.tsx` (+2 -1) 📝 `src-web/components/core/Dialog.tsx` (+2 -1) 📝 `src-web/components/core/Editor/extensions.ts` (+35 -1) 📝 `src-web/components/core/Prompt.tsx` (+17 -2) _...and 2 more files_ </details> ### 📄 Description ## Summary Adds `dynamic()` callback support to `prompt.form()` inputs, enabling form fields to update reactively when values change. This mirrors the existing `dynamic()` pattern used by auth and template function plugins. ## Changes ### Plugin API - `prompt.form()` inputs can now have `dynamic(ctx, { values })` callbacks - Added optional `size` enum (`sm`, `md`, `lg`, `full`, `dynamic`) to `PromptFormRequest` for dialog sizing - Added optional `rows` to `FormInputEditor` for fixed-height editors - New `DynamicPromptFormArg` type using the same `AddDynamic<FormInput>` pattern ### Event System - Changed `PromptFormRequest` routing from one-shot `call_frontend` to bidirectional events - Added `done` field to `PromptFormResponse` to distinguish intermediate value updates from final submission - Frontend sends debounced intermediate responses on value changes; plugin resolves `dynamic()` callbacks and sends updated inputs back ### httpsnippet Plugin (new) - Generates code snippets from HTTP requests using `@readme/httpsnippet` - Two dynamic selects (Language and Library) side-by-side in an `h_stack` - Library options update when language changes; code preview updates when either changes - Remembers last selected language/library via plugin store --- <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-20 19:53:05 -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#936