paseo-quick-prompts 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/OVERVIEW.md CHANGED
@@ -1,15 +1,18 @@
1
- Quick prompts turns the messages you send often into pills above every agent's composer. Tap a pill and its text goes to that agent as your next message, the same as typing it and pressing send. If you prefer a tidier composer, show them all in one **Prompts** pill that opens a menu instead.
1
+ Quick prompts turns the messages you send often into pills above every agent's composer. Tap a pill and, by default, its text goes to that agent as your next message, the same as typing it and pressing send. If you prefer a tidier composer, show them all in one **Prompts** pill that opens a menu instead.
2
+
3
+ To edit a prompt before it goes out, turn off **Send right away**: tapping a pill or menu item then puts the prompt in that agent's composer at the cursor, ready for you to change and send.
2
4
 
3
5
  Use it for prompts you repeat across agents, such as "Review the uncommitted changes", "Run the tests and fix failures", or "Summarize what changed and open a PR".
4
6
 
5
7
  ## Settings
6
8
 
7
- Quick prompts needs Paseo 0.11.0 or later, with plugins enabled.
9
+ Quick prompts needs Paseo 0.16.0 or later, with plugins enabled.
8
10
 
9
- Open **Settings → Plugins → paseo-quick-prompts → Quick prompts** to add, edit, reorder, and delete prompts and to choose how they appear. Each one has a label, shown on the pill or menu item, and the prompt text that is sent. Changes save automatically: deleting, reordering, and the display option save right away, and an edited label or prompt saves when you leave the field. New prompts go in the last row and are added with **Add**. If another device deletes a prompt you were editing, your text stays on the page so you can copy it.
11
+ Open **Settings → Plugins → paseo-quick-prompts → Quick prompts** to add, edit, reorder, and delete prompts and to choose how they appear. Each one has a label, shown on the pill or menu item, and the prompt text that is sent (or inserted). Changes save automatically: deleting, reordering, and the display and **Send right away** options save right away, and an edited label or prompt saves when you leave the field. New prompts go in the last row and are added with **Add**. If another device deletes a prompt you were editing, your text stays on the page so you can copy it.
10
12
 
11
13
  - Up to 20 prompts. Labels can be up to 40 characters.
12
14
  - **Show prompts as** picks **Separate pills** (the default) or **One menu pill**. Either way, prompts follow the order of the list, on every agent that belongs to a workspace. The menu also has a **Manage prompts** item that opens the settings page.
15
+ - **Send right away** is on by default. Turn it off to have pills insert their prompt into the composer instead of sending it.
13
16
  - With no prompts saved, each agent shows an **Add quick prompt** pill that opens the settings page.
14
17
 
15
18
  To use the same prompts on another Paseo host, press **Export → Copy**, then on the other host's settings page press **Import…**, paste the text, and choose **Add** to put the prompts after the existing ones or **Replace all** to replace them.
package/README.md CHANGED
@@ -4,7 +4,8 @@
4
4
 
5
5
  Save the messages you send often, like "Review the uncommitted changes" or "Run the tests and fix
6
6
  failures". Each one becomes a pill above every agent's composer; tapping it sends the prompt to that
7
- agent as a normal user message.
7
+ agent as a normal user message, or, with **Send right away** off, puts it in that agent's composer so
8
+ you can edit it first.
8
9
 
9
10
  ## Screenshots
10
11
 
@@ -20,6 +21,8 @@ agent as a normal user message.
20
21
 
21
22
  - **One pill per prompt** on every agent with a workspace, in the order you set, or **one menu
22
23
  pill** (Prompts) that lists them all with a **Manage prompts** shortcut.
24
+ - **Send right away** (on by default). Turn it off and a pill or menu item inserts its prompt into
25
+ that agent's composer at the cursor and focuses the composer, without sending.
23
26
  - **Settings screen** under **Settings → Plugins → paseo-quick-prompts → Quick prompts** to add, edit, reorder, and delete
24
27
  prompts and choose how they appear. Changes save automatically.
25
28
  - **Export and import.** Copy your prompts as text and paste them into Quick prompts on another
@@ -33,7 +36,7 @@ agent as a normal user message.
33
36
 
34
37
  ## Requirements
35
38
 
36
- - Paseo **0.11.0** or later, with plugins enabled (**Settings → Plugins → Enable plugins**, or
39
+ - Paseo **0.16.0** or later, with plugins enabled (**Settings → Plugins → Enable plugins**, or
37
40
  `"pluginsEnabled": true` in `~/.paseo/config.json`)
38
41
 
39
42
  ## Install
@@ -50,12 +53,12 @@ the latest source with `paseo plugin install github:kingsleydon/paseo-plugins:pl
50
53
  | Field | Limit | Description |
51
54
  |---|---|---|
52
55
  | Label | 1–40 characters | Text on the pill |
53
- | Prompt | 1–10,000 characters | Message sent to the agent |
56
+ | Prompt | 1–10,000 characters | Message sent to the agent, or inserted into its composer |
54
57
 
55
58
  Up to 20 prompts. Leading and trailing whitespace is trimmed when you save.
56
59
 
57
60
  Each prompt is one compact row: label, prompt text (which grows to five lines, then scrolls), and
58
- move up, move down, and delete buttons. Moving, deleting, and **Show prompts as** save right away.
61
+ move up, move down, and delete buttons. Moving, deleting, **Show prompts as**, and **Send right away** save right away.
59
62
  An edited label or prompt saves when the field loses focus, if it is valid; an invalid value shows
60
63
  an error under the field and is not saved. New prompts go in the last row and are saved with
61
64
  **Add**. The section header shows **Saving…**, **Saved**, or **Not saved** for the latest save.
@@ -69,10 +72,15 @@ edits** card with **Copy** and **Dismiss**.
69
72
  **Show prompts as** is **Separate pills** (default) or **One menu pill**. Settings saved before this
70
73
  option existed keep separate pills.
71
74
 
75
+ **Send right away** is on by default: a pill or menu item sends its prompt. Off, it inserts the
76
+ prompt into that agent's composer at the cursor (replacing any selection) and focuses the composer;
77
+ nothing is sent until you send it. It saves right away. Settings saved before this option existed
78
+ keep sending.
79
+
72
80
  **Export → Copy** copies the prompts' labels and text as JSON. **Import → Import…** opens a dialog
73
81
  to paste that text. **Add** puts the prompts after the saved ones, skipping any whose label and prompt
74
82
  are already saved; an import that would go over 20 prompts is not saved. **Replace all** replaces the
75
- saved prompts with the pasted ones. **Show prompts as** is not exported or changed by an import.
83
+ saved prompts with the pasted ones. **Show prompts as** and **Send right away** are not exported or changed by an import.
76
84
 
77
85
  ## How it works
78
86
 
@@ -82,11 +90,14 @@ saved prompts with the pasted ones. **Show prompts as** is not exported or chang
82
90
  prompt (or one menu pill) on each non-archived agent that has a workspace. Prompt changes update
83
91
  existing pills in place; a reorder of separate pills or a display switch re-registers that agent's
84
92
  pills. A failed observation starts again after 1, 5, 15, and 60 seconds, then stops.
85
- - A pill press or menu choice calls `paseo.agents.ref(agentId).send(text)`. Paseo shows the pill as busy until the
86
- send settles and reports failures in a toast. A prompt is not sent to the same agent again while its
87
- previous send is pending.
93
+ - A pill press or menu choice calls `paseo.agents.ref(agentId).send(text)`, or, with **Send right
94
+ away** off, takes the agent's composer from `client.composers({ agentId })` (which reaches it whether
95
+ or not its tab is open) and calls `insertText(text)` and then `focus()`, which opens the agent if it is
96
+ not on screen. Paseo shows the pill as busy until the press settles and reports failures (including
97
+ no composer for the agent) in a toast. A prompt is not sent or inserted to the same agent again
98
+ while its previous press is pending.
88
99
 
89
- Not supported: pills in the new-agent composer and inserting text into the composer for editing.
100
+ Not supported: pills in the new-agent composer.
90
101
 
91
102
  ## Development
92
103
 
@@ -103,9 +114,9 @@ paseo plugin logs paseo-quick-prompts
103
114
  |---|---|
104
115
  | `index.server.ts` | Daemon entry: registers the settings document |
105
116
  | `index.client.tsx` | App entry: settings screen and composer pills |
106
- | `client/pills.ts` | Keeps each agent's pills in sync with the saved prompts |
117
+ | `client/pills.ts` | Keeps each agent's pills in sync with the saved prompts, and inserts into a composer |
107
118
  | `client/follow.ts` | Follows the agent directory and settings changes |
108
- | `client/settings-screen.tsx` | Autosaving editor for the prompts and display option, export and import, and the prompt-ideas tip |
119
+ | `client/settings-screen.tsx` | Autosaving editor for the prompts, display, and Send right away options, export and import, and the prompt-ideas tip |
109
120
  | `client/autosave.ts` | Save queue for the settings screen: latest values, typed drafts, the new-prompt form, conflict retry |
110
121
  | `client/edits.ts` | Prompt edits applied to the latest values |
111
122
  | `client/transfer.ts` | Export text, and parsing and applying an import |
package/client/edits.ts CHANGED
@@ -46,6 +46,10 @@ export function setDisplay(display: PromptDisplay): Edit {
46
46
  return (values) => ({ ...values, display });
47
47
  }
48
48
 
49
+ export function setSendRightAway(sendRightAway: boolean): Edit {
50
+ return (values) => ({ ...values, sendRightAway });
51
+ }
52
+
49
53
  /** The edit applied to `values`, or `null` when it no longer applies or the result would not save. */
50
54
  export function applyEdit(edit: Edit, values: QuickPromptsSettings): QuickPromptsSettings | null {
51
55
  const next = edit(values);
package/client/pills.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type {
2
2
  PluginButton,
3
3
  PluginButtonRegistration,
4
+ PluginComposer,
4
5
  PluginComposerPillContribution,
6
+ PluginComposerSelector,
5
7
  } from "@getpaseo/plugin/client";
6
8
  import type { QuickPrompt, QuickPromptsSettings } from "../shared/prompts";
7
9
 
@@ -11,9 +13,26 @@ const MENU_PILL_ID = "quick-prompts";
11
13
  export interface PromptPillHost {
12
14
  addComposerPill(contribution: PluginComposerPillContribution): PluginButtonRegistration;
13
15
  send(agentId: string, text: string): Promise<void>;
16
+ /** Puts the text in the agent's composer without sending it. */
17
+ insert(agentId: string, text: string): Promise<void>;
14
18
  openSettings(): void;
15
19
  }
16
20
 
21
+ /**
22
+ * Inserts the text at the cursor of the agent's composer and focuses it. Rejects when Paseo has no
23
+ * composer for the agent or the composer refuses the text or focus; the pill shows that in a toast.
24
+ */
25
+ export async function insertIntoComposer(
26
+ composers: (selector: PluginComposerSelector) => readonly Pick<PluginComposer, "insertText" | "focus">[],
27
+ agentId: string,
28
+ text: string,
29
+ ): Promise<void> {
30
+ const [composer] = composers({ agentId });
31
+ if (!composer) throw new Error("This agent's composer is not available.");
32
+ composer.insertText(text);
33
+ await composer.focus();
34
+ }
35
+
17
36
  export interface PillAgent {
18
37
  id: string;
19
38
  workspaceId?: string | null;
@@ -63,17 +82,19 @@ export function createPromptPills(host: PromptPillHost): PromptPills {
63
82
  const targets = new Map<string, string>();
64
83
  const registered = new Map<string, AgentPills>();
65
84
  /**
66
- * Sends in flight by agent and prompt. Kept outside the registrations, which a reorder or display
67
- * switch replaces, so a replacement pill cannot send the same prompt again before the first settles.
85
+ * Sends and inserts in flight by agent, prompt, and action. Kept outside the registrations, which a
86
+ * reorder or display switch replaces, so a replacement pill cannot repeat a prompt before the first
87
+ * press settles.
68
88
  */
69
- const sending = new Map<string, Promise<void>>();
89
+ const pending = new Map<string, Promise<void>>();
70
90
 
71
- const send = (agentId: string, prompt: QuickPrompt): Promise<void> => {
72
- const key = JSON.stringify([agentId, prompt.id]);
73
- const current = sending.get(key);
91
+ const run = (agentId: string, prompt: QuickPrompt, sendRightAway: boolean): Promise<void> => {
92
+ const key = JSON.stringify([agentId, prompt.id, sendRightAway]);
93
+ const current = pending.get(key);
74
94
  if (current) return current;
75
- const next = host.send(agentId, prompt.text).finally(() => sending.delete(key));
76
- sending.set(key, next);
95
+ const press = sendRightAway ? host.send(agentId, prompt.text) : host.insert(agentId, prompt.text);
96
+ const next = press.finally(() => pending.delete(key));
97
+ pending.set(key, next);
77
98
  return next;
78
99
  };
79
100
 
@@ -88,23 +109,23 @@ export function createPromptPills(host: PromptPillHost): PromptPills {
88
109
  }),
89
110
  };
90
111
 
91
- const promptSpec = (prompt: QuickPrompt): PillSpec => ({
112
+ const promptSpec = (prompt: QuickPrompt, sendRightAway: boolean): PillSpec => ({
92
113
  id: `prompt-${prompt.id}`,
93
- content: JSON.stringify([prompt.label, prompt.text]),
114
+ content: JSON.stringify([prompt.label, prompt.text, sendRightAway]),
94
115
  button: (agentId) => ({
95
- title: `Send quick prompt: ${prompt.label}`,
116
+ title: `${sendRightAway ? "Send" : "Insert"} quick prompt: ${prompt.label}`,
96
117
  icon: "Zap",
97
118
  label: prompt.label,
98
- // Paseo marks the pill busy until the send settles and shows a failure in a toast.
99
- behavior: { kind: "action", onPress: () => send(agentId, prompt) },
119
+ // Paseo marks the pill busy until the press settles and shows a failure in a toast.
120
+ behavior: { kind: "action", onPress: () => run(agentId, prompt, sendRightAway) },
100
121
  }),
101
122
  });
102
123
 
103
- const menuSpec = (prompts: readonly QuickPrompt[]): PillSpec => ({
124
+ const menuSpec = (prompts: readonly QuickPrompt[], sendRightAway: boolean): PillSpec => ({
104
125
  id: MENU_PILL_ID,
105
- content: JSON.stringify(prompts),
126
+ content: JSON.stringify([prompts, sendRightAway]),
106
127
  button: (agentId) => ({
107
- title: "Send a quick prompt",
128
+ title: sendRightAway ? "Send a quick prompt" : "Insert a quick prompt",
108
129
  icon: "Zap",
109
130
  label: "Prompts",
110
131
  behavior: {
@@ -114,7 +135,7 @@ export function createPromptPills(host: PromptPillHost): PromptPills {
114
135
  kind: "item" as const,
115
136
  id: `prompt-${prompt.id}`,
116
137
  title: prompt.label,
117
- behavior: { kind: "action" as const, onPress: () => send(agentId, prompt) },
138
+ behavior: { kind: "action" as const, onPress: () => run(agentId, prompt, sendRightAway) },
118
139
  })),
119
140
  { kind: "separator", id: "manage-divider" },
120
141
  {
@@ -174,9 +195,10 @@ export function createPromptPills(host: PromptPillHost): PromptPills {
174
195
  };
175
196
 
176
197
  return {
177
- setSettings({ prompts, display }) {
198
+ setSettings({ prompts, display, sendRightAway }) {
178
199
  if (prompts.length === 0) specs = [addSpec];
179
- else specs = display === "menu" ? [menuSpec(prompts)] : prompts.map(promptSpec);
200
+ else if (display === "menu") specs = [menuSpec(prompts, sendRightAway)];
201
+ else specs = prompts.map((prompt) => promptSpec(prompt, sendRightAway));
180
202
  for (const [agentId, workspaceId] of targets) sync(agentId, workspaceId);
181
203
  },
182
204
  setAgents(list) {
@@ -1,6 +1,16 @@
1
1
  import { usePaseo, useRpc, useSettings, type PluginSurfaceProps, type SettingsState } from "@getpaseo/plugin/client";
2
- import { copyText, Icon, Modal, TextInput as ModalTextInput, useToast } from "@getpaseo/plugin/client/react-native";
3
- import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect } from "@getpaseo/plugin/client/ui";
2
+ import {
3
+ copyText,
4
+ Icon,
5
+ Modal,
6
+ TextInput as ModalTextInput,
7
+ SettingsAction,
8
+ SettingsCard,
9
+ SettingsSection,
10
+ SettingsSelect,
11
+ SettingsSwitch,
12
+ useToast,
13
+ } from "@getpaseo/plugin/client/ui";
4
14
  import { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
5
15
  import {
6
16
  ActivityIndicator,
@@ -20,7 +30,7 @@ import {
20
30
  type QuickPrompt,
21
31
  } from "../shared/prompts";
22
32
  import { createAutosave, draftKey, orphanedDrafts, type Autosave, type AutosaveState, type Field } from "./autosave";
23
- import { movePrompt, setDisplay, settingsContract, type SettingsDoc } from "./edits";
33
+ import { movePrompt, setDisplay, setSendRightAway, settingsContract, type SettingsDoc } from "./edits";
24
34
  import { followPromptChanges } from "./follow";
25
35
  import { exportPrompts, importPrompts, parseImport } from "./transfer";
26
36
 
@@ -626,7 +636,8 @@ function PromptLibrary({
626
636
  >
627
637
  <Text style={styles.intro}>
628
638
  Quick prompts appear above every agent's composer, as separate pills or in one Prompts menu. Choosing one
629
- sends the prompt to that agent as your message. Changes save automatically.
639
+ sends the prompt to that agent, or with Send right away off, puts it in the composer. Changes save
640
+ automatically.
630
641
  </Text>
631
642
  <LoadProblem
632
643
  settings={settings}
@@ -672,6 +683,12 @@ function PromptLibrary({
672
683
  options={DISPLAY_OPTIONS}
673
684
  onValueChange={(display) => void store.save(setDisplay(display))}
674
685
  />
686
+ <SettingsSwitch
687
+ label="Send right away"
688
+ hint="On: a prompt is sent when you tap it. Off: it goes into the composer so you can edit it first."
689
+ value={state.doc.values.sendRightAway}
690
+ onValueChange={(sendRightAway) => void store.save(setSendRightAway(sendRightAway))}
691
+ />
675
692
  </SettingsCard>
676
693
  <TransferPrompts state={state} store={store} theme={theme} styles={styles} />
677
694
  <FindPromptsTip styles={styles} />
package/index.client.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { PluginClientContext } from "@getpaseo/plugin/client";
2
2
  import { followAgents, followPrompts } from "./client/follow";
3
- import { createPromptPills } from "./client/pills";
3
+ import { createPromptPills, insertIntoComposer } from "./client/pills";
4
4
  import { QuickPromptsSettingsScreen } from "./client/settings-screen";
5
5
 
6
6
  const SETTINGS_SCREEN_ID = "quick-prompts";
@@ -16,6 +16,7 @@ export default function contribute(client: PluginClientContext) {
16
16
  const pills = createPromptPills({
17
17
  addComposerPill: (contribution) => client.addComposerPill(contribution),
18
18
  send: (agentId, text) => client.paseo.agents.ref(agentId).send(text),
19
+ insert: (agentId, text) => insertIntoComposer((selector) => client.composers(selector), agentId, text),
19
20
  openSettings: () => client.openSettings(SETTINGS_SCREEN_ID),
20
21
  });
21
22
  const lifetime = new AbortController();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paseo-quick-prompts",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Saved prompts as one-tap pills above every agent's composer.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -20,7 +20,7 @@
20
20
  "test": "vitest run"
21
21
  },
22
22
  "devDependencies": {
23
- "@getpaseo/plugin": "0.11.2",
23
+ "@getpaseo/plugin": "0.17.5",
24
24
  "@tanstack/react-query": "^5.90.11",
25
25
  "@types/react": "~19.2.0",
26
26
  "react": "19.1.0",
package/paseo-plugin.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "Quick prompts",
4
4
  "description": "Saved prompts as one-tap pills above every agent's composer.",
5
5
  "requirements": {
6
- "paseo": ">=0.11.0"
6
+ "paseo": ">=0.16.0"
7
7
  },
8
8
  "media": [
9
9
  "assets/pills.png",
package/shared/prompts.ts CHANGED
@@ -41,6 +41,9 @@ export const quickPromptsSettings = defineSettings({
41
41
  // Documents saved before this field existed, or with a display this version does not know,
42
42
  // keep separate pills and their prompts.
43
43
  display: z.enum(PROMPT_DISPLAYS).catch("pills"),
44
+ // Whether a prompt pill sends its prompt or inserts it into the composer. Documents saved
45
+ // before this field existed keep sending.
46
+ sendRightAway: z.boolean().catch(true),
44
47
  }),
45
48
  });
46
49