siluzan-tso-cli 1.1.40-beta.3 → 1.1.40-beta.5

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/README.md CHANGED
@@ -51,7 +51,7 @@ siluzan-tso init -d /path/to/skills # 写入自定义目录
51
51
  siluzan-tso init --force # 强制覆盖已存在文件
52
52
  ```
53
53
 
54
- > **注意**:当前为测试版(1.1.40-beta.3),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
54
+ > **注意**:当前为测试版(1.1.40-beta.5),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
55
55
 
56
56
  | 助手 | 建议 `--ai` |
57
57
  | ----------------------- | ------------------------------------ |
package/dist/index.js CHANGED
@@ -2300,6 +2300,7 @@ function buildSiluzanClientIdentityHeaders() {
2300
2300
  "X-Siluzan-Client": client,
2301
2301
  "X-Siluzan-Runtime": runtime,
2302
2302
  "X-Siluzan-Skill-Version": version,
2303
+ "X-Company-Source-Type": SILUZAN_AGENT_COMPANY_SOURCE_TYPE,
2303
2304
  "User-Agent": `${client}/${version}`
2304
2305
  };
2305
2306
  }
@@ -2328,6 +2329,19 @@ function rawRequest(url, options) {
2328
2329
  ...buildSiluzanClientIdentityHeaders(),
2329
2330
  ...options.headers
2330
2331
  };
2332
+ if (process.env.SILUZAN_DEBUG_HEADERS === "1" || process.env.SILUZAN_DEBUG_HEADERS === "true") {
2333
+ try {
2334
+ process.stderr.write(
2335
+ `[SILUZAN_DEBUG_HEADERS] ${method} ${url}
2336
+ X-Company-Source-Type=${headers["X-Company-Source-Type"] ?? "(missing)"}
2337
+ X-Siluzan-Runtime=${headers["X-Siluzan-Runtime"] ?? "(missing)"}
2338
+ X-Siluzan-Client=${headers["X-Siluzan-Client"] ?? "(missing)"}
2339
+ X-Siluzan-Skill-Version=${headers["X-Siluzan-Skill-Version"] ?? "(missing)"}
2340
+ `
2341
+ );
2342
+ } catch {
2343
+ }
2344
+ }
2331
2345
  const reqOpts = {
2332
2346
  hostname: parsed.hostname,
2333
2347
  port: parsed.port || (isHttps ? 443 : 80),
@@ -3873,7 +3887,7 @@ async function issueApiKeyWithPhoneCode(opts) {
3873
3887
  });
3874
3888
  return apiKey;
3875
3889
  }
3876
- var import_semver, SILUZAN_DIR, CONFIG_FILE, inProcessLockChain, ALLOWED_HOSTNAME_SUFFIXES, EXACT_ID_FIELD_NAMES, _clientProduct, _resolveVersion, DEFAULT_TIMEOUT_MS, MAX_RESPONSE_BYTES, httpsAgent, httpAgent, PERF_PREFIX, DEFAULT_DETAIL_MAX, VERBOSE_DETAIL_MAX, ASCII_TABLE_CHARS, CLI_SNAPSHOT_MANIFEST_FILE, SCHEMA_VERSION, FALLBACK_FIELD_GUIDE_REFS, _cliPackage, _resolveCliVersion, _fieldGuideRefs, OUTLINE_AGENT_HINT, TS_LIKE_ARRAY_SAMPLE_MAX, MAX_INVOCATION_CHARS, currentInvocation, MAX_COMMIT_CHARS, WRITE_AUDIT_AGENT_AUTO_COMMIT, cliCommitOverride, WRITE_AUDIT_SCHEMA_VERSION, MUTATING, BEIJING_TZ, AUDIT_LOG_FILENAME_RE, DEFAULT_MAX_FILE_MB, MIN_SEGMENT_BYTES, MAX_SEGMENT_BYTES, DEFAULT_RETENTION_DAYS, MIN_RETENTION_DAYS, MAX_RETENTION_DAYS, PRUNE_THROTTLE_MS, lastPruneAtMs, MAX_BODY_CHARS, MAX_ERROR_CHARS, DEFAULT_FIND_AUDIT_MAX_DAYS, MAX_SNAPSHOT_FILE_BYTES, API_KEY_SERVICE_VALUES;
3890
+ var import_semver, SILUZAN_DIR, CONFIG_FILE, inProcessLockChain, ALLOWED_HOSTNAME_SUFFIXES, EXACT_ID_FIELD_NAMES, SILUZAN_AGENT_COMPANY_SOURCE_TYPE, _clientProduct, _resolveVersion, DEFAULT_TIMEOUT_MS, MAX_RESPONSE_BYTES, httpsAgent, httpAgent, PERF_PREFIX, DEFAULT_DETAIL_MAX, VERBOSE_DETAIL_MAX, ASCII_TABLE_CHARS, CLI_SNAPSHOT_MANIFEST_FILE, SCHEMA_VERSION, FALLBACK_FIELD_GUIDE_REFS, _cliPackage, _resolveCliVersion, _fieldGuideRefs, OUTLINE_AGENT_HINT, TS_LIKE_ARRAY_SAMPLE_MAX, MAX_INVOCATION_CHARS, currentInvocation, MAX_COMMIT_CHARS, WRITE_AUDIT_AGENT_AUTO_COMMIT, cliCommitOverride, WRITE_AUDIT_SCHEMA_VERSION, MUTATING, BEIJING_TZ, AUDIT_LOG_FILENAME_RE, DEFAULT_MAX_FILE_MB, MIN_SEGMENT_BYTES, MAX_SEGMENT_BYTES, DEFAULT_RETENTION_DAYS, MIN_RETENTION_DAYS, MAX_RETENTION_DAYS, PRUNE_THROTTLE_MS, lastPruneAtMs, MAX_BODY_CHARS, MAX_ERROR_CHARS, DEFAULT_FIND_AUDIT_MAX_DAYS, MAX_SNAPSHOT_FILE_BYTES, API_KEY_SERVICE_VALUES;
3877
3891
  var init_dist = __esm({
3878
3892
  "../common/dist/index.js"() {
3879
3893
  "use strict";
@@ -3919,6 +3933,7 @@ var init_dist = __esm({
3919
3933
  "lastChangedBy",
3920
3934
  "userId"
3921
3935
  ]);
3936
+ SILUZAN_AGENT_COMPANY_SOURCE_TYPE = "Ctaiad";
3922
3937
  _clientProduct = "siluzan-cli";
3923
3938
  DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
3924
3939
  MAX_RESPONSE_BYTES = 50 * 1024 * 1024;
@@ -4469,56 +4484,6 @@ var init_currency_display = __esm({
4469
4484
  }
4470
4485
  });
4471
4486
 
4472
- // src/utils/media-customer-id.ts
4473
- function stripMediaCustomerIdDecorators(raw) {
4474
- return raw.trim().replace(/[\s-]+/g, "");
4475
- }
4476
- function looksLikeNumericMediaCustomerId(raw) {
4477
- return /^\d+$/.test(stripMediaCustomerIdDecorators(raw));
4478
- }
4479
- function normalizeNumericMediaCustomerId(raw) {
4480
- if (!looksLikeNumericMediaCustomerId(raw)) return null;
4481
- return stripMediaCustomerIdDecorators(raw);
4482
- }
4483
- function looksLikeEntityIdUuid(raw) {
4484
- return ENTITY_ID_UUID_RE.test(raw.trim());
4485
- }
4486
- function warnIfAccountIdsLookLikeEntityId(ids, command) {
4487
- const bad = ids.map((id) => id.trim()).filter((id) => id && looksLikeEntityIdUuid(id));
4488
- if (bad.length === 0) return;
4489
- console.error(
4490
- `
4491
- \u26A0\uFE0F ${command} \u7684 -a/--accounts \u6536\u5230\u7591\u4F3C entityId/UUID\uFF1A${bad.join(", ")}
4492
- \u672C\u547D\u4EE4\u9700\u8981 mediaCustomerId\uFF08list-accounts \u7684 ma.mediaCustomerId\uFF1BYandex \u5F62\u5982 porg-\u2026\uFF09\u3002
4493
- \u8BF7\u5148 list-accounts -m <\u5A92\u4F53> -k <\u5A92\u4F53\u8D26\u6237\u53F7> \u6838\u5BF9\u540E\u518D\u91CD\u8BD5\uFF1B\u52FF\u636E\u6B64\u76F4\u63A5 reauth\u3002
4494
- `
4495
- );
4496
- }
4497
- function parseNumericMediaCustomerIds(input) {
4498
- if (!input || !input.trim()) return [];
4499
- const seen = /* @__PURE__ */ new Set();
4500
- const out = [];
4501
- for (const raw of input.split(",")) {
4502
- const piece = raw.trim();
4503
- if (!piece) continue;
4504
- const id = normalizeNumericMediaCustomerId(piece);
4505
- if (!id) {
4506
- throw new Error(`mediaCustomerId \u5FC5\u987B\u4E3A\u7EAF\u6570\u5B57\uFF08\u53EF\u542B\u8FDE\u5B57\u7B26\uFF09\uFF1A${piece}`);
4507
- }
4508
- if (seen.has(id)) continue;
4509
- seen.add(id);
4510
- out.push(id);
4511
- }
4512
- return out;
4513
- }
4514
- var ENTITY_ID_UUID_RE;
4515
- var init_media_customer_id = __esm({
4516
- "src/utils/media-customer-id.ts"() {
4517
- "use strict";
4518
- ENTITY_ID_UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4519
- }
4520
- });
4521
-
4522
4487
  // src/utils/balance.ts
4523
4488
  function fmt(d) {
4524
4489
  return d.toISOString().slice(0, 10);
@@ -4825,6 +4790,56 @@ var init_balance = __esm({
4825
4790
  }
4826
4791
  });
4827
4792
 
4793
+ // src/utils/media-customer-id.ts
4794
+ function stripMediaCustomerIdDecorators(raw) {
4795
+ return raw.trim().replace(/[\s-]+/g, "");
4796
+ }
4797
+ function looksLikeNumericMediaCustomerId(raw) {
4798
+ return /^\d+$/.test(stripMediaCustomerIdDecorators(raw));
4799
+ }
4800
+ function normalizeNumericMediaCustomerId(raw) {
4801
+ if (!looksLikeNumericMediaCustomerId(raw)) return null;
4802
+ return stripMediaCustomerIdDecorators(raw);
4803
+ }
4804
+ function looksLikeEntityIdUuid(raw) {
4805
+ return ENTITY_ID_UUID_RE.test(raw.trim());
4806
+ }
4807
+ function warnIfAccountIdsLookLikeEntityId(ids, command) {
4808
+ const bad = ids.map((id) => id.trim()).filter((id) => id && looksLikeEntityIdUuid(id));
4809
+ if (bad.length === 0) return;
4810
+ console.error(
4811
+ `
4812
+ \u26A0\uFE0F ${command} \u7684 -a/--accounts \u6536\u5230\u7591\u4F3C entityId/UUID\uFF1A${bad.join(", ")}
4813
+ \u672C\u547D\u4EE4\u9700\u8981 mediaCustomerId\uFF08list-accounts \u7684 ma.mediaCustomerId\uFF1BYandex \u5F62\u5982 porg-\u2026\uFF09\u3002
4814
+ \u8BF7\u5148 list-accounts -m <\u5A92\u4F53> -k <\u5A92\u4F53\u8D26\u6237\u53F7> \u6838\u5BF9\u540E\u518D\u91CD\u8BD5\uFF1B\u52FF\u636E\u6B64\u76F4\u63A5 reauth\u3002
4815
+ `
4816
+ );
4817
+ }
4818
+ function parseNumericMediaCustomerIds(input) {
4819
+ if (!input || !input.trim()) return [];
4820
+ const seen = /* @__PURE__ */ new Set();
4821
+ const out = [];
4822
+ for (const raw of input.split(",")) {
4823
+ const piece = raw.trim();
4824
+ if (!piece) continue;
4825
+ const id = normalizeNumericMediaCustomerId(piece);
4826
+ if (!id) {
4827
+ throw new Error(`mediaCustomerId \u5FC5\u987B\u4E3A\u7EAF\u6570\u5B57\uFF08\u53EF\u542B\u8FDE\u5B57\u7B26\uFF09\uFF1A${piece}`);
4828
+ }
4829
+ if (seen.has(id)) continue;
4830
+ seen.add(id);
4831
+ out.push(id);
4832
+ }
4833
+ return out;
4834
+ }
4835
+ var ENTITY_ID_UUID_RE;
4836
+ var init_media_customer_id = __esm({
4837
+ "src/utils/media-customer-id.ts"() {
4838
+ "use strict";
4839
+ ENTITY_ID_UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4840
+ }
4841
+ });
4842
+
4828
4843
  // src/utils/media-account-batch.ts
4829
4844
  function mediaAccountDataBatchSize(media) {
4830
4845
  switch (media) {
@@ -105698,6 +105713,12 @@ var VALID_MEDIA_TYPES = [
105698
105713
  "BingV2",
105699
105714
  "Kwai"
105700
105715
  ];
105716
+ function applyListAccountsSearchKeyword(params, keyword) {
105717
+ const kw = (keyword ?? "").trim();
105718
+ if (kw) {
105719
+ params.set("keyword", kw);
105720
+ }
105721
+ }
105701
105722
  var PLATFORM_CONFIG = {
105702
105723
  Google: {
105703
105724
  path: "/query/media-account/",
@@ -106156,7 +106177,6 @@ function wrapListJson(params) {
106156
106177
  }
106157
106178
 
106158
106179
  // src/commands/list-accounts/main.ts
106159
- init_media_customer_id();
106160
106180
  async function runListAccounts(opts) {
106161
106181
  let config = loadConfig(opts.token);
106162
106182
  if (opts.refreshDp) {
@@ -106186,14 +106206,7 @@ async function runListAccounts(opts) {
106186
106206
  if (platformCfg.responseType === "array" && opts.status && opts.status !== "all") {
106187
106207
  params.set("status", opts.status);
106188
106208
  }
106189
- if (opts.keyword) {
106190
- const numericId = normalizeNumericMediaCustomerId(opts.keyword);
106191
- if (numericId) {
106192
- params.set(platformCfg.idSearchParam, numericId);
106193
- } else {
106194
- params.set("mediaCustomerName", opts.keyword.trim());
106195
- }
106196
- }
106209
+ applyListAccountsSearchKeyword(params, opts.keyword);
106197
106210
  const url = `${config.apiBaseUrl}${platformCfg.path}?${params}`;
106198
106211
  if (platformCfg.responseType === "array") {
106199
106212
  try {
@@ -106227,9 +106240,7 @@ async function runListAccounts(opts) {
106227
106240
  }
106228
106241
  } else {
106229
106242
  const params = new URLSearchParams();
106230
- if (opts.keyword) {
106231
- params.set("keyword", normalizeNumericMediaCustomerId(opts.keyword) ?? opts.keyword.trim());
106232
- }
106243
+ applyListAccountsSearchKeyword(params, opts.keyword);
106233
106244
  if (opts.status && opts.status !== "all") params.set("status", opts.status);
106234
106245
  params.set("pageNo", String(page));
106235
106246
  params.set("pageSize", String(pageSize));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.40-beta.3",
4
- "publishedAt": 1785313316702
3
+ "version": "1.1.40-beta.5",
4
+ "publishedAt": 1785481213805
5
5
  }
@@ -17,7 +17,7 @@ siluzan-tso list-accounts [选项]
17
17
  | 选项 | 说明 |
18
18
  | ----------------------- | -------------------------------------------------------------------------------- | ---------------------- |
19
19
  | `-m, --media <type>` | 媒体类型(留空查全部):`Google \| TikTok \| Yandex \| MetaAd \| BingV2 \| Kwai` |
20
- | `-k, --keyword <text>` | 按账户名称或 ID 搜索 |
20
+ | `-k, --keyword <text>` | 统一模糊搜索:账户名称 **或** ID(含 Google CID 带横杠);透传 Sammamish `keyword` |
21
21
  | `-s, --status <status>` | 账户状态:`normal \| invalid \| all`(默认 all) |
22
22
  | `-p, --page <n>` | 页码(默认 1) |
23
23
  | `--page-size <n>` | 每页数量(默认 20) |
@@ -9,7 +9,7 @@ $ErrorActionPreference = 'Stop'
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  $PKG_NAME = 'siluzan-tso-cli'
11
11
  # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
- $PKG_VERSION = '1.1.40-beta.3'
12
+ $PKG_VERSION = '1.1.40-beta.5'
13
13
  $CLI_BIN = 'siluzan-tso'
14
14
  $SKILL_LABEL = 'Siluzan TSO'
15
15
  $INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
@@ -9,7 +9,7 @@ set -euo pipefail
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  readonly PKG_NAME="siluzan-tso-cli"
11
11
  # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
- readonly PKG_VERSION="1.1.40-beta.3"
12
+ readonly PKG_VERSION="1.1.40-beta.5"
13
13
  readonly CLI_BIN="siluzan-tso"
14
14
  readonly SKILL_LABEL="Siluzan TSO"
15
15
  readonly INSTALL_CMD="npm install -g siluzan-tso-cli@beta"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-tso-cli",
3
- "version": "1.1.40-beta.3",
3
+ "version": "1.1.40-beta.5",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "keywords": [
6
6
  "ad-account",