paseo-quick-prompts 0.1.0 → 0.1.2
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 +3 -1
- package/README.md +37 -9
- package/assets/menu.png +0 -0
- package/assets/pills.png +0 -0
- package/assets/settings-light.png +0 -0
- package/assets/settings.png +0 -0
- package/client/autosave.ts +267 -0
- package/client/edits.ts +53 -0
- package/client/follow.ts +168 -34
- package/client/pills.ts +16 -2
- package/client/settings-screen.tsx +419 -224
- package/package.json +2 -1
- package/paseo-plugin.json +6 -1
package/client/pills.ts
CHANGED
|
@@ -62,6 +62,20 @@ export function createPromptPills(host: PromptPillHost): PromptPills {
|
|
|
62
62
|
/** Agents that get pills, by id, with their workspace. */
|
|
63
63
|
const targets = new Map<string, string>();
|
|
64
64
|
const registered = new Map<string, AgentPills>();
|
|
65
|
+
/**
|
|
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.
|
|
68
|
+
*/
|
|
69
|
+
const sending = new Map<string, Promise<void>>();
|
|
70
|
+
|
|
71
|
+
const send = (agentId: string, prompt: QuickPrompt): Promise<void> => {
|
|
72
|
+
const key = JSON.stringify([agentId, prompt.id]);
|
|
73
|
+
const current = sending.get(key);
|
|
74
|
+
if (current) return current;
|
|
75
|
+
const next = host.send(agentId, prompt.text).finally(() => sending.delete(key));
|
|
76
|
+
sending.set(key, next);
|
|
77
|
+
return next;
|
|
78
|
+
};
|
|
65
79
|
|
|
66
80
|
const addSpec: PillSpec = {
|
|
67
81
|
id: ADD_PILL_ID,
|
|
@@ -82,7 +96,7 @@ export function createPromptPills(host: PromptPillHost): PromptPills {
|
|
|
82
96
|
icon: "Zap",
|
|
83
97
|
label: prompt.label,
|
|
84
98
|
// Paseo marks the pill busy until the send settles and shows a failure in a toast.
|
|
85
|
-
behavior: { kind: "action", onPress: () =>
|
|
99
|
+
behavior: { kind: "action", onPress: () => send(agentId, prompt) },
|
|
86
100
|
}),
|
|
87
101
|
});
|
|
88
102
|
|
|
@@ -100,7 +114,7 @@ export function createPromptPills(host: PromptPillHost): PromptPills {
|
|
|
100
114
|
kind: "item" as const,
|
|
101
115
|
id: `prompt-${prompt.id}`,
|
|
102
116
|
title: prompt.label,
|
|
103
|
-
behavior: { kind: "action" as const, onPress: () =>
|
|
117
|
+
behavior: { kind: "action" as const, onPress: () => send(agentId, prompt) },
|
|
104
118
|
})),
|
|
105
119
|
{ kind: "separator", id: "manage-divider" },
|
|
106
120
|
{
|