siluzan-tso-cli 1.1.37-beta.11 → 1.1.37-beta.12

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.37-beta.11),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
54
+ > **注意**:当前为测试版(1.1.37-beta.12),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
55
55
 
56
56
  | 助手 | 建议 `--ai` |
57
57
  | ----------------------- | ------------------------------------ |
package/dist/index.js CHANGED
@@ -2202,6 +2202,11 @@ function skipAuthSetupInAgentEnv(commandLabel) {
2202
2202
  }
2203
2203
  return true;
2204
2204
  }
2205
+ function blockMediaAccountOAuthInAgentEnv(_commandLabel) {
2206
+ if (!isSiluzanAgentEnv()) return false;
2207
+ console.log("\u8BF7\u4F7F\u7528 present_reauth \u5B8C\u6210\u6388\u6743");
2208
+ return true;
2209
+ }
2205
2210
  function trimOrUndefined(value) {
2206
2211
  const trimmed = value?.trim();
2207
2212
  return trimmed ? trimmed : void 0;
@@ -121646,6 +121651,15 @@ async function runAccountMccUnbind(opts) {
121646
121651
  }
121647
121652
 
121648
121653
  // src/commands/account-manage/google-access-permission.ts
121654
+ function hintGoogleOAuth(kind) {
121655
+ if (isSiluzanAgentEnv()) {
121656
+ return "\u8BF7\u4F7F\u7528 present_reauth \u5B8C\u6210\u6388\u6743";
121657
+ }
121658
+ if (kind === "reauth") {
121659
+ return "list-accounts --json-out \u53D6 ma.entityId \u540E\u6267\u884C\uFF1Asiluzan-tso account reauth -m Google --id <entityId>";
121660
+ }
121661
+ return "\u6267\u884C siluzan-tso account auth -m Google \u5B8C\u6210 OAuth \u7ED1\u5B9A\u3002";
121662
+ }
121649
121663
  function assertGoogleMediaCustomerId(raw) {
121650
121664
  const id = raw.trim();
121651
121665
  if (!id) {
@@ -121692,7 +121706,7 @@ function interpretCustomerAccessPermission(mediaCustomerId, httpStatus, rawBody)
121692
121706
  status: "reauth_required",
121693
121707
  accessible: false,
121694
121708
  message: "\u8D26\u6237\u5DF2\u7ED1\u5B9A\u4F46 Google OAuth \u4E0D\u53EF\u7528\uFF0C\u9700\u91CD\u65B0\u6388\u6743\u3002",
121695
- hint: "list-accounts --json-out \u53D6 ma.entityId \u540E\u6267\u884C\uFF1Asiluzan-tso account reauth -m Google --id <entityId>"
121709
+ hint: hintGoogleOAuth("reauth")
121696
121710
  };
121697
121711
  }
121698
121712
  return {
@@ -121710,7 +121724,7 @@ function interpretCustomerAccessPermission(mediaCustomerId, httpStatus, rawBody)
121710
121724
  status: "google_not_bound",
121711
121725
  accessible: false,
121712
121726
  message: "\u5F53\u524D\u4E1D\u8DEF\u8D5E\u8D26\u53F7\u672A\u7ED1\u5B9A Google \u5A92\u4F53\u6388\u6743\u3002",
121713
- hint: "\u6267\u884C siluzan-tso account auth -m Google \u5B8C\u6210 OAuth \u7ED1\u5B9A\u3002"
121727
+ hint: hintGoogleOAuth("auth")
121714
121728
  };
121715
121729
  }
121716
121730
  return {
@@ -121977,13 +121991,16 @@ async function runAccountShareDetail(opts) {
121977
121991
  }
121978
121992
 
121979
121993
  // src/commands/account-manage/oauth.ts
121980
- init_auth();
121981
121994
  init_dist();
121995
+ init_auth();
121982
121996
  function toApiMediaType(media) {
121983
121997
  return media === "Meta" ? "FacebookAds" : media;
121984
121998
  }
121985
121999
  var tryOpenBrowser = tryOpenHttpsUrlInBrowser;
121986
122000
  async function runAccountAuth(opts) {
122001
+ if (blockMediaAccountOAuthInAgentEnv("account auth")) {
122002
+ process.exit(1);
122003
+ }
121987
122004
  const config = loadConfig(opts.token);
121988
122005
  const apiMediaType = toApiMediaType(opts.media);
121989
122006
  const webUrl = deriveWebUrl(config.apiBaseUrl);
@@ -122015,6 +122032,9 @@ async function runAccountAuth(opts) {
122015
122032
  });
122016
122033
  }
122017
122034
  async function runAccountReauth(opts) {
122035
+ if (blockMediaAccountOAuthInAgentEnv("account reauth")) {
122036
+ process.exit(1);
122037
+ }
122018
122038
  if (!opts.id && (!opts.ids || opts.ids.length === 0)) {
122019
122039
  console.error(
122020
122040
  "\n\u274C \u91CD\u65B0\u6388\u6743\u987B\u6307\u5B9A\u8981\u89E3\u7ED1\u7684\u8D26\u6237 entityId\uFF1A--id <entityId> \u6216 --ids id1,id2\n entityId \u6765\u81EA list-accounts --json-out \u7684 ma.entityId\uFF08\u4E0D\u662F mediaCustomerId\uFF09\n"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.37-beta.11",
4
- "publishedAt": 1784275362257
3
+ "version": "1.1.37-beta.12",
4
+ "publishedAt": 1784276742609
5
5
  }
@@ -335,12 +335,6 @@ siluzan-tso account check-access -a 4256317784 --json-out ./snap-access
335
335
 
336
336
  ---
337
337
 
338
- ### auth — 添加媒体平台 OAuth 授权(首次绑定)
339
-
340
- 在浏览器中打开对应媒体的 OAuth 授权页面,授权后账户自动绑定到丝路赞。对应网页 **「添加授权」**。
341
-
342
- > **OAuth 已失效**(`invalidOAuthToken=true`)时**不要**用本命令,须走下方 **`reauth`**(重新授权必须先解绑)。
343
-
344
338
  ```bash
345
339
  siluzan-tso account auth -m <媒体类型>
346
340
  ```
@@ -349,7 +343,7 @@ siluzan-tso account auth -m <媒体类型>
349
343
  | -------------------- | ------------------------------------------------------------------------ |
350
344
  | `-m, --media <type>` | 媒体类型(必填):`Google \| TikTok \| Meta \| Yandex \| BingV2 \| Kwai` |
351
345
 
352
- **示例:**
346
+ **示例(仅本地 / 非 Siluzan Agent CLI):**
353
347
 
354
348
  ```bash
355
349
  # 首次授权 Google Ads 账户
@@ -362,9 +356,9 @@ siluzan-tso account auth -m TikTok
362
356
  siluzan-tso account auth -m Meta
363
357
  ```
364
358
 
365
- > CLI 会自动在系统默认浏览器中打开授权页;无法打开时输出 URL 供手动粘贴。授权完成后会跳回丝路赞,账户立即生效。
359
+ > CLI 会自动在系统默认浏览器中打开授权页;无法打开时输出 URL 供手动粘贴。授权完成后会跳回丝路赞 TSO 绑定页,账户立即生效。
366
360
  >
367
- > **Agent 硬约束(auth / reauth 共通)**:CLI stdout 会打印完整 `https://…` OAuth 链接(Agent 沙箱不会自动开浏览器)。**必须把该 URL 原样贴进给用户的回复**,禁止只说「链接已生成 / 我这边还有链接」却不贴出;用户无法从工具日志自行翻找。
361
+ > **非 Agent 环境**若仍用手跑 CLIstdout 打印的完整 `https://…` OAuth 链接须原样贴给用户(沙箱不会自动开浏览器)。
368
362
 
369
363
  ---
370
364
 
@@ -372,6 +366,8 @@ siluzan-tso account auth -m Meta
372
366
 
373
367
  OAuth 失效时恢复授权。对齐 TSO 网页 **「重新授权」**:程序会先 **delink** 断开关联,再跳转媒体 OAuth。**禁止**对失效账户跳过解绑直接用 `account auth`。
374
368
 
369
+ > **Siluzan Agent**:同 `auth`——**禁止**执行;须走 **connectors / 平台授权工具**。CLI 拦截时不会先解绑。
370
+
375
371
  ```bash
376
372
  siluzan-tso account reauth -m <媒体类型> --id <entityId>
377
373
  siluzan-tso account reauth -m Google --ids <id1,id2>
@@ -383,7 +379,7 @@ siluzan-tso account reauth -m Google --ids <id1,id2>
383
379
  | `--id <entityId>` | 单个账户 `entityId`(来自 `list-accounts` 的 `ma.entityId`) |
384
380
  | `--ids <id1,id2>` | 批量 `entityId`,逗号分隔(与 `--id` 二选一) |
385
381
 
386
- **示例:**
382
+ **示例(仅本地 / 非 Siluzan Agent CLI):**
387
383
 
388
384
  ```bash
389
385
  # 1. 查失效账户的 entityId
@@ -396,13 +392,13 @@ siluzan-tso account reauth -m BingV2 --id <entityId> --commit "重新授权 Bing
396
392
  siluzan-tso list-accounts -m BingV2 -k <mediaCustomerId>
397
393
  ```
398
394
 
399
- **执行后 Agent 必须:**
395
+ **本地 CLI 执行后须:**
400
396
 
401
397
  1. 从 CLI 输出中提取 OAuth URL(含 `login.microsoftonline.com` / Google 等),**原样发给用户**并说明「请在浏览器打开完成授权」。
402
398
  2. 说明:步骤 1 已 delink,账户可能暂时从 `list-accounts` 消失;用户完成授权前无法拉数。
403
399
  3. 若用户之后才说要绑定回来、且当时未贴链接:再跑 **`account auth -m <媒体>`**(勿再 `reauth`——已无 entityId),把**新**链接贴出。勿声称「还有刚才的链接」却不粘贴。
404
400
 
405
- > 手动两步等价于 `reauth`:`account delink --id …` → `account auth -m …`(须用户确认解绑风险)。
401
+ > 手动两步等价于 `reauth`:`account delink --id …` → `account auth -m …`(须用户确认解绑风险;**Agent 环境仍勿用**)。
406
402
 
407
403
  ---
408
404
 
@@ -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.37-beta.11'
12
+ $PKG_VERSION = '1.1.37-beta.12'
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.37-beta.11"
12
+ readonly PKG_VERSION="1.1.37-beta.12"
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.37-beta.11",
3
+ "version": "1.1.37-beta.12",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "keywords": [
6
6
  "ad-account",