@nocobase/plugin-ai 2.2.0-beta.7 → 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 (31) hide show
  1. package/dist/ai/docs/nocobase/api/cli/config/delete.md +1 -0
  2. package/dist/ai/docs/nocobase/api/cli/config/index.md +4 -1
  3. package/dist/ai/docs/nocobase/api/cli/config/set.md +1 -0
  4. package/dist/ai/docs/nocobase/api/cli/env/auth.md +53 -5
  5. package/dist/ai/docs/nocobase/api/cli/self/check.md +19 -2
  6. package/dist/ai/docs/nocobase/api/cli/self/index.md +1 -1
  7. package/dist/ai/docs/nocobase/api/cli/self/update.md +17 -3
  8. package/dist/ai/docs/nocobase/nocobase-cli/installation/cli.md +2 -0
  9. package/dist/client/{428.5eb4f53ddbb6a3b8.js → 428.e9f38da3b0d8b498.js} +1 -1
  10. package/dist/client/{604.de96f3ec4d471afd.js → 604.89c674f35b52b4ef.js} +1 -1
  11. package/dist/client/index.js +3 -3
  12. package/dist/client-v2/ai-employees/flow/models/AIEmployeeButtonModel.d.ts +32 -0
  13. package/dist/client-v2/index.d.ts +1 -0
  14. package/dist/client-v2/index.js +1 -1
  15. package/dist/externalVersion.js +16 -16
  16. package/dist/node_modules/@langchain/xai/package.json +1 -1
  17. package/dist/node_modules/fs-extra/package.json +1 -1
  18. package/dist/node_modules/jsonrepair/package.json +1 -1
  19. package/dist/node_modules/just-bash/package.json +1 -1
  20. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  21. package/dist/node_modules/openai/package.json +1 -1
  22. package/dist/node_modules/zod/package.json +1 -1
  23. package/dist/server/ai-employees/ai-employee.js +13 -2
  24. package/dist/server/ai-employees/middleware/index.d.ts +1 -0
  25. package/dist/server/ai-employees/middleware/index.js +2 -0
  26. package/dist/server/ai-employees/middleware/tool-call-sanitizer.d.ts +16 -0
  27. package/dist/server/ai-employees/middleware/tool-call-sanitizer.js +90 -0
  28. package/dist/server/ai-employees/tool-call-sanitizer.d.ts +26 -0
  29. package/dist/server/ai-employees/tool-call-sanitizer.js +84 -0
  30. package/dist/server/ai-employees/utils.js +14 -2
  31. package/package.json +2 -2
@@ -33,6 +33,7 @@ nb config delete proxy.nginx-driver
33
33
  nb config delete proxy.caddy-driver
34
34
  nb config delete bin.nginx
35
35
  nb config delete bin.git
36
+ nb config delete bin.pnpm
36
37
  ```
37
38
 
38
39
  ## Related commands
@@ -10,7 +10,7 @@ Manage default CLI configuration values. The currently supported keys are mainly
10
10
 
11
11
  - CLI itself: `locale`, `update.policy`, `license.pkg-url`
12
12
  - Docker runtime: `docker.network`, `docker.container-prefix`
13
- - External executables: `bin.docker`, `bin.caddy`, `bin.git`, `bin.nginx`, `bin.yarn`
13
+ - External executables: `bin.docker`, `bin.caddy`, `bin.git`, `bin.nginx`, `bin.pnpm`, `bin.yarn`
14
14
  - Proxy generation: `proxy.nb-cli-root`, `proxy.upstream-host`, `proxy.nginx-driver`, `proxy.caddy-driver`
15
15
 
16
16
  Most projects only need a few of these keys. In practice, the most common ones are:
@@ -34,6 +34,7 @@ Most projects only need a few of these keys. In practice, the most common ones a
34
34
  | `bin.caddy` | `caddy` | Override the Caddy executable path |
35
35
  | `bin.git` | `git` | Override the Git executable path |
36
36
  | `bin.nginx` | `nginx` | Override the Nginx executable path |
37
+ | `bin.pnpm` | `pnpm` | Override the pnpm executable path |
37
38
  | `bin.yarn` | `yarn` | Override the Yarn executable path |
38
39
  | `proxy.nb-cli-root` | CLI root, usually the current user's home directory | Override the root path visible to the generated proxy config when the proxy process and CLI do not see the same filesystem root |
39
40
  | `proxy.upstream-host` | `127.0.0.1` | Override the host used when the proxy forwards traffic back to the NocoBase app |
@@ -70,12 +71,14 @@ nb config get docker.network
70
71
  nb config set docker.network nocobase
71
72
  nb config set bin.nginx /usr/sbin/nginx
72
73
  nb config set bin.git /usr/bin/git
74
+ nb config set bin.pnpm /usr/local/bin/pnpm
73
75
  nb config delete docker.container-prefix
74
76
  ```
75
77
 
76
78
  ## Notes
77
79
 
78
80
  - `bin.nginx` and `bin.caddy` only affect the `local` driver for `nb proxy nginx` and `nb proxy caddy`
81
+ - `bin.pnpm` is used when commands need to run pnpm directly, such as updating a pnpm-managed global CLI install with `nb self update`
79
82
  - `proxy.nginx-driver` and `proxy.caddy-driver` store the default driver used by each provider
80
83
  - `proxy.nb-cli-root` and `proxy.upstream-host` are advanced proxy overrides. Most CLI-managed `local` or `docker` envs can use the defaults directly
81
84
  - If you only want to switch the active proxy driver, using `nb proxy nginx use` or `nb proxy caddy use` is usually clearer than setting the config key manually
@@ -33,6 +33,7 @@ nb config set bin.docker /usr/local/bin/docker
33
33
  nb config set bin.caddy /opt/homebrew/bin/caddy
34
34
  nb config set bin.git /usr/bin/git
35
35
  nb config set bin.nginx /usr/sbin/nginx
36
+ nb config set bin.pnpm /usr/local/bin/pnpm
36
37
  nb config set proxy.nb-cli-root /workspace
37
38
  nb config set proxy.upstream-host host.docker.internal
38
39
  nb config set proxy.nginx-driver docker
@@ -1,17 +1,19 @@
1
1
  ---
2
2
  title: "nb env auth"
3
- description: "nb env auth command reference: run OAuth login for a saved NocoBase env."
4
- keywords: "nb env auth,NocoBase CLI,OAuth,login,authentication"
3
+ description: "nb env auth command reference: authenticate a saved NocoBase env with basic, token, or OAuth authentication."
4
+ keywords: "nb env auth,NocoBase CLI,basic,token,OAuth,login,authentication"
5
5
  ---
6
6
 
7
7
  # nb env auth
8
8
 
9
- Run OAuth login for a selected env. When the env name is omitted, the current env is used.
9
+ Authenticate a saved NocoBase env again, or update the authentication information saved for it. When the env name is omitted, the current env is used.
10
+
11
+ `nb env auth` supports three authentication methods: `basic`, `token`, and `oauth`. If `--auth-type` is omitted, the CLI first infers the method from the authentication options you pass. If it still cannot infer the method, it uses the authentication method already saved in the env.
10
12
 
11
13
  ## Usage
12
14
 
13
15
  ```bash
14
- nb env auth [name]
16
+ nb env auth [name] [flags]
15
17
  ```
16
18
 
17
19
  ## Parameters
@@ -19,19 +21,65 @@ nb env auth [name]
19
21
  | Parameter | Type | Description |
20
22
  | --- | --- | --- |
21
23
  | `[name]` | string | Configured environment name to sign in to; uses the current env if omitted |
24
+ | `--auth-type`, `-a` | string | Authentication method: `basic`, `token`, or `oauth` |
25
+ | `--access-token`, `-t` | string | API key or access token used with `token` authentication |
26
+ | `--username` | string | Username used with `basic` authentication; prompted in TTY when omitted |
27
+ | `--password` | string | Password used with `basic` authentication; prompted in TTY when omitted |
28
+
29
+ ## Compatibility options
30
+
31
+ | Option | Type | Description |
32
+ | --- | --- | --- |
33
+ | `--env`, `-e` | string | Environment name, equivalent to `[name]`. This hidden option is kept for compatibility with other commands; normally the positional argument is enough |
22
34
 
23
35
  ## Notes
24
36
 
25
- Internally, this command uses the PKCE flow: start a local callback server, open the browser for authorization, exchange the token, and save it to the config file.
37
+ The authentication methods work as follows:
38
+
39
+ - `basic`: sign in to NocoBase with a username and password, then save the returned access token and username
40
+ - `token`: save the API key or access token passed through `--access-token`
41
+ - `oauth`: start the browser authentication flow, then save the access token after authentication finishes
42
+
43
+ In an interactive terminal, the CLI prompts for `--auth-type`, `--username`, `--password`, or `--access-token` when needed. In non-interactive mode, `basic` authentication requires both `--username` and `--password`.
44
+
45
+ `oauth` authentication first tries Device Authorization Grant. When the OAuth server supports this flow, the command prints a verification URL and user code, then polls until the browser approval is complete. This works on remote or headless servers because it does not require a local callback listener.
46
+
47
+ If the OAuth server does not expose a device authorization endpoint, the command falls back to the PKCE loopback flow: start a local callback server, open the browser for authorization, exchange the token, and save it to the config file.
48
+
49
+ After authentication succeeds, the CLI automatically runs `nb env update <name>` to re-sync the env state.
50
+
51
+ ## Limits
52
+
53
+ - `[name]` and `--env` cannot provide different environment names at the same time
54
+ - `--access-token` cannot be used with `--username` or `--password`
55
+ - `--auth-type oauth` cannot be used with `--access-token`, `--username`, or `--password`
56
+ - `--auth-type token` cannot be used with `--username` or `--password`
57
+ - `--auth-type basic` cannot be used with `--access-token`
58
+ - `--access-token`, `--username`, and `--password` cannot be empty after they are provided
26
59
 
27
60
  ## Examples
28
61
 
29
62
  ```bash
63
+ # Authenticate the current env with the saved authentication method
30
64
  nb env auth
65
+
66
+ # Authenticate a specific env
31
67
  nb env auth prod
68
+
69
+ # Use OAuth browser login
70
+ nb env auth prod --auth-type oauth
71
+
72
+ # Sign in with username and password
73
+ nb env auth prod --auth-type basic --username admin --password secret
74
+
75
+ # Save an API key or access token
76
+ nb env auth prod --auth-type token --access-token <api-key>
32
77
  ```
33
78
 
79
+ For device authorization, follow the URL printed by the command and enter the displayed code in the browser.
80
+
34
81
  ## Related Commands
35
82
 
36
83
  - [`nb env add`](./add.md)
84
+ - [`nb env info`](./info.md)
37
85
  - [`nb env update`](./update.md)
@@ -6,7 +6,7 @@ keywords: "nb self check,NocoBase CLI,version check"
6
6
 
7
7
  # nb self check
8
8
 
9
- Check the current NocoBase CLI installation, resolve the latest version for the selected channel, and report whether automatic self-update is supported.
9
+ Check the current NocoBase CLI installation, resolve the latest version for the selected channel, and report whether self-update is supported.
10
10
 
11
11
  ## Usage
12
12
 
@@ -18,9 +18,26 @@ nb self check [flags]
18
18
 
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
- | `--channel` | string | Release channel to compare with, default `auto`; options: `auto`, `latest`, `beta`, `alpha` |
21
+ | `--channel` | string | Release channel to compare with, default `auto`; options: `auto`, `latest`, `test`, `beta`, `alpha` |
22
22
  | `--json` | boolean | Output JSON |
23
23
 
24
+ ## Install Method
25
+
26
+ `nb self check` detects the current install method at runtime. It does not use the historical `self-install-methods.json` cache.
27
+
28
+ The command can report these install methods:
29
+
30
+ | Install method | Meaning |
31
+ | --- | --- |
32
+ | `npm-global` | The CLI is installed under the current `npm prefix -g`. |
33
+ | `pnpm-global` | The CLI is installed under a pnpm global `node_modules` tree. |
34
+ | `yarn-global` | The CLI is launched from `yarn global bin` or installed under `yarn global dir`. |
35
+ | `package-local` | The CLI is installed in a local project dependency tree. |
36
+ | `source` | The CLI is running from a repository checkout. |
37
+ | `unknown` | The CLI install could not be matched to a supported install method. |
38
+
39
+ Self-update is supported for `npm-global`, `pnpm-global`, and `yarn-global`. For `package-local` or `source`, update the parent project or repository checkout instead.
40
+
24
41
  ## Examples
25
42
 
26
43
  ```bash
@@ -19,7 +19,7 @@ nb self <command>
19
19
  | Command | Description |
20
20
  | --- | --- |
21
21
  | [`nb self check`](./check.md) | Check current CLI version and self-update support |
22
- | [`nb self update`](./update.md) | Update the globally npm-installed NocoBase CLI |
22
+ | [`nb self update`](./update.md) | Update the globally npm-, pnpm-, or yarn-installed NocoBase CLI |
23
23
 
24
24
  ## Examples
25
25
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  title: "nb self update"
3
- description: "nb self update command reference: update the globally npm-installed NocoBase CLI."
3
+ description: "nb self update command reference: update the globally npm-, pnpm-, or yarn-installed NocoBase CLI."
4
4
  keywords: "nb self update,NocoBase CLI,update,self update"
5
5
  ---
6
6
 
7
7
  # nb self update
8
8
 
9
- Update the installed NocoBase CLI when the current CLI is managed by a standard global npm installation.
9
+ Update the installed NocoBase CLI when the current CLI is managed by a standard global npm, pnpm, or yarn installation.
10
10
 
11
11
  ## Usage
12
12
 
@@ -18,12 +18,26 @@ nb self update [flags]
18
18
 
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
- | `--channel` | string | Release channel to update to, default `auto`; options: `auto`, `latest`, `beta`, `alpha` |
21
+ | `--channel` | string | Release channel to update to, default `auto`; options: `auto`, `latest`, `test`, `beta`, `alpha` |
22
22
  | `--yes`, `-y` | boolean | Skip update confirmation |
23
23
  | `--json` | boolean | Output JSON |
24
24
  | `--skills` | boolean | Also refresh the globally installed NocoBase AI coding skills |
25
25
  | `--verbose` | boolean | Show detailed update output |
26
26
 
27
+ ## Update Behavior
28
+
29
+ `nb self update` first detects the current install method at runtime. It does not use the historical `self-install-methods.json` cache.
30
+
31
+ When an update is available, the command uses the same package manager that manages the current global CLI install:
32
+
33
+ | Install method | Update command |
34
+ | --- | --- |
35
+ | `npm-global` | `npm install -g @nocobase/cli@<channel>` |
36
+ | `pnpm-global` | `pnpm add -g @nocobase/cli@<channel>` |
37
+ | `yarn-global` | `yarn global add @nocobase/cli@<channel>` |
38
+
39
+ Interactive confirmation defaults to yes. Use `--yes` to skip the prompt in scripts.
40
+
27
41
  ## Examples
28
42
 
29
43
  ```bash
@@ -35,6 +35,8 @@ nb config set update.policy auto
35
35
  nb config set update.policy off
36
36
  ```
37
37
 
38
+ Self-update is only supported when the CLI is managed by a standard global npm, pnpm, or yarn install. If you are running from source or from a local project dependency tree, use [`nb self check`](../../api/cli/self/check.md) to see the detected install method and update that parent project instead.
39
+
38
40
  If you are going to deploy NocoBase to the server and want to open the `nb init --ui` wizard from a remote browser, it is recommended to first change the CLI's default host to the current server IP:
39
41
 
40
42
  ```bash