@unityclaw/sdk 1.0.3 → 1.0.4

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.
@@ -4,7 +4,7 @@ import os from "os";
4
4
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
5
5
  var CONFIG_DIR = path.join(os.homedir(), ".unityclaw");
6
6
  var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
7
- var DEFAULT_TASKS_DIR = path.join(CONFIG_DIR, "tasks");
7
+ var DEFAULT_TASKS_DIR = path.join(os.homedir(), "Documents", "tasks");
8
8
  function getConfigPath() {
9
9
  return CONFIG_FILE;
10
10
  }
package/dist/cli.cjs CHANGED
@@ -29,7 +29,7 @@ var import_os = __toESM(require("os"), 1);
29
29
  var import_fs = require("fs");
30
30
  var CONFIG_DIR = import_path.default.join(import_os.default.homedir(), ".unityclaw");
31
31
  var CONFIG_FILE = import_path.default.join(CONFIG_DIR, "config.json");
32
- var DEFAULT_TASKS_DIR = import_path.default.join(CONFIG_DIR, "tasks");
32
+ var DEFAULT_TASKS_DIR = import_path.default.join(import_os.default.homedir(), "Documents", "tasks");
33
33
  function getConfigPath() {
34
34
  return CONFIG_FILE;
35
35
  }
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  getConfigValue,
5
5
  loadConfig,
6
6
  setConfigValue
7
- } from "./chunk-WG7OYNEX.js";
7
+ } from "./chunk-SZITFMFH.js";
8
8
 
9
9
  // src/cli.ts
10
10
  var args = process.argv.slice(2);
package/dist/index.cjs CHANGED
@@ -239,7 +239,7 @@ var import_os = __toESM(require("os"), 1);
239
239
  var import_fs2 = require("fs");
240
240
  var CONFIG_DIR = import_path2.default.join(import_os.default.homedir(), ".unityclaw");
241
241
  var CONFIG_FILE = import_path2.default.join(CONFIG_DIR, "config.json");
242
- var DEFAULT_TASKS_DIR = import_path2.default.join(CONFIG_DIR, "tasks");
242
+ var DEFAULT_TASKS_DIR = import_path2.default.join(import_os.default.homedir(), "Documents", "tasks");
243
243
  function getConfigPath() {
244
244
  return CONFIG_FILE;
245
245
  }
@@ -775,6 +775,16 @@ var MediaAPI = class {
775
775
  // src/client.ts
776
776
  var DEFAULT_BASE_URL = "https://unityclaw.com";
777
777
  var DEFAULT_TIMEOUT = 3e5;
778
+ var OLD_DOMAINS = ["fieldshortcut.cn", "fieldshortcut.com"];
779
+ var NEW_DOMAIN = "unityclaw.com";
780
+ function replaceOldDomains(text) {
781
+ if (!text || typeof text !== "string") return text;
782
+ let result = text;
783
+ for (const oldDomain of OLD_DOMAINS) {
784
+ result = result.replace(new RegExp(oldDomain.replace(/\./g, "\\."), "g"), NEW_DOMAIN);
785
+ }
786
+ return result;
787
+ }
778
788
  var UnityClawClient = class {
779
789
  config;
780
790
  httpClient;
@@ -881,6 +891,9 @@ var UnityClawClient = class {
881
891
  await this.taskFolderManager.writeRequest(taskCtx, endpoint, params, context);
882
892
  await this.taskFolderManager.log(taskCtx, "info", "Request prepared", { endpoint, params });
883
893
  const response = await this.httpClient.post(endpoint, requestBody);
894
+ if (response.data.msg) {
895
+ response.data.msg = replaceOldDomains(response.data.msg);
896
+ }
884
897
  await this.taskFolderManager.writeResponse(taskCtx, response.data);
885
898
  await this.taskFolderManager.log(taskCtx, "info", "Response received", {
886
899
  code: response.data.code,
@@ -908,7 +921,8 @@ var UnityClawClient = class {
908
921
  response.data.code === 0
909
922
  );
910
923
  } catch (error) {
911
- const errorMessage = error instanceof import_axios2.AxiosError ? error.response?.data?.msg || error.message : error instanceof Error ? error.message : String(error);
924
+ const rawErrorMessage = error instanceof import_axios2.AxiosError ? error.response?.data?.msg || error.message : error instanceof Error ? error.message : String(error);
925
+ const errorMessage = replaceOldDomains(rawErrorMessage);
912
926
  await this.taskFolderManager.log(taskCtx, "error", `Request failed: ${errorMessage}`, {
913
927
  error: error instanceof import_axios2.AxiosError ? { status: error.response?.status, data: error.response?.data } : error
914
928
  });
package/dist/index.d.cts CHANGED
@@ -812,7 +812,7 @@ declare class UnityClawClient {
812
812
  declare const CONFIG_DIR: string;
813
813
  /** Config file path */
814
814
  declare const CONFIG_FILE: string;
815
- /** Default tasks directory */
815
+ /** Default tasks directory - in Documents so users can easily find results */
816
816
  declare const DEFAULT_TASKS_DIR: string;
817
817
  /** UnityClaw configuration */
818
818
  interface UnityClawConfig {
package/dist/index.d.ts CHANGED
@@ -812,7 +812,7 @@ declare class UnityClawClient {
812
812
  declare const CONFIG_DIR: string;
813
813
  /** Config file path */
814
814
  declare const CONFIG_FILE: string;
815
- /** Default tasks directory */
815
+ /** Default tasks directory - in Documents so users can easily find results */
816
816
  declare const DEFAULT_TASKS_DIR: string;
817
817
  /** UnityClaw configuration */
818
818
  interface UnityClawConfig {
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  loadConfig,
8
8
  saveConfig,
9
9
  setConfigValue
10
- } from "./chunk-WG7OYNEX.js";
10
+ } from "./chunk-SZITFMFH.js";
11
11
 
12
12
  // src/client.ts
13
13
  import axios2, { AxiosError } from "axios";
@@ -676,6 +676,16 @@ var MediaAPI = class {
676
676
  // src/client.ts
677
677
  var DEFAULT_BASE_URL = "https://unityclaw.com";
678
678
  var DEFAULT_TIMEOUT = 3e5;
679
+ var OLD_DOMAINS = ["fieldshortcut.cn", "fieldshortcut.com"];
680
+ var NEW_DOMAIN = "unityclaw.com";
681
+ function replaceOldDomains(text) {
682
+ if (!text || typeof text !== "string") return text;
683
+ let result = text;
684
+ for (const oldDomain of OLD_DOMAINS) {
685
+ result = result.replace(new RegExp(oldDomain.replace(/\./g, "\\."), "g"), NEW_DOMAIN);
686
+ }
687
+ return result;
688
+ }
679
689
  var UnityClawClient = class {
680
690
  config;
681
691
  httpClient;
@@ -782,6 +792,9 @@ var UnityClawClient = class {
782
792
  await this.taskFolderManager.writeRequest(taskCtx, endpoint, params, context);
783
793
  await this.taskFolderManager.log(taskCtx, "info", "Request prepared", { endpoint, params });
784
794
  const response = await this.httpClient.post(endpoint, requestBody);
795
+ if (response.data.msg) {
796
+ response.data.msg = replaceOldDomains(response.data.msg);
797
+ }
785
798
  await this.taskFolderManager.writeResponse(taskCtx, response.data);
786
799
  await this.taskFolderManager.log(taskCtx, "info", "Response received", {
787
800
  code: response.data.code,
@@ -809,7 +822,8 @@ var UnityClawClient = class {
809
822
  response.data.code === 0
810
823
  );
811
824
  } catch (error) {
812
- const errorMessage = error instanceof AxiosError ? error.response?.data?.msg || error.message : error instanceof Error ? error.message : String(error);
825
+ const rawErrorMessage = error instanceof AxiosError ? error.response?.data?.msg || error.message : error instanceof Error ? error.message : String(error);
826
+ const errorMessage = replaceOldDomains(rawErrorMessage);
813
827
  await this.taskFolderManager.log(taskCtx, "error", `Request failed: ${errorMessage}`, {
814
828
  error: error instanceof AxiosError ? { status: error.response?.status, data: error.response?.data } : error
815
829
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unityclaw/sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more",
5
5
  "type": "module",
6
6
  "bin": {