@talesofai/neta-skills 0.15.0 → 0.15.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @neta/skills-neta
2
2
 
3
+ ## 0.15.2
4
+
5
+ ### Patch Changes
6
+
7
+ - fix debug log in production environment
8
+
9
+ ## 0.15.1
10
+
11
+ ### Patch Changes
12
+
13
+ - support network media url for media assets upload
14
+
3
15
  ## 0.15.0
4
16
 
5
17
  ### Minor Changes
package/bin/cli.js CHANGED
File without changes
@@ -3,7 +3,7 @@ title: Media File Upload
3
3
  description: Upload a media file (image or video) to create a media artifact.
4
4
 
5
5
  parameters:
6
- file_path: Media file path (absolute path or relative path to command execution directory)
6
+ file_path: Local media path (absolute or relative to cwd), or http(s) URL to fetch the file
7
7
 
8
8
  errors:
9
9
  file_type_not_supported: Media file type not supported
@@ -134,6 +134,9 @@ const createArtifact = async (url, options) => {
134
134
  // biome-ignore lint/style/noNonNullAssertion: checked
135
135
  return res.result[0];
136
136
  };
137
+ const checkIsNetworkUrl = (url) => {
138
+ return url.startsWith("http://") || url.startsWith("https://");
139
+ };
137
140
  export const upload = createCommand({
138
141
  name: meta.name,
139
142
  title: meta.title,
@@ -148,7 +151,11 @@ export const upload = createCommand({
148
151
  const regionOptions = apis.baseUrl.endsWith(".cn")
149
152
  ? OSS_STS_OPTIONS_CN
150
153
  : OSS_STS_OPTIONS_US;
151
- const file = await readFile(file_path);
154
+ const file = await (checkIsNetworkUrl(file_path)
155
+ ? fetch(file_path)
156
+ .then((res) => res.arrayBuffer())
157
+ .then((buffer) => Buffer.from(buffer))
158
+ : readFile(file_path));
152
159
  const infos = filetypeinfo(file);
153
160
  const info = infos[0]; // always use first extension
154
161
  if (!info || !info.extension || !info.mime) {
@@ -3,7 +3,7 @@ title: 媒体文件上传
3
3
  description: 上传媒体文件(图片、视频)并创建一个媒体素材。
4
4
 
5
5
  parameters:
6
- file_path: 媒体文件路径(绝对路径或命令执行目录的相对路径)
6
+ file_path: 本地媒体路径(绝对路径或相对于当前工作目录),或用于拉取文件的 http(s) 网址
7
7
 
8
8
  errors:
9
9
  file_type_not_supported: 文件类型不支持
@@ -39,7 +39,14 @@ export const loadCommands = async (domains) => {
39
39
  })).then((commands) => commands.flat());
40
40
  };
41
41
  const IS_DEV = process.env["NODE_ENV"] === "development";
42
- const logger = console;
42
+ const logger = IS_DEV
43
+ ? console
44
+ : {
45
+ error: () => { },
46
+ warn: () => { },
47
+ info: () => { },
48
+ debug: () => { },
49
+ };
43
50
  export const buildCommands = async (cli) => {
44
51
  setLocale();
45
52
  const commands = await loadCommands([
@@ -96,14 +103,7 @@ export const buildCommands = async (cli) => {
96
103
  app_language: getLocale(),
97
104
  });
98
105
  const apis = createApis({
99
- logger: IS_DEV
100
- ? logger
101
- : {
102
- error: () => { },
103
- warn: () => { },
104
- info: () => { },
105
- debug: () => { },
106
- },
106
+ logger,
107
107
  baseUrl,
108
108
  headers: {
109
109
  "x-token": process.env["NETA_TOKEN"] ?? "",
@@ -132,14 +132,7 @@ export const buildCommands = async (cli) => {
132
132
  .execute(input, {
133
133
  apis,
134
134
  user,
135
- log: IS_DEV
136
- ? logger
137
- : {
138
- error: () => { },
139
- warn: () => { },
140
- info: () => { },
141
- debug: () => { },
142
- },
135
+ log: logger,
143
136
  })
144
137
  .then((result) => {
145
138
  const duration = Date.now() - startTime;
@@ -1,6 +1,7 @@
1
1
  import axios from "axios";
2
2
  import pkg from "../../package.json" with { type: "json" };
3
3
  const DISABLE_TELEMETRY = process.env["DISABLE_TELEMETRY"] === "1";
4
+ const IS_DEV = process.env["NODE_ENV"] === "development";
4
5
  const api = axios.create({
5
6
  baseURL: "https://gator.volces.com/v2/event/json",
6
7
  headers: {
@@ -42,14 +43,14 @@ export const track = (event, params) => {
42
43
  ],
43
44
  })
44
45
  .then((e) => {
45
- if (process.env["NODE_ENV"] !== "development")
46
+ if (!IS_DEV)
46
47
  return;
47
48
  if (e.status === 200)
48
49
  return;
49
50
  logger.warn("[telemetry] track error: %s %o", e.status, e.data);
50
51
  })
51
52
  .catch((e) => {
52
- if (process.env["NODE_ENV"] !== "development")
53
+ if (!IS_DEV)
53
54
  return;
54
55
  logger.warn("[telemetry] track error: %o", e);
55
56
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talesofai/neta-skills",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "Neta API pi coding agent skills for interacting with Neta API to generate images, videos, songs, and manage characters/elements.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -25,9 +25,23 @@
25
25
  "engines": {
26
26
  "node": ">=22.0.0"
27
27
  },
28
+ "packageManager": "pnpm@10.25.0",
28
29
  "bin": {
29
30
  "neta-cli": "bin/cli.js"
30
31
  },
32
+ "scripts": {
33
+ "lint": "biome check . --write --unsafe",
34
+ "validate": "skills-ref to-prompt ./skills/neta ./skills/neta-community ./skills/neta-creative ./skills/neta-suggest ./skills/neta-space ./skills/neta-character ./skills/neta-elementum ./skills/neta-adventure",
35
+ "type-check": "tsc --noEmit",
36
+ "check": "pnpm lint && pnpm type-check && pnpm validate",
37
+ "changelog": "changeset",
38
+ "bump": "changeset version",
39
+ "prepare": "husky",
40
+ "build": "rimraf bin && tsc",
41
+ "postbuild": "node scripts/postbuild.js",
42
+ "dev": "NODE_ENV=development node src/cli.ts",
43
+ "start": "node bin/cli.js"
44
+ },
31
45
  "dependencies": {
32
46
  "@aws-sdk/client-s3": "^3.1013.0",
33
47
  "@commander-js/extra-typings": "^14.0.0",
@@ -63,17 +77,5 @@
63
77
  "README.zh_cn.md",
64
78
  "CHANGELOG.md",
65
79
  "LICENSE"
66
- ],
67
- "scripts": {
68
- "lint": "biome check . --write --unsafe",
69
- "validate": "skills-ref to-prompt ./skills/neta ./skills/neta-community ./skills/neta-creative ./skills/neta-suggest ./skills/neta-space ./skills/neta-character ./skills/neta-elementum ./skills/neta-adventure",
70
- "type-check": "tsc --noEmit",
71
- "check": "pnpm lint && pnpm type-check && pnpm validate",
72
- "changelog": "changeset",
73
- "bump": "changeset version",
74
- "build": "rimraf bin && tsc",
75
- "postbuild": "node scripts/postbuild.js",
76
- "dev": "NODE_ENV=development node src/cli.ts",
77
- "start": "node bin/cli.js"
78
- }
79
- }
80
+ ]
81
+ }
@@ -57,10 +57,11 @@ npx -y @talesofai/neta-skills@latest remove_background --input_image "image_arti
57
57
 
58
58
  **Upload local image or video**
59
59
 
60
- Registers a file from disk as a Neta artifact (after upload and moderation). Use the returned **`uuid`** or **`url`** in `make_image` (`ref_img-…`), `make_video` (`--image_source` URL), `remove_background`, or collection commands.
60
+ Registers a file from disk **or from an `http://` / `https://` URL** as a Neta artifact (after upload and moderation). Use the returned **`uuid`** or **`url`** in `make_image` (`ref_img-…`), `make_video` (`--image_source` URL), `remove_background`, or collection commands.
61
61
 
62
62
  ```bash
63
63
  npx -y @talesofai/neta-skills@latest upload --file_path "/path/to/file.png"
64
+ # or: --file_path "https://example.com/asset.png"
64
65
  ```
65
66
 
66
67
  📖 [Media upload](./references/media-upload.md) — supported types, size limits, and how outputs map to each downstream command.
@@ -11,7 +11,9 @@ npx -y @talesofai/neta-skills@latest upload --file_path "/absolute/or/relative/p
11
11
  **Requirements**
12
12
 
13
13
  - **`NETA_TOKEN`** must be set (same as other authenticated commands). Unauthenticated runs fail with an explicit error.
14
- - **`file_path`**: absolute path, or path relative to the **current working directory** when the command runs.
14
+ - **`file_path`**: either
15
+ - a **local path** — absolute, or relative to the **current working directory** when the command runs; or
16
+ - a **direct media URL** — `http://` or `https://` to a resource the CLI can `fetch` (same supported types and size limits apply after download).
15
17
 
16
18
  ---
17
19
 
@@ -91,6 +93,14 @@ npx -y @talesofai/neta-skills@latest upload --file_path "./character.png"
91
93
  npx -y @talesofai/neta-skills@latest remove_background --input_image "<UUID_FROM_UPLOAD_OUTPUT>"
92
94
  ```
93
95
 
96
+ ### Remote file by URL
97
+
98
+ When the asset is already hosted, pass a direct `https://` (or `http://`) link as `file_path`. The CLI downloads it, then runs the same type/size checks and OSS upload as for a local file.
99
+
100
+ ```bash
101
+ npx -y @talesofai/neta-skills@latest upload --file_path "https://example.com/reference.jpg"
102
+ ```
103
+
94
104
  ---
95
105
 
96
106
  ## Related docs