@thinkingai/ae-cli 6.0.55 → 6.0.56

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 (118) hide show
  1. package/README.md +24 -3
  2. package/README.zh.md +24 -3
  3. package/dist/{auth-RQBO6MTY.js → auth-U7MNUUEF.js} +37 -13
  4. package/dist/{automation-VAAQBM7Y.js → automation-K32V2NKP.js} +94 -38
  5. package/dist/{capability-JRIFC4AJ.js → capability-VV7RHB3B.js} +8 -7
  6. package/dist/{chunk-CT7QDJS6.js → chunk-2IYIYSUO.js} +2 -2
  7. package/dist/{chunk-3YVEAZUN.js → chunk-2UWS5CUP.js} +32 -21
  8. package/dist/{chunk-374V5R6N.js → chunk-3TQA5RXE.js} +3 -3
  9. package/dist/{chunk-6VNIR4AP.js → chunk-ELCR235M.js} +26 -19
  10. package/dist/{chunk-7KU2WNQE.js → chunk-F6NIPIT5.js} +7 -6
  11. package/dist/{chunk-RPBOAQQQ.js → chunk-GI5BMEZO.js} +1 -1
  12. package/dist/chunk-JJJIP2XQ.js +105 -0
  13. package/dist/{chunk-5XJYLEVC.js → chunk-KHS64JZQ.js} +4 -4
  14. package/dist/{chunk-ZL7SGNIA.js → chunk-LMCYSVVA.js} +11 -13
  15. package/dist/{chunk-VZZNLV3I.js → chunk-MXV3PYC3.js} +14 -6
  16. package/dist/{chunk-OP44TT4H.js → chunk-P6VFCH3P.js} +4 -2
  17. package/dist/{chunk-GHXZK54S.js → chunk-P7KL7IOH.js} +41 -13
  18. package/dist/{chunk-AP7YP2NX.js → chunk-QSAR3GHY.js} +2 -2
  19. package/dist/{chunk-S6M42KND.js → chunk-T44M3PLZ.js} +1 -1
  20. package/dist/{chunk-Q5US7JC5.js → chunk-UUD5RB36.js} +3 -3
  21. package/dist/{chunk-RGYPSEYD.js → chunk-W2PTY5NN.js} +3 -3
  22. package/dist/chunk-X7DRLE62.js +233 -0
  23. package/dist/{chunk-WNGFSIOB.js → chunk-ZW4VMY5H.js} +103 -6
  24. package/dist/{community-report-client-PEERQCX2.js → community-report-client-S2K3A3Q6.js} +1 -1
  25. package/dist/{config-SICKWZ2A.js → config-ASSAAIOI.js} +10 -9
  26. package/dist/{context-NGVFPCBK.js → context-6RWLVOM5.js} +4 -4
  27. package/dist/{data-integration-BCLQFTGU.js → data-integration-EXSUPUDZ.js} +6 -6
  28. package/dist/evaluation-5YT4QLCL.js +3714 -0
  29. package/dist/index.js +93 -49
  30. package/dist/{local-data-upload-client-TWMHFLUA.js → local-data-upload-client-7HCPGIS3.js} +1 -1
  31. package/dist/{memory-CQKH2JAV.js → memory-VCYLVPMI.js} +6 -6
  32. package/dist/{metadata-EMFGUI2W.js → metadata-TIWIOFTU.js} +8 -8
  33. package/dist/{model-VX5M2CJ6.js → model-DPJHSD73.js} +4 -4
  34. package/dist/{personal-semantic-preference-SLWVVYZ4.js → personal-semantic-preference-SBKU2LOK.js} +6 -6
  35. package/dist/{project-semantic-DPSZBKQD.js → project-semantic-SKNWLH3I.js} +6 -6
  36. package/dist/{sync-RZIAV37C.js → sync-7PP6KQ75.js} +7 -7
  37. package/dist/{te-agent-AORRE2FM.js → te-agent-L2BYNPHM.js} +753 -94
  38. package/dist/{te-analysis-ISXKJKRT.js → te-analysis-RJB6VJC4.js} +411 -79
  39. package/dist/{te-community-42M7ICDO.js → te-community-QN3WMPNT.js} +6 -4
  40. package/dist/{te-dataops-BNKNZ4F2.js → te-dataops-UKD2XN3E.js} +8 -6
  41. package/dist/{te-engage-BZE3MBKT.js → te-engage-KPTN4N2U.js} +6 -6
  42. package/dist/{te-kb-ULATOTQ3.js → te-kb-SFZI3W5T.js} +7 -7
  43. package/dist/{te-system-UGHVKBVV.js → te-system-IE7NCKC3.js} +6 -6
  44. package/dist/{te-team-YA6SNOJ3.js → te-team-4KHCFM2I.js} +63 -41
  45. package/dist/{things-DTCOQIQB.js → things-7JJUVAWL.js} +7 -7
  46. package/dist/{update-ESNYKUVR.js → update-AX66IFMJ.js} +4 -4
  47. package/dist/{workspace-JEOHKFPX.js → workspace-Q5NMEKEN.js} +6 -6
  48. package/package.json +11 -7
  49. package/skills/ae-agent/SKILL.md +20 -3
  50. package/skills/ae-agent/references/command_index.md +8 -0
  51. package/skills/ae-agent/references/resource-package.md +53 -0
  52. package/skills/ae-analysis/SKILL.md +12 -3
  53. package/skills/ae-analysis/references/adhoc_export.md +1 -1
  54. package/skills/ae-analysis/references/agent_review_preflight.md +4 -0
  55. package/skills/ae-analysis/references/agent_review_submit_to_page.md +4 -0
  56. package/skills/ae-analysis/references/ai_models/event.md +58 -2
  57. package/skills/ae-analysis/references/ai_models/rank_list.md +1 -0
  58. package/skills/ae-analysis/references/ai_models/retention.md +2 -0
  59. package/skills/ae-analysis/references/ai_models/revenue.md +2 -0
  60. package/skills/ae-analysis/references/analysis_data_export.md +11 -1
  61. package/skills/ae-analysis/references/asset_batch_info_export.md +2 -2
  62. package/skills/ae-analysis/references/asset_batch_sql_export.md +2 -2
  63. package/skills/ae-analysis/references/asset_export.md +1 -1
  64. package/skills/ae-analysis/references/bi_panel_page_data_export.md +1 -1
  65. package/skills/ae-analysis/references/check_export.md +1 -1
  66. package/skills/ae-analysis/references/command_index.md +34 -25
  67. package/skills/ae-analysis/references/dashboard_report_data_export.md +2 -0
  68. package/skills/ae-analysis/references/dashboard_report_get.md +6 -2
  69. package/skills/ae-analysis/references/dashboard_report_update.md +24 -5
  70. package/skills/ae-analysis/references/feedback_submit.md +1 -1
  71. package/skills/ae-analysis/references/governance_recommendation_export.md +10 -2
  72. package/skills/ae-analysis/references/live_data_export.md +1 -1
  73. package/skills/ae-analysis/references/metric_create.md +29 -0
  74. package/skills/ae-analysis/references/metric_get.md +2 -0
  75. package/skills/ae-analysis/references/metric_update.md +2 -0
  76. package/skills/ae-analysis/references/operation_record_export.md +1 -1
  77. package/skills/ae-analysis/references/plan_change_log_export.md +1 -1
  78. package/skills/ae-analysis/references/plan_export.md +1 -1
  79. package/skills/ae-analysis/references/project_info_get.md +4 -0
  80. package/skills/ae-analysis/references/project_member_group_add_members.md +35 -0
  81. package/skills/ae-analysis/references/project_member_group_create.md +25 -0
  82. package/skills/ae-analysis/references/project_member_group_delete.md +34 -0
  83. package/skills/ae-analysis/references/project_member_group_list.md +29 -0
  84. package/skills/ae-analysis/references/project_member_group_members.md +28 -0
  85. package/skills/ae-analysis/references/project_member_group_remove_members.md +35 -0
  86. package/skills/ae-analysis/references/project_member_group_rename.md +26 -0
  87. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +6 -1
  88. package/skills/ae-analysis/references/report_data_export.md +1 -1
  89. package/skills/ae-analysis/references/scenario_append.md +25 -0
  90. package/skills/ae-analysis/references/scenario_collect.md +35 -0
  91. package/skills/ae-analysis/references/scenario_evaluation.md +30 -0
  92. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +73 -4
  93. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +5 -1
  94. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/execution-contract.mjs +173 -0
  95. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +109 -64
  96. package/skills/ae-automation/SKILL.md +2 -2
  97. package/skills/ae-automation/references/cli.md +18 -1
  98. package/skills/ae-capability/SKILL.md +7 -3
  99. package/skills/ae-evaluation/SKILL.md +83 -0
  100. package/skills/ae-evaluation/references/access-and-members.md +55 -0
  101. package/skills/ae-evaluation/references/connections.md +78 -0
  102. package/skills/ae-evaluation/references/datasets.md +57 -0
  103. package/skills/ae-evaluation/references/evaluators.md +81 -0
  104. package/skills/ae-evaluation/references/files.md +33 -0
  105. package/skills/ae-evaluation/references/integrations.md +39 -0
  106. package/skills/ae-evaluation/references/runs.md +160 -0
  107. package/skills/ae-evaluation/references/schedules.md +31 -0
  108. package/skills/ae-metadata/SKILL.md +2 -1
  109. package/skills/ae-metadata/references/metadata_data_table_download.md +7 -1
  110. package/skills/ae-metadata/references/metadata_data_table_get.md +2 -0
  111. package/skills/ae-team/SKILL.md +2 -2
  112. package/skills/ae-team/references/run-start.md +1 -0
  113. package/skills/ae-team/references/run-watch.md +7 -5
  114. package/skills/ae-things/SKILL.md +53 -51
  115. package/skills/ae-things/references/cli.md +56 -54
  116. package/skills/ae-things-progress/SKILL.md +20 -20
  117. package/skills/ae-things-review/SKILL.md +19 -19
  118. package/dist/chunk-CI24BDR2.js +0 -43
package/README.md CHANGED
@@ -62,11 +62,11 @@ ae-cli update --dry-run
62
62
 
63
63
  Updates use the same global Skills installation and verification as `install`. Older packages need no installer or generated manifest: their bundled Skills define the expected contents. If Skills fail after the CLI installs, the result reports partial completion and can be retried.
64
64
 
65
- Automatic synchronization runs during normal commands after login; host version checks are cached for up to 24 hours. `ae-cli update --host <AE_HOST>` checks immediately. After a downgrade, future updates run the older CLI's own updater, including its historical limitations. To use the new installer logic while following an older host, run `npx @thinkingai/ae-cli@latest update --host <AE_HOST>`; the target remains the host-required version.
65
+ Automatic synchronization runs during normal commands after login; host version checks are cached for up to one hour. `ae-cli update --host <AE_HOST>` checks immediately. After a downgrade, future updates run the older CLI's own updater, including its historical limitations. To use the new installer logic while following an older host, run `npx @thinkingai/ae-cli@latest update --host <AE_HOST>`; the target remains the host-required version.
66
66
 
67
67
  `ae-cli update` installs the exact version required by the active host rather than npm `latest`. It synchronizes Skills from the installed npm package first and uses the matching GitHub tag only as a fallback.
68
68
 
69
- Starting with the `6.0.37` and `6.1.9` release lines, ordinary business commands can automatically upgrade or downgrade the CLI to the host-required version. After a successful synchronization, the old process exits with `AE_CLI_VERSION_SYNCED`; re-run the original command so it executes with the new CLI and Skills. Installation failures are reported without replacing the business command's JSON output.
69
+ Starting with the `6.0.37` and `6.1.9` release lines, ordinary business commands can automatically upgrade or downgrade the CLI to the host-required version, including switching from `6.0.x` to `6.1.x`. Automatic synchronization requires stable `major.minor.patch` versions at both ends; development and other nonstandard versions are skipped. After a successful synchronization, the old process exits with `AE_CLI_VERSION_SYNCED`; re-run the original command so it executes with the new CLI and Skills. Installation failures are reported without replacing the business command's JSON output.
70
70
 
71
71
  Useful controls:
72
72
 
@@ -143,6 +143,7 @@ The table covers every current root command individually. Use `ae-cli --help` fo
143
143
  | Agent platform | `context` | Read the current product-page context authorized for the active Agent Run |
144
144
  | Agent platform | `memory` | AgentSpace memory, drafts, shared review, extraction jobs, revisions, and state transitions |
145
145
  | Agent platform | `team` | Agent Team and TeamRun execution, chat, results, and artifacts |
146
+ | Agent platform | `evaluation` | Agent Evaluation datasets, LLM judge evaluators, runs, case results, exports, schedules, and model/agent configs |
146
147
  | Agent platform | `system` | Root/admin management of members, sandboxes, tools, models, usage, quotas, and channels |
147
148
  | General tools | `capability` | Capability discovery, schema inspection, validation, dry-run, and generic execution |
148
149
  | General tools | `auth` | Host-scoped login, status, and multi-account management |
@@ -156,6 +157,8 @@ The table covers every current root command individually. Use `ae-cli --help` fo
156
157
  | Agent platform | `automation` | Automation configuration, execution, history, and results |
157
158
  <!-- root-command-surface:end -->
158
159
 
160
+ Evaluation commands follow the current AE Host in personal terminals and sandboxes; use `--host` to select another host. Evaluation requests use the HTTP or HTTPS scheme configured for that AE Host, consistent with other AE commands. Legacy `--endpoint` and `AE_EVAL_BASE_URL` values may only match the current AE Host; other values fail before credentials are sent. Remove these settings and use `--host` to select a host. Outside a sandbox, export `AE_EVAL_ACCESS_TOKEN` with a platform session token; sandboxes can obtain a session automatically. See [endpoint and authentication rules](skills/ae-evaluation/SKILL.md#endpoint-and-authentication).
161
+
159
162
  ## Capability Gateway
160
163
 
161
164
  Capability Gateway is the preferred entry point for operations that do not need a dedicated curated command:
@@ -169,6 +172,10 @@ ae-cli capability dry-run analysis.report.list --input input.json
169
172
  ae-cli capability run analysis.report.list --input input.json
170
173
  ```
171
174
 
175
+ Administrators can set each member's daily CLI call limit in External Access Management.
176
+
177
+ For asynchronous exports, omit `--timeout-seconds` to use the server's default timeout. See the [export guide](skills/ae-analysis/references/analysis_data_export.md) for submitting, waiting for, and downloading results.
178
+
172
179
  `--input` accepts inline JSON, a JSON file path, `@<path>`, or `-` for stdin.
173
180
 
174
181
  Use `validate` while fixing complex nested input. Use `dry-run` when you need the final risk, output mode, cancellation support, or delete confirmation preview. Do not stack `validate` and `dry-run` for the same final payload by default; `dry-run` already validates it.
@@ -194,7 +201,7 @@ ae-cli auth status --host https://host-a.example.com
194
201
  # Import a CLI token copied from External Access Management (hidden prompt)
195
202
  ae-cli auth set-token --host https://host-a.example.com
196
203
  # Non-interactive input for local scripts or tests
197
- printf '%s' "$AE_CLI_TOKEN" | ae-cli auth set-token --host https://host-a.example.com --token-stdin
204
+ printf '%s' "$IMPORTED_CLI_TOKEN" | ae-cli auth set-token --host https://host-a.example.com --token-stdin
198
205
  # For the uncommon case where one Host needs multiple accounts
199
206
  ae-cli auth login --host https://host-a.example.com --add
200
207
  ae-cli auth list --host https://host-a.example.com
@@ -216,6 +223,20 @@ A regular `auth login` keeps the simple one-Host/one-account behavior and replac
216
223
 
217
224
  `auth set-token` is for local use with a `cli_` token copied from External Access Management. It prompts without echo by default; `--token-stdin` supports non-interactive local testing. The CLI validates the token against the target Host before replacing the stored credential, encrypts it in the existing per-Host vault, and never includes the value in command output. Add `--add` to retain other accounts for the same Host.
218
225
 
226
+ Inject credentials into the current CLI invocation through environment variables or a specified file without changing stored machine accounts. This supports automation scripts, CI/CD, shared Agents, and other workflows:
227
+
228
+ ```bash
229
+ AE_CLI_TOKEN="$CALLER_CLI_TOKEN" AE_CLI_TOKEN_HOST=https://host-a.example.com ae-cli auth status
230
+ AE_CLI_TOKEN_FILE=/secure/caller-token.json ae-cli auth status
231
+ ae-cli --cli-token-file /secure/caller-token.json auth status
232
+ ```
233
+
234
+ The token file is a read-only JSON object: `{"url":"https://host-a.example.com","token":"cli_REPLACE_WITH_USER_TOKEN"}`. The historical `cli-token` key is also accepted. Keep the file private to its owner (for example, mode `600`). Files must be regular JSON files no larger than 64 KiB. The file URL or `AE_CLI_TOKEN_HOST` selects the host for this invocation; an explicit `--host` must match it. External tokens are sent only to that origin; alternate service origins and HTTP redirects are rejected.
235
+
236
+ Credential precedence is `--cli-token-file` > `AE_CLI_TOKEN` with required `AE_CLI_TOKEN_HOST` > `AE_CLI_TOKEN_FILE` > the existing stored-account/sandbox sources. An explicitly selected source that is empty, malformed, unreadable, or bound to a different host returns `EXTERNAL_CLI_TOKEN_INVALID`; it never falls back to another identity. External credentials also take precedence over sandbox identity headers for Agent calls. `auth status` reports `environment-cli-token` or `file-cli-token`, account and expiration when available, and never reveals the token. Authentication failures do not replace or delete stored credentials.
237
+
238
+ External mode does not write the token or renewal state to the local credential vault. Renewal is best effort, uses the `cli-token` header, and is limited per host/token per process day; older servers without header-based renewal can still authenticate business calls but cannot automatically extend external tokens. `auth`, `auth login`, `auth set-token`, `auth use`, and `auth logout` return `EXTERNAL_CLI_TOKEN_ACTIVE` while external credentials are selected. Remove these process settings before managing machine accounts; `auth list` continues to list local accounts.
239
+
219
240
  The new CLI persists only CLI tokens, never access or refresh tokens. Multiple accounts live in an encrypted V1 vault while the active account is projected into the historical file shape for automatic downgrades. When the CLI upgrades again, it reconciles login, switch, or logout changes made by the old CLI.
220
241
 
221
242
  Login uses a cross-platform device-code flow. Use `--no-browser` when the environment cannot open a browser.
package/README.zh.md CHANGED
@@ -66,11 +66,11 @@ ae-cli update --dry-run
66
66
 
67
67
  更新与 `install` 复用全局 Skills 安装和校验。旧包无需包含安装器或生成的清单,直接以目标包内置 Skills 为准。CLI 安装后 Skills 失败会返回部分成功信息,修复后可重复执行。
68
68
 
69
- 自动同步在登录后的普通命令中触发,集群版本检查最长缓存 24 小时;`ae-cli update --host <AE_HOST>` 可立即查询。降级后,后续更新由旧版 CLI 自身执行,也受旧版实现限制。需要用新安装逻辑匹配旧集群时,可运行 `npx @thinkingai/ae-cli@latest update --host <AE_HOST>`,目标仍是集群要求的版本。
69
+ 自动同步在登录后的普通命令中触发,集群版本检查最长缓存 1 小时;`ae-cli update --host <AE_HOST>` 可立即查询。降级后,后续更新由旧版 CLI 自身执行,也受旧版实现限制。需要用新安装逻辑匹配旧集群时,可运行 `npx @thinkingai/ae-cli@latest update --host <AE_HOST>`,目标仍是集群要求的版本。
70
70
 
71
71
  `ae-cli update` 安装当前 Host 要求的精确版本,不依赖 npm `latest`。更新时优先从已安装的 npm 包同步 Skills,本地来源失败后才回退到对应的 GitHub tag。
72
72
 
73
- 从 `6.0.37` 和 `6.1.9` 维护线开始,普通业务命令可以自动升级或降级到环境要求的版本。同步成功后,旧进程会返回 `AE_CLI_VERSION_SYNCED`;重新执行原命令,即可使用新的 CLI 和 Skills。安装失败会给出提示,但不会用安装输出污染业务命令的 JSON 结果。
73
+ 从 `6.0.37` 和 `6.1.9` 维护线开始,普通业务命令可以自动升级或降级到环境要求的版本,包括从 `6.0.x` 切换到 `6.1.x`。自动同步要求本地和目标均为 `主版本.次版本.补丁号` 格式的正式版本,开发版等不规则版本会跳过。同步成功后,旧进程会返回 `AE_CLI_VERSION_SYNCED`;重新执行原命令,即可使用新的 CLI 和 Skills。安装失败会给出提示,但不会用安装输出污染业务命令的 JSON 结果。
74
74
 
75
75
  常用控制方式:
76
76
 
@@ -147,6 +147,7 @@ ae-cli capability list --domain analysis --jq '.data.capabilities[] | .id'
147
147
  | Agent 平台 | `context` | 读取当前 Agent Run 已授权的产品页面上下文 |
148
148
  | Agent 平台 | `memory` | AgentSpace 记忆、草稿、共享审核、提取任务、版本与状态治理 |
149
149
  | Agent 平台 | `team` | Agent Team 和 TeamRun 的执行、对话、结果及产物 |
150
+ | Agent 平台 | `evaluation` | Agent Evaluation 评测数据集、LLM 裁判、评测任务、用例结果、导出、调度,以及模型/Agent 配置 |
150
151
  | Agent 平台 | `system` | root/admin 的成员、沙盒、工具、模型、用量、配额和渠道管理 |
151
152
  | 通用工具 | `capability` | 能力发现、Schema 查看、参数校验、dry-run 和通用执行 |
152
153
  | 通用工具 | `auth` | 按 Host 登录、查看状态及管理同一 Host 的多个账号 |
@@ -160,6 +161,8 @@ ae-cli capability list --domain analysis --jq '.data.capabilities[] | .id'
160
161
  | Agent 平台 | `automation` | 自动化配置、执行、历史和结果 |
161
162
  <!-- root-command-surface:end -->
162
163
 
164
+ 评测命令在普通终端和沙箱中均跟随当前 AE Host,可通过 `--host` 切换。评测请求沿用该 AE Host 配置的 HTTP 或 HTTPS 协议,与其他 AE 命令一致。旧 `--endpoint` 和 `AE_EVAL_BASE_URL` 只能与当前 AE Host 一致,其他值会在发送凭证前报错;请移除这些配置,统一使用 `--host` 切换。沙箱外需设置 `AE_EVAL_ACCESS_TOKEN` 平台 session token,沙箱内可自动获取会话。详见 [地址与鉴权规则](skills/ae-evaluation/SKILL.md#endpoint-and-authentication)。
165
+
163
166
  ## Capability Gateway
164
167
 
165
168
  不需要独立精选命令的能力,应优先通过 Capability Gateway 调用:
@@ -173,6 +176,10 @@ ae-cli capability dry-run analysis.report.list --input input.json
173
176
  ae-cli capability run analysis.report.list --input input.json
174
177
  ```
175
178
 
179
+ 管理员可在“外部访问管理”为成员配置每日 CLI 调用限额。
180
+
181
+ 异步导出时,省略 `--timeout-seconds` 即使用服务端默认超时。提交、等待和下载结果的方法见[导出使用指南](skills/ae-analysis/references/analysis_data_export.md)。
182
+
176
183
  `--input` 支持内联 JSON、JSON 文件路径、`@<path>`,或通过 `-` 从 stdin 读取。
177
184
 
178
185
  复杂嵌套参数尚在调整时使用 `validate`;需要确认最终风险等级、输出模式、取消能力或删除门禁时使用 `dry-run`。默认不要对同一份最终入参连续执行 `validate` 和 `dry-run`,因为 `dry-run` 已包含参数校验。
@@ -198,7 +205,7 @@ ae-cli auth status --host https://host-a.example.com
198
205
  # 导入从“外部访问管理”复制的 CLI Token(隐藏输入)
199
206
  ae-cli auth set-token --host https://host-a.example.com
200
207
  # 本地脚本或测试使用非交互输入
201
- printf '%s' "$AE_CLI_TOKEN" | ae-cli auth set-token --host https://host-a.example.com --token-stdin
208
+ printf '%s' "$IMPORTED_CLI_TOKEN" | ae-cli auth set-token --host https://host-a.example.com --token-stdin
202
209
  # 少量需要同一 Host 多账号的场景
203
210
  ae-cli auth login --host https://host-a.example.com --add
204
211
  ae-cli auth list --host https://host-a.example.com
@@ -220,6 +227,20 @@ ae-cli config remove pre-production --yes
220
227
 
221
228
  `auth set-token` 用于在本地导入从“外部访问管理”复制的 `cli_` Token。默认使用不回显的隐藏输入,`--token-stdin` 支持本地测试等非交互场景。CLI 会先向目标 Host 校验 Token,再替换本地凭证,并写入现有的按 Host 加密凭据库;命令输出不会包含 Token。需要保留同一 Host 的其他账号时增加 `--add`。
222
229
 
230
+ 支持通过环境变量或指定文件,为当前 CLI 调用注入凭证,不改变机器上已保存的账号;适用于自动化脚本、CI/CD、公共Agent等场景。
231
+
232
+ ```bash
233
+ AE_CLI_TOKEN="$CALLER_CLI_TOKEN" AE_CLI_TOKEN_HOST=https://host-a.example.com ae-cli auth status
234
+ AE_CLI_TOKEN_FILE=/secure/caller-token.json ae-cli auth status
235
+ ae-cli --cli-token-file /secure/caller-token.json auth status
236
+ ```
237
+
238
+ Token 文件是只读 JSON 对象:`{"url":"https://host-a.example.com","token":"cli_REPLACE_WITH_USER_TOKEN"}`,也兼容历史字段 `cli-token`。文件应仅允许所有者读取,例如权限 `600`;必须是大小不超过 64 KiB 的普通 JSON 文件。文件中的 URL 或 `AE_CLI_TOKEN_HOST` 决定本次调用的 Host;显式 `--host` 必须与之匹配。外部 Token 仅发送到该 Origin,拒绝其他服务 Origin 和 HTTP 重定向。
239
+
240
+ 凭证优先级为 `--cli-token-file` > `AE_CLI_TOKEN`(必须同时提供 `AE_CLI_TOKEN_HOST`)> `AE_CLI_TOKEN_FILE` > 现有本地账号或沙箱来源。显式来源为空、格式错误、无法读取或 Host 不匹配时返回 `EXTERNAL_CLI_TOKEN_INVALID`,不会回退到其他身份。外部凭证也优先于 Agent 调用的沙箱身份头。`auth status` 的来源为 `environment-cli-token` 或 `file-cli-token`,并在后端支持时展示账号与到期时间,不输出 Token。认证失败不会替换或删除本地凭证。
241
+
242
+ 外部模式不将 Token 或续期状态写入本地凭据库。自动续期使用 `cli-token` 请求头,失败不阻断业务请求,每个进程按 Host、Token 和当天日期限频;旧后端不支持请求头续期时仍可认证业务请求,但不能自动延长外部 Token。选择外部凭证时,`auth`、`auth login`、`auth set-token`、`auth use` 和 `auth logout` 返回 `EXTERNAL_CLI_TOKEN_ACTIVE`。管理机器账号前先移除这些进程设置;`auth list` 仍只列出本地账号。
243
+
223
244
  新版 CLI 只持久化 CLI Token,不保存 access token 或 refresh token。多账号保存在加密的 V1 凭据文件中,同时维护旧文件格式的当前账号投影,保证 CLI 自动降级后仍可登录;再次升级时会合并旧 CLI 对投影的登录、切换或退出变更。
224
245
 
225
246
  登录使用跨平台设备码流程。当前环境无法打开浏览器时,可使用 `--no-browser`。
@@ -1,21 +1,21 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
- import {
3
- missingAeHostGuidance,
4
- missingAeHostHint
5
- } from "./chunk-6ZIQV5GW.js";
6
2
  import {
7
3
  MultiselectCancelled,
8
4
  promptSingleSelect
9
5
  } from "./chunk-7K24F7T2.js";
6
+ import {
7
+ missingAeHostGuidance,
8
+ missingAeHostHint
9
+ } from "./chunk-6ZIQV5GW.js";
10
10
  import {
11
11
  resolveHost
12
- } from "./chunk-OP44TT4H.js";
12
+ } from "./chunk-P6VFCH3P.js";
13
13
  import {
14
14
  getLocalCliPackageInfo,
15
15
  printError,
16
16
  printOutput,
17
17
  runHostCompatCheck
18
- } from "./chunk-6VNIR4AP.js";
18
+ } from "./chunk-ELCR235M.js";
19
19
  import {
20
20
  CliTokenValidationUnavailableError,
21
21
  CredentialStoreUnreadableError,
@@ -31,17 +31,19 @@ import {
31
31
  saveCredential,
32
32
  updateCredentialMetadata,
33
33
  validateCliTokenOnServer
34
- } from "./chunk-GHXZK54S.js";
34
+ } from "./chunk-P7KL7IOH.js";
35
35
  import {
36
36
  getFallbackCliToken,
37
37
  loadConfig,
38
- normalizeUrl,
39
38
  saveConfig
40
- } from "./chunk-ZL7SGNIA.js";
39
+ } from "./chunk-LMCYSVVA.js";
41
40
  import {
41
+ ExternalCliTokenError,
42
42
  PermissionError,
43
- logger
44
- } from "./chunk-WNGFSIOB.js";
43
+ logger,
44
+ normalizeUrl,
45
+ readExternalCliToken
46
+ } from "./chunk-ZW4VMY5H.js";
45
47
 
46
48
  // src/core/device-auth.ts
47
49
  import { execFileSync } from "child_process";
@@ -269,7 +271,7 @@ function getExplicitAuthHostOverride(program, opts) {
269
271
  function resolveAuthHost(program, opts) {
270
272
  return resolveHost(getExplicitAuthHostOverride(program, opts));
271
273
  }
272
- async function validateExistingCliToken(host, cliToken) {
274
+ async function validateExistingCliToken(host, cliToken, external = false) {
273
275
  try {
274
276
  return { valid: true, trusted: false, details: await validateCliTokenOnServer(host, cliToken) };
275
277
  } catch (error) {
@@ -286,7 +288,7 @@ async function validateExistingCliToken(host, cliToken) {
286
288
  printError(
287
289
  "auth",
288
290
  error.message,
289
- `Run: ae-cli auth logout --host ${host}, then ae-cli auth login --host ${host}`
291
+ external ? "Replace the external CLI token with a valid token for this host." : `Run: ae-cli auth logout --host ${host}, then ae-cli auth login --host ${host}`
290
292
  );
291
293
  process.exitCode = 1;
292
294
  return { valid: false, trusted: false, details: {} };
@@ -512,6 +514,12 @@ function resolveLoginTeClaudeBase(host) {
512
514
  }
513
515
  function registerAuth(program) {
514
516
  const auth = program.command("auth").description("Manage authentication or switch the active account interactively").hook("preAction", (_command, actionCommand) => {
517
+ if (["auth", "login", "set-token", "use", "logout"].includes(actionCommand.name()) && readExternalCliToken()) {
518
+ throw new ExternalCliTokenError(
519
+ "Stored-account changes are unavailable while an external CLI token is selected.",
520
+ "EXTERNAL_CLI_TOKEN_ACTIVE"
521
+ );
522
+ }
515
523
  if (["login", "set-token"].includes(actionCommand.name())) {
516
524
  const host = resolveAuthHost(program, actionCommand.opts());
517
525
  if (host) assertCredentialsReadable(host);
@@ -644,6 +652,22 @@ function registerAuth(program) {
644
652
  }, program.opts().format || "json");
645
653
  return;
646
654
  }
655
+ const external = readExternalCliToken(host);
656
+ if (external) {
657
+ const state = await validateExistingCliToken(host, external.token, true);
658
+ if (!state.valid) return;
659
+ await printOutput({
660
+ authenticated: true,
661
+ host,
662
+ source: external.source,
663
+ cli_token: {
664
+ status: state.trusted ? "trusted" : "valid",
665
+ ...state.details.cliTokenExpiresAt ? { expires_at: state.details.cliTokenExpiresAt } : {}
666
+ },
667
+ ...state.details.account ? { account: accountOutput(state.details.account) } : {}
668
+ }, program.opts().format || "json");
669
+ return;
670
+ }
647
671
  const active = getActiveCredential(host);
648
672
  if (active) {
649
673
  const state = await validateExistingCliToken(host, active.cliToken);
@@ -1,15 +1,22 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ resolveWorkspaceTarget
4
+ } from "./chunk-UUD5RB36.js";
5
+ import {
6
+ currentAgentSpaceId
7
+ } from "./chunk-RK6GLDGI.js";
8
+ import "./chunk-JJJIP2XQ.js";
2
9
  import {
3
10
  TeAgentApiError,
4
11
  deleteFromMainApp,
5
12
  getFromMainApp,
6
13
  patchToMainApp,
7
14
  postToMainApp
8
- } from "./chunk-3YVEAZUN.js";
15
+ } from "./chunk-2UWS5CUP.js";
9
16
  import "./chunk-Y74WTIKJ.js";
10
- import "./chunk-GHXZK54S.js";
11
- import "./chunk-ZL7SGNIA.js";
12
- import "./chunk-WNGFSIOB.js";
17
+ import "./chunk-P7KL7IOH.js";
18
+ import "./chunk-LMCYSVVA.js";
19
+ import "./chunk-ZW4VMY5H.js";
13
20
 
14
21
  // src/commands/automation/index.ts
15
22
  import { randomUUID } from "crypto";
@@ -24,7 +31,7 @@ var typeFlag = flag(
24
31
  );
25
32
  var scopeFlag = flag(
26
33
  "agent-space-id",
27
- "Explicit space; otherwise server resolves sandbox context or personal space"
34
+ "Explicit space; otherwise current AgentSpace, then personal space"
28
35
  );
29
36
  var runFlag = flag(
30
37
  "run-id",
@@ -62,7 +69,21 @@ var configFlags = [
62
69
  flag("time", "HH:mm in server timezone"),
63
70
  flag("minute", "Hourly minute, 0-59", "number"),
64
71
  flag("weekday", "Weekly day, 0=Sunday through 6=Saturday", "number"),
65
- flag("day-of-month", "Monthly day, 1-28", "number"),
72
+ flag(
73
+ "weekdays",
74
+ "Weekly days as JSON array, 0=Sunday through 6=Saturday",
75
+ "json"
76
+ ),
77
+ flag(
78
+ "day-of-month",
79
+ "Monthly day, 1-31; missing dates are skipped",
80
+ "number"
81
+ ),
82
+ flag(
83
+ "days-of-month",
84
+ 'Monthly days as JSON array: integers 1-31 or "L" for last day; missing dates are skipped',
85
+ "json"
86
+ ),
66
87
  flag("model", "Agent model configuration ID; null clears the override"),
67
88
  flag("reuse-conversation", "Agent: true | false", "json"),
68
89
  {
@@ -71,12 +92,12 @@ var configFlags = [
71
92
  },
72
93
  flag(
73
94
  "channels",
74
- "Team notification channel array; [] clears channels",
95
+ "Agent or Team notification channel array; [] clears external notifications",
75
96
  "json"
76
97
  ),
77
- flag("feishu-chat-id", "Team Feishu destination; null clears it"),
78
- flag("lark-chat-id", "Team Lark destination; null clears it"),
79
- flag("slack-channel-id", "Team Slack destination; null clears it"),
98
+ flag("feishu-chat-id", "Feishu destination; null clears it"),
99
+ flag("lark-chat-id", "Lark destination; null clears it"),
100
+ flag("slack-channel-id", "Slack destination; null clears it"),
80
101
  flag(
81
102
  "save-to-knowledge-base-id",
82
103
  "Team output knowledge base ID; null clears it"
@@ -133,11 +154,33 @@ function configuration(ctx, create) {
133
154
  const kind = ctx.str("scheduleKind"), cron = ctx.str("cronExpression");
134
155
  enumValue(kind, ["hourly", "daily", "weekly", "monthly"], "schedule-kind");
135
156
  if (kind && cron) throw new Error("Use --schedule-kind or --cron-expression");
136
- if (!kind && ["time", "minute", "weekday", "dayOfMonth"].some((name2) => ctx.str(name2)))
157
+ if (!kind && (["time", "minute", "weekday", "dayOfMonth"].some(
158
+ (name2) => ctx.str(name2)
159
+ ) || ctx.json("weekdays") !== void 0 || ctx.json("daysOfMonth") !== void 0))
137
160
  throw new Error("Schedule details require --schedule-kind");
138
- if (kind && ctx.str("weekday") && kind !== "weekly" || kind && ctx.str("dayOfMonth") && kind !== "monthly" || kind && ctx.str("minute") && kind !== "hourly")
161
+ if (kind && (ctx.str("weekday") || ctx.json("weekdays") !== void 0) && kind !== "weekly" || kind && (ctx.str("dayOfMonth") || ctx.json("daysOfMonth") !== void 0) && kind !== "monthly" || kind && ctx.str("minute") && kind !== "hourly")
139
162
  throw new Error("Schedule field is not applicable to this frequency");
140
163
  if (kind) {
164
+ const dateSelection = (single, multiple, min, max, label, allowLastDay = false) => {
165
+ const values = ctx.json(multiple);
166
+ if (values === void 0)
167
+ return {
168
+ [single]: range(ctx.optionalNum(single) ?? NaN, min, max, label)
169
+ };
170
+ if (ctx.optionalNum(single) !== void 0)
171
+ throw new Error(`Use --${label} or its plural array, not both`);
172
+ if (!Array.isArray(values) || !values.length || values.length > max - min + 1 + Number(allowLastDay) || values.some(
173
+ (value) => !(allowLastDay && value === "L") && (!Number.isInteger(value) || value < min || value > max)
174
+ ))
175
+ throw new Error(
176
+ `${multiple} must be a non-empty JSON array of integers from ${min} to ${max}${allowLastDay ? ' or "L" for last day' : ""}`
177
+ );
178
+ return {
179
+ [multiple]: [...new Set(values)].sort(
180
+ (a, b) => (a === "L" ? 32 : a) - (b === "L" ? 32 : b)
181
+ )
182
+ };
183
+ };
141
184
  const schedule = { kind };
142
185
  if (kind === "hourly")
143
186
  schedule.minute = range(ctx.optionalNum("minute") ?? 0, 0, 59, "minute");
@@ -146,18 +189,21 @@ function configuration(ctx, create) {
146
189
  throw new Error("--time must use HH:mm");
147
190
  schedule.time = ctx.str("time");
148
191
  if (kind === "weekly")
149
- schedule.weekday = range(
150
- ctx.optionalNum("weekday") ?? NaN,
151
- 0,
152
- 6,
153
- "weekday"
192
+ Object.assign(
193
+ schedule,
194
+ dateSelection("weekday", "weekdays", 0, 6, "weekday")
154
195
  );
155
196
  if (kind === "monthly")
156
- schedule.dayOfMonth = range(
157
- ctx.optionalNum("dayOfMonth") ?? NaN,
158
- 1,
159
- 28,
160
- "day-of-month"
197
+ Object.assign(
198
+ schedule,
199
+ dateSelection(
200
+ "dayOfMonth",
201
+ "daysOfMonth",
202
+ 1,
203
+ 31,
204
+ "day-of-month",
205
+ true
206
+ )
161
207
  );
162
208
  }
163
209
  result.schedule = schedule;
@@ -165,8 +211,11 @@ function configuration(ctx, create) {
165
211
  if (cron) {
166
212
  const parts = cron.trim().split(/\s+/);
167
213
  const validNumber = (v, a, b) => /^\d+$/.test(v) && Number(v) >= a && Number(v) <= b;
214
+ const validDays = (v, a, b, allowLastDay = false) => v.split(",").length <= b - a + 1 + Number(allowLastDay) && v.split(",").every(
215
+ (day) => allowLastDay && day === "L" || validNumber(day, a, b)
216
+ );
168
217
  const [m, h, d, mo, w] = parts;
169
- if (parts.length !== 5 || !validNumber(m, 0, 59) || !(h === "*" || validNumber(h, 0, 23)) || mo !== "*" || !(d === "*" || validNumber(d, 1, 28)) || !(w === "*" || validNumber(w, 0, 6)) || d !== "*" && w !== "*" || h === "*" && (d !== "*" || w !== "*"))
218
+ if (parts.length !== 5 || !validNumber(m, 0, 59) || !(h === "*" || validNumber(h, 0, 23)) || mo !== "*" || !(d === "*" || validDays(d, 1, 31, true)) || !(w === "*" || validDays(w, 0, 6)) || d !== "*" && w !== "*" || h === "*" && (d !== "*" || w !== "*"))
170
219
  throw new Error(
171
220
  "--cron-expression must specify an hourly, daily, weekly or monthly schedule"
172
221
  );
@@ -175,19 +224,18 @@ function configuration(ctx, create) {
175
224
  if (create && (ctx.str("triggerType") || "scheduled") === "scheduled" && !kind && !cron)
176
225
  throw new Error("Scheduled automation requires a schedule");
177
226
  const agentNames = ["model", "reuseConversation"];
178
- const teamNames = [
179
- "scope",
227
+ const teamNames = ["scope", "saveToKnowledgeBaseId"];
228
+ const notificationNames = [
180
229
  "channels",
181
230
  "feishuChatId",
182
231
  "larkChatId",
183
- "slackChannelId",
184
- "saveToKnowledgeBaseId"
232
+ "slackChannelId"
185
233
  ];
186
- for (const name2 of [...agentNames, ...teamNames]) {
234
+ for (const name2 of [...agentNames, ...teamNames, ...notificationNames]) {
187
235
  const json = ["scope", "channels", "reuseConversation"].includes(name2);
188
236
  const value = json ? ctx.json(name2) : ctx.str(name2) || void 0;
189
237
  if (value === void 0) continue;
190
- if ((agentNames.includes(name2) ? "agent" : "team") !== targetType)
238
+ if (!notificationNames.includes(name2) && (agentNames.includes(name2) ? "agent" : "team") !== targetType)
191
239
  throw new Error(`${name2} is not applicable to ${targetType} automations`);
192
240
  if (name2 === "reuseConversation" && typeof value !== "boolean")
193
241
  throw new Error("--reuse-conversation must be true or false");
@@ -217,9 +265,13 @@ function configuration(ctx, create) {
217
265
  if (create) result.triggerImmediately = ctx.bool("triggerImmediately");
218
266
  return result;
219
267
  }
220
- function query(ctx, list = false, typed = false) {
268
+ async function query(ctx, list = false, typed = false) {
221
269
  const p = new URLSearchParams();
222
- if (ctx.str("agentSpaceId")) p.set("agentSpaceId", ctx.str("agentSpaceId"));
270
+ let spaceId = ctx.str("agentSpaceId").trim() || currentAgentSpaceId();
271
+ if (!spaceId && process.env.TE_AGENT_CONVERSATION_ID?.trim()) {
272
+ spaceId = (await resolveWorkspaceTarget(ctx)).agentSpaceId;
273
+ }
274
+ if (spaceId) p.set("agentSpaceId", spaceId);
223
275
  if (typed && ctx.str("targetType"))
224
276
  p.set("targetType", ctx.str("targetType"));
225
277
  if (list) {
@@ -232,23 +284,27 @@ async function request(ctx, method, path, body) {
232
284
  if (method === "GET")
233
285
  return getFromMainApp(
234
286
  path,
235
- ctx.hostOverride ? ctx.hostOverride() : ctx.host()
287
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
288
+ "cli-token"
236
289
  );
237
290
  if (method === "POST")
238
291
  return postToMainApp(
239
292
  path,
240
293
  body,
241
- ctx.hostOverride ? ctx.hostOverride() : ctx.host()
294
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
295
+ "cli-token"
242
296
  );
243
297
  if (method === "PATCH")
244
298
  return patchToMainApp(
245
299
  path,
246
300
  body,
247
- ctx.hostOverride ? ctx.hostOverride() : ctx.host()
301
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
302
+ "cli-token"
248
303
  );
249
304
  return deleteFromMainApp(
250
305
  path,
251
- ctx.hostOverride ? ctx.hostOverride() : ctx.host()
306
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
307
+ "cli-token"
252
308
  );
253
309
  }
254
310
  function withDryRun(path) {
@@ -267,7 +323,7 @@ async function waitForRun(ctx, id, runId) {
267
323
  const result = await request(
268
324
  ctx,
269
325
  "GET",
270
- `${base}/${encodeURIComponent(id)}/runs/${encodeURIComponent(runId)}/result${query(ctx)}`
326
+ `${base}/${encodeURIComponent(id)}/runs/${encodeURIComponent(runId)}/result${await query(ctx)}`
271
327
  );
272
328
  if (result.status !== "running")
273
329
  return { ...result, executionCompleted: true, timedOut: false };
@@ -397,7 +453,7 @@ var automationCommands = actions.map((a) => ({
397
453
  ...body,
398
454
  ...a.wait ? { commandId } : {}
399
455
  };
400
- const path = base + a.suffix(ctx) + query(ctx, a.list, a.typed);
456
+ const path = base + a.suffix(ctx) + await query(ctx, a.list, a.typed);
401
457
  return {
402
458
  request: redactedPreview(a.method, path, requestBody),
403
459
  validation: await request(ctx, a.method, withDryRun(path), requestBody)
@@ -410,7 +466,7 @@ var automationCommands = actions.map((a) => ({
410
466
  output = await request(
411
467
  ctx,
412
468
  a.method,
413
- base + a.suffix(ctx) + query(ctx, a.list, a.typed),
469
+ base + a.suffix(ctx) + await query(ctx, a.list, a.typed),
414
470
  body && { ...body, ...a.wait ? { commandId } : {} }
415
471
  );
416
472
  } catch (error) {
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-KPQY44JQ.js";
12
12
  import {
13
13
  resolveHost
14
- } from "./chunk-OP44TT4H.js";
14
+ } from "./chunk-P6VFCH3P.js";
15
15
  import {
16
16
  CapabilityGatewayError,
17
17
  dryRunCapabilityWithEnvelope,
@@ -20,24 +20,25 @@ import {
20
20
  inspectCapabilityWithEnvelope,
21
21
  listCapabilitiesWithEnvelope,
22
22
  validateCapabilityWithEnvelope
23
- } from "./chunk-VZZNLV3I.js";
23
+ } from "./chunk-MXV3PYC3.js";
24
24
  import {
25
25
  printError,
26
26
  printOutput,
27
27
  withOutputMetadata
28
- } from "./chunk-6VNIR4AP.js";
28
+ } from "./chunk-ELCR235M.js";
29
29
  import "./chunk-Y74WTIKJ.js";
30
30
  import {
31
31
  CredentialStoreUnreadableError,
32
32
  SecureStoreAuthError
33
- } from "./chunk-GHXZK54S.js";
33
+ } from "./chunk-P7KL7IOH.js";
34
34
  import {
35
35
  safeJsonParse
36
- } from "./chunk-ZL7SGNIA.js";
36
+ } from "./chunk-LMCYSVVA.js";
37
37
  import {
38
38
  CliValidationError,
39
+ ExternalCliTokenError,
39
40
  PermissionError
40
- } from "./chunk-WNGFSIOB.js";
41
+ } from "./chunk-ZW4VMY5H.js";
41
42
 
42
43
  // src/commands/capability/index.ts
43
44
  import * as readline from "readline";
@@ -365,7 +366,7 @@ function printCapabilityError(error, host) {
365
366
  );
366
367
  return;
367
368
  }
368
- if (error instanceof CredentialStoreUnreadableError) {
369
+ if (error instanceof CredentialStoreUnreadableError || error instanceof ExternalCliTokenError) {
369
370
  printError("config", error.message, error.hint, error.code);
370
371
  return;
371
372
  }
@@ -5,11 +5,11 @@ import {
5
5
  require_node,
6
6
  require_process_nextick_args,
7
7
  require_util
8
- } from "./chunk-S6M42KND.js";
8
+ } from "./chunk-T44M3PLZ.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __require
12
- } from "./chunk-WNGFSIOB.js";
12
+ } from "./chunk-ZW4VMY5H.js";
13
13
 
14
14
  // node_modules/jszip/node_modules/readable-stream/lib/internal/streams/stream.js
15
15
  var require_stream = __commonJS({