agentlaunch-templates 0.1.0

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.
Files changed (37) hide show
  1. package/dist/generator.d.ts +43 -0
  2. package/dist/generator.d.ts.map +1 -0
  3. package/dist/generator.js +213 -0
  4. package/dist/generator.js.map +1 -0
  5. package/dist/index.d.ts +41 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +39 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/registry.d.ts +49 -0
  10. package/dist/registry.d.ts.map +1 -0
  11. package/dist/registry.js +47 -0
  12. package/dist/registry.js.map +1 -0
  13. package/dist/templates/custom.d.ts +11 -0
  14. package/dist/templates/custom.d.ts.map +1 -0
  15. package/dist/templates/custom.js +458 -0
  16. package/dist/templates/custom.js.map +1 -0
  17. package/dist/templates/data-analyzer.d.ts +11 -0
  18. package/dist/templates/data-analyzer.d.ts.map +1 -0
  19. package/dist/templates/data-analyzer.js +565 -0
  20. package/dist/templates/data-analyzer.js.map +1 -0
  21. package/dist/templates/gifter.d.ts +15 -0
  22. package/dist/templates/gifter.d.ts.map +1 -0
  23. package/dist/templates/gifter.js +717 -0
  24. package/dist/templates/gifter.js.map +1 -0
  25. package/dist/templates/price-monitor.d.ts +11 -0
  26. package/dist/templates/price-monitor.d.ts.map +1 -0
  27. package/dist/templates/price-monitor.js +577 -0
  28. package/dist/templates/price-monitor.js.map +1 -0
  29. package/dist/templates/research.d.ts +11 -0
  30. package/dist/templates/research.d.ts.map +1 -0
  31. package/dist/templates/research.js +593 -0
  32. package/dist/templates/research.js.map +1 -0
  33. package/dist/templates/trading-bot.d.ts +11 -0
  34. package/dist/templates/trading-bot.d.ts.map +1 -0
  35. package/dist/templates/trading-bot.js +559 -0
  36. package/dist/templates/trading-bot.js.map +1 -0
  37. package/package.json +24 -0
@@ -0,0 +1,43 @@
1
+ /**
2
+ * generator.ts — Variable substitution engine for @agent-launch/templates
3
+ *
4
+ * Takes a template name + variable map and returns the generated files
5
+ * ready to be written to disk or returned over the MCP protocol.
6
+ */
7
+ export interface GenerateResult {
8
+ /** The generated agent.py source code */
9
+ code: string;
10
+ /** A quickstart README.md for the generated project */
11
+ readme: string;
12
+ /** A .env.example file listing all required secrets */
13
+ envExample: string;
14
+ }
15
+ export interface GenerateOptions {
16
+ /** Variable values to inject into the template */
17
+ variables: Record<string, string>;
18
+ /**
19
+ * When true, missing required variables throw an error.
20
+ * When false (default for MCP/preview use), they are left as-is.
21
+ */
22
+ strict?: boolean;
23
+ }
24
+ /**
25
+ * Generates agent files from a named template with variable substitution.
26
+ *
27
+ * @param templateName - The template slug (e.g. "price-monitor")
28
+ * @param variables - Key-value pairs for `{{variable}}` placeholders
29
+ * @param options - Generation options (strict mode, etc.)
30
+ * @returns An object containing `code`, `readme`, and `envExample` strings
31
+ * @throws If the template is not found, or if `strict` is true and required
32
+ * variables are missing
33
+ *
34
+ * @example
35
+ * const result = generateFromTemplate("price-monitor", {
36
+ * agent_name: "MyPriceBot",
37
+ * token_address: "0xabc...",
38
+ * alert_threshold: "10",
39
+ * });
40
+ * fs.writeFileSync("agent.py", result.code);
41
+ */
42
+ export declare function generateFromTemplate(templateName: string, variables: Record<string, string>, options?: GenerateOptions): GenerateResult;
43
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAsMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,OAAO,GAAE,eAAmC,GAC3C,cAAc,CAiBhB"}
@@ -0,0 +1,213 @@
1
+ /**
2
+ * generator.ts — Variable substitution engine for @agent-launch/templates
3
+ *
4
+ * Takes a template name + variable map and returns the generated files
5
+ * ready to be written to disk or returned over the MCP protocol.
6
+ */
7
+ import { getTemplate } from "./registry.js";
8
+ // ---------------------------------------------------------------------------
9
+ // Core substitution
10
+ // ---------------------------------------------------------------------------
11
+ /**
12
+ * Replaces all `{{variable}}` placeholders in `text` with values from `vars`.
13
+ * Unknown placeholders are left untouched so callers can detect them.
14
+ */
15
+ function substitute(text, vars) {
16
+ return text.replace(/\{\{(\w+)\}\}/g, (match, key) => {
17
+ return Object.prototype.hasOwnProperty.call(vars, key) ? vars[key] : match;
18
+ });
19
+ }
20
+ /**
21
+ * Merges caller-supplied variables with template defaults.
22
+ * Required variables with no value will remain as empty string unless `strict` is true.
23
+ */
24
+ function resolveVariables(templateVars, supplied, strict) {
25
+ const resolved = {};
26
+ for (const v of templateVars) {
27
+ if (Object.prototype.hasOwnProperty.call(supplied, v.name) && supplied[v.name] !== "") {
28
+ resolved[v.name] = supplied[v.name];
29
+ }
30
+ else if (v.default !== undefined) {
31
+ resolved[v.name] = v.default;
32
+ }
33
+ else if (v.required) {
34
+ if (strict) {
35
+ throw new Error(`Required variable "${v.name}" was not provided for template.`);
36
+ }
37
+ // Leave the placeholder so the caller can see it is missing
38
+ resolved[v.name] = `{{${v.name}}}`;
39
+ }
40
+ else {
41
+ resolved[v.name] = "";
42
+ }
43
+ }
44
+ // Pass through any extra caller-supplied variables not declared in the template
45
+ for (const [k, val] of Object.entries(supplied)) {
46
+ if (!Object.prototype.hasOwnProperty.call(resolved, k)) {
47
+ resolved[k] = val;
48
+ }
49
+ }
50
+ return resolved;
51
+ }
52
+ // ---------------------------------------------------------------------------
53
+ // README generator
54
+ // ---------------------------------------------------------------------------
55
+ function buildReadme(template, vars) {
56
+ const name = vars["agent_name"] || template.name;
57
+ const description = vars["description"] || template.description;
58
+ const deps = template.dependencies.join(" ");
59
+ const secretsList = template.secrets
60
+ .map((s) => `- \`${s}\``)
61
+ .join("\n");
62
+ return `# ${name}
63
+
64
+ ${description}
65
+
66
+ Generated from the **${template.name}** template by \`agentlaunch scaffold\`.
67
+
68
+ ## Quickstart
69
+
70
+ ### 1. Install dependencies
71
+
72
+ \`\`\`bash
73
+ pip install uagents uagents-core ${deps}
74
+ \`\`\`
75
+
76
+ ### 2. Configure environment
77
+
78
+ \`\`\`bash
79
+ cp .env.example .env
80
+ # Edit .env and fill in the required values
81
+ \`\`\`
82
+
83
+ ### 3. Customize your agent
84
+
85
+ Open \`agent.py\` and edit the business logic class to add your own value exchange.
86
+
87
+ ### 4. Run locally
88
+
89
+ \`\`\`bash
90
+ source .env && python agent.py
91
+ \`\`\`
92
+
93
+ ### 5. Deploy to Agentverse
94
+
95
+ \`\`\`bash
96
+ agentlaunch deploy
97
+ \`\`\`
98
+
99
+ This uploads \`agent.py\` to Agentverse, sets secrets, and starts the agent.
100
+
101
+ ### 6. Tokenize your agent
102
+
103
+ \`\`\`bash
104
+ agentlaunch tokenize \\
105
+ --agent <address> \\
106
+ --name "${name}" \\
107
+ --symbol "${name.slice(0, 4).toUpperCase()}"
108
+ \`\`\`
109
+
110
+ You will receive a handoff link. Share it with a human to complete on-chain deployment.
111
+
112
+ ## Required Secrets
113
+
114
+ ${secretsList}
115
+
116
+ ## Platform Constants
117
+
118
+ - Deploy fee: **120 FET** (read dynamically from contract)
119
+ - Graduation target: **30,000 FET** — auto DEX listing
120
+ - Trading fee: **2%** — 100% to protocol treasury (no creator fee)
121
+
122
+ ## Key Commands
123
+
124
+ | Command | Description |
125
+ |---------|-------------|
126
+ | \`agentlaunch config show\` | Show current config |
127
+ | \`agentlaunch deploy\` | Deploy agent.py to Agentverse |
128
+ | \`agentlaunch tokenize\` | Create a token record + handoff link |
129
+
130
+ ## Resources
131
+
132
+ - [AgentLaunch Platform](https://agent-launch.ai)
133
+ - [Agentverse](https://agentverse.ai)
134
+ - [skill.md](https://agent-launch.ai/skill.md)
135
+ - [API docs](https://agent-launch.ai/docs/openapi)
136
+ `;
137
+ }
138
+ // ---------------------------------------------------------------------------
139
+ // .env.example generator
140
+ // ---------------------------------------------------------------------------
141
+ function buildEnvExample(template, vars) {
142
+ const name = vars["agent_name"] || template.name;
143
+ const lines = [
144
+ `# ${name} — Environment Variables`,
145
+ `# Copy to .env and fill in real values. Never commit .env to version control.`,
146
+ ``,
147
+ `# Your Agentverse API key (https://agentverse.ai/profile/api-keys)`,
148
+ `AGENTVERSE_API_KEY=`,
149
+ ``,
150
+ `# Your AgentLaunch API key (same as Agentverse key in most cases)`,
151
+ `AGENTLAUNCH_API_KEY=`,
152
+ ``,
153
+ `# The address of this agent on Agentverse (set after first deploy)`,
154
+ `AGENT_ADDRESS=`,
155
+ ``,
156
+ `# The wallet address that owns this agent (for owner-gated commands)`,
157
+ `AGENT_OWNER_ADDRESS=`,
158
+ ``,
159
+ `# Optional: override the API base URL (default: https://agent-launch.ai/api)`,
160
+ `# AGENTLAUNCH_API=https://agent-launch.ai/api`,
161
+ ];
162
+ // Add template-specific secrets that are not in the base set
163
+ const baseSecrets = new Set([
164
+ "AGENTVERSE_API_KEY",
165
+ "AGENTLAUNCH_API_KEY",
166
+ "AGENT_ADDRESS",
167
+ "AGENT_OWNER_ADDRESS",
168
+ ]);
169
+ const extraSecrets = template.secrets.filter((s) => !baseSecrets.has(s));
170
+ if (extraSecrets.length > 0) {
171
+ lines.push(``);
172
+ lines.push(`# Template-specific secrets`);
173
+ for (const secret of extraSecrets) {
174
+ lines.push(`${secret}=`);
175
+ }
176
+ }
177
+ return lines.join("\n") + "\n";
178
+ }
179
+ // ---------------------------------------------------------------------------
180
+ // Public API
181
+ // ---------------------------------------------------------------------------
182
+ /**
183
+ * Generates agent files from a named template with variable substitution.
184
+ *
185
+ * @param templateName - The template slug (e.g. "price-monitor")
186
+ * @param variables - Key-value pairs for `{{variable}}` placeholders
187
+ * @param options - Generation options (strict mode, etc.)
188
+ * @returns An object containing `code`, `readme`, and `envExample` strings
189
+ * @throws If the template is not found, or if `strict` is true and required
190
+ * variables are missing
191
+ *
192
+ * @example
193
+ * const result = generateFromTemplate("price-monitor", {
194
+ * agent_name: "MyPriceBot",
195
+ * token_address: "0xabc...",
196
+ * alert_threshold: "10",
197
+ * });
198
+ * fs.writeFileSync("agent.py", result.code);
199
+ */
200
+ export function generateFromTemplate(templateName, variables, options = { variables: {} }) {
201
+ const template = getTemplate(templateName);
202
+ if (!template) {
203
+ const available = ["custom", "price-monitor", "trading-bot", "data-analyzer", "research", "gifter"];
204
+ throw new Error(`Template "${templateName}" not found. Available templates: ${available.join(", ")}`);
205
+ }
206
+ const strict = options.strict ?? false;
207
+ const resolved = resolveVariables(template.variables, variables, strict);
208
+ const code = substitute(template.code, resolved);
209
+ const readme = buildReadme(template, resolved);
210
+ const envExample = buildEnvExample(template, resolved);
211
+ return { code, readme, envExample };
212
+ }
213
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAA6C,MAAM,eAAe,CAAC;AAyBvF,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAY,EAAE,IAA4B;IAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;QAC3D,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CA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AO,CAAC,MAAM,IAAI,KAAK,CAAC;IACvC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAEzE,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @agent-launch/templates
3
+ *
4
+ * Agent code templates for the AgentLaunch platform.
5
+ *
6
+ * Provides six ready-to-use Python agent templates built on:
7
+ * - Agentverse Chat Protocol v0.3.0
8
+ * - uAgents Agent() zero-param init
9
+ * - ctx.logger structured logging
10
+ * - Rate limiting, health monitoring, token-gated tiers
11
+ * - agent-launch.ai/api integration
12
+ *
13
+ * Platform constants (source of truth: deployed smart contracts):
14
+ * - Deploy fee: 120 FET (read dynamically, can change via multi-sig)
15
+ * - Graduation target: 30,000 FET -> auto DEX listing
16
+ * - Trading fee: 2% -> 100% to protocol treasury (NO creator fee)
17
+ *
18
+ * @example
19
+ * import { listTemplates, getTemplate, generateFromTemplate } from "@agent-launch/templates";
20
+ *
21
+ * // List all available templates
22
+ * const templates = listTemplates();
23
+ * console.log(templates.map(t => t.name));
24
+ * // ["custom", "price-monitor", "trading-bot", "data-analyzer", "research", "gifter"]
25
+ *
26
+ * // Get metadata for a specific template
27
+ * const tpl = getTemplate("price-monitor");
28
+ * console.log(tpl?.variables);
29
+ *
30
+ * // Generate files from a template
31
+ * const { code, readme, envExample } = generateFromTemplate("price-monitor", {
32
+ * agent_name: "MyPriceWatcher",
33
+ * token_address: "0xabc123...",
34
+ * alert_threshold: "10",
35
+ * });
36
+ */
37
+ export type { AgentTemplate, TemplateVariable } from "./registry.js";
38
+ export { listTemplates, getTemplate } from "./registry.js";
39
+ export type { GenerateResult, GenerateOptions } from "./generator.js";
40
+ export { generateFromTemplate } from "./generator.js";
41
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,MAAM,eAAe,CAAC;AAG3D,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @agent-launch/templates
3
+ *
4
+ * Agent code templates for the AgentLaunch platform.
5
+ *
6
+ * Provides six ready-to-use Python agent templates built on:
7
+ * - Agentverse Chat Protocol v0.3.0
8
+ * - uAgents Agent() zero-param init
9
+ * - ctx.logger structured logging
10
+ * - Rate limiting, health monitoring, token-gated tiers
11
+ * - agent-launch.ai/api integration
12
+ *
13
+ * Platform constants (source of truth: deployed smart contracts):
14
+ * - Deploy fee: 120 FET (read dynamically, can change via multi-sig)
15
+ * - Graduation target: 30,000 FET -> auto DEX listing
16
+ * - Trading fee: 2% -> 100% to protocol treasury (NO creator fee)
17
+ *
18
+ * @example
19
+ * import { listTemplates, getTemplate, generateFromTemplate } from "@agent-launch/templates";
20
+ *
21
+ * // List all available templates
22
+ * const templates = listTemplates();
23
+ * console.log(templates.map(t => t.name));
24
+ * // ["custom", "price-monitor", "trading-bot", "data-analyzer", "research", "gifter"]
25
+ *
26
+ * // Get metadata for a specific template
27
+ * const tpl = getTemplate("price-monitor");
28
+ * console.log(tpl?.variables);
29
+ *
30
+ * // Generate files from a template
31
+ * const { code, readme, envExample } = generateFromTemplate("price-monitor", {
32
+ * agent_name: "MyPriceWatcher",
33
+ * token_address: "0xabc123...",
34
+ * alert_threshold: "10",
35
+ * });
36
+ */
37
+ export { listTemplates, getTemplate } from "./registry.js";
38
+ export { generateFromTemplate } from "./generator.js";
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * registry.ts — Template registry for @agent-launch/templates
3
+ *
4
+ * All templates are imported here and exposed via listTemplates() / getTemplate().
5
+ * Add new templates by:
6
+ * 1. Creating src/templates/<name>.ts exporting `template: AgentTemplate`
7
+ * 2. Importing and adding to TEMPLATES below
8
+ */
9
+ export interface TemplateVariable {
10
+ /** Variable name used as {{name}} placeholder in the template code */
11
+ name: string;
12
+ /** Whether this variable must be supplied by the caller (default: false) */
13
+ required?: boolean;
14
+ /** Default value used when caller does not provide the variable */
15
+ default?: string;
16
+ /** Human-readable description shown in CLI help and MCP prompts */
17
+ description: string;
18
+ }
19
+ export interface AgentTemplate {
20
+ /** Unique slug used to look up the template — e.g. "price-monitor" */
21
+ name: string;
22
+ /** One-line description shown in listings */
23
+ description: string;
24
+ /** Category label for grouping — e.g. "AI/ML", "Finance", "Infrastructure" */
25
+ category: string;
26
+ /** Variables that will be substituted into the template code */
27
+ variables: TemplateVariable[];
28
+ /** Python package names required by the generated agent.py */
29
+ dependencies: string[];
30
+ /** Environment variable names that must be set as Agentverse secrets */
31
+ secrets: string[];
32
+ /** The Python source code with {{variable}} placeholders */
33
+ code: string;
34
+ }
35
+ /**
36
+ * Returns a copy of the full template registry.
37
+ * Safe to mutate — the original array is not exposed.
38
+ */
39
+ export declare function listTemplates(): AgentTemplate[];
40
+ /**
41
+ * Looks up a template by its `name` slug.
42
+ * Returns `undefined` if no template with that name exists.
43
+ *
44
+ * @example
45
+ * const tpl = getTemplate("price-monitor");
46
+ * if (!tpl) throw new Error("Template not found");
47
+ */
48
+ export declare function getTemplate(name: string): AgentTemplate | undefined;
49
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,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;AAmBD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,aAAa,EAAE,CAE/C;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEnE"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * registry.ts — Template registry for @agent-launch/templates
3
+ *
4
+ * All templates are imported here and exposed via listTemplates() / getTemplate().
5
+ * Add new templates by:
6
+ * 1. Creating src/templates/<name>.ts exporting `template: AgentTemplate`
7
+ * 2. Importing and adding to TEMPLATES below
8
+ */
9
+ import { template as customTemplate } from "./templates/custom.js";
10
+ import { template as priceMonitorTemplate } from "./templates/price-monitor.js";
11
+ import { template as tradingBotTemplate } from "./templates/trading-bot.js";
12
+ import { template as dataAnalyzerTemplate } from "./templates/data-analyzer.js";
13
+ import { template as researchTemplate } from "./templates/research.js";
14
+ import { template as gifterTemplate } from "./templates/gifter.js";
15
+ // ---------------------------------------------------------------------------
16
+ // Internal registry
17
+ // ---------------------------------------------------------------------------
18
+ const TEMPLATES = [
19
+ customTemplate,
20
+ priceMonitorTemplate,
21
+ tradingBotTemplate,
22
+ dataAnalyzerTemplate,
23
+ researchTemplate,
24
+ gifterTemplate,
25
+ ];
26
+ // ---------------------------------------------------------------------------
27
+ // Public API
28
+ // ---------------------------------------------------------------------------
29
+ /**
30
+ * Returns a copy of the full template registry.
31
+ * Safe to mutate — the original array is not exposed.
32
+ */
33
+ export function listTemplates() {
34
+ return [...TEMPLATES];
35
+ }
36
+ /**
37
+ * Looks up a template by its `name` slug.
38
+ * Returns `undefined` if no template with that name exists.
39
+ *
40
+ * @example
41
+ * const tpl = getTemplate("price-monitor");
42
+ * if (!tpl) throw new Error("Template not found");
43
+ */
44
+ export function getTemplate(name) {
45
+ return TEMPLATES.find((t) => t.name === name);
46
+ }
47
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,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,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAkCnE,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,MAAM,SAAS,GAAoB;IACjC,cAAc;IACd,oBAAoB;IACpB,kBAAkB;IAClB,oBAAoB;IACpB,gBAAgB;IAChB,cAAc;CACf,CAAC;AAEF,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * custom.ts — Blank boilerplate template with Chat Protocol
3
+ *
4
+ * Platform constants (source of truth: deployed smart contracts):
5
+ * - Deploy fee: 120 FET (read dynamically, can change via multi-sig)
6
+ * - Graduation target: 30,000 FET -> auto DEX listing
7
+ * - Trading fee: 2% -> 100% to protocol treasury (NO creator fee)
8
+ */
9
+ import type { AgentTemplate } from "../registry.js";
10
+ export declare const template: AgentTemplate;
11
+ //# sourceMappingURL=custom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/templates/custom.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,eAAO,MAAM,QAAQ,EAAE,aAgctB,CAAC"}