Official
chat
Built-in chat UI (JavaScript UI plugin).
The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/chat@0.2.8
Permissions in 0.2.8
Files
open-in.ts2.5 KB
// "Open in": the chat's workspace folder in an editor, a terminal or the
// file manager on this machine, through the kernel's `open_in` methods. The
// app picked last is kept in the plugin's storage, so one click on the title
// strip's button opens it again.
import * as Effect from "effect/Effect";
import type { OpenInApp } from "divergence";
import type { Controller } from "./controller.ts";
const CHOSEN = "openIn";
const FINDER = "file-manager";
/** The apps on this machine and the one picked last. An older kernel has no `open_in.apps`: the list stays empty and
* the title strip shows no control. */
export const loadOpenIn = Effect.fn("Chat.loadOpenIn")(function* (c: Controller) {
const chosen = (yield* c.host.call("host/storage.get", { key: CHOSEN })).value;
if (typeof chosen === "string") c.state.openIn.chosen = chosen;
yield* listApps(c);
});
const listApps = (c: Controller) =>
c.kernel.call("open_in.apps", {}).pipe(
Effect.flatMap(({ apps }) =>
Effect.sync(() => {
c.state.openIn.apps = apps;
c.presentations?.updateAllTitles();
}),
),
Effect.catchTag("KernelCallFailed", (error) =>
error.message.startsWith("method not found")
? Effect.void
: c.notify.error(`The apps to open the workspace in could not be found: ${error.message}`),
),
);
/** The app the button opens: the one picked last while it is installed, else Finder, else the first one found. */
export function shownApp(c: Controller): OpenInApp | undefined {
const { apps, chosen } = c.state.openIn;
return apps.find((app) => app.id === chosen) ?? apps.find((app) => app.id === FINDER) ?? apps[0];
}
/** Opens the workspace's folder in `app` and remembers it once it opened, then lists the apps again, so one installed
* or removed since shows at the next look. An app that fails to open is not remembered, so the button keeps the app that
* works. */
export const openIn = Effect.fn("Chat.openIn")(function* (c: Controller, workspaceId: string, app: OpenInApp) {
const opened = yield* c.kernel.call("open_in", { app: app.id, workspaceId }).pipe(
Effect.as(true),
Effect.catchTag("KernelCallFailed", (error) =>
c.notify.error(`Could not open in ${app.name}: ${error.message}`).pipe(Effect.as(false)),
),
);
if (opened && c.state.openIn.chosen !== app.id) {
c.state.openIn.chosen = app.id;
c.presentations?.updateAllTitles();
yield* c.host.call("host/storage.set", { key: CHOSEN, value: app.id });
}
yield* listApps(c);
});Versions
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.2.9latest | Nov 21, 2026 | >=5 <6 | 349 KB | 5 permissions | Listed |
| 0.2.8 | Nov 16, 2026 | >=5 <6 | 348.6 KB | 5 permissions | Listed |
| 0.2.7 | Nov 11, 2026 | >=5 <6 | 314.3 KB | 5 permissions | Listed |
| 0.2.6 | Nov 9, 2026 | >=5 <6 | 306.2 KB | 5 permissions | Listed |
| 0.2.5 | Oct 27, 2026 | >=2 <4 | 178.6 KB | 5 permissions | Listed |
No comments yet.