@sparkelf/dsh-dataops-managed 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/lib/client.js +294 -213
  2. package/lib/client.js.map +1 -1
  3. package/lib/index.js +331 -106
  4. package/lib/types/client/BrowserVersionPrompt.d.ts +26 -0
  5. package/lib/types/client/locales.d.ts +4 -0
  6. package/lib/types/collect-api.d.ts +10 -19
  7. package/lib/types/tool-scope.d.ts +16 -1
  8. package/package.json +4 -2
  9. package/skills/browser/SKILL.md +33 -44
  10. package/skills/{browser/references/bridge.md → browser-bridge-companion/SKILL.md} +6 -1
  11. package/skills/{browser/references/headless.md → browser-headless/SKILL.md} +6 -1
  12. package/skills/dataops-collect/SKILL.md +96 -57
  13. package/skills/dataops-governance/SKILL.md +41 -0
  14. package/skills/dataops-governance/i18n/zh.json +10 -0
  15. package/skills/dataops-governance/references/01-file-import.md +201 -0
  16. package/skills/dataops-governance/references/02-api-import.md +11 -0
  17. package/skills/dataops-governance/references/03-metadata-write.md +32 -0
  18. package/skills/dataops-governance/references/04-metadata-read.md +132 -0
  19. package/skills/dataops-metadata-optimizer/SKILL.md +53 -0
  20. package/skills/dataops-metadata-optimizer/i18n/zh.json +10 -0
  21. package/skills/dataops-metadata-optimizer/references/01-inventory.md +23 -0
  22. package/skills/dataops-metadata-optimizer/references/02-pattern-catalog.md +16 -0
  23. package/skills/dataops-metadata-optimizer/references/03-proposal-and-preview.md +34 -0
  24. package/skills/dataops-metadata-optimizer/references/04-apply-and-measure.md +27 -0
  25. package/skills/dataops-synonym-governance/SKILL.md +38 -0
  26. package/skills/dataops-synonym-governance/references/synonym_governance.md +56 -0
  27. package/skills/browser/references/chrome-install.md +0 -309
  28. package/skills/browser/references/chrome-install.openai.yaml +0 -4
  29. package/skills/browser/references/scripts/check_browser_bridge_status.js +0 -33
  30. package/skills/browser/references/scripts/cleanup_isolated_chrome.ps1 +0 -10
  31. package/skills/browser/references/scripts/start_isolated_chrome.ps1 +0 -25
  32. package/skills/browser/references/scripts/start_test_browser_bridge.cjs +0 -245
  33. package/skills/dataops-collect/references/append.md +0 -137
  34. package/skills/dataops-collect/references/execution.md +0 -133
  35. package/skills/dataops-collect/references/plan-schema.md +0 -142
package/lib/index.js CHANGED
@@ -877,12 +877,17 @@ const AI_TOOL_ACCESS = {
877
877
  review_notifications_list: {},
878
878
  review_notifications_read: {},
879
879
  dataops_api_docs: { superAdminOnly: true },
880
+ synonym_group_list: { superAdminOnly: true },
881
+ synonym_group_get: { superAdminOnly: true },
882
+ synonym_group_create: { superAdminOnly: true },
883
+ synonym_group_update: { superAdminOnly: true },
884
+ synonym_group_delete: { superAdminOnly: true },
880
885
  workflow_query: { superAdminOnly: true },
881
886
  workflow_definition: { superAdminOnly: true },
882
887
  workflow_deployment: { superAdminOnly: true },
883
888
  workflow_run_control: { superAdminOnly: true },
884
889
  dataops_collect_preview: { permission: "data:resource:manage" },
885
- dataops_collect_validate_plan: { permission: "data:resource:manage" },
890
+ dataops_collect_plan: { permission: "data:resource:manage" },
886
891
  dataops_collect_execute: { permission: "data:resource:manage" },
887
892
  dataops_collect_resources: { permission: "data:resource:read" },
888
893
  dataops_open_resource_tab: {},
@@ -1349,11 +1354,10 @@ function hasCapability(id) {
1349
1354
  /**
1350
1355
  * DataOps spreadsheet-import transport for the collection skill.
1351
1356
  *
1352
- * The host reads a workspace attachment, uploads it as multipart, and validates the
1353
- * create-table or existing-table plan the current conversation model wrote. DataOps only
1354
- * normalizes that plan and returns SQL/mapping summaries; it never selects or calls a shared
1355
- * model. Execution is the single mutating call and stays behind the user's explicit
1356
- * confirmation.
1357
+ * The host reads a workspace attachment, uploads it as multipart, asks DataOps for a
1358
+ * create-table or existing-table plan, and only executes when the model calls the
1359
+ * execute tool after the user's plan confirmation. Nothing here creates a table on
1360
+ * preview/plan; execution is the single mutating call.
1357
1361
  *
1358
1362
  * @module collect-api
1359
1363
  */
@@ -1423,19 +1427,12 @@ var CollectApi = class {
1423
1427
  const body = unwrap$1(result, "import data sources");
1424
1428
  return Array.isArray(body.dataSources) ? body.dataSources : [];
1425
1429
  }
1426
- /**
1427
- * Validate and normalize a plan written by the current conversation model.
1428
- *
1429
- * Read-only and model-free: the backend runs the same deterministic sanitizers as
1430
- * `/plan` and `/execute`, then returns the normalized plan, CREATE TABLE SQL or mapping
1431
- * summary. It never resolves a shared `AiModelConfig` or calls a provider.
1432
- */
1433
- async validatePlan(payload) {
1434
- const result = await this.reviewApi.request("/api/resources/spreadsheet-import/validate-plan", {
1430
+ async plan(payload) {
1431
+ const result = await this.reviewApi.request("/api/resources/spreadsheet-import/plan", {
1435
1432
  method: "POST",
1436
1433
  body: JSON.stringify(payload)
1437
1434
  });
1438
- return unwrap$1(result, "spreadsheet plan validation");
1435
+ return unwrap$1(result, "spreadsheet plan");
1439
1436
  }
1440
1437
  async execute(payload) {
1441
1438
  const result = await this.reviewApi.request("/api/resources/spreadsheet-import/execute", {
@@ -2039,8 +2036,8 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2039
2036
  return parsed;
2040
2037
  };
2041
2038
  /**
2042
- * Keep only the fields the DataOps execute/validate DTOs accept. The validated plan
2043
- * carries `createSql`/`targetSchema`/`notes` beside `createTable`; if the model passes
2039
+ * Keep only the fields the DataOps execute DTO accepts. The plan tool returns
2040
+ * `createSql`/`targetSchema`/`notes` beside `createTable`; if the model passes
2044
2041
  * the whole plan (or rebuilds it after a table-name edit), the backend's
2045
2042
  * `forbidNonWhitelisted` pipe rejects the call with a generic 400.
2046
2043
  */
@@ -2073,24 +2070,6 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2073
2070
  columns
2074
2071
  };
2075
2072
  };
2076
- /**
2077
- * Keep only `{sourceKey,targetColumn}` from a model-written mapping list.
2078
- *
2079
- * The validated plan carries sourceHeader/targetDataType/confidence beside the pair; the
2080
- * backend DTO drops them, but rejecting a malformed entry here names the offending index
2081
- * instead of letting the server answer a generic "no usable mapping".
2082
- */
2083
- const normalizeMappings = (tool, entries) => entries.map((entry, index) => {
2084
- if (typeof entry !== "object" || entry === null || Array.isArray(entry)) throw new Error(tool + ": mappings_json[" + index + "] must be an object");
2085
- const mapping = entry;
2086
- const sourceKey = typeof mapping.sourceKey === "string" ? mapping.sourceKey.trim() : "";
2087
- const targetColumn = typeof mapping.targetColumn === "string" ? mapping.targetColumn.trim() : "";
2088
- if (!sourceKey || !targetColumn) throw new Error(tool + ": mappings_json[" + index + "] needs sourceKey and targetColumn");
2089
- return {
2090
- sourceKey,
2091
- targetColumn
2092
- };
2093
- });
2094
2073
  return [
2095
2074
  {
2096
2075
  name: "skill_list",
@@ -2722,11 +2701,17 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2722
2701
  definition: defineTool({
2723
2702
  name: "dataops_collect_preview",
2724
2703
  description: "Parse one spreadsheet attachment from the workspace and return DataOps's preview plus the importable database destinations. Read-only: it does not create a table and does not write rows. Use this first in the data-collection skill, then ask the user to choose the destination when more than one is returned.",
2725
- parameters: { file_path: {
2726
- type: "string",
2727
- required: true,
2728
- description: "Absolute or workspace-relative path to one .xlsx/.xls/.csv/.tsv file."
2729
- } },
2704
+ parameters: {
2705
+ file_path: {
2706
+ type: "string",
2707
+ required: true,
2708
+ description: "Absolute or workspace-relative path to one .xlsx/.xls/.csv/.tsv file."
2709
+ },
2710
+ model_id: {
2711
+ type: "number",
2712
+ description: "Optional shared AI model id for the later plan call."
2713
+ }
2714
+ },
2730
2715
  output: {
2731
2716
  schema: OPEN_OBJECT_SCHEMA,
2732
2717
  render: renderJson
@@ -2748,10 +2733,10 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2748
2733
  })
2749
2734
  },
2750
2735
  {
2751
- name: "dataops_collect_validate_plan",
2736
+ name: "dataops_collect_plan",
2752
2737
  definition: defineTool({
2753
- name: "dataops_collect_validate_plan",
2754
- description: "Validate and normalize the spreadsheet import plan the current conversation model wrote: a create-table plan or an existing-table field mapping. Read-only and model-free: DataOps checks identifiers, data types, source keys and target columns, then returns the normalized plan, CREATE TABLE SQL or mapping summary. It does not call any AI model and does not create tables or write rows. Call this after generating the plan and before presenting it to the user; use the returned plan for confirmation and execution.",
2738
+ name: "dataops_collect_plan",
2739
+ description: "Generate a create-table plan or an existing-table field mapping for a parsed spreadsheet session. Read-only: DataOps only plans, it does not execute DDL or write rows. Call this after the user has chosen a data source; pass root_schema + root_table only when appending to an existing table.",
2755
2740
  parameters: {
2756
2741
  session_id: {
2757
2742
  type: "string",
@@ -2760,23 +2745,20 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2760
2745
  },
2761
2746
  data_source_urn: {
2762
2747
  type: "string",
2763
- description: "Destination URN from the preview result. Required when appending to an existing table; omit only when validating a generic create-table plan."
2748
+ required: true,
2749
+ description: "Destination URN from the preview result."
2764
2750
  },
2765
2751
  target_schema: {
2766
2752
  type: "string",
2767
- description: "Existing-table schema; required together with target_table."
2753
+ description: "Existing-table schema; required when root_table is set."
2768
2754
  },
2769
2755
  target_table: {
2770
2756
  type: "string",
2771
- description: "Existing table name; omit to validate a new create-table plan."
2772
- },
2773
- create_plan_json: {
2774
- type: "string",
2775
- description: "JSON object for CREATE_TABLE: {tableName,tableChineseName?,tableComment?,columns:[{sourceKey,name,chineseName,dataType,nullable?,comment?}]}."
2757
+ description: "Existing table name; omit to create a new table."
2776
2758
  },
2777
- mappings_json: {
2778
- type: "string",
2779
- description: "JSON array for EXISTING_TABLE: [{sourceKey,targetColumn}]."
2759
+ model_id: {
2760
+ type: "number",
2761
+ description: "Optional shared AI model id."
2780
2762
  }
2781
2763
  },
2782
2764
  output: {
@@ -2784,36 +2766,21 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2784
2766
  render: renderJson
2785
2767
  },
2786
2768
  execute: async (args, exec) => {
2787
- const tool = "dataops_collect_validate_plan";
2788
- const createPlan = normalizeCreatePlan(tool, parseJsonObject(tool, "create_plan_json", args.create_plan_json));
2789
- const mappings = normalizeMappings(tool, parseJsonArray(tool, "mappings_json", args.mappings_json));
2790
- if (args.target_table !== void 0 && args.target_table.trim() === "") throw new Error(tool + ": target_table must be a non-empty existing table name");
2791
- if (args.target_schema !== void 0 && args.target_table === void 0) throw new Error(tool + ": target_schema requires target_table");
2792
- if (args.target_table !== void 0) {
2793
- if (!args.target_schema || args.target_schema.trim() === "") throw new Error(tool + ": target_schema is required when target_table is set");
2794
- if (createPlan !== void 0) throw new Error(tool + ": do not send create_plan_json when target_table is set");
2795
- if (mappings.length === 0) throw new Error(tool + ": mappings_json is required for EXISTING_TABLE");
2796
- } else {
2797
- if (createPlan === void 0) throw new Error(tool + ": create_plan_json is required for CREATE_TABLE");
2798
- if (mappings.length > 0) throw new Error(tool + ": do not send mappings_json for CREATE_TABLE");
2799
- }
2800
- const result = await collectApi.validatePlan({
2769
+ const plan = await collectApi.plan({
2801
2770
  sessionId: args.session_id,
2802
- ...args.data_source_urn === void 0 || args.data_source_urn.trim() === "" ? {} : { dataSourceUrn: args.data_source_urn },
2803
- ...args.target_schema && args.target_table ? { targetTable: {
2804
- schema: args.target_schema,
2771
+ dataSourceUrn: args.data_source_urn,
2772
+ ...args.target_table ? { targetTable: {
2773
+ schema: args.target_schema || "",
2805
2774
  table: args.target_table
2806
2775
  } } : {},
2807
- ...createPlan === void 0 ? {} : { createPlan },
2808
- ...mappings.length === 0 ? {} : { mappings }
2776
+ ...args.model_id === void 0 ? {} : { modelId: args.model_id }
2809
2777
  });
2810
- audit(tool, exec, {
2778
+ audit("dataops_collect_plan", exec, {
2811
2779
  sessionId: args.session_id,
2812
- dataSourceUrn: args.data_source_urn ?? null,
2813
- targetTable: args.target_table ?? createPlan?.tableName ?? null,
2814
- mode: args.target_table === void 0 ? "CREATE_TABLE" : "EXISTING_TABLE"
2780
+ dataSourceUrn: args.data_source_urn,
2781
+ targetTable: args.target_table ?? null
2815
2782
  });
2816
- return result;
2783
+ return plan;
2817
2784
  }
2818
2785
  })
2819
2786
  },
@@ -2821,7 +2788,7 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2821
2788
  name: "dataops_collect_execute",
2822
2789
  definition: defineTool({
2823
2790
  name: "dataops_collect_execute",
2824
- description: "Execute one confirmed spreadsheet import: create a table (or write to an existing table), insert rows, and register the DataOps resource. This is the ONLY collection tool that mutates data. Call it only after dataops_collect_validate_plan has normalized the plan and the user explicitly confirmed that plan in natural language (e.g. 确认/开始吧); never call it while the plan is still being edited and never call it with an unvalidated plan.",
2791
+ description: "Execute one confirmed spreadsheet import: create a table (or write to an existing table), insert rows, and register the DataOps resource. This is the ONLY collection tool that mutates data. Call it only after the user explicitly confirms the read-only plan in natural language (e.g. 确认/开始吧); never call it while the plan is still being edited.",
2825
2792
  parameters: {
2826
2793
  session_id: {
2827
2794
  type: "string",
@@ -2836,7 +2803,7 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2836
2803
  mode: {
2837
2804
  type: "string",
2838
2805
  required: true,
2839
- description: "CREATE_TABLE, EXISTING_TABLE or OVERWRITE_TABLE. OVERWRITE_TABLE truncates the target table first; require explicit user confirmation and confirm_overwrite=true."
2806
+ description: "CREATE_TABLE or EXISTING_TABLE."
2840
2807
  },
2841
2808
  target_schema: {
2842
2809
  type: "string",
@@ -2848,15 +2815,11 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2848
2815
  },
2849
2816
  create_plan_json: {
2850
2817
  type: "string",
2851
- description: "Only plan.createTable (tableName/tableChineseName/tableComment/columns) from the plan returned by dataops_collect_validate_plan. Do not send createSql/targetSchema/notes; if the user edits the table name, regenerate the plan and call dataops_collect_validate_plan again before executing."
2818
+ description: "Only plan.createTable (tableName/tableChineseName/tableComment/columns). Do not send createSql/targetSchema/notes; if the user edits the table name, call dataops_collect_plan again and pass its createTable."
2852
2819
  },
2853
2820
  mappings_json: {
2854
2821
  type: "string",
2855
- description: "JSON array of {sourceKey,targetColumn} for EXISTING_TABLE/OVERWRITE_TABLE."
2856
- },
2857
- confirm_overwrite: {
2858
- type: "boolean",
2859
- description: "Required true for OVERWRITE_TABLE after the user explicitly confirms that the target table will be truncated."
2822
+ description: "JSON array of {sourceKey,targetColumn} for EXISTING_TABLE."
2860
2823
  },
2861
2824
  resource_name: {
2862
2825
  type: "string",
@@ -2871,18 +2834,6 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2871
2834
  items: { type: "string" },
2872
2835
  description: "Optional resource tags."
2873
2836
  },
2874
- business_domain: {
2875
- type: "string",
2876
- description: "Business domain inferred by the conversation model from table name/comment/columns/terms, e.g. 财务域. Omit when unknown; DataOps will place it in 未分类."
2877
- },
2878
- domain_inference_source: {
2879
- type: "string",
2880
- description: "MODEL, USER, RULE or UNKNOWN. Defaults to MODEL when business_domain is provided."
2881
- },
2882
- domain_inference_confidence: {
2883
- type: "string",
2884
- description: "HIGH, MEDIUM or LOW. LOW is placed in 未分类."
2885
- },
2886
2837
  ai_visible: {
2887
2838
  type: "boolean",
2888
2839
  description: "Whether AI may retrieve this resource. Defaults to true."
@@ -2897,8 +2848,7 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2897
2848
  render: renderJson
2898
2849
  },
2899
2850
  execute: async (args, exec) => {
2900
- if (args.mode !== "CREATE_TABLE" && args.mode !== "EXISTING_TABLE" && args.mode !== "OVERWRITE_TABLE") throw new Error("dataops_collect_execute: mode must be CREATE_TABLE, EXISTING_TABLE or OVERWRITE_TABLE");
2901
- if (args.mode === "OVERWRITE_TABLE" && args.confirm_overwrite !== true) throw new Error("dataops_collect_execute: OVERWRITE_TABLE requires confirm_overwrite=true after explicit user confirmation");
2851
+ if (args.mode !== "CREATE_TABLE" && args.mode !== "EXISTING_TABLE") throw new Error("dataops_collect_execute: mode must be CREATE_TABLE or EXISTING_TABLE");
2902
2852
  const createPlan = normalizeCreatePlan("dataops_collect_execute", parseJsonObject("dataops_collect_execute", "create_plan_json", args.create_plan_json));
2903
2853
  const mappings = parseJsonArray("dataops_collect_execute", "mappings_json", args.mappings_json);
2904
2854
  if (args.mode === "CREATE_TABLE" && createPlan === void 0) throw new Error("dataops_collect_execute: create_plan_json is required for CREATE_TABLE");
@@ -2913,13 +2863,9 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2913
2863
  schema: args.target_schema,
2914
2864
  table: args.target_table
2915
2865
  } } : {},
2916
- ...args.mode === "OVERWRITE_TABLE" ? { confirmOverwrite: true } : {},
2917
2866
  ...args.resource_name === void 0 ? {} : { resourceName: args.resource_name },
2918
2867
  ...args.resource_description === void 0 ? {} : { resourceDescription: args.resource_description },
2919
2868
  ...args.resource_tags === void 0 ? {} : { resourceTags: args.resource_tags },
2920
- ...args.business_domain === void 0 ? {} : { businessDomain: args.business_domain },
2921
- ...args.domain_inference_source === void 0 ? {} : { domainInferenceSource: args.domain_inference_source },
2922
- ...args.domain_inference_confidence === void 0 ? {} : { domainInferenceConfidence: args.domain_inference_confidence },
2923
2869
  ...args.ai_visible === void 0 ? {} : { aiVisible: args.ai_visible },
2924
2870
  ...args.access_level === void 0 ? {} : { accessLevel: args.access_level }
2925
2871
  };
@@ -2929,8 +2875,7 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
2929
2875
  sessionId: args.session_id,
2930
2876
  mode: args.mode,
2931
2877
  resourceId: resource?.id ?? null,
2932
- importedRows: result.importedRows ?? null,
2933
- businessDomain: args.business_domain ?? null
2878
+ importedRows: result.importedRows ?? null
2934
2879
  });
2935
2880
  return result;
2936
2881
  }
@@ -3711,6 +3656,196 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
3711
3656
  };
3712
3657
  }
3713
3658
  })
3659
+ },
3660
+ {
3661
+ name: "synonym_group_list",
3662
+ definition: defineTool({
3663
+ name: "synonym_group_list",
3664
+ description: "List DataOps synonym groups: the canonical wording, its aliases and the catalog node it belongs to. Read-only. Super administrators only.",
3665
+ parameters: {
3666
+ catalog_node_id: {
3667
+ type: "number",
3668
+ description: "Only groups attached to this catalog node id."
3669
+ },
3670
+ keyword: {
3671
+ type: "string",
3672
+ description: "Substring of the canonical term, or an exact alias."
3673
+ }
3674
+ },
3675
+ output: {
3676
+ schema: OPEN_OBJECT_SCHEMA,
3677
+ render: renderJson
3678
+ },
3679
+ execute: async (args) => {
3680
+ const query = new URLSearchParams();
3681
+ if (args.catalog_node_id !== void 0) query.set("catalogNodeId", String(args.catalog_node_id));
3682
+ if (args.keyword !== void 0 && args.keyword.trim() !== "") query.set("keyword", args.keyword.trim());
3683
+ return await call("/api/ai/synonym-groups?" + query.toString());
3684
+ }
3685
+ })
3686
+ },
3687
+ {
3688
+ name: "synonym_group_get",
3689
+ definition: defineTool({
3690
+ name: "synonym_group_get",
3691
+ description: "Read one DataOps synonym group by id. Read-only. Super administrators only.",
3692
+ parameters: { group_id: {
3693
+ type: "number",
3694
+ required: true,
3695
+ description: "Synonym group id."
3696
+ } },
3697
+ output: {
3698
+ schema: OPEN_OBJECT_SCHEMA,
3699
+ render: renderJson
3700
+ },
3701
+ execute: async (args) => {
3702
+ if (!Number.isSafeInteger(args.group_id) || args.group_id <= 0) throw new Error("group_id must be a positive integer");
3703
+ return await call("/api/ai/synonym-groups/" + args.group_id.toString());
3704
+ }
3705
+ })
3706
+ },
3707
+ {
3708
+ name: "synonym_group_create",
3709
+ definition: defineTool({
3710
+ name: "synonym_group_create",
3711
+ description: "Create one synonym group: a canonical wording plus up to 12 aliases. Aliases are unique across groups. Requires explicit user approval; DataOps rebuilds the search index after the write. Super administrators only.",
3712
+ parameters: {
3713
+ canonical: {
3714
+ type: "string",
3715
+ required: true,
3716
+ description: "The standard wording, e.g. 酒店."
3717
+ },
3718
+ aliases: {
3719
+ type: "array",
3720
+ items: { type: "string" },
3721
+ description: "Alternative wordings, e.g. 旅馆, 宾馆, hotel."
3722
+ },
3723
+ catalog_node_id: {
3724
+ type: "number",
3725
+ description: "Optional catalog node id the group belongs to."
3726
+ },
3727
+ description: {
3728
+ type: "string",
3729
+ description: "Optional description."
3730
+ },
3731
+ is_enabled: {
3732
+ type: "boolean",
3733
+ description: "Whether the group takes effect immediately (default true)."
3734
+ }
3735
+ },
3736
+ output: {
3737
+ schema: OPEN_OBJECT_SCHEMA,
3738
+ render: renderJson
3739
+ },
3740
+ execute: async (args, exec) => {
3741
+ if (typeof args.canonical !== "string" || args.canonical.trim() === "") throw new Error("canonical is required");
3742
+ await approve("synonym_group_create", exec, "Create synonym group " + args.canonical.trim());
3743
+ const body = {
3744
+ canonical: args.canonical.trim(),
3745
+ aliases: args.aliases ?? [],
3746
+ catalogNodeId: args.catalog_node_id ?? null,
3747
+ description: args.description ?? null,
3748
+ isEnabled: args.is_enabled ?? true
3749
+ };
3750
+ const value = await call("/api/ai/synonym-groups", {
3751
+ method: "POST",
3752
+ body: JSON.stringify(body)
3753
+ });
3754
+ audit("synonym_group_create", exec, {
3755
+ canonical: body.canonical,
3756
+ aliasCount: body.aliases.length
3757
+ });
3758
+ return value;
3759
+ }
3760
+ })
3761
+ },
3762
+ {
3763
+ name: "synonym_group_update",
3764
+ definition: defineTool({
3765
+ name: "synonym_group_update",
3766
+ description: "Update one synonym group: canonical wording, aliases, catalog node, description or enabled flag. Requires explicit user approval; DataOps rebuilds the documents that expanded the group. Super administrators only.",
3767
+ parameters: {
3768
+ group_id: {
3769
+ type: "number",
3770
+ required: true,
3771
+ description: "Synonym group id."
3772
+ },
3773
+ canonical: {
3774
+ type: "string",
3775
+ description: "New standard wording."
3776
+ },
3777
+ aliases: {
3778
+ type: "array",
3779
+ items: { type: "string" },
3780
+ description: "Full replacement alias list (max 12)."
3781
+ },
3782
+ catalog_node_id: {
3783
+ type: "number",
3784
+ description: "New catalog node id."
3785
+ },
3786
+ description: {
3787
+ type: "string",
3788
+ description: "New description."
3789
+ },
3790
+ is_enabled: {
3791
+ type: "boolean",
3792
+ description: "Enable or disable the group."
3793
+ }
3794
+ },
3795
+ output: {
3796
+ schema: OPEN_OBJECT_SCHEMA,
3797
+ render: renderJson
3798
+ },
3799
+ execute: async (args, exec) => {
3800
+ if (!Number.isSafeInteger(args.group_id) || args.group_id <= 0) throw new Error("group_id must be a positive integer");
3801
+ await approve("synonym_group_update", exec, "Update synonym group " + args.group_id.toString());
3802
+ const body = {};
3803
+ if (args.canonical !== void 0) body.canonical = args.canonical;
3804
+ if (args.aliases !== void 0) body.aliases = args.aliases;
3805
+ if (args.catalog_node_id !== void 0) body.catalogNodeId = args.catalog_node_id;
3806
+ if (args.description !== void 0) body.description = args.description;
3807
+ if (args.is_enabled !== void 0) body.isEnabled = args.is_enabled;
3808
+ const value = await call("/api/ai/synonym-groups/" + args.group_id.toString(), {
3809
+ method: "PATCH",
3810
+ body: JSON.stringify(body)
3811
+ });
3812
+ audit("synonym_group_update", exec, { groupId: args.group_id });
3813
+ return value;
3814
+ }
3815
+ })
3816
+ },
3817
+ {
3818
+ name: "synonym_group_delete",
3819
+ definition: defineTool({
3820
+ name: "synonym_group_delete",
3821
+ description: "Disable a synonym group (default) or permanently delete it with purge=true. Requires explicit user approval. Super administrators only.",
3822
+ parameters: {
3823
+ group_id: {
3824
+ type: "number",
3825
+ required: true,
3826
+ description: "Synonym group id."
3827
+ },
3828
+ purge: {
3829
+ type: "boolean",
3830
+ description: "Delete permanently instead of disabling."
3831
+ }
3832
+ },
3833
+ output: {
3834
+ schema: OPEN_OBJECT_SCHEMA,
3835
+ render: renderJson
3836
+ },
3837
+ execute: async (args, exec) => {
3838
+ if (!Number.isSafeInteger(args.group_id) || args.group_id <= 0) throw new Error("group_id must be a positive integer");
3839
+ const purge = args.purge === true;
3840
+ await approve("synonym_group_delete", exec, (purge ? "Delete" : "Disable") + " synonym group " + args.group_id.toString());
3841
+ const value = await call("/api/ai/synonym-groups/" + args.group_id.toString() + (purge ? "?purge=true" : ""), { method: "DELETE" });
3842
+ audit("synonym_group_delete", exec, {
3843
+ groupId: args.group_id,
3844
+ purge
3845
+ });
3846
+ return value;
3847
+ }
3848
+ })
3714
3849
  }
3715
3850
  ];
3716
3851
  }
@@ -5737,6 +5872,93 @@ const CONNECTOR_SKILL = {
5737
5872
  * 没有权限时返回空列表,`get` 也拒绝,避免只靠 SKILL.md 里的 frontmatter 声明。
5738
5873
  */
5739
5874
  let connectorSkillAllowed = () => false;
5875
+ /** Admin data-governance skill: imports resources, writes metadata, and reads full platform metadata. */
5876
+ const GOVERNANCE_SKILL_NAME = "dataops-governance";
5877
+ const GOVERNANCE_SKILL_FILE = new URL("../skills/dataops-governance/SKILL.md", import.meta.url);
5878
+ const GOVERNANCE_SKILL = {
5879
+ name: GOVERNANCE_SKILL_NAME,
5880
+ description: "管理员/超管导入资源、维护资源/列/指标/血缘与可见性、查询全量平台元数据时使用。",
5881
+ invocation: {
5882
+ modelInvocable: true,
5883
+ userInvocable: true
5884
+ },
5885
+ provider: GOVERNANCE_SKILL_NAME,
5886
+ source: "bundled",
5887
+ resourceBase: {
5888
+ kind: "directory",
5889
+ path: fileURLToPath(new URL("../skills/dataops-governance/", import.meta.url))
5890
+ },
5891
+ rank: BUNDLED_SKILL_RANK,
5892
+ locator: GOVERNANCE_SKILL_FILE
5893
+ };
5894
+ const governanceSkillProvider = {
5895
+ name: GOVERNANCE_SKILL_NAME,
5896
+ list: () => Promise.resolve([GOVERNANCE_SKILL]),
5897
+ async get() {
5898
+ return {
5899
+ ...GOVERNANCE_SKILL,
5900
+ content: await readFile(GOVERNANCE_SKILL_FILE, "utf8")
5901
+ };
5902
+ }
5903
+ };
5904
+ /** Synonym-governance skill: discovers and maintains synonym groups for resource search. */
5905
+ const SYNONYM_SKILL_NAME = "dataops-synonym-governance";
5906
+ const SYNONYM_SKILL_FILE = new URL("../skills/dataops-synonym-governance/SKILL.md", import.meta.url);
5907
+ const SYNONYM_SKILL = {
5908
+ name: SYNONYM_SKILL_NAME,
5909
+ description: "超管维护资源检索的同义词组:从数据目录自底向上抽词、判定等价、确认后写入。",
5910
+ invocation: {
5911
+ modelInvocable: true,
5912
+ userInvocable: true
5913
+ },
5914
+ provider: SYNONYM_SKILL_NAME,
5915
+ source: "bundled",
5916
+ resourceBase: {
5917
+ kind: "directory",
5918
+ path: fileURLToPath(new URL("../skills/dataops-synonym-governance/", import.meta.url))
5919
+ },
5920
+ rank: BUNDLED_SKILL_RANK,
5921
+ locator: SYNONYM_SKILL_FILE
5922
+ };
5923
+ const synonymSkillProvider = {
5924
+ name: SYNONYM_SKILL_NAME,
5925
+ list: () => Promise.resolve([SYNONYM_SKILL]),
5926
+ async get() {
5927
+ return {
5928
+ ...SYNONYM_SKILL,
5929
+ content: await readFile(SYNONYM_SKILL_FILE, "utf8")
5930
+ };
5931
+ }
5932
+ };
5933
+ /** Metadata optimizer skill: inventories metadata and proposes governance improvements. */
5934
+ const METADATA_OPTIMIZER_SKILL_NAME = "dataops-metadata-optimizer";
5935
+ const METADATA_OPTIMIZER_SKILL_FILE = new URL("../skills/dataops-metadata-optimizer/SKILL.md", import.meta.url);
5936
+ const METADATA_OPTIMIZER_SKILL = {
5937
+ name: METADATA_OPTIMIZER_SKILL_NAME,
5938
+ description: "盘点资源/列/指标/血缘,识别命名、口径、冗余与缺失问题,生成治理提案并预览影响。",
5939
+ invocation: {
5940
+ modelInvocable: true,
5941
+ userInvocable: true
5942
+ },
5943
+ provider: METADATA_OPTIMIZER_SKILL_NAME,
5944
+ source: "bundled",
5945
+ resourceBase: {
5946
+ kind: "directory",
5947
+ path: fileURLToPath(new URL("../skills/dataops-metadata-optimizer/", import.meta.url))
5948
+ },
5949
+ rank: BUNDLED_SKILL_RANK,
5950
+ locator: METADATA_OPTIMIZER_SKILL_FILE
5951
+ };
5952
+ const metadataOptimizerSkillProvider = {
5953
+ name: METADATA_OPTIMIZER_SKILL_NAME,
5954
+ list: () => Promise.resolve([METADATA_OPTIMIZER_SKILL]),
5955
+ async get() {
5956
+ return {
5957
+ ...METADATA_OPTIMIZER_SKILL,
5958
+ content: await readFile(METADATA_OPTIMIZER_SKILL_FILE, "utf8")
5959
+ };
5960
+ }
5961
+ };
5740
5962
  const connectorSkillProvider = {
5741
5963
  name: CONNECTOR_SKILL_NAME,
5742
5964
  list: () => Promise.resolve(connectorSkillAllowed() ? [CONNECTOR_SKILL] : []),
@@ -5879,6 +6101,9 @@ async function apply(ctx, config) {
5879
6101
  let mcpFiber;
5880
6102
  ctx.skills.registerProvider(() => querySkillProvider);
5881
6103
  ctx.skills.registerProvider(() => collectSkillProvider);
6104
+ ctx.skills.registerProvider(() => governanceSkillProvider);
6105
+ ctx.skills.registerProvider(() => synonymSkillProvider);
6106
+ ctx.skills.registerProvider(() => metadataOptimizerSkillProvider);
5882
6107
  ctx.skills.registerProvider(() => connectorSkillProvider);
5883
6108
  ctx.skills.registerProvider(() => prefectScriptSkillProvider);
5884
6109
  ctx.skills.registerProvider(() => provisioningSkillProvider);
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Browser-version notice.
3
+ *
4
+ * The workspace is a web app; the local browser bridge only supports current Chromium
5
+ * releases. This banner is deliberately a sibling of the workspace-image banner: it uses
6
+ * the same shell-overlay seat and the same quiet notice geometry, while keeping the
7
+ * browser floor and the installer URL owned by this plugin.
8
+ *
9
+ * @module BrowserVersionPrompt
10
+ */
11
+ import type { en } from './locales.ts';
12
+ /** Lowest Chromium major the local browser bridge supports. */
13
+ export declare const MIN_BROWSER_MAJOR = 150;
14
+ export interface BrowserVersionPromptProps {
15
+ /** Resolve one managed DataOps message key. */
16
+ readonly t: (key: keyof typeof en) => string;
17
+ }
18
+ /**
19
+ * Extract the Chromium major from the user agent.
20
+ *
21
+ * `navigator.userAgentData` is preferred in modern Chromium; the UA fallback keeps
22
+ * Firefox/Safari and older embedded WebViews from producing a false positive.
23
+ */
24
+ export declare function chromiumMajor(ua: string): number | null;
25
+ /** Render the browser-version banner while the current browser is below the floor. */
26
+ export declare function BrowserVersionPrompt(props: BrowserVersionPromptProps): import("react").JSX.Element | null;
@@ -156,6 +156,10 @@ export declare const en: {
156
156
  readonly upgradeBusy: "Upgrading workspace…";
157
157
  readonly upgradeStarted: "Upgrade started. Reload this page when the workspace reconnects.";
158
158
  readonly upgradeFailed: "The workspace upgrade could not be started. Try again.";
159
+ readonly browserVersionTitle: "Browser version is out of date";
160
+ readonly browserVersionBody: "This browser is version {version}; version {minimum} or newer is recommended for the local browser bridge. Download the fully offline bridge installer.";
161
+ readonly browserVersionAction: "Download browser package";
162
+ readonly browserVersionLater: "Later";
159
163
  readonly upgradeRetry: "Retry";
160
164
  };
161
165
  /** Stable key set shared by every managed DataOps locale. */