@thinkingai/ae-cli 6.1.24 → 6.1.26

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 (195) hide show
  1. package/README.md +35 -10
  2. package/README.zh.md +32 -10
  3. package/bin/ae-cli.js +6 -1
  4. package/cli-installation-guide.md +91 -0
  5. package/dist/{auth-XZNXFRJS.js → auth-YHMC3GDH.js} +168 -10
  6. package/dist/automation-NWWVLWG2.js +459 -0
  7. package/dist/{capability-FYTU3X6L.js → capability-3QLLIVFB.js} +11 -6
  8. package/dist/chunk-4655PUNX.js +43 -0
  9. package/dist/{chunk-4NRCTUZJ.js → chunk-5XJYLEVC.js} +4 -4
  10. package/dist/{chunk-JOCDD4ON.js → chunk-7QXISROD.js} +1 -1
  11. package/dist/{chunk-EQ255HKO.js → chunk-AP7YP2NX.js} +2 -2
  12. package/dist/{chunk-DVMLWQD4.js → chunk-CT7QDJS6.js} +2 -2
  13. package/dist/chunk-D6ACFILC.js +56 -0
  14. package/dist/{chunk-HFGZGYCG.js → chunk-EOYSKMXN.js} +264 -10
  15. package/dist/{chunk-57RRFUEZ.js → chunk-FMNNGNYO.js} +43 -8
  16. package/dist/{chunk-7XGFSUOM.js → chunk-GIK6EDUG.js} +291 -84
  17. package/dist/chunk-HVHR4SCP.js +133 -0
  18. package/dist/{chunk-CCS66K4K.js → chunk-KAEHZZH4.js} +3 -3
  19. package/dist/{chunk-DX5CDO34.js → chunk-KFNMQTZI.js} +580 -214
  20. package/dist/{chunk-HBGADCKA.js → chunk-PLE722AJ.js} +28 -11
  21. package/dist/chunk-RK6GLDGI.js +27 -0
  22. package/dist/{chunk-V2NUHPXF.js → chunk-S6M42KND.js} +1 -1
  23. package/dist/{chunk-7FTTULED.js → chunk-UQ77JXYH.js} +7 -3
  24. package/dist/{chunk-MAPZ7VB6.js → chunk-WNGFSIOB.js} +20 -1
  25. package/dist/{chunk-VYXXOKYS.js → chunk-XCHAYMSF.js} +7 -4
  26. package/dist/{community-report-client-CU22W53K.js → community-report-client-PEERQCX2.js} +1 -1
  27. package/dist/{config-XO3LI3SA.js → config-AHPMEW5A.js} +25 -6
  28. package/dist/context-YAE3QXP3.js +136 -0
  29. package/dist/{data-integration-HNGUKFIC.js → data-integration-HESZET7E.js} +6 -6
  30. package/dist/index.js +167 -53
  31. package/dist/{local-data-upload-client-GTRIT64F.js → local-data-upload-client-TWMHFLUA.js} +1 -1
  32. package/dist/memory-62BJOULV.js +580 -0
  33. package/dist/{metadata-DI5BMYFU.js → metadata-C7CEDHOJ.js} +7 -7
  34. package/dist/{model-RNPQXIBI.js → model-SBV2JFJI.js} +9 -5
  35. package/dist/{personal-semantic-preference-5C3WUXFI.js → personal-semantic-preference-QECDPHND.js} +119 -11
  36. package/dist/project-semantic-Z4QAMBWF.js +356 -0
  37. package/dist/{sync-O45NXEQY.js → sync-SU33KYX7.js} +12 -8
  38. package/dist/{te-agent-K5MSPNHJ.js → te-agent-F5QBZSQA.js} +423 -494
  39. package/dist/{te-analysis-AISWCOOZ.js → te-analysis-2ECAAIFK.js} +1227 -154
  40. package/dist/{te-community-4OYU3BDA.js → te-community-PFLDLPP4.js} +3 -3
  41. package/dist/{te-dataops-NFIPB6FX.js → te-dataops-FOQSRIAZ.js} +644 -276
  42. package/dist/{te-engage-BAM3GBFX.js → te-engage-QKUGIWSR.js} +6 -6
  43. package/dist/{te-experiment-GUTZXZ5Z.js → te-experiment-26PXR2UO.js} +6 -6
  44. package/dist/{te-kb-3TS73NO6.js → te-kb-MHDOST62.js} +666 -244
  45. package/dist/{te-system-STMHLS5J.js → te-system-J2FQF5ER.js} +6 -6
  46. package/dist/{te-team-3I5AOX3N.js → te-team-5UOZPTU3.js} +6 -6
  47. package/dist/things-VPPXXLHB.js +1091 -0
  48. package/dist/{update-RZXLPCRH.js → update-EEUTEI6R.js} +59 -51
  49. package/dist/workspace-O3EEIYQM.js +554 -0
  50. package/package.json +30 -11
  51. package/skills/ae-agent/SKILL.md +95 -140
  52. package/skills/ae-agent/references/add-model.md +1 -1
  53. package/skills/ae-agent/references/create-agent.md +1 -1
  54. package/skills/ae-agent/references/find-archived-conversations.md +12 -5
  55. package/skills/ae-agent/references/get-agent.md +1 -1
  56. package/skills/ae-agent/references/list-agents.md +2 -2
  57. package/skills/ae-agent/references/list-models.md +2 -2
  58. package/skills/ae-agent/references/notification.md +40 -0
  59. package/skills/ae-agent/references/restore-conversation.md +3 -1
  60. package/skills/ae-analysis/SKILL.md +55 -23
  61. package/skills/ae-analysis/references/adhoc_export.md +1 -1
  62. package/skills/ae-analysis/references/adhoc_run.md +1 -1
  63. package/skills/ae-analysis/references/agent_review_submit_to_page.md +2 -0
  64. package/skills/ae-analysis/references/ai_models/event.md +6 -1
  65. package/skills/ae-analysis/references/ai_models/funnel.md +12 -4
  66. package/skills/ae-analysis/references/ai_models/heat_map.md +23 -0
  67. package/skills/ae-analysis/references/ai_models/interval.md +24 -0
  68. package/skills/ae-analysis/references/ai_models/path.md +20 -0
  69. package/skills/ae-analysis/references/ai_models/prop_analysis.md +2 -0
  70. package/skills/ae-analysis/references/ai_models/rank_list.md +30 -0
  71. package/skills/ae-analysis/references/ai_models/retention.md +45 -1
  72. package/skills/ae-analysis/references/ai_models/revenue.md +20 -2
  73. package/skills/ae-analysis/references/ai_models/session.md +76 -0
  74. package/skills/ae-analysis/references/ai_models/tag.md +2 -0
  75. package/skills/ae-analysis/references/ai_models.md +100 -3
  76. package/skills/ae-analysis/references/analysis_data_retrieval.md +4 -0
  77. package/skills/ae-analysis/references/analysis_drilldown_contract.md +4 -1
  78. package/skills/ae-analysis/references/asset_batch_info_export.md +10 -0
  79. package/skills/ae-analysis/references/asset_batch_sql_export.md +13 -1
  80. package/skills/ae-analysis/references/asset_export.md +12 -1
  81. package/skills/ae-analysis/references/asset_list.md +1 -0
  82. package/skills/ae-analysis/references/asset_search.md +11 -5
  83. package/skills/ae-analysis/references/bi_panel_list.md +1 -1
  84. package/skills/ae-analysis/references/catalog_list.md +1 -1
  85. package/skills/ae-analysis/references/collaboration.md +48 -0
  86. package/skills/ae-analysis/references/command_index.md +29 -19
  87. package/skills/ae-analysis/references/dashboard_list.md +4 -4
  88. package/skills/ae-analysis/references/dashboard_move.md +21 -0
  89. package/skills/ae-analysis/references/dashboard_report_add.md +2 -0
  90. package/skills/ae-analysis/references/dashboard_report_data_export.md +2 -0
  91. package/skills/ae-analysis/references/dashboard_report_get.md +19 -0
  92. package/skills/ae-analysis/references/dashboard_report_update.md +27 -0
  93. package/skills/ae-analysis/references/dashboard_update.md +1 -1
  94. package/skills/ae-analysis/references/drilldown_session_details_run.md +41 -0
  95. package/skills/ae-analysis/references/event_export.md +3 -1
  96. package/skills/ae-analysis/references/event_report_presentation.md +76 -0
  97. package/skills/ae-analysis/references/feedback_submit.md +37 -0
  98. package/skills/ae-analysis/references/governance_recommendation_auto_review.md +77 -0
  99. package/skills/ae-analysis/references/governance_recommendation_export.md +11 -0
  100. package/skills/ae-analysis/references/metadata_resolution.md +18 -3
  101. package/skills/ae-analysis/references/metric_export.md +3 -1
  102. package/skills/ae-analysis/references/metric_list.md +1 -1
  103. package/skills/ae-analysis/references/operation_record_export.md +10 -0
  104. package/skills/ae-analysis/references/personal_semantic_preference_add.md +2 -2
  105. package/skills/ae-analysis/references/personal_semantic_preference_get.md +4 -4
  106. package/skills/ae-analysis/references/personal_semantic_preference_list.md +4 -4
  107. package/skills/ae-analysis/references/personal_semantic_preference_review.md +9 -0
  108. package/skills/ae-analysis/references/personal_semantic_preference_review_list.md +7 -0
  109. package/skills/ae-analysis/references/personal_semantic_preference_submit.md +7 -0
  110. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +91 -32
  111. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +99 -1
  112. package/skills/ae-analysis/references/property_export.md +3 -1
  113. package/skills/ae-analysis/references/report_create.md +18 -4
  114. package/skills/ae-analysis/references/report_data_export.md +6 -0
  115. package/skills/ae-analysis/references/report_get.md +7 -1
  116. package/skills/ae-analysis/references/report_list.md +5 -5
  117. package/skills/ae-analysis/references/report_update.md +21 -4
  118. package/skills/ae-analysis/references/sql_table_columns.md +4 -4
  119. package/skills/ae-analysis/references/sql_table_list.md +5 -5
  120. package/skills/ae-analysis/references/system_query_monitor_overview.md +2 -0
  121. package/skills/ae-analysis/references/system_query_task_cancel.md +2 -0
  122. package/skills/ae-analysis/references/system_query_task_export.md +6 -2
  123. package/skills/ae-analysis/references/system_query_task_get.md +2 -0
  124. package/skills/ae-analysis/references/system_query_task_list.md +7 -3
  125. package/skills/ae-analysis/references/system_query_task_options.md +2 -2
  126. package/skills/ae-analysis/references/system_query_task_realtime_list.md +15 -0
  127. package/skills/ae-analysis/references/user_cluster_models.md +8 -0
  128. package/skills/ae-analysis/references/user_tag_create.md +7 -1
  129. package/skills/ae-analysis/references/user_tag_get.md +1 -1
  130. package/skills/ae-analysis/references/user_tag_models.md +20 -2
  131. package/skills/ae-analysis/references/user_tag_refresh.md +1 -1
  132. package/skills/ae-analysis/references/user_tag_update.md +2 -2
  133. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-empty-skeleton.mjs +105 -0
  134. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +669 -29
  135. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +21 -8
  136. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +28 -10
  137. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +66 -0
  138. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +285 -24
  139. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/package-wiki-source-zip.mjs +262 -30
  140. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/plan-kb-source-sync.mjs +1 -1
  141. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/precompiled-source.mjs +46 -2
  142. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/prepare-compile-schema.mjs +64 -0
  143. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/refresh-state-parts.mjs +91 -0
  144. package/skills/ae-automation/SKILL.md +16 -0
  145. package/skills/ae-automation/references/cli.md +53 -0
  146. package/skills/ae-automation/references/command_index.md +17 -0
  147. package/skills/ae-capability/SKILL.md +73 -2
  148. package/skills/ae-capability/references/collaboration.md +48 -0
  149. package/skills/ae-community/SKILL.md +5 -1
  150. package/skills/ae-community/references/collaboration.md +48 -0
  151. package/skills/ae-current-context/SKILL.md +3 -2
  152. package/skills/ae-data-integration/SKILL.md +4 -0
  153. package/skills/ae-data-integration/references/collaboration.md +48 -0
  154. package/skills/ae-dataops/SKILL.md +54 -74
  155. package/skills/ae-dataops/references/collaboration.md +48 -0
  156. package/skills/ae-dataops/references/dataops-backfill.md +23 -18
  157. package/skills/ae-dataops/references/dataops-flow-create.md +74 -23
  158. package/skills/ae-dataops/references/dataops-flow-monitor.md +45 -13
  159. package/skills/ae-dataops/references/dataops-integration.md +57 -30
  160. package/skills/ae-dataops/references/dataops-query.md +21 -4
  161. package/skills/ae-dataops/references/dataops-table.md +143 -11
  162. package/skills/ae-engage/SKILL.md +21 -6
  163. package/skills/ae-engage/references/channel-mgmt.md +3 -3
  164. package/skills/ae-engage/references/collaboration.md +48 -0
  165. package/skills/ae-engage/references/scene-config-channel.md +4 -4
  166. package/skills/ae-generate-tracking-plan/SKILL.md +4 -0
  167. package/skills/ae-generate-tracking-plan/references/collaboration.md +48 -0
  168. package/skills/ae-kb/SKILL.md +70 -12
  169. package/skills/ae-kb/references/analysis-workflow.md +73 -36
  170. package/skills/ae-kb/references/collaboration.md +48 -0
  171. package/skills/ae-kb/references/query-workflow.md +67 -33
  172. package/skills/ae-kb/references/schema-import.md +32 -0
  173. package/skills/ae-kb/references/source-mutations.md +6 -4
  174. package/skills/ae-kb/references/text-sources.md +53 -0
  175. package/skills/ae-kb-discovery/SKILL.md +8 -3
  176. package/skills/ae-kb-discovery/references/collaboration.md +48 -0
  177. package/skills/ae-metadata/SKILL.md +20 -12
  178. package/skills/ae-metadata/references/collaboration.md +48 -0
  179. package/skills/ae-team/SKILL.md +23 -17
  180. package/skills/ae-things/SKILL.md +85 -0
  181. package/skills/ae-things/references/cli.md +103 -0
  182. package/skills/ae-things-progress/SKILL.md +43 -0
  183. package/skills/ae-things-review/SKILL.md +42 -0
  184. package/skills/ae-workspace/SKILL.md +43 -0
  185. package/skills/ae-workspace/references/commands.md +51 -0
  186. package/dist/chunk-E2JKXMVO.js +0 -29
  187. package/dist/context-IFJI3LIT.js +0 -46
  188. package/dist/memory-QGPSNCQS.js +0 -892
  189. package/dist/project-semantic-3LF6Q6JZ.js +0 -1119
  190. package/skills/ae-agent/references/create-automation.md +0 -125
  191. package/skills/ae-agent/references/list-automations.md +0 -56
  192. package/skills/ae-agent/references/update-automation.md +0 -107
  193. package/skills/ae-project-semantic/SKILL.md +0 -193
  194. package/skills/ae-project-semantic/references/query-routing-v5.md +0 -165
  195. package/skills/ae-project-semantic/references/recommendation-quality.md +0 -68
@@ -0,0 +1,459 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ TeAgentApiError,
4
+ deleteFromMainApp,
5
+ getFromMainApp,
6
+ patchToMainApp,
7
+ postToMainApp
8
+ } from "./chunk-PLE722AJ.js";
9
+ import "./chunk-Y74WTIKJ.js";
10
+ import "./chunk-GIK6EDUG.js";
11
+ import "./chunk-UQ77JXYH.js";
12
+ import "./chunk-WNGFSIOB.js";
13
+
14
+ // src/commands/automation/index.ts
15
+ import { randomUUID } from "crypto";
16
+ var base = "/api/cli/automation/v1";
17
+ var flag = (name, desc, type = "string", required = false) => ({ name, desc, type, required });
18
+ var idFlag = flag("id", "Automation ID from list or create", "string", true);
19
+ var typeFlag = flag(
20
+ "target-type",
21
+ "agent | team; identifies the existing target on update",
22
+ "string",
23
+ true
24
+ );
25
+ var scopeFlag = flag(
26
+ "agent-space-id",
27
+ "Explicit space; otherwise server resolves sandbox context or personal space"
28
+ );
29
+ var runFlag = flag(
30
+ "run-id",
31
+ "Execution ID from run or runs list",
32
+ "string",
33
+ true
34
+ );
35
+ var pageFlags = [
36
+ flag("limit", "Page size, 1-100 (default 20)", "number"),
37
+ flag("cursor", "Opaque nextCursor from the previous page")
38
+ ];
39
+ var waitFlags = [
40
+ flag("wait", "Wait for this execution to finish", "boolean"),
41
+ flag("timeout", "Wait timeout in seconds, 1-86400 (default 300)", "number")
42
+ ];
43
+ var requestFlag = flag(
44
+ "command-id",
45
+ "Stable idempotency key; reuse it after an uncertain response"
46
+ );
47
+ var configFlags = [
48
+ typeFlag,
49
+ flag("name", "Automation name"),
50
+ {
51
+ ...flag("message", "Task instructions; an empty string clears it"),
52
+ sensitive: true
53
+ },
54
+ flag("clear-message", "Clear task instructions explicitly", "boolean"),
55
+ flag("trigger-type", "scheduled | manual"),
56
+ flag("status", "active | paused"),
57
+ flag(
58
+ "cron-expression",
59
+ "Five-field hourly, daily, weekly or monthly schedule"
60
+ ),
61
+ flag("schedule-kind", "hourly | daily | weekly | monthly"),
62
+ flag("time", "HH:mm in server timezone"),
63
+ flag("minute", "Hourly minute, 0-59", "number"),
64
+ flag("weekday", "Weekly day, 0=Sunday through 6=Saturday", "number"),
65
+ flag("day-of-month", "Monthly day, 1-28", "number"),
66
+ flag("model", "Agent model configuration ID; null clears the override"),
67
+ flag("reuse-conversation", "Agent: true | false", "json"),
68
+ {
69
+ ...flag("scope", "Team data scope JSON; null clears it", "json"),
70
+ sensitive: true
71
+ },
72
+ flag(
73
+ "channels",
74
+ "Team notification channel array; [] clears channels",
75
+ "json"
76
+ ),
77
+ flag("feishu-chat-id", "Team Feishu destination; null clears it"),
78
+ flag("lark-chat-id", "Team Lark destination; null clears it"),
79
+ flag("slack-channel-id", "Team Slack destination; null clears it"),
80
+ flag(
81
+ "save-to-knowledge-base-id",
82
+ "Team output knowledge base ID; null clears it"
83
+ )
84
+ ];
85
+ function enumValue(value, values, name) {
86
+ if (value && !values.includes(value))
87
+ throw new Error(`--${name} must be ${values.join(" | ")}`);
88
+ }
89
+ function range(value, min, max, name) {
90
+ if (!Number.isInteger(value) || value < min || value > max)
91
+ throw new Error(`--${name} must be an integer from ${min} to ${max}`);
92
+ return value;
93
+ }
94
+ function key(ctx, name) {
95
+ const value = ctx.str(name);
96
+ if (!value || value.length > 191)
97
+ throw new Error(`${name} must be a non-empty ID of at most 191 characters`);
98
+ return encodeURIComponent(value);
99
+ }
100
+ function configuration(ctx, create) {
101
+ const targetType = ctx.str("targetType");
102
+ enumValue(targetType, ["agent", "team"], "target-type");
103
+ if (!targetType) throw new Error("--target-type is required");
104
+ const result = {};
105
+ if (create) {
106
+ result.targetType = targetType;
107
+ result[targetType === "agent" ? "agentId" : "teamId"] = decodeURIComponent(
108
+ key(ctx, targetType === "agent" ? "agentId" : "teamId")
109
+ );
110
+ }
111
+ for (const name2 of ["name", "message", "triggerType", "status"]) {
112
+ if (ctx.str(name2)) result[name2] = ctx.str(name2);
113
+ }
114
+ if (ctx.bool("clearMessage")) {
115
+ if (ctx.str("message")) throw new Error("Use --message or --clear-message");
116
+ result.message = "";
117
+ }
118
+ if (create && ctx.str(targetType === "agent" ? "teamId" : "agentId"))
119
+ throw new Error("Specify only the selected target ID");
120
+ if (create && !ctx.str("name").trim()) throw new Error("--name is required");
121
+ const name = ctx.str("name");
122
+ if (name && !name.trim()) throw new Error("--name must not be blank");
123
+ if (targetType === "team") {
124
+ if (name.length > 191 || Array.from(name.replace(/\s/g, "")).length > 50)
125
+ throw new Error(
126
+ "--name must contain at most 50 non-whitespace characters (191 raw code units)"
127
+ );
128
+ } else if (name.trim().length > 100) {
129
+ throw new Error("--name must contain at most 100 characters");
130
+ }
131
+ enumValue(ctx.str("triggerType"), ["scheduled", "manual"], "trigger-type");
132
+ enumValue(ctx.str("status"), ["active", "paused"], "status");
133
+ const kind = ctx.str("scheduleKind"), cron = ctx.str("cronExpression");
134
+ enumValue(kind, ["hourly", "daily", "weekly", "monthly"], "schedule-kind");
135
+ if (kind && cron) throw new Error("Use --schedule-kind or --cron-expression");
136
+ if (!kind && ["time", "minute", "weekday", "dayOfMonth"].some((name2) => ctx.str(name2)))
137
+ throw new Error("Schedule details require --schedule-kind");
138
+ if (kind && ctx.str("weekday") && kind !== "weekly" || kind && ctx.str("dayOfMonth") && kind !== "monthly" || kind && ctx.str("minute") && kind !== "hourly")
139
+ throw new Error("Schedule field is not applicable to this frequency");
140
+ if (kind) {
141
+ const schedule = { kind };
142
+ if (kind === "hourly")
143
+ schedule.minute = range(ctx.optionalNum("minute") ?? 0, 0, 59, "minute");
144
+ else {
145
+ if (!/^([01]\d|2[0-3]):[0-5]\d$/.test(ctx.str("time")))
146
+ throw new Error("--time must use HH:mm");
147
+ schedule.time = ctx.str("time");
148
+ if (kind === "weekly")
149
+ schedule.weekday = range(
150
+ ctx.optionalNum("weekday") ?? NaN,
151
+ 0,
152
+ 6,
153
+ "weekday"
154
+ );
155
+ if (kind === "monthly")
156
+ schedule.dayOfMonth = range(
157
+ ctx.optionalNum("dayOfMonth") ?? NaN,
158
+ 1,
159
+ 28,
160
+ "day-of-month"
161
+ );
162
+ }
163
+ result.schedule = schedule;
164
+ }
165
+ if (cron) {
166
+ const parts = cron.trim().split(/\s+/);
167
+ const validNumber = (v, a, b) => /^\d+$/.test(v) && Number(v) >= a && Number(v) <= b;
168
+ const [m, h, d, mo, w] = parts;
169
+ if (parts.length !== 5 || !validNumber(m, 0, 59) || !(h === "*" || validNumber(h, 0, 23)) || mo !== "*" || !(d === "*" || validNumber(d, 1, 28)) || !(w === "*" || validNumber(w, 0, 6)) || d !== "*" && w !== "*" || h === "*" && (d !== "*" || w !== "*"))
170
+ throw new Error(
171
+ "--cron-expression must specify an hourly, daily, weekly or monthly schedule"
172
+ );
173
+ result.cronExpression = cron;
174
+ }
175
+ if (create && (ctx.str("triggerType") || "scheduled") === "scheduled" && !kind && !cron)
176
+ throw new Error("Scheduled automation requires a schedule");
177
+ const agentNames = ["model", "reuseConversation"];
178
+ const teamNames = [
179
+ "scope",
180
+ "channels",
181
+ "feishuChatId",
182
+ "larkChatId",
183
+ "slackChannelId",
184
+ "saveToKnowledgeBaseId"
185
+ ];
186
+ for (const name2 of [...agentNames, ...teamNames]) {
187
+ const json = ["scope", "channels", "reuseConversation"].includes(name2);
188
+ const value = json ? ctx.json(name2) : ctx.str(name2) || void 0;
189
+ if (value === void 0) continue;
190
+ if ((agentNames.includes(name2) ? "agent" : "team") !== targetType)
191
+ throw new Error(`${name2} is not applicable to ${targetType} automations`);
192
+ if (name2 === "reuseConversation" && typeof value !== "boolean")
193
+ throw new Error("--reuse-conversation must be true or false");
194
+ if (name2 === "channels" && (!Array.isArray(value) || value.some(
195
+ (v) => ![
196
+ "feishu",
197
+ "lark",
198
+ "slack",
199
+ "discord",
200
+ "dingtalk",
201
+ "wecom",
202
+ "mattermost",
203
+ "google_chat",
204
+ "zoom_chat",
205
+ "whatsapp"
206
+ ].includes(v)
207
+ )))
208
+ throw new Error(
209
+ "--channels must contain supported notification channels"
210
+ );
211
+ if (name2 === "scope" && value !== null && (typeof value !== "object" || Array.isArray(value)))
212
+ throw new Error("--scope must be an object or null");
213
+ result[name2 === "scope" ? "scopeJson" : name2] = name2 === "scope" ? value === null ? null : JSON.stringify(value) : value === "null" ? null : value;
214
+ }
215
+ if (!create && !Object.keys(result).length)
216
+ throw new Error("No fields to update");
217
+ if (create) result.triggerImmediately = ctx.bool("triggerImmediately");
218
+ return result;
219
+ }
220
+ function query(ctx, list = false, typed = false) {
221
+ const p = new URLSearchParams();
222
+ if (ctx.str("agentSpaceId")) p.set("agentSpaceId", ctx.str("agentSpaceId"));
223
+ if (typed && ctx.str("targetType"))
224
+ p.set("targetType", ctx.str("targetType"));
225
+ if (list) {
226
+ for (const k of ["limit", "cursor", "status", "q", "targetType"])
227
+ if (ctx.str(k)) p.set(k, ctx.str(k));
228
+ }
229
+ return p.size ? `?${p}` : "";
230
+ }
231
+ async function request(ctx, method, path, body) {
232
+ if (method === "GET")
233
+ return getFromMainApp(
234
+ path,
235
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host()
236
+ );
237
+ if (method === "POST")
238
+ return postToMainApp(
239
+ path,
240
+ body,
241
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host()
242
+ );
243
+ if (method === "PATCH")
244
+ return patchToMainApp(
245
+ path,
246
+ body,
247
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host()
248
+ );
249
+ return deleteFromMainApp(
250
+ path,
251
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host()
252
+ );
253
+ }
254
+ function withDryRun(path) {
255
+ return `${path}${path.includes("?") ? "&" : "?"}dryRun=true`;
256
+ }
257
+ function redactedPreview(method, path, body) {
258
+ return {
259
+ method,
260
+ url: path,
261
+ ...body === void 0 ? {} : { body: { payload: "[REDACTED]" } }
262
+ };
263
+ }
264
+ async function waitForRun(ctx, id, runId) {
265
+ const deadline = Date.now() + (ctx.optionalNum("timeout") ?? 300) * 1e3;
266
+ do {
267
+ const result = await request(
268
+ ctx,
269
+ "GET",
270
+ `${base}/${encodeURIComponent(id)}/runs/${encodeURIComponent(runId)}/result${query(ctx)}`
271
+ );
272
+ if (result.status !== "running")
273
+ return { ...result, executionCompleted: true, timedOut: false };
274
+ if (Date.now() >= deadline)
275
+ return { ...result, executionCompleted: false, timedOut: true };
276
+ await new Promise(
277
+ (resolve) => setTimeout(resolve, Math.min(1e3, deadline - Date.now()))
278
+ );
279
+ } while (true);
280
+ }
281
+ var actions = [
282
+ {
283
+ command: "list",
284
+ method: "GET",
285
+ suffix: () => "",
286
+ flags: [
287
+ ...pageFlags,
288
+ flag("target-type", "Filter agent | team"),
289
+ flag("status", "Filter active | paused"),
290
+ flag("q", "Search automation name")
291
+ ],
292
+ list: true
293
+ },
294
+ {
295
+ command: "get",
296
+ method: "GET",
297
+ suffix: (c) => `/${key(c, "id")}`,
298
+ flags: [idFlag]
299
+ },
300
+ {
301
+ command: "create",
302
+ method: "POST",
303
+ suffix: () => "",
304
+ flags: [
305
+ ...configFlags,
306
+ flag("agent-id", "Agent target ID"),
307
+ flag("team-id", "Team target ID"),
308
+ flag(
309
+ "trigger-immediately",
310
+ "Execute once after successful creation",
311
+ "boolean"
312
+ ),
313
+ requestFlag,
314
+ ...waitFlags
315
+ ],
316
+ body: (c) => configuration(c, true),
317
+ wait: true
318
+ },
319
+ {
320
+ command: "update",
321
+ method: "PATCH",
322
+ suffix: (c) => `/${key(c, "id")}`,
323
+ flags: [idFlag, ...configFlags],
324
+ body: (c) => configuration(c, false),
325
+ typed: true
326
+ },
327
+ ...["enable", "disable"].map((command) => ({
328
+ command,
329
+ method: "PATCH",
330
+ suffix: (c) => `/${key(c, "id")}`,
331
+ flags: [idFlag],
332
+ body: () => ({ status: command === "enable" ? "active" : "paused" })
333
+ })),
334
+ {
335
+ command: "delete",
336
+ method: "DELETE",
337
+ suffix: (c) => `/${key(c, "id")}`,
338
+ flags: [idFlag],
339
+ highRisk: true
340
+ },
341
+ {
342
+ command: "run",
343
+ method: "POST",
344
+ suffix: (c) => `/${key(c, "id")}/run`,
345
+ flags: [idFlag, requestFlag, ...waitFlags],
346
+ body: () => ({}),
347
+ wait: true
348
+ },
349
+ {
350
+ command: "list",
351
+ resource: "runs",
352
+ method: "GET",
353
+ suffix: (c) => `/${key(c, "id")}/runs`,
354
+ flags: [idFlag, ...pageFlags],
355
+ list: true
356
+ },
357
+ ...["get", "result", "stop", "retry"].map((command) => ({
358
+ command,
359
+ resource: "runs",
360
+ method: ["stop", "retry"].includes(command) ? "POST" : "GET",
361
+ suffix: (c) => `/${key(c, "id")}/runs/${key(c, "runId")}${command === "get" ? "" : `/${command}`}`,
362
+ flags: [
363
+ idFlag,
364
+ runFlag,
365
+ ...command === "retry" ? [requestFlag, ...waitFlags] : []
366
+ ],
367
+ body: ["stop", "retry"].includes(command) ? () => ({}) : void 0,
368
+ highRisk: command === "stop",
369
+ wait: command === "retry"
370
+ }))
371
+ ];
372
+ var automationCommands = actions.map((a) => ({
373
+ service: "automation",
374
+ resource: a.resource,
375
+ command: a.command,
376
+ description: `${a.command} ${a.resource ? "an automation execution" : "Agent or team automations"} (Transitional TE REST)`,
377
+ risk: a.highRisk ? "high-risk-write" : a.method === "GET" ? "read" : "write",
378
+ flags: [scopeFlag, ...a.flags ?? []],
379
+ validate: (ctx) => {
380
+ a.suffix(ctx);
381
+ a.body?.(ctx);
382
+ if (ctx.str("commandId").length > 191)
383
+ throw new Error("--command-id must contain at most 191 characters");
384
+ if (ctx.optionalNum("limit") !== void 0)
385
+ range(ctx.num("limit"), 1, 100, "limit");
386
+ if (ctx.optionalNum("timeout") !== void 0)
387
+ range(ctx.num("timeout"), 1, 86400, "timeout");
388
+ enumValue(ctx.str("targetType"), ["agent", "team"], "target-type");
389
+ enumValue(ctx.str("status"), ["active", "paused"], "status");
390
+ if (a.command === "create" && ctx.bool("wait") && !ctx.bool("triggerImmediately"))
391
+ throw new Error("--wait on create requires --trigger-immediately");
392
+ },
393
+ dryRun: async (ctx) => {
394
+ const body = a.body?.(ctx);
395
+ const commandId = ctx.str("commandId") || randomUUID();
396
+ const requestBody = body && {
397
+ ...body,
398
+ ...a.wait ? { commandId } : {}
399
+ };
400
+ const path = base + a.suffix(ctx) + query(ctx, a.list, a.typed);
401
+ return {
402
+ request: redactedPreview(a.method, path, requestBody),
403
+ validation: await request(ctx, a.method, withDryRun(path), requestBody)
404
+ };
405
+ },
406
+ execute: async (ctx) => {
407
+ const body = a.body?.(ctx), commandId = ctx.str("commandId") || randomUUID();
408
+ let output;
409
+ try {
410
+ output = await request(
411
+ ctx,
412
+ a.method,
413
+ base + a.suffix(ctx) + query(ctx, a.list, a.typed),
414
+ body && { ...body, ...a.wait ? { commandId } : {} }
415
+ );
416
+ } catch (error) {
417
+ if (a.wait && a.command !== "create" && error instanceof TeAgentApiError)
418
+ throw new TeAgentApiError(
419
+ error.message,
420
+ error.status,
421
+ error.code,
422
+ error.body,
423
+ error.errorType,
424
+ [
425
+ error.hint,
426
+ `Keep command ID ${commandId}. Reuse it when checking or retrying this execution request.`
427
+ ].filter(Boolean).join(" "),
428
+ error.details
429
+ );
430
+ throw error;
431
+ }
432
+ if (!a.wait) return output;
433
+ const runId = a.command === "create" ? output.execution?.runId : output.runId;
434
+ const id = a.command === "create" ? output.automation.id : ctx.str("id");
435
+ const accepted = { ...output, commandId };
436
+ if (!ctx.bool("wait") || !runId) return accepted;
437
+ try {
438
+ return { ...accepted, result: await waitForRun(ctx, id, runId) };
439
+ } catch (error) {
440
+ return {
441
+ ...accepted,
442
+ observation: {
443
+ status: "failed",
444
+ code: error instanceof TeAgentApiError ? error.code : "OBSERVATION_FAILED",
445
+ message: "Execution was accepted, but result polling failed. Read the existing run; do not create or trigger again.",
446
+ automationId: id,
447
+ runId
448
+ }
449
+ };
450
+ }
451
+ }
452
+ }));
453
+ var automation_default = automationCommands;
454
+ export {
455
+ automationCommands,
456
+ configuration,
457
+ automation_default as default,
458
+ waitForRun
459
+ };
@@ -11,7 +11,7 @@ import {
11
11
  inspectCapabilityWithEnvelope,
12
12
  listCapabilitiesWithEnvelope,
13
13
  validateCapabilityWithEnvelope
14
- } from "./chunk-HFGZGYCG.js";
14
+ } from "./chunk-EOYSKMXN.js";
15
15
  import {
16
16
  findGatewayDomain,
17
17
  listCapabilityDiscoveryPrefixes,
@@ -20,23 +20,24 @@ import {
20
20
  } from "./chunk-KPQY44JQ.js";
21
21
  import {
22
22
  resolveHost
23
- } from "./chunk-JOCDD4ON.js";
23
+ } from "./chunk-7QXISROD.js";
24
24
  import {
25
25
  printError,
26
26
  printOutput,
27
27
  withOutputMetadata
28
- } from "./chunk-DX5CDO34.js";
28
+ } from "./chunk-KFNMQTZI.js";
29
29
  import "./chunk-Y74WTIKJ.js";
30
30
  import {
31
+ CredentialStoreUnreadableError,
31
32
  SecureStoreAuthError
32
- } from "./chunk-7XGFSUOM.js";
33
+ } from "./chunk-GIK6EDUG.js";
33
34
  import {
34
35
  safeJsonParse
35
- } from "./chunk-7FTTULED.js";
36
+ } from "./chunk-UQ77JXYH.js";
36
37
  import {
37
38
  CliValidationError,
38
39
  PermissionError
39
- } from "./chunk-MAPZ7VB6.js";
40
+ } from "./chunk-WNGFSIOB.js";
40
41
 
41
42
  // src/commands/capability/index.ts
42
43
  import * as readline from "readline";
@@ -367,6 +368,10 @@ function printCapabilityError(error, host) {
367
368
  );
368
369
  return;
369
370
  }
371
+ if (error instanceof CredentialStoreUnreadableError) {
372
+ printError("config", error.message, error.hint, error.code);
373
+ return;
374
+ }
370
375
  if (error instanceof SecureStoreAuthError) {
371
376
  printError("auth", error.message, "Run: ae-cli auth login");
372
377
  return;
@@ -0,0 +1,43 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ deleteFromMainApp,
4
+ getBufferFromMainApp,
5
+ getFromMainApp,
6
+ patchToMainApp,
7
+ postToMainApp,
8
+ putToMainApp,
9
+ uploadToMainApp
10
+ } from "./chunk-PLE722AJ.js";
11
+
12
+ // src/commands/te-agent/api-client.ts
13
+ function getAgentApi(ctx, path) {
14
+ return getFromMainApp(path, ctx.host());
15
+ }
16
+ function postAgentApi(ctx, path, body) {
17
+ return postToMainApp(path, body, ctx.host());
18
+ }
19
+ function patchAgentApi(ctx, path, body) {
20
+ return patchToMainApp(path, body, ctx.host());
21
+ }
22
+ function putAgentApi(ctx, path, body) {
23
+ return putToMainApp(path, body, ctx.host());
24
+ }
25
+ function deleteAgentApi(ctx, path) {
26
+ return deleteFromMainApp(path, ctx.host());
27
+ }
28
+ function uploadAgentApi(ctx, path, formData) {
29
+ return uploadToMainApp(path, formData, ctx.host());
30
+ }
31
+ function getAgentBuffer(ctx, path) {
32
+ return getBufferFromMainApp(path, ctx.host());
33
+ }
34
+
35
+ export {
36
+ getAgentApi,
37
+ postAgentApi,
38
+ patchAgentApi,
39
+ putAgentApi,
40
+ deleteAgentApi,
41
+ uploadAgentApi,
42
+ getAgentBuffer
43
+ };
@@ -1,20 +1,20 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  require_lib
4
- } from "./chunk-DVMLWQD4.js";
4
+ } from "./chunk-CT7QDJS6.js";
5
5
  import {
6
6
  require_archiver,
7
7
  require_string_decoder
8
- } from "./chunk-EQ255HKO.js";
8
+ } from "./chunk-AP7YP2NX.js";
9
9
  import {
10
10
  require_inherits,
11
11
  require_node
12
- } from "./chunk-V2NUHPXF.js";
12
+ } from "./chunk-S6M42KND.js";
13
13
  import {
14
14
  __commonJS,
15
15
  __require,
16
16
  __toESM
17
- } from "./chunk-MAPZ7VB6.js";
17
+ } from "./chunk-WNGFSIOB.js";
18
18
 
19
19
  // node_modules/exceljs/lib/utils/under-dash.js
20
20
  var require_under_dash = __commonJS({
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from 'node:module'; const require =
2
2
  import {
3
3
  getActiveHost,
4
4
  normalizeUrl
5
- } from "./chunk-7FTTULED.js";
5
+ } from "./chunk-UQ77JXYH.js";
6
6
 
7
7
  // src/core/auth.ts
8
8
  function resolveHost(hostOverride) {
@@ -5,14 +5,14 @@ import {
5
5
  require_node,
6
6
  require_process_nextick_args,
7
7
  require_util
8
- } from "./chunk-V2NUHPXF.js";
8
+ } from "./chunk-S6M42KND.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __esm,
12
12
  __export,
13
13
  __require,
14
14
  __toCommonJS
15
- } from "./chunk-MAPZ7VB6.js";
15
+ } from "./chunk-WNGFSIOB.js";
16
16
 
17
17
  // node_modules/readdir-glob/node_modules/minimatch/lib/path.js
18
18
  var require_path = __commonJS({
@@ -5,11 +5,11 @@ import {
5
5
  require_node,
6
6
  require_process_nextick_args,
7
7
  require_util
8
- } from "./chunk-V2NUHPXF.js";
8
+ } from "./chunk-S6M42KND.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __require
12
- } from "./chunk-MAPZ7VB6.js";
12
+ } from "./chunk-WNGFSIOB.js";
13
13
 
14
14
  // node_modules/jszip/node_modules/readable-stream/lib/internal/streams/stream.js
15
15
  var require_stream = __commonJS({
@@ -0,0 +1,56 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ getAgentApi,
4
+ patchAgentApi,
5
+ postAgentApi
6
+ } from "./chunk-4655PUNX.js";
7
+
8
+ // src/commands/memory/cli-client.ts
9
+ var DEFAULT_TE_CLAUDE_BASE_PATH = "/agent";
10
+ var MEMORY_CLI_BASE_PATH = "/api/cli/memory/v2";
11
+ function normalizeBasePath(value) {
12
+ const trimmed = value.trim();
13
+ if (!trimmed || trimmed === "/") return "";
14
+ return `/${trimmed.replace(/^\/+|\/+$/g, "")}`;
15
+ }
16
+ function resolveMemoryApiBaseUrl(host) {
17
+ const base = host.replace(/\/+$/, "");
18
+ const basePath = normalizeBasePath(
19
+ process.env.TE_CLAUDE_BASE_PATH ?? process.env.AE_API_PREFIX ?? DEFAULT_TE_CLAUDE_BASE_PATH
20
+ );
21
+ return basePath && !base.endsWith(basePath) ? `${base}${basePath}` : base;
22
+ }
23
+ function buildMemoryCliUrl(ctx, path) {
24
+ return `${resolveMemoryApiBaseUrl(ctx.host())}${MEMORY_CLI_BASE_PATH}/${path.replace(/^\/+/, "")}`;
25
+ }
26
+ function unwrapMemoryResponse(response) {
27
+ if (response && typeof response === "object" && !Array.isArray(response)) {
28
+ const envelope = response;
29
+ if (envelope.ok === true) return envelope.data;
30
+ if (envelope.ok === false) throw new Error(envelope.error?.message || "Memory API request failed");
31
+ }
32
+ return response;
33
+ }
34
+ async function getMemoryCli(ctx, path) {
35
+ return unwrapMemoryResponse(
36
+ await getAgentApi(ctx, `${MEMORY_CLI_BASE_PATH}/${path.replace(/^\/+/, "")}`)
37
+ );
38
+ }
39
+ async function postMemoryCli(ctx, path, body) {
40
+ return unwrapMemoryResponse(
41
+ await postAgentApi(ctx, `${MEMORY_CLI_BASE_PATH}/${path.replace(/^\/+/, "")}`, body)
42
+ );
43
+ }
44
+ async function patchMemoryCli(ctx, path, body) {
45
+ return unwrapMemoryResponse(
46
+ await patchAgentApi(ctx, `${MEMORY_CLI_BASE_PATH}/${path.replace(/^\/+/, "")}`, body)
47
+ );
48
+ }
49
+
50
+ export {
51
+ resolveMemoryApiBaseUrl,
52
+ buildMemoryCliUrl,
53
+ getMemoryCli,
54
+ postMemoryCli,
55
+ patchMemoryCli
56
+ };