@nocobase/app-plugin-agents 0.0.0-stage → 0.1.0-beta.2
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 +153 -0
- package/README.md +200 -2
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +9 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/runner-token.d.ts +21 -0
- package/dist/cli/runner-token.d.ts.map +1 -0
- package/dist/cli/runner-token.js +52 -0
- package/dist/cli/runner-token.js.map +1 -0
- package/dist/client/api/client.d.ts +136 -0
- package/dist/client/api/client.d.ts.map +1 -0
- package/dist/client/api/client.js +284 -0
- package/dist/client/api/client.js.map +1 -0
- package/dist/client/api/keys.d.ts +31 -0
- package/dist/client/api/keys.d.ts.map +1 -0
- package/dist/client/api/keys.js +40 -0
- package/dist/client/api/keys.js.map +1 -0
- package/dist/client/api/runners.d.ts +24 -0
- package/dist/client/api/runners.d.ts.map +1 -0
- package/dist/client/api/runners.js +58 -0
- package/dist/client/api/runners.js.map +1 -0
- package/dist/client/chat/api.d.ts +42 -0
- package/dist/client/chat/api.d.ts.map +1 -0
- package/dist/client/chat/api.js +125 -0
- package/dist/client/chat/api.js.map +1 -0
- package/dist/client/chat/context-model.d.ts +67 -0
- package/dist/client/chat/context-model.d.ts.map +1 -0
- package/dist/client/chat/context-model.js +113 -0
- package/dist/client/chat/context-model.js.map +1 -0
- package/dist/client/chat/extensions.d.ts +41 -0
- package/dist/client/chat/extensions.d.ts.map +1 -0
- package/dist/client/chat/extensions.js +14 -0
- package/dist/client/chat/extensions.js.map +1 -0
- package/dist/client/chat/keys.d.ts +13 -0
- package/dist/client/chat/keys.d.ts.map +1 -0
- package/dist/client/chat/keys.js +12 -0
- package/dist/client/chat/keys.js.map +1 -0
- package/dist/client/chat/message-model.d.ts +111 -0
- package/dist/client/chat/message-model.d.ts.map +1 -0
- package/dist/client/chat/message-model.js +213 -0
- package/dist/client/chat/message-model.js.map +1 -0
- package/dist/client/chat/panel-state.d.ts +43 -0
- package/dist/client/chat/panel-state.d.ts.map +1 -0
- package/dist/client/chat/panel-state.js +113 -0
- package/dist/client/chat/panel-state.js.map +1 -0
- package/dist/client/chat/provider.d.ts +101 -0
- package/dist/client/chat/provider.d.ts.map +1 -0
- package/dist/client/chat/provider.js +399 -0
- package/dist/client/chat/provider.js.map +1 -0
- package/dist/client/chat/redirect.d.ts +8 -0
- package/dist/client/chat/redirect.d.ts.map +1 -0
- package/dist/client/chat/redirect.js +34 -0
- package/dist/client/chat/redirect.js.map +1 -0
- package/dist/client/chat/settings-section.d.ts +5 -0
- package/dist/client/chat/settings-section.d.ts.map +1 -0
- package/dist/client/chat/settings-section.js +86 -0
- package/dist/client/chat/settings-section.js.map +1 -0
- package/dist/client/chat/ui-hooks.d.ts +16 -0
- package/dist/client/chat/ui-hooks.d.ts.map +1 -0
- package/dist/client/chat/ui-hooks.js +35 -0
- package/dist/client/chat/ui-hooks.js.map +1 -0
- package/dist/client/chat/use-chat.d.ts +88 -0
- package/dist/client/chat/use-chat.d.ts.map +1 -0
- package/dist/client/chat/use-chat.js +399 -0
- package/dist/client/chat/use-chat.js.map +1 -0
- package/dist/client/chat.d.ts +41 -0
- package/dist/client/chat.d.ts.map +1 -0
- package/dist/client/chat.js +43 -0
- package/dist/client/chat.js.map +1 -0
- package/dist/client/components/ag-markdown.d.ts +7 -0
- package/dist/client/components/ag-markdown.d.ts.map +1 -0
- package/dist/client/components/ag-markdown.js +29 -0
- package/dist/client/components/ag-markdown.js.map +1 -0
- package/dist/client/components/ag-multi-select.d.ts +26 -0
- package/dist/client/components/ag-multi-select.d.ts.map +1 -0
- package/dist/client/components/ag-multi-select.js +48 -0
- package/dist/client/components/ag-multi-select.js.map +1 -0
- package/dist/client/components/ag-pulse.d.ts +4 -0
- package/dist/client/components/ag-pulse.d.ts.map +1 -0
- package/dist/client/components/ag-pulse.js +6 -0
- package/dist/client/components/ag-pulse.js.map +1 -0
- package/dist/client/components/ag-section.d.ts +11 -0
- package/dist/client/components/ag-section.d.ts.map +1 -0
- package/dist/client/components/ag-section.js +7 -0
- package/dist/client/components/ag-section.js.map +1 -0
- package/dist/client/components/ag-states.d.ts +27 -0
- package/dist/client/components/ag-states.d.ts.map +1 -0
- package/dist/client/components/ag-states.js +33 -0
- package/dist/client/components/ag-states.js.map +1 -0
- package/dist/client/components/ag-tag.d.ts +9 -0
- package/dist/client/components/ag-tag.d.ts.map +1 -0
- package/dist/client/components/ag-tag.js +20 -0
- package/dist/client/components/ag-tag.js.map +1 -0
- package/dist/client/components/agent-avatar.d.ts +16 -0
- package/dist/client/components/agent-avatar.d.ts.map +1 -0
- package/dist/client/components/agent-avatar.js +48 -0
- package/dist/client/components/agent-avatar.js.map +1 -0
- package/dist/client/components/agent-fields.d.ts +45 -0
- package/dist/client/components/agent-fields.d.ts.map +1 -0
- package/dist/client/components/agent-fields.js +83 -0
- package/dist/client/components/agent-fields.js.map +1 -0
- package/dist/client/components/agent-picker.d.ts +128 -0
- package/dist/client/components/agent-picker.d.ts.map +1 -0
- package/dist/client/components/agent-picker.js +150 -0
- package/dist/client/components/agent-picker.js.map +1 -0
- package/dist/client/components/agent-type.d.ts +32 -0
- package/dist/client/components/agent-type.d.ts.map +1 -0
- package/dist/client/components/agent-type.js +80 -0
- package/dist/client/components/agent-type.js.map +1 -0
- package/dist/client/components/availability-dot.d.ts +8 -0
- package/dist/client/components/availability-dot.d.ts.map +1 -0
- package/dist/client/components/availability-dot.js +15 -0
- package/dist/client/components/availability-dot.js.map +1 -0
- package/dist/client/components/brief-view.d.ts +6 -0
- package/dist/client/components/brief-view.d.ts.map +1 -0
- package/dist/client/components/brief-view.js +34 -0
- package/dist/client/components/brief-view.js.map +1 -0
- package/dist/client/components/command-line.d.ts +6 -0
- package/dist/client/components/command-line.d.ts.map +1 -0
- package/dist/client/components/command-line.js +24 -0
- package/dist/client/components/command-line.js.map +1 -0
- package/dist/client/components/default-skills.d.ts +10 -0
- package/dist/client/components/default-skills.d.ts.map +1 -0
- package/dist/client/components/default-skills.js +47 -0
- package/dist/client/components/default-skills.js.map +1 -0
- package/dist/client/components/diff-block.d.ts +8 -0
- package/dist/client/components/diff-block.d.ts.map +1 -0
- package/dist/client/components/diff-block.js +14 -0
- package/dist/client/components/diff-block.js.map +1 -0
- package/dist/client/components/model-entries.d.ts +35 -0
- package/dist/client/components/model-entries.d.ts.map +1 -0
- package/dist/client/components/model-entries.js +82 -0
- package/dist/client/components/model-entries.js.map +1 -0
- package/dist/client/components/page-container.d.ts +11 -0
- package/dist/client/components/page-container.d.ts.map +1 -0
- package/dist/client/components/page-container.js +13 -0
- package/dist/client/components/page-container.js.map +1 -0
- package/dist/client/components/page-header.d.ts +14 -0
- package/dist/client/components/page-header.d.ts.map +1 -0
- package/dist/client/components/page-header.js +10 -0
- package/dist/client/components/page-header.js.map +1 -0
- package/dist/client/components/refresh-button.d.ts +6 -0
- package/dist/client/components/refresh-button.d.ts.map +1 -0
- package/dist/client/components/refresh-button.js +26 -0
- package/dist/client/components/refresh-button.js.map +1 -0
- package/dist/client/components/route-child-page.d.ts +24 -0
- package/dist/client/components/route-child-page.d.ts.map +1 -0
- package/dist/client/components/route-child-page.js +46 -0
- package/dist/client/components/route-child-page.js.map +1 -0
- package/dist/client/components/route-dialog.d.ts +6 -0
- package/dist/client/components/route-dialog.d.ts.map +1 -0
- package/dist/client/components/route-dialog.js +7 -0
- package/dist/client/components/route-dialog.js.map +1 -0
- package/dist/client/components/route-overlay.d.ts +21 -0
- package/dist/client/components/route-overlay.d.ts.map +1 -0
- package/dist/client/components/route-overlay.js +87 -0
- package/dist/client/components/route-overlay.js.map +1 -0
- package/dist/client/components/runners-refresh.d.ts +3 -0
- package/dist/client/components/runners-refresh.d.ts.map +1 -0
- package/dist/client/components/runners-refresh.js +13 -0
- package/dist/client/components/runners-refresh.js.map +1 -0
- package/dist/client/components/secret-input.d.ts +7 -0
- package/dist/client/components/secret-input.d.ts.map +1 -0
- package/dist/client/components/secret-input.js +12 -0
- package/dist/client/components/secret-input.js.map +1 -0
- package/dist/client/components/skills-select.d.ts +16 -0
- package/dist/client/components/skills-select.d.ts.map +1 -0
- package/dist/client/components/skills-select.js +39 -0
- package/dist/client/components/skills-select.js.map +1 -0
- package/dist/client/components/ui/alert-dialog.d.ts +19 -0
- package/dist/client/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/client/components/ui/alert-dialog.js +42 -0
- package/dist/client/components/ui/alert-dialog.js.map +1 -0
- package/dist/client/components/ui/alert.d.ts +13 -0
- package/dist/client/components/ui/alert.d.ts.map +1 -0
- package/dist/client/components/ui/alert.js +31 -0
- package/dist/client/components/ui/alert.js.map +1 -0
- package/dist/client/components/ui/avatar.d.ts +12 -0
- package/dist/client/components/ui/avatar.d.ts.map +1 -0
- package/dist/client/components/ui/avatar.js +23 -0
- package/dist/client/components/ui/avatar.js.map +1 -0
- package/dist/client/components/ui/badge.d.ts +11 -0
- package/dist/client/components/ui/badge.d.ts.map +1 -0
- package/dist/client/components/ui/badge.js +37 -0
- package/dist/client/components/ui/badge.js.map +1 -0
- package/dist/client/components/ui/button.d.ts +12 -0
- package/dist/client/components/ui/button.d.ts.map +1 -0
- package/dist/client/components/ui/button.js +38 -0
- package/dist/client/components/ui/button.js.map +1 -0
- package/dist/client/components/ui/calendar.d.ts +11 -0
- package/dist/client/components/ui/calendar.d.ts.map +1 -0
- package/dist/client/components/ui/calendar.js +76 -0
- package/dist/client/components/ui/calendar.js.map +1 -0
- package/dist/client/components/ui/card.d.ts +12 -0
- package/dist/client/components/ui/card.d.ts.map +1 -0
- package/dist/client/components/ui/card.js +25 -0
- package/dist/client/components/ui/card.js.map +1 -0
- package/dist/client/components/ui/chart.d.ts +45 -0
- package/dist/client/components/ui/chart.d.ts.map +1 -0
- package/dist/client/components/ui/chart.js +133 -0
- package/dist/client/components/ui/chart.js.map +1 -0
- package/dist/client/components/ui/checkbox.d.ts +5 -0
- package/dist/client/components/ui/checkbox.d.ts.map +1 -0
- package/dist/client/components/ui/checkbox.js +9 -0
- package/dist/client/components/ui/checkbox.js.map +1 -0
- package/dist/client/components/ui/collapsible.d.ts +7 -0
- package/dist/client/components/ui/collapsible.d.ts.map +1 -0
- package/dist/client/components/ui/collapsible.js +13 -0
- package/dist/client/components/ui/collapsible.js.map +1 -0
- package/dist/client/components/ui/combobox.d.ts +25 -0
- package/dist/client/components/ui/combobox.d.ts.map +1 -0
- package/dist/client/components/ui/combobox.js +58 -0
- package/dist/client/components/ui/combobox.js.map +1 -0
- package/dist/client/components/ui/dialog.d.ts +18 -0
- package/dist/client/components/ui/dialog.d.ts.map +1 -0
- package/dist/client/components/ui/dialog.js +40 -0
- package/dist/client/components/ui/dialog.js.map +1 -0
- package/dist/client/components/ui/dropdown-menu.d.ts +30 -0
- package/dist/client/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/client/components/ui/dropdown-menu.js +51 -0
- package/dist/client/components/ui/dropdown-menu.js.map +1 -0
- package/dist/client/components/ui/empty.d.ts +15 -0
- package/dist/client/components/ui/empty.d.ts.map +1 -0
- package/dist/client/components/ui/empty.js +37 -0
- package/dist/client/components/ui/empty.js.map +1 -0
- package/dist/client/components/ui/field.d.ts +28 -0
- package/dist/client/components/ui/field.d.ts.map +1 -0
- package/dist/client/components/ui/field.js +71 -0
- package/dist/client/components/ui/field.js.map +1 -0
- package/dist/client/components/ui/input-group.d.ts +22 -0
- package/dist/client/components/ui/input-group.d.ts.map +1 -0
- package/dist/client/components/ui/input-group.js +63 -0
- package/dist/client/components/ui/input-group.js.map +1 -0
- package/dist/client/components/ui/input.d.ts +4 -0
- package/dist/client/components/ui/input.d.ts.map +1 -0
- package/dist/client/components/ui/input.js +8 -0
- package/dist/client/components/ui/input.js.map +1 -0
- package/dist/client/components/ui/item.d.ts +25 -0
- package/dist/client/components/ui/item.d.ts.map +1 -0
- package/dist/client/components/ui/item.js +82 -0
- package/dist/client/components/ui/item.js.map +1 -0
- package/dist/client/components/ui/label.d.ts +4 -0
- package/dist/client/components/ui/label.d.ts.map +1 -0
- package/dist/client/components/ui/label.js +7 -0
- package/dist/client/components/ui/label.js.map +1 -0
- package/dist/client/components/ui/popover.d.ts +10 -0
- package/dist/client/components/ui/popover.d.ts.map +1 -0
- package/dist/client/components/ui/popover.js +23 -0
- package/dist/client/components/ui/popover.js.map +1 -0
- package/dist/client/components/ui/radio-group.d.ts +7 -0
- package/dist/client/components/ui/radio-group.d.ts.map +1 -0
- package/dist/client/components/ui/radio-group.js +12 -0
- package/dist/client/components/ui/radio-group.js.map +1 -0
- package/dist/client/components/ui/select.d.ts +16 -0
- package/dist/client/components/ui/select.d.ts.map +1 -0
- package/dist/client/components/ui/select.js +34 -0
- package/dist/client/components/ui/select.js.map +1 -0
- package/dist/client/components/ui/separator.d.ts +5 -0
- package/dist/client/components/ui/separator.d.ts.map +1 -0
- package/dist/client/components/ui/separator.js +8 -0
- package/dist/client/components/ui/separator.js.map +1 -0
- package/dist/client/components/ui/sheet.d.ts +15 -0
- package/dist/client/components/ui/sheet.d.ts.map +1 -0
- package/dist/client/components/ui/sheet.js +39 -0
- package/dist/client/components/ui/sheet.js.map +1 -0
- package/dist/client/components/ui/skeleton.d.ts +4 -0
- package/dist/client/components/ui/skeleton.d.ts.map +1 -0
- package/dist/client/components/ui/skeleton.js +7 -0
- package/dist/client/components/ui/skeleton.js.map +1 -0
- package/dist/client/components/ui/spinner.d.ts +4 -0
- package/dist/client/components/ui/spinner.d.ts.map +1 -0
- package/dist/client/components/ui/spinner.js +11 -0
- package/dist/client/components/ui/spinner.js.map +1 -0
- package/dist/client/components/ui/switch.d.ts +7 -0
- package/dist/client/components/ui/switch.d.ts.map +1 -0
- package/dist/client/components/ui/switch.js +8 -0
- package/dist/client/components/ui/switch.js.map +1 -0
- package/dist/client/components/ui/table.d.ts +11 -0
- package/dist/client/components/ui/table.d.ts.map +1 -0
- package/dist/client/components/ui/table.js +28 -0
- package/dist/client/components/ui/table.js.map +1 -0
- package/dist/client/components/ui/tabs.d.ts +14 -0
- package/dist/client/components/ui/tabs.d.ts.map +1 -0
- package/dist/client/components/ui/tabs.js +32 -0
- package/dist/client/components/ui/tabs.js.map +1 -0
- package/dist/client/components/ui/textarea.d.ts +4 -0
- package/dist/client/components/ui/textarea.d.ts.map +1 -0
- package/dist/client/components/ui/textarea.js +7 -0
- package/dist/client/components/ui/textarea.js.map +1 -0
- package/dist/client/components/ui/tooltip.d.ts +8 -0
- package/dist/client/components/ui/tooltip.d.ts.map +1 -0
- package/dist/client/components/ui/tooltip.js +17 -0
- package/dist/client/components/ui/tooltip.js.map +1 -0
- package/dist/client/components/unsaved-changes.d.ts +8 -0
- package/dist/client/components/unsaved-changes.d.ts.map +1 -0
- package/dist/client/components/unsaved-changes.js +19 -0
- package/dist/client/components/unsaved-changes.js.map +1 -0
- package/dist/client/components/use-route-overlay.d.ts +15 -0
- package/dist/client/components/use-route-overlay.d.ts.map +1 -0
- package/dist/client/components/use-route-overlay.js +15 -0
- package/dist/client/components/use-route-overlay.js.map +1 -0
- package/dist/client/components/variables/access-log.d.ts +17 -0
- package/dist/client/components/variables/access-log.d.ts.map +1 -0
- package/dist/client/components/variables/access-log.js +52 -0
- package/dist/client/components/variables/access-log.js.map +1 -0
- package/dist/client/components/variables/variable-dialogs.d.ts +30 -0
- package/dist/client/components/variables/variable-dialogs.d.ts.map +1 -0
- package/dist/client/components/variables/variable-dialogs.js +106 -0
- package/dist/client/components/variables/variable-dialogs.js.map +1 -0
- package/dist/client/components/variables/variables-panel.d.ts +24 -0
- package/dist/client/components/variables/variables-panel.d.ts.map +1 -0
- package/dist/client/components/variables/variables-panel.js +119 -0
- package/dist/client/components/variables/variables-panel.js.map +1 -0
- package/dist/client/config.d.ts +6 -0
- package/dist/client/config.d.ts.map +1 -0
- package/dist/client/config.js +6 -0
- package/dist/client/config.js.map +1 -0
- package/dist/client/hooks/use-access.d.ts +6 -0
- package/dist/client/hooks/use-access.d.ts.map +1 -0
- package/dist/client/hooks/use-access.js +8 -0
- package/dist/client/hooks/use-access.js.map +1 -0
- package/dist/client/hooks/use-agent-picker-labels.d.ts +4 -0
- package/dist/client/hooks/use-agent-picker-labels.d.ts.map +1 -0
- package/dist/client/hooks/use-agent-picker-labels.js +39 -0
- package/dist/client/hooks/use-agent-picker-labels.js.map +1 -0
- package/dist/client/hooks/use-agent-save.d.ts +9 -0
- package/dist/client/hooks/use-agent-save.d.ts.map +1 -0
- package/dist/client/hooks/use-agent-save.js +40 -0
- package/dist/client/hooks/use-agent-save.js.map +1 -0
- package/dist/client/hooks/use-agents-api.d.ts +4 -0
- package/dist/client/hooks/use-agents-api.d.ts.map +1 -0
- package/dist/client/hooks/use-agents-api.js +9 -0
- package/dist/client/hooks/use-agents-api.js.map +1 -0
- package/dist/client/hooks/use-media-query.d.ts +3 -0
- package/dist/client/hooks/use-media-query.d.ts.map +1 -0
- package/dist/client/hooks/use-media-query.js +14 -0
- package/dist/client/hooks/use-media-query.js.map +1 -0
- package/dist/client/hooks/use-model-catalog.d.ts +9 -0
- package/dist/client/hooks/use-model-catalog.d.ts.map +1 -0
- package/dist/client/hooks/use-model-catalog.js +27 -0
- package/dist/client/hooks/use-model-catalog.js.map +1 -0
- package/dist/client/hooks/use-notify.d.ts +9 -0
- package/dist/client/hooks/use-notify.d.ts.map +1 -0
- package/dist/client/hooks/use-notify.js +27 -0
- package/dist/client/hooks/use-notify.js.map +1 -0
- package/dist/client/hooks/use-realtime-topic.d.ts +6 -0
- package/dist/client/hooks/use-realtime-topic.d.ts.map +1 -0
- package/dist/client/hooks/use-realtime-topic.js +24 -0
- package/dist/client/hooks/use-realtime-topic.js.map +1 -0
- package/dist/client/hooks/use-server-url.d.ts +6 -0
- package/dist/client/hooks/use-server-url.d.ts.map +1 -0
- package/dist/client/hooks/use-server-url.js +10 -0
- package/dist/client/hooks/use-server-url.js.map +1 -0
- package/dist/client/hooks/use-vocabulary.d.ts +38 -0
- package/dist/client/hooks/use-vocabulary.d.ts.map +1 -0
- package/dist/client/hooks/use-vocabulary.js +77 -0
- package/dist/client/hooks/use-vocabulary.js.map +1 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/kit.d.ts +65 -0
- package/dist/client/kit.d.ts.map +1 -0
- package/dist/client/kit.js +124 -0
- package/dist/client/kit.js.map +1 -0
- package/dist/client/lib/action-catalog.d.ts +13 -0
- package/dist/client/lib/action-catalog.d.ts.map +1 -0
- package/dist/client/lib/action-catalog.js +45 -0
- package/dist/client/lib/action-catalog.js.map +1 -0
- package/dist/client/lib/agents.d.ts +15 -0
- package/dist/client/lib/agents.d.ts.map +1 -0
- package/dist/client/lib/agents.js +49 -0
- package/dist/client/lib/agents.js.map +1 -0
- package/dist/client/lib/diff.d.ts +8 -0
- package/dist/client/lib/diff.d.ts.map +1 -0
- package/dist/client/lib/diff.js +55 -0
- package/dist/client/lib/diff.js.map +1 -0
- package/dist/client/lib/download.d.ts +5 -0
- package/dist/client/lib/download.d.ts.map +1 -0
- package/dist/client/lib/download.js +17 -0
- package/dist/client/lib/download.js.map +1 -0
- package/dist/client/lib/format.d.ts +15 -0
- package/dist/client/lib/format.d.ts.map +1 -0
- package/dist/client/lib/format.js +76 -0
- package/dist/client/lib/format.js.map +1 -0
- package/dist/client/lib/install.d.ts +23 -0
- package/dist/client/lib/install.d.ts.map +1 -0
- package/dist/client/lib/install.js +54 -0
- package/dist/client/lib/install.js.map +1 -0
- package/dist/client/lib/revision.d.ts +3 -0
- package/dist/client/lib/revision.d.ts.map +1 -0
- package/dist/client/lib/revision.js +10 -0
- package/dist/client/lib/revision.js.map +1 -0
- package/dist/client/lib/runs.d.ts +11 -0
- package/dist/client/lib/runs.d.ts.map +1 -0
- package/dist/client/lib/runs.js +22 -0
- package/dist/client/lib/runs.js.map +1 -0
- package/dist/client/lib/text.d.ts +3 -0
- package/dist/client/lib/text.d.ts.map +1 -0
- package/dist/client/lib/text.js +6 -0
- package/dist/client/lib/text.js.map +1 -0
- package/dist/client/lib/tool-policy.d.ts +5 -0
- package/dist/client/lib/tool-policy.d.ts.map +1 -0
- package/dist/client/lib/tool-policy.js +10 -0
- package/dist/client/lib/tool-policy.js.map +1 -0
- package/dist/client/lib/tool-slots.d.ts +16 -0
- package/dist/client/lib/tool-slots.d.ts.map +1 -0
- package/dist/client/lib/tool-slots.js +37 -0
- package/dist/client/lib/tool-slots.js.map +1 -0
- package/dist/client/lib/tool-summary.d.ts +6 -0
- package/dist/client/lib/tool-summary.d.ts.map +1 -0
- package/dist/client/lib/tool-summary.js +44 -0
- package/dist/client/lib/tool-summary.js.map +1 -0
- package/dist/client/locales/chat.en-US.d.ts +90 -0
- package/dist/client/locales/chat.en-US.d.ts.map +1 -0
- package/dist/client/locales/chat.en-US.js +89 -0
- package/dist/client/locales/chat.en-US.js.map +1 -0
- package/dist/client/locales/chat.zh-CN.d.ts +4 -0
- package/dist/client/locales/chat.zh-CN.d.ts.map +1 -0
- package/dist/client/locales/chat.zh-CN.js +83 -0
- package/dist/client/locales/chat.zh-CN.js.map +1 -0
- package/dist/client/locales/en-US.d.ts +615 -0
- package/dist/client/locales/en-US.d.ts.map +1 -0
- package/dist/client/locales/en-US.js +610 -0
- package/dist/client/locales/en-US.js.map +1 -0
- package/dist/client/locales/index.d.ts +4 -0
- package/dist/client/locales/index.d.ts.map +1 -0
- package/dist/client/locales/index.js +7 -0
- package/dist/client/locales/index.js.map +1 -0
- package/dist/client/locales/prices.en-US.d.ts +49 -0
- package/dist/client/locales/prices.en-US.d.ts.map +1 -0
- package/dist/client/locales/prices.en-US.js +48 -0
- package/dist/client/locales/prices.en-US.js.map +1 -0
- package/dist/client/locales/prices.zh-CN.d.ts +5 -0
- package/dist/client/locales/prices.zh-CN.d.ts.map +1 -0
- package/dist/client/locales/prices.zh-CN.js +48 -0
- package/dist/client/locales/prices.zh-CN.js.map +1 -0
- package/dist/client/locales/runWait.en-US.d.ts +31 -0
- package/dist/client/locales/runWait.en-US.d.ts.map +1 -0
- package/dist/client/locales/runWait.en-US.js +30 -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 +25 -0
- package/dist/client/locales/runWait.zh-CN.js.map +1 -0
- package/dist/client/locales/runtimes.en-US.d.ts +172 -0
- package/dist/client/locales/runtimes.en-US.d.ts.map +1 -0
- package/dist/client/locales/runtimes.en-US.js +171 -0
- package/dist/client/locales/runtimes.en-US.js.map +1 -0
- package/dist/client/locales/runtimes.zh-CN.d.ts +4 -0
- package/dist/client/locales/runtimes.zh-CN.d.ts.map +1 -0
- package/dist/client/locales/runtimes.zh-CN.js +170 -0
- package/dist/client/locales/runtimes.zh-CN.js.map +1 -0
- package/dist/client/locales/services.en-US.d.ts +112 -0
- package/dist/client/locales/services.en-US.d.ts.map +1 -0
- package/dist/client/locales/services.en-US.js +111 -0
- package/dist/client/locales/services.en-US.js.map +1 -0
- package/dist/client/locales/services.zh-CN.d.ts +4 -0
- package/dist/client/locales/services.zh-CN.d.ts.map +1 -0
- package/dist/client/locales/services.zh-CN.js +110 -0
- package/dist/client/locales/services.zh-CN.js.map +1 -0
- package/dist/client/locales/skills.en-US.d.ts +149 -0
- package/dist/client/locales/skills.en-US.d.ts.map +1 -0
- package/dist/client/locales/skills.en-US.js +149 -0
- package/dist/client/locales/skills.en-US.js.map +1 -0
- package/dist/client/locales/skills.zh-CN.d.ts +4 -0
- package/dist/client/locales/skills.zh-CN.d.ts.map +1 -0
- package/dist/client/locales/skills.zh-CN.js +148 -0
- package/dist/client/locales/skills.zh-CN.js.map +1 -0
- package/dist/client/locales/zh-CN.d.ts +4 -0
- package/dist/client/locales/zh-CN.d.ts.map +1 -0
- package/dist/client/locales/zh-CN.js +605 -0
- package/dist/client/locales/zh-CN.js.map +1 -0
- package/dist/client/online/default-model.d.ts +5 -0
- package/dist/client/online/default-model.d.ts.map +1 -0
- package/dist/client/online/default-model.js +65 -0
- package/dist/client/online/default-model.js.map +1 -0
- package/dist/client/online/model.d.ts +45 -0
- package/dist/client/online/model.d.ts.map +1 -0
- package/dist/client/online/model.js +128 -0
- package/dist/client/online/model.js.map +1 -0
- package/dist/client/online/service-editor.d.ts +11 -0
- package/dist/client/online/service-editor.d.ts.map +1 -0
- package/dist/client/online/service-editor.js +235 -0
- package/dist/client/online/service-editor.js.map +1 -0
- package/dist/client/online/services.d.ts +3 -0
- package/dist/client/online/services.d.ts.map +1 -0
- package/dist/client/online/services.js +109 -0
- package/dist/client/online/services.js.map +1 -0
- package/dist/client/pages/agents/agent-model.d.ts +73 -0
- package/dist/client/pages/agents/agent-model.d.ts.map +1 -0
- package/dist/client/pages/agents/agent-model.js +172 -0
- package/dist/client/pages/agents/agent-model.js.map +1 -0
- package/dist/client/pages/agents/detail/brief-preview.d.ts +7 -0
- package/dist/client/pages/agents/detail/brief-preview.d.ts.map +1 -0
- package/dist/client/pages/agents/detail/brief-preview.js +43 -0
- package/dist/client/pages/agents/detail/brief-preview.js.map +1 -0
- package/dist/client/pages/agents/detail/history.d.ts +11 -0
- package/dist/client/pages/agents/detail/history.d.ts.map +1 -0
- package/dist/client/pages/agents/detail/history.js +149 -0
- package/dist/client/pages/agents/detail/history.js.map +1 -0
- package/dist/client/pages/agents/detail/index.d.ts +3 -0
- package/dist/client/pages/agents/detail/index.d.ts.map +1 -0
- package/dist/client/pages/agents/detail/index.js +241 -0
- package/dist/client/pages/agents/detail/index.js.map +1 -0
- package/dist/client/pages/agents/detail/sections.d.ts +22 -0
- package/dist/client/pages/agents/detail/sections.d.ts.map +1 -0
- package/dist/client/pages/agents/detail/sections.js +311 -0
- package/dist/client/pages/agents/detail/sections.js.map +1 -0
- package/dist/client/pages/agents/detail/tab-draft.d.ts +43 -0
- package/dist/client/pages/agents/detail/tab-draft.d.ts.map +1 -0
- package/dist/client/pages/agents/detail/tab-draft.js +115 -0
- package/dist/client/pages/agents/detail/tab-draft.js.map +1 -0
- package/dist/client/pages/agents/detail/unsaved-bar.d.ts +13 -0
- package/dist/client/pages/agents/detail/unsaved-bar.d.ts.map +1 -0
- package/dist/client/pages/agents/detail/unsaved-bar.js +21 -0
- package/dist/client/pages/agents/detail/unsaved-bar.js.map +1 -0
- package/dist/client/pages/agents/index.d.ts +3 -0
- package/dist/client/pages/agents/index.d.ts.map +1 -0
- package/dist/client/pages/agents/index.js +109 -0
- package/dist/client/pages/agents/index.js.map +1 -0
- package/dist/client/pages/agents/new.d.ts +3 -0
- package/dist/client/pages/agents/new.d.ts.map +1 -0
- package/dist/client/pages/agents/new.js +149 -0
- package/dist/client/pages/agents/new.js.map +1 -0
- package/dist/client/pages/agents/preset-picker.d.ts +8 -0
- package/dist/client/pages/agents/preset-picker.d.ts.map +1 -0
- package/dist/client/pages/agents/preset-picker.js +41 -0
- package/dist/client/pages/agents/preset-picker.js.map +1 -0
- package/dist/client/pages/models/index.d.ts +6 -0
- package/dist/client/pages/models/index.d.ts.map +1 -0
- package/dist/client/pages/models/index.js +6 -0
- package/dist/client/pages/models/index.js.map +1 -0
- package/dist/client/pages/runtimes/connect.d.ts +3 -0
- package/dist/client/pages/runtimes/connect.d.ts.map +1 -0
- package/dist/client/pages/runtimes/connect.js +155 -0
- package/dist/client/pages/runtimes/connect.js.map +1 -0
- package/dist/client/pages/runtimes/index.d.ts +3 -0
- package/dist/client/pages/runtimes/index.d.ts.map +1 -0
- package/dist/client/pages/runtimes/index.js +110 -0
- package/dist/client/pages/runtimes/index.js.map +1 -0
- package/dist/client/pages/runtimes/runner-cells.d.ts +39 -0
- package/dist/client/pages/runtimes/runner-cells.d.ts.map +1 -0
- package/dist/client/pages/runtimes/runner-cells.js +117 -0
- package/dist/client/pages/runtimes/runner-cells.js.map +1 -0
- package/dist/client/pages/runtimes/runner-policy.d.ts +18 -0
- package/dist/client/pages/runtimes/runner-policy.d.ts.map +1 -0
- package/dist/client/pages/runtimes/runner-policy.js +10 -0
- package/dist/client/pages/runtimes/runner-policy.js.map +1 -0
- package/dist/client/pages/runtimes/runner-sheet.d.ts +8 -0
- package/dist/client/pages/runtimes/runner-sheet.d.ts.map +1 -0
- package/dist/client/pages/runtimes/runner-sheet.js +188 -0
- package/dist/client/pages/runtimes/runner-sheet.js.map +1 -0
- package/dist/client/pages/runtimes/tool-slots-fields.d.ts +33 -0
- package/dist/client/pages/runtimes/tool-slots-fields.d.ts.map +1 -0
- package/dist/client/pages/runtimes/tool-slots-fields.js +28 -0
- package/dist/client/pages/runtimes/tool-slots-fields.js.map +1 -0
- package/dist/client/pages/skills/detail/index.d.ts +3 -0
- package/dist/client/pages/skills/detail/index.d.ts.map +1 -0
- package/dist/client/pages/skills/detail/index.js +115 -0
- package/dist/client/pages/skills/detail/index.js.map +1 -0
- package/dist/client/pages/skills/detail/skill-editor.d.ts +13 -0
- package/dist/client/pages/skills/detail/skill-editor.d.ts.map +1 -0
- package/dist/client/pages/skills/detail/skill-editor.js +80 -0
- package/dist/client/pages/skills/detail/skill-editor.js.map +1 -0
- package/dist/client/pages/skills/detail/skill-versions.d.ts +7 -0
- package/dist/client/pages/skills/detail/skill-versions.d.ts.map +1 -0
- package/dist/client/pages/skills/detail/skill-versions.js +115 -0
- package/dist/client/pages/skills/detail/skill-versions.js.map +1 -0
- package/dist/client/pages/skills/import-button.d.ts +9 -0
- package/dist/client/pages/skills/import-button.d.ts.map +1 -0
- package/dist/client/pages/skills/import-button.js +69 -0
- package/dist/client/pages/skills/import-button.js.map +1 -0
- package/dist/client/pages/skills/index.d.ts +3 -0
- package/dist/client/pages/skills/index.d.ts.map +1 -0
- package/dist/client/pages/skills/index.js +49 -0
- package/dist/client/pages/skills/index.js.map +1 -0
- package/dist/client/pages/skills/new.d.ts +3 -0
- package/dist/client/pages/skills/new.d.ts.map +1 -0
- package/dist/client/pages/skills/new.js +81 -0
- package/dist/client/pages/skills/new.js.map +1 -0
- package/dist/client/pages/skills/workbench/discard-dialog.d.ts +8 -0
- package/dist/client/pages/skills/workbench/discard-dialog.d.ts.map +1 -0
- package/dist/client/pages/skills/workbench/discard-dialog.js +9 -0
- package/dist/client/pages/skills/workbench/discard-dialog.js.map +1 -0
- package/dist/client/pages/skills/workbench/entry-dialog.d.ts +23 -0
- package/dist/client/pages/skills/workbench/entry-dialog.d.ts.map +1 -0
- package/dist/client/pages/skills/workbench/entry-dialog.js +63 -0
- package/dist/client/pages/skills/workbench/entry-dialog.js.map +1 -0
- package/dist/client/pages/skills/workbench/file-pane.d.ts +27 -0
- package/dist/client/pages/skills/workbench/file-pane.d.ts.map +1 -0
- package/dist/client/pages/skills/workbench/file-pane.js +101 -0
- package/dist/client/pages/skills/workbench/file-pane.js.map +1 -0
- package/dist/client/pages/skills/workbench/file-tree.d.ts +23 -0
- package/dist/client/pages/skills/workbench/file-tree.d.ts.map +1 -0
- package/dist/client/pages/skills/workbench/file-tree.js +85 -0
- package/dist/client/pages/skills/workbench/file-tree.js.map +1 -0
- package/dist/client/pages/skills/workbench/model.d.ts +72 -0
- package/dist/client/pages/skills/workbench/model.d.ts.map +1 -0
- package/dist/client/pages/skills/workbench/model.js +176 -0
- package/dist/client/pages/skills/workbench/model.js.map +1 -0
- package/dist/client/pages/skills/workbench/skill-workbench.d.ts +13 -0
- package/dist/client/pages/skills/workbench/skill-workbench.d.ts.map +1 -0
- package/dist/client/pages/skills/workbench/skill-workbench.js +223 -0
- package/dist/client/pages/skills/workbench/skill-workbench.js.map +1 -0
- package/dist/client/pages/skills/workbench/state.d.ts +28 -0
- package/dist/client/pages/skills/workbench/state.d.ts.map +1 -0
- package/dist/client/pages/skills/workbench/state.js +62 -0
- package/dist/client/pages/skills/workbench/state.js.map +1 -0
- package/dist/client/pages/skills/workbench/use-element-width.d.ts +6 -0
- package/dist/client/pages/skills/workbench/use-element-width.d.ts.map +1 -0
- package/dist/client/pages/skills/workbench/use-element-width.js +18 -0
- package/dist/client/pages/skills/workbench/use-element-width.js.map +1 -0
- package/dist/client/pages/usage/date-range-picker.d.ts +10 -0
- package/dist/client/pages/usage/date-range-picker.d.ts.map +1 -0
- package/dist/client/pages/usage/date-range-picker.js +45 -0
- package/dist/client/pages/usage/date-range-picker.js.map +1 -0
- package/dist/client/pages/usage/index.d.ts +3 -0
- package/dist/client/pages/usage/index.d.ts.map +1 -0
- package/dist/client/pages/usage/index.js +269 -0
- package/dist/client/pages/usage/index.js.map +1 -0
- package/dist/client/pages/usage/model.d.ts +70 -0
- package/dist/client/pages/usage/model.d.ts.map +1 -0
- package/dist/client/pages/usage/model.js +234 -0
- package/dist/client/pages/usage/model.js.map +1 -0
- package/dist/client/pages/usage/prices/index.d.ts +6 -0
- package/dist/client/pages/usage/prices/index.d.ts.map +1 -0
- package/dist/client/pages/usage/prices/index.js +35 -0
- package/dist/client/pages/usage/prices/index.js.map +1 -0
- package/dist/client/pages/usage/prices/model.d.ts +43 -0
- package/dist/client/pages/usage/prices/model.d.ts.map +1 -0
- package/dist/client/pages/usage/prices/model.js +104 -0
- package/dist/client/pages/usage/prices/model.js.map +1 -0
- package/dist/client/pages/usage/prices/price-cells.d.ts +24 -0
- package/dist/client/pages/usage/prices/price-cells.d.ts.map +1 -0
- package/dist/client/pages/usage/prices/price-cells.js +61 -0
- package/dist/client/pages/usage/prices/price-cells.js.map +1 -0
- package/dist/client/pages/usage/prices/prices-section.d.ts +7 -0
- package/dist/client/pages/usage/prices/prices-section.d.ts.map +1 -0
- package/dist/client/pages/usage/prices/prices-section.js +50 -0
- package/dist/client/pages/usage/prices/prices-section.js.map +1 -0
- package/dist/client/pages/usage/prices/tool-panel.d.ts +9 -0
- package/dist/client/pages/usage/prices/tool-panel.d.ts.map +1 -0
- package/dist/client/pages/usage/prices/tool-panel.js +78 -0
- package/dist/client/pages/usage/prices/tool-panel.js.map +1 -0
- package/dist/client/pages/usage/prices/use-save-prices.d.ts +6 -0
- package/dist/client/pages/usage/prices/use-save-prices.d.ts.map +1 -0
- package/dist/client/pages/usage/prices/use-save-prices.js +14 -0
- package/dist/client/pages/usage/prices/use-save-prices.js.map +1 -0
- package/dist/client/plugin.d.ts +4 -0
- package/dist/client/plugin.d.ts.map +1 -0
- package/dist/client/plugin.js +11 -0
- package/dist/client/plugin.js.map +1 -0
- package/dist/client/profile/default-agent.d.ts +3 -0
- package/dist/client/profile/default-agent.d.ts.map +1 -0
- package/dist/client/profile/default-agent.js +89 -0
- package/dist/client/profile/default-agent.js.map +1 -0
- package/dist/client/profile.d.ts +8 -0
- package/dist/client/profile.d.ts.map +1 -0
- package/dist/client/profile.js +4 -0
- package/dist/client/profile.js.map +1 -0
- package/dist/client/query.d.ts +9 -0
- package/dist/client/query.d.ts.map +1 -0
- package/dist/client/query.js +41 -0
- package/dist/client/query.js.map +1 -0
- package/dist/client/routes.d.ts +25 -0
- package/dist/client/routes.d.ts.map +1 -0
- package/dist/client/routes.js +89 -0
- package/dist/client/routes.js.map +1 -0
- 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 +76 -0
- package/dist/client/runs/format-wait.js.map +1 -0
- package/dist/client/runs/run-hooks.d.ts +35 -0
- package/dist/client/runs/run-hooks.d.ts.map +1 -0
- package/dist/client/runs/run-hooks.js +92 -0
- package/dist/client/runs/run-hooks.js.map +1 -0
- package/dist/client/runs/subject-runs.d.ts +12 -0
- package/dist/client/runs/subject-runs.d.ts.map +1 -0
- package/dist/client/runs/subject-runs.js +56 -0
- package/dist/client/runs/subject-runs.js.map +1 -0
- package/dist/client/runs/use-run-events.d.ts +24 -0
- package/dist/client/runs/use-run-events.d.ts.map +1 -0
- package/dist/client/runs/use-run-events.js +80 -0
- package/dist/client/runs/use-run-events.js.map +1 -0
- package/dist/client/runs.d.ts +16 -0
- package/dist/client/runs.d.ts.map +1 -0
- package/dist/client/runs.js +15 -0
- package/dist/client/runs.js.map +1 -0
- package/dist/database/migrations/.manifest.json +61 -0
- package/dist/database/migrations/202610020001_ag_create_agents.d.ts +4 -0
- package/dist/database/migrations/202610020001_ag_create_agents.d.ts.map +1 -0
- package/dist/database/migrations/202610020001_ag_create_agents.js +108 -0
- package/dist/database/migrations/202610020001_ag_create_agents.js.map +1 -0
- package/dist/database/migrations/202610020002_ag_create_runners.d.ts +4 -0
- package/dist/database/migrations/202610020002_ag_create_runners.d.ts.map +1 -0
- package/dist/database/migrations/202610020002_ag_create_runners.js +115 -0
- package/dist/database/migrations/202610020002_ag_create_runners.js.map +1 -0
- package/dist/database/migrations/202610020003_ag_create_runs.d.ts +4 -0
- package/dist/database/migrations/202610020003_ag_create_runs.d.ts.map +1 -0
- package/dist/database/migrations/202610020003_ag_create_runs.js +289 -0
- package/dist/database/migrations/202610020003_ag_create_runs.js.map +1 -0
- package/dist/database/migrations/202610020004_ag_create_variables.d.ts +4 -0
- package/dist/database/migrations/202610020004_ag_create_variables.d.ts.map +1 -0
- package/dist/database/migrations/202610020004_ag_create_variables.js +52 -0
- package/dist/database/migrations/202610020004_ag_create_variables.js.map +1 -0
- package/dist/database/migrations/202610020005_ag_create_skills.d.ts +4 -0
- package/dist/database/migrations/202610020005_ag_create_skills.d.ts.map +1 -0
- package/dist/database/migrations/202610020005_ag_create_skills.js +94 -0
- package/dist/database/migrations/202610020005_ag_create_skills.js.map +1 -0
- package/dist/database/migrations/202610020006_ag_create_model_prices.d.ts +4 -0
- package/dist/database/migrations/202610020006_ag_create_model_prices.d.ts.map +1 -0
- package/dist/database/migrations/202610020006_ag_create_model_prices.js +46 -0
- package/dist/database/migrations/202610020006_ag_create_model_prices.js.map +1 -0
- package/dist/database/migrations/202610020008_ag_create_conversations.d.ts +4 -0
- package/dist/database/migrations/202610020008_ag_create_conversations.d.ts.map +1 -0
- package/dist/database/migrations/202610020008_ag_create_conversations.js +113 -0
- package/dist/database/migrations/202610020008_ag_create_conversations.js.map +1 -0
- package/dist/database/migrations/202610020009_ag_create_jobs.d.ts +4 -0
- package/dist/database/migrations/202610020009_ag_create_jobs.d.ts.map +1 -0
- package/dist/database/migrations/202610020009_ag_create_jobs.js +102 -0
- package/dist/database/migrations/202610020009_ag_create_jobs.js.map +1 -0
- package/dist/database/migrations/202610020010_ag_create_model_services.d.ts +4 -0
- package/dist/database/migrations/202610020010_ag_create_model_services.d.ts.map +1 -0
- package/dist/database/migrations/202610020010_ag_create_model_services.js +57 -0
- package/dist/database/migrations/202610020010_ag_create_model_services.js.map +1 -0
- package/dist/database/migrations/202610020011_ag_create_vectors.d.ts +4 -0
- package/dist/database/migrations/202610020011_ag_create_vectors.d.ts.map +1 -0
- package/dist/database/migrations/202610020011_ag_create_vectors.js +68 -0
- package/dist/database/migrations/202610020011_ag_create_vectors.js.map +1 -0
- package/dist/database/migrations/202610060001_ag_add_runner_product.d.ts +8 -0
- package/dist/database/migrations/202610060001_ag_add_runner_product.d.ts.map +1 -0
- package/dist/database/migrations/202610060001_ag_add_runner_product.js +21 -0
- package/dist/database/migrations/202610060001_ag_add_runner_product.js.map +1 -0
- package/dist/database/migrations/202610070001_ag_create_chat_attachments.d.ts +4 -0
- package/dist/database/migrations/202610070001_ag_create_chat_attachments.d.ts.map +1 -0
- package/dist/database/migrations/202610070001_ag_create_chat_attachments.js +35 -0
- package/dist/database/migrations/202610070001_ag_create_chat_attachments.js.map +1 -0
- package/dist/database/migrations/202610080001_ag_add_runner_tool_slots.d.ts +9 -0
- package/dist/database/migrations/202610080001_ag_add_runner_tool_slots.d.ts.map +1 -0
- package/dist/database/migrations/202610080001_ag_add_runner_tool_slots.js +30 -0
- package/dist/database/migrations/202610080001_ag_add_runner_tool_slots.js.map +1 -0
- 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/seeds/.manifest.json +9 -0
- package/dist/database/seeds/202610020007_ag_default_model_prices.d.ts +4 -0
- package/dist/database/seeds/202610020007_ag_default_model_prices.d.ts.map +1 -0
- package/dist/database/seeds/202610020007_ag_default_model_prices.js +142 -0
- package/dist/database/seeds/202610020007_ag_default_model_prices.js.map +1 -0
- package/dist/package.d.ts +2 -0
- package/dist/package.d.ts.map +1 -0
- package/dist/package.js +2 -0
- package/dist/package.js.map +1 -0
- package/dist/package.json +312 -0
- package/dist/server/cli/run-credential.d.ts +17 -0
- package/dist/server/cli/run-credential.d.ts.map +1 -0
- package/dist/server/cli/run-credential.js +52 -0
- package/dist/server/cli/run-credential.js.map +1 -0
- package/dist/server/cli/surface.d.ts +20 -0
- package/dist/server/cli/surface.d.ts.map +1 -0
- package/dist/server/cli/surface.js +66 -0
- package/dist/server/cli/surface.js.map +1 -0
- package/dist/server/composition.d.ts +199 -0
- package/dist/server/composition.d.ts.map +1 -0
- package/dist/server/composition.js +373 -0
- package/dist/server/composition.js.map +1 -0
- package/dist/server/core/agents/actions.d.ts +16 -0
- package/dist/server/core/agents/actions.d.ts.map +1 -0
- package/dist/server/core/agents/actions.js +26 -0
- package/dist/server/core/agents/actions.js.map +1 -0
- package/dist/server/core/agents/agent.history.d.ts +32 -0
- package/dist/server/core/agents/agent.history.d.ts.map +1 -0
- package/dist/server/core/agents/agent.history.js +71 -0
- package/dist/server/core/agents/agent.history.js.map +1 -0
- package/dist/server/core/agents/agent.service.d.ts +85 -0
- package/dist/server/core/agents/agent.service.d.ts.map +1 -0
- package/dist/server/core/agents/agent.service.js +427 -0
- package/dist/server/core/agents/agent.service.js.map +1 -0
- package/dist/server/core/agents/agent.store.d.ts +51 -0
- package/dist/server/core/agents/agent.store.d.ts.map +1 -0
- package/dist/server/core/agents/agent.store.js +152 -0
- package/dist/server/core/agents/agent.store.js.map +1 -0
- package/dist/server/core/agents/index.d.ts +4 -0
- package/dist/server/core/agents/index.d.ts.map +1 -0
- package/dist/server/core/agents/index.js +4 -0
- package/dist/server/core/agents/index.js.map +1 -0
- package/dist/server/core/brief/brief.d.ts +114 -0
- package/dist/server/core/brief/brief.d.ts.map +1 -0
- package/dist/server/core/brief/brief.js +216 -0
- package/dist/server/core/brief/brief.js.map +1 -0
- package/dist/server/core/brief/index.d.ts +2 -0
- package/dist/server/core/brief/index.d.ts.map +1 -0
- package/dist/server/core/brief/index.js +2 -0
- package/dist/server/core/brief/index.js.map +1 -0
- package/dist/server/core/callers/index.d.ts +63 -0
- package/dist/server/core/callers/index.d.ts.map +1 -0
- package/dist/server/core/callers/index.js +42 -0
- package/dist/server/core/callers/index.js.map +1 -0
- package/dist/server/core/consultations/consultation.service.d.ts +59 -0
- package/dist/server/core/consultations/consultation.service.d.ts.map +1 -0
- package/dist/server/core/consultations/consultation.service.js +195 -0
- package/dist/server/core/consultations/consultation.service.js.map +1 -0
- package/dist/server/core/consultations/index.d.ts +3 -0
- package/dist/server/core/consultations/index.d.ts.map +1 -0
- package/dist/server/core/consultations/index.js +3 -0
- package/dist/server/core/consultations/index.js.map +1 -0
- package/dist/server/core/consultations/prompt.d.ts +41 -0
- package/dist/server/core/consultations/prompt.d.ts.map +1 -0
- package/dist/server/core/consultations/prompt.js +64 -0
- package/dist/server/core/consultations/prompt.js.map +1 -0
- package/dist/server/core/conversations/attachments.d.ts +159 -0
- package/dist/server/core/conversations/attachments.d.ts.map +1 -0
- package/dist/server/core/conversations/attachments.js +281 -0
- package/dist/server/core/conversations/attachments.js.map +1 -0
- package/dist/server/core/conversations/availability.d.ts +20 -0
- package/dist/server/core/conversations/availability.d.ts.map +1 -0
- package/dist/server/core/conversations/availability.js +28 -0
- package/dist/server/core/conversations/availability.js.map +1 -0
- package/dist/server/core/conversations/chat-settings.d.ts +26 -0
- package/dist/server/core/conversations/chat-settings.d.ts.map +1 -0
- package/dist/server/core/conversations/chat-settings.js +116 -0
- package/dist/server/core/conversations/chat-settings.js.map +1 -0
- package/dist/server/core/conversations/conversation.service.d.ts +32 -0
- package/dist/server/core/conversations/conversation.service.d.ts.map +1 -0
- package/dist/server/core/conversations/conversation.service.js +1356 -0
- package/dist/server/core/conversations/conversation.service.js.map +1 -0
- package/dist/server/core/conversations/conversation.store.d.ts +104 -0
- package/dist/server/core/conversations/conversation.store.d.ts.map +1 -0
- package/dist/server/core/conversations/conversation.store.js +159 -0
- package/dist/server/core/conversations/conversation.store.js.map +1 -0
- package/dist/server/core/conversations/index.d.ts +8 -0
- package/dist/server/core/conversations/index.d.ts.map +1 -0
- package/dist/server/core/conversations/index.js +7 -0
- package/dist/server/core/conversations/index.js.map +1 -0
- package/dist/server/core/conversations/page-context.d.ts +35 -0
- package/dist/server/core/conversations/page-context.d.ts.map +1 -0
- package/dist/server/core/conversations/page-context.js +144 -0
- package/dist/server/core/conversations/page-context.js.map +1 -0
- package/dist/server/core/conversations/ports.d.ts +145 -0
- package/dist/server/core/conversations/ports.d.ts.map +1 -0
- package/dist/server/core/conversations/ports.js +2 -0
- package/dist/server/core/conversations/ports.js.map +1 -0
- package/dist/server/core/conversations/prompt.d.ts +46 -0
- package/dist/server/core/conversations/prompt.d.ts.map +1 -0
- package/dist/server/core/conversations/prompt.js +107 -0
- package/dist/server/core/conversations/prompt.js.map +1 -0
- package/dist/server/core/conversations/titles.d.ts +9 -0
- package/dist/server/core/conversations/titles.d.ts.map +1 -0
- package/dist/server/core/conversations/titles.js +20 -0
- package/dist/server/core/conversations/titles.js.map +1 -0
- package/dist/server/core/presets/index.d.ts +19 -0
- package/dist/server/core/presets/index.d.ts.map +1 -0
- package/dist/server/core/presets/index.js +28 -0
- package/dist/server/core/presets/index.js.map +1 -0
- package/dist/server/core/reports/index.d.ts +7 -0
- package/dist/server/core/reports/index.d.ts.map +1 -0
- package/dist/server/core/reports/index.js +7 -0
- package/dist/server/core/reports/index.js.map +1 -0
- package/dist/server/core/reports/metrics.d.ts +23 -0
- package/dist/server/core/reports/metrics.d.ts.map +1 -0
- package/dist/server/core/reports/metrics.js +60 -0
- package/dist/server/core/reports/metrics.js.map +1 -0
- package/dist/server/core/reports/model-usage.d.ts +35 -0
- package/dist/server/core/reports/model-usage.d.ts.map +1 -0
- package/dist/server/core/reports/model-usage.js +84 -0
- package/dist/server/core/reports/model-usage.js.map +1 -0
- package/dist/server/core/reports/prices.d.ts +35 -0
- package/dist/server/core/reports/prices.d.ts.map +1 -0
- package/dist/server/core/reports/prices.js +173 -0
- package/dist/server/core/reports/prices.js.map +1 -0
- package/dist/server/core/reports/report.service.d.ts +57 -0
- package/dist/server/core/reports/report.service.d.ts.map +1 -0
- package/dist/server/core/reports/report.service.js +310 -0
- package/dist/server/core/reports/report.service.js.map +1 -0
- package/dist/server/core/reports/usage.d.ts +50 -0
- package/dist/server/core/reports/usage.d.ts.map +1 -0
- package/dist/server/core/reports/usage.js +159 -0
- package/dist/server/core/reports/usage.js.map +1 -0
- package/dist/server/core/runs/availability.d.ts +23 -0
- package/dist/server/core/runs/availability.d.ts.map +1 -0
- package/dist/server/core/runs/availability.js +42 -0
- package/dist/server/core/runs/availability.js.map +1 -0
- package/dist/server/core/runs/claim.d.ts +183 -0
- package/dist/server/core/runs/claim.d.ts.map +1 -0
- package/dist/server/core/runs/claim.js +862 -0
- package/dist/server/core/runs/claim.js.map +1 -0
- package/dist/server/core/runs/cli-package.d.ts +16 -0
- package/dist/server/core/runs/cli-package.d.ts.map +1 -0
- package/dist/server/core/runs/cli-package.js +18 -0
- package/dist/server/core/runs/cli-package.js.map +1 -0
- package/dist/server/core/runs/eligibility.d.ts +49 -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/extensions.d.ts +131 -0
- package/dist/server/core/runs/extensions.d.ts.map +1 -0
- package/dist/server/core/runs/extensions.js +184 -0
- package/dist/server/core/runs/extensions.js.map +1 -0
- package/dist/server/core/runs/index.d.ts +17 -0
- package/dist/server/core/runs/index.d.ts.map +1 -0
- package/dist/server/core/runs/index.js +16 -0
- package/dist/server/core/runs/index.js.map +1 -0
- package/dist/server/core/runs/lifecycle.d.ts +56 -0
- package/dist/server/core/runs/lifecycle.d.ts.map +1 -0
- package/dist/server/core/runs/lifecycle.js +348 -0
- package/dist/server/core/runs/lifecycle.js.map +1 -0
- package/dist/server/core/runs/policy.d.ts +33 -0
- package/dist/server/core/runs/policy.d.ts.map +1 -0
- package/dist/server/core/runs/policy.js +38 -0
- package/dist/server/core/runs/policy.js.map +1 -0
- package/dist/server/core/runs/ports.d.ts +197 -0
- package/dist/server/core/runs/ports.d.ts.map +1 -0
- package/dist/server/core/runs/ports.js +33 -0
- package/dist/server/core/runs/ports.js.map +1 -0
- package/dist/server/core/runs/preview.d.ts +47 -0
- package/dist/server/core/runs/preview.d.ts.map +1 -0
- package/dist/server/core/runs/preview.js +104 -0
- package/dist/server/core/runs/preview.js.map +1 -0
- package/dist/server/core/runs/run-tokens.d.ts +21 -0
- package/dist/server/core/runs/run-tokens.d.ts.map +1 -0
- package/dist/server/core/runs/run-tokens.js +51 -0
- package/dist/server/core/runs/run-tokens.js.map +1 -0
- package/dist/server/core/runs/run.service.d.ts +168 -0
- package/dist/server/core/runs/run.service.d.ts.map +1 -0
- package/dist/server/core/runs/run.service.js +482 -0
- package/dist/server/core/runs/run.service.js.map +1 -0
- package/dist/server/core/runs/run.store.d.ts +191 -0
- package/dist/server/core/runs/run.store.d.ts.map +1 -0
- package/dist/server/core/runs/run.store.js +252 -0
- package/dist/server/core/runs/run.store.js.map +1 -0
- package/dist/server/core/runs/runner-view.d.ts +46 -0
- package/dist/server/core/runs/runner-view.d.ts.map +1 -0
- package/dist/server/core/runs/runner-view.js +119 -0
- package/dist/server/core/runs/runner-view.js.map +1 -0
- package/dist/server/core/runs/sweeper.d.ts +28 -0
- package/dist/server/core/runs/sweeper.d.ts.map +1 -0
- package/dist/server/core/runs/sweeper.js +199 -0
- package/dist/server/core/runs/sweeper.js.map +1 -0
- package/dist/server/core/runs/transitions.d.ts +41 -0
- package/dist/server/core/runs/transitions.d.ts.map +1 -0
- package/dist/server/core/runs/transitions.js +106 -0
- package/dist/server/core/runs/transitions.js.map +1 -0
- package/dist/server/core/runs/workload.d.ts +49 -0
- package/dist/server/core/runs/workload.d.ts.map +1 -0
- package/dist/server/core/runs/workload.js +312 -0
- package/dist/server/core/runs/workload.js.map +1 -0
- package/dist/server/core/runs/workspace.store.d.ts +23 -0
- package/dist/server/core/runs/workspace.store.d.ts.map +1 -0
- package/dist/server/core/runs/workspace.store.js +77 -0
- package/dist/server/core/runs/workspace.store.js.map +1 -0
- package/dist/server/core/skills/blobs.d.ts +65 -0
- package/dist/server/core/skills/blobs.d.ts.map +1 -0
- package/dist/server/core/skills/blobs.js +212 -0
- package/dist/server/core/skills/blobs.js.map +1 -0
- package/dist/server/core/skills/bundle.d.ts +27 -0
- package/dist/server/core/skills/bundle.d.ts.map +1 -0
- package/dist/server/core/skills/bundle.js +71 -0
- package/dist/server/core/skills/bundle.js.map +1 -0
- package/dist/server/core/skills/index.d.ts +6 -0
- package/dist/server/core/skills/index.d.ts.map +1 -0
- package/dist/server/core/skills/index.js +6 -0
- package/dist/server/core/skills/index.js.map +1 -0
- package/dist/server/core/skills/skill.service.d.ts +105 -0
- package/dist/server/core/skills/skill.service.d.ts.map +1 -0
- package/dist/server/core/skills/skill.service.js +625 -0
- package/dist/server/core/skills/skill.service.js.map +1 -0
- package/dist/server/core/skills/skill.store.d.ts +50 -0
- package/dist/server/core/skills/skill.store.d.ts.map +1 -0
- package/dist/server/core/skills/skill.store.js +58 -0
- package/dist/server/core/skills/skill.store.js.map +1 -0
- package/dist/server/core/skills/zip.d.ts +13 -0
- package/dist/server/core/skills/zip.d.ts.map +1 -0
- package/dist/server/core/skills/zip.js +126 -0
- package/dist/server/core/skills/zip.js.map +1 -0
- package/dist/server/core/variables/index.d.ts +2 -0
- package/dist/server/core/variables/index.d.ts.map +1 -0
- package/dist/server/core/variables/index.js +2 -0
- package/dist/server/core/variables/index.js.map +1 -0
- package/dist/server/core/variables/variable.service.d.ts +100 -0
- package/dist/server/core/variables/variable.service.d.ts.map +1 -0
- package/dist/server/core/variables/variable.service.js +278 -0
- package/dist/server/core/variables/variable.service.js.map +1 -0
- package/dist/server/distribution/dist.service.d.ts +50 -0
- package/dist/server/distribution/dist.service.d.ts.map +1 -0
- package/dist/server/distribution/dist.service.js +201 -0
- package/dist/server/distribution/dist.service.js.map +1 -0
- package/dist/server/distribution/download-tokens.d.ts +30 -0
- package/dist/server/distribution/download-tokens.d.ts.map +1 -0
- package/dist/server/distribution/download-tokens.js +82 -0
- package/dist/server/distribution/download-tokens.js.map +1 -0
- package/dist/server/distribution/index.d.ts +14 -0
- package/dist/server/distribution/index.d.ts.map +1 -0
- package/dist/server/distribution/index.js +28 -0
- package/dist/server/distribution/index.js.map +1 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +4 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/jobs/index.d.ts +5 -0
- package/dist/server/jobs/index.d.ts.map +1 -0
- package/dist/server/jobs/index.js +5 -0
- package/dist/server/jobs/index.js.map +1 -0
- package/dist/server/jobs/job.service.d.ts +154 -0
- package/dist/server/jobs/job.service.d.ts.map +1 -0
- package/dist/server/jobs/job.service.js +715 -0
- package/dist/server/jobs/job.service.js.map +1 -0
- package/dist/server/jobs/job.store.d.ts +74 -0
- package/dist/server/jobs/job.store.d.ts.map +1 -0
- package/dist/server/jobs/job.store.js +110 -0
- package/dist/server/jobs/job.store.js.map +1 -0
- package/dist/server/jobs/job.transitions.d.ts +41 -0
- package/dist/server/jobs/job.transitions.d.ts.map +1 -0
- package/dist/server/jobs/job.transitions.js +112 -0
- package/dist/server/jobs/job.transitions.js.map +1 -0
- package/dist/server/jobs/registry.d.ts +53 -0
- package/dist/server/jobs/registry.d.ts.map +1 -0
- package/dist/server/jobs/registry.js +32 -0
- package/dist/server/jobs/registry.js.map +1 -0
- package/dist/server/jobs/spec.d.ts +49 -0
- package/dist/server/jobs/spec.d.ts.map +1 -0
- package/dist/server/jobs/spec.js +112 -0
- package/dist/server/jobs/spec.js.map +1 -0
- package/dist/server/kernel/clock.d.ts +10 -0
- package/dist/server/kernel/clock.d.ts.map +1 -0
- package/dist/server/kernel/clock.js +10 -0
- package/dist/server/kernel/clock.js.map +1 -0
- package/dist/server/kernel/crypto.d.ts +18 -0
- package/dist/server/kernel/crypto.d.ts.map +1 -0
- package/dist/server/kernel/crypto.js +25 -0
- package/dist/server/kernel/crypto.js.map +1 -0
- package/dist/server/kernel/errors.d.ts +16 -0
- package/dist/server/kernel/errors.d.ts.map +1 -0
- package/dist/server/kernel/errors.js +44 -0
- package/dist/server/kernel/errors.js.map +1 -0
- package/dist/server/kernel/events.d.ts +127 -0
- package/dist/server/kernel/events.d.ts.map +1 -0
- package/dist/server/kernel/events.js +32 -0
- package/dist/server/kernel/events.js.map +1 -0
- package/dist/server/kernel/http.d.ts +23 -0
- package/dist/server/kernel/http.d.ts.map +1 -0
- package/dist/server/kernel/http.js +56 -0
- package/dist/server/kernel/http.js.map +1 -0
- package/dist/server/kernel/ids.d.ts +9 -0
- package/dist/server/kernel/ids.d.ts.map +1 -0
- package/dist/server/kernel/ids.js +5 -0
- package/dist/server/kernel/ids.js.map +1 -0
- package/dist/server/kernel/people.d.ts +28 -0
- package/dist/server/kernel/people.d.ts.map +1 -0
- package/dist/server/kernel/people.js +30 -0
- package/dist/server/kernel/people.js.map +1 -0
- package/dist/server/kernel/redaction.d.ts +25 -0
- package/dist/server/kernel/redaction.d.ts.map +1 -0
- package/dist/server/kernel/redaction.js +39 -0
- package/dist/server/kernel/redaction.js.map +1 -0
- package/dist/server/kernel/scopes.d.ts +34 -0
- package/dist/server/kernel/scopes.d.ts.map +1 -0
- package/dist/server/kernel/scopes.js +47 -0
- package/dist/server/kernel/scopes.js.map +1 -0
- package/dist/server/kernel/secrets.d.ts +12 -0
- package/dist/server/kernel/secrets.d.ts.map +1 -0
- package/dist/server/kernel/secrets.js +20 -0
- package/dist/server/kernel/secrets.js.map +1 -0
- package/dist/server/kernel/tx.d.ts +18 -0
- package/dist/server/kernel/tx.d.ts.map +1 -0
- package/dist/server/kernel/tx.js +15 -0
- package/dist/server/kernel/tx.js.map +1 -0
- package/dist/server/kernel/values.d.ts +19 -0
- package/dist/server/kernel/values.d.ts.map +1 -0
- package/dist/server/kernel/values.js +64 -0
- package/dist/server/kernel/values.js.map +1 -0
- package/dist/server/locales/en-US.d.ts +4 -0
- package/dist/server/locales/en-US.d.ts.map +1 -0
- package/dist/server/locales/en-US.js +6 -0
- package/dist/server/locales/en-US.js.map +1 -0
- package/dist/server/locales/index.d.ts +4 -0
- package/dist/server/locales/index.d.ts.map +1 -0
- package/dist/server/locales/index.js +6 -0
- package/dist/server/locales/index.js.map +1 -0
- package/dist/server/locales/zh-CN.d.ts +4 -0
- package/dist/server/locales/zh-CN.d.ts.map +1 -0
- package/dist/server/locales/zh-CN.js +6 -0
- package/dist/server/locales/zh-CN.js.map +1 -0
- package/dist/server/online/cli-command.d.ts +20 -0
- package/dist/server/online/cli-command.d.ts.map +1 -0
- package/dist/server/online/cli-command.js +345 -0
- package/dist/server/online/cli-command.js.map +1 -0
- package/dist/server/online/consult-tool.d.ts +54 -0
- package/dist/server/online/consult-tool.d.ts.map +1 -0
- package/dist/server/online/consult-tool.js +177 -0
- package/dist/server/online/consult-tool.js.map +1 -0
- package/dist/server/online/executor.d.ts +83 -0
- package/dist/server/online/executor.d.ts.map +1 -0
- package/dist/server/online/executor.js +714 -0
- package/dist/server/online/executor.js.map +1 -0
- package/dist/server/online/gateway.d.ts +240 -0
- package/dist/server/online/gateway.d.ts.map +1 -0
- package/dist/server/online/gateway.js +552 -0
- package/dist/server/online/gateway.js.map +1 -0
- package/dist/server/online/index.d.ts +10 -0
- package/dist/server/online/index.d.ts.map +1 -0
- package/dist/server/online/index.js +10 -0
- package/dist/server/online/index.js.map +1 -0
- package/dist/server/online/providers.d.ts +58 -0
- package/dist/server/online/providers.d.ts.map +1 -0
- package/dist/server/online/providers.js +370 -0
- package/dist/server/online/providers.js.map +1 -0
- package/dist/server/online/routes.d.ts +9 -0
- package/dist/server/online/routes.d.ts.map +1 -0
- package/dist/server/online/routes.js +197 -0
- package/dist/server/online/routes.js.map +1 -0
- package/dist/server/online/sandbox.d.ts +32 -0
- package/dist/server/online/sandbox.d.ts.map +1 -0
- package/dist/server/online/sandbox.js +246 -0
- package/dist/server/online/sandbox.js.map +1 -0
- package/dist/server/online/scripted.d.ts +12 -0
- package/dist/server/online/scripted.d.ts.map +1 -0
- package/dist/server/online/scripted.js +176 -0
- package/dist/server/online/scripted.js.map +1 -0
- package/dist/server/online/services.d.ts +49 -0
- package/dist/server/online/services.d.ts.map +1 -0
- package/dist/server/online/services.js +444 -0
- package/dist/server/online/services.js.map +1 -0
- package/dist/server/online/tools.d.ts +17 -0
- package/dist/server/online/tools.d.ts.map +1 -0
- package/dist/server/online/tools.js +31 -0
- package/dist/server/online/tools.js.map +1 -0
- package/dist/server/plugin.d.ts +4 -0
- package/dist/server/plugin.d.ts.map +1 -0
- package/dist/server/plugin.js +20 -0
- package/dist/server/plugin.js.map +1 -0
- package/dist/server/providers/agents.d.ts +84 -0
- package/dist/server/providers/agents.d.ts.map +1 -0
- package/dist/server/providers/agents.js +303 -0
- package/dist/server/providers/agents.js.map +1 -0
- package/dist/server/providers/authorization.d.ts +17 -0
- package/dist/server/providers/authorization.d.ts.map +1 -0
- package/dist/server/providers/authorization.js +60 -0
- package/dist/server/providers/authorization.js.map +1 -0
- package/dist/server/providers/index.d.ts +4 -0
- package/dist/server/providers/index.d.ts.map +1 -0
- package/dist/server/providers/index.js +10 -0
- package/dist/server/providers/index.js.map +1 -0
- package/dist/server/providers/runners.d.ts +19 -0
- package/dist/server/providers/runners.d.ts.map +1 -0
- package/dist/server/providers/runners.js +143 -0
- package/dist/server/providers/runners.js.map +1 -0
- package/dist/server/routes/admin.d.ts +27 -0
- package/dist/server/routes/admin.d.ts.map +1 -0
- package/dist/server/routes/admin.js +1431 -0
- package/dist/server/routes/admin.js.map +1 -0
- package/dist/server/routes/chat.d.ts +9 -0
- package/dist/server/routes/chat.d.ts.map +1 -0
- package/dist/server/routes/chat.js +573 -0
- package/dist/server/routes/chat.js.map +1 -0
- package/dist/server/routes/index.d.ts +6 -0
- package/dist/server/routes/index.d.ts.map +1 -0
- package/dist/server/routes/index.js +105 -0
- package/dist/server/routes/index.js.map +1 -0
- package/dist/server/routes/openapi.d.ts +30 -0
- package/dist/server/routes/openapi.d.ts.map +1 -0
- package/dist/server/routes/openapi.js +101 -0
- package/dist/server/routes/openapi.js.map +1 -0
- package/dist/server/routes/roster.d.ts +6 -0
- package/dist/server/routes/roster.d.ts.map +1 -0
- package/dist/server/routes/roster.js +53 -0
- package/dist/server/routes/roster.js.map +1 -0
- package/dist/server/routes/run.d.ts +10 -0
- package/dist/server/routes/run.d.ts.map +1 -0
- package/dist/server/routes/run.js +91 -0
- package/dist/server/routes/run.js.map +1 -0
- package/dist/server/routes/runners/admin.d.ts +28 -0
- package/dist/server/routes/runners/admin.d.ts.map +1 -0
- package/dist/server/routes/runners/admin.js +318 -0
- package/dist/server/routes/runners/admin.js.map +1 -0
- package/dist/server/routes/runners/dist.d.ts +20 -0
- package/dist/server/routes/runners/dist.d.ts.map +1 -0
- package/dist/server/routes/runners/dist.js +190 -0
- package/dist/server/routes/runners/dist.js.map +1 -0
- package/dist/server/routes/runners/install.d.ts +23 -0
- package/dist/server/routes/runners/install.d.ts.map +1 -0
- package/dist/server/routes/runners/install.js +352 -0
- package/dist/server/routes/runners/install.js.map +1 -0
- package/dist/server/routes/runners/runner.d.ts +9 -0
- package/dist/server/routes/runners/runner.d.ts.map +1 -0
- package/dist/server/routes/runners/runner.js +303 -0
- package/dist/server/routes/runners/runner.js.map +1 -0
- package/dist/server/routes/runners/runs.d.ts +5 -0
- package/dist/server/routes/runners/runs.d.ts.map +1 -0
- package/dist/server/routes/runners/runs.js +74 -0
- package/dist/server/routes/runners/runs.js.map +1 -0
- package/dist/server/routes/schemas.d.ts +222 -0
- package/dist/server/routes/schemas.d.ts.map +1 -0
- package/dist/server/routes/schemas.js +1073 -0
- package/dist/server/routes/schemas.js.map +1 -0
- package/dist/server/runners/index.d.ts +13 -0
- package/dist/server/runners/index.d.ts.map +1 -0
- package/dist/server/runners/index.js +6 -0
- package/dist/server/runners/index.js.map +1 -0
- package/dist/server/runners/runner.service.d.ts +82 -0
- package/dist/server/runners/runner.service.d.ts.map +1 -0
- package/dist/server/runners/runner.service.js +404 -0
- package/dist/server/runners/runner.service.js.map +1 -0
- package/dist/server/runners/runner.store.d.ts +74 -0
- package/dist/server/runners/runner.store.d.ts.map +1 -0
- package/dist/server/runners/runner.store.js +121 -0
- package/dist/server/runners/runner.store.js.map +1 -0
- package/dist/server/runners/signal.d.ts +13 -0
- package/dist/server/runners/signal.d.ts.map +1 -0
- package/dist/server/runners/signal.js +30 -0
- package/dist/server/runners/signal.js.map +1 -0
- package/dist/server/runners/slots.d.ts +26 -0
- package/dist/server/runners/slots.d.ts.map +1 -0
- package/dist/server/runners/slots.js +27 -0
- package/dist/server/runners/slots.js.map +1 -0
- package/dist/server/runners/sweeper.d.ts +21 -0
- package/dist/server/runners/sweeper.d.ts.map +1 -0
- package/dist/server/runners/sweeper.js +19 -0
- package/dist/server/runners/sweeper.js.map +1 -0
- package/dist/server/secrets-stores.d.ts +8 -0
- package/dist/server/secrets-stores.d.ts.map +1 -0
- package/dist/server/secrets-stores.js +43 -0
- package/dist/server/secrets-stores.js.map +1 -0
- package/dist/server/testing.d.ts +16 -0
- package/dist/server/testing.d.ts.map +1 -0
- package/dist/server/testing.js +24 -0
- package/dist/server/testing.js.map +1 -0
- package/dist/server/tokens.d.ts +40 -0
- package/dist/server/tokens.d.ts.map +1 -0
- package/dist/server/tokens.js +9 -0
- package/dist/server/tokens.js.map +1 -0
- package/dist/server/vectors/index.d.ts +7 -0
- package/dist/server/vectors/index.d.ts.map +1 -0
- package/dist/server/vectors/index.js +6 -0
- package/dist/server/vectors/index.js.map +1 -0
- package/dist/server/vectors/naming.d.ts +6 -0
- package/dist/server/vectors/naming.d.ts.map +1 -0
- package/dist/server/vectors/naming.js +15 -0
- package/dist/server/vectors/naming.js.map +1 -0
- package/dist/server/vectors/pgvector.d.ts +26 -0
- package/dist/server/vectors/pgvector.d.ts.map +1 -0
- package/dist/server/vectors/pgvector.js +346 -0
- package/dist/server/vectors/pgvector.js.map +1 -0
- package/dist/server/vectors/sqlite-vec.d.ts +14 -0
- package/dist/server/vectors/sqlite-vec.d.ts.map +1 -0
- package/dist/server/vectors/sqlite-vec.js +286 -0
- package/dist/server/vectors/sqlite-vec.js.map +1 -0
- package/dist/server/vectors/types.d.ts +256 -0
- package/dist/server/vectors/types.d.ts.map +1 -0
- package/dist/server/vectors/types.js +2 -0
- package/dist/server/vectors/types.js.map +1 -0
- package/dist/server/vectors/vectors.d.ts +34 -0
- package/dist/server/vectors/vectors.d.ts.map +1 -0
- package/dist/server/vectors/vectors.js +866 -0
- package/dist/server/vectors/vectors.js.map +1 -0
- package/dist/server/vendor/THIRD_PARTY_LICENSES.txt +782 -0
- package/dist/server/vendor/just-bash.d.ts +83 -0
- package/dist/server/vendor/just-bash.js +2102 -0
- package/dist/shared/access.d.ts +154 -0
- package/dist/shared/access.d.ts.map +1 -0
- package/dist/shared/access.js +166 -0
- package/dist/shared/access.js.map +1 -0
- package/dist/shared/agents.d.ts +284 -0
- package/dist/shared/agents.d.ts.map +1 -0
- package/dist/shared/agents.js +143 -0
- package/dist/shared/agents.js.map +1 -0
- package/dist/shared/briefs.d.ts +46 -0
- package/dist/shared/briefs.d.ts.map +1 -0
- package/dist/shared/briefs.js +10 -0
- package/dist/shared/briefs.js.map +1 -0
- package/dist/shared/conversations.d.ts +658 -0
- package/dist/shared/conversations.d.ts.map +1 -0
- package/dist/shared/conversations.js +182 -0
- package/dist/shared/conversations.js.map +1 -0
- package/dist/shared/i18n.d.ts +10 -0
- package/dist/shared/i18n.d.ts.map +1 -0
- package/dist/shared/i18n.js +2 -0
- package/dist/shared/i18n.js.map +1 -0
- package/dist/shared/jobs.d.ts +73 -0
- package/dist/shared/jobs.d.ts.map +1 -0
- package/dist/shared/jobs.js +3 -0
- package/dist/shared/jobs.js.map +1 -0
- package/dist/shared/locales/access.en-US.d.ts +47 -0
- package/dist/shared/locales/access.en-US.d.ts.map +1 -0
- package/dist/shared/locales/access.en-US.js +51 -0
- package/dist/shared/locales/access.en-US.js.map +1 -0
- package/dist/shared/locales/access.zh-CN.d.ts +4 -0
- package/dist/shared/locales/access.zh-CN.d.ts.map +1 -0
- package/dist/shared/locales/access.zh-CN.js +51 -0
- package/dist/shared/locales/access.zh-CN.js.map +1 -0
- package/dist/shared/models.d.ts +196 -0
- package/dist/shared/models.d.ts.map +1 -0
- package/dist/shared/models.js +142 -0
- package/dist/shared/models.js.map +1 -0
- package/dist/shared/presets.d.ts +30 -0
- package/dist/shared/presets.d.ts.map +1 -0
- package/dist/shared/presets.js +2 -0
- package/dist/shared/presets.js.map +1 -0
- package/dist/shared/realtime.d.ts +27 -0
- package/dist/shared/realtime.d.ts.map +1 -0
- package/dist/shared/realtime.js +7 -0
- package/dist/shared/realtime.js.map +1 -0
- package/dist/shared/reports.d.ts +293 -0
- package/dist/shared/reports.d.ts.map +1 -0
- package/dist/shared/reports.js +135 -0
- package/dist/shared/reports.js.map +1 -0
- package/dist/shared/runners.d.ts +251 -0
- package/dist/shared/runners.d.ts.map +1 -0
- package/dist/shared/runners.js +90 -0
- package/dist/shared/runners.js.map +1 -0
- package/dist/shared/runs.d.ts +226 -0
- package/dist/shared/runs.d.ts.map +1 -0
- package/dist/shared/runs.js +44 -0
- package/dist/shared/runs.js.map +1 -0
- package/dist/shared/skill-markdown.d.ts +45 -0
- package/dist/shared/skill-markdown.d.ts.map +1 -0
- package/dist/shared/skill-markdown.js +131 -0
- package/dist/shared/skill-markdown.js.map +1 -0
- package/dist/shared/skills.d.ts +155 -0
- package/dist/shared/skills.d.ts.map +1 -0
- package/dist/shared/skills.js +61 -0
- package/dist/shared/skills.js.map +1 -0
- package/dist/shared/variables.d.ts +63 -0
- package/dist/shared/variables.d.ts.map +1 -0
- package/dist/shared/variables.js +50 -0
- package/dist/shared/variables.js.map +1 -0
- package/dist/shared/vocabulary.d.ts +44 -0
- package/dist/shared/vocabulary.d.ts.map +1 -0
- package/dist/shared/vocabulary.js +2 -0
- package/dist/shared/vocabulary.js.map +1 -0
- package/package.json +202 -3
- package/skills/nocobase-app-plugin-agents/SKILL.md +34 -0
- package/skills/nocobase-app-plugin-agents/references/distribution.md +62 -0
- package/skills/nocobase-app-plugin-agents/references/extension-points.md +36 -0
- package/skills/nocobase-app-plugin-agents/references/online-agents.md +31 -0
- package/skills/nocobase-app-plugin-agents/references/runners.md +32 -0
- package/skills/nocobase-app-plugin-agents/references/setup-and-config.md +60 -0
- package/skills/nocobase-app-plugin-agents/references/variables-skills-usage.md +21 -0
- package/skills/nocobase-app-plugin-agents/references/verification-and-troubleshooting.md +46 -0
|
@@ -0,0 +1,1431 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The people-facing API, mounted at `/api/agents`: agents and their brief preview, variables, the skill library, runs,
|
|
3
|
+
* usage and prices; runners and registration tokens are in `runners/admin.ts`. Every route is behind the guard the
|
|
4
|
+
* route contribution passes (a signed-in user and their authorization context); `scoped` lets a scoped API key
|
|
5
|
+
* through as well, on the routes whose every operation is a settings check its scope narrows. What each caller may do
|
|
6
|
+
* is checked here, before the route's input is validated.
|
|
7
|
+
*
|
|
8
|
+
* - `agents.agents` read/manage: agents, skills, and every run. An agent's variables need manage.
|
|
9
|
+
* - The `agents.agents` `edit` action's level: at `all`, changing every agent and editing every skill; at `related`,
|
|
10
|
+
* the agents the caller owns and the skills they created (their settings, skills and variables; archiving, restoring
|
|
11
|
+
* and deleting the agent; saving and restoring the skill). Such an editor does not hand an agent to another owner,
|
|
12
|
+
* and adds to it only business actions they hold themselves. Every edit names the revision it was made against;
|
|
13
|
+
* the agent's history (`GET /agents/:agentId/history`) is for anyone who reads agents.
|
|
14
|
+
* - Reading agents is enough to see every runner (to pick where an agent runs).
|
|
15
|
+
* - The variables and default skills of a working directory or of a scope the application registers: the scope's kind
|
|
16
|
+
* decides who reads them and who changes them (`agents.scopes`).
|
|
17
|
+
* - Anyone signed in sees, cancels and retries the runs they started or own, and may ask for a fresh working
|
|
18
|
+
* directory on a subject they started work on.
|
|
19
|
+
* - The vocabulary (what the application calls subjects and scopes) is labels only: anyone signed in reads it, for the
|
|
20
|
+
* run panels on the application's pages.
|
|
21
|
+
* - Model services and the catalog of their models: `online/routes.ts`.
|
|
22
|
+
* - Model prices, each of a source (a model service for chat, a coding tool for work), and the coding tools paid by
|
|
23
|
+
* subscription: `agents.prices` read shows them with the models coding tools reported, manage replaces them.
|
|
24
|
+
* - Usage (`GET /agents/usage`, `shared/reports.ts`): what runs used and cost, for whoever the usage page's grant
|
|
25
|
+
* opens it to; every run for a reader of agents, otherwise the runs the caller started or owns, on subjects they may
|
|
26
|
+
* see; and `GET /agents/usage/models`, the model calls made outside runs (embeddings, reranking, utility texts), for
|
|
27
|
+
* a reader of agents. Other reports are the application's: it reads them from `agents.reporting`.
|
|
28
|
+
*/
|
|
29
|
+
import { apiErrorResponse, apiErrorResponses, apiValidator, cliRoute, dataResponse, describeRoute, emptyResponse, listResponse, } from '@nocobase/app-server/router';
|
|
30
|
+
import { bodyLimit } from 'hono/body-limit';
|
|
31
|
+
import { z } from 'zod';
|
|
32
|
+
import { policyAllowsAgent } from '@nocobase/agent-protocol';
|
|
33
|
+
import { reaches, } from '../../shared/access.js';
|
|
34
|
+
import { offersEntry } from '../../shared/models.js';
|
|
35
|
+
import { SKILL_UPLOAD_MAX_BYTES } from '../../shared/skills.js';
|
|
36
|
+
import { CONVERSATION_SUBJECT } from '../../shared/conversations.js';
|
|
37
|
+
import { AgentInputSchema, AgentPatchSchema } from '../core/agents/index.js';
|
|
38
|
+
import { ModelPricesSchema } from '../core/reports/index.js';
|
|
39
|
+
import { countActive, hasTool, onlineEntryOf } from '../core/runs/index.js';
|
|
40
|
+
import { SkillIdsSchema, SkillImportSchema, SkillInputSchema, SkillSaveSchema, } from '../core/skills/index.js';
|
|
41
|
+
import { forbidden, invalid, notFound } from '../kernel/errors.js';
|
|
42
|
+
import { decodePageToken, domainRouter, encodePageToken, } from '../kernel/http.js';
|
|
43
|
+
import { WORKDIR_TITLE } from '../kernel/scopes.js';
|
|
44
|
+
import { tags } from './openapi.js';
|
|
45
|
+
import { AgentActionOptionSchema, AgentChangeSchema, AgentHistoryQuery, AgentListQuery, AgentParams, AgentSchema, AgentSummarySchema, 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
|
+
/** A multipart body of one file, as `file`. */
|
|
47
|
+
const skillUploadBody = {
|
|
48
|
+
required: true,
|
|
49
|
+
content: {
|
|
50
|
+
'multipart/form-data': {
|
|
51
|
+
schema: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
required: ['file'],
|
|
54
|
+
properties: {
|
|
55
|
+
file: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
format: 'binary',
|
|
58
|
+
description: 'The file, or a zip to import.',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
/** Room for the multipart envelope around one file. */
|
|
66
|
+
const ENVELOPE = 64 * 1024;
|
|
67
|
+
/** `filename*` per RFC 5987, so any name survives; the plain `filename` is an ASCII fallback. */
|
|
68
|
+
function attachmentDisposition(filename) {
|
|
69
|
+
const ascii = filename.replace(/[^\x20-\x7e]|["\\]/gu, '_') || 'file';
|
|
70
|
+
const encoded = encodeURIComponent(filename).replace(/['()*]/gu, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
71
|
+
return `attachment; filename="${ascii}"; filename*=UTF-8''${encoded}`;
|
|
72
|
+
}
|
|
73
|
+
const notFoundAs = (what) => apiErrorResponse(404, `${what} does not exist, or the caller may not see it.`);
|
|
74
|
+
const revisionConflict = (what) => apiErrorResponse(409, `The ${what} changed since \`expectedRevision\` (\`REVISION_CONFLICT\`, \`metadata.revision\` the current one).`);
|
|
75
|
+
function caller(context) {
|
|
76
|
+
return context.get('caller');
|
|
77
|
+
}
|
|
78
|
+
async function requireCan(context, item, action) {
|
|
79
|
+
const who = caller(context);
|
|
80
|
+
if (!(await who.can(item, action)))
|
|
81
|
+
throw forbidden(`This needs ${item} ${action} permission.`);
|
|
82
|
+
return who;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Whether the caller may change a record of `agents.agents/edit` related to `relatedTo` (an agent's owner, a skill's
|
|
86
|
+
* creator): managers of agents and `all` change every one, a set of users the ones related to them.
|
|
87
|
+
*/
|
|
88
|
+
async function mayEdit(who, relatedTo) {
|
|
89
|
+
if (await who.can('agents.agents', 'manage'))
|
|
90
|
+
return true;
|
|
91
|
+
return reaches(await who.scope('agents.agents/edit'), relatedTo);
|
|
92
|
+
}
|
|
93
|
+
function involves(run, userId) {
|
|
94
|
+
return run.actorUserId === userId || run.ownerUserId === userId;
|
|
95
|
+
}
|
|
96
|
+
const RunPosition = z.object({ createdAt: z.string(), id: z.string() });
|
|
97
|
+
const AuditPosition = z.object({ at: z.string(), id: z.string() });
|
|
98
|
+
const ChangePosition = z.object({
|
|
99
|
+
createdAt: z.string(),
|
|
100
|
+
revision: z.number(),
|
|
101
|
+
id: z.string(),
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* `guard` authenticates the request and sets `caller`; `scoped` does too, and lets a scoped API key through. The route
|
|
105
|
+
* contribution passes the real ones, tests a fake.
|
|
106
|
+
*/
|
|
107
|
+
export function createAdminRoutes(services, guard, scoped = guard) {
|
|
108
|
+
const router = domainRouter();
|
|
109
|
+
/** Lets the request through when the caller holds `action` on `item`. */
|
|
110
|
+
const can = (item, action) => async (context, next) => {
|
|
111
|
+
await requireCan(context, item, action);
|
|
112
|
+
await next();
|
|
113
|
+
};
|
|
114
|
+
/** The run, if the caller may see it (404 otherwise, as if it did not exist). */
|
|
115
|
+
const visibleRun = async (context, action) => {
|
|
116
|
+
const who = caller(context);
|
|
117
|
+
const run = await services.runs.get(context.req.param('runId') ?? '');
|
|
118
|
+
if (involves(run, who.userId))
|
|
119
|
+
return run;
|
|
120
|
+
// A private subject's runs (a conversation) belong to the people they involve, whatever the caller manages.
|
|
121
|
+
if (isPrivate(run))
|
|
122
|
+
throw notFound('Run');
|
|
123
|
+
if (await who.can('agents.agents', action))
|
|
124
|
+
return run;
|
|
125
|
+
if (action === 'manage' && (await who.can('agents.agents', 'read')))
|
|
126
|
+
throw forbidden('This needs agents.agents manage permission.');
|
|
127
|
+
throw notFound('Run');
|
|
128
|
+
};
|
|
129
|
+
const isPrivate = (run) => services.subjects.get(run.subject.kind)?.private === true;
|
|
130
|
+
const nameOf = async (userId) => (await services.people.names(services.tx.read(), [userId])).get(userId) ??
|
|
131
|
+
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
|
+
/** 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
|
+
const editableSkill = async (context, next) => {
|
|
169
|
+
const who = caller(context);
|
|
170
|
+
const skill = await services.skills.get(context.req.param('skillId') ?? '');
|
|
171
|
+
if (!(await mayEdit(who, skill.createdById))) {
|
|
172
|
+
if (!(await who.can('agents.agents', 'read')))
|
|
173
|
+
throw notFound('Skill');
|
|
174
|
+
throw forbidden('Only its creator (with the related level of agents.agents edit) or a manager of agents may edit this skill.');
|
|
175
|
+
}
|
|
176
|
+
await next();
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* The scope of a variables or skills path, with what the caller may do there (404 when they may not see it).
|
|
180
|
+
* `withAgent`: an agent's own may be named (variables; an agent's skills are its own field).
|
|
181
|
+
*/
|
|
182
|
+
const scopeRights = async (context, withAgent) => {
|
|
183
|
+
const scope = context.req.param('scopeKind') ?? '';
|
|
184
|
+
const scopeId = context.req.param('scopeId') ?? '';
|
|
185
|
+
const allowed = services.scopes
|
|
186
|
+
.keys()
|
|
187
|
+
.filter((key) => withAgent || key !== 'agent');
|
|
188
|
+
if (!allowed.includes(scope) || !scopeId)
|
|
189
|
+
throw notFound('Scope');
|
|
190
|
+
const who = caller(context);
|
|
191
|
+
if (scope === 'agent') {
|
|
192
|
+
const agent = await services.agents.get(scopeId);
|
|
193
|
+
const manage = await mayEdit(who, agent.ownerUserId);
|
|
194
|
+
if (!manage && !(await who.can('agents.agents', 'read')))
|
|
195
|
+
throw notFound('Agent');
|
|
196
|
+
return { scope: 'agent', scopeId, manage };
|
|
197
|
+
}
|
|
198
|
+
const access = await services.scopes.access(scope, scopeId, who.userId);
|
|
199
|
+
if (!access?.visible)
|
|
200
|
+
throw notFound('Scope');
|
|
201
|
+
return { scope, scopeId, manage: access.manage };
|
|
202
|
+
};
|
|
203
|
+
/** Reads the scope of the path into `target`; with `manage`, only a caller who may change it goes on. */
|
|
204
|
+
const scopeOf = (withAgent, manage) => async (context, next) => {
|
|
205
|
+
const target = await scopeRights(context, withAgent);
|
|
206
|
+
if (manage && !target.manage)
|
|
207
|
+
throw forbidden('You may not change this.');
|
|
208
|
+
context.set('target', target);
|
|
209
|
+
await next();
|
|
210
|
+
};
|
|
211
|
+
// The business actions an agent may be configured with.
|
|
212
|
+
router.get('/actions', guard, can('agents.agents', 'read'), describeRoute({
|
|
213
|
+
tags,
|
|
214
|
+
summary: 'List the business actions an agent may be given',
|
|
215
|
+
operationId: 'agentsListActions',
|
|
216
|
+
...cliRoute({
|
|
217
|
+
command: 'agent action list',
|
|
218
|
+
columns: ['key', 'group', 'defaultOn', 'grantable', 'types'],
|
|
219
|
+
}),
|
|
220
|
+
description: 'As the application offers them. Needs `agents.agents` read.',
|
|
221
|
+
responses: {
|
|
222
|
+
200: listResponse(AgentActionOptionSchema),
|
|
223
|
+
...apiErrorResponses,
|
|
224
|
+
},
|
|
225
|
+
}), (context) => {
|
|
226
|
+
const data = services.actions.list();
|
|
227
|
+
return context.json({ data, meta: { total: data.length } });
|
|
228
|
+
});
|
|
229
|
+
// What the application calls the subjects runs work on and the scopes of variables and skills.
|
|
230
|
+
router.get('/vocabulary', guard, describeRoute({
|
|
231
|
+
tags,
|
|
232
|
+
summary: 'Get the agents vocabulary',
|
|
233
|
+
operationId: 'agentsGetVocabulary',
|
|
234
|
+
// UI-only: the labels the run panels show.
|
|
235
|
+
...cliRoute(false),
|
|
236
|
+
description: 'What the application calls the subjects runs work on, the scopes of variables and skills, and the places conversations start from. Labels only: anyone signed in reads it.',
|
|
237
|
+
responses: {
|
|
238
|
+
200: dataResponse(VocabularySchema),
|
|
239
|
+
...apiErrorResponses,
|
|
240
|
+
},
|
|
241
|
+
}), (context) => {
|
|
242
|
+
const registered = services.scopes.list();
|
|
243
|
+
const vocabulary = {
|
|
244
|
+
subjects: services.subjects.list().map((binding) => ({
|
|
245
|
+
kind: binding.kind,
|
|
246
|
+
title: binding.title ?? null,
|
|
247
|
+
groupTitle: binding.groupTitle ?? null,
|
|
248
|
+
path: binding.path ?? null,
|
|
249
|
+
groupPath: binding.groupPath ?? null,
|
|
250
|
+
triggers: binding.triggers ?? {},
|
|
251
|
+
preview: binding.preview !== undefined,
|
|
252
|
+
})),
|
|
253
|
+
sources: services.conversations.sources
|
|
254
|
+
.list()
|
|
255
|
+
.map((source) => ({ key: source.key, title: source.title })),
|
|
256
|
+
scopes: [
|
|
257
|
+
...registered.map((kind) => ({
|
|
258
|
+
key: kind.key,
|
|
259
|
+
title: kind.title,
|
|
260
|
+
description: kind.description ?? null,
|
|
261
|
+
})),
|
|
262
|
+
...(registered.some((kind) => kind.key === 'workdir')
|
|
263
|
+
? []
|
|
264
|
+
: [{ key: 'workdir', title: WORKDIR_TITLE, description: null }]),
|
|
265
|
+
],
|
|
266
|
+
};
|
|
267
|
+
return context.json({ data: vocabulary });
|
|
268
|
+
});
|
|
269
|
+
// People to pick from: the directory, every active person (a picker shows them all).
|
|
270
|
+
router.get('/users', guard, can('agents.agents', 'read'), describeRoute({
|
|
271
|
+
tags,
|
|
272
|
+
summary: 'List the people agents can be given to',
|
|
273
|
+
operationId: 'agentsListUsers',
|
|
274
|
+
// UI-only: the people picker.
|
|
275
|
+
...cliRoute(false),
|
|
276
|
+
description: 'Every active person in the directory, for pickers. Needs `agents.agents` read.',
|
|
277
|
+
responses: { 200: listResponse(UserRefSchema), ...apiErrorResponses },
|
|
278
|
+
}), async (context) => {
|
|
279
|
+
const data = await services.people.list(services.tx.read());
|
|
280
|
+
return context.json({ data, meta: { total: data.length } });
|
|
281
|
+
});
|
|
282
|
+
// Variables of an agent, a working directory, or a scope the application registers.
|
|
283
|
+
const scopedRouter = router;
|
|
284
|
+
const variableParam = apiValidator('param', VariableParams);
|
|
285
|
+
const scopeParam = apiValidator('param', ScopeParams);
|
|
286
|
+
const scopeAccess = "The scope kind (`agent`, `workdir` or one the application registers, see the vocabulary) decides who may read and change it; an agent's own needs edit rights on the agent.";
|
|
287
|
+
const noScope = notFoundAs('The scope');
|
|
288
|
+
scopedRouter.get('/variables/:scopeKind/:scopeId', guard, scopeOf(true, false), describeRoute({
|
|
289
|
+
tags,
|
|
290
|
+
summary: "List a scope's variables",
|
|
291
|
+
operationId: 'agentsListVariables',
|
|
292
|
+
...cliRoute({
|
|
293
|
+
command: 'variable list',
|
|
294
|
+
flags: {
|
|
295
|
+
scopeKind: {
|
|
296
|
+
name: 'kind',
|
|
297
|
+
description: 'The scope kind: `agent`, `workdir`, or one the application registers.',
|
|
298
|
+
},
|
|
299
|
+
scopeId: {
|
|
300
|
+
name: 'scope',
|
|
301
|
+
description: 'The scope: an agent id, a working directory id, or the id the application gives.',
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
columns: ['name', 'updatedByName', 'updatedAt'],
|
|
305
|
+
examples: ['variable list agent <agent>'],
|
|
306
|
+
}),
|
|
307
|
+
description: `Names and who changed them, never values. ${scopeAccess}`,
|
|
308
|
+
responses: {
|
|
309
|
+
200: listResponse(VariableSchema),
|
|
310
|
+
404: noScope,
|
|
311
|
+
...apiErrorResponses,
|
|
312
|
+
},
|
|
313
|
+
}), scopeParam, async (context) => {
|
|
314
|
+
const data = await services.variables.list(context.get('target'));
|
|
315
|
+
return context.json({ data, meta: { total: data.length } });
|
|
316
|
+
});
|
|
317
|
+
scopedRouter.get('/variables/:scopeKind/:scopeId/audits', guard, scopeOf(true, true), describeRoute({
|
|
318
|
+
tags,
|
|
319
|
+
summary: "List a scope's variable audit",
|
|
320
|
+
operationId: 'agentsListVariableAudits',
|
|
321
|
+
...cliRoute({
|
|
322
|
+
command: 'variable audit list',
|
|
323
|
+
flags: {
|
|
324
|
+
scopeKind: {
|
|
325
|
+
name: 'kind',
|
|
326
|
+
description: 'The scope kind: `agent`, `workdir`, or one the application registers.',
|
|
327
|
+
},
|
|
328
|
+
scopeId: {
|
|
329
|
+
name: 'scope',
|
|
330
|
+
description: 'The scope: an agent id, a working directory id, or the id the application gives.',
|
|
331
|
+
},
|
|
332
|
+
pageSize: { name: 'limit' },
|
|
333
|
+
},
|
|
334
|
+
columns: ['at', 'action', 'names', 'userName', 'runId'],
|
|
335
|
+
}),
|
|
336
|
+
description: `Who set, deleted, revealed or received the scope's variables, newest first. Needs the right to change the scope. ${scopeAccess}`,
|
|
337
|
+
responses: {
|
|
338
|
+
200: listResponse(VariableAuditSchema, PageTokenMetaSchema),
|
|
339
|
+
404: noScope,
|
|
340
|
+
...apiErrorResponses,
|
|
341
|
+
},
|
|
342
|
+
}), scopeParam, apiValidator('query', AuditListQuery), async (context) => {
|
|
343
|
+
const { pageSize, pageToken } = context.req.valid('query');
|
|
344
|
+
const rows = await services.variables.audits(context.get('target'), pageSize + 1, pageToken === undefined
|
|
345
|
+
? undefined
|
|
346
|
+
: decodePageToken(pageToken, AuditPosition));
|
|
347
|
+
const data = rows.slice(0, pageSize);
|
|
348
|
+
const last = data.at(-1);
|
|
349
|
+
return context.json({
|
|
350
|
+
data,
|
|
351
|
+
meta: rows.length > pageSize && last
|
|
352
|
+
? { nextPageToken: encodePageToken({ at: last.at, id: last.id }) }
|
|
353
|
+
: {},
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
scopedRouter.post('/variables/:scopeKind/:scopeId/reveal', guard, scopeOf(true, true), describeRoute({
|
|
357
|
+
tags,
|
|
358
|
+
summary: "Reveal a scope's variable values",
|
|
359
|
+
operationId: 'agentsRevealVariables',
|
|
360
|
+
...cliRoute({
|
|
361
|
+
command: 'variable reveal',
|
|
362
|
+
flags: {
|
|
363
|
+
scopeKind: {
|
|
364
|
+
name: 'kind',
|
|
365
|
+
description: 'The scope kind: `agent`, `workdir`, or one the application registers.',
|
|
366
|
+
},
|
|
367
|
+
scopeId: {
|
|
368
|
+
name: 'scope',
|
|
369
|
+
description: 'The scope: an agent id, a working directory id, or the id the application gives.',
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
confirm: 'Show every value of this scope? The reveal is recorded in its audit.',
|
|
373
|
+
}),
|
|
374
|
+
description: `Every value of the scope, recorded in its audit as revealed by the caller. Needs the right to change the scope. ${scopeAccess}`,
|
|
375
|
+
responses: {
|
|
376
|
+
200: dataResponse(z.array(VariableValueSchema)),
|
|
377
|
+
404: noScope,
|
|
378
|
+
...apiErrorResponses,
|
|
379
|
+
},
|
|
380
|
+
}), scopeParam, async (context) => context.json({
|
|
381
|
+
data: await services.variables.reveal(context.get('target'), caller(context).userId),
|
|
382
|
+
}));
|
|
383
|
+
scopedRouter.put('/variables/:scopeKind/:scopeId/:variableName', guard, scopeOf(true, true), describeRoute({
|
|
384
|
+
tags,
|
|
385
|
+
summary: 'Set a variable',
|
|
386
|
+
operationId: 'agentsSetVariable',
|
|
387
|
+
...cliRoute({
|
|
388
|
+
command: 'variable set',
|
|
389
|
+
flags: {
|
|
390
|
+
scopeKind: {
|
|
391
|
+
name: 'kind',
|
|
392
|
+
description: 'The scope kind: `agent`, `workdir`, or one the application registers.',
|
|
393
|
+
},
|
|
394
|
+
scopeId: {
|
|
395
|
+
name: 'scope',
|
|
396
|
+
description: 'The scope: an agent id, a working directory id, or the id the application gives.',
|
|
397
|
+
},
|
|
398
|
+
variableName: { name: 'name' },
|
|
399
|
+
value: {
|
|
400
|
+
prompt: true,
|
|
401
|
+
contentFile: true,
|
|
402
|
+
description: 'The value; stored encrypted and never shown again. Asked for when left out.',
|
|
403
|
+
},
|
|
404
|
+
teamRunnersOnly: {
|
|
405
|
+
description: 'Only team runners receive it; personal runners leave a run that gets it.',
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
examples: [
|
|
409
|
+
'variable set agent <agent> NPM_TOKEN --value-file token.txt',
|
|
410
|
+
'variable set agent <agent> DEPLOY_KEY --value-file key.txt --team-runners-only',
|
|
411
|
+
],
|
|
412
|
+
}),
|
|
413
|
+
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. Needs the right to change the scope. ${scopeAccess}`,
|
|
414
|
+
responses: {
|
|
415
|
+
200: dataResponse(VariableSchema.nullable()),
|
|
416
|
+
404: noScope,
|
|
417
|
+
...apiErrorResponses,
|
|
418
|
+
},
|
|
419
|
+
}), variableParam, apiValidator('json', VariableValueInput), async (context) => {
|
|
420
|
+
const target = context.get('target');
|
|
421
|
+
const { variableName } = context.req.valid('param');
|
|
422
|
+
const body = context.req.valid('json');
|
|
423
|
+
await services.variables.set(target, variableName, body.value, caller(context).userId, body.teamRunnersOnly === undefined
|
|
424
|
+
? {}
|
|
425
|
+
: { teamRunnersOnly: body.teamRunnersOnly });
|
|
426
|
+
const variable = (await services.variables.list(target)).find((item) => item.name === variableName);
|
|
427
|
+
return context.json({ data: variable ?? null });
|
|
428
|
+
});
|
|
429
|
+
scopedRouter.delete('/variables/:scopeKind/:scopeId/:variableName', guard, scopeOf(true, true), describeRoute({
|
|
430
|
+
tags,
|
|
431
|
+
summary: 'Delete a variable',
|
|
432
|
+
operationId: 'agentsDeleteVariable',
|
|
433
|
+
...cliRoute({
|
|
434
|
+
command: 'variable delete',
|
|
435
|
+
flags: {
|
|
436
|
+
scopeKind: {
|
|
437
|
+
name: 'kind',
|
|
438
|
+
description: 'The scope kind: `agent`, `workdir`, or one the application registers.',
|
|
439
|
+
},
|
|
440
|
+
scopeId: {
|
|
441
|
+
name: 'scope',
|
|
442
|
+
description: 'The scope: an agent id, a working directory id, or the id the application gives.',
|
|
443
|
+
},
|
|
444
|
+
variableName: { name: 'name' },
|
|
445
|
+
},
|
|
446
|
+
confirm: 'Delete this variable?',
|
|
447
|
+
}),
|
|
448
|
+
description: `Needs the right to change the scope. ${scopeAccess}`,
|
|
449
|
+
responses: {
|
|
450
|
+
204: emptyResponse(),
|
|
451
|
+
404: noScope,
|
|
452
|
+
...apiErrorResponses,
|
|
453
|
+
},
|
|
454
|
+
}), variableParam, async (context) => {
|
|
455
|
+
await services.variables.remove(context.get('target'), context.req.valid('param').variableName, caller(context).userId);
|
|
456
|
+
return context.body(null, 204);
|
|
457
|
+
});
|
|
458
|
+
// Skills.
|
|
459
|
+
/** The skill with whether the caller may edit it. */
|
|
460
|
+
const viewOf = async (context, id) => {
|
|
461
|
+
const skill = await services.skills.get(id);
|
|
462
|
+
return {
|
|
463
|
+
...skill,
|
|
464
|
+
canEdit: await mayEdit(caller(context), skill.createdById),
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
const skillParam = apiValidator('param', SkillParams);
|
|
468
|
+
const versionParam = apiValidator('param', SkillVersionParams);
|
|
469
|
+
const noSkill = notFoundAs('The skill');
|
|
470
|
+
router.get('/skills', scoped, can('agents.agents', 'read'), describeRoute({
|
|
471
|
+
tags,
|
|
472
|
+
summary: 'List skills',
|
|
473
|
+
operationId: 'agentsListSkills',
|
|
474
|
+
...cliRoute({
|
|
475
|
+
command: 'skill list',
|
|
476
|
+
columns: ['id', 'name', 'version', 'agentCount', 'updatedAt'],
|
|
477
|
+
}),
|
|
478
|
+
description: 'The skill library. Needs `agents.agents` read.',
|
|
479
|
+
responses: { 200: listResponse(SkillSchema), ...apiErrorResponses },
|
|
480
|
+
}), async (context) => {
|
|
481
|
+
const data = await services.skills.list();
|
|
482
|
+
return context.json({ data, meta: { total: data.length } });
|
|
483
|
+
});
|
|
484
|
+
router.post('/skills', scoped, can('agents.agents', 'manage'), describeRoute({
|
|
485
|
+
tags,
|
|
486
|
+
summary: 'Create a skill',
|
|
487
|
+
operationId: 'agentsCreateSkill',
|
|
488
|
+
...cliRoute({
|
|
489
|
+
command: 'skill create',
|
|
490
|
+
bodyFile: 'file',
|
|
491
|
+
flags: { content: { contentFile: true } },
|
|
492
|
+
examples: ['skill create --content-file SKILL.md'],
|
|
493
|
+
}),
|
|
494
|
+
description: "Named and described by its SKILL.md front matter, checked against the Agent Skills specification: a problem answers 400 with each one's `field` and `reason` in `metadata.problems` (`taken` when another skill has the name). Needs `agents.agents` manage.",
|
|
495
|
+
responses: {
|
|
496
|
+
201: dataResponse(SkillDetailSchema, 'Created.'),
|
|
497
|
+
...apiErrorResponses,
|
|
498
|
+
},
|
|
499
|
+
}), apiValidator('json', SkillInputSchema), async (context) => context.json({
|
|
500
|
+
data: await services.skills.create(caller(context).userId, context.req.valid('json')),
|
|
501
|
+
}, 201));
|
|
502
|
+
router.get('/skills/:skillId', scoped, can('agents.agents', 'read'), describeRoute({
|
|
503
|
+
tags,
|
|
504
|
+
summary: 'Get a skill',
|
|
505
|
+
operationId: 'agentsGetSkill',
|
|
506
|
+
...cliRoute({
|
|
507
|
+
command: 'skill get',
|
|
508
|
+
args: ['skillId'],
|
|
509
|
+
flags: { skillId: { name: 'skill' } },
|
|
510
|
+
}),
|
|
511
|
+
description: 'Its body, files and where it is attached, with whether the caller may edit it. Needs `agents.agents` read.',
|
|
512
|
+
responses: {
|
|
513
|
+
200: dataResponse(SkillViewSchema),
|
|
514
|
+
404: noSkill,
|
|
515
|
+
...apiErrorResponses,
|
|
516
|
+
},
|
|
517
|
+
}), skillParam, async (context) => context.json({
|
|
518
|
+
data: await viewOf(context, context.req.valid('param').skillId),
|
|
519
|
+
}));
|
|
520
|
+
router.patch('/skills/:skillId', scoped, editableSkill, describeRoute({
|
|
521
|
+
tags,
|
|
522
|
+
summary: 'Save a skill',
|
|
523
|
+
operationId: 'agentsSaveSkill',
|
|
524
|
+
...cliRoute({
|
|
525
|
+
command: 'skill update',
|
|
526
|
+
args: ['skillId'],
|
|
527
|
+
flags: {
|
|
528
|
+
skillId: { name: 'skill' },
|
|
529
|
+
content: { contentFile: true },
|
|
530
|
+
expectedRevision: { name: 'revision' },
|
|
531
|
+
},
|
|
532
|
+
bodyFile: 'file',
|
|
533
|
+
examples: ['skill update <skill> --content-file SKILL.md --revision 3'],
|
|
534
|
+
}),
|
|
535
|
+
description: "Saves a new version with everything it holds, its SKILL.md checked as a new skill's is; a new front matter `name` renames the skill. Its creator (at the related level of `agents.agents` edit) or a manager of agents may.",
|
|
536
|
+
responses: {
|
|
537
|
+
200: dataResponse(SkillViewSchema),
|
|
538
|
+
404: noSkill,
|
|
539
|
+
409: revisionConflict('skill'),
|
|
540
|
+
...apiErrorResponses,
|
|
541
|
+
},
|
|
542
|
+
}), skillParam, apiValidator('json', SkillSaveSchema), async (context) => {
|
|
543
|
+
const saved = await services.skills.save(context.req.valid('param').skillId, caller(context).userId, context.req.valid('json'));
|
|
544
|
+
return context.json({ data: await viewOf(context, saved.id) });
|
|
545
|
+
});
|
|
546
|
+
router.delete('/skills/:skillId', scoped, can('agents.agents', 'manage'), describeRoute({
|
|
547
|
+
tags,
|
|
548
|
+
summary: 'Delete a skill',
|
|
549
|
+
operationId: 'agentsDeleteSkill',
|
|
550
|
+
...cliRoute({
|
|
551
|
+
command: 'skill delete',
|
|
552
|
+
args: ['skillId'],
|
|
553
|
+
flags: { skillId: { name: 'skill' } },
|
|
554
|
+
confirm: 'Delete this skill from the library?',
|
|
555
|
+
}),
|
|
556
|
+
description: 'Needs `agents.agents` manage.',
|
|
557
|
+
responses: {
|
|
558
|
+
204: emptyResponse(),
|
|
559
|
+
404: noSkill,
|
|
560
|
+
...apiErrorResponses,
|
|
561
|
+
},
|
|
562
|
+
}), skillParam, async (context) => {
|
|
563
|
+
await services.skills.remove(context.req.valid('param').skillId);
|
|
564
|
+
return context.body(null, 204);
|
|
565
|
+
});
|
|
566
|
+
router.get('/skills/:skillId/versions', scoped, can('agents.agents', 'read'), describeRoute({
|
|
567
|
+
tags,
|
|
568
|
+
summary: "List a skill's versions",
|
|
569
|
+
operationId: 'agentsListSkillVersions',
|
|
570
|
+
...cliRoute({
|
|
571
|
+
command: 'skill version list',
|
|
572
|
+
args: ['skillId'],
|
|
573
|
+
flags: { skillId: { name: 'skill' } },
|
|
574
|
+
columns: ['version', 'name', 'note', 'createdByName', 'createdAt'],
|
|
575
|
+
}),
|
|
576
|
+
description: 'Newest first. Needs `agents.agents` read.',
|
|
577
|
+
responses: {
|
|
578
|
+
200: listResponse(SkillVersionSchema),
|
|
579
|
+
404: noSkill,
|
|
580
|
+
...apiErrorResponses,
|
|
581
|
+
},
|
|
582
|
+
}), skillParam, async (context) => {
|
|
583
|
+
const data = await services.skills.versions(context.req.valid('param').skillId);
|
|
584
|
+
return context.json({ data, meta: { total: data.length } });
|
|
585
|
+
});
|
|
586
|
+
router.get('/skills/:skillId/versions/:version', scoped, can('agents.agents', 'read'), describeRoute({
|
|
587
|
+
tags,
|
|
588
|
+
summary: 'Get a skill version',
|
|
589
|
+
operationId: 'agentsGetSkillVersion',
|
|
590
|
+
...cliRoute({
|
|
591
|
+
command: 'skill version get',
|
|
592
|
+
args: ['skillId', 'version'],
|
|
593
|
+
flags: { skillId: { name: 'skill' } },
|
|
594
|
+
}),
|
|
595
|
+
description: 'Needs `agents.agents` read.',
|
|
596
|
+
responses: {
|
|
597
|
+
200: dataResponse(SkillVersionDetailSchema),
|
|
598
|
+
404: notFoundAs('The skill or version'),
|
|
599
|
+
...apiErrorResponses,
|
|
600
|
+
},
|
|
601
|
+
}), versionParam, async (context) => {
|
|
602
|
+
const { skillId, version } = context.req.valid('param');
|
|
603
|
+
return context.json({
|
|
604
|
+
data: await services.skills.version(skillId, version),
|
|
605
|
+
});
|
|
606
|
+
});
|
|
607
|
+
router.post('/skills/:skillId/versions/:version/restore', scoped, editableSkill, describeRoute({
|
|
608
|
+
tags,
|
|
609
|
+
summary: 'Restore a skill version',
|
|
610
|
+
operationId: 'agentsRestoreSkillVersion',
|
|
611
|
+
...cliRoute({
|
|
612
|
+
command: 'skill version restore',
|
|
613
|
+
args: ['skillId', 'version'],
|
|
614
|
+
flags: {
|
|
615
|
+
skillId: { name: 'skill' },
|
|
616
|
+
expectedRevision: { name: 'revision' },
|
|
617
|
+
},
|
|
618
|
+
confirm: 'Make this version the current one?',
|
|
619
|
+
}),
|
|
620
|
+
description: 'The version becomes current again, as a new version. Its creator (at the related level of `agents.agents` edit) or a manager of agents may.',
|
|
621
|
+
responses: {
|
|
622
|
+
200: dataResponse(SkillViewSchema),
|
|
623
|
+
400: apiErrorResponse(400, 'The version is the current one (`SKILL_VERSION_CURRENT`).'),
|
|
624
|
+
404: notFoundAs('The skill or version'),
|
|
625
|
+
409: revisionConflict('skill'),
|
|
626
|
+
...apiErrorResponses,
|
|
627
|
+
},
|
|
628
|
+
}), versionParam, apiValidator('json', SkillRestoreInput), async (context) => {
|
|
629
|
+
const { skillId, version } = context.req.valid('param');
|
|
630
|
+
const restored = await services.skills.restore(skillId, version, caller(context).userId, context.req.valid('json').expectedRevision);
|
|
631
|
+
return context.json({ data: await viewOf(context, restored.id) });
|
|
632
|
+
});
|
|
633
|
+
/** A caller who may create skills, or edit some: who may store their files. */
|
|
634
|
+
const mayUpload = async (context, next) => {
|
|
635
|
+
const who = caller(context);
|
|
636
|
+
if (!(await who.can('agents.agents', 'manage')) &&
|
|
637
|
+
(await who.scope('agents.agents/edit')) === 'none')
|
|
638
|
+
throw forbidden('This needs agents.agents manage, or the edit action on skills.');
|
|
639
|
+
await next();
|
|
640
|
+
};
|
|
641
|
+
router.post('/skills/uploads', scoped, mayUpload, describeRoute({
|
|
642
|
+
tags,
|
|
643
|
+
summary: 'Upload a skill file or archive',
|
|
644
|
+
operationId: 'agentsUploadSkillFile',
|
|
645
|
+
...cliRoute({ command: 'skill upload' }),
|
|
646
|
+
description: `Stores one file (the \`file\` field of a multipart body, at most ${SKILL_UPLOAD_MAX_BYTES} bytes) once per content and answers its SHA-256 as \`id\`: a save names it as a file's \`hash\`, an import as its \`archive\`. What no version names is deleted after an hour. Needs \`agents.agents\` manage, or the edit action on skills.`,
|
|
647
|
+
requestBody: skillUploadBody,
|
|
648
|
+
responses: {
|
|
649
|
+
201: dataResponse(SkillUploadSchema, 'Stored.'),
|
|
650
|
+
413: apiErrorResponse(413, `The file is over ${SKILL_UPLOAD_MAX_BYTES} bytes (\`FILE_TOO_LARGE\`).`),
|
|
651
|
+
...apiErrorResponses,
|
|
652
|
+
},
|
|
653
|
+
}), bodyLimit({
|
|
654
|
+
maxSize: SKILL_UPLOAD_MAX_BYTES + ENVELOPE,
|
|
655
|
+
onError: () => {
|
|
656
|
+
throw invalid(`An upload is at most ${SKILL_UPLOAD_MAX_BYTES} bytes.`, {
|
|
657
|
+
reason: 'FILE_TOO_LARGE',
|
|
658
|
+
maxBytes: SKILL_UPLOAD_MAX_BYTES,
|
|
659
|
+
});
|
|
660
|
+
},
|
|
661
|
+
}), async (context) => {
|
|
662
|
+
let body;
|
|
663
|
+
try {
|
|
664
|
+
body = await context.req.parseBody();
|
|
665
|
+
}
|
|
666
|
+
catch {
|
|
667
|
+
throw invalid('Send one file as multipart form data, as `file`.');
|
|
668
|
+
}
|
|
669
|
+
const file = body.file;
|
|
670
|
+
if (!(file instanceof File))
|
|
671
|
+
throw invalid('Send one file as multipart form data, as `file`.');
|
|
672
|
+
return context.json({
|
|
673
|
+
data: await services.skills.upload(new Uint8Array(await file.arrayBuffer())),
|
|
674
|
+
}, 201);
|
|
675
|
+
});
|
|
676
|
+
router.post('/skills/import', scoped, describeRoute({
|
|
677
|
+
tags,
|
|
678
|
+
summary: 'Import a skill',
|
|
679
|
+
operationId: 'agentsImportSkill',
|
|
680
|
+
...cliRoute({
|
|
681
|
+
command: 'skill import',
|
|
682
|
+
flags: {
|
|
683
|
+
skillId: {
|
|
684
|
+
name: 'skill',
|
|
685
|
+
description: 'Import as a new version of this skill instead of a new skill.',
|
|
686
|
+
},
|
|
687
|
+
expectedRevision: { name: 'revision' },
|
|
688
|
+
},
|
|
689
|
+
uploads: {
|
|
690
|
+
archive: {
|
|
691
|
+
upload: 'agentsUploadSkillFile',
|
|
692
|
+
field: 'archive',
|
|
693
|
+
maxBytes: SKILL_UPLOAD_MAX_BYTES,
|
|
694
|
+
description: "The zip: SKILL.md (with `name` and `description` in its front matter) at its root or in a single top folder named as `name`, beside the skill's files.",
|
|
695
|
+
},
|
|
696
|
+
},
|
|
697
|
+
examples: [
|
|
698
|
+
'skill import --archive release-notes.zip',
|
|
699
|
+
'skill import --archive release-notes.zip --skill <skill> --revision 3',
|
|
700
|
+
],
|
|
701
|
+
}),
|
|
702
|
+
description: 'A zip in the Agent Skills layout, uploaded first (`agentsUploadSkillFile`): a new skill named by its front matter, or with `skillId` a new version of that skill, checked as a save is. Executable files stay executable. A new skill needs `agents.agents` manage; a new version, the right to edit the skill.',
|
|
703
|
+
responses: {
|
|
704
|
+
201: dataResponse(SkillViewSchema, 'Imported.'),
|
|
705
|
+
404: noSkill,
|
|
706
|
+
409: revisionConflict('skill'),
|
|
707
|
+
...apiErrorResponses,
|
|
708
|
+
},
|
|
709
|
+
}), apiValidator('json', SkillImportSchema), async (context) => {
|
|
710
|
+
const input = context.req.valid('json');
|
|
711
|
+
const who = caller(context);
|
|
712
|
+
if (input.skillId) {
|
|
713
|
+
const skill = await services.skills.get(input.skillId);
|
|
714
|
+
if (!(await mayEdit(who, skill.createdById))) {
|
|
715
|
+
if (!(await who.can('agents.agents', 'read')))
|
|
716
|
+
throw notFound('Skill');
|
|
717
|
+
throw forbidden('Only its creator (with the related level of agents.agents edit) or a manager of agents may edit this skill.');
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
else
|
|
721
|
+
await requireCan(context, 'agents.agents', 'manage');
|
|
722
|
+
const imported = await services.skills.importArchive(who.userId, input);
|
|
723
|
+
return context.json({ data: await viewOf(context, imported.id) }, 201);
|
|
724
|
+
});
|
|
725
|
+
router.get('/skills/:skillId/archive', scoped, can('agents.agents', 'read'), describeRoute({
|
|
726
|
+
tags,
|
|
727
|
+
summary: 'Export a skill',
|
|
728
|
+
operationId: 'agentsExportSkill',
|
|
729
|
+
...cliRoute({
|
|
730
|
+
command: 'skill export',
|
|
731
|
+
args: ['skillId'],
|
|
732
|
+
flags: { skillId: { name: 'skill' } },
|
|
733
|
+
examples: ['skill export <skill> --version 2 --out skills/'],
|
|
734
|
+
}),
|
|
735
|
+
description: 'A version (the current one by default) as a zip in the Agent Skills layout: `<slug>/SKILL.md` with its front matter, and its files, executable ones with the executable bit. Needs `agents.agents` read.',
|
|
736
|
+
responses: {
|
|
737
|
+
200: {
|
|
738
|
+
description: 'The zip.',
|
|
739
|
+
headers: {
|
|
740
|
+
'Content-Disposition': {
|
|
741
|
+
description: '`attachment`, named `<slug>-v<version>.zip`.',
|
|
742
|
+
schema: { type: 'string' },
|
|
743
|
+
},
|
|
744
|
+
},
|
|
745
|
+
content: {
|
|
746
|
+
'application/zip': {
|
|
747
|
+
schema: { type: 'string', format: 'binary' },
|
|
748
|
+
},
|
|
749
|
+
},
|
|
750
|
+
},
|
|
751
|
+
404: notFoundAs('The skill or version'),
|
|
752
|
+
...apiErrorResponses,
|
|
753
|
+
},
|
|
754
|
+
}), skillParam, apiValidator('query', SkillArchiveQuery), async (context) => {
|
|
755
|
+
const archive = await services.skills.exportArchive(context.req.valid('param').skillId, context.req.valid('query').version);
|
|
756
|
+
return new Response(Buffer.from(archive.bytes), {
|
|
757
|
+
headers: {
|
|
758
|
+
'Content-Type': 'application/zip',
|
|
759
|
+
'Content-Length': String(archive.bytes.length),
|
|
760
|
+
'Content-Disposition': attachmentDisposition(archive.filename),
|
|
761
|
+
},
|
|
762
|
+
});
|
|
763
|
+
});
|
|
764
|
+
router.get('/skills/:skillId/versions/:version/file', scoped, can('agents.agents', 'read'), describeRoute({
|
|
765
|
+
tags,
|
|
766
|
+
summary: 'Download a skill file',
|
|
767
|
+
operationId: 'agentsGetSkillFile',
|
|
768
|
+
...cliRoute({
|
|
769
|
+
command: 'skill file get',
|
|
770
|
+
args: ['skillId', 'version'],
|
|
771
|
+
flags: { skillId: { name: 'skill' } },
|
|
772
|
+
examples: ['skill file get <skill> 3 --path assets/logo.png --out .'],
|
|
773
|
+
}),
|
|
774
|
+
description: "One file of a version, as it is stored, named by its path's last part. Needs `agents.agents` read.",
|
|
775
|
+
responses: {
|
|
776
|
+
200: {
|
|
777
|
+
description: 'The file.',
|
|
778
|
+
content: {
|
|
779
|
+
'application/octet-stream': {
|
|
780
|
+
schema: { type: 'string', format: 'binary' },
|
|
781
|
+
},
|
|
782
|
+
},
|
|
783
|
+
},
|
|
784
|
+
404: notFoundAs('The skill, version or file'),
|
|
785
|
+
...apiErrorResponses,
|
|
786
|
+
},
|
|
787
|
+
}), versionParam, apiValidator('query', SkillFileQuery), async (context) => {
|
|
788
|
+
const { skillId, version } = context.req.valid('param');
|
|
789
|
+
const file = await services.skills.file(skillId, version, context.req.valid('query').path);
|
|
790
|
+
return new Response(Buffer.from(file.bytes), {
|
|
791
|
+
headers: {
|
|
792
|
+
'Content-Type': 'application/octet-stream',
|
|
793
|
+
'Content-Length': String(file.bytes.length),
|
|
794
|
+
'Content-Disposition': attachmentDisposition(file.path.split('/').pop() ?? 'file'),
|
|
795
|
+
},
|
|
796
|
+
});
|
|
797
|
+
});
|
|
798
|
+
// Default skills of a working directory, or of a scope the application registers.
|
|
799
|
+
scopedRouter.get('/skillAttachments/:scopeKind/:scopeId', guard, scopeOf(false, false), describeRoute({
|
|
800
|
+
tags,
|
|
801
|
+
summary: "Get a scope's default skills",
|
|
802
|
+
operationId: 'agentsGetSkillAttachments',
|
|
803
|
+
...cliRoute({
|
|
804
|
+
command: 'skill attachment get',
|
|
805
|
+
flags: {
|
|
806
|
+
scopeKind: {
|
|
807
|
+
name: 'kind',
|
|
808
|
+
description: 'The scope kind: `agent`, `workdir`, or one the application registers.',
|
|
809
|
+
},
|
|
810
|
+
scopeId: {
|
|
811
|
+
name: 'scope',
|
|
812
|
+
description: 'The scope: an agent id, a working directory id, or the id the application gives.',
|
|
813
|
+
},
|
|
814
|
+
},
|
|
815
|
+
}),
|
|
816
|
+
description: "The skills every run working in the scope gets (a working directory, or a scope the application registers; an agent's own skills are its `skillIds`).",
|
|
817
|
+
responses: {
|
|
818
|
+
200: dataResponse(SkillAttachmentsSchema),
|
|
819
|
+
404: noScope,
|
|
820
|
+
...apiErrorResponses,
|
|
821
|
+
},
|
|
822
|
+
}), scopeParam, async (context) => context.json({
|
|
823
|
+
data: {
|
|
824
|
+
skillIds: await services.skills.attached(context.get('target')),
|
|
825
|
+
},
|
|
826
|
+
}));
|
|
827
|
+
scopedRouter.put('/skillAttachments/:scopeKind/:scopeId', guard, scopeOf(false, true), describeRoute({
|
|
828
|
+
tags,
|
|
829
|
+
summary: "Replace a scope's default skills",
|
|
830
|
+
operationId: 'agentsReplaceSkillAttachments',
|
|
831
|
+
...cliRoute({
|
|
832
|
+
command: 'skill attachment set',
|
|
833
|
+
flags: {
|
|
834
|
+
scopeKind: {
|
|
835
|
+
name: 'kind',
|
|
836
|
+
description: 'The scope kind: `agent`, `workdir`, or one the application registers.',
|
|
837
|
+
},
|
|
838
|
+
scopeId: {
|
|
839
|
+
name: 'scope',
|
|
840
|
+
description: 'The scope: an agent id, a working directory id, or the id the application gives.',
|
|
841
|
+
},
|
|
842
|
+
skillIds: { name: 'skills' },
|
|
843
|
+
},
|
|
844
|
+
examples: [
|
|
845
|
+
'skill attachment set workdir <workdir> --skills <skill>,<skill>',
|
|
846
|
+
],
|
|
847
|
+
}),
|
|
848
|
+
description: 'Makes `skillIds` the skills attached to the scope. Needs the right to change the scope.',
|
|
849
|
+
responses: {
|
|
850
|
+
200: dataResponse(SkillAttachmentsSchema),
|
|
851
|
+
400: apiErrorResponse(400, 'A skill id is unknown (`INVALID_ARGUMENT`).'),
|
|
852
|
+
404: noScope,
|
|
853
|
+
...apiErrorResponses,
|
|
854
|
+
},
|
|
855
|
+
}), scopeParam, apiValidator('json', SkillIdsSchema), async (context) => context.json({
|
|
856
|
+
data: {
|
|
857
|
+
skillIds: await services.skills.attach(context.get('target'), context.req.valid('json').skillIds),
|
|
858
|
+
},
|
|
859
|
+
}));
|
|
860
|
+
// Runs.
|
|
861
|
+
const runParam = apiValidator('param', RunParams);
|
|
862
|
+
const noRun = notFoundAs('The run');
|
|
863
|
+
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.";
|
|
864
|
+
/** Only a caller who may see the run of the path (or, with `manage`, act on it) goes on. */
|
|
865
|
+
const runAccess = (action) => async (context, next) => {
|
|
866
|
+
await visibleRun(context, action);
|
|
867
|
+
await next();
|
|
868
|
+
};
|
|
869
|
+
router.get('/runs', guard, describeRoute({
|
|
870
|
+
tags,
|
|
871
|
+
summary: 'List runs',
|
|
872
|
+
operationId: 'agentsListRuns',
|
|
873
|
+
...cliRoute({
|
|
874
|
+
command: 'run list',
|
|
875
|
+
flags: {
|
|
876
|
+
subjectId: { name: 'subject' },
|
|
877
|
+
agentId: { name: 'agent' },
|
|
878
|
+
pageSize: { name: 'limit' },
|
|
879
|
+
},
|
|
880
|
+
columns: [
|
|
881
|
+
'id',
|
|
882
|
+
'agentId',
|
|
883
|
+
'subject.kind',
|
|
884
|
+
'subject.id',
|
|
885
|
+
'status',
|
|
886
|
+
'createdAt',
|
|
887
|
+
],
|
|
888
|
+
examples: ['run list --status failed', 'run list --agent <agent>'],
|
|
889
|
+
}),
|
|
890
|
+
description: `Newest first, a page at a time. ${runVisibility}`,
|
|
891
|
+
responses: {
|
|
892
|
+
200: listResponse(RunSchema, PageTokenMetaSchema),
|
|
893
|
+
...apiErrorResponses,
|
|
894
|
+
},
|
|
895
|
+
}), apiValidator('query', RunListQuery), async (context) => {
|
|
896
|
+
const who = caller(context);
|
|
897
|
+
const query = context.req.valid('query');
|
|
898
|
+
const all = await who.can('agents.agents', 'read');
|
|
899
|
+
const runs = await services.runs.list({
|
|
900
|
+
...(query.subjectKind ? { subjectKind: query.subjectKind } : {}),
|
|
901
|
+
...(query.subjectId ? { subjectId: query.subjectId } : {}),
|
|
902
|
+
...(query.agentId ? { agentId: query.agentId } : {}),
|
|
903
|
+
...(query.status ? { status: query.status } : {}),
|
|
904
|
+
limit: query.pageSize + 1,
|
|
905
|
+
...(query.pageToken === undefined
|
|
906
|
+
? {}
|
|
907
|
+
: { cursor: decodePageToken(query.pageToken, RunPosition) }),
|
|
908
|
+
...(all ? {} : { involvingUserId: who.userId }),
|
|
909
|
+
});
|
|
910
|
+
const page = runs.slice(0, query.pageSize);
|
|
911
|
+
const last = page.at(-1);
|
|
912
|
+
return context.json({
|
|
913
|
+
data: page.filter((run) => involves(run, who.userId) || !isPrivate(run)),
|
|
914
|
+
meta: runs.length > query.pageSize && last
|
|
915
|
+
? {
|
|
916
|
+
nextPageToken: encodePageToken({
|
|
917
|
+
createdAt: last.createdAt,
|
|
918
|
+
id: last.id,
|
|
919
|
+
}),
|
|
920
|
+
}
|
|
921
|
+
: {},
|
|
922
|
+
});
|
|
923
|
+
});
|
|
924
|
+
router.get('/runs/:runId', guard, runAccess('read'), describeRoute({
|
|
925
|
+
tags,
|
|
926
|
+
summary: 'Get a run',
|
|
927
|
+
operationId: 'agentsGetRun',
|
|
928
|
+
...cliRoute({
|
|
929
|
+
command: 'run get',
|
|
930
|
+
args: ['runId'],
|
|
931
|
+
flags: { runId: { name: 'run' } },
|
|
932
|
+
}),
|
|
933
|
+
description: `With its inputs, repositories and usage. ${runVisibility}`,
|
|
934
|
+
responses: {
|
|
935
|
+
200: dataResponse(RunDetailSchema),
|
|
936
|
+
404: noRun,
|
|
937
|
+
...apiErrorResponses,
|
|
938
|
+
},
|
|
939
|
+
}), runParam, async (context) => context.json({
|
|
940
|
+
data: await services.runs.detail(context.req.valid('param').runId),
|
|
941
|
+
}));
|
|
942
|
+
router.get('/runs/:runId/brief', guard, runAccess('read'), describeRoute({
|
|
943
|
+
tags,
|
|
944
|
+
summary: "Get a run's brief",
|
|
945
|
+
operationId: 'agentsGetRunBrief',
|
|
946
|
+
...cliRoute({
|
|
947
|
+
command: 'run brief',
|
|
948
|
+
args: ['runId'],
|
|
949
|
+
flags: { runId: { name: 'run' } },
|
|
950
|
+
}),
|
|
951
|
+
description: `The brief the run's latest attempt was given. ${runVisibility}`,
|
|
952
|
+
responses: {
|
|
953
|
+
200: dataResponse(RunBriefSchema),
|
|
954
|
+
404: notFoundAs('The run or its brief'),
|
|
955
|
+
...apiErrorResponses,
|
|
956
|
+
},
|
|
957
|
+
}), runParam, async (context) => context.json({
|
|
958
|
+
data: await services.runs.brief(context.req.valid('param').runId),
|
|
959
|
+
}));
|
|
960
|
+
router.get('/runs/:runId/events', guard, runAccess('read'), describeRoute({
|
|
961
|
+
tags,
|
|
962
|
+
summary: "List a run's events",
|
|
963
|
+
operationId: 'agentsListRunEvents',
|
|
964
|
+
...cliRoute({
|
|
965
|
+
command: 'run events',
|
|
966
|
+
args: ['runId'],
|
|
967
|
+
flags: { runId: { name: 'run' }, pageSize: { name: 'limit' } },
|
|
968
|
+
columns: ['seq', 'at', 'type', 'tool'],
|
|
969
|
+
}),
|
|
970
|
+
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}`,
|
|
971
|
+
responses: {
|
|
972
|
+
200: listResponse(RunEventItemSchema, SeqPageMetaSchema),
|
|
973
|
+
404: noRun,
|
|
974
|
+
...apiErrorResponses,
|
|
975
|
+
},
|
|
976
|
+
}), runParam, apiValidator('query', RunEventsQuery), async (context) => {
|
|
977
|
+
const { after, pageSize, pageToken } = context.req.valid('query');
|
|
978
|
+
const from = pageToken === undefined
|
|
979
|
+
? (after ?? 0)
|
|
980
|
+
: decodePageToken(pageToken, z.number().int().min(0));
|
|
981
|
+
const page = await services.runs.events(context.req.valid('param').runId, from, pageSize);
|
|
982
|
+
return context.json({
|
|
983
|
+
data: page.events,
|
|
984
|
+
meta: {
|
|
985
|
+
lastSeq: page.lastSeq,
|
|
986
|
+
...(page.events.length === pageSize
|
|
987
|
+
? { nextPageToken: encodePageToken(page.lastSeq) }
|
|
988
|
+
: {}),
|
|
989
|
+
},
|
|
990
|
+
});
|
|
991
|
+
});
|
|
992
|
+
router.post('/runs/:runId/cancel', guard, runAccess('manage'), describeRoute({
|
|
993
|
+
tags,
|
|
994
|
+
summary: 'Cancel a run',
|
|
995
|
+
operationId: 'agentsCancelRun',
|
|
996
|
+
...cliRoute({
|
|
997
|
+
command: 'run cancel',
|
|
998
|
+
args: ['runId'],
|
|
999
|
+
flags: { runId: { name: 'run' } },
|
|
1000
|
+
confirm: 'Cancel this run?',
|
|
1001
|
+
}),
|
|
1002
|
+
description: 'A queued run is cancelled at once; a held one is asked to stop. Whoever started or owns it, or a manager of agents, may.',
|
|
1003
|
+
responses: {
|
|
1004
|
+
200: dataResponse(RunSchema),
|
|
1005
|
+
400: apiErrorResponse(400, 'The run has ended (`RUN_NOT_ACTIVE`).'),
|
|
1006
|
+
404: noRun,
|
|
1007
|
+
...apiErrorResponses,
|
|
1008
|
+
},
|
|
1009
|
+
}), runParam, async (context) => context.json({
|
|
1010
|
+
data: await services.runs.cancel(context.req.valid('param').runId, caller(context).userId),
|
|
1011
|
+
}));
|
|
1012
|
+
router.post('/runs/:runId/retry', guard, runAccess('manage'), describeRoute({
|
|
1013
|
+
tags,
|
|
1014
|
+
summary: 'Retry a run',
|
|
1015
|
+
operationId: 'agentsRetryRun',
|
|
1016
|
+
...cliRoute({
|
|
1017
|
+
command: 'run retry',
|
|
1018
|
+
args: ['runId'],
|
|
1019
|
+
flags: { runId: { name: 'run' } },
|
|
1020
|
+
}),
|
|
1021
|
+
description: 'Queues a new run with the same input. Whoever started or owns it, or a manager of agents, may.',
|
|
1022
|
+
responses: {
|
|
1023
|
+
200: dataResponse(RunSchema),
|
|
1024
|
+
400: apiErrorResponse(400, 'The run cannot be retried (`RUN_NOT_RETRYABLE`).'),
|
|
1025
|
+
404: noRun,
|
|
1026
|
+
...apiErrorResponses,
|
|
1027
|
+
},
|
|
1028
|
+
}), runParam, async (context) => context.json({
|
|
1029
|
+
data: await services.runs.retry(context.req.valid('param').runId, caller(context).userId),
|
|
1030
|
+
}));
|
|
1031
|
+
// What runs used and cost, behind the usage page's grant.
|
|
1032
|
+
const usagePage = async (context, next) => {
|
|
1033
|
+
if (!(await caller(context).opens('usage')))
|
|
1034
|
+
throw forbidden('This needs the usage page.');
|
|
1035
|
+
await next();
|
|
1036
|
+
};
|
|
1037
|
+
router.get('/usage', scoped, usagePage, describeRoute({
|
|
1038
|
+
tags,
|
|
1039
|
+
summary: 'Get the usage report',
|
|
1040
|
+
operationId: 'agentsGetUsage',
|
|
1041
|
+
...cliRoute({
|
|
1042
|
+
command: 'run usage',
|
|
1043
|
+
flags: {
|
|
1044
|
+
groupId: { name: 'group' },
|
|
1045
|
+
agentId: { name: 'agent' },
|
|
1046
|
+
userId: { name: 'user' },
|
|
1047
|
+
},
|
|
1048
|
+
examples: ['run usage --group-by agent --from 2026-09-01'],
|
|
1049
|
+
}),
|
|
1050
|
+
description: 'What runs used and cost, grouped by `groupBy`, over `from` to `to` (UTC days, the last 30 by default, at most 366). Needs the usage page; every run for a reader of agents, otherwise the runs the caller started or owns.',
|
|
1051
|
+
responses: {
|
|
1052
|
+
200: dataResponse(UsageReportSchema),
|
|
1053
|
+
400: apiErrorResponse(400, '`from` or `to` is not a date, they are out of order, or they span more than 366 days (`INVALID_ARGUMENT`).'),
|
|
1054
|
+
...apiErrorResponses,
|
|
1055
|
+
},
|
|
1056
|
+
}), apiValidator('query', UsageQuerySchema), async (context) => {
|
|
1057
|
+
const who = caller(context);
|
|
1058
|
+
const { groupBy, ...filters } = context.req.valid('query');
|
|
1059
|
+
return context.json({
|
|
1060
|
+
data: await services.reporting.usage({
|
|
1061
|
+
userId: who.userId,
|
|
1062
|
+
allRuns: await who.can('agents.agents', 'read'),
|
|
1063
|
+
}, {
|
|
1064
|
+
...Object.fromEntries(Object.entries(filters).filter(([, value]) => value)),
|
|
1065
|
+
groupBy,
|
|
1066
|
+
}),
|
|
1067
|
+
});
|
|
1068
|
+
});
|
|
1069
|
+
// What model calls outside runs used (embeddings, reranking, utility texts), behind the usage page's grant.
|
|
1070
|
+
router.get('/usage/models', scoped, usagePage, describeRoute({
|
|
1071
|
+
tags,
|
|
1072
|
+
summary: 'Get the model usage outside runs',
|
|
1073
|
+
operationId: 'agentsGetModelUsage',
|
|
1074
|
+
...cliRoute({ command: 'model usage' }),
|
|
1075
|
+
description: 'The model calls made outside runs (embeddings, reranking, utility texts), over `from` to `to`. Needs the usage page; rows only for a reader of agents.',
|
|
1076
|
+
responses: {
|
|
1077
|
+
200: dataResponse(ModelUsageReportSchema),
|
|
1078
|
+
400: apiErrorResponse(400, '`from` or `to` is not a date, they are out of order, or they span more than 366 days (`INVALID_ARGUMENT`).'),
|
|
1079
|
+
...apiErrorResponses,
|
|
1080
|
+
},
|
|
1081
|
+
}), apiValidator('query', ModelUsageQuery), async (context) => {
|
|
1082
|
+
const who = caller(context);
|
|
1083
|
+
const range = Object.fromEntries(Object.entries(context.req.valid('query')).filter(([, value]) => value));
|
|
1084
|
+
return context.json({
|
|
1085
|
+
data: await services.reporting.modelUsage({
|
|
1086
|
+
userId: who.userId,
|
|
1087
|
+
allRuns: await who.can('agents.agents', 'read'),
|
|
1088
|
+
}, range),
|
|
1089
|
+
});
|
|
1090
|
+
});
|
|
1091
|
+
// Model prices.
|
|
1092
|
+
router.get('/prices', scoped, can('agents.prices', 'read'), describeRoute({
|
|
1093
|
+
tags,
|
|
1094
|
+
summary: 'Get the model prices',
|
|
1095
|
+
operationId: 'agentsGetPrices',
|
|
1096
|
+
...cliRoute({ command: 'model price get' }),
|
|
1097
|
+
description: 'The prices reports estimate costs from, the coding tools paid by subscription, and the models coding tools reported. Needs `agents.prices` read.',
|
|
1098
|
+
responses: { 200: dataResponse(PricesSchema), ...apiErrorResponses },
|
|
1099
|
+
}), async (context) => context.json({ data: await services.prices.list() }));
|
|
1100
|
+
router.put('/prices', scoped, can('agents.prices', 'manage'), describeRoute({
|
|
1101
|
+
tags,
|
|
1102
|
+
summary: 'Replace the model prices',
|
|
1103
|
+
operationId: 'agentsReplacePrices',
|
|
1104
|
+
...cliRoute({
|
|
1105
|
+
command: 'model price set',
|
|
1106
|
+
bodyFile: 'file',
|
|
1107
|
+
confirm: 'Replace the whole price table and the subscriptions?',
|
|
1108
|
+
examples: ['model price set --file prices.json'],
|
|
1109
|
+
}),
|
|
1110
|
+
description: 'Replaces the whole price table and the subscriptions; a model may appear once per source. Needs `agents.prices` manage.',
|
|
1111
|
+
responses: {
|
|
1112
|
+
200: dataResponse(PricesSchema),
|
|
1113
|
+
400: apiErrorResponse(400, 'A model is priced twice for one source (`INVALID_ARGUMENT`).'),
|
|
1114
|
+
...apiErrorResponses,
|
|
1115
|
+
},
|
|
1116
|
+
}), apiValidator('json', ModelPricesSchema), async (context) => context.json({
|
|
1117
|
+
data: await services.prices.replace(context.req.valid('json')),
|
|
1118
|
+
}));
|
|
1119
|
+
// A fresh working directory for the next run on a subject.
|
|
1120
|
+
router.post('/workspaces/:subjectKind/:subjectId/reset', guard, async (context, next) => {
|
|
1121
|
+
const who = caller(context);
|
|
1122
|
+
if (!(await who.can('agents.agents', 'manage'))) {
|
|
1123
|
+
const mine = await services.runs.list({
|
|
1124
|
+
subjectKind: context.req.param('subjectKind') ?? '',
|
|
1125
|
+
subjectId: context.req.param('subjectId') ?? '',
|
|
1126
|
+
involvingUserId: who.userId,
|
|
1127
|
+
limit: 1,
|
|
1128
|
+
});
|
|
1129
|
+
if (mine.length === 0)
|
|
1130
|
+
throw forbidden('Only someone who started work on it, or a manager of agents, may reset its working directory.');
|
|
1131
|
+
}
|
|
1132
|
+
await next();
|
|
1133
|
+
}, describeRoute({
|
|
1134
|
+
tags,
|
|
1135
|
+
summary: 'Reset the working directory of a subject',
|
|
1136
|
+
operationId: 'agentsResetWorkspace',
|
|
1137
|
+
...cliRoute({
|
|
1138
|
+
command: 'run workspace reset',
|
|
1139
|
+
flags: {
|
|
1140
|
+
subjectKind: { name: 'kind' },
|
|
1141
|
+
subjectId: { name: 'subject' },
|
|
1142
|
+
},
|
|
1143
|
+
confirm: 'Start the next run on this subject in a fresh working directory?',
|
|
1144
|
+
}),
|
|
1145
|
+
description: 'The next run on the subject starts in a fresh working directory. Whoever started work on it, or a manager of agents, may.',
|
|
1146
|
+
responses: { 204: emptyResponse(), ...apiErrorResponses },
|
|
1147
|
+
}), apiValidator('param', WorkspaceParams), async (context) => {
|
|
1148
|
+
const { subjectKind, subjectId } = context.req.valid('param');
|
|
1149
|
+
await services.runs.resetWorkspace({ kind: subjectKind, id: subjectId }, caller(context).userId);
|
|
1150
|
+
return context.body(null, 204);
|
|
1151
|
+
});
|
|
1152
|
+
// Agents, last: `/:agentId` would otherwise shadow the fixed segments above.
|
|
1153
|
+
const agentParam = apiValidator('param', AgentParams);
|
|
1154
|
+
const noAgent = notFoundAs('The agent');
|
|
1155
|
+
const editAccess = 'Its owner (at the related level of `agents.agents` edit) or a manager of agents may.';
|
|
1156
|
+
router.get('/', scoped, can('agents.agents', 'read'), describeRoute({
|
|
1157
|
+
tags,
|
|
1158
|
+
summary: 'List agents',
|
|
1159
|
+
operationId: 'agentsListAgents',
|
|
1160
|
+
...cliRoute({
|
|
1161
|
+
command: 'agent list-all',
|
|
1162
|
+
flags: { includeArchived: { name: 'archived' } },
|
|
1163
|
+
columns: [
|
|
1164
|
+
'id',
|
|
1165
|
+
'name',
|
|
1166
|
+
'type',
|
|
1167
|
+
'ownerName',
|
|
1168
|
+
'activeRuns',
|
|
1169
|
+
'archivedAt',
|
|
1170
|
+
],
|
|
1171
|
+
examples: ['agent list-all --archived'],
|
|
1172
|
+
}),
|
|
1173
|
+
description: 'With what the list shows about their runs and runners, and whether the caller may change each. Needs `agents.agents` read.',
|
|
1174
|
+
responses: {
|
|
1175
|
+
200: listResponse(AgentSummarySchema),
|
|
1176
|
+
...apiErrorResponses,
|
|
1177
|
+
},
|
|
1178
|
+
}), apiValidator('query', AgentListQuery), async (context) => {
|
|
1179
|
+
const data = await summarize(caller(context), await services.agents.list({
|
|
1180
|
+
includeArchived: context.req.valid('query').includeArchived === true,
|
|
1181
|
+
}));
|
|
1182
|
+
return context.json({ data, meta: { total: data.length } });
|
|
1183
|
+
});
|
|
1184
|
+
router.post('/', scoped, can('agents.agents', 'manage'), describeRoute({
|
|
1185
|
+
tags,
|
|
1186
|
+
summary: 'Create an agent',
|
|
1187
|
+
operationId: 'agentsCreateAgent',
|
|
1188
|
+
...cliRoute({
|
|
1189
|
+
command: 'agent create',
|
|
1190
|
+
bodyFile: 'file',
|
|
1191
|
+
flags: {
|
|
1192
|
+
instructions: { contentFile: true },
|
|
1193
|
+
modelEntries: { name: 'models' },
|
|
1194
|
+
ownerUserId: { name: 'owner' },
|
|
1195
|
+
runnerIds: { name: 'runtimes' },
|
|
1196
|
+
skillIds: { name: 'skills' },
|
|
1197
|
+
userIds: { name: 'users' },
|
|
1198
|
+
},
|
|
1199
|
+
examples: [
|
|
1200
|
+
'agent create --name Coder --models \'[{"tool":"claude"},{"tool":"codex","model":"gpt-5"}]\'',
|
|
1201
|
+
'agent create --name PM --type online --models \'[{"modelService":"openai","model":"gpt-5"}]\'',
|
|
1202
|
+
'agent create --file agent.json',
|
|
1203
|
+
],
|
|
1204
|
+
}),
|
|
1205
|
+
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.',
|
|
1206
|
+
responses: {
|
|
1207
|
+
201: dataResponse(AgentSchema, 'Created.'),
|
|
1208
|
+
...apiErrorResponses,
|
|
1209
|
+
},
|
|
1210
|
+
}), apiValidator('json', AgentInputSchema), async (context) => context.json({
|
|
1211
|
+
data: await services.agents.create(caller(context).userId, context.req.valid('json')),
|
|
1212
|
+
}, 201));
|
|
1213
|
+
router.get('/:agentId', scoped, can('agents.agents', 'read'), describeRoute({
|
|
1214
|
+
tags,
|
|
1215
|
+
summary: 'Get an agent',
|
|
1216
|
+
operationId: 'agentsGetAgent',
|
|
1217
|
+
...cliRoute({
|
|
1218
|
+
command: 'agent get',
|
|
1219
|
+
args: ['agentId'],
|
|
1220
|
+
flags: { agentId: { name: 'agent' } },
|
|
1221
|
+
}),
|
|
1222
|
+
description: 'Needs `agents.agents` read.',
|
|
1223
|
+
responses: {
|
|
1224
|
+
200: dataResponse(AgentSummarySchema),
|
|
1225
|
+
404: noAgent,
|
|
1226
|
+
...apiErrorResponses,
|
|
1227
|
+
},
|
|
1228
|
+
}), agentParam, async (context) => {
|
|
1229
|
+
const [agent] = await summarize(caller(context), [
|
|
1230
|
+
await services.agents.get(context.req.valid('param').agentId),
|
|
1231
|
+
]);
|
|
1232
|
+
return context.json({ data: agent });
|
|
1233
|
+
});
|
|
1234
|
+
router.get('/:agentId/history', guard, can('agents.agents', 'read'), describeRoute({
|
|
1235
|
+
tags,
|
|
1236
|
+
summary: "List an agent's history",
|
|
1237
|
+
operationId: 'agentsListAgentHistory',
|
|
1238
|
+
...cliRoute({
|
|
1239
|
+
command: 'agent history',
|
|
1240
|
+
args: ['agentId'],
|
|
1241
|
+
flags: {
|
|
1242
|
+
agentId: { name: 'agent' },
|
|
1243
|
+
afterRevision: { name: 'after' },
|
|
1244
|
+
pageSize: { name: 'limit' },
|
|
1245
|
+
},
|
|
1246
|
+
columns: ['revision', 'action', 'actorName', 'createdAt'],
|
|
1247
|
+
}),
|
|
1248
|
+
description: "The changes to the agent's configuration, newest first; `afterRevision` reads only those after a revision. A variable is named, never its value. Needs `agents.agents` read.",
|
|
1249
|
+
responses: {
|
|
1250
|
+
200: listResponse(AgentChangeSchema, PageTokenMetaSchema),
|
|
1251
|
+
404: noAgent,
|
|
1252
|
+
...apiErrorResponses,
|
|
1253
|
+
},
|
|
1254
|
+
}), agentParam, apiValidator('query', AgentHistoryQuery), async (context) => {
|
|
1255
|
+
const { afterRevision, pageSize, pageToken } = context.req.valid('query');
|
|
1256
|
+
const rows = await services.agents.history(context.req.valid('param').agentId, {
|
|
1257
|
+
...(afterRevision === undefined ? {} : { afterRevision }),
|
|
1258
|
+
limit: pageSize + 1,
|
|
1259
|
+
...(pageToken === undefined
|
|
1260
|
+
? {}
|
|
1261
|
+
: { cursor: decodePageToken(pageToken, ChangePosition) }),
|
|
1262
|
+
});
|
|
1263
|
+
const data = rows.slice(0, pageSize);
|
|
1264
|
+
const last = data.at(-1);
|
|
1265
|
+
return context.json({
|
|
1266
|
+
data,
|
|
1267
|
+
meta: rows.length > pageSize && last
|
|
1268
|
+
? {
|
|
1269
|
+
nextPageToken: encodePageToken({
|
|
1270
|
+
createdAt: last.createdAt,
|
|
1271
|
+
revision: last.revision,
|
|
1272
|
+
id: last.id,
|
|
1273
|
+
}),
|
|
1274
|
+
}
|
|
1275
|
+
: {},
|
|
1276
|
+
});
|
|
1277
|
+
});
|
|
1278
|
+
router.patch('/:agentId', scoped, editableAgent, describeRoute({
|
|
1279
|
+
tags,
|
|
1280
|
+
summary: 'Update an agent',
|
|
1281
|
+
operationId: 'agentsUpdateAgent',
|
|
1282
|
+
...cliRoute({
|
|
1283
|
+
command: 'agent update',
|
|
1284
|
+
args: ['agentId'],
|
|
1285
|
+
bodyFile: 'file',
|
|
1286
|
+
flags: {
|
|
1287
|
+
agentId: { name: 'agent' },
|
|
1288
|
+
instructions: { contentFile: true },
|
|
1289
|
+
modelEntries: { name: 'models' },
|
|
1290
|
+
ownerUserId: { name: 'owner' },
|
|
1291
|
+
runnerIds: { name: 'runtimes' },
|
|
1292
|
+
skillIds: { name: 'skills' },
|
|
1293
|
+
userIds: { name: 'users' },
|
|
1294
|
+
expectedRevision: { name: 'revision' },
|
|
1295
|
+
},
|
|
1296
|
+
examples: [
|
|
1297
|
+
'agent update <agent> --instructions-file notes.md --revision 4',
|
|
1298
|
+
'agent update <agent> --models \'[{"tool":"codex"},{"tool":"claude","model":"opus"}]\' --revision 4',
|
|
1299
|
+
],
|
|
1300
|
+
}),
|
|
1301
|
+
description: `Changes the fields given, against \`expectedRevision\`. ${editAccess} Only a manager of agents may give it to another owner, and an owner adds only business actions they hold themselves.`,
|
|
1302
|
+
responses: {
|
|
1303
|
+
200: dataResponse(AgentSchema),
|
|
1304
|
+
404: noAgent,
|
|
1305
|
+
409: revisionConflict('agent'),
|
|
1306
|
+
...apiErrorResponses,
|
|
1307
|
+
},
|
|
1308
|
+
}), agentParam, apiValidator('json', AgentPatchSchema), async (context) => {
|
|
1309
|
+
const who = caller(context);
|
|
1310
|
+
const agent = await services.agents.get(context.req.valid('param').agentId);
|
|
1311
|
+
const patch = context.req.valid('json');
|
|
1312
|
+
if (!(await who.can('agents.agents', 'manage'))) {
|
|
1313
|
+
// Someone editing as the owner gives the agent only what they may grant themselves.
|
|
1314
|
+
if (patch.ownerUserId !== undefined &&
|
|
1315
|
+
patch.ownerUserId !== agent.ownerUserId)
|
|
1316
|
+
throw forbidden('Only a manager of agents may give an agent to another owner.');
|
|
1317
|
+
if (patch.actions !== undefined) {
|
|
1318
|
+
const held = await services.gate.allowed({
|
|
1319
|
+
kind: 'user',
|
|
1320
|
+
userId: who.userId,
|
|
1321
|
+
displayName: who.userId,
|
|
1322
|
+
});
|
|
1323
|
+
const beyond = patch.actions.filter((action) => !agent.actions.includes(action) && !held.has(action));
|
|
1324
|
+
if (beyond.length > 0)
|
|
1325
|
+
throw forbidden(`You may not give the agent business actions you do not hold yourself: ${beyond.join(', ')}.`);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
return context.json({
|
|
1329
|
+
data: await services.agents.update(agent.id, who.userId, patch),
|
|
1330
|
+
});
|
|
1331
|
+
});
|
|
1332
|
+
router.delete('/:agentId', scoped, editableAgent, describeRoute({
|
|
1333
|
+
tags,
|
|
1334
|
+
summary: 'Delete an agent',
|
|
1335
|
+
operationId: 'agentsDeleteAgent',
|
|
1336
|
+
...cliRoute({
|
|
1337
|
+
command: 'agent delete',
|
|
1338
|
+
args: ['agentId'],
|
|
1339
|
+
flags: { agentId: { name: 'agent' } },
|
|
1340
|
+
confirm: 'Delete this archived agent with its variables and history?',
|
|
1341
|
+
}),
|
|
1342
|
+
description: `Deletes an archived agent with no open runs, with its variables, skill attachments and history; its past runs stay. ${editAccess}`,
|
|
1343
|
+
responses: {
|
|
1344
|
+
204: emptyResponse(),
|
|
1345
|
+
400: apiErrorResponse(400, 'The agent is not archived, or has open runs (`AGENT_NOT_ARCHIVED`, `AGENT_HAS_ACTIVE_RUNS`).'),
|
|
1346
|
+
404: noAgent,
|
|
1347
|
+
...apiErrorResponses,
|
|
1348
|
+
},
|
|
1349
|
+
}), agentParam, async (context) => {
|
|
1350
|
+
await services.agents.remove(context.req.valid('param').agentId, caller(context).userId);
|
|
1351
|
+
return context.body(null, 204);
|
|
1352
|
+
});
|
|
1353
|
+
router.post('/:agentId/archive', scoped, editableAgent, describeRoute({
|
|
1354
|
+
tags,
|
|
1355
|
+
summary: 'Archive an agent',
|
|
1356
|
+
operationId: 'agentsArchiveAgent',
|
|
1357
|
+
...cliRoute({
|
|
1358
|
+
command: 'agent archive',
|
|
1359
|
+
args: ['agentId'],
|
|
1360
|
+
flags: { agentId: { name: 'agent' } },
|
|
1361
|
+
confirm: 'Archive this agent? Its queued runs are withdrawn.',
|
|
1362
|
+
}),
|
|
1363
|
+
description: `An archived agent is not run: its queued runs are withdrawn. ${editAccess}`,
|
|
1364
|
+
responses: {
|
|
1365
|
+
200: dataResponse(AgentSchema),
|
|
1366
|
+
404: noAgent,
|
|
1367
|
+
...apiErrorResponses,
|
|
1368
|
+
},
|
|
1369
|
+
}), agentParam, async (context) => context.json({
|
|
1370
|
+
data: await services.agents.archive(context.req.valid('param').agentId, caller(context).userId),
|
|
1371
|
+
}));
|
|
1372
|
+
router.post('/:agentId/restore', scoped, editableAgent, describeRoute({
|
|
1373
|
+
tags,
|
|
1374
|
+
summary: 'Restore an archived agent',
|
|
1375
|
+
operationId: 'agentsRestoreAgent',
|
|
1376
|
+
...cliRoute({
|
|
1377
|
+
command: 'agent restore',
|
|
1378
|
+
args: ['agentId'],
|
|
1379
|
+
flags: { agentId: { name: 'agent' } },
|
|
1380
|
+
}),
|
|
1381
|
+
description: editAccess,
|
|
1382
|
+
responses: {
|
|
1383
|
+
200: dataResponse(AgentSchema),
|
|
1384
|
+
404: noAgent,
|
|
1385
|
+
...apiErrorResponses,
|
|
1386
|
+
},
|
|
1387
|
+
}), agentParam, async (context) => context.json({
|
|
1388
|
+
data: await services.agents.restore(context.req.valid('param').agentId, caller(context).userId),
|
|
1389
|
+
}));
|
|
1390
|
+
router.get('/:agentId/previewBrief', guard, can('agents.agents', 'read'), describeRoute({
|
|
1391
|
+
tags,
|
|
1392
|
+
summary: "Preview an agent's full prompt",
|
|
1393
|
+
operationId: 'agentsPreviewAgentBrief',
|
|
1394
|
+
...cliRoute({
|
|
1395
|
+
command: 'agent brief',
|
|
1396
|
+
args: ['agentId'],
|
|
1397
|
+
flags: { agentId: { name: 'agent' } },
|
|
1398
|
+
examples: [
|
|
1399
|
+
'agent brief <agent>',
|
|
1400
|
+
'agent brief <agent> --scenario conversation',
|
|
1401
|
+
],
|
|
1402
|
+
}),
|
|
1403
|
+
description: "What a run of the agent would be sent now in a scenario, rendered on a made-up subject whose values are marked `[sample]`: the system prompt in one (the rules, the task, the context and, last, the agent's own prompt) and the first message. `scenario` is a subject kind that offers a sample (for example, `issue` or `conversation`), the application's first by default. Needs `agents.agents` read.",
|
|
1404
|
+
responses: {
|
|
1405
|
+
200: dataResponse(BriefPreviewSchema),
|
|
1406
|
+
400: apiErrorResponse(400, 'The scenario offers no sample, or no scenario is given and none offers one (`INVALID_ARGUMENT`).'),
|
|
1407
|
+
404: notFoundAs('The agent'),
|
|
1408
|
+
...apiErrorResponses,
|
|
1409
|
+
},
|
|
1410
|
+
}), agentParam, apiValidator('query', PreviewBriefQuery), async (context) => {
|
|
1411
|
+
const who = caller(context);
|
|
1412
|
+
const query = context.req.valid('query');
|
|
1413
|
+
// The application's own kinds first: a conversation is previewed only when asked for.
|
|
1414
|
+
const offered = services.subjects
|
|
1415
|
+
.list()
|
|
1416
|
+
.filter((binding) => binding.preview);
|
|
1417
|
+
const scenario = query.scenario ??
|
|
1418
|
+
offered.find((binding) => binding.kind !== CONVERSATION_SUBJECT)
|
|
1419
|
+
?.kind ??
|
|
1420
|
+
offered[0]?.kind;
|
|
1421
|
+
if (!scenario)
|
|
1422
|
+
throw invalid('scenario is required: no subject offers a preview.', {
|
|
1423
|
+
field: 'scenario',
|
|
1424
|
+
});
|
|
1425
|
+
return context.json({
|
|
1426
|
+
data: await services.briefs.preview(context.req.valid('param').agentId, scenario, { id: who.userId, name: await nameOf(who.userId) }),
|
|
1427
|
+
});
|
|
1428
|
+
});
|
|
1429
|
+
return router;
|
|
1430
|
+
}
|
|
1431
|
+
//# sourceMappingURL=admin.js.map
|