@nocobase/plugin-ai 2.1.0-beta.15 → 2.1.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/ai-employees/atlas/index.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/ai-coding/prompt.js → ai/ai-employees/atlas/index.js} +29 -20
- package/dist/ai/ai-employees/atlas/prompt.md +84 -0
- package/dist/ai/ai-employees/dara.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/data-visualization/prompt.js → ai/ai-employees/dara.js} +21 -13
- package/dist/ai/ai-employees/dex.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/data-organizer/prompt.js → ai/ai-employees/dex.js} +15 -7
- package/dist/ai/ai-employees/ellis.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/email-assistant/prompt.js → ai/ai-employees/ellis.js} +19 -11
- package/dist/ai/ai-employees/lexi.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/translator/prompt.js → ai/ai-employees/lexi.js} +15 -7
- package/dist/ai/ai-employees/vera.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/research-analyst/prompt.js → ai/ai-employees/vera.js} +16 -8
- package/dist/ai/ai-employees/viz.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/insights-analyst/prompt.js → ai/ai-employees/viz.js} +15 -7
- package/dist/ai/skills/business-analysis-report/SKILLS.md +88 -0
- package/dist/{server/ai-employees/built-in/ai-coding/prompt.d.ts → ai/skills/business-analysis-report/tools/businessReportGenerator.d.ts} +1 -3
- package/dist/ai/skills/business-analysis-report/tools/businessReportGenerator.js +98 -0
- package/dist/ai/skills/document-search/SKILLS.md +69 -0
- package/dist/ai/tools/chartGenerator.js +15 -3
- package/dist/ai/tools/formFiller.js +13 -2
- package/dist/{server/ai-employees/built-in/data-modeling/prompt.d.ts → ai/tools/getSkill.d.ts} +1 -3
- package/dist/{server/ai-employees/built-in/data-modeling/index.js → ai/tools/getSkill.js} +39 -32
- package/dist/{server/ai-employees/built-in/data-organizer/prompt.d.ts → ai/tools/knowledge-base-retrieve.d.ts} +1 -3
- package/dist/ai/tools/knowledge-base-retrieve.js +94 -0
- package/dist/{server/ai-employees/built-in/data-visualization/prompt.d.ts → ai/tools/sub-agents/dispatch-sub-agent-task.d.ts} +1 -3
- package/dist/ai/tools/sub-agents/dispatch-sub-agent-task.js +108 -0
- package/dist/ai/tools/sub-agents/get-ai-employee.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/translator/profile.js → ai/tools/sub-agents/get-ai-employee.js} +28 -21
- package/dist/ai/tools/sub-agents/list-ai-employees.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/email-assistant/profile.js → ai/tools/sub-agents/list-ai-employees.js} +25 -21
- package/dist/ai/tools/sub-agents/shared.d.ts +33 -0
- package/dist/ai/tools/sub-agents/shared.js +169 -0
- package/dist/ai/tools/suggestions.js +15 -4
- package/dist/client/170.d98eacdc00d9d527.js +10 -0
- package/dist/client/228.b18148eb1009d2fb.js +10 -0
- package/dist/client/280.029428b83d62155f.js +10 -0
- package/dist/client/290.0888139e33c9b7cb.js +10 -0
- package/dist/client/{524.954f96ec4fc2fd7a.js → 331.d547c95410476a69.js} +1 -1
- package/dist/client/343.83f7d96664e4e038.js +10 -0
- package/dist/client/406.15c09d98faa2ccf1.js +10 -0
- package/dist/client/428.e9f38da3b0d8b498.js +10 -0
- package/dist/client/486.afbed6b132b3c0dd.js +10 -0
- package/dist/client/502.2b4a51e0a8122e52.js +10 -0
- package/dist/client/525.33a9c8ec28be4ec4.js +10 -0
- package/dist/client/559.133d286a0a0a1d93.js +10 -0
- package/dist/client/{91.90e7098b7fbd5d00.js → 561.776886c5308e3c26.js} +1 -1
- package/dist/client/580.e75f97fb883ad042.js +10 -0
- package/dist/client/597.aa363881a325b5c0.js +10 -0
- package/dist/client/604.de96f3ec4d471afd.js +10 -0
- package/dist/client/614.aa766080f6b99aab.js +10 -0
- package/dist/client/646.51313bb0d85d6366.js +10 -0
- package/dist/client/687.224e569a99cae4bb.js +10 -0
- package/dist/client/699.57c0a1acb723202a.js +10 -0
- package/dist/client/711.266b8f1c520d467a.js +10 -0
- package/dist/client/758.a9741e81911e53c3.js +10 -0
- package/dist/client/768.973ce32e15099a48.js +10 -0
- package/dist/client/792.ae8ad1fcae9fd974.js +10 -0
- package/dist/client/820.6a26239ea96c075a.js +10 -0
- package/dist/client/832.0cf69e3f43c320b2.js +10 -0
- package/dist/client/927.ff5cd05b14901ae6.js +10 -0
- package/dist/client/ai-employees/admin/SkillSettings.d.ts +7 -5
- package/dist/client/ai-employees/admin/ToolsSettings.d.ts +17 -0
- package/dist/client/ai-employees/admin/mcp/MCPSettings.d.ts +10 -0
- package/dist/client/ai-employees/admin/mcp/MCPToolsList.d.ts +19 -0
- package/dist/client/ai-employees/admin/mcp/context.d.ts +15 -0
- package/dist/client/ai-employees/admin/mcp/schemas.d.ts +1286 -0
- package/dist/client/ai-employees/built-in/utils.d.ts +1 -0
- package/dist/client/ai-employees/business-report/tools/index.d.ts +10 -0
- package/dist/client/ai-employees/business-report/ui/BusinessReportCard.d.ts +12 -0
- package/dist/client/ai-employees/business-report/ui/BusinessReportModal.d.ts +17 -0
- package/dist/client/ai-employees/business-report/ui/report-utils.d.ts +38 -0
- package/dist/client/ai-employees/chatbox/AIEmployeeSwitch.d.ts +3 -2
- package/dist/client/ai-employees/chatbox/HintMessageHeader.d.ts +10 -0
- package/dist/client/ai-employees/chatbox/ModelSwitcher.d.ts +3 -1
- package/dist/client/ai-employees/chatbox/SearchSwitch.d.ts +3 -1
- package/dist/client/ai-employees/chatbox/Upload.d.ts +3 -1
- package/dist/client/ai-employees/chatbox/conversations/ConversationsList.d.ts +27 -0
- package/dist/client/ai-employees/chatbox/conversations/WorkflowTasksList.d.ts +33 -0
- package/dist/client/ai-employees/chatbox/conversations/common.d.ts +43 -0
- package/dist/client/ai-employees/chatbox/conversations/index.d.ts +9 -0
- package/dist/client/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +5 -3
- package/dist/client/ai-employees/chatbox/hooks/useWorkflowTasks.d.ts +27 -0
- package/dist/client/ai-employees/chatbox/markdown/ECharts.d.ts +1 -2
- package/dist/client/ai-employees/chatbox/markdown/Markdown.d.ts +1 -1
- package/dist/client/ai-employees/chatbox/roles.d.ts +1 -0
- package/dist/client/ai-employees/chatbox/stores/chat-box.d.ts +8 -0
- package/dist/client/ai-employees/chatbox/stores/chat-conversations.d.ts +4 -0
- package/dist/client/ai-employees/chatbox/stores/chat-messages.d.ts +8 -0
- package/dist/client/ai-employees/chatbox/stores/workflow-tasks.d.ts +45 -0
- package/dist/client/ai-employees/chatbox/utils.d.ts +17 -7
- package/dist/client/ai-employees/sub-agents/tools/index.d.ts +10 -0
- package/dist/client/ai-employees/sub-agents/ui/SubAgentDispatchCard.d.ts +21 -0
- package/dist/client/ai-employees/types.d.ts +24 -4
- package/dist/{server/ai-employees/built-in/ai-coding/document/example/js-filter → client/ai-employees/workflow-tasks/tools}/index.d.ts +2 -7
- package/dist/client/ai-employees/workflow-tasks/ui/WorkflowTaskOutputCard.d.ts +11 -0
- package/dist/client/components/ListCollapse.d.ts +28 -0
- package/dist/client/index.js +7 -7
- package/dist/client/manager/ai-manager.d.ts +4 -23
- package/dist/client/repositories/AIConfigRepository.d.ts +11 -3
- package/dist/client/workflow/nodes/employee/components/AIEmployeeSelect.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/assigness.d.ts +11 -0
- package/dist/client/workflow/nodes/employee/components/file-inputs.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/message-inputs.d.ts +12 -0
- package/dist/client/workflow/nodes/employee/components/model-options.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/skill-settings.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/structured-output.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/users-select.d.ts +15 -0
- package/dist/client/workflow/nodes/employee/components/web-search-options.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/configuration.d.ts +12 -0
- package/dist/client/workflow/nodes/employee/flow-models/feedback.d.ts +14 -0
- package/dist/client/workflow/nodes/employee/flow-models/task.d.ts +13 -0
- package/dist/client/workflow/nodes/employee/index.d.ts +7 -31
- package/dist/collections/ai-employees.js +2 -1
- package/dist/collections/ai-mcp-clients.d.ts +51 -0
- package/dist/collections/ai-mcp-clients.js +111 -0
- package/dist/externalVersion.js +17 -15
- package/dist/locale/en-US.json +141 -8
- package/dist/locale/zh-CN.json +142 -9
- package/dist/node_modules/fast-glob/out/index.js +8 -8
- package/dist/node_modules/fast-glob/package.json +1 -1
- package/dist/node_modules/flexsearch/dist/flexsearch.bundle.min.js +2 -2
- package/dist/node_modules/flexsearch/package.json +1 -1
- package/dist/node_modules/fs-extra/lib/index.js +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/nodejs_snowflake.js +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/index.js +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/index.cjs +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-conversations.d.ts +70 -0
- package/dist/server/ai-employees/ai-conversations.js +325 -0
- package/dist/server/ai-employees/ai-employee.d.ts +100 -19
- package/dist/server/ai-employees/ai-employee.js +484 -261
- package/dist/server/ai-employees/ai-knowledge-base.d.ts +28 -0
- package/dist/server/ai-employees/ai-knowledge-base.js +167 -0
- package/dist/server/ai-employees/middleware/conversation.d.ts +2 -0
- package/dist/server/ai-employees/middleware/conversation.js +38 -5
- package/dist/server/ai-employees/middleware/index.d.ts +2 -0
- package/dist/server/ai-employees/middleware/index.js +5 -1
- package/dist/server/ai-employees/middleware/skill-tools.d.ts +12 -0
- package/dist/server/ai-employees/middleware/skill-tools.js +88 -0
- package/dist/server/ai-employees/middleware/tools.js +37 -10
- package/dist/server/ai-employees/middleware/workflow-history.d.ts +22 -0
- package/dist/server/ai-employees/middleware/workflow-history.js +173 -0
- package/dist/server/ai-employees/prompts.d.ts +16 -1
- package/dist/server/ai-employees/prompts.js +37 -1
- package/dist/server/ai-employees/sub-agents/dispatcher.d.ts +36 -0
- package/dist/server/ai-employees/sub-agents/dispatcher.js +225 -0
- package/dist/server/ai-employees/sub-agents/index.d.ts +9 -0
- package/dist/server/{migrations/20250923221107-setup-build-in.js → ai-employees/sub-agents/index.js} +9 -13
- package/dist/server/ai-employees/templates/form-assistant.d.ts +2 -2
- package/dist/server/ai-employees/templates/form-assistant.js +2 -2
- package/dist/server/ai-employees/utils.js +2 -2
- package/dist/server/collections/ai-conversations.js +18 -0
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_contacts_en.d.ts → collections/ai-mcp-clients.d.ts} +1 -4
- package/dist/server/{ai-employees/built-in/nocobase-assistant/index.js → collections/ai-mcp-clients.js} +12 -13
- package/dist/server/{ai-employees/built-in/ai-coding/document/basic/flow-resource.d.ts → collections/ai-skills.d.ts} +1 -4
- package/dist/server/{ai-employees/built-in/email-assistant/index.js → collections/ai-skills.js} +46 -23
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_opportunities_en.d.ts → collections/ai-workflow-tasks.d.ts} +1 -4
- package/dist/server/collections/ai-workflow-tasks.js +112 -0
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_accounts_en.d.ts → collections/users-ai-workflow-tasks.d.ts} +1 -4
- package/dist/server/collections/users-ai-workflow-tasks.js +44 -0
- package/dist/server/llm-providers/anthropic.d.ts +1 -0
- package/dist/server/llm-providers/anthropic.js +2 -1
- package/dist/server/llm-providers/dashscope.d.ts +1 -0
- package/dist/server/llm-providers/deepseek.d.ts +1 -0
- package/dist/server/llm-providers/google-genai.d.ts +1 -0
- package/dist/server/llm-providers/google-genai.js +2 -1
- package/dist/server/llm-providers/kimi/provider.d.ts +1 -0
- package/dist/server/llm-providers/openai/responses.d.ts +1 -0
- package/dist/server/llm-providers/openai/responses.js +2 -1
- package/dist/server/llm-providers/provider.d.ts +1 -10
- package/dist/server/llm-providers/provider.js +3 -34
- package/dist/server/manager/ai-coding-manager.d.ts +1 -2
- package/dist/server/manager/ai-coding-manager.js +0 -41
- package/dist/server/manager/ai-context-datasource-manager.js +30 -1
- package/dist/server/manager/built-in-manager.d.ts +2 -4
- package/dist/server/manager/built-in-manager.js +8 -117
- package/dist/server/migrations/20260306000001-migrate-skill-settings-tools.js +68 -0
- package/dist/server/migrations/20260319000000-add-ai-conversations-from.d.ts +14 -0
- package/dist/server/migrations/20260319000000-add-ai-conversations-from.js +63 -0
- package/dist/server/plugin.d.ts +6 -1
- package/dist/server/plugin.js +31 -8
- package/dist/server/resource/aiConversations.js +112 -188
- package/dist/server/resource/aiEmployees.js +5 -7
- package/dist/server/resource/aiMcpClients.d.ts +11 -0
- package/dist/server/resource/aiMcpClients.js +78 -0
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/index.d.ts → resource/aiSkills.d.ts} +3 -7
- package/dist/server/resource/aiSkills.js +71 -0
- package/dist/server/resource/aiTools.js +4 -6
- package/dist/server/resource/aiWorkflowTasks.d.ts +12 -0
- package/dist/server/resource/aiWorkflowTasks.js +290 -0
- package/dist/server/tools/docs.js +4 -3
- package/dist/server/tools/workflow-caller.js +1 -0
- package/dist/server/types/ai-chat-conversation.type.d.ts +8 -2
- package/dist/server/types/ai-message.type.d.ts +7 -0
- package/dist/server/utils.d.ts +3 -0
- package/dist/server/utils.js +28 -3
- package/dist/server/workflow/nodes/employee/files.d.ts +16 -0
- package/dist/server/workflow/nodes/employee/files.js +125 -0
- package/dist/server/workflow/nodes/employee/handler.d.ts +11 -0
- package/dist/server/workflow/nodes/employee/handler.js +107 -0
- package/dist/server/workflow/nodes/employee/index.d.ts +17 -0
- package/dist/server/workflow/nodes/employee/index.js +404 -0
- package/dist/server/workflow/nodes/employee/tools.d.ts +12 -0
- package/dist/server/workflow/nodes/employee/tools.js +133 -0
- package/dist/server/workflow/nodes/employee/types.d.ts +35 -0
- package/dist/server/workflow/nodes/employee/types.js +24 -0
- package/dist/server/workflow/utils.d.ts +14 -0
- package/dist/server/workflow/utils.js +111 -0
- package/package.json +4 -2
- package/dist/client/107.64d9efa24d6b9143.js +0 -10
- package/dist/client/124.768c8aa5d6e6b461.js +0 -10
- package/dist/client/159.d52107c7a34ce2da.js +0 -10
- package/dist/client/192.0419770b69678994.js +0 -10
- package/dist/client/204.91be8cfc54d91a59.js +0 -10
- package/dist/client/238.9f784a7cdb751999.js +0 -10
- package/dist/client/263.6e1dfb1cbb1964f5.js +0 -10
- package/dist/client/35.5ee7503d9c09daa8.js +0 -10
- package/dist/client/47.6bd245f2140efd24.js +0 -10
- package/dist/client/481.03b3d2306d409933.js +0 -10
- package/dist/client/586.6a1510cabaa84f23.js +0 -10
- package/dist/client/650.8871a07b31c307ea.js +0 -10
- package/dist/client/755.e295bbd2b2a1cc21.js +0 -10
- package/dist/client/772.d51f683c55e18dd4.js +0 -10
- package/dist/client/870.84187dcb8c89b4dc.js +0 -10
- package/dist/client/933.baab3aa75f30e020.js +0 -10
- package/dist/client/987.3aee964e7f406939.js +0 -10
- package/dist/server/ai-employees/built-in/ai-coding/document/basic/flow-resource.js +0 -256
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/index.js +0 -48
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_accounts_en.js +0 -452
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_contacts_en.js +0 -363
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_opportunities_en.js +0 -270
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_quotations_en.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_quotations_en.js +0 -219
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_tickets_en.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_tickets_en.js +0 -409
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/accounts_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/accounts_filter_ant_style.js +0 -324
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/contacts_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/contacts_filter_ant_style.js +0 -309
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/index.js +0 -50
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/leads_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/leads_filter_ant_style.js +0 -345
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/opportunities_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/opportunities_filter_ant_style.js +0 -381
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/product_categories_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/product_categories_ant_style.js +0 -545
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/tickets_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/tickets_filter_ant_style.js +0 -346
- package/dist/server/ai-employees/built-in/ai-coding/document/js-action.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-action.js +0 -102
- package/dist/server/ai-employees/built-in/ai-coding/document/js-block.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-block.js +0 -314
- package/dist/server/ai-employees/built-in/ai-coding/document/js-column.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-column.js +0 -113
- package/dist/server/ai-employees/built-in/ai-coding/document/js-field.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-field.js +0 -498
- package/dist/server/ai-employees/built-in/ai-coding/document/js-item.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-item.js +0 -184
- package/dist/server/ai-employees/built-in/ai-coding/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/ai-coding/index.js +0 -99
- package/dist/server/ai-employees/built-in/ai-coding/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/ai-coding/profile.js +0 -60
- package/dist/server/ai-employees/built-in/ai-coding/prompt_en.md +0 -110
- package/dist/server/ai-employees/built-in/data-modeling/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/data-modeling/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/data-modeling/profile.js +0 -60
- package/dist/server/ai-employees/built-in/data-modeling/prompt.js +0 -283
- package/dist/server/ai-employees/built-in/data-organizer/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/data-organizer/index.js +0 -63
- package/dist/server/ai-employees/built-in/data-organizer/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/data-organizer/profile.js +0 -60
- package/dist/server/ai-employees/built-in/data-visualization/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/data-visualization/index.js +0 -58
- package/dist/server/ai-employees/built-in/data-visualization/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/data-visualization/profile.js +0 -60
- package/dist/server/ai-employees/built-in/email-assistant/index.d.ts +0 -34
- package/dist/server/ai-employees/built-in/email-assistant/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/email-assistant/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/insights-analyst/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/insights-analyst/index.js +0 -63
- package/dist/server/ai-employees/built-in/insights-analyst/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/insights-analyst/profile.js +0 -60
- package/dist/server/ai-employees/built-in/insights-analyst/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/nocobase-assistant/index.d.ts +0 -34
- package/dist/server/ai-employees/built-in/nocobase-assistant/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/nocobase-assistant/profile.js +0 -60
- package/dist/server/ai-employees/built-in/nocobase-assistant/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/nocobase-assistant/prompt.js +0 -52
- package/dist/server/ai-employees/built-in/research-analyst/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/research-analyst/index.js +0 -63
- package/dist/server/ai-employees/built-in/research-analyst/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/research-analyst/profile.js +0 -60
- package/dist/server/ai-employees/built-in/research-analyst/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/translator/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/translator/index.js +0 -67
- package/dist/server/ai-employees/built-in/translator/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/translator/prompt.d.ts +0 -12
- /package/dist/client/ai-employees/chatbox/{Conversations.d.ts → conversations/Conversations.d.ts} +0 -0
- /package/dist/server/migrations/{20250923221107-setup-build-in.d.ts → 20260306000001-migrate-skill-settings-tools.d.ts} +0 -0
|
@@ -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-04-
|
|
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-04-24T15:28:05.948Z"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { Model, Transaction } from '@nocobase/database';
|
|
10
|
+
import PluginAIServer from '../plugin';
|
|
11
|
+
import { AIMessage, SubAgentConversationMetadata, UserDecision } from '../types';
|
|
12
|
+
export type AIConversationsOptions = {
|
|
13
|
+
systemMessage?: unknown;
|
|
14
|
+
skillSettings?: unknown;
|
|
15
|
+
conversationSettings?: unknown;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
export type AIConversationFilterParams = {
|
|
19
|
+
filter: {
|
|
20
|
+
userId: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type CreateAIConversationParams = {
|
|
24
|
+
userId?: string;
|
|
25
|
+
aiEmployee: {
|
|
26
|
+
username: string;
|
|
27
|
+
};
|
|
28
|
+
title?: string;
|
|
29
|
+
options?: AIConversationsOptions;
|
|
30
|
+
from?: 'main-agent' | 'sub-agent';
|
|
31
|
+
transaction?: Transaction;
|
|
32
|
+
category?: 'chat' | 'task';
|
|
33
|
+
};
|
|
34
|
+
export type UpdateAIConversationParams = {
|
|
35
|
+
userId: string;
|
|
36
|
+
sessionId: string;
|
|
37
|
+
title?: string;
|
|
38
|
+
options?: AIConversationsOptions;
|
|
39
|
+
};
|
|
40
|
+
export type GetAIConversationMessagesParams = {
|
|
41
|
+
userId: string;
|
|
42
|
+
sessionId: string;
|
|
43
|
+
cursor?: string;
|
|
44
|
+
paginate?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type ParsedMessageRow = AIMessage & Model;
|
|
47
|
+
export type GetAIConversationMessagesResult = {
|
|
48
|
+
rows: any[];
|
|
49
|
+
hasMore?: boolean;
|
|
50
|
+
cursor?: string | null;
|
|
51
|
+
};
|
|
52
|
+
export declare class AIConversationsManager {
|
|
53
|
+
protected plugin: PluginAIServer;
|
|
54
|
+
constructor(plugin: PluginAIServer);
|
|
55
|
+
create({ userId, aiEmployee, title, options, from, transaction, category, }: CreateAIConversationParams): Promise<any>;
|
|
56
|
+
update({ userId, sessionId, title, options: inputOptions }: UpdateAIConversationParams): Promise<any>;
|
|
57
|
+
getConversation({ sessionId, userId }: {
|
|
58
|
+
sessionId: string;
|
|
59
|
+
userId?: string;
|
|
60
|
+
}): Promise<any>;
|
|
61
|
+
getMessages({ userId, sessionId, cursor, paginate, }: GetAIConversationMessagesParams): Promise<GetAIConversationMessagesResult>;
|
|
62
|
+
getUserDecisions(messageId: string): Promise<{
|
|
63
|
+
interruptId?: string;
|
|
64
|
+
decisions: UserDecision[];
|
|
65
|
+
} | undefined>;
|
|
66
|
+
resolveSubAgentConversation(sessionId: string, toolCallId: string): Promise<SubAgentConversationMetadata>;
|
|
67
|
+
private get aiConversationsRepo();
|
|
68
|
+
private get aiMessagesRepo();
|
|
69
|
+
private get aiToolMessagesRepo();
|
|
70
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
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 ai_conversations_exports = {};
|
|
28
|
+
__export(ai_conversations_exports, {
|
|
29
|
+
AIConversationsManager: () => AIConversationsManager
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(ai_conversations_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var import_utils = require("../utils");
|
|
34
|
+
class AIConversationsManager {
|
|
35
|
+
constructor(plugin) {
|
|
36
|
+
this.plugin = plugin;
|
|
37
|
+
}
|
|
38
|
+
async create({
|
|
39
|
+
userId,
|
|
40
|
+
aiEmployee,
|
|
41
|
+
title,
|
|
42
|
+
options = {},
|
|
43
|
+
from = "main-agent",
|
|
44
|
+
transaction,
|
|
45
|
+
category = "chat"
|
|
46
|
+
}) {
|
|
47
|
+
return await this.aiConversationsRepo.create({
|
|
48
|
+
values: {
|
|
49
|
+
userId,
|
|
50
|
+
title,
|
|
51
|
+
aiEmployee,
|
|
52
|
+
options,
|
|
53
|
+
thread: 1,
|
|
54
|
+
from,
|
|
55
|
+
category
|
|
56
|
+
},
|
|
57
|
+
transaction
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async update({ userId, sessionId, title, options: inputOptions }) {
|
|
61
|
+
const conversation = await this.getConversation({
|
|
62
|
+
sessionId,
|
|
63
|
+
userId
|
|
64
|
+
});
|
|
65
|
+
if (!conversation) {
|
|
66
|
+
throw new Error("invalid sessionId");
|
|
67
|
+
}
|
|
68
|
+
const { systemMessage, skillSettings, conversationSettings } = inputOptions ?? {};
|
|
69
|
+
const options = conversation.options ?? {};
|
|
70
|
+
if (systemMessage) {
|
|
71
|
+
options["systemMessage"] = systemMessage;
|
|
72
|
+
}
|
|
73
|
+
if (skillSettings) {
|
|
74
|
+
options["skillSettings"] = skillSettings;
|
|
75
|
+
}
|
|
76
|
+
if (conversationSettings) {
|
|
77
|
+
options["conversationSettings"] = conversationSettings;
|
|
78
|
+
}
|
|
79
|
+
const values = { options };
|
|
80
|
+
if (title) {
|
|
81
|
+
values.title = title;
|
|
82
|
+
}
|
|
83
|
+
return await this.aiConversationsRepo.update({
|
|
84
|
+
filter: {
|
|
85
|
+
userId,
|
|
86
|
+
sessionId
|
|
87
|
+
},
|
|
88
|
+
values
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async getConversation({ sessionId, userId }) {
|
|
92
|
+
const conversation = await this.aiConversationsRepo.findOne({
|
|
93
|
+
filter: {
|
|
94
|
+
sessionId
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
if (!userId) {
|
|
98
|
+
return conversation;
|
|
99
|
+
}
|
|
100
|
+
if (!conversation) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
let ownershipCheck = await this.aiConversationsRepo.count({
|
|
104
|
+
filter: {
|
|
105
|
+
sessionId,
|
|
106
|
+
userId
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
if (ownershipCheck === 0) {
|
|
110
|
+
ownershipCheck = await this.plugin.db.getRepository("aiWorkflowTasks").count({
|
|
111
|
+
filter: {
|
|
112
|
+
sessionId,
|
|
113
|
+
"users.id": userId
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (ownershipCheck) {
|
|
118
|
+
return conversation;
|
|
119
|
+
} else {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async getMessages({
|
|
124
|
+
userId,
|
|
125
|
+
sessionId,
|
|
126
|
+
cursor,
|
|
127
|
+
paginate = true
|
|
128
|
+
}) {
|
|
129
|
+
const conversation = await this.getConversation({
|
|
130
|
+
sessionId,
|
|
131
|
+
userId
|
|
132
|
+
});
|
|
133
|
+
if (!conversation) {
|
|
134
|
+
throw new Error("invalid sessionId");
|
|
135
|
+
}
|
|
136
|
+
const pageSize = 10;
|
|
137
|
+
const maxLimit = 200;
|
|
138
|
+
const messageRepository = this.plugin.db.getRepository("aiConversations.messages", sessionId);
|
|
139
|
+
const filter = {
|
|
140
|
+
role: {
|
|
141
|
+
$notIn: ["tool"]
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
if (paginate && cursor) {
|
|
145
|
+
filter["messageId"] = {
|
|
146
|
+
$lt: cursor
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const rows = await messageRepository.find({
|
|
150
|
+
sort: ["-messageId"],
|
|
151
|
+
limit: paginate ? pageSize + 1 : maxLimit,
|
|
152
|
+
filter
|
|
153
|
+
});
|
|
154
|
+
const hasMore = paginate && rows.length > pageSize;
|
|
155
|
+
const data = hasMore ? rows.slice(0, -1) : rows;
|
|
156
|
+
const newCursor = data.length ? data[data.length - 1].messageId : null;
|
|
157
|
+
const subAgentConversations = data.filter((row) => {
|
|
158
|
+
var _a, _b;
|
|
159
|
+
return ((_b = (_a = row.metadata) == null ? void 0 : _a.subAgentConversations) == null ? void 0 : _b.length) ?? 0 > 0;
|
|
160
|
+
}).flatMap((row) => row.metadata.subAgentConversations);
|
|
161
|
+
const subAgentConversationSessionIds = [...new Set(subAgentConversations.map((item) => item.sessionId))];
|
|
162
|
+
const subAgentConversationMessages = subAgentConversationSessionIds.length ? await this.aiMessagesRepo.find({
|
|
163
|
+
sort: ["messageId"],
|
|
164
|
+
filter: {
|
|
165
|
+
sessionId: {
|
|
166
|
+
$in: subAgentConversationSessionIds
|
|
167
|
+
},
|
|
168
|
+
role: {
|
|
169
|
+
$notIn: ["tool"]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}) : [];
|
|
173
|
+
const subAgentConversationMessageMap = /* @__PURE__ */ new Map();
|
|
174
|
+
const toolCallIds = [
|
|
175
|
+
...data.filter((row) => {
|
|
176
|
+
var _a;
|
|
177
|
+
return ((_a = row == null ? void 0 : row.toolCalls) == null ? void 0 : _a.length) ?? 0 > 0;
|
|
178
|
+
}).flatMap((row) => row.toolCalls).map((toolCall) => toolCall.id),
|
|
179
|
+
...subAgentConversationMessages.filter((row) => {
|
|
180
|
+
var _a;
|
|
181
|
+
return ((_a = row == null ? void 0 : row.toolCalls) == null ? void 0 : _a.length) ?? 0 > 0;
|
|
182
|
+
}).flatMap((row) => row.toolCalls).map((toolCall) => toolCall.id)
|
|
183
|
+
];
|
|
184
|
+
const toolMessages = await this.aiToolMessagesRepo.find({
|
|
185
|
+
filter: {
|
|
186
|
+
toolCallId: {
|
|
187
|
+
$in: toolCallIds
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
const toolMessageKey = (messageId, toolCallId) => `${messageId}:${toolCallId}`;
|
|
192
|
+
const toolMessageMap = new Map(
|
|
193
|
+
toolMessages.map((toolMessage) => [
|
|
194
|
+
toolMessageKey(toolMessage.messageId, toolMessage.toolCallId),
|
|
195
|
+
toolMessage
|
|
196
|
+
])
|
|
197
|
+
);
|
|
198
|
+
const toolsList = await this.plugin.aiManager.toolManager.listTools();
|
|
199
|
+
const toolsMap = new Map(
|
|
200
|
+
toolsList.map((group) => group.tools).flat().map((tool) => [tool.name, tool])
|
|
201
|
+
);
|
|
202
|
+
const parseMessageRow = (row) => {
|
|
203
|
+
var _a, _b;
|
|
204
|
+
if (((_a = row == null ? void 0 : row.toolCalls) == null ? void 0 : _a.length) ?? 0 > 0) {
|
|
205
|
+
for (const toolCall of row.toolCalls) {
|
|
206
|
+
const tool = toolsMap.get(toolCall.name);
|
|
207
|
+
const toolMessage = toolMessageMap.get(toolMessageKey(row.messageId, toolCall.id));
|
|
208
|
+
toolCall.invokeStatus = toolMessage == null ? void 0 : toolMessage.invokeStatus;
|
|
209
|
+
toolCall.invokeStartTime = toolMessage == null ? void 0 : toolMessage.invokeStartTime;
|
|
210
|
+
toolCall.invokeEndTime = toolMessage == null ? void 0 : toolMessage.invokeEndTime;
|
|
211
|
+
toolCall.auto = toolMessage == null ? void 0 : toolMessage.auto;
|
|
212
|
+
toolCall.status = toolMessage == null ? void 0 : toolMessage.status;
|
|
213
|
+
toolCall.content = toolMessage == null ? void 0 : toolMessage.content;
|
|
214
|
+
toolCall.execution = tool == null ? void 0 : tool.execution;
|
|
215
|
+
toolCall.willInterrupt = (tool == null ? void 0 : tool.execution) === "frontend" || (toolMessage == null ? void 0 : toolMessage.auto) === false;
|
|
216
|
+
toolCall.defaultPermission = tool == null ? void 0 : tool.defaultPermission;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const providerOptions = this.plugin.aiManager.llmProviders.get((_b = row.metadata) == null ? void 0 : _b.provider);
|
|
220
|
+
if (!providerOptions) {
|
|
221
|
+
return (0, import_utils.parseResponseMessage)(row);
|
|
222
|
+
}
|
|
223
|
+
const Provider = providerOptions.provider;
|
|
224
|
+
const provider = new Provider({
|
|
225
|
+
app: this.plugin.app
|
|
226
|
+
});
|
|
227
|
+
return provider.parseResponseMessage(row);
|
|
228
|
+
};
|
|
229
|
+
for (const row of subAgentConversationMessages) {
|
|
230
|
+
const sessionMessages = subAgentConversationMessageMap.get(row.sessionId) ?? [];
|
|
231
|
+
sessionMessages.push(parseMessageRow(row));
|
|
232
|
+
sessionMessages.forEach((it) => it.content.from = "sub-agent");
|
|
233
|
+
subAgentConversationMessageMap.set(row.sessionId, sessionMessages);
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
rows: data.map((row) => {
|
|
237
|
+
var _a;
|
|
238
|
+
const parsedRow = parseMessageRow(row);
|
|
239
|
+
const subAgentConversationItems = ((_a = row.metadata) == null ? void 0 : _a.subAgentConversations) ?? [];
|
|
240
|
+
if (subAgentConversationItems.length) {
|
|
241
|
+
parsedRow.content.subAgentConversations = subAgentConversationItems.map((item) => ({
|
|
242
|
+
sessionId: item.sessionId,
|
|
243
|
+
toolCallId: item.toolCallId,
|
|
244
|
+
status: item.status,
|
|
245
|
+
messages: subAgentConversationMessageMap.get(item.sessionId) ?? []
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
parsedRow.content.from = "main-agent";
|
|
249
|
+
return parsedRow;
|
|
250
|
+
}),
|
|
251
|
+
...paginate && {
|
|
252
|
+
hasMore,
|
|
253
|
+
cursor: newCursor
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
async getUserDecisions(messageId) {
|
|
258
|
+
var _a;
|
|
259
|
+
const allInterruptedToolCall = await this.aiToolMessagesRepo.find({
|
|
260
|
+
filter: {
|
|
261
|
+
messageId,
|
|
262
|
+
interruptActionOrder: { [import_database.Op.not]: null }
|
|
263
|
+
},
|
|
264
|
+
order: [["interruptActionOrder", "ASC"]]
|
|
265
|
+
});
|
|
266
|
+
if (!allInterruptedToolCall.every((t) => t.invokeStatus === "waiting")) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const message = await this.aiMessagesRepo.findOne({
|
|
270
|
+
filter: {
|
|
271
|
+
messageId
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
const interruptId = (_a = message == null ? void 0 : message.get("metadata")) == null ? void 0 : _a.interruptId;
|
|
275
|
+
return {
|
|
276
|
+
interruptId,
|
|
277
|
+
decisions: allInterruptedToolCall.map((item) => item.userDecision)
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
async resolveSubAgentConversation(sessionId, toolCallId) {
|
|
281
|
+
var _a, _b;
|
|
282
|
+
if (!sessionId || !toolCallId) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
const toolMessage = await this.aiToolMessagesRepo.findOne({
|
|
286
|
+
filter: {
|
|
287
|
+
sessionId,
|
|
288
|
+
toolCallId
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
if (!toolMessage) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
const aiMessage = await this.aiMessagesRepo.findOne({
|
|
295
|
+
filter: {
|
|
296
|
+
sessionId,
|
|
297
|
+
messageId: toolMessage.messageId
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
if (!aiMessage) {
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
if (!((_b = (_a = aiMessage.metadata) == null ? void 0 : _a.subAgentConversations) == null ? void 0 : _b.length)) {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
const subAgentConversation = aiMessage.metadata.subAgentConversations.find((it) => it.toolCallId == toolCallId);
|
|
307
|
+
if (!subAgentConversation) {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
return subAgentConversation;
|
|
311
|
+
}
|
|
312
|
+
get aiConversationsRepo() {
|
|
313
|
+
return this.plugin.db.getRepository("aiConversations");
|
|
314
|
+
}
|
|
315
|
+
get aiMessagesRepo() {
|
|
316
|
+
return this.plugin.db.getRepository("aiMessages");
|
|
317
|
+
}
|
|
318
|
+
get aiToolMessagesRepo() {
|
|
319
|
+
return this.plugin.db.getRepository("aiToolMessages");
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
323
|
+
0 && (module.exports = {
|
|
324
|
+
AIConversationsManager
|
|
325
|
+
});
|
|
@@ -7,43 +7,73 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { Model, Transaction } from '@nocobase/database';
|
|
10
|
-
import { Context } from '@nocobase/actions';
|
|
11
10
|
import { LLMProvider } from '../llm-providers/provider';
|
|
12
|
-
import { AIChatContext, AIChatConversation, AIMessageInput, UserDecision } from '../types';
|
|
13
|
-
import { DocumentSegmentedWithScore } from '../features';
|
|
14
|
-
import { KnowledgeBaseGroup } from '../types';
|
|
11
|
+
import { AIChatContext, AIChatConversation, AIMessageInput, AIToolCall, UserDecision } from '../types';
|
|
15
12
|
import { ToolsEntry } from '@nocobase/ai';
|
|
16
13
|
import { AIToolMessage } from '../types/ai-message.type';
|
|
14
|
+
import { Context } from '@nocobase/actions';
|
|
17
15
|
export interface ModelRef {
|
|
18
16
|
llmService: string;
|
|
19
17
|
model: string;
|
|
20
18
|
}
|
|
19
|
+
export interface AIEmployeeOptions {
|
|
20
|
+
ctx: Context;
|
|
21
|
+
employee: Model;
|
|
22
|
+
sessionId: string;
|
|
23
|
+
systemMessage?: string;
|
|
24
|
+
skillSettings?: Record<string, any>;
|
|
25
|
+
webSearch?: boolean;
|
|
26
|
+
model?: ModelRef;
|
|
27
|
+
legacy?: boolean;
|
|
28
|
+
from?: 'main-agent' | 'sub-agent';
|
|
29
|
+
tools?: {
|
|
30
|
+
name: string;
|
|
31
|
+
}[];
|
|
32
|
+
}
|
|
21
33
|
export declare class AIEmployee {
|
|
34
|
+
sessionId: string;
|
|
35
|
+
from: string;
|
|
22
36
|
employee: Model;
|
|
23
37
|
aiChatConversation: AIChatConversation;
|
|
24
38
|
skillSettings?: Record<string, any>;
|
|
25
39
|
private plugin;
|
|
26
40
|
private db;
|
|
27
|
-
private sessionId;
|
|
28
41
|
private ctx;
|
|
29
42
|
private systemMessage;
|
|
43
|
+
private protocol;
|
|
30
44
|
private webSearch?;
|
|
31
45
|
private model?;
|
|
32
46
|
private legacy?;
|
|
33
|
-
private
|
|
34
|
-
|
|
47
|
+
private tools;
|
|
48
|
+
private inWorkflow?;
|
|
49
|
+
constructor({ ctx, employee, sessionId, systemMessage, skillSettings, webSearch, model, legacy, from, tools, }: AIEmployeeOptions);
|
|
50
|
+
getFormatMessages(userMessages: AIMessageInput[]): Promise<{
|
|
51
|
+
role: "user" | "assistant" | "tool" | "system";
|
|
52
|
+
content: any;
|
|
53
|
+
tool_call_id?: string;
|
|
54
|
+
tool_calls?: AIToolCall[];
|
|
55
|
+
}[]>;
|
|
56
|
+
isInWorkflow(): Promise<boolean>;
|
|
35
57
|
private buildState;
|
|
36
58
|
private initSession;
|
|
37
59
|
private buildChatContext;
|
|
38
60
|
stream({ messageId, userMessages, userDecisions, }: {
|
|
39
61
|
messageId?: string;
|
|
40
62
|
userMessages?: AIMessageInput[];
|
|
41
|
-
userDecisions?:
|
|
63
|
+
userDecisions?: {
|
|
64
|
+
interruptId?: string;
|
|
65
|
+
decisions: UserDecision[];
|
|
66
|
+
};
|
|
42
67
|
}): Promise<boolean>;
|
|
43
|
-
invoke({ messageId, userMessages, userDecisions, }: {
|
|
68
|
+
invoke({ messageId, userMessages, userDecisions, writer, context, }: {
|
|
44
69
|
messageId?: string;
|
|
45
70
|
userMessages?: AIMessageInput[];
|
|
46
|
-
userDecisions?:
|
|
71
|
+
userDecisions?: {
|
|
72
|
+
interruptId?: string;
|
|
73
|
+
decisions: UserDecision[];
|
|
74
|
+
};
|
|
75
|
+
writer?: (chunk: any) => void;
|
|
76
|
+
context?: any;
|
|
47
77
|
}): Promise<any>;
|
|
48
78
|
createAgent({ provider, systemPrompt, tools, middleware, }: {
|
|
49
79
|
provider: LLMProvider;
|
|
@@ -74,21 +104,15 @@ export declare class AIEmployee {
|
|
|
74
104
|
allowEmpty?: boolean;
|
|
75
105
|
responseMetadata: Map<string, any>;
|
|
76
106
|
}): Promise<void>;
|
|
107
|
+
private handleInterruptedToolCalls;
|
|
77
108
|
getEmployeeDataSourceContext(): string;
|
|
78
109
|
getSystemPrompt(userMessages: AIMessageInput[]): Promise<string>;
|
|
79
|
-
retrieveKnowledgeBase(userMessage: AIMessageInput): Promise<DocumentSegmentedWithScore[]>;
|
|
80
|
-
isEnabledKnowledgeBase(): boolean;
|
|
81
|
-
getAIEmployeeKnowledgeBaseConfig(): {
|
|
82
|
-
topK: number;
|
|
83
|
-
score: string;
|
|
84
|
-
};
|
|
85
|
-
getKnowledgeBaseGroup(): Promise<KnowledgeBaseGroup[]>;
|
|
86
110
|
initToolCall(transaction: Transaction, messageId: string, toolCalls: {
|
|
87
111
|
id: string;
|
|
88
112
|
name: string;
|
|
89
113
|
args: any;
|
|
90
114
|
}[]): Promise<Model<AIToolMessage>[]>;
|
|
91
|
-
updateToolCallInterrupted(messageId: string, toolCallId: string, interruptAction: {
|
|
115
|
+
updateToolCallInterrupted(sessionId: string, messageId: string, toolCallId: string, interruptId: string, interruptAction: {
|
|
92
116
|
order: number;
|
|
93
117
|
description?: string;
|
|
94
118
|
allowed_decisions?: string[];
|
|
@@ -98,7 +122,6 @@ export declare class AIEmployee {
|
|
|
98
122
|
confirmToolCall(transaction: Transaction, messageId: string, toolCallIds: string[]): Promise<number>;
|
|
99
123
|
getToolCallResult(messageId: string, toolCallId: string): Promise<AIToolMessage>;
|
|
100
124
|
getToolCallResultMap(messageId: string, toolCallIds: string[]): Promise<Map<string, AIToolMessage>>;
|
|
101
|
-
getUserDecisions(messageId: string): Promise<UserDecision[]>;
|
|
102
125
|
cancelToolCall(): Promise<any>;
|
|
103
126
|
get logger(): any;
|
|
104
127
|
sendErrorResponse(errorMessage: string): void;
|
|
@@ -118,11 +141,17 @@ export declare class AIEmployee {
|
|
|
118
141
|
private getToolCallMap;
|
|
119
142
|
private toInterruptActions;
|
|
120
143
|
private getAIEmployeeTools;
|
|
144
|
+
private getAvailableSkills;
|
|
145
|
+
private getAgentTools;
|
|
146
|
+
getLoadedSkillNames(): Promise<string[]>;
|
|
147
|
+
getActivatedSkillToolNames(): Promise<Set<string>>;
|
|
148
|
+
private getAvailableAIEmployees;
|
|
121
149
|
private getMiddleware;
|
|
122
150
|
private getCurrentThread;
|
|
123
151
|
private forkCurrentThread;
|
|
124
152
|
getToolsMap(): Promise<Map<string, import("@nocobase/ai").ToolsOptions>>;
|
|
125
153
|
private listTools;
|
|
154
|
+
private withRunMetadata;
|
|
126
155
|
private get toolsManager();
|
|
127
156
|
private get aiConversationsRepo();
|
|
128
157
|
private get aiMessagesRepo();
|
|
@@ -131,3 +160,55 @@ export declare class AIEmployee {
|
|
|
131
160
|
private get aiToolMessagesModel();
|
|
132
161
|
private get aiFilesModel();
|
|
133
162
|
}
|
|
163
|
+
export declare class ChatStreamProtocol {
|
|
164
|
+
private readonly streamConsumer;
|
|
165
|
+
private _statistics;
|
|
166
|
+
constructor(streamConsumer: StreamConsumer);
|
|
167
|
+
static fromContext(ctx: Context): ChatStreamProtocol;
|
|
168
|
+
with(conversation: {
|
|
169
|
+
sessionId: string;
|
|
170
|
+
from: string;
|
|
171
|
+
username: string;
|
|
172
|
+
}): {
|
|
173
|
+
startStream: () => void;
|
|
174
|
+
endStream: () => void;
|
|
175
|
+
subAgentCompleted: () => void;
|
|
176
|
+
newMessage: (content?: unknown) => void;
|
|
177
|
+
content: (content: string) => void;
|
|
178
|
+
webSearch: (content: {
|
|
179
|
+
type: string;
|
|
180
|
+
query: string;
|
|
181
|
+
}[]) => void;
|
|
182
|
+
reasoning: (content: {
|
|
183
|
+
status: string;
|
|
184
|
+
content: string;
|
|
185
|
+
}) => void;
|
|
186
|
+
stopReasoning: () => void;
|
|
187
|
+
toolCallChunks: (content: unknown) => void;
|
|
188
|
+
toolCalls: (content: unknown) => void;
|
|
189
|
+
toolCallStatus: ({ toolCall, invokeStatus, status, invokeStartTime, invokeEndTime, content, interruptAction, }: {
|
|
190
|
+
toolCall: {
|
|
191
|
+
messageId: string;
|
|
192
|
+
id: string;
|
|
193
|
+
name: string;
|
|
194
|
+
willInterrupt: boolean;
|
|
195
|
+
};
|
|
196
|
+
invokeStatus: string;
|
|
197
|
+
status?: string;
|
|
198
|
+
invokeStartTime?: string | Date | null;
|
|
199
|
+
invokeEndTime?: string | Date | null;
|
|
200
|
+
content?: unknown;
|
|
201
|
+
interruptAction?: {
|
|
202
|
+
order: number;
|
|
203
|
+
description: string;
|
|
204
|
+
allowedDecisions: string[];
|
|
205
|
+
};
|
|
206
|
+
}) => void;
|
|
207
|
+
};
|
|
208
|
+
get statistics(): {
|
|
209
|
+
sent: number;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
export type StreamConsumer = {
|
|
213
|
+
write: (chunk: any) => void;
|
|
214
|
+
};
|