@thinkingai/ae-cli 6.0.40 → 6.0.41
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.
- package/README.md +0 -2
- package/README.zh.md +0 -2
- package/dist/{auth-NN55553T.js → auth-GBMV6TEJ.js} +2 -2
- package/dist/{auth-GDV3H5I4.js → auth-NDSXE54J.js} +4 -4
- package/dist/{capability-TPORIKRQ.js → capability-CETVHGXF.js} +25 -15
- package/dist/{capability-VQNC5CF7.js → capability-ZSQBMNOE.js} +25 -15
- package/dist/{chunk-GJJA4CQZ.js → chunk-3FY3RJ26.js} +0 -4
- package/dist/chunk-4E3DB4MM.js +556 -0
- package/dist/{chunk-GS2P7LFD.js → chunk-5XUSIK27.js} +2 -2
- package/dist/{chunk-VTXHDCBW.js → chunk-AFXA7BRK.js} +2 -2
- package/dist/{chunk-7KQWSBSL.js → chunk-FNZA5RZA.js} +8 -8
- package/dist/{chunk-TS6BUGUY.js → chunk-J2N4PB56.js} +8 -8
- package/dist/{chunk-RBNKI5ZW.js → chunk-JUW4AJXN.js} +2 -2
- package/dist/{chunk-Z3OXWCIA.js → chunk-S5NTSDBS.js} +2 -2
- package/dist/{chunk-VKD5WQKN.js → chunk-VLWOLBGZ.js} +142 -24
- package/dist/chunk-WANVG6SY.js +556 -0
- package/dist/{chunk-YTG6Q75E.js → chunk-WZRX4KOH.js} +25 -3
- package/dist/{chunk-YV52FB5G.js → chunk-ZQKDZXDO.js} +1 -1
- package/dist/{cli-token-GL5MS5FK.js → cli-token-4UPER74P.js} +3 -3
- package/dist/{chunk-6A2FUCIS.js → client-L2YDMHQ6.js} +5 -6
- package/dist/{config-4VZNLBKF.js → config-OL2LWGBV.js} +4 -33
- package/dist/index.js +31 -44
- package/dist/{memory-RWJW4XFO.js → memory-MUP7PPL7.js} +4 -4
- package/dist/{memory-VO2ZJCRT.js → memory-U4O5PMXH.js} +4 -4
- package/dist/{metadata-YGTHR2XJ.js → metadata-UKZDNLLQ.js} +21 -11
- package/dist/{metadata-ZRN2GHPN.js → metadata-XXMJFN2M.js} +21 -11
- package/dist/{model-CLUIK3K5.js → model-JTUEO5M4.js} +2 -2
- package/dist/{sync-3REDHGY6.js → sync-MOSFNBVR.js} +5 -5
- package/dist/{te-agent-XNPELAKX.js → te-agent-IFKZDHZI.js} +25 -18
- package/dist/{te-analysis-GJI5FZUL.js → te-analysis-3QLLS35K.js} +1231 -456
- package/dist/{te-analysis-N2BRDJZ5.js → te-analysis-YSK2DBVL.js} +1231 -456
- package/dist/{te-community-SQXKE5OO.js → te-community-HNKVTERD.js} +207 -12
- package/dist/{te-community-TYSNU3NQ.js → te-community-IWE5B7W6.js} +208 -12
- package/dist/{te-dataops-OWIADNSM.js → te-dataops-KQPYNAE3.js} +262 -145
- package/dist/{te-dataops-5TM7WZDI.js → te-dataops-KXCEB4CS.js} +262 -145
- package/dist/{te-engage-L72HWRGO.js → te-engage-6RNGK5GH.js} +566 -17
- package/dist/{te-engage-QWM4GFS7.js → te-engage-IRMHTSQK.js} +566 -17
- package/dist/{te-kb-VRMEY3D4.js → te-kb-OIH3T6CS.js} +4 -4
- package/dist/{te-system-XGS5EQIQ.js → te-system-AZ3URMUO.js} +515 -11
- package/dist/{te-team-BZRDV2CM.js → te-team-GZPU6UWA.js} +5 -5
- package/dist/{update-HEDXGOJH.js → update-TOBFXF2V.js} +4 -4
- package/package.json +5 -5
- package/skills/ae-agent/SKILL.md +3 -3
- package/skills/ae-agent/references/list-skill-references.md +4 -4
- package/skills/ae-agent/references/read-skill-reference.md +10 -7
- package/skills/ae-agent/references/upload-skill-reference.md +11 -9
- package/skills/ae-analysis/SKILL.md +15 -12
- package/skills/ae-analysis/metadata_resolution.md +150 -0
- package/skills/ae-analysis/references/adhoc_export.md +17 -2
- package/skills/ae-analysis/references/adhoc_run.md +12 -8
- package/skills/ae-analysis/references/ai_models.md +31 -5
- package/skills/ae-analysis/references/analysis_data_retrieval.md +104 -16
- package/skills/ae-analysis/references/analysis_drilldown_contract.md +4 -4
- package/skills/ae-analysis/references/analysis_gateway_assets.md +12 -10
- package/skills/ae-analysis/references/artifact_download.md +4 -3
- package/skills/ae-analysis/references/asset_abnormal_list.md +5 -3
- package/skills/ae-analysis/references/asset_authentication_list.md +5 -3
- package/skills/ae-analysis/references/asset_search.md +5 -3
- package/skills/ae-analysis/references/bi_panel_page_data_export.md +1 -1
- package/skills/ae-analysis/references/bi_panel_page_data_run.md +4 -4
- package/skills/ae-analysis/references/catalog_export.md +28 -0
- package/skills/ae-analysis/references/catalog_list.md +44 -0
- package/skills/ae-analysis/references/command_index.md +72 -63
- package/skills/ae-analysis/references/dashboard_report_data_run.md +11 -4
- package/skills/ae-analysis/references/datatable_version_list.md +5 -3
- package/skills/ae-analysis/references/drilldown_entities_run.md +4 -4
- package/skills/ae-analysis/references/drilldown_events_run.md +2 -2
- package/skills/ae-analysis/references/drilldown_user_events_export.md +1 -1
- package/skills/ae-analysis/references/drilldown_user_events_run.md +2 -2
- package/skills/ae-analysis/references/entity_detail_run.md +4 -4
- package/skills/ae-analysis/references/entity_id_import_options.md +1 -1
- package/skills/ae-analysis/references/event_detail_run.md +4 -4
- package/skills/ae-analysis/references/event_export.md +21 -0
- package/skills/ae-analysis/references/event_list.md +7 -6
- package/skills/ae-analysis/references/exchange_rule_list.md +5 -3
- package/skills/ae-analysis/references/history_tag_data_drilldown_export.md +4 -2
- package/skills/ae-analysis/references/history_tag_data_drilldown_run.md +2 -2
- package/skills/ae-analysis/references/history_tag_data_run.md +2 -2
- package/skills/ae-analysis/references/metric_export.md +21 -0
- package/skills/ae-analysis/references/metric_list.md +8 -7
- package/skills/ae-analysis/references/property_export.md +21 -0
- package/skills/ae-analysis/references/property_list.md +9 -8
- package/skills/ae-analysis/references/query_context_get.md +20 -0
- package/skills/ae-analysis/references/query_create_result_cluster.md +1 -1
- package/skills/ae-analysis/references/report_change_log_list.md +1 -1
- package/skills/ae-analysis/references/report_create.md +3 -3
- package/skills/ae-analysis/references/report_data_run.md +8 -8
- package/skills/ae-analysis/references/report_update.md +3 -3
- package/skills/ae-analysis/references/report_version_rollback.md +1 -1
- package/skills/ae-analysis/references/rule_list.md +6 -4
- package/skills/ae-analysis/references/run_inspect.md +8 -5
- package/skills/ae-analysis/references/run_wait.md +37 -0
- package/skills/ae-analysis/references/user_cluster_export.md +13 -0
- package/skills/ae-analysis/references/user_cluster_list.md +6 -2
- package/skills/ae-analysis/references/user_cluster_member_export.md +5 -3
- package/skills/ae-analysis/references/user_cluster_member_list.md +4 -4
- package/skills/ae-analysis/references/user_tag_export.md +13 -0
- package/skills/ae-analysis/references/user_tag_list.md +6 -2
- package/skills/ae-analysis/references/user_tag_member_export.md +5 -3
- package/skills/ae-analysis/references/user_tag_member_list.md +4 -4
- package/skills/ae-analysis/references/virtual_property_create.md +2 -2
- package/skills/ae-community/SKILL.md +2 -2
- package/skills/ae-dataops/SKILL.md +4 -3
- package/skills/ae-dataops/references/dataops-flow-create.md +47 -3
- package/skills/ae-engage/SKILL.md +46 -6
- package/skills/ae-engage/references/build-task-save-guide.md +12 -0
- package/skills/ae-engage/references/cancel-query-run.md +31 -0
- package/skills/ae-engage/references/config-item-analysis-report.md +14 -1
- package/skills/ae-engage/references/config-item-strategy-comparison.md +11 -1
- package/skills/ae-engage/references/config-item-trigger-report.md +15 -1
- package/skills/ae-engage/references/flow-metric-detail-report.md +134 -0
- package/skills/ae-engage/references/flow-metric-update.md +77 -0
- package/skills/ae-engage/references/flow-metric-user.md +118 -0
- package/skills/ae-engage/references/flow-node-metric-user.md +122 -0
- package/skills/ae-engage/references/flow-node-user.md +122 -0
- package/skills/ae-engage/references/push-record-query.md +32 -1
- package/skills/ae-engage/references/save-task.md +9 -0
- package/skills/ae-engage/references/task-data-detail.md +9 -2
- package/skills/ae-engage/references/task-metric-detail.md +9 -2
- package/skills/ae-engage/references/task-submit-approval.md +3 -0
- package/skills/ae-metadata/SKILL.md +2 -1
- package/skills/ae-metadata/references/metadata_data_table_download.md +10 -2
- package/skills/ae-metadata/references/metadata_data_table_list.md +5 -2
- package/skills/ae-system/SKILL.md +66 -3
- package/dist/chunk-DT6Y3TD7.js +0 -232
- package/dist/chunk-MVDZ7DBQ.js +0 -231
- package/dist/chunk-NBPKWKRA.js +0 -51
- package/dist/client-DAIPF7XN.js +0 -23
- package/dist/raw-52B4UKO4.js +0 -71
- package/dist/te-meta-53BVXPFI.js +0 -95
- package/dist/te-meta-TOCBPBXI.js +0 -95
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCapabilityCommand
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FNZA5RZA.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
CapabilityGatewayError,
|
|
6
|
+
buildCapabilityGatewayUrl,
|
|
7
|
+
fetchCapabilityGateway,
|
|
8
|
+
requestCapabilityGateway,
|
|
9
|
+
requestCapabilityGatewayWithEnvelope
|
|
10
|
+
} from "./chunk-JUW4AJXN.js";
|
|
11
|
+
import {
|
|
12
|
+
printError,
|
|
13
|
+
withOutputMetadata
|
|
14
|
+
} from "./chunk-WZRX4KOH.js";
|
|
7
15
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
16
|
+
registerCapabilityGatewayRoute,
|
|
17
|
+
resolveGatewayDomain
|
|
18
|
+
} from "./chunk-PTE56QPL.js";
|
|
19
|
+
import "./chunk-S5NTSDBS.js";
|
|
20
|
+
import "./chunk-ZQKDZXDO.js";
|
|
21
|
+
import "./chunk-3FY3RJ26.js";
|
|
14
22
|
import {
|
|
15
23
|
CliValidationError
|
|
16
24
|
} from "./chunk-AXDXJTPC.js";
|
|
@@ -42,6 +50,9 @@ function createEngageActivityCapabilityCommand(config) {
|
|
|
42
50
|
function createEngageWorkbenchCapabilityCommand(config) {
|
|
43
51
|
return createEngageCapabilityCommand("engage-workbench", config);
|
|
44
52
|
}
|
|
53
|
+
function createEngageQueryCapabilityCommand(config) {
|
|
54
|
+
return createEngageCapabilityCommand("engage-query", config);
|
|
55
|
+
}
|
|
45
56
|
|
|
46
57
|
// src/commands/te-engage/engage-flow/flow/update-remark.ts
|
|
47
58
|
var flowUpdateRemark = createEngageFlowCapabilityCommand({
|
|
@@ -78,6 +89,9 @@ function readOptionalString(ctx, name) {
|
|
|
78
89
|
function readOptionalNumber(ctx, name) {
|
|
79
90
|
return hasFlag(ctx, name) ? ctx.num(name) : void 0;
|
|
80
91
|
}
|
|
92
|
+
function readOptionalBoolean(ctx, name) {
|
|
93
|
+
return hasFlag(ctx, name) ? ctx.bool(name) : void 0;
|
|
94
|
+
}
|
|
81
95
|
function readOptionalJsonArray(ctx, name) {
|
|
82
96
|
const value = ctx.json(name);
|
|
83
97
|
if (value === void 0) return void 0;
|
|
@@ -256,6 +270,7 @@ var METRIC_AGGREGATIONS = /* @__PURE__ */ new Set([
|
|
|
256
270
|
"variance",
|
|
257
271
|
"stddev"
|
|
258
272
|
]);
|
|
273
|
+
var TASK_TRIGGER_PERIOD_SYMBOLS = /* @__PURE__ */ new Set(["TS01", "TS02", "TS03", "TS04"]);
|
|
259
274
|
function validateSemanticAudienceDefinition(value, path) {
|
|
260
275
|
const definition = object(value, path);
|
|
261
276
|
rejectUnknown(definition, ["type", "conditions", "include_filter", "exclude_filter"], path);
|
|
@@ -307,6 +322,18 @@ function validateSemanticMetricDefinition(value, path) {
|
|
|
307
322
|
function validateEmbeddedSemanticDefinitions(value, path) {
|
|
308
323
|
walk(value, path);
|
|
309
324
|
}
|
|
325
|
+
function validateTaskTriggerPeriodDefinition(value, path) {
|
|
326
|
+
const request = object(value, path);
|
|
327
|
+
if (!isObject(request.triggerConfig)) return;
|
|
328
|
+
const triggerConfig = request.triggerConfig;
|
|
329
|
+
if (triggerConfig.triggerDefinition === void 0 || triggerConfig.triggerDefinition === null) return;
|
|
330
|
+
const definition = object(triggerConfig.triggerDefinition, `${path}.triggerConfig.triggerDefinition`);
|
|
331
|
+
const rules = array(definition.rules, `${path}.triggerConfig.triggerDefinition.rules`, 1);
|
|
332
|
+
const primaryRule = object(rules[0], `${path}.triggerConfig.triggerDefinition.rules[0]`);
|
|
333
|
+
const symbolPath = `${path}.triggerConfig.triggerDefinition.rules[0].periodTimeSymbol`;
|
|
334
|
+
required(primaryRule.periodTimeSymbol, symbolPath);
|
|
335
|
+
enumValue(primaryRule.periodTimeSymbol, TASK_TRIGGER_PERIOD_SYMBOLS, symbolPath);
|
|
336
|
+
}
|
|
310
337
|
function walk(value, path) {
|
|
311
338
|
if (Array.isArray(value)) {
|
|
312
339
|
value.forEach((item, index) => walk(item, `${path}[${index}]`));
|
|
@@ -603,6 +630,30 @@ var flowSave = createEngageFlowCapabilityCommand({
|
|
|
603
630
|
buildInput: (ctx) => ({ project_id: ctx.num("project-id"), req: readRequest(ctx) })
|
|
604
631
|
});
|
|
605
632
|
|
|
633
|
+
// src/commands/te-engage/engage-flow/metric/update.ts
|
|
634
|
+
var flowMetricUpdate = createEngageFlowCapabilityCommand({
|
|
635
|
+
resource: "metric",
|
|
636
|
+
command: "update",
|
|
637
|
+
capabilityId: "engage-flow.metric.update",
|
|
638
|
+
description: "Update metric settings for a flow canvas.",
|
|
639
|
+
flags: [
|
|
640
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
641
|
+
{ name: "flow-id", type: "string", required: true, desc: "Logical flow ID." },
|
|
642
|
+
{
|
|
643
|
+
name: "metric-map",
|
|
644
|
+
type: "json",
|
|
645
|
+
required: true,
|
|
646
|
+
desc: "Metric configuration map keyed by metric group."
|
|
647
|
+
}
|
|
648
|
+
],
|
|
649
|
+
risk: "write",
|
|
650
|
+
buildInput: (ctx) => ({
|
|
651
|
+
project_id: ctx.num("project-id"),
|
|
652
|
+
flow_id: ctx.str("flow-id"),
|
|
653
|
+
metric_map: ctx.json("metric-map")
|
|
654
|
+
})
|
|
655
|
+
});
|
|
656
|
+
|
|
606
657
|
// src/commands/te-engage/engage-flow/node-config/schema.ts
|
|
607
658
|
var nodeConfigSchema = createEngageFlowCapabilityCommand({
|
|
608
659
|
resource: "node-config",
|
|
@@ -638,6 +689,208 @@ var nodeConfigValidate = createEngageFlowCapabilityCommand({
|
|
|
638
689
|
})
|
|
639
690
|
});
|
|
640
691
|
|
|
692
|
+
// src/commands/te-engage/engage-flow/report/shared.ts
|
|
693
|
+
var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
694
|
+
var flowReportCommonFlags = [
|
|
695
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
696
|
+
{ name: "flow-id", type: "string", required: false, desc: "Logical flow ID." },
|
|
697
|
+
{ name: "flow-uuid", type: "string", required: false, desc: "Flow version UUID." },
|
|
698
|
+
{ name: "request-id", type: "string", required: false, desc: "Query correlation ID. Generated when omitted." },
|
|
699
|
+
{ name: "push-language-code", type: "string", required: false, desc: "Push language code." },
|
|
700
|
+
{ name: "show-time-zone", type: "string", required: false, desc: "Display timezone offset." }
|
|
701
|
+
];
|
|
702
|
+
var flowMetricDetailFlags = [
|
|
703
|
+
...flowReportCommonFlags,
|
|
704
|
+
{ name: "node-uuid", type: "string", required: true, desc: "Flow node UUID." },
|
|
705
|
+
{ name: "start-time", type: "string", required: true, desc: "Start date in yyyy-MM-dd format." },
|
|
706
|
+
{ name: "end-time", type: "string", required: true, desc: "End date in yyyy-MM-dd format." },
|
|
707
|
+
{ name: "branch-id", type: "string", required: false, desc: "Optional branch ID." },
|
|
708
|
+
{ name: "indicator-name", type: "string", required: false, desc: "Optional indicator name." },
|
|
709
|
+
{ name: "indicators-uuid", type: "string", required: false, desc: "Optional AB metric indicator UUID." },
|
|
710
|
+
{ name: "data-dim-type", type: "string", required: false, desc: "Data dimension type, usually uv or pv." },
|
|
711
|
+
{ name: "report-mode", type: "string", required: false, desc: "Metric report mode: node or ab. Defaults to node." }
|
|
712
|
+
];
|
|
713
|
+
var flowUserDetailFlags = [
|
|
714
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
715
|
+
{ name: "flow-id", type: "string", required: false, desc: "Logical flow ID." },
|
|
716
|
+
{ name: "flow-uuid", type: "string", required: false, desc: "Flow version UUID." },
|
|
717
|
+
{ name: "request-id", type: "string", required: false, desc: "Query correlation ID. Generated when omitted." },
|
|
718
|
+
{ name: "cluster-def", type: "string", required: false, desc: "Legacy cluster definition JSON. Prefer the report metric fields below." },
|
|
719
|
+
{ name: "indicator-name", type: "string", required: false, desc: "Metric key returned by the corresponding flow report." },
|
|
720
|
+
{ name: "data-view-type", type: "string", required: false, desc: "Data view type. Defaults to 2 (date view)." },
|
|
721
|
+
{ name: "is-summary", type: "boolean", required: false, desc: "Whether to query a summary segment. Defaults to false." },
|
|
722
|
+
{ name: "start-time", type: "string", required: false, desc: "Segment start date in yyyy-MM-dd format." },
|
|
723
|
+
{ name: "end-time", type: "string", required: false, desc: "Segment end date in yyyy-MM-dd format." },
|
|
724
|
+
{ name: "push-language-code", type: "string", required: false, desc: "Optional push language code from the report context." },
|
|
725
|
+
{ name: "user-time-zone", type: "string", required: false, desc: "Optional user timezone." },
|
|
726
|
+
{ name: "show-time-zone", type: "string", required: false, desc: "Optional report display timezone." },
|
|
727
|
+
{ name: "node-uuid", type: "string", required: false, desc: "Flow node UUID." },
|
|
728
|
+
{ name: "branch-id", type: "string", required: false, desc: "Optional branch ID." }
|
|
729
|
+
];
|
|
730
|
+
var flowNodeUserDetailFlags = flowUserDetailFlags.map((flag) => flag.name === "node-uuid" ? { ...flag, required: true } : flag);
|
|
731
|
+
var inlineLimitFlag = {
|
|
732
|
+
name: "limit",
|
|
733
|
+
type: "number",
|
|
734
|
+
required: false,
|
|
735
|
+
desc: "Maximum number of rows returned inline. Defaults to backend value."
|
|
736
|
+
};
|
|
737
|
+
var timeoutSecondsFlag = {
|
|
738
|
+
name: "timeout-seconds",
|
|
739
|
+
type: "number",
|
|
740
|
+
required: false,
|
|
741
|
+
desc: "Query or export timeout in seconds. Defaults to backend policy."
|
|
742
|
+
};
|
|
743
|
+
var exportFormatFlags = [
|
|
744
|
+
{
|
|
745
|
+
name: "artifact-format",
|
|
746
|
+
type: "string",
|
|
747
|
+
required: false,
|
|
748
|
+
desc: "Export artifact format. Flow report and user detail exports support csv or jsonl. Defaults to jsonl."
|
|
749
|
+
}
|
|
750
|
+
];
|
|
751
|
+
function validateFlowReportInput(ctx) {
|
|
752
|
+
if (!ctx.str("flow-id") && !ctx.str("flow-uuid")) {
|
|
753
|
+
printError("validation", "At least one of --flow-id or --flow-uuid is required");
|
|
754
|
+
process.exit(1);
|
|
755
|
+
}
|
|
756
|
+
validateDate(ctx.str("start-time"), "--start-time");
|
|
757
|
+
validateDate(ctx.str("end-time"), "--end-time");
|
|
758
|
+
}
|
|
759
|
+
function validateFlowUserDetailInput(ctx) {
|
|
760
|
+
if (!ctx.str("flow-id") && !ctx.str("flow-uuid")) {
|
|
761
|
+
printError("validation", "At least one of --flow-id or --flow-uuid is required");
|
|
762
|
+
process.exit(1);
|
|
763
|
+
}
|
|
764
|
+
if (!ctx.str("cluster-def") && (!ctx.str("indicator-name") || !ctx.str("start-time") || !ctx.str("end-time"))) {
|
|
765
|
+
printError("validation", "Pass either --cluster-def or --indicator-name with --start-time and --end-time");
|
|
766
|
+
process.exit(1);
|
|
767
|
+
}
|
|
768
|
+
validateDate(ctx.str("start-time"), "--start-time");
|
|
769
|
+
validateDate(ctx.str("end-time"), "--end-time");
|
|
770
|
+
}
|
|
771
|
+
function buildFlowReportInput(ctx) {
|
|
772
|
+
return {
|
|
773
|
+
project_id: ctx.num("project-id"),
|
|
774
|
+
flow_id: ctx.str("flow-id") || void 0,
|
|
775
|
+
flow_uuid: ctx.str("flow-uuid") || void 0,
|
|
776
|
+
request_id: ctx.str("request-id") || void 0,
|
|
777
|
+
push_language_code: ctx.str("push-language-code") || void 0,
|
|
778
|
+
show_time_zone: ctx.str("show-time-zone") || void 0,
|
|
779
|
+
node_uuid: ctx.str("node-uuid") || void 0,
|
|
780
|
+
branch_id: ctx.str("branch-id") || void 0,
|
|
781
|
+
indicator_name: ctx.str("indicator-name") || void 0,
|
|
782
|
+
indicators_uuid: ctx.str("indicators-uuid") || void 0,
|
|
783
|
+
data_dim_type: ctx.str("data-dim-type") || void 0,
|
|
784
|
+
start_time: ctx.str("start-time") || void 0,
|
|
785
|
+
end_time: ctx.str("end-time") || void 0,
|
|
786
|
+
report_mode: ctx.str("report-mode") || void 0,
|
|
787
|
+
cluster_def: ctx.str("cluster-def") || void 0,
|
|
788
|
+
limit: ctx.optionalNum("limit"),
|
|
789
|
+
format: ctx.str("artifact-format") || void 0,
|
|
790
|
+
timeout_seconds: ctx.optionalNum("timeout-seconds")
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
function buildFlowUserDetailInput(ctx) {
|
|
794
|
+
return {
|
|
795
|
+
project_id: ctx.num("project-id"),
|
|
796
|
+
flow_id: ctx.str("flow-id") || void 0,
|
|
797
|
+
flow_uuid: ctx.str("flow-uuid") || void 0,
|
|
798
|
+
request_id: ctx.str("request-id") || void 0,
|
|
799
|
+
node_uuid: ctx.str("node-uuid") || void 0,
|
|
800
|
+
branch_id: ctx.str("branch-id") || void 0,
|
|
801
|
+
cluster_def: ctx.str("cluster-def") || void 0,
|
|
802
|
+
indicator_name: ctx.str("indicator-name") || void 0,
|
|
803
|
+
data_view_type: ctx.str("data-view-type") || void 0,
|
|
804
|
+
is_summary: readOptionalBoolean(ctx, "is-summary"),
|
|
805
|
+
start_time: ctx.str("start-time") || void 0,
|
|
806
|
+
end_time: ctx.str("end-time") || void 0,
|
|
807
|
+
push_language_code: ctx.str("push-language-code") || void 0,
|
|
808
|
+
user_time_zone: ctx.str("user-time-zone") || void 0,
|
|
809
|
+
show_time_zone: ctx.str("show-time-zone") || void 0,
|
|
810
|
+
limit: ctx.optionalNum("limit"),
|
|
811
|
+
format: ctx.str("artifact-format") || void 0,
|
|
812
|
+
timeout_seconds: ctx.optionalNum("timeout-seconds")
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
function validateDate(value, flag) {
|
|
816
|
+
if (value && !ISO_DATE.test(value)) {
|
|
817
|
+
printError("validation", `${flag} must be in yyyy-MM-dd format`);
|
|
818
|
+
process.exit(1);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
// src/commands/te-engage/engage-flow/metric-user/export.ts
|
|
823
|
+
var metricUserExport = createEngageFlowCapabilityCommand({
|
|
824
|
+
resource: "metric-user",
|
|
825
|
+
command: "export",
|
|
826
|
+
capabilityId: "engage-flow.metric-user.export",
|
|
827
|
+
description: "Export users behind a flow metric segment.",
|
|
828
|
+
flags: [...flowUserDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
|
|
829
|
+
risk: "read",
|
|
830
|
+
validate: validateFlowUserDetailInput,
|
|
831
|
+
buildInput: buildFlowUserDetailInput
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
// src/commands/te-engage/engage-flow/metric-user/run.ts
|
|
835
|
+
var metricUserRun = createEngageFlowCapabilityCommand({
|
|
836
|
+
resource: "metric-user",
|
|
837
|
+
command: "run",
|
|
838
|
+
capabilityId: "engage-flow.metric-user.run",
|
|
839
|
+
description: "Query users behind a flow metric segment inline.",
|
|
840
|
+
flags: [...flowUserDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
|
|
841
|
+
risk: "read",
|
|
842
|
+
validate: validateFlowUserDetailInput,
|
|
843
|
+
buildInput: buildFlowUserDetailInput
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
// src/commands/te-engage/engage-flow/node-metric-user/export.ts
|
|
847
|
+
var nodeMetricUserExport = createEngageFlowCapabilityCommand({
|
|
848
|
+
resource: "node-metric-user",
|
|
849
|
+
command: "export",
|
|
850
|
+
capabilityId: "engage-flow.node-metric-user.export",
|
|
851
|
+
description: "Export users behind a flow node metric segment.",
|
|
852
|
+
flags: [...flowNodeUserDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
|
|
853
|
+
risk: "read",
|
|
854
|
+
validate: validateFlowUserDetailInput,
|
|
855
|
+
buildInput: buildFlowUserDetailInput
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
// src/commands/te-engage/engage-flow/node-metric-user/run.ts
|
|
859
|
+
var nodeMetricUserRun = createEngageFlowCapabilityCommand({
|
|
860
|
+
resource: "node-metric-user",
|
|
861
|
+
command: "run",
|
|
862
|
+
capabilityId: "engage-flow.node-metric-user.run",
|
|
863
|
+
description: "Query users behind a flow node metric segment inline.",
|
|
864
|
+
flags: [...flowNodeUserDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
|
|
865
|
+
risk: "read",
|
|
866
|
+
validate: validateFlowUserDetailInput,
|
|
867
|
+
buildInput: buildFlowUserDetailInput
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
// src/commands/te-engage/engage-flow/node-user/export.ts
|
|
871
|
+
var nodeUserExport = createEngageFlowCapabilityCommand({
|
|
872
|
+
resource: "node-user",
|
|
873
|
+
command: "export",
|
|
874
|
+
capabilityId: "engage-flow.node-user.export",
|
|
875
|
+
description: "Export users behind a flow node segment.",
|
|
876
|
+
flags: [...flowNodeUserDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
|
|
877
|
+
risk: "read",
|
|
878
|
+
validate: validateFlowUserDetailInput,
|
|
879
|
+
buildInput: buildFlowUserDetailInput
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
// src/commands/te-engage/engage-flow/node-user/run.ts
|
|
883
|
+
var nodeUserRun = createEngageFlowCapabilityCommand({
|
|
884
|
+
resource: "node-user",
|
|
885
|
+
command: "run",
|
|
886
|
+
capabilityId: "engage-flow.node-user.run",
|
|
887
|
+
description: "Query users behind a flow node segment inline.",
|
|
888
|
+
flags: [...flowNodeUserDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
|
|
889
|
+
risk: "read",
|
|
890
|
+
validate: validateFlowUserDetailInput,
|
|
891
|
+
buildInput: buildFlowUserDetailInput
|
|
892
|
+
});
|
|
893
|
+
|
|
641
894
|
// src/commands/te-engage/engage-flow/operation-log/query.ts
|
|
642
895
|
var operationLogQuery = createEngageFlowCapabilityCommand({
|
|
643
896
|
resource: "operation-log",
|
|
@@ -652,6 +905,30 @@ var operationLogQuery = createEngageFlowCapabilityCommand({
|
|
|
652
905
|
buildInput: (ctx) => ({ project_id: ctx.num("project-id"), flow_id: ctx.str("flow-id") })
|
|
653
906
|
});
|
|
654
907
|
|
|
908
|
+
// src/commands/te-engage/engage-flow/report/metric-detail-export.ts
|
|
909
|
+
var flowReportMetricDetailExport = createEngageFlowCapabilityCommand({
|
|
910
|
+
resource: "report metric-detail",
|
|
911
|
+
command: "export",
|
|
912
|
+
capabilityId: "engage-flow.report.metric-detail.export",
|
|
913
|
+
description: "Export a flow node metric detail report artifact.",
|
|
914
|
+
flags: [...flowMetricDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
|
|
915
|
+
risk: "read",
|
|
916
|
+
validate: validateFlowReportInput,
|
|
917
|
+
buildInput: buildFlowReportInput
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
// src/commands/te-engage/engage-flow/report/metric-detail-run.ts
|
|
921
|
+
var flowReportMetricDetailRun = createEngageFlowCapabilityCommand({
|
|
922
|
+
resource: "report metric-detail",
|
|
923
|
+
command: "run",
|
|
924
|
+
capabilityId: "engage-flow.report.metric-detail.run",
|
|
925
|
+
description: "Query a flow node metric detail report inline.",
|
|
926
|
+
flags: [...flowMetricDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
|
|
927
|
+
risk: "read",
|
|
928
|
+
validate: validateFlowReportInput,
|
|
929
|
+
buildInput: buildFlowReportInput
|
|
930
|
+
});
|
|
931
|
+
|
|
655
932
|
// src/commands/te-engage/engage-flow/version/list.ts
|
|
656
933
|
var versionList = createEngageFlowCapabilityCommand({
|
|
657
934
|
resource: "version",
|
|
@@ -673,9 +950,18 @@ var commands = [
|
|
|
673
950
|
flowSave,
|
|
674
951
|
nodeConfigSchema,
|
|
675
952
|
nodeConfigValidate,
|
|
953
|
+
flowMetricUpdate,
|
|
676
954
|
flowModifyBaseInfo,
|
|
677
955
|
flowManage,
|
|
678
956
|
flowDelete,
|
|
957
|
+
flowReportMetricDetailRun,
|
|
958
|
+
flowReportMetricDetailExport,
|
|
959
|
+
metricUserRun,
|
|
960
|
+
metricUserExport,
|
|
961
|
+
nodeUserRun,
|
|
962
|
+
nodeUserExport,
|
|
963
|
+
nodeMetricUserRun,
|
|
964
|
+
nodeMetricUserExport,
|
|
679
965
|
operationLogQuery,
|
|
680
966
|
// testRun,
|
|
681
967
|
versionList,
|
|
@@ -3444,6 +3730,121 @@ var channelRefStats = createEngageTaskCapabilityCommand({
|
|
|
3444
3730
|
})
|
|
3445
3731
|
});
|
|
3446
3732
|
|
|
3733
|
+
// src/commands/te-engage/engage-task/task-data-shared.ts
|
|
3734
|
+
var ISO_DATE2 = /^\d{4}-\d{2}-\d{2}$/;
|
|
3735
|
+
var taskMetricDetailFlags = [
|
|
3736
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
3737
|
+
{ name: "task-id", type: "string", required: true, desc: "Engagement task ID." },
|
|
3738
|
+
{ name: "start-time", type: "string", required: true, desc: "Start date in yyyy-MM-dd format." },
|
|
3739
|
+
{ name: "end-time", type: "string", required: true, desc: "End date in yyyy-MM-dd format." },
|
|
3740
|
+
{ name: "metric-id-list", type: "json", required: false, desc: "Optional metric setting ID JSON array." },
|
|
3741
|
+
{ name: "group-type", type: "number", required: false, desc: "Optional metric grouping mode: 1, 2, 3, or 4." },
|
|
3742
|
+
{ name: "push-language-code", type: "string", required: false, desc: "Optional push content language code." },
|
|
3743
|
+
{ name: "show-time-zone", type: "string", required: false, desc: "Display timezone offset, such as 8.0 or -5.0." },
|
|
3744
|
+
{ name: "request-id", type: "string", required: false, desc: "Caller-provided report request ID." }
|
|
3745
|
+
];
|
|
3746
|
+
var taskDataDetailFlags = [
|
|
3747
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
3748
|
+
{ name: "task-id", type: "string", required: true, desc: "Engagement task ID." },
|
|
3749
|
+
{ name: "detail-type", type: "string", required: true, desc: "Detail mode: time, instance, or instance_daily." },
|
|
3750
|
+
{ name: "start-time", type: "string", required: true, desc: "Start date in yyyy-MM-dd format." },
|
|
3751
|
+
{ name: "end-time", type: "string", required: true, desc: "End date in yyyy-MM-dd format." },
|
|
3752
|
+
{ name: "task-instance-id", type: "string", required: false, desc: "Task instance ID. Required when detail-type is instance_daily." },
|
|
3753
|
+
{ name: "data-dim-type", type: "string", required: false, desc: "Data dimension type: uv or pv." },
|
|
3754
|
+
{ name: "retention-type", type: "string", required: false, desc: "Optional retention mode: retention or lost." },
|
|
3755
|
+
{ name: "data-view-type", type: "number", required: false, desc: "Triggered-task detail view type: 2 or 3." },
|
|
3756
|
+
{ name: "push-language-code", type: "string", required: false, desc: "Optional push content language code." },
|
|
3757
|
+
{ name: "show-time-zone", type: "string", required: false, desc: "Display timezone offset, such as 8.0 or -5.0." },
|
|
3758
|
+
{ name: "request-id", type: "string", required: false, desc: "Caller-provided report request ID." }
|
|
3759
|
+
];
|
|
3760
|
+
function validateTaskMetricDetailInput(ctx) {
|
|
3761
|
+
validateDateRange(ctx);
|
|
3762
|
+
const metricIdList = ctx.json("metric-id-list");
|
|
3763
|
+
if (metricIdList != null && !Array.isArray(metricIdList)) {
|
|
3764
|
+
printError("validation", "--metric-id-list must be a JSON array");
|
|
3765
|
+
process.exit(1);
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
function validateTaskDataDetailInput(ctx) {
|
|
3769
|
+
validateDateRange(ctx);
|
|
3770
|
+
const detailType = ctx.str("detail-type");
|
|
3771
|
+
if (!["time", "instance", "instance_daily"].includes(detailType)) {
|
|
3772
|
+
printError("validation", "--detail-type must be time, instance, or instance_daily");
|
|
3773
|
+
process.exit(1);
|
|
3774
|
+
}
|
|
3775
|
+
if (detailType === "instance_daily" && !ctx.str("task-instance-id")) {
|
|
3776
|
+
printError("validation", "--task-instance-id is required when --detail-type is instance_daily");
|
|
3777
|
+
process.exit(1);
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
function buildTaskMetricDetailInput(ctx) {
|
|
3781
|
+
return {
|
|
3782
|
+
project_id: ctx.num("project-id"),
|
|
3783
|
+
task_id: ctx.str("task-id"),
|
|
3784
|
+
start_time: ctx.str("start-time"),
|
|
3785
|
+
end_time: ctx.str("end-time"),
|
|
3786
|
+
metric_id_list: ctx.json("metric-id-list") || void 0,
|
|
3787
|
+
group_type: ctx.optionalNum("group-type"),
|
|
3788
|
+
push_language_code: ctx.str("push-language-code") || void 0,
|
|
3789
|
+
show_time_zone: ctx.str("show-time-zone") || void 0,
|
|
3790
|
+
request_id: ctx.str("request-id") || void 0
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
function buildTaskDataDetailInput(ctx) {
|
|
3794
|
+
return {
|
|
3795
|
+
project_id: ctx.num("project-id"),
|
|
3796
|
+
task_id: ctx.str("task-id"),
|
|
3797
|
+
detail_type: ctx.str("detail-type"),
|
|
3798
|
+
task_instance_id: ctx.str("task-instance-id") || void 0,
|
|
3799
|
+
start_time: ctx.str("start-time"),
|
|
3800
|
+
end_time: ctx.str("end-time"),
|
|
3801
|
+
data_dim_type: ctx.str("data-dim-type") || void 0,
|
|
3802
|
+
retention_type: ctx.str("retention-type") || void 0,
|
|
3803
|
+
data_view_type: ctx.optionalNum("data-view-type"),
|
|
3804
|
+
push_language_code: ctx.str("push-language-code") || void 0,
|
|
3805
|
+
show_time_zone: ctx.str("show-time-zone") || void 0,
|
|
3806
|
+
request_id: ctx.str("request-id") || void 0
|
|
3807
|
+
};
|
|
3808
|
+
}
|
|
3809
|
+
function validateDateRange(ctx) {
|
|
3810
|
+
validateDate2(ctx.str("start-time"), "--start-time");
|
|
3811
|
+
validateDate2(ctx.str("end-time"), "--end-time");
|
|
3812
|
+
if (ctx.str("start-time") > ctx.str("end-time")) {
|
|
3813
|
+
printError("validation", "--start-time must be earlier than or equal to --end-time");
|
|
3814
|
+
process.exit(1);
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
function validateDate2(value, flag) {
|
|
3818
|
+
if (value && !ISO_DATE2.test(value)) {
|
|
3819
|
+
printError("validation", `${flag} must be in yyyy-MM-dd format`);
|
|
3820
|
+
process.exit(1);
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
// src/commands/te-engage/engage-task/data-detail/query.ts
|
|
3825
|
+
var dataDetailQuery = createEngageTaskCapabilityCommand({
|
|
3826
|
+
resource: "data-detail",
|
|
3827
|
+
command: "query",
|
|
3828
|
+
capabilityId: "engage-task.task-data.detail",
|
|
3829
|
+
description: "Query task data-detail report data.",
|
|
3830
|
+
flags: taskDataDetailFlags,
|
|
3831
|
+
risk: "read",
|
|
3832
|
+
validate: validateTaskDataDetailInput,
|
|
3833
|
+
buildInput: buildTaskDataDetailInput
|
|
3834
|
+
});
|
|
3835
|
+
|
|
3836
|
+
// src/commands/te-engage/engage-task/effect/query.ts
|
|
3837
|
+
var taskEffectQuery = createEngageTaskCapabilityCommand({
|
|
3838
|
+
resource: "effect",
|
|
3839
|
+
command: "query",
|
|
3840
|
+
capabilityId: "engage-task.task-data.metric-detail",
|
|
3841
|
+
description: "Query task metric-detail report data.",
|
|
3842
|
+
flags: taskMetricDetailFlags,
|
|
3843
|
+
risk: "read",
|
|
3844
|
+
validate: validateTaskMetricDetailInput,
|
|
3845
|
+
buildInput: buildTaskMetricDetailInput
|
|
3846
|
+
});
|
|
3847
|
+
|
|
3447
3848
|
// src/commands/te-engage/engage-task/group/create.ts
|
|
3448
3849
|
var groupCreate = createEngageTaskCapabilityCommand({
|
|
3449
3850
|
resource: "group",
|
|
@@ -3573,7 +3974,7 @@ var operationLogQuery2 = createEngageTaskCapabilityCommand({
|
|
|
3573
3974
|
});
|
|
3574
3975
|
|
|
3575
3976
|
// src/commands/te-engage/engage-task/push-record/query.ts
|
|
3576
|
-
var
|
|
3977
|
+
var ISO_DATE3 = /^\d{4}-\d{2}-\d{2}$/;
|
|
3577
3978
|
var pushRecordQuery = createEngageTaskCapabilityCommand({
|
|
3578
3979
|
resource: "push-record",
|
|
3579
3980
|
command: "query",
|
|
@@ -3601,11 +4002,11 @@ var pushRecordQuery = createEngageTaskCapabilityCommand({
|
|
|
3601
4002
|
validate: (ctx) => {
|
|
3602
4003
|
const startDate = ctx.str("start-date");
|
|
3603
4004
|
const endDate = ctx.str("end-date");
|
|
3604
|
-
if (startDate && !
|
|
4005
|
+
if (startDate && !ISO_DATE3.test(startDate)) {
|
|
3605
4006
|
printError("validation", "--start-date must be in yyyy-MM-dd format");
|
|
3606
4007
|
process.exit(1);
|
|
3607
4008
|
}
|
|
3608
|
-
if (endDate && !
|
|
4009
|
+
if (endDate && !ISO_DATE3.test(endDate)) {
|
|
3609
4010
|
printError("validation", "--end-date must be in yyyy-MM-dd format");
|
|
3610
4011
|
process.exit(1);
|
|
3611
4012
|
}
|
|
@@ -3887,12 +4288,14 @@ var taskSave = createEngageTaskCapabilityCommand({
|
|
|
3887
4288
|
name: "req",
|
|
3888
4289
|
type: "json",
|
|
3889
4290
|
required: true,
|
|
3890
|
-
desc: "Task save JSON;
|
|
4291
|
+
desc: "Task save JSON; triggered tasks require periodTimeSymbol on the primary trigger rule."
|
|
3891
4292
|
}
|
|
3892
4293
|
],
|
|
3893
4294
|
risk: "write",
|
|
3894
4295
|
validate: (ctx) => {
|
|
3895
|
-
|
|
4296
|
+
const req = readRequiredJsonObject(ctx, "req");
|
|
4297
|
+
validateEmbeddedSemanticDefinitions(req, "--req");
|
|
4298
|
+
validateTaskTriggerPeriodDefinition(req, "--req");
|
|
3896
4299
|
},
|
|
3897
4300
|
buildInput: (ctx) => ({ project_id: ctx.num("project-id"), req: readRequiredJsonObject(ctx, "req") })
|
|
3898
4301
|
});
|
|
@@ -3922,6 +4325,8 @@ var commands6 = [
|
|
|
3922
4325
|
taskBuildSaveGuide,
|
|
3923
4326
|
taskSave,
|
|
3924
4327
|
taskManage,
|
|
4328
|
+
taskEffectQuery,
|
|
4329
|
+
dataDetailQuery,
|
|
3925
4330
|
channelRefStats,
|
|
3926
4331
|
groupCreate,
|
|
3927
4332
|
groupDelete,
|
|
@@ -3942,6 +4347,148 @@ var commands6 = [
|
|
|
3942
4347
|
];
|
|
3943
4348
|
var engage_task_default = commands6;
|
|
3944
4349
|
|
|
4350
|
+
// src/commands/te-engage/engage-query/artifact/download.ts
|
|
4351
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
4352
|
+
import { dirname, resolve } from "path";
|
|
4353
|
+
var artifactDownload = {
|
|
4354
|
+
service: "engage-query",
|
|
4355
|
+
resource: "artifact",
|
|
4356
|
+
command: "download",
|
|
4357
|
+
description: "Download a generated engagement query artifact.",
|
|
4358
|
+
flags: [
|
|
4359
|
+
{ name: "run-id", type: "string", required: true, desc: "Query or export run ID." },
|
|
4360
|
+
{ name: "artifact-id", type: "string", required: true, desc: "Artifact ID returned by an export capability." },
|
|
4361
|
+
{ name: "output", type: "string", required: true, desc: "Local output file path. Use a file path, not a directory." }
|
|
4362
|
+
],
|
|
4363
|
+
risk: "read",
|
|
4364
|
+
dryRun: (ctx) => ({
|
|
4365
|
+
method: "GET",
|
|
4366
|
+
url: buildCapabilityGatewayUrl(
|
|
4367
|
+
ctx.host(),
|
|
4368
|
+
resolveGatewayDomain("engage-query", "engage"),
|
|
4369
|
+
artifactPath(ctx.str("run-id"), ctx.str("artifact-id"))
|
|
4370
|
+
),
|
|
4371
|
+
output_path: resolve(ctx.str("output"))
|
|
4372
|
+
}),
|
|
4373
|
+
execute: async (ctx) => {
|
|
4374
|
+
const runId = ctx.str("run-id");
|
|
4375
|
+
const artifactId = ctx.str("artifact-id");
|
|
4376
|
+
const outputPath = resolve(ctx.str("output"));
|
|
4377
|
+
await ensureArtifactReady(ctx.host(), runId, artifactId);
|
|
4378
|
+
const resp = await fetchArtifact(ctx.host(), runId, artifactId);
|
|
4379
|
+
const bytes = Buffer.from(await resp.arrayBuffer());
|
|
4380
|
+
await mkdir(dirname(outputPath), { recursive: true });
|
|
4381
|
+
await writeFile(outputPath, bytes);
|
|
4382
|
+
return {
|
|
4383
|
+
run_id: runId,
|
|
4384
|
+
artifact_id: artifactId,
|
|
4385
|
+
output_path: outputPath,
|
|
4386
|
+
bytes: bytes.length,
|
|
4387
|
+
content_type: resp.headers.get("content-type") ?? void 0,
|
|
4388
|
+
content_encoding: resp.headers.get("content-encoding") ?? void 0,
|
|
4389
|
+
content_disposition: resp.headers.get("content-disposition") ?? void 0
|
|
4390
|
+
};
|
|
4391
|
+
}
|
|
4392
|
+
};
|
|
4393
|
+
function artifactPath(runId, artifactId) {
|
|
4394
|
+
return `runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/download`;
|
|
4395
|
+
}
|
|
4396
|
+
async function ensureArtifactReady(host, runId, artifactId) {
|
|
4397
|
+
const descriptor = await inspectRun(host, runId);
|
|
4398
|
+
const descriptorArtifactId = descriptor.artifact_id ?? descriptor.artifactId;
|
|
4399
|
+
const artifactStatus = descriptor.artifact_status ?? descriptor.artifactStatus;
|
|
4400
|
+
const errorMessage = descriptor.error_message ?? descriptor.errorMessage;
|
|
4401
|
+
if (descriptorArtifactId && descriptorArtifactId !== artifactId) {
|
|
4402
|
+
throw new CapabilityGatewayError(
|
|
4403
|
+
`artifact_id ${artifactId} does not belong to run_id ${runId}`,
|
|
4404
|
+
"ARTIFACT_RUN_MISMATCH",
|
|
4405
|
+
400,
|
|
4406
|
+
"Use the run_id and artifact_id pair from the same export response."
|
|
4407
|
+
);
|
|
4408
|
+
}
|
|
4409
|
+
const ready = descriptor.status === "SUCCEEDED" && (artifactStatus === "READY" || artifactStatus === "COMPLETED");
|
|
4410
|
+
if (ready) {
|
|
4411
|
+
return;
|
|
4412
|
+
}
|
|
4413
|
+
const reason = errorMessage ? `; error=${errorMessage}` : "";
|
|
4414
|
+
throw new CapabilityGatewayError(
|
|
4415
|
+
`Artifact is not ready: run_status=${descriptor.status ?? "UNKNOWN"}, artifact_status=${artifactStatus ?? "UNKNOWN"}${reason}`,
|
|
4416
|
+
"ARTIFACT_NOT_READY",
|
|
4417
|
+
409,
|
|
4418
|
+
"Run ae-cli engage-query run inspect --run-id <run_id> until status=SUCCEEDED and artifact_status=READY or COMPLETED, then retry artifact download. If status is FAILED or CANCELED, do not retry download."
|
|
4419
|
+
);
|
|
4420
|
+
}
|
|
4421
|
+
async function inspectRun(host, runId) {
|
|
4422
|
+
return await requestCapabilityGateway(
|
|
4423
|
+
host,
|
|
4424
|
+
resolveGatewayDomain("engage-query", "engage"),
|
|
4425
|
+
`runs/${encodeURIComponent(runId)}`
|
|
4426
|
+
);
|
|
4427
|
+
}
|
|
4428
|
+
async function fetchArtifact(host, runId, artifactId) {
|
|
4429
|
+
return fetchCapabilityGateway(
|
|
4430
|
+
host,
|
|
4431
|
+
resolveGatewayDomain("engage-query", "engage"),
|
|
4432
|
+
artifactPath(runId, artifactId),
|
|
4433
|
+
"GET",
|
|
4434
|
+
void 0,
|
|
4435
|
+
"application/octet-stream"
|
|
4436
|
+
);
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4439
|
+
// src/commands/te-engage/engage-query/query/cancel.ts
|
|
4440
|
+
var queryCancel = createEngageQueryCapabilityCommand({
|
|
4441
|
+
resource: "query",
|
|
4442
|
+
command: "cancel",
|
|
4443
|
+
capabilityId: "engage-query.query.cancel",
|
|
4444
|
+
description: "Cancel one running engagement query or export run.",
|
|
4445
|
+
flags: [
|
|
4446
|
+
{ name: "run-id", type: "string", required: true, desc: "Query or export run ID." },
|
|
4447
|
+
{ name: "reason", type: "string", required: false, desc: "Optional cancellation reason." }
|
|
4448
|
+
],
|
|
4449
|
+
risk: "write",
|
|
4450
|
+
buildInput: (ctx) => ({
|
|
4451
|
+
run_id: ctx.str("run-id"),
|
|
4452
|
+
reason: ctx.str("reason") || void 0
|
|
4453
|
+
})
|
|
4454
|
+
});
|
|
4455
|
+
|
|
4456
|
+
// src/commands/te-engage/engage-query/run/inspect.ts
|
|
4457
|
+
var runInspect = {
|
|
4458
|
+
service: "engage-query",
|
|
4459
|
+
resource: "run",
|
|
4460
|
+
command: "inspect",
|
|
4461
|
+
description: "Inspect one engagement query or export run status.",
|
|
4462
|
+
flags: [
|
|
4463
|
+
{ name: "run-id", type: "string", required: true, desc: "Query or export run ID." }
|
|
4464
|
+
],
|
|
4465
|
+
risk: "read",
|
|
4466
|
+
dryRun: (ctx) => ({
|
|
4467
|
+
method: "GET",
|
|
4468
|
+
url: buildCapabilityGatewayUrl(
|
|
4469
|
+
ctx.host(),
|
|
4470
|
+
resolveGatewayDomain("engage-query", "engage"),
|
|
4471
|
+
`runs/${encodeURIComponent(ctx.str("run-id"))}`
|
|
4472
|
+
)
|
|
4473
|
+
}),
|
|
4474
|
+
execute: async (ctx) => {
|
|
4475
|
+
const result = await requestCapabilityGatewayWithEnvelope(
|
|
4476
|
+
ctx.host(),
|
|
4477
|
+
resolveGatewayDomain("engage-query", "engage"),
|
|
4478
|
+
`runs/${encodeURIComponent(ctx.str("run-id"))}`
|
|
4479
|
+
);
|
|
4480
|
+
return withOutputMetadata(result.data, result.meta);
|
|
4481
|
+
}
|
|
4482
|
+
};
|
|
4483
|
+
|
|
4484
|
+
// src/commands/te-engage/engage-query/index.ts
|
|
4485
|
+
var commands7 = [
|
|
4486
|
+
runInspect,
|
|
4487
|
+
artifactDownload,
|
|
4488
|
+
queryCancel
|
|
4489
|
+
];
|
|
4490
|
+
var engage_query_default = commands7;
|
|
4491
|
+
|
|
3945
4492
|
// src/commands/te-engage/index.ts
|
|
3946
4493
|
registerCapabilityGatewayRoute("engage-flow", { gatewayDomain: "engage" });
|
|
3947
4494
|
registerCapabilityGatewayRoute("engage-task", { gatewayDomain: "engage" });
|
|
@@ -3949,15 +4496,17 @@ registerCapabilityGatewayRoute("engage-setting", { gatewayDomain: "engage" });
|
|
|
3949
4496
|
registerCapabilityGatewayRoute("engage-scene", { gatewayDomain: "engage" });
|
|
3950
4497
|
registerCapabilityGatewayRoute("engage-activity", { gatewayDomain: "engage" });
|
|
3951
4498
|
registerCapabilityGatewayRoute("engage-workbench", { gatewayDomain: "engage" });
|
|
3952
|
-
|
|
4499
|
+
registerCapabilityGatewayRoute("engage-query", { gatewayDomain: "engage" });
|
|
4500
|
+
var commands8 = [
|
|
3953
4501
|
...engage_flow_default,
|
|
3954
4502
|
...engage_task_default,
|
|
3955
4503
|
...engage_setting_default,
|
|
3956
4504
|
...engage_scene_default,
|
|
3957
4505
|
...engage_activity_default,
|
|
3958
|
-
...engage_workbench_default
|
|
4506
|
+
...engage_workbench_default,
|
|
4507
|
+
...engage_query_default
|
|
3959
4508
|
];
|
|
3960
|
-
var te_engage_default =
|
|
4509
|
+
var te_engage_default = commands8;
|
|
3961
4510
|
export {
|
|
3962
4511
|
te_engage_default as default
|
|
3963
4512
|
};
|