@tiny-fish/cli 0.6.2-next.105 → 0.6.2-next.106

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/lib/client.js +11 -1
  2. package/package.json +1 -1
@@ -5,11 +5,21 @@ import { z } from "zod";
5
5
  class TinyFishCliClient extends TinyFish {
6
6
  _buildHeaders() {
7
7
  const base = super._buildHeaders();
8
- return {
8
+ const headers = {
9
9
  ...base,
10
10
  "X-TF-Request-Origin": "tinyfish-cli",
11
11
  "User-Agent": `${base["User-Agent"] ?? ""} @tiny-fish/cli/${CLI_VERSION}`.trim(),
12
12
  };
13
+ // Forwarded explicitly: the pinned published SDK may predate TF_CLIENT_* support.
14
+ // Non-printable chars make fetch throw; 128 is the server cap (client_name varchar(128)).
15
+ const sanitize = (value) => (value ?? "").replace(/[^\x20-\x7E]/g, "").trim().slice(0, 128);
16
+ const clientName = sanitize(process.env["TF_CLIENT_NAME"]);
17
+ const clientVersion = sanitize(process.env["TF_CLIENT_VERSION"]);
18
+ if (clientName)
19
+ headers["X-TF-Client-Name"] = clientName;
20
+ if (clientVersion)
21
+ headers["X-TF-Client-Version"] = clientVersion;
22
+ return headers;
13
23
  }
14
24
  // The SDK base client only exposes get/post/postStream; DELETE is needed for
15
25
  // disconnecting a vault connection. ponytail: raw fetch, no retry/timeout —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiny-fish/cli",
3
- "version": "0.6.2-next.105",
3
+ "version": "0.6.2-next.106",
4
4
  "description": "TinyFish CLI — run web automations from your terminal",
5
5
  "type": "module",
6
6
  "bin": {