Official
tabs
The tabbed detail pane beside the chat: files to edit and diffs (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/tabs@0.2.6
Permissions in 0.2.6
Files
reply.ts1.2 KB
// A reply to what is selected in a file, a diff or a Markdown preview goes
// to the chat plugin's prompt box, quoted with its place, while it runs.
import * as Effect from "effect/Effect";
import * as Stream from "effect/Stream";
import { Notify, Services } from "divergence/effect";
import type { EffectClient } from "divergence/effect";
import { quoteOf } from "./tabs.ts";
import type { CodeQuote, Tab } from "./tabs.ts";
import type { Chat } from "../chat/contract.ts";
export const makeReply = Effect.fn("Tabs.makeReply")(function* () {
const services = yield* Services;
const notify = yield* Notify;
const scope = yield* Effect.scope;
let chat: EffectClient<Chat> | undefined;
yield* services.when<Chat>("divergence/chat").pipe(
Stream.runForEach((option) =>
Effect.sync(() => {
chat = option._tag === "Some" ? option.value : undefined;
}),
),
Effect.forkIn(scope, { startImmediately: true }),
);
return Effect.fn("Tabs.reply")(function* (tab: Tab, quote: CodeQuote) {
if (!chat) return yield* notify.error("Replies need the chat plugin.");
yield* chat.quote({ text: quoteOf(tab.path, quote) }).pipe(Effect.catch((error) => notify.error(error.message)));
});
});
No comments yet.