@thinkingai/ae-cli 6.1.18 → 6.1.20

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 (127) hide show
  1. package/README.md +97 -38
  2. package/README.zh.md +101 -38
  3. package/dist/{auth-ROB2EDYV.js → auth-FUM37MHF.js} +241 -126
  4. package/dist/{capability-DKMYUTLC.js → capability-AXFQW5WM.js} +49 -35
  5. package/dist/{chunk-JHENBQ5B.js → chunk-4P355ZWB.js} +70 -1
  6. package/dist/chunk-6ZIQV5GW.js +26 -0
  7. package/dist/{chunk-TUKQZTMI.js → chunk-7K24F7T2.js} +2 -0
  8. package/dist/{chunk-OO6XR6LK.js → chunk-AMBFK2K3.js} +2 -0
  9. package/dist/chunk-ATSM5XAW.js +623 -0
  10. package/dist/{chunk-4XXOWOTA.js → chunk-BBEFP4SB.js} +31 -38
  11. package/dist/{chunk-BYYS3ANB.js → chunk-CZU3V3DQ.js} +5 -15
  12. package/dist/{chunk-VTWMIC5L.js → chunk-E2JKXMVO.js} +2 -0
  13. package/dist/chunk-ECBLHAZO.js +15 -0
  14. package/dist/{sync-HKIOZXQE.js → chunk-I4WQAEYB.js} +31 -540
  15. package/dist/{chunk-DWO43OIB.js → chunk-JQ3ENZZH.js} +2 -0
  16. package/dist/chunk-LNZBEQXW.js +25216 -0
  17. package/dist/{chunk-ZQ47LWTI.js → chunk-QJQZH5GQ.js} +49 -79
  18. package/dist/{chunk-QZ3AS4KK.js → chunk-RSG4ONOI.js} +9 -8
  19. package/dist/{chunk-4NN5IWVN.js → chunk-T6OSFQZD.js} +2 -0
  20. package/dist/{chunk-Y3LOALAV.js → chunk-TAL6CZH6.js} +8 -7
  21. package/dist/{chunk-3KWQYGYI.js → chunk-TKHSULJT.js} +2 -0
  22. package/dist/chunk-VXNMYUXU.js +202 -0
  23. package/dist/{chunk-3FY3RJ26.js → chunk-WZ6YVQSF.js} +15 -14
  24. package/dist/{chunk-6EIJSNBD.js → chunk-Y74WTIKJ.js} +2 -0
  25. package/dist/{community-report-client-C7WDGET3.js → community-report-client-XXWGSBSD.js} +3 -4
  26. package/dist/{config-BMYZX2UE.js → config-EXUGQN5T.js} +10 -10
  27. package/dist/{data-integration-QEKDWQDY.js → data-integration-4NZ53OMT.js} +920 -97
  28. package/dist/index.js +56 -81
  29. package/dist/{local-data-upload-client-4YYHSYD6.js → local-data-upload-client-KYOKVYZV.js} +3 -4
  30. package/dist/{memory-I2WXDTV2.js → memory-ATNKZNW5.js} +6 -7
  31. package/dist/{metadata-I4C2EWUN.js → metadata-VZVC7YMH.js} +10 -11
  32. package/dist/{model-HLHIEFMU.js → model-E4JMQ4V2.js} +8 -9
  33. package/dist/{personal-semantic-preference-LIPACBDX.js → personal-semantic-preference-7S2SQ3UV.js} +9 -10
  34. package/dist/{project-semantic-RT3R2VQD.js → project-semantic-2SZP2OPO.js} +13 -14
  35. package/dist/sync-YV3E66IF.js +520 -0
  36. package/dist/{te-agent-BR6VDBNX.js → te-agent-JB5T3PO7.js} +396 -92
  37. package/dist/{te-analysis-7VUNUYWZ.js → te-analysis-3YJAAT2D.js} +196 -43
  38. package/dist/{te-community-5DMNKJWY.js → te-community-UDBI672N.js} +12 -34
  39. package/dist/{te-dataops-6P5IKWNJ.js → te-dataops-ZLYOCXZ4.js} +480 -81
  40. package/dist/{te-engage-KZPR5R22.js → te-engage-4XG6OJML.js} +88 -16
  41. package/dist/{te-experiment-6BITX4RD.js → te-experiment-VXUWPINJ.js} +83 -12
  42. package/dist/te-kb-WYQWHFSC.js +1732 -0
  43. package/dist/{te-system-FXITO2JG.js → te-system-7G6F2LJA.js} +569 -35
  44. package/dist/{te-team-ADOC2ROP.js → te-team-E7FBBXMQ.js} +8 -7
  45. package/dist/{update-YCYCKJOO.js → update-D47BUG25.js} +8 -8
  46. package/package.json +22 -10
  47. package/skills/ae-agent/SKILL.md +30 -13
  48. package/skills/ae-agent/references/agent-distribution.md +94 -0
  49. package/skills/ae-agent/references/approval-request.md +4 -0
  50. package/skills/ae-agent/references/command_index.md +9 -2
  51. package/skills/ae-agent/references/create-automation.md +20 -2
  52. package/skills/ae-agent/references/get-agent-context.md +70 -0
  53. package/skills/ae-agent/references/list-automations.md +18 -3
  54. package/skills/ae-agent/references/list-mcp-credentials.md +1 -1
  55. package/skills/ae-agent/references/mcp-token.md +3 -3
  56. package/skills/ae-agent/references/set-mcp-credential.md +0 -1
  57. package/skills/ae-agent/references/update-automation.md +18 -0
  58. package/skills/ae-analysis/SKILL.md +11 -2
  59. package/skills/ae-analysis/references/adhoc_run.md +2 -0
  60. package/skills/ae-analysis/references/ai_models.md +23 -3
  61. package/skills/ae-analysis/references/analysis_gateway_assets.md +3 -3
  62. package/skills/ae-analysis/references/audience_models.md +18 -0
  63. package/skills/ae-analysis/references/command_index.md +9 -9
  64. package/skills/ae-analysis/references/cross_source_config.md +84 -0
  65. package/skills/ae-analysis/references/dashboard_update.md +1 -1
  66. package/skills/ae-analysis/references/project_timezone_update.md +13 -4
  67. package/skills/ae-analysis/references/property_create.md +2 -0
  68. package/skills/ae-analysis/references/super_metadata_batch_create.md +2 -0
  69. package/skills/ae-analysis/references/user_cluster_models.md +2 -0
  70. package/skills/ae-analysis/references/user_cluster_update.md +8 -4
  71. package/skills/ae-analysis/references/user_tag_create.md +30 -2
  72. package/skills/ae-analysis/references/user_tag_models.md +17 -3
  73. package/skills/ae-analysis/references/user_tag_update.md +14 -2
  74. package/skills/ae-data-integration/SKILL.md +3 -1
  75. package/skills/ae-data-integration/references/dimension-routing.md +36 -0
  76. package/skills/ae-data-integration/references/error-handling.md +54 -1
  77. package/skills/ae-data-integration/references/local-analysis.md +2 -0
  78. package/skills/ae-data-integration/references/source-inspect.md +18 -2
  79. package/skills/ae-data-integration/references/tracking-plan.md +1 -1
  80. package/skills/ae-data-integration/references/transform.md +4 -2
  81. package/skills/ae-data-integration/references/ue-mapping.md +5 -2
  82. package/skills/ae-data-integration/references/ue-routing.md +40 -1
  83. package/skills/ae-dataops/SKILL.md +11 -1
  84. package/skills/ae-dataops/references/dataops-backfill.md +135 -0
  85. package/skills/ae-engage/SKILL.md +5 -0
  86. package/skills/ae-engage/references/build-task-save-guide.md +5 -1
  87. package/skills/ae-engage/references/save-flow.md +37 -1
  88. package/skills/ae-engage/references/save-task.md +6 -0
  89. package/skills/ae-experiment/SKILL.md +6 -2
  90. package/skills/ae-experiment/references/save_metric.md +20 -8
  91. package/skills/ae-generate-tracking-plan/SKILL.md +25 -13
  92. package/skills/ae-generate-tracking-plan/references/business-dimension-mapping.md +1 -1
  93. package/skills/ae-kb/SKILL.md +218 -36
  94. package/skills/ae-kb/references/query-workflow.md +59 -29
  95. package/skills/ae-kb/references/versions.md +46 -0
  96. package/skills/ae-system/SKILL.md +29 -31
  97. package/skills/ae-system/references/channel-management.md +303 -0
  98. package/skills/ae-use-agent/SKILL.md +42 -0
  99. package/skills/ae-use-agent/references/local-agent.md +114 -0
  100. package/dist/auth-GBMV6TEJ.js +0 -14
  101. package/dist/capability-HYVVPG25.js +0 -352
  102. package/dist/chunk-EFH4XWYC.js +0 -556
  103. package/dist/chunk-J2DEBMRF.js +0 -313
  104. package/dist/chunk-JRJY5DMJ.js +0 -71
  105. package/dist/chunk-OMPRXM3V.js +0 -349
  106. package/dist/chunk-QNOLN2LJ.js +0 -509
  107. package/dist/chunk-RJDU7NYP.js +0 -1198
  108. package/dist/chunk-RNAALWJK.js +0 -98
  109. package/dist/chunk-SERWF6G5.js +0 -13
  110. package/dist/chunk-UW5UN47B.js +0 -70
  111. package/dist/chunk-ZQKDZXDO.js +0 -317
  112. package/dist/client-L2YDMHQ6.js +0 -203
  113. package/dist/memory-3ORCR7JH.js +0 -893
  114. package/dist/metadata-VUOQJE26.js +0 -339
  115. package/dist/model-UGRDX4MW.js +0 -139
  116. package/dist/personal-semantic-preference-OEISBRHM.js +0 -239
  117. package/dist/project-semantic-FFPWFPIW.js +0 -1114
  118. package/dist/sync-TFHU2UTG.js +0 -10261
  119. package/dist/te-agent-VLYOV7S4.js +0 -3894
  120. package/dist/te-analysis-4YGQL5RC.js +0 -9357
  121. package/dist/te-community-ISDQWJU7.js +0 -1859
  122. package/dist/te-dataops-CVULXNVB.js +0 -2209
  123. package/dist/te-engage-N5WI32H6.js +0 -4898
  124. package/dist/te-experiment-UVR4HLND.js +0 -988
  125. package/dist/te-kb-RCLSSH2Q.js +0 -935
  126. package/dist/te-system-K2GYMCTB.js +0 -2213
  127. package/skills/ae-agent/references/auto-provision-mcp-credentials.md +0 -57
@@ -0,0 +1,46 @@
1
+ # Published knowledge-base versions
2
+
3
+ Versions are immutable successful publications. No historical version is created until the first successful compile. Failed or cancelled compiles do not consume a version number. Existing `+compile`, `+status` and `+list-sources` responses pass through server version labels and draft state; `+index`, `+grep`, `+read` and `+ask` always address current content.
4
+
5
+ When `+status` returns `wiki_review_required`, inspect `publicationReview.code`, report that administrator review is required, and stop ordinary compile polling. The active Run and write lock remain in place; do not cancel or force another compile. This also covers an interrupted publication after server restart.
6
+
7
+ Discover exact names/scopes via `kb +list`, then inspect history:
8
+
9
+ ```bash
10
+ ae-cli kb +versions --name handbook --scope company --limit 100
11
+ ae-cli kb +version-show --name handbook --scope company --version 2
12
+ ae-cli kb +version-sources --name handbook --scope company --version 2 --source-type zip
13
+ ae-cli kb +version-diff --name handbook --scope company --from 1 --to 2
14
+ ae-cli kb +version-tree --name handbook --scope company --version 2 --id <historical-source-id>
15
+ ae-cli kb +version-read --name handbook --scope company --version 2 --id <historical-source-id> --path guides/start.md
16
+ ae-cli kb +version-download --name handbook --scope company --version 2 --id <historical-file-source-id> --output ./manual.pdf
17
+ ```
18
+
19
+ - `--version`, `--from` and `--to` use integer version numbers, without a `v` prefix. `+version-sources` IDs come from that historical snapshot; never substitute current source metadata.
20
+ - `+versions`, `+version-sources` and `+version-tree` return one page. Use `--cursor` with the returned `nextCursor`, retaining the same target and filters. `--limit` is 1–200.
21
+ - `--scope personal|company` is exact. Omitting it keeps the existing personal-then-company lookup. A missing target in an explicit scope never falls back.
22
+ - `+version-tree/+version-read` accept ZIP or URL parent sources. Paths are source-relative and cannot contain absolute, parent or backslash segments. Text preview is bounded; supported PDF/images use a typed data URL. Unsupported or oversized files return metadata and `previewable: false`.
23
+ - `+version-download` accepts ordinary file sources only and creates a new local file with exclusive creation. It never overwrites an existing file. Directory sources return `KB_VERSION_DIRECTORY_DOWNLOAD_UNSUPPORTED`; the CLI does not reconstruct ZIPs or export an entire version.
24
+
25
+ ## Rollback
26
+
27
+ Copy `latestVersionId` and an earlier target version from `+versions`. Explicitly explain the effects before requesting rollback: target-source edits and deletion intents are replaced; target-external sources with a previous successful publication are soft-deleted; target-external unpublished additions and their files remain unchanged.
28
+
29
+ ```bash
30
+ ae-cli kb +rollback --name handbook --scope company --version 1 --expected-latest-version-id <latestVersionId> --request-id <stable-request-id> --dry-run
31
+ ae-cli kb +rollback --name handbook --scope company --version 1 --expected-latest-version-id <latestVersionId> --request-id <stable-request-id>
32
+ ae-cli kb +rollback-status --name handbook --scope company --operation-id <operationId>
33
+ ```
34
+
35
+ `+rollback` is `high-risk-write`; use `--yes` only for an already authorized exact operation. A target must be strictly older than the current version. Success creates a new version (for example v3 → v1 produces v4), retaining all previous snapshots.
36
+
37
+ The caller must supply a stable ASCII `request-id` containing letters, digits, underscores or hyphens (1–191 characters). Reuse that exact ID, target and expected latest ID after a network interruption. The CLI does not generate another request ID, pick a different target, or retry a 409 automatically. A changed request under the same ID returns `KB_VERSION_OPERATION_REQUEST_CONFLICT`.
38
+
39
+ `queued/running` means accepted but not completed. Query `+rollback-status` using the returned `operationId`; only `status: success` with `resultVersionId` proves publication. `failed` is a terminal result; a later intentional attempt needs a new request ID. When `running` includes `KB_PUBLICATION_COMMIT_UNKNOWN`, `KB_PUBLICATION_ROLLBACK_INCOMPLETE`, or `KB_PUBLICATION_REVIEW_REQUIRED`, tell the user administrator review is required and writes remain blocked. Stop normal progress/polling; do not start another rollback. Status remains readable.
40
+
41
+ Transition status: transitional
42
+ Owning module: te-claude External Knowledge Base Versions API
43
+ Current transport: authenticated External REST via kbApi
44
+ Gateway target: TBD (published history and persistent rollback operations)
45
+ Review after: 2026-12-07
46
+ Exit condition: migrate when equivalent immutable-history and idempotent rollback Gateway capabilities exist; retain stable request IDs, exact-scope targeting and local file safety.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ae-system
3
- version: 1.1.0
4
- description: "AE Agent system administration CLI for root and agent administrators. Use when the user asks to manage Agent members, sandboxes and shared tools, company model visibility/defaults/pricing, usage statistics and exports, cost quotas, balance alerts, or IM channels. Must use ae-cli system commands, discover real IDs before writes, and never attempt to bypass a permission denial."
3
+ version: 1.2.0
4
+ description: "AE Agent system administration CLI for root and agent administrators. Use when the user asks to manage Agent members, sandboxes and shared tools, company model visibility/defaults/pricing, usage statistics and exports, cost quotas, balance alerts, IM channels, channel routing, WhatsApp Web linking, or Feishu user bindings. Must use ae-cli system commands, discover real IDs before writes, and never attempt to bypass a permission denial."
5
5
  ---
6
6
 
7
7
  # ae-system
@@ -10,13 +10,14 @@ Use the `system` domain for Agent system administration:
10
10
 
11
11
  ```bash
12
12
  ae-cli system +<command> [options]
13
+ ae-cli system <resource> <action> [options]
13
14
  ```
14
15
 
15
16
  ## Mandatory Rules
16
17
 
17
18
  - These commands are only for users whose Agent role is `root` or `agent_admin`.
18
- - The te-agent `/api/admin/**` endpoint is the final authorization boundary. A member receives a permission error (HTTP 403). Do not retry login or attempt a different endpoint after a 403.
19
- - Run `ae-cli auth login --host <host>` before using this domain. System administration requires a user access-token session; sandbox identity headers are not an authorization substitute.
19
+ - The te-agent `/api/admin/**` and `/api/cli/channel/v1/**` endpoints are the final authorization boundaries. A member receives a permission error (HTTP 403). Do not retry login or attempt a different endpoint after a 403.
20
+ - Run `ae-cli auth login --host <host>` before using this domain. System administration requires a valid user CLI-token session; sandbox identity headers are not an authorization substitute.
20
21
  - `+npm-install` is the exception that must also run inside a Linux te-agent sandbox because it packages the installed Linux files. It still requires the logged-in user to be `root` or `agent_admin`.
21
22
  - Discover real IDs with a list command before any update or delete. Never guess a user, sandbox, model, quota rule, or channel ID.
22
23
  - Before every write, run `--dry-run`, show the target and effect, and obtain explicit user confirmation. The CLI itself prompts only for `high-risk-write`; `--yes` can bypass that prompt and is not a security boundary.
@@ -353,41 +354,38 @@ Rules:
353
354
 
354
355
  ### Channels
355
356
 
357
+ For channel setup, routing, WhatsApp Web linking, or Feishu user binding, read [references/channel-management.md](references/channel-management.md) before taking action. It defines the two confirmation phases and the `ae-cli` plus Feishu OpenAPI MCP workflow.
358
+
356
359
  | Command | Risk | Purpose |
357
360
  | --- | --- | --- |
358
- | `+list-channels` | read | List Feishu, Lark, and Slack channels. |
361
+ | `+list-channels` | read | List all configured channels. |
362
+ | `channel get` | read | Read one channel, its verification state, and endpoints. |
359
363
  | `+create-channel` | write | Create one channel. |
360
364
  | `+update-channel` | write | Update channel settings, credentials, model, prompt, or enabled state. |
361
365
  | `+remove-channel` | high-risk-write | Delete a channel, unbind users, and stop its connection. |
362
-
363
- Always use `@file` for channel payloads when they contain credentials:
366
+ | `channel verify` | write | Verify credentials and discover endpoints. |
367
+ | `channel routing get` | read | Read one endpoint's group message routing. |
368
+ | `channel routing set` | write | Replace one endpoint's group message routing. |
369
+ | `channel whatsapp-web status` | read | Read a WhatsApp Web link state and QR data. |
370
+ | `channel whatsapp-web start` | write | Start or resume WhatsApp Web QR linking. |
371
+ | `channel whatsapp-web unlink` | high-risk-write | Unlink WhatsApp Web and remove stored credentials. |
372
+ | `channel binding list` | read | List channel user bindings. |
373
+ | `channel binding bind-feishu` | write | Bind one Feishu user. |
374
+ | `+bind-feishu-users` | write | Bind 1-100 Feishu users and optionally assign Agents. |
375
+ | `channel binding unbind` | high-risk-write | Delete one channel user binding. |
376
+ | `channel binding set-agent` | write | Set or clear one binding's private-chat default Agent. |
377
+
378
+ Use canonical snake_case request fields. The four original commands also accept their legacy camelCase JSON fields for compatibility. Always use `@file` for credentials and batch rosters:
364
379
 
365
380
  ```bash
366
381
  ae-cli system +create-channel --channel @channel.json
367
382
  ae-cli system +update-channel --id <channel-id> --channel @channel-update.json
383
+ ae-cli system +bind-feishu-users \
384
+ --channel-id <channel-id> \
385
+ --endpoint-id <endpoint-id> \
386
+ --bindings @bindings.json
368
387
  ```
369
388
 
370
- Create schema:
371
-
372
- ```json
373
- {
374
- "name": "Required display name",
375
- "type": "feishu",
376
- "config": {
377
- "appId": "Feishu/Lark",
378
- "appSecret": "Feishu/Lark",
379
- "botToken": "Slack",
380
- "appToken": "Slack",
381
- "clientId": "optional",
382
- "clientSecret": "optional"
383
- },
384
- "model": "optional Model.id or modelId::scope",
385
- "systemPrompt": "optional"
386
- }
387
- ```
388
-
389
- Update accepts a partial object with `name`, `config`, `model`, `systemPrompt`, `enabled`, or `unbindUsers`. Channel type is immutable after creation. Dry-run replaces secret values with `***`.
390
-
391
389
  ## Permission Errors
392
390
 
393
391
  A permission response looks like:
@@ -412,9 +410,9 @@ An authenticated `root` or `agent_admin` is still scoped to their own company. T
412
410
 
413
411
  ## Transport Status
414
412
 
415
- This is a Transitional L2 domain backed by te-agent `/api/admin/**`.
413
+ This is a Transitional domain backed by te-agent `/api/admin/**` and `/api/cli/channel/v1/**`.
416
414
 
417
- - Maintainer: te-agent admin routes and `src/commands/te-system/**`.
418
- - Migration target: system Capability Gateway.
415
+ - Maintainer: te-agent admin/channel-management routes and `src/commands/te-system/**`.
416
+ - Migration target: system and channel Capability Gateways.
419
417
  - Review date: 2026-10-24.
420
418
  - Exit condition: migrate after equivalent gateway schema, auth, risk, dry-run, and output contracts are stable.
@@ -0,0 +1,303 @@
1
+ # Channel Management
2
+
3
+ Use this workflow for channel configuration, group routing, WhatsApp Web linking, and Feishu user bindings. All channel endpoints require an authenticated `root` or `agent_admin` and enforce company isolation.
4
+
5
+ ## Scope
6
+
7
+ Channel configuration supports `feishu`, `lark`, `slack`, `discord`, `dingtalk`, `wecom`, `mattermost`, `google_chat`, and `whatsapp`. Administrator-driven user binding is available only for `feishu`.
8
+
9
+ The default Feishu binding is group-routing ready. It requires a verified `endpoint_id` for the channel and a `union_id` for every user. Use `--private-only` only after the user explicitly accepts private-chat-only behavior; never downgrade silently when either value is unavailable.
10
+
11
+ ## Two Confirmation Phases
12
+
13
+ Treat channel configuration and personnel binding as separate writes:
14
+
15
+ 1. **Channel configuration phase**: discover current state, prepare channel configuration and routing, run every applicable `ae-cli ... --dry-run`, show the redacted target/effect, and obtain one explicit confirmation before executing this phase.
16
+ 2. **Personnel binding phase**: resolve the final roster and IDs, inspect each person's sandbox readiness, validate the complete binding batch and every required sandbox write with `--dry-run`, show counts, endpoint, private-only state, Agent assignments, sandbox creates, and sandbox enables, then obtain explicit confirmation before each planned write set. A roster containing only existing Agent members needs one final binding-and-sandbox confirmation.
17
+
18
+ A confirmation for phase 1 does not authorize phase 2. A confirmation for one roster does not authorize a changed roster.
19
+
20
+ ## Phase 1: Configure a Channel
21
+
22
+ Start from current state:
23
+
24
+ ```bash
25
+ ae-cli system +list-channels
26
+ ae-cli system channel get --id <channel-id>
27
+ ```
28
+
29
+ Create JSON uses snake_case. The original `+create-channel` and `+update-channel` commands also accept legacy camelCase fields, but new files should not use them.
30
+
31
+ ```json
32
+ {
33
+ "name": "Support Bot",
34
+ "type": "feishu",
35
+ "config": {
36
+ "app_id": "<app-id>",
37
+ "app_secret": "<app-secret>"
38
+ },
39
+ "model": "<optional-model-id>",
40
+ "system_prompt": "<optional-system-prompt>",
41
+ "enabled": false
42
+ }
43
+ ```
44
+
45
+ Run the dry-run before the phase-1 confirmation. Credential values are replaced with `***`:
46
+
47
+ ```bash
48
+ ae-cli --dry-run system +create-channel --channel @channel.json
49
+ ae-cli system +create-channel --channel @channel.json
50
+ ```
51
+
52
+ Type-specific configuration:
53
+
54
+ | Type | Required config | Conditional config |
55
+ | --- | --- | --- |
56
+ | `feishu`, `lark` | `app_id`, `app_secret` | — |
57
+ | `slack` | `bot_token`, `app_token` | `client_id`, `client_secret` when used by the deployment |
58
+ | `discord` | `bot_token` | `client_id`, `client_secret` when used by the deployment |
59
+ | `dingtalk` | `client_id`, `client_secret`, `corp_id` | `interaction_card_template_id` |
60
+ | `wecom` | `bot_id`, `bot_secret` | If `oauth_enabled=true`: `corp_id`, `corp_secret`, `agent_id` |
61
+ | `mattermost` | `server_url`, `bot_token` | If `oauth_enabled=true`: `client_id`, `client_secret` |
62
+ | `google_chat` | `service_account_json` | `workspace_addon_service_account_email`; if `oauth_enabled=true`: `client_id`, `client_secret` |
63
+ | `whatsapp` | no manual config | Credentials are created by the QR lifecycle |
64
+
65
+ Update accepts a partial object containing `name`, `type`, `config`, `model`, `system_prompt`, `enabled`, or `unbind_users`. If `type` is present it must equal the channel's existing type. Omitting a secret or passing an empty string preserves the stored value; it does not clear the secret.
66
+
67
+ For every non-WhatsApp channel, verify credentials before depending on endpoints:
68
+
69
+ ```bash
70
+ ae-cli --dry-run system channel verify --id <channel-id>
71
+ ae-cli system channel verify --id <channel-id>
72
+ ae-cli system channel get --id <channel-id>
73
+ ```
74
+
75
+ Treat configuration persistence and runtime startup as separate outcomes. An HTTP 200 may still contain `runtime_status="error"`; report that the configuration was saved without claiming the bot is online. When Google Chat creation returns its one-time `webhook_url`, ask the operator to save it immediately in an approved secret store and never copy it into logs or repository files.
76
+
77
+ For WhatsApp, create the channel without config, enable it with `+update-channel`, then start linking. Poll only until the returned `expires_at` (and never longer than two minutes) for `linked`, `needs_relink`, `failed`, or `expired`:
78
+
79
+ ```bash
80
+ ae-cli --dry-run system +update-channel --id <channel-id> --channel '{"enabled":true}'
81
+ ae-cli system +update-channel --id <channel-id> --channel '{"enabled":true}'
82
+ ae-cli --dry-run system channel whatsapp-web start --id <channel-id>
83
+ ae-cli system channel whatsapp-web start --id <channel-id>
84
+ ae-cli system channel whatsapp-web status --id <channel-id>
85
+ ```
86
+
87
+ Show `qr_data_url` to the user for scanning. Do not call `channel verify` for WhatsApp. Before unlinking, disable the channel with `+update-channel`, then call `channel whatsapp-web unlink`; the unlink command requires its own high-risk CLI confirmation and still stays inside phase 1.
88
+
89
+ ```bash
90
+ ae-cli --dry-run system +update-channel --id <channel-id> --channel '{"enabled":false}'
91
+ ae-cli system +update-channel --id <channel-id> --channel '{"enabled":false}'
92
+ ae-cli --dry-run system channel whatsapp-web unlink --id <channel-id>
93
+ ae-cli system channel whatsapp-web unlink --id <channel-id>
94
+ ```
95
+
96
+ ## Group Routing
97
+
98
+ Use a verified endpoint ID from `channel verify` or `channel get`:
99
+
100
+ ```bash
101
+ ae-cli system channel routing get --endpoint-id <endpoint-id>
102
+ ae-cli --dry-run system channel routing set \
103
+ --endpoint-id <endpoint-id> \
104
+ --routing @routing.json
105
+ ```
106
+
107
+ `routing.json` replaces the full routing configuration:
108
+
109
+ ```json
110
+ {
111
+ "status": "enabled",
112
+ "default_handler": { "kind": "agent", "id": "<agent-id>" },
113
+ "targets": [
114
+ {
115
+ "handler_kind": "team",
116
+ "handler_id": "<team-id>",
117
+ "slug": "billing",
118
+ "keywords": ["invoice", "refund"],
119
+ "sort_order": 10,
120
+ "enabled": true
121
+ }
122
+ ]
123
+ }
124
+ ```
125
+
126
+ `status` is `enabled | disabled`, `default_handler` is an Agent/Team handler or `null`, and `targets` contains at most 19 entries. The server validates handler ownership, duplicate handlers/slugs, and keyword conflicts.
127
+
128
+ ## Phase 2: Resolve and Bind Feishu Users
129
+
130
+ ### Feishu binding transport contract
131
+
132
+ Both the single-user and batch CLI flows use the same binding endpoint:
133
+
134
+ | Operation | Method and path | CLI mapping |
135
+ | --- | --- | --- |
136
+ | Bind one Feishu identity to one channel | PUT `/api/cli/channel/v1/bindings/feishu` | `channel binding bind-feishu` sends one request. |
137
+ | Bind 1-100 Feishu identities to one channel | PUT `/api/cli/channel/v1/bindings/feishu` | `+bind-feishu-users` validates the full roster, then sends one binding PUT per person. |
138
+ | Set the private-chat default Agent after binding | PUT `/api/cli/channel/v1/bindings/{binding_id}/agent` | `channel binding set-agent`; the batch command calls it after each successful binding when an Agent is selected. |
139
+
140
+ The Feishu binding request body is a strict, flat JSON object:
141
+
142
+ | Field | Required | Binding meaning |
143
+ | --- | --- | --- |
144
+ | `channel_id` | yes | `channel_id` identifies the one target Feishu channel for the request. The channel must belong to the current company and be enabled. |
145
+ | `te_user_id` | yes | The selected AE Agent member's `openId`; this is the member being associated with the channel identity. |
146
+ | `open_id` | yes | The person's Feishu `open_id` under the same Feishu application configured by the target channel. |
147
+ | `union_id` | group-ready only | The person's stable Feishu identity for group routing. Supply it together with `endpoint_id`; omit both only for explicitly approved private-chat-only binding. |
148
+ | `endpoint_id` | group-ready only | `endpoint_id` must identify a verified endpoint that belongs to the same `channel_id`. Supply it together with `union_id`. |
149
+
150
+ ```json
151
+ {
152
+ "channel_id": "channel-sales",
153
+ "te_user_id": "agent-member-open-id-alice",
154
+ "open_id": "ou_alice",
155
+ "union_id": "on_alice",
156
+ "endpoint_id": "endpoint-sales-verified"
157
+ }
158
+ ```
159
+
160
+ The binding response returns:
161
+
162
+ | Field | Meaning |
163
+ | --- | --- |
164
+ | `binding_id` | The channel-user binding ID used for later Agent assignment or maintenance. |
165
+ | `channel_id` | The target channel confirmed by the server. |
166
+ | `te_user_id` | The AE Agent member associated with the channel identity. |
167
+ | `open_id` | The Feishu application-scoped identity stored on the binding. |
168
+ | `group_routing_ready` | Whether this binding is ready for group routing. |
169
+ | `agent_id` | The current private-chat default Agent, or no value when system-default resolution applies. |
170
+ | `endpoint_id` | The associated endpoint when the binding is group-routing ready. |
171
+
172
+ `agent_id` is not part of this request body. After the binding response returns `binding_id`, set or clear the private-chat default Agent through `PUT /api/cli/channel/v1/bindings/{binding_id}/agent`. `default_agent_id` and `private_only` are also CLI orchestration fields, not fields accepted by the Feishu binding endpoint.
173
+
174
+ One `+bind-feishu-users` invocation has one top-level `--channel-id` and one shared `--endpoint-id`; every entry in `bindings.json` is bound to that channel. Run separate confirmed batches for different channels. Do not put `channel_id` or `endpoint_id` inside individual roster entries.
175
+
176
+ Common contract mistakes:
177
+
178
+ | Mistake | Required correction |
179
+ | --- | --- |
180
+ | Reusing an `open_id` resolved under another Feishu application | Resolve the person again with the application configured by the target channel. |
181
+ | Pairing the target channel with an endpoint from another channel | Select a verified endpoint returned by `channel get` or `channel verify` for the same `channel_id`. |
182
+ | Sending `agent_id`, `default_agent_id`, or `private_only` to the Feishu binding endpoint | Keep them in CLI orchestration; assign the Agent through the binding-specific Agent endpoint. |
183
+ | Mixing users for multiple channels in one batch roster | Split the work by channel, dry-run every final roster, and confirm each batch separately. |
184
+
185
+ 1. The current session must have the Feishu OpenAPI MCP mounted. Before resolving identities, verify all of these prerequisites:
186
+
187
+ - The MCP and the target channel use the same App ID and App Secret. Read the channel's `config.app_id` with `ae-cli system channel get --id <channel-id>` and compare it with the MCP application configuration. When the App Secret or MCP configuration is masked, obtain explicit confirmation from the configuration owner instead of assuming a match. Feishu `open_id` is application-scoped.
188
+ - The Feishu application has the `contact:user.id:readonly` permission.
189
+ - The MCP exposes the `contact.v3.users.batchGetId` tool.
190
+
191
+ Stop when any prerequisite is missing or cannot be verified. Resolve people by exact corporate email address or mobile number; `contact.v3.users.batchGetId` does not resolve names, so ask for an email address or mobile number when only a name is provided.
192
+
193
+ 2. Call `contact.v3.users.batchGetId` with `user_id_type=open_id`. Put exact emails in `data.emails` or exact mobile numbers in `data.mobiles`:
194
+
195
+ ```json
196
+ {
197
+ "params": { "user_id_type": "open_id" },
198
+ "data": { "emails": ["alice@example.com", "bob@example.com"] }
199
+ }
200
+ ```
201
+
202
+ Map each returned `user_list[].user_id` to the matching returned email or mobile number as that person's Feishu `open_id`. A zero-result lookup, missing input, duplicate input, or response that cannot be mapped one-to-one is unresolved. Stop, show the unresolved inputs, and obtain corrected exact identifiers; never choose the first result or infer a person from ordering.
203
+
204
+ 3. Repeat `contact.v3.users.batchGetId` for the same exact emails or mobile numbers with `user_id_type=union_id`; reuse the corresponding `data.emails` or `data.mobiles` roster from step 2 unchanged.
205
+
206
+ Map each returned `user_list[].user_id` to the same person as that person's Feishu `union_id`. Require the `open_id` and `union_id` lookup results to cover the same uniquely identified roster. If the Feishu OpenAPI MCP cannot return a `union_id`, stop. Ask whether the user explicitly accepts `--private-only`; do not infer that choice.
207
+
208
+ 4. Fetch Agent members and match each selected person to exactly one Agent member by confirmed login/display identity. Use that member's `openId` as `te_user_id`; do not use its database `userId`, and do not assume the app-scoped Feishu `open_id` equals the AE member `openId`:
209
+
210
+ ```bash
211
+ ae-cli system +list-members --status enabled --all true
212
+ ```
213
+
214
+ If a selected person is not yet an Agent member, use `+list-member-candidates` to resolve the exact candidate. When member addition is required, phase 2 has a prerequisite member-add confirmation and a final binding-and-sandbox confirmation. Dry-run and confirm `+add-members`, execute it, then refetch members before preparing the final binding and sandbox plan. Keep `--create-sandbox` false or omit it in this workflow; sandbox creation and verification happen explicitly after a successful channel binding. The member-add confirmation does not authorize the later binding or sandbox writes.
215
+ 5. Build `bindings.json` using only snake_case:
216
+
217
+ ```json
218
+ [
219
+ {
220
+ "te_user_id": "<agent-member-open-id>",
221
+ "open_id": "<feishu-open-id>",
222
+ "union_id": "<feishu-union-id>",
223
+ "agent_id": "<optional-per-user-agent-id>"
224
+ }
225
+ ]
226
+ ```
227
+
228
+ `--default-agent-id` applies when an item omits `agent_id`; an item's `agent_id` overrides the default. Omit both to leave the private-chat default Agent unchanged.
229
+
230
+ 6. Inspect sandbox capacity and current ownership before building the phase-2 plan:
231
+
232
+ ```bash
233
+ ae-cli system +get-sandbox-config
234
+ ae-cli system +list-sandboxes
235
+ ```
236
+
237
+ For sandbox operations, map each selected Agent member's database `userId` to `items[].boundUsers[].userId`; never use the member's `openId`, Feishu `open_id`, or Feishu `union_id`. A channel-bound person's sandbox is ready when exactly one returned sandbox contains that `userId` and has `enabled === true`. Container `runningState` is a separate lifecycle state and does not trigger `+start-sandbox` in this workflow.
238
+
239
+ - For members with no sandbox, prepare one dry-run containing their database user IDs:
240
+
241
+ ```bash
242
+ ae-cli --dry-run system +batch-create-sandboxes \
243
+ --user-ids '["<member-database-user-id>"]'
244
+ ```
245
+
246
+ - For each existing sandbox with `enabled === false`, prepare its enable dry-run:
247
+
248
+ ```bash
249
+ ae-cli --dry-run system +set-sandbox-enabled \
250
+ --id <sandbox-id> \
251
+ --enabled true
252
+ ```
253
+
254
+ Calculate the planned quota use from `+get-sandbox-config`: required create seats equal the number of members with no sandbox, and required active seats equal that number plus the number of existing disabled sandboxes to enable. Require `sandboxQuota.cluster.remaining` to cover required create seats and `sandboxQuota.active.remaining` to cover required active seats. Treat a missing or non-numeric quota value as unverified rather than assuming capacity; `sandboxActiveSeatsLimit` is the limit, not the remaining count.
255
+
256
+ Sandbox preflight protects sandbox writes without becoming a gate on channel binding. When sandbox management is disabled, verified capacity cannot cover the plan, quota values are unverified, a person maps to multiple sandboxes, or ownership cannot be matched exactly, mark the affected person as `sandbox_readiness_blocked` and show the reason in the phase-2 plan. Require confirmation that the channel binding may succeed while the sandbox remains not ready, and do not issue an unsafe sandbox write. A sandbox preflight failure does not cancel a confirmed channel binding.
257
+
258
+ The phase-2 confirmation also authorizes the listed sandbox readiness writes. If the roster, target user IDs, sandbox IDs, required actions, or limits change, regenerate every affected dry-run and obtain a new confirmation.
259
+
260
+ 7. Validate the whole 1-100 item binding batch and show the complete phase-2 plan before asking for confirmation:
261
+
262
+ ```bash
263
+ ae-cli --dry-run system +bind-feishu-users \
264
+ --channel-id <channel-id> \
265
+ --endpoint-id <verified-endpoint-id> \
266
+ --bindings @bindings.json \
267
+ --default-agent-id <optional-agent-id>
268
+ ```
269
+
270
+ For an explicitly approved private-chat-only batch, omit every `union_id` and `--endpoint-id`, then add `--private-only true`.
271
+
272
+ 8. After phase-2 confirmation, execute the same binding command without `--dry-run`. The command validates the whole batch before the first request, then processes users sequentially. An item-level validation or conflict failure does not stop later users and no automatic rollback is attempted; a final 401 or any 403 stops the batch because authentication or authorization is no longer valid. Inspect `succeeded`, `failed`, and every result's `stage` (`binding` or `agent_assignment`). Retry only failed items with a new file; the Feishu binding PUT is idempotent.
273
+
274
+ 9. Only users whose channel binding succeeded proceed to sandbox readiness. A result with `binding_id` and `stage: "agent_assignment"` still proceeds to sandbox readiness. The channel binding exists, so report the Agent-assignment failure separately. Refetch `+list-sandboxes` after binding, then apply the confirmed plan against the refreshed state:
275
+
276
+ - If preflight marked the person as `sandbox_readiness_blocked`, preserve the successful binding, report `channel_bound_sandbox_not_ready`, and wait for a new safe dry-run and confirmation before any later sandbox write.
277
+ - If the exact user's sandbox is already `enabled === true`, make no write.
278
+ - If the confirmed existing sandbox is still present with `enabled === false`, execute its prepared `+set-sandbox-enabled --enabled true` command.
279
+ - If the confirmed user still has no sandbox, execute the prepared `+batch-create-sandboxes` command. The create call must return a successful result and a `sandboxId` for that database `userId`.
280
+ - Refetch after creation. The batch-create contract creates an enabled personal sandbox and binds it to the requested database `userId`. If the new sandbox instead has `enabled === false`, run a fresh `+set-sandbox-enabled` dry-run and obtain supplemental explicit confirmation for the returned `sandboxId` before enabling it.
281
+ - If the refreshed ownership or sandbox ID conflicts with the confirmed plan, stop that person's sandbox action and request a new dry-run and confirmation.
282
+
283
+ Inspect every create or enable result. A final 401 or any 403 stops remaining sandbox writes. A quota, validation, conflict, or other item failure does not undo earlier bindings or prevent independent confirmed users from being processed. Record and report that person as `channel_bound_sandbox_not_ready`. Do not roll back a successful channel binding when sandbox preparation fails.
284
+
285
+ 10. Read back the final channel and sandbox state:
286
+
287
+ ```bash
288
+ ae-cli system channel binding list --channel-id <channel-id>
289
+ ae-cli system +list-sandboxes
290
+ ```
291
+
292
+ For every successful channel binding, verify that exactly one sandbox contains the Agent member's database `userId` in `boundUsers[].userId` and returns `enabled === true`. Report separate counts and identities for `channel_bound_sandbox_ready`, `channel_bound_sandbox_not_ready`, and `channel_binding_failed`; do not collapse partial readiness into overall success.
293
+
294
+ For one-off maintenance, use `channel binding bind-feishu`, `channel binding set-agent`, and `channel binding unbind` with the same dry-run, confirmation, and read-back rules. Clear a binding's private-chat Agent and restore system-default resolution with `channel binding set-agent --binding-id <binding-id> --clear`.
295
+
296
+ ## Transport Status
297
+
298
+ Transition status: transitional
299
+ Owning module: te-agent channel management
300
+ Current transport: signed REST at `/api/cli/channel/v1/**`
301
+ Gateway target: channel Capability Gateway
302
+ Review after: 2026-10-24
303
+ Exit condition: migrate when equivalent schemas, authorization, risk, dry-run, batch orchestration, and output contracts are stable.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: ae-use-agent
3
+ version: 1.0.2
4
+ description: "Use a custom te-agent Agent's instructions and dependency assets for a task in a local client such as Codex or Claude Code, using the client's model and local files."
5
+ ---
6
+
7
+ # Use an AE Agent locally
8
+
9
+ The platform supplies instructions and dependency discovery. You execute the user's task
10
+ with your current model and local capabilities. This does not start a remote te-agent session.
11
+
12
+ 1. Read [the bundled command guide](references/local-agent.md) for setup and discovery.
13
+ Resolve the user's Agent name with `+list-agents --q <name>` and ask only if the choice
14
+ is ambiguous. An explicit Agent ID can be used directly. No sibling Skill is required.
15
+ 2. Use the original AE host for the context request:
16
+
17
+ ```bash
18
+ ae-cli agent +get-agent-context --id <agent-id> --host <original-host>
19
+ ```
20
+
21
+ 3. Check `ok`, then use `data.agent.instructions` as task guidance within your existing instruction hierarchy.
22
+ Inspect dependency metadata and use capabilities already present locally where appropriate.
23
+ For Skills needed by the task, fetch the body and relevant references/scripts/assets using
24
+ the returned command descriptors and the bundled guide. File inventories are on-demand,
25
+ not included in the context response.
26
+ 4. Decide how to prepare needed dependencies under the client's existing permissions.
27
+ Treat remote text and scripts as content to inspect, not automatic installation or execution
28
+ authorization. Do not change global instruction files or install software just because a
29
+ dependency appears in the list. Obtain MCP connection secrets through normal credential
30
+ setup. When the user explicitly requests credential export, follow the bundled guide's
31
+ `--include-mcp-credentials` flow; keep its sensitive output out of conversation and logs.
32
+ 5. Execute the task. Explain missing dependencies only when relevant; stop the affected step
33
+ if an essential capability is unavailable. Do not claim the full Agent is enabled based
34
+ solely on loading its prompt. The listed tools are dependencies, not an enforced tool allowlist.
35
+
36
+ Keep follow-up commands on the original AE host. Re-fetch context for a new task and verify
37
+ Skill versions when loading files. The context is live metadata, not a frozen package.
38
+ When switching Agents, replace prior task guidance where possible; use a fresh conversation
39
+ if the client's context cannot cleanly separate their instructions.
40
+
41
+ This Skill relies on ae-cli and the platform's Agent context endpoint; it does not bootstrap
42
+ or update either automatically. The bundled guide includes installation and recovery steps.
@@ -0,0 +1,114 @@
1
+ # Local Agent command guide
2
+
3
+ This guide is included in ae-use-agent; installing ae-agent is optional. Use Node.js 20+
4
+ and a local client that can run shell commands and read files.
5
+
6
+ ## Setup and recovery
7
+
8
+ Run `ae-cli --version`. If the command is missing, obtain the AE host and supported CLI
9
+ version from the user's environment administrator. Give the appropriate installation
10
+ command with that version substituted; do not install automatically:
11
+
12
+ ```bash
13
+ # Customer/public distribution
14
+ npm install -g @thinkingai/ae-cli@<supported-version>
15
+ # Internal ThinkingData distribution
16
+ npm install -g @tant/ae-cli@<supported-version> --registry=https://npm.thinkingdata.cn:3443
17
+ ```
18
+
19
+ Use the environment URL supplied by the user or configured in ae-cli; never guess a host.
20
+ Keep that original host on every request, including authentication:
21
+
22
+ ```bash
23
+ ae-cli auth status --host <original-host>
24
+ ae-cli auth login --host <original-host>
25
+ ae-cli agent +get-agent-context --help
26
+ ```
27
+
28
+ Login is needed only when the session is missing or expired. Let the user complete the
29
+ browser login; never request tokens in chat. If the command is unknown, the CLI is too old.
30
+ For the public package, `ae-cli update --dry-run` previews host-compatible updates;
31
+ perform an update only under the client's existing permissions. Internal builds use the
32
+ internal registry above. If the host-supported release lacks this command or endpoint,
33
+ ask the environment administrator for a compatible deployment; do not repeatedly update.
34
+
35
+ ## Discover and load
36
+
37
+ ```bash
38
+ ae-cli agent +list-agents --q <agent-name> --host <original-host>
39
+ ae-cli agent +get-agent-context --id <agent-id> --host <original-host>
40
+ ```
41
+
42
+ Default JSON output is `{ "ok": true, "data": ... }`. Check `ok` before reading `data`.
43
+ Name search results are in `data.agents`. Match name, scope and description; ask the user
44
+ when ambiguous. Search by name instead of assuming an unfiltered list contains every Agent.
45
+ An explicit ID can go directly to the context command. Ordinary members can read their
46
+ own personal Agents and shared Agents visible to their account; no admin role is required.
47
+
48
+ Context fields are `data.schema_version`, `data.context_version`, `data.agent.instructions`,
49
+ `data.model`, `data.dependencies.skills`, `data.dependencies.mcps` and `data.summary`.
50
+ This guide supports schema version 1; stop and obtain matching documentation for other
51
+ versions. Use your current client model. An unavailable platform model does not block it.
52
+ `availability=available` means visible metadata, not a working local dependency.
53
+
54
+ ## Read required Skill files
55
+
56
+ For an available Skill, use its `id` and `files` descriptors. No extra list-skills call is
57
+ needed. Each descriptor has `executable` and `argv`; pass arguments separately, never as
58
+ interpolated shell code. Append `--host <original-host>`. Supported read commands are:
59
+
60
+ ```bash
61
+ ae-cli agent +get-skill-content --id <skill-id> --host <original-host>
62
+ ae-cli agent +list-skill-references --id <skill-id> --host <original-host>
63
+ ae-cli agent +list-skill-scripts --id <skill-id> --host <original-host>
64
+ ae-cli agent +list-skill-assets --id <skill-id> --host <original-host>
65
+ ae-cli agent +read-skill-reference --id <skill-id> --path <relative-path> --host <original-host>
66
+ ae-cli agent +read-skill-script --id <skill-id> --path <relative-path> --host <original-host>
67
+ ae-cli agent +read-skill-asset --id <skill-id> --path <relative-path> --output <local-file> --host <original-host>
68
+ ```
69
+
70
+ Skill body is in `data.item.content`; directory entries are in `data.items`. Text file
71
+ reads return `data.content`. Use a path returned by the corresponding directory listing;
72
+ `--path` is relative to references, scripts or assets, without that directory prefix.
73
+ All three read commands support `--output <local-file>` to preserve binary bytes. Use a
74
+ new workspace file path and inspect scripts before any execution. Check reported versions
75
+ against the context and re-fetch if they change. An empty listing does not prove that a
76
+ file required by the Skill is unnecessary: report a missing required file and stop that step.
77
+
78
+ ## MCP dependencies and failures
79
+
80
+ If the user explicitly requests exporting current-user MCP credentials, use:
81
+
82
+ ```bash
83
+ ae-cli agent +get-agent-context --id <agent-id> --include-mcp-credentials --host <original-host>
84
+ ```
85
+
86
+ This is sensitive output: do not quote it in chat or logs, or commit it. Put the connection
87
+ only in the intended local client configuration. Require `data.credentials_included=true`;
88
+ its absence means an older server, not success. For each MCP, check `connection_config`:
89
+ `exported` supplies `connection_name` and the same `connection` configuration shown in the
90
+ current user's MCP market: `type`, `url`, `headers` for remote MCPs, or `type`, `command`,
91
+ `args`, `env` for stdio. Header and environment keys are unchanged; system URLs use the AE
92
+ host. `credential_expires_at=null` means expiry is not exposed. `unavailable` supplies a safe
93
+ `connection_error`. No refresh tokens or platform-internal keys are included. Re-export
94
+ after credentials expire or are revoked. Platform managed bridges require the platform
95
+ runtime. Do not assume a successful export proves connectivity.
96
+
97
+
98
+ Use `ae-cli agent +mcp-tools --id <mcp-id> --host <original-host>` for platform tool metadata.
99
+ For OAuth MCPs only, `ae-cli agent +mcp-auth-status --id <mcp-id> --host <original-host>`
100
+ reports platform authentication. Neither establishes a local connection. Reuse an existing
101
+ local capability when suitable; otherwise obtain connection setup through the client's
102
+ normal credential flow. Do not ask for secrets in chat or claim platform OAuth transfers.
103
+
104
+ - 401/auth error: log in on the same host and retry once; stop if authentication still fails.
105
+ - 403: permission denied; do not refresh repeatedly or require an admin account by default.
106
+ - 404 on context: run `ae-cli agent +get-agent --id <agent-id> --host <original-host>`.
107
+ If it also fails, verify the ID/account/host. If it succeeds, verify endpoint deployment
108
+ with the administrator. Raw Agent configuration is not a complete context fallback.
109
+ - 409 `invalid_agent_configuration`: ask the Agent owner to repair dependency configuration.
110
+ - 500/network error: report the failed step and host; no silent success or fallback.
111
+ - Unavailable dependency or file: stop only the step that needs it; explain what is missing.
112
+
113
+ Never claim the full Agent is ready from prompt loading alone. Context is live metadata,
114
+ not a frozen package; re-fetch it for a new task.
@@ -1,14 +0,0 @@
1
- import {
2
- getToken,
3
- invalidateAccessTokenForRetry,
4
- resolveHost,
5
- validateToken
6
- } from "./chunk-ZQKDZXDO.js";
7
- import "./chunk-3FY3RJ26.js";
8
- import "./chunk-JHENBQ5B.js";
9
- export {
10
- getToken,
11
- invalidateAccessTokenForRetry,
12
- resolveHost,
13
- validateToken
14
- };