create-agentmark 0.3.0 → 0.4.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 (65) hide show
  1. package/dist/index.d.ts +2 -3
  2. package/dist/index.js +787 -51
  3. package/dist/index.js.map +1 -1
  4. package/dist/utils/examples/templates/index.d.ts +47 -13
  5. package/dist/utils/examples/templates/index.js +504 -12
  6. package/dist/utils/examples/templates/index.js.map +1 -1
  7. package/package.json +3 -2
  8. package/dist/index.d.ts.map +0 -1
  9. package/dist/utils/examples/create-example-app.d.ts +0 -2
  10. package/dist/utils/examples/create-example-app.d.ts.map +0 -1
  11. package/dist/utils/examples/create-example-app.js +0 -243
  12. package/dist/utils/examples/create-example-app.js.map +0 -1
  13. package/dist/utils/examples/templates/adapters.d.ts +0 -15
  14. package/dist/utils/examples/templates/adapters.d.ts.map +0 -1
  15. package/dist/utils/examples/templates/adapters.js +0 -28
  16. package/dist/utils/examples/templates/adapters.js.map +0 -1
  17. package/dist/utils/examples/templates/animal-drawing-prompt.d.ts +0 -2
  18. package/dist/utils/examples/templates/animal-drawing-prompt.d.ts.map +0 -1
  19. package/dist/utils/examples/templates/animal-drawing-prompt.js +0 -19
  20. package/dist/utils/examples/templates/animal-drawing-prompt.js.map +0 -1
  21. package/dist/utils/examples/templates/app-index.d.ts +0 -2
  22. package/dist/utils/examples/templates/app-index.d.ts.map +0 -1
  23. package/dist/utils/examples/templates/app-index.js +0 -95
  24. package/dist/utils/examples/templates/app-index.js.map +0 -1
  25. package/dist/utils/examples/templates/customer-support-prompt.d.ts +0 -2
  26. package/dist/utils/examples/templates/customer-support-prompt.d.ts.map +0 -1
  27. package/dist/utils/examples/templates/customer-support-prompt.js +0 -40
  28. package/dist/utils/examples/templates/customer-support-prompt.js.map +0 -1
  29. package/dist/utils/examples/templates/datasets.d.ts +0 -5
  30. package/dist/utils/examples/templates/datasets.d.ts.map +0 -1
  31. package/dist/utils/examples/templates/datasets.js +0 -21
  32. package/dist/utils/examples/templates/datasets.js.map +0 -1
  33. package/dist/utils/examples/templates/env.d.ts +0 -2
  34. package/dist/utils/examples/templates/env.d.ts.map +0 -1
  35. package/dist/utils/examples/templates/env.js +0 -12
  36. package/dist/utils/examples/templates/env.js.map +0 -1
  37. package/dist/utils/examples/templates/example-prompts.d.ts +0 -2
  38. package/dist/utils/examples/templates/example-prompts.d.ts.map +0 -1
  39. package/dist/utils/examples/templates/example-prompts.js +0 -35
  40. package/dist/utils/examples/templates/example-prompts.js.map +0 -1
  41. package/dist/utils/examples/templates/index.d.ts.map +0 -1
  42. package/dist/utils/examples/templates/package-setup.d.ts +0 -3
  43. package/dist/utils/examples/templates/package-setup.d.ts.map +0 -1
  44. package/dist/utils/examples/templates/package-setup.js +0 -61
  45. package/dist/utils/examples/templates/package-setup.js.map +0 -1
  46. package/dist/utils/examples/templates/party-planner-prompt.d.ts +0 -2
  47. package/dist/utils/examples/templates/party-planner-prompt.d.ts.map +0 -1
  48. package/dist/utils/examples/templates/party-planner-prompt.js +0 -40
  49. package/dist/utils/examples/templates/party-planner-prompt.js.map +0 -1
  50. package/dist/utils/examples/templates/story-teller-prompt.d.ts +0 -2
  51. package/dist/utils/examples/templates/story-teller-prompt.d.ts.map +0 -1
  52. package/dist/utils/examples/templates/story-teller-prompt.js +0 -23
  53. package/dist/utils/examples/templates/story-teller-prompt.js.map +0 -1
  54. package/dist/utils/examples/templates/tsconfig.d.ts +0 -2
  55. package/dist/utils/examples/templates/tsconfig.d.ts.map +0 -1
  56. package/dist/utils/examples/templates/tsconfig.js +0 -14
  57. package/dist/utils/examples/templates/tsconfig.js.map +0 -1
  58. package/dist/utils/examples/templates/user-client-config.d.ts +0 -6
  59. package/dist/utils/examples/templates/user-client-config.d.ts.map +0 -1
  60. package/dist/utils/examples/templates/user-client-config.js +0 -85
  61. package/dist/utils/examples/templates/user-client-config.js.map +0 -1
  62. package/dist/utils/providers.d.ts +0 -9
  63. package/dist/utils/providers.d.ts.map +0 -1
  64. package/dist/utils/providers.js +0 -16
  65. package/dist/utils/providers.js.map +0 -1
@@ -1,13 +1,505 @@
1
- export * from './adapters.js';
2
- export * from './app-index.js';
3
- export * from './env.js';
4
- export * from './package-setup.js';
5
- export * from './tsconfig.js';
6
- export * from './animal-drawing-prompt.js';
7
- export * from './customer-support-prompt.js';
8
- export * from './party-planner-prompt.js';
9
- export * from './story-teller-prompt.js';
10
- export * from './datasets.js';
11
- export * from './example-prompts.js';
12
- export * from './user-client-config.js';
1
+ // src/utils/examples/templates/adapters.ts
2
+ var createAdapterConfig = (provider) => {
3
+ return {
4
+ "ai-sdk": {
5
+ package: "@agentmark/ai-sdk-v5-adapter",
6
+ dependencies: ["ai@^5", `@ai-sdk/${provider}@^2`],
7
+ classes: {
8
+ modelRegistry: "VercelAIModelRegistry",
9
+ toolRegistry: "VercelAIToolRegistry",
10
+ webhookHandler: "VercelAdapterWebhookHandler"
11
+ }
12
+ },
13
+ mastra: {
14
+ package: "@agentmark/mastra-v0-adapter",
15
+ dependencies: [
16
+ "@mastra/core@<0.20.0",
17
+ "@mastra/mcp@<0.13.4",
18
+ `@ai-sdk/${provider}@<2`
19
+ ],
20
+ classes: {
21
+ modelRegistry: "MastraModelRegistry",
22
+ toolRegistry: "MastraToolRegistry",
23
+ webhookHandler: "MastraAdapterWebhookHandler"
24
+ }
25
+ }
26
+ };
27
+ };
28
+ function getAdapterConfig(adapter, provider) {
29
+ const config = createAdapterConfig(provider)[adapter];
30
+ if (!config) {
31
+ throw new Error(
32
+ `Unknown adapter: ${adapter}. Available adapters: ${Object.keys(
33
+ createAdapterConfig(provider)
34
+ ).join(", ")}`
35
+ );
36
+ }
37
+ return config;
38
+ }
39
+
40
+ // src/utils/examples/templates/app-index.ts
41
+ var getIndexFileContent = (adapter = "ai-sdk") => {
42
+ if (adapter === "mastra") {
43
+ return `import "dotenv/config";
44
+ import { Agent } from "@mastra/core/agent";
45
+ import { client } from "./agentmark.client";
46
+
47
+ const telemetry = {
48
+ isEnabled: true,
49
+ metadata: {
50
+ traceId: "trace-123",
51
+ traceName: "customer-support",
52
+ userId: "user-123",
53
+ sessionId: "session-123",
54
+ sessionName: "my-first-session",
55
+ },
56
+ };
57
+
58
+ const runCustomerSupport = async (customer_message: string) => {
59
+ const prompt = await client.loadTextPrompt("customer-support-agent");
60
+ const agentConfig = await prompt.formatAgent({
61
+ options: {
62
+ telemetry,
63
+ },
64
+ });
65
+
66
+ const [messages, generateOptions] = await agentConfig.formatMessages({
67
+ props: {
68
+ customer_question: customer_message,
69
+ },
70
+ });
71
+
72
+ const agent = new Agent(agentConfig);
73
+ const response = await agent.generate(messages, generateOptions);
74
+
75
+ return (response as any).text || (response as any).content || String(response);
76
+ };
77
+
78
+ const main = async () => {
79
+ try {
80
+ const user_message = "How long does shipping take?";
81
+ const assistant = await runCustomerSupport(user_message);
82
+ console.log("Customer support response:", assistant);
83
+ } catch (error) {
84
+ console.error(error);
85
+ }
86
+ };
87
+
88
+ main();
89
+ `;
90
+ } else {
91
+ return `import "dotenv/config";
92
+ import { generateText } from "ai";
93
+ import { client } from "./agentmark.client";
94
+
95
+ const telemetry = {
96
+ isEnabled: true,
97
+ metadata: {
98
+ traceId: "trace-123",
99
+ traceName: "customer-support",
100
+ userId: "user-123",
101
+ sessionId: "session-123",
102
+ sessionName: "my-first-session",
103
+ },
104
+ };
105
+
106
+ const runCustomerSupport = async (customer_message: string) => {
107
+ const prompt = await client.loadTextPrompt("customer-support-agent");
108
+ const vercelInput = await prompt.format({
109
+ props: {
110
+ customer_question: customer_message,
111
+ },
112
+ telemetry,
113
+ });
114
+
115
+ const resp = await generateText(vercelInput);
116
+
117
+ return resp.text;
118
+ };
119
+
120
+ const main = async () => {
121
+ try {
122
+ const user_message = "How long does shipping take?";
123
+ const assistant = await runCustomerSupport(user_message);
124
+ console.log("Customer support response:", assistant);
125
+ } catch (error) {
126
+ console.error(error);
127
+ }
128
+ };
129
+
130
+ main();
131
+ `;
132
+ }
133
+ };
134
+
135
+ // src/utils/examples/templates/env.ts
136
+ var getEnvFileContent = (_modelProvider, apiKey = "") => {
137
+ const apiKeyValue = apiKey || "your_api_key_here";
138
+ return `# Cloud deployment: Set these environment variables
139
+ # AGENTMARK_BASE_URL=https://api.agentmark.co
140
+ # AGENTMARK_API_KEY=your_agentmark_api_key
141
+ # AGENTMARK_APP_ID=your_agentmark_app_id
142
+ # Learn more: https://docs.agentmark.co/platform/getting_started/quickstart
143
+
144
+ OPENAI_API_KEY=${apiKeyValue}
145
+ `;
146
+ };
147
+
148
+ // src/utils/examples/templates/package-setup.ts
149
+ import fs from "fs-extra";
150
+ import { execSync, execFileSync } from "child_process";
151
+ var setupPackageJson = (targetPath = ".", deploymentMode = "cloud") => {
152
+ const packageJsonPath = `${targetPath}/package.json`;
153
+ if (!fs.existsSync(packageJsonPath)) {
154
+ console.log("Creating package.json...");
155
+ execSync("npm init -y", { cwd: targetPath });
156
+ }
157
+ const pkgJson = fs.readJsonSync(packageJsonPath);
158
+ pkgJson.name = pkgJson.name === "test" || !pkgJson.name ? "agentmark-example-app" : pkgJson.name;
159
+ pkgJson.description = pkgJson.description || "A simple Node.js app using the Agentmark SDK";
160
+ const devScript = "agentmark dev";
161
+ const scripts = {
162
+ ...pkgJson.scripts,
163
+ "demo": "npx tsx index.ts",
164
+ "dev": devScript,
165
+ "prompt": "agentmark run-prompt",
166
+ "experiment": "agentmark run-experiment"
167
+ };
168
+ if (deploymentMode === "static") {
169
+ scripts["build"] = "agentmark build --out dist/agentmark";
170
+ }
171
+ pkgJson.scripts = scripts;
172
+ pkgJson.overrides = {
173
+ ...pkgJson.overrides,
174
+ "axios": "^1.7.9"
175
+ };
176
+ fs.writeJsonSync(packageJsonPath, pkgJson, { spaces: 2 });
177
+ };
178
+ var installDependencies = (modelProvider, targetPath = ".", adapter = "ai-sdk", deploymentMode = "cloud") => {
179
+ console.log("Installing required packages...");
180
+ console.log("This might take a moment...");
181
+ const adapterConfig = getAdapterConfig(adapter, modelProvider);
182
+ try {
183
+ const devDepsCmd = "npm install --save-dev typescript ts-node @types/node @agentmark/cli --legacy-peer-deps";
184
+ execSync(devDepsCmd, {
185
+ stdio: "inherit",
186
+ cwd: targetPath
187
+ });
188
+ const loaderPackages = deploymentMode === "static" ? ["@agentmark/loader-api", "@agentmark/loader-file"] : ["@agentmark/loader-api"];
189
+ const installArgs = [
190
+ "install",
191
+ "dotenv",
192
+ "@agentmark/prompt-core",
193
+ "@agentmark/sdk",
194
+ adapterConfig.package,
195
+ ...loaderPackages,
196
+ ...adapterConfig.dependencies,
197
+ "--legacy-peer-deps"
198
+ ];
199
+ execFileSync("npm", installArgs, { stdio: "inherit", cwd: targetPath });
200
+ console.log("Packages installed successfully!");
201
+ } catch (error) {
202
+ console.error("Error installing packages:", error);
203
+ throw new Error(
204
+ "Failed to install required packages. Please check your network connection and try again."
205
+ );
206
+ }
207
+ };
208
+
209
+ // src/utils/examples/templates/tsconfig.ts
210
+ var getTsConfigContent = () => {
211
+ return {
212
+ "compilerOptions": {
213
+ "target": "ES2020",
214
+ "module": "NodeNext",
215
+ "moduleResolution": "NodeNext",
216
+ "esModuleInterop": true,
217
+ "forceConsistentCasingInFileNames": true,
218
+ "strict": true,
219
+ "skipLibCheck": true
220
+ }
221
+ };
222
+ };
223
+
224
+ // src/utils/examples/templates/animal-drawing-prompt.ts
225
+ var getAnimalDrawingPrompt = () => {
226
+ return `---
227
+ name: animal-drawing
228
+ image_config:
229
+ model_name: dall-e-3
230
+ num_images: 1
231
+ size: 1024x1024
232
+ aspect_ratio: 1:1
233
+ test_settings:
234
+ dataset: animal.jsonl
235
+ props:
236
+ animal: "cat"
237
+ ---
238
+
239
+ <ImagePrompt>
240
+ Draw a hyper-realistic picture of a {props.animal}
241
+ </ImagePrompt>`;
242
+ };
243
+
244
+ // src/utils/examples/templates/customer-support-prompt.ts
245
+ var getCustomerSupportPrompt = (model) => {
246
+ return `---
247
+ name: customer-support-agent
248
+ text_config:
249
+ model_name: ${model}
250
+ max_calls: 2
251
+ tools:
252
+ search_knowledgebase:
253
+ description: Search the company knowledgebase for information about shipping, warranty, and returns policies.
254
+ parameters:
255
+ type: object
256
+ properties:
257
+ query:
258
+ type: string
259
+ description: The search query to find relevant information
260
+ required: [query]
261
+ test_settings:
262
+ dataset: customer-query.jsonl
263
+ props:
264
+ customer_question: "I'm having trouble with my order. How long does shipping take?"
265
+ input_schema:
266
+ type: object
267
+ properties:
268
+ customer_question:
269
+ type: string
270
+ description: "The customer's question"
271
+ required:
272
+ - customer_question
273
+ ---
274
+
275
+ <System>
276
+ You are a customer service agent for a company that sells products online. You are given a customer's question and you need to respond to the customer. You need to be friendly, professional, and helpful.
277
+
278
+ You have access to the following tool:
279
+ - search_knowledgebase: Search the company knowledgebase for information about shipping, warranty, and returns. Use this when customers ask about these topics.
280
+ </System>
281
+
282
+ <User>{props.customer_question}</User>`;
283
+ };
284
+
285
+ // src/utils/examples/templates/party-planner-prompt.ts
286
+ var getPartyPlannerPrompt = (model) => {
287
+ return `---
288
+ name: party-planner
289
+ object_config:
290
+ model_name: ${model}
291
+ schema:
292
+ type: object
293
+ properties:
294
+ names:
295
+ type: array
296
+ description: "List of names of people attending the party."
297
+ items:
298
+ type: string
299
+ required:
300
+ - names
301
+ test_settings:
302
+ dataset: party.jsonl
303
+ evals:
304
+ - exact_match_json
305
+ props:
306
+ party_text: "We're having a party with Alice, Bob, and Carol."
307
+ input_schema:
308
+ type: object
309
+ properties:
310
+ party_text:
311
+ type: string
312
+ description: "A block of text describing the upcoming party and attendees."
313
+ required:
314
+ - party_text
315
+ ---
316
+
317
+ <System>
318
+ Extract the names of all people attending the party from the following text. Respond with a list of names only.
319
+ </System>
320
+
321
+ <User>
322
+ Text: {props.party_text}
323
+ </User>`;
324
+ };
325
+
326
+ // src/utils/examples/templates/story-teller-prompt.ts
327
+ var getStoryTellerPrompt = () => {
328
+ return `---
329
+ name: story-teller
330
+ speech_config:
331
+ model_name: tts-1-hd
332
+ voice: "nova"
333
+ speed: 1.0
334
+ output_format: "mp3"
335
+ test_settings:
336
+ dataset: story.jsonl
337
+ props:
338
+ story: "Once upon a time, there was a cat who loved to play with a ball."
339
+ ---
340
+
341
+ <System>
342
+ You are a storyteller for children. Make sure your story is engaging and interesting.
343
+ </System>
344
+
345
+ <SpeechPrompt>
346
+ - {props.story}
347
+ </SpeechPrompt>`;
348
+ };
349
+
350
+ // src/utils/examples/templates/datasets.ts
351
+ var getAnimalDataset = () => {
352
+ return `{"input": {"animal": "cat"}, "expected_output": "A realistic picture of a cat"}
353
+ {"input": {"animal": "dog"}, "expected_output": "A realistic picture of a dog"}
354
+ {"input": {"animal": "bird"}, "expected_output": "A realistic picture of a bird"}`;
355
+ };
356
+ var getCustomerQueryDataset = () => {
357
+ return `{"input": {"customer_question": "My package hasn't arrived yet. Can you help me track it?"}}
358
+ {"input": {"customer_question": "I received the wrong item in my order. What should I do?"}}
359
+ {"input": {"customer_question": "How do I return a product that I purchased last week?"}}`;
360
+ };
361
+ var getPartyDataset = () => {
362
+ return `{"input": {"party_text": "We're having a party with Alice, Bob, and Carol."}, "expected_output": "{\\"names\\": [\\"Alice\\", \\"Bob\\", \\"Carol\\"]}"}
363
+ {"input": {"party_text": "The guest list includes Dave, Emma, and Frank."}, "expected_output": "{\\"names\\": [\\"Dave\\", \\"Emma\\", \\"Frank\\"]}"}
364
+ {"input": {"party_text": "Join us for a celebration with Grace, Henry, and Isla."}, "expected_output": "{\\"names\\": [\\"Grace\\", \\"Henry\\", \\"Isla\\"]}"}`;
365
+ };
366
+ var getStoryDataset = () => {
367
+ return `{"input": {"story": "Once upon a time, the Moon woke up and found her glow missing! She floated around the sky asking stars, clouds, and even comets if they'd seen her light. It wasn't until she peeked into a mountain lake that she saw her glow shining back\u2014hidden in her own reflection! Laughing, she realized she had never lost it\u2014it was with her all along, just hiding beneath a cloudy sky."}}
368
+ {"input": {"story": "Benny was no ordinary banana\u2014he dreamed of becoming a superhero. One day, when a monkey slipped in the jungle and cried for help, Benny rolled into action, dodging vines and swinging from branches using his peel like a lasso. The monkey was saved, and from that day on, Benny was known as \\"The Peel of Justice,\\" the bravest fruit in the whole rainforest."}}
369
+ {"input": {"story": "In the town of Maplebrook, there was a library that whispered stories when no one was looking. Curious little Nia tiptoed in one rainy day and heard the books giggling softly. She opened one called The Secret Tunnel, and to her surprise, it sucked her in! She found herself riding a dragon through glittering caves. When she returned, the book winked shut\u2014waiting for its next reader to listen."}}`;
370
+ };
371
+
372
+ // src/utils/examples/templates/example-prompts.ts
373
+ import fs2 from "fs-extra";
374
+ var createExamplePrompts = (model, targetPath = ".", adapter = "ai-sdk") => {
375
+ fs2.ensureDirSync(`${targetPath}/agentmark`);
376
+ if (adapter !== "mastra") {
377
+ const animalDrawingPrompt = getAnimalDrawingPrompt();
378
+ fs2.writeFileSync(`${targetPath}/agentmark/animal-drawing.prompt.mdx`, animalDrawingPrompt);
379
+ const animalDataset = getAnimalDataset();
380
+ fs2.writeFileSync(`${targetPath}/agentmark/animal.jsonl`, animalDataset);
381
+ }
382
+ const customerSupportPrompt = getCustomerSupportPrompt(model);
383
+ fs2.writeFileSync(`${targetPath}/agentmark/customer-support-agent.prompt.mdx`, customerSupportPrompt);
384
+ const customerQueryDataset = getCustomerQueryDataset();
385
+ fs2.writeFileSync(`${targetPath}/agentmark/customer-query.jsonl`, customerQueryDataset);
386
+ const partyPlannerPrompt = getPartyPlannerPrompt(model);
387
+ fs2.writeFileSync(`${targetPath}/agentmark/party-planner.prompt.mdx`, partyPlannerPrompt);
388
+ const partyDataset = getPartyDataset();
389
+ fs2.writeFileSync(`${targetPath}/agentmark/party.jsonl`, partyDataset);
390
+ if (adapter !== "mastra") {
391
+ const storyTellerPrompt = getStoryTellerPrompt();
392
+ fs2.writeFileSync(`${targetPath}/agentmark/story-teller.prompt.mdx`, storyTellerPrompt);
393
+ const storyDataset = getStoryDataset();
394
+ fs2.writeFileSync(`${targetPath}/agentmark/story.jsonl`, storyDataset);
395
+ }
396
+ };
397
+
398
+ // src/utils/examples/templates/user-client-config.ts
399
+ var getClientConfigContent = (options) => {
400
+ const { provider, languageModels, adapter, deploymentMode = "cloud" } = options;
401
+ const adapterConfig = getAdapterConfig(adapter, provider);
402
+ const { modelRegistry, toolRegistry } = adapterConfig.classes;
403
+ const providerImport = `import { ${provider} } from '@ai-sdk/${provider}';`;
404
+ const extraModelRegs = provider === "openai" ? `.registerModels(["dall-e-3"], (name: string) => ${provider}.image(name))
405
+ .registerModels(["tts-1-hd"], (name: string) => ${provider}.speech(name))` : "";
406
+ const loaderImport = deploymentMode === "cloud" ? `import { ApiLoader } from "@agentmark/loader-api";` : `import { ApiLoader } from "@agentmark/loader-api";
407
+ import { FileLoader } from "@agentmark/loader-file";`;
408
+ const loaderSetup = deploymentMode === "cloud" ? ` // ApiLoader works for both development and production
409
+ // - Development: 'agentmark dev' sets AGENTMARK_BASE_URL to localhost
410
+ // - Production: Set AGENTMARK_API_KEY and AGENTMARK_APP_ID for cloud
411
+ const loader = process.env.NODE_ENV === 'development'
412
+ ? ApiLoader.local({ baseUrl: process.env.AGENTMARK_BASE_URL || 'http://localhost:9418' })
413
+ : ApiLoader.cloud({
414
+ apiKey: process.env.AGENTMARK_API_KEY!,
415
+ appId: process.env.AGENTMARK_APP_ID!,
416
+ });` : ` const loader = process.env.NODE_ENV === 'development'
417
+ ? ApiLoader.local({ baseUrl: process.env.AGENTMARK_BASE_URL || 'http://localhost:9418' })
418
+ : new FileLoader('./dist/agentmark');`;
419
+ return `// agentmark.client.ts
420
+ import path from 'node:path';
421
+ import dotenv from 'dotenv';
422
+ dotenv.config({ path: path.resolve(__dirname, '.env') });
423
+ import { createAgentMarkClient, ${modelRegistry}, ${toolRegistry}, EvalRegistry } from "${adapterConfig.package}";
424
+ ${loaderImport}
425
+ import AgentMarkTypes, { Tools } from './agentmark.types';
426
+ ${providerImport}
427
+
428
+ function createModelRegistry() {
429
+ const modelRegistry = new ${modelRegistry}()
430
+ .registerModels(${JSON.stringify(languageModels)}, (name: string) => ${provider}(name))
431
+ ${extraModelRegs};
432
+ return modelRegistry;
433
+ }
434
+
435
+ function createToolRegistry() {
436
+ const toolRegistry = new ${toolRegistry}<Tools>()
437
+ .register('search_knowledgebase', async ({ query }) => {
438
+ // Simulate search delay
439
+ await new Promise(resolve => setTimeout(resolve, 500));
440
+
441
+ // Return all three knowledge base articles
442
+ // The LLM will select the relevant one based on the query
443
+ return {
444
+ articles: [
445
+ { topic: 'shipping', content: 'Standard shipping takes 3\u20135 business days.' },
446
+ { topic: 'warranty', content: 'All products include a 1-year limited warranty.' },
447
+ { topic: 'returns', content: 'You can return items within 30 days of delivery.' }
448
+ ]
449
+ };
450
+ });
451
+ return toolRegistry;
452
+ }
453
+
454
+ function createEvalRegistry() {
455
+ const evalRegistry = new EvalRegistry()
456
+ .register('exact_match_json', ({ output, expectedOutput }) => {
457
+ if (!expectedOutput) {
458
+ return { score: 0, label: 'error', reason: 'No expected output provided', passed: false };
459
+ }
460
+ try {
461
+ const ok = JSON.stringify(output) === JSON.stringify(JSON.parse(expectedOutput));
462
+ return {
463
+ score: ok ? 1 : 0,
464
+ label: ok ? 'correct' : 'incorrect',
465
+ reason: ok ? 'Exact match' : 'Mismatch',
466
+ passed: ok
467
+ };
468
+ } catch (e) {
469
+ return { score: 0, label: 'error', reason: 'Failed to parse expected output as JSON', passed: false };
470
+ }
471
+ });
472
+ return evalRegistry;
473
+ }
474
+
475
+ function createClient() {
476
+ ${loaderSetup}
477
+ const modelRegistry = createModelRegistry();
478
+ const toolRegistry = createToolRegistry();
479
+ const evalRegistry = createEvalRegistry();
480
+ return createAgentMarkClient<AgentMarkTypes, typeof toolRegistry>({ loader, modelRegistry, toolRegistry, evalRegistry });
481
+ }
482
+
483
+ export const client = createClient();
484
+ `;
485
+ };
486
+ export {
487
+ createAdapterConfig,
488
+ createExamplePrompts,
489
+ getAdapterConfig,
490
+ getAnimalDataset,
491
+ getAnimalDrawingPrompt,
492
+ getClientConfigContent,
493
+ getCustomerQueryDataset,
494
+ getCustomerSupportPrompt,
495
+ getEnvFileContent,
496
+ getIndexFileContent,
497
+ getPartyDataset,
498
+ getPartyPlannerPrompt,
499
+ getStoryDataset,
500
+ getStoryTellerPrompt,
501
+ getTsConfigContent,
502
+ installDependencies,
503
+ setupPackageJson
504
+ };
13
505
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/examples/templates/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"sources":["../../../../src/utils/examples/templates/adapters.ts","../../../../src/utils/examples/templates/app-index.ts","../../../../src/utils/examples/templates/env.ts","../../../../src/utils/examples/templates/package-setup.ts","../../../../src/utils/examples/templates/tsconfig.ts","../../../../src/utils/examples/templates/animal-drawing-prompt.ts","../../../../src/utils/examples/templates/customer-support-prompt.ts","../../../../src/utils/examples/templates/party-planner-prompt.ts","../../../../src/utils/examples/templates/story-teller-prompt.ts","../../../../src/utils/examples/templates/datasets.ts","../../../../src/utils/examples/templates/example-prompts.ts","../../../../src/utils/examples/templates/user-client-config.ts"],"sourcesContent":["export interface AdapterConfig {\n /** npm package name for the adapter */\n package: string;\n /** Additional npm packages required by this adapter */\n dependencies: string[];\n /** Class names used in generated code */\n classes: {\n modelRegistry: string;\n toolRegistry: string;\n webhookHandler: string;\n };\n}\n\nexport const createAdapterConfig = (\n provider: string\n): Record<string, AdapterConfig> => {\n return {\n \"ai-sdk\": {\n package: \"@agentmark/ai-sdk-v5-adapter\",\n dependencies: [\"ai@^5\", `@ai-sdk/${provider}@^2`],\n classes: {\n modelRegistry: \"VercelAIModelRegistry\",\n toolRegistry: \"VercelAIToolRegistry\",\n webhookHandler: \"VercelAdapterWebhookHandler\",\n },\n },\n mastra: {\n package: \"@agentmark/mastra-v0-adapter\",\n dependencies: [\n \"@mastra/core@<0.20.0\",\n \"@mastra/mcp@<0.13.4\",\n `@ai-sdk/${provider}@<2`,\n ],\n classes: {\n modelRegistry: \"MastraModelRegistry\",\n toolRegistry: \"MastraToolRegistry\",\n webhookHandler: \"MastraAdapterWebhookHandler\",\n },\n },\n };\n};\n\nexport function getAdapterConfig(\n adapter: string,\n provider: string\n): AdapterConfig {\n const config = createAdapterConfig(provider)[adapter];\n if (!config) {\n throw new Error(\n `Unknown adapter: ${adapter}. Available adapters: ${Object.keys(\n createAdapterConfig(provider)\n ).join(\", \")}`\n );\n }\n return config;\n}\n","export const getIndexFileContent = (adapter: string = \"ai-sdk\"): string => {\n if (adapter === \"mastra\") {\n return `import \"dotenv/config\";\nimport { Agent } from \"@mastra/core/agent\";\nimport { client } from \"./agentmark.client\";\n\nconst telemetry = {\n isEnabled: true,\n metadata: {\n traceId: \"trace-123\",\n traceName: \"customer-support\",\n userId: \"user-123\",\n sessionId: \"session-123\",\n sessionName: \"my-first-session\",\n },\n};\n\nconst runCustomerSupport = async (customer_message: string) => {\n const prompt = await client.loadTextPrompt(\"customer-support-agent\");\n const agentConfig = await prompt.formatAgent({\n options: {\n telemetry,\n },\n });\n\n const [messages, generateOptions] = await agentConfig.formatMessages({\n props: {\n customer_question: customer_message,\n },\n });\n\n const agent = new Agent(agentConfig);\n const response = await agent.generate(messages, generateOptions);\n\n return (response as any).text || (response as any).content || String(response);\n};\n\nconst main = async () => {\n try {\n const user_message = \"How long does shipping take?\";\n const assistant = await runCustomerSupport(user_message);\n console.log(\"Customer support response:\", assistant);\n } catch (error) {\n console.error(error);\n }\n};\n\nmain();\n`;\n } else {\n return `import \"dotenv/config\";\nimport { generateText } from \"ai\";\nimport { client } from \"./agentmark.client\";\n\nconst telemetry = {\n isEnabled: true,\n metadata: {\n traceId: \"trace-123\",\n traceName: \"customer-support\",\n userId: \"user-123\",\n sessionId: \"session-123\",\n sessionName: \"my-first-session\",\n },\n};\n\nconst runCustomerSupport = async (customer_message: string) => {\n const prompt = await client.loadTextPrompt(\"customer-support-agent\");\n const vercelInput = await prompt.format({\n props: {\n customer_question: customer_message,\n },\n telemetry,\n });\n\n const resp = await generateText(vercelInput);\n\n return resp.text;\n};\n\nconst main = async () => {\n try {\n const user_message = \"How long does shipping take?\";\n const assistant = await runCustomerSupport(user_message);\n console.log(\"Customer support response:\", assistant);\n } catch (error) {\n console.error(error);\n }\n};\n\nmain();\n`;\n }\n}; ","export const getEnvFileContent = (\n _modelProvider: string,\n apiKey: string = ''\n): string => {\n const apiKeyValue = apiKey || 'your_api_key_here';\n\n return `# Cloud deployment: Set these environment variables\n# AGENTMARK_BASE_URL=https://api.agentmark.co\n# AGENTMARK_API_KEY=your_agentmark_api_key\n# AGENTMARK_APP_ID=your_agentmark_app_id\n# Learn more: https://docs.agentmark.co/platform/getting_started/quickstart\n\nOPENAI_API_KEY=${apiKeyValue}\n`;\n};\n","import fs from \"fs-extra\";\nimport { execSync, execFileSync } from \"child_process\";\nimport { getAdapterConfig } from \"./adapters.js\";\n\nexport const setupPackageJson = (targetPath: string = \".\", deploymentMode: \"cloud\" | \"static\" = \"cloud\") => {\n const packageJsonPath = `${targetPath}/package.json`;\n\n if (!fs.existsSync(packageJsonPath)) {\n console.log(\"Creating package.json...\");\n execSync(\"npm init -y\", { cwd: targetPath });\n }\n\n // Update the created package.json with additional information\n const pkgJson = fs.readJsonSync(packageJsonPath);\n pkgJson.name =\n pkgJson.name === \"test\" || !pkgJson.name\n ? \"agentmark-example-app\"\n : pkgJson.name;\n pkgJson.description =\n pkgJson.description || \"A simple Node.js app using the Agentmark SDK\";\n\n // All platforms use \"agentmark dev\" which runs their respective dev-entry.ts\n const devScript = \"agentmark dev\";\n\n // Base scripts for all modes\n const scripts: Record<string, string> = {\n ...pkgJson.scripts,\n \"demo\": \"npx tsx index.ts\",\n \"dev\": devScript,\n \"prompt\": \"agentmark run-prompt\",\n \"experiment\": \"agentmark run-experiment\",\n };\n\n // For static/self-hosted mode, add the build script\n if (deploymentMode === \"static\") {\n scripts[\"build\"] = \"agentmark build --out dist/agentmark\";\n }\n\n pkgJson.scripts = scripts;\n\n // Add overrides to fix vulnerabilities in transitive dependencies\n // localtunnel (used by @agentmark/cli) depends on axios@0.21.4 which has vulnerabilities\n pkgJson.overrides = {\n ...pkgJson.overrides,\n \"axios\": \"^1.7.9\"\n };\n\n fs.writeJsonSync(packageJsonPath, pkgJson, { spaces: 2 });\n};\n\nexport const installDependencies = (\n modelProvider: string,\n targetPath: string = \".\",\n adapter: string = \"ai-sdk\",\n deploymentMode: \"cloud\" | \"static\" = \"cloud\"\n) => {\n console.log(\"Installing required packages...\");\n console.log(\"This might take a moment...\");\n\n const adapterConfig = getAdapterConfig(adapter, modelProvider);\n\n try {\n // Install TypeScript, ts-node, CLI, and other dev dependencies\n // CLI needs to be a devDep so dev-entry.ts can import from @agentmark/cli/runner-server\n const devDepsCmd = \"npm install --save-dev typescript ts-node @types/node @agentmark/cli --legacy-peer-deps\";\n\n execSync(devDepsCmd, {\n stdio: \"inherit\",\n cwd: targetPath,\n });\n\n // Install the common packages\n // SDK is required for both local (connects to agentmark serve) and cloud (connects to API)\n // Loader packages are imported directly - ApiLoader always needed, FileLoader only for static mode\n const loaderPackages = deploymentMode === \"static\"\n ? [\"@agentmark/loader-api\", \"@agentmark/loader-file\"]\n : [\"@agentmark/loader-api\"];\n\n const installArgs = [\n \"install\",\n \"dotenv\",\n \"@agentmark/prompt-core\",\n \"@agentmark/sdk\",\n adapterConfig.package,\n ...loaderPackages,\n ...adapterConfig.dependencies,\n \"--legacy-peer-deps\",\n ];\n\n execFileSync(\"npm\", installArgs, { stdio: \"inherit\", cwd: targetPath });\n\n console.log(\"Packages installed successfully!\");\n } catch (error) {\n console.error(\"Error installing packages:\", error);\n throw new Error(\n \"Failed to install required packages. Please check your network connection and try again.\"\n );\n }\n};\n","export const getTsConfigContent = (): object => {\n return {\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"NodeNext\",\n \"moduleResolution\": \"NodeNext\",\n \"esModuleInterop\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"skipLibCheck\": true\n }\n };\n}; ","export const getAnimalDrawingPrompt = (): string => {\n return `---\nname: animal-drawing\nimage_config:\n model_name: dall-e-3\n num_images: 1\n size: 1024x1024\n aspect_ratio: 1:1\ntest_settings:\n dataset: animal.jsonl\n props:\n animal: \"cat\"\n---\n\n<ImagePrompt>\nDraw a hyper-realistic picture of a {props.animal}\n</ImagePrompt>`;\n};","export const getCustomerSupportPrompt = (model: string): string => {\n return `---\nname: customer-support-agent\ntext_config:\n model_name: ${model}\n max_calls: 2\n tools:\n search_knowledgebase:\n description: Search the company knowledgebase for information about shipping, warranty, and returns policies.\n parameters:\n type: object\n properties:\n query:\n type: string\n description: The search query to find relevant information\n required: [query]\ntest_settings:\n dataset: customer-query.jsonl\n props:\n customer_question: \"I'm having trouble with my order. How long does shipping take?\"\ninput_schema:\n type: object\n properties:\n customer_question:\n type: string\n description: \"The customer's question\"\n required:\n - customer_question\n---\n\n<System>\nYou are a customer service agent for a company that sells products online. You are given a customer's question and you need to respond to the customer. You need to be friendly, professional, and helpful.\n\nYou have access to the following tool:\n- search_knowledgebase: Search the company knowledgebase for information about shipping, warranty, and returns. Use this when customers ask about these topics.\n</System>\n\n<User>{props.customer_question}</User>`;\n};","export const getPartyPlannerPrompt = (model: string): string => {\n return `---\nname: party-planner\nobject_config:\n model_name: ${model}\n schema:\n type: object\n properties:\n names:\n type: array\n description: \"List of names of people attending the party.\"\n items:\n type: string\n required:\n - names\ntest_settings:\n dataset: party.jsonl\n evals:\n - exact_match_json\n props:\n party_text: \"We're having a party with Alice, Bob, and Carol.\"\ninput_schema:\n type: object\n properties:\n party_text:\n type: string\n description: \"A block of text describing the upcoming party and attendees.\"\n required:\n - party_text\n---\n\n<System>\nExtract the names of all people attending the party from the following text. Respond with a list of names only.\n</System>\n\n<User>\nText: {props.party_text}\n</User>`;\n};","export const getStoryTellerPrompt = (): string => {\n return `---\nname: story-teller\nspeech_config:\n model_name: tts-1-hd\n voice: \"nova\"\n speed: 1.0\n output_format: \"mp3\"\ntest_settings:\n dataset: story.jsonl\n props:\n story: \"Once upon a time, there was a cat who loved to play with a ball.\"\n---\n\n<System>\nYou are a storyteller for children. Make sure your story is engaging and interesting.\n</System>\n\n<SpeechPrompt>\n- {props.story}\n</SpeechPrompt>`;\n};","export const getAnimalDataset = (): string => {\n return `{\"input\": {\"animal\": \"cat\"}, \"expected_output\": \"A realistic picture of a cat\"}\n{\"input\": {\"animal\": \"dog\"}, \"expected_output\": \"A realistic picture of a dog\"}\n{\"input\": {\"animal\": \"bird\"}, \"expected_output\": \"A realistic picture of a bird\"}`;\n};\n\nexport const getCustomerQueryDataset = (): string => {\n return `{\"input\": {\"customer_question\": \"My package hasn't arrived yet. Can you help me track it?\"}}\n{\"input\": {\"customer_question\": \"I received the wrong item in my order. What should I do?\"}}\n{\"input\": {\"customer_question\": \"How do I return a product that I purchased last week?\"}}`;\n};\n\nexport const getPartyDataset = (): string => {\n return `{\"input\": {\"party_text\": \"We're having a party with Alice, Bob, and Carol.\"}, \"expected_output\": \"{\\\\\"names\\\\\": [\\\\\"Alice\\\\\", \\\\\"Bob\\\\\", \\\\\"Carol\\\\\"]}\"}\n{\"input\": {\"party_text\": \"The guest list includes Dave, Emma, and Frank.\"}, \"expected_output\": \"{\\\\\"names\\\\\": [\\\\\"Dave\\\\\", \\\\\"Emma\\\\\", \\\\\"Frank\\\\\"]}\"}\n{\"input\": {\"party_text\": \"Join us for a celebration with Grace, Henry, and Isla.\"}, \"expected_output\": \"{\\\\\"names\\\\\": [\\\\\"Grace\\\\\", \\\\\"Henry\\\\\", \\\\\"Isla\\\\\"]}\"}`;\n};\n\nexport const getStoryDataset = (): string => {\n return `{\"input\": {\"story\": \"Once upon a time, the Moon woke up and found her glow missing! She floated around the sky asking stars, clouds, and even comets if they'd seen her light. It wasn't until she peeked into a mountain lake that she saw her glow shining back—hidden in her own reflection! Laughing, she realized she had never lost it—it was with her all along, just hiding beneath a cloudy sky.\"}}\n{\"input\": {\"story\": \"Benny was no ordinary banana—he dreamed of becoming a superhero. One day, when a monkey slipped in the jungle and cried for help, Benny rolled into action, dodging vines and swinging from branches using his peel like a lasso. The monkey was saved, and from that day on, Benny was known as \\\\\"The Peel of Justice,\\\\\" the bravest fruit in the whole rainforest.\"}}\n{\"input\": {\"story\": \"In the town of Maplebrook, there was a library that whispered stories when no one was looking. Curious little Nia tiptoed in one rainy day and heard the books giggling softly. She opened one called The Secret Tunnel, and to her surprise, it sucked her in! She found herself riding a dragon through glittering caves. When she returned, the book winked shut—waiting for its next reader to listen.\"}}`;\n};","import fs from 'fs-extra';\nimport { getAnimalDrawingPrompt } from './animal-drawing-prompt.js';\nimport { getCustomerSupportPrompt } from './customer-support-prompt.js';\nimport { getPartyPlannerPrompt } from './party-planner-prompt.js';\nimport { getStoryTellerPrompt } from './story-teller-prompt.js';\nimport { getAnimalDataset, getCustomerQueryDataset, getPartyDataset, getStoryDataset } from './datasets.js';\n\nexport const createExamplePrompts = (model: string, targetPath: string = \".\", adapter: string = \"ai-sdk\") => {\n // Ensure the templates directory exists\n fs.ensureDirSync(`${targetPath}/agentmark`);\n \n // Create animal drawing prompt and dataset (skip for mastra adapter)\n if (adapter !== \"mastra\") {\n const animalDrawingPrompt = getAnimalDrawingPrompt();\n fs.writeFileSync(`${targetPath}/agentmark/animal-drawing.prompt.mdx`, animalDrawingPrompt);\n const animalDataset = getAnimalDataset();\n fs.writeFileSync(`${targetPath}/agentmark/animal.jsonl`, animalDataset);\n }\n \n // Create customer support prompt and dataset\n const customerSupportPrompt = getCustomerSupportPrompt(model);\n fs.writeFileSync(`${targetPath}/agentmark/customer-support-agent.prompt.mdx`, customerSupportPrompt);\n const customerQueryDataset = getCustomerQueryDataset();\n fs.writeFileSync(`${targetPath}/agentmark/customer-query.jsonl`, customerQueryDataset);\n \n // Create party planner prompt and dataset\n const partyPlannerPrompt = getPartyPlannerPrompt(model);\n fs.writeFileSync(`${targetPath}/agentmark/party-planner.prompt.mdx`, partyPlannerPrompt);\n const partyDataset = getPartyDataset();\n fs.writeFileSync(`${targetPath}/agentmark/party.jsonl`, partyDataset);\n \n // Create story teller prompt and dataset (skip for mastra adapter)\n if (adapter !== \"mastra\") {\n const storyTellerPrompt = getStoryTellerPrompt();\n fs.writeFileSync(`${targetPath}/agentmark/story-teller.prompt.mdx`, storyTellerPrompt);\n const storyDataset = getStoryDataset();\n fs.writeFileSync(`${targetPath}/agentmark/story.jsonl`, storyDataset);\n }\n};","import { getAdapterConfig } from \"./adapters.js\";\n\nexport const getClientConfigContent = (options: { provider: string; languageModels: string[]; adapter: string; deploymentMode?: \"cloud\" | \"static\" }) => {\n const { provider, languageModels, adapter, deploymentMode = \"cloud\" } = options;\n const adapterConfig = getAdapterConfig(adapter, provider);\n const { modelRegistry, toolRegistry } = adapterConfig.classes;\n\n const providerImport = `import { ${provider} } from '@ai-sdk/${provider}';`;\n\n const extraModelRegs = provider === 'openai'\n ? `.registerModels([\"dall-e-3\"], (name: string) => ${provider}.image(name))\n .registerModels([\"tts-1-hd\"], (name: string) => ${provider}.speech(name))`\n : '';\n\n // Import loaders from dedicated packages\n const loaderImport = deploymentMode === \"cloud\"\n ? `import { ApiLoader } from \"@agentmark/loader-api\";`\n : `import { ApiLoader } from \"@agentmark/loader-api\";\nimport { FileLoader } from \"@agentmark/loader-file\";`;\n\n const loaderSetup = deploymentMode === \"cloud\"\n ? ` // ApiLoader works for both development and production\n // - Development: 'agentmark dev' sets AGENTMARK_BASE_URL to localhost\n // - Production: Set AGENTMARK_API_KEY and AGENTMARK_APP_ID for cloud\n const loader = process.env.NODE_ENV === 'development'\n ? ApiLoader.local({ baseUrl: process.env.AGENTMARK_BASE_URL || 'http://localhost:9418' })\n : ApiLoader.cloud({\n apiKey: process.env.AGENTMARK_API_KEY!,\n appId: process.env.AGENTMARK_APP_ID!,\n });`\n : ` const loader = process.env.NODE_ENV === 'development'\n ? ApiLoader.local({ baseUrl: process.env.AGENTMARK_BASE_URL || 'http://localhost:9418' })\n : new FileLoader('./dist/agentmark');`;\n\n return `// agentmark.client.ts\nimport path from 'node:path';\nimport dotenv from 'dotenv';\ndotenv.config({ path: path.resolve(__dirname, '.env') });\nimport { createAgentMarkClient, ${modelRegistry}, ${toolRegistry}, EvalRegistry } from \"${adapterConfig.package}\";\n${loaderImport}\nimport AgentMarkTypes, { Tools } from './agentmark.types';\n${providerImport}\n\nfunction createModelRegistry() {\n const modelRegistry = new ${modelRegistry}()\n .registerModels(${JSON.stringify(languageModels)}, (name: string) => ${provider}(name))\n ${extraModelRegs};\n return modelRegistry;\n}\n\nfunction createToolRegistry() {\n const toolRegistry = new ${toolRegistry}<Tools>()\n .register('search_knowledgebase', async ({ query }) => {\n // Simulate search delay\n await new Promise(resolve => setTimeout(resolve, 500));\n\n // Return all three knowledge base articles\n // The LLM will select the relevant one based on the query\n return {\n articles: [\n { topic: 'shipping', content: 'Standard shipping takes 3–5 business days.' },\n { topic: 'warranty', content: 'All products include a 1-year limited warranty.' },\n { topic: 'returns', content: 'You can return items within 30 days of delivery.' }\n ]\n };\n });\n return toolRegistry;\n}\n\nfunction createEvalRegistry() {\n const evalRegistry = new EvalRegistry()\n .register('exact_match_json', ({ output, expectedOutput }) => {\n if (!expectedOutput) {\n return { score: 0, label: 'error', reason: 'No expected output provided', passed: false };\n }\n try {\n const ok = JSON.stringify(output) === JSON.stringify(JSON.parse(expectedOutput));\n return {\n score: ok ? 1 : 0,\n label: ok ? 'correct' : 'incorrect',\n reason: ok ? 'Exact match' : 'Mismatch',\n passed: ok\n };\n } catch (e) {\n return { score: 0, label: 'error', reason: 'Failed to parse expected output as JSON', passed: false };\n }\n });\n return evalRegistry;\n}\n\nfunction createClient() {\n${loaderSetup}\n const modelRegistry = createModelRegistry();\n const toolRegistry = createToolRegistry();\n const evalRegistry = createEvalRegistry();\n return createAgentMarkClient<AgentMarkTypes, typeof toolRegistry>({ loader, modelRegistry, toolRegistry, evalRegistry });\n}\n\nexport const client = createClient();\n`;\n};\n"],"mappings":";AAaO,IAAM,sBAAsB,CACjC,aACkC;AAClC,SAAO;AAAA,IACL,UAAU;AAAA,MACR,SAAS;AAAA,MACT,cAAc,CAAC,SAAS,WAAW,QAAQ,KAAK;AAAA,MAChD,SAAS;AAAA,QACP,eAAe;AAAA,QACf,cAAc;AAAA,QACd,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,cAAc;AAAA,QACZ;AAAA,QACA;AAAA,QACA,WAAW,QAAQ;AAAA,MACrB;AAAA,MACA,SAAS;AAAA,QACP,eAAe;AAAA,QACf,cAAc;AAAA,QACd,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,iBACd,SACA,UACe;AACf,QAAM,SAAS,oBAAoB,QAAQ,EAAE,OAAO;AACpD,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR,oBAAoB,OAAO,yBAAyB,OAAO;AAAA,QACzD,oBAAoB,QAAQ;AAAA,MAC9B,EAAE,KAAK,IAAI,CAAC;AAAA,IACd;AAAA,EACF;AACA,SAAO;AACT;;;ACvDO,IAAM,sBAAsB,CAAC,UAAkB,aAAqB;AACzE,MAAI,YAAY,UAAU;AACxB,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwCvC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASb;","names":["fs","fs"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-agentmark",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Create AgentMark projects with npm create agentmark",
6
6
  "main": "dist/index.js",
@@ -10,7 +10,7 @@
10
10
  "./templates": "./dist/utils/examples/templates/index.js"
11
11
  },
12
12
  "scripts": {
13
- "build": "node -e \"require('fs').rmSync('./dist', { recursive: true, force: true })\" && tsc && node -e \"require('fs').chmodSync('dist/index.js', '755')\"",
13
+ "build": "node -e \"require('fs').rmSync('./dist', { recursive: true, force: true })\" && tsup && node -e \"require('fs').chmodSync('dist/index.js', '755')\"",
14
14
  "test": "vitest run",
15
15
  "lint": "eslint .",
16
16
  "prepack": "node -e \"try { require('fs').chmodSync('dist/index.js', '755') } catch {}\"",
@@ -37,6 +37,7 @@
37
37
  "@types/fs-extra": "^11.0.4",
38
38
  "@types/node": "^20",
39
39
  "@types/prompts": "^2.4.9",
40
+ "tsup": "^8.5.1",
40
41
  "typescript": "^5",
41
42
  "vitest": "^3.1.4"
42
43
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export declare const createExampleApp: (client: string, targetPath?: string, apiKey?: string, adapter?: string) => Promise<void>;
2
- //# sourceMappingURL=create-example-app.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-example-app.d.ts","sourceRoot":"","sources":["../../../src/utils/examples/create-example-app.ts"],"names":[],"mappings":"AA0HA,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,MAAM,EACd,aAAY,MAAY,EACxB,SAAQ,MAAW,EACnB,UAAS,MAAiB,kBA0K3B,CAAC"}