@thinkingai/ae-cli 6.1.32 → 6.1.34
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 +8 -5
- package/README.zh.md +10 -9
- package/bin/runtime-capabilities.json +1 -1
- package/cli-installation-guide.md +14 -4
- package/dist/{ai-monitor-MKMHSSNI.js → ai-monitor-TVRFVZBH.js} +11 -9
- package/dist/ai-monitor.js +18 -16
- package/dist/{auth-CZHHPZOQ.js → auth-JAXLMPBB.js} +33 -316
- package/dist/{automation-FLCPFMN4.js → automation-OQ647CSW.js} +7 -7
- package/dist/{capability-64KVJFIA.js → capability-2Z4ZXTPD.js} +19 -16
- package/dist/chunk-2H3SFJE3.js +344 -0
- package/dist/{chunk-TMQGS4TO.js → chunk-3PZNM5KN.js} +3 -3
- package/dist/chunk-3ZQY7SLZ.js +147 -0
- package/dist/chunk-6E6HCTP2.js +60 -0
- package/dist/{local-data-upload-client-KCMG6J62.js → chunk-6IUTXRAD.js} +32 -4
- package/dist/{chunk-5M5LBRR3.js → chunk-CYZV5AXW.js} +18 -9
- package/dist/{chunk-3ULDJJTZ.js → chunk-DE5XHQQ6.js} +2 -2
- package/dist/{chunk-FCAA7I2D.js → chunk-E5CJI7L3.js} +26 -10
- package/dist/{chunk-QVRIDN42.js → chunk-EQMGH32F.js} +2 -2
- package/dist/{chunk-DWBYNGSR.js → chunk-FNACCKQR.js} +372 -194
- package/dist/{chunk-OAWPT7VP.js → chunk-GD5JSAGV.js} +2 -2
- package/dist/{chunk-CF6JTT2U.js → chunk-GYODT7C4.js} +1 -1
- package/dist/chunk-HBI7IQH3.js +1207 -0
- package/dist/{chunk-4PSTYEG5.js → chunk-IGU3R2JD.js} +9 -5
- package/dist/{chunk-IDDWEZ7F.js → chunk-IWMDPHMI.js} +3 -3
- package/dist/{chunk-P7QDCWJ6.js → chunk-L7MT53VM.js} +8 -2
- package/dist/{chunk-F2VFZUGG.js → chunk-LXRALNNA.js} +2 -2
- package/dist/{chunk-6M7ZEDT2.js → chunk-M2OCZRVX.js} +14 -8
- package/dist/{chunk-Z3Q2AEIN.js → chunk-MTK4ZE7W.js} +17 -145
- package/dist/{chunk-T7WF4HYW.js → chunk-NK5PS5X7.js} +3 -3
- package/dist/{chunk-JEUXDY3B.js → chunk-NPH5J65M.js} +1 -1
- package/dist/chunk-PUSFEC6B.js +29 -0
- package/dist/{chunk-BNBCMCYN.js → chunk-Q764EZND.js} +78 -72
- package/dist/chunk-QOJXLXDJ.js +55 -0
- package/dist/{chunk-HVMCPKOZ.js → chunk-QPUPWGZ3.js} +1 -1
- package/dist/{chunk-72NJKS7O.js → chunk-RLPMXKDQ.js} +8921 -10119
- package/dist/{chunk-NLEXY2TM.js → chunk-S74XV3A6.js} +7 -5
- package/dist/{chunk-KTJXD27G.js → chunk-SHB7A2JE.js} +3 -3
- package/dist/{chunk-HTZ2MLYA.js → chunk-UWQXGF44.js} +25 -11
- package/dist/{data-integration-QE37EQ3A.js → chunk-V6UKLIM6.js} +160 -2258
- package/dist/{chunk-4XKTRCRK.js → chunk-VPLRZSMY.js} +22 -13
- package/dist/{chunk-2F64AZYH.js → chunk-Z6WSCIHM.js} +2 -2
- package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-5VNT6HCV.js} +4 -2
- package/dist/{compat-check-ZJNCMNQV.js → compat-check-E7AQ7UCG.js} +6 -4
- package/dist/{config-FSH2NMNZ.js → config-PGSUWIK5.js} +16 -11
- package/dist/{context-YAQG6YQC.js → context-Y2A6QIS3.js} +9 -6
- package/dist/conversion-4FR3RA45.js +16 -0
- package/dist/data-integration-EIF5QHYF.js +2138 -0
- package/dist/{evaluation-2JSF4V47.js → evaluation-OZM54MES.js} +6 -5
- package/dist/index.js +79 -52
- package/dist/local-data-upload-client-2U3LFD7Z.js +16 -0
- package/dist/{memory-VEZZVAAP.js → memory-6QMZS4HF.js} +7 -7
- package/dist/{metadata-3IWHX3V4.js → metadata-7MZ3CJ2N.js} +11 -9
- package/dist/{model-T7H7Q6BG.js → model-LEYRQKOS.js} +8 -8
- package/dist/{personal-semantic-preference-YITU23SA.js → personal-semantic-preference-SWOUNDWJ.js} +46 -14
- package/dist/{project-semantic-MHEXJF3C.js → project-semantic-M2DDPAMD.js} +10 -8
- package/dist/{sync-AQHVCSPI.js → sync-PWC63JCO.js} +17 -16
- package/dist/{te-agent-RXI7WOH4.js → te-agent-S7UH657Z.js} +304 -16
- package/dist/{te-analysis-CZY74HVF.js → te-analysis-BK6PE333.js} +295 -223
- package/dist/{te-community-DKCYUBCM.js → te-community-OLNTKGCW.js} +17 -13
- package/dist/{te-dataops-QEH6VE56.js → te-dataops-XUWRIF5R.js} +18 -14
- package/dist/{te-engage-WK7WKDKF.js → te-engage-I3I4FJOM.js} +10 -8
- package/dist/{te-experiment-LH3RPIOE.js → te-experiment-XSDUL4KH.js} +216 -28
- package/dist/{te-kb-UPORIOVN.js → te-kb-QFH3YLFQ.js} +74 -21
- package/dist/{te-system-AL4B4XZL.js → te-system-DB5Z3LLF.js} +7 -7
- package/dist/{te-team-LLVTO2G4.js → te-team-UADF2HBO.js} +10 -8
- package/dist/{things-XLMLBYQR.js → things-G2QFXDK7.js} +10 -8
- package/dist/{update-7J5UQHSK.js → update-6I366ICW.js} +10 -9
- package/dist/web-runtime-3XFREWRF.js +2367 -0
- package/dist/{workspace-FF2HXJGR.js → workspace-RZESYB6T.js} +7 -7
- package/package.json +9 -5
- package/skills/ae-agent/SKILL.md +19 -5
- package/skills/ae-agent/references/a2a.md +103 -0
- package/skills/ae-agent/references/command_index.md +11 -0
- package/skills/ae-analysis/SKILL.md +35 -23
- package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
- package/skills/ae-analysis/references/bad_case_review.md +4 -4
- package/skills/ae-analysis/references/command_index.md +7 -7
- package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
- package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
- package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
- package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
- package/skills/ae-analysis/references/project_owner_update.md +5 -1
- package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
- package/skills/ae-analysis/references/scenario_list.md +5 -6
- package/skills/ae-capability/SKILL.md +8 -4
- package/skills/ae-data-integration/references/ue-mapping.md +2 -0
- package/skills/ae-experiment/SKILL.md +45 -16
- package/skills/ae-experiment/references/experiment_approval.md +87 -29
- package/skills/ae-experiment/references/manage_experiment.md +7 -3
- package/skills/ae-experiment/references/manage_traffic_domains.md +131 -0
- package/skills/ae-experiment/references/query_experiment_detail.md +8 -0
- package/skills/ae-experiment/references/query_experiment_list.md +6 -0
- package/skills/ae-experiment/references/save_experiment.md +39 -13
- package/skills/ae-experiment/references/save_metric.md +29 -2
- package/skills/ae-experiment/references/save_submit_experiment.md +11 -7
- package/skills/ae-experiment/references/save_submit_external_experiment.md +16 -14
- package/skills/ae-experiment/references/save_traffic_layer.md +17 -1
- package/skills/ae-kb/SKILL.md +4 -2
- package/skills/ae-kb/references/publication.md +45 -0
- package/skills/ae-onboarding/SKILL.md +64 -0
- package/skills/ae-onboarding/references/business-sdk.md +8 -0
- package/skills/ae-onboarding/references/demo-operations.md +79 -0
- package/skills/ae-onboarding/references/import.md +19 -0
- package/skills/ae-onboarding/references/onboarding_experiment_launch.md +12 -0
- package/skills/ae-onboarding/references/onboarding_experiment_plan.md +14 -0
- package/skills/ae-onboarding/references/onboarding_growth.md +36 -0
- package/skills/ae-onboarding/references/onboarding_run.md +11 -0
- package/skills/ae-onboarding/references/onboarding_status.md +5 -0
- package/skills/ae-onboarding/scripts/experiment-preset.json +252 -0
- package/skills/ae-onboarding/scripts/experiment-requests.mjs +120 -0
- package/skills/ae-onboarding/scripts/generate.mjs +170 -0
- package/skills/ae-onboarding/scripts/resolve-experiment-preset.mjs +26 -0
- package/skills/ae-onboarding/scripts/web-journey.mjs +39 -0
- package/dist/chunk-6ZIQV5GW.js +0 -26
- package/dist/chunk-Y74WTIKJ.js +0 -10
package/README.md
CHANGED
|
@@ -20,8 +20,6 @@ The CLI is designed around:
|
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
23
|
-
For setup through Codex, Claude Code, Cursor, or another terminal-capable AI Agent, see the [AE CLI installation and upgrade guide](./cli-installation-guide.md).
|
|
24
|
-
|
|
25
23
|
Install the public CLI and Agent Skills:
|
|
26
24
|
|
|
27
25
|
```bash
|
|
@@ -31,6 +29,8 @@ npx @thinkingai/ae-cli@latest install --format json
|
|
|
31
29
|
|
|
32
30
|
The installer checks Node.js 20+, installs and verifies the CLI, then uses the bundled Skills tool to install matching global Skills for supported clients. First installation includes all bundled Skills when no business state has been confirmed. `--dry-run`, `--format json`, and optional `--host <AE_HOST>` are supported. Being logged out is not an installation failure. See the [installation guide](./cli-installation-guide.md).
|
|
33
31
|
|
|
32
|
+
When installing through Codex, Claude Code, Cursor, or another terminal-capable Agent, give it the `--format json` command above and the installation guide. After verification, you can use guided website onboarding in Japan, Korea, and the United States. In China, sign in to an existing account using your AE environment URL. If you only ask to get started, the Agent can use a signed-in account or ask which account route you want. If you used `npm install -g`, run `ae-cli install --format json` first to verify the installed version and sync its Skills. [Agent installation prompt](./cli-installation-guide.md#ai-installation-prompt)
|
|
33
|
+
|
|
34
34
|
The Skills teach supported coding Agents, including Claude Code, Codex, Cursor, and similar tools, how to discover and call `ae-cli`.
|
|
35
35
|
|
|
36
36
|
Install optional, approved scenario Skills with an interactive category picker:
|
|
@@ -119,12 +119,12 @@ The table covers every current root command individually. Use `ae-cli --help` fo
|
|
|
119
119
|
| Category | Root command | Purpose |
|
|
120
120
|
|---|---|---|
|
|
121
121
|
| Analysis and projects | `analysis` | Reports, dashboards, ad-hoc analysis, drilldowns, details, alerts, tags, and cohorts |
|
|
122
|
-
| Analysis and projects | `experiment` | Atlas experiments, reports, traffic layers, buckets, Features, metrics, and operation logs |
|
|
122
|
+
| Analysis and projects | `experiment` | Atlas experiments, reports, traffic domains and layers, buckets, Features, metrics, and operation logs |
|
|
123
123
|
| Analysis and projects | `analysis-meta` | Event/property catalogs, metrics, virtual metadata, tracking governance, and project analysis settings |
|
|
124
124
|
| Analysis and projects | `analysis-governance` | Data-asset search, lineage, impact analysis, certification, and governance |
|
|
125
125
|
| Analysis and projects | `project` | Project information, members, roles, permissions, entities, time zones, and handover settings |
|
|
126
126
|
| Analysis and projects | `metadata` | Capability-backed data-table, property, and dimension-table binding operations |
|
|
127
|
-
| Analysis and projects | `personal-semantic-preference` |
|
|
127
|
+
| Analysis and projects | `personal-semantic-preference` | Current-user semantic preferences for a project or across projects (`--project-id -1`) |
|
|
128
128
|
| Analysis and projects | `project-semantic` | Governed project semantics, knowledge-base asset packages, candidate validation, review, and publishing |
|
|
129
129
|
| Observability | `ai-monitor` | Read traces, conversations, Bad Traces, metrics, cost, security and existing diagnosis reports; export verified ZIPs ([guide](skills/ae-ai-monitor/SKILL.md)) |
|
|
130
130
|
| Data and tracking | `tracking` | Tracking plans, SDK samples, checks, ingestion diagnostics, code generation, and bundled wiki |
|
|
@@ -179,7 +179,7 @@ ae-cli experiment experiment manage --project-id 1 --exp-id exp_123 --target-sta
|
|
|
179
179
|
ae-cli experiment experiment get --project-id 1 --exp-id exp_123
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
-
This submission path works on older and approval-
|
|
182
|
+
This submission path works on older and approval-capable servers. Saving a draft does not start it. On updated servers, Feature experiments require approval only when the project approver roster is non-empty; external experiments are exempt. Exempt Feature submissions retain the existing manual or scheduled start. When approval is required, approval can start a due Feature experiment; scheduled starts are checked every half hour. Verify runtime status and any approval with `experiment experiment get`. Before using dedicated approval commands, check [server compatibility](skills/ae-experiment/references/experiment_approval.md#server-compatibility); submit only once. See [Feature timing](skills/ae-experiment/references/save_experiment.md#feature-timing) for scheduling.
|
|
183
183
|
|
|
184
184
|
## Capability Gateway
|
|
185
185
|
|
|
@@ -450,3 +450,6 @@ npm run verify:install
|
|
|
450
450
|
## License
|
|
451
451
|
|
|
452
452
|
MIT
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
Use `ae-cli agent a2a +card --url <A2A-link>` to discover authorized workspaces and models, then pass `--space-id <id>` and `--model <id>` to `agent a2a +send`. Use `agent a2a list`, `cancel`, and `delete-context` to manage tasks and conversations. See the [A2A command reference](skills/ae-agent/references/a2a.md).
|
package/README.zh.md
CHANGED
|
@@ -20,12 +20,6 @@ CLI 的核心设计包括:
|
|
|
20
20
|
|
|
21
21
|
## 安装
|
|
22
22
|
|
|
23
|
-
如果你希望由 Codex、Claude Code、Cursor 等 AI Agent 自动检查 Node.js、安装 CLI、完成登录并同步匹配版本,请让 Agent 阅读并执行 [AE CLI Installation and Upgrade](./cli-installation-guide.md)。
|
|
24
|
-
|
|
25
|
-
可直接复制给 Agent,并把 `<AE_HOST>` 替换为你的 AE 地址:
|
|
26
|
-
|
|
27
|
-
> 请按[安装指南](./cli-installation-guide.md)中的“AI installation prompt”帮助我安装 AE CLI;全局安装 Skills,并根据最终 CLI/Skills 验证结果判断成功。
|
|
28
|
-
|
|
29
23
|
安装公开版 CLI 和 Agent Skills:
|
|
30
24
|
|
|
31
25
|
```bash
|
|
@@ -35,6 +29,8 @@ npx @thinkingai/ae-cli@latest install --format json
|
|
|
35
29
|
|
|
36
30
|
安装器检查 Node.js 20+、安装并验证 CLI,再通过内置的 Skills 工具向支持的客户端安装同版本全局 Skills。首次安装且尚无已确认业务状态时安装全量内置 Skills。支持 `--dry-run`、`--format json` 和可选的 `--host <AE_HOST>`。未登录不算安装失败。详见[安装指南](./cli-installation-guide.md)。
|
|
37
31
|
|
|
32
|
+
通过 Codex、Claude Code、Cursor 等 AI Agent 安装时,把上面的 `--format json` 命令和安装指南交给 Agent。验证成功后,日本、韩国和美国用户可通过官网完成新手引导。中国区已有账号可使用原 AE 环境地址登录。如果只说「开始使用」,Agent 可以沿用已登录的账号,或询问你想注册还是登录已有账号。如果通过 `npm install -g` 安装,请先执行 `ae-cli install --format json` 验证版本并同步对应的 Skills。[Agent 安装提示词](./cli-installation-guide.md#ai-installation-prompt)
|
|
33
|
+
|
|
38
34
|
Skills 会帮助 Claude Code、Codex、Cursor 等编码 Agent 理解、发现并调用 `ae-cli`。
|
|
39
35
|
|
|
40
36
|
按业务分类交互安装可选的已准出场景 Skill:
|
|
@@ -123,12 +119,12 @@ ae-cli capability list --domain analysis --jq '.capabilities[] | .id'
|
|
|
123
119
|
| 类别 | 根命令 | 用途 |
|
|
124
120
|
|---|---|---|
|
|
125
121
|
| 分析与项目 | `analysis` | 报告、看板、即席分析、下钻、详情、告警、标签和分群 |
|
|
126
|
-
| 分析与项目 | `experiment` | Atlas
|
|
122
|
+
| 分析与项目 | `experiment` | Atlas 实验、报表、流量域与流量层、分桶、Feature、指标和操作日志 |
|
|
127
123
|
| 分析与项目 | `analysis-meta` | 事件/属性目录、指标、虚拟元数据、埋点治理和项目分析配置 |
|
|
128
124
|
| 分析与项目 | `analysis-governance` | 数据资产搜索、血缘、影响分析、认证和治理 |
|
|
129
125
|
| 分析与项目 | `project` | 项目信息、成员、角色、权限、实体、时区和交接配置 |
|
|
130
126
|
| 分析与项目 | `metadata` | 基于 Capability Gateway 的数据表、属性及维度表绑定 |
|
|
131
|
-
| 分析与项目 | `personal-semantic-preference` |
|
|
127
|
+
| 分析与项目 | `personal-semantic-preference` | 当前用户的项目内或跨项目个人语义偏好(`--project-id -1`) |
|
|
132
128
|
| 分析与项目 | `project-semantic` | 项目语义治理、知识库资产包、候选校验、审核和发布 |
|
|
133
129
|
| 可观测性 | `ai-monitor` | 查询 Trace、会话、Bad Trace、指标、成本、安全与已有诊断报告,导出校验后的 ZIP([指南](skills/ae-ai-monitor/SKILL.md)) |
|
|
134
130
|
| 数据与埋点 | `tracking` | 埋点方案、SDK 示例、检查、采集诊断、代码生成和内置 Wiki |
|
|
@@ -183,7 +179,7 @@ ae-cli experiment experiment manage --project-id 1 --exp-id exp_123 --target-sta
|
|
|
183
179
|
ae-cli experiment experiment get --project-id 1 --exp-id exp_123
|
|
184
180
|
```
|
|
185
181
|
|
|
186
|
-
|
|
182
|
+
此提交流程兼容旧服务端和支持审批的服务端。保存草稿不会开启实验。新版服务端仅在项目审批人名单非空时要求 Feature 实验审批,外部实验免审批;免审批的 Feature 提交沿用原有手动或预约开启流程。需要审批时,批准可能开启已到开始时间的 Feature 实验,预约由服务端每半小时检查。使用 `experiment experiment get` 确认实际运行状态及审批信息。使用专用审批命令前,按 [服务端兼容性指引](skills/ae-experiment/references/experiment_approval.md#server-compatibility) 确认能力支持,同一次提交只执行一次。时间配置见 [Feature 时间配置](skills/ae-experiment/references/save_experiment.md#feature-timing)。
|
|
187
183
|
|
|
188
184
|
## Capability Gateway
|
|
189
185
|
|
|
@@ -451,3 +447,8 @@ npm run verify:install
|
|
|
451
447
|
## 许可证
|
|
452
448
|
|
|
453
449
|
MIT
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
### 通过 A2A 调用 Agent
|
|
453
|
+
|
|
454
|
+
先登录目标部署,再用 `ae-cli agent a2a +card --url <A2A-link>` 查看可用空间和模型;调用 `agent a2a +send` 时可指定 `--space-id <id>` 和 `--model <id>`。用 `agent a2a +get` 查询结果,`list`、`cancel` 和 `delete-context` 管理任务及会话。CLI 自动使用当前用户的授权。详见 [A2A 命令参考](skills/ae-agent/references/a2a.md)。
|
|
@@ -43,6 +43,16 @@ Each `commands` array describes the current installation plan; `skillsSources` l
|
|
|
43
43
|
|
|
44
44
|
The managed synchronizer uses the verified package source. Replaying historical GitHub fallback or `skills add --copy` commands would bypass business selection and copy protection.
|
|
45
45
|
|
|
46
|
+
## Start using AE in an Agent
|
|
47
|
+
|
|
48
|
+
When a user asks you to install AE CLI or help them start using AE, continue in the same conversation after installation. If the user ran `npm install -g`, locate the executable for the requested version and run `ae-cli install --format json` with it to sync and verify the matching global Skills. For a user who already has a verified installation and asks to start using AE, begin with the authentication check.
|
|
49
|
+
|
|
50
|
+
1. For installation, check `ok: true`, `dry_run: false`, `cli.verified: true`, and `skills.status: "success"`. Report the verified version and Skill count. For an explicit install-only request, an upgrade, or a dry run, report the result and finish. For failed or skipped Skill synchronization, report its status and any affected Skills.
|
|
51
|
+
2. Read the optional `next_action` in a successful install report. For `check_authentication`, or when an older report omits `next_action`, run `ae-cli auth status --format json` with the verified executable. Use the user's supplied `--host` when applicable. If the check fails, explain the result and confirm the intended environment before starting signup or login.
|
|
52
|
+
3. Use the user's request to choose the route. For an explicit request for AE onboarding, the new-user walkthrough, or signup, go directly to step 4 for a signed-out user in Japan, Korea, or the United States. In China, use step 5 for an existing account or share the trial request link from the install report. For an explicit request to sign in to an existing account, go to step 5. For `continue_using_ae` or a confirmed sign-in, continue using the signed-in environment. Ask **“Do you already have an AE account?”** only when a signed-out user asks to get started without specifying a route. In that case, open the Agent's native picker with **“Create an account and get started”** and **“Sign in to an existing account.”** Use chat choices if the host cannot show a picker.
|
|
53
|
+
4. Start website onboarding with `ae-cli analysis onboarding run --browser system --format json`. Use `--region jp`, `--region kr`, or `--region us` to select the user's production market. Pass `--source` for the current AI tool. The CLI opens the system default browser. If opening fails, share the returned URL. Read the returned `skill_path` and reuse `session_id` in the same conversation.
|
|
54
|
+
5. To sign in, use the original AE environment supplied or confirmed by the user. If its address is unknown, ask for it. Follow the device flow below. Once the session is authorized, confirm that `ae-cli auth status` reports the expected environment and signed-in account.
|
|
55
|
+
|
|
46
56
|
## Host and login
|
|
47
57
|
|
|
48
58
|
`--host` is optional. It delegates status checks to the existing auth command; it does not independently save credentials or change the active host. Being logged out does not make a verified installation fail.
|
|
@@ -51,7 +61,7 @@ The managed synchronizer uses the verified package source. Replaying historical
|
|
|
51
61
|
ae-cli auth login --host <AE_HOST> --no-wait
|
|
52
62
|
```
|
|
53
63
|
|
|
54
|
-
|
|
64
|
+
Open the returned `verification_url` in the system default browser once. In an Agent, use its native picker for **“I approved CLI access”** or **“I need help authorizing the CLI.”** If opening fails, give the user the link. After the user confirms, run these commands in the same turn.
|
|
55
65
|
|
|
56
66
|
```bash
|
|
57
67
|
ae-cli auth login --host <AE_HOST> --device-code <DEVICE_CODE>
|
|
@@ -101,12 +111,12 @@ The newer command orchestrates the work; the installed target remains the host-r
|
|
|
101
111
|
Prefer the unified installer. For a specific client or source diagnosis, advanced users can still invoke the external Skills tool directly:
|
|
102
112
|
|
|
103
113
|
```bash
|
|
104
|
-
npx -y skills@1.5.12 add <INSTALLED_CLI_SKILLS_PATH> -g -y --agent codex
|
|
114
|
+
npx -y skills@1.5.12 add <INSTALLED_CLI_SKILLS_PATH> -g -y --agent codex --skill ae-analysis
|
|
105
115
|
npx -y skills@1.5.12 list -g --json
|
|
106
116
|
```
|
|
107
117
|
|
|
108
|
-
Raw manual-tool output is not the AE installer's final result. Do not infer completeness from the list alone, delete unrelated Skills, or overwrite a source link to resolve a conflict.
|
|
118
|
+
Choose the specific Skill you are troubleshooting. The onboarding Skill is loaded from the CLI package when a new user starts onboarding. Raw manual-tool output is not the AE installer's final result. Do not infer completeness from the list alone, delete unrelated Skills, or overwrite a source link to resolve a conflict.
|
|
109
119
|
|
|
110
120
|
## AI installation prompt
|
|
111
121
|
|
|
112
|
-
> Install AE CLI and its matching Skills
|
|
122
|
+
> Install AE CLI and its matching global Skills with `npx @thinkingai/ae-cli@latest install --format json`. Use the version and registry I supply, if any. Report the verified version and Skill count, then follow [Start using AE in an Agent](#start-using-ae-in-an-agent) in this conversation.
|
|
@@ -9,16 +9,18 @@ import {
|
|
|
9
9
|
traceCount,
|
|
10
10
|
traceGet,
|
|
11
11
|
traceList
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-IWMDPHMI.js";
|
|
13
|
+
import "./chunk-3PZNM5KN.js";
|
|
14
14
|
import "./chunk-AWW2T2WL.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-DE5XHQQ6.js";
|
|
16
|
+
import "./chunk-VPLRZSMY.js";
|
|
17
|
+
import "./chunk-6E6HCTP2.js";
|
|
18
|
+
import "./chunk-FNACCKQR.js";
|
|
19
|
+
import "./chunk-PUSFEC6B.js";
|
|
20
|
+
import "./chunk-UWQXGF44.js";
|
|
21
|
+
import "./chunk-IGU3R2JD.js";
|
|
22
|
+
import "./chunk-MTK4ZE7W.js";
|
|
23
|
+
import "./chunk-3ZQY7SLZ.js";
|
|
22
24
|
export {
|
|
23
25
|
conversationCount,
|
|
24
26
|
conversationGet,
|
package/dist/ai-monitor.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ai_monitor_default
|
|
4
|
+
} from "./chunk-IWMDPHMI.js";
|
|
5
|
+
import "./chunk-3PZNM5KN.js";
|
|
6
|
+
import "./chunk-AWW2T2WL.js";
|
|
2
7
|
import {
|
|
3
8
|
configureBusinessCommands,
|
|
4
9
|
parseProgram,
|
|
5
10
|
runCommand
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-Y74WTIKJ.js";
|
|
18
|
-
import "./chunk-DWBYNGSR.js";
|
|
19
|
-
import "./chunk-HTZ2MLYA.js";
|
|
20
|
-
import "./chunk-4PSTYEG5.js";
|
|
11
|
+
} from "./chunk-Q764EZND.js";
|
|
12
|
+
import "./chunk-GYODT7C4.js";
|
|
13
|
+
import "./chunk-L7MT53VM.js";
|
|
14
|
+
import "./chunk-DE5XHQQ6.js";
|
|
15
|
+
import "./chunk-CYZV5AXW.js";
|
|
16
|
+
import "./chunk-VPLRZSMY.js";
|
|
17
|
+
import "./chunk-6E6HCTP2.js";
|
|
18
|
+
import "./chunk-FNACCKQR.js";
|
|
19
|
+
import "./chunk-PUSFEC6B.js";
|
|
20
|
+
import "./chunk-UWQXGF44.js";
|
|
21
|
+
import "./chunk-IGU3R2JD.js";
|
|
21
22
|
import {
|
|
22
23
|
readExternalCliToken,
|
|
23
24
|
setExternalCliTokenFile
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-MTK4ZE7W.js";
|
|
26
|
+
import "./chunk-3ZQY7SLZ.js";
|
|
25
27
|
|
|
26
28
|
// src/ai-monitor.ts
|
|
27
29
|
import { Command as CommanderCommand, Option } from "commander";
|
|
@@ -3,26 +3,35 @@ import {
|
|
|
3
3
|
environmentRefreshOutput,
|
|
4
4
|
invalidateBusinessSkillSynchronization,
|
|
5
5
|
refreshEnvironmentAfterLogin
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S74XV3A6.js";
|
|
7
7
|
import {
|
|
8
8
|
MultiselectCancelled,
|
|
9
9
|
promptSingleSelect
|
|
10
10
|
} from "./chunk-7K24F7T2.js";
|
|
11
|
-
import {
|
|
12
|
-
missingAeHostGuidance,
|
|
13
|
-
missingAeHostHint
|
|
14
|
-
} from "./chunk-6ZIQV5GW.js";
|
|
15
11
|
import {
|
|
16
12
|
resolveHost
|
|
17
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-Z6WSCIHM.js";
|
|
18
14
|
import {
|
|
19
15
|
printError,
|
|
20
16
|
printOutput
|
|
21
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-DE5XHQQ6.js";
|
|
18
|
+
import {
|
|
19
|
+
DeviceFlowUnsupportedError,
|
|
20
|
+
authorizeLoginDevice,
|
|
21
|
+
buildVerificationUrl,
|
|
22
|
+
pollDeviceFlow,
|
|
23
|
+
resolveDeviceSessionRoute,
|
|
24
|
+
resolveLegacyLoginBase,
|
|
25
|
+
runDeviceFlow
|
|
26
|
+
} from "./chunk-2H3SFJE3.js";
|
|
22
27
|
import {
|
|
23
|
-
|
|
28
|
+
missingAeHostGuidance,
|
|
29
|
+
missingAeHostHint,
|
|
24
30
|
runHostCompatCheck
|
|
25
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-FNACCKQR.js";
|
|
32
|
+
import {
|
|
33
|
+
getLocalCliPackageInfo
|
|
34
|
+
} from "./chunk-PUSFEC6B.js";
|
|
26
35
|
import {
|
|
27
36
|
CliTokenValidationUnavailableError,
|
|
28
37
|
CredentialStoreUnreadableError,
|
|
@@ -38,319 +47,21 @@ import {
|
|
|
38
47
|
saveCredential,
|
|
39
48
|
updateCredentialMetadata,
|
|
40
49
|
validateCliTokenOnServer
|
|
41
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-UWQXGF44.js";
|
|
42
51
|
import {
|
|
43
52
|
getFallbackCliToken,
|
|
44
53
|
loadConfig,
|
|
45
54
|
saveConfig
|
|
46
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-IGU3R2JD.js";
|
|
47
56
|
import {
|
|
48
57
|
ExternalCliTokenError,
|
|
49
|
-
PermissionError,
|
|
50
58
|
logger,
|
|
51
59
|
normalizeUrl,
|
|
52
60
|
readExternalCliToken
|
|
53
|
-
} from "./chunk-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
function deviceApiPath(protocol, action) {
|
|
58
|
-
return protocol === "uba" ? `/v1/ta/cli/auth/device/${action}` : `/api/auth/device/${action}`;
|
|
59
|
-
}
|
|
60
|
-
function ubaAuthorizationDenial(code) {
|
|
61
|
-
if (code === "CLI_ACCESS_DISABLED") return {
|
|
62
|
-
code,
|
|
63
|
-
message: "CLI access is disabled for this account.",
|
|
64
|
-
hint: "Contact your administrator."
|
|
65
|
-
};
|
|
66
|
-
if (code === "ACCOUNT_UNAVAILABLE") return {
|
|
67
|
-
code,
|
|
68
|
-
message: "This account is unavailable.",
|
|
69
|
-
hint: "Contact your administrator or sign in with an active account."
|
|
70
|
-
};
|
|
71
|
-
if (code === "ORIGIN_DENIED") return {
|
|
72
|
-
code,
|
|
73
|
-
message: "Authorization must be approved from the trusted platform page.",
|
|
74
|
-
hint: "Open the verification URL on the configured AE host and sign in there."
|
|
75
|
-
};
|
|
76
|
-
return {
|
|
77
|
-
code: "AUTHORIZATION_DENIED",
|
|
78
|
-
message: "Device authorization was denied.",
|
|
79
|
-
hint: "Check your account status with your administrator before requesting authorization again."
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
var DeviceFlowUnsupportedError = class extends Error {
|
|
83
|
-
constructor(httpStatus) {
|
|
84
|
-
super("This AE server does not support device code login (it may be an older server version).");
|
|
85
|
-
this.httpStatus = httpStatus;
|
|
86
|
-
this.name = "DeviceFlowUnsupportedError";
|
|
87
|
-
}
|
|
88
|
-
httpStatus;
|
|
89
|
-
};
|
|
90
|
-
function looksLikeMissingEndpoint(status, contentType, body) {
|
|
91
|
-
if (status === 404) return true;
|
|
92
|
-
if (contentType && contentType.toLowerCase().includes("text/html")) return true;
|
|
93
|
-
const head = body.trimStart().toLowerCase();
|
|
94
|
-
return head.startsWith("<!doctype html") || head.startsWith("<html");
|
|
95
|
-
}
|
|
96
|
-
function openBrowser(url, _execFile) {
|
|
97
|
-
let parsedUrl;
|
|
98
|
-
try {
|
|
99
|
-
parsedUrl = new URL(url);
|
|
100
|
-
} catch {
|
|
101
|
-
logger.warn(`openBrowser: invalid URL, not opening`);
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
if (!["http:", "https:"].includes(parsedUrl.protocol)) {
|
|
105
|
-
logger.warn(`openBrowser: unsafe protocol "${parsedUrl.protocol}", not opening`);
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
const safeLogUrl = `${parsedUrl.origin}${parsedUrl.pathname}`;
|
|
109
|
-
const exec = _execFile ?? execFileSync;
|
|
110
|
-
try {
|
|
111
|
-
if (process.platform === "darwin") {
|
|
112
|
-
exec("open", [url], { timeout: 5e3 });
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
if (process.platform === "win32") {
|
|
116
|
-
exec("cmd", ["/c", "start", "", url], { timeout: 5e3 });
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
exec("xdg-open", [url], { timeout: 5e3 });
|
|
120
|
-
return true;
|
|
121
|
-
} catch (e) {
|
|
122
|
-
logger.warn(`openBrowser: failed to open ${safeLogUrl}`);
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
async function authorizeDevice(host, protocol = "legacy") {
|
|
127
|
-
const base = host.replace(/\/+$/, "");
|
|
128
|
-
const url = `${base}${deviceApiPath(protocol, "authorize")}`;
|
|
129
|
-
let resp;
|
|
130
|
-
try {
|
|
131
|
-
resp = await fetch(url, {
|
|
132
|
-
method: "POST",
|
|
133
|
-
headers: {
|
|
134
|
-
"Content-Type": "application/json",
|
|
135
|
-
...protocol === "uba" ? { "X-CLI-Verification-Origin": new URL(host).origin } : {}
|
|
136
|
-
},
|
|
137
|
-
redirect: "error",
|
|
138
|
-
signal: AbortSignal.timeout(1e4)
|
|
139
|
-
});
|
|
140
|
-
} catch (e) {
|
|
141
|
-
throw new Error("Device authorize request failed. Check the AE host and network, then retry.");
|
|
142
|
-
}
|
|
143
|
-
const contentType = resp.headers.get("content-type");
|
|
144
|
-
const text = await resp.text().catch(() => "");
|
|
145
|
-
if (looksLikeMissingEndpoint(resp.status, contentType, text)) {
|
|
146
|
-
throw new DeviceFlowUnsupportedError(resp.status);
|
|
147
|
-
}
|
|
148
|
-
if (!resp.ok) {
|
|
149
|
-
if (resp.status === 403) {
|
|
150
|
-
if (protocol === "uba") {
|
|
151
|
-
let code;
|
|
152
|
-
try {
|
|
153
|
-
code = JSON.parse(text)?.code;
|
|
154
|
-
} catch {
|
|
155
|
-
}
|
|
156
|
-
const denial = ubaAuthorizationDenial(code);
|
|
157
|
-
throw new PermissionError(denial.message, denial.code, denial.hint);
|
|
158
|
-
}
|
|
159
|
-
throw new PermissionError("CLI authorization is not allowed.", "CLI_ACCESS_DISABLED", "Contact your administrator.");
|
|
160
|
-
}
|
|
161
|
-
throw new Error(`Device authorize returned HTTP ${resp.status}`);
|
|
162
|
-
}
|
|
163
|
-
let body;
|
|
164
|
-
try {
|
|
165
|
-
body = JSON.parse(text);
|
|
166
|
-
} catch {
|
|
167
|
-
throw new Error("Device authorize returned invalid JSON");
|
|
168
|
-
}
|
|
169
|
-
if (typeof body.device_code !== "string" || !body.device_code || typeof body.user_code !== "string" || !body.user_code) {
|
|
170
|
-
throw new Error("Device authorize response missing required fields");
|
|
171
|
-
}
|
|
172
|
-
if (protocol === "uba" && (!Number.isInteger(body.expires_in) || body.expires_in < 1 || body.expires_in > 300 || !Number.isInteger(body.interval) || body.interval < 1 || body.interval > body.expires_in)) {
|
|
173
|
-
throw new Error("UBA authorization returned invalid polling limits. Check the server deployment.");
|
|
174
|
-
}
|
|
175
|
-
return body;
|
|
176
|
-
}
|
|
177
|
-
async function pollDeviceToken(host, deviceCode, protocol = "legacy") {
|
|
178
|
-
const base = host.replace(/\/+$/, "");
|
|
179
|
-
const url = `${base}${deviceApiPath(protocol, "token")}`;
|
|
180
|
-
let resp;
|
|
181
|
-
try {
|
|
182
|
-
resp = await fetch(url, {
|
|
183
|
-
method: "POST",
|
|
184
|
-
headers: { "Content-Type": "application/json" },
|
|
185
|
-
body: JSON.stringify({ device_code: deviceCode }),
|
|
186
|
-
redirect: "error",
|
|
187
|
-
signal: AbortSignal.timeout(1e4)
|
|
188
|
-
});
|
|
189
|
-
} catch (e) {
|
|
190
|
-
return { status: "error", message: "Network error while polling authorization." };
|
|
191
|
-
}
|
|
192
|
-
if (resp.status === 200) {
|
|
193
|
-
let body;
|
|
194
|
-
try {
|
|
195
|
-
body = await resp.json();
|
|
196
|
-
} catch {
|
|
197
|
-
return { status: "error", message: "Token response is not valid JSON" };
|
|
198
|
-
}
|
|
199
|
-
if (typeof body.access_token !== "string" || !body.access_token) {
|
|
200
|
-
return { status: "error", message: "Token response missing access_token" };
|
|
201
|
-
}
|
|
202
|
-
return { status: "approved", tokens: body };
|
|
203
|
-
}
|
|
204
|
-
if (resp.status === 400) {
|
|
205
|
-
let errorBody;
|
|
206
|
-
try {
|
|
207
|
-
errorBody = await resp.json();
|
|
208
|
-
} catch {
|
|
209
|
-
errorBody = {};
|
|
210
|
-
}
|
|
211
|
-
const err = errorBody.error;
|
|
212
|
-
if (err === "authorization_pending") return { status: "pending" };
|
|
213
|
-
if (err === "slow_down") return { status: "slow_down" };
|
|
214
|
-
if (err === "expired_token") return { status: "expired" };
|
|
215
|
-
if (err === "access_denied") return {
|
|
216
|
-
status: "denied",
|
|
217
|
-
code: "AUTHORIZATION_DENIED",
|
|
218
|
-
message: "Device authorization was denied.",
|
|
219
|
-
hint: "Run ae-cli auth login again only when you want to request authorization."
|
|
220
|
-
};
|
|
221
|
-
return { status: "error", message: "Token endpoint returned an unrecognized authorization error." };
|
|
222
|
-
}
|
|
223
|
-
if (resp.status === 403) {
|
|
224
|
-
let errorBody = {};
|
|
225
|
-
try {
|
|
226
|
-
errorBody = await resp.json();
|
|
227
|
-
} catch {
|
|
228
|
-
}
|
|
229
|
-
if (protocol === "uba") return { status: "denied", ...ubaAuthorizationDenial(errorBody.code) };
|
|
230
|
-
return {
|
|
231
|
-
status: "denied",
|
|
232
|
-
code: errorBody.code ?? "CLI_ACCESS_DISABLED",
|
|
233
|
-
message: errorBody.message ?? errorBody.error ?? "CLI access is disabled for this account.",
|
|
234
|
-
hint: errorBody.hint
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
const contentType = resp.headers.get("content-type");
|
|
238
|
-
const text = await resp.text().catch(() => "");
|
|
239
|
-
if (looksLikeMissingEndpoint(resp.status, contentType, text)) {
|
|
240
|
-
return { status: "unsupported" };
|
|
241
|
-
}
|
|
242
|
-
return { status: "error", message: `Unexpected HTTP ${resp.status} from token endpoint` };
|
|
243
|
-
}
|
|
244
|
-
function buildVerificationUrl(host, userCode, protocol = "legacy") {
|
|
245
|
-
if (protocol === "uba") {
|
|
246
|
-
return `${host.replace(/\/+$/, "")}/#/cli/device-activate?user_code=${encodeURIComponent(userCode)}`;
|
|
247
|
-
}
|
|
248
|
-
return `${host.replace(/\/+$/, "")}/device-activate?user_code=${encodeURIComponent(userCode)}`;
|
|
249
|
-
}
|
|
250
|
-
async function pollDeviceFlow(host, deviceCode, options = {}, onStatus) {
|
|
251
|
-
const emit = (msg) => {
|
|
252
|
-
if (onStatus) onStatus(msg);
|
|
253
|
-
};
|
|
254
|
-
let intervalMs = options.intervalMs ?? 5e3;
|
|
255
|
-
const expiresIn = options.expiresIn ?? 300;
|
|
256
|
-
const deadline = Date.now() + expiresIn * 1e3;
|
|
257
|
-
let pollCount = 0;
|
|
258
|
-
while (Date.now() < deadline) {
|
|
259
|
-
await sleep(intervalMs);
|
|
260
|
-
pollCount++;
|
|
261
|
-
const result = await pollDeviceToken(host, deviceCode, options.protocol);
|
|
262
|
-
if (result.status === "approved") {
|
|
263
|
-
emit(`Authorization successful! (polled ${pollCount} time(s))`);
|
|
264
|
-
return result.tokens;
|
|
265
|
-
}
|
|
266
|
-
if (result.status === "pending") {
|
|
267
|
-
if (pollCount % 5 === 0) {
|
|
268
|
-
const remaining = Math.max(0, Math.round((deadline - Date.now()) / 1e3));
|
|
269
|
-
emit(`Waiting for authorization... (expires in ${remaining}s)`);
|
|
270
|
-
}
|
|
271
|
-
logger.info(`device-auth: poll #${pollCount} pending`);
|
|
272
|
-
continue;
|
|
273
|
-
}
|
|
274
|
-
if (result.status === "slow_down") {
|
|
275
|
-
intervalMs += 5e3;
|
|
276
|
-
logger.info(`device-auth: slow_down received, new interval=${intervalMs}ms`);
|
|
277
|
-
continue;
|
|
278
|
-
}
|
|
279
|
-
if (result.status === "expired") {
|
|
280
|
-
throw new Error(
|
|
281
|
-
`Device code has expired. Please run ae-cli auth login again to restart the authorization flow.`
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
if (result.status === "denied") {
|
|
285
|
-
throw new PermissionError(result.message, result.code, result.hint);
|
|
286
|
-
}
|
|
287
|
-
if (result.status === "unsupported") {
|
|
288
|
-
throw new DeviceFlowUnsupportedError();
|
|
289
|
-
}
|
|
290
|
-
if (result.status === "error") {
|
|
291
|
-
logger.warn(`device-auth: poll error: ${result.message}`);
|
|
292
|
-
emit(`Poll error: ${result.message}`);
|
|
293
|
-
if (result.message.includes("HTTP 401") || result.message.includes("HTTP 403")) {
|
|
294
|
-
throw new Error(`Authorization denied (${result.message}). Please check your configuration or run ae-cli auth login again.`);
|
|
295
|
-
}
|
|
296
|
-
continue;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
throw new Error(
|
|
300
|
-
`Authorization timed out (not completed within ${expiresIn}s). Please run ae-cli auth login again.`
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
async function runDeviceFlow(host, options = {}, onStatus) {
|
|
304
|
-
const emit = (msg) => {
|
|
305
|
-
if (onStatus) onStatus(msg);
|
|
306
|
-
};
|
|
307
|
-
emit("Requesting authorization code from server...");
|
|
308
|
-
const auth = options.authorization ?? await authorizeDevice(host, options.protocol);
|
|
309
|
-
const userCode = auth.user_code;
|
|
310
|
-
const verifyUrl = buildVerificationUrl(host, userCode, options.protocol);
|
|
311
|
-
const expiresIn = auth.expires_in ?? 300;
|
|
312
|
-
emit("");
|
|
313
|
-
emit(`Verification code: ${userCode}`);
|
|
314
|
-
emit(`Open the following link in your browser to complete authorization:`);
|
|
315
|
-
emit(` ${verifyUrl}`);
|
|
316
|
-
emit("");
|
|
317
|
-
if (!options.noBrowser) {
|
|
318
|
-
const opened = openBrowser(verifyUrl);
|
|
319
|
-
if (opened) {
|
|
320
|
-
emit("(Attempted to open the link in your browser)");
|
|
321
|
-
} else {
|
|
322
|
-
emit("(Could not open browser automatically; please copy the link above manually)");
|
|
323
|
-
}
|
|
324
|
-
emit("");
|
|
325
|
-
}
|
|
326
|
-
return pollDeviceFlow(host, auth.device_code, { intervalMs: (auth.interval ?? 5) * 1e3, expiresIn, protocol: options.protocol }, onStatus);
|
|
327
|
-
}
|
|
328
|
-
function sleep(ms) {
|
|
329
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// src/core/login-device-flow.ts
|
|
333
|
-
function resolveLegacyLoginBase(host) {
|
|
334
|
-
const base = host.replace(/\/+$/, "");
|
|
335
|
-
const basePath = process.env.TE_CLAUDE_BASE_PATH || "/agent";
|
|
336
|
-
return base.endsWith(basePath) ? base : base + basePath;
|
|
337
|
-
}
|
|
338
|
-
function resolveDeviceSessionRoute(host, deviceCode) {
|
|
339
|
-
return deviceCode.startsWith("uba_") ? { baseUrl: host, protocol: "uba" } : { baseUrl: resolveLegacyLoginBase(host), protocol: "legacy" };
|
|
340
|
-
}
|
|
341
|
-
async function authorizeLoginDevice(host) {
|
|
342
|
-
try {
|
|
343
|
-
const authorization = await authorizeDevice(host, "uba");
|
|
344
|
-
if (!/^uba_[A-Za-z0-9_-]+$/.test(authorization.device_code)) {
|
|
345
|
-
throw new Error("UBA authorization returned an unsupported device-code format. Check the server deployment.");
|
|
346
|
-
}
|
|
347
|
-
return { baseUrl: host, protocol: "uba", authorization };
|
|
348
|
-
} catch (error) {
|
|
349
|
-
if (!(error instanceof DeviceFlowUnsupportedError) || error.httpStatus !== 404) throw error;
|
|
350
|
-
const baseUrl = resolveLegacyLoginBase(host);
|
|
351
|
-
return { baseUrl, protocol: "legacy", authorization: await authorizeDevice(baseUrl) };
|
|
352
|
-
}
|
|
353
|
-
}
|
|
61
|
+
} from "./chunk-MTK4ZE7W.js";
|
|
62
|
+
import {
|
|
63
|
+
PermissionError
|
|
64
|
+
} from "./chunk-3ZQY7SLZ.js";
|
|
354
65
|
|
|
355
66
|
// src/commands/auth.ts
|
|
356
67
|
var HOST_OPTION_DESC = "Override active AE host URL (e.g., https://ta.thinkingdata.cn)";
|
|
@@ -368,6 +79,11 @@ async function validateExistingCliToken(host, cliToken, external = false) {
|
|
|
368
79
|
return { valid: true, trusted: false, details: await validateCliTokenOnServer(host, cliToken) };
|
|
369
80
|
} catch (error) {
|
|
370
81
|
if (error instanceof CliTokenValidationUnavailableError) {
|
|
82
|
+
if (external && readExternalCliToken(host)?.taskContext) {
|
|
83
|
+
printError("auth", error.message, "Retry when the gateway is available; managed execution credentials cannot be trusted without validation.", "CLI_TOKEN_VALIDATION_UNAVAILABLE");
|
|
84
|
+
process.exitCode = 1;
|
|
85
|
+
return { valid: false, trusted: false, details: {} };
|
|
86
|
+
}
|
|
371
87
|
logger.warn(`auth status: ${error.message}; trusting the stored CLI token for compatibility`);
|
|
372
88
|
return { valid: true, trusted: true, details: {} };
|
|
373
89
|
}
|
|
@@ -539,11 +255,12 @@ async function switchActiveAccount(program, opts) {
|
|
|
539
255
|
}
|
|
540
256
|
async function persistDeviceTokens(host, tokens, options = {}) {
|
|
541
257
|
assertCredentialsReadable(host);
|
|
542
|
-
const cliToken = await mintCliToken(host, tokens.access_token);
|
|
258
|
+
const cliToken = await mintCliToken(host, tokens.access_token, options.signal);
|
|
543
259
|
let validation = {};
|
|
544
260
|
try {
|
|
545
|
-
validation = await validateCliTokenOnServer(host, cliToken);
|
|
261
|
+
validation = await validateCliTokenOnServer(host, cliToken, options.signal);
|
|
546
262
|
} catch (error) {
|
|
263
|
+
options.signal?.throwIfAborted();
|
|
547
264
|
if (error instanceof CliTokenValidationUnavailableError) {
|
|
548
265
|
logger.warn(`auth login: ${error.message}; saving CLI token without account metadata for compatibility`);
|
|
549
266
|
} else {
|
|
@@ -564,7 +281,7 @@ async function persistDeviceTokens(host, tokens, options = {}) {
|
|
|
564
281
|
throw error;
|
|
565
282
|
}
|
|
566
283
|
clearCliTokenCache(host);
|
|
567
|
-
await runHostCompatCheck(getLocalCliPackageInfo(), host);
|
|
284
|
+
if (options.checkCompatibility !== false) await runHostCompatCheck(getLocalCliPackageInfo(), host);
|
|
568
285
|
return saved;
|
|
569
286
|
}
|
|
570
287
|
async function persistManualCliToken(host, cliToken, options = {}) {
|