@dypai-ai/mcp 1.0.9 → 1.0.10
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/package.json +1 -1
- package/src/tools/deploy.js +21 -68
package/package.json
CHANGED
package/src/tools/deploy.js
CHANGED
|
@@ -180,85 +180,38 @@ After deploying, the site is live at https://{slug}.dypai.app within ~30s.`,
|
|
|
180
180
|
|
|
181
181
|
const label = framework?.label ?? "Project"
|
|
182
182
|
|
|
183
|
-
//
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
for (let i = 0; i < maxAttempts; i++) {
|
|
189
|
-
await new Promise(r => setTimeout(r, pollInterval))
|
|
190
|
-
try {
|
|
191
|
-
const status = await api.get(`/api/engine/${project_id}/frontend/build-status`)
|
|
192
|
-
const s = status?.status
|
|
193
|
-
if (s === "success") {
|
|
194
|
-
buildResult = { status: "success", url: result.url, duration: status.duration_seconds }
|
|
195
|
-
break
|
|
196
|
-
}
|
|
197
|
-
if (s === "failure") {
|
|
198
|
-
// Fetch build logs for error context
|
|
199
|
-
let logs = status.build_error || null
|
|
200
|
-
if (!logs) {
|
|
201
|
-
try {
|
|
202
|
-
const deployments = await api.get(`/api/engine/${project_id}/frontend/deployments?limit=1`)
|
|
203
|
-
const depId = deployments?.deployments?.[0]?.id
|
|
204
|
-
if (depId) {
|
|
205
|
-
const logRes = await api.get(`/api/engine/${project_id}/frontend/deployments/${depId}/logs`)
|
|
206
|
-
if (logRes?.logs) {
|
|
207
|
-
const lines = logRes.logs.split("\n")
|
|
208
|
-
logs = lines.slice(-30).join("\n")
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
} catch {}
|
|
212
|
-
}
|
|
213
|
-
buildResult = { status: "failure", error: logs || "Build failed — check logs with get_deployment_logs" }
|
|
214
|
-
break
|
|
215
|
-
}
|
|
216
|
-
// still queued/building — keep polling
|
|
217
|
-
} catch {
|
|
218
|
-
// build-status not available yet, keep polling
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (!buildResult) {
|
|
223
|
-
// Timed out — build still in progress
|
|
224
|
-
return {
|
|
225
|
-
success: true,
|
|
226
|
-
url: result.url,
|
|
227
|
-
files_pushed: files.length,
|
|
228
|
-
size_bytes: total,
|
|
229
|
-
framework: label,
|
|
230
|
-
build_status: "building",
|
|
231
|
-
message: `Deployed ${files.length} files (${Math.round(total / 1024)} KB). ${label} build still in progress at ${result.url} — use get_build_status to check progress.`,
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (buildResult.status === "failure") {
|
|
236
|
-
return {
|
|
237
|
-
success: false,
|
|
238
|
-
url: result.url,
|
|
239
|
-
files_pushed: files.length,
|
|
240
|
-
framework: label,
|
|
241
|
-
build_status: "failure",
|
|
242
|
-
build_error: buildResult.error,
|
|
243
|
-
message: `Deploy pushed ${files.length} files but the ${label} build FAILED. Build error:\n${buildResult.error}`,
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
183
|
+
// Fire-and-forget: return immediately with "queued" status. The agent
|
|
184
|
+
// is expected to call `get_build_status` to poll progress until the
|
|
185
|
+
// terminal "success" / "failure" is reached. Blocking here would stall
|
|
186
|
+
// the agent for up to 2 minutes and prevent it from doing anything
|
|
187
|
+
// else in parallel.
|
|
247
188
|
const skippedMsg = skipped.length > 0
|
|
248
189
|
? `\n\nSkipped ${skipped.length} file(s):\n${skipped.map(s => ` - ${s.path}: ${s.reason}`).join("\n")}`
|
|
249
190
|
: ""
|
|
250
191
|
|
|
251
192
|
return {
|
|
252
193
|
success: true,
|
|
253
|
-
|
|
194
|
+
deployed: false, // explicit: not live yet, still building
|
|
195
|
+
url: result.url, // final URL once success
|
|
254
196
|
files_pushed: files.length,
|
|
255
197
|
files_skipped: skipped.length,
|
|
256
198
|
skipped_files: skipped.length > 0 ? skipped : undefined,
|
|
257
199
|
size_bytes: total,
|
|
258
200
|
framework: label,
|
|
259
|
-
build_status: "
|
|
260
|
-
|
|
261
|
-
|
|
201
|
+
build_status: "queued",
|
|
202
|
+
next_step: {
|
|
203
|
+
action: "poll_build_status",
|
|
204
|
+
tool: "get_build_status",
|
|
205
|
+
arg: { project_id },
|
|
206
|
+
interval_seconds: 5,
|
|
207
|
+
expected_total_seconds: 60,
|
|
208
|
+
terminal_statuses: ["success", "failure"],
|
|
209
|
+
},
|
|
210
|
+
message:
|
|
211
|
+
`Deploy accepted — ${files.length} files (${Math.round(total / 1024)} KB) queued. ` +
|
|
212
|
+
`The build is running in the cloud (${label}, typically 20–60s). ` +
|
|
213
|
+
`Call get_build_status with project_id="${project_id}" every ~5s until status is "success" or "failure" ` +
|
|
214
|
+
`before reporting completion to the user. The site is NOT live yet.${skippedMsg}`,
|
|
262
215
|
}
|
|
263
216
|
} catch (e) {
|
|
264
217
|
return { error: `Deploy failed: ${e.message}` }
|