@thinkingai/ae-cli 6.0.47 → 6.0.48-workbuddy

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 (84) hide show
  1. package/README.md +93 -36
  2. package/README.zh.md +93 -36
  3. package/assets/workbuddy-host-page/thinkingai.png +0 -0
  4. package/assets/workbuddy-host-page/workbuddy.png +0 -0
  5. package/bin/ae-cli-workbuddy.js +7 -0
  6. package/dist/auth-HJG2L6DR.js +910 -0
  7. package/dist/{capability-RUSV77CO.js → capability-JHYVQNQ4.js} +47 -34
  8. package/dist/chunk-2BDQB42E.js +15 -0
  9. package/dist/{chunk-GJXRF7Y6.js → chunk-6MXFJVNP.js} +47 -78
  10. package/dist/chunk-6ZIQV5GW.js +26 -0
  11. package/dist/{chunk-KZ6ZHF5J.js → chunk-ARTIHWVD.js} +27 -25
  12. package/dist/{chunk-6QK7SYYY.js → chunk-DU5MZQFQ.js} +29 -37
  13. package/dist/{chunk-BVDST5YT.js → chunk-JFOGWBAT.js} +8 -8
  14. package/dist/{chunk-JYMGHGCE.js → chunk-KSQGGXGA.js} +24 -13
  15. package/dist/{chunk-FR2EDAQM.js → chunk-NXRKDG6E.js} +89 -3
  16. package/dist/{chunk-NSIVXKJH.js → chunk-QSO4SA6C.js} +5 -5
  17. package/dist/{chunk-QL6R6TSK.js → chunk-QYJ252CT.js} +6 -5
  18. package/dist/{chunk-B5HMQAOM.js → chunk-UL6SJDYE.js} +1 -1
  19. package/dist/chunk-Y3S2KNNR.js +623 -0
  20. package/dist/{chunk-KEWVSO64.js → chunk-ZCM47ROU.js} +5 -16
  21. package/dist/{community-report-client-6OL6GBQW.js → community-report-client-QE4RC2XG.js} +2 -4
  22. package/dist/{config-XNMACCKX.js → config-XMRP5NDA.js} +8 -9
  23. package/dist/{data-integration-4NZGZ45E.js → data-integration-SGRITHJS.js} +19 -18
  24. package/dist/index.js +53 -80
  25. package/dist/{local-data-upload-client-EFHDLXFG.js → local-data-upload-client-LMVS7YAR.js} +2 -4
  26. package/dist/{memory-HBJQ2GC5.js → memory-5ZC73XBC.js} +4 -6
  27. package/dist/{metadata-PGDJE5RQ.js → metadata-LBX6O24P.js} +7 -9
  28. package/dist/{model-BHLJ2QMT.js → model-CRDIVYN5.js} +4 -6
  29. package/dist/{personal-semantic-preference-E5NZ56DN.js → personal-semantic-preference-7FVUTJZF.js} +6 -8
  30. package/dist/{sync-MUWPRM5I.js → sync-VVNDHU7R.js} +9 -11
  31. package/dist/{te-agent-WQZTMEK4.js → te-agent-4T5TFHD6.js} +393 -90
  32. package/dist/{te-analysis-YWCSSLYL.js → te-analysis-TPYFOIFD.js} +97 -31
  33. package/dist/{te-community-BNE6KREL.js → te-community-PWOTHSEC.js} +9 -32
  34. package/dist/{te-dataops-TXLKM2W6.js → te-dataops-ZJV5QVJU.js} +19 -20
  35. package/dist/{te-engage-VEW4CJHK.js → te-engage-WVHBZAXH.js} +11 -13
  36. package/dist/{te-kb-BUD6N3NI.js → te-kb-PNM2ZKBP.js} +595 -85
  37. package/dist/{te-system-44LZJDTQ.js → te-system-MRCMLAWW.js} +6 -8
  38. package/dist/{te-team-XMP47YXE.js → te-team-Y36TG6AQ.js} +6 -8
  39. package/dist/{update-UODFOZ4P.js → update-UNKCZ5U5.js} +7 -8
  40. package/package.json +15 -10
  41. package/skills/ae-agent/SKILL.md +30 -13
  42. package/skills/ae-agent/references/agent-distribution.md +94 -0
  43. package/skills/ae-agent/references/approval-request.md +4 -0
  44. package/skills/ae-agent/references/command_index.md +9 -2
  45. package/skills/ae-agent/references/create-automation.md +20 -2
  46. package/skills/ae-agent/references/get-agent-context.md +70 -0
  47. package/skills/ae-agent/references/list-automations.md +18 -3
  48. package/skills/ae-agent/references/list-mcp-credentials.md +1 -1
  49. package/skills/ae-agent/references/mcp-token.md +3 -3
  50. package/skills/ae-agent/references/set-mcp-credential.md +0 -1
  51. package/skills/ae-agent/references/update-automation.md +18 -0
  52. package/skills/ae-analysis/SKILL.md +11 -2
  53. package/skills/ae-analysis/references/adhoc_run.md +2 -0
  54. package/skills/ae-analysis/references/ai_models.md +23 -3
  55. package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -2
  56. package/skills/ae-analysis/references/command_index.md +7 -7
  57. package/skills/ae-analysis/references/cross_source_config.md +84 -0
  58. package/skills/ae-analysis/references/dashboard_update.md +1 -1
  59. package/skills/ae-analysis/references/user_tag_create.md +23 -1
  60. package/skills/ae-analysis/references/user_tag_models.md +9 -1
  61. package/skills/ae-analysis/references/user_tag_update.md +14 -2
  62. package/skills/ae-data-integration/SKILL.md +2 -1
  63. package/skills/ae-data-integration/references/dimension-routing.md +36 -0
  64. package/skills/ae-data-integration/references/local-analysis.md +2 -0
  65. package/skills/ae-data-integration/references/source-inspect.md +1 -1
  66. package/skills/ae-data-integration/references/tracking-plan.md +1 -1
  67. package/skills/ae-data-integration/references/transform.md +1 -1
  68. package/skills/ae-data-integration/references/ue-mapping.md +5 -2
  69. package/skills/ae-data-integration/references/ue-routing.md +17 -1
  70. package/skills/ae-generate-tracking-plan/SKILL.md +25 -13
  71. package/skills/ae-generate-tracking-plan/references/business-dimension-mapping.md +1 -1
  72. package/skills/ae-kb/SKILL.md +107 -36
  73. package/skills/ae-kb/references/query-workflow.md +59 -29
  74. package/skills/ae-kb/references/versions.md +46 -0
  75. package/skills/ae-system/SKILL.md +1 -1
  76. package/skills/ae-use-agent/SKILL.md +42 -0
  77. package/skills/ae-use-agent/references/local-agent.md +114 -0
  78. package/dist/auth-QPEVVBKT.js +0 -465
  79. package/dist/auth-UMJAA72O.js +0 -15
  80. package/dist/chunk-533JK3YX.js +0 -72
  81. package/dist/chunk-O6K2ODUE.js +0 -318
  82. package/dist/chunk-RWXIXOZG.js +0 -326
  83. package/dist/client-N7NGZUNI.js +0 -204
  84. package/skills/ae-agent/references/auto-provision-mcp-credentials.md +0 -57
@@ -7,13 +7,14 @@ import {
7
7
  waitForAnalysisRun,
8
8
  withAsyncArtifactLifecycle,
9
9
  withInterruptSignal
10
- } from "./chunk-BVDST5YT.js";
10
+ } from "./chunk-JFOGWBAT.js";
11
11
  import {
12
12
  createCapabilityCommand
13
- } from "./chunk-NSIVXKJH.js";
13
+ } from "./chunk-QSO4SA6C.js";
14
14
  import {
15
- withOutputMetadata
16
- } from "./chunk-KEWVSO64.js";
15
+ registerCapabilityGatewayRoute,
16
+ resolveGatewayDomain
17
+ } from "./chunk-TKHSULJT.js";
17
18
  import {
18
19
  CapabilityGatewayError,
19
20
  buildCapabilityGatewayUrl,
@@ -24,21 +25,18 @@ import {
24
25
  requestCapabilityGatewayWithEnvelope,
25
26
  uploadInputFile,
26
27
  validateCapability
27
- } from "./chunk-GJXRF7Y6.js";
28
+ } from "./chunk-6MXFJVNP.js";
28
29
  import {
29
- registerCapabilityGatewayRoute,
30
- resolveGatewayDomain
31
- } from "./chunk-TKHSULJT.js";
30
+ withOutputMetadata
31
+ } from "./chunk-ZCM47ROU.js";
32
32
  import "./chunk-Y74WTIKJ.js";
33
33
  import {
34
34
  getCliToken
35
- } from "./chunk-RWXIXOZG.js";
36
- import "./chunk-O6K2ODUE.js";
37
- import "./chunk-KZ6ZHF5J.js";
35
+ } from "./chunk-Y3S2KNNR.js";
36
+ import "./chunk-ARTIHWVD.js";
38
37
  import {
39
38
  CliValidationError
40
- } from "./chunk-533JK3YX.js";
41
- import "./chunk-FR2EDAQM.js";
39
+ } from "./chunk-NXRKDG6E.js";
42
40
 
43
41
  // src/commands/te-analysis/capability-shared.ts
44
42
  var ANALYSIS_GATEWAY_CLI_SERVICES = /* @__PURE__ */ new Set(["project", "system"]);
@@ -335,6 +333,9 @@ function optionalString(ctx, name) {
335
333
  const value = ctx.str(name);
336
334
  return value === "" ? void 0 : value;
337
335
  }
336
+ function optionalStringPreserveEmpty(ctx, name) {
337
+ return ctx.has?.(name) ? ctx.str(name) : optionalString(ctx, name);
338
+ }
338
339
  function optionalNumber(ctx, name) {
339
340
  const value = ctx.str(name);
340
341
  return value === "" ? void 0 : Number(value);
@@ -2782,7 +2783,7 @@ var REPORT_WRITE_MODEL_TYPE_VALUES = [
2782
2783
  "tag"
2783
2784
  ];
2784
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.`;
2785
- 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.';
2786
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.`;
2787
2788
  function aiModelTypeFlag(required) {
2788
2789
  return {
@@ -2792,6 +2793,34 @@ function aiModelTypeFlag(required) {
2792
2793
  desc: AI_MODEL_DESCRIPTION
2793
2794
  };
2794
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
+ }
2795
2824
  function reportWriteModelTypeFlag(required) {
2796
2825
  return {
2797
2826
  name: "model-type",
@@ -3196,16 +3225,16 @@ var dashboardUpdate = createAnalysisCapabilityCommand({
3196
3225
  flags: [
3197
3226
  projectIdFlag,
3198
3227
  { name: "operation", type: "string", required: true, desc: "Update operation: settings, note-upsert, default-filter, or business-filter." },
3199
- { 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." },
3200
3229
  { name: "dashboard-ids", type: "json", required: false, desc: "Dashboard ID array for batch settings updates." },
3201
3230
  { name: "dashboard-name", type: "string", required: false, desc: "Dashboard name for single rename." },
3202
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." },
3203
3232
  { name: "refresh-type", type: "number", required: false, desc: "Dashboard refresh type: 0 real-time, 1 scheduled.", min: 0, max: 1 },
3204
3233
  { name: "dashboard-status", type: "string", required: false, desc: "Dashboard status: normal or freeze." },
3205
- { name: "note-id", type: "number", required: false, desc: "Dashboard note ID. Omit to create a new note." },
3206
- { name: "note-title", type: "string", required: false, desc: "Dashboard note title." },
3207
- { name: "description", type: "string", required: false, desc: "Dashboard note description." },
3208
- { 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." },
3209
3238
  { name: "filter-name", type: "string", required: false, desc: "Saved filter name. Required with --operation default-filter." },
3210
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.' },
3211
3240
  payloadFlag
@@ -3221,8 +3250,8 @@ var dashboardUpdate = createAnalysisCapabilityCommand({
3221
3250
  refresh_type: optionalNumber(ctx, "refresh-type"),
3222
3251
  dashboard_status: optionalString(ctx, "dashboard-status"),
3223
3252
  note_id: optionalNumber(ctx, "note-id"),
3224
- note_title: optionalString(ctx, "note-title"),
3225
- description: optionalString(ctx, "description"),
3253
+ note_title: optionalStringPreserveEmpty(ctx, "note-title"),
3254
+ description: optionalStringPreserveEmpty(ctx, "description"),
3226
3255
  ui_config: optionalString(ctx, "ui-config"),
3227
3256
  filter_name: optionalString(ctx, "filter-name"),
3228
3257
  filter: optionalJson(ctx, "filter"),
@@ -3764,10 +3793,12 @@ var zoneOffsetFlag2 = {
3764
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."
3765
3794
  };
3766
3795
  function adhocRunInput(ctx) {
3796
+ const definition = ctx.json("definition");
3797
+ validateFunnelStepFilters(ctx.str("model-type"), definition);
3767
3798
  return compactInput({
3768
3799
  project_id: ctx.num("project-id"),
3769
3800
  model_type: ctx.str("model-type"),
3770
- definition: ctx.json("definition"),
3801
+ definition,
3771
3802
  resolutions: optionalJson(ctx, "resolutions"),
3772
3803
  request_id: optionalString(ctx, "request-id"),
3773
3804
  use_cache: optionalBoolean(ctx, "use-cache"),
@@ -3780,10 +3811,12 @@ function adhocRunInput(ctx) {
3780
3811
  });
3781
3812
  }
3782
3813
  function adhocExportInput(ctx) {
3814
+ const definition = ctx.json("definition");
3815
+ validateFunnelStepFilters(ctx.str("model-type"), definition);
3783
3816
  return compactInput({
3784
3817
  project_id: ctx.num("project-id"),
3785
3818
  model_type: ctx.str("model-type"),
3786
- definition: ctx.json("definition"),
3819
+ definition,
3787
3820
  resolutions: optionalJson(ctx, "resolutions"),
3788
3821
  request_id: optionalString(ctx, "request-id"),
3789
3822
  use_cache: optionalBoolean(ctx, "use-cache"),
@@ -5164,6 +5197,24 @@ var autoRefreshCronFlag = {
5164
5197
  required: false,
5165
5198
  desc: "Optional Quartz cron expression for an existing enabled auto-refresh schedule. This does not enable auto refresh."
5166
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
+ ];
5167
5218
  var entityIdFlag = {
5168
5219
  name: "entity-id",
5169
5220
  type: "number",
@@ -5412,6 +5463,18 @@ function clusterWriteInput(ctx, create) {
5412
5463
  function tagWriteInput(ctx, create) {
5413
5464
  const definitionRequest = optionalJson(ctx, "definition-request");
5414
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
+ }
5415
5478
  return compactInput({
5416
5479
  project_id: ctx.num("project-id"),
5417
5480
  tag_name: ctx.str("tag-name"),
@@ -5420,7 +5483,9 @@ function tagWriteInput(ctx, create) {
5420
5483
  authenticated_only: optionalBoolean(ctx, "authenticated-only"),
5421
5484
  remark: create ? void 0 : optionalString(ctx, "remark"),
5422
5485
  zone_offset: optionalNumber(ctx, "zone-offset"),
5423
- 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,
5424
5489
  entity_id: create ? optionalNumber(ctx, "entity-id") : void 0
5425
5490
  });
5426
5491
  }
@@ -5683,7 +5748,8 @@ var commands40 = [
5683
5748
  tagDefinitionRequestFlag,
5684
5749
  authenticatedOnlyFlag,
5685
5750
  zoneOffsetFlag3,
5686
- entityIdFlag
5751
+ entityIdFlag,
5752
+ ...tagAutoRefreshFlags
5687
5753
  ], "write", (ctx) => tagWriteInput(ctx, true)),
5688
5754
  capability("user-tag", "update", "analysis.user_tag.update", "Update a user tag. Pass only fields that should change.", [
5689
5755
  projectIdFlag,
@@ -5693,7 +5759,7 @@ var commands40 = [
5693
5759
  authenticatedOnlyFlag,
5694
5760
  remarkFlag,
5695
5761
  zoneOffsetFlag3,
5696
- autoRefreshCronFlag
5762
+ ...tagAutoRefreshFlags
5697
5763
  ], "write", (ctx) => tagWriteInput(ctx, false)),
5698
5764
  capability("user-tag", "refresh", "analysis.user_tag.refresh", "Refresh a user tag by exact tag_name.", [
5699
5765
  projectIdFlag,
@@ -7455,7 +7521,7 @@ function buildDisplayNameSyncPlan(draft, metadata) {
7455
7521
  };
7456
7522
  }
7457
7523
  function assertTrackingDraft(value) {
7458
- if (!isRecord(value)) {
7524
+ if (!isRecord2(value)) {
7459
7525
  throw new Error("Tracking draft must be a JSON object.");
7460
7526
  }
7461
7527
  for (const field of [
@@ -7519,7 +7585,7 @@ function existingDefinitions(value, nameField, displayNameField) {
7519
7585
  if (!Array.isArray(value)) return [];
7520
7586
  const rows = [];
7521
7587
  for (const item of value) {
7522
- if (!isRecord(item)) continue;
7588
+ if (!isRecord2(item)) continue;
7523
7589
  const name = nonEmptyString(item[nameField]);
7524
7590
  if (!name) continue;
7525
7591
  rows.push({
@@ -7562,7 +7628,7 @@ function nonEmptyString(value) {
7562
7628
  const trimmed = value.trim();
7563
7629
  return trimmed ? trimmed : void 0;
7564
7630
  }
7565
- function isRecord(value) {
7631
+ function isRecord2(value) {
7566
7632
  return value !== null && typeof value === "object" && !Array.isArray(value);
7567
7633
  }
7568
7634
 
@@ -8090,7 +8156,7 @@ var trackingDebugDataList = createTrackingCapabilityCommand({
8090
8156
  event_name: optionalString(ctx, "event-name")
8091
8157
  }),
8092
8158
  postProcess: (result, input) => {
8093
- const data = isRecord2(result) ? result : {};
8159
+ const data = isRecord3(result) ? result : {};
8094
8160
  const eventList = Array.isArray(data.event_list) ? data.event_list : [];
8095
8161
  const deviceDataList = Array.isArray(data.device_data_list) ? data.device_data_list : [];
8096
8162
  return {
@@ -8121,7 +8187,7 @@ function formatLocalTime(value) {
8121
8187
  pad(value.getSeconds())
8122
8188
  ].join("");
8123
8189
  }
8124
- function isRecord2(value) {
8190
+ function isRecord3(value) {
8125
8191
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
8126
8192
  }
8127
8193
 
@@ -6,21 +6,18 @@ import {
6
6
  internalCallSourceHeaders
7
7
  } from "./chunk-Y74WTIKJ.js";
8
8
  import {
9
- clearCliToken,
9
+ SecureStoreAuthError,
10
10
  getCliToken
11
- } from "./chunk-RWXIXOZG.js";
12
- import "./chunk-O6K2ODUE.js";
11
+ } from "./chunk-Y3S2KNNR.js";
13
12
  import {
14
13
  getActiveHost,
15
14
  safeJsonParse
16
- } from "./chunk-KZ6ZHF5J.js";
15
+ } from "./chunk-ARTIHWVD.js";
17
16
  import {
18
17
  CliValidationError,
19
- PermissionError
20
- } from "./chunk-533JK3YX.js";
21
- import {
18
+ PermissionError,
22
19
  logger
23
- } from "./chunk-FR2EDAQM.js";
20
+ } from "./chunk-NXRKDG6E.js";
24
21
 
25
22
  // src/core/mcp.ts
26
23
  async function permissionDetails(resp) {
@@ -106,30 +103,10 @@ async function mcpRequest(url, method, params = {}, hostOverride) {
106
103
  throw new PermissionError(permission.message, permission.code, permission.hint);
107
104
  }
108
105
  if (resp.status === 401) {
109
- logger.warn(`MCP request failed (HTTP 401) for ${hostUrl}, refreshing CLI token`);
110
- clearCliToken(hostUrl);
111
- const newToken = await getCliToken(hostUrl);
112
- logger.info(`CLI token refreshed for ${hostUrl}`);
113
- process.stderr.write(`[ae-cli] CLI token refreshed for ${hostUrl}
114
- `);
115
- Object.assign(headers, buildAuthHeaders(newToken));
116
- const retryResp = await fetch(url, {
117
- method: "POST",
118
- headers,
119
- body: JSON.stringify(body)
120
- });
121
- if (retryResp.status === 403) {
122
- const permission = await permissionDetails(retryResp);
123
- throw new PermissionError(permission.message, permission.code, permission.hint);
124
- }
125
- if (!retryResp.ok) {
126
- throw new Error(`MCP HTTP error: ${retryResp.status} ${retryResp.statusText}`);
127
- }
128
- const retryData = safeJsonParse(await retryResp.text());
129
- if (retryData.error) {
130
- throw new Error(`MCP error: ${retryData.error.message || JSON.stringify(retryData.error)}`);
131
- }
132
- 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
+ );
133
110
  }
134
111
  throw new Error(`MCP HTTP error: ${resp.status} ${resp.statusText}`);
135
112
  }
@@ -1,27 +1,25 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ resolveHost
4
+ } from "./chunk-2BDQB42E.js";
2
5
  import {
3
6
  printError
4
- } from "./chunk-KEWVSO64.js";
7
+ } from "./chunk-ZCM47ROU.js";
5
8
  import {
6
9
  internalCallSourceHeaders
7
10
  } from "./chunk-Y74WTIKJ.js";
8
11
  import {
9
- clearCliToken,
12
+ SecureStoreAuthError,
10
13
  getCliToken
11
- } from "./chunk-RWXIXOZG.js";
12
- import {
13
- resolveHost
14
- } from "./chunk-O6K2ODUE.js";
14
+ } from "./chunk-Y3S2KNNR.js";
15
15
  import {
16
16
  safeJsonParse
17
- } from "./chunk-KZ6ZHF5J.js";
17
+ } from "./chunk-ARTIHWVD.js";
18
18
  import {
19
19
  CliValidationError,
20
- PermissionError
21
- } from "./chunk-533JK3YX.js";
22
- import {
20
+ PermissionError,
23
21
  logger
24
- } from "./chunk-FR2EDAQM.js";
22
+ } from "./chunk-NXRKDG6E.js";
25
23
 
26
24
  // src/commands/te-dataops/shared.ts
27
25
  import { randomBytes } from "crypto";
@@ -129,7 +127,7 @@ function buildDataopsApiDryRun(ctx, toolName68, args = {}) {
129
127
  body: params
130
128
  };
131
129
  }
132
- async function downloadDataopsApi(ctx, path, params, targetPath, retry = true) {
130
+ async function downloadDataopsApi(ctx, path, params, targetPath) {
133
131
  const host = resolveHost(ctx.host());
134
132
  const token = await getCliToken(host);
135
133
  const url = buildUrl(host, path, compactArgs(params));
@@ -145,9 +143,10 @@ async function downloadDataopsApi(ctx, path, params, targetPath, retry = true) {
145
143
  const data = parseResponseBody(await resp.text(), url, resp.status, true);
146
144
  throw new PermissionError(permissionMessage(data));
147
145
  }
148
- if (resp.status === 401 && retry) {
149
- clearCliToken(host);
150
- return downloadDataopsApi(ctx, path, params, targetPath, false);
146
+ if (resp.status === 401) {
147
+ throw new SecureStoreAuthError(
148
+ `The stored CLI token for ${host} is invalid or expired. Run: ae-cli auth login --host ${host}`
149
+ );
151
150
  }
152
151
  if (!resp.ok) {
153
152
  const data = parseResponseBody(await resp.text(), url, resp.status, true);
@@ -176,7 +175,7 @@ async function downloadDataopsApi(ctx, path, params, targetPath, retry = true) {
176
175
  if (tempPresent) await unlink(tempPath).catch(() => void 0);
177
176
  }
178
177
  }
179
- async function dataopsRequest(ctx, method, path, params = {}, body, retry = true) {
178
+ async function dataopsRequest(ctx, method, path, params = {}, body) {
180
179
  const host = resolveHost(ctx.host());
181
180
  const token = await getCliToken(host);
182
181
  const url = buildUrl(host, path, params);
@@ -197,10 +196,10 @@ async function dataopsRequest(ctx, method, path, params = {}, body, retry = true
197
196
  if (resp.status === 403) {
198
197
  throw new PermissionError(permissionMessage(data));
199
198
  }
200
- if (resp.status === 401 && retry) {
201
- logger.warn(`DataOps request failed (HTTP 401) for ${host}, refreshing CLI token`);
202
- clearCliToken(host);
203
- return dataopsRequest(ctx, method, path, params, body, false);
199
+ if (resp.status === 401) {
200
+ throw new SecureStoreAuthError(
201
+ `The stored CLI token for ${host} is invalid or expired. Run: ae-cli auth login --host ${host}`
202
+ );
204
203
  }
205
204
  if (!resp.ok) {
206
205
  throw new Error(formatHttpError(resp.status, resp.statusText, data));
@@ -1,30 +1,28 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createCapabilityCommand
4
- } from "./chunk-NSIVXKJH.js";
4
+ } from "./chunk-QSO4SA6C.js";
5
5
  import {
6
- printError,
7
- withOutputMetadata
8
- } from "./chunk-KEWVSO64.js";
6
+ registerCapabilityGatewayRoute,
7
+ resolveGatewayDomain
8
+ } from "./chunk-TKHSULJT.js";
9
9
  import {
10
10
  CapabilityGatewayError,
11
11
  buildCapabilityGatewayUrl,
12
12
  fetchCapabilityGateway,
13
13
  requestCapabilityGateway,
14
14
  requestCapabilityGatewayWithEnvelope
15
- } from "./chunk-GJXRF7Y6.js";
15
+ } from "./chunk-6MXFJVNP.js";
16
16
  import {
17
- registerCapabilityGatewayRoute,
18
- resolveGatewayDomain
19
- } from "./chunk-TKHSULJT.js";
17
+ printError,
18
+ withOutputMetadata
19
+ } from "./chunk-ZCM47ROU.js";
20
20
  import "./chunk-Y74WTIKJ.js";
21
- import "./chunk-RWXIXOZG.js";
22
- import "./chunk-O6K2ODUE.js";
23
- import "./chunk-KZ6ZHF5J.js";
21
+ import "./chunk-Y3S2KNNR.js";
22
+ import "./chunk-ARTIHWVD.js";
24
23
  import {
25
24
  CliValidationError
26
- } from "./chunk-533JK3YX.js";
27
- import "./chunk-FR2EDAQM.js";
25
+ } from "./chunk-NXRKDG6E.js";
28
26
 
29
27
  // src/commands/te-engage/shared.ts
30
28
  function createEngageCapabilityCommand(cliService, config) {