@mixio-pro/kalaasetu-mcp 2.1.1 → 2.1.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/package.json +1 -1
- package/src/tools/get-status.ts +14 -0
- package/src/tools/image-to-video.ts +24 -0
package/package.json
CHANGED
package/src/tools/get-status.ts
CHANGED
|
@@ -23,6 +23,7 @@ interface VertexOperation {
|
|
|
23
23
|
[key: string]: any;
|
|
24
24
|
};
|
|
25
25
|
error?: any;
|
|
26
|
+
_vertexError?: string;
|
|
26
27
|
[key: string]: any;
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -99,6 +100,19 @@ export async function checkVertexStatus(resumeEndpoint: string): Promise<any> {
|
|
|
99
100
|
|
|
100
101
|
const result = (await response.json()) as VertexOperation;
|
|
101
102
|
|
|
103
|
+
// If the operation completed with an error, surface it immediately
|
|
104
|
+
if (result.done && result.error) {
|
|
105
|
+
const errMsg =
|
|
106
|
+
typeof result.error === "object"
|
|
107
|
+
? result.error.message ||
|
|
108
|
+
result.error.code ||
|
|
109
|
+
JSON.stringify(result.error)
|
|
110
|
+
: String(result.error);
|
|
111
|
+
// Attach a structured error to the result for callers to inspect
|
|
112
|
+
result._vertexError = errMsg;
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
|
|
102
116
|
// If completed, save videos if present
|
|
103
117
|
const done = !!result.done || !!result.response;
|
|
104
118
|
if (done) {
|
|
@@ -515,6 +515,30 @@ export const imageToVideo = {
|
|
|
515
515
|
});
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
+
// Check if the operation failed with an error
|
|
519
|
+
if (current.error || current._vertexError) {
|
|
520
|
+
const errMsg =
|
|
521
|
+
current._vertexError ||
|
|
522
|
+
(typeof current.error === "object"
|
|
523
|
+
? current.error.message ||
|
|
524
|
+
current.error.code ||
|
|
525
|
+
JSON.stringify(current.error)
|
|
526
|
+
: String(current.error));
|
|
527
|
+
return JSON.stringify({
|
|
528
|
+
status: "ERROR",
|
|
529
|
+
message: `Vertex AI video generation failed: ${errMsg}`,
|
|
530
|
+
operationName,
|
|
531
|
+
error:
|
|
532
|
+
typeof current.error === "object"
|
|
533
|
+
? {
|
|
534
|
+
code: current.error.code,
|
|
535
|
+
message: current.error.message,
|
|
536
|
+
status: current.error.status,
|
|
537
|
+
}
|
|
538
|
+
: current.error,
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
|
|
518
542
|
const resp = current.response || current;
|
|
519
543
|
|
|
520
544
|
// checkVertexStatus already handles saving videos and sanitizing base64
|