@thinkingai/ae-cli 6.0.63 → 6.0.64

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 (75) hide show
  1. package/README.md +8 -3
  2. package/README.zh.md +8 -3
  3. package/dist/{ai-monitor-X5GL44JT.js → ai-monitor-ABPXAOYL.js} +5 -5
  4. package/dist/ai-monitor.js +6 -6
  5. package/dist/{auth-SPQ46XQ3.js → auth-EV4FSIFI.js} +3 -3
  6. package/dist/{capability-JZP4KXZC.js → capability-B35ZQSSB.js} +3 -3
  7. package/dist/{chunk-E457FREE.js → chunk-434DSEOC.js} +6 -5
  8. package/dist/{chunk-F7TCQPQX.js → chunk-4COJB2CS.js} +1 -1
  9. package/dist/{chunk-YJYC5PLL.js → chunk-4CRZ2YUC.js} +2 -1
  10. package/dist/{chunk-RYY5NJK3.js → chunk-66F7SOGR.js} +2 -2
  11. package/dist/{chunk-PRCHMOWT.js → chunk-7AQ5Y6F2.js} +1 -1
  12. package/dist/{chunk-FGGEF7MI.js → chunk-7TENODN4.js} +2 -2
  13. package/dist/{chunk-VR2D54AA.js → chunk-7XTWP3NB.js} +1 -1
  14. package/dist/{chunk-6HOM2FOJ.js → chunk-A3PREN6Q.js} +4 -14
  15. package/dist/{chunk-2VKMHNUU.js → chunk-KVTFUP5T.js} +3 -3
  16. package/dist/{compat-check-JD5D77ET.js → compat-check-V3NGDQA5.js} +1 -1
  17. package/dist/{config-IIMRATTP.js → config-7OPBS5RW.js} +3 -3
  18. package/dist/context-WAR22IGB.js +349 -0
  19. package/dist/index.js +22 -22
  20. package/dist/{metadata-ZVPG2MIA.js → metadata-OROUBOO5.js} +5 -5
  21. package/dist/{personal-semantic-preference-YNCV4QG3.js → personal-semantic-preference-UQXUQJO3.js} +40 -15
  22. package/dist/{project-semantic-E7ZAQL5S.js → project-semantic-LEU2SN6J.js} +262 -14
  23. package/dist/{sync-Y4OZRQAY.js → sync-JXJUSBN3.js} +2 -2
  24. package/dist/{te-agent-RKAUTYJZ.js → te-agent-W67K6QTR.js} +1 -1
  25. package/dist/{te-analysis-7N5VC4JB.js → te-analysis-TJ7XHW6J.js} +306 -49
  26. package/dist/{te-community-SIA2UHTS.js → te-community-YNFYG42J.js} +4 -4
  27. package/dist/{te-dataops-5MJQCODU.js → te-dataops-GASA7SEG.js} +721 -217
  28. package/dist/{te-engage-ZTLOMKO3.js → te-engage-4CGFYLP6.js} +4 -4
  29. package/dist/{te-kb-LDL3MF2Y.js → te-kb-2ZYZKMDW.js} +27 -7
  30. package/dist/{te-team-JOWHCMZA.js → te-team-ZFQANIPN.js} +4 -4
  31. package/dist/{things-DOQ2L3O2.js → things-AYKSVWGZ.js} +1 -1
  32. package/dist/{update-KUS6TCPB.js → update-EDWNZQ6B.js} +2 -2
  33. package/package.json +4 -3
  34. package/skills/ae-analysis/SKILL.md +41 -16
  35. package/skills/ae-analysis/references/adhoc_export.md +1 -1
  36. package/skills/ae-analysis/references/adhoc_run.md +8 -2
  37. package/skills/ae-analysis/references/analysis_drilldown_contract.md +1 -1
  38. package/skills/ae-analysis/references/audience_scheduling.md +30 -0
  39. package/skills/ae-analysis/references/business_semantics_workspace.md +57 -0
  40. package/skills/ae-analysis/references/command_index.md +18 -13
  41. package/skills/ae-analysis/references/context_prepare.md +49 -0
  42. package/skills/ae-analysis/references/drilldown_entities_export.md +1 -1
  43. package/skills/ae-analysis/references/drilldown_entities_run.md +1 -1
  44. package/skills/ae-analysis/references/drilldown_user_events_export.md +3 -1
  45. package/skills/ae-analysis/references/drilldown_user_events_run.md +2 -1
  46. package/skills/ae-analysis/references/governance_recommendation_export.md +1 -1
  47. package/skills/ae-analysis/references/personal_semantic_preference_add.md +5 -1
  48. package/skills/ae-analysis/references/personal_semantic_preference_get.md +4 -2
  49. package/skills/ae-analysis/references/personal_semantic_preference_list.md +7 -6
  50. package/skills/ae-analysis/references/personal_semantic_preference_submit.md +1 -1
  51. package/skills/ae-analysis/references/personal_semantic_preference_update.md +5 -1
  52. package/skills/ae-analysis/references/project_info_get.md +4 -0
  53. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +1 -1
  54. package/skills/ae-analysis/references/project_semantic_setup.md +60 -0
  55. package/skills/ae-analysis/references/report_get.md +2 -0
  56. package/skills/ae-analysis/references/report_presentation.md +55 -0
  57. package/skills/ae-analysis/references/report_update.md +4 -2
  58. package/skills/ae-analysis/references/system_openapi_token_batch_generate.md +20 -0
  59. package/skills/ae-analysis/references/system_openapi_token_get.md +14 -0
  60. package/skills/ae-analysis/references/user_cluster_create.md +3 -1
  61. package/skills/ae-analysis/references/user_cluster_models.md +2 -0
  62. package/skills/ae-analysis/references/user_cluster_update.md +5 -3
  63. package/skills/ae-analysis/references/user_tag_create.md +4 -22
  64. package/skills/ae-analysis/references/user_tag_models.md +8 -0
  65. package/skills/ae-analysis/references/user_tag_update.md +6 -14
  66. package/skills/ae-analysis/scripts/read-semantic-catalog.mjs +40 -0
  67. package/skills/ae-dataops/SKILL.md +9 -6
  68. package/skills/ae-dataops/references/dataops-flow-create.md +64 -47
  69. package/skills/ae-dataops/references/dataops-flow-monitor.md +4 -2
  70. package/skills/ae-dataops/references/dataops-flow-python.md +109 -0
  71. package/skills/ae-kb/SKILL.md +10 -5
  72. package/skills/ae-kb/references/analysis-workflow.md +19 -10
  73. package/skills/ae-kb/references/query-workflow.md +34 -17
  74. package/skills/ae-kb-discovery/SKILL.md +4 -3
  75. package/dist/context-BXHIPIIX.js +0 -138
@@ -7,7 +7,7 @@ import {
7
7
  waitForAnalysisRun,
8
8
  withAsyncArtifactLifecycle,
9
9
  withInterruptSignal
10
- } from "./chunk-RYY5NJK3.js";
10
+ } from "./chunk-66F7SOGR.js";
11
11
  import {
12
12
  evalApi
13
13
  } from "./chunk-BQFLABJQ.js";
@@ -18,7 +18,7 @@ import {
18
18
  createCapabilityCommand,
19
19
  definitionIntentSnapshotFlag,
20
20
  modelDefinitionIntentSnapshotFlag
21
- } from "./chunk-E457FREE.js";
21
+ } from "./chunk-434DSEOC.js";
22
22
  import {
23
23
  registerCapabilityGatewayRoute,
24
24
  resolveGatewayDomain
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  unwrapOutputData,
28
28
  withOutputMetadata
29
- } from "./chunk-VR2D54AA.js";
29
+ } from "./chunk-7XTWP3NB.js";
30
30
  import {
31
31
  CapabilityGatewayError,
32
32
  buildCapabilityGatewayUrl,
@@ -40,16 +40,18 @@ import {
40
40
  uploadInputFile,
41
41
  validateCapability,
42
42
  validateCapabilityWithEnvelope
43
- } from "./chunk-6HOM2FOJ.js";
43
+ } from "./chunk-A3PREN6Q.js";
44
44
  import "./chunk-NNK3JBH4.js";
45
- import "./chunk-YJYC5PLL.js";
45
+ import "./chunk-4CRZ2YUC.js";
46
46
  import "./chunk-PUSFEC6B.js";
47
47
  import {
48
48
  getCliToken
49
49
  } from "./chunk-PLNS5J33.js";
50
50
  import "./chunk-AMURHMS3.js";
51
51
  import {
52
- CliValidationError
52
+ CliApiError,
53
+ CliValidationError,
54
+ logger
53
55
  } from "./chunk-R2SVAO4G.js";
54
56
 
55
57
  // src/commands/te-analysis/capability-shared.ts
@@ -3385,8 +3387,8 @@ function validateEvidenceLinks(item2) {
3385
3387
  let evidenceLink = false;
3386
3388
  if ("evidence_links" in item2) {
3387
3389
  evidenceLink = array2(item2.evidence_links, "items[].evidence_links").some((value) => {
3388
- const link = object(value, "items[].evidence_links[]");
3389
- return typeof link.url === "string" && !!link.url.trim();
3390
+ const link2 = object(value, "items[].evidence_links[]");
3391
+ return typeof link2.url === "string" && !!link2.url.trim();
3390
3392
  });
3391
3393
  }
3392
3394
  if (!sourceLink && !evidenceLink) {
@@ -4370,14 +4372,99 @@ function validateReportMetadataResolutions(ctx) {
4370
4372
  }
4371
4373
  }
4372
4374
 
4375
+ // src/commands/te-analysis/report/display.ts
4376
+ var displayFields = ["show_values", "date_annotations", "sort", "retention", "funnel", "pie", "interval"];
4377
+ var ordinaryModels = ["event", "retention", "funnel", "distribution", "interval", "prop_analysis"];
4378
+ function validateDisplayPresentation(value, model) {
4379
+ const supplied = displayFields.filter((field) => Object.hasOwn(value, field));
4380
+ if (supplied.length === 0) return;
4381
+ if (model && !ordinaryModels.includes(model)) fail("is supported only for ordinary analysis models.");
4382
+ if (Object.hasOwn(value, "show_values")) {
4383
+ boolean(value.show_values, "show_values");
4384
+ if (model === "distribution") fail(".show_values is not supported for distribution.");
4385
+ }
4386
+ if (Object.hasOwn(value, "date_annotations")) {
4387
+ const annotations = object2(value.date_annotations, "date_annotations", ["tag_keys", "include_untagged"]);
4388
+ if (Object.hasOwn(annotations, "tag_keys")) {
4389
+ if (!Array.isArray(annotations.tag_keys) || annotations.tag_keys.some((key) => typeof key !== "string" || !key.trim() || key === "__UNGROUPED__")) {
4390
+ fail(".date_annotations.tag_keys must be an array of nonblank category keys; use include_untagged for uncategorized annotations.");
4391
+ }
4392
+ }
4393
+ if (Object.hasOwn(annotations, "include_untagged")) boolean(annotations.include_untagged, "date_annotations.include_untagged");
4394
+ }
4395
+ if (Object.hasOwn(value, "sort")) {
4396
+ onlyModels(model, ["event", "interval", "prop_analysis"], "sort");
4397
+ const sort = object2(value.sort, "sort", ["by", "direction"]);
4398
+ enumeration(sort.by, ["value", "group_name"], "sort.by");
4399
+ enumeration(sort.direction, ["asc", "desc"], "sort.direction");
4400
+ }
4401
+ if (Object.hasOwn(value, "retention")) {
4402
+ onlyModels(model, ["retention"], "retention");
4403
+ const retention = object2(value.retention, "retention", ["key_periods", "trend_value", "cohort_display_grain", "table_rows"]);
4404
+ if (Object.hasOwn(retention, "key_periods")) {
4405
+ const periods = object2(retention.key_periods, "retention.key_periods", ["mode", "day", "week", "month"]);
4406
+ if (Object.hasOwn(periods, "mode")) enumeration(periods.mode, ["all", "selected"], "retention.key_periods.mode");
4407
+ for (const unit of ["day", "week", "month"]) {
4408
+ if (!Object.hasOwn(periods, unit)) continue;
4409
+ const indexes = periods[unit];
4410
+ if (!Array.isArray(indexes) || indexes.length === 0 || indexes.some((index) => typeof index !== "number" || !Number.isInteger(index) || index < 0 || index > 2147483646)) {
4411
+ fail(`.retention.key_periods.${unit} must be a non-empty array of elapsed integer periods, 0..2147483646 (0=current, 1=next).`);
4412
+ }
4413
+ }
4414
+ }
4415
+ if (Object.hasOwn(retention, "trend_value")) enumeration(retention.trend_value, ["rate", "users"], "retention.trend_value");
4416
+ if (Object.hasOwn(retention, "cohort_display_grain")) enumeration(retention.cohort_display_grain, ["day", "week", "month"], "retention.cohort_display_grain");
4417
+ if (Object.hasOwn(retention, "table_rows")) enumeration(retention.table_rows, ["date", "group"], "retention.table_rows");
4418
+ }
4419
+ if (Object.hasOwn(value, "funnel")) {
4420
+ onlyModels(model, ["funnel"], "funnel");
4421
+ const funnel = object2(value.funnel, "funnel", ["result_view", "table_detail"]);
4422
+ if (Object.hasOwn(funnel, "result_view")) enumeration(funnel.result_view, ["conversion", "drop_off"], "funnel.result_view");
4423
+ if (Object.hasOwn(funnel, "table_detail")) enumeration(funnel.table_detail, ["summary", "steps"], "funnel.table_detail");
4424
+ }
4425
+ if (Object.hasOwn(value, "pie")) {
4426
+ onlyModels(model, ["event", "prop_analysis"], "pie");
4427
+ const pie = object2(value.pie, "pie", ["show_percentage", "group_limit", "max_charts"]);
4428
+ if (Object.hasOwn(pie, "show_percentage")) boolean(pie.show_percentage, "pie.show_percentage");
4429
+ if (Object.hasOwn(pie, "group_limit")) enumeration(pie.group_limit, [10, 15, 20, 30, 50], "pie.group_limit");
4430
+ if (Object.hasOwn(pie, "max_charts")) {
4431
+ onlyModels(model, ["event"], "pie.max_charts");
4432
+ enumeration(pie.max_charts, [1, 2, 4, 6], "pie.max_charts");
4433
+ }
4434
+ }
4435
+ if (Object.hasOwn(value, "interval")) {
4436
+ onlyModels(model, ["interval"], "interval");
4437
+ const interval = object2(value.interval, "interval", ["histogram_value"]);
4438
+ enumeration(interval.histogram_value, ["users", "occurrences"], "interval.histogram_value");
4439
+ }
4440
+ }
4441
+ function object2(value, path, keys) {
4442
+ if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).length === 0 || Object.keys(value).some((key) => !keys.includes(key))) {
4443
+ fail(`.${path} must be a non-empty object containing only ${keys.join(", ")}. Omit fields to preserve saved values; null is not a reset.`);
4444
+ }
4445
+ return value;
4446
+ }
4447
+ function boolean(value, path) {
4448
+ if (typeof value !== "boolean") fail(`.${path} must be a boolean.`);
4449
+ }
4450
+ function enumeration(value, choices, path) {
4451
+ if (!choices.includes(value)) fail(`.${path} must be one of ${choices.join(", ")}.`);
4452
+ }
4453
+ function onlyModels(model, models, path) {
4454
+ if (model && !models.includes(model)) fail(`.${path} supports only ${models.join(", ")} reports.`);
4455
+ }
4456
+ function fail(message) {
4457
+ throw new Error(`--presentation${message.startsWith(".") ? "" : " "}${message}`);
4458
+ }
4459
+
4373
4460
  // src/commands/te-analysis/report/presentation.ts
4374
4461
  var reportPresentationFlag = {
4375
4462
  name: "presentation",
4376
4463
  type: "json",
4377
4464
  required: false,
4378
- 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.'
4465
+ 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.'
4379
4466
  };
4380
- function validateReportPresentation(ctx) {
4467
+ function validateReportPresentation(ctx, allowDisplay = false) {
4381
4468
  if (!(ctx.has?.("presentation") ?? ctx.str("presentation") !== "")) return;
4382
4469
  const value = ctx.json("presentation");
4383
4470
  if (!value || typeof value !== "object" || Array.isArray(value)) {
@@ -4385,8 +4472,10 @@ function validateReportPresentation(ctx) {
4385
4472
  }
4386
4473
  const presentation = value;
4387
4474
  const keys = Object.keys(presentation);
4388
- if (keys.length === 0 || keys.some((key) => !["chart_type", "table_layout", "series"].includes(key))) {
4389
- throw new Error("--presentation accepts only chart_type, table_layout, and series; use semantic names, not raw QP fields.");
4475
+ const legacyFields = ["chart_type", "table_layout", "series"];
4476
+ const fields2 = allowDisplay ? [...legacyFields, ...displayFields] : legacyFields;
4477
+ if (keys.length === 0 || keys.some((key) => !fields2.includes(key))) {
4478
+ throw new Error(`--presentation accepts only ${fields2.join(", ")}; use semantic names, not raw QP fields.`);
4390
4479
  }
4391
4480
  if (presentation.chart_type === "table") {
4392
4481
  throw new Error("A table is a dashboard card display; use analysis dashboard-report update --chart-type table.");
@@ -4397,10 +4486,11 @@ function validateReportPresentation(ctx) {
4397
4486
  if (Object.hasOwn(presentation, "table_layout") && (typeof presentation.table_layout !== "string" || !["date", "event", "group"].includes(presentation.table_layout))) {
4398
4487
  throw new Error("--presentation.table_layout must be date, event, or group.");
4399
4488
  }
4400
- if (ctx.str("model-type") !== "" && ctx.str("model-type") !== "event") {
4489
+ if (ctx.str("model-type") !== "" && ctx.str("model-type") !== "event" && (!allowDisplay || keys.some((key) => legacyFields.includes(key)))) {
4401
4490
  throw new Error("--presentation is supported only for event reports.");
4402
4491
  }
4403
4492
  if (Object.hasOwn(presentation, "series")) validateSeries(presentation.series);
4493
+ if (allowDisplay) validateDisplayPresentation(presentation, ctx.str("model-type"));
4404
4494
  }
4405
4495
  function validateSeries(value) {
4406
4496
  if (!Array.isArray(value)) throw new Error("--presentation.series must be an array; [] resets all series.");
@@ -4480,13 +4570,13 @@ function validateReportUpdate(ctx) {
4480
4570
  throw new Error("--resolutions requires --definition.");
4481
4571
  }
4482
4572
  validateReportMetadataResolutions(ctx);
4483
- validateReportPresentation(ctx);
4573
+ validateReportPresentation(ctx, true);
4484
4574
  }
4485
4575
  var reportUpdate = createAnalysisCapabilityCommand({
4486
4576
  resource: "report",
4487
4577
  command: "update",
4488
4578
  capabilityId: "analysis.report.update",
4489
- description: "Update report metadata, AI QP definition, or event-report presentation through the capability gateway.",
4579
+ description: "Update report metadata, AI QP definition, or ordinary-model source presentation through the capability gateway.",
4490
4580
  flags: [
4491
4581
  projectIdFlag,
4492
4582
  { name: "report-id", type: "number", required: true, desc: "Report ID to update." },
@@ -5585,7 +5675,10 @@ var adhocBaseFlags = [
5585
5675
  metadataResolutionsFlag,
5586
5676
  requestIdFlag,
5587
5677
  useCacheFlag2,
5588
- zoneOffsetFlag,
5678
+ {
5679
+ ...zoneOffsetFlag,
5680
+ 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."
5681
+ },
5589
5682
  fieldsFlag,
5590
5683
  clusterQueryScopeFlag,
5591
5684
  slaveClusterIdFlag
@@ -6762,8 +6855,15 @@ var drilldownContextIdFlag = {
6762
6855
  var userIdFlag = {
6763
6856
  name: "user-id",
6764
6857
  type: "string",
6765
- required: true,
6766
- desc: "Canonical user_id returned by analysis drilldown-entities run. Never guess or substitute another identity field."
6858
+ required: false,
6859
+ desc: "Canonical user_id returned by analysis drilldown-entities run. Pass exactly one of --user-id or --account-id."
6860
+ };
6861
+ var accountIdFlag = {
6862
+ name: "account-id",
6863
+ type: "string",
6864
+ required: false,
6865
+ sensitive: true,
6866
+ desc: "Exact #account_id in the project, such as a PlayFab ID. Pass exactly one of --user-id or --account-id."
6767
6867
  };
6768
6868
  var sequenceFlags = [
6769
6869
  propertiesFlag,
@@ -6783,6 +6883,7 @@ var drilldownUserEventsBaseFlags = [
6783
6883
  projectIdFlag,
6784
6884
  drilldownContextIdFlag,
6785
6885
  userIdFlag,
6886
+ accountIdFlag,
6786
6887
  ...sequenceFlags,
6787
6888
  requestIdFlag,
6788
6889
  useCacheFlag
@@ -6812,10 +6913,22 @@ function drilldownUserEventsExportInput(ctx) {
6812
6913
  });
6813
6914
  }
6814
6915
  function baseInput2(ctx) {
6916
+ const userId = optionalStringPreserveEmpty(ctx, "user-id");
6917
+ const accountId = optionalStringPreserveEmpty(ctx, "account-id");
6918
+ if (userId !== void 0 && accountId !== void 0) {
6919
+ throw new CliValidationError("Pass only one of --user-id or --account-id.", { code: "USER_IDENTITY_CONFLICT" });
6920
+ }
6921
+ if (accountId !== void 0 && !accountId.trim()) {
6922
+ throw new CliValidationError("--account-id must not be blank.", { code: "INVALID_ACCOUNT_ID" });
6923
+ }
6924
+ if (!userId?.trim() && accountId === void 0) {
6925
+ throw new CliValidationError("Pass one of --user-id or --account-id.", { code: "USER_ID_REQUIRED" });
6926
+ }
6815
6927
  return {
6816
6928
  project_id: ctx.num("project-id"),
6817
6929
  drilldown_context_id: ctx.str("drilldown-context-id"),
6818
- user_id: ctx.str("user-id"),
6930
+ user_id: userId,
6931
+ account_id: accountId,
6819
6932
  properties: optionalJson(ctx, "properties"),
6820
6933
  sort_order: optionalString(ctx, "sort-order"),
6821
6934
  event_name_filter: optionalString(ctx, "event-name-filter"),
@@ -6952,33 +7065,32 @@ var zoneOffsetFlag2 = {
6952
7065
  var autoRefreshCronFlag = {
6953
7066
  name: "auto-refresh-cron",
6954
7067
  type: "string",
6955
- required: false,
6956
- desc: "Optional Quartz cron expression for an existing enabled auto-refresh schedule. This does not enable auto refresh."
7068
+ desc: "Deprecated Quartz cron for existing scripts. Runs must be at least 15 minutes apart. Use --auto-refresh-schedule for new scripts."
6957
7069
  };
6958
- var tagAutoRefreshFlags = [
6959
- {
6960
- name: "enable-history-tag-backup",
6961
- type: "boolean",
6962
- required: false,
6963
- desc: "Save historical tag versions during scheduled refresh. Enabling requires periodic refresh. Omit on update to preserve the setting."
6964
- },
7070
+ var autoRefreshFlags = [
6965
7071
  {
6966
7072
  name: "enable-auto-refresh",
6967
7073
  type: "boolean",
6968
7074
  required: false,
6969
- desc: "Enable or disable periodic refresh. Omit to preserve the setting on update. Enabling on create requires a schedule."
6970
- },
6971
- {
6972
- ...autoRefreshCronFlag,
6973
- desc: "Quartz cron expression in the tag timezone. Enables periodic refresh. Mutually exclusive with --auto-refresh-schedule."
7075
+ desc: "Enable or disable periodic refresh. Omit on update to preserve the setting. A supplied schedule enables refresh."
6974
7076
  },
6975
7077
  {
6976
7078
  name: "auto-refresh-schedule",
6977
7079
  type: "json",
6978
7080
  required: false,
6979
- 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"}.'
7081
+ 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"}.'
6980
7082
  }
6981
7083
  ];
7084
+ var tagAutoRefreshFlags = [
7085
+ {
7086
+ name: "enable-history-tag-backup",
7087
+ type: "boolean",
7088
+ required: false,
7089
+ desc: "Save historical tag versions during scheduled refresh. Enabling requires periodic refresh. Omit on update to preserve the setting."
7090
+ },
7091
+ ...autoRefreshFlags,
7092
+ autoRefreshCronFlag
7093
+ ];
6982
7094
  var entityIdFlag = {
6983
7095
  name: "entity-id",
6984
7096
  type: "number",
@@ -7220,16 +7332,12 @@ function clusterWriteInput(ctx, create) {
7220
7332
  authenticated_only: optionalBoolean(ctx, "authenticated-only"),
7221
7333
  remark: create ? void 0 : optionalString(ctx, "remark"),
7222
7334
  zone_offset: optionalNumber(ctx, "zone-offset"),
7223
- auto_refresh_cron: create ? void 0 : optionalString(ctx, "auto-refresh-cron"),
7335
+ ...autoRefreshInput(ctx, create, create ? void 0 : optionalString(ctx, autoRefreshCronFlag.name)),
7224
7336
  entity_id: create ? optionalNumber(ctx, "entity-id") : void 0
7225
7337
  });
7226
7338
  }
7227
- function tagWriteInput(ctx, create) {
7228
- const definitionRequest = optionalJson(ctx, "definition-request");
7229
- validateDefinitionRequest(create, definitionRequest);
7230
- const backup = optionalBoolean(ctx, "enable-history-tag-backup");
7339
+ function autoRefreshInput(ctx, create, cron) {
7231
7340
  const enabled = optionalBoolean(ctx, "enable-auto-refresh");
7232
- const cron = optionalString(ctx, "auto-refresh-cron");
7233
7341
  const schedule = optionalJson(ctx, "auto-refresh-schedule");
7234
7342
  if (cron !== void 0 && schedule !== void 0) {
7235
7343
  throw new Error("Pass only one of --auto-refresh-cron and --auto-refresh-schedule");
@@ -7237,11 +7345,22 @@ function tagWriteInput(ctx, create) {
7237
7345
  if (enabled === false && (cron !== void 0 || schedule !== void 0)) {
7238
7346
  throw new Error("Cannot set a schedule with --enable-auto-refresh false");
7239
7347
  }
7240
- if (backup === true && (enabled === false || create && schedule === void 0 && cron === void 0)) {
7241
- throw new Error("Enabling history tag backup requires periodic refresh with a schedule");
7348
+ if (create && enabled === true && schedule === void 0 && cron === void 0) {
7349
+ throw new Error("Enabling auto refresh on create requires --auto-refresh-schedule");
7242
7350
  }
7243
- if (create && enabled === true && cron === void 0 && schedule === void 0) {
7244
- throw new Error("Enabling auto refresh on create requires --auto-refresh-schedule or --auto-refresh-cron");
7351
+ return compactInput({
7352
+ enable_auto_refresh: enabled,
7353
+ auto_refresh_schedule: schedule,
7354
+ auto_refresh_cron: cron
7355
+ });
7356
+ }
7357
+ function tagWriteInput(ctx, create) {
7358
+ const definitionRequest = optionalJson(ctx, "definition-request");
7359
+ validateDefinitionRequest(create, definitionRequest);
7360
+ const refresh = autoRefreshInput(ctx, create, optionalString(ctx, autoRefreshCronFlag.name));
7361
+ const backup = optionalBoolean(ctx, "enable-history-tag-backup");
7362
+ if (backup === true && (refresh.enable_auto_refresh === false || create && refresh.auto_refresh_schedule === void 0 && refresh.auto_refresh_cron === void 0)) {
7363
+ throw new Error("Enabling history tag backup requires periodic refresh with a schedule");
7245
7364
  }
7246
7365
  return compactInput({
7247
7366
  project_id: ctx.num("project-id"),
@@ -7251,10 +7370,8 @@ function tagWriteInput(ctx, create) {
7251
7370
  authenticated_only: optionalBoolean(ctx, "authenticated-only"),
7252
7371
  remark: create ? void 0 : optionalString(ctx, "remark"),
7253
7372
  zone_offset: optionalNumber(ctx, "zone-offset"),
7254
- enable_auto_refresh: enabled,
7255
7373
  enable_history_tag_backup: backup,
7256
- auto_refresh_cron: cron,
7257
- auto_refresh_schedule: schedule,
7374
+ ...refresh,
7258
7375
  entity_id: create ? optionalNumber(ctx, "entity-id") : void 0
7259
7376
  });
7260
7377
  }
@@ -7424,7 +7541,8 @@ var commands41 = [
7424
7541
  clusterDefinitionRequestFlag,
7425
7542
  authenticatedOnlyFlag,
7426
7543
  zoneOffsetFlag2,
7427
- entityIdFlag
7544
+ entityIdFlag,
7545
+ ...autoRefreshFlags
7428
7546
  ], "write", (ctx) => clusterWriteInput(ctx, true)),
7429
7547
  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.", [
7430
7548
  projectIdFlag,
@@ -7434,7 +7552,8 @@ var commands41 = [
7434
7552
  authenticatedOnlyFlag,
7435
7553
  remarkFlag,
7436
7554
  zoneOffsetFlag2,
7437
- autoRefreshCronFlag
7555
+ ...autoRefreshFlags,
7556
+ { ...autoRefreshCronFlag, desc: `${autoRefreshCronFlag.desc} Requires an already enabled refresh plan.` }
7438
7557
  ], "high-risk-write", (ctx) => clusterWriteInput(ctx, false)),
7439
7558
  idImportCapability(capability("user-cluster", "create-id", "analysis.user_cluster.create_id", "Create a cluster by mapping imported values to an analysis entity.", [
7440
7559
  projectIdFlag,
@@ -11290,6 +11409,143 @@ var systemMonitoringCommands = [
11290
11409
  })
11291
11410
  ];
11292
11411
 
11412
+ // src/commands/te-analysis/system/openapi-token.ts
11413
+ import { link, lstat as lstat3, mkdtemp, rm as rm4, writeFile } from "fs/promises";
11414
+ import { dirname as dirname4, join as join2, resolve as resolve5 } from "path";
11415
+ var MAX_BATCH_MEMBERS = 200;
11416
+ 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})$/;
11417
+ function batchInput2(ctx) {
11418
+ const companyId = ctx.num("company-id");
11419
+ if (!Number.isInteger(companyId) || companyId < 1 || companyId > 2147483647) {
11420
+ throw new CliValidationError("--company-id must be a positive company ID.");
11421
+ }
11422
+ const openIds = ctx.json("open-ids");
11423
+ if (!Array.isArray(openIds) || openIds.length === 0 || openIds.length > MAX_BATCH_MEMBERS || !openIds.every((id) => typeof id === "string" && id.trim().length > 0)) {
11424
+ throw new CliValidationError("--open-ids must be a JSON array of 1 to 200 nonblank member open IDs.");
11425
+ }
11426
+ const expiry = ctx.str("expires-at");
11427
+ 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))) {
11428
+ throw new CliValidationError("--expires-at must be an ISO-8601 timestamp with an explicit timezone.");
11429
+ }
11430
+ return { company_id: companyId, open_ids: [...new Set(openIds.map((id) => id.trim()))], expires_at: expiry };
11431
+ }
11432
+ function responseRecord(result) {
11433
+ if (result === null || typeof result !== "object" || Array.isArray(result)) throw invalidTokenResponse();
11434
+ return result;
11435
+ }
11436
+ function invalidTokenResponse() {
11437
+ return new CliApiError("Invalid OpenAPI token response from the server.", { code: "INVALID_OPENAPI_TOKEN_RESPONSE" });
11438
+ }
11439
+ function batchSummary(result) {
11440
+ const { items, generated_count, skipped_count, failed_count } = responseRecord(result);
11441
+ if (!Array.isArray(items) || ![generated_count, skipped_count, failed_count].every(
11442
+ (count) => typeof count === "number" && Number.isSafeInteger(count) && count >= 0
11443
+ )) throw invalidTokenResponse();
11444
+ const summaries = items.map((value) => {
11445
+ const { open_id, status, expires_at, code } = responseRecord(value);
11446
+ if (typeof open_id !== "string" || status !== "generated" && status !== "skipped" && status !== "failed") {
11447
+ throw invalidTokenResponse();
11448
+ }
11449
+ return {
11450
+ open_id,
11451
+ status,
11452
+ ...typeof expires_at === "string" && ZONED_TIMESTAMP.test(expires_at) ? { expires_at } : {},
11453
+ ...typeof code === "string" && /^[A-Z][A-Z0-9_]{0,79}$/.test(code) ? { code } : {}
11454
+ };
11455
+ });
11456
+ return { items: summaries, generated_count, skipped_count, failed_count };
11457
+ }
11458
+ function outputError(error) {
11459
+ if (error.code === "EEXIST") {
11460
+ return new CliValidationError("--output already exists. Choose a new file.", { code: "OUTPUT_ALREADY_EXISTS" });
11461
+ }
11462
+ return new CliValidationError("Cannot write the OpenAPI token to --output.", { code: "OPENAPI_TOKEN_OUTPUT_FAILED" });
11463
+ }
11464
+ async function requireNewOutput(file) {
11465
+ try {
11466
+ await lstat3(file);
11467
+ } catch (error) {
11468
+ if (error.code === "ENOENT") return;
11469
+ throw outputError(error);
11470
+ }
11471
+ throw outputError({ code: "EEXIST" });
11472
+ }
11473
+ async function writeToken(file, token) {
11474
+ let directory;
11475
+ try {
11476
+ directory = await mkdtemp(join2(dirname4(file), ".ae-openapi-token-"));
11477
+ const temporary = join2(directory, "token");
11478
+ await writeFile(temporary, `${token}
11479
+ `, { mode: 384, flag: "wx" });
11480
+ await link(temporary, file);
11481
+ } catch (error) {
11482
+ throw outputError(error);
11483
+ } finally {
11484
+ if (directory) {
11485
+ await rm4(directory, { recursive: true, force: true }).catch(() => {
11486
+ logger.warn("Could not remove the private OpenAPI token staging directory.");
11487
+ });
11488
+ }
11489
+ }
11490
+ }
11491
+ var systemOpenApiTokenCommands = [
11492
+ createAnalysisCapabilityCommand({
11493
+ resource: "system openapi-token",
11494
+ command: "batch-generate",
11495
+ capabilityId: "system.openapi_token.batch_generate",
11496
+ description: "Generate OpenAPI tokens for selected company members and report per-member results.",
11497
+ helpText: "Discover member open IDs with system member list. Use --dry-run to review the batch and --yes for explicit non-interactive confirmation.",
11498
+ flags: [
11499
+ { name: "company-id", type: "number", required: true, min: 1, max: 2147483647, desc: "Company ID." },
11500
+ { name: "open-ids", type: "json", required: true, desc: "JSON array of 1 to 200 company member open IDs." },
11501
+ { name: "expires-at", type: "string", required: true, desc: "Expiration timestamp with an explicit ISO-8601 timezone." }
11502
+ ],
11503
+ risk: "high-risk-write",
11504
+ buildInput: batchInput2,
11505
+ prepareExecuteInput: (_ctx, input) => ({ ...input, yes: true }),
11506
+ postProcess: batchSummary
11507
+ }),
11508
+ createAnalysisCapabilityCommand({
11509
+ resource: "system openapi-token",
11510
+ command: "get",
11511
+ capabilityId: "system.openapi_token.get",
11512
+ description: "Get personal OpenAPI token status and expiration for the current account.",
11513
+ helpText: "Supply --output to save an active token to a new private local file. The output envelope contains status and file metadata.",
11514
+ flags: [
11515
+ { name: "output", type: "string", sensitive: true, desc: "Save an active token to this new private local file." }
11516
+ ],
11517
+ risk: "read",
11518
+ buildInput: (ctx) => {
11519
+ const file = ctx.str("output");
11520
+ if ((ctx.has?.("output") || file) && !file.trim()) {
11521
+ throw new CliValidationError("--output must be a nonblank local file path.");
11522
+ }
11523
+ return {};
11524
+ },
11525
+ prepareExecuteInput: async (ctx, input) => {
11526
+ const file = ctx.str("output");
11527
+ if (!file) return input;
11528
+ await requireNewOutput(resolve5(file));
11529
+ return { ...input, reveal: true };
11530
+ },
11531
+ postProcess: async (result, input, ctx) => {
11532
+ const { status, expires_at, token } = responseRecord(result);
11533
+ if (status !== "active" && status !== "expired" && status !== "not_generated" && status !== "disabled") {
11534
+ throw invalidTokenResponse();
11535
+ }
11536
+ const summary = {
11537
+ status,
11538
+ ...typeof expires_at === "string" && ZONED_TIMESTAMP.test(expires_at) ? { expires_at } : {}
11539
+ };
11540
+ if (input.reveal !== true || status !== "active") return summary;
11541
+ if (typeof token !== "string" || !token.trim() || /[\r\n]/.test(token)) throw invalidTokenResponse();
11542
+ const outputFile = resolve5(ctx.str("output"));
11543
+ await writeToken(outputFile, token);
11544
+ return { ...summary, output_file: outputFile };
11545
+ }
11546
+ })
11547
+ ];
11548
+
11293
11549
  // src/core/ta-password-encryption.ts
11294
11550
  import { constants, publicEncrypt } from "crypto";
11295
11551
  var TA_PASSWORD_PUBLIC_KEY = [
@@ -11454,6 +11710,7 @@ var systemUsageCommands = [
11454
11710
  var commands82 = [
11455
11711
  ...systemUsageCommands,
11456
11712
  ...systemIdentityCommands,
11713
+ ...systemOpenApiTokenCommands,
11457
11714
  ...systemSecurityCommands,
11458
11715
  ...systemMonitoringCommands,
11459
11716
  ...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-E457FREE.js";
4
+ } from "./chunk-434DSEOC.js";
5
5
  import {
6
6
  registerCapabilityGatewayRoute,
7
7
  resolveGatewayDomain
@@ -9,16 +9,16 @@ import {
9
9
  import {
10
10
  unwrapOutputData,
11
11
  withOutputMetadata
12
- } from "./chunk-VR2D54AA.js";
12
+ } from "./chunk-7XTWP3NB.js";
13
13
  import {
14
14
  CapabilityGatewayError,
15
15
  buildCapabilityGatewayUrl,
16
16
  requestCapabilityGatewayWithEnvelope
17
- } from "./chunk-6HOM2FOJ.js";
17
+ } from "./chunk-A3PREN6Q.js";
18
18
  import {
19
19
  sourceLoggedFetch
20
20
  } from "./chunk-NNK3JBH4.js";
21
- import "./chunk-YJYC5PLL.js";
21
+ import "./chunk-4CRZ2YUC.js";
22
22
  import "./chunk-PUSFEC6B.js";
23
23
  import {
24
24
  SecureStoreAuthError,