@nocobase/app-plugin-agents 0.1.0-beta.9 → 1.0.0-beta.15
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/CHANGELOG.md +293 -0
- package/README.md +94 -51
- package/dist/client/api/client.d.ts +25 -19
- package/dist/client/api/client.d.ts.map +1 -1
- package/dist/client/api/client.js +23 -24
- package/dist/client/api/client.js.map +1 -1
- package/dist/client/api/keys.d.ts +4 -1
- package/dist/client/api/keys.d.ts.map +1 -1
- package/dist/client/api/keys.js +4 -1
- package/dist/client/api/keys.js.map +1 -1
- package/dist/client/api/runners.d.ts +8 -4
- package/dist/client/api/runners.d.ts.map +1 -1
- package/dist/client/api/runners.js +9 -0
- package/dist/client/api/runners.js.map +1 -1
- package/dist/client/chat/ai-form.d.ts +13 -0
- package/dist/client/chat/ai-form.d.ts.map +1 -0
- package/dist/client/chat/ai-form.js +57 -0
- package/dist/client/chat/ai-form.js.map +1 -0
- package/dist/client/chat/api.d.ts +16 -14
- package/dist/client/chat/api.d.ts.map +1 -1
- package/dist/client/chat/api.js +85 -18
- package/dist/client/chat/api.js.map +1 -1
- package/dist/client/chat/client-id.d.ts +3 -0
- package/dist/client/chat/client-id.d.ts.map +1 -0
- package/dist/client/chat/client-id.js +17 -0
- package/dist/client/chat/client-id.js.map +1 -0
- package/dist/client/chat/consultation-identity.d.ts +7 -0
- package/dist/client/chat/consultation-identity.d.ts.map +1 -0
- package/dist/client/chat/consultation-identity.js +39 -0
- package/dist/client/chat/consultation-identity.js.map +1 -0
- package/dist/client/chat/context-model.d.ts +21 -3
- package/dist/client/chat/context-model.d.ts.map +1 -1
- package/dist/client/chat/context-model.js +33 -4
- package/dist/client/chat/context-model.js.map +1 -1
- package/dist/client/chat/controller.d.ts +83 -0
- package/dist/client/chat/controller.d.ts.map +1 -0
- package/dist/client/chat/controller.js +767 -0
- package/dist/client/chat/controller.js.map +1 -0
- package/dist/client/chat/extensions.d.ts +8 -3
- package/dist/client/chat/extensions.d.ts.map +1 -1
- package/dist/client/chat/extensions.js.map +1 -1
- package/dist/client/chat/feedback.d.ts +18 -0
- package/dist/client/chat/feedback.d.ts.map +1 -0
- package/dist/client/chat/feedback.js +38 -0
- package/dist/client/chat/feedback.js.map +1 -0
- package/dist/client/chat/form-registry.d.ts +95 -0
- package/dist/client/chat/form-registry.d.ts.map +1 -0
- package/dist/client/chat/form-registry.js +384 -0
- package/dist/client/chat/form-registry.js.map +1 -0
- package/dist/client/chat/keys.d.ts +1 -0
- package/dist/client/chat/keys.d.ts.map +1 -1
- package/dist/client/chat/keys.js +3 -1
- package/dist/client/chat/keys.js.map +1 -1
- package/dist/client/chat/message-model.d.ts +38 -44
- package/dist/client/chat/message-model.d.ts.map +1 -1
- package/dist/client/chat/message-model.js +138 -56
- package/dist/client/chat/message-model.js.map +1 -1
- package/dist/client/chat/provider.d.ts +12 -2
- package/dist/client/chat/provider.d.ts.map +1 -1
- package/dist/client/chat/provider.js +130 -4
- package/dist/client/chat/provider.js.map +1 -1
- package/dist/client/chat/submissions.d.ts +67 -0
- package/dist/client/chat/submissions.d.ts.map +1 -0
- package/dist/client/chat/submissions.js +241 -0
- package/dist/client/chat/submissions.js.map +1 -0
- package/dist/client/chat/tool-renderer.d.ts +39 -0
- package/dist/client/chat/tool-renderer.d.ts.map +1 -0
- package/dist/client/chat/tool-renderer.js +27 -0
- package/dist/client/chat/tool-renderer.js.map +1 -0
- package/dist/client/chat/use-chat-scroll.d.ts +4 -0
- package/dist/client/chat/use-chat-scroll.d.ts.map +1 -0
- package/dist/client/chat/use-chat-scroll.js +73 -0
- package/dist/client/chat/use-chat-scroll.js.map +1 -0
- package/dist/client/chat/use-chat.d.ts +13 -24
- package/dist/client/chat/use-chat.d.ts.map +1 -1
- package/dist/client/chat/use-chat.js +250 -235
- package/dist/client/chat/use-chat.js.map +1 -1
- package/dist/client/chat.d.ts +20 -8
- package/dist/client/chat.d.ts.map +1 -1
- package/dist/client/chat.js +16 -4
- package/dist/client/chat.js.map +1 -1
- package/dist/client/components/agent-picker.d.ts +6 -23
- package/dist/client/components/agent-picker.d.ts.map +1 -1
- package/dist/client/components/agent-picker.js +20 -39
- package/dist/client/components/agent-picker.js.map +1 -1
- package/dist/client/components/quota-status.d.ts +16 -0
- package/dist/client/components/quota-status.d.ts.map +1 -0
- package/dist/client/components/quota-status.js +39 -0
- package/dist/client/components/quota-status.js.map +1 -0
- package/dist/client/components/runners-refresh.d.ts.map +1 -1
- package/dist/client/components/runners-refresh.js +1 -0
- package/dist/client/components/runners-refresh.js.map +1 -1
- package/dist/client/components/variables/variable-dialogs.d.ts.map +1 -1
- package/dist/client/components/variables/variable-dialogs.js +7 -7
- package/dist/client/components/variables/variable-dialogs.js.map +1 -1
- package/dist/client/config.d.ts +2 -0
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js +2 -0
- package/dist/client/config.js.map +1 -1
- package/dist/client/hooks/use-agent-picker-labels.d.ts.map +1 -1
- package/dist/client/hooks/use-agent-picker-labels.js +4 -12
- package/dist/client/hooks/use-agent-picker-labels.js.map +1 -1
- package/dist/client/hooks/use-quota-expiry.d.ts +7 -0
- package/dist/client/hooks/use-quota-expiry.d.ts.map +1 -0
- package/dist/client/hooks/use-quota-expiry.js +92 -0
- package/dist/client/hooks/use-quota-expiry.js.map +1 -0
- package/dist/client/hooks/use-realtime-topic.d.ts +1 -4
- package/dist/client/hooks/use-realtime-topic.d.ts.map +1 -1
- package/dist/client/hooks/use-realtime-topic.js +7 -11
- package/dist/client/hooks/use-realtime-topic.js.map +1 -1
- package/dist/client/kit.d.ts +14 -12
- package/dist/client/kit.d.ts.map +1 -1
- package/dist/client/kit.js +37 -14
- package/dist/client/kit.js.map +1 -1
- package/dist/client/lib/agents.d.ts +5 -18
- package/dist/client/lib/agents.d.ts.map +1 -1
- package/dist/client/lib/agents.js +18 -55
- package/dist/client/lib/agents.js.map +1 -1
- package/dist/client/lib/format.d.ts +3 -1
- package/dist/client/lib/format.d.ts.map +1 -1
- package/dist/client/lib/format.js +25 -0
- package/dist/client/lib/format.js.map +1 -1
- package/dist/client/lib/skill-settings-context.d.ts +9 -0
- package/dist/client/lib/skill-settings-context.d.ts.map +1 -0
- package/dist/client/lib/skill-settings-context.js +4 -0
- package/dist/client/lib/skill-settings-context.js.map +1 -0
- package/dist/client/lib/skill-settings.d.ts +12 -0
- package/dist/client/lib/skill-settings.d.ts.map +1 -0
- package/dist/client/lib/skill-settings.js +37 -0
- package/dist/client/lib/skill-settings.js.map +1 -0
- package/dist/client/locales/chat.en-US.d.ts +8 -27
- package/dist/client/locales/chat.en-US.d.ts.map +1 -1
- package/dist/client/locales/chat.en-US.js +12 -30
- package/dist/client/locales/chat.en-US.js.map +1 -1
- package/dist/client/locales/chat.zh-CN.d.ts.map +1 -1
- package/dist/client/locales/chat.zh-CN.js +9 -27
- package/dist/client/locales/chat.zh-CN.js.map +1 -1
- package/dist/client/locales/en-US.d.ts +87 -217
- package/dist/client/locales/en-US.d.ts.map +1 -1
- package/dist/client/locales/en-US.js +92 -218
- package/dist/client/locales/en-US.js.map +1 -1
- package/dist/client/locales/runWait.en-US.d.ts +7 -0
- package/dist/client/locales/runWait.en-US.d.ts.map +1 -1
- package/dist/client/locales/runWait.en-US.js +10 -3
- package/dist/client/locales/runWait.en-US.js.map +1 -1
- package/dist/client/locales/runWait.zh-CN.d.ts +1 -1
- package/dist/client/locales/runWait.zh-CN.d.ts.map +1 -1
- package/dist/client/locales/runWait.zh-CN.js +11 -4
- package/dist/client/locales/runWait.zh-CN.js.map +1 -1
- package/dist/client/locales/runtimes.en-US.d.ts +83 -0
- package/dist/client/locales/runtimes.en-US.d.ts.map +1 -1
- package/dist/client/locales/runtimes.en-US.js +84 -1
- package/dist/client/locales/runtimes.en-US.js.map +1 -1
- package/dist/client/locales/runtimes.zh-CN.d.ts.map +1 -1
- package/dist/client/locales/runtimes.zh-CN.js +83 -0
- package/dist/client/locales/runtimes.zh-CN.js.map +1 -1
- package/dist/client/locales/skills.en-US.d.ts +7 -0
- package/dist/client/locales/skills.en-US.d.ts.map +1 -1
- package/dist/client/locales/skills.en-US.js +8 -1
- package/dist/client/locales/skills.en-US.js.map +1 -1
- package/dist/client/locales/skills.zh-CN.d.ts.map +1 -1
- package/dist/client/locales/skills.zh-CN.js +8 -1
- package/dist/client/locales/skills.zh-CN.js.map +1 -1
- package/dist/client/locales/zh-CN.d.ts.map +1 -1
- package/dist/client/locales/zh-CN.js +94 -220
- package/dist/client/locales/zh-CN.js.map +1 -1
- package/dist/client/online/services.d.ts.map +1 -1
- package/dist/client/online/services.js +5 -6
- package/dist/client/online/services.js.map +1 -1
- package/dist/client/pages/agents/agent-dialog.d.ts +9 -0
- package/dist/client/pages/agents/agent-dialog.d.ts.map +1 -0
- package/dist/client/pages/agents/agent-dialog.js +106 -0
- package/dist/client/pages/agents/agent-dialog.js.map +1 -0
- package/dist/client/pages/agents/agent-state.d.ts +11 -0
- package/dist/client/pages/agents/agent-state.d.ts.map +1 -0
- package/dist/client/pages/agents/agent-state.js +28 -0
- package/dist/client/pages/agents/agent-state.js.map +1 -0
- package/dist/client/pages/agents/index.d.ts +1 -1
- package/dist/client/pages/agents/index.d.ts.map +1 -1
- package/dist/client/pages/agents/index.js +7 -101
- package/dist/client/pages/agents/index.js.map +1 -1
- package/dist/client/pages/agents/runner-agents.d.ts +3 -0
- package/dist/client/pages/agents/runner-agents.d.ts.map +1 -0
- package/dist/client/pages/agents/runner-agents.js +185 -0
- package/dist/client/pages/agents/runner-agents.js.map +1 -0
- package/dist/client/pages/runtimes/connect.js.map +1 -1
- package/dist/client/pages/runtimes/index.d.ts.map +1 -1
- package/dist/client/pages/runtimes/index.js +1 -1
- package/dist/client/pages/runtimes/index.js.map +1 -1
- package/dist/client/pages/runtimes/quota-targets.d.ts +4 -0
- package/dist/client/pages/runtimes/quota-targets.d.ts.map +1 -0
- package/dist/client/pages/runtimes/quota-targets.js +18 -0
- package/dist/client/pages/runtimes/quota-targets.js.map +1 -0
- package/dist/client/pages/runtimes/quota.d.ts +17 -0
- package/dist/client/pages/runtimes/quota.d.ts.map +1 -0
- package/dist/client/pages/runtimes/quota.js +50 -0
- package/dist/client/pages/runtimes/quota.js.map +1 -0
- package/dist/client/pages/runtimes/runner-cells.d.ts +11 -4
- package/dist/client/pages/runtimes/runner-cells.d.ts.map +1 -1
- package/dist/client/pages/runtimes/runner-cells.js +6 -3
- package/dist/client/pages/runtimes/runner-cells.js.map +1 -1
- package/dist/client/pages/runtimes/runner-overview.d.ts +9 -0
- package/dist/client/pages/runtimes/runner-overview.d.ts.map +1 -0
- package/dist/client/pages/runtimes/runner-overview.js +109 -0
- package/dist/client/pages/runtimes/runner-overview.js.map +1 -0
- package/dist/client/pages/runtimes/runner-runs.d.ts +5 -0
- package/dist/client/pages/runtimes/runner-runs.d.ts.map +1 -0
- package/dist/client/pages/runtimes/runner-runs.js +35 -0
- package/dist/client/pages/runtimes/runner-runs.js.map +1 -0
- package/dist/client/pages/runtimes/runner-sheet.d.ts +2 -3
- package/dist/client/pages/runtimes/runner-sheet.d.ts.map +1 -1
- package/dist/client/pages/runtimes/runner-sheet.js +43 -171
- package/dist/client/pages/runtimes/runner-sheet.js.map +1 -1
- package/dist/client/pages/runtimes/runner-tools.d.ts +17 -0
- package/dist/client/pages/runtimes/runner-tools.d.ts.map +1 -0
- package/dist/client/pages/runtimes/runner-tools.js +75 -0
- package/dist/client/pages/runtimes/runner-tools.js.map +1 -0
- package/dist/client/pages/runtimes/runner-workspaces.d.ts +6 -0
- package/dist/client/pages/runtimes/runner-workspaces.d.ts.map +1 -0
- package/dist/client/pages/runtimes/runner-workspaces.js +37 -0
- package/dist/client/pages/runtimes/runner-workspaces.js.map +1 -0
- package/dist/client/pages/runtimes/tool-slots-fields.js +1 -1
- package/dist/client/pages/runtimes/tool-slots-fields.js.map +1 -1
- package/dist/client/pages/runtimes/workspace-diagnostics.d.ts +6 -4
- package/dist/client/pages/runtimes/workspace-diagnostics.d.ts.map +1 -1
- package/dist/client/pages/runtimes/workspace-diagnostics.js +67 -33
- package/dist/client/pages/runtimes/workspace-diagnostics.js.map +1 -1
- package/dist/client/pages/skills/detail/index.d.ts.map +1 -1
- package/dist/client/pages/skills/detail/index.js +11 -15
- package/dist/client/pages/skills/detail/index.js.map +1 -1
- package/dist/client/pages/skills/index.d.ts.map +1 -1
- package/dist/client/pages/skills/index.js +2 -2
- package/dist/client/pages/skills/index.js.map +1 -1
- package/dist/client/pages/usage/index.js +2 -2
- package/dist/client/pages/usage/index.js.map +1 -1
- package/dist/client/profile/default-agent.d.ts.map +1 -1
- package/dist/client/profile/default-agent.js +2 -4
- package/dist/client/profile/default-agent.js.map +1 -1
- package/dist/client/routes.d.ts +1 -1
- package/dist/client/routes.d.ts.map +1 -1
- package/dist/client/routes.js +1 -13
- package/dist/client/routes.js.map +1 -1
- package/dist/client/runs/format-wait.d.ts.map +1 -1
- package/dist/client/runs/format-wait.js +15 -1
- package/dist/client/runs/format-wait.js.map +1 -1
- package/dist/client/runs/subject-runs.d.ts +5 -0
- package/dist/client/runs/subject-runs.d.ts.map +1 -1
- package/dist/client/runs/subject-runs.js +24 -9
- package/dist/client/runs/subject-runs.js.map +1 -1
- package/dist/client/runs/use-run-events.d.ts +1 -1
- package/dist/client/runs/use-run-events.d.ts.map +1 -1
- package/dist/client/runs/use-run-events.js +5 -2
- package/dist/client/runs/use-run-events.js.map +1 -1
- package/dist/client/runs.d.ts +1 -1
- package/dist/client/runs.d.ts.map +1 -1
- package/dist/client/runs.js +1 -1
- package/dist/client/runs.js.map +1 -1
- package/dist/database/migrations/.manifest.json +38 -2
- package/dist/database/migrations/202610020003_ag_create_runs.d.ts.map +1 -1
- package/dist/database/migrations/202610020003_ag_create_runs.js +0 -1
- package/dist/database/migrations/202610020003_ag_create_runs.js.map +1 -1
- package/dist/database/migrations/202610120002_ag_add_queue_entered_at.d.ts +4 -0
- package/dist/database/migrations/202610120002_ag_add_queue_entered_at.d.ts.map +1 -0
- package/dist/database/migrations/202610120002_ag_add_queue_entered_at.js +50 -0
- package/dist/database/migrations/202610120002_ag_add_queue_entered_at.js.map +1 -0
- package/dist/database/migrations/202610170001_ag_runner_quota.d.ts +4 -0
- package/dist/database/migrations/202610170001_ag_runner_quota.d.ts.map +1 -0
- package/dist/database/migrations/202610170001_ag_runner_quota.js +19 -0
- package/dist/database/migrations/202610170001_ag_runner_quota.js.map +1 -0
- package/dist/database/migrations/202610240020_ag_runner_agents.d.ts +4 -0
- package/dist/database/migrations/202610240020_ag_runner_agents.d.ts.map +1 -0
- package/dist/database/migrations/202610240020_ag_runner_agents.js +115 -0
- package/dist/database/migrations/202610240020_ag_runner_agents.js.map +1 -0
- package/dist/database/migrations/202610240040_ag_discovery_preferences.d.ts +4 -0
- package/dist/database/migrations/202610240040_ag_discovery_preferences.d.ts.map +1 -0
- package/dist/database/migrations/202610240040_ag_discovery_preferences.js +18 -0
- package/dist/database/migrations/202610240040_ag_discovery_preferences.js.map +1 -0
- package/dist/database/migrations/202610250001_ag_comment_runner_consent.d.ts +4 -0
- package/dist/database/migrations/202610250001_ag_comment_runner_consent.d.ts.map +1 -0
- package/dist/database/migrations/202610250001_ag_comment_runner_consent.js +41 -0
- package/dist/database/migrations/202610250001_ag_comment_runner_consent.js.map +1 -0
- package/dist/database/migrations/202610260001_ag_drop_directory_index.d.ts +4 -0
- package/dist/database/migrations/202610260001_ag_drop_directory_index.d.ts.map +1 -0
- package/dist/database/migrations/202610260001_ag_drop_directory_index.js +24 -0
- package/dist/database/migrations/202610260001_ag_drop_directory_index.js.map +1 -0
- package/dist/database/migrations/202610260001_ag_run_revision.d.ts +4 -0
- package/dist/database/migrations/202610260001_ag_run_revision.d.ts.map +1 -0
- package/dist/database/migrations/202610260001_ag_run_revision.js +19 -0
- package/dist/database/migrations/202610260001_ag_run_revision.js.map +1 -0
- package/dist/database/migrations/202610270001_ag_online_agent.d.ts +4 -0
- package/dist/database/migrations/202610270001_ag_online_agent.d.ts.map +1 -0
- package/dist/database/migrations/202610270001_ag_online_agent.js +43 -0
- package/dist/database/migrations/202610270001_ag_online_agent.js.map +1 -0
- package/dist/database/migrations/202610270002_ag_chat_list_visibility.d.ts +4 -0
- package/dist/database/migrations/202610270002_ag_chat_list_visibility.d.ts.map +1 -0
- package/dist/database/migrations/202610270002_ag_chat_list_visibility.js +17 -0
- package/dist/database/migrations/202610270002_ag_chat_list_visibility.js.map +1 -0
- package/dist/package.json +34 -12
- package/dist/server/cli/run-credential.js +1 -1
- package/dist/server/cli/surface.d.ts.map +1 -1
- package/dist/server/cli/surface.js +4 -1
- package/dist/server/cli/surface.js.map +1 -1
- package/dist/server/composition.d.ts +36 -35
- package/dist/server/composition.d.ts.map +1 -1
- package/dist/server/composition.js +99 -66
- package/dist/server/composition.js.map +1 -1
- package/dist/server/core/agents/agent.service.d.ts +51 -43
- package/dist/server/core/agents/agent.service.d.ts.map +1 -1
- package/dist/server/core/agents/agent.service.js +347 -321
- package/dist/server/core/agents/agent.service.js.map +1 -1
- package/dist/server/core/agents/agent.store.d.ts +26 -12
- package/dist/server/core/agents/agent.store.d.ts.map +1 -1
- package/dist/server/core/agents/agent.store.js +74 -66
- package/dist/server/core/agents/agent.store.js.map +1 -1
- package/dist/server/core/agents/agent.views.d.ts +29 -0
- package/dist/server/core/agents/agent.views.d.ts.map +1 -0
- package/dist/server/core/agents/agent.views.js +88 -0
- package/dist/server/core/agents/agent.views.js.map +1 -0
- package/dist/server/core/agents/discovery.d.ts +12 -0
- package/dist/server/core/agents/discovery.d.ts.map +1 -0
- package/dist/server/core/agents/discovery.js +39 -0
- package/dist/server/core/agents/discovery.js.map +1 -0
- package/dist/server/core/agents/index.d.ts +3 -2
- package/dist/server/core/agents/index.d.ts.map +1 -1
- package/dist/server/core/agents/index.js +3 -2
- package/dist/server/core/agents/index.js.map +1 -1
- package/dist/server/core/brief/brief.js +3 -3
- package/dist/server/core/brief/brief.js.map +1 -1
- package/dist/server/core/callers/index.d.ts +10 -1
- package/dist/server/core/callers/index.d.ts.map +1 -1
- package/dist/server/core/callers/index.js +15 -0
- package/dist/server/core/callers/index.js.map +1 -1
- package/dist/server/core/conversations/attachments.d.ts.map +1 -1
- package/dist/server/core/conversations/attachments.js +6 -1
- package/dist/server/core/conversations/attachments.js.map +1 -1
- package/dist/server/core/conversations/availability.d.ts +6 -11
- package/dist/server/core/conversations/availability.d.ts.map +1 -1
- package/dist/server/core/conversations/availability.js +11 -15
- package/dist/server/core/conversations/availability.js.map +1 -1
- package/dist/server/core/conversations/chat-settings.d.ts +2 -2
- package/dist/server/core/conversations/chat-settings.d.ts.map +1 -1
- package/dist/server/core/conversations/chat-settings.js +17 -22
- package/dist/server/core/conversations/chat-settings.js.map +1 -1
- package/dist/server/core/conversations/conversation.service.d.ts +13 -8
- package/dist/server/core/conversations/conversation.service.d.ts.map +1 -1
- package/dist/server/core/conversations/conversation.service.js +397 -383
- package/dist/server/core/conversations/conversation.service.js.map +1 -1
- package/dist/server/core/conversations/conversation.store.d.ts +3 -0
- package/dist/server/core/conversations/conversation.store.d.ts.map +1 -1
- package/dist/server/core/conversations/conversation.store.js +2 -1
- package/dist/server/core/conversations/conversation.store.js.map +1 -1
- package/dist/server/core/conversations/page-context.d.ts +8 -2
- package/dist/server/core/conversations/page-context.d.ts.map +1 -1
- package/dist/server/core/conversations/page-context.js +61 -2
- package/dist/server/core/conversations/page-context.js.map +1 -1
- package/dist/server/core/conversations/ports.d.ts +18 -20
- package/dist/server/core/conversations/ports.d.ts.map +1 -1
- package/dist/server/core/reports/model-usage.d.ts.map +1 -1
- package/dist/server/core/reports/model-usage.js +42 -44
- package/dist/server/core/reports/model-usage.js.map +1 -1
- package/dist/server/core/reports/prices.d.ts.map +1 -1
- package/dist/server/core/reports/prices.js +29 -5
- package/dist/server/core/reports/prices.js.map +1 -1
- package/dist/server/core/reports/report.service.d.ts +4 -2
- package/dist/server/core/reports/report.service.d.ts.map +1 -1
- package/dist/server/core/reports/report.service.js +148 -66
- package/dist/server/core/reports/report.service.js.map +1 -1
- package/dist/server/core/runs/access.d.ts +5 -0
- package/dist/server/core/runs/access.d.ts.map +1 -0
- package/dist/server/core/runs/access.js +10 -0
- package/dist/server/core/runs/access.js.map +1 -0
- package/dist/server/core/runs/availability.d.ts +18 -6
- package/dist/server/core/runs/availability.d.ts.map +1 -1
- package/dist/server/core/runs/availability.js +40 -34
- package/dist/server/core/runs/availability.js.map +1 -1
- package/dist/server/core/runs/claim.d.ts +30 -106
- package/dist/server/core/runs/claim.d.ts.map +1 -1
- package/dist/server/core/runs/claim.js +630 -323
- package/dist/server/core/runs/claim.js.map +1 -1
- package/dist/server/core/runs/comment-consent.d.ts +24 -0
- package/dist/server/core/runs/comment-consent.d.ts.map +1 -0
- package/dist/server/core/runs/comment-consent.js +116 -0
- package/dist/server/core/runs/comment-consent.js.map +1 -0
- package/dist/server/core/runs/eligibility.d.ts +13 -1
- package/dist/server/core/runs/eligibility.d.ts.map +1 -1
- package/dist/server/core/runs/eligibility.js +41 -10
- package/dist/server/core/runs/eligibility.js.map +1 -1
- package/dist/server/core/runs/execution-view.d.ts +8 -0
- package/dist/server/core/runs/execution-view.d.ts.map +1 -1
- package/dist/server/core/runs/execution-view.js +9 -0
- package/dist/server/core/runs/execution-view.js.map +1 -1
- package/dist/server/core/runs/execution.d.ts +1 -1
- package/dist/server/core/runs/execution.d.ts.map +1 -1
- package/dist/server/core/runs/execution.js +8 -2
- package/dist/server/core/runs/execution.js.map +1 -1
- package/dist/server/core/runs/identity.d.ts +9 -0
- package/dist/server/core/runs/identity.d.ts.map +1 -0
- package/dist/server/core/runs/identity.js +75 -0
- package/dist/server/core/runs/identity.js.map +1 -0
- package/dist/server/core/runs/index.d.ts +6 -6
- package/dist/server/core/runs/index.d.ts.map +1 -1
- package/dist/server/core/runs/index.js +6 -6
- package/dist/server/core/runs/index.js.map +1 -1
- package/dist/server/core/runs/input-gate.d.ts +1 -1
- package/dist/server/core/runs/input-gate.d.ts.map +1 -1
- package/dist/server/core/runs/input-gate.js +4 -2
- package/dist/server/core/runs/input-gate.js.map +1 -1
- package/dist/server/core/runs/lifecycle.d.ts +16 -18
- package/dist/server/core/runs/lifecycle.d.ts.map +1 -1
- package/dist/server/core/runs/lifecycle.js +146 -60
- package/dist/server/core/runs/lifecycle.js.map +1 -1
- package/dist/server/core/runs/policy.d.ts +9 -2
- package/dist/server/core/runs/policy.d.ts.map +1 -1
- package/dist/server/core/runs/policy.js +17 -8
- package/dist/server/core/runs/policy.js.map +1 -1
- package/dist/server/core/runs/ports.d.ts +41 -31
- package/dist/server/core/runs/ports.d.ts.map +1 -1
- package/dist/server/core/runs/ports.js +2 -13
- package/dist/server/core/runs/ports.js.map +1 -1
- package/dist/server/core/runs/preview.d.ts.map +1 -1
- package/dist/server/core/runs/preview.js +1 -3
- package/dist/server/core/runs/preview.js.map +1 -1
- package/dist/server/core/runs/run-data-purge.d.ts +15 -0
- package/dist/server/core/runs/run-data-purge.d.ts.map +1 -0
- package/dist/server/core/runs/run-data-purge.js +82 -0
- package/dist/server/core/runs/run-data-purge.js.map +1 -0
- package/dist/server/core/runs/run-requests.d.ts +25 -0
- package/dist/server/core/runs/run-requests.d.ts.map +1 -1
- package/dist/server/core/runs/run-requests.js +131 -64
- package/dist/server/core/runs/run-requests.js.map +1 -1
- package/dist/server/core/runs/run.service.d.ts +31 -2
- package/dist/server/core/runs/run.service.d.ts.map +1 -1
- package/dist/server/core/runs/run.service.js +638 -74
- package/dist/server/core/runs/run.service.js.map +1 -1
- package/dist/server/core/runs/run.store.d.ts +11 -0
- package/dist/server/core/runs/run.store.d.ts.map +1 -1
- package/dist/server/core/runs/run.store.js +39 -11
- package/dist/server/core/runs/run.store.js.map +1 -1
- package/dist/server/core/runs/runner-view.d.ts +12 -2
- package/dist/server/core/runs/runner-view.d.ts.map +1 -1
- package/dist/server/core/runs/runner-view.js +55 -13
- package/dist/server/core/runs/runner-view.js.map +1 -1
- package/dist/server/core/runs/selection.d.ts +13 -0
- package/dist/server/core/runs/selection.d.ts.map +1 -0
- package/dist/server/core/runs/selection.js +21 -0
- package/dist/server/core/runs/selection.js.map +1 -0
- package/dist/server/core/runs/sweeper.d.ts +1 -0
- package/dist/server/core/runs/sweeper.d.ts.map +1 -1
- package/dist/server/core/runs/sweeper.js +66 -17
- package/dist/server/core/runs/sweeper.js.map +1 -1
- package/dist/server/core/runs/transitions.d.ts +6 -2
- package/dist/server/core/runs/transitions.d.ts.map +1 -1
- package/dist/server/core/runs/transitions.js +73 -19
- package/dist/server/core/runs/transitions.js.map +1 -1
- package/dist/server/core/runs/workload.d.ts +17 -5
- package/dist/server/core/runs/workload.d.ts.map +1 -1
- package/dist/server/core/runs/workload.js +203 -68
- package/dist/server/core/runs/workload.js.map +1 -1
- package/dist/server/core/skills/skill.service.d.ts +6 -2
- package/dist/server/core/skills/skill.service.d.ts.map +1 -1
- package/dist/server/core/skills/skill.service.js +87 -66
- package/dist/server/core/skills/skill.service.js.map +1 -1
- package/dist/server/core/skills/skill.store.d.ts +14 -0
- package/dist/server/core/skills/skill.store.d.ts.map +1 -1
- package/dist/server/core/skills/skill.store.js +30 -0
- package/dist/server/core/skills/skill.store.js.map +1 -1
- package/dist/server/core/transaction-read.d.ts +4 -0
- package/dist/server/core/transaction-read.d.ts.map +1 -0
- package/dist/server/core/transaction-read.js +30 -0
- package/dist/server/core/transaction-read.js.map +1 -0
- package/dist/server/core/variables/index.d.ts +1 -1
- package/dist/server/core/variables/index.d.ts.map +1 -1
- package/dist/server/core/variables/index.js.map +1 -1
- package/dist/server/core/variables/variable.service.d.ts +18 -0
- package/dist/server/core/variables/variable.service.d.ts.map +1 -1
- package/dist/server/core/variables/variable.service.js +95 -20
- package/dist/server/core/variables/variable.service.js.map +1 -1
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/jobs/job.service.d.ts +1 -1
- package/dist/server/jobs/job.service.d.ts.map +1 -1
- package/dist/server/jobs/job.service.js +8 -2
- package/dist/server/jobs/job.service.js.map +1 -1
- package/dist/server/kernel/events.d.ts +7 -3
- package/dist/server/kernel/events.d.ts.map +1 -1
- package/dist/server/kernel/events.js.map +1 -1
- package/dist/server/kernel/scopes.d.ts +6 -0
- package/dist/server/kernel/scopes.d.ts.map +1 -1
- package/dist/server/kernel/scopes.js +3 -1
- package/dist/server/kernel/scopes.js.map +1 -1
- package/dist/server/online/agent/configuration.d.ts +26 -0
- package/dist/server/online/agent/configuration.d.ts.map +1 -0
- package/dist/server/online/agent/configuration.js +261 -0
- package/dist/server/online/agent/configuration.js.map +1 -0
- package/dist/server/online/agent/contracts.d.ts +87 -0
- package/dist/server/online/agent/contracts.d.ts.map +1 -0
- package/dist/server/online/agent/contracts.js +2 -0
- package/dist/server/online/agent/contracts.js.map +1 -0
- package/dist/server/online/agent/errors.d.ts +11 -0
- package/dist/server/online/agent/errors.d.ts.map +1 -0
- package/dist/server/online/agent/errors.js +21 -0
- package/dist/server/online/agent/errors.js.map +1 -0
- package/dist/server/online/agent/index.d.ts +11 -0
- package/dist/server/online/agent/index.d.ts.map +1 -0
- package/dist/server/online/agent/index.js +9 -0
- package/dist/server/online/agent/index.js.map +1 -0
- package/dist/server/online/agent/messages/json.d.ts +5 -0
- package/dist/server/online/agent/messages/json.d.ts.map +1 -0
- package/dist/server/online/agent/messages/json.js +88 -0
- package/dist/server/online/agent/messages/json.js.map +1 -0
- package/dist/server/online/agent/messages/projection.d.ts +20 -0
- package/dist/server/online/agent/messages/projection.d.ts.map +1 -0
- package/dist/server/online/agent/messages/projection.js +495 -0
- package/dist/server/online/agent/messages/projection.js.map +1 -0
- package/dist/server/online/agent/messages/validation.d.ts +7 -0
- package/dist/server/online/agent/messages/validation.d.ts.map +1 -0
- package/dist/server/online/agent/messages/validation.js +159 -0
- package/dist/server/online/agent/messages/validation.js.map +1 -0
- package/dist/server/online/agent/native/backend.d.ts +60 -0
- package/dist/server/online/agent/native/backend.d.ts.map +1 -0
- package/dist/server/online/agent/native/backend.js +411 -0
- package/dist/server/online/agent/native/backend.js.map +1 -0
- package/dist/server/online/agent/native/execution.d.ts +41 -0
- package/dist/server/online/agent/native/execution.d.ts.map +1 -0
- package/dist/server/online/agent/native/execution.js +430 -0
- package/dist/server/online/agent/native/execution.js.map +1 -0
- package/dist/server/online/agent/native/session.d.ts +40 -0
- package/dist/server/online/agent/native/session.d.ts.map +1 -0
- package/dist/server/online/agent/native/session.js +104 -0
- package/dist/server/online/agent/native/session.js.map +1 -0
- package/dist/server/online/agent/native/types.d.ts +32 -0
- package/dist/server/online/agent/native/types.d.ts.map +1 -0
- package/dist/server/online/agent/native/types.js +2 -0
- package/dist/server/online/agent/native/types.js.map +1 -0
- package/dist/server/online/agent/persistence/manager.d.ts +16 -0
- package/dist/server/online/agent/persistence/manager.d.ts.map +1 -0
- package/dist/server/online/agent/persistence/manager.js +209 -0
- package/dist/server/online/agent/persistence/manager.js.map +1 -0
- package/dist/server/online/agent/persistence/state.d.ts +11 -0
- package/dist/server/online/agent/persistence/state.d.ts.map +1 -0
- package/dist/server/online/agent/persistence/state.js +45 -0
- package/dist/server/online/agent/persistence/state.js.map +1 -0
- package/dist/server/online/agent/persistence/store.d.ts +58 -0
- package/dist/server/online/agent/persistence/store.d.ts.map +1 -0
- package/dist/server/online/agent/persistence/store.js +634 -0
- package/dist/server/online/agent/persistence/store.js.map +1 -0
- package/dist/server/online/agent/persistence/types.d.ts +44 -0
- package/dist/server/online/agent/persistence/types.d.ts.map +1 -0
- package/dist/server/online/agent/persistence/types.js +2 -0
- package/dist/server/online/agent/persistence/types.js.map +1 -0
- package/dist/server/online/agent/runner/backend.d.ts +57 -0
- package/dist/server/online/agent/runner/backend.d.ts.map +1 -0
- package/dist/server/online/agent/runner/backend.js +501 -0
- package/dist/server/online/agent/runner/backend.js.map +1 -0
- package/dist/server/online/agent/runner/projection.d.ts +10 -0
- package/dist/server/online/agent/runner/projection.d.ts.map +1 -0
- package/dist/server/online/agent/runner/projection.js +171 -0
- package/dist/server/online/agent/runner/projection.js.map +1 -0
- package/dist/server/online/agent/runner/types.d.ts +44 -0
- package/dist/server/online/agent/runner/types.d.ts.map +1 -0
- package/dist/server/online/agent/runner/types.js +2 -0
- package/dist/server/online/agent/runner/types.js.map +1 -0
- package/dist/server/online/agent/service.d.ts +47 -0
- package/dist/server/online/agent/service.d.ts.map +1 -0
- package/dist/server/online/agent/service.js +111 -0
- package/dist/server/online/agent/service.js.map +1 -0
- package/dist/server/online/agent/transport/streams.d.ts +54 -0
- package/dist/server/online/agent/transport/streams.d.ts.map +1 -0
- package/dist/server/online/agent/transport/streams.js +440 -0
- package/dist/server/online/agent/transport/streams.js.map +1 -0
- package/dist/server/online/agent/types.d.ts +155 -0
- package/dist/server/online/agent/types.d.ts.map +1 -0
- package/dist/server/online/agent/types.js +2 -0
- package/dist/server/online/agent/types.js.map +1 -0
- package/dist/server/online/index.d.ts +0 -5
- package/dist/server/online/index.d.ts.map +1 -1
- package/dist/server/online/index.js +0 -5
- package/dist/server/online/index.js.map +1 -1
- package/dist/server/online/providers.d.ts.map +1 -1
- package/dist/server/online/providers.js +26 -2
- package/dist/server/online/providers.js.map +1 -1
- package/dist/server/online/routes.d.ts.map +1 -1
- package/dist/server/online/routes.js +6 -35
- package/dist/server/online/routes.js.map +1 -1
- package/dist/server/online/services.d.ts.map +1 -1
- package/dist/server/online/services.js +101 -24
- package/dist/server/online/services.js.map +1 -1
- package/dist/server/providers/agents.d.ts +18 -25
- package/dist/server/providers/agents.d.ts.map +1 -1
- package/dist/server/providers/agents.js +72 -101
- package/dist/server/providers/agents.js.map +1 -1
- package/dist/server/providers/runners.d.ts +3 -1
- package/dist/server/providers/runners.d.ts.map +1 -1
- package/dist/server/providers/runners.js +38 -9
- package/dist/server/providers/runners.js.map +1 -1
- package/dist/server/routes/admin.d.ts +4 -0
- package/dist/server/routes/admin.d.ts.map +1 -1
- package/dist/server/routes/admin.js +131 -209
- package/dist/server/routes/admin.js.map +1 -1
- package/dist/server/routes/chat.d.ts.map +1 -1
- package/dist/server/routes/chat.js +313 -164
- package/dist/server/routes/chat.js.map +1 -1
- package/dist/server/routes/index.d.ts.map +1 -1
- package/dist/server/routes/index.js +8 -0
- package/dist/server/routes/index.js.map +1 -1
- package/dist/server/routes/roster.d.ts.map +1 -1
- package/dist/server/routes/roster.js +6 -22
- package/dist/server/routes/roster.js.map +1 -1
- package/dist/server/routes/run-requests.js +3 -3
- package/dist/server/routes/run-requests.js.map +1 -1
- package/dist/server/routes/runners/admin.d.ts.map +1 -1
- package/dist/server/routes/runners/admin.js +219 -25
- package/dist/server/routes/runners/admin.js.map +1 -1
- package/dist/server/routes/runners/install.d.ts.map +1 -1
- package/dist/server/routes/runners/install.js +7 -2
- package/dist/server/routes/runners/install.js.map +1 -1
- package/dist/server/routes/runners/runner.d.ts.map +1 -1
- package/dist/server/routes/runners/runner.js +2 -0
- package/dist/server/routes/runners/runner.js.map +1 -1
- package/dist/server/routes/schemas.d.ts +18 -10
- package/dist/server/routes/schemas.d.ts.map +1 -1
- package/dist/server/routes/schemas.js +497 -153
- package/dist/server/routes/schemas.js.map +1 -1
- package/dist/server/runners/runner.service.d.ts +47 -4
- package/dist/server/runners/runner.service.d.ts.map +1 -1
- package/dist/server/runners/runner.service.js +423 -79
- package/dist/server/runners/runner.service.js.map +1 -1
- package/dist/server/runners/runner.store.d.ts +8 -3
- package/dist/server/runners/runner.store.d.ts.map +1 -1
- package/dist/server/runners/runner.store.js +63 -6
- package/dist/server/runners/runner.store.js.map +1 -1
- package/dist/server/runners/slots.d.ts +5 -2
- package/dist/server/runners/slots.d.ts.map +1 -1
- package/dist/server/runners/slots.js +3 -4
- package/dist/server/runners/slots.js.map +1 -1
- package/dist/server/runners/workspaces.d.ts.map +1 -1
- package/dist/server/runners/workspaces.js +18 -2
- package/dist/server/runners/workspaces.js.map +1 -1
- package/dist/server/testing.d.ts +0 -2
- package/dist/server/testing.d.ts.map +1 -1
- package/dist/server/testing.js +1 -4
- package/dist/server/testing.js.map +1 -1
- package/dist/server/tokens.d.ts +8 -7
- package/dist/server/tokens.d.ts.map +1 -1
- package/dist/server/tokens.js +4 -2
- package/dist/server/tokens.js.map +1 -1
- package/dist/shared/access.d.ts +2 -6
- package/dist/shared/access.d.ts.map +1 -1
- package/dist/shared/access.js +2 -6
- package/dist/shared/access.js.map +1 -1
- package/dist/shared/agents.d.ts +131 -169
- package/dist/shared/agents.d.ts.map +1 -1
- package/dist/shared/agents.js +36 -102
- package/dist/shared/agents.js.map +1 -1
- package/dist/shared/conversations.d.ts +93 -170
- package/dist/shared/conversations.d.ts.map +1 -1
- package/dist/shared/conversations.js +8 -30
- package/dist/shared/conversations.js.map +1 -1
- package/dist/shared/model-catalog.d.ts +53 -0
- package/dist/shared/model-catalog.d.ts.map +1 -0
- package/dist/shared/model-catalog.js +182 -0
- package/dist/shared/model-catalog.js.map +1 -0
- package/dist/shared/online-agent.d.ts +3 -0
- package/dist/shared/online-agent.d.ts.map +1 -0
- package/dist/shared/online-agent.js +3 -0
- package/dist/shared/online-agent.js.map +1 -0
- package/dist/shared/page-ui-context.d.ts +26 -0
- package/dist/shared/page-ui-context.d.ts.map +1 -0
- package/dist/shared/page-ui-context.js +129 -0
- package/dist/shared/page-ui-context.js.map +1 -0
- package/dist/shared/quota.d.ts +15 -0
- package/dist/shared/quota.d.ts.map +1 -0
- package/dist/shared/quota.js +2 -0
- package/dist/shared/quota.js.map +1 -0
- package/dist/shared/runners.d.ts +132 -14
- package/dist/shared/runners.d.ts.map +1 -1
- package/dist/shared/runners.js +171 -11
- package/dist/shared/runners.js.map +1 -1
- package/dist/shared/runs.d.ts +57 -1
- package/dist/shared/runs.d.ts.map +1 -1
- package/dist/shared/runs.js +28 -0
- package/dist/shared/runs.js.map +1 -1
- package/dist/shared/skills.d.ts +11 -5
- package/dist/shared/skills.d.ts.map +1 -1
- package/dist/shared/skills.js +7 -2
- package/dist/shared/skills.js.map +1 -1
- package/dist/shared/ui-message.d.ts +80 -0
- package/dist/shared/ui-message.d.ts.map +1 -0
- package/dist/shared/ui-message.js +153 -0
- package/dist/shared/ui-message.js.map +1 -0
- package/dist/shared/variables.js +1 -1
- package/dist/shared/variables.js.map +1 -1
- package/docs/ai-forms.md +346 -0
- package/docs/execution-history.md +19 -0
- package/docs/mysql-installation-upgrade.md +7 -0
- package/docs/runner-agents.md +27 -0
- package/docs/ui-message-clients.md +80 -0
- package/docs/ui-messages.md +209 -0
- package/docs/workspace-cleanup.md +13 -0
- package/package.json +41 -27
- package/skills/nocobase-app-plugin-agents/SKILL.md +16 -13
- package/skills/nocobase-app-plugin-agents/references/agents.md +30 -0
- package/skills/nocobase-app-plugin-agents/references/extension-points.md +21 -21
- package/skills/nocobase-app-plugin-agents/references/model-services.md +17 -0
- package/skills/nocobase-app-plugin-agents/references/online-agent.md +216 -0
- package/skills/nocobase-app-plugin-agents/references/runners.md +12 -0
- package/skills/nocobase-app-plugin-agents/references/setup-and-config.md +6 -7
- package/skills/nocobase-app-plugin-agents/references/variables-skills-usage.md +6 -4
- package/skills/nocobase-app-plugin-agents/references/verification-and-troubleshooting.md +29 -32
- package/dist/client/chat/settings-section.d.ts +0 -5
- package/dist/client/chat/settings-section.d.ts.map +0 -1
- package/dist/client/chat/settings-section.js +0 -86
- package/dist/client/chat/settings-section.js.map +0 -1
- package/dist/client/components/agent-fields.d.ts +0 -45
- package/dist/client/components/agent-fields.d.ts.map +0 -1
- package/dist/client/components/agent-fields.js +0 -83
- package/dist/client/components/agent-fields.js.map +0 -1
- package/dist/client/components/agent-type.d.ts +0 -32
- package/dist/client/components/agent-type.d.ts.map +0 -1
- package/dist/client/components/agent-type.js +0 -80
- package/dist/client/components/agent-type.js.map +0 -1
- package/dist/client/components/model-entries.d.ts +0 -44
- package/dist/client/components/model-entries.d.ts.map +0 -1
- package/dist/client/components/model-entries.js +0 -104
- package/dist/client/components/model-entries.js.map +0 -1
- package/dist/client/hooks/use-agent-save.d.ts +0 -9
- package/dist/client/hooks/use-agent-save.d.ts.map +0 -1
- package/dist/client/hooks/use-agent-save.js +0 -40
- package/dist/client/hooks/use-agent-save.js.map +0 -1
- package/dist/client/hooks/use-model-catalog.d.ts +0 -9
- package/dist/client/hooks/use-model-catalog.d.ts.map +0 -1
- package/dist/client/hooks/use-model-catalog.js +0 -27
- package/dist/client/hooks/use-model-catalog.js.map +0 -1
- package/dist/client/lib/model-suggestions.d.ts +0 -28
- package/dist/client/lib/model-suggestions.d.ts.map +0 -1
- package/dist/client/lib/model-suggestions.js +0 -44
- package/dist/client/lib/model-suggestions.js.map +0 -1
- package/dist/client/lib/tool-policy.d.ts +0 -3
- package/dist/client/lib/tool-policy.d.ts.map +0 -1
- package/dist/client/lib/tool-policy.js +0 -5
- package/dist/client/lib/tool-policy.js.map +0 -1
- package/dist/client/online/default-model.d.ts +0 -5
- package/dist/client/online/default-model.d.ts.map +0 -1
- package/dist/client/online/default-model.js +0 -65
- package/dist/client/online/default-model.js.map +0 -1
- package/dist/client/pages/agents/agent-model.d.ts +0 -69
- package/dist/client/pages/agents/agent-model.d.ts.map +0 -1
- package/dist/client/pages/agents/agent-model.js +0 -153
- package/dist/client/pages/agents/agent-model.js.map +0 -1
- package/dist/client/pages/agents/detail/brief-preview.d.ts +0 -7
- package/dist/client/pages/agents/detail/brief-preview.d.ts.map +0 -1
- package/dist/client/pages/agents/detail/brief-preview.js +0 -43
- package/dist/client/pages/agents/detail/brief-preview.js.map +0 -1
- package/dist/client/pages/agents/detail/history.d.ts +0 -11
- package/dist/client/pages/agents/detail/history.d.ts.map +0 -1
- package/dist/client/pages/agents/detail/history.js +0 -149
- package/dist/client/pages/agents/detail/history.js.map +0 -1
- package/dist/client/pages/agents/detail/index.d.ts +0 -3
- package/dist/client/pages/agents/detail/index.d.ts.map +0 -1
- package/dist/client/pages/agents/detail/index.js +0 -241
- package/dist/client/pages/agents/detail/index.js.map +0 -1
- package/dist/client/pages/agents/detail/sections.d.ts +0 -21
- package/dist/client/pages/agents/detail/sections.d.ts.map +0 -1
- package/dist/client/pages/agents/detail/sections.js +0 -280
- package/dist/client/pages/agents/detail/sections.js.map +0 -1
- package/dist/client/pages/agents/detail/tab-draft.d.ts +0 -43
- package/dist/client/pages/agents/detail/tab-draft.d.ts.map +0 -1
- package/dist/client/pages/agents/detail/tab-draft.js +0 -115
- package/dist/client/pages/agents/detail/tab-draft.js.map +0 -1
- package/dist/client/pages/agents/detail/unsaved-bar.d.ts +0 -13
- package/dist/client/pages/agents/detail/unsaved-bar.d.ts.map +0 -1
- package/dist/client/pages/agents/detail/unsaved-bar.js +0 -21
- package/dist/client/pages/agents/detail/unsaved-bar.js.map +0 -1
- package/dist/client/pages/agents/new.d.ts +0 -3
- package/dist/client/pages/agents/new.d.ts.map +0 -1
- package/dist/client/pages/agents/new.js +0 -149
- package/dist/client/pages/agents/new.js.map +0 -1
- package/dist/client/pages/agents/preset-picker.d.ts +0 -8
- package/dist/client/pages/agents/preset-picker.d.ts.map +0 -1
- package/dist/client/pages/agents/preset-picker.js +0 -41
- package/dist/client/pages/agents/preset-picker.js.map +0 -1
- package/dist/server/core/consultations/consultation.service.d.ts +0 -59
- package/dist/server/core/consultations/consultation.service.d.ts.map +0 -1
- package/dist/server/core/consultations/consultation.service.js +0 -198
- package/dist/server/core/consultations/consultation.service.js.map +0 -1
- package/dist/server/core/consultations/index.d.ts +0 -3
- package/dist/server/core/consultations/index.d.ts.map +0 -1
- package/dist/server/core/consultations/index.js +0 -3
- package/dist/server/core/consultations/index.js.map +0 -1
- package/dist/server/core/consultations/prompt.d.ts +0 -41
- package/dist/server/core/consultations/prompt.d.ts.map +0 -1
- package/dist/server/core/consultations/prompt.js +0 -64
- package/dist/server/core/consultations/prompt.js.map +0 -1
- package/dist/server/core/presets/index.d.ts +0 -19
- package/dist/server/core/presets/index.d.ts.map +0 -1
- package/dist/server/core/presets/index.js +0 -28
- package/dist/server/core/presets/index.js.map +0 -1
- package/dist/server/online/cli-command.d.ts +0 -20
- package/dist/server/online/cli-command.d.ts.map +0 -1
- package/dist/server/online/cli-command.js +0 -345
- package/dist/server/online/cli-command.js.map +0 -1
- package/dist/server/online/consult-tool.d.ts +0 -54
- package/dist/server/online/consult-tool.d.ts.map +0 -1
- package/dist/server/online/consult-tool.js +0 -177
- package/dist/server/online/consult-tool.js.map +0 -1
- package/dist/server/online/executor.d.ts +0 -83
- package/dist/server/online/executor.d.ts.map +0 -1
- package/dist/server/online/executor.js +0 -714
- package/dist/server/online/executor.js.map +0 -1
- package/dist/server/online/sandbox.d.ts +0 -32
- package/dist/server/online/sandbox.d.ts.map +0 -1
- package/dist/server/online/sandbox.js +0 -246
- package/dist/server/online/sandbox.js.map +0 -1
- package/dist/server/online/scripted.d.ts +0 -12
- package/dist/server/online/scripted.d.ts.map +0 -1
- package/dist/server/online/scripted.js +0 -176
- package/dist/server/online/scripted.js.map +0 -1
- package/dist/server/online/tools.d.ts +0 -17
- package/dist/server/online/tools.d.ts.map +0 -1
- package/dist/server/online/tools.js +0 -31
- package/dist/server/online/tools.js.map +0 -1
- package/dist/server/vendor/THIRD_PARTY_LICENSES.txt +0 -782
- package/dist/server/vendor/just-bash.d.ts +0 -83
- package/dist/server/vendor/just-bash.js +0 -2102
- package/dist/shared/presets.d.ts +0 -30
- package/dist/shared/presets.d.ts.map +0 -1
- package/dist/shared/presets.js +0 -2
- package/dist/shared/presets.js.map +0 -1
- package/skills/nocobase-app-plugin-agents/references/online-agents.md +0 -31
|
@@ -1,115 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Agents:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* every change (`agent.history.ts`).
|
|
2
|
+
* Agents: one for each coding tool and model the runners report (`syncRunner`), and the application's own
|
|
3
|
+
* (`ensureSystem`). Nobody creates or deletes an agent. Someone who manages agents writes what an agent discovered from
|
|
4
|
+
* runners is good at, chooses its default reasoning effort and enables or disables it (`update`); everything else about
|
|
5
|
+
* it is the application's, the same for each (`setDefaults`: its instructions and business actions). Who may change an
|
|
6
|
+
* agent is the route's concern; the service checks the values and the revision an edit was made against, and keeps
|
|
7
|
+
* the history of every change (`agent.history.ts`).
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Disabling an agent withdraws its queued runs and announces `agent.removed`, so the application lets go of the work
|
|
10
|
+
* it gave the agent.
|
|
12
11
|
*/
|
|
13
|
-
import {
|
|
12
|
+
import { createHash } from 'node:crypto';
|
|
14
13
|
import { z } from 'zod';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
14
|
+
import { effortsFor, MAX_MODEL_ENTRIES, } from '../../../shared/agents.js';
|
|
15
|
+
import { agentNameOf, discoveryKey } from '../../../shared/model-catalog.js';
|
|
16
|
+
import { lockDiscovery, preferences, } from './discovery.js';
|
|
17
|
+
import { reportedModels } from '../../../shared/runners.js';
|
|
18
|
+
import { invalid, notFound, ProtocolError } from '../../kernel/errors.js';
|
|
18
19
|
import { cleanList } from '../../kernel/values.js';
|
|
19
|
-
import { attachmentsRepo, replaceAttachments, skillsRepo, } from '../skills/skill.store.js';
|
|
20
20
|
import { diffAgents, listChanges, recordChange, } from './agent.history.js';
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/** An entry's reasoning effort; empty for the default. Which values its tool or service takes is `checkType`'s. */
|
|
33
|
-
const EffortSchema = z
|
|
34
|
-
.string()
|
|
35
|
-
.trim()
|
|
36
|
-
.max(32)
|
|
37
|
-
.nullable()
|
|
38
|
-
.optional()
|
|
39
|
-
.transform((effort) => (effort ? effort : null));
|
|
40
|
-
const RunnerEntrySchema = z.strictObject({
|
|
41
|
-
tool: AgentToolSchema,
|
|
42
|
-
model: z
|
|
43
|
-
.string()
|
|
44
|
-
.trim()
|
|
45
|
-
.max(200)
|
|
46
|
-
.nullable()
|
|
21
|
+
import { agentDirectory, agentNamesOf, agentsRepo, findAgent, insertAgent, isRemoved, listAgents, reviseAgent, updateAgent, } from './agent.store.js';
|
|
22
|
+
/** What changing an agent accepts. */
|
|
23
|
+
export const AgentPatchSchema = z.strictObject({
|
|
24
|
+
description: z.string().max(10_000).nullable().optional().meta({
|
|
25
|
+
description: 'What it is good at: the project manager hands it work by this. Required to enable it.',
|
|
26
|
+
}),
|
|
27
|
+
effort: z.string().trim().max(32).nullable().optional().meta({
|
|
28
|
+
description: "Its default reasoning effort, one of its tool's; null for the tool's default.",
|
|
29
|
+
}),
|
|
30
|
+
enabled: z
|
|
31
|
+
.boolean()
|
|
47
32
|
.optional()
|
|
48
|
-
.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
effort: EffortSchema,
|
|
55
|
-
});
|
|
56
|
-
/**
|
|
57
|
-
* An agent's list of tools and models: runner entries (`{ tool, model?, effort? }`) or online ones
|
|
58
|
-
* (`{ modelService, model, effort? }`).
|
|
59
|
-
*/
|
|
60
|
-
export const ModelEntriesSchema = z
|
|
61
|
-
.array(z.union([RunnerEntrySchema, OnlineEntrySchema]))
|
|
62
|
-
.max(MAX_MODEL_ENTRIES)
|
|
63
|
-
.meta({
|
|
64
|
-
description: 'The tools and models, in order, the first its default, each with an optional reasoning effort its tool or service takes: `[{"tool":"codex","model":"gpt-5","effort":"high"},{"tool":"claude"}]` for a runner agent, `[{"modelService":"openai","model":"gpt-5","effort":"low"}]` for an online one. A runner agent needs at least one; an online agent may have none until a model is configured.',
|
|
65
|
-
});
|
|
66
|
-
const fields = {
|
|
67
|
-
name: z.string().trim().min(1).max(200),
|
|
68
|
-
description: z.string().max(10_000).nullable(),
|
|
69
|
-
avatar: z.string().trim().max(500).nullable(),
|
|
70
|
-
modelEntries: ModelEntriesSchema,
|
|
71
|
-
instructions: z.string().max(100_000).nullable(),
|
|
72
|
-
runnerIds: z.array(z.string().min(1).max(64)).max(100),
|
|
73
|
-
skillIds: z.array(z.string().min(1).max(64)).max(100),
|
|
74
|
-
actions: z.array(z.string().min(1).max(100)).max(100),
|
|
75
|
-
confirmChanges: z.enum(CONFIRM_CHANGES),
|
|
76
|
-
access: z.enum(AGENT_ACCESS),
|
|
77
|
-
userIds: z.array(z.string().min(1).max(64)).max(500),
|
|
78
|
-
ownerUserId: z.string().min(1).max(64),
|
|
79
|
-
maxConcurrentRuns: z.number().int().min(1).max(100),
|
|
80
|
-
maxAttempts: z.number().int().min(1).max(10),
|
|
81
|
-
toolPolicy: ToolPolicyPatchSchema.nullable(),
|
|
82
|
-
};
|
|
83
|
-
/** What creating an agent accepts. */
|
|
84
|
-
export const AgentInputSchema = z.strictObject({
|
|
85
|
-
...fields,
|
|
86
|
-
type: z.enum(AGENT_TYPES).optional(),
|
|
87
|
-
modelEntries: fields.modelEntries.optional(),
|
|
88
|
-
description: fields.description.optional(),
|
|
89
|
-
avatar: fields.avatar.optional(),
|
|
90
|
-
instructions: fields.instructions.optional(),
|
|
91
|
-
runnerIds: fields.runnerIds.optional(),
|
|
92
|
-
skillIds: fields.skillIds.optional(),
|
|
93
|
-
actions: fields.actions.optional(),
|
|
94
|
-
confirmChanges: fields.confirmChanges.optional(),
|
|
95
|
-
access: fields.access.optional(),
|
|
96
|
-
userIds: fields.userIds.optional(),
|
|
97
|
-
ownerUserId: fields.ownerUserId.optional(),
|
|
98
|
-
maxConcurrentRuns: fields.maxConcurrentRuns.optional(),
|
|
99
|
-
maxAttempts: fields.maxAttempts.optional(),
|
|
100
|
-
toolPolicy: fields.toolPolicy.optional(),
|
|
101
|
-
});
|
|
102
|
-
/**
|
|
103
|
-
* What updating an agent accepts: any field of the input but its type, and the revision the edit was made against. A
|
|
104
|
-
* patch naming a type is refused (`AGENT_TYPE_IMMUTABLE`) rather than having it ignored.
|
|
105
|
-
*/
|
|
106
|
-
export const AgentPatchSchema = z
|
|
107
|
-
.strictObject(fields)
|
|
108
|
-
.partial()
|
|
109
|
-
.extend({
|
|
110
|
-
expectedRevision: z.number().int().min(1),
|
|
111
|
-
type: z.never({ error: 'An agent keeps its type.' }).optional(),
|
|
33
|
+
.meta({ description: 'Offer it work, or stop offering it.' }),
|
|
34
|
+
expectedRevision: z
|
|
35
|
+
.number()
|
|
36
|
+
.int()
|
|
37
|
+
.min(1)
|
|
38
|
+
.describe('The revision last read; reject if the record has changed.'),
|
|
112
39
|
});
|
|
40
|
+
const NO_DEFAULTS = { instructions: null, actions: [] };
|
|
41
|
+
/** How often a runner's report refreshes when its tools and models were last seen. */
|
|
42
|
+
const REPORT_REFRESH_MS = 10 * 60_000;
|
|
43
|
+
/** How many runs of one discovered agent may run at once: as many as the runners' slots allow. */
|
|
44
|
+
const RUNNER_AGENT_CONCURRENCY = 100;
|
|
45
|
+
/** How many attempts a run of any agent gets. */
|
|
46
|
+
const AGENT_ATTEMPTS = 3;
|
|
47
|
+
/** The effort a discovered agent starts with: `medium` when its tool takes it, else the tool's default. */
|
|
48
|
+
function initialEffort(tool) {
|
|
49
|
+
return effortsFor({ tool }).includes('medium') ? 'medium' : null;
|
|
50
|
+
}
|
|
51
|
+
/** The fixed id of the agent of a tool and model, so two runners reporting it at once create one. */
|
|
52
|
+
export function runnerAgentId(tool, model) {
|
|
53
|
+
const hash = createHash('sha256')
|
|
54
|
+
.update(`${tool}\u0000${model}`)
|
|
55
|
+
.digest('hex')
|
|
56
|
+
.slice(0, 20);
|
|
57
|
+
return `runner-${tool}-${hash}`;
|
|
58
|
+
}
|
|
113
59
|
/** Thrown inside an update's transaction when the patch changes nothing, to roll the raised revision back. */
|
|
114
60
|
class Unchanged extends Error {
|
|
115
61
|
agent;
|
|
@@ -121,200 +67,178 @@ class Unchanged extends Error {
|
|
|
121
67
|
function revisionConflict(current) {
|
|
122
68
|
return new ProtocolError('REVISION_CONFLICT', 'The agent was changed by someone else since you opened it. Reload it to see what changed, then make your change again.', { revision: current });
|
|
123
69
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
'name',
|
|
128
|
-
'description',
|
|
129
|
-
'avatar',
|
|
130
|
-
'modelEntries',
|
|
131
|
-
'instructions',
|
|
132
|
-
'confirmChanges',
|
|
133
|
-
'access',
|
|
134
|
-
'ownerUserId',
|
|
135
|
-
'maxConcurrentRuns',
|
|
136
|
-
'maxAttempts',
|
|
137
|
-
'toolPolicy',
|
|
138
|
-
])
|
|
139
|
-
if (input[key] !== undefined)
|
|
140
|
-
values[key] = input[key];
|
|
141
|
-
if (input.runnerIds !== undefined)
|
|
142
|
-
values.runnerIds = cleanList(input.runnerIds);
|
|
143
|
-
if (input.actions !== undefined)
|
|
144
|
-
values.actions = cleanList(input.actions);
|
|
145
|
-
return values;
|
|
70
|
+
/** Whether work may be given to the agent: enabled, with at least one tool and model. */
|
|
71
|
+
export function isWorkable(agent) {
|
|
72
|
+
return agent.status === 'enabled' && agent.modelEntries.length > 0;
|
|
146
73
|
}
|
|
147
|
-
/**
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
const found = await skillsRepo(conn).findMany({
|
|
152
|
-
filter: (f) => f.or(unique.map((id) => f.string('id').eq(id))),
|
|
153
|
-
});
|
|
154
|
-
if (found.length !== unique.length)
|
|
155
|
-
throw invalid('Some of the skills do not exist.');
|
|
156
|
-
}
|
|
157
|
-
await replaceAttachments(conn, 'agent', agentId, unique, () => ids.next(), now);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* 400 unless the fields fit the type: a runner agent's entries name coding tools, at least one; an online agent's name
|
|
161
|
-
* model services and their models (none while it is not configured), and it has none of what only a runner uses
|
|
162
|
-
* (runners, a tool policy), nor a business action meant for runner agents only. No entry is listed twice, and each
|
|
163
|
-
* entry's effort is one its tool or service takes.
|
|
164
|
-
*/
|
|
165
|
-
async function checkType(deps, agent,
|
|
166
|
-
/** The entries saved before; an online entry among them stays even when its service no longer offers it. */
|
|
167
|
-
previous) {
|
|
168
|
-
const wrongType = (key) => (deps.actionTypes?.(key) ?? AGENT_TYPES).includes(agent.type) === false;
|
|
169
|
-
const refused = agent.actions.filter(wrongType);
|
|
170
|
-
if (refused.length > 0)
|
|
171
|
-
throw invalid(`A ${agent.type} agent cannot be given ${refused.join(', ')}.`, { reason: 'ACTION_NOT_FOR_TYPE', actions: refused });
|
|
172
|
-
const entries = agent.modelEntries;
|
|
173
|
-
if (entries.length === 0 && agent.type === 'runner')
|
|
174
|
-
throw invalid('A runner agent needs at least one coding tool (modelEntries).');
|
|
175
|
-
if (entries.some((entry, index) => entries.slice(0, index).some((other) => sameEntry(entry, other))))
|
|
176
|
-
throw invalid('The same tool and model are listed twice.');
|
|
177
|
-
for (const entry of entries)
|
|
178
|
-
if (entry.effort &&
|
|
179
|
-
!effortsFor(entry).includes(entry.effort) &&
|
|
180
|
-
// An effort saved before its tool dropped it stays until someone changes it.
|
|
181
|
-
!previous.some((saved) => sameEntry(saved, entry) && saved.effort === entry.effort))
|
|
182
|
-
throw invalid(`${isRunnerEntry(entry) ? entry.tool : entry.modelService} takes no reasoning effort ${entry.effort}: use one of ${effortsFor(entry).join(', ')}.`, { reason: 'EFFORT_UNSUPPORTED' });
|
|
183
|
-
if (agent.type === 'runner') {
|
|
184
|
-
if (!entries.every(isRunnerEntry))
|
|
185
|
-
throw invalid('A runner agent works with coding tools: each entry names a tool, not a model service.');
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (!entries.every(isOnlineEntry))
|
|
189
|
-
throw invalid('An online agent has no coding tool: each entry names a model service and a model.');
|
|
190
|
-
if (agent.runnerIds.length > 0 || agent.toolPolicy !== null)
|
|
191
|
-
throw invalid('An online agent runs on the server: it takes no runners or tool policy.');
|
|
192
|
-
// An entry saved before its service changed stays until someone changes it; a new one must be offered now.
|
|
193
|
-
const added = entries.filter((entry) => !previous.some((saved) => sameEntry(saved, entry)));
|
|
194
|
-
if (added.length === 0)
|
|
195
|
-
return;
|
|
196
|
-
const catalog = await deps.models();
|
|
197
|
-
for (const entry of added)
|
|
198
|
-
if (!offers(catalog, entry.modelService, entry.model))
|
|
199
|
-
throw invalid(`The model service ${entry.modelService} does not offer the model ${entry.model}.`, { reason: 'MODEL_UNAVAILABLE' });
|
|
74
|
+
/** The tools and models a runner reports signed in, normalized, each once. */
|
|
75
|
+
export function reportedCombos(runner) {
|
|
76
|
+
const tools = [...new Set(runner.tools.map((tool) => tool.kind))];
|
|
77
|
+
return tools.flatMap((tool) => reportedModels(runner, tool).map((model) => ({ tool, model })));
|
|
200
78
|
}
|
|
201
79
|
export function createAgentService(deps) {
|
|
202
80
|
const { tx, ids, clock, people } = deps;
|
|
81
|
+
let defaults = () => NO_DEFAULTS;
|
|
203
82
|
const require = async (conn, id) => {
|
|
204
83
|
const agent = await findAgent(conn, id);
|
|
205
|
-
if (!agent)
|
|
84
|
+
if (!agent || (await isRemoved(conn, id)))
|
|
206
85
|
throw notFound('Agent');
|
|
207
86
|
return agent;
|
|
208
87
|
};
|
|
209
|
-
|
|
210
|
-
const revise = async (conn, agent, values) => {
|
|
211
|
-
if (!(await reviseAgent(conn, agent.id, agent.revision, values)))
|
|
212
|
-
throw revisionConflict((await require(conn, agent.id)).revision);
|
|
213
|
-
};
|
|
214
|
-
const removed = (unit, agent, reason, byUserId) => unit.emit({
|
|
88
|
+
const removed = (unit, agent, byUserId) => unit.emit({
|
|
215
89
|
type: 'agent.removed',
|
|
216
90
|
agentId: agent.id,
|
|
217
91
|
name: agent.name,
|
|
218
|
-
reason,
|
|
92
|
+
reason: 'disabled',
|
|
219
93
|
byUserId,
|
|
220
94
|
});
|
|
95
|
+
/** The defaults as stored: the instructions, and the actions each once. */
|
|
96
|
+
const currentDefaults = () => {
|
|
97
|
+
const value = defaults();
|
|
98
|
+
return {
|
|
99
|
+
instructions: value.instructions,
|
|
100
|
+
actions: cleanList(value.actions),
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
async function createRunnerAgent(unit, tool, model, now) {
|
|
104
|
+
const id = runnerAgentId(tool, model);
|
|
105
|
+
const { instructions, actions } = currentDefaults();
|
|
106
|
+
try {
|
|
107
|
+
// A savepoint: another runner's report creating the same agent at once leaves this transaction usable.
|
|
108
|
+
await unit.conn.transaction((conn) => insertAgent(conn, {
|
|
109
|
+
id,
|
|
110
|
+
name: agentNameOf(tool, model),
|
|
111
|
+
description: null,
|
|
112
|
+
nameText: null,
|
|
113
|
+
descriptionText: null,
|
|
114
|
+
avatar: null,
|
|
115
|
+
type: 'runner',
|
|
116
|
+
source: 'runner',
|
|
117
|
+
status: 'pending',
|
|
118
|
+
tool,
|
|
119
|
+
model,
|
|
120
|
+
modelEntries: [{ tool, model, effort: initialEffort(tool) }],
|
|
121
|
+
instructions,
|
|
122
|
+
runnerIds: [],
|
|
123
|
+
actions: [...actions],
|
|
124
|
+
confirmChanges: 'larger',
|
|
125
|
+
access: 'everyone',
|
|
126
|
+
ownerUserId: 'system',
|
|
127
|
+
maxConcurrentRuns: RUNNER_AGENT_CONCURRENCY,
|
|
128
|
+
maxAttempts: AGENT_ATTEMPTS,
|
|
129
|
+
toolPolicy: null,
|
|
130
|
+
lastReportedAt: now,
|
|
131
|
+
createdAt: now,
|
|
132
|
+
updatedAt: now,
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
if (await agentsRepo(unit.conn).findOne({ filter: { id } }))
|
|
137
|
+
return false;
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
await recordChange(unit.conn, {
|
|
141
|
+
id: ids.next(),
|
|
142
|
+
agentId: id,
|
|
143
|
+
revision: 1,
|
|
144
|
+
action: 'created',
|
|
145
|
+
actorUserId: null,
|
|
146
|
+
changes: [],
|
|
147
|
+
createdAt: now,
|
|
148
|
+
});
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
221
151
|
return {
|
|
222
|
-
|
|
152
|
+
setIgnored: (groups, ignored) => tx.run(async ({ conn, emit }) => {
|
|
153
|
+
const result = [];
|
|
154
|
+
const lockedGroups = [];
|
|
155
|
+
// Stable ordering avoids deadlocks between overlapping batches.
|
|
156
|
+
for (const group of [...groups].sort((a, b) => a.key.localeCompare(b.key))) {
|
|
157
|
+
lockedGroups.push(await lockDiscovery(conn, group.key, group.expectedRevision));
|
|
158
|
+
}
|
|
159
|
+
const agents = await listAgents(conn);
|
|
160
|
+
for (const group of lockedGroups) {
|
|
161
|
+
const members = agents.filter((agent) => agent.source === 'runner' &&
|
|
162
|
+
agent.tool &&
|
|
163
|
+
agent.model &&
|
|
164
|
+
discoveryKey(agent.tool, agent.model) === group.key);
|
|
165
|
+
if (!members.some((agent) => agent.status === 'pending') ||
|
|
166
|
+
members.some((agent) => agent.status === 'enabled'))
|
|
167
|
+
throw invalid('Only pending discovery groups can be ignored or restored. Reload the list.', { reason: 'DISCOVERY_NOT_PENDING' });
|
|
168
|
+
await preferences(conn).updateMany({
|
|
169
|
+
filter: { key: group.key },
|
|
170
|
+
values: { ignored },
|
|
171
|
+
});
|
|
172
|
+
for (const member of members)
|
|
173
|
+
emit({ type: 'agent.changed', agentId: member.id });
|
|
174
|
+
result.push({ ...group, ignored });
|
|
175
|
+
}
|
|
176
|
+
return result;
|
|
177
|
+
}),
|
|
178
|
+
list: () => listAgents(tx.read()),
|
|
223
179
|
get: (id) => require(tx.read(), id),
|
|
224
180
|
find: findAgent,
|
|
181
|
+
names: agentNamesOf,
|
|
182
|
+
directory: agentDirectory,
|
|
225
183
|
async findWorkable(conn, id) {
|
|
226
184
|
const agent = await findAgent(conn, id);
|
|
227
|
-
if (!agent || agent
|
|
185
|
+
if (!agent || !isWorkable(agent) || (await isRemoved(conn, id)))
|
|
228
186
|
return null;
|
|
229
187
|
return agent;
|
|
230
188
|
},
|
|
231
|
-
listActive
|
|
232
|
-
|
|
233
|
-
const type = input.type ?? 'runner';
|
|
234
|
-
await checkType(deps, {
|
|
235
|
-
type,
|
|
236
|
-
modelEntries: input.modelEntries ?? [],
|
|
237
|
-
runnerIds: input.runnerIds ?? [],
|
|
238
|
-
toolPolicy: input.toolPolicy ?? null,
|
|
239
|
-
skillIds: input.skillIds ?? [],
|
|
240
|
-
actions: input.actions ?? [],
|
|
241
|
-
}, []);
|
|
242
|
-
return tx.run(async ({ conn, emit }) => {
|
|
243
|
-
const now = clock.now().toISOString();
|
|
244
|
-
const id = ids.next();
|
|
245
|
-
await insertAgent(conn, {
|
|
246
|
-
id,
|
|
247
|
-
name: input.name,
|
|
248
|
-
description: input.description ?? null,
|
|
249
|
-
nameText: null,
|
|
250
|
-
descriptionText: input.descriptionText
|
|
251
|
-
? { ...input.descriptionText }
|
|
252
|
-
: null,
|
|
253
|
-
avatar: input.avatar ?? null,
|
|
254
|
-
type,
|
|
255
|
-
modelEntries: [...(input.modelEntries ?? [])],
|
|
256
|
-
instructions: input.instructions ?? null,
|
|
257
|
-
runnerIds: cleanList(input.runnerIds ?? []),
|
|
258
|
-
actions: cleanList(input.actions ?? []),
|
|
259
|
-
confirmChanges: input.confirmChanges ?? 'larger',
|
|
260
|
-
access: input.access ?? 'ownerOnly',
|
|
261
|
-
ownerUserId: input.ownerUserId ?? createdById,
|
|
262
|
-
maxConcurrentRuns: input.maxConcurrentRuns ?? 2,
|
|
263
|
-
maxAttempts: input.maxAttempts ?? 3,
|
|
264
|
-
toolPolicy: input.toolPolicy ?? null,
|
|
265
|
-
createdAt: now,
|
|
266
|
-
updatedAt: now,
|
|
267
|
-
});
|
|
268
|
-
await replaceUsers(conn, id, cleanList(input.userIds ?? []), () => ids.next(), now);
|
|
269
|
-
if (input.skillIds !== undefined)
|
|
270
|
-
await attachSkills(conn, id, input.skillIds, ids, now);
|
|
271
|
-
await recordChange(conn, {
|
|
272
|
-
id: ids.next(),
|
|
273
|
-
agentId: id,
|
|
274
|
-
revision: 1,
|
|
275
|
-
action: 'created',
|
|
276
|
-
actorUserId: createdById,
|
|
277
|
-
changes: [],
|
|
278
|
-
createdAt: now,
|
|
279
|
-
});
|
|
280
|
-
emit({ type: 'agent.changed', agentId: id });
|
|
281
|
-
return require(conn, id);
|
|
282
|
-
});
|
|
189
|
+
async listActive(conn) {
|
|
190
|
+
return (await listAgents(conn)).filter(isWorkable);
|
|
283
191
|
},
|
|
284
192
|
async update(id, byUserId, patch) {
|
|
285
193
|
const current = await require(tx.read(), id);
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
194
|
+
if (current.source !== 'runner')
|
|
195
|
+
throw invalid('This agent is kept by the application: change it in the application’s settings.', { reason: 'AGENT_MANAGED' });
|
|
196
|
+
const effort = patch.effort === undefined ? undefined : patch.effort;
|
|
197
|
+
const entry = current.modelEntries[0];
|
|
198
|
+
if (effort && entry && !effortsFor(entry).includes(effort))
|
|
199
|
+
throw invalid(`${entry.tool} takes no reasoning effort ${effort}: use one of ${effortsFor(entry).join(', ')}.`, { reason: 'EFFORT_UNSUPPORTED' });
|
|
200
|
+
const description = patch.description === undefined
|
|
201
|
+
? current.description
|
|
202
|
+
: patch.description?.trim()
|
|
203
|
+
? patch.description.trim()
|
|
204
|
+
: null;
|
|
205
|
+
const status = patch.enabled === undefined
|
|
206
|
+
? current.status
|
|
207
|
+
: patch.enabled
|
|
208
|
+
? 'enabled'
|
|
209
|
+
: current.status === 'pending'
|
|
210
|
+
? 'pending'
|
|
211
|
+
: 'disabled';
|
|
212
|
+
if (status === 'enabled' && !description)
|
|
213
|
+
throw invalid('Write what the agent is good at before enabling it: the project manager hands it work by this.', { reason: 'GOOD_AT_REQUIRED' });
|
|
296
214
|
try {
|
|
297
|
-
return await tx.run(async (
|
|
215
|
+
return await tx.run(async (unit) => {
|
|
216
|
+
const { conn, emit } = unit;
|
|
298
217
|
const before = await require(conn, id);
|
|
218
|
+
if (before.tool && before.model) {
|
|
219
|
+
const group = await lockDiscovery(conn, discoveryKey(before.tool, before.model));
|
|
220
|
+
if (patch.enabled && group.ignored)
|
|
221
|
+
throw invalid('Restore this discovery group before enabling it.', { reason: 'DISCOVERY_IGNORED' });
|
|
222
|
+
}
|
|
299
223
|
if (patch.expectedRevision !== before.revision)
|
|
300
224
|
throw revisionConflict(before.revision);
|
|
301
225
|
const now = clock.now().toISOString();
|
|
302
|
-
|
|
303
|
-
...
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
226
|
+
const modelEntries = effort === undefined
|
|
227
|
+
? [...before.modelEntries]
|
|
228
|
+
: before.modelEntries.map((item, index) => index === 0 ? { ...item, effort } : item);
|
|
229
|
+
if (!(await reviseAgent(conn, id, before.revision, {
|
|
230
|
+
description,
|
|
231
|
+
descriptionText: description === before.description && before.descriptionText
|
|
232
|
+
? {
|
|
233
|
+
key: before.descriptionText.key,
|
|
234
|
+
ns: before.descriptionText.ns,
|
|
235
|
+
}
|
|
236
|
+
: null,
|
|
237
|
+
status,
|
|
238
|
+
modelEntries: modelEntries.slice(0, MAX_MODEL_ENTRIES),
|
|
312
239
|
updatedAt: now,
|
|
313
|
-
})
|
|
314
|
-
|
|
315
|
-
await replaceUsers(conn, id, cleanList(patch.userIds), () => ids.next(), now);
|
|
316
|
-
if (patch.skillIds !== undefined)
|
|
317
|
-
await attachSkills(conn, id, patch.skillIds, ids, now);
|
|
240
|
+
})))
|
|
241
|
+
throw revisionConflict((await require(conn, id)).revision);
|
|
318
242
|
const after = await require(conn, id);
|
|
319
243
|
const changes = diffAgents(before, after);
|
|
320
244
|
if (changes.length === 0)
|
|
@@ -323,11 +247,19 @@ export function createAgentService(deps) {
|
|
|
323
247
|
id: ids.next(),
|
|
324
248
|
agentId: id,
|
|
325
249
|
revision: after.revision,
|
|
326
|
-
action:
|
|
250
|
+
action: before.status !== after.status
|
|
251
|
+
? after.status === 'enabled'
|
|
252
|
+
? 'enabled'
|
|
253
|
+
: 'disabled'
|
|
254
|
+
: 'updated',
|
|
327
255
|
actorUserId: byUserId,
|
|
328
256
|
changes,
|
|
329
257
|
createdAt: now,
|
|
330
258
|
});
|
|
259
|
+
if (before.status === 'enabled' && after.status !== 'enabled') {
|
|
260
|
+
await deps.owned?.withdrawQueued(unit, id, byUserId);
|
|
261
|
+
removed(unit, after, byUserId);
|
|
262
|
+
}
|
|
331
263
|
emit({ type: 'agent.changed', agentId: id });
|
|
332
264
|
return after;
|
|
333
265
|
});
|
|
@@ -338,59 +270,161 @@ export function createAgentService(deps) {
|
|
|
338
270
|
throw error;
|
|
339
271
|
}
|
|
340
272
|
},
|
|
341
|
-
|
|
342
|
-
const agent = await require(unit.conn, id);
|
|
343
|
-
if (agent.archivedAt)
|
|
344
|
-
return agent;
|
|
273
|
+
ensureSystem: (input, byUserId = null) => tx.run(async ({ conn, emit }) => {
|
|
345
274
|
const now = clock.now().toISOString();
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
275
|
+
const values = {
|
|
276
|
+
name: input.name,
|
|
277
|
+
nameText: input.nameText ? { ...input.nameText } : null,
|
|
278
|
+
description: input.description,
|
|
279
|
+
instructions: input.instructions,
|
|
280
|
+
actions: cleanList(input.actions),
|
|
281
|
+
modelEntries: input.modelEntries
|
|
282
|
+
.slice(0, MAX_MODEL_ENTRIES)
|
|
283
|
+
.map((entry) => ({ ...entry })),
|
|
284
|
+
};
|
|
285
|
+
const before = await findAgent(conn, input.id);
|
|
286
|
+
if (!before) {
|
|
287
|
+
await insertAgent(conn, {
|
|
288
|
+
id: input.id,
|
|
289
|
+
...values,
|
|
290
|
+
descriptionText: null,
|
|
291
|
+
avatar: null,
|
|
292
|
+
type: 'runner',
|
|
293
|
+
source: 'system',
|
|
294
|
+
status: 'enabled',
|
|
295
|
+
tool: null,
|
|
296
|
+
model: null,
|
|
297
|
+
runnerIds: [],
|
|
298
|
+
confirmChanges: 'larger',
|
|
299
|
+
access: 'everyone',
|
|
300
|
+
ownerUserId: 'system',
|
|
301
|
+
maxConcurrentRuns: RUNNER_AGENT_CONCURRENCY,
|
|
302
|
+
maxAttempts: AGENT_ATTEMPTS,
|
|
303
|
+
toolPolicy: null,
|
|
304
|
+
lastReportedAt: null,
|
|
305
|
+
createdAt: now,
|
|
306
|
+
updatedAt: now,
|
|
307
|
+
});
|
|
308
|
+
await recordChange(conn, {
|
|
309
|
+
id: ids.next(),
|
|
310
|
+
agentId: input.id,
|
|
311
|
+
revision: 1,
|
|
312
|
+
action: 'created',
|
|
313
|
+
actorUserId: byUserId,
|
|
314
|
+
changes: [],
|
|
315
|
+
createdAt: now,
|
|
316
|
+
});
|
|
317
|
+
emit({ type: 'agent.changed', agentId: input.id });
|
|
318
|
+
return (await findAgent(conn, input.id));
|
|
319
|
+
}
|
|
320
|
+
const unchanged = !(await isRemoved(conn, input.id)) &&
|
|
321
|
+
before.source === 'system' &&
|
|
322
|
+
before.status === 'enabled' &&
|
|
323
|
+
before.name === values.name &&
|
|
324
|
+
JSON.stringify(before.nameText) === JSON.stringify(values.nameText) &&
|
|
325
|
+
before.description === values.description &&
|
|
326
|
+
before.instructions === values.instructions &&
|
|
327
|
+
JSON.stringify(before.actions) === JSON.stringify(values.actions) &&
|
|
328
|
+
JSON.stringify(before.modelEntries) ===
|
|
329
|
+
JSON.stringify(values.modelEntries.map((entry) => ({
|
|
330
|
+
tool: entry.tool,
|
|
331
|
+
model: entry.model ?? null,
|
|
332
|
+
effort: entry.effort ?? null,
|
|
333
|
+
})));
|
|
334
|
+
if (unchanged)
|
|
335
|
+
return before;
|
|
336
|
+
await reviseAgent(conn, input.id, before.revision, {
|
|
337
|
+
...values,
|
|
338
|
+
source: 'system',
|
|
339
|
+
status: 'enabled',
|
|
340
|
+
archivedAt: null,
|
|
341
|
+
deletedAt: null,
|
|
342
|
+
updatedAt: now,
|
|
355
343
|
});
|
|
356
|
-
await
|
|
357
|
-
unit.emit({ type: 'agent.changed', agentId: id });
|
|
358
|
-
removed(unit, agent, 'archived', byUserId);
|
|
359
|
-
return require(unit.conn, id);
|
|
360
|
-
}),
|
|
361
|
-
restore: (id, byUserId) => tx.run(async ({ conn, emit }) => {
|
|
362
|
-
const agent = await require(conn, id);
|
|
363
|
-
if (!agent.archivedAt)
|
|
364
|
-
return agent;
|
|
365
|
-
const now = clock.now().toISOString();
|
|
366
|
-
await revise(conn, agent, { archivedAt: null, updatedAt: now });
|
|
344
|
+
const after = (await findAgent(conn, input.id));
|
|
367
345
|
await recordChange(conn, {
|
|
368
346
|
id: ids.next(),
|
|
369
|
-
agentId: id,
|
|
370
|
-
revision:
|
|
371
|
-
action: '
|
|
347
|
+
agentId: input.id,
|
|
348
|
+
revision: after.revision,
|
|
349
|
+
action: 'updated',
|
|
372
350
|
actorUserId: byUserId,
|
|
373
|
-
changes:
|
|
351
|
+
changes: diffAgents(before, after),
|
|
374
352
|
createdAt: now,
|
|
375
353
|
});
|
|
376
|
-
emit({ type: 'agent.changed', agentId: id });
|
|
377
|
-
return
|
|
354
|
+
emit({ type: 'agent.changed', agentId: input.id });
|
|
355
|
+
return after;
|
|
378
356
|
}),
|
|
379
|
-
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
357
|
+
async syncRunner(unit, runner) {
|
|
358
|
+
const combos = reportedCombos(runner);
|
|
359
|
+
if (combos.length === 0)
|
|
360
|
+
return;
|
|
361
|
+
const now = clock.now();
|
|
362
|
+
const nowText = now.toISOString();
|
|
363
|
+
const known = new Map((await agentsRepo(unit.conn).findMany({
|
|
364
|
+
filter: (f) => f.or(combos.map((combo) => f.string('id').eq(runnerAgentId(combo.tool, combo.model)))),
|
|
365
|
+
})).map((record) => [record.id, record]));
|
|
366
|
+
const created = [];
|
|
367
|
+
const stale = [];
|
|
368
|
+
for (const combo of combos) {
|
|
369
|
+
const id = runnerAgentId(combo.tool, combo.model);
|
|
370
|
+
const record = known.get(id);
|
|
371
|
+
if (!record) {
|
|
372
|
+
if (await createRunnerAgent(unit, combo.tool, combo.model, nowText))
|
|
373
|
+
created.push(id);
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
const generated = agentNameOf(combo.tool, combo.model);
|
|
377
|
+
if (record.status === 'pending' &&
|
|
378
|
+
record.name ===
|
|
379
|
+
`${{ claude: 'Claude', codex: 'Codex', pi: 'Pi', opencode: 'OpenCode' }[combo.tool]} · ${combo.model.split('/').at(-1)}` &&
|
|
380
|
+
record.name !== generated)
|
|
381
|
+
await updateAgent(unit.conn, id, { name: generated });
|
|
382
|
+
if (!record.lastReportedAt ||
|
|
383
|
+
now.getTime() - Date.parse(record.lastReportedAt) >= REPORT_REFRESH_MS)
|
|
384
|
+
stale.push(id);
|
|
385
|
+
}
|
|
386
|
+
if (stale.length > 0)
|
|
387
|
+
await agentsRepo(unit.conn).updateMany({
|
|
388
|
+
filter: (f) => f.or(stale.map((id) => f.string('id').eq(id))),
|
|
389
|
+
values: { lastReportedAt: nowText },
|
|
390
|
+
});
|
|
391
|
+
for (const id of created)
|
|
392
|
+
unit.emit({ type: 'agent.changed', agentId: id });
|
|
393
|
+
},
|
|
394
|
+
setDefaults(provider) {
|
|
395
|
+
defaults = provider;
|
|
396
|
+
return () => {
|
|
397
|
+
if (defaults === provider)
|
|
398
|
+
defaults = () => NO_DEFAULTS;
|
|
399
|
+
};
|
|
400
|
+
},
|
|
401
|
+
async applyDefaults(options = {}) {
|
|
402
|
+
const { instructions, actions } = currentDefaults();
|
|
403
|
+
return tx.run(async ({ conn, emit }) => {
|
|
404
|
+
const records = await agentsRepo(conn).findMany({
|
|
405
|
+
filter: (f) => f.and([
|
|
406
|
+
f.string('source').eq('runner'),
|
|
407
|
+
f.date('deletedAt').empty(),
|
|
408
|
+
]),
|
|
409
|
+
});
|
|
410
|
+
let changed = 0;
|
|
411
|
+
for (const record of records) {
|
|
412
|
+
const agent = (await findAgent(conn, record.id));
|
|
413
|
+
if ((options.preserveInstructions ||
|
|
414
|
+
agent.instructions === instructions) &&
|
|
415
|
+
JSON.stringify(agent.actions) === JSON.stringify(actions))
|
|
416
|
+
continue;
|
|
417
|
+
await updateAgent(conn, record.id, {
|
|
418
|
+
...(options.preserveInstructions ? {} : { instructions }),
|
|
419
|
+
actions: [...actions],
|
|
420
|
+
updatedAt: clock.now().toISOString(),
|
|
421
|
+
});
|
|
422
|
+
emit({ type: 'agent.changed', agentId: record.id });
|
|
423
|
+
changed += 1;
|
|
424
|
+
}
|
|
425
|
+
return changed;
|
|
388
426
|
});
|
|
389
|
-
|
|
390
|
-
await deleteAgent(conn, id);
|
|
391
|
-
unit.emit({ type: 'agent.changed', agentId: id });
|
|
392
|
-
removed(unit, agent, 'deleted', byUserId);
|
|
393
|
-
}),
|
|
427
|
+
},
|
|
394
428
|
async history(id, options = {}) {
|
|
395
429
|
const conn = tx.read();
|
|
396
430
|
await require(conn, id);
|
|
@@ -416,15 +450,7 @@ export function createAgentService(deps) {
|
|
|
416
450
|
createdAt: clock.now().toISOString(),
|
|
417
451
|
});
|
|
418
452
|
},
|
|
419
|
-
mayInvoke(agent
|
|
420
|
-
if (agent.archivedAt)
|
|
421
|
-
return false;
|
|
422
|
-
if (agent.ownerUserId === userId)
|
|
423
|
-
return true;
|
|
424
|
-
if (agent.access === 'everyone')
|
|
425
|
-
return true;
|
|
426
|
-
return agent.access === 'users' && agent.userIds.includes(userId);
|
|
427
|
-
},
|
|
453
|
+
mayInvoke: (agent) => isWorkable(agent),
|
|
428
454
|
};
|
|
429
455
|
}
|
|
430
456
|
//# sourceMappingURL=agent.service.js.map
|