@daileyos/mcp-server 1.19.0 → 1.20.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 +13 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/addons.d.ts +3 -0
- package/dist/tools/addons.d.ts.map +1 -0
- package/dist/tools/addons.js +69 -0
- package/dist/tools/addons.js.map +1 -0
- package/dist/tools/credits.d.ts +3 -0
- package/dist/tools/credits.d.ts.map +1 -0
- package/dist/tools/credits.js +57 -0
- package/dist/tools/credits.js.map +1 -0
- package/dist/tools/dailey-images.d.ts +14 -0
- package/dist/tools/dailey-images.d.ts.map +1 -0
- package/dist/tools/dailey-images.js +87 -0
- package/dist/tools/dailey-images.js.map +1 -0
- package/dist/tools/email.d.ts +3 -0
- package/dist/tools/email.d.ts.map +1 -0
- package/dist/tools/email.js +61 -0
- package/dist/tools/email.js.map +1 -0
- package/dist/tools/environments.d.ts +3 -0
- package/dist/tools/environments.d.ts.map +1 -0
- package/dist/tools/environments.js +75 -0
- package/dist/tools/environments.js.map +1 -0
- package/dist/tools/wordpress-snapshot.d.ts +3 -0
- package/dist/tools/wordpress-snapshot.d.ts.map +1 -0
- package/dist/tools/wordpress-snapshot.js +121 -0
- package/dist/tools/wordpress-snapshot.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +13 -0
- package/src/tools/addons.ts +124 -0
- package/src/tools/credits.ts +97 -0
- package/src/tools/dailey-images.ts +151 -0
- package/src/tools/email.ts +101 -0
- package/src/tools/environments.ts +138 -0
- package/src/tools/wordpress-snapshot.ts +221 -0
- package/tests/dailey-images.test.mjs +156 -0
- package/tests/environments.test.mjs +230 -0
- package/tests/wp-snapshot.test.mjs +261 -0
package/dist/index.js
CHANGED
|
@@ -21,11 +21,17 @@ import { registerBillingTools } from './tools/billing.js';
|
|
|
21
21
|
import { registerPlatformTools } from './tools/platform.js';
|
|
22
22
|
import { registerStorageTools } from './tools/storage.js';
|
|
23
23
|
import { registerAiTools } from './tools/ai.js';
|
|
24
|
+
import { registerEmailTools } from './tools/email.js';
|
|
25
|
+
import { registerCreditTools } from './tools/credits.js';
|
|
26
|
+
import { registerAddonTools } from './tools/addons.js';
|
|
27
|
+
import { registerDaileyImagesTools } from './tools/dailey-images.js';
|
|
24
28
|
import { registerImageTools } from './tools/images.js';
|
|
25
29
|
import { registerProcessTools } from './tools/processes.js';
|
|
26
30
|
import { registerLifecycleTools } from './tools/lifecycle.js';
|
|
27
31
|
import { registerBackupTools } from './tools/backups.js';
|
|
28
32
|
import { registerWordPressMigrateTools } from './tools/wordpress-migrate.js';
|
|
33
|
+
import { registerWordPressSnapshotTools } from './tools/wordpress-snapshot.js';
|
|
34
|
+
import { registerEnvironmentTools } from './tools/environments.js';
|
|
29
35
|
import { registerResourceConfigTools } from './tools/resource-config.js';
|
|
30
36
|
import { registerLinkTools } from './tools/links.js';
|
|
31
37
|
import { registerCredentialRevealTools } from './tools/credentials-reveal.js';
|
|
@@ -100,6 +106,9 @@ registerAccountTools(server);
|
|
|
100
106
|
registerPlatformTools(server);
|
|
101
107
|
registerUsageTools(server);
|
|
102
108
|
registerBillingTools(server);
|
|
109
|
+
// À-la-carte billing surfaces — prepaid credits + capacity add-ons.
|
|
110
|
+
registerCreditTools(server);
|
|
111
|
+
registerAddonTools(server);
|
|
103
112
|
// Projects + deploys
|
|
104
113
|
registerProjectTools(server);
|
|
105
114
|
registerAnalyzeTools(server);
|
|
@@ -122,8 +131,12 @@ registerDbTools(server);
|
|
|
122
131
|
registerMigrateTools(server);
|
|
123
132
|
registerStorageTools(server);
|
|
124
133
|
registerAiTools(server);
|
|
134
|
+
registerEmailTools(server);
|
|
135
|
+
registerDaileyImagesTools(server);
|
|
125
136
|
registerBackupTools(server);
|
|
126
137
|
registerWordPressMigrateTools(server);
|
|
138
|
+
registerWordPressSnapshotTools(server);
|
|
139
|
+
registerEnvironmentTools(server);
|
|
127
140
|
// Runtime operations — exec into a pod, run one-off jobs
|
|
128
141
|
registerExecRunTools(server);
|
|
129
142
|
// Admin-only — customer onboarding, project transfer
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,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M,CAAC,CAAC;AAEtC,OAAO;AACP,eAAe,CAAC,MAAM,CAAC,CAAC;AACxB,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC7B,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC7B,eAAe,CAAC,MAAM,CAAC,CAAC;AACxB,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC3B,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAClC,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAC5B,6BAA6B,CAAC,MAAM,CAAC,CAAC;AACtC,8BAA8B,CAAC,MAAM,CAAC,CAAC;AACvC,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAEjC,yDAAyD;AACzD,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAE7B,qDAAqD;AACrD,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC3B,4BAA4B,CAAC,MAAM,CAAC,CAAC;AAErC,aAAa;AACb,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,uBAAuB;AACvB,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAE5B,2EAA2E;AAC3E,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAE9B,uCAAuC;AACvC,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAE7B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addons.d.ts","sourceRoot":"","sources":["../../src/tools/addons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA0CpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QAiFnD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
export function registerAddonTools(server) {
|
|
4
|
+
server.tool('dailey_addons', 'List à-la-carte capacity add-ons: the account\'s ACTIVE add-ons (with monthly cost) plus the AVAILABLE catalog (extra_vcpu, extra_ram, extra_db_storage, extra_object_storage, db_replica, app_ha, email_pro, ...) and per-unit pricing. Purchase with dailey_addon_purchase; cancel with dailey_addon_cancel.', {}, async () => {
|
|
5
|
+
const [activeRes, catalogRes] = await Promise.all([
|
|
6
|
+
apiRequest('GET', '/billing/addons'),
|
|
7
|
+
apiRequest('GET', '/billing/addons/catalog'),
|
|
8
|
+
]);
|
|
9
|
+
if (!activeRes.ok)
|
|
10
|
+
return textResult(formatError(activeRes));
|
|
11
|
+
const lines = ['Active add-ons:'];
|
|
12
|
+
const active = activeRes.data.addons || [];
|
|
13
|
+
if (active.length === 0) {
|
|
14
|
+
lines.push(' (none)');
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
for (const a of active) {
|
|
18
|
+
lines.push(` ${a.id} ${a.addon_type} x${a.quantity} $${a.monthly_cost ?? 0}/mo [${a.status}]`);
|
|
19
|
+
}
|
|
20
|
+
lines.push(` Total: $${activeRes.data.total_monthly ?? 0}/mo`);
|
|
21
|
+
}
|
|
22
|
+
if (catalogRes.ok) {
|
|
23
|
+
lines.push('');
|
|
24
|
+
lines.push('Available add-ons (catalog):');
|
|
25
|
+
for (const c of catalogRes.data.addons || []) {
|
|
26
|
+
lines.push(` ${c.type} $${c.unit_price}/${c.unit_label} — ${c.description || c.name}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
lines.push('');
|
|
30
|
+
lines.push('Purchase: dailey_addon_purchase (type[, quantity]) → returns a Stripe Checkout URL to pay.');
|
|
31
|
+
return textResult(lines.join('\n'));
|
|
32
|
+
});
|
|
33
|
+
server.tool('dailey_addon_purchase', 'Purchase an à-la-carte capacity add-on (extra_vcpu, extra_ram, extra_db_storage, extra_object_storage, db_replica, app_ha, email_pro, ...). PAY-AT-PURCHASE and billing-owner-only: the normal response is a Stripe Checkout URL the user MUST open to pay the monthly subscription before the capacity is granted — do NOT treat the add-on as active until payment completes. (Some early-stage types with no Stripe price provision immediately.) See dailey_addons for valid types + pricing.', {
|
|
34
|
+
addon_type: z.string().describe('Add-on type, e.g. extra_vcpu, extra_ram, extra_db_storage, extra_object_storage, db_replica, app_ha, email_pro'),
|
|
35
|
+
quantity: z.number().int().min(1).optional().describe('Number of units (default 1)'),
|
|
36
|
+
}, async ({ addon_type, quantity }) => {
|
|
37
|
+
const body = { addon_type };
|
|
38
|
+
if (typeof quantity === 'number')
|
|
39
|
+
body.quantity = quantity;
|
|
40
|
+
const res = await apiRequest('POST', '/billing/addons', body);
|
|
41
|
+
if (!res.ok)
|
|
42
|
+
return textResult(formatError(res));
|
|
43
|
+
const d = res.data;
|
|
44
|
+
if (d.checkout_url) {
|
|
45
|
+
return textResult([
|
|
46
|
+
`Add-on "${addon_type}" x${quantity ?? 1} — pay-at-purchase.`,
|
|
47
|
+
'',
|
|
48
|
+
'➜ Open this URL to complete the subscription payment:',
|
|
49
|
+
d.checkout_url,
|
|
50
|
+
'',
|
|
51
|
+
'The capacity is granted automatically once the Stripe Checkout is paid. It is NOT active yet.',
|
|
52
|
+
].join('\n'));
|
|
53
|
+
}
|
|
54
|
+
// No Stripe price configured — provisioned immediately.
|
|
55
|
+
const lines = [d.message || `Add-on "${addon_type}" added.`];
|
|
56
|
+
if (d.addon)
|
|
57
|
+
lines.push(`id: ${d.addon.id} $${d.addon.monthly_cost}/mo`);
|
|
58
|
+
if (d.note)
|
|
59
|
+
lines.push(d.note);
|
|
60
|
+
return textResult(lines.join('\n'));
|
|
61
|
+
});
|
|
62
|
+
server.tool('dailey_addon_cancel', 'Cancel an active à-la-carte add-on by its add-on id (from dailey_addons). Cancels the Stripe subscription item and removes the capacity from the account quota. Billing-owner-only.', { addon_id: z.string().describe('The add-on id to cancel (from dailey_addons)') }, async ({ addon_id }) => {
|
|
63
|
+
const res = await apiRequest('DELETE', `/billing/addons/${addon_id}`);
|
|
64
|
+
if (!res.ok)
|
|
65
|
+
return textResult(formatError(res));
|
|
66
|
+
return textResult(`${res.data.message || 'Add-on cancelled'} (${res.data.addon_id || addon_id}).`);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=addons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addons.js","sourceRoot":"","sources":["../../src/tools/addons.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAwChE,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,IAAI,CACT,eAAe,EACf,gTAAgT,EAChT,EAAE,EACF,KAAK,IAAI,EAAE;QACT,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAChD,UAAU,CAAqB,KAAK,EAAE,iBAAiB,CAAC;YACxD,UAAU,CAAkB,KAAK,EAAE,yBAAyB,CAAC;SAC9D,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,CAAC,EAAE;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;QAE7D,MAAM,KAAK,GAAa,CAAC,iBAAiB,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;QAC3C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;gBACvB,KAAK,CAAC,IAAI,CACR,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,C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AAC,EAAE;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,OAAO,UAAU,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,kBAAkB,KAAK,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ,IAAI,CAAC,CAAC;IACrG,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credits.d.ts","sourceRoot":"","sources":["../../src/tools/credits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgCpE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,QAgEpD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
const dollars = (cents) => `$${(((cents ?? 0)) / 100).toFixed(2)}`;
|
|
4
|
+
export function registerCreditTools(server) {
|
|
5
|
+
server.tool('dailey_credits', 'Show the account prepaid credit balance and settings: current balance, whether prepaid is enabled, auto-recharge config, and the recent credit ledger. Prepaid credits are drawn down in real time by metered AI / Compute / Email overage; a $0 balance hard-stops those. Top up with dailey_credits_topup.', {}, async () => {
|
|
6
|
+
const res = await apiRequest('GET', '/account/credits');
|
|
7
|
+
if (!res.ok)
|
|
8
|
+
return textResult(formatError(res));
|
|
9
|
+
const d = res.data;
|
|
10
|
+
const lines = [
|
|
11
|
+
'Prepaid Credits',
|
|
12
|
+
`Balance: ${dollars(d.balance_cents)}`,
|
|
13
|
+
`Prepaid enabled: ${d.prepaid_enabled ? 'yes' : 'no'}`,
|
|
14
|
+
`Auto-recharge: ${d.auto_recharge_enabled ? 'on' : 'off'}`,
|
|
15
|
+
];
|
|
16
|
+
if (d.auto_recharge_enabled) {
|
|
17
|
+
lines.push(` when below: ${dollars(d.auto_recharge_threshold_cents)}`);
|
|
18
|
+
lines.push(` top up by: ${dollars(d.auto_recharge_amount_cents)}`);
|
|
19
|
+
}
|
|
20
|
+
const ledger = d.ledger || [];
|
|
21
|
+
lines.push('');
|
|
22
|
+
lines.push('Recent ledger:');
|
|
23
|
+
if (ledger.length === 0) {
|
|
24
|
+
lines.push(' (none)');
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
for (const e of ledger.slice(0, 20)) {
|
|
28
|
+
const sign = (e.delta_cents ?? 0) >= 0 ? '+' : '-';
|
|
29
|
+
lines.push(` ${e.created_at || '?'} ${sign}${dollars(Math.abs(e.delta_cents ?? 0))} ${e.reason || ''}${e.ref ? ` (${e.ref})` : ''}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
lines.push('');
|
|
33
|
+
lines.push('Top up with dailey_credits_topup (opens a Stripe Checkout).');
|
|
34
|
+
return textResult(lines.join('\n'));
|
|
35
|
+
});
|
|
36
|
+
server.tool('dailey_credits_topup', 'Buy a one-time prepaid credit top-up. Returns a Stripe Checkout URL the user MUST open to pay — the balance is only credited after payment completes (do NOT treat credits as added until then). The card is saved for off_session auto-recharge. Amount is $5–$1,000.', {
|
|
37
|
+
amount_usd: z.number().min(5).max(1000).describe('Top-up amount in US dollars (5 to 1000).'),
|
|
38
|
+
}, async ({ amount_usd }) => {
|
|
39
|
+
const amount_cents = Math.round(amount_usd * 100);
|
|
40
|
+
const res = await apiRequest('POST', '/account/credits/checkout', { amount_cents });
|
|
41
|
+
if (!res.ok)
|
|
42
|
+
return textResult(formatError(res));
|
|
43
|
+
const d = res.data;
|
|
44
|
+
if (!d.checkout_url) {
|
|
45
|
+
return textResult('Top-up created but no checkout_url was returned. Retry, or top up from Billing → Credits.');
|
|
46
|
+
}
|
|
47
|
+
return textResult([
|
|
48
|
+
`Prepaid top-up of ${dollars(amount_cents)}.`,
|
|
49
|
+
'',
|
|
50
|
+
'➜ Open this URL to complete payment:',
|
|
51
|
+
d.checkout_url,
|
|
52
|
+
'',
|
|
53
|
+
'Your balance is credited automatically once the Stripe Checkout is paid. It is NOT added yet.',
|
|
54
|
+
].join('\n'));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=credits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credits.js","sourceRoot":"","sources":["../../src/tools/credits.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA2BhE,MAAM,OAAO,GAAG,CAAC,KAAyB,EAAE,EAAE,CAC5C,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;AAE1C,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,8SAA8S,EAC9S,EAAE,EACF,KAAK,IAAI,EAAE;QACT,MAAM,GAAG,GAAG,MAAM,UAAU,CAAwB,KAAK,EAAE,kBAAkB,CAAC,CAAC;QAC/E,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC;QACnB,MAAM,KAAK,GAAG;YACZ,iBAAiB;YACjB,oBAAoB,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE;YAC9C,oBAAoB,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE;YACtD,oBAAoB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE;SAC7D,CAAC;QACF,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,o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I,CACT,sBAAsB,EACtB,wQAAwQ,EACxQ;QACE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,0CAA0C,CAAC;KAC7F,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;QACvB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;QAClD,MAAM,GAAG,GAAG,MAAM,UAAU,CAAgB,MAAM,EAAE,2BAA2B,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;QACnG,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC;QACnB,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;YACpB,OAAO,UAAU,CAAC,2FAA2F,CAAC,CAAC;QACjH,CAAC;QACD,OAAO,UAAU,CACf;YACE,qBAAqB,OAAO,CAAC,YAAY,CAAC,GAAG;YAC7C,EAAE;YACF,sCAAsC;YACtC,CAAC,CAAC,YAAY;YACd,EAAE;YACF,+FAA+F;SAChG,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dailey Images — AI image generation MCP tools (mirror of tools/ai.ts).
|
|
3
|
+
*
|
|
4
|
+
* Backend gateway lives at customer-api routes/images.ts, mounted on
|
|
5
|
+
* /api/projects. OpenAI-Images-compatible. Metered per image from prepaid
|
|
6
|
+
* credits: Fast (dailey-fast, Flux-schnell) 2¢/image, Pro (dailey-pro,
|
|
7
|
+
* Flux 1.1-pro) 10¢/image.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: this is a separate file from tools/images.ts (which holds the Docker
|
|
10
|
+
* container-image tools like dailey_run_image) to avoid clobbering it.
|
|
11
|
+
*/
|
|
12
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
13
|
+
export declare function registerDaileyImagesTools(server: McpServer): void;
|
|
14
|
+
//# sourceMappingURL=dailey-images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dailey-images.d.ts","sourceRoot":"","sources":["../../src/tools/dailey-images.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4CpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,QA+F1D"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
// Per-image price (cents) by tier, for the cost note.
|
|
4
|
+
const TIER_CENTS = {
|
|
5
|
+
'dailey-fast': 2,
|
|
6
|
+
'dailey-pro': 10,
|
|
7
|
+
};
|
|
8
|
+
export function registerDaileyImagesTools(server) {
|
|
9
|
+
server.tool('dailey_images_generate', 'Generate images with Dailey Images (AI). METERED from prepaid credits: model="dailey-fast" (Flux-schnell) is 2¢/image, model="dailey-pro" (Flux 1.1-pro) is 10¢/image. Returns the image URL(s) and which tier/model served the request. Images must be enabled for the project first (dailey_images_enable).', {
|
|
10
|
+
project: z.string().describe('The project ID or slug'),
|
|
11
|
+
prompt: z.string().describe('Text prompt describing the image to generate'),
|
|
12
|
+
model: z
|
|
13
|
+
.enum(['dailey-fast', 'dailey-pro'])
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Tier: dailey-fast (Flux-schnell, 2¢/image, default) or dailey-pro (Flux 1.1-pro, 10¢/image)'),
|
|
16
|
+
size: z.string().optional().describe('Image size/aspect, e.g. "landscape_16_9", "square_hd", "portrait_4_3"'),
|
|
17
|
+
n: z.number().int().min(1).max(4).optional().describe('Number of images to generate (1..4). Default 1.'),
|
|
18
|
+
}, async ({ project, prompt, model, size, n }) => {
|
|
19
|
+
const tier = model || 'dailey-fast';
|
|
20
|
+
const body = { prompt, model: tier };
|
|
21
|
+
if (size != null)
|
|
22
|
+
body.size = size;
|
|
23
|
+
if (n != null)
|
|
24
|
+
body.n = n;
|
|
25
|
+
const res = await apiRequest('POST', `/projects/${project}/images/generations`, body);
|
|
26
|
+
if (!res.ok)
|
|
27
|
+
return textResult(formatError(res));
|
|
28
|
+
const d = res.data;
|
|
29
|
+
const served = d._served_by;
|
|
30
|
+
const perImage = TIER_CENTS[served?.tier || tier] ?? TIER_CENTS[tier];
|
|
31
|
+
const count = d.data?.length ?? 0;
|
|
32
|
+
const urls = (d.data || []).map((im, i) => im.url ? ` ${i + 1}. ${im.url}` : ` ${i + 1}. (b64_json returned, ${(im.b64_json || '').length} chars)`);
|
|
33
|
+
const lines = [
|
|
34
|
+
`Generated ${count} image${count === 1 ? '' : 's'} — ${served?.tier || tier} (${served?.model || 'unknown model'}, via ${served?.provider || 'unknown'})`,
|
|
35
|
+
...urls,
|
|
36
|
+
'',
|
|
37
|
+
`Cost: ${perImage}¢/image × ${count} = ${perImage * count}¢, drawn from prepaid credits.`,
|
|
38
|
+
];
|
|
39
|
+
return textResult(lines.join('\n'));
|
|
40
|
+
});
|
|
41
|
+
server.tool('dailey_images_enable', 'Enable Dailey Images (AI image generation) for a project. Mints a capability-scoped key and injects DAILEY_IMAGE_BASE_URL/KEY/TIER into the project env (applies on next deploy). Usage is metered from prepaid credits (dailey-fast 2¢/image, dailey-pro 10¢/image).', { project: z.string().describe('The project ID or slug') }, async ({ project }) => {
|
|
42
|
+
const res = await apiRequest('POST', `/projects/${project}/images/enable`, {});
|
|
43
|
+
if (!res.ok)
|
|
44
|
+
return textResult(formatError(res));
|
|
45
|
+
const d = res.data;
|
|
46
|
+
const lines = [
|
|
47
|
+
'Dailey Images enabled.',
|
|
48
|
+
` base url: ${d.url}`,
|
|
49
|
+
` key: ${d.key_masked}`,
|
|
50
|
+
` default tier: ${d.default_tier}`,
|
|
51
|
+
' tiers: dailey-fast (2¢/image), dailey-pro (10¢/image)',
|
|
52
|
+
...(d.restart_required ? ['', 'Redeploy the project (dailey_deploy) to pick up the DAILEY_IMAGE_* env vars.'] : []),
|
|
53
|
+
'',
|
|
54
|
+
`Docs: ${d.docs_url}`,
|
|
55
|
+
];
|
|
56
|
+
return textResult(lines.join('\n'));
|
|
57
|
+
});
|
|
58
|
+
server.tool('dailey_images_info', 'Show whether Dailey Images (AI image generation) is enabled for a project, whether its DAILEY_IMAGE_* env vars are injected into the pod, the available tiers, and how to wire it up. Enable with dailey_images_enable.', { project: z.string().describe('The project ID or slug') }, async ({ project }) => {
|
|
59
|
+
const res = await apiRequest('GET', `/projects/${project}/images/info`);
|
|
60
|
+
if (!res.ok)
|
|
61
|
+
return textResult(formatError(res));
|
|
62
|
+
const d = res.data;
|
|
63
|
+
const lines = [
|
|
64
|
+
`Dailey Images: ${d.project.slug}`,
|
|
65
|
+
'',
|
|
66
|
+
` enabled: ${d.images.enabled ? 'ON' : 'off'}`,
|
|
67
|
+
` env injected: ${d.images.env_injected ? 'yes' : 'no'}`,
|
|
68
|
+
` tiers: ${d.images.tiers.join(', ')} (dailey-fast 2¢/image, dailey-pro 10¢/image)`,
|
|
69
|
+
` default tier: ${d.images.default_tier}`,
|
|
70
|
+
` base url: ${d.images.base_url}`,
|
|
71
|
+
` env vars: ${d.images.env_vars.join(', ')}`,
|
|
72
|
+
...(d.images.enable_with ? [` enable: ${d.images.enable_with} (or dailey_images_enable)`] : []),
|
|
73
|
+
'',
|
|
74
|
+
'Integration (OpenAI-compatible):',
|
|
75
|
+
` ${d.integration.images}`,
|
|
76
|
+
];
|
|
77
|
+
if (d.warnings && d.warnings.length) {
|
|
78
|
+
lines.push('');
|
|
79
|
+
for (const w of d.warnings)
|
|
80
|
+
lines.push(`⚠ ${w}`);
|
|
81
|
+
}
|
|
82
|
+
lines.push('', `Docs: ${d.docs_url}`);
|
|
83
|
+
lines.push('Note: injected env applies on the NEXT deploy — redeploy after enabling.');
|
|
84
|
+
return textResult(lines.join('\n'));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=dailey-images.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dailey-images.js","sourceRoot":"","sources":["../../src/tools/dailey-images.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAoChE,sDAAsD;AACtD,MAAM,UAAU,GAA2B;IACzC,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,EAAE;CACjB,CAAC;AAEF,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,IAAI,CACT,wBAAwB,EACxB,+SAA+S,EAC/S;QACE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QACtD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;QAC3E,KAAK,EAAE,CAAC;aACL,IAAI,CAAC,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;aACnC,QAAQ,EAAE;aACV,QAAQ,CAAC,6FAA6F,CAAC;QAC1G,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uEAAuE,CAAC;QAC7G,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iDAAiD,CAAC;KACzG,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,E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,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ;gBAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;QACvF,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/tools/email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA8BpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QAsEnD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
export function registerEmailTools(server) {
|
|
4
|
+
server.tool('dailey_email_enable', 'Enable Dailey Email ($10/mo, per project) so the app can send from <slug>@send.dailey.cloud. This is PAY-AT-PURCHASE and billing-owner-only: the normal response is a Stripe Checkout URL the user MUST open to pay $10/mo before email turns on — do NOT treat email as enabled until payment completes. The operator/internal path enables immediately (email_enabled:true). After it turns on, redeploy so DAILEY_EMAIL_* env is injected.', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
5
|
+
const res = await apiRequest('POST', `/projects/${project_id}/email/enable`, {});
|
|
6
|
+
if (!res.ok)
|
|
7
|
+
return textResult(formatError(res));
|
|
8
|
+
const d = res.data;
|
|
9
|
+
// Pay-at-purchase: a checkout_url means email is NOT on yet.
|
|
10
|
+
if (d.pending && d.checkout_url) {
|
|
11
|
+
return textResult([
|
|
12
|
+
'Dailey Email is $10/mo and requires payment to enable.',
|
|
13
|
+
'',
|
|
14
|
+
'➜ Open this URL to finish enabling email (pay $10/mo):',
|
|
15
|
+
d.checkout_url,
|
|
16
|
+
'',
|
|
17
|
+
'Email turns on automatically once the Stripe Checkout is paid. It is NOT active yet.',
|
|
18
|
+
'After it turns on, redeploy the project (dailey_deploy) to pick up DAILEY_EMAIL_* env.',
|
|
19
|
+
].join('\n'));
|
|
20
|
+
}
|
|
21
|
+
// Operator / already-on path — provisioned immediately.
|
|
22
|
+
const lines = ['Dailey Email enabled.'];
|
|
23
|
+
if (d.from)
|
|
24
|
+
lines.push(`From: ${d.from}`);
|
|
25
|
+
if (d.key_masked)
|
|
26
|
+
lines.push(`Key: ${d.key_masked}`);
|
|
27
|
+
lines.push('');
|
|
28
|
+
lines.push('Redeploy the project (dailey_deploy) to pick up the DAILEY_EMAIL_* env vars.');
|
|
29
|
+
return textResult(lines.join('\n'));
|
|
30
|
+
});
|
|
31
|
+
server.tool('dailey_email_disable', 'Disable Dailey Email for a project: cancels the $10/mo email_pro subscription, revokes the email key, and removes the DAILEY_EMAIL_* env vars. Billing-owner-only (a manager acting-as a managed account is denied).', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
32
|
+
const res = await apiRequest('DELETE', `/projects/${project_id}/email/enable`);
|
|
33
|
+
if (!res.ok)
|
|
34
|
+
return textResult(formatError(res));
|
|
35
|
+
return textResult('Dailey Email disabled. The $10/mo subscription was cancelled and the DAILEY_EMAIL_* env vars removed.');
|
|
36
|
+
});
|
|
37
|
+
server.tool('dailey_email_status', 'Show Dailey Email status for a project: whether email is enabled, the From address (<slug>@send.dailey.cloud), any suspension, and current-month usage (messages sent, bounced, complained).', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
38
|
+
const res = await apiRequest('GET', `/projects/${project_id}/email`);
|
|
39
|
+
if (!res.ok)
|
|
40
|
+
return textResult(formatError(res));
|
|
41
|
+
const d = res.data;
|
|
42
|
+
const lines = [
|
|
43
|
+
`Dailey Email — ${d.project_id}`,
|
|
44
|
+
`Enabled: ${d.email_enabled ? 'yes' : 'no'}`,
|
|
45
|
+
`From: ${d.from_address || '(not set)'}`,
|
|
46
|
+
];
|
|
47
|
+
if (d.suspended)
|
|
48
|
+
lines.push(`Suspended: yes${d.suspend_reason ? ` (${d.suspend_reason})` : ''}`);
|
|
49
|
+
lines.push('');
|
|
50
|
+
lines.push(`Usage (${d.month}):`);
|
|
51
|
+
lines.push(` messages_sent: ${d.usage?.messages_sent ?? 0}`);
|
|
52
|
+
lines.push(` bounced: ${d.usage?.bounced ?? 0}`);
|
|
53
|
+
lines.push(` complained: ${d.usage?.complained ?? 0}`);
|
|
54
|
+
if (!d.email_enabled) {
|
|
55
|
+
lines.push('');
|
|
56
|
+
lines.push('Email is off. Enable with dailey_email_enable (opens a $10/mo Stripe Checkout).');
|
|
57
|
+
}
|
|
58
|
+
return textResult(lines.join('\n'));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.js","sourceRoot":"","sources":["../../src/tools/email.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA4BhE,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,+aAA+a,EAC/a,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,EACrD,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;QACvB,MAAM,GAAG,GAAG,MAAM,UAAU,CAAsB,MAAM,EAAE,aAAa,UAAU,eAAe,EAAE,EAAE,CAAC,CAAC;QACtG,IA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,oBAAoB,CAAC,CAAC,KAAK,EAAE,UAAU,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;QAChG,CAAC;QACD,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.d.ts","sourceRoot":"","sources":["../../src/tools/environments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAqCpE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,QAoGzD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, textResult, formatError } from '../api.js';
|
|
3
|
+
export function registerEnvironmentTools(server) {
|
|
4
|
+
server.tool('dailey_environments', 'List prod and staging environments for a project', {
|
|
5
|
+
project: z.string().describe('The project ID or slug'),
|
|
6
|
+
}, async ({ project }) => {
|
|
7
|
+
const res = await apiRequest('GET', `/projects/${project}/environments`);
|
|
8
|
+
if (!res.ok)
|
|
9
|
+
return textResult(formatError(res));
|
|
10
|
+
const envs = res.data.environments;
|
|
11
|
+
if (!envs || envs.length === 0) {
|
|
12
|
+
return textResult(`No environments found for project ${project}.`);
|
|
13
|
+
}
|
|
14
|
+
const lines = [`Environments for project ${project}:`, ''];
|
|
15
|
+
for (const env of envs) {
|
|
16
|
+
const label = env.environment === 'prod' ? 'Production (prod)' : `${env.environment}`;
|
|
17
|
+
lines.push(`${label}`);
|
|
18
|
+
lines.push(` Status: ${env.status}`);
|
|
19
|
+
lines.push(` Domain: https://${env.domain}`);
|
|
20
|
+
lines.push(` Deployment: ${env.deployment}`);
|
|
21
|
+
if (env.db_name)
|
|
22
|
+
lines.push(` Database: ${env.db_name}`);
|
|
23
|
+
if (env.image)
|
|
24
|
+
lines.push(` Image: ${env.image}`);
|
|
25
|
+
if (env.replicas != null)
|
|
26
|
+
lines.push(` Replicas: ${env.replicas}`);
|
|
27
|
+
if (env.created_at)
|
|
28
|
+
lines.push(` Created: ${env.created_at}`);
|
|
29
|
+
lines.push('');
|
|
30
|
+
}
|
|
31
|
+
return textResult(lines.join('\n').trimEnd());
|
|
32
|
+
});
|
|
33
|
+
server.tool('dailey_wp_clone', 'Clone a WordPress project from prod to staging (DESTRUCTIVE — two-phase). Call WITHOUT confirm_token to get the plan; re-call WITH the returned confirm_token to execute.', {
|
|
34
|
+
project: z.string().describe('The project ID or slug'),
|
|
35
|
+
confirm_token: z.string().optional().describe('Token from the plan response. Omit to preview the plan; provide to execute. ~10min TTL.'),
|
|
36
|
+
}, async ({ project, confirm_token }) => {
|
|
37
|
+
if (!confirm_token) {
|
|
38
|
+
// Phase 1: preview
|
|
39
|
+
const res = await apiRequest('POST', `/projects/${project}/wp/clone/preview`);
|
|
40
|
+
if (!res.ok)
|
|
41
|
+
return textResult(formatError(res));
|
|
42
|
+
const { plan, confirm_token: token } = res.data;
|
|
43
|
+
const lines = [];
|
|
44
|
+
if (plan.sourceLabel || plan.targetLabel) {
|
|
45
|
+
lines.push(`Clone plan: ${plan.sourceLabel ?? 'prod'} → ${plan.targetLabel ?? 'staging'}`);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
lines.push(`Clone plan for project ${project} (prod → staging):`);
|
|
49
|
+
}
|
|
50
|
+
if (plan.steps && plan.steps.length > 0) {
|
|
51
|
+
lines.push('');
|
|
52
|
+
lines.push('Steps:');
|
|
53
|
+
plan.steps.forEach((step, i) => {
|
|
54
|
+
lines.push(` ${i + 1}. ${step}`);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
lines.push('');
|
|
58
|
+
lines.push(`confirm_token: ${token}`);
|
|
59
|
+
lines.push('');
|
|
60
|
+
lines.push('This will overwrite staging with prod data. To proceed, re-call dailey_wp_clone with the same project and this confirm_token.');
|
|
61
|
+
return textResult(lines.join('\n'));
|
|
62
|
+
}
|
|
63
|
+
// Phase 2: execute
|
|
64
|
+
const res = await apiRequest('POST', `/projects/${project}/wp/clone`, { confirm_token, confirmation: 'CLONE' });
|
|
65
|
+
if (!res.ok) {
|
|
66
|
+
if (res.status === 409) {
|
|
67
|
+
return textResult('A clone or restore operation is already in progress for this project.');
|
|
68
|
+
}
|
|
69
|
+
return textResult(formatError(res));
|
|
70
|
+
}
|
|
71
|
+
const { operation_id } = res.data;
|
|
72
|
+
return textResult(`Clone started. operation_id=${operation_id}. Poll with dailey_wp_operation_status (project, operation_id).`);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=environments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.js","sourceRoot":"","sources":["../../src/tools/environments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAmChE,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,kDAAkD,EAClD;QACE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;KACvD,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACpB,MAAM,GAAG,GAAG,MAAM,UAAU,CAAuB,KAAK,EAAE,aAAa,OAAO,eAAe,CAAC,CAAC;QAC/F,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAEjD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,YAAY,CAA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