@runflow-ai/cli 0.2.36 → 0.2.37

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.
@@ -21,8 +21,7 @@ function generateAgentCode(config) {
21
21
  }
22
22
  function generateMainTs(config) {
23
23
  const { agentName, provider, model } = config;
24
- return `import { Agent, log, ${provider}, track } from '@runflow-ai/sdk';
25
- // import { identify } from '@runflow-ai/sdk';
24
+ return `import { Agent, identify, log, ${provider}, track } from '@runflow-ai/sdk';
26
25
  // import { connector } from '@runflow-ai/sdk';
27
26
  import { tools } from './tools';
28
27
  import { systemPrompt } from './prompts';
@@ -40,7 +39,6 @@ const agent = new Agent({
40
39
  tools,
41
40
 
42
41
  // Memory - stores conversation history per session
43
- // sessionId is automatically provided by rf test and execution engine
44
42
  memory: {
45
43
  maxTurns: 10,
46
44
  },
@@ -55,9 +53,6 @@ const agent = new Agent({
55
53
  // k: 5,
56
54
  // threshold: 0.7,
57
55
  // },
58
-
59
- // Uncomment to enable debug logging
60
- // debug: true,
61
56
  });
62
57
 
63
58
  // ---------------------------------------------------------------------------
@@ -73,9 +68,12 @@ const agent = new Agent({
73
68
  export async function main(input: { message: string; sessionId?: string }) {
74
69
  const { message, sessionId } = validateInput(input);
75
70
 
76
- // --- User identity (uncomment to bind memory to a user instead of session) ---
71
+ // Identify groups all logs, traces and memory under this user
72
+ // Replace with real user data from your input (e.g. input.phone, input.email)
73
+ identify('demo-user@example.com');
74
+
75
+ // --- More identify examples ---
77
76
  // identify('+5511999999999'); // phone
78
- // identify('user@email.com'); // email
79
77
  // identify({ type: 'hubspot_contact', value: 'cid_123' });// CRM
80
78
 
81
79
  log('Processing message', { sessionId, messageLength: message.length });
@@ -120,8 +118,7 @@ export default main;
120
118
  }
121
119
  function generateMainTsWithRag(config) {
122
120
  const { agentName, provider, model } = config;
123
- return `import { Agent, log, ${provider}, track } from '@runflow-ai/sdk';
124
- // import { identify } from '@runflow-ai/sdk';
121
+ return `import { Agent, identify, log, ${provider}, track } from '@runflow-ai/sdk';
125
122
  // import { connector } from '@runflow-ai/sdk';
126
123
  import { tools } from './tools';
127
124
  import { systemPrompt } from './prompts';
@@ -152,11 +149,7 @@ const agent = new Agent({
152
149
  },
153
150
 
154
151
  // Observability - traces every LLM call, tool execution and memory access
155
- // 'full' is the default; change to 'standard' (truncated) or 'minimal' (off)
156
152
  observability: 'full',
157
-
158
- // Uncomment to enable debug logging
159
- // debug: true,
160
153
  });
161
154
 
162
155
  // ---------------------------------------------------------------------------
@@ -165,9 +158,12 @@ const agent = new Agent({
165
158
  export async function main(input: { message: string; sessionId?: string }) {
166
159
  const { message, sessionId } = validateInput(input);
167
160
 
168
- // --- User identity (uncomment to bind memory to a user instead of session) ---
161
+ // Identify groups all logs, traces and memory under this user
162
+ // Replace with real user data from your input (e.g. input.phone, input.email)
163
+ identify('demo-user@example.com');
164
+
165
+ // --- More identify examples ---
169
166
  // identify('+5511999999999'); // phone
170
- // identify('user@email.com'); // email
171
167
  // identify({ type: 'hubspot_contact', value: 'cid_123' });// CRM
172
168
 
173
169
  log('Processing message', { sessionId, messageLength: message.length });
@@ -216,7 +212,7 @@ function generateToolsIndex() {
216
212
 
217
213
  /**
218
214
  * Agent Tools Registry
219
- *
215
+ *
220
216
  * Tools are registered as a Record<string, RunflowTool>
221
217
  * The key should match the tool's 'id' property
222
218
  */
@@ -231,7 +227,7 @@ import { z } from 'zod';
231
227
 
232
228
  /**
233
229
  * Weather Tool - Get current temperature for any city
234
- *
230
+ *
235
231
  * Uses Open-Meteo API (free, no API key required)
236
232
  * Documentation: https://open-meteo.com/
237
233
  */
@@ -245,7 +241,7 @@ export const getWeather = createTool({
245
241
 
246
242
  execute: async ({ context }) => {
247
243
  const { city } = context;
248
-
244
+
249
245
  try {
250
246
  // 1. Geocoding: Convert city name to coordinates
251
247
  const geoUrl = \`https://geocoding-api.open-meteo.com/v1/search?name=\${encodeURIComponent(city)}&count=1&language=en\`;
@@ -258,9 +254,9 @@ export const getWeather = createTool({
258
254
  const geoData = await geoResponse.json();
259
255
 
260
256
  if (!geoData.results || geoData.results.length === 0) {
261
- return {
262
- success: false,
263
- error: \`City "\${city}" not found. Try a different spelling or a nearby major city.\`
257
+ return {
258
+ success: false,
259
+ error: \`City "\${city}" not found. Try a different spelling or a nearby major city.\`
264
260
  };
265
261
  }
266
262
 
@@ -345,7 +341,7 @@ function getWeatherDescription(code: number): string {
345
341
  function generatePromptsIndex(agentName) {
346
342
  return `/**
347
343
  * System Prompts for ${agentName}
348
- *
344
+ *
349
345
  * These prompts define the agent's personality, capabilities, and behavior.
350
346
  * You can customize them to match your use case.
351
347
  */
@@ -374,13 +370,8 @@ export const systemPrompt = \`You are ${agentName}, a helpful and knowledgeable
374
370
  * Additional prompt templates you can use
375
371
  */
376
372
  export const prompts = {
377
- // Greeting prompt for new sessions
378
373
  greeting: \`Hello! I'm ${agentName}. I can help you check the weather for any city, answer questions, or just chat. What can I do for you today?\`,
379
-
380
- // Error handling prompt
381
374
  errorRecovery: \`I encountered an issue processing that request. Could you please rephrase or try again?\`,
382
-
383
- // Weather-specific prompt enhancement
384
375
  weatherContext: \`When providing weather information, include the temperature, how it feels, humidity, and wind conditions.\`,
385
376
  };
386
377
  `;
@@ -397,7 +388,7 @@ function generatePackageJson(agentSlug) {
397
388
  deploy: 'rf agents deploy',
398
389
  },
399
390
  dependencies: {
400
- '@runflow-ai/sdk': '^1.0.95',
391
+ '@runflow-ai/sdk': '^1.0.96',
401
392
  zod: '^3.23.0',
402
393
  },
403
394
  devDependencies: {
@@ -439,16 +430,16 @@ rf agents deploy # Deploy to production
439
430
 
440
431
  \`\`\`
441
432
  ${agentSlug}/
442
- ├── main.ts # Entry point - agent config, track, log
443
- ├── tools/
444
- ├── index.ts # Tools registry
445
- └── weather.ts # Example tool (Open-Meteo API)
446
- ├── prompts/
447
- └── index.ts # System prompt and templates
448
- ├── .runflow/
449
- └── rf.json # Runflow configuration (auto-generated)
450
- ├── package.json
451
- └── tsconfig.json
433
+ \u251C\u2500\u2500 main.ts # Entry point - agent config, track, log
434
+ \u251C\u2500\u2500 tools/
435
+ \u2502 \u251C\u2500\u2500 index.ts # Tools registry
436
+ \u2502 \u2514\u2500\u2500 weather.ts # Example tool (Open-Meteo API)
437
+ \u251C\u2500\u2500 prompts/
438
+ \u2502 \u2514\u2500\u2500 index.ts # System prompt and templates
439
+ \u251C\u2500\u2500 .runflow/
440
+ \u2502 \u2514\u2500\u2500 rf.json # Runflow configuration (auto-generated)
441
+ \u251C\u2500\u2500 package.json
442
+ \u2514\u2500\u2500 tsconfig.json
452
443
  \`\`\`
453
444
 
454
445
  ## SDK Features Used
@@ -461,7 +452,7 @@ ${agentSlug}/
461
452
  | **Observability** | Active | Full tracing of LLM, tools and memory |
462
453
  | **track()** | Active | Business event tracking |
463
454
  | **log()** | Active | Custom observability logs |
464
- | **identify()** | Commented | Bind memory to user identity (phone, email, CRM) |
455
+ | **identify()** | Active | Groups logs and memory under a user |
465
456
  | **connector()** | Commented | Call external services (HubSpot, Slack, etc.) |
466
457
  | **RAG** | Commented | Retrieval Augmented Generation |
467
458
 
@@ -1 +1 @@
1
- {"version":3,"file":"code-generator.js","sourceRoot":"","sources":["../../../src/commands/create/code-generator.ts"],"names":[],"mappings":";;AAsBA,8CAqBC;AArBD,SAAgB,iBAAiB,CAAC,MAA+B;IAC/D,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,SAAS,EAAE,GAAG,MAAM,CAAC;IACpE,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAErC,MAAM,KAAK,GAAoB;QAC7B,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE;QACpD,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,EAAE,EAAE;QACzD,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,mBAAmB,EAAE,EAAE;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AAC;AAC3C,CAAC;AAKD,SAAS,cAAc,CAAC,SAAiB,EAAE,SAAiB;IAC1D,OAAO,KAAK,SAAS;;;;;;;;;;;;;;;EAerB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DV,CAAC;AACF,CAAC;AAKD,SAAS,iBAAiB;IACxB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BR,CAAC;AACF,CAAC;AAKD,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI;SACR,WAAW,EAAE;SACb,IAAI,EAAE;SACN,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runflow-ai/cli",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
4
4
  "description": "Official CLI for RunFlow AI platform - manage agents, deploy code, and interact with AI workflows from your terminal",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",