agentlaunch-templates 0.3.2 → 0.4.1
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/claude-context.d.ts.map +1 -1
- package/dist/claude-context.js +21 -18
- package/dist/claude-context.js.map +1 -1
- package/dist/generator.d.ts +20 -0
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +154 -7
- package/dist/generator.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/registry.d.ts +2 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +4 -1
- package/dist/registry.js.map +1 -1
- package/dist/templates/chat-memory.d.ts +20 -0
- package/dist/templates/chat-memory.d.ts.map +1 -0
- package/dist/templates/chat-memory.js +284 -0
- package/dist/templates/chat-memory.js.map +1 -0
- package/dist/templates/genesis.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-context.d.ts","sourceRoot":"","sources":["../src/claude-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA6RxC,CAAC;AAMF,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAoGzC,CAAC;AAMF,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"claude-context.d.ts","sourceRoot":"","sources":["../src/claude-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA6RxC,CAAC;AAMF,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAoGzC,CAAC;AAMF,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MA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;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,OAAO,GAAG,MAAM,CAuC3F;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,EAAE,EAC3B,aAAa,EAAE,OAAO,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWxB"}
|
package/dist/claude-context.js
CHANGED
|
@@ -87,12 +87,12 @@ payload = {"code": json.dumps(code_array)}
|
|
|
87
87
|
`,
|
|
88
88
|
"uagent-patterns.md": `# uAgent Code Patterns
|
|
89
89
|
|
|
90
|
-
> For new agents,
|
|
90
|
+
> For new agents, run: \`npx agentlaunch myagent\` (uses chat-memory template by default)
|
|
91
91
|
|
|
92
92
|
## Minimal Working Agent
|
|
93
93
|
|
|
94
94
|
\`\`\`python
|
|
95
|
-
from uagents import Agent, Context
|
|
95
|
+
from uagents import Agent, Context, Protocol
|
|
96
96
|
from uagents_core.contrib.protocols.chat import (
|
|
97
97
|
ChatMessage, ChatAcknowledgement, TextContent,
|
|
98
98
|
EndSessionContent, chat_protocol_spec
|
|
@@ -100,7 +100,7 @@ from uagents_core.contrib.protocols.chat import (
|
|
|
100
100
|
from datetime import datetime
|
|
101
101
|
|
|
102
102
|
agent = Agent()
|
|
103
|
-
chat_proto =
|
|
103
|
+
chat_proto = Protocol(spec=chat_protocol_spec)
|
|
104
104
|
|
|
105
105
|
@chat_proto.on_message(ChatMessage)
|
|
106
106
|
async def handle_message(ctx: Context, sender: str, msg: ChatMessage):
|
|
@@ -137,10 +137,10 @@ from uagents_core.contrib.protocols.payment import (
|
|
|
137
137
|
)
|
|
138
138
|
|
|
139
139
|
# Seller (service provider)
|
|
140
|
-
seller_proto =
|
|
140
|
+
seller_proto = Protocol(spec=payment_protocol_spec)
|
|
141
141
|
|
|
142
142
|
# Buyer (service consumer)
|
|
143
|
-
buyer_proto =
|
|
143
|
+
buyer_proto = Protocol(spec=payment_protocol_spec)
|
|
144
144
|
\`\`\`
|
|
145
145
|
|
|
146
146
|
## Commerce Layer (Genesis Template)
|
|
@@ -174,10 +174,10 @@ from uagents_core.contrib.protocols.payment import (
|
|
|
174
174
|
|
|
175
175
|
\`\`\`python
|
|
176
176
|
# Seller (service provider)
|
|
177
|
-
seller_proto =
|
|
177
|
+
seller_proto = Protocol(spec=payment_protocol_spec)
|
|
178
178
|
|
|
179
179
|
# Buyer (service consumer)
|
|
180
|
-
buyer_proto =
|
|
180
|
+
buyer_proto = Protocol(spec=payment_protocol_spec)
|
|
181
181
|
\`\`\`
|
|
182
182
|
|
|
183
183
|
## Payment Flow
|
|
@@ -401,12 +401,14 @@ export const DOCS = {
|
|
|
401
401
|
# Set API key
|
|
402
402
|
export AGENTVERSE_API_KEY=av-xxx
|
|
403
403
|
|
|
404
|
-
# Create agent project (
|
|
405
|
-
npx agentlaunch-
|
|
404
|
+
# Create agent project (deploys by default)
|
|
405
|
+
npx agentlaunch my-agent
|
|
406
|
+
|
|
407
|
+
# Or scaffold only (no deploy)
|
|
408
|
+
npx agentlaunch my-agent --local
|
|
406
409
|
|
|
407
410
|
# Or deploy a full swarm
|
|
408
|
-
npx agentlaunch
|
|
409
|
-
npx agentlaunch-cli create --type genesis --preset brain
|
|
411
|
+
npx agentlaunch --mode swarm
|
|
410
412
|
|
|
411
413
|
# Or use SDK
|
|
412
414
|
npm install agentlaunch-sdk
|
|
@@ -472,14 +474,16 @@ console.log(data.handoff_link); // Share with human
|
|
|
472
474
|
"cli-reference.md": `# CLI Reference
|
|
473
475
|
|
|
474
476
|
\`\`\`bash
|
|
475
|
-
npm install -g agentlaunch
|
|
477
|
+
npm install -g agentlaunch
|
|
476
478
|
\`\`\`
|
|
477
479
|
|
|
478
480
|
## Commands
|
|
479
481
|
|
|
480
482
|
| Command | Description |
|
|
481
483
|
|---------|-------------|
|
|
482
|
-
| \`agentlaunch
|
|
484
|
+
| \`npx agentlaunch\` | Interactive: prompts for name, deploys by default |
|
|
485
|
+
| \`npx agentlaunch <name>\` | Create agent with name (deploys by default) |
|
|
486
|
+
| \`npx agentlaunch <name> --local\` | Scaffold only, no deploy |
|
|
483
487
|
| \`agentlaunch deploy\` | Deploy agent.py to Agentverse |
|
|
484
488
|
| \`agentlaunch tokenize\` | Create token + handoff link |
|
|
485
489
|
| \`agentlaunch list\` | List tokens |
|
|
@@ -489,9 +493,8 @@ npm install -g agentlaunch-cli
|
|
|
489
493
|
## Full Workflow
|
|
490
494
|
|
|
491
495
|
\`\`\`bash
|
|
492
|
-
agentlaunch
|
|
493
|
-
|
|
494
|
-
# Answer prompts -> agent deployed + tokenized
|
|
496
|
+
npx agentlaunch my-agent
|
|
497
|
+
# Prompts for description + API key -> agent deployed
|
|
495
498
|
\`\`\`
|
|
496
499
|
`,
|
|
497
500
|
"mcp-tools.md": `# MCP Tools Reference
|
|
@@ -806,7 +809,7 @@ export function buildPackageJson(name) {
|
|
|
806
809
|
"agentlaunch-sdk": "^0.2.0",
|
|
807
810
|
},
|
|
808
811
|
devDependencies: {
|
|
809
|
-
"agentlaunch
|
|
812
|
+
"agentlaunch": "^1.1.0",
|
|
810
813
|
},
|
|
811
814
|
}, null, 2) + "\n";
|
|
812
815
|
}
|
|
@@ -1249,7 +1252,7 @@ export function buildSwarmPackageJson(swarmName) {
|
|
|
1249
1252
|
"agentlaunch-sdk": "^0.2.0",
|
|
1250
1253
|
},
|
|
1251
1254
|
devDependencies: {
|
|
1252
|
-
"agentlaunch
|
|
1255
|
+
"agentlaunch": "^1.1.0",
|
|
1253
1256
|
},
|
|
1254
1257
|
}, null, 2) + "\n";
|
|
1255
1258
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-context.js","sourceRoot":"","sources":["../src/claude-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8EAA8E;AAC9E,qCAAqC;AACrC,8EAA8E;AAE9E,MAAM,CAAC,MAAM,KAAK,GAA2B;IAC3C,gBAAgB,EAAE;;;;;;;;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,CAAC,YAAY,MAAM,WAAW,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAClE,MAAM,CAAC,UAAU,MAAM,WAAW,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC9D,MAAM,CAAC,YAAY,MAAM,WAAW,CAAC,GAAG,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/generator.d.ts
CHANGED
|
@@ -29,6 +29,26 @@ export interface GenerateOptions {
|
|
|
29
29
|
*/
|
|
30
30
|
strict?: boolean;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Generates a domain-specific system prompt from a description.
|
|
34
|
+
*
|
|
35
|
+
* Uses pattern matching against known domains — no API calls needed.
|
|
36
|
+
* Always returns a valid string. Never throws.
|
|
37
|
+
*
|
|
38
|
+
* @param description - What the agent does (from user input)
|
|
39
|
+
* @returns A rich system prompt tailored to the domain
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateSystemPrompt(description: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Generates the initial message for a Claude Code session, tailored to the
|
|
44
|
+
* deployed agent. This is what the user sees when Claude Code opens.
|
|
45
|
+
*/
|
|
46
|
+
export declare function generateWelcomeMessage(opts: {
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
agentAddress: string;
|
|
50
|
+
isDeployed: boolean;
|
|
51
|
+
}): string;
|
|
32
52
|
/**
|
|
33
53
|
* Generates agent files from a named template with variable substitution.
|
|
34
54
|
*
|
package/dist/generator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,MAAM,EAA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C;IACrB,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,MAAM,CAsBT;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,OAAO,GAAE,eAAmC,GAC3C,cAAc,CAqBhB"}
|
package/dist/generator.js
CHANGED
|
@@ -83,7 +83,7 @@ function buildReadme(template, vars) {
|
|
|
83
83
|
|
|
84
84
|
${description}
|
|
85
85
|
|
|
86
|
-
Generated
|
|
86
|
+
Generated by \`npx agentlaunch\` using the **${template.name}** template.
|
|
87
87
|
|
|
88
88
|
## Quickstart
|
|
89
89
|
|
|
@@ -257,7 +257,7 @@ AgentLaunch is a token launchpad for AI agents on Fetch.ai. Agents can:
|
|
|
257
257
|
|
|
258
258
|
### Authentication
|
|
259
259
|
|
|
260
|
-
**If this project was created with \`agentlaunch
|
|
260
|
+
**If this project was created with \`npx agentlaunch\`, your API key is already in \`.env\`.**
|
|
261
261
|
Do NOT ask the user for the key again — check \`.env\` first.
|
|
262
262
|
|
|
263
263
|
The key is sent as \`X-API-Key\` header on authenticated requests.
|
|
@@ -297,12 +297,13 @@ import {
|
|
|
297
297
|
} from 'agentlaunch-sdk';
|
|
298
298
|
\`\`\`
|
|
299
299
|
|
|
300
|
-
## CLI Reference (agentlaunch
|
|
300
|
+
## CLI Reference (agentlaunch)
|
|
301
301
|
|
|
302
302
|
| Command | Description |
|
|
303
303
|
|---------|-------------|
|
|
304
|
-
| \`agentlaunch
|
|
305
|
-
| \`agentlaunch
|
|
304
|
+
| \`npx agentlaunch\` | Interactive: prompts for name, deploys by default |
|
|
305
|
+
| \`npx agentlaunch <name>\` | Create agent with name (deploys by default) |
|
|
306
|
+
| \`npx agentlaunch <name> --local\` | Scaffold only, no deploy |
|
|
306
307
|
| \`agentlaunch deploy\` | Deploy agent.py to Agentverse |
|
|
307
308
|
| \`agentlaunch tokenize\` | Create token + get handoff link |
|
|
308
309
|
| \`agentlaunch list\` | List tokens on platform |
|
|
@@ -420,7 +421,7 @@ def handle_query(query: str) -> str:
|
|
|
420
421
|
- [skill.md](${RESOLVED_FRONTEND_URL}/skill.md)
|
|
421
422
|
- [Agentverse](https://agentverse.ai)
|
|
422
423
|
- [SDK on npm](https://www.npmjs.com/package/agentlaunch-sdk)
|
|
423
|
-
- [CLI on npm](https://www.npmjs.com/package/agentlaunch
|
|
424
|
+
- [CLI on npm](https://www.npmjs.com/package/agentlaunch)
|
|
424
425
|
- [MCP on npm](https://www.npmjs.com/package/agent-launch-mcp)
|
|
425
426
|
`;
|
|
426
427
|
}
|
|
@@ -454,6 +455,152 @@ function buildAgentlaunchConfig(template, vars) {
|
|
|
454
455
|
}, null, 2) + "\n";
|
|
455
456
|
}
|
|
456
457
|
// ---------------------------------------------------------------------------
|
|
458
|
+
// System prompt generation from description
|
|
459
|
+
// ---------------------------------------------------------------------------
|
|
460
|
+
/**
|
|
461
|
+
* Domain patterns for matching descriptions to system prompts.
|
|
462
|
+
* Each entry: [regex pattern, system prompt template].
|
|
463
|
+
* The {{description}} placeholder is replaced with the user's description.
|
|
464
|
+
* Patterns are tested in order — first match wins.
|
|
465
|
+
*/
|
|
466
|
+
const DOMAIN_PATTERNS = [
|
|
467
|
+
// -----------------------------------------------------------------------
|
|
468
|
+
// Agent types (specific use cases — match these FIRST)
|
|
469
|
+
// -----------------------------------------------------------------------
|
|
470
|
+
// Monitoring / alerting
|
|
471
|
+
[
|
|
472
|
+
/\b(monitor|alert|watch(?:es|ing)?|notif|surveillance|detect)/i,
|
|
473
|
+
`You are a monitoring and alerting specialist. You {{description}}. You check conditions at regular intervals, maintain alert history, and provide clear, actionable notifications. Minimize false positives.`,
|
|
474
|
+
],
|
|
475
|
+
// Trading / finance / market
|
|
476
|
+
[
|
|
477
|
+
/\b(trad(?:e|ing)|price|market|signal|portfolio|invest)/i,
|
|
478
|
+
`You are a market analysis specialist. You {{description}}. Provide data-driven insights, explain your reasoning, and always include risk disclaimers. Never guarantee returns.`,
|
|
479
|
+
],
|
|
480
|
+
// Research / analysis
|
|
481
|
+
[
|
|
482
|
+
/\b(research|analy[sz]|report|investigat|study|deep\s*div)/i,
|
|
483
|
+
`You are a research analyst. You {{description}}. Provide thorough, evidence-based analysis with clear conclusions. Cite sources when possible. Structure reports with executive summaries and detailed findings.`,
|
|
484
|
+
],
|
|
485
|
+
// Customer support / help desk
|
|
486
|
+
[
|
|
487
|
+
/\b(support|help\s*desk|customer|faq|troubleshoot)/i,
|
|
488
|
+
`You are a helpful customer support agent. You {{description}}. Be patient, empathetic, and solution-oriented. Ask clarifying questions when needed. Escalate issues you cannot resolve.`,
|
|
489
|
+
],
|
|
490
|
+
// Education / tutoring
|
|
491
|
+
[
|
|
492
|
+
/\b(teach|tutor|learn|educat|quiz|lesson)/i,
|
|
493
|
+
`You are an educational tutor. You {{description}}. Adapt your explanations to the learner's level. Use examples, analogies, and step-by-step breakdowns. Check understanding before moving on.`,
|
|
494
|
+
],
|
|
495
|
+
// Writing / content
|
|
496
|
+
[
|
|
497
|
+
/\b(writ(?:e|ing)|content|blog|article|copywrite|proofread)/i,
|
|
498
|
+
`You are a skilled writer and editor. You {{description}}. Match the requested tone and style. Provide clear, engaging prose. Offer constructive feedback on drafts.`,
|
|
499
|
+
],
|
|
500
|
+
// Health / fitness
|
|
501
|
+
[
|
|
502
|
+
/\b(health|fitness|nutrition|workout|diet|wellness|medical)/i,
|
|
503
|
+
`You are a health and wellness advisor. You {{description}}. Provide evidence-based guidance. Always recommend consulting a healthcare professional for medical decisions. Focus on general wellness principles.`,
|
|
504
|
+
],
|
|
505
|
+
// -----------------------------------------------------------------------
|
|
506
|
+
// Technology domains (match after agent types)
|
|
507
|
+
// -----------------------------------------------------------------------
|
|
508
|
+
// Programming languages / frameworks
|
|
509
|
+
[
|
|
510
|
+
/\b(typescript|javascript|node\.?js|react|vue|angular|svelte|next\.?js)/i,
|
|
511
|
+
`You are an expert JavaScript/TypeScript developer and technical advisor. You help developers with {{description}}. Provide clear code examples, explain best practices, and reference official documentation when relevant. Be concise and practical.`,
|
|
512
|
+
],
|
|
513
|
+
[
|
|
514
|
+
/\b(python|django|flask|fastapi|pandas|numpy)/i,
|
|
515
|
+
`You are an expert Python developer. You help with {{description}}. Provide working code examples, explain Pythonic patterns, and reference standard library solutions when possible. Be concise.`,
|
|
516
|
+
],
|
|
517
|
+
[
|
|
518
|
+
/\b(rust|cargo|tokio|wasm)/i,
|
|
519
|
+
`You are an expert Rust developer. You help with {{description}}. Focus on ownership, lifetimes, and zero-cost abstractions. Provide safe, idiomatic code examples.`,
|
|
520
|
+
],
|
|
521
|
+
[
|
|
522
|
+
/\b(solidity|smart\s*contract|evm|ethereum|hardhat|foundry)/i,
|
|
523
|
+
`You are a smart contract security expert. You help with {{description}}. Prioritize security patterns (reentrancy guards, access control, input validation). Reference OpenZeppelin implementations when applicable.`,
|
|
524
|
+
],
|
|
525
|
+
// Data / databases
|
|
526
|
+
[
|
|
527
|
+
/\b(database|sql|postgres|mysql|typedb|neo4j|graph\s*db|mongo|redis)/i,
|
|
528
|
+
`You are a database expert. You help with {{description}}. Provide optimized queries, explain indexing strategies, and help with schema design. Consider performance and scalability.`,
|
|
529
|
+
],
|
|
530
|
+
// Blockchain / web3
|
|
531
|
+
[
|
|
532
|
+
/\b(blockchain|web3|defi|dex|nft|wallet|crypto)/i,
|
|
533
|
+
`You are a blockchain and Web3 expert. You help with {{description}}. Explain on-chain concepts clearly, provide safe transaction patterns, and warn about common security pitfalls.`,
|
|
534
|
+
],
|
|
535
|
+
// DevOps / infrastructure
|
|
536
|
+
[
|
|
537
|
+
/\b(devops|docker|kubernetes|ci\/cd|infrastructure|terraform|aws|gcp|azure)/i,
|
|
538
|
+
`You are a DevOps and infrastructure expert. You {{description}}. Focus on reliability, security, and automation. Provide working configurations and explain trade-offs between approaches.`,
|
|
539
|
+
],
|
|
540
|
+
// AI / ML
|
|
541
|
+
[
|
|
542
|
+
/\b(ai\b|machine\s*learn|neural|llm|gpt|claude|training|inference|nlp)/i,
|
|
543
|
+
`You are an AI and machine learning specialist. You {{description}}. Explain concepts clearly, recommend appropriate models and techniques, and help with implementation. Consider compute costs and data requirements.`,
|
|
544
|
+
],
|
|
545
|
+
];
|
|
546
|
+
/**
|
|
547
|
+
* Generates a domain-specific system prompt from a description.
|
|
548
|
+
*
|
|
549
|
+
* Uses pattern matching against known domains — no API calls needed.
|
|
550
|
+
* Always returns a valid string. Never throws.
|
|
551
|
+
*
|
|
552
|
+
* @param description - What the agent does (from user input)
|
|
553
|
+
* @returns A rich system prompt tailored to the domain
|
|
554
|
+
*/
|
|
555
|
+
export function generateSystemPrompt(description) {
|
|
556
|
+
if (!description || !description.trim()) {
|
|
557
|
+
return "You are a helpful AI assistant. Be concise and accurate.";
|
|
558
|
+
}
|
|
559
|
+
const trimmed = description.trim();
|
|
560
|
+
for (const [pattern, template] of DOMAIN_PATTERNS) {
|
|
561
|
+
if (pattern.test(trimmed)) {
|
|
562
|
+
return template.replace(/\{\{description\}\}/g, trimmed.toLowerCase());
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
// Fallback: create a natural prompt from the description
|
|
566
|
+
// Handle descriptions that start with verbs (e.g. "answers questions about X")
|
|
567
|
+
const lower = trimmed.toLowerCase();
|
|
568
|
+
const startsWithVerb = /^(answers?|helps?|provides?|monitors?|tracks?|analyz|finds?|generates?|creates?|manages?|handles?)/.test(lower);
|
|
569
|
+
if (startsWithVerb) {
|
|
570
|
+
return `You are an AI agent that ${lower}. Be helpful, accurate, and concise. Provide specific, actionable responses.`;
|
|
571
|
+
}
|
|
572
|
+
// Handle noun-style descriptions (e.g. "TypeDB expert")
|
|
573
|
+
return `You are an AI agent specializing in: ${trimmed}. Be helpful, accurate, and concise. Provide specific, actionable responses based on your expertise.`;
|
|
574
|
+
}
|
|
575
|
+
// ---------------------------------------------------------------------------
|
|
576
|
+
// Welcome message generation for Claude Code sessions
|
|
577
|
+
// ---------------------------------------------------------------------------
|
|
578
|
+
/**
|
|
579
|
+
* Generates the initial message for a Claude Code session, tailored to the
|
|
580
|
+
* deployed agent. This is what the user sees when Claude Code opens.
|
|
581
|
+
*/
|
|
582
|
+
export function generateWelcomeMessage(opts) {
|
|
583
|
+
const { name, description, agentAddress, isDeployed } = opts;
|
|
584
|
+
if (isDeployed) {
|
|
585
|
+
return `I just deployed "${name}" to Agentverse at ${agentAddress}.
|
|
586
|
+
|
|
587
|
+
Description: ${description}
|
|
588
|
+
|
|
589
|
+
The agent is live with:
|
|
590
|
+
- Conversation memory (last 10 exchanges per user)
|
|
591
|
+
- LLM integration (ASI1-mini)
|
|
592
|
+
- Chat Protocol v0.3.0 (discoverable on Agentverse)
|
|
593
|
+
- Custom system prompt matching its purpose
|
|
594
|
+
|
|
595
|
+
Please start from Step 1 of the workflow — let's make this agent valuable.`;
|
|
596
|
+
}
|
|
597
|
+
return `I just scaffolded an agent called "${name}". The code is in agent.py but it's NOT deployed yet.
|
|
598
|
+
|
|
599
|
+
Description: ${description}
|
|
600
|
+
|
|
601
|
+
Please start from Step 1 of the workflow.`;
|
|
602
|
+
}
|
|
603
|
+
// ---------------------------------------------------------------------------
|
|
457
604
|
// Public API
|
|
458
605
|
// ---------------------------------------------------------------------------
|
|
459
606
|
/**
|
|
@@ -478,7 +625,7 @@ function buildAgentlaunchConfig(template, vars) {
|
|
|
478
625
|
export function generateFromTemplate(templateName, variables, options = { variables: {} }) {
|
|
479
626
|
const template = getTemplate(templateName);
|
|
480
627
|
if (!template) {
|
|
481
|
-
const available = ["
|
|
628
|
+
const available = ["chat-memory", "swarm-starter", "custom", "price-monitor", "trading-bot", "data-analyzer", "research", "gifter"];
|
|
482
629
|
throw new Error(`Template "${templateName}" not found. Available templates: ${available.join(", ")}`);
|
|
483
630
|
}
|
|
484
631
|
const strict = options.strict ?? false;
|
package/dist/generator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","s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AAM,cAAc,GAAG,mBAAmB,EAAE,CAAC;IAC7C,MAAM,iBAAiB,GAAG,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrE,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEnE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;AACrG,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
export type { AgentTemplate, TemplateVariable } from "./registry.js";
|
|
38
38
|
export { listTemplates, getTemplate, getCanonicalName } from "./registry.js";
|
|
39
39
|
export type { GenerateResult, GenerateOptions } from "./generator.js";
|
|
40
|
-
export { generateFromTemplate } from "./generator.js";
|
|
40
|
+
export { generateFromTemplate, generateSystemPrompt, generateWelcomeMessage } from "./generator.js";
|
|
41
41
|
export type { Preset } from "./presets.js";
|
|
42
42
|
export { getPreset, listPresets } from "./presets.js";
|
|
43
43
|
export { RULES, SKILLS, DOCS, EXAMPLES, buildPackageJson, CURSOR_MCP_CONFIG, CURSOR_RULES } from "./claude-context.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG7E,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG7E,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAGpG,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGvH,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* });
|
|
36
36
|
*/
|
|
37
37
|
export { listTemplates, getTemplate, getCanonicalName } from "./registry.js";
|
|
38
|
-
export { generateFromTemplate } from "./generator.js";
|
|
38
|
+
export { generateFromTemplate, generateSystemPrompt, generateWelcomeMessage } from "./generator.js";
|
|
39
39
|
export { getPreset, listPresets } from "./presets.js";
|
|
40
40
|
// Re-export Claude context (rules, skills, docs, examples, package.json, cursor config)
|
|
41
41
|
export { RULES, SKILLS, DOCS, EXAMPLES, buildPackageJson, CURSOR_MCP_CONFIG, CURSOR_RULES } from "./claude-context.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAI7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAI7E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAIpG,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,wFAAwF;AACxF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIvH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/registry.d.ts
CHANGED
|
@@ -45,7 +45,8 @@ export declare function listTemplates(): AgentTemplate[];
|
|
|
45
45
|
* Legacy name "genesis" continues to work.
|
|
46
46
|
*
|
|
47
47
|
* @example
|
|
48
|
-
* const tpl = getTemplate("
|
|
48
|
+
* const tpl = getTemplate("chat-memory"); // default
|
|
49
|
+
* const tpl2 = getTemplate("swarm-starter"); // commerce agents
|
|
49
50
|
* const tpl2 = getTemplate("genesis"); // legacy alias
|
|
50
51
|
* if (!tpl) throw new Error("Template not found");
|
|
51
52
|
*/
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,8DAA8D;IAC9D,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,wEAAwE;IACxE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;CACd;AA+BD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,aAAa,EAAE,CAE/C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAInE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAQ7D"}
|
package/dist/registry.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* 1. Creating src/templates/<name>.ts exporting `template: AgentTemplate`
|
|
7
7
|
* 2. Importing and adding to TEMPLATES below
|
|
8
8
|
*/
|
|
9
|
+
import { template as chatMemoryTemplate } from "./templates/chat-memory.js";
|
|
9
10
|
import { template as genesisTemplate } from "./templates/genesis.js";
|
|
10
11
|
import { template as customTemplate } from "./templates/custom.js";
|
|
11
12
|
import { template as priceMonitorTemplate } from "./templates/price-monitor.js";
|
|
@@ -17,6 +18,7 @@ import { template as gifterTemplate } from "./templates/gifter.js";
|
|
|
17
18
|
// Internal registry
|
|
18
19
|
// ---------------------------------------------------------------------------
|
|
19
20
|
const TEMPLATES = [
|
|
21
|
+
chatMemoryTemplate, // Base template - recommended starting point
|
|
20
22
|
genesisTemplate,
|
|
21
23
|
customTemplate,
|
|
22
24
|
priceMonitorTemplate,
|
|
@@ -52,7 +54,8 @@ export function listTemplates() {
|
|
|
52
54
|
* Legacy name "genesis" continues to work.
|
|
53
55
|
*
|
|
54
56
|
* @example
|
|
55
|
-
* const tpl = getTemplate("
|
|
57
|
+
* const tpl = getTemplate("chat-memory"); // default
|
|
58
|
+
* const tpl2 = getTemplate("swarm-starter"); // commerce agents
|
|
56
59
|
* const tpl2 = getTemplate("genesis"); // legacy alias
|
|
57
60
|
* if (!tpl) throw new Error("Template not found");
|
|
58
61
|
*/
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,QAAQ,IAAI,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,QAAQ,IAAI,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,QAAQ,IAA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B,cAAc;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,gBAAgB,GAA2B;IAC/C,eAAe,EAAE,SAAS;CAC3B,CAAC;AAEF,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,wDAAwD;IACxD,MAAM,YAAY,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;IACpD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,YAAoB;IACnD,qDAAqD;IACrD,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC/D,IAAI,MAAM,KAAK,YAAY,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chat-memory.ts — Base template with conversation memory and configurable LLM
|
|
3
|
+
*
|
|
4
|
+
* This is the foundation template for building AI agents on Agentverse.
|
|
5
|
+
* Features:
|
|
6
|
+
* - Conversation memory (persists last N exchanges per user)
|
|
7
|
+
* - Configurable LLM backend (ASI1, OpenRouter, OpenAI, or any compatible API)
|
|
8
|
+
* - Clean Chat Protocol v0.3.0 implementation
|
|
9
|
+
* - Session persistence via ctx.storage
|
|
10
|
+
* - Lazy LLM client initialization (avoids compile-time issues)
|
|
11
|
+
*
|
|
12
|
+
* Compatible LLM providers:
|
|
13
|
+
* - ASI1: https://api.asi1.ai/v1 (default)
|
|
14
|
+
* - OpenRouter: https://openrouter.ai/api/v1
|
|
15
|
+
* - OpenAI: https://api.openai.com/v1
|
|
16
|
+
* - Any OpenAI-compatible endpoint
|
|
17
|
+
*/
|
|
18
|
+
import type { AgentTemplate } from "../registry.js";
|
|
19
|
+
export declare const template: AgentTemplate;
|
|
20
|
+
//# sourceMappingURL=chat-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-memory.d.ts","sourceRoot":"","sources":["../../src/templates/chat-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,eAAO,MAAM,QAAQ,EAAE,aAyQtB,CAAC"}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chat-memory.ts — Base template with conversation memory and configurable LLM
|
|
3
|
+
*
|
|
4
|
+
* This is the foundation template for building AI agents on Agentverse.
|
|
5
|
+
* Features:
|
|
6
|
+
* - Conversation memory (persists last N exchanges per user)
|
|
7
|
+
* - Configurable LLM backend (ASI1, OpenRouter, OpenAI, or any compatible API)
|
|
8
|
+
* - Clean Chat Protocol v0.3.0 implementation
|
|
9
|
+
* - Session persistence via ctx.storage
|
|
10
|
+
* - Lazy LLM client initialization (avoids compile-time issues)
|
|
11
|
+
*
|
|
12
|
+
* Compatible LLM providers:
|
|
13
|
+
* - ASI1: https://api.asi1.ai/v1 (default)
|
|
14
|
+
* - OpenRouter: https://openrouter.ai/api/v1
|
|
15
|
+
* - OpenAI: https://api.openai.com/v1
|
|
16
|
+
* - Any OpenAI-compatible endpoint
|
|
17
|
+
*/
|
|
18
|
+
export const template = {
|
|
19
|
+
name: "chat-memory",
|
|
20
|
+
description: "AI agent with conversation memory and configurable LLM (ASI1, OpenRouter, OpenAI)",
|
|
21
|
+
category: "AI/ML",
|
|
22
|
+
variables: [
|
|
23
|
+
{ name: "agent_name", required: true, description: "Name of the agent" },
|
|
24
|
+
{
|
|
25
|
+
name: "description",
|
|
26
|
+
required: false,
|
|
27
|
+
default: "AI assistant with conversation memory",
|
|
28
|
+
description: "Short description of what this agent does",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "system_prompt",
|
|
32
|
+
default: "You are a helpful AI assistant. Be concise and accurate.",
|
|
33
|
+
description: "System prompt that defines the agent's personality and knowledge",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "llm_base_url",
|
|
37
|
+
default: "https://api.asi1.ai/v1",
|
|
38
|
+
description: "LLM API base URL (ASI1, OpenRouter, OpenAI, or compatible)",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "llm_model",
|
|
42
|
+
default: "asi1-mini",
|
|
43
|
+
description: "Model name to use (e.g., asi1-mini, gpt-4o-mini, claude-3-haiku)",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "max_history",
|
|
47
|
+
default: "10",
|
|
48
|
+
description: "Number of conversation exchanges to remember per user",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "max_tokens",
|
|
52
|
+
default: "1500",
|
|
53
|
+
description: "Maximum tokens in LLM response",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "temperature",
|
|
57
|
+
default: "0.7",
|
|
58
|
+
description: "LLM temperature (0.0-1.0, lower = more deterministic)",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
dependencies: ["openai"],
|
|
62
|
+
secrets: ["LLM_API_KEY", "AGENTVERSE_API_KEY"],
|
|
63
|
+
code: `"""
|
|
64
|
+
{{agent_name}} — AI Agent with Conversation Memory
|
|
65
|
+
|
|
66
|
+
{{description}}
|
|
67
|
+
|
|
68
|
+
Built with the chat-memory template.
|
|
69
|
+
Supports ASI1, OpenRouter, OpenAI, or any OpenAI-compatible LLM.
|
|
70
|
+
|
|
71
|
+
Environment variables (set as Agentverse secrets):
|
|
72
|
+
LLM_API_KEY - Your LLM provider API key (required)
|
|
73
|
+
LLM_BASE_URL - API endpoint (default: {{llm_base_url}})
|
|
74
|
+
LLM_MODEL - Model name (default: {{llm_model}})
|
|
75
|
+
SYSTEM_PROMPT - Override the default system prompt
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
from uagents import Agent, Context, Protocol
|
|
79
|
+
from uagents_core.contrib.protocols.chat import (
|
|
80
|
+
ChatMessage, ChatAcknowledgement, TextContent,
|
|
81
|
+
EndSessionContent, chat_protocol_spec
|
|
82
|
+
)
|
|
83
|
+
from datetime import datetime
|
|
84
|
+
import json
|
|
85
|
+
import os
|
|
86
|
+
|
|
87
|
+
agent = Agent()
|
|
88
|
+
chat_proto = Protocol(spec=chat_protocol_spec)
|
|
89
|
+
|
|
90
|
+
# =============================================================================
|
|
91
|
+
# CONFIGURATION
|
|
92
|
+
# =============================================================================
|
|
93
|
+
|
|
94
|
+
CONFIG = {
|
|
95
|
+
"name": "{{agent_name}}",
|
|
96
|
+
"description": "{{description}}",
|
|
97
|
+
"llm_base_url": os.environ.get("LLM_BASE_URL", "{{llm_base_url}}"),
|
|
98
|
+
"llm_model": os.environ.get("LLM_MODEL", "{{llm_model}}"),
|
|
99
|
+
"max_history": {{max_history}},
|
|
100
|
+
"max_tokens": {{max_tokens}},
|
|
101
|
+
"temperature": {{temperature}},
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
DEFAULT_SYSTEM_PROMPT = """{{system_prompt}}"""
|
|
105
|
+
|
|
106
|
+
SYSTEM_PROMPT = os.environ.get("SYSTEM_PROMPT", DEFAULT_SYSTEM_PROMPT)
|
|
107
|
+
|
|
108
|
+
# =============================================================================
|
|
109
|
+
# LLM CLIENT (Lazy initialization)
|
|
110
|
+
# =============================================================================
|
|
111
|
+
|
|
112
|
+
_llm_client = None
|
|
113
|
+
|
|
114
|
+
def get_llm_client():
|
|
115
|
+
"""Get or create LLM client. Lazy init avoids compile-time issues."""
|
|
116
|
+
global _llm_client
|
|
117
|
+
if _llm_client is None:
|
|
118
|
+
from openai import OpenAI
|
|
119
|
+
_llm_client = OpenAI(
|
|
120
|
+
api_key=os.environ.get("LLM_API_KEY", ""),
|
|
121
|
+
base_url=CONFIG["llm_base_url"]
|
|
122
|
+
)
|
|
123
|
+
return _llm_client
|
|
124
|
+
|
|
125
|
+
# =============================================================================
|
|
126
|
+
# CONVERSATION MEMORY
|
|
127
|
+
# =============================================================================
|
|
128
|
+
|
|
129
|
+
def get_session(ctx: Context, sender: str) -> dict:
|
|
130
|
+
"""Get or create session state with conversation history."""
|
|
131
|
+
key = f"session:{sender}"
|
|
132
|
+
data = ctx.storage.get(key)
|
|
133
|
+
if data:
|
|
134
|
+
session = json.loads(data)
|
|
135
|
+
if "history" not in session:
|
|
136
|
+
session["history"] = []
|
|
137
|
+
return session
|
|
138
|
+
return {"history": [], "message_count": 0}
|
|
139
|
+
|
|
140
|
+
def save_session(ctx: Context, sender: str, session: dict):
|
|
141
|
+
"""Persist session state."""
|
|
142
|
+
ctx.storage.set(f"session:{sender}", json.dumps(session))
|
|
143
|
+
|
|
144
|
+
def add_to_history(session: dict, role: str, content: str):
|
|
145
|
+
"""Add message to history, keeping only last MAX_HISTORY exchanges."""
|
|
146
|
+
session["history"].append({"role": role, "content": content})
|
|
147
|
+
max_messages = CONFIG["max_history"] * 2 # user + assistant pairs
|
|
148
|
+
if len(session["history"]) > max_messages:
|
|
149
|
+
session["history"] = session["history"][-max_messages:]
|
|
150
|
+
|
|
151
|
+
# =============================================================================
|
|
152
|
+
# LLM INTERACTION
|
|
153
|
+
# =============================================================================
|
|
154
|
+
|
|
155
|
+
def chat_with_llm(user_message: str, history: list = None) -> str:
|
|
156
|
+
"""
|
|
157
|
+
Send a message to the LLM with conversation history.
|
|
158
|
+
Returns the assistant's response.
|
|
159
|
+
"""
|
|
160
|
+
messages = [{"role": "system", "content": SYSTEM_PROMPT}]
|
|
161
|
+
|
|
162
|
+
if history:
|
|
163
|
+
messages.extend(history)
|
|
164
|
+
|
|
165
|
+
messages.append({"role": "user", "content": user_message})
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
client = get_llm_client()
|
|
169
|
+
response = client.chat.completions.create(
|
|
170
|
+
model=CONFIG["llm_model"],
|
|
171
|
+
messages=messages,
|
|
172
|
+
max_tokens=CONFIG["max_tokens"],
|
|
173
|
+
temperature=CONFIG["temperature"]
|
|
174
|
+
)
|
|
175
|
+
return response.choices[0].message.content
|
|
176
|
+
|
|
177
|
+
except Exception as e:
|
|
178
|
+
return f"I encountered an error: {str(e)}. Please try again."
|
|
179
|
+
|
|
180
|
+
# =============================================================================
|
|
181
|
+
# RESPONSE HELPERS
|
|
182
|
+
# =============================================================================
|
|
183
|
+
|
|
184
|
+
async def send_text(ctx: Context, sender: str, msg_id: str, text: str, end: bool = False):
|
|
185
|
+
"""Send a text response, optionally ending the session."""
|
|
186
|
+
await ctx.send(sender, ChatMessage(
|
|
187
|
+
timestamp=datetime.now(),
|
|
188
|
+
msg_id=msg_id,
|
|
189
|
+
content=[TextContent(text=text)]
|
|
190
|
+
))
|
|
191
|
+
if end:
|
|
192
|
+
await ctx.send(sender, ChatMessage(
|
|
193
|
+
timestamp=datetime.now(),
|
|
194
|
+
msg_id=msg_id,
|
|
195
|
+
content=[EndSessionContent()]
|
|
196
|
+
))
|
|
197
|
+
|
|
198
|
+
def get_help() -> str:
|
|
199
|
+
"""Return help message."""
|
|
200
|
+
return f"""# {CONFIG["name"]}
|
|
201
|
+
|
|
202
|
+
{CONFIG["description"]}
|
|
203
|
+
|
|
204
|
+
**Commands:**
|
|
205
|
+
- \`help\` — Show this message
|
|
206
|
+
- \`clear\` — Clear conversation history
|
|
207
|
+
- \`status\` — Show session info
|
|
208
|
+
|
|
209
|
+
Just send a message to start chatting!
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
# =============================================================================
|
|
213
|
+
# CHAT HANDLER
|
|
214
|
+
# =============================================================================
|
|
215
|
+
|
|
216
|
+
@chat_proto.on_message(ChatMessage)
|
|
217
|
+
async def handle_message(ctx: Context, sender: str, msg: ChatMessage):
|
|
218
|
+
"""Main chat handler with conversation memory."""
|
|
219
|
+
ctx.logger.info(f"Message from {sender}")
|
|
220
|
+
|
|
221
|
+
# Extract text from message
|
|
222
|
+
text = ""
|
|
223
|
+
for content in msg.content:
|
|
224
|
+
if hasattr(content, "text"):
|
|
225
|
+
text = content.text.strip()
|
|
226
|
+
break
|
|
227
|
+
|
|
228
|
+
if not text:
|
|
229
|
+
await send_text(ctx, sender, msg.msg_id, "Please send a text message.", end=True)
|
|
230
|
+
return
|
|
231
|
+
|
|
232
|
+
ctx.logger.info(f"Query: {text[:100]}")
|
|
233
|
+
|
|
234
|
+
# Get session with conversation history
|
|
235
|
+
session = get_session(ctx, sender)
|
|
236
|
+
|
|
237
|
+
# Handle commands
|
|
238
|
+
command = text.lower().split()[0] if text else ""
|
|
239
|
+
|
|
240
|
+
if command in {"help", "?", "start", "hello", "hi"}:
|
|
241
|
+
await send_text(ctx, sender, msg.msg_id, get_help(), end=True)
|
|
242
|
+
return
|
|
243
|
+
|
|
244
|
+
if command in {"clear", "reset", "new"}:
|
|
245
|
+
session["history"] = []
|
|
246
|
+
save_session(ctx, sender, session)
|
|
247
|
+
await send_text(ctx, sender, msg.msg_id, "Conversation cleared. Starting fresh!", end=True)
|
|
248
|
+
return
|
|
249
|
+
|
|
250
|
+
if command == "status":
|
|
251
|
+
status = f"""**Session Status**
|
|
252
|
+
- Messages: {session.get('message_count', 0)}
|
|
253
|
+
- History: {len(session.get('history', []))} messages
|
|
254
|
+
- Model: {CONFIG['llm_model']}
|
|
255
|
+
- Provider: {CONFIG['llm_base_url']}
|
|
256
|
+
"""
|
|
257
|
+
await send_text(ctx, sender, msg.msg_id, status, end=True)
|
|
258
|
+
return
|
|
259
|
+
|
|
260
|
+
# Chat with LLM using conversation history
|
|
261
|
+
response = chat_with_llm(text, session.get("history", []))
|
|
262
|
+
|
|
263
|
+
# Save this exchange to history
|
|
264
|
+
add_to_history(session, "user", text)
|
|
265
|
+
add_to_history(session, "assistant", response)
|
|
266
|
+
session["message_count"] = session.get("message_count", 0) + 1
|
|
267
|
+
save_session(ctx, sender, session)
|
|
268
|
+
|
|
269
|
+
await send_text(ctx, sender, msg.msg_id, response, end=True)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
@chat_proto.on_message(ChatAcknowledgement)
|
|
273
|
+
async def handle_ack(ctx: Context, sender: str, msg: ChatAcknowledgement):
|
|
274
|
+
"""Handle acknowledgements (required by protocol)."""
|
|
275
|
+
ctx.logger.info(f"Ack from {sender}: {msg.acknowledged_msg_id}")
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
agent.include(chat_proto, publish_manifest=True)
|
|
279
|
+
|
|
280
|
+
if __name__ == "__main__":
|
|
281
|
+
agent.run()
|
|
282
|
+
`,
|
|
283
|
+
};
|
|
284
|
+
//# sourceMappingURL=chat-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-memory.js","sourceRoot":"","sources":["../../src/templates/chat-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,CAAC,MAAM,QAAQ,GAAkB;IACrC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,mFAAmF;IAChG,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE;QACT,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE;QACxE;YACE,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,uCAAuC;YAChD,WAAW,EAAE,2CAA2C;SACzD;QACD;YACE,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,0DAA0D;YACnE,WAAW,EAAE,kEAAkE;SAChF;QACD;YACE,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,wBAAwB;YACjC,WAAW,EAAE,4DAA4D;SAC1E;QACD;YACE,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,WAAW;YACpB,WAAW,EAAE,kEAAkE;SAChF;QACD;YACE,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,uDAAuD;SACrE;QACD;YACE,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,gCAAgC;SAC9C;QACD;YACE,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,uDAAuD;SACrE;KACF;IACD,YAAY,EAAE,CAAC,QAAQ,CAAC;IACxB,OAAO,EAAE,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC9C,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2NP;CACA,CAAC"}
|
|
@@ -1142,7 +1142,7 @@ chat_proto = Protocol(spec=chat_protocol_spec)
|
|
|
1142
1142
|
|
|
1143
1143
|
# Payment protocol (seller side)
|
|
1144
1144
|
if PAYMENT_PROTOCOL_AVAILABLE and payment_protocol_spec is not None:
|
|
1145
|
-
pay_proto =
|
|
1145
|
+
pay_proto = Protocol(spec=payment_protocol_spec)
|
|
1146
1146
|
else:
|
|
1147
1147
|
pay_proto = Protocol(name="payment", version="1.0.0")
|
|
1148
1148
|
|