@blueking/ai-ui-sdk 0.6.0-beta.2 → 0.6.0-beta.21

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 (155) hide show
  1. package/README.md +3 -1
  2. package/dist/common/constants.d.ts +4 -0
  3. package/dist/common/constants.ts.js +30 -0
  4. package/dist/common/util.d.ts +5 -2
  5. package/dist/common/util.ts.js +12 -3
  6. package/dist/components/render-agent/agent-type.vue.css +4 -4
  7. package/dist/components/render-agent/agent-type.vue.js +1 -1
  8. package/dist/components/render-auto-height-textarea/index.vue.css +11 -11
  9. package/dist/components/render-auto-height-textarea/index.vue.js +1 -1
  10. package/dist/components/render-auto-refresh/index.script.vue.js.js +60 -46
  11. package/dist/components/render-auto-refresh/index.vue.js +0 -2
  12. package/dist/components/render-card/agent/prefix-info-tool.vue.css +5 -5
  13. package/dist/components/render-card/agent/prefix-info-tool.vue.js +1 -1
  14. package/dist/components/render-card/agent/upgrade.vue.css +2 -2
  15. package/dist/components/render-card/agent/upgrade.vue.js +1 -1
  16. package/dist/components/render-card/base/approval-strategy-popover.script.vue.js.js +2 -2
  17. package/dist/components/render-card/base.vue.css +13 -13
  18. package/dist/components/render-card/base.vue.js +1 -1
  19. package/dist/components/render-card/llm/corner-badge.vue.css +3 -3
  20. package/dist/components/render-card/llm/corner-badge.vue.js +1 -1
  21. package/dist/components/render-card/llm/icons.vue.css +2 -2
  22. package/dist/components/render-card/llm/icons.vue.js +1 -1
  23. package/dist/components/render-card/llm/info.vue.css +1 -1
  24. package/dist/components/render-card/llm/info.vue.js +1 -1
  25. package/dist/components/render-card/llm/tag-prefix.vue.css +2 -2
  26. package/dist/components/render-card/llm/tag-prefix.vue.js +1 -1
  27. package/dist/components/render-card/mcp/name-suffix.vue.css +2 -2
  28. package/dist/components/render-card/mcp/name-suffix.vue.js +1 -1
  29. package/dist/components/render-card/prompt/icons.vue.css +1 -1
  30. package/dist/components/render-card/prompt/icons.vue.js +1 -1
  31. package/dist/components/render-card/skill/scanner.vue.css +3 -3
  32. package/dist/components/render-card/skill/scanner.vue.js +1 -1
  33. package/dist/components/render-checkbox/index.vue.css +4 -4
  34. package/dist/components/render-checkbox/index.vue.js +1 -1
  35. package/dist/components/render-choose-tag/index.vue.css +7 -7
  36. package/dist/components/render-choose-tag/index.vue.js +1 -1
  37. package/dist/components/render-collapse/index.vue.css +2 -2
  38. package/dist/components/render-collapse/index.vue.js +1 -1
  39. package/dist/components/render-collection/content/index.vue.css +4 -4
  40. package/dist/components/render-collection/content/index.vue.js +1 -1
  41. package/dist/components/render-dataset/components/batch-delete-dataset-data/index.vue.css +3 -3
  42. package/dist/components/render-dataset/components/batch-delete-dataset-data/index.vue.js +1 -1
  43. package/dist/components/render-dataset/components/edit-dataset-data/index.vue.css +3 -3
  44. package/dist/components/render-dataset/components/edit-dataset-data/index.vue.js +1 -1
  45. package/dist/components/render-dataset/components/operation-record/index.vue.css +4 -4
  46. package/dist/components/render-dataset/components/operation-record/index.vue.js +1 -1
  47. package/dist/components/render-dataset/components/operation-record/table/index.vue.css +1 -1
  48. package/dist/components/render-dataset/components/operation-record/table/index.vue.js +1 -1
  49. package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.css +2 -2
  50. package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.js +1 -1
  51. package/dist/components/render-dataset/components/plus-dataset/index.vue.css +1 -1
  52. package/dist/components/render-dataset/components/plus-dataset/index.vue.js +1 -1
  53. package/dist/components/render-dataset/components/plus-dataset-data/form/api.vue.css +2 -2
  54. package/dist/components/render-dataset/components/plus-dataset-data/form/api.vue.js +1 -1
  55. package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.css +1 -1
  56. package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.js +1 -1
  57. package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.css +1 -1
  58. package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.js +1 -1
  59. package/dist/components/render-dataset/components/review-dataset-data/index.vue.css +10 -10
  60. package/dist/components/render-dataset/components/review-dataset-data/index.vue.js +1 -1
  61. package/dist/components/render-dataset-detail-origin-data/index.vue.css +3 -3
  62. package/dist/components/render-dataset-detail-origin-data/index.vue.js +1 -1
  63. package/dist/components/render-dataset-list/components/main.vue.css +3 -3
  64. package/dist/components/render-dataset-list/components/main.vue.js +1 -1
  65. package/dist/components/render-dataset-list/index.vue.css +2 -2
  66. package/dist/components/render-dataset-list/index.vue.js +1 -1
  67. package/dist/components/render-dialog/choose-resource.vue.css +3 -3
  68. package/dist/components/render-dialog/choose-resource.vue.js +1 -1
  69. package/dist/components/render-dialog/choose-result.vue.css +14 -14
  70. package/dist/components/render-dialog/choose-result.vue.js +1 -1
  71. package/dist/components/render-dialog/choose-space.vue.css +9 -9
  72. package/dist/components/render-dialog/choose-space.vue.js +1 -1
  73. package/dist/components/render-dialog/index.vue.css +6 -6
  74. package/dist/components/render-dialog/index.vue.js +1 -1
  75. package/dist/components/render-dropdown/index.vue.css +1 -0
  76. package/dist/components/render-exception/index.vue.css +9 -9
  77. package/dist/components/render-exception/index.vue.js +1 -1
  78. package/dist/components/render-file-card/index.vue.css +11 -11
  79. package/dist/components/render-file-card/index.vue.js +1 -1
  80. package/dist/components/render-file-type-icon/index.vue.css +6 -6
  81. package/dist/components/render-file-type-icon/index.vue.js +1 -1
  82. package/dist/components/render-generate-tag/index.script.vue.js.js +6 -0
  83. package/dist/components/render-generate-tag/index.vue.css +13 -5
  84. package/dist/components/render-generate-tag/index.vue.js +1 -1
  85. package/dist/components/render-header/index.script.vue.js.js +5 -2
  86. package/dist/components/render-knowledge/icon/index.vue.css +1 -1
  87. package/dist/components/render-knowledge/icon/index.vue.js +1 -1
  88. package/dist/components/render-markdown/common.ts.js +2 -1
  89. package/dist/components/render-markdown/edit.postcss.css +16 -0
  90. package/dist/components/render-markdown/edit.ts.js +18 -8
  91. package/dist/components/render-markdown/filter-css.ts.js +3 -8
  92. package/dist/components/render-markdown/html.d.ts +2 -0
  93. package/dist/components/render-markdown/html.ts.js +67 -0
  94. package/dist/components/render-markdown/image.d.ts +3 -0
  95. package/dist/components/render-markdown/image.ts.js +98 -0
  96. package/dist/components/render-markdown/katex.ts.js +14 -4
  97. package/dist/components/render-markdown/view.d.ts +10 -0
  98. package/dist/components/render-markdown/view.ts.js +69 -2
  99. package/dist/components/render-prompt/content/index.vue.css +1 -1
  100. package/dist/components/render-prompt/content/index.vue.js +1 -1
  101. package/dist/components/render-reference/index.vue.css +2 -2
  102. package/dist/components/render-reference/index.vue.js +1 -1
  103. package/dist/components/render-resource-version/index.vue.css +2 -2
  104. package/dist/components/render-resource-version/index.vue.js +1 -1
  105. package/dist/components/render-router-tab/index.vue.css +3 -3
  106. package/dist/components/render-router-tab/index.vue.js +1 -1
  107. package/dist/components/render-select-plus-extension/index.vue.css +3 -3
  108. package/dist/components/render-select-plus-extension/index.vue.js +1 -1
  109. package/dist/components/render-skill/install/index.script.vue.js.js +38 -28
  110. package/dist/components/render-skill/install/{openclaw-windows-instances.script.vue.js.js → openclaw-instances.script.vue.js.js} +23 -21
  111. package/dist/components/render-skill/install/{openclaw-windows-instances.vue.d.ts → openclaw-instances.vue.d.ts} +6 -4
  112. package/dist/components/render-skill/install/openclaw-instances.vue.js +3 -0
  113. package/dist/components/render-t-table/index.vue.css +33 -29
  114. package/dist/components/render-t-table/index.vue.js +1 -1
  115. package/dist/components/render-tag-tree/index.vue.css +7 -7
  116. package/dist/components/render-tag-tree/index.vue.js +1 -1
  117. package/dist/components/render-tags/index.vue.css +6 -6
  118. package/dist/components/render-tags/index.vue.js +1 -1
  119. package/dist/components/render-tree/index.script.vue.js +1 -1
  120. package/dist/css/bk-icon/fonts/iconcool.eot +0 -0
  121. package/dist/css/bk-icon/fonts/iconcool.svg +3 -0
  122. package/dist/css/bk-icon/fonts/iconcool.ttf +0 -0
  123. package/dist/css/bk-icon/fonts/iconcool.woff +0 -0
  124. package/dist/css/bk-icon/iconcool.js +1 -1
  125. package/dist/css/bk-icon/style.css +3 -0
  126. package/dist/css/bk-patch.css +31 -6
  127. package/dist/css/g-utilities.css +71 -0
  128. package/dist/css/g-utilities.manifest.json +17 -0
  129. package/dist/css/variable/token.d.ts +11 -0
  130. package/dist/css/variable/token.ts.js +16 -1
  131. package/dist/hooks/use-form-rule.d.ts +31 -2
  132. package/dist/hooks/use-form-rule.ts.js +65 -26
  133. package/dist/hooks/use-meta-http.d.ts +6 -2
  134. package/dist/hooks/use-meta-http.ts.js +19 -5
  135. package/dist/hooks/use-scroll-load.d.ts +12 -3
  136. package/dist/hooks/use-skill-http.d.ts +7 -6
  137. package/dist/hooks/use-skill-http.ts.js +19 -17
  138. package/dist/hooks.d.ts +1 -0
  139. package/dist/hooks.ts.js +1 -0
  140. package/dist/http/helper/agent.ts.js +12 -2
  141. package/dist/http/helper/model.ts.js +42 -1
  142. package/dist/http/helper/skill.d.ts +9 -9
  143. package/dist/http/helper/skill.ts.js +12 -10
  144. package/dist/i18n/en-US.d.ts +20 -0
  145. package/dist/i18n/en-US.ts.js +21 -1
  146. package/dist/i18n/zh-CN.d.ts +20 -0
  147. package/dist/i18n/zh-CN.ts.js +21 -1
  148. package/dist/types/agent.d.ts +11 -1
  149. package/dist/types/enum.d.ts +6 -1
  150. package/dist/types/enum.ts.js +6 -0
  151. package/dist/types/model.d.ts +16 -0
  152. package/dist/types/skill.d.ts +26 -22
  153. package/package.json +3 -3
  154. package/dist/components/render-auto-refresh/index.vue.css +0 -46
  155. package/dist/components/render-skill/install/openclaw-windows-instances.vue.js +0 -3
@@ -64,6 +64,16 @@ const CODE_NODE_TYPES = new Set([
64
64
  'htmlBlock',
65
65
  'htmlInline'
66
66
  ]);
67
+ const XML_ESCAPE_MAP = {
68
+ '&': '&',
69
+ '<': '&lt;',
70
+ '>': '&gt;',
71
+ '"': '&quot;',
72
+ '\'': '&#39;'
73
+ };
74
+ function escapeXml(value) {
75
+ return value.replace(/[&<>"']/g, (char)=>XML_ESCAPE_MAP[char]);
76
+ }
67
77
  function isEscaped(value, index) {
68
78
  let count = 0;
69
79
  let i = index - 1;
@@ -178,7 +188,7 @@ export function createTuiKatexCustomRenderer(options = {}) {
178
188
  try {
179
189
  html += renderKatexToHtml(mathState.content, mathState.display, options);
180
190
  } catch (e) {
181
- html += `${mathState.open}${mathState.content}${mathState.close}`;
191
+ html += escapeXml(`${mathState.open}${mathState.content}${mathState.close}`);
182
192
  }
183
193
  index = closeIndex + mathState.close.length;
184
194
  mathState = null;
@@ -186,11 +196,11 @@ export function createTuiKatexCustomRenderer(options = {}) {
186
196
  }
187
197
  const nextOpen = findNextOpen(value, index);
188
198
  if (!nextOpen) {
189
- html += value.slice(index);
199
+ html += escapeXml(value.slice(index));
190
200
  break;
191
201
  }
192
202
  hasMath = true;
193
- html += value.slice(index, nextOpen.index);
203
+ html += escapeXml(value.slice(index, nextOpen.index));
194
204
  mathState = {
195
205
  open: nextOpen.open,
196
206
  close: nextOpen.close,
@@ -208,7 +218,7 @@ export function createTuiKatexCustomRenderer(options = {}) {
208
218
  if (!mathState) return '';
209
219
  const raw = `${mathState.open}${mathState.content}`;
210
220
  mathState = null;
211
- return raw;
221
+ return escapeXml(raw);
212
222
  }
213
223
  function renderBlock(node) {
214
224
  let html = '';
@@ -1,5 +1,9 @@
1
+ import { type PropType } from 'vue';
1
2
  import '@toast-ui/editor/dist/toastui-editor-viewer.css';
2
3
  import './view.postcss';
4
+ interface IMarkdownRequestOptions {
5
+ headers?: Record<string, string> | (() => Record<string, string>);
6
+ }
3
7
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
8
  value: {
5
9
  type: StringConstructor;
@@ -12,6 +16,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
12
16
  type: StringConstructor;
13
17
  default: string;
14
18
  };
19
+ requestOptions: {
20
+ type: PropType<IMarkdownRequestOptions | (() => IMarkdownRequestOptions)>;
21
+ };
15
22
  }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
16
23
  [key: string]: any;
17
24
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -26,6 +33,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
26
33
  type: StringConstructor;
27
34
  default: string;
28
35
  };
36
+ requestOptions: {
37
+ type: PropType<IMarkdownRequestOptions | (() => IMarkdownRequestOptions)>;
38
+ };
29
39
  }>> & Readonly<{}>, {
30
40
  previewBackground: string;
31
41
  padding: string;
@@ -26,10 +26,35 @@ function _object_spread(target) {
26
26
  }
27
27
  return target;
28
28
  }
29
+ function ownKeys(object, enumerableOnly) {
30
+ var keys = Object.keys(object);
31
+ if (Object.getOwnPropertySymbols) {
32
+ var symbols = Object.getOwnPropertySymbols(object);
33
+ if (enumerableOnly) {
34
+ symbols = symbols.filter(function(sym) {
35
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
36
+ });
37
+ }
38
+ keys.push.apply(keys, symbols);
39
+ }
40
+ return keys;
41
+ }
42
+ function _object_spread_props(target, source) {
43
+ source = source != null ? source : {};
44
+ if (Object.getOwnPropertyDescriptors) {
45
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
46
+ } else {
47
+ ownKeys(Object(source)).forEach(function(key) {
48
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
49
+ });
50
+ }
51
+ return target;
52
+ }
29
53
  import { defineComponent, h, onMounted, onUnmounted, ref, watch } from 'vue';
30
54
  import Viewer from '@toast-ui/editor/dist/toastui-editor-viewer';
31
55
  import { commonConfig } from './common.ts.js';
32
56
  import { escapeHtml } from './filter-css.ts.js';
57
+ import { createImageCustomRenderer, REQUEST_IMAGE_ATTR } from './image.ts.js';
33
58
  import '@toast-ui/editor/dist/toastui-editor-viewer.css';
34
59
  import './view.postcss.css';
35
60
  export default defineComponent({
@@ -44,28 +69,70 @@ export default defineComponent({
44
69
  padding: {
45
70
  type: String,
46
71
  default: '12px 16px'
72
+ },
73
+ requestOptions: {
74
+ type: [
75
+ Object,
76
+ Function
77
+ ]
47
78
  }
48
79
  },
49
80
  setup (props) {
50
81
  const viewerRef = ref();
82
+ const imageObjectUrls = new Map();
51
83
  let viewer;
84
+ const getRequestHeaders = ()=>{
85
+ const { requestOptions } = props;
86
+ const { headers } = (typeof requestOptions === 'function' ? requestOptions() : requestOptions) || {};
87
+ return typeof headers === 'function' ? headers() : headers;
88
+ };
89
+ const requestImage = (url)=>{
90
+ if (!imageObjectUrls.has(url)) {
91
+ imageObjectUrls.set(url, fetch(url, {
92
+ credentials: 'include',
93
+ headers: getRequestHeaders()
94
+ }).then((response)=>{
95
+ if (!response.ok) throw new Error(response.statusText);
96
+ return response.blob();
97
+ }).then((blob)=>URL.createObjectURL(blob)));
98
+ }
99
+ return imageObjectUrls.get(url);
100
+ };
101
+ const handleRequestImages = ()=>{
102
+ if (!props.requestOptions) return;
103
+ viewerRef.value.querySelectorAll(`img[${REQUEST_IMAGE_ATTR}]`).forEach((img)=>{
104
+ const url = img.getAttribute(REQUEST_IMAGE_ATTR);
105
+ img.removeAttribute(REQUEST_IMAGE_ATTR);
106
+ if (!url) return;
107
+ requestImage(url).then((objectUrl)=>img.setAttribute('src', objectUrl)).catch(()=>imageObjectUrls.delete(url));
108
+ });
109
+ };
110
+ const handleRevokeImages = ()=>{
111
+ imageObjectUrls.forEach((objectUrl)=>objectUrl.then(URL.revokeObjectURL, ()=>{}));
112
+ imageObjectUrls.clear();
113
+ };
52
114
  const handleInit = ()=>{
53
- viewer = new Viewer(_object_spread({
115
+ viewer = new Viewer(_object_spread_props(_object_spread({
54
116
  el: viewerRef.value,
55
117
  initialValue: props.value,
56
118
  customHTMLSanitizer: escapeHtml
57
- }, commonConfig));
119
+ }, commonConfig), {
120
+ customHTMLRenderer: _object_spread({}, commonConfig.customHTMLRenderer, createImageCustomRenderer(()=>!!props.requestOptions))
121
+ }));
58
122
  viewer.eventEmitter.listen('updatePreview', (editResult)=>{
59
123
  editResult.forEach((item)=>viewer.preview.replaceRangeNodes(item));
60
124
  });
125
+ handleRequestImages();
61
126
  };
62
127
  const handleDestroy = ()=>{
63
128
  viewer.destroy();
64
129
  viewer = null;
130
+ handleRevokeImages();
65
131
  };
66
132
  watch(()=>props.value, (value)=>{
67
133
  if (!viewer) return;
68
134
  viewer.setMarkdown(value || '');
135
+ handleRequestImages();
69
136
  });
70
137
  onMounted(handleInit);
71
138
  onUnmounted(handleDestroy);
@@ -1,5 +1,5 @@
1
1
 
2
- .resource-card-description[data-v-cbenh7ls] {
2
+ .resource-card-description[data-v-oqrzci9p] {
3
3
  color: var(--aidev-main-color);
4
4
  height: 120px;
5
5
  white-space: pre-wrap;
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js.js';
2
- script.__scopeId = "data-v-cbenh7ls";
2
+ script.__scopeId = "data-v-oqrzci9p";
3
3
  script.__file = "./src/components/render-prompt/content/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -1,8 +1,8 @@
1
1
 
2
- .reference-table[data-v-0z5z21j7]{
2
+ .reference-table[data-v-fur7zv4x]{
3
3
  padding: 18px 24px;
4
4
  }
5
- .bk-radio-button[data-v-0z5z21j7]{
5
+ .bk-radio-button[data-v-fur7zv4x]{
6
6
  flex: 1;
7
7
  text-align: center;
8
8
  }
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js';
2
- script.__scopeId = "data-v-0z5z21j7";
2
+ script.__scopeId = "data-v-fur7zv4x";
3
3
  script.__file = "./src/components/render-reference/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -1,11 +1,11 @@
1
1
 
2
- .resource-version[data-v-p6bocenh] {
2
+ .resource-version[data-v-hvrnrb7c] {
3
3
  border-radius: var(--aidev-radius-s);
4
4
  text-align: left;
5
5
  color: var(--aidev-tag-color);
6
6
  background-color: var(--aidev-tag-background);
7
7
  white-space: nowrap;
8
8
  }
9
- .resource-version .bkaidev-rizhifenxi[data-v-p6bocenh] {
9
+ .resource-version .bkaidev-rizhifenxi[data-v-hvrnrb7c] {
10
10
  color: var(--aidev-clickable-color);
11
11
  }
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js.js';
2
- script.__scopeId = "data-v-p6bocenh";
2
+ script.__scopeId = "data-v-hvrnrb7c";
3
3
  script.__file = "./src/components/render-resource-version/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -1,12 +1,12 @@
1
1
 
2
- .router-tab[data-v-rjl6t06s] {
2
+ .router-tab[data-v-fr8durga] {
3
3
  margin-top: 2px;
4
4
  height: 42px;
5
5
  background: #FFFFFF;
6
6
  box-shadow: 0 2px 4px 0 #1919290d;
7
7
  padding: 0 24px;
8
8
  }
9
- .router-tab a[data-v-rjl6t06s] {
9
+ .router-tab a[data-v-fr8durga] {
10
10
  padding: 0 8px;
11
11
  margin-right: 24px;
12
12
  font-size: 14px;
@@ -15,7 +15,7 @@
15
15
  color: var(--aidev-main-color);
16
16
  box-sizing: border-box;
17
17
  }
18
- .router-tab a.router-link-exact-active[data-v-rjl6t06s] {
18
+ .router-tab a.router-link-exact-active[data-v-fr8durga] {
19
19
  color: var(--aidev-clickable-color);
20
20
  border-bottom: 2px solid var(--aidev-clickable-color);
21
21
  }
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js.js';
2
- script.__scopeId = "data-v-rjl6t06s";
2
+ script.__scopeId = "data-v-fr8durga";
3
3
  script.__file = "./src/components/render-router-tab/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -1,5 +1,5 @@
1
1
 
2
- .select-plus-extension[data-v-oabc10gw] {
2
+ .select-plus-extension[data-v-ab8oqp53] {
3
3
  cursor: pointer;
4
4
  width: 100%;
5
5
  display: flex;
@@ -8,10 +8,10 @@
8
8
  font-size: 12px;
9
9
  line-height: 20px;
10
10
  }
11
- .select-plus-extension .ai-ui-sdk-icon[data-v-oabc10gw] {
11
+ .select-plus-extension .ai-ui-sdk-icon[data-v-ab8oqp53] {
12
12
  font-size: 14px;
13
13
  margin-right: 6px;
14
14
  }
15
- .select-plus-extension[data-v-oabc10gw]:hover {
15
+ .select-plus-extension[data-v-ab8oqp53]:hover {
16
16
  color: var(--aidev-clickable-color);
17
17
  }
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js.js';
2
- script.__scopeId = "data-v-oabc10gw";
2
+ script.__scopeId = "data-v-ab8oqp53";
3
3
  script.__file = "./src/components/render-select-plus-extension/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -93,7 +93,7 @@ const _hoisted_3 = {
93
93
  import { Message } from 'bkui-vue';
94
94
  import { onBeforeUnmount, ref, toRef, useTemplateRef, watch } from 'vue';
95
95
  import RenderInstallGuide from './install-guide.vue.js';
96
- import RenderOpenclawWindowsInstances from './openclaw-windows-instances.vue.js';
96
+ import RenderOpenclawInstances from './openclaw-instances.vue.js';
97
97
  import { TEN_SECONDS } from '../../../common/constants.ts.js';
98
98
  import { useSkillHttp } from '../../../hooks/use-skill-http.ts.js';
99
99
  import { t } from '../../../i18n/index.ts.js';
@@ -113,48 +113,53 @@ export default /*@__PURE__*/ _defineComponent({
113
113
  setup (__props, { emit: __emit }) {
114
114
  const props = __props;
115
115
  const emits = __emit;
116
- const { getSkillInstallTargets, installSkillToOpenclawWindows, getSkillOpenclawWindowsInstallTasksStatus } = useSkillHttp(props.apiPrefix, toRef(props, 'spaceId'));
116
+ const { getSkillInstallTargets, installSkillToOpenclaw, getSkillOpenclawInstallTasksStatus } = useSkillHttp(props.apiPrefix, toRef(props, 'spaceId'));
117
117
  const formRef = useTemplateRef('formRef');
118
118
  const isLoadingInstallTargets = ref(false);
119
119
  const isConfirming = ref(false);
120
120
  const installTargets = ref([]);
121
121
  const selectedInstallTargetType = ref();
122
- const selectedOpenclawWindowsInstances = ref([]);
122
+ const selectedOpenclawInstances = ref([]);
123
123
  let isPollingStopped = false;
124
+ const getIsShowInstances = ()=>[
125
+ SkillInstallTargetType.OpenclawWindows,
126
+ SkillInstallTargetType.OpenclawLinux
127
+ ].includes(selectedInstallTargetType.value);
124
128
  const handleClose = ()=>{
125
129
  emits('update:isShow', false);
126
130
  };
127
131
  const handleConfirm = ()=>{
128
132
  switch(selectedInstallTargetType.value){
129
- case SkillInstallTargetType.OpenclawLinux:
130
133
  case SkillInstallTargetType.Cursor:
131
134
  handleClose();
132
135
  break;
136
+ case SkillInstallTargetType.OpenclawLinux:
133
137
  case SkillInstallTargetType.OpenclawWindows:
134
- handleInstallOpenclawWindows();
138
+ handleInstallOpenclaw();
135
139
  break;
136
140
  default:
137
141
  break;
138
142
  }
139
143
  };
140
- const handleInstallOpenclawWindows = function() {
144
+ const handleInstallOpenclaw = function() {
141
145
  var _ref = _async_to_generator(function*() {
142
146
  try {
143
147
  var _formRef_value;
144
148
  yield (_formRef_value = formRef.value) === null || _formRef_value === void 0 ? void 0 : _formRef_value.validate();
145
149
  isConfirming.value = true;
146
150
  isPollingStopped = false;
147
- const installTasks = yield installSkillToOpenclawWindows({
151
+ const installTasks = yield installSkillToOpenclaw({
148
152
  skillId: props.selectedSkill.id,
149
- workspaces: selectedOpenclawWindowsInstances.value
153
+ workspaces: selectedOpenclawInstances.value,
154
+ targetType: selectedInstallTargetType.value
150
155
  });
151
156
  const taskIds = Object.values(installTasks).map((task)=>task.taskId);
152
157
  const taskHostMap = Object.entries(installTasks).reduce((result, [hostName, task])=>_object_spread_props(_object_spread({}, result), {
153
158
  [String(task.taskId)]: hostName
154
159
  }), {});
155
- const loopGetSkillOpenclawWindowsInstallTask = function() {
160
+ const loopGetSkillOpenclawInstallTask = function() {
156
161
  var _ref = _async_to_generator(function*() {
157
- const taskStatusMap = yield getSkillOpenclawWindowsInstallTasksStatus({
162
+ const taskStatusMap = yield getSkillOpenclawInstallTasksStatus({
158
163
  taskIds
159
164
  });
160
165
  let isRunning = false;
@@ -189,7 +194,7 @@ export default /*@__PURE__*/ _defineComponent({
189
194
  });
190
195
  // 如果未停止轮询,则继续轮询
191
196
  if (!isPollingStopped) {
192
- yield loopGetSkillOpenclawWindowsInstallTask();
197
+ yield loopGetSkillOpenclawInstallTask();
193
198
  }
194
199
  return;
195
200
  }
@@ -208,24 +213,24 @@ export default /*@__PURE__*/ _defineComponent({
208
213
  });
209
214
  handleClose();
210
215
  });
211
- return function loopGetSkillOpenclawWindowsInstallTask() {
216
+ return function loopGetSkillOpenclawInstallTask() {
212
217
  return _ref.apply(this, arguments);
213
218
  };
214
219
  }();
215
- yield loopGetSkillOpenclawWindowsInstallTask();
220
+ yield loopGetSkillOpenclawInstallTask();
216
221
  } catch (error) {
217
222
  console.error(error);
218
223
  } finally{
219
224
  isConfirming.value = false;
220
225
  }
221
226
  });
222
- return function handleInstallOpenclawWindows() {
227
+ return function handleInstallOpenclaw() {
223
228
  return _ref.apply(this, arguments);
224
229
  };
225
230
  }();
226
231
  const handleClearTimer = ()=>{
227
232
  isPollingStopped = true;
228
- getSkillOpenclawWindowsInstallTasksStatus.abort();
233
+ getSkillOpenclawInstallTasksStatus.abort();
229
234
  };
230
235
  const handleGetInstallTargets = ()=>{
231
236
  isLoadingInstallTargets.value = true;
@@ -238,11 +243,11 @@ export default /*@__PURE__*/ _defineComponent({
238
243
  });
239
244
  };
240
245
  const handleChangeInstallTargetType = ()=>{
241
- selectedOpenclawWindowsInstances.value = [];
246
+ selectedOpenclawInstances.value = [];
242
247
  };
243
248
  const handleClearChoosen = ()=>{
244
249
  selectedInstallTargetType.value = undefined;
245
- selectedOpenclawWindowsInstances.value = [];
250
+ selectedOpenclawInstances.value = [];
246
251
  };
247
252
  watch(()=>props.isShow, (val)=>{
248
253
  if (val) {
@@ -277,7 +282,7 @@ export default /*@__PURE__*/ _defineComponent({
277
282
  _createVNode(_component_bk_form, {
278
283
  model: {
279
284
  selectedInstallTargetType: selectedInstallTargetType.value,
280
- selectedOpenclawWindowsInstances: selectedOpenclawWindowsInstances.value
285
+ selectedOpenclawInstances: selectedOpenclawInstances.value
281
286
  },
282
287
  ref_key: "formRef",
283
288
  ref: formRef,
@@ -289,7 +294,8 @@ export default /*@__PURE__*/ _defineComponent({
289
294
  class: _normalizeClass({
290
295
  '!g-mb-6': [
291
296
  _unref(SkillInstallTargetType).OpenclawLinux,
292
- _unref(SkillInstallTargetType).Cursor
297
+ _unref(SkillInstallTargetType).Cursor,
298
+ _unref(SkillInstallTargetType).OpenclawWindows
293
299
  ].includes(selectedInstallTargetType.value)
294
300
  }),
295
301
  label: _unref(t)('安装至'),
@@ -319,7 +325,8 @@ export default /*@__PURE__*/ _defineComponent({
319
325
  ]),
320
326
  [
321
327
  _unref(SkillInstallTargetType).OpenclawLinux,
322
- _unref(SkillInstallTargetType).Cursor
328
+ _unref(SkillInstallTargetType).Cursor,
329
+ _unref(SkillInstallTargetType).OpenclawWindows
323
330
  ].includes(selectedInstallTargetType.value) ? (_openBlock(), _createBlock(RenderInstallGuide, {
324
331
  key: 0,
325
332
  "skill-install-target-type": selectedInstallTargetType.value,
@@ -332,25 +339,28 @@ export default /*@__PURE__*/ _defineComponent({
332
339
  "space-id",
333
340
  "id"
334
341
  ])) : _createCommentVNode("v-if", true),
335
- selectedInstallTargetType.value === _unref(SkillInstallTargetType).OpenclawWindows ? (_openBlock(), _createBlock(_component_bk_form_item, {
342
+ getIsShowInstances() ? (_openBlock(), _createBlock(_component_bk_form_item, {
336
343
  key: 1,
337
344
  label: _unref(t)('Openclaw 实例'),
338
- property: "selectedOpenclawWindowsInstances",
345
+ property: "selectedOpenclawInstances",
339
346
  required: ""
340
347
  }, {
341
348
  default: _withCtx(()=>[
342
- _createVNode(RenderOpenclawWindowsInstances, {
343
- "selected-openclaw-windows-instances": selectedOpenclawWindowsInstances.value,
344
- "onUpdate:selectedOpenclawWindowsInstances": _cache[1] || (_cache[1] = ($event)=>selectedOpenclawWindowsInstances.value = $event),
349
+ (_openBlock(), _createBlock(RenderOpenclawInstances, {
350
+ "selected-openclaw-instances": selectedOpenclawInstances.value,
351
+ "onUpdate:selectedOpenclawInstances": _cache[1] || (_cache[1] = ($event)=>selectedOpenclawInstances.value = $event),
352
+ "target-type": selectedInstallTargetType.value,
345
353
  "skill-id": props.selectedSkill.id,
346
354
  "api-prefix": props.apiPrefix,
347
- "space-id": props.spaceId
355
+ "space-id": props.spaceId,
356
+ key: selectedInstallTargetType.value
348
357
  }, null, 8 /* PROPS */ , [
349
- "selected-openclaw-windows-instances",
358
+ "selected-openclaw-instances",
359
+ "target-type",
350
360
  "skill-id",
351
361
  "api-prefix",
352
362
  "space-id"
353
- ])
363
+ ]))
354
364
  ]),
355
365
  _: 1 /* STABLE */
356
366
  }, 8 /* PROPS */ , [
@@ -26,24 +26,25 @@ import { useSkillHttp } from '../../../hooks/use-skill-http.ts.js';
26
26
  import { t } from '../../../i18n/index.ts.js';
27
27
  export default /*@__PURE__*/ _defineComponent({
28
28
  props: {
29
- selectedOpenclawWindowsInstances: {},
29
+ selectedOpenclawInstances: {},
30
+ targetType: {},
30
31
  skillId: {},
31
32
  apiPrefix: {},
32
33
  spaceId: {}
33
34
  },
34
35
  emits: [
35
- "update:selectedOpenclawWindowsInstances"
36
+ "update:selectedOpenclawInstances"
36
37
  ],
37
38
  setup (__props, { emit: __emit }) {
38
39
  const props = __props;
39
40
  const emits = __emit;
40
- const { getSkillOpenclawWindowsInstances, getSkillOpenclawWindowsInstancesStatus } = useSkillHttp(props.apiPrefix, toRef(props, 'spaceId'));
41
+ const { getSkillOpenclawInstances, getSkillOpenclawInstancesStatus } = useSkillHttp(props.apiPrefix, toRef(props, 'spaceId'));
41
42
  const isLoadingInstances = ref(false);
42
43
  const isLoadingInstanceStatus = ref(false);
43
- const openclawWindowsInstances = ref([]);
44
+ const openclawInstances = ref([]);
44
45
  const instanceStatusMap = ref({});
45
46
  const getIsInstanceChecked = (instance)=>{
46
- const isSelected = props.selectedOpenclawWindowsInstances.some((item)=>item.hostName === instance.hostName);
47
+ const isSelected = props.selectedOpenclawInstances.some((item)=>item.hostName === instance.hostName);
47
48
  const isInstalled = getIsInstanceInstalled(instance);
48
49
  return isSelected || isInstalled;
49
50
  };
@@ -51,39 +52,40 @@ export default /*@__PURE__*/ _defineComponent({
51
52
  var _instanceStatusMap_value_instance_hostName;
52
53
  return (_instanceStatusMap_value_instance_hostName = instanceStatusMap.value[instance.hostName]) === null || _instanceStatusMap_value_instance_hostName === void 0 ? void 0 : _instanceStatusMap_value_instance_hostName.isInstalled;
53
54
  };
54
- const handleSelectOpenclawWindowsInstance = (instance)=>{
55
+ const handleSelectOpenclawInstance = (instance)=>{
55
56
  if (isLoadingInstanceStatus.value || getIsInstanceInstalled(instance)) return;
56
- if (props.selectedOpenclawWindowsInstances.some((item)=>item.hostName === instance.hostName)) {
57
- emits('update:selectedOpenclawWindowsInstances', props.selectedOpenclawWindowsInstances.filter((item)=>item.hostName !== instance.hostName));
57
+ if (props.selectedOpenclawInstances.some((item)=>item.hostName === instance.hostName)) {
58
+ emits('update:selectedOpenclawInstances', props.selectedOpenclawInstances.filter((item)=>item.hostName !== instance.hostName));
58
59
  } else {
59
- emits('update:selectedOpenclawWindowsInstances', [
60
- ...props.selectedOpenclawWindowsInstances,
60
+ emits('update:selectedOpenclawInstances', [
61
+ ...props.selectedOpenclawInstances,
61
62
  instance
62
63
  ]);
63
64
  }
64
65
  };
65
- const handleGetOpenclawWindowsInstanceStatus = (workspaces)=>{
66
+ const handleGetOpenclawInstanceStatus = (workspaces)=>{
66
67
  if (workspaces.length <= 0) return;
67
68
  isLoadingInstanceStatus.value = true;
68
- getSkillOpenclawWindowsInstancesStatus({
69
+ getSkillOpenclawInstancesStatus({
69
70
  skillId: props.skillId,
70
- workspaces
71
+ workspaces,
72
+ targetType: props.targetType
71
73
  }).then((res)=>{
72
74
  instanceStatusMap.value = res;
73
75
  }).finally(()=>{
74
76
  isLoadingInstanceStatus.value = false;
75
77
  });
76
78
  };
77
- const handleGetOpenclawWindowsInstances = ()=>{
79
+ const handleGetOpenclawInstances = ()=>{
78
80
  isLoadingInstances.value = true;
79
- getSkillOpenclawWindowsInstances().then((res)=>{
80
- openclawWindowsInstances.value = res;
81
- handleGetOpenclawWindowsInstanceStatus(res);
81
+ getSkillOpenclawInstances(props.targetType).then((res)=>{
82
+ openclawInstances.value = res;
83
+ handleGetOpenclawInstanceStatus(res);
82
84
  }).finally(()=>{
83
85
  isLoadingInstances.value = false;
84
86
  });
85
87
  };
86
- onBeforeMount(handleGetOpenclawWindowsInstances);
88
+ onBeforeMount(handleGetOpenclawInstances);
87
89
  return (_ctx, _cache)=>{
88
90
  const _component_bk_loading = _resolveComponent("bk-loading");
89
91
  return _openBlock(), _createBlock(_component_bk_loading, {
@@ -91,7 +93,7 @@ export default /*@__PURE__*/ _defineComponent({
91
93
  class: "g-max-h-400 g-scrollbar g-min-h-98"
92
94
  }, {
93
95
  default: _withCtx(()=>[
94
- (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(openclawWindowsInstances.value, (instance, index)=>{
96
+ (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(openclawInstances.value, (instance, index)=>{
95
97
  return _openBlock(), _createElementBlock("section", {
96
98
  class: _normalizeClass([
97
99
  'g-flex-row g-rounded-[var(--aidev-radius)]',
@@ -101,7 +103,7 @@ export default /*@__PURE__*/ _defineComponent({
101
103
  isLoadingInstanceStatus.value ? 'g-disabled' : 'g-cursor-pointer'
102
104
  ]),
103
105
  key: instance.hostName,
104
- onClick: ($event)=>handleSelectOpenclawWindowsInstance(instance)
106
+ onClick: ($event)=>handleSelectOpenclawInstance(instance)
105
107
  }, [
106
108
  _createElementVNode("section", _hoisted_2, [
107
109
  _createElementVNode("h3", _hoisted_3, _toDisplayString(instance.displayName), 1 /* TEXT */ ),
@@ -135,7 +137,7 @@ export default /*@__PURE__*/ _defineComponent({
135
137
  ])
136
138
  ], 10 /* CLASS, PROPS */ , _hoisted_1);
137
139
  }), 128 /* KEYED_FRAGMENT */ )),
138
- _unref(isEmpty)(openclawWindowsInstances.value) ? (_openBlock(), _createBlock(RenderException, {
140
+ _unref(isEmpty)(openclawInstances.value) ? (_openBlock(), _createBlock(RenderException, {
139
141
  key: 0,
140
142
  description: _unref(t)('暂无 Openclaw 实例'),
141
143
  class: "agent-empty",
@@ -1,14 +1,16 @@
1
- import { ISkillOpenclawWindowsInstance } from '@/types/skill';
1
+ import { SkillInstallTargetType } from '@/types/enum';
2
+ import { ISkillOpenclawInstance } from '@/types/skill';
2
3
  interface IProps {
3
- selectedOpenclawWindowsInstances: ISkillOpenclawWindowsInstance[];
4
+ selectedOpenclawInstances: ISkillOpenclawInstance[];
5
+ targetType: SkillInstallTargetType;
4
6
  skillId?: number;
5
7
  apiPrefix: string;
6
8
  spaceId?: string;
7
9
  }
8
10
  declare const __VLS_export: import("vue").DefineComponent<IProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
- "update:selectedOpenclawWindowsInstances": (value: ISkillOpenclawWindowsInstance[]) => any;
11
+ "update:selectedOpenclawInstances": (value: ISkillOpenclawInstance[]) => any;
10
12
  }, string, import("vue").PublicProps, Readonly<IProps> & Readonly<{
11
- "onUpdate:selectedOpenclawWindowsInstances"?: (value: ISkillOpenclawWindowsInstance[]) => any;
13
+ "onUpdate:selectedOpenclawInstances"?: (value: ISkillOpenclawInstance[]) => any;
12
14
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
15
  declare const _default: typeof __VLS_export;
14
16
  export default _default;
@@ -0,0 +1,3 @@
1
+ import script from './openclaw-instances.script.vue.js.js';
2
+ script.__file = "./src/components/render-skill/install/openclaw-instances.vue";
3
+ export default script;