@agenticmail/enterprise 0.5.4 → 0.5.6

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 (50) hide show
  1. package/dist/chunk-2AHKTK2N.js +819 -0
  2. package/dist/chunk-2ESYSVXG.js +48 -0
  3. package/dist/chunk-6CVIA5YL.js +808 -0
  4. package/dist/chunk-FVXEXRP2.js +12666 -0
  5. package/dist/chunk-OZZ65RAG.js +9040 -0
  6. package/dist/chunk-P2FILRUE.js +591 -0
  7. package/dist/chunk-Q3ZHFVGV.js +48 -0
  8. package/dist/chunk-TCIGK4HQ.js +1943 -0
  9. package/dist/chunk-WI62KTVK.js +3455 -0
  10. package/dist/cidr-O6T7HDUD.js +17 -0
  11. package/dist/cli-build-skill-AE7QC5C5.js +235 -0
  12. package/dist/cli-build-skill-MP6K4ZXO.js +235 -0
  13. package/dist/cli-recover-5M74V7V4.js +97 -0
  14. package/dist/cli-recover-5VWKSBTE.js +97 -0
  15. package/dist/cli-submit-skill-6AAQWZWW.js +162 -0
  16. package/dist/cli-submit-skill-LDFJGSKO.js +162 -0
  17. package/dist/cli-validate-DHESCL7V.js +148 -0
  18. package/dist/cli-validate-QTV6662P.js +148 -0
  19. package/dist/cli-verify-G27G44PM.js +98 -0
  20. package/dist/cli.js +13 -13
  21. package/dist/config-store-YW6BMVSU.js +58 -0
  22. package/dist/db-adapter-WPKXQDEY.js +7 -0
  23. package/dist/domain-lock-XXXJIX7D.js +7 -0
  24. package/dist/dynamodb-33B2BXRN.js +426 -0
  25. package/dist/esm-BZF7GNJD.js +5090 -0
  26. package/dist/factory-X6SKUEDX.js +9 -0
  27. package/dist/firewall-ZGR2AGAP.js +10 -0
  28. package/dist/index.js +35 -35
  29. package/dist/managed-J3QQMQQJ.js +16 -0
  30. package/dist/mongodb-KTICSLUI.js +319 -0
  31. package/dist/mysql-VIFJFM4A.js +574 -0
  32. package/dist/postgres-A67RQTZX.js +575 -0
  33. package/dist/registry/cli.js +1 -1
  34. package/dist/routes-F22OJNEY.js +5674 -0
  35. package/dist/runtime-TCAE7QSD.js +47 -0
  36. package/dist/server-B27VUUU6.js +11 -0
  37. package/dist/setup-HJ4PTUSA.js +20 -0
  38. package/dist/setup-UIQKEGIG.js +20 -0
  39. package/dist/skills-NJKTYIGZ.js +14 -0
  40. package/dist/sqlite-Y6GS6AE3.js +490 -0
  41. package/dist/turso-A7AO3JDH.js +495 -0
  42. package/package.json +1 -1
  43. package/src/cli.ts +13 -13
  44. package/src/domain-lock/cli-recover.ts +4 -4
  45. package/src/domain-lock/cli-verify.ts +3 -3
  46. package/src/engine/cli-build-skill.ts +2 -2
  47. package/src/engine/cli-submit-skill.ts +3 -3
  48. package/src/engine/cli-validate.ts +3 -3
  49. package/src/setup/index.ts +19 -3
  50. package/src/setup/registration.ts +4 -4
@@ -0,0 +1,17 @@
1
+ import {
2
+ compileIpMatcher,
3
+ hostMatchesPattern,
4
+ ipMatchesCidr,
5
+ ipToNumber,
6
+ isValidIpOrCidr,
7
+ parseCidr
8
+ } from "./chunk-DRXMYYKN.js";
9
+ import "./chunk-2ESYSVXG.js";
10
+ export {
11
+ compileIpMatcher,
12
+ hostMatchesPattern,
13
+ ipMatchesCidr,
14
+ ipToNumber,
15
+ isValidIpOrCidr,
16
+ parseCidr
17
+ };
@@ -0,0 +1,235 @@
1
+ import {
2
+ VALID_CATEGORIES,
3
+ VALID_RISK_LEVELS,
4
+ validateSkillManifest
5
+ } from "./chunk-TY7NVD4U.js";
6
+ import "./chunk-KFQGP6VL.js";
7
+
8
+ // src/engine/cli-build-skill.ts
9
+ async function runBuildSkill(_args) {
10
+ const chalk = (await import("chalk")).default;
11
+ const ora = (await import("ora")).default;
12
+ const inquirer = (await import("inquirer")).default;
13
+ const fs = await import("fs/promises");
14
+ const path = await import("path");
15
+ console.log("");
16
+ console.log(chalk.bold("\u{1F6E0}\uFE0F AgenticMail Community Skill Builder"));
17
+ console.log(chalk.dim(" Generate a valid agenticmail-skill.json for any application"));
18
+ console.log("");
19
+ const answers = await inquirer.prompt([
20
+ {
21
+ type: "input",
22
+ name: "application",
23
+ message: "What application or service should this skill integrate with?",
24
+ validate: (v) => v.trim().length > 0 || "Application name is required"
25
+ },
26
+ {
27
+ type: "input",
28
+ name: "operations",
29
+ message: "What operations should it support? (comma-separated)",
30
+ default: "read, create, update, delete, list"
31
+ },
32
+ {
33
+ type: "list",
34
+ name: "category",
35
+ message: "Category:",
36
+ choices: [...VALID_CATEGORIES],
37
+ default: "productivity"
38
+ },
39
+ {
40
+ type: "list",
41
+ name: "risk",
42
+ message: "Risk level:",
43
+ choices: [...VALID_RISK_LEVELS],
44
+ default: "medium"
45
+ },
46
+ {
47
+ type: "input",
48
+ name: "author",
49
+ message: "Your GitHub username:",
50
+ validate: (v) => /^[a-zA-Z0-9_-]+$/.test(v.trim()) || "Must be a valid GitHub username"
51
+ },
52
+ {
53
+ type: "input",
54
+ name: "outputDir",
55
+ message: "Output directory:",
56
+ default: (a) => `./community-skills/${a.application.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "")}`
57
+ }
58
+ ]);
59
+ const appSlug = answers.application.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
60
+ const toolPrefix = appSlug.replace(/-/g, "_");
61
+ const operations = answers.operations.split(",").map((s) => s.trim()).filter(Boolean);
62
+ let manifest = null;
63
+ const spinner = ora("Generating skill manifest...").start();
64
+ try {
65
+ const res = await fetch("http://localhost:3000/health", { signal: AbortSignal.timeout(2e3) });
66
+ if (res.ok) {
67
+ spinner.text = "Agent runtime detected \u2014 using AI to generate manifest...";
68
+ const aiRes = await fetch("http://localhost:3000/api/chat", {
69
+ method: "POST",
70
+ headers: { "Content-Type": "application/json" },
71
+ body: JSON.stringify({
72
+ message: buildAIPrompt(answers.application, operations, answers.category, answers.risk, answers.author, appSlug, toolPrefix),
73
+ system: "You are a skill manifest generator. Respond with ONLY valid JSON, no markdown, no explanation."
74
+ }),
75
+ signal: AbortSignal.timeout(3e4)
76
+ });
77
+ if (aiRes.ok) {
78
+ const aiData = await aiRes.json();
79
+ const content = aiData.response || aiData.message || "";
80
+ const jsonMatch = content.match(/\{[\s\S]*\}/);
81
+ if (jsonMatch) {
82
+ manifest = JSON.parse(jsonMatch[0]);
83
+ }
84
+ }
85
+ }
86
+ } catch {
87
+ }
88
+ if (!manifest) {
89
+ spinner.text = "Generating from template...";
90
+ manifest = generateFromTemplate(answers.application, operations, answers.category, answers.risk, answers.author, appSlug, toolPrefix);
91
+ }
92
+ spinner.succeed("Manifest generated");
93
+ const validation = validateSkillManifest(manifest);
94
+ if (!validation.valid) {
95
+ console.log(chalk.yellow("\n Validation warnings (auto-fixing)..."));
96
+ if (!manifest.category) manifest.category = answers.category;
97
+ if (!manifest.risk) manifest.risk = answers.risk;
98
+ if (!manifest.license) manifest.license = "MIT";
99
+ if (!manifest.description || manifest.description.length < 20) {
100
+ manifest.description = `Integrates with ${answers.application} to ${operations.slice(0, 3).join(", ")} and more.`;
101
+ }
102
+ }
103
+ const outDir = path.resolve(answers.outputDir);
104
+ await fs.mkdir(outDir, { recursive: true });
105
+ const manifestPath = path.join(outDir, "agenticmail-skill.json");
106
+ await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2) + "\n");
107
+ console.log(chalk.green(" \u2714") + ` Written: ${manifestPath}`);
108
+ const readmePath = path.join(outDir, "README.md");
109
+ await fs.writeFile(readmePath, generateReadme(manifest));
110
+ console.log(chalk.green(" \u2714") + ` Written: ${readmePath}`);
111
+ const finalCheck = validateSkillManifest(manifest);
112
+ if (finalCheck.valid) {
113
+ console.log(chalk.green("\n \u2714 Manifest is valid!"));
114
+ } else {
115
+ console.log(chalk.yellow("\n \u26A0 Manifest has issues:"));
116
+ for (const err of finalCheck.errors) console.log(chalk.red(" " + err));
117
+ }
118
+ for (const warn of finalCheck.warnings) console.log(chalk.yellow(" \u26A0 " + warn));
119
+ console.log("");
120
+ const { submit } = await inquirer.prompt([{
121
+ type: "confirm",
122
+ name: "submit",
123
+ message: "Submit this skill as a PR to agenticmail/enterprise?",
124
+ default: false
125
+ }]);
126
+ if (submit) {
127
+ const { runSubmitSkill } = await import("./cli-submit-skill-LDFJGSKO.js");
128
+ await runSubmitSkill([outDir]);
129
+ } else {
130
+ console.log(chalk.dim("\n To submit later: npx @agenticmail/enterprise submit-skill " + answers.outputDir));
131
+ }
132
+ }
133
+ function generateFromTemplate(app, operations, category, risk, author, slug, prefix) {
134
+ const tools = operations.map((op) => {
135
+ const opSlug = op.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_|_$/g, "");
136
+ const isRead = ["read", "get", "list", "search", "fetch", "view", "query"].some((r) => opSlug.includes(r));
137
+ const isDelete = ["delete", "remove", "destroy"].some((r) => opSlug.includes(r));
138
+ const toolCategory = isDelete ? "destroy" : isRead ? "read" : "write";
139
+ const toolRisk = isDelete ? "high" : isRead ? "low" : "medium";
140
+ const sideEffects = [];
141
+ if (!isRead) sideEffects.push("network-request");
142
+ if (isDelete) sideEffects.push("deletes-data");
143
+ return {
144
+ id: `${prefix}_${opSlug}`,
145
+ name: op.charAt(0).toUpperCase() + op.slice(1),
146
+ description: `${op.charAt(0).toUpperCase() + op.slice(1)} in ${app}`,
147
+ category: toolCategory,
148
+ riskLevel: toolRisk,
149
+ sideEffects,
150
+ parameters: {}
151
+ };
152
+ });
153
+ return {
154
+ id: slug,
155
+ name: app,
156
+ description: `Integrates with ${app} to ${operations.slice(0, 3).join(", ")}${operations.length > 3 ? " and more" : ""}. Community-contributed skill for AgenticMail agents.`,
157
+ version: "1.0.0",
158
+ author,
159
+ repository: `https://github.com/${author}/${slug}`,
160
+ license: "MIT",
161
+ category,
162
+ risk,
163
+ tags: [slug, category],
164
+ tools,
165
+ configSchema: {
166
+ apiKey: { type: "secret", label: "API Key", description: `Your ${app} API key`, required: true }
167
+ },
168
+ minEngineVersion: "0.3.0",
169
+ homepage: `https://github.com/${author}/${slug}`
170
+ };
171
+ }
172
+ function buildAIPrompt(app, operations, category, risk, author, slug, prefix) {
173
+ return `Generate a valid agenticmail-skill.json manifest for "${app}".
174
+
175
+ Requirements:
176
+ - id: "${slug}"
177
+ - name: "${app}"
178
+ - Operations: ${operations.join(", ")}
179
+ - category: "${category}"
180
+ - risk: "${risk}"
181
+ - author: "${author}"
182
+ - repository: "https://github.com/${author}/${slug}"
183
+ - license: "MIT"
184
+ - Each tool needs: id (${prefix}_<action>), name, description, category (read/write/execute/communicate/destroy), riskLevel (low/medium/high/critical), sideEffects array
185
+ - Valid sideEffects: sends-email, sends-message, sends-sms, posts-social, runs-code, modifies-files, deletes-data, network-request, controls-device, accesses-secrets, financial
186
+ - Include a configSchema with any API keys or settings needed
187
+ - version: "1.0.0"
188
+ - minEngineVersion: "0.3.0"
189
+ - description must be 20-500 chars
190
+
191
+ Output ONLY the JSON object, no explanation.`;
192
+ }
193
+ function generateReadme(manifest) {
194
+ const tools = (manifest.tools || []).map(
195
+ (t) => `| \`${t.id}\` | ${t.name} | ${t.description} | ${t.riskLevel || "medium"} |`
196
+ ).join("\n");
197
+ return `# ${manifest.name}
198
+
199
+ ${manifest.description}
200
+
201
+ ## Tools
202
+
203
+ | ID | Name | Description | Risk |
204
+ |----|------|-------------|------|
205
+ ${tools}
206
+
207
+ ## Configuration
208
+
209
+ ${manifest.configSchema ? Object.entries(manifest.configSchema).map(
210
+ ([k, v]) => `- **${k}** (${v.type || "string"}): ${v.description || k}${v.required ? " *(required)*" : ""}`
211
+ ).join("\n") : "No configuration required."}
212
+
213
+ ## Installation
214
+
215
+ Install this skill from the AgenticMail Enterprise dashboard:
216
+
217
+ 1. Go to **Community Skills** in the sidebar
218
+ 2. Search for "${manifest.name}"
219
+ 3. Click **Install**
220
+
221
+ Or via the API:
222
+ \`\`\`bash
223
+ curl -X POST /api/engine/community/skills/${manifest.id}/install \\
224
+ -H "Content-Type: application/json" \\
225
+ -d '{"orgId": "your-org-id"}'
226
+ \`\`\`
227
+
228
+ ## License
229
+
230
+ ${manifest.license || "MIT"}
231
+ `;
232
+ }
233
+ export {
234
+ runBuildSkill
235
+ };
@@ -0,0 +1,235 @@
1
+ import {
2
+ VALID_CATEGORIES,
3
+ VALID_RISK_LEVELS,
4
+ validateSkillManifest
5
+ } from "./chunk-TY7NVD4U.js";
6
+ import "./chunk-2ESYSVXG.js";
7
+
8
+ // src/engine/cli-build-skill.ts
9
+ async function runBuildSkill(_args) {
10
+ const chalk = (await import("chalk")).default;
11
+ const ora = (await import("ora")).default;
12
+ const inquirer = (await import("inquirer")).default;
13
+ const fs = await import("fs/promises");
14
+ const path = await import("path");
15
+ console.log("");
16
+ console.log(chalk.bold("\u{1F6E0}\uFE0F AgenticMail Community Skill Builder"));
17
+ console.log(chalk.dim(" Generate a valid agenticmail-skill.json for any application"));
18
+ console.log("");
19
+ const answers = await inquirer.prompt([
20
+ {
21
+ type: "input",
22
+ name: "application",
23
+ message: "What application or service should this skill integrate with?",
24
+ validate: (v) => v.trim().length > 0 || "Application name is required"
25
+ },
26
+ {
27
+ type: "input",
28
+ name: "operations",
29
+ message: "What operations should it support? (comma-separated)",
30
+ default: "read, create, update, delete, list"
31
+ },
32
+ {
33
+ type: "list",
34
+ name: "category",
35
+ message: "Category:",
36
+ choices: [...VALID_CATEGORIES],
37
+ default: "productivity"
38
+ },
39
+ {
40
+ type: "list",
41
+ name: "risk",
42
+ message: "Risk level:",
43
+ choices: [...VALID_RISK_LEVELS],
44
+ default: "medium"
45
+ },
46
+ {
47
+ type: "input",
48
+ name: "author",
49
+ message: "Your GitHub username:",
50
+ validate: (v) => /^[a-zA-Z0-9_-]+$/.test(v.trim()) || "Must be a valid GitHub username"
51
+ },
52
+ {
53
+ type: "input",
54
+ name: "outputDir",
55
+ message: "Output directory:",
56
+ default: (a) => `./community-skills/${a.application.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "")}`
57
+ }
58
+ ]);
59
+ const appSlug = answers.application.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
60
+ const toolPrefix = appSlug.replace(/-/g, "_");
61
+ const operations = answers.operations.split(",").map((s) => s.trim()).filter(Boolean);
62
+ let manifest = null;
63
+ const spinner = ora("Generating skill manifest...").start();
64
+ try {
65
+ const res = await fetch("http://localhost:3000/health", { signal: AbortSignal.timeout(2e3) });
66
+ if (res.ok) {
67
+ spinner.text = "Agent runtime detected \u2014 using AI to generate manifest...";
68
+ const aiRes = await fetch("http://localhost:3000/api/chat", {
69
+ method: "POST",
70
+ headers: { "Content-Type": "application/json" },
71
+ body: JSON.stringify({
72
+ message: buildAIPrompt(answers.application, operations, answers.category, answers.risk, answers.author, appSlug, toolPrefix),
73
+ system: "You are a skill manifest generator. Respond with ONLY valid JSON, no markdown, no explanation."
74
+ }),
75
+ signal: AbortSignal.timeout(3e4)
76
+ });
77
+ if (aiRes.ok) {
78
+ const aiData = await aiRes.json();
79
+ const content = aiData.response || aiData.message || "";
80
+ const jsonMatch = content.match(/\{[\s\S]*\}/);
81
+ if (jsonMatch) {
82
+ manifest = JSON.parse(jsonMatch[0]);
83
+ }
84
+ }
85
+ }
86
+ } catch {
87
+ }
88
+ if (!manifest) {
89
+ spinner.text = "Generating from template...";
90
+ manifest = generateFromTemplate(answers.application, operations, answers.category, answers.risk, answers.author, appSlug, toolPrefix);
91
+ }
92
+ spinner.succeed("Manifest generated");
93
+ const validation = validateSkillManifest(manifest);
94
+ if (!validation.valid) {
95
+ console.log(chalk.yellow("\n Validation warnings (auto-fixing)..."));
96
+ if (!manifest.category) manifest.category = answers.category;
97
+ if (!manifest.risk) manifest.risk = answers.risk;
98
+ if (!manifest.license) manifest.license = "MIT";
99
+ if (!manifest.description || manifest.description.length < 20) {
100
+ manifest.description = `Integrates with ${answers.application} to ${operations.slice(0, 3).join(", ")} and more.`;
101
+ }
102
+ }
103
+ const outDir = path.resolve(answers.outputDir);
104
+ await fs.mkdir(outDir, { recursive: true });
105
+ const manifestPath = path.join(outDir, "agenticmail-skill.json");
106
+ await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2) + "\n");
107
+ console.log(chalk.green(" \u2714") + ` Written: ${manifestPath}`);
108
+ const readmePath = path.join(outDir, "README.md");
109
+ await fs.writeFile(readmePath, generateReadme(manifest));
110
+ console.log(chalk.green(" \u2714") + ` Written: ${readmePath}`);
111
+ const finalCheck = validateSkillManifest(manifest);
112
+ if (finalCheck.valid) {
113
+ console.log(chalk.green("\n \u2714 Manifest is valid!"));
114
+ } else {
115
+ console.log(chalk.yellow("\n \u26A0 Manifest has issues:"));
116
+ for (const err of finalCheck.errors) console.log(chalk.red(" " + err));
117
+ }
118
+ for (const warn of finalCheck.warnings) console.log(chalk.yellow(" \u26A0 " + warn));
119
+ console.log("");
120
+ const { submit } = await inquirer.prompt([{
121
+ type: "confirm",
122
+ name: "submit",
123
+ message: "Submit this skill as a PR to agenticmail/enterprise?",
124
+ default: false
125
+ }]);
126
+ if (submit) {
127
+ const { runSubmitSkill } = await import("./cli-submit-skill-6AAQWZWW.js");
128
+ await runSubmitSkill([outDir]);
129
+ } else {
130
+ console.log(chalk.dim("\n To submit later: npx @agenticmail/enterprise submit-skill " + answers.outputDir));
131
+ }
132
+ }
133
+ function generateFromTemplate(app, operations, category, risk, author, slug, prefix) {
134
+ const tools = operations.map((op) => {
135
+ const opSlug = op.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_|_$/g, "");
136
+ const isRead = ["read", "get", "list", "search", "fetch", "view", "query"].some((r) => opSlug.includes(r));
137
+ const isDelete = ["delete", "remove", "destroy"].some((r) => opSlug.includes(r));
138
+ const toolCategory = isDelete ? "destroy" : isRead ? "read" : "write";
139
+ const toolRisk = isDelete ? "high" : isRead ? "low" : "medium";
140
+ const sideEffects = [];
141
+ if (!isRead) sideEffects.push("network-request");
142
+ if (isDelete) sideEffects.push("deletes-data");
143
+ return {
144
+ id: `${prefix}_${opSlug}`,
145
+ name: op.charAt(0).toUpperCase() + op.slice(1),
146
+ description: `${op.charAt(0).toUpperCase() + op.slice(1)} in ${app}`,
147
+ category: toolCategory,
148
+ riskLevel: toolRisk,
149
+ sideEffects,
150
+ parameters: {}
151
+ };
152
+ });
153
+ return {
154
+ id: slug,
155
+ name: app,
156
+ description: `Integrates with ${app} to ${operations.slice(0, 3).join(", ")}${operations.length > 3 ? " and more" : ""}. Community-contributed skill for AgenticMail agents.`,
157
+ version: "1.0.0",
158
+ author,
159
+ repository: `https://github.com/${author}/${slug}`,
160
+ license: "MIT",
161
+ category,
162
+ risk,
163
+ tags: [slug, category],
164
+ tools,
165
+ configSchema: {
166
+ apiKey: { type: "secret", label: "API Key", description: `Your ${app} API key`, required: true }
167
+ },
168
+ minEngineVersion: "0.3.0",
169
+ homepage: `https://github.com/${author}/${slug}`
170
+ };
171
+ }
172
+ function buildAIPrompt(app, operations, category, risk, author, slug, prefix) {
173
+ return `Generate a valid agenticmail-skill.json manifest for "${app}".
174
+
175
+ Requirements:
176
+ - id: "${slug}"
177
+ - name: "${app}"
178
+ - Operations: ${operations.join(", ")}
179
+ - category: "${category}"
180
+ - risk: "${risk}"
181
+ - author: "${author}"
182
+ - repository: "https://github.com/${author}/${slug}"
183
+ - license: "MIT"
184
+ - Each tool needs: id (${prefix}_<action>), name, description, category (read/write/execute/communicate/destroy), riskLevel (low/medium/high/critical), sideEffects array
185
+ - Valid sideEffects: sends-email, sends-message, sends-sms, posts-social, runs-code, modifies-files, deletes-data, network-request, controls-device, accesses-secrets, financial
186
+ - Include a configSchema with any API keys or settings needed
187
+ - version: "1.0.0"
188
+ - minEngineVersion: "0.3.0"
189
+ - description must be 20-500 chars
190
+
191
+ Output ONLY the JSON object, no explanation.`;
192
+ }
193
+ function generateReadme(manifest) {
194
+ const tools = (manifest.tools || []).map(
195
+ (t) => `| \`${t.id}\` | ${t.name} | ${t.description} | ${t.riskLevel || "medium"} |`
196
+ ).join("\n");
197
+ return `# ${manifest.name}
198
+
199
+ ${manifest.description}
200
+
201
+ ## Tools
202
+
203
+ | ID | Name | Description | Risk |
204
+ |----|------|-------------|------|
205
+ ${tools}
206
+
207
+ ## Configuration
208
+
209
+ ${manifest.configSchema ? Object.entries(manifest.configSchema).map(
210
+ ([k, v]) => `- **${k}** (${v.type || "string"}): ${v.description || k}${v.required ? " *(required)*" : ""}`
211
+ ).join("\n") : "No configuration required."}
212
+
213
+ ## Installation
214
+
215
+ Install this skill from the AgenticMail Enterprise dashboard:
216
+
217
+ 1. Go to **Community Skills** in the sidebar
218
+ 2. Search for "${manifest.name}"
219
+ 3. Click **Install**
220
+
221
+ Or via the API:
222
+ \`\`\`bash
223
+ curl -X POST /api/engine/community/skills/${manifest.id}/install \\
224
+ -H "Content-Type: application/json" \\
225
+ -d '{"orgId": "your-org-id"}'
226
+ \`\`\`
227
+
228
+ ## License
229
+
230
+ ${manifest.license || "MIT"}
231
+ `;
232
+ }
233
+ export {
234
+ runBuildSkill
235
+ };
@@ -0,0 +1,97 @@
1
+ import {
2
+ DomainLock
3
+ } from "./chunk-UPU23ZRG.js";
4
+ import "./chunk-KFQGP6VL.js";
5
+
6
+ // src/domain-lock/cli-recover.ts
7
+ function getFlag(args, name) {
8
+ const idx = args.indexOf(name);
9
+ if (idx !== -1 && args[idx + 1]) return args[idx + 1];
10
+ return void 0;
11
+ }
12
+ async function runRecover(args) {
13
+ const { default: inquirer } = await import("inquirer");
14
+ const { default: chalk } = await import("chalk");
15
+ const { default: ora } = await import("ora");
16
+ console.log("");
17
+ console.log(chalk.bold(" AgenticMail Enterprise \u2014 Domain Recovery"));
18
+ console.log(chalk.dim(" Recover your domain registration on a new machine."));
19
+ console.log("");
20
+ let domain = getFlag(args, "--domain");
21
+ if (!domain) {
22
+ const answer = await inquirer.prompt([{
23
+ type: "input",
24
+ name: "domain",
25
+ message: "Domain to recover:",
26
+ suffix: chalk.dim(" (e.g. agents.agenticmail.io)"),
27
+ validate: (v) => v.includes(".") || "Enter a valid domain"
28
+ }]);
29
+ domain = answer.domain;
30
+ }
31
+ let key = getFlag(args, "--key");
32
+ if (!key) {
33
+ const answer = await inquirer.prompt([{
34
+ type: "password",
35
+ name: "key",
36
+ message: "Deployment key:",
37
+ mask: "*",
38
+ validate: (v) => {
39
+ if (v.length !== 64) return "Deployment key should be 64 hex characters";
40
+ if (!/^[0-9a-fA-F]+$/.test(v)) return "Deployment key should be hexadecimal";
41
+ return true;
42
+ }
43
+ }]);
44
+ key = answer.key;
45
+ }
46
+ const spinner = ora("Contacting AgenticMail registry...").start();
47
+ const lock = new DomainLock();
48
+ const result = await lock.recover(domain, key);
49
+ if (!result.success) {
50
+ spinner.fail("Recovery failed");
51
+ console.log("");
52
+ console.error(chalk.red(` ${result.error}`));
53
+ console.log("");
54
+ process.exit(1);
55
+ }
56
+ spinner.succeed("Domain recovery initiated");
57
+ const { default: bcrypt } = await import("bcryptjs");
58
+ const keyHash = await bcrypt.hash(key, 12);
59
+ const dbPath = getFlag(args, "--db");
60
+ const dbType = getFlag(args, "--db-type") || "sqlite";
61
+ if (dbPath) {
62
+ try {
63
+ const spinnerDb = ora("Saving to local database...").start();
64
+ const { createAdapter } = await import("./factory-FVJH5RRY.js");
65
+ const db = await createAdapter({ type: dbType, connectionString: dbPath });
66
+ await db.migrate();
67
+ await db.updateSettings({
68
+ domain,
69
+ deploymentKeyHash: keyHash,
70
+ domainRegistrationId: result.registrationId,
71
+ domainDnsChallenge: result.dnsChallenge,
72
+ domainRegisteredAt: (/* @__PURE__ */ new Date()).toISOString(),
73
+ domainStatus: "pending_dns"
74
+ });
75
+ spinnerDb.succeed("Local database updated");
76
+ await db.disconnect();
77
+ } catch (err) {
78
+ console.log(chalk.yellow(`
79
+ Could not update local DB: ${err.message}`));
80
+ console.log(chalk.dim(" You can manually update settings after setup."));
81
+ }
82
+ }
83
+ console.log("");
84
+ console.log(chalk.green.bold(" Domain recovery successful!"));
85
+ console.log("");
86
+ console.log(chalk.bold(" Update your DNS TXT record:"));
87
+ console.log("");
88
+ console.log(` ${chalk.bold("Host:")} ${chalk.cyan(`_agenticmail-verify.${domain}`)}`);
89
+ console.log(` ${chalk.bold("Type:")} ${chalk.cyan("TXT")}`);
90
+ console.log(` ${chalk.bold("Value:")} ${chalk.cyan(result.dnsChallenge)}`);
91
+ console.log("");
92
+ console.log(chalk.dim(" Then run: npx @agenticmail/enterprise verify-domain"));
93
+ console.log("");
94
+ }
95
+ export {
96
+ runRecover
97
+ };
@@ -0,0 +1,97 @@
1
+ import {
2
+ DomainLock
3
+ } from "./chunk-UPU23ZRG.js";
4
+ import "./chunk-2ESYSVXG.js";
5
+
6
+ // src/domain-lock/cli-recover.ts
7
+ function getFlag(args, name) {
8
+ const idx = args.indexOf(name);
9
+ if (idx !== -1 && args[idx + 1]) return args[idx + 1];
10
+ return void 0;
11
+ }
12
+ async function runRecover(args) {
13
+ const { default: inquirer } = await import("inquirer");
14
+ const { default: chalk } = await import("chalk");
15
+ const { default: ora } = await import("ora");
16
+ console.log("");
17
+ console.log(chalk.bold(" AgenticMail Enterprise \u2014 Domain Recovery"));
18
+ console.log(chalk.dim(" Recover your domain registration on a new machine."));
19
+ console.log("");
20
+ let domain = getFlag(args, "--domain");
21
+ if (!domain) {
22
+ const answer = await inquirer.prompt([{
23
+ type: "input",
24
+ name: "domain",
25
+ message: "Domain to recover:",
26
+ suffix: chalk.dim(" (e.g. agents.agenticmail.io)"),
27
+ validate: (v) => v.includes(".") || "Enter a valid domain"
28
+ }]);
29
+ domain = answer.domain;
30
+ }
31
+ let key = getFlag(args, "--key");
32
+ if (!key) {
33
+ const answer = await inquirer.prompt([{
34
+ type: "password",
35
+ name: "key",
36
+ message: "Deployment key:",
37
+ mask: "*",
38
+ validate: (v) => {
39
+ if (v.length !== 64) return "Deployment key should be 64 hex characters";
40
+ if (!/^[0-9a-fA-F]+$/.test(v)) return "Deployment key should be hexadecimal";
41
+ return true;
42
+ }
43
+ }]);
44
+ key = answer.key;
45
+ }
46
+ const spinner = ora("Contacting AgenticMail registry...").start();
47
+ const lock = new DomainLock();
48
+ const result = await lock.recover(domain, key);
49
+ if (!result.success) {
50
+ spinner.fail("Recovery failed");
51
+ console.log("");
52
+ console.error(chalk.red(` ${result.error}`));
53
+ console.log("");
54
+ process.exit(1);
55
+ }
56
+ spinner.succeed("Domain recovery initiated");
57
+ const { default: bcrypt } = await import("bcryptjs");
58
+ const keyHash = await bcrypt.hash(key, 12);
59
+ const dbPath = getFlag(args, "--db");
60
+ const dbType = getFlag(args, "--db-type") || "sqlite";
61
+ if (dbPath) {
62
+ try {
63
+ const spinnerDb = ora("Saving to local database...").start();
64
+ const { createAdapter } = await import("./factory-X6SKUEDX.js");
65
+ const db = await createAdapter({ type: dbType, connectionString: dbPath });
66
+ await db.migrate();
67
+ await db.updateSettings({
68
+ domain,
69
+ deploymentKeyHash: keyHash,
70
+ domainRegistrationId: result.registrationId,
71
+ domainDnsChallenge: result.dnsChallenge,
72
+ domainRegisteredAt: (/* @__PURE__ */ new Date()).toISOString(),
73
+ domainStatus: "pending_dns"
74
+ });
75
+ spinnerDb.succeed("Local database updated");
76
+ await db.disconnect();
77
+ } catch (err) {
78
+ console.log(chalk.yellow(`
79
+ Could not update local DB: ${err.message}`));
80
+ console.log(chalk.dim(" You can manually update settings after setup."));
81
+ }
82
+ }
83
+ console.log("");
84
+ console.log(chalk.green.bold(" Domain recovery successful!"));
85
+ console.log("");
86
+ console.log(chalk.bold(" Update your DNS TXT record:"));
87
+ console.log("");
88
+ console.log(` ${chalk.bold("Host:")} ${chalk.cyan(`_agenticmail-verify.${domain}`)}`);
89
+ console.log(` ${chalk.bold("Type:")} ${chalk.cyan("TXT")}`);
90
+ console.log(` ${chalk.bold("Value:")} ${chalk.cyan(result.dnsChallenge)}`);
91
+ console.log("");
92
+ console.log(chalk.dim(" Then run: npx @agenticmail/enterprise verify-domain"));
93
+ console.log("");
94
+ }
95
+ export {
96
+ runRecover
97
+ };