@shwfed/config 2.12.0 → 2.12.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 (90) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +68 -68
  3. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +68 -68
  4. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +68 -68
  5. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +68 -68
  6. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +34 -34
  7. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.d.vue.ts +2 -0
  8. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.vue +22 -0
  9. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.vue.d.ts +2 -0
  10. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/runtime.vue +5 -0
  11. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/schema.d.ts +1 -0
  12. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/schema.js +12 -0
  13. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +2 -0
  14. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue +22 -0
  15. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +2 -0
  16. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/runtime.vue +5 -0
  17. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/schema.d.ts +1 -0
  18. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/schema.js +12 -0
  19. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +2 -0
  20. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue +22 -0
  21. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +2 -0
  22. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/runtime.vue +5 -0
  23. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/schema.d.ts +1 -0
  24. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/schema.js +12 -0
  25. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +2 -0
  26. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue +22 -0
  27. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +2 -0
  28. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/runtime.vue +5 -0
  29. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/schema.d.ts +1 -0
  30. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/schema.js +12 -0
  31. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.d.vue.ts +2 -0
  32. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue +22 -0
  33. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue.d.ts +2 -0
  34. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.vue +5 -0
  35. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.d.ts +1 -0
  36. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.js +12 -0
  37. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.d.vue.ts +2 -0
  38. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue +22 -0
  39. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue.d.ts +2 -0
  40. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue +5 -0
  41. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.d.ts +1 -0
  42. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.js +12 -0
  43. package/dist/runtime/components/form/utils/ai-field-tools.d.ts +11 -0
  44. package/dist/runtime/components/form/utils/ai-field-tools.js +282 -0
  45. package/dist/runtime/components/form/utils/resolve.d.ts +15 -0
  46. package/dist/runtime/components/form/utils/resolve.js +13 -0
  47. package/dist/runtime/components/table/ai-generate.system.md +6 -0
  48. package/dist/runtime/components/table/ai-generate.vue +18 -17
  49. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
  50. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
  51. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
  52. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
  53. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
  54. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
  55. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
  56. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
  57. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
  58. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
  59. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
  60. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
  61. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  62. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  63. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  64. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  65. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  66. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  67. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  68. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  69. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/config.vue +33 -0
  70. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/runtime.vue +5 -0
  71. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/schema.d.ts +1 -0
  72. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/schema.js +6 -1
  73. package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/config.vue +33 -0
  74. package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/runtime.vue +5 -0
  75. package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/schema.d.ts +1 -0
  76. package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/schema.js +6 -1
  77. package/dist/runtime/components/table/schema.d.ts +68 -68
  78. package/dist/runtime/components/table/utils/ai-tools.js +50 -1
  79. package/dist/runtime/components/table/utils/shared.d.ts +1 -0
  80. package/dist/runtime/components/table/utils/shared.js +10 -0
  81. package/dist/runtime/components/ui/alert-dialog/AlertDialogCancel.vue +1 -1
  82. package/dist/runtime/components/ui/chat/ChatPrompt.d.vue.ts +11 -1
  83. package/dist/runtime/components/ui/chat/ChatPrompt.vue +10 -0
  84. package/dist/runtime/components/ui/chat/ChatPrompt.vue.d.ts +11 -1
  85. package/dist/runtime/share/disabled-date.d.ts +34 -0
  86. package/dist/runtime/share/disabled-date.js +13 -0
  87. package/dist/runtime/utils/ai/index.js +24 -1
  88. package/dist/runtime/utils/disabled-date.d.ts +26 -0
  89. package/dist/runtime/utils/disabled-date.js +21 -0
  90. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { Schema } from "effect";
2
2
  import { getProperty } from "dot-prop";
3
3
  import { Locale } from "../../../../../share/locale.js";
4
- import { Align, CelRowAccess, derivedRowField, editableColumnFields, editableHeader } from "../../../utils/shared.js";
4
+ import { Align, CelDateDisable, CelRowAccess, derivedRowField, editableColumnFields, editableHeader } from "../../../utils/shared.js";
5
5
  export const type = "com.shwfed.table.column.date-range-input";
6
6
  export const compatibilityDate = "2026-06-22";
7
7
  export const metadata = {
@@ -40,6 +40,7 @@ export function presetSchema(configure) {
40
40
  }
41
41
  export function schema(configure) {
42
42
  const CelBool = CelRowAccess(configure, { resultType: "bool" });
43
+ const DisabledDate = CelDateDisable(configure);
43
44
  const Preset = presetSchema(configure);
44
45
  return Schema.Struct({
45
46
  type: Schema.Literal(type),
@@ -64,6 +65,10 @@ export function schema(configure) {
64
65
  title: "\u53EA\u8BFB\u6761\u4EF6",
65
66
  description: "\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u503C"
66
67
  })),
68
+ disabledDate: Schema.optional(DisabledDate.annotations({
69
+ title: "\u7981\u7528\u65E5\u671F",
70
+ description: "\u9010\u4E2A\u65E5\u671F\u5224\u5B9A\u662F\u5426\u53EF\u9009\uFF1B\u53D8\u91CF `input` \u4E3A\u5019\u9009\u65E5\u671F\uFF0C\u540C\u65F6\u53EF\u8BFB\u53D6 `row`/`index`\u3002\u8FD4\u56DE `true` \u65F6\u7981\u7528\u8BE5\u65E5\u671F\uFF0C\u8FD4\u56DE `false`\u3001\u7A7A\u503C\u6216\u4E0D\u586B\u65F6\u53EF\u9009"
71
+ })),
67
72
  derived: derivedRowField(configure, "dyn"),
68
73
  format: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
69
74
  title: "\u5C55\u793A\u683C\u5F0F",
@@ -157,40 +157,6 @@ export declare function TableConfig(configure: (env: Environment) => void): Sche
157
157
  readonly message: string;
158
158
  }[]] | undefined;
159
159
  }[];
160
- readonly query?: {
161
- readonly style?: string | undefined;
162
- readonly id?: string | undefined;
163
- readonly initial?: {
164
- readonly data: string;
165
- readonly request?: string | undefined;
166
- } | undefined;
167
- readonly displayName?: string | undefined;
168
- readonly kind: "shwfed.component.form";
169
- readonly fields: readonly any[];
170
- readonly layouts: readonly {
171
- readonly name: string;
172
- readonly layout: {
173
- readonly style?: string | undefined;
174
- readonly columns: number;
175
- readonly gap?: number | undefined;
176
- readonly rows?: number | undefined;
177
- readonly placements: {
178
- readonly [x: string]: {
179
- readonly area: readonly [readonly [number, number], readonly [number, number]];
180
- readonly v?: "stretch" | "center" | "end" | "start" | undefined;
181
- readonly h?: "stretch" | "center" | "end" | "start" | undefined;
182
- };
183
- };
184
- };
185
- readonly media?: string | undefined;
186
- }[];
187
- readonly readonly?: string | undefined;
188
- } | undefined;
189
- readonly dataSource?: {
190
- readonly data: string;
191
- readonly total?: string | undefined;
192
- readonly request?: string | undefined;
193
- } | undefined;
194
160
  readonly actions?: {
195
161
  readonly size: "default" | "sm" | "xs";
196
162
  readonly style?: string | undefined;
@@ -258,6 +224,40 @@ export declare function TableConfig(configure: (env: Environment) => void): Sche
258
224
  readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
259
225
  }[];
260
226
  } | undefined;
227
+ readonly query?: {
228
+ readonly style?: string | undefined;
229
+ readonly id?: string | undefined;
230
+ readonly initial?: {
231
+ readonly data: string;
232
+ readonly request?: string | undefined;
233
+ } | undefined;
234
+ readonly displayName?: string | undefined;
235
+ readonly kind: "shwfed.component.form";
236
+ readonly fields: readonly any[];
237
+ readonly layouts: readonly {
238
+ readonly name: string;
239
+ readonly layout: {
240
+ readonly style?: string | undefined;
241
+ readonly columns: number;
242
+ readonly gap?: number | undefined;
243
+ readonly rows?: number | undefined;
244
+ readonly placements: {
245
+ readonly [x: string]: {
246
+ readonly area: readonly [readonly [number, number], readonly [number, number]];
247
+ readonly v?: "stretch" | "center" | "end" | "start" | undefined;
248
+ readonly h?: "stretch" | "center" | "end" | "start" | undefined;
249
+ };
250
+ };
251
+ };
252
+ readonly media?: string | undefined;
253
+ }[];
254
+ readonly readonly?: string | undefined;
255
+ } | undefined;
256
+ readonly dataSource?: {
257
+ readonly data: string;
258
+ readonly total?: string | undefined;
259
+ readonly request?: string | undefined;
260
+ } | undefined;
261
261
  readonly bottomActions?: {
262
262
  readonly size: "default" | "sm" | "xs";
263
263
  readonly style?: string | undefined;
@@ -826,40 +826,6 @@ export declare function createTableConfig(body: Omit<Schema.Schema.Type<ReturnTy
826
826
  readonly message: string;
827
827
  }[]] | undefined;
828
828
  }[];
829
- query?: {
830
- readonly style?: string | undefined;
831
- readonly id?: string | undefined;
832
- readonly initial?: {
833
- readonly data: string;
834
- readonly request?: string | undefined;
835
- } | undefined;
836
- readonly displayName?: string | undefined;
837
- readonly kind: "shwfed.component.form";
838
- readonly fields: readonly any[];
839
- readonly layouts: readonly {
840
- readonly name: string;
841
- readonly layout: {
842
- readonly style?: string | undefined;
843
- readonly columns: number;
844
- readonly gap?: number | undefined;
845
- readonly rows?: number | undefined;
846
- readonly placements: {
847
- readonly [x: string]: {
848
- readonly area: readonly [readonly [number, number], readonly [number, number]];
849
- readonly v?: "stretch" | "center" | "end" | "start" | undefined;
850
- readonly h?: "stretch" | "center" | "end" | "start" | undefined;
851
- };
852
- };
853
- };
854
- readonly media?: string | undefined;
855
- }[];
856
- readonly readonly?: string | undefined;
857
- } | undefined;
858
- dataSource?: {
859
- readonly data: string;
860
- readonly total?: string | undefined;
861
- readonly request?: string | undefined;
862
- } | undefined;
863
829
  actions?: {
864
830
  readonly size: "default" | "sm" | "xs";
865
831
  readonly style?: string | undefined;
@@ -927,6 +893,40 @@ export declare function createTableConfig(body: Omit<Schema.Schema.Type<ReturnTy
927
893
  readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
928
894
  }[];
929
895
  } | undefined;
896
+ query?: {
897
+ readonly style?: string | undefined;
898
+ readonly id?: string | undefined;
899
+ readonly initial?: {
900
+ readonly data: string;
901
+ readonly request?: string | undefined;
902
+ } | undefined;
903
+ readonly displayName?: string | undefined;
904
+ readonly kind: "shwfed.component.form";
905
+ readonly fields: readonly any[];
906
+ readonly layouts: readonly {
907
+ readonly name: string;
908
+ readonly layout: {
909
+ readonly style?: string | undefined;
910
+ readonly columns: number;
911
+ readonly gap?: number | undefined;
912
+ readonly rows?: number | undefined;
913
+ readonly placements: {
914
+ readonly [x: string]: {
915
+ readonly area: readonly [readonly [number, number], readonly [number, number]];
916
+ readonly v?: "stretch" | "center" | "end" | "start" | undefined;
917
+ readonly h?: "stretch" | "center" | "end" | "start" | undefined;
918
+ };
919
+ };
920
+ };
921
+ readonly media?: string | undefined;
922
+ }[];
923
+ readonly readonly?: string | undefined;
924
+ } | undefined;
925
+ dataSource?: {
926
+ readonly data: string;
927
+ readonly total?: string | undefined;
928
+ readonly request?: string | undefined;
929
+ } | undefined;
930
930
  bottomActions?: {
931
931
  readonly size: "default" | "sm" | "xs";
932
932
  readonly style?: string | undefined;
@@ -3,11 +3,14 @@ import { coerceFromString } from "../../../share/coerce-from-string.js";
3
3
  import { Expression, HttpRequestResult } from "../../../share/expression.js";
4
4
  import {
5
5
  defaultTableConfig,
6
+ metadata as tableMetadata,
6
7
  registerDataSourceRequestVars,
7
8
  registerDataSourceResponseVars
8
9
  } from "../schema.js";
10
+ import { metadata as formMetadata } from "../../form/schema.js";
9
11
  import { registerRowVariablesIfAbsent } from "./shared.js";
10
12
  import { activeColumns } from "./resolve.js";
13
+ import { createQueryFieldTools } from "../../form/utils/ai-field-tools.js";
11
14
  const HARNESS_KEYS = ["id", "groupId", "compatibilityDate"];
12
15
  function publicColumnSchema(entry, configure) {
13
16
  return entry.schema(configure).pipe(Schema.omit(...HARNESS_KEYS));
@@ -78,6 +81,16 @@ function safeJsonSchema(schema) {
78
81
  export function createTableAiTools(deps) {
79
82
  const dataSourceSchemas = buildDataSourceExpressionSchemas(deps.configure);
80
83
  const rowKeySchema = buildRowKeyExpressionSchema(deps.configure);
84
+ const queryFieldTools = createQueryFieldTools({
85
+ read: () => deps.read().query,
86
+ write: (next) => {
87
+ const working = deps.read();
88
+ working.query = next;
89
+ deps.write(working);
90
+ },
91
+ configure: deps.configure,
92
+ genUuid: deps.genUuid
93
+ });
81
94
  return [
82
95
  // ---- 信息获取 ----
83
96
  {
@@ -453,6 +466,42 @@ ${fieldErrors.map((e) => `- ${e}`).join("\n")}`;
453
466
  deps.write(working);
454
467
  return { enabled: working.pagination !== void 0, pagination: working.pagination ?? null };
455
468
  }
456
- }
469
+ },
470
+ {
471
+ name: "describe_event_targets",
472
+ description: "List the instances a button can dispatch operations to, and the operations each exposes \u2014 i.e. the valid `target` (an instance id) and `operation` for a button trigger (`{ target, operation }`). Use this to wire search-condition buttons: e.g. a \u641C\u7D22 button whose `event.dispatch` action dispatches `search` to the table, or a \u91CD\u7F6E button dispatching `reset-query`. A trigger's `target` MUST be one of the ids returned here. The table is always listed; the search-condition form is listed once it exists. Operation semantics (e.g. only `search` actually fetches; `reset-query` just prepares state) are explained in the guidance you were given.",
473
+ inputJsonSchema: {
474
+ type: "object",
475
+ properties: {},
476
+ additionalProperties: false
477
+ },
478
+ execute: () => {
479
+ const working = deps.read();
480
+ const targets = [];
481
+ const tableId = typeof working.id === "string" ? working.id : null;
482
+ const tableName = typeof working.displayName === "string" && working.displayName.length > 0 ? working.displayName : tableMetadata.name;
483
+ targets.push({
484
+ id: tableId,
485
+ kind: "table",
486
+ name: tableName,
487
+ operations: tableMetadata.operations.map((o) => ({ id: o.id, name: o.name })),
488
+ ...tableId === null ? { note: "This table has no id yet, so a button cannot target it reliably." } : {}
489
+ });
490
+ const query = working.query;
491
+ if (query) {
492
+ const queryId = typeof query.id === "string" ? query.id : null;
493
+ targets.push({
494
+ id: queryId,
495
+ kind: "queryForm",
496
+ name: "\u641C\u7D22\u6761\u4EF6\u8868\u5355",
497
+ operations: formMetadata.operations.map((o) => ({ id: o.id, name: o.name })),
498
+ ...queryId === null ? { note: "The query form has no id yet." } : {}
499
+ });
500
+ }
501
+ return targets;
502
+ }
503
+ },
504
+ // ---- 搜索条件(query = 一个 FormConfig;字段工具镜像列工具,放置为新增)----
505
+ ...queryFieldTools
457
506
  ];
458
507
  }
@@ -98,6 +98,7 @@ export declare function LocaleMarkdownWithRow(configure: (env: Environment) => v
98
98
  readonly locale: "en" | "ja" | "ko";
99
99
  readonly message: string;
100
100
  }[]], never>>;
101
+ export declare function CelDateDisable(configure: (env: Environment) => void): Schema.Schema<string, string, never>;
101
102
  export declare function derivedRowField(configure: (env: Environment) => void, resultType: ResultType): Schema.optional<Schema.Struct<{
102
103
  mode: Schema.Literal<["formula", "prefill"]>;
103
104
  expression: Schema.Schema<string, string, never>;
@@ -1,6 +1,7 @@
1
1
  import { Schema } from "effect";
2
2
  import { h } from "vue";
3
3
  import { SELECTIONS_VAR } from "../../../utils/cel-context.js";
4
+ import { DISABLE_DATE_RESULT, registerInputDateIfAbsent } from "../../../share/disabled-date.js";
4
5
  import { Expression, LocaleMarkdown } from "../../../share/expression.js";
5
6
  import { Locale } from "../../../share/locale.js";
6
7
  import { md } from "../../../share/markdown.js";
@@ -119,6 +120,15 @@ export function CelRowAccess(configure, options) {
119
120
  export function LocaleMarkdownWithRow(configure) {
120
121
  return LocaleMarkdown({ configure: configureWithRow(configure) });
121
122
  }
123
+ export function CelDateDisable(configure) {
124
+ return Expression({
125
+ configure: (env) => {
126
+ configureWithRow(configure)(env);
127
+ registerInputDateIfAbsent(env);
128
+ },
129
+ resultType: DISABLE_DATE_RESULT
130
+ });
131
+ }
122
132
  export function derivedRowField(configure, resultType) {
123
133
  return derivedField(configureWithRow(configure), resultType);
124
134
  }
@@ -14,7 +14,7 @@ const delegatedProps = reactiveOmit(props, "class");
14
14
  <template>
15
15
  <AlertDialogCancel
16
16
  v-bind="delegatedProps"
17
- :class="cn(buttonVariants(), 'mt-2 sm:mt-0', props.class)"
17
+ :class="cn(buttonVariants(), props.class)"
18
18
  >
19
19
  <slot />
20
20
  </AlertDialogCancel>
@@ -7,7 +7,11 @@ type __VLS_ModelProps = {
7
7
  modelValue?: string;
8
8
  };
9
9
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ declare var __VLS_21: {};
11
+ type __VLS_Slots = {} & {
12
+ actions?: (props: typeof __VLS_21) => any;
13
+ };
14
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
15
  stop: () => any;
12
16
  submit: () => any;
13
17
  "update:modelValue": (value: string) => any;
@@ -20,5 +24,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
20
24
  }>, {
21
25
  status: ChatStatus;
22
26
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
23
28
  declare const _default: typeof __VLS_export;
24
29
  export default _default;
30
+ type __VLS_WithSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -31,6 +31,16 @@ function onKeydown(e) {
31
31
  @keydown="onKeydown"
32
32
  />
33
33
  <InputGroupAddon align="block-end">
34
+ <!-- Host-supplied controls sit at the block-end's leading edge: `mr-auto`
35
+ pushes them hard left while the submit button keeps the trailing
36
+ (right) slot. Only rendered when the host fills the slot, so a bare
37
+ composer stays a lone right-aligned send button. -->
38
+ <div
39
+ v-if="$slots.actions"
40
+ class="mr-auto flex items-center gap-2"
41
+ >
42
+ <slot name="actions" />
43
+ </div>
34
44
  <ChatPromptSubmit
35
45
  :status="status"
36
46
  :disabled="!text.trim()"
@@ -7,7 +7,11 @@ type __VLS_ModelProps = {
7
7
  modelValue?: string;
8
8
  };
9
9
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ declare var __VLS_21: {};
11
+ type __VLS_Slots = {} & {
12
+ actions?: (props: typeof __VLS_21) => any;
13
+ };
14
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
15
  stop: () => any;
12
16
  submit: () => any;
13
17
  "update:modelValue": (value: string) => any;
@@ -20,5 +24,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
20
24
  }>, {
21
25
  status: ChatStatus;
22
26
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
23
28
  declare const _default: typeof __VLS_export;
24
29
  export default _default;
30
+ type __VLS_WithSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,34 @@
1
+ import type { Environment } from '../vendor/cel-js/lib/index.js';
2
+ import type { ResultType } from './expression.js';
3
+ /**
4
+ * Result-type matcher for a per-date "should this date be disabled" expression.
5
+ * The expression returns `true` to disable the candidate date; `false`/none/
6
+ * absent leave it enabled (matching reka-ui's native `isDateDisabled`). Accepts
7
+ * a bare `bool` (`input >= now`) as well as `optional<bool>`
8
+ * (`cond ? optional.of(true) : optional.none()`) — same leniency as
9
+ * `HttpRequestResult` in `share/expression.ts`. At runtime `cel()` unwraps
10
+ * `optional.none()` to `undefined`, which the predicate treats as "no opinion,
11
+ * keep the date enabled". `dyn`/`optional<dyn>` ride along for gradual typing.
12
+ */
13
+ export declare const DISABLE_DATE_RESULT: ResultType;
14
+ /**
15
+ * Register the `input` (Date) CEL variable — the candidate date the calendar is
16
+ * rendering — only when an enclosing `configure` hasn't already declared it. The
17
+ * CEL registry throws `'input' is already registered` on a duplicate, so the
18
+ * guard mirrors `registerRowVariablesIfAbsent` / `registerLoopVariablesIfAbsent`.
19
+ */
20
+ export declare function registerInputDateIfAbsent(env: Environment): void;
21
+ /**
22
+ * The `input` variable advertised to `ExpressionEditor` via its `extra-vars`
23
+ * prop, so completion offers it at design time. Pair with
24
+ * `DISABLE_DATE_EDITOR_RESULT` for the editor's `result-type` — the editor prop
25
+ * can't take a function matcher, so the array form mirrors `DISABLE_DATE_RESULT`.
26
+ */
27
+ export declare const INPUT_DATE_VARS: {
28
+ readonly input: {
29
+ readonly type: "Date";
30
+ readonly label: "候选日期";
31
+ readonly description: "日历中待判定是否可选的日期";
32
+ };
33
+ };
34
+ export declare const DISABLE_DATE_EDITOR_RESULT: readonly ["bool", "optional<bool>"];
@@ -0,0 +1,13 @@
1
+ export const DISABLE_DATE_RESULT = (t) => t === "bool" || t === "optional<bool>" || t === "optional<dyn>" || t === "dyn";
2
+ const INPUT_VAR_LABEL = "\u5019\u9009\u65E5\u671F";
3
+ const INPUT_VAR_DESCRIPTION = "\u65E5\u5386\u4E2D\u5F85\u5224\u5B9A\u662F\u5426\u53EF\u9009\u7684\u65E5\u671F";
4
+ export function registerInputDateIfAbsent(env) {
5
+ const declared = new Set(env.getDefinitions().variables.map((v) => v.name));
6
+ if (!declared.has("input")) {
7
+ env.registerVariable("input", "Date", { label: INPUT_VAR_LABEL, description: INPUT_VAR_DESCRIPTION });
8
+ }
9
+ }
10
+ export const INPUT_DATE_VARS = {
11
+ input: { type: "Date", label: INPUT_VAR_LABEL, description: INPUT_VAR_DESCRIPTION }
12
+ };
13
+ export const DISABLE_DATE_EDITOR_RESULT = ["bool", "optional<bool>"];
@@ -5,7 +5,7 @@ import { coerceFromString } from "../../share/coerce-from-string.js";
5
5
  const ENDPOINT = "http://192.168.168.10/anthropic/v1/messages";
6
6
  const MODEL = "MiniMax-M2.7";
7
7
  const ANTHROPIC_VERSION = "2023-06-01";
8
- const DEFAULT_MAX_TOKENS = 8192;
8
+ const DEFAULT_MAX_TOKENS = 32768;
9
9
  export class StructuredOutputDecodeError extends Error {
10
10
  rawOutput;
11
11
  constructor(rawOutput, cause) {
@@ -273,6 +273,8 @@ async function streamChat(input) {
273
273
  };
274
274
  const assistant = { id: createMessageId(), role: "assistant", parts: [] };
275
275
  const publish = () => input.onMessageUpdate?.(assistant);
276
+ const MAX_TRUNCATION_STREAK = 3;
277
+ let truncationStreak = 0;
276
278
  for (; ; ) {
277
279
  const partByIndex = /* @__PURE__ */ new Map();
278
280
  const response = await callStream(messages, input.system, opts, input.signal, () => {
@@ -313,8 +315,29 @@ async function streamChat(input) {
313
315
  (b) => b.type === "tool_use"
314
316
  );
315
317
  if (toolUses.length === 0) {
318
+ if (response.stop_reason === "max_tokens") {
319
+ if (truncationStreak >= MAX_TRUNCATION_STREAK) {
320
+ throw new Error("\u6A21\u578B\u8FDE\u7EED\u591A\u8F6E\u5728\u4EA7\u51FA\u524D\u7528\u5C3D token \u9884\u7B97\uFF08max_tokens\uFF09\uFF0C\u5DF2\u505C\u6B62\u3002\u8BF7\u7F29\u5C0F\u672C\u6B21\u914D\u7F6E\u8303\u56F4\u6216\u62C6\u5206\u6307\u4EE4\u540E\u91CD\u8BD5\u3002");
321
+ }
322
+ truncationStreak++;
323
+ const echoable = response.content.filter(
324
+ (b) => !(b.type === "text" && b.text.length === 0)
325
+ );
326
+ const assistantEcho = echoable.length > 0 ? echoable : [{ type: "text", text: "\u2026" }];
327
+ messages.push({ role: "assistant", content: assistantEcho });
328
+ messages.push({
329
+ role: "user",
330
+ content: "\u4E0A\u4E00\u8F6E\u5728 max_tokens \u5904\u88AB\u622A\u65AD\u3002\u8BF7\u7528\u66F4\u5C0F\u7684\u6B65\u5B50\u7EE7\u7EED\uFF1A\u672C\u8F6E\u53EA\u505A\u4E00\u6B65\uFF08\u4E00\u4E2A\u5DE5\u5177\u8C03\u7528\uFF0C\u6216\u4E00\u6BB5\u7B80\u77ED\u56DE\u590D\uFF09\u3002"
331
+ });
332
+ if (assistant.parts.length > 0) {
333
+ assistant.parts.push({ type: "step-start" });
334
+ publish();
335
+ }
336
+ continue;
337
+ }
316
338
  return assistant;
317
339
  }
340
+ truncationStreak = 0;
318
341
  await runToolResults(
319
342
  messages,
320
343
  response.content,
@@ -0,0 +1,26 @@
1
+ import type { DateValue } from 'reka-ui';
2
+ /**
3
+ * Convert an `@internationalized/date` `DateValue` (what the picker's
4
+ * `disabledDate` callback receives) to a native JS `Date`, so user expressions
5
+ * see a plain `input: Date`. Mirrors `pickerValueToNative` in
6
+ * `ui/date-picker/DatePicker.vue` (minus the `Time` branch — the per-date
7
+ * predicate never receives a `Time`). For a `CalendarDate` (date/month/year
8
+ * panels) the time fields are absent and default to `0`; for `month` panels the
9
+ * candidate is the first of the month (`day` is `1`).
10
+ */
11
+ export declare function dateValueToNative(d: DateValue): Date;
12
+ /**
13
+ * Build the `(d: DateValue) => boolean` predicate the date pickers expect from a
14
+ * user-authored CEL expression. Centralizes three concerns shared by every date
15
+ * block: the `DateValue` → native `Date` conversion, the "expression returns
16
+ * `true` ⇒ date disabled" mapping (`false`/`undefined`/none ⇒ enabled — matching
17
+ * reka-ui's native `isDateDisabled`), and error containment (a throwing
18
+ * expression leaves the date enabled).
19
+ *
20
+ * Each runtime passes its own `evalWithInput` closure so its existing CEL scope
21
+ * is preserved verbatim — form fields evaluate against `{ form, input }`, table
22
+ * columns against `celScope(celContext, { input })`. Returns `undefined` when
23
+ * there's no expression, so the picker omits the prop and all dates stay
24
+ * selectable.
25
+ */
26
+ export declare function makeDisabledDatePredicate(expr: string | undefined, evalWithInput: (input: Date) => boolean | undefined): ((d: DateValue) => boolean) | undefined;
@@ -0,0 +1,21 @@
1
+ export function dateValueToNative(d) {
2
+ return new Date(
3
+ d.year,
4
+ d.month - 1,
5
+ "day" in d ? d.day : 1,
6
+ "hour" in d ? d.hour : 0,
7
+ "hour" in d ? d.minute : 0,
8
+ "hour" in d ? d.second : 0
9
+ );
10
+ }
11
+ export function makeDisabledDatePredicate(expr, evalWithInput) {
12
+ if (!expr) return void 0;
13
+ return (d) => {
14
+ try {
15
+ return evalWithInput(dateValueToNative(d)) === true;
16
+ } catch (e) {
17
+ console.error("[shwfed] disabledDate expression failed", e);
18
+ return false;
19
+ }
20
+ };
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/config",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "description": "Configurable UI for SHWFED",
5
5
  "type": "module",
6
6
  "publishConfig": {