@agentforge/cli 0.12.1 → 0.12.2
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/dist/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/api/package.json +2 -2
- package/templates/api/src/routes/agent.ts +3 -2
- package/templates/api/src/server.ts +1 -1
- package/templates/cli/package.json +2 -2
- package/templates/cli/src/commands/analyze.ts +2 -1
- package/templates/cli/src/commands/chat.ts +2 -1
- package/templates/full/package.json +2 -2
- package/templates/full/src/index.ts +3 -2
- package/templates/full/src/tools/example.ts +3 -3
- package/templates/minimal/package.json +2 -2
- package/templates/minimal/src/index.ts +2 -1
- package/templates/tool-multi/index.ts +5 -5
|
@@ -4,7 +4,7 @@ import { createReActAgent } from '@agentforge/patterns';
|
|
|
4
4
|
import { createLogger } from '@agentforge/core';
|
|
5
5
|
|
|
6
6
|
const router = Router();
|
|
7
|
-
const logger = createLogger(
|
|
7
|
+
const logger = createLogger('agent-router');
|
|
8
8
|
|
|
9
9
|
// Initialize the agent
|
|
10
10
|
const model = new ChatOpenAI({
|
|
@@ -33,7 +33,8 @@ router.post('/chat', async (req, res) => {
|
|
|
33
33
|
messages: [{ role: 'user', content: message }],
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
37
|
+
const response = lastMessage?.content || 'No response';
|
|
37
38
|
|
|
38
39
|
res.json({
|
|
39
40
|
success: true,
|
|
@@ -33,7 +33,7 @@ function validateEnvironment(): void {
|
|
|
33
33
|
// Validate environment before starting
|
|
34
34
|
validateEnvironment();
|
|
35
35
|
|
|
36
|
-
const logger = createLogger({
|
|
36
|
+
const logger = createLogger('{{PROJECT_NAME}}');
|
|
37
37
|
const app = express();
|
|
38
38
|
const port = process.env.PORT || 3000;
|
|
39
39
|
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"format": "prettier --write ."
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agentforge/core": "^0.12.
|
|
24
|
-
"@agentforge/patterns": "^0.12.
|
|
23
|
+
"@agentforge/core": "^0.12.2",
|
|
24
|
+
"@agentforge/patterns": "^0.12.2",
|
|
25
25
|
"@langchain/core": "^1.1.17",
|
|
26
26
|
"@langchain/langgraph": "^1.1.2",
|
|
27
27
|
"@langchain/openai": "^1.2.3",
|
|
@@ -40,7 +40,8 @@ export async function analyzeCommand(file: string, options: AnalyzeOptions) {
|
|
|
40
40
|
],
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
44
|
+
const analysis = lastMessage?.content || 'No analysis available';
|
|
44
45
|
|
|
45
46
|
spinner.succeed('Analysis complete');
|
|
46
47
|
|
|
@@ -49,7 +49,8 @@ export async function chatCommand(options: ChatOptions) {
|
|
|
49
49
|
messages.push({ role: 'user', content: message });
|
|
50
50
|
|
|
51
51
|
const result = await agent.invoke({ messages });
|
|
52
|
-
const
|
|
52
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
53
|
+
const response = lastMessage?.content || 'No response';
|
|
53
54
|
|
|
54
55
|
messages.push({ role: 'assistant', content: response });
|
|
55
56
|
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"clean": "rm -rf dist"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@agentforge/core": "^0.12.
|
|
23
|
-
"@agentforge/patterns": "^0.12.
|
|
22
|
+
"@agentforge/core": "^0.12.2",
|
|
23
|
+
"@agentforge/patterns": "^0.12.2",
|
|
24
24
|
"@langchain/core": "^1.1.17",
|
|
25
25
|
"@langchain/langgraph": "^1.1.2",
|
|
26
26
|
"@langchain/openai": "^1.2.3",
|
|
@@ -4,7 +4,7 @@ import { createReActAgent } from '@agentforge/patterns';
|
|
|
4
4
|
import { createLogger } from '@agentforge/core';
|
|
5
5
|
import { exampleTool } from './tools/example.js';
|
|
6
6
|
|
|
7
|
-
const logger = createLogger({
|
|
7
|
+
const logger = createLogger('{{PROJECT_NAME}}');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Validate required environment variables
|
|
@@ -67,7 +67,8 @@ async function main() {
|
|
|
67
67
|
|
|
68
68
|
logger.info('✅ Agent completed');
|
|
69
69
|
console.log('\nFinal response:');
|
|
70
|
-
|
|
70
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
71
|
+
console.log(lastMessage?.content || 'No response');
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
// Run the main function
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { toolBuilder, ToolCategory } from '@agentforge/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Example tool that demonstrates the tool creation API
|
|
6
6
|
*/
|
|
7
|
-
export const exampleTool =
|
|
7
|
+
export const exampleTool = toolBuilder()
|
|
8
8
|
.name('example_tool')
|
|
9
9
|
.description('An example tool that greets a user by name')
|
|
10
|
-
.category(
|
|
10
|
+
.category(ToolCategory.UTILITY)
|
|
11
11
|
.schema(
|
|
12
12
|
z.object({
|
|
13
13
|
name: z.string().describe('The name of the person to greet'),
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"format": "prettier --write ."
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@agentforge/core": "^0.12.
|
|
20
|
-
"@agentforge/patterns": "^0.12.
|
|
19
|
+
"@agentforge/core": "^0.12.2",
|
|
20
|
+
"@agentforge/patterns": "^0.12.2",
|
|
21
21
|
"@langchain/core": "^1.1.17",
|
|
22
22
|
"@langchain/langgraph": "^1.1.2",
|
|
23
23
|
"@langchain/openai": "^1.2.3",
|
|
@@ -55,7 +55,8 @@ async function main() {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
console.log('\n✅ Agent response:');
|
|
58
|
-
|
|
58
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
59
|
+
console.log(lastMessage?.content || 'No response');
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
// Run the main function
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { toolBuilder, ToolCategory } from '@agentforge/core';
|
|
3
3
|
import { {{TOOL_NAME_PASCAL}}Schema } from './schemas.js';
|
|
4
4
|
import type { {{TOOL_NAME_PASCAL}}Input, {{TOOL_NAME_PASCAL}}Output } from './types.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* {{TOOL_DESCRIPTION}}
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* Category: {{TOOL_CATEGORY}}
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
13
|
* const result = await {{TOOL_NAME_CAMEL}}Tool.invoke({
|
|
@@ -16,10 +16,10 @@ import type { {{TOOL_NAME_PASCAL}}Input, {{TOOL_NAME_PASCAL}}Output } from './ty
|
|
|
16
16
|
* console.log(result);
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export const {{TOOL_NAME_CAMEL}}Tool =
|
|
19
|
+
export const {{TOOL_NAME_CAMEL}}Tool = toolBuilder()
|
|
20
20
|
.name('{{TOOL_NAME}}')
|
|
21
21
|
.description('{{TOOL_DESCRIPTION}}')
|
|
22
|
-
.category(
|
|
22
|
+
.category(ToolCategory.{{TOOL_CATEGORY_ENUM}})
|
|
23
23
|
.schema({{TOOL_NAME_PASCAL}}Schema)
|
|
24
24
|
.implement(async (input: {{TOOL_NAME_PASCAL}}Input): Promise<{{TOOL_NAME_PASCAL}}Output> => {
|
|
25
25
|
try {
|