create-agentmark 0.8.2 → 0.8.4
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
|
@@ -9,34 +9,6 @@ import prompts2 from "prompts";
|
|
|
9
9
|
import fs4 from "fs-extra";
|
|
10
10
|
import * as path2 from "path";
|
|
11
11
|
|
|
12
|
-
// src/utils/providers.ts
|
|
13
|
-
var Providers = {
|
|
14
|
-
openai: {
|
|
15
|
-
label: "OpenAI",
|
|
16
|
-
languageModels: [
|
|
17
|
-
"gpt-4o",
|
|
18
|
-
"gpt-4o-mini",
|
|
19
|
-
"gpt-4",
|
|
20
|
-
"gpt-5",
|
|
21
|
-
"gpt-4-turbo",
|
|
22
|
-
"gpt-3.5-turbo"
|
|
23
|
-
],
|
|
24
|
-
imageModels: ["dall-e-3", "dall-e-2"],
|
|
25
|
-
speechModels: ["tts-1", "tts-1-hd"]
|
|
26
|
-
},
|
|
27
|
-
anthropic: {
|
|
28
|
-
label: "Anthropic",
|
|
29
|
-
languageModels: [
|
|
30
|
-
"claude-sonnet-4-20250514",
|
|
31
|
-
"claude-opus-4-20250514",
|
|
32
|
-
"claude-3-5-sonnet-20241022",
|
|
33
|
-
"claude-3-5-haiku-20241022"
|
|
34
|
-
],
|
|
35
|
-
imageModels: [],
|
|
36
|
-
speechModels: []
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
12
|
// src/utils/examples/templates/adapters.ts
|
|
41
13
|
var createAdapterConfig = (provider) => {
|
|
42
14
|
return {
|
|
@@ -101,7 +73,7 @@ sdk.initTracing({ disableBatch: true });
|
|
|
101
73
|
`;
|
|
102
74
|
const staticTracingInit = `
|
|
103
75
|
// Initialize tracing - traces will be sent to local dev server
|
|
104
|
-
// Make sure to run "npm run dev" in another terminal first
|
|
76
|
+
// Make sure to run "npm run agentmark dev" in another terminal first
|
|
105
77
|
// To disable tracing, comment out sdk.initTracing() below
|
|
106
78
|
const sdk = new AgentMarkSDK({
|
|
107
79
|
apiKey: "",
|
|
@@ -514,9 +486,7 @@ var setupPackageJson = (targetPath = ".", deploymentMode = "cloud", projectInfo
|
|
|
514
486
|
if (isExistingProject && fs2.existsSync(packageJsonPath)) {
|
|
515
487
|
const scriptsToAdd = {
|
|
516
488
|
"demo": "npx tsx index.ts",
|
|
517
|
-
"
|
|
518
|
-
"prompt": "agentmark run-prompt",
|
|
519
|
-
"experiment": "agentmark run-experiment"
|
|
489
|
+
"agentmark": "agentmark"
|
|
520
490
|
};
|
|
521
491
|
if (deploymentMode === "static") {
|
|
522
492
|
scriptsToAdd["build"] = "agentmark build --out dist/agentmark";
|
|
@@ -535,13 +505,10 @@ var setupPackageJson = (targetPath = ".", deploymentMode = "cloud", projectInfo
|
|
|
535
505
|
const pkgJson = fs2.readJsonSync(packageJsonPath);
|
|
536
506
|
pkgJson.name = pkgJson.name === "test" || !pkgJson.name ? "agentmark-example-app" : pkgJson.name;
|
|
537
507
|
pkgJson.description = pkgJson.description || "A simple Node.js app using the Agentmark SDK";
|
|
538
|
-
const devScript = "agentmark dev";
|
|
539
508
|
const scripts = {
|
|
540
509
|
...pkgJson.scripts,
|
|
541
510
|
"demo": "npx tsx index.ts",
|
|
542
|
-
"
|
|
543
|
-
"prompt": "agentmark run-prompt",
|
|
544
|
-
"experiment": "agentmark run-experiment"
|
|
511
|
+
"agentmark": "agentmark"
|
|
545
512
|
};
|
|
546
513
|
if (deploymentMode === "static") {
|
|
547
514
|
scripts["build"] = "agentmark build --out dist/agentmark";
|
|
@@ -604,7 +571,7 @@ var getAnimalDrawingPrompt = () => {
|
|
|
604
571
|
return `---
|
|
605
572
|
name: animal-drawing
|
|
606
573
|
image_config:
|
|
607
|
-
model_name: dall-e-3
|
|
574
|
+
model_name: openai/dall-e-3
|
|
608
575
|
num_images: 1
|
|
609
576
|
size: 1024x1024
|
|
610
577
|
aspect_ratio: 1:1
|
|
@@ -706,7 +673,7 @@ var getStoryTellerPrompt = () => {
|
|
|
706
673
|
return `---
|
|
707
674
|
name: story-teller
|
|
708
675
|
speech_config:
|
|
709
|
-
model_name: tts-1-hd
|
|
676
|
+
model_name: openai/tts-1-hd
|
|
710
677
|
voice: "nova"
|
|
711
678
|
speed: 1.0
|
|
712
679
|
output_format: "mp3"
|
|
@@ -779,13 +746,11 @@ var createExamplePrompts = (model, targetPath = ".", adapter = "ai-sdk") => {
|
|
|
779
746
|
|
|
780
747
|
// src/utils/examples/templates/user-client-config.ts
|
|
781
748
|
var getClientConfigContent = (options) => {
|
|
782
|
-
const { provider,
|
|
749
|
+
const { provider, adapter, deploymentMode = "cloud" } = options;
|
|
783
750
|
const adapterConfig = getAdapterConfig(adapter, provider);
|
|
784
751
|
const { modelRegistry, toolRegistry } = adapterConfig.classes;
|
|
785
752
|
const isClaudeAgentSdk = adapter === "claude-agent-sdk";
|
|
786
753
|
const providerImport = isClaudeAgentSdk ? "" : `import { ${provider} } from '@ai-sdk/${provider}';`;
|
|
787
|
-
const extraModelRegs = provider === "openai" && !isClaudeAgentSdk ? `.registerModels(["dall-e-3"], (name: string) => ${provider}.image(name))
|
|
788
|
-
.registerModels(["tts-1-hd"], (name: string) => ${provider}.speech(name))` : "";
|
|
789
754
|
const loaderImport = deploymentMode === "cloud" ? `import { ApiLoader } from "@agentmark-ai/loader-api";` : `import { ApiLoader } from "@agentmark-ai/loader-api";
|
|
790
755
|
import { FileLoader } from "@agentmark-ai/loader-file";`;
|
|
791
756
|
const loaderSetup = deploymentMode === "cloud" ? ` // ApiLoader works for both development and production
|
|
@@ -815,8 +780,7 @@ import { FileLoader } from "@agentmark-ai/loader-file";`;
|
|
|
815
780
|
return modelRegistry;
|
|
816
781
|
}` : `function createModelRegistry() {
|
|
817
782
|
const modelRegistry = new ${modelRegistry}()
|
|
818
|
-
.
|
|
819
|
-
${extraModelRegs};
|
|
783
|
+
.registerProviders({ ${provider} });
|
|
820
784
|
return modelRegistry;
|
|
821
785
|
}`;
|
|
822
786
|
const adapterOptionsImport = isClaudeAgentSdk ? `
|
|
@@ -1002,6 +966,38 @@ function displayProjectDetectionSummary(projectInfo) {
|
|
|
1002
966
|
console.log("");
|
|
1003
967
|
}
|
|
1004
968
|
|
|
969
|
+
// src/utils/git-init.ts
|
|
970
|
+
import { execSync as execSync2 } from "child_process";
|
|
971
|
+
function initGitRepo(targetPath) {
|
|
972
|
+
try {
|
|
973
|
+
try {
|
|
974
|
+
execSync2("git --version", { stdio: "ignore" });
|
|
975
|
+
} catch {
|
|
976
|
+
console.log("\u26A0\uFE0F git not found \u2014 skipping repository initialization");
|
|
977
|
+
return false;
|
|
978
|
+
}
|
|
979
|
+
try {
|
|
980
|
+
execSync2("git rev-parse --is-inside-work-tree", {
|
|
981
|
+
cwd: targetPath,
|
|
982
|
+
stdio: "ignore"
|
|
983
|
+
});
|
|
984
|
+
return false;
|
|
985
|
+
} catch {
|
|
986
|
+
}
|
|
987
|
+
execSync2("git init", { cwd: targetPath, stdio: "ignore" });
|
|
988
|
+
execSync2("git add -A", { cwd: targetPath, stdio: "ignore" });
|
|
989
|
+
execSync2(
|
|
990
|
+
'git -c user.name="create-agentmark" -c user.email="noreply" commit -m "Initial commit from create-agentmark"',
|
|
991
|
+
{ cwd: targetPath, stdio: "ignore" }
|
|
992
|
+
);
|
|
993
|
+
console.log("\u2705 Initialized git repository with initial commit");
|
|
994
|
+
return true;
|
|
995
|
+
} catch {
|
|
996
|
+
console.log("\u26A0\uFE0F Could not initialize git repository");
|
|
997
|
+
return false;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
|
|
1005
1001
|
// src/utils/examples/create-example-app.ts
|
|
1006
1002
|
var setupMCPServer = (client, targetPath) => {
|
|
1007
1003
|
if (client === "skip") {
|
|
@@ -1120,7 +1116,7 @@ var setupMCPServer = (client, targetPath) => {
|
|
|
1120
1116
|
var createExampleApp = async (client, targetPath = ".", apiKey = "", adapter = "ai-sdk", deploymentMode = "cloud", projectInfo = null, resolutions = []) => {
|
|
1121
1117
|
try {
|
|
1122
1118
|
const modelProvider = adapter === "claude-agent-sdk" ? "anthropic" : "openai";
|
|
1123
|
-
const model = adapter === "claude-agent-sdk" ? "claude-sonnet-4-20250514" : "gpt-4o";
|
|
1119
|
+
const model = adapter === "claude-agent-sdk" ? "anthropic/claude-sonnet-4-20250514" : "openai/gpt-4o";
|
|
1124
1120
|
const isExistingProject = projectInfo?.isExistingProject ?? false;
|
|
1125
1121
|
if (isExistingProject) {
|
|
1126
1122
|
console.log("Adding AgentMark to existing project...");
|
|
@@ -1132,10 +1128,9 @@ var createExampleApp = async (client, targetPath = ".", apiKey = "", adapter = "
|
|
|
1132
1128
|
setupMCPServer(client, targetPath);
|
|
1133
1129
|
createExamplePrompts(model, targetPath, adapter);
|
|
1134
1130
|
console.log(`\u2705 Example prompts and datasets created in ${folderName}/agentmark/`);
|
|
1135
|
-
const langModels = Providers[modelProvider].languageModels.slice(0, 1);
|
|
1136
1131
|
fs4.writeFileSync(
|
|
1137
1132
|
`${targetPath}/agentmark.client.ts`,
|
|
1138
|
-
getClientConfigContent({ provider: modelProvider,
|
|
1133
|
+
getClientConfigContent({ provider: modelProvider, adapter, deploymentMode })
|
|
1139
1134
|
);
|
|
1140
1135
|
if (shouldMergeFile(".env", projectInfo, resolutions)) {
|
|
1141
1136
|
const envVars = {};
|
|
@@ -1256,6 +1251,9 @@ main().catch((err) => {
|
|
|
1256
1251
|
fs4.writeFileSync(devEntryPath, devEntryContent);
|
|
1257
1252
|
console.log(`\u2705 Created dev-entry.ts at project root`);
|
|
1258
1253
|
}
|
|
1254
|
+
if (!isExistingProject) {
|
|
1255
|
+
initGitRepo(targetPath);
|
|
1256
|
+
}
|
|
1259
1257
|
console.log("\n\u2705 Agentmark initialization completed successfully!");
|
|
1260
1258
|
console.log(
|
|
1261
1259
|
`
|
|
@@ -1273,18 +1271,18 @@ main().catch((err) => {
|
|
|
1273
1271
|
console.log("\u2550".repeat(70));
|
|
1274
1272
|
const runCmd = packageManager?.runCmd ?? "npm run";
|
|
1275
1273
|
const pkgJsonPath = path2.join(targetPath, "package.json");
|
|
1276
|
-
let
|
|
1274
|
+
let agentmarkScriptName = "agentmark";
|
|
1277
1275
|
if (fs4.existsSync(pkgJsonPath)) {
|
|
1278
1276
|
const pkgJson = fs4.readJsonSync(pkgJsonPath);
|
|
1279
|
-
if (pkgJson.scripts?.["agentmark:
|
|
1280
|
-
|
|
1277
|
+
if (pkgJson.scripts?.["agentmark:agentmark"]) {
|
|
1278
|
+
agentmarkScriptName = "agentmark:agentmark";
|
|
1281
1279
|
}
|
|
1282
1280
|
}
|
|
1283
1281
|
console.log("\n Get Started:");
|
|
1284
1282
|
if (folderName !== "." && folderName !== "./" && !isExistingProject) {
|
|
1285
1283
|
console.log(` $ cd ${folderName}`);
|
|
1286
1284
|
}
|
|
1287
|
-
console.log(` $ ${runCmd} ${
|
|
1285
|
+
console.log(` $ ${runCmd} ${agentmarkScriptName} dev
|
|
1288
1286
|
`);
|
|
1289
1287
|
console.log("\u2500".repeat(70));
|
|
1290
1288
|
console.log("Resources");
|
|
@@ -1589,7 +1587,7 @@ sdk.init_tracing(disable_batch=True)
|
|
|
1589
1587
|
`;
|
|
1590
1588
|
const staticTracingInit = `
|
|
1591
1589
|
# Initialize tracing - traces will be sent to local dev server
|
|
1592
|
-
# Make sure to run "npm run dev" in another terminal first
|
|
1590
|
+
# Make sure to run "npm run agentmark dev" in another terminal first
|
|
1593
1591
|
# To disable tracing, comment out sdk.init_tracing() below
|
|
1594
1592
|
sdk = AgentMarkSDK(
|
|
1595
1593
|
api_key="",
|
|
@@ -1706,7 +1704,7 @@ var getDevServerContent = (adapter) => {
|
|
|
1706
1704
|
const adapterPackage = adapter === "claude-agent-sdk" ? "agentmark_claude_agent_sdk" : "agentmark_pydantic_ai_v0";
|
|
1707
1705
|
return `"""Auto-generated webhook server for AgentMark development.
|
|
1708
1706
|
|
|
1709
|
-
This server is started by 'npm run dev' (agentmark dev) and handles
|
|
1707
|
+
This server is started by 'npm run agentmark dev' (agentmark dev) and handles
|
|
1710
1708
|
prompt execution requests from the CLI.
|
|
1711
1709
|
"""
|
|
1712
1710
|
|
|
@@ -1777,7 +1775,7 @@ htmlcov/
|
|
|
1777
1775
|
};
|
|
1778
1776
|
var createPythonApp = async (client, targetPath = ".", apiKey = "", deploymentMode = "cloud", adapter = "pydantic-ai", projectInfo = null, resolutions = []) => {
|
|
1779
1777
|
try {
|
|
1780
|
-
const model = adapter === "claude-agent-sdk" ? "claude-sonnet-4-20250514" : "gpt-4o";
|
|
1778
|
+
const model = adapter === "claude-agent-sdk" ? "anthropic/claude-sonnet-4-20250514" : "openai/gpt-4o";
|
|
1781
1779
|
const adapterDisplayName = adapter === "claude-agent-sdk" ? "Claude Agent SDK" : "Pydantic AI";
|
|
1782
1780
|
const isExistingProject = projectInfo?.isExistingProject ?? false;
|
|
1783
1781
|
if (isExistingProject) {
|
|
@@ -1863,6 +1861,9 @@ var createPythonApp = async (client, targetPath = ".", apiKey = "", deploymentMo
|
|
|
1863
1861
|
console.log("Note: You'll need to set up a virtual environment and install dependencies.");
|
|
1864
1862
|
console.log("");
|
|
1865
1863
|
}
|
|
1864
|
+
if (!isExistingProject) {
|
|
1865
|
+
initGitRepo(targetPath);
|
|
1866
|
+
}
|
|
1866
1867
|
console.log("\n\u2705 AgentMark Python initialization completed successfully!");
|
|
1867
1868
|
console.log(
|
|
1868
1869
|
`
|
|
@@ -1891,7 +1892,7 @@ var createPythonApp = async (client, targetPath = ".", apiKey = "", deploymentMo
|
|
|
1891
1892
|
console.log(" $ source .venv/bin/activate # On Windows: .venv\\Scripts\\activate");
|
|
1892
1893
|
console.log(' $ pip install -e ".[dev]"');
|
|
1893
1894
|
}
|
|
1894
|
-
console.log(" $ npm run dev\n");
|
|
1895
|
+
console.log(" $ npm run agentmark dev\n");
|
|
1895
1896
|
console.log("\u2500".repeat(70));
|
|
1896
1897
|
console.log("Resources");
|
|
1897
1898
|
console.log("\u2500".repeat(70));
|
|
@@ -2094,7 +2095,7 @@ var main = async () => {
|
|
|
2094
2095
|
});
|
|
2095
2096
|
adapter = response.adapter;
|
|
2096
2097
|
}
|
|
2097
|
-
config.builtInModels = adapter === "claude-agent-sdk" ? ["claude-sonnet-4-20250514"] : ["gpt-4o"];
|
|
2098
|
+
config.builtInModels = adapter === "claude-agent-sdk" ? ["anthropic/claude-sonnet-4-20250514"] : ["openai/gpt-4o"];
|
|
2098
2099
|
const apiKeyName = adapter === "claude-agent-sdk" ? "Anthropic" : "OpenAI";
|
|
2099
2100
|
let apiKey = "";
|
|
2100
2101
|
const { providedApiKey } = await prompts2({
|