@joshualelon/clawdbot-skill-flow 0.2.3 → 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/package.json +1 -1
- package/src/commands/flow-start.ts +28 -2
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { ClawdbotPluginApi } from "clawdbot/plugin-sdk";
|
|
6
|
-
import { loadFlow } from "../state/flow-store.js";
|
|
6
|
+
import { loadFlow, listFlows } from "../state/flow-store.js";
|
|
7
7
|
import { createSession, getSessionKey } from "../state/session-store.js";
|
|
8
8
|
import { startFlow } from "../engine/executor.js";
|
|
9
9
|
|
|
@@ -15,8 +15,34 @@ export function createFlowStartCommand(api: ClawdbotPluginApi) {
|
|
|
15
15
|
}) => {
|
|
16
16
|
const flowName = args.args?.trim();
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// Show flow selection buttons when no flow name provided (Telegram)
|
|
19
19
|
if (!flowName) {
|
|
20
|
+
const flows = await listFlows(api);
|
|
21
|
+
|
|
22
|
+
if (flows.length === 0) {
|
|
23
|
+
return {
|
|
24
|
+
text: "No flows available.\n\nCreate one with /flow_create",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Show buttons on Telegram, text list on other channels
|
|
29
|
+
if (args.channel === "telegram") {
|
|
30
|
+
const buttons = flows.map((flow) => [
|
|
31
|
+
{
|
|
32
|
+
text: `${flow.name}${flow.description ? ` - ${flow.description}` : ""}`,
|
|
33
|
+
callback_data: `/flow_start ${flow.name}`,
|
|
34
|
+
},
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
text: "Choose a flow to start:",
|
|
39
|
+
channelData: {
|
|
40
|
+
telegram: { buttons },
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Fallback for non-Telegram channels
|
|
20
46
|
return {
|
|
21
47
|
text: "Usage: /flow_start <flow-name>\n\nExample: /flow_start pushups\n\nUse /flow_list to see available flows.",
|
|
22
48
|
};
|