@positronic/template-new-project 0.0.64 → 0.0.66
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/index.js +4 -4
- package/package.json +1 -1
- package/template/CLAUDE.md +3 -1
- package/template/docs/brain-dsl-guide.md +4 -3
package/index.js
CHANGED
|
@@ -53,10 +53,10 @@ module.exports = {
|
|
|
53
53
|
],
|
|
54
54
|
setup: async ctx => {
|
|
55
55
|
const devRootPath = process.env.POSITRONIC_LOCAL_PATH;
|
|
56
|
-
let coreVersion = '^0.0.
|
|
57
|
-
let cloudflareVersion = '^0.0.
|
|
58
|
-
let clientVercelVersion = '^0.0.
|
|
59
|
-
let genUIComponentsVersion = '^0.0.
|
|
56
|
+
let coreVersion = '^0.0.66';
|
|
57
|
+
let cloudflareVersion = '^0.0.66';
|
|
58
|
+
let clientVercelVersion = '^0.0.66';
|
|
59
|
+
let genUIComponentsVersion = '^0.0.66';
|
|
60
60
|
|
|
61
61
|
// Map backend selection to package names
|
|
62
62
|
const backendPackageMap = {
|
package/package.json
CHANGED
package/template/CLAUDE.md
CHANGED
|
@@ -111,7 +111,7 @@ export default brain('approval-workflow')
|
|
|
111
111
|
.step('Request approval', ({ state }) => ({
|
|
112
112
|
...state, status: 'pending',
|
|
113
113
|
}))
|
|
114
|
-
.wait('Wait for approval', ({ state }) => approvalWebhook(state.requestId))
|
|
114
|
+
.wait('Wait for approval', ({ state }) => approvalWebhook(state.requestId), { timeout: '24h' })
|
|
115
115
|
.step('Process approval', ({ state, response }) => ({
|
|
116
116
|
...state,
|
|
117
117
|
status: response.approved ? 'approved' : 'rejected',
|
|
@@ -119,6 +119,8 @@ export default brain('approval-workflow')
|
|
|
119
119
|
}));
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
+
The optional `timeout` parameter accepts durations like `'30m'`, `'1h'`, `'24h'`, `'7d'`, or a number in milliseconds. If the timeout elapses without a webhook response, the brain is cancelled. Without a timeout, the brain waits indefinitely.
|
|
123
|
+
|
|
122
124
|
### CSRF Tokens for Pages with Forms
|
|
123
125
|
|
|
124
126
|
If your brain generates a custom HTML page with a form that submits to a webhook, you must include a CSRF token. Without a token, the server will reject the submission.
|
|
@@ -999,6 +999,7 @@ Key points about tool `waitFor`:
|
|
|
999
999
|
- You can wait for multiple webhooks (first response wins): `{ waitFor: [webhook1(...), webhook2(...)] }`
|
|
1000
1000
|
- The `execute` function receives a `context` parameter with access to `state`, `options`, `env`, etc.
|
|
1001
1001
|
- Use this pattern for approvals, external API callbacks, or any human-in-the-loop workflow
|
|
1002
|
+
- The built-in `waitForWebhook` tool defaults to a 1-hour timeout. Agents can customize via the `timeout` parameter (e.g., "30m", "24h", "7d"). If the timeout elapses, the brain is cancelled.
|
|
1002
1003
|
|
|
1003
1004
|
### Agent Output Schema
|
|
1004
1005
|
|
|
@@ -1128,7 +1129,7 @@ brain('Archive Workflow')
|
|
|
1128
1129
|
await pages.create('my-page', html);
|
|
1129
1130
|
return { ...state, formToken };
|
|
1130
1131
|
})
|
|
1131
|
-
.wait('Wait for submission', ({ state }) => archiveWebhook(state.sessionId, state.formToken))
|
|
1132
|
+
.wait('Wait for submission', ({ state }) => archiveWebhook(state.sessionId, state.formToken), { timeout: '24h' })
|
|
1132
1133
|
.step('Process', ({ state, response }) => ({
|
|
1133
1134
|
...state,
|
|
1134
1135
|
name: response.name,
|
|
@@ -1210,8 +1211,8 @@ brain('Feedback Collector')
|
|
|
1210
1211
|
await slack.post('#feedback', `Please fill out: <%= '${page.url}' %>`);
|
|
1211
1212
|
return state;
|
|
1212
1213
|
})
|
|
1213
|
-
// Wait for form submission
|
|
1214
|
-
.wait('Wait for submission', ({ page }) => page.webhook)
|
|
1214
|
+
// Wait for form submission (timeout after 24 hours, brain is cancelled if no response)
|
|
1215
|
+
.wait('Wait for submission', ({ page }) => page.webhook, { timeout: '24h' })
|
|
1215
1216
|
// Process the form data (comes through response, not page)
|
|
1216
1217
|
.step('Process Feedback', ({ state, response }) => ({
|
|
1217
1218
|
...state,
|