@vc-shell/framework 2.0.5 → 2.0.6-pr232.5b58c86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/ai-agent/index.js +2 -2
  3. package/dist/chunks/{VcAiAgentPanel.vue_vue_type_style_index_0_lang-D5HgEXFw.js → VcAiAgentPanel.vue_vue_type_style_index_0_lang-Y09G7Gnw.js} +659 -720
  4. package/dist/chunks/{VcAiAgentPanel.vue_vue_type_style_index_0_lang-D5HgEXFw.js.map → VcAiAgentPanel.vue_vue_type_style_index_0_lang-Y09G7Gnw.js.map} +1 -1
  5. package/dist/chunks/{VcTableAdapter.vue_vue_type_style_index_0_lang-HqgHfIV-.js → VcTableAdapter.vue_vue_type_style_index_0_lang-By-yf14g.js} +3368 -3345
  6. package/dist/chunks/VcTableAdapter.vue_vue_type_style_index_0_lang-By-yf14g.js.map +1 -0
  7. package/dist/chunks/index-B78ceaW1.js +45 -0
  8. package/dist/chunks/index-B78ceaW1.js.map +1 -0
  9. package/dist/chunks/vendor-lodash-es-D2n90GJy.js +1436 -0
  10. package/dist/chunks/vendor-lodash-es-D2n90GJy.js.map +1 -0
  11. package/dist/core/plugins/ai-agent/composables/index.d.ts +1 -1
  12. package/dist/core/plugins/ai-agent/composables/index.d.ts.map +1 -1
  13. package/dist/core/plugins/ai-agent/composables/useAiAgent.d.ts +2 -2
  14. package/dist/core/plugins/ai-agent/composables/useAiAgent.d.ts.map +1 -1
  15. package/dist/core/plugins/ai-agent/composables/useAiAgentContext.d.ts +7 -18
  16. package/dist/core/plugins/ai-agent/composables/useAiAgentContext.d.ts.map +1 -1
  17. package/dist/core/plugins/ai-agent/constants.d.ts +0 -5
  18. package/dist/core/plugins/ai-agent/constants.d.ts.map +1 -1
  19. package/dist/core/plugins/ai-agent/index.d.ts +1 -1
  20. package/dist/core/plugins/ai-agent/index.d.ts.map +1 -1
  21. package/dist/core/plugins/ai-agent/public.d.ts +1 -1
  22. package/dist/core/plugins/ai-agent/public.d.ts.map +1 -1
  23. package/dist/core/plugins/ai-agent/services/ai-agent-service.d.ts +1 -5
  24. package/dist/core/plugins/ai-agent/services/ai-agent-service.d.ts.map +1 -1
  25. package/dist/core/plugins/ai-agent/services/message-transport.d.ts +1 -3
  26. package/dist/core/plugins/ai-agent/services/message-transport.d.ts.map +1 -1
  27. package/dist/core/plugins/ai-agent/types.d.ts +1 -44
  28. package/dist/core/plugins/ai-agent/types.d.ts.map +1 -1
  29. package/dist/framework.js +8 -8
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/dist/ui/components/molecules/vc-dropdown-panel/panel-anchor-registry.d.ts +1 -1
  32. package/dist/ui/components/molecules/vc-dropdown-panel/panel-anchor-registry.d.ts.map +1 -1
  33. package/dist/ui/components/molecules/vc-dropdown-panel/vc-dropdown-panel.vue.d.ts +4 -4
  34. package/dist/ui/components/molecules/vc-dropdown-panel/vc-dropdown-panel.vue.d.ts.map +1 -1
  35. package/dist/ui/components/organisms/vc-data-table/VcDataTable.vue.d.ts.map +1 -1
  36. package/dist/ui/components/organisms/vc-data-table/VcTableAdapter.vue.d.ts.map +1 -1
  37. package/dist/ui/components/organisms/vc-data-table/components/GlobalFiltersPanel.vue.d.ts +4 -3
  38. package/dist/ui/components/organisms/vc-data-table/components/GlobalFiltersPanel.vue.d.ts.map +1 -1
  39. package/dist/ui/components/organisms/vc-data-table/components/TableColumnSwitcher.vue.d.ts +4 -3
  40. package/dist/ui/components/organisms/vc-data-table/components/TableColumnSwitcher.vue.d.ts.map +1 -1
  41. package/dist/ui/components/organisms/vc-data-table/composables/useTableColumns.d.ts.map +1 -1
  42. package/dist/ui/components/organisms/vc-data-table/composables/useTableColumnsResize.d.ts +1 -1
  43. package/dist/ui/components/organisms/vc-data-table/composables/useTableColumnsResize.d.ts.map +1 -1
  44. package/dist/ui/composables/useFloatingPosition.d.ts +2 -2
  45. package/dist/ui/composables/useFloatingPosition.d.ts.map +1 -1
  46. package/dist/ui/index.js +2 -2
  47. package/package.json +4 -4
  48. package/dist/chunks/VcTableAdapter.vue_vue_type_style_index_0_lang-HqgHfIV-.js.map +0 -1
  49. package/dist/chunks/index-CacTeJdd.js +0 -117
  50. package/dist/chunks/index-CacTeJdd.js.map +0 -1
  51. package/dist/chunks/vendor-lodash-es-CfnUOh0o.js +0 -1490
  52. package/dist/chunks/vendor-lodash-es-CfnUOh0o.js.map +0 -1
  53. package/dist/core/plugins/ai-agent/utils/deep-merge-changes.d.ts +0 -16
  54. package/dist/core/plugins/ai-agent/utils/deep-merge-changes.d.ts.map +0 -1
  55. package/dist/core/plugins/ai-agent/utils/index.d.ts +0 -2
  56. package/dist/core/plugins/ai-agent/utils/index.d.ts.map +0 -1
@@ -0,0 +1,45 @@
1
+ import { inject as c, computed as b, watch as _, onUnmounted as m } from "vue";
2
+ import { b as v, B as y, d as p, D as C, A as x } from "./VcAiAgentPanel.vue_vue_type_style_index_0_lang-Y09G7Gnw.js";
3
+ const s = p("use-ai-agent-context");
4
+ function D(e) {
5
+ return Array.isArray(e.value);
6
+ }
7
+ function T(e) {
8
+ return Array.isArray(e) ? e : e != null ? [e] : [];
9
+ }
10
+ function G(e) {
11
+ const { dataRef: a, suggestions: r } = e, o = c(v), t = c(y, null), n = b(() => t?.value?.id);
12
+ if (!o) {
13
+ s.debug("AiAgentService not available, context binding disabled");
14
+ return;
15
+ }
16
+ const l = D(a) ? "list" : "details", f = _(a, () => {
17
+ const d = T(a.value), u = l === "details" ? d.map((i) => ({ ...i })) : d.map((i) => ({ id: i.id, objectType: i.objectType, name: i.name }));
18
+ o._setContextData(u, l, r, n.value), s.debug(`Context updated: ${u.length} items, type: ${l}, blade: ${n.value}`);
19
+ }, { deep: !0, immediate: !0 });
20
+ m(() => {
21
+ f(), o._setContextData([], "list", void 0, n.value), s.debug(`Context cleared on unmount for blade: ${n.value}`);
22
+ });
23
+ }
24
+ const g = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, A = p("ai-agent-plugin"), I = {
25
+ install(e, a = {}) {
26
+ const { config: r = {}, addGlobalToolbarButton: o = !0 } = a;
27
+ let t = r.url || "";
28
+ if (!t && typeof import.meta < "u" && g && (t = g[x] || ""), !t) {
29
+ A.info(
30
+ "AI Agent plugin skipped: no URL configured. Set APP_AI_AGENT_URL env variable or pass config.url option."
31
+ );
32
+ return;
33
+ }
34
+ const n = {
35
+ ...C,
36
+ ...r,
37
+ url: t
38
+ };
39
+ e.config.globalProperties.$aiAgentConfig = n, e.provide("aiAgentConfig", n), e.provide("aiAgentAddGlobalToolbarButton", o), A.info(`AI Agent plugin installed. URL: ${t}, addGlobalToolbarButton: ${o}`);
40
+ }
41
+ };
42
+ export {
43
+ I as a,
44
+ G as u
45
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B78ceaW1.js","sources":["../../core/plugins/ai-agent/composables/useAiAgentContext.ts","../../core/plugins/ai-agent/index.ts"],"sourcesContent":["import { inject, computed, watch, onUnmounted, type Ref } from \"vue\";\nimport { AiAgentServiceKey } from \"@framework/injection-keys\";\nimport { BladeDescriptorKey } from \"@core/blade-navigation/types\";\nimport type { IAiAgentServiceInternal } from \"@core/plugins/ai-agent/services/ai-agent-service\";\nimport type { UseAiAgentContextOptions, AiAgentContextType } from \"@core/plugins/ai-agent/types\";\nimport { createLogger } from \"@core/utilities\";\n\nconst logger = createLogger(\"use-ai-agent-context\");\n\n/**\n * Checks if the ref value is an array\n */\nfunction isArrayRef<T>(dataRef: Ref<T> | Ref<T[]>): dataRef is Ref<T[]> {\n return Array.isArray(dataRef.value);\n}\n\n/**\n * Normalizes any ref value to an array for sending to the AI agent\n */\nfunction normalizeToArray<T>(value: T | T[]): T[] {\n if (Array.isArray(value)) {\n return value;\n }\n return value != null ? [value] : [];\n}\n\n/**\n * Composable for binding blade data to AI agent context.\n *\n * Sends data updates to the AI agent when dataRef changes and normalizes\n * single objects to arrays for the agent protocol.\n *\n * @example List blade (array of selected items)\n * ```typescript\n * const { selectedItems } = useTableSelection<Offer>();\n *\n * useAiAgentContext({ dataRef: selectedItems });\n * ```\n *\n * @example Details blade (single object - automatically wrapped in array)\n * ```typescript\n * const offer = ref<Offer>({});\n *\n * useAiAgentContext({ dataRef: offer });\n * ```\n *\n * @example With custom suggestions\n * ```typescript\n * useAiAgentContext({\n * dataRef: offer,\n * suggestions: [\n * {\n * id: \"translate\",\n * title: \"Translate description\",\n * icon: \"translation\",\n * iconColor: \"#FF4A4A\",\n * prompt: \"Translate the offer description to English\"\n * },\n * ],\n * });\n * ```\n */\nexport function useAiAgentContext<\n T extends {\n id?: string | undefined;\n objectType?: string | undefined;\n name?: string | undefined;\n },\n>(options: UseAiAgentContextOptions<T>): void {\n const { dataRef, suggestions } = options;\n\n // Try to get the service (may not be available if plugin not installed)\n const service = inject(AiAgentServiceKey) as IAiAgentServiceInternal | undefined;\n\n // Get current blade descriptor to identify which blade this context belongs to\n const bladeDescriptor = inject(BladeDescriptorKey, null);\n const bladeId = computed(() => bladeDescriptor?.value?.id);\n\n // If service is not available, nothing to bind\n if (!service) {\n logger.debug(\"AiAgentService not available, context binding disabled\");\n return;\n }\n\n // Determine context type based on dataRef type\n // Array ref = list blade (multiple selected items)\n // Single object ref = details blade (single item being edited)\n const detectedContextType: AiAgentContextType = isArrayRef(dataRef) ? \"list\" : \"details\";\n\n // Set context data in service (items, contextType, and suggestions)\n // Always sends an array to the service, normalizing single objects\n // Context is bound to specific blade ID\n const updateContextData = () => {\n const raw = normalizeToArray(dataRef.value);\n const items =\n detectedContextType === \"details\"\n ? raw.map((item) => ({ ...item }))\n : raw.map((item) => ({ id: item.id, objectType: item.objectType, name: item.name }));\n service._setContextData(items, detectedContextType, suggestions, bladeId.value);\n logger.debug(`Context updated: ${items.length} items, type: ${detectedContextType}, blade: ${bladeId.value}`);\n };\n\n // Watch dataRef for changes and update context\n const stopWatch = watch(dataRef, updateContextData, { deep: true, immediate: true });\n\n // Cleanup on unmount\n onUnmounted(() => {\n stopWatch();\n // Clear context for this specific blade when component unmounts\n service._setContextData([], \"list\", undefined, bladeId.value);\n logger.debug(`Context cleared on unmount for blade: ${bladeId.value}`);\n });\n}\n","import type { App } from \"vue\";\r\nimport type { IAiAgentConfig } from \"@core/plugins/ai-agent/types\";\r\nimport { DEFAULT_AI_AGENT_CONFIG, AI_AGENT_URL_ENV_KEY } from \"@core/plugins/ai-agent/constants\";\r\nimport { createLogger } from \"@core/utilities\";\r\n\r\nconst logger = createLogger(\"ai-agent-plugin\");\r\n\r\n/**\r\n * Options for the AI Agent Plugin\r\n */\r\nexport interface AiAgentPluginOptions {\r\n /**\r\n * AI Agent configuration.\r\n * URL can also be set via APP_AI_AGENT_URL environment variable.\r\n */\r\n config?: Partial<IAiAgentConfig>;\r\n\r\n /**\r\n * Whether to add the AI button to all blade toolbars automatically.\r\n * Default: true\r\n */\r\n addGlobalToolbarButton?: boolean;\r\n}\r\n\r\n/**\r\n * Vue plugin for AI Agent integration.\r\n *\r\n * @example\r\n * ```typescript\r\n * import { createApp } from \"vue\";\r\n * import { aiAgentPlugin } from \"@vc-shell/framework\";\r\n *\r\n * const app = createApp(App);\r\n *\r\n * // Install with options\r\n * app.use(aiAgentPlugin, {\r\n * config: {\r\n * title: \"AI Assistant\",\r\n * width: 400,\r\n * },\r\n * addGlobalToolbarButton: true,\r\n * });\r\n * ```\r\n */\r\nexport const aiAgentPlugin = {\r\n install(app: App, options: AiAgentPluginOptions = {}) {\r\n const { config = {}, addGlobalToolbarButton = true } = options;\r\n\r\n // Get URL from environment variable if not provided\r\n let url = config.url || \"\";\r\n if (!url && typeof import.meta !== \"undefined\" && import.meta.env) {\r\n url = import.meta.env[AI_AGENT_URL_ENV_KEY] || \"\";\r\n }\r\n\r\n // Skip installation if no URL configured\r\n if (!url) {\r\n logger.info(\r\n \"AI Agent plugin skipped: no URL configured. Set APP_AI_AGENT_URL env variable or pass config.url option.\",\r\n );\r\n return;\r\n }\r\n\r\n // Merge config with defaults\r\n const finalConfig: IAiAgentConfig = {\r\n ...DEFAULT_AI_AGENT_CONFIG,\r\n ...config,\r\n url,\r\n };\r\n\r\n // Store config in app global properties for access during service creation\r\n app.config.globalProperties.$aiAgentConfig = finalConfig;\r\n app.provide(\"aiAgentConfig\", finalConfig);\r\n app.provide(\"aiAgentAddGlobalToolbarButton\", addGlobalToolbarButton);\r\n\r\n logger.info(`AI Agent plugin installed. URL: ${url}, addGlobalToolbarButton: ${addGlobalToolbarButton}`);\r\n },\r\n};\r\n\r\n// Re-export all types\r\nexport * from \"@core/plugins/ai-agent/types\";\r\nexport * from \"@core/plugins/ai-agent/constants\";\r\n\r\n// Re-export composables\r\nexport {\r\n useAiAgent,\r\n provideAiAgentService,\r\n createAiAgentToolbarButton,\r\n} from \"@core/plugins/ai-agent/composables/useAiAgent\";\r\nexport type { UseAiAgentReturn, ProvideAiAgentServiceOptions } from \"@core/plugins/ai-agent/composables/useAiAgent\";\r\n\r\nexport { useAiAgentContext } from \"@core/plugins/ai-agent/composables/useAiAgentContext\";\r\n\r\n// Re-export components\r\nexport { VcAiAgentPanel } from \"@core/plugins/ai-agent/components\";\r\n\r\n// Re-export service types\r\nexport type {\r\n IAiAgentServiceInternal,\r\n CreateAiAgentServiceOptions,\r\n} from \"@core/plugins/ai-agent/services/ai-agent-service\";\r\n"],"names":["logger","createLogger","isArrayRef","dataRef","normalizeToArray","value","useAiAgentContext","options","suggestions","service","inject","AiAgentServiceKey","bladeDescriptor","BladeDescriptorKey","bladeId","computed","detectedContextType","stopWatch","watch","raw","items","item","onUnmounted","aiAgentPlugin","app","config","addGlobalToolbarButton","url","__vite_import_meta_env__","AI_AGENT_URL_ENV_KEY","finalConfig","DEFAULT_AI_AGENT_CONFIG"],"mappings":";;AAOA,MAAMA,IAASC,EAAa,sBAAsB;AAKlD,SAASC,EAAcC,GAAiD;AACtE,SAAO,MAAM,QAAQA,EAAQ,KAAK;AACpC;AAKA,SAASC,EAAoBC,GAAqB;AAChD,SA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