@nocobase/plugin-ai 2.2.0-beta.6 → 2.2.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/index.md +8 -0
  2. package/dist/ai/docs/nocobase/api/cli/config/delete.md +1 -0
  3. package/dist/ai/docs/nocobase/api/cli/config/index.md +4 -1
  4. package/dist/ai/docs/nocobase/api/cli/config/set.md +1 -0
  5. package/dist/ai/docs/nocobase/api/cli/env/auth.md +53 -5
  6. package/dist/ai/docs/nocobase/api/cli/self/check.md +19 -2
  7. package/dist/ai/docs/nocobase/api/cli/self/index.md +1 -1
  8. package/dist/ai/docs/nocobase/api/cli/self/update.md +17 -3
  9. package/dist/ai/docs/nocobase/development/index.md +6 -2
  10. package/dist/ai/docs/nocobase/nocobase-cli/installation/cli.md +2 -0
  11. package/dist/ai/docs/nocobase/plugin-development/client/index.md +1 -0
  12. package/dist/ai/docs/nocobase/shared-components/create-form-registry.md +38 -0
  13. package/dist/ai/docs/nocobase/shared-components/filter/collection-filter-panel.md +44 -0
  14. package/dist/ai/docs/nocobase/shared-components/filter/index.md +44 -0
  15. package/dist/ai/docs/nocobase/shared-components/form/code-scanner.md +34 -0
  16. package/dist/ai/docs/nocobase/shared-components/form/dialog-form-layout.md +45 -0
  17. package/dist/ai/docs/nocobase/shared-components/form/drawer-form-layout.md +45 -0
  18. package/dist/ai/docs/nocobase/shared-components/form/env-variable-input.md +30 -0
  19. package/dist/ai/docs/nocobase/shared-components/form/file-size-input.md +24 -0
  20. package/dist/ai/docs/nocobase/shared-components/form/json-text-area.md +28 -0
  21. package/dist/ai/docs/nocobase/shared-components/form/password-input.md +23 -0
  22. package/dist/ai/docs/nocobase/shared-components/form/remote-select.md +34 -0
  23. package/dist/ai/docs/nocobase/shared-components/form/scan-input.md +27 -0
  24. package/dist/ai/docs/nocobase/shared-components/form/typed-variable-input.md +30 -0
  25. package/dist/ai/docs/nocobase/shared-components/form/variable-input.md +35 -0
  26. package/dist/ai/docs/nocobase/shared-components/form/variable-json-text-area.md +33 -0
  27. package/dist/ai/docs/nocobase/shared-components/form/variable-text-area.md +33 -0
  28. package/dist/ai/docs/nocobase/shared-components/icon.md +21 -0
  29. package/dist/ai/docs/nocobase/shared-components/index.md +70 -0
  30. package/dist/ai/docs/nocobase/shared-components/table/index.md +39 -0
  31. package/dist/ai/docs/nocobase/shared-components/table/sort-handle.md +37 -0
  32. package/dist/ai/docs/nocobase/shared-components/table/sortable-row.md +36 -0
  33. package/dist/client/{428.5eb4f53ddbb6a3b8.js → 428.e9f38da3b0d8b498.js} +1 -1
  34. package/dist/client/580.35ba54ff91b7fe6d.js +10 -0
  35. package/dist/client/{604.de96f3ec4d471afd.js → 604.89c674f35b52b4ef.js} +1 -1
  36. package/dist/client/ai-employees/admin/mcp/schemas.d.ts +46 -18
  37. package/dist/client/index.js +3 -3
  38. package/dist/client-v2/ai-employees/flow/models/AIEmployeeButtonModel.d.ts +32 -0
  39. package/dist/client-v2/index.d.ts +1 -0
  40. package/dist/client-v2/index.js +1 -1
  41. package/dist/collections/ai-mcp-clients.js +5 -0
  42. package/dist/externalVersion.js +16 -16
  43. package/dist/locale/en-US.json +8 -3
  44. package/dist/locale/zh-CN.json +8 -3
  45. package/dist/node_modules/@langchain/xai/package.json +1 -1
  46. package/dist/node_modules/fs-extra/package.json +1 -1
  47. package/dist/node_modules/jsonrepair/package.json +1 -1
  48. package/dist/node_modules/just-bash/package.json +1 -1
  49. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  50. package/dist/node_modules/openai/package.json +1 -1
  51. package/dist/node_modules/zod/package.json +1 -1
  52. package/dist/server/ai-employees/ai-employee.js +21 -5
  53. package/dist/server/ai-employees/middleware/index.d.ts +1 -0
  54. package/dist/server/ai-employees/middleware/index.js +2 -0
  55. package/dist/server/ai-employees/middleware/tool-call-sanitizer.d.ts +16 -0
  56. package/dist/server/ai-employees/middleware/tool-call-sanitizer.js +90 -0
  57. package/dist/server/ai-employees/tool-call-sanitizer.d.ts +26 -0
  58. package/dist/server/ai-employees/tool-call-sanitizer.js +84 -0
  59. package/dist/server/ai-employees/utils.js +14 -2
  60. package/dist/server/plugin.d.ts +2 -0
  61. package/dist/server/plugin.js +30 -0
  62. package/dist/server/resource/aiConversations.js +1 -1
  63. package/dist/server/resource/aiMcpClients.js +2 -2
  64. package/dist/server/resource/aiTools.js +14 -9
  65. package/package.json +2 -2
  66. package/dist/client/580.e75f97fb883ad042.js +0 -10
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: "RemoteSelect"
3
+ description: "RemoteSelect: Load Select options asynchronously from an API."
4
+ keywords: "RemoteSelect,NocoBase,client-v2"
5
+ ---
6
+
7
+ # RemoteSelect
8
+
9
+ `RemoteSelect` is used to load Select options asynchronously from an API.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx
14
+ import { RemoteSelect } from '@nocobase/client-v2';
15
+
16
+ <RemoteSelect<{ name: string; title: string }>
17
+ request={async () => {
18
+ const { data } = await ctx.api.resource('providers').list();
19
+ return data.data;
20
+ }}
21
+ fieldNames={{ label: 'title', value: 'name' }}
22
+ />;
23
+ ```
24
+
25
+ ## API
26
+
27
+ | Prop | Type | Description |
28
+ | --- | --- | --- |
29
+ | `request` | `() => Promise<T[]>` | Async request for loading options |
30
+ | `fieldNames` | `{ label; value }` | Map option label and value fields |
31
+ | `options` | `DefaultOptionType[]` | Static options |
32
+ | `mode` | `SelectProps['mode']` | Select mode |
33
+ | `showSearch` | `boolean` | Whether search is enabled |
34
+ | `filterOption` | `boolean | function` | Client-side option filtering |
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: "ScanInput"
3
+ description: "ScanInput: Add scanning support to an input."
4
+ keywords: "ScanInput,NocoBase,client-v2"
5
+ ---
6
+
7
+ # ScanInput
8
+
9
+ `ScanInput` is used to add scanning support to an input.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx file="../_demos/scan-input.tsx" preview
14
+ ```
15
+
16
+ ## API
17
+
18
+ | Prop | Type | Description |
19
+ | --- | --- | --- |
20
+ | `disableManualInput` | `boolean` | Make the input read-only |
21
+ | `enableScan` | `boolean` | Reserved prop; the scan button is always rendered |
22
+ | `formatsToSupport` | `Html5QrcodeSupportedFormats[]` | Supported QR code or barcode formats |
23
+ | `onChange` | `(value: string | ChangeEvent<HTMLInputElement>) => void` | Change callback |
24
+
25
+ ## Related Links
26
+
27
+ - [CodeScanner](./code-scanner)
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: "TypedVariableInput"
3
+ description: "TypedVariableInput: Allow a field to accept both constants and variables."
4
+ keywords: "TypedVariableInput,NocoBase,client-v2"
5
+ ---
6
+
7
+ # TypedVariableInput
8
+
9
+ `TypedVariableInput` is used to allow a field to accept both constants and variables.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx file="../_demos/typed-variable-input.tsx" preview
14
+ ```
15
+
16
+ ## API
17
+
18
+ | Prop | Type | Description |
19
+ | --- | --- | --- |
20
+ | `value` | `unknown` | Current value |
21
+ | `onChange` | `(next: unknown) => void` | Change callback |
22
+ | `types` | `TypedConstantSpec[]` | Allowed constant types |
23
+ | `namespaces` | `string[]` | Allowed top-level variable namespaces |
24
+ | `extraNodes` | `MetaTreeNode[]` | Additional local variable nodes |
25
+ | `nullable` | `boolean` | Whether null is allowed |
26
+ | `delimiters` | `[string, string]` | Variable delimiters |
27
+ | `disabled` | `boolean` | Whether disabled |
28
+ | `placeholder` | `string` | Placeholder text |
29
+ | `style` | `React.CSSProperties` | Custom style |
30
+ | `className` | `string` | Custom class name |
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: "VariableInput"
3
+ description: "VariableInput: Let a single-line field accept variables such as `{{ $env.X }}` is used to and `{{ $user.name }}`."
4
+ keywords: "VariableInput,NocoBase,client-v2"
5
+ ---
6
+
7
+ # VariableInput
8
+
9
+ `VariableInput` is used to let a single-line field accept variables such as `{{ $env.X }}` and `{{ $user.name }}`.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx file="../_demos/variable-input.tsx" preview
14
+ ```
15
+
16
+ ## API
17
+
18
+ | Prop | Type | Description |
19
+ | --- | --- | --- |
20
+ | `value` | `string` | Current value |
21
+ | `onChange` | `(value: string) => void` | Change callback |
22
+ | `disabled` | `boolean` | Whether disabled |
23
+ | `placeholder` | `string` | Placeholder text |
24
+ | `addonBefore` | `React.ReactNode` | Content before the input |
25
+ | `namespaces` | `string[]` | Allowed top-level variable namespaces |
26
+ | `extraNodes` | `MetaTreeNode[]` | Additional local variable nodes |
27
+ | `delimiters` | `[string, string]` | Variable delimiters |
28
+ | `className` | `string` | Custom class name |
29
+ | `style` | `React.CSSProperties` | Custom style |
30
+
31
+ ## Related Links
32
+
33
+ - [VariableTextArea](./variable-text-area)
34
+ - [EnvVariableInput](./env-variable-input)
35
+ - [TypedVariableInput](./typed-variable-input)
@@ -0,0 +1,33 @@
1
+ ---
2
+ title: "VariableJsonTextArea"
3
+ description: "VariableJsonTextArea: Insert variables into JSON / JSON5 configuration."
4
+ keywords: "VariableJsonTextArea,NocoBase,client-v2"
5
+ ---
6
+
7
+ # VariableJsonTextArea
8
+
9
+ `VariableJsonTextArea` is used to insert variables into JSON / JSON5 configuration.
10
+
11
+ `VariableJsonTextArea` is based on [JsonTextArea](./json-text-area).
12
+
13
+ ## Basic Usage
14
+
15
+ ```tsx file="../_demos/variable-json-text-area.tsx" preview
16
+ ```
17
+
18
+ ## API
19
+
20
+ | Prop | Type | Description |
21
+ | --- | --- | --- |
22
+ | `value` | `unknown` | Current value |
23
+ | `onChange` | `(value: unknown) => void` | Change callback |
24
+ | `namespaces` | `string[]` | Allowed top-level variable namespaces |
25
+ | `extraNodes` | `MetaTreeNode[]` | Additional local variable nodes |
26
+ | `metaTree` | `MetaTreeNode[] | function` | Custom variable tree |
27
+ | `delimiters` | `[string, string]` | Variable delimiters |
28
+ | `formatPathToValue` | `(meta) => string | undefined` | Custom variable path formatter |
29
+
30
+ ## Related Links
31
+
32
+ - [JsonTextArea](./json-text-area)
33
+ - [VariableInput](./variable-input)
@@ -0,0 +1,33 @@
1
+ ---
2
+ title: "VariableTextArea"
3
+ description: "VariableTextArea: Let multi-line text accept variables."
4
+ keywords: "VariableTextArea,NocoBase,client-v2"
5
+ ---
6
+
7
+ # VariableTextArea
8
+
9
+ `VariableTextArea` is used to let multi-line text accept variables.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx file="../_demos/variable-text-area.tsx" preview
14
+ ```
15
+
16
+ ## API
17
+
18
+ | Prop | Type | Description |
19
+ | --- | --- | --- |
20
+ | `value` | `string` | Current value |
21
+ | `onChange` | `(value: string) => void` | Change callback |
22
+ | `disabled` | `boolean` | Whether disabled |
23
+ | `placeholder` | `string` | Placeholder text |
24
+ | `namespaces` | `string[]` | Allowed top-level variable namespaces |
25
+ | `extraNodes` | `MetaTreeNode[]` | Additional local variable nodes |
26
+ | `delimiters` | `[string, string]` | Variable delimiters |
27
+ | `rows` | `number` | Fixed row count |
28
+ | `maxRows` | `number` | Maximum row count |
29
+
30
+ ## Related Links
31
+
32
+ - [VariableInput](./variable-input)
33
+ - [VariableJsonTextArea](./variable-json-text-area)
@@ -0,0 +1,21 @@
1
+ ---
2
+ title: "Icon"
3
+ description: "Icon: Use Ant Design icons or register custom icons."
4
+ keywords: "Icon,NocoBase,client-v2"
5
+ ---
6
+
7
+ # Icon
8
+
9
+ `Icon` is used to use Ant Design icons or register custom icons.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx file="./_demos/icon.tsx" preview
14
+ ```
15
+
16
+ ## API
17
+
18
+ | Prop | Type | Description |
19
+ | --- | --- | --- |
20
+ | `type` | `string` | Icon name |
21
+ | `component` | `React.ComponentType` | Custom SVG component |
@@ -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)