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

  • Control chats chats.controlHighCreates chats, sends prompts and cancels runs.Send prompts, answer agent questions, and create, change, fork, revert, stop and group chats
  • Run other plugins' commands commands.runHighRuns commands of other plugins.Run the sidebar's New chat command from the title bar, and its Close Chat and Reopen Closed Chat for Cmd+W and Cmd+Shift+T on a chat's only tab
  • Read chats chats.readMediumReads your transcripts and chat lists.Show workspaces, tasks, chats and transcripts, and follow them as agents work
  • Read files fs.readMediumReads files in the listed places.Suggest workspace files for @ mentionsPlaces: the open workspace
  • Show panels ui.slotsAlways grantedShows views in the listed parts of the window.Draw the chat grid, the title bar, and the Session panel with its rail buttonSlots: centertitlerailright

Files

question-fields.ts2.3 KB
// What a question card shows and answers: each field's answer is what the
// user gave, else the field's default; a field whose `when` conditions do
// not hold is hidden and answers nothing.
import type { QuestionCondition, QuestionField } from "divergence";

export type AnswerValue = string | number | boolean | string[];
export type Answers = Record<string, unknown>;

/// The field's answer: the user's, else its default.
export function answerOf(field: QuestionField, answers: Answers): unknown {
  const given = answers[field.id];
  return given === undefined || given === null || given === "" ? field.default : given;
}

function holds(condition: QuestionCondition, value: unknown) {
  if (value === undefined || value === null || value === "") return false;
  const hit = Array.isArray(value) ? value.includes(condition.value) : value === condition.value;
  return condition.op === "eq" ? hit : !hit;
}

/// The fields that show, in order. A condition on a hidden field does not
/// hold, so hiding one field hides every field that depends on it.
export function visibleFields(fields: readonly QuestionField[], answers: Answers): QuestionField[] {
  const shown = new Map<string, QuestionField>();
  for (const field of fields) {
    const visible = (field.when ?? []).every((condition) => {
      const on = shown.get(condition.field);
      return on !== undefined && holds(condition, answerOf(on, answers));
    });
    if (visible) shown.set(field.id, field);
  }
  return [...shown.values()];
}

/// The answer sent for a card: every shown field that has an answer or a
/// default, and nothing for a hidden one.
export function submittedValues(fields: readonly QuestionField[], answers: Answers): Record<string, unknown> {
  const values: Record<string, unknown> = {};
  for (const field of visibleFields(fields, answers)) {
    const value = answerOf(field, answers);
    if (value !== undefined && value !== null && value !== "") values[field.id] = value;
  }
  return values;
}

/// The answers worth keeping across a reload: never a secret one.
export function storableAnswers(fields: readonly QuestionField[], answers: Answers): Answers {
  const secret = new Set(fields.filter((field) => field.secret).map((field) => field.id));
  return Object.fromEntries(Object.entries(answers).filter(([id]) => !secret.has(id)));
}

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.2.9latestNov 21, 2026>=5 <6349 KB5 permissionsListed
0.2.8Nov 16, 2026>=5 <6348.6 KB5 permissionsListed
0.2.7Nov 11, 2026>=5 <6314.3 KB5 permissionsListed
0.2.6Nov 9, 2026>=5 <6306.2 KB5 permissionsListed
0.2.5Oct 27, 2026>=2 <4178.6 KB5 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.