@townco/agent 0.1.55 → 0.1.57

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.
@@ -7,6 +7,8 @@ export function getTemplateVars(name, definition) {
7
7
  tools,
8
8
  systemPrompt: definition.systemPrompt,
9
9
  hasWebSearch: tools.some((tool) => typeof tool === "string" && tool === "web_search"),
10
+ hasGenerateImage: tools.some((tool) => typeof tool === "string" && tool === "generate_image"),
11
+ hasBrowser: tools.some((tool) => typeof tool === "string" && tool === "browser"),
10
12
  hooks: definition.hooks,
11
13
  };
12
14
  if (definition.displayName) {
@@ -148,9 +150,15 @@ export function generateReadme(vars) {
148
150
  })
149
151
  .join(", ")
150
152
  : "None";
151
- const envVars = vars.hasWebSearch
152
- ? "\n- `EXA_API_KEY`: Required for web_search tool"
153
- : "";
153
+ const envVars = [
154
+ vars.hasWebSearch ? "- `EXA_API_KEY`: Required for web_search tool" : "",
155
+ vars.hasGenerateImage
156
+ ? "- `GEMINI_API_KEY` (or `GOOGLE_API_KEY`): Required for generate_image tool"
157
+ : "",
158
+ vars.hasBrowser ? "- `KERNEL_API_KEY`: Required for browser tool" : "",
159
+ ]
160
+ .filter(Boolean)
161
+ .join("\n");
154
162
  return `# ${vars.name}
155
163
 
156
164
  Agent created with \`town create\`.
@@ -211,10 +219,24 @@ bun run build
211
219
  `;
212
220
  }
213
221
  export function generateEnvExample(vars) {
214
- if (!vars.hasWebSearch) {
222
+ const envs = [];
223
+ if (vars.hasWebSearch) {
224
+ envs.push("# Required for web_search tool");
225
+ envs.push("EXA_API_KEY=your_exa_api_key_here");
226
+ envs.push("");
227
+ }
228
+ if (vars.hasGenerateImage) {
229
+ envs.push("# Required for generate_image tool");
230
+ envs.push("GEMINI_API_KEY=your_gemini_api_key_here");
231
+ envs.push("");
232
+ }
233
+ if (vars.hasBrowser) {
234
+ envs.push("# Required for browser tool");
235
+ envs.push("KERNEL_API_KEY=your_kernel_api_key_here");
236
+ envs.push("");
237
+ }
238
+ if (envs.length === 0) {
215
239
  return null;
216
240
  }
217
- return `# Required for web_search tool
218
- EXA_API_KEY=your_exa_api_key_here
219
- `;
241
+ return envs.join("\n");
220
242
  }