@thinkingai/ae-cli 6.1.25 → 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 (121) hide show
  1. package/README.md +28 -9
  2. package/README.zh.md +25 -9
  3. package/bin/ae-cli.js +6 -1
  4. package/cli-installation-guide.md +91 -0
  5. package/dist/{auth-LHM7NQPR.js → auth-YHMC3GDH.js} +6 -8
  6. package/dist/automation-NWWVLWG2.js +459 -0
  7. package/dist/{capability-SJI5KOCK.js → capability-3QLLIVFB.js} +6 -6
  8. package/dist/chunk-4655PUNX.js +43 -0
  9. package/dist/{chunk-KS4DE3MX.js → chunk-5XJYLEVC.js} +4 -4
  10. package/dist/{chunk-N4BLPJC7.js → chunk-7QXISROD.js} +1 -1
  11. package/dist/{chunk-7WZACOAI.js → chunk-AP7YP2NX.js} +2 -2
  12. package/dist/{chunk-SO5LKIWP.js → chunk-CT7QDJS6.js} +2 -2
  13. package/dist/chunk-D6ACFILC.js +56 -0
  14. package/dist/{chunk-QYXDJOLA.js → chunk-EOYSKMXN.js} +19 -11
  15. package/dist/{chunk-5XRQ3CZR.js → chunk-FMNNGNYO.js} +43 -8
  16. package/dist/{chunk-DU72X2IO.js → chunk-GIK6EDUG.js} +22 -10
  17. package/dist/chunk-HVHR4SCP.js +133 -0
  18. package/dist/{chunk-2FJM4HRV.js → chunk-KAEHZZH4.js} +3 -3
  19. package/dist/{chunk-BW7JUDEI.js → chunk-KFNMQTZI.js} +514 -213
  20. package/dist/{chunk-KJDOTPYU.js → chunk-PLE722AJ.js} +28 -11
  21. package/dist/chunk-RK6GLDGI.js +27 -0
  22. package/dist/{chunk-GK7WDY7E.js → chunk-S6M42KND.js} +1 -1
  23. package/dist/{chunk-IG3DYEIR.js → chunk-UQ77JXYH.js} +4 -3
  24. package/dist/{chunk-YVGXGTD6.js → chunk-WNGFSIOB.js} +7 -1
  25. package/dist/{chunk-XKIW3QMF.js → chunk-XCHAYMSF.js} +3 -3
  26. package/dist/{community-report-client-6VJDDMJJ.js → community-report-client-PEERQCX2.js} +1 -1
  27. package/dist/{config-XQWOPDHN.js → config-AHPMEW5A.js} +4 -4
  28. package/dist/context-YAE3QXP3.js +136 -0
  29. package/dist/{data-integration-XBTCGXQT.js → data-integration-HESZET7E.js} +6 -6
  30. package/dist/index.js +123 -46
  31. package/dist/{local-data-upload-client-3P7NIVQ4.js → local-data-upload-client-TWMHFLUA.js} +1 -1
  32. package/dist/memory-62BJOULV.js +580 -0
  33. package/dist/{metadata-JRYKNUS5.js → metadata-C7CEDHOJ.js} +7 -7
  34. package/dist/{model-ZS7HVGKN.js → model-SBV2JFJI.js} +9 -5
  35. package/dist/{personal-semantic-preference-IDE2GE5T.js → personal-semantic-preference-QECDPHND.js} +117 -11
  36. package/dist/{project-semantic-36KOCYN7.js → project-semantic-Z4QAMBWF.js} +6 -6
  37. package/dist/{sync-EQLSTUS7.js → sync-SU33KYX7.js} +12 -8
  38. package/dist/{te-agent-Z3HCTKR7.js → te-agent-F5QBZSQA.js} +90 -454
  39. package/dist/{te-analysis-5ZZ6YHVH.js → te-analysis-2ECAAIFK.js} +297 -20
  40. package/dist/{te-community-Z7JACGF3.js → te-community-PFLDLPP4.js} +3 -3
  41. package/dist/{te-dataops-F7GQOIS6.js → te-dataops-FOQSRIAZ.js} +5 -5
  42. package/dist/{te-engage-RNRMYDO3.js → te-engage-QKUGIWSR.js} +6 -6
  43. package/dist/{te-experiment-BTAC2UNK.js → te-experiment-26PXR2UO.js} +6 -6
  44. package/dist/{te-kb-QJLJEX5K.js → te-kb-MHDOST62.js} +494 -214
  45. package/dist/{te-system-IXC43QHZ.js → te-system-J2FQF5ER.js} +6 -6
  46. package/dist/{te-team-BIZIKIHZ.js → te-team-5UOZPTU3.js} +6 -6
  47. package/dist/things-VPPXXLHB.js +1091 -0
  48. package/dist/{update-W2SGQNKT.js → update-EEUTEI6R.js} +59 -51
  49. package/dist/workspace-O3EEIYQM.js +554 -0
  50. package/package.json +21 -9
  51. package/skills/ae-agent/SKILL.md +89 -139
  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/restore-conversation.md +3 -1
  59. package/skills/ae-analysis/SKILL.md +15 -6
  60. package/skills/ae-analysis/references/ai_models/funnel.md +5 -3
  61. package/skills/ae-analysis/references/ai_models.md +27 -0
  62. package/skills/ae-analysis/references/command_index.md +12 -4
  63. package/skills/ae-analysis/references/dashboard_move.md +21 -0
  64. package/skills/ae-analysis/references/dashboard_report_add.md +2 -0
  65. package/skills/ae-analysis/references/dashboard_report_get.md +19 -0
  66. package/skills/ae-analysis/references/dashboard_report_update.md +27 -0
  67. package/skills/ae-analysis/references/dashboard_update.md +1 -1
  68. package/skills/ae-analysis/references/event_report_presentation.md +76 -0
  69. package/skills/ae-analysis/references/feedback_submit.md +37 -0
  70. package/skills/ae-analysis/references/metadata_resolution.md +15 -0
  71. package/skills/ae-analysis/references/personal_semantic_preference_review.md +9 -0
  72. package/skills/ae-analysis/references/personal_semantic_preference_review_list.md +7 -0
  73. package/skills/ae-analysis/references/personal_semantic_preference_submit.md +7 -0
  74. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +68 -27
  75. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +40 -1
  76. package/skills/ae-analysis/references/report_create.md +13 -3
  77. package/skills/ae-analysis/references/report_get.md +5 -1
  78. package/skills/ae-analysis/references/report_update.md +15 -4
  79. package/skills/ae-analysis/references/system_query_monitor_overview.md +2 -0
  80. package/skills/ae-analysis/references/system_query_task_cancel.md +2 -0
  81. package/skills/ae-analysis/references/system_query_task_export.md +6 -2
  82. package/skills/ae-analysis/references/system_query_task_get.md +2 -0
  83. package/skills/ae-analysis/references/system_query_task_list.md +7 -3
  84. package/skills/ae-analysis/references/system_query_task_options.md +2 -2
  85. package/skills/ae-analysis/references/system_query_task_realtime_list.md +15 -0
  86. package/skills/ae-analysis/references/user_tag_models.md +2 -0
  87. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-empty-skeleton.mjs +105 -0
  88. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +337 -22
  89. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +21 -8
  90. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +24 -11
  91. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +66 -0
  92. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +1 -0
  93. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/package-wiki-source-zip.mjs +109 -40
  94. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/plan-kb-source-sync.mjs +1 -1
  95. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/prepare-compile-schema.mjs +64 -0
  96. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/refresh-state-parts.mjs +91 -0
  97. package/skills/ae-automation/SKILL.md +16 -0
  98. package/skills/ae-automation/references/cli.md +53 -0
  99. package/skills/ae-automation/references/command_index.md +17 -0
  100. package/skills/ae-capability/SKILL.md +15 -6
  101. package/skills/ae-current-context/SKILL.md +3 -2
  102. package/skills/ae-kb/SKILL.md +62 -12
  103. package/skills/ae-kb/references/analysis-workflow.md +73 -36
  104. package/skills/ae-kb/references/query-workflow.md +67 -33
  105. package/skills/ae-kb/references/schema-import.md +5 -3
  106. package/skills/ae-kb/references/source-mutations.md +6 -4
  107. package/skills/ae-kb/references/text-sources.md +53 -0
  108. package/skills/ae-kb-discovery/SKILL.md +1 -1
  109. package/skills/ae-team/SKILL.md +23 -17
  110. package/skills/ae-things/SKILL.md +85 -0
  111. package/skills/ae-things/references/cli.md +103 -0
  112. package/skills/ae-things-progress/SKILL.md +43 -0
  113. package/skills/ae-things-review/SKILL.md +42 -0
  114. package/skills/ae-workspace/SKILL.md +43 -0
  115. package/skills/ae-workspace/references/commands.md +51 -0
  116. package/dist/chunk-E2JKXMVO.js +0 -29
  117. package/dist/context-M3HDGEIR.js +0 -46
  118. package/dist/memory-6APEB2JB.js +0 -892
  119. package/skills/ae-agent/references/create-automation.md +0 -125
  120. package/skills/ae-agent/references/list-automations.md +0 -56
  121. package/skills/ae-agent/references/update-automation.md +0 -107
@@ -3,25 +3,40 @@ import {
3
3
  assertValidSkillVersion
4
4
  } from "./chunk-T6OSFQZD.js";
5
5
  import {
6
- deleteFromMainApp,
7
- getBufferFromMainApp,
8
- getFromMainApp,
9
- patchToMainApp,
10
- postToMainApp,
11
- putToMainApp,
12
- resolveTeClaudeBaseUrl,
13
- uploadToMainApp
14
- } from "./chunk-KJDOTPYU.js";
6
+ buildWorkspaceCliUrl,
7
+ getWorkspaceApi,
8
+ postWorkspaceApi,
9
+ previewWorkspaceResourcePath,
10
+ resolveWorkspaceTarget,
11
+ workspaceResourcePath,
12
+ workspaceTargetFlags,
13
+ workspaceTargetPath
14
+ } from "./chunk-HVHR4SCP.js";
15
+ import {
16
+ currentAgentSpaceId
17
+ } from "./chunk-RK6GLDGI.js";
18
+ import {
19
+ deleteAgentApi,
20
+ getAgentApi,
21
+ getAgentBuffer,
22
+ patchAgentApi,
23
+ postAgentApi,
24
+ putAgentApi,
25
+ uploadAgentApi
26
+ } from "./chunk-4655PUNX.js";
27
+ import {
28
+ resolveTeClaudeBaseUrl
29
+ } from "./chunk-PLE722AJ.js";
15
30
  import {
16
31
  buildCapabilityGatewayUrl,
17
32
  callCapabilityApi
18
- } from "./chunk-QYXDJOLA.js";
33
+ } from "./chunk-EOYSKMXN.js";
19
34
  import "./chunk-Y74WTIKJ.js";
20
- import "./chunk-DU72X2IO.js";
21
- import "./chunk-IG3DYEIR.js";
35
+ import "./chunk-GIK6EDUG.js";
36
+ import "./chunk-UQ77JXYH.js";
22
37
  import {
23
38
  CliValidationError
24
- } from "./chunk-YVGXGTD6.js";
39
+ } from "./chunk-WNGFSIOB.js";
25
40
 
26
41
  // src/commands/te-agent/notifications.ts
27
42
  import { openSync, closeSync, fstatSync, readSync } from "fs";
@@ -336,29 +351,6 @@ var notificationCommands = [
336
351
  notificationMarkRead
337
352
  ];
338
353
 
339
- // src/commands/te-agent/api-client.ts
340
- function getAgentApi(ctx, path) {
341
- return getFromMainApp(path, ctx.host());
342
- }
343
- function postAgentApi(ctx, path, body) {
344
- return postToMainApp(path, body, ctx.host());
345
- }
346
- function patchAgentApi(ctx, path, body) {
347
- return patchToMainApp(path, body, ctx.host());
348
- }
349
- function putAgentApi(ctx, path, body) {
350
- return putToMainApp(path, body, ctx.host());
351
- }
352
- function deleteAgentApi(ctx, path) {
353
- return deleteFromMainApp(path, ctx.host());
354
- }
355
- function uploadAgentApi(ctx, path, formData) {
356
- return uploadToMainApp(path, formData, ctx.host());
357
- }
358
- function getAgentBuffer(ctx, path) {
359
- return getBufferFromMainApp(path, ctx.host());
360
- }
361
-
362
354
  // src/commands/te-agent/agents.ts
363
355
  var BASE_PATH = "/api/sandbox/agent/agents";
364
356
  function buildQuery(ctx) {
@@ -3089,391 +3081,6 @@ var attachmentStats = {
3089
3081
  }
3090
3082
  };
3091
3083
 
3092
- // src/commands/te-agent/automations.ts
3093
- var BASE_PATH6 = "/api/sandbox/agent/automations";
3094
- var SCHEDULE_KINDS = ["hourly", "daily", "weekly", "monthly"];
3095
- var TIME_RE = /^([01]\d|2[0-3]):([0-5]\d)$/;
3096
- var AUTOMATION_STATUSES = ["active", "paused"];
3097
- function optional(value) {
3098
- const trimmed = value.trim();
3099
- return trimmed ? trimmed : void 0;
3100
- }
3101
- function envOptional(name) {
3102
- return optional(process.env[name] ?? "");
3103
- }
3104
- function readEnabled(ctx) {
3105
- return readEnabledOptional(ctx) ?? true;
3106
- }
3107
- function readEnabledOptional(ctx) {
3108
- const enabled = ctx.json("enabled");
3109
- if (enabled === void 0) return void 0;
3110
- if (typeof enabled !== "boolean") {
3111
- throw new Error("--enabled \u5FC5\u987B\u662F true \u6216 false");
3112
- }
3113
- return enabled;
3114
- }
3115
- function readReuseConversation(ctx) {
3116
- return readReuseConversationOptional(ctx) ?? false;
3117
- }
3118
- function readReuseConversationOptional(ctx) {
3119
- const reuseConversation = ctx.json("reuseConversation");
3120
- if (reuseConversation === void 0) return void 0;
3121
- if (typeof reuseConversation !== "boolean") {
3122
- throw new Error("--reuse-conversation must be true or false");
3123
- }
3124
- return reuseConversation;
3125
- }
3126
- function buildSchedule(ctx) {
3127
- const kind = optional(ctx.str("scheduleKind"));
3128
- if (!kind) return void 0;
3129
- if (kind === "hourly") {
3130
- const minute = ctx.str("minute") ? ctx.num("minute") : void 0;
3131
- return { kind, ...minute === void 0 ? {} : { minute } };
3132
- }
3133
- if (kind === "daily") return { kind, time: ctx.str("time") };
3134
- if (kind === "weekly") {
3135
- return { kind, time: ctx.str("time"), weekday: ctx.num("weekday") };
3136
- }
3137
- return {
3138
- kind: "monthly",
3139
- time: ctx.str("time"),
3140
- dayOfMonth: ctx.num("dayOfMonth")
3141
- };
3142
- }
3143
- function hasScheduleDetail(ctx) {
3144
- return Boolean(
3145
- optional(ctx.str("time")) || optional(ctx.str("minute")) || optional(ctx.str("weekday")) || optional(ctx.str("dayOfMonth"))
3146
- );
3147
- }
3148
- function validateSchedule(ctx, required) {
3149
- const cron = optional(ctx.str("cron"));
3150
- const kind = optional(ctx.str("scheduleKind"));
3151
- if (cron && kind) {
3152
- throw new Error("--cron \u4E0E --schedule-kind \u53EA\u80FD\u4E8C\u9009\u4E00");
3153
- }
3154
- if (!cron && !kind) {
3155
- if (required || hasScheduleDetail(ctx)) {
3156
- throw new Error("\u5FC5\u987B\u63D0\u4F9B --cron \u6216 --schedule-kind");
3157
- }
3158
- return;
3159
- }
3160
- if (!kind) return;
3161
- if (!SCHEDULE_KINDS.includes(kind)) {
3162
- throw new Error("--schedule-kind \u5FC5\u987B\u662F hourly\u3001daily\u3001weekly \u6216 monthly");
3163
- }
3164
- const time = optional(ctx.str("time"));
3165
- if (kind !== "hourly") {
3166
- if (!time) throw new Error(`${kind} \u8C03\u5EA6\u5FC5\u987B\u63D0\u4F9B --time HH:mm`);
3167
- if (!TIME_RE.test(time)) throw new Error("--time \u683C\u5F0F\u5FC5\u987B\u662F HH:mm");
3168
- }
3169
- if (kind === "hourly" && ctx.str("minute")) {
3170
- const minute = ctx.num("minute");
3171
- if (!Number.isInteger(minute) || minute < 0 || minute > 59) {
3172
- throw new Error("--minute \u5FC5\u987B\u662F 0-59 \u7684\u6574\u6570");
3173
- }
3174
- }
3175
- if (kind === "weekly") {
3176
- const weekday = ctx.num("weekday");
3177
- if (!Number.isInteger(weekday) || weekday < 0 || weekday > 6) {
3178
- throw new Error("--weekday \u5FC5\u987B\u662F 0-6 \u7684\u6574\u6570\uFF0C0 \u8868\u793A\u5468\u65E5");
3179
- }
3180
- }
3181
- if (kind === "monthly") {
3182
- const dayOfMonth = ctx.num("dayOfMonth");
3183
- if (!Number.isInteger(dayOfMonth) || dayOfMonth < 1 || dayOfMonth > 28) {
3184
- throw new Error("--day-of-month \u5FC5\u987B\u662F 1-28 \u7684\u6574\u6570");
3185
- }
3186
- }
3187
- }
3188
- function buildCreateBody(ctx) {
3189
- const explicitAgentId = optional(ctx.str("agentId"));
3190
- const explicitAgentName = optional(ctx.str("agentName"));
3191
- const agentId = explicitAgentId ?? (explicitAgentName ? void 0 : envOptional("TE_AGENT_CURRENT_AGENT_ID"));
3192
- const conversationId = optional(ctx.str("conversationId")) ?? envOptional("TE_AGENT_CONVERSATION_ID");
3193
- const model = optional(ctx.str("model")) ?? envOptional("TE_AGENT_CURRENT_MODEL_ID");
3194
- const enabled = readEnabled(ctx);
3195
- const agentSpaceId = optional(ctx.str("agentSpaceId"));
3196
- return {
3197
- name: ctx.str("name"),
3198
- message: ctx.str("message"),
3199
- agentId,
3200
- agentName: explicitAgentName,
3201
- conversationId,
3202
- ...agentSpaceId ? { agentSpaceId } : {},
3203
- cronExpression: optional(ctx.str("cron")),
3204
- schedule: buildSchedule(ctx),
3205
- triggerType: "scheduled",
3206
- model,
3207
- reuseConversation: readReuseConversation(ctx),
3208
- status: enabled ? "active" : "paused"
3209
- };
3210
- }
3211
- function buildListPath(ctx) {
3212
- const params = new URLSearchParams();
3213
- const q = optional(ctx.str("q"));
3214
- const status = optional(ctx.str("status"));
3215
- const limit = optional(ctx.str("limit"));
3216
- const agentSpaceId = optional(ctx.str("agentSpaceId"));
3217
- if (q) params.set("q", q);
3218
- if (status) params.set("status", status);
3219
- if (limit) params.set("limit", String(ctx.num("limit")));
3220
- if (agentSpaceId) params.set("agentSpaceId", agentSpaceId);
3221
- const query2 = params.toString();
3222
- return query2 ? `${BASE_PATH6}?${query2}` : BASE_PATH6;
3223
- }
3224
- function validateList(ctx) {
3225
- const status = optional(ctx.str("status"));
3226
- if (status && !AUTOMATION_STATUSES.includes(status)) {
3227
- throw new Error("--status \u5FC5\u987B\u662F active \u6216 paused");
3228
- }
3229
- if (ctx.str("limit")) {
3230
- const limit = ctx.num("limit");
3231
- if (!Number.isInteger(limit) || limit < 1 || limit > 50) {
3232
- throw new Error("--limit \u5FC5\u987B\u662F 1-10000 \u7684\u6574\u6570");
3233
- }
3234
- }
3235
- }
3236
- function buildUpdateBody2(ctx) {
3237
- const enabled = readEnabledOptional(ctx);
3238
- const reuseConversation = readReuseConversationOptional(ctx);
3239
- const body = {};
3240
- const name = optional(ctx.str("name"));
3241
- const message = optional(ctx.str("message"));
3242
- const cron = optional(ctx.str("cron"));
3243
- const schedule = buildSchedule(ctx);
3244
- if (name) body.name = name;
3245
- if (message !== void 0) body.message = message;
3246
- if (enabled !== void 0) body.status = enabled ? "active" : "paused";
3247
- if (reuseConversation !== void 0)
3248
- body.reuseConversation = reuseConversation;
3249
- if (cron) body.cronExpression = cron;
3250
- if (schedule) body.schedule = schedule;
3251
- return body;
3252
- }
3253
- function validateUpdate(ctx) {
3254
- validateSchedule(ctx, false);
3255
- if (!Object.keys(buildUpdateBody2(ctx)).length) {
3256
- throw new Error("\u81F3\u5C11\u63D0\u4F9B\u4E00\u4E2A\u66F4\u65B0\u5B57\u6BB5");
3257
- }
3258
- }
3259
- function buildUpdatePath(ctx) {
3260
- const path = `${BASE_PATH6}/${encodeURIComponent(ctx.str("id"))}`;
3261
- const agentSpaceId = optional(ctx.str("agentSpaceId"));
3262
- const params = new URLSearchParams();
3263
- if (agentSpaceId) params.set("agentSpaceId", agentSpaceId);
3264
- return agentSpaceId ? `${path}?${params}` : path;
3265
- }
3266
- var scheduleFlags = [
3267
- {
3268
- name: "cron",
3269
- type: "string",
3270
- required: false,
3271
- desc: "Cron expression for supported hourly/daily/weekly/monthly schedules"
3272
- },
3273
- {
3274
- name: "schedule-kind",
3275
- type: "string",
3276
- required: false,
3277
- desc: "hourly | daily | weekly | monthly"
3278
- },
3279
- {
3280
- name: "time",
3281
- type: "string",
3282
- required: false,
3283
- desc: "Time in HH:mm for daily/weekly/monthly"
3284
- },
3285
- {
3286
- name: "minute",
3287
- type: "number",
3288
- required: false,
3289
- desc: "Minute 0-59 for hourly schedules"
3290
- },
3291
- {
3292
- name: "weekday",
3293
- type: "number",
3294
- required: false,
3295
- desc: "Weekday 0-6 for weekly schedules; 0 is Sunday"
3296
- },
3297
- {
3298
- name: "day-of-month",
3299
- type: "number",
3300
- required: false,
3301
- desc: "Day 1-28 for monthly schedules"
3302
- }
3303
- ];
3304
- var listAutomations = {
3305
- service: "agent",
3306
- command: "+list-automations",
3307
- description: "List current user's Agent automation tasks in a workspace",
3308
- flags: [
3309
- {
3310
- name: "agent-space-id",
3311
- type: "string",
3312
- required: false,
3313
- maxLength: 191,
3314
- desc: "Workspace ID; omit for the personal default workspace"
3315
- },
3316
- {
3317
- name: "q",
3318
- type: "string",
3319
- required: false,
3320
- desc: "Keyword for automation name or instruction"
3321
- },
3322
- {
3323
- name: "status",
3324
- type: "string",
3325
- required: false,
3326
- desc: "active | paused"
3327
- },
3328
- {
3329
- name: "limit",
3330
- type: "number",
3331
- required: false,
3332
- desc: "Maximum number of automations to return, 1-10000"
3333
- }
3334
- ],
3335
- risk: "read",
3336
- validate: validateList,
3337
- dryRun: (ctx) => ({
3338
- method: "GET",
3339
- url: buildListPath(ctx)
3340
- }),
3341
- execute: async (ctx) => getAgentApi(ctx, buildListPath(ctx))
3342
- };
3343
- var createAutomation = {
3344
- service: "agent",
3345
- command: "+create-automation",
3346
- description: "Create an Agent automation task",
3347
- flags: [
3348
- {
3349
- name: "name",
3350
- type: "string",
3351
- required: true,
3352
- desc: "Automation task name"
3353
- },
3354
- {
3355
- name: "message",
3356
- type: "string",
3357
- required: true,
3358
- desc: "Instruction sent to the Agent"
3359
- },
3360
- {
3361
- name: "agent-id",
3362
- type: "string",
3363
- required: false,
3364
- desc: "Agent ID; defaults to current conversation Agent"
3365
- },
3366
- {
3367
- name: "agent-name",
3368
- type: "string",
3369
- required: false,
3370
- desc: "Agent name; use only after +list-agents discovery"
3371
- },
3372
- {
3373
- name: "model",
3374
- type: "string",
3375
- required: false,
3376
- desc: "Model record ID; defaults to current selected model"
3377
- },
3378
- {
3379
- name: "enabled",
3380
- type: "boolean",
3381
- required: false,
3382
- desc: "Whether to enable the automation immediately; defaults to true"
3383
- },
3384
- {
3385
- name: "reuse-conversation",
3386
- type: "boolean",
3387
- required: false,
3388
- desc: "Continue future runs in the same conversation; defaults to false"
3389
- },
3390
- {
3391
- name: "conversation-id",
3392
- type: "string",
3393
- required: false,
3394
- desc: "Conversation ID fallback for resolving the Agent and workspace"
3395
- },
3396
- {
3397
- name: "agent-space-id",
3398
- type: "string",
3399
- required: false,
3400
- maxLength: 191,
3401
- desc: "Workspace ID; omit to inherit the conversation workspace, then the personal default"
3402
- },
3403
- ...scheduleFlags
3404
- ],
3405
- risk: "write",
3406
- validate: (ctx) => {
3407
- if (ctx.str("agentId") && ctx.str("agentName")) {
3408
- throw new Error("--agent-id \u4E0E --agent-name \u53EA\u80FD\u4E8C\u9009\u4E00");
3409
- }
3410
- validateSchedule(ctx, true);
3411
- },
3412
- dryRun: (ctx) => ({
3413
- method: "POST",
3414
- url: BASE_PATH6,
3415
- body: buildCreateBody(ctx)
3416
- }),
3417
- execute: async (ctx) => postAgentApi(ctx, BASE_PATH6, buildCreateBody(ctx))
3418
- };
3419
- var updateAutomation = {
3420
- service: "agent",
3421
- command: "+update-automation",
3422
- description: "Update an Agent automation task",
3423
- flags: [
3424
- {
3425
- name: "id",
3426
- type: "string",
3427
- required: true,
3428
- desc: "Automation task ID from +list-automations"
3429
- },
3430
- {
3431
- name: "agent-space-id",
3432
- type: "string",
3433
- required: false,
3434
- maxLength: 191,
3435
- desc: "Task's workspace ID; omit for the personal default workspace. Does not move the task"
3436
- },
3437
- {
3438
- name: "name",
3439
- type: "string",
3440
- required: false,
3441
- desc: "New automation task name"
3442
- },
3443
- {
3444
- name: "message",
3445
- type: "string",
3446
- required: false,
3447
- desc: "New instruction sent to the Agent"
3448
- },
3449
- {
3450
- name: "enabled",
3451
- type: "boolean",
3452
- required: false,
3453
- desc: "true to enable, false to pause"
3454
- },
3455
- {
3456
- name: "reuse-conversation",
3457
- type: "boolean",
3458
- required: false,
3459
- desc: "true to reuse one conversation, false to create one per run"
3460
- },
3461
- ...scheduleFlags
3462
- ],
3463
- risk: "write",
3464
- validate: validateUpdate,
3465
- dryRun: (ctx) => ({
3466
- method: "PATCH",
3467
- url: buildUpdatePath(ctx),
3468
- body: buildUpdateBody2(ctx)
3469
- }),
3470
- execute: async (ctx) => patchAgentApi(
3471
- ctx,
3472
- buildUpdatePath(ctx),
3473
- buildUpdateBody2(ctx)
3474
- )
3475
- };
3476
-
3477
3084
  // src/commands/te-agent/sandbox-tools.ts
3478
3085
  import {
3479
3086
  accessSync,
@@ -3670,18 +3277,23 @@ var CONVERSATION_PATH = "/api/sandbox/agent/conversations";
3670
3277
  var ARCHIVE_SEARCH_PATH = `${CONVERSATION_PATH}/archived`;
3671
3278
  var DEFAULT_LIMIT = 20;
3672
3279
  var DEFAULT_TIME_ZONE = "Asia/Shanghai";
3673
- function optional2(value) {
3280
+ function optional(value) {
3674
3281
  const trimmed = value.trim();
3675
3282
  return trimmed ? trimmed : void 0;
3676
3283
  }
3677
- function envOptional2(name) {
3678
- return optional2(process.env[name] ?? "");
3284
+ function envOptional(name) {
3285
+ return optional(process.env[name] ?? "");
3679
3286
  }
3680
3287
  function readAll(ctx) {
3681
3288
  return ctx.str("all") === "true";
3682
3289
  }
3290
+ function hasWorkspaceScope(ctx, useConversationContext) {
3291
+ return Boolean(
3292
+ optional(ctx.str("workspaceId")) || currentAgentSpaceId() || useConversationContext && optional(ctx.str("conversationId"))
3293
+ );
3294
+ }
3683
3295
  function readTimeZone(ctx) {
3684
- return optional2(ctx.str("timeZone")) ?? DEFAULT_TIME_ZONE;
3296
+ return optional(ctx.str("timeZone")) ?? DEFAULT_TIME_ZONE;
3685
3297
  }
3686
3298
  function isValidTimeZone(timeZone) {
3687
3299
  try {
@@ -3712,17 +3324,23 @@ function formatTimestampInTimeZone(timestamp, timeZone) {
3712
3324
  function validateFind(ctx) {
3713
3325
  const rawAll = ctx.str("all");
3714
3326
  if (rawAll && rawAll !== "true" && rawAll !== "false") return;
3715
- const agentId = optional2(ctx.str("agentId"));
3327
+ const agentId = optional(ctx.str("agentId"));
3716
3328
  const all = readAll(ctx);
3717
- if (agentId && all) {
3718
- throw new Error("--agent-id and --all true cannot be used together");
3719
- }
3720
- if (!agentId && !all && !envOptional2("TE_AGENT_CURRENT_AGENT_ID")) {
3721
- throw new Error(
3722
- "Archive scope is required. Provide --agent-id or --all true, or run inside an Agent sandbox."
3723
- );
3329
+ if (hasWorkspaceScope(ctx, true)) {
3330
+ if (agentId || all) {
3331
+ throw new Error("Workspace archive scope cannot be combined with --agent-id or --all true");
3332
+ }
3333
+ } else {
3334
+ if (agentId && all) {
3335
+ throw new Error("--agent-id and --all true cannot be used together");
3336
+ }
3337
+ if (!agentId && !all && !envOptional("TE_AGENT_CURRENT_AGENT_ID")) {
3338
+ throw new Error(
3339
+ "Archive scope is required. Provide --agent-id or --all true, or run inside an Agent sandbox."
3340
+ );
3341
+ }
3724
3342
  }
3725
- const limit = optional2(ctx.str("limit")) ? ctx.num("limit") : DEFAULT_LIMIT;
3343
+ const limit = optional(ctx.str("limit")) ? ctx.num("limit") : DEFAULT_LIMIT;
3726
3344
  if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
3727
3345
  throw new Error("--limit must be an integer between 1 and 100");
3728
3346
  }
@@ -3730,13 +3348,21 @@ function validateFind(ctx) {
3730
3348
  throw new Error("--time-zone must be a valid IANA time zone");
3731
3349
  }
3732
3350
  }
3351
+ function buildWorkspaceArchiveSuffix(ctx) {
3352
+ const params = new URLSearchParams();
3353
+ const q = optional(ctx.str("q"));
3354
+ const limit = optional(ctx.str("limit")) ? ctx.num("limit") : DEFAULT_LIMIT;
3355
+ if (q) params.set("q", q);
3356
+ params.set("limit", String(limit));
3357
+ return `/conversations/archived?${params.toString()}`;
3358
+ }
3733
3359
  function buildArchivedConversationSearchPath(ctx) {
3734
3360
  const params = new URLSearchParams();
3735
- const q = optional2(ctx.str("q"));
3736
- const explicitAgentId = optional2(ctx.str("agentId"));
3361
+ const q = optional(ctx.str("q"));
3362
+ const explicitAgentId = optional(ctx.str("agentId"));
3737
3363
  const all = readAll(ctx);
3738
- const agentId = explicitAgentId ?? envOptional2("TE_AGENT_CURRENT_AGENT_ID");
3739
- const limit = optional2(ctx.str("limit")) ? ctx.num("limit") : DEFAULT_LIMIT;
3364
+ const agentId = explicitAgentId ?? envOptional("TE_AGENT_CURRENT_AGENT_ID");
3365
+ const limit = optional(ctx.str("limit")) ? ctx.num("limit") : DEFAULT_LIMIT;
3740
3366
  if (q) params.set("q", q);
3741
3367
  if (all) params.set("all", "true");
3742
3368
  else if (agentId) params.set("agentId", agentId);
@@ -3764,8 +3390,9 @@ function toArchivedConversationOutput(item, timeZone) {
3764
3390
  var findArchivedConversations = {
3765
3391
  service: "agent",
3766
3392
  command: "+find-archived-conversations",
3767
- description: "Find archived conversations for one Agent or all Agents",
3393
+ description: "Find archived conversations in an AgentSpace, one legacy Agent, or the legacy all-Agent scope",
3768
3394
  flags: [
3395
+ ...workspaceTargetFlags,
3769
3396
  {
3770
3397
  name: "q",
3771
3398
  type: "string",
@@ -3803,16 +3430,20 @@ var findArchivedConversations = {
3803
3430
  ],
3804
3431
  risk: "read",
3805
3432
  validate: validateFind,
3806
- dryRun: (ctx) => ({
3433
+ dryRun: (ctx) => hasWorkspaceScope(ctx, true) ? {
3807
3434
  method: "GET",
3808
- url: buildArchivedConversationSearchPath(ctx)
3809
- }),
3435
+ url: buildWorkspaceCliUrl(ctx, previewWorkspaceResourcePath(ctx, buildWorkspaceArchiveSuffix(ctx))),
3436
+ params: { target_url: buildWorkspaceCliUrl(ctx, workspaceTargetPath(ctx)) }
3437
+ } : { method: "GET", url: buildArchivedConversationSearchPath(ctx) },
3810
3438
  execute: async (ctx) => {
3811
3439
  const timeZone = readTimeZone(ctx);
3812
- const result = await getAgentApi(
3813
- ctx,
3814
- buildArchivedConversationSearchPath(ctx)
3815
- );
3440
+ const result = hasWorkspaceScope(ctx, true) ? await (async () => {
3441
+ const target = await resolveWorkspaceTarget(ctx);
3442
+ return getWorkspaceApi(
3443
+ ctx,
3444
+ workspaceResourcePath(target.agentSpaceId, buildWorkspaceArchiveSuffix(ctx))
3445
+ );
3446
+ })() : await getAgentApi(ctx, buildArchivedConversationSearchPath(ctx));
3816
3447
  return {
3817
3448
  items: result.items.map(
3818
3449
  (item) => toArchivedConversationOutput(item, timeZone)
@@ -3826,6 +3457,7 @@ var restoreConversation = {
3826
3457
  command: "+restore-conversation",
3827
3458
  description: "Restore an archived conversation by conversation ID",
3828
3459
  flags: [
3460
+ workspaceTargetFlags[0],
3829
3461
  {
3830
3462
  name: "conversation-id",
3831
3463
  type: "string",
@@ -3834,13 +3466,21 @@ var restoreConversation = {
3834
3466
  }
3835
3467
  ],
3836
3468
  risk: "write",
3837
- dryRun: (ctx) => ({
3469
+ dryRun: (ctx) => hasWorkspaceScope(ctx, false) ? {
3838
3470
  method: "POST",
3839
- url: `${CONVERSATION_PATH}/${encodeURIComponent(ctx.str("conversationId"))}/restore`,
3471
+ url: buildWorkspaceCliUrl(ctx, previewWorkspaceResourcePath(ctx, `/conversations/${encodeURIComponent(ctx.str("conversationId"))}/restore`)),
3472
+ params: { target_url: buildWorkspaceCliUrl(ctx, workspaceTargetPath(ctx)) },
3840
3473
  body: {}
3841
- }),
3474
+ } : { method: "POST", url: `${CONVERSATION_PATH}/${encodeURIComponent(ctx.str("conversationId"))}/restore`, body: {} },
3842
3475
  execute: async (ctx) => {
3843
- const result = await postAgentApi(
3476
+ const result = hasWorkspaceScope(ctx, false) ? await (async () => {
3477
+ const target = await resolveWorkspaceTarget(ctx);
3478
+ return postWorkspaceApi(
3479
+ ctx,
3480
+ workspaceResourcePath(target.agentSpaceId, `/conversations/${encodeURIComponent(ctx.str("conversationId"))}/restore`),
3481
+ {}
3482
+ );
3483
+ })() : await postAgentApi(
3844
3484
  ctx,
3845
3485
  `${CONVERSATION_PATH}/${encodeURIComponent(ctx.str("conversationId"))}/restore`,
3846
3486
  {}
@@ -4469,10 +4109,6 @@ var commands = [
4469
4109
  addAttachment,
4470
4110
  delAttachment,
4471
4111
  attachmentStats,
4472
- // Automate tasks
4473
- listAutomations,
4474
- createAutomation,
4475
- updateAutomation,
4476
4112
  // Archived conversations
4477
4113
  findArchivedConversations,
4478
4114
  restoreConversation,