@felores/kie-cli 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +18 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1778,12 +1778,14 @@ var flux2ImageTool = {
1778
1778
  const hasInputUrls = !!request.input_urls && request.input_urls.length > 0;
1779
1779
  const modelType = request.model_type || "pro";
1780
1780
  const modeDescription = hasInputUrls ? `image-to-image (${modelType})` : `text-to-image (${modelType})`;
1781
- if (response.data?.taskId) {
1781
+ if (response.code === 200 && response.data?.taskId) {
1782
1782
  await ctx.db.createTask({
1783
1783
  task_id: response.data.taskId,
1784
1784
  api_type: "flux2-image",
1785
1785
  status: "pending"
1786
1786
  });
1787
+ } else {
1788
+ throw new Error(response.msg || "Failed to create Flux 2 image task");
1787
1789
  }
1788
1790
  return {
1789
1791
  content: [
@@ -2383,12 +2385,14 @@ var hailuoVideoTool = {
2383
2385
  } else {
2384
2386
  modeDescription = `v${version} text-to-video (${request.quality || "standard"} quality)`;
2385
2387
  }
2386
- if (response.data?.taskId) {
2388
+ if (response.code === 200 && response.data?.taskId) {
2387
2389
  await ctx.db.createTask({
2388
2390
  task_id: response.data.taskId,
2389
2391
  api_type: "hailuo",
2390
2392
  status: "pending"
2391
2393
  });
2394
+ } else {
2395
+ throw new Error(response.msg || "Failed to create Hailuo video task");
2392
2396
  }
2393
2397
  return {
2394
2398
  content: [
@@ -2726,12 +2730,14 @@ var klingVideoTool = {
2726
2730
  const response = await ctx.client.generateKlingVideo(request);
2727
2731
  const hasImages = !!request.image_urls && request.image_urls.length > 0;
2728
2732
  const modeDescription = request.multi_shots ? "Kling 3.0 multi-shot" : hasImages ? "Kling 3.0 image-to-video" : "Kling 3.0 text-to-video";
2729
- if (response.data?.taskId) {
2733
+ if (response.code === 200 && response.data?.taskId) {
2730
2734
  await ctx.db.createTask({
2731
2735
  task_id: response.data.taskId,
2732
2736
  api_type: "kling-3.0-video",
2733
2737
  status: "pending"
2734
2738
  });
2739
+ } else {
2740
+ throw new Error(response.msg || "Failed to create Kling 3.0 video task");
2735
2741
  }
2736
2742
  return {
2737
2743
  content: [
@@ -2961,13 +2967,15 @@ var nanoBananaImageTool = {
2961
2967
  const isEdit = !!request.image_input && request.image_input.length > 0;
2962
2968
  const apiType = isEdit ? "nano-banana-edit" : "nano-banana-image";
2963
2969
  const modeDescription = isEdit ? "edit" : "generate";
2964
- if (response.data?.taskId) {
2970
+ if (response.code === 200 && response.data?.taskId) {
2965
2971
  await ctx.db.createTask({
2966
2972
  task_id: response.data.taskId,
2967
2973
  api_type: apiType,
2968
2974
  status: "pending",
2969
2975
  result_url: response.data.imageUrl
2970
2976
  });
2977
+ } else {
2978
+ throw new Error(response.msg || "Failed to create Nano Banana image task");
2971
2979
  }
2972
2980
  return {
2973
2981
  content: [
@@ -3354,12 +3362,14 @@ var veo3GenerateVideoTool = {
3354
3362
  const request = Veo3GenerateSchema.parse(args);
3355
3363
  request.callBackUrl = ctx.getCallbackUrl(request.callBackUrl);
3356
3364
  const response = await ctx.client.generateVeo3Video(request);
3357
- if (response.data?.taskId) {
3365
+ if (response.code === 200 && response.data?.taskId) {
3358
3366
  await ctx.db.createTask({
3359
3367
  task_id: response.data.taskId,
3360
3368
  api_type: "veo3",
3361
3369
  status: "pending"
3362
3370
  });
3371
+ } else {
3372
+ throw new Error(response.msg || "Failed to create Veo3 video task");
3363
3373
  }
3364
3374
  return {
3365
3375
  content: [
@@ -3436,12 +3446,14 @@ var wanAnimateTool = {
3436
3446
  request.callBackUrl = ctx.getCallbackUrl(request.callBackUrl);
3437
3447
  const response = await ctx.client.generateWanAnimate(request);
3438
3448
  const modeDescription = request.mode === "replace" ? "character replacement" : "animation";
3439
- if (response.data?.taskId) {
3449
+ if (response.code === 200 && response.data?.taskId) {
3440
3450
  await ctx.db.createTask({
3441
3451
  task_id: response.data.taskId,
3442
3452
  api_type: "wan-animate",
3443
3453
  status: "pending"
3444
3454
  });
3455
+ } else {
3456
+ throw new Error(response.msg || "Failed to create Wan Animate task");
3445
3457
  }
3446
3458
  return {
3447
3459
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felores/kie-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Standalone CLI for Kie.ai APIs: generate images, video, music and speech from the terminal. Same models as the Kie.ai MCP server, no MCP client required.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {