@fre4x/grok 1.0.49 → 1.0.50

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 (2) hide show
  1. package/dist/index.js +17 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -44378,20 +44378,24 @@ function normalizeVideoGenerationResponse(raw, prompt, aspectRatio, imageUrl) {
44378
44378
  request_id: asString(raw.request_id) || "unknown",
44379
44379
  status: asString(raw.status) || "unknown",
44380
44380
  image_url: imageUrl,
44381
- video_url: asString(raw.video_url)
44381
+ video_url: extractVideoUrl(raw)
44382
44382
  };
44383
44383
  }
44384
- function normalizeVideoStatusResponse(raw) {
44384
+ function extractVideoUrl(raw) {
44385
+ const nestedVideo = raw.video;
44386
+ return asString(raw.video_url) || (isRecord(nestedVideo) ? asString(nestedVideo.url) : void 0);
44387
+ }
44388
+ function normalizeVideoStatusResponse(raw, requestId) {
44385
44389
  if (!isRecord(raw)) {
44386
44390
  return {
44387
- request_id: "unknown",
44391
+ request_id: requestId,
44388
44392
  status: "unknown"
44389
44393
  };
44390
44394
  }
44391
44395
  return {
44392
- request_id: asString(raw.request_id) || "unknown",
44396
+ request_id: asString(raw.request_id) || requestId,
44393
44397
  status: asString(raw.status) || "unknown",
44394
- video_url: asString(raw.video_url)
44398
+ video_url: extractVideoUrl(raw)
44395
44399
  };
44396
44400
  }
44397
44401
  async function handleToolCall(name, args, client = xaiClient) {
@@ -44477,7 +44481,7 @@ async function handleToolCall(name, args, client = xaiClient) {
44477
44481
  );
44478
44482
  const mediaContent = IS_MOCK ? [buildMockImageContent()] : (await Promise.all(
44479
44483
  output.images.map(
44480
- (image) => buildImageContent(image.url)
44484
+ (image) => buildImageContent(image.url, client)
44481
44485
  )
44482
44486
  )).filter(
44483
44487
  (item) => item !== void 0
@@ -44503,7 +44507,7 @@ async function handleToolCall(name, args, client = xaiClient) {
44503
44507
  image_url
44504
44508
  );
44505
44509
  const mediaContent = output.video_url === void 0 ? [] : IS_MOCK ? [buildMockVideoContent(output.video_url)] : (await Promise.all([
44506
- buildVideoContent(output.video_url)
44510
+ buildVideoContent(output.video_url, client)
44507
44511
  ])).filter(
44508
44512
  (item) => item !== void 0
44509
44513
  );
@@ -44519,10 +44523,13 @@ async function handleToolCall(name, args, client = xaiClient) {
44519
44523
  return parsed.error;
44520
44524
  }
44521
44525
  const { request_id } = parsed.data;
44522
- const rawResponse = IS_MOCK ? MOCK_FIXTURES.grok_check_video_status : (await client.get(`/videos/status/${request_id}`)).data;
44523
- const output = normalizeVideoStatusResponse(rawResponse);
44526
+ const rawResponse = IS_MOCK ? MOCK_FIXTURES.grok_check_video_status : (await client.get(`/videos/${request_id}`)).data;
44527
+ const output = normalizeVideoStatusResponse(
44528
+ rawResponse,
44529
+ request_id
44530
+ );
44524
44531
  const mediaContent = output.video_url === void 0 ? [] : IS_MOCK ? [buildMockVideoContent(output.video_url)] : (await Promise.all([
44525
- buildVideoContent(output.video_url)
44532
+ buildVideoContent(output.video_url, client)
44526
44533
  ])).filter(
44527
44534
  (item) => item !== void 0
44528
44535
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fre4x/grok",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "An MCP server for xAI (Grok) with search and generation capabilities.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",