@webskill/sdk 0.17.0 → 0.19.0

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/dist/ui-react.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-BHkdefai.js";
2
2
  import { n as messageOf, t as WebSkillError } from "./errors-BDZNpC13.js";
3
3
  import { n as validateUiSpecEvent, r as validateUiSpecNode } from "./surface-DVGiCmwq.js";
4
- import { a as applySuggestion, c as DEFAULT_SURFACE_FORM_TEXTS, f as resolveSurfaceFormTexts, i as renderMiniMarkdown, l as DEFAULT_SURFACE_HOST_CONTROL_TEXTS, m as shapeInteractionValue, o as collectValues, p as resolveSurfaceHostControlTexts, r as renderMiniChart, u as interactionToFormModel } from "./miniChart-lauNtZu8.js";
5
- import { C as chartSpecFromProps, S as DEFAULT_CHART_FONT_SIZES, T as resolveChartFontSizes, d as collectScopedValues, f as qualifyFieldName, h as uiCatalog, l as evaluateFieldCondition, n as interactionToUiSpec, o as normalizeColumnWidths, r as toJsonRenderSpec, s as resolveColumnWidths, t as toOpenUiSpecLang, u as collectFormScopes, w as mountEchart, x as gaugePercent } from "./openUiSpecLang-B4QQ9Tfo.js";
4
+ import { a as applySuggestion, c as DEFAULT_SURFACE_FORM_TEXTS, f as resolveSurfaceFormTexts, i as renderMiniMarkdown, l as DEFAULT_SURFACE_HOST_CONTROL_TEXTS, m as shapeInteractionValue, o as collectValues, p as resolveSurfaceHostControlTexts, r as renderMiniChart, u as interactionToFormModel } from "./miniChart-D0nYMzz8.js";
5
+ import { C as DEFAULT_CHART_FONT_SIZES, E as resolveChartFontSizes, S as gaugePercent, T as mountEchart, c as resolveColumnWidths, d as collectFormScopes, f as collectScopedValues, g as uiCatalog, i as normalizeFieldOptions, n as interactionToUiSpec, p as qualifyFieldName, r as toJsonRenderSpec, s as normalizeColumnWidths, t as toOpenUiSpecLang, u as evaluateFieldCondition, w as chartSpecFromProps } from "./openUiSpecLang-CLXJEeRU.js";
6
6
  import minpath from "node:path";
7
7
  import { fileURLToPath as urlToPath } from "node:url";
8
8
  import { z } from "zod";
@@ -127184,6 +127184,15 @@ function collectFieldArrays(node, out = []) {
127184
127184
  }
127185
127185
  const isBlank = (value) => value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
127186
127186
  /**
127187
+ * select / multi-select 声明里一个选项都没有。
127188
+ * 控件无从渲染,必填也就无从满足,两处判定必须同源。
127189
+ */
127190
+ function hasNoChoices(field) {
127191
+ const type = str(field, "type", "text");
127192
+ if (type !== "select" && type !== "multi-select") return false;
127193
+ return normalizeFieldOptions(field["options"]).length === 0;
127194
+ }
127195
+ /**
127187
127196
  * 字段声明 → zod schema。
127188
127197
  *
127189
127198
  * `number` 那条不是可有可无的:数字框里打字母得到 `NaN`,而 `NaN` 不属于 `isBlank`,
@@ -127192,6 +127201,7 @@ const isBlank = (value) => value === void 0 || value === null || value === "" ||
127192
127201
  function schemaOfField(field, texts) {
127193
127202
  const required = field["required"] === true;
127194
127203
  const type = str(field, "type", "text");
127204
+ if (hasNoChoices(field)) return z.unknown();
127195
127205
  if (type === "number") {
127196
127206
  const base = z.number({ error: texts.required }).refine((value) => !Number.isNaN(value), texts.required);
127197
127207
  return required ? base : z.union([
@@ -127495,7 +127505,7 @@ function SurfaceField({ form, props, scope, binding }) {
127495
127505
  const errorId = error ? `webskill-surface-${form.surfaceId}-${key}-error` : void 0;
127496
127506
  const labelId = `webskill-surface-${form.surfaceId}-${key}-label`;
127497
127507
  const controlId = `webskill-surface-${form.surfaceId}-${key}`;
127498
- const options = Array.isArray(props["options"]) ? props["options"] : [];
127508
+ const options = normalizeFieldOptions(props["options"]);
127499
127509
  const suggestion = props["suggestion"];
127500
127510
  const texts = useSurfaceFormTexts();
127501
127511
  /**
@@ -127511,6 +127521,7 @@ function SurfaceField({ form, props, scope, binding }) {
127511
127521
  } : {}
127512
127522
  };
127513
127523
  const asRadioGroup = type === "select" && options.length > 0 && options.length <= RADIO_MAX_OPTIONS;
127524
+ const noChoices = hasNoChoices(props);
127514
127525
  if (!binding && !form.isFieldVisible(key)) return null;
127515
127526
  const control = () => {
127516
127527
  if (type === "textarea") return /* @__PURE__ */ jsx(Textarea, {
@@ -127539,6 +127550,11 @@ function SurfaceField({ form, props, scope, binding }) {
127539
127550
  onValueChange: (index) => setValue(options[Number(index)].value)
127540
127551
  });
127541
127552
  if (type === "select" || type === "multi-select") {
127553
+ if (noChoices) return /* @__PURE__ */ jsx("span", {
127554
+ "data-webskill-surface-control": key,
127555
+ className: "text-sm text-muted",
127556
+ children: texts.noOptions
127557
+ });
127542
127558
  const multiple = type === "multi-select";
127543
127559
  const optionList = options.map((option, index) => ({
127544
127560
  label: option.label,
@@ -127585,7 +127601,7 @@ function SurfaceField({ form, props, scope, binding }) {
127585
127601
  /* @__PURE__ */ jsx(FieldLabel, {
127586
127602
  id: labelId,
127587
127603
  required,
127588
- ...asRadioGroup ? {} : { htmlFor: controlId },
127604
+ ...asRadioGroup || noChoices ? {} : { htmlFor: controlId },
127589
127605
  children: label
127590
127606
  }),
127591
127607
  control(),
@@ -131337,7 +131353,7 @@ function OpenUiSpecSurface({ spec, surfaceId, actions, onAction }) {
131337
131353
  const [unavailable, setUnavailable] = useState(false);
131338
131354
  useEffect(() => {
131339
131355
  let cancelled = false;
131340
- import("./openUiLibrary-BJtCG5B1.js").then((loaded) => {
131356
+ import("./openUiLibrary-b0i7F_oZ.js").then((loaded) => {
131341
131357
  if (!cancelled) setModule(loaded);
131342
131358
  }).catch(() => {
131343
131359
  if (!cancelled) setUnavailable(true);
package/dist/ui-vue.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as applySuggestion, c as DEFAULT_SURFACE_FORM_TEXTS, i as renderMiniMarkdown, m as shapeInteractionValue, o as collectValues, r as renderMiniChart, u as interactionToFormModel } from "./miniChart-lauNtZu8.js";
1
+ import { a as applySuggestion, c as DEFAULT_SURFACE_FORM_TEXTS, i as renderMiniMarkdown, m as shapeInteractionValue, o as collectValues, r as renderMiniChart, u as interactionToFormModel } from "./miniChart-D0nYMzz8.js";
2
2
  import { defineComponent, h, reactive, ref } from "vue";
3
3
 
4
4
  //#region ../ui-vue/src/bridgeState.ts
package/dist/ui.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Ot as UiSpecNode } from "./types-Btpdd1y--BcxQ10Fa.js";
2
2
  import { Xn as buildRenderResult } from "./index-BDyXe-a5.js";
3
- import { $ as UiActionDef, $t as qualifyFieldName, A as EvaluateFieldConditionOptions, At as buildA2uiCatalogDefinition, B as OpenUiRendererProps, Bt as evaluateFieldCondition, C as DEFAULT_INTERACTION_TEXTS, Ct as WEBSKILL_STYLES_CSS, D as DOCUMENT_COMPONENTS, Dt as a2uiComponentSchema, E as DESCRIBE_UI_PRESET_TOOL, Et as ZodRuntime, F as InteractionTexts, Ft as collectSpecActions, G as SPEC_TABLE_MIN_COLUMN_WIDTH, Gt as gaugePercent, H as PLANNED_INCREMENT, Ht as fromA2uiSurfaceAction, I as JsonRenderSpec, It as collectValues, J as SurfaceHostControlTexts, Jt as loadOpenUiPeers, K as SpecColumnMeta, Kt as interactionToFormModel, L as LoadedOpenUiPeers, Lt as createUiCatalogToolSource, M as FieldConditionResult, Mt as chartToTable, N as FormModel, Nt as collectFormScopes, O as DocumentComponentName, Ot as a2uiComponentShapes, P as InteractionSpecLabels, Pt as collectScopedValues, Q as UI_PRESET_NAMES, Qt as normalizeColumnWidths, R as MAX_CONDITION_DEPTH, Rt as defineUiCatalog, S as DEFAULT_CHART_FONT_SIZES, St as WEBSKILL_A2UI_CATALOG_ID, T as DEFAULT_SURFACE_HOST_CONTROL_TEXTS, Tt as WebFormBridge, U as RENDER_UI_TOOL, Ut as fromUiSurfaceActionDispatch, V as OpenUiRuntime, Vt as fromA2uiSpecAction, W as SPEC_TABLE_MIN_COLUMN_VAR, Wt as fromVercelToolResult, X as UI_CATALOG_PROMPT_BUDGET_BYTES, Xt as mountEchart, Y as UI_CATALOG_GROUPS, Yt as loadWebSkillLitCatalog, Z as UI_PRESETS, Zt as mountViewerComponents, _ as CHART_PALETTE, _n as uiCatalog, _t as VIEWER_PROPS_ATTR, a as A2UI_SURFACE_ACTION, an as resolveColumnWidths, at as UiFormScope, b as ColumnWidthsRejection, bt as ViewerComponentsHandle, c as A2uiCatalogDefinition, cn as resolveSurfaceHostControlTexts, ct as UiSpecDegradation, d as A2uiMessage, dn as toA2uiSurfaceAction, dt as UiSpecSanitization, en as renderBlocks, et as UiCatalog, f as A2uiSpecActionEvent, fn as toEchartsOption, ft as UiSpecValidation, g as CATALOG_SCHEMA_MAX, gn as toVercelToolInvocation, gt as VIEWER_FALLBACK_ATTR, h as CATALOG_PROMPT_MAX, hn as toUiSurfaceActionDispatch, ht as VIEWER_COMPONENT_ATTR, i as A2UI_SPEC_FORM_PATH, in as resolveChartFontSizes, it as UiComponentDef, j as FieldCondition, jt as chartSpecFromProps, k as EchartHandle, kt as applySuggestion, l as A2uiCatalogHandle, ln as shapeInteractionValue, lt as UiSpecDegradationCode, m as CATALOG_BUDGET_STAGE, mn as toOpenUiSpecLang, mt as VERCEL_INTERACTION_TOOL_NAME, n as A2UI_COMMON_TYPES, nn as renderMiniMarkdown, nt as UiCatalogPromptOptions, o as A2UI_VERSION, on as resolveInteractionTexts, ot as UiPreset, p as A2uiSpecMessageOptions, pn as toJsonRenderSpec, pt as UiSurfaceActionDispatch, q as SurfaceFormTexts, qt as interactionToUiSpec, r as A2UI_SPEC_ACTION, rn as renderRenderResult, rt as UiCatalogToolSourceOptions, s as A2uiCatalogComponent, sn as resolveSurfaceFormTexts, st as UiPresetName, t as A2UI_BASIC_CATALOG_ID, tn as renderMiniChart, tt as UiCatalogInput, u as A2uiComponentShape, un as toA2uiSpecMessages, ut as UiSpecIssue, v as ChartFontSizes, vn as uiPreset, vt as VercelToolInvocation, w as DEFAULT_SURFACE_FORM_TEXTS, wt as WEBSKILL_SURFACE_ACTION, x as ControlModel, xt as ViewerComponentsOptions, y as CollectedValues, yt as VercelUiBridge, z as NormalizedColumnWidths, zt as ensureStyles } from "./index-CaLsVI-m.js";
4
- export { A2UI_BASIC_CATALOG_ID, A2UI_COMMON_TYPES, A2UI_SPEC_ACTION, A2UI_SPEC_FORM_PATH, A2UI_SURFACE_ACTION, A2UI_VERSION, type A2uiCatalogComponent, type A2uiCatalogDefinition, type A2uiCatalogHandle, type A2uiComponentShape, type A2uiMessage, type A2uiSpecActionEvent, type A2uiSpecMessageOptions, CATALOG_BUDGET_STAGE, CATALOG_PROMPT_MAX, CATALOG_SCHEMA_MAX, CHART_PALETTE, type ChartFontSizes, type CollectedValues, type ColumnWidthsRejection, type ControlModel, DEFAULT_CHART_FONT_SIZES, DEFAULT_INTERACTION_TEXTS, DEFAULT_SURFACE_FORM_TEXTS, DEFAULT_SURFACE_HOST_CONTROL_TEXTS, DESCRIBE_UI_PRESET_TOOL, DOCUMENT_COMPONENTS, type DocumentComponentName, type EchartHandle, type EvaluateFieldConditionOptions, type FieldCondition, type FieldConditionResult, type FormModel, type InteractionSpecLabels, type InteractionTexts, type JsonRenderSpec, type LoadedOpenUiPeers, MAX_CONDITION_DEPTH, type NormalizedColumnWidths, type OpenUiRendererProps, type OpenUiRuntime, PLANNED_INCREMENT, RENDER_UI_TOOL, SPEC_TABLE_MIN_COLUMN_VAR, SPEC_TABLE_MIN_COLUMN_WIDTH, type SpecColumnMeta, type SurfaceFormTexts, type SurfaceHostControlTexts, UI_CATALOG_GROUPS, UI_CATALOG_PROMPT_BUDGET_BYTES, UI_PRESETS, UI_PRESET_NAMES, type UiActionDef, type UiCatalog, type UiCatalogInput, type UiCatalogPromptOptions, type UiCatalogToolSourceOptions, type UiComponentDef, type UiFormScope, type UiPreset, type UiPresetName, type UiSpecDegradation, type UiSpecDegradationCode, type UiSpecIssue, type UiSpecNode, type UiSpecSanitization, type UiSpecValidation, type UiSurfaceActionDispatch, VERCEL_INTERACTION_TOOL_NAME, VIEWER_COMPONENT_ATTR, VIEWER_FALLBACK_ATTR, VIEWER_PROPS_ATTR, type VercelToolInvocation, VercelUiBridge, type ViewerComponentsHandle, type ViewerComponentsOptions, WEBSKILL_A2UI_CATALOG_ID, WEBSKILL_STYLES_CSS, WEBSKILL_SURFACE_ACTION, WebFormBridge, type ZodRuntime, a2uiComponentSchema, a2uiComponentShapes, applySuggestion, buildA2uiCatalogDefinition, buildRenderResult, chartSpecFromProps, chartToTable, collectFormScopes, collectScopedValues, collectSpecActions, collectValues, createUiCatalogToolSource, defineUiCatalog, ensureStyles, evaluateFieldCondition, fromA2uiSpecAction, fromA2uiSurfaceAction, fromUiSurfaceActionDispatch, fromVercelToolResult, gaugePercent, interactionToFormModel, interactionToUiSpec, loadOpenUiPeers, loadWebSkillLitCatalog, mountEchart, mountViewerComponents, normalizeColumnWidths, qualifyFieldName, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, resolveChartFontSizes, resolveColumnWidths, resolveInteractionTexts, resolveSurfaceFormTexts, resolveSurfaceHostControlTexts, shapeInteractionValue, toA2uiSpecMessages, toA2uiSurfaceAction, toEchartsOption, toJsonRenderSpec, toOpenUiSpecLang, toUiSurfaceActionDispatch, toVercelToolInvocation, uiCatalog, uiPreset };
3
+ import { $ as UI_PRESET_NAMES, $t as normalizeColumnWidths, A as EvaluateFieldConditionOptions, At as applySuggestion, B as NormalizedColumnWidths, Bt as ensureStyles, C as DEFAULT_INTERACTION_TEXTS, Ct as WEBSKILL_A2UI_CATALOG_ID, D as DOCUMENT_COMPONENTS, Dt as ZodRuntime, E as DESCRIBE_UI_PRESET_TOOL, Et as WebFormBridge, F as InteractionSpecLabels, Ft as collectScopedValues, G as SPEC_TABLE_MIN_COLUMN_VAR, Gt as fromVercelToolResult, H as OpenUiRuntime, Ht as fromA2uiSpecAction, I as InteractionTexts, It as collectSpecActions, J as SurfaceFormTexts, Jt as interactionToUiSpec, K as SPEC_TABLE_MIN_COLUMN_WIDTH, Kt as gaugePercent, L as JsonRenderSpec, Lt as collectValues, M as FieldConditionResult, Mt as chartSpecFromProps, N as FieldOption, Nt as chartToTable, O as DocumentComponentName, Ot as a2uiComponentSchema, P as FormModel, Pt as collectFormScopes, Q as UI_PRESETS, Qt as mountViewerComponents, R as LoadedOpenUiPeers, Rt as createUiCatalogToolSource, S as DEFAULT_CHART_FONT_SIZES, St as ViewerComponentsOptions, T as DEFAULT_SURFACE_HOST_CONTROL_TEXTS, Tt as WEBSKILL_SURFACE_ACTION, U as PLANNED_INCREMENT, Ut as fromA2uiSurfaceAction, V as OpenUiRendererProps, Vt as evaluateFieldCondition, W as RENDER_UI_TOOL, Wt as fromUiSurfaceActionDispatch, X as UI_CATALOG_GROUPS, Xt as loadWebSkillLitCatalog, Y as SurfaceHostControlTexts, Yt as loadOpenUiPeers, Z as UI_CATALOG_PROMPT_BUDGET_BYTES, Zt as mountEchart, _ as CHART_PALETTE, _n as toUiSurfaceActionDispatch, _t as VIEWER_FALLBACK_ATTR, a as A2UI_SURFACE_ACTION, an as renderRenderResult, at as UiComponentDef, b as ColumnWidthsRejection, bn as uiPreset, bt as VercelUiBridge, c as A2uiCatalogDefinition, cn as resolveInteractionTexts, ct as UiPresetName, d as A2uiMessage, dn as shapeInteractionValue, dt as UiSpecIssue, en as normalizeFieldOptions, et as UiActionDef, f as A2uiSpecActionEvent, fn as toA2uiSpecMessages, ft as UiSpecSanitization, g as CATALOG_SCHEMA_MAX, gn as toOpenUiSpecLang, gt as VIEWER_COMPONENT_ATTR, h as CATALOG_PROMPT_MAX, hn as toJsonRenderSpec, ht as VERCEL_INTERACTION_TOOL_NAME, i as A2UI_SPEC_FORM_PATH, in as renderMiniMarkdown, it as UiCatalogToolSourceOptions, j as FieldCondition, jt as buildA2uiCatalogDefinition, k as EchartHandle, kt as a2uiComponentShapes, l as A2uiCatalogHandle, ln as resolveSurfaceFormTexts, lt as UiSpecDegradation, m as CATALOG_BUDGET_STAGE, mn as toEchartsOption, mt as UiSurfaceActionDispatch, n as A2UI_COMMON_TYPES, nn as renderBlocks, nt as UiCatalogInput, o as A2UI_VERSION, on as resolveChartFontSizes, ot as UiFormScope, p as A2uiSpecMessageOptions, pn as toA2uiSurfaceAction, pt as UiSpecValidation, q as SpecColumnMeta, qt as interactionToFormModel, r as A2UI_SPEC_ACTION, rn as renderMiniChart, rt as UiCatalogPromptOptions, s as A2uiCatalogComponent, sn as resolveColumnWidths, st as UiPreset, t as A2UI_BASIC_CATALOG_ID, tn as qualifyFieldName, tt as UiCatalog, u as A2uiComponentShape, un as resolveSurfaceHostControlTexts, ut as UiSpecDegradationCode, v as ChartFontSizes, vn as toVercelToolInvocation, vt as VIEWER_PROPS_ATTR, w as DEFAULT_SURFACE_FORM_TEXTS, wt as WEBSKILL_STYLES_CSS, x as ControlModel, xt as ViewerComponentsHandle, y as CollectedValues, yn as uiCatalog, yt as VercelToolInvocation, z as MAX_CONDITION_DEPTH, zt as defineUiCatalog } from "./index-ad11wflI.js";
4
+ export { A2UI_BASIC_CATALOG_ID, A2UI_COMMON_TYPES, A2UI_SPEC_ACTION, A2UI_SPEC_FORM_PATH, A2UI_SURFACE_ACTION, A2UI_VERSION, type A2uiCatalogComponent, type A2uiCatalogDefinition, type A2uiCatalogHandle, type A2uiComponentShape, type A2uiMessage, type A2uiSpecActionEvent, type A2uiSpecMessageOptions, CATALOG_BUDGET_STAGE, CATALOG_PROMPT_MAX, CATALOG_SCHEMA_MAX, CHART_PALETTE, type ChartFontSizes, type CollectedValues, type ColumnWidthsRejection, type ControlModel, DEFAULT_CHART_FONT_SIZES, DEFAULT_INTERACTION_TEXTS, DEFAULT_SURFACE_FORM_TEXTS, DEFAULT_SURFACE_HOST_CONTROL_TEXTS, DESCRIBE_UI_PRESET_TOOL, DOCUMENT_COMPONENTS, type DocumentComponentName, type EchartHandle, type EvaluateFieldConditionOptions, type FieldCondition, type FieldConditionResult, type FieldOption, type FormModel, type InteractionSpecLabels, type InteractionTexts, type JsonRenderSpec, type LoadedOpenUiPeers, MAX_CONDITION_DEPTH, type NormalizedColumnWidths, type OpenUiRendererProps, type OpenUiRuntime, PLANNED_INCREMENT, RENDER_UI_TOOL, SPEC_TABLE_MIN_COLUMN_VAR, SPEC_TABLE_MIN_COLUMN_WIDTH, type SpecColumnMeta, type SurfaceFormTexts, type SurfaceHostControlTexts, UI_CATALOG_GROUPS, UI_CATALOG_PROMPT_BUDGET_BYTES, UI_PRESETS, UI_PRESET_NAMES, type UiActionDef, type UiCatalog, type UiCatalogInput, type UiCatalogPromptOptions, type UiCatalogToolSourceOptions, type UiComponentDef, type UiFormScope, type UiPreset, type UiPresetName, type UiSpecDegradation, type UiSpecDegradationCode, type UiSpecIssue, type UiSpecNode, type UiSpecSanitization, type UiSpecValidation, type UiSurfaceActionDispatch, VERCEL_INTERACTION_TOOL_NAME, VIEWER_COMPONENT_ATTR, VIEWER_FALLBACK_ATTR, VIEWER_PROPS_ATTR, type VercelToolInvocation, VercelUiBridge, type ViewerComponentsHandle, type ViewerComponentsOptions, WEBSKILL_A2UI_CATALOG_ID, WEBSKILL_STYLES_CSS, WEBSKILL_SURFACE_ACTION, WebFormBridge, type ZodRuntime, a2uiComponentSchema, a2uiComponentShapes, applySuggestion, buildA2uiCatalogDefinition, buildRenderResult, chartSpecFromProps, chartToTable, collectFormScopes, collectScopedValues, collectSpecActions, collectValues, createUiCatalogToolSource, defineUiCatalog, ensureStyles, evaluateFieldCondition, fromA2uiSpecAction, fromA2uiSurfaceAction, fromUiSurfaceActionDispatch, fromVercelToolResult, gaugePercent, interactionToFormModel, interactionToUiSpec, loadOpenUiPeers, loadWebSkillLitCatalog, mountEchart, mountViewerComponents, normalizeColumnWidths, normalizeFieldOptions, qualifyFieldName, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, resolveChartFontSizes, resolveColumnWidths, resolveInteractionTexts, resolveSurfaceFormTexts, resolveSurfaceHostControlTexts, shapeInteractionValue, toA2uiSpecMessages, toA2uiSurfaceAction, toEchartsOption, toJsonRenderSpec, toOpenUiSpecLang, toUiSurfaceActionDispatch, toVercelToolInvocation, uiCatalog, uiPreset };
package/dist/ui.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as WebSkillError } from "./errors-BDZNpC13.js";
2
2
  import { t as buildRenderResult } from "./renderResult-D9Q-Vu2x.js";
3
- import { a as applySuggestion, c as DEFAULT_SURFACE_FORM_TEXTS, d as resolveInteractionTexts, f as resolveSurfaceFormTexts, i as renderMiniMarkdown, l as DEFAULT_SURFACE_HOST_CONTROL_TEXTS, m as shapeInteractionValue, n as chartToTable, o as collectValues, p as resolveSurfaceHostControlTexts, r as renderMiniChart, s as DEFAULT_INTERACTION_TEXTS, t as CHART_PALETTE, u as interactionToFormModel } from "./miniChart-lauNtZu8.js";
4
- import { C as chartSpecFromProps, E as toEchartsOption, S as DEFAULT_CHART_FONT_SIZES, T as resolveChartFontSizes, _ as CATALOG_BUDGET_STAGE, a as SPEC_TABLE_MIN_COLUMN_WIDTH, b as PLANNED_INCREMENT, c as MAX_CONDITION_DEPTH, d as collectScopedValues, f as qualifyFieldName, g as defineUiCatalog, h as uiCatalog, i as SPEC_TABLE_MIN_COLUMN_VAR, l as evaluateFieldCondition, m as UI_CATALOG_PROMPT_BUDGET_BYTES, n as interactionToUiSpec, o as normalizeColumnWidths, p as UI_CATALOG_GROUPS, r as toJsonRenderSpec, s as resolveColumnWidths, t as toOpenUiSpecLang, u as collectFormScopes, v as CATALOG_PROMPT_MAX, w as mountEchart, x as gaugePercent, y as CATALOG_SCHEMA_MAX } from "./openUiSpecLang-B4QQ9Tfo.js";
3
+ import { a as applySuggestion, c as DEFAULT_SURFACE_FORM_TEXTS, d as resolveInteractionTexts, f as resolveSurfaceFormTexts, i as renderMiniMarkdown, l as DEFAULT_SURFACE_HOST_CONTROL_TEXTS, m as shapeInteractionValue, n as chartToTable, o as collectValues, p as resolveSurfaceHostControlTexts, r as renderMiniChart, s as DEFAULT_INTERACTION_TEXTS, t as CHART_PALETTE, u as interactionToFormModel } from "./miniChart-D0nYMzz8.js";
4
+ import { C as DEFAULT_CHART_FONT_SIZES, D as toEchartsOption, E as resolveChartFontSizes, S as gaugePercent, T as mountEchart, _ as defineUiCatalog, a as SPEC_TABLE_MIN_COLUMN_VAR, b as CATALOG_SCHEMA_MAX, c as resolveColumnWidths, d as collectFormScopes, f as collectScopedValues, g as uiCatalog, h as UI_CATALOG_PROMPT_BUDGET_BYTES, i as normalizeFieldOptions, l as MAX_CONDITION_DEPTH, m as UI_CATALOG_GROUPS, n as interactionToUiSpec, o as SPEC_TABLE_MIN_COLUMN_WIDTH, p as qualifyFieldName, r as toJsonRenderSpec, s as normalizeColumnWidths, t as toOpenUiSpecLang, u as evaluateFieldCondition, v as CATALOG_BUDGET_STAGE, w as chartSpecFromProps, x as PLANNED_INCREMENT, y as CATALOG_PROMPT_MAX } from "./openUiSpecLang-CLXJEeRU.js";
5
5
 
6
6
  //#region ../ui/src/web/resultRenderer.ts
7
7
  /** RenderBlock → DOM(markdown/json/table/image/file/chart 六种) */
@@ -155,11 +155,21 @@ function readProps(element, name) {
155
155
  }
156
156
  const result = schema.safeParse(parsed);
157
157
  if (!result.success) {
158
- fallback(element, `Component "${name}" has props the catalog rejects`);
158
+ fallback(element, `Component "${name}" has props the catalog rejects: ${describeIssue(result.error)}`);
159
159
  return;
160
160
  }
161
161
  return result.data;
162
162
  }
163
+ /**
164
+ * 只报第一条:这是文档里的一行降级提示,不是校验报告。
165
+ * 但必须指名字段——写「props 不合法」等于让作者把五个字段挨个试一遍。
166
+ */
167
+ function describeIssue(error) {
168
+ const issue = error.issues[0];
169
+ if (!issue) return "unknown reason";
170
+ const path = issue.path.map(String).join(".");
171
+ return path === "" ? issue.message : `${path} — ${issue.message}`;
172
+ }
163
173
  function render(element, name, props, fontSizes) {
164
174
  const doc = element.ownerDocument;
165
175
  element.replaceChildren();
@@ -1224,7 +1234,7 @@ function fromA2uiSpecAction(event) {
1224
1234
  */
1225
1235
  async function loadWebSkillLitCatalog() {
1226
1236
  try {
1227
- const { webskillLitCatalog } = await import("./webskillLitCatalog-BBkQjKuN.js");
1237
+ const { webskillLitCatalog } = await import("./webskillLitCatalog-W06npwej.js");
1228
1238
  return webskillLitCatalog();
1229
1239
  } catch (cause) {
1230
1240
  throw new WebSkillError("UI_UNAVAILABLE", "The WebSkill A2UI catalog is unavailable; install @a2ui/lit, @a2ui/web_core and lit to render catalog surfaces with A2UI", cause);
@@ -1252,4 +1262,4 @@ async function loadOpenUiPeers() {
1252
1262
  }
1253
1263
 
1254
1264
  //#endregion
1255
- export { A2UI_BASIC_CATALOG_ID, A2UI_COMMON_TYPES, A2UI_SPEC_ACTION, A2UI_SPEC_FORM_PATH, A2UI_SURFACE_ACTION, A2UI_VERSION, CATALOG_BUDGET_STAGE, CATALOG_PROMPT_MAX, CATALOG_SCHEMA_MAX, CHART_PALETTE, DEFAULT_CHART_FONT_SIZES, DEFAULT_INTERACTION_TEXTS, DEFAULT_SURFACE_FORM_TEXTS, DEFAULT_SURFACE_HOST_CONTROL_TEXTS, DESCRIBE_UI_PRESET_TOOL, DOCUMENT_COMPONENTS, MAX_CONDITION_DEPTH, PLANNED_INCREMENT, RENDER_UI_TOOL, SPEC_TABLE_MIN_COLUMN_VAR, SPEC_TABLE_MIN_COLUMN_WIDTH, UI_CATALOG_GROUPS, UI_CATALOG_PROMPT_BUDGET_BYTES, UI_PRESETS, UI_PRESET_NAMES, VERCEL_INTERACTION_TOOL_NAME, VIEWER_COMPONENT_ATTR, VIEWER_FALLBACK_ATTR, VIEWER_PROPS_ATTR, VercelUiBridge, WEBSKILL_A2UI_CATALOG_ID, WEBSKILL_STYLES_CSS, WEBSKILL_SURFACE_ACTION, WebFormBridge, a2uiComponentSchema, a2uiComponentShapes, applySuggestion, buildA2uiCatalogDefinition, buildRenderResult, chartSpecFromProps, chartToTable, collectFormScopes, collectScopedValues, collectSpecActions, collectValues, createUiCatalogToolSource, defineUiCatalog, ensureStyles, evaluateFieldCondition, fromA2uiSpecAction, fromA2uiSurfaceAction, fromUiSurfaceActionDispatch, fromVercelToolResult, gaugePercent, interactionToFormModel, interactionToUiSpec, loadOpenUiPeers, loadWebSkillLitCatalog, mountEchart, mountViewerComponents, normalizeColumnWidths, qualifyFieldName, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, resolveChartFontSizes, resolveColumnWidths, resolveInteractionTexts, resolveSurfaceFormTexts, resolveSurfaceHostControlTexts, shapeInteractionValue, A2UI_CHILDREN_PROP as t, toA2uiSpecMessages, toA2uiSurfaceAction, toEchartsOption, toJsonRenderSpec, toOpenUiSpecLang, toUiSurfaceActionDispatch, toVercelToolInvocation, uiCatalog, uiPreset };
1265
+ export { A2UI_BASIC_CATALOG_ID, A2UI_COMMON_TYPES, A2UI_SPEC_ACTION, A2UI_SPEC_FORM_PATH, A2UI_SURFACE_ACTION, A2UI_VERSION, CATALOG_BUDGET_STAGE, CATALOG_PROMPT_MAX, CATALOG_SCHEMA_MAX, CHART_PALETTE, DEFAULT_CHART_FONT_SIZES, DEFAULT_INTERACTION_TEXTS, DEFAULT_SURFACE_FORM_TEXTS, DEFAULT_SURFACE_HOST_CONTROL_TEXTS, DESCRIBE_UI_PRESET_TOOL, DOCUMENT_COMPONENTS, MAX_CONDITION_DEPTH, PLANNED_INCREMENT, RENDER_UI_TOOL, SPEC_TABLE_MIN_COLUMN_VAR, SPEC_TABLE_MIN_COLUMN_WIDTH, UI_CATALOG_GROUPS, UI_CATALOG_PROMPT_BUDGET_BYTES, UI_PRESETS, UI_PRESET_NAMES, VERCEL_INTERACTION_TOOL_NAME, VIEWER_COMPONENT_ATTR, VIEWER_FALLBACK_ATTR, VIEWER_PROPS_ATTR, VercelUiBridge, WEBSKILL_A2UI_CATALOG_ID, WEBSKILL_STYLES_CSS, WEBSKILL_SURFACE_ACTION, WebFormBridge, a2uiComponentSchema, a2uiComponentShapes, applySuggestion, buildA2uiCatalogDefinition, buildRenderResult, chartSpecFromProps, chartToTable, collectFormScopes, collectScopedValues, collectSpecActions, collectValues, createUiCatalogToolSource, defineUiCatalog, ensureStyles, evaluateFieldCondition, fromA2uiSpecAction, fromA2uiSurfaceAction, fromUiSurfaceActionDispatch, fromVercelToolResult, gaugePercent, interactionToFormModel, interactionToUiSpec, loadOpenUiPeers, loadWebSkillLitCatalog, mountEchart, mountViewerComponents, normalizeColumnWidths, normalizeFieldOptions, qualifyFieldName, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, resolveChartFontSizes, resolveColumnWidths, resolveInteractionTexts, resolveSurfaceFormTexts, resolveSurfaceHostControlTexts, shapeInteractionValue, A2UI_CHILDREN_PROP as t, toA2uiSpecMessages, toA2uiSurfaceAction, toEchartsOption, toJsonRenderSpec, toOpenUiSpecLang, toUiSurfaceActionDispatch, toVercelToolInvocation, uiCatalog, uiPreset };
@@ -1,6 +1,6 @@
1
1
  import { t as WebSkillError } from "./errors-BDZNpC13.js";
2
2
  import { b as parseSkillMarkdown, i as buildCatalog, n as SkillDiscovery, t as validateSkills } from "./skill-CAJMsLod.js";
3
- import { f as WebSkillRuntime } from "./approval-CBPnGPIm.js";
3
+ import { f as WebSkillRuntime } from "./approval-Bbh_Apwg.js";
4
4
 
5
5
  //#region ../runtime/src/facade/webSkillApi.ts
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { c as DEFAULT_SURFACE_FORM_TEXTS, i as renderMiniMarkdown } from "./miniChart-lauNtZu8.js";
2
- import { C as chartSpecFromProps, h as uiCatalog, w as mountEchart } from "./openUiSpecLang-B4QQ9Tfo.js";
1
+ import { c as DEFAULT_SURFACE_FORM_TEXTS, i as renderMiniMarkdown } from "./miniChart-D0nYMzz8.js";
2
+ import { T as mountEchart, g as uiCatalog, i as normalizeFieldOptions, w as chartSpecFromProps } from "./openUiSpecLang-CLXJEeRU.js";
3
3
  import { WEBSKILL_A2UI_CATALOG_ID, a2uiComponentShapes, t as A2UI_CHILDREN_PROP } from "./ui.js";
4
4
  import { A2uiController, A2uiLitElement } from "@a2ui/lit/v0_9";
5
5
  import { Catalog } from "@a2ui/web_core/v0_9";
@@ -1887,7 +1887,7 @@ const renderers = {
1887
1887
  const type = str(props, "type", "text");
1888
1888
  const value = props["value"];
1889
1889
  const commit = (next) => props.setValue?.(next);
1890
- const options = list(props["options"]);
1890
+ const options = normalizeFieldOptions(props["options"]);
1891
1891
  const control = () => {
1892
1892
  if (type === "textarea") return T`<textarea
1893
1893
  id=${name}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webskill/sdk",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "WebSkill — browser/Node agent skill runtime (skills, tools, MCP, governance, UI)",
5
5
  "license": "MIT",
6
6
  "type": "module",