@thinkingai/ae-cli 6.0.29 → 6.0.31
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 +5 -7
- package/README.zh.md +5 -7
- package/dist/{auth-7TQRGLBC.js → auth-7H3HAAJ3.js} +10 -10
- package/dist/{capability-KVA55RMK.js → capability-SEH3JWLN.js} +49 -10
- package/dist/{capability-LKHLZQPD.js → capability-SQ2IWKP3.js} +49 -10
- package/dist/{chunk-GWZ5MYWE.js → chunk-6LEYLOV3.js} +25 -4
- package/dist/{chunk-THBBNYXI.js → chunk-DYOS6YY7.js} +100 -62
- package/dist/{chunk-CWZUGF2J.js → chunk-HL2AJQ4Q.js} +15 -0
- package/dist/{chunk-OJR23CIK.js → chunk-I4A62X3N.js} +100 -61
- package/dist/chunk-N2QORU5D.js +68 -0
- package/dist/{chunk-7QQ4233A.js → chunk-PKRD2IEM.js} +25 -4
- package/dist/chunk-TKQJQXWT.js +68 -0
- package/dist/{chunk-ZAOL36CG.js → chunk-TNW2CI4W.js} +46 -30
- package/dist/{config-ZVPARN4R.js → config-7UZWDE74.js} +25 -25
- package/dist/index.js +143 -46
- package/dist/{metadata-6CCFV4K5.js → metadata-W6JFFMBA.js} +6 -43
- package/dist/{metadata-PDOIWH5O.js → metadata-X62TKIVK.js} +6 -43
- package/dist/{raw-OHSUK42D.js → raw-CN542NGT.js} +8 -6
- package/dist/{sync-ULT5SECP.js → sync-ERNHDPB5.js} +1 -1
- package/dist/{te-agent-FAIBM3SA.js → te-agent-FCCWUDTJ.js} +1 -1
- package/dist/te-analysis-NJGNWZFC.js +4530 -0
- package/dist/te-analysis-YGV5V5EX.js +4530 -0
- package/dist/{te-common-SDB3O2QG.js → te-common-5NJLF3XG.js} +1 -1
- package/dist/{te-common-CFGQXTFV.js → te-common-7VTJZPII.js} +1 -1
- package/dist/{te-community-6A7LKYUH.js → te-community-PEZ2VEF7.js} +1 -1
- package/dist/{te-community-GMWFGILT.js → te-community-TSKJ652U.js} +1 -1
- package/dist/{te-dataops-Z53CTG2U.js → te-dataops-F36T656A.js} +32 -12
- package/dist/{te-dataops-6LIPYNGH.js → te-dataops-ZNJBQ6VT.js} +33 -12
- package/dist/{te-engage-M7JQSJDP.js → te-engage-BUWVSSSK.js} +398 -11
- package/dist/{te-engage-545HJL6J.js → te-engage-EPE3QKDE.js} +398 -11
- package/dist/{te-meta-FADFLTDM.js → te-meta-MAAUHFQO.js} +9 -9
- package/dist/{te-meta-PKT27OTN.js → te-meta-VKWNAWO4.js} +9 -9
- package/dist/{te-team-RG75PR5D.js → te-team-OKCOX7OE.js} +5 -5
- package/package.json +15 -7
- package/skills/ae-agent/SKILL.md +6 -8
- package/skills/ae-agent/references/accept-skill-share.md +2 -2
- package/skills/ae-agent/references/add-attachment.md +3 -3
- package/skills/ae-agent/references/add-mcp.md +2 -3
- package/skills/ae-agent/references/add-model.md +3 -5
- package/skills/ae-agent/references/add-skill.md +2 -3
- package/skills/ae-agent/references/approve-skill.md +2 -2
- package/skills/ae-agent/references/auto-provision-mcp-credentials.md +3 -3
- package/skills/ae-agent/references/cancel-skill-submission.md +2 -2
- package/skills/ae-agent/references/copy-skill.md +3 -3
- package/skills/ae-agent/references/create-agent.md +3 -4
- package/skills/ae-agent/references/create-automation.md +5 -9
- package/skills/ae-agent/references/del-agent.md +3 -2
- package/skills/ae-agent/references/del-attachment.md +3 -2
- package/skills/ae-agent/references/del-mcp.md +3 -2
- package/skills/ae-agent/references/del-model.md +3 -2
- package/skills/ae-agent/references/del-skill-asset.md +3 -3
- package/skills/ae-agent/references/del-skill-reference.md +3 -3
- package/skills/ae-agent/references/del-skill-script.md +3 -3
- package/skills/ae-agent/references/del-skill.md +3 -2
- package/skills/ae-agent/references/edit-skill.md +4 -4
- package/skills/ae-agent/references/mcp-auth-disconnect.md +2 -2
- package/skills/ae-agent/references/mcp-auth-start.md +3 -3
- package/skills/ae-agent/references/reject-skill-share.md +2 -2
- package/skills/ae-agent/references/reject-skill.md +2 -2
- package/skills/ae-agent/references/rescan-skills.md +2 -2
- package/skills/ae-agent/references/set-mcp-credential.md +3 -3
- package/skills/ae-agent/references/set-mcp-meta.md +2 -2
- package/skills/ae-agent/references/set-skill-meta.md +2 -2
- package/skills/ae-agent/references/share-skill.md +3 -3
- package/skills/ae-agent/references/submit-skill.md +3 -3
- package/skills/ae-agent/references/toggle-mcp.md +3 -3
- package/skills/ae-agent/references/toggle-model.md +3 -3
- package/skills/ae-agent/references/toggle-skill.md +3 -3
- package/skills/ae-agent/references/update-agent.md +2 -2
- package/skills/ae-agent/references/update-automation.md +6 -8
- package/skills/ae-agent/references/update-mcp.md +4 -4
- package/skills/ae-agent/references/update-model.md +2 -3
- package/skills/ae-agent/references/upload-skill-asset.md +3 -3
- package/skills/ae-agent/references/upload-skill-reference.md +3 -3
- package/skills/ae-agent/references/upload-skill-script.md +3 -3
- package/skills/ae-agent/references/upload-skill.md +6 -7
- package/skills/ae-analysis/SKILL.md +105 -512
- package/skills/ae-analysis/references/adhoc_export.md +71 -0
- package/skills/ae-analysis/references/adhoc_run.md +58 -0
- package/skills/ae-analysis/references/ai_models.md +459 -0
- package/skills/ae-analysis/references/analysis_data_retrieval.md +101 -0
- package/skills/ae-analysis/references/analysis_gateway_assets.md +72 -12
- package/skills/ae-analysis/references/analysis_interpretation.md +38 -0
- package/skills/ae-analysis/references/artifact_download.md +13 -7
- package/skills/ae-analysis/references/asset_abnormal_get.md +5 -5
- package/skills/ae-analysis/references/asset_abnormal_list.md +5 -5
- package/skills/ae-analysis/references/asset_authentication_list.md +5 -5
- package/skills/ae-analysis/references/asset_authentication_update.md +6 -6
- package/skills/ae-analysis/references/asset_batch_dashboard_schedule_freeze.md +26 -0
- package/skills/ae-analysis/references/asset_batch_delete.md +26 -0
- package/skills/ae-analysis/references/asset_batch_disable_auto_backup.md +26 -0
- package/skills/ae-analysis/references/asset_batch_disable_auto_update.md +26 -0
- package/skills/ae-analysis/references/asset_batch_handover.md +26 -0
- package/skills/ae-analysis/references/asset_batch_info_export.md +25 -0
- package/skills/ae-analysis/references/asset_batch_sql_export.md +25 -0
- package/skills/ae-analysis/references/asset_dependency_list.md +30 -0
- package/skills/ae-analysis/references/asset_export.md +30 -0
- package/skills/ae-analysis/references/asset_impact_list.md +30 -0
- package/skills/ae-analysis/references/asset_lineage_get.md +25 -0
- package/skills/ae-analysis/references/asset_list.md +30 -0
- package/skills/ae-analysis/references/asset_query_history_list.md +30 -0
- package/skills/ae-analysis/references/asset_recent_list.md +4 -4
- package/skills/ae-analysis/references/asset_search.md +4 -4
- package/skills/ae-analysis/references/asset_url_get.md +28 -0
- package/skills/ae-analysis/references/audience_models.md +42 -0
- package/skills/ae-analysis/references/batch_create_metadata.md +5 -1
- package/skills/ae-analysis/references/batch_edit_metadata.md +4 -1
- package/skills/ae-analysis/references/bi_panel_copy.md +1 -1
- package/skills/ae-analysis/references/bi_panel_create.md +1 -1
- package/skills/ae-analysis/references/bi_panel_delete.md +2 -0
- package/skills/ae-analysis/references/bi_panel_list.md +4 -2
- package/skills/ae-analysis/references/bi_panel_page_data_export.md +8 -4
- package/skills/ae-analysis/references/bi_panel_page_data_run.md +7 -3
- package/skills/ae-analysis/references/bi_panel_share.md +1 -1
- package/skills/ae-analysis/references/bi_panel_update.md +1 -1
- package/skills/ae-analysis/references/bi_panel_version_publish.md +1 -1
- package/skills/ae-analysis/references/cancel_query.md +4 -4
- package/skills/ae-analysis/references/command_index.md +209 -0
- package/skills/ae-analysis/references/create_alert.md +1 -1
- package/skills/ae-analysis/references/create_entity.md +1 -1
- package/skills/ae-analysis/references/create_metric.md +11 -15
- package/skills/ae-analysis/references/create_project_mark_time.md +2 -1
- package/skills/ae-analysis/references/create_virtual_event.md +10 -14
- package/skills/ae-analysis/references/create_virtual_property.md +1 -1
- package/skills/ae-analysis/references/dashboard_copy.md +1 -1
- package/skills/ae-analysis/references/dashboard_create.md +1 -1
- package/skills/ae-analysis/references/dashboard_daily_report_send.md +1 -1
- package/skills/ae-analysis/references/dashboard_daily_report_update.md +1 -1
- package/skills/ae-analysis/references/dashboard_definition_import.md +1 -1
- package/skills/ae-analysis/references/dashboard_delete.md +2 -0
- package/skills/ae-analysis/references/dashboard_freeze.md +1 -1
- package/skills/ae-analysis/references/dashboard_handover.md +1 -1
- package/skills/ae-analysis/references/dashboard_list.md +4 -2
- package/skills/ae-analysis/references/dashboard_report_add.md +15 -0
- package/skills/ae-analysis/references/dashboard_report_data_export.md +15 -7
- package/skills/ae-analysis/references/dashboard_report_data_run.md +15 -7
- package/skills/ae-analysis/references/dashboard_share.md +11 -2
- package/skills/ae-analysis/references/dashboard_update.md +12 -3
- package/skills/ae-analysis/references/datatable_columns_get.md +2 -2
- package/skills/ae-analysis/references/datatable_influence_list.md +2 -2
- package/skills/ae-analysis/references/datatable_version_get.md +2 -2
- package/skills/ae-analysis/references/datatable_version_list.md +2 -2
- package/skills/ae-analysis/references/delete_alert.md +8 -3
- package/skills/ae-analysis/references/delete_metric.md +8 -3
- package/skills/ae-analysis/references/delete_project_mark_times.md +5 -3
- package/skills/ae-analysis/references/delete_track_items.md +4 -3
- package/skills/ae-analysis/references/drilldown_user_events_export.md +20 -0
- package/skills/ae-analysis/references/drilldown_user_events_run.md +34 -0
- package/skills/ae-analysis/references/drilldown_users_export.md +17 -0
- package/skills/ae-analysis/references/drilldown_users_run.md +61 -0
- package/skills/ae-analysis/references/entity_detail_export.md +31 -0
- package/skills/ae-analysis/references/entity_detail_run.md +50 -0
- package/skills/ae-analysis/references/entity_id_import_options.md +20 -0
- package/skills/ae-analysis/references/event_changelog_list.md +2 -2
- package/skills/ae-analysis/references/event_create.md +4 -4
- package/skills/ae-analysis/references/event_delete.md +5 -4
- package/skills/ae-analysis/references/event_detail_export.md +31 -0
- package/skills/ae-analysis/references/event_detail_run.md +58 -0
- package/skills/ae-analysis/references/event_get.md +2 -2
- package/skills/ae-analysis/references/event_hide_update.md +3 -3
- package/skills/ae-analysis/references/event_influence_list.md +2 -2
- package/skills/ae-analysis/references/event_list.md +2 -2
- package/skills/ae-analysis/references/{super_metadata_export.md → event_property_bundle_export.md} +7 -7
- package/skills/ae-analysis/references/event_property_bundle_import.md +25 -0
- package/skills/ae-analysis/references/event_relation_update.md +4 -4
- package/skills/ae-analysis/references/event_update.md +2 -2
- package/skills/ae-analysis/references/exchange_config_update.md +2 -2
- package/skills/ae-analysis/references/exchange_rate_refresh.md +2 -2
- package/skills/ae-analysis/references/exchange_rule_list.md +2 -2
- package/skills/ae-analysis/references/exchange_rule_update.md +4 -4
- package/skills/ae-analysis/references/exchange_rule_validate.md +4 -4
- package/skills/ae-analysis/references/favorite_add.md +1 -1
- package/skills/ae-analysis/references/favorite_remove.md +1 -1
- package/skills/ae-analysis/references/folder_create.md +2 -3
- package/skills/ae-analysis/references/folder_share.md +2 -3
- package/skills/ae-analysis/references/generate_track_program.md +2 -1
- package/skills/ae-analysis/references/generate_track_sdk_sample.md +2 -1
- package/skills/ae-analysis/references/get_alert.md +4 -0
- package/skills/ae-analysis/references/get_alert_definition_schema.md +1 -0
- package/skills/ae-analysis/references/get_metric.md +4 -4
- package/skills/ae-analysis/references/get_project_config.md +1 -0
- package/skills/ae-analysis/references/get_resource_url.md +1 -0
- package/skills/ae-analysis/references/get_track_program.md +3 -0
- package/skills/ae-analysis/references/history_tag_batch_refresh.md +19 -0
- package/skills/ae-analysis/references/history_tag_clear.md +13 -0
- package/skills/ae-analysis/references/history_tag_data_drilldown_export.md +15 -0
- package/skills/ae-analysis/references/history_tag_data_drilldown_run.md +13 -0
- package/skills/ae-analysis/references/history_tag_data_export.md +15 -0
- package/skills/ae-analysis/references/history_tag_data_run.md +15 -0
- package/skills/ae-analysis/references/history_tag_list.md +11 -0
- package/skills/ae-analysis/references/history_tag_refresh.md +11 -0
- package/skills/ae-analysis/references/input_file_inspect.md +9 -0
- package/skills/ae-analysis/references/input_file_purpose_list.md +9 -0
- package/skills/ae-analysis/references/input_file_upload.md +11 -0
- package/skills/ae-analysis/references/list_alerts.md +3 -2
- package/skills/ae-analysis/references/list_entities.md +3 -2
- package/skills/ae-analysis/references/list_events.md +5 -5
- package/skills/ae-analysis/references/list_metrics.md +5 -5
- package/skills/ae-analysis/references/list_project_mark_times.md +2 -1
- package/skills/ae-analysis/references/list_project_users.md +1 -0
- package/skills/ae-analysis/references/list_properties.md +5 -5
- package/skills/ae-analysis/references/load_filters.md +3 -0
- package/skills/ae-analysis/references/metric_create.md +11 -6
- package/skills/ae-analysis/references/metric_delete.md +5 -4
- package/skills/ae-analysis/references/metric_get.md +2 -2
- package/skills/ae-analysis/references/metric_list.md +2 -2
- package/skills/ae-analysis/references/metric_update.md +12 -6
- package/skills/ae-analysis/references/operation_record_export.md +25 -0
- package/skills/ae-analysis/references/operation_record_list.md +31 -0
- package/skills/ae-analysis/references/project_space_create.md +2 -3
- package/skills/ae-analysis/references/project_space_list.md +3 -1
- package/skills/ae-analysis/references/project_space_share.md +2 -3
- package/skills/ae-analysis/references/property_changelog_list.md +2 -2
- package/skills/ae-analysis/references/property_create.md +4 -4
- package/skills/ae-analysis/references/property_delete.md +5 -4
- package/skills/ae-analysis/references/property_get.md +2 -2
- package/skills/ae-analysis/references/property_hide_update.md +3 -3
- package/skills/ae-analysis/references/property_influence_list.md +2 -2
- package/skills/ae-analysis/references/property_list.md +2 -2
- package/skills/ae-analysis/references/property_related_events.md +2 -2
- package/skills/ae-analysis/references/property_relation_update.md +4 -4
- package/skills/ae-analysis/references/property_update.md +2 -2
- package/skills/ae-analysis/references/public_link_create.md +1 -1
- package/skills/ae-analysis/references/public_link_delete.md +2 -0
- package/skills/ae-analysis/references/public_link_list.md +3 -1
- package/skills/ae-analysis/references/public_link_offline.md +1 -1
- package/skills/ae-analysis/references/public_link_update.md +1 -1
- package/skills/ae-analysis/references/query_cancel.md +1 -1
- package/skills/ae-analysis/references/query_create_result_cluster.md +47 -0
- package/skills/ae-analysis/references/report_abnormal_get.md +15 -0
- package/skills/ae-analysis/references/report_change_log_get.md +15 -0
- package/skills/ae-analysis/references/report_change_log_list.md +15 -0
- package/skills/ae-analysis/references/report_create.md +29 -0
- package/skills/ae-analysis/references/report_data_export.md +37 -0
- package/skills/ae-analysis/references/report_data_run.md +45 -0
- package/skills/ae-analysis/references/report_delete.md +17 -0
- package/skills/ae-analysis/references/report_get.md +21 -0
- package/skills/ae-analysis/references/report_list.md +17 -0
- package/skills/ae-analysis/references/report_list_export.md +15 -0
- package/skills/ae-analysis/references/report_update.md +22 -0
- package/skills/ae-analysis/references/report_version_rollback.md +15 -0
- package/skills/ae-analysis/references/rule_create.md +27 -0
- package/skills/ae-analysis/references/rule_delete.md +26 -0
- package/skills/ae-analysis/references/rule_list.md +24 -0
- package/skills/ae-analysis/references/rule_schema.md +24 -0
- package/skills/ae-analysis/references/rule_update.md +28 -0
- package/skills/ae-analysis/references/run_inspect.md +10 -4
- package/skills/ae-analysis/references/save_track_items.md +4 -1
- package/skills/ae-analysis/references/sql_table_columns.md +20 -0
- package/skills/ae-analysis/references/sql_table_list.md +33 -0
- package/skills/ae-analysis/references/update_alert.md +1 -1
- package/skills/ae-analysis/references/update_metric.md +11 -14
- package/skills/ae-analysis/references/update_project_mark_time.md +4 -3
- package/skills/ae-analysis/references/user_cluster_create.md +15 -0
- package/skills/ae-analysis/references/user_cluster_create_id.md +15 -0
- package/skills/ae-analysis/references/user_cluster_delete.md +13 -0
- package/skills/ae-analysis/references/user_cluster_get.md +11 -0
- package/skills/ae-analysis/references/user_cluster_list.md +15 -0
- package/skills/ae-analysis/references/user_cluster_member_export.md +15 -0
- package/skills/ae-analysis/references/user_cluster_member_list.md +19 -0
- package/skills/ae-analysis/references/user_cluster_models.md +87 -0
- package/skills/ae-analysis/references/user_cluster_refresh.md +11 -0
- package/skills/ae-analysis/references/user_cluster_update.md +13 -0
- package/skills/ae-analysis/references/user_cluster_update_id.md +15 -0
- package/skills/ae-analysis/references/user_tag_create.md +15 -0
- package/skills/ae-analysis/references/user_tag_create_id.md +15 -0
- package/skills/ae-analysis/references/user_tag_delete.md +13 -0
- package/skills/ae-analysis/references/user_tag_get.md +11 -0
- package/skills/ae-analysis/references/user_tag_list.md +17 -0
- package/skills/ae-analysis/references/user_tag_member_export.md +15 -0
- package/skills/ae-analysis/references/user_tag_member_list.md +19 -0
- package/skills/ae-analysis/references/user_tag_models.md +54 -0
- package/skills/ae-analysis/references/user_tag_refresh.md +11 -0
- package/skills/ae-analysis/references/user_tag_update.md +13 -0
- package/skills/ae-analysis/references/user_tag_update_id.md +15 -0
- package/skills/ae-analysis/references/virtual_event_create.md +4 -4
- package/skills/ae-analysis/references/virtual_event_delete.md +5 -4
- package/skills/ae-analysis/references/virtual_event_get.md +2 -2
- package/skills/ae-analysis/references/virtual_property_create.md +13 -6
- package/skills/ae-analysis/references/virtual_property_sql_rule_delete.md +5 -4
- package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +13 -6
- package/skills/ae-analysis-global/SKILL.md +6 -8
- package/skills/ae-analysis-global/references/list_query_clusters.md +7 -6
- package/skills/ae-capability/SKILL.md +68 -15
- package/skills/ae-community/SKILL.md +2 -2
- package/skills/ae-data-integration-helper/SKILL.md +1 -1
- package/skills/ae-dataops/SKILL.md +1 -1
- package/skills/ae-engage/SKILL.md +38 -10
- package/skills/ae-engage/references/build-task-save-guide.md +11 -9
- package/skills/ae-engage/references/channel_touch_limits_list.md +29 -0
- package/skills/ae-engage/references/group-list.md +13 -0
- package/skills/ae-engage/references/operation-log-query.md +11 -0
- package/skills/ae-engage/references/ops-delete.md +14 -0
- package/skills/ae-engage/references/push-record-query.md +26 -0
- package/skills/ae-engage/references/save-flow.md +5 -4
- package/skills/ae-engage/references/save-task.md +24 -20
- package/skills/ae-engage/references/segment-list-query.md +18 -0
- package/skills/ae-engage/references/task-operation-log-query.md +23 -0
- package/skills/ae-engage/references/version-list.md +18 -0
- package/skills/ae-generate-tracking-code/SKILL.md +2 -2
- package/skills/ae-generate-tracking-code/references/snippet-delivery.md +2 -2
- package/skills/ae-generate-tracking-plan/SKILL.md +18 -13
- package/skills/ae-generate-tracking-plan/references/te-api.md +2 -1
- package/skills/ae-kb/SKILL.md +1 -1
- package/skills/ae-metadata/SKILL.md +9 -8
- package/skills/ae-metadata/references/metadata_data_table_csv_delete.md +1 -0
- package/skills/ae-metadata/references/metadata_data_table_csv_write.md +6 -6
- package/skills/ae-metadata/references/metadata_data_table_property_bindings_update.md +2 -2
- package/skills/ae-metadata/references/metadata_data_table_sql_delete.md +1 -0
- package/skills/ae-metadata/references/metadata_data_table_sql_write.md +21 -7
- package/skills/ae-metadata/references/metadata_property_dimension_table_bind_existing.md +3 -3
- package/skills/ae-metadata/references/metadata_property_dimension_table_create_and_bind_csv.md +4 -4
- package/skills/ae-team/SKILL.md +9 -9
- package/skills/ae-team/references/create.md +2 -2
- package/skills/ae-team/references/delete.md +3 -3
- package/skills/ae-team/references/run-cancel.md +3 -3
- package/skills/ae-team/references/run-chat.md +4 -4
- package/skills/ae-team/references/run-reply.md +3 -3
- package/skills/ae-team/references/run-start.md +4 -5
- package/skills/ae-team/references/run-watch.md +1 -1
- package/skills/ae-team/references/update.md +2 -2
- package/dist/chunk-P2JRP6HJ.js +0 -42
- package/dist/chunk-S5XN6KEX.js +0 -42
- package/dist/te-analysis-DDXGM7WM.js +0 -3188
- package/dist/te-analysis-HCDNYI7E.js +0 -3188
- package/dist/te-audience-ECFS4GF4.js +0 -600
- package/dist/te-audience-WO377T2J.js +0 -600
- package/skills/ae-analysis/references/build_attribution_analysis_qp.md +0 -62
- package/skills/ae-analysis/references/build_cluster_definition.md +0 -62
- package/skills/ae-analysis/references/build_distribution_analysis_qp.md +0 -67
- package/skills/ae-analysis/references/build_entity_details_sql.md +0 -58
- package/skills/ae-analysis/references/build_event_analysis_qp.md +0 -134
- package/skills/ae-analysis/references/build_event_details_sql.md +0 -61
- package/skills/ae-analysis/references/build_funnel_analysis_qp.md +0 -145
- package/skills/ae-analysis/references/build_heat_map_analysis_qp.md +0 -54
- package/skills/ae-analysis/references/build_interval_analysis_qp.md +0 -60
- package/skills/ae-analysis/references/build_path_analysis_qp.md +0 -53
- package/skills/ae-analysis/references/build_prop_analysis_qp.md +0 -124
- package/skills/ae-analysis/references/build_rank_list_analysis_qp.md +0 -63
- package/skills/ae-analysis/references/build_retention_analysis_qp.md +0 -143
- package/skills/ae-analysis/references/build_tag_definition.md +0 -65
- package/skills/ae-analysis/references/copy_dashboard.md +0 -33
- package/skills/ae-analysis/references/create_cluster.md +0 -69
- package/skills/ae-analysis/references/create_dashboard.md +0 -49
- package/skills/ae-analysis/references/create_id_cluster.md +0 -40
- package/skills/ae-analysis/references/create_id_tag.md +0 -39
- package/skills/ae-analysis/references/create_or_update_dashboard_note.md +0 -39
- package/skills/ae-analysis/references/create_public_access_link.md +0 -43
- package/skills/ae-analysis/references/create_report.md +0 -60
- package/skills/ae-analysis/references/create_result_cluster.md +0 -73
- package/skills/ae-analysis/references/create_space.md +0 -34
- package/skills/ae-analysis/references/create_tag.md +0 -61
- package/skills/ae-analysis/references/delete_cluster.md +0 -27
- package/skills/ae-analysis/references/delete_dashboard.md +0 -30
- package/skills/ae-analysis/references/delete_report.md +0 -27
- package/skills/ae-analysis/references/delete_tag.md +0 -27
- package/skills/ae-analysis/references/drilldown_user_events.md +0 -74
- package/skills/ae-analysis/references/drilldown_users.md +0 -80
- package/skills/ae-analysis/references/freeze_dashboards.md +0 -29
- package/skills/ae-analysis/references/get_analysis_query_schema.md +0 -71
- package/skills/ae-analysis/references/get_bi_panel_detail.md +0 -35
- package/skills/ae-analysis/references/get_cluster_definition_schema.md +0 -53
- package/skills/ae-analysis/references/get_clusters_by_name.md +0 -69
- package/skills/ae-analysis/references/get_filter_schema.md +0 -33
- package/skills/ae-analysis/references/get_groupby_schema.md +0 -33
- package/skills/ae-analysis/references/get_report_definition.md +0 -37
- package/skills/ae-analysis/references/get_table_columns.md +0 -37
- package/skills/ae-analysis/references/get_tag_definition_schema.md +0 -49
- package/skills/ae-analysis/references/get_tags_by_name.md +0 -69
- package/skills/ae-analysis/references/list_bi_panels.md +0 -35
- package/skills/ae-analysis/references/list_cluster_members.md +0 -45
- package/skills/ae-analysis/references/list_clusters.md +0 -46
- package/skills/ae-analysis/references/list_dashboards.md +0 -43
- package/skills/ae-analysis/references/list_public_access_links.md +0 -41
- package/skills/ae-analysis/references/list_reports.md +0 -43
- package/skills/ae-analysis/references/list_spaces.md +0 -27
- package/skills/ae-analysis/references/list_tag_members.md +0 -46
- package/skills/ae-analysis/references/list_tags.md +0 -44
- package/skills/ae-analysis/references/move_dashboard.md +0 -33
- package/skills/ae-analysis/references/query_adhoc.md +0 -141
- package/skills/ae-analysis/references/query_bi_panel_data.md +0 -58
- package/skills/ae-analysis/references/query_dashboard_detail.md +0 -35
- package/skills/ae-analysis/references/query_dashboard_report_data.md +0 -63
- package/skills/ae-analysis/references/query_entity_details.md +0 -63
- package/skills/ae-analysis/references/query_event_details.md +0 -66
- package/skills/ae-analysis/references/query_report_data.md +0 -99
- package/skills/ae-analysis/references/refresh_cluster.md +0 -31
- package/skills/ae-analysis/references/refresh_tag.md +0 -31
- package/skills/ae-analysis/references/super_metadata_import.md +0 -24
- package/skills/ae-analysis/references/update_cluster.md +0 -61
- package/skills/ae-analysis/references/update_dashboard.md +0 -45
- package/skills/ae-analysis/references/update_id_cluster.md +0 -36
- package/skills/ae-analysis/references/update_id_tag.md +0 -37
- package/skills/ae-analysis/references/update_public_access_link.md +0 -41
- package/skills/ae-analysis/references/update_report.md +0 -35
- package/skills/ae-analysis/references/update_tag.md +0 -61
- package/skills/ae-analysis-intent/SKILL.md +0 -132
- package/skills/ae-metadata/references/metadata_input_file_upload.md +0 -29
|
@@ -14,16 +14,18 @@ import {
|
|
|
14
14
|
import { readFile } from "fs/promises";
|
|
15
15
|
import { basename } from "path";
|
|
16
16
|
var CapabilityGatewayError = class extends Error {
|
|
17
|
-
constructor(message, code, httpStatus, hint) {
|
|
17
|
+
constructor(message, code, httpStatus, hint, meta) {
|
|
18
18
|
super(message);
|
|
19
19
|
this.code = code;
|
|
20
20
|
this.httpStatus = httpStatus;
|
|
21
21
|
this.hint = hint;
|
|
22
|
+
this.meta = meta;
|
|
22
23
|
this.name = "CapabilityGatewayError";
|
|
23
24
|
}
|
|
24
25
|
code;
|
|
25
26
|
httpStatus;
|
|
26
27
|
hint;
|
|
28
|
+
meta;
|
|
27
29
|
};
|
|
28
30
|
function buildCapabilityGatewayUrl(host, domain, pathAfterV1, queryParams = {}) {
|
|
29
31
|
const base = host.replace(/\/+$/, "");
|
|
@@ -59,25 +61,41 @@ function parseCapabilityResponse(text) {
|
|
|
59
61
|
return text;
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
|
-
function
|
|
64
|
+
function parseCapabilityEnvelope(body) {
|
|
63
65
|
if (body == null) {
|
|
64
66
|
throw new CapabilityGatewayError("Empty capability gateway response");
|
|
65
67
|
}
|
|
66
68
|
if (typeof body.ok === "boolean") {
|
|
67
69
|
if (body.ok) {
|
|
68
|
-
return
|
|
70
|
+
return {
|
|
71
|
+
ok: true,
|
|
72
|
+
data: body.data,
|
|
73
|
+
...isRecord(body.meta) ? { meta: body.meta } : {}
|
|
74
|
+
};
|
|
69
75
|
}
|
|
70
76
|
const err = body.error ?? {};
|
|
71
77
|
const code = nonEmptyString(err.code);
|
|
72
78
|
const message = nonEmptyString(err.message) ?? code ?? "Capability gateway request failed";
|
|
73
79
|
const hint = nonEmptyString(err.hint);
|
|
74
|
-
throw new CapabilityGatewayError(
|
|
80
|
+
throw new CapabilityGatewayError(
|
|
81
|
+
message,
|
|
82
|
+
code,
|
|
83
|
+
err.http_status ?? err.httpStatus,
|
|
84
|
+
hint,
|
|
85
|
+
isRecord(body.meta) ? body.meta : void 0
|
|
86
|
+
);
|
|
75
87
|
}
|
|
76
|
-
return body;
|
|
88
|
+
return { ok: true, data: body };
|
|
89
|
+
}
|
|
90
|
+
function unwrapCapabilityEnvelope(body) {
|
|
91
|
+
return parseCapabilityEnvelope(body).data;
|
|
77
92
|
}
|
|
78
93
|
function nonEmptyString(value) {
|
|
79
94
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
80
95
|
}
|
|
96
|
+
function isRecord(value) {
|
|
97
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
98
|
+
}
|
|
81
99
|
function buildCapabilityHttpError(resp, body) {
|
|
82
100
|
const fallback = `Capability gateway HTTP error: ${resp.status} ${resp.statusText}`.trim();
|
|
83
101
|
if (body && typeof body === "object") {
|
|
@@ -87,7 +105,13 @@ function buildCapabilityHttpError(resp, body) {
|
|
|
87
105
|
const hint = nonEmptyString(err.hint) ?? nonEmptyString(body.hint);
|
|
88
106
|
const details = [code, message, hint ? `Hint: ${hint}` : void 0].filter(Boolean);
|
|
89
107
|
if (details.length > 0) {
|
|
90
|
-
return new CapabilityGatewayError(
|
|
108
|
+
return new CapabilityGatewayError(
|
|
109
|
+
message ?? fallback,
|
|
110
|
+
code,
|
|
111
|
+
resp.status,
|
|
112
|
+
hint,
|
|
113
|
+
isRecord(body.meta) ? body.meta : void 0
|
|
114
|
+
);
|
|
91
115
|
}
|
|
92
116
|
}
|
|
93
117
|
if (typeof body === "string" && body.trim()) {
|
|
@@ -99,10 +123,10 @@ async function throwCapabilityHttpError(resp) {
|
|
|
99
123
|
const body = parseCapabilityResponse(await resp.text());
|
|
100
124
|
throw buildCapabilityHttpError(resp, body);
|
|
101
125
|
}
|
|
102
|
-
async function requestOnce(url, method, token, body) {
|
|
126
|
+
async function requestOnce(url, method, token, body, accept = "application/json") {
|
|
103
127
|
const headers = {
|
|
104
128
|
"cli-token": token,
|
|
105
|
-
"Accept":
|
|
129
|
+
"Accept": accept,
|
|
106
130
|
"X-Source": "ae-cli"
|
|
107
131
|
};
|
|
108
132
|
const init = { method, headers };
|
|
@@ -123,17 +147,10 @@ async function requestMultipartOnce(url, token, form) {
|
|
|
123
147
|
body: form
|
|
124
148
|
});
|
|
125
149
|
}
|
|
126
|
-
async function requestDownloadOnce(url, token) {
|
|
127
|
-
return fetch(url, {
|
|
128
|
-
method: "GET",
|
|
129
|
-
headers: {
|
|
130
|
-
"cli-token": token,
|
|
131
|
-
"Accept": "*/*",
|
|
132
|
-
"X-Source": "ae-cli"
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
150
|
async function callGateway(host, domain, pathAfterV1, method, body) {
|
|
151
|
+
return (await callGatewayWithEnvelope(host, domain, pathAfterV1, method, body)).data;
|
|
152
|
+
}
|
|
153
|
+
async function callGatewayWithEnvelope(host, domain, pathAfterV1, method, body) {
|
|
137
154
|
const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
|
|
138
155
|
const token = await getCliToken(host);
|
|
139
156
|
let resp = await requestOnce(url, method, token, body);
|
|
@@ -160,8 +177,41 @@ async function callGateway(host, domain, pathAfterV1, method, body) {
|
|
|
160
177
|
} else if (!resp.ok) {
|
|
161
178
|
await throwCapabilityHttpError(resp);
|
|
162
179
|
}
|
|
180
|
+
return parseCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
|
|
181
|
+
}
|
|
182
|
+
async function fetchCapabilityGateway(host, domain, pathAfterV1, method = "GET", body, accept = "application/json") {
|
|
183
|
+
const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
|
|
184
|
+
const token = await getCliToken(host);
|
|
185
|
+
let resp = await requestOnce(url, method, token, body, accept);
|
|
186
|
+
if (resp.status === 403) {
|
|
187
|
+
throw new PermissionError(await permissionMessage(resp));
|
|
188
|
+
}
|
|
189
|
+
if (resp.status === 401) {
|
|
190
|
+
logger.warn(`Capability gateway request failed (HTTP 401) for ${host}, refreshing CLI token`);
|
|
191
|
+
clearCliToken(host);
|
|
192
|
+
const newToken = await getCliToken(host);
|
|
193
|
+
process.stderr.write(`[ae-cli] CLI token refreshed for ${host}
|
|
194
|
+
`);
|
|
195
|
+
resp = await requestOnce(url, method, newToken, body, accept);
|
|
196
|
+
if (resp.status === 403) {
|
|
197
|
+
throw new PermissionError(await permissionMessage(resp));
|
|
198
|
+
}
|
|
199
|
+
if (!resp.ok) {
|
|
200
|
+
await throwCapabilityHttpError(resp);
|
|
201
|
+
}
|
|
202
|
+
} else if (!resp.ok) {
|
|
203
|
+
await throwCapabilityHttpError(resp);
|
|
204
|
+
}
|
|
205
|
+
return resp;
|
|
206
|
+
}
|
|
207
|
+
async function requestCapabilityGateway(host, domain, pathAfterV1, method = "GET", body) {
|
|
208
|
+
const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
|
|
163
209
|
return unwrapCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
|
|
164
210
|
}
|
|
211
|
+
async function requestCapabilityGatewayWithEnvelope(host, domain, pathAfterV1, method = "GET", body) {
|
|
212
|
+
const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
|
|
213
|
+
return parseCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
|
|
214
|
+
}
|
|
165
215
|
async function listCapabilities(host, domain) {
|
|
166
216
|
return callGateway(host, domain, "capabilities", "GET");
|
|
167
217
|
}
|
|
@@ -171,12 +221,37 @@ async function inspectCapability(host, domain, capabilityId) {
|
|
|
171
221
|
async function executeCapability(host, domain, capabilityId, input = {}) {
|
|
172
222
|
return callGateway(host, domain, `capabilities/${capabilityId}/execute`, "POST", { input });
|
|
173
223
|
}
|
|
224
|
+
async function executeCapabilityWithEnvelope(host, domain, capabilityId, input = {}) {
|
|
225
|
+
return callGatewayWithEnvelope(host, domain, `capabilities/${capabilityId}/execute`, "POST", { input });
|
|
226
|
+
}
|
|
174
227
|
async function dryRunCapability(host, domain, capabilityId, input = {}) {
|
|
175
228
|
return callGateway(host, domain, `capabilities/${capabilityId}/dry-run`, "POST", { input });
|
|
176
229
|
}
|
|
230
|
+
async function validateCapability(host, domain, capabilityId, input = {}) {
|
|
231
|
+
return callGateway(host, domain, `capabilities/${capabilityId}/validate`, "POST", { input });
|
|
232
|
+
}
|
|
177
233
|
async function uploadInputFile(host, domain, projectId, purpose, filePath) {
|
|
178
234
|
const fileBytes = await readFile(filePath);
|
|
179
|
-
|
|
235
|
+
const filename = basename(filePath);
|
|
236
|
+
return uploadInputFileBytes(
|
|
237
|
+
host,
|
|
238
|
+
domain,
|
|
239
|
+
projectId,
|
|
240
|
+
purpose,
|
|
241
|
+
fileBytes,
|
|
242
|
+
filename,
|
|
243
|
+
inputFileContentType(filename)
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
function inputFileContentType(filename) {
|
|
247
|
+
const lower = filename.toLowerCase();
|
|
248
|
+
if (lower.endsWith(".csv")) return "text/csv";
|
|
249
|
+
if (lower.endsWith(".xlsx")) {
|
|
250
|
+
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
251
|
+
}
|
|
252
|
+
if (lower.endsWith(".json")) return "application/json";
|
|
253
|
+
if (lower.endsWith(".txt")) return "text/plain";
|
|
254
|
+
return "application/octet-stream";
|
|
180
255
|
}
|
|
181
256
|
async function uploadInputFileBytes(host, domain, projectId, purpose, bytes, filename, contentType = "application/octet-stream") {
|
|
182
257
|
const url = buildCapabilityGatewayUrl(host, domain, "input-files");
|
|
@@ -211,56 +286,19 @@ async function uploadInputFileBytes(host, domain, projectId, purpose, bytes, fil
|
|
|
211
286
|
}
|
|
212
287
|
return unwrapCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
|
|
213
288
|
}
|
|
214
|
-
async function downloadCapabilityArtifact(host, domain, runId, artifactId) {
|
|
215
|
-
const url = buildCapabilityGatewayUrl(
|
|
216
|
-
host,
|
|
217
|
-
domain,
|
|
218
|
-
`runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/download`
|
|
219
|
-
);
|
|
220
|
-
const token = await getCliToken(host);
|
|
221
|
-
let resp = await requestDownloadOnce(url, token);
|
|
222
|
-
if (resp.status === 403) {
|
|
223
|
-
throw new PermissionError(await permissionMessage(resp));
|
|
224
|
-
}
|
|
225
|
-
if (resp.status === 401) {
|
|
226
|
-
logger.warn(`Capability gateway artifact download failed (HTTP 401) for ${host}, refreshing CLI token`);
|
|
227
|
-
clearCliToken(host);
|
|
228
|
-
const newToken = await getCliToken(host);
|
|
229
|
-
process.stderr.write(`[ae-cli] CLI token refreshed for ${host}
|
|
230
|
-
`);
|
|
231
|
-
resp = await requestDownloadOnce(url, newToken);
|
|
232
|
-
if (resp.status === 403) {
|
|
233
|
-
throw new PermissionError(await permissionMessage(resp));
|
|
234
|
-
}
|
|
235
|
-
if (!resp.ok) {
|
|
236
|
-
await throwCapabilityHttpError(resp);
|
|
237
|
-
}
|
|
238
|
-
} else if (!resp.ok) {
|
|
239
|
-
await throwCapabilityHttpError(resp);
|
|
240
|
-
}
|
|
241
|
-
return {
|
|
242
|
-
bytes: Buffer.from(await resp.arrayBuffer()),
|
|
243
|
-
contentType: resp.headers.get("content-type") ?? void 0,
|
|
244
|
-
contentDisposition: resp.headers.get("content-disposition") ?? void 0
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
async function callCapabilityApi(host, domain, action, method = "POST", params = {}) {
|
|
248
|
-
const isGet = method === "GET";
|
|
249
|
-
if (isGet) {
|
|
250
|
-
return callGateway(host, domain, action.replace(/^\/+|\/+$/g, ""), "GET");
|
|
251
|
-
}
|
|
252
|
-
return callGateway(host, domain, action.replace(/^\/+|\/+$/g, ""), method, params);
|
|
253
|
-
}
|
|
254
289
|
|
|
255
290
|
export {
|
|
256
291
|
CapabilityGatewayError,
|
|
257
292
|
buildCapabilityGatewayUrl,
|
|
293
|
+
fetchCapabilityGateway,
|
|
294
|
+
requestCapabilityGateway,
|
|
295
|
+
requestCapabilityGatewayWithEnvelope,
|
|
258
296
|
listCapabilities,
|
|
259
297
|
inspectCapability,
|
|
260
298
|
executeCapability,
|
|
299
|
+
executeCapabilityWithEnvelope,
|
|
261
300
|
dryRunCapability,
|
|
301
|
+
validateCapability,
|
|
262
302
|
uploadInputFile,
|
|
263
|
-
uploadInputFileBytes
|
|
264
|
-
downloadCapabilityArtifact,
|
|
265
|
-
callCapabilityApi
|
|
303
|
+
uploadInputFileBytes
|
|
266
304
|
};
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
// src/core/capability-routing.ts
|
|
2
2
|
var cliServiceRoutes = /* @__PURE__ */ new Map();
|
|
3
|
+
function envGatewayDomain(cliService) {
|
|
4
|
+
const normalized = cliService.replace(/[^a-zA-Z0-9]/g, "_").toUpperCase();
|
|
5
|
+
const serviceKey = `AE_CLI_CAPABILITY_GATEWAY_DOMAIN_${normalized}`;
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(process.env, serviceKey)) {
|
|
7
|
+
return process.env[serviceKey] ?? "";
|
|
8
|
+
}
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(process.env, "AE_CLI_CAPABILITY_GATEWAY_DOMAIN")) {
|
|
10
|
+
return process.env.AE_CLI_CAPABILITY_GATEWAY_DOMAIN ?? "";
|
|
11
|
+
}
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
3
14
|
function registerCapabilityGatewayRoute(cliService, route) {
|
|
4
15
|
cliServiceRoutes.set(cliService, route);
|
|
5
16
|
}
|
|
@@ -10,6 +21,10 @@ function resolveGatewayDomain(cliService, override) {
|
|
|
10
21
|
if (override !== void 0) {
|
|
11
22
|
return override;
|
|
12
23
|
}
|
|
24
|
+
const envDomain = envGatewayDomain(cliService);
|
|
25
|
+
if (envDomain !== void 0) {
|
|
26
|
+
return envDomain;
|
|
27
|
+
}
|
|
13
28
|
const route = cliServiceRoutes.get(cliService);
|
|
14
29
|
if (!route) {
|
|
15
30
|
throw new Error(
|
|
@@ -14,16 +14,18 @@ import {
|
|
|
14
14
|
import { readFile } from "fs/promises";
|
|
15
15
|
import { basename } from "path";
|
|
16
16
|
var CapabilityGatewayError = class extends Error {
|
|
17
|
-
constructor(message, code, httpStatus, hint) {
|
|
17
|
+
constructor(message, code, httpStatus, hint, meta) {
|
|
18
18
|
super(message);
|
|
19
19
|
this.code = code;
|
|
20
20
|
this.httpStatus = httpStatus;
|
|
21
21
|
this.hint = hint;
|
|
22
|
+
this.meta = meta;
|
|
22
23
|
this.name = "CapabilityGatewayError";
|
|
23
24
|
}
|
|
24
25
|
code;
|
|
25
26
|
httpStatus;
|
|
26
27
|
hint;
|
|
28
|
+
meta;
|
|
27
29
|
};
|
|
28
30
|
function buildCapabilityGatewayUrl(host, domain, pathAfterV1, queryParams = {}) {
|
|
29
31
|
const base = host.replace(/\/+$/, "");
|
|
@@ -59,25 +61,41 @@ function parseCapabilityResponse(text) {
|
|
|
59
61
|
return text;
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
|
-
function
|
|
64
|
+
function parseCapabilityEnvelope(body) {
|
|
63
65
|
if (body == null) {
|
|
64
66
|
throw new CapabilityGatewayError("Empty capability gateway response");
|
|
65
67
|
}
|
|
66
68
|
if (typeof body.ok === "boolean") {
|
|
67
69
|
if (body.ok) {
|
|
68
|
-
return
|
|
70
|
+
return {
|
|
71
|
+
ok: true,
|
|
72
|
+
data: body.data,
|
|
73
|
+
...isRecord(body.meta) ? { meta: body.meta } : {}
|
|
74
|
+
};
|
|
69
75
|
}
|
|
70
76
|
const err = body.error ?? {};
|
|
71
77
|
const code = nonEmptyString(err.code);
|
|
72
78
|
const message = nonEmptyString(err.message) ?? code ?? "Capability gateway request failed";
|
|
73
79
|
const hint = nonEmptyString(err.hint);
|
|
74
|
-
throw new CapabilityGatewayError(
|
|
80
|
+
throw new CapabilityGatewayError(
|
|
81
|
+
message,
|
|
82
|
+
code,
|
|
83
|
+
err.http_status ?? err.httpStatus,
|
|
84
|
+
hint,
|
|
85
|
+
isRecord(body.meta) ? body.meta : void 0
|
|
86
|
+
);
|
|
75
87
|
}
|
|
76
|
-
return body;
|
|
88
|
+
return { ok: true, data: body };
|
|
89
|
+
}
|
|
90
|
+
function unwrapCapabilityEnvelope(body) {
|
|
91
|
+
return parseCapabilityEnvelope(body).data;
|
|
77
92
|
}
|
|
78
93
|
function nonEmptyString(value) {
|
|
79
94
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
80
95
|
}
|
|
96
|
+
function isRecord(value) {
|
|
97
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
98
|
+
}
|
|
81
99
|
function buildCapabilityHttpError(resp, body) {
|
|
82
100
|
const fallback = `Capability gateway HTTP error: ${resp.status} ${resp.statusText}`.trim();
|
|
83
101
|
if (body && typeof body === "object") {
|
|
@@ -87,7 +105,13 @@ function buildCapabilityHttpError(resp, body) {
|
|
|
87
105
|
const hint = nonEmptyString(err.hint) ?? nonEmptyString(body.hint);
|
|
88
106
|
const details = [code, message, hint ? `Hint: ${hint}` : void 0].filter(Boolean);
|
|
89
107
|
if (details.length > 0) {
|
|
90
|
-
return new CapabilityGatewayError(
|
|
108
|
+
return new CapabilityGatewayError(
|
|
109
|
+
message ?? fallback,
|
|
110
|
+
code,
|
|
111
|
+
resp.status,
|
|
112
|
+
hint,
|
|
113
|
+
isRecord(body.meta) ? body.meta : void 0
|
|
114
|
+
);
|
|
91
115
|
}
|
|
92
116
|
}
|
|
93
117
|
if (typeof body === "string" && body.trim()) {
|
|
@@ -99,10 +123,10 @@ async function throwCapabilityHttpError(resp) {
|
|
|
99
123
|
const body = parseCapabilityResponse(await resp.text());
|
|
100
124
|
throw buildCapabilityHttpError(resp, body);
|
|
101
125
|
}
|
|
102
|
-
async function requestOnce(url, method, token, body) {
|
|
126
|
+
async function requestOnce(url, method, token, body, accept = "application/json") {
|
|
103
127
|
const headers = {
|
|
104
128
|
"cli-token": token,
|
|
105
|
-
"Accept":
|
|
129
|
+
"Accept": accept
|
|
106
130
|
};
|
|
107
131
|
const init = { method, headers };
|
|
108
132
|
if (body !== void 0 && method !== "GET") {
|
|
@@ -121,16 +145,10 @@ async function requestMultipartOnce(url, token, form) {
|
|
|
121
145
|
body: form
|
|
122
146
|
});
|
|
123
147
|
}
|
|
124
|
-
async function requestDownloadOnce(url, token) {
|
|
125
|
-
return fetch(url, {
|
|
126
|
-
method: "GET",
|
|
127
|
-
headers: {
|
|
128
|
-
"cli-token": token,
|
|
129
|
-
"Accept": "*/*"
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
148
|
async function callGateway(host, domain, pathAfterV1, method, body) {
|
|
149
|
+
return (await callGatewayWithEnvelope(host, domain, pathAfterV1, method, body)).data;
|
|
150
|
+
}
|
|
151
|
+
async function callGatewayWithEnvelope(host, domain, pathAfterV1, method, body) {
|
|
134
152
|
const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
|
|
135
153
|
const token = await getCliToken(host);
|
|
136
154
|
let resp = await requestOnce(url, method, token, body);
|
|
@@ -157,8 +175,41 @@ async function callGateway(host, domain, pathAfterV1, method, body) {
|
|
|
157
175
|
} else if (!resp.ok) {
|
|
158
176
|
await throwCapabilityHttpError(resp);
|
|
159
177
|
}
|
|
178
|
+
return parseCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
|
|
179
|
+
}
|
|
180
|
+
async function fetchCapabilityGateway(host, domain, pathAfterV1, method = "GET", body, accept = "application/json") {
|
|
181
|
+
const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
|
|
182
|
+
const token = await getCliToken(host);
|
|
183
|
+
let resp = await requestOnce(url, method, token, body, accept);
|
|
184
|
+
if (resp.status === 403) {
|
|
185
|
+
throw new PermissionError(await permissionMessage(resp));
|
|
186
|
+
}
|
|
187
|
+
if (resp.status === 401) {
|
|
188
|
+
logger.warn(`Capability gateway request failed (HTTP 401) for ${host}, refreshing CLI token`);
|
|
189
|
+
clearCliToken(host);
|
|
190
|
+
const newToken = await getCliToken(host);
|
|
191
|
+
process.stderr.write(`[ae-cli] CLI token refreshed for ${host}
|
|
192
|
+
`);
|
|
193
|
+
resp = await requestOnce(url, method, newToken, body, accept);
|
|
194
|
+
if (resp.status === 403) {
|
|
195
|
+
throw new PermissionError(await permissionMessage(resp));
|
|
196
|
+
}
|
|
197
|
+
if (!resp.ok) {
|
|
198
|
+
await throwCapabilityHttpError(resp);
|
|
199
|
+
}
|
|
200
|
+
} else if (!resp.ok) {
|
|
201
|
+
await throwCapabilityHttpError(resp);
|
|
202
|
+
}
|
|
203
|
+
return resp;
|
|
204
|
+
}
|
|
205
|
+
async function requestCapabilityGateway(host, domain, pathAfterV1, method = "GET", body) {
|
|
206
|
+
const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
|
|
160
207
|
return unwrapCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
|
|
161
208
|
}
|
|
209
|
+
async function requestCapabilityGatewayWithEnvelope(host, domain, pathAfterV1, method = "GET", body) {
|
|
210
|
+
const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
|
|
211
|
+
return parseCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
|
|
212
|
+
}
|
|
162
213
|
async function listCapabilities(host, domain) {
|
|
163
214
|
return callGateway(host, domain, "capabilities", "GET");
|
|
164
215
|
}
|
|
@@ -168,12 +219,37 @@ async function inspectCapability(host, domain, capabilityId) {
|
|
|
168
219
|
async function executeCapability(host, domain, capabilityId, input = {}) {
|
|
169
220
|
return callGateway(host, domain, `capabilities/${capabilityId}/execute`, "POST", { input });
|
|
170
221
|
}
|
|
222
|
+
async function executeCapabilityWithEnvelope(host, domain, capabilityId, input = {}) {
|
|
223
|
+
return callGatewayWithEnvelope(host, domain, `capabilities/${capabilityId}/execute`, "POST", { input });
|
|
224
|
+
}
|
|
171
225
|
async function dryRunCapability(host, domain, capabilityId, input = {}) {
|
|
172
226
|
return callGateway(host, domain, `capabilities/${capabilityId}/dry-run`, "POST", { input });
|
|
173
227
|
}
|
|
228
|
+
async function validateCapability(host, domain, capabilityId, input = {}) {
|
|
229
|
+
return callGateway(host, domain, `capabilities/${capabilityId}/validate`, "POST", { input });
|
|
230
|
+
}
|
|
174
231
|
async function uploadInputFile(host, domain, projectId, purpose, filePath) {
|
|
175
232
|
const fileBytes = await readFile(filePath);
|
|
176
|
-
|
|
233
|
+
const filename = basename(filePath);
|
|
234
|
+
return uploadInputFileBytes(
|
|
235
|
+
host,
|
|
236
|
+
domain,
|
|
237
|
+
projectId,
|
|
238
|
+
purpose,
|
|
239
|
+
fileBytes,
|
|
240
|
+
filename,
|
|
241
|
+
inputFileContentType(filename)
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
function inputFileContentType(filename) {
|
|
245
|
+
const lower = filename.toLowerCase();
|
|
246
|
+
if (lower.endsWith(".csv")) return "text/csv";
|
|
247
|
+
if (lower.endsWith(".xlsx")) {
|
|
248
|
+
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
249
|
+
}
|
|
250
|
+
if (lower.endsWith(".json")) return "application/json";
|
|
251
|
+
if (lower.endsWith(".txt")) return "text/plain";
|
|
252
|
+
return "application/octet-stream";
|
|
177
253
|
}
|
|
178
254
|
async function uploadInputFileBytes(host, domain, projectId, purpose, bytes, filename, contentType = "application/octet-stream") {
|
|
179
255
|
const url = buildCapabilityGatewayUrl(host, domain, "input-files");
|
|
@@ -208,56 +284,19 @@ async function uploadInputFileBytes(host, domain, projectId, purpose, bytes, fil
|
|
|
208
284
|
}
|
|
209
285
|
return unwrapCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
|
|
210
286
|
}
|
|
211
|
-
async function downloadCapabilityArtifact(host, domain, runId, artifactId) {
|
|
212
|
-
const url = buildCapabilityGatewayUrl(
|
|
213
|
-
host,
|
|
214
|
-
domain,
|
|
215
|
-
`runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/download`
|
|
216
|
-
);
|
|
217
|
-
const token = await getCliToken(host);
|
|
218
|
-
let resp = await requestDownloadOnce(url, token);
|
|
219
|
-
if (resp.status === 403) {
|
|
220
|
-
throw new PermissionError(await permissionMessage(resp));
|
|
221
|
-
}
|
|
222
|
-
if (resp.status === 401) {
|
|
223
|
-
logger.warn(`Capability gateway artifact download failed (HTTP 401) for ${host}, refreshing CLI token`);
|
|
224
|
-
clearCliToken(host);
|
|
225
|
-
const newToken = await getCliToken(host);
|
|
226
|
-
process.stderr.write(`[ae-cli] CLI token refreshed for ${host}
|
|
227
|
-
`);
|
|
228
|
-
resp = await requestDownloadOnce(url, newToken);
|
|
229
|
-
if (resp.status === 403) {
|
|
230
|
-
throw new PermissionError(await permissionMessage(resp));
|
|
231
|
-
}
|
|
232
|
-
if (!resp.ok) {
|
|
233
|
-
await throwCapabilityHttpError(resp);
|
|
234
|
-
}
|
|
235
|
-
} else if (!resp.ok) {
|
|
236
|
-
await throwCapabilityHttpError(resp);
|
|
237
|
-
}
|
|
238
|
-
return {
|
|
239
|
-
bytes: Buffer.from(await resp.arrayBuffer()),
|
|
240
|
-
contentType: resp.headers.get("content-type") ?? void 0,
|
|
241
|
-
contentDisposition: resp.headers.get("content-disposition") ?? void 0
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
async function callCapabilityApi(host, domain, action, method = "POST", params = {}) {
|
|
245
|
-
const isGet = method === "GET";
|
|
246
|
-
if (isGet) {
|
|
247
|
-
return callGateway(host, domain, action.replace(/^\/+|\/+$/g, ""), "GET");
|
|
248
|
-
}
|
|
249
|
-
return callGateway(host, domain, action.replace(/^\/+|\/+$/g, ""), method, params);
|
|
250
|
-
}
|
|
251
287
|
|
|
252
288
|
export {
|
|
253
289
|
CapabilityGatewayError,
|
|
254
290
|
buildCapabilityGatewayUrl,
|
|
291
|
+
fetchCapabilityGateway,
|
|
292
|
+
requestCapabilityGateway,
|
|
293
|
+
requestCapabilityGatewayWithEnvelope,
|
|
255
294
|
listCapabilities,
|
|
256
295
|
inspectCapability,
|
|
257
296
|
executeCapability,
|
|
297
|
+
executeCapabilityWithEnvelope,
|
|
258
298
|
dryRunCapability,
|
|
299
|
+
validateCapability,
|
|
259
300
|
uploadInputFile,
|
|
260
|
-
uploadInputFileBytes
|
|
261
|
-
downloadCapabilityArtifact,
|
|
262
|
-
callCapabilityApi
|
|
301
|
+
uploadInputFileBytes
|
|
263
302
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveGatewayDomain
|
|
3
|
+
} from "./chunk-HL2AJQ4Q.js";
|
|
4
|
+
import {
|
|
5
|
+
dryRunCapability,
|
|
6
|
+
executeCapabilityWithEnvelope,
|
|
7
|
+
validateCapability
|
|
8
|
+
} from "./chunk-DYOS6YY7.js";
|
|
9
|
+
import {
|
|
10
|
+
withOutputMetadata
|
|
11
|
+
} from "./chunk-TNW2CI4W.js";
|
|
12
|
+
|
|
13
|
+
// src/core/capability-command.ts
|
|
14
|
+
import { randomBytes } from "crypto";
|
|
15
|
+
function createCapabilityCommand(config) {
|
|
16
|
+
return {
|
|
17
|
+
service: config.cliService,
|
|
18
|
+
resource: config.resource,
|
|
19
|
+
command: config.command,
|
|
20
|
+
capabilityId: config.capabilityId,
|
|
21
|
+
description: config.description,
|
|
22
|
+
flags: config.flags,
|
|
23
|
+
risk: config.risk,
|
|
24
|
+
validate: config.validate,
|
|
25
|
+
validateInput: async (ctx) => {
|
|
26
|
+
const gatewayDomain = resolveGatewayDomain(config.cliService, config.gatewayDomain);
|
|
27
|
+
const requestHost = config.requestHost ?? ctx.host();
|
|
28
|
+
const input = config.buildInput(ctx);
|
|
29
|
+
return validateCapability(requestHost, gatewayDomain, config.capabilityId, input);
|
|
30
|
+
},
|
|
31
|
+
dryRun: async (ctx) => {
|
|
32
|
+
const gatewayDomain = resolveGatewayDomain(config.cliService, config.gatewayDomain);
|
|
33
|
+
const requestHost = config.requestHost ?? ctx.host();
|
|
34
|
+
const input = config.buildInput(ctx);
|
|
35
|
+
return dryRunCapability(requestHost, gatewayDomain, config.capabilityId, input);
|
|
36
|
+
},
|
|
37
|
+
execute: async (ctx) => {
|
|
38
|
+
const gatewayDomain = resolveGatewayDomain(config.cliService, config.gatewayDomain);
|
|
39
|
+
const requestHost = config.requestHost ?? ctx.host();
|
|
40
|
+
const input = withLifecycleRequestId(config, config.buildInput(ctx));
|
|
41
|
+
announceDispatch(config.capabilityId, input);
|
|
42
|
+
const result = await executeCapabilityWithEnvelope(requestHost, gatewayDomain, config.capabilityId, input);
|
|
43
|
+
const data = config.postProcess ? config.postProcess(result.data, input) : result.data;
|
|
44
|
+
return withOutputMetadata(data, result.meta);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function withLifecycleRequestId(config, input) {
|
|
49
|
+
if (!config.flags.some((flag) => flag.name === "request-id")) {
|
|
50
|
+
return input;
|
|
51
|
+
}
|
|
52
|
+
const supplied = input.request_id;
|
|
53
|
+
const requestId = typeof supplied === "string" && supplied.length > 0 ? supplied : `cli_${randomBytes(16).toString("hex")}`;
|
|
54
|
+
return { ...input, request_id: requestId };
|
|
55
|
+
}
|
|
56
|
+
function announceDispatch(capabilityId, input) {
|
|
57
|
+
if (typeof input.request_id !== "string") {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
process.stderr.write(
|
|
61
|
+
`[ae-cli] dispatching capability=${capabilityId} request_id=${input.request_id}
|
|
62
|
+
`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
createCapabilityCommand
|
|
68
|
+
};
|
|
@@ -167,6 +167,16 @@ async function callMcpTool(url, toolName, args = {}, hostOverride) {
|
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
169
|
function parseMcpResult(result) {
|
|
170
|
+
if (result.isError) {
|
|
171
|
+
const firstText = result.content.find((item) => item.type === "text")?.text || "";
|
|
172
|
+
let errorMessage = firstText.trim() || "MCP tool call failed";
|
|
173
|
+
try {
|
|
174
|
+
const parsed = safeJsonParse(firstText);
|
|
175
|
+
errorMessage = mcpResultErrorMessage(parsed) || errorMessage;
|
|
176
|
+
} catch {
|
|
177
|
+
}
|
|
178
|
+
throwMcpError(errorMessage);
|
|
179
|
+
}
|
|
170
180
|
if (result.content.length > 0 && result.content[0].type === "text") {
|
|
171
181
|
const text = result.content[0].text || "";
|
|
172
182
|
let parsed;
|
|
@@ -177,10 +187,7 @@ function parseMcpResult(result) {
|
|
|
177
187
|
}
|
|
178
188
|
const errMsg = mcpResultErrorMessage(parsed);
|
|
179
189
|
if (errMsg !== null) {
|
|
180
|
-
|
|
181
|
-
throw new PermissionError(errMsg);
|
|
182
|
-
}
|
|
183
|
-
throw new Error(errMsg);
|
|
190
|
+
throwMcpError(errMsg);
|
|
184
191
|
}
|
|
185
192
|
return parsed;
|
|
186
193
|
}
|
|
@@ -189,6 +196,7 @@ function parseMcpResult(result) {
|
|
|
189
196
|
function mcpResultErrorMessage(parsed) {
|
|
190
197
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
191
198
|
if (parsed.success === true || parsed.ok === true) return null;
|
|
199
|
+
const explicitlyFailed = parsed.success === false || parsed.ok === false;
|
|
192
200
|
const e = parsed.error;
|
|
193
201
|
if (typeof e === "string" && e.trim()) return e;
|
|
194
202
|
if (e && typeof e === "object") {
|
|
@@ -197,8 +205,21 @@ function mcpResultErrorMessage(parsed) {
|
|
|
197
205
|
if (msg && code) return `${code}: ${msg}`;
|
|
198
206
|
if (msg || code) return msg || code;
|
|
199
207
|
}
|
|
208
|
+
if (explicitlyFailed) {
|
|
209
|
+
const msg = typeof parsed.message === "string" && parsed.message.trim() ? parsed.message.trim() : void 0;
|
|
210
|
+
const codeValue = parsed.errorCode ?? parsed.error_code ?? parsed.code;
|
|
211
|
+
const code = typeof codeValue === "string" && codeValue.trim() ? codeValue.trim() : void 0;
|
|
212
|
+
if (msg && code) return `${code}: ${msg}`;
|
|
213
|
+
return msg || code || "MCP tool call failed";
|
|
214
|
+
}
|
|
200
215
|
return null;
|
|
201
216
|
}
|
|
217
|
+
function throwMcpError(message) {
|
|
218
|
+
if (/no_auth|auth_error|permission|forbidden|unauthor|\u65e0\u6743/i.test(message)) {
|
|
219
|
+
throw new PermissionError(message);
|
|
220
|
+
}
|
|
221
|
+
throw new Error(message);
|
|
222
|
+
}
|
|
202
223
|
|
|
203
224
|
export {
|
|
204
225
|
registerMcpMappings,
|