siluzan-tso-cli 1.1.66 → 1.1.67-beta.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/README.md CHANGED
@@ -43,7 +43,7 @@ HTML 报告模板外部资源:**ECharts** 统一使用 `https://staticpn.siluz
43
43
  在**用户的目标项目根目录**执行(根据用户使用的助手选择 `--ai`):
44
44
 
45
45
  ```bash
46
- npm install -g siluzan-tso-cli
46
+ npm install -g siluzan-tso-cli@beta
47
47
  siluzan-tso init --ai cursor # 写入 Cursor(默认)
48
48
  siluzan-tso init --ai cursor,claude # 同时写入多个平台
49
49
  siluzan-tso init --ai all # 写入所有支持的平台
@@ -51,6 +51,7 @@ siluzan-tso init -d /path/to/skills # 写入自定义目录
51
51
  siluzan-tso init --force # 强制覆盖已存在文件
52
52
  ```
53
53
 
54
+ > **注意**:当前为测试版(1.1.67-beta.2),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
54
55
 
55
56
  | 助手 | 建议 `--ai` |
56
57
  | ----------------------- | ------------------------------------ |
package/dist/index.js CHANGED
@@ -2645,7 +2645,7 @@ async function requestWithReadRetry(url, options) {
2645
2645
  }
2646
2646
  }
2647
2647
  }
2648
- async function apiFetch(url, config, options = {}, verbose = false) {
2648
+ async function apiFetch(url, config, options = {}, verbose = false, timeoutMs) {
2649
2649
  const method = options.method ?? "GET";
2650
2650
  const reqHeaders = {
2651
2651
  "Content-Type": "application/json",
@@ -2662,7 +2662,8 @@ async function apiFetch(url, config, options = {}, verbose = false) {
2662
2662
  method,
2663
2663
  headers: reqHeaders,
2664
2664
  body,
2665
- signal: options.signal ?? void 0
2665
+ signal: options.signal ?? void 0,
2666
+ ...timeoutMs !== void 0 ? { timeoutMs } : {}
2666
2667
  });
2667
2668
  return parseApiResponse(res.status, res.text, verbose);
2668
2669
  }
@@ -4103,7 +4104,7 @@ var DEFAULT_API_BASE;
4103
4104
  var init_defaults = __esm({
4104
4105
  "src/config/defaults.ts"() {
4105
4106
  "use strict";
4106
- DEFAULT_API_BASE = "https://tso-api.siluzan.com";
4107
+ DEFAULT_API_BASE = "https://tso-api-ci.siluzan.com";
4107
4108
  }
4108
4109
  });
4109
4110
 
@@ -4404,14 +4405,14 @@ async function withWriteAudit(params, execute) {
4404
4405
  throw e;
4405
4406
  }
4406
4407
  }
4407
- async function apiFetch2(url, config, options = {}, verbose = false) {
4408
+ async function apiFetch2(url, config, options = {}, verbose = false, timeoutMs) {
4408
4409
  const method = options.method ?? "GET";
4409
4410
  if (!isMutatingHttpMethod(method)) {
4410
- return apiFetch(url, config, options, verbose);
4411
+ return apiFetch(url, config, options, verbose, timeoutMs);
4411
4412
  }
4412
4413
  const body = typeof options.body === "string" ? options.body : void 0;
4413
4414
  return withWriteAudit({ config, url, method, body, verbose }, async () => ({
4414
- value: await apiFetch(url, config, options, verbose)
4415
+ value: await apiFetch(url, config, options, verbose, timeoutMs)
4415
4416
  }));
4416
4417
  }
4417
4418
  async function apiFetchWithHeaders2(url, config, options = {}, verbose = false) {
@@ -133589,6 +133590,143 @@ Google \u8D26\u6237\u8BBF\u95EE\u6743\u9650\u6821\u9A8C ${mediaCustomerId}`);
133589
133590
  }
133590
133591
  }
133591
133592
 
133593
+ // src/commands/account-manage/google-promotions.ts
133594
+ init_auth();
133595
+ init_cli_json_snapshot();
133596
+ init_media_customer_id();
133597
+ var INCENTIVE_STATE_LABEL = {
133598
+ Redeemed: "\u5DF2\u5151\u6362\uFF0C\u5F85\u5B8C\u6210\u6D88\u8017",
133599
+ Fulfilled: "\u5DF2\u8FBE\u6210\u6761\u4EF6\uFF0C\u8D60\u9001\u91D1\u5C1A\u672A\u5230\u8D26",
133600
+ RewardGranted: "\u8D60\u9001\u91D1\u5DF2\u5230\u8D26",
133601
+ Expired: "\u672A\u5728\u671F\u9650\u5185\u8FBE\u6210\u6761\u4EF6",
133602
+ RewardExpired: "\u8D60\u9001\u91D1\u5DF2\u8FC7\u671F",
133603
+ RewardExhausted: "\u8D60\u9001\u91D1\u5DF2\u7528\u5B8C",
133604
+ Invalidated: "\u5DF2\u4F5C\u5E9F",
133605
+ Unknown: "\u672A\u77E5",
133606
+ Unspecified: "\u672A\u77E5"
133607
+ };
133608
+ function incentiveStateLabel(state) {
133609
+ return INCENTIVE_STATE_LABEL[state] ?? (state || "\u672A\u77E5");
133610
+ }
133611
+ function formatPromotionAmount(value) {
133612
+ if (value == null || !Number.isFinite(value)) return "\u2014";
133613
+ return value.toFixed(6).replace(/\.?0+$/, "");
133614
+ }
133615
+ function buildAppliedIncentivesUrl(googleApiUrl, mediaCustomerId) {
133616
+ const base2 = googleApiUrl.replace(/\/$/, "");
133617
+ return `${base2}/query/media-account/${mediaCustomerId}/applied-incentives`;
133618
+ }
133619
+ function readString(row, ...keys) {
133620
+ for (const key of keys) {
133621
+ const value = row[key];
133622
+ if (typeof value === "string" && value.trim()) return value.trim();
133623
+ }
133624
+ return null;
133625
+ }
133626
+ function readMoney(row, ...keys) {
133627
+ for (const key of keys) {
133628
+ if (!(key in row) || row[key] == null) continue;
133629
+ const value = row[key];
133630
+ if (typeof value === "number" && Number.isFinite(value)) return value;
133631
+ if (typeof value === "string" && value.trim() && Number.isFinite(Number(value))) return Number(value);
133632
+ }
133633
+ return null;
133634
+ }
133635
+ function parseAppliedIncentive(raw) {
133636
+ const row = raw && typeof raw === "object" ? raw : {};
133637
+ return {
133638
+ resourceName: readString(row, "resourceName", "ResourceName") ?? "",
133639
+ couponCode: readString(row, "couponCode", "CouponCode") ?? "",
133640
+ incentiveState: readString(row, "incentiveState", "IncentiveState") ?? "",
133641
+ currencyCode: readString(row, "currencyCode", "CurrencyCode"),
133642
+ redemptionDateTime: readString(row, "redemptionDateTime", "RedemptionDateTime"),
133643
+ fulfillmentExpirationDateTime: readString(
133644
+ row,
133645
+ "fulfillmentExpirationDateTime",
133646
+ "FulfillmentExpirationDateTime"
133647
+ ),
133648
+ rewardGrantDateTime: readString(row, "rewardGrantDateTime", "RewardGrantDateTime"),
133649
+ rewardExpirationDateTime: readString(row, "rewardExpirationDateTime", "RewardExpirationDateTime"),
133650
+ rewardAmount: readMoney(row, "rewardAmount", "RewardAmount"),
133651
+ grantedAmount: readMoney(row, "grantedAmount", "GrantedAmount"),
133652
+ requiredMinSpend: readMoney(row, "requiredMinSpend", "RequiredMinSpend"),
133653
+ currentSpendTowardsFulfillment: readMoney(
133654
+ row,
133655
+ "currentSpendTowardsFulfillment",
133656
+ "CurrentSpendTowardsFulfillment"
133657
+ ),
133658
+ rewardBalanceRemaining: readMoney(row, "rewardBalanceRemaining", "RewardBalanceRemaining")
133659
+ };
133660
+ }
133661
+ function parseAppliedIncentiveList(body) {
133662
+ const list = Array.isArray(body) ? body : body && typeof body === "object" && Array.isArray(body.items) ? body.items : null;
133663
+ if (!list) {
133664
+ throw new Error("\u8D60\u9001\u91D1\u63A5\u53E3\u8FD4\u56DE\u7684\u4E0D\u662F\u5217\u8868");
133665
+ }
133666
+ return list.map(parseAppliedIncentive);
133667
+ }
133668
+ function assertGoogleMediaCustomerId2(raw) {
133669
+ try {
133670
+ return requireNumericMediaCustomerId(raw, "--account");
133671
+ } catch (error) {
133672
+ console.error(`
133673
+ \u274C ${error instanceof Error ? error.message : String(error)}
133674
+ `);
133675
+ process.exit(1);
133676
+ }
133677
+ }
133678
+ function formatAppliedIncentivesText(payload) {
133679
+ if (payload.items.length === 0) {
133680
+ return [
133681
+ `\u8D26\u6237 ${payload.mediaCustomerId} \u6CA1\u6709\u5DF2\u5151\u6362\u7684 Google Ads \u8D60\u9001\u91D1\u3002`,
133682
+ "\u672A\u5151\u6362\u7684\u65B0\u5BA2\u4F18\u60E0\u4E0D\u5728\u8FD9\u4E2A\u63A5\u53E3\u91CC\u3002\u8D26\u6237\u9884\u7B97\u8C03\u6574\u5408\u8BA1\u8FD8\u6DF7\u6709\u65E0\u6548\u70B9\u51FB\u8D54\u4ED8\uFF0C\u4E0D\u80FD\u5F53\u6210\u8D60\u9001\u91D1\u3002"
133683
+ ].join("\n");
133684
+ }
133685
+ const blocks = payload.items.map((item, index) => {
133686
+ const currency = item.currencyCode ? ` ${item.currencyCode}` : "";
133687
+ return [
133688
+ `${index + 1}. \u5238\u7801 ${item.couponCode || "\u2014"} ${incentiveStateLabel(item.incentiveState)}\uFF08${item.incentiveState || "\u2014"}\uFF09`,
133689
+ ` \u6700\u9AD8\u53EF\u5F97${currency} ${formatPromotionAmount(item.rewardAmount)} \u5DF2\u53D1\u653E ${formatPromotionAmount(item.grantedAmount)} \u5269\u4F59 ${formatPromotionAmount(item.rewardBalanceRemaining)}`,
133690
+ ` \u6700\u4F4E\u6D88\u8017 ${formatPromotionAmount(item.requiredMinSpend)} \u5DF2\u8BA1\u5165 ${formatPromotionAmount(item.currentSpendTowardsFulfillment)}`,
133691
+ ` \u5151\u6362 ${item.redemptionDateTime ?? "\u2014"} UTC \u8FBE\u6210\u622A\u6B62 ${item.fulfillmentExpirationDateTime ?? "\u2014"} UTC`,
133692
+ ` \u5230\u8D26 ${item.rewardGrantDateTime ?? "\u2014"} UTC \u8D60\u9001\u8FC7\u671F ${item.rewardExpirationDateTime ?? "\u2014"} UTC`
133693
+ ].join("\n");
133694
+ });
133695
+ return [`Google \u8D60\u9001\u91D1\uFF08\u5DF2\u5151\u6362\uFF09 \u8D26\u6237 ${payload.mediaCustomerId} \u5171 ${payload.count} \u6761`, "", ...blocks].join(
133696
+ "\n"
133697
+ );
133698
+ }
133699
+ async function fetchAppliedIncentives(config, mediaCustomerId, verbose) {
133700
+ await ensureDataPermission(config);
133701
+ const url = buildAppliedIncentivesUrl(googleGatewayBase(config), mediaCustomerId);
133702
+ const body = await apiFetch2(url, config, {}, verbose);
133703
+ const items3 = parseAppliedIncentiveList(body);
133704
+ return { mediaCustomerId, count: items3.length, items: items3 };
133705
+ }
133706
+ async function runAccountPromotions(opts) {
133707
+ const mediaCustomerId = assertGoogleMediaCustomerId2(opts.account);
133708
+ const config = loadConfig(opts.token);
133709
+ let payload;
133710
+ try {
133711
+ payload = await fetchAppliedIncentives(config, mediaCustomerId, opts.verbose);
133712
+ } catch (error) {
133713
+ console.error(`
133714
+ \u274C ${error instanceof Error ? error.message : String(error)}
133715
+ `);
133716
+ process.exit(1);
133717
+ }
133718
+ if (await emitCliJsonOrSnapshot(opts, {
133719
+ section: "account-promotions",
133720
+ commandLabel: "account promotions",
133721
+ payload
133722
+ })) {
133723
+ return;
133724
+ }
133725
+ console.log(`
133726
+ ${formatAppliedIncentivesText(payload)}
133727
+ `);
133728
+ }
133729
+
133592
133730
  // src/commands/account-manage/share.ts
133593
133731
  init_dist();
133594
133732
  init_auth();
@@ -134650,6 +134788,21 @@ function register25(program2) {
134650
134788
  });
134651
134789
  }
134652
134790
  );
134791
+ accountCmd.command("promotions").description(
134792
+ "\u67E5\u8BE2 Google \u5DF2\u5151\u6362\u8D60\u9001\u91D1\uFF08\u91D1\u989D\u3001\u5269\u4F59\u3001\u8FBE\u6210\u622A\u6B62\u3001\u8D60\u9001\u5230\u671F\uFF09\u3002\u4EC5 Google\uFF0C\u672A\u53D1\u653E\u5B57\u6BB5\u4E3A null"
134793
+ ).requiredOption(
134794
+ "-a, --account <mediaCustomerId>",
134795
+ "Google mediaCustomerId\uFF08\u7EAF\u6570\u5B57\uFF0C\u6216\u5E26\u8FDE\u5B57\u7B26\u7684 CID\uFF09"
134796
+ ).option("-t, --token <token>", "Auth Token").option("--json-out <path>", "\u843D\u76D8 JSON\uFF1Bstdout \u4E00\u884C\u6458\u8981").option("--verbose", "\u6253\u5370\u8BE6\u7EC6\u9519\u8BEF", false).action(
134797
+ async (opts) => {
134798
+ await runAccountPromotions({
134799
+ account: opts.account,
134800
+ token: opts.token,
134801
+ jsonOut: opts.jsonOut,
134802
+ verbose: opts.verbose
134803
+ });
134804
+ }
134805
+ );
134653
134806
  accountCmd.command("delink").description(
134654
134807
  "\u89E3\u9664\u6388\u6743\uFF1A\u65AD\u5F00\u5E7F\u544A\u8D26\u6237\u4E0E\u5F53\u524D\u4E1D\u8DEF\u8D5E\u8D26\u53F7\u7684\u5173\u8054\uFF08\u7834\u574F\u6027\uFF1B\u987B\u7528\u6237\u786E\u8BA4\u540E\u52A0 --i-confirm + --commit\uFF09"
134655
134808
  ).option("--id <entityId>", "\u5355\u4E2A\u8D26\u6237 entityId\uFF08\u6765\u81EA list-accounts \u7684 ma.entityId \u5B57\u6BB5\uFF09").option("--ids <entityIds>", "\u6279\u91CF entityId\uFF0C\u9017\u53F7\u5206\u9694\uFF08\u4E0E --id \u4E8C\u9009\u4E00\uFF0C\u53EF\u540C\u65F6\u4F20\uFF09").option("--i-confirm", "\u786E\u8BA4\u5DF2\u5411\u7528\u6237\u8BF4\u660E\u89E3\u7ED1\u98CE\u9669\u5E76\u83B7\u5F97\u660E\u786E\u540C\u610F", false).option("-t, --token <token>", "Auth Token").option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
@@ -136852,18 +137005,24 @@ function buildDiagnosisScaffold(signals) {
136852
137005
  // src/commands/website-diagnosis/lighthouse-with-fallback.ts
136853
137006
  init_dist();
136854
137007
  init_auth();
136855
- var LIGHTHOUSE_MAX_ATTEMPTS = 3;
136856
- var LIGHTHOUSE_RETRY_DELAYS_MS = [2e3, 4e3];
137008
+ var LIGHTHOUSE_MAX_ATTEMPTS = 2;
137009
+ var LIGHTHOUSE_RETRY_DELAYS_MS = [2e3];
137010
+ var LIGHTHOUSE_TIMEOUT_MS = 12e4;
136857
137011
  function lighthouseHasScores2(lh) {
136858
137012
  if (!lh || typeof lh !== "object") return false;
136859
137013
  const d = lh.desktop?.score;
136860
137014
  const m = lh.mobile?.score;
136861
137015
  return typeof d === "number" && Number.isFinite(d) || typeof m === "number" && Number.isFinite(m);
136862
137016
  }
137017
+ var LIGHTHOUSE_SEND_FAILURE = /while sending the request|an error occurred while sending the request/i;
136863
137018
  function isLighthouseRetryableError(error) {
137019
+ if (LIGHTHOUSE_SEND_FAILURE.test(error) || /请求超时/.test(error)) return false;
136864
137020
  const status = parseHttpStatusFromError(new Error(error));
136865
137021
  if (status === 401) return false;
136866
- return true;
137022
+ if (error.includes("\u7A7A\u5206\u6570") || error.includes("\u672A\u627E\u5230\u6027\u80FD\u6307\u6807")) return true;
137023
+ if (status === 429 || status !== void 0 && status >= 500 && status < 600) return true;
137024
+ if (/status code (429|5\d\d)/i.test(error)) return true;
137025
+ return false;
136867
137026
  }
136868
137027
  function defaultSleep(ms) {
136869
137028
  return new Promise((resolve26) => {
@@ -136893,7 +137052,8 @@ async function tryTsoLighthouseApi(config, websiteUrl, verbose) {
136893
137052
  `${config.apiBaseUrl}/api/WebsiteDiagnosisReports/performance?url=${encodeURIComponent(websiteUrl)}`,
136894
137053
  config,
136895
137054
  {},
136896
- verbose
137055
+ verbose,
137056
+ LIGHTHOUSE_TIMEOUT_MS
136897
137057
  );
136898
137058
  if (!lighthouseHasScores2(lighthouse)) {
136899
137059
  return { ok: false, error: "TSO Lighthouse API \u8FD4\u56DE\u7A7A\u5206\u6570" };
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: siluzan-tso
3
- description: 丝路赞 TSO 广告平台(Google/Bing/Yandex/TikTok/MetaAd),凡涉及丝路赞/TSO、投广告、出价预算、广告账户管理,或需要做行业分析/市场分析/行业分析报告(含「写一份 XX 行业报告」「电商/制造/医疗等行业报告」「市场调查/战略市场/KA 市场报告」「竞品/GTM/市场格局/行业趋势」等,无论是否提及丝路赞/广告/客户)须加载本 skill。【§零·最高优先】网址/域名/官网+诊断/检测/监测/评估/体检/报告/符合投放要求/能不能投(含「网络诊断」混说)→P8 website-diagnosis collect(禁纯WebFetch/肉眼看页),禁止P9/P1/W3、禁止A/B/C/D追问;细则见 intent-routing.md §零。【§零·B·次高优先】未命中§零时,行业/市场分析报告类话术→必走P9 market-analysis collect+render出HTML,禁止纯WebSearch/WebFetch在对话里写Markdown/HTML当终稿、禁止改走P8/P1/P4/W5/google-analysis;细则见 references/core/intent-routing.md §零·B。【§零·C·关键词规划】Google Ads/谷歌广告拓词、关键词规划/推荐、Keyword Planner、长尾关键词、月搜索量/搜索量、竞争度、核心词/种子词扩词(含「阅读网址/文章/页面后针对核心词出带搜索量词表」,无论是否提及丝路赞/TSO/账户)→必走W5,一次 keyword -k … --google-only --min-monthly-search,禁止分批洗词脚本,禁止WebSearch/WebFetch编造搜索量当终稿;细则见 references/core/intent-routing.md §零·C。【报告/诊断消歧】其余报告类话术禁止默认某一CLI——行业/市场/战略/行业分析报告→P9 market-analysis(必走collect+render,禁止纯WebSearch代替);Google账户ID+健康诊断→P1 google-ads-diagnosis;只要周期数据/8维/花费转化汇总/Excel→P4;Demand Gen/需求开发投放数据分析或汇总报告→P4-DG(demand-gen-render 出 HTML,要 Excel 走对应纲要,不是创建 W3);Google/谷歌广告月度报告、月总结与规划、季度报告、Q3汇总、Q4规划、季度汇报、投放季报、客户版、大族模板、下月规划→P10 google-quarterly;Meta/TikTok/Bing周期→P4/P4-FB;多账户对比→P3/P5;OKKI周报→P6;Google询盘→P7;官网+明确要搜索广告方案/campaign JSON→W3;Meta Instant Form 线索广告→W13;仅要词表+搜索量/竞争度→W5;平台优化报告列表/推送→W7;对象仍不清→Read intent-routing.md。【账户】列表/余额/消耗/激活账单(W1)、多账户余额预警 balance-scan(P2)、多户消耗汇总 accounts-digest(P3)、五大媒体开户与进度(W2)、分享/解绑/MCC/BC/BM/权限(W9)。【投放】**搭建仅 Google+Meta**:Google Search/PMax/Demand Gen(W3,无 Display;Demand Gen 用 ad demand-gen;含 CRUD/PMax/batch W4);Meta Instant Form(W13)。TikTok/Bing/Yandex **不能建广告**。另:拓词 W5、optimize W6。【财务】充值/钱包、转账记录、发票/开票/抬头(W8);写操作审计与 restore。【运营】智能预警 forewarning 创建/启停/记录(W10)、TikTok/Meta 线索 clue(W11)、日周巡检(W12)、宿主编排/投放自控/异常监控(hosted-automation)。【其他】RAG 知识库检索、Meta/Facebook 周期与诊断 HTML、Google/Meta 周期 Excel、多账户 google-analysis-batch。
3
+ description: 丝路赞 TSO 广告平台(Google/Bing/Yandex/TikTok/MetaAd),凡涉及丝路赞/TSO、投广告、出价预算、广告账户管理,或需要做行业分析/市场分析/行业分析报告(含「写一份 XX 行业报告」「电商/制造/医疗等行业报告」「市场调查/战略市场/KA 市场报告」「竞品/GTM/市场格局/行业趋势」等,无论是否提及丝路赞/广告/客户)须加载本 skill。【§零·最高优先】网址/域名/官网+诊断/检测/监测/评估/体检/报告/符合投放要求/能不能投(含「网络诊断」混说)→P8 website-diagnosis collect(禁纯WebFetch/肉眼看页),禁止P9/P1/W3、禁止A/B/C/D追问;细则见 intent-routing.md §零。【§零·B·次高优先】未命中§零时,行业/市场分析报告类话术→必走P9 market-analysis collect+render出HTML,禁止纯WebSearch/WebFetch在对话里写Markdown/HTML当终稿、禁止改走P8/P1/P4/W5/google-analysis;细则见 references/core/intent-routing.md §零·B。【§零·C·关键词规划】Google Ads/谷歌广告拓词、关键词规划/推荐、Keyword Planner、长尾关键词、月搜索量/搜索量、竞争度、核心词/种子词扩词(含「阅读网址/文章/页面后针对核心词出带搜索量词表」,无论是否提及丝路赞/TSO/账户)→必走W5,一次 keyword -k … --google-only --min-monthly-search,禁止分批洗词脚本,禁止WebSearch/WebFetch编造搜索量当终稿;细则见 references/core/intent-routing.md §零·C。【报告/诊断消歧】其余报告类话术禁止默认某一CLI——行业/市场/战略/行业分析报告→P9 market-analysis(必走collect+render,禁止纯WebSearch代替);Google账户ID+健康诊断→P1 google-ads-diagnosis;只要周期数据/8维/花费转化汇总/Excel→P4;Demand Gen/需求开发投放数据分析或汇总报告→P4-DG(demand-gen-render 出 HTML,要 Excel 走对应纲要,不是创建 W3);Google/谷歌广告月度报告、月总结与规划、季度报告、Q3汇总、Q4规划、季度汇报、投放季报、客户版、大族模板、下月规划→P10 google-quarterly;Meta/TikTok/Bing周期→P4/P4-FB;多账户对比→P3/P5;OKKI周报→P6;Google询盘→P7;官网+明确要搜索广告方案/campaign JSON→W3;Meta Instant Form 线索广告→W13;仅要词表+搜索量/竞争度→W5;平台优化报告列表/推送→W7;对象仍不清→Read intent-routing.md。【账户】列表/余额/消耗/激活账单/Google赠送金(W1)、多账户余额预警 balance-scan(P2)、多户消耗汇总 accounts-digest(P3)、五大媒体开户与进度(W2)、分享/解绑/MCC/BC/BM/权限(W9)。【投放】**搭建仅 Google+Meta**:Google Search/PMax/Demand Gen(W3,无 Display;Demand Gen 用 ad demand-gen;含 CRUD/PMax/batch W4);Meta Instant Form(W13)。TikTok/Bing/Yandex **不能建广告**。另:拓词 W5、optimize W6。【财务】充值/钱包、转账记录、发票/开票/抬头(W8);写操作审计与 restore。【运营】智能预警 forewarning 创建/启停/记录(W10)、TikTok/Meta 线索 clue(W11)、日周巡检(W12)、宿主编排/投放自控/异常监控(hosted-automation)。【其他】RAG 知识库检索、Meta/Facebook 周期与诊断 HTML、Google/Meta 周期 Excel、多账户 google-analysis-batch。
4
4
  license: MIT
5
5
  compatibility: 需要 Node.js 18+、已安装 siluzan-tso-cli,通过 send-login-code + login 或 config set 完成鉴权
6
6
  metadata:
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.66",
4
- "publishedAt": 1794218991073
3
+ "version": "1.1.67-beta.2",
4
+ "publishedAt": 1794225066347
5
5
  }
@@ -8,6 +8,7 @@
8
8
  - balance-scan(P2)
9
9
  - accounts-digest(P3)
10
10
  - stats
11
+ - account promotions(Google 赠送金)
11
12
 
12
13
  ## balance-scan — 多账户余额续航扫描
13
14
 
@@ -260,3 +261,29 @@ siluzan-tso stats -m Google -a <mediaCustomerId> --json-out ./snap
260
261
  ```
261
262
 
262
263
  ---
264
+
265
+ ## account promotions — Google 已兑换赠送金
266
+
267
+ 只查 **已经兑换到这个 Google 广告账户上** 的赠送金。网关 `GET {googleApiUrl}/query/media-account/{id}/applied-incentives`,对应 Google Ads `applied_incentive`([Incentives](https://developers.google.com/google-ads/api/docs/billing/incentives))。Sammamish:`MediaAccountQueryController.GetAppliedIncentivesAsync` → `AppliedIncentiveService`。
268
+
269
+ ```bash
270
+ siluzan-tso account promotions -a <mediaCustomerId>
271
+ siluzan-tso account promotions -a 123-456-7890 --json-out ./snap
272
+ ```
273
+
274
+ | 字段 | 含义 |
275
+ | --- | --- |
276
+ | `incentiveState` | `Redeemed` 已兑换待消耗;`Fulfilled` 已达成但未到账;`RewardGranted` 已到账;`Expired` 未达成过期;`RewardExpired` 赠送过期;`RewardExhausted` 已用完;`Invalidated` 作废 |
277
+ | `rewardAmount` | 最高可得,主币种 |
278
+ | `grantedAmount` | 实际发放。未发放为 **null**,禁止写成 0 |
279
+ | `rewardBalanceRemaining` | 剩余赠送金。未发放为 **null** |
280
+ | `requiredMinSpend` / `currentSpendTowardsFulfillment` | 达成条件所需消耗 / 已计入消耗 |
281
+ | `fulfillmentExpirationDateTime` | 达成条件的截止时间,UTC `yyyy-MM-dd HH:mm:ss` |
282
+ | `rewardGrantDateTime` / `rewardExpirationDateTime` | 到账时间 / 赠送失效时间。未发放为 null |
283
+ | `currencyCode` / `couponCode` | 币种、券码 |
284
+
285
+ 时间是 Google 的 UTC 原文,不要自行换算时区。空列表表示没有已兑换赠送金。未兑换的新客优惠不在本命令里。`account_budget.total_adjustments` 还混有无效点击赔付和超投抵扣,**禁止**把它说成赠送金。
286
+
287
+ 开发者令牌若未开通 Incentives,接口会失败并带回 Google 的错误原文。这和「该户没有赠送金」不是一回事:失败要原文告诉用户,空数组才是没有记录。
288
+
289
+ ---
@@ -170,7 +170,7 @@ siluzan-tso account-history --start 2026-03-01 --end 2026-03-31 --json-out ./sna
170
170
  | 状态 | 含义 | 下一步操作 |
171
171
  | ---------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
172
172
  | `Pending` | 审核中 | 等待,可反复运行此命令轮询;审核周期因媒体而异 |
173
- | `Approved` | 审核通过 | 运行 `list-accounts -m <媒体>` 确认账户已出现;引导用户充值激活(`config show` 取 `webUrl`,按 `finance.md` 打开对应媒体充值页;例如 Google 为 `https://www.siluzan.com/v3/foreign_trade/tso/recharge/pay?mediaType=Google`;Yandex 当前没有对应充值界面) |
173
+ | `Approved` | 审核通过 | 运行 `list-accounts -m <媒体>` 确认账户已出现;引导用户充值激活(`config show` 取 `webUrl`,按 `finance.md` 打开对应媒体充值页;例如 Google 为 `https://www-ci.siluzan.com/v3/foreign_trade/tso/recharge/pay?mediaType=Google`;Yandex 当前没有对应充值界面) |
174
174
  | `Rejected` | 被拒 | 查看 `--json-out` 落盘中的 `reason` 字段了解拒绝原因;修改资料后重新提交;若原因不明,引导用户联系丝路赞客服 |
175
175
 
176
176
  ---
@@ -490,7 +490,7 @@ siluzan-tso account email-deauth -c <mediaCustomerId> --invitation-id <id> --res
490
490
 
491
491
  | 功能 | 媒体 | 网页路径 |
492
492
  | --------------------------------------- | ------ | ------------------------------------------------- |
493
- | **账户激活**(邀请他人激活 / 充值激活) | Google | `https://www.siluzan.com/v3/foreign_trade/tso/manageAccounts` |
493
+ | **账户激活**(邀请他人激活 / 充值激活) | Google | `https://www-ci.siluzan.com/v3/foreign_trade/tso/manageAccounts` |
494
494
 
495
495
  **Agent 建议话术**:
496
496
 
@@ -499,5 +499,5 @@ siluzan-tso account email-deauth -c <mediaCustomerId> --invitation-id <id> --res
499
499
  siluzan-tso config show # 查看 webUrl 字段
500
500
 
501
501
  # 账户激活(Google)→ 引导至账户管理页
502
- # https://www.siluzan.com/v3/foreign_trade/tso/manageAccounts
502
+ # https://www-ci.siluzan.com/v3/foreign_trade/tso/manageAccounts
503
503
  ```
@@ -126,7 +126,7 @@ siluzan-tso config show
126
126
 
127
127
  ### 充值页链接(按媒体 × 类型)
128
128
 
129
- 链接模式:`https://www.siluzan.com/v3/foreign_trade/tso/recharge/<page>?mediaType=<mediaType>`;丝路赞钱包:`https://www.siluzan.com/v3/foreign_trade/tso/recharge/siluzanWallet`(无媒体参数)。
129
+ 链接模式:`https://www-ci.siluzan.com/v3/foreign_trade/tso/recharge/<page>?mediaType=<mediaType>`;丝路赞钱包:`https://www-ci.siluzan.com/v3/foreign_trade/tso/recharge/siluzanWallet`(无媒体参数)。
130
130
 
131
131
  | 充值类型 | `<page>` | 支持媒体(`mediaType` 参数) |
132
132
  | ------------------------- | --------------------- | ------------------------------------------- |
@@ -1,6 +1,6 @@
1
1
  # 各媒体开户
2
2
 
3
- > 网页链接:`https://www.siluzan.com/v3/foreign_trade/tso/accountOpeningHistory?tso=%2Fv3umijs%2Ftso%2FaccountOpeningHistory`
3
+ > 网页链接:`https://www-ci.siluzan.com/v3/foreign_trade/tso/accountOpeningHistory?tso=%2Fv3umijs%2Ftso%2FaccountOpeningHistory`
4
4
  > 多命令串联见 `references/core/workflows.md` § 流程一。
5
5
 
6
6
  ## Contents
@@ -65,7 +65,7 @@ siluzan-tso open-account google-wizard
65
65
 
66
66
  ```bash
67
67
  siluzan-tso account-history -m Google
68
- # 审核通过后:config show → https://www.siluzan.com/v3/foreign_trade/tso/recharge/pay?mediaType=Google
68
+ # 审核通过后:config show → https://www-ci.siluzan.com/v3/foreign_trade/tso/recharge/pay?mediaType=Google
69
69
  ```
70
70
 
71
71
  ---
@@ -1,6 +1,6 @@
1
1
  # rag:知识库检索(TSO 广告投放辅助)
2
2
 
3
- 知识库管理页面在 https://www.siluzan.com/knowledge-base/
3
+ 知识库管理页面在 https://www-ci.siluzan.com/knowledge-base/
4
4
 
5
5
  为 **广告投放、账户分析、拓词、诊断报告** 等 TSO 业务提供**企业已入库**的产品、行业、客户背景事实依据。
6
6
 
@@ -190,9 +190,9 @@ siluzan-tso report push receive-emails -m Google [--json-out ./snap]
190
190
 
191
191
  | 媒体 | 报告类型 | URL 模板 |
192
192
  | ------ | ---------------- | ----------------------------------------------------------- |
193
- | Google | 日报(Daily) | `https://www.siluzan.com/media-report/publish/{entityId}?culture=zh-CN` |
194
- | Google | 小时报(Hourly) | `https://www.siluzan.com/media-report/hour/{entityId}?culture=zh-CN` |
195
- | TikTok | 日报 | `https://www.siluzan.com/media-report/publish/{entityId}?culture=zh-CN` |
193
+ | Google | 日报(Daily) | `https://www-ci.siluzan.com/media-report/publish/{entityId}?culture=zh-CN` |
194
+ | Google | 小时报(Hourly) | `https://www-ci.siluzan.com/media-report/hour/{entityId}?culture=zh-CN` |
195
+ | TikTok | 日报 | `https://www-ci.siluzan.com/media-report/publish/{entityId}?culture=zh-CN` |
196
196
 
197
197
  `entityId` 来自 `siluzan-tso report list --json-out ./snap` 中每条记录的 `entityId` 字段。
198
198
 
@@ -205,8 +205,8 @@ siluzan-tso report list -m Google --json-out ./snap
205
205
 
206
206
  # 第二步:查看 webUrl
207
207
  siluzan-tso config show
208
- # webUrl: https://www.siluzan.com
208
+ # webUrl: https://www-ci.siluzan.com
209
209
 
210
210
  # 第三步:拼接链接(Google 日报)
211
- # https://www.siluzan.com/media-report/publish/rpt_abc123?culture=zh-CN
211
+ # https://www-ci.siluzan.com/media-report/publish/rpt_abc123?culture=zh-CN
212
212
  ```
@@ -65,7 +65,7 @@ siluzan-tso website-diagnosis render --data ./diagnosis.json --collect ./snap-we
65
65
 
66
66
  ## 数据缺失降级(Lighthouse 等)
67
67
 
68
- **统一策略(P8 / P1 着陆页共用)**:打 TSO `WebsiteDiagnosisReports/performance`(失败自动重试,最多 3 次)。**不再**用 HTML 下载耗时冒充 Lighthouse。拿不到分则 `lighthouseSource` / `landingPageAnalysis.source` = `none`,`m2i1`/`m5i1` 标 Absent。**禁止**编造 score/FCP。表单/导航等结构信号来自 collect 的 `signals`(完整 HTML),与测速成败无关。
68
+ **统一策略(P8 / P1 着陆页共用)**:打 TSO `WebsiteDiagnosisReports/performance`。这一次请求限时 120 秒。发送失败(正文含 `while sending the request`)和超时不重试;空分数、指标解析失败、429、5xx 最多再试 1 次。**不再**用 HTML 下载耗时冒充 Lighthouse。拿不到分则 `lighthouseSource` / `landingPageAnalysis.source` = `none`,`m2i1`/`m5i1` 标 Absent。**禁止**编造 score/FCP。表单/导航等结构信号来自 collect 的 `signals`(完整 HTML),与测速成败无关。
69
69
 
70
70
  `collect` **不会**因 Lighthouse 失败而中止;落盘含 `lighthouseWarning` 与:
71
71
 
@@ -10,7 +10,7 @@
10
10
  ## 安装 CLI
11
11
 
12
12
  ```bash
13
- npm install -g siluzan-tso-cli
13
+ npm install -g siluzan-tso-cli@beta
14
14
  ```
15
15
 
16
16
  ---
@@ -64,7 +64,7 @@ siluzan-tso config set --api-key <Key> # 或 config 直接写入
64
64
  siluzan-tso config set --token <Token> # 备用:设置 JWT Token
65
65
  ```
66
66
 
67
- API Key 获取入口:`https://www.siluzan.com/v3/foreign_trade/settings/apiKeyManagement`
67
+ API Key 获取入口:`https://www-ci.siluzan.com/v3/foreign_trade/settings/apiKeyManagement`
68
68
 
69
69
  ```bash
70
70
  # 第 1 步:让用户报出手机号后,立刻发码(命令立即返回,不会等待输入)
@@ -127,9 +127,9 @@ siluzan-tso config show
127
127
 
128
128
  ```
129
129
  构建环境 : production
130
- apiBaseUrl : https://tso-api.siluzan.com
131
- googleApiUrl : https://googleapi.mysiluzan.com
132
- webUrl : https://www.siluzan.com
130
+ apiBaseUrl : https://tso-api-ci.siluzan.com
131
+ googleApiUrl : https://googleapi-ci.mysiluzan.com
132
+ webUrl : https://www-ci.siluzan.com
133
133
  apiKey : abcd****1234
134
134
  ```
135
135
 
@@ -24,13 +24,14 @@
24
24
 
25
25
  ## W1 · 账户查询(列表 / 余额 / 消耗 / 账单)
26
26
 
27
- - **触发**:账户列表/有多少、单户余额、单户消耗、激活充值账单。
27
+ - **触发**:账户列表/有多少、单户余额、单户消耗、激活充值账单、Google 赠送金。
28
28
  - **必读**:`references/accounts/accounts-list.md` + `accounts-balance-stats.md`。
29
29
  - **步骤**:
30
30
  1. 列表/数量:`list-accounts -m <媒体> --page-size 999 --json-out ./snap`,脚本读 `list-accounts-*.json` 的 `total` / `items[]`(**禁止**默认 20 条再翻页)。
31
31
  2. 单户余额:`balance -m <媒体> -a <mediaCustomerId>`(Yandex 用 `porg-…`,**不是** `entityId`)。
32
32
  3. 单户消耗:`stats -m <媒体> -a <mediaCustomerId> --start <S> --end <D>`(用户已给账户号则原样入 `-a`;空/`403` 先核验 ID,见 `accounts-balance-stats.md`;按日 Excel → **P4-DAILY**;多账户对比 → **P3**)。
33
33
  4. 激活账单:先取 `entityId` → `account-active-bills -m <媒体> --id <entityId> --json-out ./snap`。
34
+ 5. Google 赠送金:`account promotions -a <mediaCustomerId> --json-out ./snap`。只含已兑换赠金;未发放字段为 null,不要写成 0。细则见 `accounts-balance-stats.md`。
34
35
  - **产物**:多账户余额预警走 **P2**、消耗汇总走 **P3**。
35
36
 
36
37
  ---
@@ -6,7 +6,7 @@
6
6
  siluzan-tso config show # 取 webUrl
7
7
  ```
8
8
 
9
- 首页地址:`https://www.siluzan.com/v3/foreign_trade/tso/home`
9
+ 首页地址:`https://www-ci.siluzan.com/v3/foreign_trade/tso/home`
10
10
 
11
11
  ---
12
12
 
@@ -25,7 +25,7 @@ siluzan-tso config show # 取 webUrl
25
25
 
26
26
  ## 推荐话术
27
27
 
28
- 1. **「和首页一样的总览」** → 打开 `https://www.siluzan.com/v3/foreign_trade/tso/home`。
28
+ 1. **「和首页一样的总览」** → 打开 `https://www-ci.siluzan.com/v3/foreign_trade/tso/home`。
29
29
  2. **「某个 Google 账户昨天花了多少」** → `list-accounts -m Google` + `stats -m Google -a <id>`。
30
30
  3. **「有待充值账户」** → 说明聚合数据在首页;CLI 可 `list-accounts` + `balance` 逐户排查,或引导充值页。
31
31
 
@@ -9,11 +9,11 @@ $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.66'
12
+ $PKG_VERSION = '1.1.67-beta.2'
13
13
  $CLI_BIN = 'siluzan-tso'
14
14
  $SKILL_LABEL = 'Siluzan TSO'
15
- $INSTALL_CMD = 'npm install -g siluzan-tso-cli'
16
- $WEB_BASE = 'https://www.siluzan.com'
15
+ $INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
16
+ $WEB_BASE = 'https://www-ci.siluzan.com'
17
17
 
18
18
  # -- Constants ----------------------------------------------------------------
19
19
  $NODE_MAJOR_MIN = 18
@@ -9,11 +9,11 @@ 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.66"
12
+ readonly PKG_VERSION="1.1.67-beta.2"
13
13
  readonly CLI_BIN="siluzan-tso"
14
14
  readonly SKILL_LABEL="Siluzan TSO"
15
- readonly INSTALL_CMD="npm install -g siluzan-tso-cli"
16
- readonly WEB_BASE="https://www.siluzan.com"
15
+ readonly INSTALL_CMD="npm install -g siluzan-tso-cli@beta"
16
+ readonly WEB_BASE="https://www-ci.siluzan.com"
17
17
 
18
18
  # -- Constants ----------------------------------------------------------------
19
19
  readonly NODE_MAJOR_MIN=18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-tso-cli",
3
- "version": "1.1.66",
3
+ "version": "1.1.67-beta.2",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "keywords": [
6
6
  "ad-account",