@doufunao123/asset-gateway 0.22.2 → 0.24.0

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 +58 -9
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import { AssetForgeError } from "@doufunao123/assetforge-sdk";
15
15
 
16
16
  // src/meta.ts
17
17
  var CLI_NAME = "asset-gateway";
18
- var CLI_VERSION = "0.22.2";
18
+ var CLI_VERSION = "0.24.0";
19
19
  var CLI_DESCRIPTION = "Universal asset generation gateway CLI";
20
20
  var DEFAULT_GATEWAY_URL = "https://asset.origingame.dev";
21
21
 
@@ -598,7 +598,7 @@ function createDescribeCommand() {
598
598
 
599
599
  // src/commands/generate.ts
600
600
  import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
601
- import { dirname as dirname2, extname, join as join2 } from "path";
601
+ import { basename, dirname as dirname2, extname, join as join2 } from "path";
602
602
  import { AssetForgeError as AssetForgeError3 } from "@doufunao123/assetforge-sdk";
603
603
  import { Command as Command3 } from "commander";
604
604
  function inferExtension(assetType) {
@@ -747,6 +747,36 @@ async function saveNamedOutput(result, assetType, filePath) {
747
747
  }
748
748
  return null;
749
749
  }
750
+ async function saveOutputFiles(result, outputDir) {
751
+ const outputFiles = Array.isArray(result.output_files) ? result.output_files : [];
752
+ if (outputFiles.length === 0) {
753
+ return [];
754
+ }
755
+ mkdirSync2(outputDir, { recursive: true });
756
+ const saved = [];
757
+ for (const file of outputFiles) {
758
+ if (!isOutputFile(file)) {
759
+ continue;
760
+ }
761
+ const filePath = join2(outputDir, basename(file.name));
762
+ const response = await fetch(file.url);
763
+ if (!response.ok) {
764
+ continue;
765
+ }
766
+ writeFileSync2(filePath, Buffer.from(await response.arrayBuffer()));
767
+ saved.push(filePath);
768
+ }
769
+ if (saved.length > 0) {
770
+ const manifestPath = join2(outputDir, "manifest.json");
771
+ writeFileSync2(manifestPath, `${JSON.stringify(result, null, 2)}
772
+ `, "utf8");
773
+ saved.push(manifestPath);
774
+ }
775
+ return saved;
776
+ }
777
+ function isOutputFile(value) {
778
+ return typeof value === "object" && value !== null && typeof value.name === "string" && typeof value.url === "string" && typeof value.kind === "string";
779
+ }
750
780
  function parseFrameSize(raw) {
751
781
  const [width, height] = raw.split("x");
752
782
  const frameWidth = Number(width);
@@ -1094,8 +1124,13 @@ function createGenerateCommand() {
1094
1124
  quality: options.quality,
1095
1125
  display_name: options.displayName
1096
1126
  });
1097
- const localPath = await saveOutput(data, "world", options.outputDir);
1098
- if (localPath) data.local_path = localPath;
1127
+ const localPaths = await saveOutputFiles(data, options.outputDir);
1128
+ if (localPaths.length > 0) {
1129
+ data.local_paths = localPaths;
1130
+ } else {
1131
+ const localPath = await saveOutput(data, "world", options.outputDir);
1132
+ if (localPath) data.local_path = localPath;
1133
+ }
1099
1134
  printSuccess("generate.world", data, ctx);
1100
1135
  } catch (error2) {
1101
1136
  printError("generate.world", error2);
@@ -1140,12 +1175,18 @@ import { Command as Command4 } from "commander";
1140
1175
  function createJobCommand() {
1141
1176
  const command = new Command4("job").description("Job management");
1142
1177
  command.addCommand(
1143
- new Command4("list").description("List jobs").option("--status <status>", "Filter by status").option("--limit <n>", "Maximum number of jobs to return").action(async function(options) {
1178
+ new Command4("list").description("List jobs").option("--job-kind <kind>", "Filter by job kind").option("--status <status>", "Filter by status").option("--asset-type <type>", "Filter by asset type").option("--provider-id <id>", "Filter by provider ID").option("--since <iso>", "Filter jobs created at or after an ISO8601 timestamp").option("--provider-task-id <id>", "Filter by provider task ID").option("--limit <n>", "Maximum number of jobs to return").option("--offset <n>", "Offset for pagination").action(async function(options) {
1144
1179
  try {
1145
1180
  const ctx = createContext(this);
1146
1181
  const data = await ctx.client.job.list({
1182
+ job_kind: options.jobKind,
1147
1183
  status: options.status,
1148
- limit: options.limit ? Number(options.limit) : void 0
1184
+ asset_type: options.assetType,
1185
+ provider_id: options.providerId,
1186
+ since: options.since,
1187
+ provider_task_id: options.providerTaskId,
1188
+ limit: options.limit ? Number(options.limit) : void 0,
1189
+ offset: options.offset ? Number(options.offset) : void 0
1149
1190
  });
1150
1191
  printSuccess("job.list", data, ctx);
1151
1192
  } catch (error2) {
@@ -1187,7 +1228,7 @@ function createLibraryCommand() {
1187
1228
  "Search and manage the asset library"
1188
1229
  );
1189
1230
  command.addCommand(
1190
- new Command5("search").description("Search the asset library").argument("[query]", "Search query").option("-q, --query <query>", "Search query").option("-t, --type <type>", "Filter by asset type (audio, music, image, etc.)").option("--tags <tags>", "Filter by tags (comma-separated)").option("--source <source>", "Filter by source (manual, generated, imported)").option("--mode <mode>", "Search mode (fts, vector, hybrid)").option("--style <style>", "Filter by visual style").option("--composition <composition>", "Filter by composition").option("--lighting <lighting>", "Filter by lighting").option("--color-tone <tone>", "Filter by color tone").option("--mood <mood>", "Filter by mood (comma-separated)").option("--theme <theme>", "Filter by theme (comma-separated)").option("--era <era>", "Filter by era").option("--rig-name <rig>", "Filter by exact rig name").option("--compatible-rig <rig>", "Filter by compatible rig").option("--no-rerank", "Disable LLM reranking").option("-n, --limit <limit>", "Max results", "20").option("--offset <offset>", "Offset for pagination", "0").action(async function(query) {
1231
+ new Command5("search").description("Search the asset library").argument("[query]", "Search query").option("-q, --query <query>", "Search query").option("-t, --type <type>", "Filter by asset type (audio, music, image, etc.)").option("--tags <tags>", "Filter by tags (comma-separated)").option("--source <source>", "Filter by source (manual, generated, imported)").option("--pack-id <id>", "Filter by library pack ID").option("--mode <mode>", "Search mode (fts, vector, hybrid)").option("--style <style>", "Filter by visual style").option("--composition <composition>", "Filter by composition").option("--lighting <lighting>", "Filter by lighting").option("--color-tone <tone>", "Filter by color tone").option("--mood <mood>", "Filter by mood (comma-separated)").option("--theme <theme>", "Filter by theme (comma-separated)").option("--era <era>", "Filter by era").option("--gameplay-role <role>", "Filter by gameplay role").option("--enrichment-status <status>", "Filter by enrichment status").option("--min-long-edge-px <px>", "Minimum long edge in pixels").option("--min-width-px <px>", "Minimum width in pixels").option("--min-height-px <px>", "Minimum height in pixels").option("--max-file-size-bytes <bytes>", "Maximum file size in bytes").option("--license <license>", "Filter by asset license").option("--rig-name <rig>", "Filter by exact rig name").option("--compatible-rig <rig>", "Filter by compatible rig").option("--no-rerank", "Disable LLM reranking").option("-n, --limit <limit>", "Max results", "20").option("--offset <offset>", "Offset for pagination", "0").action(async function(query) {
1191
1232
  const ctx = createContext(this);
1192
1233
  const opts = this.opts();
1193
1234
  try {
@@ -1196,6 +1237,7 @@ function createLibraryCommand() {
1196
1237
  type: opts.type,
1197
1238
  tags: opts.tags,
1198
1239
  source: opts.source,
1240
+ pack_id: opts.packId,
1199
1241
  mode: opts.mode,
1200
1242
  style: opts.style,
1201
1243
  composition: opts.composition,
@@ -1204,6 +1246,13 @@ function createLibraryCommand() {
1204
1246
  mood: opts.mood,
1205
1247
  theme: opts.theme,
1206
1248
  era: opts.era,
1249
+ gameplay_role: opts.gameplayRole,
1250
+ enrichment_status: opts.enrichmentStatus,
1251
+ min_long_edge_px: opts.minLongEdgePx ? Number(opts.minLongEdgePx) : void 0,
1252
+ min_width_px: opts.minWidthPx ? Number(opts.minWidthPx) : void 0,
1253
+ min_height_px: opts.minHeightPx ? Number(opts.minHeightPx) : void 0,
1254
+ max_file_size_bytes: opts.maxFileSizeBytes ? Number(opts.maxFileSizeBytes) : void 0,
1255
+ license: opts.license,
1207
1256
  rig_name: opts.rigName,
1208
1257
  compatible_rig: opts.compatibleRig,
1209
1258
  rerank: opts.rerank,
@@ -1836,7 +1885,7 @@ function createProviderCommand() {
1836
1885
 
1837
1886
  // src/commands/upload.ts
1838
1887
  import { readFile as readFile3 } from "fs/promises";
1839
- import { basename } from "path";
1888
+ import { basename as basename2 } from "path";
1840
1889
  import { AssetForgeError as AssetForgeError6 } from "@doufunao123/assetforge-sdk";
1841
1890
  import { Command as Command10 } from "commander";
1842
1891
  function createUploadCommand() {
@@ -1846,7 +1895,7 @@ function createUploadCommand() {
1846
1895
  const ctx = createContext(this);
1847
1896
  try {
1848
1897
  const content = await readLocalFile(filePath);
1849
- const data = await ctx.client.assets.upload(content, { filename: basename(filePath) });
1898
+ const data = await ctx.client.assets.upload(content, { filename: basename2(filePath) });
1850
1899
  printSuccess("asset.upload", data, ctx);
1851
1900
  } catch (error2) {
1852
1901
  printError("asset.upload", error2, ctx.human);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doufunao123/asset-gateway",
3
- "version": "0.22.2",
3
+ "version": "0.24.0",
4
4
  "description": "Universal asset generation gateway CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,8 +12,8 @@
12
12
  ],
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/fran0220/agent-skills.git",
16
- "directory": "asset-gateway/npm"
15
+ "url": "git+https://github.com/fran0220/asset-gateway.git",
16
+ "directory": "npm"
17
17
  },
18
18
  "author": "doufunao123",
19
19
  "scripts": {
@@ -27,7 +27,7 @@
27
27
  "node": ">=20"
28
28
  },
29
29
  "dependencies": {
30
- "@doufunao123/assetforge-sdk": "^0.8.0",
30
+ "@doufunao123/assetforge-sdk": "^0.10.0",
31
31
  "commander": "^13.1.0"
32
32
  },
33
33
  "devDependencies": {