@thinkingai/ae-cli 6.1.18 → 6.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +97 -38
  2. package/README.zh.md +101 -38
  3. package/dist/{auth-ROB2EDYV.js → auth-FUM37MHF.js} +241 -126
  4. package/dist/{capability-DKMYUTLC.js → capability-AXFQW5WM.js} +49 -35
  5. package/dist/{chunk-JHENBQ5B.js → chunk-4P355ZWB.js} +70 -1
  6. package/dist/chunk-6ZIQV5GW.js +26 -0
  7. package/dist/{chunk-TUKQZTMI.js → chunk-7K24F7T2.js} +2 -0
  8. package/dist/{chunk-OO6XR6LK.js → chunk-AMBFK2K3.js} +2 -0
  9. package/dist/chunk-ATSM5XAW.js +623 -0
  10. package/dist/{chunk-4XXOWOTA.js → chunk-BBEFP4SB.js} +31 -38
  11. package/dist/{chunk-BYYS3ANB.js → chunk-CZU3V3DQ.js} +5 -15
  12. package/dist/{chunk-VTWMIC5L.js → chunk-E2JKXMVO.js} +2 -0
  13. package/dist/chunk-ECBLHAZO.js +15 -0
  14. package/dist/{sync-HKIOZXQE.js → chunk-I4WQAEYB.js} +31 -540
  15. package/dist/{chunk-DWO43OIB.js → chunk-JQ3ENZZH.js} +2 -0
  16. package/dist/chunk-LNZBEQXW.js +25216 -0
  17. package/dist/{chunk-ZQ47LWTI.js → chunk-QJQZH5GQ.js} +49 -79
  18. package/dist/{chunk-QZ3AS4KK.js → chunk-RSG4ONOI.js} +9 -8
  19. package/dist/{chunk-4NN5IWVN.js → chunk-T6OSFQZD.js} +2 -0
  20. package/dist/{chunk-Y3LOALAV.js → chunk-TAL6CZH6.js} +8 -7
  21. package/dist/{chunk-3KWQYGYI.js → chunk-TKHSULJT.js} +2 -0
  22. package/dist/chunk-VXNMYUXU.js +202 -0
  23. package/dist/{chunk-3FY3RJ26.js → chunk-WZ6YVQSF.js} +15 -14
  24. package/dist/{chunk-6EIJSNBD.js → chunk-Y74WTIKJ.js} +2 -0
  25. package/dist/{community-report-client-C7WDGET3.js → community-report-client-XXWGSBSD.js} +3 -4
  26. package/dist/{config-BMYZX2UE.js → config-EXUGQN5T.js} +10 -10
  27. package/dist/{data-integration-QEKDWQDY.js → data-integration-4NZ53OMT.js} +920 -97
  28. package/dist/index.js +56 -81
  29. package/dist/{local-data-upload-client-4YYHSYD6.js → local-data-upload-client-KYOKVYZV.js} +3 -4
  30. package/dist/{memory-I2WXDTV2.js → memory-ATNKZNW5.js} +6 -7
  31. package/dist/{metadata-I4C2EWUN.js → metadata-VZVC7YMH.js} +10 -11
  32. package/dist/{model-HLHIEFMU.js → model-E4JMQ4V2.js} +8 -9
  33. package/dist/{personal-semantic-preference-LIPACBDX.js → personal-semantic-preference-7S2SQ3UV.js} +9 -10
  34. package/dist/{project-semantic-RT3R2VQD.js → project-semantic-2SZP2OPO.js} +13 -14
  35. package/dist/sync-YV3E66IF.js +520 -0
  36. package/dist/{te-agent-BR6VDBNX.js → te-agent-JB5T3PO7.js} +396 -92
  37. package/dist/{te-analysis-7VUNUYWZ.js → te-analysis-3YJAAT2D.js} +196 -43
  38. package/dist/{te-community-5DMNKJWY.js → te-community-UDBI672N.js} +12 -34
  39. package/dist/{te-dataops-6P5IKWNJ.js → te-dataops-ZLYOCXZ4.js} +480 -81
  40. package/dist/{te-engage-KZPR5R22.js → te-engage-4XG6OJML.js} +88 -16
  41. package/dist/{te-experiment-6BITX4RD.js → te-experiment-VXUWPINJ.js} +83 -12
  42. package/dist/te-kb-WYQWHFSC.js +1732 -0
  43. package/dist/{te-system-FXITO2JG.js → te-system-7G6F2LJA.js} +569 -35
  44. package/dist/{te-team-ADOC2ROP.js → te-team-E7FBBXMQ.js} +8 -7
  45. package/dist/{update-YCYCKJOO.js → update-D47BUG25.js} +8 -8
  46. package/package.json +22 -10
  47. package/skills/ae-agent/SKILL.md +30 -13
  48. package/skills/ae-agent/references/agent-distribution.md +94 -0
  49. package/skills/ae-agent/references/approval-request.md +4 -0
  50. package/skills/ae-agent/references/command_index.md +9 -2
  51. package/skills/ae-agent/references/create-automation.md +20 -2
  52. package/skills/ae-agent/references/get-agent-context.md +70 -0
  53. package/skills/ae-agent/references/list-automations.md +18 -3
  54. package/skills/ae-agent/references/list-mcp-credentials.md +1 -1
  55. package/skills/ae-agent/references/mcp-token.md +3 -3
  56. package/skills/ae-agent/references/set-mcp-credential.md +0 -1
  57. package/skills/ae-agent/references/update-automation.md +18 -0
  58. package/skills/ae-analysis/SKILL.md +11 -2
  59. package/skills/ae-analysis/references/adhoc_run.md +2 -0
  60. package/skills/ae-analysis/references/ai_models.md +23 -3
  61. package/skills/ae-analysis/references/analysis_gateway_assets.md +3 -3
  62. package/skills/ae-analysis/references/audience_models.md +18 -0
  63. package/skills/ae-analysis/references/command_index.md +9 -9
  64. package/skills/ae-analysis/references/cross_source_config.md +84 -0
  65. package/skills/ae-analysis/references/dashboard_update.md +1 -1
  66. package/skills/ae-analysis/references/project_timezone_update.md +13 -4
  67. package/skills/ae-analysis/references/property_create.md +2 -0
  68. package/skills/ae-analysis/references/super_metadata_batch_create.md +2 -0
  69. package/skills/ae-analysis/references/user_cluster_models.md +2 -0
  70. package/skills/ae-analysis/references/user_cluster_update.md +8 -4
  71. package/skills/ae-analysis/references/user_tag_create.md +30 -2
  72. package/skills/ae-analysis/references/user_tag_models.md +17 -3
  73. package/skills/ae-analysis/references/user_tag_update.md +14 -2
  74. package/skills/ae-data-integration/SKILL.md +3 -1
  75. package/skills/ae-data-integration/references/dimension-routing.md +36 -0
  76. package/skills/ae-data-integration/references/error-handling.md +54 -1
  77. package/skills/ae-data-integration/references/local-analysis.md +2 -0
  78. package/skills/ae-data-integration/references/source-inspect.md +18 -2
  79. package/skills/ae-data-integration/references/tracking-plan.md +1 -1
  80. package/skills/ae-data-integration/references/transform.md +4 -2
  81. package/skills/ae-data-integration/references/ue-mapping.md +5 -2
  82. package/skills/ae-data-integration/references/ue-routing.md +40 -1
  83. package/skills/ae-dataops/SKILL.md +11 -1
  84. package/skills/ae-dataops/references/dataops-backfill.md +135 -0
  85. package/skills/ae-engage/SKILL.md +5 -0
  86. package/skills/ae-engage/references/build-task-save-guide.md +5 -1
  87. package/skills/ae-engage/references/save-flow.md +37 -1
  88. package/skills/ae-engage/references/save-task.md +6 -0
  89. package/skills/ae-experiment/SKILL.md +6 -2
  90. package/skills/ae-experiment/references/save_metric.md +20 -8
  91. package/skills/ae-generate-tracking-plan/SKILL.md +25 -13
  92. package/skills/ae-generate-tracking-plan/references/business-dimension-mapping.md +1 -1
  93. package/skills/ae-kb/SKILL.md +218 -36
  94. package/skills/ae-kb/references/query-workflow.md +59 -29
  95. package/skills/ae-kb/references/versions.md +46 -0
  96. package/skills/ae-system/SKILL.md +29 -31
  97. package/skills/ae-system/references/channel-management.md +303 -0
  98. package/skills/ae-use-agent/SKILL.md +42 -0
  99. package/skills/ae-use-agent/references/local-agent.md +114 -0
  100. package/dist/auth-GBMV6TEJ.js +0 -14
  101. package/dist/capability-HYVVPG25.js +0 -352
  102. package/dist/chunk-EFH4XWYC.js +0 -556
  103. package/dist/chunk-J2DEBMRF.js +0 -313
  104. package/dist/chunk-JRJY5DMJ.js +0 -71
  105. package/dist/chunk-OMPRXM3V.js +0 -349
  106. package/dist/chunk-QNOLN2LJ.js +0 -509
  107. package/dist/chunk-RJDU7NYP.js +0 -1198
  108. package/dist/chunk-RNAALWJK.js +0 -98
  109. package/dist/chunk-SERWF6G5.js +0 -13
  110. package/dist/chunk-UW5UN47B.js +0 -70
  111. package/dist/chunk-ZQKDZXDO.js +0 -317
  112. package/dist/client-L2YDMHQ6.js +0 -203
  113. package/dist/memory-3ORCR7JH.js +0 -893
  114. package/dist/metadata-VUOQJE26.js +0 -339
  115. package/dist/model-UGRDX4MW.js +0 -139
  116. package/dist/personal-semantic-preference-OEISBRHM.js +0 -239
  117. package/dist/project-semantic-FFPWFPIW.js +0 -1114
  118. package/dist/sync-TFHU2UTG.js +0 -10261
  119. package/dist/te-agent-VLYOV7S4.js +0 -3894
  120. package/dist/te-analysis-4YGQL5RC.js +0 -9357
  121. package/dist/te-community-ISDQWJU7.js +0 -1859
  122. package/dist/te-dataops-CVULXNVB.js +0 -2209
  123. package/dist/te-engage-N5WI32H6.js +0 -4898
  124. package/dist/te-experiment-UVR4HLND.js +0 -988
  125. package/dist/te-kb-RCLSSH2Q.js +0 -935
  126. package/dist/te-system-K2GYMCTB.js +0 -2213
  127. package/skills/ae-agent/references/auto-provision-mcp-credentials.md +0 -57
@@ -1,3 +1,4 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
1
2
  import {
2
3
  assertOutputPathAvailable,
3
4
  clientWaitTimeoutSeconds,
@@ -6,17 +7,10 @@ import {
6
7
  waitForAnalysisRun,
7
8
  withAsyncArtifactLifecycle,
8
9
  withInterruptSignal
9
- } from "./chunk-QZ3AS4KK.js";
10
+ } from "./chunk-RSG4ONOI.js";
10
11
  import {
11
12
  createCapabilityCommand
12
- } from "./chunk-JRJY5DMJ.js";
13
- import {
14
- registerCapabilityGatewayRoute,
15
- resolveGatewayDomain
16
- } from "./chunk-3KWQYGYI.js";
17
- import {
18
- withOutputMetadata
19
- } from "./chunk-BYYS3ANB.js";
13
+ } from "./chunk-TAL6CZH6.js";
20
14
  import {
21
15
  CapabilityGatewayError,
22
16
  buildCapabilityGatewayUrl,
@@ -27,17 +21,22 @@ import {
27
21
  requestCapabilityGatewayWithEnvelope,
28
22
  uploadInputFile,
29
23
  validateCapability
30
- } from "./chunk-OMPRXM3V.js";
31
- import "./chunk-6EIJSNBD.js";
24
+ } from "./chunk-QJQZH5GQ.js";
25
+ import {
26
+ registerCapabilityGatewayRoute,
27
+ resolveGatewayDomain
28
+ } from "./chunk-TKHSULJT.js";
29
+ import {
30
+ withOutputMetadata
31
+ } from "./chunk-CZU3V3DQ.js";
32
+ import "./chunk-Y74WTIKJ.js";
32
33
  import {
33
34
  getCliToken
34
- } from "./chunk-J2DEBMRF.js";
35
- import "./chunk-ZQKDZXDO.js";
36
- import "./chunk-3FY3RJ26.js";
35
+ } from "./chunk-ATSM5XAW.js";
36
+ import "./chunk-WZ6YVQSF.js";
37
37
  import {
38
38
  CliValidationError
39
- } from "./chunk-UW5UN47B.js";
40
- import "./chunk-JHENBQ5B.js";
39
+ } from "./chunk-4P355ZWB.js";
41
40
 
42
41
  // src/commands/te-analysis/capability-shared.ts
43
42
  var ANALYSIS_GATEWAY_CLI_SERVICES = /* @__PURE__ */ new Set(["project", "system"]);
@@ -334,6 +333,9 @@ function optionalString(ctx, name) {
334
333
  const value = ctx.str(name);
335
334
  return value === "" ? void 0 : value;
336
335
  }
336
+ function optionalStringPreserveEmpty(ctx, name) {
337
+ return ctx.has?.(name) ? ctx.str(name) : optionalString(ctx, name);
338
+ }
337
339
  function optionalNumber(ctx, name) {
338
340
  const value = ctx.str(name);
339
341
  return value === "" ? void 0 : Number(value);
@@ -2781,7 +2783,7 @@ var REPORT_WRITE_MODEL_TYPE_VALUES = [
2781
2783
  "tag"
2782
2784
  ];
2783
2785
  var REPORT_WRITE_MODEL_DESCRIPTION = `${AI_MODEL_DESCRIPTION} Report create/update also supports tag for saved tag report data; use tag as the AI-facing spelling.`;
2784
- var AI_DEFINITION_DESCRIPTION = 'AI-facing model definition JSON. Do not pass raw QP, events, event_view, visual_view, or analysis_query. Distribution filters must be attached to the corresponding distribution_metrics[].filters; do not use top-level filters or relation. For path definitions, global filters support user_property, cluster, and tag only; event_property is not supported. session_unit accepts second (1..999), minute (1..999), or hour (1..24). Do not use day; express one day as session_interval=24 and session_unit=hour. For SQL, a simple query is {"sql":"select ..."}; raw variables use ${name}, while typed params use ${Text:name}, ${Selector:name}, or ${PartDate:name}. PartDate expands to a complete predicate, so write WHERE ${PartDate:d}, not a column followed by the placeholder. A part_date parameter may set boolean use_timezone; it defaults to false and controls whether that parameter uses the query effective timezone. Selector value must match one options[].value. Trino identifiers containing #, $, @, spaces, punctuation, or a reserved word must be delimited with double quotes, for example SELECT "#user_id", "$part_event", "end" FROM ...; single quotes are string literals. For multiline SQL JSON, the decoded sql value must contain a real line break; do not submit a literal \\n sequence outside quoted SQL text. Queries against an event table must include a date-partition predicate on the quoted "$part_date" column, for example WHERE "$part_date" BETWEEN \'2026-07-01\' AND \'2026-07-07\'; the backend rejects event-table SQL without it. The CLI preserves SQL text and never auto-quotes identifiers.';
2786
+ var AI_DEFINITION_DESCRIPTION = 'Event metrics: omit optional display_name unless the target command schema explicitly supports it. Funnel step filters use event_property_name (not field) and string-array values, including "true"/"false" for boolean properties. AI-facing model definition JSON. Do not pass raw QP, events, event_view, visual_view, or analysis_query. Distribution filters must be attached to the corresponding distribution_metrics[].filters; do not use top-level filters or relation. For path definitions, global filters support user_property, cluster, and tag only; event_property is not supported. session_unit accepts second (1..999), minute (1..999), or hour (1..24). Do not use day; express one day as session_interval=24 and session_unit=hour. For SQL, a simple query is {"sql":"select ..."}; raw variables use ${name}, while typed params use ${Text:name}, ${Selector:name}, or ${PartDate:name}. PartDate expands to a complete predicate, so write WHERE ${PartDate:d}, not a column followed by the placeholder. A part_date parameter may set boolean use_timezone; it defaults to false and controls whether that parameter uses the query effective timezone. Selector value must match one options[].value. Trino identifiers containing #, $, @, spaces, punctuation, or a reserved word must be delimited with double quotes, for example SELECT "#user_id", "$part_event", "end" FROM ...; single quotes are string literals. For multiline SQL JSON, the decoded sql value must contain a real line break; do not submit a literal \\n sequence outside quoted SQL text. Queries against an event table must include a date-partition predicate on the quoted "$part_date" column, for example WHERE "$part_date" BETWEEN \'2026-07-01\' AND \'2026-07-07\'; the backend rejects event-table SQL without it. The CLI preserves SQL text and never auto-quotes identifiers.';
2785
2787
  var REPORT_WRITE_DEFINITION_DESCRIPTION = `${AI_DEFINITION_DESCRIPTION} For model_type=tag, pass a tag report intent such as {"tag":{"tag_name":"vip_users","time_range":{"mode":"recent","unit":"day","value":7}}}. Tags are supported for report create/update and report data, not ad-hoc analysis.`;
2786
2788
  function aiModelTypeFlag(required) {
2787
2789
  return {
@@ -2791,6 +2793,34 @@ function aiModelTypeFlag(required) {
2791
2793
  desc: AI_MODEL_DESCRIPTION
2792
2794
  };
2793
2795
  }
2796
+ function validateFunnelStepFilters(modelType, definition) {
2797
+ if (modelType !== "funnel" || !isRecord(definition) || !isRecord(definition.funnel)) return;
2798
+ const steps = definition.funnel.steps;
2799
+ if (!Array.isArray(steps)) return;
2800
+ const errors = [];
2801
+ steps.forEach((step, stepIndex) => {
2802
+ if (!isRecord(step) || !Array.isArray(step.filters)) return;
2803
+ step.filters.forEach((filter, filterIndex) => {
2804
+ if (!isRecord(filter)) return;
2805
+ const location = `definition.funnel.steps[${stepIndex}].filters[${filterIndex}]`;
2806
+ if ("field" in filter || typeof filter.event_property_name !== "string" || !filter.event_property_name.trim()) {
2807
+ errors.push(`${location}: use a non-empty event_property_name, not a generic field object.`);
2808
+ }
2809
+ if ("values" in filter && (!Array.isArray(filter.values) || filter.values.some((value) => typeof value !== "string"))) {
2810
+ errors.push(`${location}.values: use an array of strings (boolean properties use "true" or "false").`);
2811
+ }
2812
+ });
2813
+ });
2814
+ if (errors.length) {
2815
+ throw new CliValidationError(errors.join("\n"), {
2816
+ code: "INVALID_ANALYSIS_DEFINITION",
2817
+ hint: "Correct all reported step-filter fields together, preserve the complete requested definition, then validate it once. No query was dispatched."
2818
+ });
2819
+ }
2820
+ }
2821
+ function isRecord(value) {
2822
+ return value !== null && typeof value === "object" && !Array.isArray(value);
2823
+ }
2794
2824
  function reportWriteModelTypeFlag(required) {
2795
2825
  return {
2796
2826
  name: "model-type",
@@ -3195,16 +3225,16 @@ var dashboardUpdate = createAnalysisCapabilityCommand({
3195
3225
  flags: [
3196
3226
  projectIdFlag,
3197
3227
  { name: "operation", type: "string", required: true, desc: "Update operation: settings, note-upsert, default-filter, or business-filter." },
3198
- { name: "dashboard-id", type: "number", required: false, desc: "Dashboard ID for a single-dashboard update." },
3228
+ { name: "dashboard-id", type: "number", required: false, desc: "Dashboard ID for a single-dashboard update. Required for note-upsert." },
3199
3229
  { name: "dashboard-ids", type: "json", required: false, desc: "Dashboard ID array for batch settings updates." },
3200
3230
  { name: "dashboard-name", type: "string", required: false, desc: "Dashboard name for single rename." },
3201
3231
  { name: "zone-offset", type: "number", required: false, desc: "Fixed dashboard time zone offset in hours. For example, UTC+8 is 8 and UTC-5 is -5. Valid range: -12 to 14." },
3202
3232
  { name: "refresh-type", type: "number", required: false, desc: "Dashboard refresh type: 0 real-time, 1 scheduled.", min: 0, max: 1 },
3203
3233
  { name: "dashboard-status", type: "string", required: false, desc: "Dashboard status: normal or freeze." },
3204
- { name: "note-id", type: "number", required: false, desc: "Dashboard note ID. Omit to create a new note." },
3205
- { name: "note-title", type: "string", required: false, desc: "Dashboard note title." },
3206
- { name: "description", type: "string", required: false, desc: "Dashboard note description." },
3207
- { name: "ui-config", type: "string", required: false, desc: "Dashboard or note UI config string." },
3234
+ { name: "note-id", type: "number", required: false, desc: "Dashboard note ID. Omit to create a new note attached to the dashboard." },
3235
+ { name: "note-title", type: "string", required: false, desc: "Dashboard note title. Defaults to empty on create; omitted values are preserved on update." },
3236
+ { name: "description", type: "string", required: false, desc: "Dashboard note description. Defaults to empty on create; omitted values are preserved on update." },
3237
+ { name: "ui-config", type: "string", required: false, desc: "Dashboard or note UI config string. Omitted note style is preserved on update." },
3208
3238
  { name: "filter-name", type: "string", required: false, desc: "Saved filter name. Required with --operation default-filter." },
3209
3239
  { name: "filter", type: "json", required: false, desc: 'Saved filter in snake_case QP form. Required with --operation default-filter or business-filter. Pass {"junction_kind":"and","ta_filters":[]} to clear a business filter.' },
3210
3240
  payloadFlag
@@ -3220,8 +3250,8 @@ var dashboardUpdate = createAnalysisCapabilityCommand({
3220
3250
  refresh_type: optionalNumber(ctx, "refresh-type"),
3221
3251
  dashboard_status: optionalString(ctx, "dashboard-status"),
3222
3252
  note_id: optionalNumber(ctx, "note-id"),
3223
- note_title: optionalString(ctx, "note-title"),
3224
- description: optionalString(ctx, "description"),
3253
+ note_title: optionalStringPreserveEmpty(ctx, "note-title"),
3254
+ description: optionalStringPreserveEmpty(ctx, "description"),
3225
3255
  ui_config: optionalString(ctx, "ui-config"),
3226
3256
  filter_name: optionalString(ctx, "filter-name"),
3227
3257
  filter: optionalJson(ctx, "filter"),
@@ -3763,10 +3793,12 @@ var zoneOffsetFlag2 = {
3763
3793
  desc: "Optional timezone mode. Fixed UTC offsets are -12..14; 99 means stored local time without fixed UTC conversion (not UTC+99). Omit to use the project analysis default."
3764
3794
  };
3765
3795
  function adhocRunInput(ctx) {
3796
+ const definition = ctx.json("definition");
3797
+ validateFunnelStepFilters(ctx.str("model-type"), definition);
3766
3798
  return compactInput({
3767
3799
  project_id: ctx.num("project-id"),
3768
3800
  model_type: ctx.str("model-type"),
3769
- definition: ctx.json("definition"),
3801
+ definition,
3770
3802
  resolutions: optionalJson(ctx, "resolutions"),
3771
3803
  request_id: optionalString(ctx, "request-id"),
3772
3804
  use_cache: optionalBoolean(ctx, "use-cache"),
@@ -3779,10 +3811,12 @@ function adhocRunInput(ctx) {
3779
3811
  });
3780
3812
  }
3781
3813
  function adhocExportInput(ctx) {
3814
+ const definition = ctx.json("definition");
3815
+ validateFunnelStepFilters(ctx.str("model-type"), definition);
3782
3816
  return compactInput({
3783
3817
  project_id: ctx.num("project-id"),
3784
3818
  model_type: ctx.str("model-type"),
3785
- definition: ctx.json("definition"),
3819
+ definition,
3786
3820
  resolutions: optionalJson(ctx, "resolutions"),
3787
3821
  request_id: optionalString(ctx, "request-id"),
3788
3822
  use_cache: optionalBoolean(ctx, "use-cache"),
@@ -5140,7 +5174,7 @@ var clusterDefinitionRequestFlag = {
5140
5174
  var optionalClusterDefinitionRequestFlag = {
5141
5175
  ...clusterDefinitionRequestFlag,
5142
5176
  required: false,
5143
- desc: "Optional semantic snake_case cluster definition. Read user_cluster_models.md; raw filts, C-codes, ftv, columnName, and backend DTOs are rejected."
5177
+ desc: "Optional semantic snake_case cluster definition. Its type must match the existing cluster type; update cannot change the analysis entity. Read user_cluster_models.md; raw filts, C-codes, ftv, columnName, and backend DTOs are rejected."
5144
5178
  };
5145
5179
  var tagDefinitionRequestFlag = {
5146
5180
  ...clusterDefinitionRequestFlag,
@@ -5163,6 +5197,24 @@ var autoRefreshCronFlag = {
5163
5197
  required: false,
5164
5198
  desc: "Optional Quartz cron expression for an existing enabled auto-refresh schedule. This does not enable auto refresh."
5165
5199
  };
5200
+ var tagAutoRefreshFlags = [
5201
+ {
5202
+ name: "enable-auto-refresh",
5203
+ type: "boolean",
5204
+ required: false,
5205
+ desc: "Enable or disable periodic refresh. Omit to preserve the setting on update. Enabling on create requires a schedule."
5206
+ },
5207
+ {
5208
+ ...autoRefreshCronFlag,
5209
+ desc: "Quartz cron expression in the tag timezone. Enables periodic refresh. Mutually exclusive with --auto-refresh-schedule."
5210
+ },
5211
+ {
5212
+ name: "auto-refresh-schedule",
5213
+ type: "json",
5214
+ required: false,
5215
+ desc: 'Schedule object: frequency daily|weekly|monthly, time HH:mm, weekdays (weekly, ISO 1=Monday to 7=Sunday), month_days (monthly, 1-31). Enables periodic refresh in the tag timezone. Example: {"frequency":"daily","time":"02:30"}.'
5216
+ }
5217
+ ];
5166
5218
  var entityIdFlag = {
5167
5219
  name: "entity-id",
5168
5220
  type: "number",
@@ -5411,6 +5463,18 @@ function clusterWriteInput(ctx, create) {
5411
5463
  function tagWriteInput(ctx, create) {
5412
5464
  const definitionRequest = optionalJson(ctx, "definition-request");
5413
5465
  validateDefinitionRequest(create, definitionRequest);
5466
+ const enabled = optionalBoolean(ctx, "enable-auto-refresh");
5467
+ const cron = optionalString(ctx, "auto-refresh-cron");
5468
+ const schedule = optionalJson(ctx, "auto-refresh-schedule");
5469
+ if (cron !== void 0 && schedule !== void 0) {
5470
+ throw new Error("Pass only one of --auto-refresh-cron and --auto-refresh-schedule");
5471
+ }
5472
+ if (enabled === false && (cron !== void 0 || schedule !== void 0)) {
5473
+ throw new Error("Cannot set a schedule with --enable-auto-refresh false");
5474
+ }
5475
+ if (create && enabled === true && cron === void 0 && schedule === void 0) {
5476
+ throw new Error("Enabling auto refresh on create requires --auto-refresh-schedule or --auto-refresh-cron");
5477
+ }
5414
5478
  return compactInput({
5415
5479
  project_id: ctx.num("project-id"),
5416
5480
  tag_name: ctx.str("tag-name"),
@@ -5419,7 +5483,9 @@ function tagWriteInput(ctx, create) {
5419
5483
  authenticated_only: optionalBoolean(ctx, "authenticated-only"),
5420
5484
  remark: create ? void 0 : optionalString(ctx, "remark"),
5421
5485
  zone_offset: optionalNumber(ctx, "zone-offset"),
5422
- auto_refresh_cron: create ? void 0 : optionalString(ctx, "auto-refresh-cron"),
5486
+ enable_auto_refresh: enabled,
5487
+ auto_refresh_cron: cron,
5488
+ auto_refresh_schedule: schedule,
5423
5489
  entity_id: create ? optionalNumber(ctx, "entity-id") : void 0
5424
5490
  });
5425
5491
  }
@@ -5591,7 +5657,7 @@ var commands40 = [
5591
5657
  zoneOffsetFlag3,
5592
5658
  entityIdFlag
5593
5659
  ], "write", (ctx) => clusterWriteInput(ctx, true)),
5594
- capability("user-cluster", "update", "analysis.user_cluster.update", "Update a condition or SQL user cluster. Pass only fields that should change.", [
5660
+ capability("user-cluster", "update", "analysis.user_cluster.update", "Update a condition or SQL user cluster without changing its existing type or analysis entity. Pass only fields that should change.", [
5595
5661
  projectIdFlag,
5596
5662
  clusterNameFlag,
5597
5663
  optionalDisplayNameFlag,
@@ -5600,7 +5666,7 @@ var commands40 = [
5600
5666
  remarkFlag,
5601
5667
  zoneOffsetFlag3,
5602
5668
  autoRefreshCronFlag
5603
- ], "write", (ctx) => clusterWriteInput(ctx, false)),
5669
+ ], "high-risk-write", (ctx) => clusterWriteInput(ctx, false)),
5604
5670
  idImportCapability(capability("user-cluster", "create-id", "analysis.user_cluster.create_id", "Create a cluster by mapping imported values to an analysis entity.", [
5605
5671
  projectIdFlag,
5606
5672
  { ...newClusterNameFlag, required: false, desc: "Optional cluster_name; generated if omitted. When provided, it must satisfy the 1-80 character machine-name contract." },
@@ -5682,7 +5748,8 @@ var commands40 = [
5682
5748
  tagDefinitionRequestFlag,
5683
5749
  authenticatedOnlyFlag,
5684
5750
  zoneOffsetFlag3,
5685
- entityIdFlag
5751
+ entityIdFlag,
5752
+ ...tagAutoRefreshFlags
5686
5753
  ], "write", (ctx) => tagWriteInput(ctx, true)),
5687
5754
  capability("user-tag", "update", "analysis.user_tag.update", "Update a user tag. Pass only fields that should change.", [
5688
5755
  projectIdFlag,
@@ -5692,7 +5759,7 @@ var commands40 = [
5692
5759
  authenticatedOnlyFlag,
5693
5760
  remarkFlag,
5694
5761
  zoneOffsetFlag3,
5695
- autoRefreshCronFlag
5762
+ ...tagAutoRefreshFlags
5696
5763
  ], "write", (ctx) => tagWriteInput(ctx, false)),
5697
5764
  capability("user-tag", "refresh", "analysis.user_tag.refresh", "Refresh a user tag by exact tag_name.", [
5698
5765
  projectIdFlag,
@@ -6886,6 +6953,16 @@ var projectTimezoneOverview = createAnalysisCapabilityCommand({
6886
6953
  });
6887
6954
 
6888
6955
  // src/commands/te-analysis/project/timezone/update.ts
6956
+ var TIMEZONE_ITEMS = [
6957
+ "timezone_toggle",
6958
+ "zone_offset",
6959
+ "user_timezone",
6960
+ "project_timezone_display"
6961
+ ];
6962
+ var timezonePayloadFlag = {
6963
+ ...requiredPayloadFlag,
6964
+ desc: 'Item-specific snake_case payload: timezone_toggle uses {"toggle":true}; zone_offset uses {"column_name":"#zone_offset"}; user_timezone uses {"column_name":"user_timezone","codetable":"optional_table"}; project_timezone_display uses {"display_timezones":[{"timezone":8,"is_default":true}]}.'
6965
+ };
6889
6966
  var projectTimezoneUpdate = createAnalysisCapabilityCommand({
6890
6967
  resource: "project timezone",
6891
6968
  command: "update",
@@ -6893,16 +6970,92 @@ var projectTimezoneUpdate = createAnalysisCapabilityCommand({
6893
6970
  description: "Update one project time zone configuration item.",
6894
6971
  flags: [
6895
6972
  projectIdFlag,
6896
- requiredPayloadFlag,
6973
+ timezonePayloadFlag,
6897
6974
  { name: "item", type: "string", required: true, desc: "Timezone item: timezone_toggle, zone_offset, user_timezone, project_timezone_display." }
6898
6975
  ],
6899
6976
  risk: "write",
6900
- buildInput: (ctx) => compactInput({
6901
- project_id: ctx.num("project-id"),
6902
- payload: ctx.json("payload"),
6903
- item: ctx.str("item")
6904
- })
6977
+ buildInput: (ctx) => {
6978
+ const item = ctx.str("item").toLowerCase();
6979
+ const payload = ctx.json("payload");
6980
+ validateTimezonePayload(item, payload);
6981
+ return compactInput({
6982
+ project_id: ctx.num("project-id"),
6983
+ payload,
6984
+ item
6985
+ });
6986
+ }
6905
6987
  });
6988
+ function validateTimezonePayload(item, payload) {
6989
+ if (!TIMEZONE_ITEMS.includes(item)) {
6990
+ throw new CliValidationError(
6991
+ "--item must be timezone_toggle, zone_offset, user_timezone, or project_timezone_display.",
6992
+ { code: "INVALID_TIMEZONE_ITEM" }
6993
+ );
6994
+ }
6995
+ if (!isObject(payload)) {
6996
+ throw invalidPayload(item, "must be a JSON object");
6997
+ }
6998
+ switch (item) {
6999
+ case "timezone_toggle":
7000
+ if (typeof payload.toggle !== "boolean") {
7001
+ throw invalidPayload(item, "requires boolean field toggle", '{"toggle":true}');
7002
+ }
7003
+ allowOnly(payload, item, ["toggle"]);
7004
+ return;
7005
+ case "zone_offset":
7006
+ if (typeof payload.column_name !== "string") {
7007
+ throw invalidPayload(item, "requires string field column_name", '{"column_name":"#zone_offset"}');
7008
+ }
7009
+ allowOnly(payload, item, ["column_name"]);
7010
+ return;
7011
+ case "user_timezone":
7012
+ if (typeof payload.column_name !== "string" || payload.column_name.length === 0) {
7013
+ throw invalidPayload(item, "requires non-empty string field column_name", '{"column_name":"user_timezone"}');
7014
+ }
7015
+ if (payload.codetable !== void 0 && typeof payload.codetable !== "string") {
7016
+ throw invalidPayload(item, "optional field codetable must be a string", '{"column_name":"user_timezone","codetable":"timezone_code_table"}');
7017
+ }
7018
+ allowOnly(payload, item, ["column_name", "codetable"]);
7019
+ return;
7020
+ case "project_timezone_display":
7021
+ validateDisplayTimezones(payload.display_timezones, item);
7022
+ allowOnly(payload, item, ["display_timezones"]);
7023
+ }
7024
+ }
7025
+ function validateDisplayTimezones(value, item) {
7026
+ if (!Array.isArray(value) || value.length === 0) {
7027
+ throw invalidPayload(item, "requires non-empty array field display_timezones", '{"display_timezones":[{"timezone":8,"is_default":true}]}');
7028
+ }
7029
+ for (const entry of value) {
7030
+ if (!isObject(entry)) {
7031
+ throw invalidPayload(item, "display_timezones entries must be objects", '{"display_timezones":[{"timezone":8,"is_default":true}]}');
7032
+ }
7033
+ allowOnly(entry, item, ["timezone", "is_default"]);
7034
+ if (!Number.isInteger(entry.timezone) || !(entry.timezone >= -12 && entry.timezone <= 14 || entry.timezone === 99)) {
7035
+ throw invalidPayload(item, "display_timezones[].timezone must be an integer from -12 through 14, or 99 for no fixed display timezone");
7036
+ }
7037
+ if (entry.is_default !== void 0 && typeof entry.is_default !== "boolean") {
7038
+ throw invalidPayload(item, "display_timezones[].is_default must be a boolean when provided");
7039
+ }
7040
+ }
7041
+ }
7042
+ function allowOnly(payload, item, fields) {
7043
+ if (Object.keys(payload).some((field) => !fields.includes(field))) {
7044
+ throw invalidPayload(item, `supports only fields ${fields.join(", ")}`);
7045
+ }
7046
+ }
7047
+ function invalidPayload(item, reason, example) {
7048
+ return new CliValidationError(
7049
+ `--payload for --item ${item} ${reason}.`,
7050
+ {
7051
+ code: "INVALID_TIMEZONE_PAYLOAD",
7052
+ hint: example === void 0 ? void 0 : `Use: --payload '${example}'`
7053
+ }
7054
+ );
7055
+ }
7056
+ function isObject(value) {
7057
+ return value !== null && typeof value === "object" && !Array.isArray(value);
7058
+ }
6906
7059
 
6907
7060
  // src/commands/te-analysis/project/timezone/index.ts
6908
7061
  var commands62 = [
@@ -7368,7 +7521,7 @@ function buildDisplayNameSyncPlan(draft, metadata) {
7368
7521
  };
7369
7522
  }
7370
7523
  function assertTrackingDraft(value) {
7371
- if (!isRecord(value)) {
7524
+ if (!isRecord2(value)) {
7372
7525
  throw new Error("Tracking draft must be a JSON object.");
7373
7526
  }
7374
7527
  for (const field of [
@@ -7432,7 +7585,7 @@ function existingDefinitions(value, nameField, displayNameField) {
7432
7585
  if (!Array.isArray(value)) return [];
7433
7586
  const rows = [];
7434
7587
  for (const item of value) {
7435
- if (!isRecord(item)) continue;
7588
+ if (!isRecord2(item)) continue;
7436
7589
  const name = nonEmptyString(item[nameField]);
7437
7590
  if (!name) continue;
7438
7591
  rows.push({
@@ -7475,7 +7628,7 @@ function nonEmptyString(value) {
7475
7628
  const trimmed = value.trim();
7476
7629
  return trimmed ? trimmed : void 0;
7477
7630
  }
7478
- function isRecord(value) {
7631
+ function isRecord2(value) {
7479
7632
  return value !== null && typeof value === "object" && !Array.isArray(value);
7480
7633
  }
7481
7634
 
@@ -8003,7 +8156,7 @@ var trackingDebugDataList = createTrackingCapabilityCommand({
8003
8156
  event_name: optionalString(ctx, "event-name")
8004
8157
  }),
8005
8158
  postProcess: (result, input) => {
8006
- const data = isRecord2(result) ? result : {};
8159
+ const data = isRecord3(result) ? result : {};
8007
8160
  const eventList = Array.isArray(data.event_list) ? data.event_list : [];
8008
8161
  const deviceDataList = Array.isArray(data.device_data_list) ? data.device_data_list : [];
8009
8162
  return {
@@ -8034,7 +8187,7 @@ function formatLocalTime(value) {
8034
8187
  pad(value.getSeconds())
8035
8188
  ].join("");
8036
8189
  }
8037
- function isRecord2(value) {
8190
+ function isRecord3(value) {
8038
8191
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
8039
8192
  }
8040
8193
 
@@ -1,25 +1,23 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
1
2
  import {
2
3
  registerCapabilityGatewayRoute
3
- } from "./chunk-3KWQYGYI.js";
4
+ } from "./chunk-TKHSULJT.js";
4
5
  import {
5
6
  internalCallSourceHeaders
6
- } from "./chunk-6EIJSNBD.js";
7
+ } from "./chunk-Y74WTIKJ.js";
7
8
  import {
8
- clearCliToken,
9
+ SecureStoreAuthError,
9
10
  getCliToken
10
- } from "./chunk-J2DEBMRF.js";
11
- import "./chunk-ZQKDZXDO.js";
11
+ } from "./chunk-ATSM5XAW.js";
12
12
  import {
13
13
  getActiveHost,
14
14
  safeJsonParse
15
- } from "./chunk-3FY3RJ26.js";
15
+ } from "./chunk-WZ6YVQSF.js";
16
16
  import {
17
17
  CliValidationError,
18
- PermissionError
19
- } from "./chunk-UW5UN47B.js";
20
- import {
18
+ PermissionError,
21
19
  logger
22
- } from "./chunk-JHENBQ5B.js";
20
+ } from "./chunk-4P355ZWB.js";
23
21
 
24
22
  // src/core/mcp.ts
25
23
  async function permissionDetails(resp) {
@@ -105,30 +103,10 @@ async function mcpRequest(url, method, params = {}, hostOverride) {
105
103
  throw new PermissionError(permission.message, permission.code, permission.hint);
106
104
  }
107
105
  if (resp.status === 401) {
108
- logger.warn(`MCP request failed (HTTP 401) for ${hostUrl}, refreshing CLI token`);
109
- clearCliToken(hostUrl);
110
- const newToken = await getCliToken(hostUrl);
111
- logger.info(`CLI token refreshed for ${hostUrl}`);
112
- process.stderr.write(`[ae-cli] CLI token refreshed for ${hostUrl}
113
- `);
114
- Object.assign(headers, buildAuthHeaders(newToken));
115
- const retryResp = await fetch(url, {
116
- method: "POST",
117
- headers,
118
- body: JSON.stringify(body)
119
- });
120
- if (retryResp.status === 403) {
121
- const permission = await permissionDetails(retryResp);
122
- throw new PermissionError(permission.message, permission.code, permission.hint);
123
- }
124
- if (!retryResp.ok) {
125
- throw new Error(`MCP HTTP error: ${retryResp.status} ${retryResp.statusText}`);
126
- }
127
- const retryData = safeJsonParse(await retryResp.text());
128
- if (retryData.error) {
129
- throw new Error(`MCP error: ${retryData.error.message || JSON.stringify(retryData.error)}`);
130
- }
131
- return retryData.result;
106
+ logger.warn(`MCP request failed (HTTP 401) for ${hostUrl}; CLI token must be replaced by login`);
107
+ throw new SecureStoreAuthError(
108
+ `CLI token is invalid or expired for ${hostUrl}. Run: ae-cli auth login --host ${hostUrl}`
109
+ );
132
110
  }
133
111
  throw new Error(`MCP HTTP error: ${resp.status} ${resp.statusText}`);
134
112
  }