@positronic/template-new-project 0.0.73 → 0.0.75

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 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.73';
57
- let cloudflareVersion = '^0.0.73';
58
- let clientVercelVersion = '^0.0.73';
59
- let genUIComponentsVersion = '^0.0.73';
56
+ let coreVersion = '^0.0.75';
57
+ let cloudflareVersion = '^0.0.75';
58
+ let clientVercelVersion = '^0.0.75';
59
+ let genUIComponentsVersion = '^0.0.75';
60
60
 
61
61
  // Map backend selection to package names
62
62
  const backendPackageMap = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@positronic/template-new-project",
3
- "version": "0.0.73",
3
+ "version": "0.0.75",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -126,7 +126,7 @@ The optional `timeout` parameter accepts durations like `'30m'`, `'1h'`, `'24h'`
126
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.
127
127
 
128
128
  1. Generate a token with `generateFormToken()` from `@positronic/core`
129
- 2. Add `<input type="hidden" name="__positronic_token" value="${token}">` to the form
129
+ 2. Add `<input type="hidden" name="__positronic_token" value="<%= '${token}' %>">` to the form
130
130
  3. Pass the token when creating the webhook registration: `myWebhook(identifier, token)`
131
131
 
132
132
  The `.ui()` step handles this automatically. See `/docs/brain-dsl-guide.md` for full examples.
package/template/_env CHANGED
@@ -33,4 +33,4 @@ R2_BUCKET_NAME=<%= projectName %>
33
33
  # 4. Copy your Account ID from the right sidebar on any Cloudflare page
34
34
  #
35
35
  # CLOUDFLARE_API_TOKEN=
36
- # CLOUDFLARE_ACCOUNT_ID=
36
+ # CLOUDFLARE_ACCOUNT_ID=
package/template/brain.ts CHANGED
@@ -81,7 +81,7 @@ import { components } from './components/index.js';
81
81
  * const memoryTools = createMem0Tools();
82
82
  * ```
83
83
  *
84
- * Memory is automatically scoped to the current user (via currentUser.id)
84
+ * Memory is automatically scoped to the current user (via currentUser.name)
85
85
  * and the brain name. No need to pass userId manually.
86
86
  *
87
87
  * See docs/memory-guide.md for full details.
@@ -1,6 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import { brain } from '../brain.js';
3
3
 
4
+ // This brain uses the AI client configured in runner.ts.
5
+ // By default it uses Google Gemini (requires GOOGLE_GENERATIVE_AI_API_KEY in .env).
6
+ // See runner.ts to switch to Anthropic, OpenAI, or any other Vercel AI SDK provider.
7
+
4
8
  const exampleBrain = brain('example')
5
9
  .step('Start', ({ state }) => ({
6
10
  ...state,
@@ -277,7 +277,7 @@ brain('sales-agent').withMemory(memory) // agentId = 'sales-agent'
277
277
 
278
278
  ### userId
279
279
 
280
- Automatically set from `currentUser.id` when the brain runs. All memory operations are automatically scoped to the current user — no need to pass userId manually:
280
+ Automatically set from `currentUser.name` when the brain runs. All memory operations are automatically scoped to the current user — no need to pass userId manually:
281
281
 
282
282
  ```typescript
283
283
  // userId is auto-bound from currentUser — just use memory directly
@@ -234,7 +234,7 @@ const api = {
234
234
 
235
235
  ## currentUser
236
236
 
237
- Every brain run requires a `currentUser` — an object with at least an `id` field that identifies who is running the brain. This identity is used to scope per-user data like memory and store fields.
237
+ Every brain run requires a `currentUser` — an object with at least a `name` field that identifies who is running the brain. This identity is used to scope per-user data like memory and store fields.
238
238
 
239
239
  ### How currentUser Gets Set
240
240
 
@@ -251,7 +251,7 @@ import { runner } from './runner.js';
251
251
  import myBrain from './brains/my-brain.js';
252
252
 
253
253
  await runner.run(myBrain, {
254
- currentUser: { id: 'local-dev-user' },
254
+ currentUser: { name: 'local-dev-user' },
255
255
  });
256
256
  ```
257
257
 
@@ -261,7 +261,7 @@ await runner.run(myBrain, {
261
261
  const events = await collectEvents(
262
262
  testBrain.run({
263
263
  client: mockClient,
264
- currentUser: { id: 'test-user' },
264
+ currentUser: { name: 'test-user' },
265
265
  })
266
266
  );
267
267
  ```
@@ -278,7 +278,7 @@ const events = await collectEvents(
278
278
  ```typescript
279
279
  export default brain('greet')
280
280
  .step('Hello', ({ currentUser }) => ({
281
- greeting: 'Hello, user ' + currentUser.id,
281
+ greeting: 'Hello, user ' + currentUser.name,
282
282
  }));
283
283
  ```
284
284
 
@@ -5,6 +5,39 @@ import { google } from '@ai-sdk/google';
5
5
  /**
6
6
  * The BrainRunner executes brains with the configured client and adapters.
7
7
  *
8
+ * ## AI Provider Setup
9
+ *
10
+ * By default this uses Google Gemini. Set GOOGLE_GENERATIVE_AI_API_KEY in
11
+ * your .env file (get a key at https://aistudio.google.com/apikey).
12
+ *
13
+ * To switch to a different provider, install its Vercel AI SDK adapter
14
+ * and swap the model below:
15
+ *
16
+ * **Anthropic (Claude):**
17
+ * ```bash
18
+ * npm install @ai-sdk/anthropic
19
+ * ```
20
+ * ```typescript
21
+ * import { anthropic } from '@ai-sdk/anthropic';
22
+ * const client = new VercelClient(anthropic('claude-sonnet-4-5-20250929'));
23
+ * ```
24
+ * Then set ANTHROPIC_API_KEY in your .env file.
25
+ *
26
+ * **OpenAI:**
27
+ * ```bash
28
+ * npm install @ai-sdk/openai
29
+ * ```
30
+ * ```typescript
31
+ * import { openai } from '@ai-sdk/openai';
32
+ * const client = new VercelClient(openai('gpt-4o'));
33
+ * ```
34
+ * Then set OPENAI_API_KEY in your .env file.
35
+ *
36
+ * Any provider supported by the Vercel AI SDK works — just install the
37
+ * package and pass the model to VercelClient.
38
+ *
39
+ * ## Memory
40
+ *
8
41
  * To add memory (automatic conversation indexing with Mem0):
9
42
  *
10
43
  * ```typescript
@@ -23,7 +56,6 @@ import { google } from '@ai-sdk/google';
23
56
  * });
24
57
  * ```
25
58
  *
26
- * The adapter automatically indexes all agent conversations to memory.
27
59
  * See docs/memory-guide.md for more details.
28
60
  */
29
61
  const client = new VercelClient(google('gemini-3-pro-preview'));