@openagt/dashboard 0.0.0-stage → 0.9.0
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/LICENSE +21 -0
- package/README.md +125 -2
- package/dist/agent-id.d.ts +13 -0
- package/dist/agent-id.d.ts.map +1 -0
- package/dist/agent-id.js +20 -0
- package/dist/agent-id.js.map +1 -0
- package/dist/agent-locks.d.ts +3 -0
- package/dist/agent-locks.d.ts.map +1 -0
- package/dist/agent-locks.js +40 -0
- package/dist/agent-locks.js.map +1 -0
- package/dist/agent-view.d.ts +39 -0
- package/dist/agent-view.d.ts.map +1 -0
- package/dist/agent-view.js +45 -0
- package/dist/agent-view.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +11 -0
- package/dist/bin.js.map +1 -0
- package/dist/branch-name.d.ts +8 -0
- package/dist/branch-name.d.ts.map +1 -0
- package/dist/branch-name.js +20 -0
- package/dist/branch-name.js.map +1 -0
- package/dist/bridge-browser.d.ts +217 -0
- package/dist/bridge-browser.d.ts.map +1 -0
- package/dist/bridge-browser.js +520 -0
- package/dist/bridge-browser.js.map +1 -0
- package/dist/browser-stream.d.ts +20 -0
- package/dist/browser-stream.d.ts.map +1 -0
- package/dist/browser-stream.js +51 -0
- package/dist/browser-stream.js.map +1 -0
- package/dist/browser.d.ts +16 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +38 -0
- package/dist/browser.js.map +1 -0
- package/dist/built-in.d.ts +38 -0
- package/dist/built-in.d.ts.map +1 -0
- package/dist/built-in.js +119 -0
- package/dist/built-in.js.map +1 -0
- package/dist/chrome-extension/background.js +532 -0
- package/dist/chrome-extension/content.js +1475 -0
- package/dist/chrome-extension/driver-plan.js +41 -0
- package/dist/chrome-extension/fingerprint.js +43 -0
- package/dist/chrome-extension/manifest.json +31 -0
- package/dist/chrome-extension/options.html +48 -0
- package/dist/chrome-extension/options.js +122 -0
- package/dist/cli.d.ts +43 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +186 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +30 -0
- package/dist/client.js.map +1 -0
- package/dist/cloud-run-state.d.ts +27 -0
- package/dist/cloud-run-state.d.ts.map +1 -0
- package/dist/cloud-run-state.js +36 -0
- package/dist/cloud-run-state.js.map +1 -0
- package/dist/cloud-scratch-refs.d.ts +85 -0
- package/dist/cloud-scratch-refs.d.ts.map +1 -0
- package/dist/cloud-scratch-refs.js +275 -0
- package/dist/cloud-scratch-refs.js.map +1 -0
- package/dist/cloud-work.d.ts +66 -0
- package/dist/cloud-work.d.ts.map +1 -0
- package/dist/cloud-work.js +204 -0
- package/dist/cloud-work.js.map +1 -0
- package/dist/daemon-runtime.d.ts +42 -0
- package/dist/daemon-runtime.d.ts.map +1 -0
- package/dist/daemon-runtime.js +183 -0
- package/dist/daemon-runtime.js.map +1 -0
- package/dist/daemon-services.d.ts +37 -0
- package/dist/daemon-services.d.ts.map +1 -0
- package/dist/daemon-services.js +126 -0
- package/dist/daemon-services.js.map +1 -0
- package/dist/daemon-tick.d.ts +68 -0
- package/dist/daemon-tick.d.ts.map +1 -0
- package/dist/daemon-tick.js +97 -0
- package/dist/daemon-tick.js.map +1 -0
- package/dist/daemon.d.ts +65 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +202 -0
- package/dist/daemon.js.map +1 -0
- package/dist/dashboard/activity.d.ts +41 -0
- package/dist/dashboard/activity.d.ts.map +1 -0
- package/dist/dashboard/activity.js +56 -0
- package/dist/dashboard/activity.js.map +1 -0
- package/dist/dashboard/agent-handoff.d.ts +244 -0
- package/dist/dashboard/agent-handoff.d.ts.map +1 -0
- package/dist/dashboard/agent-handoff.js +310 -0
- package/dist/dashboard/agent-handoff.js.map +1 -0
- package/dist/dashboard/bridge-endpoints.d.ts +158 -0
- package/dist/dashboard/bridge-endpoints.d.ts.map +1 -0
- package/dist/dashboard/bridge-endpoints.js +382 -0
- package/dist/dashboard/bridge-endpoints.js.map +1 -0
- package/dist/dashboard/bridge-question.d.ts +33 -0
- package/dist/dashboard/bridge-question.d.ts.map +1 -0
- package/dist/dashboard/bridge-question.js +20 -0
- package/dist/dashboard/bridge-question.js.map +1 -0
- package/dist/dashboard/bridge-sessions.d.ts +25 -0
- package/dist/dashboard/bridge-sessions.d.ts.map +1 -0
- package/dist/dashboard/bridge-sessions.js +46 -0
- package/dist/dashboard/bridge-sessions.js.map +1 -0
- package/dist/dashboard/bridge-starts.d.ts +61 -0
- package/dist/dashboard/bridge-starts.d.ts.map +1 -0
- package/dist/dashboard/bridge-starts.js +94 -0
- package/dist/dashboard/bridge-starts.js.map +1 -0
- package/dist/dashboard/bridge-store.d.ts +179 -0
- package/dist/dashboard/bridge-store.d.ts.map +1 -0
- package/dist/dashboard/bridge-store.js +262 -0
- package/dist/dashboard/bridge-store.js.map +1 -0
- package/dist/dashboard/bundle.d.ts +12 -0
- package/dist/dashboard/bundle.d.ts.map +1 -0
- package/dist/dashboard/bundle.js +22 -0
- package/dist/dashboard/bundle.js.map +1 -0
- package/dist/dashboard/cache.d.ts +47 -0
- package/dist/dashboard/cache.d.ts.map +1 -0
- package/dist/dashboard/cache.js +87 -0
- package/dist/dashboard/cache.js.map +1 -0
- package/dist/dashboard/content-type.d.ts +3 -0
- package/dist/dashboard/content-type.d.ts.map +1 -0
- package/dist/dashboard/content-type.js +31 -0
- package/dist/dashboard/content-type.js.map +1 -0
- package/dist/dashboard/dashboard.d.ts +38 -0
- package/dist/dashboard/dashboard.d.ts.map +1 -0
- package/dist/dashboard/dashboard.js +42 -0
- package/dist/dashboard/dashboard.js.map +1 -0
- package/dist/dashboard/docs.d.ts +39 -0
- package/dist/dashboard/docs.d.ts.map +1 -0
- package/dist/dashboard/docs.js +59 -0
- package/dist/dashboard/docs.js.map +1 -0
- package/dist/dashboard/git-status.d.ts +44 -0
- package/dist/dashboard/git-status.d.ts.map +1 -0
- package/dist/dashboard/git-status.js +37 -0
- package/dist/dashboard/git-status.js.map +1 -0
- package/dist/dashboard/http.d.ts +29 -0
- package/dist/dashboard/http.d.ts.map +1 -0
- package/dist/dashboard/http.js +74 -0
- package/dist/dashboard/http.js.map +1 -0
- package/dist/dashboard/index.d.ts +24 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +23 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/dashboard/interventions.d.ts +67 -0
- package/dist/dashboard/interventions.d.ts.map +1 -0
- package/dist/dashboard/interventions.js +169 -0
- package/dist/dashboard/interventions.js.map +1 -0
- package/dist/dashboard/keyed-watcher.d.ts +29 -0
- package/dist/dashboard/keyed-watcher.d.ts.map +1 -0
- package/dist/dashboard/keyed-watcher.js +42 -0
- package/dist/dashboard/keyed-watcher.js.map +1 -0
- package/dist/dashboard/keys.d.ts +31 -0
- package/dist/dashboard/keys.d.ts.map +1 -0
- package/dist/dashboard/keys.js +37 -0
- package/dist/dashboard/keys.js.map +1 -0
- package/dist/dashboard/models.d.ts +25 -0
- package/dist/dashboard/models.d.ts.map +1 -0
- package/dist/dashboard/models.js +30 -0
- package/dist/dashboard/models.js.map +1 -0
- package/dist/dashboard/module-host.d.ts +44 -0
- package/dist/dashboard/module-host.d.ts.map +1 -0
- package/dist/dashboard/module-host.js +91 -0
- package/dist/dashboard/module-host.js.map +1 -0
- package/dist/dashboard/module-serve.d.ts +15 -0
- package/dist/dashboard/module-serve.d.ts.map +1 -0
- package/dist/dashboard/module-serve.js +45 -0
- package/dist/dashboard/module-serve.js.map +1 -0
- package/dist/dashboard/open-in-app.d.ts +43 -0
- package/dist/dashboard/open-in-app.d.ts.map +1 -0
- package/dist/dashboard/open-in-app.js +98 -0
- package/dist/dashboard/open-in-app.js.map +1 -0
- package/dist/dashboard/open-questions.d.ts +45 -0
- package/dist/dashboard/open-questions.d.ts.map +1 -0
- package/dist/dashboard/open-questions.js +62 -0
- package/dist/dashboard/open-questions.js.map +1 -0
- package/dist/dashboard/overview.d.ts +78 -0
- package/dist/dashboard/overview.d.ts.map +1 -0
- package/dist/dashboard/overview.js +87 -0
- package/dist/dashboard/overview.js.map +1 -0
- package/dist/dashboard/projects.d.ts +101 -0
- package/dist/dashboard/projects.d.ts.map +1 -0
- package/dist/dashboard/projects.js +63 -0
- package/dist/dashboard/projects.js.map +1 -0
- package/dist/dashboard/pull-requests.d.ts +127 -0
- package/dist/dashboard/pull-requests.d.ts.map +1 -0
- package/dist/dashboard/pull-requests.js +137 -0
- package/dist/dashboard/pull-requests.js.map +1 -0
- package/dist/dashboard/queue.d.ts +17 -0
- package/dist/dashboard/queue.d.ts.map +1 -0
- package/dist/dashboard/queue.js +19 -0
- package/dist/dashboard/queue.js.map +1 -0
- package/dist/dashboard/quota.d.ts +53 -0
- package/dist/dashboard/quota.d.ts.map +1 -0
- package/dist/dashboard/quota.js +42 -0
- package/dist/dashboard/quota.js.map +1 -0
- package/dist/dashboard/relay-endpoints.d.ts +32 -0
- package/dist/dashboard/relay-endpoints.d.ts.map +1 -0
- package/dist/dashboard/relay-endpoints.js +115 -0
- package/dist/dashboard/relay-endpoints.js.map +1 -0
- package/dist/dashboard/remote-run.d.ts +95 -0
- package/dist/dashboard/remote-run.d.ts.map +1 -0
- package/dist/dashboard/remote-run.js +235 -0
- package/dist/dashboard/remote-run.js.map +1 -0
- package/dist/dashboard/rpc-serve.d.ts +106 -0
- package/dist/dashboard/rpc-serve.d.ts.map +1 -0
- package/dist/dashboard/rpc-serve.js +180 -0
- package/dist/dashboard/rpc-serve.js.map +1 -0
- package/dist/dashboard/run-inbox.d.ts +31 -0
- package/dist/dashboard/run-inbox.d.ts.map +1 -0
- package/dist/dashboard/run-inbox.js +51 -0
- package/dist/dashboard/run-inbox.js.map +1 -0
- package/dist/dashboard/server.d.ts +105 -0
- package/dist/dashboard/server.d.ts.map +1 -0
- package/dist/dashboard/server.js +231 -0
- package/dist/dashboard/server.js.map +1 -0
- package/dist/dashboard/static.d.ts +9 -0
- package/dist/dashboard/static.d.ts.map +1 -0
- package/dist/dashboard/static.js +54 -0
- package/dist/dashboard/static.js.map +1 -0
- package/dist/dashboard/types.d.ts +135 -0
- package/dist/dashboard/types.d.ts.map +1 -0
- package/dist/dashboard/types.js +2 -0
- package/dist/dashboard/types.js.map +1 -0
- package/dist/dashboard/web-start-endpoints.d.ts +32 -0
- package/dist/dashboard/web-start-endpoints.d.ts.map +1 -0
- package/dist/dashboard/web-start-endpoints.js +75 -0
- package/dist/dashboard/web-start-endpoints.js.map +1 -0
- package/dist/dashboard-bundle/assets/client-CbBRB9m4.js +9 -0
- package/dist/dashboard-bundle/assets/jsx-runtime-By8HlURe.js +1 -0
- package/dist/dashboard-bundle/assets/main-B98UOA3_.js +140 -0
- package/dist/dashboard-bundle/assets/main-ByRjbCiA.css +2 -0
- package/dist/dashboard-bundle/assets/module-v213KWfH.js +21 -0
- package/dist/dashboard-bundle/assets/react-CZI7_Jkm.js +1 -0
- package/dist/dashboard-bundle/assets/react-dom-cJyBB_A4.js +1 -0
- package/dist/dashboard-bundle/assets/rolldown-runtime-QTnfLwEv.js +1 -0
- package/dist/dashboard-bundle/host/module.js +1 -0
- package/dist/dashboard-bundle/host/react-dom-client.js +1 -0
- package/dist/dashboard-bundle/host/react-dom.js +1 -0
- package/dist/dashboard-bundle/host/react-jsx-runtime.js +1 -0
- package/dist/dashboard-bundle/host/react.js +1 -0
- package/dist/dashboard-bundle/index.html +42 -0
- package/dist/dashboard-bundle/logo-animated.svg +34 -0
- package/dist/dashboard-bundle/logo.svg +16 -0
- package/dist/dashboard-rpc/context.d.ts +56 -0
- package/dist/dashboard-rpc/context.d.ts.map +1 -0
- package/dist/dashboard-rpc/context.js +106 -0
- package/dist/dashboard-rpc/context.js.map +1 -0
- package/dist/dashboard-rpc/control.d.ts +124 -0
- package/dist/dashboard-rpc/control.d.ts.map +1 -0
- package/dist/dashboard-rpc/control.js +284 -0
- package/dist/dashboard-rpc/control.js.map +1 -0
- package/dist/dashboard-rpc/devices.d.ts +9 -0
- package/dist/dashboard-rpc/devices.d.ts.map +1 -0
- package/dist/dashboard-rpc/devices.js +12 -0
- package/dist/dashboard-rpc/devices.js.map +1 -0
- package/dist/dashboard-rpc/events-tail.d.ts +68 -0
- package/dist/dashboard-rpc/events-tail.d.ts.map +1 -0
- package/dist/dashboard-rpc/events-tail.js +257 -0
- package/dist/dashboard-rpc/events-tail.js.map +1 -0
- package/dist/dashboard-rpc/events.d.ts +39 -0
- package/dist/dashboard-rpc/events.d.ts.map +1 -0
- package/dist/dashboard-rpc/events.js +47 -0
- package/dist/dashboard-rpc/events.js.map +1 -0
- package/dist/dashboard-rpc/index.d.ts +29 -0
- package/dist/dashboard-rpc/index.d.ts.map +1 -0
- package/dist/dashboard-rpc/index.js +40 -0
- package/dist/dashboard-rpc/index.js.map +1 -0
- package/dist/dashboard-rpc/models.d.ts +4 -0
- package/dist/dashboard-rpc/models.d.ts.map +1 -0
- package/dist/dashboard-rpc/models.js +8 -0
- package/dist/dashboard-rpc/models.js.map +1 -0
- package/dist/dashboard-rpc/modules.d.ts +45 -0
- package/dist/dashboard-rpc/modules.d.ts.map +1 -0
- package/dist/dashboard-rpc/modules.js +79 -0
- package/dist/dashboard-rpc/modules.js.map +1 -0
- package/dist/dashboard-rpc/preferences.d.ts +41 -0
- package/dist/dashboard-rpc/preferences.d.ts.map +1 -0
- package/dist/dashboard-rpc/preferences.js +65 -0
- package/dist/dashboard-rpc/preferences.js.map +1 -0
- package/dist/dashboard-rpc/projects.d.ts +85 -0
- package/dist/dashboard-rpc/projects.d.ts.map +1 -0
- package/dist/dashboard-rpc/projects.js +129 -0
- package/dist/dashboard-rpc/projects.js.map +1 -0
- package/dist/dashboard-rpc/quota.d.ts +4 -0
- package/dist/dashboard-rpc/quota.d.ts.map +1 -0
- package/dist/dashboard-rpc/quota.js +15 -0
- package/dist/dashboard-rpc/quota.js.map +1 -0
- package/dist/dashboard-rpc/reads.d.ts +185 -0
- package/dist/dashboard-rpc/reads.d.ts.map +1 -0
- package/dist/dashboard-rpc/reads.js +370 -0
- package/dist/dashboard-rpc/reads.js.map +1 -0
- package/dist/dashboard-rpc/relay-agent.d.ts +9 -0
- package/dist/dashboard-rpc/relay-agent.d.ts.map +1 -0
- package/dist/dashboard-rpc/relay-agent.js +21 -0
- package/dist/dashboard-rpc/relay-agent.js.map +1 -0
- package/dist/dashboard-rpc/relay-dispatch.d.ts +9 -0
- package/dist/dashboard-rpc/relay-dispatch.d.ts.map +1 -0
- package/dist/dashboard-rpc/relay-dispatch.js +24 -0
- package/dist/dashboard-rpc/relay-dispatch.js.map +1 -0
- package/dist/dashboard-rpc/stream-forward.d.ts +17 -0
- package/dist/dashboard-rpc/stream-forward.d.ts.map +1 -0
- package/dist/dashboard-rpc/stream-forward.js +38 -0
- package/dist/dashboard-rpc/stream-forward.js.map +1 -0
- package/dist/dashboard-rpc/test-context.d.ts +23 -0
- package/dist/dashboard-rpc/test-context.d.ts.map +1 -0
- package/dist/dashboard-rpc/test-context.js +43 -0
- package/dist/dashboard-rpc/test-context.js.map +1 -0
- package/dist/driver-names.d.ts +22 -0
- package/dist/driver-names.d.ts.map +1 -0
- package/dist/driver-names.js +29 -0
- package/dist/driver-names.js.map +1 -0
- package/dist/error-message.d.ts +8 -0
- package/dist/error-message.d.ts.map +1 -0
- package/dist/error-message.js +10 -0
- package/dist/error-message.js.map +1 -0
- package/dist/event-stream.d.ts +33 -0
- package/dist/event-stream.d.ts.map +1 -0
- package/dist/event-stream.js +104 -0
- package/dist/event-stream.js.map +1 -0
- package/dist/events.d.ts +236 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +5 -0
- package/dist/events.js.map +1 -0
- package/dist/format-bytes.d.ts +3 -0
- package/dist/format-bytes.d.ts.map +1 -0
- package/dist/format-bytes.js +18 -0
- package/dist/format-bytes.js.map +1 -0
- package/dist/has-remote.d.ts +8 -0
- package/dist/has-remote.d.ts.map +1 -0
- package/dist/has-remote.js +10 -0
- package/dist/has-remote.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +31 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +54 -0
- package/dist/install.js.map +1 -0
- package/dist/jsonl-tail.d.ts +59 -0
- package/dist/jsonl-tail.d.ts.map +1 -0
- package/dist/jsonl-tail.js +152 -0
- package/dist/jsonl-tail.js.map +1 -0
- package/dist/loopback-host.d.ts +20 -0
- package/dist/loopback-host.d.ts.map +1 -0
- package/dist/loopback-host.js +31 -0
- package/dist/loopback-host.js.map +1 -0
- package/dist/module-server.d.ts +56 -0
- package/dist/module-types/dashboard/components/DiffStat.d.ts +6 -0
- package/dist/module-types/dashboard/components/DriverModelMenu.d.ts +23 -0
- package/dist/module-types/dashboard/components/LinkActions.d.ts +26 -0
- package/dist/module-types/dashboard/components/Markdown.d.ts +4 -0
- package/dist/module-types/dashboard/components/SettingsRows.d.ts +37 -0
- package/dist/module-types/dashboard/components/StartAgentButton.d.ts +39 -0
- package/dist/module-types/dashboard/components/ui/badge.d.ts +2 -0
- package/dist/module-types/dashboard/components/ui/button.d.ts +10 -0
- package/dist/module-types/dashboard/components/ui/card.d.ts +5 -0
- package/dist/module-types/dashboard/components/ui/checkbox.d.ts +7 -0
- package/dist/module-types/dashboard/components/ui/dropdown-menu.d.ts +16 -0
- package/dist/module-types/dashboard/components/ui/input.d.ts +2 -0
- package/dist/module-types/dashboard/components/ui/option-label.d.ts +4 -0
- package/dist/module-types/dashboard/components/ui/popover.d.ts +8 -0
- package/dist/module-types/dashboard/components/ui/scroll-area.d.ts +10 -0
- package/dist/module-types/dashboard/components/ui/separator.d.ts +3 -0
- package/dist/module-types/dashboard/components/ui/skeleton.d.ts +2 -0
- package/dist/module-types/dashboard/components/ui/slider.d.ts +9 -0
- package/dist/module-types/dashboard/components/ui/tooltip.d.ts +11 -0
- package/dist/module-types/dashboard/lib/agent-settings.d.ts +2 -0
- package/dist/module-types/dashboard/lib/draft-handoff.d.ts +15 -0
- package/dist/module-types/dashboard/lib/format-date.d.ts +51 -0
- package/dist/module-types/dashboard/lib/host-services.d.ts +12 -0
- package/dist/module-types/dashboard/lib/models.d.ts +24 -0
- package/dist/module-types/dashboard/lib/route.d.ts +38 -0
- package/dist/module-types/dashboard/lib/rpc.d.ts +31 -0
- package/dist/module-types/dashboard/lib/use-action.d.ts +25 -0
- package/dist/module-types/dashboard/lib/use-async.d.ts +45 -0
- package/dist/module-types/dashboard/lib/use-modules.d.ts +79 -0
- package/dist/module-types/dashboard/lib/utils.d.ts +3 -0
- package/dist/module-types/dashboard/module/index.d.ts +335 -0
- package/dist/module-types/dashboard/rpc/models.d.ts +2 -0
- package/dist/module-types/dashboard/rpc/modules.d.ts +5 -0
- package/dist/module-types/src/agent-id.d.ts +12 -0
- package/dist/module-types/src/agent-locks.d.ts +2 -0
- package/dist/module-types/src/agent-view.d.ts +38 -0
- package/dist/module-types/src/bridge-browser.d.ts +216 -0
- package/dist/module-types/src/browser-stream.d.ts +19 -0
- package/dist/module-types/src/browser.d.ts +15 -0
- package/dist/module-types/src/built-in.d.ts +37 -0
- package/dist/module-types/src/client.d.ts +15 -0
- package/dist/module-types/src/cloud-run-state.d.ts +26 -0
- package/dist/module-types/src/dashboard/activity.d.ts +40 -0
- package/dist/module-types/src/dashboard/agent-handoff.d.ts +243 -0
- package/dist/module-types/src/dashboard/bridge-endpoints.d.ts +157 -0
- package/dist/module-types/src/dashboard/bridge-question.d.ts +32 -0
- package/dist/module-types/src/dashboard/bridge-store.d.ts +178 -0
- package/dist/module-types/src/dashboard/cache.d.ts +46 -0
- package/dist/module-types/src/dashboard/content-type.d.ts +2 -0
- package/dist/module-types/src/dashboard/dashboard.d.ts +37 -0
- package/dist/module-types/src/dashboard/docs.d.ts +38 -0
- package/dist/module-types/src/dashboard/git-status.d.ts +43 -0
- package/dist/module-types/src/dashboard/http.d.ts +28 -0
- package/dist/module-types/src/dashboard/interventions.d.ts +66 -0
- package/dist/module-types/src/dashboard/keyed-watcher.d.ts +28 -0
- package/dist/module-types/src/dashboard/keys.d.ts +30 -0
- package/dist/module-types/src/dashboard/models.d.ts +24 -0
- package/dist/module-types/src/dashboard/module-host.d.ts +43 -0
- package/dist/module-types/src/dashboard/module-serve.d.ts +14 -0
- package/dist/module-types/src/dashboard/open-in-app.d.ts +42 -0
- package/dist/module-types/src/dashboard/open-questions.d.ts +44 -0
- package/dist/module-types/src/dashboard/overview.d.ts +77 -0
- package/dist/module-types/src/dashboard/projects.d.ts +100 -0
- package/dist/module-types/src/dashboard/pull-requests.d.ts +126 -0
- package/dist/module-types/src/dashboard/queue.d.ts +16 -0
- package/dist/module-types/src/dashboard/quota.d.ts +52 -0
- package/dist/module-types/src/dashboard/remote-run.d.ts +94 -0
- package/dist/module-types/src/dashboard/rpc-serve.d.ts +105 -0
- package/dist/module-types/src/dashboard/run-inbox.d.ts +30 -0
- package/dist/module-types/src/dashboard/types.d.ts +134 -0
- package/dist/module-types/src/dashboard-rpc/context.d.ts +55 -0
- package/dist/module-types/src/dashboard-rpc/control.d.ts +123 -0
- package/dist/module-types/src/dashboard-rpc/devices.d.ts +8 -0
- package/dist/module-types/src/dashboard-rpc/events-tail.d.ts +67 -0
- package/dist/module-types/src/dashboard-rpc/events.d.ts +38 -0
- package/dist/module-types/src/dashboard-rpc/index.d.ts +28 -0
- package/dist/module-types/src/dashboard-rpc/models.d.ts +3 -0
- package/dist/module-types/src/dashboard-rpc/modules.d.ts +44 -0
- package/dist/module-types/src/dashboard-rpc/preferences.d.ts +40 -0
- package/dist/module-types/src/dashboard-rpc/projects.d.ts +84 -0
- package/dist/module-types/src/dashboard-rpc/quota.d.ts +3 -0
- package/dist/module-types/src/dashboard-rpc/reads.d.ts +184 -0
- package/dist/module-types/src/dashboard-rpc/relay-agent.d.ts +8 -0
- package/dist/module-types/src/dashboard-rpc/stream-forward.d.ts +16 -0
- package/dist/module-types/src/driver-names.d.ts +21 -0
- package/dist/module-types/src/error-message.d.ts +7 -0
- package/dist/module-types/src/event-stream.d.ts +32 -0
- package/dist/module-types/src/events.d.ts +235 -0
- package/dist/module-types/src/format-bytes.d.ts +2 -0
- package/dist/module-types/src/has-remote.d.ts +7 -0
- package/dist/module-types/src/index.d.ts +41 -0
- package/dist/module-types/src/jsonl-tail.d.ts +58 -0
- package/dist/module-types/src/loopback-host.d.ts +19 -0
- package/dist/module-types/src/node-fs.d.ts +32 -0
- package/dist/module-types/src/open-choices.d.ts +14 -0
- package/dist/module-types/src/openagent-dir.d.ts +10 -0
- package/dist/module-types/src/openagent-gitignore.d.ts +11 -0
- package/dist/module-types/src/pick-directory.d.ts +29 -0
- package/dist/module-types/src/preference-defaults.d.ts +42 -0
- package/dist/module-types/src/project-commands.d.ts +23 -0
- package/dist/module-types/src/project-errors.d.ts +59 -0
- package/dist/module-types/src/project-hooks.d.ts +129 -0
- package/dist/module-types/src/project-modules.d.ts +49 -0
- package/dist/module-types/src/project-presets.d.ts +29 -0
- package/dist/module-types/src/project.d.ts +28 -0
- package/dist/module-types/src/publish-levels.d.ts +32 -0
- package/dist/module-types/src/quota-boundary.d.ts +64 -0
- package/dist/module-types/src/quota-poller.d.ts +82 -0
- package/dist/module-types/src/registry.d.ts +226 -0
- package/dist/module-types/src/store/agent-checkout.d.ts +53 -0
- package/dist/module-types/src/store/agent-store.d.ts +266 -0
- package/dist/module-types/src/store/branches.d.ts +163 -0
- package/dist/module-types/src/store/git-host.d.ts +113 -0
- package/dist/module-types/src/store/index.d.ts +9 -0
- package/dist/module-types/src/store/provided.d.ts +16 -0
- package/dist/module-types/src/store/queue.d.ts +45 -0
- package/dist/module-types/src/store/repository.d.ts +32 -0
- package/dist/module-types/src/store/run-record.d.ts +21 -0
- package/dist/module-types/src/store/runs.d.ts +107 -0
- package/dist/module-types/src/store/tickets.d.ts +72 -0
- package/dist/module-types/src/terminal.d.ts +3 -0
- package/dist/module-types/src/worktrees.d.ts +89 -0
- package/dist/module.css +50 -0
- package/dist/node-fs.d.ts +33 -0
- package/dist/node-fs.d.ts.map +1 -0
- package/dist/node-fs.js +57 -0
- package/dist/node-fs.js.map +1 -0
- package/dist/open-choices.d.ts +15 -0
- package/dist/open-choices.d.ts.map +1 -0
- package/dist/open-choices.js +31 -0
- package/dist/open-choices.js.map +1 -0
- package/dist/openagent-dir.d.ts +11 -0
- package/dist/openagent-dir.d.ts.map +1 -0
- package/dist/openagent-dir.js +11 -0
- package/dist/openagent-dir.js.map +1 -0
- package/dist/openagent-gitignore.d.ts +12 -0
- package/dist/openagent-gitignore.d.ts.map +1 -0
- package/dist/openagent-gitignore.js +19 -0
- package/dist/openagent-gitignore.js.map +1 -0
- package/dist/pick-directory.d.ts +30 -0
- package/dist/pick-directory.d.ts.map +1 -0
- package/dist/pick-directory.js +102 -0
- package/dist/pick-directory.js.map +1 -0
- package/dist/preference-defaults.d.ts +43 -0
- package/dist/preference-defaults.d.ts.map +1 -0
- package/dist/preference-defaults.js +34 -0
- package/dist/preference-defaults.js.map +1 -0
- package/dist/project-commands.d.ts +24 -0
- package/dist/project-commands.d.ts.map +1 -0
- package/dist/project-commands.js +57 -0
- package/dist/project-commands.js.map +1 -0
- package/dist/project-errors.d.ts +60 -0
- package/dist/project-errors.d.ts.map +1 -0
- package/dist/project-errors.js +51 -0
- package/dist/project-errors.js.map +1 -0
- package/dist/project-hooks.d.ts +130 -0
- package/dist/project-hooks.d.ts.map +1 -0
- package/dist/project-hooks.js +232 -0
- package/dist/project-hooks.js.map +1 -0
- package/dist/project-modules.d.ts +50 -0
- package/dist/project-modules.d.ts.map +1 -0
- package/dist/project-modules.js +110 -0
- package/dist/project-modules.js.map +1 -0
- package/dist/project-pass.d.ts +32 -0
- package/dist/project-pass.d.ts.map +1 -0
- package/dist/project-pass.js +45 -0
- package/dist/project-pass.js.map +1 -0
- package/dist/project-presets.d.ts +30 -0
- package/dist/project-presets.d.ts.map +1 -0
- package/dist/project-presets.js +74 -0
- package/dist/project-presets.js.map +1 -0
- package/dist/project.d.ts +29 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +41 -0
- package/dist/project.js.map +1 -0
- package/dist/publish-levels.d.ts +33 -0
- package/dist/publish-levels.d.ts.map +1 -0
- package/dist/publish-levels.js +53 -0
- package/dist/publish-levels.js.map +1 -0
- package/dist/quota-boundary.d.ts +65 -0
- package/dist/quota-boundary.d.ts.map +1 -0
- package/dist/quota-boundary.js +135 -0
- package/dist/quota-boundary.js.map +1 -0
- package/dist/quota-poller.d.ts +83 -0
- package/dist/quota-poller.d.ts.map +1 -0
- package/dist/quota-poller.js +118 -0
- package/dist/quota-poller.js.map +1 -0
- package/dist/registry.d.ts +227 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +364 -0
- package/dist/registry.js.map +1 -0
- package/dist/remove-files.d.ts +24 -0
- package/dist/remove-files.d.ts.map +1 -0
- package/dist/remove-files.js +98 -0
- package/dist/remove-files.js.map +1 -0
- package/dist/request-path.d.ts +10 -0
- package/dist/request-path.d.ts.map +1 -0
- package/dist/request-path.js +16 -0
- package/dist/request-path.js.map +1 -0
- package/dist/store/agent-checkout.d.ts +54 -0
- package/dist/store/agent-checkout.d.ts.map +1 -0
- package/dist/store/agent-checkout.js +61 -0
- package/dist/store/agent-checkout.js.map +1 -0
- package/dist/store/agent-store.d.ts +267 -0
- package/dist/store/agent-store.d.ts.map +1 -0
- package/dist/store/agent-store.js +190 -0
- package/dist/store/agent-store.js.map +1 -0
- package/dist/store/branches.d.ts +164 -0
- package/dist/store/branches.d.ts.map +1 -0
- package/dist/store/branches.js +187 -0
- package/dist/store/branches.js.map +1 -0
- package/dist/store/git-host.d.ts +114 -0
- package/dist/store/git-host.d.ts.map +1 -0
- package/dist/store/git-host.js +103 -0
- package/dist/store/git-host.js.map +1 -0
- package/dist/store/index.d.ts +10 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +10 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/provided.d.ts +17 -0
- package/dist/store/provided.d.ts.map +1 -0
- package/dist/store/provided.js +37 -0
- package/dist/store/provided.js.map +1 -0
- package/dist/store/queue.d.ts +46 -0
- package/dist/store/queue.d.ts.map +1 -0
- package/dist/store/queue.js +61 -0
- package/dist/store/queue.js.map +1 -0
- package/dist/store/repository.d.ts +33 -0
- package/dist/store/repository.d.ts.map +1 -0
- package/dist/store/repository.js +25 -0
- package/dist/store/repository.js.map +1 -0
- package/dist/store/run-record.d.ts +22 -0
- package/dist/store/run-record.d.ts.map +1 -0
- package/dist/store/run-record.js +108 -0
- package/dist/store/run-record.js.map +1 -0
- package/dist/store/runs.d.ts +108 -0
- package/dist/store/runs.d.ts.map +1 -0
- package/dist/store/runs.js +146 -0
- package/dist/store/runs.js.map +1 -0
- package/dist/store/test-branches.d.ts +18 -0
- package/dist/store/test-branches.d.ts.map +1 -0
- package/dist/store/test-branches.js +59 -0
- package/dist/store/test-branches.js.map +1 -0
- package/dist/store/test-runs.d.ts +15 -0
- package/dist/store/test-runs.d.ts.map +1 -0
- package/dist/store/test-runs.js +37 -0
- package/dist/store/test-runs.js.map +1 -0
- package/dist/store/tickets.d.ts +73 -0
- package/dist/store/tickets.d.ts.map +1 -0
- package/dist/store/tickets.js +67 -0
- package/dist/store/tickets.js.map +1 -0
- package/dist/terminal.d.ts +4 -0
- package/dist/terminal.d.ts.map +1 -0
- package/dist/terminal.js +97 -0
- package/dist/terminal.js.map +1 -0
- package/dist/update-check.d.ts +44 -0
- package/dist/update-check.d.ts.map +1 -0
- package/dist/update-check.js +71 -0
- package/dist/update-check.js.map +1 -0
- package/dist/worktrees.d.ts +90 -0
- package/dist/worktrees.d.ts.map +1 -0
- package/dist/worktrees.js +123 -0
- package/dist/worktrees.js.map +1 -0
- package/package.json +103 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/dashboard/activity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAcvC;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,0FAA0F;IAC1F,IAAI,EAAE,SAAS,GAAG,UAAU,CAAA;IAC5B,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uGAAuG;IACvG,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,0EAA0E;AAC1E,MAAM,WAAW,YAAY;IAC3B,gGAAgG;IAChG,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC,CAAA;CACnD;AAgBD;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,cAAc,EAAE,EAC1B,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAYnC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { readAllAgents } from '../store/index.js';
|
|
2
|
+
// The identity + diff live in the leaf `keys.ts` so the dashboard can share them (they are pure);
|
|
3
|
+
// re-exported here so this stays the import site for anything that already reads them from the
|
|
4
|
+
// module that defines `Activity`.
|
|
5
|
+
export { activityKey } from './keys.js';
|
|
6
|
+
// The "New activity" feed (#627): the cross-project stream of run lifecycle transitions that
|
|
7
|
+
// do NOT need the human — an agent started, an agent finished. It is the default-off notification
|
|
8
|
+
// category, the counterpart to the interventions queue (which is the always-on "needs you"
|
|
9
|
+
// half). Same shape and same "only genuinely new" diff as interventions.ts, so the browser
|
|
10
|
+
// hook folds it into a baseline on first look and then notifies once per transition — you hear
|
|
11
|
+
// an agent kick off and an agent land, nothing when the page opens.
|
|
12
|
+
/** How many recent agents per project to consider. Bounds the finished-set — older agents rolled off
|
|
13
|
+
* long ago and were already baselined, so they never fire. A running agent is always newest (live
|
|
14
|
+
* meta is prepended), so it is always in range. */
|
|
15
|
+
const RECENT_RUNS = 20;
|
|
16
|
+
/** Map one agent to its current activity item: `started` while running, else `finished`. */
|
|
17
|
+
function activityFor(project, agent) {
|
|
18
|
+
const kind = agent.status === 'running' ? 'started' : 'finished';
|
|
19
|
+
return {
|
|
20
|
+
projectId: project.id,
|
|
21
|
+
projectName: project.name,
|
|
22
|
+
agentId: agent.id,
|
|
23
|
+
kind,
|
|
24
|
+
...(agent.intent ? { title: agent.intent } : {}),
|
|
25
|
+
...(kind === 'finished' ? { status: agent.status } : {}),
|
|
26
|
+
...(agent.updatedAt ? { updatedAt: agent.updatedAt } : {}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Build the cross-project activity feed: for each registered project's most recent agents, one
|
|
31
|
+
* item per agent reflecting where it is now (`started` while it runs, `finished` once it lands),
|
|
32
|
+
* newest first. Forgiving — a project whose agents cannot be read simply contributes nothing, and
|
|
33
|
+
* comes back named as one that was *not* read whole (#1623), since "nothing happened there" and
|
|
34
|
+
* "I could not look" are the same empty list to everyone but the notification watcher.
|
|
35
|
+
*
|
|
36
|
+
* The `started` and `finished` items for one agent carry distinct keys ({@link activityKey}), so a
|
|
37
|
+
* run that is still going notifies once (started) and again when it lands (finished). An agent that
|
|
38
|
+
* both starts and finishes between two polls is only ever seen terminal, so it notifies once
|
|
39
|
+
* (finished) — one quick agent, one line.
|
|
40
|
+
*/
|
|
41
|
+
export async function buildActivity(projects, deps = {}) {
|
|
42
|
+
const readAgents = deps.readAgents ?? readAllAgents;
|
|
43
|
+
const items = [];
|
|
44
|
+
const whole = [];
|
|
45
|
+
for (const project of projects) {
|
|
46
|
+
const read = await readAgents(project.path).catch(() => undefined);
|
|
47
|
+
if (!read)
|
|
48
|
+
continue;
|
|
49
|
+
whole.push(project.id);
|
|
50
|
+
for (const agent of read.slice(0, RECENT_RUNS))
|
|
51
|
+
items.push(activityFor(project, agent));
|
|
52
|
+
}
|
|
53
|
+
items.sort((a, b) => (b.updatedAt ?? '').localeCompare(a.updatedAt ?? ''));
|
|
54
|
+
return { items, whole };
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../../src/dashboard/activity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAoC,MAAM,mBAAmB,CAAA;AAGnF,kGAAkG;AAClG,+FAA+F;AAC/F,kCAAkC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,6FAA6F;AAC7F,kGAAkG;AAClG,2FAA2F;AAC3F,2FAA2F;AAC3F,+FAA+F;AAC/F,oEAAoE;AAEpE;;mDAEmD;AACnD,MAAM,WAAW,GAAG,EAAE,CAAA;AA4BtB,4FAA4F;AAC5F,SAAS,WAAW,CAAC,OAAuB,EAAE,KAAgB;IAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAA;IAChE,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,EAAE;QACrB,WAAW,EAAE,OAAO,CAAC,IAAI;QACzB,OAAO,EAAE,KAAK,CAAC,EAAE;QACjB,IAAI;QACJ,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,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{ Cached } from './cache.js';
|
|
3
|
+
import type { AgentMeta } from '../store/index.js';
|
|
4
|
+
import { type BranchesFor } from '../store/branches.js';
|
|
5
|
+
import { type GitHostFor } from '../store/git-host.js';
|
|
6
|
+
import { type RunsFor } from '../store/runs.js';
|
|
7
|
+
/** One commit a session put on its branch. */
|
|
8
|
+
export interface HandoffCommit {
|
|
9
|
+
sha: string;
|
|
10
|
+
/** Short sha, for display. */
|
|
11
|
+
short: string;
|
|
12
|
+
subject: string;
|
|
13
|
+
}
|
|
14
|
+
/** One file the session changed, against the branch point. */
|
|
15
|
+
export interface HandoffFile {
|
|
16
|
+
path: string;
|
|
17
|
+
insertions: number;
|
|
18
|
+
deletions: number;
|
|
19
|
+
/** True for a binary file, where line counts are meaningless. */
|
|
20
|
+
binary: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** What a finished session produced and what can still be done with it. */
|
|
23
|
+
export interface AgentHandoff {
|
|
24
|
+
/** The branch the work is on. */
|
|
25
|
+
branch: string;
|
|
26
|
+
/** The name the agent gave its work, as the branches provider answers it; absent while the run has not named it. */
|
|
27
|
+
name?: string;
|
|
28
|
+
/** The branch still exists in the repo (a deleted or never-created one does not). */
|
|
29
|
+
exists: boolean;
|
|
30
|
+
/** The branch is gone because the run changed nothing ({@link leftNothing}), not because work went. */
|
|
31
|
+
unchanged?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The run's work was landed: merged into its main agent's branch by that agent, or into the
|
|
34
|
+
* project's default branch by the person, on this machine. The run's own branch went with that,
|
|
35
|
+
* and what is read here is what it held, by the last commit its record kept.
|
|
36
|
+
*/
|
|
37
|
+
landed?: boolean;
|
|
38
|
+
/** What the branch is measured against: the repo's default branch, or the commit the run's own work begins at (a run started from another branch, or one already merged), when one was found. */
|
|
39
|
+
base?: string;
|
|
40
|
+
commits: HandoffCommit[];
|
|
41
|
+
files: HandoffFile[];
|
|
42
|
+
insertions: number;
|
|
43
|
+
deletions: number;
|
|
44
|
+
/**
|
|
45
|
+
* The session produced nothing to hand off: the branch exists but carries no commit the base
|
|
46
|
+
* does not already have — or nothing beyond OpenAgent's own bookkeeping (#1291), which is
|
|
47
|
+
* committed for provenance, never as publishable work. Said out loud, rather than shown as an
|
|
48
|
+
* empty branch.
|
|
49
|
+
*/
|
|
50
|
+
empty: boolean;
|
|
51
|
+
/** The repo has a remote to push to at all. */
|
|
52
|
+
hasRemote: boolean;
|
|
53
|
+
/** The branch is on the remote and the remote is at the same commit. */
|
|
54
|
+
pushed: boolean;
|
|
55
|
+
/** The branch is already merged into the base. */
|
|
56
|
+
merged: boolean;
|
|
57
|
+
/** The project has a git host package (#1820): a pull request is a next step at all. Without one, the last step is the push. */
|
|
58
|
+
gitHost: boolean;
|
|
59
|
+
/** The PR opened for this branch, when there is one. */
|
|
60
|
+
pr?: LinkedPr;
|
|
61
|
+
/** The PR is not known yet, rather than absent (#1028): the lookup is still running. */
|
|
62
|
+
prPending?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The files the session changed and never committed, read from its own checkout (#1173).
|
|
65
|
+
*
|
|
66
|
+
* The agent is told to commit its work, but one that ended without doing so holds its whole
|
|
67
|
+
* output in an uncommitted tree, and nothing commits it on the agent's behalf (#1638). That work
|
|
68
|
+
* is not on the branch yet, so it is
|
|
69
|
+
* not in {@link commits} and it does not make {@link empty} false. Paths rather than a count,
|
|
70
|
+
* because a no-diff branch must *name* what is waiting instead of offering an Open PR that
|
|
71
|
+
* the git host can only refuse. Absent when no checkout is on the branch any more — "no checkout"
|
|
72
|
+
* and "a checkout, tree clean" are different answers.
|
|
73
|
+
*/
|
|
74
|
+
pendingFiles?: string[];
|
|
75
|
+
}
|
|
76
|
+
/** Injectable seams so the reader is unit-testable off disk and off the provider. */
|
|
77
|
+
export interface AgentHandoffDeps {
|
|
78
|
+
pr?: BranchPrLookup;
|
|
79
|
+
/** The project's checkouts and branches (default the project's provider, {@link projectBranches}). */
|
|
80
|
+
branches?: BranchesFor;
|
|
81
|
+
/** The project's git host (default the project's provider, {@link projectGitHost}). */
|
|
82
|
+
gitHost?: GitHostFor;
|
|
83
|
+
/**
|
|
84
|
+
* When the agent started (ISO), so the PR lookup can tell the agent's own PR from an earlier agent's
|
|
85
|
+
* on the same branch name (#1251). Without it, only an open PR is trusted.
|
|
86
|
+
*/
|
|
87
|
+
since?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Which of the run's own PRs answers, when it has more than one (#1512). Identity questions want
|
|
90
|
+
* the first; a handoff decision comparing the branch tip against a PR's head wants the last one
|
|
91
|
+
* that saw the branch, or work a later PR already landed reads as unlanded. See {@link pickAgentPr}.
|
|
92
|
+
*/
|
|
93
|
+
order?: 'first' | 'latest';
|
|
94
|
+
/** The commit the run's own work begins at ({@link AgentMeta.baseCommit}): what the branch is measured from. */
|
|
95
|
+
from?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The branch an agent's work is on: what was recorded while the checkout existed (#799/#1277).
|
|
99
|
+
* The agent renames its branch itself (#1725), so anything but the record is a guess, and a run
|
|
100
|
+
* whose record carries no branch has none to hand off.
|
|
101
|
+
*/
|
|
102
|
+
export declare function agentBranchFor(agent: {
|
|
103
|
+
id: string;
|
|
104
|
+
branch?: string;
|
|
105
|
+
}): string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Whether a run whose branch is gone changed nothing (#1850): it ended `done`, `failed` or
|
|
108
|
+
* `stopped` on this machine, has no pull request, and was not landed by a main agent (a landed
|
|
109
|
+
* run's branch went because its work moved on, not for holding nothing). Such a run's own tool recorded the branch's
|
|
110
|
+
* last name as it ended, a Stop included, and then reclaimed the checkout, and the branches rule
|
|
111
|
+
* deletes a branch with the checkout only when it holds nothing. A run whose process died is marked
|
|
112
|
+
* `stopped` by the sweep only when it left no checkout, so it had nowhere to keep a change. A run
|
|
113
|
+
* another machine ran leaves no such proof here, and one `waiting` keeps its checkout.
|
|
114
|
+
*/
|
|
115
|
+
export declare function leftNothing(agent: {
|
|
116
|
+
status?: string;
|
|
117
|
+
host?: string;
|
|
118
|
+
pr?: unknown;
|
|
119
|
+
landed?: string;
|
|
120
|
+
}, host?: string): boolean;
|
|
121
|
+
/** The cached single-PR read {@link resolveAgentPr} asks for the recorded PR's current state. */
|
|
122
|
+
export type CachedBranchPrLookup = (cwd: string, branch?: string) => Promise<Cached<LinkedPr | undefined>>;
|
|
123
|
+
/** What {@link resolveAgentPr} needs to know about an agent: structurally satisfied by {@link AgentMeta}. */
|
|
124
|
+
export interface PrAgent {
|
|
125
|
+
id: string;
|
|
126
|
+
branch?: string;
|
|
127
|
+
/** The pull request the agent recorded when one was opened for it (E6). */
|
|
128
|
+
pr?: {
|
|
129
|
+
number: number;
|
|
130
|
+
url: string;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The pull request that belongs to an agent: the one it recorded (E6), read live for its state.
|
|
135
|
+
*
|
|
136
|
+
* The number is a fact about the agent, so the agent writes it down — at the moment its handoff opens
|
|
137
|
+
* the PR, or when the dashboard's button does after the process is gone. Every surface then reads
|
|
138
|
+
* the same integer instead of re-deriving it.
|
|
139
|
+
*
|
|
140
|
+
* What that replaced: a three-way branch-name ladder (the recorded branch, then a branch built from
|
|
141
|
+
* the session name, then the run-id branch, because a hands-off web agent's checkout is gone and its
|
|
142
|
+
* session name may be a reused pin) plus a timestamp heuristic on top of it, so that a predecessor's PR on
|
|
143
|
+
* a shared branch name was not mistaken for this agent's. Three sources and a guess, standing in for
|
|
144
|
+
* one integer nobody had written down — the same lesson the `branch` event (#1277) already learned.
|
|
145
|
+
*
|
|
146
|
+
* The *state* is still read live, because it changes without this agent doing anything: a PR merges,
|
|
147
|
+
* a human closes it. That read rides the PR-lookup cache (#1028), and `pending` while it is warming means the
|
|
148
|
+
* caller can ask again rather than render "no PR".
|
|
149
|
+
*/
|
|
150
|
+
export declare function resolveAgentPr(cwd: string, agent: PrAgent, prs?: CachedBranchPrLookup): Promise<Cached<LinkedPr | undefined>>;
|
|
151
|
+
/**
|
|
152
|
+
* Merge a finished session's open PR (#1391): the Merge action, pressed by a human saying "it's
|
|
153
|
+
* good, land it". The landing itself is the git host provider's (`merge <number>`): armed to merge on
|
|
154
|
+
* green, merged at once where it is already green, or watched by the provider where the
|
|
155
|
+
* repository allows no auto-merge; a draft is marked ready on the way. Refuses when the agent has
|
|
156
|
+
* no PR or it is no longer open — "already merged" is an answer, not an action.
|
|
157
|
+
*/
|
|
158
|
+
export declare function mergeAgentPr(cwd: string, agent: PrAgent, deps?: {
|
|
159
|
+
gitHost?: GitHostFor;
|
|
160
|
+
prs?: CachedBranchPrLookup;
|
|
161
|
+
}): Promise<HandoffResult>;
|
|
162
|
+
/**
|
|
163
|
+
* Read what a finished session left behind, for `branch`: the branch's git facts from the
|
|
164
|
+
* project's branches provider, and the run's own pull request from OpenAgent's lookup.
|
|
165
|
+
*
|
|
166
|
+
* Returns undefined only when the project has no branches provider, or the provider did not
|
|
167
|
+
* answer for the branch. A branch that no longer exists still returns a handoff (with
|
|
168
|
+
* `exists: false`), because "that branch is gone" is itself the answer the dashboard needs to
|
|
169
|
+
* show — and its PR is a remote question, still answerable (#1255).
|
|
170
|
+
*/
|
|
171
|
+
export declare function readAgentHandoff(cwd: string, branch: string, deps?: AgentHandoffDeps): Promise<AgentHandoff | undefined>;
|
|
172
|
+
/**
|
|
173
|
+
* What a finished run left behind, off its record: {@link readAgentHandoff} for the branch the
|
|
174
|
+
* record names, measured from the commit the run's own work begins at when the record names one
|
|
175
|
+
* (a run started from another branch holds, beyond the default branch, that branch's work too).
|
|
176
|
+
*
|
|
177
|
+
* A run its main agent landed has no branch left: what it held is read by the last commit its
|
|
178
|
+
* record kept, and the answer says landed. A branch gone because the run changed nothing is said
|
|
179
|
+
* as that, not as lost work. Undefined for a run with neither a branch nor a landed commit.
|
|
180
|
+
*/
|
|
181
|
+
export declare function readRunHandoff(cwd: string, agent: Pick<AgentMeta, 'id' | 'startedAt' | 'branch' | 'baseCommit' | 'landed' | 'status' | 'host' | 'pr'>, deps?: AgentHandoffDeps): Promise<AgentHandoff | undefined>;
|
|
182
|
+
/**
|
|
183
|
+
* What a handoff action did. The PR's `number` rides along with its `url` (E6), because the number
|
|
184
|
+
* is the fact worth *recording* — every surface that wants an agent's PR then reads it off the agent
|
|
185
|
+
* rather than re-deriving it later.
|
|
186
|
+
*/
|
|
187
|
+
export type HandoffResult = {
|
|
188
|
+
ok: true;
|
|
189
|
+
url?: string;
|
|
190
|
+
number?: number;
|
|
191
|
+
} | {
|
|
192
|
+
ok: false;
|
|
193
|
+
error: string;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Push a finished session's branch (#1820): the last step where the project has no git host, or the
|
|
197
|
+
* step a person wants on its own. The branches provider pushes it under its clean rule; a branch
|
|
198
|
+
* only the remote has is already there. Refuses a session that recorded no branch.
|
|
199
|
+
*/
|
|
200
|
+
export declare function pushAgentBranch(cwd: string, agent: Pick<AgentMeta, 'id' | 'branch'>, deps?: {
|
|
201
|
+
branches?: BranchesFor;
|
|
202
|
+
}): Promise<HandoffResult>;
|
|
203
|
+
/**
|
|
204
|
+
* Merge a finished session's branch into the project's default branch, on this machine: how the
|
|
205
|
+
* work reaches the project's own folder where there is no remote to push to. The branches provider
|
|
206
|
+
* merges and deletes the branch; the session's record then keeps the branch's last commit and the
|
|
207
|
+
* commit its work began at, so what it changed is still read once the branch is gone.
|
|
208
|
+
*/
|
|
209
|
+
export declare function mergeAgentBranch(cwd: string, agent: Pick<AgentMeta, 'id' | 'branch'>, deps?: {
|
|
210
|
+
branches?: BranchesFor;
|
|
211
|
+
runs?: RunsFor;
|
|
212
|
+
}): Promise<HandoffResult>;
|
|
213
|
+
/**
|
|
214
|
+
* Open a draft PR for a branch that exists only on the remote (#1601): a cloud session's own
|
|
215
|
+
* `claude/*` branch was pushed from a VM this machine never sees, so there is nothing to push
|
|
216
|
+
* here — the provider publishes the branch as the remote has it. Draft because a PR
|
|
217
|
+
* OpenAgent opens by itself must not put a review request in anyone's inbox, and the
|
|
218
|
+
* interventions queue keeps listing a session's draft.
|
|
219
|
+
*/
|
|
220
|
+
export declare function openRemoteBranchPullRequest(cwd: string, agent: HandoffAgent, branch: string, deps?: {
|
|
221
|
+
branches?: BranchesFor;
|
|
222
|
+
gitHost?: GitHostFor;
|
|
223
|
+
}): Promise<HandoffResult>;
|
|
224
|
+
/**
|
|
225
|
+
* Open a PR for a finished session, deciding from what the agent recorded which cases should not
|
|
226
|
+
* open one. Reads the branch's handoff first: a branch that no longer exists, or a session that
|
|
227
|
+
* changed nothing, is a clear error rather than an empty PR, and a branch that already has a PR
|
|
228
|
+
* returns that one. Title is its branch, else the id; body is the intent, plus which session did it. This is the handoff decision the
|
|
229
|
+
* dashboard's open-PR button offers; the RPC layer only resolves which run it is about, and the
|
|
230
|
+
* two providers do the pushing and the opening.
|
|
231
|
+
*/
|
|
232
|
+
export declare function openAgentPullRequest(cwd: string, agent: AgentMeta, options?: {
|
|
233
|
+
draft?: boolean;
|
|
234
|
+
branches?: BranchesFor;
|
|
235
|
+
gitHost?: GitHostFor;
|
|
236
|
+
pr?: BranchPrLookup;
|
|
237
|
+
}): Promise<HandoffResult>;
|
|
238
|
+
/**
|
|
239
|
+
* The little a handoff needs to know about the agent it is for: which branch, and what to say on
|
|
240
|
+
* the PR. Narrower than {@link AgentMeta} so a caller cannot quietly start depending on the rest
|
|
241
|
+
* of the agent's state.
|
|
242
|
+
*/
|
|
243
|
+
export type HandoffAgent = Pick<AgentMeta, 'id' | 'branch' | 'intent'> & Partial<Pick<AgentMeta, 'startedAt'>>;
|
|
244
|
+
//# sourceMappingURL=agent-handoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-handoff.d.ts","sourceRoot":"","sources":["../../src/dashboard/agent-handoff.ts"],"names":[],"mappings":"AACA,OAAO,EAA4E,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACjJ,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,Y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cachedPrView, cachedPrsForBranch, forgetBranchPrs, forgetPr, pickAgentPr } from './pull-requests.js';
|
|
3
|
+
import { projectBranches } from '../store/branches.js';
|
|
4
|
+
import { projectGitHost } from '../store/git-host.js';
|
|
5
|
+
import { projectRuns } from '../store/runs.js';
|
|
6
|
+
/**
|
|
7
|
+
* The branch an agent's work is on: what was recorded while the checkout existed (#799/#1277).
|
|
8
|
+
* The agent renames its branch itself (#1725), so anything but the record is a guess, and a run
|
|
9
|
+
* whose record carries no branch has none to hand off.
|
|
10
|
+
*/
|
|
11
|
+
export function agentBranchFor(agent) {
|
|
12
|
+
return agent.branch;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Whether a run whose branch is gone changed nothing (#1850): it ended `done`, `failed` or
|
|
16
|
+
* `stopped` on this machine, has no pull request, and was not landed by a main agent (a landed
|
|
17
|
+
* run's branch went because its work moved on, not for holding nothing). Such a run's own tool recorded the branch's
|
|
18
|
+
* last name as it ended, a Stop included, and then reclaimed the checkout, and the branches rule
|
|
19
|
+
* deletes a branch with the checkout only when it holds nothing. A run whose process died is marked
|
|
20
|
+
* `stopped` by the sweep only when it left no checkout, so it had nowhere to keep a change. A run
|
|
21
|
+
* another machine ran leaves no such proof here, and one `waiting` keeps its checkout.
|
|
22
|
+
*/
|
|
23
|
+
export function leftNothing(agent, host = hostname()) {
|
|
24
|
+
return !agent.pr && agent.landed === undefined && (agent.status === 'done' || agent.status === 'failed' || agent.status === 'stopped') && agent.host === host;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The branch's PR as it applies to *this* run: the injected seam when the caller gave one, else
|
|
28
|
+
* the cached history filtered through {@link pickAgentPr} with the agent's start time (#1251).
|
|
29
|
+
*/
|
|
30
|
+
async function lookupAgentPr(cwd, branch, deps) {
|
|
31
|
+
if (deps.pr)
|
|
32
|
+
return { value: await deps.pr(cwd, branch).catch(() => undefined), pending: false };
|
|
33
|
+
const prs = await cachedPrsForBranch(cwd, branch).catch(() => ({ value: undefined, pending: false }));
|
|
34
|
+
return { value: prs.value ? pickAgentPr(prs.value, deps.since, deps.order) : undefined, pending: prs.pending };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The pull request that belongs to an agent: the one it recorded (E6), read live for its state.
|
|
38
|
+
*
|
|
39
|
+
* The number is a fact about the agent, so the agent writes it down — at the moment its handoff opens
|
|
40
|
+
* the PR, or when the dashboard's button does after the process is gone. Every surface then reads
|
|
41
|
+
* the same integer instead of re-deriving it.
|
|
42
|
+
*
|
|
43
|
+
* What that replaced: a three-way branch-name ladder (the recorded branch, then a branch built from
|
|
44
|
+
* the session name, then the run-id branch, because a hands-off web agent's checkout is gone and its
|
|
45
|
+
* session name may be a reused pin) plus a timestamp heuristic on top of it, so that a predecessor's PR on
|
|
46
|
+
* a shared branch name was not mistaken for this agent's. Three sources and a guess, standing in for
|
|
47
|
+
* one integer nobody had written down — the same lesson the `branch` event (#1277) already learned.
|
|
48
|
+
*
|
|
49
|
+
* The *state* is still read live, because it changes without this agent doing anything: a PR merges,
|
|
50
|
+
* a human closes it. That read rides the PR-lookup cache (#1028), and `pending` while it is warming means the
|
|
51
|
+
* caller can ask again rather than render "no PR".
|
|
52
|
+
*/
|
|
53
|
+
export async function resolveAgentPr(cwd, agent, prs = cachedPrView) {
|
|
54
|
+
if (!agent.pr)
|
|
55
|
+
return { value: undefined, pending: false };
|
|
56
|
+
const branch = agentBranchFor(agent);
|
|
57
|
+
const read = await prs(cwd, branch).catch(() => ({ value: undefined, pending: false }));
|
|
58
|
+
// The live read is about the recorded PR's *state*; a different number on the branch is some
|
|
59
|
+
// other PR and never this agent's answer.
|
|
60
|
+
if (read.value && read.value.number === agent.pr.number)
|
|
61
|
+
return { value: read.value, pending: false };
|
|
62
|
+
// Nothing live to say, so the recorded fact stands on its own: an agent whose PR is on a branch this
|
|
63
|
+
// machine cannot see still has a PR, and its number and URL are what the surfaces need.
|
|
64
|
+
return { value: { ...agent.pr, state: read.pending ? 'OPEN' : 'UNKNOWN', title: '' }, pending: read.pending };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Merge a finished session's open PR (#1391): the Merge action, pressed by a human saying "it's
|
|
68
|
+
* good, land it". The landing itself is the git host provider's (`merge <number>`): armed to merge on
|
|
69
|
+
* green, merged at once where it is already green, or watched by the provider where the
|
|
70
|
+
* repository allows no auto-merge; a draft is marked ready on the way. Refuses when the agent has
|
|
71
|
+
* no PR or it is no longer open — "already merged" is an answer, not an action.
|
|
72
|
+
*/
|
|
73
|
+
export async function mergeAgentPr(cwd, agent, deps = {}) {
|
|
74
|
+
const pr = (await resolveAgentPr(cwd, agent, deps.prs)).value;
|
|
75
|
+
if (!pr)
|
|
76
|
+
return { ok: false, error: 'this session has no pull request to merge' };
|
|
77
|
+
if (pr.state !== 'OPEN')
|
|
78
|
+
return { ok: false, error: `this session's PR is already ${pr.state.toLowerCase()}` };
|
|
79
|
+
const gitHost = await (deps.gitHost ?? projectGitHost)(cwd).catch(() => undefined);
|
|
80
|
+
if (!gitHost)
|
|
81
|
+
return { ok: false, error: 'this project has no git host package to merge with' };
|
|
82
|
+
const merged = await gitHost.merge(pr.number);
|
|
83
|
+
if (!merged.ok)
|
|
84
|
+
return { ok: false, error: merged.error };
|
|
85
|
+
// The PR's cached state just changed, so the branch's cached read must go or the bar keeps
|
|
86
|
+
// offering a merge for a PR that landed (#1028).
|
|
87
|
+
const branch = agentBranchFor(agent);
|
|
88
|
+
forgetPr(cwd, branch);
|
|
89
|
+
if (branch !== undefined)
|
|
90
|
+
forgetBranchPrs(cwd, branch);
|
|
91
|
+
return { ok: true, url: pr.url, number: pr.number };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Read what a finished session left behind, for `branch`: the branch's git facts from the
|
|
95
|
+
* project's branches provider, and the run's own pull request from OpenAgent's lookup.
|
|
96
|
+
*
|
|
97
|
+
* Returns undefined only when the project has no branches provider, or the provider did not
|
|
98
|
+
* answer for the branch. A branch that no longer exists still returns a handoff (with
|
|
99
|
+
* `exists: false`), because "that branch is gone" is itself the answer the dashboard needs to
|
|
100
|
+
* show — and its PR is a remote question, still answerable (#1255).
|
|
101
|
+
*/
|
|
102
|
+
export async function readAgentHandoff(cwd, branch, deps = {}) {
|
|
103
|
+
const branches = await (deps.branches ?? projectBranches)(cwd).catch(() => undefined);
|
|
104
|
+
if (!branches)
|
|
105
|
+
return undefined;
|
|
106
|
+
const [state] = await branches.show([branch], deps.from);
|
|
107
|
+
if (!state)
|
|
108
|
+
return undefined;
|
|
109
|
+
const gitHost = await (deps.gitHost ?? projectGitHost)(cwd).catch(() => undefined);
|
|
110
|
+
// Read through the cache and allowed to arrive late (#1028): the branch's facts are local
|
|
111
|
+
// git, and none of them should wait on the git host.
|
|
112
|
+
const pr = await lookupAgentPr(cwd, branch, deps);
|
|
113
|
+
const commits = state.commits.map(commit => ({ sha: commit.sha, short: commit.sha.slice(0, 7), subject: commit.subject }));
|
|
114
|
+
const files = state.files.map(file => ({ path: file.path, insertions: file.insertions, deletions: file.deletions, binary: file.binary }));
|
|
115
|
+
return {
|
|
116
|
+
branch,
|
|
117
|
+
...(state.name ? { name: state.name } : {}),
|
|
118
|
+
exists: state.exists,
|
|
119
|
+
...(state.base ? { base: state.base } : {}),
|
|
120
|
+
commits,
|
|
121
|
+
files,
|
|
122
|
+
insertions: files.reduce((sum, f) => sum + f.insertions, 0),
|
|
123
|
+
deletions: files.reduce((sum, f) => sum + f.deletions, 0),
|
|
124
|
+
// A session that changed nothing is a real outcome, not an error: it gets said, not shown as
|
|
125
|
+
// an empty branch with buttons that would push nothing. The files decide as well as the
|
|
126
|
+
// commits: commits that net to no change leave nothing to hand off.
|
|
127
|
+
empty: commits.length === 0 || files.length === 0,
|
|
128
|
+
hasRemote: state.hasRemote,
|
|
129
|
+
pushed: state.pushed,
|
|
130
|
+
merged: state.merged,
|
|
131
|
+
gitHost: gitHost !== undefined,
|
|
132
|
+
...(pr.value ? { pr: pr.value } : {}),
|
|
133
|
+
...(pr.pending ? { prPending: true } : {}),
|
|
134
|
+
...(state.pendingFiles ? { pendingFiles: state.pendingFiles } : {}),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* What a finished run left behind, off its record: {@link readAgentHandoff} for the branch the
|
|
139
|
+
* record names, measured from the commit the run's own work begins at when the record names one
|
|
140
|
+
* (a run started from another branch holds, beyond the default branch, that branch's work too).
|
|
141
|
+
*
|
|
142
|
+
* A run its main agent landed has no branch left: what it held is read by the last commit its
|
|
143
|
+
* record kept, and the answer says landed. A branch gone because the run changed nothing is said
|
|
144
|
+
* as that, not as lost work. Undefined for a run with neither a branch nor a landed commit.
|
|
145
|
+
*/
|
|
146
|
+
export async function readRunHandoff(cwd, agent, deps = {}) {
|
|
147
|
+
const at = agentBranchFor(agent) ?? agent.landed;
|
|
148
|
+
if (at === undefined)
|
|
149
|
+
return undefined;
|
|
150
|
+
// A commit has no pull request to look up: only a branch is asked of the git host.
|
|
151
|
+
const noPr = agentBranchFor(agent) === undefined ? { pr: async () => undefined } : {};
|
|
152
|
+
const handoff = await readAgentHandoff(cwd, at, { since: agent.startedAt, ...(agent.baseCommit !== undefined ? { from: agent.baseCommit } : {}), ...deps, ...noPr });
|
|
153
|
+
if (!handoff)
|
|
154
|
+
return undefined;
|
|
155
|
+
if (agent.landed !== undefined)
|
|
156
|
+
return { ...handoff, landed: true };
|
|
157
|
+
return !handoff.exists && leftNothing(agent) ? { ...handoff, unchanged: true } : handoff;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Open a PR for a branch: the two providers composed (#1820). The branches provider pushes the
|
|
161
|
+
* branch (`push --branch`), then the git host provider opens its request (`open --branch`); the
|
|
162
|
+
* request's base is the git host's. A branch that already has an open request is answered as it is.
|
|
163
|
+
* The branch has a PR now, so the cached "no PR" must go or the bar would keep offering to open
|
|
164
|
+
* one for the next minute (#1028) — both caches: the single-PR view and the history.
|
|
165
|
+
*/
|
|
166
|
+
async function publishBranch(cwd, branch, draft, branches, gitHost) {
|
|
167
|
+
const source = await branches(cwd).catch(() => undefined);
|
|
168
|
+
if (!source)
|
|
169
|
+
return { ok: false, error: 'this project has no branches provider to push with' };
|
|
170
|
+
const gitHostSource = await gitHost(cwd).catch(() => undefined);
|
|
171
|
+
if (!gitHostSource)
|
|
172
|
+
return { ok: false, error: 'this project has no git host package to open a pull request with' };
|
|
173
|
+
const pushed = await source.push(branch);
|
|
174
|
+
if (!pushed.ok)
|
|
175
|
+
return { ok: false, error: pushed.error };
|
|
176
|
+
const opened = await gitHostSource.open(branch, { title: draft.title, body: draft.body, ...(draft.draft ? { draft: true } : {}) });
|
|
177
|
+
if (!opened.ok)
|
|
178
|
+
return { ok: false, error: opened.error };
|
|
179
|
+
forgetPr(cwd, branch);
|
|
180
|
+
forgetBranchPrs(cwd, branch);
|
|
181
|
+
return { ok: true, url: opened.request.url, number: opened.request.number };
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Push a finished session's branch (#1820): the last step where the project has no git host, or the
|
|
185
|
+
* step a person wants on its own. The branches provider pushes it under its clean rule; a branch
|
|
186
|
+
* only the remote has is already there. Refuses a session that recorded no branch.
|
|
187
|
+
*/
|
|
188
|
+
export async function pushAgentBranch(cwd, agent, deps = {}) {
|
|
189
|
+
const branch = agentBranchFor(agent);
|
|
190
|
+
if (branch === undefined)
|
|
191
|
+
return { ok: false, error: 'this session recorded no branch to push' };
|
|
192
|
+
const source = await (deps.branches ?? projectBranches)(cwd).catch(() => undefined);
|
|
193
|
+
if (!source)
|
|
194
|
+
return { ok: false, error: 'this project has no branches provider to push with' };
|
|
195
|
+
const pushed = await source.push(branch);
|
|
196
|
+
return pushed.ok ? { ok: true } : { ok: false, error: pushed.error };
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Merge a finished session's branch into the project's default branch, on this machine: how the
|
|
200
|
+
* work reaches the project's own folder where there is no remote to push to. The branches provider
|
|
201
|
+
* merges and deletes the branch; the session's record then keeps the branch's last commit and the
|
|
202
|
+
* commit its work began at, so what it changed is still read once the branch is gone.
|
|
203
|
+
*/
|
|
204
|
+
export async function mergeAgentBranch(cwd, agent, deps = {}) {
|
|
205
|
+
const branch = agentBranchFor(agent);
|
|
206
|
+
if (branch === undefined)
|
|
207
|
+
return { ok: false, error: 'this session recorded no branch to merge' };
|
|
208
|
+
const source = await (deps.branches ?? projectBranches)(cwd).catch(() => undefined);
|
|
209
|
+
if (!source)
|
|
210
|
+
return { ok: false, error: 'this project has no branches provider to merge with' };
|
|
211
|
+
const merged = await source.merge(branch);
|
|
212
|
+
if (!merged.ok)
|
|
213
|
+
return { ok: false, error: merged.error };
|
|
214
|
+
if (!merged.deleted)
|
|
215
|
+
return { ok: true };
|
|
216
|
+
const runs = await (deps.runs ?? projectRuns)(cwd).catch(() => undefined);
|
|
217
|
+
const recorded = await runs?.patch(agent.id, { landed: { commit: merged.commit, from: merged.from } });
|
|
218
|
+
// The merge is in whatever the record says; a record that could not be written is said, since the page reads the record.
|
|
219
|
+
if (recorded && !recorded.ok)
|
|
220
|
+
return { ok: false, error: `merged into ${merged.into}, but the record was not updated: ${recorded.error}` };
|
|
221
|
+
return { ok: true };
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Open a draft PR for a branch that exists only on the remote (#1601): a cloud session's own
|
|
225
|
+
* `claude/*` branch was pushed from a VM this machine never sees, so there is nothing to push
|
|
226
|
+
* here — the provider publishes the branch as the remote has it. Draft because a PR
|
|
227
|
+
* OpenAgent opens by itself must not put a review request in anyone's inbox, and the
|
|
228
|
+
* interventions queue keeps listing a session's draft.
|
|
229
|
+
*/
|
|
230
|
+
export async function openRemoteBranchPullRequest(cwd, agent, branch, deps = {}) {
|
|
231
|
+
return publishBranch(cwd, branch, { title: agentPrTitle(agent), body: agentPrBody(agent), draft: true }, deps.branches ?? projectBranches, deps.gitHost ?? projectGitHost);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Whether the session kept committing after its PR merged or closed (#1512): the PR carries a
|
|
235
|
+
* head, the branch has a tip, and they disagree. False for an open PR (pushed commits still land
|
|
236
|
+
* on it), for a headless read (an older cache or injected lookup — never risk a duplicate PR on
|
|
237
|
+
* a guess), and for a gone branch (no tip to compare; the PR stays the best answer, #1255).
|
|
238
|
+
*/
|
|
239
|
+
function movedPastPr(state) {
|
|
240
|
+
if (!state.pr || state.pr.state === 'OPEN')
|
|
241
|
+
return false;
|
|
242
|
+
const tip = state.commits[0]?.sha;
|
|
243
|
+
return Boolean(state.pr.headRefOid && tip && state.pr.headRefOid !== tip);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Open a PR for a finished session, deciding from what the agent recorded which cases should not
|
|
247
|
+
* open one. Reads the branch's handoff first: a branch that no longer exists, or a session that
|
|
248
|
+
* changed nothing, is a clear error rather than an empty PR, and a branch that already has a PR
|
|
249
|
+
* returns that one. Title is its branch, else the id; body is the intent, plus which session did it. This is the handoff decision the
|
|
250
|
+
* dashboard's open-PR button offers; the RPC layer only resolves which run it is about, and the
|
|
251
|
+
* two providers do the pushing and the opening.
|
|
252
|
+
*/
|
|
253
|
+
export async function openAgentPullRequest(cwd, agent, options = {}) {
|
|
254
|
+
// A subagent's work goes to its main agent's branch, and that one opens the pull request.
|
|
255
|
+
if (agent.parent !== undefined)
|
|
256
|
+
return { ok: false, error: 'this run is a subagent: its main agent lands its work and opens the pull request' };
|
|
257
|
+
const branch = agentBranchFor(agent);
|
|
258
|
+
if (branch === undefined)
|
|
259
|
+
return { ok: false, error: 'this session recorded no branch to open a PR from' };
|
|
260
|
+
const branches = options.branches ?? projectBranches;
|
|
261
|
+
const gitHost = options.gitHost ?? projectGitHost;
|
|
262
|
+
// `latest` order (#1512), because the `movedPastPr` decision below compares the branch tip
|
|
263
|
+
// against a PR's head: against the *first* PR, work a second one already landed reads as
|
|
264
|
+
// unlanded and this opens a third for it.
|
|
265
|
+
const handoff = await readAgentHandoff(cwd, branch, { since: agent.startedAt, order: 'latest', branches, gitHost, ...(options.pr ? { pr: options.pr } : {}), ...(agent.baseCommit !== undefined ? { from: agent.baseCommit } : {}) }).catch(() => undefined);
|
|
266
|
+
// The agent's PR first, even when its branch is gone locally: a hands-off web agent's branch only
|
|
267
|
+
// ever existed on the remote, and its PR is the answer the button exists to give (#1255).
|
|
268
|
+
// Unless the session demonstrably kept committing after that PR merged or closed (#1512) —
|
|
269
|
+
// then the old PR is not the answer, the new work needs its own.
|
|
270
|
+
if (handoff?.pr && !movedPastPr(handoff))
|
|
271
|
+
return { ok: true, url: handoff.pr.url, number: handoff.pr.number };
|
|
272
|
+
if (handoff && !handoff.exists)
|
|
273
|
+
return { ok: false, error: `branch ${branch} no longer exists` };
|
|
274
|
+
// Refuse rather than open an empty PR: a session that changed nothing has nothing to hand off.
|
|
275
|
+
if (handoff?.empty)
|
|
276
|
+
return { ok: false, error: 'this session produced no commits to open a PR for' };
|
|
277
|
+
// Its commits are still counted once the default branch has them, from where its work began: nothing is left to open one for.
|
|
278
|
+
if (handoff?.merged)
|
|
279
|
+
return { ok: false, error: 'this session’s work is already merged' };
|
|
280
|
+
return publishBranch(cwd, branch, { title: agentPrTitle(agent, handoff?.name), body: agentPrBody(agent), ...(options.draft ? { draft: true } : {}) }, branches, gitHost);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* The PR title for a session (#1102).
|
|
284
|
+
*
|
|
285
|
+
* Two rungs, each a name for the work the session did: the branch the agent named its work with
|
|
286
|
+
* (#1725), else the session id — which says little, but says it honestly. An agent that publishes
|
|
287
|
+
* its own work titles its own PR; this is only the title of one a person opens for it.
|
|
288
|
+
*
|
|
289
|
+
* The prompt the session was given is not among them. It used to be, cut to 72 characters, and a
|
|
290
|
+
* squash merge made that permanent: `main` ended up carrying instructions truncated mid-sentence
|
|
291
|
+
* as commit subjects, which describe neither what changed nor even a whole thought (#1618).
|
|
292
|
+
*/
|
|
293
|
+
function agentPrTitle(agent, name) {
|
|
294
|
+
// The name the branches provider answers for the branch comes before the branch itself:
|
|
295
|
+
// OpenAgent draws the name it is given and never cuts the package's prefix off a branch.
|
|
296
|
+
return name ?? agent.branch ?? `Session ${agent.id}`;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* The PR body: what was asked for, which is all OpenAgent knows on its own, and which session
|
|
300
|
+
* did it.
|
|
301
|
+
*/
|
|
302
|
+
function agentPrBody(agent) {
|
|
303
|
+
const lines = [];
|
|
304
|
+
const opening = agent.intent?.trim();
|
|
305
|
+
if (opening)
|
|
306
|
+
lines.push(opening, '');
|
|
307
|
+
lines.push(`Opened from OpenAgent session \`${agent.id}\`.`);
|
|
308
|
+
return lines.join('\n');
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=agent-handoff.js.map
|