@nocobase/app-plugin-agents 0.1.0-beta.1 → 0.1.0-beta.11
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 +398 -0
- package/README.md +129 -67
- package/dist/client/api/client.d.ts +25 -17
- package/dist/client/api/client.d.ts.map +1 -1
- package/dist/client/api/client.js +29 -27
- package/dist/client/api/client.js.map +1 -1
- package/dist/client/api/keys.d.ts +1 -1
- package/dist/client/api/keys.d.ts.map +1 -1
- package/dist/client/api/keys.js +1 -1
- package/dist/client/api/keys.js.map +1 -1
- package/dist/client/chat/api.d.ts +2 -7
- package/dist/client/chat/api.d.ts.map +1 -1
- package/dist/client/chat/api.js +0 -7
- package/dist/client/chat/api.js.map +1 -1
- 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/message-model.d.ts +4 -2
- package/dist/client/chat/message-model.d.ts.map +1 -1
- package/dist/client/chat/message-model.js +28 -3
- package/dist/client/chat/message-model.js.map +1 -1
- package/dist/client/chat/use-chat.d.ts +2 -10
- package/dist/client/chat/use-chat.d.ts.map +1 -1
- package/dist/client/chat/use-chat.js +3 -10
- package/dist/client/chat/use-chat.js.map +1 -1
- package/dist/client/chat.d.ts +4 -1
- package/dist/client/chat.d.ts.map +1 -1
- package/dist/client/chat.js +3 -0
- 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 +19 -39
- package/dist/client/components/agent-picker.js.map +1 -1
- package/dist/client/components/variables/variable-dialogs.d.ts +6 -1
- package/dist/client/components/variables/variable-dialogs.d.ts.map +1 -1
- package/dist/client/components/variables/variable-dialogs.js +27 -11
- package/dist/client/components/variables/variable-dialogs.js.map +1 -1
- package/dist/client/components/variables/variables-panel.d.ts.map +1 -1
- package/dist/client/components/variables/variables-panel.js +9 -2
- package/dist/client/components/variables/variables-panel.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 +3 -12
- package/dist/client/hooks/use-agent-picker-labels.js.map +1 -1
- package/dist/client/kit.d.ts +9 -12
- package/dist/client/kit.d.ts.map +1 -1
- package/dist/client/kit.js +12 -14
- package/dist/client/kit.js.map +1 -1
- package/dist/client/lib/agents.d.ts +5 -13
- package/dist/client/lib/agents.d.ts.map +1 -1
- package/dist/client/lib/agents.js +17 -32
- package/dist/client/lib/agents.js.map +1 -1
- package/dist/client/lib/install.js +1 -1
- package/dist/client/locales/chat.en-US.d.ts +9 -22
- package/dist/client/locales/chat.en-US.d.ts.map +1 -1
- package/dist/client/locales/chat.en-US.js +13 -25
- 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 +10 -22
- package/dist/client/locales/chat.zh-CN.js.map +1 -1
- package/dist/client/locales/en-US.d.ts +101 -219
- package/dist/client/locales/en-US.d.ts.map +1 -1
- package/dist/client/locales/en-US.js +106 -219
- package/dist/client/locales/en-US.js.map +1 -1
- package/dist/client/locales/runWait.en-US.d.ts +38 -0
- package/dist/client/locales/runWait.en-US.d.ts.map +1 -0
- package/dist/client/locales/runWait.en-US.js +37 -0
- package/dist/client/locales/runWait.en-US.js.map +1 -0
- package/dist/client/locales/runWait.zh-CN.d.ts +5 -0
- package/dist/client/locales/runWait.zh-CN.d.ts.map +1 -0
- package/dist/client/locales/runWait.zh-CN.js +32 -0
- package/dist/client/locales/runWait.zh-CN.js.map +1 -0
- package/dist/client/locales/runtimes.en-US.d.ts +54 -0
- package/dist/client/locales/runtimes.en-US.d.ts.map +1 -1
- package/dist/client/locales/runtimes.en-US.js +57 -3
- 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 +57 -3
- package/dist/client/locales/runtimes.zh-CN.js.map +1 -1
- package/dist/client/locales/skills.en-US.d.ts +1 -0
- package/dist/client/locales/skills.en-US.d.ts.map +1 -1
- package/dist/client/locales/skills.en-US.js +2 -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 +2 -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 +108 -221
- 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 +6 -100
- 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 +172 -0
- package/dist/client/pages/agents/runner-agents.js.map +1 -0
- package/dist/client/pages/runtimes/connect.js +1 -1
- 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 +3 -2
- package/dist/client/pages/runtimes/index.js.map +1 -1
- package/dist/client/pages/runtimes/runner-cells.d.ts +1 -1
- package/dist/client/pages/runtimes/runner-cells.d.ts.map +1 -1
- package/dist/client/pages/runtimes/runner-cells.js +4 -1
- package/dist/client/pages/runtimes/runner-cells.js.map +1 -1
- package/dist/client/pages/runtimes/runner-sheet.d.ts.map +1 -1
- package/dist/client/pages/runtimes/runner-sheet.js +12 -3
- package/dist/client/pages/runtimes/runner-sheet.js.map +1 -1
- package/dist/client/pages/runtimes/workspace-diagnostics.d.ts +9 -0
- package/dist/client/pages/runtimes/workspace-diagnostics.d.ts.map +1 -0
- package/dist/client/pages/runtimes/workspace-diagnostics.js +68 -0
- package/dist/client/pages/runtimes/workspace-diagnostics.js.map +1 -0
- package/dist/client/pages/skills/detail/index.d.ts.map +1 -1
- package/dist/client/pages/skills/detail/index.js +7 -10
- 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 +21 -0
- package/dist/client/runs/format-wait.d.ts.map +1 -0
- package/dist/client/runs/format-wait.js +90 -0
- package/dist/client/runs/format-wait.js.map +1 -0
- 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 +13 -7
- package/dist/client/runs/subject-runs.js.map +1 -1
- package/dist/client/runs.d.ts +3 -1
- package/dist/client/runs.d.ts.map +1 -1
- package/dist/client/runs.js +3 -1
- package/dist/client/runs.js.map +1 -1
- package/dist/database/migrations/.manifest.json +62 -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/202610090001_ag_add_team_runner_variables.d.ts +9 -0
- package/dist/database/migrations/202610090001_ag_add_team_runner_variables.d.ts.map +1 -0
- package/dist/database/migrations/202610090001_ag_add_team_runner_variables.js +28 -0
- package/dist/database/migrations/202610090001_ag_add_team_runner_variables.js.map +1 -0
- package/dist/database/migrations/202610090002_ag_create_run_requests.d.ts +10 -0
- package/dist/database/migrations/202610090002_ag_create_run_requests.d.ts.map +1 -0
- package/dist/database/migrations/202610090002_ag_create_run_requests.js +105 -0
- package/dist/database/migrations/202610090002_ag_create_run_requests.js.map +1 -0
- package/dist/database/migrations/202610090003_ag_add_execution_history.d.ts +4 -0
- package/dist/database/migrations/202610090003_ag_add_execution_history.d.ts.map +1 -0
- package/dist/database/migrations/202610090003_ag_add_execution_history.js +17 -0
- package/dist/database/migrations/202610090003_ag_add_execution_history.js.map +1 -0
- package/dist/database/migrations/202610090004_ag_add_runner_workspace_usage.d.ts +9 -0
- package/dist/database/migrations/202610090004_ag_add_runner_workspace_usage.d.ts.map +1 -0
- package/dist/database/migrations/202610090004_ag_add_runner_workspace_usage.js +22 -0
- package/dist/database/migrations/202610090004_ag_add_runner_workspace_usage.js.map +1 -0
- package/dist/database/migrations/202610090005_ag_add_runner_variables.d.ts +10 -0
- package/dist/database/migrations/202610090005_ag_add_runner_variables.d.ts.map +1 -0
- package/dist/database/migrations/202610090005_ag_add_runner_variables.js +36 -0
- package/dist/database/migrations/202610090005_ag_add_runner_variables.js.map +1 -0
- package/dist/database/migrations/202610100001_ag_index_run_event_types.d.ts +4 -0
- package/dist/database/migrations/202610100001_ag_index_run_event_types.d.ts.map +1 -0
- package/dist/database/migrations/202610100001_ag_index_run_event_types.js +17 -0
- package/dist/database/migrations/202610100001_ag_index_run_event_types.js.map +1 -0
- package/dist/database/migrations/202610100002_ag_add_run_git_credentials.d.ts +9 -0
- package/dist/database/migrations/202610100002_ag_add_run_git_credentials.d.ts.map +1 -0
- package/dist/database/migrations/202610100002_ag_add_run_git_credentials.js +30 -0
- package/dist/database/migrations/202610100002_ag_add_run_git_credentials.js.map +1 -0
- package/dist/database/migrations/202610110001_ag_add_fresh_sessions.d.ts +4 -0
- package/dist/database/migrations/202610110001_ag_add_fresh_sessions.d.ts.map +1 -0
- package/dist/database/migrations/202610110001_ag_add_fresh_sessions.js +23 -0
- package/dist/database/migrations/202610110001_ag_add_fresh_sessions.js.map +1 -0
- package/dist/database/migrations/202610120001_ag_index_run_retries.d.ts +4 -0
- package/dist/database/migrations/202610120001_ag_index_run_retries.d.ts.map +1 -0
- package/dist/database/migrations/202610120001_ag_index_run_retries.js +17 -0
- package/dist/database/migrations/202610120001_ag_index_run_retries.js.map +1 -0
- 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/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/package.json +8 -10
- package/dist/server/cli/run-credential.js +1 -1
- package/dist/server/composition.d.ts +41 -37
- package/dist/server/composition.d.ts.map +1 -1
- package/dist/server/composition.js +66 -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 +342 -317
- package/dist/server/core/agents/agent.service.js.map +1 -1
- package/dist/server/core/agents/agent.store.d.ts +24 -12
- package/dist/server/core/agents/agent.store.d.ts.map +1 -1
- package/dist/server/core/agents/agent.store.js +64 -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 +86 -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 +2 -1
- package/dist/server/core/agents/index.d.ts.map +1 -1
- package/dist/server/core/agents/index.js +2 -1
- package/dist/server/core/agents/index.js.map +1 -1
- package/dist/server/core/brief/brief.js +1 -1
- package/dist/server/core/brief/brief.js.map +1 -1
- package/dist/server/core/callers/index.d.ts +1 -1
- package/dist/server/core/conversations/availability.d.ts +11 -10
- package/dist/server/core/conversations/availability.d.ts.map +1 -1
- package/dist/server/core/conversations/availability.js +14 -32
- package/dist/server/core/conversations/availability.js.map +1 -1
- package/dist/server/core/conversations/chat-settings.d.ts.map +1 -1
- package/dist/server/core/conversations/chat-settings.js +5 -3
- package/dist/server/core/conversations/chat-settings.js.map +1 -1
- package/dist/server/core/conversations/conversation.service.d.ts +3 -5
- package/dist/server/core/conversations/conversation.service.d.ts.map +1 -1
- package/dist/server/core/conversations/conversation.service.js +161 -221
- package/dist/server/core/conversations/conversation.service.js.map +1 -1
- package/dist/server/core/conversations/ports.d.ts +3 -17
- package/dist/server/core/conversations/ports.d.ts.map +1 -1
- package/dist/server/core/reports/report.service.d.ts.map +1 -1
- package/dist/server/core/reports/report.service.js +5 -2
- package/dist/server/core/reports/report.service.js.map +1 -1
- package/dist/server/core/runs/availability.d.ts +18 -7
- package/dist/server/core/runs/availability.d.ts.map +1 -1
- package/dist/server/core/runs/availability.js +35 -24
- package/dist/server/core/runs/availability.js.map +1 -1
- package/dist/server/core/runs/claim.d.ts +47 -67
- package/dist/server/core/runs/claim.d.ts.map +1 -1
- package/dist/server/core/runs/claim.js +805 -313
- 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 +51 -0
- package/dist/server/core/runs/eligibility.d.ts.map +1 -0
- package/dist/server/core/runs/eligibility.js +44 -0
- package/dist/server/core/runs/eligibility.js.map +1 -0
- package/dist/server/core/runs/execution-view.d.ts +10 -0
- package/dist/server/core/runs/execution-view.d.ts.map +1 -0
- package/dist/server/core/runs/execution-view.js +25 -0
- package/dist/server/core/runs/execution-view.js.map +1 -0
- package/dist/server/core/runs/execution.d.ts +13 -0
- package/dist/server/core/runs/execution.d.ts.map +1 -0
- package/dist/server/core/runs/execution.js +85 -0
- package/dist/server/core/runs/execution.js.map +1 -0
- package/dist/server/core/runs/extensions.d.ts +59 -4
- package/dist/server/core/runs/extensions.d.ts.map +1 -1
- package/dist/server/core/runs/extensions.js +45 -9
- package/dist/server/core/runs/extensions.js.map +1 -1
- package/dist/server/core/runs/git-credentials.d.ts +43 -0
- package/dist/server/core/runs/git-credentials.d.ts.map +1 -0
- package/dist/server/core/runs/git-credentials.js +129 -0
- package/dist/server/core/runs/git-credentials.js.map +1 -0
- 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 +9 -5
- package/dist/server/core/runs/index.d.ts.map +1 -1
- package/dist/server/core/runs/index.js +9 -5
- package/dist/server/core/runs/index.js.map +1 -1
- package/dist/server/core/runs/input-gate.d.ts +34 -0
- package/dist/server/core/runs/input-gate.d.ts.map +1 -0
- package/dist/server/core/runs/input-gate.js +58 -0
- package/dist/server/core/runs/input-gate.js.map +1 -0
- package/dist/server/core/runs/lifecycle.d.ts +9 -19
- package/dist/server/core/runs/lifecycle.d.ts.map +1 -1
- package/dist/server/core/runs/lifecycle.js +98 -50
- package/dist/server/core/runs/lifecycle.js.map +1 -1
- package/dist/server/core/runs/policy.d.ts +8 -0
- package/dist/server/core/runs/policy.d.ts.map +1 -1
- package/dist/server/core/runs/policy.js +10 -0
- package/dist/server/core/runs/policy.js.map +1 -1
- package/dist/server/core/runs/ports.d.ts +91 -28
- 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 +3 -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 +245 -0
- package/dist/server/core/runs/run-requests.d.ts.map +1 -0
- package/dist/server/core/runs/run-requests.js +543 -0
- package/dist/server/core/runs/run-requests.js.map +1 -0
- package/dist/server/core/runs/run.service.d.ts +96 -11
- package/dist/server/core/runs/run.service.d.ts.map +1 -1
- package/dist/server/core/runs/run.service.js +921 -96
- package/dist/server/core/runs/run.service.js.map +1 -1
- package/dist/server/core/runs/run.store.d.ts +25 -3
- package/dist/server/core/runs/run.store.d.ts.map +1 -1
- package/dist/server/core/runs/run.store.js +52 -2
- package/dist/server/core/runs/run.store.js.map +1 -1
- package/dist/server/core/runs/runner-view.d.ts +6 -4
- package/dist/server/core/runs/runner-view.d.ts.map +1 -1
- package/dist/server/core/runs/runner-view.js +13 -11
- 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 +55 -10
- package/dist/server/core/runs/sweeper.js.map +1 -1
- package/dist/server/core/runs/transitions.d.ts +2 -2
- package/dist/server/core/runs/transitions.d.ts.map +1 -1
- package/dist/server/core/runs/transitions.js +80 -8
- package/dist/server/core/runs/transitions.js.map +1 -1
- package/dist/server/core/runs/workload.d.ts +3 -3
- package/dist/server/core/runs/workload.d.ts.map +1 -1
- package/dist/server/core/runs/workload.js +154 -45
- 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 +43 -58
- 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/variables/index.d.ts +1 -1
- package/dist/server/core/variables/index.d.ts.map +1 -1
- package/dist/server/core/variables/index.js +1 -1
- package/dist/server/core/variables/index.js.map +1 -1
- package/dist/server/core/variables/variable.service.d.ts +38 -6
- package/dist/server/core/variables/variable.service.d.ts.map +1 -1
- package/dist/server/core/variables/variable.service.js +201 -30
- package/dist/server/core/variables/variable.service.js.map +1 -1
- package/dist/server/distribution/dist.service.d.ts +27 -5
- package/dist/server/distribution/dist.service.d.ts.map +1 -1
- package/dist/server/distribution/dist.service.js +41 -5
- package/dist/server/distribution/dist.service.js.map +1 -1
- package/dist/server/distribution/download-tokens.d.ts +1 -1
- package/dist/server/distribution/download-tokens.d.ts.map +1 -1
- package/dist/server/distribution/download-tokens.js +7 -4
- package/dist/server/distribution/download-tokens.js.map +1 -1
- package/dist/server/distribution/index.d.ts +11 -3
- package/dist/server/distribution/index.d.ts.map +1 -1
- package/dist/server/distribution/index.js +31 -8
- package/dist/server/distribution/index.js.map +1 -1
- package/dist/server/jobs/index.d.ts +1 -1
- package/dist/server/jobs/index.d.ts.map +1 -1
- package/dist/server/jobs/index.js +1 -1
- package/dist/server/jobs/index.js.map +1 -1
- package/dist/server/jobs/job.service.d.ts +3 -1
- package/dist/server/jobs/job.service.d.ts.map +1 -1
- package/dist/server/jobs/job.service.js +11 -3
- package/dist/server/jobs/job.service.js.map +1 -1
- package/dist/server/jobs/spec.d.ts +4 -0
- package/dist/server/jobs/spec.d.ts.map +1 -1
- package/dist/server/jobs/spec.js +6 -0
- package/dist/server/jobs/spec.js.map +1 -1
- package/dist/server/kernel/errors.d.ts +1 -1
- package/dist/server/kernel/errors.d.ts.map +1 -1
- package/dist/server/kernel/errors.js +1 -0
- package/dist/server/kernel/errors.js.map +1 -1
- package/dist/server/kernel/events.d.ts +34 -9
- package/dist/server/kernel/events.d.ts.map +1 -1
- package/dist/server/kernel/events.js.map +1 -1
- package/dist/server/kernel/redaction.d.ts +2 -0
- package/dist/server/kernel/redaction.d.ts.map +1 -1
- package/dist/server/kernel/redaction.js +17 -0
- package/dist/server/kernel/redaction.js.map +1 -1
- 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/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/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/providers/agents.d.ts +8 -25
- package/dist/server/providers/agents.d.ts.map +1 -1
- package/dist/server/providers/agents.js +11 -75
- package/dist/server/providers/agents.js.map +1 -1
- package/dist/server/providers/runners.d.ts.map +1 -1
- package/dist/server/providers/runners.js +23 -0
- package/dist/server/providers/runners.js.map +1 -1
- package/dist/server/routes/admin.d.ts.map +1 -1
- package/dist/server/routes/admin.js +158 -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 +12 -70
- 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 +11 -1
- 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 -21
- package/dist/server/routes/roster.js.map +1 -1
- package/dist/server/routes/run-requests.d.ts +6 -0
- package/dist/server/routes/run-requests.d.ts.map +1 -0
- package/dist/server/routes/run-requests.js +216 -0
- package/dist/server/routes/run-requests.js.map +1 -0
- package/dist/server/routes/runners/admin.d.ts +9 -1
- package/dist/server/routes/runners/admin.d.ts.map +1 -1
- package/dist/server/routes/runners/admin.js +62 -24
- package/dist/server/routes/runners/admin.js.map +1 -1
- package/dist/server/routes/runners/dist.d.ts +5 -1
- package/dist/server/routes/runners/dist.d.ts.map +1 -1
- package/dist/server/routes/runners/dist.js +36 -9
- package/dist/server/routes/runners/dist.js.map +1 -1
- package/dist/server/routes/runners/install.d.ts.map +1 -1
- package/dist/server/routes/runners/install.js +98 -15
- 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 +27 -7
- package/dist/server/routes/runners/runner.js.map +1 -1
- package/dist/server/routes/runners/runs.d.ts +1 -1
- package/dist/server/routes/runners/runs.d.ts.map +1 -1
- package/dist/server/routes/runners/runs.js +23 -3
- package/dist/server/routes/runners/runs.js.map +1 -1
- package/dist/server/routes/schemas.d.ts +37 -8
- package/dist/server/routes/schemas.d.ts.map +1 -1
- package/dist/server/routes/schemas.js +381 -84
- package/dist/server/routes/schemas.js.map +1 -1
- package/dist/server/runners/index.d.ts +1 -0
- package/dist/server/runners/index.d.ts.map +1 -1
- package/dist/server/runners/index.js +1 -0
- package/dist/server/runners/index.js.map +1 -1
- package/dist/server/runners/runner.service.d.ts +32 -8
- package/dist/server/runners/runner.service.d.ts.map +1 -1
- package/dist/server/runners/runner.service.js +130 -14
- package/dist/server/runners/runner.service.js.map +1 -1
- package/dist/server/runners/runner.store.d.ts +10 -1
- package/dist/server/runners/runner.store.d.ts.map +1 -1
- package/dist/server/runners/runner.store.js +117 -4
- package/dist/server/runners/runner.store.js.map +1 -1
- package/dist/server/runners/sweeper.d.ts +5 -0
- package/dist/server/runners/sweeper.d.ts.map +1 -1
- package/dist/server/runners/sweeper.js +4 -2
- package/dist/server/runners/sweeper.js.map +1 -1
- package/dist/server/runners/workspaces.d.ts +33 -0
- package/dist/server/runners/workspaces.d.ts.map +1 -0
- package/dist/server/runners/workspaces.js +248 -0
- package/dist/server/runners/workspaces.js.map +1 -0
- 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 +13 -9
- package/dist/server/tokens.d.ts.map +1 -1
- package/dist/server/tokens.js +7 -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 +128 -167
- package/dist/shared/agents.d.ts.map +1 -1
- package/dist/shared/agents.js +46 -97
- package/dist/shared/agents.js.map +1 -1
- package/dist/shared/conversations.d.ts +43 -89
- package/dist/shared/conversations.d.ts.map +1 -1
- package/dist/shared/conversations.js +5 -24
- package/dist/shared/conversations.js.map +1 -1
- package/dist/shared/model-catalog.d.ts +48 -0
- package/dist/shared/model-catalog.d.ts.map +1 -0
- package/dist/shared/model-catalog.js +148 -0
- package/dist/shared/model-catalog.js.map +1 -0
- package/dist/shared/models.js +1 -1
- package/dist/shared/models.js.map +1 -1
- package/dist/shared/runners.d.ts +107 -17
- package/dist/shared/runners.d.ts.map +1 -1
- package/dist/shared/runners.js +49 -7
- package/dist/shared/runners.js.map +1 -1
- package/dist/shared/runs.d.ts +213 -1
- package/dist/shared/runs.d.ts.map +1 -1
- package/dist/shared/runs.js +24 -0
- package/dist/shared/runs.js.map +1 -1
- package/dist/shared/skills.d.ts +8 -4
- 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/variables.d.ts +22 -0
- package/dist/shared/variables.d.ts.map +1 -1
- package/dist/shared/variables.js +10 -2
- package/dist/shared/variables.js.map +1 -1
- package/package.json +24 -26
- package/skills/nocobase-app-plugin-agents/SKILL.md +8 -7
- package/skills/nocobase-app-plugin-agents/references/agents.md +30 -0
- package/skills/nocobase-app-plugin-agents/references/distribution.md +21 -4
- package/skills/nocobase-app-plugin-agents/references/extension-points.md +30 -20
- package/skills/nocobase-app-plugin-agents/references/model-services.md +17 -0
- package/skills/nocobase-app-plugin-agents/references/runners.md +15 -1
- package/skills/nocobase-app-plugin-agents/references/setup-and-config.md +4 -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 +33 -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 -76
- 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 -35
- package/dist/client/components/model-entries.d.ts.map +0 -1
- package/dist/client/components/model-entries.js +0 -82
- 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/tool-policy.d.ts +0 -5
- package/dist/client/lib/tool-policy.d.ts.map +0 -1
- package/dist/client/lib/tool-policy.js +0 -10
- 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 -73
- package/dist/client/pages/agents/agent-model.d.ts.map +0 -1
- package/dist/client/pages/agents/agent-model.js +0 -172
- 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 -22
- package/dist/client/pages/agents/detail/sections.d.ts.map +0 -1
- package/dist/client/pages/agents/detail/sections.js +0 -311
- 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 -195
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../server/routes/admin.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAW,IAAI,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../server/routes/admin.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAW,IAAI,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAI7D,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA8GhD,mGAAmG;AACnG,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClE,oEAAoE;IACpE,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,KAAK,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IACxC,sFAAsF;IACtF,QAAQ,CAAC,GAAG,CAAC,EAAE;QACb,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,GAAG,IAAI,CAAC;CACV;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,CAAC;CACpC;AAyCD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,iBAAiB,CAAC,QAAQ,CAAC,EAClC,MAAM,GAAE,iBAAiB,CAAC,QAAQ,CAAS,GAC1C,IAAI,CAAC,QAAQ,CAAC,CA4wDhB"}
|
|
@@ -29,20 +29,18 @@
|
|
|
29
29
|
import { apiErrorResponse, apiErrorResponses, apiValidator, cliRoute, dataResponse, describeRoute, emptyResponse, listResponse, } from '@nocobase/app-server/router';
|
|
30
30
|
import { bodyLimit } from 'hono/body-limit';
|
|
31
31
|
import { z } from 'zod';
|
|
32
|
-
import { policyAllowsAgent } from '@nocobase/agent-protocol';
|
|
33
32
|
import { reaches, } from '../../shared/access.js';
|
|
34
|
-
import { offersEntry } from '../../shared/models.js';
|
|
35
33
|
import { SKILL_UPLOAD_MAX_BYTES } from '../../shared/skills.js';
|
|
36
34
|
import { CONVERSATION_SUBJECT } from '../../shared/conversations.js';
|
|
37
|
-
import {
|
|
35
|
+
import { AgentPatchSchema, agentViews } from '../core/agents/index.js';
|
|
38
36
|
import { ModelPricesSchema } from '../core/reports/index.js';
|
|
39
|
-
import {
|
|
37
|
+
import { runForViewer } from '../core/runs/index.js';
|
|
40
38
|
import { SkillIdsSchema, SkillImportSchema, SkillInputSchema, SkillSaveSchema, } from '../core/skills/index.js';
|
|
41
39
|
import { forbidden, invalid, notFound } from '../kernel/errors.js';
|
|
42
40
|
import { decodePageToken, domainRouter, encodePageToken, } from '../kernel/http.js';
|
|
43
41
|
import { WORKDIR_TITLE } from '../kernel/scopes.js';
|
|
44
42
|
import { tags } from './openapi.js';
|
|
45
|
-
import { AgentActionOptionSchema, AgentChangeSchema, AgentHistoryQuery,
|
|
43
|
+
import { AgentActionOptionSchema, AgentChangeSchema, AgentHistoryQuery, AgentParams, AgentNameSchema, AgentSchema, AgentViewSchema, BriefPreviewSchema, ModelUsageReportSchema, PageTokenMetaSchema, PricesSchema, RunBriefSchema, RunDetailSchema, RunEventItemSchema, RunSchema, SeqPageMetaSchema, SkillArchiveQuery, SkillAttachmentsSchema, SkillDetailSchema, SkillFileQuery, SkillUploadSchema, SkillSchema, SkillVersionDetailSchema, SkillVersionSchema, SkillViewSchema, UsageReportSchema, UserRefSchema, VariableAuditSchema, VariableSchema, VariableValueSchema, VocabularySchema, AuditListQuery, ModelUsageQuery, PreviewBriefQuery, RunEventsQuery, RunListQuery, RunParams, ScopeParams, SkillParams, SkillRestoreInput, SkillVersionParams, UsageQuerySchema, VariableParams, VariableValueInput, WorkspaceParams, } from './schemas.js';
|
|
46
44
|
/** A multipart body of one file, as `file`. */
|
|
47
45
|
const skillUploadBody = {
|
|
48
46
|
required: true,
|
|
@@ -129,41 +127,6 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
129
127
|
const isPrivate = (run) => services.subjects.get(run.subject.kind)?.private === true;
|
|
130
128
|
const nameOf = async (userId) => (await services.people.names(services.tx.read(), [userId])).get(userId) ??
|
|
131
129
|
userId;
|
|
132
|
-
/** The agents with what the list shows about their runs and runners, and whether the caller may change each. */
|
|
133
|
-
const summarize = async (who, agents) => {
|
|
134
|
-
const conn = services.tx.read();
|
|
135
|
-
const online = await services.runners.online(conn);
|
|
136
|
-
const owners = await services.people.names(conn, agents.map((agent) => agent.ownerUserId));
|
|
137
|
-
const catalog = await services.online.gateway.catalog();
|
|
138
|
-
const result = [];
|
|
139
|
-
for (const agent of agents)
|
|
140
|
-
result.push({
|
|
141
|
-
...agent,
|
|
142
|
-
ownerName: owners.get(agent.ownerUserId) ?? null,
|
|
143
|
-
activeRuns: await countActive(conn, 'agentId', agent.id),
|
|
144
|
-
// An online agent runs here: "online" while the service of its first entry offers its model.
|
|
145
|
-
onlineRunners: agent.type === 'online'
|
|
146
|
-
? Number(offersEntry(catalog, onlineEntryOf(agent, undefined, catalog.defaultModel ?? null)))
|
|
147
|
-
: online.filter((runner) => hasTool(runner, agent) &&
|
|
148
|
-
policyAllowsAgent(runner.policy, agent) &&
|
|
149
|
-
(agent.runnerIds.length === 0 ||
|
|
150
|
-
agent.runnerIds.includes(runner.id))).length,
|
|
151
|
-
canEdit: await mayEdit(who, agent.ownerUserId),
|
|
152
|
-
canCopy: services.agents.mayInvoke(agent, who.userId),
|
|
153
|
-
});
|
|
154
|
-
return result;
|
|
155
|
-
};
|
|
156
|
-
/** Only a caller who may change the agent of the path goes on: 404 when they may not read it, 403 when not change it. */
|
|
157
|
-
const editableAgent = async (context, next) => {
|
|
158
|
-
const who = caller(context);
|
|
159
|
-
const agent = await services.agents.get(context.req.param('agentId') ?? '');
|
|
160
|
-
if (!(await mayEdit(who, agent.ownerUserId))) {
|
|
161
|
-
if (!(await who.can('agents.agents', 'read')))
|
|
162
|
-
throw notFound('Agent');
|
|
163
|
-
throw forbidden('Only its owner (with the related level of agents.agents edit) or a manager of agents may change this agent.');
|
|
164
|
-
}
|
|
165
|
-
await next();
|
|
166
|
-
};
|
|
167
130
|
/** Only a caller who may edit the skill of the path goes on: 404 when they may not read it, 403 when not edit it. */
|
|
168
131
|
const editableSkill = async (context, next) => {
|
|
169
132
|
const who = caller(context);
|
|
@@ -185,12 +148,20 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
185
148
|
const allowed = services.scopes
|
|
186
149
|
.keys()
|
|
187
150
|
.filter((key) => withAgent || key !== 'agent');
|
|
151
|
+
const who = caller(context);
|
|
152
|
+
if (!withAgent && scope === 'global') {
|
|
153
|
+
if (scopeId !== 'default')
|
|
154
|
+
throw notFound('Scope');
|
|
155
|
+
const manage = await who.can('agents.agents', 'manage');
|
|
156
|
+
if (!manage && !(await who.can('agents.agents', 'read')))
|
|
157
|
+
throw notFound('Scope');
|
|
158
|
+
return { scope, scopeId, manage };
|
|
159
|
+
}
|
|
188
160
|
if (!allowed.includes(scope) || !scopeId)
|
|
189
161
|
throw notFound('Scope');
|
|
190
|
-
const who = caller(context);
|
|
191
162
|
if (scope === 'agent') {
|
|
192
|
-
|
|
193
|
-
const manage = await
|
|
163
|
+
await services.agents.get(scopeId);
|
|
164
|
+
const manage = await who.can('agents.agents', 'manage');
|
|
194
165
|
if (!manage && !(await who.can('agents.agents', 'read')))
|
|
195
166
|
throw notFound('Agent');
|
|
196
167
|
return { scope: 'agent', scopeId, manage };
|
|
@@ -279,6 +250,64 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
279
250
|
const data = await services.people.list(services.tx.read());
|
|
280
251
|
return context.json({ data, meta: { total: data.length } });
|
|
281
252
|
});
|
|
253
|
+
router.put('/discoveryPreferences', scoped, can('agents.agents', 'manage'), describeRoute({
|
|
254
|
+
tags,
|
|
255
|
+
summary: 'Ignore or restore discovery groups',
|
|
256
|
+
operationId: 'agentsSetDiscoveryPreferences',
|
|
257
|
+
...cliRoute({ command: 'agent discovery set', bodyFile: 'input' }),
|
|
258
|
+
description: 'Shared administrator preferences. Only pending groups can be changed. Batches are atomic and checked against each group revision. Reports do not reset preferences.',
|
|
259
|
+
responses: {
|
|
260
|
+
200: listResponse(z.object({
|
|
261
|
+
key: z.string(),
|
|
262
|
+
ignored: z.boolean(),
|
|
263
|
+
revision: z.number().int(),
|
|
264
|
+
})),
|
|
265
|
+
400: apiErrorResponse(400, 'The group contains a non-pending agent.'),
|
|
266
|
+
409: apiErrorResponse(409, 'The discovery group changed.'),
|
|
267
|
+
...apiErrorResponses,
|
|
268
|
+
},
|
|
269
|
+
}), apiValidator('json', z.strictObject({
|
|
270
|
+
groups: z
|
|
271
|
+
.array(z.strictObject({
|
|
272
|
+
key: z
|
|
273
|
+
.string()
|
|
274
|
+
.min(1)
|
|
275
|
+
.max(256)
|
|
276
|
+
.meta({ description: 'The discoveryKey from the agent list.' }),
|
|
277
|
+
expectedRevision: z.number().int().min(0).meta({
|
|
278
|
+
description: 'The discoveryRevision from the agent list.',
|
|
279
|
+
}),
|
|
280
|
+
}))
|
|
281
|
+
.min(1)
|
|
282
|
+
.max(256)
|
|
283
|
+
.refine((groups) => new Set(groups.map((group) => group.key)).size === groups.length, 'Groups must be unique.')
|
|
284
|
+
.meta({
|
|
285
|
+
description: 'Unique pending discovery groups to update atomically.',
|
|
286
|
+
}),
|
|
287
|
+
ignored: z.boolean().meta({
|
|
288
|
+
description: 'True to ignore pending discoveries; false to restore them without enabling.',
|
|
289
|
+
}),
|
|
290
|
+
})), async (context) => {
|
|
291
|
+
const { groups, ignored } = context.req.valid('json');
|
|
292
|
+
const data = await services.agents.setIgnored(groups, ignored);
|
|
293
|
+
return context.json({ data, meta: { total: data.length } });
|
|
294
|
+
});
|
|
295
|
+
// Every agent's name, removed ones and the application's own included, for the runs that name them.
|
|
296
|
+
router.get('/agentNames', guard, describeRoute({
|
|
297
|
+
tags,
|
|
298
|
+
summary: 'List the names of agents',
|
|
299
|
+
operationId: 'agentsListAgentNames',
|
|
300
|
+
// UI-only: the names runs show.
|
|
301
|
+
...cliRoute(false),
|
|
302
|
+
description: 'Every agent there has been, removed ones and the application’s own included, by id and name: what the runs that name them show.',
|
|
303
|
+
responses: {
|
|
304
|
+
200: listResponse(AgentNameSchema),
|
|
305
|
+
...apiErrorResponses,
|
|
306
|
+
},
|
|
307
|
+
}), async (context) => {
|
|
308
|
+
const data = await services.agents.directory(services.tx.read());
|
|
309
|
+
return context.json({ data, meta: { total: data.length } });
|
|
310
|
+
});
|
|
282
311
|
// Variables of an agent, a working directory, or a scope the application registers.
|
|
283
312
|
const scopedRouter = router;
|
|
284
313
|
const variableParam = apiValidator('param', VariableParams);
|
|
@@ -401,12 +430,20 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
401
430
|
contentFile: true,
|
|
402
431
|
description: 'The value; stored encrypted and never shown again. Asked for when left out.',
|
|
403
432
|
},
|
|
433
|
+
teamRunnersOnly: {
|
|
434
|
+
description: 'Only team runners receive it; personal runners leave a run that gets it.',
|
|
435
|
+
},
|
|
436
|
+
fromRunner: {
|
|
437
|
+
description: 'Take it from the runner: no value here; the runner that takes the run provides it (`nocobase-runner env set NAME`).',
|
|
438
|
+
},
|
|
404
439
|
},
|
|
405
440
|
examples: [
|
|
406
441
|
'variable set agent <agent> NPM_TOKEN --value-file token.txt',
|
|
442
|
+
'variable set agent <agent> DEPLOY_KEY --value-file key.txt --team-runners-only',
|
|
443
|
+
'variable set agent <agent> OPENAI_API_KEY --from-runner',
|
|
407
444
|
],
|
|
408
445
|
}),
|
|
409
|
-
description: `Creates or replaces the variable; the value is encrypted at rest and never answered. Needs the right to change the scope. ${scopeAccess}`,
|
|
446
|
+
description: `Creates or replaces the variable; the value is encrypted at rest and never answered. A run's variables go to the runner that takes it, a personal runner of anyone who may use the agent included, unless one is marked \`teamRunnersOnly\`: then only a team runner takes the run. Leave \`value\` out to change only \`teamRunnersOnly\` of an existing variable. With \`fromRunner\` the variable is a name only: the runner that takes the run provides its value from its own configuration (\`nocobase-runner env set NAME\` or \`--pass-env NAME\`), and a runner that does not fails the run before the agent starts. Needs the right to change the scope. ${scopeAccess}`,
|
|
410
447
|
responses: {
|
|
411
448
|
200: dataResponse(VariableSchema.nullable()),
|
|
412
449
|
404: noScope,
|
|
@@ -415,7 +452,15 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
415
452
|
}), variableParam, apiValidator('json', VariableValueInput), async (context) => {
|
|
416
453
|
const target = context.get('target');
|
|
417
454
|
const { variableName } = context.req.valid('param');
|
|
418
|
-
|
|
455
|
+
const body = context.req.valid('json');
|
|
456
|
+
await services.variables.set(target, variableName, body.value, caller(context).userId, {
|
|
457
|
+
...(body.teamRunnersOnly === undefined
|
|
458
|
+
? {}
|
|
459
|
+
: { teamRunnersOnly: body.teamRunnersOnly }),
|
|
460
|
+
...(body.fromRunner === undefined
|
|
461
|
+
? {}
|
|
462
|
+
: { fromRunner: body.fromRunner }),
|
|
463
|
+
});
|
|
419
464
|
const variable = (await services.variables.list(target)).find((item) => item.name === variableName);
|
|
420
465
|
return context.json({ data: variable ?? null });
|
|
421
466
|
});
|
|
@@ -466,7 +511,7 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
466
511
|
operationId: 'agentsListSkills',
|
|
467
512
|
...cliRoute({
|
|
468
513
|
command: 'skill list',
|
|
469
|
-
columns: ['id', 'name', 'version', '
|
|
514
|
+
columns: ['id', 'name', 'version', 'updatedAt'],
|
|
470
515
|
}),
|
|
471
516
|
description: 'The skill library. Needs `agents.agents` read.',
|
|
472
517
|
responses: { 200: listResponse(SkillSchema), ...apiErrorResponses },
|
|
@@ -798,15 +843,15 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
798
843
|
flags: {
|
|
799
844
|
scopeKind: {
|
|
800
845
|
name: 'kind',
|
|
801
|
-
description: 'The scope kind: `
|
|
846
|
+
description: 'The scope kind: `global`, `workdir`, or one the application registers.',
|
|
802
847
|
},
|
|
803
848
|
scopeId: {
|
|
804
849
|
name: 'scope',
|
|
805
|
-
description: 'The scope:
|
|
850
|
+
description: 'The scope: `default` for global, a working directory id, or the id the application gives.',
|
|
806
851
|
},
|
|
807
852
|
},
|
|
808
853
|
}),
|
|
809
|
-
description:
|
|
854
|
+
description: 'The skills every run gets: global default, then application scopes, then working directories; later scopes override the same slug. Global reads require agents.agents read or manage.',
|
|
810
855
|
responses: {
|
|
811
856
|
200: dataResponse(SkillAttachmentsSchema),
|
|
812
857
|
404: noScope,
|
|
@@ -826,19 +871,21 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
826
871
|
flags: {
|
|
827
872
|
scopeKind: {
|
|
828
873
|
name: 'kind',
|
|
829
|
-
description: 'The scope kind: `
|
|
874
|
+
description: 'The scope kind: `global`, `workdir`, or one the application registers.',
|
|
830
875
|
},
|
|
831
876
|
scopeId: {
|
|
832
877
|
name: 'scope',
|
|
833
|
-
description: 'The scope:
|
|
878
|
+
description: 'The scope: `default` for global, a working directory id, or the id the application gives.',
|
|
834
879
|
},
|
|
835
880
|
skillIds: { name: 'skills' },
|
|
836
881
|
},
|
|
837
882
|
examples: [
|
|
883
|
+
'skill attachment set global default --skills <skill>,<skill>',
|
|
884
|
+
'skill attachment set global default --file empty-skills.json',
|
|
838
885
|
'skill attachment set workdir <workdir> --skills <skill>,<skill>',
|
|
839
886
|
],
|
|
840
887
|
}),
|
|
841
|
-
description: 'Makes `skillIds` the skills attached to the scope.
|
|
888
|
+
description: 'Makes `skillIds` the skills attached to the scope. Global accepts only default and requires agents.agents manage; other scopes need the right to change that scope. An empty skillIds array clears attachments. Agent attachments are refused.',
|
|
842
889
|
responses: {
|
|
843
890
|
200: dataResponse(SkillAttachmentsSchema),
|
|
844
891
|
400: apiErrorResponse(400, 'A skill id is unknown (`INVALID_ARGUMENT`).'),
|
|
@@ -854,6 +901,17 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
854
901
|
const runParam = apiValidator('param', RunParams);
|
|
855
902
|
const noRun = notFoundAs('The run');
|
|
856
903
|
const runVisibility = "The caller sees the runs they started or own, and every run but a private subject's (a conversation) with `agents.agents` read.";
|
|
904
|
+
const machineViewer = async (context) => {
|
|
905
|
+
const who = caller(context);
|
|
906
|
+
const manage = await who.can('agents.runners', 'manage');
|
|
907
|
+
const see = manage ||
|
|
908
|
+
(await who.can('agents.runners', 'read')) ||
|
|
909
|
+
(await who.can('agents.agents', 'read'));
|
|
910
|
+
const uses = see &&
|
|
911
|
+
!manage &&
|
|
912
|
+
(await services.agents.list()).some((agent) => services.agents.mayInvoke(agent, who.userId));
|
|
913
|
+
return { userId: who.userId, seesMachines: manage || uses };
|
|
914
|
+
};
|
|
857
915
|
/** Only a caller who may see the run of the path (or, with `manage`, act on it) goes on. */
|
|
858
916
|
const runAccess = (action) => async (context, next) => {
|
|
859
917
|
await visibleRun(context, action);
|
|
@@ -902,8 +960,11 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
902
960
|
});
|
|
903
961
|
const page = runs.slice(0, query.pageSize);
|
|
904
962
|
const last = page.at(-1);
|
|
963
|
+
const viewer = await machineViewer(context);
|
|
905
964
|
return context.json({
|
|
906
|
-
data: page
|
|
965
|
+
data: page
|
|
966
|
+
.filter((run) => involves(run, who.userId) || !isPrivate(run))
|
|
967
|
+
.map((run) => runForViewer(run, viewer)),
|
|
907
968
|
meta: runs.length > query.pageSize && last
|
|
908
969
|
? {
|
|
909
970
|
nextPageToken: encodePageToken({
|
|
@@ -930,7 +991,7 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
930
991
|
...apiErrorResponses,
|
|
931
992
|
},
|
|
932
993
|
}), runParam, async (context) => context.json({
|
|
933
|
-
data: await services.runs.detail(context.req.valid('param').runId),
|
|
994
|
+
data: runForViewer(await services.runs.detail(context.req.valid('param').runId), await machineViewer(context)),
|
|
934
995
|
}));
|
|
935
996
|
router.get('/runs/:runId/brief', guard, runAccess('read'), describeRoute({
|
|
936
997
|
tags,
|
|
@@ -960,18 +1021,18 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
960
1021
|
flags: { runId: { name: 'run' }, pageSize: { name: 'limit' } },
|
|
961
1022
|
columns: ['seq', 'at', 'type', 'tool'],
|
|
962
1023
|
}),
|
|
963
|
-
description: `The run's transcript as JSON pages, in order: a page holds the events after \`after\` (a \`seq\`), up to \`pageSize\`. Not a stream: to follow a run, ask again with \`after\` set to \`meta.lastSeq\`, when the run's realtime topic announces a change. ${runVisibility}`,
|
|
1024
|
+
description: `The run's transcript as JSON pages, in order: a page holds the events after \`after\` (a \`seq\`), up to \`pageSize\`. Repeat \`type\` to filter raw event types before paging; omit it for all events. Keep the same types while paging. Not a stream: to follow a run, ask again with \`after\` set to \`meta.lastSeq\`, when the run's realtime topic announces a change. ${runVisibility}`,
|
|
964
1025
|
responses: {
|
|
965
1026
|
200: listResponse(RunEventItemSchema, SeqPageMetaSchema),
|
|
966
1027
|
404: noRun,
|
|
967
1028
|
...apiErrorResponses,
|
|
968
1029
|
},
|
|
969
1030
|
}), runParam, apiValidator('query', RunEventsQuery), async (context) => {
|
|
970
|
-
const { after, pageSize, pageToken } = context.req.valid('query');
|
|
1031
|
+
const { after, pageSize, pageToken, type } = context.req.valid('query');
|
|
971
1032
|
const from = pageToken === undefined
|
|
972
1033
|
? (after ?? 0)
|
|
973
1034
|
: decodePageToken(pageToken, z.number().int().min(0));
|
|
974
|
-
const page = await services.runs.events(context.req.valid('param').runId, from, pageSize);
|
|
1035
|
+
const page = await services.runs.events(context.req.valid('param').runId, from, pageSize, type);
|
|
975
1036
|
return context.json({
|
|
976
1037
|
data: page.events,
|
|
977
1038
|
meta: {
|
|
@@ -1000,7 +1061,7 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
1000
1061
|
...apiErrorResponses,
|
|
1001
1062
|
},
|
|
1002
1063
|
}), runParam, async (context) => context.json({
|
|
1003
|
-
data: await services.runs.cancel(context.req.valid('param').runId, caller(context).userId),
|
|
1064
|
+
data: runForViewer(await services.runs.cancel(context.req.valid('param').runId, caller(context).userId), await machineViewer(context)),
|
|
1004
1065
|
}));
|
|
1005
1066
|
router.post('/runs/:runId/retry', guard, runAccess('manage'), describeRoute({
|
|
1006
1067
|
tags,
|
|
@@ -1011,15 +1072,20 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
1011
1072
|
args: ['runId'],
|
|
1012
1073
|
flags: { runId: { name: 'run' } },
|
|
1013
1074
|
}),
|
|
1014
|
-
description: 'Queues a new run with the same input. Whoever started or owns it, or a manager of agents, may.',
|
|
1075
|
+
description: 'Queues a new run with the same input once. Whoever started or owns it, or a manager of agents, may. Repeating a retry returns RUN_ALREADY_RETRIED (FAILED_PRECONDITION) with the replacement run id.',
|
|
1015
1076
|
responses: {
|
|
1016
1077
|
200: dataResponse(RunSchema),
|
|
1017
|
-
400: apiErrorResponse(400, 'The run cannot be retried (`RUN_NOT_RETRYABLE`).'),
|
|
1078
|
+
400: apiErrorResponse(400, 'The run cannot be retried (`RUN_NOT_RETRYABLE`) or has already been retried (`RUN_ALREADY_RETRIED`).'),
|
|
1018
1079
|
404: noRun,
|
|
1019
1080
|
...apiErrorResponses,
|
|
1020
1081
|
},
|
|
1021
1082
|
}), runParam, async (context) => context.json({
|
|
1022
|
-
data: await services.runs.retry(context.req.valid('param').runId, caller(context).userId
|
|
1083
|
+
data: runForViewer(await services.runs.retry(context.req.valid('param').runId, caller(context).userId,
|
|
1084
|
+
// Display attribution trusts the client header. Other HTTP callers,
|
|
1085
|
+
// including API-key scripts, are runRecord; api is for service callers.
|
|
1086
|
+
context.req.header('x-nocobase-client') === 'cli'
|
|
1087
|
+
? 'cli'
|
|
1088
|
+
: 'runRecord'), await machineViewer(context)),
|
|
1023
1089
|
}));
|
|
1024
1090
|
// What runs used and cost, behind the usage page's grant.
|
|
1025
1091
|
const usagePage = async (context, next) => {
|
|
@@ -1145,65 +1211,28 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
1145
1211
|
// Agents, last: `/:agentId` would otherwise shadow the fixed segments above.
|
|
1146
1212
|
const agentParam = apiValidator('param', AgentParams);
|
|
1147
1213
|
const noAgent = notFoundAs('The agent');
|
|
1148
|
-
|
|
1149
|
-
router.get('/', scoped, can('agents.agents', 'read'), describeRoute({
|
|
1214
|
+
router.get('/', guard, describeRoute({
|
|
1150
1215
|
tags,
|
|
1151
1216
|
summary: 'List agents',
|
|
1152
1217
|
operationId: 'agentsListAgents',
|
|
1153
1218
|
...cliRoute({
|
|
1154
1219
|
command: 'agent list-all',
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
'id',
|
|
1158
|
-
'name',
|
|
1159
|
-
'type',
|
|
1160
|
-
'ownerName',
|
|
1161
|
-
'activeRuns',
|
|
1162
|
-
'archivedAt',
|
|
1163
|
-
],
|
|
1164
|
-
examples: ['agent list-all --archived'],
|
|
1220
|
+
columns: ['id', 'name', 'status', 'unusable', 'busy', 'description'],
|
|
1221
|
+
examples: ['agent list-all', 'agent list-all --json'],
|
|
1165
1222
|
}),
|
|
1166
|
-
description: '
|
|
1223
|
+
description: 'Every agent discovered from runners: one for each coding tool and model they report, with whether it is enabled, what it is good at, where it can run now (team and personal runners, the caller’s own among them), why it cannot take the caller’s work, and whether the caller may change it. Anyone signed in may read them; only a manager of agents (`agents.agents` manage) changes them.',
|
|
1167
1224
|
responses: {
|
|
1168
|
-
200: listResponse(
|
|
1225
|
+
200: listResponse(AgentViewSchema),
|
|
1169
1226
|
...apiErrorResponses,
|
|
1170
1227
|
},
|
|
1171
|
-
}),
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1174
|
-
|
|
1228
|
+
}), async (context) => {
|
|
1229
|
+
const who = caller(context);
|
|
1230
|
+
const data = await services.views(services.tx.read(), who.userId, {
|
|
1231
|
+
canEdit: await who.can('agents.agents', 'manage'),
|
|
1232
|
+
});
|
|
1175
1233
|
return context.json({ data, meta: { total: data.length } });
|
|
1176
1234
|
});
|
|
1177
|
-
router.
|
|
1178
|
-
tags,
|
|
1179
|
-
summary: 'Create an agent',
|
|
1180
|
-
operationId: 'agentsCreateAgent',
|
|
1181
|
-
...cliRoute({
|
|
1182
|
-
command: 'agent create',
|
|
1183
|
-
bodyFile: 'file',
|
|
1184
|
-
flags: {
|
|
1185
|
-
instructions: { contentFile: true },
|
|
1186
|
-
modelEntries: { name: 'models' },
|
|
1187
|
-
ownerUserId: { name: 'owner' },
|
|
1188
|
-
runnerIds: { name: 'runtimes' },
|
|
1189
|
-
skillIds: { name: 'skills' },
|
|
1190
|
-
userIds: { name: 'users' },
|
|
1191
|
-
},
|
|
1192
|
-
examples: [
|
|
1193
|
-
'agent create --name Coder --models \'[{"tool":"claude"},{"tool":"codex","model":"gpt-5"}]\'',
|
|
1194
|
-
'agent create --name PM --type online --models \'[{"modelService":"openai","model":"gpt-5"}]\'',
|
|
1195
|
-
'agent create --file agent.json',
|
|
1196
|
-
],
|
|
1197
|
-
}),
|
|
1198
|
-
description: '`modelEntries` lists the tools and models it works with, in order (the first is its default): `{ tool, model? }` for a runner agent, `{ modelService, model }` for an online one. Needs `agents.agents` manage.',
|
|
1199
|
-
responses: {
|
|
1200
|
-
201: dataResponse(AgentSchema, 'Created.'),
|
|
1201
|
-
...apiErrorResponses,
|
|
1202
|
-
},
|
|
1203
|
-
}), apiValidator('json', AgentInputSchema), async (context) => context.json({
|
|
1204
|
-
data: await services.agents.create(caller(context).userId, context.req.valid('json')),
|
|
1205
|
-
}, 201));
|
|
1206
|
-
router.get('/:agentId', scoped, can('agents.agents', 'read'), describeRoute({
|
|
1235
|
+
router.get('/:agentId', guard, describeRoute({
|
|
1207
1236
|
tags,
|
|
1208
1237
|
summary: 'Get an agent',
|
|
1209
1238
|
operationId: 'agentsGetAgent',
|
|
@@ -1212,17 +1241,22 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
1212
1241
|
args: ['agentId'],
|
|
1213
1242
|
flags: { agentId: { name: 'agent' } },
|
|
1214
1243
|
}),
|
|
1215
|
-
description: '
|
|
1244
|
+
description: 'An agent as the Agent page shows it. An application’s own agent, such as a project manager, is answered too.',
|
|
1216
1245
|
responses: {
|
|
1217
|
-
200: dataResponse(
|
|
1246
|
+
200: dataResponse(AgentViewSchema),
|
|
1218
1247
|
404: noAgent,
|
|
1219
1248
|
...apiErrorResponses,
|
|
1220
1249
|
},
|
|
1221
1250
|
}), agentParam, async (context) => {
|
|
1222
|
-
const
|
|
1223
|
-
|
|
1224
|
-
])
|
|
1225
|
-
|
|
1251
|
+
const who = caller(context);
|
|
1252
|
+
const agent = await services.agents.get(context.req.valid('param').agentId);
|
|
1253
|
+
const [data] = await agentViews(services.tx.read(), [agent], {
|
|
1254
|
+
availability: services.availability,
|
|
1255
|
+
userId: who.userId,
|
|
1256
|
+
canEdit: await who.can('agents.agents', 'manage'),
|
|
1257
|
+
now: services.clock.now(),
|
|
1258
|
+
});
|
|
1259
|
+
return context.json({ data });
|
|
1226
1260
|
});
|
|
1227
1261
|
router.get('/:agentId/history', guard, can('agents.agents', 'read'), describeRoute({
|
|
1228
1262
|
tags,
|
|
@@ -1268,117 +1302,32 @@ export function createAdminRoutes(services, guard, scoped = guard) {
|
|
|
1268
1302
|
: {},
|
|
1269
1303
|
});
|
|
1270
1304
|
});
|
|
1271
|
-
router.patch('/:agentId', scoped,
|
|
1305
|
+
router.patch('/:agentId', scoped, can('agents.agents', 'manage'), describeRoute({
|
|
1272
1306
|
tags,
|
|
1273
1307
|
summary: 'Update an agent',
|
|
1274
1308
|
operationId: 'agentsUpdateAgent',
|
|
1275
1309
|
...cliRoute({
|
|
1276
1310
|
command: 'agent update',
|
|
1277
1311
|
args: ['agentId'],
|
|
1278
|
-
bodyFile: 'file',
|
|
1279
1312
|
flags: {
|
|
1280
1313
|
agentId: { name: 'agent' },
|
|
1281
|
-
|
|
1282
|
-
modelEntries: { name: 'models' },
|
|
1283
|
-
ownerUserId: { name: 'owner' },
|
|
1284
|
-
runnerIds: { name: 'runtimes' },
|
|
1285
|
-
skillIds: { name: 'skills' },
|
|
1286
|
-
userIds: { name: 'users' },
|
|
1287
|
-
expectedRevision: { name: 'revision' },
|
|
1314
|
+
description: { name: 'good-at', contentFile: true },
|
|
1288
1315
|
},
|
|
1289
1316
|
examples: [
|
|
1290
|
-
'agent update <agent> --
|
|
1291
|
-
'agent update <agent> --
|
|
1317
|
+
'agent update <agent> --good-at "Code review" --enabled --expected-revision 2',
|
|
1318
|
+
'agent update <agent> --no-enabled --expected-revision 3',
|
|
1292
1319
|
],
|
|
1293
1320
|
}),
|
|
1294
|
-
description:
|
|
1295
|
-
responses: {
|
|
1296
|
-
200: dataResponse(AgentSchema),
|
|
1297
|
-
404: noAgent,
|
|
1298
|
-
409: revisionConflict('agent'),
|
|
1299
|
-
...apiErrorResponses,
|
|
1300
|
-
},
|
|
1301
|
-
}), agentParam, apiValidator('json', AgentPatchSchema), async (context) => {
|
|
1302
|
-
const who = caller(context);
|
|
1303
|
-
const agent = await services.agents.get(context.req.valid('param').agentId);
|
|
1304
|
-
const patch = context.req.valid('json');
|
|
1305
|
-
if (!(await who.can('agents.agents', 'manage'))) {
|
|
1306
|
-
// Someone editing as the owner gives the agent only what they may grant themselves.
|
|
1307
|
-
if (patch.ownerUserId !== undefined &&
|
|
1308
|
-
patch.ownerUserId !== agent.ownerUserId)
|
|
1309
|
-
throw forbidden('Only a manager of agents may give an agent to another owner.');
|
|
1310
|
-
if (patch.actions !== undefined) {
|
|
1311
|
-
const held = await services.gate.allowed({
|
|
1312
|
-
kind: 'user',
|
|
1313
|
-
userId: who.userId,
|
|
1314
|
-
displayName: who.userId,
|
|
1315
|
-
});
|
|
1316
|
-
const beyond = patch.actions.filter((action) => !agent.actions.includes(action) && !held.has(action));
|
|
1317
|
-
if (beyond.length > 0)
|
|
1318
|
-
throw forbidden(`You may not give the agent business actions you do not hold yourself: ${beyond.join(', ')}.`);
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
return context.json({
|
|
1322
|
-
data: await services.agents.update(agent.id, who.userId, patch),
|
|
1323
|
-
});
|
|
1324
|
-
});
|
|
1325
|
-
router.delete('/:agentId', scoped, editableAgent, describeRoute({
|
|
1326
|
-
tags,
|
|
1327
|
-
summary: 'Delete an agent',
|
|
1328
|
-
operationId: 'agentsDeleteAgent',
|
|
1329
|
-
...cliRoute({
|
|
1330
|
-
command: 'agent delete',
|
|
1331
|
-
args: ['agentId'],
|
|
1332
|
-
flags: { agentId: { name: 'agent' } },
|
|
1333
|
-
confirm: 'Delete this archived agent with its variables and history?',
|
|
1334
|
-
}),
|
|
1335
|
-
description: `Deletes an archived agent with no open runs, with its variables, skill attachments and history; its past runs stay. ${editAccess}`,
|
|
1336
|
-
responses: {
|
|
1337
|
-
204: emptyResponse(),
|
|
1338
|
-
400: apiErrorResponse(400, 'The agent is not archived, or has open runs (`AGENT_NOT_ARCHIVED`, `AGENT_HAS_ACTIVE_RUNS`).'),
|
|
1339
|
-
404: noAgent,
|
|
1340
|
-
...apiErrorResponses,
|
|
1341
|
-
},
|
|
1342
|
-
}), agentParam, async (context) => {
|
|
1343
|
-
await services.agents.remove(context.req.valid('param').agentId, caller(context).userId);
|
|
1344
|
-
return context.body(null, 204);
|
|
1345
|
-
});
|
|
1346
|
-
router.post('/:agentId/archive', scoped, editableAgent, describeRoute({
|
|
1347
|
-
tags,
|
|
1348
|
-
summary: 'Archive an agent',
|
|
1349
|
-
operationId: 'agentsArchiveAgent',
|
|
1350
|
-
...cliRoute({
|
|
1351
|
-
command: 'agent archive',
|
|
1352
|
-
args: ['agentId'],
|
|
1353
|
-
flags: { agentId: { name: 'agent' } },
|
|
1354
|
-
confirm: 'Archive this agent? Its queued runs are withdrawn.',
|
|
1355
|
-
}),
|
|
1356
|
-
description: `An archived agent is not run: its queued runs are withdrawn. ${editAccess}`,
|
|
1357
|
-
responses: {
|
|
1358
|
-
200: dataResponse(AgentSchema),
|
|
1359
|
-
404: noAgent,
|
|
1360
|
-
...apiErrorResponses,
|
|
1361
|
-
},
|
|
1362
|
-
}), agentParam, async (context) => context.json({
|
|
1363
|
-
data: await services.agents.archive(context.req.valid('param').agentId, caller(context).userId),
|
|
1364
|
-
}));
|
|
1365
|
-
router.post('/:agentId/restore', scoped, editableAgent, describeRoute({
|
|
1366
|
-
tags,
|
|
1367
|
-
summary: 'Restore an archived agent',
|
|
1368
|
-
operationId: 'agentsRestoreAgent',
|
|
1369
|
-
...cliRoute({
|
|
1370
|
-
command: 'agent restore',
|
|
1371
|
-
args: ['agentId'],
|
|
1372
|
-
flags: { agentId: { name: 'agent' } },
|
|
1373
|
-
}),
|
|
1374
|
-
description: editAccess,
|
|
1321
|
+
description: "Writes what an agent discovered from runners is good at, its default reasoning effort, and enables or disables it, against the revision the edit was made from. An agent is enabled only with a description. Disabling withdraws its queued runs. An application's own agent is changed through the application. Needs `agents.agents` manage.",
|
|
1375
1322
|
responses: {
|
|
1376
1323
|
200: dataResponse(AgentSchema),
|
|
1324
|
+
400: apiErrorResponse(400, 'Enabling without a description (`GOOD_AT_REQUIRED`), an effort its tool does not take (`EFFORT_UNSUPPORTED`), or an application’s own agent (`AGENT_MANAGED`).'),
|
|
1377
1325
|
404: noAgent,
|
|
1326
|
+
409: apiErrorResponse(409, 'Someone changed the agent since the revision named (`REVISION_CONFLICT`, `metadata.revision`).'),
|
|
1378
1327
|
...apiErrorResponses,
|
|
1379
1328
|
},
|
|
1380
|
-
}), agentParam, async (context) => context.json({
|
|
1381
|
-
data: await services.agents.
|
|
1329
|
+
}), agentParam, apiValidator('json', AgentPatchSchema), async (context) => context.json({
|
|
1330
|
+
data: await services.agents.update(context.req.valid('param').agentId, caller(context).userId, context.req.valid('json')),
|
|
1382
1331
|
}));
|
|
1383
1332
|
router.get('/:agentId/previewBrief', guard, can('agents.agents', 'read'), describeRoute({
|
|
1384
1333
|
tags,
|