@keystrokehq/cli 0.0.108 → 0.0.110
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.
|
@@ -86,6 +86,29 @@ export default definePollSource({
|
|
|
86
86
|
}).attach({ workflow });
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
+
### Ephemeral poll (agents)
|
|
90
|
+
|
|
91
|
+
Agents can register a scheduled codemode script with `set_trigger`:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
set_trigger({
|
|
95
|
+
kind: "poll",
|
|
96
|
+
key: "inbox",
|
|
97
|
+
schedule: "*/5 * * * *",
|
|
98
|
+
code: [
|
|
99
|
+
'const emails = await tools["list-emails"]({ query: "is:unread" });',
|
|
100
|
+
"if (emails.items.length === 0) return;",
|
|
101
|
+
"console.log(JSON.stringify({ count: emails.items.length, items: emails.items }));",
|
|
102
|
+
].join("\n"),
|
|
103
|
+
prompt: "You have {{payload.count}} unread emails.",
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- Write the script the same way you would for codemode (`bash` + `js-exec`).
|
|
108
|
+
- `console.log(JSON.stringify(result))` when there is work to do.
|
|
109
|
+
- Log nothing (or `null`) to skip — skipped ticks do not count toward `maxExecutions`.
|
|
110
|
+
- Prompt interpolation matches webhooks (`{{payload.path}}`).
|
|
111
|
+
|
|
89
112
|
## Develop & audit
|
|
90
113
|
|
|
91
114
|
While building, invoke the workflow directly:
|