@thinkingai/ae-cli 6.0.18 → 6.0.22

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 (110) hide show
  1. package/README.md +8 -10
  2. package/README.zh.md +9 -11
  3. package/dist/{auth-DYC2BGLM.js → auth-I2G7OAU2.js} +2 -4
  4. package/dist/{auth-GHBMJ5ZR.js → auth-RDN6D5HU.js} +32 -104
  5. package/dist/{chunk-5OC7CYCG.js → chunk-2W7HULUD.js} +14 -14
  6. package/dist/chunk-4EUZRJPO.js +163 -0
  7. package/dist/{chunk-DMMEPCST.js → chunk-5FBLRSMU.js} +25 -115
  8. package/dist/{chunk-BJX3GXWC.js → chunk-E34XH4GW.js} +2 -2
  9. package/dist/chunk-FPE5LGVU.js +105 -0
  10. package/dist/{chunk-I5CRVM2S.js → chunk-H52CSLJW.js} +44 -17
  11. package/dist/{chunk-RSHMZ3LG.js → chunk-U6QPKCN3.js} +6 -20
  12. package/dist/{chunk-6W4QOZAL.js → chunk-WPXHCP4A.js} +23 -13
  13. package/dist/{chunk-PN3OS34E.js → chunk-XE2PI5DS.js} +1 -1
  14. package/dist/{chunk-2DUEAXV3.js → chunk-YACCPUNQ.js} +1 -1
  15. package/dist/cli-token-6AGEDJF4.js +14 -0
  16. package/dist/{client-2UJ63MVQ.js → client-VTJMUZ4O.js} +3 -3
  17. package/dist/{config-NCUGK6NS.js → config-2SDTLGOC.js} +3 -3
  18. package/dist/index.js +314 -197
  19. package/dist/metadata-JZ2OTWBK.js +420 -0
  20. package/dist/{model-SJSOZTRS.js → model-ZYMRN4VS.js} +2 -2
  21. package/dist/{raw-7NVWSVJP.js → raw-NGYHAL3F.js} +4 -4
  22. package/dist/{sync-GRVO4K3U.js → sync-JVLX6TGW.js} +3 -3
  23. package/dist/{te-agent-KZRIEN4N.js → te-agent-QPZTLHPH.js} +545 -21
  24. package/dist/{te-analysis-VAR4KUOK.js → te-analysis-WWX3Z6RP.js} +352 -52
  25. package/dist/te-audience-UXGHUVBB.js +599 -0
  26. package/dist/{te-common-WNCZB7R7.js → te-common-7XXH73MF.js} +5 -4
  27. package/dist/{te-community-JEEFXPB3.js → te-community-QKE67HR2.js} +5 -4
  28. package/dist/te-dataops-6W7NNYST.js +1841 -0
  29. package/dist/{te-engage-4XHCTS6I.js → te-engage-NCFAQFX3.js} +5 -4
  30. package/dist/{te-kb-B62KFP2A.js → te-kb-K5BQYUCM.js} +50 -26
  31. package/dist/{te-meta-EPZGQN56.js → te-meta-LJZBOSMO.js} +48 -24
  32. package/dist/{te-team-YY24VORI.js → te-team-DHK5R7MV.js} +5 -6
  33. package/package.json +3 -2
  34. package/skills/ae-agent/SKILL.md +103 -4
  35. package/skills/ae-analysis/SKILL.md +75 -21
  36. package/skills/ae-analysis/references/build_attribution_analysis_qp.md +62 -0
  37. package/skills/ae-analysis/references/build_cluster_definition.md +62 -0
  38. package/skills/ae-analysis/references/build_distribution_analysis_qp.md +67 -0
  39. package/skills/ae-analysis/references/build_event_analysis_qp.md +2 -0
  40. package/skills/ae-analysis/references/build_funnel_analysis_qp.md +2 -0
  41. package/skills/ae-analysis/references/build_heat_map_analysis_qp.md +54 -0
  42. package/skills/ae-analysis/references/build_interval_analysis_qp.md +60 -0
  43. package/skills/ae-analysis/references/build_path_analysis_qp.md +53 -0
  44. package/skills/ae-analysis/references/build_prop_analysis_qp.md +2 -0
  45. package/skills/ae-analysis/references/build_rank_list_analysis_qp.md +63 -0
  46. package/skills/ae-analysis/references/build_retention_analysis_qp.md +2 -0
  47. package/skills/ae-analysis/references/build_tag_definition.md +65 -0
  48. package/skills/ae-analysis/references/cancel_query.md +2 -3
  49. package/skills/ae-analysis/references/copy_dashboard.md +33 -0
  50. package/skills/ae-analysis/references/create_id_cluster.md +40 -0
  51. package/skills/ae-analysis/references/create_id_tag.md +39 -0
  52. package/skills/ae-analysis/references/delete_alert.md +27 -0
  53. package/skills/ae-analysis/references/delete_cluster.md +27 -0
  54. package/skills/ae-analysis/references/delete_dashboard.md +30 -0
  55. package/skills/ae-analysis/references/delete_metric.md +27 -0
  56. package/skills/ae-analysis/references/delete_report.md +27 -0
  57. package/skills/ae-analysis/references/delete_tag.md +27 -0
  58. package/skills/ae-analysis/references/drilldown_user_events.md +4 -4
  59. package/skills/ae-analysis/references/drilldown_users.md +3 -3
  60. package/skills/ae-analysis/references/freeze_dashboards.md +29 -0
  61. package/skills/ae-analysis/references/get_table_columns.md +11 -12
  62. package/skills/ae-analysis/references/list_cluster_members.md +4 -4
  63. package/skills/ae-analysis/references/list_clusters.md +5 -3
  64. package/skills/ae-analysis/references/list_dashboards.md +3 -3
  65. package/skills/ae-analysis/references/list_entities.md +1 -1
  66. package/skills/ae-analysis/references/list_events.md +7 -4
  67. package/skills/ae-analysis/references/list_metrics.md +5 -3
  68. package/skills/ae-analysis/references/list_properties.md +6 -4
  69. package/skills/ae-analysis/references/list_reports.md +3 -3
  70. package/skills/ae-analysis/references/list_spaces.md +27 -0
  71. package/skills/ae-analysis/references/list_tag_members.md +4 -4
  72. package/skills/ae-analysis/references/list_tags.md +4 -2
  73. package/skills/ae-analysis/references/move_dashboard.md +33 -0
  74. package/skills/ae-analysis/references/query_adhoc.md +2 -2
  75. package/skills/ae-analysis/references/query_bi_panel_data.md +2 -2
  76. package/skills/ae-analysis/references/query_dashboard_report_data.md +4 -4
  77. package/skills/ae-analysis/references/query_entity_details.md +4 -4
  78. package/skills/ae-analysis/references/query_event_details.md +3 -3
  79. package/skills/ae-analysis/references/query_report_data.md +37 -3
  80. package/skills/ae-analysis/references/update_id_cluster.md +36 -0
  81. package/skills/ae-analysis/references/update_id_tag.md +37 -0
  82. package/skills/ae-analysis/references/update_report.md +35 -0
  83. package/skills/ae-analysis-intent/SKILL.md +1 -1
  84. package/skills/ae-dataops/SKILL.md +54 -522
  85. package/skills/ae-dataops/references/dataops-flow-create.md +78 -75
  86. package/skills/ae-dataops/references/dataops-flow-monitor.md +58 -51
  87. package/skills/ae-dataops/references/dataops-integration.md +80 -41
  88. package/skills/ae-dataops/references/dataops-query.md +54 -53
  89. package/skills/ae-dataops/references/dataops-table.md +28 -59
  90. package/skills/ae-generate-tracking-code/SKILL.md +68 -31
  91. package/skills/ae-generate-tracking-code/references/snippet-delivery.md +26 -1
  92. package/skills/ae-generate-tracking-code/references/te-api.md +47 -164
  93. package/skills/ae-generate-tracking-plan/SKILL.md +109 -32
  94. package/skills/ae-generate-tracking-plan/references/te-api.md +57 -27
  95. package/skills/ae-metadata/SKILL.md +90 -0
  96. package/skills/ae-metadata/references/metadata_data_table_csv_delete.md +15 -0
  97. package/skills/ae-metadata/references/metadata_data_table_csv_write.md +29 -0
  98. package/skills/ae-metadata/references/metadata_data_table_download.md +17 -0
  99. package/skills/ae-metadata/references/metadata_data_table_get.md +24 -0
  100. package/skills/ae-metadata/references/metadata_data_table_list.md +27 -0
  101. package/skills/ae-metadata/references/metadata_data_table_property_bindings_update.md +17 -0
  102. package/skills/ae-metadata/references/metadata_data_table_sql_delete.md +15 -0
  103. package/skills/ae-metadata/references/metadata_data_table_sql_write.md +31 -0
  104. package/skills/ae-metadata/references/metadata_event_get.md +52 -0
  105. package/skills/ae-metadata/references/metadata_input_file_upload.md +29 -0
  106. package/skills/ae-metadata/references/metadata_property_dimension_table_bind_existing.md +27 -0
  107. package/skills/ae-metadata/references/metadata_property_dimension_table_create_and_bind_csv.md +30 -0
  108. package/skills/ae-metadata/references/metadata_property_get.md +54 -0
  109. package/dist/te-audience-KMKYI2YJ.js +0 -400
  110. package/dist/te-dataops-GD3XBYCS.js +0 -1830
@@ -4,8 +4,8 @@ import {
4
4
  patchToMainApp,
5
5
  postToMainApp,
6
6
  uploadToMainApp
7
- } from "./chunk-I5CRVM2S.js";
8
- import "./chunk-6W4QOZAL.js";
7
+ } from "./chunk-H52CSLJW.js";
8
+ import "./chunk-WPXHCP4A.js";
9
9
 
10
10
  // src/commands/te-agent/agents.ts
11
11
  var BASE_PATH = "/api/sandbox/agent/agents";
@@ -210,8 +210,52 @@ var toggleModel = {
210
210
  }
211
211
  };
212
212
 
213
+ // src/commands/te-agent/market-constants.ts
214
+ var MARKET_CATEGORIES = [
215
+ "ae_preset",
216
+ "dev_tool",
217
+ "search_tool",
218
+ "data_query",
219
+ "content_gen",
220
+ "enterprise",
221
+ "life",
222
+ "automation",
223
+ "other"
224
+ ];
225
+ var MARKET_SCOPES = ["all", "system", "company", "custom"];
226
+ var MARKET_SORTS = ["newest", "calls", "likes"];
227
+ var SUBMISSION_STATUSES = ["pending", "approved", "rejected", "cancelled"];
228
+ var SHARE_DIRECTIONS = ["received", "sent"];
229
+ var SHARE_STATUSES = ["pending", "accepted", "rejected"];
230
+ function isValidMarketCategory(key) {
231
+ return !!key && MARKET_CATEGORIES.includes(key);
232
+ }
233
+ function buildMarketQuery(ctx) {
234
+ const params = new URLSearchParams();
235
+ params.set("scope", ctx.str("scope") || "all");
236
+ const category = ctx.str("category");
237
+ if (category) params.set("category", category);
238
+ const search = ctx.str("search");
239
+ if (search) params.set("search", search);
240
+ params.set("sort", ctx.str("sort") || "newest");
241
+ params.set("limit", String(ctx.num("limit") || 50));
242
+ params.set("offset", String(ctx.num("offset") || 0));
243
+ return params;
244
+ }
245
+
213
246
  // src/commands/te-agent/mcps.ts
214
247
  var BASE_PATH3 = "/api/sandbox/agent/mcp-servers";
248
+ var MARKET_BASE_PATH = "/api/mcp-servers";
249
+ function buildMetaBody(ctx) {
250
+ const body = {};
251
+ const category = ctx.str("category");
252
+ const iconEmoji = ctx.str("iconEmoji");
253
+ const iconColor = ctx.str("iconColor");
254
+ if (category) body.category = category;
255
+ if (iconEmoji) body.iconEmoji = iconEmoji;
256
+ if (iconColor) body.iconColor = iconColor;
257
+ return Object.keys(body).length > 0 ? body : null;
258
+ }
215
259
  var listMcps = {
216
260
  service: "agent",
217
261
  command: "+list-mcps",
@@ -247,7 +291,10 @@ var addMcp = {
247
291
  { name: "display-name", type: "string", required: false, desc: "Display name (max 100)" },
248
292
  { name: "description", type: "string", required: false, desc: "Description (max 255)" },
249
293
  { name: "transport", type: "string", required: false, default: "http", desc: "Transport: sse | http" },
250
- { name: "headers", type: "json", required: false, desc: "HTTP headers as JSON object" }
294
+ { name: "headers", type: "json", required: false, desc: "HTTP headers as JSON object" },
295
+ { name: "category", type: "string", required: false, desc: `Market category key: ${MARKET_CATEGORIES.join(" | ")}` },
296
+ { name: "icon-emoji", type: "string", required: false, desc: "Market icon emoji (e.g. robot)" },
297
+ { name: "icon-color", type: "string", required: false, desc: "Market icon color (e.g. #1E76F0)" }
251
298
  ],
252
299
  risk: "write",
253
300
  validate: (ctx) => {
@@ -270,21 +317,26 @@ var addMcp = {
270
317
  if (transport && !["sse", "http"].includes(transport)) {
271
318
  throw new Error("--transport must be sse or http");
272
319
  }
320
+ const category = ctx.str("category");
321
+ if (category && !isValidMarketCategory(category)) {
322
+ throw new Error(`--category must be one of: ${MARKET_CATEGORIES.join(", ")}`);
323
+ }
273
324
  },
274
- dryRun: (ctx) => ({
275
- method: "POST",
276
- url: BASE_PATH3,
277
- body: {
325
+ dryRun: (ctx) => {
326
+ const body = {
278
327
  name: ctx.str("name"),
279
328
  url: ctx.str("url"),
280
329
  displayName: ctx.str("displayName") || void 0,
281
330
  description: ctx.str("description") || void 0,
282
331
  transport: ctx.str("transport") || "http",
283
332
  headers: ctx.json("headers") || void 0
284
- }
285
- }),
333
+ };
334
+ const meta = buildMetaBody(ctx);
335
+ if (meta) body._meta = meta;
336
+ return { method: "POST", url: BASE_PATH3, body };
337
+ },
286
338
  execute: async (ctx) => {
287
- return postToMainApp(BASE_PATH3, {
339
+ const created = await postToMainApp(BASE_PATH3, {
288
340
  name: ctx.str("name"),
289
341
  url: ctx.str("url"),
290
342
  displayName: ctx.str("displayName") || void 0,
@@ -292,6 +344,17 @@ var addMcp = {
292
344
  transport: ctx.str("transport") || "http",
293
345
  headers: ctx.json("headers") || void 0
294
346
  });
347
+ const id = created?.item?.id;
348
+ const meta = buildMetaBody(ctx);
349
+ if (id && meta) {
350
+ try {
351
+ await patchToMainApp(`${MARKET_BASE_PATH}/${encodeURIComponent(id)}/meta`, meta);
352
+ } catch (err) {
353
+ process.stderr.write(`Warning: MCP created but meta update failed: ${err?.message ?? err}
354
+ `);
355
+ }
356
+ }
357
+ return created;
295
358
  }
296
359
  };
297
360
  var delMcp = {
@@ -331,9 +394,87 @@ var toggleMcp = {
331
394
  });
332
395
  }
333
396
  };
397
+ var listMcpMarket = {
398
+ service: "agent",
399
+ command: "+list-mcp-market",
400
+ description: "List MCP servers from the market (system/company/personal)",
401
+ flags: [
402
+ { name: "scope", type: "string", required: false, default: "all", desc: `Market scope: ${MARKET_SCOPES.join(" | ")} (custom = personal)` },
403
+ { name: "category", type: "string", required: false, desc: `Category key: ${MARKET_CATEGORIES.join(" | ")}` },
404
+ { name: "search", type: "string", required: false, desc: "Fuzzy search on name/displayName/description/url" },
405
+ { name: "sort", type: "string", required: false, default: "newest", desc: `Sort: ${MARKET_SORTS.join(" | ")}` },
406
+ { name: "limit", type: "number", required: false, default: 50, desc: "Page size (1-100, default 50)" },
407
+ { name: "offset", type: "number", required: false, default: 0, desc: "Page offset (>=0, default 0)" }
408
+ ],
409
+ risk: "read",
410
+ validate: (ctx) => {
411
+ const scope = ctx.str("scope");
412
+ if (scope && !MARKET_SCOPES.includes(scope)) {
413
+ throw new Error(`--scope must be one of: ${MARKET_SCOPES.join(", ")}`);
414
+ }
415
+ const category = ctx.str("category");
416
+ if (category && !isValidMarketCategory(category)) {
417
+ throw new Error(`--category must be one of: ${MARKET_CATEGORIES.join(", ")}`);
418
+ }
419
+ const sort = ctx.str("sort");
420
+ if (sort && !MARKET_SORTS.includes(sort)) {
421
+ throw new Error(`--sort must be one of: ${MARKET_SORTS.join(", ")}`);
422
+ }
423
+ },
424
+ dryRun: (ctx) => ({
425
+ method: "GET",
426
+ url: `${MARKET_BASE_PATH}/market?${buildMarketQuery(ctx).toString()}`
427
+ }),
428
+ execute: async (ctx) => {
429
+ return getFromMainApp(`${MARKET_BASE_PATH}/market?${buildMarketQuery(ctx).toString()}`);
430
+ }
431
+ };
432
+ var setMcpMeta = {
433
+ service: "agent",
434
+ command: "+set-mcp-meta",
435
+ description: "Update an MCP server market meta (category / icon). Company scope requires root; system is read-only.",
436
+ flags: [
437
+ { name: "id", type: "string", required: true, desc: "MCP server record ID (CUID)" },
438
+ { name: "category", type: "string", required: false, desc: `Category key: ${MARKET_CATEGORIES.join(" | ")}` },
439
+ { name: "icon-emoji", type: "string", required: false, desc: "Market icon emoji (e.g. robot)" },
440
+ { name: "icon-color", type: "string", required: false, desc: "Market icon color (e.g. #1E76F0)" }
441
+ ],
442
+ risk: "write",
443
+ validate: (ctx) => {
444
+ const category = ctx.str("category");
445
+ if (category && !isValidMarketCategory(category)) {
446
+ throw new Error(`--category must be one of: ${MARKET_CATEGORIES.join(", ")}`);
447
+ }
448
+ if (!buildMetaBody(ctx)) {
449
+ throw new Error("Provide at least one of --category / --icon-emoji / --icon-color");
450
+ }
451
+ },
452
+ dryRun: (ctx) => ({
453
+ method: "PATCH",
454
+ url: `${MARKET_BASE_PATH}/${encodeURIComponent(ctx.str("id"))}/meta`,
455
+ body: buildMetaBody(ctx)
456
+ }),
457
+ execute: async (ctx) => {
458
+ return patchToMainApp(
459
+ `${MARKET_BASE_PATH}/${encodeURIComponent(ctx.str("id"))}/meta`,
460
+ buildMetaBody(ctx)
461
+ );
462
+ }
463
+ };
334
464
 
335
465
  // src/commands/te-agent/skills.ts
336
466
  var BASE_PATH4 = "/api/sandbox/agent/skills";
467
+ var MARKET_BASE_PATH2 = "/api/skills";
468
+ function buildMetaBody2(ctx) {
469
+ const body = {};
470
+ const category = ctx.str("category");
471
+ const iconEmoji = ctx.str("iconEmoji");
472
+ const iconColor = ctx.str("iconColor");
473
+ if (category) body.category = category;
474
+ if (iconEmoji) body.iconEmoji = iconEmoji;
475
+ if (iconColor) body.iconColor = iconColor;
476
+ return Object.keys(body).length > 0 ? body : null;
477
+ }
337
478
  async function resolveInstructions(raw) {
338
479
  if (raw === "@-") {
339
480
  const chunks = [];
@@ -379,7 +520,10 @@ var addSkill = {
379
520
  { name: "name", type: "string", required: true, desc: "Skill name (1-80 chars)" },
380
521
  { name: "description", type: "string", required: true, desc: "Skill description" },
381
522
  { name: "instructions", type: "string", required: true, desc: "Skill instructions (use @- to read from stdin)" },
382
- { name: "display-name", type: "string", required: false, desc: "Display name (max 100)" }
523
+ { name: "display-name", type: "string", required: false, desc: "Display name (max 100)" },
524
+ { name: "category", type: "string", required: false, desc: `Market category key: ${MARKET_CATEGORIES.join(" | ")}` },
525
+ { name: "icon-emoji", type: "string", required: false, desc: "Market icon emoji (e.g. robot)" },
526
+ { name: "icon-color", type: "string", required: false, desc: "Market icon color (e.g. #1E76F0)" }
383
527
  ],
384
528
  risk: "write",
385
529
  validate: (ctx) => {
@@ -387,25 +531,41 @@ var addSkill = {
387
531
  if (name.length < 1 || name.length > 80) {
388
532
  throw new Error("--name length must be between 1 and 80");
389
533
  }
534
+ const category = ctx.str("category");
535
+ if (category && !isValidMarketCategory(category)) {
536
+ throw new Error(`--category must be one of: ${MARKET_CATEGORIES.join(", ")}`);
537
+ }
390
538
  },
391
- dryRun: (ctx) => ({
392
- method: "POST",
393
- url: BASE_PATH4,
394
- body: {
539
+ dryRun: (ctx) => {
540
+ const body = {
395
541
  name: ctx.str("name"),
396
542
  description: ctx.str("description"),
397
543
  instructions: ctx.str("instructions") === "@-" ? "(from stdin)" : ctx.str("instructions"),
398
544
  displayName: ctx.str("displayName") || void 0
399
- }
400
- }),
545
+ };
546
+ const meta = buildMetaBody2(ctx);
547
+ if (meta) body._meta = meta;
548
+ return { method: "POST", url: BASE_PATH4, body };
549
+ },
401
550
  execute: async (ctx) => {
402
551
  const instructions = await resolveInstructions(ctx.str("instructions"));
403
- return postToMainApp(BASE_PATH4, {
552
+ const created = await postToMainApp(BASE_PATH4, {
404
553
  name: ctx.str("name"),
405
554
  description: ctx.str("description"),
406
555
  instructions,
407
556
  displayName: ctx.str("displayName") || void 0
408
557
  });
558
+ const id = created?.item?.id;
559
+ const meta = buildMetaBody2(ctx);
560
+ if (id && meta) {
561
+ try {
562
+ await patchToMainApp(`${MARKET_BASE_PATH2}/${encodeURIComponent(id)}/meta`, meta);
563
+ } catch (err) {
564
+ process.stderr.write(`Warning: Skill created but meta update failed: ${err?.message ?? err}
565
+ `);
566
+ }
567
+ }
568
+ return created;
409
569
  }
410
570
  };
411
571
  var delSkill = {
@@ -445,6 +605,354 @@ var toggleSkill = {
445
605
  });
446
606
  }
447
607
  };
608
+ var listSkillMarket = {
609
+ service: "agent",
610
+ command: "+list-skill-market",
611
+ description: "List Skills from the market (only approved items; system/company/personal)",
612
+ flags: [
613
+ { name: "scope", type: "string", required: false, default: "all", desc: `Market scope: ${MARKET_SCOPES.join(" | ")} (custom = personal)` },
614
+ { name: "category", type: "string", required: false, desc: `Category key: ${MARKET_CATEGORIES.join(" | ")}` },
615
+ { name: "search", type: "string", required: false, desc: "Fuzzy search on name/displayName/description" },
616
+ { name: "sort", type: "string", required: false, default: "newest", desc: `Sort: ${MARKET_SORTS.join(" | ")} (calls = downloads)` },
617
+ { name: "limit", type: "number", required: false, default: 50, desc: "Page size (1-100, default 50)" },
618
+ { name: "offset", type: "number", required: false, default: 0, desc: "Page offset (>=0, default 0)" }
619
+ ],
620
+ risk: "read",
621
+ validate: (ctx) => {
622
+ const scope = ctx.str("scope");
623
+ if (scope && !MARKET_SCOPES.includes(scope)) {
624
+ throw new Error(`--scope must be one of: ${MARKET_SCOPES.join(", ")}`);
625
+ }
626
+ const category = ctx.str("category");
627
+ if (category && !isValidMarketCategory(category)) {
628
+ throw new Error(`--category must be one of: ${MARKET_CATEGORIES.join(", ")}`);
629
+ }
630
+ const sort = ctx.str("sort");
631
+ if (sort && !MARKET_SORTS.includes(sort)) {
632
+ throw new Error(`--sort must be one of: ${MARKET_SORTS.join(", ")}`);
633
+ }
634
+ },
635
+ dryRun: (ctx) => ({
636
+ method: "GET",
637
+ url: `${MARKET_BASE_PATH2}/market?${buildMarketQuery(ctx).toString()}`
638
+ }),
639
+ execute: async (ctx) => {
640
+ return getFromMainApp(`${MARKET_BASE_PATH2}/market?${buildMarketQuery(ctx).toString()}`);
641
+ }
642
+ };
643
+ var setSkillMeta = {
644
+ service: "agent",
645
+ command: "+set-skill-meta",
646
+ description: "Update a Skill market meta (category / icon). Company scope requires root; system is read-only.",
647
+ flags: [
648
+ { name: "id", type: "string", required: true, desc: "Skill record ID (CUID)" },
649
+ { name: "category", type: "string", required: false, desc: `Category key: ${MARKET_CATEGORIES.join(" | ")}` },
650
+ { name: "icon-emoji", type: "string", required: false, desc: "Market icon emoji (e.g. robot)" },
651
+ { name: "icon-color", type: "string", required: false, desc: "Market icon color (e.g. #1E76F0)" }
652
+ ],
653
+ risk: "write",
654
+ validate: (ctx) => {
655
+ const category = ctx.str("category");
656
+ if (category && !isValidMarketCategory(category)) {
657
+ throw new Error(`--category must be one of: ${MARKET_CATEGORIES.join(", ")}`);
658
+ }
659
+ if (!buildMetaBody2(ctx)) {
660
+ throw new Error("Provide at least one of --category / --icon-emoji / --icon-color");
661
+ }
662
+ },
663
+ dryRun: (ctx) => ({
664
+ method: "PATCH",
665
+ url: `${MARKET_BASE_PATH2}/${encodeURIComponent(ctx.str("id"))}/meta`,
666
+ body: buildMetaBody2(ctx)
667
+ }),
668
+ execute: async (ctx) => {
669
+ return patchToMainApp(
670
+ `${MARKET_BASE_PATH2}/${encodeURIComponent(ctx.str("id"))}/meta`,
671
+ buildMetaBody2(ctx)
672
+ );
673
+ }
674
+ };
675
+ var copySkill = {
676
+ service: "agent",
677
+ command: "+copy-skill",
678
+ description: "Copy a system/company Skill to a personal copy (independent duplicate)",
679
+ flags: [
680
+ { name: "id", type: "string", required: true, desc: "Source Skill record ID (CUID, system or company scope)" },
681
+ { name: "category", type: "string", required: false, desc: `Market category key for the copy: ${MARKET_CATEGORIES.join(" | ")}` },
682
+ { name: "icon-emoji", type: "string", required: false, desc: "Override market icon emoji (e.g. robot)" },
683
+ { name: "icon-color", type: "string", required: false, desc: "Override market icon color (e.g. #1E76F0)" }
684
+ ],
685
+ risk: "write",
686
+ validate: (ctx) => {
687
+ const category = ctx.str("category");
688
+ if (category && !isValidMarketCategory(category)) {
689
+ throw new Error(`--category must be one of: ${MARKET_CATEGORIES.join(", ")}`);
690
+ }
691
+ },
692
+ dryRun: (ctx) => ({
693
+ method: "POST",
694
+ url: `${MARKET_BASE_PATH2}/${encodeURIComponent(ctx.str("id"))}/copy`,
695
+ body: buildMetaBody2(ctx) ?? {}
696
+ }),
697
+ execute: async (ctx) => {
698
+ return postToMainApp(
699
+ `${MARKET_BASE_PATH2}/${encodeURIComponent(ctx.str("id"))}/copy`,
700
+ buildMetaBody2(ctx) ?? {}
701
+ );
702
+ }
703
+ };
704
+
705
+ // src/commands/te-agent/skill-approvals.ts
706
+ var BASE = "/api/skills";
707
+ var submitSkill = {
708
+ service: "agent",
709
+ command: "+submit-skill",
710
+ description: "Submit a personal Skill for company-scope approval review",
711
+ flags: [
712
+ { name: "id", type: "string", required: true, desc: "Skill record ID (CUID, personal scope)" },
713
+ { name: "description", type: "string", required: true, desc: "Submission reason / description (1-80 chars)" },
714
+ { name: "category", type: "string", required: false, desc: `Market category key: ${MARKET_CATEGORIES.join(" | ")}` },
715
+ { name: "icon-emoji", type: "string", required: false, desc: "Market icon emoji (e.g. robot)" },
716
+ { name: "icon-color", type: "string", required: false, desc: "Market icon color (e.g. #1E76F0)" }
717
+ ],
718
+ risk: "write",
719
+ validate: (ctx) => {
720
+ const description = ctx.str("description");
721
+ if (description.length < 1 || description.length > 80) {
722
+ throw new Error("--description length must be between 1 and 80");
723
+ }
724
+ const category = ctx.str("category");
725
+ if (category && !isValidMarketCategory(category)) {
726
+ throw new Error(`--category must be one of: ${MARKET_CATEGORIES.join(", ")}`);
727
+ }
728
+ },
729
+ dryRun: (ctx) => {
730
+ const body = { description: ctx.str("description") };
731
+ const category = ctx.str("category");
732
+ if (category) body.category = category;
733
+ const iconEmoji = ctx.str("iconEmoji");
734
+ if (iconEmoji) body.iconEmoji = iconEmoji;
735
+ const iconColor = ctx.str("iconColor");
736
+ if (iconColor) body.iconColor = iconColor;
737
+ return {
738
+ method: "POST",
739
+ url: `${BASE}/${encodeURIComponent(ctx.str("id"))}/submit`,
740
+ body
741
+ };
742
+ },
743
+ execute: async (ctx) => {
744
+ const body = { description: ctx.str("description") };
745
+ const category = ctx.str("category");
746
+ if (category) body.category = category;
747
+ const iconEmoji = ctx.str("iconEmoji");
748
+ if (iconEmoji) body.iconEmoji = iconEmoji;
749
+ const iconColor = ctx.str("iconColor");
750
+ if (iconColor) body.iconColor = iconColor;
751
+ return postToMainApp(`${BASE}/${encodeURIComponent(ctx.str("id"))}/submit`, body);
752
+ }
753
+ };
754
+ var listSkillSubmissions = {
755
+ service: "agent",
756
+ command: "+list-skill-submissions",
757
+ description: "List Skill submissions (approvals). Root sees all company submissions; others see only their own.",
758
+ flags: [
759
+ { name: "status", type: "string", required: false, desc: `Filter by status: ${SUBMISSION_STATUSES.join(" | ")}` },
760
+ { name: "mine", type: "boolean", required: false, desc: "Only show submissions created by the current user (root only)" }
761
+ ],
762
+ risk: "read",
763
+ validate: (ctx) => {
764
+ const status = ctx.str("status");
765
+ if (status && !SUBMISSION_STATUSES.includes(status)) {
766
+ throw new Error(`--status must be one of: ${SUBMISSION_STATUSES.join(", ")}`);
767
+ }
768
+ },
769
+ dryRun: (ctx) => {
770
+ const params = new URLSearchParams();
771
+ const status = ctx.str("status");
772
+ if (status) params.set("status", status);
773
+ if (ctx.bool("mine")) params.set("mine", "true");
774
+ const qs = params.toString();
775
+ return { method: "GET", url: `${BASE}/submissions${qs ? `?${qs}` : ""}` };
776
+ },
777
+ execute: async (ctx) => {
778
+ const params = new URLSearchParams();
779
+ const status = ctx.str("status");
780
+ if (status) params.set("status", status);
781
+ if (ctx.bool("mine")) params.set("mine", "true");
782
+ const qs = params.toString();
783
+ return getFromMainApp(`${BASE}/submissions${qs ? `?${qs}` : ""}`);
784
+ }
785
+ };
786
+ var cancelSkillSubmission = {
787
+ service: "agent",
788
+ command: "+cancel-skill-submission",
789
+ description: "Cancel a pending Skill submission (submitter or root)",
790
+ flags: [
791
+ { name: "id", type: "string", required: true, desc: "Submission record ID (CUID)" }
792
+ ],
793
+ risk: "write",
794
+ dryRun: (ctx) => ({
795
+ method: "POST",
796
+ url: `${BASE}/submissions/${encodeURIComponent(ctx.str("id"))}/cancel`
797
+ }),
798
+ execute: async (ctx) => {
799
+ return postToMainApp(`${BASE}/submissions/${encodeURIComponent(ctx.str("id"))}/cancel`, {});
800
+ }
801
+ };
802
+ var approveSkill = {
803
+ service: "agent",
804
+ command: "+approve-skill",
805
+ description: "Approve a pending Skill submission (root only). Creates a company-scope copy.",
806
+ flags: [
807
+ { name: "id", type: "string", required: true, desc: "Submission record ID (CUID)" }
808
+ ],
809
+ risk: "write",
810
+ dryRun: (ctx) => ({
811
+ method: "POST",
812
+ url: `${BASE}/submissions/${encodeURIComponent(ctx.str("id"))}/approve`
813
+ }),
814
+ execute: async (ctx) => {
815
+ return postToMainApp(`${BASE}/submissions/${encodeURIComponent(ctx.str("id"))}/approve`, {});
816
+ }
817
+ };
818
+ var rejectSkill = {
819
+ service: "agent",
820
+ command: "+reject-skill",
821
+ description: "Reject a pending Skill submission with a reason (root only).",
822
+ flags: [
823
+ { name: "id", type: "string", required: true, desc: "Submission record ID (CUID)" },
824
+ { name: "reason", type: "string", required: true, desc: "Rejection reason (1-80 chars)" }
825
+ ],
826
+ risk: "write",
827
+ validate: (ctx) => {
828
+ const reason = ctx.str("reason");
829
+ if (reason.length < 1 || reason.length > 80) {
830
+ throw new Error("--reason length must be between 1 and 80");
831
+ }
832
+ },
833
+ dryRun: (ctx) => ({
834
+ method: "POST",
835
+ url: `${BASE}/submissions/${encodeURIComponent(ctx.str("id"))}/reject`,
836
+ body: { reason: ctx.str("reason") }
837
+ }),
838
+ execute: async (ctx) => {
839
+ return postToMainApp(`${BASE}/submissions/${encodeURIComponent(ctx.str("id"))}/reject`, {
840
+ reason: ctx.str("reason")
841
+ });
842
+ }
843
+ };
844
+
845
+ // src/commands/te-agent/skill-shares.ts
846
+ var BASE2 = "/api/skills";
847
+ var shareSkill = {
848
+ service: "agent",
849
+ command: "+share-skill",
850
+ description: "Share a personal Skill to another user in the same company",
851
+ flags: [
852
+ { name: "id", type: "string", required: true, desc: "Skill record ID (CUID, personal scope)" },
853
+ { name: "to-user-id", type: "string", required: true, desc: "Recipient user ID (same company)" },
854
+ { name: "category", type: "string", required: false, desc: `Market category key: ${MARKET_CATEGORIES.join(" | ")}` },
855
+ { name: "icon-emoji", type: "string", required: false, desc: "Market icon emoji (e.g. robot)" },
856
+ { name: "icon-color", type: "string", required: false, desc: "Market icon color (e.g. #1E76F0)" }
857
+ ],
858
+ risk: "write",
859
+ validate: (ctx) => {
860
+ const category = ctx.str("category");
861
+ if (category && !isValidMarketCategory(category)) {
862
+ throw new Error(`--category must be one of: ${MARKET_CATEGORIES.join(", ")}`);
863
+ }
864
+ },
865
+ dryRun: (ctx) => {
866
+ const body = { toUserId: ctx.str("toUserId") };
867
+ const category = ctx.str("category");
868
+ if (category) body.category = category;
869
+ const iconEmoji = ctx.str("iconEmoji");
870
+ if (iconEmoji) body.iconEmoji = iconEmoji;
871
+ const iconColor = ctx.str("iconColor");
872
+ if (iconColor) body.iconColor = iconColor;
873
+ return {
874
+ method: "POST",
875
+ url: `${BASE2}/${encodeURIComponent(ctx.str("id"))}/share`,
876
+ body
877
+ };
878
+ },
879
+ execute: async (ctx) => {
880
+ const body = { toUserId: ctx.str("toUserId") };
881
+ const category = ctx.str("category");
882
+ if (category) body.category = category;
883
+ const iconEmoji = ctx.str("iconEmoji");
884
+ if (iconEmoji) body.iconEmoji = iconEmoji;
885
+ const iconColor = ctx.str("iconColor");
886
+ if (iconColor) body.iconColor = iconColor;
887
+ return postToMainApp(`${BASE2}/${encodeURIComponent(ctx.str("id"))}/share`, body);
888
+ }
889
+ };
890
+ var listSkillShares = {
891
+ service: "agent",
892
+ command: "+list-skill-shares",
893
+ description: "List Skill shares (received by default; use --direction sent for outgoing)",
894
+ flags: [
895
+ { name: "direction", type: "string", required: false, default: "received", desc: `Direction: ${SHARE_DIRECTIONS.join(" | ")}` },
896
+ { name: "status", type: "string", required: false, desc: `Filter by status: ${SHARE_STATUSES.join(" | ")}` }
897
+ ],
898
+ risk: "read",
899
+ validate: (ctx) => {
900
+ const direction = ctx.str("direction");
901
+ if (direction && !SHARE_DIRECTIONS.includes(direction)) {
902
+ throw new Error(`--direction must be one of: ${SHARE_DIRECTIONS.join(", ")}`);
903
+ }
904
+ const status = ctx.str("status");
905
+ if (status && !SHARE_STATUSES.includes(status)) {
906
+ throw new Error(`--status must be one of: ${SHARE_STATUSES.join(", ")}`);
907
+ }
908
+ },
909
+ dryRun: (ctx) => {
910
+ const params = new URLSearchParams();
911
+ params.set("direction", ctx.str("direction") || "received");
912
+ const status = ctx.str("status");
913
+ if (status) params.set("status", status);
914
+ return { method: "GET", url: `${BASE2}/shares?${params.toString()}` };
915
+ },
916
+ execute: async (ctx) => {
917
+ const params = new URLSearchParams();
918
+ params.set("direction", ctx.str("direction") || "received");
919
+ const status = ctx.str("status");
920
+ if (status) params.set("status", status);
921
+ return getFromMainApp(`${BASE2}/shares?${params.toString()}`);
922
+ }
923
+ };
924
+ var acceptSkillShare = {
925
+ service: "agent",
926
+ command: "+accept-skill-share",
927
+ description: "Accept a received Skill share (creates a personal copy for the recipient)",
928
+ flags: [
929
+ { name: "id", type: "string", required: true, desc: "Share record ID (CUID)" }
930
+ ],
931
+ risk: "write",
932
+ dryRun: (ctx) => ({
933
+ method: "POST",
934
+ url: `${BASE2}/shares/${encodeURIComponent(ctx.str("id"))}/accept`
935
+ }),
936
+ execute: async (ctx) => {
937
+ return postToMainApp(`${BASE2}/shares/${encodeURIComponent(ctx.str("id"))}/accept`, {});
938
+ }
939
+ };
940
+ var rejectSkillShare = {
941
+ service: "agent",
942
+ command: "+reject-skill-share",
943
+ description: "Reject a received Skill share",
944
+ flags: [
945
+ { name: "id", type: "string", required: true, desc: "Share record ID (CUID)" }
946
+ ],
947
+ risk: "write",
948
+ dryRun: (ctx) => ({
949
+ method: "POST",
950
+ url: `${BASE2}/shares/${encodeURIComponent(ctx.str("id"))}/reject`
951
+ }),
952
+ execute: async (ctx) => {
953
+ return postToMainApp(`${BASE2}/shares/${encodeURIComponent(ctx.str("id"))}/reject`, {});
954
+ }
955
+ };
448
956
 
449
957
  // src/commands/te-agent/attachments.ts
450
958
  import { readFileSync, existsSync } from "fs";
@@ -913,23 +1421,39 @@ var updateAutomation = {
913
1421
 
914
1422
  // src/commands/te-agent/index.ts
915
1423
  var commands = [
916
- // Agent 查询
1424
+ // Agent query
917
1425
  listAgents,
918
1426
  // Model management
919
1427
  listModels,
920
1428
  addModel,
921
1429
  delModel,
922
1430
  toggleModel,
923
- // MCP server management
1431
+ // MCP server management + market
924
1432
  listMcps,
925
1433
  addMcp,
926
1434
  delMcp,
927
1435
  toggleMcp,
928
- // Skill management
1436
+ listMcpMarket,
1437
+ setMcpMeta,
1438
+ // Skill management + market + copy
929
1439
  listSkills,
930
1440
  addSkill,
931
1441
  delSkill,
932
1442
  toggleSkill,
1443
+ listSkillMarket,
1444
+ setSkillMeta,
1445
+ copySkill,
1446
+ // Skill approval (company-scope publish)
1447
+ submitSkill,
1448
+ listSkillSubmissions,
1449
+ cancelSkillSubmission,
1450
+ approveSkill,
1451
+ rejectSkill,
1452
+ // Skill share (peer-to-peer)
1453
+ shareSkill,
1454
+ listSkillShares,
1455
+ acceptSkillShare,
1456
+ rejectSkillShare,
933
1457
  // Attachment library management
934
1458
  listAttachments,
935
1459
  addAttachment,