@aiagenta2z/agtm 1.0.3 → 1.0.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/README.md CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  ### agtm: Command Line CLI Tool for AI Agent Registry in the Open Source AI Agent Marketplace
2
3
 
3
4
  [GitHub](https://github.com/aiagenta2z/agtm)|[AI Agent Marketplace CLI Doc](https://www.deepnlp.org/doc/ai_agent_marketplace)|[DeepNLP AI Agent Marketplace](https://www.deepnlp.org/store/ai-agent) | [OneKey Agent Router](https://www.deepnlp.org/agent/onekey-mcp-router) | [Agent MCP OneKey Router Ranking](https://www.deepnlp.org/agent/rankings)
@@ -10,7 +11,6 @@ or a github repo URL in a few seconds.
10
11
  To use the command line, you need to first install the package either using python or node environment
11
12
 
12
13
 
13
-
14
14
  #### Install and Use `agtm` CLI
15
15
  Python
16
16
  ``` Python
@@ -44,6 +44,12 @@ Register your AI Agent Marketplace Access Key here (https://deepnlp.org/workspac
44
44
  export AI_AGENT_MARKETPLACE_ACCESS_KEY="{your_access_key}"
45
45
  ```
46
46
 
47
+ You can also use the test key for validation, which is associated with a test-only account on deepnlp.org and aiagenta2z.com.
48
+
49
+ ```
50
+ export AI_AGENT_MARKETPLACE_ACCESS_KEY="TEST_KEY_AI_AGENT_REGISTRY"
51
+ ```
52
+
47
53
  **2. Registry AI Agent from your GitHub**
48
54
 
49
55
  The default registry provider endpoint includes: [DeepNLP AI Agent Registry Endpoint](https://www.deepnlp.org/api/ai_agent_marketplace/registry) |
@@ -65,15 +71,9 @@ agtm upload --github https://github.com/AI-Hub-Admin/My-First-AI-Coding-Agent
65
71
  ## Register from local config of AI Agent meta
66
72
  agtm upload --config ./agent.json
67
73
  agtm upload --config ./agent.yaml
68
-
69
-
70
- ## Submit to your customized endpoint
71
-
72
- agtm upload --config ./agent.yaml --endpoint https://www.example.com
73
74
  ```
74
75
 
75
-
76
- You can download sample [agent.json](https://github.com/aiagenta2z/agtm/agent.json) or [agent.yaml](https://github.com/aiagenta2z/agtm/agent.yaml) file from github https://github.com/aiagenta2z/agtm
76
+ You can download sample [agent.json](https://github.com/aiagenta2z/agtm/blob/main/agent.json) or [agent.yaml](https://github.com/aiagenta2z/agtm/blob/main/agent.yaml) file from github https://github.com/aiagenta2z/agtm
77
77
  See the explanation of the schema, please visit the [documentation](https://www.deepnlp.org/doc/ai_agent_marketplace).
78
78
 
79
79
 
@@ -116,7 +116,91 @@ price_subscription: "Basic: your basic plan introduction, Advanced: Your Advance
116
116
 
117
117
  ```
118
118
 
119
- **4. Search AI Agent Marketplace**
119
+ **4. Use your customized endpoint and schema definition**
120
+
121
+ You have the flexibility to use the AI Agent marketplace/manager cli `agtm` to submit customized ai agent schema to your customized endpoint.
122
+
123
+ You need to define a customized `schema.json` (https://github.com/aiagenta2z/agtm/blob/main/schema.json) file similar to the default one below and your URL of `endpoint`.
124
+ Then the package will POST the the data schema to your endpoint.
125
+
126
+
127
+ Note: the keys in agent.json and schema.json should match. Package will select keys from the agent.json/agent.yaml files.
128
+
129
+
130
+ `schema.json` should have two keys defined the required fields and optional fields you want to submit from the agent.json file.
131
+
132
+ Remember to keep the `access_key` in safe place, the post request will post the `access_key` as well as schema to the endpoint.
133
+
134
+ ## default schema.json definition
135
+ ```
136
+ {
137
+ "required": [
138
+ "name",
139
+ "content"
140
+ ],
141
+ "optional": [
142
+ "website",
143
+ "field",
144
+ "subfield",
145
+ "content_tag_list",
146
+ "github",
147
+ "price_type",
148
+ "api",
149
+ "thumbnail_picture",
150
+ "upload_image_files",
151
+ "sdk",
152
+ "package"
153
+ ]
154
+ }
155
+ ```
156
+
157
+
158
+ Please visit the command line github package [agtm](https://github.com/aiagenta2z/agtm) and [DOC](https://www.deepnlp.org/doc/ai_agent_marketplace) detailed usage.
159
+
160
+
161
+ Use the test account and access
162
+
163
+ ```
164
+ export AI_AGENT_MARKETPLACE_ACCESS_KEY="TEST_KEY_AI_AGENT_REGISTRY"
165
+
166
+ agtm upload --config ./agent.json --endpoint https://www.deepnlp.org/api/ai_agent_marketplace/registry --schema ./schema.json
167
+
168
+ agtm upload --config ./agent.json --endpoint https://www.aiagenta2z.com/api/ai_agent_marketplace/registry --schema ./schema.json
169
+ ```
170
+
171
+
172
+ ```
173
+ Setting Registry Endpoint to URL: https://www.deepnlp.org/api/ai_agent_marketplace/registry
174
+ Customized Schema is enabled : ./schema.json
175
+ Attempting to register agent from config file: ./agent.json
176
+ ✅ Loaded custom schema from: ./schema.json
177
+ Using customized schema {"required": ["name", "content"], "optional": ["website", "field", "subfield", "content_tag_list", "github", "price_type", "api", "thumbnail_picture", "upload_image_files", "sdk", "package"]}
178
+ WARN: Calling AddServiceAPI input param optional keys filled fields ['website', 'field', 'subfield', 'content_tag_list', 'github', 'price_type', 'api', 'thumbnail_picture', 'upload_image_files']|missing_fields []
179
+ Submitting agent information to the marketplace...
180
+
181
+ ✅ Registration Successful!
182
+ URL: https://www.deepnlp.org/store/ai-agent/coding-agent/pub-test-agtm-registry/my-first-ai-coding-agent
183
+ Message: Content Updated Successfully|Visit URL at https://www.deepnlp.org/store/ai-agent/coding-agent/pub-test-agtm-registry/my-first-ai-coding-agent and Login to View the Pending status webpage...
184
+ Track its status at: https://www.deepnlp.org/store/ai-agent/coding-agent/pub-test-agtm-registry/my-first-ai-coding-agent
185
+ ```
186
+
187
+
188
+ Use www.example.com as endpoint example
189
+
190
+
191
+ ```
192
+ agtm upload --config ./agent.json --endpoint https://www.example.com --schema ./schema.json
193
+
194
+ ```
195
+
196
+ It will return an error message showing the endpoint and data, https://www.example.com doesn't have endpoint handling
197
+
198
+ ```
199
+ ❌ Registration Failed. Please check your endpoint https://www.example.com and agent data {'name': 'My First AI Coding Agent', 'content': 'This AI Agent can do complicated programming work for humans', 'website': 'https://www.my_first_agent.com', 'field': 'AI AGENT', 'subfield': 'Coding Agent', 'content_tag_list': 'coding,python', 'github': '', 'thumbnail_picture': 'https://avatars.githubusercontent.com/u/242328252?s=200&v=4', 'upload_image_files': '', 'api': 'https://www.my_first_agent.com/agent', 'price_type': 'FREE', 'price_per_call_credit': 0.0, 'price_fixed_credit': 0.0, 'price_subscription': 'Basic: your basic plan introduction, Advanced: Your Advanced Plan introduction, etc.'}
200
+ ```
201
+
202
+
203
+ **5. Search AI Agent Marketplace**
120
204
 
121
205
  ```
122
206
 
package/agent.json CHANGED
@@ -5,12 +5,13 @@
5
5
  "field": "AI AGENT",
6
6
  "subfield": "Coding Agent",
7
7
  "content_tag_list": "coding,python",
8
- "github": "",
8
+ "github": "https://github.com/AI-Hub-Admin/My-First-AI-Coding-Agent",
9
9
  "thumbnail_picture": "https://avatars.githubusercontent.com/u/242328252?s=200&v=4",
10
10
  "upload_image_files": "",
11
11
  "api": "https://www.my_first_agent.com/agent",
12
12
  "price_type": "PER_CALL",
13
13
  "price_per_call_credit": 0.0,
14
14
  "price_fixed_credit" : 0.0,
15
- "price_subscription": "Basic: your basic plan introduction, Advanced: Your Advanced Plan introduction, etc."
15
+ "price_subscription": "Basic: your basic plan introduction, Advanced: Your Advanced Plan introduction, etc.",
16
+ "new_key_1": "new_value_1"
16
17
  }
package/dist/agtm-cli.js CHANGED
@@ -53,30 +53,72 @@ function loadConfigFile(filePath) {
53
53
  process.exit(1);
54
54
  }
55
55
  }
56
+ /**
57
+ * Fills a dictionary (JavaScript Object) with values from a source object based on
58
+ * a list of required and optional keys.
59
+ */
60
+ function fillItemInfoDict(file_content, required_keys, optional_keys) {
61
+ const item_info = {};
62
+ // 1. Process Required Keys
63
+ if (required_keys && Array.isArray(required_keys)) {
64
+ for (const key of required_keys) {
65
+ if (file_content[key] === undefined || file_content[key] === null) {
66
+ // If a required key is missing or explicitly null/undefined, throw an error.
67
+ throw new Error(`❌ Error: Required key '${key}' is missing or empty in the file content.`);
68
+ }
69
+ // Add the key-value pair to the result dictionary
70
+ item_info[key] = file_content[key];
71
+ }
72
+ }
73
+ // 2. Process Optional Keys
74
+ if (optional_keys && Array.isArray(optional_keys)) {
75
+ for (const key of optional_keys) {
76
+ // Check if the key exists in the file_content AND hasn't already been added as a required key
77
+ // (The second part is mostly for efficiency, but also good practice)
78
+ if (file_content[key] !== undefined && required_keys.indexOf(key) === -1) {
79
+ // Add the optional key-value pair if it exists
80
+ item_info[key] = file_content[key];
81
+ }
82
+ }
83
+ }
84
+ return item_info;
85
+ }
56
86
  // --- Command Handlers ---
87
+ const default_required_keys = ["name", "content"];
88
+ const default_optional_keys = [
89
+ "website", "field", "subfield", "content_tag_list", "github", "price_type",
90
+ "api", "thumbnail_picture", "upload_image_files", "sdk", "package"
91
+ ];
57
92
  /**
58
93
  * Handles the 'agtm upload' command.
59
94
  */
60
95
  async function handleUpload(options) {
61
96
  const access_key = getAccessKey();
62
97
  let item_info = {};
98
+ // 1.0 set endpoint
99
+ const url = options.endpoint || REGISTRY_ENDPOINT;
100
+ // 2.0 schema
101
+ var required_keys = [];
102
+ var optional_keys = [];
103
+ if (options.schema && options.schema != "") {
104
+ const schemaConfig = loadConfigFile(options.schema);
105
+ required_keys = schemaConfig.required;
106
+ optional_keys = schemaConfig.optional;
107
+ }
108
+ else {
109
+ required_keys = default_required_keys;
110
+ optional_keys = default_optional_keys;
111
+ }
63
112
  // set default registry endpoint and then change according to github/other configs
64
- var internal_endpoint = REGISTRY_ENDPOINT;
65
113
  if (options.github) {
66
114
  console.log(`\nAttempting to register agent from GitHub: ${options.github}`);
67
115
  item_info.github = options.github;
68
- internal_endpoint = REGISTRY_ENDPOINT;
69
116
  }
70
117
  else if (options.config) {
71
118
  console.log(`\nAttempting to register agent from config file: ${options.config}`);
72
119
  const file_content = loadConfigFile(options.config);
73
120
  // Basic validation for config upload
74
- if (!file_content.name || !file_content.content) {
75
- console.error("❌ Error: Config file must contain 'name' and 'content' fields.");
76
- process.exit(1);
77
- }
78
- item_info = file_content;
79
- internal_endpoint = REGISTRY_ENDPOINT_v1;
121
+ item_info = fillItemInfoDict(file_content, required_keys, optional_keys);
80
122
  }
81
123
  else {
82
124
  // Should be handled by commander's required option check, but kept as safeguard.
@@ -86,13 +128,13 @@ async function handleUpload(options) {
86
128
  // decide endpoint
87
129
  // if github mode, set to REGISTRY_ENDPOINT, otherwise if config mode set to REGISTRY_ENDPOINT_v1
88
130
  // if endpoint set externally, has higher priority.
89
- const url = options.endpoint || internal_endpoint;
90
131
  // console.log(`DEBUG: options.endpoint ${options.endpoint}`);
91
132
  // console.log(`DEBUG: internal_endpoint ${internal_endpoint}`);
92
133
  // console.log(`DEBUG: final url ${url}`);
93
134
  // Prepare payload (combining item info and access key)
94
135
  const payload = { ...item_info, access_key };
95
136
  console.log(`Submitting agent information to endpoint: ${url}`);
137
+ console.log(`Submitting agent information to payload: ${JSON.stringify(item_info)}`);
96
138
  try {
97
139
  const response = await axios.post(url, payload, {
98
140
  headers: { 'Content-Type': 'application/json' },
@@ -163,16 +205,16 @@ const program = new Command();
163
205
  program
164
206
  .name('agtm')
165
207
  .description('An Open Source Command-line Tool for AI Agents meta registry, AI Agents Marketplace Management, AI Agents Search and AI Agents Index Services. Help users to explore interesting AI Agents. Documentation: https://www.deepnlp.org/doc/ai_agent_marketplace, Marketplace: https://www.deepnlp.org/store/ai-agent')
166
- .version('1.0.0');
208
+ .version('1.0.4');
167
209
  // 1. UPLOAD Command
168
210
  const uploadCommand = program.command('upload')
169
211
  .description('Register or update AI Agent meta information in the marketplace.')
170
212
  .action(handleUpload);
171
213
  // Mutually Exclusive Group (managed with custom logic and checks)
172
214
  uploadCommand.option('--github <url>', 'The GitHub repository URL for the open-sourced agent.');
173
- uploadCommand.option('--config <path>', 'Path to a .json or .yaml file containing the agent\'s meta information.');
174
- // Custom check for the required mutual exclusion
215
+ uploadCommand.option('--config <path>', 'Path to a .json or .yaml, agent.json file containing the agent\'s meta information.');
175
216
  uploadCommand.option('--endpoint <url>', 'The endpoint URL to post data to (overrides default).', "");
217
+ uploadCommand.option('--schema <path>', 'Path to a .json or .yaml, schema.json file containing the agent\'s meta information.', "");
176
218
  uploadCommand.hook('preAction', (thisCommand) => {
177
219
  const options = thisCommand.opts();
178
220
  if (!options.github && !options.config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiagenta2z/agtm",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "agtm: Open Source CLI for AI Agent Marketplace Registration, AI Agents Management, AI Agents Index and Search",
5
5
  "main": "dist/agtm-cli.js",
6
6
  "type": "module",
@@ -14,7 +14,8 @@
14
14
  "dist",
15
15
  "README.md",
16
16
  "agent.json",
17
- "agent.yaml"
17
+ "agent.yaml",
18
+ "schema.json"
18
19
  ],
19
20
  "author": "deepnlp",
20
21
  "license": "ISC",
@@ -31,6 +32,6 @@
31
32
  },
32
33
  "repository": {
33
34
  "type": "git",
34
- "url": ""
35
+ "url": "https://github.com/aiagenta2z/agtm"
35
36
  }
36
37
  }
package/schema.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "required": [
3
+ "name",
4
+ "content"
5
+ ],
6
+ "optional": [
7
+ "website",
8
+ "field",
9
+ "subfield",
10
+ "content_tag_list",
11
+ "github",
12
+ "price_type",
13
+ "api",
14
+ "thumbnail_picture",
15
+ "upload_image_files",
16
+ "sdk",
17
+ "package"
18
+ ]
19
+ }