@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,257 @@
|
|
|
1
|
+
import { existsSync, statSync } from 'node:fs';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { basename, dirname, join } from 'node:path';
|
|
4
|
+
import { logLiveFile } from '@openagt/agent-driver';
|
|
5
|
+
import { JsonlTailer, followFile } from '../jsonl-tail.js';
|
|
6
|
+
/** How often the poll backstop re-reads the log when `fs.watch` says nothing. */
|
|
7
|
+
const POLL_MS = 1000;
|
|
8
|
+
/**
|
|
9
|
+
* Tail a JSONL log: read what is already in it, then follow appends. Each complete line is
|
|
10
|
+
* parsed and handed to `onEvent`; malformed lines are skipped. Returns a stop function that
|
|
11
|
+
* removes the watcher and the poll.
|
|
12
|
+
*
|
|
13
|
+
* The reading is {@link JsonlTailer} and the following is {@link followFile}. This used to be
|
|
14
|
+
* its own copy of both, which is how it ended up missing the tailer's same-length-rewrite
|
|
15
|
+
* detection (#567).
|
|
16
|
+
*
|
|
17
|
+
* `onReplayed` is told once the first pull — the replay of everything already logged — has
|
|
18
|
+
* been delivered (#1383). That boundary is what lets a reconnecting client buffer the replay
|
|
19
|
+
* and swap its feed atomically instead of blanking while history re-streams. The follower
|
|
20
|
+
* only starts after it, so no appended line can slip in ahead of the marker. Best-effort on
|
|
21
|
+
* a failed first read: the marker still fires (the poll retries the read), because a client
|
|
22
|
+
* waiting on it forever would freeze its feed.
|
|
23
|
+
*
|
|
24
|
+
* Kept transport-agnostic (a plain `onEvent` callback, not a stream) so the file
|
|
25
|
+
* side can be driven on its own; `events.ts` wires it to the SSE endpoint.
|
|
26
|
+
*/
|
|
27
|
+
export function tailEvents(path, onEvent, onReplayed) {
|
|
28
|
+
const tailer = new JsonlTailer(path, onEvent);
|
|
29
|
+
let stopped = false;
|
|
30
|
+
let stopFollow;
|
|
31
|
+
const follow = () => {
|
|
32
|
+
if (stopped)
|
|
33
|
+
return;
|
|
34
|
+
onReplayed?.();
|
|
35
|
+
stopFollow = followFile(dirname(path), () => tailer.pull(), { pollMs: POLL_MS });
|
|
36
|
+
};
|
|
37
|
+
void tailer.pull().then(follow, follow);
|
|
38
|
+
return () => {
|
|
39
|
+
stopped = true;
|
|
40
|
+
stopFollow?.();
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Reads the message a run is writing, from the live file beside its diary, for
|
|
45
|
+
* {@link tailAgentEvents}' `afterPull`: the file changes in the diary's directory, so the diary's
|
|
46
|
+
* watch reads it too. `send` gets the text when it changed, and `''` once the file is gone.
|
|
47
|
+
*/
|
|
48
|
+
export function partialReader(send) {
|
|
49
|
+
let sent = '';
|
|
50
|
+
return async (diary) => {
|
|
51
|
+
const text = await readFile(join(dirname(diary), logLiveFile(basename(diary, '.jsonl'))), 'utf8').catch(() => '');
|
|
52
|
+
if (text === sent)
|
|
53
|
+
return;
|
|
54
|
+
sent = text;
|
|
55
|
+
send(text);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** Whether the file at `path` holds at least one byte; a file that cannot be read holds nothing. */
|
|
59
|
+
function holdsSomething(path) {
|
|
60
|
+
try {
|
|
61
|
+
return statSync(path).size > 0;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Tail a run's diary across its relocations: the same read-then-follow as {@link tailEvents},
|
|
69
|
+
* but where the diary is is asked again whenever the tailed file is not there.
|
|
70
|
+
*
|
|
71
|
+
* A run's diary does not sit still. While the run works it is a file in the run's checkout; when
|
|
72
|
+
* the run ends its tool records it and reclaims the checkout, and from then on the diary is the
|
|
73
|
+
* finished run's, read whole from the project's runs provider. A fixed-path tail whose file was
|
|
74
|
+
* retired went silent *without the final lines* whenever the last `fs.watch` signal was lost —
|
|
75
|
+
* the 1s poll then found the file gone and had nothing to read, so the feed never learned the run
|
|
76
|
+
* ended. This tail treats a missing file as the question it is: it asks `resolve` where the diary
|
|
77
|
+
* is now (`resolveAgentDiary` answers the finished run once the checkout is gone, #1472). A new
|
|
78
|
+
* file retargets the same tailer and follows it. A finished run's lines are the same lines the
|
|
79
|
+
* file had, in the same order, so the ones past the count already delivered are sent and the tail
|
|
80
|
+
* ends: a finished diary does not grow. The same file, or no answer, means the diary has not
|
|
81
|
+
* moved, and the tail keeps waiting where it is. A diary that is nowhere yet (`pending`: the run
|
|
82
|
+
* was started a moment ago and its tool has not made the checkout, or it is being continued and
|
|
83
|
+
* its checkout is on its way back) is asked for again on the same cadence until it has a home,
|
|
84
|
+
* and only then followed; the replay boundary is reported once what that home holds has been
|
|
85
|
+
* delivered, not before: a feed that reconnects swaps what it shows for the replay at the
|
|
86
|
+
* boundary, and a boundary reported with nothing delivered emptied a chat that was full, for as
|
|
87
|
+
* long as the diary took to have a home. Asking even when the file was never seen matters for a
|
|
88
|
+
* short run (#1774): started, ended and reclaimed between two polls, its diary was only ever
|
|
89
|
+
* visible as a finished run.
|
|
90
|
+
*
|
|
91
|
+
* `onReplayed` keeps {@link tailEvents}' once-per-subscription contract: a relocation is not a
|
|
92
|
+
* new replay boundary, so it never fires twice.
|
|
93
|
+
*
|
|
94
|
+
* `afterPull` is told the diary's path after each read of it: the files beside the diary change
|
|
95
|
+
* with it, and a caller reads them there, on the same watch.
|
|
96
|
+
*/
|
|
97
|
+
export function tailAgentEvents(resolve, onEvent, onReplayed, afterPull) {
|
|
98
|
+
let stopped = false;
|
|
99
|
+
let stopFollow;
|
|
100
|
+
let path;
|
|
101
|
+
let tailer;
|
|
102
|
+
let relocating = false;
|
|
103
|
+
let waiting;
|
|
104
|
+
let delivered = 0;
|
|
105
|
+
/** The replay boundary still to report: the followed file was not there when it was first read. */
|
|
106
|
+
let owed;
|
|
107
|
+
const deliver = (event) => {
|
|
108
|
+
delivered++;
|
|
109
|
+
onEvent(event);
|
|
110
|
+
};
|
|
111
|
+
/** The finished run's lines the feed has not had yet; then wait for the run to be resumed. */
|
|
112
|
+
const finish = (lines) => {
|
|
113
|
+
stopFollow?.();
|
|
114
|
+
stopFollow = undefined;
|
|
115
|
+
for (const line of lines.slice(delivered))
|
|
116
|
+
deliver(line);
|
|
117
|
+
// A boundary owed for a file that never came: the finished run's lines are the replay.
|
|
118
|
+
const boundary = owed;
|
|
119
|
+
owed = undefined;
|
|
120
|
+
boundary?.();
|
|
121
|
+
awaitDiary(true);
|
|
122
|
+
};
|
|
123
|
+
const follow = () => {
|
|
124
|
+
if (stopped || path === undefined)
|
|
125
|
+
return;
|
|
126
|
+
stopFollow = followFile(dirname(path), pullOrRelocate, { pollMs: POLL_MS });
|
|
127
|
+
};
|
|
128
|
+
const relocate = async () => {
|
|
129
|
+
const next = await resolve();
|
|
130
|
+
// No answer, nowhere yet, or the same file: not moved (or not visible yet) — keep polling the current home.
|
|
131
|
+
if (stopped || !tailer || next === undefined || 'pending' in next)
|
|
132
|
+
return;
|
|
133
|
+
if ('finished' in next)
|
|
134
|
+
return finish(next.finished);
|
|
135
|
+
if (next.file === path)
|
|
136
|
+
return;
|
|
137
|
+
stopFollow?.();
|
|
138
|
+
path = next.file;
|
|
139
|
+
tailer.retarget(next.file);
|
|
140
|
+
await tailer.pull();
|
|
141
|
+
follow();
|
|
142
|
+
};
|
|
143
|
+
const pullOrRelocate = async () => {
|
|
144
|
+
if (stopped || !tailer || path === undefined)
|
|
145
|
+
return;
|
|
146
|
+
if (existsSync(path)) {
|
|
147
|
+
// A file that is there and still holds nothing is a diary about to be written: the owed
|
|
148
|
+
// boundary waits for the pull that had lines to deliver, or it would say an empty replay.
|
|
149
|
+
const written = owed !== undefined && holdsSomething(path);
|
|
150
|
+
await tailer.pull();
|
|
151
|
+
if (written) {
|
|
152
|
+
const boundary = owed;
|
|
153
|
+
owed = undefined;
|
|
154
|
+
boundary?.();
|
|
155
|
+
}
|
|
156
|
+
await afterPull?.(path);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (relocating)
|
|
160
|
+
return;
|
|
161
|
+
relocating = true;
|
|
162
|
+
try {
|
|
163
|
+
await relocate();
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
relocating = false;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Follow `file` from its start: what is there is the replay, and appends follow. A resumed run's
|
|
171
|
+
* diary starts with the lines the feed already had, so as many lines as were delivered are skipped.
|
|
172
|
+
* The same holds when the file is rewritten in place: a run continued in the checkout it kept
|
|
173
|
+
* has its diary written again, whole, before the new lines, and the tailer reads a rewritten
|
|
174
|
+
* file from its top. It is one run's diary either way, so what was delivered is skipped again.
|
|
175
|
+
*/
|
|
176
|
+
const begin = (file, onReplayedOnce) => {
|
|
177
|
+
path = file;
|
|
178
|
+
let skip = delivered;
|
|
179
|
+
tailer = new JsonlTailer(file, line => {
|
|
180
|
+
if (skip > 0)
|
|
181
|
+
skip--;
|
|
182
|
+
else
|
|
183
|
+
deliver(line);
|
|
184
|
+
}, () => {
|
|
185
|
+
skip = delivered;
|
|
186
|
+
});
|
|
187
|
+
// The boundary is reported once the file has been read. A checkout is there a moment before
|
|
188
|
+
// the diary is written into it, and the diary is there a moment before its first lines:
|
|
189
|
+
// reported then, the boundary would say an empty replay. So it is reported only when the
|
|
190
|
+
// file held something before the read, and owed until a later read finds it written.
|
|
191
|
+
const written = holdsSomething(file);
|
|
192
|
+
const replayed = () => {
|
|
193
|
+
if (stopped)
|
|
194
|
+
return;
|
|
195
|
+
if (written)
|
|
196
|
+
onReplayedOnce();
|
|
197
|
+
else
|
|
198
|
+
owed = onReplayedOnce;
|
|
199
|
+
follow();
|
|
200
|
+
};
|
|
201
|
+
void tailer.pull().then(replayed, replayed);
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* The diary is nowhere yet, or is a finished run's: ask again after a poll, until it has a home.
|
|
205
|
+
* A finished run is asked about for as long as the feed is open, since it may be resumed: its diary
|
|
206
|
+
* is then a file in a checkout again, or, for a resumed run that already ended again, more
|
|
207
|
+
* finished lines. `replayed` is the boundary still owed, when the diary had no home at first:
|
|
208
|
+
* it is reported once the home's lines are delivered.
|
|
209
|
+
*/
|
|
210
|
+
const awaitDiary = (finished, replayed = () => { }) => {
|
|
211
|
+
if (stopped)
|
|
212
|
+
return;
|
|
213
|
+
waiting = setTimeout(() => {
|
|
214
|
+
waiting = undefined;
|
|
215
|
+
// A finished run is asked about from the shared, cached reads: the question may stay open for hours.
|
|
216
|
+
void resolve({ cached: finished }).then(next => {
|
|
217
|
+
if (stopped)
|
|
218
|
+
return;
|
|
219
|
+
if (next === undefined || 'pending' in next)
|
|
220
|
+
return awaitDiary(finished, replayed);
|
|
221
|
+
if ('finished' in next) {
|
|
222
|
+
finish(next.finished);
|
|
223
|
+
replayed();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
begin(next.file, replayed);
|
|
227
|
+
}, () => awaitDiary(finished, replayed));
|
|
228
|
+
}, POLL_MS);
|
|
229
|
+
waiting.unref?.();
|
|
230
|
+
};
|
|
231
|
+
void resolve().then(initial => {
|
|
232
|
+
if (stopped)
|
|
233
|
+
return;
|
|
234
|
+
// No journal to speak of (unknown project): honor the replay contract and stay silent.
|
|
235
|
+
if (initial === undefined) {
|
|
236
|
+
onReplayed?.();
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if ('finished' in initial) {
|
|
240
|
+
finish(initial.finished);
|
|
241
|
+
onReplayed?.();
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if ('pending' in initial) {
|
|
245
|
+
awaitDiary(false, () => onReplayed?.());
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
begin(initial.file, () => onReplayed?.());
|
|
249
|
+
}, () => onReplayed?.());
|
|
250
|
+
return () => {
|
|
251
|
+
stopped = true;
|
|
252
|
+
if (waiting)
|
|
253
|
+
clearTimeout(waiting);
|
|
254
|
+
stopFollow?.();
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=events-tail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events-tail.js","sourceRoot":"","sources":["../../src/dashboard-rpc/events-tail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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AE,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;YACvC,OAAM;QACR,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IAC3C,CAAC,EACD,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE,CACrB,CAAA;IAED,OAAO,GAAG,EAAE;QACV,OAAO,GAAG,IAAI,CAAA;QACd,IAAI,OAAO;YAAE,YAAY,CAAC,OAAO,CAAC,CAAA;QAClC,UAAU,EAAE,EAAE,CAAA;IAChB,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { OpenAgentEvent } from '../events.js';
|
|
2
|
+
/**
|
|
3
|
+
* The end-of-replay marker (#1383). A subscribe replays the whole log before following live,
|
|
4
|
+
* and without a boundary a reconnecting client cannot tell "replay still streaming" from "the
|
|
5
|
+
* log is genuinely this short" — so it blanked a populated feed and refilled it line by line.
|
|
6
|
+
* Sent once per subscription, after the on-disk replay is delivered. Wire-only: it is not a
|
|
7
|
+
* {@link OpenAgentEvent}, is never written to any journal, and the client swallows it.
|
|
8
|
+
*/
|
|
9
|
+
export type StreamSync = {
|
|
10
|
+
kind: 'stream-sync';
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The message the agent is writing, as far as it has got (the run's live file, beside its diary);
|
|
14
|
+
* empty once there is none. Wire-only like {@link StreamSync}: the pieces are never in the diary,
|
|
15
|
+
* and the page shows them until the whole message's line arrives.
|
|
16
|
+
*/
|
|
17
|
+
export type PartialMessage = {
|
|
18
|
+
kind: 'partial';
|
|
19
|
+
text: string;
|
|
20
|
+
};
|
|
21
|
+
/** What `onEvents` streams: the agent's events, plus the wire-only end-of-replay marker and partial message. */
|
|
22
|
+
export type LiveFeedEvent = OpenAgentEvent | StreamSync | PartialMessage;
|
|
23
|
+
/**
|
|
24
|
+
* Follow one agent's events: `send` is called per event until the returned stop function runs.
|
|
25
|
+
* Returns undefined when there is nothing to stream (an unknown project), which the mount ends as
|
|
26
|
+
* a clean close — mirroring the read model's empty results rather than throwing at the client.
|
|
27
|
+
*
|
|
28
|
+
* The `agentId` names the run whose diary is followed; without one there is nothing to stream.
|
|
29
|
+
*
|
|
30
|
+
* Two sources, chosen by what is wired. An in-memory stream wins: an agent the daemon is relaying
|
|
31
|
+
* from a device (#1067). Otherwise the on-disk log. The daemon's source answers only for relayed
|
|
32
|
+
* runs, so an ordinary local agent falls through to tailing the log.
|
|
33
|
+
*
|
|
34
|
+
* Only the on-disk tail sends the {@link StreamSync} marker: the in-memory sources have no replay
|
|
35
|
+
* boundary to report, so a reconnecting client falls back to a grace deadline before swapping its
|
|
36
|
+
* feed (see use-live-events in the dashboard).
|
|
37
|
+
*/
|
|
38
|
+
export declare function streamAgentEvents(projectId: string, agentId: string | undefined, send: (value: LiveFeedEvent) => void, onDone?: () => void): Promise<(() => void) | undefined>;
|
|
39
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/dashboard-rpc/events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAclD;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAA;AAEhD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9D,gHAAgH;AAChH,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,UAAU,GAAG,cAAc,CAAA;AAExE;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,EACpC,MAAM,CAAC,EAAE,MAAM,IAAI,GAClB,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAqBnC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { fromDiaryLine, resolveAgentDiary } from '../store/index.js';
|
|
2
|
+
import { contextEventsSource, resolveProjectPath } from './context.js';
|
|
3
|
+
import { partialReader, tailAgentEvents } from './events-tail.js';
|
|
4
|
+
import { forwardStream } from './stream-forward.js';
|
|
5
|
+
// The live event stream behind the dashboard (#405): the selected run's diary, the file the run's
|
|
6
|
+
// tool writes as the agent works. Each new line becomes one `send(event)`, which the mount writes
|
|
7
|
+
// out as one SSE frame. Runs, docs, and the project log come over the read-model RPCs (reads.ts).
|
|
8
|
+
/** The diary to follow, or undefined when the project or the run is unknown. */
|
|
9
|
+
async function resolveEventsDiary(projectId, agentId, opts = {}) {
|
|
10
|
+
const cwd = await resolveProjectPath(projectId);
|
|
11
|
+
return cwd ? resolveAgentDiary(cwd, agentId, undefined, undefined, opts) : undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Follow one agent's events: `send` is called per event until the returned stop function runs.
|
|
15
|
+
* Returns undefined when there is nothing to stream (an unknown project), which the mount ends as
|
|
16
|
+
* a clean close — mirroring the read model's empty results rather than throwing at the client.
|
|
17
|
+
*
|
|
18
|
+
* The `agentId` names the run whose diary is followed; without one there is nothing to stream.
|
|
19
|
+
*
|
|
20
|
+
* Two sources, chosen by what is wired. An in-memory stream wins: an agent the daemon is relaying
|
|
21
|
+
* from a device (#1067). Otherwise the on-disk log. The daemon's source answers only for relayed
|
|
22
|
+
* runs, so an ordinary local agent falls through to tailing the log.
|
|
23
|
+
*
|
|
24
|
+
* Only the on-disk tail sends the {@link StreamSync} marker: the in-memory sources have no replay
|
|
25
|
+
* boundary to report, so a reconnecting client falls back to a grace deadline before swapping its
|
|
26
|
+
* feed (see use-live-events in the dashboard).
|
|
27
|
+
*/
|
|
28
|
+
export async function streamAgentEvents(projectId, agentId, send, onDone) {
|
|
29
|
+
const stream = contextEventsSource()(projectId, agentId);
|
|
30
|
+
// An in-memory agent: replay + follow it, and end when it ends — a relayed agent that finished has
|
|
31
|
+
// nothing more to say, and leaving the response open would read as a live feed gone quiet.
|
|
32
|
+
if (stream)
|
|
33
|
+
return forwardStream(stream, send, onDone);
|
|
34
|
+
// Everywhere else: tail the run's diary. The relocating tail, because the diary moves
|
|
35
|
+
// mid-subscription: when the run ends its tool records it and reclaims the checkout, and a
|
|
36
|
+
// fixed-path tail whose fs.watch missed the final appends went silent without the run's `end`.
|
|
37
|
+
// On the move it asks again and sends the finished run's lines it had not sent, so the feed
|
|
38
|
+
// gets exactly the lines the move would have swallowed.
|
|
39
|
+
if ((await resolveEventsDiary(projectId, agentId)) === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
return tailAgentEvents(opts => resolveEventsDiary(projectId, agentId, opts), line => {
|
|
42
|
+
const event = fromDiaryLine(line);
|
|
43
|
+
if (event)
|
|
44
|
+
send(event);
|
|
45
|
+
}, () => send({ kind: 'stream-sync' }), partialReader(text => send({ kind: 'partial', text })));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/dashboard-rpc/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAA4C,MAAM,mBAAmB,CAAA;AAC9G,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEtE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,kGAAkG;AAClG,kGAAkG;AAClG,kGAAkG;AAElG,gFAAgF;AAChF,KAAK,UAAU,kBAAkB,CAAC,SAAiB,EAAE,OAAgB,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, onAgentsDoing, onDocs, onQueue, onOverview, onRecentAgents, onInterventions, onOpenQuestions, onActivity, onDashboard, onGitHostHome, onRepositoryOffer, onGitStatus, onProjectFiles, onRetainedWorktrees, onAgentWorktree, onAgentHandoff, onBridgeQuestion, onBridgeStatus, onBridgeToken, onBridgeEvents, onBridgeAnswer, onBridgeBrowser } from './reads.js';
|
|
2
|
+
export { sendStop, sendChoice, sendBridgeAnswer, sendBridgeAnswerCancel, sendBridgeBrowser, sendMessage, sendStart, sendOpenInApp, sendRemoveWorktree, sendDeleteAgent, sendOpenPullRequest, sendPush, sendMergeBranch, sendMerge, sendCreateRepository } from './control.js';
|
|
3
|
+
export { streamAgentEvents, type LiveFeedEvent, type PartialMessage, type StreamSync } from './events.js';
|
|
4
|
+
export { onProjects, sendAddProject, sendRemoveProject, onRecordsReach, sendShareRecords, sendPickProjectDirectory, onOnboarding, onCommands, onStartCheck, type ProjectLauncher } from './projects.js';
|
|
5
|
+
export { onPreferences, savePreferences, patchPreferences, onProjectPresets, saveProjectPresets, onEditors, type SavePreferencesResult, type PatchPreferencesResult, } from './preferences.js';
|
|
6
|
+
export { type EditorInfo } from '../dashboard/open-in-app.js';
|
|
7
|
+
export { onQuota } from './quota.js';
|
|
8
|
+
export { onModels } from './models.js';
|
|
9
|
+
export { checkDevices, type DeviceCheck } from './devices.js';
|
|
10
|
+
export { onModules, runModuleCommand, readModule, type DashboardModule, type ModuleCommandResult, type ModuleReadResult } from './modules.js';
|
|
11
|
+
import { streamAgentEvents } from './events.js';
|
|
12
|
+
/** One RPC: called with whatever the browser sent, answering with whatever JSON.stringify keeps. */
|
|
13
|
+
export type RpcHandler = (...args: never[]) => unknown;
|
|
14
|
+
/**
|
|
15
|
+
* Every RPC the mount will answer, by name.
|
|
16
|
+
*
|
|
17
|
+
* Built from the modules' own exports rather than listed by hand, so a function that is exported
|
|
18
|
+
* and simply never registered — the failure that shipped per-project preferences broken (#866),
|
|
19
|
+
* a 400 and nothing else — cannot happen: the name IS the export name.
|
|
20
|
+
*
|
|
21
|
+
* Null-prototype, because the name is a path segment off an unauthenticated request and this table
|
|
22
|
+
* is indexed by it directly. With `Object.prototype` behind it, `POST /_rpc/constructor` found
|
|
23
|
+
* `Object` and answered 200 with whatever it was handed, and `__proto__` / `toString` / `valueOf`
|
|
24
|
+
* were reachable too — 500s rather than the 404 a name that is not an RPC has to get.
|
|
25
|
+
*/
|
|
26
|
+
export declare const RPC_HANDLERS: Record<string, RpcHandler>;
|
|
27
|
+
/** The live event stream, which is a subscription rather than a call — see `rpc-serve.ts`. */
|
|
28
|
+
export declare const RPC_EVENT_STREAM: typeof streamAgentEvents;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dashboard-rpc/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5X,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,mBAAmB,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAC7Q,OAAO,EAAE,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AACzG,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AACvM,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAU7I,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/C,oGAAoG;AACpG,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAA;AAEtD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAOnD,CAAA;AAED,8FAA8F;AAC9F,eAAO,MAAM,gBAAgB,0BAAoB,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// The dashboard's RPC surface (#405), served in-process by the daemon so `sendStart` can reach
|
|
2
|
+
// the daemon's own `startAgent`. The browser calls these by name over `POST /_rpc/<name>`; the
|
|
3
|
+
// dashboard's `rpc/` modules are typed stubs against these signatures, so a rename that misses
|
|
4
|
+
// one is a type error rather than a 404 at runtime.
|
|
5
|
+
export { onAgents, onAgent, onAgentsDoing, onDocs, onQueue, onOverview, onRecentAgents, onInterventions, onOpenQuestions, onActivity, onDashboard, onGitHostHome, onRepositoryOffer, onGitStatus, onProjectFiles, onRetainedWorktrees, onAgentWorktree, onAgentHandoff, onBridgeQuestion, onBridgeStatus, onBridgeToken, onBridgeEvents, onBridgeAnswer, onBridgeBrowser } from './reads.js';
|
|
6
|
+
export { sendStop, sendChoice, sendBridgeAnswer, sendBridgeAnswerCancel, sendBridgeBrowser, sendMessage, sendStart, sendOpenInApp, sendRemoveWorktree, sendDeleteAgent, sendOpenPullRequest, sendPush, sendMergeBranch, sendMerge, sendCreateRepository } from './control.js';
|
|
7
|
+
export { streamAgentEvents } from './events.js';
|
|
8
|
+
export { onProjects, sendAddProject, sendRemoveProject, onRecordsReach, sendShareRecords, sendPickProjectDirectory, onOnboarding, onCommands, onStartCheck } from './projects.js';
|
|
9
|
+
export { onPreferences, savePreferences, patchPreferences, onProjectPresets, saveProjectPresets, onEditors, } from './preferences.js';
|
|
10
|
+
export { onQuota } from './quota.js';
|
|
11
|
+
export { onModels } from './models.js';
|
|
12
|
+
export { checkDevices } from './devices.js';
|
|
13
|
+
export { onModules, runModuleCommand, readModule } from './modules.js';
|
|
14
|
+
import * as reads from './reads.js';
|
|
15
|
+
import * as control from './control.js';
|
|
16
|
+
import * as projects from './projects.js';
|
|
17
|
+
import * as preferences from './preferences.js';
|
|
18
|
+
import * as quota from './quota.js';
|
|
19
|
+
import * as models from './models.js';
|
|
20
|
+
import * as devices from './devices.js';
|
|
21
|
+
import * as modules from './modules.js';
|
|
22
|
+
import { streamAgentEvents } from './events.js';
|
|
23
|
+
/**
|
|
24
|
+
* Every RPC the mount will answer, by name.
|
|
25
|
+
*
|
|
26
|
+
* Built from the modules' own exports rather than listed by hand, so a function that is exported
|
|
27
|
+
* and simply never registered — the failure that shipped per-project preferences broken (#866),
|
|
28
|
+
* a 400 and nothing else — cannot happen: the name IS the export name.
|
|
29
|
+
*
|
|
30
|
+
* Null-prototype, because the name is a path segment off an unauthenticated request and this table
|
|
31
|
+
* is indexed by it directly. With `Object.prototype` behind it, `POST /_rpc/constructor` found
|
|
32
|
+
* `Object` and answered 200 with whatever it was handed, and `__proto__` / `toString` / `valueOf`
|
|
33
|
+
* were reachable too — 500s rather than the 404 a name that is not an RPC has to get.
|
|
34
|
+
*/
|
|
35
|
+
export const RPC_HANDLERS = Object.assign(Object.create(null), Object.fromEntries([reads, control, projects, preferences, quota, models, devices, modules]
|
|
36
|
+
.flatMap(module => Object.entries(module))
|
|
37
|
+
.filter((entry) => typeof entry[1] === 'function')));
|
|
38
|
+
/** The live event stream, which is a subscription rather than a call — see `rpc-serve.ts`. */
|
|
39
|
+
export const RPC_EVENT_STREAM = streamAgentEvents;
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dashboard-rpc/index.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,+FAA+F;AAC/F,+FAA+F;AAC/F,oDAAoD;AACpD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5X,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,mBAAmB,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAC7Q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AAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KACzC,MAAM,CAAC,CAAC,KAAK,EAAiC,EAAE,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CACpF,CACF,CAAA;AAED,8FAA8F;AAC9F,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/dashboard-rpc/models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAKxD,uEAAuE;AACvE,wBAAgB,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC,CAE9C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { contextModels } from './context.js';
|
|
2
|
+
// The agent and model menu's surface: which models each coding agent offers, as the daemon asked
|
|
3
|
+
// them. The source is wired into the dashboard context by the daemon.
|
|
4
|
+
/** Which models each coding agent offers, or why one could not say. */
|
|
5
|
+
export function onModels() {
|
|
6
|
+
return contextModels().read();
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/dashboard-rpc/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAG5C,iGAAiG;AACjG,sEAAsE;AAEtE,uEAAuE;AACvE,MAAM,UAAU,QAAQ;IACtB,OAAO,aAAa,EAAE,CAAC,IAAI,EAAE,CAAA;AAC/B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ModuleCommandResult } from '../project-modules.js';
|
|
2
|
+
import { type ModuleReadResult } from '../dashboard/module-host.js';
|
|
3
|
+
export type { ModuleCommandResult } from '../project-modules.js';
|
|
4
|
+
export type { ModuleReadResult } from '../dashboard/module-host.js';
|
|
5
|
+
/** One module as the dashboard loads it: where its module is, and which projects have it. */
|
|
6
|
+
export interface DashboardModule {
|
|
7
|
+
/** The package that brings it. */
|
|
8
|
+
package: string;
|
|
9
|
+
/** The URL of its browser module, served from the first project that has it. */
|
|
10
|
+
url: string;
|
|
11
|
+
/** The registered projects whose packages include it, in the registry's order. */
|
|
12
|
+
projects: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Every module any registered project brings (#1774), one per package, with the projects
|
|
16
|
+
* that have it: with no project picked the sidebar and the pages are every project's, and the
|
|
17
|
+
* dashboard narrows them itself to a picked project's. A package several projects install is loaded once, from
|
|
18
|
+
* the first of them in the registry's order; its page then reads each project through that
|
|
19
|
+
* project's own command. A project that cannot be read contributes nothing.
|
|
20
|
+
*/
|
|
21
|
+
export declare function onModules(): Promise<DashboardModule[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Run one of a module package's commands in one project and answer its JSON output: how a module
|
|
24
|
+
* reads (and changes) its own data. Refused for an unknown project and for a package that is not a
|
|
25
|
+
* module of that project, so a page can run only its own package's commands, never an arbitrary
|
|
26
|
+
* program. Once the command has run, OpenAgent forgets what it had read of that project's
|
|
27
|
+
* provided data (its queue, its runs): the command may have written it, and the next read sees
|
|
28
|
+
* that at once instead of a cached copy.
|
|
29
|
+
*
|
|
30
|
+
* `acts` says the command is a module's action on the project (a link action), not a page's read:
|
|
31
|
+
* OpenAgent then also converges the project's data branch with origin, as its clock does
|
|
32
|
+
* every minute, before forgetting — in a project that shares its records a package's command
|
|
33
|
+
* writes as a remote writer, straight to origin, and this machine's copy would otherwise show the
|
|
34
|
+
* write only at the next sync.
|
|
35
|
+
*/
|
|
36
|
+
export declare function runModuleCommand(projectId: string, pkg: string, args: string[], command?: string, acts?: boolean): Promise<ModuleCommandResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Call read `name` of a module's server part in one project: how a module's browser part reads
|
|
39
|
+
* what a command cannot answer fast enough. Refused for an unknown project, a package that is not
|
|
40
|
+
* a module of that project, and a module with no server part. A read whose input names a run this
|
|
41
|
+
* daemon relays to a connected device (`input.agentId`) is read over there, by that device's own
|
|
42
|
+
* copy of the module, since the run's checkout is there.
|
|
43
|
+
*/
|
|
44
|
+
export declare function readModule(projectId: string, pkg: string, name: string, input: unknown): Promise<ModuleReadResult>;
|
|
45
|
+
//# sourceMappingURL=modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../src/dashboard-rpc/modules.ts"],"names":[],"mappings":"AACA,OAAO,EAAyE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAGvI,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAI/F,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAEnE,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAA;IACX,kFAAkF;IAClF,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAW5D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,UAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAUnJ;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAUxH"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { contextProjects, resolveProjectPath } from './context.js';
|
|
2
|
+
import { findProjectModule, readProjectModules, runModuleCommand as runCommand } from '../project-modules.js';
|
|
3
|
+
import { moduleUrl } from '../dashboard/module-serve.js';
|
|
4
|
+
import { providedDataChanged } from '../store/provided.js';
|
|
5
|
+
import { callModuleRead, serverHost } from '../dashboard/module-host.js';
|
|
6
|
+
import { relayOr } from './relay-agent.js';
|
|
7
|
+
import { DATA_BRANCH, pullFileBranch } from '@openagt/agent-data';
|
|
8
|
+
/**
|
|
9
|
+
* Every module any registered project brings (#1774), one per package, with the projects
|
|
10
|
+
* that have it: with no project picked the sidebar and the pages are every project's, and the
|
|
11
|
+
* dashboard narrows them itself to a picked project's. A package several projects install is loaded once, from
|
|
12
|
+
* the first of them in the registry's order; its page then reads each project through that
|
|
13
|
+
* project's own command. A project that cannot be read contributes nothing.
|
|
14
|
+
*/
|
|
15
|
+
export async function onModules() {
|
|
16
|
+
const byPackage = new Map();
|
|
17
|
+
for (const project of await contextProjects().list()) {
|
|
18
|
+
const modules = await readProjectModules(project.path).catch(() => []);
|
|
19
|
+
for (const module of modules) {
|
|
20
|
+
const known = byPackage.get(module.package);
|
|
21
|
+
if (known)
|
|
22
|
+
known.projects.push(project.id);
|
|
23
|
+
else
|
|
24
|
+
byPackage.set(module.package, { package: module.package, url: moduleUrl(project.id, module), projects: [project.id] });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return [...byPackage.values()];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Run one of a module package's commands in one project and answer its JSON output: how a module
|
|
31
|
+
* reads (and changes) its own data. Refused for an unknown project and for a package that is not a
|
|
32
|
+
* module of that project, so a page can run only its own package's commands, never an arbitrary
|
|
33
|
+
* program. Once the command has run, OpenAgent forgets what it had read of that project's
|
|
34
|
+
* provided data (its queue, its runs): the command may have written it, and the next read sees
|
|
35
|
+
* that at once instead of a cached copy.
|
|
36
|
+
*
|
|
37
|
+
* `acts` says the command is a module's action on the project (a link action), not a page's read:
|
|
38
|
+
* OpenAgent then also converges the project's data branch with origin, as its clock does
|
|
39
|
+
* every minute, before forgetting — in a project that shares its records a package's command
|
|
40
|
+
* writes as a remote writer, straight to origin, and this machine's copy would otherwise show the
|
|
41
|
+
* write only at the next sync.
|
|
42
|
+
*/
|
|
43
|
+
export async function runModuleCommand(projectId, pkg, args, command, acts = false) {
|
|
44
|
+
const root = await resolveProjectPath(projectId);
|
|
45
|
+
if (!root)
|
|
46
|
+
return { ok: false, error: 'unknown project' };
|
|
47
|
+
if (!Array.isArray(args))
|
|
48
|
+
return { ok: false, error: 'arguments must be a list' };
|
|
49
|
+
const module = await findProjectModule(root, pkg);
|
|
50
|
+
if (!module)
|
|
51
|
+
return { ok: false, error: `${pkg} brings no module to this project` };
|
|
52
|
+
const result = await runCommand(root, module, args, command);
|
|
53
|
+
if (acts)
|
|
54
|
+
await pullFileBranch(root, DATA_BRANCH, { log: () => { } }).catch(() => { });
|
|
55
|
+
providedDataChanged(root);
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Call read `name` of a module's server part in one project: how a module's browser part reads
|
|
60
|
+
* what a command cannot answer fast enough. Refused for an unknown project, a package that is not
|
|
61
|
+
* a module of that project, and a module with no server part. A read whose input names a run this
|
|
62
|
+
* daemon relays to a connected device (`input.agentId`) is read over there, by that device's own
|
|
63
|
+
* copy of the module, since the run's checkout is there.
|
|
64
|
+
*/
|
|
65
|
+
export async function readModule(projectId, pkg, name, input) {
|
|
66
|
+
const agentId = input && typeof input === 'object' && typeof input.agentId === 'string' ? input.agentId : undefined;
|
|
67
|
+
return relayOr(agentId, 'readModule', [projectId, pkg, name, input], async () => {
|
|
68
|
+
const root = await resolveProjectPath(projectId);
|
|
69
|
+
if (!root)
|
|
70
|
+
return { ok: false, error: 'unknown project' };
|
|
71
|
+
const module = await findProjectModule(root, pkg).catch(() => undefined);
|
|
72
|
+
if (!module)
|
|
73
|
+
return { ok: false, error: `${pkg} is no module of this project` };
|
|
74
|
+
if (!module.server)
|
|
75
|
+
return { ok: false, error: `${pkg} has no server part` };
|
|
76
|
+
return callModuleRead(module.server, name, serverHost(root), input);
|
|
77
|
+
}, { ok: false, error: 'the device this run works on did not answer' });
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../src/dashboard-rpc/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,IAAI,UAAU,EAA4B,MAAM,uBAAuB,CAAA;AACvI,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,UAAU,EAAyB,MAAM,6BAA6B,CAAA;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAejE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,SAAS,GAAG,IAAI,GAAG,EAA2B,CAAA;IACpD,KAAK,MAAM,OAAO,IAAI,MAAM,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;QACrD,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;QACtE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YAC3C,IAAI,KAAK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