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.7
Permissions in 0.2.7
Files
contract.ts2 KB
// The divergence/tabs service: other plugins open and close files, diffs,
// terminals and diagrams, which are this plugin's tab kinds and show in the
// side split or a task's pane (specs/tasks-and-splits/05), and follow which
// one is visible. Zod is the contract; the host
// derives JSON Schema from it and checks every call, result and event.
import * as z from "zod";
import { defineService } from "divergence/services";
export const TabKind = z.enum(["file", "diff", "terminal", "diagram"]);
// Which tab: tabs are known by kind, path (a terminal's path is its id) and
// workspace, since two workspaces can hold the same relative path. A ref
// without a workspace names the first tab of that kind and path.
export const TabRef = z.object({ kind: TabKind, path: z.string(), workspaceId: z.string().optional() });
export const OpenTab = z.object({
kind: TabKind,
workspaceId: z.string(),
path: z.string(),
// A diff tab shows this unified diff; a diagram tab draws this source of
// a markdown fence of `language`.
diff: z.string().optional(),
// A diff of the working tree (false) or of the index (true): the tab then
// reads it again whenever the file or the index changes. Without it the
// diff is a snapshot, as a turn's diff is.
staged: z.boolean().optional(),
source: z.string().optional(),
language: z.string().optional(),
title: z.string().optional(),
icon: z.string().optional(),
// A file tab's editor takes the keyboard once it shows: a file the
// user picked from a list.
focus: z.boolean().optional(),
// The chat it comes from (a diff from a tool call, a diagram from a
// reply): the tab then belongs to that chat's task.
chatId: z.string().optional(),
});
export const Tabs = defineService("divergence/tabs", "2.1.0", {
methods: {
open: { params: OpenTab, result: z.object({ id: z.string() }) },
close: { params: TabRef, result: z.null() },
active: { params: z.object({}), result: TabRef.nullable() },
},
events: {
activeChanged: TabRef.nullable(),
},
});
export type Tabs = typeof Tabs;
No comments yet.