@katlux/toolkit 0.1.1-alpha.145 → 0.1.1-alpha.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -22
- package/bin/ai-init.mjs +575 -0
- package/bin/ai-tokens/adapters/antigravityAdapter.mjs +22 -0
- package/bin/ai-tokens/adapters/claudeCodeAdapter.mjs +192 -0
- package/bin/ai-tokens/adapters/codexAdapter.mjs +176 -0
- package/bin/ai-tokens/adapters/cursorAdapter.mjs +202 -0
- package/bin/ai-tokens/adapters/index.mjs +30 -0
- package/bin/ai-tokens/cliViews.mjs +301 -0
- package/bin/ai-tokens/formatAndDates.mjs +89 -0
- package/bin/ai-tokens/reportGenerator.mjs +232 -0
- package/bin/ai-tokens/transcriptParser.mjs +299 -0
- package/bin/ai-tokens.mjs +38 -872
- package/bin/cli.mjs +81 -48
- package/bin/create-preset.mjs +1 -0
- package/bin/preset-contracts.json +2997 -0
- package/dist/compiled/composables/locales/asianAndPacific.mjs +296 -0
- package/dist/compiled/composables/locales/northernAndEasternEuropean.mjs +342 -0
- package/dist/compiled/composables/locales/westernEuropean.mjs +268 -0
- package/dist/compiled/composables/locales.mjs +32 -720
- package/dist/compiled/composables/useDataProvider.mjs +39 -26
- package/dist/compiled/composables/useFilterLogic.mjs +10 -2
- package/dist/compiled/composables/useKatluxForm.mjs +13 -11
- package/dist/compiled/composables/usePresetComponent.mjs +2 -0
- package/dist/compiled/composables/useRequestQueue.mjs +3 -1
- package/dist/compiled/composables/useVirtualDataset.mjs +657 -0
- package/dist/compiled/composables/useVirtualScroll.mjs +93 -66
- package/dist/compiled/composables/virtualDataset/cacheStateHelpers.mjs +76 -0
- package/dist/compiled/composables/virtualDataset/keyboardNavHelpers.mjs +60 -0
- package/dist/compiled/composables/virtualDataset/treeSelectionHelpers.mjs +103 -0
- package/dist/compiled/composables/virtualDataset/types.mjs +0 -0
- package/dist/compiled/utils/deprecation.mjs +44 -0
- package/dist/compiled/utils/dom.mjs +124 -0
- package/dist/module.cjs +58 -77
- package/dist/module.d.cts +5 -0
- package/dist/module.d.mts +4 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +54 -77
- package/dist/runtime/app.config.d.ts +3 -0
- package/dist/runtime/components/KAccordion/KAccordion.global.d.vue.ts +1 -1
- package/dist/runtime/components/KAccordion/KAccordion.global.vue.d.ts +1 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.global.d.vue.ts +7 -3
- package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +4 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +7 -3
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +12 -2
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +40 -41
- package/dist/runtime/components/KButton/KButton.global.d.vue.ts +1 -1
- package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
- package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
- package/dist/runtime/components/KCalendar/KCalendar.global.d.vue.ts +19 -10
- package/dist/runtime/components/KCalendar/KCalendar.global.vue +7 -2
- package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +19 -10
- package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +14 -201
- package/dist/runtime/components/KCalendar/KCalendar.logic.js +67 -14
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.d.vue.ts +25 -5
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue +15 -1
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue.d.ts +25 -5
- package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +21 -3
- package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +136 -7
- package/dist/runtime/components/KCalendar/recurringUtils.js +6 -5
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +18 -3
- package/dist/runtime/components/KCombobox/KCombobox.global.vue +9 -4
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +18 -3
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +16 -2
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +32 -13
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +8 -8
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +8 -8
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +3 -3
- package/dist/runtime/components/KContextMenu/KContextMenu.global.d.vue.ts +3 -3
- package/dist/runtime/components/KContextMenu/KContextMenu.global.vue +4 -1
- package/dist/runtime/components/KContextMenu/KContextMenu.global.vue.d.ts +3 -3
- package/dist/runtime/components/KContextMenu/KContextMenu.logic.d.ts +24 -4
- package/dist/runtime/components/KContextMenu/KContextMenu.logic.js +43 -22
- package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +38 -11
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue +39 -20
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +38 -11
- package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +31 -8
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +69 -24
- package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +10 -14
- package/dist/runtime/components/KDatatable/KDatatable.global.vue +6 -5
- package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +10 -14
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +4 -6
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +32 -24
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +33 -15
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +60 -16
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +33 -15
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +30 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +249 -59
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +2 -0
- package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +4 -4
- package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +4 -4
- package/dist/runtime/components/KDropdown/KDropdown.logic.d.ts +3 -2
- package/dist/runtime/components/KDropdown/KDropdown.logic.js +14 -13
- package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +55 -4
- package/dist/runtime/components/KGantt/KGantt.global.vue +18 -3
- package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +55 -4
- package/dist/runtime/components/KGantt/KGantt.logic.d.ts +33 -5
- package/dist/runtime/components/KGantt/KGantt.logic.js +39 -6
- package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
- package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +1 -1
- package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +1 -1
- package/dist/runtime/components/KLayout/KLayout.global.d.vue.ts +4 -1
- package/dist/runtime/components/KLayout/KLayout.global.vue +4 -1
- package/dist/runtime/components/KLayout/KLayout.global.vue.d.ts +4 -1
- package/dist/runtime/components/KLoader/KLoader.global.d.vue.ts +9 -0
- package/dist/runtime/components/KLoader/KLoader.global.vue +3 -0
- package/dist/runtime/components/KLoader/KLoader.global.vue.d.ts +9 -0
- package/dist/runtime/components/KLoader/KLoader.logic.d.ts +5 -0
- package/dist/runtime/components/KLoader/KLoader.logic.js +4 -0
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.js +30 -7
- package/dist/runtime/components/KMultiTabs/KMultiTabs.logic.d.ts +1 -0
- package/dist/runtime/components/KMultiTabs/MultiTabs.global.d.vue.ts +23 -0
- package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue +24 -0
- package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue.d.ts +23 -0
- package/dist/runtime/components/KPagination/KPagination.global.d.vue.ts +3 -1
- package/dist/runtime/components/KPagination/KPagination.global.vue +2 -1
- package/dist/runtime/components/KPagination/KPagination.global.vue.d.ts +3 -1
- package/dist/runtime/components/KPagination/KPagination.logic.d.ts +2 -1
- package/dist/runtime/components/KPagination/KPagination.logic.js +74 -14
- package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTabs/KTabs.logic.js +33 -11
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +2 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +15 -4
- package/dist/runtime/components/KTextbox/KTextbox.global.vue +8 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +15 -4
- package/dist/runtime/components/KTextbox/KTextbox.logic.d.ts +5 -0
- package/dist/runtime/components/KTextbox/KTextbox.logic.js +4 -0
- package/dist/runtime/components/KTooltip/KTooltip.logic.d.ts +11 -2
- package/dist/runtime/components/KTooltip/KTooltip.logic.js +7 -5
- package/dist/runtime/components/KTree/KTree.global.d.vue.ts +4 -4
- package/dist/runtime/components/KTree/KTree.global.vue.d.ts +4 -4
- package/dist/runtime/components/KTree/KTree.logic.d.ts +2 -2
- package/dist/runtime/components/KTree/KTree.logic.js +37 -13
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +7 -5
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +4 -6
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +7 -5
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +3 -2
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.js +10 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +40 -6
- package/dist/runtime/components/KTreeView/KTreeView.global.vue +19 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +40 -6
- package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +24 -4
- package/dist/runtime/components/KTreeView/KTreeView.logic.js +105 -11
- package/dist/runtime/composables/locales/asianAndPacific.d.ts +11 -0
- package/dist/runtime/composables/locales/asianAndPacific.js +296 -0
- package/dist/runtime/composables/locales/northernAndEasternEuropean.d.ts +12 -0
- package/dist/runtime/composables/locales/northernAndEasternEuropean.js +342 -0
- package/dist/runtime/composables/locales/westernEuropean.d.ts +10 -0
- package/dist/runtime/composables/locales/westernEuropean.js +268 -0
- package/dist/runtime/composables/locales.d.ts +4 -24
- package/dist/runtime/composables/locales.js +32 -720
- package/dist/runtime/composables/useDataProvider.d.ts +5 -3
- package/dist/runtime/composables/useDataProvider.js +39 -26
- package/dist/runtime/composables/useFilterLogic.d.ts +16 -4
- package/dist/runtime/composables/useFilterLogic.js +10 -2
- package/dist/runtime/composables/useKatluxForm.d.ts +4 -4
- package/dist/runtime/composables/useKatluxForm.js +13 -11
- package/dist/runtime/composables/usePresetComponent.js +2 -0
- package/dist/runtime/composables/useRequestQueue.d.ts +2 -0
- package/dist/runtime/composables/useRequestQueue.js +3 -1
- package/dist/runtime/composables/useSortLogic.d.ts +1 -1
- package/dist/runtime/composables/useVirtualDataset.d.ts +9 -0
- package/dist/runtime/composables/useVirtualDataset.js +657 -0
- package/dist/runtime/composables/useVirtualScroll.d.ts +14 -10
- package/dist/runtime/composables/useVirtualScroll.js +93 -66
- package/dist/runtime/composables/virtualDataset/cacheStateHelpers.d.ts +49 -0
- package/dist/runtime/composables/virtualDataset/cacheStateHelpers.js +76 -0
- package/dist/runtime/composables/virtualDataset/keyboardNavHelpers.d.ts +26 -0
- package/dist/runtime/composables/virtualDataset/keyboardNavHelpers.js +60 -0
- package/dist/runtime/composables/virtualDataset/treeSelectionHelpers.d.ts +24 -0
- package/dist/runtime/composables/virtualDataset/treeSelectionHelpers.js +103 -0
- package/dist/runtime/composables/virtualDataset/types.d.ts +113 -0
- package/dist/runtime/composables/virtualDataset/types.js +0 -0
- package/dist/runtime/directives/clickOutside.d.ts +1 -1
- package/dist/runtime/directives/clickOutside.js +41 -13
- package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +2 -1
- package/dist/runtime/plugins/nuxtCompatPlugin.js +16 -1
- package/dist/runtime/plugins/toastPlugin.client.js +2 -2
- package/dist/runtime/presets/default/assets/scss/css-variables.css +3 -0
- package/dist/runtime/presets/default/assets/scss/css-variables.scss +6 -1
- package/dist/runtime/presets/default/assets/scss/index.css +3 -0
- package/dist/runtime/presets/default/assets/svg/katlux-logo.svg +7 -0
- package/dist/runtime/presets/default/assets/svg/katlux.svg +6 -0
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.d.vue.ts +3 -2
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +31 -3
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue.d.ts +3 -2
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +3 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +6 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +3 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +7 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +57 -2
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +7 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +6 -5
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +27 -17
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +10 -10
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +67 -22
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +41 -8
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +184 -174
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +41 -8
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +17 -10
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +113 -394
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +17 -10
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +6 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +71 -4
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +6 -0
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.d.vue.ts +5 -2
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +15 -12
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue.d.ts +5 -2
- package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +11 -2
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +46 -29
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +11 -2
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.d.vue.ts +6 -2
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +23 -8
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue.d.ts +6 -2
- package/dist/runtime/presets/default/components/KLayout/KLayout.vue +2 -2
- package/dist/runtime/presets/default/components/KLoader/KLoader.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KLoader/KLoader.vue +13 -2
- package/dist/runtime/presets/default/components/KLoader/KLoader.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +1 -94
- package/dist/runtime/presets/default/components/KMultiTabs/KMultiTabs.vue +69 -4
- package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +18 -46
- package/dist/runtime/presets/default/components/KSlider/KSlider.vue +11 -23
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +24 -8
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +3 -3
- package/dist/runtime/presets/default/components/KTree/KTree.vue +61 -56
- package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +3 -3
- package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue +12 -2
- package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +11 -2
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +14 -2
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +11 -2
- package/dist/runtime/server/middleware/session.js +7 -0
- package/dist/runtime/utils/deprecation.d.ts +14 -0
- package/dist/runtime/utils/deprecation.js +44 -0
- package/dist/runtime/utils/dom.d.ts +31 -0
- package/dist/runtime/utils/dom.js +124 -0
- package/dist/skills/KATLUX_INDEX.md +18 -19
- package/dist/skills/katlux-components/SKILL.md +2 -0
- package/dist/skills/katlux-components/components/KBulkActions.md +26 -2
- package/dist/skills/katlux-components/components/KCombobox.md +2 -2
- package/dist/skills/katlux-components/components/KDataIterator.md +17 -4
- package/dist/skills/katlux-components/components/KDatatable.md +38 -0
- package/dist/skills/katlux-components/components/KDatePicker.md +3 -1
- package/dist/skills/katlux-components/components/KGantt.md +9 -0
- package/dist/skills/katlux-components/components/KIcon.md +1 -1
- package/dist/skills/katlux-components/components/KLayout.md +4 -0
- package/dist/skills/katlux-components/components/KLineChart.md +3 -0
- package/dist/skills/katlux-components/components/KLoader.md +3 -0
- package/dist/skills/katlux-components/components/KProductList.md +0 -1
- package/dist/skills/katlux-components/components/KScatterChart.md +3 -0
- package/dist/skills/katlux-components/components/KTextbox.md +1 -0
- package/dist/skills/katlux-components/components/KTreePicker.md +2 -1
- package/dist/skills/katlux-components/components/KTreeView.md +12 -0
- package/dist/skills/katlux-config/SKILL.md +27 -8
- package/dist/skills/katlux-presets/SKILL.md +163 -3
- package/dist/skills/katlux-presets/creating-a-preset.md +67 -0
- package/dist/skills/katlux-providers/SKILL.md +19 -5
- package/dist/skills/katlux-providers/providers/ADataProvider.md +17 -9
- package/dist/skills/katlux-providers/providers/CAPIFlatClientDataProvider.md +27 -3
- package/dist/skills/katlux-providers/providers/CAPIFlatServerDataProvider.md +11 -1
- package/dist/skills/katlux-providers/providers/CAPITreeServerDataProvider.md +13 -0
- package/dist/skills/katlux-providers/providers/CFlatClientDataProvider.md +19 -4
- package/dist/skills/katlux-providers/providers/CFlatServerDataProvider.md +4 -2
- package/dist/skills/katlux-providers/providers/CTreeClientDataProvider.md +2 -2
- package/dist/skills/katlux-providers/providers/RequestProvider.md +10 -0
- package/dist/skills/katlux-providers/providers/encryption-field-level.md +67 -20
- package/dist/skills/katlux-providers/providers/encryption-key-management.md +23 -2
- package/dist/skills/katlux-providers/providers/encryption-key-pinning.md +25 -11
- package/dist/skills/katlux-providers/providers/encryption-searchable.md +341 -0
- package/dist/skills/katlux-providers/providers/encryption-symmetric.md +29 -2
- package/dist/skills/katlux-providers/providers/encryption-threat-model.md +70 -1
- package/dist/skills/katlux-providers/providers/encryption.md +26 -1
- package/dist/skills/katlux-providers/providers/types.md +3 -1
- package/dist/skills/katlux-providers/providers/useDataProvider.md +2 -1
- package/dist/skills/katlux-providers/providers/useVirtualDataset.md +154 -0
- package/dist/skills/katlux-tokens/SKILL.md +2 -1
- package/dist/types.d.mts +1 -1
- package/package.json +7 -3
- package/bin/add-ai-reference.mjs +0 -259
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'
|
|
2
|
+
import { homedir } from 'node:os'
|
|
3
|
+
import { basename, dirname, join } from 'node:path'
|
|
4
|
+
import { estimateTokens, getWeekKey } from '../formatAndDates.mjs'
|
|
5
|
+
import { analyzeSession } from '../transcriptParser.mjs'
|
|
6
|
+
|
|
7
|
+
export const getClaudeProjectsDir = () =>
|
|
8
|
+
process.env.CLAUDE_PROJECTS_DIR || join(homedir(), '.claude', 'projects')
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Extracts a readable project name from a Claude Code project directory slug
|
|
12
|
+
* (e.g. `-home-user-projects-MyApp` -> `MyApp`).
|
|
13
|
+
*/
|
|
14
|
+
function projectFromSlug(slug) {
|
|
15
|
+
if (!slug) return 'Unknown'
|
|
16
|
+
const parts = slug.split('-').filter(Boolean)
|
|
17
|
+
return parts[parts.length - 1] || slug
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Extracts plain text from a Claude Code message content field
|
|
22
|
+
* (which may be a string or an array of content blocks).
|
|
23
|
+
*/
|
|
24
|
+
function extractTextFromContent(content) {
|
|
25
|
+
if (typeof content === 'string') return content
|
|
26
|
+
if (!Array.isArray(content)) return ''
|
|
27
|
+
return content
|
|
28
|
+
.filter(block => block && (block.type === 'text' || typeof block.text === 'string'))
|
|
29
|
+
.map(block => block.text || '')
|
|
30
|
+
.join('\n')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Extracts tool_use blocks from a Claude Code assistant message content array.
|
|
35
|
+
*/
|
|
36
|
+
function extractToolCalls(content) {
|
|
37
|
+
if (!Array.isArray(content)) return undefined
|
|
38
|
+
const calls = content
|
|
39
|
+
.filter(block => block && block.type === 'tool_use')
|
|
40
|
+
.map(block => ({
|
|
41
|
+
name: block.name || 'unknown_tool',
|
|
42
|
+
arguments: block.input ? JSON.stringify(block.input) : ''
|
|
43
|
+
}))
|
|
44
|
+
return calls.length > 0 ? calls : undefined
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Discovers Claude Code `.jsonl` session transcripts under `CLAUDE_PROJECTS_DIR`.
|
|
49
|
+
*/
|
|
50
|
+
export function getConversations(projectsDir = getClaudeProjectsDir()) {
|
|
51
|
+
if (!existsSync(projectsDir)) return []
|
|
52
|
+
|
|
53
|
+
const results = []
|
|
54
|
+
const projectDirs = readdirSync(projectsDir, { withFileTypes: true })
|
|
55
|
+
|
|
56
|
+
for (const pDir of projectDirs) {
|
|
57
|
+
if (!pDir.isDirectory() || pDir.name.startsWith('.')) continue
|
|
58
|
+
const fullProjectDir = join(projectsDir, pDir.name)
|
|
59
|
+
const files = readdirSync(fullProjectDir, { withFileTypes: true })
|
|
60
|
+
|
|
61
|
+
for (const f of files) {
|
|
62
|
+
if (!f.isFile() || !f.name.endsWith('.jsonl')) continue
|
|
63
|
+
const filePath = join(fullProjectDir, f.name)
|
|
64
|
+
const stat = statSync(filePath)
|
|
65
|
+
results.push({
|
|
66
|
+
id: f.name.replace(/\.jsonl$/, ''),
|
|
67
|
+
path: filePath,
|
|
68
|
+
createdAt: stat.birthtimeMs ? new Date(stat.birthtimeMs) : stat.mtime,
|
|
69
|
+
lastActive: stat.mtime,
|
|
70
|
+
mtime: stat.mtime,
|
|
71
|
+
weekKey: getWeekKey(stat.mtime),
|
|
72
|
+
project: projectFromSlug(pDir.name)
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return results.sort((a, b) => b.lastActive.getTime() - a.lastActive.getTime())
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Fast preview metadata extractor for a Claude Code `.jsonl` transcript file.
|
|
82
|
+
*/
|
|
83
|
+
export function getConversationPreviewFast(filePath, searchQuery = '') {
|
|
84
|
+
if (!existsSync(filePath)) {
|
|
85
|
+
return {
|
|
86
|
+
title: '(Empty)',
|
|
87
|
+
fullTitle: '',
|
|
88
|
+
project: 'Unknown',
|
|
89
|
+
estimatedTokens: 0,
|
|
90
|
+
rawSize: 0,
|
|
91
|
+
matchesSearch: false
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const raw = readFileSync(filePath, 'utf8')
|
|
96
|
+
const rawSize = Buffer.byteLength(raw, 'utf8')
|
|
97
|
+
const estimatedTokens = estimateTokens(rawSize)
|
|
98
|
+
const matchesSearch = searchQuery ? raw.toLowerCase().includes(searchQuery.toLowerCase()) : false
|
|
99
|
+
|
|
100
|
+
let fullTitle = ''
|
|
101
|
+
let project = projectFromSlug(basename(dirname(filePath)))
|
|
102
|
+
|
|
103
|
+
for (const line of raw.split('\n')) {
|
|
104
|
+
if (!line.trim()) continue
|
|
105
|
+
try {
|
|
106
|
+
const entry = JSON.parse(line)
|
|
107
|
+
if (entry.cwd && project === 'Unknown') {
|
|
108
|
+
project = basename(entry.cwd)
|
|
109
|
+
}
|
|
110
|
+
if (entry.type === 'user' && entry.message) {
|
|
111
|
+
const text = extractTextFromContent(entry.message.content).replace(/[\r\n\t]+/g, ' ').trim()
|
|
112
|
+
if (text) {
|
|
113
|
+
fullTitle = text
|
|
114
|
+
break
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} catch {
|
|
118
|
+
// Skip malformed lines
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const title = fullTitle
|
|
123
|
+
? (fullTitle.length > 32 ? fullTitle.slice(0, 31) + '…' : fullTitle)
|
|
124
|
+
: '(No user prompt)'
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
title,
|
|
128
|
+
fullTitle,
|
|
129
|
+
project,
|
|
130
|
+
estimatedTokens,
|
|
131
|
+
rawSize,
|
|
132
|
+
matchesSearch
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Parses a Claude Code `.jsonl` transcript into the shared step format
|
|
138
|
+
* consumed by `analyzeSession`.
|
|
139
|
+
*/
|
|
140
|
+
export function parseTranscript(filePath) {
|
|
141
|
+
if (!existsSync(filePath)) return null
|
|
142
|
+
const raw = readFileSync(filePath, 'utf8')
|
|
143
|
+
const lines = raw.split('\n').filter(l => l.trim())
|
|
144
|
+
const steps = []
|
|
145
|
+
|
|
146
|
+
lines.forEach((line, idx) => {
|
|
147
|
+
try {
|
|
148
|
+
const entry = JSON.parse(line)
|
|
149
|
+
const msg = entry.message || {}
|
|
150
|
+
const role = msg.role || entry.type
|
|
151
|
+
const createdAt = entry.timestamp || entry.createdAt || undefined
|
|
152
|
+
|
|
153
|
+
if (role === 'user' || entry.type === 'user') {
|
|
154
|
+
const text = extractTextFromContent(msg.content ?? entry.content)
|
|
155
|
+
const hasToolResult = Array.isArray(msg.content) && msg.content.some(b => b?.type === 'tool_result')
|
|
156
|
+
steps.push({
|
|
157
|
+
step_index: idx + 1,
|
|
158
|
+
type: hasToolResult && !text ? 'TOOL_RESULT' : 'USER_INPUT',
|
|
159
|
+
content: text || (hasToolResult ? JSON.stringify(msg.content) : ''),
|
|
160
|
+
created_at: createdAt
|
|
161
|
+
})
|
|
162
|
+
} else if (role === 'assistant' || entry.type === 'assistant') {
|
|
163
|
+
const text = extractTextFromContent(msg.content ?? entry.content)
|
|
164
|
+
const toolCalls = extractToolCalls(msg.content)
|
|
165
|
+
steps.push({
|
|
166
|
+
step_index: idx + 1,
|
|
167
|
+
type: 'PLANNER_RESPONSE',
|
|
168
|
+
content: text,
|
|
169
|
+
tool_calls: toolCalls,
|
|
170
|
+
created_at: createdAt
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
} catch {
|
|
174
|
+
// Skip malformed lines
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
return steps
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export const claudeCodeAdapter = {
|
|
182
|
+
name: 'claude-code',
|
|
183
|
+
displayName: 'Claude Code',
|
|
184
|
+
get emptyMessage() {
|
|
185
|
+
return `No conversations found in ${getClaudeProjectsDir()}`
|
|
186
|
+
},
|
|
187
|
+
getConversations: () => getConversations(),
|
|
188
|
+
getConversationPreviewFast,
|
|
189
|
+
parseTranscript,
|
|
190
|
+
analyzeSession
|
|
191
|
+
}
|
|
192
|
+
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'
|
|
2
|
+
import { homedir } from 'node:os'
|
|
3
|
+
import { basename, join } from 'node:path'
|
|
4
|
+
import { estimateTokens, getWeekKey } from '../formatAndDates.mjs'
|
|
5
|
+
import { analyzeSession } from '../transcriptParser.mjs'
|
|
6
|
+
|
|
7
|
+
export const getCodexSessionsDir = () =>
|
|
8
|
+
process.env.CODEX_SESSIONS_DIR || join(homedir(), '.codex', 'sessions')
|
|
9
|
+
|
|
10
|
+
function collectJsonlFiles(dir) {
|
|
11
|
+
const files = []
|
|
12
|
+
if (!existsSync(dir)) return files
|
|
13
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
14
|
+
const full = join(dir, entry.name)
|
|
15
|
+
if (entry.isDirectory() && !entry.name.startsWith('.')) {
|
|
16
|
+
files.push(...collectJsonlFiles(full))
|
|
17
|
+
} else if (entry.isFile() && entry.name.endsWith('.jsonl')) {
|
|
18
|
+
files.push(full)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return files
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function extractText(content) {
|
|
25
|
+
if (typeof content === 'string') return content
|
|
26
|
+
if (!Array.isArray(content)) return ''
|
|
27
|
+
return content
|
|
28
|
+
.filter(b => b && (b.type === 'input_text' || b.type === 'output_text' || b.type === 'text' || typeof b.text === 'string'))
|
|
29
|
+
.map(b => b.text || '')
|
|
30
|
+
.join('\n')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Discovers OpenAI Codex CLI `.jsonl` session transcripts under `CODEX_SESSIONS_DIR`.
|
|
35
|
+
*/
|
|
36
|
+
export function getConversations(sessionsDir = getCodexSessionsDir()) {
|
|
37
|
+
if (!existsSync(sessionsDir)) return []
|
|
38
|
+
|
|
39
|
+
const results = collectJsonlFiles(sessionsDir).map(filePath => {
|
|
40
|
+
const stat = statSync(filePath)
|
|
41
|
+
return {
|
|
42
|
+
id: basename(filePath, '.jsonl'),
|
|
43
|
+
path: filePath,
|
|
44
|
+
createdAt: stat.birthtimeMs ? new Date(stat.birthtimeMs) : stat.mtime,
|
|
45
|
+
lastActive: stat.mtime,
|
|
46
|
+
mtime: stat.mtime,
|
|
47
|
+
weekKey: getWeekKey(stat.mtime)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
return results.sort((a, b) => b.lastActive.getTime() - a.lastActive.getTime())
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Fast preview metadata extractor for a Codex `.jsonl` session file.
|
|
56
|
+
*/
|
|
57
|
+
export function getConversationPreviewFast(filePath, searchQuery = '') {
|
|
58
|
+
if (!existsSync(filePath)) {
|
|
59
|
+
return {
|
|
60
|
+
title: '(Empty)',
|
|
61
|
+
fullTitle: '',
|
|
62
|
+
project: 'Unknown',
|
|
63
|
+
estimatedTokens: 0,
|
|
64
|
+
rawSize: 0,
|
|
65
|
+
matchesSearch: false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const raw = readFileSync(filePath, 'utf8')
|
|
70
|
+
const rawSize = Buffer.byteLength(raw, 'utf8')
|
|
71
|
+
const estimatedTokens = estimateTokens(rawSize)
|
|
72
|
+
const matchesSearch = searchQuery ? raw.toLowerCase().includes(searchQuery.toLowerCase()) : false
|
|
73
|
+
|
|
74
|
+
let project = 'Unknown'
|
|
75
|
+
let fullTitle = ''
|
|
76
|
+
|
|
77
|
+
for (const line of raw.split('\n')) {
|
|
78
|
+
if (!line.trim()) continue
|
|
79
|
+
try {
|
|
80
|
+
const entry = JSON.parse(line)
|
|
81
|
+
const payload = entry.payload || entry
|
|
82
|
+
if (entry.type === 'session_meta' && payload.cwd) {
|
|
83
|
+
project = basename(payload.cwd)
|
|
84
|
+
}
|
|
85
|
+
if (!fullTitle && entry.type === 'response_item' && payload.role === 'user') {
|
|
86
|
+
const text = extractText(payload.content).replace(/[\r\n\t]+/g, ' ').trim()
|
|
87
|
+
if (text) fullTitle = text
|
|
88
|
+
}
|
|
89
|
+
if (project !== 'Unknown' && fullTitle) break
|
|
90
|
+
} catch {
|
|
91
|
+
// Skip malformed lines
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const title = fullTitle
|
|
96
|
+
? (fullTitle.length > 32 ? fullTitle.slice(0, 31) + '…' : fullTitle)
|
|
97
|
+
: '(No user prompt)'
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
title,
|
|
101
|
+
fullTitle,
|
|
102
|
+
project,
|
|
103
|
+
estimatedTokens,
|
|
104
|
+
rawSize,
|
|
105
|
+
matchesSearch
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Parses a Codex `.jsonl` session into the shared step format
|
|
111
|
+
* consumed by `analyzeSession`.
|
|
112
|
+
*/
|
|
113
|
+
export function parseTranscript(filePath) {
|
|
114
|
+
if (!existsSync(filePath)) return null
|
|
115
|
+
const raw = readFileSync(filePath, 'utf8')
|
|
116
|
+
const lines = raw.split('\n').filter(l => l.trim())
|
|
117
|
+
const steps = []
|
|
118
|
+
|
|
119
|
+
lines.forEach((line, idx) => {
|
|
120
|
+
try {
|
|
121
|
+
const entry = JSON.parse(line)
|
|
122
|
+
const payload = entry.payload || entry
|
|
123
|
+
const createdAt = entry.timestamp || undefined
|
|
124
|
+
|
|
125
|
+
if (entry.type === 'response_item') {
|
|
126
|
+
if (payload.role === 'user') {
|
|
127
|
+
steps.push({
|
|
128
|
+
step_index: idx + 1,
|
|
129
|
+
type: 'USER_INPUT',
|
|
130
|
+
content: extractText(payload.content),
|
|
131
|
+
created_at: createdAt
|
|
132
|
+
})
|
|
133
|
+
} else if (payload.role === 'assistant') {
|
|
134
|
+
steps.push({
|
|
135
|
+
step_index: idx + 1,
|
|
136
|
+
type: 'PLANNER_RESPONSE',
|
|
137
|
+
content: extractText(payload.content),
|
|
138
|
+
created_at: createdAt
|
|
139
|
+
})
|
|
140
|
+
} else if (payload.type === 'function_call') {
|
|
141
|
+
steps.push({
|
|
142
|
+
step_index: idx + 1,
|
|
143
|
+
type: 'PLANNER_RESPONSE',
|
|
144
|
+
content: '',
|
|
145
|
+
tool_calls: [{ name: payload.name || 'unknown_tool', arguments: payload.arguments || '' }],
|
|
146
|
+
created_at: createdAt
|
|
147
|
+
})
|
|
148
|
+
} else if (payload.type === 'function_call_output') {
|
|
149
|
+
steps.push({
|
|
150
|
+
step_index: idx + 1,
|
|
151
|
+
type: 'TOOL_RESULT',
|
|
152
|
+
content: typeof payload.output === 'string' ? payload.output : JSON.stringify(payload.output ?? ''),
|
|
153
|
+
created_at: createdAt
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} catch {
|
|
158
|
+
// Skip malformed lines
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
return steps
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const codexAdapter = {
|
|
166
|
+
name: 'codex',
|
|
167
|
+
displayName: 'Codex',
|
|
168
|
+
get emptyMessage() {
|
|
169
|
+
return `No conversations found in ${getCodexSessionsDir()}`
|
|
170
|
+
},
|
|
171
|
+
getConversations: () => getConversations(),
|
|
172
|
+
getConversationPreviewFast,
|
|
173
|
+
parseTranscript,
|
|
174
|
+
analyzeSession
|
|
175
|
+
}
|
|
176
|
+
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'
|
|
2
|
+
import { homedir } from 'node:os'
|
|
3
|
+
import { basename, dirname, join } from 'node:path'
|
|
4
|
+
import { estimateTokens, getWeekKey } from '../formatAndDates.mjs'
|
|
5
|
+
import { analyzeSession } from '../transcriptParser.mjs'
|
|
6
|
+
|
|
7
|
+
export const getCursorProjectsDir = () =>
|
|
8
|
+
process.env.CURSOR_PROJECTS_DIR || join(homedir(), '.cursor', 'projects')
|
|
9
|
+
|
|
10
|
+
function projectFromSlug(slug) {
|
|
11
|
+
if (!slug) return 'Unknown'
|
|
12
|
+
const parts = slug.split('-').filter(Boolean)
|
|
13
|
+
return parts[parts.length - 1] || slug
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function extractText(content) {
|
|
17
|
+
if (typeof content === 'string') return content
|
|
18
|
+
if (!Array.isArray(content)) return ''
|
|
19
|
+
return content
|
|
20
|
+
.filter(b => b && (b.type === 'text' || typeof b.text === 'string'))
|
|
21
|
+
.map(b => b.text || '')
|
|
22
|
+
.join('\n')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function extractToolCalls(content) {
|
|
26
|
+
if (!Array.isArray(content)) return undefined
|
|
27
|
+
const calls = content
|
|
28
|
+
.filter(b => b && (b.type === 'tool_use' || b.type === 'tool_call'))
|
|
29
|
+
.map(b => ({
|
|
30
|
+
name: b.name || 'unknown_tool',
|
|
31
|
+
arguments: b.input ? JSON.stringify(b.input) : (b.arguments || '')
|
|
32
|
+
}))
|
|
33
|
+
return calls.length > 0 ? calls : undefined
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function collectJsonlFiles(dir) {
|
|
37
|
+
const files = []
|
|
38
|
+
if (!existsSync(dir)) return files
|
|
39
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
40
|
+
const full = join(dir, entry.name)
|
|
41
|
+
if (entry.isDirectory() && !entry.name.startsWith('.')) {
|
|
42
|
+
files.push(...collectJsonlFiles(full))
|
|
43
|
+
} else if (entry.isFile() && entry.name.endsWith('.jsonl')) {
|
|
44
|
+
files.push(full)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return files
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Discovers Cursor agent transcript `.jsonl` files under `CURSOR_PROJECTS_DIR`.
|
|
52
|
+
*/
|
|
53
|
+
export function getConversations(projectsDir = getCursorProjectsDir()) {
|
|
54
|
+
if (!existsSync(projectsDir)) return []
|
|
55
|
+
|
|
56
|
+
const results = []
|
|
57
|
+
for (const pDir of readdirSync(projectsDir, { withFileTypes: true })) {
|
|
58
|
+
if (!pDir.isDirectory() || pDir.name.startsWith('.')) continue
|
|
59
|
+
const fullProjectDir = join(projectsDir, pDir.name)
|
|
60
|
+
const transcriptDir = existsSync(join(fullProjectDir, 'agent-transcripts'))
|
|
61
|
+
? join(fullProjectDir, 'agent-transcripts')
|
|
62
|
+
: fullProjectDir
|
|
63
|
+
|
|
64
|
+
for (const filePath of collectJsonlFiles(transcriptDir)) {
|
|
65
|
+
const stat = statSync(filePath)
|
|
66
|
+
results.push({
|
|
67
|
+
id: basename(filePath, '.jsonl'),
|
|
68
|
+
path: filePath,
|
|
69
|
+
createdAt: stat.birthtimeMs ? new Date(stat.birthtimeMs) : stat.mtime,
|
|
70
|
+
lastActive: stat.mtime,
|
|
71
|
+
mtime: stat.mtime,
|
|
72
|
+
weekKey: getWeekKey(stat.mtime),
|
|
73
|
+
project: projectFromSlug(pDir.name)
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return results.sort((a, b) => b.lastActive.getTime() - a.lastActive.getTime())
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Fast preview metadata extractor for a Cursor `.jsonl` transcript file.
|
|
83
|
+
*/
|
|
84
|
+
export function getConversationPreviewFast(filePath, searchQuery = '') {
|
|
85
|
+
if (!existsSync(filePath)) {
|
|
86
|
+
return {
|
|
87
|
+
title: '(Empty)',
|
|
88
|
+
fullTitle: '',
|
|
89
|
+
project: 'Unknown',
|
|
90
|
+
estimatedTokens: 0,
|
|
91
|
+
rawSize: 0,
|
|
92
|
+
matchesSearch: false
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const raw = readFileSync(filePath, 'utf8')
|
|
97
|
+
const rawSize = Buffer.byteLength(raw, 'utf8')
|
|
98
|
+
const estimatedTokens = estimateTokens(rawSize)
|
|
99
|
+
const matchesSearch = searchQuery ? raw.toLowerCase().includes(searchQuery.toLowerCase()) : false
|
|
100
|
+
|
|
101
|
+
const parentName = basename(dirname(filePath))
|
|
102
|
+
const projectSlug = parentName === 'agent-transcripts'
|
|
103
|
+
? basename(dirname(dirname(filePath)))
|
|
104
|
+
: parentName
|
|
105
|
+
let project = projectFromSlug(projectSlug)
|
|
106
|
+
let fullTitle = ''
|
|
107
|
+
|
|
108
|
+
for (const line of raw.split('\n')) {
|
|
109
|
+
if (!line.trim()) continue
|
|
110
|
+
try {
|
|
111
|
+
const entry = JSON.parse(line)
|
|
112
|
+
if (entry.cwd && project === 'Unknown') project = basename(entry.cwd)
|
|
113
|
+
const role = entry.role || entry.message?.role || entry.type
|
|
114
|
+
if (role === 'user') {
|
|
115
|
+
const text = extractText(entry.message?.content ?? entry.content ?? entry.text)
|
|
116
|
+
.replace(/[\r\n\t]+/g, ' ')
|
|
117
|
+
.trim()
|
|
118
|
+
if (text) {
|
|
119
|
+
fullTitle = text
|
|
120
|
+
break
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
} catch {
|
|
124
|
+
// Skip malformed lines
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const title = fullTitle
|
|
129
|
+
? (fullTitle.length > 32 ? fullTitle.slice(0, 31) + '…' : fullTitle)
|
|
130
|
+
: '(No user prompt)'
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
title,
|
|
134
|
+
fullTitle,
|
|
135
|
+
project,
|
|
136
|
+
estimatedTokens,
|
|
137
|
+
rawSize,
|
|
138
|
+
matchesSearch
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Parses a Cursor `.jsonl` transcript into the shared step format
|
|
144
|
+
* consumed by `analyzeSession`.
|
|
145
|
+
*/
|
|
146
|
+
export function parseTranscript(filePath) {
|
|
147
|
+
if (!existsSync(filePath)) return null
|
|
148
|
+
const raw = readFileSync(filePath, 'utf8')
|
|
149
|
+
const lines = raw.split('\n').filter(l => l.trim())
|
|
150
|
+
const steps = []
|
|
151
|
+
|
|
152
|
+
lines.forEach((line, idx) => {
|
|
153
|
+
try {
|
|
154
|
+
const entry = JSON.parse(line)
|
|
155
|
+
const msg = entry.message || {}
|
|
156
|
+
const role = entry.role || msg.role || entry.type
|
|
157
|
+
const content = msg.content ?? entry.content ?? entry.text ?? ''
|
|
158
|
+
const createdAt = entry.timestamp || entry.createdAt || undefined
|
|
159
|
+
|
|
160
|
+
if (role === 'user') {
|
|
161
|
+
steps.push({
|
|
162
|
+
step_index: idx + 1,
|
|
163
|
+
type: 'USER_INPUT',
|
|
164
|
+
content: extractText(content),
|
|
165
|
+
created_at: createdAt
|
|
166
|
+
})
|
|
167
|
+
} else if (role === 'assistant') {
|
|
168
|
+
steps.push({
|
|
169
|
+
step_index: idx + 1,
|
|
170
|
+
type: 'PLANNER_RESPONSE',
|
|
171
|
+
content: extractText(content),
|
|
172
|
+
tool_calls: extractToolCalls(content),
|
|
173
|
+
created_at: createdAt
|
|
174
|
+
})
|
|
175
|
+
} else if (role === 'tool' || role === 'tool_result') {
|
|
176
|
+
steps.push({
|
|
177
|
+
step_index: idx + 1,
|
|
178
|
+
type: 'TOOL_RESULT',
|
|
179
|
+
content: typeof content === 'string' ? content : JSON.stringify(content),
|
|
180
|
+
created_at: createdAt
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
} catch {
|
|
184
|
+
// Skip malformed lines
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
return steps
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export const cursorAdapter = {
|
|
192
|
+
name: 'cursor',
|
|
193
|
+
displayName: 'Cursor',
|
|
194
|
+
get emptyMessage() {
|
|
195
|
+
return `No conversations found in ${getCursorProjectsDir()}`
|
|
196
|
+
},
|
|
197
|
+
getConversations: () => getConversations(),
|
|
198
|
+
getConversationPreviewFast,
|
|
199
|
+
parseTranscript,
|
|
200
|
+
analyzeSession
|
|
201
|
+
}
|
|
202
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { antigravityAdapter } from './antigravityAdapter.mjs'
|
|
2
|
+
import { claudeCodeAdapter } from './claudeCodeAdapter.mjs'
|
|
3
|
+
import { codexAdapter } from './codexAdapter.mjs'
|
|
4
|
+
import { cursorAdapter } from './cursorAdapter.mjs'
|
|
5
|
+
|
|
6
|
+
const ADAPTERS = {
|
|
7
|
+
antigravity: antigravityAdapter,
|
|
8
|
+
'claude-code': claudeCodeAdapter,
|
|
9
|
+
claude: claudeCodeAdapter,
|
|
10
|
+
cursor: cursorAdapter,
|
|
11
|
+
codex: codexAdapter
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const SUPPORTED_IDES = ['antigravity', 'claude-code', 'cursor', 'codex']
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Resolves an IDE transcript adapter by name (defaults to `antigravity`).
|
|
18
|
+
* Throws an Error if the requested IDE is not supported.
|
|
19
|
+
*/
|
|
20
|
+
export function getIdeAdapter(ideName = 'antigravity') {
|
|
21
|
+
const key = String(ideName || 'antigravity').trim().toLowerCase()
|
|
22
|
+
const adapter = ADAPTERS[key]
|
|
23
|
+
if (!adapter) {
|
|
24
|
+
throw new Error(`Unsupported IDE "${ideName}". Supported IDEs: ${SUPPORTED_IDES.join(', ')}`)
|
|
25
|
+
}
|
|
26
|
+
return adapter
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { antigravityAdapter, claudeCodeAdapter, cursorAdapter, codexAdapter }
|
|
30
|
+
|