@thinkingai/ae-cli 6.1.42 → 6.1.43

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 (114) hide show
  1. package/README.md +14 -4
  2. package/README.zh.md +14 -4
  3. package/bin/ae-cli.js +3 -0
  4. package/bin/heari/commander-LICENSE +22 -0
  5. package/bin/heari/engine.mjs +6136 -0
  6. package/bin/heari/package.json +6 -0
  7. package/bin/heari.mjs +29 -0
  8. package/cli-installation-guide.md +3 -5
  9. package/dist/{ai-monitor-E62FT3TT.js → ai-monitor-4VPHXQTL.js} +7 -6
  10. package/dist/ai-monitor.js +10 -9
  11. package/dist/{auth-SDK5OAGP.js → auth-RDSS2LUT.js} +18 -16
  12. package/dist/{automation-IMDCJUML.js → automation-VLIWG2XY.js} +5 -4
  13. package/dist/{capability-F6YWGPZZ.js → capability-CUOEIB5F.js} +5 -4
  14. package/dist/{chunk-KE5WGBXS.js → chunk-3DTMWDJX.js} +1 -1
  15. package/dist/{chunk-KAZ5FWPB.js → chunk-3FSYICDW.js} +6 -5
  16. package/dist/{chunk-ZK6KEGUR.js → chunk-3TV24AVQ.js} +10 -10
  17. package/dist/{chunk-DTODOQ6T.js → chunk-3U75VLCP.js} +1 -1
  18. package/dist/{chunk-N2QILIGH.js → chunk-4MOCV6HU.js} +1 -1
  19. package/dist/{chunk-M2OCZRVX.js → chunk-6VLHJKDD.js} +2 -2
  20. package/dist/{chunk-WG27BD67.js → chunk-7KBENPQF.js} +8 -16
  21. package/dist/{chunk-CDBW5RE6.js → chunk-BFSWGXM2.js} +3 -3
  22. package/dist/{chunk-UK7HQ4IL.js → chunk-CBNE2S44.js} +2 -2
  23. package/dist/{chunk-UWQXGF44.js → chunk-FEYZBUFQ.js} +4 -353
  24. package/dist/chunk-FKTVD63C.js +369 -0
  25. package/dist/{chunk-2H3SFJE3.js → chunk-FKVG7LOP.js} +5 -3
  26. package/dist/{chunk-GTENC5CO.js → chunk-IAZ4AMVY.js} +6 -4
  27. package/dist/{chunk-ZSKLELL7.js → chunk-LSELMDKQ.js} +2 -2
  28. package/dist/{chunk-2RORKIF6.js → chunk-NJGB4YOH.js} +2 -2
  29. package/dist/{chunk-L7MT53VM.js → chunk-PWG5IGCP.js} +1 -1
  30. package/dist/{chunk-DIYDOOBL.js → chunk-TFEGYB4X.js} +2 -2
  31. package/dist/{chunk-DZRQGI2Z.js → chunk-ZPAOEDK7.js} +5 -3
  32. package/dist/{compat-check-J5K3NO5G.js → compat-check-L3C7HCVG.js} +4 -3
  33. package/dist/{config-O3W6XLHO.js → config-LAF5MMYK.js} +6 -5
  34. package/dist/context-E4YKECC4.js +350 -0
  35. package/dist/{evaluation-OZM54MES.js → evaluation-I4IJ25CY.js} +4 -3
  36. package/dist/heari-cli-login.js +83 -0
  37. package/dist/index.js +42 -34
  38. package/dist/{memory-VPOPSU52.js → memory-Y7LPCRP4.js} +5 -4
  39. package/dist/{metadata-3GA2N27I.js → metadata-T6HYAU7E.js} +7 -6
  40. package/dist/{model-2F2354QP.js → model-2BNN72MN.js} +7 -6
  41. package/dist/{personal-semantic-preference-T2HFF2V4.js → personal-semantic-preference-WCZBOA7V.js} +42 -16
  42. package/dist/{project-semantic-WJOP2HGJ.js → project-semantic-WW5AZST3.js} +266 -17
  43. package/dist/{sync-K65X7ODO.js → sync-6PL25V42.js} +13 -12
  44. package/dist/{te-agent-QWZC36YS.js → te-agent-KXLDW4NE.js} +6 -5
  45. package/dist/{te-analysis-7E2GVKOR.js → te-analysis-KKRECQ7F.js} +311 -52
  46. package/dist/{te-community-NQNSLNON.js → te-community-6RGX7IWH.js} +8 -6
  47. package/dist/{te-dataops-PMI7UX36.js → te-dataops-RSPBC6WJ.js} +726 -220
  48. package/dist/{te-engage-EZBV5IPQ.js → te-engage-FIPP5L2Z.js} +6 -5
  49. package/dist/{te-experiment-RDB3TYBG.js → te-experiment-KQ5CBYKI.js} +86 -10
  50. package/dist/{te-kb-OWPJB243.js → te-kb-XYSDXZUG.js} +32 -11
  51. package/dist/{te-system-Z4VEB6PL.js → te-system-QSOHAP7M.js} +7 -6
  52. package/dist/{te-team-NCMN34IL.js → te-team-R6MZ4RK2.js} +6 -5
  53. package/dist/{things-UBMLTY3S.js → things-DEONFUGS.js} +6 -5
  54. package/dist/{update-LYVYF3KJ.js → update-C6G4P3C7.js} +5 -4
  55. package/dist/{web-runtime-XJWDFVP3.js → web-runtime-UGKPTBOK.js} +12 -10
  56. package/dist/{workspace-W5ZPVWJS.js → workspace-OBIIE5FN.js} +5 -4
  57. package/package.json +7 -5
  58. package/skills/ae-analysis/SKILL.md +41 -16
  59. package/skills/ae-analysis/references/adhoc_export.md +1 -1
  60. package/skills/ae-analysis/references/adhoc_run.md +8 -2
  61. package/skills/ae-analysis/references/analysis_drilldown_contract.md +1 -1
  62. package/skills/ae-analysis/references/audience_scheduling.md +30 -0
  63. package/skills/ae-analysis/references/business_semantics_workspace.md +57 -0
  64. package/skills/ae-analysis/references/command_index.md +18 -13
  65. package/skills/ae-analysis/references/context_prepare.md +49 -0
  66. package/skills/ae-analysis/references/drilldown_entities_export.md +1 -1
  67. package/skills/ae-analysis/references/drilldown_entities_run.md +1 -1
  68. package/skills/ae-analysis/references/drilldown_user_events_export.md +3 -1
  69. package/skills/ae-analysis/references/drilldown_user_events_run.md +2 -1
  70. package/skills/ae-analysis/references/governance_recommendation_export.md +1 -1
  71. package/skills/ae-analysis/references/personal_semantic_preference_add.md +5 -1
  72. package/skills/ae-analysis/references/personal_semantic_preference_get.md +4 -2
  73. package/skills/ae-analysis/references/personal_semantic_preference_list.md +7 -6
  74. package/skills/ae-analysis/references/personal_semantic_preference_submit.md +1 -1
  75. package/skills/ae-analysis/references/personal_semantic_preference_update.md +5 -1
  76. package/skills/ae-analysis/references/project_info_get.md +4 -0
  77. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +1 -1
  78. package/skills/ae-analysis/references/project_semantic_setup.md +60 -0
  79. package/skills/ae-analysis/references/report_get.md +2 -0
  80. package/skills/ae-analysis/references/report_presentation.md +55 -0
  81. package/skills/ae-analysis/references/report_update.md +4 -2
  82. package/skills/ae-analysis/references/system_openapi_token_batch_generate.md +20 -0
  83. package/skills/ae-analysis/references/system_openapi_token_get.md +14 -0
  84. package/skills/ae-analysis/references/user_cluster_create.md +3 -1
  85. package/skills/ae-analysis/references/user_cluster_models.md +2 -0
  86. package/skills/ae-analysis/references/user_cluster_update.md +5 -3
  87. package/skills/ae-analysis/references/user_tag_create.md +4 -22
  88. package/skills/ae-analysis/references/user_tag_models.md +8 -0
  89. package/skills/ae-analysis/references/user_tag_update.md +6 -14
  90. package/skills/ae-analysis/scripts/read-semantic-catalog.mjs +40 -0
  91. package/skills/ae-capability/SKILL.md +5 -1
  92. package/skills/ae-dataops/SKILL.md +9 -6
  93. package/skills/ae-dataops/references/dataops-flow-create.md +64 -47
  94. package/skills/ae-dataops/references/dataops-flow-monitor.md +4 -2
  95. package/skills/ae-dataops/references/dataops-flow-python.md +109 -0
  96. package/skills/ae-experiment/SKILL.md +9 -1
  97. package/skills/ae-experiment/references/manage_feature_fixed_value.md +73 -0
  98. package/skills/ae-experiment/references/save_feature.md +14 -1
  99. package/skills/ae-heari-research/SKILL.md +40 -0
  100. package/skills/ae-heari-research/references/design.md +35 -0
  101. package/skills/ae-heari-research/references/examples.md +46 -0
  102. package/skills/ae-heari-research/references/platform-auth.md +35 -0
  103. package/skills/ae-heari-research/references/platform-research.md +74 -0
  104. package/skills/ae-heari-research/references/platform-results.md +73 -0
  105. package/skills/ae-heari-research/references/platform.md +34 -0
  106. package/skills/ae-heari-research/references/probing-screening.md +31 -0
  107. package/skills/ae-heari-research/references/quality.md +44 -0
  108. package/skills/ae-kb/SKILL.md +10 -5
  109. package/skills/ae-kb/references/analysis-workflow.md +19 -10
  110. package/skills/ae-kb/references/query-workflow.md +34 -17
  111. package/skills/ae-kb-discovery/SKILL.md +4 -3
  112. package/skills/ae-onboarding/SKILL.md +3 -3
  113. package/dist/context-WJQGJD6F.js +0 -139
  114. package/dist/{data-integration-KMJWYAKK.js → data-integration-SCYYZLWI.js} +4 -4
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  evalApi
4
- } from "./chunk-M2OCZRVX.js";
4
+ } from "./chunk-6VLHJKDD.js";
5
5
  import {
6
6
  assertOutputPathAvailable,
7
7
  clientWaitTimeoutSeconds,
@@ -10,28 +10,28 @@ import {
10
10
  waitForAnalysisRun,
11
11
  withAsyncArtifactLifecycle,
12
12
  withInterruptSignal
13
- } from "./chunk-ZSKLELL7.js";
13
+ } from "./chunk-LSELMDKQ.js";
14
14
  import {
15
15
  createCapabilityCommand,
16
16
  definitionIntentSnapshotFlag,
17
17
  modelDefinitionIntentSnapshotFlag
18
- } from "./chunk-KAZ5FWPB.js";
18
+ } from "./chunk-3FSYICDW.js";
19
19
  import {
20
20
  registerCapabilityGatewayRoute,
21
21
  resolveGatewayDomain
22
22
  } from "./chunk-AWW2T2WL.js";
23
23
  import {
24
24
  EvalApiError
25
- } from "./chunk-L7MT53VM.js";
25
+ } from "./chunk-PWG5IGCP.js";
26
26
  import {
27
27
  unwrapOutputData,
28
28
  withOutputMetadata
29
- } from "./chunk-N2QILIGH.js";
29
+ } from "./chunk-4MOCV6HU.js";
30
30
  import {
31
31
  normalizeResourceUrlFields,
32
32
  normalizeResourceUrls,
33
33
  resolvePublicWebHost
34
- } from "./chunk-GTENC5CO.js";
34
+ } from "./chunk-IAZ4AMVY.js";
35
35
  import {
36
36
  CapabilityGatewayError,
37
37
  buildCapabilityGatewayUrl,
@@ -45,13 +45,17 @@ import {
45
45
  uploadInputFile,
46
46
  validateCapability,
47
47
  validateCapabilityWithEnvelope
48
- } from "./chunk-WG27BD67.js";
48
+ } from "./chunk-7KBENPQF.js";
49
49
  import {
50
50
  getCliToken
51
- } from "./chunk-UWQXGF44.js";
51
+ } from "./chunk-FKTVD63C.js";
52
+ import "./chunk-FEYZBUFQ.js";
52
53
  import "./chunk-IGU3R2JD.js";
53
- import "./chunk-MTK4ZE7W.js";
54
54
  import {
55
+ logger
56
+ } from "./chunk-MTK4ZE7W.js";
57
+ import {
58
+ CliApiError,
55
59
  CliValidationError
56
60
  } from "./chunk-3ZQY7SLZ.js";
57
61
 
@@ -3344,8 +3348,8 @@ function validateEvidenceLinks(item2) {
3344
3348
  let evidenceLink = false;
3345
3349
  if ("evidence_links" in item2) {
3346
3350
  evidenceLink = array2(item2.evidence_links, "items[].evidence_links").some((value) => {
3347
- const link = object(value, "items[].evidence_links[]");
3348
- return typeof link.url === "string" && !!link.url.trim();
3351
+ const link2 = object(value, "items[].evidence_links[]");
3352
+ return typeof link2.url === "string" && !!link2.url.trim();
3349
3353
  });
3350
3354
  }
3351
3355
  if (!sourceLink && !evidenceLink) {
@@ -4330,14 +4334,99 @@ function validateReportMetadataResolutions(ctx) {
4330
4334
  }
4331
4335
  }
4332
4336
 
4337
+ // src/commands/te-analysis/report/display.ts
4338
+ var displayFields = ["show_values", "date_annotations", "sort", "retention", "funnel", "pie", "interval"];
4339
+ var ordinaryModels = ["event", "retention", "funnel", "distribution", "interval", "prop_analysis"];
4340
+ function validateDisplayPresentation(value, model) {
4341
+ const supplied = displayFields.filter((field) => Object.hasOwn(value, field));
4342
+ if (supplied.length === 0) return;
4343
+ if (model && !ordinaryModels.includes(model)) fail("is supported only for ordinary analysis models.");
4344
+ if (Object.hasOwn(value, "show_values")) {
4345
+ boolean(value.show_values, "show_values");
4346
+ if (model === "distribution") fail(".show_values is not supported for distribution.");
4347
+ }
4348
+ if (Object.hasOwn(value, "date_annotations")) {
4349
+ const annotations = object2(value.date_annotations, "date_annotations", ["tag_keys", "include_untagged"]);
4350
+ if (Object.hasOwn(annotations, "tag_keys")) {
4351
+ if (!Array.isArray(annotations.tag_keys) || annotations.tag_keys.some((key) => typeof key !== "string" || !key.trim() || key === "__UNGROUPED__")) {
4352
+ fail(".date_annotations.tag_keys must be an array of nonblank category keys; use include_untagged for uncategorized annotations.");
4353
+ }
4354
+ }
4355
+ if (Object.hasOwn(annotations, "include_untagged")) boolean(annotations.include_untagged, "date_annotations.include_untagged");
4356
+ }
4357
+ if (Object.hasOwn(value, "sort")) {
4358
+ onlyModels(model, ["event", "interval", "prop_analysis"], "sort");
4359
+ const sort = object2(value.sort, "sort", ["by", "direction"]);
4360
+ enumeration(sort.by, ["value", "group_name"], "sort.by");
4361
+ enumeration(sort.direction, ["asc", "desc"], "sort.direction");
4362
+ }
4363
+ if (Object.hasOwn(value, "retention")) {
4364
+ onlyModels(model, ["retention"], "retention");
4365
+ const retention = object2(value.retention, "retention", ["key_periods", "trend_value", "cohort_display_grain", "table_rows"]);
4366
+ if (Object.hasOwn(retention, "key_periods")) {
4367
+ const periods = object2(retention.key_periods, "retention.key_periods", ["mode", "day", "week", "month"]);
4368
+ if (Object.hasOwn(periods, "mode")) enumeration(periods.mode, ["all", "selected"], "retention.key_periods.mode");
4369
+ for (const unit of ["day", "week", "month"]) {
4370
+ if (!Object.hasOwn(periods, unit)) continue;
4371
+ const indexes = periods[unit];
4372
+ if (!Array.isArray(indexes) || indexes.length === 0 || indexes.some((index) => typeof index !== "number" || !Number.isInteger(index) || index < 0 || index > 2147483646)) {
4373
+ fail(`.retention.key_periods.${unit} must be a non-empty array of elapsed integer periods, 0..2147483646 (0=current, 1=next).`);
4374
+ }
4375
+ }
4376
+ }
4377
+ if (Object.hasOwn(retention, "trend_value")) enumeration(retention.trend_value, ["rate", "users"], "retention.trend_value");
4378
+ if (Object.hasOwn(retention, "cohort_display_grain")) enumeration(retention.cohort_display_grain, ["day", "week", "month"], "retention.cohort_display_grain");
4379
+ if (Object.hasOwn(retention, "table_rows")) enumeration(retention.table_rows, ["date", "group"], "retention.table_rows");
4380
+ }
4381
+ if (Object.hasOwn(value, "funnel")) {
4382
+ onlyModels(model, ["funnel"], "funnel");
4383
+ const funnel = object2(value.funnel, "funnel", ["result_view", "table_detail"]);
4384
+ if (Object.hasOwn(funnel, "result_view")) enumeration(funnel.result_view, ["conversion", "drop_off"], "funnel.result_view");
4385
+ if (Object.hasOwn(funnel, "table_detail")) enumeration(funnel.table_detail, ["summary", "steps"], "funnel.table_detail");
4386
+ }
4387
+ if (Object.hasOwn(value, "pie")) {
4388
+ onlyModels(model, ["event", "prop_analysis"], "pie");
4389
+ const pie = object2(value.pie, "pie", ["show_percentage", "group_limit", "max_charts"]);
4390
+ if (Object.hasOwn(pie, "show_percentage")) boolean(pie.show_percentage, "pie.show_percentage");
4391
+ if (Object.hasOwn(pie, "group_limit")) enumeration(pie.group_limit, [10, 15, 20, 30, 50], "pie.group_limit");
4392
+ if (Object.hasOwn(pie, "max_charts")) {
4393
+ onlyModels(model, ["event"], "pie.max_charts");
4394
+ enumeration(pie.max_charts, [1, 2, 4, 6], "pie.max_charts");
4395
+ }
4396
+ }
4397
+ if (Object.hasOwn(value, "interval")) {
4398
+ onlyModels(model, ["interval"], "interval");
4399
+ const interval = object2(value.interval, "interval", ["histogram_value"]);
4400
+ enumeration(interval.histogram_value, ["users", "occurrences"], "interval.histogram_value");
4401
+ }
4402
+ }
4403
+ function object2(value, path, keys) {
4404
+ if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).length === 0 || Object.keys(value).some((key) => !keys.includes(key))) {
4405
+ fail(`.${path} must be a non-empty object containing only ${keys.join(", ")}. Omit fields to preserve saved values; null is not a reset.`);
4406
+ }
4407
+ return value;
4408
+ }
4409
+ function boolean(value, path) {
4410
+ if (typeof value !== "boolean") fail(`.${path} must be a boolean.`);
4411
+ }
4412
+ function enumeration(value, choices, path) {
4413
+ if (!choices.includes(value)) fail(`.${path} must be one of ${choices.join(", ")}.`);
4414
+ }
4415
+ function onlyModels(model, models, path) {
4416
+ if (model && !models.includes(model)) fail(`.${path} supports only ${models.join(", ")} reports.`);
4417
+ }
4418
+ function fail(message) {
4419
+ throw new Error(`--presentation${message.startsWith(".") ? "" : " "}${message}`);
4420
+ }
4421
+
4333
4422
  // src/commands/te-analysis/report/presentation.ts
4334
4423
  var reportPresentationFlag = {
4335
4424
  name: "presentation",
4336
4425
  type: "json",
4337
4426
  required: false,
4338
- desc: 'Optional top-level event-report display JSON: chart_type (line|combo|bar|stacked|cumulative|pie), table_layout (date|event|group), series [{metric_index:1,type:"bar"|"line",axis:"primary"|"secondary"}]. Line/combo/cumulative require a non-total time_particle_size. Metric indexes are 1-based definition.metrics positions. Series is a subset patch; [] resets all series, and chart_type=line resets to pure primary-axis lines. Omit to preserve the saved chart/result-table layout on same-model updates. For a dashboard table card use analysis dashboard-report update --chart-type table.'
4427
+ desc: 'For report update, ordinary-model display intent also accepts show_values, date_annotations, sort, retention, funnel, pie and interval; use report_presentation.md for applicability. Omitted fields preserve; null is not a reset. Create keeps the original event-only fields. Optional top-level event-report display JSON: chart_type (line|combo|bar|stacked|cumulative|pie), table_layout (date|event|group), series [{metric_index:1,type:"bar"|"line",axis:"primary"|"secondary"}]. Line/combo/cumulative require a non-total time_particle_size. Metric indexes are 1-based definition.metrics positions. Series is a subset patch; [] resets all series, and chart_type=line resets to pure primary-axis lines. Omit to preserve the saved chart/result-table layout on same-model updates. For a dashboard table card use analysis dashboard-report update --chart-type table.'
4339
4428
  };
4340
- function validateReportPresentation(ctx) {
4429
+ function validateReportPresentation(ctx, allowDisplay = false) {
4341
4430
  if (!(ctx.has?.("presentation") ?? ctx.str("presentation") !== "")) return;
4342
4431
  const value = ctx.json("presentation");
4343
4432
  if (!value || typeof value !== "object" || Array.isArray(value)) {
@@ -4345,8 +4434,10 @@ function validateReportPresentation(ctx) {
4345
4434
  }
4346
4435
  const presentation = value;
4347
4436
  const keys = Object.keys(presentation);
4348
- if (keys.length === 0 || keys.some((key) => !["chart_type", "table_layout", "series"].includes(key))) {
4349
- throw new Error("--presentation accepts only chart_type, table_layout, and series; use semantic names, not raw QP fields.");
4437
+ const legacyFields = ["chart_type", "table_layout", "series"];
4438
+ const fields2 = allowDisplay ? [...legacyFields, ...displayFields] : legacyFields;
4439
+ if (keys.length === 0 || keys.some((key) => !fields2.includes(key))) {
4440
+ throw new Error(`--presentation accepts only ${fields2.join(", ")}; use semantic names, not raw QP fields.`);
4350
4441
  }
4351
4442
  if (presentation.chart_type === "table") {
4352
4443
  throw new Error("A table is a dashboard card display; use analysis dashboard-report update --chart-type table.");
@@ -4357,10 +4448,11 @@ function validateReportPresentation(ctx) {
4357
4448
  if (Object.hasOwn(presentation, "table_layout") && (typeof presentation.table_layout !== "string" || !["date", "event", "group"].includes(presentation.table_layout))) {
4358
4449
  throw new Error("--presentation.table_layout must be date, event, or group.");
4359
4450
  }
4360
- if (ctx.str("model-type") !== "" && ctx.str("model-type") !== "event") {
4451
+ if (ctx.str("model-type") !== "" && ctx.str("model-type") !== "event" && (!allowDisplay || keys.some((key) => legacyFields.includes(key)))) {
4361
4452
  throw new Error("--presentation is supported only for event reports.");
4362
4453
  }
4363
4454
  if (Object.hasOwn(presentation, "series")) validateSeries(presentation.series);
4455
+ if (allowDisplay) validateDisplayPresentation(presentation, ctx.str("model-type"));
4364
4456
  }
4365
4457
  function validateSeries(value) {
4366
4458
  if (!Array.isArray(value)) throw new Error("--presentation.series must be an array; [] resets all series.");
@@ -4440,13 +4532,13 @@ function validateReportUpdate(ctx) {
4440
4532
  throw new Error("--resolutions requires --definition.");
4441
4533
  }
4442
4534
  validateReportMetadataResolutions(ctx);
4443
- validateReportPresentation(ctx);
4535
+ validateReportPresentation(ctx, true);
4444
4536
  }
4445
4537
  var reportUpdate = createAnalysisCapabilityCommand({
4446
4538
  resource: "report",
4447
4539
  command: "update",
4448
4540
  capabilityId: "analysis.report.update",
4449
- description: "Update report metadata, AI QP definition, or event-report presentation through the capability gateway.",
4541
+ description: "Update report metadata, AI QP definition, or ordinary-model source presentation through the capability gateway.",
4450
4542
  flags: [
4451
4543
  projectIdFlag,
4452
4544
  { name: "report-id", type: "number", required: true, desc: "Report ID to update." },
@@ -5545,7 +5637,10 @@ var adhocBaseFlags = [
5545
5637
  metadataResolutionsFlag,
5546
5638
  requestIdFlag,
5547
5639
  useCacheFlag2,
5548
- zoneOffsetFlag,
5640
+ {
5641
+ ...zoneOffsetFlag,
5642
+ desc: "Omit for the server default. Fixed UTC offsets (-12..14) require project timezone conversion and a configured offset. Use 99 for stored local time, which is also the default when conversion is disabled."
5643
+ },
5549
5644
  fieldsFlag,
5550
5645
  clusterQueryScopeFlag,
5551
5646
  slaveClusterIdFlag
@@ -6722,8 +6817,15 @@ var drilldownContextIdFlag = {
6722
6817
  var userIdFlag = {
6723
6818
  name: "user-id",
6724
6819
  type: "string",
6725
- required: true,
6726
- desc: "Canonical user_id returned by analysis drilldown-entities run. Never guess or substitute another identity field."
6820
+ required: false,
6821
+ desc: "Canonical user_id returned by analysis drilldown-entities run. Pass exactly one of --user-id or --account-id."
6822
+ };
6823
+ var accountIdFlag = {
6824
+ name: "account-id",
6825
+ type: "string",
6826
+ required: false,
6827
+ sensitive: true,
6828
+ desc: "Exact #account_id in the project, such as a PlayFab ID. Pass exactly one of --user-id or --account-id."
6727
6829
  };
6728
6830
  var sequenceFlags = [
6729
6831
  propertiesFlag,
@@ -6743,6 +6845,7 @@ var drilldownUserEventsBaseFlags = [
6743
6845
  projectIdFlag,
6744
6846
  drilldownContextIdFlag,
6745
6847
  userIdFlag,
6848
+ accountIdFlag,
6746
6849
  ...sequenceFlags,
6747
6850
  requestIdFlag,
6748
6851
  useCacheFlag
@@ -6772,10 +6875,22 @@ function drilldownUserEventsExportInput(ctx) {
6772
6875
  });
6773
6876
  }
6774
6877
  function baseInput2(ctx) {
6878
+ const userId = optionalStringPreserveEmpty(ctx, "user-id");
6879
+ const accountId = optionalStringPreserveEmpty(ctx, "account-id");
6880
+ if (userId !== void 0 && accountId !== void 0) {
6881
+ throw new CliValidationError("Pass only one of --user-id or --account-id.", { code: "USER_IDENTITY_CONFLICT" });
6882
+ }
6883
+ if (accountId !== void 0 && !accountId.trim()) {
6884
+ throw new CliValidationError("--account-id must not be blank.", { code: "INVALID_ACCOUNT_ID" });
6885
+ }
6886
+ if (!userId?.trim() && accountId === void 0) {
6887
+ throw new CliValidationError("Pass one of --user-id or --account-id.", { code: "USER_ID_REQUIRED" });
6888
+ }
6775
6889
  return {
6776
6890
  project_id: ctx.num("project-id"),
6777
6891
  drilldown_context_id: ctx.str("drilldown-context-id"),
6778
- user_id: ctx.str("user-id"),
6892
+ user_id: userId,
6893
+ account_id: accountId,
6779
6894
  properties: optionalJson(ctx, "properties"),
6780
6895
  sort_order: optionalString(ctx, "sort-order"),
6781
6896
  event_name_filter: optionalString(ctx, "event-name-filter"),
@@ -6960,33 +7075,32 @@ var zoneOffsetFlag2 = {
6960
7075
  var autoRefreshCronFlag = {
6961
7076
  name: "auto-refresh-cron",
6962
7077
  type: "string",
6963
- required: false,
6964
- desc: "Optional Quartz cron expression for an existing enabled auto-refresh schedule. This does not enable auto refresh."
7078
+ desc: "Deprecated Quartz cron for existing scripts. Runs must be at least 15 minutes apart. Use --auto-refresh-schedule for new scripts."
6965
7079
  };
6966
- var tagAutoRefreshFlags = [
6967
- {
6968
- name: "enable-history-tag-backup",
6969
- type: "boolean",
6970
- required: false,
6971
- desc: "Save historical tag versions during scheduled refresh. Enabling requires periodic refresh. Omit on update to preserve the setting."
6972
- },
7080
+ var autoRefreshFlags = [
6973
7081
  {
6974
7082
  name: "enable-auto-refresh",
6975
7083
  type: "boolean",
6976
7084
  required: false,
6977
- desc: "Enable or disable periodic refresh. Omit to preserve the setting on update. Enabling on create requires a schedule."
6978
- },
6979
- {
6980
- ...autoRefreshCronFlag,
6981
- desc: "Quartz cron expression in the tag timezone. Enables periodic refresh. Mutually exclusive with --auto-refresh-schedule."
7085
+ desc: "Enable or disable periodic refresh. Omit on update to preserve the setting. A supplied schedule enables refresh."
6982
7086
  },
6983
7087
  {
6984
7088
  name: "auto-refresh-schedule",
6985
7089
  type: "json",
6986
7090
  required: false,
6987
- 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"}.'
7091
+ desc: 'Page-compatible schedule: frequency daily|daily_multiple|weekly|monthly. Use time HH:mm except daily_multiple, which requires hours (0-23) and minutes (0,15,30,45) arrays. Weekly requires weekdays (ISO 1-7); monthly requires month_days (1-31). Selected hours and minutes form all combinations. Example: {"frequency":"daily","time":"02:30"}.'
6988
7092
  }
6989
7093
  ];
7094
+ var tagAutoRefreshFlags = [
7095
+ {
7096
+ name: "enable-history-tag-backup",
7097
+ type: "boolean",
7098
+ required: false,
7099
+ desc: "Save historical tag versions during scheduled refresh. Enabling requires periodic refresh. Omit on update to preserve the setting."
7100
+ },
7101
+ ...autoRefreshFlags,
7102
+ autoRefreshCronFlag
7103
+ ];
6990
7104
  var entityIdFlag = {
6991
7105
  name: "entity-id",
6992
7106
  type: "number",
@@ -7228,16 +7342,12 @@ function clusterWriteInput(ctx, create) {
7228
7342
  authenticated_only: optionalBoolean(ctx, "authenticated-only"),
7229
7343
  remark: create ? void 0 : optionalString(ctx, "remark"),
7230
7344
  zone_offset: optionalNumber(ctx, "zone-offset"),
7231
- auto_refresh_cron: create ? void 0 : optionalString(ctx, "auto-refresh-cron"),
7345
+ ...autoRefreshInput(ctx, create, create ? void 0 : optionalString(ctx, autoRefreshCronFlag.name)),
7232
7346
  entity_id: create ? optionalNumber(ctx, "entity-id") : void 0
7233
7347
  });
7234
7348
  }
7235
- function tagWriteInput(ctx, create) {
7236
- const definitionRequest = optionalJson(ctx, "definition-request");
7237
- validateDefinitionRequest(create, definitionRequest);
7238
- const backup = optionalBoolean(ctx, "enable-history-tag-backup");
7349
+ function autoRefreshInput(ctx, create, cron) {
7239
7350
  const enabled = optionalBoolean(ctx, "enable-auto-refresh");
7240
- const cron = optionalString(ctx, "auto-refresh-cron");
7241
7351
  const schedule = optionalJson(ctx, "auto-refresh-schedule");
7242
7352
  if (cron !== void 0 && schedule !== void 0) {
7243
7353
  throw new Error("Pass only one of --auto-refresh-cron and --auto-refresh-schedule");
@@ -7245,11 +7355,22 @@ function tagWriteInput(ctx, create) {
7245
7355
  if (enabled === false && (cron !== void 0 || schedule !== void 0)) {
7246
7356
  throw new Error("Cannot set a schedule with --enable-auto-refresh false");
7247
7357
  }
7248
- if (backup === true && (enabled === false || create && schedule === void 0 && cron === void 0)) {
7249
- throw new Error("Enabling history tag backup requires periodic refresh with a schedule");
7358
+ if (create && enabled === true && schedule === void 0 && cron === void 0) {
7359
+ throw new Error("Enabling auto refresh on create requires --auto-refresh-schedule");
7250
7360
  }
7251
- if (create && enabled === true && cron === void 0 && schedule === void 0) {
7252
- throw new Error("Enabling auto refresh on create requires --auto-refresh-schedule or --auto-refresh-cron");
7361
+ return compactInput({
7362
+ enable_auto_refresh: enabled,
7363
+ auto_refresh_schedule: schedule,
7364
+ auto_refresh_cron: cron
7365
+ });
7366
+ }
7367
+ function tagWriteInput(ctx, create) {
7368
+ const definitionRequest = optionalJson(ctx, "definition-request");
7369
+ validateDefinitionRequest(create, definitionRequest);
7370
+ const refresh = autoRefreshInput(ctx, create, optionalString(ctx, autoRefreshCronFlag.name));
7371
+ const backup = optionalBoolean(ctx, "enable-history-tag-backup");
7372
+ if (backup === true && (refresh.enable_auto_refresh === false || create && refresh.auto_refresh_schedule === void 0 && refresh.auto_refresh_cron === void 0)) {
7373
+ throw new Error("Enabling history tag backup requires periodic refresh with a schedule");
7253
7374
  }
7254
7375
  return compactInput({
7255
7376
  project_id: ctx.num("project-id"),
@@ -7259,10 +7380,8 @@ function tagWriteInput(ctx, create) {
7259
7380
  authenticated_only: optionalBoolean(ctx, "authenticated-only"),
7260
7381
  remark: create ? void 0 : optionalString(ctx, "remark"),
7261
7382
  zone_offset: optionalNumber(ctx, "zone-offset"),
7262
- enable_auto_refresh: enabled,
7263
7383
  enable_history_tag_backup: backup,
7264
- auto_refresh_cron: cron,
7265
- auto_refresh_schedule: schedule,
7384
+ ...refresh,
7266
7385
  entity_id: create ? optionalNumber(ctx, "entity-id") : void 0
7267
7386
  });
7268
7387
  }
@@ -7432,7 +7551,8 @@ var commands42 = [
7432
7551
  clusterDefinitionRequestFlag,
7433
7552
  authenticatedOnlyFlag,
7434
7553
  zoneOffsetFlag2,
7435
- entityIdFlag
7554
+ entityIdFlag,
7555
+ ...autoRefreshFlags
7436
7556
  ], "write", (ctx) => clusterWriteInput(ctx, true)),
7437
7557
  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.", [
7438
7558
  projectIdFlag,
@@ -7442,7 +7562,8 @@ var commands42 = [
7442
7562
  authenticatedOnlyFlag,
7443
7563
  remarkFlag,
7444
7564
  zoneOffsetFlag2,
7445
- autoRefreshCronFlag
7565
+ ...autoRefreshFlags,
7566
+ { ...autoRefreshCronFlag, desc: `${autoRefreshCronFlag.desc} Requires an already enabled refresh plan.` }
7446
7567
  ], "high-risk-write", (ctx) => clusterWriteInput(ctx, false)),
7447
7568
  idImportCapability(capability("user-cluster", "create-id", "analysis.user_cluster.create_id", "Create a cluster by mapping imported values to an analysis entity.", [
7448
7569
  projectIdFlag,
@@ -11298,6 +11419,143 @@ var systemMonitoringCommands = [
11298
11419
  })
11299
11420
  ];
11300
11421
 
11422
+ // src/commands/te-analysis/system/openapi-token.ts
11423
+ import { link, lstat as lstat3, mkdtemp, rm as rm4, writeFile } from "fs/promises";
11424
+ import { dirname as dirname4, join as join2, resolve as resolve5 } from "path";
11425
+ var MAX_BATCH_MEMBERS = 200;
11426
+ var ZONED_TIMESTAMP = /^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})$/;
11427
+ function batchInput2(ctx) {
11428
+ const companyId = ctx.num("company-id");
11429
+ if (!Number.isInteger(companyId) || companyId < 1 || companyId > 2147483647) {
11430
+ throw new CliValidationError("--company-id must be a positive company ID.");
11431
+ }
11432
+ const openIds = ctx.json("open-ids");
11433
+ if (!Array.isArray(openIds) || openIds.length === 0 || openIds.length > MAX_BATCH_MEMBERS || !openIds.every((id) => typeof id === "string" && id.trim().length > 0)) {
11434
+ throw new CliValidationError("--open-ids must be a JSON array of 1 to 200 nonblank member open IDs.");
11435
+ }
11436
+ const expiry = ctx.str("expires-at");
11437
+ if (!ZONED_TIMESTAMP.test(expiry) || !Number.isFinite(Date.parse(expiry)) || !(/* @__PURE__ */ new Date(`${expiry.slice(0, 10)}T00:00:00Z`)).toISOString().startsWith(expiry.slice(0, 10))) {
11438
+ throw new CliValidationError("--expires-at must be an ISO-8601 timestamp with an explicit timezone.");
11439
+ }
11440
+ return { company_id: companyId, open_ids: [...new Set(openIds.map((id) => id.trim()))], expires_at: expiry };
11441
+ }
11442
+ function responseRecord(result) {
11443
+ if (result === null || typeof result !== "object" || Array.isArray(result)) throw invalidTokenResponse();
11444
+ return result;
11445
+ }
11446
+ function invalidTokenResponse() {
11447
+ return new CliApiError("Invalid OpenAPI token response from the server.", { code: "INVALID_OPENAPI_TOKEN_RESPONSE" });
11448
+ }
11449
+ function batchSummary(result) {
11450
+ const { items, generated_count, skipped_count, failed_count } = responseRecord(result);
11451
+ if (!Array.isArray(items) || ![generated_count, skipped_count, failed_count].every(
11452
+ (count) => typeof count === "number" && Number.isSafeInteger(count) && count >= 0
11453
+ )) throw invalidTokenResponse();
11454
+ const summaries = items.map((value) => {
11455
+ const { open_id, status, expires_at, code } = responseRecord(value);
11456
+ if (typeof open_id !== "string" || status !== "generated" && status !== "skipped" && status !== "failed") {
11457
+ throw invalidTokenResponse();
11458
+ }
11459
+ return {
11460
+ open_id,
11461
+ status,
11462
+ ...typeof expires_at === "string" && ZONED_TIMESTAMP.test(expires_at) ? { expires_at } : {},
11463
+ ...typeof code === "string" && /^[A-Z][A-Z0-9_]{0,79}$/.test(code) ? { code } : {}
11464
+ };
11465
+ });
11466
+ return { items: summaries, generated_count, skipped_count, failed_count };
11467
+ }
11468
+ function outputError(error) {
11469
+ if (error.code === "EEXIST") {
11470
+ return new CliValidationError("--output already exists. Choose a new file.", { code: "OUTPUT_ALREADY_EXISTS" });
11471
+ }
11472
+ return new CliValidationError("Cannot write the OpenAPI token to --output.", { code: "OPENAPI_TOKEN_OUTPUT_FAILED" });
11473
+ }
11474
+ async function requireNewOutput(file) {
11475
+ try {
11476
+ await lstat3(file);
11477
+ } catch (error) {
11478
+ if (error.code === "ENOENT") return;
11479
+ throw outputError(error);
11480
+ }
11481
+ throw outputError({ code: "EEXIST" });
11482
+ }
11483
+ async function writeToken(file, token) {
11484
+ let directory;
11485
+ try {
11486
+ directory = await mkdtemp(join2(dirname4(file), ".ae-openapi-token-"));
11487
+ const temporary = join2(directory, "token");
11488
+ await writeFile(temporary, `${token}
11489
+ `, { mode: 384, flag: "wx" });
11490
+ await link(temporary, file);
11491
+ } catch (error) {
11492
+ throw outputError(error);
11493
+ } finally {
11494
+ if (directory) {
11495
+ await rm4(directory, { recursive: true, force: true }).catch(() => {
11496
+ logger.warn("Could not remove the private OpenAPI token staging directory.");
11497
+ });
11498
+ }
11499
+ }
11500
+ }
11501
+ var systemOpenApiTokenCommands = [
11502
+ createAnalysisCapabilityCommand({
11503
+ resource: "system openapi-token",
11504
+ command: "batch-generate",
11505
+ capabilityId: "system.openapi_token.batch_generate",
11506
+ description: "Generate OpenAPI tokens for selected company members and report per-member results.",
11507
+ helpText: "Discover member open IDs with system member list. Use --dry-run to review the batch and --yes for explicit non-interactive confirmation.",
11508
+ flags: [
11509
+ { name: "company-id", type: "number", required: true, min: 1, max: 2147483647, desc: "Company ID." },
11510
+ { name: "open-ids", type: "json", required: true, desc: "JSON array of 1 to 200 company member open IDs." },
11511
+ { name: "expires-at", type: "string", required: true, desc: "Expiration timestamp with an explicit ISO-8601 timezone." }
11512
+ ],
11513
+ risk: "high-risk-write",
11514
+ buildInput: batchInput2,
11515
+ prepareExecuteInput: (_ctx, input2) => ({ ...input2, yes: true }),
11516
+ postProcess: batchSummary
11517
+ }),
11518
+ createAnalysisCapabilityCommand({
11519
+ resource: "system openapi-token",
11520
+ command: "get",
11521
+ capabilityId: "system.openapi_token.get",
11522
+ description: "Get personal OpenAPI token status and expiration for the current account.",
11523
+ helpText: "Supply --output to save an active token to a new private local file. The output envelope contains status and file metadata.",
11524
+ flags: [
11525
+ { name: "output", type: "string", sensitive: true, desc: "Save an active token to this new private local file." }
11526
+ ],
11527
+ risk: "read",
11528
+ buildInput: (ctx) => {
11529
+ const file = ctx.str("output");
11530
+ if ((ctx.has?.("output") || file) && !file.trim()) {
11531
+ throw new CliValidationError("--output must be a nonblank local file path.");
11532
+ }
11533
+ return {};
11534
+ },
11535
+ prepareExecuteInput: async (ctx, input2) => {
11536
+ const file = ctx.str("output");
11537
+ if (!file) return input2;
11538
+ await requireNewOutput(resolve5(file));
11539
+ return { ...input2, reveal: true };
11540
+ },
11541
+ postProcess: async (result, input2, ctx) => {
11542
+ const { status, expires_at, token } = responseRecord(result);
11543
+ if (status !== "active" && status !== "expired" && status !== "not_generated" && status !== "disabled") {
11544
+ throw invalidTokenResponse();
11545
+ }
11546
+ const summary = {
11547
+ status,
11548
+ ...typeof expires_at === "string" && ZONED_TIMESTAMP.test(expires_at) ? { expires_at } : {}
11549
+ };
11550
+ if (input2.reveal !== true || status !== "active") return summary;
11551
+ if (typeof token !== "string" || !token.trim() || /[\r\n]/.test(token)) throw invalidTokenResponse();
11552
+ const outputFile = resolve5(ctx.str("output"));
11553
+ await writeToken(outputFile, token);
11554
+ return { ...summary, output_file: outputFile };
11555
+ }
11556
+ })
11557
+ ];
11558
+
11301
11559
  // src/core/ta-password-encryption.ts
11302
11560
  import { constants, publicEncrypt } from "crypto";
11303
11561
  var TA_PASSWORD_PUBLIC_KEY = [
@@ -11462,6 +11720,7 @@ var systemUsageCommands = [
11462
11720
  var commands83 = [
11463
11721
  ...systemUsageCommands,
11464
11722
  ...systemIdentityCommands,
11723
+ ...systemOpenApiTokenCommands,
11465
11724
  ...systemSecurityCommands,
11466
11725
  ...systemMonitoringCommands,
11467
11726
  ...systemConfigurationCommands
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createCapabilityCommand
4
- } from "./chunk-KAZ5FWPB.js";
4
+ } from "./chunk-3FSYICDW.js";
5
5
  import {
6
6
  registerCapabilityGatewayRoute,
7
7
  resolveGatewayDomain
@@ -9,19 +9,21 @@ import {
9
9
  import {
10
10
  unwrapOutputData,
11
11
  withOutputMetadata
12
- } from "./chunk-N2QILIGH.js";
13
- import "./chunk-GTENC5CO.js";
12
+ } from "./chunk-4MOCV6HU.js";
13
+ import "./chunk-IAZ4AMVY.js";
14
14
  import {
15
15
  CapabilityGatewayError,
16
16
  buildCapabilityGatewayUrl,
17
17
  requestCapabilityGatewayWithEnvelope,
18
18
  sourceLoggedFetch
19
- } from "./chunk-WG27BD67.js";
19
+ } from "./chunk-7KBENPQF.js";
20
20
  import {
21
- SecureStoreAuthError,
22
21
  getCliToken,
23
22
  internalCallSourceHeaders
24
- } from "./chunk-UWQXGF44.js";
23
+ } from "./chunk-FKTVD63C.js";
24
+ import {
25
+ SecureStoreAuthError
26
+ } from "./chunk-FEYZBUFQ.js";
25
27
  import {
26
28
  getActiveHost,
27
29
  parseJsonRequest,