@lotics/ui 11.8.9 → 11.8.10
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/docs/ai_patterns.md +16 -0
- package/package.json +1 -1
package/docs/ai_patterns.md
CHANGED
|
@@ -74,6 +74,22 @@ review; the human presses Send. The canvas template
|
|
|
74
74
|
([`tpl_dieline`](../examples/tpl_dieline.tsx)) uses it this way; while running the host swaps
|
|
75
75
|
`Composer` for `AgentProgress` (same pill geometry, so it reads as a morph).
|
|
76
76
|
|
|
77
|
+
## The trigger — a paid action is pressed exactly once
|
|
78
|
+
|
|
79
|
+
A CTA that starts an agent run (or any paid/mutating action) must make the PRESS itself the
|
|
80
|
+
transition — never leave a live button waiting on a network round-trip:
|
|
81
|
+
|
|
82
|
+
- **Same-tick feedback.** On press, synchronously close the dialog / swap to the run surface
|
|
83
|
+
(`AgentRun` with its streaming state) so there is nothing left to click. A button that stays
|
|
84
|
+
pressable while an attach/start request round-trips invites double-fires — observed in
|
|
85
|
+
production as stacked paid runs.
|
|
86
|
+
- **Single-flight in app code too.** Guard the handler with a ref (state alone races the
|
|
87
|
+
re-render): first press wins, later presses no-op until the flow settles.
|
|
88
|
+
- **The SDK backstops runs, not workflows.** `useAgentRun().run()` is single-flight by default
|
|
89
|
+
(a duplicate call joins the in-flight run; `replace: true` is the deliberate restart) — but
|
|
90
|
+
`useWorkflow` calls are NOT deduped (rapid distinct calls are legitimate), so a workflow CTA
|
|
91
|
+
must disable itself (`loading`) while pending or a double-click writes twice.
|
|
92
|
+
|
|
77
93
|
## Show the work — `AgentRun`
|
|
78
94
|
|
|
79
95
|
`AgentRun` (`@lotics/ui/agent_run`) is a live feed of the agent's work as a TIMELINE. The prop is
|