@shwfed/config 3.0.6 → 3.0.8
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/module.json +1 -1
- package/dist/runtime/components/actions/ai-l1.md +24 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.prototype/schema.d.ts +1 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.prototype/schema.js +2 -1
- package/dist/runtime/components/actions/buttons/2026-05-11/com.shwfed.actions.button.modal.layout/prompt.md +8 -0
- package/dist/runtime/components/actions/buttons/2026-05-11/com.shwfed.actions.button.modal.layout/schema.d.ts +6 -0
- package/dist/runtime/components/actions/buttons/2026-05-11/com.shwfed.actions.button.modal.layout/schema.js +4 -0
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/prompt.md +8 -0
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.d.ts +1 -0
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.js +2 -1
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/prompt.md +9 -0
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/schema.d.ts +1 -0
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/schema.js +2 -1
- package/dist/runtime/components/actions/buttons/2026-07-13/com.shwfed.actions.button.state.write/prompt.md +8 -0
- package/dist/runtime/components/actions/buttons/2026-07-13/com.shwfed.actions.button.state.write/schema.d.ts +1 -0
- package/dist/runtime/components/actions/buttons/2026-07-13/com.shwfed.actions.button.state.write/schema.js +2 -1
- package/dist/runtime/components/actions/config.vue +109 -3
- package/dist/runtime/components/actions/items/2026-05-21/com.shwfed.actions.item.markdown/schema.d.ts +1 -0
- package/dist/runtime/components/actions/items/2026-05-21/com.shwfed.actions.item.markdown/schema.js +2 -1
- package/dist/runtime/components/actions/utils/ai-button-tools.d.ts +29 -0
- package/dist/runtime/components/actions/utils/ai-button-tools.js +664 -0
- package/dist/runtime/components/actions/utils/resolve.d.ts +22 -0
- package/dist/runtime/components/actions/utils/resolve.js +23 -1
- package/dist/runtime/components/config/ai-generate.d.vue.ts +7 -0
- package/dist/runtime/components/config/ai-generate.system.md +39 -0
- package/dist/runtime/components/{table → config}/ai-generate.vue +55 -32
- package/dist/runtime/components/config/ai-generate.vue.d.ts +7 -0
- package/dist/runtime/components/config/ai-page-slot.l1.md +25 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.actions/schema.d.ts +6 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.actions/schema.js +4 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/schema.d.ts +6 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/schema.js +4 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/schema.d.ts +1 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/schema.js +1 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +44 -44
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +44 -44
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +44 -44
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +44 -44
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +28 -22
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.js +4 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.tabs/schema.d.ts +7 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.tabs/schema.js +4 -0
- package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.d.ts +1 -0
- package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.js +1 -0
- package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/schema.d.ts +1 -0
- package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/schema.js +1 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.d.ts +6 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.js +4 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/schema.d.ts +1 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/schema.js +1 -0
- package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/config.d.vue.ts +18 -18
- package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/config.vue.d.ts +18 -18
- package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/runtime.d.vue.ts +18 -18
- package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/runtime.vue.d.ts +18 -18
- package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/schema.d.ts +6 -0
- package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/schema.js +4 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/schema.d.ts +7 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/schema.js +4 -0
- package/dist/runtime/components/config/config.vue +24 -3
- package/dist/runtime/components/config/history-picker.vue +6 -4
- package/dist/runtime/components/config/prune-dialog.vue +15 -4
- package/dist/runtime/components/config/use-editor.d.ts +1 -0
- package/dist/runtime/components/config/use-editor.js +20 -2
- package/dist/runtime/components/config/utils/ai-cursor.d.ts +21 -0
- package/dist/runtime/components/config/utils/ai-cursor.js +827 -0
- package/dist/runtime/components/config/utils/ai-host-manuals.d.ts +2 -0
- package/dist/runtime/components/config/utils/ai-host-manuals.js +19 -0
- package/dist/runtime/components/config/utils/linkage.d.ts +15 -6
- package/dist/runtime/components/config/utils/linkage.js +23 -7
- package/dist/runtime/components/config/utils/resolve.d.ts +19 -0
- package/dist/runtime/components/config/utils/resolve.js +25 -2
- package/dist/runtime/components/form/ai-l1.md +22 -0
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.actions/schema.d.ts +7 -0
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.actions/schema.js +4 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/prompt.md +8 -0
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/schema.d.ts +7 -0
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/schema.js +4 -0
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.checkbox.group/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.checkbox.group/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.radio.group/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.radio.group/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/prompt.md +12 -0
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.d.ts +6 -0
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.js +4 -0
- package/dist/runtime/components/form/fields/2026-05-20/com.shwfed.form.field.collapsible/schema.d.ts +6 -0
- package/dist/runtime/components/form/fields/2026-05-20/com.shwfed.form.field.collapsible/schema.js +4 -0
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/prompt.md +7 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/prompt.md +7 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.d.vue.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue.d.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/prompt.md +9 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.d.vue.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue.d.ts +26 -26
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/prompt.md +11 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-06-09/com.shwfed.form.field.upload/prompt.md +12 -0
- package/dist/runtime/components/form/fields/2026-06-09/com.shwfed.form.field.upload/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-06-09/com.shwfed.form.field.upload/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/prompt.md +14 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/prompt.md +19 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/schema.js +1 -0
- package/dist/runtime/components/form/fields/2026-06-20/com.shwfed.form.field.tabs/schema.d.ts +7 -0
- package/dist/runtime/components/form/fields/2026-06-20/com.shwfed.form.field.tabs/schema.js +4 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/prompt.md +14 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/schema.js +1 -0
- package/dist/runtime/components/form/unit-config.vue +2 -2
- package/dist/runtime/components/form/utils/ai-field-tools.d.ts +2 -2
- package/dist/runtime/components/form/utils/ai-field-tools.js +47 -30
- package/dist/runtime/components/form/utils/resolve.d.ts +11 -0
- package/dist/runtime/components/form/utils/resolve.js +13 -1
- package/dist/runtime/components/operations/2026-06-09/com.shwfed.operation.alert/schema.d.ts +1 -0
- package/dist/runtime/components/operations/2026-06-09/com.shwfed.operation.alert/schema.js +2 -1
- package/dist/runtime/components/operations/2026-06-11/com.shwfed.operation.http.request.json/schema.d.ts +1 -0
- package/dist/runtime/components/operations/2026-06-11/com.shwfed.operation.http.request.json/schema.js +1 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.d.ts +1 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.js +2 -1
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/schema.d.ts +1 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/schema.js +2 -1
- package/dist/runtime/components/operations/2026-07-06/com.shwfed.operation.table.add-row/schema.d.ts +1 -0
- package/dist/runtime/components/operations/2026-07-06/com.shwfed.operation.table.add-row/schema.js +2 -1
- package/dist/runtime/components/operations/utils/resolve.d.ts +17 -0
- package/dist/runtime/components/operations/utils/resolve.js +18 -1
- package/dist/runtime/components/table/ai-l1.md +38 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.actions/schema.d.ts +7 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.actions/schema.js +5 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.date/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.date/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.icon/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.icon/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.markdown/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.markdown/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.number/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.number/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-05-21/com.shwfed.table.column.drag-handle/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-05-21/com.shwfed.table.column.drag-handle/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +8 -8
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +8 -8
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +8 -8
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +8 -8
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +8 -8
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +8 -8
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +8 -8
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +8 -8
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/prompt.md +12 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/schema.js +1 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/prompt.md +16 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/schema.js +1 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +8 -8
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +8 -8
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/schema.js +1 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +8 -8
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +8 -8
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/schema.js +1 -0
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/schema.js +2 -1
- package/dist/runtime/components/table/columns/2026-07-12/com.shwfed.table.column.dynamic/prompt.md +15 -0
- package/dist/runtime/components/table/config.d.vue.ts +3 -3
- package/dist/runtime/components/table/config.vue +3 -35
- package/dist/runtime/components/table/config.vue.d.ts +3 -3
- package/dist/runtime/components/table/row-provider.vue +7 -1
- package/dist/runtime/components/table/schema.d.ts +44 -44
- package/dist/runtime/components/table/utils/ai-tools.js +16 -7
- package/dist/runtime/components/table/utils/resolve.d.ts +5 -0
- package/dist/runtime/components/table/utils/resolve.js +12 -1
- package/dist/runtime/share/clipboard.d.ts +15 -9
- package/dist/runtime/share/clipboard.js +22 -10
- package/dist/runtime/share/define-registry.d.ts +66 -0
- package/dist/runtime/share/define-registry.js +37 -1
- package/dist/runtime/share/use-persisted-chat.d.ts +11 -9
- package/dist/runtime/share/use-persisted-chat.js +3 -3
- package/dist/runtime/utils/ai/index.d.ts +1 -1
- package/dist/runtime/utils/ai/index.js +18 -11
- package/dist/runtime/utils/cel-catalog.d.ts +1 -0
- package/dist/runtime/utils/cel-catalog.js +10 -0
- package/dist/runtime/utils/cel-catalog.md +42 -0
- package/dist/runtime/utils/cel-context.d.ts +15 -0
- package/dist/runtime/utils/cel-context.js +8 -0
- package/dist/runtime/vendor/cel-js/CLAUDE.md +7 -2
- package/dist/runtime/vendor/cel-js/PROMPT.md +27 -0
- package/dist/runtime/vendor/cel-js/lib/evaluator.js +2 -0
- package/dist/runtime/vendor/cel-js/lib/globals.d.ts +2 -0
- package/dist/runtime/vendor/cel-js/lib/globals.js +10 -0
- package/dist/runtime/vendor/cel-js/lib/map-builtins.d.ts +2 -0
- package/dist/runtime/vendor/cel-js/lib/map-builtins.js +80 -0
- package/dist/runtime/vendor/cel-js/lib/operators.js +2 -12
- package/package.json +1 -1
- package/dist/runtime/components/table/ai-generate.d.vue.ts +0 -16
- package/dist/runtime/components/table/ai-generate.system.md +0 -101
- package/dist/runtime/components/table/ai-generate.vue.d.ts +0 -16
- /package/dist/runtime/components/{table → config}/ai-generate.system.d.ts +0 -0
- /package/dist/runtime/components/{table → config}/ai-generate.system.js +0 -0
|
@@ -40,34 +40,46 @@ function buildIdMap(items) {
|
|
|
40
40
|
export function reidItems(items) {
|
|
41
41
|
return remap(items, buildIdMap(items));
|
|
42
42
|
}
|
|
43
|
-
export function reidFragment(
|
|
44
|
-
const map = buildIdMap(items);
|
|
43
|
+
export function reidFragment(fragment) {
|
|
44
|
+
const map = buildIdMap([...fragment.items, ...fragment.groups ?? []]);
|
|
45
45
|
return {
|
|
46
|
-
items: remap(items, map),
|
|
47
|
-
placements: placements ? remap(placements, map) : void 0
|
|
46
|
+
items: remap(fragment.items, map),
|
|
47
|
+
placements: fragment.placements ? remap(fragment.placements, map) : void 0,
|
|
48
|
+
groups: fragment.groups ? remap(fragment.groups, map) : void 0
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
export function serializeClip(surface,
|
|
51
|
-
return JSON.stringify({
|
|
51
|
+
export function serializeClip(surface, fragment) {
|
|
52
|
+
return JSON.stringify({
|
|
53
|
+
[CLIP_KEY]: CLIP_VERSION,
|
|
54
|
+
surface,
|
|
55
|
+
items: fragment.items,
|
|
56
|
+
placements: fragment.placements,
|
|
57
|
+
groups: fragment.groups
|
|
58
|
+
});
|
|
52
59
|
}
|
|
53
60
|
function isPlainObject(v) {
|
|
54
61
|
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
55
62
|
}
|
|
63
|
+
const SURFACES = ["form", "block", "table", "actions"];
|
|
64
|
+
function isSurface(v) {
|
|
65
|
+
return typeof v === "string" && SURFACES.includes(v);
|
|
66
|
+
}
|
|
56
67
|
export function parseClip(text) {
|
|
57
68
|
try {
|
|
58
69
|
const o = JSON.parse(text);
|
|
59
70
|
if (!o || o[CLIP_KEY] !== CLIP_VERSION) return null;
|
|
60
|
-
if (o.surface
|
|
71
|
+
if (!isSurface(o.surface)) return null;
|
|
61
72
|
if (!Array.isArray(o.items)) return null;
|
|
62
73
|
const placements = isPlainObject(o.placements) ? o.placements : void 0;
|
|
63
|
-
|
|
74
|
+
const groups = Array.isArray(o.groups) ? o.groups : void 0;
|
|
75
|
+
return { surface: o.surface, items: o.items, placements, groups };
|
|
64
76
|
} catch {
|
|
65
77
|
return null;
|
|
66
78
|
}
|
|
67
79
|
}
|
|
68
|
-
export async function writeClip(surface,
|
|
80
|
+
export async function writeClip(surface, fragment) {
|
|
69
81
|
try {
|
|
70
|
-
await navigator.clipboard.writeText(serializeClip(surface,
|
|
82
|
+
await navigator.clipboard.writeText(serializeClip(surface, fragment));
|
|
71
83
|
return true;
|
|
72
84
|
} catch {
|
|
73
85
|
return false;
|
|
@@ -1,4 +1,40 @@
|
|
|
1
1
|
import type { Component } from 'vue';
|
|
2
|
+
import type { Schema } from 'effect';
|
|
3
|
+
type AnySchema = Schema.Schema<any, any, any>;
|
|
4
|
+
/**
|
|
5
|
+
* A recursion edge: a schema field on this block/host that embeds ANOTHER
|
|
6
|
+
* host's config (a table's `TableConfig`, a container's `Slot`, an actions
|
|
7
|
+
* bar's `ActionsConfig`…). Declared next to the schema — NEVER in a central
|
|
8
|
+
* table (that switch would be the drift class CLAUDE.md bans) — and aggregated
|
|
9
|
+
* by the registry so the AI scope cursor can walk them (`config/utils/ai-cursor`).
|
|
10
|
+
*
|
|
11
|
+
* - `key` — the schema field holding the embedded config. Validated at registry
|
|
12
|
+
* load (see `buildSchemaForEdges`): the declared key MUST be a real top-level
|
|
13
|
+
* field on the block's schema, exactly like the type/date drift checks.
|
|
14
|
+
* - `host` — the host kind whose tool family configures that subtree
|
|
15
|
+
* (`table` / `form` / `actions` / `slot`). The cursor maps this to a family;
|
|
16
|
+
* hosts with no family yet stay declared-but-not-enterable (Phase C).
|
|
17
|
+
* - `label` — designer-facing crumb for the edge (breadcrumb / orientation).
|
|
18
|
+
* - `itemSlot` — set when `key` is an ARRAY of items and the embedded host
|
|
19
|
+
* config lives at `item[itemSlot]` on each element (tabs: `key: 'tabs'`,
|
|
20
|
+
* `itemSlot: 'slot'`). Absent → `key` holds the embedded config directly.
|
|
21
|
+
* - `self` — set when the embedded host config is NOT under a sub-field but the
|
|
22
|
+
* record ITSELF (its fields spread the embedded host's fields, as `field.actions`
|
|
23
|
+
* / `column.actions` spread `ActionSchemaFields` at the top level). `key` still
|
|
24
|
+
* names a real field (for the load-time existence check), but the cursor bridges
|
|
25
|
+
* the whole record and the family merges its keys back (`config/utils/ai-cursor`).
|
|
26
|
+
* - `celScope` — names a per-edge CEL scope extension the cursor threads into the
|
|
27
|
+
* child frame's `configure` when entering (`loop-item` → `item`/`index`). Absent
|
|
28
|
+
* → the child inherits the parent scope unchanged. See design §5.
|
|
29
|
+
*/
|
|
30
|
+
export type RegistryEdge = Readonly<{
|
|
31
|
+
key: string;
|
|
32
|
+
host: string;
|
|
33
|
+
label: string;
|
|
34
|
+
itemSlot?: string;
|
|
35
|
+
self?: boolean;
|
|
36
|
+
celScope?: string;
|
|
37
|
+
}>;
|
|
2
38
|
/**
|
|
3
39
|
* Minimum shape every host's schema module must satisfy. Hosts extend this
|
|
4
40
|
* with their own metadata / capability fields via the generic.
|
|
@@ -6,6 +42,13 @@ import type { Component } from 'vue';
|
|
|
6
42
|
export type RegistryModuleBase = Readonly<{
|
|
7
43
|
type: string;
|
|
8
44
|
compatibilityDate: string;
|
|
45
|
+
/**
|
|
46
|
+
* Optional recursion-edge declarations — a block/host embedding another
|
|
47
|
+
* host's config lists them here (see `RegistryEdge`). Validated at load when
|
|
48
|
+
* the host supplies `buildSchemaForEdges`; otherwise carried through
|
|
49
|
+
* unvalidated. Absent for leaf and generator entries.
|
|
50
|
+
*/
|
|
51
|
+
edges?: ReadonlyArray<RegistryEdge>;
|
|
9
52
|
}>;
|
|
10
53
|
/**
|
|
11
54
|
* Per-entry shape produced by the factory before host-specific extras are
|
|
@@ -18,6 +61,8 @@ export type RegistryDraft<TModule extends RegistryModuleBase> = Readonly<{
|
|
|
18
61
|
config: Component;
|
|
19
62
|
runtime: Component;
|
|
20
63
|
module: TModule;
|
|
64
|
+
/** The sibling `prompt.md`'s raw text (L2 fragment), when one exists. */
|
|
65
|
+
prompt?: string;
|
|
21
66
|
}>;
|
|
22
67
|
export type RegistryOptions<TModule extends RegistryModuleBase, TEntryExtras extends object> = Readonly<{
|
|
23
68
|
/** Error-message prefix, e.g. `shwfed-form`. */
|
|
@@ -30,12 +75,30 @@ export type RegistryOptions<TModule extends RegistryModuleBase, TEntryExtras ext
|
|
|
30
75
|
configModules: Record<string, Component>;
|
|
31
76
|
/** Eager `import.meta.glob` over the host's runtime.vue files (default import). */
|
|
32
77
|
runtimeModules: Record<string, Component>;
|
|
78
|
+
/**
|
|
79
|
+
* Optional eager `import.meta.glob` over the host's sibling `prompt.md` files
|
|
80
|
+
* ({ query: '?raw', import: 'default', eager: true }), keyed by path exactly
|
|
81
|
+
* like `schemaModules`. Each entry's `prompt` is looked up from here by the
|
|
82
|
+
* same folder-suffix match. `prompt.md` is OPTIONAL per folder — an absent one
|
|
83
|
+
* leaves `entry.prompt` undefined. No dist extension tolerance is needed
|
|
84
|
+
* (unlike `schema.{ts,js}`): `@nuxt/module-builder` transpiles `.ts`→`.js` but
|
|
85
|
+
* copies `.md` verbatim, so the `.md` suffix is stable in source and `dist`.
|
|
86
|
+
*/
|
|
87
|
+
promptModules?: Record<string, string>;
|
|
33
88
|
/**
|
|
34
89
|
* Optional per-module validation beyond the type/date drift checks. Throw
|
|
35
90
|
* to fail at module load. Used by table to require `toColumnDef`
|
|
36
91
|
* to be a function.
|
|
37
92
|
*/
|
|
38
93
|
validateModule?: (mod: TModule, type: string, date: string) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Optional builder that constructs a module's schema with INERT args (a
|
|
96
|
+
* no-op configure, a stand-in `blockRef`) purely so the registry can verify
|
|
97
|
+
* every declared `edges[].key` is a real top-level field on it — the
|
|
98
|
+
* edge-declaration analog of the type/date drift check. Only invoked for
|
|
99
|
+
* modules that declare `edges`. Omit → edges are carried through unvalidated.
|
|
100
|
+
*/
|
|
101
|
+
buildSchemaForEdges?: (mod: TModule) => AnySchema;
|
|
39
102
|
/**
|
|
40
103
|
* Optional predicate deciding whether a given module may ship WITHOUT a
|
|
41
104
|
* sibling `runtime.vue`. Returns true → the runtime lookup is tolerant and
|
|
@@ -60,9 +123,12 @@ export type RegistryEntry<TModule extends RegistryModuleBase, TEntryExtras exten
|
|
|
60
123
|
config: Component;
|
|
61
124
|
runtime: Component;
|
|
62
125
|
module: TModule;
|
|
126
|
+
/** The sibling `prompt.md`'s raw text (L2 fragment), when one exists. */
|
|
127
|
+
prompt?: string;
|
|
63
128
|
} & TEntryExtras>;
|
|
64
129
|
export type Registry<TModule extends RegistryModuleBase, TEntryExtras extends object> = Readonly<{
|
|
65
130
|
ENTRIES: ReadonlyArray<RegistryEntry<TModule, TEntryExtras>>;
|
|
66
131
|
find: (type: string, compatibilityDate: string) => RegistryEntry<TModule, TEntryExtras> | undefined;
|
|
67
132
|
}>;
|
|
68
133
|
export declare function defineRegistry<TModule extends RegistryModuleBase, TEntryExtras extends object = Record<never, never>>(options: RegistryOptions<TModule, TEntryExtras>): Registry<TModule, TEntryExtras>;
|
|
134
|
+
export {};
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
function topLevelFieldNames(schema) {
|
|
2
|
+
const unwrap = (ast) => {
|
|
3
|
+
switch (ast._tag) {
|
|
4
|
+
case "TypeLiteral":
|
|
5
|
+
return ast;
|
|
6
|
+
case "Transformation":
|
|
7
|
+
return unwrap(ast.to);
|
|
8
|
+
case "Refinement":
|
|
9
|
+
return unwrap(ast.from);
|
|
10
|
+
case "Suspend":
|
|
11
|
+
return unwrap(ast.f());
|
|
12
|
+
default:
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const tl = unwrap(schema.ast);
|
|
17
|
+
return tl ? tl.propertySignatures.map((p) => String(p.name)) : [];
|
|
18
|
+
}
|
|
1
19
|
export function defineRegistry(options) {
|
|
2
20
|
const {
|
|
3
21
|
hostName,
|
|
@@ -5,7 +23,9 @@ export function defineRegistry(options) {
|
|
|
5
23
|
schemaModules,
|
|
6
24
|
configModules,
|
|
7
25
|
runtimeModules,
|
|
26
|
+
promptModules,
|
|
8
27
|
validateModule,
|
|
28
|
+
buildSchemaForEdges,
|
|
9
29
|
runtimeOptional,
|
|
10
30
|
deriveEntryExtras
|
|
11
31
|
} = options;
|
|
@@ -27,6 +47,18 @@ export function defineRegistry(options) {
|
|
|
27
47
|
if (found === void 0) throw new Error(`[${hostName}] missing ${file} for ${type}@${date}`);
|
|
28
48
|
return found;
|
|
29
49
|
};
|
|
50
|
+
const validateEdges = (mod, type, date) => {
|
|
51
|
+
const edges = mod.edges;
|
|
52
|
+
if (!edges || edges.length === 0 || !buildSchemaForEdges) return;
|
|
53
|
+
const fields = new Set(topLevelFieldNames(buildSchemaForEdges(mod)));
|
|
54
|
+
for (const edge of edges) {
|
|
55
|
+
if (!fields.has(edge.key)) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`[${hostName}] edge key "${edge.key}" declared on "${type}@${date}" is not a field on its schema (has: ${[...fields].join(", ") || "<none>"})`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
30
62
|
let cached = null;
|
|
31
63
|
const compute = () => {
|
|
32
64
|
if (cached) return cached;
|
|
@@ -40,13 +72,16 @@ export function defineRegistry(options) {
|
|
|
40
72
|
throw new Error(`[${hostName}] compatibilityDate "${mod.compatibilityDate}" does not match folder "${date}"`);
|
|
41
73
|
}
|
|
42
74
|
validateModule?.(mod, type, date);
|
|
75
|
+
validateEdges(mod, type, date);
|
|
43
76
|
const runtime = runtimeOptional?.(mod) ? findSiblingOptional(runtimeModules, date, type, "runtime.vue") : findSibling(runtimeModules, date, type, "runtime.vue");
|
|
44
77
|
drafts.push({
|
|
45
78
|
type: mod.type,
|
|
46
79
|
compatibilityDate: mod.compatibilityDate,
|
|
47
80
|
config: findSibling(configModules, date, type, "config.vue"),
|
|
48
81
|
runtime,
|
|
49
|
-
module: mod
|
|
82
|
+
module: mod,
|
|
83
|
+
// `prompt.md` is optional per folder; absent → undefined.
|
|
84
|
+
...promptModules ? { prompt: findSiblingOptional(promptModules, date, type, "prompt.md") } : {}
|
|
50
85
|
});
|
|
51
86
|
}
|
|
52
87
|
const mapExtras = deriveEntryExtras ? deriveEntryExtras(drafts) : () => ({});
|
|
@@ -56,6 +91,7 @@ export function defineRegistry(options) {
|
|
|
56
91
|
config: draft.config,
|
|
57
92
|
runtime: draft.runtime,
|
|
58
93
|
module: draft.module,
|
|
94
|
+
...draft.prompt !== void 0 ? { prompt: draft.prompt } : {},
|
|
59
95
|
...mapExtras(draft)
|
|
60
96
|
}));
|
|
61
97
|
return cached;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
2
|
import type { UIMessage } from '../utils/ai/parts.js';
|
|
3
3
|
/**
|
|
4
|
-
* Mirrors
|
|
5
|
-
*
|
|
6
|
-
* component unmounting — switching away from the
|
|
7
|
-
* unmounts
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* Mirrors an AI-chat history into `sessionStorage`, keyed on a stable id (the
|
|
5
|
+
* top-level config panel uses `location.pathname`), so the conversation survives
|
|
6
|
+
* both the chat component unmounting — switching away from the AI view
|
|
7
|
+
* `v-if`-unmounts it, dropping its local `ref<UIMessage[]>` — and a page reload.
|
|
8
|
+
* It clears when the browser tab is closed (`sessionStorage` lifetime), giving a
|
|
9
|
+
* per-instance, session-scoped chat memory. (Originally built for the table AI
|
|
10
|
+
* panel, removed in Phase C; now serves the top-level `config/ai-generate.vue`.)
|
|
10
11
|
*
|
|
11
12
|
* Modeled on `usePersistedQuery`: every access is SSR-guarded and guarded
|
|
12
|
-
* against unavailable storage (privacy modes). With no `tableId()`
|
|
13
|
-
*
|
|
13
|
+
* against unavailable storage (privacy modes). With no `tableId()` (the key
|
|
14
|
+
* getter — a misnomer kept from its table origin) persistence is a no-op
|
|
15
|
+
* (in-memory only) so id-less drafts can't collide on a shared key.
|
|
14
16
|
*
|
|
15
17
|
* - `restore()` seeds `messages` from the stored snapshot. Call it in
|
|
16
18
|
* `onMounted`, after the fresh component's empty ref exists, so a remount
|
|
@@ -24,7 +26,7 @@ import type { UIMessage } from '../utils/ai/parts.js';
|
|
|
24
26
|
* replays history as prose only (`partsToText` in `utils/ai`), so a continued
|
|
25
27
|
* conversation never re-sends a dangling tool_use across the restore boundary.
|
|
26
28
|
*/
|
|
27
|
-
export declare function usePersistedChat(tableId: () => string | undefined, messages: Ref<UIMessage[]
|
|
29
|
+
export declare function usePersistedChat(tableId: () => string | undefined, messages: Ref<UIMessage[]>, keyPrefix?: string): {
|
|
28
30
|
restore: () => void;
|
|
29
31
|
clear: () => void;
|
|
30
32
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { watch } from "vue";
|
|
2
2
|
const STORAGE_PREFIX = "shwfed.table.ai-chat.";
|
|
3
|
-
export function usePersistedChat(tableId, messages) {
|
|
4
|
-
const key = () => `${
|
|
3
|
+
export function usePersistedChat(tableId, messages, keyPrefix = STORAGE_PREFIX) {
|
|
4
|
+
const key = () => `${keyPrefix}${tableId()}`;
|
|
5
5
|
const active = () => Boolean(tableId()) && typeof window !== "undefined";
|
|
6
6
|
function restore() {
|
|
7
7
|
if (!active()) return;
|
|
@@ -18,7 +18,7 @@ export function usePersistedChat(tableId, messages) {
|
|
|
18
18
|
const id = tableId();
|
|
19
19
|
if (!id) return;
|
|
20
20
|
try {
|
|
21
|
-
window.sessionStorage.removeItem(`${
|
|
21
|
+
window.sessionStorage.removeItem(`${keyPrefix}${id}`);
|
|
22
22
|
} catch {
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -31,7 +31,7 @@ export interface GenerateObjectInput<A, I extends Record<string, unknown>> {
|
|
|
31
31
|
export interface StreamChatInput {
|
|
32
32
|
readonly messages: ReadonlyArray<UIMessage>;
|
|
33
33
|
readonly system?: string;
|
|
34
|
-
readonly tools?: ReadonlyArray<AgenticTool
|
|
34
|
+
readonly tools?: ReadonlyArray<AgenticTool> | (() => ReadonlyArray<AgenticTool>);
|
|
35
35
|
readonly signal?: AbortSignal;
|
|
36
36
|
readonly maxTokens?: number;
|
|
37
37
|
readonly onMessageUpdate?: (assistant: UIMessage) => void;
|
|
@@ -257,25 +257,32 @@ function partsToText(parts) {
|
|
|
257
257
|
return parts.filter((p) => p.type === "text").map((p) => p.text).join("");
|
|
258
258
|
}
|
|
259
259
|
async function streamChat(input) {
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
})) : void 0;
|
|
260
|
+
const readTools = (() => {
|
|
261
|
+
const t = input.tools;
|
|
262
|
+
if (typeof t === "function") return t;
|
|
263
|
+
const arr = t ?? [];
|
|
264
|
+
return () => arr;
|
|
265
|
+
})();
|
|
267
266
|
const messages = input.messages.map(
|
|
268
267
|
(m) => ({ role: m.role, content: partsToText(m.parts) })
|
|
269
268
|
);
|
|
270
|
-
const
|
|
271
|
-
...tools !== void 0 ? { tools } : {},
|
|
272
|
-
...input.maxTokens !== void 0 ? { maxTokens: input.maxTokens } : {}
|
|
273
|
-
};
|
|
269
|
+
const maxTokensOpt = input.maxTokens !== void 0 ? { maxTokens: input.maxTokens } : {};
|
|
274
270
|
const assistant = { id: createMessageId(), role: "assistant", parts: [] };
|
|
275
271
|
const publish = () => input.onMessageUpdate?.(assistant);
|
|
276
272
|
const MAX_TRUNCATION_STREAK = 3;
|
|
277
273
|
let truncationStreak = 0;
|
|
278
274
|
for (; ; ) {
|
|
275
|
+
const helperTools = readTools();
|
|
276
|
+
const helperByName = new Map(helperTools.map((t) => [t.name, t]));
|
|
277
|
+
const anthropicTools = helperTools.length > 0 ? helperTools.map((t) => ({
|
|
278
|
+
name: t.name,
|
|
279
|
+
description: t.description,
|
|
280
|
+
input_schema: t.inputJsonSchema
|
|
281
|
+
})) : void 0;
|
|
282
|
+
const opts = {
|
|
283
|
+
...anthropicTools !== void 0 ? { tools: anthropicTools } : {},
|
|
284
|
+
...maxTokensOpt
|
|
285
|
+
};
|
|
279
286
|
const partByIndex = /* @__PURE__ */ new Map();
|
|
280
287
|
const response = await callStream(messages, input.system, opts, input.signal, () => {
|
|
281
288
|
}, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCelCatalog(): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import rawCatalog from "./cel-catalog.md?raw";
|
|
2
|
+
let catalog = rawCatalog;
|
|
3
|
+
if (import.meta.hot) {
|
|
4
|
+
import.meta.hot.accept("./cel-catalog.md?raw", (mod) => {
|
|
5
|
+
if (typeof mod?.default === "string") catalog = mod.default;
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export function getCelCatalog() {
|
|
9
|
+
return catalog;
|
|
10
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
CEL(Common Expression Language)是一门小而安全的**单表达式**语言:没有语句、赋值、循环或函数定义,整段表达式求值为一个值。以下是本项目可用的操作符与函数速查(完整语义见字段级注解与实际类型检查报错)。
|
|
2
|
+
|
|
3
|
+
## 类型
|
|
4
|
+
|
|
5
|
+
`number`(任意精度小数,无 int/float 之分)、`string`(单双引号,`'''多行'''`,`r'原始'`)、`bool`、`bytes`、`null`、`list`、`map`、`Date`(`date('2023-01-15')` 或 `date(unixSeconds)`)。
|
|
6
|
+
|
|
7
|
+
## 操作符
|
|
8
|
+
|
|
9
|
+
- 算术:`+ - * / %`、一元 `-`(仅 `number`;`/` 保留 20 位有效数字,勿用 `==` 直接比较除法结果)。
|
|
10
|
+
- 比较:`== != < <= > >=`(对 list/map 深比较)。
|
|
11
|
+
- 逻辑:`&& || !`(短路)。
|
|
12
|
+
- 三元:`cond ? a : b`。
|
|
13
|
+
- 成员:`x in [列表]`、`key in {映射}`。
|
|
14
|
+
- 拼接:字符串 / 列表用 `+`;`[...a, x]` / `{...a, "k": v}` 展开(后写覆盖先写)。
|
|
15
|
+
- 字段访问:`obj.field`、`obj["field"]`;**可选访问** `obj.?field`、`obj[?0]`(返回 `optional`,字段可能缺失时优先用)。
|
|
16
|
+
|
|
17
|
+
## Optional(可选值,`.?` 会产生)
|
|
18
|
+
|
|
19
|
+
`optional.of(x)` / `optional.ofNullable(x)`(null→None)/ `optional.none()`;`o.orValue(默认值)`(取值或默认)、`o.or(其他optional)`、`o.hasValue()`、`o.value()`;`o.map(v, 表达式)`、`o.flatMap(v, optional)`、`o.filter(v, 布尔)`、`o.exists(v, 布尔)`。典型:`row.?amount.orValue(0)`。
|
|
20
|
+
|
|
21
|
+
## 常用函数
|
|
22
|
+
|
|
23
|
+
- 类型转换:`number(x)`、`string(x)`、`bool(x)`、`type(x)`、`dyn(x)`。无 `int()`,取整用 `math.trunc/floor/ceil/round`。
|
|
24
|
+
- 数学:`math.trunc/floor/ceil/round/abs(n)`、`math.min/max(a, b)` 或 `math.min/max(list)`。
|
|
25
|
+
- 字符串(方法):`s.size()`、`s.contains(x)`、`s.startsWith/endsWith(x)`、`s.matches(正则)`、`s.substring(i[, j])`、`s.split(sep)`、`s.trim()`、`s.replace(from, to[, limit])`、`s.lowerAscii()/upperAscii()`。
|
|
26
|
+
- 列表(宏 / 方法):`l.size()`、`l.map(x, 表达式)`、`l.filter(x, 布尔)`、`l.all(x, 布尔)`、`l.exists(x, 布尔)`、`l.exists_one(x, 布尔)`、`l.enumerate()`(→ `{index, value}` 列表)、`l.slice(i[, j])`(支持负索引)。
|
|
27
|
+
- 映射:`Map.fromList(pairs)` / `Map.toList(m)`(pair 为 `{key, value}`,是从数据构建 map 的唯一方式)。
|
|
28
|
+
- JSON:`JSON.parse(s)`、`JSON.stringify(x)`。
|
|
29
|
+
- 日期:`date(...)`、`d.get('year'|'month'(1基)|'day'|'hour'|...)`、`d.diff(other, unit)`(有符号,受者为被减数)、`d.offset(n, unit)`、`d.startOf/endOf(unit)`、`d.format(...)`、`Date.tz(...)`。
|
|
30
|
+
- 区间:`range(a, b[, step])`、`range(startDate, endDate, unit)`(右开)。
|
|
31
|
+
|
|
32
|
+
## HTTP(构建请求,不发起)
|
|
33
|
+
|
|
34
|
+
CEL 只**构建** `HttpRequest`,由宿主发起。链式:
|
|
35
|
+
```cel
|
|
36
|
+
http.get(hostname + '/path') // 或 .post / .put / .delete;端点须为绝对 URL,用 hostname 变量,勿写 {{env}}
|
|
37
|
+
.header('Content-Type', 'application/json')
|
|
38
|
+
.query(query) // query = 全部搜索条件;放在最前
|
|
39
|
+
.query('key', value) // 值可为 string | number | optional<...>(None 则不追加该参数)
|
|
40
|
+
.body({ ... }) // POST/PUT 请求体
|
|
41
|
+
```
|
|
42
|
+
`form({...})` 构建 `FormData`(文件上传:`.body(form({"file": f, "name": "a"}))`)。
|
|
@@ -6,6 +6,21 @@ export type CELVar = {
|
|
|
6
6
|
value: unknown;
|
|
7
7
|
};
|
|
8
8
|
export type CELContext = Record<string, CELVar>;
|
|
9
|
+
/**
|
|
10
|
+
* A compact CEL scope entry for AI tool output — `name` + `type`, plus the
|
|
11
|
+
* designer-facing `label` / `description` when they add anything. Flattens a
|
|
12
|
+
* `CELContext` (whose `value` thunks are irrelevant to the model) into the
|
|
13
|
+
* variable table `describe_*_settings` hands the agent alongside the function
|
|
14
|
+
* catalog. Same probed source the ExpressionEditor advertises, so the two can't
|
|
15
|
+
* drift.
|
|
16
|
+
*/
|
|
17
|
+
export type CELScopeEntry = {
|
|
18
|
+
name: string;
|
|
19
|
+
type: string;
|
|
20
|
+
label?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function renderCelScope(context: CELContext): CELScopeEntry[];
|
|
9
24
|
export declare const SCOPE_ADDRESS_VAR = "__scopes__";
|
|
10
25
|
export declare const SELECTIONS_VAR = "selections";
|
|
11
26
|
export declare const OPTIONS_VAR = "options";
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { computed, inject, provide, shallowRef } from "vue";
|
|
2
2
|
import { injectLocal, provideLocal } from "@vueuse/core";
|
|
3
|
+
export function renderCelScope(context) {
|
|
4
|
+
return Object.entries(context).map(([name, v]) => ({
|
|
5
|
+
name,
|
|
6
|
+
type: v.type,
|
|
7
|
+
...v.label && v.label !== name ? { label: v.label } : {},
|
|
8
|
+
...v.description ? { description: v.description } : {}
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
3
11
|
export const SCOPE_ADDRESS_VAR = "__scopes__";
|
|
4
12
|
export const SELECTIONS_VAR = "selections";
|
|
5
13
|
export const OPTIONS_VAR = "options";
|
|
@@ -33,6 +33,10 @@ The `__proto__` / `constructor` / `prototype` keys are skipped on the top-level
|
|
|
33
33
|
|
|
34
34
|
A `JSON` built-in namespace has been added (`json-builtins.ts`) — not from upstream. It registers a `JSON` brand class and a same-named constant on `globalRegistry`, so `JSON.parse(string): dyn` and `JSON.stringify(dyn): string` resolve in every `Environment`. The CEL-side surface mirrors the JS globals deliberately. `JSON.parse` is a thin wrapper over `globalThis.JSON.parse` — numbers come back as plain JS `number` (the evaluator coerces via `Decimal.from` at use time). `JSON.stringify` pre-walks the value via `normalizeForJSON` before handing it to `globalThis.JSON.stringify`: `Decimal` → JS number (via `.toNumber()` — loses precision past safe-integer range, deliberate trade-off for idiomatic JSON output), `Option.Some(x)` → `x`, `Option.None` → `null`, `Map` → plain object, `Date`/`TZDate` passes through so its built-in `toJSON` emits ISO 8601. The pre-walk is required because Effect's `Option` defines its own `toJSON()` that runs before any replacer would see it.
|
|
35
35
|
|
|
36
|
+
A `Map` built-in namespace has been added (`map-builtins.ts`) — not from upstream. It registers a `Map` brand class and a same-named constant on `globalRegistry`, so `Map.fromList(list<dyn>): map<dyn, dyn>` and `Map.toList(map<dyn, dyn>): list<map<string, dyn>>` resolve in every `Environment`. This is the only way to *build* a map from data: the `map` macro always yields a list, and spread only accepts a map source, so before this there was no fold from list to map (the JSON round-trip `JSON.parse("{" + rows.map(...).join(",") + "}")` was the only workaround, and it flattens `Decimal` and `Date`). The naming follows Haskell's `Data.Map.fromList` / `toList` rather than a bespoke `toMap` binding macro, because the transform half already exists — `Map.fromList(rows.map(r, {"key": r.name, "value": r.qty}))` composes it. Capitalized to stay clear of the `map` type name and the `map` macro, following `JSON`. A pair is a `{key, value}` record (CEL has no tuple type — the same convention as `list.enumerate()`'s `{index, value}`). Both are plain functions, not macros, so there is no comprehension/accumulator surgery: `fromList` validates each entry and funnels the pairs through the shared `safeFromEntries`, which is what makes a number key stringify *identically* to a map literal's (the plain-object write is the same one `#getMapField` reads back). Both fields are required per entry — a half-pair `{"key": "a"}` throws `invalid_map_entry` rather than storing `undefined` (an explicit `null` value stays legal, via `hasOwn`); keys must be string / number / bool, since `fromList` is the one place a *dyn* key can be checked at all, and an object key would otherwise silently stringify to `"[object Object]"`; duplicate keys are last-wins, which falls out of `safeFromEntries` and coincides with `Data.Map.fromList`'s `foldl insert`. `isRecord` must check the prototype (plain object or `Map`), not just `typeof === 'object'` — `Decimal` / `Date` / `File` are all objects, and without it `Map.fromList([1, 2])` would report a missing `key` field instead of a non-record entry. The handlers' non-list / non-map guards are defensive: overload resolution runs on the *runtime* type, so a non-map reaches neither handler even through a `dyn` expression.
|
|
37
|
+
|
|
38
|
+
`safeFromEntries` and the `__proto__` / `constructor` / `prototype` skip set (`FORBIDDEN_KEYS`) live in `globals.ts`, not `operators.ts` — `map-builtins.ts` needs them and `globals.ts` is the leaf module, so importing from `operators.ts` would have created a cycle. Map literals, map spread (which had its own copy of the set, `SPREAD_SKIP_KEYS`) and `Map.fromList` all funnel through them.
|
|
39
|
+
|
|
36
40
|
Spread syntax (`...expr`) inside list and map literals — not from upstream. A new `ELLIPSIS` token (3-char lookahead in the lexer) and a `spread` AST op let `[1, ...a, 4]` and `{...a, "x": 1, ...b}` desugar inside the parent literal. The spread node's own `check`/`evaluate` are defensive stubs — `parsePrimary` never produces one, so `...` outside a list/map is an "unexpected token" parse error. List `args` shape is unchanged (`IASTNode[]`, with spread elements detected via `op === 'spread'`); map `args` becomes `([IASTNode, IASTNode] | [IASTNode])[]` — a length-1 tuple represents a spread entry, preserving positional ordering for override semantics (later writes win). The fast path is preserved: the `list`/`map` `check` swaps `evaluate` meta to `evaluateSpreadList`/`evaluateSpreadMap` only when a spread child is present; literals without spreads run the original `resolveAstArray`/`safeFromEntries` paths byte-for-byte. Spread map sources may be plain objects, `Map` instances, or registered message types (typed as `map<string, dyn>`); the `__proto__`/`constructor`/`prototype` skip from `safeFromEntries` is applied to spread sources too. Runtime errors fire on non-list/non-map sources (including `null`). `maxListElements` / `maxMapEntries` count a spread as one entry — runtime expansion bypasses those caps (deliberate trade-off). Call-argument spread (`f(...args)`) is **not** supported.
|
|
37
41
|
|
|
38
42
|
## Architecture
|
|
@@ -52,12 +56,13 @@ lib/
|
|
|
52
56
|
├── http-builder.ts — `HttpRequestBuilder` — what an http.* expression returns
|
|
53
57
|
├── json-builtins.ts — `JSON` constant + `JSON.parse` / `JSON.stringify` (local addition)
|
|
54
58
|
├── form-builtins.ts — `form(map): FormData` global + `FormData` type (local addition)
|
|
59
|
+
├── map-builtins.ts — `Map` namespace: fromList / toList — list<{key, value}> ⇄ map (local addition)
|
|
55
60
|
├── math-builtins.ts — `math` namespace: trunc / floor / ceil / round / abs / min / max (local addition)
|
|
56
61
|
├── decimal.ts — Decimal class (arbitrary precision)
|
|
57
62
|
├── optional.ts — Optional type support (uses Effect Option)
|
|
58
63
|
├── serialize.ts — AST back to CEL string
|
|
59
64
|
├── errors.ts — ParseError, TypeError, EvaluationError
|
|
60
|
-
├── globals.ts — Shared utilities
|
|
65
|
+
├── globals.ts — Shared utilities + `safeFromEntries` / `FORBIDDEN_KEYS`
|
|
61
66
|
├── types.ts — Type definitions
|
|
62
67
|
└── options.ts — Configuration management
|
|
63
68
|
```
|
|
@@ -85,7 +90,7 @@ Internal-only (not re-exported from `index.js`): `parse`, standalone `evaluate`/
|
|
|
85
90
|
|
|
86
91
|
Primitives: `string`, `bool`, `number`, `bytes`, `null_type`, `type`
|
|
87
92
|
Composites: `list<T>`, `map<K, V>`, `optional<T>`, `dyn`, `message`
|
|
88
|
-
Custom: `Date` (backed by `TZDate` from `@date-fns/tz`), `URL` (backed by the native `URL`; host-supplied only — no CEL constructor. Reader `URL.query(string): optional<string>` returns the *first* value of a search param — `None` when absent, distinguishing it from a present-but-empty value. Writers return a **copy**, never mutating the receiver (a `URL` is host-injected shared state, unlike a fresh-per-expression `HttpRequestBuilder`): the set/replace `URL.query(string, string | number | optional<string> | optional<number>): URL` collapses repeated entries and on `None` *deletes* the key (the result mirrors the optional's state — deliberately unlike `HttpRequest.query`, whose `None` is a drop/no-op), while `URL.appendQuery(...)` with the same four value overloads appends an entry and no-ops on `None`. Number values render Decimal-exact, like `string(number)`. `string(URL)` is the full `href`.), `File` (native), `FormData` (native — see `form-builtins.ts`), `http` / `HttpRequest` (local addition — see `http-builtins.ts`)
|
|
93
|
+
Custom: `Date` (backed by `TZDate` from `@date-fns/tz`), `URL` (backed by the native `URL`; host-supplied only — no CEL constructor. Reader `URL.query(string): optional<string>` returns the *first* value of a search param — `None` when absent, distinguishing it from a present-but-empty value. Writers return a **copy**, never mutating the receiver (a `URL` is host-injected shared state, unlike a fresh-per-expression `HttpRequestBuilder`): the set/replace `URL.query(string, string | number | optional<string> | optional<number>): URL` collapses repeated entries and on `None` *deletes* the key (the result mirrors the optional's state — deliberately unlike `HttpRequest.query`, whose `None` is a drop/no-op), while `URL.appendQuery(...)` with the same four value overloads appends an entry and no-ops on `None`. Number values render Decimal-exact, like `string(number)`. `string(URL)` is the full `href`.), `File` (native), `FormData` (native — see `form-builtins.ts`), `http` / `HttpRequest` (local addition — see `http-builtins.ts`), `Map` (local addition — the `fromList` / `toList` namespace brand, see `map-builtins.ts`; unrelated to the `map<K, V>` composite)
|
|
89
94
|
|
|
90
95
|
## Function Signature Format
|
|
91
96
|
|
|
@@ -211,6 +211,33 @@ unwrapped first so the output is plain JSON — numbers (CEL's `Decimal`) become
|
|
|
211
211
|
JS numbers, optionals become their value (or `null` when empty), and `Date`
|
|
212
212
|
values become ISO 8601 strings.
|
|
213
213
|
|
|
214
|
+
### Map
|
|
215
|
+
```cel
|
|
216
|
+
// Build a map from a list — the only way to do it, since `map(...)` yields a list:
|
|
217
|
+
Map.fromList([{"key": "a", "value": 1}, {"key": "b", "value": 2}]) // {"a": 1, "b": 2}
|
|
218
|
+
|
|
219
|
+
// Usually you transform a list into pairs first:
|
|
220
|
+
rows.map(r, {"key": r.name, "value": r.qty}) // [{key: "a", value: 1}, ...]
|
|
221
|
+
Map.fromList(rows.map(r, {"key": r.name, "value": r.qty})) // {"a": 1, "b": 2}
|
|
222
|
+
|
|
223
|
+
// Rows already shaped {key, value} go in bare:
|
|
224
|
+
Map.fromList(kvRows)
|
|
225
|
+
|
|
226
|
+
// The inverse — explode a map into pairs so the list macros can reach it:
|
|
227
|
+
Map.toList({"a": 1, "b": 2}) // [{key: "a", value: 1}, {key: "b", value: 2}]
|
|
228
|
+
Map.toList(m).filter(e, e.value > 1).map(e, e.key) // keys whose value > 1
|
|
229
|
+
Map.fromList(Map.toList(m).filter(e, e.value != null)) // drop empty entries, back to a map
|
|
230
|
+
```
|
|
231
|
+
`Map` is a built-in namespace — always available, like `JSON`. Note the capital
|
|
232
|
+
`M`: lowercase `map` is the list macro, and they are unrelated.
|
|
233
|
+
|
|
234
|
+
A pair is a `{key, value}` record, because CEL has no tuple type — the same
|
|
235
|
+
convention `enumerate()` uses. `Map.fromList(list<dyn>)` requires both fields on
|
|
236
|
+
every entry (a `{"key": "a"}` half-pair is an error; `"value": null` is fine).
|
|
237
|
+
Keys must be `string` / `number` / `bool`. Duplicate keys: the last one wins.
|
|
238
|
+
Values keep their type — numbers stay exact, `Date` stays a `Date` — so prefer
|
|
239
|
+
this over a `JSON.parse`/`JSON.stringify` round-trip, which flattens both.
|
|
240
|
+
|
|
214
241
|
### FormData
|
|
215
242
|
```cel
|
|
216
243
|
// Build multipart/form-data for an upload:
|
|
@@ -5,6 +5,7 @@ import { registerFunctions } from "./functions.js";
|
|
|
5
5
|
import { registerHttpBuiltins } from "./http-builtins.js";
|
|
6
6
|
import { registerJSONBuiltins } from "./json-builtins.js";
|
|
7
7
|
import { registerFormBuiltins } from "./form-builtins.js";
|
|
8
|
+
import { registerMapBuiltins } from "./map-builtins.js";
|
|
8
9
|
import { registerMathBuiltins } from "./math-builtins.js";
|
|
9
10
|
import { registerMacros } from "./macros.js";
|
|
10
11
|
import { registerOverloads } from "./overloads.js";
|
|
@@ -19,6 +20,7 @@ registerMacros(globalRegistry);
|
|
|
19
20
|
registerHttpBuiltins(globalRegistry);
|
|
20
21
|
registerJSONBuiltins(globalRegistry);
|
|
21
22
|
registerFormBuiltins(globalRegistry);
|
|
23
|
+
registerMapBuiltins(globalRegistry);
|
|
22
24
|
registerMathBuiltins(globalRegistry);
|
|
23
25
|
class Environment {
|
|
24
26
|
#registry;
|
|
@@ -23,5 +23,7 @@ export declare const arrayFrom: {
|
|
|
23
23
|
<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
24
24
|
<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
25
25
|
};
|
|
26
|
+
export declare const FORBIDDEN_KEYS: Set<string>;
|
|
27
|
+
export declare function safeFromEntries(entries: [unknown, unknown][]): Record<string, unknown>;
|
|
26
28
|
export declare function isAsync(fn: Function | undefined | null, fallback?: boolean): boolean;
|
|
27
29
|
export declare const RESERVED: Set<string>;
|
|
@@ -4,6 +4,16 @@ export const objFreeze = Object.freeze;
|
|
|
4
4
|
export const objEntries = Object.entries;
|
|
5
5
|
export const isArray = Array.isArray;
|
|
6
6
|
export const arrayFrom = Array.from;
|
|
7
|
+
export const FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
8
|
+
export function safeFromEntries(entries) {
|
|
9
|
+
const obj = {};
|
|
10
|
+
for (let i = 0; i < entries.length; i++) {
|
|
11
|
+
const [k, v] = entries[i];
|
|
12
|
+
if (FORBIDDEN_KEYS.has(k)) continue;
|
|
13
|
+
obj[k] = v;
|
|
14
|
+
}
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
7
17
|
export function isAsync(fn, fallback) {
|
|
8
18
|
if (fn?.[Symbol.toStringTag] === "AsyncFunction") return true;
|
|
9
19
|
return typeof fallback === "boolean" ? fallback : true;
|