Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/app/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { ArtifactStorageService } from "../features/artifact-storage/service";
import { createAdminAccess } from "../bundled/admin-access";
import { nativeRelayStaff } from "../features/relay-staff/native";
import { createLocalAgentActivity } from "../features/agents/local-activity";
import { link } from "../features/agents/link";
import { linkedActivity, serveActivity } from "../features/agents/runner-link";
// FOUNDATION: Compose the bundled distribution, plugin runtime, and services here.
import {
createIdentity,
Expand Down Expand Up @@ -61,6 +63,20 @@ export function createServices() {
});
const localAgents = createLocalAgents();
const localActivity = createLocalAgentActivity();
// The Manager, which the screens use, and the Runner, which runs agents,
// share this page for now. Only JSON crosses the link between them.
const agentsLink = new MessageChannel();
const runnerLink = link(
agentsLink.port1,
serveActivity(localActivity.reader),
);
const managerLink = link(agentsLink.port2);
const runnerActivity = linkedActivity(managerLink);
ctx.effect(() => () => {
runnerActivity.stop();
managerLink.close();
runnerLink.close();
});
const navigationHost = provideNavigation(ctx);
const navigation = navigationHost.navigation;
const browser = new BrowserService(ctx);
Expand All @@ -82,7 +98,7 @@ export function createServices() {
localAgents.agents,
identity?.ready,
identity ? connectNativeTransport : undefined,
localActivity.reader,
runnerActivity.source,
);
ctx.provide("communityReader", {
snapshot: communities.snapshot,
Expand Down
Loading
Loading