@nocobase/plugin-ai 2.2.0-beta.6 → 2.2.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/index.md +8 -0
- package/dist/ai/docs/nocobase/development/index.md +6 -2
- package/dist/ai/docs/nocobase/plugin-development/client/index.md +1 -0
- package/dist/ai/docs/nocobase/shared-components/create-form-registry.md +38 -0
- package/dist/ai/docs/nocobase/shared-components/filter/collection-filter-panel.md +44 -0
- package/dist/ai/docs/nocobase/shared-components/filter/index.md +44 -0
- package/dist/ai/docs/nocobase/shared-components/form/code-scanner.md +34 -0
- package/dist/ai/docs/nocobase/shared-components/form/dialog-form-layout.md +45 -0
- package/dist/ai/docs/nocobase/shared-components/form/drawer-form-layout.md +45 -0
- package/dist/ai/docs/nocobase/shared-components/form/env-variable-input.md +30 -0
- package/dist/ai/docs/nocobase/shared-components/form/file-size-input.md +24 -0
- package/dist/ai/docs/nocobase/shared-components/form/json-text-area.md +28 -0
- package/dist/ai/docs/nocobase/shared-components/form/password-input.md +23 -0
- package/dist/ai/docs/nocobase/shared-components/form/remote-select.md +34 -0
- package/dist/ai/docs/nocobase/shared-components/form/scan-input.md +27 -0
- package/dist/ai/docs/nocobase/shared-components/form/typed-variable-input.md +30 -0
- package/dist/ai/docs/nocobase/shared-components/form/variable-input.md +35 -0
- package/dist/ai/docs/nocobase/shared-components/form/variable-json-text-area.md +33 -0
- package/dist/ai/docs/nocobase/shared-components/form/variable-text-area.md +33 -0
- package/dist/ai/docs/nocobase/shared-components/icon.md +21 -0
- package/dist/ai/docs/nocobase/shared-components/index.md +70 -0
- package/dist/ai/docs/nocobase/shared-components/table/index.md +39 -0
- package/dist/ai/docs/nocobase/shared-components/table/sort-handle.md +37 -0
- package/dist/ai/docs/nocobase/shared-components/table/sortable-row.md +36 -0
- package/dist/client/580.35ba54ff91b7fe6d.js +10 -0
- package/dist/client/ai-employees/admin/mcp/schemas.d.ts +46 -18
- package/dist/client/index.js +1 -1
- package/dist/collections/ai-mcp-clients.js +5 -0
- package/dist/externalVersion.js +16 -16
- package/dist/locale/en-US.json +8 -3
- package/dist/locale/zh-CN.json +8 -3
- package/dist/node_modules/@langchain/xai/package.json +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/jsonrepair/package.json +1 -1
- package/dist/node_modules/just-bash/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-employee.js +8 -3
- package/dist/server/plugin.d.ts +2 -0
- package/dist/server/plugin.js +30 -0
- package/dist/server/resource/aiConversations.js +1 -1
- package/dist/server/resource/aiMcpClients.js +2 -2
- package/dist/server/resource/aiTools.js +14 -9
- package/package.json +2 -2
- package/dist/client/580.e75f97fb883ad042.js +0 -10
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Shared Components"
|
|
3
|
+
description: "NocoBase client v2 shared components: form containers, form fields, filters, tables, and icon components."
|
|
4
|
+
keywords: "client-v2,shared components,React,Antd,NocoBase"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Shared Components
|
|
8
|
+
|
|
9
|
+
NocoBase client v2 includes a set of shared components. When building plugin pages, settings pages, or forms, you can use these components directly to reuse NocoBase UI and interactions.
|
|
10
|
+
|
|
11
|
+
This section groups components by usage scenario. Each page covers one component: when to use it, its common API, and whether it can be previewed in the docs.
|
|
12
|
+
|
|
13
|
+
## Quick Reference
|
|
14
|
+
|
|
15
|
+
| I want to... | Where to look |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| Control the low-level full-screen scanner | [CodeScanner](./form/code-scanner) |
|
|
18
|
+
| Put a standard form in a dialog | [DialogFormLayout](./form/dialog-form-layout) |
|
|
19
|
+
| Put a standard form in a drawer | [DrawerFormLayout](./form/drawer-form-layout) |
|
|
20
|
+
| Allow only `$env` environment variables | [EnvVariableInput](./form/env-variable-input) |
|
|
21
|
+
| Enter a file size and store it as bytes | [FileSizeInput](./form/file-size-input) |
|
|
22
|
+
| Edit JSON / JSON5 configuration | [JsonTextArea](./form/json-text-area) |
|
|
23
|
+
| Enter a password with a strength indicator | [PasswordInput](./form/password-input) |
|
|
24
|
+
| Load Select options asynchronously from an API | [RemoteSelect](./form/remote-select) |
|
|
25
|
+
| Add scanning support to an input | [ScanInput](./form/scan-input) |
|
|
26
|
+
| Allow a field to accept both constants and variables | [TypedVariableInput](./form/typed-variable-input) |
|
|
27
|
+
| Let a single-line field accept variables such as `{{ $env.X }}` and `{{ $user.name }}` | [VariableInput](./form/variable-input) |
|
|
28
|
+
| Insert variables into JSON / JSON5 configuration | [VariableJsonTextArea](./form/variable-json-text-area) |
|
|
29
|
+
| Let multi-line text accept variables | [VariableTextArea](./form/variable-text-area) |
|
|
30
|
+
| Filter a Collection with multiple conditions | [CollectionFilter](./filter/) |
|
|
31
|
+
| Embed a Collection filter panel in a page | [CollectionFilterPanel](./filter/collection-filter-panel) |
|
|
32
|
+
| Customize the draggable row of an antd Table | [SortableRow](./table/sortable-row) |
|
|
33
|
+
| Customize the drag handle column of a Table | [SortHandle](./table/sort-handle) |
|
|
34
|
+
| Display lists, select rows, and drag-sort rows on settings pages | [Table](./table/) |
|
|
35
|
+
| Use Ant Design icons or register custom icons | [Icon](./icon) |
|
|
36
|
+
| Create an internal registry for plugin extension items | [createFormRegistry](./create-form-registry) |
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
Import the components you need in a client plugin, then use them like regular React components:
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { RemoteSelect, Table } from '@nocobase/client-v2';
|
|
44
|
+
|
|
45
|
+
function SettingsPage() {
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<RemoteSelect request={loadOptions} />
|
|
49
|
+
<Table rowKey="id" columns={columns} dataSource={records} />
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## When to use these components
|
|
56
|
+
|
|
57
|
+
Use React + Antd by default. Check these components first for common NocoBase plugin scenarios:
|
|
58
|
+
|
|
59
|
+
- Open drawer or dialog forms on settings pages
|
|
60
|
+
- Insert variables, edit JSON, enter file sizes, or scan codes in form fields
|
|
61
|
+
- Use Collection filters or drag sorting in list pages
|
|
62
|
+
- Use NocoBase's unified icon entry
|
|
63
|
+
|
|
64
|
+
For ordinary inputs, buttons, and messages, Antd components are usually clearer.
|
|
65
|
+
|
|
66
|
+
## Related Links
|
|
67
|
+
|
|
68
|
+
- [Component Development](../plugin-development/client/component/index.md)
|
|
69
|
+
- [Context - Common Capabilities](../plugin-development/client/ctx/common-capabilities.md)
|
|
70
|
+
- [FlowEngine](../flow-engine/index.md)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Table"
|
|
3
|
+
description: "Table: Display lists, select rows, and drag-sort rows on settings pages."
|
|
4
|
+
keywords: "Table,NocoBase,client-v2"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Table
|
|
8
|
+
|
|
9
|
+
`Table` is used to display lists, select rows, and drag-sort rows on settings pages.
|
|
10
|
+
|
|
11
|
+
It is based on Antd Table and adds row selection and drag sorting for settings pages.
|
|
12
|
+
|
|
13
|
+
## Basic Usage
|
|
14
|
+
|
|
15
|
+
```tsx file="../_demos/table.tsx" preview
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
| Prop | Type | Description |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| `rowKey` | `string | (record, index) => React.Key` | Required row identity |
|
|
23
|
+
| `showIndex` | `boolean` | Show row index before selection |
|
|
24
|
+
| `isDraggable` | `boolean` | Whether drag sorting is enabled |
|
|
25
|
+
| `onSortEnd` | `(from, to) => void | Promise<void>` | Called after drag sorting ends |
|
|
26
|
+
| `showSortHandle` | `boolean` | Whether to show the default drag handle |
|
|
27
|
+
| `sortHandleColumnWidth` | `number` | Width of the automatic drag-handle column |
|
|
28
|
+
|
|
29
|
+
## Attached exports
|
|
30
|
+
|
|
31
|
+
| Description | Description |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `DEFAULT_PAGE_SIZE` | `50` |
|
|
34
|
+
| `PAGE_SIZE_OPTIONS` | `[5, 10, 20, 50, 100, 200]` |
|
|
35
|
+
|
|
36
|
+
## Related Links
|
|
37
|
+
|
|
38
|
+
- [SortHandle](./sort-handle)
|
|
39
|
+
- [SortableRow](./sortable-row)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "SortHandle"
|
|
3
|
+
description: "SortHandle: Customize the drag handle column of a Table."
|
|
4
|
+
keywords: "SortHandle,NocoBase,client-v2"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SortHandle
|
|
8
|
+
|
|
9
|
+
`SortHandle` is used to customize the drag handle column of a Table.
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { SortHandle, Table } from '@nocobase/client-v2';
|
|
15
|
+
|
|
16
|
+
<Table
|
|
17
|
+
rowKey="id"
|
|
18
|
+
isDraggable
|
|
19
|
+
showSortHandle={false}
|
|
20
|
+
columns={[
|
|
21
|
+
{ key: 'sort', width: 40, render: () => <SortHandle /> },
|
|
22
|
+
...columns,
|
|
23
|
+
]}
|
|
24
|
+
/>;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Description |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| `id` | `string | number` | Reserved prop; not used for rendering |
|
|
32
|
+
| `style` | `React.CSSProperties` | Custom style |
|
|
33
|
+
|
|
34
|
+
## Related Links
|
|
35
|
+
|
|
36
|
+
- [Table](./)
|
|
37
|
+
- [SortableRow](./sortable-row)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "SortableRow"
|
|
3
|
+
description: "SortableRow: Customize the draggable row of an antd Table."
|
|
4
|
+
keywords: "SortableRow,NocoBase,client-v2"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SortableRow
|
|
8
|
+
|
|
9
|
+
`SortableRow` is used to customize the draggable row of an antd Table.
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { DndContext } from '@dnd-kit/core';
|
|
15
|
+
import { SortableContext } from '@dnd-kit/sortable';
|
|
16
|
+
import { SortableRow } from '@nocobase/client-v2';
|
|
17
|
+
import { Table } from 'antd';
|
|
18
|
+
|
|
19
|
+
<DndContext>
|
|
20
|
+
<SortableContext items={records.map((record) => record.id)}>
|
|
21
|
+
<Table rowKey="id" components={{ body: { row: SortableRow } }} columns={columns} dataSource={records} />
|
|
22
|
+
</SortableContext>
|
|
23
|
+
</DndContext>;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Description |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| `rowIndex` | `number` | Current row index |
|
|
31
|
+
| `className` | `string` | Custom class name |
|
|
32
|
+
|
|
33
|
+
## Related Links
|
|
34
|
+
|
|
35
|
+
- [Table](./)
|
|
36
|
+
- [SortHandle](./sort-handle)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_ai=self.webpackChunk_nocobase_plugin_ai||[]).push([["580"],{7439:function(e,t,n){n.r(t),n.d(t,{MCPSettings:function(){return eC}});var r=n(3342),o=n(5477),a=n(7375),i=n(2059),l=n(9452),s=n(5230),u=n(9155),c=n.n(u),p={name:"aiMcpClients",fields:[{name:"name",type:"uid",primaryKey:!0},{name:"title",type:"string",interface:"input",uiSchema:{title:'{{t("Title")}}',"x-component":"Input"}},{name:"description",type:"string",interface:"input",uiSchema:{title:'{{t("Description")}}',"x-component":"Input.TextArea"}},{name:"enabled",type:"boolean",defaultValue:!0},{name:"transport",type:"string",interface:"select",uiSchema:{title:'{{t("Transport")}}',"x-component":"Select"}},{name:"useUserContext",type:"boolean",defaultValue:!1},{name:"command",type:"string",interface:"input",uiSchema:{title:'{{t("Command")}}',"x-component":"Input"}},{name:"args",type:"json",defaultValue:[]},{name:"env",type:"json",defaultValue:{}},{name:"url",type:"string",interface:"input",uiSchema:{title:'{{t("URL")}}',"x-component":"Input"}},{name:"headers",type:"json",defaultValue:{}},{name:"restart",type:"json",defaultValue:{}}]},m=n(3079);function d(e,t,n,r,o,a,i){try{var l=e[a](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,o)}var f=(0,u.createContext)({rebuildClient:function(){var e;return(e=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var u=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return[2,void 0]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){d(a,r,o,i,l,"next",e)}function l(e){d(a,r,o,i,l,"throw",e)}i(void 0)})})()},rebuilding:!1}),y=function(e,t){var n,r,o;return null!=(n=null!=(r=null==e||null==(o=e.data)?void 0:o.data)?r:null==e?void 0:e.data)?n:t};function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n,r,o,a,i){try{var l=e[a](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,o)}function x(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){b(a,r,o,i,l,"next",e)}function l(e){b(a,r,o,i,l,"throw",e)}i(void 0)})}}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function C(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var u=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var P=[{label:"Ask",value:"ASK"},{label:"Allow",value:"ALLOW"}],A=function(e,t){var n=null==e?void 0:e[t];return Array.isArray(n)?n:[]},S=function(){var e=(0,m.kj)(),t=(0,r.useAPIClient)(),n=i.App.useApp().message,o=(0,r.useActionContext)().visible,a=(0,r.useCollectionRecordData)(),l=(0,u.useContext)(f).rebuilding,s=g((0,u.useState)([]),2),p=s[0],d=s[1],v=g((0,u.useState)(!1),2),b=v[0],S=v[1],O=g((0,u.useState)(null),2),E=O[0],k=O[1],j=g((0,u.useState)(1),2),I=j[0],T=j[1],M=p.length,R=(0,u.useRef)(n),D=(0,u.useRef)(e);return R.current=n,D.current=e,(0,u.useEffect)(function(){if(o){var e=!1;return x(function(){var n,r;return w(this,function(o){switch(o.label){case 0:S(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,t.resource("aiMcpClients").listTools()];case 2:return n=A(y(o.sent(),null),a.name),e||(T(1),d(n)),[3,5];case 3:return r=o.sent(),e||(R.current.error((null==r?void 0:r.message)||D.current("Failed to load MCP tools")),T(1),d([])),[3,5];case 4:return e||S(!1),[7];case 5:return[2]}})})(),function(){e=!0}}},[t,a.name,o]),c().createElement(i.Space,{direction:"vertical",size:"middle",style:{width:"100%"}},b?c().createElement("div",{style:{padding:"24px 0",textAlign:"center"}},c().createElement(i.Spin,null)):p.length?c().createElement(i.List,{itemLayout:"vertical",dataSource:p,pagination:{current:I,pageSize:10,total:M,onChange:T,hideOnSinglePage:!1,size:"small",showTotal:function(t){return e("Total {{count}} items",{count:t})}},renderItem:function(n){return c().createElement(i.List.Item,{key:n.name,extra:c().createElement("div",{style:{fontSize:12,color:"var(--nb-color-text-secondary)"}},e("Permission"),c().createElement(i.Segmented,{style:{marginLeft:8},size:"small",options:P.map(function(t){return C(h({},t),{label:e(t.label)})}),value:n.permission,disabled:l||E===n.name,onChange:function(e){var r;return r=n.name,x(function(){var n,o;return w(this,function(a){switch(a.label){case 0:n=p,k(r),d(function(t){return t.map(function(t){return t.name===r?C(h({},t),{permission:e}):t})}),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,t.resource("aiMcpClients").updateToolPermission({values:{toolName:r,permission:e}})];case 2:return a.sent(),[3,5];case 3:return o=a.sent(),d(n),R.current.error((null==o?void 0:o.message)||D.current("Failed to update tool permission")),[3,5];case 4:return k(null),[7];case 5:return[2]}})})()}}))},c().createElement("div",null,n.title),n.description?c().createElement(i.Typography.Paragraph,{style:{color:"var(--nb-color-text-secondary)",fontSize:12,marginBottom:0},ellipsis:{rows:3,expandable:"collapsible"}},n.description):null)}}):c().createElement(i.Empty,{image:i.Empty.PRESENTED_IMAGE_SIMPLE,description:e("No data")}))};function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var E=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n="stdio"===e?'{{$deps[0] === "stdio"}}':'{{["http", "sse"].includes($deps[0])}}';return[{dependencies:["transport"],fulfill:{state:O({visible:n},t?{required:n}:{})}}]},k=function(e){return{name:O({type:"string","x-decorator":"FormItem",title:'{{ t("Name") }}',"x-component":"Input",required:!0},e.disableName?{"x-component-props":{disabled:!0}}:{}),title:{type:"string","x-decorator":"FormItem",title:'{{ t("Title") }}',"x-component":"Input",required:!0},description:{type:"string","x-decorator":"FormItem",title:'{{ t("Description") }}',"x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:2,maxRows:4}}},transport:{type:"string","x-decorator":"FormItem",title:'{{ t("Transport") }}',"x-component":"Select",enum:"{{ transportOptions }}",required:!0},useUserContext:{type:"boolean","x-decorator":"FormItem",title:'{{ t("Depends on current user") }}',"x-component":"UserContextCheckbox","x-component-props":{tooltip:'{{ t("When enabled, URL and headers can use current user variables and NocoBase request variables. Stdio transport is not supported.") }}'}},command:{type:"string","x-decorator":"FormItem",title:'{{ t("Command") }}',"x-component":"MCPVariableInput","x-component-props":{placeholder:'{{ t("For example: npx, uvx, node") }}'},"x-reactions":E("stdio",!0)},args:{type:"string","x-decorator":"FormItem",title:'{{ t("Arguments") }}',"x-component":"MCPVariableInput","x-component-props":{placeholder:'{{ t("Space-separated args, e.g.: -u --flag value") }}'},"x-reactions":E("stdio")},env:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:'{{ t("Environment variables") }}',items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%",display:"flex"},className:"{{ keyValueRowClassName }}"},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{ t("Name") }}'}},value:{type:"string","x-decorator":"FormItem","x-component":"MCPVariableInput"},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{ t("Add variable") }}',"x-component":"ArrayItems.Addition"}},"x-reactions":E("stdio")},url:{type:"string","x-decorator":"FormItem",title:'{{ t("URL") }}',"x-component":"MCPVariableInput","x-component-props":{placeholder:'{{ t("For example: https://example.com/mcp") }}',variableScope:"user"},"x-reactions":E("remote",!0)},headers:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:'{{ t("Headers") }}',items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%",display:"flex"},className:"{{ keyValueRowClassName }}"},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{ t("Name") }}'}},value:{type:"string","x-decorator":"FormItem","x-component":"MCPVariableInput","x-component-props":{variableScope:"user"}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{ t("Add request header") }}',"x-component":"ArrayItems.Addition"}},"x-reactions":E("remote")},restart:{type:"object","x-decorator":"FormItem",title:'{{ t("Restart options") }}',"x-component":"Input.JSON","x-visible":!1,"x-component-props":{autoSize:{minRows:4}}},testResult:{type:"void","x-component":"TestConnectionResult"},footer:{type:"void","x-component":e.footerComponent||"Action.Drawer.Footer",properties:{test:{type:"void","x-component":"TestConnectionButton"},cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary"},"x-use-component-props":e.submitPropsHook}}}}},j={type:"void",properties:k({submitPropsHook:"useCreateActionProps"})},I={type:"void",properties:k({disableName:!0,submitPropsHook:"useEditActionProps",footerComponent:"Action.Drawer.FootBar"})},T={type:"void",properties:{tools:{type:"void","x-component":"MCPToolsList"}}},M={type:"void",properties:{createDrawer:{type:"void",title:'{{ t("Add new") }}',"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useCreateFormProps",properties:j.properties}}};I.properties,T.properties;var R={type:"void",name:"ai-mcp-clients",properties:{card:{type:"void","x-component":"CardItem","x-component-props":{heightMode:"fullHeight"},"x-decorator":"TableBlockProvider","x-decorator-props":{collection:"aiMcpClients",action:"list",rowKey:"name"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:20}},properties:{refresh:{title:"{{t('Refresh')}}","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},bulkDelete:{title:"{{t('Delete')}}","x-action":"destroy","x-component":"Action","x-use-component-props":"useMCPBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},add:{type:"void",title:"{{t('Add new')}}","x-align":"right","x-component":"AddNew"}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void",title:'{{ t("Name") }}',"x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"Input","x-read-pretty":!0}}},column2:{type:"void",title:'{{ t("Title") }}',"x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"Input","x-read-pretty":!0}}},column4:{type:"void",title:'{{ t("Transport") }}',"x-component":"TableV2.Column",properties:{transport:{type:"string","x-component":"TransportTag"}}},column6:{type:"void",title:'{{ t("Enabled") }}',"x-component":"TableV2.Column",properties:{enabled:{type:"boolean","x-component":"EnabledSwitch"}}},column7:{type:"void",title:'{{ t("Actions") }}',"x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{ t("View") }}',"x-component":"Action.Link","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:'{{ t("MCP tools") }}',"x-component":"Action.Drawer","x-component-props":{width:720},properties:{content:{type:"void","x-component":"MCPViewDrawerContent"}}}}},edit:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useEditFormProps",properties:{content:{type:"void","x-component":"MCPEditDrawerContent"}}}}},destroy:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useMCPDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}}}};function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function V(e,t,n,r,o,a,i){try{var l=e[a](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,o)}function F(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){V(a,r,o,i,l,"next",e)}function l(e){V(a,r,o,i,l,"throw",e)}i(void 0)})}}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function B(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function U(e,t){if(null==e)return{};var n,r,o,a={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}if(a=function(e,t){if(null==e)return{};var n,r,o={},a=Object.getOwnPropertyNames(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||q(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function q(e,t){if(e){if("string"==typeof e)return D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D(e,t)}}function H(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var u=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function _(){var e,t,n=(e=["\n & > .ant-space-item:first-child,\n & > .ant-space-item:last-child {\n flex-shrink: 0;\n }\n\n & > .ant-space-item:first-child,\n & > .ant-space-item:nth-of-type(2) {\n flex: 1;\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return _=function(){return n},n}var K=[{label:"Stdio",value:"stdio"},{label:"HTTP (Streamable)",value:"http"},{label:"HTTP + SSE (Legacy)",value:"sse"}],W={stdio:"blue",http:"green",sse:"gold"},X=[{name:"x-app",title:"X-App",value:"x-app"},{name:"x-locale",title:"X-Locale",value:"x-locale"},{name:"x-hostname",title:"X-Hostname",value:"x-hostname"},{name:"x-timezone",title:"X-Timezone",value:"x-timezone"},{name:"x-role",title:"X-Role",value:"x-role"},{name:"x-authenticator",title:"X-Authenticator",value:"x-authenticator"}],G=(0,o.css)(_()),$=function(e){return Object.entries(e||{}).map(function(e){var t=L(e,2),n=t[0],r=t[1];return{name:n,value:null==r?"":String(r)}})},J=function(e){return(Array.isArray(e)?e:[]).reduce(function(e,t){return(null==t?void 0:t.name)&&(e[t.name]=t.value||""),e},{})},Q=function(e){var t=e.transport,n=B(N({},e),{useUserContext:"stdio"!==t&&!0===e.useUserContext,args:"string"==typeof e.args?e.args.split(" ").map(function(e){return e.trim()}).filter(function(e){return e.length>0}):Array.isArray(e.args)?e.args:[],env:J(e.env),headers:J(e.headers),restart:e.restart&&"object"===z(e.restart)&&!Array.isArray(e.restart)?e.restart:{}});return"stdio"===t?B(N({},n),{url:null,headers:{}}):B(N({},n),{command:null,args:[],env:{}})},Y=function(){var e=(0,r.useActionContext)().visible,t=(0,u.useMemo)(function(){return{enabled:!0,transport:"stdio",useUserContext:!1,command:"",url:"",args:"",env:[],headers:[],restart:{}}},[]),n=(0,u.useMemo)(function(){return(0,l.createForm)({initialValues:t})},[t]);return(0,u.useEffect)(function(){e&&(n.setInitialValues(t),n.reset())},[n,t,e]),{form:n}},Z=function(){var e=(0,r.useCollectionRecordData)(),t=(0,r.useActionContext)().visible,n=(0,u.useMemo)(function(){var t,n;return B(N({},e),{useUserContext:(null==e?void 0:e.useUserContext)===!0,command:null!=(t=null==e?void 0:e.command)?t:"",url:null!=(n=null==e?void 0:e.url)?n:"",args:Array.isArray(null==e?void 0:e.args)?e.args.join(" "):"",env:$(null==e?void 0:e.env),headers:$(null==e?void 0:e.headers),restart:(null==e?void 0:e.restart)&&"object"===z(e.restart)&&!Array.isArray(e.restart)?e.restart:{}})},[e]),o=(0,u.useMemo)(function(){return(0,l.createForm)({initialValues:n})},[n]);return(0,u.useEffect)(function(){t&&(o.setInitialValues(n),o.reset())},[o,n,t]),{form:o}},ee=function(){var e=(0,r.useActionContext)().setVisible;return{type:"default",onClick:function(){e(!1)}}},et=(0,u.createContext)({result:null,loading:!1,setResult:function(){},setLoading:function(){}}),en=function(){var e=(0,r.useAPIClient)(),t=(0,m.kj)(),n=(0,u.useContext)(et),o=n.setResult,a=n.setLoading;return function(n){return F(function(){var r,i,l;return H(this,function(s){switch(s.label){case 0:a(!0),o(null),s.label=1;case 1:return s.trys.push([1,3,4,5]),r=Q(n),[4,e.resource("aiMcpClients").testConnection({values:r})];case 2:return o(i=y({data:s.sent().data},null)),[2,!!(null==i?void 0:i.success)];case 3:return o({success:!1,error:(null==(l=s.sent())?void 0:l.message)||t("An error occurred while testing the connection")}),[2,!1];case 4:return a(!1),[7];case 5:return[2]}})})()}},er=function(){var e=i.App.useApp().modal,t=(0,m.kj)();return function(){return F(function(){return H(this,function(n){return[2,e.confirm({title:t("Connection test failed"),content:t("The MCP server uses current user variables and the connection test failed. Do you want to save it anyway?"),okText:t("Save anyway"),cancelText:t("Cancel")})]})})()}},eo=function(){var e=(0,r.useActionContext)().setVisible,t=i.App.useApp().message,n=(0,s.useForm)(),o=(0,r.useAPIClient)(),a=(0,r.useDataBlockRequest)().refresh,l=(0,m.kj)(),c=(0,u.useContext)(et).loading,p=(0,u.useContext)(f),d=p.rebuildClient,y=p.rebuilding,v=en(),b=er();return{type:"primary",loading:y||c,onClick:function(){return F(function(){return H(this,function(r){switch(r.label){case 0:return[4,n.submit()];case 1:return r.sent(),[4,v(n.values)];case 2:if(r.sent())return[3,4];if(!0!==Q(n.values).useUserContext)return[2];return[4,b()];case 3:if(!r.sent())return[2];r.label=4;case 4:return[4,o.resource("aiMcpClients").create({values:Q(n.values)})];case 5:return r.sent(),[4,d()];case 6:return r.sent(),[4,a()];case 7:return r.sent(),t.success(l("Saved successfully")),e(!1),n.reset(),[2]}})})()}}},ea=function(){var e=(0,r.useActionContext)().setVisible,t=i.App.useApp().message,n=(0,s.useForm)(),o=(0,r.useAPIClient)(),a=(0,r.useDataBlockRequest)().refresh,l=(0,r.useCollectionRecordData)(),c=(0,m.kj)(),p=(0,u.useContext)(et).loading,d=(0,u.useContext)(f),y=d.rebuildClient,v=d.rebuilding,b=en(),x=er();return{type:"primary",loading:v||p,onClick:function(){return F(function(){return H(this,function(r){switch(r.label){case 0:return[4,n.submit()];case 1:return r.sent(),[4,b(n.values)];case 2:if(r.sent())return[3,4];if(!0!==Q(n.values).useUserContext)return[2];return[4,x()];case 3:if(!r.sent())return[2];r.label=4;case 4:return[4,o.resource("aiMcpClients").update({values:Q(n.values),filterByTk:l.name})];case 5:return r.sent(),[4,y()];case 6:return r.sent(),[4,a()];case 7:return r.sent(),t.success(c("Saved successfully")),e(!1),n.reset(),[2]}})})()}}},ei=(0,s.observer)(function(){var e=(0,s.useForm)(),t=(0,r.useAPIClient)(),n=(0,u.useContext)(et),o=n.setResult,a=n.loading,l=n.setLoading,p=(0,m.kj)();return c().createElement(i.Button,{type:"default",loading:a,onClick:function(){return F(function(){var n,r;return H(this,function(a){switch(a.label){case 0:l(!0),o(null),a.label=1;case 1:return a.trys.push([1,3,4,5]),n=Q(e.values),[4,t.resource("aiMcpClients").testConnection({values:n})];case 2:return o(y({data:a.sent().data},null)),[3,5];case 3:return o({success:!1,error:(null==(r=a.sent())?void 0:r.message)||p("An error occurred while testing the connection")}),[3,5];case 4:return l(!1),[7];case 5:return[2]}})})()}},p("Test flight"))},{displayName:"TestConnectionButton"}),el=(0,s.observer)(function(){var e=(0,u.useContext)(et),t=e.result,n=e.loading,r=(0,m.kj)();return n?c().createElement("div",{style:{padding:"16px 0",textAlign:"center"}},c().createElement(i.Spin,{tip:r("Testing connection...")})):t?t.success?c().createElement(i.Alert,{type:"success",showIcon:!0,icon:c().createElement(a.CheckCircleOutlined,null),style:{marginTop:16},message:r("Connection Successful"),description:c().createElement("div",null,c().createElement("p",null,r("Successfully connected to MCP server")),c().createElement("p",null,r("Tools found"),": ",t.toolsCount),t.tools&&t.tools.length>0&&c().createElement("div",{style:{marginTop:8}},c().createElement("p",{style:{fontWeight:"bold",marginBottom:4}},r("Tools"),":"),c().createElement("div",{style:{maxHeight:120,overflow:"auto"}},t.tools.map(function(e){return c().createElement(i.Tag,{key:e,style:{margin:"2px"}},e)}),t.toolsTruncated&&c().createElement("span",null,"..."))))}):c().createElement(i.Alert,{type:"error",showIcon:!0,icon:c().createElement(a.CloseCircleOutlined,null),style:{marginTop:16},message:r("Connection Failed"),description:c().createElement("div",null,c().createElement("p",null,t.error||r("Failed to connect to MCP server")),t.details&&c().createElement("pre",{style:{maxHeight:100,overflow:"auto",fontSize:11,margin:0}},t.details))}):null},{displayName:"TestConnectionResult"}),es=function(e){var t=(0,m.kj)(),n=(0,r.useGlobalVariable)("$env"),o=(0,r.useCurrentUserVariable)({maxDepth:3,noDisabled:!0}).currentUserSettings;return(0,u.useMemo)(function(){return[eu(n),e?eu(o):null,e?eu({name:"request",title:t("NocoBase request"),value:"request",children:[{name:"headers",title:"headers",value:"headers",children:X},{name:"token",title:"Token",value:"token"}]}):null].filter(Boolean)},[o,n,e,t])},eu=function(e){if(!e)return null;var t,n,r,o,a,i,l=null!=(t=e.value)?t:e.name,s=null!=(n=e.label)?n:e.title,u=e.loadChildren?function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return F(function(){var n,o,a;return H(this,function(i){switch(i.label){case 0:return[4,null==(o=e.loadChildren)?void 0:(n=o).call.apply(n,[e,t].concat(function(e){if(Array.isArray(e))return D(e)}(r)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||q(r)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()))];case 1:return i.sent(),t.children=null==(a=t.children)?void 0:a.map(function(e){return eu(e)}).filter(function(e){return!!e}),[2]}})})()}:void 0;return N(B(N({},e),{name:null!=(r=e.name)?r:l,title:null!=(o=e.title)?o:s,value:l,label:s,key:null!=(a=e.key)?a:l,children:null==(i=e.children)?void 0:i.map(function(e){return eu(e)}).filter(function(e){return!!e})}),u?{loadChildren:u}:{})},ec={value:"name",label:"title"},ep=(0,s.observer)(function(e){var t=e.variableScope,n=U(e,["variableScope"]),o=(0,s.useForm)(),a=es("user"===(void 0===t?"env":t)&&!0===o.values.useUserContext);return c().createElement(r.Variable.TextArea,B(N({},n),{scope:a,fieldNames:ec,trim:!1}))},{displayName:"MCPVariableInput"}),em=(0,s.observer)(function(e){var t=e.tooltip,n=U(e,["tooltip"]),o=(0,s.useForm)(),a="stdio"===o.values.transport;(0,u.useEffect)(function(){a&&o.values.useUserContext&&o.setValuesIn("useUserContext",!1)},[a,o]);var l=c().createElement(r.Checkbox,B(N({},n),{disabled:a||e.disabled}));return t?c().createElement(i.Tooltip,{title:t},l):l},{displayName:"UserContextCheckbox"}),ed=function(){var e=(0,m.kj)(),t=L((0,u.useState)(!1),2),n=t[0],o=t[1],l=L((0,u.useState)(null),2),s=l[0],p=l[1],d=L((0,u.useState)(!1),2),f=d[0],y=d[1],v=(0,u.useMemo)(function(){return{result:s,loading:f,setResult:p,setLoading:y}},[s,f]);return c().createElement(r.ActionContextProvider,{value:{visible:n,setVisible:o}},c().createElement(i.Button,{icon:c().createElement(a.PlusOutlined,null),type:"primary",onClick:function(){p(null),y(!1),o(!0)}},e("Add new")),c().createElement(et.Provider,{value:v},c().createElement(r.SchemaComponent,{components:{TestConnectionButton:ei,TestConnectionResult:el,Space:i.Space,MCPVariableInput:ep,UserContextCheckbox:em},scope:{t:e,transportOptions:K,keyValueRowClassName:G,useCreateFormProps:Y,useCancelActionProps:ee,useCreateActionProps:eo},schema:M})))},ef=function(){var e=(0,m.kj)(),t=(0,r.useCollectionRecordData)(),n=L((0,u.useState)(null),2),o=n[0],a=n[1],l=L((0,u.useState)(!1),2),s=l[0],p=l[1],d=(0,u.useMemo)(function(){return{result:o,loading:s,setResult:a,setLoading:p}},[o,s]);return c().createElement(r.CollectionRecordProvider,{record:t},c().createElement(et.Provider,{value:d},c().createElement(r.SchemaComponent,{components:{TestConnectionButton:ei,TestConnectionResult:el,Space:i.Space,MCPVariableInput:ep,UserContextCheckbox:em},scope:{t:e,transportOptions:K,keyValueRowClassName:G,useEditFormProps:Z,useCancelActionProps:ee,useEditActionProps:ea},schema:I})))},ey=function(){var e=(0,m.kj)(),t=(0,r.useCollectionRecordData)();return c().createElement(r.CollectionRecordProvider,{record:t},c().createElement(r.SchemaComponent,{components:{MCPToolsList:S},scope:{t:e},schema:T}))},ev=function(){var e,t=(0,r.useCollectionRecordData)().transport,n=(null==(e=K.find(function(e){return e.value===t}))?void 0:e.label)||t;return c().createElement(i.Tag,{color:W[t]},n)},eb=(0,s.observer)(function(){var e=(0,r.useAPIClient)(),t=(0,r.useCollectionRecordData)(),n=(0,r.useDataBlockRequest)().refresh,o=(0,u.useContext)(f),a=o.rebuildClient,l=o.rebuilding,s=L((0,u.useState)(!1),2),p=s[0],m=s[1];return c().createElement(i.Switch,{size:"small",checked:!1!==t.enabled,loading:p,disabled:l,onChange:function(r){return F(function(){return H(this,function(o){switch(o.label){case 0:m(!0),o.label=1;case 1:return o.trys.push([1,,5,6]),[4,e.resource("aiMcpClients").update({filterByTk:t.name,values:{enabled:r}})];case 2:return o.sent(),[4,a()];case 3:return o.sent(),[4,n()];case 4:return o.sent(),[3,6];case 5:return m(!1),[7];case 6:return[2]}})})()}})},{displayName:"MCPEnabledSwitch"}),ex=function(){var e=(0,r.useDestroyActionProps)(),t=(0,u.useContext)(f),n=t.rebuildClient,o=t.rebuilding;return B(N({},e),{loading:o,onClick:function(t,r){return F(function(){var o;return H(this,function(a){switch(a.label){case 0:return[4,null==(o=e.onClick)?void 0:o.call(e,t,r)];case 1:return a.sent(),[4,n()];case 2:return a.sent(),[2]}})})()}})},eh=function(){var e=(0,r.useBulkDestroyActionProps)(),t=(0,r.useBlockRequestContext)().field,n=(0,u.useContext)(f),o=n.rebuildClient,a=n.rebuilding;return B(N({},e),{loading:a,onClick:function(n,r){return F(function(){var a,i,l;return H(this,function(s){switch(s.label){case 0:if(!(null==t||null==(i=t.data)||null==(a=i.selectedRowKeys)?void 0:a.length))return[2];return[4,null==(l=e.onClick)?void 0:l.call(e,n,r)];case 1:return s.sent(),[4,o()];case 2:return s.sent(),[2]}})})()}})},eC=function(){var e=(0,m.kj)(),t=(0,r.useAPIClient)(),n=(0,u.useRef)(Promise.resolve()),o=(0,u.useRef)(0),a=L((0,u.useState)(!1),2),i=a[0],l=a[1],s=(0,u.useCallback)(function(){return F(function(){var e;return H(this,function(r){return o.current+=1,l(!0),e=n.current.catch(function(){}).then(function(){return F(function(){return H(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,t.resource("aiMcpClients").rebuildClient()];case 1:case 2:return e.sent(),[3,3];case 3:return[2]}})})()}),n.current=e.finally(function(){o.current-=1,0===o.current&&l(!1)}),[2,e]})})()},[t]),d=(0,u.useMemo)(function(){return{rebuildClient:s,rebuilding:i}},[s,i]);return c().createElement(f.Provider,{value:d},c().createElement(r.ExtendCollectionsProvider,{collections:[p]},c().createElement(r.SchemaComponent,{components:{AddNew:ed,MCPEditDrawerContent:ef,MCPViewDrawerContent:ey,MCPToolsList:S,TestConnectionButton:ei,TestConnectionResult:el,MCPVariableInput:ep,UserContextCheckbox:em,TransportTag:ev,EnabledSwitch:eb},scope:{t:e,transportOptions:K,keyValueRowClassName:G,useCreateFormProps:Y,useEditFormProps:Z,useCancelActionProps:ee,useCreateActionProps:eo,useEditActionProps:ea,useMCPDestroyActionProps:ex,useMCPBulkDestroyActionProps:eh},schema:R})))}}}]);
|
|
@@ -46,6 +46,15 @@ export declare const createMCPFormContentSchema: {
|
|
|
46
46
|
enum: string;
|
|
47
47
|
required: boolean;
|
|
48
48
|
};
|
|
49
|
+
useUserContext: {
|
|
50
|
+
type: string;
|
|
51
|
+
'x-decorator': string;
|
|
52
|
+
title: string;
|
|
53
|
+
'x-component': string;
|
|
54
|
+
'x-component-props': {
|
|
55
|
+
tooltip: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
49
58
|
command: {
|
|
50
59
|
type: string;
|
|
51
60
|
'x-decorator': string;
|
|
@@ -114,9 +123,6 @@ export declare const createMCPFormContentSchema: {
|
|
|
114
123
|
type: string;
|
|
115
124
|
'x-decorator': string;
|
|
116
125
|
'x-component': string;
|
|
117
|
-
'x-component-props': {
|
|
118
|
-
useTypedConstant: boolean;
|
|
119
|
-
};
|
|
120
126
|
};
|
|
121
127
|
remove: {
|
|
122
128
|
type: string;
|
|
@@ -151,6 +157,7 @@ export declare const createMCPFormContentSchema: {
|
|
|
151
157
|
'x-component': string;
|
|
152
158
|
'x-component-props': {
|
|
153
159
|
placeholder: string;
|
|
160
|
+
variableScope: string;
|
|
154
161
|
};
|
|
155
162
|
'x-reactions': {
|
|
156
163
|
dependencies: string[];
|
|
@@ -195,7 +202,7 @@ export declare const createMCPFormContentSchema: {
|
|
|
195
202
|
'x-decorator': string;
|
|
196
203
|
'x-component': string;
|
|
197
204
|
'x-component-props': {
|
|
198
|
-
|
|
205
|
+
variableScope: string;
|
|
199
206
|
};
|
|
200
207
|
};
|
|
201
208
|
remove: {
|
|
@@ -305,6 +312,15 @@ export declare const editMCPFormContentSchema: {
|
|
|
305
312
|
enum: string;
|
|
306
313
|
required: boolean;
|
|
307
314
|
};
|
|
315
|
+
useUserContext: {
|
|
316
|
+
type: string;
|
|
317
|
+
'x-decorator': string;
|
|
318
|
+
title: string;
|
|
319
|
+
'x-component': string;
|
|
320
|
+
'x-component-props': {
|
|
321
|
+
tooltip: string;
|
|
322
|
+
};
|
|
323
|
+
};
|
|
308
324
|
command: {
|
|
309
325
|
type: string;
|
|
310
326
|
'x-decorator': string;
|
|
@@ -373,9 +389,6 @@ export declare const editMCPFormContentSchema: {
|
|
|
373
389
|
type: string;
|
|
374
390
|
'x-decorator': string;
|
|
375
391
|
'x-component': string;
|
|
376
|
-
'x-component-props': {
|
|
377
|
-
useTypedConstant: boolean;
|
|
378
|
-
};
|
|
379
392
|
};
|
|
380
393
|
remove: {
|
|
381
394
|
type: string;
|
|
@@ -410,6 +423,7 @@ export declare const editMCPFormContentSchema: {
|
|
|
410
423
|
'x-component': string;
|
|
411
424
|
'x-component-props': {
|
|
412
425
|
placeholder: string;
|
|
426
|
+
variableScope: string;
|
|
413
427
|
};
|
|
414
428
|
'x-reactions': {
|
|
415
429
|
dependencies: string[];
|
|
@@ -454,7 +468,7 @@ export declare const editMCPFormContentSchema: {
|
|
|
454
468
|
'x-decorator': string;
|
|
455
469
|
'x-component': string;
|
|
456
470
|
'x-component-props': {
|
|
457
|
-
|
|
471
|
+
variableScope: string;
|
|
458
472
|
};
|
|
459
473
|
};
|
|
460
474
|
remove: {
|
|
@@ -580,6 +594,15 @@ export declare const createMCPSchema: {
|
|
|
580
594
|
enum: string;
|
|
581
595
|
required: boolean;
|
|
582
596
|
};
|
|
597
|
+
useUserContext: {
|
|
598
|
+
type: string;
|
|
599
|
+
'x-decorator': string;
|
|
600
|
+
title: string;
|
|
601
|
+
'x-component': string;
|
|
602
|
+
'x-component-props': {
|
|
603
|
+
tooltip: string;
|
|
604
|
+
};
|
|
605
|
+
};
|
|
583
606
|
command: {
|
|
584
607
|
type: string;
|
|
585
608
|
'x-decorator': string;
|
|
@@ -648,9 +671,6 @@ export declare const createMCPSchema: {
|
|
|
648
671
|
type: string;
|
|
649
672
|
'x-decorator': string;
|
|
650
673
|
'x-component': string;
|
|
651
|
-
'x-component-props': {
|
|
652
|
-
useTypedConstant: boolean;
|
|
653
|
-
};
|
|
654
674
|
};
|
|
655
675
|
remove: {
|
|
656
676
|
type: string;
|
|
@@ -685,6 +705,7 @@ export declare const createMCPSchema: {
|
|
|
685
705
|
'x-component': string;
|
|
686
706
|
'x-component-props': {
|
|
687
707
|
placeholder: string;
|
|
708
|
+
variableScope: string;
|
|
688
709
|
};
|
|
689
710
|
'x-reactions': {
|
|
690
711
|
dependencies: string[];
|
|
@@ -729,7 +750,7 @@ export declare const createMCPSchema: {
|
|
|
729
750
|
'x-decorator': string;
|
|
730
751
|
'x-component': string;
|
|
731
752
|
'x-component-props': {
|
|
732
|
-
|
|
753
|
+
variableScope: string;
|
|
733
754
|
};
|
|
734
755
|
};
|
|
735
756
|
remove: {
|
|
@@ -848,6 +869,15 @@ export declare const editMCPDrawerSchema: {
|
|
|
848
869
|
enum: string;
|
|
849
870
|
required: boolean;
|
|
850
871
|
};
|
|
872
|
+
useUserContext: {
|
|
873
|
+
type: string;
|
|
874
|
+
'x-decorator': string;
|
|
875
|
+
title: string;
|
|
876
|
+
'x-component': string;
|
|
877
|
+
'x-component-props': {
|
|
878
|
+
tooltip: string;
|
|
879
|
+
};
|
|
880
|
+
};
|
|
851
881
|
command: {
|
|
852
882
|
type: string;
|
|
853
883
|
'x-decorator': string;
|
|
@@ -916,9 +946,6 @@ export declare const editMCPDrawerSchema: {
|
|
|
916
946
|
type: string;
|
|
917
947
|
'x-decorator': string;
|
|
918
948
|
'x-component': string;
|
|
919
|
-
'x-component-props': {
|
|
920
|
-
useTypedConstant: boolean;
|
|
921
|
-
};
|
|
922
949
|
};
|
|
923
950
|
remove: {
|
|
924
951
|
type: string;
|
|
@@ -953,6 +980,7 @@ export declare const editMCPDrawerSchema: {
|
|
|
953
980
|
'x-component': string;
|
|
954
981
|
'x-component-props': {
|
|
955
982
|
placeholder: string;
|
|
983
|
+
variableScope: string;
|
|
956
984
|
};
|
|
957
985
|
'x-reactions': {
|
|
958
986
|
dependencies: string[];
|
|
@@ -997,7 +1025,7 @@ export declare const editMCPDrawerSchema: {
|
|
|
997
1025
|
'x-decorator': string;
|
|
998
1026
|
'x-component': string;
|
|
999
1027
|
'x-component-props': {
|
|
1000
|
-
|
|
1028
|
+
variableScope: string;
|
|
1001
1029
|
};
|
|
1002
1030
|
};
|
|
1003
1031
|
remove: {
|
|
@@ -1189,7 +1217,7 @@ export declare const mcpSettingsSchema: {
|
|
|
1189
1217
|
};
|
|
1190
1218
|
};
|
|
1191
1219
|
};
|
|
1192
|
-
|
|
1220
|
+
column6: {
|
|
1193
1221
|
type: string;
|
|
1194
1222
|
title: string;
|
|
1195
1223
|
'x-component': string;
|
|
@@ -1200,7 +1228,7 @@ export declare const mcpSettingsSchema: {
|
|
|
1200
1228
|
};
|
|
1201
1229
|
};
|
|
1202
1230
|
};
|
|
1203
|
-
|
|
1231
|
+
column7: {
|
|
1204
1232
|
type: string;
|
|
1205
1233
|
title: string;
|
|
1206
1234
|
'x-decorator': string;
|