create-agentmark 0.7.0 → 0.8.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/index.js CHANGED
@@ -86,13 +86,37 @@ function getAdapterConfig(adapter, provider) {
86
86
  }
87
87
 
88
88
  // src/utils/examples/templates/app-index.ts
89
- var getIndexFileContent = (adapter = "ai-sdk") => {
89
+ var getIndexFileContent = (adapter = "ai-sdk", deploymentMode = "cloud") => {
90
+ const isCloud = deploymentMode === "cloud";
91
+ const tracingImport = `import { AgentMarkSDK } from "@agentmark-ai/sdk";
92
+ `;
93
+ const cloudTracingInit = `
94
+ // Initialize tracing - traces will be sent to AgentMark Cloud
95
+ // To disable tracing, comment out sdk.initTracing() below
96
+ const sdk = new AgentMarkSDK({
97
+ apiKey: process.env.AGENTMARK_API_KEY ?? "",
98
+ appId: process.env.AGENTMARK_APP_ID ?? "",
99
+ });
100
+ sdk.initTracing({ disableBatch: true });
101
+ `;
102
+ const staticTracingInit = `
103
+ // Initialize tracing - traces will be sent to local dev server
104
+ // Make sure to run "npm run dev" in another terminal first
105
+ // To disable tracing, comment out sdk.initTracing() below
106
+ const sdk = new AgentMarkSDK({
107
+ apiKey: "",
108
+ appId: "",
109
+ baseUrl: "http://localhost:9418",
110
+ });
111
+ sdk.initTracing({ disableBatch: true });
112
+ `;
113
+ const tracingInit = isCloud ? cloudTracingInit : staticTracingInit;
90
114
  if (adapter === "claude-agent-sdk") {
91
115
  return `import "dotenv/config";
92
116
  import { query } from "@anthropic-ai/claude-agent-sdk";
93
117
  import { withTracing } from "@agentmark-ai/claude-agent-sdk-adapter";
94
- import { client } from "./agentmark.client";
95
-
118
+ ${tracingImport}import { client } from "./agentmark.client";
119
+ ${tracingInit}
96
120
  const telemetry = {
97
121
  isEnabled: true,
98
122
  metadata: {
@@ -144,8 +168,8 @@ main();
144
168
  } else if (adapter === "mastra") {
145
169
  return `import "dotenv/config";
146
170
  import { Agent } from "@mastra/core/agent";
147
- import { client } from "./agentmark.client";
148
-
171
+ ${tracingImport}import { client } from "./agentmark.client";
172
+ ${tracingInit}
149
173
  const telemetry = {
150
174
  isEnabled: true,
151
175
  metadata: {
@@ -191,8 +215,8 @@ main();
191
215
  } else {
192
216
  return `import "dotenv/config";
193
217
  import { generateText } from "ai";
194
- import { client } from "./agentmark.client";
195
-
218
+ ${tracingImport}import { client } from "./agentmark.client";
219
+ ${tracingInit}
196
220
  const telemetry = {
197
221
  isEnabled: true,
198
222
  metadata: {
@@ -523,10 +547,6 @@ var setupPackageJson = (targetPath = ".", deploymentMode = "cloud", projectInfo
523
547
  scripts["build"] = "agentmark build --out dist/agentmark";
524
548
  }
525
549
  pkgJson.scripts = scripts;
526
- pkgJson.overrides = {
527
- ...pkgJson.overrides,
528
- "axios": "^1.7.9"
529
- };
530
550
  fs2.writeJsonSync(packageJsonPath, pkgJson, { spaces: 2 });
531
551
  }
532
552
  };
@@ -1135,7 +1155,7 @@ var createExampleApp = async (client, targetPath = ".", apiKey = "", adapter = "
1135
1155
  } else {
1136
1156
  fs4.writeFileSync(`${targetPath}/.env`, getEnvFileContent(modelProvider, apiKey, adapter));
1137
1157
  }
1138
- const gitignoreEntries = ["node_modules/", ".env", "*.agentmark-outputs/", ".agentmark/", "dist/"];
1158
+ const gitignoreEntries = ["node_modules/", ".env", "*.agentmark-outputs/", "dist/"];
1139
1159
  if (shouldMergeFile(".gitignore", projectInfo, resolutions)) {
1140
1160
  const result = appendGitignore(targetPath, gitignoreEntries);
1141
1161
  if (result.added.length > 0) {
@@ -1151,7 +1171,7 @@ var createExampleApp = async (client, targetPath = ".", apiKey = "", adapter = "
1151
1171
  if (!isExistingProject) {
1152
1172
  fs4.writeFileSync(
1153
1173
  `${targetPath}/index.ts`,
1154
- getIndexFileContent(adapter)
1174
+ getIndexFileContent(adapter, deploymentMode)
1155
1175
  );
1156
1176
  } else {
1157
1177
  console.log("\u23ED\uFE0F Skipped index.ts (existing project)");
@@ -1179,12 +1199,11 @@ export default interface AgentmarkTypes {}
1179
1199
  `);
1180
1200
  }
1181
1201
  console.log("Creating development server entry point...");
1182
- const agentmarkInternalDir = path2.join(targetPath, ".agentmark");
1183
- fs4.ensureDirSync(agentmarkInternalDir);
1184
1202
  const adapterConfig = getAdapterConfig(adapter, modelProvider);
1185
1203
  const { webhookHandler } = adapterConfig.classes;
1186
- const devEntryContent = `// Auto-generated webhook server entry point
1187
- // To customize, create a dev-server.ts file in your project root
1204
+ const devEntryPath = path2.join(targetPath, "dev-entry.ts");
1205
+ const devEntryContent = `// Development webhook server entry point
1206
+ // This file is version controlled - customize as needed for your project
1188
1207
 
1189
1208
  import { createWebhookServer } from '@agentmark-ai/cli/runner-server';
1190
1209
  import { ${webhookHandler} } from '${adapterConfig.package}/runner';
@@ -1205,7 +1224,7 @@ async function main() {
1205
1224
  process.env.AGENTMARK_BASE_URL = apiServerUrl;
1206
1225
 
1207
1226
  // Now import client - it will pick up the dev environment
1208
- const { client } = await import('../agentmark.client.js');
1227
+ const { client } = await import('./agentmark.client.js');
1209
1228
 
1210
1229
  // Initialize OpenTelemetry tracing to export traces to the API server
1211
1230
  const sdk = new AgentMarkSDK({
@@ -1231,7 +1250,12 @@ main().catch((err) => {
1231
1250
  process.exit(1);
1232
1251
  });
1233
1252
  `;
1234
- fs4.writeFileSync(path2.join(agentmarkInternalDir, "dev-entry.ts"), devEntryContent);
1253
+ if (fs4.existsSync(devEntryPath)) {
1254
+ console.log("\u23ED\uFE0F Skipped dev-entry.ts (already exists - preserving customizations)");
1255
+ } else {
1256
+ fs4.writeFileSync(devEntryPath, devEntryContent);
1257
+ console.log(`\u2705 Created dev-entry.ts at project root`);
1258
+ }
1235
1259
  console.log("\n\u2705 Agentmark initialization completed successfully!");
1236
1260
  console.log(
1237
1261
  `
@@ -1394,6 +1418,7 @@ version = "0.1.0"
1394
1418
  description = "An AgentMark application using Claude Agent SDK"
1395
1419
  requires-python = ">=3.12"
1396
1420
  dependencies = [
1421
+ "agentmark-sdk>=0.1.0",
1397
1422
  "agentmark-claude-agent-sdk>=0.1.0",
1398
1423
  "agentmark-prompt-core>=0.1.0",
1399
1424
  "python-dotenv>=1.0.0",
@@ -1406,10 +1431,6 @@ dev = [
1406
1431
  "pytest-asyncio>=0.21",
1407
1432
  "mypy>=1.0",
1408
1433
  ]
1409
- otel = [
1410
- "opentelemetry-api>=1.20",
1411
- "opentelemetry-sdk>=1.20",
1412
- ]
1413
1434
 
1414
1435
  [build-system]
1415
1436
  requires = ["hatchling"]
@@ -1428,6 +1449,7 @@ version = "0.1.0"
1428
1449
  description = "An AgentMark application using Pydantic AI"
1429
1450
  requires-python = ">=3.12"
1430
1451
  dependencies = [
1452
+ "agentmark-sdk>=0.1.0",
1431
1453
  "agentmark-pydantic-ai>=0.1.0",
1432
1454
  "agentmark-prompt-core>=0.1.0",
1433
1455
  "python-dotenv>=1.0.0",
@@ -1554,7 +1576,29 @@ client = create_pydantic_ai_client(
1554
1576
  __all__ = ["client"]
1555
1577
  `;
1556
1578
  };
1557
- var getMainPyContent = (adapter) => {
1579
+ var getMainPyContent = (adapter, deploymentMode = "cloud") => {
1580
+ const isCloud = deploymentMode === "cloud";
1581
+ const cloudTracingInit = `
1582
+ # Initialize tracing - traces will be sent to AgentMark Cloud
1583
+ # To disable tracing, comment out sdk.init_tracing() below
1584
+ sdk = AgentMarkSDK(
1585
+ api_key=os.environ.get("AGENTMARK_API_KEY", ""),
1586
+ app_id=os.environ.get("AGENTMARK_APP_ID", ""),
1587
+ )
1588
+ sdk.init_tracing(disable_batch=True)
1589
+ `;
1590
+ const staticTracingInit = `
1591
+ # Initialize tracing - traces will be sent to local dev server
1592
+ # Make sure to run "npm run dev" in another terminal first
1593
+ # To disable tracing, comment out sdk.init_tracing() below
1594
+ sdk = AgentMarkSDK(
1595
+ api_key="",
1596
+ app_id="",
1597
+ base_url="http://localhost:9418",
1598
+ )
1599
+ sdk.init_tracing(disable_batch=True)
1600
+ `;
1601
+ const tracingInit = isCloud ? cloudTracingInit : staticTracingInit;
1558
1602
  if (adapter === "claude-agent-sdk") {
1559
1603
  return `"""Example usage of AgentMark with Claude Agent SDK.
1560
1604
 
@@ -1563,11 +1607,13 @@ Run with: python main.py
1563
1607
 
1564
1608
  import asyncio
1565
1609
  import json
1610
+ import os
1566
1611
  from pathlib import Path
1567
1612
 
1613
+ from agentmark_sdk import AgentMarkSDK
1568
1614
  from agentmark_claude_agent_sdk import run_text_prompt
1569
1615
  from agentmark_client import client
1570
-
1616
+ ${tracingInit}
1571
1617
 
1572
1618
  async def main():
1573
1619
  """Run the party planner prompt."""
@@ -1612,11 +1658,13 @@ Run with: python main.py
1612
1658
 
1613
1659
  import asyncio
1614
1660
  import json
1661
+ import os
1615
1662
  from pathlib import Path
1616
1663
 
1664
+ from agentmark_sdk import AgentMarkSDK
1617
1665
  from agentmark_pydantic_ai_v0 import run_text_prompt
1618
1666
  from agentmark_client import client
1619
-
1667
+ ${tracingInit}
1620
1668
 
1621
1669
  async def main():
1622
1670
  """Run the party planner prompt."""
@@ -1750,7 +1798,7 @@ var createPythonApp = async (client, targetPath = ".", apiKey = "", deploymentMo
1750
1798
  }
1751
1799
  fs5.writeFileSync(`${targetPath}/agentmark_client.py`, getAgentmarkClientContent(deploymentMode, adapter));
1752
1800
  if (!isExistingProject) {
1753
- fs5.writeFileSync(`${targetPath}/main.py`, getMainPyContent(adapter));
1801
+ fs5.writeFileSync(`${targetPath}/main.py`, getMainPyContent(adapter, deploymentMode));
1754
1802
  } else {
1755
1803
  console.log("\u23ED\uFE0F Skipped main.py (existing project)");
1756
1804
  }