@nocobase/plugin-ai 2.2.0-beta.15 → 2.2.0-beta.17
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/block/ai-chat-box.md +133 -0
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/documents.md +1 -1
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/index.md +11 -7
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/settings.md +12 -8
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-database.md +3 -3
- package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/create-document.md +1 -1
- package/dist/ai/docs/nocobase/api/app/env.md +2 -0
- package/dist/ai/docs/nocobase/building-tips/ai-fill-js-block-form.md +1092 -0
- package/dist/ai/docs/nocobase/data-sources/calendar/calendar-collection.md +100 -3
- package/dist/ai/docs/nocobase/data-sources/collection-comment/index.md +92 -39
- package/dist/ai/docs/nocobase/data-sources/collection-sql/index.md +150 -29
- package/dist/ai/docs/nocobase/data-sources/collection-tree/index.md +93 -5
- package/dist/ai/docs/nocobase/data-sources/collection-view/index.md +226 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/china-region.md +122 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/collection-select.md +105 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/json.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/nano-id.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/snowflake-id.md +108 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/sort.md +3 -19
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/uuid.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/associations/index.md +44 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/color.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/email.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/icon.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/input.md +112 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/integer.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/number.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/password.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/percent.md +104 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/phone.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/textarea.md +99 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/url.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox-group.md +105 -3
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/china-region.md +108 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/multiple-select.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/radio-group.md +106 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/select.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/date.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime-without-tz.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/index.md +53 -47
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/time.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/unix-timestamp.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/circle.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/line.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/point.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/polygon.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/index.md +62 -16
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/markdown.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/rich-text.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-at.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-by.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/space.md +100 -6
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/table-oid.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-at.md +104 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-by.md +104 -6
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/validation.md +68 -58
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection.md +32 -13
- package/dist/ai/docs/nocobase/data-sources/data-modeling/index.md +41 -33
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mariadb/index.md +114 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mssql/index.md +117 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mysql/index.md +103 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-nocobase/index.md +75 -73
- package/dist/ai/docs/nocobase/data-sources/data-source-external-oracle/index.md +129 -11
- package/dist/ai/docs/nocobase/data-sources/data-source-external-postgres/index.md +110 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-kingbase/index.md +75 -49
- package/dist/ai/docs/nocobase/data-sources/data-source-main/general-collection.md +116 -15
- package/dist/ai/docs/nocobase/data-sources/data-source-main/index.md +92 -62
- package/dist/ai/docs/nocobase/data-sources/data-source-main/inheritance-collection.md +97 -10
- package/dist/ai/docs/nocobase/data-sources/data-source-manager/external-database.md +97 -58
- package/dist/ai/docs/nocobase/data-sources/data-source-manager/index.md +32 -24
- package/dist/ai/docs/nocobase/data-sources/data-source-rest-api/index.md +115 -153
- package/dist/ai/docs/nocobase/data-sources/external/clickhouse.md +124 -0
- package/dist/ai/docs/nocobase/data-sources/external/doris.md +130 -0
- package/dist/ai/docs/nocobase/data-sources/external/index.md +140 -0
- package/dist/ai/docs/nocobase/data-sources/external/kingbase.md +129 -0
- package/dist/ai/docs/nocobase/data-sources/external/mariadb.md +126 -0
- package/dist/ai/docs/nocobase/data-sources/external/mssql.md +129 -0
- package/dist/ai/docs/nocobase/data-sources/external/mysql.md +115 -0
- package/dist/ai/docs/nocobase/data-sources/external/nocobase.md +159 -0
- package/dist/ai/docs/nocobase/data-sources/external/oceanbase.md +126 -0
- package/dist/ai/docs/nocobase/data-sources/external/oracle.md +158 -0
- package/dist/ai/docs/nocobase/data-sources/external/postgresql.md +122 -0
- package/dist/ai/docs/nocobase/data-sources/external/rest-api.md +245 -0
- package/dist/ai/docs/nocobase/data-sources/field-attachment-url/index.md +100 -12
- package/dist/ai/docs/nocobase/data-sources/field-encryption/index.md +48 -47
- package/dist/ai/docs/nocobase/data-sources/field-formula/index.md +99 -5
- package/dist/ai/docs/nocobase/data-sources/field-markdown-vditor/index.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/field-sequence/index.md +102 -5
- package/dist/ai/docs/nocobase/data-sources/field-signature/index.md +18 -16
- package/dist/ai/docs/nocobase/data-sources/field-sort/index.md +76 -73
- package/dist/ai/docs/nocobase/data-sources/file-manager/field-attachment.md +101 -7
- package/dist/ai/docs/nocobase/data-sources/file-manager/file-collection.md +101 -14
- package/dist/ai/docs/nocobase/data-sources/index.md +49 -33
- package/dist/ai/docs/nocobase/data-sources/main/index.md +130 -0
- package/dist/ai/docs/nocobase/data-sources/main/kingbase.md +147 -0
- package/dist/ai/docs/nocobase/data-sources/main/mariadb.md +59 -0
- package/dist/ai/docs/nocobase/data-sources/main/mysql.md +59 -0
- package/dist/ai/docs/nocobase/data-sources/main/oceanbase.md +62 -0
- package/dist/ai/docs/nocobase/data-sources/main/postgresql.md +61 -0
- package/dist/ai/docs/nocobase/file-manager/file-preview/index.md +44 -3
- package/dist/ai/docs/nocobase/file-manager/storage/aliyun-oss.md +100 -3
- package/dist/ai/docs/nocobase/file-manager/storage/index.md +66 -26
- package/dist/ai/docs/nocobase/file-manager/storage/s3-pro.md +58 -7
- package/dist/ai/docs/nocobase/get-started/installation/env.md +1 -1
- package/dist/ai/docs/nocobase/ops-management/migration-manager/built-in-tables.md +1 -2
- package/dist/ai/docs/nocobase/runjs/context/ai.md +194 -4
- package/dist/ai/docs/nocobase/workflow/nodes/javascript.md +21 -1
- package/dist/ai/tools/executeFrontendTool.d.ts +10 -0
- package/dist/ai/tools/executeFrontendTool.js +86 -0
- package/dist/ai/tools/getSkill.js +1 -1
- package/dist/ai/tools/loadFrontendTool.d.ts +10 -0
- package/dist/ai/tools/loadFrontendTool.js +99 -0
- package/dist/client/244.1086967ad8fdedf4.js +10 -0
- package/dist/client/{525.203778500aca5d05.js → 525.94dd4136c1361477.js} +1 -1
- package/dist/client/681.6ffbc9329b9ac242.js +10 -0
- package/dist/{client-v2/705.1d10027ff8cfdf79.js → client/705.19b642db34de438a.js} +1 -1
- package/dist/client/index.d.ts +1 -3
- package/dist/client/index.js +8 -8
- package/dist/client-v2/244.678c34d698985c60.js +10 -0
- package/dist/client-v2/420.b2aedb1ff71fca0e.js +10 -0
- package/dist/client-v2/681.6890caa389564ff7.js +10 -0
- package/dist/client-v2/705.8dc34d43f02f322c.js +10 -0
- package/dist/client-v2/ai-employees/AIEmployeeShortcut.d.ts +2 -0
- package/dist/client-v2/ai-employees/AddContextButton.d.ts +2 -0
- package/dist/client-v2/ai-employees/chatbox/components/AIEmployeeSwitcher.d.ts +1 -0
- package/dist/client-v2/ai-employees/chatbox/components/ChatBoxUnreadBadge.d.ts +17 -0
- package/dist/client-v2/ai-employees/chatbox/components/Conversations.d.ts +9 -1
- package/dist/client-v2/ai-employees/chatbox/components/MessageRenderers.d.ts +1 -1
- package/dist/client-v2/ai-employees/chatbox/components/Messages.d.ts +5 -1
- package/dist/client-v2/ai-employees/chatbox/components/ModelSwitcher.d.ts +4 -0
- package/dist/client-v2/ai-employees/chatbox/components/Sender.d.ts +33 -1
- package/dist/client-v2/ai-employees/chatbox/components/index.d.ts +1 -0
- package/dist/client-v2/ai-employees/chatbox/hooks/useChat.d.ts +8 -5
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxEffect.d.ts +2 -1
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatConversationActions.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatMessageActions.d.ts +4 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useToolCallActions.d.ts +3 -1
- package/dist/client-v2/ai-employees/chatbox/hooks/useUploadFiles.d.ts +13 -3
- package/dist/client-v2/ai-employees/chatbox/hooks/useWorkflowTasks.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/index.d.ts +17 -0
- package/dist/client-v2/ai-employees/chatbox/roles.d.ts +2 -153
- package/dist/client-v2/ai-employees/chatbox/stores/chat-box.d.ts +46 -31
- package/dist/client-v2/ai-employees/chatbox/stores/chat-conversations.d.ts +7 -7
- package/dist/client-v2/ai-employees/chatbox/stores/chat-messages.d.ts +23 -18
- package/dist/client-v2/ai-employees/chatbox/stores/chat-sender.d.ts +43 -0
- package/dist/client-v2/ai-employees/chatbox/stores/chat-tool-call.d.ts +6 -5
- package/dist/client-v2/ai-employees/chatbox/stores/chat-tools.d.ts +11 -5
- package/dist/client-v2/ai-employees/chatbox/stores/mounted-chat-boxes.d.ts +20 -0
- package/dist/client-v2/ai-employees/chatbox/stores/runtime.d.ts +43 -0
- package/dist/client-v2/ai-employees/chatbox/stores/workflow-tasks.d.ts +22 -10
- package/dist/client-v2/ai-employees/chatbox/upload.d.ts +19 -0
- package/dist/client-v2/ai-employees/chatbox/utils.d.ts +28 -4
- package/dist/client-v2/ai-employees/frontend-tools.d.ts +11 -0
- package/dist/client-v2/ai-employees/tools/SuggestionsOptionsCard.d.ts +1 -1
- package/dist/client-v2/ai-employees/tools/WorkflowTaskOutputCard.d.ts +1 -1
- package/dist/client-v2/ai-employees/types.d.ts +30 -0
- package/dist/client-v2/block/ai-chat-box/AIChatBoxBlockModel.d.ts +21 -0
- package/dist/client-v2/block/ai-chat-box/AIChatBoxCoreModel.d.ts +13 -0
- package/dist/client-v2/block/ai-chat-box/components/AIChatBoxCoreView.d.ts +10 -0
- package/dist/client-v2/block/ai-chat-box/components/AIChatBoxView.d.ts +12 -0
- package/dist/client-v2/block/ai-chat-box/index.d.ts +14 -0
- package/dist/client-v2/block/ai-chat-box/settings.d.ts +12 -0
- package/dist/client-v2/block/ai-chat-box/sub-models.d.ts +26 -0
- package/dist/client-v2/block/ai-chat-box/types.d.ts +38 -0
- package/dist/client-v2/block/ai-chat-box/utils.d.ts +26 -0
- package/dist/client-v2/index.d.ts +3 -5
- package/dist/client-v2/index.js +3 -3
- package/dist/client-v2/llm-services/model-select.d.ts +33 -0
- package/dist/client-v2/llm-services/utils.d.ts +1 -0
- package/dist/client-v2/manager/ai-manager.d.ts +10 -3
- package/dist/client-v2/manager/frontend-tool-registry.d.ts +30 -0
- package/dist/client-v2/models/ai-employees/AIEmployeeActionModel.d.ts +4 -1
- package/dist/client-v2/models/ai-employees/AIEmployeeShortcutModel.d.ts +7 -0
- package/dist/client-v2/pages/EmployeesPage.d.ts +5 -0
- package/dist/client-v2/pages/LLMServicesPage.d.ts +9 -4
- package/dist/client-v2/runjs/registerAIEmployeeRunJSFacade.d.ts +1 -0
- package/dist/common/ai-employee-validation.d.ts +15 -0
- package/dist/common/ai-employee-validation.js +61 -0
- package/dist/common/error-codes.d.ts +13 -0
- package/dist/common/error-codes.js +48 -0
- package/dist/common/frontend-tools.d.ts +26 -0
- package/dist/common/frontend-tools.js +57 -0
- package/dist/common/llm-service-models.d.ts +16 -0
- package/dist/common/llm-service-models.js +84 -0
- package/dist/externalVersion.js +16 -16
- package/dist/locale/de-DE.json +2 -1
- package/dist/locale/en-US.json +73 -1
- package/dist/locale/es-ES.json +2 -1
- package/dist/locale/fr-FR.json +2 -1
- package/dist/locale/hu-HU.json +2 -1
- package/dist/locale/id-ID.json +2 -1
- package/dist/locale/it-IT.json +2 -1
- package/dist/locale/ja-JP.json +2 -1
- package/dist/locale/ko-KR.json +2 -1
- package/dist/locale/nl-NL.json +2 -1
- package/dist/locale/pt-BR.json +2 -1
- package/dist/locale/ru-RU.json +2 -1
- package/dist/locale/tr-TR.json +2 -1
- package/dist/locale/uk-UA.json +2 -1
- package/dist/locale/vi-VN.json +2 -1
- package/dist/locale/zh-CN.json +73 -1
- package/dist/locale/zh-TW.json +2 -1
- package/dist/node_modules/@langchain/mistralai/package.json +1 -1
- 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-conversations.d.ts +4 -1
- package/dist/server/ai-employees/ai-conversations.js +2 -0
- package/dist/server/ai-employees/ai-employee.d.ts +2 -1
- package/dist/server/ai-employees/ai-employee.js +26 -7
- package/dist/server/ai-employees/middleware/conversation.js +9 -2
- package/dist/server/collections/ai-conversations.js +5 -0
- package/dist/server/document-loader/constants.js +1 -1
- package/dist/server/frontend-tools.d.ts +25 -0
- package/dist/server/frontend-tools.js +171 -0
- package/dist/server/manager/work-context-handler.js +10 -3
- package/dist/server/plugin.d.ts +1 -0
- package/dist/server/plugin.js +25 -0
- package/dist/server/resource/aiConversations.d.ts +2 -0
- package/dist/server/resource/aiConversations.js +33 -3
- package/dist/server/resource/aiEmployees.d.ts +2 -0
- package/dist/server/resource/aiEmployees.js +62 -0
- package/dist/server/resource/aiWorkflowTasks.js +9 -1
- package/dist/server/resource/llmServices.d.ts +11 -0
- package/dist/server/resource/llmServices.js +85 -0
- package/dist/server/types/knowledge-base.type.d.ts +6 -2
- package/dist/swagger/common.d.ts +143 -0
- package/dist/swagger/common.js +144 -0
- package/dist/swagger/employees.d.ts +301 -0
- package/dist/swagger/employees.js +131 -0
- package/dist/swagger/index.d.ts +1596 -0
- package/dist/swagger/index.js +62 -0
- package/dist/swagger/llm.d.ts +563 -0
- package/dist/swagger/llm.js +255 -0
- package/dist/swagger/schemas.d.ts +736 -0
- package/dist/swagger/schemas.js +381 -0
- package/package.json +2 -2
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-store.md +0 -24
- package/dist/ai/docs/nocobase/data-sources/development/index.md +0 -6
- package/dist/client/372.40eb52905e3f3049.js +0 -10
- package/dist/client/681.399948c18d753667.js +0 -10
- package/dist/client/705.380279da896021fb.js +0 -10
- package/dist/client-v2/372.8cc3fde09c9bec77.js +0 -10
- package/dist/client-v2/406.341be51205c674e0.js +0 -10
- package/dist/client-v2/681.082f4f1c7b841983.js +0 -10
- package/dist/client-v2/ai-employees/chatbox/stores/create-selectors.d.ts +0 -46
- package/dist/client-v2/ai-employees/chatbox/utils/normalizeTriggerTaskOptions.d.ts +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"openai","version":"6.39.1","description":"The official TypeScript library for the OpenAI API","author":"OpenAI <support@openai.com>","types":"./index.d.ts","main":"./index.js","type":"commonjs","repository":"github:openai/openai-node","license":"Apache-2.0","packageManager":"yarn@1.22.22","files":["**/*"],"private":false,"publishConfig":{"access":"public"},"scripts":{"test":"./scripts/test","build":"./scripts/build","format":"./scripts/format","tsn":"ts-node -r tsconfig-paths/register","lint":"./scripts/lint","fix":"./scripts/format"},"dependencies":{},"bin":{"openai":"bin/cli"},"overrides":{"minimatch":"^9.0.5"},"pnpm":{"overrides":{"minimatch":"^9.0.5"}},"resolutions":{"minimatch":"^9.0.5"},"exports":{".":{"require":{"types":"./index.d.ts","default":"./index.js"},"types":"./index.d.mts","default":"./index.mjs"},"./_vendor/*.mjs":{"default":"./_vendor/*.mjs"},"./_vendor/*.js":{"default":"./_vendor/*.js"},"./_vendor/*":{"import":"./_vendor/*.mjs","require":"./_vendor/*.js"},"./api-promise":{"import":"./api-promise.mjs","require":"./api-promise.js"},"./api-promise.js":{"default":"./api-promise.js"},"./api-promise.mjs":{"default":"./api-promise.mjs"},"./auth/*.mjs":{"default":"./auth/*.mjs"},"./auth/*.js":{"default":"./auth/*.js"},"./auth/*":{"import":"./auth/*.mjs","require":"./auth/*.js"},"./azure":{"import":"./azure.mjs","require":"./azure.js"},"./azure.js":{"default":"./azure.js"},"./azure.mjs":{"default":"./azure.mjs"},"./beta/*.mjs":{"default":"./beta/*.mjs"},"./beta/*.js":{"default":"./beta/*.js"},"./beta/*":{"import":"./beta/*.mjs","require":"./beta/*.js"},"./client":{"import":"./client.mjs","require":"./client.js"},"./client.js":{"default":"./client.js"},"./client.mjs":{"default":"./client.mjs"},"./core/*.mjs":{"default":"./core/*.mjs"},"./core/*.js":{"default":"./core/*.js"},"./core/*":{"import":"./core/*.mjs","require":"./core/*.js"},"./error":{"import":"./error.mjs","require":"./error.js"},"./error.js":{"default":"./error.js"},"./error.mjs":{"default":"./error.mjs"},"./helpers/*.mjs":{"default":"./helpers/*.mjs"},"./helpers/*.js":{"default":"./helpers/*.js"},"./helpers/*":{"import":"./helpers/*.mjs","require":"./helpers/*.js"},"./index":{"import":"./index.mjs","require":"./index.js"},"./index.js":{"default":"./index.js"},"./index.mjs":{"default":"./index.mjs"},"./lib/*.mjs":{"default":"./lib/*.mjs"},"./lib/*.js":{"default":"./lib/*.js"},"./lib/*":{"import":"./lib/*.mjs","require":"./lib/*.js"},"./pagination":{"import":"./pagination.mjs","require":"./pagination.js"},"./pagination.js":{"default":"./pagination.js"},"./pagination.mjs":{"default":"./pagination.mjs"},"./realtime/*.mjs":{"default":"./realtime/*.mjs"},"./realtime/*.js":{"default":"./realtime/*.js"},"./realtime/*":{"import":"./realtime/*.mjs","require":"./realtime/*.js"},"./resource":{"import":"./resource.mjs","require":"./resource.js"},"./resource.js":{"default":"./resource.js"},"./resource.mjs":{"default":"./resource.mjs"},"./resources/*.mjs":{"default":"./resources/*.mjs"},"./resources/*.js":{"default":"./resources/*.js"},"./resources/*":{"import":"./resources/*.mjs","require":"./resources/*.js"},"./resources":{"import":"./resources.mjs","require":"./resources.js"},"./resources.js":{"default":"./resources.js"},"./resources.mjs":{"default":"./resources.mjs"},"./streaming":{"import":"./streaming.mjs","require":"./streaming.js"},"./streaming.js":{"default":"./streaming.js"},"./streaming.mjs":{"default":"./streaming.mjs"},"./uploads":{"import":"./uploads.mjs","require":"./uploads.js"},"./uploads.js":{"default":"./uploads.js"},"./uploads.mjs":{"default":"./uploads.mjs"},"./version":{"import":"./version.mjs","require":"./version.js"},"./version.js":{"default":"./version.js"},"./version.mjs":{"default":"./version.mjs"}},"peerDependencies":{"ws":"^8.18.0","zod":"^3.25 || ^4.0"},"peerDependenciesMeta":{"ws":{"optional":true},"zod":{"optional":true}},"_lastModified":"2026-
|
|
1
|
+
{"name":"openai","version":"6.39.1","description":"The official TypeScript library for the OpenAI API","author":"OpenAI <support@openai.com>","types":"./index.d.ts","main":"./index.js","type":"commonjs","repository":"github:openai/openai-node","license":"Apache-2.0","packageManager":"yarn@1.22.22","files":["**/*"],"private":false,"publishConfig":{"access":"public"},"scripts":{"test":"./scripts/test","build":"./scripts/build","format":"./scripts/format","tsn":"ts-node -r tsconfig-paths/register","lint":"./scripts/lint","fix":"./scripts/format"},"dependencies":{},"bin":{"openai":"bin/cli"},"overrides":{"minimatch":"^9.0.5"},"pnpm":{"overrides":{"minimatch":"^9.0.5"}},"resolutions":{"minimatch":"^9.0.5"},"exports":{".":{"require":{"types":"./index.d.ts","default":"./index.js"},"types":"./index.d.mts","default":"./index.mjs"},"./_vendor/*.mjs":{"default":"./_vendor/*.mjs"},"./_vendor/*.js":{"default":"./_vendor/*.js"},"./_vendor/*":{"import":"./_vendor/*.mjs","require":"./_vendor/*.js"},"./api-promise":{"import":"./api-promise.mjs","require":"./api-promise.js"},"./api-promise.js":{"default":"./api-promise.js"},"./api-promise.mjs":{"default":"./api-promise.mjs"},"./auth/*.mjs":{"default":"./auth/*.mjs"},"./auth/*.js":{"default":"./auth/*.js"},"./auth/*":{"import":"./auth/*.mjs","require":"./auth/*.js"},"./azure":{"import":"./azure.mjs","require":"./azure.js"},"./azure.js":{"default":"./azure.js"},"./azure.mjs":{"default":"./azure.mjs"},"./beta/*.mjs":{"default":"./beta/*.mjs"},"./beta/*.js":{"default":"./beta/*.js"},"./beta/*":{"import":"./beta/*.mjs","require":"./beta/*.js"},"./client":{"import":"./client.mjs","require":"./client.js"},"./client.js":{"default":"./client.js"},"./client.mjs":{"default":"./client.mjs"},"./core/*.mjs":{"default":"./core/*.mjs"},"./core/*.js":{"default":"./core/*.js"},"./core/*":{"import":"./core/*.mjs","require":"./core/*.js"},"./error":{"import":"./error.mjs","require":"./error.js"},"./error.js":{"default":"./error.js"},"./error.mjs":{"default":"./error.mjs"},"./helpers/*.mjs":{"default":"./helpers/*.mjs"},"./helpers/*.js":{"default":"./helpers/*.js"},"./helpers/*":{"import":"./helpers/*.mjs","require":"./helpers/*.js"},"./index":{"import":"./index.mjs","require":"./index.js"},"./index.js":{"default":"./index.js"},"./index.mjs":{"default":"./index.mjs"},"./lib/*.mjs":{"default":"./lib/*.mjs"},"./lib/*.js":{"default":"./lib/*.js"},"./lib/*":{"import":"./lib/*.mjs","require":"./lib/*.js"},"./pagination":{"import":"./pagination.mjs","require":"./pagination.js"},"./pagination.js":{"default":"./pagination.js"},"./pagination.mjs":{"default":"./pagination.mjs"},"./realtime/*.mjs":{"default":"./realtime/*.mjs"},"./realtime/*.js":{"default":"./realtime/*.js"},"./realtime/*":{"import":"./realtime/*.mjs","require":"./realtime/*.js"},"./resource":{"import":"./resource.mjs","require":"./resource.js"},"./resource.js":{"default":"./resource.js"},"./resource.mjs":{"default":"./resource.mjs"},"./resources/*.mjs":{"default":"./resources/*.mjs"},"./resources/*.js":{"default":"./resources/*.js"},"./resources/*":{"import":"./resources/*.mjs","require":"./resources/*.js"},"./resources":{"import":"./resources.mjs","require":"./resources.js"},"./resources.js":{"default":"./resources.js"},"./resources.mjs":{"default":"./resources.mjs"},"./streaming":{"import":"./streaming.mjs","require":"./streaming.js"},"./streaming.js":{"default":"./streaming.js"},"./streaming.mjs":{"default":"./streaming.mjs"},"./uploads":{"import":"./uploads.mjs","require":"./uploads.js"},"./uploads.js":{"default":"./uploads.js"},"./uploads.mjs":{"default":"./uploads.mjs"},"./version":{"import":"./version.mjs","require":"./version.js"},"./version.js":{"default":"./version.js"},"./version.mjs":{"default":"./version.mjs"}},"peerDependencies":{"ws":"^8.18.0","zod":"^3.25 || ^4.0"},"peerDependenciesMeta":{"ws":{"optional":true},"zod":{"optional":true}},"_lastModified":"2026-08-10T16:51:29.555Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-
|
|
1
|
+
{"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-08-10T16:51:27.719Z"}
|
|
@@ -9,11 +9,13 @@
|
|
|
9
9
|
import { Model, Transaction } from '@nocobase/database';
|
|
10
10
|
import PluginAIServer from '../plugin';
|
|
11
11
|
import { AIMessage, SubAgentConversationMetadata, UserDecision } from '../types';
|
|
12
|
+
import type { FrontendToolManifest } from '../../common/frontend-tools';
|
|
12
13
|
export type AIConversationsOptions = {
|
|
13
14
|
systemMessage?: unknown;
|
|
14
15
|
skillSettings?: unknown;
|
|
15
16
|
conversationSettings?: unknown;
|
|
16
17
|
modelSettings?: unknown;
|
|
18
|
+
frontendTools?: FrontendToolManifest[];
|
|
17
19
|
[key: string]: unknown;
|
|
18
20
|
};
|
|
19
21
|
export type AIConversationFilterParams = {
|
|
@@ -29,6 +31,7 @@ export type CreateAIConversationParams = {
|
|
|
29
31
|
title?: string;
|
|
30
32
|
options?: AIConversationsOptions;
|
|
31
33
|
from?: 'main-agent' | 'sub-agent';
|
|
34
|
+
scope?: string;
|
|
32
35
|
transaction?: Transaction;
|
|
33
36
|
category?: 'chat' | 'task';
|
|
34
37
|
};
|
|
@@ -55,7 +58,7 @@ export declare const registerAIConversationReadNotification: (plugin: PluginAISe
|
|
|
55
58
|
export declare class AIConversationsManager {
|
|
56
59
|
protected plugin: PluginAIServer;
|
|
57
60
|
constructor(plugin: PluginAIServer);
|
|
58
|
-
create({ userId, aiEmployee, title, options, from, transaction, category, }: CreateAIConversationParams): Promise<any>;
|
|
61
|
+
create({ userId, aiEmployee, title, options, from, scope, transaction, category, }: CreateAIConversationParams): Promise<any>;
|
|
59
62
|
update({ userId, sessionId, title, options: inputOptions }: UpdateAIConversationParams): Promise<any>;
|
|
60
63
|
getConversation({ sessionId, userId }: {
|
|
61
64
|
sessionId: string;
|
|
@@ -66,6 +66,7 @@ class AIConversationsManager {
|
|
|
66
66
|
title,
|
|
67
67
|
options = {},
|
|
68
68
|
from = "main-agent",
|
|
69
|
+
scope,
|
|
69
70
|
transaction,
|
|
70
71
|
category = "chat"
|
|
71
72
|
}) {
|
|
@@ -77,6 +78,7 @@ class AIConversationsManager {
|
|
|
77
78
|
options,
|
|
78
79
|
thread: 1,
|
|
79
80
|
from,
|
|
81
|
+
...scope !== void 0 ? { scope } : {},
|
|
80
82
|
category
|
|
81
83
|
},
|
|
82
84
|
transaction
|
|
@@ -36,6 +36,7 @@ export declare class AIEmployee {
|
|
|
36
36
|
employee: Model;
|
|
37
37
|
aiChatConversation: AIChatConversation;
|
|
38
38
|
skillSettings?: Record<string, any>;
|
|
39
|
+
userMessageCount: number;
|
|
39
40
|
private plugin;
|
|
40
41
|
private db;
|
|
41
42
|
private ctx;
|
|
@@ -117,7 +118,7 @@ export declare class AIEmployee {
|
|
|
117
118
|
initToolCall(transaction: Transaction, messageId: string, toolCalls: {
|
|
118
119
|
id: string;
|
|
119
120
|
name: string;
|
|
120
|
-
args:
|
|
121
|
+
args: unknown;
|
|
121
122
|
}[]): Promise<Model<AIToolMessage>[]>;
|
|
122
123
|
updateToolCallInterrupted(sessionId: string, messageId: string, toolCallId: string, interruptId: string, interruptAction: {
|
|
123
124
|
order: number;
|
|
@@ -56,12 +56,15 @@ var import_base = require("@langchain/core/callbacks/base");
|
|
|
56
56
|
var import_shared = require("../../ai/tools/sub-agents/shared");
|
|
57
57
|
var import_tool_call_sanitizer = require("./tool-call-sanitizer");
|
|
58
58
|
var import_attachments = require("../attachments");
|
|
59
|
+
var import_frontend_tools = require("../../common/frontend-tools");
|
|
60
|
+
var import_frontend_tools2 = require("../frontend-tools");
|
|
59
61
|
class AIEmployee {
|
|
60
62
|
sessionId;
|
|
61
63
|
from = "main-agent";
|
|
62
64
|
employee;
|
|
63
65
|
aiChatConversation;
|
|
64
66
|
skillSettings;
|
|
67
|
+
userMessageCount = 0;
|
|
65
68
|
plugin;
|
|
66
69
|
db;
|
|
67
70
|
ctx;
|
|
@@ -204,6 +207,7 @@ class AIEmployee {
|
|
|
204
207
|
const { provider, model, service } = await this.plugin.aiManager.getLLMService({
|
|
205
208
|
...this.model
|
|
206
209
|
});
|
|
210
|
+
this.userMessageCount = (userMessages ?? []).filter((message) => message.role === "user").length;
|
|
207
211
|
const { historyMessages, tools, resolvedTools, middleware, config, state } = await this.initSession({
|
|
208
212
|
messageId,
|
|
209
213
|
provider,
|
|
@@ -769,11 +773,12 @@ If information is missing, clearly state it in the summary.</Important>`;
|
|
|
769
773
|
async initToolCall(transaction, messageId, toolCalls) {
|
|
770
774
|
const nowTime = /* @__PURE__ */ new Date();
|
|
771
775
|
const toolMap = await this.getToolsMap();
|
|
776
|
+
const currentFrontendTools = toolCalls.some((toolCall) => toolCall.name === import_frontend_tools.EXECUTE_FRONTEND_TOOL_NAME) ? await (0, import_frontend_tools2.listCurrentFrontendTools)(this.ctx, this.sessionId) : [];
|
|
772
777
|
return await this.aiToolMessagesRepo.create({
|
|
773
778
|
values: toolCalls.map((toolCall) => {
|
|
774
779
|
const toolsExisted = toolMap.has(toolCall.name);
|
|
775
780
|
const tools = toolMap.get(toolCall.name);
|
|
776
|
-
const auto = this.isAutoCall(tools);
|
|
781
|
+
const auto = toolCall.name === import_frontend_tools.EXECUTE_FRONTEND_TOOL_NAME ? toolsExisted && (0, import_frontend_tools2.shouldAutoExecuteFrontendTool)(currentFrontendTools, toolCall.args) : this.isAutoCall(tools);
|
|
777
782
|
return {
|
|
778
783
|
id: this.plugin.snowflake.generate(),
|
|
779
784
|
sessionId: this.sessionId,
|
|
@@ -1190,7 +1195,12 @@ If information is missing, clearly state it in the summary.</Important>`;
|
|
|
1190
1195
|
if (!this.areToolsEnabled()) {
|
|
1191
1196
|
return [];
|
|
1192
1197
|
}
|
|
1198
|
+
const currentFrontendTools = await (0, import_frontend_tools2.listCurrentFrontendTools)(this.ctx, this.sessionId);
|
|
1193
1199
|
const tools = await this.listTools({ scope: "GENERAL" });
|
|
1200
|
+
const getSkill = await this.toolsManager.getTools(import_ai.SYSTEM_TOOLS.GET_SKILL, { ctx: this.ctx });
|
|
1201
|
+
if (getSkill) {
|
|
1202
|
+
tools.push(getSkill);
|
|
1203
|
+
}
|
|
1194
1204
|
if (this.webSearch === true) {
|
|
1195
1205
|
const subAgentWebSearch = await this.toolsManager.getTools(import_ai.SYSTEM_TOOLS.WEB_SEARCH, { ctx: this.ctx });
|
|
1196
1206
|
tools.push(subAgentWebSearch);
|
|
@@ -1217,20 +1227,26 @@ If information is missing, clearly state it in the summary.</Important>`;
|
|
|
1217
1227
|
}
|
|
1218
1228
|
tools.push(tool);
|
|
1219
1229
|
}
|
|
1220
|
-
const systemTools = (0, import_ai.listSystemTools)();
|
|
1230
|
+
const systemTools = [...(0, import_ai.listSystemTools)(), import_frontend_tools.LOAD_FRONTEND_TOOL_NAME, import_frontend_tools.EXECUTE_FRONTEND_TOOL_NAME];
|
|
1221
1231
|
if (!this.skillSettings) {
|
|
1222
|
-
return tools;
|
|
1232
|
+
return (0, import_frontend_tools2.prepareToolsForFrontendConversation)(tools, currentFrontendTools);
|
|
1223
1233
|
} else if (!this.skillSettings.toolsVersion) {
|
|
1224
1234
|
const toolFilter = this.skillSettings.tools ?? [];
|
|
1225
|
-
return
|
|
1226
|
-
|
|
1235
|
+
return (0, import_frontend_tools2.prepareToolsForFrontendConversation)(
|
|
1236
|
+
tools.filter(
|
|
1237
|
+
(t) => toolFilter.length === 0 || systemTools.includes(t.definition.name) || toolFilter.includes(t.definition.name)
|
|
1238
|
+
),
|
|
1239
|
+
currentFrontendTools
|
|
1227
1240
|
);
|
|
1228
1241
|
} else {
|
|
1229
1242
|
const toolFilter = this.skillSettings.tools;
|
|
1230
1243
|
if (import_lodash.default.isArray(toolFilter)) {
|
|
1231
|
-
return
|
|
1244
|
+
return (0, import_frontend_tools2.prepareToolsForFrontendConversation)(
|
|
1245
|
+
tools.filter((t) => systemTools.includes(t.definition.name) || toolFilter.includes(t.definition.name)),
|
|
1246
|
+
currentFrontendTools
|
|
1247
|
+
);
|
|
1232
1248
|
} else {
|
|
1233
|
-
return tools;
|
|
1249
|
+
return (0, import_frontend_tools2.prepareToolsForFrontendConversation)(tools, currentFrontendTools);
|
|
1234
1250
|
}
|
|
1235
1251
|
}
|
|
1236
1252
|
}
|
|
@@ -1272,6 +1288,9 @@ If information is missing, clearly state it in the summary.</Important>`;
|
|
|
1272
1288
|
}
|
|
1273
1289
|
const baseTools = await this.getAIEmployeeTools();
|
|
1274
1290
|
const toolMap = await this.getToolsMap();
|
|
1291
|
+
for (const tool of baseTools) {
|
|
1292
|
+
toolMap.set(tool.definition.name, tool);
|
|
1293
|
+
}
|
|
1275
1294
|
const availableSkills = await this.getAvailableSkills();
|
|
1276
1295
|
const skillOwnedToolNames = new Set(availableSkills.flatMap((it) => it.tools ?? []));
|
|
1277
1296
|
const baseToolNames = new Set(
|
|
@@ -98,8 +98,9 @@ const conversationMiddleware = (aiEmployee, options) => {
|
|
|
98
98
|
})
|
|
99
99
|
}),
|
|
100
100
|
beforeAgent: async (state) => {
|
|
101
|
-
const
|
|
102
|
-
const
|
|
101
|
+
const humanMessages = state.messages.filter((x) => x.type === "human");
|
|
102
|
+
const currentHumanMessageIndex = humanMessages.length;
|
|
103
|
+
const userMessages = (aiEmployee.userMessageCount ? humanMessages.slice(-aiEmployee.userMessageCount) : []).map((x) => x).map(convertHumanMessage);
|
|
103
104
|
await aiEmployee.aiChatConversation.withTransaction(async (conversation, transaction) => {
|
|
104
105
|
if (agentThread) {
|
|
105
106
|
await aiEmployee.updateThread(transaction, agentThread);
|
|
@@ -111,6 +112,12 @@ const conversationMiddleware = (aiEmployee, options) => {
|
|
|
111
112
|
await conversation.addMessages(userMessages);
|
|
112
113
|
}
|
|
113
114
|
});
|
|
115
|
+
return {
|
|
116
|
+
lastMessageIndex: {
|
|
117
|
+
...state.lastMessageIndex,
|
|
118
|
+
lastHumanMessageIndex: currentHumanMessageIndex
|
|
119
|
+
}
|
|
120
|
+
};
|
|
114
121
|
},
|
|
115
122
|
afterAgent: async () => {
|
|
116
123
|
aiEmployee.removeAbortController();
|
|
@@ -33,12 +33,12 @@ module.exports = __toCommonJS(constants_exports);
|
|
|
33
33
|
const DOCUMENT_PARSE_META_KEY = "documentParse";
|
|
34
34
|
const SUPPORTED_DOCUMENT_EXTNAMES = [
|
|
35
35
|
".pdf",
|
|
36
|
-
".ppt",
|
|
37
36
|
".pptx",
|
|
38
37
|
".doc",
|
|
39
38
|
".docx",
|
|
40
39
|
".xls",
|
|
41
40
|
".xlsx",
|
|
41
|
+
".xlsm",
|
|
42
42
|
".txt",
|
|
43
43
|
".md",
|
|
44
44
|
".json",
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
import type { Context } from '@nocobase/actions';
|
|
10
|
+
import { type FrontendToolManifest } from '../common/frontend-tools';
|
|
11
|
+
import type { WorkContext } from './types/ai-message.type';
|
|
12
|
+
export declare const extractFrontendToolManifests: (workContext: WorkContext[]) => FrontendToolManifest[];
|
|
13
|
+
export declare const listCurrentFrontendTools: (ctx: Context, sessionId?: string) => Promise<FrontendToolManifest[]>;
|
|
14
|
+
export declare const findCurrentFrontendTool: (ctx: Context, toolId: string, sessionId?: string) => Promise<FrontendToolManifest | undefined>;
|
|
15
|
+
export declare const shouldAutoExecuteFrontendTool: (tools: FrontendToolManifest[], args: unknown) => boolean;
|
|
16
|
+
export declare const prepareToolsForFrontendConversation: <T extends {
|
|
17
|
+
definition: {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
}>(tools: T[], frontendTools: FrontendToolManifest[]) => T[];
|
|
22
|
+
export declare const readFrontendToolResult: (ctx: Context, toolCallId: string) => {
|
|
23
|
+
provided: true;
|
|
24
|
+
value: unknown;
|
|
25
|
+
} | undefined;
|
|
@@ -0,0 +1,171 @@
|
|
|
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
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var frontend_tools_exports = {};
|
|
28
|
+
__export(frontend_tools_exports, {
|
|
29
|
+
extractFrontendToolManifests: () => extractFrontendToolManifests,
|
|
30
|
+
findCurrentFrontendTool: () => findCurrentFrontendTool,
|
|
31
|
+
listCurrentFrontendTools: () => listCurrentFrontendTools,
|
|
32
|
+
prepareToolsForFrontendConversation: () => prepareToolsForFrontendConversation,
|
|
33
|
+
readFrontendToolResult: () => readFrontendToolResult,
|
|
34
|
+
shouldAutoExecuteFrontendTool: () => shouldAutoExecuteFrontendTool
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(frontend_tools_exports);
|
|
37
|
+
var import_zod = require("zod");
|
|
38
|
+
var import_frontend_tools = require("../common/frontend-tools");
|
|
39
|
+
const isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
40
|
+
const isMessageLike = (value) => !!value && typeof value === "object";
|
|
41
|
+
const normalizeFrontendToolManifests = (value) => {
|
|
42
|
+
if (!Array.isArray(value)) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
const manifests = /* @__PURE__ */ new Map();
|
|
46
|
+
for (const manifest of value) {
|
|
47
|
+
if ((0, import_frontend_tools.isFrontendToolManifest)(manifest) && manifest.id === `${manifest.blockUid}:${manifest.name}`) {
|
|
48
|
+
manifests.set(manifest.id, manifest);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return Array.from(manifests.values());
|
|
52
|
+
};
|
|
53
|
+
const extractFrontendToolManifests = (workContext) => {
|
|
54
|
+
const manifests = /* @__PURE__ */ new Map();
|
|
55
|
+
for (const item of workContext) {
|
|
56
|
+
const frontendTools = Array.isArray(item == null ? void 0 : item.frontendTools) ? item.frontendTools : [];
|
|
57
|
+
for (const frontendTool of frontendTools) {
|
|
58
|
+
if ((0, import_frontend_tools.isFrontendToolManifest)(frontendTool) && frontendTool.blockUid === item.uid && frontendTool.id === `${item.uid}:${frontendTool.name}`) {
|
|
59
|
+
manifests.set(frontendTool.id, frontendTool);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return Array.from(manifests.values());
|
|
64
|
+
};
|
|
65
|
+
const findRequestFrontendTools = (ctx) => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
const values = (_b = (_a = ctx.action) == null ? void 0 : _a.params) == null ? void 0 : _b.values;
|
|
68
|
+
const messages = Array.isArray(values == null ? void 0 : values.messages) ? values.messages.filter(isMessageLike) : [];
|
|
69
|
+
for (const message of messages) {
|
|
70
|
+
if (message.role !== "user") {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const frontendTools = extractFrontendToolManifests(Array.isArray(message.workContext) ? message.workContext : []);
|
|
74
|
+
if (frontendTools.length) {
|
|
75
|
+
return frontendTools;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return [];
|
|
79
|
+
};
|
|
80
|
+
const listCurrentFrontendTools = async (ctx, sessionId) => {
|
|
81
|
+
var _a, _b, _c;
|
|
82
|
+
const requestSessionId = (_c = (_b = (_a = ctx.action) == null ? void 0 : _a.params) == null ? void 0 : _b.values) == null ? void 0 : _c.sessionId;
|
|
83
|
+
const currentSessionId = sessionId ?? (typeof requestSessionId === "string" ? requestSessionId : "");
|
|
84
|
+
if (!currentSessionId) {
|
|
85
|
+
return findRequestFrontendTools(ctx);
|
|
86
|
+
}
|
|
87
|
+
const conversationRepository = ctx.db.getRepository("aiConversations");
|
|
88
|
+
const conversation = await conversationRepository.findOne({
|
|
89
|
+
filter: {
|
|
90
|
+
sessionId: currentSessionId
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const options = conversation == null ? void 0 : conversation.options;
|
|
94
|
+
const boundTools = normalizeFrontendToolManifests(isRecord(options) ? options.frontendTools : void 0);
|
|
95
|
+
if (boundTools.length) {
|
|
96
|
+
return boundTools;
|
|
97
|
+
}
|
|
98
|
+
const frontendTools = findRequestFrontendTools(ctx);
|
|
99
|
+
if (!frontendTools.length || !conversation) {
|
|
100
|
+
return frontendTools;
|
|
101
|
+
}
|
|
102
|
+
await conversationRepository.update({
|
|
103
|
+
filter: {
|
|
104
|
+
sessionId: currentSessionId
|
|
105
|
+
},
|
|
106
|
+
values: {
|
|
107
|
+
options: {
|
|
108
|
+
...isRecord(options) ? options : {},
|
|
109
|
+
frontendTools
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return frontendTools;
|
|
114
|
+
};
|
|
115
|
+
const findCurrentFrontendTool = async (ctx, toolId, sessionId) => {
|
|
116
|
+
const tools = await listCurrentFrontendTools(ctx, sessionId);
|
|
117
|
+
return tools.find((tool) => tool.id === toolId);
|
|
118
|
+
};
|
|
119
|
+
const shouldAutoExecuteFrontendTool = (tools, args) => {
|
|
120
|
+
var _a;
|
|
121
|
+
if (!isRecord(args) || typeof args.toolId !== "string") {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return ((_a = tools.find((tool) => tool.id === args.toolId)) == null ? void 0 : _a.permission) === "ALLOW";
|
|
125
|
+
};
|
|
126
|
+
const prepareToolsForFrontendConversation = (tools, frontendTools) => {
|
|
127
|
+
if (!frontendTools.length) {
|
|
128
|
+
return tools.filter(
|
|
129
|
+
(tool) => tool.definition.name !== import_frontend_tools.LOAD_FRONTEND_TOOL_NAME && tool.definition.name !== import_frontend_tools.EXECUTE_FRONTEND_TOOL_NAME
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
const catalog = frontendTools.map(({ id, name, title, description }) => ({ id, name, title, description }));
|
|
133
|
+
const toolIds = frontendTools.map((tool) => tool.id);
|
|
134
|
+
const toolIdSchema = import_zod.z.enum(toolIds).describe(`Use an exact tool id from this catalog: ${JSON.stringify(catalog)}`);
|
|
135
|
+
return tools.map((tool) => {
|
|
136
|
+
if (tool.definition.name !== import_frontend_tools.LOAD_FRONTEND_TOOL_NAME && tool.definition.name !== import_frontend_tools.EXECUTE_FRONTEND_TOOL_NAME) {
|
|
137
|
+
return tool;
|
|
138
|
+
}
|
|
139
|
+
const isLoader = tool.definition.name === import_frontend_tools.LOAD_FRONTEND_TOOL_NAME;
|
|
140
|
+
return {
|
|
141
|
+
...tool,
|
|
142
|
+
definition: {
|
|
143
|
+
...tool.definition,
|
|
144
|
+
description: `${tool.definition.description}
|
|
145
|
+
|
|
146
|
+
frontendToolCatalog: ${JSON.stringify(catalog)}`,
|
|
147
|
+
schema: isLoader ? import_zod.z.object({ toolId: toolIdSchema }) : import_zod.z.object({
|
|
148
|
+
toolId: toolIdSchema,
|
|
149
|
+
args: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).default({})
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
const readFrontendToolResult = (ctx, toolCallId) => {
|
|
156
|
+
var _a, _b, _c;
|
|
157
|
+
const toolCallResults = (_c = (_b = (_a = ctx.action) == null ? void 0 : _a.params) == null ? void 0 : _b.values) == null ? void 0 : _c.toolCallResults;
|
|
158
|
+
const result = Array.isArray(toolCallResults) ? toolCallResults.find(
|
|
159
|
+
(item) => isRecord(item) && item.id === toolCallId && "result" in item
|
|
160
|
+
) : void 0;
|
|
161
|
+
return result ? { provided: true, value: result.result } : void 0;
|
|
162
|
+
};
|
|
163
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
164
|
+
0 && (module.exports = {
|
|
165
|
+
extractFrontendToolManifests,
|
|
166
|
+
findCurrentFrontendTool,
|
|
167
|
+
listCurrentFrontendTools,
|
|
168
|
+
prepareToolsForFrontendConversation,
|
|
169
|
+
readFrontendToolResult,
|
|
170
|
+
shouldAutoExecuteFrontendTool
|
|
171
|
+
});
|
|
@@ -41,6 +41,7 @@ __export(work_context_handler_exports, {
|
|
|
41
41
|
module.exports = __toCommonJS(work_context_handler_exports);
|
|
42
42
|
var import_utils = require("@nocobase/utils");
|
|
43
43
|
var import_lodash = __toESM(require("lodash"));
|
|
44
|
+
const MODEL_EXCLUDED_FIELDS = /* @__PURE__ */ new Set(["frontendTools"]);
|
|
44
45
|
const createWorkContextHandler = (plugin) => new WorkContextHandlerImpl(plugin);
|
|
45
46
|
class WorkContextHandlerImpl {
|
|
46
47
|
constructor(plugin) {
|
|
@@ -82,11 +83,17 @@ class WorkContextHandlerImpl {
|
|
|
82
83
|
if (!contextItem) {
|
|
83
84
|
return "";
|
|
84
85
|
}
|
|
85
|
-
const
|
|
86
|
+
const modelContext = this.excludeInternalFields(contextItem);
|
|
87
|
+
const { resolve } = this.strategies.get(modelContext.type) ?? {};
|
|
86
88
|
if (resolve) {
|
|
87
|
-
return await resolve(ctx,
|
|
89
|
+
return await resolve(ctx, modelContext);
|
|
88
90
|
}
|
|
89
|
-
return await ((_b = (_a = this.defaultStrategy).resolve) == null ? void 0 : _b.call(_a, ctx,
|
|
91
|
+
return await ((_b = (_a = this.defaultStrategy).resolve) == null ? void 0 : _b.call(_a, ctx, modelContext));
|
|
92
|
+
}
|
|
93
|
+
excludeInternalFields(contextItem) {
|
|
94
|
+
return Object.fromEntries(
|
|
95
|
+
Object.entries(contextItem).filter(([field]) => !MODEL_EXCLUDED_FIELDS.has(field))
|
|
96
|
+
);
|
|
90
97
|
}
|
|
91
98
|
}
|
|
92
99
|
const Stringify = (_plugin) => async (_ctx, contextItem) => {
|
package/dist/server/plugin.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export declare class PluginAIServer extends Plugin {
|
|
|
62
62
|
get repositories(): {
|
|
63
63
|
aiContextDatasources: import("@nocobase/database").Repository<any, any>;
|
|
64
64
|
};
|
|
65
|
+
private registerAIFileAccessAuthorizer;
|
|
65
66
|
get fileManager(): PluginFileManagerServer;
|
|
66
67
|
private repository;
|
|
67
68
|
}
|
package/dist/server/plugin.js
CHANGED
|
@@ -56,6 +56,7 @@ var import_ai_employees_manager = require("./ai-employees/ai-employees-manager")
|
|
|
56
56
|
var import_ai_conversations = require("./ai-employees/ai-conversations");
|
|
57
57
|
var import_snowflake = __toESM(require("./snowflake"));
|
|
58
58
|
var aiEmployeeActions = __toESM(require("./resource/aiEmployees"));
|
|
59
|
+
var llmServiceActions = __toESM(require("./resource/llmServices"));
|
|
59
60
|
var import_google_genai = require("./llm-providers/google-genai");
|
|
60
61
|
var import_ai_employee = require("./workflow/triggers/ai-employee");
|
|
61
62
|
var import_tools = require("./tools");
|
|
@@ -169,6 +170,7 @@ class PluginAIServer extends import_server.Plugin {
|
|
|
169
170
|
this.defineResources();
|
|
170
171
|
this.registerMcpClientEvents();
|
|
171
172
|
this.setPermissions();
|
|
173
|
+
this.registerAIFileAccessAuthorizer();
|
|
172
174
|
this.registerWorkflow();
|
|
173
175
|
this.registerWorkContextResolveStrategy();
|
|
174
176
|
(0, import_employee.registerAIEmployeeTaskNotification)(this);
|
|
@@ -235,6 +237,9 @@ class PluginAIServer extends import_server.Plugin {
|
|
|
235
237
|
Object.entries(aiEmployeeActions).forEach(([name, action]) => {
|
|
236
238
|
this.app.resourceManager.registerActionHandler(`aiEmployees:${name}`, action);
|
|
237
239
|
});
|
|
240
|
+
Object.entries(llmServiceActions).forEach(([name, action]) => {
|
|
241
|
+
this.app.resourceManager.registerActionHandler(`llmServices:${name}`, action);
|
|
242
|
+
});
|
|
238
243
|
}
|
|
239
244
|
registerMcpClientEvents() {
|
|
240
245
|
this.db.on("aiMcpClients.afterCreate", (model, { transaction } = {}) => {
|
|
@@ -370,6 +375,26 @@ class PluginAIServer extends import_server.Plugin {
|
|
|
370
375
|
aiContextDatasources: this.repository("aiContextDatasources")
|
|
371
376
|
};
|
|
372
377
|
}
|
|
378
|
+
registerAIFileAccessAuthorizer() {
|
|
379
|
+
this.fileManager.registerFileAccessAuthorizer({
|
|
380
|
+
name: "ai-files",
|
|
381
|
+
authorize: async (ctx, params) => {
|
|
382
|
+
var _a;
|
|
383
|
+
const currentUserId = (_a = ctx.state.currentUser) == null ? void 0 : _a.id;
|
|
384
|
+
if (params.dataSourceKey !== "main" || params.collectionName !== "aiFiles" || !currentUserId) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
const file = await ctx.db.getRepository("aiFiles").findOne({
|
|
388
|
+
filter: {
|
|
389
|
+
id: params.id,
|
|
390
|
+
createdById: currentUserId
|
|
391
|
+
},
|
|
392
|
+
fields: ["id"]
|
|
393
|
+
});
|
|
394
|
+
return Boolean(file);
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
}
|
|
373
398
|
get fileManager() {
|
|
374
399
|
return this.app.pm.get("file-manager");
|
|
375
400
|
}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { Context, Next } from '@nocobase/actions';
|
|
10
|
+
import { Model } from '@nocobase/database';
|
|
11
|
+
export declare function isAIEmployeeEnabled(employee: Model | null | undefined): boolean;
|
|
10
12
|
declare function loginInCheck(ctx: Context, next: Next): Promise<never>;
|
|
11
13
|
declare const _default: {
|
|
12
14
|
name: string;
|