@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,204 @@
|
|
|
1
|
+
import { nodeGitRunner } from '@openagt/agent-data';
|
|
2
|
+
import { pickAgentPr, prsForBranchOrThrow } from './dashboard/pull-requests.js';
|
|
3
|
+
import { openRemoteBranchPullRequest } from './dashboard/agent-handoff.js';
|
|
4
|
+
import { listAgents, projectRuns, startedAtFromAgentId } from './store/index.js';
|
|
5
|
+
import { errorMessage } from './error-message.js';
|
|
6
|
+
import { startProjectPass } from './project-pass.js';
|
|
7
|
+
// Adopt the branch a cloud session actually worked on (#1601).
|
|
8
|
+
//
|
|
9
|
+
// A web run is a local wrapper that hands the task to claude.ai and ends; the cloud session does
|
|
10
|
+
// the work on a branch of its own naming (`claude/*`), never the designated run branch. Nothing
|
|
11
|
+
// ever told the run's record about that branch, so every surface keyed to it — the session row,
|
|
12
|
+
// the PR resolution, the merge — stared at an empty `agent-*` branch, and the run read
|
|
13
|
+
// as "nothing committed" while its work sat on origin.
|
|
14
|
+
//
|
|
15
|
+
// The hand-off anchor (#1601) makes the match exact rather than guessed: the driver pushes an
|
|
16
|
+
// empty commit unique to the run as the ref the session clones at, so the session's branch — and
|
|
17
|
+
// only it — descends from that commit. This pass walks origin's `claude/*` heads, matches each
|
|
18
|
+
// waiting run by that ancestry, and records what it finds onto the run's archive as one commit
|
|
19
|
+
// on the data branch: the branch, the PR the session opened for it — and when the run was armed
|
|
20
|
+
// for a PR the session never opened, it opens the draft PR itself, which is the armed handoff
|
|
21
|
+
// finally resolving against the facts.
|
|
22
|
+
//
|
|
23
|
+
// Conservative on every unprovable case: a run matching no head (the session has not pushed, or
|
|
24
|
+
// did nothing) or more than one (ancestry alone cannot say which) is simply retried next pass,
|
|
25
|
+
// and a run older than the window stops being asked about at all.
|
|
26
|
+
/** How long after its start a run is still asked about: safely past any cloud session's life. */
|
|
27
|
+
export const CLOUD_ADOPTION_WINDOW_MS = 48 * 60 * 60 * 1000;
|
|
28
|
+
/** Where a cloud session's own branches live: what an adopted run's record names. */
|
|
29
|
+
const CLOUD_BRANCH_PREFIX = 'claude/';
|
|
30
|
+
/** Whether the run's record still carries the branch it was born on, i.e. no adoption happened: no branch, or one that is not a cloud session's. */
|
|
31
|
+
function onBirthBranch(meta) {
|
|
32
|
+
return !meta.branch?.startsWith(CLOUD_BRANCH_PREFIX);
|
|
33
|
+
}
|
|
34
|
+
/** Whether the run's handoff was armed to open a PR. Absent means armed, matching the agent. */
|
|
35
|
+
function prArmed(meta) {
|
|
36
|
+
return meta.handoff?.pr !== false;
|
|
37
|
+
}
|
|
38
|
+
/** The settled web runs this pass still owes an answer. */
|
|
39
|
+
function waitingRuns(agents, now) {
|
|
40
|
+
return agents.filter(meta => {
|
|
41
|
+
if (meta.target !== 'web' || meta.status === 'running' || !meta.cloudAnchor)
|
|
42
|
+
return false;
|
|
43
|
+
const startedAt = meta.startedAt ?? startedAtFromAgentId(meta.id);
|
|
44
|
+
const startedMs = startedAt === undefined ? NaN : Date.parse(startedAt);
|
|
45
|
+
if (!Number.isFinite(startedMs) || now - startedMs > CLOUD_ADOPTION_WINDOW_MS)
|
|
46
|
+
return false;
|
|
47
|
+
// Owed: the branch is not adopted yet, or it is and the armed PR is still unaccounted for.
|
|
48
|
+
// An unarmed run stops being asked about once its branch is recorded — a PR someone opens
|
|
49
|
+
// later is still found live, by branch name, by every surface that shows PRs.
|
|
50
|
+
return onBirthBranch(meta) || (meta.pr === undefined && prArmed(meta) && meta.status === 'done');
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** Where the pass keeps origin's `claude/*` heads locally. */
|
|
54
|
+
const CLOUD_HEAD_PREFIX = 'refs/remotes/origin/claude/';
|
|
55
|
+
/**
|
|
56
|
+
* Bring origin's `claude/*` heads local, once for the whole pass rather than once per head.
|
|
57
|
+
*
|
|
58
|
+
* The objects belong to a cloud VM, so they have to be fetched before any ancestry can be read.
|
|
59
|
+
* This replaces a fetch per unmatched head per waiting run (#1607) — the saving is the call
|
|
60
|
+
* count, not the transfer: a second fetch of heads already local negotiates and sends nothing.
|
|
61
|
+
*
|
|
62
|
+
* The destination refspec is named rather than left to chance. An ordinary checkout would write
|
|
63
|
+
* these refs anyway, because git opportunistically updates the remote-tracking branches its
|
|
64
|
+
* configured refspec covers even when the command line names its own; a checkout cloned with a
|
|
65
|
+
* narrower refspec — `--single-branch` — would not, and would re-fetch every pass forever.
|
|
66
|
+
*
|
|
67
|
+
* Pruned, because these refs are now a standing local copy of a list that used to be read live
|
|
68
|
+
* from origin each pass: without it a `claude/*` branch deleted on origin would go on matching.
|
|
69
|
+
*/
|
|
70
|
+
async function fetchCloudHeads(git, cwd) {
|
|
71
|
+
await git(['fetch', '--prune', 'origin', `+refs/heads/claude/*:${CLOUD_HEAD_PREFIX}*`], cwd);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The `claude/*` heads descending from `anchor` — the proof a branch is this run's, asked of git
|
|
75
|
+
* once for the whole set rather than once per head.
|
|
76
|
+
*
|
|
77
|
+
* `--contains` is the same ancestry question `merge-base --is-ancestor` answered one head at a
|
|
78
|
+
* time, and asking it this way also answers "how many" in the same call. Unprovable reads as no
|
|
79
|
+
* match and is retried next pass: an anchor whose object is not local is exactly the case where
|
|
80
|
+
* the session has pushed nothing for it to be an ancestor of.
|
|
81
|
+
*/
|
|
82
|
+
async function headsDescendingFrom(git, cwd, anchor) {
|
|
83
|
+
const listing = await git(['for-each-ref', `--contains=${anchor}`, '--format=%(objectname) %(refname)', CLOUD_HEAD_PREFIX], cwd).catch(() => '');
|
|
84
|
+
const heads = [];
|
|
85
|
+
for (const line of listing.split('\n')) {
|
|
86
|
+
const head = /^([0-9a-f]{40,64}) (.+)$/.exec(line.trim());
|
|
87
|
+
if (head?.[2]?.startsWith(CLOUD_HEAD_PREFIX)) {
|
|
88
|
+
heads.push({ ref: `claude/${head[2].slice(CLOUD_HEAD_PREFIX.length)}`, sha: head[1] });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return heads;
|
|
92
|
+
}
|
|
93
|
+
/** The default {@link CloudWorkDeps.patch}: the late facts onto the run, through the project's runs provider. */
|
|
94
|
+
async function patchProvidedRun(cwd, agentId, patch) {
|
|
95
|
+
const runs = await projectRuns(cwd).catch(() => undefined);
|
|
96
|
+
return runs ? (await runs.patch(agentId, patch)).ok : false;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Adopt one project's cloud work (#1601): match each waiting web run to the `claude/*` head
|
|
100
|
+
* descending from its hand-off anchor, and record the branch and its PR onto the run's archive —
|
|
101
|
+
* opening the armed draft PR when the session never did. Never throws: a repo with no remote
|
|
102
|
+
* (or offline) adopts nothing, and every unmatched run is retried next pass.
|
|
103
|
+
*/
|
|
104
|
+
export async function adoptCloudWork(cwd, deps = {}) {
|
|
105
|
+
const git = deps.git ?? nodeGitRunner();
|
|
106
|
+
const prs = deps.prs ?? prsForBranchOrThrow;
|
|
107
|
+
const agents = deps.agents ?? ((project, since) => listAgents(project, projectRuns, { since }));
|
|
108
|
+
const patchArchive = deps.patch ?? patchProvidedRun;
|
|
109
|
+
const openPr = deps.openPr ?? openRemoteBranchPullRequest;
|
|
110
|
+
const now = deps.now ? deps.now() : Date.now();
|
|
111
|
+
const result = { adopted: [], failed: [] };
|
|
112
|
+
// Only the window's runs are asked for: an archive grows without bound, and everything older
|
|
113
|
+
// than the window is a record `waitingRuns` would drop anyway — so it is never read (#1607).
|
|
114
|
+
const waiting = waitingRuns(await agents(cwd, now - CLOUD_ADOPTION_WINDOW_MS).catch(() => []), now);
|
|
115
|
+
if (waiting.length === 0)
|
|
116
|
+
return result;
|
|
117
|
+
try {
|
|
118
|
+
await fetchCloudHeads(git, cwd);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return result; // no remote, or it cannot be reached: nothing to match against
|
|
122
|
+
}
|
|
123
|
+
for (const run of waiting) {
|
|
124
|
+
const matches = await headsDescendingFrom(git, cwd, run.cloudAnchor);
|
|
125
|
+
// Exactly one, or nothing happens: zero is a session that has not pushed (or never will),
|
|
126
|
+
// and two is a history this pass cannot arbitrate — both are the next pass's question.
|
|
127
|
+
if (matches.length !== 1)
|
|
128
|
+
continue;
|
|
129
|
+
const head = matches[0];
|
|
130
|
+
const branch = head.ref;
|
|
131
|
+
// A run whose record names some other branch — neither the one it was born on nor this head
|
|
132
|
+
// — is not this pass's to answer: a PR opened here would be recorded against a branch it
|
|
133
|
+
// does not live on.
|
|
134
|
+
if (!onBirthBranch(run) && run.branch !== branch)
|
|
135
|
+
continue;
|
|
136
|
+
// The PR the session opened for its branch, if any — filtered by the run's start so a
|
|
137
|
+
// predecessor's PR on a reused name is never this run's, `latest` so the last PR that saw
|
|
138
|
+
// the branch answers (#1512). "None" and "could not list" must not look alike here: a
|
|
139
|
+
// listing that fails opens nothing this pass (a second draft PR on a branch that already
|
|
140
|
+
// has one is the cost of guessing), and the run is asked again next time.
|
|
141
|
+
const since = run.startedAt ?? startedAtFromAgentId(run.id);
|
|
142
|
+
const listing = await prs(cwd, branch).then(found => ({ ok: true, pr: pickAgentPr(found, since, 'latest') }), (err) => ({ ok: false, error: errorMessage(err) }));
|
|
143
|
+
let pr = listing.ok ? listing.pr : undefined;
|
|
144
|
+
let opened = false;
|
|
145
|
+
if (!listing.ok) {
|
|
146
|
+
result.failed.push({ agentId: run.id, error: `could not list the PRs of ${branch} (${listing.error}), so no draft PR was opened this pass` });
|
|
147
|
+
}
|
|
148
|
+
else if (!pr && prArmed(run) && run.status === 'done' && head.sha !== run.cloudAnchor) {
|
|
149
|
+
// The armed handoff, finally resolving (#1601): the run was armed for a PR, the session
|
|
150
|
+
// opened none, and the branch carries something beyond the hand-off itself — so the draft
|
|
151
|
+
// PR the wrapper's epilogue could never open (it saw only the empty run branch) opens now.
|
|
152
|
+
// A run whose PR arming was off gets its branch recorded and nothing else.
|
|
153
|
+
const openedPr = await openPr(cwd, run, branch);
|
|
154
|
+
if (openedPr.ok && openedPr.number !== undefined && openedPr.url) {
|
|
155
|
+
pr = { number: openedPr.number, url: openedPr.url, state: 'OPEN', title: '' };
|
|
156
|
+
opened = true;
|
|
157
|
+
}
|
|
158
|
+
else if (!openedPr.ok) {
|
|
159
|
+
result.failed.push({ agentId: run.id, error: `could not open the armed draft PR for ${branch}: ${openedPr.error}` });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// One commit on the data branch carries whatever this pass learned: the branch (first time
|
|
163
|
+
// only), the PR (once known). Nothing learned, nothing written — and nothing announced.
|
|
164
|
+
const patch = {
|
|
165
|
+
...(onBirthBranch(run) ? { branch } : {}),
|
|
166
|
+
...(pr && run.pr === undefined ? { pr: { number: pr.number, url: pr.url } } : {}),
|
|
167
|
+
};
|
|
168
|
+
if (Object.keys(patch).length === 0)
|
|
169
|
+
continue;
|
|
170
|
+
if (!(await patchArchive(cwd, run.id, patch))) {
|
|
171
|
+
result.failed.push({ agentId: run.id, error: `could not record ${branch} on the run's archive` });
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
result.adopted.push({
|
|
175
|
+
agentId: run.id,
|
|
176
|
+
branch,
|
|
177
|
+
...(pr ? { pr: { number: pr.number, url: pr.url } } : {}),
|
|
178
|
+
...(opened ? { opened: true } : {}),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Adopt every registered project's cloud work (#1601), one turn per call.
|
|
185
|
+
*
|
|
186
|
+
* Adoptions and failures are said out loud, unmatched runs are not: a session that has not
|
|
187
|
+
* pushed yet is the normal state of every run this watches, and a line per tick about it would
|
|
188
|
+
* be noise. A run's row changing branch with no line explaining why would read as a bug.
|
|
189
|
+
*/
|
|
190
|
+
export function startCloudWorkAdoption(opts) {
|
|
191
|
+
const adopt = opts.adopt ?? adoptCloudWork;
|
|
192
|
+
// No timer of its own (E4): the daemon's one clock calls `tick`.
|
|
193
|
+
return startProjectPass(opts.projects, async (cwd) => {
|
|
194
|
+
const { adopted, failed } = await adopt(cwd).catch(() => ({ adopted: [], failed: [] }));
|
|
195
|
+
for (const adoption of adopted) {
|
|
196
|
+
const prLine = adoption.pr ? (adoption.opened ? `; opened its armed draft PR ${adoption.pr.url}` : `; its PR is ${adoption.pr.url}`) : '';
|
|
197
|
+
opts.log(`[openagent] session ${adoption.agentId}'s cloud work landed on ${adoption.branch} — adopted as its branch (#1601)${prLine}`);
|
|
198
|
+
}
|
|
199
|
+
for (const failure of failed) {
|
|
200
|
+
opts.log(`[openagent] cloud work adoption for session ${failure.agentId}: ${failure.error}`);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=cloud-work.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-work.js","sourceRoot":"","sources":["../src/cloud-work.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAiB,MAAM,8BAA8B,CAAA;AAC9F,OAAO,EAAE,2BAA2B,EAAsB,MAAM,8BAA8B,CAAA;AAC9F,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAiC,MAAM,kBAAkB,CAAA;AAC/G,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAyC,MAAM,mBAAmB,CAAA;AAE3F,+DAA+D;AAC/D,EAAE;AACF,iGAAiG;AACjG,gGAAgG;AAChG,gGAAgG;AAChG,uFAAuF;AACvF,uDAAuD;AACvD,EAAE;AACF,8FAA8F;AAC9F,iGAAiG;AACjG,+FAA+F;AAC/F,+FAA+F;AAC/F,gGAAgG;AAChG,8FAA8F;AAC9F,uCAAuC;AACvC,EAAE;AACF,gGAAgG;AAChG,+FAA+F;AAC/F,kEAAkE;AAGlE,iGAAiG;AACjG,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAwC3D,qFAAqF;AACrF,MAAM,mBAAmB,GAAG,SAAS,CAAA;AAErC,oJAAoJ;AACpJ,SAAS,aAAa,CAAC,IAAe;IAC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AAE,CAAC;YAC/B,MAAM,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,+BAA+B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,eAAe,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;YACzI,IAAI,CAAC,GAAG,CAAC,uBAAuB,QAAQ,CAAC,OAAO,2BAA2B,QAAQ,CAAC,MAAM,mCAAmC,MAAM,EAAE,CAAC,CAAA;QACxI,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,MAAM,EAAE,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,+CAA+C,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;QAC9F,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { OpenAgentEvent } from './events.js';
|
|
2
|
+
import type { StartAgentOptions, StartAgentResult, AddProjectResult, RemoveProjectResult } from './dashboard/index.js';
|
|
3
|
+
import type { EventsSource, RemoteAgents } from './dashboard/rpc-serve.js';
|
|
4
|
+
/**
|
|
5
|
+
* What the daemon does for a project (#393): start a run, add a project, and relay a run to and
|
|
6
|
+
* from a connected device. Split from daemon.ts so that file reads as the daemon's lifecycle
|
|
7
|
+
* (state file, ports, boot, shutdown). The daemon runs no agent itself (#1774): a Start is the
|
|
8
|
+
* project's own `start` hook line, and the run it begins belongs to whatever tool that line names.
|
|
9
|
+
*/
|
|
10
|
+
/** Inputs to {@link createProjectRuntime}. */
|
|
11
|
+
export interface ProjectRuntimeOptions {
|
|
12
|
+
/** The daemon's home workspace; a run with no project id targets it. */
|
|
13
|
+
cwd: string;
|
|
14
|
+
/** Env for the registry lookups (#393). */
|
|
15
|
+
env: NodeJS.ProcessEnv;
|
|
16
|
+
}
|
|
17
|
+
/** The per-project surface the dashboard drives, plus its teardown. */
|
|
18
|
+
export interface ProjectRuntime {
|
|
19
|
+
onStart: (prompt: string, options?: StartAgentOptions, targetProjectId?: string) => Promise<StartAgentResult>;
|
|
20
|
+
onAddProject: (path: string, share: boolean) => Promise<AddProjectResult>;
|
|
21
|
+
onRemoveProject: (projectId: string, files?: boolean) => Promise<RemoveProjectResult>;
|
|
22
|
+
/** The live event stream for an agent this daemon is relaying from a device (#1067), else undefined
|
|
23
|
+
* so `onEvents` falls back to tailing the on-disk log. Wired as the dashboard's events source. */
|
|
24
|
+
remoteEventsSource: EventsSource;
|
|
25
|
+
/** Tail a relay-started agent's on-disk events (#1067): the daemon's `/_relay/events` endpoint uses
|
|
26
|
+
* it to stream one agent back to whichever daemon relayed it here. */
|
|
27
|
+
tailRelayEvents: (agentId: string, onEvent: (event: OpenAgentEvent) => void) => () => void;
|
|
28
|
+
/** The relayed-agent lookup the dashboard's read RPCs consult (#1067 slice 2): which device a remote
|
|
29
|
+
* run runs on, so a run-scoped RPC forwards there instead of resolving a local checkout. */
|
|
30
|
+
remoteAgents: RemoteAgents;
|
|
31
|
+
/** The device side of the relay (#1067 slice 2): run one whitelisted read/steer/handoff RPC against
|
|
32
|
+
* this daemon's own home checkout, for a daemon that relayed an agent here. */
|
|
33
|
+
onRelayRpc: (fn: string, args: unknown[]) => Promise<unknown>;
|
|
34
|
+
/** Let go of the relayed streams. */
|
|
35
|
+
dispose: () => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The daemon's per-project runtime (#393). The home `cwd` is the default target: a request with
|
|
39
|
+
* no project id (or the home id) resolves to it without a registry lookup.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createProjectRuntime({ cwd, env }: ProjectRuntimeOptions): ProjectRuntime;
|
|
42
|
+
//# sourceMappingURL=daemon-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-runtime.d.ts","sourceRoot":"","sources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CAAC,CAAA;CAC7B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,qBAAqB,GAAG,cAAc,CA6JxF"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { hostname } from 'node:os';
|
|
3
|
+
import { stat } from 'node:fs/promises';
|
|
4
|
+
import { fromDiaryLine, isPidAlive, projectBranches, readLiveMetas, resolveAgentDiary } from './store/index.js';
|
|
5
|
+
import { RelayedAgents, startRemoteAgent } from './dashboard/remote-run.js';
|
|
6
|
+
import { dispatchRelayRpc } from './dashboard-rpc/relay-dispatch.js';
|
|
7
|
+
import { tailAgentEvents } from './dashboard-rpc/events-tail.js';
|
|
8
|
+
import { addProject, listProjects, projectId, removeProject } from './registry.js';
|
|
9
|
+
import { writeHookLines } from './built-in.js';
|
|
10
|
+
import { installProject } from './install.js';
|
|
11
|
+
import { fileBranchRepo, writeSharing } from '@openagt/agent-data';
|
|
12
|
+
import { removeProjectFiles } from './remove-files.js';
|
|
13
|
+
import { runProjectHooks, runStartHook } from './project-hooks.js';
|
|
14
|
+
import { publishLevelOf, publishPickIn } from './publish-levels.js';
|
|
15
|
+
import { isBranchName } from './branch-name.js';
|
|
16
|
+
import { hasRemote } from './has-remote.js';
|
|
17
|
+
import { projectGitHost } from './store/git-host.js';
|
|
18
|
+
import { providedDataChanged } from './store/provided.js';
|
|
19
|
+
/**
|
|
20
|
+
* The daemon's per-project runtime (#393). The home `cwd` is the default target: a request with
|
|
21
|
+
* no project id (or the home id) resolves to it without a registry lookup.
|
|
22
|
+
*/
|
|
23
|
+
export function createProjectRuntime({ cwd, env }) {
|
|
24
|
+
const homeId = projectId(resolve(cwd));
|
|
25
|
+
// Runs this daemon is relaying to/from a connected device (#1067): the local half of a remote agent.
|
|
26
|
+
const relayedAgents = new RelayedAgents();
|
|
27
|
+
// The relayed-agent lookup the dashboard's read RPCs consult (#1067 slice 2): is this agentId remote, and
|
|
28
|
+
// which device owns it. Outlives the event stream so a finished remote agent's push/PR still reaches it.
|
|
29
|
+
const remoteAgents = {
|
|
30
|
+
target: agentId => relayedAgents.target(agentId),
|
|
31
|
+
list: projectId => relayedAgents.list(projectId),
|
|
32
|
+
};
|
|
33
|
+
// The device side of the relay (#1067 slice 2): run one whitelisted read/steer/handoff RPC against this
|
|
34
|
+
// daemon's own home checkout, for a daemon that relayed an agent here. Home id forces the addressed project.
|
|
35
|
+
const onRelayRpc = (fn, args) => dispatchRelayRpc(homeId, fn, args);
|
|
36
|
+
// A project id resolves to its repo path via the registry; the home id (or none)
|
|
37
|
+
// resolves to the daemon's own `cwd` without a lookup.
|
|
38
|
+
const resolveProject = async (id) => {
|
|
39
|
+
if (!id || id === homeId)
|
|
40
|
+
return cwd;
|
|
41
|
+
const records = await listProjects(undefined, env).catch(() => []);
|
|
42
|
+
return records.find(record => record.id === id)?.path;
|
|
43
|
+
};
|
|
44
|
+
// Start (#1774): the project's own `start` hook line, which answers the id of the run it began.
|
|
45
|
+
// The daemon names no tool and holds nothing about the run: no slot, no cap (a person's click is
|
|
46
|
+
// the brake), no process to stop at shutdown. A project without the line cannot start a run here.
|
|
47
|
+
const onStart = async (prompt, options = {}, targetProjectId) => {
|
|
48
|
+
// Run on a connected device (#1067): forward the start to the remote daemon, which runs its own
|
|
49
|
+
// project's hook, and relay the run's events back. `remote` is stripped so the device does not
|
|
50
|
+
// relay onward, and `base` because a branch of this machine names nothing on the device (the device drops it too). The
|
|
51
|
+
// device starts it in its own home project.
|
|
52
|
+
if (options.remote) {
|
|
53
|
+
const { remote, base: _thisMachines, ...forwarded } = options;
|
|
54
|
+
const result = await startRemoteAgent(remote, { prompt, options: forwarded });
|
|
55
|
+
if (result.ok) {
|
|
56
|
+
// A relayed agent has no local checkout or pid, so its list row is a memory-only stub (#1077):
|
|
57
|
+
// registered here so onAgents can show it and a dashboard reload re-opens it. Never written to disk.
|
|
58
|
+
const now = new Date().toISOString();
|
|
59
|
+
const meta = {
|
|
60
|
+
status: 'running',
|
|
61
|
+
id: result.agentId,
|
|
62
|
+
startedAt: now,
|
|
63
|
+
updatedAt: now,
|
|
64
|
+
target: 'remote',
|
|
65
|
+
intent: prompt,
|
|
66
|
+
...(remote.label ? { remoteLabel: remote.label } : {}),
|
|
67
|
+
};
|
|
68
|
+
relayedAgents.register(result.agentId, remote, meta, targetProjectId ?? homeId);
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
const projectCwd = await resolveProject(targetProjectId);
|
|
73
|
+
if (!projectCwd)
|
|
74
|
+
return { ok: false, error: `unknown project: ${targetProjectId}` };
|
|
75
|
+
// The branch to start from ends up on the line's command line: only a branch name goes there.
|
|
76
|
+
// Refused, not dropped: a run started from the main branch instead would be a silent swap.
|
|
77
|
+
if (options.base !== undefined && !isBranchName(options.base))
|
|
78
|
+
return { ok: false, error: `not a branch name: ${String(options.base)}` };
|
|
79
|
+
// The pick in force is decided here, so every Start goes the same way whichever page sent it:
|
|
80
|
+
// with none saved the run commits and pushes nothing, and with one the project is not offered
|
|
81
|
+
// it goes as far as the project does with no pull request: its branch pushed, or its work
|
|
82
|
+
// committed where there is no remote.
|
|
83
|
+
const publish = publishLevelOf(publishPickIn(options.publish, (await projectGitHost(projectCwd).catch(() => undefined)) !== undefined, await hasRemote(projectCwd)));
|
|
84
|
+
const started = await runStartHook(projectCwd, {
|
|
85
|
+
prompt,
|
|
86
|
+
...(options.driver !== undefined ? { driver: options.driver } : {}),
|
|
87
|
+
...(options.model !== undefined ? { model: options.model } : {}),
|
|
88
|
+
...(options.then !== undefined ? { then: options.then } : {}),
|
|
89
|
+
...(publish !== undefined ? { publish } : {}),
|
|
90
|
+
...(options.base !== undefined ? { base: options.base } : {}),
|
|
91
|
+
});
|
|
92
|
+
// The line made a checkout (or is about to): the project's checkouts are read again on the
|
|
93
|
+
// next look rather than a few seconds from now, so the new run's page finds its own.
|
|
94
|
+
if (started.ok)
|
|
95
|
+
projectBranches.changed(projectCwd);
|
|
96
|
+
return started.ok ? { ok: true, agentId: started.id } : { ok: false, error: started.error };
|
|
97
|
+
};
|
|
98
|
+
// Add a project (#396): install the repo, then register it so it appears in the Projects
|
|
99
|
+
// list. installProject is idempotent (an already-activated repo is a no-op success). `share`
|
|
100
|
+
// is the person's answer on the agents' records, written before the project is registered:
|
|
101
|
+
// the first sync of a project added with `false` sends nothing.
|
|
102
|
+
const onAddProject = async (path, share) => {
|
|
103
|
+
// Resolve relative input against the daemon cwd, and check the directory really
|
|
104
|
+
// exists first: without this a bad path reaches git as a missing cwd, which
|
|
105
|
+
// surfaces as the confusing "spawn git ENOENT" rather than a path error.
|
|
106
|
+
const abs = resolve(path);
|
|
107
|
+
const isDir = await stat(abs).then(s => s.isDirectory()).catch(() => false);
|
|
108
|
+
if (!isDir)
|
|
109
|
+
return { ok: false, error: `path does not exist or is not a directory: ${abs}` };
|
|
110
|
+
const result = await installProject(abs);
|
|
111
|
+
if (!result.ok)
|
|
112
|
+
return { ok: false, error: result.error };
|
|
113
|
+
// A yes is to the remote that is there: with none the records are kept, so a remote the
|
|
114
|
+
// project gets later is asked about, in the project's menu, before anything goes to it.
|
|
115
|
+
const shared = share && (await hasRemote(abs));
|
|
116
|
+
const written = await writeSharing(abs, shared).then(() => undefined, (err) => (err instanceof Error ? err.message : String(err)));
|
|
117
|
+
if (written !== undefined)
|
|
118
|
+
return { ok: false, error: written };
|
|
119
|
+
// Each package that writes hook lines writes its own (the built-in runner's start, resume and
|
|
120
|
+
// check among them), so the new project starts an agent with nothing typed by hand. A writer
|
|
121
|
+
// keeps every line already there, so adding a project again only fills what is missing.
|
|
122
|
+
for (const failed of await writeHookLines(abs))
|
|
123
|
+
console.log(`[openagent] hook lines (${abs}): ${failed}`);
|
|
124
|
+
await addProject(abs, new Date().toISOString()).catch(() => { });
|
|
125
|
+
// The project's open hooks (#1774): a project added while the daemon runs is a project the
|
|
126
|
+
// boot never saw, so its open lines run now, the way they would have at boot.
|
|
127
|
+
await runProjectHooks(abs, 'open', { log: console.log });
|
|
128
|
+
return { ok: true, alreadyActivated: result.alreadyActivated === true, ...(share && !shared ? { noRemote: true } : {}) };
|
|
129
|
+
};
|
|
130
|
+
// Remove a project: it leaves the Projects list and nothing in its folder is deleted. Found in
|
|
131
|
+
// the list by its id and not through its folder, so a project whose folder is gone goes too.
|
|
132
|
+
const onRemoveProject = async (id, files = false) => {
|
|
133
|
+
const listed = await listProjects(undefined, env).catch(() => []);
|
|
134
|
+
const record = listed.find(project => project.id === id);
|
|
135
|
+
if (!record)
|
|
136
|
+
return { ok: false, error: 'no project with that id is on the list' };
|
|
137
|
+
const here = await stat(record.path).then(s => s.isDirectory()).catch(() => false);
|
|
138
|
+
if (here) {
|
|
139
|
+
// The checkouts are read fresh: a run started a moment ago must be seen.
|
|
140
|
+
projectBranches.changed(record.path);
|
|
141
|
+
// An agent at work would go on working in a project the dashboard no longer shows. A card
|
|
142
|
+
// left "running" by a process that died does not count: nothing is working there.
|
|
143
|
+
const working = (await readLiveMetas(record.path).catch(() => [])).some(agent => agent.status === 'running' && agent.pid !== undefined && agent.host === hostname() && isPidAlive(agent.pid));
|
|
144
|
+
if (working)
|
|
145
|
+
return { ok: false, error: 'An agent is working in this project. Stop it, then remove the project.' };
|
|
146
|
+
// The project's close hooks, the ones a shutdown would have run for it: once it is off the
|
|
147
|
+
// list no shutdown names it, and what its open hooks started (a scheduler) would run on.
|
|
148
|
+
await runProjectHooks(record.path, 'close', { log: console.log });
|
|
149
|
+
}
|
|
150
|
+
await removeProject(id, undefined, env);
|
|
151
|
+
providedDataChanged(record.path);
|
|
152
|
+
if (!files || !here)
|
|
153
|
+
return { ok: true };
|
|
154
|
+
// Off the list first, so no background job of this daemon starts on the folder again; then
|
|
155
|
+
// what OpenAgent left in it. The records are the repository's: while another project on the
|
|
156
|
+
// list is a checkout of the same repository, they stay.
|
|
157
|
+
const repository = await fileBranchRepo(record.path);
|
|
158
|
+
let recordsUsedBy;
|
|
159
|
+
for (const other of listed) {
|
|
160
|
+
if (other.id !== id && repository !== undefined && (await fileBranchRepo(other.path)) === repository)
|
|
161
|
+
recordsUsedBy = other.path;
|
|
162
|
+
}
|
|
163
|
+
const cleanup = await removeProjectFiles(record.path, { recordsUsedBy });
|
|
164
|
+
providedDataChanged(record.path);
|
|
165
|
+
return { ok: true, cleanup };
|
|
166
|
+
};
|
|
167
|
+
// The dashboard's events source (#1067): a stream for an agent this daemon is relaying from a device,
|
|
168
|
+
// else undefined so `onEvents` tails the on-disk log as usual for an ordinary local agent.
|
|
169
|
+
const remoteEventsSource = (_projectId, agentId) => relayedAgents.get(agentId);
|
|
170
|
+
// Tail a relay-started run's own log (#1067) for the `/_relay/events` endpoint: the diary the
|
|
171
|
+
// run's tool keeps, its lines turned into events. The relocating tail, for the same reason as
|
|
172
|
+
// the dashboard's onEvents: the diary becomes the finished run's when the run ends.
|
|
173
|
+
const tailRelayEvents = (agentId, onEvent) => tailAgentEvents(() => resolveAgentDiary(cwd, agentId), line => {
|
|
174
|
+
const event = fromDiaryLine(line);
|
|
175
|
+
if (event)
|
|
176
|
+
onEvent(event);
|
|
177
|
+
});
|
|
178
|
+
const dispose = async () => {
|
|
179
|
+
relayedAgents.dispose();
|
|
180
|
+
};
|
|
181
|
+
return { onStart, onAddProject, onRemoveProject, remoteEventsSource, tailRelayEvents, remoteAgents, onRelayRpc, dispose };
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=daemon-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-runtime.js","sourceRoot":"","sources":["../src/daemon-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,aAA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AAC,IAAI,CAAC,CAAA;QAChC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;IAC9B,CAAC,CAAA;IAED,sGAAsG;IACtG,2FAA2F;IAC3F,MAAM,kBAAkB,GAAiB,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAE5F,8FAA8F;IAC9F,8FAA8F;IAC9F,oFAAoF;IACpF,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,OAAwC,EAAgB,EAAE,CAClG,eAAe,CAAe,GAAG,EAAE,CAAC,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE;QAC1E,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;QACjC,IAAI,KAAK;YAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;IAEJ,MAAM,OAAO,GAAG,KAAK,IAAmB,EAAE;QACxC,aAAa,CAAC,OAAO,EAAE,CAAA;IACzB,CAAC,CAAA;IAED,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,CAAA;AAC3H,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ProjectErrors } from './project-errors.js';
|
|
2
|
+
/** What the daemon needs back. */
|
|
3
|
+
export interface BackgroundServices {
|
|
4
|
+
/**
|
|
5
|
+
* Stop every background job. Resolves once the tick in flight has finished: these jobs commit
|
|
6
|
+
* and push, and stopping their clock does not stop their turn.
|
|
7
|
+
*/
|
|
8
|
+
quiesce: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
/** What {@link startBackgroundServices} needs from the daemon. */
|
|
11
|
+
export interface BackgroundServiceDeps {
|
|
12
|
+
env: NodeJS.ProcessEnv;
|
|
13
|
+
/** Where a job records a project state the user must fix (#1500), for the dashboard to show. */
|
|
14
|
+
projectErrors: ProjectErrors;
|
|
15
|
+
log: (message: string) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* One project's data-sync turn (#1599): converge the `agent-data` branch — the skills' branch,
|
|
19
|
+
* which carries the tickets, the queue and the `logs` skill's runs — with
|
|
20
|
+
* origin through the shared branch library, one pull, and set or clear the project's `data-sync`
|
|
21
|
+
* error by the outcome. The clear is unconditional on success, so the error lives exactly as long
|
|
22
|
+
* as the condition — the next tick after the user fixes the remote, it is gone. A branch that stays
|
|
23
|
+
* on this machine (no remote, or the person does not share it) is no error: the project carries why,
|
|
24
|
+
* for as long as that holds. The daemon knows
|
|
25
|
+
* nothing of what is on the branch (#1774): a skill's own setup makes its files.
|
|
26
|
+
*/
|
|
27
|
+
export declare function syncProjectData(path: string, errors: ProjectErrors, log: (message: string) => void): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* One project's provider check (#1820), on the data sync's clock: a kind of the project's data
|
|
30
|
+
* that packages declare but none is settled to provide (several declare it and the project's
|
|
31
|
+
* package.json names none, or names one that does not declare it) is the project's `provider`
|
|
32
|
+
* error, every such kind on its own line; every kind settled clears it. OpenAgent never picks
|
|
33
|
+
* the first declarer silently: the project says, or nothing provides and the banner says why.
|
|
34
|
+
*/
|
|
35
|
+
export declare function checkProviders(path: string, errors: ProjectErrors): Promise<void>;
|
|
36
|
+
export declare function startBackgroundServices(deps: BackgroundServiceDeps): BackgroundServices;
|
|
37
|
+
//# sourceMappingURL=daemon-services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-services.d.ts","sourceRoot":"","sources":["../src/daemon-services.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AA8BxD,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAED,kEAAkE;AAClE,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;IACtB,gGAAgG;IAChG,aAAa,EAAE,aAAa,CAAA;IAC5B,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAUxH;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAIvF;AAQD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,GAAG,kBAAkB,CA0DvF"}
|