monacloud-mcp 0.4.0 → 0.4.2
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/clients.js +5 -2
- package/dist/compute.js +1 -1
- package/dist/local-app.js +2 -1
- package/package.json +1 -1
package/dist/clients.js
CHANGED
|
@@ -75,8 +75,11 @@ export class CloudClients {
|
|
|
75
75
|
const status = error instanceof CloudError ? error.status ?? 0 : 0;
|
|
76
76
|
if (!(error instanceof CloudError) || ![401, 403, 404, 502, 503].includes(status))
|
|
77
77
|
throw error;
|
|
78
|
-
const
|
|
79
|
-
const
|
|
78
|
+
const root = asObject(unwrapData(await this.vibecloud('/api/me')));
|
|
79
|
+
const me = asObject(root.user ?? root); // compute trả {user:{credit_vnd, promo_credit_vnd, total_credit_vnd}}
|
|
80
|
+
const balanceVnd = me.total_credit_vnd !== undefined
|
|
81
|
+
? Number(me.total_credit_vnd)
|
|
82
|
+
: Number(me.credit_vnd ?? me.balance_vnd ?? 0) + Number(me.promo_credit_vnd ?? 0);
|
|
80
83
|
return {
|
|
81
84
|
balance_vnd: Number.isFinite(balanceVnd) ? balanceVnd : 0,
|
|
82
85
|
currency: 'VND',
|
package/dist/compute.js
CHANGED
|
@@ -97,7 +97,7 @@ export function registerComputeTools(server, clients) {
|
|
|
97
97
|
register('cloud_app_detect', 'Nhận diện Node/Next/Vite/Python/PHP/static, port, start, Dockerfile, build_type và tên biến .env.example; hoàn toàn offline, không thực thi code dự án. / Detect a local app without network.', z.object({ local_dir: localDir }).strict(), ({ local_dir }) => detectProject(local_dir));
|
|
98
98
|
register('cloud_app_create', appNotice + APP_FLOW, z.object({ local_dir: localDir.optional(), name: z.string().trim().min(1).max(80).optional(), repo_url: repo.optional(), branch: gitPath.optional(), build_type: z.enum(['dockerfile', 'nixpacks', 'static']).optional(), dockerfile: gitPath.optional(), env: env.default({}), domain: domain.optional(), app_host_id: id.optional(), port: z.number().int().min(1).max(65535).optional(), sandbox, ...poll }).strict()
|
|
99
99
|
.refine((args) => Boolean(args.local_dir) !== Boolean(args.repo_url), 'Chọn đúng một local_dir hoặc repo_url.')
|
|
100
|
-
.refine((args) => !args.local_dir || (!args.branch &&
|
|
100
|
+
.refine((args) => !args.local_dir || (!args.branch && (!args.dockerfile || args.dockerfile === 'Dockerfile')), 'Upload local dùng Dockerfile ở root (hoặc Nixpacks tự nhận); branch/app_host_id chỉ dùng cho git.'), async (args) => {
|
|
101
101
|
if (args.local_dir)
|
|
102
102
|
return local.create(args);
|
|
103
103
|
const { sandbox: requested, wait, interval_sec, timeout_sec, local_dir, name, ...fields } = args;
|
package/dist/local-app.js
CHANGED
|
@@ -38,8 +38,9 @@ export function localAppTools(clients) {
|
|
|
38
38
|
const started = Date.now();
|
|
39
39
|
const created = data(await clients.guardedVibecloud('/api/apps', { method: 'POST', body: payload }, sandbox));
|
|
40
40
|
// Existing sandbox implementations may return an estimate job without an upload slot.
|
|
41
|
+
// Sandbox: API ước tính + URL giả, không cấp upload_url (backend 05/09) → không upload; nếu API cũ vẫn cấp slot thì đi tiếp.
|
|
41
42
|
if (sandbox && !created.upload_url)
|
|
42
|
-
return finish(created, args, true);
|
|
43
|
+
return finish({ app_id: created.id ?? created.app_id, ...created, sandbox: true }, args, true);
|
|
43
44
|
if (typeof created.id !== 'string' || !created.id)
|
|
44
45
|
throw new CloudError('invalid_upload_response', 'API không trả app id cho source=upload.', 'Đọc cloud_app_list trước khi thử lại; không tạo trùng app.');
|
|
45
46
|
const appId = created.id;
|